From: support Date: Thu, 16 Mar 2023 12:44:07 +0000 (+0000) Subject: Built motion from commit 3c2ce842.|2.6.31 X-Git-Tag: 2.6.32~1 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=5083750143c3c88bdac459e1fc96a5f7f552fbd6;p=motion2.git Built motion from commit 3c2ce842.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 47b61a6..5324c94 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-03-16T12:23:29.310Z", + "time": "2023-03-16T12:37:09.018Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5a0a4ec..ff164a4 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-16T12:23:29.310Z", + "time": "2023-03-16T12:37:09.018Z", "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 ab1e43e..a8eada8 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 _0xd62d=['action','STRING','contactManager','integration','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)]','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]','exports','VIRTUAL'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd62d,0x1a7));var _0xdd62=function(_0x5e47c2,_0x3e8a16){_0x5e47c2=_0x5e47c2-0x0;var _0xa33644=_0xd62d[_0x5e47c2];return _0xa33644;};'use strict';var Sequelize=require('sequelize');module[_0xdd62('0x0')]={'name':{'type':Sequelize[_0xdd62('0x1')],'get':function(_0x449cf2){return this['getDataValue'](_0xdd62('0x2'));}},'action':{'type':Sequelize[_0xdd62('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xdd62('0x4'),_0xdd62('0x5'),'motionbar','jscripty',_0xdd62('0x6'),'browser','bot',_0xdd62('0x7')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xdd62('0x8')},'data1':{'type':Sequelize[_0xdd62('0x3')](0x1000),'comment':_0xdd62('0x9')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xdd62('0xa')},'data3':{'type':Sequelize[_0xdd62('0x3')](0x1000),'comment':_0xdd62('0xb')},'data4':{'type':Sequelize[_0xdd62('0x3')](0x1000),'comments':_0xdd62('0xc')},'data5':{'type':Sequelize[_0xdd62('0x3')](0x1000),'comments':_0xdd62('0xd')},'data6':{'type':Sequelize[_0xdd62('0x3')],'comments':_0xdd62('0xe')},'data7':{'type':Sequelize[_0xdd62('0xf')],'comments':_0xdd62('0x10')}}; \ No newline at end of file +var _0x7ac9=['urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','bot','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT'];(function(_0x2b9316,_0x26a84f){var _0x27fc1d=function(_0x18ca01){while(--_0x18ca01){_0x2b9316['push'](_0x2b9316['shift']());}};_0x27fc1d(++_0x26a84f);}(_0x7ac9,0x10b));var _0x97ac=function(_0x34ba14,_0x661b8e){_0x34ba14=_0x34ba14-0x0;var _0x515519=_0x7ac9[_0x34ba14];return _0x515519;};'use strict';var Sequelize=require(_0x97ac('0x0'));module[_0x97ac('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x70853f){return this[_0x97ac('0x2')](_0x97ac('0x3'));}},'action':{'type':Sequelize[_0x97ac('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x97ac('0x5'),_0x97ac('0x6'),'motionbar','jscripty','urlForward','browser',_0x97ac('0x7'),'script']],'msg':_0x97ac('0x8')}},'comment':_0x97ac('0x8')},'data1':{'type':Sequelize[_0x97ac('0x4')](0x1000),'comment':_0x97ac('0x9')},'data2':{'type':Sequelize[_0x97ac('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['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x97ac('0x4')](0x1000),'comments':_0x97ac('0xa')},'data5':{'type':Sequelize[_0x97ac('0x4')](0x1000),'comments':_0x97ac('0xb')},'data6':{'type':Sequelize[_0x97ac('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x97ac('0xc')],'comments':_0x97ac('0xd')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4f3df7a..52d6d85 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 _0x8cf2=['desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','Action','catch','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x86b150,_0x56ba66){var _0x8d49a9=function(_0x110ac5){while(--_0x110ac5){_0x86b150['push'](_0x86b150['shift']());}};_0x8d49a9(++_0x56ba66);}(_0x8cf2,0x75));var _0x28cf=function(_0x273769,_0x16e425){_0x273769=_0x273769-0x0;var _0x299a39=_0x8cf2[_0x273769];return _0x299a39;};'use strict';var emlformat=require(_0x28cf('0x0'));var rimraf=require(_0x28cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28cf('0x2'));var rp=require(_0x28cf('0x3'));var moment=require(_0x28cf('0x4'));var BPromise=require(_0x28cf('0x5'));var Mustache=require(_0x28cf('0x6'));var util=require(_0x28cf('0x7'));var path=require(_0x28cf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28cf('0x9'));var fs=require('fs');var fs_extra=require(_0x28cf('0xa'));var _=require(_0x28cf('0xb'));var squel=require(_0x28cf('0xc'));var crypto=require(_0x28cf('0xd'));var jsforce=require(_0x28cf('0xe'));var deskjs=require(_0x28cf('0xf'));var toCsv=require(_0x28cf('0x10'));var querystring=require(_0x28cf('0x11'));var Papa=require(_0x28cf('0x12'));var Redis=require('ioredis');var authService=require(_0x28cf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x28cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x28cf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x28cf('0x16'))['db'];function respondWithStatusCode(_0x56f1ad,_0x28d834){_0x28d834=_0x28d834||0xcc;return function(_0xbcd767){if(_0xbcd767){return _0x56f1ad[_0x28cf('0x17')](_0x28d834);}return _0x56f1ad['status'](_0x28d834)[_0x28cf('0x18')]();};}function respondWithResult(_0x4150f9,_0x2c239b){_0x2c239b=_0x2c239b||0xc8;return function(_0x3862fb){if(_0x3862fb){return _0x4150f9[_0x28cf('0x19')](_0x2c239b)[_0x28cf('0x1a')](_0x3862fb);}};}function respondWithFilteredResult(_0x5e4b4a,_0x54aab5){return function(_0x5e8014){if(_0x5e8014){var _0x570015=typeof _0x54aab5[_0x28cf('0x1b')]===_0x28cf('0x1c')&&typeof _0x54aab5['limit']===_0x28cf('0x1c');var _0x2f9aa1=_0x5e8014['count'];var _0x419991=_0x570015?0x0:_0x54aab5['offset'];var _0x368575=_0x570015?_0x5e8014[_0x28cf('0x1d')]:_0x54aab5[_0x28cf('0x1b')]+_0x54aab5[_0x28cf('0x1e')];var _0x54f3e1;if(_0x368575>=_0x2f9aa1){_0x368575=_0x2f9aa1;_0x54f3e1=0xc8;}else{_0x54f3e1=0xce;}_0x5e4b4a[_0x28cf('0x19')](_0x54f3e1);return _0x5e4b4a[_0x28cf('0x1f')]('Content-Range',_0x419991+'-'+_0x368575+'/'+_0x2f9aa1)[_0x28cf('0x1a')](_0x5e8014);}return null;};}function patchUpdates(_0xfc6c53){return function(_0xdd692b){try{jsonpatch[_0x28cf('0x20')](_0xdd692b,_0xfc6c53,!![]);}catch(_0x5f3826){return BPromise['reject'](_0x5f3826);}return _0xdd692b[_0x28cf('0x21')]();};}function saveUpdates(_0x4503df,_0x335db0){return function(_0x15053b){if(_0x15053b){return _0x15053b[_0x28cf('0x22')](_0x4503df)[_0x28cf('0x23')](function(_0x402348){return _0x402348;});}return null;};}function removeEntity(_0xfa6b8c,_0x158d2d){return function(_0x368905){if(_0x368905){return _0x368905[_0x28cf('0x24')]()[_0x28cf('0x23')](function(){_0xfa6b8c[_0x28cf('0x19')](0xcc)[_0x28cf('0x18')]();});}};}function handleEntityNotFound(_0x40fb03,_0x2cf1c3){return function(_0x310813){if(!_0x310813){_0x40fb03[_0x28cf('0x17')](0x194);}return _0x310813;};}function handleError(_0x2492bc,_0x432573){_0x432573=_0x432573||0x1f4;return function(_0x3d38e1){logger[_0x28cf('0x25')](_0x3d38e1[_0x28cf('0x26')]);if(_0x3d38e1[_0x28cf('0x27')]){delete _0x3d38e1[_0x28cf('0x27')];}_0x2492bc[_0x28cf('0x19')](_0x432573)[_0x28cf('0x28')](_0x3d38e1);};}exports[_0x28cf('0x22')]=function(_0x14e916,_0x447359){if(_0x14e916['body']['id']){delete _0x14e916['body']['id'];}return db[_0x28cf('0x29')]['find']({'where':{'id':_0x14e916['params']['id']}})[_0x28cf('0x23')](handleEntityNotFound(_0x447359,null))[_0x28cf('0x23')](saveUpdates(_0x14e916['body'],null))[_0x28cf('0x23')](respondWithResult(_0x447359,null))[_0x28cf('0x2a')](handleError(_0x447359,null));};exports['destroy']=function(_0x394610,_0x20b290){return db[_0x28cf('0x29')]['find']({'where':{'id':_0x394610[_0x28cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x20b290,null))[_0x28cf('0x23')](removeEntity(_0x20b290,null))[_0x28cf('0x2a')](handleError(_0x20b290,null));}; \ No newline at end of file +var _0xf501=['desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','body','Action','catch','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce'];(function(_0x1a5f8c,_0x567ec1){var _0x383f3e=function(_0x153142){while(--_0x153142){_0x1a5f8c['push'](_0x1a5f8c['shift']());}};_0x383f3e(++_0x567ec1);}(_0xf501,0x191));var _0x1f50=function(_0x2afb88,_0x56949){_0x2afb88=_0x2afb88-0x0;var _0x2448c7=_0xf501[_0x2afb88];return _0x2448c7;};'use strict';var emlformat=require(_0x1f50('0x0'));var rimraf=require(_0x1f50('0x1'));var zipdir=require(_0x1f50('0x2'));var jsonpatch=require(_0x1f50('0x3'));var rp=require(_0x1f50('0x4'));var moment=require('moment');var BPromise=require(_0x1f50('0x5'));var Mustache=require(_0x1f50('0x6'));var util=require('util');var path=require(_0x1f50('0x7'));var sox=require(_0x1f50('0x8'));var csv=require(_0x1f50('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f50('0xa'));var _=require(_0x1f50('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1f50('0xc'));var deskjs=require(_0x1f50('0xd'));var toCsv=require(_0x1f50('0x9'));var querystring=require(_0x1f50('0xe'));var Papa=require(_0x1f50('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f50('0x10'));var as=require(_0x1f50('0x11'));var hardwareService=require(_0x1f50('0x12'));var logger=require(_0x1f50('0x13'))(_0x1f50('0x14'));var utils=require(_0x1f50('0x15'));var config=require(_0x1f50('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f50('0x17'))['db'];function respondWithStatusCode(_0x304c71,_0x4444c7){_0x4444c7=_0x4444c7||0xcc;return function(_0x2555ec){if(_0x2555ec){return _0x304c71['sendStatus'](_0x4444c7);}return _0x304c71[_0x1f50('0x18')](_0x4444c7)['end']();};}function respondWithResult(_0x3dddd4,_0x2ca675){_0x2ca675=_0x2ca675||0xc8;return function(_0x1a060e){if(_0x1a060e){return _0x3dddd4['status'](_0x2ca675)['json'](_0x1a060e);}};}function respondWithFilteredResult(_0x4b842f,_0x4c5bda){return function(_0x2727dd){if(_0x2727dd){var _0x349e7e=typeof _0x4c5bda[_0x1f50('0x19')]===_0x1f50('0x1a')&&typeof _0x4c5bda['limit']==='undefined';var _0x153a5d=_0x2727dd[_0x1f50('0x1b')];var _0xf1b9b8=_0x349e7e?0x0:_0x4c5bda[_0x1f50('0x19')];var _0x1540b5=_0x349e7e?_0x2727dd[_0x1f50('0x1b')]:_0x4c5bda['offset']+_0x4c5bda[_0x1f50('0x1c')];var _0x2e0b5c;if(_0x1540b5>=_0x153a5d){_0x1540b5=_0x153a5d;_0x2e0b5c=0xc8;}else{_0x2e0b5c=0xce;}_0x4b842f[_0x1f50('0x18')](_0x2e0b5c);return _0x4b842f[_0x1f50('0x1d')](_0x1f50('0x1e'),_0xf1b9b8+'-'+_0x1540b5+'/'+_0x153a5d)['json'](_0x2727dd);}return null;};}function patchUpdates(_0x35d7c4){return function(_0x148cd3){try{jsonpatch[_0x1f50('0x1f')](_0x148cd3,_0x35d7c4,!![]);}catch(_0x219ac8){return BPromise[_0x1f50('0x20')](_0x219ac8);}return _0x148cd3[_0x1f50('0x21')]();};}function saveUpdates(_0x3469e0,_0x2beaf8){return function(_0x29c02a){if(_0x29c02a){return _0x29c02a[_0x1f50('0x22')](_0x3469e0)['then'](function(_0x389e22){return _0x389e22;});}return null;};}function removeEntity(_0xfac5f,_0x294a7f){return function(_0x792a4d){if(_0x792a4d){return _0x792a4d[_0x1f50('0x23')]()[_0x1f50('0x24')](function(){_0xfac5f[_0x1f50('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221256,_0x2c6425){return function(_0x144484){if(!_0x144484){_0x221256['sendStatus'](0x194);}return _0x144484;};}function handleError(_0x86f744,_0x24275b){_0x24275b=_0x24275b||0x1f4;return function(_0x510291){logger[_0x1f50('0x25')](_0x510291[_0x1f50('0x26')]);if(_0x510291[_0x1f50('0x27')]){delete _0x510291['name'];}_0x86f744[_0x1f50('0x18')](_0x24275b)[_0x1f50('0x28')](_0x510291);};}exports[_0x1f50('0x22')]=function(_0x1cb699,_0x42abd0){if(_0x1cb699['body']['id']){delete _0x1cb699[_0x1f50('0x29')]['id'];}return db[_0x1f50('0x2a')]['find']({'where':{'id':_0x1cb699['params']['id']}})[_0x1f50('0x24')](handleEntityNotFound(_0x42abd0,null))['then'](saveUpdates(_0x1cb699[_0x1f50('0x29')],null))['then'](respondWithResult(_0x42abd0,null))[_0x1f50('0x2b')](handleError(_0x42abd0,null));};exports[_0x1f50('0x23')]=function(_0x5e69e8,_0x48d7f3){return db[_0x1f50('0x2a')][_0x1f50('0x2c')]({'where':{'id':_0x5e69e8[_0x1f50('0x2d')]['id']}})['then'](handleEntityNotFound(_0x48d7f3,null))['then'](removeEntity(_0x48d7f3,null))['catch'](handleError(_0x48d7f3,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 705a763..98d0a8f 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 _0xdb51=['define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0xdb51,0x145));var _0x1db5=function(_0xfb7bc0,_0x44ef58){_0xfb7bc0=_0xfb7bc0-0x0;var _0x40b7ee=_0xdb51[_0xfb7bc0];return _0x40b7ee;};'use strict';var _=require(_0x1db5('0x0'));var util=require(_0x1db5('0x1'));var logger=require(_0x1db5('0x2'))(_0x1db5('0x3'));var moment=require(_0x1db5('0x4'));var BPromise=require(_0x1db5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1db5('0x6'));var rimraf=require(_0x1db5('0x7'));var config=require(_0x1db5('0x8'));var attributes=require(_0x1db5('0x9'));module[_0x1db5('0xa')]=function(_0x168cfc,_0x3dfee1){return _0x168cfc[_0x1db5('0xb')](_0x1db5('0xc'),attributes,{'tableName':_0x1db5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x749c=['request-promise','rimraf','../../config/environment','./action.attributes','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x749c,0xc6));var _0xc749=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x749c[_0x55677b];return _0x104b88;};'use strict';var _=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var logger=require(_0xc749('0x2'))(_0xc749('0x3'));var moment=require(_0xc749('0x4'));var BPromise=require(_0xc749('0x5'));var rp=require(_0xc749('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc749('0x7'));var config=require(_0xc749('0x8'));var attributes=require(_0xc749('0x9'));module['exports']=function(_0x185a06,_0x3021f0){return _0x185a06['define'](_0xc749('0xa'),attributes,{'tableName':_0xc749('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 30b1836..e6c0a70 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xf494,0x1c6));var _0x4f49=function(_0x3d38df,_0x17e701){_0x3d38df=_0x3d38df-0x0;var _0x5d089d=_0xf494[_0x3d38df];return _0x5d089d;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x53ec,0x192));var _0xc53e=function(_0x14d9b7,_0x41650d){_0x14d9b7=_0x14d9b7-0x0;var _0x254b92=_0x53ec[_0x14d9b7];return _0x254b92;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 1c18fae..f6544c2 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 _0x30c8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./action.controller','/:id','update','delete','isAuthenticated','destroy','exports','util'];(function(_0x2cd04b,_0xd130f9){var _0x213da5=function(_0x2e0e68){while(--_0x2e0e68){_0x2cd04b['push'](_0x2cd04b['shift']());}};_0x213da5(++_0xd130f9);}(_0x30c8,0x192));var _0x830c=function(_0x3d00f1,_0x5d2bee){_0x3d00f1=_0x3d00f1-0x0;var _0x57149d=_0x30c8[_0x3d00f1];return _0x57149d;};'use strict';var multer=require('multer');var util=require(_0x830c('0x0'));var path=require(_0x830c('0x1'));var timeout=require(_0x830c('0x2'));var express=require('express');var router=express[_0x830c('0x3')]();var fs_extra=require(_0x830c('0x4'));var auth=require(_0x830c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x830c('0x6'));router['put'](_0x830c('0x7'),auth['isAuthenticated'](),controller[_0x830c('0x8')]);router[_0x830c('0x9')]('/:id',auth[_0x830c('0xa')](),controller[_0x830c('0xb')]);module[_0x830c('0xc')]=router; \ No newline at end of file +var _0xdf91=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete'];(function(_0x45b999,_0x39467f){var _0x449e7a=function(_0x1640fa){while(--_0x1640fa){_0x45b999['push'](_0x45b999['shift']());}};_0x449e7a(++_0x39467f);}(_0xdf91,0x16c));var _0x1df9=function(_0x4e1740,_0x146669){_0x4e1740=_0x4e1740-0x0;var _0x2c0378=_0xdf91[_0x4e1740];return _0x2c0378;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1df9('0x0'));var timeout=require(_0x1df9('0x1'));var express=require(_0x1df9('0x2'));var router=express['Router']();var fs_extra=require(_0x1df9('0x3'));var auth=require(_0x1df9('0x4'));var interaction=require(_0x1df9('0x5'));var config=require(_0x1df9('0x6'));var controller=require(_0x1df9('0x7'));router[_0x1df9('0x8')](_0x1df9('0x9'),auth[_0x1df9('0xa')](),controller[_0x1df9('0xb')]);router[_0x1df9('0xc')](_0x1df9('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 62b88ef..c4f5b1a 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 _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3a122a,_0x463edf){_0x3a122a=_0x3a122a-0x0;var _0x3ff86e=_0x1cb9[_0x3a122a];return _0x3ff86e;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','TEXT'];(function(_0x5b9be7,_0x384a46){var _0x1821fe=function(_0xe85826){while(--_0xe85826){_0x5b9be7['push'](_0x5b9be7['shift']());}};_0x1821fe(++_0x384a46);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index e867764..fc08fb6 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 _0xb77a=['sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','user','Reports','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%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','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','SUM(%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','keyBy','metric','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','join','../../files/reports','savename','countTable','COUNT(*)','run','runReport','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x155faf,_0x55d3e7){var _0x3316b3=function(_0x4c7f6a){while(--_0x4c7f6a){_0x155faf['push'](_0x155faf['shift']());}};_0x3316b3(++_0x55d3e7);}(_0xb77a,0x10f));var _0xab77=function(_0x50b196,_0x1ed90a){_0x50b196=_0x50b196-0x0;var _0x2fd701=_0xb77a[_0x50b196];return _0x2fd701;};'use strict';var emlformat=require(_0xab77('0x0'));var rimraf=require(_0xab77('0x1'));var zipdir=require(_0xab77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab77('0x3'));var moment=require('moment');var BPromise=require(_0xab77('0x4'));var Mustache=require(_0xab77('0x5'));var util=require(_0xab77('0x6'));var path=require(_0xab77('0x7'));var sox=require(_0xab77('0x8'));var csv=require(_0xab77('0x9'));var ejs=require(_0xab77('0xa'));var fs=require('fs');var fs_extra=require(_0xab77('0xb'));var _=require(_0xab77('0xc'));var squel=require(_0xab77('0xd'));var crypto=require(_0xab77('0xe'));var jsforce=require(_0xab77('0xf'));var deskjs=require(_0xab77('0x10'));var toCsv=require(_0xab77('0x9'));var querystring=require(_0xab77('0x11'));var Papa=require(_0xab77('0x12'));var Redis=require(_0xab77('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab77('0x14'));var logger=require(_0xab77('0x15'))('api');var utils=require(_0xab77('0x16'));var config=require(_0xab77('0x17'));var licenseUtil=require(_0xab77('0x18'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xab77('0x19')];function respondWithStatusCode(_0x3b6fbd,_0xc3af74){_0xc3af74=_0xc3af74||0xcc;return function(_0xc54371){if(_0xc54371){return _0x3b6fbd['sendStatus'](_0xc3af74);}return _0x3b6fbd[_0xab77('0x1a')](_0xc3af74)['end']();};}function respondWithResult(_0x24a5e8,_0xbb9eea){_0xbb9eea=_0xbb9eea||0xc8;return function(_0xdd4f05){if(_0xdd4f05){return _0x24a5e8['status'](_0xbb9eea)['json'](_0xdd4f05);}};}function respondWithFilteredResult(_0x91b67d,_0x51cff2){return function(_0x5756e5){if(_0x5756e5){var _0x45e2f7=typeof _0x51cff2['offset']===_0xab77('0x1b')&&typeof _0x51cff2['limit']==='undefined';var _0xc8183=_0x5756e5['count'];var _0x2714d0=_0x45e2f7?0x0:_0x51cff2[_0xab77('0x1c')];var _0x10ceab=_0x45e2f7?_0x5756e5[_0xab77('0x1d')]:_0x51cff2['offset']+_0x51cff2[_0xab77('0x1e')];var _0x32c85b;if(_0x10ceab>=_0xc8183){_0x10ceab=_0xc8183;_0x32c85b=0xc8;}else{_0x32c85b=0xce;}_0x91b67d['status'](_0x32c85b);return _0x91b67d[_0xab77('0x1f')](_0xab77('0x20'),_0x2714d0+'-'+_0x10ceab+'/'+_0xc8183)[_0xab77('0x21')](_0x5756e5);}return null;};}function patchUpdates(_0x3b1420){return function(_0x273fba){try{jsonpatch[_0xab77('0x22')](_0x273fba,_0x3b1420,!![]);}catch(_0x3fd9b5){return BPromise[_0xab77('0x23')](_0x3fd9b5);}return _0x273fba['save']();};}function saveUpdates(_0x3a7ae7,_0x205e11){return function(_0x174de6){if(_0x174de6){return _0x174de6[_0xab77('0x24')](_0x3a7ae7)[_0xab77('0x25')](function(_0x247c90){return _0x247c90;});}return null;};}function removeEntity(_0x2ea6d6,_0x4cfa7a){return function(_0x4b0f8a){if(_0x4b0f8a){return _0x4b0f8a[_0xab77('0x26')]()['then'](function(){var _0xe1dae0=_0x4b0f8a[_0xab77('0x27')]({'plain':!![]});var _0x48b8c5=_0xab77('0x28');return db[_0xab77('0x29')][_0xab77('0x26')]({'where':{'type':_0x48b8c5,'resourceId':_0xe1dae0['id']}})[_0xab77('0x25')](function(){return _0x4b0f8a;});})['then'](function(){_0x2ea6d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x285334,_0x43b983){return function(_0x489ef2){if(!_0x489ef2){_0x285334['sendStatus'](0x194);}return _0x489ef2;};}function handleError(_0x40133d,_0x30683c){_0x30683c=_0x30683c||0x1f4;return function(_0x258738){logger['error'](_0x258738[_0xab77('0x2a')]);if(_0x258738[_0xab77('0x2b')]){delete _0x258738[_0xab77('0x2b')];}_0x40133d['status'](_0x30683c)[_0xab77('0x2c')](_0x258738);};}exports['index']=function(_0x13459b,_0x20d9fe){var _0x2258ee={},_0xf1add1={},_0x58d61b={'count':0x0,'rows':[]};var _0x5cdcd1=_[_0xab77('0x2d')](db[_0xab77('0x2e')][_0xab77('0x2f')],function(_0x53c74b){return{'name':_0x53c74b[_0xab77('0x30')],'type':_0x53c74b[_0xab77('0x31')][_0xab77('0x32')]};});_0xf1add1[_0xab77('0x33')]=_[_0xab77('0x2d')](_0x5cdcd1,_0xab77('0x2b'));_0xf1add1[_0xab77('0x34')]=_['keys'](_0x13459b[_0xab77('0x34')]);_0xf1add1['filters']=_[_0xab77('0x35')](_0xf1add1[_0xab77('0x33')],_0xf1add1['query']);_0x2258ee[_0xab77('0x36')]=_[_0xab77('0x35')](_0xf1add1[_0xab77('0x33')],qs[_0xab77('0x37')](_0x13459b['query']['fields']));_0x2258ee['attributes']=_0x2258ee[_0xab77('0x36')][_0xab77('0x38')]?_0x2258ee[_0xab77('0x36')]:_0xf1add1[_0xab77('0x33')];if(!_0x13459b['query'][_0xab77('0x39')]('nolimit')){_0x2258ee['limit']=qs[_0xab77('0x1e')](_0x13459b[_0xab77('0x34')][_0xab77('0x1e')]);_0x2258ee[_0xab77('0x1c')]=qs[_0xab77('0x1c')](_0x13459b[_0xab77('0x34')]['offset']);}_0x2258ee[_0xab77('0x3a')]=qs[_0xab77('0x3b')](_0x13459b[_0xab77('0x34')][_0xab77('0x3b')]);_0x2258ee[_0xab77('0x3c')]=qs['filters'](_[_0xab77('0x3d')](_0x13459b[_0xab77('0x34')],_0xf1add1[_0xab77('0x3e')]),_0x5cdcd1);if(_0x13459b[_0xab77('0x34')]['filter']){_0x2258ee[_0xab77('0x3c')]=_[_0xab77('0x3f')](_0x2258ee['where'],{'$or':_[_0xab77('0x2d')](_0x5cdcd1,function(_0xc153d4){if(_0xc153d4[_0xab77('0x31')]!=='VIRTUAL'){var _0x56fecc={};_0x56fecc[_0xc153d4[_0xab77('0x2b')]]={'$like':'%'+_0x13459b[_0xab77('0x34')][_0xab77('0x40')]+'%'};return _0x56fecc;}})});}_0x2258ee=_['merge']({},_0x2258ee,_0x13459b[_0xab77('0x41')]);var _0x41db98={'where':_0x2258ee[_0xab77('0x3c')]};return db[_0xab77('0x2e')][_0xab77('0x1d')](_0x41db98)[_0xab77('0x25')](function(_0x7cb290){_0x58d61b[_0xab77('0x1d')]=_0x7cb290;if(_0x13459b[_0xab77('0x34')][_0xab77('0x42')]){_0x2258ee[_0xab77('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xab77('0x44')](_0x2258ee);})[_0xab77('0x25')](function(_0x344ed7){_0x58d61b['rows']=_0x344ed7;return _0x58d61b;})[_0xab77('0x25')](respondWithFilteredResult(_0x20d9fe,_0x2258ee))['catch'](handleError(_0x20d9fe,null));};exports[_0xab77('0x45')]=function(_0x24dcf0,_0x4225f2){var _0xeebecd={'raw':![],'where':{'id':_0x24dcf0[_0xab77('0x46')]['id']}},_0x1e1a93={};_0x1e1a93[_0xab77('0x33')]=_[_0xab77('0x47')](db[_0xab77('0x2e')][_0xab77('0x2f')]);_0x1e1a93[_0xab77('0x34')]=_[_0xab77('0x47')](_0x24dcf0[_0xab77('0x34')]);_0x1e1a93['filters']=_[_0xab77('0x35')](_0x1e1a93[_0xab77('0x33')],_0x1e1a93[_0xab77('0x34')]);_0xeebecd['attributes']=_[_0xab77('0x35')](_0x1e1a93[_0xab77('0x33')],qs[_0xab77('0x37')](_0x24dcf0['query']['fields']));_0xeebecd[_0xab77('0x36')]=_0xeebecd['attributes']['length']?_0xeebecd[_0xab77('0x36')]:_0x1e1a93[_0xab77('0x33')];if(_0x24dcf0[_0xab77('0x34')]['includeAll']){_0xeebecd[_0xab77('0x43')]=[{'all':!![]}];}_0xeebecd=_['merge']({},_0xeebecd,_0x24dcf0[_0xab77('0x41')]);return db[_0xab77('0x2e')][_0xab77('0x48')](_0xeebecd)[_0xab77('0x25')](handleEntityNotFound(_0x4225f2,null))[_0xab77('0x25')](respondWithResult(_0x4225f2,null))[_0xab77('0x49')](handleError(_0x4225f2,null));};exports[_0xab77('0x4a')]=function(_0x8f66d2,_0x5eef79){return db[_0xab77('0x2e')][_0xab77('0x4a')](_0x8f66d2[_0xab77('0x4b')],{})[_0xab77('0x25')](function(_0x518c0c){var _0x439ba0=_0x8f66d2['user'][_0xab77('0x27')]({'plain':!![]});if(!_0x439ba0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x439ba0['role']===_0xab77('0x4c')){var _0x3f943e=_0x518c0c[_0xab77('0x27')]({'plain':!![]});var _0x370eaa=_0xab77('0x4d');return db[_0xab77('0x4e')][_0xab77('0x48')]({'where':{'name':_0x370eaa,'userProfileId':_0x439ba0[_0xab77('0x4f')]},'raw':!![]})[_0xab77('0x25')](function(_0x132d27){if(_0x132d27&&_0x132d27['autoAssociation']===0x0){return db[_0xab77('0x29')][_0xab77('0x4a')]({'name':_0x3f943e[_0xab77('0x2b')],'resourceId':_0x3f943e['id'],'type':_0xab77('0x28'),'sectionId':_0x132d27['id']},{})[_0xab77('0x25')](function(){return _0x518c0c;});}else{return _0x518c0c;}})[_0xab77('0x49')](function(_0x56be69){logger[_0xab77('0x50')](_0xab77('0x51'),_0x56be69);throw _0x56be69;});}return _0x518c0c;})[_0xab77('0x25')](respondWithResult(_0x5eef79,0xc9))['catch'](handleError(_0x5eef79,null));};exports[_0xab77('0x24')]=function(_0x3c7c4c,_0x58a4a5){if(_0x3c7c4c['body']['id']){delete _0x3c7c4c[_0xab77('0x4b')]['id'];}return db[_0xab77('0x2e')][_0xab77('0x48')]({'where':{'id':_0x3c7c4c[_0xab77('0x46')]['id']}})[_0xab77('0x25')](handleEntityNotFound(_0x58a4a5,null))[_0xab77('0x25')](saveUpdates(_0x3c7c4c[_0xab77('0x4b')],null))['then'](respondWithResult(_0x58a4a5,null))[_0xab77('0x49')](handleError(_0x58a4a5,null));};exports['destroy']=function(_0x2cab01,_0xb928e1){return db[_0xab77('0x2e')]['find']({'where':{'id':_0x2cab01[_0xab77('0x46')]['id']}})[_0xab77('0x25')](handleEntityNotFound(_0xb928e1,null))[_0xab77('0x25')](removeEntity(_0xb928e1,null))[_0xab77('0x49')](handleError(_0xb928e1,null));};exports[_0xab77('0x52')]=function(_0x2933cc,_0x18e071){var _0x5a0131=0xa;var _0x548250=['join',_0xab77('0x53'),_0xab77('0x54'),_0xab77('0x55')];var _0x4dda98={'SUM':'SUM(%s)','COUNT':_0xab77('0x56'),'COUNT DISTINCT':_0xab77('0x57'),'MAX':_0xab77('0x58'),'MIN':_0xab77('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xab77('0x5a'),'GROUP_CONCAT DESC':_0xab77('0x5b')};var _0x16c4a={'SEC_TO_TIME':_0xab77('0x5c'),'DATE':_0xab77('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xab77('0x5e')};var _0x15c41d=function(_0x2d917d){return!_[_0xab77('0x5f')]([_0xab77('0x60'),_0xab77('0x61'),_0xab77('0x62'),_0xab77('0x63')],_0x2d917d);};var _0x492560=function(_0x206c01){if(!_0x206c01||!_0x206c01[_0xab77('0x64')][_0xab77('0x38')]){return'';}for(var _0x13e283='(',_0x31e211=0x0;_0x31e211<_0x206c01[_0xab77('0x64')][_0xab77('0x38')];_0x31e211+=0x1){_0x31e211>0x0&&(_0x13e283+='\x20'+_0x206c01[_0xab77('0x65')]+'\x20');_0x13e283+=_0x206c01[_0xab77('0x64')][_0x31e211][_0xab77('0x66')]?_0x492560(_0x206c01['rules'][_0x31e211]['group']):_0x206c01[_0xab77('0x64')][_0x31e211][_0xab77('0x67')]+'\x20'+_0x206c01[_0xab77('0x64')][_0x31e211][_0xab77('0x68')]+(_0x15c41d(_0x206c01[_0xab77('0x64')][_0x31e211][_0xab77('0x68')])?'\x20'+_0x206c01['rules'][_0x31e211][_0xab77('0x69')]:'');}return _0x13e283+')';};var _0x44c920={'where':{'id':_0x2933cc[_0xab77('0x46')]['id']}},_0x9b171f,_0x4d17b2,_0x5f2b83,_0x43904c,_0x3b8f35;_0x44c920=_['merge']({},_0x44c920,_0x2933cc['options']);return db['AnalyticCustomReport']['find'](_0x44c920)['then'](function(_0x23f30f){if(_0x23f30f){_0x9b171f=_0x23f30f;return _0x23f30f[_0xab77('0x6a')]();}return null;})[_0xab77('0x25')](function(_0xd56819){if(_0xd56819){if(!_0xd56819['length']){throw new db[(_0xab77('0x6b'))][(_0xab77('0x6c'))](_0xab77('0x6d'),0x193);}_0x4d17b2=_0xd56819;return db[_0xab77('0x6e')][_0xab77('0x44')]({'raw':!![]});}return null;})[_0xab77('0x25')](function(_0xf9d2d5){if(_0xf9d2d5){_0x5f2b83=_['keyBy'](_0xf9d2d5,'id');var _0x1ef768;var _0x38bfe2=squel[_0xab77('0x6f')]();_0x38bfe2[_0xab77('0x70')](_0x9b171f[_0xab77('0x71')]);for(var _0x40bdb9=0x0;_0x40bdb9<_0x4d17b2[_0xab77('0x38')];_0x40bdb9+=0x1){_0x1ef768=_0x4d17b2[_0x40bdb9][_0xab77('0x72')]?_0x5f2b83[_0x4d17b2[_0x40bdb9][_0xab77('0x72')]]['metric']:_0x4d17b2[_0x40bdb9][_0xab77('0x67')];_0x1ef768=_0x4d17b2[_0x40bdb9][_0xab77('0x73')]?_[_0xab77('0x74')](_0x4dda98[_0x4d17b2[_0x40bdb9][_0xab77('0x73')]],'%s',_0x1ef768):_0x1ef768;_0x1ef768=_0x4d17b2[_0x40bdb9][_0xab77('0x75')]?_['replace'](_0x16c4a[_0x4d17b2[_0x40bdb9][_0xab77('0x75')]],'%s',_0x1ef768):_0x1ef768;if(_0x4d17b2[_0x40bdb9][_0xab77('0x76')]){_0x38bfe2['group'](_0x1ef768);}_0x4d17b2[_0x40bdb9][_0xab77('0x77')]&&_0x38bfe2[_0xab77('0x3a')](_0x1ef768,_0x4d17b2[_0x40bdb9][_0xab77('0x77')]===_0xab77('0x78')?![]:!![]);_0x38bfe2['field'](_0x1ef768,_0x4d17b2[_0x40bdb9][_0xab77('0x79')]||_0x1ef768);}if(_0x9b171f[_0xab77('0x7a')]){_0x9b171f[_0xab77('0x7a')]=JSON['parse'](_0x9b171f['joins']);for(var _0x4cc0d4=0x0;_0x4cc0d4<_0x9b171f[_0xab77('0x7a')][_0xab77('0x38')];_0x4cc0d4+=0x1){if(_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x31')]&&_[_0xab77('0x5f')](_0x548250,_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x31')])&&_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7b')]&&_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7c')]&&_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7d')]){_0x38bfe2[_0x9b171f[_0xab77('0x7a')][_0x4cc0d4]['type']](_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7c')],null,util['format'](_0xab77('0x7e'),_0x9b171f[_0xab77('0x71')],_0x9b171f['joins'][_0x4cc0d4][_0xab77('0x7b')],_0x9b171f[_0xab77('0x7a')][_0x4cc0d4]['foreignTable'],_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7d')]));}}}if(_0x9b171f[_0xab77('0x7f')]){_0x9b171f[_0xab77('0x7f')]=JSON[_0xab77('0x80')](_0x9b171f['conditions']);_0x38bfe2[_0xab77('0x3c')](_0x492560(_0x9b171f[_0xab77('0x7f')][_0xab77('0x66')]));}_0x3b8f35=_0x38bfe2['clone']();_0x38bfe2[_0xab77('0x1e')](_0x5a0131);_0x38bfe2[_0xab77('0x1c')](0x0);logger[_0xab77('0x81')](_0xab77('0x82'),_0x38bfe2['toString']());return dbH[_0xab77('0x83')][_0xab77('0x34')](_0x38bfe2[_0xab77('0x84')](),{'type':dbH['sequelize'][_0xab77('0x85')][_0xab77('0x86')]});}})['then'](respondWithResult(_0x18e071,null))['catch'](handleError(_0x18e071,null));};function runReport(_0x5e4777,_0x504381,_0x344971){var _0x17dcf3=_0x504381[_0xab77('0x2b')];var _0x325363=0xa;var _0x116f5e=['join',_0xab77('0x53'),'right_join','cross_join'];var _0x3b3559={'SUM':_0xab77('0x87'),'COUNT':_0xab77('0x56'),'COUNT DISTINCT':_0xab77('0x57'),'MAX':_0xab77('0x58'),'MIN':'MIN(%s)','AVG':_0xab77('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xab77('0x5a'),'GROUP_CONCAT DESC':_0xab77('0x5b')};var _0x557c46={'SEC_TO_TIME':_0xab77('0x5c'),'DATE':_0xab77('0x5d'),'HOUR':_0xab77('0x89'),'ROUND':_0xab77('0x8a'),'UNIX_TIMESTAMP':_0xab77('0x5e')};var _0x2753a8=function(_0x3ab091){return!_[_0xab77('0x5f')](['IS\x20NULL',_0xab77('0x61'),_0xab77('0x62'),_0xab77('0x63')],_0x3ab091);};var _0x2397a9=function(_0x499d50){if(!_0x499d50||!_0x499d50['rules'][_0xab77('0x38')]){return'';}for(var _0x779645='(',_0x257167=0x0;_0x257167<_0x499d50[_0xab77('0x64')][_0xab77('0x38')];_0x257167+=0x1){_0x257167>0x0&&(_0x779645+='\x20'+_0x499d50[_0xab77('0x65')]+'\x20');_0x779645+=_0x499d50['rules'][_0x257167][_0xab77('0x66')]?_0x2397a9(_0x499d50[_0xab77('0x64')][_0x257167][_0xab77('0x66')]):_0x499d50[_0xab77('0x64')][_0x257167][_0xab77('0x67')]+'\x20'+_0x499d50[_0xab77('0x64')][_0x257167]['condition']+(_0x2753a8(_0x499d50['rules'][_0x257167][_0xab77('0x68')])?'\x20'+_0x499d50[_0xab77('0x64')][_0x257167][_0xab77('0x69')]:'');}return _0x779645+')';};var _0x3a2c95={'where':{'id':_0x5e4777['id']}},_0x496d3e,_0x306b82,_0x59ebe5,_0xc6ff31,_0x113ae2;_0x3a2c95=_[_0xab77('0x3f')]({},_0x3a2c95,_0x344971);return db['AnalyticCustomReport'][_0xab77('0x48')](_0x3a2c95)[_0xab77('0x25')](function(_0x7648d0){if(_0x7648d0){_0x496d3e=_0x7648d0;return _0x7648d0[_0xab77('0x6a')]();}return null;})[_0xab77('0x25')](function(_0x1e7541){if(_0x1e7541){if(!_0x1e7541[_0xab77('0x38')]){throw new db[(_0xab77('0x6b'))]['ValidationErrorItem'](_0xab77('0x6d'),0x193);}_0x306b82=_0x1e7541;return db[_0xab77('0x6e')][_0xab77('0x44')]({'raw':!![]});}return null;})['then'](function(_0x139543){if(_0x139543){_0x59ebe5=_[_0xab77('0x8b')](_0x139543,'id');var _0xce87e2;var _0x3c594a=squel[_0xab77('0x6f')]();_0x3c594a[_0xab77('0x70')](_0x496d3e['table']);for(var _0x46ae62=0x0;_0x46ae62<_0x306b82[_0xab77('0x38')];_0x46ae62+=0x1){_0xce87e2=_0x306b82[_0x46ae62][_0xab77('0x72')]?_0x59ebe5[_0x306b82[_0x46ae62]['MetricId']][_0xab77('0x8c')]:_0x306b82[_0x46ae62][_0xab77('0x67')];_0xce87e2=_0x306b82[_0x46ae62][_0xab77('0x73')]?_[_0xab77('0x74')](_0x3b3559[_0x306b82[_0x46ae62][_0xab77('0x73')]],'%s',_0xce87e2):_0xce87e2;_0xce87e2=_0x306b82[_0x46ae62]['format']?_[_0xab77('0x74')](_0x557c46[_0x306b82[_0x46ae62][_0xab77('0x75')]],'%s',_0xce87e2):_0xce87e2;if(_0x306b82[_0x46ae62][_0xab77('0x76')]){_0x3c594a[_0xab77('0x66')](_0xce87e2);}_0x306b82[_0x46ae62][_0xab77('0x77')]&&_0x3c594a[_0xab77('0x3a')](_0xce87e2,_0x306b82[_0x46ae62][_0xab77('0x77')]===_0xab77('0x78')?![]:!![]);_0x3c594a[_0xab77('0x67')](_0xce87e2,_0x306b82[_0x46ae62][_0xab77('0x79')]||_0xce87e2);}if(_0x496d3e[_0xab77('0x7a')]){_0x496d3e[_0xab77('0x7a')]=JSON[_0xab77('0x80')](_0x496d3e[_0xab77('0x7a')]);for(var _0x44f03c=0x0;_0x44f03c<_0x496d3e[_0xab77('0x7a')]['length'];_0x44f03c+=0x1){if(_0x496d3e['joins'][_0x44f03c][_0xab77('0x31')]&&_[_0xab77('0x5f')](_0x116f5e,_0x496d3e[_0xab77('0x7a')][_0x44f03c]['type'])&&_0x496d3e[_0xab77('0x7a')][_0x44f03c][_0xab77('0x7b')]&&_0x496d3e[_0xab77('0x7a')][_0x44f03c][_0xab77('0x7c')]&&_0x496d3e[_0xab77('0x7a')][_0x44f03c]['foreignKey']){_0x3c594a[_0x496d3e[_0xab77('0x7a')][_0x44f03c]['type']](_0x496d3e[_0xab77('0x7a')][_0x44f03c][_0xab77('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x496d3e[_0xab77('0x71')],_0x496d3e['joins'][_0x44f03c][_0xab77('0x7b')],_0x496d3e['joins'][_0x44f03c][_0xab77('0x7c')],_0x496d3e[_0xab77('0x7a')][_0x44f03c][_0xab77('0x7d')]));}}}if(_0x496d3e['conditions']){_0x496d3e[_0xab77('0x7f')]=JSON[_0xab77('0x80')](_0x496d3e[_0xab77('0x7f')]);_0x3c594a['where'](_0x2397a9(_0x496d3e[_0xab77('0x7f')][_0xab77('0x66')]));}_0x113ae2=_0x3c594a[_0xab77('0x8d')]();_0x3c594a['limit'](_0x325363);_0x3c594a[_0xab77('0x1c')](0x0);return;}})['then'](function(){if(_0x504381[_0xab77('0x8e')]===_0xab77('0x8f')){return null;}var _0x1b50de=_[_0xab77('0x3f')](_0x504381,{'name':_0x504381[_0xab77('0x90')]||_0x504381[_0xab77('0x2b')]||_0x496d3e[_0xab77('0x2b')],'basename':_0x17dcf3,'savename':util['format'](_0xab77('0x91'),_0x504381[_0xab77('0x2b')]||_0x496d3e[_0xab77('0x2b')],require(_0xab77('0x92'))[_0xab77('0x93')](0x4),_0x504381['output']||_0xab77('0x94')),'reportId':_0x496d3e['id'],'reportType':_0xab77('0x95')});return db[_0xab77('0x96')][_0xab77('0x4a')](_0x1b50de,{'raw':!![]});})['then'](function(_0x2e7530){if(_0x496d3e[_0xab77('0x71')]===_0xab77('0x97')){_0x113ae2['where'](_0x496d3e[_0xab77('0x71')]+_0xab77('0x98'),_0x504381['startDate'],_0x504381[_0xab77('0x99')]);}else{_0x113ae2[_0xab77('0x3c')](_0x496d3e[_0xab77('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x504381[_0xab77('0x9a')],_0x504381[_0xab77('0x99')]);}if(_0x2e7530){logger[_0xab77('0x9b')](_0xab77('0x9c'),_0x113ae2[_0xab77('0x84')]());require('child_process')[_0xab77('0x9d')](path['join'](__dirname,'../../components/export/',_0x2e7530[_0xab77('0x8e')]),[_0x2e7530['id'],_0x113ae2[_0xab77('0x84')](),path[_0xab77('0x9e')](__dirname,_0xab77('0x9f'),_0x2e7530[_0xab77('0xa0')]),_0x17dcf3]);return _0x2e7530;}else{var _0x35be6f=squel[_0xab77('0x6f')]();_0x35be6f[_0xab77('0x70')]('('+_0x113ae2['toString']()+')',_0xab77('0xa1'));_0x35be6f[_0xab77('0x67')](_0xab77('0xa2'),_0xab77('0x1d'));_0x113ae2[_0xab77('0x1e')](_0x504381[_0xab77('0x1e')]||_0x325363);_0x113ae2['offset'](_0x504381['offset']||0x0);return dbH['sequelize']['query'](_0x35be6f[_0xab77('0x84')](),{'type':dbH[_0xab77('0x83')][_0xab77('0x85')][_0xab77('0x86')]})['then'](function(_0x3fd5d6){if(!_0x3fd5d6['length']){_0xc6ff31=0x0;}else{_0xc6ff31=_0x3fd5d6[0x0][_0xab77('0x1d')]||0x0;}return dbH[_0xab77('0x83')][_0xab77('0x34')](_0x113ae2[_0xab77('0x84')](),{'type':dbH[_0xab77('0x83')]['QueryTypes'][_0xab77('0x86')]});})[_0xab77('0x25')](function(_0x3a8cb1){return{'rows':_0x3a8cb1||[],'count':_0xc6ff31};});}});}exports[_0xab77('0xa3')]=function(_0x42007c,_0x4a1a79){return runReport(_0x42007c[_0xab77('0x46')],_0x42007c['query'],_0x42007c[_0xab77('0x41')])[_0xab77('0x25')](respondWithResult(_0x4a1a79,null))[_0xab77('0x49')](handleError(_0x4a1a79,null));};exports[_0xab77('0xa4')]=runReport;exports[_0xab77('0x34')]=function(_0x163bae,_0x3c1e12){var _0x2cfde5=0xa;var _0x125189=[_0xab77('0x9e'),_0xab77('0x53'),_0xab77('0x54'),_0xab77('0x55')];var _0x2e281f={'SUM':_0xab77('0x87'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xab77('0x57'),'MAX':_0xab77('0x58'),'MIN':'MIN(%s)','AVG':_0xab77('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xab77('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xb538fc={'SEC_TO_TIME':_0xab77('0x5c'),'DATE':_0xab77('0x5d'),'HOUR':_0xab77('0x89'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xab77('0x5e')};var _0x4fa4ad=function(_0x4ebbe5){return!_[_0xab77('0x5f')]([_0xab77('0x60'),_0xab77('0x61'),'IS\x20EMPTY',_0xab77('0x63')],_0x4ebbe5);};var _0x2ba066=function(_0x41fd8a){if(!_0x41fd8a||!_0x41fd8a[_0xab77('0x64')][_0xab77('0x38')]){return'';}for(var _0x310473='(',_0x177118=0x0;_0x177118<_0x41fd8a['rules'][_0xab77('0x38')];_0x177118+=0x1){_0x177118>0x0&&(_0x310473+='\x20'+_0x41fd8a['operator']+'\x20');_0x310473+=_0x41fd8a[_0xab77('0x64')][_0x177118][_0xab77('0x66')]?_0x2ba066(_0x41fd8a[_0xab77('0x64')][_0x177118][_0xab77('0x66')]):_0x41fd8a[_0xab77('0x64')][_0x177118][_0xab77('0x67')]+'\x20'+_0x41fd8a[_0xab77('0x64')][_0x177118][_0xab77('0x68')]+(_0x4fa4ad(_0x41fd8a[_0xab77('0x64')][_0x177118]['condition'])?'\x20'+_0x41fd8a['rules'][_0x177118][_0xab77('0x69')]:'');}return _0x310473+')';};var _0xdc28b3={'where':{'id':_0x163bae[_0xab77('0x46')]['id']}},_0x41d515,_0x23ef2d,_0x3c488d,_0x3a5d1,_0x5eb9c1;_0xdc28b3=_['merge']({},_0xdc28b3,_0x163bae[_0xab77('0x41')]);return db[_0xab77('0x2e')][_0xab77('0x48')](_0xdc28b3)[_0xab77('0x25')](function(_0x15ba2e){if(_0x15ba2e){_0x41d515=_0x15ba2e;return _0x15ba2e[_0xab77('0x6a')]();}return null;})['then'](function(_0x110134){if(_0x110134){if(!_0x110134['length']){throw new db[(_0xab77('0x6b'))][(_0xab77('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x23ef2d=_0x110134;return db[_0xab77('0x6e')][_0xab77('0x44')]({'raw':!![]});}return null;})[_0xab77('0x25')](function(_0x255b3c){if(_0x255b3c){_0x3c488d=_[_0xab77('0x8b')](_0x255b3c,'id');var _0x23ba43;var _0x17d2dc=squel[_0xab77('0x6f')]();_0x17d2dc[_0xab77('0x70')](_0x41d515['table']);for(var _0x3c8f7b=0x0;_0x3c8f7b<_0x23ef2d[_0xab77('0x38')];_0x3c8f7b+=0x1){_0x23ba43=_0x23ef2d[_0x3c8f7b][_0xab77('0x72')]?_0x3c488d[_0x23ef2d[_0x3c8f7b][_0xab77('0x72')]][_0xab77('0x8c')]:_0x23ef2d[_0x3c8f7b]['field'];_0x23ba43=_0x23ef2d[_0x3c8f7b][_0xab77('0x73')]?_['replace'](_0x2e281f[_0x23ef2d[_0x3c8f7b]['function']],'%s',_0x23ba43):_0x23ba43;_0x23ba43=_0x23ef2d[_0x3c8f7b]['format']?_[_0xab77('0x74')](_0xb538fc[_0x23ef2d[_0x3c8f7b][_0xab77('0x75')]],'%s',_0x23ba43):_0x23ba43;if(_0x23ef2d[_0x3c8f7b][_0xab77('0x76')]){_0x17d2dc[_0xab77('0x66')](_0x23ba43);}_0x23ef2d[_0x3c8f7b]['orderBy']&&_0x17d2dc[_0xab77('0x3a')](_0x23ba43,_0x23ef2d[_0x3c8f7b][_0xab77('0x77')]===_0xab77('0x78')?![]:!![]);_0x17d2dc[_0xab77('0x67')](_0x23ba43,_0x23ef2d[_0x3c8f7b][_0xab77('0x79')]||_0x23ba43);}if(_0x41d515[_0xab77('0x7a')]){_0x41d515['joins']=JSON[_0xab77('0x80')](_0x41d515[_0xab77('0x7a')]);for(var _0xa4828=0x0;_0xa4828<_0x41d515['joins'][_0xab77('0x38')];_0xa4828+=0x1){if(_0x41d515['joins'][_0xa4828][_0xab77('0x31')]&&_[_0xab77('0x5f')](_0x125189,_0x41d515[_0xab77('0x7a')][_0xa4828][_0xab77('0x31')])&&_0x41d515[_0xab77('0x7a')][_0xa4828]['parentKey']&&_0x41d515[_0xab77('0x7a')][_0xa4828][_0xab77('0x7c')]&&_0x41d515['joins'][_0xa4828][_0xab77('0x7d')]){_0x17d2dc[_0x41d515['joins'][_0xa4828][_0xab77('0x31')]](_0x41d515[_0xab77('0x7a')][_0xa4828]['foreignTable'],null,util[_0xab77('0x75')](_0xab77('0x7e'),_0x41d515[_0xab77('0x71')],_0x41d515['joins'][_0xa4828][_0xab77('0x7b')],_0x41d515[_0xab77('0x7a')][_0xa4828][_0xab77('0x7c')],_0x41d515[_0xab77('0x7a')][_0xa4828][_0xab77('0x7d')]));}}}if(_0x41d515[_0xab77('0x7f')]){_0x41d515[_0xab77('0x7f')]=JSON[_0xab77('0x80')](_0x41d515[_0xab77('0x7f')]);_0x17d2dc[_0xab77('0x3c')](_0x2ba066(_0x41d515[_0xab77('0x7f')][_0xab77('0x66')]));}_0x5eb9c1=_0x17d2dc['clone']();_0x17d2dc['limit'](_0x2cfde5);_0x17d2dc[_0xab77('0x1c')](0x0);logger[_0xab77('0x81')](_0xab77('0x82'),_0x17d2dc[_0xab77('0x84')]());return dbH[_0xab77('0x83')]['query'](_0x17d2dc[_0xab77('0x84')](),{'type':dbH[_0xab77('0x83')][_0xab77('0x85')][_0xab77('0x86')]});}})[_0xab77('0x25')](function(){return{'sql':_0x5eb9c1[_0xab77('0x84')]()};})[_0xab77('0x25')](respondWithResult(_0x3c1e12,null))[_0xab77('0x49')](handleError(_0x3c1e12,null));}; \ No newline at end of file +var _0x2782=['replace','format','orderBy','DESC','alias','joins','includes','parentKey','foreignKey','foreignTable','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','SEC_TO_TIME(%s)','HOUR(%s)','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','fork','join','../../components/export/','../../files/reports','savename','countTable','run','runReport','ROUND(%s)','parse','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','include','AnalyticCustomReport','findAll','rows','show','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','preview','left_join','right_join','cross_join','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function'];(function(_0xf5fdee,_0x4b5616){var _0x23aa74=function(_0x6f2ff5){while(--_0x6f2ff5){_0xf5fdee['push'](_0xf5fdee['shift']());}};_0x23aa74(++_0x4b5616);}(_0x2782,0x17f));var _0x2278=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x2782[_0x41ee16];return _0x1f60de;};'use strict';var emlformat=require(_0x2278('0x0'));var rimraf=require(_0x2278('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2278('0x2'));var moment=require(_0x2278('0x3'));var BPromise=require(_0x2278('0x4'));var Mustache=require(_0x2278('0x5'));var util=require(_0x2278('0x6'));var path=require(_0x2278('0x7'));var sox=require('sox');var csv=require(_0x2278('0x8'));var ejs=require(_0x2278('0x9'));var fs=require('fs');var fs_extra=require(_0x2278('0xa'));var _=require(_0x2278('0xb'));var squel=require(_0x2278('0xc'));var crypto=require(_0x2278('0xd'));var jsforce=require(_0x2278('0xe'));var deskjs=require(_0x2278('0xf'));var toCsv=require(_0x2278('0x8'));var querystring=require(_0x2278('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2278('0x11'));var qs=require(_0x2278('0x12'));var as=require(_0x2278('0x13'));var hardwareService=require(_0x2278('0x14'));var logger=require(_0x2278('0x15'))(_0x2278('0x16'));var utils=require(_0x2278('0x17'));var config=require(_0x2278('0x18'));var licenseUtil=require(_0x2278('0x19'));var db=require(_0x2278('0x1a'))['db'];var dbH=require('../../mysqldb')[_0x2278('0x1b')];function respondWithStatusCode(_0x34b5bc,_0x2ee61f){_0x2ee61f=_0x2ee61f||0xcc;return function(_0x8f7b3){if(_0x8f7b3){return _0x34b5bc[_0x2278('0x1c')](_0x2ee61f);}return _0x34b5bc['status'](_0x2ee61f)['end']();};}function respondWithResult(_0x1b4172,_0x323967){_0x323967=_0x323967||0xc8;return function(_0x45ade7){if(_0x45ade7){return _0x1b4172[_0x2278('0x1d')](_0x323967)[_0x2278('0x1e')](_0x45ade7);}};}function respondWithFilteredResult(_0xc12c26,_0x36c2e0){return function(_0x2e3bcd){if(_0x2e3bcd){var _0x1b7a0c=typeof _0x36c2e0[_0x2278('0x1f')]===_0x2278('0x20')&&typeof _0x36c2e0[_0x2278('0x21')]===_0x2278('0x20');var _0x51b718=_0x2e3bcd[_0x2278('0x22')];var _0x3fb87b=_0x1b7a0c?0x0:_0x36c2e0[_0x2278('0x1f')];var _0x456a61=_0x1b7a0c?_0x2e3bcd[_0x2278('0x22')]:_0x36c2e0[_0x2278('0x1f')]+_0x36c2e0[_0x2278('0x21')];var _0xa97bf0;if(_0x456a61>=_0x51b718){_0x456a61=_0x51b718;_0xa97bf0=0xc8;}else{_0xa97bf0=0xce;}_0xc12c26[_0x2278('0x1d')](_0xa97bf0);return _0xc12c26[_0x2278('0x23')](_0x2278('0x24'),_0x3fb87b+'-'+_0x456a61+'/'+_0x51b718)['json'](_0x2e3bcd);}return null;};}function patchUpdates(_0x5ee1a9){return function(_0x21e02c){try{jsonpatch['apply'](_0x21e02c,_0x5ee1a9,!![]);}catch(_0xf96295){return BPromise['reject'](_0xf96295);}return _0x21e02c['save']();};}function saveUpdates(_0x5cbe33,_0x5f0f27){return function(_0xaeaa87){if(_0xaeaa87){return _0xaeaa87[_0x2278('0x25')](_0x5cbe33)[_0x2278('0x26')](function(_0x187eb4){return _0x187eb4;});}return null;};}function removeEntity(_0x49104d,_0x17cf6b){return function(_0x58e303){if(_0x58e303){return _0x58e303[_0x2278('0x27')]()['then'](function(){var _0x3d3b26=_0x58e303[_0x2278('0x28')]({'plain':!![]});var _0x22bf33=_0x2278('0x29');return db[_0x2278('0x2a')]['destroy']({'where':{'type':_0x22bf33,'resourceId':_0x3d3b26['id']}})[_0x2278('0x26')](function(){return _0x58e303;});})['then'](function(){_0x49104d['status'](0xcc)[_0x2278('0x2b')]();});}};}function handleEntityNotFound(_0x47b4f1,_0x485beb){return function(_0x9fea2d){if(!_0x9fea2d){_0x47b4f1[_0x2278('0x1c')](0x194);}return _0x9fea2d;};}function handleError(_0x5bf466,_0x42d937){_0x42d937=_0x42d937||0x1f4;return function(_0x335d7d){logger[_0x2278('0x2c')](_0x335d7d[_0x2278('0x2d')]);if(_0x335d7d['name']){delete _0x335d7d[_0x2278('0x2e')];}_0x5bf466[_0x2278('0x1d')](_0x42d937)[_0x2278('0x2f')](_0x335d7d);};}exports[_0x2278('0x30')]=function(_0x35d6ab,_0x4d603d){var _0x23d2f9={},_0x276b64={},_0x1fdcac={'count':0x0,'rows':[]};var _0x55b4ad=_[_0x2278('0x31')](db['AnalyticCustomReport'][_0x2278('0x32')],function(_0x131d5a){return{'name':_0x131d5a[_0x2278('0x33')],'type':_0x131d5a[_0x2278('0x34')][_0x2278('0x35')]};});_0x276b64[_0x2278('0x36')]=_['map'](_0x55b4ad,'name');_0x276b64[_0x2278('0x37')]=_[_0x2278('0x38')](_0x35d6ab[_0x2278('0x37')]);_0x276b64[_0x2278('0x39')]=_[_0x2278('0x3a')](_0x276b64[_0x2278('0x36')],_0x276b64['query']);_0x23d2f9[_0x2278('0x3b')]=_['intersection'](_0x276b64['model'],qs[_0x2278('0x3c')](_0x35d6ab[_0x2278('0x37')][_0x2278('0x3c')]));_0x23d2f9[_0x2278('0x3b')]=_0x23d2f9[_0x2278('0x3b')][_0x2278('0x3d')]?_0x23d2f9[_0x2278('0x3b')]:_0x276b64[_0x2278('0x36')];if(!_0x35d6ab[_0x2278('0x37')][_0x2278('0x3e')]('nolimit')){_0x23d2f9[_0x2278('0x21')]=qs[_0x2278('0x21')](_0x35d6ab[_0x2278('0x37')][_0x2278('0x21')]);_0x23d2f9[_0x2278('0x1f')]=qs['offset'](_0x35d6ab['query'][_0x2278('0x1f')]);}_0x23d2f9[_0x2278('0x3f')]=qs[_0x2278('0x40')](_0x35d6ab[_0x2278('0x37')][_0x2278('0x40')]);_0x23d2f9['where']=qs[_0x2278('0x39')](_[_0x2278('0x41')](_0x35d6ab[_0x2278('0x37')],_0x276b64[_0x2278('0x39')]),_0x55b4ad);if(_0x35d6ab[_0x2278('0x37')]['filter']){_0x23d2f9[_0x2278('0x42')]=_[_0x2278('0x43')](_0x23d2f9[_0x2278('0x42')],{'$or':_[_0x2278('0x31')](_0x55b4ad,function(_0x44d847){if(_0x44d847['type']!=='VIRTUAL'){var _0x2d734c={};_0x2d734c[_0x44d847['name']]={'$like':'%'+_0x35d6ab['query'][_0x2278('0x44')]+'%'};return _0x2d734c;}})});}_0x23d2f9=_[_0x2278('0x43')]({},_0x23d2f9,_0x35d6ab[_0x2278('0x45')]);var _0x7cae36={'where':_0x23d2f9['where']};return db['AnalyticCustomReport']['count'](_0x7cae36)[_0x2278('0x26')](function(_0x4ef7d0){_0x1fdcac['count']=_0x4ef7d0;if(_0x35d6ab[_0x2278('0x37')]['includeAll']){_0x23d2f9[_0x2278('0x46')]=[{'all':!![]}];}return db[_0x2278('0x47')][_0x2278('0x48')](_0x23d2f9);})[_0x2278('0x26')](function(_0x182d70){_0x1fdcac[_0x2278('0x49')]=_0x182d70;return _0x1fdcac;})[_0x2278('0x26')](respondWithFilteredResult(_0x4d603d,_0x23d2f9))['catch'](handleError(_0x4d603d,null));};exports[_0x2278('0x4a')]=function(_0x856996,_0x1a562d){var _0x1a3dd3={'raw':![],'where':{'id':_0x856996[_0x2278('0x4b')]['id']}},_0x1e8df2={};_0x1e8df2[_0x2278('0x36')]=_[_0x2278('0x38')](db[_0x2278('0x47')][_0x2278('0x32')]);_0x1e8df2[_0x2278('0x37')]=_['keys'](_0x856996[_0x2278('0x37')]);_0x1e8df2['filters']=_[_0x2278('0x3a')](_0x1e8df2['model'],_0x1e8df2[_0x2278('0x37')]);_0x1a3dd3['attributes']=_[_0x2278('0x3a')](_0x1e8df2[_0x2278('0x36')],qs['fields'](_0x856996[_0x2278('0x37')][_0x2278('0x3c')]));_0x1a3dd3[_0x2278('0x3b')]=_0x1a3dd3[_0x2278('0x3b')][_0x2278('0x3d')]?_0x1a3dd3[_0x2278('0x3b')]:_0x1e8df2[_0x2278('0x36')];if(_0x856996[_0x2278('0x37')][_0x2278('0x4c')]){_0x1a3dd3[_0x2278('0x46')]=[{'all':!![]}];}_0x1a3dd3=_['merge']({},_0x1a3dd3,_0x856996[_0x2278('0x45')]);return db[_0x2278('0x47')]['find'](_0x1a3dd3)[_0x2278('0x26')](handleEntityNotFound(_0x1a562d,null))[_0x2278('0x26')](respondWithResult(_0x1a562d,null))[_0x2278('0x4d')](handleError(_0x1a562d,null));};exports[_0x2278('0x4e')]=function(_0xccab33,_0xecf104){return db['AnalyticCustomReport']['create'](_0xccab33[_0x2278('0x4f')],{})['then'](function(_0xf3e0fd){var _0x2d95c4=_0xccab33[_0x2278('0x50')][_0x2278('0x28')]({'plain':!![]});if(!_0x2d95c4)throw new Error(_0x2278('0x51'));if(_0x2d95c4[_0x2278('0x52')]===_0x2278('0x50')){var _0x282590=_0xf3e0fd[_0x2278('0x28')]({'plain':!![]});var _0x1b430a=_0x2278('0x53');return db[_0x2278('0x54')][_0x2278('0x55')]({'where':{'name':_0x1b430a,'userProfileId':_0x2d95c4[_0x2278('0x56')]},'raw':!![]})[_0x2278('0x26')](function(_0x5f43a1){if(_0x5f43a1&&_0x5f43a1[_0x2278('0x57')]===0x0){return db['UserProfileResource'][_0x2278('0x4e')]({'name':_0x282590['name'],'resourceId':_0x282590['id'],'type':'CustomReports','sectionId':_0x5f43a1['id']},{})[_0x2278('0x26')](function(){return _0xf3e0fd;});}else{return _0xf3e0fd;}})['catch'](function(_0xedeb2f){logger[_0x2278('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xedeb2f);throw _0xedeb2f;});}return _0xf3e0fd;})[_0x2278('0x26')](respondWithResult(_0xecf104,0xc9))['catch'](handleError(_0xecf104,null));};exports[_0x2278('0x25')]=function(_0x937e78,_0x59e3bb){if(_0x937e78[_0x2278('0x4f')]['id']){delete _0x937e78[_0x2278('0x4f')]['id'];}return db['AnalyticCustomReport'][_0x2278('0x55')]({'where':{'id':_0x937e78[_0x2278('0x4b')]['id']}})['then'](handleEntityNotFound(_0x59e3bb,null))[_0x2278('0x26')](saveUpdates(_0x937e78[_0x2278('0x4f')],null))[_0x2278('0x26')](respondWithResult(_0x59e3bb,null))[_0x2278('0x4d')](handleError(_0x59e3bb,null));};exports[_0x2278('0x27')]=function(_0x23cc74,_0x4fb0e5){return db[_0x2278('0x47')][_0x2278('0x55')]({'where':{'id':_0x23cc74['params']['id']}})[_0x2278('0x26')](handleEntityNotFound(_0x4fb0e5,null))[_0x2278('0x26')](removeEntity(_0x4fb0e5,null))['catch'](handleError(_0x4fb0e5,null));};exports[_0x2278('0x58')]=function(_0x11a655,_0x33f7fa){var _0x26ed89=0xa;var _0x44e622=['join',_0x2278('0x59'),_0x2278('0x5a'),_0x2278('0x5b')];var _0x50fa37={'SUM':'SUM(%s)','COUNT':_0x2278('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x2278('0x5d'),'GROUP_CONCAT':_0x2278('0x5e'),'GROUP_CONCAT ASC':_0x2278('0x5f'),'GROUP_CONCAT DESC':_0x2278('0x60')};var _0x34b9ce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2278('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2278('0x62')};var _0x4392eb=function(_0x258225){return!_['includes']([_0x2278('0x63'),_0x2278('0x64'),_0x2278('0x65'),_0x2278('0x66')],_0x258225);};var _0xc39b69=function(_0x256efa){if(!_0x256efa||!_0x256efa[_0x2278('0x67')][_0x2278('0x3d')]){return'';}for(var _0x11518b='(',_0x195e1f=0x0;_0x195e1f<_0x256efa[_0x2278('0x67')][_0x2278('0x3d')];_0x195e1f+=0x1){_0x195e1f>0x0&&(_0x11518b+='\x20'+_0x256efa[_0x2278('0x68')]+'\x20');_0x11518b+=_0x256efa[_0x2278('0x67')][_0x195e1f][_0x2278('0x69')]?_0xc39b69(_0x256efa[_0x2278('0x67')][_0x195e1f][_0x2278('0x69')]):_0x256efa[_0x2278('0x67')][_0x195e1f][_0x2278('0x6a')]+'\x20'+_0x256efa[_0x2278('0x67')][_0x195e1f][_0x2278('0x6b')]+(_0x4392eb(_0x256efa['rules'][_0x195e1f][_0x2278('0x6b')])?'\x20'+_0x256efa[_0x2278('0x67')][_0x195e1f][_0x2278('0x6c')]:'');}return _0x11518b+')';};var _0x4764a9={'where':{'id':_0x11a655[_0x2278('0x4b')]['id']}},_0x34e741,_0x27219a,_0x4ac615,_0x179cfd,_0x3b3bfb;_0x4764a9=_['merge']({},_0x4764a9,_0x11a655[_0x2278('0x45')]);return db[_0x2278('0x47')][_0x2278('0x55')](_0x4764a9)[_0x2278('0x26')](function(_0x46ff3d){if(_0x46ff3d){_0x34e741=_0x46ff3d;return _0x46ff3d[_0x2278('0x6d')]();}return null;})[_0x2278('0x26')](function(_0x5b2b29){if(_0x5b2b29){if(!_0x5b2b29[_0x2278('0x3d')]){throw new db[(_0x2278('0x6e'))][(_0x2278('0x6f'))](_0x2278('0x70'),0x193);}_0x27219a=_0x5b2b29;return db[_0x2278('0x71')]['findAll']({'raw':!![]});}return null;})[_0x2278('0x26')](function(_0xbc2525){if(_0xbc2525){_0x4ac615=_[_0x2278('0x72')](_0xbc2525,'id');var _0x349898;var _0xa513cf=squel[_0x2278('0x73')]();_0xa513cf[_0x2278('0x74')](_0x34e741[_0x2278('0x75')]);for(var _0x3741e5=0x0;_0x3741e5<_0x27219a[_0x2278('0x3d')];_0x3741e5+=0x1){_0x349898=_0x27219a[_0x3741e5][_0x2278('0x76')]?_0x4ac615[_0x27219a[_0x3741e5][_0x2278('0x76')]][_0x2278('0x77')]:_0x27219a[_0x3741e5][_0x2278('0x6a')];_0x349898=_0x27219a[_0x3741e5][_0x2278('0x78')]?_[_0x2278('0x79')](_0x50fa37[_0x27219a[_0x3741e5][_0x2278('0x78')]],'%s',_0x349898):_0x349898;_0x349898=_0x27219a[_0x3741e5][_0x2278('0x7a')]?_[_0x2278('0x79')](_0x34b9ce[_0x27219a[_0x3741e5][_0x2278('0x7a')]],'%s',_0x349898):_0x349898;if(_0x27219a[_0x3741e5]['groupBy']){_0xa513cf['group'](_0x349898);}_0x27219a[_0x3741e5]['orderBy']&&_0xa513cf[_0x2278('0x3f')](_0x349898,_0x27219a[_0x3741e5][_0x2278('0x7b')]===_0x2278('0x7c')?![]:!![]);_0xa513cf[_0x2278('0x6a')](_0x349898,_0x27219a[_0x3741e5][_0x2278('0x7d')]||_0x349898);}if(_0x34e741['joins']){_0x34e741[_0x2278('0x7e')]=JSON['parse'](_0x34e741[_0x2278('0x7e')]);for(var _0x2b0d01=0x0;_0x2b0d01<_0x34e741[_0x2278('0x7e')][_0x2278('0x3d')];_0x2b0d01+=0x1){if(_0x34e741[_0x2278('0x7e')][_0x2b0d01][_0x2278('0x34')]&&_[_0x2278('0x7f')](_0x44e622,_0x34e741['joins'][_0x2b0d01]['type'])&&_0x34e741[_0x2278('0x7e')][_0x2b0d01][_0x2278('0x80')]&&_0x34e741['joins'][_0x2b0d01]['foreignTable']&&_0x34e741[_0x2278('0x7e')][_0x2b0d01][_0x2278('0x81')]){_0xa513cf[_0x34e741[_0x2278('0x7e')][_0x2b0d01][_0x2278('0x34')]](_0x34e741['joins'][_0x2b0d01]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x34e741['table'],_0x34e741[_0x2278('0x7e')][_0x2b0d01]['parentKey'],_0x34e741[_0x2278('0x7e')][_0x2b0d01][_0x2278('0x82')],_0x34e741[_0x2278('0x7e')][_0x2b0d01][_0x2278('0x81')]));}}}if(_0x34e741[_0x2278('0x83')]){_0x34e741[_0x2278('0x83')]=JSON['parse'](_0x34e741['conditions']);_0xa513cf[_0x2278('0x42')](_0xc39b69(_0x34e741[_0x2278('0x83')][_0x2278('0x69')]));}_0x3b3bfb=_0xa513cf[_0x2278('0x84')]();_0xa513cf[_0x2278('0x21')](_0x26ed89);_0xa513cf[_0x2278('0x1f')](0x0);logger[_0x2278('0x85')]('Limited\x20Query:',_0xa513cf[_0x2278('0x86')]());return dbH[_0x2278('0x87')][_0x2278('0x37')](_0xa513cf[_0x2278('0x86')](),{'type':dbH[_0x2278('0x87')][_0x2278('0x88')][_0x2278('0x89')]});}})[_0x2278('0x26')](respondWithResult(_0x33f7fa,null))[_0x2278('0x4d')](handleError(_0x33f7fa,null));};function runReport(_0x115f9b,_0x36755a,_0x4799b8){var _0x1ba91f=_0x36755a[_0x2278('0x2e')];var _0x31ab77=0xa;var _0xab597a=['join',_0x2278('0x59'),_0x2278('0x5a'),_0x2278('0x5b')];var _0x52734a={'SUM':_0x2278('0x8a'),'COUNT':_0x2278('0x5c'),'COUNT DISTINCT':_0x2278('0x8b'),'MAX':_0x2278('0x8c'),'MIN':_0x2278('0x8d'),'AVG':_0x2278('0x5d'),'GROUP_CONCAT':_0x2278('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2278('0x60')};var _0x1f8ddc={'SEC_TO_TIME':_0x2278('0x8e'),'DATE':_0x2278('0x61'),'HOUR':_0x2278('0x8f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2278('0x62')};var _0x460a90=function(_0x57c595){return!_[_0x2278('0x7f')]([_0x2278('0x63'),_0x2278('0x64'),_0x2278('0x65'),_0x2278('0x66')],_0x57c595);};var _0x454854=function(_0x4232ea){if(!_0x4232ea||!_0x4232ea[_0x2278('0x67')][_0x2278('0x3d')]){return'';}for(var _0x22851a='(',_0x4fb971=0x0;_0x4fb971<_0x4232ea[_0x2278('0x67')][_0x2278('0x3d')];_0x4fb971+=0x1){_0x4fb971>0x0&&(_0x22851a+='\x20'+_0x4232ea[_0x2278('0x68')]+'\x20');_0x22851a+=_0x4232ea[_0x2278('0x67')][_0x4fb971][_0x2278('0x69')]?_0x454854(_0x4232ea[_0x2278('0x67')][_0x4fb971][_0x2278('0x69')]):_0x4232ea['rules'][_0x4fb971][_0x2278('0x6a')]+'\x20'+_0x4232ea[_0x2278('0x67')][_0x4fb971]['condition']+(_0x460a90(_0x4232ea[_0x2278('0x67')][_0x4fb971][_0x2278('0x6b')])?'\x20'+_0x4232ea[_0x2278('0x67')][_0x4fb971]['value']:'');}return _0x22851a+')';};var _0x27dc1a={'where':{'id':_0x115f9b['id']}},_0x1d2602,_0x3456ef,_0x574983,_0x32eb6c,_0x3f3d97;_0x27dc1a=_[_0x2278('0x43')]({},_0x27dc1a,_0x4799b8);return db[_0x2278('0x47')][_0x2278('0x55')](_0x27dc1a)[_0x2278('0x26')](function(_0x38853a){if(_0x38853a){_0x1d2602=_0x38853a;return _0x38853a[_0x2278('0x6d')]();}return null;})[_0x2278('0x26')](function(_0x1b2f17){if(_0x1b2f17){if(!_0x1b2f17['length']){throw new db[(_0x2278('0x6e'))][(_0x2278('0x6f'))](_0x2278('0x70'),0x193);}_0x3456ef=_0x1b2f17;return db[_0x2278('0x71')][_0x2278('0x48')]({'raw':!![]});}return null;})[_0x2278('0x26')](function(_0x789039){if(_0x789039){_0x574983=_[_0x2278('0x72')](_0x789039,'id');var _0x513082;var _0x366cba=squel[_0x2278('0x73')]();_0x366cba[_0x2278('0x74')](_0x1d2602[_0x2278('0x75')]);for(var _0x10d06b=0x0;_0x10d06b<_0x3456ef[_0x2278('0x3d')];_0x10d06b+=0x1){_0x513082=_0x3456ef[_0x10d06b][_0x2278('0x76')]?_0x574983[_0x3456ef[_0x10d06b][_0x2278('0x76')]][_0x2278('0x77')]:_0x3456ef[_0x10d06b]['field'];_0x513082=_0x3456ef[_0x10d06b][_0x2278('0x78')]?_[_0x2278('0x79')](_0x52734a[_0x3456ef[_0x10d06b][_0x2278('0x78')]],'%s',_0x513082):_0x513082;_0x513082=_0x3456ef[_0x10d06b][_0x2278('0x7a')]?_[_0x2278('0x79')](_0x1f8ddc[_0x3456ef[_0x10d06b]['format']],'%s',_0x513082):_0x513082;if(_0x3456ef[_0x10d06b][_0x2278('0x90')]){_0x366cba[_0x2278('0x69')](_0x513082);}_0x3456ef[_0x10d06b][_0x2278('0x7b')]&&_0x366cba[_0x2278('0x3f')](_0x513082,_0x3456ef[_0x10d06b][_0x2278('0x7b')]===_0x2278('0x7c')?![]:!![]);_0x366cba[_0x2278('0x6a')](_0x513082,_0x3456ef[_0x10d06b][_0x2278('0x7d')]||_0x513082);}if(_0x1d2602[_0x2278('0x7e')]){_0x1d2602[_0x2278('0x7e')]=JSON['parse'](_0x1d2602[_0x2278('0x7e')]);for(var _0x404341=0x0;_0x404341<_0x1d2602['joins'][_0x2278('0x3d')];_0x404341+=0x1){if(_0x1d2602['joins'][_0x404341][_0x2278('0x34')]&&_[_0x2278('0x7f')](_0xab597a,_0x1d2602[_0x2278('0x7e')][_0x404341][_0x2278('0x34')])&&_0x1d2602[_0x2278('0x7e')][_0x404341]['parentKey']&&_0x1d2602[_0x2278('0x7e')][_0x404341][_0x2278('0x82')]&&_0x1d2602['joins'][_0x404341][_0x2278('0x81')]){_0x366cba[_0x1d2602[_0x2278('0x7e')][_0x404341][_0x2278('0x34')]](_0x1d2602[_0x2278('0x7e')][_0x404341][_0x2278('0x82')],null,util[_0x2278('0x7a')](_0x2278('0x91'),_0x1d2602[_0x2278('0x75')],_0x1d2602[_0x2278('0x7e')][_0x404341][_0x2278('0x80')],_0x1d2602['joins'][_0x404341]['foreignTable'],_0x1d2602[_0x2278('0x7e')][_0x404341][_0x2278('0x81')]));}}}if(_0x1d2602[_0x2278('0x83')]){_0x1d2602['conditions']=JSON['parse'](_0x1d2602[_0x2278('0x83')]);_0x366cba[_0x2278('0x42')](_0x454854(_0x1d2602[_0x2278('0x83')][_0x2278('0x69')]));}_0x3f3d97=_0x366cba[_0x2278('0x84')]();_0x366cba['limit'](_0x31ab77);_0x366cba['offset'](0x0);return;}})[_0x2278('0x26')](function(){if(_0x36755a[_0x2278('0x92')]===_0x2278('0x93')){return null;}var _0x49a3d6=_[_0x2278('0x43')](_0x36755a,{'name':_0x36755a[_0x2278('0x94')]||_0x36755a[_0x2278('0x2e')]||_0x1d2602[_0x2278('0x2e')],'basename':_0x1ba91f,'savename':util['format']('%s-%s.%s',_0x36755a[_0x2278('0x2e')]||_0x1d2602[_0x2278('0x2e')],require('randomstring')[_0x2278('0x95')](0x4),_0x36755a['output']||_0x2278('0x96')),'reportId':_0x1d2602['id'],'reportType':_0x2278('0x97')});return db[_0x2278('0x98')]['create'](_0x49a3d6,{'raw':!![]});})[_0x2278('0x26')](function(_0x45ab0f){if(_0x1d2602[_0x2278('0x75')]==='cdr'){_0x3f3d97[_0x2278('0x42')](_0x1d2602[_0x2278('0x75')]+_0x2278('0x99'),_0x36755a['startDate'],_0x36755a[_0x2278('0x9a')]);}else{_0x3f3d97[_0x2278('0x42')](_0x1d2602['table']+_0x2278('0x9b'),_0x36755a[_0x2278('0x9c')],_0x36755a[_0x2278('0x9a')]);}if(_0x45ab0f){logger['info'](_0x2278('0x9d'),_0x3f3d97[_0x2278('0x86')]());require('child_process')[_0x2278('0x9e')](path[_0x2278('0x9f')](__dirname,_0x2278('0xa0'),_0x45ab0f[_0x2278('0x92')]),[_0x45ab0f['id'],_0x3f3d97['toString'](),path['join'](__dirname,_0x2278('0xa1'),_0x45ab0f[_0x2278('0xa2')]),_0x1ba91f]);return _0x45ab0f;}else{var _0x292e4b=squel[_0x2278('0x73')]();_0x292e4b[_0x2278('0x74')]('('+_0x3f3d97[_0x2278('0x86')]()+')',_0x2278('0xa3'));_0x292e4b[_0x2278('0x6a')]('COUNT(*)',_0x2278('0x22'));_0x3f3d97['limit'](_0x36755a[_0x2278('0x21')]||_0x31ab77);_0x3f3d97[_0x2278('0x1f')](_0x36755a[_0x2278('0x1f')]||0x0);return dbH['sequelize'][_0x2278('0x37')](_0x292e4b[_0x2278('0x86')](),{'type':dbH[_0x2278('0x87')]['QueryTypes']['SELECT']})[_0x2278('0x26')](function(_0x1dd966){if(!_0x1dd966[_0x2278('0x3d')]){_0x32eb6c=0x0;}else{_0x32eb6c=_0x1dd966[0x0][_0x2278('0x22')]||0x0;}return dbH[_0x2278('0x87')][_0x2278('0x37')](_0x3f3d97[_0x2278('0x86')](),{'type':dbH[_0x2278('0x87')]['QueryTypes'][_0x2278('0x89')]});})['then'](function(_0x576ec1){return{'rows':_0x576ec1||[],'count':_0x32eb6c};});}});}exports[_0x2278('0xa4')]=function(_0x3a933b,_0x526461){return runReport(_0x3a933b[_0x2278('0x4b')],_0x3a933b[_0x2278('0x37')],_0x3a933b[_0x2278('0x45')])[_0x2278('0x26')](respondWithResult(_0x526461,null))[_0x2278('0x4d')](handleError(_0x526461,null));};exports[_0x2278('0xa5')]=runReport;exports[_0x2278('0x37')]=function(_0x565e38,_0x1c5042){var _0x2f99b9=0xa;var _0x551457=['join',_0x2278('0x59'),_0x2278('0x5a'),_0x2278('0x5b')];var _0x571d9f={'SUM':_0x2278('0x8a'),'COUNT':_0x2278('0x5c'),'COUNT DISTINCT':_0x2278('0x8b'),'MAX':_0x2278('0x8c'),'MIN':_0x2278('0x8d'),'AVG':_0x2278('0x5d'),'GROUP_CONCAT':_0x2278('0x5e'),'GROUP_CONCAT ASC':_0x2278('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x572669={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2278('0x61'),'HOUR':_0x2278('0x8f'),'ROUND':_0x2278('0xa6'),'UNIX_TIMESTAMP':_0x2278('0x62')};var _0x33201f=function(_0x544d17){return!_[_0x2278('0x7f')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x2278('0x65'),_0x2278('0x66')],_0x544d17);};var _0x1b8e0c=function(_0x48e48e){if(!_0x48e48e||!_0x48e48e[_0x2278('0x67')][_0x2278('0x3d')]){return'';}for(var _0x436acb='(',_0x5ec73f=0x0;_0x5ec73f<_0x48e48e[_0x2278('0x67')][_0x2278('0x3d')];_0x5ec73f+=0x1){_0x5ec73f>0x0&&(_0x436acb+='\x20'+_0x48e48e['operator']+'\x20');_0x436acb+=_0x48e48e[_0x2278('0x67')][_0x5ec73f][_0x2278('0x69')]?_0x1b8e0c(_0x48e48e[_0x2278('0x67')][_0x5ec73f][_0x2278('0x69')]):_0x48e48e[_0x2278('0x67')][_0x5ec73f][_0x2278('0x6a')]+'\x20'+_0x48e48e[_0x2278('0x67')][_0x5ec73f][_0x2278('0x6b')]+(_0x33201f(_0x48e48e[_0x2278('0x67')][_0x5ec73f][_0x2278('0x6b')])?'\x20'+_0x48e48e['rules'][_0x5ec73f][_0x2278('0x6c')]:'');}return _0x436acb+')';};var _0x40ef9a={'where':{'id':_0x565e38['params']['id']}},_0x144f14,_0x379c4e,_0x5ede6e,_0x2c2540,_0x3e66a4;_0x40ef9a=_[_0x2278('0x43')]({},_0x40ef9a,_0x565e38['options']);return db[_0x2278('0x47')]['find'](_0x40ef9a)[_0x2278('0x26')](function(_0x2feae4){if(_0x2feae4){_0x144f14=_0x2feae4;return _0x2feae4[_0x2278('0x6d')]();}return null;})['then'](function(_0x2bfd49){if(_0x2bfd49){if(!_0x2bfd49[_0x2278('0x3d')]){throw new db[(_0x2278('0x6e'))]['ValidationErrorItem'](_0x2278('0x70'),0x193);}_0x379c4e=_0x2bfd49;return db[_0x2278('0x71')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x15a478){if(_0x15a478){_0x5ede6e=_[_0x2278('0x72')](_0x15a478,'id');var _0x26034a;var _0x194aff=squel[_0x2278('0x73')]();_0x194aff['from'](_0x144f14['table']);for(var _0x53315f=0x0;_0x53315f<_0x379c4e[_0x2278('0x3d')];_0x53315f+=0x1){_0x26034a=_0x379c4e[_0x53315f][_0x2278('0x76')]?_0x5ede6e[_0x379c4e[_0x53315f][_0x2278('0x76')]][_0x2278('0x77')]:_0x379c4e[_0x53315f]['field'];_0x26034a=_0x379c4e[_0x53315f][_0x2278('0x78')]?_[_0x2278('0x79')](_0x571d9f[_0x379c4e[_0x53315f]['function']],'%s',_0x26034a):_0x26034a;_0x26034a=_0x379c4e[_0x53315f]['format']?_[_0x2278('0x79')](_0x572669[_0x379c4e[_0x53315f][_0x2278('0x7a')]],'%s',_0x26034a):_0x26034a;if(_0x379c4e[_0x53315f][_0x2278('0x90')]){_0x194aff[_0x2278('0x69')](_0x26034a);}_0x379c4e[_0x53315f][_0x2278('0x7b')]&&_0x194aff[_0x2278('0x3f')](_0x26034a,_0x379c4e[_0x53315f][_0x2278('0x7b')]==='DESC'?![]:!![]);_0x194aff[_0x2278('0x6a')](_0x26034a,_0x379c4e[_0x53315f][_0x2278('0x7d')]||_0x26034a);}if(_0x144f14['joins']){_0x144f14[_0x2278('0x7e')]=JSON[_0x2278('0xa7')](_0x144f14['joins']);for(var _0x536d83=0x0;_0x536d83<_0x144f14['joins']['length'];_0x536d83+=0x1){if(_0x144f14[_0x2278('0x7e')][_0x536d83][_0x2278('0x34')]&&_[_0x2278('0x7f')](_0x551457,_0x144f14[_0x2278('0x7e')][_0x536d83][_0x2278('0x34')])&&_0x144f14[_0x2278('0x7e')][_0x536d83][_0x2278('0x80')]&&_0x144f14['joins'][_0x536d83][_0x2278('0x82')]&&_0x144f14[_0x2278('0x7e')][_0x536d83][_0x2278('0x81')]){_0x194aff[_0x144f14['joins'][_0x536d83][_0x2278('0x34')]](_0x144f14[_0x2278('0x7e')][_0x536d83][_0x2278('0x82')],null,util[_0x2278('0x7a')](_0x2278('0x91'),_0x144f14[_0x2278('0x75')],_0x144f14[_0x2278('0x7e')][_0x536d83]['parentKey'],_0x144f14[_0x2278('0x7e')][_0x536d83]['foreignTable'],_0x144f14['joins'][_0x536d83][_0x2278('0x81')]));}}}if(_0x144f14[_0x2278('0x83')]){_0x144f14[_0x2278('0x83')]=JSON[_0x2278('0xa7')](_0x144f14['conditions']);_0x194aff[_0x2278('0x42')](_0x1b8e0c(_0x144f14[_0x2278('0x83')][_0x2278('0x69')]));}_0x3e66a4=_0x194aff['clone']();_0x194aff[_0x2278('0x21')](_0x2f99b9);_0x194aff[_0x2278('0x1f')](0x0);logger[_0x2278('0x85')]('Limited\x20Query:',_0x194aff[_0x2278('0x86')]());return dbH[_0x2278('0x87')]['query'](_0x194aff[_0x2278('0x86')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x2278('0x26')](function(){return{'sql':_0x3e66a4[_0x2278('0x86')]()};})[_0x2278('0x26')](respondWithResult(_0x1c5042,null))[_0x2278('0x4d')](handleError(_0x1c5042,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 3e93c68..26afb32 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 _0x7cdc=['exports','define','analytics_custom_reports','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7cdc,0x1b1));var _0xc7cd=function(_0x5d007a,_0xcba219){_0x5d007a=_0x5d007a-0x0;var _0x44f5e3=_0x7cdc[_0x5d007a];return _0x44f5e3;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var logger=require(_0xc7cd('0x1'))('api');var moment=require(_0xc7cd('0x2'));var BPromise=require('bluebird');var rp=require(_0xc7cd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7cd('0x4'));var config=require(_0xc7cd('0x5'));var attributes=require(_0xc7cd('0x6'));module[_0xc7cd('0x7')]=function(_0x4c1e46,_0x26e6cd){return _0x4c1e46[_0xc7cd('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xc7cd('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bae=['exports','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x8bae,0x6f));var _0xe8ba=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x8bae[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0xe8ba('0x0'));var logger=require(_0xe8ba('0x1'))(_0xe8ba('0x2'));var moment=require(_0xe8ba('0x3'));var BPromise=require(_0xe8ba('0x4'));var rp=require(_0xe8ba('0x5'));var fs=require('fs');var path=require(_0xe8ba('0x6'));var rimraf=require('rimraf');var config=require(_0xe8ba('0x7'));var attributes=require(_0xe8ba('0x8'));module[_0xe8ba('0x9')]=function(_0x438dc0,_0x5f5927){return _0x438dc0['define'](_0xe8ba('0xa'),attributes,{'tableName':_0xe8ba('0xb'),'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 4d9b8a7..f12094f 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 _0x5c39=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x5c39,0xff));var _0x95c3=function(_0x42df4b,_0x5133ba){_0x42df4b=_0x42df4b-0x0;var _0x167966=_0x5c39[_0x42df4b];return _0x167966;};'use strict';var _=require('lodash');var util=require(_0x95c3('0x0'));var moment=require(_0x95c3('0x1'));var BPromise=require(_0x95c3('0x2'));var rs=require(_0x95c3('0x3'));var fs=require('fs');var Redis=require(_0x95c3('0x4'));var db=require(_0x95c3('0x5'))['db'];var utils=require(_0x95c3('0x6'));var logger=require(_0x95c3('0x7'))(_0x95c3('0x8'));var config=require(_0x95c3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x95c3('0xa')][_0x95c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22e219,_0x20d5ad,_0x4d9134){return new BPromise(function(_0x1ad5b8,_0x2b58ba){return client[_0x95c3('0xc')](_0x22e219,_0x4d9134)[_0x95c3('0xd')](function(_0x127673){logger[_0x95c3('0xe')](_0x95c3('0xf'),_0x20d5ad,_0x95c3('0x10'));logger[_0x95c3('0x11')](_0x95c3('0x12'),_0x20d5ad,_0x95c3('0x10'),JSON['stringify'](_0x127673));if(_0x127673[_0x95c3('0x13')]){if(_0x127673[_0x95c3('0x13')]['code']===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x20d5ad,_0x127673['error']['message']);return _0x2b58ba(_0x127673['error'][_0x95c3('0x14')]);}logger[_0x95c3('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x20d5ad,_0x127673[_0x95c3('0x13')][_0x95c3('0x14')]);return _0x1ad5b8(_0x127673['error'][_0x95c3('0x14')]);}else{logger['info'](_0x95c3('0xf'),_0x20d5ad,_0x95c3('0x10'));_0x1ad5b8(_0x127673[_0x95c3('0x15')][_0x95c3('0x14')]);}})[_0x95c3('0x16')](function(_0x3143db){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x20d5ad,_0x3143db);_0x2b58ba(_0x3143db);});});} \ No newline at end of file +var _0x3f4c=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x3f4c,0x83));var _0xc3f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f4c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc3f4('0x0'));var util=require('util');var moment=require(_0xc3f4('0x1'));var BPromise=require('bluebird');var rs=require(_0xc3f4('0x2'));var fs=require('fs');var Redis=require(_0xc3f4('0x3'));var db=require(_0xc3f4('0x4'))['db'];var utils=require(_0xc3f4('0x5'));var logger=require(_0xc3f4('0x6'))('rpc');var config=require(_0xc3f4('0x7'));var jayson=require(_0xc3f4('0x8'));var client=jayson[_0xc3f4('0x9')][_0xc3f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a9794,_0x2e63bb,_0x578a59){return new BPromise(function(_0x3adf45,_0x4e9d29){return client[_0xc3f4('0xb')](_0x5a9794,_0x578a59)[_0xc3f4('0xc')](function(_0x425469){logger[_0xc3f4('0xd')](_0xc3f4('0xe'),_0x2e63bb,_0xc3f4('0xf'));logger['debug'](_0xc3f4('0x10'),_0x2e63bb,_0xc3f4('0xf'),JSON[_0xc3f4('0x11')](_0x425469));if(_0x425469[_0xc3f4('0x12')]){if(_0x425469[_0xc3f4('0x12')][_0xc3f4('0x13')]===0x1f4){logger[_0xc3f4('0x12')](_0xc3f4('0xe'),_0x2e63bb,_0x425469[_0xc3f4('0x12')]['message']);return _0x4e9d29(_0x425469['error'][_0xc3f4('0x14')]);}logger[_0xc3f4('0x12')](_0xc3f4('0xe'),_0x2e63bb,_0x425469['error']['message']);return _0x3adf45(_0x425469[_0xc3f4('0x12')][_0xc3f4('0x14')]);}else{logger['info'](_0xc3f4('0xe'),_0x2e63bb,_0xc3f4('0xf'));_0x3adf45(_0x425469[_0xc3f4('0x15')]['message']);}})[_0xc3f4('0x16')](function(_0x58a808){logger[_0xc3f4('0x12')](_0xc3f4('0xe'),_0x2e63bb,_0x58a808);_0x4e9d29(_0x58a808);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 09e1cc7..e23dc55 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 _0x635a=['query','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query'];(function(_0x40a4e8,_0x4f0b81){var _0x30f2cd=function(_0x38b3e8){while(--_0x38b3e8){_0x40a4e8['push'](_0x40a4e8['shift']());}};_0x30f2cd(++_0x4f0b81);}(_0x635a,0x13f));var _0xa635=function(_0x3c9782,_0x2741b7){_0x3c9782=_0x3c9782-0x0;var _0x15b97c=_0x635a[_0x3c9782];return _0x15b97c;};'use strict';var multer=require(_0xa635('0x0'));var util=require('util');var path=require(_0xa635('0x1'));var timeout=require(_0xa635('0x2'));var express=require(_0xa635('0x3'));var router=express[_0xa635('0x4')]();var fs_extra=require(_0xa635('0x5'));var auth=require(_0xa635('0x6'));var interaction=require(_0xa635('0x7'));var config=require(_0xa635('0x8'));var controller=require(_0xa635('0x9'));router[_0xa635('0xa')]('/',auth[_0xa635('0xb')](),controller[_0xa635('0xc')]);router[_0xa635('0xa')](_0xa635('0xd'),auth[_0xa635('0xb')](),controller[_0xa635('0xe')]);router[_0xa635('0xa')](_0xa635('0xf'),auth[_0xa635('0xb')](),controller[_0xa635('0x10')]);router[_0xa635('0xa')]('/:id/run',auth[_0xa635('0xb')](),controller[_0xa635('0x11')]);router['get'](_0xa635('0x12'),auth[_0xa635('0xb')](),controller[_0xa635('0x13')]);router[_0xa635('0x14')]('/',auth[_0xa635('0xb')](),controller[_0xa635('0x15')]);router[_0xa635('0x16')](_0xa635('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa635('0x17')](_0xa635('0xd'),auth[_0xa635('0xb')](),controller[_0xa635('0x18')]);module[_0xa635('0x19')]=router; \ No newline at end of file +var _0x1f59=['./analyticCustomReport.controller','get','isAuthenticated','show','/:id/preview','run','query','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5cad2d,_0x21820a){var _0x1ab2a1=function(_0x1e6383){while(--_0x1e6383){_0x5cad2d['push'](_0x5cad2d['shift']());}};_0x1ab2a1(++_0x21820a);}(_0x1f59,0x167));var _0x91f5=function(_0x48cc90,_0x1ed37e){_0x48cc90=_0x48cc90-0x0;var _0x6149a9=_0x1f59[_0x48cc90];return _0x6149a9;};'use strict';var multer=require(_0x91f5('0x0'));var util=require('util');var path=require(_0x91f5('0x1'));var timeout=require(_0x91f5('0x2'));var express=require(_0x91f5('0x3'));var router=express[_0x91f5('0x4')]();var fs_extra=require(_0x91f5('0x5'));var auth=require(_0x91f5('0x6'));var interaction=require(_0x91f5('0x7'));var config=require(_0x91f5('0x8'));var controller=require(_0x91f5('0x9'));router[_0x91f5('0xa')]('/',auth[_0x91f5('0xb')](),controller['index']);router['get']('/:id',auth[_0x91f5('0xb')](),controller[_0x91f5('0xc')]);router['get'](_0x91f5('0xd'),auth['isAuthenticated'](),controller['preview']);router[_0x91f5('0xa')]('/:id/run',auth[_0x91f5('0xb')](),controller[_0x91f5('0xe')]);router[_0x91f5('0xa')]('/:id/query',auth[_0x91f5('0xb')](),controller[_0x91f5('0xf')]);router[_0x91f5('0x10')]('/',auth[_0x91f5('0xb')](),controller['create']);router[_0x91f5('0x11')](_0x91f5('0x12'),auth['isAuthenticated'](),controller[_0x91f5('0x13')]);router[_0x91f5('0x14')](_0x91f5('0x12'),auth[_0x91f5('0xb')](),controller[_0x91f5('0x15')]);module[_0x91f5('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6e4fa80..50f13c7 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 _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x4ec863,_0x85080a){var _0x2071fc=function(_0x5a49a2){while(--_0x5a49a2){_0x4ec863['push'](_0x4ec863['shift']());}};_0x2071fc(++_0x85080a);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x576e92,_0x165314){_0x576e92=_0x576e92-0x0;var _0x24c32e=_0xf2ca[_0x576e92];return _0x24c32e;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0xf398c2,_0x11c9d9){var _0x1b0c04=function(_0x319ecf){while(--_0x319ecf){_0xf398c2['push'](_0xf398c2['shift']());}};_0x1b0c04(++_0x11c9d9);}(_0xe14b,0x93));var _0xbe14=function(_0x11e904,_0x2f5109){_0x11e904=_0x11e904-0x0;var _0x121419=_0xe14b[_0x11e904];return _0x121419;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index bf1f354..5ee7b78 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 _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','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','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x577cb0,_0x26747e){var _0x25d4e9=function(_0x13ca7a){while(--_0x13ca7a){_0x577cb0['push'](_0x577cb0['shift']());}};_0x25d4e9(++_0x26747e);}(_0xda19,0xd5));var _0x9da1=function(_0x268306,_0x146a9e){_0x268306=_0x268306-0x0;var _0x488ae7=_0xda19[_0x268306];return _0x488ae7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x7a54,0x106));var _0x47a5=function(_0x2b0069,_0x14ee17){_0x2b0069=_0x2b0069-0x0;var _0x36c12a=_0x7a54[_0x2b0069];return _0x36c12a;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a50f8de..fd1c875 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 _0xea45=['lodash','util','api','bluebird','./analyticDefaultReport.attributes','exports','analytics_default_reports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea45,0x1a4));var _0x5ea4=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xea45[_0x3a78a0];return _0x48e917;};'use strict';var _=require(_0x5ea4('0x0'));var util=require(_0x5ea4('0x1'));var logger=require('../../config/logger')(_0x5ea4('0x2'));var moment=require('moment');var BPromise=require(_0x5ea4('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(_0x5ea4('0x4'));module[_0x5ea4('0x5')]=function(_0x541f27,_0x15b32a){return _0x541f27['define']('AnalyticDefaultReport',attributes,{'tableName':_0x5ea4('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf14=['analytics_default_reports','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xaf14,0x6d));var _0x4af1=function(_0x2c17b3,_0xbbee65){_0x2c17b3=_0x2c17b3-0x0;var _0x3d9734=_0xaf14[_0x2c17b3];return _0x3d9734;};'use strict';var _=require('lodash');var util=require(_0x4af1('0x0'));var logger=require(_0x4af1('0x1'))(_0x4af1('0x2'));var moment=require(_0x4af1('0x3'));var BPromise=require('bluebird');var rp=require(_0x4af1('0x4'));var fs=require('fs');var path=require(_0x4af1('0x5'));var rimraf=require(_0x4af1('0x6'));var config=require(_0x4af1('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x4af1('0x8')]=function(_0x22981f,_0x3ee1a1){return _0x22981f[_0x4af1('0x9')](_0x4af1('0xa'),attributes,{'tableName':_0x4af1('0xb'),'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 28ec188..c430afd 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 _0x63bb=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x245cab,_0x565284){var _0x144703=function(_0xcbc535){while(--_0xcbc535){_0x245cab['push'](_0x245cab['shift']());}};_0x144703(++_0x565284);}(_0x63bb,0x6d));var _0xb63b=function(_0x1653bf,_0x43083b){_0x1653bf=_0x1653bf-0x0;var _0xe57166=_0x63bb[_0x1653bf];return _0xe57166;};'use strict';var _=require('lodash');var util=require(_0xb63b('0x0'));var moment=require(_0xb63b('0x1'));var BPromise=require(_0xb63b('0x2'));var rs=require(_0xb63b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb63b('0x4'))['db'];var utils=require(_0xb63b('0x5'));var logger=require(_0xb63b('0x6'))('rpc');var config=require(_0xb63b('0x7'));var jayson=require(_0xb63b('0x8'));var client=jayson['client'][_0xb63b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x374842,_0x4161f6,_0x42f075){return new BPromise(function(_0x1e8612,_0x3fd31b){return client[_0xb63b('0xa')](_0x374842,_0x42f075)[_0xb63b('0xb')](function(_0x246843){logger[_0xb63b('0xc')](_0xb63b('0xd'),_0x4161f6,'request\x20sent');logger['debug'](_0xb63b('0xe'),_0x4161f6,_0xb63b('0xf'),JSON[_0xb63b('0x10')](_0x246843));if(_0x246843['error']){if(_0x246843[_0xb63b('0x11')]['code']===0x1f4){logger[_0xb63b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4161f6,_0x246843[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x3fd31b(_0x246843[_0xb63b('0x11')]['message']);}logger[_0xb63b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4161f6,_0x246843[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x1e8612(_0x246843[_0xb63b('0x11')][_0xb63b('0x12')]);}else{logger['info'](_0xb63b('0xd'),_0x4161f6,_0xb63b('0xf'));_0x1e8612(_0x246843['result'][_0xb63b('0x12')]);}})[_0xb63b('0x13')](function(_0x584bac){logger['error'](_0xb63b('0xd'),_0x4161f6,_0x584bac);_0x3fd31b(_0x584bac);});});} \ No newline at end of file +var _0x6470=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x54947f,_0x542848){var _0x290689=function(_0x307550){while(--_0x307550){_0x54947f['push'](_0x54947f['shift']());}};_0x290689(++_0x542848);}(_0x6470,0x67));var _0x0647=function(_0xe1e32f,_0x42c4d6){_0xe1e32f=_0xe1e32f-0x0;var _0x27447f=_0x6470[_0xe1e32f];return _0x27447f;};'use strict';var _=require(_0x0647('0x0'));var util=require(_0x0647('0x1'));var moment=require(_0x0647('0x2'));var BPromise=require(_0x0647('0x3'));var rs=require(_0x0647('0x4'));var fs=require('fs');var Redis=require(_0x0647('0x5'));var db=require(_0x0647('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0647('0x7'))('rpc');var config=require(_0x0647('0x8'));var jayson=require(_0x0647('0x9'));var client=jayson[_0x0647('0xa')][_0x0647('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e6893,_0x51cf52,_0x5b5f29){return new BPromise(function(_0x4618c6,_0xbd1f1d){return client[_0x0647('0xc')](_0x2e6893,_0x5b5f29)[_0x0647('0xd')](function(_0x32bf63){logger[_0x0647('0xe')](_0x0647('0xf'),_0x51cf52,_0x0647('0x10'));logger['debug'](_0x0647('0x11'),_0x51cf52,_0x0647('0x10'),JSON[_0x0647('0x12')](_0x32bf63));if(_0x32bf63['error']){if(_0x32bf63['error'][_0x0647('0x13')]===0x1f4){logger['error'](_0x0647('0xf'),_0x51cf52,_0x32bf63['error'][_0x0647('0x14')]);return _0xbd1f1d(_0x32bf63['error']['message']);}logger['error'](_0x0647('0xf'),_0x51cf52,_0x32bf63[_0x0647('0x15')][_0x0647('0x14')]);return _0x4618c6(_0x32bf63['error'][_0x0647('0x14')]);}else{logger[_0x0647('0xe')](_0x0647('0xf'),_0x51cf52,_0x0647('0x10'));_0x4618c6(_0x32bf63[_0x0647('0x16')]['message']);}})[_0x0647('0x17')](function(_0xe221c8){logger['error'](_0x0647('0xf'),_0x51cf52,_0xe221c8);_0xbd1f1d(_0xe221c8);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1639a9c..d3dfa2c 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 _0xbdf6=['create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','/:id/preview','preview','run','/:id/query','query','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbdf6,0x7c));var _0x6bdf=function(_0x411644,_0xe6e988){_0x411644=_0x411644-0x0;var _0x2eefc9=_0xbdf6[_0x411644];return _0x2eefc9;};'use strict';var multer=require(_0x6bdf('0x0'));var util=require(_0x6bdf('0x1'));var path=require(_0x6bdf('0x2'));var timeout=require(_0x6bdf('0x3'));var express=require(_0x6bdf('0x4'));var router=express[_0x6bdf('0x5')]();var fs_extra=require(_0x6bdf('0x6'));var auth=require(_0x6bdf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6bdf('0x8'));var controller=require(_0x6bdf('0x9'));router['get']('/',auth[_0x6bdf('0xa')](),controller[_0x6bdf('0xb')]);router[_0x6bdf('0xc')](_0x6bdf('0xd'),auth[_0x6bdf('0xa')](),controller['show']);router[_0x6bdf('0xc')](_0x6bdf('0xe'),auth['isAuthenticated'](),controller[_0x6bdf('0xf')]);router[_0x6bdf('0xc')]('/:id/run',auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x10')]);router[_0x6bdf('0xc')](_0x6bdf('0x11'),auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x12')]);router[_0x6bdf('0x13')]('/',auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x14')]);router[_0x6bdf('0x15')](_0x6bdf('0xd'),auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x16')]);router['delete'](_0x6bdf('0xd'),auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0946=['put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','show','preview','run','/:id/query','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0946,0xf5));var _0x6094=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x0946[_0x2cc711];return _0x31a52e;};'use strict';var multer=require(_0x6094('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6094('0x1'));var express=require(_0x6094('0x2'));var router=express[_0x6094('0x3')]();var fs_extra=require(_0x6094('0x4'));var auth=require(_0x6094('0x5'));var interaction=require(_0x6094('0x6'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x6094('0x7')](),controller['index']);router[_0x6094('0x8')]('/:id',auth[_0x6094('0x7')](),controller[_0x6094('0x9')]);router[_0x6094('0x8')]('/:id/preview',auth[_0x6094('0x7')](),controller[_0x6094('0xa')]);router[_0x6094('0x8')]('/:id/run',auth[_0x6094('0x7')](),controller[_0x6094('0xb')]);router[_0x6094('0x8')](_0x6094('0xc'),auth[_0x6094('0x7')](),controller['query']);router[_0x6094('0xd')]('/',auth[_0x6094('0x7')](),controller[_0x6094('0xe')]);router[_0x6094('0xf')](_0x6094('0x10'),auth[_0x6094('0x7')](),controller[_0x6094('0x11')]);router[_0x6094('0x12')](_0x6094('0x10'),auth[_0x6094('0x7')](),controller[_0x6094('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e60d8dc..fcc8e0a 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 _0x974a=['moment','exports','STRING','ENUM','csv','pdf','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x48863d,_0xb57402){var _0x16c8f1=function(_0xbc21a4){while(--_0xbc21a4){_0x48863d['push'](_0x48863d['shift']());}};_0x16c8f1(++_0xb57402);}(_0x974a,0x137));var _0xa974=function(_0x55a740,_0x2e70eb){_0x55a740=_0x55a740-0x0;var _0xc2679=_0x974a[_0x55a740];return _0xc2679;};'use strict';var Sequelize=require(_0xa974('0x0'));var moment=require(_0xa974('0x1'));module[_0xa974('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xa974('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa974('0x4')](_0xa974('0x5'),_0xa974('0x6'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xa974('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa974('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xa974('0x3')],'defaultValue':_0xa974('0x8')},'type':{'type':Sequelize[_0xa974('0x4')](_0xa974('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xa974('0x9')},'reportId':{'type':Sequelize[_0xa974('0xa')](0xb)[_0xa974('0xb')]},'reportType':{'type':Sequelize[_0xa974('0x3')]}}; \ No newline at end of file +var _0x51b7=['scheduled','UNSIGNED','sequelize','ENUM','csv','STRING','DATE','Loading','manual'];(function(_0xc48d87,_0x40d00e){var _0x174b19=function(_0x26d7b6){while(--_0x26d7b6){_0xc48d87['push'](_0xc48d87['shift']());}};_0x174b19(++_0x40d00e);}(_0x51b7,0x173));var _0x751b=function(_0x35986b,_0x7538d1){_0x35986b=_0x35986b-0x0;var _0x1ecd57=_0x51b7[_0x35986b];return _0x1ecd57;};'use strict';var Sequelize=require(_0x751b('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x751b('0x1')](_0x751b('0x2'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x751b('0x2')},'savename':{'type':Sequelize[_0x751b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x751b('0x4')]},'endDate':{'type':Sequelize[_0x751b('0x4')]},'status':{'type':Sequelize[_0x751b('0x3')],'defaultValue':_0x751b('0x5')},'type':{'type':Sequelize[_0x751b('0x1')](_0x751b('0x6'),_0x751b('0x7')),'allowNull':![],'defaultValue':_0x751b('0x6')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x751b('0x8')]},'reportType':{'type':Sequelize[_0x751b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 27ff276..05e2143 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 _0xd227=['where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','download','%s.%s','toLowerCase','rimraf','moment','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3aa0f0,_0x14b9c6){var _0x3dc85d=function(_0x1ce464){while(--_0x1ce464){_0x3aa0f0['push'](_0x3aa0f0['shift']());}};_0x3dc85d(++_0x14b9c6);}(_0xd227,0x13a));var _0x7d22=function(_0x4ed6c7,_0x2e6803){_0x4ed6c7=_0x4ed6c7-0x0;var _0x112d0c=_0xd227[_0x4ed6c7];return _0x112d0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d22('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d22('0x1'));var BPromise=require(_0x7d22('0x2'));var Mustache=require('mustache');var util=require(_0x7d22('0x3'));var path=require(_0x7d22('0x4'));var sox=require(_0x7d22('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d22('0x6'));var squel=require(_0x7d22('0x7'));var crypto=require('crypto');var jsforce=require(_0x7d22('0x8'));var deskjs=require(_0x7d22('0x9'));var toCsv=require(_0x7d22('0xa'));var querystring=require(_0x7d22('0xb'));var Papa=require(_0x7d22('0xc'));var Redis=require('ioredis');var authService=require(_0x7d22('0xd'));var qs=require(_0x7d22('0xe'));var as=require(_0x7d22('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d22('0x10'))('api');var utils=require(_0x7d22('0x11'));var config=require(_0x7d22('0x12'));var licenseUtil=require(_0x7d22('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe99f1,_0x5b9388){_0x5b9388=_0x5b9388||0xcc;return function(_0xde93c0){if(_0xde93c0){return _0xfe99f1['sendStatus'](_0x5b9388);}return _0xfe99f1[_0x7d22('0x14')](_0x5b9388)[_0x7d22('0x15')]();};}function respondWithResult(_0x86d699,_0x2350d1){_0x2350d1=_0x2350d1||0xc8;return function(_0x47a7b5){if(_0x47a7b5){return _0x86d699[_0x7d22('0x14')](_0x2350d1)['json'](_0x47a7b5);}};}function respondWithFilteredResult(_0xe632d,_0x16637d){return function(_0x12bcbc){if(_0x12bcbc){var _0x499aea=typeof _0x16637d['offset']===_0x7d22('0x16')&&typeof _0x16637d[_0x7d22('0x17')]==='undefined';var _0x367709=_0x12bcbc[_0x7d22('0x18')];var _0x3f977a=_0x499aea?0x0:_0x16637d['offset'];var _0x5ec42b=_0x499aea?_0x12bcbc[_0x7d22('0x18')]:_0x16637d[_0x7d22('0x19')]+_0x16637d[_0x7d22('0x17')];var _0xdfdade;if(_0x5ec42b>=_0x367709){_0x5ec42b=_0x367709;_0xdfdade=0xc8;}else{_0xdfdade=0xce;}_0xe632d[_0x7d22('0x14')](_0xdfdade);return _0xe632d[_0x7d22('0x1a')](_0x7d22('0x1b'),_0x3f977a+'-'+_0x5ec42b+'/'+_0x367709)['json'](_0x12bcbc);}return null;};}function patchUpdates(_0x30c6c9){return function(_0x1c8027){try{jsonpatch['apply'](_0x1c8027,_0x30c6c9,!![]);}catch(_0x106a9a){return BPromise[_0x7d22('0x1c')](_0x106a9a);}return _0x1c8027[_0x7d22('0x1d')]();};}function saveUpdates(_0x2dbf55,_0xe0364e){return function(_0x4a4a55){if(_0x4a4a55){return _0x4a4a55[_0x7d22('0x1e')](_0x2dbf55)[_0x7d22('0x1f')](function(_0x4a4b5f){return _0x4a4b5f;});}return null;};}function removeEntity(_0x24b5d7,_0x540841){return function(_0x7040c7){if(_0x7040c7){return _0x7040c7[_0x7d22('0x20')]()[_0x7d22('0x1f')](function(){var _0x298b65=_0x7040c7['get']({'plain':!![]});var _0x25d724=_0x7d22('0x21');return db[_0x7d22('0x22')]['destroy']({'where':{'type':_0x25d724,'resourceId':_0x298b65['id']}})['then'](function(){return _0x7040c7;});})[_0x7d22('0x1f')](function(){_0x24b5d7[_0x7d22('0x14')](0xcc)[_0x7d22('0x15')]();});}};}function handleEntityNotFound(_0x501c12,_0x380963){return function(_0x1924cc){if(!_0x1924cc){_0x501c12['sendStatus'](0x194);}return _0x1924cc;};}function handleError(_0x1bfff5,_0x4ced06){_0x4ced06=_0x4ced06||0x1f4;return function(_0x5827fc){logger[_0x7d22('0x23')](_0x5827fc[_0x7d22('0x24')]);if(_0x5827fc[_0x7d22('0x25')]){delete _0x5827fc[_0x7d22('0x25')];}_0x1bfff5[_0x7d22('0x14')](_0x4ced06)[_0x7d22('0x26')](_0x5827fc);};}exports[_0x7d22('0x27')]=function(_0x43fa8d,_0x512746){var _0x293b3c={},_0x1c5ef3={},_0x528e4b={'count':0x0,'rows':[]};var _0x5be8b8=_[_0x7d22('0x28')](db[_0x7d22('0x29')][_0x7d22('0x2a')],function(_0x5a78e2){return{'name':_0x5a78e2[_0x7d22('0x2b')],'type':_0x5a78e2[_0x7d22('0x2c')][_0x7d22('0x2d')]};});_0x1c5ef3[_0x7d22('0x2e')]=_[_0x7d22('0x28')](_0x5be8b8,'name');_0x1c5ef3[_0x7d22('0x2f')]=_[_0x7d22('0x30')](_0x43fa8d[_0x7d22('0x2f')]);_0x1c5ef3[_0x7d22('0x31')]=_[_0x7d22('0x32')](_0x1c5ef3['model'],_0x1c5ef3['query']);_0x293b3c['attributes']=_[_0x7d22('0x32')](_0x1c5ef3['model'],qs[_0x7d22('0x33')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x33')]));_0x293b3c[_0x7d22('0x34')]=_0x293b3c[_0x7d22('0x34')][_0x7d22('0x35')]?_0x293b3c[_0x7d22('0x34')]:_0x1c5ef3[_0x7d22('0x2e')];if(!_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x36')](_0x7d22('0x37'))){_0x293b3c[_0x7d22('0x17')]=qs[_0x7d22('0x17')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x17')]);_0x293b3c['offset']=qs['offset'](_0x43fa8d['query'][_0x7d22('0x19')]);}_0x293b3c[_0x7d22('0x38')]=qs[_0x7d22('0x39')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x39')]);_0x293b3c[_0x7d22('0x3a')]=qs[_0x7d22('0x31')](_['pick'](_0x43fa8d[_0x7d22('0x2f')],_0x1c5ef3[_0x7d22('0x31')]),_0x5be8b8);if(_0x43fa8d['query'][_0x7d22('0x3b')]){_0x293b3c[_0x7d22('0x3a')]=_[_0x7d22('0x3c')](_0x293b3c[_0x7d22('0x3a')],{'$or':_['map'](_0x5be8b8,function(_0x163c48){if(_0x163c48['type']!==_0x7d22('0x3d')){var _0x49abac={};_0x49abac[_0x163c48[_0x7d22('0x25')]]={'$like':'%'+_0x43fa8d['query'][_0x7d22('0x3b')]+'%'};return _0x49abac;}})});}_0x293b3c=_[_0x7d22('0x3c')]({},_0x293b3c,_0x43fa8d['options']);var _0x19379b={'where':_0x293b3c[_0x7d22('0x3a')]};return db[_0x7d22('0x29')][_0x7d22('0x18')](_0x19379b)[_0x7d22('0x1f')](function(_0x101560){_0x528e4b[_0x7d22('0x18')]=_0x101560;if(_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x3e')]){_0x293b3c[_0x7d22('0x3f')]=[{'all':!![]}];}return db[_0x7d22('0x29')][_0x7d22('0x40')](_0x293b3c);})[_0x7d22('0x1f')](function(_0xde943e){_0x528e4b[_0x7d22('0x41')]=_0xde943e;return _0x528e4b;})['then'](respondWithFilteredResult(_0x512746,_0x293b3c))[_0x7d22('0x42')](handleError(_0x512746,null));};exports[_0x7d22('0x43')]=function(_0x1838b6,_0x49694c){var _0x4f13e7={'raw':!![],'where':{'id':_0x1838b6[_0x7d22('0x44')]['id']}},_0x41ab39={};_0x41ab39[_0x7d22('0x2e')]=_['keys'](db['AnalyticExtractedReport'][_0x7d22('0x2a')]);_0x41ab39['query']=_[_0x7d22('0x30')](_0x1838b6[_0x7d22('0x2f')]);_0x41ab39[_0x7d22('0x31')]=_[_0x7d22('0x32')](_0x41ab39[_0x7d22('0x2e')],_0x41ab39['query']);_0x4f13e7['attributes']=_[_0x7d22('0x32')](_0x41ab39['model'],qs[_0x7d22('0x33')](_0x1838b6['query'][_0x7d22('0x33')]));_0x4f13e7[_0x7d22('0x34')]=_0x4f13e7[_0x7d22('0x34')][_0x7d22('0x35')]?_0x4f13e7[_0x7d22('0x34')]:_0x41ab39[_0x7d22('0x2e')];if(_0x1838b6[_0x7d22('0x2f')][_0x7d22('0x3e')]){_0x4f13e7[_0x7d22('0x3f')]=[{'all':!![]}];}_0x4f13e7=_['merge']({},_0x4f13e7,_0x1838b6[_0x7d22('0x45')]);return db[_0x7d22('0x29')][_0x7d22('0x46')](_0x4f13e7)['then'](handleEntityNotFound(_0x49694c,null))[_0x7d22('0x1f')](respondWithResult(_0x49694c,null))[_0x7d22('0x42')](handleError(_0x49694c,null));};exports['create']=function(_0x1615f2,_0x48881e){return db['AnalyticExtractedReport'][_0x7d22('0x47')](_0x1615f2[_0x7d22('0x48')],{})[_0x7d22('0x1f')](function(_0xb3ce2){var _0x410c8b=_0x1615f2[_0x7d22('0x49')]['get']({'plain':!![]});if(!_0x410c8b)throw new Error(_0x7d22('0x4a'));if(_0x410c8b[_0x7d22('0x4b')]===_0x7d22('0x49')){var _0x290ade=_0xb3ce2[_0x7d22('0x4c')]({'plain':!![]});var _0xbacc67=_0x7d22('0x21');return db[_0x7d22('0x4d')][_0x7d22('0x46')]({'where':{'name':_0xbacc67,'userProfileId':_0x410c8b['userProfileId']},'raw':!![]})[_0x7d22('0x1f')](function(_0x4efc90){if(_0x4efc90&&_0x4efc90['autoAssociation']===0x0){return db[_0x7d22('0x22')][_0x7d22('0x47')]({'name':_0x290ade[_0x7d22('0x25')],'resourceId':_0x290ade['id'],'type':_0x4efc90['name'],'sectionId':_0x4efc90['id']},{})['then'](function(){return _0xb3ce2;});}else{return _0xb3ce2;}})[_0x7d22('0x42')](function(_0x347540){logger[_0x7d22('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x347540);throw _0x347540;});}return _0xb3ce2;})[_0x7d22('0x1f')](respondWithResult(_0x48881e,0xc9))['catch'](handleError(_0x48881e,null));};exports[_0x7d22('0x1e')]=function(_0x4736ef,_0x3824a1){if(_0x4736ef['body']['id']){delete _0x4736ef[_0x7d22('0x48')]['id'];}return db[_0x7d22('0x29')][_0x7d22('0x46')]({'where':{'id':_0x4736ef['params']['id']}})['then'](handleEntityNotFound(_0x3824a1,null))[_0x7d22('0x1f')](saveUpdates(_0x4736ef['body'],null))[_0x7d22('0x1f')](respondWithResult(_0x3824a1,null))[_0x7d22('0x42')](handleError(_0x3824a1,null));};exports[_0x7d22('0x20')]=function(_0x1c982d,_0x176ce5){return db[_0x7d22('0x29')][_0x7d22('0x46')]({'where':{'id':_0x1c982d['params']['id']}})[_0x7d22('0x1f')](handleEntityNotFound(_0x176ce5,null))[_0x7d22('0x1f')](removeEntity(_0x176ce5,null))[_0x7d22('0x42')](handleError(_0x176ce5,null));};exports['download']=function(_0x4acfcd,_0x16c9f2,_0x5b5295){return db[_0x7d22('0x29')]['find']({'where':{'id':_0x4acfcd[_0x7d22('0x44')]['id']},'attributes':[_0x7d22('0x25'),_0x7d22('0x4e'),_0x7d22('0x4f'),_0x7d22('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x16c9f2,null))[_0x7d22('0x1f')](function(_0xdd9a74){if(_0xdd9a74){if(!fs[_0x7d22('0x51')](path[_0x7d22('0x52')](config[_0x7d22('0x53')],_0x7d22('0x54'),_0xdd9a74[_0x7d22('0x4f')]))){throw new db[(_0x7d22('0x55'))][(_0x7d22('0x56'))](_0x7d22('0x57'));}if(_0x4acfcd[_0x7d22('0x2f')][_0x7d22('0x58')]){return _0x16c9f2[_0x7d22('0x59')](0xc8);}return _0x16c9f2[_0x7d22('0x5a')](path[_0x7d22('0x52')](config['root'],_0x7d22('0x54'),_0xdd9a74[_0x7d22('0x4f')]),util['format'](_0x7d22('0x5b'),_0xdd9a74[_0x7d22('0x4e')]||_0xdd9a74[_0x7d22('0x25')],_0xdd9a74['output'][_0x7d22('0x5c')]()));}})['catch'](handleError(_0x16c9f2,null));}; \ No newline at end of file +var _0x0f41=['index','map','AnalyticExtractedReport','rawAttributes','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','destroy','then','get','ExtractedReports','UserProfileResource','end','error','stack','name','send'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x0f41,0x1b4));var _0x10f4=function(_0x4db156,_0x230aae){_0x4db156=_0x4db156-0x0;var _0x197983=_0x0f41[_0x4db156];return _0x197983;};'use strict';var emlformat=require(_0x10f4('0x0'));var rimraf=require(_0x10f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10f4('0x2'));var rp=require(_0x10f4('0x3'));var moment=require('moment');var BPromise=require(_0x10f4('0x4'));var Mustache=require('mustache');var util=require(_0x10f4('0x5'));var path=require('path');var sox=require(_0x10f4('0x6'));var csv=require(_0x10f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10f4('0x8'));var _=require('lodash');var squel=require(_0x10f4('0x9'));var crypto=require(_0x10f4('0xa'));var jsforce=require(_0x10f4('0xb'));var deskjs=require(_0x10f4('0xc'));var toCsv=require(_0x10f4('0x7'));var querystring=require(_0x10f4('0xd'));var Papa=require(_0x10f4('0xe'));var Redis=require(_0x10f4('0xf'));var authService=require(_0x10f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x10f4('0x11'));var hardwareService=require(_0x10f4('0x12'));var logger=require('../../config/logger')(_0x10f4('0x13'));var utils=require(_0x10f4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x10f4('0x15'));var db=require(_0x10f4('0x16'))['db'];function respondWithStatusCode(_0x53f7a0,_0x584f28){_0x584f28=_0x584f28||0xcc;return function(_0x4b6fc1){if(_0x4b6fc1){return _0x53f7a0[_0x10f4('0x17')](_0x584f28);}return _0x53f7a0['status'](_0x584f28)['end']();};}function respondWithResult(_0xfcd712,_0x4fba41){_0x4fba41=_0x4fba41||0xc8;return function(_0x1711ac){if(_0x1711ac){return _0xfcd712['status'](_0x4fba41)[_0x10f4('0x18')](_0x1711ac);}};}function respondWithFilteredResult(_0x1fbba,_0x58c86e){return function(_0xe6768d){if(_0xe6768d){var _0x43ef7c=typeof _0x58c86e[_0x10f4('0x19')]===_0x10f4('0x1a')&&typeof _0x58c86e[_0x10f4('0x1b')]==='undefined';var _0x4f0a00=_0xe6768d[_0x10f4('0x1c')];var _0x48ef42=_0x43ef7c?0x0:_0x58c86e[_0x10f4('0x19')];var _0x2571c6=_0x43ef7c?_0xe6768d[_0x10f4('0x1c')]:_0x58c86e[_0x10f4('0x19')]+_0x58c86e['limit'];var _0x557990;if(_0x2571c6>=_0x4f0a00){_0x2571c6=_0x4f0a00;_0x557990=0xc8;}else{_0x557990=0xce;}_0x1fbba[_0x10f4('0x1d')](_0x557990);return _0x1fbba['set'](_0x10f4('0x1e'),_0x48ef42+'-'+_0x2571c6+'/'+_0x4f0a00)[_0x10f4('0x18')](_0xe6768d);}return null;};}function patchUpdates(_0x3afc97){return function(_0x44326d){try{jsonpatch[_0x10f4('0x1f')](_0x44326d,_0x3afc97,!![]);}catch(_0x125ffe){return BPromise[_0x10f4('0x20')](_0x125ffe);}return _0x44326d[_0x10f4('0x21')]();};}function saveUpdates(_0x1e0f3b,_0x1523f6){return function(_0x1623cd){if(_0x1623cd){return _0x1623cd['update'](_0x1e0f3b)['then'](function(_0x515eb1){return _0x515eb1;});}return null;};}function removeEntity(_0x53d405,_0x5db1e6){return function(_0x2bece1){if(_0x2bece1){return _0x2bece1[_0x10f4('0x22')]()[_0x10f4('0x23')](function(){var _0x2b6c8b=_0x2bece1[_0x10f4('0x24')]({'plain':!![]});var _0x1730bc=_0x10f4('0x25');return db[_0x10f4('0x26')]['destroy']({'where':{'type':_0x1730bc,'resourceId':_0x2b6c8b['id']}})[_0x10f4('0x23')](function(){return _0x2bece1;});})[_0x10f4('0x23')](function(){_0x53d405[_0x10f4('0x1d')](0xcc)[_0x10f4('0x27')]();});}};}function handleEntityNotFound(_0x2b8af9,_0x70c485){return function(_0x589124){if(!_0x589124){_0x2b8af9[_0x10f4('0x17')](0x194);}return _0x589124;};}function handleError(_0x1a8aa6,_0xb6ab7a){_0xb6ab7a=_0xb6ab7a||0x1f4;return function(_0x4a9448){logger[_0x10f4('0x28')](_0x4a9448[_0x10f4('0x29')]);if(_0x4a9448[_0x10f4('0x2a')]){delete _0x4a9448[_0x10f4('0x2a')];}_0x1a8aa6[_0x10f4('0x1d')](_0xb6ab7a)[_0x10f4('0x2b')](_0x4a9448);};}exports[_0x10f4('0x2c')]=function(_0x569ede,_0x36d45a){var _0x4449ed={},_0x1ea1ed={},_0x2a72d5={'count':0x0,'rows':[]};var _0x1828b7=_[_0x10f4('0x2d')](db[_0x10f4('0x2e')][_0x10f4('0x2f')],function(_0x49e9c4){return{'name':_0x49e9c4['fieldName'],'type':_0x49e9c4[_0x10f4('0x30')]['key']};});_0x1ea1ed[_0x10f4('0x31')]=_['map'](_0x1828b7,_0x10f4('0x2a'));_0x1ea1ed['query']=_['keys'](_0x569ede['query']);_0x1ea1ed[_0x10f4('0x32')]=_[_0x10f4('0x33')](_0x1ea1ed[_0x10f4('0x31')],_0x1ea1ed['query']);_0x4449ed[_0x10f4('0x34')]=_[_0x10f4('0x33')](_0x1ea1ed[_0x10f4('0x31')],qs[_0x10f4('0x35')](_0x569ede[_0x10f4('0x36')][_0x10f4('0x35')]));_0x4449ed[_0x10f4('0x34')]=_0x4449ed['attributes'][_0x10f4('0x37')]?_0x4449ed['attributes']:_0x1ea1ed[_0x10f4('0x31')];if(!_0x569ede[_0x10f4('0x36')][_0x10f4('0x38')](_0x10f4('0x39'))){_0x4449ed['limit']=qs[_0x10f4('0x1b')](_0x569ede[_0x10f4('0x36')][_0x10f4('0x1b')]);_0x4449ed['offset']=qs[_0x10f4('0x19')](_0x569ede[_0x10f4('0x36')][_0x10f4('0x19')]);}_0x4449ed[_0x10f4('0x3a')]=qs['sort'](_0x569ede[_0x10f4('0x36')][_0x10f4('0x3b')]);_0x4449ed[_0x10f4('0x3c')]=qs[_0x10f4('0x32')](_[_0x10f4('0x3d')](_0x569ede[_0x10f4('0x36')],_0x1ea1ed[_0x10f4('0x32')]),_0x1828b7);if(_0x569ede[_0x10f4('0x36')][_0x10f4('0x3e')]){_0x4449ed[_0x10f4('0x3c')]=_[_0x10f4('0x3f')](_0x4449ed[_0x10f4('0x3c')],{'$or':_[_0x10f4('0x2d')](_0x1828b7,function(_0x240a2a){if(_0x240a2a['type']!==_0x10f4('0x40')){var _0x3692a1={};_0x3692a1[_0x240a2a['name']]={'$like':'%'+_0x569ede[_0x10f4('0x36')][_0x10f4('0x3e')]+'%'};return _0x3692a1;}})});}_0x4449ed=_[_0x10f4('0x3f')]({},_0x4449ed,_0x569ede[_0x10f4('0x41')]);var _0x1f8ac4={'where':_0x4449ed[_0x10f4('0x3c')]};return db[_0x10f4('0x2e')][_0x10f4('0x1c')](_0x1f8ac4)[_0x10f4('0x23')](function(_0x126263){_0x2a72d5[_0x10f4('0x1c')]=_0x126263;if(_0x569ede[_0x10f4('0x36')]['includeAll']){_0x4449ed[_0x10f4('0x42')]=[{'all':!![]}];}return db[_0x10f4('0x2e')][_0x10f4('0x43')](_0x4449ed);})[_0x10f4('0x23')](function(_0x2250aa){_0x2a72d5['rows']=_0x2250aa;return _0x2a72d5;})[_0x10f4('0x23')](respondWithFilteredResult(_0x36d45a,_0x4449ed))[_0x10f4('0x44')](handleError(_0x36d45a,null));};exports[_0x10f4('0x45')]=function(_0x33fa73,_0x5bec26){var _0x3f1ca3={'raw':!![],'where':{'id':_0x33fa73['params']['id']}},_0x2d9397={};_0x2d9397['model']=_[_0x10f4('0x46')](db[_0x10f4('0x2e')][_0x10f4('0x2f')]);_0x2d9397[_0x10f4('0x36')]=_[_0x10f4('0x46')](_0x33fa73[_0x10f4('0x36')]);_0x2d9397[_0x10f4('0x32')]=_[_0x10f4('0x33')](_0x2d9397[_0x10f4('0x31')],_0x2d9397['query']);_0x3f1ca3[_0x10f4('0x34')]=_['intersection'](_0x2d9397[_0x10f4('0x31')],qs[_0x10f4('0x35')](_0x33fa73[_0x10f4('0x36')]['fields']));_0x3f1ca3[_0x10f4('0x34')]=_0x3f1ca3[_0x10f4('0x34')]['length']?_0x3f1ca3['attributes']:_0x2d9397[_0x10f4('0x31')];if(_0x33fa73[_0x10f4('0x36')][_0x10f4('0x47')]){_0x3f1ca3[_0x10f4('0x42')]=[{'all':!![]}];}_0x3f1ca3=_['merge']({},_0x3f1ca3,_0x33fa73[_0x10f4('0x41')]);return db[_0x10f4('0x2e')]['find'](_0x3f1ca3)[_0x10f4('0x23')](handleEntityNotFound(_0x5bec26,null))[_0x10f4('0x23')](respondWithResult(_0x5bec26,null))[_0x10f4('0x44')](handleError(_0x5bec26,null));};exports[_0x10f4('0x48')]=function(_0x142420,_0x1020a0){return db[_0x10f4('0x2e')]['create'](_0x142420[_0x10f4('0x49')],{})[_0x10f4('0x23')](function(_0x47fd00){var _0x2046f1=_0x142420[_0x10f4('0x4a')][_0x10f4('0x24')]({'plain':!![]});if(!_0x2046f1)throw new Error(_0x10f4('0x4b'));if(_0x2046f1[_0x10f4('0x4c')]===_0x10f4('0x4a')){var _0x3d7168=_0x47fd00[_0x10f4('0x24')]({'plain':!![]});var _0x3ad536='ExtractedReports';return db[_0x10f4('0x4d')][_0x10f4('0x4e')]({'where':{'name':_0x3ad536,'userProfileId':_0x2046f1[_0x10f4('0x4f')]},'raw':!![]})[_0x10f4('0x23')](function(_0x256d0b){if(_0x256d0b&&_0x256d0b[_0x10f4('0x50')]===0x0){return db[_0x10f4('0x26')]['create']({'name':_0x3d7168['name'],'resourceId':_0x3d7168['id'],'type':_0x256d0b[_0x10f4('0x2a')],'sectionId':_0x256d0b['id']},{})[_0x10f4('0x23')](function(){return _0x47fd00;});}else{return _0x47fd00;}})[_0x10f4('0x44')](function(_0x3c663f){logger[_0x10f4('0x28')](_0x10f4('0x51'),_0x3c663f);throw _0x3c663f;});}return _0x47fd00;})[_0x10f4('0x23')](respondWithResult(_0x1020a0,0xc9))[_0x10f4('0x44')](handleError(_0x1020a0,null));};exports['update']=function(_0x4bb3ea,_0x319874){if(_0x4bb3ea['body']['id']){delete _0x4bb3ea['body']['id'];}return db['AnalyticExtractedReport'][_0x10f4('0x4e')]({'where':{'id':_0x4bb3ea[_0x10f4('0x52')]['id']}})[_0x10f4('0x23')](handleEntityNotFound(_0x319874,null))[_0x10f4('0x23')](saveUpdates(_0x4bb3ea[_0x10f4('0x49')],null))[_0x10f4('0x23')](respondWithResult(_0x319874,null))[_0x10f4('0x44')](handleError(_0x319874,null));};exports[_0x10f4('0x22')]=function(_0x2229e5,_0x5b69dd){return db[_0x10f4('0x2e')][_0x10f4('0x4e')]({'where':{'id':_0x2229e5['params']['id']}})[_0x10f4('0x23')](handleEntityNotFound(_0x5b69dd,null))[_0x10f4('0x23')](removeEntity(_0x5b69dd,null))[_0x10f4('0x44')](handleError(_0x5b69dd,null));};exports[_0x10f4('0x53')]=function(_0x3f817c,_0x39218a,_0x409fcf){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3f817c[_0x10f4('0x52')]['id']},'attributes':[_0x10f4('0x2a'),_0x10f4('0x54'),_0x10f4('0x55'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x39218a,null))['then'](function(_0x2d46cf){if(_0x2d46cf){if(!fs[_0x10f4('0x56')](path['join'](config[_0x10f4('0x57')],_0x10f4('0x58'),_0x2d46cf[_0x10f4('0x55')]))){throw new db[(_0x10f4('0x59'))][(_0x10f4('0x5a'))](_0x10f4('0x5b'));}if(_0x3f817c[_0x10f4('0x36')]['exists']){return _0x39218a[_0x10f4('0x17')](0xc8);}return _0x39218a['download'](path[_0x10f4('0x5c')](config['root'],_0x10f4('0x58'),_0x2d46cf[_0x10f4('0x55')]),util[_0x10f4('0x5d')](_0x10f4('0x5e'),_0x2d46cf[_0x10f4('0x54')]||_0x2d46cf[_0x10f4('0x2a')],_0x2d46cf['output'][_0x10f4('0x5f')]()));}})['catch'](handleError(_0x39218a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ae99824..4382b52 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 _0x826c=['bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','lodash','../../config/logger','api'];(function(_0x4486d8,_0x18aacd){var _0x55684a=function(_0x26a2c){while(--_0x26a2c){_0x4486d8['push'](_0x4486d8['shift']());}};_0x55684a(++_0x18aacd);}(_0x826c,0x1c8));var _0xc826=function(_0x325e5b,_0x4096f9){_0x325e5b=_0x325e5b-0x0;var _0xfd6072=_0x826c[_0x325e5b];return _0xfd6072;};'use strict';var _=require(_0xc826('0x0'));var util=require('util');var logger=require(_0xc826('0x1'))(_0xc826('0x2'));var moment=require('moment');var BPromise=require(_0xc826('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc826('0x4'));var rimraf=require(_0xc826('0x5'));var config=require(_0xc826('0x6'));var attributes=require(_0xc826('0x7'));module[_0xc826('0x8')]=function(_0x159ea9,_0x23c847){return _0x159ea9['define']('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ed8=['api','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','define','util','../../config/logger'];(function(_0x355860,_0x415ef8){var _0x4d1a68=function(_0x5681ca){while(--_0x5681ca){_0x355860['push'](_0x355860['shift']());}};_0x4d1a68(++_0x415ef8);}(_0x0ed8,0x80));var _0x80ed=function(_0xb002b8,_0x585e82){_0xb002b8=_0xb002b8-0x0;var _0x6888e1=_0x0ed8[_0xb002b8];return _0x6888e1;};'use strict';var _=require('lodash');var util=require(_0x80ed('0x0'));var logger=require(_0x80ed('0x1'))(_0x80ed('0x2'));var moment=require('moment');var BPromise=require(_0x80ed('0x3'));var rp=require(_0x80ed('0x4'));var fs=require('fs');var path=require(_0x80ed('0x5'));var rimraf=require(_0x80ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x80ed('0x7'));module[_0x80ed('0x8')]=function(_0x57e4f5,_0x5f0eff){return _0x57e4f5[_0x80ed('0x9')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 1be3e2d..3ea8ccd 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 _0x9ef6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x9ef6,0x1ca));var _0x69ef=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x9ef6[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0x69ef('0x0'));var util=require(_0x69ef('0x1'));var moment=require('moment');var BPromise=require(_0x69ef('0x2'));var rs=require(_0x69ef('0x3'));var fs=require('fs');var Redis=require(_0x69ef('0x4'));var db=require(_0x69ef('0x5'))['db'];var utils=require(_0x69ef('0x6'));var logger=require(_0x69ef('0x7'))('rpc');var config=require(_0x69ef('0x8'));var jayson=require(_0x69ef('0x9'));var client=jayson[_0x69ef('0xa')][_0x69ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x597c24,_0x44d502,_0x4c87a2){return new BPromise(function(_0x14dc45,_0x15d883){return client[_0x69ef('0xc')](_0x597c24,_0x4c87a2)[_0x69ef('0xd')](function(_0xc52536){logger[_0x69ef('0xe')](_0x69ef('0xf'),_0x44d502,'request\x20sent');logger[_0x69ef('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x44d502,_0x69ef('0x11'),JSON[_0x69ef('0x12')](_0xc52536));if(_0xc52536[_0x69ef('0x13')]){if(_0xc52536[_0x69ef('0x13')]['code']===0x1f4){logger[_0x69ef('0x13')](_0x69ef('0xf'),_0x44d502,_0xc52536[_0x69ef('0x13')][_0x69ef('0x14')]);return _0x15d883(_0xc52536['error']['message']);}logger['error'](_0x69ef('0xf'),_0x44d502,_0xc52536[_0x69ef('0x13')][_0x69ef('0x14')]);return _0x14dc45(_0xc52536[_0x69ef('0x13')][_0x69ef('0x14')]);}else{logger[_0x69ef('0xe')](_0x69ef('0xf'),_0x44d502,_0x69ef('0x11'));_0x14dc45(_0xc52536[_0x69ef('0x15')][_0x69ef('0x14')]);}})[_0x69ef('0x16')](function(_0x2c229d){logger[_0x69ef('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x44d502,_0x2c229d);_0x15d883(_0x2c229d);});});} \ No newline at end of file +var _0x7aab=['error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x83feae,_0x434b3b){var _0x596993=function(_0x9fcb39){while(--_0x9fcb39){_0x83feae['push'](_0x83feae['shift']());}};_0x596993(++_0x434b3b);}(_0x7aab,0x1e5));var _0xb7aa=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7aab[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xb7aa('0x0'));var util=require(_0xb7aa('0x1'));var moment=require(_0xb7aa('0x2'));var BPromise=require(_0xb7aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7aa('0x4'))['db'];var utils=require(_0xb7aa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb7aa('0x6'));var jayson=require(_0xb7aa('0x7'));var client=jayson[_0xb7aa('0x8')][_0xb7aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8cfd82,_0x34a415,_0x3f4c06){return new BPromise(function(_0x58538a,_0x19d260){return client[_0xb7aa('0xa')](_0x8cfd82,_0x3f4c06)[_0xb7aa('0xb')](function(_0x33b732){logger[_0xb7aa('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x34a415,_0xb7aa('0xd'));logger['debug'](_0xb7aa('0xe'),_0x34a415,_0xb7aa('0xd'),JSON['stringify'](_0x33b732));if(_0x33b732[_0xb7aa('0xf')]){if(_0x33b732[_0xb7aa('0xf')]['code']===0x1f4){logger[_0xb7aa('0xf')](_0xb7aa('0x10'),_0x34a415,_0x33b732[_0xb7aa('0xf')]['message']);return _0x19d260(_0x33b732[_0xb7aa('0xf')][_0xb7aa('0x11')]);}logger[_0xb7aa('0xf')](_0xb7aa('0x10'),_0x34a415,_0x33b732['error'][_0xb7aa('0x11')]);return _0x58538a(_0x33b732[_0xb7aa('0xf')][_0xb7aa('0x11')]);}else{logger[_0xb7aa('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x34a415,_0xb7aa('0xd'));_0x58538a(_0x33b732[_0xb7aa('0x12')]['message']);}})[_0xb7aa('0x13')](function(_0x3bdc7e){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x34a415,_0x3bdc7e);_0x19d260(_0x3bdc7e);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e976d00..b869306 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 _0x88c5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update','destroy','util','connect-timeout','express','Router','fs-extra'];(function(_0x51d311,_0x55bce9){var _0x4ab945=function(_0x1a40e4){while(--_0x1a40e4){_0x51d311['push'](_0x51d311['shift']());}};_0x4ab945(++_0x55bce9);}(_0x88c5,0x73));var _0x588c=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0x88c5[_0x53f964];return _0x17be6c;};'use strict';var multer=require('multer');var util=require(_0x588c('0x0'));var path=require('path');var timeout=require(_0x588c('0x1'));var express=require(_0x588c('0x2'));var router=express[_0x588c('0x3')]();var fs_extra=require(_0x588c('0x4'));var auth=require(_0x588c('0x5'));var interaction=require(_0x588c('0x6'));var config=require(_0x588c('0x7'));var controller=require(_0x588c('0x8'));router[_0x588c('0x9')]('/',auth[_0x588c('0xa')](),controller[_0x588c('0xb')]);router[_0x588c('0x9')](_0x588c('0xc'),auth[_0x588c('0xa')](),controller[_0x588c('0xd')]);router['get']('/:id/download',auth[_0x588c('0xa')](),controller[_0x588c('0xe')]);router[_0x588c('0xf')]('/',auth['isAuthenticated'](),controller[_0x588c('0x10')]);router[_0x588c('0x11')](_0x588c('0xc'),auth[_0x588c('0xa')](),controller[_0x588c('0x12')]);router['delete'](_0x588c('0xc'),auth[_0x588c('0xa')](),controller[_0x588c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2082=['Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x257142,_0x1a3acf){var _0x2e41f2=function(_0xc73fb6){while(--_0xc73fb6){_0x257142['push'](_0x257142['shift']());}};_0x2e41f2(++_0x1a3acf);}(_0x2082,0xab));var _0x2208=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x2082[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0x2208('0x0'));var util=require(_0x2208('0x1'));var path=require(_0x2208('0x2'));var timeout=require(_0x2208('0x3'));var express=require(_0x2208('0x4'));var router=express[_0x2208('0x5')]();var fs_extra=require(_0x2208('0x6'));var auth=require(_0x2208('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2208('0x8'));var controller=require(_0x2208('0x9'));router['get']('/',auth[_0x2208('0xa')](),controller[_0x2208('0xb')]);router[_0x2208('0xc')](_0x2208('0xd'),auth[_0x2208('0xa')](),controller[_0x2208('0xe')]);router[_0x2208('0xc')](_0x2208('0xf'),auth[_0x2208('0xa')](),controller[_0x2208('0x10')]);router[_0x2208('0x11')]('/',auth[_0x2208('0xa')](),controller[_0x2208('0x12')]);router['put'](_0x2208('0xd'),auth[_0x2208('0xa')](),controller[_0x2208('0x13')]);router[_0x2208('0x14')](_0x2208('0xd'),auth[_0x2208('0xa')](),controller['destroy']);module[_0x2208('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e7e2c1e..d571f4a 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 _0xee8c=['STRING','exports','TEXT'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0xee8c,0xfa));var _0xcee8=function(_0x33793a,_0x515635){_0x33793a=_0x33793a-0x0;var _0x242389=_0xee8c[_0x33793a];return _0x242389;};'use strict';var Sequelize=require('sequelize');module[_0xcee8('0x0')]={'field':{'type':Sequelize[_0xcee8('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xcee8('0x2')]},'format':{'type':Sequelize[_0xcee8('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x11b9=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x11b9,0xaf));var _0x911b=function(_0x1e22e5,_0x515cf7){_0x1e22e5=_0x1e22e5-0x0;var _0x23ac68=_0x11b9[_0x1e22e5];return _0x23ac68;};'use strict';var Sequelize=require(_0x911b('0x0'));module[_0x911b('0x1')]={'field':{'type':Sequelize[_0x911b('0x2')]},'alias':{'type':Sequelize[_0x911b('0x3')]},'function':{'type':Sequelize[_0x911b('0x3')]},'format':{'type':Sequelize[_0x911b('0x3')]},'groupBy':{'type':Sequelize[_0x911b('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x911b('0x3')]},'custom':{'type':Sequelize[_0x911b('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 1c75665..2836c3f 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 _0x596c=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','addFields','findOne','sequelize','CustomReportId','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x2d6efb,_0x4cadf8){var _0x31654d=function(_0xead211){while(--_0xead211){_0x2d6efb['push'](_0x2d6efb['shift']());}};_0x31654d(++_0x4cadf8);}(_0x596c,0x1cd));var _0xc596=function(_0x402eac,_0x465ce5){_0x402eac=_0x402eac-0x0;var _0x441ae2=_0x596c[_0x402eac];return _0x441ae2;};'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(_0xc596('0x0'));var moment=require('moment');var BPromise=require(_0xc596('0x1'));var Mustache=require(_0xc596('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc596('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc596('0x4'));var _=require(_0xc596('0x5'));var squel=require('squel');var crypto=require(_0xc596('0x6'));var jsforce=require('jsforce');var deskjs=require(_0xc596('0x7'));var toCsv=require(_0xc596('0x3'));var querystring=require('querystring');var Papa=require(_0xc596('0x8'));var Redis=require(_0xc596('0x9'));var authService=require(_0xc596('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0xc596('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc596('0xc'))('api');var utils=require(_0xc596('0xd'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc596('0xe'))['db'];function respondWithStatusCode(_0x5b8211,_0x53c8da){_0x53c8da=_0x53c8da||0xcc;return function(_0x1605f0){if(_0x1605f0){return _0x5b8211[_0xc596('0xf')](_0x53c8da);}return _0x5b8211['status'](_0x53c8da)[_0xc596('0x10')]();};}function respondWithResult(_0x2adaa2,_0x2cd4ef){_0x2cd4ef=_0x2cd4ef||0xc8;return function(_0x33f653){if(_0x33f653){return _0x2adaa2[_0xc596('0x11')](_0x2cd4ef)[_0xc596('0x12')](_0x33f653);}};}function respondWithFilteredResult(_0x2318c5,_0xf8bfa7){return function(_0x15c644){if(_0x15c644){var _0x4d8bc7=typeof _0xf8bfa7[_0xc596('0x13')]===_0xc596('0x14')&&typeof _0xf8bfa7[_0xc596('0x15')]===_0xc596('0x14');var _0x5aec08=_0x15c644['count'];var _0x39a19e=_0x4d8bc7?0x0:_0xf8bfa7[_0xc596('0x13')];var _0x4713c4=_0x4d8bc7?_0x15c644['count']:_0xf8bfa7[_0xc596('0x13')]+_0xf8bfa7[_0xc596('0x15')];var _0x1d8f8a;if(_0x4713c4>=_0x5aec08){_0x4713c4=_0x5aec08;_0x1d8f8a=0xc8;}else{_0x1d8f8a=0xce;}_0x2318c5[_0xc596('0x11')](_0x1d8f8a);return _0x2318c5[_0xc596('0x16')](_0xc596('0x17'),_0x39a19e+'-'+_0x4713c4+'/'+_0x5aec08)[_0xc596('0x12')](_0x15c644);}return null;};}function patchUpdates(_0x3b214c){return function(_0x2e8af5){try{jsonpatch[_0xc596('0x18')](_0x2e8af5,_0x3b214c,!![]);}catch(_0x5703ec){return BPromise[_0xc596('0x19')](_0x5703ec);}return _0x2e8af5[_0xc596('0x1a')]();};}function saveUpdates(_0x12b730,_0x2ab766){return function(_0x4cd5af){if(_0x4cd5af){return _0x4cd5af['update'](_0x12b730)[_0xc596('0x1b')](function(_0x486c3d){return _0x486c3d;});}return null;};}function removeEntity(_0x16d548,_0x6c0e53){return function(_0x37b3a6){if(_0x37b3a6){return _0x37b3a6[_0xc596('0x1c')]()[_0xc596('0x1b')](function(){_0x16d548[_0xc596('0x11')](0xcc)[_0xc596('0x10')]();});}};}function handleEntityNotFound(_0x1cd892,_0x596774){return function(_0x2a39a2){if(!_0x2a39a2){_0x1cd892[_0xc596('0xf')](0x194);}return _0x2a39a2;};}function handleError(_0x220f3e,_0x38eab8){_0x38eab8=_0x38eab8||0x1f4;return function(_0x12152f){logger[_0xc596('0x1d')](_0x12152f[_0xc596('0x1e')]);if(_0x12152f[_0xc596('0x1f')]){delete _0x12152f[_0xc596('0x1f')];}_0x220f3e[_0xc596('0x11')](_0x38eab8)['send'](_0x12152f);};}exports[_0xc596('0x20')]=function(_0x27df77,_0x57159d){var _0x38baa9={},_0x43f23b={},_0x1f32ca={'count':0x0,'rows':[]};var _0x59f155=_[_0xc596('0x21')](db[_0xc596('0x22')]['rawAttributes'],function(_0x5980fc){return{'name':_0x5980fc[_0xc596('0x23')],'type':_0x5980fc['type'][_0xc596('0x24')]};});_0x43f23b[_0xc596('0x25')]=_[_0xc596('0x21')](_0x59f155,'name');_0x43f23b[_0xc596('0x26')]=_[_0xc596('0x27')](_0x27df77[_0xc596('0x26')]);_0x43f23b[_0xc596('0x28')]=_[_0xc596('0x29')](_0x43f23b[_0xc596('0x25')],_0x43f23b['query']);_0x38baa9[_0xc596('0x2a')]=_['intersection'](_0x43f23b[_0xc596('0x25')],qs[_0xc596('0x2b')](_0x27df77[_0xc596('0x26')][_0xc596('0x2b')]));_0x38baa9[_0xc596('0x2a')]=_0x38baa9[_0xc596('0x2a')][_0xc596('0x2c')]?_0x38baa9[_0xc596('0x2a')]:_0x43f23b['model'];if(!_0x27df77[_0xc596('0x26')][_0xc596('0x2d')](_0xc596('0x2e'))){_0x38baa9[_0xc596('0x15')]=qs['limit'](_0x27df77['query'][_0xc596('0x15')]);_0x38baa9[_0xc596('0x13')]=qs[_0xc596('0x13')](_0x27df77[_0xc596('0x26')][_0xc596('0x13')]);}_0x38baa9[_0xc596('0x2f')]=qs['sort'](_0x27df77[_0xc596('0x26')][_0xc596('0x30')]);_0x38baa9[_0xc596('0x31')]=qs[_0xc596('0x28')](_['pick'](_0x27df77[_0xc596('0x26')],_0x43f23b[_0xc596('0x28')]),_0x59f155);if(_0x27df77[_0xc596('0x26')][_0xc596('0x32')]){_0x38baa9['where']=_[_0xc596('0x33')](_0x38baa9[_0xc596('0x31')],{'$or':_[_0xc596('0x21')](_0x59f155,function(_0x231b77){if(_0x231b77[_0xc596('0x34')]!==_0xc596('0x35')){var _0x3d512f={};_0x3d512f[_0x231b77[_0xc596('0x1f')]]={'$like':'%'+_0x27df77[_0xc596('0x26')][_0xc596('0x32')]+'%'};return _0x3d512f;}})});}_0x38baa9=_[_0xc596('0x33')]({},_0x38baa9,_0x27df77[_0xc596('0x36')]);var _0x40585f={'where':_0x38baa9[_0xc596('0x31')]};return db[_0xc596('0x22')]['count'](_0x40585f)['then'](function(_0x252011){_0x1f32ca[_0xc596('0x37')]=_0x252011;if(_0x27df77[_0xc596('0x26')][_0xc596('0x38')]){_0x38baa9[_0xc596('0x39')]=[{'all':!![]}];}return db[_0xc596('0x22')][_0xc596('0x3a')](_0x38baa9);})['then'](function(_0x5b474a){_0x1f32ca['rows']=_0x5b474a;return _0x1f32ca;})[_0xc596('0x1b')](respondWithFilteredResult(_0x57159d,_0x38baa9))[_0xc596('0x3b')](handleError(_0x57159d,null));};exports['show']=function(_0xae943b,_0x46d8d5){var _0x5b979f={'raw':![],'where':{'id':_0xae943b[_0xc596('0x3c')]['id']}},_0x399048={};_0x399048[_0xc596('0x25')]=_[_0xc596('0x27')](db['AnalyticFieldReport'][_0xc596('0x3d')]);_0x399048[_0xc596('0x26')]=_[_0xc596('0x27')](_0xae943b[_0xc596('0x26')]);_0x399048['filters']=_['intersection'](_0x399048[_0xc596('0x25')],_0x399048[_0xc596('0x26')]);_0x5b979f['attributes']=_[_0xc596('0x29')](_0x399048['model'],qs[_0xc596('0x2b')](_0xae943b[_0xc596('0x26')][_0xc596('0x2b')]));_0x5b979f[_0xc596('0x2a')]=_0x5b979f['attributes'][_0xc596('0x2c')]?_0x5b979f[_0xc596('0x2a')]:_0x399048[_0xc596('0x25')];if(_0xae943b['query'][_0xc596('0x38')]){_0x5b979f[_0xc596('0x39')]=[{'all':!![]}];}_0x5b979f=_['merge']({},_0x5b979f,_0xae943b['options']);return db[_0xc596('0x22')][_0xc596('0x3e')](_0x5b979f)['then'](handleEntityNotFound(_0x46d8d5,null))[_0xc596('0x1b')](respondWithResult(_0x46d8d5,null))[_0xc596('0x3b')](handleError(_0x46d8d5,null));};exports[_0xc596('0x3f')]=function(_0x2848ec,_0x4a9fed){return db[_0xc596('0x22')][_0xc596('0x3f')](_0x2848ec[_0xc596('0x40')],{})[_0xc596('0x1b')](respondWithResult(_0x4a9fed,0xc9))[_0xc596('0x3b')](handleError(_0x4a9fed,null));};exports['bulkCreate']=function(_0x5ba9ca,_0x486f86){return db[_0xc596('0x22')][_0xc596('0x41')](_0x5ba9ca[_0xc596('0x40')],{'raw':![],'individualHooks':!![]})[_0xc596('0x1b')](respondWithResult(_0x486f86,0xc9))[_0xc596('0x3b')](handleError(_0x486f86,null));};exports['update']=function(_0x58cf44,_0x4390d6){if(_0x58cf44[_0xc596('0x40')]['id']){delete _0x58cf44[_0xc596('0x40')]['id'];}return db[_0xc596('0x22')][_0xc596('0x3e')]({'where':{'id':_0x58cf44[_0xc596('0x3c')]['id']}})[_0xc596('0x1b')](handleEntityNotFound(_0x4390d6,null))[_0xc596('0x1b')](saveUpdates(_0x58cf44[_0xc596('0x40')],null))[_0xc596('0x1b')](respondWithResult(_0x4390d6,null))[_0xc596('0x3b')](handleError(_0x4390d6,null));};exports[_0xc596('0x1c')]=function(_0x4396b7,_0x2e5dfa){return db[_0xc596('0x22')][_0xc596('0x3e')]({'where':{'id':_0x4396b7[_0xc596('0x3c')]['id']}})[_0xc596('0x1b')](handleEntityNotFound(_0x2e5dfa,null))[_0xc596('0x1b')](removeEntity(_0x2e5dfa,null))['catch'](handleError(_0x2e5dfa,null));};exports[_0xc596('0x42')]=function(_0x2a85fd,_0xb47c0e){return db[_0xc596('0x22')]['destroy']({'where':{'id':_0x2a85fd[_0xc596('0x26')][_0xc596('0x43')]||[]},'raw':![],'individualHooks':!![]})[_0xc596('0x1b')](respondWithResult(_0xb47c0e,0xcc))['catch'](handleError(_0xb47c0e,null));};exports[_0xc596('0x44')]=function(_0x5552ef,_0x186e5f,_0x103535){return db['AnalyticCustomReport'][_0xc596('0x45')]({'where':{'id':_0x5552ef[_0xc596('0x3c')]['id']}})[_0xc596('0x1b')](handleEntityNotFound(_0x186e5f,null))[_0xc596('0x1b')](function(_0x520937){if(_0x520937){return db[_0xc596('0x46')]['transaction'](function(_0x1fff2d){return db[_0xc596('0x22')][_0xc596('0x1c')]({'where':{'CustomReportId':_0x5552ef[_0xc596('0x3c')]['id']},'transaction':_0x1fff2d})[_0xc596('0x1b')](function(_0x3768a8){var _0x28d3af=_[_0xc596('0x21')](_0x5552ef[_0xc596('0x40')],function(_0x2fef1d){delete _0x2fef1d['id'];_0x2fef1d[_0xc596('0x47')]=_0x5552ef[_0xc596('0x3c')]['id'];return _0x2fef1d;});return db[_0xc596('0x22')][_0xc596('0x41')](_0x28d3af,{'transaction':_0x1fff2d});});})[_0xc596('0x1b')](function(){return db[_0xc596('0x22')][_0xc596('0x3a')]({'where':{'CustomReportId':_0x5552ef['params']['id']}});});}})[_0xc596('0x1b')](respondWithResult(_0x186e5f,null))[_0xc596('0x3b')](handleError(_0x186e5f,null));}; \ No newline at end of file +var _0xf9ee=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','save','update','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','AnalyticFieldReport','include','findAll','rows','show','params','includeAll','find','create','body','catch','bulkCreate','bulkDestroy','ids','addFields','sequelize','transaction','eml-format','rimraf','zip-dir'];(function(_0x271aa7,_0x309496){var _0xbb50e0=function(_0x12a74d){while(--_0x12a74d){_0x271aa7['push'](_0x271aa7['shift']());}};_0xbb50e0(++_0x309496);}(_0xf9ee,0x1dd));var _0xef9e=function(_0x2c47a5,_0x1c89fa){_0x2c47a5=_0x2c47a5-0x0;var _0x227dfc=_0xf9ee[_0x2c47a5];return _0x227dfc;};'use strict';var emlformat=require(_0xef9e('0x0'));var rimraf=require(_0xef9e('0x1'));var zipdir=require(_0xef9e('0x2'));var jsonpatch=require(_0xef9e('0x3'));var rp=require(_0xef9e('0x4'));var moment=require(_0xef9e('0x5'));var BPromise=require(_0xef9e('0x6'));var Mustache=require(_0xef9e('0x7'));var util=require('util');var path=require(_0xef9e('0x8'));var sox=require(_0xef9e('0x9'));var csv=require(_0xef9e('0xa'));var ejs=require(_0xef9e('0xb'));var fs=require('fs');var fs_extra=require(_0xef9e('0xc'));var _=require(_0xef9e('0xd'));var squel=require(_0xef9e('0xe'));var crypto=require(_0xef9e('0xf'));var jsforce=require(_0xef9e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xef9e('0x11'));var Papa=require('papaparse');var Redis=require(_0xef9e('0x12'));var authService=require(_0xef9e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef9e('0x14'));var logger=require('../../config/logger')(_0xef9e('0x15'));var utils=require(_0xef9e('0x16'));var config=require(_0xef9e('0x17'));var licenseUtil=require(_0xef9e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x514a75,_0x4fa628){_0x4fa628=_0x4fa628||0xcc;return function(_0x5eff45){if(_0x5eff45){return _0x514a75[_0xef9e('0x19')](_0x4fa628);}return _0x514a75[_0xef9e('0x1a')](_0x4fa628)['end']();};}function respondWithResult(_0x39cc21,_0x46618e){_0x46618e=_0x46618e||0xc8;return function(_0x32e031){if(_0x32e031){return _0x39cc21[_0xef9e('0x1a')](_0x46618e)['json'](_0x32e031);}};}function respondWithFilteredResult(_0x56623a,_0x35948c){return function(_0x2dab4e){if(_0x2dab4e){var _0x10cb43=typeof _0x35948c[_0xef9e('0x1b')]==='undefined'&&typeof _0x35948c[_0xef9e('0x1c')]===_0xef9e('0x1d');var _0x48939c=_0x2dab4e[_0xef9e('0x1e')];var _0x3bb205=_0x10cb43?0x0:_0x35948c['offset'];var _0x3e103a=_0x10cb43?_0x2dab4e[_0xef9e('0x1e')]:_0x35948c[_0xef9e('0x1b')]+_0x35948c[_0xef9e('0x1c')];var _0x13536f;if(_0x3e103a>=_0x48939c){_0x3e103a=_0x48939c;_0x13536f=0xc8;}else{_0x13536f=0xce;}_0x56623a[_0xef9e('0x1a')](_0x13536f);return _0x56623a[_0xef9e('0x1f')](_0xef9e('0x20'),_0x3bb205+'-'+_0x3e103a+'/'+_0x48939c)[_0xef9e('0x21')](_0x2dab4e);}return null;};}function patchUpdates(_0x471a70){return function(_0x51742a){try{jsonpatch['apply'](_0x51742a,_0x471a70,!![]);}catch(_0x1c0b51){return BPromise['reject'](_0x1c0b51);}return _0x51742a[_0xef9e('0x22')]();};}function saveUpdates(_0x538bda,_0x2d4b70){return function(_0x4a0838){if(_0x4a0838){return _0x4a0838[_0xef9e('0x23')](_0x538bda)['then'](function(_0x3f9915){return _0x3f9915;});}return null;};}function removeEntity(_0x547b8d,_0x5d9b4d){return function(_0x3671f6){if(_0x3671f6){return _0x3671f6[_0xef9e('0x24')]()[_0xef9e('0x25')](function(){_0x547b8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b187d,_0x576ff2){return function(_0x310c2e){if(!_0x310c2e){_0x1b187d[_0xef9e('0x19')](0x194);}return _0x310c2e;};}function handleError(_0x13cb84,_0x42e8e6){_0x42e8e6=_0x42e8e6||0x1f4;return function(_0x560ec8){logger['error'](_0x560ec8[_0xef9e('0x26')]);if(_0x560ec8[_0xef9e('0x27')]){delete _0x560ec8[_0xef9e('0x27')];}_0x13cb84[_0xef9e('0x1a')](_0x42e8e6)['send'](_0x560ec8);};}exports[_0xef9e('0x28')]=function(_0x53cc7e,_0x29f7f9){var _0x51d3b1={},_0xb3c3d9={},_0x8d3ede={'count':0x0,'rows':[]};var _0x290147=_[_0xef9e('0x29')](db['AnalyticFieldReport'][_0xef9e('0x2a')],function(_0x2fd57b){return{'name':_0x2fd57b[_0xef9e('0x2b')],'type':_0x2fd57b[_0xef9e('0x2c')][_0xef9e('0x2d')]};});_0xb3c3d9[_0xef9e('0x2e')]=_[_0xef9e('0x29')](_0x290147,_0xef9e('0x27'));_0xb3c3d9['query']=_[_0xef9e('0x2f')](_0x53cc7e[_0xef9e('0x30')]);_0xb3c3d9['filters']=_[_0xef9e('0x31')](_0xb3c3d9[_0xef9e('0x2e')],_0xb3c3d9[_0xef9e('0x30')]);_0x51d3b1[_0xef9e('0x32')]=_[_0xef9e('0x31')](_0xb3c3d9[_0xef9e('0x2e')],qs['fields'](_0x53cc7e[_0xef9e('0x30')][_0xef9e('0x33')]));_0x51d3b1['attributes']=_0x51d3b1[_0xef9e('0x32')][_0xef9e('0x34')]?_0x51d3b1[_0xef9e('0x32')]:_0xb3c3d9[_0xef9e('0x2e')];if(!_0x53cc7e[_0xef9e('0x30')][_0xef9e('0x35')](_0xef9e('0x36'))){_0x51d3b1[_0xef9e('0x1c')]=qs['limit'](_0x53cc7e['query'][_0xef9e('0x1c')]);_0x51d3b1[_0xef9e('0x1b')]=qs['offset'](_0x53cc7e[_0xef9e('0x30')]['offset']);}_0x51d3b1[_0xef9e('0x37')]=qs[_0xef9e('0x38')](_0x53cc7e[_0xef9e('0x30')][_0xef9e('0x38')]);_0x51d3b1[_0xef9e('0x39')]=qs[_0xef9e('0x3a')](_['pick'](_0x53cc7e['query'],_0xb3c3d9[_0xef9e('0x3a')]),_0x290147);if(_0x53cc7e['query'][_0xef9e('0x3b')]){_0x51d3b1['where']=_[_0xef9e('0x3c')](_0x51d3b1[_0xef9e('0x39')],{'$or':_['map'](_0x290147,function(_0x27588a){if(_0x27588a['type']!==_0xef9e('0x3d')){var _0x38b080={};_0x38b080[_0x27588a[_0xef9e('0x27')]]={'$like':'%'+_0x53cc7e[_0xef9e('0x30')][_0xef9e('0x3b')]+'%'};return _0x38b080;}})});}_0x51d3b1=_['merge']({},_0x51d3b1,_0x53cc7e[_0xef9e('0x3e')]);var _0x4b84b2={'where':_0x51d3b1[_0xef9e('0x39')]};return db[_0xef9e('0x3f')][_0xef9e('0x1e')](_0x4b84b2)[_0xef9e('0x25')](function(_0x38c95c){_0x8d3ede[_0xef9e('0x1e')]=_0x38c95c;if(_0x53cc7e[_0xef9e('0x30')]['includeAll']){_0x51d3b1[_0xef9e('0x40')]=[{'all':!![]}];}return db[_0xef9e('0x3f')][_0xef9e('0x41')](_0x51d3b1);})[_0xef9e('0x25')](function(_0x21e72c){_0x8d3ede[_0xef9e('0x42')]=_0x21e72c;return _0x8d3ede;})['then'](respondWithFilteredResult(_0x29f7f9,_0x51d3b1))['catch'](handleError(_0x29f7f9,null));};exports[_0xef9e('0x43')]=function(_0x58354e,_0x64ef6e){var _0x5262af={'raw':![],'where':{'id':_0x58354e[_0xef9e('0x44')]['id']}},_0x31e43f={};_0x31e43f[_0xef9e('0x2e')]=_[_0xef9e('0x2f')](db[_0xef9e('0x3f')][_0xef9e('0x2a')]);_0x31e43f['query']=_[_0xef9e('0x2f')](_0x58354e[_0xef9e('0x30')]);_0x31e43f['filters']=_['intersection'](_0x31e43f[_0xef9e('0x2e')],_0x31e43f[_0xef9e('0x30')]);_0x5262af[_0xef9e('0x32')]=_[_0xef9e('0x31')](_0x31e43f[_0xef9e('0x2e')],qs[_0xef9e('0x33')](_0x58354e[_0xef9e('0x30')]['fields']));_0x5262af[_0xef9e('0x32')]=_0x5262af['attributes'][_0xef9e('0x34')]?_0x5262af[_0xef9e('0x32')]:_0x31e43f[_0xef9e('0x2e')];if(_0x58354e[_0xef9e('0x30')][_0xef9e('0x45')]){_0x5262af[_0xef9e('0x40')]=[{'all':!![]}];}_0x5262af=_['merge']({},_0x5262af,_0x58354e['options']);return db[_0xef9e('0x3f')][_0xef9e('0x46')](_0x5262af)['then'](handleEntityNotFound(_0x64ef6e,null))[_0xef9e('0x25')](respondWithResult(_0x64ef6e,null))['catch'](handleError(_0x64ef6e,null));};exports[_0xef9e('0x47')]=function(_0x4ced4d,_0x4def64){return db[_0xef9e('0x3f')][_0xef9e('0x47')](_0x4ced4d[_0xef9e('0x48')],{})[_0xef9e('0x25')](respondWithResult(_0x4def64,0xc9))[_0xef9e('0x49')](handleError(_0x4def64,null));};exports[_0xef9e('0x4a')]=function(_0x36d76e,_0x16f35d){return db[_0xef9e('0x3f')]['bulkCreate'](_0x36d76e['body'],{'raw':![],'individualHooks':!![]})[_0xef9e('0x25')](respondWithResult(_0x16f35d,0xc9))[_0xef9e('0x49')](handleError(_0x16f35d,null));};exports[_0xef9e('0x23')]=function(_0x24de2c,_0x3f7bac){if(_0x24de2c['body']['id']){delete _0x24de2c[_0xef9e('0x48')]['id'];}return db['AnalyticFieldReport'][_0xef9e('0x46')]({'where':{'id':_0x24de2c[_0xef9e('0x44')]['id']}})[_0xef9e('0x25')](handleEntityNotFound(_0x3f7bac,null))[_0xef9e('0x25')](saveUpdates(_0x24de2c[_0xef9e('0x48')],null))['then'](respondWithResult(_0x3f7bac,null))[_0xef9e('0x49')](handleError(_0x3f7bac,null));};exports[_0xef9e('0x24')]=function(_0x266c09,_0x3037ce){return db['AnalyticFieldReport']['find']({'where':{'id':_0x266c09['params']['id']}})[_0xef9e('0x25')](handleEntityNotFound(_0x3037ce,null))[_0xef9e('0x25')](removeEntity(_0x3037ce,null))[_0xef9e('0x49')](handleError(_0x3037ce,null));};exports[_0xef9e('0x4b')]=function(_0x5dafb0,_0x501c87){return db[_0xef9e('0x3f')][_0xef9e('0x24')]({'where':{'id':_0x5dafb0[_0xef9e('0x30')][_0xef9e('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xef9e('0x25')](respondWithResult(_0x501c87,0xcc))[_0xef9e('0x49')](handleError(_0x501c87,null));};exports[_0xef9e('0x4d')]=function(_0x5ce858,_0x5d8748,_0x5d7489){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x5ce858[_0xef9e('0x44')]['id']}})[_0xef9e('0x25')](handleEntityNotFound(_0x5d8748,null))[_0xef9e('0x25')](function(_0x4c89ff){if(_0x4c89ff){return db[_0xef9e('0x4e')][_0xef9e('0x4f')](function(_0x2b8e04){return db[_0xef9e('0x3f')][_0xef9e('0x24')]({'where':{'CustomReportId':_0x5ce858[_0xef9e('0x44')]['id']},'transaction':_0x2b8e04})[_0xef9e('0x25')](function(_0x39c41){var _0x312e24=_['map'](_0x5ce858[_0xef9e('0x48')],function(_0x2b3ba7){delete _0x2b3ba7['id'];_0x2b3ba7['CustomReportId']=_0x5ce858['params']['id'];return _0x2b3ba7;});return db[_0xef9e('0x3f')]['bulkCreate'](_0x312e24,{'transaction':_0x2b8e04});});})['then'](function(){return db['AnalyticFieldReport'][_0xef9e('0x41')]({'where':{'CustomReportId':_0x5ce858[_0xef9e('0x44')]['id']}});});}})[_0xef9e('0x25')](respondWithResult(_0x5d8748,null))[_0xef9e('0x49')](handleError(_0x5d8748,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 5f5f09d..16ae07e 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 _0x9f83=['../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9f83,0x12d));var _0x39f8=function(_0x4e2929,_0x93b5f1){_0x4e2929=_0x4e2929-0x0;var _0x4e1c87=_0x9f83[_0x4e2929];return _0x4e1c87;};'use strict';var _=require(_0x39f8('0x0'));var util=require(_0x39f8('0x1'));var logger=require(_0x39f8('0x2'))(_0x39f8('0x3'));var moment=require('moment');var BPromise=require(_0x39f8('0x4'));var rp=require(_0x39f8('0x5'));var fs=require('fs');var path=require(_0x39f8('0x6'));var rimraf=require('rimraf');var config=require(_0x39f8('0x7'));var attributes=require(_0x39f8('0x8'));module['exports']=function(_0x2af4b1,_0x5a72dc){return _0x2af4b1[_0x39f8('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x39f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa5a=['rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x39d560,_0x5228c8){var _0x3d7e6c=function(_0x54cf67){while(--_0x54cf67){_0x39d560['push'](_0x39d560['shift']());}};_0x3d7e6c(++_0x5228c8);}(_0xaa5a,0x18c));var _0xaaa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa5a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xaaa5('0x0'));var logger=require(_0xaaa5('0x1'))(_0xaaa5('0x2'));var moment=require(_0xaaa5('0x3'));var BPromise=require(_0xaaa5('0x4'));var rp=require(_0xaaa5('0x5'));var fs=require('fs');var path=require(_0xaaa5('0x6'));var rimraf=require(_0xaaa5('0x7'));var config=require(_0xaaa5('0x8'));var attributes=require(_0xaaa5('0x9'));module['exports']=function(_0x3320b6,_0x15476d){return _0x3320b6[_0xaaa5('0xa')](_0xaaa5('0xb'),attributes,{'tableName':_0xaaa5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 3461eb4..19dd068 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 _0x2fa5=['rpc','../../config/environment','jayson/promise','client','http','request','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2fa5,0x1c4));var _0x52fa=function(_0xec0833,_0x1b4e39){_0xec0833=_0xec0833-0x0;var _0x166af1=_0x2fa5[_0xec0833];return _0x166af1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x52fa('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52fa('0x1'));var db=require(_0x52fa('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x52fa('0x3'))(_0x52fa('0x4'));var config=require(_0x52fa('0x5'));var jayson=require(_0x52fa('0x6'));var client=jayson[_0x52fa('0x7')][_0x52fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x362f3d,_0x2e67d9,_0x4b8b9a){return new BPromise(function(_0x1cca68,_0x472914){return client[_0x52fa('0x9')](_0x362f3d,_0x4b8b9a)['then'](function(_0xeb6252){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2e67d9,'request\x20sent');logger[_0x52fa('0xa')](_0x52fa('0xb'),_0x2e67d9,_0x52fa('0xc'),JSON[_0x52fa('0xd')](_0xeb6252));if(_0xeb6252[_0x52fa('0xe')]){if(_0xeb6252['error']['code']===0x1f4){logger[_0x52fa('0xe')](_0x52fa('0xf'),_0x2e67d9,_0xeb6252[_0x52fa('0xe')][_0x52fa('0x10')]);return _0x472914(_0xeb6252['error']['message']);}logger[_0x52fa('0xe')](_0x52fa('0xf'),_0x2e67d9,_0xeb6252[_0x52fa('0xe')][_0x52fa('0x10')]);return _0x1cca68(_0xeb6252[_0x52fa('0xe')]['message']);}else{logger['info'](_0x52fa('0xf'),_0x2e67d9,'request\x20sent');_0x1cca68(_0xeb6252[_0x52fa('0x11')][_0x52fa('0x10')]);}})[_0x52fa('0x12')](function(_0x1f5351){logger[_0x52fa('0xe')](_0x52fa('0xf'),_0x2e67d9,_0x1f5351);_0x472914(_0x1f5351);});});} \ No newline at end of file +var _0x4907=['error','code','message','AnalyticFieldReport,\x20%s,\x20%s','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x23b2b4,_0x1af875){var _0x4918ae=function(_0x17829a){while(--_0x17829a){_0x23b2b4['push'](_0x23b2b4['shift']());}};_0x4918ae(++_0x1af875);}(_0x4907,0x1c7));var _0x7490=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4907[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x7490('0x0'));var util=require('util');var moment=require(_0x7490('0x1'));var BPromise=require(_0x7490('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7490('0x3'))['db'];var utils=require(_0x7490('0x4'));var logger=require(_0x7490('0x5'))(_0x7490('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7490('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f81a4,_0x205bd8,_0x53c31f){return new BPromise(function(_0x487026,_0x586af4){return client['request'](_0x1f81a4,_0x53c31f)[_0x7490('0x8')](function(_0x4dc05){logger[_0x7490('0x9')]('AnalyticFieldReport,\x20%s,\x20%s',_0x205bd8,_0x7490('0xa'));logger['debug'](_0x7490('0xb'),_0x205bd8,'request\x20sent',JSON[_0x7490('0xc')](_0x4dc05));if(_0x4dc05['error']){if(_0x4dc05[_0x7490('0xd')][_0x7490('0xe')]===0x1f4){logger[_0x7490('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x205bd8,_0x4dc05[_0x7490('0xd')][_0x7490('0xf')]);return _0x586af4(_0x4dc05[_0x7490('0xd')]['message']);}logger['error'](_0x7490('0x10'),_0x205bd8,_0x4dc05[_0x7490('0xd')][_0x7490('0xf')]);return _0x487026(_0x4dc05[_0x7490('0xd')][_0x7490('0xf')]);}else{logger[_0x7490('0x9')]('AnalyticFieldReport,\x20%s,\x20%s',_0x205bd8,_0x7490('0xa'));_0x487026(_0x4dc05['result'][_0x7490('0xf')]);}})[_0x7490('0x11')](function(_0x484a79){logger['error'](_0x7490('0x10'),_0x205bd8,_0x484a79);_0x586af4(_0x484a79);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 015c7f6..27b9c9b 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(_0x18e9e3,_0x33ec06){var _0xcee7dc=function(_0x102b51){while(--_0x102b51){_0x18e9e3['push'](_0x18e9e3['shift']());}};_0xcee7dc(++_0x33ec06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x4d4f29,_0x247af2){var _0x261648=function(_0x5c9b27){while(--_0x5c9b27){_0x4d4f29['push'](_0x4d4f29['shift']());}};_0x261648(++_0x247af2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 66d9f3d..ce0c8b5 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 _0x2948=['STRING','name','TEXT','sequelize','exports'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x2948,0xcb));var _0x8294=function(_0xb79f3c,_0x41cae2){_0xb79f3c=_0xb79f3c-0x0;var _0x4d18e0=_0x2948[_0xb79f3c];return _0x4d18e0;};'use strict';var Sequelize=require(_0x8294('0x0'));module[_0x8294('0x1')]={'name':{'type':Sequelize[_0x8294('0x2')],'allowNull':![],'unique':_0x8294('0x3')},'table':{'type':Sequelize[_0x8294('0x2')]},'metric':{'type':Sequelize[_0x8294('0x4')]},'description':{'type':Sequelize[_0x8294('0x2')]}}; \ No newline at end of file +var _0x2b50=['sequelize','STRING'];(function(_0x22cc8d,_0x4fca24){var _0x4d3ecc=function(_0x57ffb1){while(--_0x57ffb1){_0x22cc8d['push'](_0x22cc8d['shift']());}};_0x4d3ecc(++_0x4fca24);}(_0x2b50,0x68));var _0x02b5=function(_0x102a3b,_0x668420){_0x102a3b=_0x102a3b-0x0;var _0x1c1b96=_0x2b50[_0x102a3b];return _0x1c1b96;};'use strict';var Sequelize=require(_0x02b5('0x0'));module['exports']={'name':{'type':Sequelize[_0x02b5('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x02b5('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 44c8633..3530d13 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x151762,_0x17691f){var _0x27f596=function(_0x4ca750){while(--_0x4ca750){_0x151762['push'](_0x151762['shift']());}};_0x27f596(++_0x17691f);}(_0x008c,0x188));var _0xc008=function(_0x27def7,_0x3f0835){_0x27def7=_0x27def7-0x0;var _0x581cbc=_0x008c[_0x27def7];return _0x581cbc;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x4e3ca7,_0x4418bc){var _0x34f625=function(_0x201333){while(--_0x201333){_0x4e3ca7['push'](_0x4e3ca7['shift']());}};_0x34f625(++_0x4418bc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x5fc3[_0x687ddc];return _0x441991;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index c02dd3a..a14ca18 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 _0xbfe8=['analytics_metrics','util','api','moment','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x377ddf,_0x102e9a){var _0x5b8465=function(_0x3e0ed3){while(--_0x3e0ed3){_0x377ddf['push'](_0x377ddf['shift']());}};_0x5b8465(++_0x102e9a);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x1f3894,_0x375683){_0x1f3894=_0x1f3894-0x0;var _0xe66dd1=_0xbfe8[_0x1f3894];return _0xe66dd1;};'use strict';var _=require('lodash');var util=require(_0x8bfe('0x0'));var logger=require('../../config/logger')(_0x8bfe('0x1'));var moment=require(_0x8bfe('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bfe('0x3'));var rimraf=require(_0x8bfe('0x4'));var config=require('../../config/environment');var attributes=require(_0x8bfe('0x5'));module[_0x8bfe('0x6')]=function(_0x314a9a,_0x4933c9){return _0x314a9a[_0x8bfe('0x7')](_0x8bfe('0x8'),attributes,{'tableName':_0x8bfe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x268711,_0x151157){var _0x296608=function(_0x17caf5){while(--_0x17caf5){_0x268711['push'](_0x268711['shift']());}};_0x296608(++_0x151157);}(_0x7bd0,0x111));var _0x07bd=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x7bd0[_0x31172e];return _0x414ada;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var logger=require(_0x07bd('0x2'))(_0x07bd('0x3'));var moment=require(_0x07bd('0x4'));var BPromise=require(_0x07bd('0x5'));var rp=require(_0x07bd('0x6'));var fs=require('fs');var path=require(_0x07bd('0x7'));var rimraf=require('rimraf');var config=require(_0x07bd('0x8'));var attributes=require(_0x07bd('0x9'));module[_0x07bd('0xa')]=function(_0x313548,_0x3e8349){return _0x313548[_0x07bd('0xb')](_0x07bd('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 36c305c..1aa6b82 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 _0x4819=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xb9ac5,_0x4d9640){var _0x3d4bd8=function(_0x25ec21){while(--_0x25ec21){_0xb9ac5['push'](_0xb9ac5['shift']());}};_0x3d4bd8(++_0x4d9640);}(_0x4819,0xec));var _0x9481=function(_0x20dbe3,_0x2cc5b3){_0x20dbe3=_0x20dbe3-0x0;var _0x57b693=_0x4819[_0x20dbe3];return _0x57b693;};'use strict';var _=require(_0x9481('0x0'));var util=require(_0x9481('0x1'));var moment=require('moment');var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))('rpc');var config=require(_0x9481('0x8'));var jayson=require(_0x9481('0x9'));var client=jayson['client'][_0x9481('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b769f,_0x4ed818,_0xf007a0){return new BPromise(function(_0x440c8f,_0x5143f8){return client[_0x9481('0xb')](_0x2b769f,_0xf007a0)[_0x9481('0xc')](function(_0x4296bc){logger[_0x9481('0xd')](_0x9481('0xe'),_0x4ed818,_0x9481('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4ed818,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x4296bc));if(_0x4296bc[_0x9481('0x11')]){if(_0x4296bc[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x4296bc[_0x9481('0x11')][_0x9481('0x13')]);return _0x5143f8(_0x4296bc[_0x9481('0x11')]['message']);}logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x4296bc['error'][_0x9481('0x13')]);return _0x440c8f(_0x4296bc[_0x9481('0x11')][_0x9481('0x13')]);}else{logger['info'](_0x9481('0xe'),_0x4ed818,_0x9481('0xf'));_0x440c8f(_0x4296bc[_0x9481('0x14')][_0x9481('0x13')]);}})[_0x9481('0x15')](function(_0x966cf9){logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x966cf9);_0x5143f8(_0x966cf9);});});} \ No newline at end of file +var _0xc2f0=['error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ed853,_0x1c21e9){var _0x3e76aa=function(_0x1d41ed){while(--_0x1d41ed){_0x1ed853['push'](_0x1ed853['shift']());}};_0x3e76aa(++_0x1c21e9);}(_0xc2f0,0x68));var _0x0c2f=function(_0x5aa5c4,_0x20d570){_0x5aa5c4=_0x5aa5c4-0x0;var _0x2d6e05=_0xc2f0[_0x5aa5c4];return _0x2d6e05;};'use strict';var _=require(_0x0c2f('0x0'));var util=require(_0x0c2f('0x1'));var moment=require('moment');var BPromise=require(_0x0c2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c2f('0x3'))['db'];var utils=require(_0x0c2f('0x4'));var logger=require('../../config/logger')(_0x0c2f('0x5'));var config=require(_0x0c2f('0x6'));var jayson=require(_0x0c2f('0x7'));var client=jayson['client'][_0x0c2f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x366e2b,_0x4e291f,_0x2df7d8){return new BPromise(function(_0x5d0e93,_0xc6853c){return client['request'](_0x366e2b,_0x2df7d8)[_0x0c2f('0x9')](function(_0xb5e867){logger[_0x0c2f('0xa')](_0x0c2f('0xb'),_0x4e291f,_0x0c2f('0xc'));logger[_0x0c2f('0xd')](_0x0c2f('0xe'),_0x4e291f,_0x0c2f('0xc'),JSON[_0x0c2f('0xf')](_0xb5e867));if(_0xb5e867[_0x0c2f('0x10')]){if(_0xb5e867['error']['code']===0x1f4){logger['error'](_0x0c2f('0xb'),_0x4e291f,_0xb5e867[_0x0c2f('0x10')]['message']);return _0xc6853c(_0xb5e867[_0x0c2f('0x10')]['message']);}logger['error'](_0x0c2f('0xb'),_0x4e291f,_0xb5e867[_0x0c2f('0x10')][_0x0c2f('0x11')]);return _0x5d0e93(_0xb5e867[_0x0c2f('0x10')][_0x0c2f('0x11')]);}else{logger[_0x0c2f('0xa')](_0x0c2f('0xb'),_0x4e291f,'request\x20sent');_0x5d0e93(_0xb5e867[_0x0c2f('0x12')]['message']);}})[_0x0c2f('0x13')](function(_0xf30d9b){logger[_0x0c2f('0x10')](_0x0c2f('0xb'),_0x4e291f,_0xf30d9b);_0xc6853c(_0xf30d9b);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3e24b6c..04d8a7f 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 _0x6347=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x6347,0x1c9));var _0x7634=function(_0x2d1f2a,_0x4803f2){_0x2d1f2a=_0x2d1f2a-0x0;var _0x740409=_0x6347[_0x2d1f2a];return _0x740409;};'use strict';var multer=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var path=require('path');var timeout=require(_0x7634('0x2'));var express=require(_0x7634('0x3'));var router=express[_0x7634('0x4')]();var fs_extra=require(_0x7634('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7634('0x6'));var config=require('../../config/environment');var controller=require(_0x7634('0x7'));router[_0x7634('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7634('0x8')](_0x7634('0x9'),auth[_0x7634('0xa')](),controller[_0x7634('0xb')]);router[_0x7634('0xc')]('/',auth[_0x7634('0xa')](),controller['create']);router[_0x7634('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7634('0xe')](_0x7634('0x9'),auth[_0x7634('0xa')](),controller[_0x7634('0xf')]);module[_0x7634('0x10')]=router; \ No newline at end of file +var _0x0bde=['post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x456d0d,_0x222682){var _0x57d285=function(_0x51e076){while(--_0x51e076){_0x456d0d['push'](_0x456d0d['shift']());}};_0x57d285(++_0x222682);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe0bd('0x0'));var util=require('util');var path=require(_0xe0bd('0x1'));var timeout=require(_0xe0bd('0x2'));var express=require('express');var router=express[_0xe0bd('0x3')]();var fs_extra=require(_0xe0bd('0x4'));var auth=require(_0xe0bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe0bd('0x6'));var controller=require(_0xe0bd('0x7'));router[_0xe0bd('0x8')]('/',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xa')]);router[_0xe0bd('0x8')](_0xe0bd('0xb'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xc')]);router[_0xe0bd('0xd')]('/',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xe')]);router[_0xe0bd('0xf')]('/:id',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0x10')]);router['delete'](_0xe0bd('0xb'),auth['isAuthenticated'](),controller[_0xe0bd('0x11')]);module[_0xe0bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index b75e6df..9ccc2d2 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 _0x5c9b=['TEXT','sequelize','exports'];(function(_0x36982c,_0x226c13){var _0x4ff168=function(_0x44eec8){while(--_0x44eec8){_0x36982c['push'](_0x36982c['shift']());}};_0x4ff168(++_0x226c13);}(_0x5c9b,0x14e));var _0xb5c9=function(_0x880077,_0x3aedaa){_0x880077=_0x880077-0x0;var _0x86ba0d=_0x5c9b[_0x880077];return _0x86ba0d;};'use strict';var Sequelize=require(_0xb5c9('0x0'));module[_0xb5c9('0x1')]={'tree':{'type':Sequelize[_0xb5c9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x47e7=['TEXT','sequelize'];(function(_0x1856b4,_0x1e9aea){var _0x76348c=function(_0x3a8cdd){while(--_0x3a8cdd){_0x1856b4['push'](_0x1856b4['shift']());}};_0x76348c(++_0x1e9aea);}(_0x47e7,0xfd));var _0x747e=function(_0x46e5c8,_0x5e6777){_0x46e5c8=_0x46e5c8-0x0;var _0x398e5f=_0x47e7[_0x46e5c8];return _0x398e5f;};'use strict';var Sequelize=require(_0x747e('0x0'));module['exports']={'tree':{'type':Sequelize[_0x747e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 6b4807f..fe6d4b3 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 _0xa462=['rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','index','AnalyticTreeReport','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','include','findAll','params','rawAttributes','includeAll','catch','create','body','find','eml-format'];(function(_0x614f5,_0x2cfabe){var _0x2360f7=function(_0x30c1c3){while(--_0x30c1c3){_0x614f5['push'](_0x614f5['shift']());}};_0x2360f7(++_0x2cfabe);}(_0xa462,0x12f));var _0x2a46=function(_0x1afe66,_0x1cdecd){_0x1afe66=_0x1afe66-0x0;var _0x9a9acd=_0xa462[_0x1afe66];return _0x9a9acd;};'use strict';var emlformat=require(_0x2a46('0x0'));var rimraf=require(_0x2a46('0x1'));var zipdir=require(_0x2a46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a46('0x3'));var moment=require('moment');var BPromise=require(_0x2a46('0x4'));var Mustache=require(_0x2a46('0x5'));var util=require(_0x2a46('0x6'));var path=require(_0x2a46('0x7'));var sox=require(_0x2a46('0x8'));var csv=require(_0x2a46('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a46('0xa'));var _=require(_0x2a46('0xb'));var squel=require(_0x2a46('0xc'));var crypto=require(_0x2a46('0xd'));var jsforce=require(_0x2a46('0xe'));var deskjs=require(_0x2a46('0xf'));var toCsv=require(_0x2a46('0x9'));var querystring=require('querystring');var Papa=require(_0x2a46('0x10'));var Redis=require(_0x2a46('0x11'));var authService=require(_0x2a46('0x12'));var qs=require(_0x2a46('0x13'));var as=require(_0x2a46('0x14'));var hardwareService=require(_0x2a46('0x15'));var logger=require(_0x2a46('0x16'))(_0x2a46('0x17'));var utils=require(_0x2a46('0x18'));var config=require(_0x2a46('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a46('0x1a'))['db'];function respondWithStatusCode(_0x284073,_0x3a8ceb){_0x3a8ceb=_0x3a8ceb||0xcc;return function(_0x16de60){if(_0x16de60){return _0x284073['sendStatus'](_0x3a8ceb);}return _0x284073[_0x2a46('0x1b')](_0x3a8ceb)[_0x2a46('0x1c')]();};}function respondWithResult(_0x9fe1b9,_0x3a8ff3){_0x3a8ff3=_0x3a8ff3||0xc8;return function(_0x2fc0ca){if(_0x2fc0ca){return _0x9fe1b9[_0x2a46('0x1b')](_0x3a8ff3)[_0x2a46('0x1d')](_0x2fc0ca);}};}function respondWithFilteredResult(_0x234a38,_0x4e1a0a){return function(_0x3b9f4b){if(_0x3b9f4b){var _0x539994=typeof _0x4e1a0a[_0x2a46('0x1e')]===_0x2a46('0x1f')&&typeof _0x4e1a0a['limit']==='undefined';var _0x357498=_0x3b9f4b[_0x2a46('0x20')];var _0x1f1c56=_0x539994?0x0:_0x4e1a0a[_0x2a46('0x1e')];var _0xa255b=_0x539994?_0x3b9f4b['count']:_0x4e1a0a[_0x2a46('0x1e')]+_0x4e1a0a[_0x2a46('0x21')];var _0x136698;if(_0xa255b>=_0x357498){_0xa255b=_0x357498;_0x136698=0xc8;}else{_0x136698=0xce;}_0x234a38['status'](_0x136698);return _0x234a38[_0x2a46('0x22')](_0x2a46('0x23'),_0x1f1c56+'-'+_0xa255b+'/'+_0x357498)['json'](_0x3b9f4b);}return null;};}function patchUpdates(_0x53cc1f){return function(_0x2d14aa){try{jsonpatch[_0x2a46('0x24')](_0x2d14aa,_0x53cc1f,!![]);}catch(_0x170c0b){return BPromise['reject'](_0x170c0b);}return _0x2d14aa['save']();};}function saveUpdates(_0x356938,_0x386299){return function(_0x32ed5c){if(_0x32ed5c){return _0x32ed5c[_0x2a46('0x25')](_0x356938)[_0x2a46('0x26')](function(_0x4b0610){return _0x4b0610;});}return null;};}function removeEntity(_0x555289,_0x21636c){return function(_0x310523){if(_0x310523){return _0x310523[_0x2a46('0x27')]()['then'](function(){_0x555289[_0x2a46('0x1b')](0xcc)[_0x2a46('0x1c')]();});}};}function handleEntityNotFound(_0x498e10,_0x365d5b){return function(_0x47cc87){if(!_0x47cc87){_0x498e10[_0x2a46('0x28')](0x194);}return _0x47cc87;};}function handleError(_0x705547,_0x30206a){_0x30206a=_0x30206a||0x1f4;return function(_0xe87cf2){logger[_0x2a46('0x29')](_0xe87cf2[_0x2a46('0x2a')]);if(_0xe87cf2['name']){delete _0xe87cf2['name'];}_0x705547['status'](_0x30206a)['send'](_0xe87cf2);};}exports[_0x2a46('0x2b')]=function(_0x3fb77e,_0x11227c){var _0x506e1e={},_0x52b846={},_0x1afe6f={'count':0x0,'rows':[]};var _0x4722b0=_['map'](db[_0x2a46('0x2c')]['rawAttributes'],function(_0x4cde07){return{'name':_0x4cde07[_0x2a46('0x2d')],'type':_0x4cde07['type'][_0x2a46('0x2e')]};});_0x52b846[_0x2a46('0x2f')]=_['map'](_0x4722b0,_0x2a46('0x30'));_0x52b846[_0x2a46('0x31')]=_[_0x2a46('0x32')](_0x3fb77e['query']);_0x52b846[_0x2a46('0x33')]=_[_0x2a46('0x34')](_0x52b846[_0x2a46('0x2f')],_0x52b846[_0x2a46('0x31')]);_0x506e1e['attributes']=_[_0x2a46('0x34')](_0x52b846[_0x2a46('0x2f')],qs[_0x2a46('0x35')](_0x3fb77e[_0x2a46('0x31')]['fields']));_0x506e1e['attributes']=_0x506e1e[_0x2a46('0x36')][_0x2a46('0x37')]?_0x506e1e[_0x2a46('0x36')]:_0x52b846[_0x2a46('0x2f')];if(!_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x38')]('nolimit')){_0x506e1e[_0x2a46('0x21')]=qs['limit'](_0x3fb77e['query'][_0x2a46('0x21')]);_0x506e1e['offset']=qs[_0x2a46('0x1e')](_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x1e')]);}_0x506e1e[_0x2a46('0x39')]=qs[_0x2a46('0x3a')](_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x3a')]);_0x506e1e[_0x2a46('0x3b')]=qs[_0x2a46('0x33')](_[_0x2a46('0x3c')](_0x3fb77e[_0x2a46('0x31')],_0x52b846[_0x2a46('0x33')]),_0x4722b0);if(_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x3d')]){_0x506e1e['where']=_['merge'](_0x506e1e[_0x2a46('0x3b')],{'$or':_[_0x2a46('0x3e')](_0x4722b0,function(_0x35ef95){if(_0x35ef95[_0x2a46('0x3f')]!==_0x2a46('0x40')){var _0x41a287={};_0x41a287[_0x35ef95[_0x2a46('0x30')]]={'$like':'%'+_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x3d')]+'%'};return _0x41a287;}})});}_0x506e1e=_[_0x2a46('0x41')]({},_0x506e1e,_0x3fb77e[_0x2a46('0x42')]);var _0x3f45c5={'where':_0x506e1e['where']};return db['AnalyticTreeReport'][_0x2a46('0x20')](_0x3f45c5)['then'](function(_0x5d81dc){_0x1afe6f[_0x2a46('0x20')]=_0x5d81dc;if(_0x3fb77e['query']['includeAll']){_0x506e1e[_0x2a46('0x43')]=[{'all':!![]}];}return db[_0x2a46('0x2c')][_0x2a46('0x44')](_0x506e1e);})[_0x2a46('0x26')](function(_0x3f0b1f){_0x1afe6f['rows']=_0x3f0b1f;return _0x1afe6f;})['then'](respondWithFilteredResult(_0x11227c,_0x506e1e))['catch'](handleError(_0x11227c,null));};exports['show']=function(_0x2808b1,_0x46c7b1){var _0x490cc7={'raw':!![],'where':{'id':_0x2808b1[_0x2a46('0x45')]['id']}},_0x2df5ce={};_0x2df5ce[_0x2a46('0x2f')]=_[_0x2a46('0x32')](db['AnalyticTreeReport'][_0x2a46('0x46')]);_0x2df5ce[_0x2a46('0x31')]=_[_0x2a46('0x32')](_0x2808b1[_0x2a46('0x31')]);_0x2df5ce[_0x2a46('0x33')]=_[_0x2a46('0x34')](_0x2df5ce[_0x2a46('0x2f')],_0x2df5ce[_0x2a46('0x31')]);_0x490cc7[_0x2a46('0x36')]=_['intersection'](_0x2df5ce['model'],qs[_0x2a46('0x35')](_0x2808b1[_0x2a46('0x31')]['fields']));_0x490cc7[_0x2a46('0x36')]=_0x490cc7['attributes']['length']?_0x490cc7['attributes']:_0x2df5ce[_0x2a46('0x2f')];if(_0x2808b1[_0x2a46('0x31')][_0x2a46('0x47')]){_0x490cc7['include']=[{'all':!![]}];}_0x490cc7=_[_0x2a46('0x41')]({},_0x490cc7,_0x2808b1[_0x2a46('0x42')]);return db[_0x2a46('0x2c')]['find'](_0x490cc7)[_0x2a46('0x26')](handleEntityNotFound(_0x46c7b1,null))[_0x2a46('0x26')](respondWithResult(_0x46c7b1,null))[_0x2a46('0x48')](handleError(_0x46c7b1,null));};exports[_0x2a46('0x49')]=function(_0x2d6b8e,_0x5a5668){return db[_0x2a46('0x2c')]['create'](_0x2d6b8e['body'],{})['then'](respondWithResult(_0x5a5668,0xc9))[_0x2a46('0x48')](handleError(_0x5a5668,null));};exports[_0x2a46('0x25')]=function(_0x464a02,_0x4e571e){if(_0x464a02[_0x2a46('0x4a')]['id']){delete _0x464a02[_0x2a46('0x4a')]['id'];}return db[_0x2a46('0x2c')]['find']({'where':{'id':_0x464a02[_0x2a46('0x45')]['id']}})[_0x2a46('0x26')](handleEntityNotFound(_0x4e571e,null))[_0x2a46('0x26')](saveUpdates(_0x464a02[_0x2a46('0x4a')],null))[_0x2a46('0x26')](respondWithResult(_0x4e571e,null))[_0x2a46('0x48')](handleError(_0x4e571e,null));};exports[_0x2a46('0x27')]=function(_0x380255,_0x2b86da){return db['AnalyticTreeReport'][_0x2a46('0x4b')]({'where':{'id':_0x380255[_0x2a46('0x45')]['id']}})[_0x2a46('0x26')](handleEntityNotFound(_0x2b86da,null))[_0x2a46('0x26')](removeEntity(_0x2b86da,null))[_0x2a46('0x48')](handleError(_0x2b86da,null));}; \ No newline at end of file +var _0xff3e=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','end','stack','name','send','map','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','AnalyticTreeReport','includeAll','findAll','rows','catch','params','keys','include','find','create','body','update','eml-format','rimraf','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x35ebb6,_0x4770cd){var _0x1d2927=function(_0x2ced41){while(--_0x2ced41){_0x35ebb6['push'](_0x35ebb6['shift']());}};_0x1d2927(++_0x4770cd);}(_0xff3e,0x19c));var _0xeff3=function(_0x4c86d7,_0x46367c){_0x4c86d7=_0x4c86d7-0x0;var _0x2aa0df=_0xff3e[_0x4c86d7];return _0x2aa0df;};'use strict';var emlformat=require(_0xeff3('0x0'));var rimraf=require(_0xeff3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeff3('0x2'));var util=require(_0xeff3('0x3'));var path=require(_0xeff3('0x4'));var sox=require(_0xeff3('0x5'));var csv=require(_0xeff3('0x6'));var ejs=require(_0xeff3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeff3('0x8'));var squel=require(_0xeff3('0x9'));var crypto=require(_0xeff3('0xa'));var jsforce=require(_0xeff3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xeff3('0x6'));var querystring=require(_0xeff3('0xc'));var Papa=require(_0xeff3('0xd'));var Redis=require('ioredis');var authService=require(_0xeff3('0xe'));var qs=require(_0xeff3('0xf'));var as=require(_0xeff3('0x10'));var hardwareService=require(_0xeff3('0x11'));var logger=require(_0xeff3('0x12'))(_0xeff3('0x13'));var utils=require(_0xeff3('0x14'));var config=require(_0xeff3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeff3('0x16'))['db'];function respondWithStatusCode(_0x27459f,_0x388806){_0x388806=_0x388806||0xcc;return function(_0xa7bc8){if(_0xa7bc8){return _0x27459f[_0xeff3('0x17')](_0x388806);}return _0x27459f[_0xeff3('0x18')](_0x388806)['end']();};}function respondWithResult(_0x431416,_0x6135b6){_0x6135b6=_0x6135b6||0xc8;return function(_0x33dfdb){if(_0x33dfdb){return _0x431416['status'](_0x6135b6)[_0xeff3('0x19')](_0x33dfdb);}};}function respondWithFilteredResult(_0xaf3b97,_0x5dba12){return function(_0x4c08e0){if(_0x4c08e0){var _0x4b0f7e=typeof _0x5dba12[_0xeff3('0x1a')]==='undefined'&&typeof _0x5dba12[_0xeff3('0x1b')]===_0xeff3('0x1c');var _0x335d2a=_0x4c08e0[_0xeff3('0x1d')];var _0x246d4c=_0x4b0f7e?0x0:_0x5dba12[_0xeff3('0x1a')];var _0x198384=_0x4b0f7e?_0x4c08e0[_0xeff3('0x1d')]:_0x5dba12[_0xeff3('0x1a')]+_0x5dba12[_0xeff3('0x1b')];var _0x357a72;if(_0x198384>=_0x335d2a){_0x198384=_0x335d2a;_0x357a72=0xc8;}else{_0x357a72=0xce;}_0xaf3b97[_0xeff3('0x18')](_0x357a72);return _0xaf3b97[_0xeff3('0x1e')](_0xeff3('0x1f'),_0x246d4c+'-'+_0x198384+'/'+_0x335d2a)[_0xeff3('0x19')](_0x4c08e0);}return null;};}function patchUpdates(_0x2e29ef){return function(_0x444f80){try{jsonpatch['apply'](_0x444f80,_0x2e29ef,!![]);}catch(_0x1816c9){return BPromise[_0xeff3('0x20')](_0x1816c9);}return _0x444f80[_0xeff3('0x21')]();};}function saveUpdates(_0x4a9b4c,_0x20f5ed){return function(_0x26dbaa){if(_0x26dbaa){return _0x26dbaa['update'](_0x4a9b4c)['then'](function(_0x4160e6){return _0x4160e6;});}return null;};}function removeEntity(_0x45d36a,_0x14e33c){return function(_0x43a675){if(_0x43a675){return _0x43a675['destroy']()[_0xeff3('0x22')](function(){_0x45d36a[_0xeff3('0x18')](0xcc)[_0xeff3('0x23')]();});}};}function handleEntityNotFound(_0x21ba10,_0x582c37){return function(_0x4e72ca){if(!_0x4e72ca){_0x21ba10[_0xeff3('0x17')](0x194);}return _0x4e72ca;};}function handleError(_0x306734,_0x452855){_0x452855=_0x452855||0x1f4;return function(_0x25e27d){logger['error'](_0x25e27d[_0xeff3('0x24')]);if(_0x25e27d[_0xeff3('0x25')]){delete _0x25e27d[_0xeff3('0x25')];}_0x306734[_0xeff3('0x18')](_0x452855)[_0xeff3('0x26')](_0x25e27d);};}exports['index']=function(_0x5dabf6,_0x1b0e87){var _0x48e328={},_0x41746a={},_0x4d7447={'count':0x0,'rows':[]};var _0xfb4b6=_[_0xeff3('0x27')](db['AnalyticTreeReport'][_0xeff3('0x28')],function(_0x3d7004){return{'name':_0x3d7004['fieldName'],'type':_0x3d7004['type'][_0xeff3('0x29')]};});_0x41746a[_0xeff3('0x2a')]=_['map'](_0xfb4b6,_0xeff3('0x25'));_0x41746a['query']=_['keys'](_0x5dabf6[_0xeff3('0x2b')]);_0x41746a['filters']=_[_0xeff3('0x2c')](_0x41746a[_0xeff3('0x2a')],_0x41746a[_0xeff3('0x2b')]);_0x48e328['attributes']=_[_0xeff3('0x2c')](_0x41746a[_0xeff3('0x2a')],qs[_0xeff3('0x2d')](_0x5dabf6['query'][_0xeff3('0x2d')]));_0x48e328[_0xeff3('0x2e')]=_0x48e328[_0xeff3('0x2e')][_0xeff3('0x2f')]?_0x48e328['attributes']:_0x41746a['model'];if(!_0x5dabf6[_0xeff3('0x2b')][_0xeff3('0x30')](_0xeff3('0x31'))){_0x48e328[_0xeff3('0x1b')]=qs[_0xeff3('0x1b')](_0x5dabf6['query'][_0xeff3('0x1b')]);_0x48e328['offset']=qs['offset'](_0x5dabf6[_0xeff3('0x2b')][_0xeff3('0x1a')]);}_0x48e328[_0xeff3('0x32')]=qs[_0xeff3('0x33')](_0x5dabf6[_0xeff3('0x2b')][_0xeff3('0x33')]);_0x48e328[_0xeff3('0x34')]=qs[_0xeff3('0x35')](_[_0xeff3('0x36')](_0x5dabf6[_0xeff3('0x2b')],_0x41746a[_0xeff3('0x35')]),_0xfb4b6);if(_0x5dabf6['query'][_0xeff3('0x37')]){_0x48e328[_0xeff3('0x34')]=_[_0xeff3('0x38')](_0x48e328[_0xeff3('0x34')],{'$or':_[_0xeff3('0x27')](_0xfb4b6,function(_0x45f419){if(_0x45f419[_0xeff3('0x39')]!==_0xeff3('0x3a')){var _0x167e56={};_0x167e56[_0x45f419[_0xeff3('0x25')]]={'$like':'%'+_0x5dabf6[_0xeff3('0x2b')][_0xeff3('0x37')]+'%'};return _0x167e56;}})});}_0x48e328=_[_0xeff3('0x38')]({},_0x48e328,_0x5dabf6[_0xeff3('0x3b')]);var _0x257b5f={'where':_0x48e328[_0xeff3('0x34')]};return db[_0xeff3('0x3c')][_0xeff3('0x1d')](_0x257b5f)[_0xeff3('0x22')](function(_0xffb719){_0x4d7447[_0xeff3('0x1d')]=_0xffb719;if(_0x5dabf6[_0xeff3('0x2b')][_0xeff3('0x3d')]){_0x48e328['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xeff3('0x3e')](_0x48e328);})[_0xeff3('0x22')](function(_0x3da48b){_0x4d7447[_0xeff3('0x3f')]=_0x3da48b;return _0x4d7447;})[_0xeff3('0x22')](respondWithFilteredResult(_0x1b0e87,_0x48e328))[_0xeff3('0x40')](handleError(_0x1b0e87,null));};exports['show']=function(_0x498d93,_0x3e00e7){var _0x39404d={'raw':!![],'where':{'id':_0x498d93[_0xeff3('0x41')]['id']}},_0x1955ca={};_0x1955ca[_0xeff3('0x2a')]=_[_0xeff3('0x42')](db['AnalyticTreeReport'][_0xeff3('0x28')]);_0x1955ca['query']=_[_0xeff3('0x42')](_0x498d93[_0xeff3('0x2b')]);_0x1955ca['filters']=_[_0xeff3('0x2c')](_0x1955ca['model'],_0x1955ca['query']);_0x39404d['attributes']=_[_0xeff3('0x2c')](_0x1955ca[_0xeff3('0x2a')],qs[_0xeff3('0x2d')](_0x498d93['query'][_0xeff3('0x2d')]));_0x39404d['attributes']=_0x39404d[_0xeff3('0x2e')][_0xeff3('0x2f')]?_0x39404d[_0xeff3('0x2e')]:_0x1955ca[_0xeff3('0x2a')];if(_0x498d93[_0xeff3('0x2b')][_0xeff3('0x3d')]){_0x39404d[_0xeff3('0x43')]=[{'all':!![]}];}_0x39404d=_[_0xeff3('0x38')]({},_0x39404d,_0x498d93[_0xeff3('0x3b')]);return db[_0xeff3('0x3c')][_0xeff3('0x44')](_0x39404d)[_0xeff3('0x22')](handleEntityNotFound(_0x3e00e7,null))[_0xeff3('0x22')](respondWithResult(_0x3e00e7,null))[_0xeff3('0x40')](handleError(_0x3e00e7,null));};exports[_0xeff3('0x45')]=function(_0x54547f,_0xd8eddb){return db['AnalyticTreeReport'][_0xeff3('0x45')](_0x54547f[_0xeff3('0x46')],{})[_0xeff3('0x22')](respondWithResult(_0xd8eddb,0xc9))[_0xeff3('0x40')](handleError(_0xd8eddb,null));};exports[_0xeff3('0x47')]=function(_0x395005,_0x3c3c3c){if(_0x395005[_0xeff3('0x46')]['id']){delete _0x395005['body']['id'];}return db[_0xeff3('0x3c')]['find']({'where':{'id':_0x395005[_0xeff3('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c3c3c,null))[_0xeff3('0x22')](saveUpdates(_0x395005[_0xeff3('0x46')],null))[_0xeff3('0x22')](respondWithResult(_0x3c3c3c,null))[_0xeff3('0x40')](handleError(_0x3c3c3c,null));};exports['destroy']=function(_0x3c19b8,_0x2629f6){return db[_0xeff3('0x3c')][_0xeff3('0x44')]({'where':{'id':_0x3c19b8[_0xeff3('0x41')]['id']}})[_0xeff3('0x22')](handleEntityNotFound(_0x2629f6,null))[_0xeff3('0x22')](removeEntity(_0x2629f6,null))[_0xeff3('0x40')](handleError(_0x2629f6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e133139..aaba529 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 _0x08f1=['define','analytics_report_trees','lodash','util','../../config/logger','api','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x08f1,0x160));var _0x108f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x08f1[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x108f('0x0'));var util=require(_0x108f('0x1'));var logger=require(_0x108f('0x2'))(_0x108f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x108f('0x4'));var config=require(_0x108f('0x5'));var attributes=require(_0x108f('0x6'));module[_0x108f('0x7')]=function(_0x310432,_0x320bcf){return _0x310432[_0x108f('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0x108f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0ca=['request-promise','path','rimraf','./analyticTreeReport.attributes','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xe0ca,0x1c7));var _0xae0c=function(_0x1111ac,_0x27f3d9){_0x1111ac=_0x1111ac-0x0;var _0x2b30c6=_0xe0ca[_0x1111ac];return _0x2b30c6;};'use strict';var _=require(_0xae0c('0x0'));var util=require(_0xae0c('0x1'));var logger=require(_0xae0c('0x2'))('api');var moment=require(_0xae0c('0x3'));var BPromise=require(_0xae0c('0x4'));var rp=require(_0xae0c('0x5'));var fs=require('fs');var path=require(_0xae0c('0x6'));var rimraf=require(_0xae0c('0x7'));var config=require('../../config/environment');var attributes=require(_0xae0c('0x8'));module['exports']=function(_0x693deb,_0x3ef4b2){return _0x693deb['define']('AnalyticTreeReport',attributes,{'tableName':_0xae0c('0x9'),'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 80bc295..d0a464c 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x36f8eb,_0x5b6e60){var _0x14d199=function(_0x10b8b0){while(--_0x10b8b0){_0x36f8eb['push'](_0x36f8eb['shift']());}};_0x14d199(++_0x5b6e60);}(_0xdb28,0x106));var _0x8db2=function(_0x43daa0,_0x385585){_0x43daa0=_0x43daa0-0x0;var _0x49b51a=_0xdb28[_0x43daa0];return _0x49b51a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x5f0e8b,_0x34edaa){_0x5f0e8b=_0x5f0e8b-0x0;var _0x10b71d=_0x7a54[_0x5f0e8b];return _0x10b71d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 1522f6f..cd8ed9b 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 _0x24cf=['put','update','delete','destroy','exports','util','path','express','Router','fs-extra','isAuthenticated','get','/:id','show','post','create'];(function(_0x19112a,_0x3f9d8e){var _0x21b9f0=function(_0x13f1a5){while(--_0x13f1a5){_0x19112a['push'](_0x19112a['shift']());}};_0x21b9f0(++_0x3f9d8e);}(_0x24cf,0xc5));var _0xf24c=function(_0x334df2,_0x3e5500){_0x334df2=_0x334df2-0x0;var _0x23a453=_0x24cf[_0x334df2];return _0x23a453;};'use strict';var multer=require('multer');var util=require(_0xf24c('0x0'));var path=require(_0xf24c('0x1'));var timeout=require('connect-timeout');var express=require(_0xf24c('0x2'));var router=express[_0xf24c('0x3')]();var fs_extra=require(_0xf24c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0xf24c('0x5')](),controller['index']);router[_0xf24c('0x6')](_0xf24c('0x7'),auth[_0xf24c('0x5')](),controller[_0xf24c('0x8')]);router[_0xf24c('0x9')]('/',auth[_0xf24c('0x5')](),controller[_0xf24c('0xa')]);router[_0xf24c('0xb')](_0xf24c('0x7'),auth[_0xf24c('0x5')](),controller[_0xf24c('0xc')]);router[_0xf24c('0xd')](_0xf24c('0x7'),auth['isAuthenticated'](),controller[_0xf24c('0xe')]);module[_0xf24c('0xf')]=router; \ No newline at end of file +var _0xa76d=['isAuthenticated','show','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa76d,0x18e));var _0xda76=function(_0x30fa78,_0xbed7d3){_0x30fa78=_0x30fa78-0x0;var _0xeb83dc=_0xa76d[_0x30fa78];return _0xeb83dc;};'use strict';var multer=require(_0xda76('0x0'));var util=require('util');var path=require(_0xda76('0x1'));var timeout=require(_0xda76('0x2'));var express=require('express');var router=express[_0xda76('0x3')]();var fs_extra=require(_0xda76('0x4'));var auth=require(_0xda76('0x5'));var interaction=require(_0xda76('0x6'));var config=require(_0xda76('0x7'));var controller=require(_0xda76('0x8'));router[_0xda76('0x9')]('/',auth[_0xda76('0xa')](),controller['index']);router['get']('/:id',auth[_0xda76('0xa')](),controller[_0xda76('0xb')]);router['post']('/',auth[_0xda76('0xa')](),controller['create']);router[_0xda76('0xc')](_0xda76('0xd'),auth[_0xda76('0xa')](),controller[_0xda76('0xe')]);router[_0xda76('0xf')]('/:id',auth[_0xda76('0xa')](),controller['destroy']);module[_0xda76('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 8598337..e6840f8 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 _0xe0c3=['sequelize','STRING'];(function(_0x688a1,_0x4c742e){var _0x43ead1=function(_0x166569){while(--_0x166569){_0x688a1['push'](_0x688a1['shift']());}};_0x43ead1(++_0x4c742e);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3e0c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e0c('0x1')]},'basename':{'type':Sequelize[_0x3e0c('0x1')]},'type':{'type':Sequelize[_0x3e0c('0x1')]}}; \ No newline at end of file +var _0xa8eb=['STRING','sequelize'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0xa8eb,0x179));var _0xba8e=function(_0x40570e,_0x53df30){_0x40570e=_0x40570e-0x0;var _0x16336a=_0xa8eb[_0x40570e];return _0x16336a;};'use strict';var Sequelize=require(_0xba8e('0x0'));module['exports']={'name':{'type':Sequelize[_0xba8e('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xba8e('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index bf69dec..2d7152b 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 _0x6af8=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','count','set','Content-Range','reject','update','then','destroy','error','name','send','index','Attachment','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','clone','get','omit','createdAt','updatedAt','body','create','file','filename','mimetype','download','ChatOfflineMessageId','join','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x110a30,_0x1ec1e0){var _0x5f0e4f=function(_0x211ea0){while(--_0x211ea0){_0x110a30['push'](_0x110a30['shift']());}};_0x5f0e4f(++_0x1ec1e0);}(_0x6af8,0xe7));var _0x86af=function(_0x981675,_0x59feff){_0x981675=_0x981675-0x0;var _0x566cf4=_0x6af8[_0x981675];return _0x566cf4;};'use strict';var emlformat=require(_0x86af('0x0'));var rimraf=require(_0x86af('0x1'));var zipdir=require(_0x86af('0x2'));var jsonpatch=require(_0x86af('0x3'));var rp=require(_0x86af('0x4'));var moment=require(_0x86af('0x5'));var BPromise=require(_0x86af('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x86af('0x7'));var sox=require('sox');var csv=require(_0x86af('0x8'));var ejs=require(_0x86af('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x86af('0xa'));var crypto=require(_0x86af('0xb'));var jsforce=require(_0x86af('0xc'));var deskjs=require(_0x86af('0xd'));var toCsv=require('to-csv');var querystring=require(_0x86af('0xe'));var Papa=require('papaparse');var Redis=require(_0x86af('0xf'));var authService=require(_0x86af('0x10'));var qs=require(_0x86af('0x11'));var as=require(_0x86af('0x12'));var hardwareService=require(_0x86af('0x13'));var logger=require(_0x86af('0x14'))(_0x86af('0x15'));var utils=require('../../config/utils');var config=require(_0x86af('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c870b,_0x22ec55){_0x22ec55=_0x22ec55||0xcc;return function(_0x4be0ab){if(_0x4be0ab){return _0x3c870b[_0x86af('0x17')](_0x22ec55);}return _0x3c870b[_0x86af('0x18')](_0x22ec55)[_0x86af('0x19')]();};}function respondWithResult(_0xfd878,_0x2b563d){_0x2b563d=_0x2b563d||0xc8;return function(_0x46aa6b){if(_0x46aa6b){return _0xfd878[_0x86af('0x18')](_0x2b563d)['json'](_0x46aa6b);}};}function respondWithFilteredResult(_0x2a6ba1,_0x2205f9){return function(_0x44a5fa){if(_0x44a5fa){var _0x181da5=typeof _0x2205f9[_0x86af('0x1a')]===_0x86af('0x1b')&&typeof _0x2205f9['limit']===_0x86af('0x1b');var _0x36fb22=_0x44a5fa[_0x86af('0x1c')];var _0x90c30d=_0x181da5?0x0:_0x2205f9[_0x86af('0x1a')];var _0x5e7441=_0x181da5?_0x44a5fa[_0x86af('0x1c')]:_0x2205f9[_0x86af('0x1a')]+_0x2205f9['limit'];var _0x5f1c8c;if(_0x5e7441>=_0x36fb22){_0x5e7441=_0x36fb22;_0x5f1c8c=0xc8;}else{_0x5f1c8c=0xce;}_0x2a6ba1[_0x86af('0x18')](_0x5f1c8c);return _0x2a6ba1[_0x86af('0x1d')](_0x86af('0x1e'),_0x90c30d+'-'+_0x5e7441+'/'+_0x36fb22)['json'](_0x44a5fa);}return null;};}function patchUpdates(_0x2d5e8b){return function(_0x5e8271){try{jsonpatch['apply'](_0x5e8271,_0x2d5e8b,!![]);}catch(_0xe20753){return BPromise[_0x86af('0x1f')](_0xe20753);}return _0x5e8271['save']();};}function saveUpdates(_0x161bf8,_0x516902){return function(_0x17430b){if(_0x17430b){return _0x17430b[_0x86af('0x20')](_0x161bf8)[_0x86af('0x21')](function(_0x251a57){return _0x251a57;});}return null;};}function removeEntity(_0x5e83d7,_0x6aa612){return function(_0x1bb574){if(_0x1bb574){return _0x1bb574[_0x86af('0x22')]()[_0x86af('0x21')](function(){_0x5e83d7[_0x86af('0x18')](0xcc)[_0x86af('0x19')]();});}};}function handleEntityNotFound(_0x5565f6,_0x1ae07c){return function(_0x5961c8){if(!_0x5961c8){_0x5565f6[_0x86af('0x17')](0x194);}return _0x5961c8;};}function handleError(_0xd0eb7b,_0x5dae65){_0x5dae65=_0x5dae65||0x1f4;return function(_0x51b5a2){logger[_0x86af('0x23')](_0x51b5a2['stack']);if(_0x51b5a2[_0x86af('0x24')]){delete _0x51b5a2[_0x86af('0x24')];}_0xd0eb7b[_0x86af('0x18')](_0x5dae65)[_0x86af('0x25')](_0x51b5a2);};}exports[_0x86af('0x26')]=function(_0x44e322,_0x35f296){var _0x639b4d={},_0x13fa03={},_0x52c1a={'count':0x0,'rows':[]};var _0x2e64a8=_['map'](db[_0x86af('0x27')][_0x86af('0x28')],function(_0x4cd511){return{'name':_0x4cd511['fieldName'],'type':_0x4cd511[_0x86af('0x29')][_0x86af('0x2a')]};});_0x13fa03[_0x86af('0x2b')]=_[_0x86af('0x2c')](_0x2e64a8,_0x86af('0x24'));_0x13fa03['query']=_[_0x86af('0x2d')](_0x44e322[_0x86af('0x2e')]);_0x13fa03[_0x86af('0x2f')]=_[_0x86af('0x30')](_0x13fa03[_0x86af('0x2b')],_0x13fa03['query']);_0x639b4d['attributes']=_[_0x86af('0x30')](_0x13fa03[_0x86af('0x2b')],qs[_0x86af('0x31')](_0x44e322[_0x86af('0x2e')][_0x86af('0x31')]));_0x639b4d[_0x86af('0x32')]=_0x639b4d[_0x86af('0x32')][_0x86af('0x33')]?_0x639b4d[_0x86af('0x32')]:_0x13fa03[_0x86af('0x2b')];if(!_0x44e322[_0x86af('0x2e')][_0x86af('0x34')]('nolimit')){_0x639b4d[_0x86af('0x35')]=qs[_0x86af('0x35')](_0x44e322['query'][_0x86af('0x35')]);_0x639b4d[_0x86af('0x1a')]=qs[_0x86af('0x1a')](_0x44e322[_0x86af('0x2e')][_0x86af('0x1a')]);}_0x639b4d[_0x86af('0x36')]=qs[_0x86af('0x37')](_0x44e322[_0x86af('0x2e')][_0x86af('0x37')]);_0x639b4d['where']=qs['filters'](_[_0x86af('0x38')](_0x44e322[_0x86af('0x2e')],_0x13fa03[_0x86af('0x2f')]),_0x2e64a8);if(_0x44e322[_0x86af('0x2e')][_0x86af('0x39')]){_0x639b4d[_0x86af('0x3a')]=_[_0x86af('0x3b')](_0x639b4d['where'],{'$or':_[_0x86af('0x2c')](_0x2e64a8,function(_0x1c4294){if(_0x1c4294[_0x86af('0x29')]!==_0x86af('0x3c')){var _0x4627dc={};_0x4627dc[_0x1c4294[_0x86af('0x24')]]={'$like':'%'+_0x44e322[_0x86af('0x2e')]['filter']+'%'};return _0x4627dc;}})});}_0x639b4d=_[_0x86af('0x3b')]({},_0x639b4d,_0x44e322[_0x86af('0x3d')]);var _0xa78d94={'where':_0x639b4d[_0x86af('0x3a')]};return db[_0x86af('0x27')][_0x86af('0x1c')](_0xa78d94)[_0x86af('0x21')](function(_0x55a404){_0x52c1a[_0x86af('0x1c')]=_0x55a404;if(_0x44e322[_0x86af('0x2e')][_0x86af('0x3e')]){_0x639b4d[_0x86af('0x3f')]=[{'all':!![]}];}return db[_0x86af('0x27')]['findAll'](_0x639b4d);})[_0x86af('0x21')](function(_0x29d913){_0x52c1a[_0x86af('0x40')]=_0x29d913;return _0x52c1a;})['then'](respondWithFilteredResult(_0x35f296,_0x639b4d))[_0x86af('0x41')](handleError(_0x35f296,null));};exports[_0x86af('0x42')]=function(_0x5e6d74,_0x528df8){var _0x4c0e4d={'raw':!![],'where':{'id':_0x5e6d74[_0x86af('0x43')]['id']}},_0x2596f4={};_0x2596f4[_0x86af('0x2b')]=_[_0x86af('0x2d')](db[_0x86af('0x27')][_0x86af('0x28')]);_0x2596f4[_0x86af('0x2e')]=_[_0x86af('0x2d')](_0x5e6d74[_0x86af('0x2e')]);_0x2596f4[_0x86af('0x2f')]=_[_0x86af('0x30')](_0x2596f4[_0x86af('0x2b')],_0x2596f4['query']);_0x4c0e4d[_0x86af('0x32')]=_[_0x86af('0x30')](_0x2596f4[_0x86af('0x2b')],qs[_0x86af('0x31')](_0x5e6d74[_0x86af('0x2e')]['fields']));_0x4c0e4d[_0x86af('0x32')]=_0x4c0e4d['attributes']['length']?_0x4c0e4d[_0x86af('0x32')]:_0x2596f4[_0x86af('0x2b')];if(_0x5e6d74[_0x86af('0x2e')][_0x86af('0x3e')]){_0x4c0e4d[_0x86af('0x3f')]=[{'all':!![]}];}_0x4c0e4d=_[_0x86af('0x3b')]({},_0x4c0e4d,_0x5e6d74['options']);return db[_0x86af('0x27')][_0x86af('0x44')](_0x4c0e4d)[_0x86af('0x21')](handleEntityNotFound(_0x528df8,null))['then'](respondWithResult(_0x528df8,null))[_0x86af('0x41')](handleError(_0x528df8,null));};exports[_0x86af('0x45')]=function(_0x28f1a8,_0xb195a8){var _0x101e11={'where':{'id':_0x28f1a8[_0x86af('0x43')]['id']}},_0x210d7b={};_0x210d7b[_0x86af('0x2b')]=_['keys'](db[_0x86af('0x27')][_0x86af('0x28')]);_0x101e11[_0x86af('0x32')]=_['intersection'](_0x210d7b[_0x86af('0x2b')],qs[_0x86af('0x31')](_0x28f1a8[_0x86af('0x2e')][_0x86af('0x31')]));_0x101e11[_0x86af('0x32')]=_0x101e11['attributes'][_0x86af('0x33')]?_0x101e11['attributes']:_0x210d7b['model'];if(_0x28f1a8[_0x86af('0x2e')][_0x86af('0x3e')]){_0x101e11[_0x86af('0x3f')]=[{'all':!![]}];}_0x101e11=_['merge']({},_0x101e11,_0x28f1a8[_0x86af('0x3d')]);return db[_0x86af('0x27')][_0x86af('0x44')](_0x101e11)[_0x86af('0x21')](handleEntityNotFound(_0xb195a8,null))['then'](function(_0x1558b3){if(_0x1558b3){var _0x1d19a2=_0x1558b3[_0x86af('0x46')]({'plain':!![]});_0x1d19a2=qs[_0x86af('0x47')](_0x1d19a2,['id',_0x86af('0x48'),_0x86af('0x49')]);_0x28f1a8['body']=_[_0x86af('0x47')](_0x28f1a8[_0x86af('0x4a')],['id',_0x86af('0x48'),_0x86af('0x49')]);return db[_0x86af('0x27')][_0x86af('0x4b')](_[_0x86af('0x3b')](_0x1d19a2,_0x28f1a8[_0x86af('0x4a')]),{'include':_0x28f1a8['query'][_0x86af('0x3e')]?[{'all':!![]}]:undefined});}})[_0x86af('0x21')](respondWithResult(_0xb195a8,0xc9))[_0x86af('0x41')](handleError(_0xb195a8,null));};exports[_0x86af('0x20')]=function(_0x31d0f6,_0x573a96){if(_0x31d0f6[_0x86af('0x4a')]['id']){delete _0x31d0f6[_0x86af('0x4a')]['id'];}return db[_0x86af('0x27')][_0x86af('0x44')]({'where':{'id':_0x31d0f6['params']['id']}})[_0x86af('0x21')](handleEntityNotFound(_0x573a96,null))[_0x86af('0x21')](saveUpdates(_0x31d0f6[_0x86af('0x4a')],null))[_0x86af('0x21')](respondWithResult(_0x573a96,null))['catch'](handleError(_0x573a96,null));};exports[_0x86af('0x22')]=function(_0x1936e1,_0x239252){return db[_0x86af('0x27')][_0x86af('0x44')]({'where':{'id':_0x1936e1[_0x86af('0x43')]['id']}})[_0x86af('0x21')](handleEntityNotFound(_0x239252,null))[_0x86af('0x21')](removeEntity(_0x239252,null))[_0x86af('0x41')](handleError(_0x239252,null));};exports[_0x86af('0x4b')]=function(_0x474a23,_0x112355,_0xa4ba52){_0x474a23[_0x86af('0x4a')][_0x86af('0x24')]=_0x474a23[_0x86af('0x4c')]['originalname'];_0x474a23[_0x86af('0x4a')]['basename']=_0x474a23[_0x86af('0x4c')][_0x86af('0x4d')];_0x474a23[_0x86af('0x4a')][_0x86af('0x29')]=_0x474a23[_0x86af('0x4c')][_0x86af('0x4e')];return db['Attachment'][_0x86af('0x4b')](_0x474a23[_0x86af('0x4a')])[_0x86af('0x21')](respondWithResult(_0x112355,0xc9))[_0x86af('0x41')](handleError(_0x112355,null));};exports[_0x86af('0x4f')]=function(_0x21c61a,_0x309762,_0x38031d){return db[_0x86af('0x27')]['findOne']({'where':{'id':_0x21c61a[_0x86af('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x309762,null))['then'](function(_0x5be14a){if(_0x5be14a){var _0x3c3533=_0x5be14a[_0x86af('0x50')]!==null;var _0xe10bfd=path[_0x86af('0x51')](config['root'],'server/files/attachments/');if(_0x3c3533){_0xe10bfd=path[_0x86af('0x51')](_0xe10bfd,'offline-chat/');}var _0x1194b7=path[_0x86af('0x51')](_0xe10bfd,_0x5be14a[_0x86af('0x52')]);return _0x309762[_0x86af('0x4f')](_0x1194b7);}})[_0x86af('0x41')](handleError(_0x309762,null));}; \ No newline at end of file +var _0xbb06=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','show','params','include','options','catch','clone','find','get','omit','updatedAt','body','file','basename','filename','mimetype','create','findOne','root','server/files/attachments/','join','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x1a1a0f,_0x43e154){var _0x2c752c=function(_0x315785){while(--_0x315785){_0x1a1a0f['push'](_0x1a1a0f['shift']());}};_0x2c752c(++_0x43e154);}(_0xbb06,0xa0));var _0x6bb0=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xbb06[_0x46361e];return _0x14e302;};'use strict';var emlformat=require(_0x6bb0('0x0'));var rimraf=require(_0x6bb0('0x1'));var zipdir=require(_0x6bb0('0x2'));var jsonpatch=require(_0x6bb0('0x3'));var rp=require(_0x6bb0('0x4'));var moment=require('moment');var BPromise=require(_0x6bb0('0x5'));var Mustache=require(_0x6bb0('0x6'));var util=require('util');var path=require(_0x6bb0('0x7'));var sox=require(_0x6bb0('0x8'));var csv=require(_0x6bb0('0x9'));var ejs=require(_0x6bb0('0xa'));var fs=require('fs');var fs_extra=require(_0x6bb0('0xb'));var _=require(_0x6bb0('0xc'));var squel=require(_0x6bb0('0xd'));var crypto=require(_0x6bb0('0xe'));var jsforce=require(_0x6bb0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6bb0('0x9'));var querystring=require(_0x6bb0('0x10'));var Papa=require(_0x6bb0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bb0('0x12'))('api');var utils=require(_0x6bb0('0x13'));var config=require(_0x6bb0('0x14'));var licenseUtil=require(_0x6bb0('0x15'));var db=require(_0x6bb0('0x16'))['db'];function respondWithStatusCode(_0x3cef06,_0x3c383e){_0x3c383e=_0x3c383e||0xcc;return function(_0x5eb025){if(_0x5eb025){return _0x3cef06[_0x6bb0('0x17')](_0x3c383e);}return _0x3cef06[_0x6bb0('0x18')](_0x3c383e)[_0x6bb0('0x19')]();};}function respondWithResult(_0x54b620,_0x5c8f2a){_0x5c8f2a=_0x5c8f2a||0xc8;return function(_0x3d1a27){if(_0x3d1a27){return _0x54b620[_0x6bb0('0x18')](_0x5c8f2a)[_0x6bb0('0x1a')](_0x3d1a27);}};}function respondWithFilteredResult(_0x29d897,_0x460982){return function(_0x519d8c){if(_0x519d8c){var _0x490182=typeof _0x460982[_0x6bb0('0x1b')]===_0x6bb0('0x1c')&&typeof _0x460982['limit']===_0x6bb0('0x1c');var _0x53572c=_0x519d8c[_0x6bb0('0x1d')];var _0x4eb8f4=_0x490182?0x0:_0x460982[_0x6bb0('0x1b')];var _0x4da14e=_0x490182?_0x519d8c[_0x6bb0('0x1d')]:_0x460982['offset']+_0x460982[_0x6bb0('0x1e')];var _0x2dd59c;if(_0x4da14e>=_0x53572c){_0x4da14e=_0x53572c;_0x2dd59c=0xc8;}else{_0x2dd59c=0xce;}_0x29d897[_0x6bb0('0x18')](_0x2dd59c);return _0x29d897[_0x6bb0('0x1f')]('Content-Range',_0x4eb8f4+'-'+_0x4da14e+'/'+_0x53572c)[_0x6bb0('0x1a')](_0x519d8c);}return null;};}function patchUpdates(_0x12bafa){return function(_0x382770){try{jsonpatch[_0x6bb0('0x20')](_0x382770,_0x12bafa,!![]);}catch(_0x513df7){return BPromise[_0x6bb0('0x21')](_0x513df7);}return _0x382770[_0x6bb0('0x22')]();};}function saveUpdates(_0x4e3dcb,_0x46344b){return function(_0x332307){if(_0x332307){return _0x332307[_0x6bb0('0x23')](_0x4e3dcb)[_0x6bb0('0x24')](function(_0x30498d){return _0x30498d;});}return null;};}function removeEntity(_0x5c5379,_0x270611){return function(_0x42498a){if(_0x42498a){return _0x42498a['destroy']()[_0x6bb0('0x24')](function(){_0x5c5379[_0x6bb0('0x18')](0xcc)[_0x6bb0('0x19')]();});}};}function handleEntityNotFound(_0x290003,_0x5abe44){return function(_0x23526b){if(!_0x23526b){_0x290003[_0x6bb0('0x17')](0x194);}return _0x23526b;};}function handleError(_0x17e578,_0x18995b){_0x18995b=_0x18995b||0x1f4;return function(_0x34db11){logger[_0x6bb0('0x25')](_0x34db11[_0x6bb0('0x26')]);if(_0x34db11[_0x6bb0('0x27')]){delete _0x34db11[_0x6bb0('0x27')];}_0x17e578[_0x6bb0('0x18')](_0x18995b)[_0x6bb0('0x28')](_0x34db11);};}exports[_0x6bb0('0x29')]=function(_0x2c5294,_0x4061d6){var _0x8ec559={},_0x5afc25={},_0x308cdd={'count':0x0,'rows':[]};var _0x1b662d=_[_0x6bb0('0x2a')](db[_0x6bb0('0x2b')][_0x6bb0('0x2c')],function(_0x4237d9){return{'name':_0x4237d9[_0x6bb0('0x2d')],'type':_0x4237d9['type'][_0x6bb0('0x2e')]};});_0x5afc25[_0x6bb0('0x2f')]=_[_0x6bb0('0x2a')](_0x1b662d,_0x6bb0('0x27'));_0x5afc25[_0x6bb0('0x30')]=_[_0x6bb0('0x31')](_0x2c5294[_0x6bb0('0x30')]);_0x5afc25['filters']=_[_0x6bb0('0x32')](_0x5afc25['model'],_0x5afc25['query']);_0x8ec559['attributes']=_['intersection'](_0x5afc25[_0x6bb0('0x2f')],qs[_0x6bb0('0x33')](_0x2c5294[_0x6bb0('0x30')][_0x6bb0('0x33')]));_0x8ec559[_0x6bb0('0x34')]=_0x8ec559['attributes'][_0x6bb0('0x35')]?_0x8ec559[_0x6bb0('0x34')]:_0x5afc25[_0x6bb0('0x2f')];if(!_0x2c5294['query'][_0x6bb0('0x36')]('nolimit')){_0x8ec559[_0x6bb0('0x1e')]=qs[_0x6bb0('0x1e')](_0x2c5294['query']['limit']);_0x8ec559[_0x6bb0('0x1b')]=qs[_0x6bb0('0x1b')](_0x2c5294[_0x6bb0('0x30')][_0x6bb0('0x1b')]);}_0x8ec559['order']=qs[_0x6bb0('0x37')](_0x2c5294[_0x6bb0('0x30')][_0x6bb0('0x37')]);_0x8ec559[_0x6bb0('0x38')]=qs[_0x6bb0('0x39')](_[_0x6bb0('0x3a')](_0x2c5294['query'],_0x5afc25['filters']),_0x1b662d);if(_0x2c5294[_0x6bb0('0x30')][_0x6bb0('0x3b')]){_0x8ec559['where']=_[_0x6bb0('0x3c')](_0x8ec559[_0x6bb0('0x38')],{'$or':_[_0x6bb0('0x2a')](_0x1b662d,function(_0x3c9350){if(_0x3c9350[_0x6bb0('0x3d')]!==_0x6bb0('0x3e')){var _0x120f20={};_0x120f20[_0x3c9350[_0x6bb0('0x27')]]={'$like':'%'+_0x2c5294[_0x6bb0('0x30')][_0x6bb0('0x3b')]+'%'};return _0x120f20;}})});}_0x8ec559=_[_0x6bb0('0x3c')]({},_0x8ec559,_0x2c5294['options']);var _0x18296b={'where':_0x8ec559[_0x6bb0('0x38')]};return db[_0x6bb0('0x2b')][_0x6bb0('0x1d')](_0x18296b)['then'](function(_0x1e7793){_0x308cdd[_0x6bb0('0x1d')]=_0x1e7793;if(_0x2c5294['query'][_0x6bb0('0x3f')]){_0x8ec559['include']=[{'all':!![]}];}return db[_0x6bb0('0x2b')]['findAll'](_0x8ec559);})['then'](function(_0x281232){_0x308cdd['rows']=_0x281232;return _0x308cdd;})[_0x6bb0('0x24')](respondWithFilteredResult(_0x4061d6,_0x8ec559))['catch'](handleError(_0x4061d6,null));};exports[_0x6bb0('0x40')]=function(_0x181eb0,_0x42154d){var _0x158b27={'raw':!![],'where':{'id':_0x181eb0[_0x6bb0('0x41')]['id']}},_0x2e76fd={};_0x2e76fd[_0x6bb0('0x2f')]=_[_0x6bb0('0x31')](db[_0x6bb0('0x2b')][_0x6bb0('0x2c')]);_0x2e76fd[_0x6bb0('0x30')]=_[_0x6bb0('0x31')](_0x181eb0[_0x6bb0('0x30')]);_0x2e76fd[_0x6bb0('0x39')]=_[_0x6bb0('0x32')](_0x2e76fd['model'],_0x2e76fd['query']);_0x158b27['attributes']=_[_0x6bb0('0x32')](_0x2e76fd[_0x6bb0('0x2f')],qs[_0x6bb0('0x33')](_0x181eb0[_0x6bb0('0x30')][_0x6bb0('0x33')]));_0x158b27[_0x6bb0('0x34')]=_0x158b27[_0x6bb0('0x34')][_0x6bb0('0x35')]?_0x158b27[_0x6bb0('0x34')]:_0x2e76fd[_0x6bb0('0x2f')];if(_0x181eb0[_0x6bb0('0x30')][_0x6bb0('0x3f')]){_0x158b27[_0x6bb0('0x42')]=[{'all':!![]}];}_0x158b27=_['merge']({},_0x158b27,_0x181eb0[_0x6bb0('0x43')]);return db[_0x6bb0('0x2b')]['find'](_0x158b27)[_0x6bb0('0x24')](handleEntityNotFound(_0x42154d,null))[_0x6bb0('0x24')](respondWithResult(_0x42154d,null))[_0x6bb0('0x44')](handleError(_0x42154d,null));};exports[_0x6bb0('0x45')]=function(_0x4bafc0,_0x2d1ca8){var _0x1b924a={'where':{'id':_0x4bafc0[_0x6bb0('0x41')]['id']}},_0x911183={};_0x911183['model']=_['keys'](db['Attachment'][_0x6bb0('0x2c')]);_0x1b924a[_0x6bb0('0x34')]=_[_0x6bb0('0x32')](_0x911183[_0x6bb0('0x2f')],qs[_0x6bb0('0x33')](_0x4bafc0[_0x6bb0('0x30')]['fields']));_0x1b924a['attributes']=_0x1b924a['attributes']['length']?_0x1b924a[_0x6bb0('0x34')]:_0x911183['model'];if(_0x4bafc0[_0x6bb0('0x30')][_0x6bb0('0x3f')]){_0x1b924a[_0x6bb0('0x42')]=[{'all':!![]}];}_0x1b924a=_[_0x6bb0('0x3c')]({},_0x1b924a,_0x4bafc0[_0x6bb0('0x43')]);return db[_0x6bb0('0x2b')][_0x6bb0('0x46')](_0x1b924a)[_0x6bb0('0x24')](handleEntityNotFound(_0x2d1ca8,null))[_0x6bb0('0x24')](function(_0x2ff237){if(_0x2ff237){var _0x4965aa=_0x2ff237[_0x6bb0('0x47')]({'plain':!![]});_0x4965aa=qs[_0x6bb0('0x48')](_0x4965aa,['id','createdAt',_0x6bb0('0x49')]);_0x4bafc0[_0x6bb0('0x4a')]=_['omit'](_0x4bafc0['body'],['id','createdAt',_0x6bb0('0x49')]);return db[_0x6bb0('0x2b')]['create'](_[_0x6bb0('0x3c')](_0x4965aa,_0x4bafc0[_0x6bb0('0x4a')]),{'include':_0x4bafc0[_0x6bb0('0x30')][_0x6bb0('0x3f')]?[{'all':!![]}]:undefined});}})[_0x6bb0('0x24')](respondWithResult(_0x2d1ca8,0xc9))['catch'](handleError(_0x2d1ca8,null));};exports[_0x6bb0('0x23')]=function(_0x6950a4,_0x53771e){if(_0x6950a4[_0x6bb0('0x4a')]['id']){delete _0x6950a4[_0x6bb0('0x4a')]['id'];}return db[_0x6bb0('0x2b')][_0x6bb0('0x46')]({'where':{'id':_0x6950a4[_0x6bb0('0x41')]['id']}})[_0x6bb0('0x24')](handleEntityNotFound(_0x53771e,null))[_0x6bb0('0x24')](saveUpdates(_0x6950a4[_0x6bb0('0x4a')],null))[_0x6bb0('0x24')](respondWithResult(_0x53771e,null))['catch'](handleError(_0x53771e,null));};exports['destroy']=function(_0x57caf0,_0xd1b185){return db['Attachment'][_0x6bb0('0x46')]({'where':{'id':_0x57caf0[_0x6bb0('0x41')]['id']}})[_0x6bb0('0x24')](handleEntityNotFound(_0xd1b185,null))['then'](removeEntity(_0xd1b185,null))['catch'](handleError(_0xd1b185,null));};exports['create']=function(_0x4cb78c,_0x54440d,_0x14df2c){_0x4cb78c[_0x6bb0('0x4a')][_0x6bb0('0x27')]=_0x4cb78c[_0x6bb0('0x4b')]['originalname'];_0x4cb78c[_0x6bb0('0x4a')][_0x6bb0('0x4c')]=_0x4cb78c['file'][_0x6bb0('0x4d')];_0x4cb78c[_0x6bb0('0x4a')][_0x6bb0('0x3d')]=_0x4cb78c['file'][_0x6bb0('0x4e')];return db[_0x6bb0('0x2b')][_0x6bb0('0x4f')](_0x4cb78c['body'])[_0x6bb0('0x24')](respondWithResult(_0x54440d,0xc9))['catch'](handleError(_0x54440d,null));};exports['download']=function(_0x30b3ad,_0x5373fd,_0x1696f3){return db[_0x6bb0('0x2b')][_0x6bb0('0x50')]({'where':{'id':_0x30b3ad['params']['id']},'raw':!![]})[_0x6bb0('0x24')](handleEntityNotFound(_0x5373fd,null))[_0x6bb0('0x24')](function(_0xdcb4e7){if(_0xdcb4e7){var _0x32bc76=_0xdcb4e7['ChatOfflineMessageId']!==null;var _0x55679b=path['join'](config[_0x6bb0('0x51')],_0x6bb0('0x52'));if(_0x32bc76){_0x55679b=path[_0x6bb0('0x53')](_0x55679b,'offline-chat/');}var _0x42c7fe=path[_0x6bb0('0x53')](_0x55679b,_0xdcb4e7['basename']);return _0x5373fd[_0x6bb0('0x54')](_0x42c7fe);}})[_0x6bb0('0x44')](handleError(_0x5373fd,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 159d4c3..83b2c23 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 _0xe525=['../../config/logger','request-promise','path','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','util'];(function(_0x43ed13,_0x2b7693){var _0x4a3a37=function(_0x4e4cbb){while(--_0x4e4cbb){_0x43ed13['push'](_0x43ed13['shift']());}};_0x4a3a37(++_0x2b7693);}(_0xe525,0xc6));var _0x5e52=function(_0x4a81b9,_0x320e9c){_0x4a81b9=_0x4a81b9-0x0;var _0x40e1d3=_0xe525[_0x4a81b9];return _0x40e1d3;};'use strict';var _=require(_0x5e52('0x0'));var util=require(_0x5e52('0x1'));var logger=require(_0x5e52('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e52('0x3'));var fs=require('fs');var path=require(_0x5e52('0x4'));var rimraf=require('rimraf');var config=require(_0x5e52('0x5'));var attributes=require(_0x5e52('0x6'));module[_0x5e52('0x7')]=function(_0xcdb3a9,_0x3dc544){return _0xcdb3a9['define'](_0x5e52('0x8'),attributes,{'tableName':_0x5e52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cd7=['exports','../../config/logger','moment','bluebird','path','../../config/environment','./attachment.attributes'];(function(_0x414e3b,_0x326857){var _0x49b754=function(_0x33536c){while(--_0x33536c){_0x414e3b['push'](_0x414e3b['shift']());}};_0x49b754(++_0x326857);}(_0x9cd7,0xb0));var _0x79cd=function(_0x2dea58,_0x59d6f0){_0x2dea58=_0x2dea58-0x0;var _0x2b23c2=_0x9cd7[_0x2dea58];return _0x2b23c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79cd('0x0'))('api');var moment=require(_0x79cd('0x1'));var BPromise=require(_0x79cd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79cd('0x3'));var rimraf=require('rimraf');var config=require(_0x79cd('0x4'));var attributes=require(_0x79cd('0x5'));module[_0x79cd('0x6')]=function(_0x341bc3,_0x1b9628){return _0x341bc3['define']('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 726e163..d3af4fb 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 _0xee5b=['debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s'];(function(_0x39f364,_0x230572){var _0x295493=function(_0x48a360){while(--_0x48a360){_0x39f364['push'](_0x39f364['shift']());}};_0x295493(++_0x230572);}(_0xee5b,0x1f4));var _0xbee5=function(_0x49f1cf,_0x50e313){_0x49f1cf=_0x49f1cf-0x0;var _0x540043=_0xee5b[_0x49f1cf];return _0x540043;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('Attachment,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('Attachment,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')](_0x538460[_0xbee5('0x18')],{'raw':_0x538460[_0xbee5('0x19')]?_0x538460[_0xbee5('0x19')][_0xbee5('0x1a')]===undefined?!![]:![]:!![]})[_0xbee5('0xa')](function(_0x35d7d3){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger['debug']('CreateAttachment',_0x538460,JSON[_0xbee5('0x10')](_0x35d7d3));_0x3c3f4e(_0x35d7d3);})['catch'](function(_0x205491){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x205491[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x205491[_0xbee5('0x13')]));});});}; \ No newline at end of file +var _0x1bb2=['http','request','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','info','result','catch','CreateAttachment','create','body','options','raw','then','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x1bb2,0x152));var _0x21bb=function(_0x4bbbce,_0x370e89){_0x4bbbce=_0x4bbbce-0x0;var _0x3cffbc=_0x1bb2[_0x4bbbce];return _0x3cffbc;};'use strict';var _=require('lodash');var util=require(_0x21bb('0x0'));var moment=require(_0x21bb('0x1'));var BPromise=require(_0x21bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21bb('0x3'))['db'];var utils=require(_0x21bb('0x4'));var logger=require(_0x21bb('0x5'))(_0x21bb('0x6'));var config=require(_0x21bb('0x7'));var jayson=require(_0x21bb('0x8'));var client=jayson[_0x21bb('0x9')][_0x21bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36217b,_0x330447,_0x642998){return new BPromise(function(_0x316b77,_0x5af85f){return client[_0x21bb('0xb')](_0x36217b,_0x642998)['then'](function(_0x300c15){logger['info']('Attachment,\x20%s,\x20%s',_0x330447,_0x21bb('0xc'));logger[_0x21bb('0xd')](_0x21bb('0xe'),_0x330447,_0x21bb('0xc'),JSON[_0x21bb('0xf')](_0x300c15));if(_0x300c15[_0x21bb('0x10')]){if(_0x300c15[_0x21bb('0x10')][_0x21bb('0x11')]===0x1f4){logger['error'](_0x21bb('0x12'),_0x330447,_0x300c15[_0x21bb('0x10')]['message']);return _0x5af85f(_0x300c15[_0x21bb('0x10')][_0x21bb('0x13')]);}logger['error'](_0x21bb('0x12'),_0x330447,_0x300c15[_0x21bb('0x10')][_0x21bb('0x13')]);return _0x316b77(_0x300c15[_0x21bb('0x10')]['message']);}else{logger[_0x21bb('0x14')]('Attachment,\x20%s,\x20%s',_0x330447,'request\x20sent');_0x316b77(_0x300c15[_0x21bb('0x15')][_0x21bb('0x13')]);}})[_0x21bb('0x16')](function(_0x465f5e){logger[_0x21bb('0x10')](_0x21bb('0x12'),_0x330447,_0x465f5e);_0x5af85f(_0x465f5e);});});}exports[_0x21bb('0x17')]=function(_0x15fc36){var _0x4393d8=this;return new Promise(function(_0x17ee1d,_0x4699b0){return db['Attachment'][_0x21bb('0x18')](_0x15fc36[_0x21bb('0x19')],{'raw':_0x15fc36[_0x21bb('0x1a')]?_0x15fc36['options'][_0x21bb('0x1b')]===undefined?!![]:![]:!![]})[_0x21bb('0x1c')](function(_0x271a9f){logger[_0x21bb('0x14')](_0x21bb('0x17'),_0x15fc36);logger[_0x21bb('0xd')](_0x21bb('0x17'),_0x15fc36,JSON[_0x21bb('0xf')](_0x271a9f));_0x17ee1d(_0x271a9f);})[_0x21bb('0x16')](function(_0x3d4814){logger[_0x21bb('0x10')](_0x21bb('0x17'),_0x3d4814['message'],_0x15fc36);_0x4699b0(_0x4393d8[_0x21bb('0x10')](0x1f4,_0x3d4814[_0x21bb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 184a3ef..77392c0 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x184617,_0xa564e3){var _0x265d23=function(_0x50cfa2){while(--_0x50cfa2){_0x184617['push'](_0x184617['shift']());}};_0x265d23(++_0xa564e3);}(_0x2032,0xd9));var _0x2203=function(_0x3fcb16,_0x4a68b5){_0x3fcb16=_0x3fcb16-0x0;var _0x1ee4da=_0x2032[_0x3fcb16];return _0x1ee4da;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 639e2ab..deb1b58 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 _0xe7ce=['blockedAt','online','admin','user','agent','then','disabled','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport-local','Strategy','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','name','password','role','blocked'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0xe7ce,0x185));var _0xee7c=function(_0x4bc927,_0x25e1da){_0x4bc927=_0x4bc927-0x0;var _0x4f08a8=_0xe7ce[_0x4bc927];return _0x4f08a8;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xee7c('0x0'))[_0xee7c('0x1')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xee7c('0x2'));var util=require(_0xee7c('0x3'));var db=require(_0xee7c('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xee7c('0x5'));var config=require(_0xee7c('0x6'));var logger=require(_0xee7c('0x7'))(_0xee7c('0x8'));function isActiveDirectoryConfigured(_0x4e1813){var _0x10238f=![];if(typeof _0x4e1813[_0xee7c('0x9')]!==_0xee7c('0xa')){_0x10238f=_0x4e1813[_0xee7c('0x9')][_0xee7c('0xb')]&&_0x4e1813[_0xee7c('0x9')][_0xee7c('0xc')]&&_0x4e1813[_0xee7c('0x9')]['domain'];}return _0x10238f;}function adAuthenticate(_0x3fcf0a,_0x13e0da,_0x1d721b){return new BPromise(function(_0x4a93e4,_0x37833f){try{var _0x7b69fa=new ActiveDirectory(_0x3fcf0a);_0x7b69fa[_0xee7c('0xd')](_0x13e0da,_0x1d721b,function(_0x33b10e,_0x511045){if(_0x33b10e){logger[_0xee7c('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x13e0da,util[_0xee7c('0xf')](_0x33b10e,{'showHidden':![],'depth':null}));_0x37833f(_0xee7c('0x10'));}else if(!_0x511045){logger[_0xee7c('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x13e0da);_0x37833f(_0xee7c('0x10'));}else{_0x4a93e4(_0x511045);}});}catch(_0x5f44c6){_0x37833f(_0x5f44c6);}});}function ActiveDirectoryAuthenticate(_0x9ae5de,_0x355a1d,_0x21e5a2,_0x374984){var _0x4bd9d4,_0x1cdfcc;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xee7c('0x11'),_0x355a1d);return _0x374984(null,![],{'message':_0xee7c('0x10')});}return db['Setting'][_0xee7c('0x12')]({'where':{'id':0x1},'attributes':[_0xee7c('0x13'),_0xee7c('0x14')],'raw':!![]})['then'](function(_0x49e4f7){_0x4bd9d4=_0x49e4f7;if(!_0x4bd9d4[_0xee7c('0x13')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x355a1d);throw new Error(_0xee7c('0x10'));}return _0x9ae5de[_0xee7c('0x12')]({'attributes':['id',_0xee7c('0x15'),_0xee7c('0x16'),'salt',_0xee7c('0x17'),'disabled',_0xee7c('0x18'),_0xee7c('0x19'),_0xee7c('0x1a')],'where':{'name':_0x355a1d,'role':{'$or':[_0xee7c('0x1b'),_0xee7c('0x1c'),_0xee7c('0x1d')]},'adSsoEnabled':!![]}});})[_0xee7c('0x1e')](function(_0x2fbebd){if(!_0x2fbebd||_0x2fbebd&&_0x2fbebd[_0xee7c('0x15')]!==_0x355a1d){throw new Error(_0xee7c('0x10'));}_0x1cdfcc=_0x2fbebd;var _0x36c5e3=_0x1cdfcc[_0xee7c('0x15')]+'@'+config[_0xee7c('0x9')]['domain'];return adAuthenticate(config[_0xee7c('0x9')],_0x36c5e3,_0x21e5a2);})[_0xee7c('0x1e')](function(_0x5e1da5){if(_0x1cdfcc[_0xee7c('0x1f')]){throw new Error(_0xee7c('0x10'));}if(_0x4bd9d4[_0xee7c('0x14')]>0x0){if(_0x1cdfcc[_0xee7c('0x18')]){if(moment(_0x1cdfcc[_0xee7c('0x19')])[_0xee7c('0x20')](_0x4bd9d4[_0xee7c('0x14')],_0xee7c('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xee7c('0x22')](_0x1cdfcc,0x0,![],null)[_0xee7c('0x1e')](function(){return utils[_0xee7c('0x23')](_0x1cdfcc);})['then'](function(){return _0x374984(null,_0x1cdfcc);});}else{return utils['getLicense'](_0x1cdfcc)[_0xee7c('0x1e')](function(){return _0x374984(null,_0x1cdfcc);});}}else{return utils[_0xee7c('0x23')](_0x1cdfcc)[_0xee7c('0x1e')](function(){return _0x374984(null,_0x1cdfcc);});}})[_0xee7c('0x24')](function(_0x6686a6){return _0x374984(null,![],_0x6686a6);});}function handleError(_0x2da04a,_0x5213e2,_0x147b5c){return _0x2da04a[_0xee7c('0x25')](_0x5213e2||0x1f4)['send']({'message':_0x147b5c?_0x147b5c[_0xee7c('0x26')]||_0x147b5c:''});}exports[_0xee7c('0x27')]=function(_0x2cb1d1,_0x1f7dd4,_0x558b97){passport[_0xee7c('0xd')](_0xee7c('0x28'),function(_0x2ac5b1,_0x5d2ae2,_0x301255){var _0xce9272=_0x2ac5b1||_0x301255;if(_0xce9272){return handleError(_0x1f7dd4,0x191,_0xce9272);}if(!_0x5d2ae2){return handleError(_0x1f7dd4,0x194,{'message':_0xee7c('0x29')});}else{var _0x3127f2={'payload':{'id':_0x5d2ae2['id'],'role':_0x5d2ae2[_0xee7c('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0xee7c('0x2a')](_0x3127f2)['then'](function(_0x3dec9f){_0x1f7dd4[_0xee7c('0x2b')]({'id':_0x5d2ae2['id'],'token':_0x3dec9f,'statusCall':'','isAlreadyLogged':_0x5d2ae2[_0xee7c('0x1a')]});});}})(_0x2cb1d1,_0x1f7dd4,_0x558b97);};passport[_0xee7c('0x2c')](_0xee7c('0x28'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0xe524f0,_0x12d950,_0x31e520){return ActiveDirectoryAuthenticate(db[_0xee7c('0x2d')],_0xe524f0,_0x12d950,_0x31e520);})); \ No newline at end of file +var _0x6d67=['blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blocked','admin','user','agent','domain','blockedAt','minutes','clearBlockUser','getLicense','catch','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','url','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0x6d67,0xd5));var _0x76d6=function(_0x90f605,_0x446dbb){_0x90f605=_0x90f605-0x0;var _0x13abe4=_0x6d67[_0x90f605];return _0x13abe4;};'use strict';var passport=require(_0x76d6('0x0'));var LocalStrategy=require(_0x76d6('0x1'))['Strategy'];var moment=require(_0x76d6('0x2'));var ActiveDirectory=require(_0x76d6('0x3'));var BPromise=require(_0x76d6('0x4'));var util=require(_0x76d6('0x5'));var db=require(_0x76d6('0x6'))['db'];var authService=require(_0x76d6('0x7'));var utils=require(_0x76d6('0x8'));var config=require(_0x76d6('0x9'));var logger=require(_0x76d6('0xa'))('api');function isActiveDirectoryConfigured(_0x33f131){var _0x4eec23=![];if(typeof _0x33f131[_0x76d6('0xb')]!=='undefined'){_0x4eec23=_0x33f131[_0x76d6('0xb')][_0x76d6('0xc')]&&_0x33f131['activedirectory'][_0x76d6('0xd')]&&_0x33f131[_0x76d6('0xb')]['domain'];}return _0x4eec23;}function adAuthenticate(_0x281c49,_0x338483,_0x1d9fb2){return new BPromise(function(_0x27d39d,_0x2a9bb2){try{var _0x5d5a0b=new ActiveDirectory(_0x281c49);_0x5d5a0b['authenticate'](_0x338483,_0x1d9fb2,function(_0x4a8578,_0xe275b2){if(_0x4a8578){logger[_0x76d6('0xe')](_0x76d6('0xf'),_0x338483,util[_0x76d6('0x10')](_0x4a8578,{'showHidden':![],'depth':null}));_0x2a9bb2(_0x76d6('0x11'));}else if(!_0xe275b2){logger['error'](_0x76d6('0x12'),_0x338483);_0x2a9bb2(_0x76d6('0x11'));}else{_0x27d39d(_0xe275b2);}});}catch(_0x1076c5){_0x2a9bb2(_0x1076c5);}});}function ActiveDirectoryAuthenticate(_0x56e790,_0x487fe8,_0x230cea,_0x2ac0ae){var _0x3aa67b,_0x562c57;if(!isActiveDirectoryConfigured(config)){logger[_0x76d6('0xe')](_0x76d6('0x13'),_0x487fe8);return _0x2ac0ae(null,![],{'message':_0x76d6('0x11')});}return db['Setting'][_0x76d6('0x14')]({'where':{'id':0x1},'attributes':[_0x76d6('0x15'),_0x76d6('0x16')],'raw':!![]})[_0x76d6('0x17')](function(_0xeade72){_0x3aa67b=_0xeade72;if(!_0x3aa67b['adSsoEnabled']){logger['error'](_0x76d6('0x18'),_0x487fe8);throw new Error(_0x76d6('0x11'));}return _0x56e790[_0x76d6('0x14')]({'attributes':['id',_0x76d6('0x19'),_0x76d6('0x1a'),'salt',_0x76d6('0x1b'),_0x76d6('0x1c'),_0x76d6('0x1d'),'blockedAt','online'],'where':{'name':_0x487fe8,'role':{'$or':[_0x76d6('0x1e'),_0x76d6('0x1f'),_0x76d6('0x20')]},'adSsoEnabled':!![]}});})[_0x76d6('0x17')](function(_0x2d3bdc){if(!_0x2d3bdc||_0x2d3bdc&&_0x2d3bdc[_0x76d6('0x19')]!==_0x487fe8){throw new Error(_0x76d6('0x11'));}_0x562c57=_0x2d3bdc;var _0x54b644=_0x562c57['name']+'@'+config[_0x76d6('0xb')][_0x76d6('0x21')];return adAuthenticate(config[_0x76d6('0xb')],_0x54b644,_0x230cea);})['then'](function(_0x1922ce){if(_0x562c57[_0x76d6('0x1c')]){throw new Error(_0x76d6('0x11'));}if(_0x3aa67b[_0x76d6('0x16')]>0x0){if(_0x562c57['blocked']){if(moment(_0x562c57[_0x76d6('0x22')])['add'](_0x3aa67b[_0x76d6('0x16')],_0x76d6('0x23'))>moment()){throw new Error(_0x76d6('0x11'));}return utils[_0x76d6('0x24')](_0x562c57,0x0,![],null)['then'](function(){return utils[_0x76d6('0x25')](_0x562c57);})[_0x76d6('0x17')](function(){return _0x2ac0ae(null,_0x562c57);});}else{return utils[_0x76d6('0x25')](_0x562c57)[_0x76d6('0x17')](function(){return _0x2ac0ae(null,_0x562c57);});}}else{return utils[_0x76d6('0x25')](_0x562c57)[_0x76d6('0x17')](function(){return _0x2ac0ae(null,_0x562c57);});}})[_0x76d6('0x26')](function(_0x2b1ab6){return _0x2ac0ae(null,![],_0x2b1ab6);});}function handleError(_0x56d614,_0x4a644b,_0x1248fe){return _0x56d614['status'](_0x4a644b||0x1f4)[_0x76d6('0x27')]({'message':_0x1248fe?_0x1248fe[_0x76d6('0x28')]||_0x1248fe:''});}exports[_0x76d6('0x29')]=function(_0xf025cc,_0x98fd88,_0x3bab60){passport[_0x76d6('0x2a')](_0x76d6('0x2b'),function(_0x174524,_0xc248d0,_0x38e2d0){var _0x457b1f=_0x174524||_0x38e2d0;if(_0x457b1f){return handleError(_0x98fd88,0x191,_0x457b1f);}if(!_0xc248d0){return handleError(_0x98fd88,0x194,{'message':_0x76d6('0x2c')});}else{var _0x2be67c={'payload':{'id':_0xc248d0['id'],'role':_0xc248d0[_0x76d6('0x1b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2be67c)['then'](function(_0x36f71b){_0x98fd88['json']({'id':_0xc248d0['id'],'token':_0x36f71b,'statusCall':'','isAlreadyLogged':_0xc248d0['online']});});}})(_0xf025cc,_0x98fd88,_0x3bab60);};passport[_0x76d6('0x2d')](_0x76d6('0x2b'),new LocalStrategy({'usernameField':_0x76d6('0x19'),'passwordField':_0x76d6('0x1a')},function(_0x391b87,_0x41382f,_0x23e647){return ActiveDirectoryAuthenticate(db[_0x76d6('0x2e')],_0x391b87,_0x41382f,_0x23e647);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index ad7728e..4487d96 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 _0x636e=['exports','express','Router','login'];(function(_0x31c6ca,_0x5b37b3){var _0x1b5088=function(_0x3c840b){while(--_0x3c840b){_0x31c6ca['push'](_0x31c6ca['shift']());}};_0x1b5088(++_0x5b37b3);}(_0x636e,0x95));var _0xe636=function(_0x5e00d9,_0x16319b){_0x5e00d9=_0x5e00d9-0x0;var _0x3f53d1=_0x636e[_0x5e00d9];return _0x3f53d1;};'use strict';var express=require(_0xe636('0x0'));var router=express[_0xe636('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xe636('0x2')]);module[_0xe636('0x3')]=router; \ No newline at end of file +var _0x1a40=['Router','./authActiveDirectory.controller','exports'];(function(_0x92d580,_0x4928fb){var _0x4ee344=function(_0x55aa0c){while(--_0x55aa0c){_0x92d580['push'](_0x92d580['shift']());}};_0x4ee344(++_0x4928fb);}(_0x1a40,0x1a7));var _0x01a4=function(_0x523032,_0x13e2af){_0x523032=_0x523032-0x0;var _0x5588f9=_0x1a40[_0x523032];return _0x5588f9;};'use strict';var express=require('express');var router=express[_0x01a4('0x0')]();var controller=require(_0x01a4('0x1'));router['post']('/',controller['login']);module[_0x01a4('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 45fd515..24e1c28 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(_0x5d88da,_0x43b964){var _0x4391bb=function(_0x449ac4){while(--_0x449ac4){_0x5d88da['push'](_0x5d88da['shift']());}};_0x4391bb(++_0x43b964);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 _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(_0x2d775e,_0x4c0165){var _0x47e959=function(_0x558ee4){while(--_0x558ee4){_0x2d775e['push'](_0x2d775e['shift']());}};_0x47e959(++_0x4c0165);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index ea26d72..3931c84 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 _0xffcc=['setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','get','callback','login'];(function(_0x3110b8,_0x1e54b1){var _0xd41d04=function(_0x1eb317){while(--_0x1eb317){_0x3110b8['push'](_0x3110b8['shift']());}};_0xd41d04(++_0x1e54b1);}(_0xffcc,0x112));var _0xcffc=function(_0x210e2b,_0x377c45){_0x210e2b=_0x210e2b-0x0;var _0x5e1dbc=_0xffcc[_0x210e2b];return _0x5e1dbc;};'use strict';var express=require('express');var passport=require(_0xcffc('0x0'));var router=express['Router']();var controller=require(_0xcffc('0x1'));var userController=require(_0xcffc('0x2'));var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0xcffc('0x3')]('/callback',controller[_0xcffc('0x4')],authService['isMiddleware'],userController[_0xcffc('0x5')],authService[_0xcffc('0x6')]);module[_0xcffc('0x7')]=router; \ No newline at end of file +var _0x64b0=['passport','Router','../../components/auth/service','get','/callback','isMiddleware','login','exports','express'];(function(_0x5bad83,_0x5c216d){var _0x1bddfd=function(_0x236e94){while(--_0x236e94){_0x5bad83['push'](_0x5bad83['shift']());}};_0x1bddfd(++_0x5c216d);}(_0x64b0,0x74));var _0x064b=function(_0x45f622,_0x21020b){_0x45f622=_0x45f622-0x0;var _0x27bbfb=_0x64b0[_0x45f622];return _0x27bbfb;};'use strict';var express=require(_0x064b('0x0'));var passport=require(_0x064b('0x1'));var router=express[_0x064b('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x064b('0x3'));router[_0x064b('0x4')]('/',controller['login']);router[_0x064b('0x4')](_0x064b('0x5'),controller['callback'],authService[_0x064b('0x6')],userController[_0x064b('0x7')],authService['setTokenCookie']);module[_0x064b('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 5dfb9a3..245a5bc 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 _0x6e2b=['../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','clearBlockUser','add','minutes','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','online','forgot','body','generate','trim','toLowerCase','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','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','send','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment'];(function(_0x4e3e19,_0x555547){var _0xd3384d=function(_0x18b1d0){while(--_0x18b1d0){_0x4e3e19['push'](_0x4e3e19['shift']());}};_0xd3384d(++_0x555547);}(_0x6e2b,0x9e));var _0xb6e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e2b[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xb6e2('0x0'));var passport=require(_0xb6e2('0x1'));var LocalStrategy=require(_0xb6e2('0x2'))[_0xb6e2('0x3')];var jayson=require(_0xb6e2('0x4'));var _=require(_0xb6e2('0x5'));var rs=require(_0xb6e2('0x6'));var moment=require(_0xb6e2('0x7'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xb6e2('0x8'));var client=jayson[_0xb6e2('0x9')][_0xb6e2('0xa')]({'port':0x232b});function localAuthenticate(_0x1e7c90,_0x40492f,_0x57c2bb,_0x5d157f){var _0x58babb,_0x58b123;return db[_0xb6e2('0xb')][_0xb6e2('0xc')]({'where':{'id':0x1},'attributes':[_0xb6e2('0xd'),_0xb6e2('0xe')],'raw':!![]})[_0xb6e2('0xf')](function(_0x205de8){_0x58babb=_0x205de8;return _0x1e7c90[_0xb6e2('0xc')]({'attributes':['id',_0xb6e2('0x10'),_0xb6e2('0x11'),_0xb6e2('0x12'),'role','disabled',_0xb6e2('0x13'),_0xb6e2('0x14'),_0xb6e2('0x15')],'where':{'name':_0x40492f,'role':{'$or':[_0xb6e2('0x16'),_0xb6e2('0x17'),'agent']}}});})['then'](function(_0xfbb0f9){if(!_0xfbb0f9||_0xfbb0f9&&_0xfbb0f9[_0xb6e2('0x10')]!==_0x40492f){throw new Error(_0xb6e2('0x18'));}else{_0x58b123=_0xfbb0f9;return _0x58b123;}})[_0xb6e2('0xf')](function(){_0x58b123[_0xb6e2('0x19')](_0x57c2bb,function(_0x5966c8,_0x4ff9ea){var _0x40133b=_0x58b123['loginAttempts']+0x1;if(_0x5966c8){return _0x5d157f(_0x5966c8);}else if(!_0x4ff9ea){if(_0x58b123[_0xb6e2('0x1a')]){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else if(_0x58babb[_0xb6e2('0xd')]>0x0){if(_0x58b123[_0xb6e2('0x13')]){if(_0x58babb[_0xb6e2('0xe')]>0x0){if(moment(_0x58b123[_0xb6e2('0x14')])['add'](_0x58babb[_0xb6e2('0xe')],'minutes')>moment()){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else{return utils[_0xb6e2('0x1b')](_0x58b123,_0x40133b,![],null)[_0xb6e2('0xf')](function(){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});});}}else{return _0x5d157f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x40133b>=_0x58babb[_0xb6e2('0xd')]){return utils[_0xb6e2('0x1b')](_0x58b123,0x0,!![],moment())[_0xb6e2('0xf')](function(){return _0x5d157f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xb6e2('0x1b')](_0x58b123,_0x40133b,![],null)[_0xb6e2('0xf')](function(){return _0x5d157f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}}else{if(_0x58b123[_0xb6e2('0x1a')]){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else if(_0x58babb['allowedLoginAttempts']>0x0){if(_0x58b123[_0xb6e2('0x13')]){if(_0x58babb['blockDuration']>0x0){if(moment(_0x58b123[_0xb6e2('0x14')])[_0xb6e2('0x1c')](_0x58babb[_0xb6e2('0xe')],_0xb6e2('0x1d'))>moment()){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else{return utils['clearBlockUser'](_0x58b123,0x0,![],null)[_0xb6e2('0xf')](function(){return utils[_0xb6e2('0x1e')](_0x58b123);})[_0xb6e2('0xf')](function(){return _0x5d157f(null,_0x58b123);});}}else{return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}}else{return utils[_0xb6e2('0x1b')](_0x58b123,0x0,![],null)['then'](function(){return utils['getLicense'](_0x58b123);})[_0xb6e2('0xf')](function(){return _0x5d157f(null,_0x58b123);})[_0xb6e2('0x1f')](function(_0x53dd4d){return _0x5d157f(null,![],_0x53dd4d);});}}else{if(_0x58b123[_0xb6e2('0x13')]){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else{return utils[_0xb6e2('0x1e')](_0x58b123)[_0xb6e2('0xf')](function(){return _0x5d157f(null,_0x58b123);});}}}});})[_0xb6e2('0x1f')](function(_0x4e5dc7){return _0x5d157f(null,![],_0x4e5dc7);});}function sendServiceMail(_0x57811e){return db['MailAccount'][_0xb6e2('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xb6e2('0x21')],'include':[{'model':db[_0xb6e2('0x22')],'as':_0xb6e2('0x23'),'include':[{'model':db[_0xb6e2('0x24')],'as':_0xb6e2('0x24')}]}]})[_0xb6e2('0xf')](function(_0x78999a){if(!_0x78999a){throw new Error(_0xb6e2('0x25'));}var _0x34617f=_0x78999a[_0xb6e2('0x26')]();var _0x562fbf={'account':_0x34617f,'message':_['merge']({'from':util[_0xb6e2('0x27')](_0xb6e2('0x28'),_0x78999a[_0xb6e2('0x10')],_0x78999a[_0xb6e2('0x21')]||_0x78999a[_0xb6e2('0x23')][_0xb6e2('0x17')])},_0x57811e)};return client[_0xb6e2('0x29')](_0xb6e2('0x2a'),_0x562fbf);})[_0xb6e2('0xf')](function(_0x1f74f7){if(_0x1f74f7['error']){throw new Error(util[_0xb6e2('0x27')](_0xb6e2('0x2b'),_0x1f74f7[_0xb6e2('0x2c')][_0xb6e2('0x2d')]||JSON[_0xb6e2('0x2e')](_0x1f74f7[_0xb6e2('0x2c')])));}return!![];});}function handleError(_0x55d8e4,_0x557a0c,_0x487b06){return _0x55d8e4['status'](_0x557a0c||0x1f4)['send']({'message':_0x487b06?_0x487b06['message']||_0x487b06:''});}exports['login']=function(_0x44a5c4,_0x2a1cf8,_0x36aeb5){passport['authenticate'](_0xb6e2('0x2f'),function(_0xa83fd6,_0xf1f785,_0x334d47){var _0x178573=_0xa83fd6||_0x334d47;if(_0x178573){return handleError(_0x2a1cf8,0x191,_0x178573);}if(!_0xf1f785){return handleError(_0x2a1cf8,0x194,{'message':_0xb6e2('0x30')});}else{var _0x2e030c={'payload':{'id':_0xf1f785['id'],'role':_0xf1f785[_0xb6e2('0x31')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2e030c)[_0xb6e2('0xf')](function(_0x60d3e){_0x2a1cf8['json']({'id':_0xf1f785['id'],'token':_0x60d3e,'statusCall':'','isAlreadyLogged':_0xf1f785[_0xb6e2('0x32')]});});}})(_0x44a5c4,_0x2a1cf8,_0x36aeb5);};exports[_0xb6e2('0x33')]=function(_0x41c1a2,_0x286c29){if(!_0x41c1a2[_0xb6e2('0x34')]['email']){return handleError(_0x286c29,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x11fe3d=rs[_0xb6e2('0x35')]();_0x41c1a2[_0xb6e2('0x34')][_0xb6e2('0x21')]=_0x41c1a2[_0xb6e2('0x34')][_0xb6e2('0x21')][_0xb6e2('0x36')]()[_0xb6e2('0x37')]();var _0x504b9e;return db[_0xb6e2('0xb')][_0xb6e2('0xc')]({'where':{'id':0x1},'attributes':[_0xb6e2('0xd'),_0xb6e2('0xe')],'raw':!![]})['then'](function(_0x1f3090){_0x504b9e=_0x1f3090;return db['User']['find']({'where':{'email':_0x41c1a2['body']['email']}});})[_0xb6e2('0xf')](function(_0x114b2e){if(!_0x114b2e){throw new Error(_0xb6e2('0x38'));}if(_0x114b2e['disabled']){throw new Error(_0xb6e2('0x39'));}if(_0x114b2e[_0xb6e2('0x13')]){if(moment(_0x114b2e[_0xb6e2('0x14')])[_0xb6e2('0x1c')](_0x504b9e[_0xb6e2('0xe')],'minutes')>moment()){throw new Error(_0xb6e2('0x3a'));}else{_0x114b2e[_0xb6e2('0x13')]=![];_0x114b2e[_0xb6e2('0x14')]=null;}}_0x114b2e[_0xb6e2('0x3b')]=_0x11fe3d;_0x114b2e[_0xb6e2('0x3c')]=Date[_0xb6e2('0x3d')]()+0x36ee80;return _0x114b2e[_0xb6e2('0x3e')]();})[_0xb6e2('0xf')](function(){return sendServiceMail({'to':_0x41c1a2[_0xb6e2('0x34')][_0xb6e2('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xb6e2('0x3f')+_0xb6e2('0x40')+_0x41c1a2[_0xb6e2('0x41')][_0xb6e2('0x42')]+'/reset/'+_0x11fe3d+'\x0a\x0a'+_0xb6e2('0x43')});})[_0xb6e2('0xf')](function(){_0x286c29[_0xb6e2('0x44')](0xc8)[_0xb6e2('0x45')]({'message':_0xb6e2('0x46')});})['catch'](function(_0x544e5f){return handleError(_0x286c29,0x1f4,_0x544e5f);});};exports[_0xb6e2('0x47')]=function(_0x27434a,_0x118945){return db[_0xb6e2('0x48')][_0xb6e2('0x20')]({'where':{'resetPasswordToken':_0x27434a[_0xb6e2('0x49')][_0xb6e2('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xb6e2('0x3d')]()}}})[_0xb6e2('0xf')](function(_0x1a2ff9){if(!_0x1a2ff9){throw new Error(_0xb6e2('0x4b'));}return db[_0xb6e2('0xb')]['findOne']({'attributes':['id',_0xb6e2('0x4c'),_0xb6e2('0x4d'),_0xb6e2('0x4e')]})[_0xb6e2('0xf')](function(_0xe7e144){if(_0xe7e144[_0xb6e2('0x4c')])authService['validatePasswordPattern'](_0x27434a[_0xb6e2('0x34')][_0xb6e2('0x11')]);if(!_0xe7e144[_0xb6e2('0x4d')]||!_0x1a2ff9[_0xb6e2('0x4f')])return _0x1a2ff9;authService[_0xb6e2('0x50')](_0x27434a['body'][_0xb6e2('0x11')],_0x1a2ff9['previousPasswords'],_0xe7e144[_0xb6e2('0x4e')]);return _0x1a2ff9;})[_0xb6e2('0xf')](function(){_0x1a2ff9[_0xb6e2('0x11')]=_0x27434a[_0xb6e2('0x34')][_0xb6e2('0x11')];_0x1a2ff9['resetPasswordToken']=null;_0x1a2ff9['resetPasswordExpires']=null;return _0x1a2ff9['save']();});})[_0xb6e2('0xf')](function(){_0x118945[_0xb6e2('0x44')](0xc8)['send']({'message':_0xb6e2('0x51')});})['catch'](function(_0x2189cf){return handleError(_0x118945,0x1f4,_0x2189cf);});};passport[_0xb6e2('0x52')](_0xb6e2('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':_0xb6e2('0x11')},function(_0x193bdd,_0x2802e8,_0x17cd27){return localAuthenticate(db[_0xb6e2('0x48')],_0x193bdd,_0x2802e8,_0x17cd27);})); \ No newline at end of file +var _0xcc64=['request','SendMail','error','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','generate','body','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','/reset/','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','Password\x20reset!','util','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','blockDuration','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','format'];(function(_0x2db63a,_0x52ee8e){var _0x556b91=function(_0x4ad3aa){while(--_0x4ad3aa){_0x2db63a['push'](_0x2db63a['shift']());}};_0x556b91(++_0x52ee8e);}(_0xcc64,0x1da));var _0x4cc6=function(_0x2a6600,_0x34ffbd){_0x2a6600=_0x2a6600-0x0;var _0x1bc831=_0xcc64[_0x2a6600];return _0x1bc831;};'use strict';var util=require(_0x4cc6('0x0'));var passport=require(_0x4cc6('0x1'));var LocalStrategy=require('passport-local')[_0x4cc6('0x2')];var jayson=require(_0x4cc6('0x3'));var _=require(_0x4cc6('0x4'));var rs=require(_0x4cc6('0x5'));var moment=require(_0x4cc6('0x6'));var db=require(_0x4cc6('0x7'))['db'];var authService=require(_0x4cc6('0x8'));var utils=require(_0x4cc6('0x9'));var client=jayson[_0x4cc6('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x1796c7,_0x2ee369,_0x426d95,_0x5c27d6){var _0x2ac2c1,_0x2f7361;return db[_0x4cc6('0xb')][_0x4cc6('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x4cc6('0xd')],'raw':!![]})[_0x4cc6('0xe')](function(_0x23c6e5){_0x2ac2c1=_0x23c6e5;return _0x1796c7[_0x4cc6('0xc')]({'attributes':['id',_0x4cc6('0xf'),_0x4cc6('0x10'),'salt',_0x4cc6('0x11'),_0x4cc6('0x12'),_0x4cc6('0x13'),_0x4cc6('0x14'),_0x4cc6('0x15')],'where':{'name':_0x2ee369,'role':{'$or':[_0x4cc6('0x16'),_0x4cc6('0x17'),'agent']}}});})[_0x4cc6('0xe')](function(_0x529129){if(!_0x529129||_0x529129&&_0x529129['name']!==_0x2ee369){throw new Error(_0x4cc6('0x18'));}else{_0x2f7361=_0x529129;return _0x2f7361;}})[_0x4cc6('0xe')](function(){_0x2f7361['authenticate'](_0x426d95,function(_0x266a8a,_0x4d0c69){var _0x292523=_0x2f7361[_0x4cc6('0x15')]+0x1;if(_0x266a8a){return _0x5c27d6(_0x266a8a);}else if(!_0x4d0c69){if(_0x2f7361[_0x4cc6('0x12')]){return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});}else if(_0x2ac2c1[_0x4cc6('0x19')]>0x0){if(_0x2f7361['blocked']){if(_0x2ac2c1[_0x4cc6('0xd')]>0x0){if(moment(_0x2f7361[_0x4cc6('0x14')])[_0x4cc6('0x1a')](_0x2ac2c1['blockDuration'],_0x4cc6('0x1b'))>moment()){return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});}else{return utils[_0x4cc6('0x1c')](_0x2f7361,_0x292523,![],null)[_0x4cc6('0xe')](function(){return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});});}}else{return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});}}else{if(_0x292523>=_0x2ac2c1[_0x4cc6('0x19')]){return utils[_0x4cc6('0x1c')](_0x2f7361,0x0,!![],moment())['then'](function(){return _0x5c27d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x4cc6('0x1c')](_0x2f7361,_0x292523,![],null)[_0x4cc6('0xe')](function(){return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});});}}}else{return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});}}else{if(_0x2f7361[_0x4cc6('0x12')]){return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});}else if(_0x2ac2c1['allowedLoginAttempts']>0x0){if(_0x2f7361[_0x4cc6('0x13')]){if(_0x2ac2c1['blockDuration']>0x0){if(moment(_0x2f7361[_0x4cc6('0x14')])['add'](_0x2ac2c1[_0x4cc6('0xd')],_0x4cc6('0x1b'))>moment()){return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});}else{return utils[_0x4cc6('0x1c')](_0x2f7361,0x0,![],null)['then'](function(){return utils[_0x4cc6('0x1d')](_0x2f7361);})[_0x4cc6('0xe')](function(){return _0x5c27d6(null,_0x2f7361);});}}else{return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});}}else{return utils[_0x4cc6('0x1c')](_0x2f7361,0x0,![],null)[_0x4cc6('0xe')](function(){return utils[_0x4cc6('0x1d')](_0x2f7361);})[_0x4cc6('0xe')](function(){return _0x5c27d6(null,_0x2f7361);})['catch'](function(_0x4b23e0){return _0x5c27d6(null,![],_0x4b23e0);});}}else{if(_0x2f7361[_0x4cc6('0x13')]){return _0x5c27d6(null,![],{'message':_0x4cc6('0x18')});}else{return utils[_0x4cc6('0x1d')](_0x2f7361)['then'](function(){return _0x5c27d6(null,_0x2f7361);});}}}});})[_0x4cc6('0x1e')](function(_0x6a2586){return _0x5c27d6(null,![],_0x6a2586);});}function sendServiceMail(_0x4b1c5f){return db['MailAccount'][_0x4cc6('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x4cc6('0xf'),_0x4cc6('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x4cc6('0x21'),'include':[{'model':db[_0x4cc6('0x22')],'as':'CloudProvider'}]}]})[_0x4cc6('0xe')](function(_0x44932a){if(!_0x44932a){throw new Error(_0x4cc6('0x23'));}var _0x4b25c8=_0x44932a['getSmtpOptions']();var _0x14dc5c={'account':_0x4b25c8,'message':_['merge']({'from':util[_0x4cc6('0x24')]('\x22%s\x22\x20<%s>',_0x44932a[_0x4cc6('0xf')],_0x44932a[_0x4cc6('0x20')]||_0x44932a[_0x4cc6('0x21')]['user'])},_0x4b1c5f)};return client[_0x4cc6('0x25')](_0x4cc6('0x26'),_0x14dc5c);})['then'](function(_0x1166c9){if(_0x1166c9[_0x4cc6('0x27')]){throw new Error(util[_0x4cc6('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1166c9[_0x4cc6('0x27')][_0x4cc6('0x28')]||JSON[_0x4cc6('0x29')](_0x1166c9['error'])));}return!![];});}function handleError(_0x47bdc3,_0x51d9ff,_0x2c1bce){return _0x47bdc3[_0x4cc6('0x2a')](_0x51d9ff||0x1f4)[_0x4cc6('0x2b')]({'message':_0x2c1bce?_0x2c1bce[_0x4cc6('0x28')]||_0x2c1bce:''});}exports['login']=function(_0x47e76d,_0x2f40e0,_0x48e3d6){passport['authenticate'](_0x4cc6('0x2c'),function(_0x482472,_0x4183b9,_0xc25b99){var _0xc32705=_0x482472||_0xc25b99;if(_0xc32705){return handleError(_0x2f40e0,0x191,_0xc32705);}if(!_0x4183b9){return handleError(_0x2f40e0,0x194,{'message':_0x4cc6('0x2d')});}else{var _0x17c21b={'payload':{'id':_0x4183b9['id'],'role':_0x4183b9[_0x4cc6('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x4cc6('0x2e')](_0x17c21b)[_0x4cc6('0xe')](function(_0x6b119){_0x2f40e0['json']({'id':_0x4183b9['id'],'token':_0x6b119,'statusCall':'','isAlreadyLogged':_0x4183b9['online']});});}})(_0x47e76d,_0x2f40e0,_0x48e3d6);};exports[_0x4cc6('0x2f')]=function(_0x542c07,_0x441dff){if(!_0x542c07['body'][_0x4cc6('0x20')]){return handleError(_0x441dff,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x106c31=rs[_0x4cc6('0x30')]();_0x542c07[_0x4cc6('0x31')][_0x4cc6('0x20')]=_0x542c07[_0x4cc6('0x31')][_0x4cc6('0x20')]['trim']()['toLowerCase']();var _0x25a0bb;return db[_0x4cc6('0xb')][_0x4cc6('0xc')]({'where':{'id':0x1},'attributes':[_0x4cc6('0x19'),_0x4cc6('0xd')],'raw':!![]})['then'](function(_0x28d9dc){_0x25a0bb=_0x28d9dc;return db[_0x4cc6('0x32')][_0x4cc6('0x1f')]({'where':{'email':_0x542c07[_0x4cc6('0x31')]['email']}});})[_0x4cc6('0xe')](function(_0x52063b){if(!_0x52063b){throw new Error(_0x4cc6('0x33'));}if(_0x52063b[_0x4cc6('0x12')]){throw new Error(_0x4cc6('0x34'));}if(_0x52063b['blocked']){if(moment(_0x52063b[_0x4cc6('0x14')])['add'](_0x25a0bb[_0x4cc6('0xd')],'minutes')>moment()){throw new Error(_0x4cc6('0x35'));}else{_0x52063b['blocked']=![];_0x52063b[_0x4cc6('0x14')]=null;}}_0x52063b[_0x4cc6('0x36')]=_0x106c31;_0x52063b[_0x4cc6('0x37')]=Date['now']()+0x36ee80;return _0x52063b[_0x4cc6('0x38')]();})[_0x4cc6('0xe')](function(){return sendServiceMail({'to':_0x542c07[_0x4cc6('0x31')]['email'],'subject':_0x4cc6('0x39'),'text':_0x4cc6('0x3a')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x4cc6('0x3b')+_0x542c07['headers']['host']+_0x4cc6('0x3c')+_0x106c31+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x4cc6('0xe')](function(){_0x441dff[_0x4cc6('0x2a')](0xc8)['send']({'message':_0x4cc6('0x3d')});})[_0x4cc6('0x1e')](function(_0x4f6b72){return handleError(_0x441dff,0x1f4,_0x4f6b72);});};exports[_0x4cc6('0x3e')]=function(_0x57bebb,_0x3e372b){return db[_0x4cc6('0x32')][_0x4cc6('0x1f')]({'where':{'resetPasswordToken':_0x57bebb[_0x4cc6('0x3f')][_0x4cc6('0x40')],'resetPasswordExpires':{'$gt':Date[_0x4cc6('0x41')]()}}})[_0x4cc6('0xe')](function(_0x31b3ca){if(!_0x31b3ca){throw new Error(_0x4cc6('0x42'));}return db['Setting'][_0x4cc6('0xc')]({'attributes':['id','securePassword',_0x4cc6('0x43'),_0x4cc6('0x44')]})[_0x4cc6('0xe')](function(_0x18a879){if(_0x18a879[_0x4cc6('0x45')])authService[_0x4cc6('0x46')](_0x57bebb['body'][_0x4cc6('0x10')]);if(!_0x18a879[_0x4cc6('0x43')]||!_0x31b3ca[_0x4cc6('0x47')])return _0x31b3ca;authService['validatePasswordHistory'](_0x57bebb[_0x4cc6('0x31')][_0x4cc6('0x10')],_0x31b3ca[_0x4cc6('0x47')],_0x18a879[_0x4cc6('0x44')]);return _0x31b3ca;})['then'](function(){_0x31b3ca[_0x4cc6('0x10')]=_0x57bebb[_0x4cc6('0x31')]['password'];_0x31b3ca[_0x4cc6('0x36')]=null;_0x31b3ca[_0x4cc6('0x37')]=null;return _0x31b3ca[_0x4cc6('0x38')]();});})[_0x4cc6('0xe')](function(){_0x3e372b['status'](0xc8)[_0x4cc6('0x2b')]({'message':_0x4cc6('0x48')});})[_0x4cc6('0x1e')](function(_0x512401){return handleError(_0x3e372b,0x1f4,_0x512401);});};passport['use'](_0x4cc6('0x2c'),new LocalStrategy({'usernameField':_0x4cc6('0xf'),'passwordField':'password'},function(_0x4b7094,_0x20d3aa,_0x5a579a){return localAuthenticate(db['User'],_0x4b7094,_0x20d3aa,_0x5a579a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1fd0511..d112d17 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 _0x7fe8=['exports','express','Router','./authLocal.controller','post','login','forgot','/reset/:token','reset'];(function(_0x57369a,_0x1550f0){var _0x3cdd5b=function(_0x13af47){while(--_0x13af47){_0x57369a['push'](_0x57369a['shift']());}};_0x3cdd5b(++_0x1550f0);}(_0x7fe8,0x145));var _0x87fe=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x7fe8[_0x4d613c];return _0x301fe3;};'use strict';var express=require(_0x87fe('0x0'));var router=express[_0x87fe('0x1')]();var controller=require(_0x87fe('0x2'));router[_0x87fe('0x3')]('/',controller[_0x87fe('0x4')]);router[_0x87fe('0x3')]('/forgot',controller[_0x87fe('0x5')]);router[_0x87fe('0x3')](_0x87fe('0x6'),controller[_0x87fe('0x7')]);module[_0x87fe('0x8')]=router; \ No newline at end of file +var _0x9730=['./authLocal.controller','login','post','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x41f279,_0x2f5bf3){var _0x40b931=function(_0x5c9923){while(--_0x5c9923){_0x41f279['push'](_0x41f279['shift']());}};_0x40b931(++_0x2f5bf3);}(_0x9730,0x10c));var _0x0973=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9730[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x0973('0x0'));var router=express[_0x0973('0x1')]();var controller=require(_0x0973('0x2'));router['post']('/',controller[_0x0973('0x3')]);router[_0x0973('0x4')](_0x0973('0x5'),controller[_0x0973('0x6')]);router[_0x0973('0x4')](_0x0973('0x7'),controller[_0x0973('0x8')]);module[_0x0973('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 5efd932..528249f 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 _0xe6f5=['BOOLEAN','sequelize','exports','STRING'];(function(_0x34bedd,_0x541e66){var _0x4050b3=function(_0x64e23e){while(--_0x64e23e){_0x34bedd['push'](_0x34bedd['shift']());}};_0x4050b3(++_0x541e66);}(_0xe6f5,0xed));var _0x5e6f=function(_0x4f3463,_0x5a1ee7){_0x4f3463=_0x4f3463-0x0;var _0x5f0e49=_0xe6f5[_0x4f3463];return _0x5f0e49;};'use strict';var Sequelize=require(_0x5e6f('0x0'));module[_0x5e6f('0x1')]={'name':{'type':Sequelize[_0x5e6f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5e6f('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5e6f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x446d=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x59ab09,_0x25e012){var _0x53ff1d=function(_0x5ce4d9){while(--_0x5ce4d9){_0x59ab09['push'](_0x59ab09['shift']());}};_0x53ff1d(++_0x25e012);}(_0x446d,0x184));var _0xd446=function(_0x204c3a,_0x5129a7){_0x204c3a=_0x204c3a-0x0;var _0x465b9d=_0x446d[_0x204c3a];return _0x465b9d;};'use strict';var Sequelize=require(_0xd446('0x0'));module[_0xd446('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd446('0x2')]},'status':{'type':Sequelize[_0xd446('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd446('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 381cd0a..106f791 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 _0x74e4=['fields','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','catch','show','params','length','options','create','body','find','addConditions','ids','omit','getConditions','findOne','keys','pick','addActions','Action','getActions','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','util','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/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes'];(function(_0x209e2e,_0x1d7c3b){var _0x479b49=function(_0x2ecb1c){while(--_0x2ecb1c){_0x209e2e['push'](_0x209e2e['shift']());}};_0x479b49(++_0x1d7c3b);}(_0x74e4,0x165));var _0x474e=function(_0x220835,_0x2d58dd){_0x220835=_0x220835-0x0;var _0x5cd63b=_0x74e4[_0x220835];return _0x5cd63b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x474e('0x0'));var jsonpatch=require(_0x474e('0x1'));var rp=require(_0x474e('0x2'));var moment=require(_0x474e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x474e('0x4'));var path=require('path');var sox=require(_0x474e('0x5'));var csv=require(_0x474e('0x6'));var ejs=require(_0x474e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x474e('0x8'));var crypto=require(_0x474e('0x9'));var jsforce=require(_0x474e('0xa'));var deskjs=require(_0x474e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x474e('0xc'));var Papa=require(_0x474e('0xd'));var Redis=require(_0x474e('0xe'));var authService=require(_0x474e('0xf'));var qs=require(_0x474e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x474e('0x11'));var logger=require(_0x474e('0x12'))(_0x474e('0x13'));var utils=require(_0x474e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x474e('0x15'));var db=require(_0x474e('0x16'))['db'];function respondWithStatusCode(_0x5a5c85,_0x22ff33){_0x22ff33=_0x22ff33||0xcc;return function(_0x30bd24){if(_0x30bd24){return _0x5a5c85[_0x474e('0x17')](_0x22ff33);}return _0x5a5c85[_0x474e('0x18')](_0x22ff33)[_0x474e('0x19')]();};}function respondWithResult(_0x51dc41,_0x1f31d2){_0x1f31d2=_0x1f31d2||0xc8;return function(_0x1b2892){if(_0x1b2892){return _0x51dc41['status'](_0x1f31d2)['json'](_0x1b2892);}};}function respondWithFilteredResult(_0x3ca30d,_0x4d1229){return function(_0x26236c){if(_0x26236c){var _0x1a5c86=typeof _0x4d1229[_0x474e('0x1a')]==='undefined'&&typeof _0x4d1229[_0x474e('0x1b')]===_0x474e('0x1c');var _0x21eeda=_0x26236c[_0x474e('0x1d')];var _0x23878f=_0x1a5c86?0x0:_0x4d1229[_0x474e('0x1a')];var _0xadb0f6=_0x1a5c86?_0x26236c[_0x474e('0x1d')]:_0x4d1229[_0x474e('0x1a')]+_0x4d1229[_0x474e('0x1b')];var _0x124a4d;if(_0xadb0f6>=_0x21eeda){_0xadb0f6=_0x21eeda;_0x124a4d=0xc8;}else{_0x124a4d=0xce;}_0x3ca30d[_0x474e('0x18')](_0x124a4d);return _0x3ca30d[_0x474e('0x1e')]('Content-Range',_0x23878f+'-'+_0xadb0f6+'/'+_0x21eeda)[_0x474e('0x1f')](_0x26236c);}return null;};}function patchUpdates(_0x4cac35){return function(_0x1b0816){try{jsonpatch[_0x474e('0x20')](_0x1b0816,_0x4cac35,!![]);}catch(_0x20bd72){return BPromise[_0x474e('0x21')](_0x20bd72);}return _0x1b0816[_0x474e('0x22')]();};}function saveUpdates(_0x58e1e4,_0x397367){return function(_0x172508){if(_0x172508){return _0x172508[_0x474e('0x23')](_0x58e1e4)[_0x474e('0x24')](function(_0x4a1967){return _0x4a1967;});}return null;};}function removeEntity(_0x352ec2,_0xd5c7c4){return function(_0xb0b39a){if(_0xb0b39a){return _0xb0b39a[_0x474e('0x25')]()[_0x474e('0x24')](function(){_0x352ec2[_0x474e('0x18')](0xcc)[_0x474e('0x19')]();});}};}function handleEntityNotFound(_0x5a84f4,_0x57c94c){return function(_0x6bc62b){if(!_0x6bc62b){_0x5a84f4[_0x474e('0x17')](0x194);}return _0x6bc62b;};}function handleError(_0x1d7467,_0x4a8532){_0x4a8532=_0x4a8532||0x1f4;return function(_0x2237b3){logger[_0x474e('0x26')](_0x2237b3[_0x474e('0x27')]);if(_0x2237b3[_0x474e('0x28')]){delete _0x2237b3[_0x474e('0x28')];}_0x1d7467['status'](_0x4a8532)['send'](_0x2237b3);};}exports[_0x474e('0x29')]=function(_0x345d96,_0x582868){var _0x23b5b6={},_0x57f1b6={},_0x25c240={'count':0x0,'rows':[]};var _0x36b0c2=_[_0x474e('0x2a')](db[_0x474e('0x2b')][_0x474e('0x2c')],function(_0x2b8a04){return{'name':_0x2b8a04[_0x474e('0x2d')],'type':_0x2b8a04[_0x474e('0x2e')][_0x474e('0x2f')]};});_0x57f1b6[_0x474e('0x30')]=_[_0x474e('0x2a')](_0x36b0c2,'name');_0x57f1b6['query']=_['keys'](_0x345d96['query']);_0x57f1b6[_0x474e('0x31')]=_[_0x474e('0x32')](_0x57f1b6[_0x474e('0x30')],_0x57f1b6[_0x474e('0x33')]);_0x23b5b6[_0x474e('0x34')]=_[_0x474e('0x32')](_0x57f1b6['model'],qs[_0x474e('0x35')](_0x345d96['query']['fields']));_0x23b5b6[_0x474e('0x34')]=_0x23b5b6[_0x474e('0x34')]['length']?_0x23b5b6['attributes']:_0x57f1b6[_0x474e('0x30')];if(!_0x345d96[_0x474e('0x33')]['hasOwnProperty'](_0x474e('0x36'))){_0x23b5b6[_0x474e('0x1b')]=qs[_0x474e('0x1b')](_0x345d96[_0x474e('0x33')][_0x474e('0x1b')]);_0x23b5b6['offset']=qs[_0x474e('0x1a')](_0x345d96[_0x474e('0x33')]['offset']);}_0x23b5b6[_0x474e('0x37')]=qs['sort'](_0x345d96[_0x474e('0x33')][_0x474e('0x38')]);_0x23b5b6[_0x474e('0x39')]=qs[_0x474e('0x31')](_['pick'](_0x345d96[_0x474e('0x33')],_0x57f1b6[_0x474e('0x31')]),_0x36b0c2);if(_0x345d96['query']['filter']){_0x23b5b6[_0x474e('0x39')]=_[_0x474e('0x3a')](_0x23b5b6[_0x474e('0x39')],{'$or':_['map'](_0x36b0c2,function(_0x220282){if(_0x220282[_0x474e('0x2e')]!==_0x474e('0x3b')){var _0x56ba95={};_0x56ba95[_0x220282['name']]={'$like':'%'+_0x345d96[_0x474e('0x33')][_0x474e('0x3c')]+'%'};return _0x56ba95;}})});}_0x23b5b6=_[_0x474e('0x3a')]({},_0x23b5b6,_0x345d96['options']);var _0x304616={'where':_0x23b5b6[_0x474e('0x39')]};return db[_0x474e('0x2b')][_0x474e('0x1d')](_0x304616)['then'](function(_0x15a394){_0x25c240[_0x474e('0x1d')]=_0x15a394;if(_0x345d96['query'][_0x474e('0x3d')]){_0x23b5b6[_0x474e('0x3e')]=[{'all':!![]}];}return db[_0x474e('0x2b')]['findAll'](_0x23b5b6);})[_0x474e('0x24')](function(_0x389d20){_0x25c240['rows']=_0x389d20;return _0x25c240;})['then'](respondWithFilteredResult(_0x582868,_0x23b5b6))[_0x474e('0x3f')](handleError(_0x582868,null));};exports[_0x474e('0x40')]=function(_0x1b2845,_0x40a4ed){var _0x5324f4={'raw':![],'where':{'id':_0x1b2845[_0x474e('0x41')]['id']}},_0x21a28d={};_0x21a28d[_0x474e('0x30')]=_['keys'](db[_0x474e('0x2b')]['rawAttributes']);_0x21a28d[_0x474e('0x33')]=_['keys'](_0x1b2845[_0x474e('0x33')]);_0x21a28d['filters']=_[_0x474e('0x32')](_0x21a28d[_0x474e('0x30')],_0x21a28d[_0x474e('0x33')]);_0x5324f4[_0x474e('0x34')]=_[_0x474e('0x32')](_0x21a28d['model'],qs[_0x474e('0x35')](_0x1b2845[_0x474e('0x33')][_0x474e('0x35')]));_0x5324f4['attributes']=_0x5324f4['attributes'][_0x474e('0x42')]?_0x5324f4[_0x474e('0x34')]:_0x21a28d[_0x474e('0x30')];if(_0x1b2845[_0x474e('0x33')]['includeAll']){_0x5324f4['include']=[{'all':!![]}];}_0x5324f4=_[_0x474e('0x3a')]({},_0x5324f4,_0x1b2845[_0x474e('0x43')]);return db['Automation']['find'](_0x5324f4)['then'](handleEntityNotFound(_0x40a4ed,null))[_0x474e('0x24')](respondWithResult(_0x40a4ed,null))['catch'](handleError(_0x40a4ed,null));};exports[_0x474e('0x44')]=function(_0x331e16,_0x72eded){return db[_0x474e('0x2b')]['create'](_0x331e16[_0x474e('0x45')],{})[_0x474e('0x24')](respondWithResult(_0x72eded,0xc9))[_0x474e('0x3f')](handleError(_0x72eded,null));};exports[_0x474e('0x23')]=function(_0x23c9de,_0x56bdae){if(_0x23c9de[_0x474e('0x45')]['id']){delete _0x23c9de[_0x474e('0x45')]['id'];}return db['Automation'][_0x474e('0x46')]({'where':{'id':_0x23c9de['params']['id']}})[_0x474e('0x24')](handleEntityNotFound(_0x56bdae,null))[_0x474e('0x24')](saveUpdates(_0x23c9de[_0x474e('0x45')],null))[_0x474e('0x24')](respondWithResult(_0x56bdae,null))[_0x474e('0x3f')](handleError(_0x56bdae,null));};exports[_0x474e('0x25')]=function(_0x1bd4e6,_0x124df9){return db['Automation'][_0x474e('0x46')]({'where':{'id':_0x1bd4e6[_0x474e('0x41')]['id']}})[_0x474e('0x24')](handleEntityNotFound(_0x124df9,null))[_0x474e('0x24')](removeEntity(_0x124df9,null))['catch'](handleError(_0x124df9,null));};exports[_0x474e('0x47')]=function(_0x1a56cf,_0x3cbc66,_0x290d91){return db['Condition'][_0x474e('0x46')]({'where':{'id':_0x1a56cf[_0x474e('0x41')]['id']}})['then'](handleEntityNotFound(_0x3cbc66,null))[_0x474e('0x24')](function(_0x58ee90){if(_0x58ee90){return _0x58ee90[_0x474e('0x47')](_0x1a56cf['body'][_0x474e('0x48')],_[_0x474e('0x49')](_0x1a56cf['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3cbc66,null))[_0x474e('0x3f')](handleError(_0x3cbc66,null));};exports[_0x474e('0x4a')]=function(_0x546897,_0x5ce0f2,_0x1eaf18){var _0x4c267c={};var _0x2fe406={};var _0x3b7ade;var _0x232582;return db[_0x474e('0x2b')][_0x474e('0x4b')]({'where':{'id':_0x546897['params']['id']}})[_0x474e('0x24')](handleEntityNotFound(_0x5ce0f2,null))[_0x474e('0x24')](function(_0x27af92){if(_0x27af92){_0x3b7ade=_0x27af92;_0x2fe406['model']=_[_0x474e('0x4c')](db['Condition'][_0x474e('0x2c')]);_0x2fe406['query']=_['keys'](_0x546897[_0x474e('0x33')]);_0x2fe406[_0x474e('0x31')]=_['intersection'](_0x2fe406[_0x474e('0x30')],_0x2fe406['query']);_0x4c267c[_0x474e('0x34')]=_[_0x474e('0x32')](_0x2fe406[_0x474e('0x30')],qs[_0x474e('0x35')](_0x546897[_0x474e('0x33')][_0x474e('0x35')]));_0x4c267c[_0x474e('0x34')]=_0x4c267c[_0x474e('0x34')][_0x474e('0x42')]?_0x4c267c[_0x474e('0x34')]:_0x2fe406[_0x474e('0x30')];_0x4c267c['order']=qs['sort'](_0x546897[_0x474e('0x33')][_0x474e('0x38')]);_0x4c267c[_0x474e('0x39')]=qs[_0x474e('0x31')](_[_0x474e('0x4d')](_0x546897[_0x474e('0x33')],_0x2fe406['filters']));if(_0x546897[_0x474e('0x33')][_0x474e('0x3c')]){_0x4c267c[_0x474e('0x39')]=_[_0x474e('0x3a')](_0x4c267c['where'],{'$or':_[_0x474e('0x2a')](_0x4c267c[_0x474e('0x34')],function(_0x355e17){var _0x215701={};_0x215701[_0x355e17]={'$like':'%'+_0x546897[_0x474e('0x33')][_0x474e('0x3c')]+'%'};return _0x215701;})});}_0x4c267c=_[_0x474e('0x3a')]({},_0x4c267c,_0x546897[_0x474e('0x43')]);return _0x3b7ade[_0x474e('0x4a')](_0x4c267c);}})[_0x474e('0x24')](function(_0x14aeb3){if(_0x14aeb3){_0x232582=_0x14aeb3['length'];if(!_0x546897['query']['hasOwnProperty'](_0x474e('0x36'))){_0x4c267c['limit']=qs['limit'](_0x546897[_0x474e('0x33')][_0x474e('0x1b')]);_0x4c267c[_0x474e('0x1a')]=qs[_0x474e('0x1a')](_0x546897[_0x474e('0x33')][_0x474e('0x1a')]);}return _0x3b7ade[_0x474e('0x4a')](_0x4c267c);}})[_0x474e('0x24')](function(_0x55a023){if(_0x55a023){return _0x55a023?{'count':_0x232582,'rows':_0x55a023}:null;}})[_0x474e('0x24')](respondWithResult(_0x5ce0f2,null))[_0x474e('0x3f')](handleError(_0x5ce0f2,null));};exports[_0x474e('0x4e')]=function(_0x14ebdf,_0x276d17,_0x118efc){return db[_0x474e('0x4f')][_0x474e('0x46')]({'where':{'id':_0x14ebdf['params']['id']}})[_0x474e('0x24')](handleEntityNotFound(_0x276d17,null))[_0x474e('0x24')](function(_0x158e34){if(_0x158e34){return _0x158e34[_0x474e('0x4e')](_0x14ebdf[_0x474e('0x45')][_0x474e('0x48')],_['omit'](_0x14ebdf['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x276d17,null))[_0x474e('0x3f')](handleError(_0x276d17,null));};exports[_0x474e('0x50')]=function(_0x4bcc54,_0x36e1e6,_0x5c41d4){var _0x8ad628={};var _0x189c83={};var _0x4265d5;var _0x4f9edb;return db[_0x474e('0x2b')]['findOne']({'where':{'id':_0x4bcc54['params']['id']}})['then'](handleEntityNotFound(_0x36e1e6,null))[_0x474e('0x24')](function(_0x386650){if(_0x386650){_0x4265d5=_0x386650;_0x189c83[_0x474e('0x30')]=_[_0x474e('0x4c')](db[_0x474e('0x4f')][_0x474e('0x2c')]);_0x189c83['query']=_['keys'](_0x4bcc54[_0x474e('0x33')]);_0x189c83['filters']=_['intersection'](_0x189c83[_0x474e('0x30')],_0x189c83[_0x474e('0x33')]);_0x8ad628[_0x474e('0x34')]=_[_0x474e('0x32')](_0x189c83['model'],qs[_0x474e('0x35')](_0x4bcc54[_0x474e('0x33')][_0x474e('0x35')]));_0x8ad628[_0x474e('0x34')]=_0x8ad628['attributes']['length']?_0x8ad628[_0x474e('0x34')]:_0x189c83[_0x474e('0x30')];_0x8ad628[_0x474e('0x37')]=qs[_0x474e('0x38')](_0x4bcc54['query']['sort']);_0x8ad628[_0x474e('0x39')]=qs[_0x474e('0x31')](_[_0x474e('0x4d')](_0x4bcc54[_0x474e('0x33')],_0x189c83['filters']));if(_0x4bcc54[_0x474e('0x33')]['filter']){_0x8ad628['where']=_[_0x474e('0x3a')](_0x8ad628['where'],{'$or':_[_0x474e('0x2a')](_0x8ad628[_0x474e('0x34')],function(_0x45e1d6){var _0x58a4a3={};_0x58a4a3[_0x45e1d6]={'$like':'%'+_0x4bcc54[_0x474e('0x33')][_0x474e('0x3c')]+'%'};return _0x58a4a3;})});}_0x8ad628=_[_0x474e('0x3a')]({},_0x8ad628,_0x4bcc54[_0x474e('0x43')]);return _0x4265d5[_0x474e('0x50')](_0x8ad628);}})[_0x474e('0x24')](function(_0x3679cb){if(_0x3679cb){_0x4f9edb=_0x3679cb[_0x474e('0x42')];if(!_0x4bcc54[_0x474e('0x33')][_0x474e('0x51')](_0x474e('0x36'))){_0x8ad628[_0x474e('0x1b')]=qs[_0x474e('0x1b')](_0x4bcc54[_0x474e('0x33')][_0x474e('0x1b')]);_0x8ad628[_0x474e('0x1a')]=qs['offset'](_0x4bcc54[_0x474e('0x33')][_0x474e('0x1a')]);}return _0x4265d5[_0x474e('0x50')](_0x8ad628);}})[_0x474e('0x24')](function(_0x43a9cd){if(_0x43a9cd){return _0x43a9cd?{'count':_0x4f9edb,'rows':_0x43a9cd}:null;}})[_0x474e('0x24')](respondWithResult(_0x36e1e6,null))[_0x474e('0x3f')](handleError(_0x36e1e6,null));}; \ No newline at end of file +var _0x50ff=['send','index','map','Automation','rawAttributes','fieldName','type','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','include','rows','catch','show','params','includeAll','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','pick','options','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x2b4724,_0x4b5a31){var _0x59e45d=function(_0x39d57a){while(--_0x39d57a){_0x2b4724['push'](_0x2b4724['shift']());}};_0x59e45d(++_0x4b5a31);}(_0x50ff,0x12d));var _0xf50f=function(_0x4dff13,_0x4b370c){_0x4dff13=_0x4dff13-0x0;var _0xebeadb=_0x50ff[_0x4dff13];return _0xebeadb;};'use strict';var emlformat=require(_0xf50f('0x0'));var rimraf=require(_0xf50f('0x1'));var zipdir=require(_0xf50f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf50f('0x3'));var moment=require(_0xf50f('0x4'));var BPromise=require(_0xf50f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf50f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf50f('0x7'));var _=require(_0xf50f('0x8'));var squel=require(_0xf50f('0x9'));var crypto=require(_0xf50f('0xa'));var jsforce=require(_0xf50f('0xb'));var deskjs=require(_0xf50f('0xc'));var toCsv=require(_0xf50f('0xd'));var querystring=require(_0xf50f('0xe'));var Papa=require('papaparse');var Redis=require(_0xf50f('0xf'));var authService=require(_0xf50f('0x10'));var qs=require(_0xf50f('0x11'));var as=require(_0xf50f('0x12'));var hardwareService=require(_0xf50f('0x13'));var logger=require(_0xf50f('0x14'))('api');var utils=require(_0xf50f('0x15'));var config=require(_0xf50f('0x16'));var licenseUtil=require(_0xf50f('0x17'));var db=require(_0xf50f('0x18'))['db'];function respondWithStatusCode(_0x57e86a,_0x5737d7){_0x5737d7=_0x5737d7||0xcc;return function(_0xfa07f2){if(_0xfa07f2){return _0x57e86a[_0xf50f('0x19')](_0x5737d7);}return _0x57e86a[_0xf50f('0x1a')](_0x5737d7)[_0xf50f('0x1b')]();};}function respondWithResult(_0x46a110,_0x34bf23){_0x34bf23=_0x34bf23||0xc8;return function(_0x2d2c06){if(_0x2d2c06){return _0x46a110[_0xf50f('0x1a')](_0x34bf23)[_0xf50f('0x1c')](_0x2d2c06);}};}function respondWithFilteredResult(_0x48471d,_0x365a65){return function(_0x2eb671){if(_0x2eb671){var _0xa95f00=typeof _0x365a65[_0xf50f('0x1d')]==='undefined'&&typeof _0x365a65[_0xf50f('0x1e')]===_0xf50f('0x1f');var _0x355e25=_0x2eb671['count'];var _0x566ed7=_0xa95f00?0x0:_0x365a65[_0xf50f('0x1d')];var _0x5e64c9=_0xa95f00?_0x2eb671[_0xf50f('0x20')]:_0x365a65[_0xf50f('0x1d')]+_0x365a65[_0xf50f('0x1e')];var _0x4fd987;if(_0x5e64c9>=_0x355e25){_0x5e64c9=_0x355e25;_0x4fd987=0xc8;}else{_0x4fd987=0xce;}_0x48471d[_0xf50f('0x1a')](_0x4fd987);return _0x48471d['set'](_0xf50f('0x21'),_0x566ed7+'-'+_0x5e64c9+'/'+_0x355e25)[_0xf50f('0x1c')](_0x2eb671);}return null;};}function patchUpdates(_0x578f19){return function(_0x25b1f7){try{jsonpatch[_0xf50f('0x22')](_0x25b1f7,_0x578f19,!![]);}catch(_0x5dd501){return BPromise[_0xf50f('0x23')](_0x5dd501);}return _0x25b1f7[_0xf50f('0x24')]();};}function saveUpdates(_0x4c7788,_0x432f93){return function(_0x343478){if(_0x343478){return _0x343478[_0xf50f('0x25')](_0x4c7788)[_0xf50f('0x26')](function(_0x5e3945){return _0x5e3945;});}return null;};}function removeEntity(_0x3d2e9b,_0x174d2b){return function(_0x233199){if(_0x233199){return _0x233199[_0xf50f('0x27')]()['then'](function(){_0x3d2e9b['status'](0xcc)[_0xf50f('0x1b')]();});}};}function handleEntityNotFound(_0x16ca13,_0x4f6181){return function(_0x497404){if(!_0x497404){_0x16ca13['sendStatus'](0x194);}return _0x497404;};}function handleError(_0x1135c3,_0xdee982){_0xdee982=_0xdee982||0x1f4;return function(_0x36c1c1){logger[_0xf50f('0x28')](_0x36c1c1[_0xf50f('0x29')]);if(_0x36c1c1[_0xf50f('0x2a')]){delete _0x36c1c1[_0xf50f('0x2a')];}_0x1135c3[_0xf50f('0x1a')](_0xdee982)[_0xf50f('0x2b')](_0x36c1c1);};}exports[_0xf50f('0x2c')]=function(_0x3378a6,_0x16c2cb){var _0x1409bb={},_0x2dca9c={},_0x2a87ce={'count':0x0,'rows':[]};var _0x356e61=_[_0xf50f('0x2d')](db[_0xf50f('0x2e')][_0xf50f('0x2f')],function(_0x3a7a14){return{'name':_0x3a7a14[_0xf50f('0x30')],'type':_0x3a7a14[_0xf50f('0x31')]['key']};});_0x2dca9c['model']=_['map'](_0x356e61,'name');_0x2dca9c['query']=_[_0xf50f('0x32')](_0x3378a6[_0xf50f('0x33')]);_0x2dca9c[_0xf50f('0x34')]=_['intersection'](_0x2dca9c['model'],_0x2dca9c[_0xf50f('0x33')]);_0x1409bb[_0xf50f('0x35')]=_[_0xf50f('0x36')](_0x2dca9c[_0xf50f('0x37')],qs[_0xf50f('0x38')](_0x3378a6['query'][_0xf50f('0x38')]));_0x1409bb[_0xf50f('0x35')]=_0x1409bb[_0xf50f('0x35')][_0xf50f('0x39')]?_0x1409bb['attributes']:_0x2dca9c['model'];if(!_0x3378a6[_0xf50f('0x33')][_0xf50f('0x3a')](_0xf50f('0x3b'))){_0x1409bb['limit']=qs[_0xf50f('0x1e')](_0x3378a6[_0xf50f('0x33')][_0xf50f('0x1e')]);_0x1409bb[_0xf50f('0x1d')]=qs['offset'](_0x3378a6['query'][_0xf50f('0x1d')]);}_0x1409bb[_0xf50f('0x3c')]=qs[_0xf50f('0x3d')](_0x3378a6['query'][_0xf50f('0x3d')]);_0x1409bb[_0xf50f('0x3e')]=qs[_0xf50f('0x34')](_['pick'](_0x3378a6[_0xf50f('0x33')],_0x2dca9c[_0xf50f('0x34')]),_0x356e61);if(_0x3378a6[_0xf50f('0x33')][_0xf50f('0x3f')]){_0x1409bb[_0xf50f('0x3e')]=_['merge'](_0x1409bb[_0xf50f('0x3e')],{'$or':_[_0xf50f('0x2d')](_0x356e61,function(_0x10e1ea){if(_0x10e1ea['type']!==_0xf50f('0x40')){var _0x1a8392={};_0x1a8392[_0x10e1ea[_0xf50f('0x2a')]]={'$like':'%'+_0x3378a6[_0xf50f('0x33')]['filter']+'%'};return _0x1a8392;}})});}_0x1409bb=_[_0xf50f('0x41')]({},_0x1409bb,_0x3378a6['options']);var _0x2c7e17={'where':_0x1409bb['where']};return db[_0xf50f('0x2e')][_0xf50f('0x20')](_0x2c7e17)['then'](function(_0x27573f){_0x2a87ce[_0xf50f('0x20')]=_0x27573f;if(_0x3378a6['query']['includeAll']){_0x1409bb[_0xf50f('0x42')]=[{'all':!![]}];}return db[_0xf50f('0x2e')]['findAll'](_0x1409bb);})['then'](function(_0x2240ac){_0x2a87ce[_0xf50f('0x43')]=_0x2240ac;return _0x2a87ce;})[_0xf50f('0x26')](respondWithFilteredResult(_0x16c2cb,_0x1409bb))[_0xf50f('0x44')](handleError(_0x16c2cb,null));};exports[_0xf50f('0x45')]=function(_0x3e67c,_0x358eac){var _0xa4e46a={'raw':![],'where':{'id':_0x3e67c[_0xf50f('0x46')]['id']}},_0x319bca={};_0x319bca['model']=_[_0xf50f('0x32')](db[_0xf50f('0x2e')]['rawAttributes']);_0x319bca[_0xf50f('0x33')]=_[_0xf50f('0x32')](_0x3e67c[_0xf50f('0x33')]);_0x319bca[_0xf50f('0x34')]=_[_0xf50f('0x36')](_0x319bca[_0xf50f('0x37')],_0x319bca[_0xf50f('0x33')]);_0xa4e46a[_0xf50f('0x35')]=_[_0xf50f('0x36')](_0x319bca[_0xf50f('0x37')],qs[_0xf50f('0x38')](_0x3e67c[_0xf50f('0x33')][_0xf50f('0x38')]));_0xa4e46a['attributes']=_0xa4e46a['attributes'][_0xf50f('0x39')]?_0xa4e46a[_0xf50f('0x35')]:_0x319bca['model'];if(_0x3e67c[_0xf50f('0x33')][_0xf50f('0x47')]){_0xa4e46a[_0xf50f('0x42')]=[{'all':!![]}];}_0xa4e46a=_[_0xf50f('0x41')]({},_0xa4e46a,_0x3e67c['options']);return db[_0xf50f('0x2e')][_0xf50f('0x48')](_0xa4e46a)['then'](handleEntityNotFound(_0x358eac,null))[_0xf50f('0x26')](respondWithResult(_0x358eac,null))['catch'](handleError(_0x358eac,null));};exports[_0xf50f('0x49')]=function(_0x165553,_0x1a9f9b){return db[_0xf50f('0x2e')][_0xf50f('0x49')](_0x165553[_0xf50f('0x4a')],{})[_0xf50f('0x26')](respondWithResult(_0x1a9f9b,0xc9))['catch'](handleError(_0x1a9f9b,null));};exports[_0xf50f('0x25')]=function(_0x4fcf31,_0x108d61){if(_0x4fcf31[_0xf50f('0x4a')]['id']){delete _0x4fcf31['body']['id'];}return db[_0xf50f('0x2e')]['find']({'where':{'id':_0x4fcf31[_0xf50f('0x46')]['id']}})[_0xf50f('0x26')](handleEntityNotFound(_0x108d61,null))['then'](saveUpdates(_0x4fcf31[_0xf50f('0x4a')],null))[_0xf50f('0x26')](respondWithResult(_0x108d61,null))['catch'](handleError(_0x108d61,null));};exports[_0xf50f('0x27')]=function(_0x5bc1e3,_0x47e048){return db['Automation'][_0xf50f('0x48')]({'where':{'id':_0x5bc1e3['params']['id']}})['then'](handleEntityNotFound(_0x47e048,null))[_0xf50f('0x26')](removeEntity(_0x47e048,null))[_0xf50f('0x44')](handleError(_0x47e048,null));};exports[_0xf50f('0x4b')]=function(_0x28c61b,_0x27ae2b,_0xc4172d){return db[_0xf50f('0x4c')][_0xf50f('0x48')]({'where':{'id':_0x28c61b[_0xf50f('0x46')]['id']}})[_0xf50f('0x26')](handleEntityNotFound(_0x27ae2b,null))[_0xf50f('0x26')](function(_0x5bbe4f){if(_0x5bbe4f){return _0x5bbe4f[_0xf50f('0x4b')](_0x28c61b[_0xf50f('0x4a')][_0xf50f('0x4d')],_[_0xf50f('0x4e')](_0x28c61b[_0xf50f('0x4a')],[_0xf50f('0x4d'),'id'])||{});}})[_0xf50f('0x26')](respondWithResult(_0x27ae2b,null))[_0xf50f('0x44')](handleError(_0x27ae2b,null));};exports[_0xf50f('0x4f')]=function(_0x14a5e9,_0x12e8ec,_0xba727e){var _0x2891cc={};var _0x217748={};var _0x108132;var _0x5280d4;return db['Automation'][_0xf50f('0x50')]({'where':{'id':_0x14a5e9[_0xf50f('0x46')]['id']}})[_0xf50f('0x26')](handleEntityNotFound(_0x12e8ec,null))[_0xf50f('0x26')](function(_0x32911f){if(_0x32911f){_0x108132=_0x32911f;_0x217748[_0xf50f('0x37')]=_[_0xf50f('0x32')](db[_0xf50f('0x4c')][_0xf50f('0x2f')]);_0x217748[_0xf50f('0x33')]=_[_0xf50f('0x32')](_0x14a5e9[_0xf50f('0x33')]);_0x217748[_0xf50f('0x34')]=_[_0xf50f('0x36')](_0x217748[_0xf50f('0x37')],_0x217748[_0xf50f('0x33')]);_0x2891cc[_0xf50f('0x35')]=_[_0xf50f('0x36')](_0x217748[_0xf50f('0x37')],qs[_0xf50f('0x38')](_0x14a5e9['query'][_0xf50f('0x38')]));_0x2891cc['attributes']=_0x2891cc[_0xf50f('0x35')]['length']?_0x2891cc[_0xf50f('0x35')]:_0x217748['model'];_0x2891cc[_0xf50f('0x3c')]=qs[_0xf50f('0x3d')](_0x14a5e9[_0xf50f('0x33')][_0xf50f('0x3d')]);_0x2891cc[_0xf50f('0x3e')]=qs[_0xf50f('0x34')](_[_0xf50f('0x51')](_0x14a5e9[_0xf50f('0x33')],_0x217748[_0xf50f('0x34')]));if(_0x14a5e9[_0xf50f('0x33')][_0xf50f('0x3f')]){_0x2891cc[_0xf50f('0x3e')]=_['merge'](_0x2891cc[_0xf50f('0x3e')],{'$or':_[_0xf50f('0x2d')](_0x2891cc[_0xf50f('0x35')],function(_0x250c46){var _0x45827d={};_0x45827d[_0x250c46]={'$like':'%'+_0x14a5e9[_0xf50f('0x33')][_0xf50f('0x3f')]+'%'};return _0x45827d;})});}_0x2891cc=_[_0xf50f('0x41')]({},_0x2891cc,_0x14a5e9[_0xf50f('0x52')]);return _0x108132[_0xf50f('0x4f')](_0x2891cc);}})[_0xf50f('0x26')](function(_0x2007d5){if(_0x2007d5){_0x5280d4=_0x2007d5['length'];if(!_0x14a5e9[_0xf50f('0x33')][_0xf50f('0x3a')]('nolimit')){_0x2891cc[_0xf50f('0x1e')]=qs[_0xf50f('0x1e')](_0x14a5e9[_0xf50f('0x33')]['limit']);_0x2891cc[_0xf50f('0x1d')]=qs[_0xf50f('0x1d')](_0x14a5e9[_0xf50f('0x33')]['offset']);}return _0x108132[_0xf50f('0x4f')](_0x2891cc);}})[_0xf50f('0x26')](function(_0x35b5b1){if(_0x35b5b1){return _0x35b5b1?{'count':_0x5280d4,'rows':_0x35b5b1}:null;}})['then'](respondWithResult(_0x12e8ec,null))[_0xf50f('0x44')](handleError(_0x12e8ec,null));};exports[_0xf50f('0x53')]=function(_0x4a55b2,_0x5c30d0,_0x173e54){return db[_0xf50f('0x54')][_0xf50f('0x48')]({'where':{'id':_0x4a55b2[_0xf50f('0x46')]['id']}})[_0xf50f('0x26')](handleEntityNotFound(_0x5c30d0,null))['then'](function(_0x1ab78e){if(_0x1ab78e){return _0x1ab78e[_0xf50f('0x53')](_0x4a55b2['body']['ids'],_[_0xf50f('0x4e')](_0x4a55b2['body'],[_0xf50f('0x4d'),'id'])||{});}})[_0xf50f('0x26')](respondWithResult(_0x5c30d0,null))[_0xf50f('0x44')](handleError(_0x5c30d0,null));};exports['getActions']=function(_0x239355,_0x11dd53,_0x17c8f8){var _0x51e58e={};var _0x50e330={};var _0xda6c78;var _0x2d5d31;return db[_0xf50f('0x2e')][_0xf50f('0x50')]({'where':{'id':_0x239355[_0xf50f('0x46')]['id']}})[_0xf50f('0x26')](handleEntityNotFound(_0x11dd53,null))[_0xf50f('0x26')](function(_0x465a54){if(_0x465a54){_0xda6c78=_0x465a54;_0x50e330[_0xf50f('0x37')]=_['keys'](db[_0xf50f('0x54')]['rawAttributes']);_0x50e330['query']=_['keys'](_0x239355[_0xf50f('0x33')]);_0x50e330['filters']=_[_0xf50f('0x36')](_0x50e330[_0xf50f('0x37')],_0x50e330[_0xf50f('0x33')]);_0x51e58e['attributes']=_[_0xf50f('0x36')](_0x50e330[_0xf50f('0x37')],qs['fields'](_0x239355[_0xf50f('0x33')][_0xf50f('0x38')]));_0x51e58e[_0xf50f('0x35')]=_0x51e58e[_0xf50f('0x35')][_0xf50f('0x39')]?_0x51e58e[_0xf50f('0x35')]:_0x50e330[_0xf50f('0x37')];_0x51e58e[_0xf50f('0x3c')]=qs[_0xf50f('0x3d')](_0x239355[_0xf50f('0x33')]['sort']);_0x51e58e[_0xf50f('0x3e')]=qs[_0xf50f('0x34')](_[_0xf50f('0x51')](_0x239355['query'],_0x50e330[_0xf50f('0x34')]));if(_0x239355[_0xf50f('0x33')][_0xf50f('0x3f')]){_0x51e58e['where']=_[_0xf50f('0x41')](_0x51e58e[_0xf50f('0x3e')],{'$or':_[_0xf50f('0x2d')](_0x51e58e[_0xf50f('0x35')],function(_0x3cddec){var _0x4710b7={};_0x4710b7[_0x3cddec]={'$like':'%'+_0x239355[_0xf50f('0x33')][_0xf50f('0x3f')]+'%'};return _0x4710b7;})});}_0x51e58e=_[_0xf50f('0x41')]({},_0x51e58e,_0x239355[_0xf50f('0x52')]);return _0xda6c78[_0xf50f('0x55')](_0x51e58e);}})[_0xf50f('0x26')](function(_0x11c315){if(_0x11c315){_0x2d5d31=_0x11c315[_0xf50f('0x39')];if(!_0x239355['query'][_0xf50f('0x3a')](_0xf50f('0x3b'))){_0x51e58e['limit']=qs[_0xf50f('0x1e')](_0x239355[_0xf50f('0x33')][_0xf50f('0x1e')]);_0x51e58e['offset']=qs['offset'](_0x239355[_0xf50f('0x33')][_0xf50f('0x1d')]);}return _0xda6c78[_0xf50f('0x55')](_0x51e58e);}})[_0xf50f('0x26')](function(_0x524b8b){if(_0x524b8b){return _0x524b8b?{'count':_0x2d5d31,'rows':_0x524b8b}:null;}})[_0xf50f('0x26')](respondWithResult(_0x11dd53,null))[_0xf50f('0x44')](handleError(_0x11dd53,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index fdf2729..f5d3df6 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 _0x4d9f=['exports','define','Automation','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes'];(function(_0x1a6597,_0x17f51c){var _0x41eadd=function(_0xe9a407){while(--_0xe9a407){_0x1a6597['push'](_0x1a6597['shift']());}};_0x41eadd(++_0x17f51c);}(_0x4d9f,0xdb));var _0xf4d9=function(_0x19a2d3,_0xe8232a){_0x19a2d3=_0x19a2d3-0x0;var _0xbbae3f=_0x4d9f[_0x19a2d3];return _0xbbae3f;};'use strict';var _=require('lodash');var util=require(_0xf4d9('0x0'));var logger=require(_0xf4d9('0x1'))(_0xf4d9('0x2'));var moment=require(_0xf4d9('0x3'));var BPromise=require(_0xf4d9('0x4'));var rp=require(_0xf4d9('0x5'));var fs=require('fs');var path=require(_0xf4d9('0x6'));var rimraf=require('rimraf');var config=require(_0xf4d9('0x7'));var attributes=require(_0xf4d9('0x8'));module[_0xf4d9('0x9')]=function(_0x23cd94,_0x28b9c9){return _0x23cd94[_0xf4d9('0xa')](_0xf4d9('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20a6=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x20a6,0x180));var _0x620a=function(_0x537d24,_0x5be0f1){_0x537d24=_0x537d24-0x0;var _0x4531c7=_0x20a6[_0x537d24];return _0x4531c7;};'use strict';var _=require(_0x620a('0x0'));var util=require(_0x620a('0x1'));var logger=require('../../config/logger')(_0x620a('0x2'));var moment=require(_0x620a('0x3'));var BPromise=require(_0x620a('0x4'));var rp=require(_0x620a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x620a('0x6'));var attributes=require(_0x620a('0x7'));module[_0x620a('0x8')]=function(_0x28e058,_0x3c6773){return _0x28e058[_0x620a('0x9')](_0x620a('0xa'),attributes,{'tableName':_0x620a('0xb'),'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 fdf8f74..a26637a 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 _0x91b6=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x15ce3a,_0x1cf22c){var _0x202f3b=function(_0xd3605e){while(--_0xd3605e){_0x15ce3a['push'](_0x15ce3a['shift']());}};_0x202f3b(++_0x1cf22c);}(_0x91b6,0x18b));var _0x691b=function(_0x181707,_0x47d753){_0x181707=_0x181707-0x0;var _0x1d2b7a=_0x91b6[_0x181707];return _0x1d2b7a;};'use strict';var _=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var moment=require('moment');var BPromise=require(_0x691b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x691b('0x3'))['db'];var utils=require(_0x691b('0x4'));var logger=require(_0x691b('0x5'))(_0x691b('0x6'));var config=require(_0x691b('0x7'));var jayson=require(_0x691b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x448027,_0x1ebd9c,_0x4ff18c){return new BPromise(function(_0x223632,_0xceca6a){return client[_0x691b('0x9')](_0x448027,_0x4ff18c)[_0x691b('0xa')](function(_0xbd8767){logger[_0x691b('0xb')](_0x691b('0xc'),_0x1ebd9c,_0x691b('0xd'));logger['debug'](_0x691b('0xe'),_0x1ebd9c,_0x691b('0xd'),JSON[_0x691b('0xf')](_0xbd8767));if(_0xbd8767[_0x691b('0x10')]){if(_0xbd8767[_0x691b('0x10')][_0x691b('0x11')]===0x1f4){logger['error'](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0xceca6a(_0xbd8767[_0x691b('0x10')]['message']);}logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0x223632(_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);}else{logger[_0x691b('0xb')]('Automation,\x20%s,\x20%s',_0x1ebd9c,_0x691b('0xd'));_0x223632(_0xbd8767['result'][_0x691b('0x12')]);}})[_0x691b('0x13')](function(_0x2e4f84){logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0x2e4f84);_0xceca6a(_0x2e4f84);});});} \ No newline at end of file +var _0xb94c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xb94c,0x176));var _0xcb94=function(_0x43e101,_0x5f51f3){_0x43e101=_0x43e101-0x0;var _0x2d8e7f=_0xb94c[_0x43e101];return _0x2d8e7f;};'use strict';var _=require(_0xcb94('0x0'));var util=require(_0xcb94('0x1'));var moment=require('moment');var BPromise=require(_0xcb94('0x2'));var rs=require(_0xcb94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb94('0x5'))(_0xcb94('0x6'));var config=require(_0xcb94('0x7'));var jayson=require(_0xcb94('0x8'));var client=jayson[_0xcb94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab328,_0x27441c,_0x20f879){return new BPromise(function(_0x22cac1,_0x16288f){return client['request'](_0x3ab328,_0x20f879)[_0xcb94('0xa')](function(_0x3305c9){logger[_0xcb94('0xb')](_0xcb94('0xc'),_0x27441c,'request\x20sent');logger[_0xcb94('0xd')](_0xcb94('0xe'),_0x27441c,_0xcb94('0xf'),JSON[_0xcb94('0x10')](_0x3305c9));if(_0x3305c9[_0xcb94('0x11')]){if(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x12')]===0x1f4){logger[_0xcb94('0x11')](_0xcb94('0xc'),_0x27441c,_0x3305c9[_0xcb94('0x11')]['message']);return _0x16288f(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x13')]);}logger['error']('Automation,\x20%s,\x20%s',_0x27441c,_0x3305c9['error']['message']);return _0x22cac1(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x13')]);}else{logger[_0xcb94('0xb')]('Automation,\x20%s,\x20%s',_0x27441c,_0xcb94('0xf'));_0x22cac1(_0x3305c9['result'][_0xcb94('0x13')]);}})[_0xcb94('0x14')](function(_0x3dbfbb){logger[_0xcb94('0x11')](_0xcb94('0xc'),_0x27441c,_0x3dbfbb);_0x16288f(_0x3dbfbb);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 86d4202..970c2fa 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 _0x8ebf=['create','/:id/conditions','addConditions','addActions','put','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/actions','post'];(function(_0x23dcb0,_0x1d33d8){var _0x64f3a3=function(_0x55af46){while(--_0x55af46){_0x23dcb0['push'](_0x23dcb0['shift']());}};_0x64f3a3(++_0x1d33d8);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x8ebf[_0x4687df];return _0x32eaef;};'use strict';var multer=require(_0xf8eb('0x0'));var util=require(_0xf8eb('0x1'));var path=require(_0xf8eb('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8eb('0x3'));var router=express[_0xf8eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf8eb('0x5'));var interaction=require(_0xf8eb('0x6'));var config=require(_0xf8eb('0x7'));var controller=require('./automation.controller');router[_0xf8eb('0x8')]('/',auth[_0xf8eb('0x9')](),controller['index']);router[_0xf8eb('0x8')](_0xf8eb('0xa'),auth[_0xf8eb('0x9')](),controller['show']);router[_0xf8eb('0x8')]('/:id/conditions',auth[_0xf8eb('0x9')](),controller['getConditions']);router[_0xf8eb('0x8')](_0xf8eb('0xb'),auth[_0xf8eb('0x9')](),controller['getActions']);router[_0xf8eb('0xc')]('/',auth[_0xf8eb('0x9')](),controller[_0xf8eb('0xd')]);router[_0xf8eb('0xc')](_0xf8eb('0xe'),auth[_0xf8eb('0x9')](),controller[_0xf8eb('0xf')]);router[_0xf8eb('0xc')]('/:id/actions',auth[_0xf8eb('0x9')](),controller[_0xf8eb('0x10')]);router[_0xf8eb('0x11')](_0xf8eb('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf8eb('0x9')](),controller[_0xf8eb('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc688=['put','update','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','/:id','/:id/conditions','getConditions','/:id/actions','isAuthenticated','getActions','post','create','addConditions','addActions'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xc688,0xc0));var _0x8c68=function(_0x57bb78,_0x33873a){_0x57bb78=_0x57bb78-0x0;var _0x3fdb0b=_0xc688[_0x57bb78];return _0x3fdb0b;};'use strict';var multer=require(_0x8c68('0x0'));var util=require(_0x8c68('0x1'));var path=require('path');var timeout=require(_0x8c68('0x2'));var express=require(_0x8c68('0x3'));var router=express['Router']();var fs_extra=require(_0x8c68('0x4'));var auth=require(_0x8c68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c68('0x6'));var controller=require('./automation.controller');router[_0x8c68('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8c68('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x8c68('0x7')](_0x8c68('0x9'),auth['isAuthenticated'](),controller[_0x8c68('0xa')]);router['get'](_0x8c68('0xb'),auth[_0x8c68('0xc')](),controller[_0x8c68('0xd')]);router[_0x8c68('0xe')]('/',auth['isAuthenticated'](),controller[_0x8c68('0xf')]);router[_0x8c68('0xe')](_0x8c68('0x9'),auth['isAuthenticated'](),controller[_0x8c68('0x10')]);router[_0x8c68('0xe')](_0x8c68('0xb'),auth[_0x8c68('0xc')](),controller[_0x8c68('0x11')]);router[_0x8c68('0x12')](_0x8c68('0x8'),auth[_0x8c68('0xc')](),controller[_0x8c68('0x13')]);router['delete'](_0x8c68('0x8'),auth['isAuthenticated'](),controller[_0x8c68('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 0fc1ffb..2496c86 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 _0x6665=['07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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\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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x315011,_0x3dfb3e){var _0x569d4b=function(_0x31dda7){while(--_0x31dda7){_0x315011['push'](_0x315011['shift']());}};_0x569d4b(++_0x3dfb3e);}(_0x6665,0x88));var _0x5666=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x6665[_0x4e5552];return _0x60a338;};'use strict';var Sequelize=require(_0x5666('0x0'));module[_0x5666('0x1')]={'name':{'type':Sequelize[_0x5666('0x2')],'unique':_0x5666('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5666('0x4')](_0x5666('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x5666('0x2')]},'active':{'type':Sequelize[_0x5666('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x5666('0x7')](0x4)[_0x5666('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5666('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5666('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5666('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('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[_0x5666('0x2')],'defaultValue':_0x5666('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5666('0xf'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5666('0x6')],'defaultValue':0x0,'comment':_0x5666('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x5666('0x7')](0x9)[_0x5666('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5666('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x5666('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5666('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5666('0x7')](0x9)[_0x5666('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5666('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x5666('0x7')](0x9)[_0x5666('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5666('0x7')](0x9)[_0x5666('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5666('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5666('0x13')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5666('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x5666('0x4')](_0x5666('0x14'),'ASC'),'defaultValue':_0x5666('0x14')},'dialPrefix':{'type':Sequelize[_0x5666('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5666('0x15')},'dialCutDigit':{'type':Sequelize[_0x5666('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5666('0x16')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0x17')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0x18')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0x19')},'dialDropRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0x1a')},'dialMachineMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0x1b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0x1c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x58a3=['#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x50c074,_0x116dd0){var _0x2d8088=function(_0x2502e1){while(--_0x2502e1){_0x50c074['push'](_0x50c074['shift']());}};_0x2d8088(++_0x116dd0);}(_0x58a3,0xfc));var _0x358a=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x58a3[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0x358a('0x0'));module[_0x358a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x358a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x358a('0x3')](_0x358a('0x4')),'allowNull':![],'defaultValue':_0x358a('0x4')},'description':{'type':Sequelize[_0x358a('0x5')]},'active':{'type':Sequelize[_0x358a('0x6')],'defaultValue':0x0,'comment':_0x358a('0x7')},'limitCalls':{'type':Sequelize[_0x358a('0x8')](0x4)[_0x358a('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x358a('0xa')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x358a('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x358a('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x358a('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x358a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x358a('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x358a('0x8')](0x5)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x358a('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x358a('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x358a('0xe')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x358a('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x358a('0x10')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x358a('0x11')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x358a('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x358a('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x358a('0x13'),_0x358a('0x14'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x358a('0x6')],'defaultValue':0x0,'comment':_0x358a('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x358a('0x8')](0x9)[_0x358a('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x358a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x358a('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x358a('0x8')](0x9)[_0x358a('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x358a('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x358a('0x8')](0x9)[_0x358a('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x358a('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x358a('0x8')](0x9)[_0x358a('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x358a('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x358a('0x8')](0x9)[_0x358a('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x358a('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x358a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x358a('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x358a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x358a('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x358a('0x8')](0x9)[_0x358a('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x358a('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x358a('0x1e'),'ASC'),'defaultValue':_0x358a('0x1e')},'dialPrefix':{'type':Sequelize[_0x358a('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x358a('0x8')](0x3)[_0x358a('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x358a('0x1f')},'dialCutDigit':{'type':Sequelize[_0x358a('0x8')](0x3)[_0x358a('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x358a('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x358a('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x358a('0x8')](0x5)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x358a('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x358a('0x8')](0x3)[_0x358a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x358a('0x8')](0x5)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x358a('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x358a('0x8')](0x3)[_0x358a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x358a('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x358a('0x8')](0x5)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x358a('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x358a('0x8')](0x3)[_0x358a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x358a('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x358a('0x8')](0x5)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x358a('0x8')](0x3)[_0x358a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x358a('0x8')](0x5)[_0x358a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 88f4d8d..035c337 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 _0xd403=['onlyIfOpen','insert','cm_contacts','CampaignId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','Campaign','find','create','body','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','role','UserProfileSection','getHoppers','findOne','CmHopper','pick','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','NOW()','field','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','from','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)'];(function(_0x320fec,_0x49c104){var _0x158c82=function(_0x2f4668){while(--_0x2f4668){_0x320fec['push'](_0x320fec['shift']());}};_0x158c82(++_0x49c104);}(_0xd403,0x1d5));var _0x3d40=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd403[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0x3d40('0x0'));var rimraf=require(_0x3d40('0x1'));var zipdir=require(_0x3d40('0x2'));var jsonpatch=require(_0x3d40('0x3'));var rp=require('request-promise');var moment=require(_0x3d40('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3d40('0x5'));var util=require(_0x3d40('0x6'));var path=require(_0x3d40('0x7'));var sox=require(_0x3d40('0x8'));var csv=require(_0x3d40('0x9'));var ejs=require(_0x3d40('0xa'));var fs=require('fs');var fs_extra=require(_0x3d40('0xb'));var _=require(_0x3d40('0xc'));var squel=require(_0x3d40('0xd'));var crypto=require(_0x3d40('0xe'));var jsforce=require(_0x3d40('0xf'));var deskjs=require(_0x3d40('0x10'));var toCsv=require(_0x3d40('0x9'));var querystring=require(_0x3d40('0x11'));var Papa=require(_0x3d40('0x12'));var Redis=require(_0x3d40('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3d40('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d40('0x15'));var logger=require(_0x3d40('0x16'))(_0x3d40('0x17'));var utils=require('../../config/utils');var config=require(_0x3d40('0x18'));var licenseUtil=require(_0x3d40('0x19'));var db=require(_0x3d40('0x1a'))['db'];function respondWithStatusCode(_0x49ea7c,_0x31c199){_0x31c199=_0x31c199||0xcc;return function(_0x405625){if(_0x405625){return _0x49ea7c['sendStatus'](_0x31c199);}return _0x49ea7c['status'](_0x31c199)[_0x3d40('0x1b')]();};}function respondWithResult(_0x24d2c0,_0x3e6d19){_0x3e6d19=_0x3e6d19||0xc8;return function(_0x5062ec){if(_0x5062ec){return _0x24d2c0[_0x3d40('0x1c')](_0x3e6d19)[_0x3d40('0x1d')](_0x5062ec);}};}function respondWithFilteredResult(_0x311d57,_0x3e6e71){return function(_0x2b5e2d){if(_0x2b5e2d){var _0x359e9d=typeof _0x3e6e71[_0x3d40('0x1e')]==='undefined'&&typeof _0x3e6e71['limit']===_0x3d40('0x1f');var _0x2f38e1=_0x2b5e2d[_0x3d40('0x20')];var _0x75437e=_0x359e9d?0x0:_0x3e6e71[_0x3d40('0x1e')];var _0x2f3663=_0x359e9d?_0x2b5e2d[_0x3d40('0x20')]:_0x3e6e71[_0x3d40('0x1e')]+_0x3e6e71[_0x3d40('0x21')];var _0x402b4e;if(_0x2f3663>=_0x2f38e1){_0x2f3663=_0x2f38e1;_0x402b4e=0xc8;}else{_0x402b4e=0xce;}_0x311d57[_0x3d40('0x1c')](_0x402b4e);return _0x311d57['set']('Content-Range',_0x75437e+'-'+_0x2f3663+'/'+_0x2f38e1)[_0x3d40('0x1d')](_0x2b5e2d);}return null;};}function patchUpdates(_0x41608f){return function(_0x2fc0e2){try{jsonpatch[_0x3d40('0x22')](_0x2fc0e2,_0x41608f,!![]);}catch(_0x28b1c0){return BPromise[_0x3d40('0x23')](_0x28b1c0);}return _0x2fc0e2[_0x3d40('0x24')]();};}function saveUpdates(_0xbd7298,_0x3df1f9){return function(_0x321bc2){if(_0x321bc2){return _0x321bc2[_0x3d40('0x25')](_0xbd7298)[_0x3d40('0x26')](function(_0x181688){return _0x181688;});}return null;};}function removeEntity(_0x5314c5,_0x1a2d0f){return function(_0x14cad3){if(_0x14cad3){return _0x14cad3[_0x3d40('0x27')]()[_0x3d40('0x26')](function(){var _0x645da4=_0x14cad3['get']({'plain':!![]});var _0x45aa46=_0x3d40('0x28');return db[_0x3d40('0x29')][_0x3d40('0x27')]({'where':{'type':_0x45aa46,'resourceId':_0x645da4['id']}})[_0x3d40('0x26')](function(){return _0x14cad3;});})['then'](function(){_0x5314c5[_0x3d40('0x1c')](0xcc)[_0x3d40('0x1b')]();});}};}function handleEntityNotFound(_0x4e4ee9,_0x412d46){return function(_0x1f94ac){if(!_0x1f94ac){_0x4e4ee9[_0x3d40('0x2a')](0x194);}return _0x1f94ac;};}function handleError(_0x537790,_0x38ff70){_0x38ff70=_0x38ff70||0x1f4;return function(_0x265c2c){logger[_0x3d40('0x2b')](_0x265c2c[_0x3d40('0x2c')]);if(_0x265c2c[_0x3d40('0x2d')]){delete _0x265c2c[_0x3d40('0x2d')];}_0x537790[_0x3d40('0x1c')](_0x38ff70)[_0x3d40('0x2e')](_0x265c2c);};}exports['index']=function(_0x4e536f,_0x394fab){var _0xcb3c3b={},_0x5071b9={},_0x2c1ce6={'count':0x0,'rows':[]};var _0x4f235f=_[_0x3d40('0x2f')](db['Campaign'][_0x3d40('0x30')],function(_0xbff1f2){return{'name':_0xbff1f2[_0x3d40('0x31')],'type':_0xbff1f2[_0x3d40('0x32')][_0x3d40('0x33')]};});_0x5071b9['model']=_['map'](_0x4f235f,_0x3d40('0x2d'));_0x5071b9[_0x3d40('0x34')]=_[_0x3d40('0x35')](_0x4e536f['query']);_0x5071b9[_0x3d40('0x36')]=_['intersection'](_0x5071b9['model'],_0x5071b9['query']);_0xcb3c3b[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x5071b9[_0x3d40('0x39')],qs[_0x3d40('0x3a')](_0x4e536f[_0x3d40('0x34')][_0x3d40('0x3a')]));_0xcb3c3b[_0x3d40('0x37')]=_0xcb3c3b[_0x3d40('0x37')][_0x3d40('0x3b')]?_0xcb3c3b['attributes']:_0x5071b9['model'];if(!_0x4e536f[_0x3d40('0x34')][_0x3d40('0x3c')](_0x3d40('0x3d'))){_0xcb3c3b[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x4e536f[_0x3d40('0x34')]['limit']);_0xcb3c3b[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x4e536f[_0x3d40('0x34')]['offset']);}_0xcb3c3b[_0x3d40('0x3e')]=qs['sort'](_0x4e536f[_0x3d40('0x34')][_0x3d40('0x3f')]);_0xcb3c3b['where']=qs[_0x3d40('0x36')](_['pick'](_0x4e536f['query'],_0x5071b9[_0x3d40('0x36')]),_0x4f235f);if(_0x4e536f[_0x3d40('0x34')]['filter']){_0xcb3c3b[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0xcb3c3b[_0x3d40('0x40')],{'$or':_['map'](_0x4f235f,function(_0x295418){if(_0x295418[_0x3d40('0x32')]!==_0x3d40('0x42')){var _0x2c45c5={};_0x2c45c5[_0x295418[_0x3d40('0x2d')]]={'$like':'%'+_0x4e536f[_0x3d40('0x34')][_0x3d40('0x43')]+'%'};return _0x2c45c5;}})});}_0xcb3c3b=_[_0x3d40('0x41')]({},_0xcb3c3b,_0x4e536f[_0x3d40('0x44')]);var _0x322030={'where':_0xcb3c3b[_0x3d40('0x40')]};return db['Campaign'][_0x3d40('0x20')](_0x322030)['then'](function(_0x575268){_0x2c1ce6['count']=_0x575268;if(_0x4e536f[_0x3d40('0x34')][_0x3d40('0x45')]){_0xcb3c3b[_0x3d40('0x46')]=[{'all':!![]}];}return db['Campaign'][_0x3d40('0x47')](_0xcb3c3b);})[_0x3d40('0x26')](function(_0x46e59d){_0x2c1ce6[_0x3d40('0x48')]=_0x46e59d;return _0x2c1ce6;})['then'](respondWithFilteredResult(_0x394fab,_0xcb3c3b))[_0x3d40('0x49')](handleError(_0x394fab,null));};exports[_0x3d40('0x4a')]=function(_0x17becc,_0x1be4a9){var _0xdde7e4={'raw':![],'where':{'id':_0x17becc[_0x3d40('0x4b')]['id']}},_0x4387f5={};_0x4387f5[_0x3d40('0x39')]=_[_0x3d40('0x35')](db[_0x3d40('0x4c')]['rawAttributes']);_0x4387f5['query']=_[_0x3d40('0x35')](_0x17becc[_0x3d40('0x34')]);_0x4387f5[_0x3d40('0x36')]=_[_0x3d40('0x38')](_0x4387f5[_0x3d40('0x39')],_0x4387f5[_0x3d40('0x34')]);_0xdde7e4[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x4387f5[_0x3d40('0x39')],qs['fields'](_0x17becc['query'][_0x3d40('0x3a')]));_0xdde7e4[_0x3d40('0x37')]=_0xdde7e4[_0x3d40('0x37')][_0x3d40('0x3b')]?_0xdde7e4[_0x3d40('0x37')]:_0x4387f5['model'];if(_0x17becc[_0x3d40('0x34')][_0x3d40('0x45')]){_0xdde7e4['include']=[{'all':!![]}];}_0xdde7e4=_['merge']({},_0xdde7e4,_0x17becc['options']);return db[_0x3d40('0x4c')][_0x3d40('0x4d')](_0xdde7e4)[_0x3d40('0x26')](handleEntityNotFound(_0x1be4a9,null))['then'](respondWithResult(_0x1be4a9,null))[_0x3d40('0x49')](handleError(_0x1be4a9,null));};exports['create']=function(_0x580eee,_0xa3ba73){return db[_0x3d40('0x4c')][_0x3d40('0x4e')](_0x580eee[_0x3d40('0x4f')],{})['then'](function(_0xb99156){var _0x5d957d=_0x580eee[_0x3d40('0x50')][_0x3d40('0x51')]({'plain':!![]});if(!_0x5d957d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d957d['role']===_0x3d40('0x50')){var _0x1448c4=_0xb99156[_0x3d40('0x51')]({'plain':!![]});var _0x23eadf=_0x3d40('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x23eadf,'userProfileId':_0x5d957d[_0x3d40('0x52')]},'raw':!![]})[_0x3d40('0x26')](function(_0x333538){if(_0x333538&&_0x333538[_0x3d40('0x53')]===0x0){return db[_0x3d40('0x29')][_0x3d40('0x4e')]({'name':_0x1448c4['name'],'resourceId':_0x1448c4['id'],'type':_0x333538[_0x3d40('0x2d')],'sectionId':_0x333538['id']},{})[_0x3d40('0x26')](function(){return _0xb99156;});}else{return _0xb99156;}})[_0x3d40('0x49')](function(_0x10223d){logger[_0x3d40('0x2b')](_0x3d40('0x54'),_0x10223d);throw _0x10223d;});}return _0xb99156;})[_0x3d40('0x26')](respondWithResult(_0xa3ba73,0xc9))[_0x3d40('0x49')](handleError(_0xa3ba73,null));};exports[_0x3d40('0x55')]=function(_0x189e80,_0x40eb86){var _0x1ab188={'where':{'id':_0x189e80[_0x3d40('0x4b')]['id']}},_0x427f2a={};_0x427f2a['model']=_['keys'](db['Campaign']['rawAttributes']);_0x1ab188['attributes']=_[_0x3d40('0x38')](_0x427f2a['model'],qs[_0x3d40('0x3a')](_0x189e80[_0x3d40('0x34')]['fields']));_0x1ab188[_0x3d40('0x37')]=_0x1ab188[_0x3d40('0x37')]['length']?_0x1ab188[_0x3d40('0x37')]:_0x427f2a[_0x3d40('0x39')];if(_0x189e80[_0x3d40('0x34')]['includeAll']){_0x1ab188[_0x3d40('0x46')]=[{'all':!![]}];}_0x1ab188=_['merge']({},_0x1ab188,_0x189e80[_0x3d40('0x44')]);return db['Campaign']['find'](_0x1ab188)['then'](handleEntityNotFound(_0x40eb86,null))[_0x3d40('0x26')](function(_0x18626d){if(_0x18626d){var _0x5ad181=_0x18626d[_0x3d40('0x51')]({'plain':!![]});_0x5ad181=qs['omit'](_0x5ad181,['id','createdAt',_0x3d40('0x56')]);_0x189e80['body']=_[_0x3d40('0x57')](_0x189e80['body'],['id','createdAt',_0x3d40('0x56')]);return db['Campaign'][_0x3d40('0x4e')](_[_0x3d40('0x41')](_0x5ad181,_0x189e80[_0x3d40('0x4f')]),{'include':_0x189e80[_0x3d40('0x34')][_0x3d40('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x358999){var _0x1d6445=_0x189e80[_0x3d40('0x50')][_0x3d40('0x51')]({'plain':!![]});if(!_0x1d6445)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d6445[_0x3d40('0x58')]===_0x3d40('0x50')){var _0x4600a2=_0x358999['get']({'plain':!![]});var _0x44d093=_0x3d40('0x28');return db[_0x3d40('0x59')][_0x3d40('0x4d')]({'where':{'name':_0x44d093,'userProfileId':_0x1d6445[_0x3d40('0x52')]},'raw':!![]})['then'](function(_0x850ccc){if(_0x850ccc&&_0x850ccc[_0x3d40('0x53')]===0x0){return db[_0x3d40('0x29')][_0x3d40('0x4e')]({'name':_0x4600a2[_0x3d40('0x2d')],'resourceId':_0x4600a2['id'],'type':_0x850ccc[_0x3d40('0x2d')],'sectionId':_0x850ccc['id']},{})[_0x3d40('0x26')](function(){return _0x358999;});}else{return _0x358999;}})['catch'](function(_0x5d14f8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d14f8);throw _0x5d14f8;});}return _0x358999;});}})[_0x3d40('0x26')](respondWithResult(_0x40eb86,0xc9))['catch'](handleError(_0x40eb86,null));};exports[_0x3d40('0x25')]=function(_0x471d78,_0x19f033){if(_0x471d78[_0x3d40('0x4f')]['id']){delete _0x471d78[_0x3d40('0x4f')]['id'];}return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x471d78[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x19f033,null))['then'](saveUpdates(_0x471d78[_0x3d40('0x4f')],null))[_0x3d40('0x26')](respondWithResult(_0x19f033,null))[_0x3d40('0x49')](handleError(_0x19f033,null));};exports[_0x3d40('0x27')]=function(_0x46ef8e,_0x25637f){return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x46ef8e[_0x3d40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25637f,null))[_0x3d40('0x26')](removeEntity(_0x25637f,null))[_0x3d40('0x49')](handleError(_0x25637f,null));};exports[_0x3d40('0x5a')]=function(_0x11fc54,_0x2cfc63,_0x213ea9){var _0x4dc423={'raw':!![],'where':{}};var _0x4409a2={};var _0x5cea69={'count':0x0,'rows':[]};return db[_0x3d40('0x4c')][_0x3d40('0x5b')]({'where':{'id':_0x11fc54['params']['id']}})['then'](handleEntityNotFound(_0x2cfc63,null))[_0x3d40('0x26')](function(_0xa531d1){if(_0xa531d1){_0x4409a2[_0x3d40('0x39')]=_['keys'](db[_0x3d40('0x5c')][_0x3d40('0x30')]);_0x4409a2[_0x3d40('0x34')]=_['keys'](_0x11fc54[_0x3d40('0x34')]);_0x4409a2['filters']=_[_0x3d40('0x38')](_0x4409a2[_0x3d40('0x39')],_0x4409a2[_0x3d40('0x34')]);_0x4dc423[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x4409a2['model'],qs[_0x3d40('0x3a')](_0x11fc54['query']['fields']));_0x4dc423[_0x3d40('0x37')]=_0x4dc423['attributes'][_0x3d40('0x3b')]?_0x4dc423[_0x3d40('0x37')]:_0x4409a2[_0x3d40('0x39')];if(!_0x11fc54['query']['hasOwnProperty'](_0x3d40('0x3d'))){_0x4dc423[_0x3d40('0x21')]=qs['limit'](_0x11fc54['query'][_0x3d40('0x21')]);_0x4dc423['offset']=qs[_0x3d40('0x1e')](_0x11fc54[_0x3d40('0x34')][_0x3d40('0x1e')]);}_0x4dc423['order']=qs[_0x3d40('0x3f')](_0x11fc54[_0x3d40('0x34')][_0x3d40('0x3f')]);_0x4dc423[_0x3d40('0x40')]=qs[_0x3d40('0x36')](_[_0x3d40('0x5d')](_0x11fc54[_0x3d40('0x34')],_0x4409a2['filters']));_0x4dc423[_0x3d40('0x40')]['CampaignId']=_0xa531d1['id'];if(_0x11fc54[_0x3d40('0x34')][_0x3d40('0x43')]){_0x4dc423[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x4dc423[_0x3d40('0x40')],{'$or':_['map'](_0x4dc423[_0x3d40('0x37')],function(_0x183b7d){var _0x5416f3={};_0x5416f3[_0x183b7d]={'$like':'%'+_0x11fc54[_0x3d40('0x34')]['filter']+'%'};return _0x5416f3;})});}_0x4dc423=_[_0x3d40('0x41')]({},_0x4dc423,_0x11fc54[_0x3d40('0x44')]);return db[_0x3d40('0x5c')][_0x3d40('0x20')]({'where':_0x4dc423[_0x3d40('0x40')]})[_0x3d40('0x26')](function(_0x15e576){_0x5cea69['count']=_0x15e576;if(_0x11fc54[_0x3d40('0x34')][_0x3d40('0x45')]){_0x4dc423[_0x3d40('0x46')]=[{'all':!![]}];}return db[_0x3d40('0x5c')]['findAll'](_0x4dc423);})[_0x3d40('0x26')](function(_0x1e84f0){_0x5cea69[_0x3d40('0x48')]=_0x1e84f0;return _0x5cea69;});}})['then'](respondWithFilteredResult(_0x2cfc63,_0x4dc423))[_0x3d40('0x49')](handleError(_0x2cfc63,null));};exports['getHopperHistories']=function(_0x8883b2,_0x4647e5,_0x5bdbd8){var _0x317dcf={'raw':!![],'where':{}};var _0x568ba9={};var _0x229865={'count':0x0,'rows':[]};return db[_0x3d40('0x4c')][_0x3d40('0x5b')]({'where':{'id':_0x8883b2[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x4647e5,null))[_0x3d40('0x26')](function(_0x2916f9){if(_0x2916f9){_0x568ba9[_0x3d40('0x39')]=_[_0x3d40('0x35')](db['CmHopperHistory'][_0x3d40('0x30')]);_0x568ba9['query']=_[_0x3d40('0x35')](_0x8883b2[_0x3d40('0x34')]);_0x568ba9['filters']=_[_0x3d40('0x38')](_0x568ba9[_0x3d40('0x39')],_0x568ba9[_0x3d40('0x34')]);_0x317dcf['attributes']=_[_0x3d40('0x38')](_0x568ba9['model'],qs[_0x3d40('0x3a')](_0x8883b2[_0x3d40('0x34')][_0x3d40('0x3a')]));_0x317dcf[_0x3d40('0x37')]=_0x317dcf[_0x3d40('0x37')][_0x3d40('0x3b')]?_0x317dcf[_0x3d40('0x37')]:_0x568ba9[_0x3d40('0x39')];if(!_0x8883b2[_0x3d40('0x34')]['hasOwnProperty'](_0x3d40('0x3d'))){_0x317dcf[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x8883b2[_0x3d40('0x34')][_0x3d40('0x21')]);_0x317dcf[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x8883b2[_0x3d40('0x34')][_0x3d40('0x1e')]);}_0x317dcf[_0x3d40('0x3e')]=qs[_0x3d40('0x3f')](_0x8883b2['query'][_0x3d40('0x3f')]);_0x317dcf[_0x3d40('0x40')]=qs['filters'](_[_0x3d40('0x5d')](_0x8883b2[_0x3d40('0x34')],_0x568ba9['filters']));_0x317dcf['where'][_0x3d40('0x5e')]=_0x2916f9['id'];if(_0x8883b2[_0x3d40('0x34')][_0x3d40('0x43')]){_0x317dcf[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x317dcf[_0x3d40('0x40')],{'$or':_['map'](_0x317dcf[_0x3d40('0x37')],function(_0x97a8f2){var _0x1aca85={};_0x1aca85[_0x97a8f2]={'$like':'%'+_0x8883b2[_0x3d40('0x34')][_0x3d40('0x43')]+'%'};return _0x1aca85;})});}_0x317dcf=_[_0x3d40('0x41')]({},_0x317dcf,_0x8883b2[_0x3d40('0x44')]);return db['CmHopperHistory']['count']({'where':_0x317dcf[_0x3d40('0x40')]})['then'](function(_0x1c0932){_0x229865['count']=_0x1c0932;if(_0x8883b2[_0x3d40('0x34')][_0x3d40('0x45')]){_0x317dcf[_0x3d40('0x46')]=[{'all':!![]}];}return db[_0x3d40('0x5f')][_0x3d40('0x47')](_0x317dcf);})[_0x3d40('0x26')](function(_0x496311){_0x229865[_0x3d40('0x48')]=_0x496311;return _0x229865;});}})['then'](respondWithFilteredResult(_0x4647e5,_0x317dcf))['catch'](handleError(_0x4647e5,null));};exports[_0x3d40('0x60')]=function(_0x3d8be8,_0x37ccdd,_0x44578d){var _0x49e8fe={'raw':!![],'where':{}};var _0x2fbfb5={};var _0x3cbdcf={'count':0x0,'rows':[]};return db['Campaign'][_0x3d40('0x5b')]({'where':{'id':_0x3d8be8[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x37ccdd,null))[_0x3d40('0x26')](function(_0x162945){if(_0x162945){_0x2fbfb5['model']=_['keys'](db[_0x3d40('0x61')][_0x3d40('0x30')]);_0x2fbfb5['query']=_[_0x3d40('0x35')](_0x3d8be8['query']);_0x2fbfb5[_0x3d40('0x36')]=_['intersection'](_0x2fbfb5['model'],_0x2fbfb5['query']);_0x49e8fe[_0x3d40('0x37')]=_['intersection'](_0x2fbfb5[_0x3d40('0x39')],qs[_0x3d40('0x3a')](_0x3d8be8[_0x3d40('0x34')][_0x3d40('0x3a')]));_0x49e8fe[_0x3d40('0x37')]=_0x49e8fe[_0x3d40('0x37')][_0x3d40('0x3b')]?_0x49e8fe['attributes']:_0x2fbfb5[_0x3d40('0x39')];if(!_0x3d8be8[_0x3d40('0x34')][_0x3d40('0x3c')](_0x3d40('0x3d'))){_0x49e8fe[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x3d8be8[_0x3d40('0x34')]['limit']);_0x49e8fe['offset']=qs[_0x3d40('0x1e')](_0x3d8be8[_0x3d40('0x34')][_0x3d40('0x1e')]);}_0x49e8fe[_0x3d40('0x3e')]=qs[_0x3d40('0x3f')](_0x3d8be8['query'][_0x3d40('0x3f')]);_0x49e8fe[_0x3d40('0x40')]=qs[_0x3d40('0x36')](_[_0x3d40('0x5d')](_0x3d8be8[_0x3d40('0x34')],_0x2fbfb5[_0x3d40('0x36')]));_0x49e8fe[_0x3d40('0x40')]['CampaignId']=_0x162945['id'];if(_0x3d8be8['query'][_0x3d40('0x43')]){_0x49e8fe[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x49e8fe[_0x3d40('0x40')],{'$or':_['map'](_0x49e8fe[_0x3d40('0x37')],function(_0x385429){var _0x362bec={};_0x362bec[_0x385429]={'$like':'%'+_0x3d8be8[_0x3d40('0x34')]['filter']+'%'};return _0x362bec;})});}_0x49e8fe=_[_0x3d40('0x41')]({},_0x49e8fe,_0x3d8be8['options']);return db[_0x3d40('0x61')][_0x3d40('0x20')]({'where':_0x49e8fe[_0x3d40('0x40')]})['then'](function(_0x49a656){_0x3cbdcf[_0x3d40('0x20')]=_0x49a656;if(_0x3d8be8['query'][_0x3d40('0x45')]){_0x49e8fe['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x3d40('0x47')](_0x49e8fe);})[_0x3d40('0x26')](function(_0x51917c){_0x3cbdcf[_0x3d40('0x48')]=_0x51917c;return _0x3cbdcf;});}})[_0x3d40('0x26')](respondWithFilteredResult(_0x37ccdd,_0x49e8fe))[_0x3d40('0x49')](handleError(_0x37ccdd,null));};exports[_0x3d40('0x62')]=function(_0x5512f4,_0x1495ae,_0x281525){var _0x42ca13={'raw':!![],'where':{}};var _0x4b0adb={};var _0x3345bc={'count':0x0,'rows':[]};return db[_0x3d40('0x4c')]['findOne']({'where':{'id':_0x5512f4[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x1495ae,null))[_0x3d40('0x26')](function(_0x382776){if(_0x382776){_0x4b0adb[_0x3d40('0x39')]=_[_0x3d40('0x35')](db['CmHopperBlack'][_0x3d40('0x30')]);_0x4b0adb[_0x3d40('0x34')]=_[_0x3d40('0x35')](_0x5512f4[_0x3d40('0x34')]);_0x4b0adb[_0x3d40('0x36')]=_[_0x3d40('0x38')](_0x4b0adb['model'],_0x4b0adb['query']);_0x42ca13[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x4b0adb['model'],qs['fields'](_0x5512f4['query'][_0x3d40('0x3a')]));_0x42ca13[_0x3d40('0x37')]=_0x42ca13[_0x3d40('0x37')]['length']?_0x42ca13[_0x3d40('0x37')]:_0x4b0adb['model'];if(!_0x5512f4[_0x3d40('0x34')][_0x3d40('0x3c')](_0x3d40('0x3d'))){_0x42ca13[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x5512f4[_0x3d40('0x34')][_0x3d40('0x21')]);_0x42ca13['offset']=qs[_0x3d40('0x1e')](_0x5512f4[_0x3d40('0x34')][_0x3d40('0x1e')]);}_0x42ca13[_0x3d40('0x3e')]=qs[_0x3d40('0x3f')](_0x5512f4[_0x3d40('0x34')]['sort']);_0x42ca13[_0x3d40('0x40')]=qs[_0x3d40('0x36')](_['pick'](_0x5512f4[_0x3d40('0x34')],_0x4b0adb[_0x3d40('0x36')]));_0x42ca13['where'][_0x3d40('0x5e')]=_0x382776['id'];if(_0x5512f4['query'][_0x3d40('0x43')]){_0x42ca13[_0x3d40('0x40')]=_['merge'](_0x42ca13[_0x3d40('0x40')],{'$or':_[_0x3d40('0x2f')](_0x42ca13['attributes'],function(_0x3bd591){var _0x16f64d={};_0x16f64d[_0x3bd591]={'$like':'%'+_0x5512f4[_0x3d40('0x34')][_0x3d40('0x43')]+'%'};return _0x16f64d;})});}_0x42ca13=_['merge']({},_0x42ca13,_0x5512f4['options']);return db[_0x3d40('0x63')][_0x3d40('0x20')]({'where':_0x42ca13[_0x3d40('0x40')]})['then'](function(_0x2ffed4){_0x3345bc['count']=_0x2ffed4;if(_0x5512f4['query'][_0x3d40('0x45')]){_0x42ca13[_0x3d40('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3d40('0x47')](_0x42ca13);})[_0x3d40('0x26')](function(_0x3773e9){_0x3345bc[_0x3d40('0x48')]=_0x3773e9;return _0x3345bc;});}})[_0x3d40('0x26')](respondWithFilteredResult(_0x1495ae,_0x42ca13))[_0x3d40('0x49')](handleError(_0x1495ae,null));};exports[_0x3d40('0x64')]=function(_0x230d49,_0x43d62d,_0xd243c4){var _0x334633={};var _0x4abce8={};var _0x3773e5;var _0x37a6bf;return db[_0x3d40('0x4c')][_0x3d40('0x5b')]({'where':{'id':_0x230d49[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x43d62d,null))['then'](function(_0x37bacc){if(_0x37bacc){_0x3773e5=_0x37bacc;_0x4abce8[_0x3d40('0x39')]=_[_0x3d40('0x35')](db['CmList']['rawAttributes']);_0x4abce8[_0x3d40('0x34')]=_[_0x3d40('0x35')](_0x230d49['query']);_0x4abce8[_0x3d40('0x36')]=_[_0x3d40('0x38')](_0x4abce8['model'],_0x4abce8['query']);_0x334633[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x4abce8['model'],qs['fields'](_0x230d49[_0x3d40('0x34')][_0x3d40('0x3a')]));_0x334633['attributes']=_0x334633['attributes'][_0x3d40('0x3b')]?_0x334633['attributes']:_0x4abce8[_0x3d40('0x39')];_0x334633['order']=qs[_0x3d40('0x3f')](_0x230d49[_0x3d40('0x34')][_0x3d40('0x3f')]);_0x334633['where']=qs[_0x3d40('0x36')](_[_0x3d40('0x5d')](_0x230d49[_0x3d40('0x34')],_0x4abce8[_0x3d40('0x36')]));if(_0x230d49[_0x3d40('0x34')][_0x3d40('0x43')]){_0x334633[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x334633[_0x3d40('0x40')],{'$or':_['map'](_0x334633[_0x3d40('0x37')],function(_0xc92421){var _0x58f6a7={};_0x58f6a7[_0xc92421]={'$like':'%'+_0x230d49[_0x3d40('0x34')]['filter']+'%'};return _0x58f6a7;})});}_0x334633=_[_0x3d40('0x41')]({},_0x334633,_0x230d49[_0x3d40('0x44')]);return _0x3773e5[_0x3d40('0x64')](_0x334633);}})[_0x3d40('0x26')](function(_0x5b0f25){if(_0x5b0f25){_0x37a6bf=_0x5b0f25[_0x3d40('0x3b')];if(!_0x230d49['query'][_0x3d40('0x3c')](_0x3d40('0x3d'))){_0x334633[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x230d49[_0x3d40('0x34')][_0x3d40('0x21')]);_0x334633[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x230d49[_0x3d40('0x34')][_0x3d40('0x1e')]);}return _0x3773e5['getLists'](_0x334633);}})[_0x3d40('0x26')](function(_0x5d4a70){if(_0x5d4a70){return _0x5d4a70?{'count':_0x37a6bf,'rows':_0x5d4a70}:null;}})[_0x3d40('0x26')](respondWithResult(_0x43d62d,null))[_0x3d40('0x49')](handleError(_0x43d62d,null));};exports[_0x3d40('0x65')]=function(_0xf3c644,_0x26309d,_0x1d8f41){var _0x39bf67,_0x43e18e;var _0x1d5a17=[];var _0x836dc7=moment()['format'](_0x3d40('0x66'));return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0xf3c644[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x26309d,null))[_0x3d40('0x26')](function(_0x41d3ca){if(_0x41d3ca){_0x43e18e=_0x41d3ca;return _0x41d3ca['addLists'](_0xf3c644[_0x3d40('0x4f')]['ids'],_[_0x3d40('0x57')](_0xf3c644['body'],[_0x3d40('0x67'),'id'])||{});}return null;})[_0x3d40('0x68')](function(_0x1b80d6){var _0x275a02;var _0x49848e;_0x39bf67=_0x1b80d6||[];var _0x3eda3d=[];if(_0x1b80d6){for(var _0x2a8851=0x0;_0x2a8851<_0x1b80d6['length'];_0x2a8851+=0x1){var _0x11f1bd=_0x1b80d6[_0x2a8851][_0x3d40('0x51')]({'plain':!![]});_0x43e18e[_0x3d40('0x69')]=_0xf3c644[_0x3d40('0x4f')][_0x3d40('0x69')]?_0xf3c644['body']['dialCheckDuplicateType']:_0x43e18e[_0x3d40('0x69')];switch(_0x43e18e['dialCheckDuplicateType']){case _0x3d40('0x6a'):_0x275a02=squel['insert']()[_0x3d40('0x6b')](_0x3d40('0x6c'))[_0x3d40('0x6d')]([_0x3d40('0x6e'),_0x3d40('0x6f'),_0x3d40('0x70'),_0x3d40('0x71'),_0x3d40('0x5e'),_0x3d40('0x72'),_0x3d40('0x56')],squel['select']()['field'](_0x3d40('0x6e'),'phone')['field'](_0x3d40('0x73'),'scheduledAt')[_0x3d40('0x74')]('id',_0x3d40('0x70'))[_0x3d40('0x74')](_0x11f1bd['CmListId'][_0x3d40('0x75')](),_0x3d40('0x71'))[_0x3d40('0x74')](_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')](),_0x3d40('0x5e'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x72'))['field']('\x27'+_0x836dc7+'\x27',_0x3d40('0x56'))['from']('cm_contacts')[_0x3d40('0x40')](_0x3d40('0x76'))[_0x3d40('0x40')](_0x3d40('0x77'),_0x11f1bd[_0x3d40('0x78')]['toString']())[_0x3d40('0x40')](_0x3d40('0x79'))[_0x3d40('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x7b'))[_0x3d40('0x7c')]('cm_hopper_final')[_0x3d40('0x40')]('CampaignId\x20=\x20?',_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')]()))[_0x3d40('0x40')](_0x3d40('0x7d'),squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x7e'))[_0x3d40('0x7c')](_0x3d40('0x6c'))[_0x3d40('0x40')]('CampaignId\x20=\x20?',_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')]())))['toString']();break;case _0x3d40('0x7f'):_0x275a02=squel[_0x3d40('0x80')]()[_0x3d40('0x6b')](_0x3d40('0x6c'))['fromQuery']([_0x3d40('0x6e'),_0x3d40('0x6f'),'ContactId',_0x3d40('0x71'),'CampaignId',_0x3d40('0x72'),_0x3d40('0x56')],squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x6e'),'phone')['field'](_0x3d40('0x73'),_0x3d40('0x6f'))[_0x3d40('0x74')]('id',_0x3d40('0x70'))[_0x3d40('0x74')](_0x11f1bd['CmListId'][_0x3d40('0x75')](),_0x3d40('0x71'))[_0x3d40('0x74')](_0xf3c644['params']['id']['toString'](),_0x3d40('0x5e'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x72'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x56'))[_0x3d40('0x7c')](_0x3d40('0x81'))[_0x3d40('0x40')](_0x3d40('0x76'))['where'](_0x3d40('0x77'),_0x11f1bd[_0x3d40('0x78')][_0x3d40('0x75')]())[_0x3d40('0x40')](_0x3d40('0x79'))['where'](_0x3d40('0x7d'),squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x7e'))[_0x3d40('0x7c')](_0x3d40('0x6c'))[_0x3d40('0x40')](_0x3d40('0x82'),_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')]())))[_0x3d40('0x75')]();break;default:_0x275a02=squel[_0x3d40('0x80')]()['into'](_0x3d40('0x6c'))[_0x3d40('0x6d')]([_0x3d40('0x6e'),_0x3d40('0x6f'),_0x3d40('0x70'),_0x3d40('0x71'),_0x3d40('0x5e'),_0x3d40('0x72'),_0x3d40('0x56')],squel['select']()[_0x3d40('0x74')](_0x3d40('0x6e'),_0x3d40('0x6e'))[_0x3d40('0x74')](_0x3d40('0x73'),_0x3d40('0x6f'))[_0x3d40('0x74')]('id',_0x3d40('0x70'))['field'](_0x11f1bd[_0x3d40('0x78')][_0x3d40('0x75')](),_0x3d40('0x71'))[_0x3d40('0x74')](_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')](),_0x3d40('0x5e'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x72'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x56'))[_0x3d40('0x7c')](_0x3d40('0x81'))[_0x3d40('0x40')]('deletedAt\x20IS\x20NULL')[_0x3d40('0x40')](_0x3d40('0x77'),_0x11f1bd['CmListId'][_0x3d40('0x75')]())[_0x3d40('0x40')](_0x3d40('0x79')))[_0x3d40('0x75')]();}_0x49848e=squel['insert']()[_0x3d40('0x6b')](_0x3d40('0x83'))[_0x3d40('0x6d')]([_0x3d40('0x84'),_0x3d40('0x6f'),_0x3d40('0x6e'),'OrderBy',_0x3d40('0x72'),'updatedAt'],squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x85'),'id')['field']('NOW()',_0x3d40('0x6f'))[_0x3d40('0x74')]('ci.item',_0x3d40('0x6e'))[_0x3d40('0x74')](_0x3d40('0x86'),_0x3d40('0x87'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x72'))['field']('\x27'+_0x836dc7+'\x27','updatedAt')[_0x3d40('0x7c')](_0x3d40('0x88'),'ci')[_0x3d40('0x89')](_0x3d40('0x6c'),'h',_0x3d40('0x8a'))[_0x3d40('0x40')](_0x3d40('0x8b'),_0x11f1bd[_0x3d40('0x78')][_0x3d40('0x75')]())[_0x3d40('0x40')]('h.CampaignId=?',_0xf3c644[_0x3d40('0x4b')]['id']['toString']())[_0x3d40('0x40')](_0x3d40('0x8c'),_0x836dc7))['toString']();_0x3eda3d[_0x3d40('0x8d')](db[_0x3d40('0x8e')][_0x3d40('0x34')](_0x275a02));_0x1d5a17[_0x3d40('0x8d')](db[_0x3d40('0x8e')][_0x3d40('0x34')](_0x49848e));}return BPromise['all'](_0x3eda3d);}})[_0x3d40('0x26')](function(){return BPromise[_0x3d40('0x8f')](_0x1d5a17);})[_0x3d40('0x26')](function(){return _0x39bf67;})[_0x3d40('0x26')](respondWithResult(_0x26309d,null))[_0x3d40('0x49')](handleError(_0x26309d,null));};exports[_0x3d40('0x90')]=function(_0x2d6556,_0x22e4f5,_0x11851a){return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x2d6556['params']['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x22e4f5,null))[_0x3d40('0x26')](function(_0x1c80ff){if(_0x1c80ff){return _0x1c80ff[_0x3d40('0x90')](_0x2d6556[_0x3d40('0x34')][_0x3d40('0x67')]);}})['then'](function(_0x213153){if(_0x213153){return db[_0x3d40('0x5c')]['destroy']({'where':{'ListId':_0x2d6556[_0x3d40('0x34')][_0x3d40('0x67')],'CampaignId':_0x2d6556[_0x3d40('0x4b')]['id']}})['then'](function(){return _0x213153;});}})[_0x3d40('0x26')](respondWithStatusCode(_0x22e4f5,null))[_0x3d40('0x49')](handleError(_0x22e4f5,null));};exports[_0x3d40('0x91')]=function(_0x16f636,_0x1f75b2,_0x10e479){var _0x11c7c3={};var _0x36a069={};var _0x5ab498;var _0x325579;return db[_0x3d40('0x4c')][_0x3d40('0x5b')]({'where':{'id':_0x16f636['params']['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x1f75b2,null))[_0x3d40('0x26')](function(_0x13e1dc){if(_0x13e1dc){_0x5ab498=_0x13e1dc;_0x36a069[_0x3d40('0x39')]=_['keys'](db['CmList'][_0x3d40('0x30')]);_0x36a069[_0x3d40('0x34')]=_[_0x3d40('0x35')](_0x16f636[_0x3d40('0x34')]);_0x36a069['filters']=_[_0x3d40('0x38')](_0x36a069[_0x3d40('0x39')],_0x36a069[_0x3d40('0x34')]);_0x11c7c3[_0x3d40('0x37')]=_['intersection'](_0x36a069[_0x3d40('0x39')],qs['fields'](_0x16f636[_0x3d40('0x34')][_0x3d40('0x3a')]));_0x11c7c3[_0x3d40('0x37')]=_0x11c7c3[_0x3d40('0x37')][_0x3d40('0x3b')]?_0x11c7c3['attributes']:_0x36a069['model'];_0x11c7c3['order']=qs[_0x3d40('0x3f')](_0x16f636[_0x3d40('0x34')][_0x3d40('0x3f')]);_0x11c7c3['where']=qs['filters'](_[_0x3d40('0x5d')](_0x16f636[_0x3d40('0x34')],_0x36a069[_0x3d40('0x36')]));if(_0x16f636['query'][_0x3d40('0x43')]){_0x11c7c3[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x11c7c3['where'],{'$or':_[_0x3d40('0x2f')](_0x11c7c3[_0x3d40('0x37')],function(_0x4d7817){var _0x22f625={};_0x22f625[_0x4d7817]={'$like':'%'+_0x16f636[_0x3d40('0x34')][_0x3d40('0x43')]+'%'};return _0x22f625;})});}_0x11c7c3=_[_0x3d40('0x41')]({},_0x11c7c3,_0x16f636[_0x3d40('0x44')]);return _0x5ab498[_0x3d40('0x91')](_0x11c7c3);}})[_0x3d40('0x26')](function(_0x394aba){if(_0x394aba){_0x325579=_0x394aba['length'];if(!_0x16f636[_0x3d40('0x34')]['hasOwnProperty']('nolimit')){_0x11c7c3[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x16f636['query']['limit']);_0x11c7c3[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x16f636[_0x3d40('0x34')][_0x3d40('0x1e')]);}return _0x5ab498[_0x3d40('0x91')](_0x11c7c3);}})[_0x3d40('0x26')](function(_0x3f2ad8){if(_0x3f2ad8){return _0x3f2ad8?{'count':_0x325579,'rows':_0x3f2ad8}:null;}})['then'](respondWithResult(_0x1f75b2,null))[_0x3d40('0x49')](handleError(_0x1f75b2,null));};exports['addBlackLists']=function(_0x5b5cdc,_0x27f2bc,_0x335ad2){var _0x46f5bd,_0x1ba164;var _0x2ed7ba=[];var _0x5b90be=moment()[_0x3d40('0x92')](_0x3d40('0x66'));return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x5b5cdc[_0x3d40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27f2bc,null))[_0x3d40('0x26')](function(_0x30a94f){if(_0x30a94f){_0x1ba164=_0x30a94f;return _0x30a94f['addBlackLists'](_0x5b5cdc[_0x3d40('0x4f')]['ids'],_[_0x3d40('0x57')](_0x5b5cdc[_0x3d40('0x4f')],[_0x3d40('0x67'),'id'])||{});}return null;})[_0x3d40('0x68')](function(_0x397301){var _0x5bb0dc;var _0x278733;_0x46f5bd=_0x397301||[];var _0x1ebfef=[];if(_0x397301){for(var _0x4442f8=0x0;_0x4442f8<_0x397301['length'];_0x4442f8+=0x1){var _0x3d17e2=_0x397301[_0x4442f8][_0x3d40('0x51')]({'plain':!![]});_0x5bb0dc=squel[_0x3d40('0x80')]()[_0x3d40('0x6b')](_0x3d40('0x93'))[_0x3d40('0x6d')]([_0x3d40('0x6e'),_0x3d40('0x70'),'ListId',_0x3d40('0x5e'),_0x3d40('0x72'),'updatedAt'],squel['select']()[_0x3d40('0x74')](_0x3d40('0x6e'),_0x3d40('0x6e'))[_0x3d40('0x74')]('id',_0x3d40('0x70'))[_0x3d40('0x74')](_0x3d17e2[_0x3d40('0x78')][_0x3d40('0x75')](),'ListId')['field'](_0x5b5cdc[_0x3d40('0x4b')]['id']['toString'](),'CampaignId')[_0x3d40('0x74')](_0x3d40('0x73'),_0x3d40('0x72'))[_0x3d40('0x74')](_0x3d40('0x73'),_0x3d40('0x56'))[_0x3d40('0x7c')](_0x3d40('0x81'))[_0x3d40('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x3d17e2[_0x3d40('0x78')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3d40('0x75')]();_0x1ebfef[_0x3d40('0x8d')](db[_0x3d40('0x8e')][_0x3d40('0x34')](_0x5bb0dc));}return BPromise[_0x3d40('0x8f')](_0x1ebfef);}})[_0x3d40('0x26')](function(){return _0x46f5bd;})['then'](respondWithResult(_0x27f2bc,null))[_0x3d40('0x49')](handleError(_0x27f2bc,null));};exports[_0x3d40('0x94')]=function(_0x177fc5,_0x4d8afe,_0x5df071){return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x177fc5[_0x3d40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d8afe,null))['then'](function(_0x16c7c7){if(_0x16c7c7){return _0x16c7c7[_0x3d40('0x94')](_0x177fc5[_0x3d40('0x34')][_0x3d40('0x67')]);}})[_0x3d40('0x26')](function(_0x1e4d30){if(_0x1e4d30){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x177fc5[_0x3d40('0x34')][_0x3d40('0x67')],'CampaignId':_0x177fc5[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](function(){return _0x1e4d30;});}})[_0x3d40('0x26')](respondWithStatusCode(_0x4d8afe,null))[_0x3d40('0x49')](handleError(_0x4d8afe,null));}; \ No newline at end of file +var _0x2572=['end','limit','offset','count','set','Content-Range','json','apply','update','then','destroy','IvrCampaigns','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','rows','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','rawAttributes','omit','createdAt','updatedAt','body','role','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x528aec,_0x13f8ad){var _0x54c419=function(_0x3890de){while(--_0x3890de){_0x528aec['push'](_0x528aec['shift']());}};_0x54c419(++_0x13f8ad);}(_0x2572,0x110));var _0x2257=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2572[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x2257('0x0'));var rimraf=require(_0x2257('0x1'));var zipdir=require(_0x2257('0x2'));var jsonpatch=require(_0x2257('0x3'));var rp=require(_0x2257('0x4'));var moment=require(_0x2257('0x5'));var BPromise=require(_0x2257('0x6'));var Mustache=require(_0x2257('0x7'));var util=require(_0x2257('0x8'));var path=require('path');var sox=require(_0x2257('0x9'));var csv=require(_0x2257('0xa'));var ejs=require(_0x2257('0xb'));var fs=require('fs');var fs_extra=require(_0x2257('0xc'));var _=require(_0x2257('0xd'));var squel=require(_0x2257('0xe'));var crypto=require(_0x2257('0xf'));var jsforce=require(_0x2257('0x10'));var deskjs=require(_0x2257('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2257('0x12'));var Papa=require(_0x2257('0x13'));var Redis=require('ioredis');var authService=require(_0x2257('0x14'));var qs=require(_0x2257('0x15'));var as=require(_0x2257('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2257('0x17'))(_0x2257('0x18'));var utils=require(_0x2257('0x19'));var config=require(_0x2257('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2257('0x1b'))['db'];function respondWithStatusCode(_0x5131bd,_0x578d2f){_0x578d2f=_0x578d2f||0xcc;return function(_0x7f8b71){if(_0x7f8b71){return _0x5131bd[_0x2257('0x1c')](_0x578d2f);}return _0x5131bd[_0x2257('0x1d')](_0x578d2f)[_0x2257('0x1e')]();};}function respondWithResult(_0x2e610e,_0x32fdfe){_0x32fdfe=_0x32fdfe||0xc8;return function(_0x1738a3){if(_0x1738a3){return _0x2e610e['status'](_0x32fdfe)['json'](_0x1738a3);}};}function respondWithFilteredResult(_0x3578db,_0x45efee){return function(_0x2b4102){if(_0x2b4102){var _0x156d68=typeof _0x45efee['offset']==='undefined'&&typeof _0x45efee[_0x2257('0x1f')]==='undefined';var _0x4cd932=_0x2b4102['count'];var _0x31c8c6=_0x156d68?0x0:_0x45efee[_0x2257('0x20')];var _0x31e8d0=_0x156d68?_0x2b4102[_0x2257('0x21')]:_0x45efee[_0x2257('0x20')]+_0x45efee[_0x2257('0x1f')];var _0x36224b;if(_0x31e8d0>=_0x4cd932){_0x31e8d0=_0x4cd932;_0x36224b=0xc8;}else{_0x36224b=0xce;}_0x3578db[_0x2257('0x1d')](_0x36224b);return _0x3578db[_0x2257('0x22')](_0x2257('0x23'),_0x31c8c6+'-'+_0x31e8d0+'/'+_0x4cd932)[_0x2257('0x24')](_0x2b4102);}return null;};}function patchUpdates(_0x263108){return function(_0x482240){try{jsonpatch[_0x2257('0x25')](_0x482240,_0x263108,!![]);}catch(_0x2e3d19){return BPromise['reject'](_0x2e3d19);}return _0x482240['save']();};}function saveUpdates(_0x56e513,_0x5ae577){return function(_0x31cd98){if(_0x31cd98){return _0x31cd98[_0x2257('0x26')](_0x56e513)[_0x2257('0x27')](function(_0x2a1aa7){return _0x2a1aa7;});}return null;};}function removeEntity(_0x137d53,_0x1e220c){return function(_0x1549aa){if(_0x1549aa){return _0x1549aa[_0x2257('0x28')]()[_0x2257('0x27')](function(){var _0x27a619=_0x1549aa['get']({'plain':!![]});var _0x3ab173=_0x2257('0x29');return db['UserProfileResource'][_0x2257('0x28')]({'where':{'type':_0x3ab173,'resourceId':_0x27a619['id']}})[_0x2257('0x27')](function(){return _0x1549aa;});})['then'](function(){_0x137d53[_0x2257('0x1d')](0xcc)[_0x2257('0x1e')]();});}};}function handleEntityNotFound(_0x4bdc02,_0x387200){return function(_0x40f188){if(!_0x40f188){_0x4bdc02[_0x2257('0x1c')](0x194);}return _0x40f188;};}function handleError(_0x33619a,_0x574c57){_0x574c57=_0x574c57||0x1f4;return function(_0x8b9b1b){logger[_0x2257('0x2a')](_0x8b9b1b['stack']);if(_0x8b9b1b[_0x2257('0x2b')]){delete _0x8b9b1b[_0x2257('0x2b')];}_0x33619a[_0x2257('0x1d')](_0x574c57)[_0x2257('0x2c')](_0x8b9b1b);};}exports[_0x2257('0x2d')]=function(_0x1a491d,_0x3b5372){var _0x43f0b2={},_0x320ead={},_0x54f10b={'count':0x0,'rows':[]};var _0x2a15d9=_[_0x2257('0x2e')](db['Campaign']['rawAttributes'],function(_0x30a71a){return{'name':_0x30a71a[_0x2257('0x2f')],'type':_0x30a71a[_0x2257('0x30')][_0x2257('0x31')]};});_0x320ead[_0x2257('0x32')]=_[_0x2257('0x2e')](_0x2a15d9,'name');_0x320ead[_0x2257('0x33')]=_[_0x2257('0x34')](_0x1a491d[_0x2257('0x33')]);_0x320ead[_0x2257('0x35')]=_['intersection'](_0x320ead[_0x2257('0x32')],_0x320ead['query']);_0x43f0b2['attributes']=_[_0x2257('0x36')](_0x320ead[_0x2257('0x32')],qs[_0x2257('0x37')](_0x1a491d[_0x2257('0x33')][_0x2257('0x37')]));_0x43f0b2[_0x2257('0x38')]=_0x43f0b2[_0x2257('0x38')][_0x2257('0x39')]?_0x43f0b2[_0x2257('0x38')]:_0x320ead[_0x2257('0x32')];if(!_0x1a491d[_0x2257('0x33')][_0x2257('0x3a')](_0x2257('0x3b'))){_0x43f0b2[_0x2257('0x1f')]=qs['limit'](_0x1a491d[_0x2257('0x33')][_0x2257('0x1f')]);_0x43f0b2[_0x2257('0x20')]=qs[_0x2257('0x20')](_0x1a491d[_0x2257('0x33')]['offset']);}_0x43f0b2[_0x2257('0x3c')]=qs[_0x2257('0x3d')](_0x1a491d[_0x2257('0x33')][_0x2257('0x3d')]);_0x43f0b2[_0x2257('0x3e')]=qs[_0x2257('0x35')](_[_0x2257('0x3f')](_0x1a491d[_0x2257('0x33')],_0x320ead[_0x2257('0x35')]),_0x2a15d9);if(_0x1a491d[_0x2257('0x33')][_0x2257('0x40')]){_0x43f0b2[_0x2257('0x3e')]=_[_0x2257('0x41')](_0x43f0b2['where'],{'$or':_[_0x2257('0x2e')](_0x2a15d9,function(_0x312416){if(_0x312416[_0x2257('0x30')]!==_0x2257('0x42')){var _0x6ebead={};_0x6ebead[_0x312416[_0x2257('0x2b')]]={'$like':'%'+_0x1a491d[_0x2257('0x33')][_0x2257('0x40')]+'%'};return _0x6ebead;}})});}_0x43f0b2=_[_0x2257('0x41')]({},_0x43f0b2,_0x1a491d[_0x2257('0x43')]);var _0x510ff7={'where':_0x43f0b2[_0x2257('0x3e')]};return db[_0x2257('0x44')][_0x2257('0x21')](_0x510ff7)['then'](function(_0x22a6ea){_0x54f10b[_0x2257('0x21')]=_0x22a6ea;if(_0x1a491d[_0x2257('0x33')][_0x2257('0x45')]){_0x43f0b2[_0x2257('0x46')]=[{'all':!![]}];}return db[_0x2257('0x44')]['findAll'](_0x43f0b2);})[_0x2257('0x27')](function(_0x2be2ee){_0x54f10b[_0x2257('0x47')]=_0x2be2ee;return _0x54f10b;})[_0x2257('0x27')](respondWithFilteredResult(_0x3b5372,_0x43f0b2))['catch'](handleError(_0x3b5372,null));};exports['show']=function(_0x490a7b,_0x52c23d){var _0xff4e24={'raw':![],'where':{'id':_0x490a7b['params']['id']}},_0x521783={};_0x521783[_0x2257('0x32')]=_['keys'](db['Campaign']['rawAttributes']);_0x521783[_0x2257('0x33')]=_[_0x2257('0x34')](_0x490a7b[_0x2257('0x33')]);_0x521783[_0x2257('0x35')]=_[_0x2257('0x36')](_0x521783[_0x2257('0x32')],_0x521783[_0x2257('0x33')]);_0xff4e24['attributes']=_[_0x2257('0x36')](_0x521783['model'],qs[_0x2257('0x37')](_0x490a7b[_0x2257('0x33')][_0x2257('0x37')]));_0xff4e24[_0x2257('0x38')]=_0xff4e24[_0x2257('0x38')][_0x2257('0x39')]?_0xff4e24[_0x2257('0x38')]:_0x521783['model'];if(_0x490a7b[_0x2257('0x33')][_0x2257('0x45')]){_0xff4e24['include']=[{'all':!![]}];}_0xff4e24=_[_0x2257('0x41')]({},_0xff4e24,_0x490a7b['options']);return db[_0x2257('0x44')][_0x2257('0x48')](_0xff4e24)[_0x2257('0x27')](handleEntityNotFound(_0x52c23d,null))[_0x2257('0x27')](respondWithResult(_0x52c23d,null))[_0x2257('0x49')](handleError(_0x52c23d,null));};exports[_0x2257('0x4a')]=function(_0x33ed5a,_0x50c5cb){return db[_0x2257('0x44')][_0x2257('0x4a')](_0x33ed5a['body'],{})[_0x2257('0x27')](function(_0x57ae22){var _0x4b921d=_0x33ed5a[_0x2257('0x4b')][_0x2257('0x4c')]({'plain':!![]});if(!_0x4b921d)throw new Error(_0x2257('0x4d'));if(_0x4b921d['role']===_0x2257('0x4b')){var _0x4cf2b6=_0x57ae22[_0x2257('0x4c')]({'plain':!![]});var _0x53644a=_0x2257('0x29');return db[_0x2257('0x4e')][_0x2257('0x48')]({'where':{'name':_0x53644a,'userProfileId':_0x4b921d[_0x2257('0x4f')]},'raw':!![]})[_0x2257('0x27')](function(_0x22780a){if(_0x22780a&&_0x22780a[_0x2257('0x50')]===0x0){return db[_0x2257('0x51')]['create']({'name':_0x4cf2b6[_0x2257('0x2b')],'resourceId':_0x4cf2b6['id'],'type':_0x22780a[_0x2257('0x2b')],'sectionId':_0x22780a['id']},{})[_0x2257('0x27')](function(){return _0x57ae22;});}else{return _0x57ae22;}})[_0x2257('0x49')](function(_0x3ae279){logger[_0x2257('0x2a')](_0x2257('0x52'),_0x3ae279);throw _0x3ae279;});}return _0x57ae22;})[_0x2257('0x27')](respondWithResult(_0x50c5cb,0xc9))[_0x2257('0x49')](handleError(_0x50c5cb,null));};exports[_0x2257('0x53')]=function(_0x194d90,_0x3aa4bb){var _0x271f2f={'where':{'id':_0x194d90[_0x2257('0x54')]['id']}},_0x594c16={};_0x594c16[_0x2257('0x32')]=_[_0x2257('0x34')](db['Campaign'][_0x2257('0x55')]);_0x271f2f[_0x2257('0x38')]=_[_0x2257('0x36')](_0x594c16['model'],qs[_0x2257('0x37')](_0x194d90[_0x2257('0x33')][_0x2257('0x37')]));_0x271f2f[_0x2257('0x38')]=_0x271f2f[_0x2257('0x38')][_0x2257('0x39')]?_0x271f2f['attributes']:_0x594c16['model'];if(_0x194d90[_0x2257('0x33')][_0x2257('0x45')]){_0x271f2f[_0x2257('0x46')]=[{'all':!![]}];}_0x271f2f=_[_0x2257('0x41')]({},_0x271f2f,_0x194d90[_0x2257('0x43')]);return db[_0x2257('0x44')][_0x2257('0x48')](_0x271f2f)[_0x2257('0x27')](handleEntityNotFound(_0x3aa4bb,null))[_0x2257('0x27')](function(_0x40d926){if(_0x40d926){var _0x44aa84=_0x40d926[_0x2257('0x4c')]({'plain':!![]});_0x44aa84=qs[_0x2257('0x56')](_0x44aa84,['id',_0x2257('0x57'),_0x2257('0x58')]);_0x194d90[_0x2257('0x59')]=_[_0x2257('0x56')](_0x194d90[_0x2257('0x59')],['id',_0x2257('0x57'),'updatedAt']);return db['Campaign']['create'](_[_0x2257('0x41')](_0x44aa84,_0x194d90[_0x2257('0x59')]),{'include':_0x194d90[_0x2257('0x33')][_0x2257('0x45')]?[{'all':!![]}]:undefined})[_0x2257('0x27')](function(_0x412efa){var _0x2241b3=_0x194d90[_0x2257('0x4b')]['get']({'plain':!![]});if(!_0x2241b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2241b3[_0x2257('0x5a')]==='user'){var _0x411d47=_0x412efa['get']({'plain':!![]});var _0x1fe210='IvrCampaigns';return db[_0x2257('0x4e')][_0x2257('0x48')]({'where':{'name':_0x1fe210,'userProfileId':_0x2241b3[_0x2257('0x4f')]},'raw':!![]})[_0x2257('0x27')](function(_0x22c4ea){if(_0x22c4ea&&_0x22c4ea[_0x2257('0x50')]===0x0){return db[_0x2257('0x51')][_0x2257('0x4a')]({'name':_0x411d47['name'],'resourceId':_0x411d47['id'],'type':_0x22c4ea[_0x2257('0x2b')],'sectionId':_0x22c4ea['id']},{})[_0x2257('0x27')](function(){return _0x412efa;});}else{return _0x412efa;}})[_0x2257('0x49')](function(_0xdb72ad){logger[_0x2257('0x2a')](_0x2257('0x52'),_0xdb72ad);throw _0xdb72ad;});}return _0x412efa;});}})[_0x2257('0x27')](respondWithResult(_0x3aa4bb,0xc9))['catch'](handleError(_0x3aa4bb,null));};exports[_0x2257('0x26')]=function(_0xa07de9,_0x35de68){if(_0xa07de9[_0x2257('0x59')]['id']){delete _0xa07de9[_0x2257('0x59')]['id'];}return db['Campaign']['find']({'where':{'id':_0xa07de9['params']['id']}})[_0x2257('0x27')](handleEntityNotFound(_0x35de68,null))[_0x2257('0x27')](saveUpdates(_0xa07de9[_0x2257('0x59')],null))[_0x2257('0x27')](respondWithResult(_0x35de68,null))[_0x2257('0x49')](handleError(_0x35de68,null));};exports[_0x2257('0x28')]=function(_0x364303,_0x2bca07){return db['Campaign'][_0x2257('0x48')]({'where':{'id':_0x364303[_0x2257('0x54')]['id']}})['then'](handleEntityNotFound(_0x2bca07,null))[_0x2257('0x27')](removeEntity(_0x2bca07,null))[_0x2257('0x49')](handleError(_0x2bca07,null));};exports[_0x2257('0x5b')]=function(_0x2acfc1,_0xe33530,_0x285b0a){var _0x1e4b15={'raw':!![],'where':{}};var _0x4e6a59={};var _0x5b1972={'count':0x0,'rows':[]};return db[_0x2257('0x44')][_0x2257('0x5c')]({'where':{'id':_0x2acfc1['params']['id']}})[_0x2257('0x27')](handleEntityNotFound(_0xe33530,null))['then'](function(_0x1a9935){if(_0x1a9935){_0x4e6a59[_0x2257('0x32')]=_[_0x2257('0x34')](db[_0x2257('0x5d')][_0x2257('0x55')]);_0x4e6a59[_0x2257('0x33')]=_['keys'](_0x2acfc1['query']);_0x4e6a59[_0x2257('0x35')]=_[_0x2257('0x36')](_0x4e6a59[_0x2257('0x32')],_0x4e6a59[_0x2257('0x33')]);_0x1e4b15[_0x2257('0x38')]=_[_0x2257('0x36')](_0x4e6a59[_0x2257('0x32')],qs['fields'](_0x2acfc1['query']['fields']));_0x1e4b15['attributes']=_0x1e4b15[_0x2257('0x38')][_0x2257('0x39')]?_0x1e4b15['attributes']:_0x4e6a59[_0x2257('0x32')];if(!_0x2acfc1[_0x2257('0x33')][_0x2257('0x3a')]('nolimit')){_0x1e4b15[_0x2257('0x1f')]=qs['limit'](_0x2acfc1[_0x2257('0x33')][_0x2257('0x1f')]);_0x1e4b15[_0x2257('0x20')]=qs[_0x2257('0x20')](_0x2acfc1[_0x2257('0x33')]['offset']);}_0x1e4b15[_0x2257('0x3c')]=qs['sort'](_0x2acfc1[_0x2257('0x33')]['sort']);_0x1e4b15[_0x2257('0x3e')]=qs[_0x2257('0x35')](_[_0x2257('0x3f')](_0x2acfc1[_0x2257('0x33')],_0x4e6a59[_0x2257('0x35')]));_0x1e4b15[_0x2257('0x3e')][_0x2257('0x5e')]=_0x1a9935['id'];if(_0x2acfc1[_0x2257('0x33')][_0x2257('0x40')]){_0x1e4b15['where']=_[_0x2257('0x41')](_0x1e4b15['where'],{'$or':_[_0x2257('0x2e')](_0x1e4b15[_0x2257('0x38')],function(_0x38ffdf){var _0xc5eae9={};_0xc5eae9[_0x38ffdf]={'$like':'%'+_0x2acfc1[_0x2257('0x33')][_0x2257('0x40')]+'%'};return _0xc5eae9;})});}_0x1e4b15=_[_0x2257('0x41')]({},_0x1e4b15,_0x2acfc1['options']);return db['CmHopper'][_0x2257('0x21')]({'where':_0x1e4b15[_0x2257('0x3e')]})[_0x2257('0x27')](function(_0x542c31){_0x5b1972[_0x2257('0x21')]=_0x542c31;if(_0x2acfc1[_0x2257('0x33')][_0x2257('0x45')]){_0x1e4b15[_0x2257('0x46')]=[{'all':!![]}];}return db['CmHopper'][_0x2257('0x5f')](_0x1e4b15);})[_0x2257('0x27')](function(_0x391416){_0x5b1972[_0x2257('0x47')]=_0x391416;return _0x5b1972;});}})[_0x2257('0x27')](respondWithFilteredResult(_0xe33530,_0x1e4b15))[_0x2257('0x49')](handleError(_0xe33530,null));};exports[_0x2257('0x60')]=function(_0x57a959,_0x1f92dd,_0x15cafb){var _0x216434={'raw':!![],'where':{}};var _0x39986d={};var _0x4f9d72={'count':0x0,'rows':[]};return db[_0x2257('0x44')]['findOne']({'where':{'id':_0x57a959['params']['id']}})[_0x2257('0x27')](handleEntityNotFound(_0x1f92dd,null))[_0x2257('0x27')](function(_0x909078){if(_0x909078){_0x39986d[_0x2257('0x32')]=_['keys'](db['CmHopperHistory'][_0x2257('0x55')]);_0x39986d[_0x2257('0x33')]=_['keys'](_0x57a959[_0x2257('0x33')]);_0x39986d[_0x2257('0x35')]=_['intersection'](_0x39986d[_0x2257('0x32')],_0x39986d['query']);_0x216434[_0x2257('0x38')]=_[_0x2257('0x36')](_0x39986d[_0x2257('0x32')],qs['fields'](_0x57a959[_0x2257('0x33')][_0x2257('0x37')]));_0x216434[_0x2257('0x38')]=_0x216434[_0x2257('0x38')][_0x2257('0x39')]?_0x216434[_0x2257('0x38')]:_0x39986d[_0x2257('0x32')];if(!_0x57a959[_0x2257('0x33')][_0x2257('0x3a')](_0x2257('0x3b'))){_0x216434[_0x2257('0x1f')]=qs['limit'](_0x57a959['query'][_0x2257('0x1f')]);_0x216434[_0x2257('0x20')]=qs[_0x2257('0x20')](_0x57a959[_0x2257('0x33')][_0x2257('0x20')]);}_0x216434[_0x2257('0x3c')]=qs['sort'](_0x57a959['query'][_0x2257('0x3d')]);_0x216434['where']=qs['filters'](_[_0x2257('0x3f')](_0x57a959[_0x2257('0x33')],_0x39986d[_0x2257('0x35')]));_0x216434[_0x2257('0x3e')][_0x2257('0x5e')]=_0x909078['id'];if(_0x57a959[_0x2257('0x33')][_0x2257('0x40')]){_0x216434[_0x2257('0x3e')]=_[_0x2257('0x41')](_0x216434[_0x2257('0x3e')],{'$or':_[_0x2257('0x2e')](_0x216434[_0x2257('0x38')],function(_0x3b3c89){var _0x44682d={};_0x44682d[_0x3b3c89]={'$like':'%'+_0x57a959['query'][_0x2257('0x40')]+'%'};return _0x44682d;})});}_0x216434=_[_0x2257('0x41')]({},_0x216434,_0x57a959['options']);return db[_0x2257('0x61')][_0x2257('0x21')]({'where':_0x216434['where']})['then'](function(_0x4d0606){_0x4f9d72[_0x2257('0x21')]=_0x4d0606;if(_0x57a959[_0x2257('0x33')][_0x2257('0x45')]){_0x216434[_0x2257('0x46')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2257('0x5f')](_0x216434);})['then'](function(_0x6befa3){_0x4f9d72[_0x2257('0x47')]=_0x6befa3;return _0x4f9d72;});}})['then'](respondWithFilteredResult(_0x1f92dd,_0x216434))[_0x2257('0x49')](handleError(_0x1f92dd,null));};exports[_0x2257('0x62')]=function(_0x10bae7,_0x3bfda0,_0x3afe01){var _0x32ea56={'raw':!![],'where':{}};var _0x39aa3e={};var _0x21495f={'count':0x0,'rows':[]};return db[_0x2257('0x44')][_0x2257('0x5c')]({'where':{'id':_0x10bae7['params']['id']}})[_0x2257('0x27')](handleEntityNotFound(_0x3bfda0,null))['then'](function(_0x326103){if(_0x326103){_0x39aa3e[_0x2257('0x32')]=_[_0x2257('0x34')](db[_0x2257('0x63')][_0x2257('0x55')]);_0x39aa3e[_0x2257('0x33')]=_['keys'](_0x10bae7[_0x2257('0x33')]);_0x39aa3e[_0x2257('0x35')]=_[_0x2257('0x36')](_0x39aa3e['model'],_0x39aa3e[_0x2257('0x33')]);_0x32ea56[_0x2257('0x38')]=_[_0x2257('0x36')](_0x39aa3e[_0x2257('0x32')],qs[_0x2257('0x37')](_0x10bae7[_0x2257('0x33')]['fields']));_0x32ea56[_0x2257('0x38')]=_0x32ea56[_0x2257('0x38')]['length']?_0x32ea56[_0x2257('0x38')]:_0x39aa3e['model'];if(!_0x10bae7[_0x2257('0x33')]['hasOwnProperty'](_0x2257('0x3b'))){_0x32ea56[_0x2257('0x1f')]=qs[_0x2257('0x1f')](_0x10bae7['query'][_0x2257('0x1f')]);_0x32ea56[_0x2257('0x20')]=qs[_0x2257('0x20')](_0x10bae7[_0x2257('0x33')]['offset']);}_0x32ea56[_0x2257('0x3c')]=qs[_0x2257('0x3d')](_0x10bae7['query'][_0x2257('0x3d')]);_0x32ea56[_0x2257('0x3e')]=qs['filters'](_[_0x2257('0x3f')](_0x10bae7[_0x2257('0x33')],_0x39aa3e[_0x2257('0x35')]));_0x32ea56['where'][_0x2257('0x5e')]=_0x326103['id'];if(_0x10bae7[_0x2257('0x33')][_0x2257('0x40')]){_0x32ea56[_0x2257('0x3e')]=_[_0x2257('0x41')](_0x32ea56['where'],{'$or':_[_0x2257('0x2e')](_0x32ea56[_0x2257('0x38')],function(_0x355e37){var _0x2590e1={};_0x2590e1[_0x355e37]={'$like':'%'+_0x10bae7[_0x2257('0x33')]['filter']+'%'};return _0x2590e1;})});}_0x32ea56=_[_0x2257('0x41')]({},_0x32ea56,_0x10bae7['options']);return db[_0x2257('0x63')]['count']({'where':_0x32ea56['where']})[_0x2257('0x27')](function(_0x393af1){_0x21495f[_0x2257('0x21')]=_0x393af1;if(_0x10bae7[_0x2257('0x33')]['includeAll']){_0x32ea56[_0x2257('0x46')]=[{'all':!![]}];}return db[_0x2257('0x63')][_0x2257('0x5f')](_0x32ea56);})[_0x2257('0x27')](function(_0x19186b){_0x21495f[_0x2257('0x47')]=_0x19186b;return _0x21495f;});}})[_0x2257('0x27')](respondWithFilteredResult(_0x3bfda0,_0x32ea56))[_0x2257('0x49')](handleError(_0x3bfda0,null));};exports[_0x2257('0x64')]=function(_0x16eaf2,_0x1ba3bd,_0x1ca6a1){var _0x40c8f0={'raw':!![],'where':{}};var _0x33bc30={};var _0x52db81={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x16eaf2[_0x2257('0x54')]['id']}})[_0x2257('0x27')](handleEntityNotFound(_0x1ba3bd,null))[_0x2257('0x27')](function(_0x49c70c){if(_0x49c70c){_0x33bc30[_0x2257('0x32')]=_['keys'](db[_0x2257('0x65')]['rawAttributes']);_0x33bc30['query']=_[_0x2257('0x34')](_0x16eaf2['query']);_0x33bc30[_0x2257('0x35')]=_[_0x2257('0x36')](_0x33bc30['model'],_0x33bc30[_0x2257('0x33')]);_0x40c8f0[_0x2257('0x38')]=_[_0x2257('0x36')](_0x33bc30[_0x2257('0x32')],qs['fields'](_0x16eaf2['query'][_0x2257('0x37')]));_0x40c8f0['attributes']=_0x40c8f0[_0x2257('0x38')][_0x2257('0x39')]?_0x40c8f0[_0x2257('0x38')]:_0x33bc30[_0x2257('0x32')];if(!_0x16eaf2[_0x2257('0x33')]['hasOwnProperty'](_0x2257('0x3b'))){_0x40c8f0[_0x2257('0x1f')]=qs[_0x2257('0x1f')](_0x16eaf2['query']['limit']);_0x40c8f0[_0x2257('0x20')]=qs[_0x2257('0x20')](_0x16eaf2[_0x2257('0x33')][_0x2257('0x20')]);}_0x40c8f0[_0x2257('0x3c')]=qs[_0x2257('0x3d')](_0x16eaf2[_0x2257('0x33')][_0x2257('0x3d')]);_0x40c8f0[_0x2257('0x3e')]=qs[_0x2257('0x35')](_[_0x2257('0x3f')](_0x16eaf2[_0x2257('0x33')],_0x33bc30['filters']));_0x40c8f0[_0x2257('0x3e')]['CampaignId']=_0x49c70c['id'];if(_0x16eaf2[_0x2257('0x33')][_0x2257('0x40')]){_0x40c8f0[_0x2257('0x3e')]=_[_0x2257('0x41')](_0x40c8f0['where'],{'$or':_['map'](_0x40c8f0['attributes'],function(_0x3da2d0){var _0x42a58c={};_0x42a58c[_0x3da2d0]={'$like':'%'+_0x16eaf2[_0x2257('0x33')]['filter']+'%'};return _0x42a58c;})});}_0x40c8f0=_[_0x2257('0x41')]({},_0x40c8f0,_0x16eaf2[_0x2257('0x43')]);return db[_0x2257('0x65')][_0x2257('0x21')]({'where':_0x40c8f0[_0x2257('0x3e')]})['then'](function(_0xdb3dca){_0x52db81['count']=_0xdb3dca;if(_0x16eaf2[_0x2257('0x33')][_0x2257('0x45')]){_0x40c8f0['include']=[{'all':!![]}];}return db[_0x2257('0x65')][_0x2257('0x5f')](_0x40c8f0);})[_0x2257('0x27')](function(_0x3350fd){_0x52db81[_0x2257('0x47')]=_0x3350fd;return _0x52db81;});}})['then'](respondWithFilteredResult(_0x1ba3bd,_0x40c8f0))['catch'](handleError(_0x1ba3bd,null));};exports['getLists']=function(_0x1fe461,_0x21c911,_0x289eeb){var _0x1b2223={};var _0x381270={};var _0x2a939f;var _0x4bd8ff;return db[_0x2257('0x44')][_0x2257('0x5c')]({'where':{'id':_0x1fe461['params']['id']}})[_0x2257('0x27')](handleEntityNotFound(_0x21c911,null))[_0x2257('0x27')](function(_0x43e7d6){if(_0x43e7d6){_0x2a939f=_0x43e7d6;_0x381270['model']=_[_0x2257('0x34')](db[_0x2257('0x66')][_0x2257('0x55')]);_0x381270['query']=_['keys'](_0x1fe461[_0x2257('0x33')]);_0x381270[_0x2257('0x35')]=_['intersection'](_0x381270[_0x2257('0x32')],_0x381270['query']);_0x1b2223[_0x2257('0x38')]=_[_0x2257('0x36')](_0x381270[_0x2257('0x32')],qs[_0x2257('0x37')](_0x1fe461['query']['fields']));_0x1b2223['attributes']=_0x1b2223[_0x2257('0x38')]['length']?_0x1b2223['attributes']:_0x381270[_0x2257('0x32')];_0x1b2223['order']=qs[_0x2257('0x3d')](_0x1fe461['query'][_0x2257('0x3d')]);_0x1b2223[_0x2257('0x3e')]=qs[_0x2257('0x35')](_['pick'](_0x1fe461['query'],_0x381270[_0x2257('0x35')]));if(_0x1fe461[_0x2257('0x33')]['filter']){_0x1b2223[_0x2257('0x3e')]=_['merge'](_0x1b2223['where'],{'$or':_[_0x2257('0x2e')](_0x1b2223[_0x2257('0x38')],function(_0x520faf){var _0xd43c9d={};_0xd43c9d[_0x520faf]={'$like':'%'+_0x1fe461[_0x2257('0x33')][_0x2257('0x40')]+'%'};return _0xd43c9d;})});}_0x1b2223=_[_0x2257('0x41')]({},_0x1b2223,_0x1fe461['options']);return _0x2a939f[_0x2257('0x67')](_0x1b2223);}})['then'](function(_0x5af6c1){if(_0x5af6c1){_0x4bd8ff=_0x5af6c1[_0x2257('0x39')];if(!_0x1fe461[_0x2257('0x33')][_0x2257('0x3a')](_0x2257('0x3b'))){_0x1b2223[_0x2257('0x1f')]=qs[_0x2257('0x1f')](_0x1fe461[_0x2257('0x33')][_0x2257('0x1f')]);_0x1b2223[_0x2257('0x20')]=qs[_0x2257('0x20')](_0x1fe461[_0x2257('0x33')][_0x2257('0x20')]);}return _0x2a939f['getLists'](_0x1b2223);}})[_0x2257('0x27')](function(_0x368c2c){if(_0x368c2c){return _0x368c2c?{'count':_0x4bd8ff,'rows':_0x368c2c}:null;}})[_0x2257('0x27')](respondWithResult(_0x21c911,null))[_0x2257('0x49')](handleError(_0x21c911,null));};exports[_0x2257('0x68')]=function(_0x2d52d4,_0x1862b9,_0x5b2861){var _0x5b92c4,_0x10911e;var _0x44785c=[];var _0x1f01a2=moment()[_0x2257('0x69')](_0x2257('0x6a'));return db[_0x2257('0x44')][_0x2257('0x48')]({'where':{'id':_0x2d52d4[_0x2257('0x54')]['id']}})['then'](handleEntityNotFound(_0x1862b9,null))[_0x2257('0x27')](function(_0x5e7656){if(_0x5e7656){_0x10911e=_0x5e7656;return _0x5e7656[_0x2257('0x68')](_0x2d52d4[_0x2257('0x59')][_0x2257('0x6b')],_[_0x2257('0x56')](_0x2d52d4[_0x2257('0x59')],[_0x2257('0x6b'),'id'])||{});}return null;})[_0x2257('0x6c')](function(_0x2ca240){var _0x57445e;var _0x37c5a0;_0x5b92c4=_0x2ca240||[];var _0xca0d7d=[];if(_0x2ca240){for(var _0x56eeee=0x0;_0x56eeee<_0x2ca240[_0x2257('0x39')];_0x56eeee+=0x1){var _0x1b7c20=_0x2ca240[_0x56eeee][_0x2257('0x4c')]({'plain':!![]});_0x10911e['dialCheckDuplicateType']=_0x2d52d4[_0x2257('0x59')][_0x2257('0x6d')]?_0x2d52d4[_0x2257('0x59')][_0x2257('0x6d')]:_0x10911e[_0x2257('0x6d')];switch(_0x10911e[_0x2257('0x6d')]){case _0x2257('0x6e'):_0x57445e=squel[_0x2257('0x6f')]()[_0x2257('0x70')](_0x2257('0x71'))['fromQuery']([_0x2257('0x72'),_0x2257('0x73'),_0x2257('0x74'),_0x2257('0x75'),_0x2257('0x5e'),_0x2257('0x57'),'updatedAt'],squel[_0x2257('0x76')]()['field'](_0x2257('0x72'),_0x2257('0x72'))[_0x2257('0x77')](_0x2257('0x78'),_0x2257('0x73'))[_0x2257('0x77')]('id','ContactId')[_0x2257('0x77')](_0x1b7c20[_0x2257('0x79')][_0x2257('0x7a')](),_0x2257('0x75'))[_0x2257('0x77')](_0x2d52d4['params']['id'][_0x2257('0x7a')](),_0x2257('0x5e'))[_0x2257('0x77')]('\x27'+_0x1f01a2+'\x27',_0x2257('0x57'))['field']('\x27'+_0x1f01a2+'\x27',_0x2257('0x58'))[_0x2257('0x7b')](_0x2257('0x7c'))['where'](_0x2257('0x7d'))[_0x2257('0x3e')](_0x2257('0x7e'),_0x1b7c20['CmListId']['toString']())[_0x2257('0x3e')](_0x2257('0x7f'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2257('0x76')]()[_0x2257('0x77')](_0x2257('0x80'))['from'](_0x2257('0x81'))[_0x2257('0x3e')](_0x2257('0x82'),_0x2d52d4[_0x2257('0x54')]['id'][_0x2257('0x7a')]()))[_0x2257('0x3e')](_0x2257('0x83'),squel[_0x2257('0x76')]()[_0x2257('0x77')](_0x2257('0x84'))[_0x2257('0x7b')]('cm_hopper')[_0x2257('0x3e')]('CampaignId\x20=\x20?',_0x2d52d4['params']['id'][_0x2257('0x7a')]())))['toString']();break;case _0x2257('0x85'):_0x57445e=squel[_0x2257('0x6f')]()[_0x2257('0x70')](_0x2257('0x71'))[_0x2257('0x86')]([_0x2257('0x72'),_0x2257('0x73'),'ContactId','ListId',_0x2257('0x5e'),_0x2257('0x57'),_0x2257('0x58')],squel[_0x2257('0x76')]()[_0x2257('0x77')](_0x2257('0x72'),_0x2257('0x72'))['field'](_0x2257('0x78'),'scheduledAt')['field']('id',_0x2257('0x74'))[_0x2257('0x77')](_0x1b7c20[_0x2257('0x79')]['toString'](),_0x2257('0x75'))['field'](_0x2d52d4[_0x2257('0x54')]['id'][_0x2257('0x7a')](),_0x2257('0x5e'))[_0x2257('0x77')]('\x27'+_0x1f01a2+'\x27',_0x2257('0x57'))[_0x2257('0x77')]('\x27'+_0x1f01a2+'\x27',_0x2257('0x58'))['from'](_0x2257('0x7c'))['where'](_0x2257('0x7d'))[_0x2257('0x3e')](_0x2257('0x7e'),_0x1b7c20['CmListId'][_0x2257('0x7a')]())[_0x2257('0x3e')](_0x2257('0x7f'))[_0x2257('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2257('0x76')]()[_0x2257('0x77')](_0x2257('0x84'))[_0x2257('0x7b')](_0x2257('0x71'))[_0x2257('0x3e')](_0x2257('0x82'),_0x2d52d4[_0x2257('0x54')]['id'][_0x2257('0x7a')]())))['toString']();break;default:_0x57445e=squel[_0x2257('0x6f')]()[_0x2257('0x70')](_0x2257('0x71'))[_0x2257('0x86')]([_0x2257('0x72'),_0x2257('0x73'),_0x2257('0x74'),'ListId','CampaignId','createdAt',_0x2257('0x58')],squel[_0x2257('0x76')]()[_0x2257('0x77')]('phone',_0x2257('0x72'))[_0x2257('0x77')]('NOW()',_0x2257('0x73'))['field']('id',_0x2257('0x74'))[_0x2257('0x77')](_0x1b7c20[_0x2257('0x79')][_0x2257('0x7a')](),_0x2257('0x75'))[_0x2257('0x77')](_0x2d52d4['params']['id'][_0x2257('0x7a')](),_0x2257('0x5e'))['field']('\x27'+_0x1f01a2+'\x27',_0x2257('0x57'))[_0x2257('0x77')]('\x27'+_0x1f01a2+'\x27','updatedAt')[_0x2257('0x7b')](_0x2257('0x7c'))[_0x2257('0x3e')](_0x2257('0x7d'))[_0x2257('0x3e')](_0x2257('0x7e'),_0x1b7c20[_0x2257('0x79')][_0x2257('0x7a')]())[_0x2257('0x3e')](_0x2257('0x7f')))[_0x2257('0x7a')]();}_0x37c5a0=squel[_0x2257('0x6f')]()[_0x2257('0x70')](_0x2257('0x87'))[_0x2257('0x86')]([_0x2257('0x88'),'scheduledAt',_0x2257('0x72'),_0x2257('0x89'),_0x2257('0x57'),_0x2257('0x58')],squel[_0x2257('0x76')]()[_0x2257('0x77')](_0x2257('0x8a'),'id')[_0x2257('0x77')]('NOW()',_0x2257('0x73'))[_0x2257('0x77')](_0x2257('0x8b'),_0x2257('0x72'))['field']('ci.OrderBY',_0x2257('0x89'))[_0x2257('0x77')]('\x27'+_0x1f01a2+'\x27',_0x2257('0x57'))[_0x2257('0x77')]('\x27'+_0x1f01a2+'\x27',_0x2257('0x58'))[_0x2257('0x7b')](_0x2257('0x8c'),'ci')['join'](_0x2257('0x71'),'h',_0x2257('0x8d'))[_0x2257('0x3e')](_0x2257('0x8e'),_0x1b7c20[_0x2257('0x79')]['toString']())[_0x2257('0x3e')]('h.CampaignId=?',_0x2d52d4['params']['id'][_0x2257('0x7a')]())['where'](_0x2257('0x8f'),_0x1f01a2))[_0x2257('0x7a')]();_0xca0d7d[_0x2257('0x90')](db[_0x2257('0x91')][_0x2257('0x33')](_0x57445e));_0x44785c[_0x2257('0x90')](db[_0x2257('0x91')]['query'](_0x37c5a0));}return BPromise[_0x2257('0x92')](_0xca0d7d);}})[_0x2257('0x27')](function(){return BPromise['all'](_0x44785c);})[_0x2257('0x27')](function(){return _0x5b92c4;})[_0x2257('0x27')](respondWithResult(_0x1862b9,null))['catch'](handleError(_0x1862b9,null));};exports[_0x2257('0x93')]=function(_0x4ab15c,_0xb5f5bd,_0x237d53){return db['Campaign'][_0x2257('0x48')]({'where':{'id':_0x4ab15c[_0x2257('0x54')]['id']}})[_0x2257('0x27')](handleEntityNotFound(_0xb5f5bd,null))[_0x2257('0x27')](function(_0x3cdfe6){if(_0x3cdfe6){return _0x3cdfe6[_0x2257('0x93')](_0x4ab15c['query'][_0x2257('0x6b')]);}})[_0x2257('0x27')](function(_0x13b2a7){if(_0x13b2a7){return db[_0x2257('0x5d')][_0x2257('0x28')]({'where':{'ListId':_0x4ab15c['query'][_0x2257('0x6b')],'CampaignId':_0x4ab15c['params']['id']}})[_0x2257('0x27')](function(){return _0x13b2a7;});}})[_0x2257('0x27')](respondWithStatusCode(_0xb5f5bd,null))['catch'](handleError(_0xb5f5bd,null));};exports['getBlackLists']=function(_0xda9c32,_0x22e54a,_0x7a95da){var _0x27605b={};var _0x40fd8c={};var _0x5b4f5d;var _0x4e2cf3;return db[_0x2257('0x44')]['findOne']({'where':{'id':_0xda9c32[_0x2257('0x54')]['id']}})['then'](handleEntityNotFound(_0x22e54a,null))[_0x2257('0x27')](function(_0x19e3c5){if(_0x19e3c5){_0x5b4f5d=_0x19e3c5;_0x40fd8c[_0x2257('0x32')]=_[_0x2257('0x34')](db[_0x2257('0x66')][_0x2257('0x55')]);_0x40fd8c['query']=_['keys'](_0xda9c32[_0x2257('0x33')]);_0x40fd8c['filters']=_[_0x2257('0x36')](_0x40fd8c[_0x2257('0x32')],_0x40fd8c[_0x2257('0x33')]);_0x27605b[_0x2257('0x38')]=_[_0x2257('0x36')](_0x40fd8c['model'],qs['fields'](_0xda9c32[_0x2257('0x33')][_0x2257('0x37')]));_0x27605b[_0x2257('0x38')]=_0x27605b[_0x2257('0x38')][_0x2257('0x39')]?_0x27605b[_0x2257('0x38')]:_0x40fd8c[_0x2257('0x32')];_0x27605b[_0x2257('0x3c')]=qs[_0x2257('0x3d')](_0xda9c32['query']['sort']);_0x27605b[_0x2257('0x3e')]=qs[_0x2257('0x35')](_['pick'](_0xda9c32[_0x2257('0x33')],_0x40fd8c[_0x2257('0x35')]));if(_0xda9c32['query'][_0x2257('0x40')]){_0x27605b[_0x2257('0x3e')]=_[_0x2257('0x41')](_0x27605b[_0x2257('0x3e')],{'$or':_[_0x2257('0x2e')](_0x27605b['attributes'],function(_0x315fcf){var _0xd0a90f={};_0xd0a90f[_0x315fcf]={'$like':'%'+_0xda9c32[_0x2257('0x33')][_0x2257('0x40')]+'%'};return _0xd0a90f;})});}_0x27605b=_[_0x2257('0x41')]({},_0x27605b,_0xda9c32[_0x2257('0x43')]);return _0x5b4f5d[_0x2257('0x94')](_0x27605b);}})[_0x2257('0x27')](function(_0x25d9b0){if(_0x25d9b0){_0x4e2cf3=_0x25d9b0[_0x2257('0x39')];if(!_0xda9c32[_0x2257('0x33')]['hasOwnProperty'](_0x2257('0x3b'))){_0x27605b[_0x2257('0x1f')]=qs[_0x2257('0x1f')](_0xda9c32['query']['limit']);_0x27605b[_0x2257('0x20')]=qs[_0x2257('0x20')](_0xda9c32[_0x2257('0x33')]['offset']);}return _0x5b4f5d['getBlackLists'](_0x27605b);}})['then'](function(_0x586dd8){if(_0x586dd8){return _0x586dd8?{'count':_0x4e2cf3,'rows':_0x586dd8}:null;}})['then'](respondWithResult(_0x22e54a,null))[_0x2257('0x49')](handleError(_0x22e54a,null));};exports[_0x2257('0x95')]=function(_0x1177b1,_0x1b9ec1,_0x20cd6c){var _0x15365c,_0x8501c4;var _0x4e2296=[];var _0x3bb81e=moment()[_0x2257('0x69')](_0x2257('0x6a'));return db[_0x2257('0x44')][_0x2257('0x48')]({'where':{'id':_0x1177b1[_0x2257('0x54')]['id']}})[_0x2257('0x27')](handleEntityNotFound(_0x1b9ec1,null))[_0x2257('0x27')](function(_0xf6c510){if(_0xf6c510){_0x8501c4=_0xf6c510;return _0xf6c510['addBlackLists'](_0x1177b1['body']['ids'],_['omit'](_0x1177b1[_0x2257('0x59')],['ids','id'])||{});}return null;})[_0x2257('0x6c')](function(_0x120572){var _0x2f7534;var _0x5ef0d0;_0x15365c=_0x120572||[];var _0x41a1a4=[];if(_0x120572){for(var _0x414f06=0x0;_0x414f06<_0x120572[_0x2257('0x39')];_0x414f06+=0x1){var _0x277af3=_0x120572[_0x414f06][_0x2257('0x4c')]({'plain':!![]});_0x2f7534=squel[_0x2257('0x6f')]()[_0x2257('0x70')]('cm_hopper_black')[_0x2257('0x86')]([_0x2257('0x72'),_0x2257('0x74'),_0x2257('0x75'),'CampaignId',_0x2257('0x57'),_0x2257('0x58')],squel[_0x2257('0x76')]()[_0x2257('0x77')](_0x2257('0x72'),_0x2257('0x72'))[_0x2257('0x77')]('id',_0x2257('0x74'))['field'](_0x277af3[_0x2257('0x79')][_0x2257('0x7a')](),_0x2257('0x75'))[_0x2257('0x77')](_0x1177b1['params']['id'][_0x2257('0x7a')](),_0x2257('0x5e'))[_0x2257('0x77')]('NOW()',_0x2257('0x57'))[_0x2257('0x77')](_0x2257('0x78'),_0x2257('0x58'))[_0x2257('0x7b')]('cm_contacts')[_0x2257('0x3e')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x277af3[_0x2257('0x79')][_0x2257('0x7a')]())[_0x2257('0x3e')](_0x2257('0x7f')))['toString']();_0x41a1a4[_0x2257('0x90')](db['sequelize'][_0x2257('0x33')](_0x2f7534));}return BPromise[_0x2257('0x92')](_0x41a1a4);}})['then'](function(){return _0x15365c;})['then'](respondWithResult(_0x1b9ec1,null))['catch'](handleError(_0x1b9ec1,null));};exports['removeBlackLists']=function(_0x3d6cc7,_0x530e81,_0x22c41f){return db[_0x2257('0x44')][_0x2257('0x48')]({'where':{'id':_0x3d6cc7[_0x2257('0x54')]['id']}})[_0x2257('0x27')](handleEntityNotFound(_0x530e81,null))[_0x2257('0x27')](function(_0x3bd137){if(_0x3bd137){return _0x3bd137[_0x2257('0x96')](_0x3d6cc7['query'][_0x2257('0x6b')]);}})[_0x2257('0x27')](function(_0x1ece1c){if(_0x1ece1c){return db[_0x2257('0x65')]['destroy']({'where':{'ListId':_0x3d6cc7[_0x2257('0x33')][_0x2257('0x6b')],'CampaignId':_0x3d6cc7[_0x2257('0x54')]['id']}})[_0x2257('0x27')](function(){return _0x1ece1c;});}})[_0x2257('0x27')](respondWithStatusCode(_0x530e81,null))[_0x2257('0x49')](handleError(_0x530e81,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index fc5fbfb..1f9c822 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x7a54,0x106));var _0x47a5=function(_0x31fca8,_0xd6b571){_0x31fca8=_0x31fca8-0x0;var _0x8deb85=_0x7a54[_0x31fca8];return _0x8deb85;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 8446806..95a7ed5 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 _0x0b40=['Campaign,\x20%s,\x20%s','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc391bf,_0x5cc846){var _0x4bd503=function(_0x6970a9){while(--_0x6970a9){_0xc391bf['push'](_0xc391bf['shift']());}};_0x4bd503(++_0x5cc846);}(_0x0b40,0xba));var _0x00b4=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x0b40[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require('lodash');var util=require(_0x00b4('0x0'));var moment=require(_0x00b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x00b4('0x2'));var fs=require('fs');var Redis=require(_0x00b4('0x3'));var db=require(_0x00b4('0x4'))['db'];var utils=require(_0x00b4('0x5'));var logger=require(_0x00b4('0x6'))(_0x00b4('0x7'));var config=require('../../config/environment');var jayson=require(_0x00b4('0x8'));var client=jayson[_0x00b4('0x9')][_0x00b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x120157,_0x5684ec,_0x445536){return new BPromise(function(_0x20c810,_0x3f6285){return client['request'](_0x120157,_0x445536)[_0x00b4('0xb')](function(_0x144611){logger['info']('Campaign,\x20%s,\x20%s',_0x5684ec,_0x00b4('0xc'));logger[_0x00b4('0xd')](_0x00b4('0xe'),_0x5684ec,_0x00b4('0xc'),JSON[_0x00b4('0xf')](_0x144611));if(_0x144611[_0x00b4('0x10')]){if(_0x144611[_0x00b4('0x10')][_0x00b4('0x11')]===0x1f4){logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x144611[_0x00b4('0x10')][_0x00b4('0x13')]);return _0x3f6285(_0x144611['error']['message']);}logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x144611[_0x00b4('0x10')][_0x00b4('0x13')]);return _0x20c810(_0x144611['error'][_0x00b4('0x13')]);}else{logger[_0x00b4('0x14')](_0x00b4('0x12'),_0x5684ec,_0x00b4('0xc'));_0x20c810(_0x144611[_0x00b4('0x15')][_0x00b4('0x13')]);}})[_0x00b4('0x16')](function(_0x56e54c){logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x56e54c);_0x3f6285(_0x56e54c);});});}exports[_0x00b4('0x17')]=function(_0x3f4b1d){var _0x24a5be=this;return new Promise(function(_0x5d960a,_0x265dbd){return db[_0x00b4('0x18')][_0x00b4('0x19')]({'raw':_0x3f4b1d['options']?_0x3f4b1d[_0x00b4('0x1a')][_0x00b4('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f4b1d[_0x00b4('0x1a')]?_0x3f4b1d[_0x00b4('0x1a')][_0x00b4('0x1c')]||null:null,'attributes':_0x3f4b1d['options']?_0x3f4b1d['options'][_0x00b4('0x1d')]||null:null,'limit':_0x3f4b1d[_0x00b4('0x1a')]?_0x3f4b1d[_0x00b4('0x1a')][_0x00b4('0x1e')]||null:null,'include':_0x3f4b1d[_0x00b4('0x1a')]?_0x3f4b1d['options'][_0x00b4('0x1f')]?_[_0x00b4('0x20')](_0x3f4b1d['options'][_0x00b4('0x1f')],function(_0x40d7ba){return{'model':db[_0x40d7ba[_0x00b4('0x21')]],'as':_0x40d7ba['as'],'attributes':_0x40d7ba['attributes'],'include':_0x40d7ba[_0x00b4('0x1f')]?_[_0x00b4('0x20')](_0x40d7ba[_0x00b4('0x1f')],function(_0x50d48d){return{'model':db[_0x50d48d['model']],'as':_0x50d48d['as'],'attributes':_0x50d48d[_0x00b4('0x1d')],'include':_0x50d48d[_0x00b4('0x1f')]?_[_0x00b4('0x20')](_0x50d48d[_0x00b4('0x1f')],function(_0x3cf0ff){return{'model':db[_0x3cf0ff[_0x00b4('0x21')]],'as':_0x3cf0ff['as'],'attributes':_0x3cf0ff['attributes']};}):[]};}):[]};}):[]:[]})[_0x00b4('0xb')](function(_0x3abc75){logger[_0x00b4('0x14')](_0x00b4('0x17'),_0x3f4b1d);logger[_0x00b4('0xd')](_0x00b4('0x17'),_0x3f4b1d,JSON[_0x00b4('0xf')](_0x3abc75));_0x5d960a(_0x3abc75);})[_0x00b4('0x16')](function(_0x3d3684){logger[_0x00b4('0x10')](_0x00b4('0x17'),_0x3d3684['message'],_0x3f4b1d);_0x265dbd(_0x24a5be[_0x00b4('0x10')](0x1f4,_0x3d3684[_0x00b4('0x13')]));});});}; \ No newline at end of file +var _0x00b3=['../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetCampaign','findAll','options','raw','where','attributes','limit','map','include','model','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x18dc31,_0xb80970){var _0xce6c40=function(_0x48c858){while(--_0x48c858){_0x18dc31['push'](_0x18dc31['shift']());}};_0xce6c40(++_0xb80970);}(_0x00b3,0x17a));var _0x300b=function(_0x40584b,_0xc288cb){_0x40584b=_0x40584b-0x0;var _0x12cbac=_0x00b3[_0x40584b];return _0x12cbac;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});}exports[_0x300b('0x15')]=function(_0x4d2024){var _0x1fbf16=this;return new Promise(function(_0x2a7d96,_0xb4b3fa){return db['Campaign'][_0x300b('0x16')]({'raw':_0x4d2024[_0x300b('0x17')]?_0x4d2024[_0x300b('0x17')][_0x300b('0x18')]===undefined?!![]:![]:!![],'where':_0x4d2024['options']?_0x4d2024[_0x300b('0x17')][_0x300b('0x19')]||null:null,'attributes':_0x4d2024[_0x300b('0x17')]?_0x4d2024['options'][_0x300b('0x1a')]||null:null,'limit':_0x4d2024[_0x300b('0x17')]?_0x4d2024[_0x300b('0x17')][_0x300b('0x1b')]||null:null,'include':_0x4d2024[_0x300b('0x17')]?_0x4d2024['options']['include']?_[_0x300b('0x1c')](_0x4d2024[_0x300b('0x17')][_0x300b('0x1d')],function(_0x3ea40b){return{'model':db[_0x3ea40b[_0x300b('0x1e')]],'as':_0x3ea40b['as'],'attributes':_0x3ea40b[_0x300b('0x1a')],'include':_0x3ea40b[_0x300b('0x1d')]?_[_0x300b('0x1c')](_0x3ea40b[_0x300b('0x1d')],function(_0x544658){return{'model':db[_0x544658[_0x300b('0x1e')]],'as':_0x544658['as'],'attributes':_0x544658[_0x300b('0x1a')],'include':_0x544658[_0x300b('0x1d')]?_[_0x300b('0x1c')](_0x544658['include'],function(_0x4f50b0){return{'model':db[_0x4f50b0['model']],'as':_0x4f50b0['as'],'attributes':_0x4f50b0[_0x300b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1241c7){logger[_0x300b('0x13')](_0x300b('0x15'),_0x4d2024);logger[_0x300b('0xe')](_0x300b('0x15'),_0x4d2024,JSON[_0x300b('0x10')](_0x1241c7));_0x2a7d96(_0x1241c7);})[_0x300b('0x1f')](function(_0x159b63){logger[_0x300b('0x11')](_0x300b('0x15'),_0x159b63['message'],_0x4d2024);_0xb4b3fa(_0x1fbf16['error'](0x1f4,_0x159b63[_0x300b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 183efdc..a6e5d20 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 _0x93da=['/:id/clone','clone','addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create'];(function(_0x52f773,_0x25eeb7){var _0x43fa26=function(_0x7d1470){while(--_0x7d1470){_0x52f773['push'](_0x52f773['shift']());}};_0x43fa26(++_0x25eeb7);}(_0x93da,0x92));var _0xa93d=function(_0x2a36e6,_0x250137){_0x2a36e6=_0x2a36e6-0x0;var _0x438728=_0x93da[_0x2a36e6];return _0x438728;};'use strict';var multer=require(_0xa93d('0x0'));var util=require('util');var path=require(_0xa93d('0x1'));var timeout=require(_0xa93d('0x2'));var express=require(_0xa93d('0x3'));var router=express[_0xa93d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa93d('0x5'));var controller=require(_0xa93d('0x6'));router[_0xa93d('0x7')]('/',auth[_0xa93d('0x8')](),controller[_0xa93d('0x9')]);router[_0xa93d('0x7')](_0xa93d('0xa'),auth[_0xa93d('0x8')](),controller[_0xa93d('0xb')]);router['get'](_0xa93d('0xc'),auth['isAuthenticated'](),controller[_0xa93d('0xd')]);router[_0xa93d('0x7')](_0xa93d('0xe'),auth['isAuthenticated'](),controller[_0xa93d('0xf')]);router[_0xa93d('0x7')](_0xa93d('0x10'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x11')]);router['get']('/:id/hopper_black',auth[_0xa93d('0x8')](),controller['getHopperBlacks']);router[_0xa93d('0x7')](_0xa93d('0x12'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x13')]);router[_0xa93d('0x7')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x15')]);router[_0xa93d('0x16')]('/',auth[_0xa93d('0x8')](),controller[_0xa93d('0x17')]);router[_0xa93d('0x16')](_0xa93d('0x18'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x19')]);router['post']('/:id/lists',auth[_0xa93d('0x8')](),controller[_0xa93d('0x1a')]);router[_0xa93d('0x16')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x1b')]);router[_0xa93d('0x1c')](_0xa93d('0xa'),auth[_0xa93d('0x8')](),controller['update']);router[_0xa93d('0x1d')](_0xa93d('0xa'),auth['isAuthenticated'](),controller[_0xa93d('0x1e')]);router[_0xa93d('0x1d')](_0xa93d('0x12'),auth['isAuthenticated'](),controller[_0xa93d('0x1f')]);router[_0xa93d('0x1d')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x20')]);module[_0xa93d('0x21')]=router; \ No newline at end of file +var _0xaec6=['../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','clone','addLists','put','update','delete','removeLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3658cc,_0x382024){var _0x59802c=function(_0x5ca0eb){while(--_0x5ca0eb){_0x3658cc['push'](_0x3658cc['shift']());}};_0x59802c(++_0x382024);}(_0xaec6,0x172));var _0x6aec=function(_0x317146,_0x5e2833){_0x317146=_0x317146-0x0;var _0xf4778c=_0xaec6[_0x317146];return _0xf4778c;};'use strict';var multer=require(_0x6aec('0x0'));var util=require(_0x6aec('0x1'));var path=require(_0x6aec('0x2'));var timeout=require(_0x6aec('0x3'));var express=require('express');var router=express[_0x6aec('0x4')]();var fs_extra=require(_0x6aec('0x5'));var auth=require(_0x6aec('0x6'));var interaction=require(_0x6aec('0x7'));var config=require(_0x6aec('0x8'));var controller=require(_0x6aec('0x9'));router[_0x6aec('0xa')]('/',auth[_0x6aec('0xb')](),controller[_0x6aec('0xc')]);router[_0x6aec('0xa')]('/:id',auth[_0x6aec('0xb')](),controller['show']);router[_0x6aec('0xa')]('/:id/hoppers',auth[_0x6aec('0xb')](),controller['getHoppers']);router['get'](_0x6aec('0xd'),auth[_0x6aec('0xb')](),controller[_0x6aec('0xe')]);router[_0x6aec('0xa')](_0x6aec('0xf'),auth[_0x6aec('0xb')](),controller['getHopperFinals']);router[_0x6aec('0xa')](_0x6aec('0x10'),auth['isAuthenticated'](),controller[_0x6aec('0x11')]);router[_0x6aec('0xa')](_0x6aec('0x12'),auth[_0x6aec('0xb')](),controller['getLists']);router[_0x6aec('0xa')](_0x6aec('0x13'),auth[_0x6aec('0xb')](),controller[_0x6aec('0x14')]);router[_0x6aec('0x15')]('/',auth[_0x6aec('0xb')](),controller['create']);router[_0x6aec('0x15')]('/:id/clone',auth[_0x6aec('0xb')](),controller[_0x6aec('0x16')]);router['post'](_0x6aec('0x12'),auth[_0x6aec('0xb')](),controller[_0x6aec('0x17')]);router[_0x6aec('0x15')](_0x6aec('0x13'),auth[_0x6aec('0xb')](),controller['addBlackLists']);router[_0x6aec('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6aec('0x19')]);router[_0x6aec('0x1a')]('/:id',auth[_0x6aec('0xb')](),controller['destroy']);router[_0x6aec('0x1a')]('/:id/lists',auth[_0x6aec('0xb')](),controller[_0x6aec('0x1b')]);router['delete'](_0x6aec('0x13'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x6aec('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 2ae8e25..23414c8 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 _0xc292=['medium','VIRTUAL','key','exports','STRING','TEXT'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xc292,0x141));var _0x2c29=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc292[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');module[_0x2c29('0x0')]={'key':{'type':Sequelize[_0x2c29('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x2c29('0x2')],'length':_0x2c29('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2c29('0x1')]},'name':{'type':Sequelize[_0x2c29('0x4')],'get':function(){return this['getDataValue'](_0x2c29('0x5'));}}}; \ No newline at end of file +var _0x19d9=['exports','STRING','medium','getDataValue','sequelize'];(function(_0x3645ab,_0x476d98){var _0x51b4f7=function(_0x4e3bd9){while(--_0x4e3bd9){_0x3645ab['push'](_0x3645ab['shift']());}};_0x51b4f7(++_0x476d98);}(_0x19d9,0x9a));var _0x919d=function(_0x5d6490,_0x26c65d){_0x5d6490=_0x5d6490-0x0;var _0x1b3d9c=_0x19d9[_0x5d6490];return _0x1b3d9c;};'use strict';var Sequelize=require(_0x919d('0x0'));module[_0x919d('0x1')]={'key':{'type':Sequelize[_0x919d('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x919d('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x919d('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 123e77c..599a259 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 _0xfbc8=['rows','show','params','catch','update','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','get','CannedAnswers','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','CannedAnswer','findAll'];(function(_0xaee297,_0x58190c){var _0x90293c=function(_0x281ba3){while(--_0x281ba3){_0xaee297['push'](_0xaee297['shift']());}};_0x90293c(++_0x58190c);}(_0xfbc8,0x1bb));var _0x8fbc=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0xfbc8[_0x45cd35];return _0x16db84;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8fbc('0x0'));var jsonpatch=require(_0x8fbc('0x1'));var rp=require(_0x8fbc('0x2'));var moment=require(_0x8fbc('0x3'));var BPromise=require(_0x8fbc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8fbc('0x5'));var sox=require(_0x8fbc('0x6'));var csv=require(_0x8fbc('0x7'));var ejs=require(_0x8fbc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fbc('0x9'));var squel=require(_0x8fbc('0xa'));var crypto=require(_0x8fbc('0xb'));var jsforce=require(_0x8fbc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8fbc('0x7'));var querystring=require(_0x8fbc('0xd'));var Papa=require(_0x8fbc('0xe'));var Redis=require('ioredis');var authService=require(_0x8fbc('0xf'));var qs=require(_0x8fbc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fbc('0x11'));var logger=require('../../config/logger')(_0x8fbc('0x12'));var utils=require('../../config/utils');var config=require(_0x8fbc('0x13'));var licenseUtil=require(_0x8fbc('0x14'));var db=require(_0x8fbc('0x15'))['db'];function respondWithStatusCode(_0x3d8a17,_0xcdfa91){_0xcdfa91=_0xcdfa91||0xcc;return function(_0x89f19a){if(_0x89f19a){return _0x3d8a17[_0x8fbc('0x16')](_0xcdfa91);}return _0x3d8a17[_0x8fbc('0x17')](_0xcdfa91)[_0x8fbc('0x18')]();};}function respondWithResult(_0x29ab06,_0x27bff9){_0x27bff9=_0x27bff9||0xc8;return function(_0x35ae1a){if(_0x35ae1a){return _0x29ab06[_0x8fbc('0x17')](_0x27bff9)[_0x8fbc('0x19')](_0x35ae1a);}};}function respondWithFilteredResult(_0x55cd74,_0x47cf48){return function(_0x3b92eb){if(_0x3b92eb){var _0x3b070d=typeof _0x47cf48['offset']===_0x8fbc('0x1a')&&typeof _0x47cf48[_0x8fbc('0x1b')]===_0x8fbc('0x1a');var _0x4ce8c3=_0x3b92eb[_0x8fbc('0x1c')];var _0x5896e5=_0x3b070d?0x0:_0x47cf48[_0x8fbc('0x1d')];var _0x19c23c=_0x3b070d?_0x3b92eb['count']:_0x47cf48[_0x8fbc('0x1d')]+_0x47cf48[_0x8fbc('0x1b')];var _0x231206;if(_0x19c23c>=_0x4ce8c3){_0x19c23c=_0x4ce8c3;_0x231206=0xc8;}else{_0x231206=0xce;}_0x55cd74[_0x8fbc('0x17')](_0x231206);return _0x55cd74[_0x8fbc('0x1e')](_0x8fbc('0x1f'),_0x5896e5+'-'+_0x19c23c+'/'+_0x4ce8c3)['json'](_0x3b92eb);}return null;};}function patchUpdates(_0x4d74a8){return function(_0x38ffb8){try{jsonpatch[_0x8fbc('0x20')](_0x38ffb8,_0x4d74a8,!![]);}catch(_0x32bcb6){return BPromise[_0x8fbc('0x21')](_0x32bcb6);}return _0x38ffb8[_0x8fbc('0x22')]();};}function saveUpdates(_0x354c90,_0x3be4a2){return function(_0x51167e){if(_0x51167e){return _0x51167e['update'](_0x354c90)['then'](function(_0x19ed0a){return _0x19ed0a;});}return null;};}function removeEntity(_0x1bae03,_0x36371c){return function(_0x5059a6){if(_0x5059a6){return _0x5059a6['destroy']()['then'](function(){var _0x329b12=_0x5059a6[_0x8fbc('0x23')]({'plain':!![]});var _0x55d9fc=_0x8fbc('0x24');return db['UserProfileResource'][_0x8fbc('0x25')]({'where':{'type':_0x55d9fc,'resourceId':_0x329b12['id']}})[_0x8fbc('0x26')](function(){return _0x5059a6;});})['then'](function(){_0x1bae03[_0x8fbc('0x17')](0xcc)[_0x8fbc('0x18')]();});}};}function handleEntityNotFound(_0x1097bb,_0x1cc446){return function(_0x508595){if(!_0x508595){_0x1097bb[_0x8fbc('0x16')](0x194);}return _0x508595;};}function handleError(_0x1177da,_0x51d9ae){_0x51d9ae=_0x51d9ae||0x1f4;return function(_0x4fbce9){logger[_0x8fbc('0x27')](_0x4fbce9[_0x8fbc('0x28')]);if(_0x4fbce9[_0x8fbc('0x29')]){delete _0x4fbce9[_0x8fbc('0x29')];}_0x1177da[_0x8fbc('0x17')](_0x51d9ae)['send'](_0x4fbce9);};}exports[_0x8fbc('0x2a')]=function(_0x1741cc,_0x3f1eee){var _0x573a53={},_0x48e06e={},_0x8801f0={'count':0x0,'rows':[]};var _0x462283=_['map'](db['CannedAnswer'][_0x8fbc('0x2b')],function(_0x3e0a5e){return{'name':_0x3e0a5e[_0x8fbc('0x2c')],'type':_0x3e0a5e[_0x8fbc('0x2d')]['key']};});_0x48e06e[_0x8fbc('0x2e')]=_[_0x8fbc('0x2f')](_0x462283,'name');_0x48e06e[_0x8fbc('0x30')]=_[_0x8fbc('0x31')](_0x1741cc[_0x8fbc('0x30')]);_0x48e06e[_0x8fbc('0x32')]=_[_0x8fbc('0x33')](_0x48e06e['model'],_0x48e06e[_0x8fbc('0x30')]);_0x573a53[_0x8fbc('0x34')]=_[_0x8fbc('0x33')](_0x48e06e[_0x8fbc('0x2e')],qs[_0x8fbc('0x35')](_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x35')]));_0x573a53[_0x8fbc('0x34')]=_0x573a53[_0x8fbc('0x34')][_0x8fbc('0x36')]?_0x573a53[_0x8fbc('0x34')]:_0x48e06e[_0x8fbc('0x2e')];if(!_0x1741cc['query'][_0x8fbc('0x37')](_0x8fbc('0x38'))){_0x573a53['limit']=qs[_0x8fbc('0x1b')](_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x1b')]);_0x573a53[_0x8fbc('0x1d')]=qs[_0x8fbc('0x1d')](_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x1d')]);}_0x573a53['order']=qs[_0x8fbc('0x39')](_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x39')]);_0x573a53[_0x8fbc('0x3a')]=qs[_0x8fbc('0x32')](_[_0x8fbc('0x3b')](_0x1741cc[_0x8fbc('0x30')],_0x48e06e[_0x8fbc('0x32')]),_0x462283);if(_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x3c')]){_0x573a53[_0x8fbc('0x3a')]=_[_0x8fbc('0x3d')](_0x573a53[_0x8fbc('0x3a')],{'$or':[{'key':{'$like':'%'+_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x3c')]+'%'}},{'value':{'$like':'%'+_0x1741cc['query'][_0x8fbc('0x3c')]+'%'}}]});}_0x573a53=_[_0x8fbc('0x3d')]({},_0x573a53,_0x1741cc[_0x8fbc('0x3e')]);var _0x47b7aa={'where':_0x573a53[_0x8fbc('0x3a')]};return db['CannedAnswer'][_0x8fbc('0x1c')](_0x47b7aa)[_0x8fbc('0x26')](function(_0x5bbe31){_0x8801f0[_0x8fbc('0x1c')]=_0x5bbe31;if(_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x3f')]){_0x573a53[_0x8fbc('0x40')]=[{'all':!![]}];}return db[_0x8fbc('0x41')][_0x8fbc('0x42')](_0x573a53);})[_0x8fbc('0x26')](function(_0x37dbc8){_0x8801f0[_0x8fbc('0x43')]=_0x37dbc8;return _0x8801f0;})['then'](respondWithFilteredResult(_0x3f1eee,_0x573a53))['catch'](handleError(_0x3f1eee,null));};exports[_0x8fbc('0x44')]=function(_0x12d9fb,_0x5e4378){var _0x2da16d={'raw':!![],'where':{'id':_0x12d9fb[_0x8fbc('0x45')]['id']}},_0x2df1c0={};_0x2df1c0[_0x8fbc('0x2e')]=_['keys'](db[_0x8fbc('0x41')][_0x8fbc('0x2b')]);_0x2df1c0['query']=_[_0x8fbc('0x31')](_0x12d9fb[_0x8fbc('0x30')]);_0x2df1c0[_0x8fbc('0x32')]=_[_0x8fbc('0x33')](_0x2df1c0['model'],_0x2df1c0[_0x8fbc('0x30')]);_0x2da16d['attributes']=_[_0x8fbc('0x33')](_0x2df1c0[_0x8fbc('0x2e')],qs['fields'](_0x12d9fb[_0x8fbc('0x30')][_0x8fbc('0x35')]));_0x2da16d['attributes']=_0x2da16d[_0x8fbc('0x34')]['length']?_0x2da16d['attributes']:_0x2df1c0[_0x8fbc('0x2e')];if(_0x12d9fb[_0x8fbc('0x30')]['includeAll']){_0x2da16d['include']=[{'all':!![]}];}_0x2da16d=_[_0x8fbc('0x3d')]({},_0x2da16d,_0x12d9fb[_0x8fbc('0x3e')]);return db['CannedAnswer']['find'](_0x2da16d)[_0x8fbc('0x26')](handleEntityNotFound(_0x5e4378,null))[_0x8fbc('0x26')](respondWithResult(_0x5e4378,null))[_0x8fbc('0x46')](handleError(_0x5e4378,null));};exports[_0x8fbc('0x47')]=function(_0xcbe79b,_0x5e9dd9){if(_0xcbe79b[_0x8fbc('0x48')]['id']){delete _0xcbe79b['body']['id'];}return db[_0x8fbc('0x41')][_0x8fbc('0x49')]({'where':{'id':_0xcbe79b[_0x8fbc('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e9dd9,null))['then'](saveUpdates(_0xcbe79b[_0x8fbc('0x48')],null))[_0x8fbc('0x26')](respondWithResult(_0x5e9dd9,null))[_0x8fbc('0x46')](handleError(_0x5e9dd9,null));};exports[_0x8fbc('0x25')]=function(_0x4aa8d7,_0x29714d){return db[_0x8fbc('0x41')]['find']({'where':{'id':_0x4aa8d7['params']['id']}})[_0x8fbc('0x26')](handleEntityNotFound(_0x29714d,null))['then'](removeEntity(_0x29714d,null))['catch'](handleError(_0x29714d,null));};exports['create']=function(_0xa18dfe,_0x439ee2){var _0x457947={'key':_0xa18dfe['body']['key']};if(_0xa18dfe[_0x8fbc('0x48')][_0x8fbc('0x4a')]){_0x457947[_0x8fbc('0x4a')]=_0xa18dfe[_0x8fbc('0x48')]['MailAccountId'];}else if(_0xa18dfe[_0x8fbc('0x48')][_0x8fbc('0x4b')]){_0x457947[_0x8fbc('0x4b')]=_0xa18dfe[_0x8fbc('0x48')][_0x8fbc('0x4b')];}else if(_0xa18dfe[_0x8fbc('0x48')]['OpenchannelAccountId']){_0x457947['OpenchannelAccountId']=_0xa18dfe['body'][_0x8fbc('0x4c')];}else if(_0xa18dfe[_0x8fbc('0x48')]['ChatWebsiteId']){_0x457947[_0x8fbc('0x4d')]=_0xa18dfe[_0x8fbc('0x48')][_0x8fbc('0x4d')];}return db[_0x8fbc('0x41')][_0x8fbc('0x49')]({'where':_0x457947})[_0x8fbc('0x26')](function(_0x26ce58){if(_0x26ce58){throw new db[(_0x8fbc('0x4e'))][(_0x8fbc('0x4f'))](_0x8fbc('0x50'));}return db[_0x8fbc('0x41')]['create'](_0xa18dfe[_0x8fbc('0x48')]);})[_0x8fbc('0x26')](function(_0x3135c9){var _0xca4537=_0xa18dfe['user']['get']({'plain':!![]});if(!_0xca4537)throw new Error(_0x8fbc('0x51'));if(_0xca4537[_0x8fbc('0x52')]==='user'){var _0x166126=_0x3135c9[_0x8fbc('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x8fbc('0x49')]({'where':{'name':_0x8fbc('0x24'),'userProfileId':_0xca4537[_0x8fbc('0x53')]},'raw':!![]})['then'](function(_0x2ad0dd){if(_0x2ad0dd&&_0x2ad0dd[_0x8fbc('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x166126['name'],'resourceId':_0x166126['id'],'type':_0x2ad0dd[_0x8fbc('0x29')],'sectionId':_0x2ad0dd['id']},{})[_0x8fbc('0x26')](function(){return _0x3135c9;});}else{return _0x3135c9;}})['catch'](function(_0x230267){logger[_0x8fbc('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x230267);throw _0x230267;});}return _0x3135c9;})[_0x8fbc('0x26')](respondWithResult(_0x439ee2,0xc9))[_0x8fbc('0x46')](handleError(_0x439ee2,null));}; \ No newline at end of file +var _0x7bf1=['request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','stack','name','send','CannedAnswer','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','catch','show','length','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch'];(function(_0x18eac0,_0x35ed08){var _0x1a1fcd=function(_0x154b8c){while(--_0x154b8c){_0x18eac0['push'](_0x18eac0['shift']());}};_0x1a1fcd(++_0x35ed08);}(_0x7bf1,0x1ba));var _0x17bf=function(_0x406ebd,_0x5ec435){_0x406ebd=_0x406ebd-0x0;var _0x535dbe=_0x7bf1[_0x406ebd];return _0x535dbe;};'use strict';var emlformat=require(_0x17bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17bf('0x1'));var jsonpatch=require(_0x17bf('0x2'));var rp=require(_0x17bf('0x3'));var moment=require(_0x17bf('0x4'));var BPromise=require(_0x17bf('0x5'));var Mustache=require('mustache');var util=require(_0x17bf('0x6'));var path=require(_0x17bf('0x7'));var sox=require(_0x17bf('0x8'));var csv=require('to-csv');var ejs=require(_0x17bf('0x9'));var fs=require('fs');var fs_extra=require(_0x17bf('0xa'));var _=require(_0x17bf('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x17bf('0xc'));var deskjs=require(_0x17bf('0xd'));var toCsv=require(_0x17bf('0xe'));var querystring=require(_0x17bf('0xf'));var Papa=require(_0x17bf('0x10'));var Redis=require('ioredis');var authService=require(_0x17bf('0x11'));var qs=require(_0x17bf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17bf('0x13'));var logger=require(_0x17bf('0x14'))('api');var utils=require(_0x17bf('0x15'));var config=require(_0x17bf('0x16'));var licenseUtil=require(_0x17bf('0x17'));var db=require(_0x17bf('0x18'))['db'];function respondWithStatusCode(_0x128c5b,_0x48e93f){_0x48e93f=_0x48e93f||0xcc;return function(_0x3be8b9){if(_0x3be8b9){return _0x128c5b[_0x17bf('0x19')](_0x48e93f);}return _0x128c5b[_0x17bf('0x1a')](_0x48e93f)[_0x17bf('0x1b')]();};}function respondWithResult(_0x386e0f,_0x156b0f){_0x156b0f=_0x156b0f||0xc8;return function(_0x345430){if(_0x345430){return _0x386e0f['status'](_0x156b0f)[_0x17bf('0x1c')](_0x345430);}};}function respondWithFilteredResult(_0x1af0c7,_0x115567){return function(_0x52e18b){if(_0x52e18b){var _0x216fb9=typeof _0x115567[_0x17bf('0x1d')]===_0x17bf('0x1e')&&typeof _0x115567[_0x17bf('0x1f')]===_0x17bf('0x1e');var _0x141e38=_0x52e18b[_0x17bf('0x20')];var _0x17d58e=_0x216fb9?0x0:_0x115567['offset'];var _0xeba640=_0x216fb9?_0x52e18b['count']:_0x115567[_0x17bf('0x1d')]+_0x115567[_0x17bf('0x1f')];var _0x39081b;if(_0xeba640>=_0x141e38){_0xeba640=_0x141e38;_0x39081b=0xc8;}else{_0x39081b=0xce;}_0x1af0c7[_0x17bf('0x1a')](_0x39081b);return _0x1af0c7[_0x17bf('0x21')](_0x17bf('0x22'),_0x17d58e+'-'+_0xeba640+'/'+_0x141e38)['json'](_0x52e18b);}return null;};}function patchUpdates(_0x5ef84d){return function(_0x362183){try{jsonpatch['apply'](_0x362183,_0x5ef84d,!![]);}catch(_0x4e8589){return BPromise[_0x17bf('0x23')](_0x4e8589);}return _0x362183['save']();};}function saveUpdates(_0x49323c,_0x1acf72){return function(_0x172e66){if(_0x172e66){return _0x172e66[_0x17bf('0x24')](_0x49323c)[_0x17bf('0x25')](function(_0x2a6f86){return _0x2a6f86;});}return null;};}function removeEntity(_0x51b9d4,_0x2d83b8){return function(_0x873b21){if(_0x873b21){return _0x873b21[_0x17bf('0x26')]()[_0x17bf('0x25')](function(){var _0x48e592=_0x873b21[_0x17bf('0x27')]({'plain':!![]});var _0x4614c9='CannedAnswers';return db[_0x17bf('0x28')][_0x17bf('0x26')]({'where':{'type':_0x4614c9,'resourceId':_0x48e592['id']}})['then'](function(){return _0x873b21;});})[_0x17bf('0x25')](function(){_0x51b9d4[_0x17bf('0x1a')](0xcc)[_0x17bf('0x1b')]();});}};}function handleEntityNotFound(_0x2da209,_0x5ed938){return function(_0x1216b4){if(!_0x1216b4){_0x2da209[_0x17bf('0x19')](0x194);}return _0x1216b4;};}function handleError(_0xf3123a,_0x14aaaf){_0x14aaaf=_0x14aaaf||0x1f4;return function(_0x1e0686){logger['error'](_0x1e0686[_0x17bf('0x29')]);if(_0x1e0686[_0x17bf('0x2a')]){delete _0x1e0686[_0x17bf('0x2a')];}_0xf3123a[_0x17bf('0x1a')](_0x14aaaf)[_0x17bf('0x2b')](_0x1e0686);};}exports['index']=function(_0xb988ba,_0x36a627){var _0x40568b={},_0x5bad2f={},_0x5e92d4={'count':0x0,'rows':[]};var _0x366fff=_['map'](db[_0x17bf('0x2c')][_0x17bf('0x2d')],function(_0x336070){return{'name':_0x336070[_0x17bf('0x2e')],'type':_0x336070[_0x17bf('0x2f')][_0x17bf('0x30')]};});_0x5bad2f[_0x17bf('0x31')]=_[_0x17bf('0x32')](_0x366fff,_0x17bf('0x2a'));_0x5bad2f['query']=_[_0x17bf('0x33')](_0xb988ba[_0x17bf('0x34')]);_0x5bad2f[_0x17bf('0x35')]=_['intersection'](_0x5bad2f[_0x17bf('0x31')],_0x5bad2f[_0x17bf('0x34')]);_0x40568b[_0x17bf('0x36')]=_[_0x17bf('0x37')](_0x5bad2f[_0x17bf('0x31')],qs[_0x17bf('0x38')](_0xb988ba[_0x17bf('0x34')][_0x17bf('0x38')]));_0x40568b[_0x17bf('0x36')]=_0x40568b[_0x17bf('0x36')]['length']?_0x40568b['attributes']:_0x5bad2f[_0x17bf('0x31')];if(!_0xb988ba[_0x17bf('0x34')][_0x17bf('0x39')](_0x17bf('0x3a'))){_0x40568b[_0x17bf('0x1f')]=qs[_0x17bf('0x1f')](_0xb988ba['query'][_0x17bf('0x1f')]);_0x40568b['offset']=qs['offset'](_0xb988ba[_0x17bf('0x34')][_0x17bf('0x1d')]);}_0x40568b[_0x17bf('0x3b')]=qs[_0x17bf('0x3c')](_0xb988ba[_0x17bf('0x34')][_0x17bf('0x3c')]);_0x40568b['where']=qs['filters'](_['pick'](_0xb988ba[_0x17bf('0x34')],_0x5bad2f['filters']),_0x366fff);if(_0xb988ba[_0x17bf('0x34')][_0x17bf('0x3d')]){_0x40568b[_0x17bf('0x3e')]=_[_0x17bf('0x3f')](_0x40568b[_0x17bf('0x3e')],{'$or':[{'key':{'$like':'%'+_0xb988ba[_0x17bf('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0xb988ba[_0x17bf('0x34')][_0x17bf('0x3d')]+'%'}}]});}_0x40568b=_['merge']({},_0x40568b,_0xb988ba[_0x17bf('0x40')]);var _0x3fc714={'where':_0x40568b[_0x17bf('0x3e')]};return db[_0x17bf('0x2c')][_0x17bf('0x20')](_0x3fc714)['then'](function(_0x38ccfd){_0x5e92d4[_0x17bf('0x20')]=_0x38ccfd;if(_0xb988ba['query'][_0x17bf('0x41')]){_0x40568b[_0x17bf('0x42')]=[{'all':!![]}];}return db[_0x17bf('0x2c')][_0x17bf('0x43')](_0x40568b);})[_0x17bf('0x25')](function(_0x3d51b3){_0x5e92d4['rows']=_0x3d51b3;return _0x5e92d4;})[_0x17bf('0x25')](respondWithFilteredResult(_0x36a627,_0x40568b))[_0x17bf('0x44')](handleError(_0x36a627,null));};exports[_0x17bf('0x45')]=function(_0xfcf9e4,_0x3b3c45){var _0x41f5dd={'raw':!![],'where':{'id':_0xfcf9e4['params']['id']}},_0x2a4129={};_0x2a4129[_0x17bf('0x31')]=_[_0x17bf('0x33')](db[_0x17bf('0x2c')][_0x17bf('0x2d')]);_0x2a4129[_0x17bf('0x34')]=_['keys'](_0xfcf9e4[_0x17bf('0x34')]);_0x2a4129[_0x17bf('0x35')]=_[_0x17bf('0x37')](_0x2a4129[_0x17bf('0x31')],_0x2a4129[_0x17bf('0x34')]);_0x41f5dd[_0x17bf('0x36')]=_['intersection'](_0x2a4129[_0x17bf('0x31')],qs[_0x17bf('0x38')](_0xfcf9e4[_0x17bf('0x34')][_0x17bf('0x38')]));_0x41f5dd[_0x17bf('0x36')]=_0x41f5dd[_0x17bf('0x36')][_0x17bf('0x46')]?_0x41f5dd[_0x17bf('0x36')]:_0x2a4129[_0x17bf('0x31')];if(_0xfcf9e4['query'][_0x17bf('0x41')]){_0x41f5dd[_0x17bf('0x42')]=[{'all':!![]}];}_0x41f5dd=_[_0x17bf('0x3f')]({},_0x41f5dd,_0xfcf9e4[_0x17bf('0x40')]);return db[_0x17bf('0x2c')][_0x17bf('0x47')](_0x41f5dd)['then'](handleEntityNotFound(_0x3b3c45,null))['then'](respondWithResult(_0x3b3c45,null))[_0x17bf('0x44')](handleError(_0x3b3c45,null));};exports[_0x17bf('0x24')]=function(_0x16d5b5,_0x48a27e){if(_0x16d5b5[_0x17bf('0x48')]['id']){delete _0x16d5b5[_0x17bf('0x48')]['id'];}return db[_0x17bf('0x2c')][_0x17bf('0x47')]({'where':{'id':_0x16d5b5['params']['id']}})['then'](handleEntityNotFound(_0x48a27e,null))[_0x17bf('0x25')](saveUpdates(_0x16d5b5[_0x17bf('0x48')],null))[_0x17bf('0x25')](respondWithResult(_0x48a27e,null))[_0x17bf('0x44')](handleError(_0x48a27e,null));};exports['destroy']=function(_0x1da8ad,_0x43f8c3){return db[_0x17bf('0x2c')]['find']({'where':{'id':_0x1da8ad[_0x17bf('0x49')]['id']}})['then'](handleEntityNotFound(_0x43f8c3,null))[_0x17bf('0x25')](removeEntity(_0x43f8c3,null))['catch'](handleError(_0x43f8c3,null));};exports[_0x17bf('0x4a')]=function(_0x543cb6,_0x28cbd4){var _0x1819b9={'key':_0x543cb6[_0x17bf('0x48')]['key']};if(_0x543cb6['body'][_0x17bf('0x4b')]){_0x1819b9[_0x17bf('0x4b')]=_0x543cb6['body']['MailAccountId'];}else if(_0x543cb6[_0x17bf('0x48')]['SmsAccountId']){_0x1819b9[_0x17bf('0x4c')]=_0x543cb6['body'][_0x17bf('0x4c')];}else if(_0x543cb6[_0x17bf('0x48')]['OpenchannelAccountId']){_0x1819b9[_0x17bf('0x4d')]=_0x543cb6[_0x17bf('0x48')][_0x17bf('0x4d')];}else if(_0x543cb6[_0x17bf('0x48')][_0x17bf('0x4e')]){_0x1819b9[_0x17bf('0x4e')]=_0x543cb6[_0x17bf('0x48')]['ChatWebsiteId'];}return db[_0x17bf('0x2c')][_0x17bf('0x47')]({'where':_0x1819b9})['then'](function(_0xa0607){if(_0xa0607){throw new db[(_0x17bf('0x4f'))][(_0x17bf('0x50'))](_0x17bf('0x51'));}return db[_0x17bf('0x2c')][_0x17bf('0x4a')](_0x543cb6[_0x17bf('0x48')]);})['then'](function(_0x133a53){var _0x16e50b=_0x543cb6[_0x17bf('0x52')][_0x17bf('0x27')]({'plain':!![]});if(!_0x16e50b)throw new Error(_0x17bf('0x53'));if(_0x16e50b[_0x17bf('0x54')]==='user'){var _0x2d2f34=_0x133a53[_0x17bf('0x27')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x17bf('0x55'),'userProfileId':_0x16e50b['userProfileId']},'raw':!![]})['then'](function(_0xe08e2){if(_0xe08e2&&_0xe08e2[_0x17bf('0x56')]===0x0){return db['UserProfileResource'][_0x17bf('0x4a')]({'name':_0x2d2f34[_0x17bf('0x2a')],'resourceId':_0x2d2f34['id'],'type':_0xe08e2['name'],'sectionId':_0xe08e2['id']},{})[_0x17bf('0x25')](function(){return _0x133a53;});}else{return _0x133a53;}})[_0x17bf('0x44')](function(_0x16a77e){logger[_0x17bf('0x57')](_0x17bf('0x58'),_0x16a77e);throw _0x16a77e;});}return _0x133a53;})[_0x17bf('0x25')](respondWithResult(_0x28cbd4,0xc9))[_0x17bf('0x44')](handleError(_0x28cbd4,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index e2dbc17..df01288 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 _0x1fc6=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4_unicode_ci','lodash'];(function(_0x9ba57c,_0x5ecc0d){var _0x627a6e=function(_0x3c702d){while(--_0x3c702d){_0x9ba57c['push'](_0x9ba57c['shift']());}};_0x627a6e(++_0x5ecc0d);}(_0x1fc6,0x11f));var _0x61fc=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x1fc6[_0x378b4];return _0x11d07b;};'use strict';var _=require(_0x61fc('0x0'));var util=require(_0x61fc('0x1'));var logger=require(_0x61fc('0x2'))(_0x61fc('0x3'));var moment=require(_0x61fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x61fc('0x5'));var fs=require('fs');var path=require(_0x61fc('0x6'));var rimraf=require('rimraf');var config=require(_0x61fc('0x7'));var attributes=require(_0x61fc('0x8'));module[_0x61fc('0x9')]=function(_0x1873e3,_0x145d3c){return _0x1873e3['define'](_0x61fc('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x61fc('0xb')});}; \ No newline at end of file +var _0xed60=['moment','request-promise','path','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed60,0x81));var _0x0ed6=function(_0xe7eb36,_0x2dcdf8){_0xe7eb36=_0xe7eb36-0x0;var _0x333fd5=_0xed60[_0xe7eb36];return _0x333fd5;};'use strict';var _=require(_0x0ed6('0x0'));var util=require(_0x0ed6('0x1'));var logger=require('../../config/logger')(_0x0ed6('0x2'));var moment=require(_0x0ed6('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ed6('0x4'));var fs=require('fs');var path=require(_0x0ed6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ed6('0x6'));module[_0x0ed6('0x7')]=function(_0x453996,_0x12d9da){return _0x453996['define'](_0x0ed6('0x8'),attributes,{'tableName':_0x0ed6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0ed6('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2c9bbec..b3b4277 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(_0x5e8c03,_0x7cabd9){var _0x473152=function(_0x3c4238){while(--_0x3c4238){_0x5e8c03['push'](_0x5e8c03['shift']());}};_0x473152(++_0x7cabd9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x3de7a8,_0x24dca1){var _0x162c93=function(_0x42e3cd){while(--_0x42e3cd){_0x3de7a8['push'](_0x3de7a8['shift']());}};_0x162c93(++_0x24dca1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 dff0fe4..7c32132 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 _0x5404=['show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x22fd55,_0x5735c5){var _0xa2259e=function(_0x5664d4){while(--_0x5664d4){_0x22fd55['push'](_0x22fd55['shift']());}};_0xa2259e(++_0x5735c5);}(_0x5404,0x13a));var _0x4540=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5404[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x4540('0x0'));var util=require(_0x4540('0x1'));var path=require(_0x4540('0x2'));var timeout=require(_0x4540('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4540('0x4'));var config=require('../../config/environment');var controller=require(_0x4540('0x5'));router[_0x4540('0x6')]('/',auth[_0x4540('0x7')](),controller[_0x4540('0x8')]);router[_0x4540('0x6')]('/:id',auth[_0x4540('0x7')](),controller[_0x4540('0x9')]);router[_0x4540('0xa')]('/',auth[_0x4540('0x7')](),controller[_0x4540('0xb')]);router[_0x4540('0xc')](_0x4540('0xd'),auth[_0x4540('0x7')](),controller[_0x4540('0xe')]);router['delete'](_0x4540('0xd'),auth['isAuthenticated'](),controller[_0x4540('0xf')]);module[_0x4540('0x10')]=router; \ No newline at end of file +var _0xf066=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','post','create','put','exports','multer','util'];(function(_0x2dd849,_0x3bd1bf){var _0x38ba4e=function(_0xd89ddc){while(--_0xd89ddc){_0x2dd849['push'](_0x2dd849['shift']());}};_0x38ba4e(++_0x3bd1bf);}(_0xf066,0x175));var _0x6f06=function(_0x1e11c2,_0x1bcbca){_0x1e11c2=_0x1e11c2-0x0;var _0x4faa44=_0xf066[_0x1e11c2];return _0x4faa44;};'use strict';var multer=require(_0x6f06('0x0'));var util=require(_0x6f06('0x1'));var path=require('path');var timeout=require(_0x6f06('0x2'));var express=require(_0x6f06('0x3'));var router=express[_0x6f06('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6f06('0x5'));var interaction=require(_0x6f06('0x6'));var config=require(_0x6f06('0x7'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6f06('0x8')]);router['get'](_0x6f06('0x9'),auth[_0x6f06('0xa')](),controller['show']);router[_0x6f06('0xb')]('/',auth[_0x6f06('0xa')](),controller[_0x6f06('0xc')]);router[_0x6f06('0xd')](_0x6f06('0x9'),auth[_0x6f06('0xa')](),controller['update']);router['delete'](_0x6f06('0x9'),auth[_0x6f06('0xa')](),controller['destroy']);module[_0x6f06('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 55dd24d..30482d9 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 _0x91ff=['STRING','INTEGER','DATE'];(function(_0x4a563b,_0x36f42d){var _0x2935ef=function(_0x32593f){while(--_0x32593f){_0x4a563b['push'](_0x4a563b['shift']());}};_0x2935ef(++_0x36f42d);}(_0x91ff,0x15b));var _0xf91f=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x91ff[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xf91f('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xf91f('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xf91f('0x1')]},'dcontext':{'type':Sequelize[_0xf91f('0x1')]},'channel':{'type':Sequelize[_0xf91f('0x1')]},'dstchannel':{'type':Sequelize[_0xf91f('0x1')]},'lastapp':{'type':Sequelize[_0xf91f('0x1')]},'lastdata':{'type':Sequelize[_0xf91f('0x1')]},'duration':{'type':Sequelize[_0xf91f('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf91f('0x1')]},'amaflags':{'type':Sequelize[_0xf91f('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf91f('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf91f('0x1')]},'sequence':{'type':Sequelize[_0xf91f('0x1')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf91f('0x1')]},'tag':{'type':Sequelize[_0xf91f('0x1')]}}; \ No newline at end of file +var _0xc1c3=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xc1c3,0x1b5));var _0x3c1c=function(_0x31d293,_0x254381){_0x31d293=_0x31d293-0x0;var _0x564dc7=_0xc1c3[_0x31d293];return _0x564dc7;};'use strict';var Sequelize=require(_0x3c1c('0x0'));module[_0x3c1c('0x1')]={'calldate':{'type':Sequelize[_0x3c1c('0x2')],'allowNull':![],'defaultValue':_0x3c1c('0x3')},'clid':{'type':Sequelize[_0x3c1c('0x4')]},'src':{'type':Sequelize[_0x3c1c('0x4')]},'dst':{'type':Sequelize[_0x3c1c('0x4')]},'dcontext':{'type':Sequelize[_0x3c1c('0x4')]},'channel':{'type':Sequelize[_0x3c1c('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x3c1c('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x3c1c('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x3c1c('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x3c1c('0x4')]},'uniqueid':{'type':Sequelize[_0x3c1c('0x4')]},'linkedid':{'type':Sequelize[_0x3c1c('0x4')]},'sequence':{'type':Sequelize[_0x3c1c('0x4')]},'peeraccount':{'type':Sequelize[_0x3c1c('0x4')]},'type':{'type':Sequelize[_0x3c1c('0x4')]},'tag':{'type':Sequelize[_0x3c1c('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1b33672..3fd8df8 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 _0xa0a1=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','apply','reject','then','destroy','end','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','options','create','body','update','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x544832,_0x2b8cfb){var _0x19c757=function(_0x5f213e){while(--_0x5f213e){_0x544832['push'](_0x544832['shift']());}};_0x19c757(++_0x2b8cfb);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x34cef7,_0x52293f){_0x34cef7=_0x34cef7-0x0;var _0x8f7873=_0xa0a1[_0x34cef7];return _0x8f7873;};'use strict';var emlformat=require(_0x1a0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a0a('0x1'));var jsonpatch=require(_0x1a0a('0x2'));var rp=require(_0x1a0a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a0a('0x4'));var util=require(_0x1a0a('0x5'));var path=require('path');var sox=require(_0x1a0a('0x6'));var csv=require(_0x1a0a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a0a('0x8'));var _=require(_0x1a0a('0x9'));var squel=require(_0x1a0a('0xa'));var crypto=require(_0x1a0a('0xb'));var jsforce=require(_0x1a0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1a0a('0x7'));var querystring=require(_0x1a0a('0xd'));var Papa=require(_0x1a0a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a0a('0xf'));var hardwareService=require(_0x1a0a('0x10'));var logger=require(_0x1a0a('0x11'))('api');var utils=require(_0x1a0a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1a0a('0x13'));var db=require(_0x1a0a('0x14'))['db'];function respondWithStatusCode(_0x461b36,_0x1877bf){_0x1877bf=_0x1877bf||0xcc;return function(_0x289046){if(_0x289046){return _0x461b36[_0x1a0a('0x15')](_0x1877bf);}return _0x461b36[_0x1a0a('0x16')](_0x1877bf)['end']();};}function respondWithResult(_0x88d191,_0x3b0b2d){_0x3b0b2d=_0x3b0b2d||0xc8;return function(_0x3c531c){if(_0x3c531c){return _0x88d191[_0x1a0a('0x16')](_0x3b0b2d)[_0x1a0a('0x17')](_0x3c531c);}};}function respondWithFilteredResult(_0x4c8080,_0x16b8c9){return function(_0x80627b){if(_0x80627b){var _0x157b74=typeof _0x16b8c9['offset']===_0x1a0a('0x18')&&typeof _0x16b8c9['limit']===_0x1a0a('0x18');var _0x57f65d=_0x80627b['count'];var _0x3a988c=_0x157b74?0x0:_0x16b8c9[_0x1a0a('0x19')];var _0x307fdc=_0x157b74?_0x80627b[_0x1a0a('0x1a')]:_0x16b8c9['offset']+_0x16b8c9['limit'];var _0x239065;if(_0x307fdc>=_0x57f65d){_0x307fdc=_0x57f65d;_0x239065=0xc8;}else{_0x239065=0xce;}_0x4c8080[_0x1a0a('0x16')](_0x239065);return _0x4c8080[_0x1a0a('0x1b')]('Content-Range',_0x3a988c+'-'+_0x307fdc+'/'+_0x57f65d)[_0x1a0a('0x17')](_0x80627b);}return null;};}function patchUpdates(_0x3547fe){return function(_0x5bb4bd){try{jsonpatch[_0x1a0a('0x1c')](_0x5bb4bd,_0x3547fe,!![]);}catch(_0x1ba27f){return BPromise[_0x1a0a('0x1d')](_0x1ba27f);}return _0x5bb4bd['save']();};}function saveUpdates(_0x159a2a,_0xc33284){return function(_0x1f4083){if(_0x1f4083){return _0x1f4083['update'](_0x159a2a)[_0x1a0a('0x1e')](function(_0x47ef88){return _0x47ef88;});}return null;};}function removeEntity(_0x28c094,_0x2d426d){return function(_0x2d7967){if(_0x2d7967){return _0x2d7967[_0x1a0a('0x1f')]()[_0x1a0a('0x1e')](function(){_0x28c094['status'](0xcc)[_0x1a0a('0x20')]();});}};}function handleEntityNotFound(_0x8e4151,_0x561407){return function(_0x4cf939){if(!_0x4cf939){_0x8e4151[_0x1a0a('0x15')](0x194);}return _0x4cf939;};}function handleError(_0x184de8,_0x3f61e4){_0x3f61e4=_0x3f61e4||0x1f4;return function(_0x365ab5){logger[_0x1a0a('0x21')](_0x365ab5[_0x1a0a('0x22')]);if(_0x365ab5[_0x1a0a('0x23')]){delete _0x365ab5[_0x1a0a('0x23')];}_0x184de8[_0x1a0a('0x16')](_0x3f61e4)[_0x1a0a('0x24')](_0x365ab5);};}exports[_0x1a0a('0x25')]=function(_0x35fd0a,_0x354d89){var _0x385f2b={},_0x396c01={},_0x3069ab={'count':0x0,'rows':[]};var _0x297b12=_['map'](db[_0x1a0a('0x26')][_0x1a0a('0x27')],function(_0x36ca44){return{'name':_0x36ca44[_0x1a0a('0x28')],'type':_0x36ca44[_0x1a0a('0x29')][_0x1a0a('0x2a')]};});_0x396c01[_0x1a0a('0x2b')]=_[_0x1a0a('0x2c')](_0x297b12,_0x1a0a('0x23'));_0x396c01[_0x1a0a('0x2d')]=_['keys'](_0x35fd0a[_0x1a0a('0x2d')]);_0x396c01[_0x1a0a('0x2e')]=_['intersection'](_0x396c01[_0x1a0a('0x2b')],_0x396c01['query']);_0x385f2b['attributes']=_[_0x1a0a('0x2f')](_0x396c01[_0x1a0a('0x2b')],qs['fields'](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x30')]));_0x385f2b[_0x1a0a('0x31')]=_0x385f2b['attributes'][_0x1a0a('0x32')]?_0x385f2b[_0x1a0a('0x31')]:_0x396c01['model'];if(!_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x33')]('nolimit')){_0x385f2b[_0x1a0a('0x34')]=qs[_0x1a0a('0x34')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x34')]);_0x385f2b['offset']=qs[_0x1a0a('0x19')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x19')]);}_0x385f2b[_0x1a0a('0x35')]=qs[_0x1a0a('0x36')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x36')]);_0x385f2b[_0x1a0a('0x37')]=qs[_0x1a0a('0x2e')](_['pick'](_0x35fd0a['query'],_0x396c01['filters']),_0x297b12);if(_0x35fd0a['query'][_0x1a0a('0x38')]){_0x385f2b['where']=_[_0x1a0a('0x39')](_0x385f2b[_0x1a0a('0x37')],{'$or':_['map'](_0x297b12,function(_0x5f586c){if(_0x5f586c[_0x1a0a('0x29')]!==_0x1a0a('0x3a')){var _0x13042e={};_0x13042e[_0x5f586c[_0x1a0a('0x23')]]={'$like':'%'+_0x35fd0a['query'][_0x1a0a('0x38')]+'%'};return _0x13042e;}})});}_0x385f2b=_['merge']({},_0x385f2b,_0x35fd0a['options']);var _0x4852e8={'where':_0x385f2b[_0x1a0a('0x37')]};return db[_0x1a0a('0x26')]['count'](_0x4852e8)[_0x1a0a('0x1e')](function(_0x2dcda5){_0x3069ab['count']=_0x2dcda5;if(_0x35fd0a['query'][_0x1a0a('0x3b')]){_0x385f2b[_0x1a0a('0x3c')]=[{'all':!![]}];}return db['Cdr'][_0x1a0a('0x3d')](_0x385f2b);})[_0x1a0a('0x1e')](function(_0x56cfd6){_0x3069ab[_0x1a0a('0x3e')]=_0x56cfd6;return _0x3069ab;})['then'](respondWithFilteredResult(_0x354d89,_0x385f2b))[_0x1a0a('0x3f')](handleError(_0x354d89,null));};exports['show']=function(_0x2dfcfb,_0x7b6e14){var _0x3466f6={'raw':!![],'where':{'id':_0x2dfcfb['params']['id']}},_0x2a72b7={};_0x2a72b7[_0x1a0a('0x2b')]=_[_0x1a0a('0x40')](db[_0x1a0a('0x26')][_0x1a0a('0x27')]);_0x2a72b7['query']=_[_0x1a0a('0x40')](_0x2dfcfb[_0x1a0a('0x2d')]);_0x2a72b7['filters']=_[_0x1a0a('0x2f')](_0x2a72b7[_0x1a0a('0x2b')],_0x2a72b7[_0x1a0a('0x2d')]);_0x3466f6[_0x1a0a('0x31')]=_[_0x1a0a('0x2f')](_0x2a72b7[_0x1a0a('0x2b')],qs[_0x1a0a('0x30')](_0x2dfcfb[_0x1a0a('0x2d')][_0x1a0a('0x30')]));_0x3466f6[_0x1a0a('0x31')]=_0x3466f6['attributes'][_0x1a0a('0x32')]?_0x3466f6[_0x1a0a('0x31')]:_0x2a72b7['model'];if(_0x2dfcfb['query']['includeAll']){_0x3466f6['include']=[{'all':!![]}];}_0x3466f6=_[_0x1a0a('0x39')]({},_0x3466f6,_0x2dfcfb[_0x1a0a('0x41')]);return db['Cdr']['find'](_0x3466f6)['then'](handleEntityNotFound(_0x7b6e14,null))[_0x1a0a('0x1e')](respondWithResult(_0x7b6e14,null))[_0x1a0a('0x3f')](handleError(_0x7b6e14,null));};exports[_0x1a0a('0x42')]=function(_0x2c58a9,_0x4678da){return db[_0x1a0a('0x26')][_0x1a0a('0x42')](_0x2c58a9[_0x1a0a('0x43')],{})[_0x1a0a('0x1e')](respondWithResult(_0x4678da,0xc9))[_0x1a0a('0x3f')](handleError(_0x4678da,null));};exports[_0x1a0a('0x44')]=function(_0x2bab64,_0x23a985){if(_0x2bab64['body']['id']){delete _0x2bab64[_0x1a0a('0x43')]['id'];}return db[_0x1a0a('0x26')][_0x1a0a('0x45')]({'where':{'id':_0x2bab64['params']['id']}})[_0x1a0a('0x1e')](handleEntityNotFound(_0x23a985,null))[_0x1a0a('0x1e')](saveUpdates(_0x2bab64['body'],null))[_0x1a0a('0x1e')](respondWithResult(_0x23a985,null))[_0x1a0a('0x3f')](handleError(_0x23a985,null));};exports['destroy']=function(_0x555b6d,_0x313e79){return db['Cdr']['find']({'where':{'id':_0x555b6d[_0x1a0a('0x46')]['id']}})['then'](handleEntityNotFound(_0x313e79,null))[_0x1a0a('0x1e')](removeEntity(_0x313e79,null))[_0x1a0a('0x3f')](handleError(_0x313e79,null));};exports[_0x1a0a('0x47')]=function(_0x3678c7,_0x22a0f9){return db[_0x1a0a('0x26')][_0x1a0a('0x47')]()[_0x1a0a('0x1e')](respondWithResult(_0x22a0f9,null))[_0x1a0a('0x3f')](handleError(_0x22a0f9,null));}; \ No newline at end of file +var _0x4ab0=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','Cdr','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs'];(function(_0xdd0836,_0x3fd1c1){var _0x3681a3=function(_0x340915){while(--_0x340915){_0xdd0836['push'](_0xdd0836['shift']());}};_0x3681a3(++_0x3fd1c1);}(_0x4ab0,0xd5));var _0x04ab=function(_0x24a724,_0x5ad0b9){_0x24a724=_0x24a724-0x0;var _0x3c2fec=_0x4ab0[_0x24a724];return _0x3c2fec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04ab('0x0'));var zipdir=require(_0x04ab('0x1'));var jsonpatch=require(_0x04ab('0x2'));var rp=require(_0x04ab('0x3'));var moment=require(_0x04ab('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04ab('0x5'));var path=require(_0x04ab('0x6'));var sox=require('sox');var csv=require(_0x04ab('0x7'));var ejs=require(_0x04ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04ab('0x9'));var squel=require(_0x04ab('0xa'));var crypto=require(_0x04ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04ab('0xc'));var toCsv=require(_0x04ab('0x7'));var querystring=require(_0x04ab('0xd'));var Papa=require(_0x04ab('0xe'));var Redis=require('ioredis');var authService=require(_0x04ab('0xf'));var qs=require(_0x04ab('0x10'));var as=require(_0x04ab('0x11'));var hardwareService=require(_0x04ab('0x12'));var logger=require('../../config/logger')(_0x04ab('0x13'));var utils=require(_0x04ab('0x14'));var config=require(_0x04ab('0x15'));var licenseUtil=require(_0x04ab('0x16'));var db=require(_0x04ab('0x17'))['db'];function respondWithStatusCode(_0x386d0a,_0x4a6b39){_0x4a6b39=_0x4a6b39||0xcc;return function(_0x710503){if(_0x710503){return _0x386d0a['sendStatus'](_0x4a6b39);}return _0x386d0a[_0x04ab('0x18')](_0x4a6b39)[_0x04ab('0x19')]();};}function respondWithResult(_0x2abdf8,_0x428798){_0x428798=_0x428798||0xc8;return function(_0x4f0da1){if(_0x4f0da1){return _0x2abdf8['status'](_0x428798)['json'](_0x4f0da1);}};}function respondWithFilteredResult(_0x103ca8,_0x3cee44){return function(_0x149fd2){if(_0x149fd2){var _0x2b10b0=typeof _0x3cee44[_0x04ab('0x1a')]===_0x04ab('0x1b')&&typeof _0x3cee44[_0x04ab('0x1c')]===_0x04ab('0x1b');var _0x1f3251=_0x149fd2[_0x04ab('0x1d')];var _0x5ce43c=_0x2b10b0?0x0:_0x3cee44[_0x04ab('0x1a')];var _0x83ab27=_0x2b10b0?_0x149fd2[_0x04ab('0x1d')]:_0x3cee44[_0x04ab('0x1a')]+_0x3cee44[_0x04ab('0x1c')];var _0x10669a;if(_0x83ab27>=_0x1f3251){_0x83ab27=_0x1f3251;_0x10669a=0xc8;}else{_0x10669a=0xce;}_0x103ca8[_0x04ab('0x18')](_0x10669a);return _0x103ca8[_0x04ab('0x1e')](_0x04ab('0x1f'),_0x5ce43c+'-'+_0x83ab27+'/'+_0x1f3251)['json'](_0x149fd2);}return null;};}function patchUpdates(_0x75a04e){return function(_0x4a6679){try{jsonpatch[_0x04ab('0x20')](_0x4a6679,_0x75a04e,!![]);}catch(_0x1d04c2){return BPromise[_0x04ab('0x21')](_0x1d04c2);}return _0x4a6679['save']();};}function saveUpdates(_0x15a36b,_0x1c08f4){return function(_0xf6275e){if(_0xf6275e){return _0xf6275e['update'](_0x15a36b)['then'](function(_0xc8358e){return _0xc8358e;});}return null;};}function removeEntity(_0x2f614a,_0x5885bd){return function(_0x551583){if(_0x551583){return _0x551583[_0x04ab('0x22')]()[_0x04ab('0x23')](function(){_0x2f614a[_0x04ab('0x18')](0xcc)[_0x04ab('0x19')]();});}};}function handleEntityNotFound(_0x26bb81,_0xa3838a){return function(_0x21d9b7){if(!_0x21d9b7){_0x26bb81[_0x04ab('0x24')](0x194);}return _0x21d9b7;};}function handleError(_0x222557,_0x5cf1e5){_0x5cf1e5=_0x5cf1e5||0x1f4;return function(_0x86bf80){logger[_0x04ab('0x25')](_0x86bf80[_0x04ab('0x26')]);if(_0x86bf80[_0x04ab('0x27')]){delete _0x86bf80['name'];}_0x222557['status'](_0x5cf1e5)[_0x04ab('0x28')](_0x86bf80);};}exports['index']=function(_0x404eae,_0x30db64){var _0x2e069d={},_0x3c25fb={},_0x12385b={'count':0x0,'rows':[]};var _0x5596fc=_['map'](db[_0x04ab('0x29')][_0x04ab('0x2a')],function(_0x28e77b){return{'name':_0x28e77b[_0x04ab('0x2b')],'type':_0x28e77b[_0x04ab('0x2c')][_0x04ab('0x2d')]};});_0x3c25fb[_0x04ab('0x2e')]=_[_0x04ab('0x2f')](_0x5596fc,_0x04ab('0x27'));_0x3c25fb[_0x04ab('0x30')]=_[_0x04ab('0x31')](_0x404eae[_0x04ab('0x30')]);_0x3c25fb[_0x04ab('0x32')]=_['intersection'](_0x3c25fb[_0x04ab('0x2e')],_0x3c25fb[_0x04ab('0x30')]);_0x2e069d['attributes']=_[_0x04ab('0x33')](_0x3c25fb[_0x04ab('0x2e')],qs['fields'](_0x404eae[_0x04ab('0x30')][_0x04ab('0x34')]));_0x2e069d['attributes']=_0x2e069d[_0x04ab('0x35')][_0x04ab('0x36')]?_0x2e069d[_0x04ab('0x35')]:_0x3c25fb[_0x04ab('0x2e')];if(!_0x404eae[_0x04ab('0x30')][_0x04ab('0x37')]('nolimit')){_0x2e069d[_0x04ab('0x1c')]=qs[_0x04ab('0x1c')](_0x404eae[_0x04ab('0x30')]['limit']);_0x2e069d[_0x04ab('0x1a')]=qs['offset'](_0x404eae['query'][_0x04ab('0x1a')]);}_0x2e069d[_0x04ab('0x38')]=qs['sort'](_0x404eae[_0x04ab('0x30')]['sort']);_0x2e069d[_0x04ab('0x39')]=qs[_0x04ab('0x32')](_[_0x04ab('0x3a')](_0x404eae[_0x04ab('0x30')],_0x3c25fb[_0x04ab('0x32')]),_0x5596fc);if(_0x404eae[_0x04ab('0x30')][_0x04ab('0x3b')]){_0x2e069d[_0x04ab('0x39')]=_[_0x04ab('0x3c')](_0x2e069d[_0x04ab('0x39')],{'$or':_[_0x04ab('0x2f')](_0x5596fc,function(_0x3f145){if(_0x3f145['type']!==_0x04ab('0x3d')){var _0x14756a={};_0x14756a[_0x3f145['name']]={'$like':'%'+_0x404eae['query'][_0x04ab('0x3b')]+'%'};return _0x14756a;}})});}_0x2e069d=_[_0x04ab('0x3c')]({},_0x2e069d,_0x404eae[_0x04ab('0x3e')]);var _0x4327b9={'where':_0x2e069d['where']};return db[_0x04ab('0x29')][_0x04ab('0x1d')](_0x4327b9)[_0x04ab('0x23')](function(_0x244acf){_0x12385b['count']=_0x244acf;if(_0x404eae[_0x04ab('0x30')][_0x04ab('0x3f')]){_0x2e069d[_0x04ab('0x40')]=[{'all':!![]}];}return db[_0x04ab('0x29')][_0x04ab('0x41')](_0x2e069d);})[_0x04ab('0x23')](function(_0x20b8cc){_0x12385b[_0x04ab('0x42')]=_0x20b8cc;return _0x12385b;})['then'](respondWithFilteredResult(_0x30db64,_0x2e069d))['catch'](handleError(_0x30db64,null));};exports[_0x04ab('0x43')]=function(_0x4c8cb0,_0x8a93c2){var _0x46a7c5={'raw':!![],'where':{'id':_0x4c8cb0['params']['id']}},_0x3c27ee={};_0x3c27ee[_0x04ab('0x2e')]=_[_0x04ab('0x31')](db[_0x04ab('0x29')]['rawAttributes']);_0x3c27ee[_0x04ab('0x30')]=_[_0x04ab('0x31')](_0x4c8cb0[_0x04ab('0x30')]);_0x3c27ee[_0x04ab('0x32')]=_[_0x04ab('0x33')](_0x3c27ee[_0x04ab('0x2e')],_0x3c27ee[_0x04ab('0x30')]);_0x46a7c5[_0x04ab('0x35')]=_[_0x04ab('0x33')](_0x3c27ee[_0x04ab('0x2e')],qs['fields'](_0x4c8cb0[_0x04ab('0x30')][_0x04ab('0x34')]));_0x46a7c5[_0x04ab('0x35')]=_0x46a7c5[_0x04ab('0x35')][_0x04ab('0x36')]?_0x46a7c5[_0x04ab('0x35')]:_0x3c27ee['model'];if(_0x4c8cb0[_0x04ab('0x30')][_0x04ab('0x3f')]){_0x46a7c5[_0x04ab('0x40')]=[{'all':!![]}];}_0x46a7c5=_[_0x04ab('0x3c')]({},_0x46a7c5,_0x4c8cb0['options']);return db[_0x04ab('0x29')][_0x04ab('0x44')](_0x46a7c5)[_0x04ab('0x23')](handleEntityNotFound(_0x8a93c2,null))[_0x04ab('0x23')](respondWithResult(_0x8a93c2,null))[_0x04ab('0x45')](handleError(_0x8a93c2,null));};exports['create']=function(_0x326621,_0x15b995){return db['Cdr']['create'](_0x326621[_0x04ab('0x46')],{})[_0x04ab('0x23')](respondWithResult(_0x15b995,0xc9))[_0x04ab('0x45')](handleError(_0x15b995,null));};exports[_0x04ab('0x47')]=function(_0x1c4aa2,_0x3a9056){if(_0x1c4aa2[_0x04ab('0x46')]['id']){delete _0x1c4aa2['body']['id'];}return db[_0x04ab('0x29')][_0x04ab('0x44')]({'where':{'id':_0x1c4aa2[_0x04ab('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a9056,null))[_0x04ab('0x23')](saveUpdates(_0x1c4aa2[_0x04ab('0x46')],null))['then'](respondWithResult(_0x3a9056,null))[_0x04ab('0x45')](handleError(_0x3a9056,null));};exports['destroy']=function(_0xc9db25,_0x4bc4f6){return db[_0x04ab('0x29')]['find']({'where':{'id':_0xc9db25['params']['id']}})[_0x04ab('0x23')](handleEntityNotFound(_0x4bc4f6,null))[_0x04ab('0x23')](removeEntity(_0x4bc4f6,null))[_0x04ab('0x45')](handleError(_0x4bc4f6,null));};exports['describe']=function(_0x53f63a,_0x5ed30e){return db[_0x04ab('0x29')][_0x04ab('0x49')]()['then'](respondWithResult(_0x5ed30e,null))[_0x04ab('0x45')](handleError(_0x5ed30e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 60064f6..673a471 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3c262a,_0x6cfa16){var _0x259ea1=function(_0x2fc847){while(--_0x2fc847){_0x3c262a['push'](_0x3c262a['shift']());}};_0x259ea1(++_0x6cfa16);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x29de33,_0x1f9130){var _0x49f023=function(_0x4921dc){while(--_0x4921dc){_0x29de33['push'](_0x29de33['shift']());}};_0x49f023(++_0x1f9130);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 ffc4940..bd113da 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 _0xfb36=['then','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Cdr,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x40ce3e,_0x385f40){var _0x4a7296=function(_0x5f236b){while(--_0x5f236b){_0x40ce3e['push'](_0x40ce3e['shift']());}};_0x4a7296(++_0x385f40);}(_0xfb36,0x93));var _0x6fb3=function(_0x55ab31,_0x2881e9){_0x55ab31=_0x55ab31-0x0;var _0x2eefc3=_0xfb36[_0x55ab31];return _0x2eefc3;};'use strict';var _=require(_0x6fb3('0x0'));var util=require(_0x6fb3('0x1'));var moment=require(_0x6fb3('0x2'));var BPromise=require(_0x6fb3('0x3'));var rs=require(_0x6fb3('0x4'));var fs=require('fs');var Redis=require(_0x6fb3('0x5'));var db=require(_0x6fb3('0x6'))['db'];var utils=require(_0x6fb3('0x7'));var logger=require(_0x6fb3('0x8'))(_0x6fb3('0x9'));var config=require('../../config/environment');var jayson=require(_0x6fb3('0xa'));var client=jayson[_0x6fb3('0xb')][_0x6fb3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c054d,_0x208e28,_0x338b7d){return new BPromise(function(_0x11ab55,_0x281ba4){return client[_0x6fb3('0xd')](_0x3c054d,_0x338b7d)[_0x6fb3('0xe')](function(_0x5c6fc7){logger['info']('Cdr,\x20%s,\x20%s',_0x208e28,'request\x20sent');logger[_0x6fb3('0xf')](_0x6fb3('0x10'),_0x208e28,_0x6fb3('0x11'),JSON['stringify'](_0x5c6fc7));if(_0x5c6fc7[_0x6fb3('0x12')]){if(_0x5c6fc7['error'][_0x6fb3('0x13')]===0x1f4){logger[_0x6fb3('0x12')](_0x6fb3('0x14'),_0x208e28,_0x5c6fc7[_0x6fb3('0x12')][_0x6fb3('0x15')]);return _0x281ba4(_0x5c6fc7[_0x6fb3('0x12')][_0x6fb3('0x15')]);}logger[_0x6fb3('0x12')]('Cdr,\x20%s,\x20%s',_0x208e28,_0x5c6fc7['error'][_0x6fb3('0x15')]);return _0x11ab55(_0x5c6fc7['error'][_0x6fb3('0x15')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x208e28,_0x6fb3('0x11'));_0x11ab55(_0x5c6fc7['result'][_0x6fb3('0x15')]);}})[_0x6fb3('0x16')](function(_0x4418cd){logger['error'](_0x6fb3('0x14'),_0x208e28,_0x4418cd);_0x281ba4(_0x4418cd);});});} \ No newline at end of file +var _0x9474=['http','request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x9474,0x141));var _0x4947=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x9474[_0x47e549];return _0x251374;};'use strict';var _=require(_0x4947('0x0'));var util=require(_0x4947('0x1'));var moment=require(_0x4947('0x2'));var BPromise=require('bluebird');var rs=require(_0x4947('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4947('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4947('0x5'))(_0x4947('0x6'));var config=require('../../config/environment');var jayson=require(_0x4947('0x7'));var client=jayson[_0x4947('0x8')][_0x4947('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ab71,_0x2067ad,_0x340706){return new BPromise(function(_0x1818cb,_0x2b1f9c){return client[_0x4947('0xa')](_0x20ab71,_0x340706)['then'](function(_0x448e7e){logger[_0x4947('0xb')]('Cdr,\x20%s,\x20%s',_0x2067ad,_0x4947('0xc'));logger[_0x4947('0xd')](_0x4947('0xe'),_0x2067ad,_0x4947('0xc'),JSON[_0x4947('0xf')](_0x448e7e));if(_0x448e7e[_0x4947('0x10')]){if(_0x448e7e[_0x4947('0x10')][_0x4947('0x11')]===0x1f4){logger['error'](_0x4947('0x12'),_0x2067ad,_0x448e7e[_0x4947('0x10')][_0x4947('0x13')]);return _0x2b1f9c(_0x448e7e[_0x4947('0x10')][_0x4947('0x13')]);}logger[_0x4947('0x10')](_0x4947('0x12'),_0x2067ad,_0x448e7e['error'][_0x4947('0x13')]);return _0x1818cb(_0x448e7e['error'][_0x4947('0x13')]);}else{logger[_0x4947('0xb')](_0x4947('0x12'),_0x2067ad,'request\x20sent');_0x1818cb(_0x448e7e[_0x4947('0x14')]['message']);}})[_0x4947('0x15')](function(_0x2277a8){logger[_0x4947('0x10')](_0x4947('0x12'),_0x2067ad,_0x2277a8);_0x2b1f9c(_0x2277a8);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c577412..e723fb9 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(_0x568c73,_0xb1cd74){var _0x42f893=function(_0x20c08){while(--_0x20c08){_0x568c73['push'](_0x568c73['shift']());}};_0x42f893(++_0xb1cd74);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xb10b[_0x3ce2c4];return _0x4047c1;};'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(_0x5d3cf7,_0x51d1b2){var _0x32d8d7=function(_0x3218b1){while(--_0x3218b1){_0x5d3cf7['push'](_0x5d3cf7['shift']());}};_0x32d8d7(++_0x51d1b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x482e30,_0x11c205){_0x482e30=_0x482e30-0x0;var _0x59bf70=_0xb10b[_0x482e30];return _0x59bf70;};'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 417753d..2fa93b8 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 _0x7d49=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x9f7498,_0x536073){var _0x51fb51=function(_0x43846b){while(--_0x43846b){_0x9f7498['push'](_0x9f7498['shift']());}};_0x51fb51(++_0x536073);}(_0x7d49,0x1c5));var _0x97d4=function(_0x49ae1b,_0x3ba84f){_0x49ae1b=_0x49ae1b-0x0;var _0x3c1df7=_0x7d49[_0x49ae1b];return _0x3c1df7;};'use strict';var Sequelize=require(_0x97d4('0x0'));module[_0x97d4('0x1')]={'priority':{'type':Sequelize[_0x97d4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x97d4('0x3')],'allowNull':![],'defaultValue':_0x97d4('0x4')},'appdata':{'type':Sequelize[_0x97d4('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x97d4('0x3')],'defaultValue':_0x97d4('0x6')}}; \ No newline at end of file +var _0xa126=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x741427,_0x21fe4c){var _0x5e0a59=function(_0x2c4eb5){while(--_0x2c4eb5){_0x741427['push'](_0x741427['shift']());}};_0x5e0a59(++_0x21fe4c);}(_0xa126,0x7b));var _0x6a12=function(_0x12475c,_0x2be558){_0x12475c=_0x12475c-0x0;var _0x20f6c7=_0xa126[_0x12475c];return _0x20f6c7;};'use strict';var Sequelize=require(_0x6a12('0x0'));module[_0x6a12('0x1')]={'priority':{'type':Sequelize[_0x6a12('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6a12('0x3')],'allowNull':![],'defaultValue':_0x6a12('0x4')},'appdata':{'type':Sequelize[_0x6a12('0x5')]()},'description':{'type':Sequelize[_0x6a12('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6a12('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index bd84b46..52248e5 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 _0x220b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','length','merge','options','find','catch','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x220b,0x1a2));var _0xb220=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x220b[_0x5471ec];return _0x121d4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb220('0x0'));var zipdir=require(_0xb220('0x1'));var jsonpatch=require(_0xb220('0x2'));var rp=require(_0xb220('0x3'));var moment=require('moment');var BPromise=require(_0xb220('0x4'));var Mustache=require('mustache');var util=require(_0xb220('0x5'));var path=require('path');var sox=require(_0xb220('0x6'));var csv=require(_0xb220('0x7'));var ejs=require(_0xb220('0x8'));var fs=require('fs');var fs_extra=require(_0xb220('0x9'));var _=require('lodash');var squel=require(_0xb220('0xa'));var crypto=require(_0xb220('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb220('0xc'));var toCsv=require(_0xb220('0x7'));var querystring=require(_0xb220('0xd'));var Papa=require(_0xb220('0xe'));var Redis=require(_0xb220('0xf'));var authService=require(_0xb220('0x10'));var qs=require(_0xb220('0x11'));var as=require(_0xb220('0x12'));var hardwareService=require(_0xb220('0x13'));var logger=require('../../config/logger')(_0xb220('0x14'));var utils=require(_0xb220('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x528ce0,_0x59ef3e){_0x59ef3e=_0x59ef3e||0xcc;return function(_0x11229c){if(_0x11229c){return _0x528ce0['sendStatus'](_0x59ef3e);}return _0x528ce0[_0xb220('0x16')](_0x59ef3e)[_0xb220('0x17')]();};}function respondWithResult(_0x378a3b,_0x312c59){_0x312c59=_0x312c59||0xc8;return function(_0x576649){if(_0x576649){return _0x378a3b['status'](_0x312c59)[_0xb220('0x18')](_0x576649);}};}function respondWithFilteredResult(_0x1db409,_0x159eb7){return function(_0x2ee3d2){if(_0x2ee3d2){var _0x16a34b=typeof _0x159eb7[_0xb220('0x19')]===_0xb220('0x1a')&&typeof _0x159eb7[_0xb220('0x1b')]===_0xb220('0x1a');var _0x1416de=_0x2ee3d2[_0xb220('0x1c')];var _0x464ceb=_0x16a34b?0x0:_0x159eb7[_0xb220('0x19')];var _0x21cf2d=_0x16a34b?_0x2ee3d2[_0xb220('0x1c')]:_0x159eb7[_0xb220('0x19')]+_0x159eb7[_0xb220('0x1b')];var _0x1cc822;if(_0x21cf2d>=_0x1416de){_0x21cf2d=_0x1416de;_0x1cc822=0xc8;}else{_0x1cc822=0xce;}_0x1db409[_0xb220('0x16')](_0x1cc822);return _0x1db409[_0xb220('0x1d')](_0xb220('0x1e'),_0x464ceb+'-'+_0x21cf2d+'/'+_0x1416de)[_0xb220('0x18')](_0x2ee3d2);}return null;};}function patchUpdates(_0x213736){return function(_0x358035){try{jsonpatch['apply'](_0x358035,_0x213736,!![]);}catch(_0x45b406){return BPromise['reject'](_0x45b406);}return _0x358035[_0xb220('0x1f')]();};}function saveUpdates(_0x5c4d46,_0x3a1ad7){return function(_0x501f0f){if(_0x501f0f){return _0x501f0f[_0xb220('0x20')](_0x5c4d46)[_0xb220('0x21')](function(_0x2ddf73){return _0x2ddf73;});}return null;};}function removeEntity(_0x2f5a0d,_0x396c72){return function(_0x2975ff){if(_0x2975ff){return _0x2975ff['destroy']()[_0xb220('0x21')](function(){_0x2f5a0d[_0xb220('0x16')](0xcc)[_0xb220('0x17')]();});}};}function handleEntityNotFound(_0x1849c8,_0x180b94){return function(_0x4d83aa){if(!_0x4d83aa){_0x1849c8[_0xb220('0x22')](0x194);}return _0x4d83aa;};}function handleError(_0x30b75b,_0x57768e){_0x57768e=_0x57768e||0x1f4;return function(_0x2b9b1a){logger[_0xb220('0x23')](_0x2b9b1a[_0xb220('0x24')]);if(_0x2b9b1a[_0xb220('0x25')]){delete _0x2b9b1a[_0xb220('0x25')];}_0x30b75b[_0xb220('0x16')](_0x57768e)['send'](_0x2b9b1a);};}exports[_0xb220('0x26')]=function(_0x54c1b9,_0x589e07){var _0x181b14={'raw':!![],'where':{'id':_0x54c1b9[_0xb220('0x27')]['id']}},_0x1a9b82={};_0x1a9b82[_0xb220('0x28')]=_[_0xb220('0x29')](db[_0xb220('0x2a')][_0xb220('0x2b')]);_0x1a9b82[_0xb220('0x2c')]=_[_0xb220('0x29')](_0x54c1b9[_0xb220('0x2c')]);_0x1a9b82['filters']=_[_0xb220('0x2d')](_0x1a9b82[_0xb220('0x28')],_0x1a9b82[_0xb220('0x2c')]);_0x181b14['attributes']=_['intersection'](_0x1a9b82[_0xb220('0x28')],qs['fields'](_0x54c1b9['query']['fields']));_0x181b14[_0xb220('0x2e')]=_0x181b14[_0xb220('0x2e')][_0xb220('0x2f')]?_0x181b14[_0xb220('0x2e')]:_0x1a9b82[_0xb220('0x28')];if(_0x54c1b9[_0xb220('0x2c')]['includeAll']){_0x181b14['include']=[{'all':!![]}];}_0x181b14=_[_0xb220('0x30')]({},_0x181b14,_0x54c1b9[_0xb220('0x31')]);return db['ChatApplication'][_0xb220('0x32')](_0x181b14)['then'](handleEntityNotFound(_0x589e07,null))[_0xb220('0x21')](respondWithResult(_0x589e07,null))[_0xb220('0x33')](handleError(_0x589e07,null));};exports[_0xb220('0x20')]=function(_0x5e4c0a,_0x1ed281){if(_0x5e4c0a['body']['id']){delete _0x5e4c0a['body']['id'];}return db['ChatApplication'][_0xb220('0x32')]({'where':{'id':_0x5e4c0a['params']['id']}})[_0xb220('0x21')](handleEntityNotFound(_0x1ed281,null))[_0xb220('0x21')](saveUpdates(_0x5e4c0a[_0xb220('0x34')],null))['then'](respondWithResult(_0x1ed281,null))['catch'](handleError(_0x1ed281,null));};exports[_0xb220('0x35')]=function(_0x4f385e,_0xb3cff4){return db[_0xb220('0x2a')]['find']({'where':{'id':_0x4f385e[_0xb220('0x27')]['id']}})[_0xb220('0x21')](handleEntityNotFound(_0xb3cff4,null))[_0xb220('0x21')](removeEntity(_0xb3cff4,null))[_0xb220('0x33')](handleError(_0xb3cff4,null));}; \ No newline at end of file +var _0xc902=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','show','params','keys','ChatApplication','query','filters','intersection','attributes','fields','model','includeAll','include','merge','find','catch','body'];(function(_0x511ec9,_0x346a6f){var _0x11b5a5=function(_0x349c58){while(--_0x349c58){_0x511ec9['push'](_0x511ec9['shift']());}};_0x11b5a5(++_0x346a6f);}(_0xc902,0x15c));var _0x2c90=function(_0x461860,_0x4e9c10){_0x461860=_0x461860-0x0;var _0x476abd=_0xc902[_0x461860];return _0x476abd;};'use strict';var emlformat=require(_0x2c90('0x0'));var rimraf=require(_0x2c90('0x1'));var zipdir=require(_0x2c90('0x2'));var jsonpatch=require(_0x2c90('0x3'));var rp=require(_0x2c90('0x4'));var moment=require(_0x2c90('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c90('0x6'));var util=require(_0x2c90('0x7'));var path=require(_0x2c90('0x8'));var sox=require(_0x2c90('0x9'));var csv=require(_0x2c90('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c90('0xb'));var squel=require(_0x2c90('0xc'));var crypto=require(_0x2c90('0xd'));var jsforce=require(_0x2c90('0xe'));var deskjs=require(_0x2c90('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2c90('0x10'));var Redis=require('ioredis');var authService=require(_0x2c90('0x11'));var qs=require(_0x2c90('0x12'));var as=require(_0x2c90('0x13'));var hardwareService=require(_0x2c90('0x14'));var logger=require(_0x2c90('0x15'))(_0x2c90('0x16'));var utils=require(_0x2c90('0x17'));var config=require(_0x2c90('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c90('0x19'))['db'];function respondWithStatusCode(_0x3434b1,_0x548ed4){_0x548ed4=_0x548ed4||0xcc;return function(_0x42809d){if(_0x42809d){return _0x3434b1['sendStatus'](_0x548ed4);}return _0x3434b1[_0x2c90('0x1a')](_0x548ed4)[_0x2c90('0x1b')]();};}function respondWithResult(_0x2a346a,_0x29feec){_0x29feec=_0x29feec||0xc8;return function(_0x306f17){if(_0x306f17){return _0x2a346a[_0x2c90('0x1a')](_0x29feec)['json'](_0x306f17);}};}function respondWithFilteredResult(_0x3dba74,_0x3626fd){return function(_0x2ee7be){if(_0x2ee7be){var _0x22452f=typeof _0x3626fd[_0x2c90('0x1c')]===_0x2c90('0x1d')&&typeof _0x3626fd[_0x2c90('0x1e')]===_0x2c90('0x1d');var _0x445f34=_0x2ee7be['count'];var _0x1507a6=_0x22452f?0x0:_0x3626fd[_0x2c90('0x1c')];var _0x5589f1=_0x22452f?_0x2ee7be['count']:_0x3626fd['offset']+_0x3626fd[_0x2c90('0x1e')];var _0x594ac8;if(_0x5589f1>=_0x445f34){_0x5589f1=_0x445f34;_0x594ac8=0xc8;}else{_0x594ac8=0xce;}_0x3dba74[_0x2c90('0x1a')](_0x594ac8);return _0x3dba74[_0x2c90('0x1f')]('Content-Range',_0x1507a6+'-'+_0x5589f1+'/'+_0x445f34)[_0x2c90('0x20')](_0x2ee7be);}return null;};}function patchUpdates(_0x8804ff){return function(_0x5ce79a){try{jsonpatch[_0x2c90('0x21')](_0x5ce79a,_0x8804ff,!![]);}catch(_0xf2f284){return BPromise[_0x2c90('0x22')](_0xf2f284);}return _0x5ce79a[_0x2c90('0x23')]();};}function saveUpdates(_0x219523,_0x792cc6){return function(_0xda9d85){if(_0xda9d85){return _0xda9d85[_0x2c90('0x24')](_0x219523)[_0x2c90('0x25')](function(_0x9a3486){return _0x9a3486;});}return null;};}function removeEntity(_0x25b954,_0x151a7a){return function(_0x4d4516){if(_0x4d4516){return _0x4d4516[_0x2c90('0x26')]()['then'](function(){_0x25b954['status'](0xcc)[_0x2c90('0x1b')]();});}};}function handleEntityNotFound(_0x74027e,_0x3a6eaa){return function(_0x3064ed){if(!_0x3064ed){_0x74027e['sendStatus'](0x194);}return _0x3064ed;};}function handleError(_0x23c59d,_0x852dc6){_0x852dc6=_0x852dc6||0x1f4;return function(_0x4e3391){logger[_0x2c90('0x27')](_0x4e3391['stack']);if(_0x4e3391[_0x2c90('0x28')]){delete _0x4e3391[_0x2c90('0x28')];}_0x23c59d['status'](_0x852dc6)[_0x2c90('0x29')](_0x4e3391);};}exports[_0x2c90('0x2a')]=function(_0x151462,_0x19cca4){var _0x44d4b5={'raw':!![],'where':{'id':_0x151462[_0x2c90('0x2b')]['id']}},_0x48043f={};_0x48043f['model']=_[_0x2c90('0x2c')](db[_0x2c90('0x2d')]['rawAttributes']);_0x48043f[_0x2c90('0x2e')]=_[_0x2c90('0x2c')](_0x151462['query']);_0x48043f[_0x2c90('0x2f')]=_[_0x2c90('0x30')](_0x48043f['model'],_0x48043f[_0x2c90('0x2e')]);_0x44d4b5[_0x2c90('0x31')]=_[_0x2c90('0x30')](_0x48043f['model'],qs['fields'](_0x151462[_0x2c90('0x2e')][_0x2c90('0x32')]));_0x44d4b5[_0x2c90('0x31')]=_0x44d4b5[_0x2c90('0x31')]['length']?_0x44d4b5['attributes']:_0x48043f[_0x2c90('0x33')];if(_0x151462['query'][_0x2c90('0x34')]){_0x44d4b5[_0x2c90('0x35')]=[{'all':!![]}];}_0x44d4b5=_[_0x2c90('0x36')]({},_0x44d4b5,_0x151462['options']);return db[_0x2c90('0x2d')][_0x2c90('0x37')](_0x44d4b5)['then'](handleEntityNotFound(_0x19cca4,null))[_0x2c90('0x25')](respondWithResult(_0x19cca4,null))[_0x2c90('0x38')](handleError(_0x19cca4,null));};exports[_0x2c90('0x24')]=function(_0x45b6c3,_0x4b90dd){if(_0x45b6c3['body']['id']){delete _0x45b6c3[_0x2c90('0x39')]['id'];}return db[_0x2c90('0x2d')][_0x2c90('0x37')]({'where':{'id':_0x45b6c3[_0x2c90('0x2b')]['id']}})[_0x2c90('0x25')](handleEntityNotFound(_0x4b90dd,null))[_0x2c90('0x25')](saveUpdates(_0x45b6c3[_0x2c90('0x39')],null))[_0x2c90('0x25')](respondWithResult(_0x4b90dd,null))['catch'](handleError(_0x4b90dd,null));};exports[_0x2c90('0x26')]=function(_0x38cca4,_0x51956d){return db[_0x2c90('0x2d')][_0x2c90('0x37')]({'where':{'id':_0x38cca4[_0x2c90('0x2b')]['id']}})['then'](handleEntityNotFound(_0x51956d,null))[_0x2c90('0x25')](removeEntity(_0x51956d,null))[_0x2c90('0x38')](handleError(_0x51956d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 66697fb..e40c19b 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 _0xfc9f=['utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./chatApplication.attributes','ChatApplication','chat_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc9f,0x7a));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xffc9('0x0'));var util=require('util');var logger=require(_0xffc9('0x1'))(_0xffc9('0x2'));var moment=require(_0xffc9('0x3'));var BPromise=require(_0xffc9('0x4'));var rp=require(_0xffc9('0x5'));var fs=require('fs');var path=require(_0xffc9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xffc9('0x7'));module['exports']=function(_0x155cef,_0x122a56){return _0x155cef['define'](_0xffc9('0x8'),attributes,{'tableName':_0xffc9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffc9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5959=['ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x2a8c6b,_0x3cfa71){var _0x2fb943=function(_0x4eab79){while(--_0x4eab79){_0x2a8c6b['push'](_0x2a8c6b['shift']());}};_0x2fb943(++_0x3cfa71);}(_0x5959,0x17c));var _0x9595=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5959[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var logger=require(_0x9595('0x2'))('api');var moment=require(_0x9595('0x3'));var BPromise=require(_0x9595('0x4'));var rp=require(_0x9595('0x5'));var fs=require('fs');var path=require(_0x9595('0x6'));var rimraf=require(_0x9595('0x7'));var config=require(_0x9595('0x8'));var attributes=require(_0x9595('0x9'));module['exports']=function(_0x20e2fb,_0x19b27c){return _0x20e2fb['define'](_0x9595('0xa'),attributes,{'tableName':_0x9595('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9595('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 72bb6c7..eafbbd0 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 _0x8456=['code','message','lodash','util','bluebird','randomstring','../../config/utils','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x19db9b,_0x4e3b99){var _0x257ad3=function(_0x427fd3){while(--_0x427fd3){_0x19db9b['push'](_0x19db9b['shift']());}};_0x257ad3(++_0x4e3b99);}(_0x8456,0xf0));var _0x6845=function(_0x12e6b2,_0x183b5e){_0x12e6b2=_0x12e6b2-0x0;var _0x5618b2=_0x8456[_0x12e6b2];return _0x5618b2;};'use strict';var _=require(_0x6845('0x0'));var util=require(_0x6845('0x1'));var moment=require('moment');var BPromise=require(_0x6845('0x2'));var rs=require(_0x6845('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6845('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6845('0x5'));var client=jayson[_0x6845('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x108235,_0x8824d3,_0x342b40){return new BPromise(function(_0x20e5df,_0x69a43d){return client[_0x6845('0x7')](_0x108235,_0x342b40)[_0x6845('0x8')](function(_0x34699b){logger[_0x6845('0x9')](_0x6845('0xa'),_0x8824d3,_0x6845('0xb'));logger['debug'](_0x6845('0xc'),_0x8824d3,_0x6845('0xb'),JSON[_0x6845('0xd')](_0x34699b));if(_0x34699b[_0x6845('0xe')]){if(_0x34699b[_0x6845('0xe')][_0x6845('0xf')]===0x1f4){logger['error'](_0x6845('0xa'),_0x8824d3,_0x34699b['error'][_0x6845('0x10')]);return _0x69a43d(_0x34699b[_0x6845('0xe')]['message']);}logger[_0x6845('0xe')](_0x6845('0xa'),_0x8824d3,_0x34699b[_0x6845('0xe')]['message']);return _0x20e5df(_0x34699b['error'][_0x6845('0x10')]);}else{logger[_0x6845('0x9')](_0x6845('0xa'),_0x8824d3,_0x6845('0xb'));_0x20e5df(_0x34699b['result'][_0x6845('0x10')]);}})['catch'](function(_0x24fd15){logger['error'](_0x6845('0xa'),_0x8824d3,_0x24fd15);_0x69a43d(_0x24fd15);});});} \ No newline at end of file +var _0x5202=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x170e3d,_0x2c69f7){var _0x58bbee=function(_0x2afaca){while(--_0x2afaca){_0x170e3d['push'](_0x170e3d['shift']());}};_0x58bbee(++_0x2c69f7);}(_0x5202,0x191));var _0x2520=function(_0x552da7,_0x20ceda){_0x552da7=_0x552da7-0x0;var _0x583894=_0x5202[_0x552da7];return _0x583894;};'use strict';var _=require(_0x2520('0x0'));var util=require(_0x2520('0x1'));var moment=require(_0x2520('0x2'));var BPromise=require(_0x2520('0x3'));var rs=require(_0x2520('0x4'));var fs=require('fs');var Redis=require(_0x2520('0x5'));var db=require(_0x2520('0x6'))['db'];var utils=require(_0x2520('0x7'));var logger=require(_0x2520('0x8'))('rpc');var config=require(_0x2520('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2520('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4383e9,_0x1f6d12,_0x2e4bd9){return new BPromise(function(_0x2b25ba,_0xa2d745){return client[_0x2520('0xb')](_0x4383e9,_0x2e4bd9)[_0x2520('0xc')](function(_0x578c19){logger[_0x2520('0xd')](_0x2520('0xe'),_0x1f6d12,'request\x20sent');logger[_0x2520('0xf')](_0x2520('0x10'),_0x1f6d12,_0x2520('0x11'),JSON[_0x2520('0x12')](_0x578c19));if(_0x578c19[_0x2520('0x13')]){if(_0x578c19['error'][_0x2520('0x14')]===0x1f4){logger[_0x2520('0x13')](_0x2520('0xe'),_0x1f6d12,_0x578c19[_0x2520('0x13')][_0x2520('0x15')]);return _0xa2d745(_0x578c19['error'][_0x2520('0x15')]);}logger[_0x2520('0x13')](_0x2520('0xe'),_0x1f6d12,_0x578c19[_0x2520('0x13')][_0x2520('0x15')]);return _0x2b25ba(_0x578c19['error']['message']);}else{logger[_0x2520('0xd')](_0x2520('0xe'),_0x1f6d12,_0x2520('0x11'));_0x2b25ba(_0x578c19[_0x2520('0x16')][_0x2520('0x15')]);}})[_0x2520('0x17')](function(_0x5d2be4){logger[_0x2520('0x13')](_0x2520('0xe'),_0x1f6d12,_0x5d2be4);_0xa2d745(_0x5d2be4);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d9c8690..927be07 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 _0x3f50=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x32674e,_0x4f0d04){var _0x2032b8=function(_0x591bf2){while(--_0x591bf2){_0x32674e['push'](_0x32674e['shift']());}};_0x2032b8(++_0x4f0d04);}(_0x3f50,0x10a));var _0x03f5=function(_0x5de96a,_0x3ee340){_0x5de96a=_0x5de96a-0x0;var _0x53ab51=_0x3f50[_0x5de96a];return _0x53ab51;};'use strict';var multer=require(_0x03f5('0x0'));var util=require(_0x03f5('0x1'));var path=require(_0x03f5('0x2'));var timeout=require(_0x03f5('0x3'));var express=require(_0x03f5('0x4'));var router=express[_0x03f5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x03f5('0x6'));var config=require(_0x03f5('0x7'));var controller=require(_0x03f5('0x8'));router[_0x03f5('0x9')](_0x03f5('0xa'),auth[_0x03f5('0xb')](),controller[_0x03f5('0xc')]);router['put']('/:id',auth[_0x03f5('0xb')](),controller['update']);router[_0x03f5('0xd')](_0x03f5('0xa'),auth[_0x03f5('0xb')](),controller[_0x03f5('0xe')]);module[_0x03f5('0xf')]=router; \ No newline at end of file +var _0x83e0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path'];(function(_0x19bae7,_0x55fa75){var _0x152876=function(_0x4f0d89){while(--_0x4f0d89){_0x19bae7['push'](_0x19bae7['shift']());}};_0x152876(++_0x55fa75);}(_0x83e0,0xc9));var _0x083e=function(_0x2fbc4f,_0x4d9a30){_0x2fbc4f=_0x2fbc4f-0x0;var _0x22b830=_0x83e0[_0x2fbc4f];return _0x22b830;};'use strict';var multer=require(_0x083e('0x0'));var util=require(_0x083e('0x1'));var path=require(_0x083e('0x2'));var timeout=require('connect-timeout');var express=require(_0x083e('0x3'));var router=express[_0x083e('0x4')]();var fs_extra=require(_0x083e('0x5'));var auth=require(_0x083e('0x6'));var interaction=require(_0x083e('0x7'));var config=require('../../config/environment');var controller=require(_0x083e('0x8'));router[_0x083e('0x9')](_0x083e('0xa'),auth[_0x083e('0xb')](),controller[_0x083e('0xc')]);router['put']('/:id',auth[_0x083e('0xb')](),controller[_0x083e('0xd')]);router[_0x083e('0xe')]('/:id',auth[_0x083e('0xb')](),controller[_0x083e('0xf')]);module[_0x083e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 2ad38c1..455683c 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 _0xa810=['exports','BOOLEAN','sequelize'];(function(_0xe1336b,_0x3f3130){var _0x1cf4b2=function(_0x38bcc5){while(--_0x38bcc5){_0xe1336b['push'](_0xe1336b['shift']());}};_0x1cf4b2(++_0x3f3130);}(_0xa810,0x80));var _0x0a81=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0xa810[_0xc8a11];return _0x55a500;};'use strict';var Sequelize=require(_0x0a81('0x0'));module[_0x0a81('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x0a81('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x965d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x48514d,_0x5cf7f6){var _0x4d26ff=function(_0x10c337){while(--_0x10c337){_0x48514d['push'](_0x48514d['shift']());}};_0x4d26ff(++_0x5cf7f6);}(_0x965d,0x1be));var _0xd965=function(_0x1ee0c2,_0x2d0835){_0x1ee0c2=_0x1ee0c2-0x0;var _0x285079=_0x965d[_0x1ee0c2];return _0x285079;};'use strict';var Sequelize=require(_0xd965('0x0'));module[_0xd965('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd965('0x2')]},'write':{'type':Sequelize[_0xd965('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index bd7accf..57c9c14 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 _0xe9ec=['bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','defaults','redis','localhost','register','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','describe','toInteger','addMembers','ids','omit','getMembers','findOne','removeMembers','ChatInternalMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x6d3aa,_0x452556){var _0x3457f1=function(_0x1a7234){while(--_0x1a7234){_0x6d3aa['push'](_0x6d3aa['shift']());}};_0x3457f1(++_0x452556);}(_0xe9ec,0x1c2));var _0xce9e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe9ec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xce9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce9e('0x1'));var jsonpatch=require(_0xce9e('0x2'));var rp=require(_0xce9e('0x3'));var moment=require(_0xce9e('0x4'));var BPromise=require(_0xce9e('0x5'));var Mustache=require(_0xce9e('0x6'));var util=require(_0xce9e('0x7'));var path=require(_0xce9e('0x8'));var sox=require(_0xce9e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce9e('0xa'));var _=require(_0xce9e('0xb'));var squel=require(_0xce9e('0xc'));var crypto=require(_0xce9e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xce9e('0xe'));var toCsv=require(_0xce9e('0xf'));var querystring=require(_0xce9e('0x10'));var Papa=require(_0xce9e('0x11'));var Redis=require('ioredis');var authService=require(_0xce9e('0x12'));var qs=require(_0xce9e('0x13'));var as=require(_0xce9e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce9e('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xce9e('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xce9e('0x17')](config[_0xce9e('0x18')],{'host':_0xce9e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce9e('0x18')]));require('./chatGroup.socket')[_0xce9e('0x1a')](socket);function respondWithStatusCode(_0x5dfc31,_0x2d51e2){_0x2d51e2=_0x2d51e2||0xcc;return function(_0x550fb6){if(_0x550fb6){return _0x5dfc31['sendStatus'](_0x2d51e2);}return _0x5dfc31[_0xce9e('0x1b')](_0x2d51e2)[_0xce9e('0x1c')]();};}function respondWithResult(_0x2ee224,_0x1a77b9){_0x1a77b9=_0x1a77b9||0xc8;return function(_0x40d522){if(_0x40d522){return _0x2ee224[_0xce9e('0x1b')](_0x1a77b9)['json'](_0x40d522);}};}function respondWithFilteredResult(_0x4ca4ff,_0xed8e13){return function(_0x2e26bd){if(_0x2e26bd){var _0x3148f8=typeof _0xed8e13['offset']==='undefined'&&typeof _0xed8e13[_0xce9e('0x1d')]===_0xce9e('0x1e');var _0x2a99f7=_0x2e26bd[_0xce9e('0x1f')];var _0x154268=_0x3148f8?0x0:_0xed8e13[_0xce9e('0x20')];var _0x33a1f3=_0x3148f8?_0x2e26bd[_0xce9e('0x1f')]:_0xed8e13[_0xce9e('0x20')]+_0xed8e13[_0xce9e('0x1d')];var _0x50e7c0;if(_0x33a1f3>=_0x2a99f7){_0x33a1f3=_0x2a99f7;_0x50e7c0=0xc8;}else{_0x50e7c0=0xce;}_0x4ca4ff[_0xce9e('0x1b')](_0x50e7c0);return _0x4ca4ff['set'](_0xce9e('0x21'),_0x154268+'-'+_0x33a1f3+'/'+_0x2a99f7)[_0xce9e('0x22')](_0x2e26bd);}return null;};}function patchUpdates(_0x2e1bc8){return function(_0x4acf75){try{jsonpatch[_0xce9e('0x23')](_0x4acf75,_0x2e1bc8,!![]);}catch(_0x50d28e){return BPromise[_0xce9e('0x24')](_0x50d28e);}return _0x4acf75['save']();};}function saveUpdates(_0xc6fd85,_0x27d837){return function(_0x58cc20){if(_0x58cc20){return _0x58cc20[_0xce9e('0x25')](_0xc6fd85)[_0xce9e('0x26')](function(_0x374647){return _0x374647;});}return null;};}function removeEntity(_0x5c7571,_0x5a8142){return function(_0x4b12d0){if(_0x4b12d0){return _0x4b12d0[_0xce9e('0x27')]()[_0xce9e('0x26')](function(){_0x5c7571[_0xce9e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e476c,_0x18bb07){return function(_0x4acaa6){if(!_0x4acaa6){_0x2e476c[_0xce9e('0x28')](0x194);}return _0x4acaa6;};}function handleError(_0xf64f19,_0x4e210c){_0x4e210c=_0x4e210c||0x1f4;return function(_0x95a25d){logger['error'](_0x95a25d[_0xce9e('0x29')]);if(_0x95a25d['name']){delete _0x95a25d['name'];}_0xf64f19['status'](_0x4e210c)[_0xce9e('0x2a')](_0x95a25d);};}exports[_0xce9e('0x2b')]=function(_0x5cfd14,_0xa7345d){var _0x5e05b5={},_0xe00715={},_0x4984a7={'count':0x0,'rows':[]};var _0x10e2c1=_[_0xce9e('0x2c')](db[_0xce9e('0x2d')][_0xce9e('0x2e')],function(_0x1e23a5){return{'name':_0x1e23a5[_0xce9e('0x2f')],'type':_0x1e23a5[_0xce9e('0x30')][_0xce9e('0x31')]};});_0xe00715[_0xce9e('0x32')]=_['map'](_0x10e2c1,_0xce9e('0x33'));_0xe00715[_0xce9e('0x34')]=_['keys'](_0x5cfd14[_0xce9e('0x34')]);_0xe00715['filters']=_[_0xce9e('0x35')](_0xe00715[_0xce9e('0x32')],_0xe00715[_0xce9e('0x34')]);_0x5e05b5[_0xce9e('0x36')]=_[_0xce9e('0x35')](_0xe00715['model'],qs[_0xce9e('0x37')](_0x5cfd14['query'][_0xce9e('0x37')]));_0x5e05b5[_0xce9e('0x36')]=_0x5e05b5[_0xce9e('0x36')][_0xce9e('0x38')]?_0x5e05b5[_0xce9e('0x36')]:_0xe00715['model'];if(!_0x5cfd14[_0xce9e('0x34')][_0xce9e('0x39')](_0xce9e('0x3a'))){_0x5e05b5[_0xce9e('0x1d')]=qs['limit'](_0x5cfd14[_0xce9e('0x34')]['limit']);_0x5e05b5[_0xce9e('0x20')]=qs[_0xce9e('0x20')](_0x5cfd14['query'][_0xce9e('0x20')]);}_0x5e05b5[_0xce9e('0x3b')]=qs[_0xce9e('0x3c')](_0x5cfd14[_0xce9e('0x34')][_0xce9e('0x3c')]);_0x5e05b5['where']=qs[_0xce9e('0x3d')](_[_0xce9e('0x3e')](_0x5cfd14[_0xce9e('0x34')],_0xe00715[_0xce9e('0x3d')]),_0x10e2c1);if(_0x5cfd14[_0xce9e('0x34')][_0xce9e('0x3f')]){_0x5e05b5[_0xce9e('0x40')]=_[_0xce9e('0x41')](_0x5e05b5['where'],{'$or':_['map'](_0x10e2c1,function(_0x2865c1){if(_0x2865c1[_0xce9e('0x30')]!==_0xce9e('0x42')){var _0x343dee={};_0x343dee[_0x2865c1['name']]={'$like':'%'+_0x5cfd14[_0xce9e('0x34')][_0xce9e('0x3f')]+'%'};return _0x343dee;}})});}_0x5e05b5=_['merge']({},_0x5e05b5,_0x5cfd14['options']);var _0x5e1570={'where':_0x5e05b5[_0xce9e('0x40')]};return db['ChatGroup'][_0xce9e('0x1f')](_0x5e1570)[_0xce9e('0x26')](function(_0x834ede){_0x4984a7[_0xce9e('0x1f')]=_0x834ede;if(_0x5cfd14['query'][_0xce9e('0x43')]){_0x5e05b5['include']=[{'all':!![]}];}return db[_0xce9e('0x2d')][_0xce9e('0x44')](_0x5e05b5);})[_0xce9e('0x26')](function(_0x52d282){_0x4984a7[_0xce9e('0x45')]=_0x52d282;return _0x4984a7;})[_0xce9e('0x26')](respondWithFilteredResult(_0xa7345d,_0x5e05b5))[_0xce9e('0x46')](handleError(_0xa7345d,null));};exports['show']=function(_0x4cd2ef,_0x58e980){var _0x58da99={'raw':!![],'where':{'id':_0x4cd2ef[_0xce9e('0x47')]['id']}},_0xe3c207={};_0xe3c207[_0xce9e('0x32')]=_[_0xce9e('0x48')](db[_0xce9e('0x2d')][_0xce9e('0x2e')]);_0xe3c207[_0xce9e('0x34')]=_[_0xce9e('0x48')](_0x4cd2ef[_0xce9e('0x34')]);_0xe3c207[_0xce9e('0x3d')]=_[_0xce9e('0x35')](_0xe3c207[_0xce9e('0x32')],_0xe3c207[_0xce9e('0x34')]);_0x58da99[_0xce9e('0x36')]=_['intersection'](_0xe3c207['model'],qs[_0xce9e('0x37')](_0x4cd2ef[_0xce9e('0x34')][_0xce9e('0x37')]));_0x58da99[_0xce9e('0x36')]=_0x58da99[_0xce9e('0x36')][_0xce9e('0x38')]?_0x58da99['attributes']:_0xe3c207[_0xce9e('0x32')];if(_0x4cd2ef[_0xce9e('0x34')][_0xce9e('0x43')]){_0x58da99[_0xce9e('0x49')]=[{'all':!![]}];}_0x58da99=_[_0xce9e('0x41')]({},_0x58da99,_0x4cd2ef[_0xce9e('0x4a')]);return db[_0xce9e('0x2d')][_0xce9e('0x4b')](_0x58da99)[_0xce9e('0x26')](handleEntityNotFound(_0x58e980,null))[_0xce9e('0x26')](respondWithResult(_0x58e980,null))[_0xce9e('0x46')](handleError(_0x58e980,null));};exports[_0xce9e('0x4c')]=function(_0x5b85b0,_0x3e2d7d){return db[_0xce9e('0x2d')][_0xce9e('0x4c')](_0x5b85b0[_0xce9e('0x4d')],{})[_0xce9e('0x26')](respondWithResult(_0x3e2d7d,0xc9))[_0xce9e('0x46')](handleError(_0x3e2d7d,null));};exports[_0xce9e('0x25')]=function(_0x5c77c5,_0x13108f){if(_0x5c77c5[_0xce9e('0x4d')]['id']){delete _0x5c77c5[_0xce9e('0x4d')]['id'];}return db[_0xce9e('0x2d')][_0xce9e('0x4b')]({'where':{'id':_0x5c77c5[_0xce9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x13108f,null))['then'](saveUpdates(_0x5c77c5[_0xce9e('0x4d')],null))[_0xce9e('0x26')](respondWithResult(_0x13108f,null))['catch'](handleError(_0x13108f,null));};exports['destroy']=function(_0x2083b0,_0x5241ec){return db['ChatGroup'][_0xce9e('0x4b')]({'where':{'id':_0x2083b0[_0xce9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5241ec,null))[_0xce9e('0x26')](removeEntity(_0x5241ec,null))['catch'](handleError(_0x5241ec,null));};exports[_0xce9e('0x4e')]=function(_0x384da5,_0xc6cf8){return db['ChatGroup']['describe']()[_0xce9e('0x26')](respondWithResult(_0xc6cf8,null))[_0xce9e('0x46')](handleError(_0xc6cf8,null));};exports['getUnread']=function(_0x4d6242,_0x5ba239,_0x351437){return db['ChatInternalMessage'][_0xce9e('0x1f')]({'where':{'ChatGroupId':_0x4d6242[_0xce9e('0x47')]['id'],'ToId':_0x4d6242['user']['id'],'read':![]}})[_0xce9e('0x26')](function(_0xbdec12){return{'id':_[_0xce9e('0x4f')](_0x4d6242[_0xce9e('0x47')]['id']),'count':_0xbdec12};})['then'](respondWithResult(_0x5ba239,null))[_0xce9e('0x46')](handleError(_0x5ba239,null));};exports['addMembers']=function(_0xeeeaa0,_0x56bb76,_0x99fc0a){return db[_0xce9e('0x2d')][_0xce9e('0x4b')]({'where':{'id':_0xeeeaa0[_0xce9e('0x47')]['id']}})[_0xce9e('0x26')](handleEntityNotFound(_0x56bb76,null))['then'](function(_0x1d080c){if(_0x1d080c){return _0x1d080c[_0xce9e('0x50')](_0xeeeaa0[_0xce9e('0x4d')][_0xce9e('0x51')],_[_0xce9e('0x52')](_0xeeeaa0[_0xce9e('0x4d')],[_0xce9e('0x51'),'id'])||{});}})[_0xce9e('0x26')](respondWithResult(_0x56bb76,null))[_0xce9e('0x46')](handleError(_0x56bb76,null));};exports[_0xce9e('0x53')]=function(_0xb404f7,_0xea8ae,_0x2def06){var _0x136af9={};var _0x3dede1={};var _0x51099d;var _0x4fa4f2;return db[_0xce9e('0x2d')][_0xce9e('0x54')]({'where':{'id':_0xb404f7[_0xce9e('0x47')]['id']}})[_0xce9e('0x26')](handleEntityNotFound(_0xea8ae,null))['then'](function(_0x41d243){if(_0x41d243){_0x51099d=_0x41d243;_0x3dede1['model']=_[_0xce9e('0x48')](db['User'][_0xce9e('0x2e')]);_0x3dede1[_0xce9e('0x34')]=_[_0xce9e('0x48')](_0xb404f7[_0xce9e('0x34')]);_0x3dede1[_0xce9e('0x3d')]=_[_0xce9e('0x35')](_0x3dede1[_0xce9e('0x32')],_0x3dede1[_0xce9e('0x34')]);_0x136af9['attributes']=_[_0xce9e('0x35')](_0x3dede1[_0xce9e('0x32')],qs[_0xce9e('0x37')](_0xb404f7[_0xce9e('0x34')][_0xce9e('0x37')]));_0x136af9[_0xce9e('0x36')]=_0x136af9[_0xce9e('0x36')][_0xce9e('0x38')]?_0x136af9[_0xce9e('0x36')]:_0x3dede1[_0xce9e('0x32')];_0x136af9[_0xce9e('0x3b')]=qs[_0xce9e('0x3c')](_0xb404f7[_0xce9e('0x34')][_0xce9e('0x3c')]);_0x136af9['where']=qs[_0xce9e('0x3d')](_[_0xce9e('0x3e')](_0xb404f7[_0xce9e('0x34')],_0x3dede1[_0xce9e('0x3d')]));if(_0xb404f7[_0xce9e('0x34')][_0xce9e('0x3f')]){_0x136af9['where']=_[_0xce9e('0x41')](_0x136af9['where'],{'$or':_[_0xce9e('0x2c')](_0x136af9[_0xce9e('0x36')],function(_0x5b93db){var _0x26b49a={};_0x26b49a[_0x5b93db]={'$like':'%'+_0xb404f7['query'][_0xce9e('0x3f')]+'%'};return _0x26b49a;})});}_0x136af9=_[_0xce9e('0x41')]({},_0x136af9,_0xb404f7[_0xce9e('0x4a')]);return _0x51099d[_0xce9e('0x53')](_0x136af9);}})[_0xce9e('0x26')](function(_0x57c177){if(_0x57c177){_0x4fa4f2=_0x57c177[_0xce9e('0x38')];if(!_0xb404f7[_0xce9e('0x34')][_0xce9e('0x39')](_0xce9e('0x3a'))){_0x136af9['limit']=qs[_0xce9e('0x1d')](_0xb404f7[_0xce9e('0x34')][_0xce9e('0x1d')]);_0x136af9['offset']=qs['offset'](_0xb404f7[_0xce9e('0x34')][_0xce9e('0x20')]);}return _0x51099d['getMembers'](_0x136af9);}})['then'](function(_0x54864b){if(_0x54864b){return _0x54864b?{'count':_0x4fa4f2,'rows':_0x54864b}:null;}})[_0xce9e('0x26')](respondWithResult(_0xea8ae,null))['catch'](handleError(_0xea8ae,null));};exports[_0xce9e('0x55')]=function(_0x494710,_0x280baa,_0x53d5b5){return db[_0xce9e('0x2d')][_0xce9e('0x4b')]({'where':{'id':_0x494710['params']['id']}})[_0xce9e('0x26')](handleEntityNotFound(_0x280baa,null))[_0xce9e('0x26')](function(_0x6d07a9){if(_0x6d07a9){return _0x6d07a9[_0xce9e('0x55')](_0x494710[_0xce9e('0x34')][_0xce9e('0x51')]);}})[_0xce9e('0x26')](respondWithStatusCode(_0x280baa,null))[_0xce9e('0x46')](handleError(_0x280baa,null));};exports['addMessage']=function(_0x23721d,_0x5e9288,_0x37d23e){if(_0x23721d[_0xce9e('0x4d')]['id']){delete _0x23721d['body']['id'];}return db[_0xce9e('0x2d')][_0xce9e('0x4b')]({'where':{'id':_0x23721d[_0xce9e('0x47')]['id']}})[_0xce9e('0x26')](handleEntityNotFound(_0x5e9288,null))['then'](function(_0x3f97dc){if(_0x3f97dc){_0x23721d['body']['ChatGroupId']=_0x3f97dc['id'];return db[_0xce9e('0x56')][_0xce9e('0x4c')](_0x23721d['body']);}})[_0xce9e('0x26')](respondWithResult(_0x5e9288,null))[_0xce9e('0x46')](handleError(_0x5e9288,null));};exports[_0xce9e('0x57')]=function(_0x2ba7cc,_0x3e0f87,_0x328257){var _0x166b75={};var _0x537bb9={};var _0x4c1f88;var _0x37d8da;return db[_0xce9e('0x2d')][_0xce9e('0x54')]({'where':{'id':_0x2ba7cc['params']['id']}})['then'](handleEntityNotFound(_0x3e0f87,null))[_0xce9e('0x26')](function(_0x32c774){if(_0x32c774){_0x4c1f88=_0x32c774;_0x537bb9[_0xce9e('0x32')]=_[_0xce9e('0x48')](db['ChatInternalMessage'][_0xce9e('0x2e')]);_0x537bb9['query']=_[_0xce9e('0x48')](_0x2ba7cc[_0xce9e('0x34')]);_0x537bb9[_0xce9e('0x3d')]=_['intersection'](_0x537bb9[_0xce9e('0x32')],_0x537bb9[_0xce9e('0x34')]);_0x166b75[_0xce9e('0x36')]=_['intersection'](_0x537bb9[_0xce9e('0x32')],qs['fields'](_0x2ba7cc['query'][_0xce9e('0x37')]));_0x166b75['attributes']=_0x166b75[_0xce9e('0x36')][_0xce9e('0x38')]?_0x166b75[_0xce9e('0x36')]:_0x537bb9[_0xce9e('0x32')];_0x166b75[_0xce9e('0x3b')]=qs[_0xce9e('0x3c')](_0x2ba7cc[_0xce9e('0x34')]['sort']);_0x166b75['where']=qs[_0xce9e('0x3d')](_[_0xce9e('0x3e')](_0x2ba7cc['query'],_0x537bb9[_0xce9e('0x3d')]));if(_0x2ba7cc[_0xce9e('0x34')][_0xce9e('0x3f')]){_0x166b75[_0xce9e('0x40')]=_['merge'](_0x166b75[_0xce9e('0x40')],{'$or':_[_0xce9e('0x2c')](_0x166b75[_0xce9e('0x36')],function(_0x3e79ce){var _0x342529={};_0x342529[_0x3e79ce]={'$like':'%'+_0x2ba7cc[_0xce9e('0x34')][_0xce9e('0x3f')]+'%'};return _0x342529;})});}if(_0x2ba7cc[_0xce9e('0x34')][_0xce9e('0x58')]){var _0x321c67=_0x2ba7cc['query'][_0xce9e('0x58')]['split'](',');var _0x1ed78d={};_0x1ed78d[_0x321c67[0x0]]={'$gte':moment(_0x321c67[0x1])[_0xce9e('0x59')](_0xce9e('0x5a'))};_0x166b75['where']=_[_0xce9e('0x41')](_0x166b75['where'],_0x1ed78d);}_0x166b75=_[_0xce9e('0x41')]({},_0x166b75,_0x2ba7cc[_0xce9e('0x4a')]);return _0x4c1f88[_0xce9e('0x57')](_0x166b75);}})[_0xce9e('0x26')](function(_0x2ff574){if(_0x2ff574){_0x37d8da=_0x2ff574['length'];if(!_0x2ba7cc[_0xce9e('0x34')][_0xce9e('0x39')]('nolimit')){_0x166b75[_0xce9e('0x1d')]=qs[_0xce9e('0x1d')](_0x2ba7cc[_0xce9e('0x34')]['limit']);_0x166b75[_0xce9e('0x20')]=qs[_0xce9e('0x20')](_0x2ba7cc['query'][_0xce9e('0x20')]);}return _0x4c1f88[_0xce9e('0x57')](_0x166b75);}})[_0xce9e('0x26')](function(_0x4a7b9e){if(_0x4a7b9e){return _0x4a7b9e?{'count':_0x37d8da,'rows':_0x4a7b9e}:null;}})[_0xce9e('0x26')](respondWithResult(_0x3e0f87,null))[_0xce9e('0x46')](handleError(_0x3e0f87,null));}; \ No newline at end of file +var _0x7ed2=['find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','removeMembers','ChatGroupId','getMessages','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','send','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','fields','includeAll','options'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0x7ed2,0x18d));var _0x27ed=function(_0x404285,_0x5ceb1b){_0x404285=_0x404285-0x0;var _0x11c5eb=_0x7ed2[_0x404285];return _0x11c5eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27ed('0x0'));var zipdir=require(_0x27ed('0x1'));var jsonpatch=require(_0x27ed('0x2'));var rp=require(_0x27ed('0x3'));var moment=require(_0x27ed('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x27ed('0x5'));var sox=require(_0x27ed('0x6'));var csv=require(_0x27ed('0x7'));var ejs=require(_0x27ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27ed('0x9'));var squel=require('squel');var crypto=require(_0x27ed('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x27ed('0xb'));var toCsv=require(_0x27ed('0x7'));var querystring=require(_0x27ed('0xc'));var Papa=require(_0x27ed('0xd'));var Redis=require(_0x27ed('0xe'));var authService=require(_0x27ed('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x27ed('0x10'));var hardwareService=require(_0x27ed('0x11'));var logger=require('../../config/logger')(_0x27ed('0x12'));var utils=require(_0x27ed('0x13'));var config=require(_0x27ed('0x14'));var licenseUtil=require(_0x27ed('0x15'));var db=require(_0x27ed('0x16'))['db'];config[_0x27ed('0x17')]=_[_0x27ed('0x18')](config[_0x27ed('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x27ed('0x19'))[_0x27ed('0x1a')](socket);function respondWithStatusCode(_0x539ba6,_0x50d611){_0x50d611=_0x50d611||0xcc;return function(_0x226dce){if(_0x226dce){return _0x539ba6['sendStatus'](_0x50d611);}return _0x539ba6[_0x27ed('0x1b')](_0x50d611)[_0x27ed('0x1c')]();};}function respondWithResult(_0x47b48b,_0x34e4aa){_0x34e4aa=_0x34e4aa||0xc8;return function(_0x3f211d){if(_0x3f211d){return _0x47b48b[_0x27ed('0x1b')](_0x34e4aa)[_0x27ed('0x1d')](_0x3f211d);}};}function respondWithFilteredResult(_0x5e0f0c,_0x723837){return function(_0x173180){if(_0x173180){var _0x5577f1=typeof _0x723837[_0x27ed('0x1e')]===_0x27ed('0x1f')&&typeof _0x723837[_0x27ed('0x20')]===_0x27ed('0x1f');var _0x2dd015=_0x173180[_0x27ed('0x21')];var _0xd1b0a0=_0x5577f1?0x0:_0x723837['offset'];var _0x38c7e0=_0x5577f1?_0x173180['count']:_0x723837['offset']+_0x723837[_0x27ed('0x20')];var _0x1df259;if(_0x38c7e0>=_0x2dd015){_0x38c7e0=_0x2dd015;_0x1df259=0xc8;}else{_0x1df259=0xce;}_0x5e0f0c[_0x27ed('0x1b')](_0x1df259);return _0x5e0f0c[_0x27ed('0x22')](_0x27ed('0x23'),_0xd1b0a0+'-'+_0x38c7e0+'/'+_0x2dd015)[_0x27ed('0x1d')](_0x173180);}return null;};}function patchUpdates(_0x5109d3){return function(_0x454ff8){try{jsonpatch[_0x27ed('0x24')](_0x454ff8,_0x5109d3,!![]);}catch(_0x4fad34){return BPromise[_0x27ed('0x25')](_0x4fad34);}return _0x454ff8['save']();};}function saveUpdates(_0x4ed974,_0x1fdb44){return function(_0x155e0b){if(_0x155e0b){return _0x155e0b[_0x27ed('0x26')](_0x4ed974)['then'](function(_0x1eb982){return _0x1eb982;});}return null;};}function removeEntity(_0x2a1448,_0x359e50){return function(_0x362bbb){if(_0x362bbb){return _0x362bbb[_0x27ed('0x27')]()[_0x27ed('0x28')](function(){_0x2a1448[_0x27ed('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1b1f,_0x41879d){return function(_0x19594d){if(!_0x19594d){_0x3b1b1f[_0x27ed('0x29')](0x194);}return _0x19594d;};}function handleError(_0x1ec560,_0x2fbf83){_0x2fbf83=_0x2fbf83||0x1f4;return function(_0x566534){logger[_0x27ed('0x2a')](_0x566534['stack']);if(_0x566534[_0x27ed('0x2b')]){delete _0x566534[_0x27ed('0x2b')];}_0x1ec560['status'](_0x2fbf83)[_0x27ed('0x2c')](_0x566534);};}exports['index']=function(_0x1cbe5a,_0x3f51bf){var _0x353129={},_0x921f2f={},_0x1aa210={'count':0x0,'rows':[]};var _0x4610a6=_[_0x27ed('0x2d')](db[_0x27ed('0x2e')][_0x27ed('0x2f')],function(_0x4735f4){return{'name':_0x4735f4['fieldName'],'type':_0x4735f4[_0x27ed('0x30')][_0x27ed('0x31')]};});_0x921f2f[_0x27ed('0x32')]=_['map'](_0x4610a6,_0x27ed('0x2b'));_0x921f2f[_0x27ed('0x33')]=_[_0x27ed('0x34')](_0x1cbe5a[_0x27ed('0x33')]);_0x921f2f[_0x27ed('0x35')]=_[_0x27ed('0x36')](_0x921f2f[_0x27ed('0x32')],_0x921f2f['query']);_0x353129[_0x27ed('0x37')]=_['intersection'](_0x921f2f[_0x27ed('0x32')],qs['fields'](_0x1cbe5a[_0x27ed('0x33')]['fields']));_0x353129['attributes']=_0x353129[_0x27ed('0x37')][_0x27ed('0x38')]?_0x353129[_0x27ed('0x37')]:_0x921f2f[_0x27ed('0x32')];if(!_0x1cbe5a[_0x27ed('0x33')][_0x27ed('0x39')](_0x27ed('0x3a'))){_0x353129[_0x27ed('0x20')]=qs[_0x27ed('0x20')](_0x1cbe5a[_0x27ed('0x33')][_0x27ed('0x20')]);_0x353129[_0x27ed('0x1e')]=qs[_0x27ed('0x1e')](_0x1cbe5a[_0x27ed('0x33')][_0x27ed('0x1e')]);}_0x353129['order']=qs['sort'](_0x1cbe5a['query'][_0x27ed('0x3b')]);_0x353129[_0x27ed('0x3c')]=qs['filters'](_[_0x27ed('0x3d')](_0x1cbe5a['query'],_0x921f2f[_0x27ed('0x35')]),_0x4610a6);if(_0x1cbe5a['query'][_0x27ed('0x3e')]){_0x353129[_0x27ed('0x3c')]=_['merge'](_0x353129[_0x27ed('0x3c')],{'$or':_[_0x27ed('0x2d')](_0x4610a6,function(_0x34ce08){if(_0x34ce08['type']!==_0x27ed('0x3f')){var _0x32e556={};_0x32e556[_0x34ce08['name']]={'$like':'%'+_0x1cbe5a['query']['filter']+'%'};return _0x32e556;}})});}_0x353129=_[_0x27ed('0x40')]({},_0x353129,_0x1cbe5a['options']);var _0x298aed={'where':_0x353129['where']};return db[_0x27ed('0x2e')][_0x27ed('0x21')](_0x298aed)[_0x27ed('0x28')](function(_0x591bdb){_0x1aa210['count']=_0x591bdb;if(_0x1cbe5a['query']['includeAll']){_0x353129[_0x27ed('0x41')]=[{'all':!![]}];}return db[_0x27ed('0x2e')][_0x27ed('0x42')](_0x353129);})[_0x27ed('0x28')](function(_0x28d4ce){_0x1aa210['rows']=_0x28d4ce;return _0x1aa210;})[_0x27ed('0x28')](respondWithFilteredResult(_0x3f51bf,_0x353129))[_0x27ed('0x43')](handleError(_0x3f51bf,null));};exports[_0x27ed('0x44')]=function(_0xe85aa0,_0xebec4f){var _0x356ca2={'raw':!![],'where':{'id':_0xe85aa0[_0x27ed('0x45')]['id']}},_0x12e02f={};_0x12e02f[_0x27ed('0x32')]=_[_0x27ed('0x34')](db[_0x27ed('0x2e')]['rawAttributes']);_0x12e02f[_0x27ed('0x33')]=_[_0x27ed('0x34')](_0xe85aa0[_0x27ed('0x33')]);_0x12e02f[_0x27ed('0x35')]=_['intersection'](_0x12e02f[_0x27ed('0x32')],_0x12e02f[_0x27ed('0x33')]);_0x356ca2['attributes']=_[_0x27ed('0x36')](_0x12e02f[_0x27ed('0x32')],qs[_0x27ed('0x46')](_0xe85aa0[_0x27ed('0x33')][_0x27ed('0x46')]));_0x356ca2['attributes']=_0x356ca2[_0x27ed('0x37')][_0x27ed('0x38')]?_0x356ca2[_0x27ed('0x37')]:_0x12e02f[_0x27ed('0x32')];if(_0xe85aa0['query'][_0x27ed('0x47')]){_0x356ca2['include']=[{'all':!![]}];}_0x356ca2=_[_0x27ed('0x40')]({},_0x356ca2,_0xe85aa0[_0x27ed('0x48')]);return db[_0x27ed('0x2e')][_0x27ed('0x49')](_0x356ca2)[_0x27ed('0x28')](handleEntityNotFound(_0xebec4f,null))[_0x27ed('0x28')](respondWithResult(_0xebec4f,null))[_0x27ed('0x43')](handleError(_0xebec4f,null));};exports[_0x27ed('0x4a')]=function(_0x33322d,_0x34a17c){return db['ChatGroup']['create'](_0x33322d[_0x27ed('0x4b')],{})[_0x27ed('0x28')](respondWithResult(_0x34a17c,0xc9))[_0x27ed('0x43')](handleError(_0x34a17c,null));};exports[_0x27ed('0x26')]=function(_0x34860b,_0xa140b0){if(_0x34860b[_0x27ed('0x4b')]['id']){delete _0x34860b['body']['id'];}return db[_0x27ed('0x2e')][_0x27ed('0x49')]({'where':{'id':_0x34860b[_0x27ed('0x45')]['id']}})[_0x27ed('0x28')](handleEntityNotFound(_0xa140b0,null))[_0x27ed('0x28')](saveUpdates(_0x34860b[_0x27ed('0x4b')],null))[_0x27ed('0x28')](respondWithResult(_0xa140b0,null))[_0x27ed('0x43')](handleError(_0xa140b0,null));};exports[_0x27ed('0x27')]=function(_0x16615b,_0x239eaf){return db[_0x27ed('0x2e')][_0x27ed('0x49')]({'where':{'id':_0x16615b[_0x27ed('0x45')]['id']}})['then'](handleEntityNotFound(_0x239eaf,null))[_0x27ed('0x28')](removeEntity(_0x239eaf,null))[_0x27ed('0x43')](handleError(_0x239eaf,null));};exports['describe']=function(_0x69657e,_0x328312){return db['ChatGroup'][_0x27ed('0x4c')]()[_0x27ed('0x28')](respondWithResult(_0x328312,null))[_0x27ed('0x43')](handleError(_0x328312,null));};exports[_0x27ed('0x4d')]=function(_0x2fc36b,_0x3b1009,_0x47fbd1){return db[_0x27ed('0x4e')][_0x27ed('0x21')]({'where':{'ChatGroupId':_0x2fc36b[_0x27ed('0x45')]['id'],'ToId':_0x2fc36b[_0x27ed('0x4f')]['id'],'read':![]}})[_0x27ed('0x28')](function(_0x5c232a){return{'id':_['toInteger'](_0x2fc36b[_0x27ed('0x45')]['id']),'count':_0x5c232a};})[_0x27ed('0x28')](respondWithResult(_0x3b1009,null))[_0x27ed('0x43')](handleError(_0x3b1009,null));};exports[_0x27ed('0x50')]=function(_0x302974,_0x56160f,_0x14bcf6){return db[_0x27ed('0x2e')][_0x27ed('0x49')]({'where':{'id':_0x302974[_0x27ed('0x45')]['id']}})['then'](handleEntityNotFound(_0x56160f,null))['then'](function(_0x625afb){if(_0x625afb){return _0x625afb[_0x27ed('0x50')](_0x302974[_0x27ed('0x4b')][_0x27ed('0x51')],_[_0x27ed('0x52')](_0x302974[_0x27ed('0x4b')],[_0x27ed('0x51'),'id'])||{});}})[_0x27ed('0x28')](respondWithResult(_0x56160f,null))[_0x27ed('0x43')](handleError(_0x56160f,null));};exports[_0x27ed('0x53')]=function(_0x797474,_0x435e4f,_0x22ff87){var _0x22ec29={};var _0x3d2b5f={};var _0x55c0a4;var _0x505a58;return db[_0x27ed('0x2e')][_0x27ed('0x54')]({'where':{'id':_0x797474['params']['id']}})[_0x27ed('0x28')](handleEntityNotFound(_0x435e4f,null))[_0x27ed('0x28')](function(_0x371fa){if(_0x371fa){_0x55c0a4=_0x371fa;_0x3d2b5f[_0x27ed('0x32')]=_[_0x27ed('0x34')](db[_0x27ed('0x55')]['rawAttributes']);_0x3d2b5f['query']=_[_0x27ed('0x34')](_0x797474[_0x27ed('0x33')]);_0x3d2b5f[_0x27ed('0x35')]=_[_0x27ed('0x36')](_0x3d2b5f[_0x27ed('0x32')],_0x3d2b5f['query']);_0x22ec29[_0x27ed('0x37')]=_[_0x27ed('0x36')](_0x3d2b5f['model'],qs[_0x27ed('0x46')](_0x797474['query'][_0x27ed('0x46')]));_0x22ec29[_0x27ed('0x37')]=_0x22ec29[_0x27ed('0x37')]['length']?_0x22ec29[_0x27ed('0x37')]:_0x3d2b5f[_0x27ed('0x32')];_0x22ec29['order']=qs[_0x27ed('0x3b')](_0x797474[_0x27ed('0x33')]['sort']);_0x22ec29['where']=qs[_0x27ed('0x35')](_['pick'](_0x797474['query'],_0x3d2b5f[_0x27ed('0x35')]));if(_0x797474[_0x27ed('0x33')][_0x27ed('0x3e')]){_0x22ec29[_0x27ed('0x3c')]=_[_0x27ed('0x40')](_0x22ec29[_0x27ed('0x3c')],{'$or':_['map'](_0x22ec29[_0x27ed('0x37')],function(_0x270e33){var _0x8ca490={};_0x8ca490[_0x270e33]={'$like':'%'+_0x797474[_0x27ed('0x33')][_0x27ed('0x3e')]+'%'};return _0x8ca490;})});}_0x22ec29=_[_0x27ed('0x40')]({},_0x22ec29,_0x797474['options']);return _0x55c0a4[_0x27ed('0x53')](_0x22ec29);}})[_0x27ed('0x28')](function(_0x20ec7d){if(_0x20ec7d){_0x505a58=_0x20ec7d[_0x27ed('0x38')];if(!_0x797474[_0x27ed('0x33')]['hasOwnProperty']('nolimit')){_0x22ec29['limit']=qs['limit'](_0x797474[_0x27ed('0x33')][_0x27ed('0x20')]);_0x22ec29['offset']=qs[_0x27ed('0x1e')](_0x797474['query'][_0x27ed('0x1e')]);}return _0x55c0a4['getMembers'](_0x22ec29);}})[_0x27ed('0x28')](function(_0x2ad31f){if(_0x2ad31f){return _0x2ad31f?{'count':_0x505a58,'rows':_0x2ad31f}:null;}})['then'](respondWithResult(_0x435e4f,null))[_0x27ed('0x43')](handleError(_0x435e4f,null));};exports['removeMembers']=function(_0x17482d,_0x34b96d,_0x18785e){return db[_0x27ed('0x2e')][_0x27ed('0x49')]({'where':{'id':_0x17482d['params']['id']}})[_0x27ed('0x28')](handleEntityNotFound(_0x34b96d,null))[_0x27ed('0x28')](function(_0x568e35){if(_0x568e35){return _0x568e35[_0x27ed('0x56')](_0x17482d[_0x27ed('0x33')][_0x27ed('0x51')]);}})[_0x27ed('0x28')](respondWithStatusCode(_0x34b96d,null))[_0x27ed('0x43')](handleError(_0x34b96d,null));};exports['addMessage']=function(_0x4537e4,_0x2b4119,_0x44f4f9){if(_0x4537e4['body']['id']){delete _0x4537e4[_0x27ed('0x4b')]['id'];}return db[_0x27ed('0x2e')]['find']({'where':{'id':_0x4537e4[_0x27ed('0x45')]['id']}})[_0x27ed('0x28')](handleEntityNotFound(_0x2b4119,null))[_0x27ed('0x28')](function(_0x4291c9){if(_0x4291c9){_0x4537e4[_0x27ed('0x4b')][_0x27ed('0x57')]=_0x4291c9['id'];return db[_0x27ed('0x4e')]['create'](_0x4537e4[_0x27ed('0x4b')]);}})['then'](respondWithResult(_0x2b4119,null))[_0x27ed('0x43')](handleError(_0x2b4119,null));};exports[_0x27ed('0x58')]=function(_0x5bbafe,_0xfcb4ac,_0x1765b6){var _0x273501={};var _0x56c74d={};var _0x1a50d3;var _0x33d56b;return db[_0x27ed('0x2e')][_0x27ed('0x54')]({'where':{'id':_0x5bbafe[_0x27ed('0x45')]['id']}})[_0x27ed('0x28')](handleEntityNotFound(_0xfcb4ac,null))[_0x27ed('0x28')](function(_0x1ef800){if(_0x1ef800){_0x1a50d3=_0x1ef800;_0x56c74d[_0x27ed('0x32')]=_[_0x27ed('0x34')](db[_0x27ed('0x4e')][_0x27ed('0x2f')]);_0x56c74d['query']=_[_0x27ed('0x34')](_0x5bbafe[_0x27ed('0x33')]);_0x56c74d[_0x27ed('0x35')]=_[_0x27ed('0x36')](_0x56c74d[_0x27ed('0x32')],_0x56c74d[_0x27ed('0x33')]);_0x273501[_0x27ed('0x37')]=_[_0x27ed('0x36')](_0x56c74d[_0x27ed('0x32')],qs[_0x27ed('0x46')](_0x5bbafe[_0x27ed('0x33')][_0x27ed('0x46')]));_0x273501[_0x27ed('0x37')]=_0x273501[_0x27ed('0x37')][_0x27ed('0x38')]?_0x273501['attributes']:_0x56c74d[_0x27ed('0x32')];_0x273501[_0x27ed('0x59')]=qs[_0x27ed('0x3b')](_0x5bbafe[_0x27ed('0x33')][_0x27ed('0x3b')]);_0x273501[_0x27ed('0x3c')]=qs[_0x27ed('0x35')](_[_0x27ed('0x3d')](_0x5bbafe[_0x27ed('0x33')],_0x56c74d[_0x27ed('0x35')]));if(_0x5bbafe['query'][_0x27ed('0x3e')]){_0x273501[_0x27ed('0x3c')]=_[_0x27ed('0x40')](_0x273501[_0x27ed('0x3c')],{'$or':_[_0x27ed('0x2d')](_0x273501[_0x27ed('0x37')],function(_0x54a88){var _0x5d47e3={};_0x5d47e3[_0x54a88]={'$like':'%'+_0x5bbafe[_0x27ed('0x33')][_0x27ed('0x3e')]+'%'};return _0x5d47e3;})});}if(_0x5bbafe[_0x27ed('0x33')][_0x27ed('0x5a')]){var _0x5b3661=_0x5bbafe[_0x27ed('0x33')][_0x27ed('0x5a')][_0x27ed('0x5b')](',');var _0x4837cf={};_0x4837cf[_0x5b3661[0x0]]={'$gte':moment(_0x5b3661[0x1])[_0x27ed('0x5c')](_0x27ed('0x5d'))};_0x273501[_0x27ed('0x3c')]=_['merge'](_0x273501[_0x27ed('0x3c')],_0x4837cf);}_0x273501=_[_0x27ed('0x40')]({},_0x273501,_0x5bbafe['options']);return _0x1a50d3[_0x27ed('0x58')](_0x273501);}})[_0x27ed('0x28')](function(_0x3b19cd){if(_0x3b19cd){_0x33d56b=_0x3b19cd[_0x27ed('0x38')];if(!_0x5bbafe['query'][_0x27ed('0x39')]('nolimit')){_0x273501[_0x27ed('0x20')]=qs[_0x27ed('0x20')](_0x5bbafe[_0x27ed('0x33')][_0x27ed('0x20')]);_0x273501[_0x27ed('0x1e')]=qs['offset'](_0x5bbafe[_0x27ed('0x33')][_0x27ed('0x1e')]);}return _0x1a50d3[_0x27ed('0x58')](_0x273501);}})[_0x27ed('0x28')](function(_0x2db126){if(_0x2db126){return _0x2db126?{'count':_0x33d56b,'rows':_0x2db126}:null;}})['then'](respondWithResult(_0xfcb4ac,null))[_0x27ed('0x43')](handleError(_0xfcb4ac,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5de5cc1..dad8b63 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 _0x803d=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatGroup','setMaxListeners','save'];(function(_0x24d61f,_0x38cebb){var _0x29ae79=function(_0x5ae6b7){while(--_0x5ae6b7){_0x24d61f['push'](_0x24d61f['shift']());}};_0x29ae79(++_0x38cebb);}(_0x803d,0x15a));var _0xd803=function(_0x30b5cc,_0x56fbfc){_0x30b5cc=_0x30b5cc-0x0;var _0x382eb4=_0x803d[_0x30b5cc];return _0x382eb4;};'use strict';var EventEmitter=require(_0xd803('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xd803('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd803('0x2')](0x0);var events={'afterCreate':_0xd803('0x3'),'afterUpdate':_0xd803('0x4'),'afterDestroy':_0xd803('0x5')};function emitEvent(_0x11253c){return function(_0x57138a,_0xc67786,_0x55e3d2){ChatGroupEvents[_0xd803('0x6')](_0x11253c+':'+_0x57138a['id'],_0x57138a);ChatGroupEvents[_0xd803('0x6')](_0x11253c,_0x57138a);_0x55e3d2(null);};}for(var e in events){if(events[_0xd803('0x7')](e)){var event=events[e];ChatGroup[_0xd803('0x8')](e,emitEvent(event));}}module[_0xd803('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x788c=['../../mysqldb','setMaxListeners','update','hasOwnProperty','hook','exports'];(function(_0x46bc75,_0x3fda3b){var _0x3294c5=function(_0x680c3b){while(--_0x680c3b){_0x46bc75['push'](_0x46bc75['shift']());}};_0x3294c5(++_0x3fda3b);}(_0x788c,0xf6));var _0xc788=function(_0x336ec5,_0x35cc88){_0x336ec5=_0x336ec5-0x0;var _0x39aa1f=_0x788c[_0x336ec5];return _0x39aa1f;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xc788('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc788('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc788('0x2'),'afterDestroy':'remove'};function emitEvent(_0x526ec5){return function(_0x13d917,_0x1235c0,_0x15c1f2){ChatGroupEvents['emit'](_0x526ec5+':'+_0x13d917['id'],_0x13d917);ChatGroupEvents['emit'](_0x526ec5,_0x13d917);_0x15c1f2(null);};}for(var e in events){if(events[_0xc788('0x3')](e)){var event=events[e];ChatGroup[_0xc788('0x4')](e,emitEvent(event));}}module[_0xc788('0x5')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d32cbe4..a237a81 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 _0xc290=['util','api','moment','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0xc290,0x14d));var _0x0c29=function(_0x2ffc5d,_0x564eba){_0x2ffc5d=_0x2ffc5d-0x0;var _0x57f0a=_0xc290[_0x2ffc5d];return _0x57f0a;};'use strict';var _=require('lodash');var util=require(_0x0c29('0x0'));var logger=require('../../config/logger')(_0x0c29('0x1'));var moment=require(_0x0c29('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c29('0x3'));var rimraf=require('rimraf');var config=require(_0x0c29('0x4'));var attributes=require(_0x0c29('0x5'));module[_0x0c29('0x6')]=function(_0x57c4f6,_0x277042){return _0x57c4f6[_0x0c29('0x7')](_0x0c29('0x8'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb8d=['chat_groups','lodash','util','api','bluebird','request-promise','path','rimraf','./chatGroup.attributes','define','ChatGroup'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xdb8d,0x1c4));var _0xddb8=function(_0x214393,_0x243463){_0x214393=_0x214393-0x0;var _0x38be1a=_0xdb8d[_0x214393];return _0x38be1a;};'use strict';var _=require(_0xddb8('0x0'));var util=require(_0xddb8('0x1'));var logger=require('../../config/logger')(_0xddb8('0x2'));var moment=require('moment');var BPromise=require(_0xddb8('0x3'));var rp=require(_0xddb8('0x4'));var fs=require('fs');var path=require(_0xddb8('0x5'));var rimraf=require(_0xddb8('0x6'));var config=require('../../config/environment');var attributes=require(_0xddb8('0x7'));module['exports']=function(_0x4d6189,_0x5a8433){return _0x4d6189[_0xddb8('0x8')](_0xddb8('0x9'),attributes,{'tableName':_0xddb8('0xa'),'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 720be89..0abddf7 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 _0x32c0=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x32c0,0x1f3));var _0x032c=function(_0x174ae1,_0x30e650){_0x174ae1=_0x174ae1-0x0;var _0x4c5108=_0x32c0[_0x174ae1];return _0x4c5108;};'use strict';var _=require(_0x032c('0x0'));var util=require(_0x032c('0x1'));var moment=require('moment');var BPromise=require(_0x032c('0x2'));var rs=require(_0x032c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x032c('0x4'))['db'];var utils=require(_0x032c('0x5'));var logger=require(_0x032c('0x6'))(_0x032c('0x7'));var config=require('../../config/environment');var jayson=require(_0x032c('0x8'));var client=jayson[_0x032c('0x9')][_0x032c('0xa')]({'port':0x232a});config[_0x032c('0xb')]=_['defaults'](config[_0x032c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x032c('0xc'))(new Redis(config[_0x032c('0xb')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x3c7233,_0x5be922,_0x33fed9){return new BPromise(function(_0x520943,_0x428600){return client[_0x032c('0xd')](_0x3c7233,_0x33fed9)[_0x032c('0xe')](function(_0x14be2a){logger[_0x032c('0xf')](_0x032c('0x10'),_0x5be922,'request\x20sent');logger[_0x032c('0x11')](_0x032c('0x12'),_0x5be922,_0x032c('0x13'),JSON[_0x032c('0x14')](_0x14be2a));if(_0x14be2a['error']){if(_0x14be2a[_0x032c('0x15')][_0x032c('0x16')]===0x1f4){logger[_0x032c('0x15')](_0x032c('0x10'),_0x5be922,_0x14be2a[_0x032c('0x15')][_0x032c('0x17')]);return _0x428600(_0x14be2a['error'][_0x032c('0x17')]);}logger[_0x032c('0x15')](_0x032c('0x10'),_0x5be922,_0x14be2a[_0x032c('0x15')][_0x032c('0x17')]);return _0x520943(_0x14be2a[_0x032c('0x15')]['message']);}else{logger[_0x032c('0xf')](_0x032c('0x10'),_0x5be922,_0x032c('0x13'));_0x520943(_0x14be2a[_0x032c('0x18')][_0x032c('0x17')]);}})[_0x032c('0x19')](function(_0xe222c0){logger[_0x032c('0x15')](_0x032c('0x10'),_0x5be922,_0xe222c0);_0x428600(_0xe222c0);});});} \ No newline at end of file +var _0xa633=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','then','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa633,0x15d));var _0x3a63=function(_0x31ef75,_0x56e06a){_0x31ef75=_0x31ef75-0x0;var _0x536337=_0xa633[_0x31ef75];return _0x536337;};'use strict';var _=require(_0x3a63('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a63('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a63('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a63('0x3'))(_0x3a63('0x4'));var config=require(_0x3a63('0x5'));var jayson=require(_0x3a63('0x6'));var client=jayson[_0x3a63('0x7')][_0x3a63('0x8')]({'port':0x232a});config[_0x3a63('0x9')]=_[_0x3a63('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3a63('0xb'))(new Redis(config[_0x3a63('0x9')]));require(_0x3a63('0xc'))[_0x3a63('0xd')](socket);function respondWithRpcPromise(_0x5a20b4,_0x332025,_0x1b8a13){return new BPromise(function(_0x5b6ed8,_0x1511cc){return client['request'](_0x5a20b4,_0x1b8a13)[_0x3a63('0xe')](function(_0x21e23b){logger['info']('ChatGroup,\x20%s,\x20%s',_0x332025,_0x3a63('0xf'));logger['debug'](_0x3a63('0x10'),_0x332025,_0x3a63('0xf'),JSON['stringify'](_0x21e23b));if(_0x21e23b[_0x3a63('0x11')]){if(_0x21e23b['error']['code']===0x1f4){logger['error'](_0x3a63('0x12'),_0x332025,_0x21e23b[_0x3a63('0x11')][_0x3a63('0x13')]);return _0x1511cc(_0x21e23b['error'][_0x3a63('0x13')]);}logger[_0x3a63('0x11')](_0x3a63('0x12'),_0x332025,_0x21e23b[_0x3a63('0x11')][_0x3a63('0x13')]);return _0x5b6ed8(_0x21e23b[_0x3a63('0x11')][_0x3a63('0x13')]);}else{logger['info'](_0x3a63('0x12'),_0x332025,_0x3a63('0xf'));_0x5b6ed8(_0x21e23b[_0x3a63('0x14')][_0x3a63('0x13')]);}})[_0x3a63('0x15')](function(_0x1a9146){logger[_0x3a63('0x11')](_0x3a63('0x12'),_0x332025,_0x1a9146);_0x1511cc(_0x1a9146);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e9fdcab..a4465b7 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 _0x304c=['removeListener','register','length','chatGroup:','save','remove','update','emit'];(function(_0x4e364c,_0x32af6b){var _0x213b5b=function(_0x56434e){while(--_0x56434e){_0x4e364c['push'](_0x4e364c['shift']());}};_0x213b5b(++_0x32af6b);}(_0x304c,0x154));var _0xc304=function(_0x1c16e5,_0x297035){_0x1c16e5=_0x1c16e5-0x0;var _0x38de4e=_0x304c[_0x1c16e5];return _0x38de4e;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xc304('0x0'),_0xc304('0x1'),_0xc304('0x2')];function createListener(_0x3fce8f,_0x3c4c93){return function(_0x5bb45d){_0x3c4c93[_0xc304('0x3')](_0x3fce8f,_0x5bb45d);};}function removeListener(_0x2da327,_0x149f03){return function(){ChatGroupEvents[_0xc304('0x4')](_0x2da327,_0x149f03);};}exports[_0xc304('0x5')]=function(_0x2067e){for(var _0x30ad9f=0x0,_0xd40177=events[_0xc304('0x6')];_0x30ad9f<_0xd40177;_0x30ad9f++){var _0x4805fb=events[_0x30ad9f];var _0x59cca9=createListener(_0xc304('0x7')+_0x4805fb,_0x2067e);ChatGroupEvents['on'](_0x4805fb,_0x59cca9);}}; \ No newline at end of file +var _0xc1b9=['save','update','register','length','chatGroup:','./chatGroup.events'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc1b9,0xd1));var _0x9c1b=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xc1b9[_0x4a8bad];return _0x30cf32;};'use strict';var ChatGroupEvents=require(_0x9c1b('0x0'));var events=[_0x9c1b('0x1'),'remove',_0x9c1b('0x2')];function createListener(_0x7ec256,_0x26b724){return function(_0x1ddc52){_0x26b724['emit'](_0x7ec256,_0x1ddc52);};}function removeListener(_0x421fc4,_0x58bb17){return function(){ChatGroupEvents['removeListener'](_0x421fc4,_0x58bb17);};}exports[_0x9c1b('0x3')]=function(_0x1f62f5){for(var _0x4495fa=0x0,_0x1c00fa=events[_0x9c1b('0x4')];_0x4495fa<_0x1c00fa;_0x4495fa++){var _0x5954dc=events[_0x4495fa];var _0x49ae26=createListener(_0x9c1b('0x5')+_0x5954dc,_0x1f62f5);ChatGroupEvents['on'](_0x5954dc,_0x49ae26);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4d87e8b..c010961 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 _0xc711=['./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','/:id/members','getMembers','getMessages','post','create','addMembers','/:id/messages','put','update','destroy','delete','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xc711,0xf4));var _0x1c71=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0xc711[_0x5d3903];return _0x4b8bc9;};'use strict';var multer=require('multer');var util=require(_0x1c71('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1c71('0x1'));var router=express[_0x1c71('0x2')]();var fs_extra=require(_0x1c71('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1c71('0x4'));var config=require(_0x1c71('0x5'));var controller=require(_0x1c71('0x6'));router[_0x1c71('0x7')]('/',auth[_0x1c71('0x8')](),controller[_0x1c71('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1c71('0xa')]);router[_0x1c71('0x7')](_0x1c71('0xb'),auth[_0x1c71('0x8')](),controller['show']);router[_0x1c71('0x7')](_0x1c71('0xc'),auth[_0x1c71('0x8')](),controller['getUnread']);router['get'](_0x1c71('0xd'),auth[_0x1c71('0x8')](),controller[_0x1c71('0xe')]);router[_0x1c71('0x7')]('/:id/messages',auth[_0x1c71('0x8')](),controller[_0x1c71('0xf')]);router[_0x1c71('0x10')]('/',auth[_0x1c71('0x8')](),controller[_0x1c71('0x11')]);router[_0x1c71('0x10')]('/:id/members',auth[_0x1c71('0x8')](),controller[_0x1c71('0x12')]);router[_0x1c71('0x10')](_0x1c71('0x13'),auth['isAuthenticated'](),controller['addMessage']);router[_0x1c71('0x14')](_0x1c71('0xb'),auth[_0x1c71('0x8')](),controller[_0x1c71('0x15')]);router['delete'](_0x1c71('0xb'),auth[_0x1c71('0x8')](),controller[_0x1c71('0x16')]);router[_0x1c71('0x17')](_0x1c71('0xd'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x1c71('0x18')]=router; \ No newline at end of file +var _0x6a13=['./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','connect-timeout','express','../../config/environment'];(function(_0x59ab49,_0x1c7ee0){var _0x29126e=function(_0x23e486){while(--_0x23e486){_0x59ab49['push'](_0x59ab49['shift']());}};_0x29126e(++_0x1c7ee0);}(_0x6a13,0x9d));var _0x36a1=function(_0x14b50e,_0x3699dc){_0x14b50e=_0x14b50e-0x0;var _0x46f7b5=_0x6a13[_0x14b50e];return _0x46f7b5;};'use strict';var multer=require(_0x36a1('0x0'));var util=require(_0x36a1('0x1'));var path=require('path');var timeout=require(_0x36a1('0x2'));var express=require(_0x36a1('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(_0x36a1('0x4'));var controller=require(_0x36a1('0x5'));router[_0x36a1('0x6')]('/',auth[_0x36a1('0x7')](),controller['index']);router['get'](_0x36a1('0x8'),auth[_0x36a1('0x7')](),controller[_0x36a1('0x9')]);router[_0x36a1('0x6')](_0x36a1('0xa'),auth[_0x36a1('0x7')](),controller[_0x36a1('0xb')]);router[_0x36a1('0x6')](_0x36a1('0xc'),auth[_0x36a1('0x7')](),controller[_0x36a1('0xd')]);router[_0x36a1('0x6')](_0x36a1('0xe'),auth['isAuthenticated'](),controller[_0x36a1('0xf')]);router[_0x36a1('0x6')](_0x36a1('0x10'),auth[_0x36a1('0x7')](),controller[_0x36a1('0x11')]);router[_0x36a1('0x12')]('/',auth[_0x36a1('0x7')](),controller['create']);router[_0x36a1('0x12')](_0x36a1('0xe'),auth[_0x36a1('0x7')](),controller[_0x36a1('0x13')]);router[_0x36a1('0x12')](_0x36a1('0x10'),auth[_0x36a1('0x7')](),controller[_0x36a1('0x14')]);router[_0x36a1('0x15')](_0x36a1('0xa'),auth[_0x36a1('0x7')](),controller[_0x36a1('0x16')]);router[_0x36a1('0x17')](_0x36a1('0xa'),auth[_0x36a1('0x7')](),controller[_0x36a1('0x18')]);router[_0x36a1('0x17')](_0x36a1('0xe'),auth[_0x36a1('0x7')](),controller[_0x36a1('0x19')]);module[_0x36a1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7ae1261..2af3545 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 _0xa877=['star','TEXT','DATE','STRING','long','ENUM','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x4df208,_0x105fd3){var _0xb19b91=function(_0x28536b){while(--_0x28536b){_0x4df208['push'](_0x4df208['shift']());}};_0xb19b91(++_0x105fd3);}(_0xa877,0x1eb));var _0x7a87=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa877[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x7a87('0x0'));module[_0x7a87('0x1')]={'closed':{'type':Sequelize[_0x7a87('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7a87('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x7a87('0x4'),'thumb'),'defaultValue':_0x7a87('0x4')},'ratingMessage':{'type':Sequelize[_0x7a87('0x5')]},'pathTranscript':{'type':Sequelize[_0x7a87('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7a87('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7a87('0x7')]},'note':{'type':Sequelize[_0x7a87('0x7')]},'browserName':{'type':Sequelize[_0x7a87('0x7')]},'browserVersion':{'type':Sequelize[_0x7a87('0x7')]},'osName':{'type':Sequelize[_0x7a87('0x7')]},'osVersion':{'type':Sequelize[_0x7a87('0x7')]},'deviceModel':{'type':Sequelize[_0x7a87('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x7a87('0x7')]},'referer':{'type':Sequelize[_0x7a87('0x5')]},'customerIp':{'type':Sequelize[_0x7a87('0x7')]},'formData':{'type':Sequelize[_0x7a87('0x5')](_0x7a87('0x8'))},'read1stAt':{'type':Sequelize[_0x7a87('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7a87('0x9')]('in',_0x7a87('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x7a87('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x7a87('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x7a87('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7a87('0x3')]}}; \ No newline at end of file +var _0xbddc=['STRING','long','DATE','out','INTEGER','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT'];(function(_0x2422a7,_0xb7752d){var _0x497f6b=function(_0x83e54f){while(--_0x83e54f){_0x2422a7['push'](_0x2422a7['shift']());}};_0x497f6b(++_0xb7752d);}(_0xbddc,0x95));var _0xcbdd=function(_0x2590bd,_0x3788d1){_0x2590bd=_0x2590bd-0x0;var _0x32324d=_0xbddc[_0x2590bd];return _0x32324d;};'use strict';var Sequelize=require(_0xcbdd('0x0'));module[_0xcbdd('0x1')]={'closed':{'type':Sequelize[_0xcbdd('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xcbdd('0x3')](_0xcbdd('0x4'),_0xcbdd('0x5')),'defaultValue':_0xcbdd('0x4')},'ratingMessage':{'type':Sequelize[_0xcbdd('0x6')]},'pathTranscript':{'type':Sequelize[_0xcbdd('0x6')]},'mailTranscript':{'type':Sequelize[_0xcbdd('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcbdd('0x7')]},'thirdDisposition':{'type':Sequelize[_0xcbdd('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xcbdd('0x7')]},'browserVersion':{'type':Sequelize[_0xcbdd('0x7')]},'osName':{'type':Sequelize[_0xcbdd('0x7')]},'osVersion':{'type':Sequelize[_0xcbdd('0x7')]},'deviceModel':{'type':Sequelize[_0xcbdd('0x7')]},'deviceVendor':{'type':Sequelize[_0xcbdd('0x7')]},'deviceType':{'type':Sequelize[_0xcbdd('0x7')]},'referer':{'type':Sequelize[_0xcbdd('0x6')]},'customerIp':{'type':Sequelize[_0xcbdd('0x7')]},'formData':{'type':Sequelize[_0xcbdd('0x6')](_0xcbdd('0x8'))},'read1stAt':{'type':Sequelize[_0xcbdd('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcbdd('0x3')]('in',_0xcbdd('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xcbdd('0x7')]},'customerPort':{'type':Sequelize[_0xcbdd('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xcbdd('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xcbdd('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xcbdd('0xb')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0c0232a..84fb6d3 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 _0x79d1=['keys','query','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','name','fullname','email','POST','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','CmContact','format','%s%d','customer','Visitor','ContactId','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','includeAgent','addTags','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','toString','files','tmp','server','attachments','transcript-%d-%s.zip','push','Contact','lastName','secret','read','Account','get','mkdirSync','N.A.','closedAt','osName','referer','customerIp','customerPort','tail','createReadStream','firstName','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','localhost','redis','./chatInteraction.socket','register','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','stack','send','render','contact','interaction','account','index','map','ChatInteraction','rawAttributes','type','getOptions','findAll','chat','user','show','params','model'];(function(_0x4f347f,_0x5ceafd){var _0x2d9bc2=function(_0x4fe4f9){while(--_0x4fe4f9){_0x4f347f['push'](_0x4f347f['shift']());}};_0x2d9bc2(++_0x5ceafd);}(_0x79d1,0x95));var _0x179d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x79d1[_0x40a045];return _0x1a687c;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x179d('0x0'));var rp=require(_0x179d('0x1'));var moment=require(_0x179d('0x2'));var BPromise=require(_0x179d('0x3'));var Mustache=require(_0x179d('0x4'));var util=require(_0x179d('0x5'));var path=require(_0x179d('0x6'));var ejs=require(_0x179d('0x7'));var fs=require('fs');var _=require(_0x179d('0x8'));var Redis=require(_0x179d('0x9'));var interaction=require(_0x179d('0xa'));var qs=require(_0x179d('0xb'));var pdf=require(_0x179d('0xc'));var logger=require(_0x179d('0xd'))(_0x179d('0xe'));var config=require('../../config/environment');var db=require(_0x179d('0xf'))['db'];config['redis']=_[_0x179d('0x10')](config['redis'],{'host':_0x179d('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x179d('0x12')]));require(_0x179d('0x13'))[_0x179d('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x179d('0x15')]({'port':0x232b});var client9004=jayson[_0x179d('0x16')][_0x179d('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x4ab090,_0x3ed0cd,_0x4929fe,_0x148456){return new BPromise(function(_0x5db82d,_0x4e1818){var _0x41932d=_0x148456||client;return _0x41932d[_0x179d('0x17')](_0x4ab090,_0x4929fe)[_0x179d('0x18')](function(_0x4c5f40){logger[_0x179d('0x19')](_0x179d('0x1a'),_0x3ed0cd,_0x179d('0x1b'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3ed0cd,_0x179d('0x1b'),JSON[_0x179d('0x1c')](_0x4c5f40));if(_0x4c5f40[_0x179d('0x1d')]){if(_0x4c5f40[_0x179d('0x1d')]['code']===0x1f4){logger[_0x179d('0x1d')](_0x179d('0x1a'),_0x3ed0cd,_0x4c5f40['error'][_0x179d('0x1e')]);return _0x4e1818(_0x4c5f40[_0x179d('0x1d')][_0x179d('0x1e')]);}logger[_0x179d('0x1d')](_0x179d('0x1a'),_0x3ed0cd,_0x4c5f40[_0x179d('0x1d')][_0x179d('0x1e')]);return _0x5db82d(_0x4c5f40[_0x179d('0x1d')][_0x179d('0x1e')]);}else{logger[_0x179d('0x19')](_0x179d('0x1a'),_0x3ed0cd,_0x179d('0x1b'));_0x5db82d(_0x4c5f40[_0x179d('0x1f')][_0x179d('0x1e')]);}})[_0x179d('0x20')](function(_0x2d1d9f){logger[_0x179d('0x1d')](_0x179d('0x1a'),_0x3ed0cd,_0x2d1d9f);_0x4e1818(_0x2d1d9f);});});}function respondWithStatusCode(_0x4c6a44,_0x54bf5f){_0x54bf5f=_0x54bf5f||0xcc;return function(_0x1eda31){if(_0x1eda31){return _0x4c6a44[_0x179d('0x21')](_0x54bf5f);}return _0x4c6a44[_0x179d('0x22')](_0x54bf5f)[_0x179d('0x23')]();};}function respondWithResult(_0x52d0de,_0x40254d){_0x40254d=_0x40254d||0xc8;return function(_0x1d64c6){if(_0x1d64c6){return _0x52d0de['status'](_0x40254d)['json'](_0x1d64c6);}};}function respondWithFilteredResult(_0x370876,_0x1bdf80){return function(_0x32d388){if(_0x32d388){var _0x17e482=typeof _0x1bdf80[_0x179d('0x24')]===_0x179d('0x25')&&typeof _0x1bdf80[_0x179d('0x26')]==='undefined';var _0x2fbbc3=_0x32d388[_0x179d('0x27')];var _0x233941=_0x17e482?0x0:_0x1bdf80[_0x179d('0x24')];var _0x548152=_0x17e482?_0x32d388[_0x179d('0x27')]:_0x1bdf80['offset']+_0x1bdf80['limit'];var _0x23b406;if(_0x548152>=_0x2fbbc3){_0x548152=_0x2fbbc3;_0x23b406=0xc8;}else{_0x23b406=0xce;}_0x370876[_0x179d('0x22')](_0x23b406);return _0x370876[_0x179d('0x28')](_0x179d('0x29'),_0x233941+'-'+_0x548152+'/'+_0x2fbbc3)[_0x179d('0x2a')](_0x32d388);}return null;};}function saveUpdates(_0x253bbb){return function(_0x38dc98){if(_0x38dc98){return _0x38dc98[_0x179d('0x2b')](_0x253bbb)['then'](function(_0x47bafb){return _0x47bafb;});}return null;};}function removeEntity(_0x57c066){return function(_0x16f3dd){if(_0x16f3dd){return _0x16f3dd[_0x179d('0x2c')]()['then'](function(){_0x57c066[_0x179d('0x22')](0xcc)[_0x179d('0x23')]();});}};}function handleEntityNotFound(_0x436f34){return function(_0x442b0a){if(!_0x442b0a){_0x436f34[_0x179d('0x21')](0x194);}return _0x442b0a;};}function handleError(_0x48962f,_0x5d1300){_0x5d1300=_0x5d1300||0x1f4;return function(_0x3ac824){logger[_0x179d('0x1d')](_0x3ac824[_0x179d('0x2d')]);if(_0x3ac824['name']){delete _0x3ac824['name'];}_0x48962f[_0x179d('0x22')](_0x5d1300)[_0x179d('0x2e')](_0x3ac824);};}function getMustacheRender(_0x1f6215,_0x126350){return Mustache[_0x179d('0x2f')](_0x1f6215,_['merge'](_0x126350['body'],{'contact':_0x126350[_0x179d('0x30')],'message':_0x126350[_0x179d('0x1e')],'agent':_0x126350['agent'],'interaction':_0x126350[_0x179d('0x31')],'account':_0x126350[_0x179d('0x32')]}))||'';}exports[_0x179d('0x33')]=function(_0x55560f,_0x334293){var _0x4de57e={};var _0x17cd1b=_[_0x179d('0x34')](db[_0x179d('0x35')][_0x179d('0x36')],function(_0x2ab330){return{'name':_0x2ab330['fieldName'],'type':_0x2ab330[_0x179d('0x37')]['key']};});_0x4de57e=qs[_0x179d('0x38')](_0x17cd1b,_0x55560f);return interaction[_0x179d('0x39')](_0x179d('0x3a'),_0x55560f['query'],_0x55560f[_0x179d('0x3b')],_0x4de57e,_0x17cd1b)[_0x179d('0x18')](respondWithFilteredResult(_0x334293,_0x4de57e))['catch'](handleError(_0x334293,null));};exports[_0x179d('0x3c')]=function(_0x48f87d,_0x392dfd){var _0x7f155a={'raw':![],'where':{'id':_0x48f87d[_0x179d('0x3d')]['id']}},_0x3161f9={};_0x3161f9[_0x179d('0x3e')]=_[_0x179d('0x3f')](db['ChatInteraction'][_0x179d('0x36')]);_0x3161f9[_0x179d('0x40')]=_[_0x179d('0x3f')](_0x48f87d[_0x179d('0x40')]);_0x3161f9[_0x179d('0x41')]=_[_0x179d('0x42')](_0x3161f9['model'],_0x3161f9['query']);_0x7f155a[_0x179d('0x43')]=_['intersection'](_0x3161f9[_0x179d('0x3e')],qs[_0x179d('0x44')](_0x48f87d[_0x179d('0x40')][_0x179d('0x44')]));_0x7f155a[_0x179d('0x43')]=_0x7f155a[_0x179d('0x43')][_0x179d('0x45')]?_0x7f155a[_0x179d('0x43')]:_0x3161f9['model'];if(_0x48f87d[_0x179d('0x40')][_0x179d('0x46')]){_0x7f155a['include']=[{'all':!![]}];}_0x7f155a=_[_0x179d('0x47')]({},_0x7f155a,_0x48f87d['options']);return db[_0x179d('0x35')][_0x179d('0x48')](_0x7f155a)['then'](handleEntityNotFound(_0x392dfd,null))[_0x179d('0x18')](respondWithResult(_0x392dfd,null))[_0x179d('0x20')](handleError(_0x392dfd,null));};exports['create']=function(_0x2c299e,_0x1d1877){return db['ChatInteraction'][_0x179d('0x49')](_0x2c299e['body'],{})['then'](respondWithResult(_0x1d1877,0xc9))['catch'](handleError(_0x1d1877,null));};exports['update']=function(_0x7d4784,_0x1e93bf){if(_0x7d4784['body']['id']){delete _0x7d4784[_0x179d('0x4a')]['id'];}return db['ChatInteraction'][_0x179d('0x48')]({'where':{'id':_0x7d4784[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x1e93bf,null))[_0x179d('0x18')](saveUpdates(_0x7d4784[_0x179d('0x4a')],null))[_0x179d('0x18')](respondWithResult(_0x1e93bf,null))[_0x179d('0x20')](handleError(_0x1e93bf,null));};exports[_0x179d('0x2c')]=function(_0x3d8ddf,_0x2477c2){return db[_0x179d('0x35')][_0x179d('0x48')]({'where':{'id':_0x3d8ddf['params']['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x2477c2,null))[_0x179d('0x18')](removeEntity(_0x2477c2,null))[_0x179d('0x20')](handleError(_0x2477c2,null));};exports[_0x179d('0x4b')]=function(_0x1a38b7,_0x4dfb0c){return db[_0x179d('0x35')]['describe']()[_0x179d('0x18')](respondWithResult(_0x4dfb0c,null))[_0x179d('0x20')](handleError(_0x4dfb0c,null));};exports[_0x179d('0x4c')]=function(_0x53e17e,_0x501632){var _0x498a04=_0x53e17e[_0x179d('0x3d')]['id'];var _0x5478b2;var _0x208c87;var _0x4d9763;return db[_0x179d('0x35')][_0x179d('0x4d')]({'where':{'id':_0x498a04}})[_0x179d('0x18')](function(_0xdeec2){_0x5478b2=_0xdeec2;return db[_0x179d('0x4e')]['findOne']({'where':{'id':_0xdeec2['ChatWebsiteId']},'attributes':['id',_0x179d('0x4f'),_0x179d('0x50'),_0x179d('0x51'),_0x179d('0x52'),_0x179d('0x53')],'raw':!![]});})[_0x179d('0x18')](function(_0xdf0bb9){if(_0xdf0bb9&&_0xdf0bb9[_0x179d('0x4f')]&&_0xdf0bb9['vidaooEscalation']){_0x208c87=_0xdf0bb9;var _0xb39726={'interaction':{'id':_0x498a04},'agent':{'id':_0x53e17e['user']['id'],'name':_0x53e17e[_0x179d('0x3b')][_0x179d('0x54')],'fullname':_0x53e17e[_0x179d('0x3b')][_0x179d('0x55')],'email':_0x53e17e['user'][_0x179d('0x56')]},'contact':_0x53e17e[_0x179d('0x4a')][_0x179d('0x30')],'account':_0x53e17e[_0x179d('0x4a')][_0x179d('0x32')]};var _0x279873={'rejectUnauthorized':![],'method':_0x179d('0x57'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0xdf0bb9[_0x179d('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53e17e[_0x179d('0x3b')]['email']],'buttons':null,'topic':_0x208c87[_0x179d('0x51')],'note':_[_0x179d('0x58')](_0x208c87[_0x179d('0x52')])?null:getMustacheRender(_0x208c87['vidaooNote'],_0xb39726),'metadata':null},'redirect':_0x179d('0x59'),'json':!![]};try{if(!_[_0x179d('0x58')](_0x208c87[_0x179d('0x53')])){var _0x5d4700=getMustacheRender(_0x208c87[_0x179d('0x53')],_0xb39726);var _0x58988d=JSON[_0x179d('0x5a')](_0x5d4700);_0x279873['body'][_0x179d('0x5b')]=_0x58988d;}}catch(_0x53d4c4){throw new db[(_0x179d('0x5c'))][(_0x179d('0x5d'))](_0x179d('0x5e'));}return rp(_0x279873);}else{throw new db[(_0x179d('0x5c'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x179d('0x18')](function(_0x4ec484){_0x4d9763=_0x4ec484;if(_0x4d9763['id']){var _0xe4c9b4={'body':_0x4d9763[_0x179d('0x5f')],'ChatWebsiteId':_0x208c87['id'],'ChatInteractionId':_0x5478b2['id'],'direction':_0x179d('0x60'),'UserId':_0x53e17e[_0x179d('0x3b')]['id']};return db[_0x179d('0x61')][_0x179d('0x49')](_0xe4c9b4,{});}else{throw new db[(_0x179d('0x5c'))][(_0x179d('0x5d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x5478b2[_0x179d('0x62')]({'vidaooSessionId':_0x4d9763['id']});})[_0x179d('0x18')](respondWithResult(_0x501632,null))[_0x179d('0x20')](handleError(_0x501632,null));};exports[_0x179d('0x63')]=function(_0x7eb1b3,_0xb3e2e9){if(_0x7eb1b3[_0x179d('0x4a')]['id']){delete _0x7eb1b3['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x7eb1b3[_0x179d('0x3d')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x179d('0x18')](handleEntityNotFound(_0xb3e2e9,null))[_0x179d('0x18')](saveUpdates(_0x7eb1b3[_0x179d('0x4a')],null))[_0x179d('0x18')](respondWithResult(_0xb3e2e9,null))['catch'](handleError(_0xb3e2e9,null));};exports[_0x179d('0x64')]=function(_0x2d4e3c,_0x3dad4f){if(_0x2d4e3c[_0x179d('0x4a')]['id']){delete _0x2d4e3c[_0x179d('0x4a')]['id'];}return db[_0x179d('0x35')][_0x179d('0x48')]({'where':{'id':_0x2d4e3c['params']['id']}})[_0x179d('0x18')](function(_0x45af23){if(!_0x45af23){logger[_0x179d('0x1d')](_0x179d('0x65'),_0x179d('0x64'),0x194,_0x179d('0x66'));_0x3dad4f[_0x179d('0x21')](0x194);}else{if(_0x45af23[_0x179d('0x67')]){throw new db[(_0x179d('0x5c'))][(_0x179d('0x5d'))](_0x179d('0x68'));}}return _0x45af23;})[_0x179d('0x18')](function(_0x145fd0){if(_0x145fd0){return _0x145fd0[_0x179d('0x2b')]({'closed':_0x2d4e3c['body'][_0x179d('0x69')],'disposition':_0x2d4e3c[_0x179d('0x4a')][_0x179d('0x6a')]})[_0x179d('0x18')](function(_0xcb0f84){return _0xcb0f84;});}})[_0x179d('0x18')](function(){return respondWithRpcPromise(_0x179d('0x6b'),_0x179d('0x64'),_0x2d4e3c[_0x179d('0x4a')],client9004);})['then'](respondWithResult(_0x3dad4f,null))['catch'](handleError(_0x3dad4f,null));};exports[_0x179d('0x6c')]=function(_0x2cfe0a,_0x3bde1a){_0x2cfe0a['body'][_0x179d('0x54')]=_0x2cfe0a[_0x179d('0x6d')][_0x179d('0x6e')];_0x2cfe0a[_0x179d('0x4a')][_0x179d('0x6f')]=_0x2cfe0a['file']['filename'];_0x2cfe0a[_0x179d('0x4a')][_0x179d('0x37')]=_0x2cfe0a[_0x179d('0x6d')][_0x179d('0x70')];return db[_0x179d('0x71')][_0x179d('0x49')](_0x2cfe0a[_0x179d('0x4a')])[_0x179d('0x18')](respondWithResult(_0x3bde1a,0xc9))[_0x179d('0x20')](handleError(_0x3bde1a,null));};exports[_0x179d('0x72')]=function(_0x55090b,_0x32a08d){return db['ChatInteraction'][_0x179d('0x4d')]({'where':{'id':_0x55090b[_0x179d('0x3d')]['id']},'raw':!![]})[_0x179d('0x18')](handleEntityNotFound(_0x32a08d,null))[_0x179d('0x18')](function(_0x3e2c76){if(_0x3e2c76){if(_0x3e2c76[_0x179d('0x69')]){return _0x32a08d['status'](0x193)[_0x179d('0x2a')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x179d('0x4d')]({'where':{'id':_0x55090b[_0x179d('0x40')][_0x179d('0x73')]},'raw':!![]})['then'](handleEntityNotFound(_0x32a08d,null));}})['then'](function(_0x2b7feb){if(_0x2b7feb){var _0x5b75b3=_0x2b7feb[_0x179d('0x74')]!==null;var _0x31a5bd=path[_0x179d('0x75')](config[_0x179d('0x76')],_0x179d('0x77'));if(_0x5b75b3){_0x31a5bd=path[_0x179d('0x75')](_0x31a5bd,_0x179d('0x78'));}var _0x50a3aa=path[_0x179d('0x75')](_0x31a5bd,_0x2b7feb[_0x179d('0x6f')]);return _0x32a08d[_0x179d('0x79')](_0x50a3aa);}})[_0x179d('0x20')](handleError(_0x32a08d,null));};exports[_0x179d('0x7a')]=function(_0x1284d7,_0x16be90){var _0x3cb1ce=null;var _0x512949=null;var _0x1cd08b=null;if(_0x1284d7[_0x179d('0x4a')]['id']){delete _0x1284d7[_0x179d('0x4a')]['id'];}if(_0x1284d7[_0x179d('0x4a')][_0x179d('0x7b')]){_0x1cd08b=path['join'](config[_0x179d('0x76')],_0x179d('0x7c'),util['format'](_0x179d('0x7d'),Date[_0x179d('0x7e')]()));_0x1284d7[_0x179d('0x4a')][_0x179d('0x7f')]=_0x1cd08b;}return db['ChatInteraction'][_0x179d('0x48')]({'where':{'id':_0x1284d7['params']['id']},'include':[{'model':db[_0x179d('0x61')],'as':_0x179d('0x80'),'include':[{'model':db['User'],'as':_0x179d('0x81')}]}]})[_0x179d('0x18')](handleEntityNotFound(_0x16be90,null))[_0x179d('0x18')](saveUpdates(_0x1284d7[_0x179d('0x4a')],null))[_0x179d('0x18')](function(_0x41311f){if(_0x41311f){_0x3cb1ce=_0x41311f;return db[_0x179d('0x4e')][_0x179d('0x48')]({'where':{'id':_0x3cb1ce[_0x179d('0x82')]}});}})[_0x179d('0x18')](function(_0xfc09d){if(_0xfc09d){_0x512949=_0xfc09d;return db[_0x179d('0x83')][_0x179d('0x48')]({'where':{'id':_0x3cb1ce['ContactId']}});}})[_0x179d('0x18')](function(_0xadd2b6){if(_0xadd2b6){if(_0x1cd08b){var _0x5acc89=null;for(var _0x464062=0x1;_0x464062<_0x3cb1ce[_0x179d('0x80')]['length'];++_0x464062){_0x5acc89=_0x3cb1ce[_0x179d('0x80')][_0x464062];var _0x128a9f=_0x5acc89['UserId']?util[_0x179d('0x84')](_0x179d('0x85'),_0x512949['agentAlias'],_0x5acc89[_0x179d('0x67')]):'System';var _0x30787d=_0x1284d7[_0x179d('0x4a')][_0x179d('0x86')]||util['format']('%s%d',_0x179d('0x87'),_0x5acc89[_0x179d('0x88')]);switch(_0x512949[_0x179d('0x89')]){case _0x179d('0x8a'):_0x128a9f=_0x5acc89['UserId']?util[_0x179d('0x84')](_0x179d('0x85'),_0x512949[_0x179d('0x8b')],_0x5acc89['UserId']):_0x179d('0x8c');break;case _0x179d('0x8d'):_0x128a9f=_0x5acc89['UserId']?_0x5acc89[_0x179d('0x81')][_0x179d('0x8e')]||_0x5acc89[_0x179d('0x81')][_0x179d('0x55')]:_0x179d('0x8c');break;case'agent_fullname':_0x128a9f=_0x5acc89['UserId']?_0x5acc89['User']['fullname']:_0x179d('0x8c');break;default:_0x128a9f=_0x5acc89['UserId']?util[_0x179d('0x84')](_0x179d('0x85'),_0x512949[_0x179d('0x8b')],_0x5acc89['UserId']):_0x179d('0x8c');}var _0x1a6a0c=util[_0x179d('0x84')](_0x179d('0x8f'),moment(_0x5acc89[_0x179d('0x90')])[_0x179d('0x84')](_0x179d('0x91')),_0x5acc89[_0x179d('0x92')]==='in'?_0x30787d:_0x128a9f,_0x5acc89['body']);if(!_0x5acc89['secret']){fs[_0x179d('0x93')](_0x1cd08b,_0x1a6a0c);}}return db['MailAccount'][_0x179d('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x179d('0x94')],'as':_0x179d('0x95'),'raw':!![],'include':[{'model':db[_0x179d('0x96')],'as':_0x179d('0x96'),'raw':!![]}]}]});}}})[_0x179d('0x18')](function(_0xded189){if(!_0xded189||!_0xded189[_0x179d('0x95')]||!_0x1284d7[_0x179d('0x4a')])return _0x3cb1ce;var _0x154b9d=_0xded189['getSmtpOptions']();return respondWithRpcPromise(_0x179d('0x97'),_0x179d('0x98'),{'account':_0x154b9d,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0xded189['name'],_0xded189['email']||_0xded189[_0x179d('0x95')][_0x179d('0x3b')]),'to':_0x1284d7['body']['mailTranscript'],'subject':_0x179d('0x99'),'text':util['format'](_0x179d('0x9a'),_0x1284d7[_0x179d('0x4a')][_0x179d('0x7b')]),'attachments':[{'path':_0x1cd08b}]}})[_0x179d('0x18')](function(){return _0x3cb1ce;})[_0x179d('0x20')](function(_0x64cf54){logger[_0x179d('0x1d')](_0x64cf54);});})[_0x179d('0x18')](respondWithStatusCode(_0x16be90,0xc8))[_0x179d('0x20')](handleError(_0x16be90,null));};exports[_0x179d('0x9b')]=function(_0x2656fa,_0x21dcc4){return db[_0x179d('0x61')][_0x179d('0x48')]({'where':{'id':_0x2656fa[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x21dcc4,null))[_0x179d('0x18')](function(_0x312bac){if(_0x312bac){return _0x312bac[_0x179d('0x9b')](_0x2656fa['body'][_0x179d('0x9c')],_['omit'](_0x2656fa[_0x179d('0x4a')],[_0x179d('0x9c'),'id'])||{});}})[_0x179d('0x18')](respondWithResult(_0x21dcc4,null))[_0x179d('0x20')](handleError(_0x21dcc4,null));};exports[_0x179d('0x9d')]=function(_0x2376e3,_0x38d39c){var _0x24c53c={'raw':![],'where':{}};var _0x4c4de3={};var _0x2c61ac={'count':0x0,'rows':[]};return db[_0x179d('0x35')][_0x179d('0x4d')]({'where':{'id':_0x2376e3[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x38d39c,null))['then'](function(_0x199af7){if(_0x199af7){_0x4c4de3['model']=_[_0x179d('0x3f')](db[_0x179d('0x61')]['rawAttributes']);_0x4c4de3[_0x179d('0x40')]=_['keys'](_0x2376e3[_0x179d('0x40')]);_0x4c4de3['filters']=_[_0x179d('0x42')](_0x4c4de3[_0x179d('0x3e')],_0x4c4de3[_0x179d('0x40')]);_0x24c53c[_0x179d('0x43')]=_[_0x179d('0x42')](_0x4c4de3['model'],qs[_0x179d('0x44')](_0x2376e3['query'][_0x179d('0x44')]));_0x24c53c[_0x179d('0x43')]=_0x24c53c[_0x179d('0x43')][_0x179d('0x45')]?_0x24c53c[_0x179d('0x43')]:_0x4c4de3[_0x179d('0x3e')];if(!_0x2376e3[_0x179d('0x40')][_0x179d('0x9e')]('nolimit')){_0x24c53c[_0x179d('0x26')]=qs[_0x179d('0x26')](_0x2376e3['query'][_0x179d('0x26')]);_0x24c53c[_0x179d('0x24')]=qs[_0x179d('0x24')](_0x2376e3[_0x179d('0x40')][_0x179d('0x24')]);}_0x24c53c[_0x179d('0x9f')]=qs['sort'](_0x2376e3[_0x179d('0x40')][_0x179d('0xa0')]);_0x24c53c[_0x179d('0xa1')]=qs[_0x179d('0x41')](_[_0x179d('0xa2')](_0x2376e3[_0x179d('0x40')],_0x4c4de3[_0x179d('0x41')]));_0x24c53c['where'][_0x179d('0xa3')]=_0x199af7['id'];if(_0x2376e3['query']['filter']){_0x24c53c[_0x179d('0xa1')]=_['merge'](_0x24c53c[_0x179d('0xa1')],{'$or':_['map'](_0x24c53c[_0x179d('0x43')],function(_0x48ffab){var _0x54fa28={};_0x54fa28[_0x48ffab]={'$like':'%'+_0x2376e3[_0x179d('0x40')][_0x179d('0xa4')]+'%'};return _0x54fa28;})});}if(_0x2376e3[_0x179d('0x40')][_0x179d('0xa5')]){var _0x1e227a=_0x2376e3[_0x179d('0x40')]['$gte']['split'](',');var _0x2d57dc={};_0x2d57dc[_0x1e227a[0x0]]={'$gte':moment(_0x1e227a[0x1])['format'](_0x179d('0xa6'))};_0x24c53c['where']=_[_0x179d('0x47')](_0x24c53c[_0x179d('0xa1')],_0x2d57dc);}_0x24c53c=_['merge']({},_0x24c53c,_0x2376e3[_0x179d('0xa7')]);return db[_0x179d('0x61')][_0x179d('0x27')]({'where':_0x24c53c[_0x179d('0xa1')]})[_0x179d('0x18')](function(_0x56d9ad){_0x2c61ac[_0x179d('0x27')]=_0x56d9ad;if(_0x2376e3[_0x179d('0x40')][_0x179d('0x46')]){_0x24c53c[_0x179d('0xa8')]=[{'all':!![]}];}return db['ChatMessage'][_0x179d('0x39')](_0x24c53c);})[_0x179d('0x18')](function(_0x44f1ca){_0x2c61ac[_0x179d('0xa9')]=_0x44f1ca;return _0x2c61ac;});}})['then'](respondWithFilteredResult(_0x38d39c,_0x24c53c))['catch'](handleError(_0x38d39c,null));};exports[_0x179d('0xaa')]=function(_0xcc7547,_0x4d6d48){var _0x5a40b6={'where':{}},_0x5c08e2={},_0x50398f={'count':0x0,'rows':[]};return db[_0x179d('0x35')][_0x179d('0x4d')]({'where':{'id':_0xcc7547[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x4d6d48,null))[_0x179d('0x18')](function(_0x4a0765){if(_0x4a0765){_0x5c08e2['model']=_[_0x179d('0x3f')](db[_0x179d('0x61')]['rawAttributes']);_0x5c08e2[_0x179d('0x40')]=_[_0x179d('0x3f')](_0xcc7547[_0x179d('0x40')]);_0x5c08e2[_0x179d('0x41')]=_['intersection'](_0x5c08e2[_0x179d('0x3e')],_0x5c08e2[_0x179d('0x40')]);_0x5a40b6[_0x179d('0x43')]=_[_0x179d('0x42')](_0x5c08e2[_0x179d('0x3e')],qs[_0x179d('0x44')](_0xcc7547[_0x179d('0x40')][_0x179d('0x44')]));_0x5a40b6[_0x179d('0x43')]=_0x5a40b6[_0x179d('0x43')][_0x179d('0x45')]?_0x5a40b6['attributes']:_0x5c08e2[_0x179d('0x3e')];if(!_0xcc7547[_0x179d('0x40')]['hasOwnProperty']('nolimit')){_0x5a40b6['limit']=qs['limit'](_0xcc7547[_0x179d('0x40')][_0x179d('0x26')]);_0x5a40b6[_0x179d('0x24')]=qs[_0x179d('0x24')](_0xcc7547[_0x179d('0x40')][_0x179d('0x24')]);}_0x5a40b6[_0x179d('0x9f')]=qs['sort'](_0xcc7547[_0x179d('0x40')]['sort']);_0x5a40b6['where']=qs['filters'](_['pick'](_0xcc7547['query'],_0x5c08e2[_0x179d('0x41')]));_0x5a40b6['where']['ChatInteractionId']=_0x4a0765['id'];if(_0xcc7547[_0x179d('0x40')]['filter']){_0x5a40b6[_0x179d('0xa1')]=_[_0x179d('0x47')](_0x5a40b6[_0x179d('0xa1')],{'$or':_['map'](_0x5a40b6['attributes'],function(_0x1db3ef){var _0x49163b={};_0x49163b[_0x1db3ef]={'$like':'%'+_0xcc7547[_0x179d('0x40')]['filter']+'%'};return _0x49163b;})});}_0x5a40b6['where']['secret']=![];if(_0xcc7547['query']['id']){_0x5a40b6[_0x179d('0xa1')]['id']={'$gt':_0xcc7547[_0x179d('0x40')]['id']};}_0x5a40b6=_[_0x179d('0x47')]({},_0x5a40b6,_0xcc7547[_0x179d('0xa7')]);return db[_0x179d('0x61')][_0x179d('0x27')]({'where':_0x5a40b6[_0x179d('0xa1')]})[_0x179d('0x18')](function(_0x283d02){_0x50398f[_0x179d('0x27')]=_0x283d02;_0x5a40b6[_0x179d('0xa8')]=[];if(_0xcc7547[_0x179d('0x40')][_0x179d('0xab')]){_0x5a40b6[_0x179d('0xa8')]['push']({'model':db[_0x179d('0x81')],'as':_0x179d('0x81'),'attributes':['id',_0x179d('0x55'),'alias']});}if(_0xcc7547[_0x179d('0x40')][_0x179d('0x46')]){_0x5a40b6[_0x179d('0xa8')]=[{'all':!![]}];}return db['ChatMessage'][_0x179d('0x39')](_0x5a40b6);})['then'](function(_0x1772f7){_0x50398f[_0x179d('0xa9')]=_0x1772f7;return _0x50398f;});}})['then'](respondWithFilteredResult(_0x4d6d48,_0x5a40b6))['catch'](handleError(_0x4d6d48,null));};exports[_0x179d('0xac')]=function(_0x54613f,_0x4bc042){return db[_0x179d('0x35')][_0x179d('0x48')]({'where':{'id':_0x54613f[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x4bc042,null))['then'](function(_0x275367){if(_0x275367){return _0x275367[_0x179d('0xad')](_0x54613f['body'][_0x179d('0x9c')],_[_0x179d('0xae')](_0x54613f[_0x179d('0x4a')],[_0x179d('0x9c'),'id'])||{})[_0x179d('0xaf')](function(){return db[_0x179d('0xb0')][_0x179d('0x39')]({'attributes':['id',_0x179d('0x54'),_0x179d('0xb1')],'where':{'id':_0x54613f[_0x179d('0x4a')]['ids']}});})[_0x179d('0x18')](function(_0x2bbe91){socket[_0x179d('0xb2')](_0x179d('0xb3'),{'id':Number(_0x54613f[_0x179d('0x3d')]['id']),'tags':_0x2bbe91||[]});return{'id':Number(_0x54613f[_0x179d('0x3d')]['id']),'tags':_0x2bbe91||[]};});}})['then'](respondWithResult(_0x4bc042,null))[_0x179d('0x20')](handleError(_0x4bc042,null));};exports[_0x179d('0xb4')]=function(_0x1c7d2d,_0x4535da){return db[_0x179d('0x35')][_0x179d('0x48')]({'where':{'id':_0x1c7d2d[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x4535da,null))[_0x179d('0x18')](function(_0xfa30d1){if(_0xfa30d1){return _0xfa30d1[_0x179d('0xb4')](_0x1c7d2d[_0x179d('0x40')][_0x179d('0x9c')]);}})[_0x179d('0x18')](respondWithStatusCode(_0x4535da,null))[_0x179d('0x20')](handleError(_0x4535da,null));};exports['download']=function(_0x56d444,_0x3cd251){var _0x34fa3d=moment()['unix']()[_0x179d('0xb5')]();var _0x24fcc4=path['join'](config['root'],'server',_0x179d('0xb6'),_0x179d('0xb7'));var _0x345b8f=path['join'](config[_0x179d('0x76')],_0x179d('0xb8'),_0x179d('0xb6'),_0x179d('0xb9'));var _0x24c255=path[_0x179d('0x75')](_0x24fcc4,_0x34fa3d);var _0x176858=util[_0x179d('0x84')](_0x179d('0xba'),_0x56d444['params']['id'],_0x34fa3d);var _0x5848f8=path[_0x179d('0x75')](_0x24fcc4,_0x176858);var _0x5b7291=[];_0x5b7291[_0x179d('0xbb')]({'model':db['User'],'as':_0x179d('0x81'),'attributes':['id','fullname'],'raw':!![]});_0x5b7291[_0x179d('0xbb')]({'model':db[_0x179d('0x83')],'as':_0x179d('0xbc'),'attributes':['id','firstName',_0x179d('0xbd')],'raw':!![]});if(_0x56d444[_0x179d('0x40')][_0x179d('0xb9')]){_0x5b7291[_0x179d('0xbb')]({'model':db[_0x179d('0x71')],'as':'Attachment','raw':!![]});}var _0x5e908c=[{'model':db[_0x179d('0x61')],'as':_0x179d('0x80'),'attributes':['id','body',_0x179d('0x90'),_0x179d('0x92'),_0x179d('0xbe'),_0x179d('0xbf')],'include':_0x5b7291}];_0x5e908c[_0x179d('0xbb')]({'model':db[_0x179d('0x4e')],'as':_0x179d('0xc0'),'attributes':['id',_0x179d('0x54')]});_0x5e908c[_0x179d('0xbb')]({'model':db[_0x179d('0x81')],'as':'Owner','attributes':['id',_0x179d('0x55')]});return db['ChatInteraction'][_0x179d('0x48')]({'where':{'id':_0x56d444[_0x179d('0x3d')]['id']},'include':_0x5e908c})[_0x179d('0x18')](handleEntityNotFound(_0x3cd251,null))[_0x179d('0x18')](function(_0x4d08c6){if(_0x4d08c6){var _0x5e6a26=_0x4d08c6[_0x179d('0xc1')]({'plain':!![]});fs[_0x179d('0xc2')](_0x24c255);var _0x58d60a={'channel':'Chat','account':_0x5e6a26[_0x179d('0xc0')][_0x179d('0x54')],'agent':_0x5e6a26['Owner']?_0x5e6a26['Owner'][_0x179d('0x55')]:_0x179d('0xc3'),'createdAt':moment(_0x5e6a26['createdAt'])['format'](_0x179d('0xa6'))[_0x179d('0xb5')](),'closedAt':_0x5e6a26[_0x179d('0x69')]?moment(_0x5e6a26[_0x179d('0xc4')])[_0x179d('0x84')](_0x179d('0xa6'))[_0x179d('0xb5')]():'','disposition':_0x5e6a26[_0x179d('0x6a')],'chatInfo':{'browser':_0x5e6a26['browserName'],'os':_0x5e6a26[_0x179d('0xc5')],'referer':_0x5e6a26[_0x179d('0xc6')],'customerIp':_0x5e6a26[_0x179d('0xc7')],'customerPort':_0x5e6a26[_0x179d('0xc8')]?_0x5e6a26[_0x179d('0xc8')]:'N.A.'},'messages':_(_0x5e6a26[_0x179d('0x80')])[_0x179d('0xc9')]()[_0x179d('0xa4')]({'secret':![]})[_0x179d('0x34')](function(_0x1fcc8d){if(_0x1fcc8d[_0x179d('0x71')]){var _0x3b4b63=path[_0x179d('0x75')](_0x345b8f,_0x1fcc8d['Attachment'][_0x179d('0x6f')]);if(fs['existsSync'](_0x3b4b63)){fs[_0x179d('0xca')](_0x3b4b63)['pipe'](fs['createWriteStream'](path['join'](_0x24c255,_0x1fcc8d[_0x179d('0x71')]['basename'])));}}return{'date':moment(_0x1fcc8d['createdAt'])[_0x179d('0x84')]('YYYY-MM-DD\x20HH:mm:ss')[_0x179d('0xb5')](),'sender':_0x1fcc8d[_0x179d('0x92')]===_0x179d('0x60')?_0x1fcc8d[_0x179d('0x81')]?_0x1fcc8d[_0x179d('0x81')]['fullname']:'System':_0x1fcc8d['Contact'][_0x179d('0xcb')]+(_0x1fcc8d[_0x179d('0xbc')][_0x179d('0xbd')]?'\x20'+_0x1fcc8d[_0x179d('0xbc')][_0x179d('0xbd')]:''),'body':_0x1fcc8d[_0x179d('0x71')]?_0x1fcc8d[_0x179d('0x71')]['basename']:_0x1fcc8d[_0x179d('0x4a')],'direction':_0x1fcc8d['direction']==='out'?'A':'C','secret':_0x1fcc8d['secret'],'read':_0x1fcc8d[_0x179d('0xbf')],'attachment':_0x1fcc8d[_0x179d('0x71')]};})[_0x179d('0xcc')]()};return ejs[_0x179d('0xcd')](path[_0x179d('0x75')](config['root'],'server',_0x179d('0xce'),'downloadInteraction.ejs'),{'interaction':_0x58d60a})[_0x179d('0x18')](function(_0x31ef4b){var _0x1ce2d6=path[_0x179d('0x75')](_0x24c255,_0x179d('0xcf')+_0x5e6a26['id']+'-'+_0x34fa3d+_0x179d('0xd0'));var _0x3b60c3={'path':_0x1ce2d6,'channel':'Chat','interactionId':_0x5e6a26['id']};return pdf[_0x179d('0xd1')](_0x31ef4b,_0x3b60c3);})[_0x179d('0x18')](function(){return new Promise(function(_0x27bfcf,_0x457978){zipdir(_0x24c255,{'saveTo':_0x5848f8},function(_0x35aac7,_0x2f1feb){if(_0x35aac7)return _0x457978(_0x35aac7);return _0x27bfcf(_0x2f1feb);});})['then'](function(){return new BPromise(function(_0x5a39f9,_0x135683){rimraf(_0x24c255,function(_0x14e269){if(_0x14e269)_0x135683(_0x14e269);return _0x5a39f9();});});})[_0x179d('0x18')](function(){return _0x3cd251['download'](_0x5848f8,_0x176858,function(_0x15244e){if(_0x15244e){logger[_0x179d('0x1d')](_0x179d('0xd2'),_0x15244e);}else{fs[_0x179d('0xd3')](_0x5848f8);}});});});}else{return _0x3cd251['sendStatus'](0xc8);}})[_0x179d('0x20')](handleError(_0x3cd251,null));}; \ No newline at end of file +var _0x18e1=['createdAt','read','Account','get','mkdirSync','Owner','N.A.','toString','closedAt','disposition','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','update','destroy','name','render','merge','body','contact','agent','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','keys','rawAttributes','filters','intersection','attributes','model','fields','length','includeAll','include','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','originalname','basename','filename','file','attachmentDownload','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','format','transcript-%s.txt','now','Messages','User','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','getMessages','hasOwnProperty','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','getMyMessages','nolimit','order','options','includeAgent','push','rows','addTags','setTags','ids','spread','color','emit','removeTags','unix','server','tmp','files','attachments','firstName','lastName'];(function(_0x4d2583,_0x52bd89){var _0x57fa3a=function(_0x3ad39c){while(--_0x3ad39c){_0x4d2583['push'](_0x4d2583['shift']());}};_0x57fa3a(++_0x52bd89);}(_0x18e1,0xeb));var _0x118e=function(_0x1f6098,_0x1e728c){_0x1f6098=_0x1f6098-0x0;var _0x38b312=_0x18e1[_0x1f6098];return _0x38b312;};'use strict';var rimraf=require(_0x118e('0x0'));var zipdir=require(_0x118e('0x1'));var rp=require(_0x118e('0x2'));var moment=require(_0x118e('0x3'));var BPromise=require(_0x118e('0x4'));var Mustache=require(_0x118e('0x5'));var util=require(_0x118e('0x6'));var path=require(_0x118e('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x118e('0x8'));var Redis=require(_0x118e('0x9'));var interaction=require(_0x118e('0xa'));var qs=require(_0x118e('0xb'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x118e('0xc'));var config=require(_0x118e('0xd'));var db=require(_0x118e('0xe'))['db'];config[_0x118e('0xf')]=_[_0x118e('0x10')](config[_0x118e('0xf')],{'host':_0x118e('0x11'),'port':0x18eb});var socket=require(_0x118e('0x12'))(new Redis(config[_0x118e('0xf')]));require(_0x118e('0x13'))[_0x118e('0x14')](socket);var jayson=require(_0x118e('0x15'));var client=jayson[_0x118e('0x16')][_0x118e('0x17')]({'port':0x232b});var client9004=jayson[_0x118e('0x16')][_0x118e('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x1e5602,_0x3b6469,_0x230d5f,_0x2de3a4){return new BPromise(function(_0x5cb63f,_0x4188c4){var _0x288bc7=_0x2de3a4||client;return _0x288bc7['request'](_0x1e5602,_0x230d5f)[_0x118e('0x18')](function(_0x57f34d){logger[_0x118e('0x19')](_0x118e('0x1a'),_0x3b6469,_0x118e('0x1b'));logger[_0x118e('0x1c')](_0x118e('0x1d'),_0x3b6469,'request\x20sent',JSON[_0x118e('0x1e')](_0x57f34d));if(_0x57f34d[_0x118e('0x1f')]){if(_0x57f34d[_0x118e('0x1f')][_0x118e('0x20')]===0x1f4){logger['error'](_0x118e('0x1a'),_0x3b6469,_0x57f34d[_0x118e('0x1f')][_0x118e('0x21')]);return _0x4188c4(_0x57f34d[_0x118e('0x1f')][_0x118e('0x21')]);}logger[_0x118e('0x1f')](_0x118e('0x1a'),_0x3b6469,_0x57f34d[_0x118e('0x1f')][_0x118e('0x21')]);return _0x5cb63f(_0x57f34d[_0x118e('0x1f')]['message']);}else{logger[_0x118e('0x19')](_0x118e('0x1a'),_0x3b6469,'request\x20sent');_0x5cb63f(_0x57f34d[_0x118e('0x22')][_0x118e('0x21')]);}})[_0x118e('0x23')](function(_0x316ccb){logger[_0x118e('0x1f')](_0x118e('0x1a'),_0x3b6469,_0x316ccb);_0x4188c4(_0x316ccb);});});}function respondWithStatusCode(_0x254b9e,_0x4d68c8){_0x4d68c8=_0x4d68c8||0xcc;return function(_0x197fea){if(_0x197fea){return _0x254b9e[_0x118e('0x24')](_0x4d68c8);}return _0x254b9e['status'](_0x4d68c8)[_0x118e('0x25')]();};}function respondWithResult(_0x494fc4,_0x5b6bea){_0x5b6bea=_0x5b6bea||0xc8;return function(_0x2aaf5d){if(_0x2aaf5d){return _0x494fc4[_0x118e('0x26')](_0x5b6bea)[_0x118e('0x27')](_0x2aaf5d);}};}function respondWithFilteredResult(_0xf4e21d,_0x5ab80e){return function(_0x26a244){if(_0x26a244){var _0x40d181=typeof _0x5ab80e[_0x118e('0x28')]===_0x118e('0x29')&&typeof _0x5ab80e['limit']===_0x118e('0x29');var _0xb6eebd=_0x26a244['count'];var _0x253603=_0x40d181?0x0:_0x5ab80e[_0x118e('0x28')];var _0x5bd687=_0x40d181?_0x26a244['count']:_0x5ab80e['offset']+_0x5ab80e[_0x118e('0x2a')];var _0xeba19d;if(_0x5bd687>=_0xb6eebd){_0x5bd687=_0xb6eebd;_0xeba19d=0xc8;}else{_0xeba19d=0xce;}_0xf4e21d['status'](_0xeba19d);return _0xf4e21d[_0x118e('0x2b')]('Content-Range',_0x253603+'-'+_0x5bd687+'/'+_0xb6eebd)[_0x118e('0x27')](_0x26a244);}return null;};}function saveUpdates(_0x5d2473){return function(_0x514a7a){if(_0x514a7a){return _0x514a7a[_0x118e('0x2c')](_0x5d2473)['then'](function(_0xcf1e0d){return _0xcf1e0d;});}return null;};}function removeEntity(_0xe2e91a){return function(_0x443372){if(_0x443372){return _0x443372[_0x118e('0x2d')]()['then'](function(){_0xe2e91a['status'](0xcc)[_0x118e('0x25')]();});}};}function handleEntityNotFound(_0x815c61){return function(_0x561337){if(!_0x561337){_0x815c61[_0x118e('0x24')](0x194);}return _0x561337;};}function handleError(_0x3a0488,_0x212e87){_0x212e87=_0x212e87||0x1f4;return function(_0x349632){logger[_0x118e('0x1f')](_0x349632['stack']);if(_0x349632[_0x118e('0x2e')]){delete _0x349632['name'];}_0x3a0488['status'](_0x212e87)['send'](_0x349632);};}function getMustacheRender(_0x376689,_0x38f646){return Mustache[_0x118e('0x2f')](_0x376689,_[_0x118e('0x30')](_0x38f646[_0x118e('0x31')],{'contact':_0x38f646[_0x118e('0x32')],'message':_0x38f646[_0x118e('0x21')],'agent':_0x38f646[_0x118e('0x33')],'interaction':_0x38f646['interaction'],'account':_0x38f646[_0x118e('0x34')]}))||'';}exports[_0x118e('0x35')]=function(_0x4d3237,_0xe3f1c6){var _0x46bbeb={};var _0x154a9b=_[_0x118e('0x36')](db[_0x118e('0x37')]['rawAttributes'],function(_0x31c338){return{'name':_0x31c338[_0x118e('0x38')],'type':_0x31c338[_0x118e('0x39')][_0x118e('0x3a')]};});_0x46bbeb=qs[_0x118e('0x3b')](_0x154a9b,_0x4d3237);return interaction[_0x118e('0x3c')](_0x118e('0x3d'),_0x4d3237[_0x118e('0x3e')],_0x4d3237[_0x118e('0x3f')],_0x46bbeb,_0x154a9b)[_0x118e('0x18')](respondWithFilteredResult(_0xe3f1c6,_0x46bbeb))[_0x118e('0x23')](handleError(_0xe3f1c6,null));};exports[_0x118e('0x40')]=function(_0x29c7e8,_0x503d76){var _0x26c597={'raw':![],'where':{'id':_0x29c7e8[_0x118e('0x41')]['id']}},_0x3b4e9d={};_0x3b4e9d['model']=_[_0x118e('0x42')](db['ChatInteraction'][_0x118e('0x43')]);_0x3b4e9d['query']=_[_0x118e('0x42')](_0x29c7e8[_0x118e('0x3e')]);_0x3b4e9d[_0x118e('0x44')]=_[_0x118e('0x45')](_0x3b4e9d['model'],_0x3b4e9d[_0x118e('0x3e')]);_0x26c597[_0x118e('0x46')]=_[_0x118e('0x45')](_0x3b4e9d[_0x118e('0x47')],qs[_0x118e('0x48')](_0x29c7e8[_0x118e('0x3e')]['fields']));_0x26c597['attributes']=_0x26c597[_0x118e('0x46')][_0x118e('0x49')]?_0x26c597['attributes']:_0x3b4e9d[_0x118e('0x47')];if(_0x29c7e8['query'][_0x118e('0x4a')]){_0x26c597[_0x118e('0x4b')]=[{'all':!![]}];}_0x26c597=_[_0x118e('0x30')]({},_0x26c597,_0x29c7e8['options']);return db[_0x118e('0x37')][_0x118e('0x4c')](_0x26c597)[_0x118e('0x18')](handleEntityNotFound(_0x503d76,null))[_0x118e('0x18')](respondWithResult(_0x503d76,null))[_0x118e('0x23')](handleError(_0x503d76,null));};exports[_0x118e('0x4d')]=function(_0x120d53,_0x2d028c){return db[_0x118e('0x37')][_0x118e('0x4d')](_0x120d53[_0x118e('0x31')],{})['then'](respondWithResult(_0x2d028c,0xc9))[_0x118e('0x23')](handleError(_0x2d028c,null));};exports[_0x118e('0x2c')]=function(_0x3542dd,_0xd28e30){if(_0x3542dd['body']['id']){delete _0x3542dd[_0x118e('0x31')]['id'];}return db['ChatInteraction'][_0x118e('0x4c')]({'where':{'id':_0x3542dd['params']['id']}})[_0x118e('0x18')](handleEntityNotFound(_0xd28e30,null))['then'](saveUpdates(_0x3542dd[_0x118e('0x31')],null))[_0x118e('0x18')](respondWithResult(_0xd28e30,null))[_0x118e('0x23')](handleError(_0xd28e30,null));};exports[_0x118e('0x2d')]=function(_0x43b4b9,_0x4c1db9){return db[_0x118e('0x37')][_0x118e('0x4c')]({'where':{'id':_0x43b4b9[_0x118e('0x41')]['id']}})[_0x118e('0x18')](handleEntityNotFound(_0x4c1db9,null))[_0x118e('0x18')](removeEntity(_0x4c1db9,null))[_0x118e('0x23')](handleError(_0x4c1db9,null));};exports[_0x118e('0x4e')]=function(_0xa9a291,_0x48dc95){return db[_0x118e('0x37')][_0x118e('0x4e')]()['then'](respondWithResult(_0x48dc95,null))['catch'](handleError(_0x48dc95,null));};exports[_0x118e('0x4f')]=function(_0x56434b,_0x3cc84b){var _0x300bb3=_0x56434b[_0x118e('0x41')]['id'];var _0xa14a39;var _0x38b569;var _0x32205a;return db['ChatInteraction'][_0x118e('0x50')]({'where':{'id':_0x300bb3}})[_0x118e('0x18')](function(_0xf1f8a5){_0xa14a39=_0xf1f8a5;return db[_0x118e('0x51')][_0x118e('0x50')]({'where':{'id':_0xf1f8a5[_0x118e('0x52')]},'attributes':['id',_0x118e('0x53'),_0x118e('0x54'),_0x118e('0x55'),_0x118e('0x56'),'vidaooMetadata'],'raw':!![]});})[_0x118e('0x18')](function(_0x4e7798){if(_0x4e7798&&_0x4e7798[_0x118e('0x53')]&&_0x4e7798[_0x118e('0x54')]){_0x38b569=_0x4e7798;var _0x201266={'interaction':{'id':_0x300bb3},'agent':{'id':_0x56434b[_0x118e('0x3f')]['id'],'name':_0x56434b[_0x118e('0x3f')][_0x118e('0x2e')],'fullname':_0x56434b[_0x118e('0x3f')]['fullname'],'email':_0x56434b[_0x118e('0x3f')][_0x118e('0x57')]},'contact':_0x56434b[_0x118e('0x31')][_0x118e('0x32')],'account':_0x56434b['body'][_0x118e('0x34')]};var _0x24e57b={'rejectUnauthorized':![],'method':_0x118e('0x58'),'url':_0x118e('0x59'),'headers':{'X-APIKEY':_0x4e7798['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x56434b['user'][_0x118e('0x57')]],'buttons':null,'topic':_0x38b569[_0x118e('0x55')],'note':_[_0x118e('0x5a')](_0x38b569[_0x118e('0x56')])?null:getMustacheRender(_0x38b569[_0x118e('0x56')],_0x201266),'metadata':null},'redirect':_0x118e('0x5b'),'json':!![]};try{if(!_[_0x118e('0x5a')](_0x38b569[_0x118e('0x5c')])){var _0x1bfbe1=getMustacheRender(_0x38b569[_0x118e('0x5c')],_0x201266);var _0x1170d3=JSON['parse'](_0x1bfbe1);_0x24e57b[_0x118e('0x31')]['metadata']=_0x1170d3;}}catch(_0x575f6d){throw new db[(_0x118e('0x5d'))][(_0x118e('0x5e'))](_0x118e('0x5f'));}return rp(_0x24e57b);}else{throw new db[(_0x118e('0x5d'))][(_0x118e('0x5e'))](_0x118e('0x60'));}})[_0x118e('0x18')](function(_0x132930){_0x32205a=_0x132930;if(_0x32205a['id']){var _0x18605e={'body':_0x32205a[_0x118e('0x61')],'ChatWebsiteId':_0x38b569['id'],'ChatInteractionId':_0xa14a39['id'],'direction':'out','UserId':_0x56434b[_0x118e('0x3f')]['id']};return db[_0x118e('0x62')][_0x118e('0x4d')](_0x18605e,{});}else{throw new db['Sequelize']['ValidationError'](_0x118e('0x63'));}})['then'](function(){return _0xa14a39['updateAttributes']({'vidaooSessionId':_0x32205a['id']});})['then'](respondWithResult(_0x3cc84b,null))[_0x118e('0x23')](handleError(_0x3cc84b,null));};exports['customUpdate']=function(_0x107a2f,_0x5df194){if(_0x107a2f[_0x118e('0x31')]['id']){delete _0x107a2f[_0x118e('0x31')]['id'];}return db['ChatInteraction'][_0x118e('0x4c')]({'where':{'id':_0x107a2f[_0x118e('0x41')]['id']},'include':[{'model':db[_0x118e('0x64')],'as':_0x118e('0x65')}]})[_0x118e('0x18')](handleEntityNotFound(_0x5df194,null))[_0x118e('0x18')](saveUpdates(_0x107a2f['body'],null))['then'](respondWithResult(_0x5df194,null))[_0x118e('0x23')](handleError(_0x5df194,null));};exports[_0x118e('0x66')]=function(_0x464112,_0x17723c){if(_0x464112[_0x118e('0x31')]['id']){delete _0x464112[_0x118e('0x31')]['id'];}return db[_0x118e('0x37')]['find']({'where':{'id':_0x464112[_0x118e('0x41')]['id']}})[_0x118e('0x18')](function(_0x4b36f3){if(!_0x4b36f3){logger[_0x118e('0x1f')](_0x118e('0x67'),_0x118e('0x66'),0x194,_0x118e('0x68'));_0x17723c[_0x118e('0x24')](0x194);}else{if(_0x4b36f3[_0x118e('0x69')]){throw new db[(_0x118e('0x5d'))][(_0x118e('0x5e'))](_0x118e('0x6a'));}}return _0x4b36f3;})[_0x118e('0x18')](function(_0x3c832a){if(_0x3c832a){return _0x3c832a[_0x118e('0x2c')]({'closed':_0x464112['body'][_0x118e('0x6b')],'disposition':_0x464112['body']['disposition']})[_0x118e('0x18')](function(_0x50b6f3){return _0x50b6f3;});}})[_0x118e('0x18')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x464112[_0x118e('0x31')],client9004);})['then'](respondWithResult(_0x17723c,null))['catch'](handleError(_0x17723c,null));};exports['attachmentUpload']=function(_0x5a6a1c,_0x13b50c){_0x5a6a1c['body'][_0x118e('0x2e')]=_0x5a6a1c['file'][_0x118e('0x6c')];_0x5a6a1c['body'][_0x118e('0x6d')]=_0x5a6a1c['file'][_0x118e('0x6e')];_0x5a6a1c['body'][_0x118e('0x39')]=_0x5a6a1c[_0x118e('0x6f')]['mimetype'];return db['Attachment'][_0x118e('0x4d')](_0x5a6a1c[_0x118e('0x31')])[_0x118e('0x18')](respondWithResult(_0x13b50c,0xc9))[_0x118e('0x23')](handleError(_0x13b50c,null));};exports[_0x118e('0x70')]=function(_0x3e0d63,_0x2b8ee4){return db['ChatInteraction'][_0x118e('0x50')]({'where':{'id':_0x3e0d63[_0x118e('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2b8ee4,null))[_0x118e('0x18')](function(_0x24ef3f){if(_0x24ef3f){if(_0x24ef3f[_0x118e('0x6b')]){return _0x2b8ee4[_0x118e('0x26')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x118e('0x71')][_0x118e('0x50')]({'where':{'id':_0x3e0d63[_0x118e('0x3e')][_0x118e('0x72')]},'raw':!![]})['then'](handleEntityNotFound(_0x2b8ee4,null));}})['then'](function(_0x337f9c){if(_0x337f9c){var _0x4adadb=_0x337f9c[_0x118e('0x73')]!==null;var _0x2afb01=path[_0x118e('0x74')](config[_0x118e('0x75')],_0x118e('0x76'));if(_0x4adadb){_0x2afb01=path[_0x118e('0x74')](_0x2afb01,'offline-chat/');}var _0x4e41e0=path[_0x118e('0x74')](_0x2afb01,_0x337f9c[_0x118e('0x6d')]);return _0x2b8ee4[_0x118e('0x77')](_0x4e41e0);}})[_0x118e('0x23')](handleError(_0x2b8ee4,null));};exports[_0x118e('0x78')]=function(_0x47239c,_0x2a295a){var _0x4527ea=null;var _0x1a6942=null;var _0x28f110=null;if(_0x47239c[_0x118e('0x31')]['id']){delete _0x47239c[_0x118e('0x31')]['id'];}if(_0x47239c[_0x118e('0x31')][_0x118e('0x79')]){_0x28f110=path['join'](config[_0x118e('0x75')],'server/files/chat/upload/',util[_0x118e('0x7a')](_0x118e('0x7b'),Date[_0x118e('0x7c')]()));_0x47239c[_0x118e('0x31')]['pathTranscript']=_0x28f110;}return db[_0x118e('0x37')][_0x118e('0x4c')]({'where':{'id':_0x47239c[_0x118e('0x41')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x118e('0x7d'),'include':[{'model':db[_0x118e('0x7e')],'as':'User'}]}]})[_0x118e('0x18')](handleEntityNotFound(_0x2a295a,null))[_0x118e('0x18')](saveUpdates(_0x47239c[_0x118e('0x31')],null))[_0x118e('0x18')](function(_0x3cf9bf){if(_0x3cf9bf){_0x4527ea=_0x3cf9bf;return db[_0x118e('0x51')][_0x118e('0x4c')]({'where':{'id':_0x4527ea['ChatWebsiteId']}});}})[_0x118e('0x18')](function(_0x272870){if(_0x272870){_0x1a6942=_0x272870;return db[_0x118e('0x64')][_0x118e('0x4c')]({'where':{'id':_0x4527ea[_0x118e('0x7f')]}});}})[_0x118e('0x18')](function(_0x4502c6){if(_0x4502c6){if(_0x28f110){var _0xb124c8=null;for(var _0x173c01=0x1;_0x173c01<_0x4527ea[_0x118e('0x7d')][_0x118e('0x49')];++_0x173c01){_0xb124c8=_0x4527ea[_0x118e('0x7d')][_0x173c01];var _0x4445df=_0xb124c8['UserId']?util[_0x118e('0x7a')](_0x118e('0x80'),_0x1a6942[_0x118e('0x81')],_0xb124c8[_0x118e('0x69')]):_0x118e('0x82');var _0x2012b6=_0x47239c[_0x118e('0x31')][_0x118e('0x83')]||util[_0x118e('0x7a')](_0x118e('0x80'),_0x118e('0x84'),_0xb124c8[_0x118e('0x7f')]);switch(_0x1a6942[_0x118e('0x85')]){case'website_alias':_0x4445df=_0xb124c8[_0x118e('0x69')]?util[_0x118e('0x7a')](_0x118e('0x80'),_0x1a6942[_0x118e('0x81')],_0xb124c8[_0x118e('0x69')]):_0x118e('0x82');break;case _0x118e('0x86'):_0x4445df=_0xb124c8[_0x118e('0x69')]?_0xb124c8['User'][_0x118e('0x87')]||_0xb124c8[_0x118e('0x7e')][_0x118e('0x88')]:_0x118e('0x82');break;case _0x118e('0x89'):_0x4445df=_0xb124c8[_0x118e('0x69')]?_0xb124c8[_0x118e('0x7e')]['fullname']:_0x118e('0x82');break;default:_0x4445df=_0xb124c8['UserId']?util[_0x118e('0x7a')](_0x118e('0x80'),_0x1a6942['agentAlias'],_0xb124c8[_0x118e('0x69')]):'System';}var _0x2ca480=util[_0x118e('0x7a')](_0x118e('0x8a'),moment(_0xb124c8['createdAt'])[_0x118e('0x7a')](_0x118e('0x8b')),_0xb124c8[_0x118e('0x8c')]==='in'?_0x2012b6:_0x4445df,_0xb124c8[_0x118e('0x31')]);if(!_0xb124c8[_0x118e('0x8d')]){fs[_0x118e('0x8e')](_0x28f110,_0x2ca480);}}return db[_0x118e('0x8f')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x118e('0x90')],'as':_0x118e('0x91'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x118e('0x92'),'raw':!![]}]}]});}}})[_0x118e('0x18')](function(_0x439a19){if(!_0x439a19||!_0x439a19[_0x118e('0x91')]||!_0x47239c['body'])return _0x4527ea;var _0xb84c44=_0x439a19[_0x118e('0x93')]();return respondWithRpcPromise(_0x118e('0x94'),_0x118e('0x95'),{'account':_0xb84c44,'message':{'from':util[_0x118e('0x7a')](_0x118e('0x96'),_0x439a19['name'],_0x439a19[_0x118e('0x57')]||_0x439a19[_0x118e('0x91')]['user']),'to':_0x47239c[_0x118e('0x31')][_0x118e('0x79')],'subject':_0x118e('0x97'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x47239c[_0x118e('0x31')][_0x118e('0x79')]),'attachments':[{'path':_0x28f110}]}})[_0x118e('0x18')](function(){return _0x4527ea;})[_0x118e('0x23')](function(_0x4f84ce){logger['error'](_0x4f84ce);});})['then'](respondWithStatusCode(_0x2a295a,0xc8))[_0x118e('0x23')](handleError(_0x2a295a,null));};exports['addMessage']=function(_0x3ca254,_0xca5b6d){return db[_0x118e('0x62')][_0x118e('0x4c')]({'where':{'id':_0x3ca254[_0x118e('0x41')]['id']}})[_0x118e('0x18')](handleEntityNotFound(_0xca5b6d,null))['then'](function(_0x1c5e89){if(_0x1c5e89){return _0x1c5e89['addMessage'](_0x3ca254[_0x118e('0x31')]['ids'],_['omit'](_0x3ca254[_0x118e('0x31')],['ids','id'])||{});}})[_0x118e('0x18')](respondWithResult(_0xca5b6d,null))[_0x118e('0x23')](handleError(_0xca5b6d,null));};exports[_0x118e('0x98')]=function(_0x3afe9e,_0x427273){var _0x3eeaf6={'raw':![],'where':{}};var _0x539a24={};var _0x5bc107={'count':0x0,'rows':[]};return db[_0x118e('0x37')][_0x118e('0x50')]({'where':{'id':_0x3afe9e[_0x118e('0x41')]['id']}})[_0x118e('0x18')](handleEntityNotFound(_0x427273,null))[_0x118e('0x18')](function(_0x47cdf8){if(_0x47cdf8){_0x539a24[_0x118e('0x47')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x539a24[_0x118e('0x3e')]=_[_0x118e('0x42')](_0x3afe9e['query']);_0x539a24[_0x118e('0x44')]=_['intersection'](_0x539a24[_0x118e('0x47')],_0x539a24['query']);_0x3eeaf6[_0x118e('0x46')]=_[_0x118e('0x45')](_0x539a24[_0x118e('0x47')],qs['fields'](_0x3afe9e[_0x118e('0x3e')][_0x118e('0x48')]));_0x3eeaf6[_0x118e('0x46')]=_0x3eeaf6['attributes'][_0x118e('0x49')]?_0x3eeaf6[_0x118e('0x46')]:_0x539a24[_0x118e('0x47')];if(!_0x3afe9e[_0x118e('0x3e')][_0x118e('0x99')]('nolimit')){_0x3eeaf6[_0x118e('0x2a')]=qs[_0x118e('0x2a')](_0x3afe9e['query']['limit']);_0x3eeaf6[_0x118e('0x28')]=qs[_0x118e('0x28')](_0x3afe9e[_0x118e('0x3e')][_0x118e('0x28')]);}_0x3eeaf6['order']=qs[_0x118e('0x9a')](_0x3afe9e[_0x118e('0x3e')][_0x118e('0x9a')]);_0x3eeaf6['where']=qs[_0x118e('0x44')](_['pick'](_0x3afe9e[_0x118e('0x3e')],_0x539a24[_0x118e('0x44')]));_0x3eeaf6[_0x118e('0x9b')][_0x118e('0x9c')]=_0x47cdf8['id'];if(_0x3afe9e['query'][_0x118e('0x9d')]){_0x3eeaf6[_0x118e('0x9b')]=_[_0x118e('0x30')](_0x3eeaf6[_0x118e('0x9b')],{'$or':_[_0x118e('0x36')](_0x3eeaf6[_0x118e('0x46')],function(_0x5b7a68){var _0x54d900={};_0x54d900[_0x5b7a68]={'$like':'%'+_0x3afe9e[_0x118e('0x3e')]['filter']+'%'};return _0x54d900;})});}if(_0x3afe9e[_0x118e('0x3e')][_0x118e('0x9e')]){var _0x55fe5c=_0x3afe9e[_0x118e('0x3e')][_0x118e('0x9e')][_0x118e('0x9f')](',');var _0x27227d={};_0x27227d[_0x55fe5c[0x0]]={'$gte':moment(_0x55fe5c[0x1])[_0x118e('0x7a')](_0x118e('0xa0'))};_0x3eeaf6['where']=_['merge'](_0x3eeaf6[_0x118e('0x9b')],_0x27227d);}_0x3eeaf6=_['merge']({},_0x3eeaf6,_0x3afe9e['options']);return db['ChatMessage'][_0x118e('0xa1')]({'where':_0x3eeaf6[_0x118e('0x9b')]})[_0x118e('0x18')](function(_0x11364e){_0x5bc107[_0x118e('0xa1')]=_0x11364e;if(_0x3afe9e[_0x118e('0x3e')][_0x118e('0x4a')]){_0x3eeaf6['include']=[{'all':!![]}];}return db[_0x118e('0x62')][_0x118e('0x3c')](_0x3eeaf6);})[_0x118e('0x18')](function(_0x32cf60){_0x5bc107['rows']=_0x32cf60;return _0x5bc107;});}})[_0x118e('0x18')](respondWithFilteredResult(_0x427273,_0x3eeaf6))[_0x118e('0x23')](handleError(_0x427273,null));};exports[_0x118e('0xa2')]=function(_0x47b787,_0x3ea8fe){var _0x36023f={'where':{}},_0x22c60d={},_0x2dfe9a={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x118e('0x50')]({'where':{'id':_0x47b787[_0x118e('0x41')]['id']}})[_0x118e('0x18')](handleEntityNotFound(_0x3ea8fe,null))[_0x118e('0x18')](function(_0x53feb5){if(_0x53feb5){_0x22c60d[_0x118e('0x47')]=_[_0x118e('0x42')](db[_0x118e('0x62')][_0x118e('0x43')]);_0x22c60d[_0x118e('0x3e')]=_[_0x118e('0x42')](_0x47b787[_0x118e('0x3e')]);_0x22c60d[_0x118e('0x44')]=_[_0x118e('0x45')](_0x22c60d[_0x118e('0x47')],_0x22c60d['query']);_0x36023f['attributes']=_['intersection'](_0x22c60d[_0x118e('0x47')],qs['fields'](_0x47b787[_0x118e('0x3e')][_0x118e('0x48')]));_0x36023f['attributes']=_0x36023f['attributes'][_0x118e('0x49')]?_0x36023f[_0x118e('0x46')]:_0x22c60d[_0x118e('0x47')];if(!_0x47b787[_0x118e('0x3e')][_0x118e('0x99')](_0x118e('0xa3'))){_0x36023f[_0x118e('0x2a')]=qs['limit'](_0x47b787[_0x118e('0x3e')][_0x118e('0x2a')]);_0x36023f[_0x118e('0x28')]=qs['offset'](_0x47b787[_0x118e('0x3e')][_0x118e('0x28')]);}_0x36023f[_0x118e('0xa4')]=qs[_0x118e('0x9a')](_0x47b787['query']['sort']);_0x36023f[_0x118e('0x9b')]=qs[_0x118e('0x44')](_['pick'](_0x47b787[_0x118e('0x3e')],_0x22c60d[_0x118e('0x44')]));_0x36023f[_0x118e('0x9b')][_0x118e('0x9c')]=_0x53feb5['id'];if(_0x47b787[_0x118e('0x3e')][_0x118e('0x9d')]){_0x36023f['where']=_[_0x118e('0x30')](_0x36023f[_0x118e('0x9b')],{'$or':_[_0x118e('0x36')](_0x36023f[_0x118e('0x46')],function(_0x15aede){var _0x4d6af5={};_0x4d6af5[_0x15aede]={'$like':'%'+_0x47b787[_0x118e('0x3e')]['filter']+'%'};return _0x4d6af5;})});}_0x36023f[_0x118e('0x9b')][_0x118e('0x8d')]=![];if(_0x47b787[_0x118e('0x3e')]['id']){_0x36023f[_0x118e('0x9b')]['id']={'$gt':_0x47b787[_0x118e('0x3e')]['id']};}_0x36023f=_[_0x118e('0x30')]({},_0x36023f,_0x47b787[_0x118e('0xa5')]);return db[_0x118e('0x62')][_0x118e('0xa1')]({'where':_0x36023f[_0x118e('0x9b')]})[_0x118e('0x18')](function(_0x21349f){_0x2dfe9a[_0x118e('0xa1')]=_0x21349f;_0x36023f[_0x118e('0x4b')]=[];if(_0x47b787['query'][_0x118e('0xa6')]){_0x36023f[_0x118e('0x4b')][_0x118e('0xa7')]({'model':db[_0x118e('0x7e')],'as':_0x118e('0x7e'),'attributes':['id',_0x118e('0x88'),_0x118e('0x87')]});}if(_0x47b787[_0x118e('0x3e')]['includeAll']){_0x36023f[_0x118e('0x4b')]=[{'all':!![]}];}return db[_0x118e('0x62')]['findAll'](_0x36023f);})['then'](function(_0x321232){_0x2dfe9a[_0x118e('0xa8')]=_0x321232;return _0x2dfe9a;});}})['then'](respondWithFilteredResult(_0x3ea8fe,_0x36023f))[_0x118e('0x23')](handleError(_0x3ea8fe,null));};exports[_0x118e('0xa9')]=function(_0x41c534,_0x11393c){return db[_0x118e('0x37')][_0x118e('0x4c')]({'where':{'id':_0x41c534[_0x118e('0x41')]['id']}})[_0x118e('0x18')](handleEntityNotFound(_0x11393c,null))[_0x118e('0x18')](function(_0xdc7543){if(_0xdc7543){return _0xdc7543[_0x118e('0xaa')](_0x41c534[_0x118e('0x31')][_0x118e('0xab')],_['omit'](_0x41c534[_0x118e('0x31')],[_0x118e('0xab'),'id'])||{})[_0x118e('0xac')](function(){return db['Tag'][_0x118e('0x3c')]({'attributes':['id','name',_0x118e('0xad')],'where':{'id':_0x41c534[_0x118e('0x31')][_0x118e('0xab')]}});})['then'](function(_0x5ec4c3){socket[_0x118e('0xae')]('chatInteractionTags:save',{'id':Number(_0x41c534[_0x118e('0x41')]['id']),'tags':_0x5ec4c3||[]});return{'id':Number(_0x41c534['params']['id']),'tags':_0x5ec4c3||[]};});}})['then'](respondWithResult(_0x11393c,null))[_0x118e('0x23')](handleError(_0x11393c,null));};exports[_0x118e('0xaf')]=function(_0x372a5f,_0x1a1c1d){return db['ChatInteraction'][_0x118e('0x4c')]({'where':{'id':_0x372a5f[_0x118e('0x41')]['id']}})[_0x118e('0x18')](handleEntityNotFound(_0x1a1c1d,null))[_0x118e('0x18')](function(_0x5111ef){if(_0x5111ef){return _0x5111ef['removeTags'](_0x372a5f['query'][_0x118e('0xab')]);}})[_0x118e('0x18')](respondWithStatusCode(_0x1a1c1d,null))[_0x118e('0x23')](handleError(_0x1a1c1d,null));};exports[_0x118e('0x77')]=function(_0x113b83,_0xf60927){var _0x259711=moment()[_0x118e('0xb0')]()['toString']();var _0x5c86c0=path[_0x118e('0x74')](config['root'],_0x118e('0xb1'),'files',_0x118e('0xb2'));var _0x469fc9=path[_0x118e('0x74')](config['root'],'server',_0x118e('0xb3'),_0x118e('0xb4'));var _0x4de8e0=path['join'](_0x5c86c0,_0x259711);var _0x3eff07=util[_0x118e('0x7a')]('transcript-%d-%s.zip',_0x113b83[_0x118e('0x41')]['id'],_0x259711);var _0x3422fc=path['join'](_0x5c86c0,_0x3eff07);var _0x35daca=[];_0x35daca['push']({'model':db[_0x118e('0x7e')],'as':_0x118e('0x7e'),'attributes':['id',_0x118e('0x88')],'raw':!![]});_0x35daca[_0x118e('0xa7')]({'model':db[_0x118e('0x64')],'as':_0x118e('0x65'),'attributes':['id',_0x118e('0xb5'),_0x118e('0xb6')],'raw':!![]});if(_0x113b83[_0x118e('0x3e')]['attachments']){_0x35daca[_0x118e('0xa7')]({'model':db['Attachment'],'as':_0x118e('0x71'),'raw':!![]});}var _0x24dcad=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x118e('0x31'),_0x118e('0xb7'),'direction',_0x118e('0x8d'),_0x118e('0xb8')],'include':_0x35daca}];_0x24dcad[_0x118e('0xa7')]({'model':db[_0x118e('0x51')],'as':_0x118e('0xb9'),'attributes':['id',_0x118e('0x2e')]});_0x24dcad[_0x118e('0xa7')]({'model':db[_0x118e('0x7e')],'as':'Owner','attributes':['id',_0x118e('0x88')]});return db['ChatInteraction']['find']({'where':{'id':_0x113b83[_0x118e('0x41')]['id']},'include':_0x24dcad})[_0x118e('0x18')](handleEntityNotFound(_0xf60927,null))[_0x118e('0x18')](function(_0x31ec7c){if(_0x31ec7c){var _0xb56544=_0x31ec7c[_0x118e('0xba')]({'plain':!![]});fs[_0x118e('0xbb')](_0x4de8e0);var _0x50fa69={'channel':'Chat','account':_0xb56544[_0x118e('0xb9')][_0x118e('0x2e')],'agent':_0xb56544[_0x118e('0xbc')]?_0xb56544[_0x118e('0xbc')]['fullname']:_0x118e('0xbd'),'createdAt':moment(_0xb56544['createdAt'])['format'](_0x118e('0xa0'))[_0x118e('0xbe')](),'closedAt':_0xb56544['closed']?moment(_0xb56544[_0x118e('0xbf')])[_0x118e('0x7a')](_0x118e('0xa0'))['toString']():'','disposition':_0xb56544[_0x118e('0xc0')],'chatInfo':{'browser':_0xb56544[_0x118e('0xc1')],'os':_0xb56544[_0x118e('0xc2')],'referer':_0xb56544['referer'],'customerIp':_0xb56544[_0x118e('0xc3')],'customerPort':_0xb56544[_0x118e('0xc4')]?_0xb56544[_0x118e('0xc4')]:_0x118e('0xbd')},'messages':_(_0xb56544['Messages'])[_0x118e('0xc5')]()['filter']({'secret':![]})[_0x118e('0x36')](function(_0x1c7a1e){if(_0x1c7a1e[_0x118e('0x71')]){var _0x48fa34=path[_0x118e('0x74')](_0x469fc9,_0x1c7a1e['Attachment'][_0x118e('0x6d')]);if(fs[_0x118e('0xc6')](_0x48fa34)){fs[_0x118e('0xc7')](_0x48fa34)[_0x118e('0xc8')](fs[_0x118e('0xc9')](path[_0x118e('0x74')](_0x4de8e0,_0x1c7a1e[_0x118e('0x71')][_0x118e('0x6d')])));}}return{'date':moment(_0x1c7a1e[_0x118e('0xb7')])['format'](_0x118e('0xa0'))[_0x118e('0xbe')](),'sender':_0x1c7a1e[_0x118e('0x8c')]===_0x118e('0xca')?_0x1c7a1e[_0x118e('0x7e')]?_0x1c7a1e[_0x118e('0x7e')][_0x118e('0x88')]:_0x118e('0x82'):_0x1c7a1e[_0x118e('0x65')][_0x118e('0xb5')]+(_0x1c7a1e['Contact'][_0x118e('0xb6')]?'\x20'+_0x1c7a1e[_0x118e('0x65')][_0x118e('0xb6')]:''),'body':_0x1c7a1e[_0x118e('0x71')]?_0x1c7a1e['Attachment']['basename']:_0x1c7a1e[_0x118e('0x31')],'direction':_0x1c7a1e[_0x118e('0x8c')]===_0x118e('0xca')?'A':'C','secret':_0x1c7a1e[_0x118e('0x8d')],'read':_0x1c7a1e[_0x118e('0xb8')],'attachment':_0x1c7a1e[_0x118e('0x71')]};})['value']()};return ejs['renderFile'](path[_0x118e('0x74')](config[_0x118e('0x75')],_0x118e('0xb1'),_0x118e('0xcb'),_0x118e('0xcc')),{'interaction':_0x50fa69})['then'](function(_0x2fb1ac){var _0x146594=path[_0x118e('0x74')](_0x4de8e0,_0x118e('0xcd')+_0xb56544['id']+'-'+_0x259711+_0x118e('0xce'));var _0x1a7c47={'path':_0x146594,'channel':'Chat','interactionId':_0xb56544['id']};return pdf['createPdfFromHTML'](_0x2fb1ac,_0x1a7c47);})[_0x118e('0x18')](function(){return new Promise(function(_0x5dc2a8,_0x2fcddb){zipdir(_0x4de8e0,{'saveTo':_0x3422fc},function(_0x46202e,_0x30da53){if(_0x46202e)return _0x2fcddb(_0x46202e);return _0x5dc2a8(_0x30da53);});})[_0x118e('0x18')](function(){return new BPromise(function(_0x4831d2,_0x457d44){rimraf(_0x4de8e0,function(_0x20e612){if(_0x20e612)_0x457d44(_0x20e612);return _0x4831d2();});});})[_0x118e('0x18')](function(){return _0xf60927[_0x118e('0x77')](_0x3422fc,_0x3eff07,function(_0x47f649){if(_0x47f649){logger['error'](_0x118e('0xcf'),_0x47f649);}else{fs[_0x118e('0xd0')](_0x3422fc);}});});});}else{return _0xf60927[_0x118e('0x24')](0xc8);}})[_0x118e('0x23')](handleError(_0xf60927,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9a338b5..6a45421 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 _0x7bf4=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','exports','../../mysqldb','ChatInteraction','setMaxListeners','save','remove'];(function(_0x25e486,_0x5b72c9){var _0x4ac677=function(_0x450fd0){while(--_0x450fd0){_0x25e486['push'](_0x25e486['shift']());}};_0x4ac677(++_0x5b72c9);}(_0x7bf4,0x15b));var _0x47bf=function(_0x34e362,_0x397343){_0x34e362=_0x34e362-0x0;var _0x4142a8=_0x7bf4[_0x34e362];return _0x4142a8;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x47bf('0x0'))['db'][_0x47bf('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x47bf('0x2')](0x0);var events={'afterCreate':_0x47bf('0x3'),'afterUpdate':'update','afterDestroy':_0x47bf('0x4')};function emitEvent(_0x381039){return function(_0x453e2c,_0x2cf806,_0x593fc2){_0x453e2c[_0x47bf('0x5')]({'attributes':['id'],'raw':!![]})[_0x47bf('0x6')](function(_0x2708fe){_0x453e2c[_0x47bf('0x7')](_0x47bf('0x8'),_0x2708fe[_0x47bf('0x9')](function(_0x2b7f21){return{'id':_0x2b7f21['id']};}));return ChatMessage[_0x47bf('0xa')]({'where':{'ChatInteractionId':_0x453e2c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x47bf('0x6')](function(_0x5bbc30){_0x453e2c[_0x47bf('0x7')](_0x47bf('0xb'),_0x5bbc30['length']);ChatInteractionEvents['emit'](_0x381039+':'+_0x453e2c['id'],_0x453e2c);ChatInteractionEvents[_0x47bf('0xc')](_0x381039,_0x453e2c);_0x593fc2(null);})[_0x47bf('0xd')](_0x593fc2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x47bf('0xe')](e,emitEvent(event));}}module[_0x47bf('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xed3f=['save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xed3f,0xb7));var _0xfed3=function(_0x10dc20,_0x53b0ca){_0x10dc20=_0x10dc20-0x0;var _0x45c996=_0xed3f[_0x10dc20];return _0x45c996;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xfed3('0x0'))['db'][_0xfed3('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0xfed3('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfed3('0x3')](0x0);var events={'afterCreate':_0xfed3('0x4'),'afterUpdate':_0xfed3('0x5'),'afterDestroy':_0xfed3('0x6')};function emitEvent(_0x325566){return function(_0x9dcd8e,_0x4ea9a6,_0x1d56b1){_0x9dcd8e['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5f46b8){_0x9dcd8e[_0xfed3('0x7')](_0xfed3('0x8'),_0x5f46b8[_0xfed3('0x9')](function(_0x327c80){return{'id':_0x327c80['id']};}));return ChatMessage[_0xfed3('0xa')]({'where':{'ChatInteractionId':_0x9dcd8e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfed3('0xb')](function(_0x5db6de){_0x9dcd8e[_0xfed3('0x7')](_0xfed3('0xc'),_0x5db6de[_0xfed3('0xd')]);ChatInteractionEvents['emit'](_0x325566+':'+_0x9dcd8e['id'],_0x9dcd8e);ChatInteractionEvents['emit'](_0x325566,_0x9dcd8e);_0x1d56b1(null);})[_0xfed3('0xe')](_0x1d56b1(null));};}for(var e in events){if(events[_0xfed3('0xf')](e)){var event=events[e];ChatInteraction[_0xfed3('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 98b2a9f..b103f33 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 _0x1d91=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x1d91,0x179));var _0x11d9=function(_0x55e83d,_0x29534f){_0x55e83d=_0x55e83d-0x0;var _0x394761=_0x1d91[_0x55e83d];return _0x394761;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11d9('0x0'))('api');var moment=require(_0x11d9('0x1'));var BPromise=require(_0x11d9('0x2'));var rp=require(_0x11d9('0x3'));var fs=require('fs');var path=require(_0x11d9('0x4'));var rimraf=require(_0x11d9('0x5'));var config=require(_0x11d9('0x6'));var attributes=require(_0x11d9('0x7'));module[_0x11d9('0x8')]=function(_0x1236d3,_0x304736){return _0x1236d3[_0x11d9('0x9')](_0x11d9('0xa'),attributes,{'tableName':_0x11d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x563f0e,_0x257690,_0x397178){if(_0x563f0e[_0x11d9('0xc')]('closed')){_0x563f0e['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x397178(null,_0x563f0e);}},'charset':_0x11d9('0xd'),'collate':_0x11d9('0xe')});}; \ No newline at end of file +var _0xc548=['closed','closedAt','format','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions'];(function(_0x5ea542,_0x2ba3d8){var _0x1d31f7=function(_0x564405){while(--_0x564405){_0x5ea542['push'](_0x5ea542['shift']());}};_0x1d31f7(++_0x2ba3d8);}(_0xc548,0x17e));var _0x8c54=function(_0x608e05,_0x2cd8fe){_0x608e05=_0x608e05-0x0;var _0x1f9590=_0xc548[_0x608e05];return _0x1f9590;};'use strict';var _=require(_0x8c54('0x0'));var util=require(_0x8c54('0x1'));var logger=require(_0x8c54('0x2'))(_0x8c54('0x3'));var moment=require(_0x8c54('0x4'));var BPromise=require('bluebird');var rp=require(_0x8c54('0x5'));var fs=require('fs');var path=require(_0x8c54('0x6'));var rimraf=require(_0x8c54('0x7'));var config=require(_0x8c54('0x8'));var attributes=require(_0x8c54('0x9'));module[_0x8c54('0xa')]=function(_0x7219da,_0x54cf62){return _0x7219da[_0x8c54('0xb')](_0x8c54('0xc'),attributes,{'tableName':_0x8c54('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f79fd,_0x534fdb,_0x1bf2df){if(_0x5f79fd['changed'](_0x8c54('0xe'))){_0x5f79fd[_0x8c54('0xf')]=moment()[_0x8c54('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1bf2df(null,_0x5f79fd);}},'charset':_0x8c54('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index a9a8464..b538968 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 _0x7739=['AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UpdateChatInteraction','update','options','raw','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','where','addTags','body','ids','omit','spread'];(function(_0x36cec5,_0x11477e){var _0x328186=function(_0x5bca9d){while(--_0x5bca9d){_0x36cec5['push'](_0x36cec5['shift']());}};_0x328186(++_0x11477e);}(_0x7739,0xeb));var _0x9773=function(_0x218ee2,_0x44b8e8){_0x218ee2=_0x218ee2-0x0;var _0x5b74a6=_0x7739[_0x218ee2];return _0x5b74a6;};'use strict';var _=require(_0x9773('0x0'));var util=require(_0x9773('0x1'));var moment=require(_0x9773('0x2'));var BPromise=require('bluebird');var rs=require(_0x9773('0x3'));var fs=require('fs');var Redis=require(_0x9773('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9773('0x5'));var logger=require('../../config/logger')(_0x9773('0x6'));var config=require('../../config/environment');var jayson=require(_0x9773('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9773('0x8')](config[_0x9773('0x9')],{'host':_0x9773('0xa'),'port':0x18eb});var socket=require(_0x9773('0xb'))(new Redis(config[_0x9773('0x9')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x14d4cc,_0xa1cba5,_0x88f214){return new BPromise(function(_0x12957e,_0x2eb139){return client[_0x9773('0xc')](_0x14d4cc,_0x88f214)[_0x9773('0xd')](function(_0x3db0dc){logger[_0x9773('0xe')](_0x9773('0xf'),_0xa1cba5,_0x9773('0x10'));logger[_0x9773('0x11')](_0x9773('0x12'),_0xa1cba5,_0x9773('0x10'),JSON[_0x9773('0x13')](_0x3db0dc));if(_0x3db0dc['error']){if(_0x3db0dc['error'][_0x9773('0x14')]===0x1f4){logger[_0x9773('0x15')](_0x9773('0xf'),_0xa1cba5,_0x3db0dc[_0x9773('0x15')][_0x9773('0x16')]);return _0x2eb139(_0x3db0dc[_0x9773('0x15')][_0x9773('0x16')]);}logger[_0x9773('0x15')](_0x9773('0xf'),_0xa1cba5,_0x3db0dc[_0x9773('0x15')]['message']);return _0x12957e(_0x3db0dc[_0x9773('0x15')]['message']);}else{logger[_0x9773('0xe')](_0x9773('0xf'),_0xa1cba5,_0x9773('0x10'));_0x12957e(_0x3db0dc['result']['message']);}})['catch'](function(_0x2f6012){logger[_0x9773('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xa1cba5,_0x2f6012);_0x2eb139(_0x2f6012);});});}exports[_0x9773('0x17')]=function(_0x177e9a){var _0x1b8bc7=this;return new Promise(function(_0x44e259,_0x4e12ce){return db['ChatInteraction'][_0x9773('0x18')](_0x177e9a['body'],{'raw':_0x177e9a[_0x9773('0x19')]?_0x177e9a[_0x9773('0x19')][_0x9773('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x177e9a[_0x9773('0x19')]?_0x177e9a['options']['where']||null:null,'attributes':_0x177e9a[_0x9773('0x19')]?_0x177e9a[_0x9773('0x19')][_0x9773('0x1b')]||null:null,'limit':_0x177e9a[_0x9773('0x19')]?_0x177e9a[_0x9773('0x19')][_0x9773('0x1c')]||null:null})[_0x9773('0xd')](function(_0x4eff96){logger[_0x9773('0xe')](_0x9773('0x17'),_0x177e9a);logger[_0x9773('0x11')](_0x9773('0x17'),_0x177e9a,JSON[_0x9773('0x13')](_0x4eff96));_0x44e259(_0x4eff96);})['catch'](function(_0x8a2758){logger['error'](_0x9773('0x17'),_0x8a2758['message'],_0x177e9a);_0x4e12ce(_0x1b8bc7[_0x9773('0x15')](0x1f4,_0x8a2758['message']));});});};exports[_0x9773('0x1d')]=function(_0x247bbc){return new Promise(function(_0x3286db,_0x291113){return db[_0x9773('0x1e')][_0x9773('0x1f')]({'where':_0x247bbc[_0x9773('0x19')]?_0x247bbc[_0x9773('0x19')][_0x9773('0x20')]||null:null})[_0x9773('0xd')](function(_0x524416){if(_0x524416){return _0x524416[_0x9773('0x21')](_0x247bbc[_0x9773('0x22')][_0x9773('0x23')],_[_0x9773('0x24')](_0x247bbc['body'],['ids','id'])||{});}})[_0x9773('0x25')](function(_0x59a381){logger[_0x9773('0xe')](_0x9773('0x26'),_0x247bbc);logger[_0x9773('0x11')](_0x9773('0x26'),_0x247bbc,JSON[_0x9773('0x13')](_0x59a381));_0x3286db(_0x59a381);})['catch'](function(_0x28b427){logger[_0x9773('0x15')]('AddTags',_0x28b427['message'],_0x247bbc);_0x291113(_this[_0x9773('0x15')](0x1f4,_0x28b427['message']));});});}; \ No newline at end of file +var _0x7d97=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','limit','AddTagsToChatInteraction','find','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x1e1943,_0x1a6d54){var _0x4989a9=function(_0x4e1e58){while(--_0x4e1e58){_0x1e1943['push'](_0x1e1943['shift']());}};_0x4989a9(++_0x1a6d54);}(_0x7d97,0x1b0));var _0x77d9=function(_0x4f7124,_0x56238e){_0x4f7124=_0x4f7124-0x0;var _0x329a8b=_0x7d97[_0x4f7124];return _0x329a8b;};'use strict';var _=require(_0x77d9('0x0'));var util=require(_0x77d9('0x1'));var moment=require('moment');var BPromise=require(_0x77d9('0x2'));var rs=require(_0x77d9('0x3'));var fs=require('fs');var Redis=require(_0x77d9('0x4'));var db=require(_0x77d9('0x5'))['db'];var utils=require(_0x77d9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x77d9('0x7'));var jayson=require(_0x77d9('0x8'));var client=jayson['client'][_0x77d9('0x9')]({'port':0x232a});config[_0x77d9('0xa')]=_[_0x77d9('0xb')](config[_0x77d9('0xa')],{'host':_0x77d9('0xc'),'port':0x18eb});var socket=require(_0x77d9('0xd'))(new Redis(config['redis']));require(_0x77d9('0xe'))[_0x77d9('0xf')](socket);function respondWithRpcPromise(_0x354cbc,_0x1a0f47,_0x38adc6){return new BPromise(function(_0x2783f3,_0x426e68){return client[_0x77d9('0x10')](_0x354cbc,_0x38adc6)[_0x77d9('0x11')](function(_0x1972ea){logger[_0x77d9('0x12')](_0x77d9('0x13'),_0x1a0f47,_0x77d9('0x14'));logger[_0x77d9('0x15')](_0x77d9('0x16'),_0x1a0f47,_0x77d9('0x14'),JSON[_0x77d9('0x17')](_0x1972ea));if(_0x1972ea['error']){if(_0x1972ea[_0x77d9('0x18')][_0x77d9('0x19')]===0x1f4){logger[_0x77d9('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x1a0f47,_0x1972ea[_0x77d9('0x18')]['message']);return _0x426e68(_0x1972ea[_0x77d9('0x18')]['message']);}logger[_0x77d9('0x18')](_0x77d9('0x13'),_0x1a0f47,_0x1972ea[_0x77d9('0x18')][_0x77d9('0x1a')]);return _0x2783f3(_0x1972ea[_0x77d9('0x18')]['message']);}else{logger['info'](_0x77d9('0x13'),_0x1a0f47,_0x77d9('0x14'));_0x2783f3(_0x1972ea[_0x77d9('0x1b')]['message']);}})[_0x77d9('0x1c')](function(_0x27e911){logger[_0x77d9('0x18')](_0x77d9('0x13'),_0x1a0f47,_0x27e911);_0x426e68(_0x27e911);});});}exports[_0x77d9('0x1d')]=function(_0x3de8e0){var _0x23d45c=this;return new Promise(function(_0x1c5bd3,_0x4d0347){return db[_0x77d9('0x1e')][_0x77d9('0x1f')](_0x3de8e0[_0x77d9('0x20')],{'raw':_0x3de8e0[_0x77d9('0x21')]?_0x3de8e0[_0x77d9('0x21')][_0x77d9('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3de8e0[_0x77d9('0x21')]?_0x3de8e0['options']['where']||null:null,'attributes':_0x3de8e0[_0x77d9('0x21')]?_0x3de8e0[_0x77d9('0x21')]['attributes']||null:null,'limit':_0x3de8e0[_0x77d9('0x21')]?_0x3de8e0[_0x77d9('0x21')][_0x77d9('0x23')]||null:null})[_0x77d9('0x11')](function(_0x1ad9ae){logger['info'](_0x77d9('0x1d'),_0x3de8e0);logger[_0x77d9('0x15')](_0x77d9('0x1d'),_0x3de8e0,JSON[_0x77d9('0x17')](_0x1ad9ae));_0x1c5bd3(_0x1ad9ae);})[_0x77d9('0x1c')](function(_0x399e09){logger[_0x77d9('0x18')](_0x77d9('0x1d'),_0x399e09['message'],_0x3de8e0);_0x4d0347(_0x23d45c[_0x77d9('0x18')](0x1f4,_0x399e09[_0x77d9('0x1a')]));});});};exports[_0x77d9('0x24')]=function(_0x387c7a){return new Promise(function(_0x22a719,_0x5207ce){return db[_0x77d9('0x1e')][_0x77d9('0x25')]({'where':_0x387c7a['options']?_0x387c7a[_0x77d9('0x21')]['where']||null:null})[_0x77d9('0x11')](function(_0x29eb5d){if(_0x29eb5d){return _0x29eb5d['addTags'](_0x387c7a['body'][_0x77d9('0x26')],_['omit'](_0x387c7a[_0x77d9('0x20')],['ids','id'])||{});}})['spread'](function(_0x350621){logger['info']('AddTags',_0x387c7a);logger['debug'](_0x77d9('0x27'),_0x387c7a,JSON[_0x77d9('0x17')](_0x350621));_0x22a719(_0x350621);})[_0x77d9('0x1c')](function(_0x3a2a51){logger['error'](_0x77d9('0x27'),_0x3a2a51['message'],_0x387c7a);_0x5207ce(_this[_0x77d9('0x18')](0x1f4,_0x3a2a51[_0x77d9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 30b4f72..4959402 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 _0xf109=['remove','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x466b13,_0x7f20ce){var _0x5cb98c=function(_0x5c369f){while(--_0x5c369f){_0x466b13['push'](_0x466b13['shift']());}};_0x5cb98c(++_0x7f20ce);}(_0xf109,0x1de));var _0x9f10=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xf109[_0x1b4b23];return _0x2a325b;};'use strict';var ChatInteractionEvents=require(_0x9f10('0x0'));var events=[_0x9f10('0x1'),_0x9f10('0x2'),'update'];function createListener(_0x1f9ed8,_0x34d67c){return function(_0x368f40){_0x34d67c['emit'](_0x1f9ed8,_0x368f40);};}function removeListener(_0x4d57aa,_0x550c4c){return function(){ChatInteractionEvents['removeListener'](_0x4d57aa,_0x550c4c);};}exports[_0x9f10('0x3')]=function(_0x53c7a9){for(var _0x13d9d1=0x0,_0x294780=events[_0x9f10('0x4')];_0x13d9d1<_0x294780;_0x13d9d1++){var _0x11d75a=events[_0x13d9d1];var _0x1d7ed7=createListener(_0x9f10('0x5')+_0x11d75a,_0x53c7a9);ChatInteractionEvents['on'](_0x11d75a,_0x1d7ed7);}}; \ No newline at end of file +var _0x5583=['update','emit','removeListener','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x465d4a,_0x43ade6){var _0x32bdd1=function(_0x33d480){while(--_0x33d480){_0x465d4a['push'](_0x465d4a['shift']());}};_0x32bdd1(++_0x43ade6);}(_0x5583,0x1e0));var _0x3558=function(_0x12fe32,_0x1d5358){_0x12fe32=_0x12fe32-0x0;var _0x1701f5=_0x5583[_0x12fe32];return _0x1701f5;};'use strict';var ChatInteractionEvents=require(_0x3558('0x0'));var events=[_0x3558('0x1'),_0x3558('0x2'),_0x3558('0x3')];function createListener(_0x25b305,_0x83be64){return function(_0x21f0be){_0x83be64[_0x3558('0x4')](_0x25b305,_0x21f0be);};}function removeListener(_0x436f05,_0x2c10af){return function(){ChatInteractionEvents[_0x3558('0x5')](_0x436f05,_0x2c10af);};}exports['register']=function(_0x3181da){for(var _0xbed80f=0x0,_0x19a0fb=events['length'];_0xbed80f<_0x19a0fb;_0xbed80f++){var _0x2ce949=events[_0xbed80f];var _0x53b2aa=createListener(_0x3558('0x6')+_0x2ce949,_0x3181da);ChatInteractionEvents['on'](_0x2ce949,_0x53b2aa);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 550f9cb..9dc7c6f 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 _0xd080=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','download','post','create','createVidaooSession','diskStorage','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','addTags','put','chat','/:id/custom_update','abandon','close','delete','destroy','removeTags','exports','multer','path'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0xd080,0x1de));var _0x0d08=function(_0x49bda3,_0x2bb661){_0x49bda3=_0x49bda3-0x0;var _0x18b651=_0xd080[_0x49bda3];return _0x18b651;};'use strict';var multer=require(_0x0d08('0x0'));var util=require('util');var path=require(_0x0d08('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d08('0x2')]();var fs_extra=require(_0x0d08('0x3'));var auth=require(_0x0d08('0x4'));var interaction=require(_0x0d08('0x5'));var config=require(_0x0d08('0x6'));var controller=require(_0x0d08('0x7'));router['get']('/',auth[_0x0d08('0x8')](),controller[_0x0d08('0x9')]);router['get'](_0x0d08('0xa'),auth[_0x0d08('0x8')](),controller[_0x0d08('0xb')]);router[_0x0d08('0xc')](_0x0d08('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x0d08('0xe')]);router[_0x0d08('0xc')](_0x0d08('0xf'),auth[_0x0d08('0x10')](),controller[_0x0d08('0x11')]);router[_0x0d08('0xc')](_0x0d08('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0x0d08('0xc')](_0x0d08('0x13'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x0d08('0xc')](_0x0d08('0x14'),auth[_0x0d08('0x8')](),controller[_0x0d08('0x15')]);router[_0x0d08('0x16')]('/',auth[_0x0d08('0x8')](),controller[_0x0d08('0x17')]);router[_0x0d08('0x16')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x0d08('0x18')]);var upload=multer({'storage':multer[_0x0d08('0x19')]({'destination':function(_0x569140,_0x31b15a,_0x1ab314){_0x1ab314(null,path['join'](config['root'],_0x0d08('0x1a')));},'filename':function(_0x35a6fa,_0x9aa5a,_0x1516a2){_0x1516a2(null,util[_0x0d08('0x1b')](_0x0d08('0x1c'),Date[_0x0d08('0x1d')](),_0x9aa5a[_0x0d08('0x1e')][_0x0d08('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0d08('0x16')](_0x0d08('0x20'),upload[_0x0d08('0x21')](_0x0d08('0x22')),controller[_0x0d08('0x23')]);router[_0x0d08('0x16')]('/:id/messages',auth[_0x0d08('0x10')](),controller[_0x0d08('0x24')]);router[_0x0d08('0x16')]('/:id/tags',auth[_0x0d08('0x8')](),interaction[_0x0d08('0x25')]('chat','chatinteraction:addtags'),controller[_0x0d08('0x26')]);router[_0x0d08('0x27')](_0x0d08('0xd'),auth[_0x0d08('0x8')](),interaction[_0x0d08('0x25')](_0x0d08('0x28'),'chatinteraction:update'),controller['update']);router[_0x0d08('0x27')](_0x0d08('0x29'),controller['customUpdate']);router[_0x0d08('0x27')]('/:id/abandon',auth[_0x0d08('0x10')](),controller[_0x0d08('0x2a')]);router[_0x0d08('0x27')]('/:id/close',controller[_0x0d08('0x2b')]);router[_0x0d08('0x2c')](_0x0d08('0xd'),auth[_0x0d08('0x8')](),interaction['tracked']('chat','chatinteraction:destroy'),controller[_0x0d08('0x2d')]);router[_0x0d08('0x2c')]('/:id/tags',auth[_0x0d08('0x8')](),controller[_0x0d08('0x2e')]);module[_0x0d08('0x2f')]=router; \ No newline at end of file +var _0xf4b0=['/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','isAuthenticated','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages'];(function(_0x40abc4,_0x396658){var _0x188165=function(_0x366ae7){while(--_0x366ae7){_0x40abc4['push'](_0x40abc4['shift']());}};_0x188165(++_0x396658);}(_0xf4b0,0x7d));var _0x0f4b=function(_0x303a74,_0x2a17e5){_0x303a74=_0x303a74-0x0;var _0x5c401d=_0xf4b0[_0x303a74];return _0x5c401d;};'use strict';var multer=require('multer');var util=require(_0x0f4b('0x0'));var path=require(_0x0f4b('0x1'));var timeout=require(_0x0f4b('0x2'));var express=require(_0x0f4b('0x3'));var router=express[_0x0f4b('0x4')]();var fs_extra=require(_0x0f4b('0x5'));var auth=require(_0x0f4b('0x6'));var interaction=require(_0x0f4b('0x7'));var config=require(_0x0f4b('0x8'));var controller=require(_0x0f4b('0x9'));router[_0x0f4b('0xa')]('/',auth['isAuthenticated'](),controller[_0x0f4b('0xb')]);router['get']('/describe',auth[_0x0f4b('0xc')](),controller['describe']);router[_0x0f4b('0xa')](_0x0f4b('0xd'),auth[_0x0f4b('0xe')](),controller['show']);router['get'](_0x0f4b('0xf'),auth[_0x0f4b('0xe')](),controller[_0x0f4b('0x10')]);router[_0x0f4b('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0f4b('0x11')]);router[_0x0f4b('0xa')](_0x0f4b('0x12'),auth[_0x0f4b('0xe')](),controller[_0x0f4b('0x13')]);router[_0x0f4b('0xa')](_0x0f4b('0x14'),auth[_0x0f4b('0xc')](),controller[_0x0f4b('0x15')]);router[_0x0f4b('0x16')]('/',auth[_0x0f4b('0xc')](),controller[_0x0f4b('0x17')]);router['post'](_0x0f4b('0x18'),auth['isAuthenticated'](),controller[_0x0f4b('0x19')]);var upload=multer({'storage':multer[_0x0f4b('0x1a')]({'destination':function(_0x344b45,_0x2e1b3c,_0x297dff){_0x297dff(null,path[_0x0f4b('0x1b')](config['root'],'server/files/attachments/'));},'filename':function(_0x163c1f,_0x289760,_0x3f79fb){_0x3f79fb(null,util['format'](_0x0f4b('0x1c'),Date[_0x0f4b('0x1d')](),_0x289760[_0x0f4b('0x1e')][_0x0f4b('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0f4b('0x16')](_0x0f4b('0x20'),upload[_0x0f4b('0x21')](_0x0f4b('0x22')),controller[_0x0f4b('0x23')]);router['post'](_0x0f4b('0x24'),auth[_0x0f4b('0xe')](),controller['addMessage']);router[_0x0f4b('0x16')](_0x0f4b('0x25'),auth[_0x0f4b('0xc')](),interaction[_0x0f4b('0x26')](_0x0f4b('0x27'),_0x0f4b('0x28')),controller[_0x0f4b('0x29')]);router[_0x0f4b('0x2a')]('/:id',auth[_0x0f4b('0xc')](),interaction[_0x0f4b('0x26')](_0x0f4b('0x27'),_0x0f4b('0x2b')),controller[_0x0f4b('0x2c')]);router[_0x0f4b('0x2a')](_0x0f4b('0x2d'),controller[_0x0f4b('0x2e')]);router[_0x0f4b('0x2a')](_0x0f4b('0x2f'),auth['isChatInteractionAuthorized'](),controller[_0x0f4b('0x30')]);router['put'](_0x0f4b('0x31'),controller[_0x0f4b('0x32')]);router[_0x0f4b('0x33')](_0x0f4b('0xd'),auth[_0x0f4b('0xc')](),interaction[_0x0f4b('0x26')](_0x0f4b('0x27'),'chatinteraction:destroy'),controller[_0x0f4b('0x34')]);router['delete']('/:id/tags',auth[_0x0f4b('0xc')](),controller[_0x0f4b('0x35')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f5bde66..7d0cddb 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 _0x91b4=['sequelize','TEXT','BOOLEAN','INTEGER'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x91b4,0x130));var _0x491b=function(_0x576fe4,_0x2e4f2b){_0x576fe4=_0x576fe4-0x0;var _0x192e88=_0x91b4[_0x576fe4];return _0x192e88;};'use strict';var Sequelize=require(_0x491b('0x0'));module['exports']={'body':{'type':Sequelize[_0x491b('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x491b('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x491b('0x3')]}}; \ No newline at end of file +var _0x2bd1=['sequelize','exports','BOOLEAN','INTEGER'];(function(_0x13101d,_0x6aca42){var _0xa41854=function(_0x10309f){while(--_0x10309f){_0x13101d['push'](_0x13101d['shift']());}};_0xa41854(++_0x6aca42);}(_0x2bd1,0x1b8));var _0x12bd=function(_0x2eda5a,_0x3ceff9){_0x2eda5a=_0x2eda5a-0x0;var _0x5385e1=_0x2bd1[_0x2eda5a];return _0x5385e1;};'use strict';var Sequelize=require(_0x12bd('0x0'));module[_0x12bd('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x12bd('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5c4e67c..1cc75b5 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 _0x6e3f=['Agents','userProfileId','autoAssociation','isEmpty','messages','push','FromId','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','ChatInternalMessage','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','params','rawAttributes','find','catch','create','body','describe','get','lastMessageAt','createdAt','lastMessage','getUsers','findAll','agent','admin','fullname','internal','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x4596b9,_0x1a3f4a){var _0x5da47a=function(_0x4ae8bd){while(--_0x4ae8bd){_0x4596b9['push'](_0x4596b9['shift']());}};_0x5da47a(++_0x1a3f4a);}(_0x6e3f,0x1a0));var _0xf6e3=function(_0x20bd48,_0x293e0d){_0x20bd48=_0x20bd48-0x0;var _0x8c31ae=_0x6e3f[_0x20bd48];return _0x8c31ae;};'use strict';var emlformat=require(_0xf6e3('0x0'));var rimraf=require(_0xf6e3('0x1'));var zipdir=require(_0xf6e3('0x2'));var jsonpatch=require(_0xf6e3('0x3'));var rp=require('request-promise');var moment=require(_0xf6e3('0x4'));var BPromise=require(_0xf6e3('0x5'));var Mustache=require(_0xf6e3('0x6'));var util=require(_0xf6e3('0x7'));var path=require('path');var sox=require(_0xf6e3('0x8'));var csv=require('to-csv');var ejs=require(_0xf6e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf6e3('0xa'));var _=require(_0xf6e3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf6e3('0xc'));var deskjs=require(_0xf6e3('0xd'));var toCsv=require(_0xf6e3('0xe'));var querystring=require(_0xf6e3('0xf'));var Papa=require('papaparse');var Redis=require(_0xf6e3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf6e3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6e3('0x12'))(_0xf6e3('0x13'));var utils=require('../../config/utils');var config=require(_0xf6e3('0x14'));var licenseUtil=require(_0xf6e3('0x15'));var db=require(_0xf6e3('0x16'))['db'];config[_0xf6e3('0x17')]=_[_0xf6e3('0x18')](config[_0xf6e3('0x17')],{'host':_0xf6e3('0x19'),'port':0x18eb});var socket=require(_0xf6e3('0x1a'))(new Redis(config[_0xf6e3('0x17')]));require(_0xf6e3('0x1b'))['register'](socket);function respondWithStatusCode(_0xf8fe99,_0x8a1bd8){_0x8a1bd8=_0x8a1bd8||0xcc;return function(_0x52db50){if(_0x52db50){return _0xf8fe99['sendStatus'](_0x8a1bd8);}return _0xf8fe99[_0xf6e3('0x1c')](_0x8a1bd8)[_0xf6e3('0x1d')]();};}function respondWithResult(_0x5bdaae,_0x291f39){_0x291f39=_0x291f39||0xc8;return function(_0x48c2ba){if(_0x48c2ba){return _0x5bdaae[_0xf6e3('0x1c')](_0x291f39)[_0xf6e3('0x1e')](_0x48c2ba);}};}function respondWithFilteredResult(_0x51e9c1,_0x56cfeb){return function(_0x416fdb){if(_0x416fdb){var _0x4f3d83=typeof _0x56cfeb[_0xf6e3('0x1f')]==='undefined'&&typeof _0x56cfeb[_0xf6e3('0x20')]===_0xf6e3('0x21');var _0x39cea7=_0x416fdb[_0xf6e3('0x22')];var _0x417826=_0x4f3d83?0x0:_0x56cfeb[_0xf6e3('0x1f')];var _0x38681c=_0x4f3d83?_0x416fdb['count']:_0x56cfeb[_0xf6e3('0x1f')]+_0x56cfeb[_0xf6e3('0x20')];var _0x686851;if(_0x38681c>=_0x39cea7){_0x38681c=_0x39cea7;_0x686851=0xc8;}else{_0x686851=0xce;}_0x51e9c1[_0xf6e3('0x1c')](_0x686851);return _0x51e9c1[_0xf6e3('0x23')](_0xf6e3('0x24'),_0x417826+'-'+_0x38681c+'/'+_0x39cea7)[_0xf6e3('0x1e')](_0x416fdb);}return null;};}function patchUpdates(_0x47efac){return function(_0x1b98f5){try{jsonpatch[_0xf6e3('0x25')](_0x1b98f5,_0x47efac,!![]);}catch(_0x10685e){return BPromise['reject'](_0x10685e);}return _0x1b98f5[_0xf6e3('0x26')]();};}function saveUpdates(_0x178e7f,_0xf83b67){return function(_0x5afe57){if(_0x5afe57){return _0x5afe57[_0xf6e3('0x27')](_0x178e7f)['then'](function(_0x6251c9){return _0x6251c9;});}return null;};}function removeEntity(_0x291a31,_0x59d2cb){return function(_0x4b992e){if(_0x4b992e){return _0x4b992e[_0xf6e3('0x28')]()[_0xf6e3('0x29')](function(){_0x291a31[_0xf6e3('0x1c')](0xcc)[_0xf6e3('0x1d')]();});}};}function handleEntityNotFound(_0x492f14,_0x18ecb5){return function(_0x49708e){if(!_0x49708e){_0x492f14[_0xf6e3('0x2a')](0x194);}return _0x49708e;};}function handleError(_0x456d4f,_0x6d7fa5){_0x6d7fa5=_0x6d7fa5||0x1f4;return function(_0x48b06e){logger[_0xf6e3('0x2b')](_0x48b06e['stack']);if(_0x48b06e[_0xf6e3('0x2c')]){delete _0x48b06e['name'];}_0x456d4f[_0xf6e3('0x1c')](_0x6d7fa5)[_0xf6e3('0x2d')](_0x48b06e);};}exports[_0xf6e3('0x2e')]=function(_0x2c54aa,_0x746bc5){var _0x27a10a={},_0x3e6c60={},_0x5ceb96={'count':0x0,'rows':[]};var _0x2648cc=_[_0xf6e3('0x2f')](db[_0xf6e3('0x30')]['rawAttributes'],function(_0x3cfb21){return{'name':_0x3cfb21['fieldName'],'type':_0x3cfb21['type']['key']};});_0x3e6c60['model']=_[_0xf6e3('0x2f')](_0x2648cc,_0xf6e3('0x2c'));_0x3e6c60[_0xf6e3('0x31')]=_[_0xf6e3('0x32')](_0x2c54aa['query']);_0x3e6c60[_0xf6e3('0x33')]=_['intersection'](_0x3e6c60[_0xf6e3('0x34')],_0x3e6c60[_0xf6e3('0x31')]);_0x27a10a['attributes']=_[_0xf6e3('0x35')](_0x3e6c60['model'],qs[_0xf6e3('0x36')](_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x36')]));_0x27a10a[_0xf6e3('0x37')]=_0x27a10a[_0xf6e3('0x37')][_0xf6e3('0x38')]?_0x27a10a[_0xf6e3('0x37')]:_0x3e6c60[_0xf6e3('0x34')];if(!_0x2c54aa[_0xf6e3('0x31')]['hasOwnProperty'](_0xf6e3('0x39'))){_0x27a10a[_0xf6e3('0x20')]=qs[_0xf6e3('0x20')](_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x20')]);_0x27a10a[_0xf6e3('0x1f')]=qs[_0xf6e3('0x1f')](_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x1f')]);}_0x27a10a[_0xf6e3('0x3a')]=qs[_0xf6e3('0x3b')](_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x3b')]);_0x27a10a[_0xf6e3('0x3c')]=qs['filters'](_[_0xf6e3('0x3d')](_0x2c54aa[_0xf6e3('0x31')],_0x3e6c60[_0xf6e3('0x33')]),_0x2648cc);if(_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x3e')]){_0x27a10a[_0xf6e3('0x3c')]=_[_0xf6e3('0x3f')](_0x27a10a[_0xf6e3('0x3c')],{'$or':_[_0xf6e3('0x2f')](_0x2648cc,function(_0x1a197a){if(_0x1a197a[_0xf6e3('0x40')]!=='VIRTUAL'){var _0x5d9e4e={};_0x5d9e4e[_0x1a197a[_0xf6e3('0x2c')]]={'$like':'%'+_0x2c54aa['query'][_0xf6e3('0x3e')]+'%'};return _0x5d9e4e;}})});}_0x27a10a=_[_0xf6e3('0x3f')]({},_0x27a10a,_0x2c54aa[_0xf6e3('0x41')]);var _0x278b2d={'where':_0x27a10a['where']};return db[_0xf6e3('0x30')][_0xf6e3('0x22')](_0x278b2d)[_0xf6e3('0x29')](function(_0x4088d6){_0x5ceb96[_0xf6e3('0x22')]=_0x4088d6;if(_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x42')]){_0x27a10a[_0xf6e3('0x43')]=[{'all':!![]}];}return db[_0xf6e3('0x30')]['findAll'](_0x27a10a);})['then'](function(_0x4ee02c){_0x5ceb96[_0xf6e3('0x44')]=_0x4ee02c;return _0x5ceb96;})[_0xf6e3('0x29')](respondWithFilteredResult(_0x746bc5,_0x27a10a))['catch'](handleError(_0x746bc5,null));};exports['show']=function(_0x56df03,_0x52839c){var _0x1dca2d={'raw':!![],'where':{'id':_0x56df03[_0xf6e3('0x45')]['id']}},_0x49f9cf={};_0x49f9cf[_0xf6e3('0x34')]=_[_0xf6e3('0x32')](db[_0xf6e3('0x30')][_0xf6e3('0x46')]);_0x49f9cf[_0xf6e3('0x31')]=_[_0xf6e3('0x32')](_0x56df03[_0xf6e3('0x31')]);_0x49f9cf['filters']=_[_0xf6e3('0x35')](_0x49f9cf[_0xf6e3('0x34')],_0x49f9cf[_0xf6e3('0x31')]);_0x1dca2d[_0xf6e3('0x37')]=_[_0xf6e3('0x35')](_0x49f9cf[_0xf6e3('0x34')],qs[_0xf6e3('0x36')](_0x56df03[_0xf6e3('0x31')][_0xf6e3('0x36')]));_0x1dca2d[_0xf6e3('0x37')]=_0x1dca2d['attributes'][_0xf6e3('0x38')]?_0x1dca2d['attributes']:_0x49f9cf[_0xf6e3('0x34')];if(_0x56df03[_0xf6e3('0x31')][_0xf6e3('0x42')]){_0x1dca2d[_0xf6e3('0x43')]=[{'all':!![]}];}_0x1dca2d=_[_0xf6e3('0x3f')]({},_0x1dca2d,_0x56df03['options']);return db[_0xf6e3('0x30')][_0xf6e3('0x47')](_0x1dca2d)['then'](handleEntityNotFound(_0x52839c,null))['then'](respondWithResult(_0x52839c,null))[_0xf6e3('0x48')](handleError(_0x52839c,null));};exports[_0xf6e3('0x49')]=function(_0x538111,_0x3038e8){return db[_0xf6e3('0x30')][_0xf6e3('0x49')](_0x538111[_0xf6e3('0x4a')],{})['then'](respondWithResult(_0x3038e8,0xc9))[_0xf6e3('0x48')](handleError(_0x3038e8,null));};exports[_0xf6e3('0x27')]=function(_0xbc793d,_0x35da51){if(_0xbc793d[_0xf6e3('0x4a')]['id']){delete _0xbc793d[_0xf6e3('0x4a')]['id'];}return db[_0xf6e3('0x30')][_0xf6e3('0x47')]({'where':{'id':_0xbc793d[_0xf6e3('0x45')]['id']}})[_0xf6e3('0x29')](handleEntityNotFound(_0x35da51,null))[_0xf6e3('0x29')](saveUpdates(_0xbc793d[_0xf6e3('0x4a')],null))[_0xf6e3('0x29')](respondWithResult(_0x35da51,null))['catch'](handleError(_0x35da51,null));};exports[_0xf6e3('0x28')]=function(_0xc19300,_0x9aca1c){return db[_0xf6e3('0x30')]['find']({'where':{'id':_0xc19300[_0xf6e3('0x45')]['id']}})[_0xf6e3('0x29')](handleEntityNotFound(_0x9aca1c,null))[_0xf6e3('0x29')](removeEntity(_0x9aca1c,null))[_0xf6e3('0x48')](handleError(_0x9aca1c,null));};exports[_0xf6e3('0x4b')]=function(_0x5629e7,_0x526ac3){return db[_0xf6e3('0x30')]['describe']()[_0xf6e3('0x29')](respondWithResult(_0x526ac3,null))[_0xf6e3('0x48')](handleError(_0x526ac3,null));};function wrapUser(_0xc5beac){return function(_0x4c654d){var _0x2ee5b7=_0xc5beac[_0xf6e3('0x4c')]({'plain':!![]});_0x2ee5b7['messages']=[];if(_0x4c654d){_0x2ee5b7[_0xf6e3('0x4d')]=_0x4c654d[_0xf6e3('0x4e')];_0x2ee5b7[_0xf6e3('0x4f')]=_0x4c654d;}else{_0x2ee5b7['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ee5b7[_0xf6e3('0x4f')]={};}return _0x2ee5b7;};}exports[_0xf6e3('0x50')]=function(_0x5678e0,_0x18a72c,_0x34a085){var _0x357169=[];return db['User'][_0xf6e3('0x51')]({'where':{'role':[_0xf6e3('0x52'),_0xf6e3('0x53'),'user']},'attributes':['id',_0xf6e3('0x54'),_0xf6e3('0x2c'),'role','userpic',_0xf6e3('0x55'),'online','lastLoginAt',_0xf6e3('0x56'),_0xf6e3('0x57')],'order':qs[_0xf6e3('0x3b')](_0xf6e3('0x58')),'include':[{'model':db[_0xf6e3('0x59')],'as':_0xf6e3('0x5a'),'attributes':['id',_0xf6e3('0x2c'),_0xf6e3('0x40')],'through':{'attributes':[]}}]})[_0xf6e3('0x29')](function(_0x257bdc){if(_0x257bdc){var _0x43351b=_0x5678e0[_0xf6e3('0x5b')]['get']({'plain':!![]});if(!_0x43351b)throw new Error(_0xf6e3('0x5c'));if(_0x43351b[_0xf6e3('0x5d')]==='user'){return db['UserProfileSection'][_0xf6e3('0x47')]({'where':{'name':_0xf6e3('0x5e'),'userProfileId':_0x43351b[_0xf6e3('0x5f')]},'raw':!![]})[_0xf6e3('0x29')](function(_0x1a2c92){if(_0x1a2c92){if(_0x1a2c92[_0xf6e3('0x60')]===0x0){return db['UserProfileResource'][_0xf6e3('0x51')]({'where':{'sectionId':_0x1a2c92['id']},'raw':!![]})['then'](function(_0x504b21){var _0x24bd6f=[];if(_[_0xf6e3('0x61')](_0x504b21)){_0x24bd6f=_[_0xf6e3('0x3e')](_0x257bdc,function(_0x70ba67){if(_0x70ba67[_0xf6e3('0x5d')]!==_0xf6e3('0x52')){return _0x70ba67;}});return _0x24bd6f;}else{for(var _0x41565a=0x0;_0x41565a<_0x257bdc['length'];_0x41565a++){var _0x18423f=_0x257bdc[_0x41565a];if(_0x18423f[_0xf6e3('0x5d')]===_0xf6e3('0x52')){var _0x22252d=_[_0xf6e3('0x47')](_0x504b21,function(_0x4b39d7){return _0x4b39d7['resourceId']===_0x18423f['id'];});if(_0x22252d)_0x24bd6f['push'](_0x18423f);}else{_0x24bd6f['push'](_0x18423f);}}return _0x24bd6f;}});}else{return _0x257bdc;}}else{var _0x101c98=_[_0xf6e3('0x3e')](_0x257bdc,function(_0x176d9f){if(_0x176d9f['role']!==_0xf6e3('0x52')){return _0x176d9f;}});return _0x101c98;}});}else{return _0x257bdc;}}})[_0xf6e3('0x29')](function(_0x5bdfbd){var _0x3c2242=[];if(_0x5bdfbd){_0x357169=_0x5bdfbd;for(var _0x4b9f8a=0x0;_0x4b9f8a<_0x5bdfbd[_0xf6e3('0x38')];_0x4b9f8a+=0x1){_0x357169[_0x4b9f8a][_0xf6e3('0x62')]=[];_0x3c2242[_0xf6e3('0x63')](db[_0xf6e3('0x30')][_0xf6e3('0x47')]({'where':{'FromId':[_0x5678e0[_0xf6e3('0x5b')]['id'],_0x5bdfbd[_0x4b9f8a]['id']],'ToId':[_0x5678e0[_0xf6e3('0x5b')]['id'],_0x5bdfbd[_0x4b9f8a]['id']],'ChatGroupId':null},'attributes':['id',_0xf6e3('0x4e'),_0xf6e3('0x64'),'ToId','read',_0xf6e3('0x4a')],'order':qs[_0xf6e3('0x3b')](_0xf6e3('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf6e3('0x29')](wrapUser(_0x5bdfbd[_0x4b9f8a])));}return BPromise['all'](_0x3c2242);}return[];})[_0xf6e3('0x29')](function(_0x1880ca){return{'rows':_0x1880ca,'count':_0x1880ca[_0xf6e3('0x38')]};})[_0xf6e3('0x29')](respondWithResult(_0x18a72c,null))[_0xf6e3('0x48')](handleError(_0x18a72c,null));}; \ No newline at end of file +var _0x6126=['intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','create','body','update','find','params','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','get','Agents','autoAssociation','UserProfileResource','findAll','isEmpty','agent','length','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','name','query','keys'];(function(_0x888381,_0xfc8d0e){var _0x6037c6=function(_0x33d719){while(--_0x33d719){_0x888381['push'](_0x888381['shift']());}};_0x6037c6(++_0xfc8d0e);}(_0x6126,0xa7));var _0x6612=function(_0x222b3f,_0x133be7){_0x222b3f=_0x222b3f-0x0;var _0x20b57a=_0x6126[_0x222b3f];return _0x20b57a;};'use strict';var emlformat=require(_0x6612('0x0'));var rimraf=require(_0x6612('0x1'));var zipdir=require(_0x6612('0x2'));var jsonpatch=require(_0x6612('0x3'));var rp=require(_0x6612('0x4'));var moment=require(_0x6612('0x5'));var BPromise=require(_0x6612('0x6'));var Mustache=require(_0x6612('0x7'));var util=require(_0x6612('0x8'));var path=require(_0x6612('0x9'));var sox=require(_0x6612('0xa'));var csv=require(_0x6612('0xb'));var ejs=require(_0x6612('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6612('0xd'));var squel=require('squel');var crypto=require(_0x6612('0xe'));var jsforce=require(_0x6612('0xf'));var deskjs=require(_0x6612('0x10'));var toCsv=require(_0x6612('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6612('0x11'));var authService=require(_0x6612('0x12'));var qs=require(_0x6612('0x13'));var as=require(_0x6612('0x14'));var hardwareService=require(_0x6612('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6612('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6612('0x17'));var db=require(_0x6612('0x18'))['db'];config[_0x6612('0x19')]=_[_0x6612('0x1a')](config[_0x6612('0x19')],{'host':_0x6612('0x1b'),'port':0x18eb});var socket=require(_0x6612('0x1c'))(new Redis(config[_0x6612('0x19')]));require(_0x6612('0x1d'))['register'](socket);function respondWithStatusCode(_0x7fd4b2,_0x351c5f){_0x351c5f=_0x351c5f||0xcc;return function(_0x7009c2){if(_0x7009c2){return _0x7fd4b2['sendStatus'](_0x351c5f);}return _0x7fd4b2[_0x6612('0x1e')](_0x351c5f)[_0x6612('0x1f')]();};}function respondWithResult(_0x83a1dd,_0x19fb13){_0x19fb13=_0x19fb13||0xc8;return function(_0x39a4cc){if(_0x39a4cc){return _0x83a1dd[_0x6612('0x1e')](_0x19fb13)['json'](_0x39a4cc);}};}function respondWithFilteredResult(_0x1ee491,_0x4cfcd8){return function(_0x52205f){if(_0x52205f){var _0x1a4abf=typeof _0x4cfcd8[_0x6612('0x20')]===_0x6612('0x21')&&typeof _0x4cfcd8[_0x6612('0x22')]===_0x6612('0x21');var _0x159502=_0x52205f[_0x6612('0x23')];var _0x1db0fe=_0x1a4abf?0x0:_0x4cfcd8['offset'];var _0x228d50=_0x1a4abf?_0x52205f[_0x6612('0x23')]:_0x4cfcd8[_0x6612('0x20')]+_0x4cfcd8[_0x6612('0x22')];var _0x8012e0;if(_0x228d50>=_0x159502){_0x228d50=_0x159502;_0x8012e0=0xc8;}else{_0x8012e0=0xce;}_0x1ee491[_0x6612('0x1e')](_0x8012e0);return _0x1ee491[_0x6612('0x24')](_0x6612('0x25'),_0x1db0fe+'-'+_0x228d50+'/'+_0x159502)['json'](_0x52205f);}return null;};}function patchUpdates(_0x264105){return function(_0x2d6c51){try{jsonpatch[_0x6612('0x26')](_0x2d6c51,_0x264105,!![]);}catch(_0xb1c303){return BPromise[_0x6612('0x27')](_0xb1c303);}return _0x2d6c51[_0x6612('0x28')]();};}function saveUpdates(_0x2ca239,_0x510a3d){return function(_0x1f0b1a){if(_0x1f0b1a){return _0x1f0b1a['update'](_0x2ca239)[_0x6612('0x29')](function(_0xbcdd88){return _0xbcdd88;});}return null;};}function removeEntity(_0x1427fc,_0x55764e){return function(_0xf510e6){if(_0xf510e6){return _0xf510e6['destroy']()[_0x6612('0x29')](function(){_0x1427fc['status'](0xcc)[_0x6612('0x1f')]();});}};}function handleEntityNotFound(_0x43b628,_0x30e899){return function(_0x140605){if(!_0x140605){_0x43b628[_0x6612('0x2a')](0x194);}return _0x140605;};}function handleError(_0x1be189,_0x382e1a){_0x382e1a=_0x382e1a||0x1f4;return function(_0x3b5b57){logger[_0x6612('0x2b')](_0x3b5b57[_0x6612('0x2c')]);if(_0x3b5b57['name']){delete _0x3b5b57['name'];}_0x1be189['status'](_0x382e1a)[_0x6612('0x2d')](_0x3b5b57);};}exports[_0x6612('0x2e')]=function(_0x5b6412,_0x58ac8f){var _0x26be8a={},_0x12f9b6={},_0x59fd69={'count':0x0,'rows':[]};var _0x592e68=_[_0x6612('0x2f')](db[_0x6612('0x30')][_0x6612('0x31')],function(_0x16f3e2){return{'name':_0x16f3e2[_0x6612('0x32')],'type':_0x16f3e2[_0x6612('0x33')][_0x6612('0x34')]};});_0x12f9b6[_0x6612('0x35')]=_['map'](_0x592e68,_0x6612('0x36'));_0x12f9b6[_0x6612('0x37')]=_[_0x6612('0x38')](_0x5b6412[_0x6612('0x37')]);_0x12f9b6['filters']=_[_0x6612('0x39')](_0x12f9b6[_0x6612('0x35')],_0x12f9b6[_0x6612('0x37')]);_0x26be8a[_0x6612('0x3a')]=_['intersection'](_0x12f9b6[_0x6612('0x35')],qs[_0x6612('0x3b')](_0x5b6412[_0x6612('0x37')][_0x6612('0x3b')]));_0x26be8a[_0x6612('0x3a')]=_0x26be8a[_0x6612('0x3a')]['length']?_0x26be8a[_0x6612('0x3a')]:_0x12f9b6[_0x6612('0x35')];if(!_0x5b6412['query'][_0x6612('0x3c')]('nolimit')){_0x26be8a['limit']=qs['limit'](_0x5b6412[_0x6612('0x37')][_0x6612('0x22')]);_0x26be8a['offset']=qs[_0x6612('0x20')](_0x5b6412[_0x6612('0x37')][_0x6612('0x20')]);}_0x26be8a['order']=qs[_0x6612('0x3d')](_0x5b6412[_0x6612('0x37')][_0x6612('0x3d')]);_0x26be8a[_0x6612('0x3e')]=qs[_0x6612('0x3f')](_[_0x6612('0x40')](_0x5b6412['query'],_0x12f9b6[_0x6612('0x3f')]),_0x592e68);if(_0x5b6412[_0x6612('0x37')][_0x6612('0x41')]){_0x26be8a['where']=_[_0x6612('0x42')](_0x26be8a[_0x6612('0x3e')],{'$or':_['map'](_0x592e68,function(_0x1f45e9){if(_0x1f45e9[_0x6612('0x33')]!==_0x6612('0x43')){var _0x5c83b4={};_0x5c83b4[_0x1f45e9[_0x6612('0x36')]]={'$like':'%'+_0x5b6412['query'][_0x6612('0x41')]+'%'};return _0x5c83b4;}})});}_0x26be8a=_[_0x6612('0x42')]({},_0x26be8a,_0x5b6412[_0x6612('0x44')]);var _0x1b5965={'where':_0x26be8a[_0x6612('0x3e')]};return db[_0x6612('0x30')][_0x6612('0x23')](_0x1b5965)[_0x6612('0x29')](function(_0x49616f){_0x59fd69[_0x6612('0x23')]=_0x49616f;if(_0x5b6412[_0x6612('0x37')][_0x6612('0x45')]){_0x26be8a[_0x6612('0x46')]=[{'all':!![]}];}return db[_0x6612('0x30')]['findAll'](_0x26be8a);})['then'](function(_0x27bc36){_0x59fd69[_0x6612('0x47')]=_0x27bc36;return _0x59fd69;})['then'](respondWithFilteredResult(_0x58ac8f,_0x26be8a))[_0x6612('0x48')](handleError(_0x58ac8f,null));};exports['show']=function(_0x2e6afc,_0x4b6dba){var _0x21bcae={'raw':!![],'where':{'id':_0x2e6afc['params']['id']}},_0x14c64c={};_0x14c64c['model']=_[_0x6612('0x38')](db[_0x6612('0x30')]['rawAttributes']);_0x14c64c['query']=_[_0x6612('0x38')](_0x2e6afc[_0x6612('0x37')]);_0x14c64c[_0x6612('0x3f')]=_[_0x6612('0x39')](_0x14c64c['model'],_0x14c64c['query']);_0x21bcae[_0x6612('0x3a')]=_['intersection'](_0x14c64c[_0x6612('0x35')],qs[_0x6612('0x3b')](_0x2e6afc[_0x6612('0x37')][_0x6612('0x3b')]));_0x21bcae[_0x6612('0x3a')]=_0x21bcae[_0x6612('0x3a')]['length']?_0x21bcae[_0x6612('0x3a')]:_0x14c64c[_0x6612('0x35')];if(_0x2e6afc[_0x6612('0x37')]['includeAll']){_0x21bcae[_0x6612('0x46')]=[{'all':!![]}];}_0x21bcae=_[_0x6612('0x42')]({},_0x21bcae,_0x2e6afc[_0x6612('0x44')]);return db['ChatInternalMessage']['find'](_0x21bcae)['then'](handleEntityNotFound(_0x4b6dba,null))['then'](respondWithResult(_0x4b6dba,null))[_0x6612('0x48')](handleError(_0x4b6dba,null));};exports[_0x6612('0x49')]=function(_0x5b46f4,_0x48113b){return db['ChatInternalMessage'][_0x6612('0x49')](_0x5b46f4[_0x6612('0x4a')],{})[_0x6612('0x29')](respondWithResult(_0x48113b,0xc9))[_0x6612('0x48')](handleError(_0x48113b,null));};exports[_0x6612('0x4b')]=function(_0xcd6f81,_0x507006){if(_0xcd6f81['body']['id']){delete _0xcd6f81['body']['id'];}return db['ChatInternalMessage'][_0x6612('0x4c')]({'where':{'id':_0xcd6f81[_0x6612('0x4d')]['id']}})[_0x6612('0x29')](handleEntityNotFound(_0x507006,null))[_0x6612('0x29')](saveUpdates(_0xcd6f81[_0x6612('0x4a')],null))['then'](respondWithResult(_0x507006,null))[_0x6612('0x48')](handleError(_0x507006,null));};exports[_0x6612('0x4e')]=function(_0x5757a9,_0xf962cd){return db[_0x6612('0x30')]['find']({'where':{'id':_0x5757a9[_0x6612('0x4d')]['id']}})[_0x6612('0x29')](handleEntityNotFound(_0xf962cd,null))[_0x6612('0x29')](removeEntity(_0xf962cd,null))[_0x6612('0x48')](handleError(_0xf962cd,null));};exports[_0x6612('0x4f')]=function(_0x1f6fdf,_0x1058a6){return db[_0x6612('0x30')]['describe']()[_0x6612('0x29')](respondWithResult(_0x1058a6,null))['catch'](handleError(_0x1058a6,null));};function wrapUser(_0x4d25d8){return function(_0x1b4b1a){var _0x247d7b=_0x4d25d8['get']({'plain':!![]});_0x247d7b[_0x6612('0x50')]=[];if(_0x1b4b1a){_0x247d7b[_0x6612('0x51')]=_0x1b4b1a[_0x6612('0x52')];_0x247d7b[_0x6612('0x53')]=_0x1b4b1a;}else{_0x247d7b[_0x6612('0x51')]=moment(0x0)['format'](_0x6612('0x54'));_0x247d7b['lastMessage']={};}return _0x247d7b;};}exports[_0x6612('0x55')]=function(_0x20d7a2,_0x434859,_0x2b574c){var _0x1b0090=[];return db[_0x6612('0x56')]['findAll']({'where':{'role':['agent',_0x6612('0x57'),_0x6612('0x58')]},'attributes':['id',_0x6612('0x59'),_0x6612('0x36'),_0x6612('0x5a'),_0x6612('0x5b'),_0x6612('0x5c'),'online',_0x6612('0x5d'),_0x6612('0x5e'),_0x6612('0x5f')],'order':qs[_0x6612('0x3d')](_0x6612('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0x6612('0x61'),'attributes':['id','name',_0x6612('0x33')],'through':{'attributes':[]}}]})[_0x6612('0x29')](function(_0x1b7dea){if(_0x1b7dea){var _0x77bb7a=_0x20d7a2['user'][_0x6612('0x62')]({'plain':!![]});if(!_0x77bb7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x77bb7a[_0x6612('0x5a')]==='user'){return db['UserProfileSection'][_0x6612('0x4c')]({'where':{'name':_0x6612('0x63'),'userProfileId':_0x77bb7a['userProfileId']},'raw':!![]})[_0x6612('0x29')](function(_0x41fe27){if(_0x41fe27){if(_0x41fe27[_0x6612('0x64')]===0x0){return db[_0x6612('0x65')][_0x6612('0x66')]({'where':{'sectionId':_0x41fe27['id']},'raw':!![]})[_0x6612('0x29')](function(_0x51e444){var _0x380e2a=[];if(_[_0x6612('0x67')](_0x51e444)){_0x380e2a=_[_0x6612('0x41')](_0x1b7dea,function(_0x59c2a9){if(_0x59c2a9[_0x6612('0x5a')]!==_0x6612('0x68')){return _0x59c2a9;}});return _0x380e2a;}else{for(var _0x35867c=0x0;_0x35867c<_0x1b7dea[_0x6612('0x69')];_0x35867c++){var _0x11d0e6=_0x1b7dea[_0x35867c];if(_0x11d0e6[_0x6612('0x5a')]===_0x6612('0x68')){var _0x4b0a5d=_[_0x6612('0x4c')](_0x51e444,function(_0x58ff1e){return _0x58ff1e['resourceId']===_0x11d0e6['id'];});if(_0x4b0a5d)_0x380e2a[_0x6612('0x6a')](_0x11d0e6);}else{_0x380e2a[_0x6612('0x6a')](_0x11d0e6);}}return _0x380e2a;}});}else{return _0x1b7dea;}}else{var _0x26f735=_[_0x6612('0x41')](_0x1b7dea,function(_0x1690cd){if(_0x1690cd['role']!=='agent'){return _0x1690cd;}});return _0x26f735;}});}else{return _0x1b7dea;}}})[_0x6612('0x29')](function(_0xc88a55){var _0x38cda2=[];if(_0xc88a55){_0x1b0090=_0xc88a55;for(var _0x2d7c46=0x0;_0x2d7c46<_0xc88a55[_0x6612('0x69')];_0x2d7c46+=0x1){_0x1b0090[_0x2d7c46]['messages']=[];_0x38cda2['push'](db[_0x6612('0x30')][_0x6612('0x4c')]({'where':{'FromId':[_0x20d7a2['user']['id'],_0xc88a55[_0x2d7c46]['id']],'ToId':[_0x20d7a2[_0x6612('0x58')]['id'],_0xc88a55[_0x2d7c46]['id']],'ChatGroupId':null},'attributes':['id',_0x6612('0x52'),_0x6612('0x6b'),_0x6612('0x6c'),_0x6612('0x6d'),_0x6612('0x4a')],'order':qs[_0x6612('0x3d')](_0x6612('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6612('0x29')](wrapUser(_0xc88a55[_0x2d7c46])));}return BPromise[_0x6612('0x6f')](_0x38cda2);}return[];})[_0x6612('0x29')](function(_0x244f6e){return{'rows':_0x244f6e,'count':_0x244f6e[_0x6612('0x69')]};})[_0x6612('0x29')](respondWithResult(_0x434859,null))[_0x6612('0x48')](handleError(_0x434859,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 594cf3b..68b7a99 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 _0xc7ec=['../../mysqldb','save','update','remove','hasOwnProperty','exports','events'];(function(_0x31f233,_0x5ed1ab){var _0x4e0203=function(_0x4e45ae){while(--_0x4e45ae){_0x31f233['push'](_0x31f233['shift']());}};_0x4e0203(++_0x5ed1ab);}(_0xc7ec,0x164));var _0xcc7e=function(_0x122633,_0x22057b){_0x122633=_0x122633-0x0;var _0x2d02e5=_0xc7ec[_0x122633];return _0x2d02e5;};'use strict';var EventEmitter=require(_0xcc7e('0x0'));var ChatInternalMessage=require(_0xcc7e('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc7e('0x2'),'afterUpdate':_0xcc7e('0x3'),'afterDestroy':_0xcc7e('0x4')};function emitEvent(_0x67367d){return function(_0x2a7005,_0x2420b0,_0x4168ea){ChatInternalMessageEvents['emit'](_0x67367d+':'+_0x2a7005['id'],_0x2a7005);ChatInternalMessageEvents['emit'](_0x67367d,_0x2a7005);_0x4168ea(null);};}for(var e in events){if(events[_0xcc7e('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xcc7e('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x8a5e=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x4f809a,_0x268445){var _0x24bbd3=function(_0x39e5b3){while(--_0x39e5b3){_0x4f809a['push'](_0x4f809a['shift']());}};_0x24bbd3(++_0x268445);}(_0x8a5e,0xa4));var _0xe8a5=function(_0x1fa856,_0x42d6f6){_0x1fa856=_0x1fa856-0x0;var _0x7e828e=_0x8a5e[_0x1fa856];return _0x7e828e;};'use strict';var EventEmitter=require(_0xe8a5('0x0'));var ChatInternalMessage=require(_0xe8a5('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe8a5('0x2')](0x0);var events={'afterCreate':_0xe8a5('0x3'),'afterUpdate':_0xe8a5('0x4'),'afterDestroy':_0xe8a5('0x5')};function emitEvent(_0x34aaf4){return function(_0x5cddd7,_0x4b726d,_0x300237){ChatInternalMessageEvents[_0xe8a5('0x6')](_0x34aaf4+':'+_0x5cddd7['id'],_0x5cddd7);ChatInternalMessageEvents[_0xe8a5('0x6')](_0x34aaf4,_0x5cddd7);_0x300237(null);};}for(var e in events){if(events[_0xe8a5('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xe8a5('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 e1a5a42..18708cd 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 _0x12d3=['rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xe6b8ed,_0x4e5b4d){var _0x39a1b7=function(_0x2aa3c9){while(--_0x2aa3c9){_0xe6b8ed['push'](_0xe6b8ed['shift']());}};_0x39a1b7(++_0x4e5b4d);}(_0x12d3,0x133));var _0x312d=function(_0x19aa6d,_0x2cb0d0){_0x19aa6d=_0x19aa6d-0x0;var _0x5f4924=_0x12d3[_0x19aa6d];return _0x5f4924;};'use strict';var _=require(_0x312d('0x0'));var util=require(_0x312d('0x1'));var logger=require(_0x312d('0x2'))(_0x312d('0x3'));var moment=require(_0x312d('0x4'));var BPromise=require(_0x312d('0x5'));var rp=require(_0x312d('0x6'));var fs=require('fs');var path=require(_0x312d('0x7'));var rimraf=require(_0x312d('0x8'));var config=require(_0x312d('0x9'));var attributes=require('./chatInternalMessage.attributes');module[_0x312d('0xa')]=function(_0x186de3,_0x3e65df){return _0x186de3[_0x312d('0xb')](_0x312d('0xc'),attributes,{'tableName':_0x312d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x312d('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0343=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x43347e,_0x12f3ac){var _0xcb5363=function(_0xeae5b4){while(--_0xeae5b4){_0x43347e['push'](_0x43347e['shift']());}};_0xcb5363(++_0x12f3ac);}(_0x0343,0x13c));var _0x3034=function(_0x57ee8c,_0xe42849){_0x57ee8c=_0x57ee8c-0x0;var _0x3a2322=_0x0343[_0x57ee8c];return _0x3a2322;};'use strict';var _=require(_0x3034('0x0'));var util=require(_0x3034('0x1'));var logger=require(_0x3034('0x2'))(_0x3034('0x3'));var moment=require(_0x3034('0x4'));var BPromise=require('bluebird');var rp=require(_0x3034('0x5'));var fs=require('fs');var path=require(_0x3034('0x6'));var rimraf=require(_0x3034('0x7'));var config=require(_0x3034('0x8'));var attributes=require(_0x3034('0x9'));module[_0x3034('0xa')]=function(_0x1875a7,_0x1d37b8){return _0x1875a7[_0x3034('0xb')](_0x3034('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index f044903..c9321c6 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 _0xce77=['stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug'];(function(_0x1580f7,_0x5580dc){var _0x147246=function(_0x5661ea){while(--_0x5661ea){_0x1580f7['push'](_0x1580f7['shift']());}};_0x147246(++_0x5580dc);}(_0xce77,0x18e));var _0x7ce7=function(_0xe12f87,_0x40f96b){_0xe12f87=_0xe12f87-0x0;var _0x2bb9f7=_0xce77[_0xe12f87];return _0x2bb9f7;};'use strict';var _=require(_0x7ce7('0x0'));var util=require(_0x7ce7('0x1'));var moment=require(_0x7ce7('0x2'));var BPromise=require(_0x7ce7('0x3'));var rs=require(_0x7ce7('0x4'));var fs=require('fs');var Redis=require(_0x7ce7('0x5'));var db=require(_0x7ce7('0x6'))['db'];var utils=require(_0x7ce7('0x7'));var logger=require(_0x7ce7('0x8'))('rpc');var config=require(_0x7ce7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ce7('0xa')][_0x7ce7('0xb')]({'port':0x232a});config[_0x7ce7('0xc')]=_[_0x7ce7('0xd')](config['redis'],{'host':_0x7ce7('0xe'),'port':0x18eb});var socket=require(_0x7ce7('0xf'))(new Redis(config[_0x7ce7('0xc')]));require(_0x7ce7('0x10'))['register'](socket);function respondWithRpcPromise(_0x50fc7e,_0x5ed452,_0xaba8a0){return new BPromise(function(_0x2bdff8,_0x1a6511){return client[_0x7ce7('0x11')](_0x50fc7e,_0xaba8a0)[_0x7ce7('0x12')](function(_0x1e6cbb){logger[_0x7ce7('0x13')](_0x7ce7('0x14'),_0x5ed452,'request\x20sent');logger[_0x7ce7('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5ed452,'request\x20sent',JSON[_0x7ce7('0x16')](_0x1e6cbb));if(_0x1e6cbb[_0x7ce7('0x17')]){if(_0x1e6cbb['error']['code']===0x1f4){logger[_0x7ce7('0x17')](_0x7ce7('0x14'),_0x5ed452,_0x1e6cbb[_0x7ce7('0x17')][_0x7ce7('0x18')]);return _0x1a6511(_0x1e6cbb[_0x7ce7('0x17')]['message']);}logger[_0x7ce7('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ed452,_0x1e6cbb[_0x7ce7('0x17')][_0x7ce7('0x18')]);return _0x2bdff8(_0x1e6cbb['error'][_0x7ce7('0x18')]);}else{logger['info'](_0x7ce7('0x14'),_0x5ed452,_0x7ce7('0x19'));_0x2bdff8(_0x1e6cbb[_0x7ce7('0x1a')][_0x7ce7('0x18')]);}})[_0x7ce7('0x1b')](function(_0x9ddb24){logger['error'](_0x7ce7('0x14'),_0x5ed452,_0x9ddb24);_0x1a6511(_0x9ddb24);});});} \ No newline at end of file +var _0x8b2d=['localhost','socket.io-emitter','register','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x33deb7,_0x25181a){var _0x3dfeeb=function(_0x310393){while(--_0x310393){_0x33deb7['push'](_0x33deb7['shift']());}};_0x3dfeeb(++_0x25181a);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x2d4521,_0x8d98b6){_0x2d4521=_0x2d4521-0x0;var _0x5d765f=_0x8b2d[_0x2d4521];return _0x5d765f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8b2('0x0'));var BPromise=require('bluebird');var rs=require(_0xd8b2('0x1'));var fs=require('fs');var Redis=require(_0xd8b2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8b2('0x3'));var logger=require(_0xd8b2('0x4'))('rpc');var config=require(_0xd8b2('0x5'));var jayson=require(_0xd8b2('0x6'));var client=jayson[_0xd8b2('0x7')][_0xd8b2('0x8')]({'port':0x232a});config[_0xd8b2('0x9')]=_[_0xd8b2('0xa')](config[_0xd8b2('0x9')],{'host':_0xd8b2('0xb'),'port':0x18eb});var socket=require(_0xd8b2('0xc'))(new Redis(config[_0xd8b2('0x9')]));require('./chatInternalMessage.socket')[_0xd8b2('0xd')](socket);function respondWithRpcPromise(_0x47acb6,_0x2236aa,_0x27c2c2){return new BPromise(function(_0xba39d5,_0x1fd1a7){return client[_0xd8b2('0xe')](_0x47acb6,_0x27c2c2)['then'](function(_0x53298a){logger['info'](_0xd8b2('0xf'),_0x2236aa,_0xd8b2('0x10'));logger[_0xd8b2('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2236aa,_0xd8b2('0x10'),JSON[_0xd8b2('0x12')](_0x53298a));if(_0x53298a[_0xd8b2('0x13')]){if(_0x53298a[_0xd8b2('0x13')]['code']===0x1f4){logger[_0xd8b2('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x2236aa,_0x53298a['error'][_0xd8b2('0x14')]);return _0x1fd1a7(_0x53298a[_0xd8b2('0x13')][_0xd8b2('0x14')]);}logger[_0xd8b2('0x13')](_0xd8b2('0xf'),_0x2236aa,_0x53298a[_0xd8b2('0x13')][_0xd8b2('0x14')]);return _0xba39d5(_0x53298a['error']['message']);}else{logger[_0xd8b2('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2236aa,_0xd8b2('0x10'));_0xba39d5(_0x53298a[_0xd8b2('0x16')][_0xd8b2('0x14')]);}})[_0xd8b2('0x17')](function(_0x2ccbfe){logger['error'](_0xd8b2('0xf'),_0x2236aa,_0x2ccbfe);_0x1fd1a7(_0x2ccbfe);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d4ce3ac..194e2a0 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 _0x0bfa=['save','remove','emit','removeListener','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bfa,0xb9));var _0xa0bf=function(_0x1f6154,_0x91c64e){_0x1f6154=_0x1f6154-0x0;var _0x8326c6=_0x0bfa[_0x1f6154];return _0x8326c6;};'use strict';var ChatInternalMessageEvents=require(_0xa0bf('0x0'));var events=[_0xa0bf('0x1'),_0xa0bf('0x2'),'update'];function createListener(_0x30c2b2,_0x24f681){return function(_0x16cb98){_0x24f681[_0xa0bf('0x3')](_0x30c2b2,_0x16cb98);};}function removeListener(_0x330258,_0x3016e3){return function(){ChatInternalMessageEvents[_0xa0bf('0x4')](_0x330258,_0x3016e3);};}exports['register']=function(_0x3d2ecf){for(var _0x5cffcf=0x0,_0x3aad94=events['length'];_0x5cffcf<_0x3aad94;_0x5cffcf++){var _0x2e3c6d=events[_0x5cffcf];var _0xe3c815=createListener(_0xa0bf('0x5')+_0x2e3c6d,_0x3d2ecf);ChatInternalMessageEvents['on'](_0x2e3c6d,_0xe3c815);}}; \ No newline at end of file +var _0xe2a1=['register','length','chatInternalMessage:','save','update','emit','removeListener'];(function(_0x2a979d,_0x583622){var _0x45e0a0=function(_0x4e7a17){while(--_0x4e7a17){_0x2a979d['push'](_0x2a979d['shift']());}};_0x45e0a0(++_0x583622);}(_0xe2a1,0x176));var _0x1e2a=function(_0x3f8870,_0x44ac68){_0x3f8870=_0x3f8870-0x0;var _0x1e4c60=_0xe2a1[_0x3f8870];return _0x1e4c60;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x1e2a('0x0'),'remove',_0x1e2a('0x1')];function createListener(_0x20271d,_0x589e50){return function(_0x5d2632){_0x589e50[_0x1e2a('0x2')](_0x20271d,_0x5d2632);};}function removeListener(_0x49d1ca,_0x1058df){return function(){ChatInternalMessageEvents[_0x1e2a('0x3')](_0x49d1ca,_0x1058df);};}exports[_0x1e2a('0x4')]=function(_0x1955be){for(var _0x218bb5=0x0,_0x260961=events[_0x1e2a('0x5')];_0x218bb5<_0x260961;_0x218bb5++){var _0x4c99d8=events[_0x218bb5];var _0x4f0df9=createListener(_0x1e2a('0x6')+_0x4c99d8,_0x1955be);ChatInternalMessageEvents['on'](_0x4c99d8,_0x4f0df9);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index dde74a5..3fdf636 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 _0x502d=['create','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','getUsers','show','post'];(function(_0x1ae111,_0x181d78){var _0x329e81=function(_0x3fc4f4){while(--_0x3fc4f4){_0x1ae111['push'](_0x1ae111['shift']());}};_0x329e81(++_0x181d78);}(_0x502d,0x1d1));var _0xd502=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0x502d[_0x4812e0];return _0x252e0f;};'use strict';var multer=require(_0xd502('0x0'));var util=require(_0xd502('0x1'));var path=require(_0xd502('0x2'));var timeout=require('connect-timeout');var express=require(_0xd502('0x3'));var router=express[_0xd502('0x4')]();var fs_extra=require(_0xd502('0x5'));var auth=require(_0xd502('0x6'));var interaction=require(_0xd502('0x7'));var config=require('../../config/environment');var controller=require(_0xd502('0x8'));router['get']('/',auth[_0xd502('0x9')](),controller[_0xd502('0xa')]);router[_0xd502('0xb')](_0xd502('0xc'),auth[_0xd502('0x9')](),controller[_0xd502('0xd')]);router[_0xd502('0xb')](_0xd502('0xe'),auth[_0xd502('0x9')](),controller[_0xd502('0xf')]);router[_0xd502('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xd502('0x10')]);router[_0xd502('0x11')]('/',auth[_0xd502('0x9')](),controller[_0xd502('0x12')]);router['put'](_0xd502('0x13'),controller[_0xd502('0x14')]);router[_0xd502('0x15')](_0xd502('0x13'),auth[_0xd502('0x9')](),controller[_0xd502('0x16')]);module['exports']=router; \ No newline at end of file +var _0xdbd2=['./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','post','delete','/:id','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xdbd2,0x162));var _0x2dbd=function(_0x44b3e3,_0x3371d4){_0x44b3e3=_0x44b3e3-0x0;var _0x3d0afb=_0xdbd2[_0x44b3e3];return _0x3d0afb;};'use strict';var multer=require(_0x2dbd('0x0'));var util=require('util');var path=require(_0x2dbd('0x1'));var timeout=require(_0x2dbd('0x2'));var express=require(_0x2dbd('0x3'));var router=express['Router']();var fs_extra=require(_0x2dbd('0x4'));var auth=require(_0x2dbd('0x5'));var interaction=require(_0x2dbd('0x6'));var config=require('../../config/environment');var controller=require(_0x2dbd('0x7'));router[_0x2dbd('0x8')]('/',auth[_0x2dbd('0x9')](),controller[_0x2dbd('0xa')]);router[_0x2dbd('0x8')](_0x2dbd('0xb'),auth[_0x2dbd('0x9')](),controller[_0x2dbd('0xc')]);router[_0x2dbd('0x8')](_0x2dbd('0xd'),auth[_0x2dbd('0x9')](),controller[_0x2dbd('0xe')]);router[_0x2dbd('0x8')]('/:id',auth[_0x2dbd('0x9')](),controller['show']);router[_0x2dbd('0xf')]('/',auth[_0x2dbd('0x9')](),controller['create']);router['put']('/:id',controller['update']);router[_0x2dbd('0x10')](_0x2dbd('0x11'),auth[_0x2dbd('0x9')](),controller['destroy']);module[_0x2dbd('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 8e0e4af..858bef7 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 _0x173d=['exports','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x5efb4a,_0x39b1ec){var _0x5f31a2=function(_0x2375a7){while(--_0x2375a7){_0x5efb4a['push'](_0x5efb4a['shift']());}};_0x5f31a2(++_0x39b1ec);}(_0x173d,0x108));var _0xd173=function(_0x5e8a79,_0x10d6ae){_0x5e8a79=_0x5e8a79-0x0;var _0x4a856c=_0x173d[_0x5e8a79];return _0x4a856c;};'use strict';var Sequelize=require('sequelize');module[_0xd173('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd173('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd173('0x2')]('in',_0xd173('0x3')),'defaultValue':_0xd173('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd173('0x4')]},'providerName':{'type':Sequelize[_0xd173('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6d0c=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x2f9a0b,_0x507dad){_0x2f9a0b=_0x2f9a0b-0x0;var _0x49c803=_0x6d0c[_0x2f9a0b];return _0x49c803;};'use strict';var Sequelize=require(_0xc6d0('0x0'));module[_0xc6d0('0x1')]={'body':{'type':Sequelize[_0xc6d0('0x2')](_0xc6d0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc6d0('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc6d0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc6d0('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc6d0('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 56c8188..0af3b78 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 _0xa236=['ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatMessage,\x20%s,\x20%s','message','catch','status','offset','undefined','limit','count','set','Content-Range','destroy','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','keys','includeAll','create','body','update','find','describe','accept','chat','acceptMessage','agent','UserId','get','ChatInteraction','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','motionChannel','reject','EventManager','parse','formData','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','chat-interactions','request','then','info','debug'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0xa236,0x1e4));var _0x6a23=function(_0x5c6061,_0x5bb492){_0x5c6061=_0x5c6061-0x0;var _0x396143=_0xa236[_0x5c6061];return _0x396143;};'use strict';var util=require(_0x6a23('0x0'));var _=require(_0x6a23('0x1'));var Redis=require('ioredis');var interactionService=require(_0x6a23('0x2'));var qs=require(_0x6a23('0x3'));var logger=require(_0x6a23('0x4'))(_0x6a23('0x5'));var config=require(_0x6a23('0x6'));var db=require('../../mysqldb')['db'];config[_0x6a23('0x7')]=_[_0x6a23('0x8')](config[_0x6a23('0x7')],{'host':_0x6a23('0x9'),'port':0x18eb});var socket=require(_0x6a23('0xa'))(new Redis(config[_0x6a23('0x7')]));require(_0x6a23('0xb'))[_0x6a23('0xc')](socket);var jayson=require(_0x6a23('0xd'));var client=jayson[_0x6a23('0xe')][_0x6a23('0xf')]({'port':0x232c});var client9002=jayson[_0x6a23('0xe')][_0x6a23('0xf')]({'port':0x232a});var interaction_log=require(_0x6a23('0x4'))(_0x6a23('0x10'));function respondWithRpcPromise(_0xf30835,_0x6f10d1,_0x16d619,_0x2cdbc5){return new Promise(function(_0x129770,_0x2550c7){var _0x7be8ef=_0x2cdbc5||client;return _0x7be8ef[_0x6a23('0x11')](_0xf30835,_0x16d619)[_0x6a23('0x12')](function(_0x460c19){logger[_0x6a23('0x13')]('ChatMessage,\x20%s,\x20%s',_0x6f10d1,'request\x20sent');logger[_0x6a23('0x14')](_0x6a23('0x15'),_0x6f10d1,_0x6a23('0x16'),JSON['stringify'](_0x460c19));if(_0x460c19['error']){if(_0x460c19[_0x6a23('0x17')][_0x6a23('0x18')]===0x1f4){logger['error'](_0x6a23('0x19'),_0x6f10d1,_0x460c19['error'][_0x6a23('0x1a')]);return _0x2550c7(_0x460c19['error'][_0x6a23('0x1a')]);}logger[_0x6a23('0x17')](_0x6a23('0x19'),_0x6f10d1,_0x460c19[_0x6a23('0x17')]['message']);return _0x129770(_0x460c19['error']['message']);}else{logger['info'](_0x6a23('0x19'),_0x6f10d1,_0x6a23('0x16'));_0x129770(_0x460c19['result'][_0x6a23('0x1a')]);}})[_0x6a23('0x1b')](function(_0x1bd598){logger[_0x6a23('0x17')](_0x6a23('0x19'),_0x6f10d1,_0x1bd598);_0x2550c7(_0x1bd598);});});}function respondWithResult(_0x47a754,_0x2b90bf){_0x2b90bf=_0x2b90bf||0xc8;return function(_0x3c1332){if(_0x3c1332){return _0x47a754[_0x6a23('0x1c')](_0x2b90bf)['json'](_0x3c1332);}};}function respondWithFilteredResult(_0x4d0331,_0x2fccf3){return function(_0x37f403){if(_0x37f403){var _0x317f7e=typeof _0x2fccf3[_0x6a23('0x1d')]===_0x6a23('0x1e')&&typeof _0x2fccf3[_0x6a23('0x1f')]===_0x6a23('0x1e');var _0x48de6f=_0x37f403[_0x6a23('0x20')];var _0x128418=_0x317f7e?0x0:_0x2fccf3[_0x6a23('0x1d')];var _0x4cdcd7=_0x317f7e?_0x37f403['count']:_0x2fccf3['offset']+_0x2fccf3[_0x6a23('0x1f')];var _0x38ebd8;if(_0x4cdcd7>=_0x48de6f){_0x4cdcd7=_0x48de6f;_0x38ebd8=0xc8;}else{_0x38ebd8=0xce;}_0x4d0331[_0x6a23('0x1c')](_0x38ebd8);return _0x4d0331[_0x6a23('0x21')](_0x6a23('0x22'),_0x128418+'-'+_0x4cdcd7+'/'+_0x48de6f)['json'](_0x37f403);}return null;};}function saveUpdates(_0x5ab977){return function(_0x23a4f4){if(_0x23a4f4){return _0x23a4f4['update'](_0x5ab977)['then'](function(_0x2d9ab1){return _0x2d9ab1;});}return null;};}function removeEntity(_0x2dadc9){return function(_0x176853){if(_0x176853){return _0x176853[_0x6a23('0x23')]()[_0x6a23('0x12')](function(){_0x2dadc9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xef6300){return function(_0x1d6446){if(!_0x1d6446){_0xef6300['sendStatus'](0x194);}return _0x1d6446;};}function handleError(_0x212646,_0x45b81d){_0x45b81d=_0x45b81d||0x1f4;return function(_0x3f2735){logger[_0x6a23('0x17')](_0x3f2735['stack']);if(_0x3f2735[_0x6a23('0x24')]){delete _0x3f2735[_0x6a23('0x24')];}_0x212646['status'](_0x45b81d)[_0x6a23('0x25')](_0x3f2735);};}exports[_0x6a23('0x26')]=function(_0x4656f1,_0x48ffcb){var _0x1a3c12={},_0x2bcecd={},_0x50c71d={'count':0x0,'rows':[]};var _0x527cef=_[_0x6a23('0x27')](db[_0x6a23('0x28')][_0x6a23('0x29')],function(_0x58bef6){return{'name':_0x58bef6[_0x6a23('0x2a')],'type':_0x58bef6[_0x6a23('0x2b')][_0x6a23('0x2c')]};});_0x2bcecd[_0x6a23('0x2d')]=_['map'](_0x527cef,_0x6a23('0x24'));_0x2bcecd[_0x6a23('0x2e')]=_['keys'](_0x4656f1[_0x6a23('0x2e')]);_0x2bcecd[_0x6a23('0x2f')]=_['intersection'](_0x2bcecd['model'],_0x2bcecd[_0x6a23('0x2e')]);_0x1a3c12[_0x6a23('0x30')]=_[_0x6a23('0x31')](_0x2bcecd['model'],qs[_0x6a23('0x32')](_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x32')]));_0x1a3c12[_0x6a23('0x30')]=_0x1a3c12[_0x6a23('0x30')][_0x6a23('0x33')]?_0x1a3c12[_0x6a23('0x30')]:_0x2bcecd[_0x6a23('0x2d')];if(!_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x34')](_0x6a23('0x35'))){_0x1a3c12['limit']=qs[_0x6a23('0x1f')](_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x1f')]);_0x1a3c12[_0x6a23('0x1d')]=qs[_0x6a23('0x1d')](_0x4656f1['query'][_0x6a23('0x1d')]);}_0x1a3c12['order']=qs['sort'](_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x36')]);_0x1a3c12[_0x6a23('0x37')]=qs[_0x6a23('0x2f')](_[_0x6a23('0x38')](_0x4656f1[_0x6a23('0x2e')],_0x2bcecd[_0x6a23('0x2f')]),_0x527cef);if(_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x39')]){_0x1a3c12[_0x6a23('0x37')]=_['merge'](_0x1a3c12[_0x6a23('0x37')],{'$or':_[_0x6a23('0x27')](_0x527cef,function(_0x4ccfff){if(_0x4ccfff[_0x6a23('0x2b')]!==_0x6a23('0x3a')){var _0x274bf6={};_0x274bf6[_0x4ccfff[_0x6a23('0x24')]]={'$like':'%'+_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x39')]+'%'};return _0x274bf6;}})});}_0x1a3c12=_[_0x6a23('0x3b')]({},_0x1a3c12,_0x4656f1[_0x6a23('0x3c')]);var _0x57c68c={'where':_0x1a3c12[_0x6a23('0x37')]};return db[_0x6a23('0x28')][_0x6a23('0x20')](_0x57c68c)[_0x6a23('0x12')](function(_0x16e42f){_0x50c71d['count']=_0x16e42f;if(_0x4656f1[_0x6a23('0x2e')]['includeAll']){_0x1a3c12[_0x6a23('0x3d')]=[{'all':!![]}];}return db[_0x6a23('0x28')]['findAll'](_0x1a3c12);})[_0x6a23('0x12')](function(_0x2ff62f){_0x50c71d[_0x6a23('0x3e')]=_0x2ff62f;return _0x50c71d;})['then'](respondWithFilteredResult(_0x48ffcb,_0x1a3c12))[_0x6a23('0x1b')](handleError(_0x48ffcb,null));};exports[_0x6a23('0x3f')]=function(_0x22dfc5,_0x4acd1e){var _0xc0304={'raw':!![],'where':{'id':_0x22dfc5[_0x6a23('0x40')]['id']}},_0x82a9d1={};_0x82a9d1[_0x6a23('0x2d')]=_['keys'](db[_0x6a23('0x28')][_0x6a23('0x29')]);_0x82a9d1[_0x6a23('0x2e')]=_[_0x6a23('0x41')](_0x22dfc5['query']);_0x82a9d1[_0x6a23('0x2f')]=_[_0x6a23('0x31')](_0x82a9d1[_0x6a23('0x2d')],_0x82a9d1[_0x6a23('0x2e')]);_0xc0304['attributes']=_[_0x6a23('0x31')](_0x82a9d1[_0x6a23('0x2d')],qs[_0x6a23('0x32')](_0x22dfc5[_0x6a23('0x2e')][_0x6a23('0x32')]));_0xc0304['attributes']=_0xc0304['attributes'][_0x6a23('0x33')]?_0xc0304[_0x6a23('0x30')]:_0x82a9d1[_0x6a23('0x2d')];if(_0x22dfc5[_0x6a23('0x2e')][_0x6a23('0x42')]){_0xc0304['include']=[{'all':!![]}];}_0xc0304=_[_0x6a23('0x3b')]({},_0xc0304,_0x22dfc5[_0x6a23('0x3c')]);return db[_0x6a23('0x28')]['find'](_0xc0304)['then'](handleEntityNotFound(_0x4acd1e,null))[_0x6a23('0x12')](respondWithResult(_0x4acd1e,null))[_0x6a23('0x1b')](handleError(_0x4acd1e,null));};exports[_0x6a23('0x43')]=function(_0x1290a8,_0x538eea){return db[_0x6a23('0x28')][_0x6a23('0x43')](_0x1290a8[_0x6a23('0x44')],{})['then'](respondWithResult(_0x538eea,0xc9))[_0x6a23('0x1b')](handleError(_0x538eea,null));};exports[_0x6a23('0x45')]=function(_0x58781f,_0x1ac2ed){if(_0x58781f['body']['id']){delete _0x58781f['body']['id'];}return db['ChatMessage'][_0x6a23('0x46')]({'where':{'id':_0x58781f['params']['id']}})[_0x6a23('0x12')](handleEntityNotFound(_0x1ac2ed,null))['then'](saveUpdates(_0x58781f['body'],null))[_0x6a23('0x12')](respondWithResult(_0x1ac2ed,null))[_0x6a23('0x1b')](handleError(_0x1ac2ed,null));};exports[_0x6a23('0x23')]=function(_0x40bdce,_0x448910){return db[_0x6a23('0x28')]['find']({'where':{'id':_0x40bdce[_0x6a23('0x40')]['id']}})[_0x6a23('0x12')](handleEntityNotFound(_0x448910,null))[_0x6a23('0x12')](removeEntity(_0x448910,null))['catch'](handleError(_0x448910,null));};exports[_0x6a23('0x47')]=function(_0x13e574,_0x8dbadc){return db['ChatMessage'][_0x6a23('0x47')]()[_0x6a23('0x12')](respondWithResult(_0x8dbadc,null))[_0x6a23('0x1b')](handleError(_0x8dbadc,null));};exports[_0x6a23('0x48')]=function(_0x480dae,_0x5b5bbc){var _0x1aa4e6=_0x6a23('0x49');return interactionService[_0x6a23('0x4a')](_0x480dae,_0x1aa4e6)[_0x6a23('0x12')](respondWithResult(_0x5b5bbc,null))[_0x6a23('0x1b')](handleError(_0x5b5bbc,null));};exports['reject']=function(_0x1f97a2,_0x503099){var _0x305222={'agent':{},'channel':_0x6a23('0x49')};if(_0x1f97a2[_0x6a23('0x44')]['id']){delete _0x1f97a2['body']['id'];}_0x1f97a2['body']['UserId']=_0x1f97a2['body']['UserId']||_0x1f97a2['user']['id'];_0x305222[_0x6a23('0x4b')]['id']=_0x1f97a2['body'][_0x6a23('0x4c')];return db[_0x6a23('0x28')][_0x6a23('0x46')]({'where':{'id':_0x1f97a2[_0x6a23('0x40')]['id'],'UserId':null}})[_0x6a23('0x12')](handleEntityNotFound(_0x503099,null))[_0x6a23('0x12')](function(_0x4845e0){if(_0x4845e0){_0x305222[_0x6a23('0x1a')]=_0x4845e0[_0x6a23('0x4d')]({'plain':!![]});return db[_0x6a23('0x4e')][_0x6a23('0x46')]({'where':{'id':_0x4845e0['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x503099,null))[_0x6a23('0x12')](function(_0x4b8f2a){if(_0x4b8f2a){_0x305222[_0x6a23('0x4f')]=_0x4b8f2a[_0x6a23('0x4d')]({'plain':!![]});interaction_log[_0x6a23('0x13')](_0x6a23('0x50'),_0x1f97a2[_0x6a23('0x51')]['id'],_0x1f97a2['user'][_0x6a23('0x24')],_0x1f97a2[_0x6a23('0x51')][_0x6a23('0x52')],_0x305222[_0x6a23('0x4f')]['id'],_0x1f97a2['body']?JSON[_0x6a23('0x53')](_0x1f97a2['body']):_0x6a23('0x54'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x305222);}return null;})[_0x6a23('0x12')](function(_0x46b322){var _0x1671ad=_0x6a23('0x55')+_0x46b322['message'][_0x6a23('0x56')];return db['sequelize'][_0x6a23('0x2e')](_0x1671ad,{'type':db[_0x6a23('0x57')]['QueryTypes'][_0x6a23('0x58')],'raw':!![]})[_0x6a23('0x12')](function(_0x1dc9af){return _0x1dc9af;});})[_0x6a23('0x12')](function(_0x1b9b67){if(_0x1b9b67){_0x305222[_0x6a23('0x1a')][_0x6a23('0x59')]=_0x1b9b67[0x0];if(!_0x1f97a2[_0x6a23('0x44')][_0x6a23('0x4c')])return;return db[_0x6a23('0x5a')][_0x6a23('0x46')]({'where':{'id':_0x1f97a2['body'][_0x6a23('0x4c')],'role':_0x6a23('0x4b')},'attributes':['id',_0x6a23('0x24'),_0x6a23('0x5b'),'email',_0x6a23('0x5c')],'raw':!![]});}return null;})[_0x6a23('0x12')](function(_0x8a088c){if(!_0x8a088c)return null;_0x305222[_0x6a23('0x1a')]['agent']=_0x8a088c;return _0x305222;})[_0x6a23('0x12')](function(_0x3f892f){if(_0x3f892f){_0x3f892f[_0x6a23('0x1a')][_0x6a23('0x5d')]=util[_0x6a23('0x5e')](_0x6a23('0x5f'),_0x1f97a2[_0x6a23('0x51')][_0x6a23('0x24')]);_0x3f892f[_0x6a23('0x1a')]['channel']=_0x305222['channel'];_0x3f892f[_0x6a23('0x1a')][_0x6a23('0x60')]=_0x305222['channel'];_0x3f892f[_0x6a23('0x1a')]['event']=_0x6a23('0x61');respondWithRpcPromise(_0x6a23('0x62'),_0x6a23('0x62'),{'event':'rejectmessage','message':_[_0x6a23('0x3b')](_0x305222[_0x6a23('0x1a')],JSON[_0x6a23('0x63')](_0x305222[_0x6a23('0x4f')][_0x6a23('0x64')]))},client9002);return _0x305222;}return null;})[_0x6a23('0x12')](respondWithResult(_0x503099,null))[_0x6a23('0x1b')](handleError(_0x503099,null));}; \ No newline at end of file +var _0xfafc=['http','chat-interactions','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','offset','undefined','limit','count','set','json','update','destroy','end','send','index','map','ChatMessage','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','catch','show','params','merge','options','create','body','find','describe','accept','chat','UserId','user','agent','get','ChatInteraction','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','fullname','interface','format','name','channel','event','reject','EventManager','rejectmessage','formData','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xfafc,0xb0));var _0xcfaf=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xfafc[_0x31eb67];return _0x2a8cb8;};'use strict';var util=require('util');var _=require(_0xcfaf('0x0'));var Redis=require(_0xcfaf('0x1'));var interactionService=require(_0xcfaf('0x2'));var qs=require(_0xcfaf('0x3'));var logger=require(_0xcfaf('0x4'))('api');var config=require(_0xcfaf('0x5'));var db=require(_0xcfaf('0x6'))['db'];config[_0xcfaf('0x7')]=_[_0xcfaf('0x8')](config['redis'],{'host':_0xcfaf('0x9'),'port':0x18eb});var socket=require(_0xcfaf('0xa'))(new Redis(config[_0xcfaf('0x7')]));require(_0xcfaf('0xb'))['register'](socket);var jayson=require(_0xcfaf('0xc'));var client=jayson[_0xcfaf('0xd')][_0xcfaf('0xe')]({'port':0x232c});var client9002=jayson[_0xcfaf('0xd')][_0xcfaf('0xe')]({'port':0x232a});var interaction_log=require(_0xcfaf('0x4'))(_0xcfaf('0xf'));function respondWithRpcPromise(_0x303dd,_0x5bc1de,_0x4c5a28,_0x9770af){return new Promise(function(_0x1b55fd,_0x2fa689){var _0x52ea4a=_0x9770af||client;return _0x52ea4a[_0xcfaf('0x10')](_0x303dd,_0x4c5a28)[_0xcfaf('0x11')](function(_0x229f90){logger[_0xcfaf('0x12')](_0xcfaf('0x13'),_0x5bc1de,_0xcfaf('0x14'));logger[_0xcfaf('0x15')](_0xcfaf('0x16'),_0x5bc1de,_0xcfaf('0x14'),JSON['stringify'](_0x229f90));if(_0x229f90['error']){if(_0x229f90[_0xcfaf('0x17')][_0xcfaf('0x18')]===0x1f4){logger[_0xcfaf('0x17')](_0xcfaf('0x13'),_0x5bc1de,_0x229f90[_0xcfaf('0x17')][_0xcfaf('0x19')]);return _0x2fa689(_0x229f90[_0xcfaf('0x17')]['message']);}logger[_0xcfaf('0x17')]('ChatMessage,\x20%s,\x20%s',_0x5bc1de,_0x229f90['error'][_0xcfaf('0x19')]);return _0x1b55fd(_0x229f90[_0xcfaf('0x17')][_0xcfaf('0x19')]);}else{logger[_0xcfaf('0x12')](_0xcfaf('0x13'),_0x5bc1de,_0xcfaf('0x14'));_0x1b55fd(_0x229f90['result'][_0xcfaf('0x19')]);}})['catch'](function(_0x2c546e){logger['error'](_0xcfaf('0x13'),_0x5bc1de,_0x2c546e);_0x2fa689(_0x2c546e);});});}function respondWithResult(_0x251007,_0x107bef){_0x107bef=_0x107bef||0xc8;return function(_0x597a54){if(_0x597a54){return _0x251007[_0xcfaf('0x1a')](_0x107bef)['json'](_0x597a54);}};}function respondWithFilteredResult(_0x206a44,_0x10114f){return function(_0x245c03){if(_0x245c03){var _0x258d80=typeof _0x10114f[_0xcfaf('0x1b')]===_0xcfaf('0x1c')&&typeof _0x10114f[_0xcfaf('0x1d')]===_0xcfaf('0x1c');var _0x3c7426=_0x245c03[_0xcfaf('0x1e')];var _0x1f88a5=_0x258d80?0x0:_0x10114f[_0xcfaf('0x1b')];var _0x757845=_0x258d80?_0x245c03[_0xcfaf('0x1e')]:_0x10114f['offset']+_0x10114f[_0xcfaf('0x1d')];var _0x216cfc;if(_0x757845>=_0x3c7426){_0x757845=_0x3c7426;_0x216cfc=0xc8;}else{_0x216cfc=0xce;}_0x206a44['status'](_0x216cfc);return _0x206a44[_0xcfaf('0x1f')]('Content-Range',_0x1f88a5+'-'+_0x757845+'/'+_0x3c7426)[_0xcfaf('0x20')](_0x245c03);}return null;};}function saveUpdates(_0x16d857){return function(_0x32dda2){if(_0x32dda2){return _0x32dda2[_0xcfaf('0x21')](_0x16d857)[_0xcfaf('0x11')](function(_0x102536){return _0x102536;});}return null;};}function removeEntity(_0x18f8f7){return function(_0x53985c){if(_0x53985c){return _0x53985c[_0xcfaf('0x22')]()[_0xcfaf('0x11')](function(){_0x18f8f7[_0xcfaf('0x1a')](0xcc)[_0xcfaf('0x23')]();});}};}function handleEntityNotFound(_0x58edbc){return function(_0x1b5d26){if(!_0x1b5d26){_0x58edbc['sendStatus'](0x194);}return _0x1b5d26;};}function handleError(_0x57da55,_0x1a1e49){_0x1a1e49=_0x1a1e49||0x1f4;return function(_0x36a066){logger[_0xcfaf('0x17')](_0x36a066['stack']);if(_0x36a066['name']){delete _0x36a066['name'];}_0x57da55['status'](_0x1a1e49)[_0xcfaf('0x24')](_0x36a066);};}exports[_0xcfaf('0x25')]=function(_0x45e066,_0x1bf1a9){var _0x49efa2={},_0x3f5aea={},_0x31a7cc={'count':0x0,'rows':[]};var _0x1632ee=_[_0xcfaf('0x26')](db[_0xcfaf('0x27')][_0xcfaf('0x28')],function(_0x2c179a){return{'name':_0x2c179a[_0xcfaf('0x29')],'type':_0x2c179a['type']['key']};});_0x3f5aea[_0xcfaf('0x2a')]=_[_0xcfaf('0x26')](_0x1632ee,'name');_0x3f5aea['query']=_[_0xcfaf('0x2b')](_0x45e066[_0xcfaf('0x2c')]);_0x3f5aea[_0xcfaf('0x2d')]=_['intersection'](_0x3f5aea['model'],_0x3f5aea[_0xcfaf('0x2c')]);_0x49efa2[_0xcfaf('0x2e')]=_[_0xcfaf('0x2f')](_0x3f5aea['model'],qs[_0xcfaf('0x30')](_0x45e066[_0xcfaf('0x2c')][_0xcfaf('0x30')]));_0x49efa2[_0xcfaf('0x2e')]=_0x49efa2[_0xcfaf('0x2e')][_0xcfaf('0x31')]?_0x49efa2['attributes']:_0x3f5aea['model'];if(!_0x45e066[_0xcfaf('0x2c')]['hasOwnProperty'](_0xcfaf('0x32'))){_0x49efa2['limit']=qs[_0xcfaf('0x1d')](_0x45e066['query']['limit']);_0x49efa2[_0xcfaf('0x1b')]=qs[_0xcfaf('0x1b')](_0x45e066[_0xcfaf('0x2c')]['offset']);}_0x49efa2[_0xcfaf('0x33')]=qs['sort'](_0x45e066[_0xcfaf('0x2c')][_0xcfaf('0x34')]);_0x49efa2[_0xcfaf('0x35')]=qs[_0xcfaf('0x2d')](_[_0xcfaf('0x36')](_0x45e066[_0xcfaf('0x2c')],_0x3f5aea[_0xcfaf('0x2d')]),_0x1632ee);if(_0x45e066['query'][_0xcfaf('0x37')]){_0x49efa2[_0xcfaf('0x35')]=_['merge'](_0x49efa2[_0xcfaf('0x35')],{'$or':_[_0xcfaf('0x26')](_0x1632ee,function(_0x35fb74){if(_0x35fb74['type']!==_0xcfaf('0x38')){var _0xd0e6bc={};_0xd0e6bc[_0x35fb74['name']]={'$like':'%'+_0x45e066[_0xcfaf('0x2c')][_0xcfaf('0x37')]+'%'};return _0xd0e6bc;}})});}_0x49efa2=_['merge']({},_0x49efa2,_0x45e066['options']);var _0x5ffadb={'where':_0x49efa2[_0xcfaf('0x35')]};return db[_0xcfaf('0x27')][_0xcfaf('0x1e')](_0x5ffadb)['then'](function(_0x27a59e){_0x31a7cc[_0xcfaf('0x1e')]=_0x27a59e;if(_0x45e066['query'][_0xcfaf('0x39')]){_0x49efa2[_0xcfaf('0x3a')]=[{'all':!![]}];}return db[_0xcfaf('0x27')]['findAll'](_0x49efa2);})['then'](function(_0x4966a9){_0x31a7cc['rows']=_0x4966a9;return _0x31a7cc;})[_0xcfaf('0x11')](respondWithFilteredResult(_0x1bf1a9,_0x49efa2))[_0xcfaf('0x3b')](handleError(_0x1bf1a9,null));};exports[_0xcfaf('0x3c')]=function(_0x4f0ba2,_0x4ad7af){var _0x4f1b73={'raw':!![],'where':{'id':_0x4f0ba2[_0xcfaf('0x3d')]['id']}},_0x18945d={};_0x18945d[_0xcfaf('0x2a')]=_[_0xcfaf('0x2b')](db[_0xcfaf('0x27')][_0xcfaf('0x28')]);_0x18945d[_0xcfaf('0x2c')]=_['keys'](_0x4f0ba2[_0xcfaf('0x2c')]);_0x18945d[_0xcfaf('0x2d')]=_[_0xcfaf('0x2f')](_0x18945d['model'],_0x18945d['query']);_0x4f1b73[_0xcfaf('0x2e')]=_['intersection'](_0x18945d[_0xcfaf('0x2a')],qs[_0xcfaf('0x30')](_0x4f0ba2['query'][_0xcfaf('0x30')]));_0x4f1b73[_0xcfaf('0x2e')]=_0x4f1b73[_0xcfaf('0x2e')][_0xcfaf('0x31')]?_0x4f1b73[_0xcfaf('0x2e')]:_0x18945d[_0xcfaf('0x2a')];if(_0x4f0ba2[_0xcfaf('0x2c')][_0xcfaf('0x39')]){_0x4f1b73[_0xcfaf('0x3a')]=[{'all':!![]}];}_0x4f1b73=_[_0xcfaf('0x3e')]({},_0x4f1b73,_0x4f0ba2[_0xcfaf('0x3f')]);return db[_0xcfaf('0x27')]['find'](_0x4f1b73)[_0xcfaf('0x11')](handleEntityNotFound(_0x4ad7af,null))[_0xcfaf('0x11')](respondWithResult(_0x4ad7af,null))[_0xcfaf('0x3b')](handleError(_0x4ad7af,null));};exports[_0xcfaf('0x40')]=function(_0x41e113,_0xd7a8d8){return db[_0xcfaf('0x27')][_0xcfaf('0x40')](_0x41e113['body'],{})[_0xcfaf('0x11')](respondWithResult(_0xd7a8d8,0xc9))[_0xcfaf('0x3b')](handleError(_0xd7a8d8,null));};exports[_0xcfaf('0x21')]=function(_0x53007b,_0x2ccb32){if(_0x53007b['body']['id']){delete _0x53007b[_0xcfaf('0x41')]['id'];}return db[_0xcfaf('0x27')][_0xcfaf('0x42')]({'where':{'id':_0x53007b[_0xcfaf('0x3d')]['id']}})[_0xcfaf('0x11')](handleEntityNotFound(_0x2ccb32,null))[_0xcfaf('0x11')](saveUpdates(_0x53007b[_0xcfaf('0x41')],null))['then'](respondWithResult(_0x2ccb32,null))[_0xcfaf('0x3b')](handleError(_0x2ccb32,null));};exports[_0xcfaf('0x22')]=function(_0x509515,_0xc3bd7a){return db[_0xcfaf('0x27')][_0xcfaf('0x42')]({'where':{'id':_0x509515[_0xcfaf('0x3d')]['id']}})[_0xcfaf('0x11')](handleEntityNotFound(_0xc3bd7a,null))[_0xcfaf('0x11')](removeEntity(_0xc3bd7a,null))['catch'](handleError(_0xc3bd7a,null));};exports[_0xcfaf('0x43')]=function(_0x50cd6e,_0x497dda){return db[_0xcfaf('0x27')][_0xcfaf('0x43')]()[_0xcfaf('0x11')](respondWithResult(_0x497dda,null))[_0xcfaf('0x3b')](handleError(_0x497dda,null));};exports[_0xcfaf('0x44')]=function(_0x52556c,_0x5802da){var _0x5a0476=_0xcfaf('0x45');return interactionService['acceptMessage'](_0x52556c,_0x5a0476)[_0xcfaf('0x11')](respondWithResult(_0x5802da,null))[_0xcfaf('0x3b')](handleError(_0x5802da,null));};exports['reject']=function(_0x2bb86f,_0x2eee4d){var _0x4fd195={'agent':{},'channel':_0xcfaf('0x45')};if(_0x2bb86f['body']['id']){delete _0x2bb86f[_0xcfaf('0x41')]['id'];}_0x2bb86f[_0xcfaf('0x41')][_0xcfaf('0x46')]=_0x2bb86f[_0xcfaf('0x41')][_0xcfaf('0x46')]||_0x2bb86f[_0xcfaf('0x47')]['id'];_0x4fd195[_0xcfaf('0x48')]['id']=_0x2bb86f[_0xcfaf('0x41')][_0xcfaf('0x46')];return db[_0xcfaf('0x27')][_0xcfaf('0x42')]({'where':{'id':_0x2bb86f['params']['id'],'UserId':null}})[_0xcfaf('0x11')](handleEntityNotFound(_0x2eee4d,null))[_0xcfaf('0x11')](function(_0x179bc4){if(_0x179bc4){_0x4fd195[_0xcfaf('0x19')]=_0x179bc4[_0xcfaf('0x49')]({'plain':!![]});return db[_0xcfaf('0x4a')]['find']({'where':{'id':_0x179bc4['ChatInteractionId']}});}return null;})[_0xcfaf('0x11')](handleEntityNotFound(_0x2eee4d,null))[_0xcfaf('0x11')](function(_0x19ca43){if(_0x19ca43){_0x4fd195[_0xcfaf('0x4b')]=_0x19ca43[_0xcfaf('0x49')]({'plain':!![]});interaction_log[_0xcfaf('0x12')](_0xcfaf('0x4c'),_0x2bb86f[_0xcfaf('0x47')]['id'],_0x2bb86f['user']['name'],_0x2bb86f[_0xcfaf('0x47')]['role'],_0x4fd195[_0xcfaf('0x4b')]['id'],_0x2bb86f[_0xcfaf('0x41')]?JSON[_0xcfaf('0x4d')](_0x2bb86f['body']):_0xcfaf('0x4e'));return respondWithRpcPromise('RejectMessage',_0xcfaf('0x4f'),_0x4fd195);}return null;})['then'](function(_0x4c8502){var _0x29f8cd=_0xcfaf('0x50')+_0x4c8502[_0xcfaf('0x19')]['ContactId'];return db['sequelize'][_0xcfaf('0x2c')](_0x29f8cd,{'type':db[_0xcfaf('0x51')][_0xcfaf('0x52')]['SELECT'],'raw':!![]})[_0xcfaf('0x11')](function(_0x238485){return _0x238485;});})[_0xcfaf('0x11')](function(_0x1965c1){if(_0x1965c1){_0x4fd195[_0xcfaf('0x19')][_0xcfaf('0x53')]=_0x1965c1[0x0];if(!_0x2bb86f[_0xcfaf('0x41')]['UserId'])return;return db[_0xcfaf('0x54')][_0xcfaf('0x42')]({'where':{'id':_0x2bb86f[_0xcfaf('0x41')][_0xcfaf('0x46')],'role':_0xcfaf('0x48')},'attributes':['id','name',_0xcfaf('0x55'),'email','internal'],'raw':!![]});}return null;})[_0xcfaf('0x11')](function(_0x3f1684){if(!_0x3f1684)return null;_0x4fd195['message'][_0xcfaf('0x48')]=_0x3f1684;return _0x4fd195;})[_0xcfaf('0x11')](function(_0x1724c8){if(_0x1724c8){_0x1724c8[_0xcfaf('0x19')][_0xcfaf('0x56')]=util[_0xcfaf('0x57')]('SIP/%s',_0x2bb86f[_0xcfaf('0x47')][_0xcfaf('0x58')]);_0x1724c8[_0xcfaf('0x19')][_0xcfaf('0x59')]=_0x4fd195[_0xcfaf('0x59')];_0x1724c8[_0xcfaf('0x19')]['motionChannel']=_0x4fd195[_0xcfaf('0x59')];_0x1724c8[_0xcfaf('0x19')][_0xcfaf('0x5a')]=_0xcfaf('0x5b');respondWithRpcPromise(_0xcfaf('0x5c'),'EventManager',{'event':_0xcfaf('0x5d'),'message':_[_0xcfaf('0x3e')](_0x4fd195[_0xcfaf('0x19')],JSON['parse'](_0x4fd195[_0xcfaf('0x4b')][_0xcfaf('0x5e')]))},client9002);return _0x4fd195;}return null;})[_0xcfaf('0x11')](respondWithResult(_0x2eee4d,null))[_0xcfaf('0x3b')](handleError(_0x2eee4d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 6b055b1..bce03a2 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 _0x20ad=['emit','hook','exports','events','ChatMessage','setMaxListeners','save','update'];(function(_0x31e7dd,_0xd5691d){var _0x16062f=function(_0x11625e){while(--_0x11625e){_0x31e7dd['push'](_0x31e7dd['shift']());}};_0x16062f(++_0xd5691d);}(_0x20ad,0x1db));var _0xd20a=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x20ad[_0x20c9b2];return _0x2c6030;};'use strict';var EventEmitter=require(_0xd20a('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xd20a('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd20a('0x2')](0x0);var events={'afterCreate':_0xd20a('0x3'),'afterUpdate':_0xd20a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x141cf5){return function(_0x2ce50b,_0x4c7df4,_0x2206eb){ChatMessageEvents[_0xd20a('0x5')](_0x141cf5+':'+_0x2ce50b['id'],_0x2ce50b);ChatMessageEvents[_0xd20a('0x5')](_0x141cf5,_0x2ce50b);_0x2206eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xd20a('0x6')](e,emitEvent(event));}}module[_0xd20a('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x5900=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0xe1d842,_0x5a5c77){var _0x3b1074=function(_0x37194d){while(--_0x37194d){_0xe1d842['push'](_0xe1d842['shift']());}};_0x3b1074(++_0x5a5c77);}(_0x5900,0x6e));var _0x0590=function(_0x3231ee,_0x44e1ef){_0x3231ee=_0x3231ee-0x0;var _0x2092f1=_0x5900[_0x3231ee];return _0x2092f1;};'use strict';var EventEmitter=require(_0x0590('0x0'));var ChatMessage=require(_0x0590('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0590('0x2')](0x0);var events={'afterCreate':_0x0590('0x3'),'afterUpdate':_0x0590('0x4'),'afterDestroy':_0x0590('0x5')};function emitEvent(_0x54fabc){return function(_0x176864,_0x5e5f43,_0x129a21){ChatMessageEvents['emit'](_0x54fabc+':'+_0x176864['id'],_0x176864);ChatMessageEvents[_0x0590('0x6')](_0x54fabc,_0x176864);_0x129a21(null);};}for(var e in events){if(events[_0x0590('0x7')](e)){var event=events[e];ChatMessage[_0x0590('0x8')](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 000d5a5..ba18e86 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 _0x4a25=['exports','ChatMessage','chat_messages','fti_chat_messages','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x4a25,0x1d4));var _0x54a2=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x4a25[_0x2353fe];return _0x4d43f6;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'paranoid':![],'indexes':[{'name':_0x54a2('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d0334,_0x5db8dc,_0x466c88){var _0x28655c=_0x3ecde5['models'];var _0x38a9f5=_0x3d0334[_0x54a2('0xc')]({'plain':!![]});if(_0x38a9f5['direction'][_0x54a2('0xd')]()==='in'||_0x38a9f5[_0x54a2('0xe')]['toLowerCase']()===_0x54a2('0xf')&&!_0x38a9f5[_0x54a2('0x10')]&&!_[_0x54a2('0x11')](_0x38a9f5[_0x54a2('0x12')])){_0x28655c[_0x54a2('0x13')][_0x54a2('0x14')]({'where':{'id':_0x38a9f5[_0x54a2('0x15')]}})[_0x54a2('0x16')](function(_0x5e5786){if(_0x5e5786){_0x5e5786[_0x54a2('0x17')]({'lastMsgAt':_0x38a9f5['createdAt'],'lastMsgDirection':_0x38a9f5[_0x54a2('0xe')][_0x54a2('0xd')]()});}})[_0x54a2('0x18')](function(_0x1fcc41){console[_0x54a2('0x19')](_0x1fcc41);});}_0x466c88();}},'charset':_0x54a2('0x1a'),'collate':_0x54a2('0x1b')});}; \ No newline at end of file +var _0xd2e5=['secret','UserId','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction'];(function(_0x2b032d,_0x2273bc){var _0x35f8f0=function(_0x596795){while(--_0x596795){_0x2b032d['push'](_0x2b032d['shift']());}};_0x35f8f0(++_0x2273bc);}(_0xd2e5,0x1cc));var _0x5d2e=function(_0x230dd3,_0x26024b){_0x230dd3=_0x230dd3-0x0;var _0x7987fa=_0xd2e5[_0x230dd3];return _0x7987fa;};'use strict';var _=require('lodash');var util=require(_0x5d2e('0x0'));var logger=require(_0x5d2e('0x1'))(_0x5d2e('0x2'));var moment=require(_0x5d2e('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d2e('0x4'));var fs=require('fs');var path=require(_0x5d2e('0x5'));var rimraf=require(_0x5d2e('0x6'));var config=require(_0x5d2e('0x7'));var attributes=require(_0x5d2e('0x8'));module[_0x5d2e('0x9')]=function(_0x392cb0,_0x31eb59){return _0x392cb0[_0x5d2e('0xa')](_0x5d2e('0xb'),attributes,{'tableName':_0x5d2e('0xc'),'paranoid':![],'indexes':[{'name':_0x5d2e('0xd'),'fields':[_0x5d2e('0xe')],'type':_0x5d2e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29cf36,_0x19e70b,_0x284b24){var _0x201fa6=_0x392cb0[_0x5d2e('0x10')];var _0x61cae8=_0x29cf36[_0x5d2e('0x11')]({'plain':!![]});if(_0x61cae8['direction'][_0x5d2e('0x12')]()==='in'||_0x61cae8[_0x5d2e('0x13')][_0x5d2e('0x12')]()==='out'&&!_0x61cae8[_0x5d2e('0x14')]&&!_['isNil'](_0x61cae8[_0x5d2e('0x15')])){_0x201fa6['ChatInteraction'][_0x5d2e('0x16')]({'where':{'id':_0x61cae8['ChatInteractionId']}})[_0x5d2e('0x17')](function(_0x3ca6cf){if(_0x3ca6cf){_0x3ca6cf[_0x5d2e('0x18')]({'lastMsgAt':_0x61cae8[_0x5d2e('0x19')],'lastMsgDirection':_0x61cae8[_0x5d2e('0x13')][_0x5d2e('0x12')]()});}})[_0x5d2e('0x1a')](function(_0x1d3ddc){console[_0x5d2e('0x1b')](_0x1d3ddc);});}_0x284b24();}},'charset':_0x5d2e('0x1c'),'collate':_0x5d2e('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 604952a..4ffd756 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 _0xe982=['body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','create'];(function(_0x34d546,_0x16f762){var _0x20fd3e=function(_0x1b07f6){while(--_0x1b07f6){_0x34d546['push'](_0x34d546['shift']());}};_0x20fd3e(++_0x16f762);}(_0xe982,0x112));var _0x2e98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe982[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x2e98('0x0'));var util=require(_0x2e98('0x1'));var moment=require(_0x2e98('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e98('0x3'));var fs=require('fs');var Redis=require(_0x2e98('0x4'));var db=require(_0x2e98('0x5'))['db'];var utils=require(_0x2e98('0x6'));var logger=require(_0x2e98('0x7'))(_0x2e98('0x8'));var config=require(_0x2e98('0x9'));var jayson=require(_0x2e98('0xa'));var client=jayson['client'][_0x2e98('0xb')]({'port':0x232a});config['redis']=_[_0x2e98('0xc')](config[_0x2e98('0xd')],{'host':_0x2e98('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e98('0xd')]));require(_0x2e98('0xf'))[_0x2e98('0x10')](socket);function respondWithRpcPromise(_0x1ad07d,_0x40bc15,_0x33c268){return new BPromise(function(_0xf73a03,_0x5250fc){return client[_0x2e98('0x11')](_0x1ad07d,_0x33c268)[_0x2e98('0x12')](function(_0x33e246){logger[_0x2e98('0x13')](_0x2e98('0x14'),_0x40bc15,_0x2e98('0x15'));logger[_0x2e98('0x16')](_0x2e98('0x17'),_0x40bc15,'request\x20sent',JSON[_0x2e98('0x18')](_0x33e246));if(_0x33e246[_0x2e98('0x19')]){if(_0x33e246['error'][_0x2e98('0x1a')]===0x1f4){logger['error'](_0x2e98('0x14'),_0x40bc15,_0x33e246[_0x2e98('0x19')][_0x2e98('0x1b')]);return _0x5250fc(_0x33e246[_0x2e98('0x19')][_0x2e98('0x1b')]);}logger[_0x2e98('0x19')]('ChatMessage,\x20%s,\x20%s',_0x40bc15,_0x33e246[_0x2e98('0x19')]['message']);return _0xf73a03(_0x33e246[_0x2e98('0x19')][_0x2e98('0x1b')]);}else{logger['info'](_0x2e98('0x14'),_0x40bc15,_0x2e98('0x15'));_0xf73a03(_0x33e246[_0x2e98('0x1c')][_0x2e98('0x1b')]);}})[_0x2e98('0x1d')](function(_0x180bae){logger['error'](_0x2e98('0x14'),_0x40bc15,_0x180bae);_0x5250fc(_0x180bae);});});}exports[_0x2e98('0x1e')]=function(_0x27f118){var _0x1d1ca9=this;return new Promise(function(_0x23f2b1,_0x55c4a0){return db['ChatMessage'][_0x2e98('0x1f')](_0x27f118[_0x2e98('0x20')],{'raw':_0x27f118['options']?_0x27f118[_0x2e98('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x2e98('0x12')](function(_0x352132){logger['info']('CreateChatMessage',_0x27f118);logger[_0x2e98('0x16')]('CreateChatMessage',_0x27f118,JSON['stringify'](_0x352132));_0x23f2b1(_0x352132);})[_0x2e98('0x1d')](function(_0x231f71){logger[_0x2e98('0x19')](_0x2e98('0x1e'),_0x231f71[_0x2e98('0x1b')],_0x27f118);_0x55c4a0(_0x1d1ca9[_0x2e98('0x19')](0x1f4,_0x231f71[_0x2e98('0x1b')]));});});}; \ No newline at end of file +var _0x2cda=['ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatMessage','create','body','options','then','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','info'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2cda,0x185));var _0xa2cd=function(_0x5be420,_0x3796ae){_0x5be420=_0x5be420-0x0;var _0x24395c=_0x2cda[_0x5be420];return _0x24395c;};'use strict';var _=require('lodash');var util=require(_0xa2cd('0x0'));var moment=require('moment');var BPromise=require(_0xa2cd('0x1'));var rs=require(_0xa2cd('0x2'));var fs=require('fs');var Redis=require(_0xa2cd('0x3'));var db=require(_0xa2cd('0x4'))['db'];var utils=require(_0xa2cd('0x5'));var logger=require(_0xa2cd('0x6'))(_0xa2cd('0x7'));var config=require(_0xa2cd('0x8'));var jayson=require(_0xa2cd('0x9'));var client=jayson[_0xa2cd('0xa')][_0xa2cd('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa2cd('0xc')],{'host':_0xa2cd('0xd'),'port':0x18eb});var socket=require(_0xa2cd('0xe'))(new Redis(config['redis']));require(_0xa2cd('0xf'))[_0xa2cd('0x10')](socket);function respondWithRpcPromise(_0x1dd3b7,_0x2cb61c,_0x526578){return new BPromise(function(_0x1ce6ff,_0x3a4102){return client[_0xa2cd('0x11')](_0x1dd3b7,_0x526578)['then'](function(_0x45bc71){logger[_0xa2cd('0x12')](_0xa2cd('0x13'),_0x2cb61c,'request\x20sent');logger['debug'](_0xa2cd('0x14'),_0x2cb61c,_0xa2cd('0x15'),JSON[_0xa2cd('0x16')](_0x45bc71));if(_0x45bc71[_0xa2cd('0x17')]){if(_0x45bc71['error'][_0xa2cd('0x18')]===0x1f4){logger['error'](_0xa2cd('0x13'),_0x2cb61c,_0x45bc71[_0xa2cd('0x17')][_0xa2cd('0x19')]);return _0x3a4102(_0x45bc71['error'][_0xa2cd('0x19')]);}logger['error'](_0xa2cd('0x13'),_0x2cb61c,_0x45bc71[_0xa2cd('0x17')][_0xa2cd('0x19')]);return _0x1ce6ff(_0x45bc71[_0xa2cd('0x17')][_0xa2cd('0x19')]);}else{logger[_0xa2cd('0x12')](_0xa2cd('0x13'),_0x2cb61c,'request\x20sent');_0x1ce6ff(_0x45bc71[_0xa2cd('0x1a')][_0xa2cd('0x19')]);}})[_0xa2cd('0x1b')](function(_0x345daf){logger[_0xa2cd('0x17')]('ChatMessage,\x20%s,\x20%s',_0x2cb61c,_0x345daf);_0x3a4102(_0x345daf);});});}exports[_0xa2cd('0x1c')]=function(_0x4bec1e){var _0xad3edc=this;return new Promise(function(_0x2e1b46,_0x62eb67){return db['ChatMessage'][_0xa2cd('0x1d')](_0x4bec1e[_0xa2cd('0x1e')],{'raw':_0x4bec1e['options']?_0x4bec1e[_0xa2cd('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xa2cd('0x20')](function(_0x2c3bd7){logger[_0xa2cd('0x12')](_0xa2cd('0x1c'),_0x4bec1e);logger[_0xa2cd('0x21')](_0xa2cd('0x1c'),_0x4bec1e,JSON['stringify'](_0x2c3bd7));_0x2e1b46(_0x2c3bd7);})['catch'](function(_0x311fb2){logger[_0xa2cd('0x17')]('CreateChatMessage',_0x311fb2[_0xa2cd('0x19')],_0x4bec1e);_0x62eb67(_0xad3edc[_0xa2cd('0x17')](0x1f4,_0x311fb2[_0xa2cd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 36587fa..2c05c27 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 _0xc492=['./chatMessage.events','save','remove','register','chatMessage:'];(function(_0x47ce74,_0x57a458){var _0x419f44=function(_0x254607){while(--_0x254607){_0x47ce74['push'](_0x47ce74['shift']());}};_0x419f44(++_0x57a458);}(_0xc492,0xd7));var _0x2c49=function(_0x5d2a6b,_0x20810e){_0x5d2a6b=_0x5d2a6b-0x0;var _0x528839=_0xc492[_0x5d2a6b];return _0x528839;};'use strict';var ChatMessageEvents=require(_0x2c49('0x0'));var events=[_0x2c49('0x1'),_0x2c49('0x2'),'update'];function createListener(_0x57cde2,_0x37eda4){return function(_0x5bab73){_0x37eda4['emit'](_0x57cde2,_0x5bab73);};}function removeListener(_0x555cba,_0x1de940){return function(){ChatMessageEvents['removeListener'](_0x555cba,_0x1de940);};}exports[_0x2c49('0x3')]=function(_0x499c4e){for(var _0x3ad911=0x0,_0x9c10f7=events['length'];_0x3ad911<_0x9c10f7;_0x3ad911++){var _0xe7b4cb=events[_0x3ad911];var _0x17f596=createListener(_0x2c49('0x4')+_0xe7b4cb,_0x499c4e);ChatMessageEvents['on'](_0xe7b4cb,_0x17f596);}}; \ No newline at end of file +var _0x63b6=['./chatMessage.events','save','remove','removeListener','chatMessage:'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x63b6,0x127));var _0x663b=function(_0x153e6d,_0x28c072){_0x153e6d=_0x153e6d-0x0;var _0x244e95=_0x63b6[_0x153e6d];return _0x244e95;};'use strict';var ChatMessageEvents=require(_0x663b('0x0'));var events=[_0x663b('0x1'),_0x663b('0x2'),'update'];function createListener(_0x813f8c,_0x522472){return function(_0x10dcf6){_0x522472['emit'](_0x813f8c,_0x10dcf6);};}function removeListener(_0x93bab1,_0x3e2b4b){return function(){ChatMessageEvents[_0x663b('0x3')](_0x93bab1,_0x3e2b4b);};}exports['register']=function(_0x4486b1){for(var _0x57e43e=0x0,_0x210eb1=events['length'];_0x57e43e<_0x210eb1;_0x57e43e++){var _0x414dc2=events[_0x57e43e];var _0x2976ff=createListener(_0x663b('0x4')+_0x414dc2,_0x4486b1);ChatMessageEvents['on'](_0x414dc2,_0x2976ff);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3b5649f..9777fca 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 _0xcf92=['delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x5cbf0c,_0x32c5ed){var _0x36571c=function(_0x287aa1){while(--_0x287aa1){_0x5cbf0c['push'](_0x5cbf0c['shift']());}};_0x36571c(++_0x32c5ed);}(_0xcf92,0xc0));var _0x2cf9=function(_0x3fe514,_0x30c4ba){_0x3fe514=_0x3fe514-0x0;var _0x56ba25=_0xcf92[_0x3fe514];return _0x56ba25;};'use strict';var multer=require(_0x2cf9('0x0'));var util=require('util');var path=require(_0x2cf9('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cf9('0x2'));var router=express['Router']();var fs_extra=require(_0x2cf9('0x3'));var auth=require(_0x2cf9('0x4'));var interaction=require(_0x2cf9('0x5'));var config=require(_0x2cf9('0x6'));var controller=require(_0x2cf9('0x7'));router[_0x2cf9('0x8')]('/',auth[_0x2cf9('0x9')](),controller[_0x2cf9('0xa')]);router['get'](_0x2cf9('0xb'),auth['isAuthenticated'](),controller[_0x2cf9('0xc')]);router[_0x2cf9('0x8')](_0x2cf9('0xd'),auth[_0x2cf9('0x9')](),controller['show']);router[_0x2cf9('0xe')]('/',auth[_0x2cf9('0x9')](),interaction[_0x2cf9('0xf')](_0x2cf9('0x10'),_0x2cf9('0x11')),controller[_0x2cf9('0x12')]);router[_0x2cf9('0x13')](_0x2cf9('0xd'),controller['update']);router[_0x2cf9('0x13')](_0x2cf9('0x14'),auth[_0x2cf9('0x9')](),controller[_0x2cf9('0x15')]);router['put'](_0x2cf9('0x16'),auth[_0x2cf9('0x9')](),controller[_0x2cf9('0x17')]);router[_0x2cf9('0x18')](_0x2cf9('0xd'),auth[_0x2cf9('0x9')](),controller[_0x2cf9('0x19')]);module[_0x2cf9('0x1a')]=router; \ No newline at end of file +var _0xfcd9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','accept','reject','delete','destroy','exports','multer','path'];(function(_0xd9a74f,_0x3e263e){var _0x3fc7ae=function(_0x29be5d){while(--_0x29be5d){_0xd9a74f['push'](_0xd9a74f['shift']());}};_0x3fc7ae(++_0x3e263e);}(_0xfcd9,0x1ae));var _0x9fcd=function(_0x23fcec,_0x48ec4c){_0x23fcec=_0x23fcec-0x0;var _0x447567=_0xfcd9[_0x23fcec];return _0x447567;};'use strict';var multer=require(_0x9fcd('0x0'));var util=require('util');var path=require(_0x9fcd('0x1'));var timeout=require('connect-timeout');var express=require(_0x9fcd('0x2'));var router=express['Router']();var fs_extra=require(_0x9fcd('0x3'));var auth=require(_0x9fcd('0x4'));var interaction=require(_0x9fcd('0x5'));var config=require(_0x9fcd('0x6'));var controller=require(_0x9fcd('0x7'));router[_0x9fcd('0x8')]('/',auth[_0x9fcd('0x9')](),controller[_0x9fcd('0xa')]);router[_0x9fcd('0x8')](_0x9fcd('0xb'),auth[_0x9fcd('0x9')](),controller[_0x9fcd('0xc')]);router[_0x9fcd('0x8')](_0x9fcd('0xd'),auth[_0x9fcd('0x9')](),controller[_0x9fcd('0xe')]);router[_0x9fcd('0xf')]('/',auth[_0x9fcd('0x9')](),interaction[_0x9fcd('0x10')](_0x9fcd('0x11'),_0x9fcd('0x12')),controller[_0x9fcd('0x13')]);router[_0x9fcd('0x14')](_0x9fcd('0xd'),controller[_0x9fcd('0x15')]);router[_0x9fcd('0x14')]('/:id/accept',auth[_0x9fcd('0x9')](),controller[_0x9fcd('0x16')]);router[_0x9fcd('0x14')]('/:id/reject',auth[_0x9fcd('0x9')](),controller[_0x9fcd('0x17')]);router[_0x9fcd('0x18')]('/:id',auth[_0x9fcd('0x9')](),controller[_0x9fcd('0x19')]);module[_0x9fcd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 59adb02..fd547f6 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x1b936f,_0x12b112){var _0xeb2a6e=function(_0x1976ed){while(--_0x1976ed){_0x1b936f['push'](_0x1b936f['shift']());}};_0xeb2a6e(++_0x12b112);}(_0x5f2f,0x73));var _0xf5f2=function(_0x560af1,_0x80d213){_0x560af1=_0x560af1-0x0;var _0x45fc1d=_0x5f2f[_0x560af1];return _0x45fc1d;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x552676,_0x6e7ced){var _0x2928e0=function(_0x2fc730){while(--_0x2fc730){_0x552676['push'](_0x552676['shift']());}};_0x2928e0(++_0x6e7ced);}(_0xadb5,0xad));var _0x5adb=function(_0x29eed9,_0x3107cc){_0x29eed9=_0x29eed9-0x0;var _0x400aa7=_0xadb5[_0x29eed9];return _0x400aa7;};'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 37a2cc6..1381368 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1511b0,_0x1c4c09){var _0x4b9a7a=function(_0x4ed840){while(--_0x4ed840){_0x1511b0['push'](_0x1511b0['shift']());}};_0x4b9a7a(++_0x1c4c09);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x7a54,0x106));var _0x47a5=function(_0x55b755,_0x1fb186){_0x55b755=_0x55b755-0x0;var _0x4ccee1=_0x7a54[_0x55b755];return _0x4ccee1;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index a70c71f..8fbf567 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 _0x964c=['hook','../../mysqldb','update','remove','emit'];(function(_0x32d537,_0x580e46){var _0x2ec857=function(_0x38ff38){while(--_0x38ff38){_0x32d537['push'](_0x32d537['shift']());}};_0x2ec857(++_0x580e46);}(_0x964c,0x65));var _0xc964=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x964c[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xc964('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc964('0x1'),'afterDestroy':_0xc964('0x2')};function emitEvent(_0x22982c){return function(_0xe338ef,_0x593bd4,_0x36a832){ChatOfflineMessageEvents[_0xc964('0x3')](_0x22982c+':'+_0xe338ef['id'],_0xe338ef);ChatOfflineMessageEvents[_0xc964('0x3')](_0x22982c,_0xe338ef);_0x36a832(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xc964('0x4')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x7f05=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatOfflineMessage','save'];(function(_0x5d4404,_0x4cb789){var _0x469f43=function(_0x2a41e4){while(--_0x2a41e4){_0x5d4404['push'](_0x5d4404['shift']());}};_0x469f43(++_0x4cb789);}(_0x7f05,0xdc));var _0x57f0=function(_0x3062c2,_0x1ede58){_0x3062c2=_0x3062c2-0x0;var _0x512807=_0x7f05[_0x3062c2];return _0x512807;};'use strict';var EventEmitter=require(_0x57f0('0x0'));var ChatOfflineMessage=require(_0x57f0('0x1'))['db'][_0x57f0('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x57f0('0x3'),'afterUpdate':'update','afterDestroy':_0x57f0('0x4')};function emitEvent(_0x3d1eec){return function(_0x52bde5,_0x25b25f,_0x615ad9){ChatOfflineMessageEvents['emit'](_0x3d1eec+':'+_0x52bde5['id'],_0x52bde5);ChatOfflineMessageEvents[_0x57f0('0x5')](_0x3d1eec,_0x52bde5);_0x615ad9(null);};}for(var e in events){if(events[_0x57f0('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x57f0('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index bdfa21f..b336a10 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 _0x59d7=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x181dc5,_0x2ac432){var _0x5ea42d=function(_0x521d2d){while(--_0x521d2d){_0x181dc5['push'](_0x181dc5['shift']());}};_0x5ea42d(++_0x2ac432);}(_0x59d7,0x19d));var _0x759d=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x59d7[_0x383356];return _0x32ee5a;};'use strict';var attributes=require(_0x759d('0x0'));module[_0x759d('0x1')]=function(_0x3c6f64){return _0x3c6f64['define'](_0x759d('0x2'),attributes,{'tableName':_0x759d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x759d('0x4'),'collate':_0x759d('0x5')});}; \ No newline at end of file +var _0x55a0=['exports','define','ChatOfflineMessage','chat_offline_messages','./chatOfflineMessage.attributes'];(function(_0xc88c02,_0x287914){var _0x36cceb=function(_0x58b6e5){while(--_0x58b6e5){_0xc88c02['push'](_0xc88c02['shift']());}};_0x36cceb(++_0x287914);}(_0x55a0,0x199));var _0x055a=function(_0x4231cf,_0x12b3f7){_0x4231cf=_0x4231cf-0x0;var _0x3ef1f9=_0x55a0[_0x4231cf];return _0x3ef1f9;};'use strict';var attributes=require(_0x055a('0x0'));module[_0x055a('0x1')]=function(_0x9b917d){return _0x9b917d[_0x055a('0x2')](_0x055a('0x3'),attributes,{'tableName':_0x055a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 76d049c..454b51b 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 _0x0261=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x476c88,_0x15a566){var _0x124cb7=function(_0x5c99e3){while(--_0x5c99e3){_0x476c88['push'](_0x476c88['shift']());}};_0x124cb7(++_0x15a566);}(_0x0261,0x11b));var _0x1026=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x0261[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x1026('0x0'));var util=require(_0x1026('0x1'));var moment=require(_0x1026('0x2'));var BPromise=require(_0x1026('0x3'));var rs=require(_0x1026('0x4'));var fs=require('fs');var Redis=require(_0x1026('0x5'));var db=require(_0x1026('0x6'))['db'];var utils=require(_0x1026('0x7'));var logger=require(_0x1026('0x8'))(_0x1026('0x9'));var config=require(_0x1026('0xa'));var jayson=require(_0x1026('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x465ee3,_0x332f1c,_0x557baa){return new BPromise(function(_0xa2d1de,_0x42dfa7){return client[_0x1026('0xc')](_0x465ee3,_0x557baa)['then'](function(_0x408f52){logger[_0x1026('0xd')](_0x1026('0xe'),_0x332f1c,_0x1026('0xf'));logger[_0x1026('0x10')](_0x1026('0x11'),_0x332f1c,_0x1026('0xf'),JSON[_0x1026('0x12')](_0x408f52));if(_0x408f52['error']){if(_0x408f52[_0x1026('0x13')][_0x1026('0x14')]===0x1f4){logger['error'](_0x1026('0xe'),_0x332f1c,_0x408f52[_0x1026('0x13')]['message']);return _0x42dfa7(_0x408f52['error'][_0x1026('0x15')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x332f1c,_0x408f52['error'][_0x1026('0x15')]);return _0xa2d1de(_0x408f52[_0x1026('0x13')][_0x1026('0x15')]);}else{logger['info'](_0x1026('0xe'),_0x332f1c,_0x1026('0xf'));_0xa2d1de(_0x408f52[_0x1026('0x16')][_0x1026('0x15')]);}})['catch'](function(_0x262a10){logger[_0x1026('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x332f1c,_0x262a10);_0x42dfa7(_0x262a10);});});} \ No newline at end of file +var _0x5331=['client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45950f,_0x531612){var _0x164f9a=function(_0x2c5095){while(--_0x2c5095){_0x45950f['push'](_0x45950f['shift']());}};_0x164f9a(++_0x531612);}(_0x5331,0x112));var _0x1533=function(_0x506ff5,_0x16d10f){_0x506ff5=_0x506ff5-0x0;var _0x2bd51b=_0x5331[_0x506ff5];return _0x2bd51b;};'use strict';var _=require(_0x1533('0x0'));var util=require(_0x1533('0x1'));var moment=require(_0x1533('0x2'));var BPromise=require(_0x1533('0x3'));var rs=require(_0x1533('0x4'));var fs=require('fs');var Redis=require(_0x1533('0x5'));var db=require(_0x1533('0x6'))['db'];var utils=require(_0x1533('0x7'));var logger=require(_0x1533('0x8'))(_0x1533('0x9'));var config=require(_0x1533('0xa'));var jayson=require(_0x1533('0xb'));var client=jayson[_0x1533('0xc')][_0x1533('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x433a0d,_0x2c74f8,_0x2185e8){return new BPromise(function(_0x3ef297,_0x4ad623){return client['request'](_0x433a0d,_0x2185e8)[_0x1533('0xe')](function(_0x54b675){logger[_0x1533('0xf')](_0x1533('0x10'),_0x2c74f8,_0x1533('0x11'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x2c74f8,'request\x20sent',JSON[_0x1533('0x12')](_0x54b675));if(_0x54b675[_0x1533('0x13')]){if(_0x54b675[_0x1533('0x13')]['code']===0x1f4){logger[_0x1533('0x13')](_0x1533('0x10'),_0x2c74f8,_0x54b675[_0x1533('0x13')]['message']);return _0x4ad623(_0x54b675['error'][_0x1533('0x14')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2c74f8,_0x54b675[_0x1533('0x13')][_0x1533('0x14')]);return _0x3ef297(_0x54b675['error'][_0x1533('0x14')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x2c74f8,'request\x20sent');_0x3ef297(_0x54b675[_0x1533('0x15')][_0x1533('0x14')]);}})['catch'](function(_0x163e03){logger[_0x1533('0x13')](_0x1533('0x10'),_0x2c74f8,_0x163e03);_0x4ad623(_0x163e03);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 01a70da..bfc2289 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 _0x1651=['get','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','describe'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0x1651,0x15c));var _0x1165=function(_0x49d64f,_0x3d016){_0x49d64f=_0x49d64f-0x0;var _0x3c20fe=_0x1651[_0x49d64f];return _0x3c20fe;};'use strict';var multer=require(_0x1165('0x0'));var util=require(_0x1165('0x1'));var path=require(_0x1165('0x2'));var timeout=require(_0x1165('0x3'));var express=require(_0x1165('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1165('0x5'));var interaction=require(_0x1165('0x6'));var config=require(_0x1165('0x7'));var controller=require(_0x1165('0x8'));router['get']('/',auth[_0x1165('0x9')](),controller[_0x1165('0xa')]);router['get']('/describe',auth[_0x1165('0x9')](),controller[_0x1165('0xb')]);router[_0x1165('0xc')](_0x1165('0xd'),auth[_0x1165('0x9')](),controller[_0x1165('0xe')]);router[_0x1165('0xf')]('/',auth[_0x1165('0x9')](),controller[_0x1165('0x10')]);router[_0x1165('0x11')](_0x1165('0xd'),auth[_0x1165('0x9')](),controller[_0x1165('0x12')]);router['delete']('/:id',auth[_0x1165('0x9')](),controller[_0x1165('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd081=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get'];(function(_0x478b96,_0x1f3668){var _0xcea802=function(_0x2b3abd){while(--_0x2b3abd){_0x478b96['push'](_0x478b96['shift']());}};_0xcea802(++_0x1f3668);}(_0xd081,0x11d));var _0x1d08=function(_0x57c79f,_0x16ebcc){_0x57c79f=_0x57c79f-0x0;var _0x59e2c8=_0xd081[_0x57c79f];return _0x59e2c8;};'use strict';var multer=require(_0x1d08('0x0'));var util=require(_0x1d08('0x1'));var path=require(_0x1d08('0x2'));var timeout=require(_0x1d08('0x3'));var express=require(_0x1d08('0x4'));var router=express[_0x1d08('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1d08('0x6'));var interaction=require(_0x1d08('0x7'));var config=require(_0x1d08('0x8'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x1d08('0x9')](),controller[_0x1d08('0xa')]);router['get'](_0x1d08('0xb'),auth['isAuthenticated'](),controller[_0x1d08('0xc')]);router[_0x1d08('0xd')](_0x1d08('0xe'),auth[_0x1d08('0x9')](),controller[_0x1d08('0xf')]);router[_0x1d08('0x10')]('/',auth[_0x1d08('0x9')](),controller[_0x1d08('0x11')]);router[_0x1d08('0x12')](_0x1d08('0xe'),auth[_0x1d08('0x9')](),controller[_0x1d08('0x13')]);router[_0x1d08('0x14')](_0x1d08('0xe'),auth['isAuthenticated'](),controller[_0x1d08('0x15')]);module[_0x1d08('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 6bd59d9..0b35573 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 _0x58cc=['sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x58cc,0x72));var _0xc58c=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x58cc[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0xc58c('0x0'));module[_0xc58c('0x1')]={'name':{'type':Sequelize[_0xc58c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc58c('0x3')](_0xc58c('0x4'),_0xc58c('0x5')),'defaultValue':_0xc58c('0x4')},'selector':{'type':Sequelize[_0xc58c('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7b23=['timeout','INTEGER','sequelize','exports','ENUM','mouseOver'];(function(_0xd6a093,_0x2dc9fe){var _0x2e9533=function(_0x432f1f){while(--_0x432f1f){_0xd6a093['push'](_0xd6a093['shift']());}};_0x2e9533(++_0x2dc9fe);}(_0x7b23,0xf2));var _0x37b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7b23[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x37b2('0x0'));module[_0x37b2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x37b2('0x2')](_0x37b2('0x3'),_0x37b2('0x4')),'defaultValue':_0x37b2('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x37b2('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d390a7e..f2dfec2 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 _0x9aee=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','error','name','send','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','include','options','find','then','catch','create'];(function(_0x1d4ea9,_0x3f1d85){var _0x2cf5eb=function(_0x145f17){while(--_0x145f17){_0x1d4ea9['push'](_0x1d4ea9['shift']());}};_0x2cf5eb(++_0x3f1d85);}(_0x9aee,0x71));var _0xe9ae=function(_0x440f53,_0x58aa56){_0x440f53=_0x440f53-0x0;var _0x190b07=_0x9aee[_0x440f53];return _0x190b07;};'use strict';var emlformat=require(_0xe9ae('0x0'));var rimraf=require(_0xe9ae('0x1'));var zipdir=require(_0xe9ae('0x2'));var jsonpatch=require(_0xe9ae('0x3'));var rp=require(_0xe9ae('0x4'));var moment=require(_0xe9ae('0x5'));var BPromise=require(_0xe9ae('0x6'));var Mustache=require(_0xe9ae('0x7'));var util=require(_0xe9ae('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe9ae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe9ae('0xa'));var crypto=require('crypto');var jsforce=require(_0xe9ae('0xb'));var deskjs=require(_0xe9ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe9ae('0xd'));var Papa=require(_0xe9ae('0xe'));var Redis=require(_0xe9ae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe9ae('0x10'));var as=require(_0xe9ae('0x11'));var hardwareService=require(_0xe9ae('0x12'));var logger=require('../../config/logger')(_0xe9ae('0x13'));var utils=require('../../config/utils');var config=require(_0xe9ae('0x14'));var licenseUtil=require(_0xe9ae('0x15'));var db=require(_0xe9ae('0x16'))['db'];function respondWithStatusCode(_0x1833c9,_0x3f55e5){_0x3f55e5=_0x3f55e5||0xcc;return function(_0x1be4dd){if(_0x1be4dd){return _0x1833c9[_0xe9ae('0x17')](_0x3f55e5);}return _0x1833c9[_0xe9ae('0x18')](_0x3f55e5)['end']();};}function respondWithResult(_0x2f2c3b,_0x38b4af){_0x38b4af=_0x38b4af||0xc8;return function(_0x4e8869){if(_0x4e8869){return _0x2f2c3b[_0xe9ae('0x18')](_0x38b4af)[_0xe9ae('0x19')](_0x4e8869);}};}function respondWithFilteredResult(_0x44fa8c,_0x43963c){return function(_0x3ef25b){if(_0x3ef25b){var _0x1fd836=typeof _0x43963c[_0xe9ae('0x1a')]===_0xe9ae('0x1b')&&typeof _0x43963c[_0xe9ae('0x1c')]==='undefined';var _0x5b18ae=_0x3ef25b[_0xe9ae('0x1d')];var _0x4bae07=_0x1fd836?0x0:_0x43963c[_0xe9ae('0x1a')];var _0x32748a=_0x1fd836?_0x3ef25b[_0xe9ae('0x1d')]:_0x43963c[_0xe9ae('0x1a')]+_0x43963c['limit'];var _0x4e9e93;if(_0x32748a>=_0x5b18ae){_0x32748a=_0x5b18ae;_0x4e9e93=0xc8;}else{_0x4e9e93=0xce;}_0x44fa8c['status'](_0x4e9e93);return _0x44fa8c[_0xe9ae('0x1e')](_0xe9ae('0x1f'),_0x4bae07+'-'+_0x32748a+'/'+_0x5b18ae)['json'](_0x3ef25b);}return null;};}function patchUpdates(_0x1ad4d5){return function(_0x49fc40){try{jsonpatch[_0xe9ae('0x20')](_0x49fc40,_0x1ad4d5,!![]);}catch(_0x324de0){return BPromise[_0xe9ae('0x21')](_0x324de0);}return _0x49fc40['save']();};}function saveUpdates(_0x4a7568,_0x475b7a){return function(_0x206bd7){if(_0x206bd7){return _0x206bd7[_0xe9ae('0x22')](_0x4a7568)['then'](function(_0x36285a){return _0x36285a;});}return null;};}function removeEntity(_0x29d690,_0x31e94f){return function(_0x3fd466){if(_0x3fd466){return _0x3fd466[_0xe9ae('0x23')]()['then'](function(){_0x29d690[_0xe9ae('0x18')](0xcc)[_0xe9ae('0x24')]();});}};}function handleEntityNotFound(_0x9f1726,_0x209236){return function(_0x5cec8a){if(!_0x5cec8a){_0x9f1726[_0xe9ae('0x17')](0x194);}return _0x5cec8a;};}function handleError(_0x5195ce,_0x3e78ca){_0x3e78ca=_0x3e78ca||0x1f4;return function(_0x18e5b3){logger[_0xe9ae('0x25')](_0x18e5b3['stack']);if(_0x18e5b3[_0xe9ae('0x26')]){delete _0x18e5b3[_0xe9ae('0x26')];}_0x5195ce[_0xe9ae('0x18')](_0x3e78ca)[_0xe9ae('0x27')](_0x18e5b3);};}exports['show']=function(_0x266f36,_0x3db24e){var _0x483df4={'raw':!![],'where':{'id':_0x266f36[_0xe9ae('0x28')]['id']}},_0x4ac613={};_0x4ac613[_0xe9ae('0x29')]=_[_0xe9ae('0x2a')](db[_0xe9ae('0x2b')]['rawAttributes']);_0x4ac613[_0xe9ae('0x2c')]=_['keys'](_0x266f36[_0xe9ae('0x2c')]);_0x4ac613[_0xe9ae('0x2d')]=_[_0xe9ae('0x2e')](_0x4ac613[_0xe9ae('0x29')],_0x4ac613[_0xe9ae('0x2c')]);_0x483df4[_0xe9ae('0x2f')]=_['intersection'](_0x4ac613[_0xe9ae('0x29')],qs[_0xe9ae('0x30')](_0x266f36[_0xe9ae('0x2c')][_0xe9ae('0x30')]));_0x483df4[_0xe9ae('0x2f')]=_0x483df4[_0xe9ae('0x2f')]['length']?_0x483df4[_0xe9ae('0x2f')]:_0x4ac613[_0xe9ae('0x29')];if(_0x266f36[_0xe9ae('0x2c')]['includeAll']){_0x483df4[_0xe9ae('0x31')]=[{'all':!![]}];}_0x483df4=_['merge']({},_0x483df4,_0x266f36[_0xe9ae('0x32')]);return db[_0xe9ae('0x2b')][_0xe9ae('0x33')](_0x483df4)['then'](handleEntityNotFound(_0x3db24e,null))[_0xe9ae('0x34')](respondWithResult(_0x3db24e,null))[_0xe9ae('0x35')](handleError(_0x3db24e,null));};exports[_0xe9ae('0x36')]=function(_0x416bae,_0x161c77){return db[_0xe9ae('0x2b')]['create'](_0x416bae[_0xe9ae('0x37')],{})[_0xe9ae('0x34')](respondWithResult(_0x161c77,0xc9))['catch'](handleError(_0x161c77,null));};exports[_0xe9ae('0x22')]=function(_0x2813a0,_0x22c47c){if(_0x2813a0['body']['id']){delete _0x2813a0[_0xe9ae('0x37')]['id'];}return db['ChatProactiveAction'][_0xe9ae('0x33')]({'where':{'id':_0x2813a0[_0xe9ae('0x28')]['id']}})[_0xe9ae('0x34')](handleEntityNotFound(_0x22c47c,null))[_0xe9ae('0x34')](saveUpdates(_0x2813a0['body'],null))[_0xe9ae('0x34')](respondWithResult(_0x22c47c,null))['catch'](handleError(_0x22c47c,null));};exports[_0xe9ae('0x23')]=function(_0x50d500,_0x52e381){return db[_0xe9ae('0x2b')]['find']({'where':{'id':_0x50d500[_0xe9ae('0x28')]['id']}})[_0xe9ae('0x34')](handleEntityNotFound(_0x52e381,null))[_0xe9ae('0x34')](removeEntity(_0x52e381,null))[_0xe9ae('0x35')](handleError(_0x52e381,null));}; \ No newline at end of file +var _0x24ce=['query','keys','filters','attributes','fields','includeAll','merge','options','ChatProactiveAction','find','create','body','update','catch','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','destroy','then','end','error','stack','name','send','show','params','model','rawAttributes'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x24ce,0x1de));var _0xe24c=function(_0x24bae1,_0x53069e){_0x24bae1=_0x24bae1-0x0;var _0x4f2d76=_0x24ce[_0x24bae1];return _0x4f2d76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe24c('0x0'));var zipdir=require(_0xe24c('0x1'));var jsonpatch=require(_0xe24c('0x2'));var rp=require(_0xe24c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe24c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe24c('0x5'));var csv=require(_0xe24c('0x6'));var ejs=require(_0xe24c('0x7'));var fs=require('fs');var fs_extra=require(_0xe24c('0x8'));var _=require(_0xe24c('0x9'));var squel=require('squel');var crypto=require(_0xe24c('0xa'));var jsforce=require(_0xe24c('0xb'));var deskjs=require(_0xe24c('0xc'));var toCsv=require(_0xe24c('0x6'));var querystring=require(_0xe24c('0xd'));var Papa=require(_0xe24c('0xe'));var Redis=require(_0xe24c('0xf'));var authService=require(_0xe24c('0x10'));var qs=require(_0xe24c('0x11'));var as=require(_0xe24c('0x12'));var hardwareService=require(_0xe24c('0x13'));var logger=require(_0xe24c('0x14'))(_0xe24c('0x15'));var utils=require('../../config/utils');var config=require(_0xe24c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe24c('0x17'))['db'];function respondWithStatusCode(_0x59a9b5,_0x1030bb){_0x1030bb=_0x1030bb||0xcc;return function(_0x1492c6){if(_0x1492c6){return _0x59a9b5['sendStatus'](_0x1030bb);}return _0x59a9b5['status'](_0x1030bb)['end']();};}function respondWithResult(_0x3f0955,_0x59b4d1){_0x59b4d1=_0x59b4d1||0xc8;return function(_0x1cb6c0){if(_0x1cb6c0){return _0x3f0955[_0xe24c('0x18')](_0x59b4d1)[_0xe24c('0x19')](_0x1cb6c0);}};}function respondWithFilteredResult(_0x33979b,_0x48a435){return function(_0x21c00d){if(_0x21c00d){var _0x36b1e6=typeof _0x48a435[_0xe24c('0x1a')]===_0xe24c('0x1b')&&typeof _0x48a435[_0xe24c('0x1c')]===_0xe24c('0x1b');var _0xbd9e1d=_0x21c00d[_0xe24c('0x1d')];var _0x384bd2=_0x36b1e6?0x0:_0x48a435[_0xe24c('0x1a')];var _0xed9c0b=_0x36b1e6?_0x21c00d[_0xe24c('0x1d')]:_0x48a435[_0xe24c('0x1a')]+_0x48a435['limit'];var _0x3db589;if(_0xed9c0b>=_0xbd9e1d){_0xed9c0b=_0xbd9e1d;_0x3db589=0xc8;}else{_0x3db589=0xce;}_0x33979b[_0xe24c('0x18')](_0x3db589);return _0x33979b[_0xe24c('0x1e')]('Content-Range',_0x384bd2+'-'+_0xed9c0b+'/'+_0xbd9e1d)[_0xe24c('0x19')](_0x21c00d);}return null;};}function patchUpdates(_0x258d10){return function(_0x2462f2){try{jsonpatch[_0xe24c('0x1f')](_0x2462f2,_0x258d10,!![]);}catch(_0x3e9d00){return BPromise[_0xe24c('0x20')](_0x3e9d00);}return _0x2462f2['save']();};}function saveUpdates(_0x4def0b,_0x5a2315){return function(_0x354430){if(_0x354430){return _0x354430['update'](_0x4def0b)['then'](function(_0x7e7bda){return _0x7e7bda;});}return null;};}function removeEntity(_0x2edb8f,_0x267de3){return function(_0x4525e3){if(_0x4525e3){return _0x4525e3[_0xe24c('0x21')]()[_0xe24c('0x22')](function(){_0x2edb8f[_0xe24c('0x18')](0xcc)[_0xe24c('0x23')]();});}};}function handleEntityNotFound(_0x2b6bcf,_0x291018){return function(_0x25aeb2){if(!_0x25aeb2){_0x2b6bcf['sendStatus'](0x194);}return _0x25aeb2;};}function handleError(_0x431cde,_0x1dcd46){_0x1dcd46=_0x1dcd46||0x1f4;return function(_0x12b536){logger[_0xe24c('0x24')](_0x12b536[_0xe24c('0x25')]);if(_0x12b536[_0xe24c('0x26')]){delete _0x12b536[_0xe24c('0x26')];}_0x431cde[_0xe24c('0x18')](_0x1dcd46)[_0xe24c('0x27')](_0x12b536);};}exports[_0xe24c('0x28')]=function(_0x5c668e,_0x190cc3){var _0x375aab={'raw':!![],'where':{'id':_0x5c668e[_0xe24c('0x29')]['id']}},_0x51d81e={};_0x51d81e[_0xe24c('0x2a')]=_['keys'](db['ChatProactiveAction'][_0xe24c('0x2b')]);_0x51d81e[_0xe24c('0x2c')]=_[_0xe24c('0x2d')](_0x5c668e['query']);_0x51d81e[_0xe24c('0x2e')]=_['intersection'](_0x51d81e['model'],_0x51d81e[_0xe24c('0x2c')]);_0x375aab[_0xe24c('0x2f')]=_['intersection'](_0x51d81e['model'],qs[_0xe24c('0x30')](_0x5c668e[_0xe24c('0x2c')][_0xe24c('0x30')]));_0x375aab[_0xe24c('0x2f')]=_0x375aab['attributes']['length']?_0x375aab['attributes']:_0x51d81e[_0xe24c('0x2a')];if(_0x5c668e[_0xe24c('0x2c')][_0xe24c('0x31')]){_0x375aab['include']=[{'all':!![]}];}_0x375aab=_[_0xe24c('0x32')]({},_0x375aab,_0x5c668e[_0xe24c('0x33')]);return db[_0xe24c('0x34')][_0xe24c('0x35')](_0x375aab)[_0xe24c('0x22')](handleEntityNotFound(_0x190cc3,null))['then'](respondWithResult(_0x190cc3,null))['catch'](handleError(_0x190cc3,null));};exports[_0xe24c('0x36')]=function(_0x77f337,_0x530f2e){return db['ChatProactiveAction'][_0xe24c('0x36')](_0x77f337[_0xe24c('0x37')],{})[_0xe24c('0x22')](respondWithResult(_0x530f2e,0xc9))['catch'](handleError(_0x530f2e,null));};exports[_0xe24c('0x38')]=function(_0x725784,_0x614472){if(_0x725784[_0xe24c('0x37')]['id']){delete _0x725784[_0xe24c('0x37')]['id'];}return db['ChatProactiveAction'][_0xe24c('0x35')]({'where':{'id':_0x725784[_0xe24c('0x29')]['id']}})[_0xe24c('0x22')](handleEntityNotFound(_0x614472,null))['then'](saveUpdates(_0x725784[_0xe24c('0x37')],null))[_0xe24c('0x22')](respondWithResult(_0x614472,null))['catch'](handleError(_0x614472,null));};exports[_0xe24c('0x21')]=function(_0x327a24,_0x1338b9){return db[_0xe24c('0x34')][_0xe24c('0x35')]({'where':{'id':_0x327a24[_0xe24c('0x29')]['id']}})[_0xe24c('0x22')](handleEntityNotFound(_0x1338b9,null))[_0xe24c('0x22')](removeEntity(_0x1338b9,null))[_0xe24c('0x39')](handleError(_0x1338b9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index eebc53c..a5840f6 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 _0x45e1=['exports','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes'];(function(_0x2abe9a,_0x426745){var _0xdd91ac=function(_0x4279e5){while(--_0x4279e5){_0x2abe9a['push'](_0x2abe9a['shift']());}};_0xdd91ac(++_0x426745);}(_0x45e1,0x145));var _0x145e=function(_0xb37185,_0x3ec508){_0xb37185=_0xb37185-0x0;var _0x575b45=_0x45e1[_0xb37185];return _0x575b45;};'use strict';var _=require(_0x145e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x145e('0x1'));var moment=require(_0x145e('0x2'));var BPromise=require(_0x145e('0x3'));var rp=require(_0x145e('0x4'));var fs=require('fs');var path=require(_0x145e('0x5'));var rimraf=require('rimraf');var config=require(_0x145e('0x6'));var attributes=require(_0x145e('0x7'));module[_0x145e('0x8')]=function(_0x5228a5,_0x12fed4){return _0x5228a5['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92c3=['bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','../../config/logger','api'];(function(_0xafbf68,_0x44766a){var _0x12dc58=function(_0x581c54){while(--_0x581c54){_0xafbf68['push'](_0xafbf68['shift']());}};_0x12dc58(++_0x44766a);}(_0x92c3,0x111));var _0x392c=function(_0x3eb672,_0x18b75c){_0x3eb672=_0x3eb672-0x0;var _0x5a7639=_0x92c3[_0x3eb672];return _0x5a7639;};'use strict';var _=require('lodash');var util=require(_0x392c('0x0'));var logger=require(_0x392c('0x1'))(_0x392c('0x2'));var moment=require('moment');var BPromise=require(_0x392c('0x3'));var rp=require(_0x392c('0x4'));var fs=require('fs');var path=require(_0x392c('0x5'));var rimraf=require(_0x392c('0x6'));var config=require(_0x392c('0x7'));var attributes=require(_0x392c('0x8'));module[_0x392c('0x9')]=function(_0x231930,_0x508ef1){return _0x231930[_0x392c('0xa')](_0x392c('0xb'),attributes,{'tableName':'chat_proactive_actions','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 18cad78..a0c855a 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 _0x828f=['message','request\x20sent','result','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0x828f,0xc1));var _0xf828=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x828f[_0x5eb22e];return _0x27fed5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf828('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf828('0x1'));var db=require(_0xf828('0x2'))['db'];var utils=require(_0xf828('0x3'));var logger=require(_0xf828('0x4'))(_0xf828('0x5'));var config=require(_0xf828('0x6'));var jayson=require(_0xf828('0x7'));var client=jayson[_0xf828('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfeb32a,_0x1a393c,_0x43a369){return new BPromise(function(_0x353b54,_0x5d937e){return client['request'](_0xfeb32a,_0x43a369)[_0xf828('0x9')](function(_0x29120d){logger[_0xf828('0xa')](_0xf828('0xb'),_0x1a393c,'request\x20sent');logger[_0xf828('0xc')](_0xf828('0xd'),_0x1a393c,'request\x20sent',JSON['stringify'](_0x29120d));if(_0x29120d[_0xf828('0xe')]){if(_0x29120d[_0xf828('0xe')][_0xf828('0xf')]===0x1f4){logger[_0xf828('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a393c,_0x29120d[_0xf828('0xe')]['message']);return _0x5d937e(_0x29120d[_0xf828('0xe')]['message']);}logger[_0xf828('0xe')](_0xf828('0xb'),_0x1a393c,_0x29120d[_0xf828('0xe')][_0xf828('0x10')]);return _0x353b54(_0x29120d[_0xf828('0xe')][_0xf828('0x10')]);}else{logger[_0xf828('0xa')](_0xf828('0xb'),_0x1a393c,_0xf828('0x11'));_0x353b54(_0x29120d[_0xf828('0x12')][_0xf828('0x10')]);}})['catch'](function(_0xf4b944){logger[_0xf828('0xe')](_0xf828('0xb'),_0x1a393c,_0xf4b944);_0x5d937e(_0xf4b944);});});} \ No newline at end of file +var _0xea0d=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','ioredis'];(function(_0x863d4f,_0x2df089){var _0x211082=function(_0x29c34b){while(--_0x29c34b){_0x863d4f['push'](_0x863d4f['shift']());}};_0x211082(++_0x2df089);}(_0xea0d,0x166));var _0xdea0=function(_0x51356c,_0x501f0c){_0x51356c=_0x51356c-0x0;var _0x2ebe29=_0xea0d[_0x51356c];return _0x2ebe29;};'use strict';var _=require(_0xdea0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdea0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdea0('0x2'));var db=require(_0xdea0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdea0('0x4'))(_0xdea0('0x5'));var config=require(_0xdea0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdea0('0x7')][_0xdea0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4afd06,_0x4f2bc0,_0x116ea9){return new BPromise(function(_0x4fe1ca,_0x32e9ee){return client[_0xdea0('0x9')](_0x4afd06,_0x116ea9)['then'](function(_0x16e658){logger[_0xdea0('0xa')](_0xdea0('0xb'),_0x4f2bc0,_0xdea0('0xc'));logger['debug'](_0xdea0('0xd'),_0x4f2bc0,_0xdea0('0xc'),JSON[_0xdea0('0xe')](_0x16e658));if(_0x16e658['error']){if(_0x16e658[_0xdea0('0xf')]['code']===0x1f4){logger['error'](_0xdea0('0xb'),_0x4f2bc0,_0x16e658[_0xdea0('0xf')][_0xdea0('0x10')]);return _0x32e9ee(_0x16e658[_0xdea0('0xf')]['message']);}logger[_0xdea0('0xf')](_0xdea0('0xb'),_0x4f2bc0,_0x16e658[_0xdea0('0xf')]['message']);return _0x4fe1ca(_0x16e658[_0xdea0('0xf')]['message']);}else{logger[_0xdea0('0xa')](_0xdea0('0xb'),_0x4f2bc0,'request\x20sent');_0x4fe1ca(_0x16e658[_0xdea0('0x11')]['message']);}})[_0xdea0('0x12')](function(_0x36c05f){logger[_0xdea0('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x4f2bc0,_0x36c05f);_0x32e9ee(_0x36c05f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 525c216..ea3a24f 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 _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4e820b,_0x37b5af){_0x4e820b=_0x4e820b-0x0;var _0x3f539e=_0xb4c7[_0x4e820b];return _0x3f539e;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file +var _0x7fbe=['show','post','create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x46969b,_0x20c7e8){var _0x4cabb6=function(_0x5e73c6){while(--_0x5e73c6){_0x46969b['push'](_0x46969b['shift']());}};_0x4cabb6(++_0x20c7e8);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x52c856,_0x47fd69){_0x52c856=_0x52c856-0x0;var _0x41f172=_0x7fbe[_0x52c856];return _0x41f172;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0xc')]);router[_0xe7fb('0xd')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller['update']);router['delete'](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0x10')]);module[_0xe7fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 33d204d..9d88d44 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 _0xcb86=['name','INTEGER','rrmemory','roundrobin','exports','STRING'];(function(_0x5bfc72,_0x959e59){var _0x11fe83=function(_0x51cbb9){while(--_0x51cbb9){_0x5bfc72['push'](_0x5bfc72['shift']());}};_0x11fe83(++_0x959e59);}(_0xcb86,0xac));var _0x6cb8=function(_0x13b762,_0x9c16ee){_0x13b762=_0x13b762-0x0;var _0x344406=_0xcb86[_0x13b762];return _0x344406;};'use strict';var Sequelize=require('sequelize');module[_0x6cb8('0x0')]={'name':{'type':Sequelize[_0x6cb8('0x1')],'unique':_0x6cb8('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6cb8('0x1')]},'timeout':{'type':Sequelize[_0x6cb8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6cb8('0x4'),'beepall',_0x6cb8('0x5'))}}; \ No newline at end of file +var _0xce4f=['rrmemory','beepall','roundrobin','exports','STRING','name','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xce4f,0x168));var _0xfce4=function(_0x214fbd,_0x2e0ee7){_0x214fbd=_0x214fbd-0x0;var _0x16adcf=_0xce4f[_0x214fbd];return _0x16adcf;};'use strict';var Sequelize=require('sequelize');module[_0xfce4('0x0')]={'name':{'type':Sequelize[_0xfce4('0x1')],'unique':_0xfce4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfce4('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfce4('0x3')](_0xfce4('0x4'),_0xfce4('0x5'),_0xfce4('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a556ebc..63ee294 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 _0x2e5a=['fields','includeAll','merge','options','create','user','UserProfileSection','find','userProfileId','UserProfileResource','update','body','getMembers','findOne','UserChatQueue','length','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','Team','pick','getTeams','addTeams','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','all','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','then','get','ChatQueues','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','keys','ChatQueue','filters','intersection','model','attributes'];(function(_0x523e3f,_0xbdbe8b){var _0x71967f=function(_0x2c2c2b){while(--_0x2c2c2b){_0x523e3f['push'](_0x523e3f['shift']());}};_0x71967f(++_0xbdbe8b);}(_0x2e5a,0x199));var _0xa2e5=function(_0x4945b8,_0x28d659){_0x4945b8=_0x4945b8-0x0;var _0x38a136=_0x2e5a[_0x4945b8];return _0x38a136;};'use strict';var BPromise=require('bluebird');var util=require(_0xa2e5('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xa2e5('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa2e5('0x2'))(_0xa2e5('0x3'));var config=require(_0xa2e5('0x4'));var db=require(_0xa2e5('0x5'))['db'];config[_0xa2e5('0x6')]=_[_0xa2e5('0x7')](config[_0xa2e5('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2e5('0x8'))(new Redis(config['redis']));require(_0xa2e5('0x9'))[_0xa2e5('0xa')](socket);function respondWithStatusCode(_0x23364a,_0x2c1b4f){_0x2c1b4f=_0x2c1b4f||0xcc;return function(_0x2d7fc3){if(_0x2d7fc3){return _0x23364a[_0xa2e5('0xb')](_0x2c1b4f);}return _0x23364a[_0xa2e5('0xc')](_0x2c1b4f)['end']();};}function respondWithResult(_0xfa5952,_0x4b237d){_0x4b237d=_0x4b237d||0xc8;return function(_0x25a9e3){if(_0x25a9e3){return _0xfa5952[_0xa2e5('0xc')](_0x4b237d)[_0xa2e5('0xd')](_0x25a9e3);}};}function respondWithFilteredResult(_0x4a95ff,_0x405a75){return function(_0x2a3362){if(_0x2a3362){var _0x586280=typeof _0x405a75[_0xa2e5('0xe')]===_0xa2e5('0xf')&&typeof _0x405a75[_0xa2e5('0x10')]==='undefined';var _0x39d049=_0x2a3362['count'];var _0x4235a9=_0x586280?0x0:_0x405a75[_0xa2e5('0xe')];var _0x4bdab6=_0x586280?_0x2a3362['count']:_0x405a75[_0xa2e5('0xe')]+_0x405a75[_0xa2e5('0x10')];var _0x2c4e67;if(_0x4bdab6>=_0x39d049){_0x4bdab6=_0x39d049;_0x2c4e67=0xc8;}else{_0x2c4e67=0xce;}_0x4a95ff[_0xa2e5('0xc')](_0x2c4e67);return _0x4a95ff[_0xa2e5('0x11')](_0xa2e5('0x12'),_0x4235a9+'-'+_0x4bdab6+'/'+_0x39d049)[_0xa2e5('0xd')](_0x2a3362);}return null;};}function saveUpdates(_0x57f785){return function(_0x282ff3){if(_0x282ff3){return _0x282ff3['update'](_0x57f785)[_0xa2e5('0x13')](function(_0x596262){return _0x596262;});}return null;};}function removeEntity(_0x3cf06a){return function(_0x2741f9){if(_0x2741f9){return _0x2741f9['destroy']()['then'](function(){var _0x2e774c=_0x2741f9[_0xa2e5('0x14')]({'plain':!![]});var _0x1d506a=_0xa2e5('0x15');return db['UserProfileResource'][_0xa2e5('0x16')]({'where':{'type':_0x1d506a,'resourceId':_0x2e774c['id']}})[_0xa2e5('0x13')](function(){return _0x2741f9;});})[_0xa2e5('0x13')](function(){_0x3cf06a[_0xa2e5('0xc')](0xcc)[_0xa2e5('0x17')]();});}};}function handleEntityNotFound(_0x227428){return function(_0x398e13){if(!_0x398e13){_0x227428['sendStatus'](0x194);}return _0x398e13;};}function handleError(_0x547b88,_0x332999){_0x332999=_0x332999||0x1f4;return function(_0x21800f){logger[_0xa2e5('0x18')](_0x21800f[_0xa2e5('0x19')]);if(_0x21800f[_0xa2e5('0x1a')]){delete _0x21800f[_0xa2e5('0x1a')];}_0x547b88[_0xa2e5('0xc')](_0x332999)['send'](_0x21800f);};}exports[_0xa2e5('0x1b')]=function(_0x379f1b,_0x412ac4){var _0x514be3={};var _0xc0d3da={'count':0x0,'rows':[]};var _0x37a889=_[_0xa2e5('0x1c')](db['ChatQueue'][_0xa2e5('0x1d')],function(_0x5cb4de){return{'name':_0x5cb4de[_0xa2e5('0x1e')],'type':_0x5cb4de[_0xa2e5('0x1f')][_0xa2e5('0x20')]};});_0x514be3=qs[_0xa2e5('0x21')](_0x37a889,_0x379f1b);var _0x77200e={'where':_0x514be3[_0xa2e5('0x22')]};return db['ChatQueue']['count'](_0x77200e)[_0xa2e5('0x13')](function(_0x5447d9){_0xc0d3da['count']=_0x5447d9;_0x514be3[_0xa2e5('0x23')]=qs['include'](_0x379f1b[_0xa2e5('0x24')]);return db['ChatQueue'][_0xa2e5('0x25')](_0x514be3);})[_0xa2e5('0x13')](function(_0x4145bd){_0xc0d3da['rows']=_0x4145bd;return _0xc0d3da;})['then'](respondWithFilteredResult(_0x412ac4,_0x514be3))[_0xa2e5('0x26')](handleError(_0x412ac4,null));};exports[_0xa2e5('0x27')]=function(_0xf29f7d,_0x21c474){var _0x2c18e7={'raw':!![],'where':{'id':_0xf29f7d[_0xa2e5('0x28')]['id']}},_0x533ab2={};_0x533ab2['model']=_[_0xa2e5('0x29')](db[_0xa2e5('0x2a')][_0xa2e5('0x1d')]);_0x533ab2[_0xa2e5('0x24')]=_[_0xa2e5('0x29')](_0xf29f7d['query']);_0x533ab2[_0xa2e5('0x2b')]=_[_0xa2e5('0x2c')](_0x533ab2[_0xa2e5('0x2d')],_0x533ab2[_0xa2e5('0x24')]);_0x2c18e7[_0xa2e5('0x2e')]=_[_0xa2e5('0x2c')](_0x533ab2[_0xa2e5('0x2d')],qs[_0xa2e5('0x2f')](_0xf29f7d[_0xa2e5('0x24')][_0xa2e5('0x2f')]));_0x2c18e7['attributes']=_0x2c18e7[_0xa2e5('0x2e')]['length']?_0x2c18e7['attributes']:_0x533ab2[_0xa2e5('0x2d')];if(_0xf29f7d[_0xa2e5('0x24')][_0xa2e5('0x30')]){_0x2c18e7[_0xa2e5('0x23')]=[{'all':!![]}];}_0x2c18e7=_[_0xa2e5('0x31')]({},_0x2c18e7,_0xf29f7d[_0xa2e5('0x32')]);return db['ChatQueue']['find'](_0x2c18e7)[_0xa2e5('0x13')](handleEntityNotFound(_0x21c474,null))['then'](respondWithResult(_0x21c474,null))[_0xa2e5('0x26')](handleError(_0x21c474,null));};exports[_0xa2e5('0x33')]=function(_0xd6bb94,_0x4da0db){return db[_0xa2e5('0x2a')][_0xa2e5('0x33')](_0xd6bb94['body'],{})[_0xa2e5('0x13')](function(_0x2d7882){var _0x527134=_0xd6bb94[_0xa2e5('0x34')]['get']({'plain':!![]});if(!_0x527134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x527134['role']===_0xa2e5('0x34')){var _0x22e450=_0x2d7882[_0xa2e5('0x14')]({'plain':!![]});var _0x3c5e22=_0xa2e5('0x15');return db[_0xa2e5('0x35')][_0xa2e5('0x36')]({'where':{'name':_0x3c5e22,'userProfileId':_0x527134[_0xa2e5('0x37')]},'raw':!![]})['then'](function(_0xcaa90b){if(_0xcaa90b&&_0xcaa90b['autoAssociation']===0x0){return db[_0xa2e5('0x38')][_0xa2e5('0x33')]({'name':_0x22e450[_0xa2e5('0x1a')],'resourceId':_0x22e450['id'],'type':_0xcaa90b['name'],'sectionId':_0xcaa90b['id']},{})[_0xa2e5('0x13')](function(){return _0x2d7882;});}else{return _0x2d7882;}})[_0xa2e5('0x26')](function(_0x346324){logger[_0xa2e5('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x346324);throw _0x346324;});}return _0x2d7882;})[_0xa2e5('0x13')](respondWithResult(_0x4da0db,0xc9))[_0xa2e5('0x26')](handleError(_0x4da0db,null));};exports[_0xa2e5('0x39')]=function(_0x3e858d,_0x5a20ad){if(_0x3e858d[_0xa2e5('0x3a')]['id']){delete _0x3e858d[_0xa2e5('0x3a')]['id'];}return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0x3e858d[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0x5a20ad,null))['then'](saveUpdates(_0x3e858d['body'],null))[_0xa2e5('0x13')](respondWithResult(_0x5a20ad,null))[_0xa2e5('0x26')](handleError(_0x5a20ad,null));};exports[_0xa2e5('0x16')]=function(_0x3d49ee,_0x4c11c2){return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0x3d49ee['params']['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0x4c11c2,null))[_0xa2e5('0x13')](removeEntity(_0x4c11c2,null))['catch'](handleError(_0x4c11c2,null));};exports['describe']=function(_0x164276,_0x595521){return db[_0xa2e5('0x2a')]['describe']()[_0xa2e5('0x13')](respondWithResult(_0x595521,null))[_0xa2e5('0x26')](handleError(_0x595521,null));};exports[_0xa2e5('0x3b')]=function(_0x229904,_0xd682fb){var _0x8e46bb={'raw':!![],'where':{}},_0x58a6ea={},_0x4c1b86;return db[_0xa2e5('0x2a')][_0xa2e5('0x3c')]({'where':{'id':_0x229904[_0xa2e5('0x28')]['id']}})['then'](handleEntityNotFound(_0xd682fb,null))[_0xa2e5('0x13')](function(_0x12bf33){if(_0x12bf33){_0x4c1b86=_0x12bf33[_0xa2e5('0x14')]({'plain':!![]});_0x58a6ea['model']=_[_0xa2e5('0x29')](db[_0xa2e5('0x3d')][_0xa2e5('0x1d')]);_0x58a6ea[_0xa2e5('0x24')]=_[_0xa2e5('0x29')](_0x229904[_0xa2e5('0x24')]);_0x58a6ea[_0xa2e5('0x2b')]=_[_0xa2e5('0x2c')](_0x58a6ea[_0xa2e5('0x2d')],_0x58a6ea[_0xa2e5('0x24')]);_0x8e46bb['attributes']=_[_0xa2e5('0x2c')](_0x58a6ea[_0xa2e5('0x2d')],qs[_0xa2e5('0x2f')](_0x229904[_0xa2e5('0x24')][_0xa2e5('0x2f')]));_0x8e46bb[_0xa2e5('0x2e')]=_0x8e46bb['attributes'][_0xa2e5('0x3e')]?_0x8e46bb[_0xa2e5('0x2e')]:_0x58a6ea[_0xa2e5('0x2d')];if(!_0x229904[_0xa2e5('0x24')][_0xa2e5('0x3f')](_0xa2e5('0x40'))){_0x8e46bb[_0xa2e5('0x10')]=qs[_0xa2e5('0x10')](_0x229904['query'][_0xa2e5('0x10')]);_0x8e46bb[_0xa2e5('0xe')]=qs[_0xa2e5('0xe')](_0x229904[_0xa2e5('0x24')][_0xa2e5('0xe')]);}_0x8e46bb[_0xa2e5('0x41')]=qs['sort'](_0x229904[_0xa2e5('0x24')][_0xa2e5('0x42')]);_0x8e46bb[_0xa2e5('0x22')]=qs[_0xa2e5('0x2b')](_['pick'](_0x229904[_0xa2e5('0x24')],_0x58a6ea[_0xa2e5('0x2b')]));_0x8e46bb[_0xa2e5('0x22')][_0xa2e5('0x43')]=_0x12bf33['id'];if(_0x229904[_0xa2e5('0x24')][_0xa2e5('0x44')]){_0x8e46bb[_0xa2e5('0x22')]=_[_0xa2e5('0x31')](_0x8e46bb[_0xa2e5('0x22')],{'$or':_[_0xa2e5('0x1c')](_0x8e46bb[_0xa2e5('0x2e')],function(_0x3394f9){var _0x32a3de={};_0x32a3de[_0x3394f9]={'$like':'%'+_0x229904[_0xa2e5('0x24')][_0xa2e5('0x44')]+'%'};return _0x32a3de;})});}_0x8e46bb=_[_0xa2e5('0x31')]({},_0x8e46bb,_0x229904[_0xa2e5('0x32')]);return db[_0xa2e5('0x3d')][_0xa2e5('0x25')](_0x8e46bb);}})[_0xa2e5('0x13')](function(_0x89bc78){if(_0x89bc78){return db[_0xa2e5('0x45')][_0xa2e5('0x46')]({'where':{'id':_[_0xa2e5('0x1c')](_0x89bc78,'UserId'),'role':_0xa2e5('0x47')},'attributes':['id',_0xa2e5('0x1a'),_0xa2e5('0x48'),_0xa2e5('0x49'),_0xa2e5('0x4a')]});}})[_0xa2e5('0x13')](function(_0x2fa455){if(_0x2fa455){return{'count':_0x2fa455['count'],'rows':_['map'](_0x2fa455['rows'],function(_0x589eaa){return{'membername':_0x589eaa[_0xa2e5('0x1a')],'UserId':_0x589eaa['id'],'queue_name':_0x4c1b86['name'],'ChatQueueId':_0x4c1b86['id'],'interface':util['format'](_0xa2e5('0x4b'),'SIP',_0x589eaa[_0xa2e5('0x1a')]),'penalty':0x0,'paused':_0x589eaa[_0xa2e5('0x48')],'createdAt':_0x589eaa[_0xa2e5('0x4a')],'updatedAt':_0x589eaa[_0xa2e5('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa2e5('0x13')](respondWithFilteredResult(_0xd682fb,_0x8e46bb))[_0xa2e5('0x26')](handleError(_0xd682fb,null));};exports['getTeams']=function(_0x5cd7a9,_0x3dba64){var _0x35d322={};var _0x13b3c6={};var _0x38bc23;var _0x59ee9e;return db[_0xa2e5('0x2a')][_0xa2e5('0x3c')]({'where':{'id':_0x5cd7a9[_0xa2e5('0x28')]['id']}})['then'](handleEntityNotFound(_0x3dba64,null))[_0xa2e5('0x13')](function(_0x133753){if(_0x133753){_0x38bc23=_0x133753;_0x13b3c6['model']=_['keys'](db[_0xa2e5('0x4c')][_0xa2e5('0x1d')]);_0x13b3c6[_0xa2e5('0x24')]=_[_0xa2e5('0x29')](_0x5cd7a9[_0xa2e5('0x24')]);_0x13b3c6[_0xa2e5('0x2b')]=_['intersection'](_0x13b3c6[_0xa2e5('0x2d')],_0x13b3c6[_0xa2e5('0x24')]);_0x35d322[_0xa2e5('0x2e')]=_[_0xa2e5('0x2c')](_0x13b3c6[_0xa2e5('0x2d')],qs[_0xa2e5('0x2f')](_0x5cd7a9['query'][_0xa2e5('0x2f')]));_0x35d322['attributes']=_0x35d322['attributes']['length']?_0x35d322[_0xa2e5('0x2e')]:_0x13b3c6[_0xa2e5('0x2d')];_0x35d322[_0xa2e5('0x41')]=qs[_0xa2e5('0x42')](_0x5cd7a9[_0xa2e5('0x24')][_0xa2e5('0x42')]);_0x35d322[_0xa2e5('0x22')]=qs[_0xa2e5('0x2b')](_[_0xa2e5('0x4d')](_0x5cd7a9[_0xa2e5('0x24')],_0x13b3c6[_0xa2e5('0x2b')]));if(_0x5cd7a9[_0xa2e5('0x24')]['filter']){_0x35d322['where']=_[_0xa2e5('0x31')](_0x35d322[_0xa2e5('0x22')],{'$or':_[_0xa2e5('0x1c')](_0x35d322[_0xa2e5('0x2e')],function(_0x450dbb){var _0x101afa={};_0x101afa[_0x450dbb]={'$like':'%'+_0x5cd7a9[_0xa2e5('0x24')][_0xa2e5('0x44')]+'%'};return _0x101afa;})});}_0x35d322=_[_0xa2e5('0x31')]({},_0x35d322,_0x5cd7a9[_0xa2e5('0x32')]);return _0x38bc23[_0xa2e5('0x4e')](_0x35d322);}})[_0xa2e5('0x13')](function(_0x4182c8){if(_0x4182c8){_0x59ee9e=_0x4182c8['length'];if(!_0x5cd7a9[_0xa2e5('0x24')]['hasOwnProperty'](_0xa2e5('0x40'))){_0x35d322[_0xa2e5('0x10')]=qs[_0xa2e5('0x10')](_0x5cd7a9[_0xa2e5('0x24')]['limit']);_0x35d322[_0xa2e5('0xe')]=qs[_0xa2e5('0xe')](_0x5cd7a9[_0xa2e5('0x24')][_0xa2e5('0xe')]);}return _0x38bc23[_0xa2e5('0x4e')](_0x35d322);}})[_0xa2e5('0x13')](function(_0x11bb3c){if(_0x11bb3c){return _0x11bb3c?{'count':_0x59ee9e,'rows':_0x11bb3c}:null;}})[_0xa2e5('0x13')](respondWithResult(_0x3dba64,null))[_0xa2e5('0x26')](handleError(_0x3dba64,null));};exports[_0xa2e5('0x4f')]=function(_0xd3b153,_0x2b84b5){var _0x507e80=_0xd3b153[_0xa2e5('0x3a')]['ids'];return db[_0xa2e5('0x4c')]['findAll']({'where':{'id':_0x507e80},'attributes':['id'],'include':[{'model':db[_0xa2e5('0x45')],'as':'Agents','attributes':['id',_0xa2e5('0x1a'),'online',_0xa2e5('0x50'),_0xa2e5('0x51')],'raw':!![]}]})['then'](function(_0x4763b7){if(_0x4763b7){var _0x446803=_['flatMap'](_0x4763b7,function(_0x594c60){var _0x502b59=_0x594c60[_0xa2e5('0x14')]({'plain':!![]});return _0x502b59[_0xa2e5('0x52')];});return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0xd3b153[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](function(_0x435558){return db[_0xa2e5('0x53')][_0xa2e5('0x54')](function(_0xa535cd){return _0x435558['addTeams'](_0x507e80,{'transaction':_0xa535cd})[_0xa2e5('0x13')](function(){return BPromise[_0xa2e5('0x55')](_0x446803,function(_0x5af0c2){return db[_0xa2e5('0x3d')][_0xa2e5('0x56')]({'where':{'UserId':_0x5af0c2['id'],'ChatQueueId':_0xd3b153['params']['id']},'transaction':_0xa535cd});});})[_0xa2e5('0x13')](function(){_0x446803[_0xa2e5('0x57')](function(_0x49e8a8){socket[_0xa2e5('0x58')](_0xa2e5('0x59'),{'UserId':_0x49e8a8['id'],'ChatQueueId':_0x435558['id']});});});});});}})[_0xa2e5('0x13')](respondWithStatusCode(_0x2b84b5,null))[_0xa2e5('0x26')](handleError(_0x2b84b5,null));};exports[_0xa2e5('0x5a')]=function(_0x18e8dd,_0xa8b922){return db[_0xa2e5('0x4c')][_0xa2e5('0x25')]({'where':{'id':_0x18e8dd[_0xa2e5('0x24')][_0xa2e5('0x5b')]},'attributes':['id'],'include':[{'model':db[_0xa2e5('0x45')],'as':_0xa2e5('0x52'),'attributes':['id'],'raw':!![]}]})[_0xa2e5('0x13')](handleEntityNotFound(_0xa8b922,null))[_0xa2e5('0x13')](function(_0x2556a4){var _0x5997eb=_['map'](_0x2556a4,'id');var _0x279f03=[];var _0x334aeb=[];var _0x34f5bb=squel[_0xa2e5('0x5c')]();_0x34f5bb['field']('tq.TeamId')[_0xa2e5('0x5d')](_0xa2e5('0x5e'),'tq')[_0xa2e5('0x5f')]('user_has_teams','ut',_0xa2e5('0x60'))[_0xa2e5('0x22')](_0xa2e5('0x61'),_0x18e8dd[_0xa2e5('0x28')]['id']);for(var _0x18c51=0x0;_0x18c51<_0x2556a4['length'];_0x18c51+=0x1){let _0x3c4177=_0x2556a4[_0x18c51];for(var _0x55e20e=0x0;_0x55e20e<_0x3c4177['Agents'][_0xa2e5('0x3e')];_0x55e20e+=0x1){let _0x15d694=_0x3c4177[_0xa2e5('0x52')][_0x55e20e];var _0x3fddbe=_0x34f5bb[_0xa2e5('0x62')]();_0x3fddbe[_0xa2e5('0x22')](_0xa2e5('0x63'),_0x15d694['id']);_0x334aeb[_0xa2e5('0x64')](db[_0xa2e5('0x53')][_0xa2e5('0x24')](_0x3fddbe['toString'](),{'type':db[_0xa2e5('0x53')][_0xa2e5('0x65')]['SELECT']})['then'](function(_0x569ac3){if(_0x569ac3[_0xa2e5('0x3e')]===0x1){return _0x15d694['id'];}else{var _0xea878=_['every'](_[_0xa2e5('0x1c')](_0x569ac3,_0xa2e5('0x66')),function(_0x50190c){return _['includes'](_0x5997eb,_0x50190c);});if(_0xea878){return _0x15d694['id'];}}}));}}return BPromise[_0xa2e5('0x67')](_0x334aeb)[_0xa2e5('0x13')](function(_0x498e2c){_0x279f03=_(_0x279f03)['union'](_0x498e2c)[_0xa2e5('0x68')]()[_0xa2e5('0x69')]();return db['ChatQueue'][_0xa2e5('0x36')]({'where':{'id':_0x18e8dd['params']['id']}})[_0xa2e5('0x13')](function(_0x36f8cd){return db[_0xa2e5('0x53')][_0xa2e5('0x54')](function(_0x2816f1){return _0x36f8cd['removeTeams'](_0x18e8dd[_0xa2e5('0x24')][_0xa2e5('0x5b')],{'transaction':_0x2816f1})[_0xa2e5('0x13')](function(){if(!_[_0xa2e5('0x6a')](_0x279f03)){return _0x36f8cd['removeAgents'](_0x279f03,{'transaction':_0x2816f1});}})[_0xa2e5('0x13')](function(){_0x279f03['forEach'](function(_0x5d1db3){socket[_0xa2e5('0x58')](_0xa2e5('0x6b'),{'UserId':_0x5d1db3,'ChatQueueId':_0x36f8cd['id']});});});});});});})['then'](respondWithStatusCode(_0xa8b922,null))[_0xa2e5('0x26')](handleError(_0xa8b922,null));};exports['addAgents']=function(_0x5aa27a,_0x2b42bd){return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0x5aa27a[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0x2b42bd,null))[_0xa2e5('0x13')](function(_0x39c316){if(_0x39c316){return _0x39c316[_0xa2e5('0x6c')](_0x5aa27a[_0xa2e5('0x3a')][_0xa2e5('0x5b')],_[_0xa2e5('0x6d')](_0x5aa27a[_0xa2e5('0x3a')],[_0xa2e5('0x5b'),'id'])||{})[_0xa2e5('0x6e')](function(_0x4323f7){for(var _0x38641c=0x0;_0x38641c<_0x5aa27a[_0xa2e5('0x3a')]['ids'][_0xa2e5('0x3e')];_0x38641c+=0x1){socket[_0xa2e5('0x58')](_0xa2e5('0x59'),{'UserId':Number(_0x5aa27a[_0xa2e5('0x3a')][_0xa2e5('0x5b')][_0x38641c]),'ChatQueueId':Number(_0x5aa27a[_0xa2e5('0x28')]['id'])});}return _0x4323f7;});}})[_0xa2e5('0x13')](respondWithResult(_0x2b42bd,null))['catch'](handleError(_0x2b42bd,null));};exports[_0xa2e5('0x6f')]=function(_0x9a17c8,_0xabde46){return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0x9a17c8[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0xabde46,null))[_0xa2e5('0x13')](function(_0xaf9ee1){if(_0xaf9ee1){return _0xaf9ee1[_0xa2e5('0x6f')](_0x9a17c8['query'][_0xa2e5('0x5b')])[_0xa2e5('0x13')](function(){if(_[_0xa2e5('0x70')](_0x9a17c8[_0xa2e5('0x24')][_0xa2e5('0x5b')])){for(var _0x476e97=0x0;_0x476e97<_0x9a17c8['query'][_0xa2e5('0x5b')]['length'];_0x476e97+=0x1){socket[_0xa2e5('0x58')]('userChatQueue:remove',{'UserId':Number(_0x9a17c8['query'][_0xa2e5('0x5b')][_0x476e97]),'ChatQueueId':Number(_0x9a17c8[_0xa2e5('0x28')]['id'])});}}else{socket['emit'](_0xa2e5('0x6b'),{'UserId':Number(_0x9a17c8[_0xa2e5('0x24')]['ids']),'ChatQueueId':Number(_0x9a17c8[_0xa2e5('0x28')]['id'])});}});}})[_0xa2e5('0x13')](respondWithStatusCode(_0xabde46,null))[_0xa2e5('0x26')](handleError(_0xabde46,null));};exports[_0xa2e5('0x71')]=function(_0x416327,_0x438bfe){var _0x331675={};var _0x4a8ed0={};var _0x3ff9e9;var _0x40dd9e;return db['ChatQueue'][_0xa2e5('0x3c')]({'where':{'id':_0x416327[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0x438bfe,null))[_0xa2e5('0x13')](function(_0x336b48){if(_0x336b48){_0x3ff9e9=_0x336b48;_0x4a8ed0[_0xa2e5('0x2d')]=_['keys'](db[_0xa2e5('0x45')][_0xa2e5('0x1d')]);_0x4a8ed0[_0xa2e5('0x24')]=_[_0xa2e5('0x29')](_0x416327[_0xa2e5('0x24')]);_0x4a8ed0['filters']=_[_0xa2e5('0x2c')](_0x4a8ed0[_0xa2e5('0x2d')],_0x4a8ed0[_0xa2e5('0x24')]);_0x331675['attributes']=_['intersection'](_0x4a8ed0[_0xa2e5('0x2d')],qs[_0xa2e5('0x2f')](_0x416327[_0xa2e5('0x24')][_0xa2e5('0x2f')]));_0x331675['attributes']=_0x331675[_0xa2e5('0x2e')][_0xa2e5('0x3e')]?_0x331675['attributes']:_0x4a8ed0[_0xa2e5('0x2d')];_0x331675[_0xa2e5('0x41')]=qs[_0xa2e5('0x42')](_0x416327[_0xa2e5('0x24')]['sort']);_0x331675['where']=qs[_0xa2e5('0x2b')](_[_0xa2e5('0x4d')](_0x416327[_0xa2e5('0x24')],_0x4a8ed0['filters']));if(_0x416327['query'][_0xa2e5('0x44')]){_0x331675[_0xa2e5('0x22')]=_[_0xa2e5('0x31')](_0x331675[_0xa2e5('0x22')],{'$or':_[_0xa2e5('0x1c')](_0x331675[_0xa2e5('0x2e')],function(_0x44f1af){var _0x3914ce={};_0x3914ce[_0x44f1af]={'$like':'%'+_0x416327[_0xa2e5('0x24')][_0xa2e5('0x44')]+'%'};return _0x3914ce;})});}_0x331675=_[_0xa2e5('0x31')]({},_0x331675,_0x416327[_0xa2e5('0x32')]);return _0x3ff9e9[_0xa2e5('0x71')](_0x331675);}})[_0xa2e5('0x13')](function(_0x5693f8){if(_0x5693f8){_0x40dd9e=_0x5693f8[_0xa2e5('0x3e')];if(!_0x416327[_0xa2e5('0x24')][_0xa2e5('0x3f')](_0xa2e5('0x40'))){_0x331675[_0xa2e5('0x10')]=qs[_0xa2e5('0x10')](_0x416327['query'][_0xa2e5('0x10')]);_0x331675[_0xa2e5('0xe')]=qs[_0xa2e5('0xe')](_0x416327['query'][_0xa2e5('0xe')]);}return _0x3ff9e9[_0xa2e5('0x71')](_0x331675);}})['then'](function(_0x278555){if(_0x278555){return _0x278555?{'count':_0x40dd9e,'rows':_0x278555}:null;}})[_0xa2e5('0x13')](respondWithResult(_0x438bfe,null))[_0xa2e5('0x26')](handleError(_0x438bfe,null));}; \ No newline at end of file +var _0xabf4=['redis','defaults','localhost','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','rawAttributes','type','key','where','include','query','findAll','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','filter','options','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','Team','ids','User','Agents','online','voicePause','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','includes','all','union','value','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb'];(function(_0x3d79ac,_0x222051){var _0x475b30=function(_0x119831){while(--_0x119831){_0x3d79ac['push'](_0x3d79ac['shift']());}};_0x475b30(++_0x222051);}(_0xabf4,0x77));var _0x4abf=function(_0x34f41a,_0x5f1d24){_0x34f41a=_0x34f41a-0x0;var _0x4bfb9b=_0xabf4[_0x34f41a];return _0x4bfb9b;};'use strict';var BPromise=require('bluebird');var util=require(_0x4abf('0x0'));var _=require(_0x4abf('0x1'));var squel=require(_0x4abf('0x2'));var Redis=require('ioredis');var qs=require(_0x4abf('0x3'));var logger=require(_0x4abf('0x4'))(_0x4abf('0x5'));var config=require('../../config/environment');var db=require(_0x4abf('0x6'))['db'];config[_0x4abf('0x7')]=_[_0x4abf('0x8')](config['redis'],{'host':_0x4abf('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4abf('0x7')]));require(_0x4abf('0xa'))[_0x4abf('0xb')](socket);function respondWithStatusCode(_0x53a02a,_0x211221){_0x211221=_0x211221||0xcc;return function(_0x3c47e4){if(_0x3c47e4){return _0x53a02a[_0x4abf('0xc')](_0x211221);}return _0x53a02a[_0x4abf('0xd')](_0x211221)[_0x4abf('0xe')]();};}function respondWithResult(_0x155768,_0xc4914){_0xc4914=_0xc4914||0xc8;return function(_0x473f5a){if(_0x473f5a){return _0x155768['status'](_0xc4914)[_0x4abf('0xf')](_0x473f5a);}};}function respondWithFilteredResult(_0x41b901,_0x2b6cae){return function(_0x2a9487){if(_0x2a9487){var _0x5169cf=typeof _0x2b6cae[_0x4abf('0x10')]===_0x4abf('0x11')&&typeof _0x2b6cae[_0x4abf('0x12')]==='undefined';var _0x2ad0a1=_0x2a9487[_0x4abf('0x13')];var _0x188a43=_0x5169cf?0x0:_0x2b6cae[_0x4abf('0x10')];var _0x5f452f=_0x5169cf?_0x2a9487[_0x4abf('0x13')]:_0x2b6cae[_0x4abf('0x10')]+_0x2b6cae[_0x4abf('0x12')];var _0x470aaa;if(_0x5f452f>=_0x2ad0a1){_0x5f452f=_0x2ad0a1;_0x470aaa=0xc8;}else{_0x470aaa=0xce;}_0x41b901['status'](_0x470aaa);return _0x41b901[_0x4abf('0x14')](_0x4abf('0x15'),_0x188a43+'-'+_0x5f452f+'/'+_0x2ad0a1)[_0x4abf('0xf')](_0x2a9487);}return null;};}function saveUpdates(_0x1f0bce){return function(_0xc2b78d){if(_0xc2b78d){return _0xc2b78d[_0x4abf('0x16')](_0x1f0bce)[_0x4abf('0x17')](function(_0x1d9bfa){return _0x1d9bfa;});}return null;};}function removeEntity(_0x178917){return function(_0x79d84f){if(_0x79d84f){return _0x79d84f[_0x4abf('0x18')]()['then'](function(){var _0x2072f1=_0x79d84f[_0x4abf('0x19')]({'plain':!![]});var _0x3745da=_0x4abf('0x1a');return db[_0x4abf('0x1b')][_0x4abf('0x18')]({'where':{'type':_0x3745da,'resourceId':_0x2072f1['id']}})[_0x4abf('0x17')](function(){return _0x79d84f;});})['then'](function(){_0x178917[_0x4abf('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b45b){return function(_0x38768b){if(!_0x38768b){_0x11b45b[_0x4abf('0xc')](0x194);}return _0x38768b;};}function handleError(_0xfa066e,_0x2044f9){_0x2044f9=_0x2044f9||0x1f4;return function(_0x186023){logger[_0x4abf('0x1c')](_0x186023[_0x4abf('0x1d')]);if(_0x186023[_0x4abf('0x1e')]){delete _0x186023[_0x4abf('0x1e')];}_0xfa066e[_0x4abf('0xd')](_0x2044f9)[_0x4abf('0x1f')](_0x186023);};}exports[_0x4abf('0x20')]=function(_0x5cb8dc,_0x58f8d7){var _0x56c923={};var _0x5de50d={'count':0x0,'rows':[]};var _0x42c656=_[_0x4abf('0x21')](db[_0x4abf('0x22')][_0x4abf('0x23')],function(_0x3a3668){return{'name':_0x3a3668['fieldName'],'type':_0x3a3668[_0x4abf('0x24')][_0x4abf('0x25')]};});_0x56c923=qs['getOptions'](_0x42c656,_0x5cb8dc);var _0xd08200={'where':_0x56c923[_0x4abf('0x26')]};return db[_0x4abf('0x22')][_0x4abf('0x13')](_0xd08200)[_0x4abf('0x17')](function(_0xec4417){_0x5de50d[_0x4abf('0x13')]=_0xec4417;_0x56c923[_0x4abf('0x27')]=qs['include'](_0x5cb8dc[_0x4abf('0x28')]);return db['ChatQueue'][_0x4abf('0x29')](_0x56c923);})[_0x4abf('0x17')](function(_0x2c4650){_0x5de50d['rows']=_0x2c4650;return _0x5de50d;})[_0x4abf('0x17')](respondWithFilteredResult(_0x58f8d7,_0x56c923))['catch'](handleError(_0x58f8d7,null));};exports[_0x4abf('0x2a')]=function(_0x231b39,_0x12a277){var _0x34a12f={'raw':!![],'where':{'id':_0x231b39[_0x4abf('0x2b')]['id']}},_0x5d90e9={};_0x5d90e9[_0x4abf('0x2c')]=_[_0x4abf('0x2d')](db['ChatQueue']['rawAttributes']);_0x5d90e9[_0x4abf('0x28')]=_[_0x4abf('0x2d')](_0x231b39[_0x4abf('0x28')]);_0x5d90e9[_0x4abf('0x2e')]=_['intersection'](_0x5d90e9['model'],_0x5d90e9[_0x4abf('0x28')]);_0x34a12f[_0x4abf('0x2f')]=_[_0x4abf('0x30')](_0x5d90e9['model'],qs[_0x4abf('0x31')](_0x231b39[_0x4abf('0x28')]['fields']));_0x34a12f['attributes']=_0x34a12f[_0x4abf('0x2f')][_0x4abf('0x32')]?_0x34a12f[_0x4abf('0x2f')]:_0x5d90e9[_0x4abf('0x2c')];if(_0x231b39['query'][_0x4abf('0x33')]){_0x34a12f[_0x4abf('0x27')]=[{'all':!![]}];}_0x34a12f=_[_0x4abf('0x34')]({},_0x34a12f,_0x231b39['options']);return db[_0x4abf('0x22')][_0x4abf('0x35')](_0x34a12f)[_0x4abf('0x17')](handleEntityNotFound(_0x12a277,null))['then'](respondWithResult(_0x12a277,null))[_0x4abf('0x36')](handleError(_0x12a277,null));};exports[_0x4abf('0x37')]=function(_0x3d78f4,_0x2a243e){return db[_0x4abf('0x22')][_0x4abf('0x37')](_0x3d78f4[_0x4abf('0x38')],{})[_0x4abf('0x17')](function(_0x574548){var _0x1c17cd=_0x3d78f4['user']['get']({'plain':!![]});if(!_0x1c17cd)throw new Error(_0x4abf('0x39'));if(_0x1c17cd[_0x4abf('0x3a')]===_0x4abf('0x3b')){var _0x1e2377=_0x574548[_0x4abf('0x19')]({'plain':!![]});var _0x505339=_0x4abf('0x1a');return db[_0x4abf('0x3c')][_0x4abf('0x35')]({'where':{'name':_0x505339,'userProfileId':_0x1c17cd[_0x4abf('0x3d')]},'raw':!![]})[_0x4abf('0x17')](function(_0x49e4fd){if(_0x49e4fd&&_0x49e4fd[_0x4abf('0x3e')]===0x0){return db[_0x4abf('0x1b')][_0x4abf('0x37')]({'name':_0x1e2377[_0x4abf('0x1e')],'resourceId':_0x1e2377['id'],'type':_0x49e4fd['name'],'sectionId':_0x49e4fd['id']},{})[_0x4abf('0x17')](function(){return _0x574548;});}else{return _0x574548;}})[_0x4abf('0x36')](function(_0x531abe){logger[_0x4abf('0x1c')](_0x4abf('0x3f'),_0x531abe);throw _0x531abe;});}return _0x574548;})[_0x4abf('0x17')](respondWithResult(_0x2a243e,0xc9))[_0x4abf('0x36')](handleError(_0x2a243e,null));};exports[_0x4abf('0x16')]=function(_0x31ac3d,_0x40055d){if(_0x31ac3d[_0x4abf('0x38')]['id']){delete _0x31ac3d[_0x4abf('0x38')]['id'];}return db[_0x4abf('0x22')]['find']({'where':{'id':_0x31ac3d[_0x4abf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x40055d,null))[_0x4abf('0x17')](saveUpdates(_0x31ac3d['body'],null))[_0x4abf('0x17')](respondWithResult(_0x40055d,null))[_0x4abf('0x36')](handleError(_0x40055d,null));};exports[_0x4abf('0x18')]=function(_0x2a90be,_0x2695e3){return db[_0x4abf('0x22')][_0x4abf('0x35')]({'where':{'id':_0x2a90be['params']['id']}})[_0x4abf('0x17')](handleEntityNotFound(_0x2695e3,null))[_0x4abf('0x17')](removeEntity(_0x2695e3,null))[_0x4abf('0x36')](handleError(_0x2695e3,null));};exports['describe']=function(_0x54d590,_0x2c6b76){return db[_0x4abf('0x22')][_0x4abf('0x40')]()['then'](respondWithResult(_0x2c6b76,null))[_0x4abf('0x36')](handleError(_0x2c6b76,null));};exports[_0x4abf('0x41')]=function(_0x28a756,_0xec661a){var _0x1f3a7d={'raw':!![],'where':{}},_0x14ac29={},_0x2fbf68;return db[_0x4abf('0x22')]['findOne']({'where':{'id':_0x28a756['params']['id']}})['then'](handleEntityNotFound(_0xec661a,null))[_0x4abf('0x17')](function(_0xec48ef){if(_0xec48ef){_0x2fbf68=_0xec48ef[_0x4abf('0x19')]({'plain':!![]});_0x14ac29[_0x4abf('0x2c')]=_[_0x4abf('0x2d')](db[_0x4abf('0x42')][_0x4abf('0x23')]);_0x14ac29['query']=_[_0x4abf('0x2d')](_0x28a756[_0x4abf('0x28')]);_0x14ac29[_0x4abf('0x2e')]=_[_0x4abf('0x30')](_0x14ac29[_0x4abf('0x2c')],_0x14ac29[_0x4abf('0x28')]);_0x1f3a7d[_0x4abf('0x2f')]=_[_0x4abf('0x30')](_0x14ac29[_0x4abf('0x2c')],qs[_0x4abf('0x31')](_0x28a756['query'][_0x4abf('0x31')]));_0x1f3a7d['attributes']=_0x1f3a7d[_0x4abf('0x2f')][_0x4abf('0x32')]?_0x1f3a7d[_0x4abf('0x2f')]:_0x14ac29[_0x4abf('0x2c')];if(!_0x28a756[_0x4abf('0x28')][_0x4abf('0x43')](_0x4abf('0x44'))){_0x1f3a7d[_0x4abf('0x12')]=qs[_0x4abf('0x12')](_0x28a756[_0x4abf('0x28')][_0x4abf('0x12')]);_0x1f3a7d['offset']=qs[_0x4abf('0x10')](_0x28a756[_0x4abf('0x28')]['offset']);}_0x1f3a7d[_0x4abf('0x45')]=qs[_0x4abf('0x46')](_0x28a756[_0x4abf('0x28')][_0x4abf('0x46')]);_0x1f3a7d[_0x4abf('0x26')]=qs[_0x4abf('0x2e')](_[_0x4abf('0x47')](_0x28a756[_0x4abf('0x28')],_0x14ac29[_0x4abf('0x2e')]));_0x1f3a7d[_0x4abf('0x26')]['ChatQueueId']=_0xec48ef['id'];if(_0x28a756[_0x4abf('0x28')][_0x4abf('0x48')]){_0x1f3a7d[_0x4abf('0x26')]=_['merge'](_0x1f3a7d[_0x4abf('0x26')],{'$or':_[_0x4abf('0x21')](_0x1f3a7d['attributes'],function(_0x1f531f){var _0x47f0ec={};_0x47f0ec[_0x1f531f]={'$like':'%'+_0x28a756[_0x4abf('0x28')][_0x4abf('0x48')]+'%'};return _0x47f0ec;})});}_0x1f3a7d=_[_0x4abf('0x34')]({},_0x1f3a7d,_0x28a756[_0x4abf('0x49')]);return db[_0x4abf('0x42')]['findAll'](_0x1f3a7d);}})['then'](function(_0x24cff2){if(_0x24cff2){return db['User'][_0x4abf('0x4a')]({'where':{'id':_['map'](_0x24cff2,_0x4abf('0x4b')),'role':_0x4abf('0x4c')},'attributes':['id',_0x4abf('0x1e'),_0x4abf('0x4d'),_0x4abf('0x4e'),_0x4abf('0x4f')]});}})['then'](function(_0xe7383e){if(_0xe7383e){return{'count':_0xe7383e['count'],'rows':_[_0x4abf('0x21')](_0xe7383e[_0x4abf('0x50')],function(_0x185d54){return{'membername':_0x185d54[_0x4abf('0x1e')],'UserId':_0x185d54['id'],'queue_name':_0x2fbf68[_0x4abf('0x1e')],'ChatQueueId':_0x2fbf68['id'],'interface':util[_0x4abf('0x51')](_0x4abf('0x52'),_0x4abf('0x53'),_0x185d54['name']),'penalty':0x0,'paused':_0x185d54['chatPause'],'createdAt':_0x185d54[_0x4abf('0x4f')],'updatedAt':_0x185d54[_0x4abf('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4abf('0x17')](respondWithFilteredResult(_0xec661a,_0x1f3a7d))[_0x4abf('0x36')](handleError(_0xec661a,null));};exports[_0x4abf('0x54')]=function(_0x281c85,_0xd468a9){var _0x584084={};var _0x34232e={};var _0x4d89de;var _0xcf48fd;return db[_0x4abf('0x22')][_0x4abf('0x55')]({'where':{'id':_0x281c85['params']['id']}})[_0x4abf('0x17')](handleEntityNotFound(_0xd468a9,null))[_0x4abf('0x17')](function(_0xec860){if(_0xec860){_0x4d89de=_0xec860;_0x34232e[_0x4abf('0x2c')]=_[_0x4abf('0x2d')](db[_0x4abf('0x56')][_0x4abf('0x23')]);_0x34232e[_0x4abf('0x28')]=_['keys'](_0x281c85[_0x4abf('0x28')]);_0x34232e['filters']=_[_0x4abf('0x30')](_0x34232e[_0x4abf('0x2c')],_0x34232e['query']);_0x584084['attributes']=_[_0x4abf('0x30')](_0x34232e['model'],qs['fields'](_0x281c85[_0x4abf('0x28')]['fields']));_0x584084['attributes']=_0x584084['attributes']['length']?_0x584084[_0x4abf('0x2f')]:_0x34232e[_0x4abf('0x2c')];_0x584084['order']=qs['sort'](_0x281c85[_0x4abf('0x28')][_0x4abf('0x46')]);_0x584084['where']=qs['filters'](_[_0x4abf('0x47')](_0x281c85[_0x4abf('0x28')],_0x34232e[_0x4abf('0x2e')]));if(_0x281c85[_0x4abf('0x28')]['filter']){_0x584084['where']=_[_0x4abf('0x34')](_0x584084[_0x4abf('0x26')],{'$or':_[_0x4abf('0x21')](_0x584084['attributes'],function(_0x4937b8){var _0xd6f5e5={};_0xd6f5e5[_0x4937b8]={'$like':'%'+_0x281c85[_0x4abf('0x28')][_0x4abf('0x48')]+'%'};return _0xd6f5e5;})});}_0x584084=_[_0x4abf('0x34')]({},_0x584084,_0x281c85['options']);return _0x4d89de[_0x4abf('0x54')](_0x584084);}})[_0x4abf('0x17')](function(_0x484881){if(_0x484881){_0xcf48fd=_0x484881[_0x4abf('0x32')];if(!_0x281c85[_0x4abf('0x28')]['hasOwnProperty'](_0x4abf('0x44'))){_0x584084[_0x4abf('0x12')]=qs[_0x4abf('0x12')](_0x281c85[_0x4abf('0x28')][_0x4abf('0x12')]);_0x584084[_0x4abf('0x10')]=qs[_0x4abf('0x10')](_0x281c85[_0x4abf('0x28')]['offset']);}return _0x4d89de[_0x4abf('0x54')](_0x584084);}})['then'](function(_0x4012a0){if(_0x4012a0){return _0x4012a0?{'count':_0xcf48fd,'rows':_0x4012a0}:null;}})[_0x4abf('0x17')](respondWithResult(_0xd468a9,null))[_0x4abf('0x36')](handleError(_0xd468a9,null));};exports['addTeams']=function(_0x519fb7,_0x4da9a2){var _0x91f1e4=_0x519fb7['body'][_0x4abf('0x57')];return db[_0x4abf('0x56')][_0x4abf('0x29')]({'where':{'id':_0x91f1e4},'attributes':['id'],'include':[{'model':db[_0x4abf('0x58')],'as':_0x4abf('0x59'),'attributes':['id','name',_0x4abf('0x5a'),_0x4abf('0x5b'),'interface'],'raw':!![]}]})[_0x4abf('0x17')](function(_0x4f9a08){if(_0x4f9a08){var _0x73ebb=_[_0x4abf('0x5c')](_0x4f9a08,function(_0x1284a9){var _0x7d871f=_0x1284a9[_0x4abf('0x19')]({'plain':!![]});return _0x7d871f[_0x4abf('0x59')];});return db[_0x4abf('0x22')][_0x4abf('0x35')]({'where':{'id':_0x519fb7[_0x4abf('0x2b')]['id']}})[_0x4abf('0x17')](function(_0x413c32){return db['sequelize'][_0x4abf('0x5d')](function(_0x545df7){return _0x413c32[_0x4abf('0x5e')](_0x91f1e4,{'transaction':_0x545df7})[_0x4abf('0x17')](function(){return BPromise[_0x4abf('0x5f')](_0x73ebb,function(_0x466fe5){return db[_0x4abf('0x42')][_0x4abf('0x60')]({'where':{'UserId':_0x466fe5['id'],'ChatQueueId':_0x519fb7[_0x4abf('0x2b')]['id']},'transaction':_0x545df7});});})['then'](function(){_0x73ebb[_0x4abf('0x61')](function(_0x23a2d4){socket[_0x4abf('0x62')](_0x4abf('0x63'),{'UserId':_0x23a2d4['id'],'ChatQueueId':_0x413c32['id']});});});});});}})['then'](respondWithStatusCode(_0x4da9a2,null))[_0x4abf('0x36')](handleError(_0x4da9a2,null));};exports[_0x4abf('0x64')]=function(_0x5ea920,_0x25ee71){return db[_0x4abf('0x56')][_0x4abf('0x29')]({'where':{'id':_0x5ea920['query'][_0x4abf('0x57')]},'attributes':['id'],'include':[{'model':db[_0x4abf('0x58')],'as':_0x4abf('0x59'),'attributes':['id'],'raw':!![]}]})[_0x4abf('0x17')](handleEntityNotFound(_0x25ee71,null))[_0x4abf('0x17')](function(_0x115e27){var _0x3809ff=_[_0x4abf('0x21')](_0x115e27,'id');var _0x15b882=[];var _0x5475ca=[];var _0x4ef80d=squel[_0x4abf('0x65')]();_0x4ef80d[_0x4abf('0x66')](_0x4abf('0x67'))[_0x4abf('0x68')]('team_has_chat_queues','tq')[_0x4abf('0x69')](_0x4abf('0x6a'),'ut',_0x4abf('0x6b'))[_0x4abf('0x26')](_0x4abf('0x6c'),_0x5ea920[_0x4abf('0x2b')]['id']);for(var _0x3a056b=0x0;_0x3a056b<_0x115e27[_0x4abf('0x32')];_0x3a056b+=0x1){let _0x305d12=_0x115e27[_0x3a056b];for(var _0x156fdd=0x0;_0x156fdd<_0x305d12[_0x4abf('0x59')][_0x4abf('0x32')];_0x156fdd+=0x1){let _0x4b3e33=_0x305d12[_0x4abf('0x59')][_0x156fdd];var _0x5bf25d=_0x4ef80d[_0x4abf('0x6d')]();_0x5bf25d[_0x4abf('0x26')](_0x4abf('0x6e'),_0x4b3e33['id']);_0x5475ca[_0x4abf('0x6f')](db['sequelize'][_0x4abf('0x28')](_0x5bf25d[_0x4abf('0x70')](),{'type':db[_0x4abf('0x71')][_0x4abf('0x72')]['SELECT']})[_0x4abf('0x17')](function(_0x23aa05){if(_0x23aa05[_0x4abf('0x32')]===0x1){return _0x4b3e33['id'];}else{var _0x4b8da9=_[_0x4abf('0x73')](_[_0x4abf('0x21')](_0x23aa05,'TeamId'),function(_0x4bb8f){return _[_0x4abf('0x74')](_0x3809ff,_0x4bb8f);});if(_0x4b8da9){return _0x4b3e33['id'];}}}));}}return BPromise[_0x4abf('0x75')](_0x5475ca)[_0x4abf('0x17')](function(_0x4a39f6){_0x15b882=_(_0x15b882)[_0x4abf('0x76')](_0x4a39f6)['compact']()[_0x4abf('0x77')]();return db[_0x4abf('0x22')]['find']({'where':{'id':_0x5ea920[_0x4abf('0x2b')]['id']}})[_0x4abf('0x17')](function(_0x1bc6fa){return db[_0x4abf('0x71')][_0x4abf('0x5d')](function(_0x109c52){return _0x1bc6fa[_0x4abf('0x64')](_0x5ea920[_0x4abf('0x28')]['ids'],{'transaction':_0x109c52})[_0x4abf('0x17')](function(){if(!_['isEmpty'](_0x15b882)){return _0x1bc6fa['removeAgents'](_0x15b882,{'transaction':_0x109c52});}})[_0x4abf('0x17')](function(){_0x15b882[_0x4abf('0x61')](function(_0x38a577){socket['emit'](_0x4abf('0x78'),{'UserId':_0x38a577,'ChatQueueId':_0x1bc6fa['id']});});});});});});})[_0x4abf('0x17')](respondWithStatusCode(_0x25ee71,null))[_0x4abf('0x36')](handleError(_0x25ee71,null));};exports[_0x4abf('0x79')]=function(_0x474fdd,_0x1ad492){return db[_0x4abf('0x22')][_0x4abf('0x35')]({'where':{'id':_0x474fdd[_0x4abf('0x2b')]['id']}})[_0x4abf('0x17')](handleEntityNotFound(_0x1ad492,null))['then'](function(_0x371639){if(_0x371639){return _0x371639['addAgents'](_0x474fdd['body'][_0x4abf('0x57')],_[_0x4abf('0x7a')](_0x474fdd[_0x4abf('0x38')],[_0x4abf('0x57'),'id'])||{})[_0x4abf('0x7b')](function(_0x67f9a4){for(var _0x5aef6e=0x0;_0x5aef6e<_0x474fdd[_0x4abf('0x38')]['ids'][_0x4abf('0x32')];_0x5aef6e+=0x1){socket[_0x4abf('0x62')](_0x4abf('0x63'),{'UserId':Number(_0x474fdd[_0x4abf('0x38')][_0x4abf('0x57')][_0x5aef6e]),'ChatQueueId':Number(_0x474fdd['params']['id'])});}return _0x67f9a4;});}})['then'](respondWithResult(_0x1ad492,null))[_0x4abf('0x36')](handleError(_0x1ad492,null));};exports[_0x4abf('0x7c')]=function(_0x56df70,_0x3e70bd){return db['ChatQueue'][_0x4abf('0x35')]({'where':{'id':_0x56df70[_0x4abf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3e70bd,null))[_0x4abf('0x17')](function(_0x198776){if(_0x198776){return _0x198776[_0x4abf('0x7c')](_0x56df70[_0x4abf('0x28')][_0x4abf('0x57')])[_0x4abf('0x17')](function(){if(_['isArray'](_0x56df70[_0x4abf('0x28')]['ids'])){for(var _0x2d9aeb=0x0;_0x2d9aeb<_0x56df70[_0x4abf('0x28')]['ids'][_0x4abf('0x32')];_0x2d9aeb+=0x1){socket[_0x4abf('0x62')](_0x4abf('0x78'),{'UserId':Number(_0x56df70[_0x4abf('0x28')][_0x4abf('0x57')][_0x2d9aeb]),'ChatQueueId':Number(_0x56df70[_0x4abf('0x2b')]['id'])});}}else{socket[_0x4abf('0x62')]('userChatQueue:remove',{'UserId':Number(_0x56df70[_0x4abf('0x28')][_0x4abf('0x57')]),'ChatQueueId':Number(_0x56df70[_0x4abf('0x2b')]['id'])});}});}})[_0x4abf('0x17')](respondWithStatusCode(_0x3e70bd,null))['catch'](handleError(_0x3e70bd,null));};exports[_0x4abf('0x7d')]=function(_0x36c929,_0x43f626){var _0x235b68={};var _0xb55a4={};var _0x498ceb;var _0x476963;return db['ChatQueue'][_0x4abf('0x55')]({'where':{'id':_0x36c929['params']['id']}})[_0x4abf('0x17')](handleEntityNotFound(_0x43f626,null))[_0x4abf('0x17')](function(_0x1d9ac3){if(_0x1d9ac3){_0x498ceb=_0x1d9ac3;_0xb55a4[_0x4abf('0x2c')]=_['keys'](db[_0x4abf('0x58')][_0x4abf('0x23')]);_0xb55a4['query']=_[_0x4abf('0x2d')](_0x36c929[_0x4abf('0x28')]);_0xb55a4[_0x4abf('0x2e')]=_[_0x4abf('0x30')](_0xb55a4[_0x4abf('0x2c')],_0xb55a4[_0x4abf('0x28')]);_0x235b68[_0x4abf('0x2f')]=_[_0x4abf('0x30')](_0xb55a4[_0x4abf('0x2c')],qs[_0x4abf('0x31')](_0x36c929['query']['fields']));_0x235b68[_0x4abf('0x2f')]=_0x235b68[_0x4abf('0x2f')][_0x4abf('0x32')]?_0x235b68[_0x4abf('0x2f')]:_0xb55a4[_0x4abf('0x2c')];_0x235b68[_0x4abf('0x45')]=qs[_0x4abf('0x46')](_0x36c929[_0x4abf('0x28')][_0x4abf('0x46')]);_0x235b68[_0x4abf('0x26')]=qs[_0x4abf('0x2e')](_[_0x4abf('0x47')](_0x36c929[_0x4abf('0x28')],_0xb55a4['filters']));if(_0x36c929[_0x4abf('0x28')][_0x4abf('0x48')]){_0x235b68[_0x4abf('0x26')]=_[_0x4abf('0x34')](_0x235b68[_0x4abf('0x26')],{'$or':_[_0x4abf('0x21')](_0x235b68['attributes'],function(_0x41c95f){var _0x192c85={};_0x192c85[_0x41c95f]={'$like':'%'+_0x36c929[_0x4abf('0x28')][_0x4abf('0x48')]+'%'};return _0x192c85;})});}_0x235b68=_['merge']({},_0x235b68,_0x36c929[_0x4abf('0x49')]);return _0x498ceb[_0x4abf('0x7d')](_0x235b68);}})[_0x4abf('0x17')](function(_0x2d9546){if(_0x2d9546){_0x476963=_0x2d9546[_0x4abf('0x32')];if(!_0x36c929[_0x4abf('0x28')][_0x4abf('0x43')]('nolimit')){_0x235b68['limit']=qs[_0x4abf('0x12')](_0x36c929[_0x4abf('0x28')][_0x4abf('0x12')]);_0x235b68[_0x4abf('0x10')]=qs[_0x4abf('0x10')](_0x36c929[_0x4abf('0x28')][_0x4abf('0x10')]);}return _0x498ceb[_0x4abf('0x7d')](_0x235b68);}})['then'](function(_0x1063b8){if(_0x1063b8){return _0x1063b8?{'count':_0x476963,'rows':_0x1063b8}:null;}})[_0x4abf('0x17')](respondWithResult(_0x43f626,null))[_0x4abf('0x36')](handleError(_0x43f626,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b95392f..b2b1640 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 _0x1cd5=['hasOwnProperty','hook','exports','events','setMaxListeners','update','remove','emit'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x1cd5,0x193));var _0x51cd=function(_0x42331d,_0x324fe0){_0x42331d=_0x42331d-0x0;var _0x4b0c71=_0x1cd5[_0x42331d];return _0x4b0c71;};'use strict';var EventEmitter=require(_0x51cd('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x51cd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x51cd('0x2'),'afterDestroy':_0x51cd('0x3')};function emitEvent(_0x2fdfa5){return function(_0x19c74f,_0x538b10,_0x2bd804){ChatQueueEvents[_0x51cd('0x4')](_0x2fdfa5+':'+_0x19c74f['id'],_0x19c74f);ChatQueueEvents[_0x51cd('0x4')](_0x2fdfa5,_0x19c74f);_0x2bd804(null);};}for(var e in events){if(events[_0x51cd('0x5')](e)){var event=events[e];ChatQueue[_0x51cd('0x6')](e,emitEvent(event));}}module[_0x51cd('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x1c08=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x26f333,_0x394579){var _0x1424bb=function(_0x478063){while(--_0x478063){_0x26f333['push'](_0x26f333['shift']());}};_0x1424bb(++_0x394579);}(_0x1c08,0x17b));var _0x81c0=function(_0x39dbcb,_0x4f63d7){_0x39dbcb=_0x39dbcb-0x0;var _0x5aadb2=_0x1c08[_0x39dbcb];return _0x5aadb2;};'use strict';var EventEmitter=require(_0x81c0('0x0'));var ChatQueue=require(_0x81c0('0x1'))['db'][_0x81c0('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x81c0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x81c0('0x4'),'afterDestroy':_0x81c0('0x5')};function emitEvent(_0x5981ec){return function(_0x3f411d,_0x2d66e8,_0x1f8333){ChatQueueEvents[_0x81c0('0x6')](_0x5981ec+':'+_0x3f411d['id'],_0x3f411d);ChatQueueEvents[_0x81c0('0x6')](_0x5981ec,_0x3f411d);_0x1f8333(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x81c0('0x7')](e,emitEvent(event));}}module[_0x81c0('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 39cd6e8..f66137b 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 _0x56b9=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3809e3,_0x132e51){var _0x334579=function(_0x109a77){while(--_0x109a77){_0x3809e3['push'](_0x3809e3['shift']());}};_0x334579(++_0x132e51);}(_0x56b9,0x1e2));var _0x956b=function(_0x4f964a,_0x41f80b){_0x4f964a=_0x4f964a-0x0;var _0x22142b=_0x56b9[_0x4f964a];return _0x22142b;};'use strict';var _=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var logger=require(_0x956b('0x2'))(_0x956b('0x3'));var moment=require(_0x956b('0x4'));var BPromise=require('bluebird');var rp=require(_0x956b('0x5'));var fs=require('fs');var path=require(_0x956b('0x6'));var rimraf=require(_0x956b('0x7'));var config=require(_0x956b('0x8'));var attributes=require(_0x956b('0x9'));module[_0x956b('0xa')]=function(_0x57ace5,_0x4c6033){return _0x57ace5[_0x956b('0xb')](_0x956b('0xc'),attributes,{'tableName':_0x956b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3109=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','lodash','../../config/logger','moment'];(function(_0xe82d5f,_0x30fa26){var _0x2080dc=function(_0x5d9f73){while(--_0x5d9f73){_0xe82d5f['push'](_0xe82d5f['shift']());}};_0x2080dc(++_0x30fa26);}(_0x3109,0x173));var _0x9310=function(_0x5b7a37,_0x1c3d28){_0x5b7a37=_0x5b7a37-0x0;var _0x16528d=_0x3109[_0x5b7a37];return _0x16528d;};'use strict';var _=require(_0x9310('0x0'));var util=require('util');var logger=require(_0x9310('0x1'))('api');var moment=require(_0x9310('0x2'));var BPromise=require(_0x9310('0x3'));var rp=require(_0x9310('0x4'));var fs=require('fs');var path=require(_0x9310('0x5'));var rimraf=require(_0x9310('0x6'));var config=require(_0x9310('0x7'));var attributes=require(_0x9310('0x8'));module[_0x9310('0x9')]=function(_0x2d91b0,_0x5f319b){return _0x2d91b0[_0x9310('0xa')]('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 fe0f213..aaa7766 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 _0xbd5f=['request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','GetChatQueue','catch','ShowChatQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','register'];(function(_0x38f295,_0x48ecc3){var _0x4450bc=function(_0x294a4f){while(--_0x294a4f){_0x38f295['push'](_0x38f295['shift']());}};_0x4450bc(++_0x48ecc3);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x356db4,_0x36dbfe){_0x356db4=_0x356db4-0x0;var _0x2a9100=_0xbd5f[_0x356db4];return _0x2a9100;};'use strict';var _=require(_0xfbd5('0x0'));var util=require(_0xfbd5('0x1'));var moment=require(_0xfbd5('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbd5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbd5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbd5('0x5'))(_0xfbd5('0x6'));var config=require(_0xfbd5('0x7'));var jayson=require(_0xfbd5('0x8'));var client=jayson[_0xfbd5('0x9')][_0xfbd5('0xa')]({'port':0x232a});config[_0xfbd5('0xb')]=_['defaults'](config[_0xfbd5('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbd5('0xb')]));require('./chatQueue.socket')[_0xfbd5('0xc')](socket);function respondWithRpcPromise(_0x1cf660,_0x28b8bd,_0x541986){return new BPromise(function(_0x5376c7,_0x4ea0b9){return client[_0xfbd5('0xd')](_0x1cf660,_0x541986)[_0xfbd5('0xe')](function(_0x1b57af){logger[_0xfbd5('0xf')](_0xfbd5('0x10'),_0x28b8bd,_0xfbd5('0x11'));logger['debug'](_0xfbd5('0x12'),_0x28b8bd,'request\x20sent',JSON[_0xfbd5('0x13')](_0x1b57af));if(_0x1b57af[_0xfbd5('0x14')]){if(_0x1b57af['error']['code']===0x1f4){logger[_0xfbd5('0x14')](_0xfbd5('0x10'),_0x28b8bd,_0x1b57af[_0xfbd5('0x14')][_0xfbd5('0x15')]);return _0x4ea0b9(_0x1b57af[_0xfbd5('0x14')][_0xfbd5('0x15')]);}logger[_0xfbd5('0x14')](_0xfbd5('0x10'),_0x28b8bd,_0x1b57af['error'][_0xfbd5('0x15')]);return _0x5376c7(_0x1b57af[_0xfbd5('0x14')][_0xfbd5('0x15')]);}else{logger['info'](_0xfbd5('0x10'),_0x28b8bd,_0xfbd5('0x11'));_0x5376c7(_0x1b57af['result'][_0xfbd5('0x15')]);}})['catch'](function(_0x5b0401){logger[_0xfbd5('0x14')](_0xfbd5('0x10'),_0x28b8bd,_0x5b0401);_0x4ea0b9(_0x5b0401);});});}exports['GetChatQueue']=function(_0x220bc1){var _0x2fc40c=this;return new Promise(function(_0x5d74ed,_0x1a2ee7){return db[_0xfbd5('0x16')][_0xfbd5('0x17')]({'raw':_0x220bc1[_0xfbd5('0x18')]?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x19')]===undefined?!![]:![]:!![],'where':_0x220bc1[_0xfbd5('0x18')]?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x1a')]||null:null,'attributes':_0x220bc1['options']?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x1b')]||null:null,'limit':_0x220bc1[_0xfbd5('0x18')]?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x1c')]||null:null,'include':_0x220bc1[_0xfbd5('0x18')]?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x1d')]?_['map'](_0x220bc1['options']['include'],function(_0x2a6f8c){return{'model':db[_0x2a6f8c[_0xfbd5('0x1e')]],'as':_0x2a6f8c['as'],'attributes':_0x2a6f8c[_0xfbd5('0x1b')],'include':_0x2a6f8c['include']?_['map'](_0x2a6f8c[_0xfbd5('0x1d')],function(_0x908fb5){return{'model':db[_0x908fb5[_0xfbd5('0x1e')]],'as':_0x908fb5['as'],'attributes':_0x908fb5[_0xfbd5('0x1b')],'include':_0x908fb5[_0xfbd5('0x1d')]?_[_0xfbd5('0x1f')](_0x908fb5[_0xfbd5('0x1d')],function(_0x24ec67){return{'model':db[_0x24ec67['model']],'as':_0x24ec67['as'],'attributes':_0x24ec67[_0xfbd5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfbd5('0xe')](function(_0x195f41){logger[_0xfbd5('0xf')]('GetChatQueue',_0x220bc1);logger[_0xfbd5('0x20')](_0xfbd5('0x21'),_0x220bc1,JSON[_0xfbd5('0x13')](_0x195f41));_0x5d74ed(_0x195f41);})[_0xfbd5('0x22')](function(_0x27af3f){logger[_0xfbd5('0x14')](_0xfbd5('0x21'),_0x27af3f[_0xfbd5('0x15')],_0x220bc1);_0x1a2ee7(_0x2fc40c[_0xfbd5('0x14')](0x1f4,_0x27af3f['message']));});});};exports[_0xfbd5('0x23')]=function(_0x29f410){var _0x45e067=this;return new Promise(function(_0x3a51c7,_0x328f81){return db[_0xfbd5('0x16')]['find']({'raw':_0x29f410[_0xfbd5('0x18')]?_0x29f410[_0xfbd5('0x18')][_0xfbd5('0x19')]===undefined?!![]:![]:!![],'where':_0x29f410[_0xfbd5('0x18')]?_0x29f410['options']['where']||null:null,'attributes':_0x29f410['options']?_0x29f410[_0xfbd5('0x18')][_0xfbd5('0x1b')]||null:null,'include':_0x29f410[_0xfbd5('0x18')]?_0x29f410['options']['include']?_[_0xfbd5('0x1f')](_0x29f410[_0xfbd5('0x18')]['include'],function(_0x52d022){return{'model':db[_0x52d022[_0xfbd5('0x1e')]],'as':_0x52d022['as'],'attributes':_0x52d022[_0xfbd5('0x1b')],'include':_0x52d022[_0xfbd5('0x1d')]?_[_0xfbd5('0x1f')](_0x52d022['include'],function(_0x3f872c){return{'model':db[_0x3f872c[_0xfbd5('0x1e')]],'as':_0x3f872c['as'],'attributes':_0x3f872c[_0xfbd5('0x1b')],'include':_0x3f872c['include']?_[_0xfbd5('0x1f')](_0x3f872c[_0xfbd5('0x1d')],function(_0x5204d1){return{'model':db[_0x5204d1[_0xfbd5('0x1e')]],'as':_0x5204d1['as'],'attributes':_0x5204d1[_0xfbd5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfbd5('0xe')](function(_0x4baeff){logger[_0xfbd5('0xf')](_0xfbd5('0x23'),_0x29f410);logger[_0xfbd5('0x20')](_0xfbd5('0x23'),_0x29f410,JSON[_0xfbd5('0x13')](_0x4baeff));_0x3a51c7(_0x4baeff);})['catch'](function(_0xbcb78e){logger[_0xfbd5('0x14')](_0xfbd5('0x23'),_0xbcb78e[_0xfbd5('0x15')],_0x29f410);_0x328f81(_0x45e067[_0xfbd5('0x14')](0x1f4,_0xbcb78e['message']));});});}; \ No newline at end of file +var _0x1527=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','GetChatQueue','ChatQueue','findAll','options','where','limit','include','map','model','attributes','stringify','ShowChatQueue','find','raw','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x533221,_0x2037e7){var _0x7070de=function(_0x4f34d2){while(--_0x4f34d2){_0x533221['push'](_0x533221['shift']());}};_0x7070de(++_0x2037e7);}(_0x1527,0xc1));var _0x7152=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x1527[_0x1cb18a];return _0x22442e;};'use strict';var _=require('lodash');var util=require(_0x7152('0x0'));var moment=require(_0x7152('0x1'));var BPromise=require(_0x7152('0x2'));var rs=require(_0x7152('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7152('0x4'));var logger=require(_0x7152('0x5'))('rpc');var config=require(_0x7152('0x6'));var jayson=require(_0x7152('0x7'));var client=jayson['client'][_0x7152('0x8')]({'port':0x232a});config[_0x7152('0x9')]=_[_0x7152('0xa')](config['redis'],{'host':_0x7152('0xb'),'port':0x18eb});var socket=require(_0x7152('0xc'))(new Redis(config[_0x7152('0x9')]));require(_0x7152('0xd'))[_0x7152('0xe')](socket);function respondWithRpcPromise(_0x37c291,_0x5750e6,_0x2eb53a){return new BPromise(function(_0x24b460,_0xb4f00f){return client[_0x7152('0xf')](_0x37c291,_0x2eb53a)[_0x7152('0x10')](function(_0x5cae05){logger[_0x7152('0x11')](_0x7152('0x12'),_0x5750e6,'request\x20sent');logger[_0x7152('0x13')](_0x7152('0x14'),_0x5750e6,'request\x20sent',JSON['stringify'](_0x5cae05));if(_0x5cae05['error']){if(_0x5cae05[_0x7152('0x15')][_0x7152('0x16')]===0x1f4){logger[_0x7152('0x15')]('ChatQueue,\x20%s,\x20%s',_0x5750e6,_0x5cae05['error'][_0x7152('0x17')]);return _0xb4f00f(_0x5cae05[_0x7152('0x15')][_0x7152('0x17')]);}logger['error'](_0x7152('0x12'),_0x5750e6,_0x5cae05[_0x7152('0x15')]['message']);return _0x24b460(_0x5cae05['error'][_0x7152('0x17')]);}else{logger['info'](_0x7152('0x12'),_0x5750e6,_0x7152('0x18'));_0x24b460(_0x5cae05['result']['message']);}})[_0x7152('0x19')](function(_0x3820dd){logger['error'](_0x7152('0x12'),_0x5750e6,_0x3820dd);_0xb4f00f(_0x3820dd);});});}exports[_0x7152('0x1a')]=function(_0x345426){var _0x4eacf9=this;return new Promise(function(_0x4bb541,_0x1720c9){return db[_0x7152('0x1b')][_0x7152('0x1c')]({'raw':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')][_0x7152('0x1e')]||null:null,'attributes':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')]['attributes']||null:null,'limit':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')][_0x7152('0x1f')]||null:null,'include':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')][_0x7152('0x20')]?_[_0x7152('0x21')](_0x345426[_0x7152('0x1d')]['include'],function(_0x4671bf){return{'model':db[_0x4671bf[_0x7152('0x22')]],'as':_0x4671bf['as'],'attributes':_0x4671bf[_0x7152('0x23')],'include':_0x4671bf[_0x7152('0x20')]?_[_0x7152('0x21')](_0x4671bf['include'],function(_0x286194){return{'model':db[_0x286194[_0x7152('0x22')]],'as':_0x286194['as'],'attributes':_0x286194[_0x7152('0x23')],'include':_0x286194[_0x7152('0x20')]?_[_0x7152('0x21')](_0x286194[_0x7152('0x20')],function(_0x51fb5c){return{'model':db[_0x51fb5c[_0x7152('0x22')]],'as':_0x51fb5c['as'],'attributes':_0x51fb5c[_0x7152('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7152('0x10')](function(_0x39ae3b){logger[_0x7152('0x11')](_0x7152('0x1a'),_0x345426);logger[_0x7152('0x13')](_0x7152('0x1a'),_0x345426,JSON[_0x7152('0x24')](_0x39ae3b));_0x4bb541(_0x39ae3b);})['catch'](function(_0x3c7fe1){logger[_0x7152('0x15')]('GetChatQueue',_0x3c7fe1[_0x7152('0x17')],_0x345426);_0x1720c9(_0x4eacf9[_0x7152('0x15')](0x1f4,_0x3c7fe1['message']));});});};exports[_0x7152('0x25')]=function(_0x143062){var _0x40056d=this;return new Promise(function(_0x5e3004,_0x145595){return db[_0x7152('0x1b')][_0x7152('0x26')]({'raw':_0x143062['options']?_0x143062['options'][_0x7152('0x27')]===undefined?!![]:![]:!![],'where':_0x143062[_0x7152('0x1d')]?_0x143062[_0x7152('0x1d')][_0x7152('0x1e')]||null:null,'attributes':_0x143062['options']?_0x143062[_0x7152('0x1d')][_0x7152('0x23')]||null:null,'include':_0x143062[_0x7152('0x1d')]?_0x143062[_0x7152('0x1d')][_0x7152('0x20')]?_[_0x7152('0x21')](_0x143062[_0x7152('0x1d')][_0x7152('0x20')],function(_0x3a7742){return{'model':db[_0x3a7742[_0x7152('0x22')]],'as':_0x3a7742['as'],'attributes':_0x3a7742['attributes'],'include':_0x3a7742[_0x7152('0x20')]?_['map'](_0x3a7742[_0x7152('0x20')],function(_0x1ec28c){return{'model':db[_0x1ec28c[_0x7152('0x22')]],'as':_0x1ec28c['as'],'attributes':_0x1ec28c[_0x7152('0x23')],'include':_0x1ec28c[_0x7152('0x20')]?_[_0x7152('0x21')](_0x1ec28c[_0x7152('0x20')],function(_0xab1618){return{'model':db[_0xab1618[_0x7152('0x22')]],'as':_0xab1618['as'],'attributes':_0xab1618[_0x7152('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7152('0x10')](function(_0x3e3061){logger[_0x7152('0x11')](_0x7152('0x25'),_0x143062);logger[_0x7152('0x13')](_0x7152('0x25'),_0x143062,JSON[_0x7152('0x24')](_0x3e3061));_0x5e3004(_0x3e3061);})[_0x7152('0x19')](function(_0x465101){logger[_0x7152('0x15')](_0x7152('0x25'),_0x465101[_0x7152('0x17')],_0x143062);_0x145595(_0x40056d[_0x7152('0x15')](0x1f4,_0x465101[_0x7152('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b5a271d..47551fc 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 _0x207c=['length','chatQueue:','save','remove','update','emit'];(function(_0x3f7e45,_0x4121c){var _0x4d6882=function(_0x1fcfa2){while(--_0x1fcfa2){_0x3f7e45['push'](_0x3f7e45['shift']());}};_0x4d6882(++_0x4121c);}(_0x207c,0x1e8));var _0xc207=function(_0x303d9d,_0x363884){_0x303d9d=_0x303d9d-0x0;var _0x4ccd15=_0x207c[_0x303d9d];return _0x4ccd15;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xc207('0x0'),_0xc207('0x1'),_0xc207('0x2')];function createListener(_0xaaba3d,_0x2b40be){return function(_0x12f1f2){_0x2b40be[_0xc207('0x3')](_0xaaba3d,_0x12f1f2);};}function removeListener(_0x4b9daa,_0x38ff02){return function(){ChatQueueEvents['removeListener'](_0x4b9daa,_0x38ff02);};}exports['register']=function(_0x55023e){for(var _0xc88789=0x0,_0x314561=events[_0xc207('0x4')];_0xc88789<_0x314561;_0xc88789++){var _0x59ff6f=events[_0xc88789];var _0x25cb97=createListener(_0xc207('0x5')+_0x59ff6f,_0x55023e);ChatQueueEvents['on'](_0x59ff6f,_0x25cb97);}}; \ No newline at end of file +var _0x4fdb=['removeListener','length','./chatQueue.events','save','remove','update','emit'];(function(_0x3eed3f,_0x5253b5){var _0xd68fd8=function(_0x3395c4){while(--_0x3395c4){_0x3eed3f['push'](_0x3eed3f['shift']());}};_0xd68fd8(++_0x5253b5);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x47a5c0,_0x5be9e4){_0x47a5c0=_0x47a5c0-0x0;var _0x3d1986=_0x4fdb[_0x47a5c0];return _0x3d1986;};'use strict';var ChatQueueEvents=require(_0xb4fd('0x0'));var events=[_0xb4fd('0x1'),_0xb4fd('0x2'),_0xb4fd('0x3')];function createListener(_0x3b399e,_0xafe34b){return function(_0x260a35){_0xafe34b[_0xb4fd('0x4')](_0x3b399e,_0x260a35);};}function removeListener(_0x1c0b08,_0x5b73bb){return function(){ChatQueueEvents[_0xb4fd('0x5')](_0x1c0b08,_0x5b73bb);};}exports['register']=function(_0x14052b){for(var _0x5d8b39=0x0,_0x53273f=events[_0xb4fd('0x6')];_0x5d8b39<_0x53273f;_0x5d8b39++){var _0x3af8e3=events[_0x5d8b39];var _0x1151b5=createListener('chatQueue:'+_0x3af8e3,_0x14052b);ChatQueueEvents['on'](_0x3af8e3,_0x1151b5);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0b8edfc..9dcda9e 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(_0x5bbd3b,_0x4616a3){_0x5bbd3b=_0x5bbd3b-0x0;var _0x488799=_0x3e74[_0x5bbd3b];return _0x488799;};'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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2ab07a,_0x142056){var _0x1bc69f=function(_0x4a80f9){while(--_0x4a80f9){_0x2ab07a['push'](_0x2ab07a['shift']());}};_0x1bc69f(++_0x142056);}(_0x008c,0x188));var _0xc008=function(_0x419c0c,_0x2598ad){_0x419c0c=_0x419c0c-0x0;var _0x391694=_0x008c[_0x419c0c];return _0x391694;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c68b3b9..3b89c97 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 _0xb2d8=['sequelize','exports','STRING','DATE'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xb2d8,0x94));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x8b2d('0x0'));module[_0x8b2d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8b2d('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8b2d('0x3')]},'acceptAt':{'type':Sequelize[_0x8b2d('0x3')]},'exitAt':{'type':Sequelize[_0x8b2d('0x3')]},'reason':{'type':Sequelize[_0x8b2d('0x2')]}}; \ No newline at end of file +var _0x294c=['exports','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x294c,0x153));var _0xc294=function(_0x5a9db2,_0x2aace7){_0x5a9db2=_0x5a9db2-0x0;var _0x2ce378=_0x294c[_0x5a9db2];return _0x2ce378;};'use strict';var moment=require(_0xc294('0x0'));var Sequelize=require('sequelize');module[_0xc294('0x1')]={'uniqueid':{'type':Sequelize[_0xc294('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc294('0x2')]},'joinAt':{'type':Sequelize[_0xc294('0x3')]},'leaveAt':{'type':Sequelize[_0xc294('0x3')]},'acceptAt':{'type':Sequelize[_0xc294('0x3')]},'exitAt':{'type':Sequelize[_0xc294('0x3')]},'reason':{'type':Sequelize[_0xc294('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b78238d..5ee8ac8 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 _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x1db9,0x176));var _0x91db=function(_0x1f0f1b,_0x124a77){_0x1f0f1b=_0x1f0f1b-0x0;var _0x58a668=_0x1db9[_0x1f0f1b];return _0x58a668;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['ChatQueueReport'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['ChatQueueReport']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file +var _0xd1f1=['rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','then','destroy','end','error','stack','name','send','index','ChatQueueReport'];(function(_0x62c993,_0x1d06c7){var _0x38df4f=function(_0x2b9fa1){while(--_0x2b9fa1){_0x62c993['push'](_0x62c993['shift']());}};_0x38df4f(++_0x1d06c7);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x254761,_0x550307){_0x254761=_0x254761-0x0;var _0x4236de=_0xd1f1[_0x254761];return _0x4236de;};'use strict';var emlformat=require(_0x1d1f('0x0'));var rimraf=require(_0x1d1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d1f('0x2'));var rp=require(_0x1d1f('0x3'));var moment=require(_0x1d1f('0x4'));var BPromise=require(_0x1d1f('0x5'));var Mustache=require(_0x1d1f('0x6'));var util=require(_0x1d1f('0x7'));var path=require(_0x1d1f('0x8'));var sox=require('sox');var csv=require(_0x1d1f('0x9'));var ejs=require(_0x1d1f('0xa'));var fs=require('fs');var fs_extra=require(_0x1d1f('0xb'));var _=require(_0x1d1f('0xc'));var squel=require(_0x1d1f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d1f('0x9'));var querystring=require(_0x1d1f('0xe'));var Papa=require(_0x1d1f('0xf'));var Redis=require(_0x1d1f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1d1f('0x11'));var as=require(_0x1d1f('0x12'));var hardwareService=require(_0x1d1f('0x13'));var logger=require(_0x1d1f('0x14'))(_0x1d1f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1d1f('0x16'));var db=require(_0x1d1f('0x17'))['db'];function respondWithStatusCode(_0x5582d4,_0x33e3b1){_0x33e3b1=_0x33e3b1||0xcc;return function(_0x2f3c0f){if(_0x2f3c0f){return _0x5582d4[_0x1d1f('0x18')](_0x33e3b1);}return _0x5582d4[_0x1d1f('0x19')](_0x33e3b1)['end']();};}function respondWithResult(_0x2e0629,_0xa62267){_0xa62267=_0xa62267||0xc8;return function(_0x3db906){if(_0x3db906){return _0x2e0629[_0x1d1f('0x19')](_0xa62267)[_0x1d1f('0x1a')](_0x3db906);}};}function respondWithFilteredResult(_0x152f33,_0x147371){return function(_0x56cec9){if(_0x56cec9){var _0x3f66c7=typeof _0x147371[_0x1d1f('0x1b')]===_0x1d1f('0x1c')&&typeof _0x147371[_0x1d1f('0x1d')]===_0x1d1f('0x1c');var _0x3a9c75=_0x56cec9['count'];var _0x53ff5f=_0x3f66c7?0x0:_0x147371['offset'];var _0x2a5507=_0x3f66c7?_0x56cec9['count']:_0x147371[_0x1d1f('0x1b')]+_0x147371['limit'];var _0x4938d6;if(_0x2a5507>=_0x3a9c75){_0x2a5507=_0x3a9c75;_0x4938d6=0xc8;}else{_0x4938d6=0xce;}_0x152f33['status'](_0x4938d6);return _0x152f33[_0x1d1f('0x1e')]('Content-Range',_0x53ff5f+'-'+_0x2a5507+'/'+_0x3a9c75)[_0x1d1f('0x1a')](_0x56cec9);}return null;};}function patchUpdates(_0xe6b89a){return function(_0xe121be){try{jsonpatch[_0x1d1f('0x1f')](_0xe121be,_0xe6b89a,!![]);}catch(_0x507ee0){return BPromise['reject'](_0x507ee0);}return _0xe121be[_0x1d1f('0x20')]();};}function saveUpdates(_0x491c1b,_0x360051){return function(_0x2c2518){if(_0x2c2518){return _0x2c2518[_0x1d1f('0x21')](_0x491c1b)[_0x1d1f('0x22')](function(_0x23189b){return _0x23189b;});}return null;};}function removeEntity(_0x1e4650,_0x4d406c){return function(_0x3fe260){if(_0x3fe260){return _0x3fe260[_0x1d1f('0x23')]()['then'](function(){_0x1e4650[_0x1d1f('0x19')](0xcc)[_0x1d1f('0x24')]();});}};}function handleEntityNotFound(_0x2aabc7,_0x585ec7){return function(_0x2aebd3){if(!_0x2aebd3){_0x2aabc7[_0x1d1f('0x18')](0x194);}return _0x2aebd3;};}function handleError(_0x318bc9,_0x4f3bbf){_0x4f3bbf=_0x4f3bbf||0x1f4;return function(_0x238db7){logger[_0x1d1f('0x25')](_0x238db7[_0x1d1f('0x26')]);if(_0x238db7['name']){delete _0x238db7[_0x1d1f('0x27')];}_0x318bc9[_0x1d1f('0x19')](_0x4f3bbf)[_0x1d1f('0x28')](_0x238db7);};}exports[_0x1d1f('0x29')]=function(_0x23e61e,_0x57f817){var _0x4989de={},_0x2cc444={},_0x26b533={'count':0x0,'rows':[]};var _0x9f6459=_['map'](db[_0x1d1f('0x2a')][_0x1d1f('0x2b')],function(_0x52474b){return{'name':_0x52474b[_0x1d1f('0x2c')],'type':_0x52474b[_0x1d1f('0x2d')]['key']};});_0x2cc444[_0x1d1f('0x2e')]=_[_0x1d1f('0x2f')](_0x9f6459,_0x1d1f('0x27'));_0x2cc444[_0x1d1f('0x30')]=_[_0x1d1f('0x31')](_0x23e61e[_0x1d1f('0x30')]);_0x2cc444[_0x1d1f('0x32')]=_[_0x1d1f('0x33')](_0x2cc444[_0x1d1f('0x2e')],_0x2cc444['query']);_0x4989de[_0x1d1f('0x34')]=_['intersection'](_0x2cc444[_0x1d1f('0x2e')],qs['fields'](_0x23e61e['query']['fields']));_0x4989de[_0x1d1f('0x34')]=_0x4989de[_0x1d1f('0x34')][_0x1d1f('0x35')]?_0x4989de[_0x1d1f('0x34')]:_0x2cc444[_0x1d1f('0x2e')];if(!_0x23e61e['query'][_0x1d1f('0x36')](_0x1d1f('0x37'))){_0x4989de[_0x1d1f('0x1d')]=qs[_0x1d1f('0x1d')](_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x1d')]);_0x4989de[_0x1d1f('0x1b')]=qs[_0x1d1f('0x1b')](_0x23e61e[_0x1d1f('0x30')]['offset']);}_0x4989de[_0x1d1f('0x38')]=qs[_0x1d1f('0x39')](_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x39')]);_0x4989de['where']=qs[_0x1d1f('0x32')](_[_0x1d1f('0x3a')](_0x23e61e[_0x1d1f('0x30')],_0x2cc444[_0x1d1f('0x32')]),_0x9f6459);if(_0x23e61e[_0x1d1f('0x30')]['filter']){_0x4989de['where']=_[_0x1d1f('0x3b')](_0x4989de[_0x1d1f('0x3c')],{'$or':_[_0x1d1f('0x2f')](_0x9f6459,function(_0x27ddb3){if(_0x27ddb3[_0x1d1f('0x2d')]!==_0x1d1f('0x3d')){var _0x28ff35={};_0x28ff35[_0x27ddb3[_0x1d1f('0x27')]]={'$like':'%'+_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x3e')]+'%'};return _0x28ff35;}})});}_0x4989de=_[_0x1d1f('0x3b')]({},_0x4989de,_0x23e61e[_0x1d1f('0x3f')]);var _0x444958={'where':_0x4989de[_0x1d1f('0x3c')]};return db['ChatQueueReport'][_0x1d1f('0x40')](_0x444958)[_0x1d1f('0x22')](function(_0x131e0b){_0x26b533[_0x1d1f('0x40')]=_0x131e0b;if(_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x41')]){_0x4989de[_0x1d1f('0x42')]=[{'all':!![]}];}return db[_0x1d1f('0x2a')][_0x1d1f('0x43')](_0x4989de);})[_0x1d1f('0x22')](function(_0x12d933){_0x26b533[_0x1d1f('0x44')]=_0x12d933;return _0x26b533;})[_0x1d1f('0x22')](respondWithFilteredResult(_0x57f817,_0x4989de))[_0x1d1f('0x45')](handleError(_0x57f817,null));};exports[_0x1d1f('0x46')]=function(_0x13a887,_0x28885b){var _0x24bbc6={'raw':!![],'where':{'id':_0x13a887['params']['id']}},_0x911278={};_0x911278[_0x1d1f('0x2e')]=_[_0x1d1f('0x31')](db['ChatQueueReport'][_0x1d1f('0x2b')]);_0x911278[_0x1d1f('0x30')]=_[_0x1d1f('0x31')](_0x13a887['query']);_0x911278[_0x1d1f('0x32')]=_['intersection'](_0x911278[_0x1d1f('0x2e')],_0x911278[_0x1d1f('0x30')]);_0x24bbc6[_0x1d1f('0x34')]=_[_0x1d1f('0x33')](_0x911278[_0x1d1f('0x2e')],qs[_0x1d1f('0x47')](_0x13a887[_0x1d1f('0x30')]['fields']));_0x24bbc6[_0x1d1f('0x34')]=_0x24bbc6[_0x1d1f('0x34')][_0x1d1f('0x35')]?_0x24bbc6[_0x1d1f('0x34')]:_0x911278[_0x1d1f('0x2e')];if(_0x13a887[_0x1d1f('0x30')]['includeAll']){_0x24bbc6[_0x1d1f('0x42')]=[{'all':!![]}];}_0x24bbc6=_[_0x1d1f('0x3b')]({},_0x24bbc6,_0x13a887[_0x1d1f('0x3f')]);return db['ChatQueueReport'][_0x1d1f('0x48')](_0x24bbc6)[_0x1d1f('0x22')](handleEntityNotFound(_0x28885b,null))[_0x1d1f('0x22')](respondWithResult(_0x28885b,null))[_0x1d1f('0x45')](handleError(_0x28885b,null));};exports[_0x1d1f('0x49')]=function(_0x2d7fc5,_0x3eec9b){return db[_0x1d1f('0x2a')][_0x1d1f('0x49')](_0x2d7fc5[_0x1d1f('0x4a')],{})['then'](respondWithResult(_0x3eec9b,0xc9))[_0x1d1f('0x45')](handleError(_0x3eec9b,null));};exports[_0x1d1f('0x21')]=function(_0x5f0afa,_0x21624d){if(_0x5f0afa[_0x1d1f('0x4a')]['id']){delete _0x5f0afa[_0x1d1f('0x4a')]['id'];}return db[_0x1d1f('0x2a')][_0x1d1f('0x48')]({'where':{'id':_0x5f0afa[_0x1d1f('0x4b')]['id']}})[_0x1d1f('0x22')](handleEntityNotFound(_0x21624d,null))[_0x1d1f('0x22')](saveUpdates(_0x5f0afa['body'],null))[_0x1d1f('0x22')](respondWithResult(_0x21624d,null))[_0x1d1f('0x45')](handleError(_0x21624d,null));};exports[_0x1d1f('0x23')]=function(_0x5d2276,_0x49e092){return db[_0x1d1f('0x2a')]['find']({'where':{'id':_0x5d2276['params']['id']}})[_0x1d1f('0x22')](handleEntityNotFound(_0x49e092,null))[_0x1d1f('0x22')](removeEntity(_0x49e092,null))['catch'](handleError(_0x49e092,null));};exports[_0x1d1f('0x4c')]=function(_0x5c002f,_0x20f5bc){return db['ChatQueueReport'][_0x1d1f('0x4c')]()[_0x1d1f('0x22')](respondWithResult(_0x20f5bc,null))['catch'](handleError(_0x20f5bc,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ea2134f..1a88f9f 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x1b6f1d,_0x3c21ff){var _0xcc0832=function(_0x5a1ba2){while(--_0x5a1ba2){_0x1b6f1d['push'](_0x1b6f1d['shift']());}};_0xcc0832(++_0x3c21ff);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x1f01f4,_0x5ea9ef){var _0x42dcb5=function(_0x5cdc99){while(--_0x5cdc99){_0x1f01f4['push'](_0x1f01f4['shift']());}};_0x42dcb5(++_0x5ea9ef);}(_0xb10b,0x12a));var _0xbb10=function(_0x2bf1fb,_0x10022d){_0x2bf1fb=_0x2bf1fb-0x0;var _0x5e7e68=_0xb10b[_0x2bf1fb];return _0x5e7e68;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 497b19e..eabde0d 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 _0xa63b=['info','CreateChatQueueReport','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ChatQueueReport','create','body','options','raw'];(function(_0x193b59,_0x1d3454){var _0x339e71=function(_0x401922){while(--_0x401922){_0x193b59['push'](_0x193b59['shift']());}};_0x339e71(++_0x1d3454);}(_0xa63b,0xb5));var _0xba63=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa63b[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xba63('0x0'));var util=require(_0xba63('0x1'));var moment=require(_0xba63('0x2'));var BPromise=require(_0xba63('0x3'));var rs=require(_0xba63('0x4'));var fs=require('fs');var Redis=require(_0xba63('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xba63('0x6'));var logger=require(_0xba63('0x7'))(_0xba63('0x8'));var config=require(_0xba63('0x9'));var jayson=require(_0xba63('0xa'));var client=jayson[_0xba63('0xb')][_0xba63('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x398e80,_0x134562,_0x365a5f){return new BPromise(function(_0x52b829,_0x4e16d3){return client[_0xba63('0xd')](_0x398e80,_0x365a5f)[_0xba63('0xe')](function(_0x109f7b){logger['info'](_0xba63('0xf'),_0x134562,'request\x20sent');logger[_0xba63('0x10')](_0xba63('0x11'),_0x134562,'request\x20sent',JSON[_0xba63('0x12')](_0x109f7b));if(_0x109f7b[_0xba63('0x13')]){if(_0x109f7b[_0xba63('0x13')][_0xba63('0x14')]===0x1f4){logger['error'](_0xba63('0xf'),_0x134562,_0x109f7b['error']['message']);return _0x4e16d3(_0x109f7b[_0xba63('0x13')]['message']);}logger[_0xba63('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x134562,_0x109f7b[_0xba63('0x13')][_0xba63('0x15')]);return _0x52b829(_0x109f7b['error'][_0xba63('0x15')]);}else{logger['info'](_0xba63('0xf'),_0x134562,_0xba63('0x16'));_0x52b829(_0x109f7b['result'][_0xba63('0x15')]);}})[_0xba63('0x17')](function(_0x5dbf76){logger[_0xba63('0x13')](_0xba63('0xf'),_0x134562,_0x5dbf76);_0x4e16d3(_0x5dbf76);});});}exports['CreateChatQueueReport']=function(_0x428d4f){var _0x4f097e=this;return new Promise(function(_0x2c9fe4,_0x39a559){return db[_0xba63('0x18')][_0xba63('0x19')](_0x428d4f[_0xba63('0x1a')],{'raw':_0x428d4f[_0xba63('0x1b')]?_0x428d4f[_0xba63('0x1b')][_0xba63('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2b6804){logger[_0xba63('0x1d')](_0xba63('0x1e'),_0x428d4f);logger[_0xba63('0x10')](_0xba63('0x1e'),_0x428d4f,JSON[_0xba63('0x12')](_0x2b6804));_0x2c9fe4(_0x2b6804);})[_0xba63('0x17')](function(_0x403af3){logger[_0xba63('0x13')](_0xba63('0x1e'),_0x403af3[_0xba63('0x15')],_0x428d4f);_0x39a559(_0x4f097e[_0xba63('0x13')](0x1f4,_0x403af3[_0xba63('0x15')]));});});};exports[_0xba63('0x1f')]=function(_0x1de008){var _0x42b042=this;return new Promise(function(_0x579029,_0x4ca5ae){return db['ChatQueueReport']['update'](_0x1de008[_0xba63('0x1a')],{'raw':_0x1de008[_0xba63('0x1b')]?_0x1de008[_0xba63('0x1b')][_0xba63('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1de008[_0xba63('0x1b')]?_0x1de008[_0xba63('0x1b')][_0xba63('0x20')]||null:null,'attributes':_0x1de008[_0xba63('0x1b')]?_0x1de008[_0xba63('0x1b')][_0xba63('0x21')]||null:null,'limit':_0x1de008[_0xba63('0x1b')]?_0x1de008[_0xba63('0x1b')][_0xba63('0x22')]||null:null})[_0xba63('0xe')](function(_0x1f572f){logger[_0xba63('0x1d')](_0xba63('0x1f'),_0x1de008);logger['debug'](_0xba63('0x1f'),_0x1de008,JSON[_0xba63('0x12')](_0x1f572f));_0x579029(_0x1f572f);})['catch'](function(_0x420ddc){logger[_0xba63('0x13')]('UpdateChatQueueReport',_0x420ddc[_0xba63('0x15')],_0x1de008);_0x4ca5ae(_0x42b042[_0xba63('0x13')](0x1f4,_0x420ddc[_0xba63('0x15')]));});});}; \ No newline at end of file +var _0x5ff0=['message','result','body','options','raw','then','CreateChatQueueReport','debug','stringify','catch','UpdateChatQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','ChatQueueReport,\x20%s,\x20%s'];(function(_0x1c54d1,_0x47b927){var _0xf8a462=function(_0x3799fd){while(--_0x3799fd){_0x1c54d1['push'](_0x1c54d1['shift']());}};_0xf8a462(++_0x47b927);}(_0x5ff0,0xad));var _0x05ff=function(_0x3db78f,_0x19beee){_0x3db78f=_0x3db78f-0x0;var _0x10f3e1=_0x5ff0[_0x3db78f];return _0x10f3e1;};'use strict';var _=require(_0x05ff('0x0'));var util=require(_0x05ff('0x1'));var moment=require(_0x05ff('0x2'));var BPromise=require(_0x05ff('0x3'));var rs=require(_0x05ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05ff('0x5'))['db'];var utils=require(_0x05ff('0x6'));var logger=require(_0x05ff('0x7'))(_0x05ff('0x8'));var config=require(_0x05ff('0x9'));var jayson=require(_0x05ff('0xa'));var client=jayson[_0x05ff('0xb')][_0x05ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b7fd8,_0x565dd5,_0x46eab9){return new BPromise(function(_0x783754,_0x5f3e1a){return client[_0x05ff('0xd')](_0x2b7fd8,_0x46eab9)['then'](function(_0x3db417){logger[_0x05ff('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x565dd5,_0x05ff('0xf'));logger['debug'](_0x05ff('0x10'),_0x565dd5,_0x05ff('0xf'),JSON['stringify'](_0x3db417));if(_0x3db417[_0x05ff('0x11')]){if(_0x3db417['error']['code']===0x1f4){logger['error'](_0x05ff('0x12'),_0x565dd5,_0x3db417['error'][_0x05ff('0x13')]);return _0x5f3e1a(_0x3db417[_0x05ff('0x11')][_0x05ff('0x13')]);}logger[_0x05ff('0x11')](_0x05ff('0x12'),_0x565dd5,_0x3db417[_0x05ff('0x11')][_0x05ff('0x13')]);return _0x783754(_0x3db417['error'][_0x05ff('0x13')]);}else{logger[_0x05ff('0xe')](_0x05ff('0x12'),_0x565dd5,'request\x20sent');_0x783754(_0x3db417[_0x05ff('0x14')]['message']);}})['catch'](function(_0x568ecd){logger['error'](_0x05ff('0x12'),_0x565dd5,_0x568ecd);_0x5f3e1a(_0x568ecd);});});}exports['CreateChatQueueReport']=function(_0x36b985){var _0x192f14=this;return new Promise(function(_0x19f4b3,_0x5ce895){return db['ChatQueueReport']['create'](_0x36b985[_0x05ff('0x15')],{'raw':_0x36b985[_0x05ff('0x16')]?_0x36b985['options'][_0x05ff('0x17')]===undefined?!![]:![]:!![]})[_0x05ff('0x18')](function(_0x44b755){logger[_0x05ff('0xe')](_0x05ff('0x19'),_0x36b985);logger[_0x05ff('0x1a')](_0x05ff('0x19'),_0x36b985,JSON[_0x05ff('0x1b')](_0x44b755));_0x19f4b3(_0x44b755);})[_0x05ff('0x1c')](function(_0x1eda09){logger[_0x05ff('0x11')](_0x05ff('0x19'),_0x1eda09[_0x05ff('0x13')],_0x36b985);_0x5ce895(_0x192f14[_0x05ff('0x11')](0x1f4,_0x1eda09[_0x05ff('0x13')]));});});};exports[_0x05ff('0x1d')]=function(_0x1f213b){var _0x59d41c=this;return new Promise(function(_0x3837ac,_0x10021b){return db['ChatQueueReport'][_0x05ff('0x1e')](_0x1f213b['body'],{'raw':_0x1f213b[_0x05ff('0x16')]?_0x1f213b[_0x05ff('0x16')][_0x05ff('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f213b['options']?_0x1f213b[_0x05ff('0x16')]['where']||null:null,'attributes':_0x1f213b[_0x05ff('0x16')]?_0x1f213b[_0x05ff('0x16')]['attributes']||null:null,'limit':_0x1f213b[_0x05ff('0x16')]?_0x1f213b[_0x05ff('0x16')][_0x05ff('0x1f')]||null:null})[_0x05ff('0x18')](function(_0x2e6a52){logger['info'](_0x05ff('0x1d'),_0x1f213b);logger[_0x05ff('0x1a')]('UpdateChatQueueReport',_0x1f213b,JSON[_0x05ff('0x1b')](_0x2e6a52));_0x3837ac(_0x2e6a52);})[_0x05ff('0x1c')](function(_0x317aca){logger['error'](_0x05ff('0x1d'),_0x317aca[_0x05ff('0x13')],_0x1f213b);_0x10021b(_0x59d41c['error'](0x1f4,_0x317aca['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 99593ef..58fecff 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 _0x4a58=['post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0xc7679b,_0x2511a2){var _0x4e8f0b=function(_0x166401){while(--_0x166401){_0xc7679b['push'](_0xc7679b['shift']());}};_0x4e8f0b(++_0x2511a2);}(_0x4a58,0x72));var _0x84a5=function(_0x2e69fb,_0x4359e3){_0x2e69fb=_0x2e69fb-0x0;var _0x4d2404=_0x4a58[_0x2e69fb];return _0x4d2404;};'use strict';var multer=require('multer');var util=require(_0x84a5('0x0'));var path=require(_0x84a5('0x1'));var timeout=require(_0x84a5('0x2'));var express=require(_0x84a5('0x3'));var router=express[_0x84a5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x84a5('0x5'));var controller=require(_0x84a5('0x6'));router[_0x84a5('0x7')]('/',auth[_0x84a5('0x8')](),controller[_0x84a5('0x9')]);router['get']('/describe',auth[_0x84a5('0x8')](),controller['describe']);router[_0x84a5('0x7')](_0x84a5('0xa'),auth['isAuthenticated'](),controller[_0x84a5('0xb')]);router[_0x84a5('0xc')]('/',auth['isAuthenticated'](),controller[_0x84a5('0xd')]);router[_0x84a5('0xe')](_0x84a5('0xa'),auth[_0x84a5('0x8')](),controller[_0x84a5('0xf')]);router[_0x84a5('0x10')](_0x84a5('0xa'),auth[_0x84a5('0x8')](),controller[_0x84a5('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe85b=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xe85b,0xee));var _0xbe85=function(_0x4c0155,_0x5b20db){_0x4c0155=_0x4c0155-0x0;var _0x1276db=_0xe85b[_0x4c0155];return _0x1276db;};'use strict';var multer=require(_0xbe85('0x0'));var util=require(_0xbe85('0x1'));var path=require(_0xbe85('0x2'));var timeout=require(_0xbe85('0x3'));var express=require('express');var router=express[_0xbe85('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbe85('0x5'));var config=require(_0xbe85('0x6'));var controller=require(_0xbe85('0x7'));router[_0xbe85('0x8')]('/',auth[_0xbe85('0x9')](),controller[_0xbe85('0xa')]);router[_0xbe85('0x8')]('/describe',auth[_0xbe85('0x9')](),controller['describe']);router[_0xbe85('0x8')](_0xbe85('0xb'),auth[_0xbe85('0x9')](),controller[_0xbe85('0xc')]);router['post']('/',auth[_0xbe85('0x9')](),controller[_0xbe85('0xd')]);router['put'](_0xbe85('0xb'),auth[_0xbe85('0x9')](),controller[_0xbe85('0xe')]);router[_0xbe85('0xf')](_0xbe85('0xb'),auth['isAuthenticated'](),controller[_0xbe85('0x10')]);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 4303154..8447f99 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x67655b,_0x15ff31){var _0x71c09d=function(_0x50c331){while(--_0x50c331){_0x67655b['push'](_0x67655b['shift']());}};_0x71c09d(++_0x15ff31);}(_0x008c,0x188));var _0xc008=function(_0xb096ef,_0x20ebdf){_0xb096ef=_0xb096ef-0x0;var _0x5ac5b=_0x008c[_0xb096ef];return _0x5ac5b;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2e924f,_0x579a84){var _0x136642=function(_0x3c7f10){while(--_0x3c7f10){_0x2e924f['push'](_0x2e924f['shift']());}};_0x136642(++_0x579a84);}(_0xedd9,0xfc));var _0x9edd=function(_0x51aab0,_0x537d99){_0x51aab0=_0x51aab0-0x0;var _0x3652cc=_0xedd9[_0x51aab0];return _0x3652cc;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index af77a8e..aaefdb5 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 _0x7008=['catch','show','params','intersection','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','findAll','rows'];(function(_0x53c43d,_0x1541b4){var _0x594166=function(_0x282ff7){while(--_0x282ff7){_0x53c43d['push'](_0x53c43d['shift']());}};_0x594166(++_0x1541b4);}(_0x7008,0x185));var _0x8700=function(_0x57e1f7,_0xfa390a){_0x57e1f7=_0x57e1f7-0x0;var _0x3c1940=_0x7008[_0x57e1f7];return _0x3c1940;};'use strict';var emlformat=require(_0x8700('0x0'));var rimraf=require(_0x8700('0x1'));var zipdir=require(_0x8700('0x2'));var jsonpatch=require(_0x8700('0x3'));var rp=require('request-promise');var moment=require(_0x8700('0x4'));var BPromise=require(_0x8700('0x5'));var Mustache=require('mustache');var util=require(_0x8700('0x6'));var path=require(_0x8700('0x7'));var sox=require(_0x8700('0x8'));var csv=require(_0x8700('0x9'));var ejs=require(_0x8700('0xa'));var fs=require('fs');var fs_extra=require(_0x8700('0xb'));var _=require(_0x8700('0xc'));var squel=require('squel');var crypto=require(_0x8700('0xd'));var jsforce=require(_0x8700('0xe'));var deskjs=require(_0x8700('0xf'));var toCsv=require(_0x8700('0x9'));var querystring=require(_0x8700('0x10'));var Papa=require(_0x8700('0x11'));var Redis=require(_0x8700('0x12'));var authService=require(_0x8700('0x13'));var qs=require(_0x8700('0x14'));var as=require(_0x8700('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8700('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8700('0x17'))['db'];function respondWithStatusCode(_0x10f9d4,_0x14d24d){_0x14d24d=_0x14d24d||0xcc;return function(_0xf315f9){if(_0xf315f9){return _0x10f9d4[_0x8700('0x18')](_0x14d24d);}return _0x10f9d4[_0x8700('0x19')](_0x14d24d)[_0x8700('0x1a')]();};}function respondWithResult(_0x50eb8d,_0x33a0f1){_0x33a0f1=_0x33a0f1||0xc8;return function(_0x28fb33){if(_0x28fb33){return _0x50eb8d[_0x8700('0x19')](_0x33a0f1)[_0x8700('0x1b')](_0x28fb33);}};}function respondWithFilteredResult(_0x70fd70,_0x406ee6){return function(_0x58b06c){if(_0x58b06c){var _0x25508a=typeof _0x406ee6[_0x8700('0x1c')]===_0x8700('0x1d')&&typeof _0x406ee6[_0x8700('0x1e')]===_0x8700('0x1d');var _0x54bae9=_0x58b06c[_0x8700('0x1f')];var _0x24fe1c=_0x25508a?0x0:_0x406ee6[_0x8700('0x1c')];var _0x4e0499=_0x25508a?_0x58b06c['count']:_0x406ee6[_0x8700('0x1c')]+_0x406ee6[_0x8700('0x1e')];var _0x7ba748;if(_0x4e0499>=_0x54bae9){_0x4e0499=_0x54bae9;_0x7ba748=0xc8;}else{_0x7ba748=0xce;}_0x70fd70[_0x8700('0x19')](_0x7ba748);return _0x70fd70['set'](_0x8700('0x20'),_0x24fe1c+'-'+_0x4e0499+'/'+_0x54bae9)[_0x8700('0x1b')](_0x58b06c);}return null;};}function patchUpdates(_0x1e404f){return function(_0x2f8548){try{jsonpatch[_0x8700('0x21')](_0x2f8548,_0x1e404f,!![]);}catch(_0x2aafd9){return BPromise[_0x8700('0x22')](_0x2aafd9);}return _0x2f8548[_0x8700('0x23')]();};}function saveUpdates(_0x35df7e,_0x3a7a31){return function(_0x4d09bb){if(_0x4d09bb){return _0x4d09bb[_0x8700('0x24')](_0x35df7e)[_0x8700('0x25')](function(_0xcf258c){return _0xcf258c;});}return null;};}function removeEntity(_0x246157,_0x36611e){return function(_0x114287){if(_0x114287){return _0x114287[_0x8700('0x26')]()[_0x8700('0x25')](function(){_0x246157[_0x8700('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2f1a,_0x1470ed){return function(_0x50c5de){if(!_0x50c5de){_0x5e2f1a['sendStatus'](0x194);}return _0x50c5de;};}function handleError(_0x4c6d29,_0x310688){_0x310688=_0x310688||0x1f4;return function(_0x56ac4e){logger[_0x8700('0x27')](_0x56ac4e[_0x8700('0x28')]);if(_0x56ac4e[_0x8700('0x29')]){delete _0x56ac4e[_0x8700('0x29')];}_0x4c6d29[_0x8700('0x19')](_0x310688)[_0x8700('0x2a')](_0x56ac4e);};}exports[_0x8700('0x2b')]=function(_0x3be479,_0x4393ab){var _0x4a95c8={},_0x41ab8f={},_0x49e8bf={'count':0x0,'rows':[]};var _0x2dd515=_[_0x8700('0x2c')](db[_0x8700('0x2d')][_0x8700('0x2e')],function(_0xf96394){return{'name':_0xf96394[_0x8700('0x2f')],'type':_0xf96394['type'][_0x8700('0x30')]};});_0x41ab8f[_0x8700('0x31')]=_['map'](_0x2dd515,_0x8700('0x29'));_0x41ab8f[_0x8700('0x32')]=_[_0x8700('0x33')](_0x3be479[_0x8700('0x32')]);_0x41ab8f[_0x8700('0x34')]=_['intersection'](_0x41ab8f[_0x8700('0x31')],_0x41ab8f[_0x8700('0x32')]);_0x4a95c8[_0x8700('0x35')]=_['intersection'](_0x41ab8f[_0x8700('0x31')],qs[_0x8700('0x36')](_0x3be479['query'][_0x8700('0x36')]));_0x4a95c8['attributes']=_0x4a95c8['attributes'][_0x8700('0x37')]?_0x4a95c8[_0x8700('0x35')]:_0x41ab8f[_0x8700('0x31')];if(!_0x3be479[_0x8700('0x32')]['hasOwnProperty'](_0x8700('0x38'))){_0x4a95c8[_0x8700('0x1e')]=qs[_0x8700('0x1e')](_0x3be479[_0x8700('0x32')][_0x8700('0x1e')]);_0x4a95c8[_0x8700('0x1c')]=qs[_0x8700('0x1c')](_0x3be479[_0x8700('0x32')][_0x8700('0x1c')]);}_0x4a95c8['order']=qs[_0x8700('0x39')](_0x3be479[_0x8700('0x32')][_0x8700('0x39')]);_0x4a95c8['where']=qs['filters'](_[_0x8700('0x3a')](_0x3be479['query'],_0x41ab8f['filters']),_0x2dd515);if(_0x3be479[_0x8700('0x32')][_0x8700('0x3b')]){_0x4a95c8['where']=_[_0x8700('0x3c')](_0x4a95c8[_0x8700('0x3d')],{'$or':_[_0x8700('0x2c')](_0x2dd515,function(_0x45fe53){if(_0x45fe53[_0x8700('0x3e')]!==_0x8700('0x3f')){var _0x166bd2={};_0x166bd2[_0x45fe53[_0x8700('0x29')]]={'$like':'%'+_0x3be479[_0x8700('0x32')]['filter']+'%'};return _0x166bd2;}})});}_0x4a95c8=_[_0x8700('0x3c')]({},_0x4a95c8,_0x3be479[_0x8700('0x40')]);var _0x232b02={'where':_0x4a95c8[_0x8700('0x3d')]};return db[_0x8700('0x2d')][_0x8700('0x1f')](_0x232b02)[_0x8700('0x25')](function(_0x279092){_0x49e8bf[_0x8700('0x1f')]=_0x279092;if(_0x3be479[_0x8700('0x32')]['includeAll']){_0x4a95c8['include']=[{'all':!![]}];}return db[_0x8700('0x2d')][_0x8700('0x41')](_0x4a95c8);})['then'](function(_0x16a102){_0x49e8bf[_0x8700('0x42')]=_0x16a102;return _0x49e8bf;})[_0x8700('0x25')](respondWithFilteredResult(_0x4393ab,_0x4a95c8))[_0x8700('0x43')](handleError(_0x4393ab,null));};exports[_0x8700('0x44')]=function(_0x25de59,_0x372fee){var _0x7719ca={'raw':!![],'where':{'id':_0x25de59[_0x8700('0x45')]['id']}},_0x24652c={};_0x24652c[_0x8700('0x31')]=_[_0x8700('0x33')](db[_0x8700('0x2d')][_0x8700('0x2e')]);_0x24652c[_0x8700('0x32')]=_[_0x8700('0x33')](_0x25de59[_0x8700('0x32')]);_0x24652c[_0x8700('0x34')]=_['intersection'](_0x24652c['model'],_0x24652c[_0x8700('0x32')]);_0x7719ca['attributes']=_[_0x8700('0x46')](_0x24652c[_0x8700('0x31')],qs[_0x8700('0x36')](_0x25de59['query'][_0x8700('0x36')]));_0x7719ca[_0x8700('0x35')]=_0x7719ca[_0x8700('0x35')][_0x8700('0x37')]?_0x7719ca[_0x8700('0x35')]:_0x24652c['model'];if(_0x25de59[_0x8700('0x32')][_0x8700('0x47')]){_0x7719ca['include']=[{'all':!![]}];}_0x7719ca=_[_0x8700('0x3c')]({},_0x7719ca,_0x25de59[_0x8700('0x40')]);return db[_0x8700('0x2d')]['find'](_0x7719ca)['then'](handleEntityNotFound(_0x372fee,null))[_0x8700('0x25')](respondWithResult(_0x372fee,null))[_0x8700('0x43')](handleError(_0x372fee,null));};exports[_0x8700('0x48')]=function(_0x14a17b,_0x2bb131){return db[_0x8700('0x2d')][_0x8700('0x48')](_0x14a17b[_0x8700('0x49')],{})[_0x8700('0x25')](respondWithResult(_0x2bb131,0xc9))['catch'](handleError(_0x2bb131,null));};exports[_0x8700('0x24')]=function(_0x4b4cd6,_0xc3831a){if(_0x4b4cd6[_0x8700('0x49')]['id']){delete _0x4b4cd6[_0x8700('0x49')]['id'];}return db[_0x8700('0x2d')][_0x8700('0x4a')]({'where':{'id':_0x4b4cd6[_0x8700('0x45')]['id']}})[_0x8700('0x25')](handleEntityNotFound(_0xc3831a,null))[_0x8700('0x25')](saveUpdates(_0x4b4cd6[_0x8700('0x49')],null))[_0x8700('0x25')](respondWithResult(_0xc3831a,null))[_0x8700('0x43')](handleError(_0xc3831a,null));};exports['destroy']=function(_0x30ad3e,_0x421d7e){return db[_0x8700('0x2d')]['find']({'where':{'id':_0x30ad3e[_0x8700('0x45')]['id']}})[_0x8700('0x25')](handleEntityNotFound(_0x421d7e,null))['then'](removeEntity(_0x421d7e,null))[_0x8700('0x43')](handleError(_0x421d7e,null));};exports['describe']=function(_0x4456be,_0x1c7f0f){return db[_0x8700('0x2d')][_0x8700('0x4b')]()[_0x8700('0x25')](respondWithResult(_0x1c7f0f,null))[_0x8700('0x43')](handleError(_0x1c7f0f,null));}; \ No newline at end of file +var _0xf0e9=['name','send','map','ChatTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','show','rawAttributes','include','find','catch','create','body','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack'];(function(_0x53d29c,_0x16a6e1){var _0x1d0211=function(_0x1debef){while(--_0x1debef){_0x53d29c['push'](_0x53d29c['shift']());}};_0x1d0211(++_0x16a6e1);}(_0xf0e9,0xf2));var _0x9f0e=function(_0x389928,_0x5b0c08){_0x389928=_0x389928-0x0;var _0x41b3d9=_0xf0e9[_0x389928];return _0x41b3d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f0e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f0e('0x1'));var rp=require(_0x9f0e('0x2'));var moment=require('moment');var BPromise=require(_0x9f0e('0x3'));var Mustache=require(_0x9f0e('0x4'));var util=require('util');var path=require(_0x9f0e('0x5'));var sox=require(_0x9f0e('0x6'));var csv=require('to-csv');var ejs=require(_0x9f0e('0x7'));var fs=require('fs');var fs_extra=require(_0x9f0e('0x8'));var _=require(_0x9f0e('0x9'));var squel=require('squel');var crypto=require(_0x9f0e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f0e('0xb'));var querystring=require(_0x9f0e('0xc'));var Papa=require('papaparse');var Redis=require(_0x9f0e('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f0e('0xe'));var hardwareService=require(_0x9f0e('0xf'));var logger=require('../../config/logger')(_0x9f0e('0x10'));var utils=require('../../config/utils');var config=require(_0x9f0e('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f0e('0x12'))['db'];function respondWithStatusCode(_0x4b5f97,_0x289438){_0x289438=_0x289438||0xcc;return function(_0x59b596){if(_0x59b596){return _0x4b5f97['sendStatus'](_0x289438);}return _0x4b5f97[_0x9f0e('0x13')](_0x289438)['end']();};}function respondWithResult(_0x3e24e9,_0x1c0686){_0x1c0686=_0x1c0686||0xc8;return function(_0xe31cb8){if(_0xe31cb8){return _0x3e24e9[_0x9f0e('0x13')](_0x1c0686)[_0x9f0e('0x14')](_0xe31cb8);}};}function respondWithFilteredResult(_0x18d5af,_0x1a77ec){return function(_0x279f9b){if(_0x279f9b){var _0x37e885=typeof _0x1a77ec['offset']==='undefined'&&typeof _0x1a77ec[_0x9f0e('0x15')]===_0x9f0e('0x16');var _0x1d078c=_0x279f9b[_0x9f0e('0x17')];var _0x16ac7a=_0x37e885?0x0:_0x1a77ec[_0x9f0e('0x18')];var _0x5ef2ba=_0x37e885?_0x279f9b[_0x9f0e('0x17')]:_0x1a77ec['offset']+_0x1a77ec[_0x9f0e('0x15')];var _0x4330f0;if(_0x5ef2ba>=_0x1d078c){_0x5ef2ba=_0x1d078c;_0x4330f0=0xc8;}else{_0x4330f0=0xce;}_0x18d5af[_0x9f0e('0x13')](_0x4330f0);return _0x18d5af['set'](_0x9f0e('0x19'),_0x16ac7a+'-'+_0x5ef2ba+'/'+_0x1d078c)[_0x9f0e('0x14')](_0x279f9b);}return null;};}function patchUpdates(_0x4b4998){return function(_0x33445d){try{jsonpatch[_0x9f0e('0x1a')](_0x33445d,_0x4b4998,!![]);}catch(_0x326379){return BPromise[_0x9f0e('0x1b')](_0x326379);}return _0x33445d['save']();};}function saveUpdates(_0x571197,_0x3dd8de){return function(_0x34a10f){if(_0x34a10f){return _0x34a10f[_0x9f0e('0x1c')](_0x571197)[_0x9f0e('0x1d')](function(_0x2fcb27){return _0x2fcb27;});}return null;};}function removeEntity(_0x3ec414,_0x174bea){return function(_0x34b7da){if(_0x34b7da){return _0x34b7da[_0x9f0e('0x1e')]()['then'](function(){_0x3ec414[_0x9f0e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d6632,_0x1d4a73){return function(_0x2808f4){if(!_0x2808f4){_0x3d6632[_0x9f0e('0x1f')](0x194);}return _0x2808f4;};}function handleError(_0x5d40a9,_0x1f4338){_0x1f4338=_0x1f4338||0x1f4;return function(_0x2c85dc){logger[_0x9f0e('0x20')](_0x2c85dc[_0x9f0e('0x21')]);if(_0x2c85dc[_0x9f0e('0x22')]){delete _0x2c85dc[_0x9f0e('0x22')];}_0x5d40a9[_0x9f0e('0x13')](_0x1f4338)[_0x9f0e('0x23')](_0x2c85dc);};}exports['index']=function(_0x162125,_0x3e4214){var _0x150c39={},_0x25077b={},_0x16f82e={'count':0x0,'rows':[]};var _0x158bc6=_[_0x9f0e('0x24')](db[_0x9f0e('0x25')]['rawAttributes'],function(_0x25f36d){return{'name':_0x25f36d[_0x9f0e('0x26')],'type':_0x25f36d[_0x9f0e('0x27')][_0x9f0e('0x28')]};});_0x25077b[_0x9f0e('0x29')]=_['map'](_0x158bc6,_0x9f0e('0x22'));_0x25077b[_0x9f0e('0x2a')]=_[_0x9f0e('0x2b')](_0x162125[_0x9f0e('0x2a')]);_0x25077b['filters']=_[_0x9f0e('0x2c')](_0x25077b['model'],_0x25077b[_0x9f0e('0x2a')]);_0x150c39[_0x9f0e('0x2d')]=_['intersection'](_0x25077b[_0x9f0e('0x29')],qs[_0x9f0e('0x2e')](_0x162125[_0x9f0e('0x2a')][_0x9f0e('0x2e')]));_0x150c39[_0x9f0e('0x2d')]=_0x150c39[_0x9f0e('0x2d')][_0x9f0e('0x2f')]?_0x150c39[_0x9f0e('0x2d')]:_0x25077b[_0x9f0e('0x29')];if(!_0x162125[_0x9f0e('0x2a')][_0x9f0e('0x30')](_0x9f0e('0x31'))){_0x150c39['limit']=qs['limit'](_0x162125[_0x9f0e('0x2a')][_0x9f0e('0x15')]);_0x150c39[_0x9f0e('0x18')]=qs[_0x9f0e('0x18')](_0x162125[_0x9f0e('0x2a')][_0x9f0e('0x18')]);}_0x150c39['order']=qs[_0x9f0e('0x32')](_0x162125['query'][_0x9f0e('0x32')]);_0x150c39[_0x9f0e('0x33')]=qs['filters'](_[_0x9f0e('0x34')](_0x162125[_0x9f0e('0x2a')],_0x25077b[_0x9f0e('0x35')]),_0x158bc6);if(_0x162125['query'][_0x9f0e('0x36')]){_0x150c39[_0x9f0e('0x33')]=_[_0x9f0e('0x37')](_0x150c39[_0x9f0e('0x33')],{'$or':_[_0x9f0e('0x24')](_0x158bc6,function(_0x2077ce){if(_0x2077ce[_0x9f0e('0x27')]!==_0x9f0e('0x38')){var _0x7c8b69={};_0x7c8b69[_0x2077ce['name']]={'$like':'%'+_0x162125[_0x9f0e('0x2a')]['filter']+'%'};return _0x7c8b69;}})});}_0x150c39=_[_0x9f0e('0x37')]({},_0x150c39,_0x162125[_0x9f0e('0x39')]);var _0x2897dd={'where':_0x150c39[_0x9f0e('0x33')]};return db[_0x9f0e('0x25')]['count'](_0x2897dd)[_0x9f0e('0x1d')](function(_0x19246f){_0x16f82e['count']=_0x19246f;if(_0x162125['query'][_0x9f0e('0x3a')]){_0x150c39['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x9f0e('0x3b')](_0x150c39);})[_0x9f0e('0x1d')](function(_0x38af7b){_0x16f82e['rows']=_0x38af7b;return _0x16f82e;})[_0x9f0e('0x1d')](respondWithFilteredResult(_0x3e4214,_0x150c39))['catch'](handleError(_0x3e4214,null));};exports[_0x9f0e('0x3c')]=function(_0x4f1765,_0x43db67){var _0x39f2c6={'raw':!![],'where':{'id':_0x4f1765['params']['id']}},_0x32e27c={};_0x32e27c[_0x9f0e('0x29')]=_[_0x9f0e('0x2b')](db[_0x9f0e('0x25')][_0x9f0e('0x3d')]);_0x32e27c[_0x9f0e('0x2a')]=_[_0x9f0e('0x2b')](_0x4f1765['query']);_0x32e27c[_0x9f0e('0x35')]=_[_0x9f0e('0x2c')](_0x32e27c['model'],_0x32e27c[_0x9f0e('0x2a')]);_0x39f2c6[_0x9f0e('0x2d')]=_[_0x9f0e('0x2c')](_0x32e27c[_0x9f0e('0x29')],qs[_0x9f0e('0x2e')](_0x4f1765['query'][_0x9f0e('0x2e')]));_0x39f2c6[_0x9f0e('0x2d')]=_0x39f2c6['attributes'][_0x9f0e('0x2f')]?_0x39f2c6[_0x9f0e('0x2d')]:_0x32e27c[_0x9f0e('0x29')];if(_0x4f1765['query'][_0x9f0e('0x3a')]){_0x39f2c6[_0x9f0e('0x3e')]=[{'all':!![]}];}_0x39f2c6=_['merge']({},_0x39f2c6,_0x4f1765[_0x9f0e('0x39')]);return db['ChatTransferReport'][_0x9f0e('0x3f')](_0x39f2c6)[_0x9f0e('0x1d')](handleEntityNotFound(_0x43db67,null))[_0x9f0e('0x1d')](respondWithResult(_0x43db67,null))[_0x9f0e('0x40')](handleError(_0x43db67,null));};exports['create']=function(_0x4b3f2f,_0x1a1b22){return db[_0x9f0e('0x25')][_0x9f0e('0x41')](_0x4b3f2f['body'],{})[_0x9f0e('0x1d')](respondWithResult(_0x1a1b22,0xc9))['catch'](handleError(_0x1a1b22,null));};exports['update']=function(_0x439ef8,_0x2f8256){if(_0x439ef8[_0x9f0e('0x42')]['id']){delete _0x439ef8[_0x9f0e('0x42')]['id'];}return db[_0x9f0e('0x25')][_0x9f0e('0x3f')]({'where':{'id':_0x439ef8[_0x9f0e('0x43')]['id']}})[_0x9f0e('0x1d')](handleEntityNotFound(_0x2f8256,null))[_0x9f0e('0x1d')](saveUpdates(_0x439ef8[_0x9f0e('0x42')],null))[_0x9f0e('0x1d')](respondWithResult(_0x2f8256,null))['catch'](handleError(_0x2f8256,null));};exports['destroy']=function(_0x3f359b,_0x4a1532){return db['ChatTransferReport'][_0x9f0e('0x3f')]({'where':{'id':_0x3f359b[_0x9f0e('0x43')]['id']}})[_0x9f0e('0x1d')](handleEntityNotFound(_0x4a1532,null))['then'](removeEntity(_0x4a1532,null))[_0x9f0e('0x40')](handleError(_0x4a1532,null));};exports[_0x9f0e('0x44')]=function(_0x19775e,_0x3fa4a2){return db['ChatTransferReport'][_0x9f0e('0x44')]()['then'](respondWithResult(_0x3fa4a2,null))[_0x9f0e('0x40')](handleError(_0x3fa4a2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a44ea5a..6de9717 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 _0xe09a=['path','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xe09a,0x180));var _0xae09=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe09a[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xae09('0x0'));var util=require(_0xae09('0x1'));var logger=require('../../config/logger')(_0xae09('0x2'));var moment=require(_0xae09('0x3'));var BPromise=require(_0xae09('0x4'));var rp=require(_0xae09('0x5'));var fs=require('fs');var path=require(_0xae09('0x6'));var rimraf=require('rimraf');var config=require(_0xae09('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0xae09('0x8')]=function(_0x3008e9,_0x340ce4){return _0x3008e9[_0xae09('0x9')](_0xae09('0xa'),attributes,{'tableName':_0xae09('0xb'),'paranoid':![],'indexes':[{'name':_0xae09('0xc'),'fields':[_0xae09('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef8b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_chat_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x2fac87,_0xaa7130){var _0x48342e=function(_0x2cb396){while(--_0x2cb396){_0x2fac87['push'](_0x2fac87['shift']());}};_0x48342e(++_0xaa7130);}(_0xef8b,0xc0));var _0xbef8=function(_0x2c69a1,_0x201903){_0x2c69a1=_0x2c69a1-0x0;var _0x24bb91=_0xef8b[_0x2c69a1];return _0x24bb91;};'use strict';var _=require(_0xbef8('0x0'));var util=require('util');var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require(_0xbef8('0x6'));var rimraf=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0xbef8('0x9')]=function(_0x937386,_0x71f715){return _0x937386[_0xbef8('0xa')]('ChatTransferReport',attributes,{'tableName':_0xbef8('0xb'),'paranoid':![],'indexes':[{'name':_0xbef8('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b20c68d..5fd6201 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 _0x757b=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x2e61dd,_0x5131b7){var _0x41f98c=function(_0x55b2e8){while(--_0x55b2e8){_0x2e61dd['push'](_0x2e61dd['shift']());}};_0x41f98c(++_0x5131b7);}(_0x757b,0x88));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb757('0x0'));var util=require(_0xb757('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb757('0x2'));var fs=require('fs');var Redis=require(_0xb757('0x3'));var db=require(_0xb757('0x4'))['db'];var utils=require(_0xb757('0x5'));var logger=require(_0xb757('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb757('0x7'));var client=jayson[_0xb757('0x8')][_0xb757('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x535a6a,_0x2bce4b,_0x456493){return new BPromise(function(_0x11a6ba,_0x4d77d8){return client[_0xb757('0xa')](_0x535a6a,_0x456493)[_0xb757('0xb')](function(_0x3d184f){logger[_0xb757('0xc')](_0xb757('0xd'),_0x2bce4b,_0xb757('0xe'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2bce4b,_0xb757('0xe'),JSON[_0xb757('0xf')](_0x3d184f));if(_0x3d184f['error']){if(_0x3d184f[_0xb757('0x10')][_0xb757('0x11')]===0x1f4){logger[_0xb757('0x10')](_0xb757('0xd'),_0x2bce4b,_0x3d184f[_0xb757('0x10')][_0xb757('0x12')]);return _0x4d77d8(_0x3d184f[_0xb757('0x10')][_0xb757('0x12')]);}logger[_0xb757('0x10')](_0xb757('0xd'),_0x2bce4b,_0x3d184f[_0xb757('0x10')][_0xb757('0x12')]);return _0x11a6ba(_0x3d184f['error'][_0xb757('0x12')]);}else{logger[_0xb757('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x2bce4b,_0xb757('0xe'));_0x11a6ba(_0x3d184f[_0xb757('0x13')][_0xb757('0x12')]);}})[_0xb757('0x14')](function(_0x2256c0){logger[_0xb757('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2bce4b,_0x2256c0);_0x4d77d8(_0x2256c0);});});} \ No newline at end of file +var _0x1f77=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x1f77,0x180));var _0x71f7=function(_0x3559db,_0x5a2d9b){_0x3559db=_0x3559db-0x0;var _0x404bbd=_0x1f77[_0x3559db];return _0x404bbd;};'use strict';var _=require(_0x71f7('0x0'));var util=require(_0x71f7('0x1'));var moment=require(_0x71f7('0x2'));var BPromise=require(_0x71f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71f7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x71f7('0x5'))(_0x71f7('0x6'));var config=require(_0x71f7('0x7'));var jayson=require(_0x71f7('0x8'));var client=jayson[_0x71f7('0x9')][_0x71f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x323c64,_0x5f443c,_0x2c031c){return new BPromise(function(_0x51b1f4,_0x404e2c){return client['request'](_0x323c64,_0x2c031c)[_0x71f7('0xb')](function(_0x208b2b){logger[_0x71f7('0xc')](_0x71f7('0xd'),_0x5f443c,_0x71f7('0xe'));logger[_0x71f7('0xf')](_0x71f7('0x10'),_0x5f443c,_0x71f7('0xe'),JSON[_0x71f7('0x11')](_0x208b2b));if(_0x208b2b[_0x71f7('0x12')]){if(_0x208b2b[_0x71f7('0x12')]['code']===0x1f4){logger['error'](_0x71f7('0xd'),_0x5f443c,_0x208b2b[_0x71f7('0x12')][_0x71f7('0x13')]);return _0x404e2c(_0x208b2b[_0x71f7('0x12')][_0x71f7('0x13')]);}logger[_0x71f7('0x12')](_0x71f7('0xd'),_0x5f443c,_0x208b2b[_0x71f7('0x12')][_0x71f7('0x13')]);return _0x51b1f4(_0x208b2b[_0x71f7('0x12')]['message']);}else{logger[_0x71f7('0xc')](_0x71f7('0xd'),_0x5f443c,_0x71f7('0xe'));_0x51b1f4(_0x208b2b[_0x71f7('0x14')][_0x71f7('0x13')]);}})['catch'](function(_0x24ab7a){logger[_0x71f7('0x12')](_0x71f7('0xd'),_0x5f443c,_0x24ab7a);_0x404e2c(_0x24ab7a);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index fb2c38d..80ef131 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 _0x4bd1=['index','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x594352,_0x29d569){var _0x3e1e22=function(_0x34939d){while(--_0x34939d){_0x594352['push'](_0x594352['shift']());}};_0x3e1e22(++_0x29d569);}(_0x4bd1,0xfe));var _0x14bd=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x4bd1[_0x333fed];return _0x12cac2;};'use strict';var multer=require(_0x14bd('0x0'));var util=require(_0x14bd('0x1'));var path=require(_0x14bd('0x2'));var timeout=require(_0x14bd('0x3'));var express=require(_0x14bd('0x4'));var router=express[_0x14bd('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x14bd('0x6'));var config=require(_0x14bd('0x7'));var controller=require(_0x14bd('0x8'));router[_0x14bd('0x9')]('/',auth['isAuthenticated'](),controller[_0x14bd('0xa')]);router[_0x14bd('0x9')]('/describe',auth[_0x14bd('0xb')](),controller[_0x14bd('0xc')]);router[_0x14bd('0x9')]('/:id',auth[_0x14bd('0xb')](),controller[_0x14bd('0xd')]);router[_0x14bd('0xe')]('/',auth[_0x14bd('0xb')](),controller[_0x14bd('0xf')]);router[_0x14bd('0x10')]('/:id',auth[_0x14bd('0xb')](),controller[_0x14bd('0x11')]);router[_0x14bd('0x12')](_0x14bd('0x13'),auth[_0x14bd('0xb')](),controller[_0x14bd('0x14')]);module[_0x14bd('0x15')]=router; \ No newline at end of file +var _0xfda5=['isAuthenticated','/describe','describe','post','create','/:id','update','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xc53dd8,_0x2d7a86){var _0x44e5da=function(_0x31af61){while(--_0x31af61){_0xc53dd8['push'](_0xc53dd8['shift']());}};_0x44e5da(++_0x2d7a86);}(_0xfda5,0x99));var _0x5fda=function(_0x109d69,_0x53a294){_0x109d69=_0x109d69-0x0;var _0xb07add=_0xfda5[_0x109d69];return _0xb07add;};'use strict';var multer=require('multer');var util=require(_0x5fda('0x0'));var path=require(_0x5fda('0x1'));var timeout=require(_0x5fda('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5fda('0x3'));var interaction=require(_0x5fda('0x4'));var config=require(_0x5fda('0x5'));var controller=require('./chatTransferReport.controller');router[_0x5fda('0x6')]('/',auth[_0x5fda('0x7')](),controller['index']);router[_0x5fda('0x6')](_0x5fda('0x8'),auth[_0x5fda('0x7')](),controller[_0x5fda('0x9')]);router['get']('/:id',auth[_0x5fda('0x7')](),controller['show']);router[_0x5fda('0xa')]('/',auth[_0x5fda('0x7')](),controller[_0x5fda('0xb')]);router['put'](_0x5fda('0xc'),auth['isAuthenticated'](),controller[_0x5fda('0xd')]);router['delete'](_0x5fda('0xc'),auth[_0x5fda('0x7')](),controller[_0x5fda('0xe')]);module[_0x5fda('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1d59844..7da5c0c 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 _0xe373=['Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x18084e,_0x1983c6){var _0x46d662=function(_0x4888ab){while(--_0x4888ab){_0x18084e['push'](_0x18084e['shift']());}};_0x46d662(++_0x1983c6);}(_0xe373,0x1aa));var _0x3e37=function(_0x482fd,_0x2cb692){_0x482fd=_0x482fd-0x0;var _0x2c8289=_0xe373[_0x482fd];return _0x2c8289;};'use strict';var Sequelize=require(_0x3e37('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'unique':_0x3e37('0x2')},'description':{'type':Sequelize[_0x3e37('0x1')]},'mapKey':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x3')},'key':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x4')},'customerAlias':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'defaultValue':_0x3e37('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3e37('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3e37('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3e37('0x1')]},'animation':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3e37('0x9')](_0x3e37('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xb')},'start_chat_button':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0xd')},'header_offline':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xe')},'download_transcript':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3e37('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3e37('0x10')]},'closingQuestion':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x13')},'placeholderMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x15')},'closingMessageButton':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xd')},'skipMessageButton':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x17')},'ratingType':{'type':Sequelize[_0x3e37('0x9')]('star',_0x3e37('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x3e37('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3e37('0x10')],'defaultValue':function(){return JSON[_0x3e37('0x19')]({'items':[{'type':_0x3e37('0x1a'),'variable':null,'config':{'placeholder':_0x3e37('0x1b'),'type':_0x3e37('0x1c'),'required':!![]},'props':{'title':_0x3e37('0x1b'),'helpText':''}},{'type':_0x3e37('0x1a'),'props':{'title':_0x3e37('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3e37('0x3'),'type':_0x3e37('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3e37('0x1d')](_0x3e37('0x1e'))?JSON[_0x3e37('0x1f')](this['getDataValue'](_0x3e37('0x1e'))):{};},'set':function(_0x324542){return this['setDataValue'](_0x3e37('0x1e'),JSON['stringify'](_0x324542));}},'offlineForm':{'type':Sequelize[_0x3e37('0x10')],'defaultValue':function(){return JSON[_0x3e37('0x19')]({'items':[{'type':_0x3e37('0x1a'),'props':{'title':_0x3e37('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3e37('0x3'),'type':'email'},'variable':null},{'type':_0x3e37('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x3e37('0x21'),'helpText':_0x3e37('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x3e37('0x1d')](_0x3e37('0x23'))?JSON[_0x3e37('0x1f')](this['getDataValue'](_0x3e37('0x23'))):{};},'set':function(_0x15ef4a){return this[_0x3e37('0x24')]('offlineForm',JSON[_0x3e37('0x19')](_0x15ef4a));}},'token':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':function(){return rs[_0x3e37('0x25')]();}},'autoclose':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3e37('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3e37('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x26')},'waitingMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3e37('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3e37('0x29');}},'notificationSound':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3e37('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x2b')},'verticalAlignment':{'type':Sequelize[_0x3e37('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'defaultValue':_0x3e37('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3e37('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3e37('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x2e')},'systemAvatar':{'type':Sequelize[_0x3e37('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3e37('0x7')],'comment':_0x3e37('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![],'comment':_0x3e37('0x30'),'set':function(_0x2107e2){if(!_0x2107e2)this[_0x3e37('0x24')](_0x3e37('0x31'),null);this[_0x3e37('0x24')](_0x3e37('0x32'),_0x2107e2);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3e37('0x1')]},'vidaooTopic':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'defaultValue':_0x3e37('0x33')},'vidaooNote':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':function(){return _0x3e37('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x3e37('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4cd6=['Leave\x20your\x20comments','parse','offlineForm','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','name','onlineForm','getDataValue','textarea','Comments'];(function(_0x5ce105,_0x34f3ce){var _0x33d030=function(_0x3e64ef){while(--_0x3e64ef){_0x5ce105['push'](_0x5ce105['shift']());}};_0x33d030(++_0x34f3ce);}(_0x4cd6,0xa5));var _0x64cd=function(_0x5ef2a3,_0x285893){_0x5ef2a3=_0x5ef2a3-0x0;var _0x37d42c=_0x4cd6[_0x5ef2a3];return _0x37d42c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x64cd('0x0'));module[_0x64cd('0x1')]={'name':{'type':Sequelize[_0x64cd('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x64cd('0x2')],'allowNull':![],'unique':_0x64cd('0x3')},'description':{'type':Sequelize[_0x64cd('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x64cd('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x64cd('0x4')},'key':{'type':Sequelize[_0x64cd('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x64cd('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x64cd('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x64cd('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x64cd('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x64cd('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x64cd('0xa')](_0x64cd('0xb'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0xc')},'start_chat_button':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x64cd('0xd')},'header_offline':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x64cd('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x64cd('0xf')]},'closingQuestion':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x64cd('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x12')},'placeholderMessage':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x13')},'closingMessage':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0xd')},'skipMessageButton':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x14')},'conditionAgreement':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x15')},'ratingType':{'type':Sequelize[_0x64cd('0xa')](_0x64cd('0x16'),_0x64cd('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x64cd('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x64cd('0xf')],'defaultValue':function(){return JSON[_0x64cd('0x18')]({'items':[{'type':_0x64cd('0x19'),'variable':null,'config':{'placeholder':_0x64cd('0x1a'),'type':'text','required':!![]},'props':{'title':_0x64cd('0x1a'),'helpText':''}},{'type':_0x64cd('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x64cd('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x64cd('0x1b'))?JSON['parse'](this[_0x64cd('0x1c')](_0x64cd('0x1b'))):{};},'set':function(_0x55098a){return this['setDataValue'](_0x64cd('0x1b'),JSON[_0x64cd('0x18')](_0x55098a));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x64cd('0x18')]({'items':[{'type':_0x64cd('0x19'),'props':{'title':_0x64cd('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x64cd('0x4')},'variable':null},{'type':_0x64cd('0x1d'),'config':{'placeholder':'Comments'},'props':{'title':_0x64cd('0x1e'),'helpText':_0x64cd('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x64cd('0x1c')]('offlineForm')?JSON[_0x64cd('0x20')](this[_0x64cd('0x1c')](_0x64cd('0x21'))):{};},'set':function(_0x3754c0){return this[_0x64cd('0x22')](_0x64cd('0x21'),JSON[_0x64cd('0x18')](_0x3754c0));}},'token':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':function(){return rs[_0x64cd('0x23')]();}},'autoclose':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x64cd('0x2')]},'forwardOffline':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x64cd('0x25')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x64cd('0x14')},'sendUnmanaged':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x64cd('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x64cd('0x2')]},'notificationTemplate':{'type':Sequelize[_0x64cd('0xf')],'defaultValue':function(){return _0x64cd('0x26');}},'notificationSound':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x64cd('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x64cd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x28')},'verticalAlignment':{'type':Sequelize[_0x64cd('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':_0x64cd('0x29')},'messagesAlignment':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x64cd('0x2')]},'customerAvatar':{'type':Sequelize[_0x64cd('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x64cd('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x64cd('0x2')],'allowNull':![],'defaultValue':_0x64cd('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x64cd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x64cd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x64cd('0x8')],'comment':_0x64cd('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![],'comment':_0x64cd('0x2c'),'set':function(_0x1eb8c6){if(!_0x1eb8c6)this['setDataValue'](_0x64cd('0x2d'),null);this[_0x64cd('0x22')](_0x64cd('0x2e'),_0x1eb8c6);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x64cd('0x2')]},'vidaooTopic':{'type':Sequelize[_0x64cd('0x2')],'allowNull':![],'defaultValue':_0x64cd('0x2f')},'vidaooNote':{'type':Sequelize[_0x64cd('0x2')],'defaultValue':function(){return _0x64cd('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x64cd('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x64cd('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x64cd('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 43584bd..8ec3af5 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 _0x9957=['Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','priority','asc','account','list','Contacts','contact','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','interaction','ChatInteraction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','Sequelize','no\x20available\x20attributes','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','ChatOfflineMessage','fromString','originalname','mimetype','files','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tags','color','tag','getSnippet','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','3.13.0','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','stringify','x-real-ip','connection','replace','alignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','undefined','limit','offset','count','Content-Range','update','destroy','ChatWebsites','end','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','vendor','%s\x20%s\x20%s','model','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','key','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','include','findAll','show','params','includeAll','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','get','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','rows','removeDispositions','ChatWebsiteId','CannedAnswer','removeAnswers','ids','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','includes'];(function(_0x28fb34,_0x1a1869){var _0x404a15=function(_0x35f155){while(--_0x35f155){_0x28fb34['push'](_0x28fb34['shift']());}};_0x404a15(++_0x1a1869);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Mustache=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var ejs=require(_0x7995('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7995('0x4'));var querystring=require(_0x7995('0x5'));var htmlToText=require(_0x7995('0x6'));var Redis=require(_0x7995('0x7'));var jayson=require('jayson/promise');var qs=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));var config=require(_0x7995('0xb'));var APIBadRequestError=require(_0x7995('0xc'))[_0x7995('0xd')];var APINotFoundError=require('../../errors/api')[_0x7995('0xe')];var APIOutOfIntervalError=require(_0x7995('0xc'))['APIOutOfIntervalError'];var APIHandleError=require(_0x7995('0xc'))[_0x7995('0xf')];var APIConflictError=require(_0x7995('0xc'))[_0x7995('0x10')];var wildcardUtils=require(_0x7995('0x11'));var URL=require(_0x7995('0x12'))[_0x7995('0x13')];var db=require('../../mysqldb')['db'];config[_0x7995('0x14')]=_[_0x7995('0x15')](config['redis'],{'host':_0x7995('0x16'),'port':0x18eb});var socket=require(_0x7995('0x17'))(new Redis(config[_0x7995('0x14')]));require(_0x7995('0x18'))[_0x7995('0x19')](socket);var client=jayson[_0x7995('0x1a')][_0x7995('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x7995('0x1a')][_0x7995('0x1b')]({'port':0x232b});var client9001=jayson[_0x7995('0x1a')][_0x7995('0x1b')]({'port':0x2329});function respondWithRpcPromise(_0x3f1d3e,_0x1a5310,_0x2202ce,_0x41cbf0){return new Promise(function(_0x5377e5,_0x2eeacc){var _0x565d97=_0x41cbf0||client;return _0x565d97[_0x7995('0x1c')](_0x3f1d3e,_0x2202ce)[_0x7995('0x1d')](function(_0x43d4b8){logger[_0x7995('0x1e')](_0x7995('0x1f'),_0x1a5310,_0x7995('0x20'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1a5310,_0x7995('0x20'),JSON['stringify'](_0x43d4b8));if(_0x43d4b8['error']){if(_0x43d4b8[_0x7995('0x21')][_0x7995('0x22')]===0x1f4){logger['error'](_0x7995('0x1f'),_0x1a5310,_0x43d4b8['error']['message']);return _0x2eeacc(_0x43d4b8[_0x7995('0x21')][_0x7995('0x23')]);}logger[_0x7995('0x21')](_0x7995('0x1f'),_0x1a5310,_0x43d4b8[_0x7995('0x21')][_0x7995('0x23')]);return _0x5377e5(_0x43d4b8['error'][_0x7995('0x23')]);}else{logger[_0x7995('0x1e')](_0x7995('0x1f'),_0x1a5310,_0x7995('0x20'));_0x5377e5(_0x43d4b8[_0x7995('0x24')][_0x7995('0x23')]);}})[_0x7995('0x25')](function(_0x472195){logger['error'](_0x7995('0x1f'),_0x1a5310,_0x472195);_0x2eeacc(_0x472195);});});}function respondWithStatusCode(_0x34e70c,_0x401dc3){_0x401dc3=_0x401dc3||0xcc;return function(_0x268ce7){if(_0x268ce7){return _0x34e70c[_0x7995('0x26')](_0x401dc3);}return _0x34e70c[_0x7995('0x27')](_0x401dc3)['end']();};}function respondWithResult(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0xc8;return function(_0x229742){if(_0x229742){return _0x47625f[_0x7995('0x27')](_0x5911c3)[_0x7995('0x28')](_0x229742);}};}function respondWithFilteredResult(_0x132a42,_0x11c1eb){return function(_0x4b6f99){if(_0x4b6f99){var _0x9b2a15=typeof _0x11c1eb['offset']===_0x7995('0x29')&&typeof _0x11c1eb[_0x7995('0x2a')]===_0x7995('0x29');var _0x574574=_0x4b6f99['count'];var _0x48e573=_0x9b2a15?0x0:_0x11c1eb[_0x7995('0x2b')];var _0xe6b0b3=_0x9b2a15?_0x4b6f99[_0x7995('0x2c')]:_0x11c1eb[_0x7995('0x2b')]+_0x11c1eb[_0x7995('0x2a')];var _0x1ca460;if(_0xe6b0b3>=_0x574574){_0xe6b0b3=_0x574574;_0x1ca460=0xc8;}else{_0x1ca460=0xce;}_0x132a42['status'](_0x1ca460);return _0x132a42['set'](_0x7995('0x2d'),_0x48e573+'-'+_0xe6b0b3+'/'+_0x574574)['json'](_0x4b6f99);}return null;};}function saveUpdates(_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x2e')](_0x553671)[_0x7995('0x1d')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x2f')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x30');return db['UserProfileResource'][_0x7995('0x2f')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1d')](function(){_0x510841[_0x7995('0x27')](0xcc)[_0x7995('0x31')]();});}};}function handleEntityNotFound(_0x5014d2){return function(_0x52d76d){if(!_0x52d76d){_0x5014d2[_0x7995('0x26')](0x194);}return _0x52d76d;};}function handleError(_0x5e67fe,_0x5d2428){_0x5d2428=_0x5d2428||0x1f4;return function(_0x3e99cd){logger[_0x7995('0x21')](_0x3e99cd['stack']);if(_0x3e99cd[_0x7995('0x32')]){delete _0x3e99cd[_0x7995('0x32')];}_0x5e67fe[_0x7995('0x27')](_0x5d2428)[_0x7995('0x33')](_0x3e99cd);};}function createInteractionObject(_0x1e3dbf,_0x53002a,_0x2d4285,_0x242713){var _0xf612e6=require(_0x7995('0x34'));var _0x4b1541=new _0xf612e6();var _0x2be2c0=_0x4b1541[_0x7995('0x35')](_0x2d4285[_0x7995('0x36')])[_0x7995('0x37')]();var _0x1f5bee=_0x53002a[_0x7995('0x38')];if(_0x2d4285['cf-connecting-ip']){_0x1f5bee=_0x2d4285[_0x7995('0x39')];}else if(_0x2d4285[_0x7995('0x3a')]){_0x1f5bee=_[_0x7995('0x3b')](_0x2d4285[_0x7995('0x3a')][_0x7995('0x3c')](','));}return{'ContactId':_0x242713['id'],'ChatWebsiteId':_0x1e3dbf,'from':(_0x242713[_0x7995('0x3d')]||'')+'\x20'+(_0x242713[_0x7995('0x3e')]||''),'customerIp':_0x1f5bee,'customerPort':_0x2d4285[_0x7995('0x3f')]?_0x2d4285[_0x7995('0x3f')]:null,'referer':_0x53002a[_0x7995('0x40')],'browserName':_0x2be2c0[_0x7995('0x41')][_0x7995('0x32')]&&_0x2be2c0[_0x7995('0x41')]['version']?util['format'](_0x7995('0x42'),_0x2be2c0[_0x7995('0x41')]['name'],_0x2be2c0['browser'][_0x7995('0x43')]):'unknown','browserVersion':_0x2be2c0['browser'][_0x7995('0x43')]||_0x7995('0x44'),'osName':util[_0x7995('0x45')]('%s\x20%s',_0x2be2c0['os'][_0x7995('0x32')],_0x2be2c0['os']['version']),'osVersion':_0x2be2c0['os'][_0x7995('0x43')],'deviceModel':_0x2be2c0['device']['model']&&_0x2be2c0[_0x7995('0x46')][_0x7995('0x47')]?util[_0x7995('0x45')](_0x7995('0x48'),_0x2be2c0['device'][_0x7995('0x49')],_0x2be2c0[_0x7995('0x46')][_0x7995('0x47')],_0x2be2c0[_0x7995('0x46')]['type']):null,'deviceVendor':_0x2be2c0['device'][_0x7995('0x47')],'deviceType':_0x2be2c0['device'][_0x7995('0x4a')],'formData':JSON['stringify'](_0x53002a)};}exports[_0x7995('0x4b')]=function(_0x4c1127,_0x1e795e){var _0x1b0373={'include':[{'model':db[_0x7995('0x4c')],'as':_0x7995('0x4d')}]},_0x4d9245={},_0x3e9e62={'count':0x0,'rows':[]};var _0xb70a51=_['map'](db[_0x7995('0x4e')][_0x7995('0x4f')],function(_0x237270){return{'name':_0x237270['fieldName'],'type':_0x237270[_0x7995('0x4a')][_0x7995('0x50')]};});_0x4d9245[_0x7995('0x49')]=_[_0x7995('0x51')](_0xb70a51,_0x7995('0x32'));_0x4d9245['query']=_[_0x7995('0x52')](_0x4c1127[_0x7995('0x53')]);_0x4d9245['filters']=_[_0x7995('0x54')](_0x4d9245['model'],_0x4d9245[_0x7995('0x53')]);_0x1b0373[_0x7995('0x55')]=_[_0x7995('0x54')](_0x4d9245[_0x7995('0x49')],qs[_0x7995('0x56')](_0x4c1127[_0x7995('0x53')][_0x7995('0x56')]));_0x1b0373['attributes']=_0x1b0373[_0x7995('0x55')][_0x7995('0x57')]?_0x1b0373[_0x7995('0x55')]:_0x4d9245['model'];if(!_0x4c1127[_0x7995('0x53')][_0x7995('0x58')](_0x7995('0x59'))){_0x1b0373['limit']=qs['limit'](_0x4c1127['query'][_0x7995('0x2a')]);_0x1b0373[_0x7995('0x2b')]=qs['offset'](_0x4c1127[_0x7995('0x53')][_0x7995('0x2b')]);}_0x1b0373[_0x7995('0x5a')]=qs[_0x7995('0x5b')](_0x4c1127[_0x7995('0x53')]['sort']);_0x1b0373[_0x7995('0x5c')]=qs['filters'](_[_0x7995('0x5d')](_0x4c1127[_0x7995('0x53')],_0x4d9245[_0x7995('0x5e')]),_0xb70a51);if(_0x4c1127['query']['filter']){_0x1b0373['where']=_['merge'](_0x1b0373[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0xb70a51,function(_0x1a861c){if(_0x1a861c[_0x7995('0x4a')]!==_0x7995('0x5f')){var _0x357e60={};_0x357e60[_0x1a861c[_0x7995('0x32')]]={'$like':'%'+_0x4c1127[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x357e60;}})});}_0x1b0373=_[_0x7995('0x61')]({},_0x1b0373,_0x4c1127[_0x7995('0x62')]);var _0x133c63={'where':_0x1b0373[_0x7995('0x5c')]};return db[_0x7995('0x4e')][_0x7995('0x2c')](_0x133c63)[_0x7995('0x1d')](function(_0x447a2b){_0x3e9e62[_0x7995('0x2c')]=_0x447a2b;if(_0x4c1127[_0x7995('0x53')]['includeAll']){_0x1b0373[_0x7995('0x63')]=[{'all':!![]}];}return db[_0x7995('0x4e')][_0x7995('0x64')](_0x1b0373);})[_0x7995('0x1d')](function(_0x5d160d){_0x3e9e62['rows']=_0x5d160d;return _0x3e9e62;})[_0x7995('0x1d')](respondWithFilteredResult(_0x1e795e,_0x1b0373))[_0x7995('0x25')](handleError(_0x1e795e,null));};exports[_0x7995('0x65')]=function(_0x332a85,_0x51c50b){var _0x13cd7b={'raw':![],'where':{'id':_0x332a85[_0x7995('0x66')]['id']},'include':[{'model':db[_0x7995('0x4c')],'as':'mandatoryDispositionPause'}]},_0x74ff38={};_0x74ff38['model']=_[_0x7995('0x52')](db[_0x7995('0x4e')][_0x7995('0x4f')]);_0x74ff38[_0x7995('0x53')]=_[_0x7995('0x52')](_0x332a85[_0x7995('0x53')]);_0x74ff38[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x74ff38[_0x7995('0x49')],_0x74ff38['query']);_0x13cd7b[_0x7995('0x55')]=_[_0x7995('0x54')](_0x74ff38[_0x7995('0x49')],qs[_0x7995('0x56')](_0x332a85['query']['fields']));_0x13cd7b[_0x7995('0x55')]=_0x13cd7b[_0x7995('0x55')]['length']?_0x13cd7b[_0x7995('0x55')]:_0x74ff38[_0x7995('0x49')];if(_0x332a85[_0x7995('0x53')][_0x7995('0x67')]){_0x13cd7b[_0x7995('0x63')]=[{'all':!![]}];}_0x13cd7b=_['merge']({},_0x13cd7b,_0x332a85[_0x7995('0x62')]);return db['ChatWebsite'][_0x7995('0x68')](_0x13cd7b)[_0x7995('0x1d')](handleEntityNotFound(_0x51c50b,null))[_0x7995('0x1d')](respondWithResult(_0x51c50b,null))[_0x7995('0x25')](handleError(_0x51c50b,null));};exports[_0x7995('0x69')]=function(_0xeb8920,_0x2b3c1d){var _0x44372a=null;_0xeb8920[_0x7995('0x6a')][_0x7995('0x6b')][_0x7995('0x3c')](',')[_0x7995('0x6c')](_0x56eb85=>{if(_0x56eb85[_0x7995('0x6d')]()!==''&&!wildcardUtils[_0x7995('0x6e')](_0x56eb85[_0x7995('0x6d')]())){_0x44372a=new APIBadRequestError('\x22'+_0x56eb85[_0x7995('0x6d')]()+_0x7995('0x6f'));}});if(_0x44372a){return handleError(_0x2b3c1d,null)(_0x44372a);}return db['ChatWebsite']['create'](_0xeb8920[_0x7995('0x6a')],{})[_0x7995('0x1d')](function(_0x221542){var _0xae6166=_0xeb8920['user'][_0x7995('0x70')]({'plain':!![]});if(!_0xae6166)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xae6166['role']===_0x7995('0x71')){var _0x36d27d=_0x221542[_0x7995('0x70')]({'plain':!![]});var _0x44bf2b=_0x7995('0x30');return db[_0x7995('0x72')][_0x7995('0x68')]({'where':{'name':_0x44bf2b,'userProfileId':_0xae6166[_0x7995('0x73')]},'raw':!![]})[_0x7995('0x1d')](function(_0x2466df){if(_0x2466df&&_0x2466df['autoAssociation']===0x0){return db[_0x7995('0x74')][_0x7995('0x69')]({'name':_0x36d27d[_0x7995('0x32')],'resourceId':_0x36d27d['id'],'type':_0x2466df['name'],'sectionId':_0x2466df['id']},{})[_0x7995('0x1d')](function(){return _0x221542;});}else{return _0x221542;}})[_0x7995('0x25')](function(_0x705f0){logger[_0x7995('0x21')](_0x7995('0x75'),_0x705f0);throw _0x705f0;});}return _0x221542;})[_0x7995('0x1d')](respondWithResult(_0x2b3c1d,0xc9))[_0x7995('0x25')](handleError(_0x2b3c1d,null));};exports[_0x7995('0x2e')]=function(_0x2f94c4,_0x1fdff6){var _0x435a1b=null;_0x2f94c4['body']['address'][_0x7995('0x3c')](',')[_0x7995('0x6c')](_0x39ebb6=>{if(_0x39ebb6[_0x7995('0x6d')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x39ebb6[_0x7995('0x6d')]())){_0x435a1b=new APIBadRequestError('\x22'+_0x39ebb6[_0x7995('0x6d')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x435a1b){return handleError(_0x1fdff6,null)(_0x435a1b);}if(_0x2f94c4['body']['id']){delete _0x2f94c4[_0x7995('0x6a')]['id'];}return db[_0x7995('0x4e')]['find']({'where':{'id':_0x2f94c4[_0x7995('0x66')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x4d')}]})[_0x7995('0x1d')](handleEntityNotFound(_0x1fdff6,null))['then'](saveUpdates(_0x2f94c4['body'],null))[_0x7995('0x1d')](respondWithResult(_0x1fdff6,null))['catch'](handleError(_0x1fdff6,null));};exports[_0x7995('0x2f')]=function(_0xa41fff,_0x3dd197){return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0xa41fff[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x3dd197,null))[_0x7995('0x1d')](removeEntity(_0x3dd197,null))[_0x7995('0x25')](handleError(_0x3dd197,null));};exports[_0x7995('0x76')]=function(_0x1ab590,_0x16108c){return db[_0x7995('0x4e')][_0x7995('0x76')]()[_0x7995('0x1d')](respondWithResult(_0x16108c,null))[_0x7995('0x25')](handleError(_0x16108c,null));};exports[_0x7995('0x77')]=function(_0x251490,_0x2ff7ba){if(_0x251490[_0x7995('0x6a')]['id']){delete _0x251490[_0x7995('0x6a')]['id'];}return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x251490[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x2ff7ba,null))[_0x7995('0x1d')](function(_0x2f7f51){if(_0x2f7f51){_0x251490[_0x7995('0x6a')]['ChatWebsiteId']=_0x2f7f51['id'];return db[_0x7995('0x78')][_0x7995('0x69')](_0x251490['body']);}})['then'](respondWithResult(_0x2ff7ba,null))[_0x7995('0x25')](handleError(_0x2ff7ba,null));};exports[_0x7995('0x79')]=function(_0x2d45d5,_0x38acda){var _0xe1ce4={'raw':![],'where':{}};var _0x2491fe={};var _0x5507a0={'count':0x0,'rows':[]};return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x2d45d5[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x38acda,null))[_0x7995('0x1d')](function(_0x3f0bff){if(_0x3f0bff){_0x2491fe[_0x7995('0x49')]=_[_0x7995('0x52')](db['Disposition'][_0x7995('0x4f')]);_0x2491fe[_0x7995('0x53')]=_['keys'](_0x2d45d5['query']);_0x2491fe[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x2491fe[_0x7995('0x49')],_0x2491fe[_0x7995('0x53')]);_0xe1ce4[_0x7995('0x55')]=_['intersection'](_0x2491fe[_0x7995('0x49')],qs[_0x7995('0x56')](_0x2d45d5['query'][_0x7995('0x56')]));_0xe1ce4[_0x7995('0x55')]=_0xe1ce4['attributes'][_0x7995('0x57')]?_0xe1ce4['attributes']:_0x2491fe[_0x7995('0x49')];if(!_0x2d45d5[_0x7995('0x53')][_0x7995('0x58')](_0x7995('0x59'))){_0xe1ce4[_0x7995('0x2a')]=qs['limit'](_0x2d45d5[_0x7995('0x53')][_0x7995('0x2a')]);_0xe1ce4[_0x7995('0x2b')]=qs['offset'](_0x2d45d5[_0x7995('0x53')][_0x7995('0x2b')]);}_0xe1ce4[_0x7995('0x5a')]=qs[_0x7995('0x5b')](_0x2d45d5['query'][_0x7995('0x5b')]);_0xe1ce4[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_['pick'](_0x2d45d5['query'],_0x2491fe[_0x7995('0x5e')]));_0xe1ce4[_0x7995('0x5c')]['ChatWebsiteId']=_0x3f0bff['id'];if(_0x2d45d5['query'][_0x7995('0x60')]){_0xe1ce4[_0x7995('0x5c')]=_[_0x7995('0x61')](_0xe1ce4[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0xe1ce4['attributes'],function(_0x56003d){var _0x393cb7={};_0x393cb7[_0x56003d]={'$like':'%'+_0x2d45d5['query']['filter']+'%'};return _0x393cb7;})});}_0xe1ce4=_[_0x7995('0x61')]({},_0xe1ce4,_0x2d45d5[_0x7995('0x62')]);return db[_0x7995('0x78')]['count']({'where':_0xe1ce4[_0x7995('0x5c')]})[_0x7995('0x1d')](function(_0x2b0b79){_0x5507a0[_0x7995('0x2c')]=_0x2b0b79;if(_0x2d45d5[_0x7995('0x53')]['includeAll']){_0xe1ce4[_0x7995('0x63')]=[{'all':!![]}];}return db[_0x7995('0x78')][_0x7995('0x64')](_0xe1ce4);})[_0x7995('0x1d')](function(_0x50bf9a){_0x5507a0[_0x7995('0x7b')]=_0x50bf9a;return _0x5507a0;});}})[_0x7995('0x1d')](respondWithFilteredResult(_0x38acda,_0xe1ce4))['catch'](handleError(_0x38acda,null));};exports[_0x7995('0x7c')]=function(_0x20683e,_0x5b1528){return db[_0x7995('0x4e')]['find']({'where':{'id':_0x20683e[_0x7995('0x66')]['id']}})['then'](handleEntityNotFound(_0x5b1528,null))[_0x7995('0x1d')](function(_0x4d12fd){if(_0x4d12fd){return _0x4d12fd[_0x7995('0x7c')](_0x20683e[_0x7995('0x53')]['ids']);}})[_0x7995('0x1d')](respondWithStatusCode(_0x5b1528,null))['catch'](handleError(_0x5b1528,null));};exports['addAnswer']=function(_0x7b9e26,_0x14812d){if(_0x7b9e26[_0x7995('0x6a')]['id']){delete _0x7b9e26[_0x7995('0x6a')]['id'];}return db['ChatWebsite'][_0x7995('0x68')]({'where':{'id':_0x7b9e26[_0x7995('0x66')]['id']}})['then'](handleEntityNotFound(_0x14812d,null))['then'](function(_0xc2648d){if(_0xc2648d){_0x7b9e26['body'][_0x7995('0x7d')]=_0xc2648d['id'];return db[_0x7995('0x7e')][_0x7995('0x69')](_0x7b9e26['body']);}})['then'](respondWithResult(_0x14812d,null))[_0x7995('0x25')](handleError(_0x14812d,null));};exports['getAnswers']=function(_0x12e9d9,_0x44891e){var _0x14449c={'raw':![],'where':{}};var _0x38bd35={};var _0x4ff5e7={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x12e9d9[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x44891e,null))[_0x7995('0x1d')](function(_0x2df7d3){if(_0x2df7d3){_0x38bd35[_0x7995('0x49')]=_[_0x7995('0x52')](db['CannedAnswer']['rawAttributes']);_0x38bd35[_0x7995('0x53')]=_['keys'](_0x12e9d9['query']);_0x38bd35[_0x7995('0x5e')]=_['intersection'](_0x38bd35['model'],_0x38bd35[_0x7995('0x53')]);_0x14449c[_0x7995('0x55')]=_[_0x7995('0x54')](_0x38bd35['model'],qs[_0x7995('0x56')](_0x12e9d9[_0x7995('0x53')][_0x7995('0x56')]));_0x14449c[_0x7995('0x55')]=_0x14449c[_0x7995('0x55')][_0x7995('0x57')]?_0x14449c[_0x7995('0x55')]:_0x38bd35[_0x7995('0x49')];if(!_0x12e9d9[_0x7995('0x53')]['hasOwnProperty'](_0x7995('0x59'))){_0x14449c[_0x7995('0x2a')]=qs[_0x7995('0x2a')](_0x12e9d9[_0x7995('0x53')][_0x7995('0x2a')]);_0x14449c['offset']=qs[_0x7995('0x2b')](_0x12e9d9[_0x7995('0x53')][_0x7995('0x2b')]);}_0x14449c['order']=qs['sort'](_0x12e9d9['query'][_0x7995('0x5b')]);_0x14449c[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_[_0x7995('0x5d')](_0x12e9d9[_0x7995('0x53')],_0x38bd35[_0x7995('0x5e')]));_0x14449c['where'][_0x7995('0x7d')]=_0x2df7d3['id'];if(_0x12e9d9['query'][_0x7995('0x60')]){_0x14449c[_0x7995('0x5c')]=_[_0x7995('0x61')](_0x14449c[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0x14449c[_0x7995('0x55')],function(_0x4f929b){var _0x24a0e6={};_0x24a0e6[_0x4f929b]={'$like':'%'+_0x12e9d9[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x24a0e6;})});}_0x14449c=_[_0x7995('0x61')]({},_0x14449c,_0x12e9d9['options']);return db[_0x7995('0x7e')]['count']({'where':_0x14449c[_0x7995('0x5c')]})[_0x7995('0x1d')](function(_0x592ae3){_0x4ff5e7['count']=_0x592ae3;if(_0x12e9d9[_0x7995('0x53')][_0x7995('0x67')]){_0x14449c[_0x7995('0x63')]=[{'all':!![]}];}return db[_0x7995('0x7e')][_0x7995('0x64')](_0x14449c);})[_0x7995('0x1d')](function(_0x281477){_0x4ff5e7[_0x7995('0x7b')]=_0x281477;return _0x4ff5e7;});}})[_0x7995('0x1d')](respondWithFilteredResult(_0x44891e,_0x14449c))[_0x7995('0x25')](handleError(_0x44891e,null));};exports[_0x7995('0x7f')]=function(_0x245ea6,_0x5eb2d9){return db['ChatWebsite'][_0x7995('0x68')]({'where':{'id':_0x245ea6[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x5eb2d9,null))[_0x7995('0x1d')](function(_0x100bde){if(_0x100bde){return _0x100bde['removeAnswers'](_0x245ea6[_0x7995('0x53')][_0x7995('0x80')]);}})['then'](respondWithStatusCode(_0x5eb2d9,null))[_0x7995('0x25')](handleError(_0x5eb2d9,null));};exports['addLogo']=function(_0x37416c,_0x30cda5){_0x37416c[_0x7995('0x6a')]['sitepic']=_0x37416c[_0x7995('0x81')][_0x7995('0x82')];return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x37416c[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x30cda5,null))[_0x7995('0x1d')](saveUpdates(_0x37416c['body'],null))['then'](respondWithResult(_0x30cda5,null))['catch'](handleError(_0x30cda5,null));};exports[_0x7995('0x83')]=function(_0x1b4915,_0x5a78e9){_0x1b4915['body'][_0x7995('0x84')]=_0x1b4915[_0x7995('0x81')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x1b4915['params']['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x5a78e9,null))[_0x7995('0x1d')](saveUpdates(_0x1b4915[_0x7995('0x6a')],null))[_0x7995('0x1d')](respondWithResult(_0x5a78e9,null))['catch'](handleError(_0x5a78e9,null));};exports[_0x7995('0x85')]=function(_0x248e7c,_0x58c3e8){_0x248e7c[_0x7995('0x6a')][_0x7995('0x86')]=_0x248e7c[_0x7995('0x81')]['filename'];return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x248e7c['params']['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x58c3e8,null))[_0x7995('0x1d')](saveUpdates(_0x248e7c[_0x7995('0x6a')],null))[_0x7995('0x1d')](respondWithResult(_0x58c3e8,null))[_0x7995('0x25')](handleError(_0x58c3e8,null));};exports[_0x7995('0x87')]=function(_0x8abd9a,_0x114f3c){_0x8abd9a[_0x7995('0x6a')][_0x7995('0x88')]=_0x8abd9a[_0x7995('0x81')][_0x7995('0x82')];return db[_0x7995('0x4e')]['find']({'where':{'id':_0x8abd9a[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x114f3c,null))[_0x7995('0x1d')](saveUpdates(_0x8abd9a[_0x7995('0x6a')],null))['then'](respondWithResult(_0x114f3c,null))[_0x7995('0x25')](handleError(_0x114f3c,null));};exports[_0x7995('0x89')]=function(_0x2bc931,_0x52af9b){var _0x1bcc6b=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x8c'));var _0x1dfc40={'where':{'id':_0x2bc931[_0x7995('0x66')]['id']},'attributes':['id',_0x7995('0x8d')],'raw':!![]};var _0x4f9d58=![];return require(_0x7995('0x8e'))['getLicense']()[_0x7995('0x1d')](function(_0x164c61){if(_0x164c61){_0x4f9d58=_0x164c61[_0x7995('0x8f')];}})['then'](function(){return db[_0x7995('0x4e')]['find'](_0x1dfc40);})['then'](handleEntityNotFound(_0x52af9b,null))['then'](function(_0x4b3170){if(_0x4b3170){if(!_[_0x7995('0x90')](_0x4b3170[_0x7995('0x8d')])){if(fs['existsSync'](path[_0x7995('0x8a')](config[_0x7995('0x8b')],'server/files/images/logos/',_0x4b3170[_0x7995('0x8d')]))&&_0x4f9d58){_0x1bcc6b=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x91'),_0x4b3170[_0x7995('0x8d')]);}}return _0x52af9b['download'](_0x1bcc6b);}})[_0x7995('0x25')](handleError(_0x52af9b,null));};exports[_0x7995('0x92')]=function(_0x12127d,_0x186ebe){var _0x55387b=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x93'));var _0x3ca281={'where':{'id':_0x12127d[_0x7995('0x66')]['id']},'attributes':['id',_0x7995('0x84')],'raw':!![]};return db[_0x7995('0x4e')][_0x7995('0x68')](_0x3ca281)[_0x7995('0x1d')](handleEntityNotFound(_0x186ebe,null))[_0x7995('0x1d')](function(_0x5e08fa){if(_0x5e08fa){if(!_[_0x7995('0x90')](_0x5e08fa['agentAvatar'])){if(fs[_0x7995('0x94')](path[_0x7995('0x8a')](config[_0x7995('0x8b')],'server/files/images/avatars/',_0x5e08fa['agentAvatar']))){_0x55387b=path[_0x7995('0x8a')](config[_0x7995('0x8b')],'server/files/images/avatars/',_0x5e08fa[_0x7995('0x84')]);}}return _0x186ebe['download'](_0x55387b);}})[_0x7995('0x25')](handleError(_0x186ebe,null));};exports[_0x7995('0x95')]=function(_0x27b1c2,_0x4e5667){var _0x5897df=path['join'](config[_0x7995('0x8b')],_0x7995('0x96'));var _0x365318={'where':{'id':_0x27b1c2[_0x7995('0x66')]['id']},'attributes':['id','customerAvatar',_0x7995('0x97')],'raw':!![]};return db[_0x7995('0x4e')][_0x7995('0x68')](_0x365318)[_0x7995('0x1d')](handleEntityNotFound(_0x4e5667,null))[_0x7995('0x1d')](function(_0x5104bf){if(_0x5104bf){if(!_['isNil'](_0x5104bf['customerAvatar'])){if(fs[_0x7995('0x94')](path[_0x7995('0x8a')](config['root'],_0x7995('0x98'),_0x5104bf['customerAvatar']))&&_0x5104bf[_0x7995('0x97')]){_0x5897df=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x98'),_0x5104bf['customerAvatar']);}}return _0x4e5667[_0x7995('0x99')](_0x5897df);}})[_0x7995('0x25')](handleError(_0x4e5667,null));};exports[_0x7995('0x9a')]=function(_0x1d7866,_0x2023a7){var _0x197adc=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x9b'));var _0x32e5f6={'where':{'id':_0x1d7866[_0x7995('0x66')]['id']},'attributes':['id',_0x7995('0x88')],'raw':!![]};return db[_0x7995('0x4e')][_0x7995('0x68')](_0x32e5f6)['then'](handleEntityNotFound(_0x2023a7,null))[_0x7995('0x1d')](function(_0x58e0c0){if(_0x58e0c0){if(!_[_0x7995('0x90')](_0x58e0c0[_0x7995('0x88')])){if(fs['existsSync'](path[_0x7995('0x8a')](config['root'],_0x7995('0x98'),_0x58e0c0[_0x7995('0x88')]))){_0x197adc=path['join'](config['root'],'server/files/images/avatars/',_0x58e0c0[_0x7995('0x88')]);}}return _0x2023a7[_0x7995('0x99')](_0x197adc);}})[_0x7995('0x25')](handleError(_0x2023a7,null));};function checkWebsiteInterval(_0x2b7bc2){var _0x566b48=_0x2b7bc2[_0x7995('0x9c')];if(!_0x566b48){return Promise[_0x7995('0x9d')](_0x2b7bc2);}var _0xc81297=_0x2b7bc2[_0x7995('0x9e')]||undefined;return _0x566b48[_0x7995('0x9f')](_0xc81297)[_0x7995('0x1d')](function(_0x3e8479){if(!_0x3e8479){throw new APIOutOfIntervalError();}return _0x2b7bc2;});}exports[_0x7995('0xa0')]=function(_0x47f0d9,_0x2e93a9){var _0x5e12c4={'body':_0x47f0d9[_0x7995('0x6a')],'channel':_0x7995('0xa1')};var _0x51ee98=[];var _0x3e90a5=[];var _0x3a2958={};var _0x448faa=![];if(_0x47f0d9[_0x7995('0x6a')]['id']){delete _0x47f0d9[_0x7995('0x6a')]['id'];}if(_[_0x7995('0x90')](_0x47f0d9['body'][_0x7995('0xa2')])){throw new APIBadRequestError(_0x7995('0xa3'));}if(_[_0x7995('0x90')](_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa4')])){throw new APIBadRequestError(_0x7995('0xa5'));}if(_[_0x7995('0xa6')](_0x47f0d9[_0x7995('0x6a')][_0x7995('0x6a')])){throw new APIBadRequestError(_0x7995('0xa7'));}var _0x370e25=_0x47f0d9[_0x7995('0x6a')][_0x7995('0x38')]&&_0x47f0d9[_0x7995('0x6a')][_0x7995('0x40')];return db[_0x7995('0xa8')][_0x7995('0x76')]()[_0x7995('0x1d')](function(_0x40c06b){if(!_0x40c06b){throw new Error(_0x7995('0xa9'));}_0x51ee98=Object[_0x7995('0x52')](_0x40c06b)['filter'](function(_0x4cf7f1){return![_0x7995('0xaa'),_0x7995('0xab')]['includes'](_0x4cf7f1);});_0x3e90a5=Object[_0x7995('0x52')](_0x40c06b)['filter'](function(_0x2ce103){return!['createdAt',_0x7995('0xab'),_0x7995('0xac'),_0x7995('0xad')][_0x7995('0xae')](_0x2ce103);});if(!_[_0x7995('0xae')](_0x3e90a5,_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa4')])){throw new APIBadRequestError(_0x7995('0xaf')+_0x3e90a5[_0x7995('0x8a')](',\x20'));}_0x3a2958[_0x47f0d9[_0x7995('0x6a')]['mapKey']]=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa2')];})[_0x7995('0x1d')](function(){return db[_0x7995('0x4e')]['find']({'where':{'id':_0x47f0d9[_0x7995('0x66')]['id']},'include':[{'model':db[_0x7995('0xb0')],'as':_0x7995('0xb1'),'include':[{'model':db[_0x7995('0xa8')],'as':'Contacts','where':_0x3a2958,'limit':0x1,'order':[[_0x7995('0xab'),_0x7995('0xb2')]]}]},{'model':db[_0x7995('0xb3')],'as':_0x7995('0xb4')},{'model':db[_0x7995('0x9c')],'as':_0x7995('0x9c'),'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xb5'),'attributes':['id',_0x7995('0xb6')],'raw':!![]}]}]});})['then'](function(_0x3c81cc){if(!_0x3c81cc){throw new APINotFoundError(util['format'](_0x7995('0xb7'),_0x47f0d9[_0x7995('0x66')]['id']));}if(_0x370e25){return checkWebsiteInterval(_0x3c81cc);}return _0x3c81cc;})[_0x7995('0x1d')](function(_0x19fa6d){_0x5e12c4['account']=_0x19fa6d;_0x5e12c4[_0x7995('0xb8')]=_[_0x7995('0xb9')](_0x19fa6d[_0x7995('0xb4')],[_0x7995('0xba')],[_0x7995('0xbb')]);if(_0x5e12c4[_0x7995('0xbc')][_0x7995('0xb4')]){delete _0x5e12c4[_0x7995('0xbc')][_0x7995('0xb4')];}_0x5e12c4[_0x7995('0xbd')]=_0x19fa6d[_0x7995('0xb1')]||{'id':_0x19fa6d[_0x7995('0xad')]};if(_0x5e12c4[_0x7995('0xbd')]&&_0x5e12c4[_0x7995('0xbd')]['Contacts']['length']){return _0x5e12c4[_0x7995('0xbd')][_0x7995('0xbe')][0x0];}var _0xceb704=_['defaults'](_0x47f0d9[_0x7995('0x6a')],{'firstName':_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa2')],'ListId':_0x19fa6d['ListId']});_0xceb704[_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa4')]]=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa2')];return db[_0x7995('0xa8')][_0x7995('0x69')](_0xceb704,{'fields':_0x51ee98,'raw':!![]});})[_0x7995('0x1d')](function(_0x503d2b){_0x5e12c4[_0x7995('0xbf')]=_0x503d2b;var _0x3e28b6=createInteractionObject(_0x47f0d9[_0x7995('0x66')]['id'],_0x47f0d9['body'],_0x47f0d9['headers'],_0x503d2b);var _0x23e2c8={'ChatWebsiteId':_0x47f0d9['params']['id']};if(_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc0')]){_0x23e2c8[_0x7995('0xc0')]=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc0')];_0x23e2c8['closed']=![];return db['ChatInteraction'][_0x7995('0x68')]({'where':_0x23e2c8})[_0x7995('0x1d')](function(_0x1475f8){var _0x1eacbf=_0x47f0d9[_0x7995('0x6a')][_0x7995('0x38')]&&_0x47f0d9[_0x7995('0x6a')][_0x7995('0x40')];if(_0x1475f8){_0x448faa=!![];return _0x1475f8;}else if(!_0x1eacbf&&_0x1475f8&&_0x1475f8[_0x7995('0xc1')]){throw new APIConflictError(_0x7995('0xc2'));}_0x3e28b6['threadId']=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc0')];_0x3e28b6[_0x7995('0xc3')]=_0x47f0d9[_0x7995('0x6a')]['externalUrl'];return db['ChatInteraction']['create'](_0x3e28b6);});}_0x23e2c8['ContactId']=_0x503d2b['id'];if(_0x47f0d9['body'][_0x7995('0xc4')]&&_0x47f0d9['body']['interaction']['id']){_0x23e2c8['id']=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc4')]['id'];return db[_0x7995('0xc5')]['find']({'where':_0x23e2c8})[_0x7995('0x1d')](function(_0x4f008a){var _0x39dff0=_0x47f0d9[_0x7995('0x6a')][_0x7995('0x38')]&&_0x47f0d9['body'][_0x7995('0x40')];if(!_0x39dff0&&_0x4f008a&&_0x4f008a[_0x7995('0xc1')]){throw new APIConflictError(_0x7995('0xc2'));}else if(_0x4f008a){_0x448faa=!![];return _0x4f008a;}else{return db['ChatInteraction'][_0x7995('0x69')](_0x3e28b6);}});}return db[_0x7995('0xc5')][_0x7995('0x69')](_0x3e28b6);})[_0x7995('0x1d')](function(_0x17fbde){if(!_0x448faa){return _0x17fbde;}var _0x574e2a={'from':(_0x5e12c4[_0x7995('0xbf')][_0x7995('0x3d')]||'')+'\x20'+(_0x5e12c4[_0x7995('0xbf')]['lastName']||'')};if(_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc0')]&&_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc6')]&&_0x47f0d9[_0x7995('0x6a')]['threadId']!=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc6')]){_0x574e2a[_0x7995('0xc0')]=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc6')];}return _0x17fbde[_0x7995('0x2e')](_0x574e2a);})[_0x7995('0x1d')](function(_0x5baca7){_0x5e12c4['interaction']=_0x5baca7[_0x7995('0x70')]({'plain':!![]});_0x5e12c4[_0x7995('0xc4')]['created']=!_0x448faa;if(_0x5e12c4['interaction'][_0x7995('0xc7')]){if(_0x5e12c4[_0x7995('0xbc')][_0x7995('0xc8')]){_0x5e12c4[_0x7995('0xb8')][_0x7995('0xc9')]({'id':0x0,'priority':_0x5e12c4[_0x7995('0xb8')][_0x7995('0x57')]+0x1,'app':'close','appdata':_0x7995('0xca'),'interval':_0x7995('0xcb')});}}return db[_0x7995('0xcc')][_0x7995('0x69')]({'body':_0x47f0d9[_0x7995('0x6a')][_0x7995('0x6a')],'ChatWebsiteId':_0x47f0d9['params']['id'],'ChatInteractionId':_0x5baca7['id'],'direction':'in','ContactId':_0x5e12c4[_0x7995('0xbf')]['id'],'AttachmentId':_0x47f0d9[_0x7995('0x6a')][_0x7995('0xcd')]});})[_0x7995('0x1d')](function(_0x13c918){_0x5e12c4[_0x7995('0x23')]=_0x13c918;if(!_0x5e12c4[_0x7995('0xc4')]['UserId']){return;}return db[_0x7995('0xce')][_0x7995('0x68')]({'attributes':['id',_0x7995('0x32')],'where':{'id':_0x5e12c4[_0x7995('0xc4')]['UserId']}});})[_0x7995('0x1d')](function(_0x5c9894){if(_0x5c9894){_0x5e12c4[_0x7995('0xb8')][_0x7995('0xcf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5c9894['name']+','+(_0x5e12c4['account'][_0x7995('0xd0')]||0xa),'interval':_0x7995('0xcb')});_0x5e12c4[_0x7995('0xd1')]=!![];}if(!_0x5e12c4[_0x7995('0xc4')][_0x7995('0xd2')]){return;}return db[_0x7995('0xd3')][_0x7995('0x68')]({'attributes':['id',_0x7995('0x32')],'where':{'id':_0x5e12c4[_0x7995('0xc4')][_0x7995('0xd2')]}});})[_0x7995('0x1d')](function(_0x233f44){if(_0x233f44){_0x5e12c4['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x7995('0xd4'),'appdata':_0x233f44['name']+','+(_0x5e12c4['account'][_0x7995('0xd5')]||0x12c),'interval':_0x7995('0xcb')});}return respondWithRpcPromise(_0x7995('0xd6'),_0x7995('0xd7'),_0x5e12c4);})[_0x7995('0x1d')](function(_0x29b1cd){respondWithRpcPromise(_0x7995('0xd8'),_0x7995('0xd8'),{'event':_0x7995('0xa0'),'message':_0x29b1cd},client9002);return _0x29b1cd;})[_0x7995('0x1d')](respondWithResult(_0x2e93a9,null))[_0x7995('0x25')](APIHandleError(_0x2e93a9));};exports[_0x7995('0xd9')]=function(_0x511628,_0x3ad9ff){var _0x1a4919,_0x39f3d9,_0x2ec6c9;var _0x2ace90=[];var _0x17570a={};var _0x360022=_0x511628['files']||[];var _0x88334d=[];var _0x234832;return db[_0x7995('0xa8')][_0x7995('0x76')]()[_0x7995('0x1d')](function(_0x53a7a4){if(!_0x53a7a4){throw new db[(_0x7995('0xda'))]['ValidationError'](_0x7995('0xdb'));}_0x2ace90=_[_0x7995('0xdc')](_[_0x7995('0x52')](_0x53a7a4),['createdAt',_0x7995('0xab'),_0x7995('0xac'),_0x7995('0xad')]);if(_0x511628[_0x7995('0x6a')]['id']){delete _0x511628[_0x7995('0x6a')]['id'];}if(_[_0x7995('0x90')](_0x511628[_0x7995('0x6a')]['from'])){throw _0x3ad9ff['status'](0x1f4)[_0x7995('0x33')](new db[(_0x7995('0xda'))][(_0x7995('0xdd'))](_0x7995('0xde')));}if(_[_0x7995('0x90')](_0x511628[_0x7995('0x6a')]['body'])||_0x511628[_0x7995('0x6a')][_0x7995('0x6a')]===''){throw _0x3ad9ff[_0x7995('0x27')](0x1f4)[_0x7995('0x33')](new db['Sequelize']['ValidationError'](_0x7995('0xdf')));}if(_[_0x7995('0x90')](_0x511628['body'][_0x7995('0xe0')])){throw _0x3ad9ff[_0x7995('0x27')](0x1f4)['send'](new db[(_0x7995('0xda'))][(_0x7995('0xdd'))](_0x7995('0xe1')+_0x2ace90));}if(!_[_0x7995('0xae')](_0x2ace90,_0x511628[_0x7995('0x6a')]['mapKeyOffline'])){throw _0x3ad9ff['status'](0x1f4)[_0x7995('0x33')](new db[(_0x7995('0xda'))][(_0x7995('0xdd'))](_0x7995('0xe2')+_0x2ace90));}_0x17570a[_0x511628[_0x7995('0x6a')]['mapKeyOffline']]=_0x511628[_0x7995('0x6a')][_0x7995('0xa2')];})[_0x7995('0x1d')](function(){return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x511628['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0x7995('0xe3')}]});})[_0x7995('0x1d')](handleEntityNotFound(_0x3ad9ff,null))['then'](function(_0x382bd9){if(_0x382bd9&&_0x382bd9[_0x7995('0xb1')]){_0x39f3d9=_0x382bd9;var _0x5e8551=_['defaults'](_0x511628[_0x7995('0x6a')],{'firstName':_0x511628[_0x7995('0x6a')][_0x7995('0xa2')],'phone':_0x511628[_0x7995('0x6a')][_0x7995('0xa2')],'ListId':_0x382bd9[_0x7995('0xad')]});_0x5e8551[_0x511628[_0x7995('0x6a')]['mapKeyOffline']]=_0x511628['body'][_0x7995('0xa2')];return db[_0x7995('0xa8')][_0x7995('0xe4')]({'where':_0x17570a,'defaults':_0x5e8551});}})['spread'](function(_0x2f96fd){if(_0x2f96fd){_0x2ec6c9=_0x2f96fd;var _0x39cc1a=fs[_0x7995('0xe5')](path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0xe6')),_0x7995('0xe7'));var _0x1b4cab=ejs[_0x7995('0xe8')](_0x39cc1a,{'body':_['toPairs'](_0x511628['body'][_0x7995('0x6a')]),'bodyTitle':_0x39f3d9['offlineMessageBody']});return db[_0x7995('0xe9')]['create']({'body':_0x1b4cab,'plainBody':htmlToText[_0x7995('0xea')](_0x1b4cab),'ContactId':_0x2f96fd['id'],'ChatWebsiteId':_0x39f3d9['id']});}})[_0x7995('0x1d')](function(_0x2ab61c){_0x234832=_0x2ab61c;if(_0x360022['length']){var _0x4c810d=_0x360022[_0x7995('0x51')](function(_0xff0ee8){return{'name':_0xff0ee8[_0x7995('0xeb')],'basename':_0xff0ee8[_0x7995('0x82')],'type':_0xff0ee8[_0x7995('0xec')],'ChatOfflineMessageId':_0x2ab61c['id']};});_0x88334d=_0x4c810d[_0x7995('0x51')](_0xb0164a=>{var _0x294b73={'filename':_0xb0164a[_0x7995('0x32')],'path':path[_0x7995('0x8a')](config[_0x7995('0x8b')],'server',_0x7995('0xed'),_0x7995('0xee'),_0x7995('0xef'),_0xb0164a[_0x7995('0xf0')])};return _0x294b73;});if(!_0x39f3d9[_0x7995('0xf1')]){return db['sequelize'][_0x7995('0xf2')](function(_0x44068f){return db[_0x7995('0xf3')][_0x7995('0xf4')](_0x4c810d,{'transaction':_0x44068f});});}}})[_0x7995('0x1d')](function(){if(_0x234832){_0x1a4919=_0x234832;return db[_0x7995('0xe3')][_0x7995('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0x7995('0xf5')],'as':_0x7995('0xf6'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x7995('0x1d')](function(_0x127b80){if(_0x127b80&&_0x127b80[_0x7995('0xf6')]&&_0x39f3d9[_0x7995('0xf7')]&&_0x39f3d9[_0x7995('0xf8')]){var _0x498d7c=_0x127b80[_0x7995('0xf9')]();return respondWithRpcPromise(_0x7995('0xfa'),_0x7995('0xfb'),{'account':_0x498d7c,'message':{'from':util[_0x7995('0x45')](_0x7995('0xfc'),_0x127b80[_0x7995('0x32')],_0x127b80[_0x7995('0xfd')]||_0x127b80[_0x7995('0xf6')][_0x7995('0x71')]),'to':_0x39f3d9['forwardOfflineAddress'],'subject':_0x39f3d9['offlineMessageSubject'],'html':_0x1a4919[_0x7995('0x6a')],'attachments':_0x88334d}},client9003)[_0x7995('0x1d')](function(){return _0x1a4919;})[_0x7995('0x25')](function(_0x296643){logger[_0x7995('0x21')](_0x296643);});}})[_0x7995('0x1d')](function(){if(_0x39f3d9&&_0x39f3d9[_0x7995('0xf1')]&&_0x39f3d9[_0x7995('0xfe')]){var _0x5f100f=[];if(_0x360022['length']){_0x5f100f=_0x360022[_0x7995('0x51')](function(_0x386081){return{'name':_0x386081[_0x7995('0xeb')],'basename':_0x386081[_0x7995('0x82')],'type':_0x386081['mimetype'],'ChatOfflineMessageId':_0x234832['id']};});}var _0x580476;if(!_[_0x7995('0x90')](_0x39f3d9[_0x7995('0xff')])){var _0x2c8cd6=_[_0x7995('0x51')](_0x511628[_0x7995('0x6a')],function(_0x166566){return _0x166566;});var _0x127b5b=_[_0x7995('0x100')](_0x2c8cd6)[0x0];var _0x273283=_[_0x7995('0x101')](_0x127b5b,function(_0x1c2899){return _0x1c2899;});_0x580476=_0x273283[0x1][_0x39f3d9[_0x7995('0xff')]];}var _0x56809d={'from':_0x2ec6c9['email'],'firstName':_0x2ec6c9[_0x7995('0x3d')],'lastName':_0x2ec6c9[_0x7995('0x3e')],'mapKey':_0x7995('0xfd'),'message':{'from':_0x2ec6c9[_0x7995('0xfd')],'to':_0x39f3d9['MailAccount'][_0x7995('0xfd')],'cc':'','subject':_['isNil'](_0x580476)?_0x39f3d9[_0x7995('0x102')]:_0x580476,'messageId':'','sentAt':new Date(),'attach':_0x5f100f[_0x7995('0x57')],'attachments':_0x5f100f,'originChannel':_0x7995('0x103'),'ChatWebsiteId':_0x39f3d9['id'],'ChatOfflineMessageId':_0x1a4919['id'],'originTo':_0x39f3d9[_0x7995('0xe3')][_0x7995('0xfd')]},'body':_0x1a4919[_0x7995('0x6a')]};var _0x570408={'account':{'id':_0x39f3d9[_0x7995('0xfe')]},'body':_0x56809d,'log':_0x7995('0x104')};return respondWithRpcPromise(_0x7995('0x104'),_0x7995('0x105'),_0x570408,client9001)['then'](function(){return _0x1a4919;})['catch'](function(_0x43b9d6){logger[_0x7995('0x21')](_0x43b9d6);});}return;})[_0x7995('0x1d')](function(){if(_0x1a4919){return _0x1a4919;}})[_0x7995('0x1d')](respondWithResult(_0x3ad9ff,null))['catch'](function(){for(var _0x2958e9 of _0x360022){var _0x4e72=path[_0x7995('0x8a')](config['root'],_0x7995('0x106'),_0x7995('0xed'),_0x7995('0xee'),'offline-chat',_0x2958e9[_0x7995('0x82')]);fs_extra[_0x7995('0x107')](_0x4e72)[_0x7995('0x25')](function(_0x36778f){logger[_0x7995('0x21')](_0x7995('0x108'),_0x4e72,_0x36778f);});}});};exports[_0x7995('0x109')]=function(_0x2c8459,_0x3a285b){return db['ChatInteraction'][_0x7995('0x68')]({'where':{'id':_0x2c8459[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x3a285b,null))[_0x7995('0x1d')](function(_0x5eb18f){if(_0x5eb18f){return _0x5eb18f[_0x7995('0x109')](_0x2c8459[_0x7995('0x6a')][_0x7995('0x80')],_[_0x7995('0x10a')](_0x2c8459['body'],[_0x7995('0x80'),'id'])||{});}})[_0x7995('0x1d')](respondWithResult(_0x3a285b,null))[_0x7995('0x25')](handleError(_0x3a285b,null));};exports[_0x7995('0x10b')]=function(_0x3c711e,_0x126d6e){var _0x31dae8={'raw':![],'where':{}};var _0x5e3421={};var _0x1a4089={'count':0x0,'rows':[]};return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x3c711e[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x126d6e,null))['then'](function(_0x1f915b){if(_0x1f915b){_0x5e3421['model']=_[_0x7995('0x52')](db[_0x7995('0xc5')][_0x7995('0x4f')]);_0x5e3421['query']=_['keys'](_0x3c711e['query']);_0x5e3421[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x5e3421[_0x7995('0x49')],_0x5e3421[_0x7995('0x53')]);_0x31dae8[_0x7995('0x55')]=_[_0x7995('0x54')](_0x5e3421['model'],qs[_0x7995('0x56')](_0x3c711e[_0x7995('0x53')][_0x7995('0x56')]));_0x31dae8[_0x7995('0x55')]=_0x31dae8['attributes'][_0x7995('0x57')]?_0x31dae8[_0x7995('0x55')]:_0x5e3421['model'];if(!_0x3c711e[_0x7995('0x53')]['hasOwnProperty'](_0x7995('0x59'))){_0x31dae8[_0x7995('0x2a')]=qs[_0x7995('0x2a')](_0x3c711e['query']['limit']);_0x31dae8[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x3c711e[_0x7995('0x53')][_0x7995('0x2b')]);}_0x31dae8[_0x7995('0x5a')]=qs[_0x7995('0x5b')](_0x3c711e[_0x7995('0x53')][_0x7995('0x5b')]);_0x31dae8[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_[_0x7995('0x5d')](_0x3c711e['query'],_0x5e3421['filters']));_0x31dae8[_0x7995('0x5c')][_0x7995('0x7d')]=_0x1f915b['id'];if(_0x3c711e[_0x7995('0x53')][_0x7995('0x60')]){_0x31dae8['where']=_['merge'](_0x31dae8[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0x31dae8['attributes'],function(_0x4d0036){var _0x952d6c={};_0x952d6c[_0x4d0036]={'$like':'%'+_0x3c711e[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x952d6c;})});}_0x31dae8=_[_0x7995('0x61')]({},_0x31dae8,_0x3c711e[_0x7995('0x62')]);return db['ChatInteraction'][_0x7995('0x2c')]({'where':_0x31dae8[_0x7995('0x5c')]})['then'](function(_0xf9859c){_0x1a4089[_0x7995('0x2c')]=_0xf9859c;if(_0x3c711e[_0x7995('0x53')]['includeAll']){_0x31dae8[_0x7995('0x63')]=[{'model':db[_0x7995('0xa8')],'as':_0x7995('0x10c'),'required':![]},{'model':db[_0x7995('0xce')],'as':_0x7995('0x10d'),'attributes':['name','fullname',_0x7995('0x10e')],'required':![]},{'model':db['Tag'],'as':_0x7995('0x10f'),'attributes':['id','name',_0x7995('0x110')],'where':_0x3c711e[_0x7995('0x53')][_0x7995('0x111')]?{'id':_0x3c711e['query']['tag']}:undefined,'required':_0x3c711e['query'][_0x7995('0x111')]?!![]:![]}];}return db[_0x7995('0xc5')][_0x7995('0x64')](_0x31dae8);})['then'](function(_0x2a9738){_0x1a4089[_0x7995('0x7b')]=_0x2a9738;return _0x1a4089;});}})['then'](respondWithFilteredResult(_0x126d6e,_0x31dae8))[_0x7995('0x25')](handleError(_0x126d6e,null));};exports[_0x7995('0x112')]=function(_0x34350f,_0x108aeb){var _0x3a9c19=0x0;var _0x4b3aa3=0x0;var _0x5a6bb5=![];var _0x19cdd8;var _0x2d72c2;return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x34350f[_0x7995('0x66')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0x9c'),'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xb5'),'attributes':['id',_0x7995('0xb6')]}]}]})['then'](handleEntityNotFound(_0x108aeb,null))[_0x7995('0x1d')](function(_0x1faf9b){if(_0x1faf9b){_0x19cdd8=_0x1faf9b;return _0x1faf9b[_0x7995('0x113')]({'raw':!![]});}})[_0x7995('0x1d')](function(_0x39ee00){if(_0x19cdd8){if(_0x39ee00){_0x2d72c2=_0x39ee00;}}return require(_0x7995('0x8e'))[_0x7995('0x114')]();})['then'](function(_0x5d0fe6){if(_0x5d0fe6){_0x4b3aa3=_0x5d0fe6[_0x7995('0x115')];_0x5a6bb5=_0x5d0fe6[_0x7995('0x8f')];}})[_0x7995('0x1d')](function(){return db[_0x7995('0xc5')]['count']({'where':{'closed':![]}});})['then'](function(_0x4b477a){_0x3a9c19=_0x4b477a;if(_0x4b3aa3&&_0x4b477a>_0x4b3aa3){return db[_0x7995('0x116')][_0x7995('0x7a')]({'where':{'id':0x1}})['then'](function(_0x3f908e){if(_0x3f908e){_0x3f908e[_0x7995('0x117')](_0x7995('0x118'));}});}})[_0x7995('0x1d')](function(){var _0x13fc64=_0x19cdd8[_0x7995('0x9c')];var _0x35229d=_0x19cdd8[_0x7995('0x9e')]||undefined;return _0x13fc64?_0x13fc64['ifTime'](_0x35229d):!![];})[_0x7995('0x1d')](function(_0x13d525){var _0x37b7e7=fs['readFileSync'](path[_0x7995('0x8a')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x507bf3=_0x7995('0x119');var _0x4c64a8=![];var _0x296af1,_0x2e1466;if(_0x34350f['headers'][_0x7995('0x40')]){_0x296af1=new URL(_0x34350f[_0x7995('0x11a')][_0x7995('0x40')])[_0x7995('0x11b')];}else if(_0x34350f['headers'][_0x7995('0x11b')]){_0x296af1=new URL(_0x34350f['headers'][_0x7995('0x11b')])[_0x7995('0x11b')];}else{_0x296af1=_0x7995('0x11c');}_0x2e1466=typeof _0x19cdd8[_0x7995('0x6b')][_0x7995('0x3c')](',')[_0x7995('0x68')](function(_0x30d2af){return wildcardUtils[_0x7995('0x11d')](_0x30d2af,_0x296af1);})!==_0x7995('0x29');var _0x281839={'chatVersion':_0x507bf3,'chatWebsiteAddressOrigin':_0x2e1466?_0x296af1:_0x19cdd8['address'],'remote':_0x19cdd8[_0x7995('0x11e')],'query':querystring[_0x7995('0x11f')](_['merge'](_0x19cdd8[_0x7995('0x70')]({'plain':!![]}),{'customerIp':_0x34350f[_0x7995('0x11a')][_0x7995('0x3a')]||_0x34350f[_0x7995('0x11a')][_0x7995('0x120')]||_0x34350f[_0x7995('0x121')]['remoteAddress']||_0x34350f['ip'],'referer':_0x34350f[_0x7995('0x11a')]['referer'],'openedInteractions':_0x3a9c19,'maxInteractions':_0x4b3aa3,'virtual':_0x5a6bb5[_0x7995('0x115')],'online':_0x13d525,'custom':_0x5a6bb5,'address':_0x2e1466?_0x296af1:null}))[_0x7995('0x122')](/'/g,'\x5c\x27')};_0x108aeb[_0x7995('0x33')](ejs[_0x7995('0xe8')](Mustache[_0x7995('0xe8')](_0x37b7e7,_0x281839),{'proactiveActions':_0x2d72c2,'alignment':_0x19cdd8[_0x7995('0x123')],'verticalAlignment':_0x19cdd8['verticalAlignment'],'div_color':_0x19cdd8[_0x7995('0x110')],'labelText':_0x19cdd8[_0x7995('0x124')],'text_color':_0x19cdd8[_0x7995('0x125')],'text_button_color':_0x19cdd8['textButtonColor'],'button_color':_0x19cdd8[_0x7995('0x126')],'background_color':_0x19cdd8[_0x7995('0x127')],'hideWhenOffline':_0x19cdd8[_0x7995('0x128')],'intervalId':_0x19cdd8[_0x7995('0x129')],'isDevelopment':_0x4c64a8,'chatVersion':_0x507bf3}));})[_0x7995('0x25')](handleError(_0x108aeb,null));};exports[_0x7995('0x12a')]=function(_0x346f52,_0x204974){var _0x2c10fd=_0x346f52[_0x7995('0x66')]['id'];var _0xaafd4=_0x346f52['body'];var _0x125233=0xc8;var _0x131fdc=null;return db['sequelize'][_0x7995('0xf2')]({'isolationLevel':db[_0x7995('0x12b')][_0x7995('0x12c')][_0x7995('0x12d')][_0x7995('0x12e')]},function(_0x5a5cc4){return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x2c10fd},'transaction':_0x5a5cc4})[_0x7995('0x1d')](function(_0x2da304){if(_0x2da304){return db[_0x7995('0xb3')][_0x7995('0x2f')]({'where':{'ChatWebsiteId':_0x2c10fd},'transaction':_0x5a5cc4})[_0x7995('0x1d')](function(){var _0x3404a1=_[_0x7995('0x51')](_0xaafd4,function(_0x363e3b){_0x363e3b[_0x7995('0x7d')]=_0x2c10fd;return _0x363e3b;});return db[_0x7995('0xb3')][_0x7995('0xf4')](_0x3404a1,{'transaction':_0x5a5cc4});});}else{_0x125233=0x194;_0x131fdc=[];}});})['then'](function(){if(_0x125233!==0x194){return db[_0x7995('0xb3')][_0x7995('0x12f')]({'where':{'ChatWebsiteId':_0x2c10fd},'order':_0x7995('0xba')})[_0x7995('0x1d')](function(_0x4f9d28){_0x131fdc=_0x4f9d28;});}})[_0x7995('0x25')](function(_0x1d07e2){_0x125233=0x1f4;logger[_0x7995('0x21')](_0x1d07e2[_0x7995('0x130')]);if(_0x1d07e2[_0x7995('0x32')]){delete _0x1d07e2[_0x7995('0x32')];}_0x131fdc=_0x1d07e2;})[_0x7995('0x131')](function(){if(_0x131fdc===null){_0x204974['sendStatus'](_0x125233);}else{if(_0x125233===0x1f4){_0x204974[_0x7995('0x27')](_0x125233)['send'](_0x131fdc);}else{_0x204974[_0x7995('0x27')](_0x125233)[_0x7995('0x28')](_0x131fdc);}}});};exports[_0x7995('0x132')]=function(_0x491694,_0x4d13c0){var _0x26c46c={};var _0x2802cf={};var _0x4071bf;var _0x54a8ac;return db[_0x7995('0x4e')]['findOne']({'where':{'id':_0x491694[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x4d13c0,null))[_0x7995('0x1d')](function(_0x35ee8c){if(_0x35ee8c){_0x4071bf=_0x35ee8c;_0x2802cf[_0x7995('0x49')]=_[_0x7995('0x52')](db['ChatApplication'][_0x7995('0x4f')]);_0x2802cf[_0x7995('0x53')]=_['keys'](_0x491694[_0x7995('0x53')]);_0x2802cf[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x2802cf[_0x7995('0x49')],_0x2802cf[_0x7995('0x53')]);_0x26c46c[_0x7995('0x55')]=_[_0x7995('0x54')](_0x2802cf[_0x7995('0x49')],qs[_0x7995('0x56')](_0x491694[_0x7995('0x53')][_0x7995('0x56')]));_0x26c46c[_0x7995('0x55')]=_0x26c46c[_0x7995('0x55')][_0x7995('0x57')]?_0x26c46c[_0x7995('0x55')]:_0x2802cf[_0x7995('0x49')];_0x26c46c[_0x7995('0x5a')]=qs['sort'](_0x491694['query'][_0x7995('0x5b')]);_0x26c46c[_0x7995('0x5c')]=qs['filters'](_[_0x7995('0x5d')](_0x491694[_0x7995('0x53')],_0x2802cf['filters']));if(_0x491694['query'][_0x7995('0x60')]){_0x26c46c[_0x7995('0x5c')]=_[_0x7995('0x61')](_0x26c46c[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0x26c46c[_0x7995('0x55')],function(_0x1b3920){var _0x3212a3={};_0x3212a3[_0x1b3920]={'$like':'%'+_0x491694[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x3212a3;})});}_0x26c46c=_['merge']({},_0x26c46c,_0x491694[_0x7995('0x62')]);return _0x4071bf[_0x7995('0x132')](_0x26c46c);}})[_0x7995('0x1d')](function(_0x16df00){if(_0x16df00){_0x54a8ac=_0x16df00[_0x7995('0x57')];if(!_0x491694[_0x7995('0x53')][_0x7995('0x58')]('nolimit')){_0x26c46c[_0x7995('0x2a')]=qs[_0x7995('0x2a')](_0x491694[_0x7995('0x53')]['limit']);_0x26c46c[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x491694[_0x7995('0x53')][_0x7995('0x2b')]);}return _0x4071bf[_0x7995('0x132')](_0x26c46c);}})[_0x7995('0x1d')](function(_0x5dc448){if(_0x5dc448){return _0x5dc448?{'count':_0x54a8ac,'rows':_0x5dc448}:null;}})[_0x7995('0x1d')](respondWithResult(_0x4d13c0,null))['catch'](handleError(_0x4d13c0,null));};exports[_0x7995('0x133')]=function(_0x226991,_0x36f8a1){return db['chatProactiveAction']['find']({'where':{'id':_0x226991[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x36f8a1,null))[_0x7995('0x1d')](function(_0x586439){if(_0x586439){return _0x586439[_0x7995('0x133')](_0x226991[_0x7995('0x6a')][_0x7995('0x80')],_[_0x7995('0x10a')](_0x226991[_0x7995('0x6a')],['ids','id'])||{});}})[_0x7995('0x1d')](respondWithResult(_0x36f8a1,null))[_0x7995('0x25')](handleError(_0x36f8a1,null));};exports[_0x7995('0x113')]=function(_0x24d374,_0x132c1a){var _0x3366f7={};var _0x3e452b={};var _0x2436d7;var _0x4b9dd3;return db['ChatWebsite'][_0x7995('0x7a')]({'where':{'id':_0x24d374['params']['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x132c1a,null))[_0x7995('0x1d')](function(_0x47659d){if(_0x47659d){_0x2436d7=_0x47659d;_0x3e452b['model']=_['keys'](db['ChatProactiveAction'][_0x7995('0x4f')]);_0x3e452b[_0x7995('0x53')]=_[_0x7995('0x52')](_0x24d374[_0x7995('0x53')]);_0x3e452b[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x3e452b[_0x7995('0x49')],_0x3e452b[_0x7995('0x53')]);_0x3366f7['attributes']=_['intersection'](_0x3e452b['model'],qs[_0x7995('0x56')](_0x24d374['query']['fields']));_0x3366f7['attributes']=_0x3366f7[_0x7995('0x55')][_0x7995('0x57')]?_0x3366f7[_0x7995('0x55')]:_0x3e452b[_0x7995('0x49')];_0x3366f7[_0x7995('0x5a')]=qs['sort'](_0x24d374[_0x7995('0x53')]['sort']);_0x3366f7[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_[_0x7995('0x5d')](_0x24d374[_0x7995('0x53')],_0x3e452b[_0x7995('0x5e')]));if(_0x24d374[_0x7995('0x53')][_0x7995('0x60')]){_0x3366f7[_0x7995('0x5c')]=_['merge'](_0x3366f7[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0x3366f7['attributes'],function(_0x198ba5){var _0x328677={};_0x328677[_0x198ba5]={'$like':'%'+_0x24d374[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x328677;})});}_0x3366f7=_[_0x7995('0x61')]({},_0x3366f7,_0x24d374[_0x7995('0x62')]);return _0x2436d7[_0x7995('0x113')](_0x3366f7);}})[_0x7995('0x1d')](function(_0x423751){if(_0x423751){_0x4b9dd3=_0x423751['length'];if(!_0x24d374['query']['hasOwnProperty'](_0x7995('0x59'))){_0x3366f7[_0x7995('0x2a')]=qs['limit'](_0x24d374['query']['limit']);_0x3366f7[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x24d374['query'][_0x7995('0x2b')]);}return _0x2436d7[_0x7995('0x113')](_0x3366f7);}})[_0x7995('0x1d')](function(_0x349351){if(_0x349351){return _0x349351?{'count':_0x4b9dd3,'rows':_0x349351}:null;}})['then'](respondWithResult(_0x132c1a,null))[_0x7995('0x25')](handleError(_0x132c1a,null));};exports['getFields']=function(_0x463f2c,_0x47ecf5){var _0x2ea80c=_0x463f2c[_0x7995('0x53')]['online']===_0x7995('0x134')?'offlineForm':_0x7995('0x135');return db[_0x7995('0x4e')][_0x7995('0x68')]({'attributes':['id',_0x2ea80c],'where':{'id':_0x463f2c[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x47ecf5,null))[_0x7995('0x1d')](function(_0x4a27e7){if(_0x4a27e7){var _0x58aa57=_0x4a27e7[_0x2ea80c];var _0x5b4201=_0x58aa57&&_0x58aa57['items']?_0x58aa57[_0x7995('0x136')]:[];_0x47ecf5['send']({'fromKey':_[_0x7995('0x90')](_0x58aa57[_0x7995('0x137')])?undefined:_0x58aa57['fromKey'],'count':_0x5b4201[_0x7995('0x57')],'rows':_0x5b4201});}})['catch'](handleError(_0x47ecf5,null));};exports[_0x7995('0x138')]=function(_0x5a0510,_0x3d9091){var _0x385396={'raw':![],'where':{}};var _0x3e86a9={};var _0x219fa6={'count':0x0,'rows':[]};return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x5a0510[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x3d9091,null))[_0x7995('0x1d')](function(_0x4092e2){if(_0x4092e2){_0x3e86a9[_0x7995('0x49')]=_[_0x7995('0x52')](db[_0x7995('0xe9')][_0x7995('0x4f')]);_0x3e86a9[_0x7995('0x53')]=_[_0x7995('0x52')](_0x5a0510[_0x7995('0x53')]);_0x3e86a9['filters']=_[_0x7995('0x54')](_0x3e86a9[_0x7995('0x49')],_0x3e86a9[_0x7995('0x53')]);_0x385396['attributes']=_[_0x7995('0x54')](_0x3e86a9['model'],qs[_0x7995('0x56')](_0x5a0510[_0x7995('0x53')][_0x7995('0x56')]));_0x385396[_0x7995('0x55')]=_0x385396['attributes'][_0x7995('0x57')]?_0x385396[_0x7995('0x55')]:_0x3e86a9['model'];if(!_0x5a0510['query']['hasOwnProperty'](_0x7995('0x59'))){_0x385396[_0x7995('0x2a')]=qs['limit'](_0x5a0510[_0x7995('0x53')]['limit']);_0x385396[_0x7995('0x2b')]=qs['offset'](_0x5a0510[_0x7995('0x53')][_0x7995('0x2b')]);}_0x385396['order']=qs['sort'](_0x5a0510[_0x7995('0x53')][_0x7995('0x5b')]);_0x385396[_0x7995('0x5c')]=qs['filters'](_[_0x7995('0x5d')](_0x5a0510[_0x7995('0x53')],_0x3e86a9[_0x7995('0x5e')]));_0x385396[_0x7995('0x5c')][_0x7995('0x7d')]=_0x4092e2['id'];if(_0x5a0510[_0x7995('0x53')][_0x7995('0x60')]){_0x385396[_0x7995('0x5c')]=_[_0x7995('0x61')](_0x385396['where'],{'$or':_[_0x7995('0x51')](_0x385396[_0x7995('0x55')],function(_0x1ca931){var _0x4fb2af={};_0x4fb2af[_0x1ca931]={'$like':'%'+_0x5a0510[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x4fb2af;})});}_0x385396=_['merge']({},_0x385396,_0x5a0510['options']);return db[_0x7995('0xe9')][_0x7995('0x2c')]({'where':_0x385396['where']})[_0x7995('0x1d')](function(_0x23b296){_0x219fa6['count']=_0x23b296;if(_0x5a0510[_0x7995('0x53')][_0x7995('0x67')]){_0x385396['include']=[{'all':!![]}];}else{_0x385396[_0x7995('0x63')]=[{'model':db[_0x7995('0xa8')],'as':_0x7995('0x10c'),'required':![]},{'model':db[_0x7995('0xf3')],'as':_0x7995('0x139'),'required':![]}];}return db[_0x7995('0xe9')][_0x7995('0x64')](_0x385396);})[_0x7995('0x1d')](function(_0x3ea53f){_0x219fa6[_0x7995('0x7b')]=_0x3ea53f;return _0x219fa6;});}})[_0x7995('0x1d')](respondWithFilteredResult(_0x3d9091,_0x385396))['catch'](handleError(_0x3d9091,null));};exports[_0x7995('0x13a')]=function(_0x318bf0,_0x80caf9){return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x318bf0[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x80caf9,null))[_0x7995('0x1d')](function(_0x3f3d05){if(_0x3f3d05){return _0x3f3d05[_0x7995('0x13a')](_0x318bf0[_0x7995('0x6a')]['ids'],_[_0x7995('0x10a')](_0x318bf0['body'],['ids','id'])||{})[_0x7995('0x13b')](function(_0x39394e){for(var _0x256c33=0x0;_0x256c33<_0x318bf0['body'][_0x7995('0x80')]['length'];_0x256c33+=0x1){socket[_0x7995('0x13c')](_0x7995('0x13d'),{'UserId':Number(_0x318bf0[_0x7995('0x6a')]['ids'][_0x256c33]),'ChatWebsiteId':Number(_0x318bf0[_0x7995('0x66')]['id'])});}return _0x39394e;});}})[_0x7995('0x1d')](respondWithResult(_0x80caf9,null))['catch'](handleError(_0x80caf9,null));};exports['removeAgents']=function(_0xfae12b,_0x22750a){return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0xfae12b[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x22750a,null))[_0x7995('0x1d')](function(_0x456dc7){if(_0x456dc7){return _0x456dc7[_0x7995('0x13e')](_0xfae12b['query']['ids'])['then'](function(){if(_[_0x7995('0x13f')](_0xfae12b[_0x7995('0x53')]['ids'])){for(var _0x3a5d1f=0x0;_0x3a5d1f<_0xfae12b[_0x7995('0x53')][_0x7995('0x80')][_0x7995('0x57')];_0x3a5d1f+=0x1){socket[_0x7995('0x13c')](_0x7995('0x140'),{'UserId':Number(_0xfae12b[_0x7995('0x53')][_0x7995('0x80')][_0x3a5d1f]),'ChatWebsiteId':Number(_0xfae12b[_0x7995('0x66')]['id'])});}}else{socket[_0x7995('0x13c')](_0x7995('0x140'),{'UserId':Number(_0xfae12b[_0x7995('0x53')][_0x7995('0x80')]),'ChatWebsiteId':Number(_0xfae12b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x22750a,null))[_0x7995('0x25')](handleError(_0x22750a,null));};exports['getAgents']=function(_0x5d1bbe,_0x4d2868){var _0x465147={};var _0x3aced8={};var _0x52c6ce;var _0x440306;return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x5d1bbe['params']['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x4d2868,null))[_0x7995('0x1d')](function(_0x4a53f8){if(_0x4a53f8){_0x52c6ce=_0x4a53f8;_0x3aced8['model']=_[_0x7995('0x52')](db[_0x7995('0xce')]['rawAttributes']);_0x3aced8[_0x7995('0x53')]=_[_0x7995('0x52')](_0x5d1bbe[_0x7995('0x53')]);_0x3aced8[_0x7995('0x5e')]=_['intersection'](_0x3aced8[_0x7995('0x49')],_0x3aced8[_0x7995('0x53')]);_0x465147['attributes']=_[_0x7995('0x54')](_0x3aced8[_0x7995('0x49')],qs['fields'](_0x5d1bbe[_0x7995('0x53')][_0x7995('0x56')]));_0x465147[_0x7995('0x55')]=_0x465147[_0x7995('0x55')][_0x7995('0x57')]?_0x465147[_0x7995('0x55')]:_0x3aced8['model'];_0x465147[_0x7995('0x5a')]=qs['sort'](_0x5d1bbe[_0x7995('0x53')][_0x7995('0x5b')]);_0x465147[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_[_0x7995('0x5d')](_0x5d1bbe[_0x7995('0x53')],_0x3aced8['filters']));if(_0x5d1bbe[_0x7995('0x53')][_0x7995('0x60')]){_0x465147[_0x7995('0x5c')]=_[_0x7995('0x61')](_0x465147['where'],{'$or':_[_0x7995('0x51')](_0x465147[_0x7995('0x55')],function(_0x21a1e0){var _0x319cf9={};_0x319cf9[_0x21a1e0]={'$like':'%'+_0x5d1bbe[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x319cf9;})});}_0x465147=_[_0x7995('0x61')]({},_0x465147,_0x5d1bbe[_0x7995('0x62')]);return _0x52c6ce[_0x7995('0x141')](_0x465147);}})[_0x7995('0x1d')](function(_0x5dc2aa){if(_0x5dc2aa){_0x440306=_0x5dc2aa[_0x7995('0x57')];if(!_0x5d1bbe[_0x7995('0x53')]['hasOwnProperty'](_0x7995('0x59'))){_0x465147[_0x7995('0x2a')]=qs[_0x7995('0x2a')](_0x5d1bbe[_0x7995('0x53')][_0x7995('0x2a')]);_0x465147[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x5d1bbe['query']['offset']);}return _0x52c6ce[_0x7995('0x141')](_0x465147);}})[_0x7995('0x1d')](function(_0x2097f0){if(_0x2097f0){return _0x2097f0?{'count':_0x440306,'rows':_0x2097f0}:null;}})[_0x7995('0x1d')](respondWithResult(_0x4d2868,null))[_0x7995('0x25')](handleError(_0x4d2868,null));}; \ No newline at end of file +var _0x984b=['vendor','%s\x20%s\x20%s','type','stringify','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','address','forEach','testWildcardValidity','trim','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','sitepic','file','filename','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','server/files/images/logos/','download','getAvatar','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','mapKey','MapKey\x20is\x20mandatory','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','List','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','list','Contacts','from','CmContact','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','queueId','waitForTheAssignedQueue','Start','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','spread','server/files/templates/chatOfflineMessage.ejs','render','toPairs','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailAccount','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','getSnippet','getProactiveActions','virtual','License','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','utf8','3.13.0','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','remoteAddress','replace','alignment','color','labelText','textColor','textButtonColor','backgroundColor','IntervalId','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','ejs','fs-extra','lodash','ioredis','jayson/promise','api','../../config/environment','APIBadRequestError','../../errors/api','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','model'];(function(_0x40daf9,_0x1beebc){var _0x14446f=function(_0x492fe1){while(--_0x492fe1){_0x40daf9['push'](_0x40daf9['shift']());}};_0x14446f(++_0x1beebc);}(_0x984b,0xee));var _0xb984=function(_0x1cc9f9,_0x6bf4c5){_0x1cc9f9=_0x1cc9f9-0x0;var _0x341e9a=_0x984b[_0x1cc9f9];return _0x341e9a;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require(_0xb984('0x0'));var fs=require('fs');var fs_extra=require(_0xb984('0x1'));var _=require(_0xb984('0x2'));var querystring=require('querystring');var htmlToText=require('html-to-text');var Redis=require(_0xb984('0x3'));var jayson=require(_0xb984('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb984('0x5'));var config=require(_0xb984('0x6'));var APIBadRequestError=require('../../errors/api')[_0xb984('0x7')];var APINotFoundError=require(_0xb984('0x8'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xb984('0x8'))['APIOutOfIntervalError'];var APIHandleError=require(_0xb984('0x8'))[_0xb984('0x9')];var APIConflictError=require(_0xb984('0x8'))[_0xb984('0xa')];var wildcardUtils=require(_0xb984('0xb'));var URL=require(_0xb984('0xc'))[_0xb984('0xd')];var db=require(_0xb984('0xe'))['db'];config[_0xb984('0xf')]=_[_0xb984('0x10')](config[_0xb984('0xf')],{'host':_0xb984('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb984('0xf')]));require('./chatWebsite.socket')[_0xb984('0x12')](socket);var client=jayson[_0xb984('0x13')]['http']({'port':0x232c});var client9002=jayson[_0xb984('0x13')][_0xb984('0x14')]({'port':0x232a});var client9003=jayson['client'][_0xb984('0x14')]({'port':0x232b});var client9001=jayson[_0xb984('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0xede12d,_0x4073cb,_0x57365c,_0x6fae41){return new Promise(function(_0x5cd1aa,_0x3b8241){var _0x1dc4df=_0x6fae41||client;return _0x1dc4df[_0xb984('0x15')](_0xede12d,_0x57365c)[_0xb984('0x16')](function(_0x59dcb7){logger[_0xb984('0x17')](_0xb984('0x18'),_0x4073cb,_0xb984('0x19'));logger[_0xb984('0x1a')](_0xb984('0x1b'),_0x4073cb,_0xb984('0x19'),JSON['stringify'](_0x59dcb7));if(_0x59dcb7[_0xb984('0x1c')]){if(_0x59dcb7[_0xb984('0x1c')][_0xb984('0x1d')]===0x1f4){logger[_0xb984('0x1c')](_0xb984('0x18'),_0x4073cb,_0x59dcb7[_0xb984('0x1c')]['message']);return _0x3b8241(_0x59dcb7[_0xb984('0x1c')][_0xb984('0x1e')]);}logger['error'](_0xb984('0x18'),_0x4073cb,_0x59dcb7[_0xb984('0x1c')][_0xb984('0x1e')]);return _0x5cd1aa(_0x59dcb7[_0xb984('0x1c')][_0xb984('0x1e')]);}else{logger[_0xb984('0x17')](_0xb984('0x18'),_0x4073cb,'request\x20sent');_0x5cd1aa(_0x59dcb7[_0xb984('0x1f')][_0xb984('0x1e')]);}})[_0xb984('0x20')](function(_0x5d4d38){logger[_0xb984('0x1c')](_0xb984('0x18'),_0x4073cb,_0x5d4d38);_0x3b8241(_0x5d4d38);});});}function respondWithStatusCode(_0x1cb2c2,_0x2d0450){_0x2d0450=_0x2d0450||0xcc;return function(_0x1f7b62){if(_0x1f7b62){return _0x1cb2c2[_0xb984('0x21')](_0x2d0450);}return _0x1cb2c2[_0xb984('0x22')](_0x2d0450)[_0xb984('0x23')]();};}function respondWithResult(_0x5d93d9,_0x249d47){_0x249d47=_0x249d47||0xc8;return function(_0x469af6){if(_0x469af6){return _0x5d93d9[_0xb984('0x22')](_0x249d47)[_0xb984('0x24')](_0x469af6);}};}function respondWithFilteredResult(_0x4fb896,_0xa44895){return function(_0x67e4d3){if(_0x67e4d3){var _0x476811=typeof _0xa44895['offset']===_0xb984('0x25')&&typeof _0xa44895[_0xb984('0x26')]===_0xb984('0x25');var _0x3d2757=_0x67e4d3['count'];var _0x5b8da1=_0x476811?0x0:_0xa44895['offset'];var _0x10b9ac=_0x476811?_0x67e4d3[_0xb984('0x27')]:_0xa44895['offset']+_0xa44895[_0xb984('0x26')];var _0x2bb03f;if(_0x10b9ac>=_0x3d2757){_0x10b9ac=_0x3d2757;_0x2bb03f=0xc8;}else{_0x2bb03f=0xce;}_0x4fb896[_0xb984('0x22')](_0x2bb03f);return _0x4fb896[_0xb984('0x28')]('Content-Range',_0x5b8da1+'-'+_0x10b9ac+'/'+_0x3d2757)['json'](_0x67e4d3);}return null;};}function saveUpdates(_0x315f70){return function(_0x2daa31){if(_0x2daa31){return _0x2daa31[_0xb984('0x29')](_0x315f70)[_0xb984('0x16')](function(_0x4df9e0){return _0x4df9e0;});}return null;};}function removeEntity(_0x44ef84){return function(_0x35b37f){if(_0x35b37f){return _0x35b37f[_0xb984('0x2a')]()[_0xb984('0x16')](function(){var _0x3d2714=_0x35b37f[_0xb984('0x2b')]({'plain':!![]});var _0x5f4426=_0xb984('0x2c');return db[_0xb984('0x2d')][_0xb984('0x2a')]({'where':{'type':_0x5f4426,'resourceId':_0x3d2714['id']}})[_0xb984('0x16')](function(){return _0x35b37f;});})[_0xb984('0x16')](function(){_0x44ef84[_0xb984('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31f490){return function(_0x138dc5){if(!_0x138dc5){_0x31f490['sendStatus'](0x194);}return _0x138dc5;};}function handleError(_0x578a80,_0x13a950){_0x13a950=_0x13a950||0x1f4;return function(_0x4a440d){logger[_0xb984('0x1c')](_0x4a440d[_0xb984('0x2e')]);if(_0x4a440d['name']){delete _0x4a440d[_0xb984('0x2f')];}_0x578a80['status'](_0x13a950)[_0xb984('0x30')](_0x4a440d);};}function createInteractionObject(_0x5c25a9,_0x19bd91,_0x557302,_0x52f872){var _0xf6d925=require(_0xb984('0x31'));var _0x4dac3f=new _0xf6d925();var _0x26b36c=_0x4dac3f[_0xb984('0x32')](_0x557302['user-agent'])[_0xb984('0x33')]();var _0x446f45=_0x19bd91[_0xb984('0x34')];if(_0x557302[_0xb984('0x35')]){_0x446f45=_0x557302['cf-connecting-ip'];}else if(_0x557302[_0xb984('0x36')]){_0x446f45=_[_0xb984('0x37')](_0x557302[_0xb984('0x36')][_0xb984('0x38')](','));}return{'ContactId':_0x52f872['id'],'ChatWebsiteId':_0x5c25a9,'from':(_0x52f872[_0xb984('0x39')]||'')+'\x20'+(_0x52f872[_0xb984('0x3a')]||''),'customerIp':_0x446f45,'customerPort':_0x557302[_0xb984('0x3b')]?_0x557302[_0xb984('0x3b')]:null,'referer':_0x19bd91[_0xb984('0x3c')],'browserName':_0x26b36c[_0xb984('0x3d')]['name']&&_0x26b36c[_0xb984('0x3d')][_0xb984('0x3e')]?util[_0xb984('0x3f')](_0xb984('0x40'),_0x26b36c[_0xb984('0x3d')][_0xb984('0x2f')],_0x26b36c[_0xb984('0x3d')][_0xb984('0x3e')]):'unknown','browserVersion':_0x26b36c['browser'][_0xb984('0x3e')]||'unknown','osName':util[_0xb984('0x3f')](_0xb984('0x40'),_0x26b36c['os'][_0xb984('0x2f')],_0x26b36c['os'][_0xb984('0x3e')]),'osVersion':_0x26b36c['os']['version'],'deviceModel':_0x26b36c[_0xb984('0x41')][_0xb984('0x42')]&&_0x26b36c['device'][_0xb984('0x43')]?util[_0xb984('0x3f')](_0xb984('0x44'),_0x26b36c[_0xb984('0x41')][_0xb984('0x42')],_0x26b36c[_0xb984('0x41')][_0xb984('0x43')],_0x26b36c['device'][_0xb984('0x45')]):null,'deviceVendor':_0x26b36c[_0xb984('0x41')]['vendor'],'deviceType':_0x26b36c['device'][_0xb984('0x45')],'formData':JSON[_0xb984('0x46')](_0x19bd91)};}exports[_0xb984('0x47')]=function(_0x248800,_0x1acc7a){var _0x56a3bf={'include':[{'model':db[_0xb984('0x48')],'as':_0xb984('0x49')}]},_0x664cb1={},_0x40666f={'count':0x0,'rows':[]};var _0x460a7e=_[_0xb984('0x4a')](db[_0xb984('0x4b')][_0xb984('0x4c')],function(_0x23b95b){return{'name':_0x23b95b[_0xb984('0x4d')],'type':_0x23b95b['type'][_0xb984('0x4e')]};});_0x664cb1[_0xb984('0x42')]=_['map'](_0x460a7e,_0xb984('0x2f'));_0x664cb1[_0xb984('0x4f')]=_[_0xb984('0x50')](_0x248800[_0xb984('0x4f')]);_0x664cb1[_0xb984('0x51')]=_[_0xb984('0x52')](_0x664cb1[_0xb984('0x42')],_0x664cb1[_0xb984('0x4f')]);_0x56a3bf[_0xb984('0x53')]=_[_0xb984('0x52')](_0x664cb1['model'],qs[_0xb984('0x54')](_0x248800[_0xb984('0x4f')][_0xb984('0x54')]));_0x56a3bf[_0xb984('0x53')]=_0x56a3bf[_0xb984('0x53')][_0xb984('0x55')]?_0x56a3bf[_0xb984('0x53')]:_0x664cb1[_0xb984('0x42')];if(!_0x248800[_0xb984('0x4f')]['hasOwnProperty'](_0xb984('0x56'))){_0x56a3bf[_0xb984('0x26')]=qs[_0xb984('0x26')](_0x248800['query'][_0xb984('0x26')]);_0x56a3bf[_0xb984('0x57')]=qs['offset'](_0x248800[_0xb984('0x4f')]['offset']);}_0x56a3bf[_0xb984('0x58')]=qs[_0xb984('0x59')](_0x248800['query'][_0xb984('0x59')]);_0x56a3bf[_0xb984('0x5a')]=qs[_0xb984('0x51')](_[_0xb984('0x5b')](_0x248800[_0xb984('0x4f')],_0x664cb1[_0xb984('0x51')]),_0x460a7e);if(_0x248800['query'][_0xb984('0x5c')]){_0x56a3bf['where']=_[_0xb984('0x5d')](_0x56a3bf[_0xb984('0x5a')],{'$or':_[_0xb984('0x4a')](_0x460a7e,function(_0x5cf038){if(_0x5cf038['type']!==_0xb984('0x5e')){var _0x2dfaf8={};_0x2dfaf8[_0x5cf038['name']]={'$like':'%'+_0x248800['query'][_0xb984('0x5c')]+'%'};return _0x2dfaf8;}})});}_0x56a3bf=_[_0xb984('0x5d')]({},_0x56a3bf,_0x248800[_0xb984('0x5f')]);var _0x3daaa0={'where':_0x56a3bf[_0xb984('0x5a')]};return db[_0xb984('0x4b')]['count'](_0x3daaa0)['then'](function(_0x3dcdf1){_0x40666f[_0xb984('0x27')]=_0x3dcdf1;if(_0x248800['query'][_0xb984('0x60')]){_0x56a3bf[_0xb984('0x61')]=[{'all':!![]}];}return db[_0xb984('0x4b')][_0xb984('0x62')](_0x56a3bf);})['then'](function(_0x4d719c){_0x40666f[_0xb984('0x63')]=_0x4d719c;return _0x40666f;})[_0xb984('0x16')](respondWithFilteredResult(_0x1acc7a,_0x56a3bf))[_0xb984('0x20')](handleError(_0x1acc7a,null));};exports[_0xb984('0x64')]=function(_0x3bdadc,_0x3cc2a0){var _0x49ecfd={'raw':![],'where':{'id':_0x3bdadc[_0xb984('0x65')]['id']},'include':[{'model':db[_0xb984('0x48')],'as':_0xb984('0x49')}]},_0x2de42b={};_0x2de42b[_0xb984('0x42')]=_[_0xb984('0x50')](db['ChatWebsite']['rawAttributes']);_0x2de42b['query']=_[_0xb984('0x50')](_0x3bdadc[_0xb984('0x4f')]);_0x2de42b[_0xb984('0x51')]=_[_0xb984('0x52')](_0x2de42b[_0xb984('0x42')],_0x2de42b['query']);_0x49ecfd[_0xb984('0x53')]=_[_0xb984('0x52')](_0x2de42b[_0xb984('0x42')],qs['fields'](_0x3bdadc[_0xb984('0x4f')][_0xb984('0x54')]));_0x49ecfd['attributes']=_0x49ecfd['attributes'][_0xb984('0x55')]?_0x49ecfd['attributes']:_0x2de42b['model'];if(_0x3bdadc[_0xb984('0x4f')]['includeAll']){_0x49ecfd[_0xb984('0x61')]=[{'all':!![]}];}_0x49ecfd=_[_0xb984('0x5d')]({},_0x49ecfd,_0x3bdadc[_0xb984('0x5f')]);return db[_0xb984('0x4b')][_0xb984('0x66')](_0x49ecfd)[_0xb984('0x16')](handleEntityNotFound(_0x3cc2a0,null))[_0xb984('0x16')](respondWithResult(_0x3cc2a0,null))[_0xb984('0x20')](handleError(_0x3cc2a0,null));};exports[_0xb984('0x67')]=function(_0x2b187f,_0x742a0f){var _0x1d9213=null;_0x2b187f['body'][_0xb984('0x68')][_0xb984('0x38')](',')[_0xb984('0x69')](_0x511780=>{if(_0x511780['trim']()!==''&&!wildcardUtils[_0xb984('0x6a')](_0x511780[_0xb984('0x6b')]())){_0x1d9213=new APIBadRequestError('\x22'+_0x511780[_0xb984('0x6b')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x1d9213){return handleError(_0x742a0f,null)(_0x1d9213);}return db[_0xb984('0x4b')][_0xb984('0x67')](_0x2b187f[_0xb984('0x6c')],{})[_0xb984('0x16')](function(_0x434c5c){var _0x1793e2=_0x2b187f[_0xb984('0x6d')][_0xb984('0x2b')]({'plain':!![]});if(!_0x1793e2)throw new Error(_0xb984('0x6e'));if(_0x1793e2[_0xb984('0x6f')]===_0xb984('0x6d')){var _0x4c377f=_0x434c5c[_0xb984('0x2b')]({'plain':!![]});var _0x9ea21f='ChatWebsites';return db[_0xb984('0x70')]['find']({'where':{'name':_0x9ea21f,'userProfileId':_0x1793e2[_0xb984('0x71')]},'raw':!![]})['then'](function(_0x3cfd28){if(_0x3cfd28&&_0x3cfd28[_0xb984('0x72')]===0x0){return db[_0xb984('0x2d')][_0xb984('0x67')]({'name':_0x4c377f[_0xb984('0x2f')],'resourceId':_0x4c377f['id'],'type':_0x3cfd28[_0xb984('0x2f')],'sectionId':_0x3cfd28['id']},{})[_0xb984('0x16')](function(){return _0x434c5c;});}else{return _0x434c5c;}})[_0xb984('0x20')](function(_0x3bc1d3){logger[_0xb984('0x1c')](_0xb984('0x73'),_0x3bc1d3);throw _0x3bc1d3;});}return _0x434c5c;})[_0xb984('0x16')](respondWithResult(_0x742a0f,0xc9))[_0xb984('0x20')](handleError(_0x742a0f,null));};exports['update']=function(_0x4886bf,_0x917c53){var _0x441166=null;_0x4886bf[_0xb984('0x6c')]['address'][_0xb984('0x38')](',')[_0xb984('0x69')](_0x50544b=>{if(_0x50544b['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x50544b[_0xb984('0x6b')]())){_0x441166=new APIBadRequestError('\x22'+_0x50544b['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x441166){return handleError(_0x917c53,null)(_0x441166);}if(_0x4886bf['body']['id']){delete _0x4886bf[_0xb984('0x6c')]['id'];}return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x4886bf[_0xb984('0x65')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xb984('0x16')](handleEntityNotFound(_0x917c53,null))[_0xb984('0x16')](saveUpdates(_0x4886bf[_0xb984('0x6c')],null))[_0xb984('0x16')](respondWithResult(_0x917c53,null))[_0xb984('0x20')](handleError(_0x917c53,null));};exports['destroy']=function(_0x2063cd,_0x3e7ed1){return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x2063cd[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x3e7ed1,null))['then'](removeEntity(_0x3e7ed1,null))[_0xb984('0x20')](handleError(_0x3e7ed1,null));};exports['describe']=function(_0x12890c,_0x1d9392){return db[_0xb984('0x4b')][_0xb984('0x74')]()[_0xb984('0x16')](respondWithResult(_0x1d9392,null))['catch'](handleError(_0x1d9392,null));};exports[_0xb984('0x75')]=function(_0x203915,_0x1f0e09){if(_0x203915['body']['id']){delete _0x203915[_0xb984('0x6c')]['id'];}return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x203915[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x1f0e09,null))['then'](function(_0x504d1a){if(_0x504d1a){_0x203915[_0xb984('0x6c')][_0xb984('0x76')]=_0x504d1a['id'];return db[_0xb984('0x77')][_0xb984('0x67')](_0x203915['body']);}})[_0xb984('0x16')](respondWithResult(_0x1f0e09,null))[_0xb984('0x20')](handleError(_0x1f0e09,null));};exports[_0xb984('0x78')]=function(_0x199e48,_0x5e4b1f){var _0x1b0673={'raw':![],'where':{}};var _0x2725eb={};var _0x417526={'count':0x0,'rows':[]};return db[_0xb984('0x4b')]['findOne']({'where':{'id':_0x199e48[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x5e4b1f,null))[_0xb984('0x16')](function(_0x2d686e){if(_0x2d686e){_0x2725eb[_0xb984('0x42')]=_[_0xb984('0x50')](db[_0xb984('0x77')][_0xb984('0x4c')]);_0x2725eb[_0xb984('0x4f')]=_[_0xb984('0x50')](_0x199e48[_0xb984('0x4f')]);_0x2725eb['filters']=_[_0xb984('0x52')](_0x2725eb[_0xb984('0x42')],_0x2725eb[_0xb984('0x4f')]);_0x1b0673[_0xb984('0x53')]=_[_0xb984('0x52')](_0x2725eb[_0xb984('0x42')],qs['fields'](_0x199e48[_0xb984('0x4f')][_0xb984('0x54')]));_0x1b0673[_0xb984('0x53')]=_0x1b0673[_0xb984('0x53')]['length']?_0x1b0673[_0xb984('0x53')]:_0x2725eb[_0xb984('0x42')];if(!_0x199e48['query'][_0xb984('0x79')]('nolimit')){_0x1b0673['limit']=qs[_0xb984('0x26')](_0x199e48[_0xb984('0x4f')][_0xb984('0x26')]);_0x1b0673[_0xb984('0x57')]=qs[_0xb984('0x57')](_0x199e48[_0xb984('0x4f')][_0xb984('0x57')]);}_0x1b0673[_0xb984('0x58')]=qs[_0xb984('0x59')](_0x199e48['query']['sort']);_0x1b0673[_0xb984('0x5a')]=qs[_0xb984('0x51')](_[_0xb984('0x5b')](_0x199e48[_0xb984('0x4f')],_0x2725eb['filters']));_0x1b0673[_0xb984('0x5a')][_0xb984('0x76')]=_0x2d686e['id'];if(_0x199e48[_0xb984('0x4f')][_0xb984('0x5c')]){_0x1b0673[_0xb984('0x5a')]=_[_0xb984('0x5d')](_0x1b0673['where'],{'$or':_[_0xb984('0x4a')](_0x1b0673['attributes'],function(_0x38b0e6){var _0x56cb5d={};_0x56cb5d[_0x38b0e6]={'$like':'%'+_0x199e48[_0xb984('0x4f')]['filter']+'%'};return _0x56cb5d;})});}_0x1b0673=_['merge']({},_0x1b0673,_0x199e48[_0xb984('0x5f')]);return db[_0xb984('0x77')]['count']({'where':_0x1b0673[_0xb984('0x5a')]})[_0xb984('0x16')](function(_0x1eecfd){_0x417526[_0xb984('0x27')]=_0x1eecfd;if(_0x199e48[_0xb984('0x4f')]['includeAll']){_0x1b0673['include']=[{'all':!![]}];}return db[_0xb984('0x77')][_0xb984('0x62')](_0x1b0673);})['then'](function(_0x42a63d){_0x417526[_0xb984('0x63')]=_0x42a63d;return _0x417526;});}})[_0xb984('0x16')](respondWithFilteredResult(_0x5e4b1f,_0x1b0673))['catch'](handleError(_0x5e4b1f,null));};exports[_0xb984('0x7a')]=function(_0x52c145,_0x15a258){return db[_0xb984('0x4b')]['find']({'where':{'id':_0x52c145[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x15a258,null))[_0xb984('0x16')](function(_0xc39a0){if(_0xc39a0){return _0xc39a0['removeDispositions'](_0x52c145['query']['ids']);}})['then'](respondWithStatusCode(_0x15a258,null))['catch'](handleError(_0x15a258,null));};exports[_0xb984('0x7b')]=function(_0x431b44,_0x50de1){if(_0x431b44[_0xb984('0x6c')]['id']){delete _0x431b44[_0xb984('0x6c')]['id'];}return db[_0xb984('0x4b')]['find']({'where':{'id':_0x431b44[_0xb984('0x65')]['id']}})['then'](handleEntityNotFound(_0x50de1,null))['then'](function(_0x45cf65){if(_0x45cf65){_0x431b44['body'][_0xb984('0x76')]=_0x45cf65['id'];return db[_0xb984('0x7c')]['create'](_0x431b44[_0xb984('0x6c')]);}})[_0xb984('0x16')](respondWithResult(_0x50de1,null))[_0xb984('0x20')](handleError(_0x50de1,null));};exports[_0xb984('0x7d')]=function(_0x1e48c5,_0x35c63a){var _0x175683={'raw':![],'where':{}};var _0x1ac7bd={};var _0x2c2750={'count':0x0,'rows':[]};return db[_0xb984('0x4b')][_0xb984('0x7e')]({'where':{'id':_0x1e48c5[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x35c63a,null))['then'](function(_0x3e2bd0){if(_0x3e2bd0){_0x1ac7bd['model']=_[_0xb984('0x50')](db['CannedAnswer'][_0xb984('0x4c')]);_0x1ac7bd[_0xb984('0x4f')]=_[_0xb984('0x50')](_0x1e48c5[_0xb984('0x4f')]);_0x1ac7bd[_0xb984('0x51')]=_[_0xb984('0x52')](_0x1ac7bd[_0xb984('0x42')],_0x1ac7bd['query']);_0x175683[_0xb984('0x53')]=_[_0xb984('0x52')](_0x1ac7bd[_0xb984('0x42')],qs[_0xb984('0x54')](_0x1e48c5[_0xb984('0x4f')][_0xb984('0x54')]));_0x175683[_0xb984('0x53')]=_0x175683[_0xb984('0x53')][_0xb984('0x55')]?_0x175683['attributes']:_0x1ac7bd[_0xb984('0x42')];if(!_0x1e48c5[_0xb984('0x4f')][_0xb984('0x79')](_0xb984('0x56'))){_0x175683[_0xb984('0x26')]=qs[_0xb984('0x26')](_0x1e48c5[_0xb984('0x4f')][_0xb984('0x26')]);_0x175683[_0xb984('0x57')]=qs[_0xb984('0x57')](_0x1e48c5['query'][_0xb984('0x57')]);}_0x175683['order']=qs[_0xb984('0x59')](_0x1e48c5[_0xb984('0x4f')][_0xb984('0x59')]);_0x175683[_0xb984('0x5a')]=qs[_0xb984('0x51')](_['pick'](_0x1e48c5[_0xb984('0x4f')],_0x1ac7bd[_0xb984('0x51')]));_0x175683['where'][_0xb984('0x76')]=_0x3e2bd0['id'];if(_0x1e48c5[_0xb984('0x4f')][_0xb984('0x5c')]){_0x175683['where']=_[_0xb984('0x5d')](_0x175683[_0xb984('0x5a')],{'$or':_[_0xb984('0x4a')](_0x175683[_0xb984('0x53')],function(_0xc92c53){var _0x22425e={};_0x22425e[_0xc92c53]={'$like':'%'+_0x1e48c5[_0xb984('0x4f')][_0xb984('0x5c')]+'%'};return _0x22425e;})});}_0x175683=_[_0xb984('0x5d')]({},_0x175683,_0x1e48c5[_0xb984('0x5f')]);return db['CannedAnswer']['count']({'where':_0x175683['where']})[_0xb984('0x16')](function(_0xfe3d03){_0x2c2750[_0xb984('0x27')]=_0xfe3d03;if(_0x1e48c5[_0xb984('0x4f')]['includeAll']){_0x175683['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xb984('0x62')](_0x175683);})[_0xb984('0x16')](function(_0x5e9fa1){_0x2c2750[_0xb984('0x63')]=_0x5e9fa1;return _0x2c2750;});}})['then'](respondWithFilteredResult(_0x35c63a,_0x175683))[_0xb984('0x20')](handleError(_0x35c63a,null));};exports['removeAnswers']=function(_0x1ca908,_0x5e2d33){return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x1ca908['params']['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x5e2d33,null))['then'](function(_0x3b0e65){if(_0x3b0e65){return _0x3b0e65[_0xb984('0x7f')](_0x1ca908[_0xb984('0x4f')][_0xb984('0x80')]);}})['then'](respondWithStatusCode(_0x5e2d33,null))[_0xb984('0x20')](handleError(_0x5e2d33,null));};exports['addLogo']=function(_0x272bf0,_0x28c248){_0x272bf0[_0xb984('0x6c')][_0xb984('0x81')]=_0x272bf0[_0xb984('0x82')][_0xb984('0x83')];return db['ChatWebsite'][_0xb984('0x66')]({'where':{'id':_0x272bf0[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x28c248,null))['then'](saveUpdates(_0x272bf0[_0xb984('0x6c')],null))[_0xb984('0x16')](respondWithResult(_0x28c248,null))[_0xb984('0x20')](handleError(_0x28c248,null));};exports['addAvatar']=function(_0x26b0bf,_0x3138df){_0x26b0bf[_0xb984('0x6c')][_0xb984('0x84')]=_0x26b0bf[_0xb984('0x82')][_0xb984('0x83')];return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x26b0bf[_0xb984('0x65')]['id']}})['then'](handleEntityNotFound(_0x3138df,null))[_0xb984('0x16')](saveUpdates(_0x26b0bf[_0xb984('0x6c')],null))[_0xb984('0x16')](respondWithResult(_0x3138df,null))[_0xb984('0x20')](handleError(_0x3138df,null));};exports[_0xb984('0x85')]=function(_0x1382d7,_0x5d1e30){_0x1382d7['body']['customerAvatar']=_0x1382d7['file']['filename'];return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x1382d7[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x5d1e30,null))[_0xb984('0x16')](saveUpdates(_0x1382d7[_0xb984('0x6c')],null))[_0xb984('0x16')](respondWithResult(_0x5d1e30,null))[_0xb984('0x20')](handleError(_0x5d1e30,null));};exports[_0xb984('0x86')]=function(_0x2f3a0e,_0x27ec1e){_0x2f3a0e[_0xb984('0x6c')][_0xb984('0x87')]=_0x2f3a0e[_0xb984('0x82')][_0xb984('0x83')];return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x2f3a0e[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x27ec1e,null))[_0xb984('0x16')](saveUpdates(_0x2f3a0e['body'],null))[_0xb984('0x16')](respondWithResult(_0x27ec1e,null))[_0xb984('0x20')](handleError(_0x27ec1e,null));};exports['getLogo']=function(_0x197038,_0x36ffc1){var _0x428c26=path[_0xb984('0x88')](config[_0xb984('0x89')],_0xb984('0x8a'));var _0x444d38={'where':{'id':_0x197038[_0xb984('0x65')]['id']},'attributes':['id',_0xb984('0x81')],'raw':!![]};var _0x447d61=![];return require(_0xb984('0x8b'))[_0xb984('0x8c')]()[_0xb984('0x16')](function(_0x1a4dc6){if(_0x1a4dc6){_0x447d61=_0x1a4dc6[_0xb984('0x8d')];}})[_0xb984('0x16')](function(){return db[_0xb984('0x4b')][_0xb984('0x66')](_0x444d38);})[_0xb984('0x16')](handleEntityNotFound(_0x36ffc1,null))[_0xb984('0x16')](function(_0x476fdd){if(_0x476fdd){if(!_['isNil'](_0x476fdd[_0xb984('0x81')])){if(fs['existsSync'](path['join'](config[_0xb984('0x89')],_0xb984('0x8e'),_0x476fdd[_0xb984('0x81')]))&&_0x447d61){_0x428c26=path['join'](config[_0xb984('0x89')],_0xb984('0x8e'),_0x476fdd[_0xb984('0x81')]);}}return _0x36ffc1[_0xb984('0x8f')](_0x428c26);}})['catch'](handleError(_0x36ffc1,null));};exports[_0xb984('0x90')]=function(_0x146470,_0x2cb327){var _0x2a4478=path['join'](config[_0xb984('0x89')],'server/files/images/avatars/default_avatar.png');var _0x5569e2={'where':{'id':_0x146470[_0xb984('0x65')]['id']},'attributes':['id',_0xb984('0x84')],'raw':!![]};return db['ChatWebsite'][_0xb984('0x66')](_0x5569e2)[_0xb984('0x16')](handleEntityNotFound(_0x2cb327,null))[_0xb984('0x16')](function(_0x2975da){if(_0x2975da){if(!_[_0xb984('0x91')](_0x2975da['agentAvatar'])){if(fs['existsSync'](path['join'](config['root'],_0xb984('0x92'),_0x2975da[_0xb984('0x84')]))){_0x2a4478=path[_0xb984('0x88')](config[_0xb984('0x89')],_0xb984('0x92'),_0x2975da[_0xb984('0x84')]);}}return _0x2cb327[_0xb984('0x8f')](_0x2a4478);}})[_0xb984('0x20')](handleError(_0x2cb327,null));};exports['getCustomerAvatar']=function(_0x7a61a3,_0x364971){var _0x15c0d1=path['join'](config[_0xb984('0x89')],_0xb984('0x93'));var _0x126072={'where':{'id':_0x7a61a3[_0xb984('0x65')]['id']},'attributes':['id','customerAvatar',_0xb984('0x94')],'raw':!![]};return db[_0xb984('0x4b')]['find'](_0x126072)[_0xb984('0x16')](handleEntityNotFound(_0x364971,null))['then'](function(_0xa2ae6e){if(_0xa2ae6e){if(!_[_0xb984('0x91')](_0xa2ae6e[_0xb984('0x95')])){if(fs[_0xb984('0x96')](path[_0xb984('0x88')](config[_0xb984('0x89')],_0xb984('0x92'),_0xa2ae6e[_0xb984('0x95')]))&&_0xa2ae6e[_0xb984('0x94')]){_0x15c0d1=path['join'](config[_0xb984('0x89')],_0xb984('0x92'),_0xa2ae6e[_0xb984('0x95')]);}}return _0x364971[_0xb984('0x8f')](_0x15c0d1);}})['catch'](handleError(_0x364971,null));};exports[_0xb984('0x97')]=function(_0x566cf1,_0x1b9c9b){var _0x178bc5=path['join'](config[_0xb984('0x89')],_0xb984('0x98'));var _0x3ea17b={'where':{'id':_0x566cf1[_0xb984('0x65')]['id']},'attributes':['id',_0xb984('0x87')],'raw':!![]};return db[_0xb984('0x4b')][_0xb984('0x66')](_0x3ea17b)[_0xb984('0x16')](handleEntityNotFound(_0x1b9c9b,null))[_0xb984('0x16')](function(_0x18dda5){if(_0x18dda5){if(!_[_0xb984('0x91')](_0x18dda5['systemAvatar'])){if(fs[_0xb984('0x96')](path[_0xb984('0x88')](config[_0xb984('0x89')],_0xb984('0x92'),_0x18dda5[_0xb984('0x87')]))){_0x178bc5=path[_0xb984('0x88')](config[_0xb984('0x89')],'server/files/images/avatars/',_0x18dda5['systemAvatar']);}}return _0x1b9c9b[_0xb984('0x8f')](_0x178bc5);}})[_0xb984('0x20')](handleError(_0x1b9c9b,null));};function checkWebsiteInterval(_0x1261d7){var _0x7903b8=_0x1261d7[_0xb984('0x99')];if(!_0x7903b8){return Promise[_0xb984('0x9a')](_0x1261d7);}var _0x4d0329=_0x1261d7[_0xb984('0x9b')]||undefined;return _0x7903b8[_0xb984('0x9c')](_0x4d0329)[_0xb984('0x16')](function(_0xe6d4e3){if(!_0xe6d4e3){throw new APIOutOfIntervalError();}return _0x1261d7;});}exports[_0xb984('0x9d')]=function(_0xaf2e56,_0x59ef00){var _0x4964a2={'body':_0xaf2e56[_0xb984('0x6c')],'channel':_0xb984('0x9e')};var _0x40fe08=[];var _0x6df7f6=[];var _0x201dea={};var _0x34a464=![];if(_0xaf2e56[_0xb984('0x6c')]['id']){delete _0xaf2e56[_0xb984('0x6c')]['id'];}if(_[_0xb984('0x91')](_0xaf2e56[_0xb984('0x6c')]['from'])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_['isNil'](_0xaf2e56[_0xb984('0x6c')][_0xb984('0x9f')])){throw new APIBadRequestError(_0xb984('0xa0'));}if(_['isEmpty'](_0xaf2e56['body'][_0xb984('0x6c')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x5408f0=_0xaf2e56[_0xb984('0x6c')][_0xb984('0x34')]&&_0xaf2e56[_0xb984('0x6c')]['referer'];return db['CmContact'][_0xb984('0x74')]()[_0xb984('0x16')](function(_0x21859f){if(!_0x21859f){throw new Error('No\x20available\x20attributes');}_0x40fe08=Object[_0xb984('0x50')](_0x21859f)[_0xb984('0x5c')](function(_0x217025){return![_0xb984('0xa1'),_0xb984('0xa2')][_0xb984('0xa3')](_0x217025);});_0x6df7f6=Object['keys'](_0x21859f)[_0xb984('0x5c')](function(_0x5d0b15){return![_0xb984('0xa1'),_0xb984('0xa2'),_0xb984('0xa4'),_0xb984('0xa5')][_0xb984('0xa3')](_0x5d0b15);});if(!_['includes'](_0x6df7f6,_0xaf2e56[_0xb984('0x6c')][_0xb984('0x9f')])){throw new APIBadRequestError(_0xb984('0xa6')+_0x6df7f6[_0xb984('0x88')](',\x20'));}_0x201dea[_0xaf2e56['body']['mapKey']]=_0xaf2e56[_0xb984('0x6c')]['from'];})[_0xb984('0x16')](function(){return db[_0xb984('0x4b')]['find']({'where':{'id':_0xaf2e56[_0xb984('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0xb984('0xa7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x201dea,'limit':0x1,'order':[['updatedAt',_0xb984('0xa8')]]}]},{'model':db[_0xb984('0xa9')],'as':_0xb984('0xaa')},{'model':db['Interval'],'as':_0xb984('0x99'),'include':[{'model':db['Interval'],'as':_0xb984('0xab'),'attributes':['id',_0xb984('0xac')],'raw':!![]}]}]});})[_0xb984('0x16')](function(_0x51a74a){if(!_0x51a74a){throw new APINotFoundError(util[_0xb984('0x3f')](_0xb984('0xad'),_0xaf2e56[_0xb984('0x65')]['id']));}if(_0x5408f0){return checkWebsiteInterval(_0x51a74a);}return _0x51a74a;})[_0xb984('0x16')](function(_0x34f9de){_0x4964a2[_0xb984('0xae')]=_0x34f9de;_0x4964a2[_0xb984('0xaf')]=_[_0xb984('0xb0')](_0x34f9de['Applications'],[_0xb984('0xb1')],['asc']);if(_0x4964a2[_0xb984('0xae')][_0xb984('0xaa')]){delete _0x4964a2[_0xb984('0xae')][_0xb984('0xaa')];}_0x4964a2['list']=_0x34f9de[_0xb984('0xa7')]||{'id':_0x34f9de['ListId']};if(_0x4964a2[_0xb984('0xb2')]&&_0x4964a2[_0xb984('0xb2')]['Contacts'][_0xb984('0x55')]){return _0x4964a2['list'][_0xb984('0xb3')][0x0];}var _0x24dc10=_[_0xb984('0x10')](_0xaf2e56[_0xb984('0x6c')],{'firstName':_0xaf2e56[_0xb984('0x6c')][_0xb984('0xb4')],'ListId':_0x34f9de[_0xb984('0xa5')]});_0x24dc10[_0xaf2e56[_0xb984('0x6c')][_0xb984('0x9f')]]=_0xaf2e56[_0xb984('0x6c')][_0xb984('0xb4')];return db[_0xb984('0xb5')][_0xb984('0x67')](_0x24dc10,{'fields':_0x40fe08,'raw':!![]});})['then'](function(_0x3ec9bf){_0x4964a2['contact']=_0x3ec9bf;var _0x1657b9=createInteractionObject(_0xaf2e56[_0xb984('0x65')]['id'],_0xaf2e56['body'],_0xaf2e56['headers'],_0x3ec9bf);var _0x2cce8b={'ChatWebsiteId':_0xaf2e56[_0xb984('0x65')]['id']};if(_0xaf2e56[_0xb984('0x6c')][_0xb984('0xb6')]){_0x2cce8b['threadId']=_0xaf2e56[_0xb984('0x6c')][_0xb984('0xb6')];_0x2cce8b[_0xb984('0xb7')]=![];return db['ChatInteraction'][_0xb984('0x66')]({'where':_0x2cce8b})[_0xb984('0x16')](function(_0x95059b){var _0x41d5cc=_0xaf2e56[_0xb984('0x6c')]['customerIp']&&_0xaf2e56[_0xb984('0x6c')][_0xb984('0x3c')];if(_0x95059b){_0x34a464=!![];return _0x95059b;}else if(!_0x41d5cc&&_0x95059b&&_0x95059b[_0xb984('0xb7')]){throw new APIConflictError(_0xb984('0xb8'));}_0x1657b9[_0xb984('0xb6')]=_0xaf2e56[_0xb984('0x6c')][_0xb984('0xb6')];_0x1657b9[_0xb984('0xb9')]=_0xaf2e56[_0xb984('0x6c')]['externalUrl'];return db[_0xb984('0xba')][_0xb984('0x67')](_0x1657b9);});}_0x2cce8b['ContactId']=_0x3ec9bf['id'];if(_0xaf2e56[_0xb984('0x6c')]['interaction']&&_0xaf2e56['body'][_0xb984('0xbb')]['id']){_0x2cce8b['id']=_0xaf2e56[_0xb984('0x6c')][_0xb984('0xbb')]['id'];return db[_0xb984('0xba')][_0xb984('0x66')]({'where':_0x2cce8b})[_0xb984('0x16')](function(_0x5bda49){var _0x87fb63=_0xaf2e56['body'][_0xb984('0x34')]&&_0xaf2e56[_0xb984('0x6c')][_0xb984('0x3c')];if(!_0x87fb63&&_0x5bda49&&_0x5bda49[_0xb984('0xb7')]){throw new APIConflictError(_0xb984('0xb8'));}else if(_0x5bda49){_0x34a464=!![];return _0x5bda49;}else{return db[_0xb984('0xba')][_0xb984('0x67')](_0x1657b9);}});}return db[_0xb984('0xba')]['create'](_0x1657b9);})[_0xb984('0x16')](function(_0x2ef68f){if(!_0x34a464){return _0x2ef68f;}var _0x2b2b68={'from':(_0x4964a2['contact'][_0xb984('0x39')]||'')+'\x20'+(_0x4964a2['contact'][_0xb984('0x3a')]||'')};if(_0xaf2e56[_0xb984('0x6c')][_0xb984('0xb6')]&&_0xaf2e56['body']['messageId']&&_0xaf2e56[_0xb984('0x6c')]['threadId']!=_0xaf2e56[_0xb984('0x6c')][_0xb984('0xbc')]){_0x2b2b68['threadId']=_0xaf2e56[_0xb984('0x6c')][_0xb984('0xbc')];}return _0x2ef68f[_0xb984('0x29')](_0x2b2b68);})[_0xb984('0x16')](function(_0x391988){_0x4964a2[_0xb984('0xbb')]=_0x391988[_0xb984('0x2b')]({'plain':!![]});_0x4964a2[_0xb984('0xbb')]['created']=!_0x34a464;if(_0x4964a2[_0xb984('0xbb')][_0xb984('0xbd')]){if(_0x4964a2[_0xb984('0xae')][_0xb984('0xbe')]){_0x4964a2[_0xb984('0xaf')][_0xb984('0xbf')]({'id':0x0,'priority':_0x4964a2[_0xb984('0xaf')][_0xb984('0x55')]+0x1,'app':_0xb984('0xc0'),'appdata':_0xb984('0xc1'),'interval':_0xb984('0xc2')});}}return db[_0xb984('0xc3')][_0xb984('0x67')]({'body':_0xaf2e56[_0xb984('0x6c')]['body'],'ChatWebsiteId':_0xaf2e56[_0xb984('0x65')]['id'],'ChatInteractionId':_0x391988['id'],'direction':'in','ContactId':_0x4964a2['contact']['id'],'AttachmentId':_0xaf2e56[_0xb984('0x6c')][_0xb984('0xc4')]});})[_0xb984('0x16')](function(_0xcf9ea6){_0x4964a2[_0xb984('0x1e')]=_0xcf9ea6;if(!_0x4964a2['interaction'][_0xb984('0xc5')]){return;}return db['User'][_0xb984('0x66')]({'attributes':['id',_0xb984('0x2f')],'where':{'id':_0x4964a2['interaction'][_0xb984('0xc5')]}});})[_0xb984('0x16')](function(_0x373d95){if(_0x373d95){_0x4964a2[_0xb984('0xaf')][_0xb984('0xc6')]({'id':0x0,'priority':0x0,'app':_0xb984('0xc7'),'appdata':_0x373d95[_0xb984('0x2f')]+','+(_0x4964a2['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x4964a2['forcedOwnership']=!![];}if(!_0x4964a2[_0xb984('0xbb')]['queueId']){return;}return db['ChatQueue'][_0xb984('0x66')]({'attributes':['id',_0xb984('0x2f')],'where':{'id':_0x4964a2[_0xb984('0xbb')][_0xb984('0xc8')]}});})[_0xb984('0x16')](function(_0x39b639){if(_0x39b639){_0x4964a2[_0xb984('0xaf')][_0xb984('0xc6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x39b639['name']+','+(_0x4964a2[_0xb984('0xae')][_0xb984('0xc9')]||0x12c),'interval':_0xb984('0xc2')});}return respondWithRpcPromise(_0xb984('0xca'),'startRouting',_0x4964a2);})[_0xb984('0x16')](function(_0x1d0780){respondWithRpcPromise(_0xb984('0xcb'),_0xb984('0xcb'),{'event':_0xb984('0x9d'),'message':_0x1d0780},client9002);return _0x1d0780;})['then'](respondWithResult(_0x59ef00,null))[_0xb984('0x20')](APIHandleError(_0x59ef00));};exports[_0xb984('0xcc')]=function(_0x3deb31,_0x3c982a){var _0x4a683e,_0x2d8347,_0x327159;var _0x4d67da=[];var _0x1ea3e2={};var _0x7892c7=_0x3deb31[_0xb984('0xcd')]||[];var _0x564a33=[];var _0x51f9d2;return db[_0xb984('0xb5')]['describe']()[_0xb984('0x16')](function(_0x2b39a9){if(!_0x2b39a9){throw new db[(_0xb984('0xce'))][(_0xb984('0xcf'))](_0xb984('0xd0'));}_0x4d67da=_[_0xb984('0xd1')](_['keys'](_0x2b39a9),['createdAt',_0xb984('0xa2'),_0xb984('0xa4'),_0xb984('0xa5')]);if(_0x3deb31[_0xb984('0x6c')]['id']){delete _0x3deb31[_0xb984('0x6c')]['id'];}if(_[_0xb984('0x91')](_0x3deb31['body'][_0xb984('0xb4')])){throw _0x3c982a['status'](0x1f4)[_0xb984('0x30')](new db[(_0xb984('0xce'))][(_0xb984('0xcf'))](_0xb984('0xd2')));}if(_[_0xb984('0x91')](_0x3deb31[_0xb984('0x6c')][_0xb984('0x6c')])||_0x3deb31[_0xb984('0x6c')][_0xb984('0x6c')]===''){throw _0x3c982a[_0xb984('0x22')](0x1f4)[_0xb984('0x30')](new db['Sequelize'][(_0xb984('0xcf'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xb984('0x91')](_0x3deb31[_0xb984('0x6c')][_0xb984('0xd3')])){throw _0x3c982a[_0xb984('0x22')](0x1f4)[_0xb984('0x30')](new db[(_0xb984('0xce'))][(_0xb984('0xcf'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d67da));}if(!_['includes'](_0x4d67da,_0x3deb31[_0xb984('0x6c')]['mapKeyOffline'])){throw _0x3c982a['status'](0x1f4)[_0xb984('0x30')](new db[(_0xb984('0xce'))][(_0xb984('0xcf'))](_0xb984('0xd4')+_0x4d67da));}_0x1ea3e2[_0x3deb31[_0xb984('0x6c')]['mapKeyOffline']]=_0x3deb31[_0xb984('0x6c')][_0xb984('0xb4')];})['then'](function(){return db['ChatWebsite'][_0xb984('0x66')]({'where':{'id':_0x3deb31[_0xb984('0x65')]['id']},'include':[{'model':db[_0xb984('0xd5')],'as':_0xb984('0xa7')},{'model':db['MailAccount'],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x3c982a,null))[_0xb984('0x16')](function(_0x30ebd){if(_0x30ebd&&_0x30ebd['List']){_0x2d8347=_0x30ebd;var _0x380f7b=_[_0xb984('0x10')](_0x3deb31[_0xb984('0x6c')],{'firstName':_0x3deb31[_0xb984('0x6c')][_0xb984('0xb4')],'phone':_0x3deb31[_0xb984('0x6c')][_0xb984('0xb4')],'ListId':_0x30ebd[_0xb984('0xa5')]});_0x380f7b[_0x3deb31[_0xb984('0x6c')][_0xb984('0xd3')]]=_0x3deb31['body'][_0xb984('0xb4')];return db[_0xb984('0xb5')]['findOrCreate']({'where':_0x1ea3e2,'defaults':_0x380f7b});}})[_0xb984('0xd6')](function(_0x2d960e){if(_0x2d960e){_0x327159=_0x2d960e;var _0xa402d1=fs['readFileSync'](path[_0xb984('0x88')](config[_0xb984('0x89')],_0xb984('0xd7')),'utf8');var _0x2b99d9=ejs[_0xb984('0xd8')](_0xa402d1,{'body':_[_0xb984('0xd9')](_0x3deb31[_0xb984('0x6c')][_0xb984('0x6c')]),'bodyTitle':_0x2d8347['offlineMessageBody']});return db['ChatOfflineMessage'][_0xb984('0x67')]({'body':_0x2b99d9,'plainBody':htmlToText[_0xb984('0xda')](_0x2b99d9),'ContactId':_0x2d960e['id'],'ChatWebsiteId':_0x2d8347['id']});}})[_0xb984('0x16')](function(_0x230900){_0x51f9d2=_0x230900;if(_0x7892c7[_0xb984('0x55')]){var _0x3fed67=_0x7892c7['map'](function(_0x17818b){return{'name':_0x17818b[_0xb984('0xdb')],'basename':_0x17818b[_0xb984('0x83')],'type':_0x17818b[_0xb984('0xdc')],'ChatOfflineMessageId':_0x230900['id']};});_0x564a33=_0x3fed67[_0xb984('0x4a')](_0x48db10=>{var _0x1bf129={'filename':_0x48db10[_0xb984('0x2f')],'path':path[_0xb984('0x88')](config[_0xb984('0x89')],_0xb984('0xdd'),_0xb984('0xcd'),_0xb984('0xde'),_0xb984('0xdf'),_0x48db10[_0xb984('0xe0')])};return _0x1bf129;});if(!_0x2d8347[_0xb984('0xe1')]){return db[_0xb984('0xe2')][_0xb984('0xe3')](function(_0x25c025){return db[_0xb984('0xe4')][_0xb984('0xe5')](_0x3fed67,{'transaction':_0x25c025});});}}})[_0xb984('0x16')](function(){if(_0x51f9d2){_0x4a683e=_0x51f9d2;return db[_0xb984('0xe6')][_0xb984('0x7e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb984('0xe7'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xb984('0xe8'),'raw':!![]}]}]});}})[_0xb984('0x16')](function(_0x1453de){if(_0x1453de&&_0x1453de[_0xb984('0xe7')]&&_0x2d8347['forwardOffline']&&_0x2d8347['forwardOfflineAddress']){var _0x386213=_0x1453de['getSmtpOptions']();return respondWithRpcPromise(_0xb984('0xe9'),_0xb984('0xea'),{'account':_0x386213,'message':{'from':util[_0xb984('0x3f')](_0xb984('0xeb'),_0x1453de[_0xb984('0x2f')],_0x1453de[_0xb984('0xec')]||_0x1453de[_0xb984('0xe7')]['user']),'to':_0x2d8347[_0xb984('0xed')],'subject':_0x2d8347[_0xb984('0xee')],'html':_0x4a683e['body'],'attachments':_0x564a33}},client9003)[_0xb984('0x16')](function(){return _0x4a683e;})[_0xb984('0x20')](function(_0x2b3973){logger['error'](_0x2b3973);});}})['then'](function(){if(_0x2d8347&&_0x2d8347['openNewInteraction']&&_0x2d8347['MailAccountId']){var _0x5144b9=[];if(_0x7892c7['length']){_0x5144b9=_0x7892c7['map'](function(_0x2da5c1){return{'name':_0x2da5c1[_0xb984('0xdb')],'basename':_0x2da5c1[_0xb984('0x83')],'type':_0x2da5c1[_0xb984('0xdc')],'ChatOfflineMessageId':_0x51f9d2['id']};});}var _0x5351c1;if(!_[_0xb984('0x91')](_0x2d8347[_0xb984('0xef')])){var _0x5e2df9=_[_0xb984('0x4a')](_0x3deb31['body'],function(_0xd91a0b){return _0xd91a0b;});var _0x5944da=_[_0xb984('0xf0')](_0x5e2df9)[0x0];var _0x54c95b=_[_0xb984('0xf1')](_0x5944da,function(_0x4054bc){return _0x4054bc;});_0x5351c1=_0x54c95b[0x1][_0x2d8347[_0xb984('0xef')]];}var _0x1cf6ed={'from':_0x327159[_0xb984('0xec')],'firstName':_0x327159['firstName'],'lastName':_0x327159[_0xb984('0x3a')],'mapKey':'email','message':{'from':_0x327159['email'],'to':_0x2d8347['MailAccount'][_0xb984('0xec')],'cc':'','subject':_[_0xb984('0x91')](_0x5351c1)?_0x2d8347['offlineMessageSubject']:_0x5351c1,'messageId':'','sentAt':new Date(),'attach':_0x5144b9['length'],'attachments':_0x5144b9,'originChannel':_0xb984('0xf2'),'ChatWebsiteId':_0x2d8347['id'],'ChatOfflineMessageId':_0x4a683e['id'],'originTo':_0x2d8347['MailAccount']['email']},'body':_0x4a683e[_0xb984('0x6c')]};var _0x1923e0={'account':{'id':_0x2d8347[_0xb984('0xf3')]},'body':_0x1cf6ed,'log':_0xb984('0xf4')};return respondWithRpcPromise(_0xb984('0xf4'),_0xb984('0xf5'),_0x1923e0,client9001)['then'](function(){return _0x4a683e;})[_0xb984('0x20')](function(_0x21e3cb){logger[_0xb984('0x1c')](_0x21e3cb);});}return;})[_0xb984('0x16')](function(){if(_0x4a683e){return _0x4a683e;}})['then'](respondWithResult(_0x3c982a,null))[_0xb984('0x20')](function(){for(var _0x239446 of _0x7892c7){var _0x560a43=path[_0xb984('0x88')](config['root'],_0xb984('0xdd'),_0xb984('0xcd'),_0xb984('0xde'),_0xb984('0xdf'),_0x239446[_0xb984('0x83')]);fs_extra[_0xb984('0xf6')](_0x560a43)[_0xb984('0x20')](function(_0xf96fed){logger[_0xb984('0x1c')](_0xb984('0xf7'),_0x560a43,_0xf96fed);});}});};exports[_0xb984('0xf8')]=function(_0x470640,_0x484883){return db[_0xb984('0xba')]['find']({'where':{'id':_0x470640[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x484883,null))['then'](function(_0x1dc7cf){if(_0x1dc7cf){return _0x1dc7cf[_0xb984('0xf8')](_0x470640[_0xb984('0x6c')][_0xb984('0x80')],_[_0xb984('0xf9')](_0x470640[_0xb984('0x6c')],[_0xb984('0x80'),'id'])||{});}})[_0xb984('0x16')](respondWithResult(_0x484883,null))[_0xb984('0x20')](handleError(_0x484883,null));};exports[_0xb984('0xfa')]=function(_0x3eb419,_0x148d95){var _0x21412e={'raw':![],'where':{}};var _0x2dac8e={};var _0x230f60={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x3eb419[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x148d95,null))['then'](function(_0x306d47){if(_0x306d47){_0x2dac8e[_0xb984('0x42')]=_[_0xb984('0x50')](db[_0xb984('0xba')][_0xb984('0x4c')]);_0x2dac8e['query']=_[_0xb984('0x50')](_0x3eb419[_0xb984('0x4f')]);_0x2dac8e['filters']=_[_0xb984('0x52')](_0x2dac8e['model'],_0x2dac8e[_0xb984('0x4f')]);_0x21412e[_0xb984('0x53')]=_[_0xb984('0x52')](_0x2dac8e[_0xb984('0x42')],qs[_0xb984('0x54')](_0x3eb419[_0xb984('0x4f')]['fields']));_0x21412e[_0xb984('0x53')]=_0x21412e['attributes']['length']?_0x21412e['attributes']:_0x2dac8e[_0xb984('0x42')];if(!_0x3eb419[_0xb984('0x4f')][_0xb984('0x79')](_0xb984('0x56'))){_0x21412e[_0xb984('0x26')]=qs[_0xb984('0x26')](_0x3eb419[_0xb984('0x4f')][_0xb984('0x26')]);_0x21412e[_0xb984('0x57')]=qs[_0xb984('0x57')](_0x3eb419[_0xb984('0x4f')][_0xb984('0x57')]);}_0x21412e[_0xb984('0x58')]=qs[_0xb984('0x59')](_0x3eb419[_0xb984('0x4f')][_0xb984('0x59')]);_0x21412e[_0xb984('0x5a')]=qs[_0xb984('0x51')](_[_0xb984('0x5b')](_0x3eb419[_0xb984('0x4f')],_0x2dac8e[_0xb984('0x51')]));_0x21412e[_0xb984('0x5a')]['ChatWebsiteId']=_0x306d47['id'];if(_0x3eb419['query']['filter']){_0x21412e[_0xb984('0x5a')]=_[_0xb984('0x5d')](_0x21412e[_0xb984('0x5a')],{'$or':_[_0xb984('0x4a')](_0x21412e[_0xb984('0x53')],function(_0x316390){var _0x441031={};_0x441031[_0x316390]={'$like':'%'+_0x3eb419['query'][_0xb984('0x5c')]+'%'};return _0x441031;})});}_0x21412e=_[_0xb984('0x5d')]({},_0x21412e,_0x3eb419[_0xb984('0x5f')]);return db[_0xb984('0xba')][_0xb984('0x27')]({'where':_0x21412e[_0xb984('0x5a')]})[_0xb984('0x16')](function(_0x86780d){_0x230f60[_0xb984('0x27')]=_0x86780d;if(_0x3eb419[_0xb984('0x4f')][_0xb984('0x60')]){_0x21412e[_0xb984('0x61')]=[{'model':db[_0xb984('0xb5')],'as':_0xb984('0xfb'),'required':![]},{'model':db[_0xb984('0xfc')],'as':_0xb984('0xfd'),'attributes':[_0xb984('0x2f'),_0xb984('0xfe'),_0xb984('0xff')],'required':![]},{'model':db[_0xb984('0x100')],'as':_0xb984('0x101'),'attributes':['id',_0xb984('0x2f'),'color'],'where':_0x3eb419[_0xb984('0x4f')][_0xb984('0x102')]?{'id':_0x3eb419[_0xb984('0x4f')]['tag']}:undefined,'required':_0x3eb419[_0xb984('0x4f')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xb984('0x62')](_0x21412e);})['then'](function(_0x162eb7){_0x230f60[_0xb984('0x63')]=_0x162eb7;return _0x230f60;});}})['then'](respondWithFilteredResult(_0x148d95,_0x21412e))[_0xb984('0x20')](handleError(_0x148d95,null));};exports[_0xb984('0x103')]=function(_0x1af036,_0x5e7936){var _0x3145f8=0x0;var _0x2e9f8e=0x0;var _0x1029bb=![];var _0x2ad62e;var _0x31c9a1;return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x1af036[_0xb984('0x65')]['id']},'include':[{'model':db[_0xb984('0x99')],'as':_0xb984('0x99'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xb984('0xac')]}]}]})[_0xb984('0x16')](handleEntityNotFound(_0x5e7936,null))[_0xb984('0x16')](function(_0x4bd400){if(_0x4bd400){_0x2ad62e=_0x4bd400;return _0x4bd400[_0xb984('0x104')]({'raw':!![]});}})[_0xb984('0x16')](function(_0x2dc204){if(_0x2ad62e){if(_0x2dc204){_0x31c9a1=_0x2dc204;}}return require('../../config/license/util')['getLicense']();})[_0xb984('0x16')](function(_0x5ca21e){if(_0x5ca21e){_0x2e9f8e=_0x5ca21e[_0xb984('0x105')];_0x1029bb=_0x5ca21e['custom'];}})[_0xb984('0x16')](function(){return db[_0xb984('0xba')][_0xb984('0x27')]({'where':{'closed':![]}});})[_0xb984('0x16')](function(_0x3f70f2){_0x3145f8=_0x3f70f2;if(_0x2e9f8e&&_0x3f70f2>_0x2e9f8e){return db[_0xb984('0x106')][_0xb984('0x7e')]({'where':{'id':0x1}})['then'](function(_0x2b2d2f){if(_0x2b2d2f){_0x2b2d2f['increment'](_0xb984('0x107'));}});}})['then'](function(){var _0x4c01f7=_0x2ad62e[_0xb984('0x99')];var _0x83aa33=_0x2ad62e[_0xb984('0x9b')]||undefined;return _0x4c01f7?_0x4c01f7[_0xb984('0x9c')](_0x83aa33):!![];})['then'](function(_0x256b3d){var _0x5eee58=fs[_0xb984('0x108')](path[_0xb984('0x88')](config[_0xb984('0x89')],_0xb984('0x109')),_0xb984('0x10a'));var _0xb5c49f=_0xb984('0x10b');var _0x22d584=![];var _0x461ab4,_0x2ba2fc;if(_0x1af036[_0xb984('0x10c')]['referer']){_0x461ab4=new URL(_0x1af036[_0xb984('0x10c')]['referer'])[_0xb984('0x10d')];}else if(_0x1af036[_0xb984('0x10c')][_0xb984('0x10d')]){_0x461ab4=new URL(_0x1af036['headers'][_0xb984('0x10d')])[_0xb984('0x10d')];}else{_0x461ab4=_0xb984('0x10e');}_0x2ba2fc=typeof _0x2ad62e[_0xb984('0x68')]['split'](',')[_0xb984('0x66')](function(_0x2df7bd){return wildcardUtils[_0xb984('0x10f')](_0x2df7bd,_0x461ab4);})!=='undefined';var _0x384873={'chatVersion':_0xb5c49f,'chatWebsiteAddressOrigin':_0x2ba2fc?_0x461ab4:_0x2ad62e[_0xb984('0x68')],'remote':_0x2ad62e[_0xb984('0x110')],'query':querystring['stringify'](_['merge'](_0x2ad62e['get']({'plain':!![]}),{'customerIp':_0x1af036[_0xb984('0x10c')]['x-forwarded-for']||_0x1af036['headers']['x-real-ip']||_0x1af036[_0xb984('0x111')][_0xb984('0x112')]||_0x1af036['ip'],'referer':_0x1af036['headers'][_0xb984('0x3c')],'openedInteractions':_0x3145f8,'maxInteractions':_0x2e9f8e,'virtual':_0x1029bb[_0xb984('0x105')],'online':_0x256b3d,'custom':_0x1029bb,'address':_0x2ba2fc?_0x461ab4:null}))[_0xb984('0x113')](/'/g,'\x5c\x27')};_0x5e7936[_0xb984('0x30')](ejs['render'](Mustache[_0xb984('0xd8')](_0x5eee58,_0x384873),{'proactiveActions':_0x31c9a1,'alignment':_0x2ad62e[_0xb984('0x114')],'verticalAlignment':_0x2ad62e['verticalAlignment'],'div_color':_0x2ad62e[_0xb984('0x115')],'labelText':_0x2ad62e[_0xb984('0x116')],'text_color':_0x2ad62e[_0xb984('0x117')],'text_button_color':_0x2ad62e[_0xb984('0x118')],'button_color':_0x2ad62e['color_button'],'background_color':_0x2ad62e[_0xb984('0x119')],'hideWhenOffline':_0x2ad62e['hideWhenOffline'],'intervalId':_0x2ad62e[_0xb984('0x11a')],'isDevelopment':_0x22d584,'chatVersion':_0xb5c49f}));})['catch'](handleError(_0x5e7936,null));};exports['addApplications']=function(_0x3338a3,_0x4a7169){var _0xce8465=_0x3338a3[_0xb984('0x65')]['id'];var _0x1c3ccd=_0x3338a3['body'];var _0x1a70dc=0xc8;var _0x23fea7=null;return db['sequelize'][_0xb984('0xe3')]({'isolationLevel':db['sequelize']['Transaction'][_0xb984('0x11b')]['READ_COMMITTED']},function(_0x3c82be){return db['ChatWebsite'][_0xb984('0x7e')]({'where':{'id':_0xce8465},'transaction':_0x3c82be})[_0xb984('0x16')](function(_0x464eae){if(_0x464eae){return db['ChatApplication'][_0xb984('0x2a')]({'where':{'ChatWebsiteId':_0xce8465},'transaction':_0x3c82be})['then'](function(){var _0x3cd674=_[_0xb984('0x4a')](_0x1c3ccd,function(_0x3d961f){_0x3d961f['ChatWebsiteId']=_0xce8465;return _0x3d961f;});return db[_0xb984('0xa9')]['bulkCreate'](_0x3cd674,{'transaction':_0x3c82be});});}else{_0x1a70dc=0x194;_0x23fea7=[];}});})[_0xb984('0x16')](function(){if(_0x1a70dc!==0x194){return db[_0xb984('0xa9')][_0xb984('0x11c')]({'where':{'ChatWebsiteId':_0xce8465},'order':_0xb984('0xb1')})['then'](function(_0x1c19a7){_0x23fea7=_0x1c19a7;});}})[_0xb984('0x20')](function(_0x14478c){_0x1a70dc=0x1f4;logger[_0xb984('0x1c')](_0x14478c['stack']);if(_0x14478c[_0xb984('0x2f')]){delete _0x14478c[_0xb984('0x2f')];}_0x23fea7=_0x14478c;})[_0xb984('0x11d')](function(){if(_0x23fea7===null){_0x4a7169[_0xb984('0x21')](_0x1a70dc);}else{if(_0x1a70dc===0x1f4){_0x4a7169[_0xb984('0x22')](_0x1a70dc)[_0xb984('0x30')](_0x23fea7);}else{_0x4a7169[_0xb984('0x22')](_0x1a70dc)[_0xb984('0x24')](_0x23fea7);}}});};exports[_0xb984('0x11e')]=function(_0x5a2758,_0x1ac027){var _0x577d83={};var _0x2699c3={};var _0x4c59eb;var _0x5ea724;return db[_0xb984('0x4b')]['findOne']({'where':{'id':_0x5a2758[_0xb984('0x65')]['id']}})['then'](handleEntityNotFound(_0x1ac027,null))[_0xb984('0x16')](function(_0x224023){if(_0x224023){_0x4c59eb=_0x224023;_0x2699c3['model']=_['keys'](db[_0xb984('0xa9')]['rawAttributes']);_0x2699c3[_0xb984('0x4f')]=_['keys'](_0x5a2758[_0xb984('0x4f')]);_0x2699c3['filters']=_[_0xb984('0x52')](_0x2699c3[_0xb984('0x42')],_0x2699c3[_0xb984('0x4f')]);_0x577d83[_0xb984('0x53')]=_[_0xb984('0x52')](_0x2699c3[_0xb984('0x42')],qs[_0xb984('0x54')](_0x5a2758[_0xb984('0x4f')]['fields']));_0x577d83[_0xb984('0x53')]=_0x577d83[_0xb984('0x53')][_0xb984('0x55')]?_0x577d83[_0xb984('0x53')]:_0x2699c3[_0xb984('0x42')];_0x577d83[_0xb984('0x58')]=qs[_0xb984('0x59')](_0x5a2758[_0xb984('0x4f')][_0xb984('0x59')]);_0x577d83[_0xb984('0x5a')]=qs[_0xb984('0x51')](_[_0xb984('0x5b')](_0x5a2758['query'],_0x2699c3['filters']));if(_0x5a2758[_0xb984('0x4f')][_0xb984('0x5c')]){_0x577d83[_0xb984('0x5a')]=_[_0xb984('0x5d')](_0x577d83[_0xb984('0x5a')],{'$or':_[_0xb984('0x4a')](_0x577d83[_0xb984('0x53')],function(_0xbb1af1){var _0x3d6db4={};_0x3d6db4[_0xbb1af1]={'$like':'%'+_0x5a2758['query'][_0xb984('0x5c')]+'%'};return _0x3d6db4;})});}_0x577d83=_[_0xb984('0x5d')]({},_0x577d83,_0x5a2758['options']);return _0x4c59eb[_0xb984('0x11e')](_0x577d83);}})[_0xb984('0x16')](function(_0x1e3555){if(_0x1e3555){_0x5ea724=_0x1e3555[_0xb984('0x55')];if(!_0x5a2758[_0xb984('0x4f')][_0xb984('0x79')](_0xb984('0x56'))){_0x577d83[_0xb984('0x26')]=qs[_0xb984('0x26')](_0x5a2758[_0xb984('0x4f')][_0xb984('0x26')]);_0x577d83[_0xb984('0x57')]=qs[_0xb984('0x57')](_0x5a2758[_0xb984('0x4f')]['offset']);}return _0x4c59eb[_0xb984('0x11e')](_0x577d83);}})['then'](function(_0x45ad9f){if(_0x45ad9f){return _0x45ad9f?{'count':_0x5ea724,'rows':_0x45ad9f}:null;}})[_0xb984('0x16')](respondWithResult(_0x1ac027,null))['catch'](handleError(_0x1ac027,null));};exports['addProactiveActions']=function(_0x10965f,_0x496396){return db[_0xb984('0x11f')]['find']({'where':{'id':_0x10965f[_0xb984('0x65')]['id']}})['then'](handleEntityNotFound(_0x496396,null))[_0xb984('0x16')](function(_0x4a498d){if(_0x4a498d){return _0x4a498d['addProactiveActions'](_0x10965f[_0xb984('0x6c')][_0xb984('0x80')],_[_0xb984('0xf9')](_0x10965f['body'],[_0xb984('0x80'),'id'])||{});}})[_0xb984('0x16')](respondWithResult(_0x496396,null))[_0xb984('0x20')](handleError(_0x496396,null));};exports[_0xb984('0x104')]=function(_0x509927,_0x2f477e){var _0x5efa1e={};var _0x1220f4={};var _0x4ac8a9;var _0x215b05;return db[_0xb984('0x4b')][_0xb984('0x7e')]({'where':{'id':_0x509927[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x2f477e,null))['then'](function(_0x83930f){if(_0x83930f){_0x4ac8a9=_0x83930f;_0x1220f4[_0xb984('0x42')]=_[_0xb984('0x50')](db[_0xb984('0x120')][_0xb984('0x4c')]);_0x1220f4[_0xb984('0x4f')]=_['keys'](_0x509927[_0xb984('0x4f')]);_0x1220f4[_0xb984('0x51')]=_[_0xb984('0x52')](_0x1220f4['model'],_0x1220f4['query']);_0x5efa1e[_0xb984('0x53')]=_[_0xb984('0x52')](_0x1220f4['model'],qs[_0xb984('0x54')](_0x509927['query'][_0xb984('0x54')]));_0x5efa1e['attributes']=_0x5efa1e[_0xb984('0x53')][_0xb984('0x55')]?_0x5efa1e[_0xb984('0x53')]:_0x1220f4[_0xb984('0x42')];_0x5efa1e[_0xb984('0x58')]=qs['sort'](_0x509927['query'][_0xb984('0x59')]);_0x5efa1e[_0xb984('0x5a')]=qs['filters'](_[_0xb984('0x5b')](_0x509927[_0xb984('0x4f')],_0x1220f4[_0xb984('0x51')]));if(_0x509927[_0xb984('0x4f')]['filter']){_0x5efa1e[_0xb984('0x5a')]=_[_0xb984('0x5d')](_0x5efa1e[_0xb984('0x5a')],{'$or':_[_0xb984('0x4a')](_0x5efa1e[_0xb984('0x53')],function(_0x53dfd7){var _0x2b4b04={};_0x2b4b04[_0x53dfd7]={'$like':'%'+_0x509927[_0xb984('0x4f')][_0xb984('0x5c')]+'%'};return _0x2b4b04;})});}_0x5efa1e=_[_0xb984('0x5d')]({},_0x5efa1e,_0x509927[_0xb984('0x5f')]);return _0x4ac8a9[_0xb984('0x104')](_0x5efa1e);}})[_0xb984('0x16')](function(_0x17de2f){if(_0x17de2f){_0x215b05=_0x17de2f[_0xb984('0x55')];if(!_0x509927[_0xb984('0x4f')][_0xb984('0x79')](_0xb984('0x56'))){_0x5efa1e['limit']=qs['limit'](_0x509927[_0xb984('0x4f')]['limit']);_0x5efa1e[_0xb984('0x57')]=qs['offset'](_0x509927['query']['offset']);}return _0x4ac8a9[_0xb984('0x104')](_0x5efa1e);}})[_0xb984('0x16')](function(_0x3fdc7d){if(_0x3fdc7d){return _0x3fdc7d?{'count':_0x215b05,'rows':_0x3fdc7d}:null;}})[_0xb984('0x16')](respondWithResult(_0x2f477e,null))[_0xb984('0x20')](handleError(_0x2f477e,null));};exports[_0xb984('0x121')]=function(_0x2e9d36,_0x3d7ae9){var _0x18b112=_0x2e9d36[_0xb984('0x4f')][_0xb984('0x122')]===_0xb984('0x123')?_0xb984('0x124'):_0xb984('0x125');return db[_0xb984('0x4b')][_0xb984('0x66')]({'attributes':['id',_0x18b112],'where':{'id':_0x2e9d36[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x3d7ae9,null))[_0xb984('0x16')](function(_0x2f4779){if(_0x2f4779){var _0xd81de1=_0x2f4779[_0x18b112];var _0x1f98a1=_0xd81de1&&_0xd81de1[_0xb984('0x126')]?_0xd81de1[_0xb984('0x126')]:[];_0x3d7ae9[_0xb984('0x30')]({'fromKey':_[_0xb984('0x91')](_0xd81de1['fromKey'])?undefined:_0xd81de1['fromKey'],'count':_0x1f98a1['length'],'rows':_0x1f98a1});}})[_0xb984('0x20')](handleError(_0x3d7ae9,null));};exports[_0xb984('0x127')]=function(_0x14a46c,_0x464919){var _0x3e80f5={'raw':![],'where':{}};var _0x20c8c5={};var _0x362f2a={'count':0x0,'rows':[]};return db[_0xb984('0x4b')][_0xb984('0x7e')]({'where':{'id':_0x14a46c[_0xb984('0x65')]['id']}})['then'](handleEntityNotFound(_0x464919,null))['then'](function(_0x427a6e){if(_0x427a6e){_0x20c8c5[_0xb984('0x42')]=_[_0xb984('0x50')](db[_0xb984('0x128')][_0xb984('0x4c')]);_0x20c8c5['query']=_['keys'](_0x14a46c[_0xb984('0x4f')]);_0x20c8c5[_0xb984('0x51')]=_[_0xb984('0x52')](_0x20c8c5[_0xb984('0x42')],_0x20c8c5[_0xb984('0x4f')]);_0x3e80f5[_0xb984('0x53')]=_[_0xb984('0x52')](_0x20c8c5[_0xb984('0x42')],qs[_0xb984('0x54')](_0x14a46c[_0xb984('0x4f')]['fields']));_0x3e80f5[_0xb984('0x53')]=_0x3e80f5[_0xb984('0x53')][_0xb984('0x55')]?_0x3e80f5[_0xb984('0x53')]:_0x20c8c5[_0xb984('0x42')];if(!_0x14a46c['query'][_0xb984('0x79')]('nolimit')){_0x3e80f5[_0xb984('0x26')]=qs[_0xb984('0x26')](_0x14a46c[_0xb984('0x4f')][_0xb984('0x26')]);_0x3e80f5[_0xb984('0x57')]=qs[_0xb984('0x57')](_0x14a46c[_0xb984('0x4f')][_0xb984('0x57')]);}_0x3e80f5[_0xb984('0x58')]=qs[_0xb984('0x59')](_0x14a46c[_0xb984('0x4f')][_0xb984('0x59')]);_0x3e80f5[_0xb984('0x5a')]=qs[_0xb984('0x51')](_['pick'](_0x14a46c['query'],_0x20c8c5[_0xb984('0x51')]));_0x3e80f5[_0xb984('0x5a')][_0xb984('0x76')]=_0x427a6e['id'];if(_0x14a46c[_0xb984('0x4f')][_0xb984('0x5c')]){_0x3e80f5[_0xb984('0x5a')]=_[_0xb984('0x5d')](_0x3e80f5[_0xb984('0x5a')],{'$or':_[_0xb984('0x4a')](_0x3e80f5[_0xb984('0x53')],function(_0x501d65){var _0x38f917={};_0x38f917[_0x501d65]={'$like':'%'+_0x14a46c[_0xb984('0x4f')][_0xb984('0x5c')]+'%'};return _0x38f917;})});}_0x3e80f5=_[_0xb984('0x5d')]({},_0x3e80f5,_0x14a46c[_0xb984('0x5f')]);return db[_0xb984('0x128')][_0xb984('0x27')]({'where':_0x3e80f5['where']})[_0xb984('0x16')](function(_0x3a1c1c){_0x362f2a[_0xb984('0x27')]=_0x3a1c1c;if(_0x14a46c[_0xb984('0x4f')][_0xb984('0x60')]){_0x3e80f5[_0xb984('0x61')]=[{'all':!![]}];}else{_0x3e80f5[_0xb984('0x61')]=[{'model':db[_0xb984('0xb5')],'as':'Contact','required':![]},{'model':db[_0xb984('0xe4')],'as':_0xb984('0x129'),'required':![]}];}return db[_0xb984('0x128')]['findAll'](_0x3e80f5);})[_0xb984('0x16')](function(_0x5735ed){_0x362f2a[_0xb984('0x63')]=_0x5735ed;return _0x362f2a;});}})[_0xb984('0x16')](respondWithFilteredResult(_0x464919,_0x3e80f5))[_0xb984('0x20')](handleError(_0x464919,null));};exports[_0xb984('0x12a')]=function(_0x108963,_0x294cb9){return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0x108963[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x294cb9,null))['then'](function(_0x72bcf8){if(_0x72bcf8){return _0x72bcf8[_0xb984('0x12a')](_0x108963[_0xb984('0x6c')][_0xb984('0x80')],_[_0xb984('0xf9')](_0x108963['body'],['ids','id'])||{})[_0xb984('0xd6')](function(_0x496fbb){for(var _0x7b3434=0x0;_0x7b3434<_0x108963[_0xb984('0x6c')][_0xb984('0x80')][_0xb984('0x55')];_0x7b3434+=0x1){socket[_0xb984('0x12b')](_0xb984('0x12c'),{'UserId':Number(_0x108963['body']['ids'][_0x7b3434]),'ChatWebsiteId':Number(_0x108963[_0xb984('0x65')]['id'])});}return _0x496fbb;});}})[_0xb984('0x16')](respondWithResult(_0x294cb9,null))[_0xb984('0x20')](handleError(_0x294cb9,null));};exports['removeAgents']=function(_0xcc9c8e,_0x24bac4){return db[_0xb984('0x4b')][_0xb984('0x66')]({'where':{'id':_0xcc9c8e['params']['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x24bac4,null))[_0xb984('0x16')](function(_0x16f05e){if(_0x16f05e){return _0x16f05e[_0xb984('0x12d')](_0xcc9c8e[_0xb984('0x4f')][_0xb984('0x80')])[_0xb984('0x16')](function(){if(_[_0xb984('0x12e')](_0xcc9c8e[_0xb984('0x4f')][_0xb984('0x80')])){for(var _0x2e99bc=0x0;_0x2e99bc<_0xcc9c8e[_0xb984('0x4f')][_0xb984('0x80')][_0xb984('0x55')];_0x2e99bc+=0x1){socket[_0xb984('0x12b')]('userChatWebsite:remove',{'UserId':Number(_0xcc9c8e[_0xb984('0x4f')][_0xb984('0x80')][_0x2e99bc]),'ChatWebsiteId':Number(_0xcc9c8e['params']['id'])});}}else{socket[_0xb984('0x12b')](_0xb984('0x12f'),{'UserId':Number(_0xcc9c8e[_0xb984('0x4f')][_0xb984('0x80')]),'ChatWebsiteId':Number(_0xcc9c8e[_0xb984('0x65')]['id'])});}});}})[_0xb984('0x16')](respondWithStatusCode(_0x24bac4,null))[_0xb984('0x20')](handleError(_0x24bac4,null));};exports['getAgents']=function(_0x314eac,_0x19fcd0){var _0x573a4c={};var _0xbed419={};var _0x24787b;var _0x30484e;return db['ChatWebsite'][_0xb984('0x7e')]({'where':{'id':_0x314eac[_0xb984('0x65')]['id']}})[_0xb984('0x16')](handleEntityNotFound(_0x19fcd0,null))[_0xb984('0x16')](function(_0x5ba451){if(_0x5ba451){_0x24787b=_0x5ba451;_0xbed419[_0xb984('0x42')]=_[_0xb984('0x50')](db[_0xb984('0xfc')][_0xb984('0x4c')]);_0xbed419[_0xb984('0x4f')]=_[_0xb984('0x50')](_0x314eac[_0xb984('0x4f')]);_0xbed419[_0xb984('0x51')]=_[_0xb984('0x52')](_0xbed419[_0xb984('0x42')],_0xbed419['query']);_0x573a4c[_0xb984('0x53')]=_['intersection'](_0xbed419[_0xb984('0x42')],qs[_0xb984('0x54')](_0x314eac[_0xb984('0x4f')][_0xb984('0x54')]));_0x573a4c[_0xb984('0x53')]=_0x573a4c[_0xb984('0x53')][_0xb984('0x55')]?_0x573a4c[_0xb984('0x53')]:_0xbed419[_0xb984('0x42')];_0x573a4c[_0xb984('0x58')]=qs[_0xb984('0x59')](_0x314eac[_0xb984('0x4f')][_0xb984('0x59')]);_0x573a4c['where']=qs[_0xb984('0x51')](_['pick'](_0x314eac[_0xb984('0x4f')],_0xbed419['filters']));if(_0x314eac[_0xb984('0x4f')]['filter']){_0x573a4c[_0xb984('0x5a')]=_[_0xb984('0x5d')](_0x573a4c[_0xb984('0x5a')],{'$or':_[_0xb984('0x4a')](_0x573a4c[_0xb984('0x53')],function(_0x2a212a){var _0x36dfa1={};_0x36dfa1[_0x2a212a]={'$like':'%'+_0x314eac[_0xb984('0x4f')][_0xb984('0x5c')]+'%'};return _0x36dfa1;})});}_0x573a4c=_['merge']({},_0x573a4c,_0x314eac['options']);return _0x24787b[_0xb984('0x130')](_0x573a4c);}})[_0xb984('0x16')](function(_0x4bd4cc){if(_0x4bd4cc){_0x30484e=_0x4bd4cc[_0xb984('0x55')];if(!_0x314eac[_0xb984('0x4f')][_0xb984('0x79')](_0xb984('0x56'))){_0x573a4c[_0xb984('0x26')]=qs[_0xb984('0x26')](_0x314eac['query'][_0xb984('0x26')]);_0x573a4c[_0xb984('0x57')]=qs[_0xb984('0x57')](_0x314eac[_0xb984('0x4f')][_0xb984('0x57')]);}return _0x24787b[_0xb984('0x130')](_0x573a4c);}})['then'](function(_0x54cbef){if(_0x54cbef){return _0x54cbef?{'count':_0x30484e,'rows':_0x54cbef}:null;}})[_0xb984('0x16')](respondWithResult(_0x19fcd0,null))[_0xb984('0x20')](handleError(_0x19fcd0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 0922672..b13d553 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 _0xbc8d=['emit','hasOwnProperty','exports','events','ChatWebsite','setMaxListeners','save','update'];(function(_0x127796,_0xd2a09b){var _0x2113eb=function(_0x34f9ef){while(--_0x34f9ef){_0x127796['push'](_0x127796['shift']());}};_0x2113eb(++_0xd2a09b);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xdbc8('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xdbc8('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xdbc8('0x2')](0x0);var events={'afterCreate':_0xdbc8('0x3'),'afterUpdate':_0xdbc8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x287649){return function(_0x172112,_0x2dd539,_0x4e8c02){ChatWebsiteEvents[_0xdbc8('0x5')](_0x287649+':'+_0x172112['id'],_0x172112);ChatWebsiteEvents[_0xdbc8('0x5')](_0x287649,_0x172112);_0x4e8c02(null);};}for(var e in events){if(events[_0xdbc8('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xdbc8('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3c6d=['../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x3c6d,0x199));var _0xd3c6=function(_0x1a9e16,_0x7485e0){_0x1a9e16=_0x1a9e16-0x0;var _0x344653=_0x3c6d[_0x1a9e16];return _0x344653;};'use strict';var EventEmitter=require(_0xd3c6('0x0'));var ChatWebsite=require(_0xd3c6('0x1'))['db'][_0xd3c6('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd3c6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd3c6('0x4'),'afterDestroy':_0xd3c6('0x5')};function emitEvent(_0x2a3a62){return function(_0x28b706,_0x26c5b9,_0x236c6b){ChatWebsiteEvents['emit'](_0x2a3a62+':'+_0x28b706['id'],_0x28b706);ChatWebsiteEvents[_0xd3c6('0x6')](_0x2a3a62,_0x28b706);_0x236c6b(null);};}for(var e in events){if(events[_0xd3c6('0x7')](e)){var event=events[e];ChatWebsite[_0xd3c6('0x8')](e,emitEvent(event));}}module[_0xd3c6('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 169cae9..76dcc95 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 _0x77f1=['define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x30126e,_0x17339f){var _0x56ee2c=function(_0xc1dd88){while(--_0xc1dd88){_0x30126e['push'](_0x30126e['shift']());}};_0x56ee2c(++_0x17339f);}(_0x77f1,0x10b));var _0x177f=function(_0x44cfab,_0x599f0b){_0x44cfab=_0x44cfab-0x0;var _0x5cdb3b=_0x77f1[_0x44cfab];return _0x5cdb3b;};'use strict';var _=require(_0x177f('0x0'));var util=require('util');var logger=require(_0x177f('0x1'))(_0x177f('0x2'));var moment=require(_0x177f('0x3'));var BPromise=require('bluebird');var rp=require(_0x177f('0x4'));var fs=require('fs');var path=require(_0x177f('0x5'));var rimraf=require(_0x177f('0x6'));var config=require(_0x177f('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x177f('0x8')]=function(_0x12828d,_0x11cac8){return _0x12828d[_0x177f('0x9')](_0x177f('0xa'),attributes,{'tableName':_0x177f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a8b=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','util'];(function(_0x3cc17b,_0x528851){var _0x512f29=function(_0x423224){while(--_0x423224){_0x3cc17b['push'](_0x3cc17b['shift']());}};_0x512f29(++_0x528851);}(_0x1a8b,0x112));var _0xb1a8=function(_0x29ad5c,_0x90d04){_0x29ad5c=_0x29ad5c-0x0;var _0x4d7a32=_0x1a8b[_0x29ad5c];return _0x4d7a32;};'use strict';var _=require(_0xb1a8('0x0'));var util=require(_0xb1a8('0x1'));var logger=require(_0xb1a8('0x2'))(_0xb1a8('0x3'));var moment=require('moment');var BPromise=require(_0xb1a8('0x4'));var rp=require(_0xb1a8('0x5'));var fs=require('fs');var path=require(_0xb1a8('0x6'));var rimraf=require('rimraf');var config=require(_0xb1a8('0x7'));var attributes=require(_0xb1a8('0x8'));module[_0xb1a8('0x9')]=function(_0x38b044,_0x3c8351){return _0x38b044[_0xb1a8('0xa')]('ChatWebsite',attributes,{'tableName':_0xb1a8('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 6c8e050..4e6f4af 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 _0x80ea=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis'];(function(_0x5418ad,_0x40742f){var _0x2cae56=function(_0x36d317){while(--_0x36d317){_0x5418ad['push'](_0x5418ad['shift']());}};_0x2cae56(++_0x40742f);}(_0x80ea,0x7f));var _0xa80e=function(_0x5e2ea7,_0x1f6528){_0x5e2ea7=_0x5e2ea7-0x0;var _0x51d948=_0x80ea[_0x5e2ea7];return _0x51d948;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa80e('0x0'));var BPromise=require(_0xa80e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa80e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa80e('0x3'));var logger=require(_0xa80e('0x4'))(_0xa80e('0x5'));var config=require(_0xa80e('0x6'));var jayson=require(_0xa80e('0x7'));var client=jayson[_0xa80e('0x8')][_0xa80e('0x9')]({'port':0x232a});config[_0xa80e('0xa')]=_[_0xa80e('0xb')](config[_0xa80e('0xa')],{'host':_0xa80e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa80e('0xa')]));require(_0xa80e('0xd'))[_0xa80e('0xe')](socket);function respondWithRpcPromise(_0x5c7259,_0x1b747d,_0x30c197){return new BPromise(function(_0x3eabc6,_0x48884c){return client[_0xa80e('0xf')](_0x5c7259,_0x30c197)[_0xa80e('0x10')](function(_0x357912){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1b747d,_0xa80e('0x11'));logger[_0xa80e('0x12')](_0xa80e('0x13'),_0x1b747d,_0xa80e('0x11'),JSON[_0xa80e('0x14')](_0x357912));if(_0x357912['error']){if(_0x357912[_0xa80e('0x15')][_0xa80e('0x16')]===0x1f4){logger[_0xa80e('0x15')](_0xa80e('0x17'),_0x1b747d,_0x357912[_0xa80e('0x15')][_0xa80e('0x18')]);return _0x48884c(_0x357912[_0xa80e('0x15')][_0xa80e('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1b747d,_0x357912[_0xa80e('0x15')]['message']);return _0x3eabc6(_0x357912['error'][_0xa80e('0x18')]);}else{logger['info'](_0xa80e('0x17'),_0x1b747d,_0xa80e('0x11'));_0x3eabc6(_0x357912['result'][_0xa80e('0x18')]);}})[_0xa80e('0x19')](function(_0x5def6b){logger[_0xa80e('0x15')](_0xa80e('0x17'),_0x1b747d,_0x5def6b);_0x48884c(_0x5def6b);});});} \ No newline at end of file +var _0x12cc=['redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x12cc,0x1ed));var _0xc12c=function(_0x583e92,_0x18cf7b){_0x583e92=_0x583e92-0x0;var _0x3ec500=_0x12cc[_0x583e92];return _0x3ec500;};'use strict';var _=require(_0xc12c('0x0'));var util=require(_0xc12c('0x1'));var moment=require(_0xc12c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc12c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc12c('0x4'))['db'];var utils=require(_0xc12c('0x5'));var logger=require(_0xc12c('0x6'))(_0xc12c('0x7'));var config=require(_0xc12c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc12c('0x9')][_0xc12c('0xa')]({'port':0x232a});config[_0xc12c('0xb')]=_[_0xc12c('0xc')](config[_0xc12c('0xb')],{'host':_0xc12c('0xd'),'port':0x18eb});var socket=require(_0xc12c('0xe'))(new Redis(config[_0xc12c('0xb')]));require(_0xc12c('0xf'))[_0xc12c('0x10')](socket);function respondWithRpcPromise(_0xda3f92,_0x3995fc,_0x2ce1c7){return new BPromise(function(_0x5c4d65,_0x1cc600){return client[_0xc12c('0x11')](_0xda3f92,_0x2ce1c7)[_0xc12c('0x12')](function(_0x316645){logger[_0xc12c('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x3995fc,_0xc12c('0x14'));logger['debug'](_0xc12c('0x15'),_0x3995fc,_0xc12c('0x14'),JSON['stringify'](_0x316645));if(_0x316645[_0xc12c('0x16')]){if(_0x316645[_0xc12c('0x16')][_0xc12c('0x17')]===0x1f4){logger[_0xc12c('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x3995fc,_0x316645[_0xc12c('0x16')][_0xc12c('0x18')]);return _0x1cc600(_0x316645[_0xc12c('0x16')][_0xc12c('0x18')]);}logger['error'](_0xc12c('0x19'),_0x3995fc,_0x316645[_0xc12c('0x16')][_0xc12c('0x18')]);return _0x5c4d65(_0x316645[_0xc12c('0x16')][_0xc12c('0x18')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3995fc,_0xc12c('0x14'));_0x5c4d65(_0x316645[_0xc12c('0x1a')][_0xc12c('0x18')]);}})[_0xc12c('0x1b')](function(_0x4783cb){logger['error'](_0xc12c('0x19'),_0x3995fc,_0x4783cb);_0x1cc600(_0x4783cb);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c6f4f67..6ab0780 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 _0xee87=['length','chatWebsite:','./chatWebsite.events','save','removeListener','register'];(function(_0x46dbc2,_0x276ffd){var _0xd57d08=function(_0x4da39c){while(--_0x4da39c){_0x46dbc2['push'](_0x46dbc2['shift']());}};_0xd57d08(++_0x276ffd);}(_0xee87,0x68));var _0x7ee8=function(_0x146a84,_0x5b5a25){_0x146a84=_0x146a84-0x0;var _0x496ac4=_0xee87[_0x146a84];return _0x496ac4;};'use strict';var ChatWebsiteEvents=require(_0x7ee8('0x0'));var events=[_0x7ee8('0x1'),'remove','update'];function createListener(_0xbdef93,_0x574d3d){return function(_0x37e951){_0x574d3d['emit'](_0xbdef93,_0x37e951);};}function removeListener(_0x18429f,_0x1197d9){return function(){ChatWebsiteEvents[_0x7ee8('0x2')](_0x18429f,_0x1197d9);};}exports[_0x7ee8('0x3')]=function(_0x487856){for(var _0x1ab390=0x0,_0x524464=events[_0x7ee8('0x4')];_0x1ab390<_0x524464;_0x1ab390++){var _0x581911=events[_0x1ab390];var _0x825645=createListener(_0x7ee8('0x5')+_0x581911,_0x487856);ChatWebsiteEvents['on'](_0x581911,_0x825645);}}; \ No newline at end of file +var _0x70b2=['removeListener','register','length','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x2c4260,_0x4dca4e){var _0x230e22=function(_0x1fcce7){while(--_0x1fcce7){_0x2c4260['push'](_0x2c4260['shift']());}};_0x230e22(++_0x4dca4e);}(_0x70b2,0x14d));var _0x270b=function(_0x4795b6,_0x525259){_0x4795b6=_0x4795b6-0x0;var _0x2ed611=_0x70b2[_0x4795b6];return _0x2ed611;};'use strict';var ChatWebsiteEvents=require(_0x270b('0x0'));var events=['save',_0x270b('0x1'),_0x270b('0x2')];function createListener(_0x59fbbf,_0x503f17){return function(_0x5a5d8e){_0x503f17['emit'](_0x59fbbf,_0x5a5d8e);};}function removeListener(_0x21d2a0,_0x4d6647){return function(){ChatWebsiteEvents[_0x270b('0x3')](_0x21d2a0,_0x4d6647);};}exports[_0x270b('0x4')]=function(_0x2402e9){for(var _0x40a4ad=0x0,_0x13971d=events[_0x270b('0x5')];_0x40a4ad<_0x13971d;_0x40a4ad++){var _0x2f42f5=events[_0x40a4ad];var _0x4201f3=createListener(_0x270b('0x6')+_0x2f42f5,_0x2402e9);ChatWebsiteEvents['on'](_0x2f42f5,_0x4201f3);}}; \ 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 b2f1a17..7cacc8b 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 _0x24bb=['test','exports','../../../utils/misc','url','localhost','replace','([\x5cw]+)'];(function(_0x1dece9,_0x2cd405){var _0x449378=function(_0x13b0ec){while(--_0x13b0ec){_0x1dece9['push'](_0x1dece9['shift']());}};_0x449378(++_0x2cd405);}(_0x24bb,0x19f));var _0xb24b=function(_0x35d182,_0x546ed3){_0x35d182=_0x35d182-0x0;var _0x4eb48a=_0x24bb[_0x35d182];return _0x4eb48a;};var escapeRegExp=require(_0xb24b('0x0'))['escapeRegExp'];var URL=require(_0xb24b('0x1'))['URL'];function testWildcardValidity(_0x2f062f){var _0x10f8ed=!![];try{new URL(_0x2f062f['replace']('*',_0xb24b('0x2')));}catch(_0x48ff68){_0x10f8ed=![];}return _0x10f8ed&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x2f062f);}function testWebsiteWithWildcard(_0x2af39f,_0x4062b5){var _0x45588a;var _0x51e19e=escapeRegExp(_0x2af39f['trim']()[_0xb24b('0x3')](/\/$/,''))[_0xb24b('0x3')]('\x5c*',_0xb24b('0x4'));try{new URL(_0x2af39f[_0xb24b('0x3')]('\x5c*',_0xb24b('0x2')));_0x45588a=new RegExp(_0x51e19e)[_0xb24b('0x5')](_0x4062b5);}catch(_0x268f76){_0x45588a=![];}return _0x45588a;}module[_0xb24b('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xa76e=['replace','exports','escapeRegExp','url','localhost','test'];(function(_0x137d0c,_0x133d7e){var _0x51f5ea=function(_0x28b1e6){while(--_0x28b1e6){_0x137d0c['push'](_0x137d0c['shift']());}};_0x51f5ea(++_0x133d7e);}(_0xa76e,0xfe));var _0xea76=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xa76e[_0x4fde08];return _0x12e725;};var escapeRegExp=require('../../../utils/misc')[_0xea76('0x0')];var URL=require(_0xea76('0x1'))['URL'];function testWildcardValidity(_0x5d448a){var _0x3bfa22=!![];try{new URL(_0x5d448a['replace']('*',_0xea76('0x2')));}catch(_0x368f89){_0x3bfa22=![];}return _0x3bfa22&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xea76('0x3')](_0x5d448a);}function testWebsiteWithWildcard(_0x4ed094,_0x273c1b){var _0x48ff4f;var _0x337097=escapeRegExp(_0x4ed094['trim']()[_0xea76('0x4')](/\/$/,''))[_0xea76('0x4')]('\x5c*','([\x5cw]+)');try{new URL(_0x4ed094['replace']('\x5c*',_0xea76('0x2')));_0x48ff4f=new RegExp(_0x337097)[_0xea76('0x3')](_0x273c1b);}catch(_0x1c6723){_0x48ff4f=![];}return _0x48ff4f;}module[_0xea76('0x5')]={'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 f5e4acf..ed97ff4 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 _0xe290=['getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','post','create','/:id/canned_answers','diskStorage','join','root','format','%s-%s','single','server/files/images/avatars/','now','file','addAvatar','originalname','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','/:id/users','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','/:id/dispositions'];(function(_0x1de2e2,_0x55f13c){var _0x4f02e7=function(_0x415dee){while(--_0x415dee){_0x1de2e2['push'](_0x1de2e2['shift']());}};_0x4f02e7(++_0x55f13c);}(_0xe290,0xbb));var _0x0e29=function(_0x3fec1f,_0x563512){_0x3fec1f=_0x3fec1f-0x0;var _0x5cb79b=_0xe290[_0x3fec1f];return _0x5cb79b;};'use strict';var multer=require(_0x0e29('0x0'));var util=require(_0x0e29('0x1'));var path=require(_0x0e29('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e29('0x3'));var router=express[_0x0e29('0x4')]();var fs_extra=require(_0x0e29('0x5'));var auth=require(_0x0e29('0x6'));var interaction=require(_0x0e29('0x7'));var config=require(_0x0e29('0x8'));var controller=require('./chatWebsite.controller');router[_0x0e29('0x9')]('/',auth[_0x0e29('0xa')](),controller['index']);router[_0x0e29('0x9')]('/describe',auth[_0x0e29('0xa')](),controller[_0x0e29('0xb')]);router[_0x0e29('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0e29('0xc')]);router[_0x0e29('0x9')](_0x0e29('0xd'),auth[_0x0e29('0xa')](),controller['getDispositions']);router[_0x0e29('0x9')]('/:id/canned_answers',auth[_0x0e29('0xa')](),controller[_0x0e29('0xe')]);router[_0x0e29('0x9')](_0x0e29('0xf'),controller[_0x0e29('0x10')]);router[_0x0e29('0x9')](_0x0e29('0x11'),controller['getAvatar']);router['get'](_0x0e29('0x12'),controller[_0x0e29('0x13')]);router[_0x0e29('0x9')](_0x0e29('0x14'),controller[_0x0e29('0x15')]);router['get'](_0x0e29('0x16'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x17')]);router[_0x0e29('0x9')](_0x0e29('0x18'),controller[_0x0e29('0x19')]);router[_0x0e29('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x0e29('0x1a'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x1b')]);router[_0x0e29('0x9')]('/:id/fields',controller[_0x0e29('0x1c')]);router[_0x0e29('0x9')]('/:id/offline_messages',auth[_0x0e29('0xa')](),controller[_0x0e29('0x1d')]);router[_0x0e29('0x9')]('/:id/users',auth[_0x0e29('0xa')](),controller['getAgents']);router[_0x0e29('0x1e')]('/',auth[_0x0e29('0xa')](),controller[_0x0e29('0x1f')]);router['post'](_0x0e29('0xd'),auth[_0x0e29('0xa')](),controller['addDisposition']);router[_0x0e29('0x1e')](_0x0e29('0x20'),auth[_0x0e29('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x47cace,_0x544947,_0x5bf85c){_0x5bf85c(null,path[_0x0e29('0x22')](config[_0x0e29('0x23')],'server/files/images/logos/'));},'filename':function(_0x44d494,_0x4fa9af,_0x14a34c){_0x14a34c(null,util[_0x0e29('0x24')](_0x0e29('0x25'),Date['now'](),_0x4fa9af['originalname']));}})});router['post'](_0x0e29('0xf'),upload[_0x0e29('0x26')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x1f3a7e,_0x19b20f,_0x1a3c10){_0x1a3c10(null,path['join'](config[_0x0e29('0x23')],_0x0e29('0x27')));},'filename':function(_0x14ff65,_0x2856ec,_0x23f490){_0x23f490(null,util[_0x0e29('0x24')](_0x0e29('0x25'),Date[_0x0e29('0x28')](),_0x2856ec['originalname']));}})});router[_0x0e29('0x1e')](_0x0e29('0x11'),upload[_0x0e29('0x26')](_0x0e29('0x29')),controller[_0x0e29('0x2a')]);var upload=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x329cae,_0x40e8f1,_0x4d3fa7){_0x4d3fa7(null,path[_0x0e29('0x22')](config[_0x0e29('0x23')],'server/files/images/avatars/'));},'filename':function(_0x35277d,_0x927f26,_0x2cfd71){_0x2cfd71(null,util[_0x0e29('0x24')](_0x0e29('0x25'),Date['now'](),_0x927f26[_0x0e29('0x2b')]));}})});router[_0x0e29('0x1e')](_0x0e29('0x12'),upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x9901c5,_0x5218b0,_0x49d918){_0x49d918(null,path[_0x0e29('0x22')](config[_0x0e29('0x23')],_0x0e29('0x27')));},'filename':function(_0x1d4ff7,_0x44188c,_0x41183e){_0x41183e(null,util[_0x0e29('0x24')](_0x0e29('0x25'),Date[_0x0e29('0x28')](),_0x44188c[_0x0e29('0x2b')]));}})});router[_0x0e29('0x1e')](_0x0e29('0x14'),upload[_0x0e29('0x26')]('file'),controller[_0x0e29('0x2c')]);router[_0x0e29('0x1e')](_0x0e29('0x2d'),controller[_0x0e29('0x2e')]);const offlineUploadMulter=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x25dea7,_0xcc17ca,_0x496d34){const _0x2e419e=path[_0x0e29('0x22')](config[_0x0e29('0x23')],_0x0e29('0x2f'),_0x0e29('0x30'),_0x0e29('0x31'));fs_extra[_0x0e29('0x32')](_0x2e419e,function(){_0x496d34(null,_0x2e419e);});},'filename':function(_0x14b7b3,_0x1a71a5,_0x42e364){const _0x7f5323=_0x1a71a5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1dc8c1=path[_0x0e29('0x33')](_0x7f5323);const _0x1722af=Date['now']()+'-'+_0x7f5323[_0x0e29('0x34')](_0x1dc8c1,'')+_0x1dc8c1;_0x42e364(null,_0x1722af);}})});router[_0x0e29('0x1e')](_0x0e29('0x35'),offlineUploadMulter[_0x0e29('0x36')](),controller[_0x0e29('0x37')]);router['post'](_0x0e29('0x16'),auth['isAuthenticated'](),controller[_0x0e29('0x38')]);router['post'](_0x0e29('0x39'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x3a')]);router[_0x0e29('0x1e')](_0x0e29('0x1a'),auth[_0x0e29('0xa')](),controller['addProactiveActions']);router['post'](_0x0e29('0x3b'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x0e29('0x3c'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x3d')]);router[_0x0e29('0x3e')]('/:id',auth['isAuthenticated'](),controller[_0x0e29('0x3f')]);router['delete'](_0x0e29('0xd'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x40')]);router[_0x0e29('0x3e')](_0x0e29('0x20'),auth['isAuthenticated'](),controller[_0x0e29('0x41')]);router[_0x0e29('0x3e')](_0x0e29('0x3b'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x42')]);module['exports']=router; \ No newline at end of file +var _0x6eff=['addProactiveActions','/:id/users','addAgents','update','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','post','addDisposition','addAnswer','diskStorage','root','format','%s-%s','now','originalname','/:id/logo','single','addLogo','join','server/files/images/avatars/','/:id/avatar','file','addAvatar','addCustomerAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','offline','addApplications'];(function(_0x75da66,_0x171a52){var _0x2aefc0=function(_0x590cea){while(--_0x590cea){_0x75da66['push'](_0x75da66['shift']());}};_0x2aefc0(++_0x171a52);}(_0x6eff,0xce));var _0xf6ef=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x6eff[_0x18cac4];return _0x2227c6;};'use strict';var multer=require(_0xf6ef('0x0'));var util=require('util');var path=require(_0xf6ef('0x1'));var timeout=require(_0xf6ef('0x2'));var express=require(_0xf6ef('0x3'));var router=express[_0xf6ef('0x4')]();var fs_extra=require(_0xf6ef('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6ef('0x6'));var controller=require(_0xf6ef('0x7'));router['get']('/',auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x9')]);router[_0xf6ef('0xa')](_0xf6ef('0xb'),auth[_0xf6ef('0x8')](),controller[_0xf6ef('0xc')]);router[_0xf6ef('0xa')](_0xf6ef('0xd'),auth['isAuthenticated'](),controller[_0xf6ef('0xe')]);router[_0xf6ef('0xa')](_0xf6ef('0xf'),auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x10')]);router['get'](_0xf6ef('0x11'),auth['isAuthenticated'](),controller[_0xf6ef('0x12')]);router['get']('/:id/logo',controller[_0xf6ef('0x13')]);router['get']('/:id/avatar',controller[_0xf6ef('0x14')]);router[_0xf6ef('0xa')]('/:id/customer_avatar',controller[_0xf6ef('0x15')]);router[_0xf6ef('0xa')](_0xf6ef('0x16'),controller[_0xf6ef('0x17')]);router[_0xf6ef('0xa')](_0xf6ef('0x18'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xf6ef('0xa')](_0xf6ef('0x19'),controller[_0xf6ef('0x1a')]);router[_0xf6ef('0xa')](_0xf6ef('0x1b'),auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x1c')]);router[_0xf6ef('0xa')](_0xf6ef('0x1d'),auth['isAuthenticated'](),controller[_0xf6ef('0x1e')]);router[_0xf6ef('0xa')](_0xf6ef('0x1f'),controller['getFields']);router[_0xf6ef('0xa')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xf6ef('0x20')]('/',auth[_0xf6ef('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x21')]);router[_0xf6ef('0x20')](_0xf6ef('0x11'),auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x22')]);var upload=multer({'storage':multer[_0xf6ef('0x23')]({'destination':function(_0x4e5c35,_0xe4c46c,_0x3ee193){_0x3ee193(null,path['join'](config[_0xf6ef('0x24')],'server/files/images/logos/'));},'filename':function(_0x1548c1,_0x1fce5a,_0x357bd2){_0x357bd2(null,util[_0xf6ef('0x25')](_0xf6ef('0x26'),Date[_0xf6ef('0x27')](),_0x1fce5a[_0xf6ef('0x28')]));}})});router[_0xf6ef('0x20')](_0xf6ef('0x29'),upload[_0xf6ef('0x2a')]('file'),controller[_0xf6ef('0x2b')]);var upload=multer({'storage':multer[_0xf6ef('0x23')]({'destination':function(_0x2dfe1a,_0xb68853,_0x4bdcdb){_0x4bdcdb(null,path[_0xf6ef('0x2c')](config[_0xf6ef('0x24')],_0xf6ef('0x2d')));},'filename':function(_0x30cd2a,_0x53ed60,_0x1f413f){_0x1f413f(null,util[_0xf6ef('0x25')](_0xf6ef('0x26'),Date[_0xf6ef('0x27')](),_0x53ed60[_0xf6ef('0x28')]));}})});router[_0xf6ef('0x20')](_0xf6ef('0x2e'),upload[_0xf6ef('0x2a')](_0xf6ef('0x2f')),controller[_0xf6ef('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4affbd,_0x4e1af6,_0x3a1c46){_0x3a1c46(null,path[_0xf6ef('0x2c')](config['root'],_0xf6ef('0x2d')));},'filename':function(_0x471ae2,_0xb61091,_0x298159){_0x298159(null,util['format']('%s-%s',Date[_0xf6ef('0x27')](),_0xb61091['originalname']));}})});router[_0xf6ef('0x20')]('/:id/customer_avatar',upload[_0xf6ef('0x2a')](_0xf6ef('0x2f')),controller[_0xf6ef('0x31')]);var upload=multer({'storage':multer[_0xf6ef('0x23')]({'destination':function(_0x2cd821,_0x16dbcf,_0xed822f){_0xed822f(null,path['join'](config[_0xf6ef('0x24')],'server/files/images/avatars/'));},'filename':function(_0x1e1670,_0x44f4cd,_0x81b1bb){_0x81b1bb(null,util[_0xf6ef('0x25')](_0xf6ef('0x26'),Date[_0xf6ef('0x27')](),_0x44f4cd[_0xf6ef('0x28')]));}})});router[_0xf6ef('0x20')](_0xf6ef('0x16'),upload['single'](_0xf6ef('0x2f')),controller['addSystemAvatar']);router['post'](_0xf6ef('0x32'),controller[_0xf6ef('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xf6ef('0x23')]({'destination':function(_0x1a6b60,_0x12cddd,_0x3cd71d){const _0x355dc5=path['join'](config['root'],'server/files',_0xf6ef('0x34'),_0xf6ef('0x35'));fs_extra[_0xf6ef('0x36')](_0x355dc5,function(){_0x3cd71d(null,_0x355dc5);});},'filename':function(_0x4f26dc,_0x120f12,_0x59c315){const _0x14b922=_0x120f12['originalname'][_0xf6ef('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x7d7970=path['extname'](_0x14b922);const _0xd9cd8f=Date['now']()+'-'+_0x14b922['replace'](_0x7d7970,'')+_0x7d7970;_0x59c315(null,_0xd9cd8f);}})});router[_0xf6ef('0x20')]('/:id/offline',offlineUploadMulter['any'](),controller[_0xf6ef('0x38')]);router['post'](_0xf6ef('0x18'),auth[_0xf6ef('0x8')](),controller['addInteraction']);router[_0xf6ef('0x20')](_0xf6ef('0x1b'),auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x39')]);router[_0xf6ef('0x20')](_0xf6ef('0x1d'),auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x3a')]);router[_0xf6ef('0x20')](_0xf6ef('0x3b'),auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x3c')]);router['put'](_0xf6ef('0xd'),auth['isAuthenticated'](),controller[_0xf6ef('0x3d')]);router[_0xf6ef('0x3e')](_0xf6ef('0xd'),auth[_0xf6ef('0x8')](),controller['destroy']);router['delete'](_0xf6ef('0xf'),auth[_0xf6ef('0x8')](),controller['removeDispositions']);router[_0xf6ef('0x3e')](_0xf6ef('0x11'),auth[_0xf6ef('0x8')](),controller[_0xf6ef('0x3f')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xf6ef('0x40')]);module[_0xf6ef('0x41')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index dda3679..b1dbce3 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 _0xdd80=['beaver-logger/server','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','exports'];(function(_0x573992,_0x6e6ba8){var _0x56d21b=function(_0x46971e){while(--_0x46971e){_0x573992['push'](_0x573992['shift']());}};_0x56d21b(++_0x6e6ba8);}(_0xdd80,0xc4));var _0x0dd8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xdd80[_0x501510];return _0x1e6ee5;};var beaverLogger=require(_0x0dd8('0x0'));var express=require('express');var auth=require(_0x0dd8('0x1'));var config=require(_0x0dd8('0x2'));var router=express[_0x0dd8('0x3')]();var isProduction=config[_0x0dd8('0x4')]===_0x0dd8('0x5')||![];function clientSideLogs(_0x566415,_0x4b9612,_0x109a1d){var _0x5cf904=_0x566415[_0x0dd8('0x6')][_0x0dd8('0x7')](_0x0dd8('0x8'));if(!_0x5cf904){throw new Error(_0x0dd8('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x0dd8('0xa'),'logger':_0x5cf904,'enableCors':!isProduction})(_0x566415,_0x4b9612,_0x109a1d);}router[_0x0dd8('0xb')](auth[_0x0dd8('0xc')](),clientSideLogs);module[_0x0dd8('0xd')]=router; \ No newline at end of file +var _0x28d6=['use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env','production','get','expressEndpoint','/client-logs'];(function(_0x407844,_0x47eedc){var _0x36f5df=function(_0x31ee6d){while(--_0x31ee6d){_0x407844['push'](_0x407844['shift']());}};_0x36f5df(++_0x47eedc);}(_0x28d6,0xff));var _0x628d=function(_0x1e0139,_0x4970a3){_0x1e0139=_0x1e0139-0x0;var _0xbfc2ba=_0x28d6[_0x1e0139];return _0xbfc2ba;};var beaverLogger=require(_0x628d('0x0'));var express=require(_0x628d('0x1'));var auth=require(_0x628d('0x2'));var config=require('../config/environment');var router=express[_0x628d('0x3')]();var isProduction=config[_0x628d('0x4')]===_0x628d('0x5')||![];function clientSideLogs(_0x5d9008,_0x190721,_0x407b82){var _0x5b17d8=_0x5d9008['app'][_0x628d('0x6')]('client-side-logger');if(!_0x5b17d8){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x628d('0x7')]({'uri':_0x628d('0x8'),'logger':_0x5b17d8,'enableCors':!isProduction})(_0x5d9008,_0x190721,_0x407b82);}router[_0x628d('0x9')](auth[_0x628d('0xa')](),clientSideLogs);module[_0x628d('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 02cb996..c2f56b7 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 _0x3fa8=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x44c36f,_0x1f93f6){var _0x1e1c7a=function(_0x267646){while(--_0x267646){_0x44c36f['push'](_0x44c36f['shift']());}};_0x1e1c7a(++_0x1f93f6);}(_0x3fa8,0x8c));var _0x83fa=function(_0x155935,_0x46f524){_0x155935=_0x155935-0x0;var _0x44c310=_0x3fa8[_0x155935];return _0x44c310;};'use strict';var Sequelize=require('sequelize');module[_0x83fa('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x83fa('0x1')](_0x83fa('0x2'),_0x83fa('0x3'),_0x83fa('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x83fa('0x1')](_0x83fa('0x5'),_0x83fa('0x6'))},'data1':{'type':Sequelize[_0x83fa('0x7')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x83fa('0x7')],'comment':_0x83fa('0x8')},'data3':{'type':Sequelize[_0x83fa('0x7')],'comment':_0x83fa('0x9')},'data4':{'type':Sequelize[_0x83fa('0x7')],'comment':_0x83fa('0xa')},'data5':{'type':Sequelize[_0x83fa('0xb')],'comment':_0x83fa('0xc')},'data6':{'type':Sequelize[_0x83fa('0xb')],'comment':_0x83fa('0xd')},'data7':{'type':Sequelize[_0x83fa('0xb')],'comment':_0x83fa('0xe')}}; \ No newline at end of file +var _0x0709=['ENUM','AmazonAWS','Google','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20access_token','TEXT','sequelize','exports','STRING'];(function(_0x934e2d,_0x872107){var _0x56c861=function(_0x321cbb){while(--_0x321cbb){_0x934e2d['push'](_0x934e2d['shift']());}};_0x56c861(++_0x872107);}(_0x0709,0x1ec));var _0x9070=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x0709[_0x5d1044];return _0x3cd90e;};'use strict';var Sequelize=require(_0x9070('0x0'));module[_0x9070('0x1')]={'name':{'type':Sequelize[_0x9070('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9070('0x3')](_0x9070('0x4'),_0x9070('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9070('0x3')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x9070('0x2')],'comment':_0x9070('0x6')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x9070('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x9070('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x9070('0x7')},'data6':{'type':Sequelize[_0x9070('0x8')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x9070('0x8')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ec06fca..c5b569c 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 _0x0642=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','count','set','Content-Range','json','update','then','error','stack','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','map','merge','options','includeAll','findAll','service','decryptString','catch','show','params','include','find','MicrosoftAzure','data3','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data6','refresh_token','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth'];(function(_0x462516,_0x5042bb){var _0x28f3bf=function(_0x11e8dc){while(--_0x11e8dc){_0x462516['push'](_0x462516['shift']());}};_0x28f3bf(++_0x5042bb);}(_0x0642,0x1c5));var _0x2064=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x0642[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require('lodash');var Redis=require(_0x2064('0x0'));var qs=require(_0x2064('0x1'));var encryptor=require(_0x2064('0x2'));var config=require(_0x2064('0x3'));var logger=require(_0x2064('0x4'))(_0x2064('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x2064('0x6'));config[_0x2064('0x7')]=_[_0x2064('0x8')](config[_0x2064('0x7')],{'host':_0x2064('0x9'),'port':0x18eb});var socket=require(_0x2064('0xa'))(new Redis(config[_0x2064('0x7')]));var redis=new Redis(config[_0x2064('0x7')]);function respondWithStatusCode(_0x10e70e,_0x3be7a2){_0x3be7a2=_0x3be7a2||0xcc;return function(_0x20ba60){if(_0x20ba60){return _0x10e70e[_0x2064('0xb')](_0x3be7a2);}return _0x10e70e[_0x2064('0xc')](_0x3be7a2)['end']();};}function respondWithResult(_0x44adf1,_0x257376){_0x257376=_0x257376||0xc8;return function(_0x465e55){if(_0x465e55){return _0x44adf1[_0x2064('0xc')](_0x257376)['json'](_0x465e55);}};}function respondWithFilteredResult(_0x557ff6,_0x356cc3){return function(_0x6c048a){if(_0x6c048a){var _0x1508c8=typeof _0x356cc3[_0x2064('0xd')]===_0x2064('0xe')&&typeof _0x356cc3['limit']===_0x2064('0xe');var _0x2a9452=_0x6c048a[_0x2064('0xf')];var _0x2cfcc7=_0x1508c8?0x0:_0x356cc3[_0x2064('0xd')];var _0x4d1008=_0x1508c8?_0x6c048a[_0x2064('0xf')]:_0x356cc3[_0x2064('0xd')]+_0x356cc3['limit'];var _0x4ed761;if(_0x4d1008>=_0x2a9452){_0x4d1008=_0x2a9452;_0x4ed761=0xc8;}else{_0x4ed761=0xce;}_0x557ff6['status'](_0x4ed761);return _0x557ff6[_0x2064('0x10')](_0x2064('0x11'),_0x2cfcc7+'-'+_0x4d1008+'/'+_0x2a9452)[_0x2064('0x12')](_0x6c048a);}return null;};}function saveUpdates(_0x542116){return function(_0x43ce5c){if(_0x43ce5c){return _0x43ce5c[_0x2064('0x13')](_0x542116)['then'](function(_0x223b90){return _0x223b90;});}return null;};}function removeEntity(_0x50ec80){return function(_0x2e7422){if(_0x2e7422){return _0x2e7422['destroy']()[_0x2064('0x14')](function(){_0x50ec80[_0x2064('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c2a0){return function(_0x359bb5){if(!_0x359bb5){_0x16c2a0[_0x2064('0xb')](0x194);}return _0x359bb5;};}function handleError(_0x135d5d,_0x7b86be){_0x7b86be=_0x7b86be||0x1f4;return function(_0x6ce682){logger[_0x2064('0x15')](_0x6ce682[_0x2064('0x16')]);if(_0x6ce682['name']){delete _0x6ce682['name'];}_0x135d5d[_0x2064('0xc')](_0x7b86be)['send'](_0x6ce682);};}function maskClientSecret(_0x48b5ad){return _[_0x2064('0x17')](_0x48b5ad[_0x2064('0x18')](0x0,0x3),0x14,'*');}exports[_0x2064('0x19')]=function(_0x335824,_0x9b3505){var _0x2284eb={},_0x5c3203={},_0x3292bf={'count':0x0,'rows':[]};var _0x5d1f69=_['map'](db[_0x2064('0x1a')][_0x2064('0x1b')],function(_0xf418d8){return{'name':_0xf418d8[_0x2064('0x1c')],'type':_0xf418d8[_0x2064('0x1d')][_0x2064('0x1e')]};});_0x5c3203[_0x2064('0x1f')]=_['map'](_0x5d1f69,_0x2064('0x20'));_0x5c3203[_0x2064('0x21')]=_[_0x2064('0x22')](_0x335824[_0x2064('0x21')]);_0x5c3203[_0x2064('0x23')]=_[_0x2064('0x24')](_0x5c3203['model'],_0x5c3203[_0x2064('0x21')]);_0x2284eb[_0x2064('0x25')]=_[_0x2064('0x24')](_0x5c3203['model'],qs['fields'](_0x335824[_0x2064('0x21')][_0x2064('0x26')]));_0x2284eb[_0x2064('0x25')]=_0x2284eb[_0x2064('0x25')][_0x2064('0x27')]?_0x2284eb[_0x2064('0x25')]:_0x5c3203[_0x2064('0x1f')];if(!_0x335824[_0x2064('0x21')][_0x2064('0x28')](_0x2064('0x29'))){_0x2284eb[_0x2064('0x2a')]=qs['limit'](_0x335824[_0x2064('0x21')][_0x2064('0x2a')]);_0x2284eb[_0x2064('0xd')]=qs[_0x2064('0xd')](_0x335824[_0x2064('0x21')][_0x2064('0xd')]);}_0x2284eb[_0x2064('0x2b')]=qs[_0x2064('0x2c')](_0x335824[_0x2064('0x21')][_0x2064('0x2c')]);_0x2284eb['where']=qs['filters'](_[_0x2064('0x2d')](_0x335824[_0x2064('0x21')],_0x5c3203[_0x2064('0x23')]),_0x5d1f69);if(_0x335824[_0x2064('0x21')][_0x2064('0x2e')]){_0x2284eb['where']=_['merge'](_0x2284eb['where'],{'$or':_[_0x2064('0x2f')](_0x5d1f69,function(_0x11f141){if(_0x11f141[_0x2064('0x1d')]!=='VIRTUAL'){var _0x52d43c={};_0x52d43c[_0x11f141[_0x2064('0x20')]]={'$like':'%'+_0x335824[_0x2064('0x21')][_0x2064('0x2e')]+'%'};return _0x52d43c;}})});}_0x2284eb=_[_0x2064('0x30')]({},_0x2284eb,_0x335824[_0x2064('0x31')]);var _0x177af2={'where':_0x2284eb['where']};return db['CloudProvider'][_0x2064('0xf')](_0x177af2)[_0x2064('0x14')](function(_0x370b64){_0x3292bf[_0x2064('0xf')]=_0x370b64;if(_0x335824[_0x2064('0x21')][_0x2064('0x32')]){_0x2284eb['include']=[{'all':!![]}];}return db[_0x2064('0x1a')][_0x2064('0x33')](_0x2284eb);})[_0x2064('0x14')](function(_0x2072a8){_0x3292bf['rows']=_[_0x2064('0x2f')](_0x2072a8,function(_0x1b5fa1){if(_0x1b5fa1[_0x2064('0x34')]==='MicrosoftAzure'){var _0xee72c1=encryptor[_0x2064('0x35')](_0x1b5fa1['data3']);_0x1b5fa1['data3']=maskClientSecret(_0xee72c1);}return _0x1b5fa1;});return _0x3292bf;})[_0x2064('0x14')](respondWithFilteredResult(_0x9b3505,_0x2284eb))[_0x2064('0x36')](handleError(_0x9b3505,null));};exports[_0x2064('0x37')]=function(_0x2cae1b,_0xa436fd){var _0x2d9c6b={'raw':!![],'where':{'id':_0x2cae1b[_0x2064('0x38')]['id']}},_0x280ce4={};_0x280ce4['model']=_[_0x2064('0x22')](db[_0x2064('0x1a')][_0x2064('0x1b')]);_0x280ce4[_0x2064('0x21')]=_[_0x2064('0x22')](_0x2cae1b[_0x2064('0x21')]);_0x280ce4['filters']=_[_0x2064('0x24')](_0x280ce4[_0x2064('0x1f')],_0x280ce4[_0x2064('0x21')]);_0x2d9c6b[_0x2064('0x25')]=_[_0x2064('0x24')](_0x280ce4[_0x2064('0x1f')],qs[_0x2064('0x26')](_0x2cae1b[_0x2064('0x21')][_0x2064('0x26')]));_0x2d9c6b['attributes']=_0x2d9c6b[_0x2064('0x25')]['length']?_0x2d9c6b['attributes']:_0x280ce4[_0x2064('0x1f')];if(_0x2cae1b[_0x2064('0x21')][_0x2064('0x32')]){_0x2d9c6b[_0x2064('0x39')]=[{'all':!![]}];}_0x2d9c6b=_[_0x2064('0x30')]({},_0x2d9c6b,_0x2cae1b[_0x2064('0x31')]);return db[_0x2064('0x1a')][_0x2064('0x3a')](_0x2d9c6b)[_0x2064('0x14')](handleEntityNotFound(_0xa436fd,null))[_0x2064('0x14')](function(_0xbff98f){if(_0xbff98f['service']===_0x2064('0x3b')){var _0x500322=encryptor[_0x2064('0x35')](_0xbff98f[_0x2064('0x3c')]);_0xbff98f[_0x2064('0x3c')]=maskClientSecret(_0x500322);}return _0xbff98f;})['then'](respondWithResult(_0xa436fd,null))[_0x2064('0x36')](handleError(_0xa436fd,null));};exports[_0x2064('0x3d')]=function(_0x3ac2ec,_0x38b6da){if(!_0x3ac2ec[_0x2064('0x3e')]['name'])throw new Error(_0x2064('0x3f'));if(!_0x3ac2ec['body'][_0x2064('0x34')])throw new Error(_0x2064('0x40'));var _0xa2030d=db[_0x2064('0x1a')][_0x2064('0x1b')][_0x2064('0x34')][_0x2064('0x41')];if(!_0xa2030d[_0x2064('0x42')](_0x3ac2ec[_0x2064('0x3e')][_0x2064('0x34')]))throw new Error(_0x2064('0x43')+_0xa2030d[_0x2064('0x44')](',\x20'));if(_0x3ac2ec[_0x2064('0x3e')][_0x2064('0x34')]===_0x2064('0x3b')&&_0x3ac2ec['body'][_0x2064('0x3c')]){_0x3ac2ec[_0x2064('0x3e')]['data3']=encryptor[_0x2064('0x45')](_0x3ac2ec[_0x2064('0x3e')][_0x2064('0x3c')]);}return db['CloudProvider'][_0x2064('0x3d')](_0x3ac2ec['body'],{})[_0x2064('0x14')](respondWithResult(_0x38b6da,0xc9))[_0x2064('0x36')](handleError(_0x38b6da,null));};exports[_0x2064('0x13')]=function(_0x30914e,_0x1e1f3e){if(_0x30914e[_0x2064('0x3e')]['id']){delete _0x30914e[_0x2064('0x3e')]['id'];}return db['CloudProvider'][_0x2064('0x3a')]({'where':{'id':_0x30914e[_0x2064('0x38')]['id']}})[_0x2064('0x14')](handleEntityNotFound(_0x1e1f3e,null))['then'](function(_0xd3b9d7){if(_0xd3b9d7[_0x2064('0x34')]==='MicrosoftAzure'&&_0x30914e[_0x2064('0x3e')][_0x2064('0x3c')]){_0x30914e[_0x2064('0x3e')][_0x2064('0x3c')]=encryptor['encryptString'](_0x30914e[_0x2064('0x3e')][_0x2064('0x3c')]);}return _0xd3b9d7;})['then'](saveUpdates(_0x30914e['body'],null))[_0x2064('0x14')](respondWithResult(_0x1e1f3e,null))[_0x2064('0x36')](handleError(_0x1e1f3e,null));};exports[_0x2064('0x46')]=function(_0x3dc715,_0x53fccf){return db[_0x2064('0x1a')][_0x2064('0x3a')]({'where':{'id':_0x3dc715['params']['id']}})['then'](handleEntityNotFound(_0x53fccf,null))[_0x2064('0x14')](removeEntity(_0x53fccf,null))[_0x2064('0x36')](handleError(_0x53fccf,null));};exports[_0x2064('0x47')]=function(_0x53ba72,_0x557088){return db[_0x2064('0x1a')][_0x2064('0x48')]({'where':{'id':_0x53ba72[_0x2064('0x38')]['id']},'raw':!![]})[_0x2064('0x14')](function(_0xac017a){if(!_0xac017a)return _0x557088[_0x2064('0xb')](0x194);return{'url':oauth[_0x2064('0x49')](_0xac017a,_0x53ba72[_0x2064('0x4a')]['id'])};})[_0x2064('0x14')](respondWithResult(_0x557088,null))[_0x2064('0x36')](handleError(_0x557088,null));};exports['oauth2MicrosoftCallback']=function(_0x38dda8,_0x2b5369){var _0x55ec6c=_0x38dda8[_0x2064('0x3e')];var _0x288676;var _0x1cc878;if(_0x55ec6c[_0x2064('0x15')])throw _0x55ec6c;redis['get'](_0x55ec6c[_0x2064('0x4b')])[_0x2064('0x14')](function(_0x13aab0){if(!_0x13aab0)throw new Error(_0x2064('0x4c'));_0x288676=JSON[_0x2064('0x4d')](_0x13aab0);var _0x161d1f=Buffer['from'](_0x55ec6c[_0x2064('0x4b')],'base64')['toString']('ascii');_0x1cc878=JSON[_0x2064('0x4d')](_0x161d1f);if(!oauth[_0x2064('0x4e')](_0x55ec6c[_0x2064('0x4f')],_0x288676[_0x2064('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x2064('0x51')](_0x55ec6c['state']);return oauth[_0x2064('0x52')](_0x55ec6c[_0x2064('0x53')],_0x288676);})[_0x2064('0x14')](function(_0x4e4232){_0x288676['data5']=_0x4e4232['access_token'];_0x288676[_0x2064('0x54')]=_0x4e4232[_0x2064('0x55')];return db[_0x2064('0x1a')]['update']({'data5':_0x288676['data5'],'data6':_0x288676[_0x2064('0x54')]},{'where':{'id':_0x288676['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x288676);socket[_0x2064('0x56')](_0x2064('0x57'),{'id':_0x1cc878['id']});return;})[_0x2064('0x14')](respondWithStatusCode(_0x2b5369,null))[_0x2064('0x36')](function(_0x133e4b){if(_0x1cc878){socket[_0x2064('0x56')]('microsoftAuthorization:error',{'id':_0x1cc878['id']});}if(!_0x288676){logger['error'](_0x2064('0x58'),_0x133e4b);return _0x2b5369[_0x2064('0xc')](0x1f4)[_0x2064('0x59')](_0x133e4b[_0x2064('0x5a')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x288676['id'],JSON[_0x2064('0x5b')](_0x133e4b));});}; \ No newline at end of file +var _0xe9be=['map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CloudProvider','then','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','sendStatus','status','end','offset','undefined','count','limit','set','json','destroy','stack','name','padEnd','slice','index'];(function(_0x3c9921,_0x4f3ec3){var _0x1011c4=function(_0x31f84d){while(--_0x31f84d){_0x3c9921['push'](_0x3c9921['shift']());}};_0x1011c4(++_0x4f3ec3);}(_0xe9be,0x1e0));var _0xee9b=function(_0x28383d,_0x4c101e){_0x28383d=_0x28383d-0x0;var _0x2e919e=_0xe9be[_0x28383d];return _0x2e919e;};'use strict';var _=require(_0xee9b('0x0'));var Redis=require('ioredis');var qs=require(_0xee9b('0x1'));var encryptor=require(_0xee9b('0x2'));var config=require(_0xee9b('0x3'));var logger=require(_0xee9b('0x4'))(_0xee9b('0x5'));var db=require(_0xee9b('0x6'))['db'];var oauth=require(_0xee9b('0x7'));config['redis']=_[_0xee9b('0x8')](config[_0xee9b('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee9b('0x9')]));var redis=new Redis(config[_0xee9b('0x9')]);function respondWithStatusCode(_0x404ff1,_0x2e6e2a){_0x2e6e2a=_0x2e6e2a||0xcc;return function(_0x4b03b0){if(_0x4b03b0){return _0x404ff1[_0xee9b('0xa')](_0x2e6e2a);}return _0x404ff1[_0xee9b('0xb')](_0x2e6e2a)[_0xee9b('0xc')]();};}function respondWithResult(_0x547cb3,_0x9ac80d){_0x9ac80d=_0x9ac80d||0xc8;return function(_0x4d76a5){if(_0x4d76a5){return _0x547cb3[_0xee9b('0xb')](_0x9ac80d)['json'](_0x4d76a5);}};}function respondWithFilteredResult(_0x3b065f,_0x24dcda){return function(_0x5a8341){if(_0x5a8341){var _0x176481=typeof _0x24dcda[_0xee9b('0xd')]===_0xee9b('0xe')&&typeof _0x24dcda['limit']===_0xee9b('0xe');var _0x1b5717=_0x5a8341[_0xee9b('0xf')];var _0x14bb61=_0x176481?0x0:_0x24dcda[_0xee9b('0xd')];var _0x4504b3=_0x176481?_0x5a8341['count']:_0x24dcda[_0xee9b('0xd')]+_0x24dcda[_0xee9b('0x10')];var _0x50b1e9;if(_0x4504b3>=_0x1b5717){_0x4504b3=_0x1b5717;_0x50b1e9=0xc8;}else{_0x50b1e9=0xce;}_0x3b065f[_0xee9b('0xb')](_0x50b1e9);return _0x3b065f[_0xee9b('0x11')]('Content-Range',_0x14bb61+'-'+_0x4504b3+'/'+_0x1b5717)[_0xee9b('0x12')](_0x5a8341);}return null;};}function saveUpdates(_0x117075){return function(_0x16355e){if(_0x16355e){return _0x16355e['update'](_0x117075)['then'](function(_0x49dfcc){return _0x49dfcc;});}return null;};}function removeEntity(_0x538c14){return function(_0xf586c6){if(_0xf586c6){return _0xf586c6[_0xee9b('0x13')]()['then'](function(){_0x538c14[_0xee9b('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64df38){return function(_0xf02b58){if(!_0xf02b58){_0x64df38['sendStatus'](0x194);}return _0xf02b58;};}function handleError(_0x46e028,_0x3a3451){_0x3a3451=_0x3a3451||0x1f4;return function(_0x4dfd05){logger['error'](_0x4dfd05[_0xee9b('0x14')]);if(_0x4dfd05[_0xee9b('0x15')]){delete _0x4dfd05[_0xee9b('0x15')];}_0x46e028['status'](_0x3a3451)['send'](_0x4dfd05);};}function maskClientSecret(_0x21b9f5){return _[_0xee9b('0x16')](_0x21b9f5[_0xee9b('0x17')](0x0,0x3),0x14,'*');}exports[_0xee9b('0x18')]=function(_0x400559,_0xf2e006){var _0x906d08={},_0x2c06d1={},_0x223073={'count':0x0,'rows':[]};var _0x552c17=_[_0xee9b('0x19')](db['CloudProvider'][_0xee9b('0x1a')],function(_0x196b8c){return{'name':_0x196b8c[_0xee9b('0x1b')],'type':_0x196b8c[_0xee9b('0x1c')][_0xee9b('0x1d')]};});_0x2c06d1[_0xee9b('0x1e')]=_[_0xee9b('0x19')](_0x552c17,'name');_0x2c06d1['query']=_[_0xee9b('0x1f')](_0x400559[_0xee9b('0x20')]);_0x2c06d1[_0xee9b('0x21')]=_['intersection'](_0x2c06d1[_0xee9b('0x1e')],_0x2c06d1['query']);_0x906d08['attributes']=_[_0xee9b('0x22')](_0x2c06d1[_0xee9b('0x1e')],qs[_0xee9b('0x23')](_0x400559[_0xee9b('0x20')]['fields']));_0x906d08[_0xee9b('0x24')]=_0x906d08[_0xee9b('0x24')][_0xee9b('0x25')]?_0x906d08['attributes']:_0x2c06d1[_0xee9b('0x1e')];if(!_0x400559[_0xee9b('0x20')][_0xee9b('0x26')](_0xee9b('0x27'))){_0x906d08['limit']=qs[_0xee9b('0x10')](_0x400559[_0xee9b('0x20')]['limit']);_0x906d08['offset']=qs[_0xee9b('0xd')](_0x400559[_0xee9b('0x20')][_0xee9b('0xd')]);}_0x906d08[_0xee9b('0x28')]=qs[_0xee9b('0x29')](_0x400559['query'][_0xee9b('0x29')]);_0x906d08[_0xee9b('0x2a')]=qs['filters'](_['pick'](_0x400559[_0xee9b('0x20')],_0x2c06d1[_0xee9b('0x21')]),_0x552c17);if(_0x400559[_0xee9b('0x20')][_0xee9b('0x2b')]){_0x906d08[_0xee9b('0x2a')]=_[_0xee9b('0x2c')](_0x906d08['where'],{'$or':_[_0xee9b('0x19')](_0x552c17,function(_0x49b97d){if(_0x49b97d[_0xee9b('0x1c')]!==_0xee9b('0x2d')){var _0x1146d6={};_0x1146d6[_0x49b97d[_0xee9b('0x15')]]={'$like':'%'+_0x400559[_0xee9b('0x20')][_0xee9b('0x2b')]+'%'};return _0x1146d6;}})});}_0x906d08=_[_0xee9b('0x2c')]({},_0x906d08,_0x400559[_0xee9b('0x2e')]);var _0x4ee5ac={'where':_0x906d08[_0xee9b('0x2a')]};return db[_0xee9b('0x2f')][_0xee9b('0xf')](_0x4ee5ac)[_0xee9b('0x30')](function(_0x483619){_0x223073[_0xee9b('0xf')]=_0x483619;if(_0x400559[_0xee9b('0x20')][_0xee9b('0x31')]){_0x906d08[_0xee9b('0x32')]=[{'all':!![]}];}return db[_0xee9b('0x2f')][_0xee9b('0x33')](_0x906d08);})['then'](function(_0x3f8cd7){_0x223073[_0xee9b('0x34')]=_[_0xee9b('0x19')](_0x3f8cd7,function(_0x46d5ea){if(_0x46d5ea[_0xee9b('0x35')]===_0xee9b('0x36')){var _0x44684a=encryptor[_0xee9b('0x37')](_0x46d5ea[_0xee9b('0x38')]);_0x46d5ea[_0xee9b('0x38')]=maskClientSecret(_0x44684a);}return _0x46d5ea;});return _0x223073;})[_0xee9b('0x30')](respondWithFilteredResult(_0xf2e006,_0x906d08))[_0xee9b('0x39')](handleError(_0xf2e006,null));};exports[_0xee9b('0x3a')]=function(_0x29c90c,_0x16d431){var _0x467e0b={'raw':!![],'where':{'id':_0x29c90c['params']['id']}},_0x155976={};_0x155976[_0xee9b('0x1e')]=_['keys'](db[_0xee9b('0x2f')][_0xee9b('0x1a')]);_0x155976[_0xee9b('0x20')]=_[_0xee9b('0x1f')](_0x29c90c[_0xee9b('0x20')]);_0x155976[_0xee9b('0x21')]=_[_0xee9b('0x22')](_0x155976['model'],_0x155976['query']);_0x467e0b[_0xee9b('0x24')]=_[_0xee9b('0x22')](_0x155976['model'],qs['fields'](_0x29c90c[_0xee9b('0x20')][_0xee9b('0x23')]));_0x467e0b['attributes']=_0x467e0b[_0xee9b('0x24')][_0xee9b('0x25')]?_0x467e0b[_0xee9b('0x24')]:_0x155976[_0xee9b('0x1e')];if(_0x29c90c[_0xee9b('0x20')]['includeAll']){_0x467e0b['include']=[{'all':!![]}];}_0x467e0b=_[_0xee9b('0x2c')]({},_0x467e0b,_0x29c90c[_0xee9b('0x2e')]);return db['CloudProvider'][_0xee9b('0x3b')](_0x467e0b)['then'](handleEntityNotFound(_0x16d431,null))[_0xee9b('0x30')](function(_0x22a746){if(_0x22a746[_0xee9b('0x35')]===_0xee9b('0x36')){var _0x51817c=encryptor[_0xee9b('0x37')](_0x22a746[_0xee9b('0x38')]);_0x22a746['data3']=maskClientSecret(_0x51817c);}return _0x22a746;})[_0xee9b('0x30')](respondWithResult(_0x16d431,null))['catch'](handleError(_0x16d431,null));};exports[_0xee9b('0x3c')]=function(_0x44fbc4,_0x48578c){if(!_0x44fbc4[_0xee9b('0x3d')][_0xee9b('0x15')])throw new Error(_0xee9b('0x3e'));if(!_0x44fbc4[_0xee9b('0x3d')][_0xee9b('0x35')])throw new Error(_0xee9b('0x3f'));var _0xb8816c=db['CloudProvider'][_0xee9b('0x1a')][_0xee9b('0x35')][_0xee9b('0x40')];if(!_0xb8816c[_0xee9b('0x41')](_0x44fbc4['body'][_0xee9b('0x35')]))throw new Error(_0xee9b('0x42')+_0xb8816c[_0xee9b('0x43')](',\x20'));if(_0x44fbc4['body'][_0xee9b('0x35')]===_0xee9b('0x36')&&_0x44fbc4[_0xee9b('0x3d')][_0xee9b('0x38')]){_0x44fbc4[_0xee9b('0x3d')]['data3']=encryptor[_0xee9b('0x44')](_0x44fbc4['body'][_0xee9b('0x38')]);}return db[_0xee9b('0x2f')]['create'](_0x44fbc4[_0xee9b('0x3d')],{})['then'](respondWithResult(_0x48578c,0xc9))[_0xee9b('0x39')](handleError(_0x48578c,null));};exports[_0xee9b('0x45')]=function(_0x16e15d,_0x104980){if(_0x16e15d[_0xee9b('0x3d')]['id']){delete _0x16e15d[_0xee9b('0x3d')]['id'];}return db[_0xee9b('0x2f')][_0xee9b('0x3b')]({'where':{'id':_0x16e15d['params']['id']}})['then'](handleEntityNotFound(_0x104980,null))[_0xee9b('0x30')](function(_0x9e0d6c){if(_0x9e0d6c[_0xee9b('0x35')]===_0xee9b('0x36')&&_0x16e15d[_0xee9b('0x3d')][_0xee9b('0x38')]){_0x16e15d[_0xee9b('0x3d')][_0xee9b('0x38')]=encryptor['encryptString'](_0x16e15d['body'][_0xee9b('0x38')]);}return _0x9e0d6c;})['then'](saveUpdates(_0x16e15d[_0xee9b('0x3d')],null))[_0xee9b('0x30')](respondWithResult(_0x104980,null))[_0xee9b('0x39')](handleError(_0x104980,null));};exports[_0xee9b('0x13')]=function(_0x4c15b6,_0x2a4a26){return db[_0xee9b('0x2f')][_0xee9b('0x3b')]({'where':{'id':_0x4c15b6[_0xee9b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a4a26,null))['then'](removeEntity(_0x2a4a26,null))['catch'](handleError(_0x2a4a26,null));};exports[_0xee9b('0x47')]=function(_0xe1f4bb,_0xf76a38){return db[_0xee9b('0x2f')][_0xee9b('0x48')]({'where':{'id':_0xe1f4bb['params']['id']},'raw':!![]})['then'](function(_0x1b7594){if(!_0x1b7594)return _0xf76a38[_0xee9b('0xa')](0x194);return{'url':oauth[_0xee9b('0x49')](_0x1b7594,_0xe1f4bb[_0xee9b('0x4a')]['id'])};})[_0xee9b('0x30')](respondWithResult(_0xf76a38,null))[_0xee9b('0x39')](handleError(_0xf76a38,null));};exports[_0xee9b('0x4b')]=function(_0x3a9fec,_0x365d1a){var _0x2edb7b=_0x3a9fec[_0xee9b('0x3d')];var _0x431ae2;var _0x3f7148;if(_0x2edb7b[_0xee9b('0x4c')])throw _0x2edb7b;redis[_0xee9b('0x4d')](_0x2edb7b[_0xee9b('0x4e')])['then'](function(_0x35dbba){if(!_0x35dbba)throw new Error(_0xee9b('0x4f'));_0x431ae2=JSON[_0xee9b('0x50')](_0x35dbba);var _0x4c7f95=Buffer['from'](_0x2edb7b[_0xee9b('0x4e')],_0xee9b('0x51'))[_0xee9b('0x52')](_0xee9b('0x53'));_0x3f7148=JSON[_0xee9b('0x50')](_0x4c7f95);if(!oauth['isValidIdToken'](_0x2edb7b[_0xee9b('0x54')],_0x431ae2[_0xee9b('0x55')]))throw new Error(_0xee9b('0x56'));redis[_0xee9b('0x57')](_0x2edb7b[_0xee9b('0x4e')]);return oauth[_0xee9b('0x58')](_0x2edb7b[_0xee9b('0x59')],_0x431ae2);})[_0xee9b('0x30')](function(_0x489e50){_0x431ae2[_0xee9b('0x5a')]=_0x489e50[_0xee9b('0x5b')];_0x431ae2[_0xee9b('0x5c')]=_0x489e50[_0xee9b('0x5d')];return db[_0xee9b('0x2f')]['update']({'data5':_0x431ae2[_0xee9b('0x5a')],'data6':_0x431ae2['data6']},{'where':{'id':_0x431ae2['id']}});})[_0xee9b('0x30')](function(){oauth[_0xee9b('0x5e')](_0x431ae2);socket[_0xee9b('0x5f')](_0xee9b('0x60'),{'id':_0x3f7148['id']});return;})[_0xee9b('0x30')](respondWithStatusCode(_0x365d1a,null))[_0xee9b('0x39')](function(_0x25302e){if(_0x3f7148){socket[_0xee9b('0x5f')](_0xee9b('0x61'),{'id':_0x3f7148['id']});}if(!_0x431ae2){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x25302e);return _0x365d1a[_0xee9b('0xb')](0x1f4)['send'](_0x25302e[_0xee9b('0x62')]);}logger[_0xee9b('0x4c')](_0xee9b('0x63'),_0x431ae2['id'],JSON[_0xee9b('0x64')](_0x25302e));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f2d6603..ad10cd6 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 _0x96e1=['lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x96e1,0x90));var _0x196e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x96e1[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x196e('0x0'));var util=require(_0x196e('0x1'));var logger=require(_0x196e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x196e('0x3'));var rp=require(_0x196e('0x4'));var fs=require('fs');var path=require(_0x196e('0x5'));var rimraf=require('rimraf');var config=require(_0x196e('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x196e('0x7')]=function(_0x5e0625,_0x19b473){return _0x5e0625['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3378=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util'];(function(_0x5820a6,_0x491add){var _0x55f807=function(_0x7ebb01){while(--_0x7ebb01){_0x5820a6['push'](_0x5820a6['shift']());}};_0x55f807(++_0x491add);}(_0x3378,0xc2));var _0x8337=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x3378[_0x2f54b6];return _0x169f21;};'use strict';var _=require(_0x8337('0x0'));var util=require(_0x8337('0x1'));var logger=require(_0x8337('0x2'))(_0x8337('0x3'));var moment=require(_0x8337('0x4'));var BPromise=require(_0x8337('0x5'));var rp=require(_0x8337('0x6'));var fs=require('fs');var path=require(_0x8337('0x7'));var rimraf=require(_0x8337('0x8'));var config=require(_0x8337('0x9'));var attributes=require(_0x8337('0xa'));module[_0x8337('0xb')]=function(_0x417221,_0xb0de98){return _0x417221[_0x8337('0xc')](_0x8337('0xd'),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 57bc4b2..e4b5917 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 _0x589b=['/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','id_token','from','toString','base64','randomBytes','hex','client_id','data1','data4','response_mode','form_post','scope','state','nonce','prompt','login','map','value','oauth2Claims','set','decode','payload','iss','isAfter','unix','exp','then','CloudProvider','findOne','refresh_token','data6','data2','access_token','update','data5','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','POST','intervals','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'];(function(_0x521b74,_0x3c9887){var _0x31dedf=function(_0x5b5d9c){while(--_0x5b5d9c){_0x521b74['push'](_0x521b74['shift']());}};_0x31dedf(++_0x3c9887);}(_0x589b,0x16e));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb589('0x0'));var crypto=require(_0xb589('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0xb589('0x2'));var Redis=require(_0xb589('0x3'));var rp=require(_0xb589('0x4'));var util=require(_0xb589('0x5'));var encryptor=require(_0xb589('0x6'));var config=require(_0xb589('0x7'));var logger=require('../../config/logger')('api');var schedule=require(_0xb589('0x8'));var db=require(_0xb589('0x9'))['db'];config['redis']=_[_0xb589('0xa')](config[_0xb589('0xb')],{'host':_0xb589('0xc'),'port':0x18eb});var redis=new Redis(config[_0xb589('0xb')]);var MICROSOFT_AUTH_URL=_0xb589('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb589('0xe'),_0xb589('0xf'),'email',_0xb589('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xb589('0x11'),_0xb589('0x12')],'Dynamics365':[_0xb589('0xe'),_0xb589('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xb589('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xb589('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5b12d8){var _0x15ecfd=_['map'](AZURE_AUTH_SCOPES[_0x5b12d8[_0xb589('0x15')]]);if(_0x5b12d8[_0xb589('0x15')]===_0xb589('0x16'))_0x15ecfd[_0xb589('0x17')](_0x5b12d8[_0xb589('0x18')]+_0xb589('0x19'));return _0x15ecfd[_0xb589('0x1a')]('\x20');}function getAccessTokenScope(_0xf320e8){if(_0xf320e8[_0xb589('0x15')]===_0xb589('0x1b'))return _0xb589('0x1c');if(_0xf320e8[_0xb589('0x15')]===_0xb589('0x16'))return _0xf320e8[_0xb589('0x18')]+_0xb589('0x19');}function generateMicrosoftAuthorizationUrl(_0x39cb99,_0x25e88a){var _0x64fff1=MICROSOFT_AUTH_URL[_0xb589('0x1d')](_0xb589('0x1e'),_0x39cb99['data2']);var _0x3545d2=['code',_0xb589('0x1f')];var _0x51c121=Buffer[_0xb589('0x20')](JSON['stringify']({'id':_0x25e88a}))[_0xb589('0x21')](_0xb589('0x22'));var _0x1ab46a=crypto[_0xb589('0x23')](0x10)[_0xb589('0x21')](_0xb589('0x24'));var _0x487187=getAuthorizationScopes(_0x39cb99);var _0x18f502=[{'key':_0xb589('0x25'),'value':_0x39cb99[_0xb589('0x26')]},{'key':'response_type','value':encodeURIComponent(_0x3545d2[_0xb589('0x1a')]('\x20'))},{'key':'redirect_uri','value':_0x39cb99[_0xb589('0x27')]},{'key':_0xb589('0x28'),'value':_0xb589('0x29')},{'key':_0xb589('0x2a'),'value':encodeURIComponent(_0x487187)},{'key':_0xb589('0x2b'),'value':_0x51c121},{'key':_0xb589('0x2c'),'value':_0x1ab46a},{'key':_0xb589('0x2d'),'value':_0xb589('0x2e')}];var _0x34df1c=_0x64fff1+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb589('0x2f')](_0x18f502,function(_0x36d708){return _0x36d708['key']+'='+_0x36d708[_0xb589('0x30')];})[_0xb589('0x1a')]('&');_0x39cb99[_0xb589('0x31')]={'issuer':_0x64fff1['replace']('oauth2/',''),'audience':_0x39cb99[_0xb589('0x26')],'state':_0x51c121,'nonce':_0x1ab46a};redis[_0xb589('0x32')](_0x51c121,JSON['stringify'](_0x39cb99));return _0x34df1c;}function isValidIdToken(_0x4107d6,_0xbc6ba8){try{var _0x762b35=jwt[_0xb589('0x33')](_0x4107d6,{'complete':!![]});var _0xe55c05=_0x762b35[_0xb589('0x34')];if(_0xe55c05[_0xb589('0x35')]!==_0xbc6ba8['issuer'])return![];if(_0xe55c05['aud']!==_0xbc6ba8['audience'])return![];if(_0xe55c05['nonce']!==_0xbc6ba8[_0xb589('0x2c')])return![];if(moment()[_0xb589('0x36')](moment[_0xb589('0x37')](_0xe55c05[_0xb589('0x38')])))return![];return!![];}catch(_0x4b3be3){throw _0x4b3be3;}}function refreshOauth2MicrosoftAccessToken(_0x11bba9){return Promise['resolve']()[_0xb589('0x39')](function(){if(_0x11bba9['data3'])return _0x11bba9;return db[_0xb589('0x3a')][_0xb589('0x3b')]({'where':{'id':_0x11bba9['id']},'raw':!![]});})[_0xb589('0x39')](function(_0x1fa1f9){var _0x35e946={'grant_type':_0xb589('0x3c'),'refresh_token':_0x1fa1f9[_0xb589('0x3d')],'scope':getAccessTokenScope(_0x1fa1f9),'redirect_uri':_0x1fa1f9[_0xb589('0x27')],'client_id':_0x1fa1f9['data1'],'client_secret':encryptor['decryptString'](_0x1fa1f9['data3'])};var _0x2fa5f6={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xb589('0x1d')]('{TENANT_ID}',_0x1fa1f9[_0xb589('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x35e946,'json':!![]};return rp(_0x2fa5f6);})[_0xb589('0x39')](function(_0xc0786){_0x11bba9['data5']=_0xc0786[_0xb589('0x3f')];_0x11bba9[_0xb589('0x3d')]=_0xc0786[_0xb589('0x3c')];return db[_0xb589('0x3a')][_0xb589('0x40')]({'data5':_0x11bba9[_0xb589('0x41')],'data6':_0x11bba9[_0xb589('0x3d')]},{'where':{'id':_0x11bba9['id']}});})[_0xb589('0x39')](function(){return _0x11bba9;})[_0xb589('0x42')](function(_0x4c7a95){logger['error'](_0xb589('0x43'),_0x11bba9['id'],_0x4c7a95);});}function getOauth2MicrosoftAccessToken(_0x54a185,_0x5a064c){var _0x332b95={'grant_type':_0xb589('0x44'),'code':_0x54a185,'scope':getAccessTokenScope(_0x5a064c),'redirect_uri':_0x5a064c[_0xb589('0x27')],'client_id':_0x5a064c['data1'],'client_secret':encryptor['decryptString'](_0x5a064c[_0xb589('0x45')])};var _0x44ad9c={'method':_0xb589('0x46'),'uri':MICROSOFT_AUTH_URL[_0xb589('0x1d')]('{TENANT_ID}',_0x5a064c[_0xb589('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x332b95,'json':!![]};return rp(_0x44ad9c);}function startRefreshInterval(_0x1c4fc0){var _0x4db916=schedule[_0xb589('0x47')];if(_0x4db916[_0x1c4fc0['id']])clearInterval(_0x4db916[_0x1c4fc0['id']]);_0x4db916[_0x1c4fc0['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x1c4fc0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb589('0x47')]=_0x4db916;}function startAllRefreshIntervals(){return db[_0xb589('0x3a')][_0xb589('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x391e59){var _0x5ccb4c=_0x391e59['map'](function(_0x5afdca){return refreshOauth2MicrosoftAccessToken(_0x5afdca)[_0xb589('0x39')](function(_0x38fb2d){startRefreshInterval(_0x38fb2d);});});return Promise[_0xb589('0x49')](_0x5ccb4c);})[_0xb589('0x42')](function(_0x4add2e){var _0x35aa5b=_0x4add2e?util[_0xb589('0x4a')](_0x4add2e,{'showHidden':![],'depth':null}):'';logger[_0xb589('0x4b')](_0xb589('0x4c'),_0x35aa5b);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x259e=['issuer','aud','isAfter','unix','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','findAll','all','catch','inspect','lodash','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','openid','/authorize','/token','map','type','push','data7','join','Outlook365','Dynamics365','/.default','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','data4','response_mode','form_post','scope','state','nonce','prompt','key','value','set','iss'];(function(_0x343731,_0x266f23){var _0x560561=function(_0x4bbb27){while(--_0x4bbb27){_0x343731['push'](_0x343731['shift']());}};_0x560561(++_0x266f23);}(_0x259e,0x1eb));var _0xe259=function(_0x2dc0d3,_0x3d52a6){_0x2dc0d3=_0x2dc0d3-0x0;var _0x4a8217=_0x259e[_0x2dc0d3];return _0x4a8217;};'use strict';var _=require(_0xe259('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0xe259('0x1'));var Redis=require(_0xe259('0x2'));var rp=require(_0xe259('0x3'));var util=require('util');var encryptor=require(_0xe259('0x4'));var config=require(_0xe259('0x5'));var logger=require(_0xe259('0x6'))(_0xe259('0x7'));var schedule=require(_0xe259('0x8'));var db=require(_0xe259('0x9'))['db'];config[_0xe259('0xa')]=_[_0xe259('0xb')](config[_0xe259('0xa')],{'host':_0xe259('0xc'),'port':0x18eb});var redis=new Redis(config[_0xe259('0xa')]);var MICROSOFT_AUTH_URL=_0xe259('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xe259('0xe'),_0xe259('0xf'),_0xe259('0x10'),_0xe259('0x11'),_0xe259('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xe259('0x13'),_0xe259('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xe259('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0xe259('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5727d4){var _0x58d13e=_[_0xe259('0x16')](AZURE_AUTH_SCOPES[_0x5727d4[_0xe259('0x17')]]);if(_0x5727d4[_0xe259('0x17')]==='Dynamics365')_0x58d13e[_0xe259('0x18')](_0x5727d4[_0xe259('0x19')]+'/.default');return _0x58d13e[_0xe259('0x1a')]('\x20');}function getAccessTokenScope(_0x1f3860){if(_0x1f3860[_0xe259('0x17')]===_0xe259('0x1b'))return _0xe259('0x11');if(_0x1f3860[_0xe259('0x17')]===_0xe259('0x1c'))return _0x1f3860[_0xe259('0x19')]+_0xe259('0x1d');}function generateMicrosoftAuthorizationUrl(_0x13d2b8,_0x5383b5){var _0x374873=MICROSOFT_AUTH_URL[_0xe259('0x1e')](_0xe259('0x1f'),_0x13d2b8[_0xe259('0x20')]);var _0x1e792c=[_0xe259('0x21'),_0xe259('0x22')];var _0x16c003=Buffer[_0xe259('0x23')](JSON[_0xe259('0x24')]({'id':_0x5383b5}))[_0xe259('0x25')](_0xe259('0x26'));var _0x1e6fa4=crypto[_0xe259('0x27')](0x10)[_0xe259('0x25')](_0xe259('0x28'));var _0x264e24=getAuthorizationScopes(_0x13d2b8);var _0x307b08=[{'key':_0xe259('0x29'),'value':_0x13d2b8[_0xe259('0x2a')]},{'key':_0xe259('0x2b'),'value':encodeURIComponent(_0x1e792c[_0xe259('0x1a')]('\x20'))},{'key':'redirect_uri','value':_0x13d2b8[_0xe259('0x2c')]},{'key':_0xe259('0x2d'),'value':_0xe259('0x2e')},{'key':_0xe259('0x2f'),'value':encodeURIComponent(_0x264e24)},{'key':_0xe259('0x30'),'value':_0x16c003},{'key':_0xe259('0x31'),'value':_0x1e6fa4},{'key':_0xe259('0x32'),'value':'login'}];var _0x4f8db3=_0x374873+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xe259('0x16')](_0x307b08,function(_0x4d56de){return _0x4d56de[_0xe259('0x33')]+'='+_0x4d56de[_0xe259('0x34')];})['join']('&');_0x13d2b8['oauth2Claims']={'issuer':_0x374873['replace']('oauth2/',''),'audience':_0x13d2b8[_0xe259('0x2a')],'state':_0x16c003,'nonce':_0x1e6fa4};redis[_0xe259('0x35')](_0x16c003,JSON[_0xe259('0x24')](_0x13d2b8));return _0x4f8db3;}function isValidIdToken(_0x59b7f0,_0x3a95b2){try{var _0x3b04f8=jwt['decode'](_0x59b7f0,{'complete':!![]});var _0x1b41f7=_0x3b04f8['payload'];if(_0x1b41f7[_0xe259('0x36')]!==_0x3a95b2[_0xe259('0x37')])return![];if(_0x1b41f7[_0xe259('0x38')]!==_0x3a95b2['audience'])return![];if(_0x1b41f7['nonce']!==_0x3a95b2[_0xe259('0x31')])return![];if(moment()[_0xe259('0x39')](moment[_0xe259('0x3a')](_0x1b41f7['exp'])))return![];return!![];}catch(_0x10d5b6){throw _0x10d5b6;}}function refreshOauth2MicrosoftAccessToken(_0x31bcb5){return Promise[_0xe259('0x3b')]()[_0xe259('0x3c')](function(){if(_0x31bcb5['data3'])return _0x31bcb5;return db[_0xe259('0x3d')][_0xe259('0x3e')]({'where':{'id':_0x31bcb5['id']},'raw':!![]});})[_0xe259('0x3c')](function(_0x3a8804){var _0x4ad900={'grant_type':_0xe259('0x3f'),'refresh_token':_0x3a8804[_0xe259('0x40')],'scope':getAccessTokenScope(_0x3a8804),'redirect_uri':_0x3a8804[_0xe259('0x2c')],'client_id':_0x3a8804[_0xe259('0x2a')],'client_secret':encryptor[_0xe259('0x41')](_0x3a8804[_0xe259('0x42')])};var _0x26f57b={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xe259('0x1e')](_0xe259('0x1f'),_0x3a8804[_0xe259('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4ad900,'json':!![]};return rp(_0x26f57b);})['then'](function(_0x5c64a5){_0x31bcb5[_0xe259('0x43')]=_0x5c64a5[_0xe259('0x44')];_0x31bcb5[_0xe259('0x40')]=_0x5c64a5['refresh_token'];return db['CloudProvider'][_0xe259('0x45')]({'data5':_0x31bcb5[_0xe259('0x43')],'data6':_0x31bcb5[_0xe259('0x40')]},{'where':{'id':_0x31bcb5['id']}});})[_0xe259('0x3c')](function(){return _0x31bcb5;})['catch'](function(_0x31b395){logger[_0xe259('0x46')](_0xe259('0x47'),_0x31bcb5['id'],_0x31b395);});}function getOauth2MicrosoftAccessToken(_0x46f0da,_0x46bd92){var _0x507360={'grant_type':_0xe259('0x48'),'code':_0x46f0da,'scope':getAccessTokenScope(_0x46bd92),'redirect_uri':_0x46bd92['data4'],'client_id':_0x46bd92[_0xe259('0x2a')],'client_secret':encryptor['decryptString'](_0x46bd92[_0xe259('0x42')])};var _0x360c43={'method':_0xe259('0x49'),'uri':MICROSOFT_AUTH_URL[_0xe259('0x1e')]('{TENANT_ID}',_0x46bd92[_0xe259('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x507360,'json':!![]};return rp(_0x360c43);}function startRefreshInterval(_0x486422){var _0x208ede=schedule['intervals'];if(_0x208ede[_0x486422['id']])clearInterval(_0x208ede[_0x486422['id']]);_0x208ede[_0x486422['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x486422['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x208ede;}function startAllRefreshIntervals(){return db[_0xe259('0x3d')][_0xe259('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xe259('0x3c')](function(_0x552463){var _0x1abc46=_0x552463[_0xe259('0x16')](function(_0x37e006){return refreshOauth2MicrosoftAccessToken(_0x37e006)[_0xe259('0x3c')](function(_0x587579){startRefreshInterval(_0x587579);});});return Promise[_0xe259('0x4b')](_0x1abc46);})[_0xe259('0x4c')](function(_0x411207){var _0x560e3c=_0x411207?util[_0xe259('0x4d')](_0x411207,{'showHidden':![],'depth':null}):'';logger[_0xe259('0x46')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x560e3c);});}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 f918bda..9d76fa6 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 _0xd7d1=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x16e4c4,_0x1e67a1){var _0x2896fe=function(_0x47429a){while(--_0x47429a){_0x16e4c4['push'](_0x16e4c4['shift']());}};_0x2896fe(++_0x1e67a1);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2b96ed,_0x38ebf5){_0x2b96ed=_0x2b96ed-0x0;var _0x43a96a=_0xd7d1[_0x2b96ed];return _0x43a96a;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('CloudProvider,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file +var _0xfa25=['info','CloudProvider,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request'];(function(_0xacb834,_0x3da351){var _0xda3052=function(_0x7fce5c){while(--_0x7fce5c){_0xacb834['push'](_0xacb834['shift']());}};_0xda3052(++_0x3da351);}(_0xfa25,0xd1));var _0x5fa2=function(_0x480433,_0x306d5d){_0x480433=_0x480433-0x0;var _0x91f513=_0xfa25[_0x480433];return _0x91f513;};'use strict';var _=require('lodash');var util=require(_0x5fa2('0x0'));var moment=require(_0x5fa2('0x1'));var BPromise=require(_0x5fa2('0x2'));var rs=require(_0x5fa2('0x3'));var fs=require('fs');var Redis=require(_0x5fa2('0x4'));var db=require(_0x5fa2('0x5'))['db'];var utils=require(_0x5fa2('0x6'));var logger=require(_0x5fa2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fa2('0x8'));var client=jayson[_0x5fa2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53a560,_0x2a9a69,_0x4b04ea){return new BPromise(function(_0x35c145,_0x9c9f1c){return client[_0x5fa2('0xa')](_0x53a560,_0x4b04ea)['then'](function(_0x36778e){logger[_0x5fa2('0xb')](_0x5fa2('0xc'),_0x2a9a69,'request\x20sent');logger[_0x5fa2('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x2a9a69,'request\x20sent',JSON[_0x5fa2('0xe')](_0x36778e));if(_0x36778e[_0x5fa2('0xf')]){if(_0x36778e['error'][_0x5fa2('0x10')]===0x1f4){logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);return _0x9c9f1c(_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);}logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);return _0x35c145(_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);}else{logger[_0x5fa2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2a9a69,_0x5fa2('0x12'));_0x35c145(_0x36778e[_0x5fa2('0x13')][_0x5fa2('0x11')]);}})['catch'](function(_0x4e20d1){logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x4e20d1);_0x9c9f1c(_0x4e20d1);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9be6a5b..59cc615 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7a54,0x106));var _0x47a5=function(_0x4596de,_0x555149){_0x4596de=_0x4596de-0x0;var _0x43d186=_0x7a54[_0x4596de];return _0x43d186;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x494364,_0x364883){_0x494364=_0x494364-0x0;var _0x2677e9=_0x5f2f[_0x494364];return _0x2677e9;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 6accb4d..6bf7bb8 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 _0x3f1a=['STRING','exports','name'];(function(_0x480f89,_0x5d304d){var _0x53400e=function(_0x36532d){while(--_0x36532d){_0x480f89['push'](_0x480f89['shift']());}};_0x53400e(++_0x5d304d);}(_0x3f1a,0x145));var _0xa3f1=function(_0x1d10c7,_0x50b734){_0x1d10c7=_0x1d10c7-0x0;var _0x4c5881=_0x3f1a[_0x1d10c7];return _0x4c5881;};'use strict';var Sequelize=require('sequelize');module[_0xa3f1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa3f1('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa3f1('0x2')]},'companyId':{'type':Sequelize[_0xa3f1('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa3f1('0x2')]},'fax':{'type':Sequelize[_0xa3f1('0x2')]},'type':{'type':Sequelize[_0xa3f1('0x2')]},'street':{'type':Sequelize[_0xa3f1('0x2')]},'postalCode':{'type':Sequelize[_0xa3f1('0x2')]},'city':{'type':Sequelize[_0xa3f1('0x2')]},'country':{'type':Sequelize[_0xa3f1('0x2')]},'email':{'type':Sequelize[_0xa3f1('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa3f1('0x2')]},'sStreet':{'type':Sequelize[_0xa3f1('0x2')]},'sPostalCode':{'type':Sequelize[_0xa3f1('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xa3f1('0x2')]},'description':{'type':Sequelize[_0xa3f1('0x2')]}}; \ No newline at end of file +var _0xf9f9=['STRING','name','sequelize'];(function(_0x8970dc,_0x6c0cb5){var _0x2ab2c7=function(_0x2db85a){while(--_0x2db85a){_0x8970dc['push'](_0x8970dc['shift']());}};_0x2ab2c7(++_0x6c0cb5);}(_0xf9f9,0x15b));var _0x9f9f=function(_0x33ce69,_0xe71dd3){_0x33ce69=_0x33ce69-0x0;var _0x5a4427=_0xf9f9[_0x33ce69];return _0x5a4427;};'use strict';var Sequelize=require(_0x9f9f('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f9f('0x1')],'unique':_0x9f9f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9f9f('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x9f9f('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9f9f('0x1')]},'type':{'type':Sequelize[_0x9f9f('0x1')]},'street':{'type':Sequelize[_0x9f9f('0x1')]},'postalCode':{'type':Sequelize[_0x9f9f('0x1')]},'city':{'type':Sequelize[_0x9f9f('0x1')]},'country':{'type':Sequelize[_0x9f9f('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9f9f('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x9f9f('0x1')]},'sCity':{'type':Sequelize[_0x9f9f('0x1')]},'sCountry':{'type':Sequelize[_0x9f9f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 29260b8..e8616ee 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 _0x60d5=['params','intersection','fields','length','include','find','create','body','user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','CmContact','ids','rawAttributes','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','offset','status','set','Content-Range','reject','then','destroy','get','Companies','stack','name','index','CmCompany','describe','model','keys','query','filters','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','findAll','rows','catch','show'];(function(_0x2ec438,_0x4c25e2){var _0x3d1baa=function(_0x59f81c){while(--_0x59f81c){_0x2ec438['push'](_0x2ec438['shift']());}};_0x3d1baa(++_0x4c25e2);}(_0x60d5,0x16f));var _0x560d=function(_0x55c747,_0xc8e95a){_0x55c747=_0x55c747-0x0;var _0xb7c5c=_0x60d5[_0x55c747];return _0xb7c5c;};'use strict';var emlformat=require(_0x560d('0x0'));var rimraf=require(_0x560d('0x1'));var zipdir=require(_0x560d('0x2'));var jsonpatch=require(_0x560d('0x3'));var rp=require(_0x560d('0x4'));var moment=require(_0x560d('0x5'));var BPromise=require(_0x560d('0x6'));var Mustache=require(_0x560d('0x7'));var util=require(_0x560d('0x8'));var path=require(_0x560d('0x9'));var sox=require(_0x560d('0xa'));var csv=require(_0x560d('0xb'));var ejs=require(_0x560d('0xc'));var fs=require('fs');var fs_extra=require(_0x560d('0xd'));var _=require(_0x560d('0xe'));var squel=require(_0x560d('0xf'));var crypto=require(_0x560d('0x10'));var jsforce=require(_0x560d('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x560d('0xb'));var querystring=require(_0x560d('0x12'));var Papa=require(_0x560d('0x13'));var Redis=require(_0x560d('0x14'));var authService=require(_0x560d('0x15'));var qs=require(_0x560d('0x16'));var as=require(_0x560d('0x17'));var hardwareService=require(_0x560d('0x18'));var logger=require(_0x560d('0x19'))('api');var utils=require(_0x560d('0x1a'));var config=require(_0x560d('0x1b'));var licenseUtil=require(_0x560d('0x1c'));var db=require(_0x560d('0x1d'))['db'];function respondWithStatusCode(_0x558361,_0xf29b00){_0xf29b00=_0xf29b00||0xcc;return function(_0x47952b){if(_0x47952b){return _0x558361['sendStatus'](_0xf29b00);}return _0x558361['status'](_0xf29b00)[_0x560d('0x1e')]();};}function respondWithResult(_0x3ce734,_0x2a8a9c){_0x2a8a9c=_0x2a8a9c||0xc8;return function(_0x74280d){if(_0x74280d){return _0x3ce734['status'](_0x2a8a9c)[_0x560d('0x1f')](_0x74280d);}};}function respondWithFilteredResult(_0xc31961,_0x18ad09){return function(_0x5e462d){if(_0x5e462d){var _0x396136=typeof _0x18ad09['offset']===_0x560d('0x20')&&typeof _0x18ad09[_0x560d('0x21')]===_0x560d('0x20');var _0x4210bf=_0x5e462d['count'];var _0x1d9236=_0x396136?0x0:_0x18ad09[_0x560d('0x22')];var _0x22df66=_0x396136?_0x5e462d['count']:_0x18ad09[_0x560d('0x22')]+_0x18ad09[_0x560d('0x21')];var _0x3d6f13;if(_0x22df66>=_0x4210bf){_0x22df66=_0x4210bf;_0x3d6f13=0xc8;}else{_0x3d6f13=0xce;}_0xc31961[_0x560d('0x23')](_0x3d6f13);return _0xc31961[_0x560d('0x24')](_0x560d('0x25'),_0x1d9236+'-'+_0x22df66+'/'+_0x4210bf)[_0x560d('0x1f')](_0x5e462d);}return null;};}function patchUpdates(_0x155dab){return function(_0x2d6763){try{jsonpatch['apply'](_0x2d6763,_0x155dab,!![]);}catch(_0x4624f6){return BPromise[_0x560d('0x26')](_0x4624f6);}return _0x2d6763['save']();};}function saveUpdates(_0x47db16,_0x228b62){return function(_0x3810eb){if(_0x3810eb){return _0x3810eb['update'](_0x47db16)[_0x560d('0x27')](function(_0x591c0d){return _0x591c0d;});}return null;};}function removeEntity(_0x508f59,_0xe42cce){return function(_0xf873fd){if(_0xf873fd){return _0xf873fd[_0x560d('0x28')]()[_0x560d('0x27')](function(){var _0x27877e=_0xf873fd[_0x560d('0x29')]({'plain':!![]});var _0x4f7779=_0x560d('0x2a');return db['UserProfileResource'][_0x560d('0x28')]({'where':{'type':_0x4f7779,'resourceId':_0x27877e['id']}})[_0x560d('0x27')](function(){return _0xf873fd;});})[_0x560d('0x27')](function(){_0x508f59[_0x560d('0x23')](0xcc)[_0x560d('0x1e')]();});}};}function handleEntityNotFound(_0x4b49ba,_0x5e32d2){return function(_0x5769e3){if(!_0x5769e3){_0x4b49ba['sendStatus'](0x194);}return _0x5769e3;};}function handleError(_0x406bd9,_0x455b86){_0x455b86=_0x455b86||0x1f4;return function(_0x13206c){logger['error'](_0x13206c[_0x560d('0x2b')]);if(_0x13206c[_0x560d('0x2c')]){delete _0x13206c['name'];}_0x406bd9[_0x560d('0x23')](_0x455b86)['send'](_0x13206c);};}exports[_0x560d('0x2d')]=function(_0x383e10,_0x4f940d){var _0xcc988={},_0x560114={},_0x263ec7={'count':0x0,'rows':[]};return db[_0x560d('0x2e')][_0x560d('0x2f')]()['then'](function(_0x47acb4){_0x560114[_0x560d('0x30')]=_[_0x560d('0x31')](_0x47acb4);_0x560114[_0x560d('0x32')]=_[_0x560d('0x31')](_0x383e10[_0x560d('0x32')]);_0x560114[_0x560d('0x33')]=_['intersection'](_0x560114[_0x560d('0x30')],_0x560114[_0x560d('0x32')]);_0xcc988[_0x560d('0x34')]=_['intersection'](_0x560114[_0x560d('0x30')],qs['fields'](_0x383e10[_0x560d('0x32')]['fields']));_0xcc988[_0x560d('0x34')]=_0xcc988[_0x560d('0x34')]['length']?_0xcc988[_0x560d('0x34')]:_0x560114['model'];if(!_0x383e10[_0x560d('0x32')][_0x560d('0x35')](_0x560d('0x36'))){_0xcc988[_0x560d('0x21')]=qs['limit'](_0x383e10['query'][_0x560d('0x21')]);_0xcc988[_0x560d('0x22')]=qs[_0x560d('0x22')](_0x383e10[_0x560d('0x32')]['offset']);}_0xcc988[_0x560d('0x37')]=qs[_0x560d('0x38')](_0x383e10[_0x560d('0x32')][_0x560d('0x38')]);_0xcc988['where']=qs[_0x560d('0x33')](_[_0x560d('0x39')](_0x383e10[_0x560d('0x32')],_0x560114['filters']),_0x47acb4);if(_0x383e10[_0x560d('0x32')][_0x560d('0x3a')]){_0xcc988[_0x560d('0x3b')]=_[_0x560d('0x3c')](_0xcc988[_0x560d('0x3b')],{'$or':_['map'](_0xcc988[_0x560d('0x34')],function(_0x3e2d91){var _0x545386={};_0x545386[_0x3e2d91]={'$like':'%'+_0x383e10[_0x560d('0x32')][_0x560d('0x3a')]+'%'};return _0x545386;})});}_0xcc988=_[_0x560d('0x3c')]({},_0xcc988,_0x383e10[_0x560d('0x3d')]);var _0x162b70={'where':_0xcc988['where']};return db[_0x560d('0x2e')][_0x560d('0x3e')](_0x162b70)[_0x560d('0x27')](function(_0x23d617){_0x263ec7[_0x560d('0x3e')]=_0x23d617;if(_0x383e10[_0x560d('0x32')][_0x560d('0x3f')]){_0xcc988['include']=[{'all':!![]}];}return db[_0x560d('0x2e')][_0x560d('0x40')](_0xcc988);})['then'](function(_0x352460){_0x263ec7[_0x560d('0x41')]=_0x352460;return _0x263ec7;})[_0x560d('0x27')](respondWithFilteredResult(_0x4f940d,_0xcc988))[_0x560d('0x42')](handleError(_0x4f940d,null));})[_0x560d('0x42')](handleError(_0x4f940d,null));};exports[_0x560d('0x43')]=function(_0xda70ff,_0x129e66){var _0x4c1f2a={'raw':![],'where':{'id':_0xda70ff[_0x560d('0x44')]['id']}},_0x2bee73={};_0x2bee73[_0x560d('0x30')]=_[_0x560d('0x31')](db['CmCompany']['rawAttributes']);_0x2bee73[_0x560d('0x32')]=_[_0x560d('0x31')](_0xda70ff[_0x560d('0x32')]);_0x2bee73[_0x560d('0x33')]=_[_0x560d('0x45')](_0x2bee73[_0x560d('0x30')],_0x2bee73['query']);_0x4c1f2a[_0x560d('0x34')]=_[_0x560d('0x45')](_0x2bee73[_0x560d('0x30')],qs[_0x560d('0x46')](_0xda70ff[_0x560d('0x32')]['fields']));_0x4c1f2a[_0x560d('0x34')]=_0x4c1f2a['attributes'][_0x560d('0x47')]?_0x4c1f2a['attributes']:_0x2bee73['model'];if(_0xda70ff[_0x560d('0x32')]['includeAll']){_0x4c1f2a[_0x560d('0x48')]=[{'all':!![]}];}_0x4c1f2a=_[_0x560d('0x3c')]({},_0x4c1f2a,_0xda70ff[_0x560d('0x3d')]);return db[_0x560d('0x2e')][_0x560d('0x49')](_0x4c1f2a)[_0x560d('0x27')](handleEntityNotFound(_0x129e66,null))['then'](respondWithResult(_0x129e66,null))[_0x560d('0x42')](handleError(_0x129e66,null));};exports['create']=function(_0x59103a,_0x32cc66){return db[_0x560d('0x2e')][_0x560d('0x4a')](_0x59103a[_0x560d('0x4b')],{})[_0x560d('0x27')](function(_0x2774a9){var _0x3a4911=_0x59103a['user'][_0x560d('0x29')]({'plain':!![]});if(!_0x3a4911)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a4911['role']===_0x560d('0x4c')){var _0x5f53aa=_0x2774a9[_0x560d('0x29')]({'plain':!![]});var _0x465c71=_0x560d('0x2a');return db[_0x560d('0x4d')]['find']({'where':{'name':_0x465c71,'userProfileId':_0x3a4911['userProfileId']},'raw':!![]})[_0x560d('0x27')](function(_0x33d235){if(_0x33d235&&_0x33d235[_0x560d('0x4e')]===0x0){return db[_0x560d('0x4f')][_0x560d('0x4a')]({'name':_0x5f53aa[_0x560d('0x2c')],'resourceId':_0x5f53aa['id'],'type':_0x33d235[_0x560d('0x2c')],'sectionId':_0x33d235['id']},{})[_0x560d('0x27')](function(){return _0x2774a9;});}else{return _0x2774a9;}})['catch'](function(_0x6e0f06){logger[_0x560d('0x50')](_0x560d('0x51'),_0x6e0f06);throw _0x6e0f06;});}return _0x2774a9;})[_0x560d('0x27')](respondWithResult(_0x32cc66,0xc9))['catch'](handleError(_0x32cc66,null));};exports[_0x560d('0x52')]=function(_0x33e78a,_0x513e04){if(_0x33e78a['body']['id']){delete _0x33e78a['body']['id'];}return db[_0x560d('0x2e')][_0x560d('0x49')]({'where':{'id':_0x33e78a['params']['id']}})['then'](handleEntityNotFound(_0x513e04,null))[_0x560d('0x27')](saveUpdates(_0x33e78a[_0x560d('0x4b')],null))['then'](respondWithResult(_0x513e04,null))[_0x560d('0x42')](handleError(_0x513e04,null));};exports[_0x560d('0x28')]=function(_0x2d1a27,_0x1ef5ec){return db[_0x560d('0x2e')][_0x560d('0x49')]({'where':{'id':_0x2d1a27[_0x560d('0x44')]['id']}})[_0x560d('0x27')](handleEntityNotFound(_0x1ef5ec,null))[_0x560d('0x27')](removeEntity(_0x1ef5ec,null))['catch'](handleError(_0x1ef5ec,null));};exports['describe']=function(_0x3e0360,_0x3afc63){return db[_0x560d('0x2e')][_0x560d('0x2f')]()[_0x560d('0x27')](respondWithResult(_0x3afc63,null))[_0x560d('0x42')](handleError(_0x3afc63,null));};exports['addContacts']=function(_0x5997e1,_0x1ab704,_0x412f59){return db[_0x560d('0x53')][_0x560d('0x49')]({'where':{'id':_0x5997e1[_0x560d('0x44')]['id']}})[_0x560d('0x27')](handleEntityNotFound(_0x1ab704,null))['then'](function(_0x378021){if(_0x378021){return _0x378021['addContacts'](_0x5997e1['body'][_0x560d('0x54')],_['omit'](_0x5997e1[_0x560d('0x4b')],[_0x560d('0x54'),'id'])||{});}})['then'](respondWithResult(_0x1ab704,null))[_0x560d('0x42')](handleError(_0x1ab704,null));};exports['getContacts']=function(_0x5b1a2a,_0xf41644,_0x3f629a){var _0x177706={};var _0x311d97={};var _0x10152f;var _0x213173;return db[_0x560d('0x2e')]['findOne']({'where':{'id':_0x5b1a2a[_0x560d('0x44')]['id']}})[_0x560d('0x27')](handleEntityNotFound(_0xf41644,null))[_0x560d('0x27')](function(_0x427b38){if(_0x427b38){_0x10152f=_0x427b38;_0x311d97[_0x560d('0x30')]=_[_0x560d('0x31')](db[_0x560d('0x53')][_0x560d('0x55')]);_0x311d97[_0x560d('0x32')]=_[_0x560d('0x31')](_0x5b1a2a['query']);_0x311d97[_0x560d('0x33')]=_[_0x560d('0x45')](_0x311d97[_0x560d('0x30')],_0x311d97['query']);_0x177706['attributes']=_[_0x560d('0x45')](_0x311d97['model'],qs['fields'](_0x5b1a2a[_0x560d('0x32')][_0x560d('0x46')]));_0x177706[_0x560d('0x34')]=_0x177706[_0x560d('0x34')][_0x560d('0x47')]?_0x177706[_0x560d('0x34')]:_0x311d97[_0x560d('0x30')];_0x177706[_0x560d('0x37')]=qs['sort'](_0x5b1a2a[_0x560d('0x32')][_0x560d('0x38')]);_0x177706[_0x560d('0x3b')]=qs[_0x560d('0x33')](_[_0x560d('0x39')](_0x5b1a2a[_0x560d('0x32')],_0x311d97[_0x560d('0x33')]));if(_0x5b1a2a[_0x560d('0x32')][_0x560d('0x3a')]){_0x177706['where']=_[_0x560d('0x3c')](_0x177706[_0x560d('0x3b')],{'$or':_['map'](_0x177706[_0x560d('0x34')],function(_0x2b4f05){var _0x36f29c={};_0x36f29c[_0x2b4f05]={'$like':'%'+_0x5b1a2a[_0x560d('0x32')][_0x560d('0x3a')]+'%'};return _0x36f29c;})});}_0x177706=_[_0x560d('0x3c')]({},_0x177706,_0x5b1a2a[_0x560d('0x3d')]);return _0x10152f[_0x560d('0x56')](_0x177706);}})[_0x560d('0x27')](function(_0x5b626e){if(_0x5b626e){_0x213173=_0x5b626e['length'];if(!_0x5b1a2a[_0x560d('0x32')][_0x560d('0x35')](_0x560d('0x36'))){_0x177706[_0x560d('0x21')]=qs[_0x560d('0x21')](_0x5b1a2a[_0x560d('0x32')]['limit']);_0x177706[_0x560d('0x22')]=qs[_0x560d('0x22')](_0x5b1a2a[_0x560d('0x32')][_0x560d('0x22')]);}return _0x10152f[_0x560d('0x56')](_0x177706);}})[_0x560d('0x27')](function(_0x4eb089){if(_0x4eb089){return _0x4eb089?{'count':_0x213173,'rows':_0x4eb089}:null;}})[_0x560d('0x27')](respondWithResult(_0xf41644,null))[_0x560d('0x42')](handleError(_0xf41644,null));}; \ No newline at end of file +var _0xb36b=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','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','CmContact','ids','omit','getContacts','map','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters'];(function(_0x17d986,_0x303071){var _0x321a49=function(_0x4cf376){while(--_0x4cf376){_0x17d986['push'](_0x17d986['shift']());}};_0x321a49(++_0x303071);}(_0xb36b,0x1c2));var _0xbb36=function(_0x28365d,_0x14eba1){_0x28365d=_0x28365d-0x0;var _0x407b82=_0xb36b[_0x28365d];return _0x407b82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb36('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb36('0x1'));var rp=require(_0xbb36('0x2'));var moment=require('moment');var BPromise=require(_0xbb36('0x3'));var Mustache=require(_0xbb36('0x4'));var util=require(_0xbb36('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbb36('0x6'));var ejs=require(_0xbb36('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb36('0x8'));var squel=require(_0xbb36('0x9'));var crypto=require(_0xbb36('0xa'));var jsforce=require(_0xbb36('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbb36('0x6'));var querystring=require('querystring');var Papa=require(_0xbb36('0xc'));var Redis=require('ioredis');var authService=require(_0xbb36('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbb36('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb36('0xf'))(_0xbb36('0x10'));var utils=require(_0xbb36('0x11'));var config=require(_0xbb36('0x12'));var licenseUtil=require(_0xbb36('0x13'));var db=require(_0xbb36('0x14'))['db'];function respondWithStatusCode(_0x55e146,_0x3767b0){_0x3767b0=_0x3767b0||0xcc;return function(_0x1d087b){if(_0x1d087b){return _0x55e146['sendStatus'](_0x3767b0);}return _0x55e146[_0xbb36('0x15')](_0x3767b0)['end']();};}function respondWithResult(_0x1cafd3,_0x275088){_0x275088=_0x275088||0xc8;return function(_0x4cbbe9){if(_0x4cbbe9){return _0x1cafd3['status'](_0x275088)['json'](_0x4cbbe9);}};}function respondWithFilteredResult(_0x2190d3,_0xcadea4){return function(_0x786432){if(_0x786432){var _0x1581f2=typeof _0xcadea4[_0xbb36('0x16')]===_0xbb36('0x17')&&typeof _0xcadea4['limit']===_0xbb36('0x17');var _0x2b37e=_0x786432[_0xbb36('0x18')];var _0x4d28c2=_0x1581f2?0x0:_0xcadea4['offset'];var _0x42200d=_0x1581f2?_0x786432[_0xbb36('0x18')]:_0xcadea4['offset']+_0xcadea4[_0xbb36('0x19')];var _0x1d54e7;if(_0x42200d>=_0x2b37e){_0x42200d=_0x2b37e;_0x1d54e7=0xc8;}else{_0x1d54e7=0xce;}_0x2190d3[_0xbb36('0x15')](_0x1d54e7);return _0x2190d3[_0xbb36('0x1a')]('Content-Range',_0x4d28c2+'-'+_0x42200d+'/'+_0x2b37e)['json'](_0x786432);}return null;};}function patchUpdates(_0x8e6bac){return function(_0x326b71){try{jsonpatch[_0xbb36('0x1b')](_0x326b71,_0x8e6bac,!![]);}catch(_0x201d37){return BPromise[_0xbb36('0x1c')](_0x201d37);}return _0x326b71[_0xbb36('0x1d')]();};}function saveUpdates(_0x5aa9ee,_0x3a26fa){return function(_0x43d4a0){if(_0x43d4a0){return _0x43d4a0[_0xbb36('0x1e')](_0x5aa9ee)[_0xbb36('0x1f')](function(_0x521890){return _0x521890;});}return null;};}function removeEntity(_0x47a82b,_0x40fdea){return function(_0x3be874){if(_0x3be874){return _0x3be874[_0xbb36('0x20')]()[_0xbb36('0x1f')](function(){var _0x5b2daa=_0x3be874[_0xbb36('0x21')]({'plain':!![]});var _0x2979a2=_0xbb36('0x22');return db[_0xbb36('0x23')]['destroy']({'where':{'type':_0x2979a2,'resourceId':_0x5b2daa['id']}})['then'](function(){return _0x3be874;});})[_0xbb36('0x1f')](function(){_0x47a82b[_0xbb36('0x15')](0xcc)[_0xbb36('0x24')]();});}};}function handleEntityNotFound(_0x4ab114,_0x5b4567){return function(_0x4c778b){if(!_0x4c778b){_0x4ab114['sendStatus'](0x194);}return _0x4c778b;};}function handleError(_0x11e821,_0x344b64){_0x344b64=_0x344b64||0x1f4;return function(_0xe4ac1e){logger[_0xbb36('0x25')](_0xe4ac1e[_0xbb36('0x26')]);if(_0xe4ac1e[_0xbb36('0x27')]){delete _0xe4ac1e[_0xbb36('0x27')];}_0x11e821[_0xbb36('0x15')](_0x344b64)[_0xbb36('0x28')](_0xe4ac1e);};}exports[_0xbb36('0x29')]=function(_0x142127,_0x5ba53a){var _0x26e987={},_0xb4f886={},_0x4056c2={'count':0x0,'rows':[]};return db[_0xbb36('0x2a')][_0xbb36('0x2b')]()[_0xbb36('0x1f')](function(_0x53303d){_0xb4f886[_0xbb36('0x2c')]=_[_0xbb36('0x2d')](_0x53303d);_0xb4f886[_0xbb36('0x2e')]=_[_0xbb36('0x2d')](_0x142127[_0xbb36('0x2e')]);_0xb4f886[_0xbb36('0x2f')]=_[_0xbb36('0x30')](_0xb4f886['model'],_0xb4f886[_0xbb36('0x2e')]);_0x26e987[_0xbb36('0x31')]=_[_0xbb36('0x30')](_0xb4f886[_0xbb36('0x2c')],qs[_0xbb36('0x32')](_0x142127['query']['fields']));_0x26e987['attributes']=_0x26e987[_0xbb36('0x31')][_0xbb36('0x33')]?_0x26e987['attributes']:_0xb4f886[_0xbb36('0x2c')];if(!_0x142127[_0xbb36('0x2e')][_0xbb36('0x34')](_0xbb36('0x35'))){_0x26e987[_0xbb36('0x19')]=qs[_0xbb36('0x19')](_0x142127[_0xbb36('0x2e')][_0xbb36('0x19')]);_0x26e987['offset']=qs[_0xbb36('0x16')](_0x142127['query']['offset']);}_0x26e987[_0xbb36('0x36')]=qs[_0xbb36('0x37')](_0x142127[_0xbb36('0x2e')][_0xbb36('0x37')]);_0x26e987[_0xbb36('0x38')]=qs[_0xbb36('0x2f')](_[_0xbb36('0x39')](_0x142127['query'],_0xb4f886[_0xbb36('0x2f')]),_0x53303d);if(_0x142127[_0xbb36('0x2e')][_0xbb36('0x3a')]){_0x26e987['where']=_[_0xbb36('0x3b')](_0x26e987[_0xbb36('0x38')],{'$or':_['map'](_0x26e987[_0xbb36('0x31')],function(_0x4c2c32){var _0x4a574d={};_0x4a574d[_0x4c2c32]={'$like':'%'+_0x142127[_0xbb36('0x2e')][_0xbb36('0x3a')]+'%'};return _0x4a574d;})});}_0x26e987=_[_0xbb36('0x3b')]({},_0x26e987,_0x142127[_0xbb36('0x3c')]);var _0x3426d3={'where':_0x26e987['where']};return db['CmCompany'][_0xbb36('0x18')](_0x3426d3)[_0xbb36('0x1f')](function(_0x2af0a5){_0x4056c2[_0xbb36('0x18')]=_0x2af0a5;if(_0x142127[_0xbb36('0x2e')][_0xbb36('0x3d')]){_0x26e987['include']=[{'all':!![]}];}return db[_0xbb36('0x2a')][_0xbb36('0x3e')](_0x26e987);})['then'](function(_0x53fe53){_0x4056c2[_0xbb36('0x3f')]=_0x53fe53;return _0x4056c2;})[_0xbb36('0x1f')](respondWithFilteredResult(_0x5ba53a,_0x26e987))[_0xbb36('0x40')](handleError(_0x5ba53a,null));})['catch'](handleError(_0x5ba53a,null));};exports['show']=function(_0x4a4413,_0xba200f){var _0x35d233={'raw':![],'where':{'id':_0x4a4413[_0xbb36('0x41')]['id']}},_0x31d9bf={};_0x31d9bf[_0xbb36('0x2c')]=_[_0xbb36('0x2d')](db[_0xbb36('0x2a')][_0xbb36('0x42')]);_0x31d9bf[_0xbb36('0x2e')]=_[_0xbb36('0x2d')](_0x4a4413[_0xbb36('0x2e')]);_0x31d9bf[_0xbb36('0x2f')]=_[_0xbb36('0x30')](_0x31d9bf[_0xbb36('0x2c')],_0x31d9bf[_0xbb36('0x2e')]);_0x35d233[_0xbb36('0x31')]=_[_0xbb36('0x30')](_0x31d9bf[_0xbb36('0x2c')],qs['fields'](_0x4a4413[_0xbb36('0x2e')][_0xbb36('0x32')]));_0x35d233[_0xbb36('0x31')]=_0x35d233[_0xbb36('0x31')][_0xbb36('0x33')]?_0x35d233[_0xbb36('0x31')]:_0x31d9bf[_0xbb36('0x2c')];if(_0x4a4413[_0xbb36('0x2e')]['includeAll']){_0x35d233['include']=[{'all':!![]}];}_0x35d233=_['merge']({},_0x35d233,_0x4a4413[_0xbb36('0x3c')]);return db[_0xbb36('0x2a')][_0xbb36('0x43')](_0x35d233)[_0xbb36('0x1f')](handleEntityNotFound(_0xba200f,null))[_0xbb36('0x1f')](respondWithResult(_0xba200f,null))[_0xbb36('0x40')](handleError(_0xba200f,null));};exports[_0xbb36('0x44')]=function(_0x5467c3,_0x5482f3){return db[_0xbb36('0x2a')][_0xbb36('0x44')](_0x5467c3[_0xbb36('0x45')],{})[_0xbb36('0x1f')](function(_0x3a134d){var _0x12c9b7=_0x5467c3[_0xbb36('0x46')][_0xbb36('0x21')]({'plain':!![]});if(!_0x12c9b7)throw new Error(_0xbb36('0x47'));if(_0x12c9b7[_0xbb36('0x48')]===_0xbb36('0x46')){var _0x5916cd=_0x3a134d[_0xbb36('0x21')]({'plain':!![]});var _0xf3d06b=_0xbb36('0x22');return db[_0xbb36('0x49')][_0xbb36('0x43')]({'where':{'name':_0xf3d06b,'userProfileId':_0x12c9b7[_0xbb36('0x4a')]},'raw':!![]})[_0xbb36('0x1f')](function(_0x363aaf){if(_0x363aaf&&_0x363aaf[_0xbb36('0x4b')]===0x0){return db[_0xbb36('0x23')]['create']({'name':_0x5916cd[_0xbb36('0x27')],'resourceId':_0x5916cd['id'],'type':_0x363aaf[_0xbb36('0x27')],'sectionId':_0x363aaf['id']},{})[_0xbb36('0x1f')](function(){return _0x3a134d;});}else{return _0x3a134d;}})[_0xbb36('0x40')](function(_0x457cca){logger[_0xbb36('0x25')](_0xbb36('0x4c'),_0x457cca);throw _0x457cca;});}return _0x3a134d;})[_0xbb36('0x1f')](respondWithResult(_0x5482f3,0xc9))[_0xbb36('0x40')](handleError(_0x5482f3,null));};exports['update']=function(_0x2e12a6,_0x13749e){if(_0x2e12a6['body']['id']){delete _0x2e12a6['body']['id'];}return db[_0xbb36('0x2a')][_0xbb36('0x43')]({'where':{'id':_0x2e12a6['params']['id']}})['then'](handleEntityNotFound(_0x13749e,null))['then'](saveUpdates(_0x2e12a6[_0xbb36('0x45')],null))[_0xbb36('0x1f')](respondWithResult(_0x13749e,null))[_0xbb36('0x40')](handleError(_0x13749e,null));};exports[_0xbb36('0x20')]=function(_0x22a1f5,_0x460d38){return db[_0xbb36('0x2a')][_0xbb36('0x43')]({'where':{'id':_0x22a1f5[_0xbb36('0x41')]['id']}})[_0xbb36('0x1f')](handleEntityNotFound(_0x460d38,null))['then'](removeEntity(_0x460d38,null))[_0xbb36('0x40')](handleError(_0x460d38,null));};exports[_0xbb36('0x2b')]=function(_0x5c2a98,_0x10e39e){return db[_0xbb36('0x2a')]['describe']()[_0xbb36('0x1f')](respondWithResult(_0x10e39e,null))['catch'](handleError(_0x10e39e,null));};exports[_0xbb36('0x4d')]=function(_0x2b2ddf,_0x31675c,_0x12d220){return db[_0xbb36('0x4e')][_0xbb36('0x43')]({'where':{'id':_0x2b2ddf[_0xbb36('0x41')]['id']}})['then'](handleEntityNotFound(_0x31675c,null))[_0xbb36('0x1f')](function(_0x11e410){if(_0x11e410){return _0x11e410[_0xbb36('0x4d')](_0x2b2ddf[_0xbb36('0x45')][_0xbb36('0x4f')],_[_0xbb36('0x50')](_0x2b2ddf[_0xbb36('0x45')],[_0xbb36('0x4f'),'id'])||{});}})[_0xbb36('0x1f')](respondWithResult(_0x31675c,null))['catch'](handleError(_0x31675c,null));};exports[_0xbb36('0x51')]=function(_0x3c8f1b,_0x360eaf,_0x293926){var _0x5cf538={};var _0x56a3a2={};var _0x71aed;var _0x199cf6;return db[_0xbb36('0x2a')]['findOne']({'where':{'id':_0x3c8f1b[_0xbb36('0x41')]['id']}})['then'](handleEntityNotFound(_0x360eaf,null))[_0xbb36('0x1f')](function(_0x4c9a3f){if(_0x4c9a3f){_0x71aed=_0x4c9a3f;_0x56a3a2[_0xbb36('0x2c')]=_[_0xbb36('0x2d')](db[_0xbb36('0x4e')][_0xbb36('0x42')]);_0x56a3a2[_0xbb36('0x2e')]=_[_0xbb36('0x2d')](_0x3c8f1b[_0xbb36('0x2e')]);_0x56a3a2[_0xbb36('0x2f')]=_[_0xbb36('0x30')](_0x56a3a2['model'],_0x56a3a2['query']);_0x5cf538[_0xbb36('0x31')]=_[_0xbb36('0x30')](_0x56a3a2[_0xbb36('0x2c')],qs[_0xbb36('0x32')](_0x3c8f1b['query'][_0xbb36('0x32')]));_0x5cf538['attributes']=_0x5cf538[_0xbb36('0x31')][_0xbb36('0x33')]?_0x5cf538['attributes']:_0x56a3a2[_0xbb36('0x2c')];_0x5cf538[_0xbb36('0x36')]=qs[_0xbb36('0x37')](_0x3c8f1b[_0xbb36('0x2e')][_0xbb36('0x37')]);_0x5cf538[_0xbb36('0x38')]=qs['filters'](_[_0xbb36('0x39')](_0x3c8f1b[_0xbb36('0x2e')],_0x56a3a2[_0xbb36('0x2f')]));if(_0x3c8f1b['query'][_0xbb36('0x3a')]){_0x5cf538[_0xbb36('0x38')]=_[_0xbb36('0x3b')](_0x5cf538[_0xbb36('0x38')],{'$or':_[_0xbb36('0x52')](_0x5cf538[_0xbb36('0x31')],function(_0x2405b9){var _0x586a5a={};_0x586a5a[_0x2405b9]={'$like':'%'+_0x3c8f1b[_0xbb36('0x2e')][_0xbb36('0x3a')]+'%'};return _0x586a5a;})});}_0x5cf538=_[_0xbb36('0x3b')]({},_0x5cf538,_0x3c8f1b['options']);return _0x71aed[_0xbb36('0x51')](_0x5cf538);}})[_0xbb36('0x1f')](function(_0x58d7db){if(_0x58d7db){_0x199cf6=_0x58d7db[_0xbb36('0x33')];if(!_0x3c8f1b[_0xbb36('0x2e')][_0xbb36('0x34')](_0xbb36('0x35'))){_0x5cf538[_0xbb36('0x19')]=qs[_0xbb36('0x19')](_0x3c8f1b[_0xbb36('0x2e')][_0xbb36('0x19')]);_0x5cf538[_0xbb36('0x16')]=qs[_0xbb36('0x16')](_0x3c8f1b[_0xbb36('0x2e')][_0xbb36('0x16')]);}return _0x71aed['getContacts'](_0x5cf538);}})[_0xbb36('0x1f')](function(_0x536302){if(_0x536302){return _0x536302?{'count':_0x199cf6,'rows':_0x536302}:null;}})[_0xbb36('0x1f')](respondWithResult(_0x360eaf,null))[_0xbb36('0x40')](handleError(_0x360eaf,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 646e5f3..a0147d7 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 _0xc235=['../../config/environment','./cmCompany.attributes','define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1824c6,_0x79fcc3){var _0xbc0e9a=function(_0x4262ef){while(--_0x4262ef){_0x1824c6['push'](_0x1824c6['shift']());}};_0xbc0e9a(++_0x79fcc3);}(_0xc235,0x148));var _0x5c23=function(_0x517684,_0x398de8){_0x517684=_0x517684-0x0;var _0x277fd8=_0xc235[_0x517684];return _0x277fd8;};'use strict';var _=require(_0x5c23('0x0'));var util=require(_0x5c23('0x1'));var logger=require(_0x5c23('0x2'))(_0x5c23('0x3'));var moment=require(_0x5c23('0x4'));var BPromise=require(_0x5c23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c23('0x6'));var rimraf=require(_0x5c23('0x7'));var config=require(_0x5c23('0x8'));var attributes=require(_0x5c23('0x9'));module['exports']=function(_0x2206fc,_0x3ee2ed){return _0x2206fc[_0x5c23('0xa')](_0x5c23('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a62=['CmCompany','cm_companies','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x5bcebd,_0x3a3654){var _0x16c625=function(_0x930bfa){while(--_0x930bfa){_0x5bcebd['push'](_0x5bcebd['shift']());}};_0x16c625(++_0x3a3654);}(_0x6a62,0x9c));var _0x26a6=function(_0x5269a4,_0x516164){_0x5269a4=_0x5269a4-0x0;var _0xd998d8=_0x6a62[_0x5269a4];return _0xd998d8;};'use strict';var _=require(_0x26a6('0x0'));var util=require(_0x26a6('0x1'));var logger=require(_0x26a6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x26a6('0x3'));var rp=require(_0x26a6('0x4'));var fs=require('fs');var path=require(_0x26a6('0x5'));var rimraf=require('rimraf');var config=require(_0x26a6('0x6'));var attributes=require('./cmCompany.attributes');module[_0x26a6('0x7')]=function(_0x49f7b2,_0x33d832){return _0x49f7b2[_0x26a6('0x8')](_0x26a6('0x9'),attributes,{'tableName':_0x26a6('0xa'),'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 cac0afd..b912b7a 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 _0x7afa=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x244452,_0x4b6c43){var _0x4e48e2=function(_0x5aedcd){while(--_0x5aedcd){_0x244452['push'](_0x244452['shift']());}};_0x4e48e2(++_0x4b6c43);}(_0x7afa,0xe0));var _0xa7af=function(_0x499e1a,_0x5e6669){_0x499e1a=_0x499e1a-0x0;var _0x12ef82=_0x7afa[_0x499e1a];return _0x12ef82;};'use strict';var _=require(_0xa7af('0x0'));var util=require(_0xa7af('0x1'));var moment=require(_0xa7af('0x2'));var BPromise=require(_0xa7af('0x3'));var rs=require(_0xa7af('0x4'));var fs=require('fs');var Redis=require(_0xa7af('0x5'));var db=require(_0xa7af('0x6'))['db'];var utils=require(_0xa7af('0x7'));var logger=require(_0xa7af('0x8'))('rpc');var config=require(_0xa7af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa7af('0xa')][_0xa7af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50da13,_0x34d56c,_0x1e1a2b){return new BPromise(function(_0x388fa1,_0x2f3841){return client[_0xa7af('0xc')](_0x50da13,_0x1e1a2b)['then'](function(_0x5046c0){logger['info'](_0xa7af('0xd'),_0x34d56c,'request\x20sent');logger[_0xa7af('0xe')](_0xa7af('0xf'),_0x34d56c,_0xa7af('0x10'),JSON[_0xa7af('0x11')](_0x5046c0));if(_0x5046c0[_0xa7af('0x12')]){if(_0x5046c0[_0xa7af('0x12')][_0xa7af('0x13')]===0x1f4){logger[_0xa7af('0x12')](_0xa7af('0xd'),_0x34d56c,_0x5046c0[_0xa7af('0x12')][_0xa7af('0x14')]);return _0x2f3841(_0x5046c0['error'][_0xa7af('0x14')]);}logger[_0xa7af('0x12')](_0xa7af('0xd'),_0x34d56c,_0x5046c0[_0xa7af('0x12')]['message']);return _0x388fa1(_0x5046c0['error']['message']);}else{logger[_0xa7af('0x15')](_0xa7af('0xd'),_0x34d56c,_0xa7af('0x10'));_0x388fa1(_0x5046c0[_0xa7af('0x16')][_0xa7af('0x14')]);}})['catch'](function(_0x53e7c){logger['error'](_0xa7af('0xd'),_0x34d56c,_0x53e7c);_0x2f3841(_0x53e7c);});});} \ No newline at end of file +var _0x30b6=['CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x30b6,0x70));var _0x630b=function(_0x193dde,_0x325ba9){_0x193dde=_0x193dde-0x0;var _0x258de5=_0x30b6[_0x193dde];return _0x258de5;};'use strict';var _=require(_0x630b('0x0'));var util=require('util');var moment=require(_0x630b('0x1'));var BPromise=require(_0x630b('0x2'));var rs=require(_0x630b('0x3'));var fs=require('fs');var Redis=require(_0x630b('0x4'));var db=require(_0x630b('0x5'))['db'];var utils=require(_0x630b('0x6'));var logger=require('../../config/logger')(_0x630b('0x7'));var config=require(_0x630b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x630b('0x9')][_0x630b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48a187,_0x1b9bb8,_0x4336a4){return new BPromise(function(_0x4416b5,_0x1a9ce4){return client[_0x630b('0xb')](_0x48a187,_0x4336a4)[_0x630b('0xc')](function(_0x46ab2e){logger[_0x630b('0xd')](_0x630b('0xe'),_0x1b9bb8,_0x630b('0xf'));logger['debug'](_0x630b('0x10'),_0x1b9bb8,'request\x20sent',JSON['stringify'](_0x46ab2e));if(_0x46ab2e[_0x630b('0x11')]){if(_0x46ab2e['error'][_0x630b('0x12')]===0x1f4){logger[_0x630b('0x11')](_0x630b('0xe'),_0x1b9bb8,_0x46ab2e[_0x630b('0x11')][_0x630b('0x13')]);return _0x1a9ce4(_0x46ab2e[_0x630b('0x11')][_0x630b('0x13')]);}logger[_0x630b('0x11')](_0x630b('0xe'),_0x1b9bb8,_0x46ab2e[_0x630b('0x11')][_0x630b('0x13')]);return _0x4416b5(_0x46ab2e[_0x630b('0x11')]['message']);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x1b9bb8,'request\x20sent');_0x4416b5(_0x46ab2e[_0x630b('0x14')][_0x630b('0x13')]);}})['catch'](function(_0x20dd10){logger['error']('CmCompany,\x20%s,\x20%s',_0x1b9bb8,_0x20dd10);_0x1a9ce4(_0x20dd10);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d14520c..e0edc37 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 _0x7a75=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','/:id/contacts','addContacts','put','delete','destroy'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a75,0x18f));var _0x57a7=function(_0x49608e,_0x4bebb2){_0x49608e=_0x49608e-0x0;var _0x5eca4f=_0x7a75[_0x49608e];return _0x5eca4f;};'use strict';var multer=require(_0x57a7('0x0'));var util=require(_0x57a7('0x1'));var path=require('path');var timeout=require(_0x57a7('0x2'));var express=require(_0x57a7('0x3'));var router=express['Router']();var fs_extra=require(_0x57a7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x57a7('0x5'));var config=require('../../config/environment');var controller=require(_0x57a7('0x6'));router[_0x57a7('0x7')]('/',auth[_0x57a7('0x8')](),controller[_0x57a7('0x9')]);router[_0x57a7('0x7')](_0x57a7('0xa'),auth[_0x57a7('0x8')](),controller[_0x57a7('0xb')]);router['get'](_0x57a7('0xc'),auth[_0x57a7('0x8')](),controller[_0x57a7('0xd')]);router[_0x57a7('0x7')]('/:id/contacts',auth[_0x57a7('0x8')](),controller[_0x57a7('0xe')]);router[_0x57a7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x57a7('0x10'),auth['isAuthenticated'](),controller[_0x57a7('0x11')]);router[_0x57a7('0x12')](_0x57a7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x57a7('0x13')](_0x57a7('0xc'),auth[_0x57a7('0x8')](),controller[_0x57a7('0x14')]);module['exports']=router; \ No newline at end of file +var _0x06cf=['get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','create','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x06cf,0xce));var _0xf06c=function(_0x2028af,_0x17496f){_0x2028af=_0x2028af-0x0;var _0x4bb7aa=_0x06cf[_0x2028af];return _0x4bb7aa;};'use strict';var multer=require(_0xf06c('0x0'));var util=require(_0xf06c('0x1'));var path=require(_0xf06c('0x2'));var timeout=require(_0xf06c('0x3'));var express=require(_0xf06c('0x4'));var router=express[_0xf06c('0x5')]();var fs_extra=require(_0xf06c('0x6'));var auth=require(_0xf06c('0x7'));var interaction=require(_0xf06c('0x8'));var config=require(_0xf06c('0x9'));var controller=require('./cmCompany.controller');router[_0xf06c('0xa')]('/',auth['isAuthenticated'](),controller[_0xf06c('0xb')]);router[_0xf06c('0xa')](_0xf06c('0xc'),auth[_0xf06c('0xd')](),controller[_0xf06c('0xe')]);router[_0xf06c('0xa')](_0xf06c('0xf'),auth[_0xf06c('0xd')](),controller[_0xf06c('0x10')]);router[_0xf06c('0xa')](_0xf06c('0x11'),auth[_0xf06c('0xd')](),controller[_0xf06c('0x12')]);router['post']('/',auth[_0xf06c('0xd')](),controller[_0xf06c('0x13')]);router[_0xf06c('0x14')](_0xf06c('0x11'),auth['isAuthenticated'](),controller['addContacts']);router['put'](_0xf06c('0xf'),auth['isAuthenticated'](),controller[_0xf06c('0x15')]);router['delete'](_0xf06c('0xf'),auth[_0xf06c('0xd')](),controller[_0xf06c('0x16')]);module[_0xf06c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8f07322..ce73bc8 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 _0x79a1=['STRING','TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x549d16,_0x4d069a){var _0x344ccc=function(_0x1d992a){while(--_0x1d992a){_0x549d16['push'](_0x549d16['shift']());}};_0x344ccc(++_0x4d069a);}(_0x79a1,0xf5));var _0x179a=function(_0x27a9fa,_0x4e93e5){_0x27a9fa=_0x27a9fa-0x0;var _0x4f525d=_0x79a1[_0x27a9fa];return _0x4f525d;};'use strict';var _=require(_0x179a('0x0'));var Sequelize=require(_0x179a('0x1'));module[_0x179a('0x2')]={'firstName':{'type':Sequelize[_0x179a('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x179a('0x3')]},'street':{'type':Sequelize[_0x179a('0x3')]},'postalCode':{'type':Sequelize[_0x179a('0x3')]},'city':{'type':Sequelize[_0x179a('0x3')]},'country':{'type':Sequelize[_0x179a('0x3')]},'dateOfBirth':{'type':Sequelize[_0x179a('0x3')]},'description':{'type':Sequelize[_0x179a('0x4')]},'phone':{'type':Sequelize[_0x179a('0x3')]},'mobile':{'type':Sequelize[_0x179a('0x3')]},'fax':{'type':Sequelize[_0x179a('0x3')]},'email':{'type':Sequelize[_0x179a('0x3')]},'url':{'type':Sequelize[_0x179a('0x3')]},'facebook':{'type':Sequelize[_0x179a('0x3')]},'fb_data':{'type':Sequelize[_0x179a('0x3')]},'twitter':{'type':Sequelize[_0x179a('0x3')]},'skype':{'type':Sequelize[_0x179a('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x179a('0x3')]},'line':{'type':Sequelize[_0x179a('0x3')]},'wechat':{'type':Sequelize[_0x179a('0x3')]},'telegram':{'type':Sequelize[_0x179a('0x3')]},'UserId':{'type':Sequelize[_0x179a('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x179a('0x5')](0x2)[_0x179a('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x179a('0x7')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x179a('0x5')]}}; \ No newline at end of file +var _0xa4d2=['STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0xa4d2,0x175));var _0x2a4d=function(_0x3a4453,_0x4c2661){_0x3a4453=_0x3a4453-0x0;var _0xb0cefd=_0xa4d2[_0x3a4453];return _0xb0cefd;};'use strict';var _=require(_0x2a4d('0x0'));var Sequelize=require(_0x2a4d('0x1'));module[_0x2a4d('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x2a4d('0x3')]},'street':{'type':Sequelize[_0x2a4d('0x3')]},'postalCode':{'type':Sequelize[_0x2a4d('0x3')]},'city':{'type':Sequelize[_0x2a4d('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x2a4d('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x2a4d('0x3')]},'fax':{'type':Sequelize[_0x2a4d('0x3')]},'email':{'type':Sequelize[_0x2a4d('0x3')]},'url':{'type':Sequelize[_0x2a4d('0x3')]},'facebook':{'type':Sequelize[_0x2a4d('0x3')]},'fb_data':{'type':Sequelize[_0x2a4d('0x3')]},'twitter':{'type':Sequelize[_0x2a4d('0x3')]},'skype':{'type':Sequelize[_0x2a4d('0x3')]},'teams':{'type':Sequelize[_0x2a4d('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x2a4d('0x3')]},'wechat':{'type':Sequelize[_0x2a4d('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x2a4d('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x2a4d('0x3')]},'priority':{'type':Sequelize[_0x2a4d('0x4')](0x2)[_0x2a4d('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2a4d('0x6')],'defaultValue':Sequelize[_0x2a4d('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x2a4d('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e5a34a5..d428970 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 _0x54da=['isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','all','show','Tag','Tags','color','tag','CmContactHasItem','Phones','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','CmCustomField','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','item','ContactItemType','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','nolimit','ContactId','count','includeAll','rows','getHopperHistories','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','createReadStream','file','meta','import','User','agent','binding','firstName','../../components/import/cm/csv2','stringify','pid','exit','error\x20child\x20process','importUpdates','No\x20firstName\x20column\x20specified','start\x20child\x20process\x20correctly!','getJourney','mail','openchannel','voice','resolve','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','findAndCountAll','fullname','startCase','Website','closedAt','disposition','thirdDisposition','UserId','key','Owner','chat','browserName','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','externalUrl','threadId','sortBy','reverse','value','moment','bluebird','util','path','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','./cmContact.socket','register','status','offset','undefined','limit','set','Content-Range','update','then','end','error','stack','name','send','describe','getOptions','findAll','query','user','catch','destroy','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith'];(function(_0x295e0f,_0x1c4d1c){var _0x2745ba=function(_0x56a2a9){while(--_0x56a2a9){_0x295e0f['push'](_0x295e0f['shift']());}};_0x2745ba(++_0x1c4d1c);}(_0x54da,0x1c5));var _0xa54d=function(_0x2b37b5,_0x4f677b){_0x2b37b5=_0x2b37b5-0x0;var _0x36df6d=_0x54da[_0x2b37b5];return _0x36df6d;};'use strict';var moment=require(_0xa54d('0x0'));var BPromise=require(_0xa54d('0x1'));var util=require(_0xa54d('0x2'));var path=require(_0xa54d('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xa54d('0x4'));var contacts=require(_0xa54d('0x5'));var qs=require(_0xa54d('0x6'));var logger=require(_0xa54d('0x7'))('api');var config=require(_0xa54d('0x8'));var shared=require(_0xa54d('0x9'));var db=require(_0xa54d('0xa'))['db'];config[_0xa54d('0xb')]=_[_0xa54d('0xc')](config[_0xa54d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa54d('0xb')]));require(_0xa54d('0xd'))[_0xa54d('0xe')](socket);function respondWithResult(_0x54824c,_0x2ae123){_0x2ae123=_0x2ae123||0xc8;return function(_0x9b94d3){if(_0x9b94d3){return _0x54824c[_0xa54d('0xf')](_0x2ae123)['json'](_0x9b94d3);}};}function respondWithFilteredResult(_0x3591f8,_0xbf698a){return function(_0x2621ef){if(_0x2621ef){var _0xea2e14=typeof _0xbf698a[_0xa54d('0x10')]===_0xa54d('0x11')&&typeof _0xbf698a[_0xa54d('0x12')]===_0xa54d('0x11');var _0x3c469f=_0x2621ef['count'];var _0x2edba4=_0xea2e14?0x0:_0xbf698a['offset'];var _0x1e73e8=_0xea2e14?_0x2621ef['count']:_0xbf698a[_0xa54d('0x10')]+_0xbf698a[_0xa54d('0x12')];var _0xf34acc;if(_0x1e73e8>=_0x3c469f){_0x1e73e8=_0x3c469f;_0xf34acc=0xc8;}else{_0xf34acc=0xce;}_0x3591f8['status'](_0xf34acc);return _0x3591f8[_0xa54d('0x13')](_0xa54d('0x14'),_0x2edba4+'-'+_0x1e73e8+'/'+_0x3c469f)['json'](_0x2621ef);}return null;};}function saveUpdates(_0x247102){return function(_0x3a2a0f){if(_0x3a2a0f){return _0x3a2a0f[_0xa54d('0x15')](_0x247102)['then'](function(_0x37c826){return _0x37c826;});}return null;};}function removeEntity(_0x216656){return function(_0x218fd0){if(_0x218fd0){return _0x218fd0['destroy']()[_0xa54d('0x16')](function(){_0x216656[_0xa54d('0xf')](0xcc)[_0xa54d('0x17')]();});}};}function handleEntityNotFound(_0x23e2ac){return function(_0x2e388a){if(!_0x2e388a){_0x23e2ac['sendStatus'](0x194);}return _0x2e388a;};}function handleError(_0x4aafea,_0x6da888){_0x6da888=_0x6da888||0x1f4;return function(_0x5662ea){logger[_0xa54d('0x18')](_0x5662ea[_0xa54d('0x19')]);if(_0x5662ea[_0xa54d('0x1a')]){delete _0x5662ea['name'];}_0x4aafea[_0xa54d('0xf')](_0x6da888)[_0xa54d('0x1b')](_0x5662ea);};}exports['index']=function(_0x59dc29,_0x76df9b){var _0x3e83a0={};return contacts[_0xa54d('0x1c')]()[_0xa54d('0x16')](function(_0x488de5){_0x3e83a0=qs[_0xa54d('0x1d')](_0x488de5,_0x59dc29);return contacts[_0xa54d('0x1e')](_0x59dc29[_0xa54d('0x1f')],_0x59dc29[_0xa54d('0x20')],_0x3e83a0,_0x488de5);})[_0xa54d('0x16')](respondWithFilteredResult(_0x76df9b,_0x3e83a0))[_0xa54d('0x21')](handleError(_0x76df9b,null));};exports[_0xa54d('0x22')]=function(_0x5ecfb5,_0x1f433c){return db[_0xa54d('0x23')][_0xa54d('0x24')]({'where':{'id':_0x5ecfb5[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x1f433c,null))[_0xa54d('0x16')](removeEntity(_0x1f433c,null))[_0xa54d('0x21')](handleError(_0x1f433c,null));};exports[_0xa54d('0x1c')]=function(_0x242f2e,_0x539c26){return db[_0xa54d('0x23')][_0xa54d('0x1c')]()[_0xa54d('0x16')](function(_0x262dc0){delete _0x262dc0[_0xa54d('0x26')];for(var _0x5def55=0x0;_0x5def550x0){return new Promise(function(_0x26dc16){var _0x166673=[];for(var _0xc83e12=0x0;_0xc83e12<_0x49bb31['length'];_0xc83e12++){_0x166673[_0xa54d('0x64')](insertAdditionalPhones(_0x49bb31[_0xc83e12]['contact'],_0x49bb31[_0xc83e12][_0xa54d('0x5e')]));}Promise[_0xa54d('0x67')](_0x166673)['then'](function(){_0x26dc16(0x1);});})[_0xa54d('0x16')](function(){return{'success':_0x26af33,'failure':_0x4c6dc8,'duplicates':_0x1b108e};});}else{return{'success':_0x26af33,'failure':_0x4c6dc8,'duplicates':_0x1b108e};}}})['then'](respondWithResult(_0x5afe3e,0xc9))[_0xa54d('0x21')](handleError(_0x5afe3e,null));};exports[_0xa54d('0x68')]=function(_0x4f4ba0,_0x50a08b){var _0x445081;return db['CmContact'][_0xa54d('0x1c')]()[_0xa54d('0x16')](function(_0x1f01d4){return db['CmContact'][_0xa54d('0x24')]({'where':{'id':_0x4f4ba0[_0xa54d('0x25')]['id']},'include':[{'model':db[_0xa54d('0x69')],'as':_0xa54d('0x6a'),'attributes':['id',_0xa54d('0x1a'),_0xa54d('0x6b')],'required':_0x4f4ba0[_0xa54d('0x1f')][_0xa54d('0x6c')]?!![]:![]},{'model':db[_0xa54d('0x6d')],'as':_0xa54d('0x6e'),'where':{'CmContactId':_0x4f4ba0[_0xa54d('0x25')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xa54d('0x6f')}]}],'order':[db[_0xa54d('0x70')][_0xa54d('0x71')](_0xa54d('0x72'))],'attributes':_['keys'](_0x1f01d4)});})[_0xa54d('0x16')](function(_0x5f146a){if(!_[_0xa54d('0x5a')](_0x5f146a)){_0x445081=_0x5f146a[_0xa54d('0x39')]({'plain':!![]});var _0x41c569={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5f146a&&_0x5f146a[_0xa54d('0x65')]){if(_0x5f146a[_0xa54d('0x65')]){_0x41c569[_0xa54d('0x62')][_0xa54d('0x73')][_0xa54d('0x64')]({'ListId':{'$ne':_0x5f146a[_0xa54d('0x65')]}});}}return db['CmCustomField'][_0xa54d('0x1e')](_0x41c569);}})[_0xa54d('0x16')](function(_0x22861e){if(!_[_0xa54d('0x5a')](_0x22861e)){return _[_0xa54d('0x74')](_0x445081,_[_0xa54d('0x75')](_0x22861e,function(_0x3d8eb3){return util[_0xa54d('0x76')](_0xa54d('0x77'),_0x3d8eb3['id']);}));}})[_0xa54d('0x16')](handleEntityNotFound(_0x50a08b,null))[_0xa54d('0x16')](respondWithResult(_0x50a08b,null))[_0xa54d('0x21')](handleError(_0x50a08b,null));};exports[_0xa54d('0x15')]=function(_0x329a38,_0x456c41){var _0xabfa2;if(_0x329a38['body']['id']){delete _0x329a38[_0xa54d('0x37')]['id'];}if(!_[_0xa54d('0x5a')](_0x329a38[_0xa54d('0x37')][_0xa54d('0x5b')])){var _0x280f46=_0x329a38[_0xa54d('0x37')][_0xa54d('0x5b')];if(!_[_0xa54d('0x5a')](shared[_0xa54d('0x5c')][_0x280f46]))_0x329a38[_0xa54d('0x37')][_0xa54d('0x5d')]=shared[_0xa54d('0x5c')][_0x280f46][_0xa54d('0x5d')];}return db['CmContact']['find']({'where':{'id':_0x329a38[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x456c41,null))[_0xa54d('0x16')](saveUpdates(_0x329a38[_0xa54d('0x37')],null))[_0xa54d('0x16')](function(_0x437f19){_0xabfa2=_0x437f19;var _0x362a03={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x437f19&&_0x437f19['ListId']){if(_0x437f19[_0xa54d('0x65')]){_0x362a03[_0xa54d('0x62')]['$and'][_0xa54d('0x64')]({'ListId':{'$ne':_0x437f19[_0xa54d('0x65')]}});}}return db[_0xa54d('0x78')][_0xa54d('0x1e')](_0x362a03);})[_0xa54d('0x16')](function(_0x14249a){if(_0x14249a){return _[_0xa54d('0x74')](_['pickBy'](_0x329a38[_0xa54d('0x37')],function(_0x1d6040,_0x150715){return _[_0xa54d('0x29')](_0x150715,_0xa54d('0x2a'));}),_[_0xa54d('0x75')](_0x14249a,function(_0x26fc81){return util['format'](_0xa54d('0x77'),_0x26fc81['id']);}));}})[_0xa54d('0x16')](function(_0x4741e7){if(_0x4741e7&&!_[_0xa54d('0x79')](_0x4741e7)){var _0x1b0c7a=squel[_0xa54d('0x15')]()[_0xa54d('0x7a')](_0xa54d('0x7b'))[_0xa54d('0x7c')](_0x4741e7)[_0xa54d('0x62')](_0xa54d('0x7d'),_0x329a38[_0xa54d('0x25')]['id'])[_0xa54d('0x7e')]();return db['sequelize']['query'](_0x1b0c7a['text'],{'replacements':_0x1b0c7a[_0xa54d('0x31')]});}})[_0xa54d('0x16')](function(){if(_0x329a38[_0xa54d('0x37')][_0xa54d('0x7f')]&&_0xabfa2){return db[_0xa54d('0x3d')][_0xa54d('0x15')]({'phone':_0x329a38['body'][_0xa54d('0x7f')],'OrderBy':0x0},{'where':{'ContactId':_0xabfa2['id']}});}})[_0xa54d('0x16')](function(){return _0xabfa2;})[_0xa54d('0x16')](respondWithResult(_0x456c41,null))['catch'](handleError(_0x456c41,null));};exports[_0xa54d('0x80')]=function(_0x543314,_0x185df7){var _0x200ad7={};var _0x49a0c4={};var _0x232fc1;var _0x4e17e9;return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0x543314[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x185df7,null))['then'](function(_0x59b3b9){if(_0x59b3b9){_0x232fc1=_0x59b3b9;_0x49a0c4[_0xa54d('0x82')]=_[_0xa54d('0x27')](db[_0xa54d('0x69')][_0xa54d('0x83')]);_0x49a0c4[_0xa54d('0x1f')]=_['keys'](_0x543314[_0xa54d('0x1f')]);_0x49a0c4[_0xa54d('0x84')]=_[_0xa54d('0x85')](_0x49a0c4[_0xa54d('0x82')],_0x49a0c4[_0xa54d('0x1f')]);_0x200ad7[_0xa54d('0x86')]=_['intersection'](_0x49a0c4[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0x543314[_0xa54d('0x1f')][_0xa54d('0x87')]));_0x200ad7[_0xa54d('0x86')]=_0x200ad7['attributes'][_0xa54d('0x28')]?_0x200ad7[_0xa54d('0x86')]:_0x49a0c4['model'];_0x200ad7[_0xa54d('0x88')]=qs[_0xa54d('0x89')](_0x543314['query'][_0xa54d('0x89')]);_0x200ad7[_0xa54d('0x62')]=qs[_0xa54d('0x84')](_[_0xa54d('0x8a')](_0x543314[_0xa54d('0x1f')],_0x49a0c4[_0xa54d('0x84')]));if(_0x543314[_0xa54d('0x1f')][_0xa54d('0x8b')]){_0x200ad7[_0xa54d('0x62')]=_['merge'](_0x200ad7[_0xa54d('0x62')],{'$or':_[_0xa54d('0x75')](_0x200ad7[_0xa54d('0x86')],function(_0x1b0afc){var _0x5641d1={};_0x5641d1[_0x1b0afc]={'$like':'%'+_0x543314['query'][_0xa54d('0x8b')]+'%'};return _0x5641d1;})});}_0x200ad7=_['merge']({},_0x200ad7,_0x543314[_0xa54d('0x8c')]);return _0x232fc1[_0xa54d('0x80')](_0x200ad7);}})[_0xa54d('0x16')](function(_0x4a8cad){if(_0x4a8cad){_0x4e17e9=_0x4a8cad[_0xa54d('0x28')];if(!_0x543314[_0xa54d('0x1f')]['hasOwnProperty']('nolimit')){_0x200ad7[_0xa54d('0x12')]=qs['limit'](_0x543314[_0xa54d('0x1f')][_0xa54d('0x12')]);_0x200ad7['offset']=qs[_0xa54d('0x10')](_0x543314[_0xa54d('0x1f')]['offset']);}return _0x232fc1[_0xa54d('0x80')](_0x200ad7);}})[_0xa54d('0x16')](function(_0x571b97){if(_0x571b97){return _0x571b97?{'count':_0x4e17e9,'rows':_0x571b97}:null;}})[_0xa54d('0x16')](respondWithResult(_0x185df7,null))[_0xa54d('0x21')](handleError(_0x185df7,null));};exports[_0xa54d('0x8d')]=function(_0x2ebd19,_0x286089){if(_0x2ebd19['body']['id']){delete _0x2ebd19[_0xa54d('0x37')]['id'];}return db['CmContact'][_0xa54d('0x81')]({'where':{'id':_0x2ebd19[_0xa54d('0x25')]['id']}})['then'](handleEntityNotFound(_0x286089,null))[_0xa54d('0x16')](function(_0x2e7036){if(_0x2e7036){return _0x2e7036[_0xa54d('0x8d')](_0x2ebd19[_0xa54d('0x37')][_0xa54d('0x8e')]||[]);}return null;})[_0xa54d('0x16')](respondWithResult(_0x286089,null))['catch'](handleError(_0x286089,null));};exports[_0xa54d('0x8f')]=function(_0x14a8a1,_0x2a398e){var _0x39aeb5=[];_0x39aeb5[_0xa54d('0x64')](addAdditionalPhones(_0x14a8a1[_0xa54d('0x37')]));Promise[_0xa54d('0x67')](_0x39aeb5)[_0xa54d('0x16')](function(){_0x39aeb5=[];_0x39aeb5[_0xa54d('0x64')](deleteCmHopperPhones(_0x14a8a1[_0xa54d('0x37')]['id']));_0x39aeb5[_0xa54d('0x64')](addCmHopperPhones(_0x14a8a1[_0xa54d('0x37')]['id']));Promise['all'](_0x39aeb5)[_0xa54d('0x16')](function(){return[0x1];})[_0xa54d('0x16')](respondWithResult(_0x2a398e,null));});};function addAdditionalPhones(_0x5969f2){var _0x247353;return new Promise(function(_0xb6d873){return db[_0xa54d('0x6d')]['destroy']({'where':{'CmContactId':_0x5969f2['id']}})['then'](function(){db['ContactItemType'][_0xa54d('0x1e')]({'raw':!![],'attributes':['id',_0xa54d('0x90')]})['then'](function(_0x58e1dd){var _0x4553e7=[];for(var _0x3469c2=0x0;_0x3469c2<_0x5969f2[_0xa54d('0x91')][_0xa54d('0x28')];_0x3469c2++){var _0x2db280=_0x5969f2[_0xa54d('0x92')]?_[_0xa54d('0x5a')](_0x5969f2['item_types'][_0x3469c2])?'':_0x5969f2[_0xa54d('0x92')][_0x3469c2]:_0x5969f2[_0xa54d('0x91')][_0x3469c2]['ItemTypeId']?_0x5969f2['items'][_0x3469c2][_0xa54d('0x93')]:'';var _0x51f7d9=_[_0xa54d('0x5a')](_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x94')])?'':_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x94')];var _0x532e73=_0x2db280+':'+_0x5969f2['items'][_0x3469c2][_0xa54d('0x7f')]+'§'+_0x51f7d9;if(_[_0xa54d('0x5a')](_0x247353))_0x247353=_0x532e73;else _0x247353+=';'+_0x532e73;var _0x25978f=null;var _0x2e029a=null;if(_0x5969f2[_0xa54d('0x92')]){if(!_[_0xa54d('0x5a')](_0x5969f2['item_types'][_0x3469c2])){_0x2e029a=_[_0xa54d('0x24')](_0x58e1dd,function(_0x484d85){return _0x484d85['id']===_0x5969f2[_0xa54d('0x92')][_0x3469c2];});if(!_[_0xa54d('0x5a')](_0x2e029a)){_0x25978f=_0x2e029a[_0xa54d('0x90')];}}}else{if(!_[_0xa54d('0x5a')](_0x5969f2['items'][_0x3469c2])){_0x2e029a=_['find'](_0x58e1dd,function(_0x2df766){return _0x2df766['id']===_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x93')];});if(!_[_0xa54d('0x5a')](_0x2e029a)){_0x25978f=_0x3469c2;}}}if(_[_0xa54d('0x5a')](_0x25978f)){_0x25978f=0x64;}_0x4553e7[_0xa54d('0x64')](addAdditionalPhone(_0x5969f2['id'],_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x7f')],_0x5969f2['item_types']?_[_0xa54d('0x5a')](_0x5969f2[_0xa54d('0x92')][_0x3469c2])?null:_0x5969f2[_0xa54d('0x92')][_0x3469c2]:_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x93')]?_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x93')]:null,_0x25978f,_0x51f7d9));}Promise[_0xa54d('0x67')](_0x4553e7)[_0xa54d('0x16')](function(){db[_0xa54d('0x23')][_0xa54d('0x15')]({'AdditionalPhones':_0x247353},{'where':{'id':_0x5969f2['id']}})[_0xa54d('0x16')](function(){_0xb6d873(0x1);});});});});});}function addAdditionalPhone(_0x46f058,_0x1f94a5,_0x2c6448,_0x241f87,_0x337ce0){return db[_0xa54d('0x6d')][_0xa54d('0x24')]({'where':{'CmContactId':_0x46f058,'item':_0x1f94a5}})[_0xa54d('0x16')](function(_0x44b7c5){if(_0x44b7c5)logger[_0xa54d('0x32')](_0xa54d('0x95'),_0x44b7c5);else{db[_0xa54d('0x6d')][_0xa54d('0x58')]({'CmContactId':_0x46f058,'item':_0x1f94a5,'ItemTypeId':_0x2c6448,'OrderBy':_0x241f87,'ItemClass':'PHONE','description':_0x337ce0});}});}function deleteCmHopperPhones(_0x193ac9){return new Promise(function(_0x3f62fb){return db[_0xa54d('0x3d')][_0xa54d('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x193ac9}})[_0xa54d('0x16')](function(_0x4aa056){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x4aa056,'id')}}});})[_0xa54d('0x16')](function(){_0x3f62fb(0x1);});});}function addCmHopperPhones(_0x457309){return new Promise(function(_0x566c82){return db['CmHopper'][_0xa54d('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x457309}})[_0xa54d('0x16')](function(_0x534af3){var _0x389666=[];_[_0xa54d('0x75')](_0x534af3,function(_0x53d3a5){_0x389666[_0xa54d('0x64')](createCmHopperPhone(_0x457309,_0x53d3a5['id']));});Promise['all'](_0x389666)[_0xa54d('0x16')](function(){_0x566c82(0x1);});});});}function createCmHopperPhone(_0x326e04,_0x4afa5f){return new Promise(function(_0x557c4d){db['CmContactHasItem'][_0xa54d('0x1e')]({'raw':!![],'attributes':[_0xa54d('0x96'),_0xa54d('0x90')],'where':{'CmContactId':_0x326e04,'ItemClass':'PHONE'},'include':[{'model':db[_0xa54d('0x97')],'attributes':[_0xa54d('0x90')],'as':_0xa54d('0x6f')}],'order':[_0xa54d('0x90'),db[_0xa54d('0x70')][_0xa54d('0x71')](_0xa54d('0x98'))]})['then'](function(_0x17b389){var _0x500c0a=0x1;var _0x34897f=_['map'](_0x17b389,function(_0x39265c){_0x39265c[_0xa54d('0x99')]=_0x4afa5f;_0x39265c[_0xa54d('0x7f')]=_0x39265c[_0xa54d('0x96')];_0x39265c[_0xa54d('0x90')]=_0x500c0a;delete _0x39265c['ItemType.OrderBy'];_0x500c0a=_0x500c0a+0x1;return _0x39265c;});return db['CmHopperAdditionalPhone'][_0xa54d('0x5f')](_0x34897f,{});})[_0xa54d('0x16')](function(){_0x557c4d(0x1);});});}function insertAdditionalPhones(_0x222518,_0x293fb4){return new Promise(function(_0x132881){var _0x384582=[];for(var _0xe368aa=0x0;_0xe368aa<_0x293fb4[_0xa54d('0x28')];_0xe368aa++){var _0xb92ada=_0x293fb4[_0xe368aa];_0x384582[_0xa54d('0x64')](parseContactItemType(_0xb92ada));}Promise['all'](_0x384582)[_0xa54d('0x16')](function(){var _0x346162={'id':_0x222518['id'],'items':_0x293fb4};return addAdditionalPhones(_0x346162)['then'](function(){return addCmHopperPhones(_0x222518['id']);});})[_0xa54d('0x16')](function(){_0x132881(_0x222518);});});}function parseContactItemType(_0x276aac){return new Promise(function(_0x811925){if(_0x276aac[_0xa54d('0x35')](_0xa54d('0x93'))){_0x811925(_0x276aac);}else{return db[_0xa54d('0x97')][_0xa54d('0x24')]({'where':{'name':_0x276aac['ItemType']}})[_0xa54d('0x16')](function(_0x5d193c){if(_[_0xa54d('0x5a')](_0x5d193c))_0x276aac[_0xa54d('0x93')]=null;else _0x276aac[_0xa54d('0x93')]=_0x5d193c['id'];_0x811925(_0x276aac);});}});}exports[_0xa54d('0x9a')]=function(_0x477629,_0x44f02a){return db['CmContactHasItem'][_0xa54d('0x1e')]({'raw':!![],'where':{'CmContactId':_0x477629['params']['id'],'ItemClass':_0xa54d('0x9b')},'include':[{'model':db[_0xa54d('0x97')],'as':'ItemType'}],'order':[[_0xa54d('0x90')],[db[_0xa54d('0x70')][_0xa54d('0x71')](_0xa54d('0x98'))]]})[_0xa54d('0x16')](function(_0x13e21f){return _0x13e21f;})['then'](respondWithResult(_0x44f02a,null))['catch'](handleError(_0x44f02a,null));};exports[_0xa54d('0x9c')]=function(_0x1954e8,_0x147d7b){return db[_0xa54d('0x6d')]['findAll']({'raw':!![],'where':{'CmContactId':_0x1954e8[_0xa54d('0x37')]['fromContactId']}})[_0xa54d('0x16')](function(_0x1311b8){var _0x4bc55e=_[_0xa54d('0x75')](_0x1311b8,function(_0x239a2b){_0x239a2b[_0xa54d('0x9d')]=_0x1954e8['body'][_0xa54d('0x9e')];return _0x239a2b;});return db[_0xa54d('0x6d')][_0xa54d('0x5f')](_0x4bc55e,{});})[_0xa54d('0x16')](function(){return addCmHopperPhones(_0x1954e8[_0xa54d('0x37')][_0xa54d('0x9e')]);})['then'](function(){return['ok'];})[_0xa54d('0x16')](respondWithResult(_0x147d7b,null))['catch'](handleError(_0x147d7b,null));};exports[_0xa54d('0x9f')]=function(_0x58b104,_0x557f79){var _0x5b4a83=[];_0x5b4a83['push'](createCmHopperPhone(_0x58b104[_0xa54d('0x37')]['id'],_0x58b104[_0xa54d('0x37')]['hopperId']));Promise[_0xa54d('0x67')](_0x5b4a83)['then'](function(){return[0x1];})['then'](respondWithResult(_0x557f79,null));};exports[_0xa54d('0xa0')]=function(_0x18dc70,_0x1fb1cf){var _0x2d75ec={'raw':![],'where':{}};var _0x4042ea={};var _0x595123={'count':0x0,'rows':[]};return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0x18dc70[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x1fb1cf,null))[_0xa54d('0x16')](function(_0x1b1f04){if(_0x1b1f04){_0x4042ea[_0xa54d('0x82')]=_[_0xa54d('0x27')](db[_0xa54d('0x3d')][_0xa54d('0x83')]);_0x4042ea[_0xa54d('0x1f')]=_[_0xa54d('0x27')](_0x18dc70[_0xa54d('0x1f')]);_0x4042ea['filters']=_['intersection'](_0x4042ea[_0xa54d('0x82')],_0x4042ea['query']);_0x2d75ec[_0xa54d('0x86')]=_[_0xa54d('0x85')](_0x4042ea[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0x18dc70[_0xa54d('0x1f')]['fields']));_0x2d75ec[_0xa54d('0x86')]=_0x2d75ec[_0xa54d('0x86')]['length']?_0x2d75ec[_0xa54d('0x86')]:_0x4042ea['model'];if(!_0x18dc70[_0xa54d('0x1f')][_0xa54d('0x35')](_0xa54d('0xa1'))){_0x2d75ec[_0xa54d('0x12')]=qs[_0xa54d('0x12')](_0x18dc70[_0xa54d('0x1f')]['limit']);_0x2d75ec[_0xa54d('0x10')]=qs['offset'](_0x18dc70[_0xa54d('0x1f')][_0xa54d('0x10')]);}_0x2d75ec['order']=qs[_0xa54d('0x89')](_0x18dc70[_0xa54d('0x1f')][_0xa54d('0x89')]);_0x2d75ec[_0xa54d('0x62')]=qs[_0xa54d('0x84')](_[_0xa54d('0x8a')](_0x18dc70['query'],_0x4042ea[_0xa54d('0x84')]));_0x2d75ec[_0xa54d('0x62')][_0xa54d('0xa2')]=_0x1b1f04['id'];if(_0x18dc70['query'][_0xa54d('0x8b')]){_0x2d75ec[_0xa54d('0x62')]=_[_0xa54d('0x36')](_0x2d75ec[_0xa54d('0x62')],{'$or':_[_0xa54d('0x75')](_0x2d75ec['attributes'],function(_0xab0334){var _0x1fe7de={};_0x1fe7de[_0xab0334]={'$like':'%'+_0x18dc70[_0xa54d('0x1f')]['filter']+'%'};return _0x1fe7de;})});}_0x2d75ec=_[_0xa54d('0x36')]({},_0x2d75ec,_0x18dc70['options']);return db['CmHopper'][_0xa54d('0xa3')]({'where':_0x2d75ec[_0xa54d('0x62')]})['then'](function(_0x38580b){_0x595123[_0xa54d('0xa3')]=_0x38580b;if(_0x18dc70[_0xa54d('0x1f')][_0xa54d('0xa4')]){_0x2d75ec['include']=[{'all':!![]}];}return db[_0xa54d('0x3d')][_0xa54d('0x1e')](_0x2d75ec);})[_0xa54d('0x16')](function(_0xe3e72f){_0x595123[_0xa54d('0xa5')]=_0xe3e72f;return _0x595123;});}})[_0xa54d('0x16')](respondWithFilteredResult(_0x1fb1cf,_0x2d75ec))[_0xa54d('0x21')](handleError(_0x1fb1cf,null));};exports[_0xa54d('0xa6')]=function(_0x2e2a5b,_0x384abf){var _0x593144={'raw':!![],'where':{}};var _0x2eef68={};var _0x2dbf81={'count':0x0,'rows':[]};return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0x2e2a5b[_0xa54d('0x25')]['id']}})['then'](handleEntityNotFound(_0x384abf,null))[_0xa54d('0x16')](function(_0x3a19e6){if(_0x3a19e6){_0x2eef68[_0xa54d('0x82')]=_[_0xa54d('0x27')](db[_0xa54d('0x4c')]['rawAttributes']);_0x2eef68[_0xa54d('0x1f')]=_[_0xa54d('0x27')](_0x2e2a5b['query']);_0x2eef68[_0xa54d('0x84')]=_[_0xa54d('0x85')](_0x2eef68[_0xa54d('0x82')],_0x2eef68[_0xa54d('0x1f')]);_0x593144[_0xa54d('0x86')]=_['intersection'](_0x2eef68[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0x2e2a5b['query'][_0xa54d('0x87')]));_0x593144['attributes']=_0x593144['attributes']['length']?_0x593144[_0xa54d('0x86')]:_0x2eef68[_0xa54d('0x82')];if(!_0x2e2a5b['query'][_0xa54d('0x35')](_0xa54d('0xa1'))){_0x593144[_0xa54d('0x12')]=qs[_0xa54d('0x12')](_0x2e2a5b[_0xa54d('0x1f')][_0xa54d('0x12')]);_0x593144[_0xa54d('0x10')]=qs['offset'](_0x2e2a5b['query'][_0xa54d('0x10')]);}_0x593144['order']=qs['sort'](_0x2e2a5b[_0xa54d('0x1f')][_0xa54d('0x89')]);_0x593144[_0xa54d('0x62')]=qs['filters'](_['pick'](_0x2e2a5b['query'],_0x2eef68[_0xa54d('0x84')]));_0x593144[_0xa54d('0x62')][_0xa54d('0xa2')]=_0x3a19e6['id'];if(_0x2e2a5b[_0xa54d('0x1f')][_0xa54d('0x8b')]){_0x593144['where']=_[_0xa54d('0x36')](_0x593144['where'],{'$or':_[_0xa54d('0x75')](_0x593144[_0xa54d('0x86')],function(_0x57fa8c){var _0x48e43a={};_0x48e43a[_0x57fa8c]={'$like':'%'+_0x2e2a5b['query'][_0xa54d('0x8b')]+'%'};return _0x48e43a;})});}_0x593144=_[_0xa54d('0x36')]({},_0x593144,_0x2e2a5b[_0xa54d('0x8c')]);return db[_0xa54d('0x4c')]['count']({'where':_0x593144['where']})[_0xa54d('0x16')](function(_0x19510e){_0x2dbf81[_0xa54d('0xa3')]=_0x19510e;if(_0x2e2a5b[_0xa54d('0x1f')][_0xa54d('0xa4')]){_0x593144[_0xa54d('0xa7')]=[{'all':!![]}];}return db[_0xa54d('0x4c')][_0xa54d('0x1e')](_0x593144);})[_0xa54d('0x16')](function(_0x3bdf75){_0x2dbf81[_0xa54d('0xa5')]=_0x3bdf75;return _0x2dbf81;});}})[_0xa54d('0x16')](respondWithFilteredResult(_0x384abf,_0x593144))[_0xa54d('0x21')](handleError(_0x384abf,null));};exports[_0xa54d('0xa8')]=function(_0xfb4050,_0x56385c){var _0x162d30={'raw':!![],'where':{}};var _0x74d90={};var _0x30b913={'count':0x0,'rows':[]};return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0xfb4050['params']['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x56385c,null))[_0xa54d('0x16')](function(_0x685d92){if(_0x685d92){_0x74d90['model']=_['keys'](db[_0xa54d('0x4b')][_0xa54d('0x83')]);_0x74d90[_0xa54d('0x1f')]=_['keys'](_0xfb4050[_0xa54d('0x1f')]);_0x74d90[_0xa54d('0x84')]=_[_0xa54d('0x85')](_0x74d90[_0xa54d('0x82')],_0x74d90[_0xa54d('0x1f')]);_0x162d30['attributes']=_[_0xa54d('0x85')](_0x74d90[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0xfb4050[_0xa54d('0x1f')]['fields']));_0x162d30[_0xa54d('0x86')]=_0x162d30['attributes'][_0xa54d('0x28')]?_0x162d30[_0xa54d('0x86')]:_0x74d90[_0xa54d('0x82')];if(!_0xfb4050[_0xa54d('0x1f')]['hasOwnProperty']('nolimit')){_0x162d30[_0xa54d('0x12')]=qs[_0xa54d('0x12')](_0xfb4050[_0xa54d('0x1f')]['limit']);_0x162d30[_0xa54d('0x10')]=qs[_0xa54d('0x10')](_0xfb4050[_0xa54d('0x1f')][_0xa54d('0x10')]);}_0x162d30[_0xa54d('0x88')]=qs['sort'](_0xfb4050['query'][_0xa54d('0x89')]);_0x162d30[_0xa54d('0x62')]=qs[_0xa54d('0x84')](_['pick'](_0xfb4050['query'],_0x74d90[_0xa54d('0x84')]));_0x162d30[_0xa54d('0x62')][_0xa54d('0xa2')]=_0x685d92['id'];if(_0xfb4050[_0xa54d('0x1f')][_0xa54d('0x8b')]){_0x162d30['where']=_[_0xa54d('0x36')](_0x162d30[_0xa54d('0x62')],{'$or':_[_0xa54d('0x75')](_0x162d30[_0xa54d('0x86')],function(_0x3f2754){var _0x416d6e={};_0x416d6e[_0x3f2754]={'$like':'%'+_0xfb4050[_0xa54d('0x1f')][_0xa54d('0x8b')]+'%'};return _0x416d6e;})});}_0x162d30=_[_0xa54d('0x36')]({},_0x162d30,_0xfb4050[_0xa54d('0x8c')]);return db[_0xa54d('0x4b')][_0xa54d('0xa3')]({'where':_0x162d30['where']})['then'](function(_0x132084){_0x30b913[_0xa54d('0xa3')]=_0x132084;if(_0xfb4050['query'][_0xa54d('0xa4')]){_0x162d30['include']=[{'all':!![]}];}return db[_0xa54d('0x4b')][_0xa54d('0x1e')](_0x162d30);})[_0xa54d('0x16')](function(_0x578c5b){_0x30b913[_0xa54d('0xa5')]=_0x578c5b;return _0x30b913;});}})[_0xa54d('0x16')](respondWithFilteredResult(_0x56385c,_0x162d30))[_0xa54d('0x21')](handleError(_0x56385c,null));};exports[_0xa54d('0xa9')]=function(_0x2d0c47,_0x90da25){var _0xe2580f={'raw':!![],'where':{}};var _0x3a6d71={};var _0x307f84={'count':0x0,'rows':[]};return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0x2d0c47[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x90da25,null))[_0xa54d('0x16')](function(_0x1c239a){if(_0x1c239a){_0x3a6d71[_0xa54d('0x82')]=_['keys'](db[_0xa54d('0x54')][_0xa54d('0x83')]);_0x3a6d71[_0xa54d('0x1f')]=_[_0xa54d('0x27')](_0x2d0c47[_0xa54d('0x1f')]);_0x3a6d71['filters']=_[_0xa54d('0x85')](_0x3a6d71[_0xa54d('0x82')],_0x3a6d71[_0xa54d('0x1f')]);_0xe2580f['attributes']=_[_0xa54d('0x85')](_0x3a6d71[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x87')]));_0xe2580f[_0xa54d('0x86')]=_0xe2580f['attributes'][_0xa54d('0x28')]?_0xe2580f['attributes']:_0x3a6d71['model'];if(!_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x35')](_0xa54d('0xa1'))){_0xe2580f[_0xa54d('0x12')]=qs[_0xa54d('0x12')](_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x12')]);_0xe2580f[_0xa54d('0x10')]=qs[_0xa54d('0x10')](_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x10')]);}_0xe2580f[_0xa54d('0x88')]=qs[_0xa54d('0x89')](_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x89')]);_0xe2580f[_0xa54d('0x62')]=qs[_0xa54d('0x84')](_['pick'](_0x2d0c47[_0xa54d('0x1f')],_0x3a6d71['filters']));_0xe2580f[_0xa54d('0x62')][_0xa54d('0xa2')]=_0x1c239a['id'];if(_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x8b')]){_0xe2580f[_0xa54d('0x62')]=_[_0xa54d('0x36')](_0xe2580f[_0xa54d('0x62')],{'$or':_[_0xa54d('0x75')](_0xe2580f['attributes'],function(_0x4b195b){var _0x4ea8e1={};_0x4ea8e1[_0x4b195b]={'$like':'%'+_0x2d0c47[_0xa54d('0x1f')]['filter']+'%'};return _0x4ea8e1;})});}_0xe2580f=_[_0xa54d('0x36')]({},_0xe2580f,_0x2d0c47[_0xa54d('0x8c')]);return db[_0xa54d('0x54')]['count']({'where':_0xe2580f[_0xa54d('0x62')]})[_0xa54d('0x16')](function(_0x1e378d){_0x307f84[_0xa54d('0xa3')]=_0x1e378d;if(_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0xa4')]){_0xe2580f['include']=[{'all':!![]}];}return db[_0xa54d('0x54')][_0xa54d('0x1e')](_0xe2580f);})[_0xa54d('0x16')](function(_0x335f5d){_0x307f84[_0xa54d('0xa5')]=_0x335f5d;return _0x307f84;});}})[_0xa54d('0x16')](respondWithFilteredResult(_0x90da25,_0xe2580f))[_0xa54d('0x21')](handleError(_0x90da25,null));};exports[_0xa54d('0xaa')]=function(_0x4a1d06,_0x2d58a9){try{if(!_0x4a1d06[_0xa54d('0x37')]['ListId']){throw new Error(_0xa54d('0xab'));}if(!_0x4a1d06['body']['binding_keys']){throw new Error(_0xa54d('0xac'));}if(!_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xad')]){throw new Error(_0xa54d('0xae'));}if(!_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xaf')]){throw new Error(_0xa54d('0xb0'));}var _0x399e6a=_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xb1')]['split'](',');var _0xe63542=_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xad')][_0xa54d('0xb2')](',');if(!_0x399e6a[_0xa54d('0x28')]||!_0xe63542[_0xa54d('0x28')]||_0x399e6a[_0xa54d('0x28')]!==_0xe63542[_0xa54d('0x28')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x4a1d06[_0xa54d('0x37')][_0xa54d('0x87')]=_[_0xa54d('0xb3')](_0x399e6a,_0xe63542);if(!_0x4a1d06[_0xa54d('0x37')][_0xa54d('0x87')][_0xa54d('0x7f')]){throw new Error(_0xa54d('0xb4'));}if(!_0x4a1d06['body']['fields']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x5e4fe7=path['join'](config[_0xa54d('0xb5')],_0xa54d('0xb6'),_0x4a1d06['file'][_0xa54d('0xb7')]);fs[_0xa54d('0xb8')](_0x5e4fe7,parseInt(_0xa54d('0xb9'),0x8));var _0x500daa=require(_0xa54d('0xba'))[_0xa54d('0xbb')](path[_0xa54d('0x59')](__dirname,_0xa54d('0xbc')),[_0x5e4fe7,_0x4a1d06['body'][_0xa54d('0xb1')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xad')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0x65')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xbd')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0x61')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xaf')]]);return _0x2d58a9[_0xa54d('0xf')](0xc8)[_0xa54d('0xbe')]({'message':_0xa54d('0xbf'),'pid':_0x500daa['pid']});}catch(_0x283c21){return _0x2d58a9[_0xa54d('0xf')](0x1f4)[_0xa54d('0x1b')](_0x283c21);}};exports['upload']=function(_0x16701b,_0x5324f){var _0x47ee85=fs[_0xa54d('0xc0')](_0x16701b[_0xa54d('0xc1')][_0xa54d('0x3')]);Papa['parse'](_0x47ee85,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3c1c87){return _0x5324f[_0xa54d('0xf')](0xc8)[_0xa54d('0xbe')]({'file':_0x16701b[_0xa54d('0xc1')],'fields':_0x3c1c87[_0xa54d('0xc2')][_0xa54d('0x87')]});}});};exports[_0xa54d('0xc3')]=function(_0x135c2a,_0x4464aa){return db[_0xa54d('0xc4')][_0xa54d('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xa54d('0xc5')}})['then'](function(_0x5b9495){var _0xbf178f=![];if(!_0x135c2a[_0xa54d('0x37')][_0xa54d('0x65')]){throw new Error(_0xa54d('0xab'));}if(!_0x135c2a[_0xa54d('0x37')]['binding']['phone']){throw new Error(_0xa54d('0xb4'));}if(!_0x135c2a[_0xa54d('0x37')][_0xa54d('0xc6')][_0xa54d('0xc7')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x135c2a['body'][_0xa54d('0xaf')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0xfd7ce2=require(_0xa54d('0xba'))[_0xa54d('0xbb')](path['join'](__dirname,_0xa54d('0xc8')),[_0x135c2a[_0xa54d('0x25')]['id'],JSON[_0xa54d('0xc9')](_0x135c2a['body']),JSON['stringify'](_0x5b9495)]);_0xfd7ce2['on']('message',function(){_0xbf178f=!![];return _0x4464aa[_0xa54d('0xf')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0xfd7ce2[_0xa54d('0xca')]});});_0xfd7ce2['on'](_0xa54d('0xcb'),function(_0x106fb0){if(_0x106fb0&&!_0xbf178f){return _0x4464aa[_0xa54d('0xf')](0x1f4)[_0xa54d('0xbe')]({'message':_0xa54d('0xcc'),'pid':_0xfd7ce2[_0xa54d('0xca')]});}});})[_0xa54d('0x21')](handleError(_0x4464aa,null));};exports[_0xa54d('0xcd')]=function(_0x266623,_0x36f164){return db['User'][_0xa54d('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xa54d('0xc5')}})['then'](function(_0x1d4c18){var _0x33c4d7=![];if(!_0x266623[_0xa54d('0x37')][_0xa54d('0x65')]){throw new Error(_0xa54d('0xab'));}if(!_0x266623['body'][_0xa54d('0xc6')][_0xa54d('0x7f')]){throw new Error(_0xa54d('0xb4'));}if(!_0x266623['body'][_0xa54d('0xc6')][_0xa54d('0xc7')]){throw new Error(_0xa54d('0xce'));}if(!_0x266623[_0xa54d('0x37')]['socket_timestamp']){throw new Error(_0xa54d('0xb0'));}var _0x5c20be=require(_0xa54d('0xba'))[_0xa54d('0xbb')](path[_0xa54d('0x59')](__dirname,'../../components/import/cm/csvUpdates'),[_0x266623[_0xa54d('0x25')]['id'],JSON[_0xa54d('0xc9')](_0x266623[_0xa54d('0x37')]),JSON['stringify'](_0x1d4c18)]);_0x5c20be['on']('message',function(){_0x33c4d7=!![];return _0x36f164[_0xa54d('0xf')](0xc8)['json']({'message':_0xa54d('0xcf'),'pid':_0x5c20be[_0xa54d('0xca')]});});_0x5c20be['on'](_0xa54d('0xcb'),function(_0x1a5352){if(_0x1a5352&&!_0x33c4d7){return _0x36f164[_0xa54d('0xf')](0x1f4)['json']({'message':_0xa54d('0xcc'),'pid':_0x5c20be['pid']});}});})[_0xa54d('0x21')](handleError(_0x36f164,null));};exports[_0xa54d('0xd0')]=function(_0x9cec9a,_0x1b0f0d){var _0x6919ba=[_0xa54d('0xd1'),'chat','sms',_0xa54d('0xd2'),'fax','whatsapp',_0xa54d('0xd3')];var _0x59e159={'offset':0x0,'order':qs[_0xa54d('0x89')]('-createdAt')},_0x53ada7={'count':0x0,'rows':[]};Promise[_0xa54d('0xd4')]()[_0xa54d('0x16')](function(){if(_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0xd5')]){if(!_['includes'](_0x6919ba,_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0xd5')][_0xa54d('0xd6')]())){throw new Error(_0xa54d('0xd7'));}_0x6919ba=[_0x9cec9a['query'][_0xa54d('0xd5')][_0xa54d('0xd6')]()];}if(_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0xd8')]){try{var _0x33d8c4=JSON[_0xa54d('0xd9')](_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0xd8')]);if(!moment(_0x33d8c4[_0xa54d('0x38')])[_0xa54d('0xda')]()){throw new Error(_0xa54d('0xdb'));}if(!moment(_0x33d8c4['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x52f2ad){throw new Error(_0xa54d('0xdc'));}}if(!_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0x35')]('nolimit')){_0x59e159[_0xa54d('0x12')]=qs['limit'](_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0x12')]||0xa);_0x59e159[_0xa54d('0x10')]=qs[_0xa54d('0x10')](_0x9cec9a['query']['offset']);}var _0x30f91e=_0x6919ba[_0xa54d('0x75')](function(_0x1c7709){if(_0x1c7709===_0xa54d('0xd3')){var _0x45064b={'attributes':['id',_0xa54d('0xdd'),_0xa54d('0x30'),'source',_0xa54d('0xde'),_0xa54d('0xdf'),_0xa54d('0xe0'),_0xa54d('0xe1'),_0xa54d('0xe2'),_0xa54d('0xe3'),_0xa54d('0xe4'),_0xa54d('0xe5'),_0xa54d('0xe6'),_0xa54d('0xe7'),'UserId'],'where':{'ContactId':_0x9cec9a[_0xa54d('0x25')]['id']},'include':[{'model':db[_0xa54d('0xc4')],'as':_0xa54d('0xc4'),'attributes':['id',_0xa54d('0x1a'),'fullname',_0xa54d('0x2e')]}],'order':[[_0xa54d('0xe4'),'DESC']]};if(_0x9cec9a[_0xa54d('0x1f')]['range']){_0x45064b[_0xa54d('0x62')][_0xa54d('0xe4')]={'$gte':_0x33d8c4['from'],'$lte':_0x33d8c4['to']};}return db[_0xa54d('0x4e')][_0xa54d('0xe8')](_0x45064b)[_0xa54d('0x16')](function(_0x5e59b3){_0x53ada7[_0xa54d('0xa3')]+=_0x5e59b3[_0xa54d('0xa3')];return _['map'](_0x5e59b3['rows'],function(_0x20a0fe){var _0x29dee4=_0x20a0fe[_0xa54d('0x39')]({'plain':!![]});_0x29dee4[_0xa54d('0xd5')]=_0x1c7709;if(_0x29dee4[_0xa54d('0xc4')]){_0x29dee4[_0xa54d('0xc4')]={'id':_0x29dee4[_0xa54d('0xc4')]['id'],'name':_0x29dee4['User']['name'],'fullname':_0x29dee4['User'][_0xa54d('0xe9')],'alias':_0x29dee4[_0xa54d('0xc4')][_0xa54d('0x2e')]};}return _0x29dee4;});});}else{var _0x147f6d=_[_0xa54d('0xea')](_0x1c7709)+(_0x1c7709==='chat'?_0xa54d('0xeb'):'Account');var _0x48342a={'attributes':['id','closed',_0xa54d('0xec'),_0xa54d('0xe4'),_0xa54d('0xe3'),_0xa54d('0xed'),'secondDisposition',_0xa54d('0xee'),_0xa54d('0xef'),_0x147f6d+'Id'],'where':{'ContactId':_0x9cec9a[_0xa54d('0x25')]['id']},'include':[{'model':db[_0x147f6d],'as':'Account','attributes':['id',_0xa54d('0x1a'),_0xa54d('0xf0')]},{'model':db[_0xa54d('0xc4')],'as':_0xa54d('0xf1'),'attributes':['id',_0xa54d('0x1a'),_0xa54d('0xe9')]},{'model':db['Tag'],'as':_0xa54d('0x6a'),'attributes':['id',_0xa54d('0x1a'),'color'],'through':{'attributes':[]}}],'order':[[_0xa54d('0xe4'),'DESC']]};if(_0x9cec9a[_0xa54d('0x1f')]['range']){_0x48342a[_0xa54d('0x62')][_0xa54d('0xe4')]={'$gte':_0x33d8c4[_0xa54d('0x38')],'$lte':_0x33d8c4['to']};}switch(_0x1c7709){case _0xa54d('0xf2'):_0x48342a[_0xa54d('0x86')][_0xa54d('0x64')](_0xa54d('0xf3'),'customerIp','customerPort',_0xa54d('0xf4'),_0xa54d('0xf5'),_0xa54d('0xf6'),_0xa54d('0xf7'),'ratingValue',_0xa54d('0xf8'));break;case _0xa54d('0xd1'):_0x48342a['attributes'][_0xa54d('0x64')](_0xa54d('0xf9'),_0xa54d('0xfa'));break;case _0xa54d('0xd2'):_0x48342a[_0xa54d('0x86')][_0xa54d('0x64')](_0xa54d('0xfb'),_0xa54d('0xfc'));break;}return db[_[_0xa54d('0xea')](_0x1c7709)+'Interaction'][_0xa54d('0xe8')](_0x48342a)['then'](function(_0x235849){_0x53ada7[_0xa54d('0xa3')]+=_0x235849[_0xa54d('0xa3')];return _[_0xa54d('0x75')](_0x235849[_0xa54d('0xa5')],function(_0x4cb4ed){var _0x108f6b=_0x4cb4ed[_0xa54d('0x39')]({'plain':!![]});_0x108f6b['channel']=_0x1c7709;if(_0x108f6b[_0xa54d('0xf1')]){_0x108f6b[_0xa54d('0xf1')]={'id':_0x108f6b[_0xa54d('0xf1')]['id'],'name':_0x108f6b[_0xa54d('0xf1')][_0xa54d('0x1a')],'fullname':_0x108f6b['Owner'][_0xa54d('0xe9')]};}return _0x108f6b;});});}});return Promise[_0xa54d('0x67')](_0x30f91e);})[_0xa54d('0x16')](function(_0x44d3b5){return _(_0x44d3b5)['flatten']()[_0xa54d('0xfd')]('createdAt')[_0xa54d('0xfe')]()[_0xa54d('0xff')]();})[_0xa54d('0x16')](function(_0x4e0bc6){_0x53ada7[_0xa54d('0xa5')]=_0x59e159[_0xa54d('0x12')]?_0x4e0bc6['slice'](_0x59e159[_0xa54d('0x10')],_0x59e159[_0xa54d('0x10')]+_0x59e159[_0xa54d('0x12')]):_0x4e0bc6;return _0x53ada7;})['then'](respondWithFilteredResult(_0x1b0f0d,_0x59e159))[_0xa54d('0x21')](handleError(_0x1b0f0d,null));}; \ No newline at end of file +var _0x52d0=['query','user','CmContact','find','params','catch','tags','keys','startsWith','cf_','columnName','analytics','CmCustomField','displayName','alias','type','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','merge','body','from','length','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','show','Tag','Tags','color','tag','Phones','ContactItemType','Phones.OrderBy','$and','map','format','cf_%d','utcOffset','omit','pickBy','table','cm_contacts','setFields','id\x20=\x20?','toParam','sequelize','text','values','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','order','sort','pick','filter','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','item','ItemType','literal','`ItemType`.OrderBy','ItemType.OrderBy','CmHopperAdditionalPhone','duplicateAdditionalPhones','fromContactId','toContactId','hopperId','fields','nolimit','ContactId','options','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','file','parse','meta','import','User','agent','binding','firstName','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','Invalid\x20channel','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','createdAt','VoiceCallReport','startCase','Website','closed','disposition','secondDisposition','key','Owner','customerIp','deviceModel','osName','ratingType','ratingValue','referer','mail','subject','substatus','externalUrl','threadId','Interaction','findAndCountAll','flatten','sortBy','reverse','value','moment','util','path','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','stack','name','describe','getOptions','findAll'];(function(_0x5d25ed,_0x3004e0){var _0x1cd0b7=function(_0x21a0b4){while(--_0x21a0b4){_0x5d25ed['push'](_0x5d25ed['shift']());}};_0x1cd0b7(++_0x3004e0);}(_0x52d0,0x1ec));var _0x052d=function(_0x326017,_0x5205fd){_0x326017=_0x326017-0x0;var _0x5e43b1=_0x52d0[_0x326017];return _0x5e43b1;};'use strict';var moment=require(_0x052d('0x0'));var BPromise=require('bluebird');var util=require(_0x052d('0x1'));var path=require(_0x052d('0x2'));var fs=require('fs');var _=require(_0x052d('0x3'));var squel=require(_0x052d('0x4'));var Papa=require('papaparse');var Redis=require(_0x052d('0x5'));var contacts=require(_0x052d('0x6'));var qs=require(_0x052d('0x7'));var logger=require('../../config/logger')(_0x052d('0x8'));var config=require(_0x052d('0x9'));var shared=require(_0x052d('0xa'));var db=require(_0x052d('0xb'))['db'];config[_0x052d('0xc')]=_[_0x052d('0xd')](config[_0x052d('0xc')],{'host':_0x052d('0xe'),'port':0x18eb});var socket=require(_0x052d('0xf'))(new Redis(config['redis']));require(_0x052d('0x10'))[_0x052d('0x11')](socket);function respondWithResult(_0x23d3dd,_0x1e4f6a){_0x1e4f6a=_0x1e4f6a||0xc8;return function(_0x1122cf){if(_0x1122cf){return _0x23d3dd[_0x052d('0x12')](_0x1e4f6a)[_0x052d('0x13')](_0x1122cf);}};}function respondWithFilteredResult(_0x3d64e5,_0x411f89){return function(_0x51ff7e){if(_0x51ff7e){var _0x5e3778=typeof _0x411f89[_0x052d('0x14')]==='undefined'&&typeof _0x411f89[_0x052d('0x15')]===_0x052d('0x16');var _0x3d4cd8=_0x51ff7e[_0x052d('0x17')];var _0x1b01c9=_0x5e3778?0x0:_0x411f89['offset'];var _0x47546a=_0x5e3778?_0x51ff7e[_0x052d('0x17')]:_0x411f89[_0x052d('0x14')]+_0x411f89['limit'];var _0x377326;if(_0x47546a>=_0x3d4cd8){_0x47546a=_0x3d4cd8;_0x377326=0xc8;}else{_0x377326=0xce;}_0x3d64e5[_0x052d('0x12')](_0x377326);return _0x3d64e5[_0x052d('0x18')](_0x052d('0x19'),_0x1b01c9+'-'+_0x47546a+'/'+_0x3d4cd8)[_0x052d('0x13')](_0x51ff7e);}return null;};}function saveUpdates(_0x125a07){return function(_0x28e7bd){if(_0x28e7bd){return _0x28e7bd['update'](_0x125a07)[_0x052d('0x1a')](function(_0x4631f8){return _0x4631f8;});}return null;};}function removeEntity(_0x2df059){return function(_0x2a73df){if(_0x2a73df){return _0x2a73df[_0x052d('0x1b')]()[_0x052d('0x1a')](function(){_0x2df059[_0x052d('0x12')](0xcc)[_0x052d('0x1c')]();});}};}function handleEntityNotFound(_0x3d1cc6){return function(_0x5c3929){if(!_0x5c3929){_0x3d1cc6['sendStatus'](0x194);}return _0x5c3929;};}function handleError(_0x107847,_0x4f2ee0){_0x4f2ee0=_0x4f2ee0||0x1f4;return function(_0x2b853c){logger['error'](_0x2b853c[_0x052d('0x1d')]);if(_0x2b853c['name']){delete _0x2b853c[_0x052d('0x1e')];}_0x107847[_0x052d('0x12')](_0x4f2ee0)['send'](_0x2b853c);};}exports['index']=function(_0x155f36,_0x1b2f85){var _0x44b4e0={};return contacts[_0x052d('0x1f')]()['then'](function(_0x3406b3){_0x44b4e0=qs[_0x052d('0x20')](_0x3406b3,_0x155f36);return contacts[_0x052d('0x21')](_0x155f36[_0x052d('0x22')],_0x155f36[_0x052d('0x23')],_0x44b4e0,_0x3406b3);})[_0x052d('0x1a')](respondWithFilteredResult(_0x1b2f85,_0x44b4e0))['catch'](handleError(_0x1b2f85,null));};exports[_0x052d('0x1b')]=function(_0x770543,_0x219fd3){return db[_0x052d('0x24')][_0x052d('0x25')]({'where':{'id':_0x770543[_0x052d('0x26')]['id']}})[_0x052d('0x1a')](handleEntityNotFound(_0x219fd3,null))['then'](removeEntity(_0x219fd3,null))[_0x052d('0x27')](handleError(_0x219fd3,null));};exports[_0x052d('0x1f')]=function(_0x2137ea,_0x1bf018){return db[_0x052d('0x24')][_0x052d('0x1f')]()['then'](function(_0x16ee67){delete _0x16ee67[_0x052d('0x28')];for(var _0x3e6fb6=0x0;_0x3e6fb60x0){return new Promise(function(_0x4f6df5){var _0x38f520=[];for(var _0x947785=0x0;_0x947785<_0x4537fd[_0x052d('0x37')];_0x947785++){_0x38f520[_0x052d('0x5f')](insertAdditionalPhones(_0x4537fd[_0x947785][_0x052d('0x63')],_0x4537fd[_0x947785][_0x052d('0x5a')]));}Promise[_0x052d('0x64')](_0x38f520)['then'](function(){_0x4f6df5(0x1);});})[_0x052d('0x1a')](function(){return{'success':_0x26a5ab,'failure':_0x145fd1,'duplicates':_0x535e70};});}else{return{'success':_0x26a5ab,'failure':_0x145fd1,'duplicates':_0x535e70};}}})[_0x052d('0x1a')](respondWithResult(_0x4a3745,0xc9))['catch'](handleError(_0x4a3745,null));};exports[_0x052d('0x65')]=function(_0x181547,_0x1431ab){var _0x41ebce;return db[_0x052d('0x24')]['describe']()[_0x052d('0x1a')](function(_0x278558){return db['CmContact'][_0x052d('0x25')]({'where':{'id':_0x181547[_0x052d('0x26')]['id']},'include':[{'model':db[_0x052d('0x66')],'as':_0x052d('0x67'),'attributes':['id',_0x052d('0x1e'),_0x052d('0x68')],'required':_0x181547[_0x052d('0x22')][_0x052d('0x69')]?!![]:![]},{'model':db[_0x052d('0x4c')],'as':_0x052d('0x6a'),'where':{'CmContactId':_0x181547['params']['id']},'required':![],'include':[{'model':db[_0x052d('0x6b')],'as':'ItemType'}]}],'order':[db['sequelize']['literal'](_0x052d('0x6c'))],'attributes':_['keys'](_0x278558)});})[_0x052d('0x1a')](function(_0x143dcf){if(!_[_0x052d('0x58')](_0x143dcf)){_0x41ebce=_0x143dcf['get']({'plain':!![]});var _0x2ce831={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x143dcf&&_0x143dcf[_0x052d('0x60')]){if(_0x143dcf[_0x052d('0x60')]){_0x2ce831['where'][_0x052d('0x6d')]['push']({'ListId':{'$ne':_0x143dcf[_0x052d('0x60')]}});}}return db[_0x052d('0x2e')][_0x052d('0x21')](_0x2ce831);}})[_0x052d('0x1a')](function(_0x4bbc26){if(!_[_0x052d('0x58')](_0x4bbc26)){return _['omit'](_0x41ebce,_[_0x052d('0x6e')](_0x4bbc26,function(_0x4246b4){return util[_0x052d('0x6f')](_0x052d('0x70'),_0x4246b4['id']);}));}})[_0x052d('0x1a')](handleEntityNotFound(_0x1431ab,null))[_0x052d('0x1a')](respondWithResult(_0x1431ab,null))['catch'](handleError(_0x1431ab,null));};exports[_0x052d('0x42')]=function(_0x59f474,_0xc14636){var _0x5b2459;if(_0x59f474['body']['id']){delete _0x59f474[_0x052d('0x35')]['id'];}if(!_[_0x052d('0x58')](_0x59f474[_0x052d('0x35')][_0x052d('0x57')])){var _0x56406c=_0x59f474[_0x052d('0x35')][_0x052d('0x57')];if(!_[_0x052d('0x58')](shared[_0x052d('0x59')][_0x56406c]))_0x59f474['body']['utcOffset']=shared[_0x052d('0x59')][_0x56406c][_0x052d('0x71')];}return db[_0x052d('0x24')][_0x052d('0x25')]({'where':{'id':_0x59f474['params']['id']}})['then'](handleEntityNotFound(_0xc14636,null))[_0x052d('0x1a')](saveUpdates(_0x59f474[_0x052d('0x35')],null))['then'](function(_0x2af7f9){_0x5b2459=_0x2af7f9;var _0x23889b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2af7f9&&_0x2af7f9['ListId']){if(_0x2af7f9[_0x052d('0x60')]){_0x23889b[_0x052d('0x5d')][_0x052d('0x6d')][_0x052d('0x5f')]({'ListId':{'$ne':_0x2af7f9[_0x052d('0x60')]}});}}return db[_0x052d('0x2e')][_0x052d('0x21')](_0x23889b);})[_0x052d('0x1a')](function(_0x4c8eca){if(_0x4c8eca){return _[_0x052d('0x72')](_[_0x052d('0x73')](_0x59f474['body'],function(_0x4108c0,_0x56aeb2){return _[_0x052d('0x2a')](_0x56aeb2,_0x052d('0x2b'));}),_[_0x052d('0x6e')](_0x4c8eca,function(_0x3c8ee0){return util['format'](_0x052d('0x70'),_0x3c8ee0['id']);}));}})['then'](function(_0x306046){if(_0x306046&&!_['isEmpty'](_0x306046)){var _0x4b7174=squel['update']()[_0x052d('0x74')](_0x052d('0x75'))[_0x052d('0x76')](_0x306046)[_0x052d('0x5d')](_0x052d('0x77'),_0x59f474['params']['id'])[_0x052d('0x78')]();return db[_0x052d('0x79')][_0x052d('0x22')](_0x4b7174[_0x052d('0x7a')],{'replacements':_0x4b7174[_0x052d('0x7b')]});}})['then'](function(){if(_0x59f474[_0x052d('0x35')][_0x052d('0x7c')]&&_0x5b2459){return db[_0x052d('0x3e')][_0x052d('0x42')]({'phone':_0x59f474[_0x052d('0x35')][_0x052d('0x7c')],'OrderBy':0x0},{'where':{'ContactId':_0x5b2459['id']}});}})[_0x052d('0x1a')](function(){return _0x5b2459;})['then'](respondWithResult(_0xc14636,null))[_0x052d('0x27')](handleError(_0xc14636,null));};exports[_0x052d('0x7d')]=function(_0x3b3d1a,_0x18ccec){var _0x447b70={};var _0x226c81={};var _0x32e933;var _0x1c665c;return db[_0x052d('0x24')][_0x052d('0x7e')]({'where':{'id':_0x3b3d1a[_0x052d('0x26')]['id']}})[_0x052d('0x1a')](handleEntityNotFound(_0x18ccec,null))[_0x052d('0x1a')](function(_0x41bb50){if(_0x41bb50){_0x32e933=_0x41bb50;_0x226c81[_0x052d('0x7f')]=_[_0x052d('0x29')](db['Tag'][_0x052d('0x80')]);_0x226c81[_0x052d('0x22')]=_['keys'](_0x3b3d1a[_0x052d('0x22')]);_0x226c81[_0x052d('0x81')]=_[_0x052d('0x82')](_0x226c81[_0x052d('0x7f')],_0x226c81[_0x052d('0x22')]);_0x447b70[_0x052d('0x83')]=_[_0x052d('0x82')](_0x226c81[_0x052d('0x7f')],qs['fields'](_0x3b3d1a[_0x052d('0x22')]['fields']));_0x447b70[_0x052d('0x83')]=_0x447b70[_0x052d('0x83')][_0x052d('0x37')]?_0x447b70[_0x052d('0x83')]:_0x226c81[_0x052d('0x7f')];_0x447b70[_0x052d('0x84')]=qs[_0x052d('0x85')](_0x3b3d1a[_0x052d('0x22')][_0x052d('0x85')]);_0x447b70[_0x052d('0x5d')]=qs[_0x052d('0x81')](_[_0x052d('0x86')](_0x3b3d1a['query'],_0x226c81[_0x052d('0x81')]));if(_0x3b3d1a[_0x052d('0x22')][_0x052d('0x87')]){_0x447b70[_0x052d('0x5d')]=_[_0x052d('0x34')](_0x447b70['where'],{'$or':_['map'](_0x447b70[_0x052d('0x83')],function(_0x33c034){var _0x548140={};_0x548140[_0x33c034]={'$like':'%'+_0x3b3d1a[_0x052d('0x22')]['filter']+'%'};return _0x548140;})});}_0x447b70=_[_0x052d('0x34')]({},_0x447b70,_0x3b3d1a['options']);return _0x32e933[_0x052d('0x7d')](_0x447b70);}})[_0x052d('0x1a')](function(_0x3774f0){if(_0x3774f0){_0x1c665c=_0x3774f0[_0x052d('0x37')];if(!_0x3b3d1a[_0x052d('0x22')][_0x052d('0x33')]('nolimit')){_0x447b70[_0x052d('0x15')]=qs[_0x052d('0x15')](_0x3b3d1a[_0x052d('0x22')][_0x052d('0x15')]);_0x447b70['offset']=qs['offset'](_0x3b3d1a['query'][_0x052d('0x14')]);}return _0x32e933['getTags'](_0x447b70);}})[_0x052d('0x1a')](function(_0x205392){if(_0x205392){return _0x205392?{'count':_0x1c665c,'rows':_0x205392}:null;}})['then'](respondWithResult(_0x18ccec,null))['catch'](handleError(_0x18ccec,null));};exports[_0x052d('0x88')]=function(_0x4bbb63,_0x2db3af){if(_0x4bbb63['body']['id']){delete _0x4bbb63[_0x052d('0x35')]['id'];}return db['CmContact'][_0x052d('0x7e')]({'where':{'id':_0x4bbb63[_0x052d('0x26')]['id']}})[_0x052d('0x1a')](handleEntityNotFound(_0x2db3af,null))[_0x052d('0x1a')](function(_0xec1d69){if(_0xec1d69){return _0xec1d69[_0x052d('0x88')](_0x4bbb63['body'][_0x052d('0x89')]||[]);}return null;})['then'](respondWithResult(_0x2db3af,null))[_0x052d('0x27')](handleError(_0x2db3af,null));};exports[_0x052d('0x8a')]=function(_0x58b4fe,_0x38b274){var _0x293d94=[];_0x293d94[_0x052d('0x5f')](addAdditionalPhones(_0x58b4fe[_0x052d('0x35')]));Promise['all'](_0x293d94)[_0x052d('0x1a')](function(){_0x293d94=[];_0x293d94[_0x052d('0x5f')](deleteCmHopperPhones(_0x58b4fe[_0x052d('0x35')]['id']));_0x293d94[_0x052d('0x5f')](addCmHopperPhones(_0x58b4fe[_0x052d('0x35')]['id']));Promise[_0x052d('0x64')](_0x293d94)[_0x052d('0x1a')](function(){return[0x1];})[_0x052d('0x1a')](respondWithResult(_0x38b274,null));});};function addAdditionalPhones(_0x26eec6){var _0xc7794d;return new Promise(function(_0x217df9){return db[_0x052d('0x4c')][_0x052d('0x1b')]({'where':{'CmContactId':_0x26eec6['id']}})['then'](function(){db[_0x052d('0x6b')][_0x052d('0x21')]({'raw':!![],'attributes':['id','OrderBy']})[_0x052d('0x1a')](function(_0x1eb78d){var _0x2dcf23=[];for(var _0x5877d8=0x0;_0x5877d8<_0x26eec6[_0x052d('0x8b')][_0x052d('0x37')];_0x5877d8++){var _0x28603f=_0x26eec6[_0x052d('0x8c')]?_[_0x052d('0x58')](_0x26eec6[_0x052d('0x8c')][_0x5877d8])?'':_0x26eec6[_0x052d('0x8c')][_0x5877d8]:_0x26eec6['items'][_0x5877d8][_0x052d('0x8d')]?_0x26eec6['items'][_0x5877d8][_0x052d('0x8d')]:'';var _0x29dd7d=_[_0x052d('0x58')](_0x26eec6[_0x052d('0x8b')][_0x5877d8][_0x052d('0x8e')])?'':_0x26eec6['items'][_0x5877d8][_0x052d('0x8e')];var _0x3ff9e1=_0x28603f+':'+_0x26eec6[_0x052d('0x8b')][_0x5877d8]['phone']+'§'+_0x29dd7d;if(_['isNil'](_0xc7794d))_0xc7794d=_0x3ff9e1;else _0xc7794d+=';'+_0x3ff9e1;var _0x36399f=null;var _0x36c806=null;if(_0x26eec6[_0x052d('0x8c')]){if(!_['isNil'](_0x26eec6[_0x052d('0x8c')][_0x5877d8])){_0x36c806=_[_0x052d('0x25')](_0x1eb78d,function(_0x249892){return _0x249892['id']===_0x26eec6[_0x052d('0x8c')][_0x5877d8];});if(!_[_0x052d('0x58')](_0x36c806)){_0x36399f=_0x36c806[_0x052d('0x8f')];}}}else{if(!_[_0x052d('0x58')](_0x26eec6[_0x052d('0x8b')][_0x5877d8])){_0x36c806=_[_0x052d('0x25')](_0x1eb78d,function(_0xf41878){return _0xf41878['id']===_0x26eec6[_0x052d('0x8b')][_0x5877d8]['ItemTypeId'];});if(!_[_0x052d('0x58')](_0x36c806)){_0x36399f=_0x5877d8;}}}if(_['isNil'](_0x36399f)){_0x36399f=0x64;}_0x2dcf23[_0x052d('0x5f')](addAdditionalPhone(_0x26eec6['id'],_0x26eec6[_0x052d('0x8b')][_0x5877d8]['phone'],_0x26eec6['item_types']?_['isNil'](_0x26eec6[_0x052d('0x8c')][_0x5877d8])?null:_0x26eec6[_0x052d('0x8c')][_0x5877d8]:_0x26eec6[_0x052d('0x8b')][_0x5877d8][_0x052d('0x8d')]?_0x26eec6['items'][_0x5877d8]['ItemTypeId']:null,_0x36399f,_0x29dd7d));}Promise[_0x052d('0x64')](_0x2dcf23)[_0x052d('0x1a')](function(){db[_0x052d('0x24')][_0x052d('0x42')]({'AdditionalPhones':_0xc7794d},{'where':{'id':_0x26eec6['id']}})[_0x052d('0x1a')](function(){_0x217df9(0x1);});});});});});}function addAdditionalPhone(_0x2b4cb5,_0x2781e7,_0x31a883,_0x58ecc9,_0x1c5a89){return db[_0x052d('0x4c')][_0x052d('0x25')]({'where':{'CmContactId':_0x2b4cb5,'item':_0x2781e7}})[_0x052d('0x1a')](function(_0x58f274){if(_0x58f274)logger[_0x052d('0x3c')](_0x052d('0x90'),_0x58f274);else{db['CmContactHasItem']['create']({'CmContactId':_0x2b4cb5,'item':_0x2781e7,'ItemTypeId':_0x31a883,'OrderBy':_0x58ecc9,'ItemClass':_0x052d('0x91'),'description':_0x1c5a89});}});}function deleteCmHopperPhones(_0x3e0b98){return new Promise(function(_0x48c046){return db[_0x052d('0x3e')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3e0b98}})['then'](function(_0x5ddc30){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x5ddc30,'id')}}});})[_0x052d('0x1a')](function(){_0x48c046(0x1);});});}function addCmHopperPhones(_0x13f444){return new Promise(function(_0x5c2b63){return db['CmHopper'][_0x052d('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x13f444}})['then'](function(_0x2ffc36){var _0x45ce9e=[];_[_0x052d('0x6e')](_0x2ffc36,function(_0x525e19){_0x45ce9e[_0x052d('0x5f')](createCmHopperPhone(_0x13f444,_0x525e19['id']));});Promise['all'](_0x45ce9e)['then'](function(){_0x5c2b63(0x1);});});});}function createCmHopperPhone(_0x4dd349,_0x45b165){return new Promise(function(_0x5015b2){db[_0x052d('0x4c')][_0x052d('0x21')]({'raw':!![],'attributes':[_0x052d('0x92'),'OrderBy'],'where':{'CmContactId':_0x4dd349,'ItemClass':'PHONE'},'include':[{'model':db[_0x052d('0x6b')],'attributes':[_0x052d('0x8f')],'as':_0x052d('0x93')}],'order':[_0x052d('0x8f'),db['sequelize'][_0x052d('0x94')](_0x052d('0x95'))]})['then'](function(_0x425ad3){var _0xc2016a=0x1;var _0x5155c3=_[_0x052d('0x6e')](_0x425ad3,function(_0x341088){_0x341088['CmHopperId']=_0x45b165;_0x341088[_0x052d('0x7c')]=_0x341088[_0x052d('0x92')];_0x341088[_0x052d('0x8f')]=_0xc2016a;delete _0x341088[_0x052d('0x96')];_0xc2016a=_0xc2016a+0x1;return _0x341088;});return db[_0x052d('0x97')][_0x052d('0x5b')](_0x5155c3,{});})[_0x052d('0x1a')](function(){_0x5015b2(0x1);});});}function insertAdditionalPhones(_0x30ed8e,_0x279152){return new Promise(function(_0x55fb4f){var _0x1b423a=[];for(var _0x2a4399=0x0;_0x2a4399<_0x279152['length'];_0x2a4399++){var _0x2f75ba=_0x279152[_0x2a4399];_0x1b423a[_0x052d('0x5f')](parseContactItemType(_0x2f75ba));}Promise['all'](_0x1b423a)[_0x052d('0x1a')](function(){var _0xe415d4={'id':_0x30ed8e['id'],'items':_0x279152};return addAdditionalPhones(_0xe415d4)[_0x052d('0x1a')](function(){return addCmHopperPhones(_0x30ed8e['id']);});})[_0x052d('0x1a')](function(){_0x55fb4f(_0x30ed8e);});});}function parseContactItemType(_0x4fb2ec){return new Promise(function(_0x182371){if(_0x4fb2ec['hasOwnProperty'](_0x052d('0x8d'))){_0x182371(_0x4fb2ec);}else{return db[_0x052d('0x6b')][_0x052d('0x25')]({'where':{'name':_0x4fb2ec[_0x052d('0x93')]}})['then'](function(_0x1c2ddd){if(_['isNil'](_0x1c2ddd))_0x4fb2ec[_0x052d('0x8d')]=null;else _0x4fb2ec[_0x052d('0x8d')]=_0x1c2ddd['id'];_0x182371(_0x4fb2ec);});}});}exports['getAdditionalPhones']=function(_0x13ff36,_0x330061){return db[_0x052d('0x4c')][_0x052d('0x21')]({'raw':!![],'where':{'CmContactId':_0x13ff36['params']['id'],'ItemClass':_0x052d('0x91')},'include':[{'model':db[_0x052d('0x6b')],'as':'ItemType'}],'order':[[_0x052d('0x8f')],[db[_0x052d('0x79')][_0x052d('0x94')](_0x052d('0x95'))]]})['then'](function(_0x449854){return _0x449854;})[_0x052d('0x1a')](respondWithResult(_0x330061,null))[_0x052d('0x27')](handleError(_0x330061,null));};exports[_0x052d('0x98')]=function(_0x288640,_0x2dd694){return db[_0x052d('0x4c')][_0x052d('0x21')]({'raw':!![],'where':{'CmContactId':_0x288640['body'][_0x052d('0x99')]}})[_0x052d('0x1a')](function(_0xee0083){var _0x181ada=_[_0x052d('0x6e')](_0xee0083,function(_0x4aedb8){_0x4aedb8['CmContactId']=_0x288640[_0x052d('0x35')][_0x052d('0x9a')];return _0x4aedb8;});return db['CmContactHasItem'][_0x052d('0x5b')](_0x181ada,{});})[_0x052d('0x1a')](function(){return addCmHopperPhones(_0x288640[_0x052d('0x35')]['toContactId']);})[_0x052d('0x1a')](function(){return['ok'];})[_0x052d('0x1a')](respondWithResult(_0x2dd694,null))[_0x052d('0x27')](handleError(_0x2dd694,null));};exports['rescheduleAdditionalPhones']=function(_0x544f32,_0x769e98){var _0x33b66d=[];_0x33b66d['push'](createCmHopperPhone(_0x544f32[_0x052d('0x35')]['id'],_0x544f32[_0x052d('0x35')][_0x052d('0x9b')]));Promise[_0x052d('0x64')](_0x33b66d)['then'](function(){return[0x1];})['then'](respondWithResult(_0x769e98,null));};exports['getHoppers']=function(_0x3ae928,_0x3bba51){var _0x100f14={'raw':![],'where':{}};var _0x3921ff={};var _0x2d0f44={'count':0x0,'rows':[]};return db['CmContact'][_0x052d('0x7e')]({'where':{'id':_0x3ae928['params']['id']}})[_0x052d('0x1a')](handleEntityNotFound(_0x3bba51,null))['then'](function(_0x5dca93){if(_0x5dca93){_0x3921ff[_0x052d('0x7f')]=_[_0x052d('0x29')](db[_0x052d('0x3e')][_0x052d('0x80')]);_0x3921ff[_0x052d('0x22')]=_['keys'](_0x3ae928[_0x052d('0x22')]);_0x3921ff[_0x052d('0x81')]=_['intersection'](_0x3921ff[_0x052d('0x7f')],_0x3921ff[_0x052d('0x22')]);_0x100f14['attributes']=_['intersection'](_0x3921ff[_0x052d('0x7f')],qs['fields'](_0x3ae928['query'][_0x052d('0x9c')]));_0x100f14[_0x052d('0x83')]=_0x100f14[_0x052d('0x83')][_0x052d('0x37')]?_0x100f14[_0x052d('0x83')]:_0x3921ff[_0x052d('0x7f')];if(!_0x3ae928['query'][_0x052d('0x33')](_0x052d('0x9d'))){_0x100f14[_0x052d('0x15')]=qs[_0x052d('0x15')](_0x3ae928[_0x052d('0x22')][_0x052d('0x15')]);_0x100f14[_0x052d('0x14')]=qs[_0x052d('0x14')](_0x3ae928[_0x052d('0x22')][_0x052d('0x14')]);}_0x100f14['order']=qs['sort'](_0x3ae928[_0x052d('0x22')][_0x052d('0x85')]);_0x100f14[_0x052d('0x5d')]=qs['filters'](_[_0x052d('0x86')](_0x3ae928['query'],_0x3921ff[_0x052d('0x81')]));_0x100f14['where'][_0x052d('0x9e')]=_0x5dca93['id'];if(_0x3ae928['query'][_0x052d('0x87')]){_0x100f14['where']=_[_0x052d('0x34')](_0x100f14[_0x052d('0x5d')],{'$or':_['map'](_0x100f14['attributes'],function(_0x37a839){var _0x168f89={};_0x168f89[_0x37a839]={'$like':'%'+_0x3ae928[_0x052d('0x22')][_0x052d('0x87')]+'%'};return _0x168f89;})});}_0x100f14=_[_0x052d('0x34')]({},_0x100f14,_0x3ae928[_0x052d('0x9f')]);return db[_0x052d('0x3e')][_0x052d('0x17')]({'where':_0x100f14['where']})[_0x052d('0x1a')](function(_0x25e38b){_0x2d0f44[_0x052d('0x17')]=_0x25e38b;if(_0x3ae928['query'][_0x052d('0xa0')]){_0x100f14[_0x052d('0xa1')]=[{'all':!![]}];}return db[_0x052d('0x3e')][_0x052d('0x21')](_0x100f14);})[_0x052d('0x1a')](function(_0x62062a){_0x2d0f44[_0x052d('0xa2')]=_0x62062a;return _0x2d0f44;});}})[_0x052d('0x1a')](respondWithFilteredResult(_0x3bba51,_0x100f14))['catch'](handleError(_0x3bba51,null));};exports[_0x052d('0xa3')]=function(_0x16ab5f,_0x192c42){var _0x41a43a={'raw':!![],'where':{}};var _0xc59689={};var _0x151590={'count':0x0,'rows':[]};return db[_0x052d('0x24')][_0x052d('0x7e')]({'where':{'id':_0x16ab5f['params']['id']}})[_0x052d('0x1a')](handleEntityNotFound(_0x192c42,null))[_0x052d('0x1a')](function(_0x4121a2){if(_0x4121a2){_0xc59689['model']=_[_0x052d('0x29')](db[_0x052d('0xa4')]['rawAttributes']);_0xc59689[_0x052d('0x22')]=_[_0x052d('0x29')](_0x16ab5f[_0x052d('0x22')]);_0xc59689[_0x052d('0x81')]=_['intersection'](_0xc59689[_0x052d('0x7f')],_0xc59689[_0x052d('0x22')]);_0x41a43a[_0x052d('0x83')]=_[_0x052d('0x82')](_0xc59689[_0x052d('0x7f')],qs['fields'](_0x16ab5f[_0x052d('0x22')][_0x052d('0x9c')]));_0x41a43a['attributes']=_0x41a43a['attributes'][_0x052d('0x37')]?_0x41a43a['attributes']:_0xc59689['model'];if(!_0x16ab5f['query'][_0x052d('0x33')](_0x052d('0x9d'))){_0x41a43a[_0x052d('0x15')]=qs[_0x052d('0x15')](_0x16ab5f['query'][_0x052d('0x15')]);_0x41a43a[_0x052d('0x14')]=qs['offset'](_0x16ab5f[_0x052d('0x22')][_0x052d('0x14')]);}_0x41a43a['order']=qs[_0x052d('0x85')](_0x16ab5f[_0x052d('0x22')]['sort']);_0x41a43a[_0x052d('0x5d')]=qs[_0x052d('0x81')](_[_0x052d('0x86')](_0x16ab5f[_0x052d('0x22')],_0xc59689[_0x052d('0x81')]));_0x41a43a[_0x052d('0x5d')]['ContactId']=_0x4121a2['id'];if(_0x16ab5f['query'][_0x052d('0x87')]){_0x41a43a[_0x052d('0x5d')]=_[_0x052d('0x34')](_0x41a43a[_0x052d('0x5d')],{'$or':_[_0x052d('0x6e')](_0x41a43a['attributes'],function(_0x3d3814){var _0x488cd3={};_0x488cd3[_0x3d3814]={'$like':'%'+_0x16ab5f[_0x052d('0x22')]['filter']+'%'};return _0x488cd3;})});}_0x41a43a=_[_0x052d('0x34')]({},_0x41a43a,_0x16ab5f['options']);return db[_0x052d('0xa4')][_0x052d('0x17')]({'where':_0x41a43a['where']})['then'](function(_0x3a582f){_0x151590[_0x052d('0x17')]=_0x3a582f;if(_0x16ab5f[_0x052d('0x22')]['includeAll']){_0x41a43a[_0x052d('0xa1')]=[{'all':!![]}];}return db[_0x052d('0xa4')]['findAll'](_0x41a43a);})[_0x052d('0x1a')](function(_0x5ba39d){_0x151590['rows']=_0x5ba39d;return _0x151590;});}})[_0x052d('0x1a')](respondWithFilteredResult(_0x192c42,_0x41a43a))[_0x052d('0x27')](handleError(_0x192c42,null));};exports[_0x052d('0xa5')]=function(_0x128f34,_0x3e274e){var _0x41be43={'raw':!![],'where':{}};var _0xa2f18b={};var _0x57fa05={'count':0x0,'rows':[]};return db['CmContact'][_0x052d('0x7e')]({'where':{'id':_0x128f34[_0x052d('0x26')]['id']}})['then'](handleEntityNotFound(_0x3e274e,null))['then'](function(_0x20f0f6){if(_0x20f0f6){_0xa2f18b[_0x052d('0x7f')]=_[_0x052d('0x29')](db[_0x052d('0x4d')]['rawAttributes']);_0xa2f18b[_0x052d('0x22')]=_['keys'](_0x128f34[_0x052d('0x22')]);_0xa2f18b[_0x052d('0x81')]=_[_0x052d('0x82')](_0xa2f18b[_0x052d('0x7f')],_0xa2f18b[_0x052d('0x22')]);_0x41be43[_0x052d('0x83')]=_[_0x052d('0x82')](_0xa2f18b[_0x052d('0x7f')],qs[_0x052d('0x9c')](_0x128f34[_0x052d('0x22')][_0x052d('0x9c')]));_0x41be43['attributes']=_0x41be43[_0x052d('0x83')]['length']?_0x41be43['attributes']:_0xa2f18b['model'];if(!_0x128f34[_0x052d('0x22')][_0x052d('0x33')]('nolimit')){_0x41be43['limit']=qs[_0x052d('0x15')](_0x128f34[_0x052d('0x22')]['limit']);_0x41be43['offset']=qs['offset'](_0x128f34[_0x052d('0x22')][_0x052d('0x14')]);}_0x41be43[_0x052d('0x84')]=qs['sort'](_0x128f34['query']['sort']);_0x41be43[_0x052d('0x5d')]=qs[_0x052d('0x81')](_['pick'](_0x128f34['query'],_0xa2f18b['filters']));_0x41be43[_0x052d('0x5d')][_0x052d('0x9e')]=_0x20f0f6['id'];if(_0x128f34[_0x052d('0x22')][_0x052d('0x87')]){_0x41be43[_0x052d('0x5d')]=_[_0x052d('0x34')](_0x41be43[_0x052d('0x5d')],{'$or':_['map'](_0x41be43[_0x052d('0x83')],function(_0x3faff9){var _0x52cfa0={};_0x52cfa0[_0x3faff9]={'$like':'%'+_0x128f34[_0x052d('0x22')][_0x052d('0x87')]+'%'};return _0x52cfa0;})});}_0x41be43=_[_0x052d('0x34')]({},_0x41be43,_0x128f34[_0x052d('0x9f')]);return db[_0x052d('0x4d')]['count']({'where':_0x41be43[_0x052d('0x5d')]})['then'](function(_0x515aa){_0x57fa05[_0x052d('0x17')]=_0x515aa;if(_0x128f34['query'][_0x052d('0xa0')]){_0x41be43['include']=[{'all':!![]}];}return db[_0x052d('0x4d')][_0x052d('0x21')](_0x41be43);})[_0x052d('0x1a')](function(_0x3ef31b){_0x57fa05[_0x052d('0xa2')]=_0x3ef31b;return _0x57fa05;});}})[_0x052d('0x1a')](respondWithFilteredResult(_0x3e274e,_0x41be43))['catch'](handleError(_0x3e274e,null));};exports[_0x052d('0xa6')]=function(_0x56f6d0,_0xc43697){var _0x5bc16f={'raw':!![],'where':{}};var _0x3158c7={};var _0x117b86={'count':0x0,'rows':[]};return db[_0x052d('0x24')][_0x052d('0x7e')]({'where':{'id':_0x56f6d0[_0x052d('0x26')]['id']}})['then'](handleEntityNotFound(_0xc43697,null))[_0x052d('0x1a')](function(_0x2c2652){if(_0x2c2652){_0x3158c7[_0x052d('0x7f')]=_[_0x052d('0x29')](db['JscriptySessionReport'][_0x052d('0x80')]);_0x3158c7[_0x052d('0x22')]=_['keys'](_0x56f6d0[_0x052d('0x22')]);_0x3158c7[_0x052d('0x81')]=_[_0x052d('0x82')](_0x3158c7['model'],_0x3158c7['query']);_0x5bc16f[_0x052d('0x83')]=_[_0x052d('0x82')](_0x3158c7[_0x052d('0x7f')],qs[_0x052d('0x9c')](_0x56f6d0['query'][_0x052d('0x9c')]));_0x5bc16f[_0x052d('0x83')]=_0x5bc16f[_0x052d('0x83')]['length']?_0x5bc16f[_0x052d('0x83')]:_0x3158c7[_0x052d('0x7f')];if(!_0x56f6d0[_0x052d('0x22')][_0x052d('0x33')]('nolimit')){_0x5bc16f[_0x052d('0x15')]=qs[_0x052d('0x15')](_0x56f6d0[_0x052d('0x22')][_0x052d('0x15')]);_0x5bc16f[_0x052d('0x14')]=qs[_0x052d('0x14')](_0x56f6d0[_0x052d('0x22')][_0x052d('0x14')]);}_0x5bc16f['order']=qs[_0x052d('0x85')](_0x56f6d0[_0x052d('0x22')][_0x052d('0x85')]);_0x5bc16f['where']=qs[_0x052d('0x81')](_['pick'](_0x56f6d0[_0x052d('0x22')],_0x3158c7[_0x052d('0x81')]));_0x5bc16f['where']['ContactId']=_0x2c2652['id'];if(_0x56f6d0[_0x052d('0x22')][_0x052d('0x87')]){_0x5bc16f[_0x052d('0x5d')]=_[_0x052d('0x34')](_0x5bc16f[_0x052d('0x5d')],{'$or':_[_0x052d('0x6e')](_0x5bc16f[_0x052d('0x83')],function(_0xaef1b7){var _0x209fef={};_0x209fef[_0xaef1b7]={'$like':'%'+_0x56f6d0[_0x052d('0x22')][_0x052d('0x87')]+'%'};return _0x209fef;})});}_0x5bc16f=_[_0x052d('0x34')]({},_0x5bc16f,_0x56f6d0['options']);return db[_0x052d('0xa7')][_0x052d('0x17')]({'where':_0x5bc16f[_0x052d('0x5d')]})['then'](function(_0x599232){_0x117b86['count']=_0x599232;if(_0x56f6d0['query'][_0x052d('0xa0')]){_0x5bc16f[_0x052d('0xa1')]=[{'all':!![]}];}return db[_0x052d('0xa7')][_0x052d('0x21')](_0x5bc16f);})[_0x052d('0x1a')](function(_0x539c78){_0x117b86[_0x052d('0xa2')]=_0x539c78;return _0x117b86;});}})[_0x052d('0x1a')](respondWithFilteredResult(_0xc43697,_0x5bc16f))[_0x052d('0x27')](handleError(_0xc43697,null));};exports[_0x052d('0xa8')]=function(_0x22ce66,_0x67e7be){try{if(!_0x22ce66[_0x052d('0x35')]['ListId']){throw new Error(_0x052d('0xa9'));}if(!_0x22ce66[_0x052d('0x35')][_0x052d('0xaa')]){throw new Error(_0x052d('0xab'));}if(!_0x22ce66[_0x052d('0x35')]['binding_values']){throw new Error(_0x052d('0xac'));}if(!_0x22ce66['body'][_0x052d('0xad')]){throw new Error(_0x052d('0xae'));}var _0x54f458=_0x22ce66[_0x052d('0x35')]['binding_keys'][_0x052d('0xaf')](',');var _0x123a74=_0x22ce66[_0x052d('0x35')][_0x052d('0xb0')]['split'](',');if(!_0x54f458[_0x052d('0x37')]||!_0x123a74['length']||_0x54f458[_0x052d('0x37')]!==_0x123a74['length']){throw new Error(_0x052d('0xb1'));}_0x22ce66[_0x052d('0x35')][_0x052d('0x9c')]=_['zipObject'](_0x54f458,_0x123a74);if(!_0x22ce66[_0x052d('0x35')][_0x052d('0x9c')][_0x052d('0x7c')]){throw new Error(_0x052d('0xb2'));}if(!_0x22ce66[_0x052d('0x35')]['fields']['firstName']){throw new Error(_0x052d('0xb3'));}var _0x20b47d=path[_0x052d('0x3b')](config[_0x052d('0xb4')],_0x052d('0xb5'),_0x22ce66['file'][_0x052d('0xb6')]);fs['chmodSync'](_0x20b47d,parseInt(_0x052d('0xb7'),0x8));var _0x56b397=require(_0x052d('0xb8'))['fork'](path[_0x052d('0x3b')](__dirname,_0x052d('0xb9')),[_0x20b47d,_0x22ce66[_0x052d('0x35')][_0x052d('0xaa')],_0x22ce66[_0x052d('0x35')][_0x052d('0xb0')],_0x22ce66[_0x052d('0x35')]['ListId'],_0x22ce66['body'][_0x052d('0xba')],_0x22ce66[_0x052d('0x35')][_0x052d('0x5c')],_0x22ce66['body'][_0x052d('0xad')]]);return _0x67e7be[_0x052d('0x12')](0xc8)[_0x052d('0x13')]({'message':_0x052d('0xbb'),'pid':_0x56b397[_0x052d('0xbc')]});}catch(_0x3f14fd){return _0x67e7be[_0x052d('0x12')](0x1f4)[_0x052d('0xbd')](_0x3f14fd);}};exports[_0x052d('0xbe')]=function(_0x3326c4,_0x3760ca){var _0x1fc211=fs['createReadStream'](_0x3326c4[_0x052d('0xbf')][_0x052d('0x2')]);Papa[_0x052d('0xc0')](_0x1fc211,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x773671){return _0x3760ca[_0x052d('0x12')](0xc8)[_0x052d('0x13')]({'file':_0x3326c4['file'],'fields':_0x773671[_0x052d('0xc1')]['fields']});}});};exports[_0x052d('0xc2')]=function(_0x2692b3,_0x31a154){return db[_0x052d('0xc3')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x052d('0xc4')}})['then'](function(_0x7ff9b1){var _0x432cd3=![];if(!_0x2692b3[_0x052d('0x35')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x2692b3[_0x052d('0x35')][_0x052d('0xc5')][_0x052d('0x7c')]){throw new Error(_0x052d('0xb2'));}if(!_0x2692b3[_0x052d('0x35')][_0x052d('0xc5')][_0x052d('0xc6')]){throw new Error(_0x052d('0xb3'));}if(!_0x2692b3[_0x052d('0x35')]['socket_timestamp']){throw new Error(_0x052d('0xae'));}var _0x22fec4=require(_0x052d('0xb8'))[_0x052d('0xc7')](path['join'](__dirname,_0x052d('0xc8')),[_0x2692b3[_0x052d('0x26')]['id'],JSON[_0x052d('0xc9')](_0x2692b3[_0x052d('0x35')]),JSON[_0x052d('0xc9')](_0x7ff9b1)]);_0x22fec4['on'](_0x052d('0xca'),function(){_0x432cd3=!![];return _0x31a154[_0x052d('0x12')](0xc8)[_0x052d('0x13')]({'message':_0x052d('0xcb'),'pid':_0x22fec4[_0x052d('0xbc')]});});_0x22fec4['on'](_0x052d('0xcc'),function(_0x28dfa0){if(_0x28dfa0&&!_0x432cd3){return _0x31a154[_0x052d('0x12')](0x1f4)[_0x052d('0x13')]({'message':_0x052d('0xcd'),'pid':_0x22fec4[_0x052d('0xbc')]});}});})[_0x052d('0x27')](handleError(_0x31a154,null));};exports[_0x052d('0xce')]=function(_0x4c4429,_0x50de10){return db[_0x052d('0xc3')][_0x052d('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x349380){var _0x1fafc3=![];if(!_0x4c4429[_0x052d('0x35')][_0x052d('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4c4429[_0x052d('0x35')]['binding'][_0x052d('0x7c')]){throw new Error(_0x052d('0xb2'));}if(!_0x4c4429[_0x052d('0x35')]['binding'][_0x052d('0xc6')]){throw new Error(_0x052d('0xb3'));}if(!_0x4c4429[_0x052d('0x35')][_0x052d('0xad')]){throw new Error(_0x052d('0xae'));}var _0x2d0ff4=require(_0x052d('0xb8'))[_0x052d('0xc7')](path['join'](__dirname,_0x052d('0xcf')),[_0x4c4429[_0x052d('0x26')]['id'],JSON[_0x052d('0xc9')](_0x4c4429[_0x052d('0x35')]),JSON[_0x052d('0xc9')](_0x349380)]);_0x2d0ff4['on'](_0x052d('0xca'),function(){_0x1fafc3=!![];return _0x50de10[_0x052d('0x12')](0xc8)[_0x052d('0x13')]({'message':_0x052d('0xcb'),'pid':_0x2d0ff4[_0x052d('0xbc')]});});_0x2d0ff4['on'](_0x052d('0xcc'),function(_0x29f8a1){if(_0x29f8a1&&!_0x1fafc3){return _0x50de10['status'](0x1f4)[_0x052d('0x13')]({'message':_0x052d('0xcd'),'pid':_0x2d0ff4['pid']});}});})[_0x052d('0x27')](handleError(_0x50de10,null));};exports[_0x052d('0xd0')]=function(_0x13d15c,_0x118de2){var _0x32f605=['mail',_0x052d('0xd1'),_0x052d('0xd2'),_0x052d('0xd3'),_0x052d('0xd4'),_0x052d('0xd5'),_0x052d('0xd6')];var _0x91d110={'offset':0x0,'order':qs[_0x052d('0x85')](_0x052d('0xd7'))},_0x3b3783={'count':0x0,'rows':[]};Promise[_0x052d('0xd8')]()[_0x052d('0x1a')](function(){if(_0x13d15c[_0x052d('0x22')]['channel']){if(!_[_0x052d('0xd9')](_0x32f605,_0x13d15c[_0x052d('0x22')][_0x052d('0xda')][_0x052d('0xdb')]())){throw new Error(_0x052d('0xdc'));}_0x32f605=[_0x13d15c[_0x052d('0x22')][_0x052d('0xda')][_0x052d('0xdb')]()];}if(_0x13d15c[_0x052d('0x22')]['range']){try{var _0xb1a9ef=JSON[_0x052d('0xc0')](_0x13d15c[_0x052d('0x22')]['range']);if(!moment(_0xb1a9ef[_0x052d('0x36')])[_0x052d('0xdd')]()){throw new Error(_0x052d('0xde'));}if(!moment(_0xb1a9ef['to'])[_0x052d('0xdd')]()){throw new Error(_0x052d('0xdf'));}}catch(_0x7089c4){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x13d15c[_0x052d('0x22')][_0x052d('0x33')](_0x052d('0x9d'))){_0x91d110[_0x052d('0x15')]=qs[_0x052d('0x15')](_0x13d15c[_0x052d('0x22')]['limit']||0xa);_0x91d110[_0x052d('0x14')]=qs['offset'](_0x13d15c[_0x052d('0x22')][_0x052d('0x14')]);}var _0x1e3925=_0x32f605[_0x052d('0x6e')](function(_0x3fac69){if(_0x3fac69==='voice'){var _0x51ce4d={'attributes':['id',_0x052d('0xe0'),_0x052d('0x31'),_0x052d('0xe1'),'destination',_0x052d('0xe2'),_0x052d('0xe3'),_0x052d('0xe4'),_0x052d('0xe5'),_0x052d('0xe6'),'createdAt',_0x052d('0xe7'),_0x052d('0xe8'),_0x052d('0xe9'),_0x052d('0xea')],'where':{'ContactId':_0x13d15c[_0x052d('0x26')]['id']},'include':[{'model':db[_0x052d('0xc3')],'as':'User','attributes':['id','name',_0x052d('0xeb'),'alias']}],'order':[['createdAt',_0x052d('0xec')]]};if(_0x13d15c[_0x052d('0x22')]['range']){_0x51ce4d[_0x052d('0x5d')][_0x052d('0xed')]={'$gte':_0xb1a9ef[_0x052d('0x36')],'$lte':_0xb1a9ef['to']};}return db[_0x052d('0xee')]['findAndCountAll'](_0x51ce4d)['then'](function(_0x3e6316){_0x3b3783[_0x052d('0x17')]+=_0x3e6316[_0x052d('0x17')];return _[_0x052d('0x6e')](_0x3e6316[_0x052d('0xa2')],function(_0x283572){var _0x69397b=_0x283572[_0x052d('0x38')]({'plain':!![]});_0x69397b[_0x052d('0xda')]=_0x3fac69;if(_0x69397b['User']){_0x69397b[_0x052d('0xc3')]={'id':_0x69397b[_0x052d('0xc3')]['id'],'name':_0x69397b[_0x052d('0xc3')][_0x052d('0x1e')],'fullname':_0x69397b['User'][_0x052d('0xeb')],'alias':_0x69397b[_0x052d('0xc3')][_0x052d('0x30')]};}return _0x69397b;});});}else{var _0x2b91e4=_[_0x052d('0xef')](_0x3fac69)+(_0x3fac69===_0x052d('0xd1')?_0x052d('0xf0'):'Account');var _0x44f94f={'attributes':['id',_0x052d('0xf1'),'closedAt',_0x052d('0xed'),'note',_0x052d('0xf2'),_0x052d('0xf3'),'thirdDisposition',_0x052d('0xea'),_0x2b91e4+'Id'],'where':{'ContactId':_0x13d15c[_0x052d('0x26')]['id']},'include':[{'model':db[_0x2b91e4],'as':'Account','attributes':['id',_0x052d('0x1e'),_0x052d('0xf4')]},{'model':db['User'],'as':_0x052d('0xf5'),'attributes':['id',_0x052d('0x1e'),_0x052d('0xeb')]},{'model':db[_0x052d('0x66')],'as':'Tags','attributes':['id',_0x052d('0x1e'),_0x052d('0x68')],'through':{'attributes':[]}}],'order':[[_0x052d('0xed'),_0x052d('0xec')]]};if(_0x13d15c[_0x052d('0x22')]['range']){_0x44f94f[_0x052d('0x5d')][_0x052d('0xed')]={'$gte':_0xb1a9ef['from'],'$lte':_0xb1a9ef['to']};}switch(_0x3fac69){case'chat':_0x44f94f[_0x052d('0x83')]['push']('browserName',_0x052d('0xf6'),'customerPort',_0x052d('0xf7'),_0x052d('0xf8'),'ratingMessage',_0x052d('0xf9'),_0x052d('0xfa'),_0x052d('0xfb'));break;case _0x052d('0xfc'):_0x44f94f[_0x052d('0x83')][_0x052d('0x5f')](_0x052d('0xfd'),_0x052d('0xfe'));break;case _0x052d('0xd3'):_0x44f94f[_0x052d('0x83')]['push'](_0x052d('0xff'),_0x052d('0x100'));break;}return db[_['startCase'](_0x3fac69)+_0x052d('0x101')][_0x052d('0x102')](_0x44f94f)[_0x052d('0x1a')](function(_0x190df7){_0x3b3783[_0x052d('0x17')]+=_0x190df7['count'];return _['map'](_0x190df7['rows'],function(_0x393a6d){var _0x48e971=_0x393a6d[_0x052d('0x38')]({'plain':!![]});_0x48e971[_0x052d('0xda')]=_0x3fac69;if(_0x48e971[_0x052d('0xf5')]){_0x48e971[_0x052d('0xf5')]={'id':_0x48e971[_0x052d('0xf5')]['id'],'name':_0x48e971[_0x052d('0xf5')][_0x052d('0x1e')],'fullname':_0x48e971['Owner'][_0x052d('0xeb')]};}return _0x48e971;});});}});return Promise[_0x052d('0x64')](_0x1e3925);})[_0x052d('0x1a')](function(_0x315824){return _(_0x315824)[_0x052d('0x103')]()[_0x052d('0x104')]('createdAt')[_0x052d('0x105')]()[_0x052d('0x106')]();})[_0x052d('0x1a')](function(_0x8eef28){_0x3b3783[_0x052d('0xa2')]=_0x91d110[_0x052d('0x15')]?_0x8eef28['slice'](_0x91d110[_0x052d('0x14')],_0x91d110[_0x052d('0x14')]+_0x91d110['limit']):_0x8eef28;return _0x3b3783;})[_0x052d('0x1a')](respondWithFilteredResult(_0x118de2,_0x91d110))[_0x052d('0x27')](handleError(_0x118de2,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index c177c87..556b52a 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 _0x79cd=['../../mysqldb','CmContact','save','update','remove','emit','hook','events'];(function(_0x4eb1b3,_0x2c7e9f){var _0x2bd514=function(_0x4c3b8b){while(--_0x4c3b8b){_0x4eb1b3['push'](_0x4eb1b3['shift']());}};_0x2bd514(++_0x2c7e9f);}(_0x79cd,0x1a7));var _0xd79c=function(_0x504980,_0x3ac83a){_0x504980=_0x504980-0x0;var _0x5a6ed9=_0x79cd[_0x504980];return _0x5a6ed9;};'use strict';var EventEmitter=require(_0xd79c('0x0'));var CmContact=require(_0xd79c('0x1'))['db'][_0xd79c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd79c('0x3'),'afterUpdate':_0xd79c('0x4'),'afterDestroy':_0xd79c('0x5')};function emitEvent(_0x65974){return function(_0x467234,_0x5b3918,_0x157918){CmContactEvents[_0xd79c('0x6')](_0x65974+':'+_0x467234['id'],_0x467234);CmContactEvents[_0xd79c('0x6')](_0x65974,_0x467234);_0x157918(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xd79c('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xd780=['hook','exports','events','../../mysqldb','remove','emit'];(function(_0xb2a2e7,_0x11a1f4){var _0x53af4c=function(_0x300fd5){while(--_0x300fd5){_0xb2a2e7['push'](_0xb2a2e7['shift']());}};_0x53af4c(++_0x11a1f4);}(_0xd780,0xd4));var _0x0d78=function(_0x415ccc,_0x5f15c9){_0x415ccc=_0x415ccc-0x0;var _0x78e423=_0xd780[_0x415ccc];return _0x78e423;};'use strict';var EventEmitter=require(_0x0d78('0x0'));var CmContact=require(_0x0d78('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0d78('0x2')};function emitEvent(_0x621d4c){return function(_0x55c5ff,_0x2098a8,_0x1bf652){CmContactEvents[_0x0d78('0x3')](_0x621d4c+':'+_0x55c5ff['id'],_0x55c5ff);CmContactEvents[_0x0d78('0x3')](_0x621d4c,_0x55c5ff);_0x1bf652(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x0d78('0x4')](e,emitEvent(event));}}module[_0x0d78('0x5')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 0fe0589..f59a125 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 _0xc852=['isEmpty','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','findOne','then','isNil','timezones','utcOffset','add','minutes','phone','ListId','format','priority','callbackUniqueid','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','CmHopper','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','create','always','onlyIfOpen','findAll','outbound','dialCheckDuplicateType','Lists','map','all','CmList','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','mobile','fax','FULLTEXT','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xc852,0x14d));var _0x2c85=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc852[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2c85('0x0'))(_0x2c85('0x1'));var moment=require(_0x2c85('0x2'));var shared=require(_0x2c85('0x3'));var attributes=require(_0x2c85('0x4'));function getTimezoneCallbackAt(_0x4c0eca,_0x1cbf74,_0x17189c,_0x162593){var _0x2b86c0=_0x162593?_0x2c85('0x5'):_0x2c85('0x6');var _0x585513=_0x17189c[_0x2c85('0x7')]?_0x17189c[_0x2c85('0x7')]:moment()['format'](_0x2c85('0x8'));if(_['isNil'](_0x17189c[_0x2c85('0x9')])){return Promise[_0x2c85('0xa')](_0x585513);}return _0x4c0eca[_0x2b86c0][_0x2c85('0xb')]({'where':{'id':_0x1cbf74}})[_0x2c85('0xc')](function(_0x1df64f){if(_[_0x2c85('0xd')](_0x1df64f)||_[_0x2c85('0xd')](_0x1df64f[_0x2c85('0x9')])){return Promise[_0x2c85('0xa')](_0x585513);}var _0x1c1f4c=shared[_0x2c85('0xe')];var _0x351a55=_0x1c1f4c[_0x1df64f[_0x2c85('0x9')]];var _0x55c756=_0x1c1f4c[_0x17189c['dialTimezone']];if(_[_0x2c85('0xd')](_0x351a55)&&_['isNil'](_0x55c756)){return Promise[_0x2c85('0xa')](_0x585513);}var _0x443af4=_0x351a55[_0x2c85('0xf')]-_0x55c756['utcOffset'];var _0x2e4baa=_0x17189c[_0x2c85('0x7')]?_0x17189c[_0x2c85('0x7')]:moment();_0x585513=moment(_0x2e4baa)[_0x2c85('0x10')](_0x443af4,_0x2c85('0x11'))['format'](_0x2c85('0x8'));return Promise['resolve'](_0x585513);});}function getNewHopperPayload(_0x52a3e7){return{'phone':_0x52a3e7[_0x2c85('0x12')],'ContactId':_0x52a3e7['id'],'ListId':_0x52a3e7[_0x2c85('0x13')],'scheduledat':_0x52a3e7[_0x2c85('0x7')]?_0x52a3e7[_0x2c85('0x7')]:moment()[_0x2c85('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x52a3e7[_0x2c85('0x15')]?_0x52a3e7[_0x2c85('0x15')]:0x2,'callback':_0x52a3e7['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x52a3e7['callbackUniqueid']?_0x52a3e7[_0x2c85('0x16')]:undefined,'callbackat':_0x52a3e7[_0x2c85('0x16')]?moment()[_0x2c85('0x14')](_0x2c85('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0xa1fa04,_0x5dbe4e,_0x5bbe19,_0x548452){var _0x1e3c44={'phone':_0x5bbe19['phone']};var _0x4d1f00={'calleridnum':_0x5bbe19[_0x2c85('0x12')]};if(_0x548452){Object['assign'](_0x1e3c44,{'CampaignId':_0x5dbe4e['id']});Object[_0x2c85('0x17')](_0x4d1f00,{'CampaignId':_0x5dbe4e['id']});}else{Object['assign'](_0x1e3c44,{'VoiceQueueId':_0x5dbe4e['id']});Object[_0x2c85('0x17')](_0x4d1f00,{'VoiceQueueId':_0x5dbe4e['id']});}return _0xa1fa04['CmHopper']['findOne']({'where':_0x1e3c44})['then'](function(_0x2abd14){if(_0x2abd14){throw new Error(_0x2c85('0x18')+_0x5bbe19[_0x2c85('0x12')]+_0x2c85('0x19')+_0x5dbe4e['id']);}return _0xa1fa04['CmHopperFinal'][_0x2c85('0xb')]({'where':_0x4d1f00});})[_0x2c85('0xc')](function(_0x31b525){if(_0x31b525){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x5bbe19[_0x2c85('0x12')]+_0x2c85('0x19')+_0x5dbe4e['id']);}var _0x3af34b=getNewHopperPayload(_0x5bbe19);if(_0x548452){_0x3af34b[_0x2c85('0x1a')]=_0x5dbe4e['id'];}else{_0x3af34b['VoiceQueueId']=_0x5dbe4e['id'];}return _0xa1fa04[_0x2c85('0x1b')]['create'](_0x3af34b);});}function handleOnlyIfOpenCheckDuplicate(_0x2b19db,_0x2e3979,_0x256df6,_0x21d311){var _0x3d28ad={'phone':_0x256df6[_0x2c85('0x12')]};if(_0x21d311){Object[_0x2c85('0x17')](_0x3d28ad,{'CampaignId':_0x2e3979['id']});}else{Object[_0x2c85('0x17')](_0x3d28ad,{'VoiceQueueId':_0x2e3979['id']});}return _0x2b19db[_0x2c85('0x1b')][_0x2c85('0xb')]({'where':_0x3d28ad})[_0x2c85('0xc')](function(_0x5e05c5){if(_0x5e05c5){throw new Error(_0x2c85('0x1c')+_0x256df6[_0x2c85('0x12')]+_0x2c85('0x19')+_0x2e3979['id']);}var _0x1e3b2b=getNewHopperPayload(_0x256df6);if(_0x21d311){_0x1e3b2b[_0x2c85('0x1a')]=_0x2e3979['id'];}else{_0x1e3b2b[_0x2c85('0x1d')]=_0x2e3979['id'];}return _0x2b19db[_0x2c85('0x1b')][_0x2c85('0x1e')](_0x1e3b2b);});}function handleNeverCheckDuplicate(_0x47bdab,_0xf47b40,_0x3c8525){var _0x254ff2=getNewHopperPayload(_0x3c8525);_0x254ff2[_0x2c85('0x1d')]=_0xf47b40['id'];return _0x47bdab['CmHopper'][_0x2c85('0x1e')](_0x254ff2);}function handleCheckDuplicate(_0x2426c6,_0x57ded1,_0x19583f,_0x5c99a2){return getTimezoneCallbackAt(_0x2426c6,_0x57ded1,_0x19583f,_0x5c99a2)[_0x2c85('0xc')](function(_0xb5f091){_0x19583f[_0x2c85('0x7')]=_0xb5f091;switch(_0x57ded1['dialCheckDuplicateType']){case _0x2c85('0x1f'):return handleAlwaysCheckDuplicate(_0x2426c6,_0x57ded1,_0x19583f,_0x5c99a2);case _0x2c85('0x20'):return handleOnlyIfOpenCheckDuplicate(_0x2426c6,_0x57ded1,_0x19583f,_0x5c99a2);default:return handleNeverCheckDuplicate(_0x2426c6,_0x57ded1,_0x19583f);}});}function createHopperForVoiceQueues(_0x29b212,_0x303d91){return _0x29b212[_0x2c85('0x6')][_0x2c85('0x21')]({'where':{'type':_0x2c85('0x22')},'attributes':['id',_0x2c85('0x23'),_0x2c85('0x9')],'include':[{'model':_0x29b212['CmList'],'as':_0x2c85('0x24'),'where':{'id':_0x303d91[_0x2c85('0x13')]}}],'raw':!![]})[_0x2c85('0xc')](function(_0x800c60){var _0x1d2b4c=_0x800c60[_0x2c85('0x25')](function(_0x51a9ee){return handleCheckDuplicate(_0x29b212,_0x51a9ee,_0x303d91,![]);});return Promise[_0x2c85('0x26')](_0x1d2b4c);});}function createHopperForCampaigns(_0x2df187,_0x4bc809){return _0x2df187[_0x2c85('0x5')]['findAll']({'attributes':['id',_0x2c85('0x23'),_0x2c85('0x9')],'include':[{'model':_0x2df187[_0x2c85('0x27')],'as':'Lists','where':{'id':_0x4bc809[_0x2c85('0x13')]}}],'raw':!![]})[_0x2c85('0xc')](function(_0x41d1f3){var _0x4d98a1=_0x41d1f3['map'](function(_0x3f7919){return handleCheckDuplicate(_0x2df187,_0x3f7919,_0x4bc809,!![]);});return Promise[_0x2c85('0x26')](_0x4d98a1);});}function createHopperBlackForVoiceQueues(_0x6c7b34,_0xb70fef){return _0x6c7b34[_0x2c85('0x6')][_0x2c85('0x21')]({'where':{'type':_0x2c85('0x22')},'attributes':['id'],'include':[{'model':_0x6c7b34[_0x2c85('0x27')],'as':_0x2c85('0x28'),'where':{'id':_0xb70fef[_0x2c85('0x13')]}}],'raw':!![]})[_0x2c85('0xc')](function(_0x3843e1){var _0x55b28f=_0x3843e1[_0x2c85('0x25')](function(_0x3f6e2e){return _0x6c7b34[_0x2c85('0x29')][_0x2c85('0x1e')]({'phone':_0xb70fef[_0x2c85('0x12')],'ContactId':_0xb70fef['id'],'ListId':_0xb70fef['ListId'],'VoiceQueueId':_0x3f6e2e['id']});});return Promise['all'](_0x55b28f);});}function createHopperBlackForCampaigns(_0xbffdd0,_0x22cedc){return _0xbffdd0['Campaign'][_0x2c85('0x21')]({'attributes':['id'],'include':[{'model':_0xbffdd0[_0x2c85('0x27')],'as':_0x2c85('0x28'),'where':{'id':_0x22cedc[_0x2c85('0x13')]}}],'raw':!![]})[_0x2c85('0xc')](function(_0x5b7763){var _0x4c1e94=_0x5b7763[_0x2c85('0x25')](function(_0x5681d2){return _0xbffdd0['CmHopperBlack'][_0x2c85('0x1e')]({'phone':_0x22cedc[_0x2c85('0x12')],'ContactId':_0x22cedc['id'],'ListId':_0x22cedc['ListId'],'CampaignId':_0x5681d2['id']});});return Promise[_0x2c85('0x26')](_0x4c1e94);});}module[_0x2c85('0x2a')]=function(_0x1b0998){return _0x1b0998[_0x2c85('0x2b')](_0x2c85('0x2c'),attributes,{'tableName':_0x2c85('0x2d'),'paranoid':!![],'indexes':[{'name':_0x2c85('0x12'),'fields':[_0x2c85('0x12')]},{'name':'fti_cm_contacts','fields':['firstName','lastName',_0x2c85('0x12'),_0x2c85('0x2e'),_0x2c85('0x2f'),'email'],'type':_0x2c85('0x30')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x2c85('0x31'),'hooks':{'afterCreate':function(_0x4ee585,_0x33af7c,_0x2dc2f8){var _0x3e2fab=_0x1b0998[_0x2c85('0x32')];var _0x57487f=_0x4ee585[_0x2c85('0x33')]({'plain':!![]});if(!_0x57487f[_0x2c85('0x13')]){logger[_0x2c85('0x34')](_0x2c85('0x35')+_0x57487f['id']);return _0x2dc2f8();}if(!_0x57487f['phone']){return _0x2dc2f8();}return createHopperForVoiceQueues(_0x3e2fab,_0x57487f)[_0x2c85('0xc')](function(){return createHopperBlackForVoiceQueues(_0x3e2fab,_0x57487f);})[_0x2c85('0xc')](function(){return createHopperForCampaigns(_0x3e2fab,_0x57487f);})[_0x2c85('0xc')](function(){return createHopperBlackForCampaigns(_0x3e2fab,_0x57487f);})[_0x2c85('0xc')](function(){return _0x2dc2f8();})[_0x2c85('0x36')](function(_0x583d8b){logger[_0x2c85('0x34')](_0x2c85('0x37'),_0x583d8b[_0x2c85('0x38')]);_0x2dc2f8();});},'afterDestroy':function(_0x5266ca,_0x41ff28,_0x5a43af){var _0x55a304=_0x1b0998[_0x2c85('0x32')];var _0x3cf09b=_0x5266ca[_0x2c85('0x33')]({'plain':!![]});return _0x55a304[_0x2c85('0x1b')][_0x2c85('0x21')]({'raw':!![],'where':{'ListId':_0x3cf09b['ListId'],'ContactId':_0x3cf09b['id']}})[_0x2c85('0xc')](function(_0x596f86){if(!_[_0x2c85('0x39')](_0x596f86)){var _0x3262d1=[];for(var _0x3143a3=0x0;_0x3143a3<_0x596f86['length'];_0x3143a3+=0x1){var _0x51c11f=_0x55a304[_0x2c85('0x1b')][_0x2c85('0x3a')]({'where':{'ListId':_0x596f86[_0x3143a3][_0x2c85('0x13')],'ContactId':_0x596f86[_0x3143a3][_0x2c85('0x3b')],'VoiceQueueId':_0x596f86[_0x3143a3][_0x2c85('0x1d')],'CampaignId':_0x596f86[_0x3143a3][_0x2c85('0x1a')]}});_0x3262d1[_0x2c85('0x3c')](_0x51c11f);}return Promise[_0x2c85('0x26')](_0x3262d1);}})['then'](function(_0x43ba0a){logger[_0x2c85('0x3d')](_0x2c85('0x3e'),util[_0x2c85('0x3f')](_0x43ba0a,{'showHidden':![],'depth':null}));_0x5a43af();})[_0x2c85('0x36')](function(_0x5a99d4){logger[_0x2c85('0x34')](_0x2c85('0x40'),util[_0x2c85('0x3f')](_0x5a99d4,{'showHidden':![],'depth':null}));_0x5a43af(_0x5a99d4);});}}});}; \ No newline at end of file +var _0x4bcf=['message','models','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','utcOffset','add','minutes','ListId','scheduledat','priority','callbackUniqueid','phone','assign','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','CmHopper','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','always','onlyIfOpen','findAll','outbound','dialCheckDuplicateType','CmList','Lists','map','all','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','get','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','error'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x4bcf,0xe0));var _0xf4bc=function(_0xe6aba1,_0x4ff2b4){_0xe6aba1=_0xe6aba1-0x0;var _0x56482c=_0x4bcf[_0xe6aba1];return _0x56482c;};'use strict';var _=require(_0xf4bc('0x0'));var util=require(_0xf4bc('0x1'));var logger=require(_0xf4bc('0x2'))(_0xf4bc('0x3'));var moment=require(_0xf4bc('0x4'));var shared=require(_0xf4bc('0x5'));var attributes=require(_0xf4bc('0x6'));function getTimezoneCallbackAt(_0x1cc4d0,_0x286cbe,_0xef7287,_0x45f1c5){var _0x1034f2=_0x45f1c5?_0xf4bc('0x7'):_0xf4bc('0x8');var _0x5c7a82=_0xef7287['scheduledat']?_0xef7287['scheduledat']:moment()[_0xf4bc('0x9')](_0xf4bc('0xa'));if(_[_0xf4bc('0xb')](_0xef7287[_0xf4bc('0xc')])){return Promise[_0xf4bc('0xd')](_0x5c7a82);}return _0x1cc4d0[_0x1034f2][_0xf4bc('0xe')]({'where':{'id':_0x286cbe}})[_0xf4bc('0xf')](function(_0xeaa122){if(_['isNil'](_0xeaa122)||_[_0xf4bc('0xb')](_0xeaa122[_0xf4bc('0xc')])){return Promise[_0xf4bc('0xd')](_0x5c7a82);}var _0x3ff818=shared['timezones'];var _0x17353f=_0x3ff818[_0xeaa122[_0xf4bc('0xc')]];var _0x59e2df=_0x3ff818[_0xef7287[_0xf4bc('0xc')]];if(_[_0xf4bc('0xb')](_0x17353f)&&_[_0xf4bc('0xb')](_0x59e2df)){return Promise[_0xf4bc('0xd')](_0x5c7a82);}var _0x74ab20=_0x17353f['utcOffset']-_0x59e2df[_0xf4bc('0x10')];var _0x30bff0=_0xef7287['scheduledat']?_0xef7287['scheduledat']:moment();_0x5c7a82=moment(_0x30bff0)[_0xf4bc('0x11')](_0x74ab20,_0xf4bc('0x12'))[_0xf4bc('0x9')](_0xf4bc('0xa'));return Promise[_0xf4bc('0xd')](_0x5c7a82);});}function getNewHopperPayload(_0x118699){return{'phone':_0x118699['phone'],'ContactId':_0x118699['id'],'ListId':_0x118699[_0xf4bc('0x13')],'scheduledat':_0x118699[_0xf4bc('0x14')]?_0x118699[_0xf4bc('0x14')]:moment()['format'](_0xf4bc('0xa')),'priority':_0x118699[_0xf4bc('0x15')]?_0x118699['priority']:0x2,'callback':_0x118699[_0xf4bc('0x16')]?!![]:![],'callbackuniqueid':_0x118699[_0xf4bc('0x16')]?_0x118699[_0xf4bc('0x16')]:undefined,'callbackat':_0x118699[_0xf4bc('0x16')]?moment()[_0xf4bc('0x9')](_0xf4bc('0xa')):undefined};}function handleAlwaysCheckDuplicate(_0x4ac63f,_0x495f18,_0x10ff98,_0x19f0e6){var _0x5d9f6f={'phone':_0x10ff98[_0xf4bc('0x17')]};var _0x1b0418={'calleridnum':_0x10ff98[_0xf4bc('0x17')]};if(_0x19f0e6){Object[_0xf4bc('0x18')](_0x5d9f6f,{'CampaignId':_0x495f18['id']});Object[_0xf4bc('0x18')](_0x1b0418,{'CampaignId':_0x495f18['id']});}else{Object[_0xf4bc('0x18')](_0x5d9f6f,{'VoiceQueueId':_0x495f18['id']});Object['assign'](_0x1b0418,{'VoiceQueueId':_0x495f18['id']});}return _0x4ac63f['CmHopper'][_0xf4bc('0xe')]({'where':_0x5d9f6f})['then'](function(_0x12991c){if(_0x12991c){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x10ff98[_0xf4bc('0x17')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x495f18['id']);}return _0x4ac63f[_0xf4bc('0x19')][_0xf4bc('0xe')]({'where':_0x1b0418});})[_0xf4bc('0xf')](function(_0x3c2b45){if(_0x3c2b45){throw new Error(_0xf4bc('0x1a')+_0x10ff98[_0xf4bc('0x17')]+_0xf4bc('0x1b')+_0x495f18['id']);}var _0x4b47e6=getNewHopperPayload(_0x10ff98);if(_0x19f0e6){_0x4b47e6[_0xf4bc('0x1c')]=_0x495f18['id'];}else{_0x4b47e6['VoiceQueueId']=_0x495f18['id'];}return _0x4ac63f[_0xf4bc('0x1d')][_0xf4bc('0x1e')](_0x4b47e6);});}function handleOnlyIfOpenCheckDuplicate(_0x505c3a,_0x22e13b,_0xb82f93,_0x106bd2){var _0x5bec11={'phone':_0xb82f93[_0xf4bc('0x17')]};if(_0x106bd2){Object[_0xf4bc('0x18')](_0x5bec11,{'CampaignId':_0x22e13b['id']});}else{Object[_0xf4bc('0x18')](_0x5bec11,{'VoiceQueueId':_0x22e13b['id']});}return _0x505c3a[_0xf4bc('0x1d')][_0xf4bc('0xe')]({'where':_0x5bec11})[_0xf4bc('0xf')](function(_0x428ae){if(_0x428ae){throw new Error(_0xf4bc('0x1f')+_0xb82f93[_0xf4bc('0x17')]+_0xf4bc('0x1b')+_0x22e13b['id']);}var _0x4a6e1b=getNewHopperPayload(_0xb82f93);if(_0x106bd2){_0x4a6e1b[_0xf4bc('0x1c')]=_0x22e13b['id'];}else{_0x4a6e1b[_0xf4bc('0x20')]=_0x22e13b['id'];}return _0x505c3a[_0xf4bc('0x1d')][_0xf4bc('0x1e')](_0x4a6e1b);});}function handleNeverCheckDuplicate(_0x348c15,_0x59fd0f,_0x2ac0fc){var _0x3995af=getNewHopperPayload(_0x2ac0fc);_0x3995af['VoiceQueueId']=_0x59fd0f['id'];return _0x348c15['CmHopper'][_0xf4bc('0x1e')](_0x3995af);}function handleCheckDuplicate(_0x1d0583,_0x52db0e,_0xe1289e,_0x4cc2b0){return getTimezoneCallbackAt(_0x1d0583,_0x52db0e,_0xe1289e,_0x4cc2b0)['then'](function(_0x408906){_0xe1289e[_0xf4bc('0x14')]=_0x408906;switch(_0x52db0e['dialCheckDuplicateType']){case _0xf4bc('0x21'):return handleAlwaysCheckDuplicate(_0x1d0583,_0x52db0e,_0xe1289e,_0x4cc2b0);case _0xf4bc('0x22'):return handleOnlyIfOpenCheckDuplicate(_0x1d0583,_0x52db0e,_0xe1289e,_0x4cc2b0);default:return handleNeverCheckDuplicate(_0x1d0583,_0x52db0e,_0xe1289e);}});}function createHopperForVoiceQueues(_0x59964a,_0x17e281){return _0x59964a[_0xf4bc('0x8')][_0xf4bc('0x23')]({'where':{'type':_0xf4bc('0x24')},'attributes':['id',_0xf4bc('0x25'),_0xf4bc('0xc')],'include':[{'model':_0x59964a[_0xf4bc('0x26')],'as':_0xf4bc('0x27'),'where':{'id':_0x17e281['ListId']}}],'raw':!![]})[_0xf4bc('0xf')](function(_0x2e52a0){var _0x53d719=_0x2e52a0[_0xf4bc('0x28')](function(_0x4d32b6){return handleCheckDuplicate(_0x59964a,_0x4d32b6,_0x17e281,![]);});return Promise[_0xf4bc('0x29')](_0x53d719);});}function createHopperForCampaigns(_0xeba7b,_0x4c4734){return _0xeba7b[_0xf4bc('0x7')][_0xf4bc('0x23')]({'attributes':['id',_0xf4bc('0x25'),_0xf4bc('0xc')],'include':[{'model':_0xeba7b['CmList'],'as':_0xf4bc('0x27'),'where':{'id':_0x4c4734[_0xf4bc('0x13')]}}],'raw':!![]})[_0xf4bc('0xf')](function(_0x5532d4){var _0x3a5860=_0x5532d4[_0xf4bc('0x28')](function(_0x6c595c){return handleCheckDuplicate(_0xeba7b,_0x6c595c,_0x4c4734,!![]);});return Promise[_0xf4bc('0x29')](_0x3a5860);});}function createHopperBlackForVoiceQueues(_0xfb8b5a,_0x797547){return _0xfb8b5a[_0xf4bc('0x8')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0xfb8b5a[_0xf4bc('0x26')],'as':'BlackLists','where':{'id':_0x797547[_0xf4bc('0x13')]}}],'raw':!![]})[_0xf4bc('0xf')](function(_0x1436ff){var _0x5c535a=_0x1436ff[_0xf4bc('0x28')](function(_0x5b5e9a){return _0xfb8b5a['CmHopperBlack'][_0xf4bc('0x1e')]({'phone':_0x797547[_0xf4bc('0x17')],'ContactId':_0x797547['id'],'ListId':_0x797547[_0xf4bc('0x13')],'VoiceQueueId':_0x5b5e9a['id']});});return Promise['all'](_0x5c535a);});}function createHopperBlackForCampaigns(_0x520f9b,_0x181e00){return _0x520f9b[_0xf4bc('0x7')]['findAll']({'attributes':['id'],'include':[{'model':_0x520f9b[_0xf4bc('0x26')],'as':_0xf4bc('0x2a'),'where':{'id':_0x181e00[_0xf4bc('0x13')]}}],'raw':!![]})[_0xf4bc('0xf')](function(_0x2c35f0){var _0x3de3bf=_0x2c35f0['map'](function(_0x2f8f62){return _0x520f9b[_0xf4bc('0x2b')][_0xf4bc('0x1e')]({'phone':_0x181e00['phone'],'ContactId':_0x181e00['id'],'ListId':_0x181e00[_0xf4bc('0x13')],'CampaignId':_0x2f8f62['id']});});return Promise[_0xf4bc('0x29')](_0x3de3bf);});}module[_0xf4bc('0x2c')]=function(_0x229dd7){return _0x229dd7[_0xf4bc('0x2d')](_0xf4bc('0x2e'),attributes,{'tableName':_0xf4bc('0x2f'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xf4bc('0x17')]},{'name':_0xf4bc('0x30'),'fields':[_0xf4bc('0x31'),_0xf4bc('0x32'),_0xf4bc('0x17'),_0xf4bc('0x33'),_0xf4bc('0x34'),_0xf4bc('0x35')],'type':_0xf4bc('0x36')}],'timestamps':!![],'charset':_0xf4bc('0x37'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x29121d,_0x2e28e8,_0x3c09da){var _0x422d51=_0x229dd7['models'];var _0x1b2202=_0x29121d[_0xf4bc('0x38')]({'plain':!![]});if(!_0x1b2202['ListId']){logger['error'](_0xf4bc('0x39')+_0x1b2202['id']);return _0x3c09da();}if(!_0x1b2202['phone']){return _0x3c09da();}return createHopperForVoiceQueues(_0x422d51,_0x1b2202)[_0xf4bc('0xf')](function(){return createHopperBlackForVoiceQueues(_0x422d51,_0x1b2202);})[_0xf4bc('0xf')](function(){return createHopperForCampaigns(_0x422d51,_0x1b2202);})[_0xf4bc('0xf')](function(){return createHopperBlackForCampaigns(_0x422d51,_0x1b2202);})[_0xf4bc('0xf')](function(){return _0x3c09da();})[_0xf4bc('0x3a')](function(_0x25fc4e){logger[_0xf4bc('0x3b')]('[cmContact][afterCreate]',_0x25fc4e[_0xf4bc('0x3c')]);_0x3c09da();});},'afterDestroy':function(_0x4c4307,_0xc2f22e,_0x4e3f0f){var _0x16fecb=_0x229dd7[_0xf4bc('0x3d')];var _0x456a8b=_0x4c4307[_0xf4bc('0x38')]({'plain':!![]});return _0x16fecb[_0xf4bc('0x1d')][_0xf4bc('0x23')]({'raw':!![],'where':{'ListId':_0x456a8b[_0xf4bc('0x13')],'ContactId':_0x456a8b['id']}})[_0xf4bc('0xf')](function(_0x54f6e4){if(!_[_0xf4bc('0x3e')](_0x54f6e4)){var _0x10107e=[];for(var _0x2eb2a4=0x0;_0x2eb2a4<_0x54f6e4[_0xf4bc('0x3f')];_0x2eb2a4+=0x1){var _0x25f12f=_0x16fecb['CmHopper'][_0xf4bc('0x40')]({'where':{'ListId':_0x54f6e4[_0x2eb2a4][_0xf4bc('0x13')],'ContactId':_0x54f6e4[_0x2eb2a4][_0xf4bc('0x41')],'VoiceQueueId':_0x54f6e4[_0x2eb2a4][_0xf4bc('0x20')],'CampaignId':_0x54f6e4[_0x2eb2a4]['CampaignId']}});_0x10107e[_0xf4bc('0x42')](_0x25f12f);}return Promise[_0xf4bc('0x29')](_0x10107e);}})[_0xf4bc('0xf')](function(_0x266b16){logger[_0xf4bc('0x43')](_0xf4bc('0x44'),util[_0xf4bc('0x45')](_0x266b16,{'showHidden':![],'depth':null}));_0x4e3f0f();})['catch'](function(_0x47d551){logger['error'](_0xf4bc('0x46'),util['inspect'](_0x47d551,{'showHidden':![],'depth':null}));_0x4e3f0f(_0x47d551);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index e80d7ca..f9a8990 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x27bcfc,_0x46bed0){var _0x59e179=function(_0x3559c2){while(--_0x3559c2){_0x27bcfc['push'](_0x27bcfc['shift']());}};_0x59e179(++_0x46bed0);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0xb4f476,_0x5211f3){var _0x2d6247=function(_0x2a5697){while(--_0x2a5697){_0xb4f476['push'](_0xb4f476['shift']());}};_0x2d6247(++_0x5211f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 d9ff261..4fc59c2 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 _0x3299=['exports','INTEGER','STRING','PHONE'];(function(_0x57bfad,_0x5126cc){var _0x5d8e2f=function(_0xd5ce2b){while(--_0xd5ce2b){_0x57bfad['push'](_0x57bfad['shift']());}};_0x5d8e2f(++_0x5126cc);}(_0x3299,0x1bc));var _0x9329=function(_0x426c05,_0x2e2a00){_0x426c05=_0x426c05-0x0;var _0x124454=_0x3299[_0x426c05];return _0x124454;};'use strict';var Sequelize=require('sequelize');module[_0x9329('0x0')]={'CmContactId':{'type':Sequelize[_0x9329('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x9329('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9329('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9329('0x2')],'defaultValue':_0x9329('0x3')},'OrderBy':{'type':Sequelize[_0x9329('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x9329('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x639a=['exports','INTEGER','STRING','PHONE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x639a,0xec));var _0xa639=function(_0x114f78,_0x2fe47b){_0x114f78=_0x114f78-0x0;var _0x375ba4=_0x639a[_0x114f78];return _0x375ba4;};'use strict';var Sequelize=require('sequelize');module[_0xa639('0x0')]={'CmContactId':{'type':Sequelize[_0xa639('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xa639('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa639('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa639('0x2')],'defaultValue':_0xa639('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xa639('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 8f03044..b32622e 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 _0x284d=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','CmContactHasItem','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x275890,_0x625a19){var _0x5347bc=function(_0x1b2642){while(--_0x1b2642){_0x275890['push'](_0x275890['shift']());}};_0x5347bc(++_0x625a19);}(_0x284d,0x194));var _0xd284=function(_0x478754,_0x1ceb87){_0x478754=_0x478754-0x0;var _0x30b765=_0x284d[_0x478754];return _0x30b765;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd284('0x0'));var jsonpatch=require(_0xd284('0x1'));var rp=require(_0xd284('0x2'));var moment=require(_0xd284('0x3'));var BPromise=require(_0xd284('0x4'));var Mustache=require(_0xd284('0x5'));var util=require(_0xd284('0x6'));var path=require(_0xd284('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd284('0x8'));var fs=require('fs');var fs_extra=require(_0xd284('0x9'));var _=require(_0xd284('0xa'));var squel=require(_0xd284('0xb'));var crypto=require(_0xd284('0xc'));var jsforce=require(_0xd284('0xd'));var deskjs=require(_0xd284('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd284('0xf'));var Papa=require(_0xd284('0x10'));var Redis=require(_0xd284('0x11'));var authService=require(_0xd284('0x12'));var qs=require(_0xd284('0x13'));var as=require(_0xd284('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd284('0x15'))(_0xd284('0x16'));var utils=require(_0xd284('0x17'));var config=require(_0xd284('0x18'));var licenseUtil=require(_0xd284('0x19'));var db=require(_0xd284('0x1a'))['db'];function respondWithStatusCode(_0x3df129,_0x49da2e){_0x49da2e=_0x49da2e||0xcc;return function(_0x33726e){if(_0x33726e){return _0x3df129[_0xd284('0x1b')](_0x49da2e);}return _0x3df129['status'](_0x49da2e)[_0xd284('0x1c')]();};}function respondWithResult(_0x35726c,_0x3c31d6){_0x3c31d6=_0x3c31d6||0xc8;return function(_0x3a9e1e){if(_0x3a9e1e){return _0x35726c[_0xd284('0x1d')](_0x3c31d6)[_0xd284('0x1e')](_0x3a9e1e);}};}function respondWithFilteredResult(_0x1a7432,_0x37b2f6){return function(_0x5b9b40){if(_0x5b9b40){var _0x3230a0=typeof _0x37b2f6['offset']===_0xd284('0x1f')&&typeof _0x37b2f6[_0xd284('0x20')]===_0xd284('0x1f');var _0x59dd6a=_0x5b9b40[_0xd284('0x21')];var _0x37cadd=_0x3230a0?0x0:_0x37b2f6[_0xd284('0x22')];var _0x16078e=_0x3230a0?_0x5b9b40[_0xd284('0x21')]:_0x37b2f6[_0xd284('0x22')]+_0x37b2f6[_0xd284('0x20')];var _0x216ad8;if(_0x16078e>=_0x59dd6a){_0x16078e=_0x59dd6a;_0x216ad8=0xc8;}else{_0x216ad8=0xce;}_0x1a7432[_0xd284('0x1d')](_0x216ad8);return _0x1a7432[_0xd284('0x23')](_0xd284('0x24'),_0x37cadd+'-'+_0x16078e+'/'+_0x59dd6a)['json'](_0x5b9b40);}return null;};}function patchUpdates(_0x5a8ce5){return function(_0x26c6cd){try{jsonpatch[_0xd284('0x25')](_0x26c6cd,_0x5a8ce5,!![]);}catch(_0x2a1c4b){return BPromise[_0xd284('0x26')](_0x2a1c4b);}return _0x26c6cd[_0xd284('0x27')]();};}function saveUpdates(_0x4984e9,_0x8bb085){return function(_0x4a64e9){if(_0x4a64e9){return _0x4a64e9[_0xd284('0x28')](_0x4984e9)[_0xd284('0x29')](function(_0x55753c){return _0x55753c;});}return null;};}function removeEntity(_0x389ed8,_0x59827d){return function(_0x427de9){if(_0x427de9){return _0x427de9[_0xd284('0x2a')]()['then'](function(){var _0x539cc1=_0x427de9['get']({'plain':!![]});var _0x494bbf=_0xd284('0x2b');return db[_0xd284('0x2c')]['destroy']({'where':{'type':_0x494bbf,'resourceId':_0x539cc1['id']}})[_0xd284('0x29')](function(){return _0x427de9;});})['then'](function(){_0x389ed8[_0xd284('0x1d')](0xcc)[_0xd284('0x1c')]();});}};}function handleEntityNotFound(_0x40715e,_0x404016){return function(_0x229c13){if(!_0x229c13){_0x40715e['sendStatus'](0x194);}return _0x229c13;};}function handleError(_0x207bb8,_0x143fa7){_0x143fa7=_0x143fa7||0x1f4;return function(_0x42f138){logger[_0xd284('0x2d')](_0x42f138[_0xd284('0x2e')]);if(_0x42f138[_0xd284('0x2f')]){delete _0x42f138['name'];}_0x207bb8[_0xd284('0x1d')](_0x143fa7)[_0xd284('0x30')](_0x42f138);};}exports['index']=function(_0x4df5fc,_0x447eab){var _0x408923={},_0xa7f5a4={},_0x1510f6={'count':0x0,'rows':[]};var _0x54396b=_['map'](db[_0xd284('0x31')][_0xd284('0x32')],function(_0x21dc4e){return{'name':_0x21dc4e[_0xd284('0x33')],'type':_0x21dc4e[_0xd284('0x34')][_0xd284('0x35')]};});_0xa7f5a4['model']=_[_0xd284('0x36')](_0x54396b,_0xd284('0x2f'));_0xa7f5a4[_0xd284('0x37')]=_['keys'](_0x4df5fc[_0xd284('0x37')]);_0xa7f5a4[_0xd284('0x38')]=_['intersection'](_0xa7f5a4[_0xd284('0x39')],_0xa7f5a4[_0xd284('0x37')]);_0x408923[_0xd284('0x3a')]=_[_0xd284('0x3b')](_0xa7f5a4[_0xd284('0x39')],qs['fields'](_0x4df5fc['query'][_0xd284('0x3c')]));_0x408923[_0xd284('0x3a')]=_0x408923[_0xd284('0x3a')][_0xd284('0x3d')]?_0x408923[_0xd284('0x3a')]:_0xa7f5a4[_0xd284('0x39')];if(!_0x4df5fc[_0xd284('0x37')][_0xd284('0x3e')]('nolimit')){_0x408923[_0xd284('0x20')]=qs[_0xd284('0x20')](_0x4df5fc[_0xd284('0x37')]['limit']);_0x408923[_0xd284('0x22')]=qs[_0xd284('0x22')](_0x4df5fc[_0xd284('0x37')][_0xd284('0x22')]);}_0x408923[_0xd284('0x3f')]=qs[_0xd284('0x40')](_0x4df5fc[_0xd284('0x37')][_0xd284('0x40')]);_0x408923['where']=qs[_0xd284('0x38')](_[_0xd284('0x41')](_0x4df5fc[_0xd284('0x37')],_0xa7f5a4[_0xd284('0x38')]),_0x54396b);if(_0x4df5fc[_0xd284('0x37')][_0xd284('0x42')]){_0x408923[_0xd284('0x43')]=_['merge'](_0x408923[_0xd284('0x43')],{'$or':_[_0xd284('0x36')](_0x54396b,function(_0x99baf4){if(_0x99baf4[_0xd284('0x34')]!==_0xd284('0x44')){var _0x2220cc={};_0x2220cc[_0x99baf4['name']]={'$like':'%'+_0x4df5fc['query'][_0xd284('0x42')]+'%'};return _0x2220cc;}})});}_0x408923=_[_0xd284('0x45')]({},_0x408923,_0x4df5fc[_0xd284('0x46')]);var _0x1f10d3={'where':_0x408923[_0xd284('0x43')]};return db[_0xd284('0x31')][_0xd284('0x21')](_0x1f10d3)[_0xd284('0x29')](function(_0x14f71f){_0x1510f6[_0xd284('0x21')]=_0x14f71f;if(_0x4df5fc[_0xd284('0x37')][_0xd284('0x47')]){_0x408923[_0xd284('0x48')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xd284('0x49')](_0x408923);})['then'](function(_0x2ef6a7){_0x1510f6['rows']=_0x2ef6a7;return _0x1510f6;})[_0xd284('0x29')](respondWithFilteredResult(_0x447eab,_0x408923))[_0xd284('0x4a')](handleError(_0x447eab,null));};exports['show']=function(_0x4c4c38,_0x188b07){var _0x988dde={'raw':!![],'where':{'id':_0x4c4c38[_0xd284('0x4b')]['id']}},_0x310883={};_0x310883[_0xd284('0x39')]=_[_0xd284('0x4c')](db[_0xd284('0x31')][_0xd284('0x32')]);_0x310883[_0xd284('0x37')]=_[_0xd284('0x4c')](_0x4c4c38[_0xd284('0x37')]);_0x310883['filters']=_['intersection'](_0x310883[_0xd284('0x39')],_0x310883[_0xd284('0x37')]);_0x988dde[_0xd284('0x3a')]=_['intersection'](_0x310883[_0xd284('0x39')],qs[_0xd284('0x3c')](_0x4c4c38['query'][_0xd284('0x3c')]));_0x988dde['attributes']=_0x988dde[_0xd284('0x3a')]['length']?_0x988dde['attributes']:_0x310883['model'];if(_0x4c4c38['query'][_0xd284('0x47')]){_0x988dde['include']=[{'all':!![]}];}_0x988dde=_[_0xd284('0x45')]({},_0x988dde,_0x4c4c38[_0xd284('0x46')]);return db[_0xd284('0x31')][_0xd284('0x4d')](_0x988dde)[_0xd284('0x29')](handleEntityNotFound(_0x188b07,null))[_0xd284('0x29')](respondWithResult(_0x188b07,null))[_0xd284('0x4a')](handleError(_0x188b07,null));};exports[_0xd284('0x4e')]=function(_0x3434ae,_0x1853a3){return db[_0xd284('0x31')][_0xd284('0x4e')](_0x3434ae['body'],{})['then'](function(_0x361b9e){var _0x96aae7=_0x3434ae[_0xd284('0x4f')][_0xd284('0x50')]({'plain':!![]});if(!_0x96aae7)throw new Error(_0xd284('0x51'));if(_0x96aae7[_0xd284('0x52')]===_0xd284('0x4f')){var _0x3fa714=_0x361b9e[_0xd284('0x50')]({'plain':!![]});var _0x5ed8a2=_0xd284('0x2b');return db[_0xd284('0x53')][_0xd284('0x4d')]({'where':{'name':_0x5ed8a2,'userProfileId':_0x96aae7['userProfileId']},'raw':!![]})[_0xd284('0x29')](function(_0x4974cb){if(_0x4974cb&&_0x4974cb[_0xd284('0x54')]===0x0){return db['UserProfileResource'][_0xd284('0x4e')]({'name':_0x3fa714['name'],'resourceId':_0x3fa714['id'],'type':_0x4974cb[_0xd284('0x2f')],'sectionId':_0x4974cb['id']},{})[_0xd284('0x29')](function(){return _0x361b9e;});}else{return _0x361b9e;}})[_0xd284('0x4a')](function(_0x1abb4d){logger['error'](_0xd284('0x55'),_0x1abb4d);throw _0x1abb4d;});}return _0x361b9e;})[_0xd284('0x29')](respondWithResult(_0x1853a3,0xc9))[_0xd284('0x4a')](handleError(_0x1853a3,null));};exports[_0xd284('0x28')]=function(_0x51209c,_0x181f91){if(_0x51209c[_0xd284('0x56')]['id']){delete _0x51209c[_0xd284('0x56')]['id'];}return db[_0xd284('0x31')][_0xd284('0x4d')]({'where':{'id':_0x51209c[_0xd284('0x4b')]['id']}})['then'](handleEntityNotFound(_0x181f91,null))[_0xd284('0x29')](saveUpdates(_0x51209c[_0xd284('0x56')],null))[_0xd284('0x29')](respondWithResult(_0x181f91,null))[_0xd284('0x4a')](handleError(_0x181f91,null));};exports[_0xd284('0x2a')]=function(_0xa02ae7,_0xc3ef32){return db[_0xd284('0x31')]['find']({'where':{'id':_0xa02ae7[_0xd284('0x4b')]['id']}})[_0xd284('0x29')](handleEntityNotFound(_0xc3ef32,null))[_0xd284('0x29')](removeEntity(_0xc3ef32,null))[_0xd284('0x4a')](handleError(_0xc3ef32,null));}; \ No newline at end of file +var _0x8e67=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','CmContactHasItems','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','request-promise','moment','bluebird','path','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0x8e67,0x99));var _0x78e6=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x8e67[_0x420b24];return _0x4da552;};'use strict';var emlformat=require(_0x78e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78e6('0x2'));var moment=require(_0x78e6('0x3'));var BPromise=require(_0x78e6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x78e6('0x5'));var sox=require('sox');var csv=require(_0x78e6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78e6('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x78e6('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x78e6('0x9'));var toCsv=require('to-csv');var querystring=require(_0x78e6('0xa'));var Papa=require(_0x78e6('0xb'));var Redis=require(_0x78e6('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78e6('0xd'));var logger=require(_0x78e6('0xe'))(_0x78e6('0xf'));var utils=require(_0x78e6('0x10'));var config=require(_0x78e6('0x11'));var licenseUtil=require(_0x78e6('0x12'));var db=require(_0x78e6('0x13'))['db'];function respondWithStatusCode(_0x45648d,_0x430f07){_0x430f07=_0x430f07||0xcc;return function(_0x14c908){if(_0x14c908){return _0x45648d[_0x78e6('0x14')](_0x430f07);}return _0x45648d[_0x78e6('0x15')](_0x430f07)['end']();};}function respondWithResult(_0x162d8d,_0x259d9e){_0x259d9e=_0x259d9e||0xc8;return function(_0xba64c3){if(_0xba64c3){return _0x162d8d['status'](_0x259d9e)[_0x78e6('0x16')](_0xba64c3);}};}function respondWithFilteredResult(_0x193ce5,_0x1a102b){return function(_0x150b2a){if(_0x150b2a){var _0x5c5d14=typeof _0x1a102b['offset']===_0x78e6('0x17')&&typeof _0x1a102b['limit']===_0x78e6('0x17');var _0x43adeb=_0x150b2a[_0x78e6('0x18')];var _0x2a4e0b=_0x5c5d14?0x0:_0x1a102b[_0x78e6('0x19')];var _0x142345=_0x5c5d14?_0x150b2a['count']:_0x1a102b['offset']+_0x1a102b[_0x78e6('0x1a')];var _0x52f491;if(_0x142345>=_0x43adeb){_0x142345=_0x43adeb;_0x52f491=0xc8;}else{_0x52f491=0xce;}_0x193ce5['status'](_0x52f491);return _0x193ce5[_0x78e6('0x1b')](_0x78e6('0x1c'),_0x2a4e0b+'-'+_0x142345+'/'+_0x43adeb)[_0x78e6('0x16')](_0x150b2a);}return null;};}function patchUpdates(_0x345657){return function(_0x36e962){try{jsonpatch['apply'](_0x36e962,_0x345657,!![]);}catch(_0x2d40ce){return BPromise[_0x78e6('0x1d')](_0x2d40ce);}return _0x36e962[_0x78e6('0x1e')]();};}function saveUpdates(_0x3c6733,_0xd178a3){return function(_0x43c726){if(_0x43c726){return _0x43c726[_0x78e6('0x1f')](_0x3c6733)[_0x78e6('0x20')](function(_0x59aeda){return _0x59aeda;});}return null;};}function removeEntity(_0x471cf9,_0x53822c){return function(_0x5d0bc0){if(_0x5d0bc0){return _0x5d0bc0['destroy']()[_0x78e6('0x20')](function(){var _0x2e5eb7=_0x5d0bc0['get']({'plain':!![]});var _0x512974=_0x78e6('0x21');return db[_0x78e6('0x22')][_0x78e6('0x23')]({'where':{'type':_0x512974,'resourceId':_0x2e5eb7['id']}})[_0x78e6('0x20')](function(){return _0x5d0bc0;});})[_0x78e6('0x20')](function(){_0x471cf9[_0x78e6('0x15')](0xcc)[_0x78e6('0x24')]();});}};}function handleEntityNotFound(_0x281f60,_0x2f598c){return function(_0x420c92){if(!_0x420c92){_0x281f60[_0x78e6('0x14')](0x194);}return _0x420c92;};}function handleError(_0x3f04d3,_0x4e8dc9){_0x4e8dc9=_0x4e8dc9||0x1f4;return function(_0x14004e){logger[_0x78e6('0x25')](_0x14004e[_0x78e6('0x26')]);if(_0x14004e[_0x78e6('0x27')]){delete _0x14004e[_0x78e6('0x27')];}_0x3f04d3[_0x78e6('0x15')](_0x4e8dc9)[_0x78e6('0x28')](_0x14004e);};}exports[_0x78e6('0x29')]=function(_0x588611,_0x3fbbee){var _0x4dc09e={},_0x30ebe9={},_0xd31488={'count':0x0,'rows':[]};var _0x1f5c88=_[_0x78e6('0x2a')](db[_0x78e6('0x2b')][_0x78e6('0x2c')],function(_0x5a3c68){return{'name':_0x5a3c68[_0x78e6('0x2d')],'type':_0x5a3c68[_0x78e6('0x2e')][_0x78e6('0x2f')]};});_0x30ebe9[_0x78e6('0x30')]=_[_0x78e6('0x2a')](_0x1f5c88,'name');_0x30ebe9[_0x78e6('0x31')]=_[_0x78e6('0x32')](_0x588611[_0x78e6('0x31')]);_0x30ebe9[_0x78e6('0x33')]=_[_0x78e6('0x34')](_0x30ebe9['model'],_0x30ebe9[_0x78e6('0x31')]);_0x4dc09e[_0x78e6('0x35')]=_['intersection'](_0x30ebe9[_0x78e6('0x30')],qs[_0x78e6('0x36')](_0x588611[_0x78e6('0x31')][_0x78e6('0x36')]));_0x4dc09e['attributes']=_0x4dc09e[_0x78e6('0x35')][_0x78e6('0x37')]?_0x4dc09e[_0x78e6('0x35')]:_0x30ebe9[_0x78e6('0x30')];if(!_0x588611[_0x78e6('0x31')][_0x78e6('0x38')](_0x78e6('0x39'))){_0x4dc09e['limit']=qs[_0x78e6('0x1a')](_0x588611[_0x78e6('0x31')]['limit']);_0x4dc09e[_0x78e6('0x19')]=qs[_0x78e6('0x19')](_0x588611[_0x78e6('0x31')][_0x78e6('0x19')]);}_0x4dc09e[_0x78e6('0x3a')]=qs[_0x78e6('0x3b')](_0x588611['query'][_0x78e6('0x3b')]);_0x4dc09e[_0x78e6('0x3c')]=qs[_0x78e6('0x33')](_[_0x78e6('0x3d')](_0x588611[_0x78e6('0x31')],_0x30ebe9[_0x78e6('0x33')]),_0x1f5c88);if(_0x588611[_0x78e6('0x31')][_0x78e6('0x3e')]){_0x4dc09e[_0x78e6('0x3c')]=_[_0x78e6('0x3f')](_0x4dc09e[_0x78e6('0x3c')],{'$or':_[_0x78e6('0x2a')](_0x1f5c88,function(_0x331508){if(_0x331508[_0x78e6('0x2e')]!==_0x78e6('0x40')){var _0x3364c0={};_0x3364c0[_0x331508[_0x78e6('0x27')]]={'$like':'%'+_0x588611[_0x78e6('0x31')][_0x78e6('0x3e')]+'%'};return _0x3364c0;}})});}_0x4dc09e=_[_0x78e6('0x3f')]({},_0x4dc09e,_0x588611[_0x78e6('0x41')]);var _0x227f12={'where':_0x4dc09e['where']};return db[_0x78e6('0x2b')]['count'](_0x227f12)[_0x78e6('0x20')](function(_0x21d927){_0xd31488[_0x78e6('0x18')]=_0x21d927;if(_0x588611['query'][_0x78e6('0x42')]){_0x4dc09e[_0x78e6('0x43')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x78e6('0x44')](_0x4dc09e);})[_0x78e6('0x20')](function(_0x3570c9){_0xd31488[_0x78e6('0x45')]=_0x3570c9;return _0xd31488;})['then'](respondWithFilteredResult(_0x3fbbee,_0x4dc09e))[_0x78e6('0x46')](handleError(_0x3fbbee,null));};exports[_0x78e6('0x47')]=function(_0x4ee1ee,_0x5a5544){var _0x55f2ed={'raw':!![],'where':{'id':_0x4ee1ee['params']['id']}},_0x3b92e0={};_0x3b92e0[_0x78e6('0x30')]=_[_0x78e6('0x32')](db[_0x78e6('0x2b')][_0x78e6('0x2c')]);_0x3b92e0[_0x78e6('0x31')]=_[_0x78e6('0x32')](_0x4ee1ee[_0x78e6('0x31')]);_0x3b92e0[_0x78e6('0x33')]=_['intersection'](_0x3b92e0[_0x78e6('0x30')],_0x3b92e0[_0x78e6('0x31')]);_0x55f2ed[_0x78e6('0x35')]=_[_0x78e6('0x34')](_0x3b92e0[_0x78e6('0x30')],qs[_0x78e6('0x36')](_0x4ee1ee['query'][_0x78e6('0x36')]));_0x55f2ed[_0x78e6('0x35')]=_0x55f2ed['attributes'][_0x78e6('0x37')]?_0x55f2ed['attributes']:_0x3b92e0['model'];if(_0x4ee1ee[_0x78e6('0x31')][_0x78e6('0x42')]){_0x55f2ed[_0x78e6('0x43')]=[{'all':!![]}];}_0x55f2ed=_[_0x78e6('0x3f')]({},_0x55f2ed,_0x4ee1ee['options']);return db[_0x78e6('0x2b')][_0x78e6('0x48')](_0x55f2ed)[_0x78e6('0x20')](handleEntityNotFound(_0x5a5544,null))[_0x78e6('0x20')](respondWithResult(_0x5a5544,null))[_0x78e6('0x46')](handleError(_0x5a5544,null));};exports[_0x78e6('0x49')]=function(_0x1271d7,_0x3228a3){return db[_0x78e6('0x2b')][_0x78e6('0x49')](_0x1271d7[_0x78e6('0x4a')],{})[_0x78e6('0x20')](function(_0x2f4364){var _0x10fdcf=_0x1271d7[_0x78e6('0x4b')][_0x78e6('0x4c')]({'plain':!![]});if(!_0x10fdcf)throw new Error(_0x78e6('0x4d'));if(_0x10fdcf['role']===_0x78e6('0x4b')){var _0x21c6ab=_0x2f4364[_0x78e6('0x4c')]({'plain':!![]});var _0x25f024=_0x78e6('0x21');return db[_0x78e6('0x4e')][_0x78e6('0x48')]({'where':{'name':_0x25f024,'userProfileId':_0x10fdcf[_0x78e6('0x4f')]},'raw':!![]})[_0x78e6('0x20')](function(_0x30fbcf){if(_0x30fbcf&&_0x30fbcf[_0x78e6('0x50')]===0x0){return db[_0x78e6('0x22')][_0x78e6('0x49')]({'name':_0x21c6ab[_0x78e6('0x27')],'resourceId':_0x21c6ab['id'],'type':_0x30fbcf[_0x78e6('0x27')],'sectionId':_0x30fbcf['id']},{})['then'](function(){return _0x2f4364;});}else{return _0x2f4364;}})[_0x78e6('0x46')](function(_0x8f4905){logger[_0x78e6('0x25')](_0x78e6('0x51'),_0x8f4905);throw _0x8f4905;});}return _0x2f4364;})[_0x78e6('0x20')](respondWithResult(_0x3228a3,0xc9))[_0x78e6('0x46')](handleError(_0x3228a3,null));};exports[_0x78e6('0x1f')]=function(_0x5a3967,_0x2d5033){if(_0x5a3967['body']['id']){delete _0x5a3967[_0x78e6('0x4a')]['id'];}return db[_0x78e6('0x2b')]['find']({'where':{'id':_0x5a3967[_0x78e6('0x52')]['id']}})[_0x78e6('0x20')](handleEntityNotFound(_0x2d5033,null))['then'](saveUpdates(_0x5a3967['body'],null))[_0x78e6('0x20')](respondWithResult(_0x2d5033,null))['catch'](handleError(_0x2d5033,null));};exports[_0x78e6('0x23')]=function(_0xfda13a,_0x53138e){return db[_0x78e6('0x2b')]['find']({'where':{'id':_0xfda13a['params']['id']}})[_0x78e6('0x20')](handleEntityNotFound(_0x53138e,null))[_0x78e6('0x20')](removeEntity(_0x53138e,null))[_0x78e6('0x46')](handleError(_0x53138e,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 869ee67..b968bd0 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 _0xceeb=['CmContactHasItem','cm_contact_has_items','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define'];(function(_0x47df8e,_0x43f857){var _0x392f57=function(_0x4b5992){while(--_0x4b5992){_0x47df8e['push'](_0x47df8e['shift']());}};_0x392f57(++_0x43f857);}(_0xceeb,0x147));var _0xbcee=function(_0x19d745,_0x234005){_0x19d745=_0x19d745-0x0;var _0x388814=_0xceeb[_0x19d745];return _0x388814;};'use strict';var _=require('lodash');var util=require(_0xbcee('0x0'));var logger=require('../../config/logger')(_0xbcee('0x1'));var moment=require(_0xbcee('0x2'));var BPromise=require(_0xbcee('0x3'));var rp=require(_0xbcee('0x4'));var fs=require('fs');var path=require(_0xbcee('0x5'));var rimraf=require(_0xbcee('0x6'));var config=require(_0xbcee('0x7'));var attributes=require(_0xbcee('0x8'));module[_0xbcee('0x9')]=function(_0x561b29,_0x377ed3){return _0x561b29[_0xbcee('0xa')](_0xbcee('0xb'),attributes,{'tableName':_0xbcee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38e9=['rimraf','./cmContactHasItem.attributes','exports','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x120fb7,_0x53a996){var _0x4fecc2=function(_0x5a513f){while(--_0x5a513f){_0x120fb7['push'](_0x120fb7['shift']());}};_0x4fecc2(++_0x53a996);}(_0x38e9,0x67));var _0x938e=function(_0x20cf10,_0x465f55){_0x20cf10=_0x20cf10-0x0;var _0x53fe52=_0x38e9[_0x20cf10];return _0x53fe52;};'use strict';var _=require(_0x938e('0x0'));var util=require(_0x938e('0x1'));var logger=require(_0x938e('0x2'))(_0x938e('0x3'));var moment=require(_0x938e('0x4'));var BPromise=require(_0x938e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x938e('0x6'));var rimraf=require(_0x938e('0x7'));var config=require('../../config/environment');var attributes=require(_0x938e('0x8'));module[_0x938e('0x9')]=function(_0x542541,_0x15b88b){return _0x542541['define']('CmContactHasItem',attributes,{'tableName':_0x938e('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 2b3a1ba..27425c5 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 _0x65f9=['CmContactHasItem,\x20%s,\x20%s,\x20%s','error','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x48ca40,_0x5d1655){var _0x38b379=function(_0x32cfff){while(--_0x32cfff){_0x48ca40['push'](_0x48ca40['shift']());}};_0x38b379(++_0x5d1655);}(_0x65f9,0x1d3));var _0x965f=function(_0x1b2aac,_0x23fe7a){_0x1b2aac=_0x1b2aac-0x0;var _0x33aec2=_0x65f9[_0x1b2aac];return _0x33aec2;};'use strict';var _=require(_0x965f('0x0'));var util=require(_0x965f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x965f('0x2'));var fs=require('fs');var Redis=require(_0x965f('0x3'));var db=require(_0x965f('0x4'))['db'];var utils=require(_0x965f('0x5'));var logger=require(_0x965f('0x6'))(_0x965f('0x7'));var config=require(_0x965f('0x8'));var jayson=require(_0x965f('0x9'));var client=jayson[_0x965f('0xa')][_0x965f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401dba,_0x455617,_0x3fa2fd){return new BPromise(function(_0x3a6552,_0x3465a2){return client[_0x965f('0xc')](_0x401dba,_0x3fa2fd)[_0x965f('0xd')](function(_0x4a1119){logger[_0x965f('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x455617,_0x965f('0xf'));logger[_0x965f('0x10')](_0x965f('0x11'),_0x455617,_0x965f('0xf'),JSON['stringify'](_0x4a1119));if(_0x4a1119[_0x965f('0x12')]){if(_0x4a1119[_0x965f('0x12')]['code']===0x1f4){logger[_0x965f('0x12')](_0x965f('0x13'),_0x455617,_0x4a1119[_0x965f('0x12')][_0x965f('0x14')]);return _0x3465a2(_0x4a1119['error'][_0x965f('0x14')]);}logger[_0x965f('0x12')](_0x965f('0x13'),_0x455617,_0x4a1119['error'][_0x965f('0x14')]);return _0x3a6552(_0x4a1119[_0x965f('0x12')][_0x965f('0x14')]);}else{logger[_0x965f('0xe')](_0x965f('0x13'),_0x455617,'request\x20sent');_0x3a6552(_0x4a1119[_0x965f('0x15')][_0x965f('0x14')]);}})['catch'](function(_0x180df7){logger[_0x965f('0x12')](_0x965f('0x13'),_0x455617,_0x180df7);_0x3465a2(_0x180df7);});});} \ No newline at end of file +var _0xd86a=['http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x460321,_0x5bc325){var _0x4a7888=function(_0x4fa503){while(--_0x4fa503){_0x460321['push'](_0x460321['shift']());}};_0x4a7888(++_0x5bc325);}(_0xd86a,0xe6));var _0xad86=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xd86a[_0x5a26f5];return _0x2e9ef7;};'use strict';var _=require(_0xad86('0x0'));var util=require(_0xad86('0x1'));var moment=require(_0xad86('0x2'));var BPromise=require(_0xad86('0x3'));var rs=require(_0xad86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad86('0x5'))['db'];var utils=require(_0xad86('0x6'));var logger=require('../../config/logger')(_0xad86('0x7'));var config=require(_0xad86('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xad86('0x9')][_0xad86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b761d,_0x1eca6f,_0x5adaff){return new BPromise(function(_0xa7b0d0,_0x3401a3){return client['request'](_0x3b761d,_0x5adaff)[_0xad86('0xb')](function(_0x5c0e39){logger['info'](_0xad86('0xc'),_0x1eca6f,_0xad86('0xd'));logger[_0xad86('0xe')](_0xad86('0xf'),_0x1eca6f,_0xad86('0xd'),JSON['stringify'](_0x5c0e39));if(_0x5c0e39[_0xad86('0x10')]){if(_0x5c0e39[_0xad86('0x10')]['code']===0x1f4){logger['error'](_0xad86('0xc'),_0x1eca6f,_0x5c0e39['error'][_0xad86('0x11')]);return _0x3401a3(_0x5c0e39[_0xad86('0x10')][_0xad86('0x11')]);}logger['error'](_0xad86('0xc'),_0x1eca6f,_0x5c0e39[_0xad86('0x10')][_0xad86('0x11')]);return _0xa7b0d0(_0x5c0e39[_0xad86('0x10')]['message']);}else{logger[_0xad86('0x12')](_0xad86('0xc'),_0x1eca6f,_0xad86('0xd'));_0xa7b0d0(_0x5c0e39[_0xad86('0x13')][_0xad86('0x11')]);}})['catch'](function(_0x126a6d){logger[_0xad86('0x10')](_0xad86('0xc'),_0x1eca6f,_0x126a6d);_0x3401a3(_0x126a6d);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 47b818e..f92705f 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 _0x1903=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmContactHasItem.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x241164,_0x336838){var _0x297e72=function(_0x29bea7){while(--_0x29bea7){_0x241164['push'](_0x241164['shift']());}};_0x297e72(++_0x336838);}(_0x1903,0x7a));var _0x3190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1903[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3190('0x0'));var path=require(_0x3190('0x1'));var timeout=require(_0x3190('0x2'));var express=require(_0x3190('0x3'));var router=express[_0x3190('0x4')]();var fs_extra=require(_0x3190('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3190('0x6'));var controller=require(_0x3190('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3190('0x8')]);router[_0x3190('0x9')](_0x3190('0xa'),auth['isAuthenticated'](),controller[_0x3190('0xb')]);router[_0x3190('0xc')]('/',auth[_0x3190('0xd')](),controller[_0x3190('0xe')]);router[_0x3190('0xf')](_0x3190('0xa'),auth[_0x3190('0xd')](),controller[_0x3190('0x10')]);router[_0x3190('0x11')]('/:id',auth[_0x3190('0xd')](),controller[_0x3190('0x12')]);module[_0x3190('0x13')]=router; \ No newline at end of file +var _0xd4e7=['get','isAuthenticated','index','/:id','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmContactHasItem.controller'];(function(_0x316103,_0x1fa2d4){var _0xafd404=function(_0x3e46cf){while(--_0x3e46cf){_0x316103['push'](_0x316103['shift']());}};_0xafd404(++_0x1fa2d4);}(_0xd4e7,0x1ab));var _0x7d4e=function(_0x4e6ead,_0x22a426){_0x4e6ead=_0x4e6ead-0x0;var _0x5015a7=_0xd4e7[_0x4e6ead];return _0x5015a7;};'use strict';var multer=require('multer');var util=require(_0x7d4e('0x0'));var path=require('path');var timeout=require(_0x7d4e('0x1'));var express=require(_0x7d4e('0x2'));var router=express[_0x7d4e('0x3')]();var fs_extra=require(_0x7d4e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7d4e('0x5'));var config=require('../../config/environment');var controller=require(_0x7d4e('0x6'));router[_0x7d4e('0x7')]('/',auth[_0x7d4e('0x8')](),controller[_0x7d4e('0x9')]);router[_0x7d4e('0x7')](_0x7d4e('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7d4e('0x8')](),controller['create']);router['put'](_0x7d4e('0xa'),auth[_0x7d4e('0x8')](),controller[_0x7d4e('0xb')]);router[_0x7d4e('0xc')](_0x7d4e('0xa'),auth[_0x7d4e('0x8')](),controller[_0x7d4e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index cbdbc6a..ca959c3 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 _0x5bf5=['BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','type','parse','values','isArray','stringify'];(function(_0x596649,_0x4773b1){var _0x26f5d8=function(_0x203e3e){while(--_0x203e3e){_0x596649['push'](_0x596649['shift']());}};_0x26f5d8(++_0x4773b1);}(_0x5bf5,0x1ab));var _0x55bf=function(_0x42eb44,_0x5b5a9a){_0x42eb44=_0x42eb44-0x0;var _0x4f6b13=_0x5bf5[_0x42eb44];return _0x4f6b13;};'use strict';var Sequelize=require(_0x55bf('0x0'));var _=require(_0x55bf('0x1'));module[_0x55bf('0x2')]={'name':{'type':Sequelize[_0x55bf('0x3')],'get':function(_0x1dc39d){return this[_0x55bf('0x4')](_0x55bf('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xb90fb0){this[_0x55bf('0x6')](_0x55bf('0x5'),_0xb90fb0?_0xb90fb0:this['getDataValue'](_0x55bf('0x7')));}},'type':{'type':Sequelize[_0x55bf('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x55bf('0x9')]('long'),'get':function(){if(this[_0x55bf('0x4')](_0x55bf('0xa'))==='select'){return JSON[_0x55bf('0xb')](this[_0x55bf('0x4')](_0x55bf('0xc')));}else{return this[_0x55bf('0x4')](_0x55bf('0xc'));}},'set':function(_0x57edf8){if(Array[_0x55bf('0xd')](_0x57edf8)){this['setDataValue'](_0x55bf('0xc'),JSON[_0x55bf('0xe')](_0x57edf8));}else{this[_0x55bf('0x6')](_0x55bf('0xc'),_0x57edf8);}}},'required':{'type':Sequelize[_0x55bf('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x55bf('0x10'))}}; \ No newline at end of file +var _0x3390=['name','STRING','TEXT','long','type','select','values','isArray','setDataValue','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3390,0x108));var _0x0339=function(_0x37ea79,_0x489e57){_0x37ea79=_0x37ea79-0x0;var _0x220eb3=_0x3390[_0x37ea79];return _0x220eb3;};'use strict';var Sequelize=require(_0x0339('0x0'));var _=require(_0x0339('0x1'));module[_0x0339('0x2')]={'name':{'type':Sequelize[_0x0339('0x3')],'get':function(_0x2771e3){return this[_0x0339('0x4')](_0x0339('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x15353f){this['setDataValue']('alias',_0x15353f?_0x15353f:this['getDataValue'](_0x0339('0x6')));}},'type':{'type':Sequelize[_0x0339('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x0339('0x8')](_0x0339('0x9')),'get':function(){if(this['getDataValue'](_0x0339('0xa'))===_0x0339('0xb')){return JSON['parse'](this['getDataValue'](_0x0339('0xc')));}else{return this['getDataValue'](_0x0339('0xc'));}},'set':function(_0x3520d7){if(Array[_0x0339('0xd')](_0x3520d7)){this[_0x0339('0xe')]('values',JSON[_0x0339('0xf')](_0x3520d7));}else{this[_0x0339('0xe')](_0x0339('0xc'),_0x3520d7);}}},'required':{'type':Sequelize[_0x0339('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0339('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x0339('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6d17e07..99b5690 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 _0xb6ce=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','CmCustomField','findAll','rows','catch','options','body','find','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','query','keys','intersection','model','fields','attributes'];(function(_0x232795,_0x299c0b){var _0xe03ba2=function(_0x42b7db){while(--_0x42b7db){_0x232795['push'](_0x232795['shift']());}};_0xe03ba2(++_0x299c0b);}(_0xb6ce,0x130));var _0xeb6c=function(_0x7ac34d,_0x44f85b){_0x7ac34d=_0x7ac34d-0x0;var _0x440b94=_0xb6ce[_0x7ac34d];return _0x440b94;};'use strict';var emlformat=require(_0xeb6c('0x0'));var rimraf=require(_0xeb6c('0x1'));var zipdir=require(_0xeb6c('0x2'));var jsonpatch=require(_0xeb6c('0x3'));var rp=require('request-promise');var moment=require(_0xeb6c('0x4'));var BPromise=require(_0xeb6c('0x5'));var Mustache=require('mustache');var util=require(_0xeb6c('0x6'));var path=require(_0xeb6c('0x7'));var sox=require(_0xeb6c('0x8'));var csv=require(_0xeb6c('0x9'));var ejs=require(_0xeb6c('0xa'));var fs=require('fs');var fs_extra=require(_0xeb6c('0xb'));var _=require(_0xeb6c('0xc'));var squel=require('squel');var crypto=require(_0xeb6c('0xd'));var jsforce=require(_0xeb6c('0xe'));var deskjs=require(_0xeb6c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb6c('0x10'));var Papa=require(_0xeb6c('0x11'));var Redis=require(_0xeb6c('0x12'));var authService=require(_0xeb6c('0x13'));var qs=require(_0xeb6c('0x14'));var as=require(_0xeb6c('0x15'));var hardwareService=require(_0xeb6c('0x16'));var logger=require(_0xeb6c('0x17'))('api');var utils=require(_0xeb6c('0x18'));var config=require(_0xeb6c('0x19'));var licenseUtil=require(_0xeb6c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x369ccf,_0x4fc0f7){_0x4fc0f7=_0x4fc0f7||0xcc;return function(_0x77046){if(_0x77046){return _0x369ccf[_0xeb6c('0x1b')](_0x4fc0f7);}return _0x369ccf['status'](_0x4fc0f7)[_0xeb6c('0x1c')]();};}function respondWithResult(_0x573af1,_0xfdd00e){_0xfdd00e=_0xfdd00e||0xc8;return function(_0x441761){if(_0x441761){return _0x573af1[_0xeb6c('0x1d')](_0xfdd00e)[_0xeb6c('0x1e')](_0x441761);}};}function respondWithFilteredResult(_0x4f1270,_0x227b1f){return function(_0xd7a88d){if(_0xd7a88d){var _0x2a44a3=typeof _0x227b1f[_0xeb6c('0x1f')]==='undefined'&&typeof _0x227b1f[_0xeb6c('0x20')]===_0xeb6c('0x21');var _0x2e973c=_0xd7a88d[_0xeb6c('0x22')];var _0x1e1ef8=_0x2a44a3?0x0:_0x227b1f[_0xeb6c('0x1f')];var _0x1f6ea8=_0x2a44a3?_0xd7a88d[_0xeb6c('0x22')]:_0x227b1f[_0xeb6c('0x1f')]+_0x227b1f['limit'];var _0x1d690a;if(_0x1f6ea8>=_0x2e973c){_0x1f6ea8=_0x2e973c;_0x1d690a=0xc8;}else{_0x1d690a=0xce;}_0x4f1270[_0xeb6c('0x1d')](_0x1d690a);return _0x4f1270[_0xeb6c('0x23')](_0xeb6c('0x24'),_0x1e1ef8+'-'+_0x1f6ea8+'/'+_0x2e973c)[_0xeb6c('0x1e')](_0xd7a88d);}return null;};}function patchUpdates(_0x35ee05){return function(_0x56bd0d){try{jsonpatch[_0xeb6c('0x25')](_0x56bd0d,_0x35ee05,!![]);}catch(_0x44140f){return BPromise[_0xeb6c('0x26')](_0x44140f);}return _0x56bd0d['save']();};}function saveUpdates(_0x4bbe08,_0x946b13){return function(_0x29cf4c){if(_0x29cf4c){return _0x29cf4c[_0xeb6c('0x27')](_0x4bbe08)[_0xeb6c('0x28')](function(_0x4572d0){return _0x4572d0;});}return null;};}function removeEntity(_0x294b1d,_0x5db40d){return function(_0xe4e8b0){if(_0xe4e8b0){return _0xe4e8b0[_0xeb6c('0x29')]()[_0xeb6c('0x28')](function(){_0x294b1d[_0xeb6c('0x1d')](0xcc)[_0xeb6c('0x1c')]();});}};}function handleEntityNotFound(_0x775d91,_0x1e7e89){return function(_0x7ba3e){if(!_0x7ba3e){_0x775d91['sendStatus'](0x194);}return _0x7ba3e;};}function handleError(_0xb3b686,_0x27d0e7){_0x27d0e7=_0x27d0e7||0x1f4;return function(_0x5588ca){logger[_0xeb6c('0x2a')](_0x5588ca['stack']);if(_0x5588ca[_0xeb6c('0x2b')]){delete _0x5588ca['name'];}_0xb3b686[_0xeb6c('0x1d')](_0x27d0e7)[_0xeb6c('0x2c')](_0x5588ca);};}exports[_0xeb6c('0x2d')]=function(_0x3946b0,_0x1e4cc5){var _0x289d9c={},_0x3deced={},_0x96cdf7={'count':0x0,'rows':[]};var _0x4ca32f=_[_0xeb6c('0x2e')](db['CmCustomField'][_0xeb6c('0x2f')],function(_0x170922){return{'name':_0x170922['fieldName'],'type':_0x170922[_0xeb6c('0x30')][_0xeb6c('0x31')]};});_0x3deced['model']=_['differenceBy'](_[_0xeb6c('0x2e')](_0x4ca32f,_0xeb6c('0x2b')),['name']);_0x3deced[_0xeb6c('0x32')]=_[_0xeb6c('0x33')](_0x3946b0[_0xeb6c('0x32')]);_0x3deced['filters']=_[_0xeb6c('0x34')](_0x3deced[_0xeb6c('0x35')],_0x3deced[_0xeb6c('0x32')]);_0x289d9c['attributes']=_[_0xeb6c('0x34')](_0x3deced[_0xeb6c('0x35')],qs['fields'](_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x36')]));_0x289d9c[_0xeb6c('0x37')]=_0x289d9c['attributes']['length']?_0x289d9c[_0xeb6c('0x37')]:_0x3deced[_0xeb6c('0x35')];if(!_0x3946b0['query'][_0xeb6c('0x38')](_0xeb6c('0x39'))){_0x289d9c['limit']=qs[_0xeb6c('0x20')](_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x20')]);_0x289d9c[_0xeb6c('0x1f')]=qs[_0xeb6c('0x1f')](_0x3946b0['query'][_0xeb6c('0x1f')]);}_0x289d9c[_0xeb6c('0x3a')]=qs[_0xeb6c('0x3b')](_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x3b')]);_0x289d9c[_0xeb6c('0x3c')]=qs[_0xeb6c('0x3d')](_[_0xeb6c('0x3e')](_0x3946b0[_0xeb6c('0x32')],_0x3deced['filters']),_0x4ca32f);if(_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x3f')]){_0x289d9c[_0xeb6c('0x3c')]=_[_0xeb6c('0x40')](_0x289d9c[_0xeb6c('0x3c')],{'$or':_[_0xeb6c('0x2e')](_0x4ca32f,function(_0x4f9193){if(_0x4f9193[_0xeb6c('0x30')]!=='VIRTUAL'){var _0x5300a8={};_0x5300a8[_0x4f9193[_0xeb6c('0x2b')]]={'$like':'%'+_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x3f')]+'%'};return _0x5300a8;}})});}_0x289d9c=_['merge']({},_0x289d9c,_0x3946b0['options']);var _0x1c0c27={'where':_0x289d9c[_0xeb6c('0x3c')]};return db['CmCustomField'][_0xeb6c('0x22')](_0x1c0c27)[_0xeb6c('0x28')](function(_0x536894){_0x96cdf7[_0xeb6c('0x22')]=_0x536894;if(_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x41')]){_0x289d9c[_0xeb6c('0x42')]=[{'all':!![]}];}return db[_0xeb6c('0x43')][_0xeb6c('0x44')](_0x289d9c);})['then'](function(_0x24f4cd){_0x96cdf7[_0xeb6c('0x45')]=_0x24f4cd;return _0x96cdf7;})[_0xeb6c('0x28')](respondWithFilteredResult(_0x1e4cc5,_0x289d9c))[_0xeb6c('0x46')](handleError(_0x1e4cc5,null));};exports['show']=function(_0xd3009f,_0x4cdfca){var _0xdeaa27={'raw':!![],'where':{'id':_0xd3009f['params']['id']}},_0x4207eb={};_0x4207eb[_0xeb6c('0x35')]=_[_0xeb6c('0x33')](db[_0xeb6c('0x43')][_0xeb6c('0x2f')]);_0x4207eb[_0xeb6c('0x32')]=_[_0xeb6c('0x33')](_0xd3009f[_0xeb6c('0x32')]);_0x4207eb['filters']=_['intersection'](_0x4207eb[_0xeb6c('0x35')],_0x4207eb['query']);_0xdeaa27[_0xeb6c('0x37')]=_[_0xeb6c('0x34')](_0x4207eb[_0xeb6c('0x35')],qs['fields'](_0xd3009f[_0xeb6c('0x32')]['fields']));_0xdeaa27['attributes']=_0xdeaa27[_0xeb6c('0x37')]['length']?_0xdeaa27[_0xeb6c('0x37')]:_0x4207eb['model'];if(_0xd3009f['query'][_0xeb6c('0x41')]){_0xdeaa27['include']=[{'all':!![]}];}_0xdeaa27=_[_0xeb6c('0x40')]({},_0xdeaa27,_0xd3009f[_0xeb6c('0x47')]);return db[_0xeb6c('0x43')]['find'](_0xdeaa27)[_0xeb6c('0x28')](handleEntityNotFound(_0x4cdfca,null))['then'](respondWithResult(_0x4cdfca,null))[_0xeb6c('0x46')](handleError(_0x4cdfca,null));};exports['update']=function(_0x1e268c,_0x114e6c){if(_0x1e268c[_0xeb6c('0x48')]['id']){delete _0x1e268c[_0xeb6c('0x48')]['id'];}return db[_0xeb6c('0x43')][_0xeb6c('0x49')]({'where':{'id':_0x1e268c['params']['id']}})[_0xeb6c('0x28')](handleEntityNotFound(_0x114e6c,null))[_0xeb6c('0x28')](saveUpdates(_0x1e268c['body'],null))['then'](respondWithResult(_0x114e6c,null))[_0xeb6c('0x46')](handleError(_0x114e6c,null));};exports[_0xeb6c('0x29')]=function(_0x2dc5d5,_0x5c783a){return db[_0xeb6c('0x43')][_0xeb6c('0x49')]({'where':{'id':_0x2dc5d5[_0xeb6c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c783a,null))['then'](removeEntity(_0x5c783a,null))['catch'](handleError(_0x5c783a,null));};exports[_0xeb6c('0x4b')]=function(_0x4171c8,_0x4aff02){var _0x1a9331;return db[_0xeb6c('0x4c')][_0xeb6c('0x4d')](function(_0x8412c7){return db[_0xeb6c('0x43')]['create'](_0x4171c8[_0xeb6c('0x48')],{'transaction':_0x8412c7})[_0xeb6c('0x28')](function(_0x3440f1){_0x1a9331=_0x3440f1;var _0x6cacee={'type':db[_0xeb6c('0x4e')][_0xeb6c('0x4f')],'transaction':_0x8412c7};switch(_0x4171c8[_0xeb6c('0x48')][_0xeb6c('0x30')]){case _0xeb6c('0x50'):_0x6cacee['type']=db[_0xeb6c('0x4e')][_0xeb6c('0x4f')];break;case _0xeb6c('0x51'):_0x6cacee[_0xeb6c('0x30')]=db[_0xeb6c('0x4e')][_0xeb6c('0x52')];break;case _0xeb6c('0x53'):_0x6cacee[_0xeb6c('0x30')]=db[_0xeb6c('0x4e')]['BOOLEAN'];_0x6cacee[_0xeb6c('0x54')]=![];break;default:}return db[_0xeb6c('0x4c')][_0xeb6c('0x55')][_0xeb6c('0x56')](_0xeb6c('0x57'),util[_0xeb6c('0x58')](_0xeb6c('0x59'),_0x1a9331['id']),_0x6cacee);})['then'](function(){return _0x1a9331;});})['then'](respondWithResult(_0x4aff02,0xc9))['catch'](handleError(_0x4aff02,null));}; \ No newline at end of file +var _0x6f25=['body','create','sequelize','transaction','TEXT','switch','Sequelize','BOOLEAN','cm_contacts','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','map','rawAttributes','fieldName','type','key','model','differenceBy','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','CmCustomField','catch','params','keys','find'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x6f25,0x199));var _0x56f2=function(_0x3f3a3a,_0x5e4af1){_0x3f3a3a=_0x3f3a3a-0x0;var _0x1eea67=_0x6f25[_0x3f3a3a];return _0x1eea67;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x56f2('0x0'));var jsonpatch=require(_0x56f2('0x1'));var rp=require(_0x56f2('0x2'));var moment=require(_0x56f2('0x3'));var BPromise=require(_0x56f2('0x4'));var Mustache=require('mustache');var util=require(_0x56f2('0x5'));var path=require(_0x56f2('0x6'));var sox=require('sox');var csv=require(_0x56f2('0x7'));var ejs=require(_0x56f2('0x8'));var fs=require('fs');var fs_extra=require(_0x56f2('0x9'));var _=require(_0x56f2('0xa'));var squel=require(_0x56f2('0xb'));var crypto=require(_0x56f2('0xc'));var jsforce=require(_0x56f2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x56f2('0x7'));var querystring=require(_0x56f2('0xe'));var Papa=require(_0x56f2('0xf'));var Redis=require('ioredis');var authService=require(_0x56f2('0x10'));var qs=require(_0x56f2('0x11'));var as=require(_0x56f2('0x12'));var hardwareService=require(_0x56f2('0x13'));var logger=require(_0x56f2('0x14'))(_0x56f2('0x15'));var utils=require(_0x56f2('0x16'));var config=require(_0x56f2('0x17'));var licenseUtil=require(_0x56f2('0x18'));var db=require(_0x56f2('0x19'))['db'];function respondWithStatusCode(_0x56d894,_0x188687){_0x188687=_0x188687||0xcc;return function(_0x100617){if(_0x100617){return _0x56d894[_0x56f2('0x1a')](_0x188687);}return _0x56d894['status'](_0x188687)[_0x56f2('0x1b')]();};}function respondWithResult(_0x3d8afe,_0x16e5e8){_0x16e5e8=_0x16e5e8||0xc8;return function(_0x11072f){if(_0x11072f){return _0x3d8afe[_0x56f2('0x1c')](_0x16e5e8)[_0x56f2('0x1d')](_0x11072f);}};}function respondWithFilteredResult(_0x4261e3,_0x251098){return function(_0xed0aed){if(_0xed0aed){var _0x4aab05=typeof _0x251098[_0x56f2('0x1e')]===_0x56f2('0x1f')&&typeof _0x251098[_0x56f2('0x20')]===_0x56f2('0x1f');var _0xbb9acf=_0xed0aed[_0x56f2('0x21')];var _0x562877=_0x4aab05?0x0:_0x251098[_0x56f2('0x1e')];var _0x32ac25=_0x4aab05?_0xed0aed[_0x56f2('0x21')]:_0x251098[_0x56f2('0x1e')]+_0x251098[_0x56f2('0x20')];var _0x4fd4e9;if(_0x32ac25>=_0xbb9acf){_0x32ac25=_0xbb9acf;_0x4fd4e9=0xc8;}else{_0x4fd4e9=0xce;}_0x4261e3['status'](_0x4fd4e9);return _0x4261e3[_0x56f2('0x22')]('Content-Range',_0x562877+'-'+_0x32ac25+'/'+_0xbb9acf)[_0x56f2('0x1d')](_0xed0aed);}return null;};}function patchUpdates(_0x42bf36){return function(_0x2a10f9){try{jsonpatch[_0x56f2('0x23')](_0x2a10f9,_0x42bf36,!![]);}catch(_0x5103bb){return BPromise[_0x56f2('0x24')](_0x5103bb);}return _0x2a10f9[_0x56f2('0x25')]();};}function saveUpdates(_0x46532d,_0xde0d18){return function(_0x22599c){if(_0x22599c){return _0x22599c[_0x56f2('0x26')](_0x46532d)[_0x56f2('0x27')](function(_0x3a7962){return _0x3a7962;});}return null;};}function removeEntity(_0x5f3dc3,_0x5dd6f7){return function(_0x1713e2){if(_0x1713e2){return _0x1713e2[_0x56f2('0x28')]()[_0x56f2('0x27')](function(){_0x5f3dc3[_0x56f2('0x1c')](0xcc)[_0x56f2('0x1b')]();});}};}function handleEntityNotFound(_0x4ef047,_0x553d25){return function(_0x28fc5c){if(!_0x28fc5c){_0x4ef047['sendStatus'](0x194);}return _0x28fc5c;};}function handleError(_0x1eefc0,_0x37ba29){_0x37ba29=_0x37ba29||0x1f4;return function(_0xc2cbf9){logger[_0x56f2('0x29')](_0xc2cbf9['stack']);if(_0xc2cbf9['name']){delete _0xc2cbf9['name'];}_0x1eefc0[_0x56f2('0x1c')](_0x37ba29)['send'](_0xc2cbf9);};}exports['index']=function(_0x511fc2,_0x183993){var _0x999abd={},_0x4f2d9f={},_0x860543={'count':0x0,'rows':[]};var _0x367a4f=_[_0x56f2('0x2a')](db['CmCustomField'][_0x56f2('0x2b')],function(_0x2e827d){return{'name':_0x2e827d[_0x56f2('0x2c')],'type':_0x2e827d[_0x56f2('0x2d')][_0x56f2('0x2e')]};});_0x4f2d9f[_0x56f2('0x2f')]=_[_0x56f2('0x30')](_[_0x56f2('0x2a')](_0x367a4f,'name'),[_0x56f2('0x31')]);_0x4f2d9f['query']=_['keys'](_0x511fc2[_0x56f2('0x32')]);_0x4f2d9f[_0x56f2('0x33')]=_[_0x56f2('0x34')](_0x4f2d9f[_0x56f2('0x2f')],_0x4f2d9f[_0x56f2('0x32')]);_0x999abd['attributes']=_[_0x56f2('0x34')](_0x4f2d9f[_0x56f2('0x2f')],qs[_0x56f2('0x35')](_0x511fc2[_0x56f2('0x32')][_0x56f2('0x35')]));_0x999abd[_0x56f2('0x36')]=_0x999abd[_0x56f2('0x36')][_0x56f2('0x37')]?_0x999abd['attributes']:_0x4f2d9f[_0x56f2('0x2f')];if(!_0x511fc2['query'][_0x56f2('0x38')](_0x56f2('0x39'))){_0x999abd[_0x56f2('0x20')]=qs[_0x56f2('0x20')](_0x511fc2[_0x56f2('0x32')][_0x56f2('0x20')]);_0x999abd[_0x56f2('0x1e')]=qs[_0x56f2('0x1e')](_0x511fc2[_0x56f2('0x32')][_0x56f2('0x1e')]);}_0x999abd[_0x56f2('0x3a')]=qs['sort'](_0x511fc2[_0x56f2('0x32')]['sort']);_0x999abd[_0x56f2('0x3b')]=qs[_0x56f2('0x33')](_[_0x56f2('0x3c')](_0x511fc2[_0x56f2('0x32')],_0x4f2d9f[_0x56f2('0x33')]),_0x367a4f);if(_0x511fc2[_0x56f2('0x32')]['filter']){_0x999abd[_0x56f2('0x3b')]=_[_0x56f2('0x3d')](_0x999abd[_0x56f2('0x3b')],{'$or':_[_0x56f2('0x2a')](_0x367a4f,function(_0x487928){if(_0x487928['type']!==_0x56f2('0x3e')){var _0xf1c778={};_0xf1c778[_0x487928[_0x56f2('0x31')]]={'$like':'%'+_0x511fc2[_0x56f2('0x32')][_0x56f2('0x3f')]+'%'};return _0xf1c778;}})});}_0x999abd=_[_0x56f2('0x3d')]({},_0x999abd,_0x511fc2['options']);var _0x36f469={'where':_0x999abd[_0x56f2('0x3b')]};return db['CmCustomField'][_0x56f2('0x21')](_0x36f469)[_0x56f2('0x27')](function(_0x56d127){_0x860543['count']=_0x56d127;if(_0x511fc2[_0x56f2('0x32')][_0x56f2('0x40')]){_0x999abd[_0x56f2('0x41')]=[{'all':!![]}];}return db[_0x56f2('0x42')]['findAll'](_0x999abd);})[_0x56f2('0x27')](function(_0x3e60da){_0x860543['rows']=_0x3e60da;return _0x860543;})[_0x56f2('0x27')](respondWithFilteredResult(_0x183993,_0x999abd))[_0x56f2('0x43')](handleError(_0x183993,null));};exports['show']=function(_0x2511f6,_0x261a43){var _0x4cc61e={'raw':!![],'where':{'id':_0x2511f6[_0x56f2('0x44')]['id']}},_0x5d49a1={};_0x5d49a1['model']=_[_0x56f2('0x45')](db[_0x56f2('0x42')][_0x56f2('0x2b')]);_0x5d49a1['query']=_[_0x56f2('0x45')](_0x2511f6['query']);_0x5d49a1[_0x56f2('0x33')]=_[_0x56f2('0x34')](_0x5d49a1[_0x56f2('0x2f')],_0x5d49a1[_0x56f2('0x32')]);_0x4cc61e[_0x56f2('0x36')]=_[_0x56f2('0x34')](_0x5d49a1['model'],qs[_0x56f2('0x35')](_0x2511f6['query'][_0x56f2('0x35')]));_0x4cc61e[_0x56f2('0x36')]=_0x4cc61e[_0x56f2('0x36')][_0x56f2('0x37')]?_0x4cc61e[_0x56f2('0x36')]:_0x5d49a1['model'];if(_0x2511f6[_0x56f2('0x32')]['includeAll']){_0x4cc61e[_0x56f2('0x41')]=[{'all':!![]}];}_0x4cc61e=_[_0x56f2('0x3d')]({},_0x4cc61e,_0x2511f6['options']);return db[_0x56f2('0x42')][_0x56f2('0x46')](_0x4cc61e)[_0x56f2('0x27')](handleEntityNotFound(_0x261a43,null))[_0x56f2('0x27')](respondWithResult(_0x261a43,null))[_0x56f2('0x43')](handleError(_0x261a43,null));};exports[_0x56f2('0x26')]=function(_0x39c9d5,_0x36a39d){if(_0x39c9d5[_0x56f2('0x47')]['id']){delete _0x39c9d5['body']['id'];}return db[_0x56f2('0x42')]['find']({'where':{'id':_0x39c9d5[_0x56f2('0x44')]['id']}})[_0x56f2('0x27')](handleEntityNotFound(_0x36a39d,null))[_0x56f2('0x27')](saveUpdates(_0x39c9d5['body'],null))['then'](respondWithResult(_0x36a39d,null))[_0x56f2('0x43')](handleError(_0x36a39d,null));};exports[_0x56f2('0x28')]=function(_0x37adb5,_0x2c38d6){return db[_0x56f2('0x42')][_0x56f2('0x46')]({'where':{'id':_0x37adb5[_0x56f2('0x44')]['id']}})[_0x56f2('0x27')](handleEntityNotFound(_0x2c38d6,null))['then'](removeEntity(_0x2c38d6,null))['catch'](handleError(_0x2c38d6,null));};exports[_0x56f2('0x48')]=function(_0x2f217f,_0x496323){var _0x44d077;return db[_0x56f2('0x49')][_0x56f2('0x4a')](function(_0x5a7464){return db[_0x56f2('0x42')][_0x56f2('0x48')](_0x2f217f['body'],{'transaction':_0x5a7464})['then'](function(_0x524bac){_0x44d077=_0x524bac;var _0x56418c={'type':db['Sequelize'][_0x56f2('0x4b')],'transaction':_0x5a7464};switch(_0x2f217f[_0x56f2('0x47')][_0x56f2('0x2d')]){case'text':_0x56418c[_0x56f2('0x2d')]=db['Sequelize'][_0x56f2('0x4b')];break;case'number':_0x56418c[_0x56f2('0x2d')]=db['Sequelize']['INTEGER'];break;case _0x56f2('0x4c'):_0x56418c[_0x56f2('0x2d')]=db[_0x56f2('0x4d')][_0x56f2('0x4e')];_0x56418c['defaultValue']=![];break;default:}return db[_0x56f2('0x49')]['queryInterface']['addColumn'](_0x56f2('0x4f'),util['format']('cf_%d',_0x44d077['id']),_0x56418c);})[_0x56f2('0x27')](function(){return _0x44d077;});})[_0x56f2('0x27')](respondWithResult(_0x496323,0xc9))[_0x56f2('0x43')](handleError(_0x496323,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 2c4790b..5f43846 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 _0x8899=['lodash','util','moment','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields'];(function(_0x71a6e0,_0x19ff83){var _0x264938=function(_0x598f5a){while(--_0x598f5a){_0x71a6e0['push'](_0x71a6e0['shift']());}};_0x264938(++_0x19ff83);}(_0x8899,0x17c));var _0x9889=function(_0x5393c2,_0xa6bd55){_0x5393c2=_0x5393c2-0x0;var _0x7ca3aa=_0x8899[_0x5393c2];return _0x7ca3aa;};'use strict';var _=require(_0x9889('0x0'));var util=require(_0x9889('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9889('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9889('0x3'));var rimraf=require(_0x9889('0x4'));var config=require(_0x9889('0x5'));var attributes=require(_0x9889('0x6'));module[_0x9889('0x7')]=function(_0x4dd7e4,_0x35c843){return _0x4dd7e4[_0x9889('0x8')]('CmCustomField',attributes,{'tableName':_0x9889('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b42=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes','define','CmCustomField','lodash','util'];(function(_0x37de50,_0x27f82a){var _0x2c37dc=function(_0x325186){while(--_0x325186){_0x37de50['push'](_0x37de50['shift']());}};_0x2c37dc(++_0x27f82a);}(_0x1b42,0x6c));var _0x21b4=function(_0x54ea6d,_0xcb0c43){_0x54ea6d=_0x54ea6d-0x0;var _0x492640=_0x1b42[_0x54ea6d];return _0x492640;};'use strict';var _=require(_0x21b4('0x0'));var util=require(_0x21b4('0x1'));var logger=require(_0x21b4('0x2'))(_0x21b4('0x3'));var moment=require(_0x21b4('0x4'));var BPromise=require(_0x21b4('0x5'));var rp=require(_0x21b4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x21b4('0x7'));var attributes=require(_0x21b4('0x8'));module['exports']=function(_0x18bc06,_0x39d84f){return _0x18bc06[_0x21b4('0x9')](_0x21b4('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index cb7a097..5af56aa 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 _0xdcda=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x32e35e,_0x528101){var _0x4c9768=function(_0x222509){while(--_0x222509){_0x32e35e['push'](_0x32e35e['shift']());}};_0x4c9768(++_0x528101);}(_0xdcda,0x9d));var _0xadcd=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xdcda[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xadcd('0x0'));var util=require(_0xadcd('0x1'));var moment=require(_0xadcd('0x2'));var BPromise=require(_0xadcd('0x3'));var rs=require(_0xadcd('0x4'));var fs=require('fs');var Redis=require(_0xadcd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xadcd('0x6'));var logger=require(_0xadcd('0x7'))(_0xadcd('0x8'));var config=require(_0xadcd('0x9'));var jayson=require(_0xadcd('0xa'));var client=jayson[_0xadcd('0xb')][_0xadcd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x385d1c,_0x1cf941,_0x35f4a8){return new BPromise(function(_0x3dab85,_0x3faa6b){return client[_0xadcd('0xd')](_0x385d1c,_0x35f4a8)[_0xadcd('0xe')](function(_0x426d4a){logger[_0xadcd('0xf')](_0xadcd('0x10'),_0x1cf941,_0xadcd('0x11'));logger[_0xadcd('0x12')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1cf941,_0xadcd('0x11'),JSON[_0xadcd('0x13')](_0x426d4a));if(_0x426d4a['error']){if(_0x426d4a[_0xadcd('0x14')][_0xadcd('0x15')]===0x1f4){logger['error'](_0xadcd('0x10'),_0x1cf941,_0x426d4a[_0xadcd('0x14')][_0xadcd('0x16')]);return _0x3faa6b(_0x426d4a[_0xadcd('0x14')][_0xadcd('0x16')]);}logger[_0xadcd('0x14')]('CmCustomField,\x20%s,\x20%s',_0x1cf941,_0x426d4a[_0xadcd('0x14')][_0xadcd('0x16')]);return _0x3dab85(_0x426d4a[_0xadcd('0x14')][_0xadcd('0x16')]);}else{logger[_0xadcd('0xf')](_0xadcd('0x10'),_0x1cf941,_0xadcd('0x11'));_0x3dab85(_0x426d4a[_0xadcd('0x17')]['message']);}})[_0xadcd('0x18')](function(_0x2e5a78){logger[_0xadcd('0x14')](_0xadcd('0x10'),_0x1cf941,_0x2e5a78);_0x3faa6b(_0x2e5a78);});});} \ No newline at end of file +var _0x21c5=['../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x161684,_0x57a86a){var _0x539d43=function(_0x5d199d){while(--_0x5d199d){_0x161684['push'](_0x161684['shift']());}};_0x539d43(++_0x57a86a);}(_0x21c5,0x1c3));var _0x521c=function(_0x55a041,_0x5943ff){_0x55a041=_0x55a041-0x0;var _0x220f16=_0x21c5[_0x55a041];return _0x220f16;};'use strict';var _=require(_0x521c('0x0'));var util=require(_0x521c('0x1'));var moment=require(_0x521c('0x2'));var BPromise=require(_0x521c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x521c('0x4'));var db=require(_0x521c('0x5'))['db'];var utils=require(_0x521c('0x6'));var logger=require(_0x521c('0x7'))(_0x521c('0x8'));var config=require(_0x521c('0x9'));var jayson=require(_0x521c('0xa'));var client=jayson['client'][_0x521c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x171f11,_0x12ca2e,_0x49cf52){return new BPromise(function(_0x2f0934,_0x32468d){return client[_0x521c('0xc')](_0x171f11,_0x49cf52)[_0x521c('0xd')](function(_0x2e0bb0){logger['info'](_0x521c('0xe'),_0x12ca2e,'request\x20sent');logger[_0x521c('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x12ca2e,_0x521c('0x10'),JSON['stringify'](_0x2e0bb0));if(_0x2e0bb0[_0x521c('0x11')]){if(_0x2e0bb0[_0x521c('0x11')][_0x521c('0x12')]===0x1f4){logger[_0x521c('0x11')](_0x521c('0xe'),_0x12ca2e,_0x2e0bb0['error']['message']);return _0x32468d(_0x2e0bb0[_0x521c('0x11')][_0x521c('0x13')]);}logger[_0x521c('0x11')](_0x521c('0xe'),_0x12ca2e,_0x2e0bb0[_0x521c('0x11')][_0x521c('0x13')]);return _0x2f0934(_0x2e0bb0[_0x521c('0x11')][_0x521c('0x13')]);}else{logger[_0x521c('0x14')]('CmCustomField,\x20%s,\x20%s',_0x12ca2e,_0x521c('0x10'));_0x2f0934(_0x2e0bb0[_0x521c('0x15')][_0x521c('0x13')]);}})[_0x521c('0x16')](function(_0x3f550b){logger[_0x521c('0x11')]('CmCustomField,\x20%s,\x20%s',_0x12ca2e,_0x3f550b);_0x32468d(_0x3f550b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d2c828d..fc99105 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 _0x510e=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x510e,0x1ed));var _0xe510=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x510e[_0x59e821];return _0x5333f6;};'use strict';var multer=require(_0xe510('0x0'));var util=require(_0xe510('0x1'));var path=require(_0xe510('0x2'));var timeout=require(_0xe510('0x3'));var express=require(_0xe510('0x4'));var router=express[_0xe510('0x5')]();var fs_extra=require(_0xe510('0x6'));var auth=require(_0xe510('0x7'));var interaction=require(_0xe510('0x8'));var config=require('../../config/environment');var controller=require(_0xe510('0x9'));router[_0xe510('0xa')]('/',auth[_0xe510('0xb')](),controller[_0xe510('0xc')]);router[_0xe510('0xa')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller[_0xe510('0xe')]);router[_0xe510('0xf')]('/',auth[_0xe510('0xb')](),controller[_0xe510('0x10')]);router[_0xe510('0x11')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller['update']);router[_0xe510('0x12')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller[_0xe510('0x13')]);module[_0xe510('0x14')]=router; \ No newline at end of file +var _0x39d4=['index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x312cb6,_0x58de79){var _0x2592dc=function(_0x38adf7){while(--_0x38adf7){_0x312cb6['push'](_0x312cb6['shift']());}};_0x2592dc(++_0x58de79);}(_0x39d4,0x9e));var _0x439d=function(_0x4f8999,_0x2d733b){_0x4f8999=_0x4f8999-0x0;var _0x798b5b=_0x39d4[_0x4f8999];return _0x798b5b;};'use strict';var multer=require(_0x439d('0x0'));var util=require(_0x439d('0x1'));var path=require(_0x439d('0x2'));var timeout=require(_0x439d('0x3'));var express=require(_0x439d('0x4'));var router=express[_0x439d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x439d('0x6'));var interaction=require(_0x439d('0x7'));var config=require(_0x439d('0x8'));var controller=require(_0x439d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x439d('0xa')]);router[_0x439d('0xb')](_0x439d('0xc'),auth[_0x439d('0xd')](),controller[_0x439d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x439d('0xf')]);router[_0x439d('0x10')]('/:id',auth[_0x439d('0xd')](),controller[_0x439d('0x11')]);router[_0x439d('0x12')](_0x439d('0xc'),auth['isAuthenticated'](),controller[_0x439d('0x13')]);module[_0x439d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f2f70d9..9557b25 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 _0x8108=['contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x8108,0xb5));var _0x8810=function(_0x580cea,_0x41fab5){_0x580cea=_0x580cea-0x0;var _0x5311c8=_0x8108[_0x580cea];return _0x5311c8;};'use strict';var moment=require(_0x8810('0x0'));var Sequelize=require(_0x8810('0x1'));module[_0x8810('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8810('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8810('0x4')],'defaultValue':moment()[_0x8810('0x5')](_0x8810('0x6'))},'countbusyretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8810('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8810('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8810('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8810('0x7')],'unique':_0x8810('0x9')},'ListId':{'type':Sequelize[_0x8810('0x7')],'unique':_0x8810('0x9')},'UserId':{'type':Sequelize[_0x8810('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x8810('0x7')],'unique':_0x8810('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x8810('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8810('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8810('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xc1a6=['DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x16a9d5,_0x48f397){var _0x4df0fc=function(_0x417505){while(--_0x417505){_0x16a9d5['push'](_0x16a9d5['shift']());}};_0x4df0fc(++_0x48f397);}(_0xc1a6,0xc3));var _0x6c1a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xc1a6[_0x2a6809];return _0x11c371;};'use strict';var moment=require(_0x6c1a('0x0'));var Sequelize=require(_0x6c1a('0x1'));module[_0x6c1a('0x2')]={'phone':{'type':Sequelize[_0x6c1a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x6c1a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6c1a('0x5')],'defaultValue':moment()[_0x6c1a('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x6c1a('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6c1a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6c1a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6c1a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x6c1a('0x7')](0x2)[_0x6c1a('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6c1a('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6c1a('0x7')],'unique':_0x6c1a('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x6c1a('0x7')],'unique':_0x6c1a('0x9')},'CampaignId':{'type':Sequelize[_0x6c1a('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6c1a('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6c1a('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6c1a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6c1a('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6c1a('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6c1a('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index b03014f..f8ef1d9 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 _0xc949=['$or','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','Contact','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','index','map','CmHopper','fieldName','key','model','query','keys','filters','intersection','concat'];(function(_0x5056c1,_0x465db0){var _0x39e19a=function(_0x41d720){while(--_0x41d720){_0x5056c1['push'](_0x5056c1['shift']());}};_0x39e19a(++_0x465db0);}(_0xc949,0x181));var _0x9c94=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xc949[_0x25bea7];return _0x175952;};'use strict';var moment=require(_0x9c94('0x0'));var _=require('lodash');var qs=require(_0x9c94('0x1'));var logger=require(_0x9c94('0x2'))(_0x9c94('0x3'));var shared=require(_0x9c94('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x11a56c,_0x231762){_0x231762=_0x231762||0xc8;return function(_0x528a17){if(_0x528a17){return _0x11a56c[_0x9c94('0x5')](_0x231762)[_0x9c94('0x6')](_0x528a17);}};}function respondWithFilteredResult(_0x46d560,_0x1357ac){return function(_0x57fcd7){if(_0x57fcd7){var _0xf373e=typeof _0x1357ac[_0x9c94('0x7')]===_0x9c94('0x8')&&typeof _0x1357ac[_0x9c94('0x9')]===_0x9c94('0x8');var _0x423e62=_0x57fcd7[_0x9c94('0xa')];var _0x454b16=_0xf373e?0x0:_0x1357ac[_0x9c94('0x7')];var _0x3287f8=_0xf373e?_0x57fcd7['count']:_0x1357ac[_0x9c94('0x7')]+_0x1357ac[_0x9c94('0x9')];var _0x14c4ae;if(_0x3287f8>=_0x423e62){_0x3287f8=_0x423e62;_0x14c4ae=0xc8;}else{_0x14c4ae=0xce;}_0x46d560[_0x9c94('0x5')](_0x14c4ae);return _0x46d560[_0x9c94('0xb')](_0x9c94('0xc'),_0x454b16+'-'+_0x3287f8+'/'+_0x423e62)[_0x9c94('0x6')](_0x57fcd7);}return null;};}function saveUpdates(_0x423adb,_0x30f64e){return function(_0x1e326f){if(_0x1e326f){return _0x1e326f[_0x9c94('0xd')](_0x423adb)[_0x9c94('0xe')](function(_0x369d70){return _0x369d70;});}return null;};}function handleEntityNotFound(_0x15c51c,_0x54d956){return function(_0x9789bc){if(!_0x9789bc){_0x15c51c['sendStatus'](0x194);}return _0x9789bc;};}function handleError(_0x3d3de5,_0x26e629){_0x26e629=_0x26e629||0x1f4;return function(_0x4f0013){logger[_0x9c94('0xf')](_0x4f0013['stack']);if(_0x4f0013['name']){delete _0x4f0013[_0x9c94('0x10')];}_0x3d3de5['status'](_0x26e629)[_0x9c94('0x11')](_0x4f0013);};}exports[_0x9c94('0x12')]=function(_0x4d9266,_0x201e04){var _0x367eed={},_0x412804={},_0x3b825e={'count':0x0,'rows':[]};var _0x16ef2c=_[_0x9c94('0x13')](db[_0x9c94('0x14')]['rawAttributes'],function(_0x2c9736){return{'name':_0x2c9736[_0x9c94('0x15')],'type':_0x2c9736['type'][_0x9c94('0x16')]};});_0x412804[_0x9c94('0x17')]=_[_0x9c94('0x13')](_0x16ef2c,_0x9c94('0x10'));_0x412804[_0x9c94('0x18')]=_[_0x9c94('0x19')](_0x4d9266[_0x9c94('0x18')]);_0x412804[_0x9c94('0x1a')]=_[_0x9c94('0x1b')](_0x412804[_0x9c94('0x17')],_0x412804[_0x9c94('0x18')]);_0x412804[_0x9c94('0x1a')]=_[_0x9c94('0x1c')](_0x412804[_0x9c94('0x1a')],['$and',_0x9c94('0x1d'),_0x9c94('0x1e'),'$gte',_0x9c94('0x1f'),_0x9c94('0x20'),_0x9c94('0x21'),_0x9c94('0x22'),_0x9c94('0x23'),'$between',_0x9c94('0x24'),_0x9c94('0x25'),'$notIn',_0x9c94('0x26'),'$notLike',_0x9c94('0x27'),_0x9c94('0x28'),_0x9c94('0x26'),_0x9c94('0x29'),_0x9c94('0x2a'),_0x9c94('0x2b'),_0x9c94('0x2c')]);_0x367eed['attributes']=_['intersection'](_0x412804[_0x9c94('0x17')],qs[_0x9c94('0x2d')](_0x4d9266[_0x9c94('0x18')]['fields']));_0x367eed[_0x9c94('0x2e')]=_0x367eed['attributes'][_0x9c94('0x2f')]?_0x367eed[_0x9c94('0x2e')]:_0x412804[_0x9c94('0x17')];if(!_0x4d9266['query']['hasOwnProperty'](_0x9c94('0x30'))){_0x367eed[_0x9c94('0x9')]=qs[_0x9c94('0x9')](_0x4d9266['query']['limit']);_0x367eed['offset']=qs['offset'](_0x4d9266[_0x9c94('0x18')]['offset']);}_0x367eed[_0x9c94('0x31')]=qs[_0x9c94('0x32')](_0x4d9266['query']['sort']);_0x367eed[_0x9c94('0x33')]=qs[_0x9c94('0x1a')](_[_0x9c94('0x34')](_0x4d9266[_0x9c94('0x18')],_0x412804[_0x9c94('0x1a')]),_0x16ef2c);if(_0x4d9266[_0x9c94('0x18')][_0x9c94('0x35')]){_0x367eed[_0x9c94('0x33')]=_[_0x9c94('0x36')](_0x367eed[_0x9c94('0x33')],{'$or':_[_0x9c94('0x13')](_0x16ef2c,function(_0x44392f){if(_0x44392f[_0x9c94('0x37')]!==_0x9c94('0x38')){var _0x3060e8={};_0x3060e8[_0x44392f[_0x9c94('0x10')]]={'$like':'%'+_0x4d9266[_0x9c94('0x18')][_0x9c94('0x35')]+'%'};return _0x3060e8;}})});}_0x367eed=_['merge']({},_0x367eed,_0x4d9266[_0x9c94('0x39')]);var _0x230685={'where':_0x367eed[_0x9c94('0x33')]};return db[_0x9c94('0x14')][_0x9c94('0xa')](_0x230685)[_0x9c94('0xe')](function(_0x13f94c){_0x3b825e['count']=_0x13f94c;if(_0x4d9266[_0x9c94('0x18')]['includeAll']){_0x367eed[_0x9c94('0x3a')]=[{'all':!![]}];}return db[_0x9c94('0x14')][_0x9c94('0x3b')](_0x367eed);})[_0x9c94('0xe')](function(_0x4b2c4e){_0x3b825e[_0x9c94('0x3c')]=_0x4b2c4e;return _0x3b825e;})['then'](respondWithFilteredResult(_0x201e04,_0x367eed))[_0x9c94('0x3d')](handleError(_0x201e04,null));};exports[_0x9c94('0x3e')]=function(_0x3912f0,_0x5e3119){var _0x21e9f7={'raw':!![],'where':{'id':_0x3912f0[_0x9c94('0x3f')]['id']}},_0x4d4dc0={};_0x4d4dc0['model']=_['keys'](db[_0x9c94('0x14')][_0x9c94('0x40')]);_0x4d4dc0[_0x9c94('0x18')]=_[_0x9c94('0x19')](_0x3912f0['query']);_0x4d4dc0[_0x9c94('0x1a')]=_[_0x9c94('0x1b')](_0x4d4dc0[_0x9c94('0x17')],_0x4d4dc0[_0x9c94('0x18')]);_0x21e9f7['attributes']=_[_0x9c94('0x1b')](_0x4d4dc0[_0x9c94('0x17')],qs['fields'](_0x3912f0[_0x9c94('0x18')][_0x9c94('0x2d')]));_0x21e9f7[_0x9c94('0x2e')]=_0x21e9f7['attributes']['length']?_0x21e9f7[_0x9c94('0x2e')]:_0x4d4dc0[_0x9c94('0x17')];if(_0x3912f0[_0x9c94('0x18')][_0x9c94('0x41')]){_0x21e9f7[_0x9c94('0x3a')]=[{'all':!![]}];}_0x21e9f7=_[_0x9c94('0x36')]({},_0x21e9f7,_0x3912f0[_0x9c94('0x39')]);return db[_0x9c94('0x14')][_0x9c94('0x42')](_0x21e9f7)[_0x9c94('0xe')](handleEntityNotFound(_0x5e3119,null))[_0x9c94('0xe')](respondWithResult(_0x5e3119,null))['catch'](handleError(_0x5e3119,null));};exports[_0x9c94('0x43')]=function(_0x5647f9,_0x4ae326){return db[_0x9c94('0x14')][_0x9c94('0x43')](_0x5647f9[_0x9c94('0x44')],{})[_0x9c94('0xe')](respondWithResult(_0x4ae326,0xc9))[_0x9c94('0x3d')](handleError(_0x4ae326,null));};exports[_0x9c94('0xd')]=function(_0x4aeabc,_0x5665d2){if(_0x4aeabc[_0x9c94('0x44')]['id']){delete _0x4aeabc[_0x9c94('0x44')]['id'];}return db[_0x9c94('0x14')]['find']({'where':{'id':_0x4aeabc[_0x9c94('0x3f')]['id']}})[_0x9c94('0xe')](handleEntityNotFound(_0x5665d2,null))['then'](saveUpdates(_0x4aeabc['body'],null))['then'](respondWithResult(_0x5665d2,null))['catch'](handleError(_0x5665d2,null));};exports[_0x9c94('0x45')]=function(_0x5362f4,_0x5ccc46){return db[_0x9c94('0x14')]['describe']()[_0x9c94('0xe')](respondWithResult(_0x5ccc46,null))[_0x9c94('0x3d')](handleError(_0x5ccc46,null));};exports[_0x9c94('0x46')]=function(_0x205f51,_0x22eaa4){var _0x5ae40c;var _0x33ccef=_0x205f51[_0x9c94('0x3f')]['id'];return db[_0x9c94('0x14')][_0x9c94('0x42')]({'where':{'id':_0x205f51[_0x9c94('0x3f')]['id']}})[_0x9c94('0xe')](handleEntityNotFound(_0x22eaa4,null))['then'](function(_0x44311e){if(_0x44311e){return _0x44311e['destroy']()[_0x9c94('0xe')](function(_0x38bb48){return _0x38bb48;});}})[_0x9c94('0xe')](function(_0x48d368){_0x5ae40c=_0x48d368;if(_0x48d368){if(_0x48d368[_0x9c94('0x47')]||_0x48d368[_0x9c94('0x48')]){return db[_0x48d368['VoiceQueueId']?_0x9c94('0x49'):'Campaign'][_0x9c94('0x42')]({'where':{'id':_0x48d368[_0x9c94('0x47')]?_0x48d368['VoiceQueueId']:_0x48d368['CampaignId']},'attributes':['id',_0x9c94('0x10')],'raw':!![]});}}})['then'](function(_0x472107){var _0x3f8448={};if(_0x472107){_[_0x9c94('0x36')](_0x3f8448,_[_0x9c94('0x4a')](_0x5ae40c['dataValues'],[_0x9c94('0x4b'),_0x9c94('0x4c'),'id']));_0x3f8448['state']=0x15;_0x3f8448['statedesc']=_0x9c94('0x4d');_0x3f8448[_0x9c94('0x4e')]=_0x472107[_0x9c94('0x10')];_0x3f8448[_0x9c94('0x4f')]=_0x205f51[_0x9c94('0x50')][_0x9c94('0x10')];_0x3f8448['UserId']=_0x205f51[_0x9c94('0x50')]['id'];_0x3f8448[_0x9c94('0x4d')]=!![];_0x3f8448[_0x9c94('0x51')]=moment()[_0x9c94('0x52')](_0x9c94('0x53'));_0x3f8448[_0x9c94('0x54')]=_0x5ae40c['phone'];_0x3f8448[_0x9c94('0x55')]=_0x5ae40c['VoiceQueueId']?_0x9c94('0x56'):_0x9c94('0x57');return db[_0x9c94('0x58')]['find']({'where':{'id':_0x3f8448[_0x9c94('0x59')]},'attributes':['firstName','lastName']})[_0x9c94('0xe')](function(_0x3b88be){if(!_['isNil'](_0x22eaa4)&&!_[_0x9c94('0x5a')](_0x3b88be[_0x9c94('0x5b')])){_0x3f8448[_0x9c94('0x5c')]=_0x3b88be[_0x9c94('0x5b')];if(!_[_0x9c94('0x5a')](_0x3b88be[_0x9c94('0x5d')])){_0x3f8448[_0x9c94('0x5c')]+='\x20'+_0x3b88be[_0x9c94('0x5d')];}}})[_0x9c94('0x5e')](function(){return db[_0x9c94('0x5f')][_0x9c94('0x43')](_0x3f8448);});}})['then'](function(_0x481a11){return db[_0x9c94('0x60')][_0x9c94('0x46')]({'where':{'CmHopperId':_0x33ccef}});})['then'](function(){return _0x22eaa4[_0x9c94('0x5')](0xcc)[_0x9c94('0x61')]();})[_0x9c94('0x3d')](handleError(_0x22eaa4,null));};exports[_0x9c94('0x62')]=function(_0x249759,_0xd5674b){var _0x4f3f89=[];return db['CmContact']['describe']()[_0x9c94('0xe')](function(_0x5c2ea2){_0x4f3f89=_['keys'](_0x5c2ea2);return _0x249759[_0x9c94('0x50')][_0x9c94('0x63')]({'where':{'type':_0x9c94('0x64'),'dialActive':!![],'dialMethod':_0x9c94('0x65')},'attributes':['id',_0x9c94('0x66'),_0x9c94('0x67')],'raw':!![]});})['then'](function(_0x2a8a97){if(_0x2a8a97&&_0x2a8a97['length']){return db[_0x9c94('0x68')][_0x9c94('0x69')](function(_0x5b4e1a){var _0x1e3e42={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9c94('0x52')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x9c94('0x13')](_0x2a8a97,'id')},'$or':[{'UserId':null},{'UserId':_0x249759[_0x9c94('0x50')]['id']}]};var _0x364450={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a8a97)[_0x9c94('0x35')](['dialPreviewAutoRecallMe',0x0])[_0x9c94('0x13')]('id')[_0x9c94('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x249759['user']['id']}]};var _0x5b68ac={'$or':[_0x1e3e42,_0x364450]};var _0xf8b2ec=[];if(_0x249759[_0x9c94('0x44')][_0x9c94('0x6b')]&&_0x249759['body']['direction']===_0x9c94('0x6c')){if(!_[_0x9c94('0x6d')](_0x249759[_0x9c94('0x44')]['hopperIds'])){_0x5b68ac['id']={'$in':_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')]};}_0xf8b2ec=[[_0x9c94('0x6f'),_0x9c94('0x70')],[_0x9c94('0x71'),_0x2a8a97[0x0][_0x9c94('0x66')]==='ASC'?_0x9c94('0x72'):_0x9c94('0x70')],db[_0x9c94('0x68')][_0x9c94('0x73')](_0x9c94('0x74')),['id',_0x9c94('0x72')]];}else{if(!_[_0x9c94('0x6d')](_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')])){_0x5b68ac['id']={'$notIn':_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')]};}_0xf8b2ec=[['priority','DESC'],[_0x9c94('0x71'),_0x2a8a97[0x0]['dialOrderByScheduledAt']],db['sequelize']['literal'](_0x9c94('0x75')),['id',_0x9c94('0x70')]];}return db['CmHopper'][_0x9c94('0x76')]({'attributes':['id',_0x9c94('0x77'),_0x9c94('0x78'),_0x9c94('0x79')],'where':_0x5b68ac,'order':_0xf8b2ec,'transaction':_0x5b4e1a,'lock':_0x5b4e1a[_0x9c94('0x7a')]['UPDATE'],'include':[{'model':db[_0x9c94('0x58')],'as':'Contact','attributes':_0x4f3f89,'include':[{'model':db[_0x9c94('0x7b')],'as':_0x9c94('0x7c'),'attributes':['id',_0x9c94('0x10')]}]},{'model':db[_0x9c94('0x7d')],'as':_0x9c94('0x7e'),'attributes':['id',_0x9c94('0x10')]},{'model':db[_0x9c94('0x49')],'as':_0x9c94('0x7f'),'attributes':['id',_0x9c94('0x10'),_0x9c94('0x80')]}]})[_0x9c94('0xe')](function(_0x540996){if(_0x540996){return _0x540996[_0x9c94('0xd')]({'UserId':_0x249759[_0x9c94('0x50')]['id']},{'transaction':_0x5b4e1a});}});});}})[_0x9c94('0xe')](handleEntityNotFound(_0xd5674b,null))['then'](respondWithResult(_0xd5674b,null))[_0x9c94('0x3d')](handleError(_0xd5674b,null));};exports[_0x9c94('0x81')]=function(_0x324b1f,_0x18dd23,_0xc6d42c){var _0x66483b=[];var _0x13988a=_0x324b1f['params']['id'];var _0x1dcfaa=_0x324b1f[_0x9c94('0x50')]['id'];return db[_0x9c94('0x58')]['describe']()[_0x9c94('0xe')](function(_0x59ef88){_0x66483b=_[_0x9c94('0x19')](_0x59ef88);return db[_0x9c94('0x68')]['transaction'](function(_0x3fa6be){const _0x1b0eac={'id':_0x13988a};return db[_0x9c94('0x14')][_0x9c94('0x76')]({'attributes':['id',_0x9c94('0x77'),_0x9c94('0x79')],'where':_0x1b0eac,'transaction':_0x3fa6be,'lock':_0x3fa6be['LOCK']['UPDATE'],'include':[{'model':db[_0x9c94('0x58')],'as':_0x9c94('0x82'),'attributes':_0x66483b,'include':[{'model':db[_0x9c94('0x7b')],'as':'Company','attributes':['id',_0x9c94('0x10')]}]},{'model':db[_0x9c94('0x7d')],'as':_0x9c94('0x7e'),'attributes':['id','name']},{'model':db[_0x9c94('0x49')],'as':'Queue','attributes':['id','name',_0x9c94('0x80')]}]})[_0x9c94('0xe')](function(_0x48d0ea){if(_0x48d0ea){return _0x48d0ea[_0x9c94('0xd')]({'UserId':_0x1dcfaa},{'transaction':_0x3fa6be});}});});})[_0x9c94('0xe')](handleEntityNotFound(_0x18dd23,null))['then'](respondWithResult(_0x18dd23,null))[_0x9c94('0x3d')](handleError(_0x18dd23,null));};exports[_0x9c94('0x83')]=function(_0xe7fc99,_0x1bacd9){return _0xe7fc99[_0x9c94('0x50')][_0x9c94('0x63')]({'where':{'type':_0x9c94('0x64'),'dialActive':!![],'dialMethod':_0x9c94('0x65')},'attributes':['id'],'raw':!![]})[_0x9c94('0xe')](function(_0x540373){if(_0x540373&&_0x540373[_0x9c94('0x2f')]){return db[_0x9c94('0x14')][_0x9c94('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9c94('0x52')](_0x9c94('0x53'))},'VoiceQueueId':{'$in':_['map'](_0x540373,'id')},'$or':[{'UserId':null},{'UserId':_0xe7fc99[_0x9c94('0x50')]['id']}]}});}return 0x0;})['then'](function(_0x2ca6a4){if(!_[_0x9c94('0x5a')](_0x2ca6a4)&&_['isNumber'](_0x2ca6a4)){return _0x1bacd9['status'](0xc8)[_0x9c94('0x6')]({'contacts':_0x2ca6a4});}else{logger[_0x9c94('0xf')](_0x9c94('0x84'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x1bacd9[_0x9c94('0x85')](0x194);}})[_0x9c94('0x3d')](handleError(_0x1bacd9,null));};exports[_0x9c94('0x86')]=function(_0x27cdde,_0x34edf2){var _0x3b7c65=shared[_0x9c94('0x87')];var _0x117e0f=[];_[_0x9c94('0x13')](_0x3b7c65,function(_0x4c9022){_0x117e0f['push']({'id':_0x4c9022['name'],'name':_0x4c9022['name'],'utcOffset':_0x4c9022[_0x9c94('0x88')]});});return _0x34edf2['status'](0xc8)[_0x9c94('0x6')]({'tz':_0x117e0f});};exports[_0x9c94('0x89')]=function(_0x22d5bc,_0x4e23c1){var _0xf55837=shared[_0x9c94('0x87')];var _0x3edf16={};if(!_['isNil'](_0xf55837[_0x22d5bc[_0x9c94('0x44')]['id']]))_0x3edf16=_0xf55837[_0x22d5bc[_0x9c94('0x44')]['id']];return _0x4e23c1[_0x9c94('0x5')](0xc8)[_0x9c94('0x6')](_0x3edf16);}; \ No newline at end of file +var _0xbeea=['phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','end','getPreview','CmContact','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','Company','List','dialActive','update','CmCompany','Queue','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','limit','count','Content-Range','sendStatus','error','stack','name','send','rawAttributes','type','key','model','map','keys','filters','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','query','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmHopper','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','createdAt','updatedAt','state','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum'];(function(_0x7007a1,_0x4137dc){var _0x47b44b=function(_0x21f704){while(--_0x21f704){_0x7007a1['push'](_0x7007a1['shift']());}};_0x47b44b(++_0x4137dc);}(_0xbeea,0xb1));var _0xabee=function(_0x44b3ee,_0x3dec88){_0x44b3ee=_0x44b3ee-0x0;var _0x3da25e=_0xbeea[_0x44b3ee];return _0x3da25e;};'use strict';var moment=require(_0xabee('0x0'));var _=require('lodash');var qs=require(_0xabee('0x1'));var logger=require(_0xabee('0x2'))(_0xabee('0x3'));var shared=require('../../config/environment');var db=require(_0xabee('0x4'))['db'];function respondWithResult(_0x59e264,_0x58afa7){_0x58afa7=_0x58afa7||0xc8;return function(_0x33571e){if(_0x33571e){return _0x59e264[_0xabee('0x5')](_0x58afa7)[_0xabee('0x6')](_0x33571e);}};}function respondWithFilteredResult(_0x1ea258,_0x58c9ef){return function(_0x5bb218){if(_0x5bb218){var _0x238317=typeof _0x58c9ef[_0xabee('0x7')]==='undefined'&&typeof _0x58c9ef[_0xabee('0x8')]==='undefined';var _0x14a78d=_0x5bb218[_0xabee('0x9')];var _0x2a1c06=_0x238317?0x0:_0x58c9ef[_0xabee('0x7')];var _0x33a862=_0x238317?_0x5bb218[_0xabee('0x9')]:_0x58c9ef['offset']+_0x58c9ef[_0xabee('0x8')];var _0x3bbb18;if(_0x33a862>=_0x14a78d){_0x33a862=_0x14a78d;_0x3bbb18=0xc8;}else{_0x3bbb18=0xce;}_0x1ea258[_0xabee('0x5')](_0x3bbb18);return _0x1ea258['set'](_0xabee('0xa'),_0x2a1c06+'-'+_0x33a862+'/'+_0x14a78d)[_0xabee('0x6')](_0x5bb218);}return null;};}function saveUpdates(_0x16d6a5,_0x49fb73){return function(_0x5915a1){if(_0x5915a1){return _0x5915a1['update'](_0x16d6a5)['then'](function(_0x57abc2){return _0x57abc2;});}return null;};}function handleEntityNotFound(_0x113c5c,_0x370a4e){return function(_0x38ba29){if(!_0x38ba29){_0x113c5c[_0xabee('0xb')](0x194);}return _0x38ba29;};}function handleError(_0x38cf66,_0x5e94ff){_0x5e94ff=_0x5e94ff||0x1f4;return function(_0x177670){logger[_0xabee('0xc')](_0x177670[_0xabee('0xd')]);if(_0x177670[_0xabee('0xe')]){delete _0x177670[_0xabee('0xe')];}_0x38cf66[_0xabee('0x5')](_0x5e94ff)[_0xabee('0xf')](_0x177670);};}exports['index']=function(_0x33e3c0,_0x112bb9){var _0x447ed3={},_0x471b24={},_0x150bdb={'count':0x0,'rows':[]};var _0xcf2973=_['map'](db['CmHopper'][_0xabee('0x10')],function(_0x593923){return{'name':_0x593923['fieldName'],'type':_0x593923[_0xabee('0x11')][_0xabee('0x12')]};});_0x471b24[_0xabee('0x13')]=_[_0xabee('0x14')](_0xcf2973,_0xabee('0xe'));_0x471b24['query']=_[_0xabee('0x15')](_0x33e3c0['query']);_0x471b24['filters']=_['intersection'](_0x471b24[_0xabee('0x13')],_0x471b24['query']);_0x471b24[_0xabee('0x16')]=_[_0xabee('0x17')](_0x471b24[_0xabee('0x16')],[_0xabee('0x18'),_0xabee('0x19'),_0xabee('0x1a'),_0xabee('0x1b'),'$lt',_0xabee('0x1c'),_0xabee('0x1d'),_0xabee('0x1e'),_0xabee('0x1f'),'$between',_0xabee('0x20'),_0xabee('0x21'),'$notIn',_0xabee('0x22'),_0xabee('0x23'),_0xabee('0x24'),_0xabee('0x25'),'$like',_0xabee('0x26'),_0xabee('0x27'),_0xabee('0x28'),_0xabee('0x29')]);_0x447ed3[_0xabee('0x2a')]=_[_0xabee('0x2b')](_0x471b24[_0xabee('0x13')],qs[_0xabee('0x2c')](_0x33e3c0[_0xabee('0x2d')]['fields']));_0x447ed3[_0xabee('0x2a')]=_0x447ed3['attributes'][_0xabee('0x2e')]?_0x447ed3[_0xabee('0x2a')]:_0x471b24[_0xabee('0x13')];if(!_0x33e3c0[_0xabee('0x2d')]['hasOwnProperty'](_0xabee('0x2f'))){_0x447ed3['limit']=qs[_0xabee('0x8')](_0x33e3c0['query'][_0xabee('0x8')]);_0x447ed3['offset']=qs['offset'](_0x33e3c0[_0xabee('0x2d')][_0xabee('0x7')]);}_0x447ed3[_0xabee('0x30')]=qs[_0xabee('0x31')](_0x33e3c0[_0xabee('0x2d')][_0xabee('0x31')]);_0x447ed3[_0xabee('0x32')]=qs[_0xabee('0x16')](_['pick'](_0x33e3c0[_0xabee('0x2d')],_0x471b24[_0xabee('0x16')]),_0xcf2973);if(_0x33e3c0[_0xabee('0x2d')][_0xabee('0x33')]){_0x447ed3[_0xabee('0x32')]=_[_0xabee('0x34')](_0x447ed3[_0xabee('0x32')],{'$or':_[_0xabee('0x14')](_0xcf2973,function(_0x41c4a3){if(_0x41c4a3[_0xabee('0x11')]!==_0xabee('0x35')){var _0x3112fd={};_0x3112fd[_0x41c4a3[_0xabee('0xe')]]={'$like':'%'+_0x33e3c0[_0xabee('0x2d')][_0xabee('0x33')]+'%'};return _0x3112fd;}})});}_0x447ed3=_[_0xabee('0x34')]({},_0x447ed3,_0x33e3c0[_0xabee('0x36')]);var _0x491279={'where':_0x447ed3['where']};return db[_0xabee('0x37')][_0xabee('0x9')](_0x491279)[_0xabee('0x38')](function(_0x153c0b){_0x150bdb['count']=_0x153c0b;if(_0x33e3c0[_0xabee('0x2d')][_0xabee('0x39')]){_0x447ed3[_0xabee('0x3a')]=[{'all':!![]}];}return db['CmHopper'][_0xabee('0x3b')](_0x447ed3);})['then'](function(_0x186333){_0x150bdb[_0xabee('0x3c')]=_0x186333;return _0x150bdb;})[_0xabee('0x38')](respondWithFilteredResult(_0x112bb9,_0x447ed3))[_0xabee('0x3d')](handleError(_0x112bb9,null));};exports['show']=function(_0x48d6ca,_0x417281){var _0xb76b1d={'raw':!![],'where':{'id':_0x48d6ca[_0xabee('0x3e')]['id']}},_0xa2ae67={};_0xa2ae67[_0xabee('0x13')]=_['keys'](db[_0xabee('0x37')][_0xabee('0x10')]);_0xa2ae67['query']=_[_0xabee('0x15')](_0x48d6ca[_0xabee('0x2d')]);_0xa2ae67['filters']=_[_0xabee('0x2b')](_0xa2ae67[_0xabee('0x13')],_0xa2ae67[_0xabee('0x2d')]);_0xb76b1d[_0xabee('0x2a')]=_[_0xabee('0x2b')](_0xa2ae67[_0xabee('0x13')],qs[_0xabee('0x2c')](_0x48d6ca['query'][_0xabee('0x2c')]));_0xb76b1d[_0xabee('0x2a')]=_0xb76b1d[_0xabee('0x2a')]['length']?_0xb76b1d[_0xabee('0x2a')]:_0xa2ae67[_0xabee('0x13')];if(_0x48d6ca['query'][_0xabee('0x39')]){_0xb76b1d[_0xabee('0x3a')]=[{'all':!![]}];}_0xb76b1d=_['merge']({},_0xb76b1d,_0x48d6ca[_0xabee('0x36')]);return db[_0xabee('0x37')][_0xabee('0x3f')](_0xb76b1d)[_0xabee('0x38')](handleEntityNotFound(_0x417281,null))[_0xabee('0x38')](respondWithResult(_0x417281,null))[_0xabee('0x3d')](handleError(_0x417281,null));};exports[_0xabee('0x40')]=function(_0x5a5fa7,_0x2aa2f0){return db[_0xabee('0x37')][_0xabee('0x40')](_0x5a5fa7['body'],{})[_0xabee('0x38')](respondWithResult(_0x2aa2f0,0xc9))[_0xabee('0x3d')](handleError(_0x2aa2f0,null));};exports['update']=function(_0x57c65c,_0x4b458f){if(_0x57c65c[_0xabee('0x41')]['id']){delete _0x57c65c[_0xabee('0x41')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x57c65c[_0xabee('0x3e')]['id']}})[_0xabee('0x38')](handleEntityNotFound(_0x4b458f,null))[_0xabee('0x38')](saveUpdates(_0x57c65c[_0xabee('0x41')],null))[_0xabee('0x38')](respondWithResult(_0x4b458f,null))[_0xabee('0x3d')](handleError(_0x4b458f,null));};exports[_0xabee('0x42')]=function(_0x307d34,_0xfb2b6f){return db[_0xabee('0x37')][_0xabee('0x42')]()[_0xabee('0x38')](respondWithResult(_0xfb2b6f,null))[_0xabee('0x3d')](handleError(_0xfb2b6f,null));};exports[_0xabee('0x43')]=function(_0x3e277d,_0x252f60){var _0x1b5cf2;var _0x34dca8=_0x3e277d['params']['id'];return db[_0xabee('0x37')][_0xabee('0x3f')]({'where':{'id':_0x3e277d['params']['id']}})['then'](handleEntityNotFound(_0x252f60,null))[_0xabee('0x38')](function(_0x3ecfff){if(_0x3ecfff){return _0x3ecfff[_0xabee('0x43')]()[_0xabee('0x38')](function(_0xe2433f){return _0xe2433f;});}})[_0xabee('0x38')](function(_0x37e589){_0x1b5cf2=_0x37e589;if(_0x37e589){if(_0x37e589['VoiceQueueId']||_0x37e589[_0xabee('0x44')]){return db[_0x37e589['VoiceQueueId']?_0xabee('0x45'):_0xabee('0x46')]['find']({'where':{'id':_0x37e589[_0xabee('0x47')]?_0x37e589[_0xabee('0x47')]:_0x37e589[_0xabee('0x44')]},'attributes':['id','name'],'raw':!![]});}}})[_0xabee('0x38')](function(_0x4f36a4){var _0x1fc0da={};if(_0x4f36a4){_[_0xabee('0x34')](_0x1fc0da,_[_0xabee('0x48')](_0x1b5cf2['dataValues'],[_0xabee('0x49'),_0xabee('0x4a'),'id']));_0x1fc0da[_0xabee('0x4b')]=0x15;_0x1fc0da['statedesc']=_0xabee('0x4c');_0x1fc0da[_0xabee('0x4d')]=_0x4f36a4[_0xabee('0xe')];_0x1fc0da[_0xabee('0x4e')]=_0x3e277d['user'][_0xabee('0xe')];_0x1fc0da[_0xabee('0x4f')]=_0x3e277d[_0xabee('0x50')]['id'];_0x1fc0da['deleted']=!![];_0x1fc0da[_0xabee('0x51')]=moment()[_0xabee('0x52')](_0xabee('0x53'));_0x1fc0da[_0xabee('0x54')]=_0x1b5cf2[_0xabee('0x55')];_0x1fc0da[_0xabee('0x56')]=_0x1b5cf2[_0xabee('0x47')]?_0xabee('0x57'):_0xabee('0x58');return db['CmContact']['find']({'where':{'id':_0x1fc0da[_0xabee('0x59')]},'attributes':[_0xabee('0x5a'),_0xabee('0x5b')]})[_0xabee('0x38')](function(_0x30f70c){if(!_[_0xabee('0x5c')](_0x252f60)&&!_['isNil'](_0x30f70c[_0xabee('0x5a')])){_0x1fc0da[_0xabee('0x5d')]=_0x30f70c[_0xabee('0x5a')];if(!_['isNil'](_0x30f70c['lastName'])){_0x1fc0da[_0xabee('0x5d')]+='\x20'+_0x30f70c['lastName'];}}})['finally'](function(){return db['CmHopperFinal'][_0xabee('0x40')](_0x1fc0da);});}})['then'](function(_0x449530){return db['CmHopperAdditionalPhone'][_0xabee('0x43')]({'where':{'CmHopperId':_0x34dca8}});})['then'](function(){return _0x252f60[_0xabee('0x5')](0xcc)[_0xabee('0x5e')]();})[_0xabee('0x3d')](handleError(_0x252f60,null));};exports[_0xabee('0x5f')]=function(_0x553cfb,_0xc4a70d){var _0x5d52fd=[];return db[_0xabee('0x60')][_0xabee('0x42')]()[_0xabee('0x38')](function(_0x3a41cd){_0x5d52fd=_[_0xabee('0x15')](_0x3a41cd);return _0x553cfb[_0xabee('0x50')][_0xabee('0x61')]({'where':{'type':_0xabee('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xabee('0x63'),_0xabee('0x64')],'raw':!![]});})['then'](function(_0x1d9fc3){if(_0x1d9fc3&&_0x1d9fc3['length']){return db[_0xabee('0x65')][_0xabee('0x66')](function(_0x230d3a){var _0x3d4fef={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xabee('0x53'))},'VoiceQueueId':{'$in':_[_0xabee('0x14')](_0x1d9fc3,'id')},'$or':[{'UserId':null},{'UserId':_0x553cfb[_0xabee('0x50')]['id']}]};var _0x47a0d2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1d9fc3)[_0xabee('0x33')]([_0xabee('0x64'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x553cfb[_0xabee('0x50')]['id']}]};var _0x1e0082={'$or':[_0x3d4fef,_0x47a0d2]};var _0x4a7bef=[];if(_0x553cfb[_0xabee('0x41')]['direction']&&_0x553cfb[_0xabee('0x41')][_0xabee('0x67')]==='prev'){if(!_[_0xabee('0x68')](_0x553cfb[_0xabee('0x41')][_0xabee('0x69')])){_0x1e0082['id']={'$in':_0x553cfb[_0xabee('0x41')][_0xabee('0x69')]};}_0x4a7bef=[[_0xabee('0x6a'),'ASC'],[_0xabee('0x6b'),_0x1d9fc3[0x0][_0xabee('0x63')]===_0xabee('0x6c')?_0xabee('0x6d'):'ASC'],db[_0xabee('0x65')][_0xabee('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xabee('0x6d')]];}else{if(!_[_0xabee('0x68')](_0x553cfb[_0xabee('0x41')]['hopperIds'])){_0x1e0082['id']={'$notIn':_0x553cfb[_0xabee('0x41')][_0xabee('0x69')]};}_0x4a7bef=[[_0xabee('0x6a'),_0xabee('0x6d')],['scheduledAt',_0x1d9fc3[0x0][_0xabee('0x63')]],db['sequelize'][_0xabee('0x6e')](_0xabee('0x6f')),['id',_0xabee('0x6c')]];}return db[_0xabee('0x37')][_0xabee('0x70')]({'attributes':['id',_0xabee('0x71'),_0xabee('0x55'),'recallme'],'where':_0x1e0082,'order':_0x4a7bef,'transaction':_0x230d3a,'lock':_0x230d3a[_0xabee('0x72')]['UPDATE'],'include':[{'model':db[_0xabee('0x60')],'as':_0xabee('0x73'),'attributes':_0x5d52fd,'include':[{'model':db['CmCompany'],'as':_0xabee('0x74'),'attributes':['id',_0xabee('0xe')]}]},{'model':db['CmList'],'as':_0xabee('0x75'),'attributes':['id',_0xabee('0xe')]},{'model':db[_0xabee('0x45')],'as':'Queue','attributes':['id',_0xabee('0xe'),_0xabee('0x76')]}]})['then'](function(_0x446f9b){if(_0x446f9b){return _0x446f9b[_0xabee('0x77')]({'UserId':_0x553cfb['user']['id']},{'transaction':_0x230d3a});}});});}})[_0xabee('0x38')](handleEntityNotFound(_0xc4a70d,null))[_0xabee('0x38')](respondWithResult(_0xc4a70d,null))[_0xabee('0x3d')](handleError(_0xc4a70d,null));};exports['getPreviewRecall']=function(_0x5e4e68,_0x2e2c08,_0xfc581){var _0x112861=[];var _0x19d112=_0x5e4e68[_0xabee('0x3e')]['id'];var _0x3a9913=_0x5e4e68[_0xabee('0x50')]['id'];return db[_0xabee('0x60')][_0xabee('0x42')]()[_0xabee('0x38')](function(_0x414f81){_0x112861=_[_0xabee('0x15')](_0x414f81);return db['sequelize']['transaction'](function(_0x22f073){const _0x43af53={'id':_0x19d112};return db[_0xabee('0x37')]['findOne']({'attributes':['id',_0xabee('0x71'),'recallme'],'where':_0x43af53,'transaction':_0x22f073,'lock':_0x22f073[_0xabee('0x72')]['UPDATE'],'include':[{'model':db[_0xabee('0x60')],'as':_0xabee('0x73'),'attributes':_0x112861,'include':[{'model':db[_0xabee('0x78')],'as':_0xabee('0x74'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xabee('0x75'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xabee('0x79'),'attributes':['id',_0xabee('0xe'),_0xabee('0x76')]}]})[_0xabee('0x38')](function(_0x235463){if(_0x235463){return _0x235463[_0xabee('0x77')]({'UserId':_0x3a9913},{'transaction':_0x22f073});}});});})[_0xabee('0x38')](handleEntityNotFound(_0x2e2c08,null))['then'](respondWithResult(_0x2e2c08,null))['catch'](handleError(_0x2e2c08,null));};exports[_0xabee('0x7a')]=function(_0x398870,_0x5c49e6){return _0x398870[_0xabee('0x50')][_0xabee('0x61')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xabee('0x7b')},'attributes':['id'],'raw':!![]})[_0xabee('0x38')](function(_0x5eb87b){if(_0x5eb87b&&_0x5eb87b[_0xabee('0x2e')]){return db['CmHopper'][_0xabee('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xabee('0x52')](_0xabee('0x53'))},'VoiceQueueId':{'$in':_[_0xabee('0x14')](_0x5eb87b,'id')},'$or':[{'UserId':null},{'UserId':_0x398870[_0xabee('0x50')]['id']}]}});}return 0x0;})[_0xabee('0x38')](function(_0xe8c89d){if(!_[_0xabee('0x5c')](_0xe8c89d)&&_[_0xabee('0x7c')](_0xe8c89d)){return _0x5c49e6[_0xabee('0x5')](0xc8)[_0xabee('0x6')]({'contacts':_0xe8c89d});}else{logger[_0xabee('0xc')](_0xabee('0x7d'),'getOpenContacts',0x194,_0xabee('0x7e'));_0x5c49e6[_0xabee('0xb')](0x194);}})[_0xabee('0x3d')](handleError(_0x5c49e6,null));};exports['getTimezones']=function(_0x4d72b9,_0x5ed061){var _0x56b37d=shared[_0xabee('0x7f')];var _0x1a6a66=[];_[_0xabee('0x14')](_0x56b37d,function(_0x4433b8){_0x1a6a66[_0xabee('0x80')]({'id':_0x4433b8[_0xabee('0xe')],'name':_0x4433b8[_0xabee('0xe')],'utcOffset':_0x4433b8[_0xabee('0x81')]});});return _0x5ed061[_0xabee('0x5')](0xc8)['json']({'tz':_0x1a6a66});};exports[_0xabee('0x82')]=function(_0x529640,_0x191634){var _0x50a6db=shared['timezones'];var _0x3ded8f={};if(!_[_0xabee('0x5c')](_0x50a6db[_0x529640[_0xabee('0x41')]['id']]))_0x3ded8f=_0x50a6db[_0x529640[_0xabee('0x41')]['id']];return _0x191634['status'](0xc8)[_0xabee('0x6')](_0x3ded8f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 57a254e..e9d1924 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 _0x524e=['define','CmHopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x5eb173,_0x2924f1){var _0x320899=function(_0x63dadd){while(--_0x63dadd){_0x5eb173['push'](_0x5eb173['shift']());}};_0x320899(++_0x2924f1);}(_0x524e,0x15e));var _0xe524=function(_0x2d8006,_0x250123){_0x2d8006=_0x2d8006-0x0;var _0x8b57a2=_0x524e[_0x2d8006];return _0x8b57a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xc')]},{'name':_0xe524('0xd'),'fields':[_0xe524('0xd')]},{'name':_0xe524('0xe'),'fields':[_0xe524('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x474880,_0x35af91){_0x474880=_0x474880-0x0;var _0xe8830f=_0xc6ac[_0x474880];return _0xe8830f;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 7326d4d..b674a93 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 _0xc7bd=['map','include','info','debug','stringify','message','error','ShowCmHopper','find','model','then','CreateCmHopper','catch','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','User','Agent','voicePause','length','push','dataValues','ContactId','transaction','CmHopperFinal','create','MoveContactManagedDialer','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','List','NOW()','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit'];(function(_0x16ee52,_0x5c93a9){var _0x372922=function(_0x15e1e5){while(--_0x15e1e5){_0x16ee52['push'](_0x16ee52['shift']());}};_0x372922(++_0x5c93a9);}(_0xc7bd,0xd9));var _0xdc7b=function(_0x412448,_0x52e9b9){_0x412448=_0x412448-0x0;var _0x4b1920=_0xc7bd[_0x412448];return _0x4b1920;};'use strict';var _=require('lodash');var util=require(_0xdc7b('0x0'));var moment=require(_0xdc7b('0x1'));var BPromise=require(_0xdc7b('0x2'));var db=require(_0xdc7b('0x3'))['db'];var logger=require(_0xdc7b('0x4'))(_0xdc7b('0x5'));exports[_0xdc7b('0x6')]=function(_0x1a900a){var _0x43489a=this;return new Promise(function(_0x51f82b,_0x2ebde2){return db[_0xdc7b('0x7')][_0xdc7b('0x8')]({'raw':_0x1a900a[_0xdc7b('0x9')]?_0x1a900a['options'][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'where':_0x1a900a[_0xdc7b('0x9')]?_0x1a900a[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x1a900a[_0xdc7b('0x9')]?_0x1a900a[_0xdc7b('0x9')][_0xdc7b('0xc')]||null:null,'limit':_0x1a900a[_0xdc7b('0x9')]?_0x1a900a['options'][_0xdc7b('0xd')]||null:null,'include':_0x1a900a['options']?_0x1a900a['options']['include']?_[_0xdc7b('0xe')](_0x1a900a[_0xdc7b('0x9')]['include'],function(_0x29fd1d){return{'model':db[_0x29fd1d['model']],'as':_0x29fd1d['as'],'attributes':_0x29fd1d[_0xdc7b('0xc')],'include':_0x29fd1d[_0xdc7b('0xf')]?_['map'](_0x29fd1d['include'],function(_0x4a22e6){return{'model':db[_0x4a22e6['model']],'as':_0x4a22e6['as'],'attributes':_0x4a22e6[_0xdc7b('0xc')],'include':_0x4a22e6[_0xdc7b('0xf')]?_['map'](_0x4a22e6['include'],function(_0x3ab9bc){return{'model':db[_0x3ab9bc['model']],'as':_0x3ab9bc['as'],'attributes':_0x3ab9bc[_0xdc7b('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x162185){logger[_0xdc7b('0x10')](_0xdc7b('0x6'),_0x1a900a);logger[_0xdc7b('0x11')](_0xdc7b('0x6'),_0x1a900a,JSON[_0xdc7b('0x12')](_0x162185));_0x51f82b(_0x162185);})['catch'](function(_0x244e8c){logger['error'](_0xdc7b('0x6'),_0x244e8c[_0xdc7b('0x13')],_0x1a900a);_0x2ebde2(_0x43489a[_0xdc7b('0x14')](0x1f4,_0x244e8c[_0xdc7b('0x13')]));});});};exports[_0xdc7b('0x15')]=function(_0x271bf6){var _0x25cf7d=this;return new Promise(function(_0x16e5e2,_0x14554c){return db['CmHopper'][_0xdc7b('0x16')]({'raw':_0x271bf6['options']?_0x271bf6[_0xdc7b('0x9')][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'where':_0x271bf6['options']?_0x271bf6[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x271bf6[_0xdc7b('0x9')]?_0x271bf6[_0xdc7b('0x9')][_0xdc7b('0xc')]||null:null,'include':_0x271bf6[_0xdc7b('0x9')]?_0x271bf6[_0xdc7b('0x9')][_0xdc7b('0xf')]?_[_0xdc7b('0xe')](_0x271bf6[_0xdc7b('0x9')]['include'],function(_0x53d8b4){return{'model':db[_0x53d8b4[_0xdc7b('0x17')]],'as':_0x53d8b4['as'],'attributes':_0x53d8b4['attributes'],'include':_0x53d8b4[_0xdc7b('0xf')]?_['map'](_0x53d8b4[_0xdc7b('0xf')],function(_0xbc3f6){return{'model':db[_0xbc3f6[_0xdc7b('0x17')]],'as':_0xbc3f6['as'],'attributes':_0xbc3f6[_0xdc7b('0xc')],'include':_0xbc3f6['include']?_[_0xdc7b('0xe')](_0xbc3f6[_0xdc7b('0xf')],function(_0x12a9be){return{'model':db[_0x12a9be[_0xdc7b('0x17')]],'as':_0x12a9be['as'],'attributes':_0x12a9be[_0xdc7b('0xc')]};}):[]};}):[]};}):[]:[]})[_0xdc7b('0x18')](function(_0x8f2816){logger[_0xdc7b('0x10')](_0xdc7b('0x15'),_0x271bf6);logger[_0xdc7b('0x11')](_0xdc7b('0x15'),_0x271bf6,JSON[_0xdc7b('0x12')](_0x8f2816));_0x16e5e2(_0x8f2816);})['catch'](function(_0x2f57e7){logger[_0xdc7b('0x14')]('ShowCmHopper',_0x2f57e7[_0xdc7b('0x13')],_0x271bf6);_0x14554c(_0x25cf7d[_0xdc7b('0x14')](0x1f4,_0x2f57e7['message']));});});};exports[_0xdc7b('0x19')]=function(_0x500536){var _0x4c9a05=this;return new Promise(function(_0x4ff640,_0x42dccb){return db[_0xdc7b('0x7')]['create'](_0x500536['body'],{'raw':_0x500536['options']?_0x500536[_0xdc7b('0x9')][_0xdc7b('0xa')]===undefined?!![]:![]:!![]})[_0xdc7b('0x18')](function(_0x32cb7){logger[_0xdc7b('0x10')](_0xdc7b('0x19'),_0x500536);logger[_0xdc7b('0x11')]('CreateCmHopper',_0x500536,JSON['stringify'](_0x32cb7));_0x4ff640(_0x32cb7);})[_0xdc7b('0x1a')](function(_0x41f561){logger['error'](_0xdc7b('0x19'),_0x41f561['message'],_0x500536);_0x42dccb(_0x4c9a05[_0xdc7b('0x14')](0x1f4,_0x41f561['message']));});});};exports[_0xdc7b('0x1b')]=function(_0x4d1533){var _0x4b4ae9=this;return new Promise(function(_0x286813,_0x5e675a){return db[_0xdc7b('0x7')][_0xdc7b('0x1c')](_0x4d1533[_0xdc7b('0x1d')],{'raw':_0x4d1533[_0xdc7b('0x9')]?_0x4d1533['options'][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d1533[_0xdc7b('0x9')]?_0x4d1533[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x4d1533[_0xdc7b('0x9')]?_0x4d1533[_0xdc7b('0x9')][_0xdc7b('0xc')]||null:null,'limit':_0x4d1533[_0xdc7b('0x9')]?_0x4d1533['options'][_0xdc7b('0xd')]||null:null})[_0xdc7b('0x18')](function(_0x55cbb6){logger['info'](_0xdc7b('0x1b'),_0x4d1533);logger[_0xdc7b('0x10')](_0xdc7b('0x1e'),JSON[_0xdc7b('0x12')](_0x4d1533[_0xdc7b('0x9')][_0xdc7b('0xb')]),_0x4d1533[_0xdc7b('0x1d')][_0xdc7b('0x1f')]);logger[_0xdc7b('0x11')](_0xdc7b('0x1b'),_0x4d1533,JSON[_0xdc7b('0x12')](_0x55cbb6));_0x286813(_0x55cbb6);})[_0xdc7b('0x1a')](function(_0x34f817){logger[_0xdc7b('0x14')]('UpdateCmHopper',_0x34f817['message'],_0x4d1533);_0x5e675a(_0x4b4ae9[_0xdc7b('0x14')](0x1f4,_0x34f817[_0xdc7b('0x13')]));});});};exports[_0xdc7b('0x20')]=function(_0xce17f9){var _0x3f1600=this;return new Promise(function(_0x1ca5ad,_0x7089da){return db[_0xdc7b('0x7')][_0xdc7b('0x21')]({'where':_0xce17f9[_0xdc7b('0x9')]?_0xce17f9[_0xdc7b('0x9')]['where']||null:null})[_0xdc7b('0x18')](function(_0x1585c5){logger[_0xdc7b('0x10')](_0xdc7b('0x20'),_0xce17f9);logger[_0xdc7b('0x11')](_0xdc7b('0x20'),_0xce17f9,JSON[_0xdc7b('0x12')](_0x1585c5));_0x1ca5ad(_0x1585c5);})[_0xdc7b('0x1a')](function(_0x251393){logger[_0xdc7b('0x14')](_0xdc7b('0x20'),_0x251393['message'],_0xce17f9);_0x7089da(_0x3f1600[_0xdc7b('0x14')](0x1f4,_0x251393[_0xdc7b('0x13')]));});});};exports[_0xdc7b('0x22')]=function(_0x29f47c){var _0x33cf40=this;return new Promise(function(_0x1ed5d2,_0x40dac0){return db[_0xdc7b('0x23')][_0xdc7b('0x24')]()['then'](function(_0x3fb410){return db[_0xdc7b('0x25')]['transaction'](function(_0x45ea97){return db[_0xdc7b('0x7')]['findAll']({'where':_0x29f47c[_0xdc7b('0x9')]?_0x29f47c[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x29f47c[_0xdc7b('0x9')]?_0x29f47c['options']['attributes']||null:null,'limit':_0x29f47c['options']?_0x29f47c[_0xdc7b('0x9')][_0xdc7b('0xd')]||null:null,'order':_0x29f47c[_0xdc7b('0x9')]?_0x29f47c['options'][_0xdc7b('0x26')]||null:null,'transaction':_0x45ea97,'lock':_0x45ea97[_0xdc7b('0x27')][_0xdc7b('0x28')],'include':[{'model':db[_0xdc7b('0x23')],'as':'Contact','attributes':_['keys'](_0x3fb410)},{'model':db[_0xdc7b('0x29')],'as':_0xdc7b('0x2a'),'attributes':['id','name',_0xdc7b('0x2b')]}]})[_0xdc7b('0x18')](function(_0x180e42){var _0x45dd8e=[];var _0x47d4ba=[];for(var _0x3b56f4=0x0;_0x3b56f4<_0x180e42[_0xdc7b('0x2c')];_0x3b56f4+=0x1){var _0x62b132=_0x180e42[_0x3b56f4]['UserId'];if(_0x62b132===null){_0x45dd8e[_0xdc7b('0x2d')](_0x180e42[_0x3b56f4][_0xdc7b('0x1c')](_0x29f47c[_0xdc7b('0x1d')],{'transaction':_0x45ea97}));}else if(!_0x47d4ba['includes'](_0x62b132)){_0x47d4ba[_0xdc7b('0x2d')](_0x62b132);_0x45dd8e[_0xdc7b('0x2d')](_0x180e42[_0x3b56f4][_0xdc7b('0x1c')](_0x29f47c['body'],{'transaction':_0x45ea97}));}}return BPromise['all'](_0x45dd8e);});})[_0xdc7b('0x18')](function(_0x50a2c0){logger['info'](_0xdc7b('0x22'),_0x29f47c);if(_0x50a2c0[_0xdc7b('0x2c')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x50a2c0[0x0][_0xdc7b('0x2e')]['id'],_0x50a2c0[0x0][_0xdc7b('0x2e')][_0xdc7b('0x2f')],_0x50a2c0[0x0][_0xdc7b('0x2e')][_0xdc7b('0x1f')]);}logger['debug']('GetContactDialer',_0x29f47c,JSON['stringify'](_0x50a2c0));_0x1ed5d2(_0x50a2c0);})[_0xdc7b('0x1a')](function(_0x3ee346){logger['error'](_0xdc7b('0x22'),_0x3ee346[_0xdc7b('0x13')],_0x29f47c);_0x40dac0(_0x33cf40[_0xdc7b('0x14')](0x1f4,_0x3ee346[_0xdc7b('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x24cb25){var _0x4f2a03=this;return new Promise(function(_0x4ece6e,_0x4c6a44){return db[_0xdc7b('0x25')][_0xdc7b('0x30')](function(_0x3b9825){return db[_0xdc7b('0x31')][_0xdc7b('0x32')](_0x24cb25[_0xdc7b('0x1d')],{'raw':_0x24cb25[_0xdc7b('0x9')]?_0x24cb25[_0xdc7b('0x9')][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'transaction':_0x3b9825})[_0xdc7b('0x18')](function(){logger[_0xdc7b('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xdc7b('0x12')](_0x24cb25['options'][_0xdc7b('0xb')]),_0x24cb25[_0xdc7b('0x9')][_0xdc7b('0xb')]['active']);return db[_0xdc7b('0x7')][_0xdc7b('0x21')]({'where':_0x24cb25[_0xdc7b('0x9')]?_0x24cb25[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'transaction':_0x3b9825});});})[_0xdc7b('0x18')](function(_0x249fc7){logger[_0xdc7b('0x10')]('MoveContactManagedDialer',_0x24cb25);logger[_0xdc7b('0x11')](_0xdc7b('0x33'),_0x24cb25,JSON[_0xdc7b('0x12')](_0x249fc7));_0x4ece6e(_0x249fc7);})['catch'](function(_0x2c2775){logger[_0xdc7b('0x14')](_0xdc7b('0x33'),_0x2c2775[_0xdc7b('0x13')],_0x24cb25);_0x4c6a44(_0x4f2a03[_0xdc7b('0x14')](0x1f4,_0x2c2775['message']));});});};exports['CountReScheduled']=function(_0xdf194e){var _0x4a4fc2=this;return new Promise(function(_0xec4a5e,_0x36a8b2){return db[_0xdc7b('0x7')]['findAll']({'raw':_0xdf194e[_0xdc7b('0x9')]?_0xdf194e[_0xdc7b('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0xdf194e['options']?_0xdf194e['options'][_0xdc7b('0xb')]||null:null,'attributes':[[db[_0xdc7b('0x25')]['fn'](_0xdc7b('0x34'),db[_0xdc7b('0x25')]['fn']('IF',db['sequelize'][_0xdc7b('0x35')]('`scheduledat`\x20>=\x20'+util['format'](_0xdc7b('0x36'),moment()[_0xdc7b('0x37')](_0xdc7b('0x38')))+_0xdc7b('0x39')))),_0xdc7b('0x3a')]]})[_0xdc7b('0x18')](function(_0x35c378){logger[_0xdc7b('0x10')](_0xdc7b('0x3b'),_0xdf194e);logger[_0xdc7b('0x11')](_0xdc7b('0x3b'),_0xdf194e,JSON['stringify'](_0x35c378));_0xec4a5e(_0x35c378);})[_0xdc7b('0x1a')](function(_0x39592b){logger[_0xdc7b('0x14')](_0xdc7b('0x3b'),_0x39592b[_0xdc7b('0x13')],_0xdf194e);_0x36a8b2(_0x4a4fc2[_0xdc7b('0x14')](0x1f4,_0x39592b['message']));});});};exports[_0xdc7b('0x3c')]=function(_0x122f28){var _0x1b9fcd=this;return new Promise(function(_0x2a53b0,_0xdea304){return db[_0xdc7b('0x23')]['describe']()[_0xdc7b('0x18')](function(){return db[_0xdc7b('0x25')][_0xdc7b('0x30')](function(_0x4da228){return db[_0xdc7b('0x7')][_0xdc7b('0x8')]({'where':_0x122f28[_0xdc7b('0x9')]?_0x122f28[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x122f28['options']?_0x122f28[_0xdc7b('0x9')][_0xdc7b('0xc')]||null:null,'limit':0x1,'order':_0x122f28[_0xdc7b('0x9')]?_0x122f28[_0xdc7b('0x9')][_0xdc7b('0x26')]||null:null,'group':db[_0xdc7b('0x7')]['UserId'],'transaction':_0x4da228,'lock':_0x4da228[_0xdc7b('0x27')][_0xdc7b('0x28')],'include':_0x122f28[_0xdc7b('0x9')]?_0x122f28[_0xdc7b('0x9')]['include']?_['map'](_0x122f28['options'][_0xdc7b('0xf')],function(_0x16525f){return{'model':db[_0x16525f[_0xdc7b('0x17')]],'as':_0x16525f['as'],'attributes':_0x16525f[_0xdc7b('0xc')],'include':_0x16525f[_0xdc7b('0xf')]?_['map'](_0x16525f['include'],function(_0x2ed955){return{'model':db[_0x2ed955[_0xdc7b('0x17')]],'as':_0x2ed955['as'],'attributes':_0x2ed955[_0xdc7b('0xc')],'include':_0x2ed955[_0xdc7b('0xf')]?_[_0xdc7b('0xe')](_0x2ed955['include'],function(_0x162a84){return{'model':db[_0x162a84[_0xdc7b('0x17')]],'as':_0x162a84['as'],'attributes':_0x162a84[_0xdc7b('0xc')]};}):[]};}):[]};}):[]:[]})[_0xdc7b('0x18')](function(_0x33eb5e){var _0x32519b=[];for(var _0x46c2ba=0x0;_0x46c2ba<_0x33eb5e[_0xdc7b('0x2c')];_0x46c2ba+=0x1){_0x32519b[_0xdc7b('0x2d')](_0x33eb5e[_0x46c2ba][_0xdc7b('0x1c')](_0x122f28[_0xdc7b('0x1d')],{'transaction':_0x4da228}));}return BPromise['all'](_0x32519b);});})['then'](function(_0x3d3642){logger['info'](_0xdc7b('0x3c'),_0x122f28);logger[_0xdc7b('0x11')](_0xdc7b('0x3c'),_0x122f28,JSON['stringify'](_0x3d3642));_0x2a53b0(_0x3d3642);})[_0xdc7b('0x1a')](function(_0x5b1157){logger['error'](_0xdc7b('0x3c'),_0x5b1157['message'],_0x122f28);_0xdea304(_0x1b9fcd[_0xdc7b('0x14')](0x1f4,_0x5b1157[_0xdc7b('0x13')]));});});});};exports[_0xdc7b('0x3d')]=function(_0x226988){var _0x482f4d=this;return new Promise(function(_0x5ee642,_0x3c6f26){db[_0xdc7b('0x23')][_0xdc7b('0x24')]()[_0xdc7b('0x18')](function(_0x16a743){return db[_0xdc7b('0x7')][_0xdc7b('0x8')]({'raw':_0x226988[_0xdc7b('0x9')]?_0x226988[_0xdc7b('0x9')][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'where':_0x226988[_0xdc7b('0x9')]?_0x226988[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x226988[_0xdc7b('0x9')]?_0x226988['options']['attributes']||null:null,'limit':_0x226988['options']?_0x226988[_0xdc7b('0x9')][_0xdc7b('0xd')]||null:null,'include':_0x226988['options']?_0x226988[_0xdc7b('0x9')][_0xdc7b('0xf')]?_[_0xdc7b('0xe')](_0x226988[_0xdc7b('0x9')][_0xdc7b('0xf')],function(_0x4fd480){return{'model':db[_0x4fd480[_0xdc7b('0x17')]],'as':_0x4fd480['as'],'attributes':_0x4fd480['as']===_0xdc7b('0x3e')?_[_0xdc7b('0x3f')](_0x16a743):_0x4fd480[_0xdc7b('0xc')],'include':_0x4fd480['include']?_[_0xdc7b('0xe')](_0x4fd480[_0xdc7b('0xf')],function(_0x4f50bd){return{'model':db[_0x4f50bd[_0xdc7b('0x17')]],'as':_0x4f50bd['as'],'attributes':_0x4f50bd[_0xdc7b('0xc')],'include':_0x4f50bd[_0xdc7b('0xf')]?_[_0xdc7b('0xe')](_0x4f50bd[_0xdc7b('0xf')],function(_0x4a9c8a){return{'model':db[_0x4a9c8a[_0xdc7b('0x17')]],'as':_0x4a9c8a['as'],'attributes':_0x4a9c8a[_0xdc7b('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32db1c){logger[_0xdc7b('0x10')](_0xdc7b('0x6'),_0x226988);logger[_0xdc7b('0x11')]('GetCmHopper',_0x226988,JSON[_0xdc7b('0x12')](_0x32db1c));_0x5ee642(_0x32db1c);})[_0xdc7b('0x1a')](function(_0x210d7a){logger[_0xdc7b('0x14')](_0xdc7b('0x6'),_0x210d7a[_0xdc7b('0x13')],_0x226988);_0x3c6f26(_0x482f4d[_0xdc7b('0x14')](0x1f4,_0x210d7a[_0xdc7b('0x13')]));});});});};exports[_0xdc7b('0x40')]=function(_0x3baf55){var _0x1aac14=this;return new Promise(function(_0x534941,_0x2c7c31){return db[_0xdc7b('0x23')][_0xdc7b('0x41')]({'raw':!![],'where':{'phone':_0x3baf55[_0xdc7b('0x9')]['where'][_0xdc7b('0x42')]},'attributes':['id','dialTimezone'],'order':[['id',_0xdc7b('0x43')]]})['then'](function(_0x51ff2e){logger['info']('getContactByPhone',_0x3baf55);logger[_0xdc7b('0x11')](_0xdc7b('0x44'),_0x3baf55,JSON[_0xdc7b('0x12')](_0x51ff2e));_0x534941(_0x51ff2e);})[_0xdc7b('0x1a')](function(_0x140856){logger[_0xdc7b('0x14')](_0xdc7b('0x44'),_0x140856[_0xdc7b('0x13')],_0x3baf55);_0x2c7c31(_0x1aac14[_0xdc7b('0x14')](0x1f4,_0x140856[_0xdc7b('0x13')]));});});};exports['ResetActiveCalls']=function(_0x20de7e){var _0x4e0be6=this;return new Promise(function(_0x347b8e,_0x3a25d1){return db[_0xdc7b('0x25')][_0xdc7b('0x30')](function(_0x3a5295){var _0x3649a1=_0x20de7e['options']&&_0x20de7e[_0xdc7b('0x9')]['where']?_0x20de7e[_0xdc7b('0x9')][_0xdc7b('0xb')]:{};return db[_0xdc7b('0x7')]['update'](_0x20de7e['body'],{'where':_0x3649a1,'transaction':_0x3a5295})[_0xdc7b('0x18')](function(_0x3ae1fa){logger[_0xdc7b('0x10')](_0xdc7b('0x45'),_0x20de7e);logger[_0xdc7b('0x11')]('ResetActiveCalls',_0x20de7e,JSON['stringify'](_0x3ae1fa));_0x347b8e(_0x3ae1fa);})[_0xdc7b('0x1a')](function(_0x10ea32){logger['error'](_0xdc7b('0x45'),_0x10ea32[_0xdc7b('0x13')],_0x20de7e);_0x3a25d1(_0x4e0be6[_0xdc7b('0x14')](0x1f4,_0x10ea32[_0xdc7b('0x13')]));});});});};exports[_0xdc7b('0x46')]=function(_0x328235){var _0x20f711=this;var _0x48491d=_0x328235[_0xdc7b('0x1d')][_0xdc7b('0xb')][_0xdc7b('0x47')];var _0x4707de=_0x328235['body']['where'][_0xdc7b('0x48')];var _0x3512c6=_0x328235[_0xdc7b('0x1d')][_0xdc7b('0xb')][_0xdc7b('0x49')];return new Promise(function(_0x526a12,_0x264638){return db[_0xdc7b('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x48491d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xdc7b('0x25')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x4707de+_0xdc7b('0x4a')),'$gt':db[_0xdc7b('0x25')][_0xdc7b('0x35')]('NOW()')}},'UserId':{'$in':_0x3512c6}},'include':[{'model':db[_0xdc7b('0x23')],'as':_0xdc7b('0x3e')},{'model':db[_0xdc7b('0x29')],'as':_0xdc7b('0x2a'),'attributes':['id','name',_0xdc7b('0x2b')]},{'model':db['CmList'],'as':_0xdc7b('0x4b')}]})[_0xdc7b('0x18')](function(_0x595dda){if(_0x595dda[_0xdc7b('0x2c')]>0x0){return db[_0xdc7b('0x25')][_0xdc7b('0x30')](function(_0x3f08d9){return db[_0xdc7b('0x7')][_0xdc7b('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0xdc7b('0x35')](_0xdc7b('0x4c'))},{'where':{'id':{'$in':_[_0xdc7b('0xe')](_0x595dda,'id')}},'transaction':_0x3f08d9})[_0xdc7b('0x18')](function(){_0x526a12(_0x595dda);})[_0xdc7b('0x1a')](function(_0x1094e2){logger['error'](_0xdc7b('0x46'),_0x1094e2[_0xdc7b('0x13')],_0x328235);_0x264638(_0x20f711[_0xdc7b('0x14')](0x1f4,_0x1094e2[_0xdc7b('0x13')]));});})[_0xdc7b('0x1a')](function(_0x51048f){logger['error'](_0xdc7b('0x46'),_0x51048f[_0xdc7b('0x13')],_0x328235);_0x264638(_0x20f711['error'](0x1f4,_0x51048f['message']));});}else{_0x526a12(_0x595dda);}});});}; \ No newline at end of file +var _0x29fa=['info','create','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','LOCK','UPDATE','CmContact','Contact','keys','name','UserId','push','body','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','transaction','order','length','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()','Agent','voicePause','List','lodash','util','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','attributes','map','model','then','debug','stringify','catch','error','message','ShowCmHopper'];(function(_0x388d04,_0x2a5566){var _0xb664ed=function(_0x90025f){while(--_0x90025f){_0x388d04['push'](_0x388d04['shift']());}};_0xb664ed(++_0x2a5566);}(_0x29fa,0x1e8));var _0xa29f=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x29fa[_0x513545];return _0x18b7c5;};'use strict';var _=require(_0xa29f('0x0'));var util=require(_0xa29f('0x1'));var moment=require('moment');var BPromise=require(_0xa29f('0x2'));var db=require(_0xa29f('0x3'))['db'];var logger=require(_0xa29f('0x4'))('rpc');exports[_0xa29f('0x5')]=function(_0x577813){var _0x1b9ebd=this;return new Promise(function(_0x5c28e3,_0x575e05){return db[_0xa29f('0x6')][_0xa29f('0x7')]({'raw':_0x577813[_0xa29f('0x8')]?_0x577813[_0xa29f('0x8')][_0xa29f('0x9')]===undefined?!![]:![]:!![],'where':_0x577813[_0xa29f('0x8')]?_0x577813[_0xa29f('0x8')][_0xa29f('0xa')]||null:null,'attributes':_0x577813[_0xa29f('0x8')]?_0x577813[_0xa29f('0x8')]['attributes']||null:null,'limit':_0x577813[_0xa29f('0x8')]?_0x577813[_0xa29f('0x8')][_0xa29f('0xb')]||null:null,'include':_0x577813[_0xa29f('0x8')]?_0x577813[_0xa29f('0x8')]['include']?_['map'](_0x577813[_0xa29f('0x8')][_0xa29f('0xc')],function(_0x1d3bd9){return{'model':db[_0x1d3bd9['model']],'as':_0x1d3bd9['as'],'attributes':_0x1d3bd9[_0xa29f('0xd')],'include':_0x1d3bd9['include']?_[_0xa29f('0xe')](_0x1d3bd9[_0xa29f('0xc')],function(_0x3852b9){return{'model':db[_0x3852b9[_0xa29f('0xf')]],'as':_0x3852b9['as'],'attributes':_0x3852b9[_0xa29f('0xd')],'include':_0x3852b9[_0xa29f('0xc')]?_['map'](_0x3852b9[_0xa29f('0xc')],function(_0x29326a){return{'model':db[_0x29326a[_0xa29f('0xf')]],'as':_0x29326a['as'],'attributes':_0x29326a[_0xa29f('0xd')]};}):[]};}):[]};}):[]:[]})[_0xa29f('0x10')](function(_0x4d7bfb){logger['info'](_0xa29f('0x5'),_0x577813);logger[_0xa29f('0x11')](_0xa29f('0x5'),_0x577813,JSON[_0xa29f('0x12')](_0x4d7bfb));_0x5c28e3(_0x4d7bfb);})[_0xa29f('0x13')](function(_0xd8ce62){logger[_0xa29f('0x14')]('GetCmHopper',_0xd8ce62[_0xa29f('0x15')],_0x577813);_0x575e05(_0x1b9ebd['error'](0x1f4,_0xd8ce62[_0xa29f('0x15')]));});});};exports[_0xa29f('0x16')]=function(_0x437d40){var _0x3a6f87=this;return new Promise(function(_0x2c785e,_0x5d0e1a){return db[_0xa29f('0x6')]['find']({'raw':_0x437d40['options']?_0x437d40[_0xa29f('0x8')][_0xa29f('0x9')]===undefined?!![]:![]:!![],'where':_0x437d40[_0xa29f('0x8')]?_0x437d40[_0xa29f('0x8')][_0xa29f('0xa')]||null:null,'attributes':_0x437d40[_0xa29f('0x8')]?_0x437d40[_0xa29f('0x8')][_0xa29f('0xd')]||null:null,'include':_0x437d40['options']?_0x437d40['options'][_0xa29f('0xc')]?_['map'](_0x437d40[_0xa29f('0x8')][_0xa29f('0xc')],function(_0x501737){return{'model':db[_0x501737['model']],'as':_0x501737['as'],'attributes':_0x501737['attributes'],'include':_0x501737[_0xa29f('0xc')]?_[_0xa29f('0xe')](_0x501737[_0xa29f('0xc')],function(_0x4aafbd){return{'model':db[_0x4aafbd[_0xa29f('0xf')]],'as':_0x4aafbd['as'],'attributes':_0x4aafbd[_0xa29f('0xd')],'include':_0x4aafbd[_0xa29f('0xc')]?_[_0xa29f('0xe')](_0x4aafbd['include'],function(_0x4fba0f){return{'model':db[_0x4fba0f['model']],'as':_0x4fba0f['as'],'attributes':_0x4fba0f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c3e1f){logger[_0xa29f('0x17')](_0xa29f('0x16'),_0x437d40);logger[_0xa29f('0x11')](_0xa29f('0x16'),_0x437d40,JSON[_0xa29f('0x12')](_0x3c3e1f));_0x2c785e(_0x3c3e1f);})[_0xa29f('0x13')](function(_0x260153){logger[_0xa29f('0x14')](_0xa29f('0x16'),_0x260153[_0xa29f('0x15')],_0x437d40);_0x5d0e1a(_0x3a6f87['error'](0x1f4,_0x260153['message']));});});};exports['CreateCmHopper']=function(_0x41d374){var _0x3c34d8=this;return new Promise(function(_0x378ac5,_0x337b54){return db[_0xa29f('0x6')][_0xa29f('0x18')](_0x41d374['body'],{'raw':_0x41d374[_0xa29f('0x8')]?_0x41d374[_0xa29f('0x8')][_0xa29f('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x2915f0){logger[_0xa29f('0x17')](_0xa29f('0x19'),_0x41d374);logger[_0xa29f('0x11')](_0xa29f('0x19'),_0x41d374,JSON[_0xa29f('0x12')](_0x2915f0));_0x378ac5(_0x2915f0);})[_0xa29f('0x13')](function(_0x46d9e0){logger[_0xa29f('0x14')](_0xa29f('0x19'),_0x46d9e0[_0xa29f('0x15')],_0x41d374);_0x337b54(_0x3c34d8[_0xa29f('0x14')](0x1f4,_0x46d9e0[_0xa29f('0x15')]));});});};exports[_0xa29f('0x1a')]=function(_0x118926){var _0x484f8f=this;return new Promise(function(_0x3a9667,_0x11d7f7){return db[_0xa29f('0x6')][_0xa29f('0x1b')](_0x118926['body'],{'raw':_0x118926[_0xa29f('0x8')]?_0x118926['options'][_0xa29f('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x118926[_0xa29f('0x8')]?_0x118926[_0xa29f('0x8')][_0xa29f('0xa')]||null:null,'attributes':_0x118926[_0xa29f('0x8')]?_0x118926[_0xa29f('0x8')][_0xa29f('0xd')]||null:null,'limit':_0x118926[_0xa29f('0x8')]?_0x118926[_0xa29f('0x8')][_0xa29f('0xb')]||null:null})[_0xa29f('0x10')](function(_0x62bcda){logger[_0xa29f('0x17')](_0xa29f('0x1a'),_0x118926);logger[_0xa29f('0x17')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xa29f('0x12')](_0x118926[_0xa29f('0x8')]['where']),_0x118926['body'][_0xa29f('0x1c')]);logger[_0xa29f('0x11')]('UpdateCmHopper',_0x118926,JSON['stringify'](_0x62bcda));_0x3a9667(_0x62bcda);})[_0xa29f('0x13')](function(_0x406eb9){logger[_0xa29f('0x14')](_0xa29f('0x1a'),_0x406eb9[_0xa29f('0x15')],_0x118926);_0x11d7f7(_0x484f8f[_0xa29f('0x14')](0x1f4,_0x406eb9[_0xa29f('0x15')]));});});};exports[_0xa29f('0x1d')]=function(_0x5ec6fb){var _0x1ae598=this;return new Promise(function(_0x719cb7,_0x339e8f){return db[_0xa29f('0x6')][_0xa29f('0x1e')]({'where':_0x5ec6fb['options']?_0x5ec6fb['options']['where']||null:null})[_0xa29f('0x10')](function(_0x492eae){logger['info'](_0xa29f('0x1d'),_0x5ec6fb);logger[_0xa29f('0x11')](_0xa29f('0x1d'),_0x5ec6fb,JSON[_0xa29f('0x12')](_0x492eae));_0x719cb7(_0x492eae);})[_0xa29f('0x13')](function(_0x535fae){logger['error']('DestroyCmHopper',_0x535fae[_0xa29f('0x15')],_0x5ec6fb);_0x339e8f(_0x1ae598[_0xa29f('0x14')](0x1f4,_0x535fae[_0xa29f('0x15')]));});});};exports[_0xa29f('0x1f')]=function(_0x15f0da){var _0x1b5ea2=this;return new Promise(function(_0x1d75ab,_0x59b576){return db['CmContact'][_0xa29f('0x20')]()[_0xa29f('0x10')](function(_0x4de329){return db[_0xa29f('0x21')]['transaction'](function(_0x119254){return db['CmHopper']['findAll']({'where':_0x15f0da['options']?_0x15f0da[_0xa29f('0x8')]['where']||null:null,'attributes':_0x15f0da[_0xa29f('0x8')]?_0x15f0da[_0xa29f('0x8')][_0xa29f('0xd')]||null:null,'limit':_0x15f0da[_0xa29f('0x8')]?_0x15f0da[_0xa29f('0x8')][_0xa29f('0xb')]||null:null,'order':_0x15f0da[_0xa29f('0x8')]?_0x15f0da[_0xa29f('0x8')]['order']||null:null,'transaction':_0x119254,'lock':_0x119254[_0xa29f('0x22')][_0xa29f('0x23')],'include':[{'model':db[_0xa29f('0x24')],'as':_0xa29f('0x25'),'attributes':_[_0xa29f('0x26')](_0x4de329)},{'model':db['User'],'as':'Agent','attributes':['id',_0xa29f('0x27'),'voicePause']}]})[_0xa29f('0x10')](function(_0x319b56){var _0x1fe040=[];var _0x3d6916=[];for(var _0x56ca98=0x0;_0x56ca98<_0x319b56['length'];_0x56ca98+=0x1){var _0x3c8101=_0x319b56[_0x56ca98][_0xa29f('0x28')];if(_0x3c8101===null){_0x1fe040[_0xa29f('0x29')](_0x319b56[_0x56ca98][_0xa29f('0x1b')](_0x15f0da[_0xa29f('0x2a')],{'transaction':_0x119254}));}else if(!_0x3d6916['includes'](_0x3c8101)){_0x3d6916['push'](_0x3c8101);_0x1fe040[_0xa29f('0x29')](_0x319b56[_0x56ca98][_0xa29f('0x1b')](_0x15f0da[_0xa29f('0x2a')],{'transaction':_0x119254}));}}return BPromise[_0xa29f('0x2b')](_0x1fe040);});})[_0xa29f('0x10')](function(_0x50382e){logger[_0xa29f('0x17')](_0xa29f('0x1f'),_0x15f0da);if(_0x50382e['length']>0x0){logger[_0xa29f('0x17')](_0xa29f('0x2c'),_0x50382e[0x0][_0xa29f('0x2d')]['id'],_0x50382e[0x0][_0xa29f('0x2d')][_0xa29f('0x2e')],_0x50382e[0x0][_0xa29f('0x2d')][_0xa29f('0x1c')]);}logger[_0xa29f('0x11')](_0xa29f('0x1f'),_0x15f0da,JSON[_0xa29f('0x12')](_0x50382e));_0x1d75ab(_0x50382e);})[_0xa29f('0x13')](function(_0x206f0d){logger[_0xa29f('0x14')](_0xa29f('0x1f'),_0x206f0d[_0xa29f('0x15')],_0x15f0da);_0x59b576(_0x1b5ea2['error'](0x1f4,_0x206f0d['message']));});});});};exports[_0xa29f('0x2f')]=function(_0x270135){var _0x402b8a=this;return new Promise(function(_0x4f2d01,_0x19ba3b){return db[_0xa29f('0x21')]['transaction'](function(_0x12c532){return db[_0xa29f('0x30')][_0xa29f('0x18')](_0x270135[_0xa29f('0x2a')],{'raw':_0x270135[_0xa29f('0x8')]?_0x270135['options'][_0xa29f('0x9')]===undefined?!![]:![]:!![],'transaction':_0x12c532})['then'](function(){logger['info'](_0xa29f('0x31'),JSON['stringify'](_0x270135[_0xa29f('0x8')][_0xa29f('0xa')]),_0x270135[_0xa29f('0x8')][_0xa29f('0xa')][_0xa29f('0x1c')]);return db[_0xa29f('0x6')][_0xa29f('0x1e')]({'where':_0x270135[_0xa29f('0x8')]?_0x270135[_0xa29f('0x8')][_0xa29f('0xa')]||null:null,'transaction':_0x12c532});});})[_0xa29f('0x10')](function(_0x17b2c0){logger['info']('MoveContactManagedDialer',_0x270135);logger[_0xa29f('0x11')]('MoveContactManagedDialer',_0x270135,JSON[_0xa29f('0x12')](_0x17b2c0));_0x4f2d01(_0x17b2c0);})[_0xa29f('0x13')](function(_0x2c4c6f){logger[_0xa29f('0x14')](_0xa29f('0x2f'),_0x2c4c6f[_0xa29f('0x15')],_0x270135);_0x19ba3b(_0x402b8a['error'](0x1f4,_0x2c4c6f[_0xa29f('0x15')]));});});};exports[_0xa29f('0x32')]=function(_0x236ad3){var _0x1c2b3e=this;return new Promise(function(_0x517e3b,_0x325438){return db[_0xa29f('0x6')][_0xa29f('0x7')]({'raw':_0x236ad3[_0xa29f('0x8')]?_0x236ad3[_0xa29f('0x8')][_0xa29f('0x9')]===undefined?!![]:![]:!![],'where':_0x236ad3[_0xa29f('0x8')]?_0x236ad3[_0xa29f('0x8')][_0xa29f('0xa')]||null:null,'attributes':[[db[_0xa29f('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa29f('0x21')][_0xa29f('0x33')]('`scheduledat`\x20>=\x20'+util[_0xa29f('0x34')](_0xa29f('0x35'),moment()['format'](_0xa29f('0x36')))+_0xa29f('0x37')))),'contactsRescheduled']]})[_0xa29f('0x10')](function(_0x11e82d){logger['info'](_0xa29f('0x32'),_0x236ad3);logger[_0xa29f('0x11')]('CountReScheduled',_0x236ad3,JSON[_0xa29f('0x12')](_0x11e82d));_0x517e3b(_0x11e82d);})[_0xa29f('0x13')](function(_0x3f59fc){logger[_0xa29f('0x14')](_0xa29f('0x32'),_0x3f59fc[_0xa29f('0x15')],_0x236ad3);_0x325438(_0x1c2b3e[_0xa29f('0x14')](0x1f4,_0x3f59fc[_0xa29f('0x15')]));});});};exports[_0xa29f('0x38')]=function(_0x1e122a){var _0x304716=this;return new Promise(function(_0x56545b,_0x49234e){return db[_0xa29f('0x24')][_0xa29f('0x20')]()[_0xa29f('0x10')](function(){return db['sequelize'][_0xa29f('0x39')](function(_0x588d7c){return db[_0xa29f('0x6')]['findAll']({'where':_0x1e122a[_0xa29f('0x8')]?_0x1e122a[_0xa29f('0x8')]['where']||null:null,'attributes':_0x1e122a[_0xa29f('0x8')]?_0x1e122a[_0xa29f('0x8')][_0xa29f('0xd')]||null:null,'limit':0x1,'order':_0x1e122a[_0xa29f('0x8')]?_0x1e122a[_0xa29f('0x8')][_0xa29f('0x3a')]||null:null,'group':db[_0xa29f('0x6')][_0xa29f('0x28')],'transaction':_0x588d7c,'lock':_0x588d7c[_0xa29f('0x22')]['UPDATE'],'include':_0x1e122a[_0xa29f('0x8')]?_0x1e122a[_0xa29f('0x8')][_0xa29f('0xc')]?_[_0xa29f('0xe')](_0x1e122a[_0xa29f('0x8')][_0xa29f('0xc')],function(_0x3f1cbd){return{'model':db[_0x3f1cbd['model']],'as':_0x3f1cbd['as'],'attributes':_0x3f1cbd[_0xa29f('0xd')],'include':_0x3f1cbd[_0xa29f('0xc')]?_['map'](_0x3f1cbd[_0xa29f('0xc')],function(_0x292e36){return{'model':db[_0x292e36[_0xa29f('0xf')]],'as':_0x292e36['as'],'attributes':_0x292e36['attributes'],'include':_0x292e36[_0xa29f('0xc')]?_[_0xa29f('0xe')](_0x292e36['include'],function(_0x275066){return{'model':db[_0x275066[_0xa29f('0xf')]],'as':_0x275066['as'],'attributes':_0x275066['attributes']};}):[]};}):[]};}):[]:[]})[_0xa29f('0x10')](function(_0x2c752e){var _0x63702e=[];for(var _0x23cb59=0x0;_0x23cb59<_0x2c752e[_0xa29f('0x3b')];_0x23cb59+=0x1){_0x63702e[_0xa29f('0x29')](_0x2c752e[_0x23cb59][_0xa29f('0x1b')](_0x1e122a[_0xa29f('0x2a')],{'transaction':_0x588d7c}));}return BPromise['all'](_0x63702e);});})[_0xa29f('0x10')](function(_0xb13fec){logger[_0xa29f('0x17')](_0xa29f('0x38'),_0x1e122a);logger[_0xa29f('0x11')]('GetContactRecallMe',_0x1e122a,JSON[_0xa29f('0x12')](_0xb13fec));_0x56545b(_0xb13fec);})['catch'](function(_0x4d0b25){logger[_0xa29f('0x14')](_0xa29f('0x38'),_0x4d0b25['message'],_0x1e122a);_0x49234e(_0x304716[_0xa29f('0x14')](0x1f4,_0x4d0b25[_0xa29f('0x15')]));});});});};exports[_0xa29f('0x3c')]=function(_0x4b6dc9){var _0x285c59=this;return new Promise(function(_0x113547,_0x26b36a){db[_0xa29f('0x24')]['describe']()['then'](function(_0x4c6a79){return db[_0xa29f('0x6')]['findAll']({'raw':_0x4b6dc9[_0xa29f('0x8')]?_0x4b6dc9[_0xa29f('0x8')][_0xa29f('0x9')]===undefined?!![]:![]:!![],'where':_0x4b6dc9[_0xa29f('0x8')]?_0x4b6dc9['options'][_0xa29f('0xa')]||null:null,'attributes':_0x4b6dc9[_0xa29f('0x8')]?_0x4b6dc9['options'][_0xa29f('0xd')]||null:null,'limit':_0x4b6dc9['options']?_0x4b6dc9[_0xa29f('0x8')]['limit']||null:null,'include':_0x4b6dc9[_0xa29f('0x8')]?_0x4b6dc9[_0xa29f('0x8')]['include']?_['map'](_0x4b6dc9['options'][_0xa29f('0xc')],function(_0x172fe){return{'model':db[_0x172fe[_0xa29f('0xf')]],'as':_0x172fe['as'],'attributes':_0x172fe['as']===_0xa29f('0x25')?_[_0xa29f('0x26')](_0x4c6a79):_0x172fe['attributes'],'include':_0x172fe['include']?_[_0xa29f('0xe')](_0x172fe[_0xa29f('0xc')],function(_0x48ac87){return{'model':db[_0x48ac87[_0xa29f('0xf')]],'as':_0x48ac87['as'],'attributes':_0x48ac87['attributes'],'include':_0x48ac87['include']?_['map'](_0x48ac87[_0xa29f('0xc')],function(_0x323120){return{'model':db[_0x323120['model']],'as':_0x323120['as'],'attributes':_0x323120[_0xa29f('0xd')]};}):[]};}):[]};}):[]:[]})[_0xa29f('0x10')](function(_0xacec50){logger['info']('GetCmHopper',_0x4b6dc9);logger[_0xa29f('0x11')](_0xa29f('0x5'),_0x4b6dc9,JSON[_0xa29f('0x12')](_0xacec50));_0x113547(_0xacec50);})[_0xa29f('0x13')](function(_0x5c8b0e){logger[_0xa29f('0x14')](_0xa29f('0x5'),_0x5c8b0e['message'],_0x4b6dc9);_0x26b36a(_0x285c59[_0xa29f('0x14')](0x1f4,_0x5c8b0e[_0xa29f('0x15')]));});});});};exports['GetContactByPhone']=function(_0xe74f28){var _0x1afc03=this;return new Promise(function(_0x577999,_0x5861e6){return db[_0xa29f('0x24')][_0xa29f('0x3d')]({'raw':!![],'where':{'phone':_0xe74f28[_0xa29f('0x8')]['where'][_0xa29f('0x3e')]},'attributes':['id',_0xa29f('0x3f')],'order':[['id',_0xa29f('0x40')]]})['then'](function(_0x487e6a){logger['info']('getContactByPhone',_0xe74f28);logger[_0xa29f('0x11')](_0xa29f('0x41'),_0xe74f28,JSON['stringify'](_0x487e6a));_0x577999(_0x487e6a);})[_0xa29f('0x13')](function(_0x13ced3){logger[_0xa29f('0x14')](_0xa29f('0x41'),_0x13ced3[_0xa29f('0x15')],_0xe74f28);_0x5861e6(_0x1afc03['error'](0x1f4,_0x13ced3[_0xa29f('0x15')]));});});};exports[_0xa29f('0x42')]=function(_0x316641){var _0x4d5e91=this;return new Promise(function(_0x26f5e8,_0x412c64){return db[_0xa29f('0x21')][_0xa29f('0x39')](function(_0x47a2cf){var _0x131a4d=_0x316641[_0xa29f('0x8')]&&_0x316641[_0xa29f('0x8')][_0xa29f('0xa')]?_0x316641[_0xa29f('0x8')]['where']:{};return db[_0xa29f('0x6')][_0xa29f('0x1b')](_0x316641['body'],{'where':_0x131a4d,'transaction':_0x47a2cf})[_0xa29f('0x10')](function(_0xcd3957){logger[_0xa29f('0x17')](_0xa29f('0x42'),_0x316641);logger[_0xa29f('0x11')](_0xa29f('0x42'),_0x316641,JSON[_0xa29f('0x12')](_0xcd3957));_0x26f5e8(_0xcd3957);})['catch'](function(_0xc38cb7){logger[_0xa29f('0x14')](_0xa29f('0x42'),_0xc38cb7[_0xa29f('0x15')],_0x316641);_0x412c64(_0x4d5e91[_0xa29f('0x14')](0x1f4,_0xc38cb7[_0xa29f('0x15')]));});});});};exports[_0xa29f('0x43')]=function(_0x284fdc){var _0x401787=this;var _0x33e13d=_0x284fdc[_0xa29f('0x2a')][_0xa29f('0xa')]['voiceQueueIds'];var _0x1c4860=_0x284fdc[_0xa29f('0x2a')][_0xa29f('0xa')]['interval'];var _0x3f13b6=_0x284fdc[_0xa29f('0x2a')][_0xa29f('0xa')][_0xa29f('0x44')];return new Promise(function(_0x1625ca,_0x588ecb){return db[_0xa29f('0x6')][_0xa29f('0x7')]({'where':{'voiceQueueId':{'$in':_0x33e13d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xa29f('0x21')][_0xa29f('0x33')]('NOW()\x20+\x20INTERVAL\x20'+_0x1c4860+'\x20MINUTE'),'$gt':db[_0xa29f('0x21')]['literal'](_0xa29f('0x45'))}},'UserId':{'$in':_0x3f13b6}},'include':[{'model':db[_0xa29f('0x24')],'as':_0xa29f('0x25')},{'model':db['User'],'as':_0xa29f('0x46'),'attributes':['id',_0xa29f('0x27'),_0xa29f('0x47')]},{'model':db['CmList'],'as':_0xa29f('0x48')}]})['then'](function(_0x33891c){if(_0x33891c[_0xa29f('0x3b')]>0x0){return db[_0xa29f('0x21')][_0xa29f('0x39')](function(_0x28797c){return db[_0xa29f('0x6')][_0xa29f('0x1b')]({'recallmeNotifiedDate':db[_0xa29f('0x21')][_0xa29f('0x33')]('NOW()')},{'where':{'id':{'$in':_[_0xa29f('0xe')](_0x33891c,'id')}},'transaction':_0x28797c})[_0xa29f('0x10')](function(){_0x1625ca(_0x33891c);})[_0xa29f('0x13')](function(_0x38a363){logger['error'](_0xa29f('0x43'),_0x38a363[_0xa29f('0x15')],_0x284fdc);_0x588ecb(_0x401787['error'](0x1f4,_0x38a363[_0xa29f('0x15')]));});})[_0xa29f('0x13')](function(_0x21905b){logger['error'](_0xa29f('0x43'),_0x21905b[_0xa29f('0x15')],_0x284fdc);_0x588ecb(_0x401787[_0xa29f('0x14')](0x1f4,_0x21905b[_0xa29f('0x15')]));});}else{_0x1625ca(_0x33891c);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b86dad5..7107b8c 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 _0x2d63=['/opencontacts','/timezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','delete','destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','/describe','describe'];(function(_0x341081,_0x2a79f6){var _0x38f022=function(_0x813f22){while(--_0x813f22){_0x341081['push'](_0x341081['shift']());}};_0x38f022(++_0x2a79f6);}(_0x2d63,0x117));var _0x32d6=function(_0x40913b,_0x12de86){_0x40913b=_0x40913b-0x0;var _0x5bb838=_0x2d63[_0x40913b];return _0x5bb838;};'use strict';var express=require(_0x32d6('0x0'));var router=express[_0x32d6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x32d6('0x2'));router[_0x32d6('0x3')]('/',auth[_0x32d6('0x4')](),controller['index']);router[_0x32d6('0x3')](_0x32d6('0x5'),auth[_0x32d6('0x4')](),controller[_0x32d6('0x6')]);router[_0x32d6('0x3')](_0x32d6('0x7'),auth[_0x32d6('0x4')](),controller['getOpenContacts']);router[_0x32d6('0x3')](_0x32d6('0x8'),auth[_0x32d6('0x4')](),controller['getTimezones']);router[_0x32d6('0x3')](_0x32d6('0x9'),auth[_0x32d6('0x4')](),controller['show']);router[_0x32d6('0x3')](_0x32d6('0xa'),auth[_0x32d6('0x4')](),controller[_0x32d6('0xb')]);router[_0x32d6('0xc')]('/',auth['isAuthenticated'](),controller[_0x32d6('0xd')]);router[_0x32d6('0xc')](_0x32d6('0xe'),auth[_0x32d6('0x4')](),controller[_0x32d6('0xf')]);router['post']('/timezone',auth[_0x32d6('0x4')](),controller[_0x32d6('0x10')]);router[_0x32d6('0x11')](_0x32d6('0x9'),auth[_0x32d6('0x4')](),controller[_0x32d6('0x12')]);router[_0x32d6('0x13')](_0x32d6('0x9'),auth[_0x32d6('0x4')](),controller[_0x32d6('0x14')]);module[_0x32d6('0x15')]=router; \ No newline at end of file +var _0x7990=['getPreview','/timezone','getTimezone','update','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post'];(function(_0x24664f,_0x494ee7){var _0x29b597=function(_0x39abc2){while(--_0x39abc2){_0x24664f['push'](_0x24664f['shift']());}};_0x29b597(++_0x494ee7);}(_0x7990,0xa0));var _0x0799=function(_0x4be7d8,_0x494c92){_0x4be7d8=_0x4be7d8-0x0;var _0x5c7fc5=_0x7990[_0x4be7d8];return _0x5c7fc5;};'use strict';var express=require(_0x0799('0x0'));var router=express[_0x0799('0x1')]();var auth=require(_0x0799('0x2'));var controller=require(_0x0799('0x3'));router[_0x0799('0x4')]('/',auth[_0x0799('0x5')](),controller[_0x0799('0x6')]);router[_0x0799('0x4')](_0x0799('0x7'),auth[_0x0799('0x5')](),controller[_0x0799('0x8')]);router[_0x0799('0x4')]('/opencontacts',auth[_0x0799('0x5')](),controller[_0x0799('0x9')]);router[_0x0799('0x4')]('/timezones',auth['isAuthenticated'](),controller[_0x0799('0xa')]);router[_0x0799('0x4')](_0x0799('0xb'),auth[_0x0799('0x5')](),controller[_0x0799('0xc')]);router[_0x0799('0x4')](_0x0799('0xd'),auth[_0x0799('0x5')](),controller[_0x0799('0xe')]);router[_0x0799('0xf')]('/',auth[_0x0799('0x5')](),controller['create']);router[_0x0799('0xf')]('/preview',auth[_0x0799('0x5')](),controller[_0x0799('0x10')]);router[_0x0799('0xf')](_0x0799('0x11'),auth[_0x0799('0x5')](),controller[_0x0799('0x12')]);router['put'](_0x0799('0xb'),auth[_0x0799('0x5')](),controller[_0x0799('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0799('0x14')]);module[_0x0799('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index b7c28bc..1e0dc50 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 _0x0f51=['format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','DATE'];(function(_0x4722d9,_0x5749e4){var _0x4221c4=function(_0x4f243f){while(--_0x4f243f){_0x4722d9['push'](_0x4722d9['shift']());}};_0x4221c4(++_0x5749e4);}(_0x0f51,0x194));var _0x10f5=function(_0x188a2a,_0x368961){_0x188a2a=_0x188a2a-0x0;var _0x38598a=_0x0f51[_0x188a2a];return _0x38598a;};'use strict';var moment=require(_0x10f5('0x0'));var Sequelize=require('sequelize');module[_0x10f5('0x1')]={'CmHopperId':{'type':Sequelize[_0x10f5('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x10f5('0x3')],'defaultValue':moment()[_0x10f5('0x4')](_0x10f5('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e97=['format','YYYY-MM-DD\x20HH:mm:ss','exports','STRING','INTEGER','DATE'];(function(_0x1fbcb0,_0x4e10a5){var _0x375c98=function(_0x332022){while(--_0x332022){_0x1fbcb0['push'](_0x1fbcb0['shift']());}};_0x375c98(++_0x4e10a5);}(_0x0e97,0x1ca));var _0x70e9=function(_0x179998,_0x314a0e){_0x179998=_0x179998-0x0;var _0xae5746=_0x0e97[_0x179998];return _0xae5746;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x70e9('0x0')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x70e9('0x1')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x70e9('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x70e9('0x3')],'defaultValue':moment()[_0x70e9('0x4')](_0x70e9('0x5'))},'countbusyretry':{'type':Sequelize[_0x70e9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x70e9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x70e9('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x70e9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x70e9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x70e9('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x70e9('0x2')],'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 7ccd319..d6163f9 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 _0x17df=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','include','findAll','show','params','CmHopperAdditionalPhone','fields','includeAll','options','find','catch','create','body','user'];(function(_0x49ee80,_0x3668af){var _0x4c8d54=function(_0x7b94ed){while(--_0x7b94ed){_0x49ee80['push'](_0x49ee80['shift']());}};_0x4c8d54(++_0x3668af);}(_0x17df,0x1a5));var _0xf17d=function(_0x1c5ae7,_0x1c375f){_0x1c5ae7=_0x1c5ae7-0x0;var _0x4a449a=_0x17df[_0x1c5ae7];return _0x4a449a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf17d('0x0'));var zipdir=require(_0xf17d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf17d('0x2'));var moment=require('moment');var BPromise=require(_0xf17d('0x3'));var Mustache=require(_0xf17d('0x4'));var util=require(_0xf17d('0x5'));var path=require(_0xf17d('0x6'));var sox=require(_0xf17d('0x7'));var csv=require(_0xf17d('0x8'));var ejs=require(_0xf17d('0x9'));var fs=require('fs');var fs_extra=require(_0xf17d('0xa'));var _=require(_0xf17d('0xb'));var squel=require(_0xf17d('0xc'));var crypto=require('crypto');var jsforce=require(_0xf17d('0xd'));var deskjs=require(_0xf17d('0xe'));var toCsv=require(_0xf17d('0x8'));var querystring=require(_0xf17d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf17d('0x10'));var qs=require(_0xf17d('0x11'));var as=require(_0xf17d('0x12'));var hardwareService=require(_0xf17d('0x13'));var logger=require(_0xf17d('0x14'))(_0xf17d('0x15'));var utils=require(_0xf17d('0x16'));var config=require(_0xf17d('0x17'));var licenseUtil=require(_0xf17d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a9021,_0x410280){_0x410280=_0x410280||0xcc;return function(_0x359206){if(_0x359206){return _0x1a9021[_0xf17d('0x19')](_0x410280);}return _0x1a9021[_0xf17d('0x1a')](_0x410280)['end']();};}function respondWithResult(_0x1fdc81,_0x1f6382){_0x1f6382=_0x1f6382||0xc8;return function(_0x43b78b){if(_0x43b78b){return _0x1fdc81[_0xf17d('0x1a')](_0x1f6382)[_0xf17d('0x1b')](_0x43b78b);}};}function respondWithFilteredResult(_0x19d88c,_0x1f7adb){return function(_0x2a7fad){if(_0x2a7fad){var _0x4ef9ff=typeof _0x1f7adb[_0xf17d('0x1c')]===_0xf17d('0x1d')&&typeof _0x1f7adb[_0xf17d('0x1e')]===_0xf17d('0x1d');var _0x3ca987=_0x2a7fad[_0xf17d('0x1f')];var _0x33a857=_0x4ef9ff?0x0:_0x1f7adb[_0xf17d('0x1c')];var _0x1df82a=_0x4ef9ff?_0x2a7fad['count']:_0x1f7adb[_0xf17d('0x1c')]+_0x1f7adb[_0xf17d('0x1e')];var _0x305a2c;if(_0x1df82a>=_0x3ca987){_0x1df82a=_0x3ca987;_0x305a2c=0xc8;}else{_0x305a2c=0xce;}_0x19d88c[_0xf17d('0x1a')](_0x305a2c);return _0x19d88c[_0xf17d('0x20')]('Content-Range',_0x33a857+'-'+_0x1df82a+'/'+_0x3ca987)[_0xf17d('0x1b')](_0x2a7fad);}return null;};}function patchUpdates(_0x3f5d2f){return function(_0x18a81e){try{jsonpatch[_0xf17d('0x21')](_0x18a81e,_0x3f5d2f,!![]);}catch(_0x576678){return BPromise[_0xf17d('0x22')](_0x576678);}return _0x18a81e[_0xf17d('0x23')]();};}function saveUpdates(_0x3dd5c7,_0x1d32bb){return function(_0x482f67){if(_0x482f67){return _0x482f67['update'](_0x3dd5c7)['then'](function(_0x17eef5){return _0x17eef5;});}return null;};}function removeEntity(_0x1722b7,_0x45bf05){return function(_0x546f1a){if(_0x546f1a){return _0x546f1a[_0xf17d('0x24')]()[_0xf17d('0x25')](function(){var _0x525115=_0x546f1a[_0xf17d('0x26')]({'plain':!![]});var _0x31c587=_0xf17d('0x27');return db[_0xf17d('0x28')][_0xf17d('0x24')]({'where':{'type':_0x31c587,'resourceId':_0x525115['id']}})['then'](function(){return _0x546f1a;});})[_0xf17d('0x25')](function(){_0x1722b7['status'](0xcc)[_0xf17d('0x29')]();});}};}function handleEntityNotFound(_0x2f4259,_0x5d8024){return function(_0x300cdb){if(!_0x300cdb){_0x2f4259[_0xf17d('0x19')](0x194);}return _0x300cdb;};}function handleError(_0x349694,_0x18da38){_0x18da38=_0x18da38||0x1f4;return function(_0x500892){logger[_0xf17d('0x2a')](_0x500892[_0xf17d('0x2b')]);if(_0x500892[_0xf17d('0x2c')]){delete _0x500892[_0xf17d('0x2c')];}_0x349694[_0xf17d('0x1a')](_0x18da38)[_0xf17d('0x2d')](_0x500892);};}exports[_0xf17d('0x2e')]=function(_0x52ba4c,_0x1434f1){var _0x1c36ea={},_0x540b05={},_0x23339b={'count':0x0,'rows':[]};var _0x47852c=_['map'](db['CmHopperAdditionalPhone'][_0xf17d('0x2f')],function(_0x50c49a){return{'name':_0x50c49a['fieldName'],'type':_0x50c49a[_0xf17d('0x30')][_0xf17d('0x31')]};});_0x540b05[_0xf17d('0x32')]=_[_0xf17d('0x33')](_0x47852c,_0xf17d('0x2c'));_0x540b05[_0xf17d('0x34')]=_[_0xf17d('0x35')](_0x52ba4c[_0xf17d('0x34')]);_0x540b05[_0xf17d('0x36')]=_[_0xf17d('0x37')](_0x540b05[_0xf17d('0x32')],_0x540b05[_0xf17d('0x34')]);_0x1c36ea['attributes']=_['intersection'](_0x540b05[_0xf17d('0x32')],qs['fields'](_0x52ba4c[_0xf17d('0x34')]['fields']));_0x1c36ea[_0xf17d('0x38')]=_0x1c36ea[_0xf17d('0x38')][_0xf17d('0x39')]?_0x1c36ea[_0xf17d('0x38')]:_0x540b05['model'];if(!_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x3a')]('nolimit')){_0x1c36ea[_0xf17d('0x1e')]=qs[_0xf17d('0x1e')](_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x1e')]);_0x1c36ea[_0xf17d('0x1c')]=qs[_0xf17d('0x1c')](_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x1c')]);}_0x1c36ea[_0xf17d('0x3b')]=qs[_0xf17d('0x3c')](_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x3c')]);_0x1c36ea[_0xf17d('0x3d')]=qs[_0xf17d('0x36')](_['pick'](_0x52ba4c[_0xf17d('0x34')],_0x540b05[_0xf17d('0x36')]),_0x47852c);if(_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x3e')]){_0x1c36ea[_0xf17d('0x3d')]=_[_0xf17d('0x3f')](_0x1c36ea['where'],{'$or':_[_0xf17d('0x33')](_0x47852c,function(_0x32e511){if(_0x32e511[_0xf17d('0x30')]!=='VIRTUAL'){var _0xcfd2e6={};_0xcfd2e6[_0x32e511['name']]={'$like':'%'+_0x52ba4c['query'][_0xf17d('0x3e')]+'%'};return _0xcfd2e6;}})});}_0x1c36ea=_[_0xf17d('0x3f')]({},_0x1c36ea,_0x52ba4c['options']);var _0xd2a0a4={'where':_0x1c36ea[_0xf17d('0x3d')]};return db['CmHopperAdditionalPhone']['count'](_0xd2a0a4)['then'](function(_0x1ee2c9){_0x23339b[_0xf17d('0x1f')]=_0x1ee2c9;if(_0x52ba4c[_0xf17d('0x34')]['includeAll']){_0x1c36ea[_0xf17d('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xf17d('0x41')](_0x1c36ea);})['then'](function(_0xe80b91){_0x23339b['rows']=_0xe80b91;return _0x23339b;})['then'](respondWithFilteredResult(_0x1434f1,_0x1c36ea))['catch'](handleError(_0x1434f1,null));};exports[_0xf17d('0x42')]=function(_0x2f0dd0,_0x2d5159){var _0x1c99c5={'raw':!![],'where':{'id':_0x2f0dd0[_0xf17d('0x43')]['id']}},_0x2518ff={};_0x2518ff['model']=_[_0xf17d('0x35')](db[_0xf17d('0x44')][_0xf17d('0x2f')]);_0x2518ff['query']=_['keys'](_0x2f0dd0[_0xf17d('0x34')]);_0x2518ff[_0xf17d('0x36')]=_[_0xf17d('0x37')](_0x2518ff[_0xf17d('0x32')],_0x2518ff[_0xf17d('0x34')]);_0x1c99c5[_0xf17d('0x38')]=_[_0xf17d('0x37')](_0x2518ff['model'],qs[_0xf17d('0x45')](_0x2f0dd0[_0xf17d('0x34')][_0xf17d('0x45')]));_0x1c99c5[_0xf17d('0x38')]=_0x1c99c5[_0xf17d('0x38')]['length']?_0x1c99c5[_0xf17d('0x38')]:_0x2518ff['model'];if(_0x2f0dd0[_0xf17d('0x34')][_0xf17d('0x46')]){_0x1c99c5[_0xf17d('0x40')]=[{'all':!![]}];}_0x1c99c5=_[_0xf17d('0x3f')]({},_0x1c99c5,_0x2f0dd0[_0xf17d('0x47')]);return db[_0xf17d('0x44')][_0xf17d('0x48')](_0x1c99c5)[_0xf17d('0x25')](handleEntityNotFound(_0x2d5159,null))[_0xf17d('0x25')](respondWithResult(_0x2d5159,null))[_0xf17d('0x49')](handleError(_0x2d5159,null));};exports['create']=function(_0x4b1bd9,_0x388661){return db[_0xf17d('0x44')][_0xf17d('0x4a')](_0x4b1bd9[_0xf17d('0x4b')],{})[_0xf17d('0x25')](function(_0x63f67c){var _0xa2b0e4=_0x4b1bd9[_0xf17d('0x4c')][_0xf17d('0x26')]({'plain':!![]});if(!_0xa2b0e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa2b0e4[_0xf17d('0x4d')]==='user'){var _0xe039bd=_0x63f67c[_0xf17d('0x26')]({'plain':!![]});var _0x5621ea=_0xf17d('0x27');return db[_0xf17d('0x4e')][_0xf17d('0x48')]({'where':{'name':_0x5621ea,'userProfileId':_0xa2b0e4[_0xf17d('0x4f')]},'raw':!![]})[_0xf17d('0x25')](function(_0x285e44){if(_0x285e44&&_0x285e44[_0xf17d('0x50')]===0x0){return db[_0xf17d('0x28')][_0xf17d('0x4a')]({'name':_0xe039bd[_0xf17d('0x2c')],'resourceId':_0xe039bd['id'],'type':_0x285e44[_0xf17d('0x2c')],'sectionId':_0x285e44['id']},{})[_0xf17d('0x25')](function(){return _0x63f67c;});}else{return _0x63f67c;}})[_0xf17d('0x49')](function(_0x46ddd6){logger[_0xf17d('0x2a')](_0xf17d('0x51'),_0x46ddd6);throw _0x46ddd6;});}return _0x63f67c;})[_0xf17d('0x25')](respondWithResult(_0x388661,0xc9))[_0xf17d('0x49')](handleError(_0x388661,null));};exports[_0xf17d('0x52')]=function(_0x1fd09d,_0x12372c){if(_0x1fd09d[_0xf17d('0x4b')]['id']){delete _0x1fd09d[_0xf17d('0x4b')]['id'];}return db['CmHopperAdditionalPhone'][_0xf17d('0x48')]({'where':{'id':_0x1fd09d['params']['id']}})[_0xf17d('0x25')](handleEntityNotFound(_0x12372c,null))['then'](saveUpdates(_0x1fd09d[_0xf17d('0x4b')],null))['then'](respondWithResult(_0x12372c,null))['catch'](handleError(_0x12372c,null));};exports[_0xf17d('0x24')]=function(_0x25580c,_0x28ec44){return db['CmHopperAdditionalPhone'][_0xf17d('0x48')]({'where':{'id':_0x25580c['params']['id']}})[_0xf17d('0x25')](handleEntityNotFound(_0x28ec44,null))[_0xf17d('0x25')](removeEntity(_0x28ec44,null))[_0xf17d('0x49')](handleError(_0x28ec44,null));}; \ No newline at end of file +var _0x3134=['nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','set','Content-Range','apply','then','destroy','get','end','error','stack','name','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x3134,0x16e));var _0x4313=function(_0x334cbd,_0x47a1ad){_0x334cbd=_0x334cbd-0x0;var _0x48a8ed=_0x3134[_0x334cbd];return _0x48a8ed;};'use strict';var emlformat=require(_0x4313('0x0'));var rimraf=require(_0x4313('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4313('0x2'));var rp=require(_0x4313('0x3'));var moment=require(_0x4313('0x4'));var BPromise=require(_0x4313('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4313('0x6'));var csv=require(_0x4313('0x7'));var ejs=require(_0x4313('0x8'));var fs=require('fs');var fs_extra=require(_0x4313('0x9'));var _=require(_0x4313('0xa'));var squel=require(_0x4313('0xb'));var crypto=require('crypto');var jsforce=require(_0x4313('0xc'));var deskjs=require(_0x4313('0xd'));var toCsv=require(_0x4313('0x7'));var querystring=require('querystring');var Papa=require(_0x4313('0xe'));var Redis=require(_0x4313('0xf'));var authService=require(_0x4313('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4313('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4313('0x12'))(_0x4313('0x13'));var utils=require(_0x4313('0x14'));var config=require(_0x4313('0x15'));var licenseUtil=require(_0x4313('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d63b5,_0x267939){_0x267939=_0x267939||0xcc;return function(_0x543d33){if(_0x543d33){return _0x1d63b5[_0x4313('0x17')](_0x267939);}return _0x1d63b5[_0x4313('0x18')](_0x267939)['end']();};}function respondWithResult(_0x3314d2,_0x59ff4f){_0x59ff4f=_0x59ff4f||0xc8;return function(_0xa16e9){if(_0xa16e9){return _0x3314d2[_0x4313('0x18')](_0x59ff4f)[_0x4313('0x19')](_0xa16e9);}};}function respondWithFilteredResult(_0x8d1a91,_0x5bfad8){return function(_0x47d651){if(_0x47d651){var _0x3c8dbb=typeof _0x5bfad8[_0x4313('0x1a')]===_0x4313('0x1b')&&typeof _0x5bfad8['limit']===_0x4313('0x1b');var _0x3d4e52=_0x47d651['count'];var _0x296974=_0x3c8dbb?0x0:_0x5bfad8['offset'];var _0x34b48a=_0x3c8dbb?_0x47d651['count']:_0x5bfad8[_0x4313('0x1a')]+_0x5bfad8['limit'];var _0xb8429b;if(_0x34b48a>=_0x3d4e52){_0x34b48a=_0x3d4e52;_0xb8429b=0xc8;}else{_0xb8429b=0xce;}_0x8d1a91[_0x4313('0x18')](_0xb8429b);return _0x8d1a91[_0x4313('0x1c')](_0x4313('0x1d'),_0x296974+'-'+_0x34b48a+'/'+_0x3d4e52)[_0x4313('0x19')](_0x47d651);}return null;};}function patchUpdates(_0x162655){return function(_0x58e32d){try{jsonpatch[_0x4313('0x1e')](_0x58e32d,_0x162655,!![]);}catch(_0x4ca5b2){return BPromise['reject'](_0x4ca5b2);}return _0x58e32d['save']();};}function saveUpdates(_0x163ede,_0x24a634){return function(_0x3286af){if(_0x3286af){return _0x3286af['update'](_0x163ede)[_0x4313('0x1f')](function(_0x133c62){return _0x133c62;});}return null;};}function removeEntity(_0x1f37ce,_0x5c8984){return function(_0x196a41){if(_0x196a41){return _0x196a41[_0x4313('0x20')]()['then'](function(){var _0x5cd80f=_0x196a41[_0x4313('0x21')]({'plain':!![]});var _0x1304be='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x1304be,'resourceId':_0x5cd80f['id']}})[_0x4313('0x1f')](function(){return _0x196a41;});})[_0x4313('0x1f')](function(){_0x1f37ce[_0x4313('0x18')](0xcc)[_0x4313('0x22')]();});}};}function handleEntityNotFound(_0x27d85d,_0x49a957){return function(_0x3240a5){if(!_0x3240a5){_0x27d85d[_0x4313('0x17')](0x194);}return _0x3240a5;};}function handleError(_0x4054bb,_0x1c9fb2){_0x1c9fb2=_0x1c9fb2||0x1f4;return function(_0x1ef629){logger[_0x4313('0x23')](_0x1ef629[_0x4313('0x24')]);if(_0x1ef629[_0x4313('0x25')]){delete _0x1ef629['name'];}_0x4054bb[_0x4313('0x18')](_0x1c9fb2)['send'](_0x1ef629);};}exports[_0x4313('0x26')]=function(_0x29e015,_0x10e317){var _0x395e4e={},_0x3c3dcb={},_0x2e710b={'count':0x0,'rows':[]};var _0x932bf2=_['map'](db[_0x4313('0x27')][_0x4313('0x28')],function(_0x1add12){return{'name':_0x1add12[_0x4313('0x29')],'type':_0x1add12[_0x4313('0x2a')][_0x4313('0x2b')]};});_0x3c3dcb['model']=_[_0x4313('0x2c')](_0x932bf2,_0x4313('0x25'));_0x3c3dcb[_0x4313('0x2d')]=_[_0x4313('0x2e')](_0x29e015[_0x4313('0x2d')]);_0x3c3dcb[_0x4313('0x2f')]=_[_0x4313('0x30')](_0x3c3dcb['model'],_0x3c3dcb['query']);_0x395e4e[_0x4313('0x31')]=_[_0x4313('0x30')](_0x3c3dcb[_0x4313('0x32')],qs[_0x4313('0x33')](_0x29e015['query'][_0x4313('0x33')]));_0x395e4e[_0x4313('0x31')]=_0x395e4e[_0x4313('0x31')][_0x4313('0x34')]?_0x395e4e['attributes']:_0x3c3dcb[_0x4313('0x32')];if(!_0x29e015[_0x4313('0x2d')][_0x4313('0x35')](_0x4313('0x36'))){_0x395e4e['limit']=qs['limit'](_0x29e015[_0x4313('0x2d')][_0x4313('0x37')]);_0x395e4e[_0x4313('0x1a')]=qs[_0x4313('0x1a')](_0x29e015[_0x4313('0x2d')][_0x4313('0x1a')]);}_0x395e4e[_0x4313('0x38')]=qs[_0x4313('0x39')](_0x29e015['query'][_0x4313('0x39')]);_0x395e4e['where']=qs['filters'](_[_0x4313('0x3a')](_0x29e015[_0x4313('0x2d')],_0x3c3dcb[_0x4313('0x2f')]),_0x932bf2);if(_0x29e015[_0x4313('0x2d')][_0x4313('0x3b')]){_0x395e4e[_0x4313('0x3c')]=_[_0x4313('0x3d')](_0x395e4e[_0x4313('0x3c')],{'$or':_[_0x4313('0x2c')](_0x932bf2,function(_0x486ced){if(_0x486ced['type']!==_0x4313('0x3e')){var _0x3c3e82={};_0x3c3e82[_0x486ced['name']]={'$like':'%'+_0x29e015[_0x4313('0x2d')][_0x4313('0x3b')]+'%'};return _0x3c3e82;}})});}_0x395e4e=_[_0x4313('0x3d')]({},_0x395e4e,_0x29e015[_0x4313('0x3f')]);var _0xd4c36f={'where':_0x395e4e['where']};return db[_0x4313('0x27')]['count'](_0xd4c36f)[_0x4313('0x1f')](function(_0x5a5c2a){_0x2e710b[_0x4313('0x40')]=_0x5a5c2a;if(_0x29e015['query'][_0x4313('0x41')]){_0x395e4e[_0x4313('0x42')]=[{'all':!![]}];}return db[_0x4313('0x27')][_0x4313('0x43')](_0x395e4e);})[_0x4313('0x1f')](function(_0x18fb44){_0x2e710b[_0x4313('0x44')]=_0x18fb44;return _0x2e710b;})[_0x4313('0x1f')](respondWithFilteredResult(_0x10e317,_0x395e4e))[_0x4313('0x45')](handleError(_0x10e317,null));};exports[_0x4313('0x46')]=function(_0x141f45,_0x10a884){var _0x2122b9={'raw':!![],'where':{'id':_0x141f45[_0x4313('0x47')]['id']}},_0xf9f813={};_0xf9f813[_0x4313('0x32')]=_[_0x4313('0x2e')](db['CmHopperAdditionalPhone'][_0x4313('0x28')]);_0xf9f813[_0x4313('0x2d')]=_[_0x4313('0x2e')](_0x141f45[_0x4313('0x2d')]);_0xf9f813['filters']=_[_0x4313('0x30')](_0xf9f813['model'],_0xf9f813[_0x4313('0x2d')]);_0x2122b9[_0x4313('0x31')]=_[_0x4313('0x30')](_0xf9f813[_0x4313('0x32')],qs['fields'](_0x141f45['query'][_0x4313('0x33')]));_0x2122b9[_0x4313('0x31')]=_0x2122b9['attributes'][_0x4313('0x34')]?_0x2122b9[_0x4313('0x31')]:_0xf9f813[_0x4313('0x32')];if(_0x141f45['query']['includeAll']){_0x2122b9[_0x4313('0x42')]=[{'all':!![]}];}_0x2122b9=_[_0x4313('0x3d')]({},_0x2122b9,_0x141f45[_0x4313('0x3f')]);return db['CmHopperAdditionalPhone'][_0x4313('0x48')](_0x2122b9)[_0x4313('0x1f')](handleEntityNotFound(_0x10a884,null))[_0x4313('0x1f')](respondWithResult(_0x10a884,null))[_0x4313('0x45')](handleError(_0x10a884,null));};exports[_0x4313('0x49')]=function(_0x285980,_0x574ce9){return db[_0x4313('0x27')][_0x4313('0x49')](_0x285980[_0x4313('0x4a')],{})[_0x4313('0x1f')](function(_0x4164fe){var _0x1c7dc5=_0x285980[_0x4313('0x4b')][_0x4313('0x21')]({'plain':!![]});if(!_0x1c7dc5)throw new Error(_0x4313('0x4c'));if(_0x1c7dc5[_0x4313('0x4d')]===_0x4313('0x4b')){var _0x34612b=_0x4164fe[_0x4313('0x21')]({'plain':!![]});var _0x162b01=_0x4313('0x4e');return db[_0x4313('0x4f')][_0x4313('0x48')]({'where':{'name':_0x162b01,'userProfileId':_0x1c7dc5['userProfileId']},'raw':!![]})['then'](function(_0x6c7de3){if(_0x6c7de3&&_0x6c7de3[_0x4313('0x50')]===0x0){return db[_0x4313('0x51')][_0x4313('0x49')]({'name':_0x34612b[_0x4313('0x25')],'resourceId':_0x34612b['id'],'type':_0x6c7de3[_0x4313('0x25')],'sectionId':_0x6c7de3['id']},{})[_0x4313('0x1f')](function(){return _0x4164fe;});}else{return _0x4164fe;}})[_0x4313('0x45')](function(_0x2074c1){logger['error'](_0x4313('0x52'),_0x2074c1);throw _0x2074c1;});}return _0x4164fe;})[_0x4313('0x1f')](respondWithResult(_0x574ce9,0xc9))[_0x4313('0x45')](handleError(_0x574ce9,null));};exports[_0x4313('0x53')]=function(_0x1aa294,_0x5b5b69){if(_0x1aa294[_0x4313('0x4a')]['id']){delete _0x1aa294[_0x4313('0x4a')]['id'];}return db[_0x4313('0x27')][_0x4313('0x48')]({'where':{'id':_0x1aa294[_0x4313('0x47')]['id']}})[_0x4313('0x1f')](handleEntityNotFound(_0x5b5b69,null))['then'](saveUpdates(_0x1aa294[_0x4313('0x4a')],null))[_0x4313('0x1f')](respondWithResult(_0x5b5b69,null))[_0x4313('0x45')](handleError(_0x5b5b69,null));};exports['destroy']=function(_0x197286,_0x28fe14){return db[_0x4313('0x27')][_0x4313('0x48')]({'where':{'id':_0x197286[_0x4313('0x47')]['id']}})['then'](handleEntityNotFound(_0x28fe14,null))[_0x4313('0x1f')](removeEntity(_0x28fe14,null))[_0x4313('0x45')](handleError(_0x28fe14,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f9e8dfd..169a867 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 _0xcce3=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','exports','define','CmHopperAdditionalPhone'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xcce3,0x18c));var _0x3cce=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0xcce3[_0x33ebf5];return _0x66957b;};'use strict';var _=require(_0x3cce('0x0'));var util=require('util');var logger=require(_0x3cce('0x1'))(_0x3cce('0x2'));var moment=require(_0x3cce('0x3'));var BPromise=require(_0x3cce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cce('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x3cce('0x6')]=function(_0x5dc817,_0x334f41){return _0x5dc817[_0x3cce('0x7')](_0x3cce('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd0=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x3055ee,_0x464818){var _0x434d13=function(_0x1b3b8a){while(--_0x1b3b8a){_0x3055ee['push'](_0x3055ee['shift']());}};_0x434d13(++_0x464818);}(_0x9fd0,0x1c2));var _0x09fd=function(_0x11fff7,_0x46baaf){_0x11fff7=_0x11fff7-0x0;var _0x5214a5=_0x9fd0[_0x11fff7];return _0x5214a5;};'use strict';var _=require(_0x09fd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x09fd('0x1'));var BPromise=require(_0x09fd('0x2'));var rp=require(_0x09fd('0x3'));var fs=require('fs');var path=require(_0x09fd('0x4'));var rimraf=require(_0x09fd('0x5'));var config=require(_0x09fd('0x6'));var attributes=require(_0x09fd('0x7'));module[_0x09fd('0x8')]=function(_0x509521,_0x2b9262){return _0x509521[_0x09fd('0x9')](_0x09fd('0xa'),attributes,{'tableName':_0x09fd('0xb'),'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 7dd8cd2..fb50c55 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 _0x0cf4=['message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnoanswerretry','countabandonedretry','SwapAdditionalPhones','ListId','waitTime','duration','isNil','scheduledat','add','minutes','phone','countcongestionretry','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x124157,_0x13d8f6){var _0x475783=function(_0x997985){while(--_0x997985){_0x124157['push'](_0x124157['shift']());}};_0x475783(++_0x13d8f6);}(_0x0cf4,0x142));var _0x40cf=function(_0x411289,_0x36dbc8){_0x411289=_0x411289-0x0;var _0x5e72ec=_0x0cf4[_0x411289];return _0x5e72ec;};'use strict';var _=require(_0x40cf('0x0'));var util=require(_0x40cf('0x1'));var moment=require(_0x40cf('0x2'));var BPromise=require(_0x40cf('0x3'));var rs=require(_0x40cf('0x4'));var fs=require('fs');var Redis=require(_0x40cf('0x5'));var db=require(_0x40cf('0x6'))['db'];var utils=require(_0x40cf('0x7'));var logger=require(_0x40cf('0x8'))(_0x40cf('0x9'));var config=require(_0x40cf('0xa'));var jayson=require(_0x40cf('0xb'));var client=jayson[_0x40cf('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37a34a,_0x30703e,_0x2852f7){return new BPromise(function(_0x2c9952,_0xe58832){return client[_0x40cf('0xd')](_0x37a34a,_0x2852f7)[_0x40cf('0xe')](function(_0x3fc1d){logger[_0x40cf('0xf')](_0x40cf('0x10'),_0x30703e,_0x40cf('0x11'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x30703e,'request\x20sent',JSON['stringify'](_0x3fc1d));if(_0x3fc1d[_0x40cf('0x12')]){if(_0x3fc1d['error'][_0x40cf('0x13')]===0x1f4){logger[_0x40cf('0x12')](_0x40cf('0x10'),_0x30703e,_0x3fc1d[_0x40cf('0x12')][_0x40cf('0x14')]);return _0xe58832(_0x3fc1d['error'][_0x40cf('0x14')]);}logger[_0x40cf('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x30703e,_0x3fc1d[_0x40cf('0x12')]['message']);return _0x2c9952(_0x3fc1d[_0x40cf('0x12')][_0x40cf('0x14')]);}else{logger[_0x40cf('0xf')](_0x40cf('0x10'),_0x30703e,_0x40cf('0x11'));_0x2c9952(_0x3fc1d[_0x40cf('0x15')][_0x40cf('0x14')]);}})[_0x40cf('0x16')](function(_0x119e95){logger[_0x40cf('0x12')](_0x40cf('0x10'),_0x30703e,_0x119e95);_0xe58832(_0x119e95);});});}exports[_0x40cf('0x17')]=function(_0x2553ae){var _0x4d096c=this;return new Promise(function(_0x20061b,_0x2fd337){return db[_0x40cf('0x18')][_0x40cf('0x19')]({'raw':!![],'where':{'ContactId':_0x2553ae[_0x40cf('0x1a')]['ContactId'],'ListId':_0x2553ae['body']['ListId'],'VoiceQueueId':_0x2553ae['body']['VoiceQueueId']===undefined?null:_0x2553ae[_0x40cf('0x1a')][_0x40cf('0x1b')],'CampaignId':_0x2553ae[_0x40cf('0x1a')][_0x40cf('0x1c')]===undefined?null:_0x2553ae[_0x40cf('0x1a')][_0x40cf('0x1c')]}})[_0x40cf('0xe')](function(_0x4fd6dc){if(_0x4fd6dc!=null){return db['CmHopperAdditionalPhone'][_0x40cf('0x19')]({'raw':!![],'where':{'CmHopperId':_0x4fd6dc['id'],'OrderBy':{'$gt':_0x4fd6dc['OrderBy']}},'order':[[_0x40cf('0x1d'),_0x40cf('0x1e')]]})['then'](function(_0x5e8809){var _0x50a67c=0x0;if(_0x5e8809){if(_0x5e8809[_0x40cf('0x1f')]+_0x5e8809['countcongestionretry']+_0x5e8809['countnoanswerretry']+_0x5e8809[_0x40cf('0x20')]+_0x5e8809[_0x40cf('0x21')]+_0x5e8809['countabandonedretry']+_0x5e8809[_0x40cf('0x22')]+_0x5e8809[_0x40cf('0x23')]<_0x2553ae[_0x40cf('0x24')][_0x40cf('0x25')])_0x50a67c=0x1;_0x20061b({'additional':_0x50a67c});}else{return db[_0x40cf('0x26')][_0x40cf('0x19')]({'raw':!![],'where':{'CmHopperId':_0x4fd6dc['id']},'order':[['OrderBy',_0x40cf('0x1e')]]})[_0x40cf('0xe')](function(_0x4e1449){var _0x4692da=0x0;if(_0x4e1449){if(_0x4e1449[_0x40cf('0x1f')]+_0x4e1449['countcongestionretry']+_0x4e1449[_0x40cf('0x27')]+_0x4e1449[_0x40cf('0x20')]+_0x4e1449['countdropretry']+_0x4e1449[_0x40cf('0x28')]+_0x4e1449[_0x40cf('0x22')]+_0x4e1449[_0x40cf('0x23')]<_0x2553ae[_0x40cf('0x24')]['dialGlobalMaxRetry'])_0x4692da=0x1;_0x20061b({'additional':_0x4692da});}else{_0x20061b({'additional':0x0});}})['catch'](function(_0x384943){logger[_0x40cf('0x12')](_0x40cf('0x17'),_0x384943['message']);_0x2fd337(_0x4d096c[_0x40cf('0x12')](0x1f4,_0x384943[_0x40cf('0x14')]));});}})[_0x40cf('0x16')](function(_0x40cff7){logger['error'](_0x40cf('0x17'),_0x40cff7[_0x40cf('0x14')]);_0x2fd337(_0x4d096c[_0x40cf('0x12')](0x1f4,_0x40cff7[_0x40cf('0x14')]));});}else _0x20061b({'additional':0x0});});});};exports[_0x40cf('0x29')]=function(_0x5a5f63){var _0x3456a0=this;return new Promise(function(_0x4a7cf7,_0x3c0747){return db[_0x40cf('0x18')][_0x40cf('0x19')]({'raw':!![],'where':{'ContactId':_0x5a5f63['body']['ContactId'],'ListId':_0x5a5f63['body'][_0x40cf('0x2a')],'VoiceQueueId':_0x5a5f63['body'][_0x40cf('0x1b')]===undefined?null:_0x5a5f63[_0x40cf('0x1a')]['VoiceQueueId'],'CampaignId':_0x5a5f63[_0x40cf('0x1a')]['CampaignId']===undefined?null:_0x5a5f63['body'][_0x40cf('0x1c')]}})['then'](function(_0x550db2){if(_0x550db2!=null){return db[_0x40cf('0x26')][_0x40cf('0x19')]({'raw':!![],'where':{'CmHopperId':_0x550db2['id'],'OrderBy':{'$gte':_0x550db2[_0x40cf('0x1d')]}},'order':[['OrderBy','ASC']]})['then'](function(_0xd03f48){if(_0xd03f48)return activateAdditionalPhone(_0x550db2,_0x5a5f63[_0x40cf('0x1a')],_0xd03f48,_0x5a5f63['duration'],_0x5a5f63[_0x40cf('0x2b')])['then'](function(_0x9cdaec){_0x4a7cf7(_0x9cdaec);});else{return db[_0x40cf('0x26')][_0x40cf('0x19')]({'raw':!![],'where':{'CmHopperId':_0x550db2['id']},'order':[[_0x40cf('0x1d'),_0x40cf('0x1e')]]})['then'](function(_0x375969){if(_0x375969)return activateAdditionalPhone(_0x550db2,_0x5a5f63[_0x40cf('0x1a')],_0x375969,_0x5a5f63[_0x40cf('0x2c')],_0x5a5f63[_0x40cf('0x2b')])['then'](function(_0x505fda){_0x4a7cf7(_0x505fda);});else{_0x4a7cf7({'id':_0x550db2['id'],'phone':''});}})[_0x40cf('0x16')](function(_0x4ae74c){logger['error'](_0x40cf('0x17'),_0x4ae74c['message']);_0x3c0747(_0x3456a0[_0x40cf('0x12')](0x1f4,_0x4ae74c[_0x40cf('0x14')]));});}})[_0x40cf('0x16')](function(_0x3c8411){logger['error'](_0x40cf('0x17'),_0x3c8411[_0x40cf('0x14')]);_0x3c0747(_0x3456a0[_0x40cf('0x12')](0x1f4,_0x3c8411[_0x40cf('0x14')]));});}else _0x4a7cf7(0x1);});});};function activateAdditionalPhone(_0x4c4ca6,_0x3c76dc,_0x390022,_0x234305,_0x43e402){return new Promise(function(_0x341d5c,_0xd4116a){var _0x1a3a6d;if(_[_0x40cf('0x2d')](_0x390022[_0x40cf('0x2e')])){_0x390022[_0x40cf('0x2e')]=moment();}if(moment()>moment(_0x390022['scheduledat'])){_0x1a3a6d=moment()[_0x40cf('0x2f')](_0x43e402||0x3,_0x40cf('0x30'));}else{if(_0x390022[_0x40cf('0x1d')]==0x0){_0x1a3a6d=moment(_0x390022['scheduledat']);}else{_0x1a3a6d=moment()[_0x40cf('0x2f')](_0x43e402||0x3,_0x40cf('0x30'));}}if(_[_0x40cf('0x2d')](_0x1a3a6d)){_0x1a3a6d=moment()[_0x40cf('0x2f')](_0x43e402||0x3,'minutes');}var _0x10fdc2={'phone':_0x4c4ca6[_0x40cf('0x31')],'active':0x0,'OrderBy':_[_0x40cf('0x2d')](_0x4c4ca6['OrderBy'])?0x0:_0x4c4ca6[_0x40cf('0x1d')],'scheduledat':moment()['add'](_0x234305||0x1,_0x40cf('0x30')),'countbusyretry':_0x3c76dc[_0x40cf('0x1f')],'countcongestionretry':_0x3c76dc[_0x40cf('0x32')],'countnoanswerretry':_0x3c76dc['countnoanswerretry'],'countnosuchnumberretry':_0x3c76dc[_0x40cf('0x20')],'countdropretry':_0x3c76dc[_0x40cf('0x21')],'countabandonedretry':_0x3c76dc['countabandonedretry'],'countmachineretry':_0x3c76dc[_0x40cf('0x22')],'countagentrejectretry':_0x3c76dc[_0x40cf('0x23')],'createdAt':_0x3c76dc[_0x40cf('0x33')],'updatedAt':_0x3c76dc[_0x40cf('0x34')]};var _0x1a115e={'CmHopperId':_0x4c4ca6['id'],'phone':_0x390022[_0x40cf('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x390022[_0x40cf('0x1d')])?0x0:_0x390022[_0x40cf('0x1d')],'scheduledat':_0x1a3a6d,'countbusyretry':_0x390022[_0x40cf('0x1f')],'countcongestionretry':_0x390022['countcongestionretry'],'countnoanswerretry':_0x390022['countnoanswerretry'],'countnosuchnumberretry':_0x390022[_0x40cf('0x20')],'countdropretry':_0x390022[_0x40cf('0x21')],'countabandonedretry':_0x390022[_0x40cf('0x28')],'countmachineretry':_0x390022[_0x40cf('0x22')],'countagentrejectretry':_0x390022['countagentrejectretry'],'createdAt':_0x390022['createdAt'],'updatedAt':_0x390022[_0x40cf('0x34')]};return db[_0x40cf('0x35')][_0x40cf('0x36')](function(_0x542ad8){return db[_0x40cf('0x26')][_0x40cf('0x37')](_0x10fdc2,{'where':{'id':_0x390022['id']}},{'transaction':_0x542ad8})['then'](function(){return db[_0x40cf('0x18')][_0x40cf('0x37')](_0x1a115e,{'where':{'id':_0x4c4ca6['id']}},{'transaction':_0x542ad8});});})[_0x40cf('0xe')](function(_0x403e9b){_0x341d5c({'id':_0x4c4ca6['id'],'phone':_0x390022[_0x40cf('0x31')]});})['catch'](function(_0x27e1c2){logger[_0x40cf('0x12')]('activateAdditionalPhone',_0x27e1c2[_0x40cf('0x14')]);_0xd4116a({'error':_0x27e1c2['message']});});});}exports[_0x40cf('0x38')]=function(_0x5cc4f6){var _0x520210=this;return new Promise(function(_0x759f30,_0x15bd20){return db[_0x40cf('0x18')]['update'](_0x5cc4f6['body']['field'],{'where':{'id':_0x5cc4f6['body']['id']}})[_0x40cf('0xe')](function(_0xfb10a2){_0x759f30(_0xfb10a2);})[_0x40cf('0x16')](function(_0x449cba){logger[_0x40cf('0x12')](_0x40cf('0x38'),_0x449cba[_0x40cf('0x14')]);_0x15bd20(_0x520210[_0x40cf('0x12')](0x1f4,_0x449cba[_0x40cf('0x14')]));});});}; \ No newline at end of file +var _0xc155=['countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','OrderBy','ASC','countdropretry','VerifyAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','debug','stringify','code','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','request\x20sent','catch','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry'];(function(_0x48e28a,_0x58ccbb){var _0x2a2cfa=function(_0x2aa7ae){while(--_0x2aa7ae){_0x48e28a['push'](_0x48e28a['shift']());}};_0x2a2cfa(++_0x58ccbb);}(_0xc155,0x88));var _0x5c15=function(_0x45fc83,_0x1679a8){_0x45fc83=_0x45fc83-0x0;var _0x8006f7=_0xc155[_0x45fc83];return _0x8006f7;};'use strict';var _=require('lodash');var util=require(_0x5c15('0x0'));var moment=require(_0x5c15('0x1'));var BPromise=require(_0x5c15('0x2'));var rs=require(_0x5c15('0x3'));var fs=require('fs');var Redis=require(_0x5c15('0x4'));var db=require(_0x5c15('0x5'))['db'];var utils=require(_0x5c15('0x6'));var logger=require('../../config/logger')(_0x5c15('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c15('0x8'));var client=jayson[_0x5c15('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1c78,_0x2b24c3,_0x58f8c1){return new BPromise(function(_0x33b933,_0x51da68){return client[_0x5c15('0xa')](_0x3e1c78,_0x58f8c1)[_0x5c15('0xb')](function(_0x3b14cf){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2b24c3,'request\x20sent');logger[_0x5c15('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x2b24c3,'request\x20sent',JSON[_0x5c15('0xd')](_0x3b14cf));if(_0x3b14cf['error']){if(_0x3b14cf['error'][_0x5c15('0xe')]===0x1f4){logger[_0x5c15('0xf')](_0x5c15('0x10'),_0x2b24c3,_0x3b14cf[_0x5c15('0xf')][_0x5c15('0x11')]);return _0x51da68(_0x3b14cf[_0x5c15('0xf')]['message']);}logger['error'](_0x5c15('0x10'),_0x2b24c3,_0x3b14cf[_0x5c15('0xf')][_0x5c15('0x11')]);return _0x33b933(_0x3b14cf[_0x5c15('0xf')]['message']);}else{logger[_0x5c15('0x12')](_0x5c15('0x10'),_0x2b24c3,_0x5c15('0x13'));_0x33b933(_0x3b14cf['result'][_0x5c15('0x11')]);}})[_0x5c15('0x14')](function(_0x2de4f9){logger[_0x5c15('0xf')](_0x5c15('0x10'),_0x2b24c3,_0x2de4f9);_0x51da68(_0x2de4f9);});});}exports['VerifyAdditionalPhones']=function(_0xfcea41){var _0x5b5a5b=this;return new Promise(function(_0x3f6c91,_0x4f3e35){return db[_0x5c15('0x15')][_0x5c15('0x16')]({'raw':!![],'where':{'ContactId':_0xfcea41[_0x5c15('0x17')]['ContactId'],'ListId':_0xfcea41['body'][_0x5c15('0x18')],'VoiceQueueId':_0xfcea41[_0x5c15('0x17')][_0x5c15('0x19')]===undefined?null:_0xfcea41[_0x5c15('0x17')][_0x5c15('0x19')],'CampaignId':_0xfcea41[_0x5c15('0x17')][_0x5c15('0x1a')]===undefined?null:_0xfcea41['body'][_0x5c15('0x1a')]}})[_0x5c15('0xb')](function(_0x4d0547){if(_0x4d0547!=null){return db['CmHopperAdditionalPhone'][_0x5c15('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4d0547['id'],'OrderBy':{'$gt':_0x4d0547['OrderBy']}},'order':[['OrderBy','ASC']]})[_0x5c15('0xb')](function(_0x29e308){var _0x64e122=0x0;if(_0x29e308){if(_0x29e308[_0x5c15('0x1b')]+_0x29e308[_0x5c15('0x1c')]+_0x29e308[_0x5c15('0x1d')]+_0x29e308[_0x5c15('0x1e')]+_0x29e308['countdropretry']+_0x29e308[_0x5c15('0x1f')]+_0x29e308[_0x5c15('0x20')]+_0x29e308[_0x5c15('0x21')]<_0xfcea41[_0x5c15('0x22')][_0x5c15('0x23')])_0x64e122=0x1;_0x3f6c91({'additional':_0x64e122});}else{return db[_0x5c15('0x24')][_0x5c15('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4d0547['id']},'order':[[_0x5c15('0x25'),_0x5c15('0x26')]]})['then'](function(_0x1f4737){var _0x11a940=0x0;if(_0x1f4737){if(_0x1f4737[_0x5c15('0x1b')]+_0x1f4737[_0x5c15('0x1c')]+_0x1f4737[_0x5c15('0x1d')]+_0x1f4737[_0x5c15('0x1e')]+_0x1f4737[_0x5c15('0x27')]+_0x1f4737[_0x5c15('0x1f')]+_0x1f4737[_0x5c15('0x20')]+_0x1f4737[_0x5c15('0x21')]<_0xfcea41[_0x5c15('0x22')][_0x5c15('0x23')])_0x11a940=0x1;_0x3f6c91({'additional':_0x11a940});}else{_0x3f6c91({'additional':0x0});}})[_0x5c15('0x14')](function(_0x53f70f){logger[_0x5c15('0xf')](_0x5c15('0x28'),_0x53f70f['message']);_0x4f3e35(_0x5b5a5b[_0x5c15('0xf')](0x1f4,_0x53f70f[_0x5c15('0x11')]));});}})[_0x5c15('0x14')](function(_0x32b2fb){logger[_0x5c15('0xf')](_0x5c15('0x28'),_0x32b2fb[_0x5c15('0x11')]);_0x4f3e35(_0x5b5a5b['error'](0x1f4,_0x32b2fb[_0x5c15('0x11')]));});}else _0x3f6c91({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x2079ba){var _0x1a4a32=this;return new Promise(function(_0x3ed31e,_0x27a752){return db[_0x5c15('0x15')][_0x5c15('0x16')]({'raw':!![],'where':{'ContactId':_0x2079ba[_0x5c15('0x17')][_0x5c15('0x29')],'ListId':_0x2079ba[_0x5c15('0x17')]['ListId'],'VoiceQueueId':_0x2079ba[_0x5c15('0x17')][_0x5c15('0x19')]===undefined?null:_0x2079ba[_0x5c15('0x17')][_0x5c15('0x19')],'CampaignId':_0x2079ba[_0x5c15('0x17')][_0x5c15('0x1a')]===undefined?null:_0x2079ba[_0x5c15('0x17')][_0x5c15('0x1a')]}})[_0x5c15('0xb')](function(_0x1ffaaa){if(_0x1ffaaa!=null){return db[_0x5c15('0x24')][_0x5c15('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1ffaaa['id'],'OrderBy':{'$gte':_0x1ffaaa['OrderBy']}},'order':[[_0x5c15('0x25'),_0x5c15('0x26')]]})[_0x5c15('0xb')](function(_0x4e05a2){if(_0x4e05a2)return activateAdditionalPhone(_0x1ffaaa,_0x2079ba[_0x5c15('0x17')],_0x4e05a2,_0x2079ba[_0x5c15('0x2a')],_0x2079ba['waitTime'])[_0x5c15('0xb')](function(_0x4b22be){_0x3ed31e(_0x4b22be);});else{return db[_0x5c15('0x24')][_0x5c15('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1ffaaa['id']},'order':[[_0x5c15('0x25'),'ASC']]})['then'](function(_0xea9660){if(_0xea9660)return activateAdditionalPhone(_0x1ffaaa,_0x2079ba[_0x5c15('0x17')],_0xea9660,_0x2079ba['duration'],_0x2079ba[_0x5c15('0x2b')])['then'](function(_0x279099){_0x3ed31e(_0x279099);});else{_0x3ed31e({'id':_0x1ffaaa['id'],'phone':''});}})[_0x5c15('0x14')](function(_0x2d61dc){logger[_0x5c15('0xf')](_0x5c15('0x28'),_0x2d61dc[_0x5c15('0x11')]);_0x27a752(_0x1a4a32[_0x5c15('0xf')](0x1f4,_0x2d61dc['message']));});}})[_0x5c15('0x14')](function(_0x4d7659){logger[_0x5c15('0xf')](_0x5c15('0x28'),_0x4d7659[_0x5c15('0x11')]);_0x27a752(_0x1a4a32[_0x5c15('0xf')](0x1f4,_0x4d7659[_0x5c15('0x11')]));});}else _0x3ed31e(0x1);});});};function activateAdditionalPhone(_0x477535,_0x20063e,_0x3eb973,_0x3ca701,_0x1e9397){return new Promise(function(_0x4e729f,_0x395738){var _0x239538;if(_[_0x5c15('0x2c')](_0x3eb973[_0x5c15('0x2d')])){_0x3eb973[_0x5c15('0x2d')]=moment();}if(moment()>moment(_0x3eb973[_0x5c15('0x2d')])){_0x239538=moment()[_0x5c15('0x2e')](_0x1e9397||0x3,_0x5c15('0x2f'));}else{if(_0x3eb973[_0x5c15('0x25')]==0x0){_0x239538=moment(_0x3eb973[_0x5c15('0x2d')]);}else{_0x239538=moment()[_0x5c15('0x2e')](_0x1e9397||0x3,_0x5c15('0x2f'));}}if(_[_0x5c15('0x2c')](_0x239538)){_0x239538=moment()['add'](_0x1e9397||0x3,'minutes');}var _0x435809={'phone':_0x477535['phone'],'active':0x0,'OrderBy':_[_0x5c15('0x2c')](_0x477535[_0x5c15('0x25')])?0x0:_0x477535[_0x5c15('0x25')],'scheduledat':moment()['add'](_0x3ca701||0x1,'minutes'),'countbusyretry':_0x20063e[_0x5c15('0x1b')],'countcongestionretry':_0x20063e['countcongestionretry'],'countnoanswerretry':_0x20063e[_0x5c15('0x1d')],'countnosuchnumberretry':_0x20063e['countnosuchnumberretry'],'countdropretry':_0x20063e[_0x5c15('0x27')],'countabandonedretry':_0x20063e[_0x5c15('0x1f')],'countmachineretry':_0x20063e[_0x5c15('0x20')],'countagentrejectretry':_0x20063e[_0x5c15('0x21')],'createdAt':_0x20063e[_0x5c15('0x30')],'updatedAt':_0x20063e[_0x5c15('0x31')]};var _0x2aa7e5={'CmHopperId':_0x477535['id'],'phone':_0x3eb973[_0x5c15('0x32')],'active':0x0,'OrderBy':_[_0x5c15('0x2c')](_0x3eb973['OrderBy'])?0x0:_0x3eb973['OrderBy'],'scheduledat':_0x239538,'countbusyretry':_0x3eb973[_0x5c15('0x1b')],'countcongestionretry':_0x3eb973[_0x5c15('0x1c')],'countnoanswerretry':_0x3eb973['countnoanswerretry'],'countnosuchnumberretry':_0x3eb973[_0x5c15('0x1e')],'countdropretry':_0x3eb973['countdropretry'],'countabandonedretry':_0x3eb973[_0x5c15('0x1f')],'countmachineretry':_0x3eb973['countmachineretry'],'countagentrejectretry':_0x3eb973[_0x5c15('0x21')],'createdAt':_0x3eb973[_0x5c15('0x30')],'updatedAt':_0x3eb973[_0x5c15('0x31')]};return db['sequelize'][_0x5c15('0x33')](function(_0x5bf0ec){return db[_0x5c15('0x24')]['update'](_0x435809,{'where':{'id':_0x3eb973['id']}},{'transaction':_0x5bf0ec})[_0x5c15('0xb')](function(){return db[_0x5c15('0x15')][_0x5c15('0x34')](_0x2aa7e5,{'where':{'id':_0x477535['id']}},{'transaction':_0x5bf0ec});});})[_0x5c15('0xb')](function(_0x37fc7b){_0x4e729f({'id':_0x477535['id'],'phone':_0x3eb973[_0x5c15('0x32')]});})['catch'](function(_0x2aa60f){logger['error'](_0x5c15('0x35'),_0x2aa60f['message']);_0x395738({'error':_0x2aa60f[_0x5c15('0x11')]});});});}exports['IncrementPreviewCounters']=function(_0x59de8d){var _0x342b4c=this;return new Promise(function(_0x21b379,_0x2c50b3){return db[_0x5c15('0x15')][_0x5c15('0x34')](_0x59de8d['body'][_0x5c15('0x36')],{'where':{'id':_0x59de8d['body']['id']}})[_0x5c15('0xb')](function(_0x565a64){_0x21b379(_0x565a64);})['catch'](function(_0x242fd9){logger[_0x5c15('0xf')](_0x5c15('0x37'),_0x242fd9[_0x5c15('0x11')]);_0x2c50b3(_0x342b4c[_0x5c15('0xf')](0x1f4,_0x242fd9[_0x5c15('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e061e22..f6619ec 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 _0x269e=['get','isAuthenticated','index','/:id','show','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x1638a8,_0x2ab38c){var _0x5e3e42=function(_0x280c71){while(--_0x280c71){_0x1638a8['push'](_0x1638a8['shift']());}};_0x5e3e42(++_0x2ab38c);}(_0x269e,0xc8));var _0xe269=function(_0x331fc4,_0x5daaa2){_0x331fc4=_0x331fc4-0x0;var _0x57b8cd=_0x269e[_0x331fc4];return _0x57b8cd;};'use strict';var multer=require(_0xe269('0x0'));var util=require(_0xe269('0x1'));var path=require('path');var timeout=require(_0xe269('0x2'));var express=require(_0xe269('0x3'));var router=express[_0xe269('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe269('0x5'));var config=require(_0xe269('0x6'));var controller=require(_0xe269('0x7'));router[_0xe269('0x8')]('/',auth[_0xe269('0x9')](),controller[_0xe269('0xa')]);router[_0xe269('0x8')](_0xe269('0xb'),auth['isAuthenticated'](),controller[_0xe269('0xc')]);router['post']('/',auth[_0xe269('0x9')](),controller['create']);router[_0xe269('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xe269('0xb'),auth['isAuthenticated'](),controller[_0xe269('0xe')]);module[_0xe269('0xf')]=router; \ No newline at end of file +var _0x6002=['/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','create','put'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x6002,0x103));var _0x2600=function(_0x1a6278,_0x298782){_0x1a6278=_0x1a6278-0x0;var _0x557688=_0x6002[_0x1a6278];return _0x557688;};'use strict';var multer=require(_0x2600('0x0'));var util=require(_0x2600('0x1'));var path=require('path');var timeout=require(_0x2600('0x2'));var express=require(_0x2600('0x3'));var router=express['Router']();var fs_extra=require(_0x2600('0x4'));var auth=require(_0x2600('0x5'));var interaction=require(_0x2600('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x2600('0x7')](),controller[_0x2600('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2600('0x7')](),controller[_0x2600('0x9')]);router[_0x2600('0xa')](_0x2600('0xb'),auth[_0x2600('0x7')](),controller[_0x2600('0xc')]);router['delete'](_0x2600('0xb'),auth[_0x2600('0x7')](),controller[_0x2600('0xd')]);module[_0x2600('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index eb4867f..762672a 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 _0xb194=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x96a34a,_0x48b3c6){var _0x4e325e=function(_0x20e343){while(--_0x20e343){_0x96a34a['push'](_0x96a34a['shift']());}};_0x4e325e(++_0x48b3c6);}(_0xb194,0x1b2));var _0x4b19=function(_0x540511,_0x201e3b){_0x540511=_0x540511-0x0;var _0x5c1ac6=_0xb194[_0x540511];return _0x5c1ac6;};'use strict';var moment=require(_0x4b19('0x0'));var Sequelize=require('sequelize');module[_0x4b19('0x1')]={'phone':{'type':Sequelize[_0x4b19('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4b19('0x3')],'unique':_0x4b19('0x4')},'ListId':{'type':Sequelize[_0x4b19('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x4b19('0x3')],'unique':_0x4b19('0x4')}}; \ No newline at end of file +var _0x510e=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0x510e,0x1ed));var _0xe510=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x510e[_0x273dc5];return _0x46dae7;};'use strict';var moment=require(_0xe510('0x0'));var Sequelize=require(_0xe510('0x1'));module[_0xe510('0x2')]={'phone':{'type':Sequelize[_0xe510('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe510('0x4')],'unique':_0xe510('0x5')},'ListId':{'type':Sequelize[_0xe510('0x4')],'unique':_0xe510('0x5')},'VoiceQueueId':{'type':Sequelize[_0xe510('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e904052..35d73fd 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 _0x1c87=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','VIRTUAL','merge','CmHopperBlack','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x1c87,0x92));var _0x71c8=function(_0x5a65e9,_0x5caf5d){_0x5a65e9=_0x5a65e9-0x0;var _0x95de87=_0x1c87[_0x5a65e9];return _0x95de87;};'use strict';var emlformat=require(_0x71c8('0x0'));var rimraf=require(_0x71c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71c8('0x2'));var rp=require(_0x71c8('0x3'));var moment=require(_0x71c8('0x4'));var BPromise=require(_0x71c8('0x5'));var Mustache=require(_0x71c8('0x6'));var util=require(_0x71c8('0x7'));var path=require(_0x71c8('0x8'));var sox=require(_0x71c8('0x9'));var csv=require(_0x71c8('0xa'));var ejs=require(_0x71c8('0xb'));var fs=require('fs');var fs_extra=require(_0x71c8('0xc'));var _=require(_0x71c8('0xd'));var squel=require('squel');var crypto=require(_0x71c8('0xe'));var jsforce=require(_0x71c8('0xf'));var deskjs=require(_0x71c8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x71c8('0x11'));var Papa=require(_0x71c8('0x12'));var Redis=require(_0x71c8('0x13'));var authService=require(_0x71c8('0x14'));var qs=require(_0x71c8('0x15'));var as=require(_0x71c8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x71c8('0x17'));var utils=require('../../config/utils');var config=require(_0x71c8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x71c8('0x19'))['db'];function respondWithStatusCode(_0x28e0ca,_0x17b2cd){_0x17b2cd=_0x17b2cd||0xcc;return function(_0x141901){if(_0x141901){return _0x28e0ca['sendStatus'](_0x17b2cd);}return _0x28e0ca['status'](_0x17b2cd)[_0x71c8('0x1a')]();};}function respondWithResult(_0x5352cc,_0x163ac7){_0x163ac7=_0x163ac7||0xc8;return function(_0xd9689a){if(_0xd9689a){return _0x5352cc[_0x71c8('0x1b')](_0x163ac7)[_0x71c8('0x1c')](_0xd9689a);}};}function respondWithFilteredResult(_0x32e07c,_0x40b054){return function(_0x3b2095){if(_0x3b2095){var _0x418de6=typeof _0x40b054[_0x71c8('0x1d')]===_0x71c8('0x1e')&&typeof _0x40b054['limit']==='undefined';var _0x1a9f38=_0x3b2095[_0x71c8('0x1f')];var _0x3e73fb=_0x418de6?0x0:_0x40b054[_0x71c8('0x1d')];var _0x32eab4=_0x418de6?_0x3b2095[_0x71c8('0x1f')]:_0x40b054[_0x71c8('0x1d')]+_0x40b054['limit'];var _0x554ffa;if(_0x32eab4>=_0x1a9f38){_0x32eab4=_0x1a9f38;_0x554ffa=0xc8;}else{_0x554ffa=0xce;}_0x32e07c['status'](_0x554ffa);return _0x32e07c[_0x71c8('0x20')](_0x71c8('0x21'),_0x3e73fb+'-'+_0x32eab4+'/'+_0x1a9f38)['json'](_0x3b2095);}return null;};}function patchUpdates(_0xb8869d){return function(_0x46483a){try{jsonpatch[_0x71c8('0x22')](_0x46483a,_0xb8869d,!![]);}catch(_0x4a9eac){return BPromise[_0x71c8('0x23')](_0x4a9eac);}return _0x46483a[_0x71c8('0x24')]();};}function saveUpdates(_0x1a05d8,_0x191713){return function(_0x58c861){if(_0x58c861){return _0x58c861['update'](_0x1a05d8)[_0x71c8('0x25')](function(_0x57a8e0){return _0x57a8e0;});}return null;};}function removeEntity(_0x23db9c,_0x4a8a77){return function(_0x59bb25){if(_0x59bb25){return _0x59bb25[_0x71c8('0x26')]()[_0x71c8('0x25')](function(){_0x23db9c[_0x71c8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48bd1d,_0xfd37ea){return function(_0x322700){if(!_0x322700){_0x48bd1d[_0x71c8('0x27')](0x194);}return _0x322700;};}function handleError(_0x30346e,_0x3301d6){_0x3301d6=_0x3301d6||0x1f4;return function(_0x14d649){logger[_0x71c8('0x28')](_0x14d649['stack']);if(_0x14d649[_0x71c8('0x29')]){delete _0x14d649[_0x71c8('0x29')];}_0x30346e[_0x71c8('0x1b')](_0x3301d6)['send'](_0x14d649);};}exports[_0x71c8('0x2a')]=function(_0x13984c,_0x53c5ff){var _0x2c53a5={},_0x1e800c={},_0x2e356c={'count':0x0,'rows':[]};var _0x521634=_[_0x71c8('0x2b')](db['CmHopperBlack']['rawAttributes'],function(_0x104af5){return{'name':_0x104af5[_0x71c8('0x2c')],'type':_0x104af5[_0x71c8('0x2d')][_0x71c8('0x2e')]};});_0x1e800c[_0x71c8('0x2f')]=_[_0x71c8('0x2b')](_0x521634,_0x71c8('0x29'));_0x1e800c['query']=_[_0x71c8('0x30')](_0x13984c['query']);_0x1e800c['filters']=_[_0x71c8('0x31')](_0x1e800c[_0x71c8('0x2f')],_0x1e800c[_0x71c8('0x32')]);_0x2c53a5[_0x71c8('0x33')]=_['intersection'](_0x1e800c[_0x71c8('0x2f')],qs[_0x71c8('0x34')](_0x13984c[_0x71c8('0x32')][_0x71c8('0x34')]));_0x2c53a5['attributes']=_0x2c53a5[_0x71c8('0x33')][_0x71c8('0x35')]?_0x2c53a5['attributes']:_0x1e800c[_0x71c8('0x2f')];if(!_0x13984c[_0x71c8('0x32')][_0x71c8('0x36')](_0x71c8('0x37'))){_0x2c53a5[_0x71c8('0x38')]=qs[_0x71c8('0x38')](_0x13984c[_0x71c8('0x32')][_0x71c8('0x38')]);_0x2c53a5[_0x71c8('0x1d')]=qs[_0x71c8('0x1d')](_0x13984c[_0x71c8('0x32')][_0x71c8('0x1d')]);}_0x2c53a5[_0x71c8('0x39')]=qs[_0x71c8('0x3a')](_0x13984c[_0x71c8('0x32')]['sort']);_0x2c53a5['where']=qs[_0x71c8('0x3b')](_['pick'](_0x13984c[_0x71c8('0x32')],_0x1e800c[_0x71c8('0x3b')]),_0x521634);if(_0x13984c[_0x71c8('0x32')][_0x71c8('0x3c')]){_0x2c53a5[_0x71c8('0x3d')]=_['merge'](_0x2c53a5['where'],{'$or':_[_0x71c8('0x2b')](_0x521634,function(_0x2a6bb8){if(_0x2a6bb8[_0x71c8('0x2d')]!==_0x71c8('0x3e')){var _0x2f0ebc={};_0x2f0ebc[_0x2a6bb8['name']]={'$like':'%'+_0x13984c['query'][_0x71c8('0x3c')]+'%'};return _0x2f0ebc;}})});}_0x2c53a5=_[_0x71c8('0x3f')]({},_0x2c53a5,_0x13984c['options']);var _0x267446={'where':_0x2c53a5[_0x71c8('0x3d')]};return db[_0x71c8('0x40')][_0x71c8('0x1f')](_0x267446)[_0x71c8('0x25')](function(_0x532a10){_0x2e356c[_0x71c8('0x1f')]=_0x532a10;if(_0x13984c[_0x71c8('0x32')]['includeAll']){_0x2c53a5[_0x71c8('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x71c8('0x42')](_0x2c53a5);})[_0x71c8('0x25')](function(_0x5de8b3){_0x2e356c[_0x71c8('0x43')]=_0x5de8b3;return _0x2e356c;})['then'](respondWithFilteredResult(_0x53c5ff,_0x2c53a5))[_0x71c8('0x44')](handleError(_0x53c5ff,null));};exports[_0x71c8('0x45')]=function(_0x1c0e06,_0x47a9b2){var _0x2674b2={'raw':!![],'where':{'id':_0x1c0e06[_0x71c8('0x46')]['id']}},_0x210668={};_0x210668['model']=_[_0x71c8('0x30')](db['CmHopperBlack'][_0x71c8('0x47')]);_0x210668[_0x71c8('0x32')]=_[_0x71c8('0x30')](_0x1c0e06[_0x71c8('0x32')]);_0x210668[_0x71c8('0x3b')]=_[_0x71c8('0x31')](_0x210668[_0x71c8('0x2f')],_0x210668[_0x71c8('0x32')]);_0x2674b2['attributes']=_[_0x71c8('0x31')](_0x210668[_0x71c8('0x2f')],qs[_0x71c8('0x34')](_0x1c0e06[_0x71c8('0x32')][_0x71c8('0x34')]));_0x2674b2[_0x71c8('0x33')]=_0x2674b2['attributes'][_0x71c8('0x35')]?_0x2674b2[_0x71c8('0x33')]:_0x210668[_0x71c8('0x2f')];if(_0x1c0e06['query'][_0x71c8('0x48')]){_0x2674b2['include']=[{'all':!![]}];}_0x2674b2=_[_0x71c8('0x3f')]({},_0x2674b2,_0x1c0e06[_0x71c8('0x49')]);return db[_0x71c8('0x40')][_0x71c8('0x4a')](_0x2674b2)[_0x71c8('0x25')](handleEntityNotFound(_0x47a9b2,null))[_0x71c8('0x25')](respondWithResult(_0x47a9b2,null))['catch'](handleError(_0x47a9b2,null));};exports[_0x71c8('0x4b')]=function(_0x2bf95a,_0x29c3ed){if(_0x2bf95a[_0x71c8('0x4c')]['id']){delete _0x2bf95a[_0x71c8('0x4c')]['id'];}return db[_0x71c8('0x40')][_0x71c8('0x4a')]({'where':{'id':_0x2bf95a[_0x71c8('0x46')]['id']}})[_0x71c8('0x25')](handleEntityNotFound(_0x29c3ed,null))[_0x71c8('0x25')](saveUpdates(_0x2bf95a['body'],null))[_0x71c8('0x25')](respondWithResult(_0x29c3ed,null))[_0x71c8('0x44')](handleError(_0x29c3ed,null));};exports[_0x71c8('0x26')]=function(_0x4b46f7,_0x5d4377){return db[_0x71c8('0x40')][_0x71c8('0x4a')]({'where':{'id':_0x4b46f7['params']['id']}})[_0x71c8('0x25')](handleEntityNotFound(_0x5d4377,null))[_0x71c8('0x25')](removeEntity(_0x5d4377,null))['catch'](handleError(_0x5d4377,null));};exports[_0x71c8('0x4d')]=function(_0x3539e6,_0x1d6c88){return db['CmHopperBlack'][_0x71c8('0x4d')]()['then'](respondWithResult(_0x1d6c88,null))[_0x71c8('0x44')](handleError(_0x1d6c88,null));}; \ No newline at end of file +var _0x2d0b=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../config/license/util'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x2d0b,0x102));var _0xb2d0=function(_0x10ebc2,_0x44b48d){_0x10ebc2=_0x10ebc2-0x0;var _0x2bc47a=_0x2d0b[_0x10ebc2];return _0x2bc47a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2d0('0x0'));var zipdir=require(_0xb2d0('0x1'));var jsonpatch=require(_0xb2d0('0x2'));var rp=require('request-promise');var moment=require(_0xb2d0('0x3'));var BPromise=require(_0xb2d0('0x4'));var Mustache=require(_0xb2d0('0x5'));var util=require(_0xb2d0('0x6'));var path=require('path');var sox=require(_0xb2d0('0x7'));var csv=require('to-csv');var ejs=require(_0xb2d0('0x8'));var fs=require('fs');var fs_extra=require(_0xb2d0('0x9'));var _=require(_0xb2d0('0xa'));var squel=require(_0xb2d0('0xb'));var crypto=require(_0xb2d0('0xc'));var jsforce=require(_0xb2d0('0xd'));var deskjs=require(_0xb2d0('0xe'));var toCsv=require(_0xb2d0('0xf'));var querystring=require(_0xb2d0('0x10'));var Papa=require(_0xb2d0('0x11'));var Redis=require(_0xb2d0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2d0('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb2d0('0x14'));var licenseUtil=require(_0xb2d0('0x15'));var db=require(_0xb2d0('0x16'))['db'];function respondWithStatusCode(_0x4f7a57,_0x19e3e8){_0x19e3e8=_0x19e3e8||0xcc;return function(_0x539b47){if(_0x539b47){return _0x4f7a57[_0xb2d0('0x17')](_0x19e3e8);}return _0x4f7a57[_0xb2d0('0x18')](_0x19e3e8)[_0xb2d0('0x19')]();};}function respondWithResult(_0x2790a7,_0x343488){_0x343488=_0x343488||0xc8;return function(_0x3c2b9e){if(_0x3c2b9e){return _0x2790a7[_0xb2d0('0x18')](_0x343488)[_0xb2d0('0x1a')](_0x3c2b9e);}};}function respondWithFilteredResult(_0x3509c5,_0x43390d){return function(_0x36c3b3){if(_0x36c3b3){var _0x1adbea=typeof _0x43390d[_0xb2d0('0x1b')]===_0xb2d0('0x1c')&&typeof _0x43390d[_0xb2d0('0x1d')]==='undefined';var _0x159dc3=_0x36c3b3['count'];var _0xbcdaba=_0x1adbea?0x0:_0x43390d[_0xb2d0('0x1b')];var _0x3aa246=_0x1adbea?_0x36c3b3[_0xb2d0('0x1e')]:_0x43390d[_0xb2d0('0x1b')]+_0x43390d[_0xb2d0('0x1d')];var _0x2f18e2;if(_0x3aa246>=_0x159dc3){_0x3aa246=_0x159dc3;_0x2f18e2=0xc8;}else{_0x2f18e2=0xce;}_0x3509c5[_0xb2d0('0x18')](_0x2f18e2);return _0x3509c5[_0xb2d0('0x1f')]('Content-Range',_0xbcdaba+'-'+_0x3aa246+'/'+_0x159dc3)[_0xb2d0('0x1a')](_0x36c3b3);}return null;};}function patchUpdates(_0x1bdc6d){return function(_0x1959fd){try{jsonpatch[_0xb2d0('0x20')](_0x1959fd,_0x1bdc6d,!![]);}catch(_0x1bb7b4){return BPromise[_0xb2d0('0x21')](_0x1bb7b4);}return _0x1959fd[_0xb2d0('0x22')]();};}function saveUpdates(_0x9e90bf,_0x204b4a){return function(_0x19c461){if(_0x19c461){return _0x19c461[_0xb2d0('0x23')](_0x9e90bf)['then'](function(_0x221dde){return _0x221dde;});}return null;};}function removeEntity(_0xdb149d,_0x15d113){return function(_0x5a0a8f){if(_0x5a0a8f){return _0x5a0a8f[_0xb2d0('0x24')]()[_0xb2d0('0x25')](function(){_0xdb149d[_0xb2d0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fcd4,_0x26bbca){return function(_0x2a2203){if(!_0x2a2203){_0x39fcd4[_0xb2d0('0x17')](0x194);}return _0x2a2203;};}function handleError(_0x2595a8,_0x31252b){_0x31252b=_0x31252b||0x1f4;return function(_0x3b2ab9){logger[_0xb2d0('0x26')](_0x3b2ab9[_0xb2d0('0x27')]);if(_0x3b2ab9[_0xb2d0('0x28')]){delete _0x3b2ab9[_0xb2d0('0x28')];}_0x2595a8['status'](_0x31252b)['send'](_0x3b2ab9);};}exports[_0xb2d0('0x29')]=function(_0x3420e8,_0x2bcc54){var _0xadef61={},_0x11e6fe={},_0x2019fe={'count':0x0,'rows':[]};var _0x3d6482=_[_0xb2d0('0x2a')](db[_0xb2d0('0x2b')][_0xb2d0('0x2c')],function(_0x4469ef){return{'name':_0x4469ef[_0xb2d0('0x2d')],'type':_0x4469ef[_0xb2d0('0x2e')]['key']};});_0x11e6fe[_0xb2d0('0x2f')]=_[_0xb2d0('0x2a')](_0x3d6482,_0xb2d0('0x28'));_0x11e6fe[_0xb2d0('0x30')]=_[_0xb2d0('0x31')](_0x3420e8[_0xb2d0('0x30')]);_0x11e6fe['filters']=_[_0xb2d0('0x32')](_0x11e6fe['model'],_0x11e6fe['query']);_0xadef61[_0xb2d0('0x33')]=_[_0xb2d0('0x32')](_0x11e6fe[_0xb2d0('0x2f')],qs[_0xb2d0('0x34')](_0x3420e8[_0xb2d0('0x30')][_0xb2d0('0x34')]));_0xadef61[_0xb2d0('0x33')]=_0xadef61[_0xb2d0('0x33')][_0xb2d0('0x35')]?_0xadef61['attributes']:_0x11e6fe[_0xb2d0('0x2f')];if(!_0x3420e8['query'][_0xb2d0('0x36')]('nolimit')){_0xadef61[_0xb2d0('0x1d')]=qs[_0xb2d0('0x1d')](_0x3420e8[_0xb2d0('0x30')][_0xb2d0('0x1d')]);_0xadef61[_0xb2d0('0x1b')]=qs['offset'](_0x3420e8['query'][_0xb2d0('0x1b')]);}_0xadef61['order']=qs[_0xb2d0('0x37')](_0x3420e8[_0xb2d0('0x30')]['sort']);_0xadef61[_0xb2d0('0x38')]=qs[_0xb2d0('0x39')](_['pick'](_0x3420e8[_0xb2d0('0x30')],_0x11e6fe[_0xb2d0('0x39')]),_0x3d6482);if(_0x3420e8[_0xb2d0('0x30')][_0xb2d0('0x3a')]){_0xadef61['where']=_[_0xb2d0('0x3b')](_0xadef61[_0xb2d0('0x38')],{'$or':_[_0xb2d0('0x2a')](_0x3d6482,function(_0x1fc53f){if(_0x1fc53f[_0xb2d0('0x2e')]!==_0xb2d0('0x3c')){var _0x2c7c53={};_0x2c7c53[_0x1fc53f[_0xb2d0('0x28')]]={'$like':'%'+_0x3420e8['query'][_0xb2d0('0x3a')]+'%'};return _0x2c7c53;}})});}_0xadef61=_[_0xb2d0('0x3b')]({},_0xadef61,_0x3420e8[_0xb2d0('0x3d')]);var _0x59e587={'where':_0xadef61[_0xb2d0('0x38')]};return db['CmHopperBlack'][_0xb2d0('0x1e')](_0x59e587)[_0xb2d0('0x25')](function(_0x362eb3){_0x2019fe[_0xb2d0('0x1e')]=_0x362eb3;if(_0x3420e8[_0xb2d0('0x30')][_0xb2d0('0x3e')]){_0xadef61[_0xb2d0('0x3f')]=[{'all':!![]}];}return db[_0xb2d0('0x2b')][_0xb2d0('0x40')](_0xadef61);})[_0xb2d0('0x25')](function(_0x2913b7){_0x2019fe[_0xb2d0('0x41')]=_0x2913b7;return _0x2019fe;})[_0xb2d0('0x25')](respondWithFilteredResult(_0x2bcc54,_0xadef61))['catch'](handleError(_0x2bcc54,null));};exports['show']=function(_0x189d4c,_0x27b0d6){var _0x216610={'raw':!![],'where':{'id':_0x189d4c[_0xb2d0('0x42')]['id']}},_0x526237={};_0x526237[_0xb2d0('0x2f')]=_[_0xb2d0('0x31')](db[_0xb2d0('0x2b')]['rawAttributes']);_0x526237[_0xb2d0('0x30')]=_[_0xb2d0('0x31')](_0x189d4c[_0xb2d0('0x30')]);_0x526237['filters']=_[_0xb2d0('0x32')](_0x526237[_0xb2d0('0x2f')],_0x526237[_0xb2d0('0x30')]);_0x216610['attributes']=_[_0xb2d0('0x32')](_0x526237[_0xb2d0('0x2f')],qs[_0xb2d0('0x34')](_0x189d4c[_0xb2d0('0x30')][_0xb2d0('0x34')]));_0x216610['attributes']=_0x216610[_0xb2d0('0x33')][_0xb2d0('0x35')]?_0x216610[_0xb2d0('0x33')]:_0x526237['model'];if(_0x189d4c[_0xb2d0('0x30')][_0xb2d0('0x3e')]){_0x216610[_0xb2d0('0x3f')]=[{'all':!![]}];}_0x216610=_['merge']({},_0x216610,_0x189d4c['options']);return db[_0xb2d0('0x2b')][_0xb2d0('0x43')](_0x216610)[_0xb2d0('0x25')](handleEntityNotFound(_0x27b0d6,null))[_0xb2d0('0x25')](respondWithResult(_0x27b0d6,null))['catch'](handleError(_0x27b0d6,null));};exports['update']=function(_0x505265,_0x2950af){if(_0x505265[_0xb2d0('0x44')]['id']){delete _0x505265[_0xb2d0('0x44')]['id'];}return db['CmHopperBlack'][_0xb2d0('0x43')]({'where':{'id':_0x505265['params']['id']}})[_0xb2d0('0x25')](handleEntityNotFound(_0x2950af,null))[_0xb2d0('0x25')](saveUpdates(_0x505265[_0xb2d0('0x44')],null))[_0xb2d0('0x25')](respondWithResult(_0x2950af,null))[_0xb2d0('0x45')](handleError(_0x2950af,null));};exports['destroy']=function(_0x21acbf,_0x27da84){return db[_0xb2d0('0x2b')][_0xb2d0('0x43')]({'where':{'id':_0x21acbf[_0xb2d0('0x42')]['id']}})['then'](handleEntityNotFound(_0x27da84,null))[_0xb2d0('0x25')](removeEntity(_0x27da84,null))[_0xb2d0('0x45')](handleError(_0x27da84,null));};exports['describe']=function(_0x410859,_0x18abdb){return db['CmHopperBlack']['describe']()[_0xb2d0('0x25')](respondWithResult(_0x18abdb,null))[_0xb2d0('0x45')](handleError(_0x18abdb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index cd2f392..77e3cbd 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 _0xb3fb=['api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0xb3fb,0x15b));var _0xbb3f=function(_0x3355c0,_0x4b530b){_0x3355c0=_0x3355c0-0x0;var _0x5a3288=_0xb3fb[_0x3355c0];return _0x5a3288;};'use strict';var _=require(_0xbb3f('0x0'));var util=require(_0xbb3f('0x1'));var logger=require(_0xbb3f('0x2'))(_0xbb3f('0x3'));var moment=require(_0xbb3f('0x4'));var BPromise=require(_0xbb3f('0x5'));var rp=require(_0xbb3f('0x6'));var fs=require('fs');var path=require(_0xbb3f('0x7'));var rimraf=require(_0xbb3f('0x8'));var config=require('../../config/environment');var attributes=require(_0xbb3f('0x9'));module[_0xbb3f('0xa')]=function(_0x28b422,_0x306625){return _0x28b422[_0xbb3f('0xb')](_0xbb3f('0xc'),attributes,{'tableName':_0xbb3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc187=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','cm_hopper_black','lodash','util'];(function(_0x5c0bb5,_0x491223){var _0x17a488=function(_0x1b4e40){while(--_0x1b4e40){_0x5c0bb5['push'](_0x5c0bb5['shift']());}};_0x17a488(++_0x491223);}(_0xc187,0x1a0));var _0x7c18=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xc187[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x7c18('0x0'));var util=require(_0x7c18('0x1'));var logger=require(_0x7c18('0x2'))(_0x7c18('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7c18('0x4'));var fs=require('fs');var path=require(_0x7c18('0x5'));var rimraf=require(_0x7c18('0x6'));var config=require(_0x7c18('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x7c18('0x8')]=function(_0x1e6bd0,_0x538110){return _0x1e6bd0[_0x7c18('0x9')]('CmHopperBlack',attributes,{'tableName':_0x7c18('0xa'),'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 55ea1ba..fd2c36c 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 _0xe943=['catch','options','attributes','limit','include','model','map','GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update','raw','destroy','where','DestroyCmHopperBlack','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','client','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xe943,0x75));var _0x3e94=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xe943[_0x367361];return _0x195d2d;};'use strict';var _=require('lodash');var util=require(_0x3e94('0x0'));var moment=require(_0x3e94('0x1'));var BPromise=require(_0x3e94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e94('0x3'));var db=require(_0x3e94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e94('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e94('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c37f8,_0x4f6095,_0x5b860e){return new BPromise(function(_0x59da97,_0x15ec5b){return client[_0x3e94('0x7')](_0x5c37f8,_0x5b860e)[_0x3e94('0x8')](function(_0x22f153){logger[_0x3e94('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x4f6095,_0x3e94('0xa'));logger[_0x3e94('0xb')](_0x3e94('0xc'),_0x4f6095,'request\x20sent',JSON[_0x3e94('0xd')](_0x22f153));if(_0x22f153[_0x3e94('0xe')]){if(_0x22f153[_0x3e94('0xe')][_0x3e94('0xf')]===0x1f4){logger[_0x3e94('0xe')](_0x3e94('0x10'),_0x4f6095,_0x22f153['error']['message']);return _0x15ec5b(_0x22f153[_0x3e94('0xe')][_0x3e94('0x11')]);}logger[_0x3e94('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x4f6095,_0x22f153[_0x3e94('0xe')][_0x3e94('0x11')]);return _0x59da97(_0x22f153[_0x3e94('0xe')]['message']);}else{logger[_0x3e94('0x9')](_0x3e94('0x10'),_0x4f6095,_0x3e94('0xa'));_0x59da97(_0x22f153[_0x3e94('0x12')][_0x3e94('0x11')]);}})[_0x3e94('0x13')](function(_0x418036){logger[_0x3e94('0xe')](_0x3e94('0x10'),_0x4f6095,_0x418036);_0x15ec5b(_0x418036);});});}exports['GetCmHopperBlack']=function(_0x26ff00){var _0x53cd35=this;return new Promise(function(_0x5252e8,_0x4c8ebb){return db['CmHopperBlack']['findAll']({'raw':_0x26ff00[_0x3e94('0x14')]?_0x26ff00[_0x3e94('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x26ff00[_0x3e94('0x14')]?_0x26ff00['options']['where']||null:null,'attributes':_0x26ff00['options']?_0x26ff00[_0x3e94('0x14')][_0x3e94('0x15')]||null:null,'limit':_0x26ff00[_0x3e94('0x14')]?_0x26ff00[_0x3e94('0x14')][_0x3e94('0x16')]||null:null,'include':_0x26ff00[_0x3e94('0x14')]?_0x26ff00[_0x3e94('0x14')][_0x3e94('0x17')]?_['map'](_0x26ff00[_0x3e94('0x14')]['include'],function(_0x33ab2d){return{'model':db[_0x33ab2d[_0x3e94('0x18')]],'as':_0x33ab2d['as'],'attributes':_0x33ab2d[_0x3e94('0x15')],'include':_0x33ab2d[_0x3e94('0x17')]?_['map'](_0x33ab2d['include'],function(_0x73dc56){return{'model':db[_0x73dc56['model']],'as':_0x73dc56['as'],'attributes':_0x73dc56['attributes'],'include':_0x73dc56[_0x3e94('0x17')]?_[_0x3e94('0x19')](_0x73dc56[_0x3e94('0x17')],function(_0x1a86e4){return{'model':db[_0x1a86e4[_0x3e94('0x18')]],'as':_0x1a86e4['as'],'attributes':_0x1a86e4[_0x3e94('0x15')]};}):[]};}):[]};}):[]:[]})[_0x3e94('0x8')](function(_0x10681d){logger['info'](_0x3e94('0x1a'),_0x26ff00);logger[_0x3e94('0xb')](_0x3e94('0x1a'),_0x26ff00,JSON[_0x3e94('0xd')](_0x10681d));_0x5252e8(_0x10681d);})[_0x3e94('0x13')](function(_0x29166b){logger['error'](_0x3e94('0x1a'),_0x29166b[_0x3e94('0x11')],_0x26ff00);_0x4c8ebb(_0x53cd35[_0x3e94('0xe')](0x1f4,_0x29166b[_0x3e94('0x11')]));});});};exports[_0x3e94('0x1b')]=function(_0x7d8081){var _0xd3e8e1=this;return new Promise(function(_0x3f1a08,_0x46503e){return db[_0x3e94('0x1c')][_0x3e94('0x1d')](_0x7d8081['body'],{'raw':_0x7d8081[_0x3e94('0x14')]?_0x7d8081['options'][_0x3e94('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d8081[_0x3e94('0x14')]?_0x7d8081['options']['where']||null:null,'attributes':_0x7d8081['options']?_0x7d8081[_0x3e94('0x14')]['attributes']||null:null,'limit':_0x7d8081[_0x3e94('0x14')]?_0x7d8081['options'][_0x3e94('0x16')]||null:null})[_0x3e94('0x8')](function(_0x210645){logger[_0x3e94('0x9')](_0x3e94('0x1b'),_0x7d8081);logger['debug'](_0x3e94('0x1b'),_0x7d8081,JSON[_0x3e94('0xd')](_0x210645));_0x3f1a08(_0x210645);})[_0x3e94('0x13')](function(_0x582981){logger['error'](_0x3e94('0x1b'),_0x582981[_0x3e94('0x11')],_0x7d8081);_0x46503e(_0xd3e8e1[_0x3e94('0xe')](0x1f4,_0x582981[_0x3e94('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x5995f6){var _0x16e1ad=this;return new Promise(function(_0x4d4c99,_0x850132){return db[_0x3e94('0x1c')][_0x3e94('0x1f')]({'where':_0x5995f6[_0x3e94('0x14')]?_0x5995f6[_0x3e94('0x14')][_0x3e94('0x20')]||null:null})[_0x3e94('0x8')](function(_0x1fccd0){logger[_0x3e94('0x9')]('DestroyCmHopperBlack',_0x5995f6);logger[_0x3e94('0xb')](_0x3e94('0x21'),_0x5995f6,JSON['stringify'](_0x1fccd0));_0x4d4c99(_0x1fccd0);})[_0x3e94('0x13')](function(_0x40f7e2){logger['error'](_0x3e94('0x21'),_0x40f7e2[_0x3e94('0x11')],_0x5995f6);_0x850132(_0x16e1ad['error'](0x1f4,_0x40f7e2[_0x3e94('0x11')]));});});}; \ No newline at end of file +var _0xcb27=['model','map','update','body','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include'];(function(_0x34b784,_0xd942b5){var _0x364427=function(_0x20ec11){while(--_0x20ec11){_0x34b784['push'](_0x34b784['shift']());}};_0x364427(++_0xd942b5);}(_0xcb27,0xdf));var _0x7cb2=function(_0x2a3aaf,_0x485081){_0x2a3aaf=_0x2a3aaf-0x0;var _0x1c8852=_0xcb27[_0x2a3aaf];return _0x1c8852;};'use strict';var _=require('lodash');var util=require(_0x7cb2('0x0'));var moment=require(_0x7cb2('0x1'));var BPromise=require(_0x7cb2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cb2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cb2('0x4'));var logger=require(_0x7cb2('0x5'))(_0x7cb2('0x6'));var config=require(_0x7cb2('0x7'));var jayson=require(_0x7cb2('0x8'));var client=jayson['client'][_0x7cb2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c9859,_0x13d1e3,_0x239a00){return new BPromise(function(_0x35d296,_0xaca1a4){return client['request'](_0x1c9859,_0x239a00)[_0x7cb2('0xa')](function(_0x2fb76){logger[_0x7cb2('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x13d1e3,_0x7cb2('0xc'));logger[_0x7cb2('0xd')](_0x7cb2('0xe'),_0x13d1e3,_0x7cb2('0xc'),JSON[_0x7cb2('0xf')](_0x2fb76));if(_0x2fb76['error']){if(_0x2fb76[_0x7cb2('0x10')][_0x7cb2('0x11')]===0x1f4){logger[_0x7cb2('0x10')](_0x7cb2('0x12'),_0x13d1e3,_0x2fb76[_0x7cb2('0x10')][_0x7cb2('0x13')]);return _0xaca1a4(_0x2fb76[_0x7cb2('0x10')]['message']);}logger['error'](_0x7cb2('0x12'),_0x13d1e3,_0x2fb76[_0x7cb2('0x10')][_0x7cb2('0x13')]);return _0x35d296(_0x2fb76['error']['message']);}else{logger['info'](_0x7cb2('0x12'),_0x13d1e3,_0x7cb2('0xc'));_0x35d296(_0x2fb76['result'][_0x7cb2('0x13')]);}})[_0x7cb2('0x14')](function(_0x29918c){logger[_0x7cb2('0x10')](_0x7cb2('0x12'),_0x13d1e3,_0x29918c);_0xaca1a4(_0x29918c);});});}exports[_0x7cb2('0x15')]=function(_0x269947){var _0x5c1a49=this;return new Promise(function(_0x15e611,_0x2cb0dc){return db[_0x7cb2('0x16')][_0x7cb2('0x17')]({'raw':_0x269947[_0x7cb2('0x18')]?_0x269947[_0x7cb2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x269947[_0x7cb2('0x18')]?_0x269947[_0x7cb2('0x18')][_0x7cb2('0x19')]||null:null,'attributes':_0x269947[_0x7cb2('0x18')]?_0x269947[_0x7cb2('0x18')][_0x7cb2('0x1a')]||null:null,'limit':_0x269947['options']?_0x269947[_0x7cb2('0x18')][_0x7cb2('0x1b')]||null:null,'include':_0x269947['options']?_0x269947[_0x7cb2('0x18')]['include']?_['map'](_0x269947[_0x7cb2('0x18')][_0x7cb2('0x1c')],function(_0x3dffc9){return{'model':db[_0x3dffc9['model']],'as':_0x3dffc9['as'],'attributes':_0x3dffc9[_0x7cb2('0x1a')],'include':_0x3dffc9[_0x7cb2('0x1c')]?_['map'](_0x3dffc9[_0x7cb2('0x1c')],function(_0x334321){return{'model':db[_0x334321[_0x7cb2('0x1d')]],'as':_0x334321['as'],'attributes':_0x334321[_0x7cb2('0x1a')],'include':_0x334321[_0x7cb2('0x1c')]?_[_0x7cb2('0x1e')](_0x334321[_0x7cb2('0x1c')],function(_0x1f9fcf){return{'model':db[_0x1f9fcf[_0x7cb2('0x1d')]],'as':_0x1f9fcf['as'],'attributes':_0x1f9fcf['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cb2('0xa')](function(_0x484fda){logger[_0x7cb2('0xb')]('GetCmHopperBlack',_0x269947);logger[_0x7cb2('0xd')](_0x7cb2('0x15'),_0x269947,JSON[_0x7cb2('0xf')](_0x484fda));_0x15e611(_0x484fda);})[_0x7cb2('0x14')](function(_0x27572a){logger[_0x7cb2('0x10')](_0x7cb2('0x15'),_0x27572a[_0x7cb2('0x13')],_0x269947);_0x2cb0dc(_0x5c1a49['error'](0x1f4,_0x27572a['message']));});});};exports['UpdateCmHopperBlack']=function(_0x10ef74){var _0x87d1d4=this;return new Promise(function(_0xfcb314,_0x72f888){return db['CmHopperBlack'][_0x7cb2('0x1f')](_0x10ef74[_0x7cb2('0x20')],{'raw':_0x10ef74['options']?_0x10ef74[_0x7cb2('0x18')][_0x7cb2('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10ef74[_0x7cb2('0x18')]?_0x10ef74[_0x7cb2('0x18')][_0x7cb2('0x19')]||null:null,'attributes':_0x10ef74[_0x7cb2('0x18')]?_0x10ef74[_0x7cb2('0x18')][_0x7cb2('0x1a')]||null:null,'limit':_0x10ef74[_0x7cb2('0x18')]?_0x10ef74[_0x7cb2('0x18')][_0x7cb2('0x1b')]||null:null})[_0x7cb2('0xa')](function(_0x31b184){logger[_0x7cb2('0xb')](_0x7cb2('0x22'),_0x10ef74);logger['debug']('UpdateCmHopperBlack',_0x10ef74,JSON[_0x7cb2('0xf')](_0x31b184));_0xfcb314(_0x31b184);})[_0x7cb2('0x14')](function(_0x28ffe2){logger[_0x7cb2('0x10')](_0x7cb2('0x22'),_0x28ffe2[_0x7cb2('0x13')],_0x10ef74);_0x72f888(_0x87d1d4['error'](0x1f4,_0x28ffe2[_0x7cb2('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x44a784){var _0x42c9d7=this;return new Promise(function(_0x133680,_0xd9c85b){return db[_0x7cb2('0x16')]['destroy']({'where':_0x44a784[_0x7cb2('0x18')]?_0x44a784[_0x7cb2('0x18')][_0x7cb2('0x19')]||null:null})[_0x7cb2('0xa')](function(_0x140989){logger['info'](_0x7cb2('0x23'),_0x44a784);logger[_0x7cb2('0xd')](_0x7cb2('0x23'),_0x44a784,JSON[_0x7cb2('0xf')](_0x140989));_0x133680(_0x140989);})[_0x7cb2('0x14')](function(_0x806373){logger[_0x7cb2('0x10')](_0x7cb2('0x23'),_0x806373['message'],_0x44a784);_0xd9c85b(_0x42c9d7[_0x7cb2('0x10')](0x1f4,_0x806373[_0x7cb2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 169937f..cdf5b12 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 _0xba34=['./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x2fe301,_0x49a268){var _0x568b3d=function(_0x263943){while(--_0x263943){_0x2fe301['push'](_0x2fe301['shift']());}};_0x568b3d(++_0x49a268);}(_0xba34,0x119));var _0x4ba3=function(_0x3b95a9,_0xcd72c0){_0x3b95a9=_0x3b95a9-0x0;var _0x4bd589=_0xba34[_0x3b95a9];return _0x4bd589;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc4aa=['isAuthenticated','index','/describe','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x5d4c18,_0x9b5fea){var _0x359492=function(_0x2f946b){while(--_0x2f946b){_0x5d4c18['push'](_0x5d4c18['shift']());}};_0x359492(++_0x9b5fea);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['put'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router['delete'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e1df611..8e6f09d 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 _0x9d46=['BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x2ba0fd,_0x28fb94){var _0x147e20=function(_0x3e1791){while(--_0x3e1791){_0x2ba0fd['push'](_0x2ba0fd['shift']());}};_0x147e20(++_0x28fb94);}(_0x9d46,0xfe));var _0x69d4=function(_0x3def7f,_0x3af1d7){_0x3def7f=_0x3def7f-0x0;var _0xcbd22c=_0x9d46[_0x3def7f];return _0xcbd22c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x69d4('0x0')]={'state':{'type':Sequelize[_0x69d4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x69d4('0x2')]},'scheduledat':{'type':Sequelize[_0x69d4('0x3')]},'countbusyretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x69d4('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x69d4('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x69d4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x69d4('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x69d4('0x3')]},'droptime':{'type':Sequelize[_0x69d4('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x69d4('0x2')]},'campaign':{'type':Sequelize[_0x69d4('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x69d4('0x2')]},'disposition':{'type':Sequelize[_0x69d4('0x2')]},'secondDisposition':{'type':Sequelize[_0x69d4('0x2')]},'thirdDisposition':{'type':Sequelize[_0x69d4('0x2')]},'dispositionat':{'type':Sequelize[_0x69d4('0x3')],'set':function(_0x3a942f){var _0x5016ca=this[_0x69d4('0x4')](_0x69d4('0x5'));if(_0x5016ca&&_0x3a942f){this[_0x69d4('0x6')](_0x69d4('0x7'),moment(_0x3a942f)[_0x69d4('0x8')](moment(_0x5016ca),_0x69d4('0x9')));}}},'amd':{'type':Sequelize[_0x69d4('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x69d4('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x69d4('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x69d4('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x69d4('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x69d4('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb57a=['seconds','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','followuptime'];(function(_0x47a9f9,_0x219de9){var _0x156699=function(_0x1b6f30){while(--_0x1b6f30){_0x47a9f9['push'](_0x47a9f9['shift']());}};_0x156699(++_0x219de9);}(_0xb57a,0x160));var _0xab57=function(_0x45e60a,_0x3d6279){_0x45e60a=_0x45e60a-0x0;var _0x2a200a=_0xb57a[_0x45e60a];return _0x2a200a;};'use strict';var Sequelize=require(_0xab57('0x0'));var moment=require(_0xab57('0x1'));module['exports']={'state':{'type':Sequelize[_0xab57('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xab57('0x3')]},'scheduledat':{'type':Sequelize[_0xab57('0x4')]},'countbusyretry':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xab57('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xab57('0x3')]},'originatecalleridname':{'type':Sequelize[_0xab57('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xab57('0x3')]},'starttime':{'type':Sequelize[_0xab57('0x4')]},'responsetime':{'type':Sequelize[_0xab57('0x4')]},'answertime':{'type':Sequelize[_0xab57('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xab57('0x3')]},'campaign':{'type':Sequelize[_0xab57('0x3')]},'campaigntype':{'type':Sequelize[_0xab57('0x3')]},'membername':{'type':Sequelize[_0xab57('0x3')]},'reason':{'type':Sequelize[_0xab57('0x3')]},'disposition':{'type':Sequelize[_0xab57('0x3')]},'secondDisposition':{'type':Sequelize[_0xab57('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xab57('0x4')],'set':function(_0x25913a){var _0x76c42a=this[_0xab57('0x5')](_0xab57('0x6'));if(_0x76c42a&&_0x25913a){this['setDataValue'](_0xab57('0x7'),moment(_0x25913a)['diff'](moment(_0x76c42a),_0xab57('0x8')));}}},'amd':{'type':Sequelize[_0xab57('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xab57('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xab57('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xab57('0x4')]},'deleted':{'type':Sequelize[_0xab57('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xab57('0x4')]},'recallme':{'type':Sequelize[_0xab57('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xab57('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xab57('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 2d54352..2f79017 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 _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x50a4a4,_0x366a00){var _0x2d4444=function(_0x94408d){while(--_0x94408d){_0x50a4a4['push'](_0x50a4a4['shift']());}};_0x2d4444(++_0x366a00);}(_0xadb5,0xad));var _0x5adb=function(_0x18b682,_0xfc7e60){_0x18b682=_0x18b682-0x0;var _0x18d993=_0xadb5[_0x18b682];return _0x18d993;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CmHopperFinal']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file +var _0x4888=['ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','find','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','CmHopperFinal','includeAll','include','rows','catch','params','options','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','select','field','ANY_VALUE(ContactId)','ContactId'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x4888,0x198));var _0x8488=function(_0x255227,_0x2063b0){_0x255227=_0x255227-0x0;var _0x43a3e4=_0x4888[_0x255227];return _0x43a3e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':!![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')]()[_0x8488('0x21')](respondWithResult(_0x1f0516,null))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x42')]=function(_0x886a9e,_0x299d8e){if(_0x886a9e[_0x8488('0x43')][_0x8488('0x44')]){delete _0x886a9e[_0x8488('0x43')][_0x8488('0x44')];}return db[_0x8488('0x3a')]['find']({'where':{'uniqueid':_0x886a9e['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x299d8e,null))[_0x8488('0x21')](saveUpdates(_0x886a9e[_0x8488('0x43')],null))[_0x8488('0x21')](respondWithResult(_0x299d8e,null))[_0x8488('0x3e')](handleError(_0x299d8e,null));};exports[_0x8488('0x45')]=function(_0x25f2dc,_0x27dfd2,_0x24fa20){return db['CmHopperFinal'][_0x8488('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x25f2dc[_0x8488('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),_0x8488('0x4c')],[db['sequelize']['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0x8488('0x4d')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x4f')))),'dropContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x52')))),_0x8488('0x53')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x27dfd2,null))[_0x8488('0x21')](respondWithResult(_0x27dfd2,null))[_0x8488('0x3e')](handleError(_0x27dfd2,null));};exports[_0x8488('0x55')]=function(_0x1971f3,_0x24ba2d,_0x4facfb){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x1971f3[_0x8488('0x3f')]['id']},'attributes':[[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x56')))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x57')))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8488('0x58')],[db[_0x8488('0x48')]['fn']('COUNT',db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x24ba2d,null))['then'](respondWithResult(_0x24ba2d,null))[_0x8488('0x3e')](handleError(_0x24ba2d,null));};exports[_0x8488('0x59')]=function(_0x44a50b,_0x5815cb,_0xbee86e){return db[_0x8488('0x5a')]['find']({'where':{'id':_0x44a50b['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x5815cb,null))[_0x8488('0x21')](function(_0xfedfd2){var _0x3ab1b6;if(_0xfedfd2){_0x3ab1b6=squel[_0x8488('0x5b')]()[_0x8488('0x5c')](_0x8488('0x5d'))[_0x8488('0x5e')]([_0x8488('0x5f'),_0x8488('0x60'),'ContactId',_0x8488('0x61'),'VoiceQueueId',_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')]('ANY_VALUE(calleridnum)',_0x8488('0x5f'))[_0x8488('0x65')]('NOW()',_0x8488('0x60'))['field'](_0x8488('0x66'),_0x8488('0x67'))[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x69'),_0x8488('0x6a'))['field'](_0x8488('0x6b'),'createdAt')['field'](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']())[_0x8488('0x35')](_0x8488('0x6e'),_0x44a50b[_0x8488('0x43')][_0x8488('0x6f')][_0x8488('0x70')]())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8488('0x35')](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x72'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x73')))[_0x8488('0x74')]('ContactId'))[_0x8488('0x70')]();return db['sequelize'][_0x8488('0x2c')](_0x3ab1b6);}return[];})['then'](respondWithResult(_0x5815cb,null))[_0x8488('0x3e')](handleError(_0x5815cb,null));};exports[_0x8488('0x75')]=function(_0x267401,_0x1e635a,_0x31ab35){return db[_0x8488('0x76')][_0x8488('0x77')]({'where':{'id':_0x267401[_0x8488('0x3f')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x1e635a,null))[_0x8488('0x21')](function(_0xce1d1a){var _0xc9c221;if(_0xce1d1a){_0xc9c221=squel[_0x8488('0x5b')]()[_0x8488('0x5c')]('cm_hopper')[_0x8488('0x5e')]([_0x8488('0x5f'),'scheduledAt',_0x8488('0x67'),_0x8488('0x61'),_0x8488('0x78'),_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x79'),_0x8488('0x5f'))[_0x8488('0x65')](_0x8488('0x6b'),'scheduledAt')[_0x8488('0x65')](_0x8488('0x66'),'ContactId')[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x7a'),'CampaignId')['field'](_0x8488('0x6b'),_0x8488('0x62'))[_0x8488('0x65')](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')](_0x8488('0x7b'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x6e'),_0x267401[_0x8488('0x43')][_0x8488('0x6f')]['toString']())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x72'))[_0x8488('0x6c')](_0x8488('0x7b'))['where'](_0x8488('0x7c'),_0x267401['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')]('state\x20=\x204'))['group'](_0x8488('0x67')))[_0x8488('0x70')]();return db[_0x8488('0x48')][_0x8488('0x2c')](_0xc9c221);}return[];})[_0x8488('0x21')](respondWithResult(_0x1e635a,null))['catch'](handleError(_0x1e635a,null));};exports[_0x8488('0x7d')]=function(_0x19c5c6,_0x50f773,_0x52c750){return db[_0x8488('0x7e')][_0x8488('0x7f')]({'where':{'VoiceQueueId':_0x19c5c6[_0x8488('0x43')]['VoiceQueueId'],'CampaignId':_0x19c5c6['body'][_0x8488('0x78')],'ContactId':_0x19c5c6[_0x8488('0x43')][_0x8488('0x67')]}})['then'](handleEntityNotFound(_0x50f773,null))[_0x8488('0x21')](function(_0x1e4e51){if(_0x1e4e51){return _0x1e4e51;}return null;})[_0x8488('0x21')](respondWithResult(_0x50f773,null))[_0x8488('0x3e')](handleError(_0x50f773,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 87c14bc..2d36e3a 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 _0xa2b7=['uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','cm_hopper_final','calleridnum'];(function(_0x51a84c,_0x5eae5e){var _0x288f27=function(_0x5b7f7c){while(--_0x5b7f7c){_0x51a84c['push'](_0x51a84c['shift']());}};_0x288f27(++_0x5eae5e);}(_0xa2b7,0x1c9));var _0x7a2b=function(_0x18f76d,_0x534402){_0x18f76d=_0x18f76d-0x0;var _0xb70ebd=_0xa2b7[_0x18f76d];return _0xb70ebd;};'use strict';var _=require(_0x7a2b('0x0'));var util=require(_0x7a2b('0x1'));var logger=require(_0x7a2b('0x2'))(_0x7a2b('0x3'));var moment=require(_0x7a2b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a2b('0x5'));var rimraf=require('rimraf');var config=require(_0x7a2b('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x7a2b('0x7')]=function(_0x236a70,_0x1155dd){return _0x236a70[_0x7a2b('0x8')]('CmHopperFinal',attributes,{'tableName':_0x7a2b('0x9'),'paranoid':![],'indexes':[{'name':_0x7a2b('0xa'),'fields':[_0x7a2b('0xa')]},{'name':_0x7a2b('0xb'),'fields':[_0x7a2b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18af=['util','../../config/logger','bluebird','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x18af,0x1af));var _0xf18a=function(_0x618b32,_0x44df92){_0x618b32=_0x618b32-0x0;var _0x367b32=_0x18af[_0x618b32];return _0x367b32;};'use strict';var _=require(_0xf18a('0x0'));var util=require(_0xf18a('0x1'));var logger=require(_0xf18a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf18a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf18a('0x4'));var config=require('../../config/environment');var attributes=require(_0xf18a('0x5'));module[_0xf18a('0x6')]=function(_0x1c6bc8,_0x234ab4){return _0x1c6bc8[_0xf18a('0x7')](_0xf18a('0x8'),attributes,{'tableName':_0xf18a('0x9'),'paranoid':![],'indexes':[{'name':_0xf18a('0xa'),'fields':[_0xf18a('0xa')]},{'name':_0xf18a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 36a3553..fd72d21 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x27b45e,_0x25a138){var _0x2b6522=function(_0x286a4d){while(--_0x286a4d){_0x27b45e['push'](_0x27b45e['shift']());}};_0x2b6522(++_0x25a138);}(_0xb10b,0x12a));var _0xbb10=function(_0x30eb36,_0x4f7dab){_0x30eb36=_0x30eb36-0x0;var _0x1b33d1=_0xb10b[_0x30eb36];return _0x1b33d1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2a09aa,_0x1c69b3){var _0xc5894d=function(_0x5c5581){while(--_0x5c5581){_0x2a09aa['push'](_0x2a09aa['shift']());}};_0xc5894d(++_0x1c69b3);}(_0xb10b,0x12a));var _0xbb10=function(_0x294d96,_0x2a7812){_0x294d96=_0x294d96-0x0;var _0x5ceb37=_0xb10b[_0x294d96];return _0x5ceb37;};'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 aa4d4f8..e47d3bf 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 _0x1a22=['./cmHopperFinal.controller','get','isAuthenticated','index','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cc408,_0x30d40a){var _0x5d0d1a=function(_0x4cd765){while(--_0x4cd765){_0x1cc408['push'](_0x1cc408['shift']());}};_0x5d0d1a(++_0x30d40a);}(_0x1a22,0x125));var _0x21a2=function(_0x38db77,_0x18239f){_0x38db77=_0x38db77-0x0;var _0x916e60=_0x1a22[_0x38db77];return _0x916e60;};'use strict';var multer=require(_0x21a2('0x0'));var util=require(_0x21a2('0x1'));var path=require('path');var timeout=require(_0x21a2('0x2'));var express=require(_0x21a2('0x3'));var router=express[_0x21a2('0x4')]();var fs_extra=require(_0x21a2('0x5'));var auth=require(_0x21a2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21a2('0x7'));router[_0x21a2('0x8')]('/',auth[_0x21a2('0x9')](),controller[_0x21a2('0xa')]);router[_0x21a2('0x8')]('/describe',auth[_0x21a2('0x9')](),controller['describe']);router[_0x21a2('0x8')](_0x21a2('0xb'),auth[_0x21a2('0x9')](),controller[_0x21a2('0xc')]);router['get'](_0x21a2('0xd'),auth[_0x21a2('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x21a2('0xe'),auth[_0x21a2('0x9')](),controller[_0x21a2('0xf')]);router[_0x21a2('0x10')](_0x21a2('0x11'),auth['isAuthenticated'](),controller[_0x21a2('0x12')]);router[_0x21a2('0x10')](_0x21a2('0x13'),auth['isAuthenticated'](),controller[_0x21a2('0x14')]);router[_0x21a2('0x10')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x21a2('0x15')]);router[_0x21a2('0x16')](_0x21a2('0xb'),auth[_0x21a2('0x9')](),controller[_0x21a2('0x17')]);module[_0x21a2('0x18')]=router; \ No newline at end of file +var _0x46cb=['moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x269f29,_0x37c706){var _0xf09899=function(_0x5078a1){while(--_0x5078a1){_0x269f29['push'](_0x269f29['shift']());}};_0xf09899(++_0x37c706);}(_0x46cb,0x84));var _0xb46c=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46cb[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0xb46c('0x0'));var util=require(_0xb46c('0x1'));var path=require(_0xb46c('0x2'));var timeout=require(_0xb46c('0x3'));var express=require('express');var router=express[_0xb46c('0x4')]();var fs_extra=require(_0xb46c('0x5'));var auth=require(_0xb46c('0x6'));var interaction=require(_0xb46c('0x7'));var config=require('../../config/environment');var controller=require(_0xb46c('0x8'));router[_0xb46c('0x9')]('/',auth[_0xb46c('0xa')](),controller['index']);router[_0xb46c('0x9')]('/describe',auth[_0xb46c('0xa')](),controller[_0xb46c('0xb')]);router['get']('/:id',auth[_0xb46c('0xa')](),controller[_0xb46c('0xc')]);router[_0xb46c('0x9')](_0xb46c('0xd'),auth[_0xb46c('0xa')](),controller[_0xb46c('0xe')]);router['get'](_0xb46c('0xf'),auth[_0xb46c('0xa')](),controller[_0xb46c('0x10')]);router[_0xb46c('0x11')]('/voice/queue/moveContacts/:id',auth[_0xb46c('0xa')](),controller[_0xb46c('0x12')]);router[_0xb46c('0x11')]('/voice/campaign/moveContacts/:id',auth[_0xb46c('0xa')](),controller[_0xb46c('0x13')]);router['post'](_0xb46c('0x14'),auth[_0xb46c('0xa')](),controller[_0xb46c('0x15')]);router[_0xb46c('0x16')](_0xb46c('0x17'),auth[_0xb46c('0xa')](),controller[_0xb46c('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 96a44ae..27cc842 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 _0x9e2e=['INTEGER','DATE','STRING','BOOLEAN','sequelize','exports'];(function(_0x59b9c4,_0x1a853d){var _0x43893e=function(_0x2657ff){while(--_0x2657ff){_0x59b9c4['push'](_0x59b9c4['shift']());}};_0x43893e(++_0x1a853d);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x58006e,_0x6c6cc1){_0x58006e=_0x58006e-0x0;var _0x2c07de=_0x9e2e[_0x58006e];return _0x2c07de;};'use strict';var Sequelize=require(_0xe9e2('0x0'));module[_0xe9e2('0x1')]={'state':{'type':Sequelize[_0xe9e2('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe9e2('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe9e2('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe9e2('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe9e2('0x4')]},'calleridnum':{'type':Sequelize[_0xe9e2('0x4')]},'calleridname':{'type':Sequelize[_0xe9e2('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe9e2('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe9e2('0x3')]},'endtime':{'type':Sequelize[_0xe9e2('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe9e2('0x4')]},'campaign':{'type':Sequelize[_0xe9e2('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe9e2('0x4')]},'amd':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe9e2('0x3')]},'edited':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe9e2('0x4')]}}; \ No newline at end of file +var _0xbb1f=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x43e8c5,_0x2d41ab){var _0x5a211a=function(_0x21f23c){while(--_0x21f23c){_0x43e8c5['push'](_0x43e8c5['shift']());}};_0x5a211a(++_0x2d41ab);}(_0xbb1f,0x68));var _0xfbb1=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0xbb1f[_0x75267d];return _0x21ccec;};'use strict';var Sequelize=require(_0xfbb1('0x0'));module[_0xfbb1('0x1')]={'state':{'type':Sequelize[_0xfbb1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfbb1('0x3')]},'scheduledat':{'type':Sequelize[_0xfbb1('0x4')]},'countbusyretry':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfbb1('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xfbb1('0x3')]},'calleridnum':{'type':Sequelize[_0xfbb1('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xfbb1('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfbb1('0x4')]},'droptime':{'type':Sequelize[_0xfbb1('0x4')]},'endtime':{'type':Sequelize[_0xfbb1('0x4')]},'ringtime':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfbb1('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xfbb1('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xfbb1('0x3')]},'amd':{'type':Sequelize[_0xfbb1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfbb1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xfbb1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfbb1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfbb1('0x4')]},'recallme':{'type':Sequelize[_0xfbb1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfbb1('0x4')]},'edited':{'type':Sequelize[_0xfbb1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfbb1('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfbb1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 746325d..024126e 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 _0x80ab=['error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','reject','save','update','then'];(function(_0x4ef7e2,_0x257e37){var _0x84fa8=function(_0x2c967b){while(--_0x2c967b){_0x4ef7e2['push'](_0x4ef7e2['shift']());}};_0x84fa8(++_0x257e37);}(_0x80ab,0x18a));var _0xb80a=function(_0x3d9edb,_0x343e9c){_0x3d9edb=_0x3d9edb-0x0;var _0xede284=_0x80ab[_0x3d9edb];return _0xede284;};'use strict';var emlformat=require(_0xb80a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb80a('0x1'));var jsonpatch=require(_0xb80a('0x2'));var rp=require('request-promise');var moment=require(_0xb80a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb80a('0x4'));var util=require(_0xb80a('0x5'));var path=require(_0xb80a('0x6'));var sox=require('sox');var csv=require(_0xb80a('0x7'));var ejs=require(_0xb80a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb80a('0x9'));var squel=require(_0xb80a('0xa'));var crypto=require(_0xb80a('0xb'));var jsforce=require(_0xb80a('0xc'));var deskjs=require(_0xb80a('0xd'));var toCsv=require(_0xb80a('0x7'));var querystring=require(_0xb80a('0xe'));var Papa=require(_0xb80a('0xf'));var Redis=require(_0xb80a('0x10'));var authService=require(_0xb80a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb80a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb80a('0x13'))(_0xb80a('0x14'));var utils=require(_0xb80a('0x15'));var config=require(_0xb80a('0x16'));var licenseUtil=require(_0xb80a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e756,_0x27ebf1){_0x27ebf1=_0x27ebf1||0xcc;return function(_0x566703){if(_0x566703){return _0x20e756[_0xb80a('0x18')](_0x27ebf1);}return _0x20e756['status'](_0x27ebf1)[_0xb80a('0x19')]();};}function respondWithResult(_0x50d379,_0x4d9991){_0x4d9991=_0x4d9991||0xc8;return function(_0x3fd80e){if(_0x3fd80e){return _0x50d379['status'](_0x4d9991)['json'](_0x3fd80e);}};}function respondWithFilteredResult(_0x2d7ba0,_0x3f02ad){return function(_0xea6c1c){if(_0xea6c1c){var _0x108390=typeof _0x3f02ad['offset']===_0xb80a('0x1a')&&typeof _0x3f02ad[_0xb80a('0x1b')]===_0xb80a('0x1a');var _0x133cb9=_0xea6c1c[_0xb80a('0x1c')];var _0x5bd8f4=_0x108390?0x0:_0x3f02ad[_0xb80a('0x1d')];var _0x125d11=_0x108390?_0xea6c1c[_0xb80a('0x1c')]:_0x3f02ad[_0xb80a('0x1d')]+_0x3f02ad[_0xb80a('0x1b')];var _0x3974e7;if(_0x125d11>=_0x133cb9){_0x125d11=_0x133cb9;_0x3974e7=0xc8;}else{_0x3974e7=0xce;}_0x2d7ba0[_0xb80a('0x1e')](_0x3974e7);return _0x2d7ba0[_0xb80a('0x1f')](_0xb80a('0x20'),_0x5bd8f4+'-'+_0x125d11+'/'+_0x133cb9)[_0xb80a('0x21')](_0xea6c1c);}return null;};}function patchUpdates(_0x2add9d){return function(_0x3c4d4d){try{jsonpatch['apply'](_0x3c4d4d,_0x2add9d,!![]);}catch(_0x5ab6cc){return BPromise[_0xb80a('0x22')](_0x5ab6cc);}return _0x3c4d4d[_0xb80a('0x23')]();};}function saveUpdates(_0x3ee135,_0x48e4a7){return function(_0x3e3602){if(_0x3e3602){return _0x3e3602[_0xb80a('0x24')](_0x3ee135)[_0xb80a('0x25')](function(_0x4f7066){return _0x4f7066;});}return null;};}function removeEntity(_0x3d30e1,_0x23e05c){return function(_0x282409){if(_0x282409){return _0x282409['destroy']()[_0xb80a('0x25')](function(){_0x3d30e1[_0xb80a('0x1e')](0xcc)[_0xb80a('0x19')]();});}};}function handleEntityNotFound(_0x361974,_0x568baf){return function(_0x4713b7){if(!_0x4713b7){_0x361974[_0xb80a('0x18')](0x194);}return _0x4713b7;};}function handleError(_0x598ae1,_0x29a12e){_0x29a12e=_0x29a12e||0x1f4;return function(_0x363c6e){logger[_0xb80a('0x26')](_0x363c6e[_0xb80a('0x27')]);if(_0x363c6e[_0xb80a('0x28')]){delete _0x363c6e['name'];}_0x598ae1[_0xb80a('0x1e')](_0x29a12e)[_0xb80a('0x29')](_0x363c6e);};}exports[_0xb80a('0x2a')]=function(_0xc6a00b,_0x3b7f9a){var _0x5541b3={},_0xbf1486={},_0x5aa0f4={'count':0x0,'rows':[]};var _0x796a1d=_[_0xb80a('0x2b')](db[_0xb80a('0x2c')][_0xb80a('0x2d')],function(_0x35137b){return{'name':_0x35137b[_0xb80a('0x2e')],'type':_0x35137b[_0xb80a('0x2f')]['key']};});_0xbf1486[_0xb80a('0x30')]=_['map'](_0x796a1d,'name');_0xbf1486[_0xb80a('0x31')]=_[_0xb80a('0x32')](_0xc6a00b[_0xb80a('0x31')]);_0xbf1486[_0xb80a('0x33')]=_[_0xb80a('0x34')](_0xbf1486[_0xb80a('0x30')],_0xbf1486[_0xb80a('0x31')]);_0x5541b3[_0xb80a('0x35')]=_['intersection'](_0xbf1486[_0xb80a('0x30')],qs[_0xb80a('0x36')](_0xc6a00b['query'][_0xb80a('0x36')]));_0x5541b3[_0xb80a('0x35')]=_0x5541b3[_0xb80a('0x35')][_0xb80a('0x37')]?_0x5541b3[_0xb80a('0x35')]:_0xbf1486['model'];if(!_0xc6a00b[_0xb80a('0x31')]['hasOwnProperty']('nolimit')){_0x5541b3[_0xb80a('0x1b')]=qs[_0xb80a('0x1b')](_0xc6a00b[_0xb80a('0x31')][_0xb80a('0x1b')]);_0x5541b3[_0xb80a('0x1d')]=qs[_0xb80a('0x1d')](_0xc6a00b['query'][_0xb80a('0x1d')]);}_0x5541b3[_0xb80a('0x38')]=qs[_0xb80a('0x39')](_0xc6a00b['query'][_0xb80a('0x39')]);_0x5541b3['where']=qs[_0xb80a('0x33')](_[_0xb80a('0x3a')](_0xc6a00b[_0xb80a('0x31')],_0xbf1486[_0xb80a('0x33')]),_0x796a1d);if(_0xc6a00b['query'][_0xb80a('0x3b')]){_0x5541b3[_0xb80a('0x3c')]=_[_0xb80a('0x3d')](_0x5541b3['where'],{'$or':_[_0xb80a('0x2b')](_0x796a1d,function(_0x466d35){if(_0x466d35['type']!=='VIRTUAL'){var _0x118a5a={};_0x118a5a[_0x466d35['name']]={'$like':'%'+_0xc6a00b[_0xb80a('0x31')][_0xb80a('0x3b')]+'%'};return _0x118a5a;}})});}_0x5541b3=_['merge']({},_0x5541b3,_0xc6a00b['options']);var _0x3ac58f={'where':_0x5541b3['where']};return db[_0xb80a('0x2c')][_0xb80a('0x1c')](_0x3ac58f)['then'](function(_0x5a9b4f){_0x5aa0f4[_0xb80a('0x1c')]=_0x5a9b4f;if(_0xc6a00b[_0xb80a('0x31')][_0xb80a('0x3e')]){_0x5541b3[_0xb80a('0x3f')]=[{'all':!![]}];}return db[_0xb80a('0x2c')][_0xb80a('0x40')](_0x5541b3);})[_0xb80a('0x25')](function(_0x2afb31){_0x5aa0f4[_0xb80a('0x41')]=_0x2afb31;return _0x5aa0f4;})['then'](respondWithFilteredResult(_0x3b7f9a,_0x5541b3))[_0xb80a('0x42')](handleError(_0x3b7f9a,null));};exports['show']=function(_0x6b5679,_0x5c2eca){var _0x42aebe={'raw':!![],'where':{'id':_0x6b5679[_0xb80a('0x43')]['id']}},_0xecf3e1={};_0xecf3e1[_0xb80a('0x30')]=_[_0xb80a('0x32')](db['CmHopperHistory'][_0xb80a('0x2d')]);_0xecf3e1[_0xb80a('0x31')]=_[_0xb80a('0x32')](_0x6b5679[_0xb80a('0x31')]);_0xecf3e1['filters']=_[_0xb80a('0x34')](_0xecf3e1[_0xb80a('0x30')],_0xecf3e1[_0xb80a('0x31')]);_0x42aebe[_0xb80a('0x35')]=_[_0xb80a('0x34')](_0xecf3e1[_0xb80a('0x30')],qs[_0xb80a('0x36')](_0x6b5679[_0xb80a('0x31')][_0xb80a('0x36')]));_0x42aebe[_0xb80a('0x35')]=_0x42aebe['attributes'][_0xb80a('0x37')]?_0x42aebe[_0xb80a('0x35')]:_0xecf3e1[_0xb80a('0x30')];if(_0x6b5679['query'][_0xb80a('0x3e')]){_0x42aebe[_0xb80a('0x3f')]=[{'all':!![]}];}_0x42aebe=_['merge']({},_0x42aebe,_0x6b5679['options']);return db[_0xb80a('0x2c')][_0xb80a('0x44')](_0x42aebe)[_0xb80a('0x25')](handleEntityNotFound(_0x5c2eca,null))['then'](respondWithResult(_0x5c2eca,null))['catch'](handleError(_0x5c2eca,null));};exports[_0xb80a('0x45')]=function(_0x5cf3b6,_0x4b54c0){return db['CmHopperHistory'][_0xb80a('0x45')](_0x5cf3b6[_0xb80a('0x46')],{})[_0xb80a('0x25')](respondWithResult(_0x4b54c0,0xc9))[_0xb80a('0x42')](handleError(_0x4b54c0,null));};exports['describe']=function(_0x37ee2f,_0x24ac31){return db[_0xb80a('0x2c')][_0xb80a('0x47')]()[_0xb80a('0x25')](respondWithResult(_0x24ac31,null))[_0xb80a('0x42')](handleError(_0x24ac31,null));};exports[_0xb80a('0x24')]=function(_0x4af0b2,_0x1e5f96){if(_0x4af0b2[_0xb80a('0x46')]['uniqueid']){delete _0x4af0b2[_0xb80a('0x46')]['uniqueid'];}return db[_0xb80a('0x2c')]['find']({'where':{'uniqueid':_0x4af0b2[_0xb80a('0x43')]['id']}})[_0xb80a('0x25')](handleEntityNotFound(_0x1e5f96,null))[_0xb80a('0x25')](saveUpdates(_0x4af0b2[_0xb80a('0x46')],null))['then'](respondWithResult(_0x1e5f96,null))[_0xb80a('0x42')](handleError(_0x1e5f96,null));}; \ No newline at end of file +var _0x16cc=['save','update','then','error','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','uniqueid','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0x16cc,0xb5));var _0xc16c=function(_0x3122ca,_0x1eaf4c){_0x3122ca=_0x3122ca-0x0;var _0xf95988=_0x16cc[_0x3122ca];return _0xf95988;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc16c('0x0'));var jsonpatch=require(_0xc16c('0x1'));var rp=require('request-promise');var moment=require(_0xc16c('0x2'));var BPromise=require(_0xc16c('0x3'));var Mustache=require(_0xc16c('0x4'));var util=require(_0xc16c('0x5'));var path=require(_0xc16c('0x6'));var sox=require(_0xc16c('0x7'));var csv=require(_0xc16c('0x8'));var ejs=require(_0xc16c('0x9'));var fs=require('fs');var fs_extra=require(_0xc16c('0xa'));var _=require(_0xc16c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc16c('0xc'));var deskjs=require(_0xc16c('0xd'));var toCsv=require(_0xc16c('0x8'));var querystring=require('querystring');var Papa=require(_0xc16c('0xe'));var Redis=require(_0xc16c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc16c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc16c('0x11'));var logger=require(_0xc16c('0x12'))(_0xc16c('0x13'));var utils=require(_0xc16c('0x14'));var config=require(_0xc16c('0x15'));var licenseUtil=require(_0xc16c('0x16'));var db=require(_0xc16c('0x17'))['db'];function respondWithStatusCode(_0x59f30f,_0x20b9ba){_0x20b9ba=_0x20b9ba||0xcc;return function(_0x372648){if(_0x372648){return _0x59f30f[_0xc16c('0x18')](_0x20b9ba);}return _0x59f30f[_0xc16c('0x19')](_0x20b9ba)[_0xc16c('0x1a')]();};}function respondWithResult(_0x40ea97,_0x43be21){_0x43be21=_0x43be21||0xc8;return function(_0x1efc95){if(_0x1efc95){return _0x40ea97[_0xc16c('0x19')](_0x43be21)[_0xc16c('0x1b')](_0x1efc95);}};}function respondWithFilteredResult(_0x115840,_0x429268){return function(_0x2333c5){if(_0x2333c5){var _0x46d10f=typeof _0x429268[_0xc16c('0x1c')]===_0xc16c('0x1d')&&typeof _0x429268[_0xc16c('0x1e')]===_0xc16c('0x1d');var _0x503444=_0x2333c5['count'];var _0x48b9ac=_0x46d10f?0x0:_0x429268[_0xc16c('0x1c')];var _0x2df6f8=_0x46d10f?_0x2333c5[_0xc16c('0x1f')]:_0x429268[_0xc16c('0x1c')]+_0x429268[_0xc16c('0x1e')];var _0x703ab2;if(_0x2df6f8>=_0x503444){_0x2df6f8=_0x503444;_0x703ab2=0xc8;}else{_0x703ab2=0xce;}_0x115840[_0xc16c('0x19')](_0x703ab2);return _0x115840['set'](_0xc16c('0x20'),_0x48b9ac+'-'+_0x2df6f8+'/'+_0x503444)['json'](_0x2333c5);}return null;};}function patchUpdates(_0x2c8a65){return function(_0x320a15){try{jsonpatch[_0xc16c('0x21')](_0x320a15,_0x2c8a65,!![]);}catch(_0x1b6a75){return BPromise[_0xc16c('0x22')](_0x1b6a75);}return _0x320a15[_0xc16c('0x23')]();};}function saveUpdates(_0x1adac0,_0x44b26a){return function(_0x104b9c){if(_0x104b9c){return _0x104b9c[_0xc16c('0x24')](_0x1adac0)[_0xc16c('0x25')](function(_0x4c9975){return _0x4c9975;});}return null;};}function removeEntity(_0x17d299,_0x127594){return function(_0x26338e){if(_0x26338e){return _0x26338e['destroy']()['then'](function(){_0x17d299['status'](0xcc)[_0xc16c('0x1a')]();});}};}function handleEntityNotFound(_0x16ccd7,_0x5f355f){return function(_0x30156d){if(!_0x30156d){_0x16ccd7[_0xc16c('0x18')](0x194);}return _0x30156d;};}function handleError(_0x33d104,_0x58962b){_0x58962b=_0x58962b||0x1f4;return function(_0x36d2d3){logger[_0xc16c('0x26')](_0x36d2d3['stack']);if(_0x36d2d3['name']){delete _0x36d2d3[_0xc16c('0x27')];}_0x33d104['status'](_0x58962b)['send'](_0x36d2d3);};}exports[_0xc16c('0x28')]=function(_0x49582c,_0x50fc24){var _0x6f56f1={},_0x590ad1={},_0x54c3c0={'count':0x0,'rows':[]};var _0x31bbe7=_[_0xc16c('0x29')](db[_0xc16c('0x2a')][_0xc16c('0x2b')],function(_0x469c25){return{'name':_0x469c25[_0xc16c('0x2c')],'type':_0x469c25[_0xc16c('0x2d')][_0xc16c('0x2e')]};});_0x590ad1['model']=_[_0xc16c('0x29')](_0x31bbe7,_0xc16c('0x27'));_0x590ad1['query']=_[_0xc16c('0x2f')](_0x49582c[_0xc16c('0x30')]);_0x590ad1[_0xc16c('0x31')]=_[_0xc16c('0x32')](_0x590ad1[_0xc16c('0x33')],_0x590ad1['query']);_0x6f56f1[_0xc16c('0x34')]=_[_0xc16c('0x32')](_0x590ad1[_0xc16c('0x33')],qs[_0xc16c('0x35')](_0x49582c[_0xc16c('0x30')]['fields']));_0x6f56f1[_0xc16c('0x34')]=_0x6f56f1[_0xc16c('0x34')][_0xc16c('0x36')]?_0x6f56f1[_0xc16c('0x34')]:_0x590ad1[_0xc16c('0x33')];if(!_0x49582c[_0xc16c('0x30')][_0xc16c('0x37')](_0xc16c('0x38'))){_0x6f56f1[_0xc16c('0x1e')]=qs['limit'](_0x49582c[_0xc16c('0x30')][_0xc16c('0x1e')]);_0x6f56f1[_0xc16c('0x1c')]=qs[_0xc16c('0x1c')](_0x49582c[_0xc16c('0x30')][_0xc16c('0x1c')]);}_0x6f56f1['order']=qs[_0xc16c('0x39')](_0x49582c[_0xc16c('0x30')][_0xc16c('0x39')]);_0x6f56f1[_0xc16c('0x3a')]=qs[_0xc16c('0x31')](_['pick'](_0x49582c[_0xc16c('0x30')],_0x590ad1[_0xc16c('0x31')]),_0x31bbe7);if(_0x49582c[_0xc16c('0x30')]['filter']){_0x6f56f1[_0xc16c('0x3a')]=_[_0xc16c('0x3b')](_0x6f56f1['where'],{'$or':_[_0xc16c('0x29')](_0x31bbe7,function(_0x2b6835){if(_0x2b6835[_0xc16c('0x2d')]!==_0xc16c('0x3c')){var _0x415159={};_0x415159[_0x2b6835['name']]={'$like':'%'+_0x49582c[_0xc16c('0x30')]['filter']+'%'};return _0x415159;}})});}_0x6f56f1=_[_0xc16c('0x3b')]({},_0x6f56f1,_0x49582c['options']);var _0x18deee={'where':_0x6f56f1['where']};return db['CmHopperHistory']['count'](_0x18deee)[_0xc16c('0x25')](function(_0x225477){_0x54c3c0[_0xc16c('0x1f')]=_0x225477;if(_0x49582c[_0xc16c('0x30')][_0xc16c('0x3d')]){_0x6f56f1[_0xc16c('0x3e')]=[{'all':!![]}];}return db[_0xc16c('0x2a')][_0xc16c('0x3f')](_0x6f56f1);})[_0xc16c('0x25')](function(_0x7285eb){_0x54c3c0[_0xc16c('0x40')]=_0x7285eb;return _0x54c3c0;})[_0xc16c('0x25')](respondWithFilteredResult(_0x50fc24,_0x6f56f1))['catch'](handleError(_0x50fc24,null));};exports['show']=function(_0xdacbc7,_0x532a61){var _0x3b6548={'raw':!![],'where':{'id':_0xdacbc7[_0xc16c('0x41')]['id']}},_0x16fa2c={};_0x16fa2c[_0xc16c('0x33')]=_['keys'](db['CmHopperHistory'][_0xc16c('0x2b')]);_0x16fa2c[_0xc16c('0x30')]=_['keys'](_0xdacbc7[_0xc16c('0x30')]);_0x16fa2c[_0xc16c('0x31')]=_[_0xc16c('0x32')](_0x16fa2c[_0xc16c('0x33')],_0x16fa2c['query']);_0x3b6548['attributes']=_[_0xc16c('0x32')](_0x16fa2c[_0xc16c('0x33')],qs[_0xc16c('0x35')](_0xdacbc7[_0xc16c('0x30')][_0xc16c('0x35')]));_0x3b6548[_0xc16c('0x34')]=_0x3b6548[_0xc16c('0x34')]['length']?_0x3b6548[_0xc16c('0x34')]:_0x16fa2c['model'];if(_0xdacbc7[_0xc16c('0x30')][_0xc16c('0x3d')]){_0x3b6548[_0xc16c('0x3e')]=[{'all':!![]}];}_0x3b6548=_['merge']({},_0x3b6548,_0xdacbc7[_0xc16c('0x42')]);return db[_0xc16c('0x2a')][_0xc16c('0x43')](_0x3b6548)[_0xc16c('0x25')](handleEntityNotFound(_0x532a61,null))[_0xc16c('0x25')](respondWithResult(_0x532a61,null))[_0xc16c('0x44')](handleError(_0x532a61,null));};exports['create']=function(_0x2ea2c0,_0x5c9461){return db[_0xc16c('0x2a')][_0xc16c('0x45')](_0x2ea2c0[_0xc16c('0x46')],{})[_0xc16c('0x25')](respondWithResult(_0x5c9461,0xc9))[_0xc16c('0x44')](handleError(_0x5c9461,null));};exports['describe']=function(_0x4cc89b,_0x4ce332){return db[_0xc16c('0x2a')]['describe']()[_0xc16c('0x25')](respondWithResult(_0x4ce332,null))[_0xc16c('0x44')](handleError(_0x4ce332,null));};exports[_0xc16c('0x24')]=function(_0x29612d,_0x163a8f){if(_0x29612d[_0xc16c('0x46')][_0xc16c('0x47')]){delete _0x29612d[_0xc16c('0x46')][_0xc16c('0x47')];}return db[_0xc16c('0x2a')]['find']({'where':{'uniqueid':_0x29612d[_0xc16c('0x41')]['id']}})['then'](handleEntityNotFound(_0x163a8f,null))[_0xc16c('0x25')](saveUpdates(_0x29612d[_0xc16c('0x46')],null))[_0xc16c('0x25')](respondWithResult(_0x163a8f,null))['catch'](handleError(_0x163a8f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 4d69fc3..3e85514 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 _0x2bab=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','define','cm_hopper_history','uniqueid','lodash','util'];(function(_0x38da37,_0x55b675){var _0x1e3a85=function(_0x15f63e){while(--_0x15f63e){_0x38da37['push'](_0x38da37['shift']());}};_0x1e3a85(++_0x55b675);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x2d3ae4,_0x3d3f2c){_0x2d3ae4=_0x2d3ae4-0x0;var _0x3da84e=_0x2bab[_0x2d3ae4];return _0x3da84e;};'use strict';var _=require(_0xb2ba('0x0'));var util=require(_0xb2ba('0x1'));var logger=require(_0xb2ba('0x2'))(_0xb2ba('0x3'));var moment=require('moment');var BPromise=require(_0xb2ba('0x4'));var rp=require(_0xb2ba('0x5'));var fs=require('fs');var path=require(_0xb2ba('0x6'));var rimraf=require('rimraf');var config=require(_0xb2ba('0x7'));var attributes=require(_0xb2ba('0x8'));module['exports']=function(_0x5ea667,_0x5ab92f){return _0x5ea667[_0xb2ba('0x9')]('CmHopperHistory',attributes,{'tableName':_0xb2ba('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xb2ba('0xb'),'fields':[_0xb2ba('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44c2=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4466d6,_0x3b6acd){var _0x326fb1=function(_0x503c0c){while(--_0x503c0c){_0x4466d6['push'](_0x4466d6['shift']());}};_0x326fb1(++_0x3b6acd);}(_0x44c2,0x100));var _0x244c=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x44c2[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var logger=require(_0x244c('0x2'))(_0x244c('0x3'));var moment=require('moment');var BPromise=require(_0x244c('0x4'));var rp=require(_0x244c('0x5'));var fs=require('fs');var path=require(_0x244c('0x6'));var rimraf=require(_0x244c('0x7'));var config=require(_0x244c('0x8'));var attributes=require(_0x244c('0x9'));module['exports']=function(_0x5b6f9a,_0x446a4c){return _0x5b6f9a['define'](_0x244c('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x244c('0xb')]},{'name':_0x244c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index cf90f42..4736878 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 _0xbee3=['outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x46adcd,_0x15c37b){var _0x2f9454=function(_0x49234a){while(--_0x49234a){_0x46adcd['push'](_0x46adcd['shift']());}};_0x2f9454(++_0x15c37b);}(_0xbee3,0xd5));var _0x3bee=function(_0x133673,_0x3b50c9){_0x133673=_0x133673-0x0;var _0x6ac4cc=_0xbee3[_0x133673];return _0x6ac4cc;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fdeec,_0x28d912,_0x1b510d){return new BPromise(function(_0x339223,_0xbdd5d5){return client[_0x3bee('0x8')](_0x2fdeec,_0x1b510d)[_0x3bee('0x9')](function(_0x518e2d){logger[_0x3bee('0xa')](_0x3bee('0xb'),_0x28d912,_0x3bee('0xc'));logger[_0x3bee('0xd')](_0x3bee('0xe'),_0x28d912,_0x3bee('0xc'),JSON['stringify'](_0x518e2d));if(_0x518e2d[_0x3bee('0xf')]){if(_0x518e2d['error'][_0x3bee('0x10')]===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0xbdd5d5(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}logger['error'](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x339223(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x28d912,_0x3bee('0xc'));_0x339223(_0x518e2d['result'][_0x3bee('0x11')]);}})[_0x3bee('0x12')](function(_0x57d42c){logger['error'](_0x3bee('0xb'),_0x28d912,_0x57d42c);_0xbdd5d5(_0x57d42c);});});}exports[_0x3bee('0x13')]=function(_0xfdba3b){var _0x631ff8=this;return new Promise(function(_0x49095a,_0x30a1de){return db[_0x3bee('0x14')][_0x3bee('0x15')](_0xfdba3b[_0x3bee('0x16')],{'raw':_0xfdba3b[_0x3bee('0x17')]?_0xfdba3b[_0x3bee('0x17')][_0x3bee('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4f36af){logger[_0x3bee('0xa')](_0x3bee('0x13'),_0xfdba3b);logger['debug'](_0x3bee('0x13'),_0xfdba3b,JSON[_0x3bee('0x19')](_0x4f36af));_0x49095a(_0x4f36af);})[_0x3bee('0x12')](function(_0x179e62){logger[_0x3bee('0xf')](_0x3bee('0x13'),_0x179e62[_0x3bee('0x11')],_0xfdba3b);_0x30a1de(_0x631ff8['error'](0x1f4,_0x179e62[_0x3bee('0x11')]));});});};exports[_0x3bee('0x1a')]=function(_0x1fed5a){var _0x3bb884=this;return new Promise(function(_0x500664,_0x45249c){return db[_0x3bee('0x14')][_0x3bee('0x1b')]({'raw':_0x1fed5a['options']?_0x1fed5a['options'][_0x3bee('0x18')]===undefined?!![]:![]:!![],'where':_0x1fed5a[_0x3bee('0x17')]?_0x1fed5a['options'][_0x3bee('0x1c')]||null:null,'attributes':[[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db['sequelize'][_0x3bee('0x1f')]('id')),_0x3bee('0x20')],[db[_0x3bee('0x1d')]['fn']('COUNT',db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x3bee('0x22')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x3bee('0x23')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x3bee('0x24')))),_0x3bee('0x25')],[db['sequelize']['fn']('AVG',db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x26')))),_0x3bee('0x27')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x28'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x3bee('0x9')](function(_0x4a4706){logger['info'](_0x3bee('0x1a'),_0x1fed5a);logger[_0x3bee('0xd')](_0x3bee('0x1a'),_0x1fed5a,JSON[_0x3bee('0x19')](_0x4a4706));_0x500664(_0x4a4706);})[_0x3bee('0x12')](function(_0x232fac){logger[_0x3bee('0xf')](_0x3bee('0x1a'),_0x232fac['message'],_0x1fed5a);_0x45249c(_0x3bb884[_0x3bee('0xf')](0x1f4,_0x232fac[_0x3bee('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3711e4){var _0x28181b=this;return new Promise(function(_0x106ce6,_0x13d2d5){return db[_0x3bee('0x14')]['findAll']({'raw':_0x3711e4['options']?_0x3711e4[_0x3bee('0x17')][_0x3bee('0x18')]===undefined?!![]:![]:!![],'where':_0x3711e4[_0x3bee('0x17')]?_0x3711e4[_0x3bee('0x17')][_0x3bee('0x1c')]||null:null,'attributes':[[_0x3bee('0x29'),_0x3bee('0x2a')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0x3bee('0x2b')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x2c')))),_0x3bee('0x2d')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x3bee('0x2e')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x2f')))),_0x3bee('0x30')],[db['sequelize']['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')]['literal'](_0x3bee('0x31')))),'outboundCongestionCallsDay'],[db[_0x3bee('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x32')))),_0x3bee('0x33')],[db[_0x3bee('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3bee('0x1d')]['literal'](_0x3bee('0x34')))),'outboundDropCallsDayCallersExit'],[db[_0x3bee('0x1d')]['fn']('COUNT',db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x35')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x3bee('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3bee('0x36')))),'outboundBlacklistCallsDay'],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db['sequelize'][_0x3bee('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x3bee('0x37')],[db['sequelize']['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')]['literal'](_0x3bee('0x38')))),_0x3bee('0x39')],[db[_0x3bee('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x3a')))),_0x3bee('0x3b')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db['sequelize'][_0x3bee('0x21')](_0x3bee('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x3bee('0x1e'),db['sequelize']['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x3d')))),'outboundReCallsDay']],'group':[_0x3bee('0x29')]})[_0x3bee('0x9')](function(_0x127cb8){logger['info'](_0x3bee('0x3e'),_0x3711e4);logger[_0x3bee('0xd')]('GetVoiceQueueHopperHistory',_0x3711e4,JSON[_0x3bee('0x19')](_0x127cb8));_0x106ce6(_0x127cb8);})[_0x3bee('0x12')](function(_0x53c881){logger[_0x3bee('0xf')](_0x3bee('0x3e'),_0x53c881[_0x3bee('0x11')],_0x3711e4);_0x13d2d5(_0x28181b[_0x3bee('0xf')](0x1f4,_0x53c881[_0x3bee('0x11')]));});});};exports[_0x3bee('0x3f')]=function(_0xf7f9c3){var _0x72c2c4=this;return new Promise(function(_0x4c981f,_0x51fd46){return db[_0x3bee('0x14')]['findAll']({'raw':_0xf7f9c3[_0x3bee('0x17')]?_0xf7f9c3[_0x3bee('0x17')][_0x3bee('0x18')]===undefined?!![]:![]:!![],'where':_0xf7f9c3['options']?_0xf7f9c3[_0x3bee('0x17')][_0x3bee('0x1c')]||null:null,'attributes':[[_0x3bee('0x29'),'name'],[db[_0x3bee('0x1d')]['fn']('COUNT',db[_0x3bee('0x1d')][_0x3bee('0x1f')]('id')),_0x3bee('0x40')],[db['sequelize']['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x3bee('0x41')]],'group':[_0x3bee('0x29')]})[_0x3bee('0x9')](function(_0x4e6b22){logger['info'](_0x3bee('0x3f'),_0xf7f9c3);logger['debug']('GetCampaignHopperHistory',_0xf7f9c3,JSON[_0x3bee('0x19')](_0x4e6b22));_0x4c981f(_0x4e6b22);})[_0x3bee('0x12')](function(_0x43d3bc){logger['error']('GetCampaignHopperHistory',_0x43d3bc[_0x3bee('0x11')],_0xf7f9c3);_0x51fd46(_0x72c2c4[_0x3bee('0xf')](0x1f4,_0x43d3bc['message']));});});}; \ No newline at end of file +var _0x0f73=['findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime'];(function(_0x536fb3,_0x3c3201){var _0x182cbf=function(_0x394f2b){while(--_0x394f2b){_0x536fb3['push'](_0x536fb3['shift']());}};_0x182cbf(++_0x3c3201);}(_0x0f73,0x146));var _0x30f7=function(_0x3d5806,_0x1e01e2){_0x3d5806=_0x3d5806-0x0;var _0x50cb96=_0x0f73[_0x3d5806];return _0x50cb96;};'use strict';var _=require(_0x30f7('0x0'));var util=require(_0x30f7('0x1'));var moment=require(_0x30f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30f7('0x3'));var db=require(_0x30f7('0x4'))['db'];var utils=require(_0x30f7('0x5'));var logger=require(_0x30f7('0x6'))(_0x30f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x30f7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38ad1d,_0x1c90cb,_0x2de5e7){return new BPromise(function(_0x7e377e,_0x5c5cf3){return client[_0x30f7('0x9')](_0x38ad1d,_0x2de5e7)[_0x30f7('0xa')](function(_0x5eedb2){logger[_0x30f7('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x1c90cb,'request\x20sent');logger[_0x30f7('0xc')](_0x30f7('0xd'),_0x1c90cb,_0x30f7('0xe'),JSON[_0x30f7('0xf')](_0x5eedb2));if(_0x5eedb2['error']){if(_0x5eedb2[_0x30f7('0x10')][_0x30f7('0x11')]===0x1f4){logger['error'](_0x30f7('0x12'),_0x1c90cb,_0x5eedb2[_0x30f7('0x10')][_0x30f7('0x13')]);return _0x5c5cf3(_0x5eedb2['error'][_0x30f7('0x13')]);}logger[_0x30f7('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x1c90cb,_0x5eedb2[_0x30f7('0x10')][_0x30f7('0x13')]);return _0x7e377e(_0x5eedb2[_0x30f7('0x10')][_0x30f7('0x13')]);}else{logger[_0x30f7('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x1c90cb,'request\x20sent');_0x7e377e(_0x5eedb2[_0x30f7('0x14')][_0x30f7('0x13')]);}})[_0x30f7('0x15')](function(_0x1a5565){logger['error'](_0x30f7('0x12'),_0x1c90cb,_0x1a5565);_0x5c5cf3(_0x1a5565);});});}exports[_0x30f7('0x16')]=function(_0x1efb71){var _0x1083e3=this;return new Promise(function(_0x1e7777,_0x21f3d1){return db[_0x30f7('0x17')][_0x30f7('0x18')](_0x1efb71[_0x30f7('0x19')],{'raw':_0x1efb71['options']?_0x1efb71[_0x30f7('0x1a')][_0x30f7('0x1b')]===undefined?!![]:![]:!![]})[_0x30f7('0xa')](function(_0x12cdf1){logger[_0x30f7('0xb')](_0x30f7('0x16'),_0x1efb71);logger['debug'](_0x30f7('0x16'),_0x1efb71,JSON[_0x30f7('0xf')](_0x12cdf1));_0x1e7777(_0x12cdf1);})['catch'](function(_0x570d52){logger[_0x30f7('0x10')]('CreateCmHopperHistory',_0x570d52['message'],_0x1efb71);_0x21f3d1(_0x1083e3['error'](0x1f4,_0x570d52[_0x30f7('0x13')]));});});};exports[_0x30f7('0x1c')]=function(_0x4c686d){var _0x4b77ec=this;return new Promise(function(_0x2ad9e5,_0x86b4f8){return db['CmHopperHistory'][_0x30f7('0x1d')]({'raw':_0x4c686d[_0x30f7('0x1a')]?_0x4c686d[_0x30f7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4c686d[_0x30f7('0x1a')]?_0x4c686d[_0x30f7('0x1a')]['where']||null:null,'attributes':[[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db['sequelize'][_0x30f7('0x20')]('id')),_0x30f7('0x21')],[db['sequelize']['fn'](_0x30f7('0x1f'),db['sequelize']['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x23')))),_0x30f7('0x24')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x30f7('0x1e')]['fn']('COUNT',db[_0x30f7('0x1e')]['fn']('IF',db['sequelize'][_0x30f7('0x22')](_0x30f7('0x26')))),_0x30f7('0x27')],[db[_0x30f7('0x1e')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x28')))),_0x30f7('0x29')],[db['sequelize']['fn'](_0x30f7('0x2a'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x2b')))),_0x30f7('0x2c')]]})[_0x30f7('0xa')](function(_0x16c791){logger[_0x30f7('0xb')]('AvgHandleTime',_0x4c686d);logger[_0x30f7('0xc')](_0x30f7('0x1c'),_0x4c686d,JSON[_0x30f7('0xf')](_0x16c791));_0x2ad9e5(_0x16c791);})[_0x30f7('0x15')](function(_0x579f46){logger[_0x30f7('0x10')](_0x30f7('0x1c'),_0x579f46[_0x30f7('0x13')],_0x4c686d);_0x86b4f8(_0x4b77ec['error'](0x1f4,_0x579f46[_0x30f7('0x13')]));});});};exports[_0x30f7('0x2d')]=function(_0x32214e){var _0x1e46ba=this;return new Promise(function(_0x1f4d3f,_0x31253a){return db[_0x30f7('0x17')][_0x30f7('0x1d')]({'raw':_0x32214e['options']?_0x32214e[_0x30f7('0x1a')][_0x30f7('0x1b')]===undefined?!![]:![]:!![],'where':_0x32214e['options']?_0x32214e[_0x30f7('0x1a')][_0x30f7('0x2e')]||null:null,'attributes':[[_0x30f7('0x2f'),_0x30f7('0x30')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x31')))),_0x30f7('0x32')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')]['literal'](_0x30f7('0x33')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x23')))),_0x30f7('0x34')],[db[_0x30f7('0x1e')]['fn']('COUNT',db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x30f7('0x1f'),db['sequelize']['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x35')))),'outboundCongestionCallsDay'],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x36')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x30f7('0x1f'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x30f7('0x37')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x30f7('0x22')](_0x30f7('0x38')))),'outboundUnknownCallsDay'],[db[_0x30f7('0x1e')]['fn']('COUNT',db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x39')))),_0x30f7('0x3a')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x3b')))),_0x30f7('0x3c')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x3d')))),_0x30f7('0x3e')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db['sequelize']['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x3f')))),_0x30f7('0x40')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x41')))),_0x30f7('0x3e')],[db[_0x30f7('0x1e')]['fn']('COUNT',db[_0x30f7('0x1e')]['fn']('IF',db['sequelize'][_0x30f7('0x22')](_0x30f7('0x42')))),_0x30f7('0x43')]],'group':['campaign']})[_0x30f7('0xa')](function(_0x9fc9f){logger[_0x30f7('0xb')]('GetVoiceQueueHopperHistory',_0x32214e);logger['debug'](_0x30f7('0x2d'),_0x32214e,JSON[_0x30f7('0xf')](_0x9fc9f));_0x1f4d3f(_0x9fc9f);})['catch'](function(_0x5c00f2){logger[_0x30f7('0x10')](_0x30f7('0x2d'),_0x5c00f2['message'],_0x32214e);_0x31253a(_0x1e46ba[_0x30f7('0x10')](0x1f4,_0x5c00f2[_0x30f7('0x13')]));});});};exports[_0x30f7('0x44')]=function(_0x314e74){var _0x2a16f7=this;return new Promise(function(_0x1455d7,_0x2180aa){return db[_0x30f7('0x17')][_0x30f7('0x1d')]({'raw':_0x314e74[_0x30f7('0x1a')]?_0x314e74['options'][_0x30f7('0x1b')]===undefined?!![]:![]:!![],'where':_0x314e74['options']?_0x314e74[_0x30f7('0x1a')][_0x30f7('0x2e')]||null:null,'attributes':[[_0x30f7('0x2f'),_0x30f7('0x30')],[db[_0x30f7('0x1e')]['fn'](_0x30f7('0x1f'),db['sequelize'][_0x30f7('0x20')]('id')),_0x30f7('0x45')],[db['sequelize']['fn']('COUNT',db[_0x30f7('0x1e')]['fn']('IF',db[_0x30f7('0x1e')][_0x30f7('0x22')](_0x30f7('0x23')))),_0x30f7('0x46')]],'group':[_0x30f7('0x2f')]})[_0x30f7('0xa')](function(_0x27bf73){logger[_0x30f7('0xb')](_0x30f7('0x44'),_0x314e74);logger[_0x30f7('0xc')](_0x30f7('0x44'),_0x314e74,JSON[_0x30f7('0xf')](_0x27bf73));_0x1455d7(_0x27bf73);})[_0x30f7('0x15')](function(_0x3d1ba1){logger[_0x30f7('0x10')](_0x30f7('0x44'),_0x3d1ba1[_0x30f7('0x13')],_0x314e74);_0x2180aa(_0x2a16f7[_0x30f7('0x10')](0x1f4,_0x3d1ba1[_0x30f7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f060ece..c5b1177 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 _0x2ca8=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','post','put','update'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x2ca8,0x166));var _0x82ca=function(_0x590371,_0x1b2c96){_0x590371=_0x590371-0x0;var _0x4e830f=_0x2ca8[_0x590371];return _0x4e830f;};'use strict';var multer=require('multer');var util=require(_0x82ca('0x0'));var path=require(_0x82ca('0x1'));var timeout=require(_0x82ca('0x2'));var express=require(_0x82ca('0x3'));var router=express[_0x82ca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x82ca('0x5'));var interaction=require(_0x82ca('0x6'));var config=require(_0x82ca('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x82ca('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x82ca('0x8')](_0x82ca('0x9'),auth[_0x82ca('0xa')](),controller['describe']);router['get'](_0x82ca('0xb'),auth['isAuthenticated'](),controller[_0x82ca('0xc')]);router[_0x82ca('0xd')]('/',auth[_0x82ca('0xa')](),controller['create']);router[_0x82ca('0xe')](_0x82ca('0xb'),auth[_0x82ca('0xa')](),controller[_0x82ca('0xf')]);module[_0x82ca('0x10')]=router; \ No newline at end of file +var _0xdb25=['put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','post','create'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xdb25,0xdb));var _0x5db2=function(_0xaa5ed6,_0x3c39cb){_0xaa5ed6=_0xaa5ed6-0x0;var _0x29847d=_0xdb25[_0xaa5ed6];return _0x29847d;};'use strict';var multer=require(_0x5db2('0x0'));var util=require(_0x5db2('0x1'));var path=require(_0x5db2('0x2'));var timeout=require(_0x5db2('0x3'));var express=require('express');var router=express[_0x5db2('0x4')]();var fs_extra=require(_0x5db2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5db2('0x6'));var config=require('../../config/environment');var controller=require(_0x5db2('0x7'));router[_0x5db2('0x8')]('/',auth[_0x5db2('0x9')](),controller['index']);router[_0x5db2('0x8')](_0x5db2('0xa'),auth[_0x5db2('0x9')](),controller[_0x5db2('0xb')]);router[_0x5db2('0x8')](_0x5db2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5db2('0xd')]('/',auth[_0x5db2('0x9')](),controller[_0x5db2('0xe')]);router[_0x5db2('0xf')](_0x5db2('0xc'),auth[_0x5db2('0x9')](),controller[_0x5db2('0x10')]);module[_0x5db2('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 576841a..28416e9 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 _0x28e3=['STRING','name','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x28e3,0x106));var _0x328e=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x28e3[_0x5ac84c];return _0x3c53d2;};'use strict';var Sequelize=require(_0x328e('0x0'));module[_0x328e('0x1')]={'name':{'type':Sequelize[_0x328e('0x2')],'unique':_0x328e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x328e('0x2')]}}; \ No newline at end of file +var _0x279d=['sequelize','exports','STRING','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x279d,0x1d8));var _0xd279=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x279d[_0x1477ef];return _0x164acd;};'use strict';var Sequelize=require(_0xd279('0x0'));module[_0xd279('0x1')]={'name':{'type':Sequelize[_0xd279('0x2')],'unique':_0xd279('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 5fa06d6..e244339 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 _0xcf6b=['model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','ListId','Disposition','getDispositions','findOne','rawAttributes','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','hasOwnProperty','raw','ContactItemType','OrderBy','CmCustomField','alias','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','select','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','number','Sequelize','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','spread','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','get','Lists','UserProfileResource','destroy','stack','name','CmList','fieldName','type','key'];(function(_0x3ad7be,_0x224585){var _0x2b6c8a=function(_0xa09237){while(--_0xa09237){_0x3ad7be['push'](_0x3ad7be['shift']());}};_0x2b6c8a(++_0x224585);}(_0xcf6b,0x72));var _0xbcf6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcf6b[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xbcf6('0x0'));var rimraf=require(_0xbcf6('0x1'));var zipdir=require(_0xbcf6('0x2'));var jsonpatch=require(_0xbcf6('0x3'));var rp=require('request-promise');var moment=require(_0xbcf6('0x4'));var BPromise=require(_0xbcf6('0x5'));var Mustache=require(_0xbcf6('0x6'));var util=require(_0xbcf6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbcf6('0x8'));var ejs=require(_0xbcf6('0x9'));var fs=require('fs');var fs_extra=require(_0xbcf6('0xa'));var _=require(_0xbcf6('0xb'));var squel=require(_0xbcf6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbcf6('0xd'));var toCsv=require(_0xbcf6('0x8'));var querystring=require(_0xbcf6('0xe'));var Papa=require('papaparse');var Redis=require(_0xbcf6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbcf6('0x10'));var hardwareService=require(_0xbcf6('0x11'));var logger=require(_0xbcf6('0x12'))(_0xbcf6('0x13'));var utils=require('../../config/utils');var config=require(_0xbcf6('0x14'));var licenseUtil=require(_0xbcf6('0x15'));var db=require(_0xbcf6('0x16'))['db'];var csv_results;config[_0xbcf6('0x17')]=_[_0xbcf6('0x18')](config[_0xbcf6('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcf6('0x19'))(new Redis(config[_0xbcf6('0x17')]));require('./cmList.socket')[_0xbcf6('0x1a')](socket);function respondWithStatusCode(_0xaa2d54,_0x26c683){_0x26c683=_0x26c683||0xcc;return function(_0x157db6){if(_0x157db6){return _0xaa2d54['sendStatus'](_0x26c683);}return _0xaa2d54['status'](_0x26c683)['end']();};}function respondWithResult(_0x51537f,_0xdc824d){_0xdc824d=_0xdc824d||0xc8;return function(_0x11e87a){if(_0x11e87a){return _0x51537f[_0xbcf6('0x1b')](_0xdc824d)[_0xbcf6('0x1c')](_0x11e87a);}};}function respondWithFilteredResult(_0x48aa84,_0x1dc6c9){return function(_0x992387){if(_0x992387){var _0x39388e=typeof _0x1dc6c9[_0xbcf6('0x1d')]===_0xbcf6('0x1e')&&typeof _0x1dc6c9['limit']===_0xbcf6('0x1e');var _0x5f1d52=_0x992387[_0xbcf6('0x1f')];var _0x9153c2=_0x39388e?0x0:_0x1dc6c9[_0xbcf6('0x1d')];var _0x340890=_0x39388e?_0x992387[_0xbcf6('0x1f')]:_0x1dc6c9['offset']+_0x1dc6c9[_0xbcf6('0x20')];var _0x5b4061;if(_0x340890>=_0x5f1d52){_0x340890=_0x5f1d52;_0x5b4061=0xc8;}else{_0x5b4061=0xce;}_0x48aa84[_0xbcf6('0x1b')](_0x5b4061);return _0x48aa84['set'](_0xbcf6('0x21'),_0x9153c2+'-'+_0x340890+'/'+_0x5f1d52)[_0xbcf6('0x1c')](_0x992387);}return null;};}function patchUpdates(_0x5b6273){return function(_0x5f03a3){try{jsonpatch[_0xbcf6('0x22')](_0x5f03a3,_0x5b6273,!![]);}catch(_0x34fb4e){return BPromise['reject'](_0x34fb4e);}return _0x5f03a3[_0xbcf6('0x23')]();};}function saveUpdates(_0x95b32c,_0x445d8e){return function(_0x1fbac6){if(_0x1fbac6){return _0x1fbac6[_0xbcf6('0x24')](_0x95b32c)['then'](function(_0x398fe8){return _0x398fe8;});}return null;};}function removeEntity(_0x323021,_0x3bf80a){return function(_0xbc32ec){if(_0xbc32ec){return _0xbc32ec['destroy']()[_0xbcf6('0x25')](function(){var _0x3ea3ad=_0xbc32ec[_0xbcf6('0x26')]({'plain':!![]});var _0x4d0796=_0xbcf6('0x27');return db[_0xbcf6('0x28')][_0xbcf6('0x29')]({'where':{'type':_0x4d0796,'resourceId':_0x3ea3ad['id']}})['then'](function(){return _0xbc32ec;});})[_0xbcf6('0x25')](function(){_0x323021['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c1f8d,_0x563bdf){return function(_0x33ad06){if(!_0x33ad06){_0x2c1f8d['sendStatus'](0x194);}return _0x33ad06;};}function handleError(_0x4e894e,_0x4048ed){_0x4048ed=_0x4048ed||0x1f4;return function(_0x1788ea){logger['error'](_0x1788ea[_0xbcf6('0x2a')]);if(_0x1788ea['name']){delete _0x1788ea[_0xbcf6('0x2b')];}_0x4e894e[_0xbcf6('0x1b')](_0x4048ed)['send'](_0x1788ea);};}exports['index']=function(_0x5c44a1,_0x4c859d){var _0x72e391={},_0x242f25={},_0x44a292={'count':0x0,'rows':[]};var _0x2206d3=_['map'](db[_0xbcf6('0x2c')]['rawAttributes'],function(_0x2f9e9f){return{'name':_0x2f9e9f[_0xbcf6('0x2d')],'type':_0x2f9e9f[_0xbcf6('0x2e')][_0xbcf6('0x2f')]};});_0x242f25[_0xbcf6('0x30')]=_[_0xbcf6('0x31')](_0x2206d3,_0xbcf6('0x2b'));_0x242f25[_0xbcf6('0x32')]=_[_0xbcf6('0x33')](_0x5c44a1['query']);_0x242f25['filters']=_[_0xbcf6('0x34')](_0x242f25[_0xbcf6('0x30')],_0x242f25[_0xbcf6('0x32')]);_0x72e391['attributes']=_[_0xbcf6('0x34')](_0x242f25[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x5c44a1['query'][_0xbcf6('0x35')]));_0x72e391[_0xbcf6('0x36')]=_0x72e391[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x72e391['attributes']:_0x242f25[_0xbcf6('0x30')];if(!_0x5c44a1[_0xbcf6('0x32')]['hasOwnProperty'](_0xbcf6('0x38'))){_0x72e391[_0xbcf6('0x20')]=qs[_0xbcf6('0x20')](_0x5c44a1[_0xbcf6('0x32')][_0xbcf6('0x20')]);_0x72e391[_0xbcf6('0x1d')]=qs[_0xbcf6('0x1d')](_0x5c44a1[_0xbcf6('0x32')]['offset']);}_0x72e391[_0xbcf6('0x39')]=qs[_0xbcf6('0x3a')](_0x5c44a1['query'][_0xbcf6('0x3a')]);_0x72e391['where']=qs[_0xbcf6('0x3b')](_['pick'](_0x5c44a1[_0xbcf6('0x32')],_0x242f25[_0xbcf6('0x3b')]),_0x2206d3);if(_0x5c44a1[_0xbcf6('0x32')][_0xbcf6('0x3c')]){_0x72e391[_0xbcf6('0x3d')]=_['merge'](_0x72e391[_0xbcf6('0x3d')],{'$or':_[_0xbcf6('0x31')](_0x2206d3,function(_0x4c58f5){if(_0x4c58f5[_0xbcf6('0x2e')]!==_0xbcf6('0x3e')){var _0x2055c4={};_0x2055c4[_0x4c58f5['name']]={'$like':'%'+_0x5c44a1[_0xbcf6('0x32')][_0xbcf6('0x3c')]+'%'};return _0x2055c4;}})});}_0x72e391=_[_0xbcf6('0x3f')]({},_0x72e391,_0x5c44a1[_0xbcf6('0x40')]);var _0xeaa133={'where':_0x72e391[_0xbcf6('0x3d')]};return db[_0xbcf6('0x2c')][_0xbcf6('0x1f')](_0xeaa133)[_0xbcf6('0x25')](function(_0x472148){_0x44a292[_0xbcf6('0x1f')]=_0x472148;if(_0x5c44a1['query'][_0xbcf6('0x41')]){_0x72e391[_0xbcf6('0x42')]=[{'all':!![]}];}return db[_0xbcf6('0x2c')][_0xbcf6('0x43')](_0x72e391);})[_0xbcf6('0x25')](function(_0x5eb4c9){_0x44a292[_0xbcf6('0x44')]=_0x5eb4c9;return _0x44a292;})[_0xbcf6('0x25')](respondWithFilteredResult(_0x4c859d,_0x72e391))[_0xbcf6('0x45')](handleError(_0x4c859d,null));};exports[_0xbcf6('0x46')]=function(_0x501c63,_0x25a2a1){var _0x2f4f44={'raw':![],'where':{'id':_0x501c63[_0xbcf6('0x47')]['id']}},_0x5e61af={};_0x5e61af[_0xbcf6('0x30')]=_[_0xbcf6('0x33')](db[_0xbcf6('0x2c')]['rawAttributes']);_0x5e61af[_0xbcf6('0x32')]=_['keys'](_0x501c63[_0xbcf6('0x32')]);_0x5e61af['filters']=_['intersection'](_0x5e61af[_0xbcf6('0x30')],_0x5e61af['query']);_0x2f4f44[_0xbcf6('0x36')]=_[_0xbcf6('0x34')](_0x5e61af[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x501c63['query']['fields']));_0x2f4f44['attributes']=_0x2f4f44[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x2f4f44[_0xbcf6('0x36')]:_0x5e61af[_0xbcf6('0x30')];if(_0x501c63[_0xbcf6('0x32')]['includeAll']){_0x2f4f44[_0xbcf6('0x42')]=[{'all':!![]}];}_0x2f4f44=_[_0xbcf6('0x3f')]({},_0x2f4f44,_0x501c63[_0xbcf6('0x40')]);return db[_0xbcf6('0x2c')]['find'](_0x2f4f44)['then'](handleEntityNotFound(_0x25a2a1,null))[_0xbcf6('0x25')](respondWithResult(_0x25a2a1,null))[_0xbcf6('0x45')](handleError(_0x25a2a1,null));};exports[_0xbcf6('0x48')]=function(_0x3782ef,_0x4732ee){return db['CmList']['create'](_0x3782ef[_0xbcf6('0x49')],{})[_0xbcf6('0x25')](function(_0x135bfe){var _0x401e7f=_0x3782ef[_0xbcf6('0x4a')][_0xbcf6('0x26')]({'plain':!![]});if(!_0x401e7f)throw new Error(_0xbcf6('0x4b'));if(_0x401e7f[_0xbcf6('0x4c')]===_0xbcf6('0x4a')){var _0x3b9ee7=_0x135bfe['get']({'plain':!![]});var _0x4950f5='Lists';return db[_0xbcf6('0x4d')]['find']({'where':{'name':_0x4950f5,'userProfileId':_0x401e7f[_0xbcf6('0x4e')]},'raw':!![]})[_0xbcf6('0x25')](function(_0x457c83){if(_0x457c83&&_0x457c83['autoAssociation']===0x0){return db['UserProfileResource'][_0xbcf6('0x48')]({'name':_0x3b9ee7['name'],'resourceId':_0x3b9ee7['id'],'type':_0x457c83[_0xbcf6('0x2b')],'sectionId':_0x457c83['id']},{})['then'](function(){return _0x135bfe;});}else{return _0x135bfe;}})['catch'](function(_0x1c48f6){logger[_0xbcf6('0x4f')](_0xbcf6('0x50'),_0x1c48f6);throw _0x1c48f6;});}return _0x135bfe;})[_0xbcf6('0x25')](respondWithResult(_0x4732ee,0xc9))[_0xbcf6('0x45')](handleError(_0x4732ee,null));};exports[_0xbcf6('0x24')]=function(_0x739b82,_0x1724e4){if(_0x739b82[_0xbcf6('0x49')]['id']){delete _0x739b82[_0xbcf6('0x49')]['id'];}return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x739b82[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x1724e4,null))['then'](saveUpdates(_0x739b82[_0xbcf6('0x49')],null))[_0xbcf6('0x25')](respondWithResult(_0x1724e4,null))['catch'](handleError(_0x1724e4,null));};exports[_0xbcf6('0x29')]=function(_0x5b5be0,_0x5dc5dc){return db['CmList'][_0xbcf6('0x51')]({'where':{'id':_0x5b5be0[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x5dc5dc,null))[_0xbcf6('0x25')](removeEntity(_0x5dc5dc,null))[_0xbcf6('0x45')](handleError(_0x5dc5dc,null));};exports[_0xbcf6('0x52')]=function(_0x5b67fd,_0x180edb){return db['CmList'][_0xbcf6('0x52')]()[_0xbcf6('0x25')](respondWithResult(_0x180edb,null))[_0xbcf6('0x45')](handleError(_0x180edb,null));};exports['addDisposition']=function(_0x35f862,_0x1f423e,_0x21da89){if(_0x35f862[_0xbcf6('0x49')]['id']){delete _0x35f862['body']['id'];}return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x35f862[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x1f423e,null))[_0xbcf6('0x25')](function(_0x234809){if(_0x234809){_0x35f862[_0xbcf6('0x49')][_0xbcf6('0x53')]=_0x234809['id'];return db[_0xbcf6('0x54')][_0xbcf6('0x48')](_0x35f862[_0xbcf6('0x49')]);}})[_0xbcf6('0x25')](respondWithResult(_0x1f423e,null))[_0xbcf6('0x45')](handleError(_0x1f423e,null));};exports[_0xbcf6('0x55')]=function(_0x5d42b0,_0x4edb30,_0x3d433a){var _0x55175b={'raw':![],'where':{}};var _0x441a42={};var _0x1ea029={'count':0x0,'rows':[]};return db['CmList'][_0xbcf6('0x56')]({'where':{'id':_0x5d42b0[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x4edb30,null))[_0xbcf6('0x25')](function(_0x1670e6){if(_0x1670e6){_0x441a42[_0xbcf6('0x30')]=_[_0xbcf6('0x33')](db['Disposition'][_0xbcf6('0x57')]);_0x441a42['query']=_[_0xbcf6('0x33')](_0x5d42b0[_0xbcf6('0x32')]);_0x441a42[_0xbcf6('0x3b')]=_[_0xbcf6('0x34')](_0x441a42['model'],_0x441a42[_0xbcf6('0x32')]);_0x55175b['attributes']=_[_0xbcf6('0x34')](_0x441a42[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x5d42b0[_0xbcf6('0x32')][_0xbcf6('0x35')]));_0x55175b[_0xbcf6('0x36')]=_0x55175b[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x55175b[_0xbcf6('0x36')]:_0x441a42[_0xbcf6('0x30')];if(!_0x5d42b0[_0xbcf6('0x32')]['hasOwnProperty'](_0xbcf6('0x38'))){_0x55175b[_0xbcf6('0x20')]=qs['limit'](_0x5d42b0['query'][_0xbcf6('0x20')]);_0x55175b[_0xbcf6('0x1d')]=qs[_0xbcf6('0x1d')](_0x5d42b0[_0xbcf6('0x32')][_0xbcf6('0x1d')]);}_0x55175b[_0xbcf6('0x39')]=qs[_0xbcf6('0x3a')](_0x5d42b0['query'][_0xbcf6('0x3a')]);_0x55175b[_0xbcf6('0x3d')]=qs[_0xbcf6('0x3b')](_[_0xbcf6('0x58')](_0x5d42b0[_0xbcf6('0x32')],_0x441a42[_0xbcf6('0x3b')]));_0x55175b[_0xbcf6('0x3d')]['ListId']=_0x1670e6['id'];if(_0x5d42b0[_0xbcf6('0x32')][_0xbcf6('0x3c')]){_0x55175b[_0xbcf6('0x3d')]=_[_0xbcf6('0x3f')](_0x55175b['where'],{'$or':_[_0xbcf6('0x31')](_0x55175b[_0xbcf6('0x36')],function(_0x52695c){var _0x3d7a8d={};_0x3d7a8d[_0x52695c]={'$like':'%'+_0x5d42b0[_0xbcf6('0x32')]['filter']+'%'};return _0x3d7a8d;})});}_0x55175b=_[_0xbcf6('0x3f')]({},_0x55175b,_0x5d42b0[_0xbcf6('0x40')]);return db['Disposition'][_0xbcf6('0x1f')]({'where':_0x55175b['where']})[_0xbcf6('0x25')](function(_0x4406c6){_0x1ea029[_0xbcf6('0x1f')]=_0x4406c6;if(_0x5d42b0['query']['includeAll']){_0x55175b[_0xbcf6('0x42')]=[{'all':!![]}];}return db[_0xbcf6('0x54')]['findAll'](_0x55175b);})[_0xbcf6('0x25')](function(_0xfedc7c){_0x1ea029['rows']=_0xfedc7c;return _0x1ea029;});}})[_0xbcf6('0x25')](respondWithFilteredResult(_0x4edb30,_0x55175b))['catch'](handleError(_0x4edb30,null));};exports[_0xbcf6('0x59')]=function(_0x4664a8,_0x2f1f6a,_0x3e9817){return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x4664a8[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x2f1f6a,null))[_0xbcf6('0x25')](function(_0x1b89d2){if(_0x1b89d2){return _0x1b89d2[_0xbcf6('0x59')](_0x4664a8[_0xbcf6('0x32')][_0xbcf6('0x5a')]);}})[_0xbcf6('0x25')](respondWithStatusCode(_0x2f1f6a,null))[_0xbcf6('0x45')](handleError(_0x2f1f6a,null));};exports[_0xbcf6('0x5b')]=function(_0x5cc8f1,_0x2b49ea,_0x26abcc){return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x5cc8f1[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x2b49ea,null))[_0xbcf6('0x25')](function(_0x20af64){if(_0x20af64){var _0x129136=[];var _0x1b0871={'success':[],'errors':[]};return db[_0xbcf6('0x5c')][_0xbcf6('0x52')]()[_0xbcf6('0x25')](function(_0xa66bac){if(_0x5cc8f1['body'][_0xbcf6('0x5d')]&&_[_0xbcf6('0x5e')](_0x5cc8f1[_0xbcf6('0x49')][_0xbcf6('0x5d')])){if(_0x5cc8f1['body']['tags'][_0xbcf6('0x37')]){_0x5cc8f1[_0xbcf6('0x49')][_0xbcf6('0x5d')]=_0x5cc8f1['body'][_0xbcf6('0x5d')][_0xbcf6('0x5f')](';')+';';}else{_0x5cc8f1[_0xbcf6('0x49')]['tags']=null;}}else{_0x5cc8f1[_0xbcf6('0x49')][_0xbcf6('0x5d')]=null;}if(_0x5cc8f1[_0xbcf6('0x49')]&&_[_0xbcf6('0x5e')](_0x5cc8f1[_0xbcf6('0x49')])){for(var _0x1f9fa5=0x0;_0x1f9fa5<_0x5cc8f1[_0xbcf6('0x49')][_0xbcf6('0x37')];_0x1f9fa5+=0x1){_0x5cc8f1['body'][_0x1f9fa5]['ListId']=_0x5cc8f1[_0xbcf6('0x47')]['id'];_0x129136[_0xbcf6('0x60')](_0x5cc8f1[_0xbcf6('0x49')][_0x1f9fa5]);}return BPromise[_0xbcf6('0x61')](_0x129136,function(_0x2c9b1d){return db[_0xbcf6('0x5c')]['create'](_[_0xbcf6('0x62')](_0x2c9b1d,[_0xbcf6('0x5a'),'id'])||{},{'fields':_[_0xbcf6('0x33')](_0xa66bac),'raw':!![]})[_0xbcf6('0x25')](function(_0x3f989a){_0x1b0871['success'][_0xbcf6('0x60')](_0x3f989a[_0xbcf6('0x63')]);})['catch'](function(_0x2d354e){_0x1b0871[_0xbcf6('0x64')][_0xbcf6('0x60')]({'data':_0x2c9b1d,'error':_0x2d354e['message']});});})['then'](function(_0x5e4d24){return _0x1b0871;})[_0xbcf6('0x45')](function(_0x1c7f57){return _0x1c7f57;});}else{_0x2b49ea[_0xbcf6('0x1b')](0x190)['json']({'message':_0xbcf6('0x65')});}});}})[_0xbcf6('0x25')](respondWithResult(_0x2b49ea,null))[_0xbcf6('0x45')](handleError(_0x2b49ea,null));};exports[_0xbcf6('0x66')]=function(_0x5f2ed0,_0x25e1ed,_0x27d3a9){var _0x11ce27;return db['CmList'][_0xbcf6('0x51')]({'where':{'id':_0x5f2ed0[_0xbcf6('0x47')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xbcf6('0x67')}]})[_0xbcf6('0x25')](handleEntityNotFound(_0x25e1ed,null))[_0xbcf6('0x25')](function(_0x17b22a){if(_0x17b22a){_0x11ce27=_0x17b22a;return db[_0xbcf6('0x5c')][_0xbcf6('0x57')];}})['then'](function(_0x442ccb){if(_0x442ccb){var _0x55e325={};var _0x1911b5={};_0x1911b5[_0xbcf6('0x30')]=_[_0xbcf6('0x68')](_[_0xbcf6('0x33')](_0x442ccb),_[_0xbcf6('0x31')](_0x11ce27[_0xbcf6('0x67')],function(_0x3c71d0){return util['format'](_0xbcf6('0x69'),_0x3c71d0['id']);}));_0x1911b5['query']=_[_0xbcf6('0x33')](_0x5f2ed0[_0xbcf6('0x32')]);_0x1911b5[_0xbcf6('0x3b')]=_['intersection'](_0x1911b5['model'],_0x1911b5[_0xbcf6('0x32')]);_0x55e325[_0xbcf6('0x36')]=_['intersection'](_0x1911b5[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x35')]));_0x55e325[_0xbcf6('0x36')]=_0x55e325[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x55e325[_0xbcf6('0x36')]:_0x1911b5[_0xbcf6('0x30')];if(!_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x6a')](_0xbcf6('0x38'))){_0x55e325[_0xbcf6('0x20')]=qs[_0xbcf6('0x20')](_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x20')]);_0x55e325[_0xbcf6('0x1d')]=qs[_0xbcf6('0x1d')](_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x1d')]);}_0x55e325[_0xbcf6('0x39')]=qs[_0xbcf6('0x3a')](_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x3a')]);_0x55e325[_0xbcf6('0x3d')]=qs['filters'](_[_0xbcf6('0x58')](_0x5f2ed0[_0xbcf6('0x32')],_0x1911b5[_0xbcf6('0x3b')]));_0x55e325[_0xbcf6('0x6b')]=!![];if(_0x5f2ed0[_0xbcf6('0x32')]['filter']){_0x55e325[_0xbcf6('0x3d')]=_['merge'](_0x55e325[_0xbcf6('0x3d')],{'$or':_['map'](_0x55e325[_0xbcf6('0x36')],function(_0x48c185){var _0x682b11={};_0x682b11[_0x48c185]={'$like':'%'+_0x5f2ed0['query'][_0xbcf6('0x3c')]+'%'};return _0x682b11;})});}_0x55e325=_[_0xbcf6('0x3f')]({},_0x55e325,_0x5f2ed0[_0xbcf6('0x40')]);return _0x11ce27['getContacts'](_0x55e325);}})['then'](respondWithResult(_0x25e1ed,null))[_0xbcf6('0x45')](handleError(_0x25e1ed,null));};exports['getContactsCsv']=function(_0x3af64f,_0x5bead3,_0x1a7261){var _0x104ca0;var _0x4dda76;var _0x1edc1d;var _0x44039a=_0x3af64f['params']['id'];csv_results=[];return db[_0xbcf6('0x6c')][_0xbcf6('0x43')]({'attributes':['id',_0xbcf6('0x2b')],'raw':!![],'order':[_0xbcf6('0x6d')]})[_0xbcf6('0x25')](function(_0x368c61){_0x104ca0=_0x368c61;var _0x199cd7=_[_0xbcf6('0x33')](db[_0xbcf6('0x5c')]['rawAttributes']);return db[_0xbcf6('0x6e')][_0xbcf6('0x43')]({'raw':!![],'attributes':['id',_0xbcf6('0x6f')]})[_0xbcf6('0x25')](function(_0x41e03d){_0x4dda76=_0x41e03d;var _0x24c31b=squel['select']()[_0xbcf6('0x35')](_0x199cd7)[_0xbcf6('0x70')]('cm_contacts','c')[_0xbcf6('0x3d')](_0xbcf6('0x71'),_0x44039a)['where'](_0xbcf6('0x72'))['distinct']();for(var _0x1ca7c7=0x0;_0x1ca7c7<_0x4dda76[_0xbcf6('0x37')];_0x1ca7c7++){_0x24c31b[_0xbcf6('0x73')](_0xbcf6('0x74')+_0x4dda76[_0x1ca7c7]['id'],_0xbcf6('0x75')+_0x4dda76[_0x1ca7c7][_0xbcf6('0x6f')]);}for(var _0x1ca7c7=0x0;_0x1ca7c7<_0x104ca0[_0xbcf6('0x37')];_0x1ca7c7++){_0x24c31b[_0xbcf6('0x73')](squel['select']()['field']('item')[_0xbcf6('0x70')](_0xbcf6('0x76'))[_0xbcf6('0x3d')](_0xbcf6('0x77'),_0x104ca0[_0x1ca7c7]['id'])[_0xbcf6('0x3d')](_0xbcf6('0x78')),_0xbcf6('0x79')+_0x104ca0[_0x1ca7c7][_0xbcf6('0x2b')]);_0x24c31b[_0xbcf6('0x73')](squel[_0xbcf6('0x7a')]()[_0xbcf6('0x73')]('description')['from'](_0xbcf6('0x76'))[_0xbcf6('0x3d')]('ItemTypeId\x20=\x20?',_0x104ca0[_0x1ca7c7]['id'])[_0xbcf6('0x3d')](_0xbcf6('0x78')),_0xbcf6('0x7b')+_0x104ca0[_0x1ca7c7]['name']);}var _0x45ec84=[];_0x45ec84['push'](_0x24c31b['toString']());BPromise['each'](_0x45ec84,handleQuery)[_0xbcf6('0x25')](function(_0x384e4c){handleQuery(_0x24c31b[_0xbcf6('0x7c')]());var _0x5664c4=csv_results[0x0];if(!_['isEmpty'](_0x5664c4)){var _0x279320=toCsv(_0x5664c4);var _0x19be5f=Date[_0xbcf6('0x7d')]();fs[_0xbcf6('0x7e')](util['format'](_0xbcf6('0x7f'),_0x44039a,_0x19be5f),_0x279320);_0x5bead3[_0xbcf6('0x80')](_0xbcf6('0x81'),_0xbcf6('0x82')+util[_0xbcf6('0x83')](_0xbcf6('0x84'),_0x44039a,_0x19be5f));_0x5bead3[_0xbcf6('0x80')](_0xbcf6('0x85'),_0xbcf6('0x86'));return _0x5bead3[_0xbcf6('0x87')](util[_0xbcf6('0x83')](_0xbcf6('0x7f'),_0x44039a,_0x19be5f));}else{return _0x5bead3[_0xbcf6('0x88')](0xcc);}});});});};exports[_0xbcf6('0x89')]=function(_0x537b55,_0x1e9810,_0xb3c1d7){var _0x32ff0a;delete _0x537b55[_0xbcf6('0x49')]['id'];return db[_0xbcf6('0x2c')][_0xbcf6('0x56')]({'where':{'id':_0x537b55[_0xbcf6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e9810,null))['then'](function(_0x1d3de2){if(_0x1d3de2){return db[_0xbcf6('0x8a')][_0xbcf6('0x8b')](function(_0x3874b6){return db[_0xbcf6('0x6e')][_0xbcf6('0x48')](_0x537b55[_0xbcf6('0x49')],{'transaction':_0x3874b6})[_0xbcf6('0x25')](function(_0x518f61){_0x32ff0a=_0x518f61;return _0x1d3de2[_0xbcf6('0x8c')](_0x518f61,{'transaction':_0x3874b6});})[_0xbcf6('0x25')](function(){var _0x4b4f52={'type':db['Sequelize'][_0xbcf6('0x8d')],'transaction':_0x3874b6};switch(_0x537b55[_0xbcf6('0x49')][_0xbcf6('0x2e')]){case _0xbcf6('0x8e'):_0x4b4f52['type']=db['Sequelize']['TEXT'];break;case _0xbcf6('0x8f'):_0x4b4f52[_0xbcf6('0x2e')]=db[_0xbcf6('0x90')]['INTEGER'];break;case _0xbcf6('0x91'):_0x4b4f52['type']=db[_0xbcf6('0x90')][_0xbcf6('0x92')];_0x4b4f52[_0xbcf6('0x93')]=![];break;default:}return db[_0xbcf6('0x8a')][_0xbcf6('0x94')]['addColumn'](_0xbcf6('0x95'),util[_0xbcf6('0x83')](_0xbcf6('0x96'),_0x32ff0a['id']),_0x4b4f52);})[_0xbcf6('0x25')](function(){return _0x32ff0a;});});}})[_0xbcf6('0x25')](respondWithResult(_0x1e9810,null))['catch'](handleError(_0x1e9810,null));};exports[_0xbcf6('0x97')]=function(_0x24f510,_0x40e3d2,_0x5868ee){var _0x5894bc={};var _0x16a806={};var _0x13bef7;var _0x3f3f94;return db[_0xbcf6('0x2c')][_0xbcf6('0x56')]({'where':{'id':_0x24f510['params']['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x40e3d2,null))['then'](function(_0xe069d9){if(_0xe069d9){_0x13bef7=_0xe069d9;_0x16a806[_0xbcf6('0x30')]=_[_0xbcf6('0x33')](db[_0xbcf6('0x6e')][_0xbcf6('0x57')]);_0x16a806[_0xbcf6('0x32')]=_[_0xbcf6('0x33')](_0x24f510[_0xbcf6('0x32')]);_0x16a806[_0xbcf6('0x3b')]=_[_0xbcf6('0x34')](_0x16a806['model'],_0x16a806[_0xbcf6('0x32')]);_0x5894bc[_0xbcf6('0x36')]=_[_0xbcf6('0x34')](_0x16a806[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x24f510[_0xbcf6('0x32')]['fields']));_0x5894bc[_0xbcf6('0x36')]=_0x5894bc[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x5894bc[_0xbcf6('0x36')]:_0x16a806[_0xbcf6('0x30')];_0x5894bc[_0xbcf6('0x39')]=qs['sort'](_0x24f510[_0xbcf6('0x32')][_0xbcf6('0x3a')]);_0x5894bc[_0xbcf6('0x3d')]=qs[_0xbcf6('0x3b')](_['pick'](_0x24f510[_0xbcf6('0x32')],_0x16a806[_0xbcf6('0x3b')]));_0x5894bc[_0xbcf6('0x3d')]=_[_0xbcf6('0x3f')](_0x5894bc[_0xbcf6('0x3d')],{'$or':[{'ListId':_0xe069d9['id']},{'ListId':null}]});if(_0x24f510[_0xbcf6('0x32')][_0xbcf6('0x3c')]){_0x5894bc[_0xbcf6('0x3d')]=_['merge'](_0x5894bc[_0xbcf6('0x3d')],{'$or':_[_0xbcf6('0x31')](_0x5894bc[_0xbcf6('0x36')],function(_0x57974f){var _0x518ce1={};_0x518ce1[_0x57974f]={'$like':'%'+_0x24f510[_0xbcf6('0x32')][_0xbcf6('0x3c')]+'%'};return _0x518ce1;})});}_0x5894bc=_[_0xbcf6('0x3f')]({},_0x5894bc,_0x24f510[_0xbcf6('0x40')]);return db['CmCustomField']['findAndCountAll'](_0x5894bc);}})[_0xbcf6('0x25')](respondWithResult(_0x40e3d2,null))['catch'](handleError(_0x40e3d2,null));};exports[_0xbcf6('0x98')]=function(_0x5ddedc,_0x5e1490){return db[_0xbcf6('0x6e')][_0xbcf6('0x99')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x5e1490,null))[_0xbcf6('0x25')](function(_0x43a787){return _0x43a787;})[_0xbcf6('0x25')](respondWithResult(_0x5e1490,null))[_0xbcf6('0x45')](handleError(_0x5e1490,null));};exports[_0xbcf6('0x9a')]=function(_0x22931e,_0x34760d,_0x19ee15){return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x22931e[_0xbcf6('0x47')]['id']}})['then'](handleEntityNotFound(_0x34760d,null))[_0xbcf6('0x25')](function(_0x4b95fc){if(_0x4b95fc){return _0x4b95fc[_0xbcf6('0x9a')](_0x22931e['body'][_0xbcf6('0x5a')],_[_0xbcf6('0x62')](_0x22931e[_0xbcf6('0x49')],[_0xbcf6('0x5a'),'id'])||{})['spread'](function(_0x11995a){for(var _0x5de09b=0x0;_0x5de09b<_0x22931e[_0xbcf6('0x49')][_0xbcf6('0x5a')][_0xbcf6('0x37')];_0x5de09b+=0x1){socket[_0xbcf6('0x9b')](_0xbcf6('0x9c'),{'UserId':Number(_0x22931e[_0xbcf6('0x49')]['ids'][_0x5de09b]),'CmListId':Number(_0x22931e[_0xbcf6('0x47')]['id'])});}return _0x11995a;});}})[_0xbcf6('0x25')](respondWithResult(_0x34760d,null))['catch'](handleError(_0x34760d,null));};exports[_0xbcf6('0x9d')]=function(_0x2a6eb5,_0x211934,_0x314a34){return db[_0xbcf6('0x2c')]['find']({'where':{'id':_0x2a6eb5['params']['id']}})['then'](handleEntityNotFound(_0x211934,null))[_0xbcf6('0x25')](function(_0x336bca){if(_0x336bca){return _0x336bca['removeAgents'](_0x2a6eb5[_0xbcf6('0x32')]['ids'])['then'](function(){if(_['isArray'](_0x2a6eb5[_0xbcf6('0x32')]['ids'])){for(var _0x2a8d1a=0x0;_0x2a8d1a<_0x2a6eb5[_0xbcf6('0x32')][_0xbcf6('0x5a')][_0xbcf6('0x37')];_0x2a8d1a+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2a6eb5['query']['ids'][_0x2a8d1a]),'CmListId':Number(_0x2a6eb5[_0xbcf6('0x47')]['id'])});}}else{socket['emit'](_0xbcf6('0x9e'),{'UserId':Number(_0x2a6eb5[_0xbcf6('0x32')][_0xbcf6('0x5a')]),'CmListId':Number(_0x2a6eb5[_0xbcf6('0x47')]['id'])});}});}})[_0xbcf6('0x25')](respondWithStatusCode(_0x211934,null))[_0xbcf6('0x45')](handleError(_0x211934,null));};exports[_0xbcf6('0x9f')]=function(_0x28c00b,_0x1629d7,_0x4c9775){var _0x3b4dde={};var _0x41fd2d={};var _0x126973;var _0xc03834;return db[_0xbcf6('0x2c')][_0xbcf6('0x56')]({'where':{'id':_0x28c00b[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x1629d7,null))[_0xbcf6('0x25')](function(_0x4f0fda){if(_0x4f0fda){_0x126973=_0x4f0fda;_0x41fd2d[_0xbcf6('0x30')]=_[_0xbcf6('0x33')](db[_0xbcf6('0xa0')][_0xbcf6('0x57')]);_0x41fd2d[_0xbcf6('0x32')]=_[_0xbcf6('0x33')](_0x28c00b[_0xbcf6('0x32')]);_0x41fd2d['filters']=_[_0xbcf6('0x34')](_0x41fd2d['model'],_0x41fd2d['query']);_0x3b4dde['attributes']=_[_0xbcf6('0x34')](_0x41fd2d['model'],qs[_0xbcf6('0x35')](_0x28c00b['query'][_0xbcf6('0x35')]));_0x3b4dde[_0xbcf6('0x36')]=_0x3b4dde['attributes']['length']?_0x3b4dde[_0xbcf6('0x36')]:_0x41fd2d['model'];_0x3b4dde[_0xbcf6('0x39')]=qs[_0xbcf6('0x3a')](_0x28c00b['query']['sort']);_0x3b4dde['where']=qs[_0xbcf6('0x3b')](_['pick'](_0x28c00b[_0xbcf6('0x32')],_0x41fd2d[_0xbcf6('0x3b')]));if(_0x28c00b[_0xbcf6('0x32')][_0xbcf6('0x3c')]){_0x3b4dde[_0xbcf6('0x3d')]=_[_0xbcf6('0x3f')](_0x3b4dde[_0xbcf6('0x3d')],{'$or':_['map'](_0x3b4dde[_0xbcf6('0x36')],function(_0x35fa00){var _0x44d77e={};_0x44d77e[_0x35fa00]={'$like':'%'+_0x28c00b[_0xbcf6('0x32')][_0xbcf6('0x3c')]+'%'};return _0x44d77e;})});}_0x3b4dde=_[_0xbcf6('0x3f')]({},_0x3b4dde,_0x28c00b[_0xbcf6('0x40')]);return _0x126973[_0xbcf6('0x9f')](_0x3b4dde);}})['then'](function(_0xc2a5e4){if(_0xc2a5e4){_0xc03834=_0xc2a5e4[_0xbcf6('0x37')];if(!_0x28c00b['query']['hasOwnProperty']('nolimit')){_0x3b4dde['limit']=qs[_0xbcf6('0x20')](_0x28c00b['query']['limit']);_0x3b4dde['offset']=qs['offset'](_0x28c00b[_0xbcf6('0x32')]['offset']);}return _0x126973[_0xbcf6('0x9f')](_0x3b4dde);}})[_0xbcf6('0x25')](function(_0x110bfb){if(_0x110bfb){return _0x110bfb?{'count':_0xc03834,'rows':_0x110bfb}:null;}})[_0xbcf6('0x25')](respondWithResult(_0x1629d7,null))['catch'](handleError(_0x1629d7,null));};function handleQuery(_0x436090){logger['info'](_0x436090);return db['sequelize']['query'](_0x436090)[_0xbcf6('0xa1')](function(_0x15f2aa){csv_results['push'](_0x15f2aa);})[_0xbcf6('0x45')](function(_0x42d753){logger[_0xbcf6('0x4f')](_0x42d753['message']);});} \ No newline at end of file +var _0x1502=['findOne','Disposition','order','ListId','ids','CmContact','tags','isArray','join','push','each','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','customField_','field','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','/tmp/list_%d_%s.csv','addCustomField','transaction','Sequelize','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','sequelize','eml-format','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','count','limit','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','name','send','index','map','CmList','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','create','body','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1502,0xeb));var _0x2150=function(_0x338fc9,_0x238003){_0x338fc9=_0x338fc9-0x0;var _0x149c91=_0x1502[_0x338fc9];return _0x149c91;};'use strict';var emlformat=require(_0x2150('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2150('0x1'));var rp=require(_0x2150('0x2'));var moment=require(_0x2150('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2150('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2150('0x5'));var csv=require(_0x2150('0x6'));var ejs=require(_0x2150('0x7'));var fs=require('fs');var fs_extra=require(_0x2150('0x8'));var _=require(_0x2150('0x9'));var squel=require(_0x2150('0xa'));var crypto=require(_0x2150('0xb'));var jsforce=require(_0x2150('0xc'));var deskjs=require(_0x2150('0xd'));var toCsv=require(_0x2150('0x6'));var querystring=require(_0x2150('0xe'));var Papa=require(_0x2150('0xf'));var Redis=require('ioredis');var authService=require(_0x2150('0x10'));var qs=require(_0x2150('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2150('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2150('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2150('0x14'))['db'];var csv_results;config[_0x2150('0x15')]=_[_0x2150('0x16')](config['redis'],{'host':_0x2150('0x17'),'port':0x18eb});var socket=require(_0x2150('0x18'))(new Redis(config[_0x2150('0x15')]));require(_0x2150('0x19'))[_0x2150('0x1a')](socket);function respondWithStatusCode(_0x50bba1,_0x5c2017){_0x5c2017=_0x5c2017||0xcc;return function(_0xfb732e){if(_0xfb732e){return _0x50bba1[_0x2150('0x1b')](_0x5c2017);}return _0x50bba1[_0x2150('0x1c')](_0x5c2017)[_0x2150('0x1d')]();};}function respondWithResult(_0x586d30,_0x4a7d3e){_0x4a7d3e=_0x4a7d3e||0xc8;return function(_0x19bae1){if(_0x19bae1){return _0x586d30[_0x2150('0x1c')](_0x4a7d3e)['json'](_0x19bae1);}};}function respondWithFilteredResult(_0x58cd5d,_0x358fd2){return function(_0xcfce4a){if(_0xcfce4a){var _0x2d3f4f=typeof _0x358fd2[_0x2150('0x1e')]===_0x2150('0x1f')&&typeof _0x358fd2['limit']==='undefined';var _0x3d5395=_0xcfce4a[_0x2150('0x20')];var _0x474012=_0x2d3f4f?0x0:_0x358fd2[_0x2150('0x1e')];var _0x7e5997=_0x2d3f4f?_0xcfce4a[_0x2150('0x20')]:_0x358fd2[_0x2150('0x1e')]+_0x358fd2[_0x2150('0x21')];var _0x409742;if(_0x7e5997>=_0x3d5395){_0x7e5997=_0x3d5395;_0x409742=0xc8;}else{_0x409742=0xce;}_0x58cd5d[_0x2150('0x1c')](_0x409742);return _0x58cd5d['set']('Content-Range',_0x474012+'-'+_0x7e5997+'/'+_0x3d5395)['json'](_0xcfce4a);}return null;};}function patchUpdates(_0x3a27d9){return function(_0x5de540){try{jsonpatch[_0x2150('0x22')](_0x5de540,_0x3a27d9,!![]);}catch(_0x40ff41){return BPromise[_0x2150('0x23')](_0x40ff41);}return _0x5de540[_0x2150('0x24')]();};}function saveUpdates(_0x2e8326,_0x1c8a00){return function(_0x62f552){if(_0x62f552){return _0x62f552[_0x2150('0x25')](_0x2e8326)['then'](function(_0x6d0cda){return _0x6d0cda;});}return null;};}function removeEntity(_0x20dff9,_0xb318cb){return function(_0x2228df){if(_0x2228df){return _0x2228df[_0x2150('0x26')]()[_0x2150('0x27')](function(){var _0x1db71e=_0x2228df[_0x2150('0x28')]({'plain':!![]});var _0x4c9e64=_0x2150('0x29');return db[_0x2150('0x2a')][_0x2150('0x26')]({'where':{'type':_0x4c9e64,'resourceId':_0x1db71e['id']}})[_0x2150('0x27')](function(){return _0x2228df;});})[_0x2150('0x27')](function(){_0x20dff9[_0x2150('0x1c')](0xcc)[_0x2150('0x1d')]();});}};}function handleEntityNotFound(_0x1dfbbf,_0x19d07b){return function(_0x1e3116){if(!_0x1e3116){_0x1dfbbf['sendStatus'](0x194);}return _0x1e3116;};}function handleError(_0x5f3d7e,_0x52b2ea){_0x52b2ea=_0x52b2ea||0x1f4;return function(_0x10bc24){logger[_0x2150('0x2b')](_0x10bc24['stack']);if(_0x10bc24[_0x2150('0x2c')]){delete _0x10bc24['name'];}_0x5f3d7e['status'](_0x52b2ea)[_0x2150('0x2d')](_0x10bc24);};}exports[_0x2150('0x2e')]=function(_0x2a775e,_0x23a072){var _0x1dbe70={},_0x3903ac={},_0x4479a1={'count':0x0,'rows':[]};var _0x382898=_[_0x2150('0x2f')](db[_0x2150('0x30')][_0x2150('0x31')],function(_0x31f5e8){return{'name':_0x31f5e8['fieldName'],'type':_0x31f5e8[_0x2150('0x32')][_0x2150('0x33')]};});_0x3903ac['model']=_[_0x2150('0x2f')](_0x382898,_0x2150('0x2c'));_0x3903ac[_0x2150('0x34')]=_[_0x2150('0x35')](_0x2a775e[_0x2150('0x34')]);_0x3903ac['filters']=_[_0x2150('0x36')](_0x3903ac[_0x2150('0x37')],_0x3903ac['query']);_0x1dbe70['attributes']=_[_0x2150('0x36')](_0x3903ac['model'],qs[_0x2150('0x38')](_0x2a775e[_0x2150('0x34')]['fields']));_0x1dbe70[_0x2150('0x39')]=_0x1dbe70['attributes'][_0x2150('0x3a')]?_0x1dbe70[_0x2150('0x39')]:_0x3903ac[_0x2150('0x37')];if(!_0x2a775e[_0x2150('0x34')][_0x2150('0x3b')](_0x2150('0x3c'))){_0x1dbe70[_0x2150('0x21')]=qs[_0x2150('0x21')](_0x2a775e['query'][_0x2150('0x21')]);_0x1dbe70[_0x2150('0x1e')]=qs['offset'](_0x2a775e[_0x2150('0x34')][_0x2150('0x1e')]);}_0x1dbe70['order']=qs[_0x2150('0x3d')](_0x2a775e[_0x2150('0x34')]['sort']);_0x1dbe70['where']=qs[_0x2150('0x3e')](_[_0x2150('0x3f')](_0x2a775e[_0x2150('0x34')],_0x3903ac[_0x2150('0x3e')]),_0x382898);if(_0x2a775e[_0x2150('0x34')][_0x2150('0x40')]){_0x1dbe70[_0x2150('0x41')]=_[_0x2150('0x42')](_0x1dbe70['where'],{'$or':_[_0x2150('0x2f')](_0x382898,function(_0x2601f1){if(_0x2601f1['type']!=='VIRTUAL'){var _0xd2b0fb={};_0xd2b0fb[_0x2601f1[_0x2150('0x2c')]]={'$like':'%'+_0x2a775e[_0x2150('0x34')][_0x2150('0x40')]+'%'};return _0xd2b0fb;}})});}_0x1dbe70=_[_0x2150('0x42')]({},_0x1dbe70,_0x2a775e[_0x2150('0x43')]);var _0x2b33ee={'where':_0x1dbe70['where']};return db['CmList']['count'](_0x2b33ee)[_0x2150('0x27')](function(_0x420415){_0x4479a1[_0x2150('0x20')]=_0x420415;if(_0x2a775e[_0x2150('0x34')][_0x2150('0x44')]){_0x1dbe70[_0x2150('0x45')]=[{'all':!![]}];}return db[_0x2150('0x30')][_0x2150('0x46')](_0x1dbe70);})[_0x2150('0x27')](function(_0x2a5c71){_0x4479a1['rows']=_0x2a5c71;return _0x4479a1;})[_0x2150('0x27')](respondWithFilteredResult(_0x23a072,_0x1dbe70))[_0x2150('0x47')](handleError(_0x23a072,null));};exports[_0x2150('0x48')]=function(_0x17636a,_0x773b28){var _0x26ae0f={'raw':![],'where':{'id':_0x17636a['params']['id']}},_0x338744={};_0x338744[_0x2150('0x37')]=_[_0x2150('0x35')](db['CmList']['rawAttributes']);_0x338744[_0x2150('0x34')]=_['keys'](_0x17636a[_0x2150('0x34')]);_0x338744[_0x2150('0x3e')]=_[_0x2150('0x36')](_0x338744['model'],_0x338744[_0x2150('0x34')]);_0x26ae0f[_0x2150('0x39')]=_['intersection'](_0x338744[_0x2150('0x37')],qs['fields'](_0x17636a[_0x2150('0x34')][_0x2150('0x38')]));_0x26ae0f[_0x2150('0x39')]=_0x26ae0f[_0x2150('0x39')]['length']?_0x26ae0f['attributes']:_0x338744[_0x2150('0x37')];if(_0x17636a[_0x2150('0x34')][_0x2150('0x44')]){_0x26ae0f[_0x2150('0x45')]=[{'all':!![]}];}_0x26ae0f=_[_0x2150('0x42')]({},_0x26ae0f,_0x17636a[_0x2150('0x43')]);return db[_0x2150('0x30')]['find'](_0x26ae0f)[_0x2150('0x27')](handleEntityNotFound(_0x773b28,null))['then'](respondWithResult(_0x773b28,null))[_0x2150('0x47')](handleError(_0x773b28,null));};exports[_0x2150('0x49')]=function(_0x36a191,_0x19e575){return db[_0x2150('0x30')][_0x2150('0x49')](_0x36a191[_0x2150('0x4a')],{})[_0x2150('0x27')](function(_0x2d5e26){var _0x5224a9=_0x36a191['user']['get']({'plain':!![]});if(!_0x5224a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5224a9['role']===_0x2150('0x4b')){var _0xcb44e0=_0x2d5e26[_0x2150('0x28')]({'plain':!![]});var _0x43347c=_0x2150('0x29');return db[_0x2150('0x4c')][_0x2150('0x4d')]({'where':{'name':_0x43347c,'userProfileId':_0x5224a9[_0x2150('0x4e')]},'raw':!![]})[_0x2150('0x27')](function(_0x390c80){if(_0x390c80&&_0x390c80['autoAssociation']===0x0){return db[_0x2150('0x2a')][_0x2150('0x49')]({'name':_0xcb44e0['name'],'resourceId':_0xcb44e0['id'],'type':_0x390c80[_0x2150('0x2c')],'sectionId':_0x390c80['id']},{})[_0x2150('0x27')](function(){return _0x2d5e26;});}else{return _0x2d5e26;}})[_0x2150('0x47')](function(_0x287626){logger[_0x2150('0x2b')](_0x2150('0x4f'),_0x287626);throw _0x287626;});}return _0x2d5e26;})[_0x2150('0x27')](respondWithResult(_0x19e575,0xc9))[_0x2150('0x47')](handleError(_0x19e575,null));};exports[_0x2150('0x25')]=function(_0x44ea07,_0x4c87c2){if(_0x44ea07[_0x2150('0x4a')]['id']){delete _0x44ea07[_0x2150('0x4a')]['id'];}return db[_0x2150('0x30')][_0x2150('0x4d')]({'where':{'id':_0x44ea07['params']['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x4c87c2,null))['then'](saveUpdates(_0x44ea07[_0x2150('0x4a')],null))[_0x2150('0x27')](respondWithResult(_0x4c87c2,null))[_0x2150('0x47')](handleError(_0x4c87c2,null));};exports['destroy']=function(_0x3095cd,_0x1cbf23){return db['CmList'][_0x2150('0x4d')]({'where':{'id':_0x3095cd['params']['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x1cbf23,null))['then'](removeEntity(_0x1cbf23,null))[_0x2150('0x47')](handleError(_0x1cbf23,null));};exports[_0x2150('0x50')]=function(_0x146b5b,_0x44adb1){return db[_0x2150('0x30')][_0x2150('0x50')]()[_0x2150('0x27')](respondWithResult(_0x44adb1,null))['catch'](handleError(_0x44adb1,null));};exports[_0x2150('0x51')]=function(_0x42a221,_0x41d6d6,_0x49591f){if(_0x42a221['body']['id']){delete _0x42a221['body']['id'];}return db['CmList'][_0x2150('0x4d')]({'where':{'id':_0x42a221[_0x2150('0x52')]['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x41d6d6,null))[_0x2150('0x27')](function(_0x4e24f3){if(_0x4e24f3){_0x42a221[_0x2150('0x4a')]['ListId']=_0x4e24f3['id'];return db['Disposition'][_0x2150('0x49')](_0x42a221[_0x2150('0x4a')]);}})[_0x2150('0x27')](respondWithResult(_0x41d6d6,null))[_0x2150('0x47')](handleError(_0x41d6d6,null));};exports['getDispositions']=function(_0x699e17,_0x173709,_0xb34547){var _0x1caa88={'raw':![],'where':{}};var _0x5abdb1={};var _0x3707fe={'count':0x0,'rows':[]};return db[_0x2150('0x30')][_0x2150('0x53')]({'where':{'id':_0x699e17[_0x2150('0x52')]['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x173709,null))[_0x2150('0x27')](function(_0x54ab91){if(_0x54ab91){_0x5abdb1[_0x2150('0x37')]=_[_0x2150('0x35')](db[_0x2150('0x54')][_0x2150('0x31')]);_0x5abdb1['query']=_[_0x2150('0x35')](_0x699e17[_0x2150('0x34')]);_0x5abdb1['filters']=_[_0x2150('0x36')](_0x5abdb1['model'],_0x5abdb1['query']);_0x1caa88[_0x2150('0x39')]=_[_0x2150('0x36')](_0x5abdb1[_0x2150('0x37')],qs[_0x2150('0x38')](_0x699e17[_0x2150('0x34')][_0x2150('0x38')]));_0x1caa88[_0x2150('0x39')]=_0x1caa88[_0x2150('0x39')][_0x2150('0x3a')]?_0x1caa88[_0x2150('0x39')]:_0x5abdb1[_0x2150('0x37')];if(!_0x699e17['query'][_0x2150('0x3b')](_0x2150('0x3c'))){_0x1caa88['limit']=qs['limit'](_0x699e17['query'][_0x2150('0x21')]);_0x1caa88[_0x2150('0x1e')]=qs[_0x2150('0x1e')](_0x699e17[_0x2150('0x34')]['offset']);}_0x1caa88[_0x2150('0x55')]=qs[_0x2150('0x3d')](_0x699e17['query']['sort']);_0x1caa88[_0x2150('0x41')]=qs[_0x2150('0x3e')](_[_0x2150('0x3f')](_0x699e17['query'],_0x5abdb1['filters']));_0x1caa88['where'][_0x2150('0x56')]=_0x54ab91['id'];if(_0x699e17[_0x2150('0x34')]['filter']){_0x1caa88[_0x2150('0x41')]=_[_0x2150('0x42')](_0x1caa88['where'],{'$or':_[_0x2150('0x2f')](_0x1caa88[_0x2150('0x39')],function(_0x478105){var _0x4596d4={};_0x4596d4[_0x478105]={'$like':'%'+_0x699e17[_0x2150('0x34')]['filter']+'%'};return _0x4596d4;})});}_0x1caa88=_[_0x2150('0x42')]({},_0x1caa88,_0x699e17[_0x2150('0x43')]);return db[_0x2150('0x54')][_0x2150('0x20')]({'where':_0x1caa88['where']})[_0x2150('0x27')](function(_0x58d09e){_0x3707fe[_0x2150('0x20')]=_0x58d09e;if(_0x699e17[_0x2150('0x34')][_0x2150('0x44')]){_0x1caa88[_0x2150('0x45')]=[{'all':!![]}];}return db[_0x2150('0x54')][_0x2150('0x46')](_0x1caa88);})['then'](function(_0x23dca4){_0x3707fe['rows']=_0x23dca4;return _0x3707fe;});}})[_0x2150('0x27')](respondWithFilteredResult(_0x173709,_0x1caa88))[_0x2150('0x47')](handleError(_0x173709,null));};exports['removeDispositions']=function(_0x1e45f0,_0x456f95,_0x42d1b5){return db['CmList'][_0x2150('0x4d')]({'where':{'id':_0x1e45f0[_0x2150('0x52')]['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x456f95,null))[_0x2150('0x27')](function(_0x4d4644){if(_0x4d4644){return _0x4d4644['removeDispositions'](_0x1e45f0[_0x2150('0x34')][_0x2150('0x57')]);}})[_0x2150('0x27')](respondWithStatusCode(_0x456f95,null))[_0x2150('0x47')](handleError(_0x456f95,null));};exports['addContacts']=function(_0x5c4a1a,_0x53b015,_0x1b8a73){return db[_0x2150('0x30')][_0x2150('0x4d')]({'where':{'id':_0x5c4a1a['params']['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x53b015,null))[_0x2150('0x27')](function(_0x2efe65){if(_0x2efe65){var _0x1c31dc=[];var _0x1ad590={'success':[],'errors':[]};return db[_0x2150('0x58')][_0x2150('0x50')]()[_0x2150('0x27')](function(_0x2b4a25){if(_0x5c4a1a[_0x2150('0x4a')][_0x2150('0x59')]&&_[_0x2150('0x5a')](_0x5c4a1a[_0x2150('0x4a')][_0x2150('0x59')])){if(_0x5c4a1a['body'][_0x2150('0x59')][_0x2150('0x3a')]){_0x5c4a1a[_0x2150('0x4a')][_0x2150('0x59')]=_0x5c4a1a[_0x2150('0x4a')][_0x2150('0x59')][_0x2150('0x5b')](';')+';';}else{_0x5c4a1a[_0x2150('0x4a')][_0x2150('0x59')]=null;}}else{_0x5c4a1a[_0x2150('0x4a')][_0x2150('0x59')]=null;}if(_0x5c4a1a[_0x2150('0x4a')]&&_[_0x2150('0x5a')](_0x5c4a1a[_0x2150('0x4a')])){for(var _0x14ea5a=0x0;_0x14ea5a<_0x5c4a1a[_0x2150('0x4a')][_0x2150('0x3a')];_0x14ea5a+=0x1){_0x5c4a1a[_0x2150('0x4a')][_0x14ea5a][_0x2150('0x56')]=_0x5c4a1a[_0x2150('0x52')]['id'];_0x1c31dc[_0x2150('0x5c')](_0x5c4a1a[_0x2150('0x4a')][_0x14ea5a]);}return BPromise[_0x2150('0x5d')](_0x1c31dc,function(_0x35aef5){return db['CmContact'][_0x2150('0x49')](_['omit'](_0x35aef5,[_0x2150('0x57'),'id'])||{},{'fields':_[_0x2150('0x35')](_0x2b4a25),'raw':!![]})[_0x2150('0x27')](function(_0xc0fdde){_0x1ad590['success'][_0x2150('0x5c')](_0xc0fdde[_0x2150('0x5e')]);})['catch'](function(_0x5eca3d){_0x1ad590[_0x2150('0x5f')][_0x2150('0x5c')]({'data':_0x35aef5,'error':_0x5eca3d[_0x2150('0x60')]});});})['then'](function(_0xe9ed21){return _0x1ad590;})[_0x2150('0x47')](function(_0x14be9c){return _0x14be9c;});}else{_0x53b015[_0x2150('0x1c')](0x190)[_0x2150('0x61')]({'message':_0x2150('0x62')});}});}})[_0x2150('0x27')](respondWithResult(_0x53b015,null))[_0x2150('0x47')](handleError(_0x53b015,null));};exports[_0x2150('0x63')]=function(_0x22cd22,_0x185cfa,_0x21d80e){var _0x1ea670;return db[_0x2150('0x30')]['find']({'where':{'id':_0x22cd22[_0x2150('0x52')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x2150('0x64')}]})[_0x2150('0x27')](handleEntityNotFound(_0x185cfa,null))[_0x2150('0x27')](function(_0x1ceffd){if(_0x1ceffd){_0x1ea670=_0x1ceffd;return db[_0x2150('0x58')][_0x2150('0x31')];}})[_0x2150('0x27')](function(_0x29f9ec){if(_0x29f9ec){var _0x5f1469={};var _0x2e83b8={};_0x2e83b8[_0x2150('0x37')]=_[_0x2150('0x65')](_['keys'](_0x29f9ec),_[_0x2150('0x2f')](_0x1ea670[_0x2150('0x64')],function(_0x41a65c){return util[_0x2150('0x66')]('cf_%d',_0x41a65c['id']);}));_0x2e83b8[_0x2150('0x34')]=_['keys'](_0x22cd22[_0x2150('0x34')]);_0x2e83b8[_0x2150('0x3e')]=_['intersection'](_0x2e83b8[_0x2150('0x37')],_0x2e83b8['query']);_0x5f1469['attributes']=_[_0x2150('0x36')](_0x2e83b8[_0x2150('0x37')],qs[_0x2150('0x38')](_0x22cd22['query'][_0x2150('0x38')]));_0x5f1469[_0x2150('0x39')]=_0x5f1469[_0x2150('0x39')][_0x2150('0x3a')]?_0x5f1469['attributes']:_0x2e83b8['model'];if(!_0x22cd22['query'][_0x2150('0x3b')]('nolimit')){_0x5f1469['limit']=qs[_0x2150('0x21')](_0x22cd22[_0x2150('0x34')][_0x2150('0x21')]);_0x5f1469[_0x2150('0x1e')]=qs[_0x2150('0x1e')](_0x22cd22[_0x2150('0x34')][_0x2150('0x1e')]);}_0x5f1469[_0x2150('0x55')]=qs[_0x2150('0x3d')](_0x22cd22['query'][_0x2150('0x3d')]);_0x5f1469[_0x2150('0x41')]=qs[_0x2150('0x3e')](_[_0x2150('0x3f')](_0x22cd22['query'],_0x2e83b8[_0x2150('0x3e')]));_0x5f1469[_0x2150('0x67')]=!![];if(_0x22cd22['query'][_0x2150('0x40')]){_0x5f1469[_0x2150('0x41')]=_[_0x2150('0x42')](_0x5f1469[_0x2150('0x41')],{'$or':_['map'](_0x5f1469[_0x2150('0x39')],function(_0x1ee546){var _0x3fb7b1={};_0x3fb7b1[_0x1ee546]={'$like':'%'+_0x22cd22['query']['filter']+'%'};return _0x3fb7b1;})});}_0x5f1469=_[_0x2150('0x42')]({},_0x5f1469,_0x22cd22[_0x2150('0x43')]);return _0x1ea670[_0x2150('0x63')](_0x5f1469);}})[_0x2150('0x27')](respondWithResult(_0x185cfa,null))[_0x2150('0x47')](handleError(_0x185cfa,null));};exports[_0x2150('0x68')]=function(_0x41f828,_0x2bcdb8,_0x209602){var _0x3a89a3;var _0x1d8f5d;var _0x201f7d;var _0x401b01=_0x41f828[_0x2150('0x52')]['id'];csv_results=[];return db[_0x2150('0x69')][_0x2150('0x46')]({'attributes':['id',_0x2150('0x2c')],'raw':!![],'order':[_0x2150('0x6a')]})[_0x2150('0x27')](function(_0x33f0ce){_0x3a89a3=_0x33f0ce;var _0xbf1ccd=_[_0x2150('0x35')](db[_0x2150('0x58')][_0x2150('0x31')]);return db[_0x2150('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x2150('0x6c')]})[_0x2150('0x27')](function(_0x2523e8){_0x1d8f5d=_0x2523e8;var _0x46deac=squel[_0x2150('0x6d')]()[_0x2150('0x38')](_0xbf1ccd)[_0x2150('0x6e')](_0x2150('0x6f'),'c')[_0x2150('0x41')](_0x2150('0x70'),_0x401b01)['where'](_0x2150('0x71'))[_0x2150('0x72')]();for(var _0x30b955=0x0;_0x30b955<_0x1d8f5d['length'];_0x30b955++){_0x46deac['field']('c.cf_'+_0x1d8f5d[_0x30b955]['id'],_0x2150('0x73')+_0x1d8f5d[_0x30b955]['alias']);}for(var _0x30b955=0x0;_0x30b955<_0x3a89a3['length'];_0x30b955++){_0x46deac['field'](squel[_0x2150('0x6d')]()[_0x2150('0x74')](_0x2150('0x75'))['from'](_0x2150('0x76'))[_0x2150('0x41')]('ItemTypeId\x20=\x20?',_0x3a89a3[_0x30b955]['id'])[_0x2150('0x41')](_0x2150('0x77')),_0x2150('0x78')+_0x3a89a3[_0x30b955]['name']);_0x46deac[_0x2150('0x74')](squel[_0x2150('0x6d')]()[_0x2150('0x74')](_0x2150('0x79'))['from'](_0x2150('0x76'))[_0x2150('0x41')](_0x2150('0x7a'),_0x3a89a3[_0x30b955]['id'])[_0x2150('0x41')](_0x2150('0x77')),_0x2150('0x7b')+_0x3a89a3[_0x30b955][_0x2150('0x2c')]);}var _0xf59ebb=[];_0xf59ebb['push'](_0x46deac[_0x2150('0x7c')]());BPromise[_0x2150('0x5d')](_0xf59ebb,handleQuery)['then'](function(_0x37c627){handleQuery(_0x46deac['toString']());var _0x2d6e5c=csv_results[0x0];if(!_[_0x2150('0x7d')](_0x2d6e5c)){var _0x3c7154=toCsv(_0x2d6e5c);var _0x3c673a=Date[_0x2150('0x7e')]();fs[_0x2150('0x7f')](util['format']('/tmp/list_%d_%s.csv',_0x401b01,_0x3c673a),_0x3c7154);_0x2bcdb8[_0x2150('0x80')](_0x2150('0x81'),'attachment;\x20filename='+util[_0x2150('0x66')](_0x2150('0x82'),_0x401b01,_0x3c673a));_0x2bcdb8[_0x2150('0x80')](_0x2150('0x83'),_0x2150('0x84'));return _0x2bcdb8['download'](util[_0x2150('0x66')](_0x2150('0x85'),_0x401b01,_0x3c673a));}else{return _0x2bcdb8['sendStatus'](0xcc);}});});});};exports[_0x2150('0x86')]=function(_0x5cfe77,_0x471a81,_0x1742e6){var _0x3aa6cf;delete _0x5cfe77[_0x2150('0x4a')]['id'];return db[_0x2150('0x30')][_0x2150('0x53')]({'where':{'id':_0x5cfe77[_0x2150('0x52')]['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x471a81,null))['then'](function(_0x5b74d9){if(_0x5b74d9){return db['sequelize'][_0x2150('0x87')](function(_0x50f2f7){return db[_0x2150('0x6b')][_0x2150('0x49')](_0x5cfe77[_0x2150('0x4a')],{'transaction':_0x50f2f7})[_0x2150('0x27')](function(_0x52d2b8){_0x3aa6cf=_0x52d2b8;return _0x5b74d9['addCustomFields'](_0x52d2b8,{'transaction':_0x50f2f7});})['then'](function(){var _0xdbc8d2={'type':db[_0x2150('0x88')]['TEXT'],'transaction':_0x50f2f7};switch(_0x5cfe77[_0x2150('0x4a')][_0x2150('0x32')]){case _0x2150('0x89'):_0xdbc8d2['type']=db[_0x2150('0x88')]['TEXT'];break;case _0x2150('0x8a'):_0xdbc8d2[_0x2150('0x32')]=db[_0x2150('0x88')][_0x2150('0x8b')];break;case _0x2150('0x8c'):_0xdbc8d2[_0x2150('0x32')]=db[_0x2150('0x88')][_0x2150('0x8d')];_0xdbc8d2[_0x2150('0x8e')]=![];break;default:}return db['sequelize'][_0x2150('0x8f')][_0x2150('0x90')](_0x2150('0x6f'),util[_0x2150('0x66')](_0x2150('0x91'),_0x3aa6cf['id']),_0xdbc8d2);})[_0x2150('0x27')](function(){return _0x3aa6cf;});});}})[_0x2150('0x27')](respondWithResult(_0x471a81,null))[_0x2150('0x47')](handleError(_0x471a81,null));};exports['getCustomFields']=function(_0x499d6f,_0x4a5640,_0x26c93c){var _0xbab0b={};var _0x328409={};var _0x2f79cf;var _0x599fc5;return db['CmList'][_0x2150('0x53')]({'where':{'id':_0x499d6f['params']['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x4a5640,null))[_0x2150('0x27')](function(_0x4eb9d3){if(_0x4eb9d3){_0x2f79cf=_0x4eb9d3;_0x328409['model']=_[_0x2150('0x35')](db[_0x2150('0x6b')][_0x2150('0x31')]);_0x328409[_0x2150('0x34')]=_[_0x2150('0x35')](_0x499d6f['query']);_0x328409['filters']=_[_0x2150('0x36')](_0x328409[_0x2150('0x37')],_0x328409[_0x2150('0x34')]);_0xbab0b[_0x2150('0x39')]=_[_0x2150('0x36')](_0x328409[_0x2150('0x37')],qs['fields'](_0x499d6f[_0x2150('0x34')][_0x2150('0x38')]));_0xbab0b['attributes']=_0xbab0b[_0x2150('0x39')][_0x2150('0x3a')]?_0xbab0b[_0x2150('0x39')]:_0x328409[_0x2150('0x37')];_0xbab0b[_0x2150('0x55')]=qs[_0x2150('0x3d')](_0x499d6f[_0x2150('0x34')]['sort']);_0xbab0b[_0x2150('0x41')]=qs['filters'](_['pick'](_0x499d6f[_0x2150('0x34')],_0x328409[_0x2150('0x3e')]));_0xbab0b[_0x2150('0x41')]=_[_0x2150('0x42')](_0xbab0b['where'],{'$or':[{'ListId':_0x4eb9d3['id']},{'ListId':null}]});if(_0x499d6f[_0x2150('0x34')][_0x2150('0x40')]){_0xbab0b[_0x2150('0x41')]=_['merge'](_0xbab0b[_0x2150('0x41')],{'$or':_[_0x2150('0x2f')](_0xbab0b[_0x2150('0x39')],function(_0xb7a4df){var _0x3dd69e={};_0x3dd69e[_0xb7a4df]={'$like':'%'+_0x499d6f[_0x2150('0x34')][_0x2150('0x40')]+'%'};return _0x3dd69e;})});}_0xbab0b=_[_0x2150('0x42')]({},_0xbab0b,_0x499d6f[_0x2150('0x43')]);return db[_0x2150('0x6b')][_0x2150('0x92')](_0xbab0b);}})['then'](respondWithResult(_0x4a5640,null))[_0x2150('0x47')](handleError(_0x4a5640,null));};exports[_0x2150('0x93')]=function(_0x2dad4c,_0x4517cc){return db[_0x2150('0x6b')][_0x2150('0x92')]({'where':{'ListId':null}})[_0x2150('0x27')](handleEntityNotFound(_0x4517cc,null))[_0x2150('0x27')](function(_0x1c8b1f){return _0x1c8b1f;})[_0x2150('0x27')](respondWithResult(_0x4517cc,null))[_0x2150('0x47')](handleError(_0x4517cc,null));};exports[_0x2150('0x94')]=function(_0x38bb66,_0x3bb537,_0x585823){return db[_0x2150('0x30')][_0x2150('0x4d')]({'where':{'id':_0x38bb66['params']['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x3bb537,null))['then'](function(_0x4c85fc){if(_0x4c85fc){return _0x4c85fc[_0x2150('0x94')](_0x38bb66[_0x2150('0x4a')][_0x2150('0x57')],_[_0x2150('0x95')](_0x38bb66[_0x2150('0x4a')],['ids','id'])||{})[_0x2150('0x96')](function(_0x2dc1ca){for(var _0x33ff42=0x0;_0x33ff42<_0x38bb66[_0x2150('0x4a')][_0x2150('0x57')]['length'];_0x33ff42+=0x1){socket[_0x2150('0x97')](_0x2150('0x98'),{'UserId':Number(_0x38bb66[_0x2150('0x4a')][_0x2150('0x57')][_0x33ff42]),'CmListId':Number(_0x38bb66[_0x2150('0x52')]['id'])});}return _0x2dc1ca;});}})[_0x2150('0x27')](respondWithResult(_0x3bb537,null))[_0x2150('0x47')](handleError(_0x3bb537,null));};exports[_0x2150('0x99')]=function(_0x49f101,_0x4ff074,_0x476d25){return db[_0x2150('0x30')]['find']({'where':{'id':_0x49f101[_0x2150('0x52')]['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x4ff074,null))[_0x2150('0x27')](function(_0x559e99){if(_0x559e99){return _0x559e99[_0x2150('0x99')](_0x49f101[_0x2150('0x34')][_0x2150('0x57')])[_0x2150('0x27')](function(){if(_['isArray'](_0x49f101[_0x2150('0x34')][_0x2150('0x57')])){for(var _0x120190=0x0;_0x120190<_0x49f101['query'][_0x2150('0x57')][_0x2150('0x3a')];_0x120190+=0x1){socket[_0x2150('0x97')](_0x2150('0x9a'),{'UserId':Number(_0x49f101[_0x2150('0x34')]['ids'][_0x120190]),'CmListId':Number(_0x49f101[_0x2150('0x52')]['id'])});}}else{socket[_0x2150('0x97')](_0x2150('0x9a'),{'UserId':Number(_0x49f101[_0x2150('0x34')][_0x2150('0x57')]),'CmListId':Number(_0x49f101[_0x2150('0x52')]['id'])});}});}})[_0x2150('0x27')](respondWithStatusCode(_0x4ff074,null))[_0x2150('0x47')](handleError(_0x4ff074,null));};exports[_0x2150('0x9b')]=function(_0x581b32,_0x24a8cd,_0x2b062d){var _0x5ef52c={};var _0x3d77fd={};var _0x155c80;var _0x2ee651;return db[_0x2150('0x30')][_0x2150('0x53')]({'where':{'id':_0x581b32['params']['id']}})[_0x2150('0x27')](handleEntityNotFound(_0x24a8cd,null))[_0x2150('0x27')](function(_0x3aa4b7){if(_0x3aa4b7){_0x155c80=_0x3aa4b7;_0x3d77fd[_0x2150('0x37')]=_[_0x2150('0x35')](db[_0x2150('0x9c')][_0x2150('0x31')]);_0x3d77fd[_0x2150('0x34')]=_[_0x2150('0x35')](_0x581b32['query']);_0x3d77fd[_0x2150('0x3e')]=_[_0x2150('0x36')](_0x3d77fd[_0x2150('0x37')],_0x3d77fd[_0x2150('0x34')]);_0x5ef52c['attributes']=_['intersection'](_0x3d77fd[_0x2150('0x37')],qs['fields'](_0x581b32[_0x2150('0x34')][_0x2150('0x38')]));_0x5ef52c['attributes']=_0x5ef52c[_0x2150('0x39')][_0x2150('0x3a')]?_0x5ef52c[_0x2150('0x39')]:_0x3d77fd['model'];_0x5ef52c[_0x2150('0x55')]=qs['sort'](_0x581b32['query'][_0x2150('0x3d')]);_0x5ef52c['where']=qs[_0x2150('0x3e')](_['pick'](_0x581b32[_0x2150('0x34')],_0x3d77fd[_0x2150('0x3e')]));if(_0x581b32[_0x2150('0x34')][_0x2150('0x40')]){_0x5ef52c['where']=_['merge'](_0x5ef52c[_0x2150('0x41')],{'$or':_[_0x2150('0x2f')](_0x5ef52c[_0x2150('0x39')],function(_0x570fdf){var _0x34a2ea={};_0x34a2ea[_0x570fdf]={'$like':'%'+_0x581b32['query'][_0x2150('0x40')]+'%'};return _0x34a2ea;})});}_0x5ef52c=_[_0x2150('0x42')]({},_0x5ef52c,_0x581b32['options']);return _0x155c80[_0x2150('0x9b')](_0x5ef52c);}})[_0x2150('0x27')](function(_0x4de90f){if(_0x4de90f){_0x2ee651=_0x4de90f[_0x2150('0x3a')];if(!_0x581b32['query'][_0x2150('0x3b')](_0x2150('0x3c'))){_0x5ef52c['limit']=qs[_0x2150('0x21')](_0x581b32[_0x2150('0x34')][_0x2150('0x21')]);_0x5ef52c[_0x2150('0x1e')]=qs['offset'](_0x581b32[_0x2150('0x34')][_0x2150('0x1e')]);}return _0x155c80['getAgents'](_0x5ef52c);}})['then'](function(_0x340c9c){if(_0x340c9c){return _0x340c9c?{'count':_0x2ee651,'rows':_0x340c9c}:null;}})[_0x2150('0x27')](respondWithResult(_0x24a8cd,null))[_0x2150('0x47')](handleError(_0x24a8cd,null));};function handleQuery(_0x5a4301){logger[_0x2150('0x9d')](_0x5a4301);return db[_0x2150('0x9e')][_0x2150('0x34')](_0x5a4301)[_0x2150('0x96')](function(_0x2e8860){csv_results[_0x2150('0x5c')](_0x2e8860);})[_0x2150('0x47')](function(_0x465bf9){logger['error'](_0x465bf9[_0x2150('0x60')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 86d47e8..6f136c3 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4f2801,_0x366dd1){var _0x3ac22a=function(_0x39862a){while(--_0x39862a){_0x4f2801['push'](_0x4f2801['shift']());}};_0x3ac22a(++_0x366dd1);}(_0x7217,0x19e));var _0x7721=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7217[_0x491a7f];return _0x3d8f44;};'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 +var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x326f,0xd1));var _0xf326=function(_0x2b2754,_0x124c20){_0x2b2754=_0x2b2754-0x0;var _0x50c5b5=_0x326f[_0x2b2754];return _0x50c5b5;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index da49c9a..4fecf0e 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 _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0x163f5d,_0x4b45e8){var _0x5f4247=function(_0x5708e9){while(--_0x5708e9){_0x163f5d['push'](_0x163f5d['shift']());}};_0x5f4247(++_0x4b45e8);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5460ff,_0x893258){_0x5460ff=_0x5460ff-0x0;var _0x551a44=_0xb43b[_0x5460ff];return _0x551a44;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x21d88c,_0x4fe948){var _0x106251=function(_0x14d5c9){while(--_0x14d5c9){_0x21d88c['push'](_0x21d88c['shift']());}};_0x106251(++_0x4fe948);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0xf3cd[_0x25b24a];return _0x224e68;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./cmList.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'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 76dddf5..d999c40 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 _0x423c=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x423c,0x1b4));var _0xc423=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x423c[_0x279d37];return _0x530173;};'use strict';var _=require(_0xc423('0x0'));var util=require(_0xc423('0x1'));var moment=require('moment');var BPromise=require(_0xc423('0x2'));var rs=require(_0xc423('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc423('0x4'))['db'];var utils=require(_0xc423('0x5'));var logger=require(_0xc423('0x6'))('rpc');var config=require(_0xc423('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc423('0x8')][_0xc423('0x9')]({'port':0x232a});config[_0xc423('0xa')]=_[_0xc423('0xb')](config[_0xc423('0xa')],{'host':_0xc423('0xc'),'port':0x18eb});var socket=require(_0xc423('0xd'))(new Redis(config[_0xc423('0xa')]));require(_0xc423('0xe'))[_0xc423('0xf')](socket);function respondWithRpcPromise(_0x13db4a,_0x39e69a,_0x4ef0c9){return new BPromise(function(_0x2dca62,_0xcebfdf){return client[_0xc423('0x10')](_0x13db4a,_0x4ef0c9)[_0xc423('0x11')](function(_0x445e95){logger[_0xc423('0x12')](_0xc423('0x13'),_0x39e69a,_0xc423('0x14'));logger[_0xc423('0x15')](_0xc423('0x16'),_0x39e69a,_0xc423('0x14'),JSON[_0xc423('0x17')](_0x445e95));if(_0x445e95[_0xc423('0x18')]){if(_0x445e95[_0xc423('0x18')][_0xc423('0x19')]===0x1f4){logger[_0xc423('0x18')](_0xc423('0x13'),_0x39e69a,_0x445e95[_0xc423('0x18')][_0xc423('0x1a')]);return _0xcebfdf(_0x445e95[_0xc423('0x18')][_0xc423('0x1a')]);}logger[_0xc423('0x18')]('CmList,\x20%s,\x20%s',_0x39e69a,_0x445e95['error'][_0xc423('0x1a')]);return _0x2dca62(_0x445e95['error'][_0xc423('0x1a')]);}else{logger[_0xc423('0x12')](_0xc423('0x13'),_0x39e69a,'request\x20sent');_0x2dca62(_0x445e95[_0xc423('0x1b')][_0xc423('0x1a')]);}})[_0xc423('0x1c')](function(_0x5f3855){logger[_0xc423('0x18')](_0xc423('0x13'),_0x39e69a,_0x5f3855);_0xcebfdf(_0x5f3855);});});} \ No newline at end of file +var _0x25d2=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x22f963,_0x4bb343){var _0x3ef3ee=function(_0x1bbbac){while(--_0x1bbbac){_0x22f963['push'](_0x22f963['shift']());}};_0x3ef3ee(++_0x4bb343);}(_0x25d2,0x168));var _0x225d=function(_0x44cf8c,_0x26b091){_0x44cf8c=_0x44cf8c-0x0;var _0x27e480=_0x25d2[_0x44cf8c];return _0x27e480;};'use strict';var _=require(_0x225d('0x0'));var util=require(_0x225d('0x1'));var moment=require(_0x225d('0x2'));var BPromise=require(_0x225d('0x3'));var rs=require(_0x225d('0x4'));var fs=require('fs');var Redis=require(_0x225d('0x5'));var db=require(_0x225d('0x6'))['db'];var utils=require(_0x225d('0x7'));var logger=require('../../config/logger')(_0x225d('0x8'));var config=require(_0x225d('0x9'));var jayson=require(_0x225d('0xa'));var client=jayson['client'][_0x225d('0xb')]({'port':0x232a});config[_0x225d('0xc')]=_[_0x225d('0xd')](config[_0x225d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x225d('0xe'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x222c66,_0x35370e,_0x146d4b){return new BPromise(function(_0x3b5f02,_0x33424a){return client[_0x225d('0xf')](_0x222c66,_0x146d4b)[_0x225d('0x10')](function(_0x597fb1){logger[_0x225d('0x11')](_0x225d('0x12'),_0x35370e,_0x225d('0x13'));logger[_0x225d('0x14')](_0x225d('0x15'),_0x35370e,'request\x20sent',JSON[_0x225d('0x16')](_0x597fb1));if(_0x597fb1[_0x225d('0x17')]){if(_0x597fb1[_0x225d('0x17')][_0x225d('0x18')]===0x1f4){logger[_0x225d('0x17')](_0x225d('0x12'),_0x35370e,_0x597fb1[_0x225d('0x17')][_0x225d('0x19')]);return _0x33424a(_0x597fb1[_0x225d('0x17')][_0x225d('0x19')]);}logger[_0x225d('0x17')](_0x225d('0x12'),_0x35370e,_0x597fb1['error'][_0x225d('0x19')]);return _0x3b5f02(_0x597fb1[_0x225d('0x17')][_0x225d('0x19')]);}else{logger[_0x225d('0x11')](_0x225d('0x12'),_0x35370e,_0x225d('0x13'));_0x3b5f02(_0x597fb1[_0x225d('0x1a')][_0x225d('0x19')]);}})[_0x225d('0x1b')](function(_0x368ded){logger[_0x225d('0x17')](_0x225d('0x12'),_0x35370e,_0x368ded);_0x33424a(_0x368ded);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 60fb2cf..bf21ca6 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 _0x4ce6=['./cmList.events','remove','update','emit','length','cmList:'];(function(_0x1e84ba,_0x5d949c){var _0x1517af=function(_0x57abdf){while(--_0x57abdf){_0x1e84ba['push'](_0x1e84ba['shift']());}};_0x1517af(++_0x5d949c);}(_0x4ce6,0x108));var _0x64ce=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x4ce6[_0x125ff8];return _0x2d9ef;};'use strict';var CmListEvents=require(_0x64ce('0x0'));var events=['save',_0x64ce('0x1'),_0x64ce('0x2')];function createListener(_0x3f9718,_0x11bca6){return function(_0x3f0983){_0x11bca6[_0x64ce('0x3')](_0x3f9718,_0x3f0983);};}function removeListener(_0x4a8899,_0x469aa){return function(){CmListEvents['removeListener'](_0x4a8899,_0x469aa);};}exports['register']=function(_0x31bc0f){for(var _0x262751=0x0,_0x5b8f2d=events[_0x64ce('0x4')];_0x262751<_0x5b8f2d;_0x262751++){var _0x3c279f=events[_0x262751];var _0x134230=createListener(_0x64ce('0x5')+_0x3c279f,_0x31bc0f);CmListEvents['on'](_0x3c279f,_0x134230);}}; \ No newline at end of file +var _0x33d1=['emit','removeListener','length','cmList:','save','update'];(function(_0xd22918,_0x1de1a1){var _0x30c9f9=function(_0x40b277){while(--_0x40b277){_0xd22918['push'](_0xd22918['shift']());}};_0x30c9f9(++_0x1de1a1);}(_0x33d1,0x16c));var _0x133d=function(_0x148101,_0x459e2c){_0x148101=_0x148101-0x0;var _0x47f449=_0x33d1[_0x148101];return _0x47f449;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x133d('0x0'),'remove',_0x133d('0x1')];function createListener(_0x1c23a3,_0x1c6edd){return function(_0x4290c2){_0x1c6edd[_0x133d('0x2')](_0x1c23a3,_0x4290c2);};}function removeListener(_0x1687e4,_0xded5b1){return function(){CmListEvents[_0x133d('0x3')](_0x1687e4,_0xded5b1);};}exports['register']=function(_0x2db599){for(var _0x60fe5=0x0,_0x46f7a2=events[_0x133d('0x4')];_0x60fe5<_0x46f7a2;_0x60fe5++){var _0x2069f7=events[_0x60fe5];var _0x500a2e=createListener(_0x133d('0x5')+_0x2069f7,_0x2db599);CmListEvents['on'](_0x2069f7,_0x500a2e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 689affb..beabac2 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 _0x75f0=['getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/describe','describe','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields'];(function(_0x4caf5f,_0x3d8397){var _0x21dbdc=function(_0x57a86a){while(--_0x57a86a){_0x4caf5f['push'](_0x4caf5f['shift']());}};_0x21dbdc(++_0x3d8397);}(_0x75f0,0x196));var _0x075f=function(_0x754f7f,_0x5a0753){_0x754f7f=_0x754f7f-0x0;var _0x20d21b=_0x75f0[_0x754f7f];return _0x20d21b;};'use strict';var multer=require(_0x075f('0x0'));var util=require(_0x075f('0x1'));var path=require(_0x075f('0x2'));var timeout=require(_0x075f('0x3'));var express=require(_0x075f('0x4'));var router=express[_0x075f('0x5')]();var fs_extra=require(_0x075f('0x6'));var auth=require(_0x075f('0x7'));var interaction=require(_0x075f('0x8'));var config=require('../../config/environment');var controller=require(_0x075f('0x9'));router[_0x075f('0xa')]('/',auth[_0x075f('0xb')](),controller['index']);router['get'](_0x075f('0xc'),auth['isAuthenticated'](),controller[_0x075f('0xd')]);router[_0x075f('0xa')]('/global_fields',auth[_0x075f('0xb')](),controller[_0x075f('0xe')]);router[_0x075f('0xa')](_0x075f('0xf'),auth[_0x075f('0xb')](),controller['show']);router['get'](_0x075f('0x10'),auth[_0x075f('0xb')](),controller[_0x075f('0x11')]);router[_0x075f('0xa')](_0x075f('0x12'),auth[_0x075f('0xb')](),controller[_0x075f('0x13')]);router[_0x075f('0xa')](_0x075f('0x14'),auth[_0x075f('0xb')](),controller[_0x075f('0x15')]);router[_0x075f('0xa')](_0x075f('0x16'),auth[_0x075f('0xb')](),controller[_0x075f('0x17')]);router[_0x075f('0xa')](_0x075f('0x18'),auth['isAuthenticated'](),controller[_0x075f('0x19')]);router['post']('/',auth['isAuthenticated'](),controller[_0x075f('0x1a')]);router[_0x075f('0x1b')](_0x075f('0x10'),auth['isAuthenticated'](),controller[_0x075f('0x1c')]);router[_0x075f('0x1b')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x075f('0x1d')]);router['post']('/:id/fields',auth[_0x075f('0xb')](),controller[_0x075f('0x1e')]);router[_0x075f('0x1b')](_0x075f('0x18'),auth[_0x075f('0xb')](),controller[_0x075f('0x1f')]);router[_0x075f('0x20')](_0x075f('0xf'),auth[_0x075f('0xb')](),controller[_0x075f('0x21')]);router[_0x075f('0x22')]('/:id',auth[_0x075f('0xb')](),controller[_0x075f('0x23')]);router[_0x075f('0x22')](_0x075f('0x10'),auth[_0x075f('0xb')](),controller[_0x075f('0x24')]);router[_0x075f('0x22')](_0x075f('0x18'),auth[_0x075f('0xb')](),controller[_0x075f('0x25')]);module[_0x075f('0x26')]=router; \ No newline at end of file +var _0x50b0=['/:id','show','/:id/dispositions','/:id/contacts','getContacts','getContactsCsv','/:id/users','getAgents','post','addContacts','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','/global_fields','getGlobalCustomFields'];(function(_0x32179c,_0x32fb68){var _0xad3766=function(_0x597f3f){while(--_0x597f3f){_0x32179c['push'](_0x32179c['shift']());}};_0xad3766(++_0x32fb68);}(_0x50b0,0xa7));var _0x050b=function(_0x6cf23e,_0x448101){_0x6cf23e=_0x6cf23e-0x0;var _0x1be1d6=_0x50b0[_0x6cf23e];return _0x1be1d6;};'use strict';var multer=require('multer');var util=require(_0x050b('0x0'));var path=require('path');var timeout=require(_0x050b('0x1'));var express=require(_0x050b('0x2'));var router=express['Router']();var fs_extra=require(_0x050b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x050b('0x4'));var config=require(_0x050b('0x5'));var controller=require(_0x050b('0x6'));router[_0x050b('0x7')]('/',auth['isAuthenticated'](),controller[_0x050b('0x8')]);router[_0x050b('0x7')](_0x050b('0x9'),auth[_0x050b('0xa')](),controller['describe']);router['get'](_0x050b('0xb'),auth[_0x050b('0xa')](),controller[_0x050b('0xc')]);router[_0x050b('0x7')](_0x050b('0xd'),auth[_0x050b('0xa')](),controller[_0x050b('0xe')]);router[_0x050b('0x7')](_0x050b('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x050b('0x7')](_0x050b('0x10'),auth[_0x050b('0xa')](),controller[_0x050b('0x11')]);router[_0x050b('0x7')]('/:id/contacts/csv',auth[_0x050b('0xa')](),controller[_0x050b('0x12')]);router[_0x050b('0x7')]('/:id/fields',auth[_0x050b('0xa')](),controller['getCustomFields']);router[_0x050b('0x7')](_0x050b('0x13'),auth[_0x050b('0xa')](),controller[_0x050b('0x14')]);router[_0x050b('0x15')]('/',auth[_0x050b('0xa')](),controller['create']);router[_0x050b('0x15')](_0x050b('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x050b('0x10'),auth[_0x050b('0xa')](),controller[_0x050b('0x16')]);router[_0x050b('0x15')]('/:id/fields',auth[_0x050b('0xa')](),controller['addCustomField']);router['post']('/:id/users',auth[_0x050b('0xa')](),controller[_0x050b('0x17')]);router[_0x050b('0x18')]('/:id',auth[_0x050b('0xa')](),controller['update']);router[_0x050b('0x19')](_0x050b('0xd'),auth[_0x050b('0xa')](),controller[_0x050b('0x1a')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x050b('0x1b')]);router[_0x050b('0x19')](_0x050b('0x13'),auth[_0x050b('0xa')](),controller[_0x050b('0x1c')]);module[_0x050b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 55df921..17cb62e 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 _0xb46b=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x87ef7e,_0x4502e5){var _0x4fbad9=function(_0x8634de){while(--_0x8634de){_0x87ef7e['push'](_0x87ef7e['shift']());}};_0x4fbad9(++_0x4502e5);}(_0xb46b,0x8a));var _0xbb46=function(_0x58e9c7,_0x31b4a3){_0x58e9c7=_0x58e9c7-0x0;var _0x251bed=_0xb46b[_0x58e9c7];return _0x251bed;};'use strict';var Sequelize=require(_0xbb46('0x0'));module[_0xbb46('0x1')]={'name':{'type':Sequelize[_0xbb46('0x2')],'get':function(_0x5ad7fe){return this[_0xbb46('0x3')]('field');}},'field':{'type':Sequelize[_0xbb46('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xbb46('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xbb46('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x7571=['sequelize','getDataValue','field','STRING'];(function(_0x2ccbdf,_0x363109){var _0x4b9c93=function(_0x3629ce){while(--_0x3629ce){_0x2ccbdf['push'](_0x2ccbdf['shift']());}};_0x4b9c93(++_0x363109);}(_0x7571,0x124));var _0x1757=function(_0x55d44e,_0x9c70fa){_0x55d44e=_0x55d44e-0x0;var _0x54d5fe=_0x7571[_0x55d44e];return _0x54d5fe;};'use strict';var Sequelize=require(_0x1757('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x26be05){return this[_0x1757('0x1')](_0x1757('0x2'));}},'field':{'type':Sequelize[_0x1757('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x1757('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x1757('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 2886293..a63ecfd 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x513c55,_0x3d0461){var _0x1da56b=function(_0x570ee1){while(--_0x570ee1){_0x513c55['push'](_0x513c55['shift']());}};_0x1da56b(++_0x3d0461);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x433938,_0x49e278){var _0x138795=function(_0x5f0fca){while(--_0x5f0fca){_0x433938['push'](_0x433938['shift']());}};_0x138795(++_0x49e278);}(_0x7a54,0x106));var _0x47a5=function(_0x279d09,_0x5e4ce2){_0x279d09=_0x279d09-0x0;var _0x49e977=_0x7a54[_0x279d09];return _0x49e977;};'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 1b6e1b4..1b51b25 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 _0xdda5=['rimraf','../../config/environment','define','tools_conditions','util','api','moment','request-promise'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xdda5,0x19c));var _0x5dda=function(_0x474683,_0x16c3b9){_0x474683=_0x474683-0x0;var _0x3c7ab2=_0xdda5[_0x474683];return _0x3c7ab2;};'use strict';var _=require('lodash');var util=require(_0x5dda('0x0'));var logger=require('../../config/logger')(_0x5dda('0x1'));var moment=require(_0x5dda('0x2'));var BPromise=require('bluebird');var rp=require(_0x5dda('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5dda('0x4'));var config=require(_0x5dda('0x5'));var attributes=require('./condition.attributes');module['exports']=function(_0x3ea651,_0x41f65d){return _0x3ea651[_0x5dda('0x6')]('Condition',attributes,{'tableName':_0x5dda('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3fc=['exports','Condition','tools_conditions','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20d290,_0x40fc11){var _0x2bfa8f=function(_0x2498e0){while(--_0x2498e0){_0x20d290['push'](_0x20d290['shift']());}};_0x2bfa8f(++_0x40fc11);}(_0xd3fc,0x123));var _0xcd3f=function(_0x3a31c3,_0x184f64){_0x3a31c3=_0x3a31c3-0x0;var _0x3c1264=_0xd3fc[_0x3a31c3];return _0x3c1264;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcd3f('0x0'))(_0xcd3f('0x1'));var moment=require(_0xcd3f('0x2'));var BPromise=require(_0xcd3f('0x3'));var rp=require(_0xcd3f('0x4'));var fs=require('fs');var path=require(_0xcd3f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0xcd3f('0x6')]=function(_0x170e09,_0x4c991c){return _0x170e09['define'](_0xcd3f('0x7'),attributes,{'tableName':_0xcd3f('0x8'),'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 a7efc8c..2deae9f 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 _0xef6a=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','Condition,\x20%s,\x20%s'];(function(_0x2223b5,_0x8d79dd){var _0x3b9802=function(_0x4f9549){while(--_0x4f9549){_0x2223b5['push'](_0x2223b5['shift']());}};_0x3b9802(++_0x8d79dd);}(_0xef6a,0x8d));var _0xaef6=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xef6a[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xaef6('0x0'));var util=require(_0xaef6('0x1'));var moment=require(_0xaef6('0x2'));var BPromise=require(_0xaef6('0x3'));var rs=require(_0xaef6('0x4'));var fs=require('fs');var Redis=require(_0xaef6('0x5'));var db=require(_0xaef6('0x6'))['db'];var utils=require(_0xaef6('0x7'));var logger=require(_0xaef6('0x8'))('rpc');var config=require(_0xaef6('0x9'));var jayson=require(_0xaef6('0xa'));var client=jayson['client'][_0xaef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ed6c7,_0x415a6c,_0x237c76){return new BPromise(function(_0xb5f118,_0x27e23b){return client['request'](_0x4ed6c7,_0x237c76)['then'](function(_0x85e031){logger['info'](_0xaef6('0xc'),_0x415a6c,_0xaef6('0xd'));logger[_0xaef6('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x415a6c,_0xaef6('0xd'),JSON[_0xaef6('0xf')](_0x85e031));if(_0x85e031['error']){if(_0x85e031[_0xaef6('0x10')][_0xaef6('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x415a6c,_0x85e031[_0xaef6('0x10')]['message']);return _0x27e23b(_0x85e031['error'][_0xaef6('0x12')]);}logger[_0xaef6('0x10')]('Condition,\x20%s,\x20%s',_0x415a6c,_0x85e031[_0xaef6('0x10')][_0xaef6('0x12')]);return _0xb5f118(_0x85e031[_0xaef6('0x10')][_0xaef6('0x12')]);}else{logger[_0xaef6('0x13')]('Condition,\x20%s,\x20%s',_0x415a6c,_0xaef6('0xd'));_0xb5f118(_0x85e031[_0xaef6('0x14')]['message']);}})[_0xaef6('0x15')](function(_0x5522d8){logger['error'](_0xaef6('0xc'),_0x415a6c,_0x5522d8);_0x27e23b(_0x5522d8);});});} \ No newline at end of file +var _0xfe44=['../../config/logger','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3f2e2d,_0x314ddc){var _0x5cf715=function(_0x4de41c){while(--_0x4de41c){_0x3f2e2d['push'](_0x3f2e2d['shift']());}};_0x5cf715(++_0x314ddc);}(_0xfe44,0xb1));var _0x4fe4=function(_0x34b264,_0xf2b885){_0x34b264=_0x34b264-0x0;var _0x5983f1=_0xfe44[_0x34b264];return _0x5983f1;};'use strict';var _=require(_0x4fe4('0x0'));var util=require(_0x4fe4('0x1'));var moment=require(_0x4fe4('0x2'));var BPromise=require(_0x4fe4('0x3'));var rs=require(_0x4fe4('0x4'));var fs=require('fs');var Redis=require(_0x4fe4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fe4('0x6'));var logger=require(_0x4fe4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4fe4('0x8'));var client=jayson[_0x4fe4('0x9')][_0x4fe4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15bfe5,_0x5bdc4e,_0x215264){return new BPromise(function(_0x29102e,_0x174616){return client[_0x4fe4('0xb')](_0x15bfe5,_0x215264)[_0x4fe4('0xc')](function(_0x5de956){logger[_0x4fe4('0xd')](_0x4fe4('0xe'),_0x5bdc4e,_0x4fe4('0xf'));logger[_0x4fe4('0x10')](_0x4fe4('0x11'),_0x5bdc4e,_0x4fe4('0xf'),JSON[_0x4fe4('0x12')](_0x5de956));if(_0x5de956[_0x4fe4('0x13')]){if(_0x5de956[_0x4fe4('0x13')]['code']===0x1f4){logger[_0x4fe4('0x13')]('Condition,\x20%s,\x20%s',_0x5bdc4e,_0x5de956['error'][_0x4fe4('0x14')]);return _0x174616(_0x5de956[_0x4fe4('0x13')]['message']);}logger[_0x4fe4('0x13')]('Condition,\x20%s,\x20%s',_0x5bdc4e,_0x5de956[_0x4fe4('0x13')][_0x4fe4('0x14')]);return _0x29102e(_0x5de956[_0x4fe4('0x13')][_0x4fe4('0x14')]);}else{logger['info'](_0x4fe4('0xe'),_0x5bdc4e,_0x4fe4('0xf'));_0x29102e(_0x5de956[_0x4fe4('0x15')][_0x4fe4('0x14')]);}})[_0x4fe4('0x16')](function(_0x444811){logger[_0x4fe4('0x13')](_0x4fe4('0xe'),_0x5bdc4e,_0x444811);_0x174616(_0x444811);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 21d71e3..94c54e8 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 _0x6a2f=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x22ac67,_0xef7b3d){var _0x14a172=function(_0x5698d0){while(--_0x5698d0){_0x22ac67['push'](_0x22ac67['shift']());}};_0x14a172(++_0xef7b3d);}(_0x6a2f,0x1ce));var _0xf6a2=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x6a2f[_0x43d16c];return _0x208cce;};'use strict';var multer=require(_0xf6a2('0x0'));var util=require(_0xf6a2('0x1'));var path=require('path');var timeout=require(_0xf6a2('0x2'));var express=require(_0xf6a2('0x3'));var router=express[_0xf6a2('0x4')]();var fs_extra=require(_0xf6a2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf6a2('0x6'));var config=require(_0xf6a2('0x7'));var controller=require('./condition.controller');router[_0xf6a2('0x8')](_0xf6a2('0x9'),auth[_0xf6a2('0xa')](),controller[_0xf6a2('0xb')]);router[_0xf6a2('0xc')](_0xf6a2('0x9'),auth[_0xf6a2('0xa')](),controller[_0xf6a2('0xd')]);module[_0xf6a2('0xe')]=router; \ No newline at end of file +var _0x5777=['fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x45978b,_0x137b2e){var _0x390259=function(_0x11a8e2){while(--_0x11a8e2){_0x45978b['push'](_0x45978b['shift']());}};_0x390259(++_0x137b2e);}(_0x5777,0xb2));var _0x7577=function(_0x4377a3,_0x2ee5c3){_0x4377a3=_0x4377a3-0x0;var _0x500e49=_0x5777[_0x4377a3];return _0x500e49;};'use strict';var multer=require(_0x7577('0x0'));var util=require('util');var path=require(_0x7577('0x1'));var timeout=require(_0x7577('0x2'));var express=require(_0x7577('0x3'));var router=express['Router']();var fs_extra=require(_0x7577('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7577('0x5'));var config=require(_0x7577('0x6'));var controller=require('./condition.controller');router[_0x7577('0x7')](_0x7577('0x8'),auth[_0x7577('0x9')](),controller[_0x7577('0xa')]);router[_0x7577('0xb')](_0x7577('0x8'),auth[_0x7577('0x9')](),controller['destroy']);module[_0x7577('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index ed3a2ff..71b83c7 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 _0xf76a=['STRING','name','sequelize','exports'];(function(_0x263cb4,_0x53ce57){var _0x32a04b=function(_0x31e87b){while(--_0x31e87b){_0x263cb4['push'](_0x263cb4['shift']());}};_0x32a04b(++_0x53ce57);}(_0xf76a,0xfa));var _0xaf76=function(_0x59653f,_0x3f2fe4){_0x59653f=_0x59653f-0x0;var _0x3de0c4=_0xf76a[_0x59653f];return _0x3de0c4;};'use strict';var Sequelize=require(_0xaf76('0x0'));module[_0xaf76('0x1')]={'name':{'type':Sequelize[_0xaf76('0x2')],'allowNull':![],'unique':_0xaf76('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xaf76('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2c11=['name','INTEGER','exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2c11,0xd2));var _0x12c1=function(_0x19b742,_0x19e318){_0x19b742=_0x19b742-0x0;var _0x3ab093=_0x2c11[_0x19b742];return _0x3ab093;};'use strict';var Sequelize=require('sequelize');module[_0x12c1('0x0')]={'name':{'type':Sequelize[_0x12c1('0x1')],'allowNull':![],'unique':_0x12c1('0x2')},'OrderBy':{'type':Sequelize[_0x12c1('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x12c1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 42c75cb..40d363f 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 _0xb78e=['find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','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','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','destroy','ContactItemTypes','UserProfileResource','then','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x4a70c3,_0x6b0d4f){var _0x3e0aec=function(_0x3a96cf){while(--_0x3a96cf){_0x4a70c3['push'](_0x4a70c3['shift']());}};_0x3e0aec(++_0x6b0d4f);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5a9aff,_0x11e48c){_0x5a9aff=_0x5a9aff-0x0;var _0x4824d1=_0xb78e[_0x5a9aff];return _0x4824d1;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){var _0x777ca3=_0x2159c1['get']({'plain':!![]});var _0x9a00b=_0xeb78('0x28');return db[_0xeb78('0x29')][_0xeb78('0x27')]({'where':{'type':_0x9a00b,'resourceId':_0x777ca3['id']}})['then'](function(){return _0x2159c1;});})[_0xeb78('0x2a')](function(){_0x3c8e66['status'](0xcc)[_0xeb78('0x1f')]();});}};}function handleEntityNotFound(_0x23295a,_0x4493bb){return function(_0x5263fc){if(!_0x5263fc){_0x23295a[_0xeb78('0x1d')](0x194);}return _0x5263fc;};}function handleError(_0x1e7d56,_0x1c04dd){_0x1c04dd=_0x1c04dd||0x1f4;return function(_0x381b2f){logger[_0xeb78('0x2b')](_0x381b2f[_0xeb78('0x2c')]);if(_0x381b2f[_0xeb78('0x2d')]){delete _0x381b2f[_0xeb78('0x2d')];}_0x1e7d56[_0xeb78('0x1e')](_0x1c04dd)[_0xeb78('0x2e')](_0x381b2f);};}exports[_0xeb78('0x2f')]=function(_0x505468,_0x555d89){var _0x4d12a3={},_0xb3a935={},_0x4253ea={'count':0x0,'rows':[]};var _0x15327f=_['map'](db[_0xeb78('0x30')][_0xeb78('0x31')],function(_0x3de59f){return{'name':_0x3de59f[_0xeb78('0x32')],'type':_0x3de59f[_0xeb78('0x33')][_0xeb78('0x34')]};});_0xb3a935[_0xeb78('0x35')]=_[_0xeb78('0x36')](_0x15327f,_0xeb78('0x2d'));_0xb3a935['query']=_[_0xeb78('0x37')](_0x505468['query']);_0xb3a935[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0xb3a935[_0xeb78('0x35')],_0xb3a935[_0xeb78('0x3a')]);_0x4d12a3[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0xb3a935['model'],qs['fields'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x4d12a3[_0xeb78('0x3b')]=_0x4d12a3[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x4d12a3['attributes']:_0xb3a935[_0xeb78('0x35')];if(!_0x505468[_0xeb78('0x3a')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x4d12a3[_0xeb78('0x40')]=qs[_0xeb78('0x40')](_0x505468['query']['limit']);_0x4d12a3['offset']=qs['offset'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x20')]);}_0x4d12a3[_0xeb78('0x41')]=qs['sort'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x42')]);_0x4d12a3['where']=qs['filters'](_['pick'](_0x505468[_0xeb78('0x3a')],_0xb3a935[_0xeb78('0x38')]),_0x15327f);if(_0x505468[_0xeb78('0x3a')]['filter']){_0x4d12a3[_0xeb78('0x43')]=_[_0xeb78('0x44')](_0x4d12a3[_0xeb78('0x43')],{'$or':_['map'](_0x15327f,function(_0xf0f13c){if(_0xf0f13c[_0xeb78('0x33')]!==_0xeb78('0x45')){var _0x437590={};_0x437590[_0xf0f13c['name']]={'$like':'%'+_0x505468['query'][_0xeb78('0x46')]+'%'};return _0x437590;}})});}_0x4d12a3=_[_0xeb78('0x44')]({},_0x4d12a3,_0x505468[_0xeb78('0x47')]);var _0x183095={'where':_0x4d12a3[_0xeb78('0x43')]};return db[_0xeb78('0x30')][_0xeb78('0x22')](_0x183095)[_0xeb78('0x2a')](function(_0x47567d){_0x4253ea['count']=_0x47567d;if(_0x505468[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x4d12a3[_0xeb78('0x49')]=[{'all':!![]}];}return db['ContactItemType'][_0xeb78('0x4a')](_0x4d12a3);})['then'](function(_0x21f81b){_0x4253ea[_0xeb78('0x4b')]=_0x21f81b;return _0x4253ea;})[_0xeb78('0x2a')](respondWithFilteredResult(_0x555d89,_0x4d12a3))['catch'](handleError(_0x555d89,null));};exports[_0xeb78('0x4c')]=function(_0x3ab487,_0x390051){var _0x2944d8={'raw':!![],'where':{'id':_0x3ab487['params']['id']}},_0x2dc9f7={};_0x2dc9f7[_0xeb78('0x35')]=_[_0xeb78('0x37')](db['ContactItemType'][_0xeb78('0x31')]);_0x2dc9f7[_0xeb78('0x3a')]=_[_0xeb78('0x37')](_0x3ab487['query']);_0x2dc9f7[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0x2dc9f7[_0xeb78('0x35')],_0x2dc9f7[_0xeb78('0x3a')]);_0x2944d8[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0x2dc9f7['model'],qs['fields'](_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x2944d8['attributes']=_0x2944d8[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x2944d8[_0xeb78('0x3b')]:_0x2dc9f7[_0xeb78('0x35')];if(_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x2944d8[_0xeb78('0x49')]=[{'all':!![]}];}_0x2944d8=_[_0xeb78('0x44')]({},_0x2944d8,_0x3ab487[_0xeb78('0x47')]);return db[_0xeb78('0x30')][_0xeb78('0x4d')](_0x2944d8)[_0xeb78('0x2a')](handleEntityNotFound(_0x390051,null))[_0xeb78('0x2a')](respondWithResult(_0x390051,null))[_0xeb78('0x4e')](handleError(_0x390051,null));};exports[_0xeb78('0x4f')]=function(_0x58e361,_0x2c4616){return db[_0xeb78('0x30')][_0xeb78('0x4f')](_0x58e361[_0xeb78('0x50')],{})['then'](function(_0x35cedb){var _0x135106=_0x58e361[_0xeb78('0x51')][_0xeb78('0x52')]({'plain':!![]});if(!_0x135106)throw new Error(_0xeb78('0x53'));if(_0x135106['role']==='user'){var _0x553f6d=_0x35cedb[_0xeb78('0x52')]({'plain':!![]});var _0x21ee21='ContactItemTypes';return db[_0xeb78('0x54')][_0xeb78('0x4d')]({'where':{'name':_0x21ee21,'userProfileId':_0x135106[_0xeb78('0x55')]},'raw':!![]})['then'](function(_0x4d6a21){if(_0x4d6a21&&_0x4d6a21[_0xeb78('0x56')]===0x0){return db[_0xeb78('0x29')][_0xeb78('0x4f')]({'name':_0x553f6d['name'],'resourceId':_0x553f6d['id'],'type':_0x4d6a21[_0xeb78('0x2d')],'sectionId':_0x4d6a21['id']},{})[_0xeb78('0x2a')](function(){return _0x35cedb;});}else{return _0x35cedb;}})[_0xeb78('0x4e')](function(_0x4a3c91){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a3c91);throw _0x4a3c91;});}return _0x35cedb;})[_0xeb78('0x2a')](respondWithResult(_0x2c4616,0xc9))[_0xeb78('0x4e')](handleError(_0x2c4616,null));};exports['update']=function(_0x2b42f6,_0x31eb10){if(_0x2b42f6[_0xeb78('0x50')]['id']){delete _0x2b42f6['body']['id'];}return db[_0xeb78('0x30')]['find']({'where':{'id':_0x2b42f6[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x31eb10,null))[_0xeb78('0x2a')](saveUpdates(_0x2b42f6['body'],null))['then'](respondWithResult(_0x31eb10,null))['catch'](handleError(_0x31eb10,null));};exports['destroy']=function(_0x3238e9,_0x51f51f){return db[_0xeb78('0x30')][_0xeb78('0x4d')]({'where':{'id':_0x3238e9[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x51f51f,null))[_0xeb78('0x2a')](db[_0xeb78('0x58')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3238e9['params']['id']}}))[_0xeb78('0x2a')](removeEntity(_0x51f51f,null))[_0xeb78('0x4e')](handleError(_0x51f51f,null));}; \ No newline at end of file +var _0xcf2f=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ContactItemType','includeAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x1a85b5,_0x2e86ce){var _0x182ebf=function(_0x240765){while(--_0x240765){_0x1a85b5['push'](_0x1a85b5['shift']());}};_0x182ebf(++_0x2e86ce);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x191885,_0x466446){_0x191885=_0x191885-0x0;var _0x27c790=_0xcf2f[_0x191885];return _0x27c790;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];function respondWithStatusCode(_0x1ba610,_0x175ac9){_0x175ac9=_0x175ac9||0xcc;return function(_0x1be8cc){if(_0x1be8cc){return _0x1ba610['sendStatus'](_0x175ac9);}return _0x1ba610[_0xfcf2('0x19')](_0x175ac9)['end']();};}function respondWithResult(_0x5b414a,_0x5dc04b){_0x5dc04b=_0x5dc04b||0xc8;return function(_0xc87ff4){if(_0xc87ff4){return _0x5b414a['status'](_0x5dc04b)[_0xfcf2('0x1a')](_0xc87ff4);}};}function respondWithFilteredResult(_0x1febf8,_0x245f9a){return function(_0x21f7d1){if(_0x21f7d1){var _0x315b2f=typeof _0x245f9a[_0xfcf2('0x1b')]===_0xfcf2('0x1c')&&typeof _0x245f9a['limit']===_0xfcf2('0x1c');var _0x213125=_0x21f7d1[_0xfcf2('0x1d')];var _0x581d78=_0x315b2f?0x0:_0x245f9a[_0xfcf2('0x1b')];var _0x1b3c89=_0x315b2f?_0x21f7d1[_0xfcf2('0x1d')]:_0x245f9a[_0xfcf2('0x1b')]+_0x245f9a[_0xfcf2('0x1e')];var _0x53c406;if(_0x1b3c89>=_0x213125){_0x1b3c89=_0x213125;_0x53c406=0xc8;}else{_0x53c406=0xce;}_0x1febf8[_0xfcf2('0x19')](_0x53c406);return _0x1febf8[_0xfcf2('0x1f')]('Content-Range',_0x581d78+'-'+_0x1b3c89+'/'+_0x213125)[_0xfcf2('0x1a')](_0x21f7d1);}return null;};}function patchUpdates(_0x23c079){return function(_0x206738){try{jsonpatch[_0xfcf2('0x20')](_0x206738,_0x23c079,!![]);}catch(_0x51e0b7){return BPromise[_0xfcf2('0x21')](_0x51e0b7);}return _0x206738[_0xfcf2('0x22')]();};}function saveUpdates(_0x422c5a,_0x1eeebd){return function(_0x5afab5){if(_0x5afab5){return _0x5afab5[_0xfcf2('0x23')](_0x422c5a)[_0xfcf2('0x24')](function(_0x232f6f){return _0x232f6f;});}return null;};}function removeEntity(_0x584e76,_0x26641a){return function(_0x151aa8){if(_0x151aa8){return _0x151aa8['destroy']()[_0xfcf2('0x24')](function(){var _0xbc8722=_0x151aa8['get']({'plain':!![]});var _0x1e6f14=_0xfcf2('0x25');return db[_0xfcf2('0x26')][_0xfcf2('0x27')]({'where':{'type':_0x1e6f14,'resourceId':_0xbc8722['id']}})['then'](function(){return _0x151aa8;});})[_0xfcf2('0x24')](function(){_0x584e76[_0xfcf2('0x19')](0xcc)[_0xfcf2('0x28')]();});}};}function handleEntityNotFound(_0x3779ee,_0x17c994){return function(_0x2b1d60){if(!_0x2b1d60){_0x3779ee[_0xfcf2('0x29')](0x194);}return _0x2b1d60;};}function handleError(_0x1c8f38,_0x23c09c){_0x23c09c=_0x23c09c||0x1f4;return function(_0x56f839){logger['error'](_0x56f839[_0xfcf2('0x2a')]);if(_0x56f839[_0xfcf2('0x2b')]){delete _0x56f839[_0xfcf2('0x2b')];}_0x1c8f38['status'](_0x23c09c)[_0xfcf2('0x2c')](_0x56f839);};}exports['index']=function(_0x3ce9f8,_0x26651e){var _0x40c1ae={},_0x1a4485={},_0x313884={'count':0x0,'rows':[]};var _0x3760ad=_[_0xfcf2('0x2d')](db['ContactItemType']['rawAttributes'],function(_0xfc3b86){return{'name':_0xfc3b86[_0xfcf2('0x2e')],'type':_0xfc3b86[_0xfcf2('0x2f')][_0xfcf2('0x30')]};});_0x1a4485['model']=_['map'](_0x3760ad,_0xfcf2('0x2b'));_0x1a4485['query']=_[_0xfcf2('0x31')](_0x3ce9f8[_0xfcf2('0x32')]);_0x1a4485['filters']=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],_0x1a4485[_0xfcf2('0x32')]);_0x40c1ae[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x3ce9f8['query'][_0xfcf2('0x36')]));_0x40c1ae[_0xfcf2('0x35')]=_0x40c1ae['attributes'][_0xfcf2('0x37')]?_0x40c1ae[_0xfcf2('0x35')]:_0x1a4485['model'];if(!_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x38')]('nolimit')){_0x40c1ae[_0xfcf2('0x1e')]=qs[_0xfcf2('0x1e')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1e')]);_0x40c1ae['offset']=qs[_0xfcf2('0x1b')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1b')]);}_0x40c1ae[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x3ce9f8['query'][_0xfcf2('0x3a')]);_0x40c1ae[_0xfcf2('0x3b')]=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x3ce9f8[_0xfcf2('0x32')],_0x1a4485['filters']),_0x3760ad);if(_0x3ce9f8[_0xfcf2('0x32')]['filter']){_0x40c1ae[_0xfcf2('0x3b')]=_[_0xfcf2('0x3e')](_0x40c1ae[_0xfcf2('0x3b')],{'$or':_[_0xfcf2('0x2d')](_0x3760ad,function(_0x2fd2ef){if(_0x2fd2ef['type']!==_0xfcf2('0x3f')){var _0x341505={};_0x341505[_0x2fd2ef[_0xfcf2('0x2b')]]={'$like':'%'+_0x3ce9f8['query'][_0xfcf2('0x40')]+'%'};return _0x341505;}})});}_0x40c1ae=_[_0xfcf2('0x3e')]({},_0x40c1ae,_0x3ce9f8[_0xfcf2('0x41')]);var _0x320c19={'where':_0x40c1ae[_0xfcf2('0x3b')]};return db[_0xfcf2('0x42')]['count'](_0x320c19)['then'](function(_0x526c42){_0x313884[_0xfcf2('0x1d')]=_0x526c42;if(_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x43')]){_0x40c1ae['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x40c1ae);})[_0xfcf2('0x24')](function(_0xab0747){_0x313884[_0xfcf2('0x44')]=_0xab0747;return _0x313884;})[_0xfcf2('0x24')](respondWithFilteredResult(_0x26651e,_0x40c1ae))[_0xfcf2('0x45')](handleError(_0x26651e,null));};exports[_0xfcf2('0x46')]=function(_0x2c8ba2,_0x16cc21){var _0x2b790b={'raw':!![],'where':{'id':_0x2c8ba2[_0xfcf2('0x47')]['id']}},_0x467ecd={};_0x467ecd['model']=_['keys'](db[_0xfcf2('0x42')][_0xfcf2('0x48')]);_0x467ecd[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x2c8ba2[_0xfcf2('0x32')]);_0x467ecd[_0xfcf2('0x3c')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],_0x467ecd[_0xfcf2('0x32')]);_0x2b790b[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x2c8ba2[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x2b790b[_0xfcf2('0x35')]=_0x2b790b[_0xfcf2('0x35')]['length']?_0x2b790b[_0xfcf2('0x35')]:_0x467ecd[_0xfcf2('0x34')];if(_0x2c8ba2['query'][_0xfcf2('0x43')]){_0x2b790b['include']=[{'all':!![]}];}_0x2b790b=_[_0xfcf2('0x3e')]({},_0x2b790b,_0x2c8ba2[_0xfcf2('0x41')]);return db[_0xfcf2('0x42')][_0xfcf2('0x49')](_0x2b790b)['then'](handleEntityNotFound(_0x16cc21,null))['then'](respondWithResult(_0x16cc21,null))['catch'](handleError(_0x16cc21,null));};exports[_0xfcf2('0x4a')]=function(_0x37d4bb,_0x20fcab){return db[_0xfcf2('0x42')]['create'](_0x37d4bb[_0xfcf2('0x4b')],{})[_0xfcf2('0x24')](function(_0x3b981c){var _0x548c6c=_0x37d4bb[_0xfcf2('0x4c')][_0xfcf2('0x4d')]({'plain':!![]});if(!_0x548c6c)throw new Error(_0xfcf2('0x4e'));if(_0x548c6c[_0xfcf2('0x4f')]===_0xfcf2('0x4c')){var _0x4af270=_0x3b981c[_0xfcf2('0x4d')]({'plain':!![]});var _0x1260a4=_0xfcf2('0x25');return db[_0xfcf2('0x50')][_0xfcf2('0x49')]({'where':{'name':_0x1260a4,'userProfileId':_0x548c6c[_0xfcf2('0x51')]},'raw':!![]})['then'](function(_0x5d162d){if(_0x5d162d&&_0x5d162d['autoAssociation']===0x0){return db[_0xfcf2('0x26')][_0xfcf2('0x4a')]({'name':_0x4af270['name'],'resourceId':_0x4af270['id'],'type':_0x5d162d['name'],'sectionId':_0x5d162d['id']},{})[_0xfcf2('0x24')](function(){return _0x3b981c;});}else{return _0x3b981c;}})[_0xfcf2('0x45')](function(_0x137a47){logger['error'](_0xfcf2('0x52'),_0x137a47);throw _0x137a47;});}return _0x3b981c;})[_0xfcf2('0x24')](respondWithResult(_0x20fcab,0xc9))['catch'](handleError(_0x20fcab,null));};exports['update']=function(_0xfc4b7b,_0x51f636){if(_0xfc4b7b[_0xfcf2('0x4b')]['id']){delete _0xfc4b7b[_0xfcf2('0x4b')]['id'];}return db['ContactItemType'][_0xfcf2('0x49')]({'where':{'id':_0xfc4b7b['params']['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x51f636,null))['then'](saveUpdates(_0xfc4b7b[_0xfcf2('0x4b')],null))[_0xfcf2('0x24')](respondWithResult(_0x51f636,null))[_0xfcf2('0x45')](handleError(_0x51f636,null));};exports['destroy']=function(_0x235b06,_0x27bae5){return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x235b06[_0xfcf2('0x47')]['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x27bae5,null))[_0xfcf2('0x24')](db['CmContactHasItem'][_0xfcf2('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x235b06[_0xfcf2('0x47')]['id']}}))['then'](removeEntity(_0x27bae5,null))[_0xfcf2('0x45')](handleError(_0x27bae5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index c1d49c6..2eddf0e 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 _0x69cf=['./contactItemType.attributes','exports','define','ContactItemType','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x69cf,0x1d8));var _0xf69c=function(_0x300915,_0x320ae4){_0x300915=_0x300915-0x0;var _0x5887ed=_0x69cf[_0x300915];return _0x5887ed;};'use strict';var _=require(_0xf69c('0x0'));var util=require(_0xf69c('0x1'));var logger=require('../../config/logger')(_0xf69c('0x2'));var moment=require(_0xf69c('0x3'));var BPromise=require(_0xf69c('0x4'));var rp=require(_0xf69c('0x5'));var fs=require('fs');var path=require(_0xf69c('0x6'));var rimraf=require(_0xf69c('0x7'));var config=require(_0xf69c('0x8'));var attributes=require(_0xf69c('0x9'));module[_0xf69c('0xa')]=function(_0x5883b3,_0x5d7eb7){return _0x5883b3[_0xf69c('0xb')](_0xf69c('0xc'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d19=['define','ContactItemType','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x5631dc,_0x34bc60){var _0x564cc4=function(_0x7a4e39){while(--_0x7a4e39){_0x5631dc['push'](_0x5631dc['shift']());}};_0x564cc4(++_0x34bc60);}(_0x0d19,0xc8));var _0x90d1=function(_0x151ae3,_0x3a9195){_0x151ae3=_0x151ae3-0x0;var _0x564680=_0x0d19[_0x151ae3];return _0x564680;};'use strict';var _=require('lodash');var util=require(_0x90d1('0x0'));var logger=require('../../config/logger')(_0x90d1('0x1'));var moment=require('moment');var BPromise=require(_0x90d1('0x2'));var rp=require(_0x90d1('0x3'));var fs=require('fs');var path=require(_0x90d1('0x4'));var rimraf=require(_0x90d1('0x5'));var config=require(_0x90d1('0x6'));var attributes=require(_0x90d1('0x7'));module[_0x90d1('0x8')]=function(_0x2168c9,_0xab4ec2){return _0x2168c9[_0x90d1('0x9')](_0x90d1('0xa'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index bf9d9f0..0059d74 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 _0xd786=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x110108,_0x141dec){var _0x3de16e=function(_0x4d9352){while(--_0x4d9352){_0x110108['push'](_0x110108['shift']());}};_0x3de16e(++_0x141dec);}(_0xd786,0x1dc));var _0x6d78=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xd786[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var moment=require(_0x6d78('0x2'));var BPromise=require(_0x6d78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d78('0x4'));var db=require(_0x6d78('0x5'))['db'];var utils=require(_0x6d78('0x6'));var logger=require(_0x6d78('0x7'))(_0x6d78('0x8'));var config=require(_0x6d78('0x9'));var jayson=require(_0x6d78('0xa'));var client=jayson['client'][_0x6d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30e9e5,_0x5c3f38,_0x44db98){return new BPromise(function(_0x33b85e,_0x10f58a){return client[_0x6d78('0xc')](_0x30e9e5,_0x44db98)['then'](function(_0x3198b6){logger[_0x6d78('0xd')](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');logger[_0x6d78('0xf')](_0x6d78('0x10'),_0x5c3f38,_0x6d78('0x11'),JSON[_0x6d78('0x12')](_0x3198b6));if(_0x3198b6[_0x6d78('0x13')]){if(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x14')]===0x1f4){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x10f58a(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x15')]);}logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x33b85e(_0x3198b6['error'][_0x6d78('0x15')]);}else{logger['info'](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');_0x33b85e(_0x3198b6[_0x6d78('0x16')]['message']);}})[_0x6d78('0x17')](function(_0x378c59){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x378c59);_0x10f58a(_0x378c59);});});} \ No newline at end of file +var _0x9a20=['error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x366ce1,_0x41a82e){var _0x2d6265=function(_0x4e21b7){while(--_0x4e21b7){_0x366ce1['push'](_0x366ce1['shift']());}};_0x2d6265(++_0x41a82e);}(_0x9a20,0x158));var _0x09a2=function(_0x495291,_0x568dad){_0x495291=_0x495291-0x0;var _0x1fef5e=_0x9a20[_0x495291];return _0x1fef5e;};'use strict';var _=require(_0x09a2('0x0'));var util=require(_0x09a2('0x1'));var moment=require(_0x09a2('0x2'));var BPromise=require(_0x09a2('0x3'));var rs=require(_0x09a2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09a2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x09a2('0x6'))('rpc');var config=require(_0x09a2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x09a2('0x8')][_0x09a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b235a,_0x34b4c0,_0x12d8b4){return new BPromise(function(_0x1a553e,_0xaa35b4){return client['request'](_0x4b235a,_0x12d8b4)['then'](function(_0x348b6f){logger[_0x09a2('0xa')](_0x09a2('0xb'),_0x34b4c0,_0x09a2('0xc'));logger[_0x09a2('0xd')](_0x09a2('0xe'),_0x34b4c0,_0x09a2('0xc'),JSON[_0x09a2('0xf')](_0x348b6f));if(_0x348b6f[_0x09a2('0x10')]){if(_0x348b6f[_0x09a2('0x10')][_0x09a2('0x11')]===0x1f4){logger['error'](_0x09a2('0xb'),_0x34b4c0,_0x348b6f[_0x09a2('0x10')][_0x09a2('0x12')]);return _0xaa35b4(_0x348b6f[_0x09a2('0x10')][_0x09a2('0x12')]);}logger[_0x09a2('0x10')](_0x09a2('0xb'),_0x34b4c0,_0x348b6f[_0x09a2('0x10')][_0x09a2('0x12')]);return _0x1a553e(_0x348b6f[_0x09a2('0x10')][_0x09a2('0x12')]);}else{logger[_0x09a2('0xa')]('ContactItemType,\x20%s,\x20%s',_0x34b4c0,_0x09a2('0xc'));_0x1a553e(_0x348b6f[_0x09a2('0x13')]['message']);}})['catch'](function(_0x46f82d){logger[_0x09a2('0x10')](_0x09a2('0xb'),_0x34b4c0,_0x46f82d);_0xaa35b4(_0x46f82d);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6643843..a051be8 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 _0x64ad=['fs-extra','../../components/auth/service','./contactItemType.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x2f35ce,_0x56dd4a){var _0x11bd3e=function(_0x5b4d5a){while(--_0x5b4d5a){_0x2f35ce['push'](_0x2f35ce['shift']());}};_0x11bd3e(++_0x56dd4a);}(_0x64ad,0x176));var _0xd64a=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x64ad[_0x458363];return _0x4d0290;};'use strict';var multer=require('multer');var util=require(_0xd64a('0x0'));var path=require(_0xd64a('0x1'));var timeout=require(_0xd64a('0x2'));var express=require(_0xd64a('0x3'));var router=express['Router']();var fs_extra=require(_0xd64a('0x4'));var auth=require(_0xd64a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd64a('0x6'));router['get']('/',auth[_0xd64a('0x7')](),controller[_0xd64a('0x8')]);router[_0xd64a('0x9')](_0xd64a('0xa'),auth[_0xd64a('0x7')](),controller[_0xd64a('0xb')]);router[_0xd64a('0xc')]('/',auth[_0xd64a('0x7')](),controller[_0xd64a('0xd')]);router[_0xd64a('0xe')](_0xd64a('0xa'),auth[_0xd64a('0x7')](),controller[_0xd64a('0xf')]);router[_0xd64a('0x10')](_0xd64a('0xa'),auth[_0xd64a('0x7')](),controller[_0xd64a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5d70=['index','get','/:id','post','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x23bece,_0x2512f5){var _0x14ec52=function(_0x180755){while(--_0x180755){_0x23bece['push'](_0x23bece['shift']());}};_0x14ec52(++_0x2512f5);}(_0x5d70,0xbb));var _0x05d7=function(_0x16fae7,_0x4cd6b9){_0x16fae7=_0x16fae7-0x0;var _0x48454d=_0x5d70[_0x16fae7];return _0x48454d;};'use strict';var multer=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var path=require(_0x05d7('0x2'));var timeout=require(_0x05d7('0x3'));var express=require(_0x05d7('0x4'));var router=express[_0x05d7('0x5')]();var fs_extra=require(_0x05d7('0x6'));var auth=require(_0x05d7('0x7'));var interaction=require(_0x05d7('0x8'));var config=require(_0x05d7('0x9'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0x05d7('0xa')](),controller[_0x05d7('0xb')]);router[_0x05d7('0xc')](_0x05d7('0xd'),auth[_0x05d7('0xa')](),controller['show']);router[_0x05d7('0xe')]('/',auth[_0x05d7('0xa')](),controller[_0x05d7('0xf')]);router['put'](_0x05d7('0xd'),auth[_0x05d7('0xa')](),controller[_0x05d7('0x10')]);router[_0x05d7('0x11')](_0x05d7('0xd'),auth[_0x05d7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 282ba85..3179cf0 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x30cac2,_0x279f1b){var _0x1c8eef=function(_0x52e470){while(--_0x52e470){_0x30cac2['push'](_0x30cac2['shift']());}};_0x1c8eef(++_0x279f1b);}(_0x757a,0xde));var _0xa757=function(_0x51d147,_0x10b23d){_0x51d147=_0x51d147-0x0;var _0x282973=_0x757a[_0x51d147];return _0x282973;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x19d810,_0x2a14c3){var _0x45e664=function(_0x34ba40){while(--_0x34ba40){_0x19d810['push'](_0x19d810['shift']());}};_0x45e664(++_0x2a14c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0xb10b[_0x5d9867];return _0x7d2118;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d534661..df1c8c4 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 _0x4ef8=['clock','attrHourFormat','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','Dashboard','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','user','CustomDashboards','update','attrUrl','attrs','value','https://','custom','attrPath'];(function(_0x76d145,_0x334088){var _0x1b541b=function(_0x596ee1){while(--_0x596ee1){_0x76d145['push'](_0x76d145['shift']());}};_0x1b541b(++_0x334088);}(_0x4ef8,0x18a));var _0x84ef=function(_0x5d3bac,_0x2eb657){_0x5d3bac=_0x5d3bac-0x0;var _0x2c8242=_0x4ef8[_0x5d3bac];return _0x2c8242;};'use strict';var emlformat=require(_0x84ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84ef('0x1'));var jsonpatch=require(_0x84ef('0x2'));var rp=require('request-promise');var moment=require(_0x84ef('0x3'));var BPromise=require(_0x84ef('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x84ef('0x5'));var sox=require('sox');var csv=require(_0x84ef('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84ef('0x7'));var _=require(_0x84ef('0x8'));var squel=require('squel');var crypto=require(_0x84ef('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x84ef('0xa'));var toCsv=require('to-csv');var querystring=require(_0x84ef('0xb'));var Papa=require(_0x84ef('0xc'));var Redis=require(_0x84ef('0xd'));var authService=require(_0x84ef('0xe'));var qs=require(_0x84ef('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84ef('0x10'));var logger=require(_0x84ef('0x11'))('api');var utils=require(_0x84ef('0x12'));var config=require(_0x84ef('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x84ef('0x14'))['db'];config[_0x84ef('0x15')]=_['defaults'](config[_0x84ef('0x15')],{'host':_0x84ef('0x16'),'port':0x18eb});var socket=require(_0x84ef('0x17'))(new Redis(config[_0x84ef('0x15')]));require(_0x84ef('0x18'))[_0x84ef('0x19')](socket);function respondWithStatusCode(_0x470387,_0x1b296d){_0x1b296d=_0x1b296d||0xcc;return function(_0x3689a7){if(_0x3689a7){return _0x470387['sendStatus'](_0x1b296d);}return _0x470387[_0x84ef('0x1a')](_0x1b296d)[_0x84ef('0x1b')]();};}function respondWithResult(_0xbee217,_0x44e126){_0x44e126=_0x44e126||0xc8;return function(_0x20afff){if(_0x20afff){return _0xbee217[_0x84ef('0x1a')](_0x44e126)[_0x84ef('0x1c')](_0x20afff);}};}function respondWithFilteredResult(_0x566b0b,_0x37db65){return function(_0x35942f){if(_0x35942f){var _0x252114=typeof _0x37db65[_0x84ef('0x1d')]===_0x84ef('0x1e')&&typeof _0x37db65['limit']===_0x84ef('0x1e');var _0x2112ca=_0x35942f[_0x84ef('0x1f')];var _0x191192=_0x252114?0x0:_0x37db65[_0x84ef('0x1d')];var _0x3f5ecc=_0x252114?_0x35942f['count']:_0x37db65['offset']+_0x37db65['limit'];var _0x20232f;if(_0x3f5ecc>=_0x2112ca){_0x3f5ecc=_0x2112ca;_0x20232f=0xc8;}else{_0x20232f=0xce;}_0x566b0b[_0x84ef('0x1a')](_0x20232f);return _0x566b0b['set'](_0x84ef('0x20'),_0x191192+'-'+_0x3f5ecc+'/'+_0x2112ca)[_0x84ef('0x1c')](_0x35942f);}return null;};}function patchUpdates(_0x169547){return function(_0xaff6c5){try{jsonpatch['apply'](_0xaff6c5,_0x169547,!![]);}catch(_0x5dc379){return BPromise[_0x84ef('0x21')](_0x5dc379);}return _0xaff6c5[_0x84ef('0x22')]();};}function saveUpdates(_0x351b25,_0x56de68){return function(_0x5acf04){if(_0x5acf04){return _0x5acf04['update'](_0x351b25)[_0x84ef('0x23')](function(_0x48b8ff){return _0x48b8ff;});}return null;};}function removeEntity(_0x2a580e,_0x2c54ec){return function(_0x4965d0){if(_0x4965d0){return _0x4965d0[_0x84ef('0x24')]()['then'](function(){var _0x5a3e2f=_0x4965d0[_0x84ef('0x25')]({'plain':!![]});var _0x17e3ed='CustomDashboards';return db[_0x84ef('0x26')]['destroy']({'where':{'type':_0x17e3ed,'resourceId':_0x5a3e2f['id']}})['then'](function(){return _0x4965d0;});})[_0x84ef('0x23')](function(){_0x2a580e[_0x84ef('0x1a')](0xcc)[_0x84ef('0x1b')]();});}};}function handleEntityNotFound(_0x228418,_0xbe7b39){return function(_0x26f7f4){if(!_0x26f7f4){_0x228418['sendStatus'](0x194);}return _0x26f7f4;};}function handleError(_0x17a847,_0x5d7f4c){_0x5d7f4c=_0x5d7f4c||0x1f4;return function(_0x25ef9c){logger[_0x84ef('0x27')](_0x25ef9c[_0x84ef('0x28')]);if(_0x25ef9c[_0x84ef('0x29')]){delete _0x25ef9c['name'];}_0x17a847[_0x84ef('0x1a')](_0x5d7f4c)['send'](_0x25ef9c);};}exports[_0x84ef('0x2a')]=function(_0x58dee7,_0x24ce5f){var _0x52060f={},_0x16701f={},_0x5a5960={'count':0x0,'rows':[]};var _0x352dac=_[_0x84ef('0x2b')](db['Dashboard'][_0x84ef('0x2c')],function(_0xb45098){return{'name':_0xb45098[_0x84ef('0x2d')],'type':_0xb45098[_0x84ef('0x2e')]['key']};});_0x16701f[_0x84ef('0x2f')]=_['map'](_0x352dac,_0x84ef('0x29'));_0x16701f['query']=_[_0x84ef('0x30')](_0x58dee7[_0x84ef('0x31')]);_0x16701f[_0x84ef('0x32')]=_[_0x84ef('0x33')](_0x16701f[_0x84ef('0x2f')],_0x16701f[_0x84ef('0x31')]);_0x52060f[_0x84ef('0x34')]=_['intersection'](_0x16701f[_0x84ef('0x2f')],qs[_0x84ef('0x35')](_0x58dee7[_0x84ef('0x31')][_0x84ef('0x35')]));_0x52060f[_0x84ef('0x34')]=_0x52060f['attributes'][_0x84ef('0x36')]?_0x52060f[_0x84ef('0x34')]:_0x16701f['model'];if(!_0x58dee7[_0x84ef('0x31')][_0x84ef('0x37')]('nolimit')){_0x52060f[_0x84ef('0x38')]=qs[_0x84ef('0x38')](_0x58dee7[_0x84ef('0x31')][_0x84ef('0x38')]);_0x52060f[_0x84ef('0x1d')]=qs[_0x84ef('0x1d')](_0x58dee7[_0x84ef('0x31')]['offset']);}_0x52060f[_0x84ef('0x39')]=qs[_0x84ef('0x3a')](_0x58dee7[_0x84ef('0x31')][_0x84ef('0x3a')]);_0x52060f[_0x84ef('0x3b')]=qs[_0x84ef('0x32')](_[_0x84ef('0x3c')](_0x58dee7[_0x84ef('0x31')],_0x16701f['filters']),_0x352dac);if(_0x58dee7[_0x84ef('0x31')][_0x84ef('0x3d')]){_0x52060f[_0x84ef('0x3b')]=_[_0x84ef('0x3e')](_0x52060f[_0x84ef('0x3b')],{'$or':_[_0x84ef('0x2b')](_0x352dac,function(_0x56c7e1){if(_0x56c7e1[_0x84ef('0x2e')]!==_0x84ef('0x3f')){var _0x109c35={};_0x109c35[_0x56c7e1['name']]={'$like':'%'+_0x58dee7[_0x84ef('0x31')][_0x84ef('0x3d')]+'%'};return _0x109c35;}})});}_0x52060f=_[_0x84ef('0x3e')]({},_0x52060f,_0x58dee7[_0x84ef('0x40')]);var _0x444cf6={'where':_0x52060f[_0x84ef('0x3b')]};return db['Dashboard']['count'](_0x444cf6)[_0x84ef('0x23')](function(_0x5a7561){_0x5a5960[_0x84ef('0x1f')]=_0x5a7561;if(_0x58dee7[_0x84ef('0x31')][_0x84ef('0x41')]){_0x52060f['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x52060f);})['then'](function(_0x4d2d8d){_0x5a5960[_0x84ef('0x42')]=_0x4d2d8d;return _0x5a5960;})[_0x84ef('0x23')](respondWithFilteredResult(_0x24ce5f,_0x52060f))[_0x84ef('0x43')](handleError(_0x24ce5f,null));};exports[_0x84ef('0x44')]=function(_0x5cf36f,_0x436726){var _0x178351={'raw':![],'where':{'id':_0x5cf36f[_0x84ef('0x45')]['id']}},_0x2bd4f3={};_0x2bd4f3['model']=_['keys'](db['Dashboard'][_0x84ef('0x2c')]);_0x2bd4f3[_0x84ef('0x31')]=_[_0x84ef('0x30')](_0x5cf36f[_0x84ef('0x31')]);_0x2bd4f3['filters']=_[_0x84ef('0x33')](_0x2bd4f3[_0x84ef('0x2f')],_0x2bd4f3[_0x84ef('0x31')]);_0x178351[_0x84ef('0x34')]=_[_0x84ef('0x33')](_0x2bd4f3[_0x84ef('0x2f')],qs[_0x84ef('0x35')](_0x5cf36f[_0x84ef('0x31')][_0x84ef('0x35')]));_0x178351[_0x84ef('0x34')]=_0x178351[_0x84ef('0x34')]['length']?_0x178351[_0x84ef('0x34')]:_0x2bd4f3['model'];if(_0x5cf36f['query'][_0x84ef('0x41')]){_0x178351['include']=[{'all':!![]}];}_0x178351=_[_0x84ef('0x3e')]({},_0x178351,_0x5cf36f[_0x84ef('0x40')]);return db['Dashboard'][_0x84ef('0x46')](_0x178351)['then'](handleEntityNotFound(_0x436726,null))[_0x84ef('0x23')](respondWithResult(_0x436726,null))[_0x84ef('0x43')](handleError(_0x436726,null));};exports[_0x84ef('0x47')]=function(_0x2ef82f,_0x4ac6eb){return db[_0x84ef('0x48')][_0x84ef('0x47')](_0x2ef82f[_0x84ef('0x49')],{})[_0x84ef('0x23')](function(_0x2239a4){var _0x134ae8=_0x2ef82f['user'][_0x84ef('0x25')]({'plain':!![]});if(!_0x134ae8)throw new Error(_0x84ef('0x4a'));if(_0x134ae8[_0x84ef('0x4b')]==='user'){var _0x4e7459=_0x2239a4[_0x84ef('0x25')]({'plain':!![]});var _0x3596dc='CustomDashboards';return db[_0x84ef('0x4c')]['find']({'where':{'name':_0x3596dc,'userProfileId':_0x134ae8[_0x84ef('0x4d')]},'raw':!![]})['then'](function(_0x5aa457){if(_0x5aa457&&_0x5aa457[_0x84ef('0x4e')]===0x0){return db['UserProfileResource'][_0x84ef('0x47')]({'name':_0x4e7459[_0x84ef('0x29')],'resourceId':_0x4e7459['id'],'type':_0x5aa457[_0x84ef('0x29')],'sectionId':_0x5aa457['id']},{})[_0x84ef('0x23')](function(){return _0x2239a4;});}else{return _0x2239a4;}})[_0x84ef('0x43')](function(_0x15dddb){logger[_0x84ef('0x27')](_0x84ef('0x4f'),_0x15dddb);throw _0x15dddb;});}return _0x2239a4;})[_0x84ef('0x23')](respondWithResult(_0x4ac6eb,0xc9))[_0x84ef('0x43')](handleError(_0x4ac6eb,null));};exports[_0x84ef('0x50')]=function(_0x1cefd4,_0x52d7ae){var _0x18c99d={'where':{'id':_0x1cefd4[_0x84ef('0x45')]['id']}},_0x14f325={};_0x14f325['model']=_[_0x84ef('0x30')](db[_0x84ef('0x48')][_0x84ef('0x2c')]);_0x18c99d[_0x84ef('0x34')]=_[_0x84ef('0x33')](_0x14f325[_0x84ef('0x2f')],qs['fields'](_0x1cefd4[_0x84ef('0x31')][_0x84ef('0x35')]));_0x18c99d[_0x84ef('0x34')]=_0x18c99d[_0x84ef('0x34')][_0x84ef('0x36')]?_0x18c99d['attributes']:_0x14f325['model'];if(_0x1cefd4['query'][_0x84ef('0x41')]){_0x18c99d[_0x84ef('0x51')]=[{'all':!![]}];}_0x18c99d=_[_0x84ef('0x3e')]({},_0x18c99d,_0x1cefd4[_0x84ef('0x40')]);return db[_0x84ef('0x48')][_0x84ef('0x46')](_0x18c99d)[_0x84ef('0x23')](handleEntityNotFound(_0x52d7ae,null))[_0x84ef('0x23')](function(_0x58a7b9){if(_0x58a7b9){var _0x51df03=_0x58a7b9['get']({'plain':!![]});_0x51df03=qs[_0x84ef('0x52')](_0x51df03,['id',_0x84ef('0x53'),_0x84ef('0x54')]);_0x1cefd4['body']=_['omit'](_0x1cefd4[_0x84ef('0x49')],['id','createdAt','updatedAt']);return db[_0x84ef('0x48')][_0x84ef('0x47')](_[_0x84ef('0x3e')](_0x51df03,_0x1cefd4[_0x84ef('0x49')]),{'include':_0x1cefd4['query'][_0x84ef('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0xc05426){var _0x960fc8=_0x1cefd4[_0x84ef('0x55')][_0x84ef('0x25')]({'plain':!![]});if(!_0x960fc8)throw new Error(_0x84ef('0x4a'));if(_0x960fc8['role']===_0x84ef('0x55')){var _0x512750=_0xc05426['get']({'plain':!![]});var _0x24b58c=_0x84ef('0x56');return db[_0x84ef('0x4c')][_0x84ef('0x46')]({'where':{'name':_0x24b58c,'userProfileId':_0x960fc8['userProfileId']},'raw':!![]})[_0x84ef('0x23')](function(_0x523d95){if(_0x523d95&&_0x523d95[_0x84ef('0x4e')]===0x0){return db[_0x84ef('0x26')][_0x84ef('0x47')]({'name':_0x512750[_0x84ef('0x29')],'resourceId':_0x512750['id'],'type':_0x523d95[_0x84ef('0x29')],'sectionId':_0x523d95['id']},{})[_0x84ef('0x23')](function(){return _0xc05426;});}else{return _0xc05426;}})[_0x84ef('0x43')](function(_0x4627c0){logger[_0x84ef('0x27')](_0x84ef('0x4f'),_0x4627c0);throw _0x4627c0;});}return _0xc05426;});}})['then'](respondWithResult(_0x52d7ae,0xc9))[_0x84ef('0x43')](handleError(_0x52d7ae,null));};exports[_0x84ef('0x57')]=function(_0x15ddfb,_0x38ad98){if(_0x15ddfb['body']['id']){delete _0x15ddfb[_0x84ef('0x49')]['id'];}return db[_0x84ef('0x48')][_0x84ef('0x46')]({'where':{'id':_0x15ddfb[_0x84ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x38ad98,null))['then'](saveUpdates(_0x15ddfb['body'],null))['then'](respondWithResult(_0x38ad98,null))['catch'](handleError(_0x38ad98,null));};exports[_0x84ef('0x24')]=function(_0x29ae4f,_0x403e51){return db['Dashboard']['find']({'where':{'id':_0x29ae4f[_0x84ef('0x45')]['id']}})[_0x84ef('0x23')](handleEntityNotFound(_0x403e51,null))[_0x84ef('0x23')](removeEntity(_0x403e51,null))['catch'](handleError(_0x403e51,null));};function widgetAttributes(_0x2a7019){try{switch(_0x2a7019[_0x84ef('0x2e')]){case'iframe':return[{'name':_0x84ef('0x58'),'value':_0x2a7019['attrUrl']||(_0x2a7019['attrs']&&_0x2a7019['attrs'][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||_0x84ef('0x5b')}];case _0x84ef('0x5c'):return[{'name':_0x84ef('0x5d'),'value':_0x2a7019['attrPath']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||''}];case _0x84ef('0x5e'):return[{'name':'attrHourFormat','value':_0x2a7019[_0x84ef('0x5f')]||(_0x2a7019['attrs']&&_0x2a7019['attrs'][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2a7019['attrTimezone']||(_0x2a7019['attrs']&&_0x2a7019['attrs'][0x1]?_0x2a7019['attrs'][0x1][_0x84ef('0x5a')]:undefined)||'0.00'},{'name':_0x84ef('0x60'),'value':_0x2a7019['attrFontSize']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x2]?_0x2a7019[_0x84ef('0x59')][0x2][_0x84ef('0x5a')]:undefined)||0xc}];case _0x84ef('0x61'):return[{'name':'attrMetric','value':_0x2a7019[_0x84ef('0x62')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||_0x84ef('0x63')},{'name':'attrVoiceQueues','value':_0x2a7019[_0x84ef('0x64')]||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x1]?_0x2a7019[_0x84ef('0x59')][0x1][_0x84ef('0x5a')]:undefined)||[]},{'name':_0x84ef('0x60'),'value':_0x2a7019[_0x84ef('0x60')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x2]?_0x2a7019[_0x84ef('0x59')][0x2][_0x84ef('0x5a')]:undefined)||0x14},{'name':_0x84ef('0x65'),'value':_0x2a7019[_0x84ef('0x65')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x3]?_0x2a7019['attrs'][0x3][_0x84ef('0x5a')]:undefined)||_0x84ef('0x66')},{'name':_0x84ef('0x67'),'value':_0x2a7019[_0x84ef('0x67')]||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x4]?_0x2a7019[_0x84ef('0x59')][0x4][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x68'),'value':_0x2a7019[_0x84ef('0x68')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x5]?_0x2a7019[_0x84ef('0x59')][0x5][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x69'),'value':_0x2a7019[_0x84ef('0x69')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x6]?_0x2a7019[_0x84ef('0x59')][0x6][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6a'),'value':_0x2a7019[_0x84ef('0x6a')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x7]?_0x2a7019[_0x84ef('0x59')][0x7][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6b'),'value':_0x2a7019[_0x84ef('0x6b')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019['attrs'][0x8]?_0x2a7019[_0x84ef('0x59')][0x8]['value']:undefined)||''},{'name':_0x84ef('0x6c'),'value':_0x2a7019[_0x84ef('0x6c')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x9]?_0x2a7019[_0x84ef('0x59')][0x9][_0x84ef('0x5a')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x84ef('0x6d'),'value':_0x2a7019['attrSerie1']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||'total'},{'name':_0x84ef('0x6e'),'value':_0x2a7019[_0x84ef('0x6e')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019['attrs'][0x1]?_0x2a7019[_0x84ef('0x59')][0x1][_0x84ef('0x5a')]:undefined)||null},{'name':'attrSerie3','value':_0x2a7019[_0x84ef('0x6f')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x2]?_0x2a7019['attrs'][0x2][_0x84ef('0x5a')]:undefined)||null},{'name':_0x84ef('0x64'),'value':_0x2a7019[_0x84ef('0x64')]||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x3]?_0x2a7019[_0x84ef('0x59')][0x3][_0x84ef('0x5a')]:undefined)||[]},{'name':_0x84ef('0x65'),'value':_0x2a7019[_0x84ef('0x65')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x4]?_0x2a7019[_0x84ef('0x59')][0x4][_0x84ef('0x5a')]:undefined)||_0x84ef('0x66')},{'name':_0x84ef('0x67'),'value':_0x2a7019[_0x84ef('0x67')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019['attrs'][0x5]?_0x2a7019['attrs'][0x5][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x68'),'value':_0x2a7019[_0x84ef('0x68')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x6]?_0x2a7019[_0x84ef('0x59')][0x6][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x69'),'value':_0x2a7019[_0x84ef('0x69')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x7]?_0x2a7019[_0x84ef('0x59')][0x7][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6a'),'value':_0x2a7019['attrOpenchannelAccounts']||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x8]?_0x2a7019[_0x84ef('0x59')][0x8][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6b'),'value':_0x2a7019[_0x84ef('0x6b')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x9]?_0x2a7019[_0x84ef('0x59')][0x9][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6c'),'value':_0x2a7019['attrChatWebsites']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0xa]?_0x2a7019[_0x84ef('0x59')][0xa]['value']:undefined)||''}];case _0x84ef('0x70'):return[{'name':_0x84ef('0x71'),'type':_0x2a7019['reportType']||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019['attrs'][0x0][_0x84ef('0x2e')]:undefined)||null,'value':_0x2a7019[_0x84ef('0x71')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||null},{'name':_0x84ef('0x72'),'value':_0x2a7019['attrRefresh']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x1]?_0x2a7019[_0x84ef('0x59')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x30b54d){logger[_0x84ef('0x27')]('widgetAttributes:\x20%s',JSON[_0x84ef('0x73')](_0x30b54d));return[];}}exports[_0x84ef('0x74')]=function(_0x596fc2,_0x314bbf,_0x567d45){if(_0x596fc2[_0x84ef('0x49')]['id']){delete _0x596fc2[_0x84ef('0x49')]['id'];}return db[_0x84ef('0x48')][_0x84ef('0x46')]({'where':{'id':_0x596fc2['params']['id']}})['then'](handleEntityNotFound(_0x314bbf,null))['then'](function(_0x26d54e){if(_0x26d54e){_0x596fc2[_0x84ef('0x49')][_0x84ef('0x75')]=_0x26d54e['id'];_0x596fc2[_0x84ef('0x49')][_0x84ef('0x59')]=widgetAttributes(_0x596fc2[_0x84ef('0x49')]);return db[_0x84ef('0x76')][_0x84ef('0x47')](_0x596fc2[_0x84ef('0x49')]);}})[_0x84ef('0x23')](respondWithResult(_0x314bbf,null))[_0x84ef('0x43')](handleError(_0x314bbf,null));};exports[_0x84ef('0x77')]=function(_0x1c33f1,_0x33880c,_0x264282){var _0x32842f={};var _0x1a0a82={};var _0x2f008a;var _0x23e7cf;return db[_0x84ef('0x48')][_0x84ef('0x78')]({'where':{'id':_0x1c33f1[_0x84ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x33880c,null))['then'](function(_0x1af373){if(_0x1af373){_0x2f008a=_0x1af373;_0x1a0a82['model']=_[_0x84ef('0x30')](db[_0x84ef('0x76')][_0x84ef('0x2c')]);_0x1a0a82[_0x84ef('0x31')]=_[_0x84ef('0x30')](_0x1c33f1[_0x84ef('0x31')]);_0x1a0a82[_0x84ef('0x32')]=_['intersection'](_0x1a0a82[_0x84ef('0x2f')],_0x1a0a82[_0x84ef('0x31')]);_0x32842f[_0x84ef('0x34')]=_[_0x84ef('0x33')](_0x1a0a82['model'],qs[_0x84ef('0x35')](_0x1c33f1[_0x84ef('0x31')][_0x84ef('0x35')]));_0x32842f[_0x84ef('0x34')]=_0x32842f[_0x84ef('0x34')][_0x84ef('0x36')]?_0x32842f[_0x84ef('0x34')]:_0x1a0a82[_0x84ef('0x2f')];_0x32842f[_0x84ef('0x39')]=qs[_0x84ef('0x3a')](_0x1c33f1[_0x84ef('0x31')][_0x84ef('0x3a')]);_0x32842f[_0x84ef('0x3b')]=qs[_0x84ef('0x32')](_[_0x84ef('0x3c')](_0x1c33f1[_0x84ef('0x31')],_0x1a0a82[_0x84ef('0x32')]));if(_0x1c33f1[_0x84ef('0x31')][_0x84ef('0x3d')]){_0x32842f[_0x84ef('0x3b')]=_[_0x84ef('0x3e')](_0x32842f['where'],{'$or':_[_0x84ef('0x2b')](_0x32842f[_0x84ef('0x34')],function(_0x49640){var _0x334bf1={};_0x334bf1[_0x49640]={'$like':'%'+_0x1c33f1[_0x84ef('0x31')]['filter']+'%'};return _0x334bf1;})});}_0x32842f=_[_0x84ef('0x3e')]({},_0x32842f,_0x1c33f1[_0x84ef('0x40')]);return _0x2f008a[_0x84ef('0x77')](_0x32842f);}})[_0x84ef('0x23')](function(_0x1480b2){if(_0x1480b2){_0x23e7cf=_0x1480b2[_0x84ef('0x36')];if(!_0x1c33f1[_0x84ef('0x31')][_0x84ef('0x37')](_0x84ef('0x79'))){_0x32842f[_0x84ef('0x38')]=qs[_0x84ef('0x38')](_0x1c33f1['query'][_0x84ef('0x38')]);_0x32842f[_0x84ef('0x1d')]=qs[_0x84ef('0x1d')](_0x1c33f1['query'][_0x84ef('0x1d')]);}return _0x2f008a[_0x84ef('0x77')](_0x32842f);}})[_0x84ef('0x23')](function(_0x28d678){if(_0x28d678){return _0x28d678?{'count':_0x23e7cf,'rows':_0x28d678}:null;}})['then'](respondWithResult(_0x33880c,null))[_0x84ef('0x43')](handleError(_0x33880c,null));}; \ No newline at end of file +var _0x01d0=['attrs','value','custom','attrPath','clock','attrHourFormat','0.00','attrFontSize','counter','attrMetric','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','DashboardItem','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./dashboard.socket','register','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','get','CustomDashboards','then','sendStatus','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','type','iframe','attrUrl'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x01d0,0x19f));var _0x001d=function(_0x7e800d,_0x5bef20){_0x7e800d=_0x7e800d-0x0;var _0x35799e=_0x01d0[_0x7e800d];return _0x35799e;};'use strict';var emlformat=require(_0x001d('0x0'));var rimraf=require(_0x001d('0x1'));var zipdir=require(_0x001d('0x2'));var jsonpatch=require(_0x001d('0x3'));var rp=require(_0x001d('0x4'));var moment=require(_0x001d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x001d('0x6'));var sox=require(_0x001d('0x7'));var csv=require(_0x001d('0x8'));var ejs=require(_0x001d('0x9'));var fs=require('fs');var fs_extra=require(_0x001d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x001d('0xb'));var jsforce=require(_0x001d('0xc'));var deskjs=require(_0x001d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x001d('0xe'));var Papa=require(_0x001d('0xf'));var Redis=require(_0x001d('0x10'));var authService=require(_0x001d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x001d('0x12'))(_0x001d('0x13'));var utils=require(_0x001d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x001d('0x15'));var db=require(_0x001d('0x16'))['db'];config[_0x001d('0x17')]=_[_0x001d('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x001d('0x19'))[_0x001d('0x1a')](socket);function respondWithStatusCode(_0x131ff1,_0x3659fe){_0x3659fe=_0x3659fe||0xcc;return function(_0x5617cb){if(_0x5617cb){return _0x131ff1['sendStatus'](_0x3659fe);}return _0x131ff1[_0x001d('0x1b')](_0x3659fe)['end']();};}function respondWithResult(_0x3a52e1,_0xa6e8ef){_0xa6e8ef=_0xa6e8ef||0xc8;return function(_0x25b78a){if(_0x25b78a){return _0x3a52e1[_0x001d('0x1b')](_0xa6e8ef)[_0x001d('0x1c')](_0x25b78a);}};}function respondWithFilteredResult(_0x5f32a4,_0x1d05d1){return function(_0x345094){if(_0x345094){var _0x2522a1=typeof _0x1d05d1[_0x001d('0x1d')]==='undefined'&&typeof _0x1d05d1[_0x001d('0x1e')]===_0x001d('0x1f');var _0x5c8062=_0x345094[_0x001d('0x20')];var _0x3e6220=_0x2522a1?0x0:_0x1d05d1[_0x001d('0x1d')];var _0xb1a1b4=_0x2522a1?_0x345094[_0x001d('0x20')]:_0x1d05d1[_0x001d('0x1d')]+_0x1d05d1[_0x001d('0x1e')];var _0x34fee8;if(_0xb1a1b4>=_0x5c8062){_0xb1a1b4=_0x5c8062;_0x34fee8=0xc8;}else{_0x34fee8=0xce;}_0x5f32a4[_0x001d('0x1b')](_0x34fee8);return _0x5f32a4[_0x001d('0x21')]('Content-Range',_0x3e6220+'-'+_0xb1a1b4+'/'+_0x5c8062)[_0x001d('0x1c')](_0x345094);}return null;};}function patchUpdates(_0x57c021){return function(_0x2a737d){try{jsonpatch[_0x001d('0x22')](_0x2a737d,_0x57c021,!![]);}catch(_0xcf58c4){return BPromise[_0x001d('0x23')](_0xcf58c4);}return _0x2a737d[_0x001d('0x24')]();};}function saveUpdates(_0xce2444,_0x5274c0){return function(_0x567e7e){if(_0x567e7e){return _0x567e7e[_0x001d('0x25')](_0xce2444)['then'](function(_0x4c33b6){return _0x4c33b6;});}return null;};}function removeEntity(_0x4cb8af,_0x246288){return function(_0x32eb47){if(_0x32eb47){return _0x32eb47[_0x001d('0x26')]()['then'](function(){var _0x3f344d=_0x32eb47[_0x001d('0x27')]({'plain':!![]});var _0x224a94=_0x001d('0x28');return db['UserProfileResource'][_0x001d('0x26')]({'where':{'type':_0x224a94,'resourceId':_0x3f344d['id']}})[_0x001d('0x29')](function(){return _0x32eb47;});})[_0x001d('0x29')](function(){_0x4cb8af[_0x001d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f20c3,_0x359526){return function(_0x4cb460){if(!_0x4cb460){_0x1f20c3[_0x001d('0x2a')](0x194);}return _0x4cb460;};}function handleError(_0x491588,_0x3c1b78){_0x3c1b78=_0x3c1b78||0x1f4;return function(_0x54a32f){logger[_0x001d('0x2b')](_0x54a32f[_0x001d('0x2c')]);if(_0x54a32f[_0x001d('0x2d')]){delete _0x54a32f[_0x001d('0x2d')];}_0x491588[_0x001d('0x1b')](_0x3c1b78)[_0x001d('0x2e')](_0x54a32f);};}exports['index']=function(_0x8b0ba1,_0x12c14c){var _0x7263e7={},_0xde5595={},_0x1b7e3d={'count':0x0,'rows':[]};var _0x533ede=_[_0x001d('0x2f')](db[_0x001d('0x30')][_0x001d('0x31')],function(_0x4b886d){return{'name':_0x4b886d[_0x001d('0x32')],'type':_0x4b886d['type'][_0x001d('0x33')]};});_0xde5595[_0x001d('0x34')]=_[_0x001d('0x2f')](_0x533ede,'name');_0xde5595[_0x001d('0x35')]=_[_0x001d('0x36')](_0x8b0ba1[_0x001d('0x35')]);_0xde5595[_0x001d('0x37')]=_[_0x001d('0x38')](_0xde5595[_0x001d('0x34')],_0xde5595[_0x001d('0x35')]);_0x7263e7['attributes']=_['intersection'](_0xde5595[_0x001d('0x34')],qs['fields'](_0x8b0ba1[_0x001d('0x35')][_0x001d('0x39')]));_0x7263e7[_0x001d('0x3a')]=_0x7263e7[_0x001d('0x3a')][_0x001d('0x3b')]?_0x7263e7['attributes']:_0xde5595[_0x001d('0x34')];if(!_0x8b0ba1[_0x001d('0x35')]['hasOwnProperty'](_0x001d('0x3c'))){_0x7263e7[_0x001d('0x1e')]=qs['limit'](_0x8b0ba1[_0x001d('0x35')][_0x001d('0x1e')]);_0x7263e7['offset']=qs['offset'](_0x8b0ba1[_0x001d('0x35')]['offset']);}_0x7263e7[_0x001d('0x3d')]=qs['sort'](_0x8b0ba1[_0x001d('0x35')]['sort']);_0x7263e7[_0x001d('0x3e')]=qs[_0x001d('0x37')](_[_0x001d('0x3f')](_0x8b0ba1[_0x001d('0x35')],_0xde5595[_0x001d('0x37')]),_0x533ede);if(_0x8b0ba1[_0x001d('0x35')][_0x001d('0x40')]){_0x7263e7[_0x001d('0x3e')]=_[_0x001d('0x41')](_0x7263e7[_0x001d('0x3e')],{'$or':_[_0x001d('0x2f')](_0x533ede,function(_0x4e82d0){if(_0x4e82d0['type']!==_0x001d('0x42')){var _0x4073d2={};_0x4073d2[_0x4e82d0[_0x001d('0x2d')]]={'$like':'%'+_0x8b0ba1[_0x001d('0x35')][_0x001d('0x40')]+'%'};return _0x4073d2;}})});}_0x7263e7=_[_0x001d('0x41')]({},_0x7263e7,_0x8b0ba1['options']);var _0x55a208={'where':_0x7263e7[_0x001d('0x3e')]};return db[_0x001d('0x30')][_0x001d('0x20')](_0x55a208)[_0x001d('0x29')](function(_0x2fe4ee){_0x1b7e3d['count']=_0x2fe4ee;if(_0x8b0ba1[_0x001d('0x35')][_0x001d('0x43')]){_0x7263e7[_0x001d('0x44')]=[{'all':!![]}];}return db['Dashboard'][_0x001d('0x45')](_0x7263e7);})[_0x001d('0x29')](function(_0x58192b){_0x1b7e3d[_0x001d('0x46')]=_0x58192b;return _0x1b7e3d;})['then'](respondWithFilteredResult(_0x12c14c,_0x7263e7))[_0x001d('0x47')](handleError(_0x12c14c,null));};exports[_0x001d('0x48')]=function(_0x2b686e,_0x3298ee){var _0x21012c={'raw':![],'where':{'id':_0x2b686e[_0x001d('0x49')]['id']}},_0x2cf60a={};_0x2cf60a[_0x001d('0x34')]=_['keys'](db[_0x001d('0x30')][_0x001d('0x31')]);_0x2cf60a[_0x001d('0x35')]=_[_0x001d('0x36')](_0x2b686e['query']);_0x2cf60a[_0x001d('0x37')]=_['intersection'](_0x2cf60a['model'],_0x2cf60a[_0x001d('0x35')]);_0x21012c['attributes']=_[_0x001d('0x38')](_0x2cf60a[_0x001d('0x34')],qs[_0x001d('0x39')](_0x2b686e[_0x001d('0x35')]['fields']));_0x21012c[_0x001d('0x3a')]=_0x21012c[_0x001d('0x3a')][_0x001d('0x3b')]?_0x21012c[_0x001d('0x3a')]:_0x2cf60a[_0x001d('0x34')];if(_0x2b686e[_0x001d('0x35')][_0x001d('0x43')]){_0x21012c[_0x001d('0x44')]=[{'all':!![]}];}_0x21012c=_[_0x001d('0x41')]({},_0x21012c,_0x2b686e[_0x001d('0x4a')]);return db[_0x001d('0x30')]['find'](_0x21012c)['then'](handleEntityNotFound(_0x3298ee,null))[_0x001d('0x29')](respondWithResult(_0x3298ee,null))[_0x001d('0x47')](handleError(_0x3298ee,null));};exports[_0x001d('0x4b')]=function(_0xa104db,_0x1de4a2){return db[_0x001d('0x30')]['create'](_0xa104db[_0x001d('0x4c')],{})[_0x001d('0x29')](function(_0x2a86df){var _0x5eab10=_0xa104db[_0x001d('0x4d')][_0x001d('0x27')]({'plain':!![]});if(!_0x5eab10)throw new Error(_0x001d('0x4e'));if(_0x5eab10[_0x001d('0x4f')]===_0x001d('0x4d')){var _0x1f3ba4=_0x2a86df[_0x001d('0x27')]({'plain':!![]});var _0x30a67b=_0x001d('0x28');return db[_0x001d('0x50')][_0x001d('0x51')]({'where':{'name':_0x30a67b,'userProfileId':_0x5eab10[_0x001d('0x52')]},'raw':!![]})['then'](function(_0x2ab056){if(_0x2ab056&&_0x2ab056[_0x001d('0x53')]===0x0){return db[_0x001d('0x54')][_0x001d('0x4b')]({'name':_0x1f3ba4[_0x001d('0x2d')],'resourceId':_0x1f3ba4['id'],'type':_0x2ab056[_0x001d('0x2d')],'sectionId':_0x2ab056['id']},{})[_0x001d('0x29')](function(){return _0x2a86df;});}else{return _0x2a86df;}})[_0x001d('0x47')](function(_0x3a86f){logger[_0x001d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a86f);throw _0x3a86f;});}return _0x2a86df;})[_0x001d('0x29')](respondWithResult(_0x1de4a2,0xc9))[_0x001d('0x47')](handleError(_0x1de4a2,null));};exports[_0x001d('0x55')]=function(_0x449524,_0x229b0a){var _0x452857={'where':{'id':_0x449524[_0x001d('0x49')]['id']}},_0x3ffc48={};_0x3ffc48['model']=_[_0x001d('0x36')](db[_0x001d('0x30')][_0x001d('0x31')]);_0x452857[_0x001d('0x3a')]=_[_0x001d('0x38')](_0x3ffc48[_0x001d('0x34')],qs[_0x001d('0x39')](_0x449524[_0x001d('0x35')][_0x001d('0x39')]));_0x452857['attributes']=_0x452857[_0x001d('0x3a')][_0x001d('0x3b')]?_0x452857['attributes']:_0x3ffc48[_0x001d('0x34')];if(_0x449524['query']['includeAll']){_0x452857[_0x001d('0x44')]=[{'all':!![]}];}_0x452857=_[_0x001d('0x41')]({},_0x452857,_0x449524['options']);return db[_0x001d('0x30')]['find'](_0x452857)[_0x001d('0x29')](handleEntityNotFound(_0x229b0a,null))[_0x001d('0x29')](function(_0x379733){if(_0x379733){var _0x4a1f7e=_0x379733[_0x001d('0x27')]({'plain':!![]});_0x4a1f7e=qs[_0x001d('0x56')](_0x4a1f7e,['id',_0x001d('0x57'),_0x001d('0x58')]);_0x449524['body']=_[_0x001d('0x56')](_0x449524[_0x001d('0x4c')],['id',_0x001d('0x57'),_0x001d('0x58')]);return db['Dashboard'][_0x001d('0x4b')](_[_0x001d('0x41')](_0x4a1f7e,_0x449524[_0x001d('0x4c')]),{'include':_0x449524[_0x001d('0x35')][_0x001d('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x3af58b){var _0x4fed59=_0x449524[_0x001d('0x4d')][_0x001d('0x27')]({'plain':!![]});if(!_0x4fed59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fed59[_0x001d('0x4f')]===_0x001d('0x4d')){var _0x454f76=_0x3af58b[_0x001d('0x27')]({'plain':!![]});var _0x609175=_0x001d('0x28');return db[_0x001d('0x50')][_0x001d('0x51')]({'where':{'name':_0x609175,'userProfileId':_0x4fed59[_0x001d('0x52')]},'raw':!![]})['then'](function(_0x5ec4fb){if(_0x5ec4fb&&_0x5ec4fb[_0x001d('0x53')]===0x0){return db[_0x001d('0x54')][_0x001d('0x4b')]({'name':_0x454f76[_0x001d('0x2d')],'resourceId':_0x454f76['id'],'type':_0x5ec4fb['name'],'sectionId':_0x5ec4fb['id']},{})[_0x001d('0x29')](function(){return _0x3af58b;});}else{return _0x3af58b;}})[_0x001d('0x47')](function(_0x36761f){logger['error'](_0x001d('0x59'),_0x36761f);throw _0x36761f;});}return _0x3af58b;});}})[_0x001d('0x29')](respondWithResult(_0x229b0a,0xc9))[_0x001d('0x47')](handleError(_0x229b0a,null));};exports[_0x001d('0x25')]=function(_0x5e1375,_0x3c4ff7){if(_0x5e1375[_0x001d('0x4c')]['id']){delete _0x5e1375[_0x001d('0x4c')]['id'];}return db['Dashboard'][_0x001d('0x51')]({'where':{'id':_0x5e1375['params']['id']}})[_0x001d('0x29')](handleEntityNotFound(_0x3c4ff7,null))['then'](saveUpdates(_0x5e1375[_0x001d('0x4c')],null))[_0x001d('0x29')](respondWithResult(_0x3c4ff7,null))[_0x001d('0x47')](handleError(_0x3c4ff7,null));};exports[_0x001d('0x26')]=function(_0x3c505d,_0x5764fe){return db[_0x001d('0x30')][_0x001d('0x51')]({'where':{'id':_0x3c505d[_0x001d('0x49')]['id']}})[_0x001d('0x29')](handleEntityNotFound(_0x5764fe,null))['then'](removeEntity(_0x5764fe,null))[_0x001d('0x47')](handleError(_0x5764fe,null));};function widgetAttributes(_0x3c8f01){try{switch(_0x3c8f01[_0x001d('0x5a')]){case _0x001d('0x5b'):return[{'name':_0x001d('0x5c'),'value':_0x3c8f01[_0x001d('0x5c')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x0]?_0x3c8f01[_0x001d('0x5d')][0x0][_0x001d('0x5e')]:undefined)||'https://'}];case _0x001d('0x5f'):return[{'name':_0x001d('0x60'),'value':_0x3c8f01[_0x001d('0x60')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x0]?_0x3c8f01[_0x001d('0x5d')][0x0][_0x001d('0x5e')]:undefined)||''}];case _0x001d('0x61'):return[{'name':_0x001d('0x62'),'value':_0x3c8f01[_0x001d('0x62')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x0]?_0x3c8f01[_0x001d('0x5d')][0x0][_0x001d('0x5e')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x3c8f01['attrTimezone']||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x1]?_0x3c8f01[_0x001d('0x5d')][0x1][_0x001d('0x5e')]:undefined)||_0x001d('0x63')},{'name':_0x001d('0x64'),'value':_0x3c8f01[_0x001d('0x64')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x2]?_0x3c8f01['attrs'][0x2][_0x001d('0x5e')]:undefined)||0xc}];case _0x001d('0x65'):return[{'name':_0x001d('0x66'),'value':_0x3c8f01[_0x001d('0x66')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x0]?_0x3c8f01[_0x001d('0x5d')][0x0][_0x001d('0x5e')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x3c8f01['attrVoiceQueues']||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x1]?_0x3c8f01['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x3c8f01[_0x001d('0x64')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x2]?_0x3c8f01[_0x001d('0x5d')][0x2][_0x001d('0x5e')]:undefined)||0x14},{'name':'attrChannel','value':_0x3c8f01[_0x001d('0x67')]||(_0x3c8f01['attrs']&&_0x3c8f01[_0x001d('0x5d')][0x3]?_0x3c8f01[_0x001d('0x5d')][0x3][_0x001d('0x5e')]:undefined)||'voice'},{'name':_0x001d('0x68'),'value':_0x3c8f01[_0x001d('0x68')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x4]?_0x3c8f01[_0x001d('0x5d')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3c8f01[_0x001d('0x69')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01['attrs'][0x5]?_0x3c8f01['attrs'][0x5][_0x001d('0x5e')]:undefined)||''},{'name':_0x001d('0x6a'),'value':_0x3c8f01['attrSmsAccounts']||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x6]?_0x3c8f01[_0x001d('0x5d')][0x6][_0x001d('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c8f01[_0x001d('0x6b')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x7]?_0x3c8f01[_0x001d('0x5d')][0x7][_0x001d('0x5e')]:undefined)||''},{'name':_0x001d('0x6c'),'value':_0x3c8f01[_0x001d('0x6c')]||(_0x3c8f01['attrs']&&_0x3c8f01[_0x001d('0x5d')][0x8]?_0x3c8f01[_0x001d('0x5d')][0x8][_0x001d('0x5e')]:undefined)||''},{'name':_0x001d('0x6d'),'value':_0x3c8f01[_0x001d('0x6d')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x9]?_0x3c8f01[_0x001d('0x5d')][0x9]['value']:undefined)||''}];case _0x001d('0x6e'):case _0x001d('0x6f'):return[{'name':_0x001d('0x70'),'value':_0x3c8f01['attrSerie1']||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x0]?_0x3c8f01['attrs'][0x0][_0x001d('0x5e')]:undefined)||_0x001d('0x71')},{'name':'attrSerie2','value':_0x3c8f01['attrSerie2']||(_0x3c8f01['attrs']&&_0x3c8f01[_0x001d('0x5d')][0x1]?_0x3c8f01[_0x001d('0x5d')][0x1][_0x001d('0x5e')]:undefined)||null},{'name':_0x001d('0x72'),'value':_0x3c8f01[_0x001d('0x72')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01['attrs'][0x2]?_0x3c8f01[_0x001d('0x5d')][0x2][_0x001d('0x5e')]:undefined)||null},{'name':_0x001d('0x73'),'value':_0x3c8f01[_0x001d('0x73')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x3]?_0x3c8f01[_0x001d('0x5d')][0x3][_0x001d('0x5e')]:undefined)||[]},{'name':'attrChannel','value':_0x3c8f01[_0x001d('0x67')]||(_0x3c8f01['attrs']&&_0x3c8f01[_0x001d('0x5d')][0x4]?_0x3c8f01['attrs'][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x3c8f01['attrEmailAccounts']||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x5]?_0x3c8f01[_0x001d('0x5d')][0x5][_0x001d('0x5e')]:undefined)||''},{'name':_0x001d('0x69'),'value':_0x3c8f01['attrFaxAccounts']||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01['attrs'][0x6]?_0x3c8f01[_0x001d('0x5d')][0x6][_0x001d('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3c8f01[_0x001d('0x6a')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x7]?_0x3c8f01[_0x001d('0x5d')][0x7]['value']:undefined)||''},{'name':_0x001d('0x6b'),'value':_0x3c8f01[_0x001d('0x6b')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01['attrs'][0x8]?_0x3c8f01[_0x001d('0x5d')][0x8][_0x001d('0x5e')]:undefined)||''},{'name':_0x001d('0x6c'),'value':_0x3c8f01[_0x001d('0x6c')]||(_0x3c8f01['attrs']&&_0x3c8f01[_0x001d('0x5d')][0x9]?_0x3c8f01[_0x001d('0x5d')][0x9][_0x001d('0x5e')]:undefined)||''},{'name':_0x001d('0x6d'),'value':_0x3c8f01[_0x001d('0x6d')]||(_0x3c8f01['attrs']&&_0x3c8f01['attrs'][0xa]?_0x3c8f01[_0x001d('0x5d')][0xa][_0x001d('0x5e')]:undefined)||''}];case _0x001d('0x74'):return[{'name':_0x001d('0x75'),'type':_0x3c8f01[_0x001d('0x76')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x0]?_0x3c8f01['attrs'][0x0][_0x001d('0x5a')]:undefined)||null,'value':_0x3c8f01[_0x001d('0x75')]||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x0]?_0x3c8f01['attrs'][0x0][_0x001d('0x5e')]:undefined)||null},{'name':_0x001d('0x77'),'value':_0x3c8f01['attrRefresh']||(_0x3c8f01[_0x001d('0x5d')]&&_0x3c8f01[_0x001d('0x5d')][0x1]?_0x3c8f01[_0x001d('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4f3878){logger['error'](_0x001d('0x78'),JSON[_0x001d('0x79')](_0x4f3878));return[];}}exports[_0x001d('0x7a')]=function(_0x14b58e,_0x34c40b,_0x1bffe7){if(_0x14b58e[_0x001d('0x4c')]['id']){delete _0x14b58e['body']['id'];}return db[_0x001d('0x30')]['find']({'where':{'id':_0x14b58e[_0x001d('0x49')]['id']}})[_0x001d('0x29')](handleEntityNotFound(_0x34c40b,null))[_0x001d('0x29')](function(_0x7ab5ba){if(_0x7ab5ba){_0x14b58e['body'][_0x001d('0x7b')]=_0x7ab5ba['id'];_0x14b58e[_0x001d('0x4c')]['attrs']=widgetAttributes(_0x14b58e[_0x001d('0x4c')]);return db['DashboardItem'][_0x001d('0x4b')](_0x14b58e[_0x001d('0x4c')]);}})['then'](respondWithResult(_0x34c40b,null))[_0x001d('0x47')](handleError(_0x34c40b,null));};exports[_0x001d('0x7c')]=function(_0x1ec474,_0x531acc,_0x525776){var _0x1289e0={};var _0x37bc74={};var _0x5bdce9;var _0x4eef6c;return db[_0x001d('0x30')]['findOne']({'where':{'id':_0x1ec474[_0x001d('0x49')]['id']}})[_0x001d('0x29')](handleEntityNotFound(_0x531acc,null))[_0x001d('0x29')](function(_0x3e2963){if(_0x3e2963){_0x5bdce9=_0x3e2963;_0x37bc74['model']=_['keys'](db[_0x001d('0x7d')]['rawAttributes']);_0x37bc74[_0x001d('0x35')]=_[_0x001d('0x36')](_0x1ec474[_0x001d('0x35')]);_0x37bc74[_0x001d('0x37')]=_[_0x001d('0x38')](_0x37bc74[_0x001d('0x34')],_0x37bc74[_0x001d('0x35')]);_0x1289e0['attributes']=_[_0x001d('0x38')](_0x37bc74[_0x001d('0x34')],qs[_0x001d('0x39')](_0x1ec474[_0x001d('0x35')][_0x001d('0x39')]));_0x1289e0[_0x001d('0x3a')]=_0x1289e0[_0x001d('0x3a')]['length']?_0x1289e0[_0x001d('0x3a')]:_0x37bc74[_0x001d('0x34')];_0x1289e0[_0x001d('0x3d')]=qs[_0x001d('0x7e')](_0x1ec474[_0x001d('0x35')]['sort']);_0x1289e0[_0x001d('0x3e')]=qs[_0x001d('0x37')](_['pick'](_0x1ec474[_0x001d('0x35')],_0x37bc74['filters']));if(_0x1ec474['query'][_0x001d('0x40')]){_0x1289e0[_0x001d('0x3e')]=_['merge'](_0x1289e0[_0x001d('0x3e')],{'$or':_[_0x001d('0x2f')](_0x1289e0[_0x001d('0x3a')],function(_0x5a376f){var _0x13f908={};_0x13f908[_0x5a376f]={'$like':'%'+_0x1ec474['query'][_0x001d('0x40')]+'%'};return _0x13f908;})});}_0x1289e0=_[_0x001d('0x41')]({},_0x1289e0,_0x1ec474[_0x001d('0x4a')]);return _0x5bdce9['getItems'](_0x1289e0);}})[_0x001d('0x29')](function(_0x1d62bc){if(_0x1d62bc){_0x4eef6c=_0x1d62bc[_0x001d('0x3b')];if(!_0x1ec474[_0x001d('0x35')]['hasOwnProperty'](_0x001d('0x3c'))){_0x1289e0[_0x001d('0x1e')]=qs['limit'](_0x1ec474[_0x001d('0x35')][_0x001d('0x1e')]);_0x1289e0['offset']=qs[_0x001d('0x1d')](_0x1ec474[_0x001d('0x35')][_0x001d('0x1d')]);}return _0x5bdce9[_0x001d('0x7c')](_0x1289e0);}})[_0x001d('0x29')](function(_0xf1556){if(_0xf1556){return _0xf1556?{'count':_0x4eef6c,'rows':_0xf1556}:null;}})[_0x001d('0x29')](respondWithResult(_0x531acc,null))[_0x001d('0x47')](handleError(_0x531acc,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 74c2128..6758b73 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 _0xce2f=['../../mysqldb','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xce2f,0x1ef));var _0xfce2=function(_0x8c5648,_0x6a34b){_0x8c5648=_0x8c5648-0x0;var _0x19a4d6=_0xce2f[_0x8c5648];return _0x19a4d6;};'use strict';var EventEmitter=require(_0xfce2('0x0'));var Dashboard=require(_0xfce2('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfce2('0x2')](0x0);var events={'afterCreate':_0xfce2('0x3'),'afterUpdate':_0xfce2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4170fc){return function(_0x8e48f1,_0x5a6aac,_0x124616){DashboardEvents[_0xfce2('0x5')](_0x4170fc+':'+_0x8e48f1['id'],_0x8e48f1);DashboardEvents[_0xfce2('0x5')](_0x4170fc,_0x8e48f1);_0x124616(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xfce2('0x6')](e,emitEvent(event));}}module[_0xfce2('0x7')]=DashboardEvents; \ No newline at end of file +var _0xa6ce=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','Dashboard'];(function(_0x2c6360,_0x2e594a){var _0x23c50e=function(_0x33625c){while(--_0x33625c){_0x2c6360['push'](_0x2c6360['shift']());}};_0x23c50e(++_0x2e594a);}(_0xa6ce,0x15e));var _0xea6c=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0xa6ce[_0x1627ae];return _0x34b38f;};'use strict';var EventEmitter=require(_0xea6c('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xea6c('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xea6c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xea6c('0x3'),'afterDestroy':_0xea6c('0x4')};function emitEvent(_0x4c45ad){return function(_0x5620a1,_0x2ac723,_0x1eea8f){DashboardEvents[_0xea6c('0x5')](_0x4c45ad+':'+_0x5620a1['id'],_0x5620a1);DashboardEvents[_0xea6c('0x5')](_0x4c45ad,_0x5620a1);_0x1eea8f(null);};}for(var e in events){if(events[_0xea6c('0x6')](e)){var event=events[e];Dashboard[_0xea6c('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f41a923..b876dc2 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 _0x9795=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','../../config/logger','moment','bluebird','path'];(function(_0x5864c6,_0x35552f){var _0x393ade=function(_0x117da7){while(--_0x117da7){_0x5864c6['push'](_0x5864c6['shift']());}};_0x393ade(++_0x35552f);}(_0x9795,0x92));var _0x5979=function(_0x3f7f82,_0x46ad7f){_0x3f7f82=_0x3f7f82-0x0;var _0x3ab8b6=_0x9795[_0x3f7f82];return _0x3ab8b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5979('0x0'))('api');var moment=require(_0x5979('0x1'));var BPromise=require(_0x5979('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5979('0x3'));var rimraf=require('rimraf');var config=require(_0x5979('0x4'));var attributes=require(_0x5979('0x5'));module[_0x5979('0x6')]=function(_0x25da2a,_0x37acba){return _0x25da2a[_0x5979('0x7')](_0x5979('0x8'),attributes,{'tableName':_0x5979('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0eb=['rimraf','./dashboard.attributes','exports','dashboards','lodash','util','moment','bluebird','request-promise'];(function(_0x506858,_0x13b318){var _0x51304a=function(_0x224969){while(--_0x224969){_0x506858['push'](_0x506858['shift']());}};_0x51304a(++_0x13b318);}(_0xd0eb,0x11b));var _0xbd0e=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0xd0eb[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0xbd0e('0x0'));var util=require(_0xbd0e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbd0e('0x2'));var BPromise=require(_0xbd0e('0x3'));var rp=require(_0xbd0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd0e('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd0e('0x6'));module[_0xbd0e('0x7')]=function(_0x3e7f75,_0x22a550){return _0x3e7f75['define']('Dashboard',attributes,{'tableName':_0xbd0e('0x8'),'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 92be784..6027b3d 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 _0x2cbe=['redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dashboard,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','client','http'];(function(_0x7cb073,_0x3fcc51){var _0x428a5d=function(_0x6f5779){while(--_0x6f5779){_0x7cb073['push'](_0x7cb073['shift']());}};_0x428a5d(++_0x3fcc51);}(_0x2cbe,0xf5));var _0xe2cb=function(_0x1075b8,_0xd606e2){_0x1075b8=_0x1075b8-0x0;var _0x5d047f=_0x2cbe[_0x1075b8];return _0x5d047f;};'use strict';var _=require(_0xe2cb('0x0'));var util=require(_0xe2cb('0x1'));var moment=require(_0xe2cb('0x2'));var BPromise=require(_0xe2cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe2cb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe2cb('0x6')][_0xe2cb('0x7')]({'port':0x232a});config[_0xe2cb('0x8')]=_[_0xe2cb('0x9')](config[_0xe2cb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe2cb('0xa'))(new Redis(config[_0xe2cb('0x8')]));require(_0xe2cb('0xb'))[_0xe2cb('0xc')](socket);function respondWithRpcPromise(_0x30d116,_0x2829e5,_0x3ebd53){return new BPromise(function(_0x114989,_0x2877e3){return client[_0xe2cb('0xd')](_0x30d116,_0x3ebd53)[_0xe2cb('0xe')](function(_0x125897){logger[_0xe2cb('0xf')]('Dashboard,\x20%s,\x20%s',_0x2829e5,'request\x20sent');logger['debug'](_0xe2cb('0x10'),_0x2829e5,_0xe2cb('0x11'),JSON[_0xe2cb('0x12')](_0x125897));if(_0x125897[_0xe2cb('0x13')]){if(_0x125897[_0xe2cb('0x13')]['code']===0x1f4){logger[_0xe2cb('0x13')](_0xe2cb('0x14'),_0x2829e5,_0x125897[_0xe2cb('0x13')][_0xe2cb('0x15')]);return _0x2877e3(_0x125897[_0xe2cb('0x13')]['message']);}logger[_0xe2cb('0x13')]('Dashboard,\x20%s,\x20%s',_0x2829e5,_0x125897[_0xe2cb('0x13')][_0xe2cb('0x15')]);return _0x114989(_0x125897[_0xe2cb('0x13')]['message']);}else{logger['info'](_0xe2cb('0x14'),_0x2829e5,'request\x20sent');_0x114989(_0x125897['result'][_0xe2cb('0x15')]);}})[_0xe2cb('0x16')](function(_0x5c34a6){logger[_0xe2cb('0x13')](_0xe2cb('0x14'),_0x2829e5,_0x5c34a6);_0x2877e3(_0x5c34a6);});});} \ No newline at end of file +var _0xf74b=['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','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5c0368,_0x423cf2){var _0x5b31b9=function(_0x118b40){while(--_0x118b40){_0x5c0368['push'](_0x5c0368['shift']());}};_0x5b31b9(++_0x423cf2);}(_0xf74b,0x1ae));var _0xbf74=function(_0x542ffa,_0x259765){_0x542ffa=_0x542ffa-0x0;var _0xf99561=_0xf74b[_0x542ffa];return _0xf99561;};'use strict';var _=require(_0xbf74('0x0'));var util=require(_0xbf74('0x1'));var moment=require(_0xbf74('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf74('0x3'));var fs=require('fs');var Redis=require(_0xbf74('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf74('0x5'));var config=require('../../config/environment');var jayson=require(_0xbf74('0x6'));var client=jayson[_0xbf74('0x7')][_0xbf74('0x8')]({'port':0x232a});config[_0xbf74('0x9')]=_[_0xbf74('0xa')](config[_0xbf74('0x9')],{'host':_0xbf74('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0xbf74('0xc')](socket);function respondWithRpcPromise(_0x48e3e5,_0x1a3937,_0x80e2c9){return new BPromise(function(_0x24761e,_0x5d0f5f){return client[_0xbf74('0xd')](_0x48e3e5,_0x80e2c9)[_0xbf74('0xe')](function(_0x38d302){logger[_0xbf74('0xf')](_0xbf74('0x10'),_0x1a3937,_0xbf74('0x11'));logger[_0xbf74('0x12')](_0xbf74('0x13'),_0x1a3937,_0xbf74('0x11'),JSON[_0xbf74('0x14')](_0x38d302));if(_0x38d302[_0xbf74('0x15')]){if(_0x38d302['error'][_0xbf74('0x16')]===0x1f4){logger[_0xbf74('0x15')](_0xbf74('0x10'),_0x1a3937,_0x38d302[_0xbf74('0x15')]['message']);return _0x5d0f5f(_0x38d302['error'][_0xbf74('0x17')]);}logger[_0xbf74('0x15')](_0xbf74('0x10'),_0x1a3937,_0x38d302['error'][_0xbf74('0x17')]);return _0x24761e(_0x38d302[_0xbf74('0x15')][_0xbf74('0x17')]);}else{logger[_0xbf74('0xf')](_0xbf74('0x10'),_0x1a3937,_0xbf74('0x11'));_0x24761e(_0x38d302[_0xbf74('0x18')][_0xbf74('0x17')]);}})[_0xbf74('0x19')](function(_0x56cb2f){logger[_0xbf74('0x15')](_0xbf74('0x10'),_0x1a3937,_0x56cb2f);_0x5d0f5f(_0x56cb2f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index de4d6ba..0a5b7a8 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 _0x9b5f=['update','emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x9b5f,0x163));var _0xf9b5=function(_0x414f45,_0x1ee7d3){_0x414f45=_0x414f45-0x0;var _0x3bc907=_0x9b5f[_0x414f45];return _0x3bc907;};'use strict';var DashboardEvents=require(_0xf9b5('0x0'));var events=[_0xf9b5('0x1'),'remove',_0xf9b5('0x2')];function createListener(_0x2ded06,_0x5da0d4){return function(_0x2399b5){_0x5da0d4[_0xf9b5('0x3')](_0x2ded06,_0x2399b5);};}function removeListener(_0x428bca,_0x54fa7d){return function(){DashboardEvents['removeListener'](_0x428bca,_0x54fa7d);};}exports[_0xf9b5('0x4')]=function(_0x3e9abe){for(var _0x56a38a=0x0,_0x5dc49b=events[_0xf9b5('0x5')];_0x56a38a<_0x5dc49b;_0x56a38a++){var _0x8ec2a6=events[_0x56a38a];var _0x3a8859=createListener(_0xf9b5('0x6')+_0x8ec2a6,_0x3e9abe);DashboardEvents['on'](_0x8ec2a6,_0x3a8859);}}; \ No newline at end of file +var _0xc12a=['length','dashboard:','./dashboard.events','save','remove','emit','register'];(function(_0x2ba9b6,_0x4a1fe0){var _0x57a446=function(_0x1265cc){while(--_0x1265cc){_0x2ba9b6['push'](_0x2ba9b6['shift']());}};_0x57a446(++_0x4a1fe0);}(_0xc12a,0x18a));var _0xac12=function(_0xceb651,_0x19e6a1){_0xceb651=_0xceb651-0x0;var _0x4aab94=_0xc12a[_0xceb651];return _0x4aab94;};'use strict';var DashboardEvents=require(_0xac12('0x0'));var events=[_0xac12('0x1'),_0xac12('0x2'),'update'];function createListener(_0x5226a0,_0x177500){return function(_0x569c35){_0x177500[_0xac12('0x3')](_0x5226a0,_0x569c35);};}function removeListener(_0x148c27,_0x414706){return function(){DashboardEvents['removeListener'](_0x148c27,_0x414706);};}exports[_0xac12('0x4')]=function(_0x2b6888){for(var _0x4c8035=0x0,_0x22c975=events[_0xac12('0x5')];_0x4c8035<_0x22c975;_0x4c8035++){var _0x5cc8e0=events[_0x4c8035];var _0x2eed78=createListener(_0xac12('0x6')+_0x5cc8e0,_0x2b6888);DashboardEvents['on'](_0x5cc8e0,_0x2eed78);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 92f8394..d259f7e 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 _0x8124=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','update','destroy'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x8124,0x1b1));var _0x4812=function(_0x1ba691,_0x59087e){_0x1ba691=_0x1ba691-0x0;var _0xa6091c=_0x8124[_0x1ba691];return _0xa6091c;};'use strict';var multer=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var path=require(_0x4812('0x2'));var timeout=require(_0x4812('0x3'));var express=require(_0x4812('0x4'));var router=express[_0x4812('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4812('0x6'));var interaction=require(_0x4812('0x7'));var config=require(_0x4812('0x8'));var controller=require(_0x4812('0x9'));router[_0x4812('0xa')]('/',auth[_0x4812('0xb')](),controller[_0x4812('0xc')]);router[_0x4812('0xa')](_0x4812('0xd'),auth[_0x4812('0xb')](),controller[_0x4812('0xe')]);router[_0x4812('0xa')](_0x4812('0xf'),auth[_0x4812('0xb')](),controller[_0x4812('0x10')]);router[_0x4812('0x11')]('/',auth[_0x4812('0xb')](),controller[_0x4812('0x12')]);router[_0x4812('0x11')](_0x4812('0x13'),auth[_0x4812('0xb')](),controller[_0x4812('0x14')]);router[_0x4812('0x11')](_0x4812('0xf'),auth[_0x4812('0xb')](),controller['addItem']);router['put'](_0x4812('0xd'),auth['isAuthenticated'](),controller[_0x4812('0x15')]);router['delete']('/:id',auth[_0x4812('0xb')](),controller[_0x4812('0x16')]);module[_0x4812('0x17')]=router; \ No newline at end of file +var _0x6016=['clone','put','update','delete','exports','multer','util','connect-timeout','express','Router','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x6016,0x109));var _0x6601=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x6016[_0x506d2f];return _0x101255;};'use strict';var multer=require(_0x6601('0x0'));var util=require(_0x6601('0x1'));var path=require('path');var timeout=require(_0x6601('0x2'));var express=require(_0x6601('0x3'));var router=express[_0x6601('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6601('0x5'));router[_0x6601('0x6')]('/',auth[_0x6601('0x7')](),controller[_0x6601('0x8')]);router[_0x6601('0x6')](_0x6601('0x9'),auth[_0x6601('0x7')](),controller[_0x6601('0xa')]);router[_0x6601('0x6')](_0x6601('0xb'),auth[_0x6601('0x7')](),controller[_0x6601('0xc')]);router[_0x6601('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6601('0xe'),auth[_0x6601('0x7')](),controller[_0x6601('0xf')]);router[_0x6601('0xd')](_0x6601('0xb'),auth[_0x6601('0x7')](),controller['addItem']);router[_0x6601('0x10')]('/:id',auth[_0x6601('0x7')](),controller[_0x6601('0x11')]);router[_0x6601('0x12')]('/:id',auth[_0x6601('0x7')](),controller['destroy']);module[_0x6601('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 526b26a..dee2e72 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 _0xd8fb=['exports','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','STRING','sequelize','squel','lodash'];(function(_0x5e738a,_0x2b0ab4){var _0x27d917=function(_0x35ffb5){while(--_0x35ffb5){_0x5e738a['push'](_0x5e738a['shift']());}};_0x27d917(++_0x2b0ab4);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1d0cf6,_0x27b01f){_0x1d0cf6=_0x1d0cf6-0x0;var _0x181fb1=_0xd8fb[_0x1d0cf6];return _0x181fb1;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var squel=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));module[_0xbd8f('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xbd8f('0x4')),'get':function(){try{return JSON[_0xbd8f('0x5')](this['getDataValue'](_0xbd8f('0x6')));}catch(_0x2343bf){return[];}},'set':function(_0x5543b2){try{this[_0xbd8f('0x7')]('attrs',JSON[_0xbd8f('0x8')](_0x5543b2));}catch(_0x578499){this[_0xbd8f('0x7')](_0xbd8f('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbd8f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbd8f('0x9')]},'col':{'type':Sequelize[_0xbd8f('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd8f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbd8f('0xb')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xbd8f('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x6d38=['INTEGER','STRING','#2196f3','squel','lodash','exports','TEXT','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x4f3ea1,_0x3beea5){var _0x3cda89=function(_0x9ca029){while(--_0x9ca029){_0x4f3ea1['push'](_0x4f3ea1['shift']());}};_0x3cda89(++_0x3beea5);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6d38[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x86d3('0x0'));var _=require(_0x86d3('0x1'));module[_0x86d3('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x86d3('0x3')]('long'),'get':function(){try{return JSON[_0x86d3('0x4')](this[_0x86d3('0x5')](_0x86d3('0x6')));}catch(_0x4ef557){return[];}},'set':function(_0x2d8272){try{this[_0x86d3('0x7')](_0x86d3('0x6'),JSON[_0x86d3('0x8')](_0x2d8272));}catch(_0x47e654){this['setDataValue'](_0x86d3('0x6'),JSON[_0x86d3('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x86d3('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x86d3('0x9')]},'background':{'type':Sequelize[_0x86d3('0xa')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x86d3('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x86d3('0xa')]},'titleFontSize':{'type':Sequelize['INTEGER'],'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 f9204b5..441ab12 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 _0x8f9d=['params','model','DashboardItem','query','keys','filters','intersection','attributes','length','include','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','show'];(function(_0x2d7a82,_0x25c994){var _0x3a3b7b=function(_0x1dcf5f){while(--_0x1dcf5f){_0x2d7a82['push'](_0x2d7a82['shift']());}};_0x3a3b7b(++_0x25c994);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xd8f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8f9('0x2'));var moment=require(_0xd8f9('0x3'));var BPromise=require(_0xd8f9('0x4'));var Mustache=require(_0xd8f9('0x5'));var util=require(_0xd8f9('0x6'));var path=require(_0xd8f9('0x7'));var sox=require(_0xd8f9('0x8'));var csv=require('to-csv');var ejs=require(_0xd8f9('0x9'));var fs=require('fs');var fs_extra=require(_0xd8f9('0xa'));var _=require(_0xd8f9('0xb'));var squel=require(_0xd8f9('0xc'));var crypto=require(_0xd8f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd8f9('0xe'));var toCsv=require(_0xd8f9('0xf'));var querystring=require('querystring');var Papa=require(_0xd8f9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8f9('0x11'));var as=require(_0xd8f9('0x12'));var hardwareService=require(_0xd8f9('0x13'));var logger=require(_0xd8f9('0x14'))(_0xd8f9('0x15'));var utils=require(_0xd8f9('0x16'));var config=require(_0xd8f9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8f9('0x18'))['db'];config['redis']=_[_0xd8f9('0x19')](config[_0xd8f9('0x1a')],{'host':_0xd8f9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8f9('0x1a')]));require(_0xd8f9('0x1c'))[_0xd8f9('0x1d')](socket);function respondWithStatusCode(_0x223f10,_0x4c11f2){_0x4c11f2=_0x4c11f2||0xcc;return function(_0x3529e9){if(_0x3529e9){return _0x223f10[_0xd8f9('0x1e')](_0x4c11f2);}return _0x223f10[_0xd8f9('0x1f')](_0x4c11f2)[_0xd8f9('0x20')]();};}function respondWithResult(_0x3a3a41,_0x19603a){_0x19603a=_0x19603a||0xc8;return function(_0x566448){if(_0x566448){return _0x3a3a41['status'](_0x19603a)['json'](_0x566448);}};}function respondWithFilteredResult(_0x284a1a,_0xc6a825){return function(_0x4d5b8d){if(_0x4d5b8d){var _0x35943f=typeof _0xc6a825['offset']===_0xd8f9('0x21')&&typeof _0xc6a825['limit']==='undefined';var _0x58956e=_0x4d5b8d[_0xd8f9('0x22')];var _0x5d094d=_0x35943f?0x0:_0xc6a825[_0xd8f9('0x23')];var _0xef802d=_0x35943f?_0x4d5b8d[_0xd8f9('0x22')]:_0xc6a825[_0xd8f9('0x23')]+_0xc6a825[_0xd8f9('0x24')];var _0x45b2e3;if(_0xef802d>=_0x58956e){_0xef802d=_0x58956e;_0x45b2e3=0xc8;}else{_0x45b2e3=0xce;}_0x284a1a['status'](_0x45b2e3);return _0x284a1a[_0xd8f9('0x25')](_0xd8f9('0x26'),_0x5d094d+'-'+_0xef802d+'/'+_0x58956e)[_0xd8f9('0x27')](_0x4d5b8d);}return null;};}function patchUpdates(_0x36d740){return function(_0x1bf210){try{jsonpatch[_0xd8f9('0x28')](_0x1bf210,_0x36d740,!![]);}catch(_0x4c5808){return BPromise[_0xd8f9('0x29')](_0x4c5808);}return _0x1bf210[_0xd8f9('0x2a')]();};}function saveUpdates(_0x1fcd45,_0x956cc3){return function(_0x290553){if(_0x290553){return _0x290553['update'](_0x1fcd45)[_0xd8f9('0x2b')](function(_0x1d6796){return _0x1d6796;});}return null;};}function removeEntity(_0x28854a,_0xd15475){return function(_0x3e68dc){if(_0x3e68dc){return _0x3e68dc[_0xd8f9('0x2c')]()[_0xd8f9('0x2b')](function(){_0x28854a[_0xd8f9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x464a6a,_0x4764d9){return function(_0x3967fb){if(!_0x3967fb){_0x464a6a['sendStatus'](0x194);}return _0x3967fb;};}function handleError(_0x5bd32e,_0x4c08b0){_0x4c08b0=_0x4c08b0||0x1f4;return function(_0x3f85a2){logger[_0xd8f9('0x2d')](_0x3f85a2['stack']);if(_0x3f85a2[_0xd8f9('0x2e')]){delete _0x3f85a2[_0xd8f9('0x2e')];}_0x5bd32e['status'](_0x4c08b0)[_0xd8f9('0x2f')](_0x3f85a2);};}exports[_0xd8f9('0x30')]=function(_0x2786db,_0x4caa27){var _0xda1b6d={'raw':![],'where':{'id':_0x2786db[_0xd8f9('0x31')]['id']}},_0x48f7c0={};_0x48f7c0[_0xd8f9('0x32')]=_['keys'](db[_0xd8f9('0x33')]['rawAttributes']);_0x48f7c0[_0xd8f9('0x34')]=_[_0xd8f9('0x35')](_0x2786db[_0xd8f9('0x34')]);_0x48f7c0[_0xd8f9('0x36')]=_[_0xd8f9('0x37')](_0x48f7c0[_0xd8f9('0x32')],_0x48f7c0[_0xd8f9('0x34')]);_0xda1b6d['attributes']=_[_0xd8f9('0x37')](_0x48f7c0['model'],qs['fields'](_0x2786db['query']['fields']));_0xda1b6d[_0xd8f9('0x38')]=_0xda1b6d[_0xd8f9('0x38')][_0xd8f9('0x39')]?_0xda1b6d[_0xd8f9('0x38')]:_0x48f7c0[_0xd8f9('0x32')];if(_0x2786db['query']['includeAll']){_0xda1b6d[_0xd8f9('0x3a')]=[{'all':!![]}];}_0xda1b6d=_[_0xd8f9('0x3b')]({},_0xda1b6d,_0x2786db['options']);return db[_0xd8f9('0x33')][_0xd8f9('0x3c')](_0xda1b6d)[_0xd8f9('0x2b')](handleEntityNotFound(_0x4caa27,null))['then'](respondWithResult(_0x4caa27,null))['catch'](handleError(_0x4caa27,null));};exports['destroy']=function(_0x542312,_0xed6ba){return db[_0xd8f9('0x33')][_0xd8f9('0x3c')]({'where':{'id':_0x542312[_0xd8f9('0x31')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0xed6ba,null))['then'](removeEntity(_0xed6ba,null))[_0xd8f9('0x3d')](handleError(_0xed6ba,null));};function widgetAttributes(_0x2bc390){try{switch(_0x2bc390[_0xd8f9('0x3e')]){case _0xd8f9('0x3f'):return[{'name':_0xd8f9('0x40'),'value':_0x2bc390[_0xd8f9('0x40')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0][_0xd8f9('0x42')]:undefined)||_0xd8f9('0x43')}];case'custom':return[{'name':_0xd8f9('0x44'),'value':_0x2bc390[_0xd8f9('0x44')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390['attrs'][0x0][_0xd8f9('0x42')]:undefined)||''}];case _0xd8f9('0x45'):return[{'name':_0xd8f9('0x46'),'value':_0x2bc390[_0xd8f9('0x46')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xd8f9('0x47'),'value':_0x2bc390[_0xd8f9('0x47')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x1]?_0x2bc390[_0xd8f9('0x41')][0x1][_0xd8f9('0x42')]:undefined)||_0xd8f9('0x48')},{'name':_0xd8f9('0x49'),'value':_0x2bc390[_0xd8f9('0x49')]||(_0x2bc390['attrs']&&_0x2bc390['attrs'][0x2]?_0x2bc390[_0xd8f9('0x41')][0x2][_0xd8f9('0x42')]:undefined)||0xc}];case _0xd8f9('0x4a'):return[{'name':'attrMetric','value':_0x2bc390['attrMetric']||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0]['value']:undefined)||_0xd8f9('0x4b')},{'name':_0xd8f9('0x4c'),'value':_0x2bc390[_0xd8f9('0x4c')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x1]?_0x2bc390[_0xd8f9('0x41')][0x1][_0xd8f9('0x42')]:undefined)||[]},{'name':_0xd8f9('0x49'),'value':_0x2bc390[_0xd8f9('0x49')]||(_0x2bc390['attrs']&&_0x2bc390['attrs'][0x2]?_0x2bc390['attrs'][0x2][_0xd8f9('0x42')]:undefined)||0x14},{'name':_0xd8f9('0x4d'),'value':_0x2bc390[_0xd8f9('0x4d')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x3]?_0x2bc390[_0xd8f9('0x41')][0x3][_0xd8f9('0x42')]:undefined)||_0xd8f9('0x4e')},{'name':_0xd8f9('0x4f'),'value':_0x2bc390[_0xd8f9('0x4f')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x4]?_0x2bc390[_0xd8f9('0x41')][0x4]['value']:undefined)||''},{'name':_0xd8f9('0x50'),'value':_0x2bc390[_0xd8f9('0x50')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x5]?_0x2bc390['attrs'][0x5][_0xd8f9('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2bc390['attrSmsAccounts']||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x6]?_0x2bc390[_0xd8f9('0x41')][0x6][_0xd8f9('0x42')]:undefined)||''},{'name':_0xd8f9('0x51'),'value':_0x2bc390[_0xd8f9('0x51')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x7]?_0x2bc390[_0xd8f9('0x41')][0x7][_0xd8f9('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2bc390['attrWhatsappAccounts']||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x8]?_0x2bc390[_0xd8f9('0x41')][0x8]['value']:undefined)||''},{'name':_0xd8f9('0x52'),'value':_0x2bc390[_0xd8f9('0x52')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x9]?_0x2bc390[_0xd8f9('0x41')][0x9][_0xd8f9('0x42')]:undefined)||''}];case _0xd8f9('0x53'):case _0xd8f9('0x54'):return[{'name':'attrSerie1','value':_0x2bc390[_0xd8f9('0x55')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0][_0xd8f9('0x42')]:undefined)||_0xd8f9('0x4b')},{'name':_0xd8f9('0x56'),'value':_0x2bc390[_0xd8f9('0x56')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x1]?_0x2bc390[_0xd8f9('0x41')][0x1]['value']:undefined)||null},{'name':_0xd8f9('0x57'),'value':_0x2bc390[_0xd8f9('0x57')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x2]?_0x2bc390['attrs'][0x2][_0xd8f9('0x42')]:undefined)||null},{'name':_0xd8f9('0x4c'),'value':_0x2bc390[_0xd8f9('0x4c')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x3]?_0x2bc390[_0xd8f9('0x41')][0x3][_0xd8f9('0x42')]:undefined)||[]},{'name':_0xd8f9('0x4d'),'value':_0x2bc390['attrChannel']||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x4]?_0x2bc390['attrs'][0x4]['value']:undefined)||_0xd8f9('0x4e')},{'name':_0xd8f9('0x4f'),'value':_0x2bc390[_0xd8f9('0x4f')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x5]?_0x2bc390['attrs'][0x5][_0xd8f9('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2bc390[_0xd8f9('0x50')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x6]?_0x2bc390[_0xd8f9('0x41')][0x6]['value']:undefined)||''},{'name':_0xd8f9('0x58'),'value':_0x2bc390[_0xd8f9('0x58')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x7]?_0x2bc390[_0xd8f9('0x41')][0x7][_0xd8f9('0x42')]:undefined)||''},{'name':_0xd8f9('0x51'),'value':_0x2bc390[_0xd8f9('0x51')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x8]?_0x2bc390[_0xd8f9('0x41')][0x8][_0xd8f9('0x42')]:undefined)||''},{'name':_0xd8f9('0x59'),'value':_0x2bc390[_0xd8f9('0x59')]||(_0x2bc390['attrs']&&_0x2bc390['attrs'][0x9]?_0x2bc390['attrs'][0x9][_0xd8f9('0x42')]:undefined)||''},{'name':_0xd8f9('0x52'),'value':_0x2bc390['attrChatWebsites']||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0xa]?_0x2bc390[_0xd8f9('0x41')][0xa][_0xd8f9('0x42')]:undefined)||''}];case _0xd8f9('0x5a'):return[{'name':_0xd8f9('0x5b'),'type':_0x2bc390[_0xd8f9('0x5c')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0][_0xd8f9('0x3e')]:undefined)||null,'value':_0x2bc390[_0xd8f9('0x5b')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0][_0xd8f9('0x42')]:undefined)||null},{'name':_0xd8f9('0x5d'),'value':_0x2bc390[_0xd8f9('0x5d')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x1]?_0x2bc390[_0xd8f9('0x41')][0x1][_0xd8f9('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x47ecf8){logger['error']('widgetAttributes:\x20%s',JSON[_0xd8f9('0x5e')](_0x47ecf8));return[];}}exports[_0xd8f9('0x5f')]=function(_0x2a8815,_0x23d4fb){if(_0x2a8815[_0xd8f9('0x60')]){_0x2a8815[_0xd8f9('0x60')][_0xd8f9('0x41')]=widgetAttributes(_0x2a8815[_0xd8f9('0x60')]);}return db['DashboardItem'][_0xd8f9('0x5f')](_0x2a8815['body'],{})[_0xd8f9('0x2b')](respondWithResult(_0x23d4fb,0xc9))[_0xd8f9('0x3d')](handleError(_0x23d4fb,null));};exports[_0xd8f9('0x61')]=function(_0x4580dc,_0x28f06f){if(_0x4580dc[_0xd8f9('0x60')]['id']){delete _0x4580dc[_0xd8f9('0x60')]['id'];}_0x4580dc[_0xd8f9('0x60')]['attrs']=widgetAttributes(_0x4580dc[_0xd8f9('0x60')]);return db['DashboardItem'][_0xd8f9('0x3c')]({'where':{'id':_0x4580dc['params']['id']}})['then'](handleEntityNotFound(_0x28f06f,null))[_0xd8f9('0x2b')](saveUpdates(_0x4580dc['body'],null))['then'](respondWithResult(_0x28f06f,null))[_0xd8f9('0x3d')](handleError(_0x28f06f,null));}; \ No newline at end of file +var _0xef96=['attrChatWebsites','multibar-chart','pie-chart','attrSerie2','web-report','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','update','then','destroy','send','params','model','DashboardItem','rawAttributes','query','intersection','fields','attributes','length','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0x2e6141,_0x2bcaf1){var _0x432b18=function(_0x7391ac){while(--_0x7391ac){_0x2e6141['push'](_0x2e6141['shift']());}};_0x432b18(++_0x2bcaf1);}(_0xef96,0x162));var _0x6ef9=function(_0x34f049,_0x560858){_0x34f049=_0x34f049-0x0;var _0x43dfd4=_0xef96[_0x34f049];return _0x43dfd4;};'use strict';var emlformat=require(_0x6ef9('0x0'));var rimraf=require(_0x6ef9('0x1'));var zipdir=require(_0x6ef9('0x2'));var jsonpatch=require(_0x6ef9('0x3'));var rp=require(_0x6ef9('0x4'));var moment=require(_0x6ef9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ef9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6ef9('0x7'));var ejs=require(_0x6ef9('0x8'));var fs=require('fs');var fs_extra=require(_0x6ef9('0x9'));var _=require('lodash');var squel=require(_0x6ef9('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ef9('0xb'));var deskjs=require(_0x6ef9('0xc'));var toCsv=require(_0x6ef9('0x7'));var querystring=require('querystring');var Papa=require(_0x6ef9('0xd'));var Redis=require('ioredis');var authService=require(_0x6ef9('0xe'));var qs=require(_0x6ef9('0xf'));var as=require(_0x6ef9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ef9('0x11'))(_0x6ef9('0x12'));var utils=require(_0x6ef9('0x13'));var config=require(_0x6ef9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ef9('0x15'))['db'];config[_0x6ef9('0x16')]=_[_0x6ef9('0x17')](config[_0x6ef9('0x16')],{'host':_0x6ef9('0x18'),'port':0x18eb});var socket=require(_0x6ef9('0x19'))(new Redis(config[_0x6ef9('0x16')]));require('./dashboardItem.socket')[_0x6ef9('0x1a')](socket);function respondWithStatusCode(_0x2942bc,_0x1f3793){_0x1f3793=_0x1f3793||0xcc;return function(_0x3f50e0){if(_0x3f50e0){return _0x2942bc[_0x6ef9('0x1b')](_0x1f3793);}return _0x2942bc[_0x6ef9('0x1c')](_0x1f3793)[_0x6ef9('0x1d')]();};}function respondWithResult(_0x253b13,_0x37deec){_0x37deec=_0x37deec||0xc8;return function(_0x4e0132){if(_0x4e0132){return _0x253b13[_0x6ef9('0x1c')](_0x37deec)[_0x6ef9('0x1e')](_0x4e0132);}};}function respondWithFilteredResult(_0x4fac02,_0x5064cb){return function(_0x1cb130){if(_0x1cb130){var _0x572ce6=typeof _0x5064cb[_0x6ef9('0x1f')]===_0x6ef9('0x20')&&typeof _0x5064cb[_0x6ef9('0x21')]===_0x6ef9('0x20');var _0x1d975c=_0x1cb130[_0x6ef9('0x22')];var _0x493cdd=_0x572ce6?0x0:_0x5064cb['offset'];var _0x1ac999=_0x572ce6?_0x1cb130[_0x6ef9('0x22')]:_0x5064cb['offset']+_0x5064cb[_0x6ef9('0x21')];var _0x3e74d2;if(_0x1ac999>=_0x1d975c){_0x1ac999=_0x1d975c;_0x3e74d2=0xc8;}else{_0x3e74d2=0xce;}_0x4fac02[_0x6ef9('0x1c')](_0x3e74d2);return _0x4fac02[_0x6ef9('0x23')](_0x6ef9('0x24'),_0x493cdd+'-'+_0x1ac999+'/'+_0x1d975c)[_0x6ef9('0x1e')](_0x1cb130);}return null;};}function patchUpdates(_0x404515){return function(_0x57d440){try{jsonpatch['apply'](_0x57d440,_0x404515,!![]);}catch(_0xae1b6e){return BPromise[_0x6ef9('0x25')](_0xae1b6e);}return _0x57d440['save']();};}function saveUpdates(_0x49faeb,_0x22b3d6){return function(_0x4f8520){if(_0x4f8520){return _0x4f8520[_0x6ef9('0x26')](_0x49faeb)[_0x6ef9('0x27')](function(_0xdbc856){return _0xdbc856;});}return null;};}function removeEntity(_0x383197,_0x1bdb00){return function(_0x116891){if(_0x116891){return _0x116891[_0x6ef9('0x28')]()['then'](function(){_0x383197[_0x6ef9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21cc0c,_0x19b575){return function(_0x4c9aba){if(!_0x4c9aba){_0x21cc0c[_0x6ef9('0x1b')](0x194);}return _0x4c9aba;};}function handleError(_0x351dce,_0x205b74){_0x205b74=_0x205b74||0x1f4;return function(_0x212d32){logger['error'](_0x212d32['stack']);if(_0x212d32['name']){delete _0x212d32['name'];}_0x351dce['status'](_0x205b74)[_0x6ef9('0x29')](_0x212d32);};}exports['show']=function(_0x40b4e7,_0x5a8f0c){var _0xe7b717={'raw':![],'where':{'id':_0x40b4e7[_0x6ef9('0x2a')]['id']}},_0x2958e0={};_0x2958e0[_0x6ef9('0x2b')]=_['keys'](db[_0x6ef9('0x2c')][_0x6ef9('0x2d')]);_0x2958e0[_0x6ef9('0x2e')]=_['keys'](_0x40b4e7[_0x6ef9('0x2e')]);_0x2958e0['filters']=_[_0x6ef9('0x2f')](_0x2958e0[_0x6ef9('0x2b')],_0x2958e0[_0x6ef9('0x2e')]);_0xe7b717['attributes']=_[_0x6ef9('0x2f')](_0x2958e0[_0x6ef9('0x2b')],qs['fields'](_0x40b4e7[_0x6ef9('0x2e')][_0x6ef9('0x30')]));_0xe7b717[_0x6ef9('0x31')]=_0xe7b717[_0x6ef9('0x31')][_0x6ef9('0x32')]?_0xe7b717[_0x6ef9('0x31')]:_0x2958e0['model'];if(_0x40b4e7['query']['includeAll']){_0xe7b717['include']=[{'all':!![]}];}_0xe7b717=_[_0x6ef9('0x33')]({},_0xe7b717,_0x40b4e7['options']);return db['DashboardItem'][_0x6ef9('0x34')](_0xe7b717)[_0x6ef9('0x27')](handleEntityNotFound(_0x5a8f0c,null))['then'](respondWithResult(_0x5a8f0c,null))[_0x6ef9('0x35')](handleError(_0x5a8f0c,null));};exports['destroy']=function(_0x578c9b,_0x1721b2){return db[_0x6ef9('0x2c')]['find']({'where':{'id':_0x578c9b[_0x6ef9('0x2a')]['id']}})[_0x6ef9('0x27')](handleEntityNotFound(_0x1721b2,null))[_0x6ef9('0x27')](removeEntity(_0x1721b2,null))['catch'](handleError(_0x1721b2,null));};function widgetAttributes(_0x319e7d){try{switch(_0x319e7d[_0x6ef9('0x36')]){case _0x6ef9('0x37'):return[{'name':_0x6ef9('0x38'),'value':_0x319e7d['attrUrl']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d['attrs'][0x0][_0x6ef9('0x3a')]:undefined)||_0x6ef9('0x3b')}];case'custom':return[{'name':_0x6ef9('0x3c'),'value':_0x319e7d[_0x6ef9('0x3c')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d[_0x6ef9('0x39')][0x0][_0x6ef9('0x3a')]:undefined)||''}];case'clock':return[{'name':_0x6ef9('0x3d'),'value':_0x319e7d[_0x6ef9('0x3d')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d['attrs'][0x0][_0x6ef9('0x3a')]:undefined)||_0x6ef9('0x3e')},{'name':_0x6ef9('0x3f'),'value':_0x319e7d[_0x6ef9('0x3f')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d['attrs'][0x1]?_0x319e7d[_0x6ef9('0x39')][0x1][_0x6ef9('0x3a')]:undefined)||'0.00'},{'name':_0x6ef9('0x40'),'value':_0x319e7d[_0x6ef9('0x40')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x2]?_0x319e7d['attrs'][0x2][_0x6ef9('0x3a')]:undefined)||0xc}];case _0x6ef9('0x41'):return[{'name':_0x6ef9('0x42'),'value':_0x319e7d[_0x6ef9('0x42')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d['attrs'][0x0]?_0x319e7d['attrs'][0x0]['value']:undefined)||_0x6ef9('0x43')},{'name':_0x6ef9('0x44'),'value':_0x319e7d['attrVoiceQueues']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x1]?_0x319e7d['attrs'][0x1][_0x6ef9('0x3a')]:undefined)||[]},{'name':'attrFontSize','value':_0x319e7d[_0x6ef9('0x40')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x2]?_0x319e7d[_0x6ef9('0x39')][0x2][_0x6ef9('0x3a')]:undefined)||0x14},{'name':'attrChannel','value':_0x319e7d[_0x6ef9('0x45')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x3]?_0x319e7d[_0x6ef9('0x39')][0x3][_0x6ef9('0x3a')]:undefined)||_0x6ef9('0x46')},{'name':'attrEmailAccounts','value':_0x319e7d[_0x6ef9('0x47')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x4]?_0x319e7d[_0x6ef9('0x39')][0x4][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x48'),'value':_0x319e7d[_0x6ef9('0x48')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x5]?_0x319e7d[_0x6ef9('0x39')][0x5][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x49'),'value':_0x319e7d[_0x6ef9('0x49')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x6]?_0x319e7d[_0x6ef9('0x39')][0x6]['value']:undefined)||''},{'name':_0x6ef9('0x4a'),'value':_0x319e7d[_0x6ef9('0x4a')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x7]?_0x319e7d['attrs'][0x7][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x4b'),'value':_0x319e7d['attrWhatsappAccounts']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x8]?_0x319e7d[_0x6ef9('0x39')][0x8][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x4c'),'value':_0x319e7d['attrChatWebsites']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x9]?_0x319e7d[_0x6ef9('0x39')][0x9][_0x6ef9('0x3a')]:undefined)||''}];case _0x6ef9('0x4d'):case _0x6ef9('0x4e'):return[{'name':'attrSerie1','value':_0x319e7d['attrSerie1']||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d['attrs'][0x0][_0x6ef9('0x3a')]:undefined)||_0x6ef9('0x43')},{'name':'attrSerie2','value':_0x319e7d[_0x6ef9('0x4f')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x1]?_0x319e7d[_0x6ef9('0x39')][0x1][_0x6ef9('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x319e7d['attrSerie3']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d['attrs'][0x2]?_0x319e7d[_0x6ef9('0x39')][0x2][_0x6ef9('0x3a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x319e7d['attrVoiceQueues']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x3]?_0x319e7d[_0x6ef9('0x39')][0x3][_0x6ef9('0x3a')]:undefined)||[]},{'name':_0x6ef9('0x45'),'value':_0x319e7d['attrChannel']||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x4]?_0x319e7d[_0x6ef9('0x39')][0x4][_0x6ef9('0x3a')]:undefined)||'voice'},{'name':_0x6ef9('0x47'),'value':_0x319e7d[_0x6ef9('0x47')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x5]?_0x319e7d['attrs'][0x5][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x48'),'value':_0x319e7d[_0x6ef9('0x48')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x6]?_0x319e7d[_0x6ef9('0x39')][0x6][_0x6ef9('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x319e7d[_0x6ef9('0x49')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x7]?_0x319e7d[_0x6ef9('0x39')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x319e7d[_0x6ef9('0x4a')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x8]?_0x319e7d[_0x6ef9('0x39')][0x8][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x4b'),'value':_0x319e7d['attrWhatsappAccounts']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x9]?_0x319e7d['attrs'][0x9]['value']:undefined)||''},{'name':_0x6ef9('0x4c'),'value':_0x319e7d[_0x6ef9('0x4c')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0xa]?_0x319e7d[_0x6ef9('0x39')][0xa][_0x6ef9('0x3a')]:undefined)||''}];case _0x6ef9('0x50'):return[{'name':'attrReport','type':_0x319e7d[_0x6ef9('0x51')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d[_0x6ef9('0x39')][0x0][_0x6ef9('0x36')]:undefined)||null,'value':_0x319e7d['attrReport']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d['attrs'][0x0]['value']:undefined)||null},{'name':_0x6ef9('0x52'),'value':_0x319e7d[_0x6ef9('0x52')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x1]?_0x319e7d[_0x6ef9('0x39')][0x1][_0x6ef9('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x29c6ee){logger['error']('widgetAttributes:\x20%s',JSON[_0x6ef9('0x53')](_0x29c6ee));return[];}}exports[_0x6ef9('0x54')]=function(_0x1f85a4,_0x322f8e){if(_0x1f85a4[_0x6ef9('0x55')]){_0x1f85a4['body'][_0x6ef9('0x39')]=widgetAttributes(_0x1f85a4['body']);}return db[_0x6ef9('0x2c')][_0x6ef9('0x54')](_0x1f85a4['body'],{})['then'](respondWithResult(_0x322f8e,0xc9))[_0x6ef9('0x35')](handleError(_0x322f8e,null));};exports[_0x6ef9('0x26')]=function(_0x200896,_0x24a3d5){if(_0x200896['body']['id']){delete _0x200896['body']['id'];}_0x200896[_0x6ef9('0x55')]['attrs']=widgetAttributes(_0x200896['body']);return db[_0x6ef9('0x2c')][_0x6ef9('0x34')]({'where':{'id':_0x200896['params']['id']}})[_0x6ef9('0x27')](handleEntityNotFound(_0x24a3d5,null))['then'](saveUpdates(_0x200896[_0x6ef9('0x55')],null))['then'](respondWithResult(_0x24a3d5,null))[_0x6ef9('0x35')](handleError(_0x24a3d5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index ac7e5a3..5e23c88 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 _0x6965=['save','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners'];(function(_0x2340a7,_0x597ea7){var _0x2e1c90=function(_0x5ce812){while(--_0x5ce812){_0x2340a7['push'](_0x2340a7['shift']());}};_0x2e1c90(++_0x597ea7);}(_0x6965,0xa8));var _0x5696=function(_0x383fdd,_0x5123bb){_0x383fdd=_0x383fdd-0x0;var _0x58fefb=_0x6965[_0x383fdd];return _0x58fefb;};'use strict';var EventEmitter=require(_0x5696('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x5696('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5696('0x2')](0x0);var events={'afterCreate':_0x5696('0x3'),'afterUpdate':'update','afterDestroy':_0x5696('0x4')};function emitEvent(_0x272332){return function(_0x1280a6,_0x2d403a,_0x3e362e){DashboardItemEvents[_0x5696('0x5')](_0x272332+':'+_0x1280a6['id'],_0x1280a6);DashboardItemEvents[_0x5696('0x5')](_0x272332,_0x1280a6);_0x3e362e(null);};}for(var e in events){if(events[_0x5696('0x6')](e)){var event=events[e];DashboardItem[_0x5696('0x7')](e,emitEvent(event));}}module[_0x5696('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x41d0=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update'];(function(_0x4daea8,_0x35c1cd){var _0xd730c2=function(_0x4a7a79){while(--_0x4a7a79){_0x4daea8['push'](_0x4daea8['shift']());}};_0xd730c2(++_0x35c1cd);}(_0x41d0,0x1c6));var _0x041d=function(_0x3ec594,_0x448834){_0x3ec594=_0x3ec594-0x0;var _0x21f286=_0x41d0[_0x3ec594];return _0x21f286;};'use strict';var EventEmitter=require(_0x041d('0x0'));var DashboardItem=require(_0x041d('0x1'))['db'][_0x041d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x041d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x041d('0x4'),'afterDestroy':_0x041d('0x5')};function emitEvent(_0x12e55d){return function(_0x397dad,_0x41e587,_0x3a22a4){DashboardItemEvents[_0x041d('0x6')](_0x12e55d+':'+_0x397dad['id'],_0x397dad);DashboardItemEvents[_0x041d('0x6')](_0x12e55d,_0x397dad);_0x3a22a4(null);};}for(var e in events){if(events[_0x041d('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x041d('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 0df1456..baad79b 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 _0x94fe=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment'];(function(_0x125be5,_0x373bf8){var _0x303eed=function(_0x25f6b3){while(--_0x25f6b3){_0x125be5['push'](_0x125be5['shift']());}};_0x303eed(++_0x373bf8);}(_0x94fe,0x167));var _0xe94f=function(_0x4cfd4c,_0x1dd3d2){_0x4cfd4c=_0x4cfd4c-0x0;var _0x3011f9=_0x94fe[_0x4cfd4c];return _0x3011f9;};'use strict';var _=require(_0xe94f('0x0'));var util=require(_0xe94f('0x1'));var logger=require(_0xe94f('0x2'))(_0xe94f('0x3'));var moment=require(_0xe94f('0x4'));var BPromise=require('bluebird');var rp=require(_0xe94f('0x5'));var fs=require('fs');var path=require(_0xe94f('0x6'));var rimraf=require(_0xe94f('0x7'));var config=require(_0xe94f('0x8'));var attributes=require(_0xe94f('0x9'));module[_0xe94f('0xa')]=function(_0x13ee9a,_0x14ea58){return _0x13ee9a['define'](_0xe94f('0xb'),attributes,{'tableName':_0xe94f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9abf=['util','../../config/logger','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','lodash'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0x9abf,0xd7));var _0xf9ab=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9abf[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf9ab('0x0'));var util=require(_0xf9ab('0x1'));var logger=require(_0xf9ab('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9ab('0x4'));var config=require(_0xf9ab('0x5'));var attributes=require(_0xf9ab('0x6'));module[_0xf9ab('0x7')]=function(_0x4ee567,_0x415cc5){return _0x4ee567['define'](_0xf9ab('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 08216f2..f5aa48b 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 _0xff3c=['DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug'];(function(_0x313ed3,_0x4ea2da){var _0x595a64=function(_0x300adf){while(--_0x300adf){_0x313ed3['push'](_0x313ed3['shift']());}};_0x595a64(++_0x4ea2da);}(_0xff3c,0x10b));var _0xcff3=function(_0x39ed20,_0x3b8d39){_0x39ed20=_0x39ed20-0x0;var _0x57bddf=_0xff3c[_0x39ed20];return _0x57bddf;};'use strict';var _=require(_0xcff3('0x0'));var util=require(_0xcff3('0x1'));var moment=require(_0xcff3('0x2'));var BPromise=require(_0xcff3('0x3'));var rs=require(_0xcff3('0x4'));var fs=require('fs');var Redis=require(_0xcff3('0x5'));var db=require(_0xcff3('0x6'))['db'];var utils=require(_0xcff3('0x7'));var logger=require(_0xcff3('0x8'))(_0xcff3('0x9'));var config=require(_0xcff3('0xa'));var jayson=require(_0xcff3('0xb'));var client=jayson[_0xcff3('0xc')][_0xcff3('0xd')]({'port':0x232a});config[_0xcff3('0xe')]=_[_0xcff3('0xf')](config[_0xcff3('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xcff3('0x10'))(new Redis(config[_0xcff3('0xe')]));require('./dashboardItem.socket')[_0xcff3('0x11')](socket);function respondWithRpcPromise(_0x39b257,_0x388b27,_0x46a7dc){return new BPromise(function(_0x54c66b,_0x4ff867){return client[_0xcff3('0x12')](_0x39b257,_0x46a7dc)[_0xcff3('0x13')](function(_0x5e64c2){logger[_0xcff3('0x14')](_0xcff3('0x15'),_0x388b27,'request\x20sent');logger[_0xcff3('0x16')](_0xcff3('0x17'),_0x388b27,_0xcff3('0x18'),JSON['stringify'](_0x5e64c2));if(_0x5e64c2[_0xcff3('0x19')]){if(_0x5e64c2['error'][_0xcff3('0x1a')]===0x1f4){logger[_0xcff3('0x19')](_0xcff3('0x15'),_0x388b27,_0x5e64c2['error'][_0xcff3('0x1b')]);return _0x4ff867(_0x5e64c2[_0xcff3('0x19')][_0xcff3('0x1b')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x388b27,_0x5e64c2[_0xcff3('0x19')][_0xcff3('0x1b')]);return _0x54c66b(_0x5e64c2['error'][_0xcff3('0x1b')]);}else{logger[_0xcff3('0x14')](_0xcff3('0x15'),_0x388b27,_0xcff3('0x18'));_0x54c66b(_0x5e64c2[_0xcff3('0x1c')][_0xcff3('0x1b')]);}})['catch'](function(_0x2de7ea){logger['error'](_0xcff3('0x15'),_0x388b27,_0x2de7ea);_0x4ff867(_0x2de7ea);});});} \ No newline at end of file +var _0xd83f=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x238f08,_0x17b2d6){var _0x306697=function(_0x28a705){while(--_0x28a705){_0x238f08['push'](_0x238f08['shift']());}};_0x306697(++_0x17b2d6);}(_0xd83f,0x13a));var _0xfd83=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd83f[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xfd83('0x0'));var util=require(_0xfd83('0x1'));var moment=require(_0xfd83('0x2'));var BPromise=require(_0xfd83('0x3'));var rs=require(_0xfd83('0x4'));var fs=require('fs');var Redis=require(_0xfd83('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd83('0x6'));var logger=require('../../config/logger')(_0xfd83('0x7'));var config=require('../../config/environment');var jayson=require(_0xfd83('0x8'));var client=jayson[_0xfd83('0x9')][_0xfd83('0xa')]({'port':0x232a});config['redis']=_[_0xfd83('0xb')](config[_0xfd83('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfd83('0xd'))[_0xfd83('0xe')](socket);function respondWithRpcPromise(_0x309449,_0x1846dc,_0x27b628){return new BPromise(function(_0x5342e0,_0xa5729b){return client[_0xfd83('0xf')](_0x309449,_0x27b628)['then'](function(_0x432538){logger[_0xfd83('0x10')](_0xfd83('0x11'),_0x1846dc,_0xfd83('0x12'));logger[_0xfd83('0x13')](_0xfd83('0x14'),_0x1846dc,_0xfd83('0x12'),JSON[_0xfd83('0x15')](_0x432538));if(_0x432538[_0xfd83('0x16')]){if(_0x432538['error'][_0xfd83('0x17')]===0x1f4){logger['error'](_0xfd83('0x11'),_0x1846dc,_0x432538[_0xfd83('0x16')]['message']);return _0xa5729b(_0x432538[_0xfd83('0x16')][_0xfd83('0x18')]);}logger['error'](_0xfd83('0x11'),_0x1846dc,_0x432538['error'][_0xfd83('0x18')]);return _0x5342e0(_0x432538[_0xfd83('0x16')][_0xfd83('0x18')]);}else{logger[_0xfd83('0x10')](_0xfd83('0x11'),_0x1846dc,_0xfd83('0x12'));_0x5342e0(_0x432538['result'][_0xfd83('0x18')]);}})[_0xfd83('0x19')](function(_0x5a1f76){logger[_0xfd83('0x16')](_0xfd83('0x11'),_0x1846dc,_0x5a1f76);_0xa5729b(_0x5a1f76);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c5827c1..a17e3f3 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 _0x97fe=['length','dashboardItem:','remove','update','removeListener'];(function(_0x3720f6,_0x4ab838){var _0x5a2527=function(_0x2cd4ed){while(--_0x2cd4ed){_0x3720f6['push'](_0x3720f6['shift']());}};_0x5a2527(++_0x4ab838);}(_0x97fe,0x10b));var _0xe97f=function(_0x45f763,_0x551397){_0x45f763=_0x45f763-0x0;var _0x176e05=_0x97fe[_0x45f763];return _0x176e05;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0xe97f('0x0'),_0xe97f('0x1')];function createListener(_0x3667d1,_0x4e6173){return function(_0x1c42c1){_0x4e6173['emit'](_0x3667d1,_0x1c42c1);};}function removeListener(_0x38548a,_0x14e76f){return function(){DashboardItemEvents[_0xe97f('0x2')](_0x38548a,_0x14e76f);};}exports['register']=function(_0x3cf79d){for(var _0x45bdbb=0x0,_0x189090=events[_0xe97f('0x3')];_0x45bdbb<_0x189090;_0x45bdbb++){var _0x1ad6cd=events[_0x45bdbb];var _0x22843f=createListener(_0xe97f('0x4')+_0x1ad6cd,_0x3cf79d);DashboardItemEvents['on'](_0x1ad6cd,_0x22843f);}}; \ No newline at end of file +var _0x5e9d=['emit','register','length','dashboardItem:','save','update'];(function(_0x37abcc,_0x2d927c){var _0x35500f=function(_0x337fa1){while(--_0x337fa1){_0x37abcc['push'](_0x37abcc['shift']());}};_0x35500f(++_0x2d927c);}(_0x5e9d,0x136));var _0xd5e9=function(_0x4f35f3,_0x453930){_0x4f35f3=_0x4f35f3-0x0;var _0x569aee=_0x5e9d[_0x4f35f3];return _0x569aee;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xd5e9('0x0'),'remove',_0xd5e9('0x1')];function createListener(_0x390d63,_0x274903){return function(_0x26f961){_0x274903[_0xd5e9('0x2')](_0x390d63,_0x26f961);};}function removeListener(_0x187db9,_0x4be3dd){return function(){DashboardItemEvents['removeListener'](_0x187db9,_0x4be3dd);};}exports[_0xd5e9('0x3')]=function(_0xa139f5){for(var _0x2fcfdb=0x0,_0x52b113=events[_0xd5e9('0x4')];_0x2fcfdb<_0x52b113;_0x2fcfdb++){var _0x6b660f=events[_0x2fcfdb];var _0x418300=createListener(_0xd5e9('0x5')+_0x6b660f,_0xa139f5);DashboardItemEvents['on'](_0x6b660f,_0x418300);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a920d12..37ac167 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 _0x481f=['update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create'];(function(_0x5a50ce,_0x346ba6){var _0x13792e=function(_0x3b3758){while(--_0x3b3758){_0x5a50ce['push'](_0x5a50ce['shift']());}};_0x13792e(++_0x346ba6);}(_0x481f,0xf2));var _0xf481=function(_0x175359,_0x7f4b6e){_0x175359=_0x175359-0x0;var _0x1582b6=_0x481f[_0x175359];return _0x1582b6;};'use strict';var multer=require(_0xf481('0x0'));var util=require(_0xf481('0x1'));var path=require('path');var timeout=require(_0xf481('0x2'));var express=require(_0xf481('0x3'));var router=express['Router']();var fs_extra=require(_0xf481('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf481('0x5'));var config=require(_0xf481('0x6'));var controller=require(_0xf481('0x7'));router[_0xf481('0x8')](_0xf481('0x9'),auth[_0xf481('0xa')](),controller['show']);router[_0xf481('0xb')]('/',auth[_0xf481('0xa')](),controller[_0xf481('0xc')]);router['put'](_0xf481('0x9'),auth[_0xf481('0xa')](),controller[_0xf481('0xd')]);router[_0xf481('0xe')](_0xf481('0x9'),auth[_0xf481('0xa')](),controller[_0xf481('0xf')]);module[_0xf481('0x10')]=router; \ No newline at end of file +var _0x7b02=['util','path','connect-timeout','express','Router','./dashboardItem.controller','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x7b02,0x8f));var _0x27b0=function(_0x3cac3f,_0x276d81){_0x3cac3f=_0x3cac3f-0x0;var _0x1f8615=_0x7b02[_0x3cac3f];return _0x1f8615;};'use strict';var multer=require(_0x27b0('0x0'));var util=require(_0x27b0('0x1'));var path=require(_0x27b0('0x2'));var timeout=require(_0x27b0('0x3'));var express=require(_0x27b0('0x4'));var router=express[_0x27b0('0x5')]();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(_0x27b0('0x6'));router[_0x27b0('0x7')](_0x27b0('0x8'),auth['isAuthenticated'](),controller[_0x27b0('0x9')]);router[_0x27b0('0xa')]('/',auth['isAuthenticated'](),controller[_0x27b0('0xb')]);router[_0x27b0('0xc')](_0x27b0('0x8'),auth[_0x27b0('0xd')](),controller[_0x27b0('0xe')]);router[_0x27b0('0xf')]('/:id',auth[_0x27b0('0xd')](),controller[_0x27b0('0x10')]);module[_0x27b0('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d2bf31a..794d73f 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 _0x470d=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x48d2f4,_0x2ebd62){var _0x3efa9b=function(_0x644861){while(--_0x644861){_0x48d2f4['push'](_0x48d2f4['shift']());}};_0x3efa9b(++_0x2ebd62);}(_0x470d,0x1b0));var _0xd470=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x470d[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xd470('0x0'));module[_0xd470('0x1')]={'name':{'type':Sequelize[_0xd470('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xd470('0x3')](_0xd470('0x4'),_0xd470('0x5'),_0xd470('0x6')),'allowNull':![],'defaultValue':_0xd470('0x4')},'description':{'type':Sequelize[_0xd470('0x2')]}}; \ No newline at end of file +var _0xf69d=['ENUM','first','second','third','STRING','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf69d,0xc2));var _0xdf69=function(_0x4688ff,_0x5cd862){_0x4688ff=_0x4688ff-0x0;var _0x32958f=_0xf69d[_0x4688ff];return _0x32958f;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xdf69('0x2')](_0xdf69('0x3'),_0xdf69('0x4'),_0xdf69('0x5')),'allowNull':![],'defaultValue':_0xdf69('0x3')},'description':{'type':Sequelize[_0xdf69('0x6')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a50c3d9..59665a8 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 _0xaa65=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0xaa65,0x90));var _0x5aa6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa65[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5aa6('0x0'));var rimraf=require(_0x5aa6('0x1'));var zipdir=require(_0x5aa6('0x2'));var jsonpatch=require(_0x5aa6('0x3'));var rp=require('request-promise');var moment=require(_0x5aa6('0x4'));var BPromise=require(_0x5aa6('0x5'));var Mustache=require(_0x5aa6('0x6'));var util=require(_0x5aa6('0x7'));var path=require(_0x5aa6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5aa6('0x9'));var fs=require('fs');var fs_extra=require(_0x5aa6('0xa'));var _=require(_0x5aa6('0xb'));var squel=require(_0x5aa6('0xc'));var crypto=require('crypto');var jsforce=require(_0x5aa6('0xd'));var deskjs=require(_0x5aa6('0xe'));var toCsv=require(_0x5aa6('0xf'));var querystring=require(_0x5aa6('0x10'));var Papa=require(_0x5aa6('0x11'));var Redis=require(_0x5aa6('0x12'));var authService=require(_0x5aa6('0x13'));var qs=require(_0x5aa6('0x14'));var as=require(_0x5aa6('0x15'));var hardwareService=require(_0x5aa6('0x16'));var logger=require(_0x5aa6('0x17'))(_0x5aa6('0x18'));var utils=require('../../config/utils');var config=require(_0x5aa6('0x19'));var licenseUtil=require(_0x5aa6('0x1a'));var db=require(_0x5aa6('0x1b'))['db'];function respondWithStatusCode(_0x2705c1,_0x35f52a){_0x35f52a=_0x35f52a||0xcc;return function(_0x4eb241){if(_0x4eb241){return _0x2705c1[_0x5aa6('0x1c')](_0x35f52a);}return _0x2705c1['status'](_0x35f52a)[_0x5aa6('0x1d')]();};}function respondWithResult(_0x3b9975,_0x37b20b){_0x37b20b=_0x37b20b||0xc8;return function(_0xbe2686){if(_0xbe2686){return _0x3b9975['status'](_0x37b20b)['json'](_0xbe2686);}};}function respondWithFilteredResult(_0x54d11f,_0x434bb8){return function(_0x49bc20){if(_0x49bc20){var _0x29c809=typeof _0x434bb8[_0x5aa6('0x1e')]===_0x5aa6('0x1f')&&typeof _0x434bb8[_0x5aa6('0x20')]===_0x5aa6('0x1f');var _0x2dc6b5=_0x49bc20[_0x5aa6('0x21')];var _0x5370dd=_0x29c809?0x0:_0x434bb8['offset'];var _0x16f7e0=_0x29c809?_0x49bc20['count']:_0x434bb8[_0x5aa6('0x1e')]+_0x434bb8['limit'];var _0x223cc6;if(_0x16f7e0>=_0x2dc6b5){_0x16f7e0=_0x2dc6b5;_0x223cc6=0xc8;}else{_0x223cc6=0xce;}_0x54d11f[_0x5aa6('0x22')](_0x223cc6);return _0x54d11f[_0x5aa6('0x23')](_0x5aa6('0x24'),_0x5370dd+'-'+_0x16f7e0+'/'+_0x2dc6b5)['json'](_0x49bc20);}return null;};}function patchUpdates(_0x55d786){return function(_0x313b4b){try{jsonpatch[_0x5aa6('0x25')](_0x313b4b,_0x55d786,!![]);}catch(_0xdc492e){return BPromise[_0x5aa6('0x26')](_0xdc492e);}return _0x313b4b[_0x5aa6('0x27')]();};}function saveUpdates(_0x136f00,_0x27c317){return function(_0x535692){if(_0x535692){return _0x535692[_0x5aa6('0x28')](_0x136f00)['then'](function(_0x5eaddd){return _0x5eaddd;});}return null;};}function removeEntity(_0x296a11,_0x1e74d2){return function(_0x8c7319){if(_0x8c7319){return _0x8c7319[_0x5aa6('0x29')]()[_0x5aa6('0x2a')](function(){var _0x3066a6=_0x8c7319[_0x5aa6('0x2b')]({'plain':!![]});var _0x30a7da=_0x5aa6('0x2c');return db[_0x5aa6('0x2d')][_0x5aa6('0x29')]({'where':{'type':_0x30a7da,'resourceId':_0x3066a6['id']}})[_0x5aa6('0x2a')](function(){return _0x8c7319;});})[_0x5aa6('0x2a')](function(){_0x296a11[_0x5aa6('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x540789,_0x3f0623){return function(_0x546337){if(!_0x546337){_0x540789[_0x5aa6('0x1c')](0x194);}return _0x546337;};}function handleError(_0x35b48b,_0x26c401){_0x26c401=_0x26c401||0x1f4;return function(_0x5c3b1f){logger[_0x5aa6('0x2e')](_0x5c3b1f['stack']);if(_0x5c3b1f['name']){delete _0x5c3b1f[_0x5aa6('0x2f')];}_0x35b48b['status'](_0x26c401)['send'](_0x5c3b1f);};}exports[_0x5aa6('0x30')]=function(_0x33bd51,_0x4ac7c0){var _0x1ce7d1={},_0x407958={},_0x58ec31={'count':0x0,'rows':[]};var _0x5b9aff=_[_0x5aa6('0x31')](db[_0x5aa6('0x32')][_0x5aa6('0x33')],function(_0x39914f){return{'name':_0x39914f[_0x5aa6('0x34')],'type':_0x39914f[_0x5aa6('0x35')][_0x5aa6('0x36')]};});_0x407958[_0x5aa6('0x37')]=_[_0x5aa6('0x31')](_0x5b9aff,'name');_0x407958['query']=_[_0x5aa6('0x38')](_0x33bd51['query']);_0x407958['filters']=_['intersection'](_0x407958[_0x5aa6('0x37')],_0x407958['query']);_0x1ce7d1['attributes']=_[_0x5aa6('0x39')](_0x407958['model'],qs['fields'](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x3b')]));_0x1ce7d1[_0x5aa6('0x3c')]=_0x1ce7d1[_0x5aa6('0x3c')]['length']?_0x1ce7d1[_0x5aa6('0x3c')]:_0x407958['model'];if(!_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x3d')](_0x5aa6('0x3e'))){_0x1ce7d1[_0x5aa6('0x20')]=qs[_0x5aa6('0x20')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x20')]);_0x1ce7d1[_0x5aa6('0x1e')]=qs[_0x5aa6('0x1e')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x1e')]);}_0x1ce7d1[_0x5aa6('0x3f')]=qs[_0x5aa6('0x40')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x40')]);_0x1ce7d1[_0x5aa6('0x41')]=qs[_0x5aa6('0x42')](_['pick'](_0x33bd51[_0x5aa6('0x3a')],_0x407958[_0x5aa6('0x42')]),_0x5b9aff);if(_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x43')]){_0x1ce7d1['where']=_['merge'](_0x1ce7d1[_0x5aa6('0x41')],{'$or':_[_0x5aa6('0x31')](_0x5b9aff,function(_0x372c95){if(_0x372c95[_0x5aa6('0x35')]!=='VIRTUAL'){var _0x4d19f9={};_0x4d19f9[_0x372c95[_0x5aa6('0x2f')]]={'$like':'%'+_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x43')]+'%'};return _0x4d19f9;}})});}_0x1ce7d1=_[_0x5aa6('0x44')]({},_0x1ce7d1,_0x33bd51['options']);var _0x57b48d={'where':_0x1ce7d1[_0x5aa6('0x41')]};return db[_0x5aa6('0x32')][_0x5aa6('0x21')](_0x57b48d)['then'](function(_0x5b6595){_0x58ec31[_0x5aa6('0x21')]=_0x5b6595;if(_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x45')]){_0x1ce7d1[_0x5aa6('0x46')]=[{'all':!![]}];}return db[_0x5aa6('0x32')]['findAll'](_0x1ce7d1);})[_0x5aa6('0x2a')](function(_0x568afd){_0x58ec31[_0x5aa6('0x47')]=_0x568afd;return _0x58ec31;})[_0x5aa6('0x2a')](respondWithFilteredResult(_0x4ac7c0,_0x1ce7d1))[_0x5aa6('0x48')](handleError(_0x4ac7c0,null));};exports[_0x5aa6('0x49')]=function(_0x24665d,_0x4bb169){var _0x4e2487={'raw':!![],'where':{'id':_0x24665d['params']['id']}},_0x471d2c={};_0x471d2c[_0x5aa6('0x37')]=_['keys'](db[_0x5aa6('0x32')][_0x5aa6('0x33')]);_0x471d2c[_0x5aa6('0x3a')]=_[_0x5aa6('0x38')](_0x24665d[_0x5aa6('0x3a')]);_0x471d2c[_0x5aa6('0x42')]=_['intersection'](_0x471d2c[_0x5aa6('0x37')],_0x471d2c[_0x5aa6('0x3a')]);_0x4e2487[_0x5aa6('0x3c')]=_[_0x5aa6('0x39')](_0x471d2c[_0x5aa6('0x37')],qs['fields'](_0x24665d[_0x5aa6('0x3a')]['fields']));_0x4e2487[_0x5aa6('0x3c')]=_0x4e2487[_0x5aa6('0x3c')]['length']?_0x4e2487['attributes']:_0x471d2c[_0x5aa6('0x37')];if(_0x24665d[_0x5aa6('0x3a')][_0x5aa6('0x45')]){_0x4e2487[_0x5aa6('0x46')]=[{'all':!![]}];}_0x4e2487=_[_0x5aa6('0x44')]({},_0x4e2487,_0x24665d[_0x5aa6('0x4a')]);return db[_0x5aa6('0x32')][_0x5aa6('0x4b')](_0x4e2487)[_0x5aa6('0x2a')](handleEntityNotFound(_0x4bb169,null))[_0x5aa6('0x2a')](respondWithResult(_0x4bb169,null))[_0x5aa6('0x48')](handleError(_0x4bb169,null));};exports['create']=function(_0x5cfb93,_0xc33a2){return db[_0x5aa6('0x32')][_0x5aa6('0x4c')](_0x5cfb93[_0x5aa6('0x4d')],{})[_0x5aa6('0x2a')](function(_0x27bdf4){var _0xb62d69=_0x5cfb93[_0x5aa6('0x4e')][_0x5aa6('0x2b')]({'plain':!![]});if(!_0xb62d69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb62d69[_0x5aa6('0x4f')]===_0x5aa6('0x4e')){var _0x28c4d7=_0x27bdf4[_0x5aa6('0x2b')]({'plain':!![]});var _0x22ae33=_0x5aa6('0x2c');return db[_0x5aa6('0x50')][_0x5aa6('0x4b')]({'where':{'name':_0x22ae33,'userProfileId':_0xb62d69[_0x5aa6('0x51')]},'raw':!![]})[_0x5aa6('0x2a')](function(_0xf56e54){if(_0xf56e54&&_0xf56e54[_0x5aa6('0x52')]===0x0){return db[_0x5aa6('0x2d')][_0x5aa6('0x4c')]({'name':_0x28c4d7[_0x5aa6('0x2f')],'resourceId':_0x28c4d7['id'],'type':_0xf56e54['name'],'sectionId':_0xf56e54['id']},{})['then'](function(){return _0x27bdf4;});}else{return _0x27bdf4;}})[_0x5aa6('0x48')](function(_0x385966){logger[_0x5aa6('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x385966);throw _0x385966;});}return _0x27bdf4;})[_0x5aa6('0x2a')](respondWithResult(_0xc33a2,0xc9))[_0x5aa6('0x48')](handleError(_0xc33a2,null));};exports[_0x5aa6('0x28')]=function(_0x2b5276,_0x451304){if(_0x2b5276[_0x5aa6('0x4d')]['id']){delete _0x2b5276[_0x5aa6('0x4d')]['id'];}return db[_0x5aa6('0x32')][_0x5aa6('0x4b')]({'where':{'id':_0x2b5276[_0x5aa6('0x53')]['id']}})[_0x5aa6('0x2a')](handleEntityNotFound(_0x451304,null))[_0x5aa6('0x2a')](saveUpdates(_0x2b5276[_0x5aa6('0x4d')],null))[_0x5aa6('0x2a')](respondWithResult(_0x451304,null))[_0x5aa6('0x48')](handleError(_0x451304,null));};exports[_0x5aa6('0x29')]=function(_0x205ac0,_0x2844f8){return db[_0x5aa6('0x32')][_0x5aa6('0x4b')]({'where':{'id':_0x205ac0[_0x5aa6('0x53')]['id']}})[_0x5aa6('0x2a')](handleEntityNotFound(_0x2844f8,null))[_0x5aa6('0x2a')](removeEntity(_0x2844f8,null))[_0x5aa6('0x48')](handleError(_0x2844f8,null));}; \ No newline at end of file +var _0xba6e=['pick','filter','where','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xba6e,0x168));var _0xeba6=function(_0xf9ce28,_0x3571a5){_0xf9ce28=_0xf9ce28-0x0;var _0x96578e=_0xba6e[_0xf9ce28];return _0x96578e;};'use strict';var emlformat=require(_0xeba6('0x0'));var rimraf=require(_0xeba6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeba6('0x2'));var rp=require('request-promise');var moment=require(_0xeba6('0x3'));var BPromise=require(_0xeba6('0x4'));var Mustache=require(_0xeba6('0x5'));var util=require(_0xeba6('0x6'));var path=require(_0xeba6('0x7'));var sox=require(_0xeba6('0x8'));var csv=require(_0xeba6('0x9'));var ejs=require(_0xeba6('0xa'));var fs=require('fs');var fs_extra=require(_0xeba6('0xb'));var _=require(_0xeba6('0xc'));var squel=require(_0xeba6('0xd'));var crypto=require(_0xeba6('0xe'));var jsforce=require(_0xeba6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeba6('0x9'));var querystring=require(_0xeba6('0x10'));var Papa=require(_0xeba6('0x11'));var Redis=require(_0xeba6('0x12'));var authService=require(_0xeba6('0x13'));var qs=require(_0xeba6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeba6('0x15'));var logger=require(_0xeba6('0x16'))(_0xeba6('0x17'));var utils=require(_0xeba6('0x18'));var config=require(_0xeba6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xeba6('0x1a'))['db'];function respondWithStatusCode(_0xc6c95f,_0x2847cf){_0x2847cf=_0x2847cf||0xcc;return function(_0x9b58c9){if(_0x9b58c9){return _0xc6c95f[_0xeba6('0x1b')](_0x2847cf);}return _0xc6c95f['status'](_0x2847cf)[_0xeba6('0x1c')]();};}function respondWithResult(_0x48abfc,_0x2a9607){_0x2a9607=_0x2a9607||0xc8;return function(_0x232ac1){if(_0x232ac1){return _0x48abfc[_0xeba6('0x1d')](_0x2a9607)[_0xeba6('0x1e')](_0x232ac1);}};}function respondWithFilteredResult(_0x25d2f9,_0x32c8aa){return function(_0x41c36f){if(_0x41c36f){var _0x4c82d2=typeof _0x32c8aa[_0xeba6('0x1f')]===_0xeba6('0x20')&&typeof _0x32c8aa['limit']===_0xeba6('0x20');var _0x1948f3=_0x41c36f[_0xeba6('0x21')];var _0xd632dc=_0x4c82d2?0x0:_0x32c8aa[_0xeba6('0x1f')];var _0x346d44=_0x4c82d2?_0x41c36f[_0xeba6('0x21')]:_0x32c8aa[_0xeba6('0x1f')]+_0x32c8aa[_0xeba6('0x22')];var _0x44ed37;if(_0x346d44>=_0x1948f3){_0x346d44=_0x1948f3;_0x44ed37=0xc8;}else{_0x44ed37=0xce;}_0x25d2f9[_0xeba6('0x1d')](_0x44ed37);return _0x25d2f9[_0xeba6('0x23')](_0xeba6('0x24'),_0xd632dc+'-'+_0x346d44+'/'+_0x1948f3)[_0xeba6('0x1e')](_0x41c36f);}return null;};}function patchUpdates(_0x5a7c69){return function(_0x46856f){try{jsonpatch[_0xeba6('0x25')](_0x46856f,_0x5a7c69,!![]);}catch(_0x33ce8a){return BPromise['reject'](_0x33ce8a);}return _0x46856f['save']();};}function saveUpdates(_0x43e6c4,_0x1264fc){return function(_0x1b61da){if(_0x1b61da){return _0x1b61da[_0xeba6('0x26')](_0x43e6c4)[_0xeba6('0x27')](function(_0x2c55a4){return _0x2c55a4;});}return null;};}function removeEntity(_0x2423ee,_0x5d0889){return function(_0x2d77e3){if(_0x2d77e3){return _0x2d77e3[_0xeba6('0x28')]()[_0xeba6('0x27')](function(){var _0x57d141=_0x2d77e3[_0xeba6('0x29')]({'plain':!![]});var _0x3a7e81=_0xeba6('0x2a');return db[_0xeba6('0x2b')][_0xeba6('0x28')]({'where':{'type':_0x3a7e81,'resourceId':_0x57d141['id']}})[_0xeba6('0x27')](function(){return _0x2d77e3;});})['then'](function(){_0x2423ee[_0xeba6('0x1d')](0xcc)[_0xeba6('0x1c')]();});}};}function handleEntityNotFound(_0x2b6017,_0xfabfd2){return function(_0x57a506){if(!_0x57a506){_0x2b6017[_0xeba6('0x1b')](0x194);}return _0x57a506;};}function handleError(_0x555d74,_0x4e09d9){_0x4e09d9=_0x4e09d9||0x1f4;return function(_0x288a08){logger['error'](_0x288a08[_0xeba6('0x2c')]);if(_0x288a08[_0xeba6('0x2d')]){delete _0x288a08['name'];}_0x555d74['status'](_0x4e09d9)[_0xeba6('0x2e')](_0x288a08);};}exports[_0xeba6('0x2f')]=function(_0x5c5d5f,_0x42e7d0){var _0x3327dc={},_0x5c6797={},_0x2f8ef6={'count':0x0,'rows':[]};var _0x5dc9a7=_[_0xeba6('0x30')](db[_0xeba6('0x31')][_0xeba6('0x32')],function(_0x56bcde){return{'name':_0x56bcde[_0xeba6('0x33')],'type':_0x56bcde['type'][_0xeba6('0x34')]};});_0x5c6797[_0xeba6('0x35')]=_['map'](_0x5dc9a7,_0xeba6('0x2d'));_0x5c6797[_0xeba6('0x36')]=_[_0xeba6('0x37')](_0x5c5d5f[_0xeba6('0x36')]);_0x5c6797[_0xeba6('0x38')]=_[_0xeba6('0x39')](_0x5c6797[_0xeba6('0x35')],_0x5c6797[_0xeba6('0x36')]);_0x3327dc[_0xeba6('0x3a')]=_[_0xeba6('0x39')](_0x5c6797['model'],qs[_0xeba6('0x3b')](_0x5c5d5f[_0xeba6('0x36')][_0xeba6('0x3b')]));_0x3327dc[_0xeba6('0x3a')]=_0x3327dc[_0xeba6('0x3a')][_0xeba6('0x3c')]?_0x3327dc[_0xeba6('0x3a')]:_0x5c6797[_0xeba6('0x35')];if(!_0x5c5d5f['query'][_0xeba6('0x3d')](_0xeba6('0x3e'))){_0x3327dc[_0xeba6('0x22')]=qs['limit'](_0x5c5d5f[_0xeba6('0x36')][_0xeba6('0x22')]);_0x3327dc[_0xeba6('0x1f')]=qs[_0xeba6('0x1f')](_0x5c5d5f['query'][_0xeba6('0x1f')]);}_0x3327dc[_0xeba6('0x3f')]=qs[_0xeba6('0x40')](_0x5c5d5f[_0xeba6('0x36')][_0xeba6('0x40')]);_0x3327dc['where']=qs[_0xeba6('0x38')](_[_0xeba6('0x41')](_0x5c5d5f[_0xeba6('0x36')],_0x5c6797[_0xeba6('0x38')]),_0x5dc9a7);if(_0x5c5d5f[_0xeba6('0x36')][_0xeba6('0x42')]){_0x3327dc[_0xeba6('0x43')]=_[_0xeba6('0x44')](_0x3327dc[_0xeba6('0x43')],{'$or':_['map'](_0x5dc9a7,function(_0x3ab15a){if(_0x3ab15a['type']!=='VIRTUAL'){var _0x55770a={};_0x55770a[_0x3ab15a['name']]={'$like':'%'+_0x5c5d5f['query'][_0xeba6('0x42')]+'%'};return _0x55770a;}})});}_0x3327dc=_[_0xeba6('0x44')]({},_0x3327dc,_0x5c5d5f[_0xeba6('0x45')]);var _0x55cb23={'where':_0x3327dc[_0xeba6('0x43')]};return db[_0xeba6('0x31')][_0xeba6('0x21')](_0x55cb23)[_0xeba6('0x27')](function(_0x2af9c0){_0x2f8ef6[_0xeba6('0x21')]=_0x2af9c0;if(_0x5c5d5f[_0xeba6('0x36')]['includeAll']){_0x3327dc[_0xeba6('0x46')]=[{'all':!![]}];}return db[_0xeba6('0x31')][_0xeba6('0x47')](_0x3327dc);})[_0xeba6('0x27')](function(_0x1b4538){_0x2f8ef6[_0xeba6('0x48')]=_0x1b4538;return _0x2f8ef6;})[_0xeba6('0x27')](respondWithFilteredResult(_0x42e7d0,_0x3327dc))[_0xeba6('0x49')](handleError(_0x42e7d0,null));};exports[_0xeba6('0x4a')]=function(_0x45edc1,_0x59b8f3){var _0x270272={'raw':!![],'where':{'id':_0x45edc1[_0xeba6('0x4b')]['id']}},_0x2c294c={};_0x2c294c['model']=_['keys'](db[_0xeba6('0x31')][_0xeba6('0x32')]);_0x2c294c[_0xeba6('0x36')]=_[_0xeba6('0x37')](_0x45edc1['query']);_0x2c294c[_0xeba6('0x38')]=_[_0xeba6('0x39')](_0x2c294c[_0xeba6('0x35')],_0x2c294c['query']);_0x270272['attributes']=_[_0xeba6('0x39')](_0x2c294c[_0xeba6('0x35')],qs[_0xeba6('0x3b')](_0x45edc1['query'][_0xeba6('0x3b')]));_0x270272['attributes']=_0x270272['attributes']['length']?_0x270272[_0xeba6('0x3a')]:_0x2c294c[_0xeba6('0x35')];if(_0x45edc1[_0xeba6('0x36')][_0xeba6('0x4c')]){_0x270272['include']=[{'all':!![]}];}_0x270272=_[_0xeba6('0x44')]({},_0x270272,_0x45edc1[_0xeba6('0x45')]);return db[_0xeba6('0x31')][_0xeba6('0x4d')](_0x270272)[_0xeba6('0x27')](handleEntityNotFound(_0x59b8f3,null))[_0xeba6('0x27')](respondWithResult(_0x59b8f3,null))['catch'](handleError(_0x59b8f3,null));};exports[_0xeba6('0x4e')]=function(_0x1b3e28,_0x1ce105){return db[_0xeba6('0x31')][_0xeba6('0x4e')](_0x1b3e28[_0xeba6('0x4f')],{})[_0xeba6('0x27')](function(_0x3c314e){var _0x3cc7fd=_0x1b3e28[_0xeba6('0x50')][_0xeba6('0x29')]({'plain':!![]});if(!_0x3cc7fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cc7fd[_0xeba6('0x51')]==='user'){var _0x2cc00c=_0x3c314e[_0xeba6('0x29')]({'plain':!![]});var _0x5a997d=_0xeba6('0x2a');return db[_0xeba6('0x52')]['find']({'where':{'name':_0x5a997d,'userProfileId':_0x3cc7fd[_0xeba6('0x53')]},'raw':!![]})[_0xeba6('0x27')](function(_0x181577){if(_0x181577&&_0x181577[_0xeba6('0x54')]===0x0){return db[_0xeba6('0x2b')]['create']({'name':_0x2cc00c[_0xeba6('0x2d')],'resourceId':_0x2cc00c['id'],'type':_0x181577[_0xeba6('0x2d')],'sectionId':_0x181577['id']},{})[_0xeba6('0x27')](function(){return _0x3c314e;});}else{return _0x3c314e;}})[_0xeba6('0x49')](function(_0xbb03d5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbb03d5);throw _0xbb03d5;});}return _0x3c314e;})[_0xeba6('0x27')](respondWithResult(_0x1ce105,0xc9))[_0xeba6('0x49')](handleError(_0x1ce105,null));};exports[_0xeba6('0x26')]=function(_0x6ddbb3,_0x4c8677){if(_0x6ddbb3['body']['id']){delete _0x6ddbb3['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x6ddbb3[_0xeba6('0x4b')]['id']}})[_0xeba6('0x27')](handleEntityNotFound(_0x4c8677,null))[_0xeba6('0x27')](saveUpdates(_0x6ddbb3['body'],null))[_0xeba6('0x27')](respondWithResult(_0x4c8677,null))[_0xeba6('0x49')](handleError(_0x4c8677,null));};exports[_0xeba6('0x28')]=function(_0x50f873,_0x314363){return db[_0xeba6('0x31')][_0xeba6('0x4d')]({'where':{'id':_0x50f873[_0xeba6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x314363,null))[_0xeba6('0x27')](removeEntity(_0x314363,null))['catch'](handleError(_0x314363,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 30c78ea..b0426d9 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 _0xdc9e=['FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','tools_dispositions','name_voice','name','name_chat','MailAccountId','name_sms','name_fax'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdc9e,0x6e));var _0xedc9=function(_0x3cc912,_0x144b91){_0x3cc912=_0x3cc912-0x0;var _0x29024d=_0xdc9e[_0x3cc912];return _0x29024d;};'use strict';var _=require(_0xedc9('0x0'));var util=require(_0xedc9('0x1'));var logger=require(_0xedc9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xedc9('0x3'));var rp=require(_0xedc9('0x4'));var fs=require('fs');var path=require(_0xedc9('0x5'));var rimraf=require(_0xedc9('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xedc9('0x7')]=function(_0x18aeb8,_0x1042a9){return _0x18aeb8[_0xedc9('0x8')]('Disposition',attributes,{'tableName':_0xedc9('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xedc9('0xa'),'fields':[_0xedc9('0xb'),'ListId']},{'unique':!![],'name':_0xedc9('0xc'),'fields':[_0xedc9('0xb'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xedc9('0xb'),_0xedc9('0xd')]},{'unique':!![],'name':_0xedc9('0xe'),'fields':[_0xedc9('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xedc9('0xf'),'fields':[_0xedc9('0xb'),_0xedc9('0x10')]},{'unique':!![],'name':_0xedc9('0x11'),'fields':['name',_0xedc9('0x12')]},{'unique':!![],'name':_0xedc9('0x13'),'fields':[_0xedc9('0xb'),_0xedc9('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1167=['request-promise','path','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment'];(function(_0xfec4f2,_0x27b2aa){var _0x4ee052=function(_0x195ba5){while(--_0x195ba5){_0xfec4f2['push'](_0xfec4f2['shift']());}};_0x4ee052(++_0x27b2aa);}(_0x1167,0x159));var _0x7116=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x1167[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x7116('0x0'));var util=require(_0x7116('0x1'));var logger=require(_0x7116('0x2'))(_0x7116('0x3'));var moment=require(_0x7116('0x4'));var BPromise=require('bluebird');var rp=require(_0x7116('0x5'));var fs=require('fs');var path=require(_0x7116('0x6'));var rimraf=require(_0x7116('0x7'));var config=require(_0x7116('0x8'));var attributes=require('./disposition.attributes');module[_0x7116('0x9')]=function(_0x3caa6b,_0x2a715d){return _0x3caa6b['define'](_0x7116('0xa'),attributes,{'tableName':_0x7116('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7116('0xc'),'fields':[_0x7116('0xd'),_0x7116('0xe')]},{'unique':!![],'name':_0x7116('0xf'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x7116('0xd'),_0x7116('0x10')]},{'unique':!![],'name':_0x7116('0x11'),'fields':[_0x7116('0xd'),_0x7116('0x12')]},{'unique':!![],'name':_0x7116('0x13'),'fields':[_0x7116('0xd'),_0x7116('0x14')]},{'unique':!![],'name':_0x7116('0x15'),'fields':[_0x7116('0xd'),_0x7116('0x16')]},{'unique':!![],'name':_0x7116('0x17'),'fields':[_0x7116('0xd'),_0x7116('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 66fc795..d34c5dd 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(_0x414e30,_0x379e16){var _0x5d14c3=function(_0x114a5d){while(--_0x114a5d){_0x414e30['push'](_0x414e30['shift']());}};_0x5d14c3(++_0x379e16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x261928,_0x353595){var _0x5e3cbf=function(_0x343d43){while(--_0x343d43){_0x261928['push'](_0x261928['shift']());}};_0x5e3cbf(++_0x353595);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 8261eb1..31d98c8 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 _0x2af7=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x183279,_0x4e7670){var _0x50e121=function(_0x2508a0){while(--_0x2508a0){_0x183279['push'](_0x183279['shift']());}};_0x50e121(++_0x4e7670);}(_0x2af7,0x199));var _0x72af=function(_0x4b5b22,_0x2d93f5){_0x4b5b22=_0x4b5b22-0x0;var _0x2285e8=_0x2af7[_0x4b5b22];return _0x2285e8;};'use strict';var multer=require(_0x72af('0x0'));var util=require(_0x72af('0x1'));var path=require('path');var timeout=require(_0x72af('0x2'));var express=require(_0x72af('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x72af('0x4'));var interaction=require(_0x72af('0x5'));var config=require(_0x72af('0x6'));var controller=require(_0x72af('0x7'));router[_0x72af('0x8')]('/',auth[_0x72af('0x9')](),controller[_0x72af('0xa')]);router[_0x72af('0x8')](_0x72af('0xb'),auth[_0x72af('0x9')](),controller[_0x72af('0xc')]);router[_0x72af('0xd')]('/',auth['isAuthenticated'](),controller[_0x72af('0xe')]);router[_0x72af('0xf')](_0x72af('0xb'),auth[_0x72af('0x9')](),controller['update']);router[_0x72af('0x10')](_0x72af('0xb'),auth[_0x72af('0x9')](),controller[_0x72af('0x11')]);module[_0x72af('0x12')]=router; \ No newline at end of file +var _0xe1c1=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0xd980e8,_0x3595dd){var _0x1e421d=function(_0x576c05){while(--_0x576c05){_0xd980e8['push'](_0xd980e8['shift']());}};_0x1e421d(++_0x3595dd);}(_0xe1c1,0x95));var _0x1e1c=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0xe1c1[_0x311909];return _0x8d3163;};'use strict';var multer=require(_0x1e1c('0x0'));var util=require(_0x1e1c('0x1'));var path=require(_0x1e1c('0x2'));var timeout=require(_0x1e1c('0x3'));var express=require(_0x1e1c('0x4'));var router=express[_0x1e1c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1e1c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e1c('0x7'));var controller=require(_0x1e1c('0x8'));router[_0x1e1c('0x9')]('/',auth[_0x1e1c('0xa')](),controller['index']);router[_0x1e1c('0x9')](_0x1e1c('0xb'),auth[_0x1e1c('0xa')](),controller[_0x1e1c('0xc')]);router[_0x1e1c('0xd')]('/',auth[_0x1e1c('0xa')](),controller[_0x1e1c('0xe')]);router[_0x1e1c('0xf')](_0x1e1c('0xb'),auth[_0x1e1c('0xa')](),controller[_0x1e1c('0x10')]);router[_0x1e1c('0x11')](_0x1e1c('0xb'),auth[_0x1e1c('0xa')](),controller[_0x1e1c('0x12')]);module[_0x1e1c('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 9ea903e..7cce598 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 _0xe3da=['INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29'];(function(_0x138d06,_0x33edf2){var _0x1a01eb=function(_0x387acb){while(--_0x387acb){_0x138d06['push'](_0x138d06['shift']());}};_0x1a01eb(++_0x33edf2);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xae3d('0x0'));module[_0xae3d('0x1')]={'name':{'type':Sequelize[_0xae3d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xae3d('0x2')]},'ecm':{'type':Sequelize[_0xae3d('0x3')](_0xae3d('0x4'),'no'),'defaultValue':_0xae3d('0x4')},'headerinfo':{'type':Sequelize[_0xae3d('0x2')],'defaultValue':_0xae3d('0x5')},'localstationid':{'type':Sequelize[_0xae3d('0x2')],'unique':_0xae3d('0x6')},'minrate':{'type':Sequelize[_0xae3d('0x3')](_0xae3d('0x7'),_0xae3d('0x8'),_0xae3d('0x9'),_0xae3d('0xa'),'12000',_0xae3d('0xb')),'defaultValue':_0xae3d('0x8')},'maxrate':{'type':Sequelize['ENUM']('2400',_0xae3d('0x8'),_0xae3d('0x9'),_0xae3d('0xa'),_0xae3d('0xc'),_0xae3d('0xb')),'defaultValue':_0xae3d('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xae3d('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xae3d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xae3d('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xae3d('0x3')](_0xae3d('0xf'),'IAX',_0xae3d('0x10'),_0xae3d('0x11')),'defaultValue':_0xae3d('0xf')},'key':{'type':Sequelize[_0xae3d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xae3d('0x12')],'defaultValue':function(){return _0xae3d('0x13');}},'notificationSound':{'type':Sequelize[_0xae3d('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xae3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xae3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xae3d('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xae3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae3d('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xae3d('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xae3d('0x14')],'defaultValue':![],'comment':_0xae3d('0x16'),'set':function(_0x5303c2){if(!_0x5303c2)this[_0xae3d('0x17')](_0xae3d('0x18'),null);this['setDataValue']('mandatoryDisposition',_0x5303c2);}}}; \ No newline at end of file +var _0x814b=['SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','14400','4800','12000','INTEGER'];(function(_0x530933,_0x2dc117){var _0xb05cc6=function(_0xdb20e2){while(--_0xdb20e2){_0x530933['push'](_0x530933['shift']());}};_0xb05cc6(++_0x2dc117);}(_0x814b,0x1a2));var _0xb814=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x814b[_0x9e0cb3];return _0x5926b7;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb814('0x2')]},'ecm':{'type':Sequelize[_0xb814('0x3')](_0xb814('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xb814('0x2')],'defaultValue':_0xb814('0x5')},'localstationid':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x6')},'minrate':{'type':Sequelize[_0xb814('0x3')](_0xb814('0x7'),'4800',_0xb814('0x8'),_0xb814('0x9'),'12000',_0xb814('0xa')),'defaultValue':_0xb814('0xb')},'maxrate':{'type':Sequelize[_0xb814('0x3')](_0xb814('0x7'),_0xb814('0xb'),_0xb814('0x8'),_0xb814('0x9'),_0xb814('0xc'),_0xb814('0xa')),'defaultValue':_0xb814('0xa')},'modem':{'type':Sequelize[_0xb814('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xb814('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb814('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb814('0x3')](_0xb814('0xe'),_0xb814('0xf'),_0xb814('0x10'),_0xb814('0x11')),'defaultValue':_0xb814('0xe')},'key':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb814('0x12')],'defaultValue':function(){return _0xb814('0x13');}},'notificationSound':{'type':Sequelize[_0xb814('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb814('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb814('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb814('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb814('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb814('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb814('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb814('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb814('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xb814('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xb814('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x168a48){if(!_0x168a48)this['setDataValue'](_0xb814('0x16'),null);this[_0xb814('0x17')]('mandatoryDisposition',_0x168a48);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 1c49db5..9e9e05b 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 _0xdc54=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./faxAccount.socket','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','type','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','include','findAll','show','params','mandatoryDispositionPause','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','internal','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','minrate','modem','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','key','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','filename','Messages','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x3223e8,_0x5d1dc5){var _0x5aabcc=function(_0x125d53){while(--_0x125d53){_0x3223e8['push'](_0x3223e8['shift']());}};_0x5aabcc(++_0x5d1dc5);}(_0xdc54,0xb2));var _0x4dc5=function(_0x2e9855,_0xc91f78){_0x2e9855=_0x2e9855-0x0;var _0x2e8dfc=_0xdc54[_0x2e9855];return _0x2e8dfc;};'use strict';var emlformat=require(_0x4dc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dc5('0x1'));var jsonpatch=require(_0x4dc5('0x2'));var rp=require(_0x4dc5('0x3'));var moment=require(_0x4dc5('0x4'));var BPromise=require(_0x4dc5('0x5'));var Mustache=require(_0x4dc5('0x6'));var util=require(_0x4dc5('0x7'));var path=require('path');var sox=require(_0x4dc5('0x8'));var csv=require('to-csv');var ejs=require(_0x4dc5('0x9'));var fs=require('fs');var fs_extra=require(_0x4dc5('0xa'));var _=require(_0x4dc5('0xb'));var squel=require(_0x4dc5('0xc'));var crypto=require(_0x4dc5('0xd'));var jsforce=require(_0x4dc5('0xe'));var deskjs=require(_0x4dc5('0xf'));var toCsv=require(_0x4dc5('0x10'));var querystring=require(_0x4dc5('0x11'));var Papa=require('papaparse');var Redis=require(_0x4dc5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4dc5('0x13'));var as=require(_0x4dc5('0x14'));var hardwareService=require(_0x4dc5('0x15'));var logger=require(_0x4dc5('0x16'))(_0x4dc5('0x17'));var utils=require(_0x4dc5('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4dc5('0x19')]=_[_0x4dc5('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4dc5('0x1b'))(new Redis(config[_0x4dc5('0x19')]));require(_0x4dc5('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x4dc5('0x1d')][_0x4dc5('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x4dc5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5ef38e,_0x10485b,_0x1ccc17,_0x45ec03){return new BPromise(function(_0x50827b,_0x266637){var _0x4ee8dd=_0x45ec03||client;return _0x4ee8dd[_0x4dc5('0x1f')](_0x5ef38e,_0x1ccc17)[_0x4dc5('0x20')](function(_0x26349d){logger['info']('FaxAccount,\x20%s,\x20%s',_0x10485b,_0x4dc5('0x21'));logger[_0x4dc5('0x22')](_0x4dc5('0x23'),_0x10485b,_0x4dc5('0x21'),JSON[_0x4dc5('0x24')](_0x26349d));if(_0x26349d[_0x4dc5('0x25')]){if(_0x26349d['error'][_0x4dc5('0x26')]===0x1f4){logger[_0x4dc5('0x25')](_0x4dc5('0x27'),_0x10485b,_0x26349d[_0x4dc5('0x25')][_0x4dc5('0x28')]);return _0x266637(_0x26349d[_0x4dc5('0x25')][_0x4dc5('0x28')]);}logger[_0x4dc5('0x25')]('FaxAccount,\x20%s,\x20%s',_0x10485b,_0x26349d[_0x4dc5('0x25')][_0x4dc5('0x28')]);return _0x50827b(_0x26349d[_0x4dc5('0x25')][_0x4dc5('0x28')]);}else{logger[_0x4dc5('0x29')](_0x4dc5('0x27'),_0x10485b,_0x4dc5('0x21'));_0x50827b(_0x26349d[_0x4dc5('0x2a')]['message']);}})['catch'](function(_0x11d5ef){logger[_0x4dc5('0x25')](_0x4dc5('0x27'),_0x10485b,_0x11d5ef);_0x266637(_0x11d5ef);});});}function respondWithStatusCode(_0x53e98f,_0x39de69){_0x39de69=_0x39de69||0xcc;return function(_0x4c742f){if(_0x4c742f){return _0x53e98f[_0x4dc5('0x2b')](_0x39de69);}return _0x53e98f[_0x4dc5('0x2c')](_0x39de69)[_0x4dc5('0x2d')]();};}function respondWithResult(_0x1e53a7,_0x2af058){_0x2af058=_0x2af058||0xc8;return function(_0x16b82d){if(_0x16b82d){return _0x1e53a7['status'](_0x2af058)['json'](_0x16b82d);}};}function respondWithFilteredResult(_0x2c7445,_0x25bf80){return function(_0x18f89c){if(_0x18f89c){var _0x13a8a0=typeof _0x25bf80['offset']===_0x4dc5('0x2e')&&typeof _0x25bf80[_0x4dc5('0x2f')]===_0x4dc5('0x2e');var _0x3e3c37=_0x18f89c[_0x4dc5('0x30')];var _0x4a8f32=_0x13a8a0?0x0:_0x25bf80['offset'];var _0x702244=_0x13a8a0?_0x18f89c[_0x4dc5('0x30')]:_0x25bf80[_0x4dc5('0x31')]+_0x25bf80[_0x4dc5('0x2f')];var _0x50c55a;if(_0x702244>=_0x3e3c37){_0x702244=_0x3e3c37;_0x50c55a=0xc8;}else{_0x50c55a=0xce;}_0x2c7445[_0x4dc5('0x2c')](_0x50c55a);return _0x2c7445[_0x4dc5('0x32')](_0x4dc5('0x33'),_0x4a8f32+'-'+_0x702244+'/'+_0x3e3c37)[_0x4dc5('0x34')](_0x18f89c);}return null;};}function patchUpdates(_0x5d170b){return function(_0x12fe94){try{jsonpatch[_0x4dc5('0x35')](_0x12fe94,_0x5d170b,!![]);}catch(_0x2f6e1c){return BPromise['reject'](_0x2f6e1c);}return _0x12fe94[_0x4dc5('0x36')]();};}function saveUpdates(_0x39f175,_0x1e4a86){return function(_0x51fa7b){if(_0x51fa7b){return _0x51fa7b[_0x4dc5('0x37')](_0x39f175)[_0x4dc5('0x20')](function(_0x533868){return _0x533868;});}return null;};}function removeEntity(_0x2f6958,_0x552d8d){return function(_0x38b4b){if(_0x38b4b){return _0x38b4b[_0x4dc5('0x38')]()[_0x4dc5('0x20')](function(){var _0x58af46=_0x38b4b[_0x4dc5('0x39')]({'plain':!![]});var _0x25102d=_0x4dc5('0x3a');return db[_0x4dc5('0x3b')][_0x4dc5('0x38')]({'where':{'type':_0x25102d,'resourceId':_0x58af46['id']}})[_0x4dc5('0x20')](function(){return _0x38b4b;});})[_0x4dc5('0x20')](function(){_0x2f6958[_0x4dc5('0x2c')](0xcc)[_0x4dc5('0x2d')]();});}};}function handleEntityNotFound(_0x247e47,_0x5444f6){return function(_0x3c6d2b){if(!_0x3c6d2b){_0x247e47[_0x4dc5('0x2b')](0x194);}return _0x3c6d2b;};}function handleError(_0x242cb7,_0x186093){_0x186093=_0x186093||0x1f4;return function(_0x3b8ec3){logger[_0x4dc5('0x25')](_0x3b8ec3[_0x4dc5('0x3c')]);if(_0x3b8ec3[_0x4dc5('0x3d')]){delete _0x3b8ec3[_0x4dc5('0x3d')];}_0x242cb7['status'](_0x186093)[_0x4dc5('0x3e')](_0x3b8ec3);};}exports[_0x4dc5('0x3f')]=function(_0x3e20b6,_0x141d4b){var _0x494f75={'include':[{'model':db[_0x4dc5('0x40')],'as':'mandatoryDispositionPause'}]},_0x4b1b41={},_0x369af7={'count':0x0,'rows':[]};var _0x5cf7d3=_[_0x4dc5('0x41')](db['FaxAccount'][_0x4dc5('0x42')],function(_0x488deb){return{'name':_0x488deb['fieldName'],'type':_0x488deb[_0x4dc5('0x43')]['key']};});_0x4b1b41[_0x4dc5('0x44')]=_['map'](_0x5cf7d3,_0x4dc5('0x3d'));_0x4b1b41[_0x4dc5('0x45')]=_['keys'](_0x3e20b6[_0x4dc5('0x45')]);_0x4b1b41['filters']=_['intersection'](_0x4b1b41[_0x4dc5('0x44')],_0x4b1b41[_0x4dc5('0x45')]);_0x494f75[_0x4dc5('0x46')]=_[_0x4dc5('0x47')](_0x4b1b41[_0x4dc5('0x44')],qs[_0x4dc5('0x48')](_0x3e20b6[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0x494f75['attributes']=_0x494f75['attributes'][_0x4dc5('0x49')]?_0x494f75[_0x4dc5('0x46')]:_0x4b1b41['model'];if(!_0x3e20b6[_0x4dc5('0x45')]['hasOwnProperty'](_0x4dc5('0x4a'))){_0x494f75[_0x4dc5('0x2f')]=qs['limit'](_0x3e20b6['query'][_0x4dc5('0x2f')]);_0x494f75[_0x4dc5('0x31')]=qs[_0x4dc5('0x31')](_0x3e20b6[_0x4dc5('0x45')]['offset']);}_0x494f75[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x3e20b6[_0x4dc5('0x45')]['sort']);_0x494f75[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_[_0x4dc5('0x4f')](_0x3e20b6[_0x4dc5('0x45')],_0x4b1b41[_0x4dc5('0x4e')]),_0x5cf7d3);if(_0x3e20b6['query'][_0x4dc5('0x50')]){_0x494f75['where']=_[_0x4dc5('0x51')](_0x494f75[_0x4dc5('0x4d')],{'$or':_['map'](_0x5cf7d3,function(_0x38eb12){if(_0x38eb12['type']!==_0x4dc5('0x52')){var _0x1dab66={};_0x1dab66[_0x38eb12[_0x4dc5('0x3d')]]={'$like':'%'+_0x3e20b6[_0x4dc5('0x45')][_0x4dc5('0x50')]+'%'};return _0x1dab66;}})});}_0x494f75=_[_0x4dc5('0x51')]({},_0x494f75,_0x3e20b6['options']);var _0x339a5d={'where':_0x494f75[_0x4dc5('0x4d')]};return db[_0x4dc5('0x53')][_0x4dc5('0x30')](_0x339a5d)[_0x4dc5('0x20')](function(_0x984b01){_0x369af7[_0x4dc5('0x30')]=_0x984b01;if(_0x3e20b6[_0x4dc5('0x45')][_0x4dc5('0x54')]){_0x494f75[_0x4dc5('0x55')]=[{'all':!![]}];}return db[_0x4dc5('0x53')][_0x4dc5('0x56')](_0x494f75);})[_0x4dc5('0x20')](function(_0x37ee68){_0x369af7['rows']=_0x37ee68;return _0x369af7;})[_0x4dc5('0x20')](respondWithFilteredResult(_0x141d4b,_0x494f75))['catch'](handleError(_0x141d4b,null));};exports[_0x4dc5('0x57')]=function(_0x1b7fc6,_0x24d601){var _0xcb8cab={'raw':![],'where':{'id':_0x1b7fc6[_0x4dc5('0x58')]['id']},'include':[{'model':db[_0x4dc5('0x40')],'as':_0x4dc5('0x59')}]},_0x486185={};_0x486185['model']=_['keys'](db[_0x4dc5('0x53')][_0x4dc5('0x42')]);_0x486185['query']=_[_0x4dc5('0x5a')](_0x1b7fc6[_0x4dc5('0x45')]);_0x486185['filters']=_[_0x4dc5('0x47')](_0x486185[_0x4dc5('0x44')],_0x486185[_0x4dc5('0x45')]);_0xcb8cab['attributes']=_[_0x4dc5('0x47')](_0x486185[_0x4dc5('0x44')],qs[_0x4dc5('0x48')](_0x1b7fc6[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0xcb8cab[_0x4dc5('0x46')]=_0xcb8cab[_0x4dc5('0x46')][_0x4dc5('0x49')]?_0xcb8cab[_0x4dc5('0x46')]:_0x486185[_0x4dc5('0x44')];if(_0x1b7fc6[_0x4dc5('0x45')][_0x4dc5('0x54')]){_0xcb8cab['include']=[{'all':!![]}];}_0xcb8cab=_[_0x4dc5('0x51')]({},_0xcb8cab,_0x1b7fc6[_0x4dc5('0x5b')]);return db['FaxAccount'][_0x4dc5('0x5c')](_0xcb8cab)[_0x4dc5('0x20')](handleEntityNotFound(_0x24d601,null))['then'](respondWithResult(_0x24d601,null))['catch'](handleError(_0x24d601,null));};exports[_0x4dc5('0x5d')]=function(_0x42fc36,_0xc4bb01){return db[_0x4dc5('0x53')][_0x4dc5('0x5d')](_0x42fc36[_0x4dc5('0x5e')],{})[_0x4dc5('0x20')](function(_0x517c56){var _0x51e2b8=_0x42fc36[_0x4dc5('0x5f')][_0x4dc5('0x39')]({'plain':!![]});if(!_0x51e2b8)throw new Error(_0x4dc5('0x60'));if(_0x51e2b8[_0x4dc5('0x61')]===_0x4dc5('0x5f')){var _0x2cbab9=_0x517c56[_0x4dc5('0x39')]({'plain':!![]});var _0x12f925=_0x4dc5('0x3a');return db[_0x4dc5('0x62')][_0x4dc5('0x5c')]({'where':{'name':_0x12f925,'userProfileId':_0x51e2b8[_0x4dc5('0x63')]},'raw':!![]})['then'](function(_0x7003e9){if(_0x7003e9&&_0x7003e9[_0x4dc5('0x64')]===0x0){return db['UserProfileResource'][_0x4dc5('0x5d')]({'name':_0x2cbab9[_0x4dc5('0x3d')],'resourceId':_0x2cbab9['id'],'type':_0x7003e9['name'],'sectionId':_0x7003e9['id']},{})[_0x4dc5('0x20')](function(){return _0x517c56;});}else{return _0x517c56;}})[_0x4dc5('0x65')](function(_0xf7c43a){logger[_0x4dc5('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf7c43a);throw _0xf7c43a;});}return _0x517c56;})[_0x4dc5('0x20')](respondWithResult(_0xc4bb01,0xc9))[_0x4dc5('0x65')](handleError(_0xc4bb01,null));};exports['update']=function(_0x121c08,_0x3fe962){if(_0x121c08[_0x4dc5('0x5e')]['id']){delete _0x121c08[_0x4dc5('0x5e')]['id'];}return db['FaxAccount'][_0x4dc5('0x5c')]({'where':{'id':_0x121c08['params']['id']},'include':[{'model':db['Pause'],'as':_0x4dc5('0x59')}]})[_0x4dc5('0x20')](handleEntityNotFound(_0x3fe962,null))[_0x4dc5('0x20')](saveUpdates(_0x121c08['body'],null))[_0x4dc5('0x20')](respondWithResult(_0x3fe962,null))[_0x4dc5('0x65')](handleError(_0x3fe962,null));};exports[_0x4dc5('0x38')]=function(_0x5545a8,_0x2e66e0){return db['FaxAccount'][_0x4dc5('0x5c')]({'where':{'id':_0x5545a8['params']['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x2e66e0,null))['then'](removeEntity(_0x2e66e0,null))['catch'](handleError(_0x2e66e0,null));};exports['describe']=function(_0x2bf117,_0xe028d5){return db[_0x4dc5('0x53')][_0x4dc5('0x66')]()['then'](respondWithResult(_0xe028d5,null))['catch'](handleError(_0xe028d5,null));};exports[_0x4dc5('0x67')]=function(_0x39c5ee,_0x128de2,_0x1e8a5a){if(_0x39c5ee[_0x4dc5('0x5e')]['id']){delete _0x39c5ee['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x39c5ee['params']['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x128de2,null))['then'](function(_0x57722d){if(_0x57722d){_0x39c5ee['body'][_0x4dc5('0x68')]=_0x57722d['id'];return db['Disposition'][_0x4dc5('0x5d')](_0x39c5ee['body']);}})[_0x4dc5('0x20')](respondWithResult(_0x128de2,null))['catch'](handleError(_0x128de2,null));};exports[_0x4dc5('0x69')]=function(_0x756668,_0x337395,_0x32617a){var _0x429ea6={'raw':![],'where':{}};var _0x1dfd2b={};var _0x4f7354={'count':0x0,'rows':[]};return db[_0x4dc5('0x53')][_0x4dc5('0x6a')]({'where':{'id':_0x756668[_0x4dc5('0x58')]['id']}})['then'](handleEntityNotFound(_0x337395,null))['then'](function(_0x408623){if(_0x408623){_0x1dfd2b[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0x6b')][_0x4dc5('0x42')]);_0x1dfd2b[_0x4dc5('0x45')]=_['keys'](_0x756668[_0x4dc5('0x45')]);_0x1dfd2b[_0x4dc5('0x4e')]=_[_0x4dc5('0x47')](_0x1dfd2b[_0x4dc5('0x44')],_0x1dfd2b[_0x4dc5('0x45')]);_0x429ea6[_0x4dc5('0x46')]=_[_0x4dc5('0x47')](_0x1dfd2b[_0x4dc5('0x44')],qs['fields'](_0x756668[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0x429ea6[_0x4dc5('0x46')]=_0x429ea6['attributes'][_0x4dc5('0x49')]?_0x429ea6['attributes']:_0x1dfd2b['model'];if(!_0x756668[_0x4dc5('0x45')][_0x4dc5('0x6c')](_0x4dc5('0x4a'))){_0x429ea6['limit']=qs[_0x4dc5('0x2f')](_0x756668['query'][_0x4dc5('0x2f')]);_0x429ea6[_0x4dc5('0x31')]=qs['offset'](_0x756668[_0x4dc5('0x45')][_0x4dc5('0x31')]);}_0x429ea6[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x756668[_0x4dc5('0x45')][_0x4dc5('0x4c')]);_0x429ea6[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_['pick'](_0x756668[_0x4dc5('0x45')],_0x1dfd2b[_0x4dc5('0x4e')]));_0x429ea6[_0x4dc5('0x4d')]['FaxAccountId']=_0x408623['id'];if(_0x756668[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x429ea6[_0x4dc5('0x4d')]=_[_0x4dc5('0x51')](_0x429ea6[_0x4dc5('0x4d')],{'$or':_[_0x4dc5('0x41')](_0x429ea6[_0x4dc5('0x46')],function(_0x46864e){var _0x1a41b3={};_0x1a41b3[_0x46864e]={'$like':'%'+_0x756668[_0x4dc5('0x45')][_0x4dc5('0x50')]+'%'};return _0x1a41b3;})});}_0x429ea6=_[_0x4dc5('0x51')]({},_0x429ea6,_0x756668[_0x4dc5('0x5b')]);return db['Disposition'][_0x4dc5('0x30')]({'where':_0x429ea6[_0x4dc5('0x4d')]})[_0x4dc5('0x20')](function(_0x4ba688){_0x4f7354[_0x4dc5('0x30')]=_0x4ba688;if(_0x756668['query'][_0x4dc5('0x54')]){_0x429ea6[_0x4dc5('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x4dc5('0x56')](_0x429ea6);})[_0x4dc5('0x20')](function(_0x3f97a6){_0x4f7354['rows']=_0x3f97a6;return _0x4f7354;});}})[_0x4dc5('0x20')](respondWithFilteredResult(_0x337395,_0x429ea6))[_0x4dc5('0x65')](handleError(_0x337395,null));};exports[_0x4dc5('0x6d')]=function(_0x5ec462,_0x5acf18,_0x5a3262){return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x5ec462[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x5acf18,null))[_0x4dc5('0x20')](function(_0x4b5ed2){if(_0x4b5ed2){return _0x4b5ed2[_0x4dc5('0x6d')](_0x5ec462[_0x4dc5('0x45')][_0x4dc5('0x6e')]);}})[_0x4dc5('0x20')](respondWithStatusCode(_0x5acf18,null))[_0x4dc5('0x65')](handleError(_0x5acf18,null));};exports[_0x4dc5('0x6f')]=function(_0x125cf4,_0x5ed515,_0x3aee04){if(_0x125cf4[_0x4dc5('0x5e')]['id']){delete _0x125cf4[_0x4dc5('0x5e')]['id'];}return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x125cf4[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x5ed515,null))[_0x4dc5('0x20')](function(_0x9a503b){if(_0x9a503b){_0x125cf4[_0x4dc5('0x5e')][_0x4dc5('0x68')]=_0x9a503b['id'];return db[_0x4dc5('0x70')][_0x4dc5('0x5d')](_0x125cf4[_0x4dc5('0x5e')]);}})[_0x4dc5('0x20')](respondWithResult(_0x5ed515,null))[_0x4dc5('0x65')](handleError(_0x5ed515,null));};exports[_0x4dc5('0x71')]=function(_0x16cf0e,_0x4d6051,_0x50b9c1){var _0x5c8352={'raw':![],'where':{}};var _0x231bc5={};var _0x4293ae={'count':0x0,'rows':[]};return db[_0x4dc5('0x53')][_0x4dc5('0x6a')]({'where':{'id':_0x16cf0e[_0x4dc5('0x58')]['id']}})['then'](handleEntityNotFound(_0x4d6051,null))[_0x4dc5('0x20')](function(_0x3b3c2a){if(_0x3b3c2a){_0x231bc5[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0x70')]['rawAttributes']);_0x231bc5[_0x4dc5('0x45')]=_['keys'](_0x16cf0e['query']);_0x231bc5[_0x4dc5('0x4e')]=_[_0x4dc5('0x47')](_0x231bc5[_0x4dc5('0x44')],_0x231bc5['query']);_0x5c8352['attributes']=_['intersection'](_0x231bc5[_0x4dc5('0x44')],qs[_0x4dc5('0x48')](_0x16cf0e[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0x5c8352[_0x4dc5('0x46')]=_0x5c8352[_0x4dc5('0x46')][_0x4dc5('0x49')]?_0x5c8352['attributes']:_0x231bc5['model'];if(!_0x16cf0e[_0x4dc5('0x45')]['hasOwnProperty']('nolimit')){_0x5c8352[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x16cf0e[_0x4dc5('0x45')][_0x4dc5('0x2f')]);_0x5c8352['offset']=qs[_0x4dc5('0x31')](_0x16cf0e[_0x4dc5('0x45')]['offset']);}_0x5c8352[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x16cf0e['query'][_0x4dc5('0x4c')]);_0x5c8352[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_['pick'](_0x16cf0e[_0x4dc5('0x45')],_0x231bc5[_0x4dc5('0x4e')]));_0x5c8352['where'][_0x4dc5('0x68')]=_0x3b3c2a['id'];if(_0x16cf0e[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x5c8352[_0x4dc5('0x4d')]=_[_0x4dc5('0x51')](_0x5c8352['where'],{'$or':_['map'](_0x5c8352[_0x4dc5('0x46')],function(_0x5a7f77){var _0x1b3316={};_0x1b3316[_0x5a7f77]={'$like':'%'+_0x16cf0e[_0x4dc5('0x45')][_0x4dc5('0x50')]+'%'};return _0x1b3316;})});}_0x5c8352=_['merge']({},_0x5c8352,_0x16cf0e['options']);return db[_0x4dc5('0x70')][_0x4dc5('0x30')]({'where':_0x5c8352[_0x4dc5('0x4d')]})[_0x4dc5('0x20')](function(_0x8b5217){_0x4293ae[_0x4dc5('0x30')]=_0x8b5217;if(_0x16cf0e['query'][_0x4dc5('0x54')]){_0x5c8352[_0x4dc5('0x55')]=[{'all':!![]}];}return db[_0x4dc5('0x70')]['findAll'](_0x5c8352);})[_0x4dc5('0x20')](function(_0xd02a02){_0x4293ae[_0x4dc5('0x72')]=_0xd02a02;return _0x4293ae;});}})['then'](respondWithFilteredResult(_0x4d6051,_0x5c8352))[_0x4dc5('0x65')](handleError(_0x4d6051,null));};exports[_0x4dc5('0x73')]=function(_0x4917ee,_0x2feeff,_0x3807ee){return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x4917ee[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x2feeff,null))[_0x4dc5('0x20')](function(_0x2da198){if(_0x2da198){return _0x2da198[_0x4dc5('0x73')](_0x4917ee[_0x4dc5('0x45')][_0x4dc5('0x6e')]);}})[_0x4dc5('0x20')](respondWithStatusCode(_0x2feeff,null))[_0x4dc5('0x65')](handleError(_0x2feeff,null));};exports[_0x4dc5('0x74')]=function(_0x1d9ae4,_0x35faf3,_0x5531b3){return db[_0x4dc5('0x75')][_0x4dc5('0x5c')]({'where':{'id':_0x1d9ae4[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x35faf3,null))[_0x4dc5('0x20')](function(_0x3fde66){if(_0x3fde66){return _0x3fde66[_0x4dc5('0x74')](_0x1d9ae4[_0x4dc5('0x5e')][_0x4dc5('0x6e')],_[_0x4dc5('0x76')](_0x1d9ae4[_0x4dc5('0x5e')],['ids','id'])||{});}})[_0x4dc5('0x20')](respondWithResult(_0x35faf3,null))['catch'](handleError(_0x35faf3,null));};exports[_0x4dc5('0x77')]=function(_0x39aabe,_0x44d3cb,_0x388d98){var _0x30c107={'raw':![],'where':{}};var _0x20b0e7={};var _0x589f8e={'count':0x0,'rows':[]};return db[_0x4dc5('0x53')][_0x4dc5('0x6a')]({'where':{'id':_0x39aabe[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x44d3cb,null))[_0x4dc5('0x20')](function(_0x301c28){if(_0x301c28){_0x20b0e7[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0x75')][_0x4dc5('0x42')]);_0x20b0e7['query']=_[_0x4dc5('0x5a')](_0x39aabe[_0x4dc5('0x45')]);_0x20b0e7[_0x4dc5('0x4e')]=_[_0x4dc5('0x47')](_0x20b0e7[_0x4dc5('0x44')],_0x20b0e7[_0x4dc5('0x45')]);_0x30c107['attributes']=_[_0x4dc5('0x47')](_0x20b0e7['model'],qs[_0x4dc5('0x48')](_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0x30c107[_0x4dc5('0x46')]=_0x30c107[_0x4dc5('0x46')][_0x4dc5('0x49')]?_0x30c107[_0x4dc5('0x46')]:_0x20b0e7[_0x4dc5('0x44')];if(!_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x6c')](_0x4dc5('0x4a'))){_0x30c107[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x2f')]);_0x30c107[_0x4dc5('0x31')]=qs[_0x4dc5('0x31')](_0x39aabe[_0x4dc5('0x45')]['offset']);}_0x30c107[_0x4dc5('0x4b')]=qs['sort'](_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x4c')]);_0x30c107[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_[_0x4dc5('0x4f')](_0x39aabe['query'],_0x20b0e7[_0x4dc5('0x4e')]));_0x30c107[_0x4dc5('0x4d')][_0x4dc5('0x68')]=_0x301c28['id'];if(_0x39aabe[_0x4dc5('0x45')]['filter']){_0x30c107[_0x4dc5('0x4d')]=_['merge'](_0x30c107['where'],{'$or':_[_0x4dc5('0x41')](_0x30c107[_0x4dc5('0x46')],function(_0x31078b){var _0x100c87={};_0x100c87[_0x31078b]={'$like':'%'+_0x39aabe[_0x4dc5('0x45')]['filter']+'%'};return _0x100c87;})});}_0x30c107=_['merge']({},_0x30c107,_0x39aabe[_0x4dc5('0x5b')]);return db[_0x4dc5('0x75')][_0x4dc5('0x30')]({'where':_0x30c107[_0x4dc5('0x4d')]})['then'](function(_0x1b3bb0){_0x589f8e['count']=_0x1b3bb0;if(_0x39aabe[_0x4dc5('0x45')]['includeAll']){_0x30c107[_0x4dc5('0x55')]=[{'model':db[_0x4dc5('0x78')],'as':_0x4dc5('0x79'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x4dc5('0x3d'),'fullname',_0x4dc5('0x7a')],'required':![]},{'model':db['Tag'],'as':_0x4dc5('0x7b'),'attributes':['id',_0x4dc5('0x3d'),_0x4dc5('0x7c')],'where':_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x7d')]?{'id':_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x7d')]}:undefined,'required':_0x39aabe[_0x4dc5('0x45')]['tag']?!![]:![]}];}return db[_0x4dc5('0x75')][_0x4dc5('0x56')](_0x30c107);})[_0x4dc5('0x20')](function(_0x2ad131){_0x589f8e[_0x4dc5('0x72')]=_0x2ad131;return _0x589f8e;});}})[_0x4dc5('0x20')](respondWithFilteredResult(_0x44d3cb,_0x30c107))[_0x4dc5('0x65')](handleError(_0x44d3cb,null));};exports[_0x4dc5('0x7e')]=function(_0x291350,_0x4f3ce5){var _0x410bb5=_0x291350['params']['id'];var _0x1954e5=_0x291350[_0x4dc5('0x5e')];var _0x42ace1=0xc8;var _0x1a8c78=null;return db[_0x4dc5('0x7f')][_0x4dc5('0x80')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x35e90){return db[_0x4dc5('0x53')]['findOne']({'where':{'id':_0x410bb5},'transaction':_0x35e90})[_0x4dc5('0x20')](function(_0x2f512a){if(_0x2f512a){return db[_0x4dc5('0x81')][_0x4dc5('0x38')]({'where':{'FaxAccountId':_0x410bb5},'transaction':_0x35e90})[_0x4dc5('0x20')](function(){var _0x11c83d=_['map'](_0x1954e5,function(_0x1371e0){_0x1371e0['FaxAccountId']=_0x410bb5;return _0x1371e0;});return db['FaxApplication'][_0x4dc5('0x82')](_0x11c83d,{'transaction':_0x35e90});});}else{_0x42ace1=0x194;_0x1a8c78=[];}});})['then'](function(){if(_0x42ace1!==0x194){return db[_0x4dc5('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x410bb5},'order':_0x4dc5('0x83')})['then'](function(_0x9b571a){_0x1a8c78=_0x9b571a;});}})['catch'](function(_0x5da81d){_0x42ace1=0x1f4;logger['error'](_0x5da81d[_0x4dc5('0x3c')]);if(_0x5da81d[_0x4dc5('0x3d')]){delete _0x5da81d[_0x4dc5('0x3d')];}_0x1a8c78=_0x5da81d;})['finally'](function(){if(_0x1a8c78===null){_0x4f3ce5['sendStatus'](_0x42ace1);}else{if(_0x42ace1===0x1f4){_0x4f3ce5[_0x4dc5('0x2c')](_0x42ace1)[_0x4dc5('0x3e')](_0x1a8c78);}else{_0x4f3ce5['status'](_0x42ace1)['json'](_0x1a8c78);}}});};exports[_0x4dc5('0x84')]=function(_0x59d1a2,_0x20d2a4,_0x42d080){var _0x70a9e5={};var _0x57f9a3={};var _0x53806c;var _0x157166;return db['FaxAccount'][_0x4dc5('0x6a')]({'where':{'id':_0x59d1a2['params']['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x20d2a4,null))[_0x4dc5('0x20')](function(_0x28e14c){if(_0x28e14c){_0x53806c=_0x28e14c;_0x57f9a3['model']=_[_0x4dc5('0x5a')](db[_0x4dc5('0x81')]['rawAttributes']);_0x57f9a3[_0x4dc5('0x45')]=_[_0x4dc5('0x5a')](_0x59d1a2[_0x4dc5('0x45')]);_0x57f9a3[_0x4dc5('0x4e')]=_[_0x4dc5('0x47')](_0x57f9a3[_0x4dc5('0x44')],_0x57f9a3[_0x4dc5('0x45')]);_0x70a9e5[_0x4dc5('0x46')]=_[_0x4dc5('0x47')](_0x57f9a3[_0x4dc5('0x44')],qs[_0x4dc5('0x48')](_0x59d1a2['query'][_0x4dc5('0x48')]));_0x70a9e5['attributes']=_0x70a9e5[_0x4dc5('0x46')]['length']?_0x70a9e5[_0x4dc5('0x46')]:_0x57f9a3['model'];_0x70a9e5[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x59d1a2[_0x4dc5('0x45')][_0x4dc5('0x4c')]);_0x70a9e5[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_[_0x4dc5('0x4f')](_0x59d1a2[_0x4dc5('0x45')],_0x57f9a3[_0x4dc5('0x4e')]));if(_0x59d1a2[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x70a9e5[_0x4dc5('0x4d')]=_[_0x4dc5('0x51')](_0x70a9e5[_0x4dc5('0x4d')],{'$or':_['map'](_0x70a9e5[_0x4dc5('0x46')],function(_0x4ca8a0){var _0x55a472={};_0x55a472[_0x4ca8a0]={'$like':'%'+_0x59d1a2['query'][_0x4dc5('0x50')]+'%'};return _0x55a472;})});}_0x70a9e5=_[_0x4dc5('0x51')]({},_0x70a9e5,_0x59d1a2[_0x4dc5('0x5b')]);return _0x53806c[_0x4dc5('0x84')](_0x70a9e5);}})[_0x4dc5('0x20')](function(_0x537eaa){if(_0x537eaa){_0x157166=_0x537eaa[_0x4dc5('0x49')];if(!_0x59d1a2['query']['hasOwnProperty']('nolimit')){_0x70a9e5[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x59d1a2[_0x4dc5('0x45')][_0x4dc5('0x2f')]);_0x70a9e5['offset']=qs['offset'](_0x59d1a2[_0x4dc5('0x45')][_0x4dc5('0x31')]);}return _0x53806c[_0x4dc5('0x84')](_0x70a9e5);}})[_0x4dc5('0x20')](function(_0x14bd93){if(_0x14bd93){return _0x14bd93?{'count':_0x157166,'rows':_0x14bd93}:null;}})[_0x4dc5('0x20')](respondWithResult(_0x20d2a4,null))[_0x4dc5('0x65')](handleError(_0x20d2a4,null));};function Extension(_0x45092b,_0x94f887,_0x249e81,_0x53cf8d){this[_0x4dc5('0x85')]='from-voip-provider';this[_0x4dc5('0x86')]=_0x45092b[_0x4dc5('0x87')];this[_0x4dc5('0x88')]=_0x53cf8d;this[_0x4dc5('0x43')]=_0x4dc5('0x89');this[_0x4dc5('0x8a')]=_0x4dc5('0x8b');this[_0x4dc5('0x68')]=_0x45092b['id'];this['priority']=_0x94f887;this[_0x4dc5('0x8c')]=_0x249e81;}function createExtensionsReciveFax(_0x5eb84a){var _0x35507f=0x1;var _0x19dd48=[];_0x19dd48[_0x4dc5('0x8d')](new Extension(_0x5eb84a,_0x35507f,'',_0x4dc5('0x8e')));_0x35507f+=0x1;_0x19dd48['push'](new Extension(_0x5eb84a,_0x35507f,_0x4dc5('0x8f'),_0x4dc5('0x90')));_0x35507f+=0x1;for(var _0x54a658 in _0x5eb84a){if(_0x5eb84a[_0x4dc5('0x6c')](_0x54a658)&&(_0x54a658===_0x4dc5('0x91')||_0x54a658===_0x4dc5('0x87')||_0x54a658===_0x4dc5('0x92')||_0x54a658==='faxdetect'||_0x54a658===_0x4dc5('0x93')||_0x54a658==='maxrate'||_0x54a658===_0x4dc5('0x94')||_0x54a658===_0x4dc5('0x95')||_0x54a658==='t38timeout')){_0x19dd48['push'](new Extension(_0x5eb84a,_0x35507f,'FAXOPT('+_0x54a658+')='+_0x5eb84a[_0x54a658],_0x4dc5('0x90')));_0x35507f+=0x1;}}_0x19dd48[_0x4dc5('0x8d')](new Extension(_0x5eb84a,_0x35507f,'6',_0x4dc5('0x96')));_0x35507f+=0x1;_0x19dd48[_0x4dc5('0x8d')](new Extension(_0x5eb84a,_0x35507f,'/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',_0x4dc5('0x97')));_0x35507f=0x0;return _0x19dd48;}exports[_0x4dc5('0x98')]=function(_0x1703f0,_0x5ae7d9,_0x1b5018){var _0x5b01b2;return db[_0x4dc5('0x7f')]['transaction'](function(_0x4a7cf1){return db['FaxAccount'][_0x4dc5('0x5d')](_0x1703f0[_0x4dc5('0x5e')],{'transaction':_0x4a7cf1})[_0x4dc5('0x20')](function(_0x213a1d){_0x5b01b2=_0x213a1d[_0x4dc5('0x39')]({'plain':!![]});return db[_0x4dc5('0x99')][_0x4dc5('0x82')](createExtensionsReciveFax(_0x5b01b2),{'transaction':_0x4a7cf1});});})['then'](function(){return _0x5b01b2;})['then'](respondWithResult(_0x5ae7d9,null))[_0x4dc5('0x65')](handleError(_0x5ae7d9,null));};exports[_0x4dc5('0x9a')]=function(_0x340dbd,_0x5a25d4,_0x379c78){var _0x306761;return db[_0x4dc5('0x7f')][_0x4dc5('0x80')](function(_0x591fc5){return db['FaxAccount'][_0x4dc5('0x37')](_0x340dbd['body'],{'where':{'id':_0x340dbd[_0x4dc5('0x5e')]['id']},'transaction':_0x591fc5})[_0x4dc5('0x20')](function(_0x568fdb){return db[_0x4dc5('0x99')][_0x4dc5('0x38')]({'where':{'FaxAccountId':_0x340dbd[_0x4dc5('0x5e')]['id']},'transaction':_0x591fc5})[_0x4dc5('0x20')](function(_0x150fa9){return db[_0x4dc5('0x99')][_0x4dc5('0x82')](createExtensionsReciveFax(_[_0x4dc5('0x76')](_0x340dbd[_0x4dc5('0x5e')],['tech',_0x4dc5('0x9b'),'createdAt',_0x4dc5('0x9c'),_0x4dc5('0x9d'),_0x4dc5('0x9e')])),{'transaction':_0x591fc5});});});})[_0x4dc5('0x20')](function(){return db[_0x4dc5('0x53')][_0x4dc5('0x9f')](_0x340dbd[_0x4dc5('0x5e')]['id']);})[_0x4dc5('0x20')](respondWithResult(_0x5a25d4,null))[_0x4dc5('0x65')](handleError(_0x5a25d4,null));};exports['getMessages']=function(_0x24e6d0,_0x3b39b6,_0x209542){var _0x4b911a={'raw':!![],'where':{}};var _0x2e2b63={};var _0x47d27d={'count':0x0,'rows':[]};return db[_0x4dc5('0x53')][_0x4dc5('0x6a')]({'where':{'id':_0x24e6d0[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x3b39b6,null))[_0x4dc5('0x20')](function(_0x3eb77e){if(_0x3eb77e){_0x2e2b63[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0xa0')][_0x4dc5('0x42')]);_0x2e2b63[_0x4dc5('0x45')]=_[_0x4dc5('0x5a')](_0x24e6d0[_0x4dc5('0x45')]);_0x2e2b63['filters']=_['intersection'](_0x2e2b63['model'],_0x2e2b63[_0x4dc5('0x45')]);_0x4b911a['attributes']=_[_0x4dc5('0x47')](_0x2e2b63['model'],qs[_0x4dc5('0x48')](_0x24e6d0['query']['fields']));_0x4b911a[_0x4dc5('0x46')]=_0x4b911a[_0x4dc5('0x46')][_0x4dc5('0x49')]?_0x4b911a[_0x4dc5('0x46')]:_0x2e2b63[_0x4dc5('0x44')];if(!_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0x6c')](_0x4dc5('0x4a'))){_0x4b911a[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x24e6d0['query']['limit']);_0x4b911a[_0x4dc5('0x31')]=qs['offset'](_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0x31')]);}_0x4b911a[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x24e6d0['query'][_0x4dc5('0x4c')]);_0x4b911a[_0x4dc5('0x4d')]=qs['filters'](_['pick'](_0x24e6d0[_0x4dc5('0x45')],_0x2e2b63[_0x4dc5('0x4e')]));_0x4b911a[_0x4dc5('0x4d')][_0x4dc5('0x68')]=_0x3eb77e['id'];if(_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x4b911a[_0x4dc5('0x4d')]=_[_0x4dc5('0x51')](_0x4b911a['where'],{'$or':_[_0x4dc5('0x41')](_0x4b911a['attributes'],function(_0x43d01b){var _0x119c0c={};_0x119c0c[_0x43d01b]={'$like':'%'+_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0x50')]+'%'};return _0x119c0c;})});}if(_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0xa1')]){var _0x1935cd=_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0xa1')][_0x4dc5('0xa2')](',');var _0x19357a={};_0x19357a[_0x1935cd[0x0]]={'$gte':moment(_0x1935cd[0x1])[_0x4dc5('0xa3')](_0x4dc5('0xa4'))};_0x4b911a[_0x4dc5('0x4d')]=_['merge'](_0x4b911a[_0x4dc5('0x4d')],_0x19357a);}_0x4b911a=_[_0x4dc5('0x51')]({},_0x4b911a,_0x24e6d0[_0x4dc5('0x5b')]);return db[_0x4dc5('0xa0')][_0x4dc5('0x30')]({'where':_0x4b911a[_0x4dc5('0x4d')]})[_0x4dc5('0x20')](function(_0x4a6f15){_0x47d27d[_0x4dc5('0x30')]=_0x4a6f15;if(_0x24e6d0['query'][_0x4dc5('0x54')]){_0x4b911a[_0x4dc5('0x55')]=[{'all':!![]}];}return db[_0x4dc5('0xa0')]['findAll'](_0x4b911a);})[_0x4dc5('0x20')](function(_0x538252){_0x47d27d[_0x4dc5('0x72')]=_0x538252;return _0x47d27d;});}})['then'](respondWithFilteredResult(_0x3b39b6,_0x4b911a))[_0x4dc5('0x65')](handleError(_0x3b39b6,null));};exports[_0x4dc5('0x3e')]=function(_0x2bebe6,_0x3c9ddd,_0x2a8bac){var _0x2cab83,_0x3efbea={},_0x404f9f;if(_0x2bebe6[_0x4dc5('0x5e')]['to']){_0x404f9f=_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0];}return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x2bebe6[_0x4dc5('0x58')]['id']},'include':[{'model':db[_0x4dc5('0xa5')],'as':_0x4dc5('0xa6'),'include':[{'model':db['CmContact'],'as':_0x4dc5('0xa7'),'where':{'fax':_0x404f9f},'limit':0x1,'order':[[_0x4dc5('0x9c'),'DESC']]}]}]})[_0x4dc5('0x20')](handleEntityNotFound(_0x3c9ddd,null))[_0x4dc5('0x20')](function(_0x471816){_0x2cab83=_0x471816;if(_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')]&&_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][_0x4dc5('0x49')]){for(var _0x129cd8=0x0;_0x129cd8<_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][_0x4dc5('0x49')];_0x129cd8+=0x1){_0x2bebe6[_0x4dc5('0x5e')]['attachments'][_0x129cd8]={'filename':_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][_0x129cd8][_0x4dc5('0x3d')],'id':_0x2bebe6[_0x4dc5('0x5e')]['attachments'][_0x129cd8]['id'],'path':path[_0x4dc5('0xa9')](config[_0x4dc5('0xaa')],_0x4dc5('0xab'),_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][_0x129cd8][_0x4dc5('0xac')])};}}return respondWithRpcPromise(_0x4dc5('0xad'),_0x4dc5('0xad'),{'FaxAccountId':_[_0x4dc5('0xae')](_0x2bebe6['params']['id'])?undefined:_0x2bebe6[_0x4dc5('0x58')]['id'],'path':_['isNil'](_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0]['path'])?undefined:_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0][_0x4dc5('0xaf')],'fax':_[_0x4dc5('0xae')](_0x2bebe6['body']['to'][0x0])?undefined:_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0]},client9002);})[_0x4dc5('0x20')](function(){if(_0x2cab83){if(_[_0x4dc5('0xae')](_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xb0')])){_0x2bebe6[_0x4dc5('0x5e')]['from']=util['format'](_0x4dc5('0xb1'),_0x2cab83[_0x4dc5('0x3d')],_0x2cab83[_0x4dc5('0xb2')]);}if(_0x2cab83[_0x4dc5('0xa6')]){if(_0x2cab83[_0x4dc5('0xa6')][_0x4dc5('0xa7')][_0x4dc5('0x49')]){return _0x2cab83[_0x4dc5('0xa6')][_0x4dc5('0xa7')][0x0];}else{return db['CmContact']['create'](_[_0x4dc5('0x1a')](_0x2bebe6[_0x4dc5('0x5e')],{'firstName':_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0],'phone':_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0],'fax':_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0],'ListId':_0x2cab83[_0x4dc5('0x9e')]}));}}else{throw new Error(_0x4dc5('0xb3'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x4dc5('0x20')](function(_0x55bc88){if(_0x55bc88){return db[_0x4dc5('0x75')]['find']({'where':{'ContactId':_0x55bc88['id'],'closed':![],'FaxAccountId':_0x2cab83['id']}})[_0x4dc5('0x20')](function(_0x28ad20){if(_0x28ad20){return[_0x28ad20,![]];}return db[_0x4dc5('0x75')][_0x4dc5('0x5d')]({'UserId':_0x2bebe6[_0x4dc5('0x5f')]['id'],'ContactId':_0x55bc88['id'],'FaxAccountId':_0x2cab83['id'],'fax':_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x4dc5('0x51')](_0x2bebe6[_0x4dc5('0x5e')],{'read':![],'body':_0x2bebe6['body'][_0x4dc5('0xa8')][0x0][_0x4dc5('0xb4')],'FaxAccountId':_0x2cab83['id'],'UserId':_0x2bebe6['user']['id'],'ContactId':_0x55bc88['id'],'AttachmentId':_0x2bebe6[_0x4dc5('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x4dc5('0xa0')],'as':_0x4dc5('0xb5')}]})[_0x4dc5('0x20')](function(_0x5d1566){return[_0x5d1566,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4dc5('0xb6')](function(_0x6d4e0b,_0xa3587a){if(_0xa3587a){return _0x6d4e0b;}return db[_0x4dc5('0xa0')][_0x4dc5('0x5d')]({'direction':_0x4dc5('0xb7'),'read':![],'body':_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0][_0x4dc5('0xb4')],'FaxAccountId':_0x2cab83['id'],'FaxInteractionId':_0x6d4e0b['id'],'UserId':_0x2bebe6['user']['id'],'ContactId':_0x6d4e0b['ContactId'],'AttachmentId':_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0]['id']})['then'](function(_0x2bbb8e){_0x6d4e0b[_0x4dc5('0xb8')][_0x4dc5('0xb5')]=[];_0x6d4e0b['dataValues'][_0x4dc5('0xb5')][_0x4dc5('0x8d')](_0x2bbb8e[_0x4dc5('0xb8')]);return _0x6d4e0b;});})[_0x4dc5('0x20')](function(_0x28bea6){respondWithRpcPromise(_0x4dc5('0xb9'),_0x4dc5('0xb9'),{'FaxAccountId':_[_0x4dc5('0xae')](_0x2bebe6[_0x4dc5('0x58')]['id'])?undefined:_0x2bebe6['params']['id'],'path':_[_0x4dc5('0xae')](_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0][_0x4dc5('0xaf')])?undefined:_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0]['path'],'fax':_[_0x4dc5('0xae')](_0x2bebe6['body']['to'][0x0])?undefined:_0x2bebe6['body']['to'][0x0],'AttachmentId':_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0]['id']},client9002)[_0x4dc5('0x20')](function(_0x27556e){logger[_0x4dc5('0x29')]('SendFaxRpc,\x20%s',_0x27556e);})[_0x4dc5('0x65')](function(_0x233d51){logger[_0x4dc5('0x29')](_0x4dc5('0xba'),_0x233d51);});return _0x28bea6;})[_0x4dc5('0x20')](respondWithResult(_0x3c9ddd,null))[_0x4dc5('0x65')](handleError(_0x3c9ddd,null));};exports[_0x4dc5('0xbb')]=function(_0x93dfaf,_0x35940b,_0x2bfb6e){return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x93dfaf[_0x4dc5('0x58')]['id']}})['then'](handleEntityNotFound(_0x35940b,null))[_0x4dc5('0x20')](function(_0x17d70e){if(_0x17d70e){return _0x17d70e['addAgents'](_0x93dfaf['body']['ids'],_[_0x4dc5('0x76')](_0x93dfaf[_0x4dc5('0x5e')],[_0x4dc5('0x6e'),'id'])||{})[_0x4dc5('0xb6')](function(_0x5d071a){for(var _0x47980b=0x0;_0x47980b<_0x93dfaf[_0x4dc5('0x5e')][_0x4dc5('0x6e')][_0x4dc5('0x49')];_0x47980b+=0x1){socket[_0x4dc5('0xbc')](_0x4dc5('0xbd'),{'UserId':Number(_0x93dfaf[_0x4dc5('0x5e')][_0x4dc5('0x6e')][_0x47980b]),'FaxAccountId':Number(_0x93dfaf['params']['id'])});}return _0x5d071a;});}})[_0x4dc5('0x20')](respondWithResult(_0x35940b,null))[_0x4dc5('0x65')](handleError(_0x35940b,null));};exports['removeAgents']=function(_0x24ad90,_0x1b5100,_0x3aedf9){return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x24ad90[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x1b5100,null))[_0x4dc5('0x20')](function(_0xc6bf9e){if(_0xc6bf9e){return _0xc6bf9e[_0x4dc5('0xbe')](_0x24ad90[_0x4dc5('0x45')][_0x4dc5('0x6e')])[_0x4dc5('0x20')](function(){if(_[_0x4dc5('0xbf')](_0x24ad90[_0x4dc5('0x45')][_0x4dc5('0x6e')])){for(var _0x388c72=0x0;_0x388c72<_0x24ad90[_0x4dc5('0x45')][_0x4dc5('0x6e')][_0x4dc5('0x49')];_0x388c72+=0x1){socket[_0x4dc5('0xbc')](_0x4dc5('0xc0'),{'UserId':Number(_0x24ad90['query']['ids'][_0x388c72]),'FaxAccountId':Number(_0x24ad90[_0x4dc5('0x58')]['id'])});}}else{socket['emit'](_0x4dc5('0xc0'),{'UserId':Number(_0x24ad90['query'][_0x4dc5('0x6e')]),'FaxAccountId':Number(_0x24ad90[_0x4dc5('0x58')]['id'])});}});}})[_0x4dc5('0x20')](respondWithStatusCode(_0x1b5100,null))[_0x4dc5('0x65')](handleError(_0x1b5100,null));};exports[_0x4dc5('0xc1')]=function(_0x3fab35,_0xd003c7,_0x2b0d8b){var _0x4161b6={};var _0x5cb34a={};var _0x5a26b8;var _0x43ea9d;return db[_0x4dc5('0x53')]['findOne']({'where':{'id':_0x3fab35[_0x4dc5('0x58')]['id']}})['then'](handleEntityNotFound(_0xd003c7,null))[_0x4dc5('0x20')](function(_0x4b1d91){if(_0x4b1d91){_0x5a26b8=_0x4b1d91;_0x5cb34a[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0xc2')][_0x4dc5('0x42')]);_0x5cb34a[_0x4dc5('0x45')]=_[_0x4dc5('0x5a')](_0x3fab35['query']);_0x5cb34a['filters']=_['intersection'](_0x5cb34a['model'],_0x5cb34a[_0x4dc5('0x45')]);_0x4161b6['attributes']=_[_0x4dc5('0x47')](_0x5cb34a[_0x4dc5('0x44')],qs['fields'](_0x3fab35['query'][_0x4dc5('0x48')]));_0x4161b6[_0x4dc5('0x46')]=_0x4161b6['attributes']['length']?_0x4161b6['attributes']:_0x5cb34a[_0x4dc5('0x44')];_0x4161b6[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x3fab35[_0x4dc5('0x45')][_0x4dc5('0x4c')]);_0x4161b6[_0x4dc5('0x4d')]=qs['filters'](_['pick'](_0x3fab35[_0x4dc5('0x45')],_0x5cb34a[_0x4dc5('0x4e')]));if(_0x3fab35[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x4161b6['where']=_['merge'](_0x4161b6[_0x4dc5('0x4d')],{'$or':_[_0x4dc5('0x41')](_0x4161b6[_0x4dc5('0x46')],function(_0x279f97){var _0x1b765c={};_0x1b765c[_0x279f97]={'$like':'%'+_0x3fab35['query'][_0x4dc5('0x50')]+'%'};return _0x1b765c;})});}_0x4161b6=_[_0x4dc5('0x51')]({},_0x4161b6,_0x3fab35[_0x4dc5('0x5b')]);return _0x5a26b8['getAgents'](_0x4161b6);}})[_0x4dc5('0x20')](function(_0x3e059e){if(_0x3e059e){_0x43ea9d=_0x3e059e[_0x4dc5('0x49')];if(!_0x3fab35[_0x4dc5('0x45')][_0x4dc5('0x6c')]('nolimit')){_0x4161b6[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x3fab35['query']['limit']);_0x4161b6[_0x4dc5('0x31')]=qs[_0x4dc5('0x31')](_0x3fab35['query'][_0x4dc5('0x31')]);}return _0x5a26b8[_0x4dc5('0xc1')](_0x4161b6);}})[_0x4dc5('0x20')](function(_0x3f8406){if(_0x3f8406){return _0x3f8406?{'count':_0x43ea9d,'rows':_0x3f8406}:null;}})[_0x4dc5('0x20')](respondWithResult(_0xd003c7,null))[_0x4dc5('0x65')](handleError(_0xd003c7,null));}; \ No newline at end of file +var _0x21c8=['split','format','YYYY-MM-DD\x20HH:mm:ss','List','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','path','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','save','update','destroy','get','FaxAccounts','name','send','index','Pause','map','FaxAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','mandatoryDispositionPause','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','order','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0x21c8,0xe6));var _0x821c=function(_0x20e5e2,_0x57c3b1){_0x20e5e2=_0x20e5e2-0x0;var _0x803951=_0x21c8[_0x20e5e2];return _0x803951;};'use strict';var emlformat=require(_0x821c('0x0'));var rimraf=require(_0x821c('0x1'));var zipdir=require(_0x821c('0x2'));var jsonpatch=require(_0x821c('0x3'));var rp=require(_0x821c('0x4'));var moment=require(_0x821c('0x5'));var BPromise=require(_0x821c('0x6'));var Mustache=require(_0x821c('0x7'));var util=require(_0x821c('0x8'));var path=require('path');var sox=require(_0x821c('0x9'));var csv=require('to-csv');var ejs=require(_0x821c('0xa'));var fs=require('fs');var fs_extra=require(_0x821c('0xb'));var _=require(_0x821c('0xc'));var squel=require(_0x821c('0xd'));var crypto=require(_0x821c('0xe'));var jsforce=require(_0x821c('0xf'));var deskjs=require(_0x821c('0x10'));var toCsv=require(_0x821c('0x11'));var querystring=require('querystring');var Papa=require(_0x821c('0x12'));var Redis=require(_0x821c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x821c('0x14'));var as=require(_0x821c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x821c('0x16'));var utils=require(_0x821c('0x17'));var config=require(_0x821c('0x18'));var licenseUtil=require(_0x821c('0x19'));var db=require(_0x821c('0x1a'))['db'];config[_0x821c('0x1b')]=_[_0x821c('0x1c')](config['redis'],{'host':_0x821c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x821c('0x1b')]));require(_0x821c('0x1e'))[_0x821c('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x821c('0x20')][_0x821c('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x821c('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x51d5f8,_0x4825e1,_0x567f8f,_0x53a7fd){return new BPromise(function(_0x2ff714,_0x212114){var _0x455f8e=_0x53a7fd||client;return _0x455f8e[_0x821c('0x22')](_0x51d5f8,_0x567f8f)[_0x821c('0x23')](function(_0x505e27){logger['info'](_0x821c('0x24'),_0x4825e1,_0x821c('0x25'));logger[_0x821c('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4825e1,_0x821c('0x25'),JSON['stringify'](_0x505e27));if(_0x505e27[_0x821c('0x27')]){if(_0x505e27['error']['code']===0x1f4){logger[_0x821c('0x27')]('FaxAccount,\x20%s,\x20%s',_0x4825e1,_0x505e27[_0x821c('0x27')][_0x821c('0x28')]);return _0x212114(_0x505e27[_0x821c('0x27')]['message']);}logger['error'](_0x821c('0x24'),_0x4825e1,_0x505e27['error']['message']);return _0x2ff714(_0x505e27[_0x821c('0x27')][_0x821c('0x28')]);}else{logger[_0x821c('0x29')]('FaxAccount,\x20%s,\x20%s',_0x4825e1,_0x821c('0x25'));_0x2ff714(_0x505e27['result'][_0x821c('0x28')]);}})['catch'](function(_0x5934ab){logger[_0x821c('0x27')](_0x821c('0x24'),_0x4825e1,_0x5934ab);_0x212114(_0x5934ab);});});}function respondWithStatusCode(_0x48682f,_0x3a3bd0){_0x3a3bd0=_0x3a3bd0||0xcc;return function(_0xda235b){if(_0xda235b){return _0x48682f[_0x821c('0x2a')](_0x3a3bd0);}return _0x48682f[_0x821c('0x2b')](_0x3a3bd0)[_0x821c('0x2c')]();};}function respondWithResult(_0x477399,_0xb58b1a){_0xb58b1a=_0xb58b1a||0xc8;return function(_0x5402e4){if(_0x5402e4){return _0x477399['status'](_0xb58b1a)[_0x821c('0x2d')](_0x5402e4);}};}function respondWithFilteredResult(_0x3aa6f2,_0x20bbdb){return function(_0x3f28ac){if(_0x3f28ac){var _0x431480=typeof _0x20bbdb['offset']==='undefined'&&typeof _0x20bbdb[_0x821c('0x2e')]===_0x821c('0x2f');var _0x523cd5=_0x3f28ac['count'];var _0x5c6291=_0x431480?0x0:_0x20bbdb[_0x821c('0x30')];var _0xf3667b=_0x431480?_0x3f28ac[_0x821c('0x31')]:_0x20bbdb[_0x821c('0x30')]+_0x20bbdb[_0x821c('0x2e')];var _0x266d09;if(_0xf3667b>=_0x523cd5){_0xf3667b=_0x523cd5;_0x266d09=0xc8;}else{_0x266d09=0xce;}_0x3aa6f2[_0x821c('0x2b')](_0x266d09);return _0x3aa6f2[_0x821c('0x32')]('Content-Range',_0x5c6291+'-'+_0xf3667b+'/'+_0x523cd5)[_0x821c('0x2d')](_0x3f28ac);}return null;};}function patchUpdates(_0x4dcf65){return function(_0x3a288e){try{jsonpatch[_0x821c('0x33')](_0x3a288e,_0x4dcf65,!![]);}catch(_0x5e8ab0){return BPromise['reject'](_0x5e8ab0);}return _0x3a288e[_0x821c('0x34')]();};}function saveUpdates(_0x5275d3,_0x17ac87){return function(_0x576e61){if(_0x576e61){return _0x576e61[_0x821c('0x35')](_0x5275d3)[_0x821c('0x23')](function(_0x5e0470){return _0x5e0470;});}return null;};}function removeEntity(_0x62980d,_0x5d2115){return function(_0x2423ed){if(_0x2423ed){return _0x2423ed[_0x821c('0x36')]()[_0x821c('0x23')](function(){var _0x44088d=_0x2423ed[_0x821c('0x37')]({'plain':!![]});var _0x3e38a7=_0x821c('0x38');return db['UserProfileResource'][_0x821c('0x36')]({'where':{'type':_0x3e38a7,'resourceId':_0x44088d['id']}})['then'](function(){return _0x2423ed;});})[_0x821c('0x23')](function(){_0x62980d[_0x821c('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c4f82,_0x6983c7){return function(_0x58dbb8){if(!_0x58dbb8){_0x1c4f82[_0x821c('0x2a')](0x194);}return _0x58dbb8;};}function handleError(_0x22a117,_0x3e58d8){_0x3e58d8=_0x3e58d8||0x1f4;return function(_0x317383){logger[_0x821c('0x27')](_0x317383['stack']);if(_0x317383[_0x821c('0x39')]){delete _0x317383[_0x821c('0x39')];}_0x22a117[_0x821c('0x2b')](_0x3e58d8)[_0x821c('0x3a')](_0x317383);};}exports[_0x821c('0x3b')]=function(_0x376ff3,_0x2968cc){var _0x1b2fa7={'include':[{'model':db[_0x821c('0x3c')],'as':'mandatoryDispositionPause'}]},_0x54e92b={},_0x1f44b1={'count':0x0,'rows':[]};var _0x216d47=_[_0x821c('0x3d')](db[_0x821c('0x3e')][_0x821c('0x3f')],function(_0x6dc433){return{'name':_0x6dc433['fieldName'],'type':_0x6dc433[_0x821c('0x40')][_0x821c('0x41')]};});_0x54e92b['model']=_[_0x821c('0x3d')](_0x216d47,_0x821c('0x39'));_0x54e92b[_0x821c('0x42')]=_[_0x821c('0x43')](_0x376ff3['query']);_0x54e92b[_0x821c('0x44')]=_[_0x821c('0x45')](_0x54e92b[_0x821c('0x46')],_0x54e92b['query']);_0x1b2fa7[_0x821c('0x47')]=_[_0x821c('0x45')](_0x54e92b[_0x821c('0x46')],qs[_0x821c('0x48')](_0x376ff3[_0x821c('0x42')][_0x821c('0x48')]));_0x1b2fa7['attributes']=_0x1b2fa7[_0x821c('0x47')][_0x821c('0x49')]?_0x1b2fa7[_0x821c('0x47')]:_0x54e92b[_0x821c('0x46')];if(!_0x376ff3[_0x821c('0x42')][_0x821c('0x4a')](_0x821c('0x4b'))){_0x1b2fa7[_0x821c('0x2e')]=qs['limit'](_0x376ff3['query'][_0x821c('0x2e')]);_0x1b2fa7['offset']=qs[_0x821c('0x30')](_0x376ff3[_0x821c('0x42')][_0x821c('0x30')]);}_0x1b2fa7['order']=qs[_0x821c('0x4c')](_0x376ff3['query'][_0x821c('0x4c')]);_0x1b2fa7[_0x821c('0x4d')]=qs[_0x821c('0x44')](_[_0x821c('0x4e')](_0x376ff3[_0x821c('0x42')],_0x54e92b[_0x821c('0x44')]),_0x216d47);if(_0x376ff3[_0x821c('0x42')][_0x821c('0x4f')]){_0x1b2fa7[_0x821c('0x4d')]=_[_0x821c('0x50')](_0x1b2fa7[_0x821c('0x4d')],{'$or':_[_0x821c('0x3d')](_0x216d47,function(_0x3b40d7){if(_0x3b40d7[_0x821c('0x40')]!==_0x821c('0x51')){var _0x305ee2={};_0x305ee2[_0x3b40d7[_0x821c('0x39')]]={'$like':'%'+_0x376ff3['query']['filter']+'%'};return _0x305ee2;}})});}_0x1b2fa7=_[_0x821c('0x50')]({},_0x1b2fa7,_0x376ff3[_0x821c('0x52')]);var _0x4d02d3={'where':_0x1b2fa7['where']};return db['FaxAccount'][_0x821c('0x31')](_0x4d02d3)[_0x821c('0x23')](function(_0x5f292c){_0x1f44b1[_0x821c('0x31')]=_0x5f292c;if(_0x376ff3[_0x821c('0x42')]['includeAll']){_0x1b2fa7[_0x821c('0x53')]=[{'all':!![]}];}return db[_0x821c('0x3e')][_0x821c('0x54')](_0x1b2fa7);})['then'](function(_0x1093eb){_0x1f44b1[_0x821c('0x55')]=_0x1093eb;return _0x1f44b1;})[_0x821c('0x23')](respondWithFilteredResult(_0x2968cc,_0x1b2fa7))['catch'](handleError(_0x2968cc,null));};exports['show']=function(_0x111ed2,_0x1a05b6){var _0x297142={'raw':![],'where':{'id':_0x111ed2[_0x821c('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x821c('0x57')}]},_0xe1bf79={};_0xe1bf79[_0x821c('0x46')]=_['keys'](db[_0x821c('0x3e')]['rawAttributes']);_0xe1bf79[_0x821c('0x42')]=_[_0x821c('0x43')](_0x111ed2[_0x821c('0x42')]);_0xe1bf79[_0x821c('0x44')]=_[_0x821c('0x45')](_0xe1bf79[_0x821c('0x46')],_0xe1bf79[_0x821c('0x42')]);_0x297142[_0x821c('0x47')]=_['intersection'](_0xe1bf79[_0x821c('0x46')],qs[_0x821c('0x48')](_0x111ed2['query'][_0x821c('0x48')]));_0x297142[_0x821c('0x47')]=_0x297142['attributes'][_0x821c('0x49')]?_0x297142[_0x821c('0x47')]:_0xe1bf79[_0x821c('0x46')];if(_0x111ed2[_0x821c('0x42')][_0x821c('0x58')]){_0x297142[_0x821c('0x53')]=[{'all':!![]}];}_0x297142=_[_0x821c('0x50')]({},_0x297142,_0x111ed2['options']);return db[_0x821c('0x3e')][_0x821c('0x59')](_0x297142)['then'](handleEntityNotFound(_0x1a05b6,null))[_0x821c('0x23')](respondWithResult(_0x1a05b6,null))['catch'](handleError(_0x1a05b6,null));};exports[_0x821c('0x5a')]=function(_0x506e85,_0x22e5df){return db[_0x821c('0x3e')]['create'](_0x506e85[_0x821c('0x5b')],{})[_0x821c('0x23')](function(_0x193c3e){var _0x3b5ea=_0x506e85[_0x821c('0x5c')]['get']({'plain':!![]});if(!_0x3b5ea)throw new Error(_0x821c('0x5d'));if(_0x3b5ea[_0x821c('0x5e')]===_0x821c('0x5c')){var _0x59841d=_0x193c3e[_0x821c('0x37')]({'plain':!![]});var _0x2c39d9='FaxAccounts';return db['UserProfileSection'][_0x821c('0x59')]({'where':{'name':_0x2c39d9,'userProfileId':_0x3b5ea[_0x821c('0x5f')]},'raw':!![]})[_0x821c('0x23')](function(_0x1d89c8){if(_0x1d89c8&&_0x1d89c8[_0x821c('0x60')]===0x0){return db[_0x821c('0x61')]['create']({'name':_0x59841d[_0x821c('0x39')],'resourceId':_0x59841d['id'],'type':_0x1d89c8[_0x821c('0x39')],'sectionId':_0x1d89c8['id']},{})[_0x821c('0x23')](function(){return _0x193c3e;});}else{return _0x193c3e;}})[_0x821c('0x62')](function(_0x47c25d){logger[_0x821c('0x27')](_0x821c('0x63'),_0x47c25d);throw _0x47c25d;});}return _0x193c3e;})[_0x821c('0x23')](respondWithResult(_0x22e5df,0xc9))['catch'](handleError(_0x22e5df,null));};exports[_0x821c('0x35')]=function(_0x4e8072,_0x52fe8e){if(_0x4e8072[_0x821c('0x5b')]['id']){delete _0x4e8072['body']['id'];}return db[_0x821c('0x3e')][_0x821c('0x59')]({'where':{'id':_0x4e8072['params']['id']},'include':[{'model':db[_0x821c('0x3c')],'as':_0x821c('0x57')}]})['then'](handleEntityNotFound(_0x52fe8e,null))[_0x821c('0x23')](saveUpdates(_0x4e8072[_0x821c('0x5b')],null))[_0x821c('0x23')](respondWithResult(_0x52fe8e,null))[_0x821c('0x62')](handleError(_0x52fe8e,null));};exports[_0x821c('0x36')]=function(_0x4e81d7,_0x2fba42){return db['FaxAccount']['find']({'where':{'id':_0x4e81d7[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x2fba42,null))[_0x821c('0x23')](removeEntity(_0x2fba42,null))[_0x821c('0x62')](handleError(_0x2fba42,null));};exports['describe']=function(_0x87bbc2,_0xfd8048){return db['FaxAccount'][_0x821c('0x64')]()[_0x821c('0x23')](respondWithResult(_0xfd8048,null))[_0x821c('0x62')](handleError(_0xfd8048,null));};exports[_0x821c('0x65')]=function(_0x564b33,_0x4a36dd,_0x10f51a){if(_0x564b33['body']['id']){delete _0x564b33[_0x821c('0x5b')]['id'];}return db[_0x821c('0x3e')][_0x821c('0x59')]({'where':{'id':_0x564b33[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x4a36dd,null))[_0x821c('0x23')](function(_0xe303bc){if(_0xe303bc){_0x564b33[_0x821c('0x5b')][_0x821c('0x66')]=_0xe303bc['id'];return db[_0x821c('0x67')][_0x821c('0x5a')](_0x564b33['body']);}})['then'](respondWithResult(_0x4a36dd,null))[_0x821c('0x62')](handleError(_0x4a36dd,null));};exports['getDispositions']=function(_0x5544e9,_0x38b72b,_0x2cdc3e){var _0x456374={'raw':![],'where':{}};var _0x229c4f={};var _0x41a0d9={'count':0x0,'rows':[]};return db[_0x821c('0x3e')][_0x821c('0x68')]({'where':{'id':_0x5544e9[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x38b72b,null))[_0x821c('0x23')](function(_0x284e6d){if(_0x284e6d){_0x229c4f[_0x821c('0x46')]=_[_0x821c('0x43')](db[_0x821c('0x67')][_0x821c('0x3f')]);_0x229c4f[_0x821c('0x42')]=_[_0x821c('0x43')](_0x5544e9[_0x821c('0x42')]);_0x229c4f[_0x821c('0x44')]=_['intersection'](_0x229c4f[_0x821c('0x46')],_0x229c4f[_0x821c('0x42')]);_0x456374[_0x821c('0x47')]=_[_0x821c('0x45')](_0x229c4f['model'],qs[_0x821c('0x48')](_0x5544e9[_0x821c('0x42')][_0x821c('0x48')]));_0x456374['attributes']=_0x456374[_0x821c('0x47')][_0x821c('0x49')]?_0x456374[_0x821c('0x47')]:_0x229c4f[_0x821c('0x46')];if(!_0x5544e9[_0x821c('0x42')][_0x821c('0x4a')](_0x821c('0x4b'))){_0x456374[_0x821c('0x2e')]=qs['limit'](_0x5544e9[_0x821c('0x42')]['limit']);_0x456374['offset']=qs[_0x821c('0x30')](_0x5544e9['query'][_0x821c('0x30')]);}_0x456374[_0x821c('0x69')]=qs[_0x821c('0x4c')](_0x5544e9[_0x821c('0x42')]['sort']);_0x456374[_0x821c('0x4d')]=qs[_0x821c('0x44')](_[_0x821c('0x4e')](_0x5544e9[_0x821c('0x42')],_0x229c4f['filters']));_0x456374[_0x821c('0x4d')][_0x821c('0x66')]=_0x284e6d['id'];if(_0x5544e9[_0x821c('0x42')]['filter']){_0x456374['where']=_[_0x821c('0x50')](_0x456374[_0x821c('0x4d')],{'$or':_[_0x821c('0x3d')](_0x456374['attributes'],function(_0x5631b1){var _0x581c30={};_0x581c30[_0x5631b1]={'$like':'%'+_0x5544e9['query'][_0x821c('0x4f')]+'%'};return _0x581c30;})});}_0x456374=_[_0x821c('0x50')]({},_0x456374,_0x5544e9[_0x821c('0x52')]);return db['Disposition'][_0x821c('0x31')]({'where':_0x456374['where']})[_0x821c('0x23')](function(_0x50f867){_0x41a0d9['count']=_0x50f867;if(_0x5544e9[_0x821c('0x42')]['includeAll']){_0x456374[_0x821c('0x53')]=[{'all':!![]}];}return db[_0x821c('0x67')][_0x821c('0x54')](_0x456374);})[_0x821c('0x23')](function(_0x120f6c){_0x41a0d9[_0x821c('0x55')]=_0x120f6c;return _0x41a0d9;});}})[_0x821c('0x23')](respondWithFilteredResult(_0x38b72b,_0x456374))[_0x821c('0x62')](handleError(_0x38b72b,null));};exports[_0x821c('0x6a')]=function(_0x58e488,_0x116773,_0x15052b){return db[_0x821c('0x3e')][_0x821c('0x59')]({'where':{'id':_0x58e488[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x116773,null))[_0x821c('0x23')](function(_0x2c7a7b){if(_0x2c7a7b){return _0x2c7a7b[_0x821c('0x6a')](_0x58e488[_0x821c('0x42')][_0x821c('0x6b')]);}})['then'](respondWithStatusCode(_0x116773,null))['catch'](handleError(_0x116773,null));};exports['addAnswer']=function(_0x3ac058,_0x4aff72,_0x5de60b){if(_0x3ac058['body']['id']){delete _0x3ac058[_0x821c('0x5b')]['id'];}return db[_0x821c('0x3e')][_0x821c('0x59')]({'where':{'id':_0x3ac058[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x4aff72,null))['then'](function(_0x16dc8e){if(_0x16dc8e){_0x3ac058['body'][_0x821c('0x66')]=_0x16dc8e['id'];return db[_0x821c('0x6c')][_0x821c('0x5a')](_0x3ac058[_0x821c('0x5b')]);}})[_0x821c('0x23')](respondWithResult(_0x4aff72,null))[_0x821c('0x62')](handleError(_0x4aff72,null));};exports[_0x821c('0x6d')]=function(_0x1ec454,_0x3e607b,_0x2746d7){var _0x1f2dff={'raw':![],'where':{}};var _0x39d429={};var _0x516450={'count':0x0,'rows':[]};return db[_0x821c('0x3e')][_0x821c('0x68')]({'where':{'id':_0x1ec454[_0x821c('0x56')]['id']}})['then'](handleEntityNotFound(_0x3e607b,null))[_0x821c('0x23')](function(_0x4900f0){if(_0x4900f0){_0x39d429[_0x821c('0x46')]=_[_0x821c('0x43')](db['CannedAnswer'][_0x821c('0x3f')]);_0x39d429[_0x821c('0x42')]=_[_0x821c('0x43')](_0x1ec454[_0x821c('0x42')]);_0x39d429[_0x821c('0x44')]=_['intersection'](_0x39d429[_0x821c('0x46')],_0x39d429[_0x821c('0x42')]);_0x1f2dff[_0x821c('0x47')]=_[_0x821c('0x45')](_0x39d429[_0x821c('0x46')],qs[_0x821c('0x48')](_0x1ec454[_0x821c('0x42')][_0x821c('0x48')]));_0x1f2dff['attributes']=_0x1f2dff[_0x821c('0x47')][_0x821c('0x49')]?_0x1f2dff[_0x821c('0x47')]:_0x39d429[_0x821c('0x46')];if(!_0x1ec454['query'][_0x821c('0x4a')](_0x821c('0x4b'))){_0x1f2dff[_0x821c('0x2e')]=qs['limit'](_0x1ec454[_0x821c('0x42')][_0x821c('0x2e')]);_0x1f2dff[_0x821c('0x30')]=qs[_0x821c('0x30')](_0x1ec454['query'][_0x821c('0x30')]);}_0x1f2dff[_0x821c('0x69')]=qs[_0x821c('0x4c')](_0x1ec454['query'][_0x821c('0x4c')]);_0x1f2dff[_0x821c('0x4d')]=qs['filters'](_[_0x821c('0x4e')](_0x1ec454[_0x821c('0x42')],_0x39d429['filters']));_0x1f2dff[_0x821c('0x4d')][_0x821c('0x66')]=_0x4900f0['id'];if(_0x1ec454[_0x821c('0x42')]['filter']){_0x1f2dff[_0x821c('0x4d')]=_[_0x821c('0x50')](_0x1f2dff[_0x821c('0x4d')],{'$or':_['map'](_0x1f2dff['attributes'],function(_0x58d6bc){var _0x23d99a={};_0x23d99a[_0x58d6bc]={'$like':'%'+_0x1ec454[_0x821c('0x42')][_0x821c('0x4f')]+'%'};return _0x23d99a;})});}_0x1f2dff=_[_0x821c('0x50')]({},_0x1f2dff,_0x1ec454['options']);return db[_0x821c('0x6c')][_0x821c('0x31')]({'where':_0x1f2dff[_0x821c('0x4d')]})[_0x821c('0x23')](function(_0x598208){_0x516450[_0x821c('0x31')]=_0x598208;if(_0x1ec454['query'][_0x821c('0x58')]){_0x1f2dff[_0x821c('0x53')]=[{'all':!![]}];}return db[_0x821c('0x6c')][_0x821c('0x54')](_0x1f2dff);})['then'](function(_0x508696){_0x516450[_0x821c('0x55')]=_0x508696;return _0x516450;});}})[_0x821c('0x23')](respondWithFilteredResult(_0x3e607b,_0x1f2dff))['catch'](handleError(_0x3e607b,null));};exports[_0x821c('0x6e')]=function(_0x1b2bc7,_0x3c08c5,_0x29652e){return db[_0x821c('0x3e')][_0x821c('0x59')]({'where':{'id':_0x1b2bc7[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x3c08c5,null))[_0x821c('0x23')](function(_0x3bb87d){if(_0x3bb87d){return _0x3bb87d[_0x821c('0x6e')](_0x1b2bc7[_0x821c('0x42')]['ids']);}})[_0x821c('0x23')](respondWithStatusCode(_0x3c08c5,null))[_0x821c('0x62')](handleError(_0x3c08c5,null));};exports['addInteraction']=function(_0x2dd18f,_0x337777,_0x2bbb78){return db[_0x821c('0x6f')][_0x821c('0x59')]({'where':{'id':_0x2dd18f[_0x821c('0x56')]['id']}})['then'](handleEntityNotFound(_0x337777,null))['then'](function(_0xc7a1e8){if(_0xc7a1e8){return _0xc7a1e8[_0x821c('0x70')](_0x2dd18f[_0x821c('0x5b')]['ids'],_['omit'](_0x2dd18f[_0x821c('0x5b')],[_0x821c('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x337777,null))[_0x821c('0x62')](handleError(_0x337777,null));};exports['getInteractions']=function(_0x56d2f5,_0x4eacb1,_0x1e9881){var _0x2ad35b={'raw':![],'where':{}};var _0x33f8b3={};var _0x4ba923={'count':0x0,'rows':[]};return db[_0x821c('0x3e')][_0x821c('0x68')]({'where':{'id':_0x56d2f5[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x4eacb1,null))[_0x821c('0x23')](function(_0x23f5e5){if(_0x23f5e5){_0x33f8b3['model']=_[_0x821c('0x43')](db[_0x821c('0x6f')]['rawAttributes']);_0x33f8b3[_0x821c('0x42')]=_[_0x821c('0x43')](_0x56d2f5['query']);_0x33f8b3['filters']=_['intersection'](_0x33f8b3[_0x821c('0x46')],_0x33f8b3[_0x821c('0x42')]);_0x2ad35b[_0x821c('0x47')]=_[_0x821c('0x45')](_0x33f8b3[_0x821c('0x46')],qs['fields'](_0x56d2f5[_0x821c('0x42')][_0x821c('0x48')]));_0x2ad35b['attributes']=_0x2ad35b[_0x821c('0x47')][_0x821c('0x49')]?_0x2ad35b[_0x821c('0x47')]:_0x33f8b3[_0x821c('0x46')];if(!_0x56d2f5[_0x821c('0x42')]['hasOwnProperty']('nolimit')){_0x2ad35b[_0x821c('0x2e')]=qs[_0x821c('0x2e')](_0x56d2f5[_0x821c('0x42')][_0x821c('0x2e')]);_0x2ad35b['offset']=qs['offset'](_0x56d2f5[_0x821c('0x42')][_0x821c('0x30')]);}_0x2ad35b['order']=qs[_0x821c('0x4c')](_0x56d2f5['query'][_0x821c('0x4c')]);_0x2ad35b['where']=qs[_0x821c('0x44')](_[_0x821c('0x4e')](_0x56d2f5[_0x821c('0x42')],_0x33f8b3[_0x821c('0x44')]));_0x2ad35b[_0x821c('0x4d')][_0x821c('0x66')]=_0x23f5e5['id'];if(_0x56d2f5[_0x821c('0x42')][_0x821c('0x4f')]){_0x2ad35b[_0x821c('0x4d')]=_[_0x821c('0x50')](_0x2ad35b[_0x821c('0x4d')],{'$or':_[_0x821c('0x3d')](_0x2ad35b[_0x821c('0x47')],function(_0x3be9cf){var _0x318832={};_0x318832[_0x3be9cf]={'$like':'%'+_0x56d2f5[_0x821c('0x42')][_0x821c('0x4f')]+'%'};return _0x318832;})});}_0x2ad35b=_[_0x821c('0x50')]({},_0x2ad35b,_0x56d2f5[_0x821c('0x52')]);return db['FaxInteraction'][_0x821c('0x31')]({'where':_0x2ad35b[_0x821c('0x4d')]})['then'](function(_0x421518){_0x4ba923['count']=_0x421518;if(_0x56d2f5['query'][_0x821c('0x58')]){_0x2ad35b[_0x821c('0x53')]=[{'model':db[_0x821c('0x71')],'as':_0x821c('0x72'),'required':![]},{'model':db['User'],'as':_0x821c('0x73'),'attributes':['name',_0x821c('0x74'),_0x821c('0x75')],'required':![]},{'model':db[_0x821c('0x76')],'as':'Tags','attributes':['id',_0x821c('0x39'),_0x821c('0x77')],'where':_0x56d2f5[_0x821c('0x42')][_0x821c('0x78')]?{'id':_0x56d2f5[_0x821c('0x42')][_0x821c('0x78')]}:undefined,'required':_0x56d2f5[_0x821c('0x42')][_0x821c('0x78')]?!![]:![]}];}return db[_0x821c('0x6f')][_0x821c('0x54')](_0x2ad35b);})['then'](function(_0x528142){_0x4ba923['rows']=_0x528142;return _0x4ba923;});}})[_0x821c('0x23')](respondWithFilteredResult(_0x4eacb1,_0x2ad35b))['catch'](handleError(_0x4eacb1,null));};exports[_0x821c('0x79')]=function(_0x1749d8,_0xafcf83){var _0x45d300=_0x1749d8[_0x821c('0x56')]['id'];var _0x5c0a80=_0x1749d8[_0x821c('0x5b')];var _0x5ce33e=0xc8;var _0x1c4565=null;return db[_0x821c('0x7a')][_0x821c('0x7b')]({'isolationLevel':db[_0x821c('0x7a')][_0x821c('0x7c')]['ISOLATION_LEVELS'][_0x821c('0x7d')]},function(_0x5921bb){return db['FaxAccount'][_0x821c('0x68')]({'where':{'id':_0x45d300},'transaction':_0x5921bb})[_0x821c('0x23')](function(_0x3ae291){if(_0x3ae291){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x45d300},'transaction':_0x5921bb})[_0x821c('0x23')](function(){var _0x332197=_['map'](_0x5c0a80,function(_0x487c4f){_0x487c4f['FaxAccountId']=_0x45d300;return _0x487c4f;});return db[_0x821c('0x7e')][_0x821c('0x7f')](_0x332197,{'transaction':_0x5921bb});});}else{_0x5ce33e=0x194;_0x1c4565=[];}});})[_0x821c('0x23')](function(){if(_0x5ce33e!==0x194){return db[_0x821c('0x7e')][_0x821c('0x80')]({'where':{'FaxAccountId':_0x45d300},'order':_0x821c('0x81')})[_0x821c('0x23')](function(_0x519902){_0x1c4565=_0x519902;});}})[_0x821c('0x62')](function(_0x35fbc9){_0x5ce33e=0x1f4;logger[_0x821c('0x27')](_0x35fbc9[_0x821c('0x82')]);if(_0x35fbc9[_0x821c('0x39')]){delete _0x35fbc9[_0x821c('0x39')];}_0x1c4565=_0x35fbc9;})[_0x821c('0x83')](function(){if(_0x1c4565===null){_0xafcf83['sendStatus'](_0x5ce33e);}else{if(_0x5ce33e===0x1f4){_0xafcf83[_0x821c('0x2b')](_0x5ce33e)[_0x821c('0x3a')](_0x1c4565);}else{_0xafcf83[_0x821c('0x2b')](_0x5ce33e)[_0x821c('0x2d')](_0x1c4565);}}});};exports['getApplications']=function(_0x29282c,_0x3e3097,_0x4a20e4){var _0x5177ed={};var _0x502c5a={};var _0xe62bfe;var _0x51d088;return db[_0x821c('0x3e')][_0x821c('0x68')]({'where':{'id':_0x29282c[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x3e3097,null))[_0x821c('0x23')](function(_0x5b60de){if(_0x5b60de){_0xe62bfe=_0x5b60de;_0x502c5a['model']=_[_0x821c('0x43')](db['FaxApplication'][_0x821c('0x3f')]);_0x502c5a[_0x821c('0x42')]=_[_0x821c('0x43')](_0x29282c[_0x821c('0x42')]);_0x502c5a[_0x821c('0x44')]=_[_0x821c('0x45')](_0x502c5a[_0x821c('0x46')],_0x502c5a[_0x821c('0x42')]);_0x5177ed[_0x821c('0x47')]=_[_0x821c('0x45')](_0x502c5a['model'],qs[_0x821c('0x48')](_0x29282c[_0x821c('0x42')][_0x821c('0x48')]));_0x5177ed[_0x821c('0x47')]=_0x5177ed['attributes'][_0x821c('0x49')]?_0x5177ed[_0x821c('0x47')]:_0x502c5a['model'];_0x5177ed[_0x821c('0x69')]=qs[_0x821c('0x4c')](_0x29282c[_0x821c('0x42')]['sort']);_0x5177ed[_0x821c('0x4d')]=qs[_0x821c('0x44')](_[_0x821c('0x4e')](_0x29282c[_0x821c('0x42')],_0x502c5a['filters']));if(_0x29282c[_0x821c('0x42')]['filter']){_0x5177ed['where']=_[_0x821c('0x50')](_0x5177ed[_0x821c('0x4d')],{'$or':_[_0x821c('0x3d')](_0x5177ed[_0x821c('0x47')],function(_0x9341ec){var _0x52156b={};_0x52156b[_0x9341ec]={'$like':'%'+_0x29282c[_0x821c('0x42')][_0x821c('0x4f')]+'%'};return _0x52156b;})});}_0x5177ed=_['merge']({},_0x5177ed,_0x29282c['options']);return _0xe62bfe[_0x821c('0x84')](_0x5177ed);}})[_0x821c('0x23')](function(_0x190c47){if(_0x190c47){_0x51d088=_0x190c47[_0x821c('0x49')];if(!_0x29282c[_0x821c('0x42')]['hasOwnProperty'](_0x821c('0x4b'))){_0x5177ed[_0x821c('0x2e')]=qs[_0x821c('0x2e')](_0x29282c[_0x821c('0x42')][_0x821c('0x2e')]);_0x5177ed[_0x821c('0x30')]=qs['offset'](_0x29282c['query'][_0x821c('0x30')]);}return _0xe62bfe[_0x821c('0x84')](_0x5177ed);}})[_0x821c('0x23')](function(_0x2efddb){if(_0x2efddb){return _0x2efddb?{'count':_0x51d088,'rows':_0x2efddb}:null;}})[_0x821c('0x23')](respondWithResult(_0x3e3097,null))[_0x821c('0x62')](handleError(_0x3e3097,null));};function Extension(_0x50ad53,_0x38828f,_0x4180de,_0x49c039){this[_0x821c('0x85')]=_0x821c('0x86');this['exten']=_0x50ad53['localstationid'];this[_0x821c('0x87')]=_0x49c039;this[_0x821c('0x40')]=_0x821c('0x88');this[_0x821c('0x89')]=_0x821c('0x8a');this[_0x821c('0x66')]=_0x50ad53['id'];this[_0x821c('0x81')]=_0x38828f;this[_0x821c('0x8b')]=_0x4180de;}function createExtensionsReciveFax(_0x5a0a99){var _0x32198c=0x1;var _0x23821f=[];_0x23821f[_0x821c('0x8c')](new Extension(_0x5a0a99,_0x32198c,'',_0x821c('0x8d')));_0x32198c+=0x1;_0x23821f[_0x821c('0x8c')](new Extension(_0x5a0a99,_0x32198c,_0x821c('0x8e'),_0x821c('0x8f')));_0x32198c+=0x1;for(var _0x3e5242 in _0x5a0a99){if(_0x5a0a99[_0x821c('0x4a')](_0x3e5242)&&(_0x3e5242===_0x821c('0x90')||_0x3e5242===_0x821c('0x91')||_0x3e5242===_0x821c('0x92')||_0x3e5242===_0x821c('0x93')||_0x3e5242===_0x821c('0x94')||_0x3e5242===_0x821c('0x95')||_0x3e5242==='minrate'||_0x3e5242===_0x821c('0x96')||_0x3e5242===_0x821c('0x97'))){_0x23821f[_0x821c('0x8c')](new Extension(_0x5a0a99,_0x32198c,'FAXOPT('+_0x3e5242+')='+_0x5a0a99[_0x3e5242],'Set'));_0x32198c+=0x1;}}_0x23821f[_0x821c('0x8c')](new Extension(_0x5a0a99,_0x32198c,'6',_0x821c('0x98')));_0x32198c+=0x1;_0x23821f[_0x821c('0x8c')](new Extension(_0x5a0a99,_0x32198c,_0x821c('0x99'),_0x821c('0x9a')));_0x32198c=0x0;return _0x23821f;}exports[_0x821c('0x9b')]=function(_0x2c7aab,_0xbb3544,_0xf91a67){var _0x414561;return db['sequelize']['transaction'](function(_0x1d4d9b){return db[_0x821c('0x3e')][_0x821c('0x5a')](_0x2c7aab[_0x821c('0x5b')],{'transaction':_0x1d4d9b})[_0x821c('0x23')](function(_0x52c577){_0x414561=_0x52c577[_0x821c('0x37')]({'plain':!![]});return db[_0x821c('0x9c')][_0x821c('0x7f')](createExtensionsReciveFax(_0x414561),{'transaction':_0x1d4d9b});});})['then'](function(){return _0x414561;})[_0x821c('0x23')](respondWithResult(_0xbb3544,null))[_0x821c('0x62')](handleError(_0xbb3544,null));};exports[_0x821c('0x9d')]=function(_0x701bc7,_0x147bae,_0x55fc7a){var _0x28c51c;return db[_0x821c('0x7a')][_0x821c('0x7b')](function(_0xac2cb8){return db[_0x821c('0x3e')][_0x821c('0x35')](_0x701bc7[_0x821c('0x5b')],{'where':{'id':_0x701bc7['body']['id']},'transaction':_0xac2cb8})[_0x821c('0x23')](function(_0x4f6543){return db[_0x821c('0x9c')][_0x821c('0x36')]({'where':{'FaxAccountId':_0x701bc7[_0x821c('0x5b')]['id']},'transaction':_0xac2cb8})['then'](function(_0x5e05f2){return db[_0x821c('0x9c')][_0x821c('0x7f')](createExtensionsReciveFax(_[_0x821c('0x9e')](_0x701bc7[_0x821c('0x5b')],['tech',_0x821c('0x41'),_0x821c('0x9f'),_0x821c('0xa0'),_0x821c('0xa1'),_0x821c('0xa2')])),{'transaction':_0xac2cb8});});});})[_0x821c('0x23')](function(){return db[_0x821c('0x3e')]['findById'](_0x701bc7[_0x821c('0x5b')]['id']);})['then'](respondWithResult(_0x147bae,null))['catch'](handleError(_0x147bae,null));};exports[_0x821c('0xa3')]=function(_0x2073c2,_0x1273a2,_0x4a0777){var _0xdab134={'raw':!![],'where':{}};var _0x200576={};var _0x4e1768={'count':0x0,'rows':[]};return db['FaxAccount'][_0x821c('0x68')]({'where':{'id':_0x2073c2[_0x821c('0x56')]['id']}})['then'](handleEntityNotFound(_0x1273a2,null))[_0x821c('0x23')](function(_0x323104){if(_0x323104){_0x200576[_0x821c('0x46')]=_[_0x821c('0x43')](db[_0x821c('0xa4')][_0x821c('0x3f')]);_0x200576[_0x821c('0x42')]=_['keys'](_0x2073c2[_0x821c('0x42')]);_0x200576[_0x821c('0x44')]=_['intersection'](_0x200576[_0x821c('0x46')],_0x200576['query']);_0xdab134['attributes']=_[_0x821c('0x45')](_0x200576[_0x821c('0x46')],qs[_0x821c('0x48')](_0x2073c2['query'][_0x821c('0x48')]));_0xdab134[_0x821c('0x47')]=_0xdab134[_0x821c('0x47')][_0x821c('0x49')]?_0xdab134[_0x821c('0x47')]:_0x200576[_0x821c('0x46')];if(!_0x2073c2[_0x821c('0x42')]['hasOwnProperty'](_0x821c('0x4b'))){_0xdab134[_0x821c('0x2e')]=qs[_0x821c('0x2e')](_0x2073c2['query']['limit']);_0xdab134[_0x821c('0x30')]=qs[_0x821c('0x30')](_0x2073c2['query']['offset']);}_0xdab134['order']=qs['sort'](_0x2073c2[_0x821c('0x42')][_0x821c('0x4c')]);_0xdab134[_0x821c('0x4d')]=qs[_0x821c('0x44')](_[_0x821c('0x4e')](_0x2073c2['query'],_0x200576[_0x821c('0x44')]));_0xdab134[_0x821c('0x4d')][_0x821c('0x66')]=_0x323104['id'];if(_0x2073c2[_0x821c('0x42')][_0x821c('0x4f')]){_0xdab134['where']=_[_0x821c('0x50')](_0xdab134['where'],{'$or':_[_0x821c('0x3d')](_0xdab134[_0x821c('0x47')],function(_0x52145a){var _0x5d8917={};_0x5d8917[_0x52145a]={'$like':'%'+_0x2073c2[_0x821c('0x42')][_0x821c('0x4f')]+'%'};return _0x5d8917;})});}if(_0x2073c2[_0x821c('0x42')]['$gte']){var _0x5d6d8a=_0x2073c2[_0x821c('0x42')][_0x821c('0xa5')][_0x821c('0xa6')](',');var _0x66d4c2={};_0x66d4c2[_0x5d6d8a[0x0]]={'$gte':moment(_0x5d6d8a[0x1])[_0x821c('0xa7')](_0x821c('0xa8'))};_0xdab134['where']=_[_0x821c('0x50')](_0xdab134[_0x821c('0x4d')],_0x66d4c2);}_0xdab134=_[_0x821c('0x50')]({},_0xdab134,_0x2073c2[_0x821c('0x52')]);return db[_0x821c('0xa4')]['count']({'where':_0xdab134['where']})[_0x821c('0x23')](function(_0x134a5f){_0x4e1768[_0x821c('0x31')]=_0x134a5f;if(_0x2073c2['query'][_0x821c('0x58')]){_0xdab134[_0x821c('0x53')]=[{'all':!![]}];}return db[_0x821c('0xa4')][_0x821c('0x54')](_0xdab134);})['then'](function(_0x3c6b01){_0x4e1768['rows']=_0x3c6b01;return _0x4e1768;});}})['then'](respondWithFilteredResult(_0x1273a2,_0xdab134))[_0x821c('0x62')](handleError(_0x1273a2,null));};exports[_0x821c('0x3a')]=function(_0x4fc472,_0x2591ae,_0x555c06){var _0x19a4bc,_0x23ff2f={},_0x1e93bf;if(_0x4fc472[_0x821c('0x5b')]['to']){_0x1e93bf=_0x4fc472[_0x821c('0x5b')]['to'][0x0];}return db['FaxAccount'][_0x821c('0x59')]({'where':{'id':_0x4fc472[_0x821c('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0x821c('0xa9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x1e93bf},'limit':0x1,'order':[[_0x821c('0xa0'),_0x821c('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x2591ae,null))[_0x821c('0x23')](function(_0x3ae50c){_0x19a4bc=_0x3ae50c;if(_0x4fc472[_0x821c('0x5b')]['attachments']&&_0x4fc472[_0x821c('0x5b')][_0x821c('0xab')][_0x821c('0x49')]){for(var _0x27798f=0x0;_0x27798f<_0x4fc472[_0x821c('0x5b')][_0x821c('0xab')][_0x821c('0x49')];_0x27798f+=0x1){_0x4fc472[_0x821c('0x5b')][_0x821c('0xab')][_0x27798f]={'filename':_0x4fc472[_0x821c('0x5b')][_0x821c('0xab')][_0x27798f][_0x821c('0x39')],'id':_0x4fc472['body'][_0x821c('0xab')][_0x27798f]['id'],'path':path[_0x821c('0xac')](config['root'],_0x821c('0xad'),_0x4fc472[_0x821c('0x5b')][_0x821c('0xab')][_0x27798f]['basename'])};}}return respondWithRpcPromise(_0x821c('0xae'),_0x821c('0xae'),{'FaxAccountId':_[_0x821c('0xaf')](_0x4fc472[_0x821c('0x56')]['id'])?undefined:_0x4fc472[_0x821c('0x56')]['id'],'path':_['isNil'](_0x4fc472[_0x821c('0x5b')]['attachments'][0x0]['path'])?undefined:_0x4fc472['body']['attachments'][0x0]['path'],'fax':_[_0x821c('0xaf')](_0x4fc472[_0x821c('0x5b')]['to'][0x0])?undefined:_0x4fc472[_0x821c('0x5b')]['to'][0x0]},client9002);})['then'](function(){if(_0x19a4bc){if(_['isNil'](_0x4fc472[_0x821c('0x5b')]['from'])){_0x4fc472[_0x821c('0x5b')][_0x821c('0xb0')]=util[_0x821c('0xa7')](_0x821c('0xb1'),_0x19a4bc[_0x821c('0x39')],_0x19a4bc[_0x821c('0xb2')]);}if(_0x19a4bc[_0x821c('0xa9')]){if(_0x19a4bc[_0x821c('0xa9')][_0x821c('0xb3')]['length']){return _0x19a4bc[_0x821c('0xa9')]['Contacts'][0x0];}else{return db[_0x821c('0x71')][_0x821c('0x5a')](_['defaults'](_0x4fc472[_0x821c('0x5b')],{'firstName':_0x4fc472['body']['to'][0x0],'phone':_0x4fc472[_0x821c('0x5b')]['to'][0x0],'fax':_0x4fc472['body']['to'][0x0],'ListId':_0x19a4bc['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x821c('0xb4'));}})[_0x821c('0x23')](function(_0x25f090){if(_0x25f090){return db[_0x821c('0x6f')]['find']({'where':{'ContactId':_0x25f090['id'],'closed':![],'FaxAccountId':_0x19a4bc['id']}})[_0x821c('0x23')](function(_0x2e6cf4){if(_0x2e6cf4){return[_0x2e6cf4,![]];}return db[_0x821c('0x6f')][_0x821c('0x5a')]({'UserId':_0x4fc472[_0x821c('0x5c')]['id'],'ContactId':_0x25f090['id'],'FaxAccountId':_0x19a4bc['id'],'fax':_0x4fc472[_0x821c('0x5b')]['to'][0x0],'firstMsgDirection':_0x821c('0xb5'),'Messages':[_[_0x821c('0x50')](_0x4fc472[_0x821c('0x5b')],{'read':![],'body':_0x4fc472['body'][_0x821c('0xab')][0x0][_0x821c('0xb6')],'FaxAccountId':_0x19a4bc['id'],'UserId':_0x4fc472[_0x821c('0x5c')]['id'],'ContactId':_0x25f090['id'],'AttachmentId':_0x4fc472['body'][_0x821c('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x821c('0xa4')],'as':'Messages'}]})['then'](function(_0x25d080){return[_0x25d080,!![]];});});}else{throw new Error(_0x821c('0xb7'));}})[_0x821c('0xb8')](function(_0x14c1ef,_0x18319e){if(_0x18319e){return _0x14c1ef;}return db['FaxMessage'][_0x821c('0x5a')]({'direction':_0x821c('0xb5'),'read':![],'body':_0x4fc472['body'][_0x821c('0xab')][0x0][_0x821c('0xb6')],'FaxAccountId':_0x19a4bc['id'],'FaxInteractionId':_0x14c1ef['id'],'UserId':_0x4fc472[_0x821c('0x5c')]['id'],'ContactId':_0x14c1ef[_0x821c('0xb9')],'AttachmentId':_0x4fc472[_0x821c('0x5b')][_0x821c('0xab')][0x0]['id']})[_0x821c('0x23')](function(_0x28bb0a){_0x14c1ef[_0x821c('0xba')]['Messages']=[];_0x14c1ef[_0x821c('0xba')][_0x821c('0xbb')][_0x821c('0x8c')](_0x28bb0a[_0x821c('0xba')]);return _0x14c1ef;});})[_0x821c('0x23')](function(_0x402c4a){respondWithRpcPromise(_0x821c('0xbc'),_0x821c('0xbc'),{'FaxAccountId':_[_0x821c('0xaf')](_0x4fc472[_0x821c('0x56')]['id'])?undefined:_0x4fc472['params']['id'],'path':_[_0x821c('0xaf')](_0x4fc472[_0x821c('0x5b')]['attachments'][0x0][_0x821c('0xbd')])?undefined:_0x4fc472[_0x821c('0x5b')][_0x821c('0xab')][0x0][_0x821c('0xbd')],'fax':_[_0x821c('0xaf')](_0x4fc472[_0x821c('0x5b')]['to'][0x0])?undefined:_0x4fc472[_0x821c('0x5b')]['to'][0x0],'AttachmentId':_0x4fc472[_0x821c('0x5b')][_0x821c('0xab')][0x0]['id']},client9002)[_0x821c('0x23')](function(_0x19404d){logger[_0x821c('0x29')](_0x821c('0xbe'),_0x19404d);})['catch'](function(_0x22a7af){logger[_0x821c('0x29')]('SendFaxRpc,\x20%s',_0x22a7af);});return _0x402c4a;})['then'](respondWithResult(_0x2591ae,null))[_0x821c('0x62')](handleError(_0x2591ae,null));};exports[_0x821c('0xbf')]=function(_0x4b1c04,_0x315662,_0x5db792){return db[_0x821c('0x3e')][_0x821c('0x59')]({'where':{'id':_0x4b1c04[_0x821c('0x56')]['id']}})[_0x821c('0x23')](handleEntityNotFound(_0x315662,null))['then'](function(_0x281d2b){if(_0x281d2b){return _0x281d2b[_0x821c('0xbf')](_0x4b1c04[_0x821c('0x5b')][_0x821c('0x6b')],_[_0x821c('0x9e')](_0x4b1c04[_0x821c('0x5b')],[_0x821c('0x6b'),'id'])||{})['spread'](function(_0x189278){for(var _0x412521=0x0;_0x412521<_0x4b1c04[_0x821c('0x5b')][_0x821c('0x6b')]['length'];_0x412521+=0x1){socket[_0x821c('0xc0')]('userFaxAccount:save',{'UserId':Number(_0x4b1c04[_0x821c('0x5b')]['ids'][_0x412521]),'FaxAccountId':Number(_0x4b1c04['params']['id'])});}return _0x189278;});}})[_0x821c('0x23')](respondWithResult(_0x315662,null))[_0x821c('0x62')](handleError(_0x315662,null));};exports['removeAgents']=function(_0x22c168,_0x3069f3,_0x124003){return db[_0x821c('0x3e')][_0x821c('0x59')]({'where':{'id':_0x22c168['params']['id']}})['then'](handleEntityNotFound(_0x3069f3,null))[_0x821c('0x23')](function(_0x485194){if(_0x485194){return _0x485194[_0x821c('0xc1')](_0x22c168[_0x821c('0x42')][_0x821c('0x6b')])[_0x821c('0x23')](function(){if(_[_0x821c('0xc2')](_0x22c168[_0x821c('0x42')][_0x821c('0x6b')])){for(var _0x5500eb=0x0;_0x5500eb<_0x22c168['query']['ids'][_0x821c('0x49')];_0x5500eb+=0x1){socket['emit'](_0x821c('0xc3'),{'UserId':Number(_0x22c168[_0x821c('0x42')]['ids'][_0x5500eb]),'FaxAccountId':Number(_0x22c168[_0x821c('0x56')]['id'])});}}else{socket['emit'](_0x821c('0xc3'),{'UserId':Number(_0x22c168[_0x821c('0x42')][_0x821c('0x6b')]),'FaxAccountId':Number(_0x22c168[_0x821c('0x56')]['id'])});}});}})[_0x821c('0x23')](respondWithStatusCode(_0x3069f3,null))[_0x821c('0x62')](handleError(_0x3069f3,null));};exports['getAgents']=function(_0x140b09,_0x5de581,_0x2580c3){var _0x2e992f={};var _0x1cbd05={};var _0x16130e;var _0x5cccd7;return db[_0x821c('0x3e')][_0x821c('0x68')]({'where':{'id':_0x140b09[_0x821c('0x56')]['id']}})['then'](handleEntityNotFound(_0x5de581,null))[_0x821c('0x23')](function(_0x9b8f66){if(_0x9b8f66){_0x16130e=_0x9b8f66;_0x1cbd05['model']=_[_0x821c('0x43')](db[_0x821c('0xc4')]['rawAttributes']);_0x1cbd05['query']=_['keys'](_0x140b09[_0x821c('0x42')]);_0x1cbd05['filters']=_[_0x821c('0x45')](_0x1cbd05['model'],_0x1cbd05[_0x821c('0x42')]);_0x2e992f['attributes']=_['intersection'](_0x1cbd05[_0x821c('0x46')],qs[_0x821c('0x48')](_0x140b09[_0x821c('0x42')][_0x821c('0x48')]));_0x2e992f[_0x821c('0x47')]=_0x2e992f[_0x821c('0x47')][_0x821c('0x49')]?_0x2e992f[_0x821c('0x47')]:_0x1cbd05[_0x821c('0x46')];_0x2e992f['order']=qs['sort'](_0x140b09[_0x821c('0x42')][_0x821c('0x4c')]);_0x2e992f[_0x821c('0x4d')]=qs[_0x821c('0x44')](_[_0x821c('0x4e')](_0x140b09[_0x821c('0x42')],_0x1cbd05[_0x821c('0x44')]));if(_0x140b09[_0x821c('0x42')][_0x821c('0x4f')]){_0x2e992f[_0x821c('0x4d')]=_[_0x821c('0x50')](_0x2e992f[_0x821c('0x4d')],{'$or':_[_0x821c('0x3d')](_0x2e992f[_0x821c('0x47')],function(_0x21323f){var _0x6a048a={};_0x6a048a[_0x21323f]={'$like':'%'+_0x140b09[_0x821c('0x42')]['filter']+'%'};return _0x6a048a;})});}_0x2e992f=_[_0x821c('0x50')]({},_0x2e992f,_0x140b09['options']);return _0x16130e[_0x821c('0xc5')](_0x2e992f);}})[_0x821c('0x23')](function(_0x3fcd0c){if(_0x3fcd0c){_0x5cccd7=_0x3fcd0c[_0x821c('0x49')];if(!_0x140b09['query']['hasOwnProperty'](_0x821c('0x4b'))){_0x2e992f[_0x821c('0x2e')]=qs[_0x821c('0x2e')](_0x140b09['query'][_0x821c('0x2e')]);_0x2e992f[_0x821c('0x30')]=qs['offset'](_0x140b09[_0x821c('0x42')]['offset']);}return _0x16130e[_0x821c('0xc5')](_0x2e992f);}})[_0x821c('0x23')](function(_0x32f6ce){if(_0x32f6ce){return _0x32f6ce?{'count':_0x5cccd7,'rows':_0x32f6ce}:null;}})[_0x821c('0x23')](respondWithResult(_0x5de581,null))[_0x821c('0x62')](handleError(_0x5de581,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index fd35a35..1701332 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 _0x77ec=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x77ec,0x1ab));var _0xc77e=function(_0x4749cc,_0x43be3f){_0x4749cc=_0x4749cc-0x0;var _0x16c4e5=_0x77ec[_0x4749cc];return _0x16c4e5;};'use strict';var EventEmitter=require(_0xc77e('0x0'));var FaxAccount=require(_0xc77e('0x1'))['db'][_0xc77e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc77e('0x3')](0x0);var events={'afterCreate':_0xc77e('0x4'),'afterUpdate':_0xc77e('0x5'),'afterDestroy':_0xc77e('0x6')};function emitEvent(_0x3d6374){return function(_0x3f56fa,_0x5656e2,_0x12007e){FaxAccountEvents[_0xc77e('0x7')](_0x3d6374+':'+_0x3f56fa['id'],_0x3f56fa);FaxAccountEvents[_0xc77e('0x7')](_0x3d6374,_0x3f56fa);_0x12007e(null);};}for(var e in events){if(events[_0xc77e('0x8')](e)){var event=events[e];FaxAccount[_0xc77e('0x9')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xd075=['FaxAccount','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x2a62b1,_0x23f742){var _0x16b9f2=function(_0x382b99){while(--_0x382b99){_0x2a62b1['push'](_0x2a62b1['shift']());}};_0x16b9f2(++_0x23f742);}(_0xd075,0xcb));var _0x5d07=function(_0x6c75a4,_0x414eb3){_0x6c75a4=_0x6c75a4-0x0;var _0x88afc8=_0xd075[_0x6c75a4];return _0x88afc8;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x5d07('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d07('0x1'),'afterUpdate':_0x5d07('0x2'),'afterDestroy':_0x5d07('0x3')};function emitEvent(_0xbf9c7d){return function(_0x501fb9,_0x3242bd,_0x1c6acc){FaxAccountEvents['emit'](_0xbf9c7d+':'+_0x501fb9['id'],_0x501fb9);FaxAccountEvents['emit'](_0xbf9c7d,_0x501fb9);_0x1c6acc(null);};}for(var e in events){if(events[_0x5d07('0x4')](e)){var event=events[e];FaxAccount[_0x5d07('0x5')](e,emitEvent(event));}}module[_0x5d07('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index b910a8b..6ffff3e 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 _0xa1be=['define','FaxAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0xa1be,0xbd));var _0xea1b=function(_0x510c74,_0x4702f3){_0x510c74=_0x510c74-0x0;var _0x6c31fa=_0xa1be[_0x510c74];return _0x6c31fa;};'use strict';var _=require('lodash');var util=require(_0xea1b('0x0'));var logger=require(_0xea1b('0x1'))(_0xea1b('0x2'));var moment=require(_0xea1b('0x3'));var BPromise=require(_0xea1b('0x4'));var rp=require(_0xea1b('0x5'));var fs=require('fs');var path=require(_0xea1b('0x6'));var rimraf=require(_0xea1b('0x7'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xea1b('0x8')]=function(_0x1e035d,_0x24c141){return _0x1e035d[_0xea1b('0x9')](_0xea1b('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33a8=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','util','api','moment'];(function(_0x4ee0d0,_0x10b283){var _0x389dec=function(_0xf00ed7){while(--_0xf00ed7){_0x4ee0d0['push'](_0x4ee0d0['shift']());}};_0x389dec(++_0x10b283);}(_0x33a8,0xcc));var _0x833a=function(_0x46df94,_0x32332b){_0x46df94=_0x46df94-0x0;var _0x76e487=_0x33a8[_0x46df94];return _0x76e487;};'use strict';var _=require(_0x833a('0x0'));var util=require(_0x833a('0x1'));var logger=require('../../config/logger')(_0x833a('0x2'));var moment=require(_0x833a('0x3'));var BPromise=require(_0x833a('0x4'));var rp=require(_0x833a('0x5'));var fs=require('fs');var path=require(_0x833a('0x6'));var rimraf=require(_0x833a('0x7'));var config=require(_0x833a('0x8'));var attributes=require(_0x833a('0x9'));module[_0x833a('0xa')]=function(_0x2c7422,_0x291b89){return _0x2c7422[_0x833a('0xb')]('FaxAccount',attributes,{'tableName':_0x833a('0xc'),'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 937c729..ebd5756 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 _0x0ff7=['CmList','List','Contacts','DESC','Applications','get','list','applications','priority','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','FaxAccount,\x20%s,\x20%s','error','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','include','map','model','attributes','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account'];(function(_0x407d38,_0x3f0578){var _0x5d0978=function(_0x265fef){while(--_0x265fef){_0x407d38['push'](_0x407d38['shift']());}};_0x5d0978(++_0x3f0578);}(_0x0ff7,0xdf));var _0x70ff=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x0ff7[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x70ff('0x0'));var BPromise=require(_0x70ff('0x1'));var rs=require(_0x70ff('0x2'));var fs=require('fs');var Redis=require(_0x70ff('0x3'));var db=require(_0x70ff('0x4'))['db'];var utils=require(_0x70ff('0x5'));var logger=require('../../config/logger')(_0x70ff('0x6'));var config=require(_0x70ff('0x7'));var jayson=require(_0x70ff('0x8'));var client=jayson[_0x70ff('0x9')][_0x70ff('0xa')]({'port':0x232c});config[_0x70ff('0xb')]=_['defaults'](config[_0x70ff('0xb')],{'host':_0x70ff('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0x70ff('0xd')](socket);function respondWithRpcPromise(_0x442755,_0x56d48e,_0x484283){return new BPromise(function(_0x456497,_0xb84664){return client[_0x70ff('0xe')](_0x442755,_0x484283)['then'](function(_0x541a04){logger[_0x70ff('0xf')]('FaxAccount,\x20%s,\x20%s',_0x56d48e,_0x70ff('0x10'));logger[_0x70ff('0x11')](_0x70ff('0x12'),_0x56d48e,_0x70ff('0x10'),JSON[_0x70ff('0x13')](_0x541a04));if(_0x541a04['error']){if(_0x541a04['error'][_0x70ff('0x14')]===0x1f4){logger['error'](_0x70ff('0x15'),_0x56d48e,_0x541a04[_0x70ff('0x16')][_0x70ff('0x17')]);return _0xb84664(_0x541a04[_0x70ff('0x16')][_0x70ff('0x17')]);}logger[_0x70ff('0x16')]('FaxAccount,\x20%s,\x20%s',_0x56d48e,_0x541a04[_0x70ff('0x16')]['message']);return _0x456497(_0x541a04[_0x70ff('0x16')][_0x70ff('0x17')]);}else{logger[_0x70ff('0xf')]('FaxAccount,\x20%s,\x20%s',_0x56d48e,_0x70ff('0x10'));_0x456497(_0x541a04['result']['message']);}})[_0x70ff('0x18')](function(_0x49bc82){logger[_0x70ff('0x16')]('FaxAccount,\x20%s,\x20%s',_0x56d48e,_0x49bc82);_0xb84664(_0x49bc82);});});}exports[_0x70ff('0x19')]=function(_0x3e7fdd){var _0x44584f=this;return new Promise(function(_0x332d00,_0x44624a){return db[_0x70ff('0x1a')][_0x70ff('0x1b')]({'raw':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')][_0x70ff('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')][_0x70ff('0x1e')]||null:null,'attributes':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')]['attributes']||null:null,'limit':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')]['limit']||null:null,'include':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')][_0x70ff('0x1f')]?_[_0x70ff('0x20')](_0x3e7fdd[_0x70ff('0x1c')][_0x70ff('0x1f')],function(_0xc52964){return{'model':db[_0xc52964[_0x70ff('0x21')]],'as':_0xc52964['as'],'attributes':_0xc52964[_0x70ff('0x22')],'include':_0xc52964[_0x70ff('0x1f')]?_[_0x70ff('0x20')](_0xc52964[_0x70ff('0x1f')],function(_0x227fe4){return{'model':db[_0x227fe4[_0x70ff('0x21')]],'as':_0x227fe4['as'],'attributes':_0x227fe4[_0x70ff('0x22')],'include':_0x227fe4['include']?_['map'](_0x227fe4[_0x70ff('0x1f')],function(_0x5ee1a1){return{'model':db[_0x5ee1a1['model']],'as':_0x5ee1a1['as'],'attributes':_0x5ee1a1[_0x70ff('0x22')]};}):[]};}):[]};}):[]:[]})[_0x70ff('0x23')](function(_0x39876f){logger[_0x70ff('0xf')](_0x70ff('0x19'),_0x3e7fdd);logger[_0x70ff('0x11')](_0x70ff('0x19'),_0x3e7fdd,JSON[_0x70ff('0x13')](_0x39876f));_0x332d00(_0x39876f);})['catch'](function(_0x168035){logger[_0x70ff('0x16')](_0x70ff('0x19'),_0x168035[_0x70ff('0x17')],_0x3e7fdd);_0x44624a(_0x44584f[_0x70ff('0x16')](0x1f4,_0x168035['message']));});});};exports[_0x70ff('0x24')]=function(_0x10bfad,_0x25a349,_0xdd2d56){var _0x40a0ec=this;return new Promise(function(_0x16f29c,_0x428b1e){var _0x484cf4={'body':_0x10bfad[_0x70ff('0x25')],'channel':_0x70ff('0x26')};var _0x5dd9e7=[];var _0x28731=[];var _0x190a5b={};return db[_0x70ff('0x27')][_0x70ff('0x28')]()['then'](function(_0xf60ca9){if(!_0xf60ca9){throw new db[(_0x70ff('0x29'))][(_0x70ff('0x2a'))]('no\x20available\x20attributes');}_0x5dd9e7=_[_0x70ff('0x2b')](_[_0x70ff('0x2c')](_0xf60ca9),[_0x70ff('0x2d'),_0x70ff('0x2e')]);_0x28731=_[_0x70ff('0x2b')](_[_0x70ff('0x2c')](_0xf60ca9),['createdAt',_0x70ff('0x2e'),_0x70ff('0x2f'),_0x70ff('0x30')]);if(_0x10bfad[_0x70ff('0x25')]['id']){delete _0x10bfad[_0x70ff('0x25')]['id'];}if(_[_0x70ff('0x31')](_0x10bfad['body'][_0x70ff('0x32')])){throw new db[(_0x70ff('0x29'))][(_0x70ff('0x2a'))](_0x70ff('0x33'));}if(_['isNil'](_0x10bfad['body'][_0x70ff('0x25')])||_0x10bfad['body'][_0x70ff('0x25')]===''){throw new db['Sequelize'][(_0x70ff('0x2a'))](_0x70ff('0x34'));}if(_['isNil'](_0x10bfad[_0x70ff('0x25')][_0x70ff('0x35')])){throw new db[(_0x70ff('0x29'))][(_0x70ff('0x2a'))](_0x70ff('0x36')+_0x28731);}if(!_[_0x70ff('0x37')](_0x28731,_0x10bfad[_0x70ff('0x25')]['mapKey'])){throw new db[(_0x70ff('0x29'))][(_0x70ff('0x2a'))](_0x70ff('0x38')+_0x28731);}_0x190a5b[_0x10bfad[_0x70ff('0x25')][_0x70ff('0x35')]]=_0x10bfad['body'][_0x70ff('0x32')];})['then'](function(){return db[_0x70ff('0x1a')][_0x70ff('0x39')]({'where':{'id':_0x10bfad[_0x70ff('0x3a')]['id']},'include':[{'model':db[_0x70ff('0x3b')],'as':_0x70ff('0x3c'),'include':[{'model':db['CmContact'],'as':_0x70ff('0x3d'),'where':_0x190a5b,'limit':0x1,'order':[[_0x70ff('0x2e'),_0x70ff('0x3e')]]}]},{'model':db['FaxApplication'],'as':_0x70ff('0x3f')}]});})[_0x70ff('0x23')](function(_0x12c23e){if(_0x12c23e&&_0x12c23e['List']){var _0x38145b=_0x12c23e[_0x70ff('0x40')]({'plain':!![]});_0x484cf4[_0x70ff('0x3a')]=_0x38145b;_0x484cf4['applications']=_0x38145b[_0x70ff('0x3f')];_0x484cf4[_0x70ff('0x41')]=_0x38145b[_0x70ff('0x3c')];_0x484cf4[_0x70ff('0x42')]=_['orderBy'](_0x484cf4[_0x70ff('0x42')],[_0x70ff('0x43')],['asc']);if(_0x484cf4[_0x70ff('0x3a')]['Applications']){delete _0x484cf4['account'][_0x70ff('0x3f')];}if(_0x484cf4[_0x70ff('0x3a')]['List']&&_0x484cf4[_0x70ff('0x3a')]['List'][_0x70ff('0x3d')]['length']){return _0x484cf4['account'][_0x70ff('0x3c')][_0x70ff('0x3d')][0x0];}var _0x3fa118=_[_0x70ff('0x44')](_0x10bfad[_0x70ff('0x25')],{'firstName':_0x10bfad[_0x70ff('0x25')][_0x70ff('0x32')],'ListId':_0x38145b['ListId']});_0x3fa118[_0x10bfad['body'][_0x70ff('0x35')]]=_0x10bfad['body'][_0x70ff('0x32')];return db[_0x70ff('0x27')][_0x70ff('0x45')](_0x3fa118,{'fields':_0x5dd9e7,'raw':!![]});}})[_0x70ff('0x23')](function(_0x319ff7){_0x484cf4[_0x70ff('0x46')]=_0x319ff7;if(_0x319ff7){var _0x4f71aa={'ContactId':_0x319ff7['id'],'FaxAccountId':_0x10bfad[_0x70ff('0x3a')]['id'],'fax':_0x319ff7[_0x70ff('0x26')]};return db[_0x70ff('0x47')][_0x70ff('0x39')]({'where':{'ContactId':_0x319ff7['id'],'closed':![],'FaxAccountId':_0x10bfad[_0x70ff('0x3a')]['id']}})[_0x70ff('0x23')](function(_0x1a452f){if(_0x1a452f){return[_0x1a452f,![]];}return db[_0x70ff('0x47')]['create'](_0x4f71aa)[_0x70ff('0x23')](function(_0xe89631){return[_0xe89631,!![]];});});}else{throw new Error(_0x70ff('0x48'));}})[_0x70ff('0x49')](function(_0x51cbf9,_0x2e448b){var _0x2deb67=_0x51cbf9[_0x70ff('0x40')]({'plain':!![]});if(_0x2e448b){if(_0x484cf4[_0x70ff('0x3a')][_0x70ff('0x4a')]){_0x484cf4[_0x70ff('0x42')][_0x70ff('0x4b')]({'id':0x0,'priority':_0x484cf4['applications'][_0x70ff('0x4c')]+0x1,'app':_0x70ff('0x4d'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x2deb67[_0x70ff('0x4e')]=!![];}else{_0x2deb67[_0x70ff('0x4e')]=![];}_0x484cf4[_0x70ff('0x4f')]=_0x2deb67;return db[_0x70ff('0x50')][_0x70ff('0x45')]({'body':_0x10bfad[_0x70ff('0x25')]['body'],'FaxAccountId':_0x10bfad[_0x70ff('0x3a')]['id'],'FaxInteractionId':_0x51cbf9['id'],'direction':'in','ContactId':_0x51cbf9['ContactId'],'AttachmentId':_0x10bfad[_0x70ff('0x25')][_0x70ff('0x51')]});})[_0x70ff('0x23')](function(_0x27d56f){_0x484cf4[_0x70ff('0x17')]=_0x27d56f;if(!_0x484cf4['interaction'][_0x70ff('0x52')])return;return db[_0x70ff('0x53')][_0x70ff('0x39')]({'attributes':['id',_0x70ff('0x54')],'where':{'id':_0x484cf4[_0x70ff('0x4f')]['UserId']}});})[_0x70ff('0x23')](function(_0x2a7f50){if(_0x2a7f50){_0x484cf4[_0x70ff('0x42')][_0x70ff('0x55')]({'id':0x0,'priority':0x0,'app':_0x70ff('0x56'),'appdata':_0x2a7f50[_0x70ff('0x54')]+','+(_0x484cf4[_0x70ff('0x3a')][_0x70ff('0x57')]||0xa),'interval':_0x70ff('0x58')});}if(!_0x484cf4[_0x70ff('0x4f')][_0x70ff('0x59')])return;return db[_0x70ff('0x5a')][_0x70ff('0x39')]({'attributes':['id',_0x70ff('0x54')],'where':{'id':_0x484cf4[_0x70ff('0x4f')][_0x70ff('0x59')]}});})[_0x70ff('0x23')](function(_0x4266b8){if(_0x4266b8){_0x484cf4[_0x70ff('0x42')][_0x70ff('0x55')]({'id':0x0,'priority':0x1,'app':_0x70ff('0x5b'),'appdata':_0x4266b8[_0x70ff('0x54')]+','+(_0x484cf4[_0x70ff('0x3a')][_0x70ff('0x5c')]||0x12c),'interval':_0x70ff('0x58')});}return respondWithRpcPromise('Start',_0x70ff('0x5d'),_0x484cf4);})[_0x70ff('0x23')](function(_0x23c895){_0x16f29c(_0x23c895);})['catch'](function(_0xe88f42){_0x428b1e(_0x40a0ec[_0x70ff('0x16')](0x1f4,_0xe88f42[_0x70ff('0x17')]));});});}; \ No newline at end of file +var _0xedcc=['fax','CmContact','describe','Sequelize','ValidationError','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','CmList','List','FaxApplication','Applications','get','account','list','applications','orderBy','priority','Contacts','length','defaults','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','*,*,*,*','queueId','FaxQueue','queue','Start','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxAccount,\x20%s,\x20%s','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include','map','model','debug','stringify','body'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0xedcc,0x1e2));var _0xcedc=function(_0x34b001,_0x4c91c8){_0x34b001=_0x34b001-0x0;var _0x4f96ff=_0xedcc[_0x34b001];return _0x4f96ff;};'use strict';var _=require(_0xcedc('0x0'));var util=require(_0xcedc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcedc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcedc('0x3'));var logger=require(_0xcedc('0x4'))(_0xcedc('0x5'));var config=require(_0xcedc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcedc('0x7')]['http']({'port':0x232c});config[_0xcedc('0x8')]=_['defaults'](config['redis'],{'host':_0xcedc('0x9'),'port':0x18eb});var socket=require(_0xcedc('0xa'))(new Redis(config[_0xcedc('0x8')]));require('./faxAccount.socket')[_0xcedc('0xb')](socket);function respondWithRpcPromise(_0x52e4f8,_0x2d5703,_0x262e16){return new BPromise(function(_0x2e24af,_0x581a0d){return client[_0xcedc('0xc')](_0x52e4f8,_0x262e16)[_0xcedc('0xd')](function(_0x1d0261){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2d5703,_0xcedc('0xe'));logger['debug'](_0xcedc('0xf'),_0x2d5703,_0xcedc('0xe'),JSON['stringify'](_0x1d0261));if(_0x1d0261[_0xcedc('0x10')]){if(_0x1d0261[_0xcedc('0x10')][_0xcedc('0x11')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2d5703,_0x1d0261[_0xcedc('0x10')]['message']);return _0x581a0d(_0x1d0261[_0xcedc('0x10')][_0xcedc('0x12')]);}logger[_0xcedc('0x10')]('FaxAccount,\x20%s,\x20%s',_0x2d5703,_0x1d0261['error'][_0xcedc('0x12')]);return _0x2e24af(_0x1d0261[_0xcedc('0x10')][_0xcedc('0x12')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x2d5703,_0xcedc('0xe'));_0x2e24af(_0x1d0261[_0xcedc('0x13')][_0xcedc('0x12')]);}})[_0xcedc('0x14')](function(_0x591d44){logger[_0xcedc('0x10')](_0xcedc('0x15'),_0x2d5703,_0x591d44);_0x581a0d(_0x591d44);});});}exports[_0xcedc('0x16')]=function(_0x32ab6d){var _0x1b2460=this;return new Promise(function(_0x3d1286,_0x439ae6){return db[_0xcedc('0x17')][_0xcedc('0x18')]({'raw':_0x32ab6d['options']?_0x32ab6d['options']['raw']===undefined?!![]:![]:!![],'where':_0x32ab6d['options']?_0x32ab6d['options']['where']||null:null,'attributes':_0x32ab6d[_0xcedc('0x19')]?_0x32ab6d[_0xcedc('0x19')][_0xcedc('0x1a')]||null:null,'limit':_0x32ab6d['options']?_0x32ab6d['options'][_0xcedc('0x1b')]||null:null,'include':_0x32ab6d[_0xcedc('0x19')]?_0x32ab6d[_0xcedc('0x19')][_0xcedc('0x1c')]?_[_0xcedc('0x1d')](_0x32ab6d['options'][_0xcedc('0x1c')],function(_0x14ddfa){return{'model':db[_0x14ddfa[_0xcedc('0x1e')]],'as':_0x14ddfa['as'],'attributes':_0x14ddfa[_0xcedc('0x1a')],'include':_0x14ddfa[_0xcedc('0x1c')]?_['map'](_0x14ddfa[_0xcedc('0x1c')],function(_0x11643f){return{'model':db[_0x11643f['model']],'as':_0x11643f['as'],'attributes':_0x11643f['attributes'],'include':_0x11643f[_0xcedc('0x1c')]?_['map'](_0x11643f[_0xcedc('0x1c')],function(_0x2ad9b8){return{'model':db[_0x2ad9b8[_0xcedc('0x1e')]],'as':_0x2ad9b8['as'],'attributes':_0x2ad9b8[_0xcedc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4940dc){logger['info']('GetFaxAccount',_0x32ab6d);logger[_0xcedc('0x1f')](_0xcedc('0x16'),_0x32ab6d,JSON[_0xcedc('0x20')](_0x4940dc));_0x3d1286(_0x4940dc);})['catch'](function(_0x27d792){logger['error'](_0xcedc('0x16'),_0x27d792['message'],_0x32ab6d);_0x439ae6(_0x1b2460[_0xcedc('0x10')](0x1f4,_0x27d792[_0xcedc('0x12')]));});});};exports['NotifyFaxAccount']=function(_0xd0e60f,_0x595d1,_0x121701){var _0x1d6f5f=this;return new Promise(function(_0x13016f,_0x9046b6){var _0x52e982={'body':_0xd0e60f[_0xcedc('0x21')],'channel':_0xcedc('0x22')};var _0x4d95c1=[];var _0x440839=[];var _0x1255de={};return db[_0xcedc('0x23')][_0xcedc('0x24')]()[_0xcedc('0xd')](function(_0x2c6c12){if(!_0x2c6c12){throw new db[(_0xcedc('0x25'))][(_0xcedc('0x26'))]('no\x20available\x20attributes');}_0x4d95c1=_['difference'](_['keys'](_0x2c6c12),[_0xcedc('0x27'),'updatedAt']);_0x440839=_[_0xcedc('0x28')](_['keys'](_0x2c6c12),[_0xcedc('0x27'),_0xcedc('0x29'),_0xcedc('0x2a'),_0xcedc('0x2b')]);if(_0xd0e60f[_0xcedc('0x21')]['id']){delete _0xd0e60f[_0xcedc('0x21')]['id'];}if(_[_0xcedc('0x2c')](_0xd0e60f[_0xcedc('0x21')]['from'])){throw new db[(_0xcedc('0x25'))][(_0xcedc('0x26'))](_0xcedc('0x2d'));}if(_['isNil'](_0xd0e60f[_0xcedc('0x21')][_0xcedc('0x21')])||_0xd0e60f['body']['body']===''){throw new db[(_0xcedc('0x25'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xd0e60f['body'][_0xcedc('0x2e')])){throw new db[(_0xcedc('0x25'))][(_0xcedc('0x26'))](_0xcedc('0x2f')+_0x440839);}if(!_[_0xcedc('0x30')](_0x440839,_0xd0e60f['body'][_0xcedc('0x2e')])){throw new db[(_0xcedc('0x25'))]['ValidationError'](_0xcedc('0x31')+_0x440839);}_0x1255de[_0xd0e60f['body'][_0xcedc('0x2e')]]=_0xd0e60f[_0xcedc('0x21')][_0xcedc('0x32')];})['then'](function(){return db['FaxAccount'][_0xcedc('0x33')]({'where':{'id':_0xd0e60f['account']['id']},'include':[{'model':db[_0xcedc('0x34')],'as':_0xcedc('0x35'),'include':[{'model':db[_0xcedc('0x23')],'as':'Contacts','where':_0x1255de,'limit':0x1,'order':[[_0xcedc('0x29'),'DESC']]}]},{'model':db[_0xcedc('0x36')],'as':_0xcedc('0x37')}]});})[_0xcedc('0xd')](function(_0xf22a78){if(_0xf22a78&&_0xf22a78['List']){var _0x383c7a=_0xf22a78[_0xcedc('0x38')]({'plain':!![]});_0x52e982[_0xcedc('0x39')]=_0x383c7a;_0x52e982['applications']=_0x383c7a[_0xcedc('0x37')];_0x52e982[_0xcedc('0x3a')]=_0x383c7a[_0xcedc('0x35')];_0x52e982[_0xcedc('0x3b')]=_[_0xcedc('0x3c')](_0x52e982['applications'],[_0xcedc('0x3d')],['asc']);if(_0x52e982[_0xcedc('0x39')]['Applications']){delete _0x52e982[_0xcedc('0x39')][_0xcedc('0x37')];}if(_0x52e982[_0xcedc('0x39')][_0xcedc('0x35')]&&_0x52e982[_0xcedc('0x39')]['List'][_0xcedc('0x3e')][_0xcedc('0x3f')]){return _0x52e982[_0xcedc('0x39')]['List']['Contacts'][0x0];}var _0x600539=_[_0xcedc('0x40')](_0xd0e60f[_0xcedc('0x21')],{'firstName':_0xd0e60f[_0xcedc('0x21')][_0xcedc('0x32')],'ListId':_0x383c7a['ListId']});_0x600539[_0xd0e60f['body'][_0xcedc('0x2e')]]=_0xd0e60f[_0xcedc('0x21')][_0xcedc('0x32')];return db[_0xcedc('0x23')]['create'](_0x600539,{'fields':_0x4d95c1,'raw':!![]});}})['then'](function(_0x34d29f){_0x52e982['contact']=_0x34d29f;if(_0x34d29f){var _0x1612cd={'ContactId':_0x34d29f['id'],'FaxAccountId':_0xd0e60f['account']['id'],'fax':_0x34d29f[_0xcedc('0x22')]};return db['FaxInteraction'][_0xcedc('0x33')]({'where':{'ContactId':_0x34d29f['id'],'closed':![],'FaxAccountId':_0xd0e60f[_0xcedc('0x39')]['id']}})[_0xcedc('0xd')](function(_0x300780){if(_0x300780){return[_0x300780,![]];}return db[_0xcedc('0x41')]['create'](_0x1612cd)[_0xcedc('0xd')](function(_0x66040d){return[_0x66040d,!![]];});});}else{throw new Error(_0xcedc('0x42'));}})[_0xcedc('0x43')](function(_0x503d59,_0x59f4f4){var _0x560315=_0x503d59[_0xcedc('0x38')]({'plain':!![]});if(_0x59f4f4){if(_0x52e982['account']['autoclose']){_0x52e982[_0xcedc('0x3b')][_0xcedc('0x44')]({'id':0x0,'priority':_0x52e982['applications'][_0xcedc('0x3f')]+0x1,'app':_0xcedc('0x45'),'appdata':_0xcedc('0x46'),'interval':'*,*,*,*'});}_0x560315[_0xcedc('0x47')]=!![];}else{_0x560315[_0xcedc('0x47')]=![];}_0x52e982['interaction']=_0x560315;return db[_0xcedc('0x48')]['create']({'body':_0xd0e60f['body'][_0xcedc('0x21')],'FaxAccountId':_0xd0e60f[_0xcedc('0x39')]['id'],'FaxInteractionId':_0x503d59['id'],'direction':'in','ContactId':_0x503d59[_0xcedc('0x49')],'AttachmentId':_0xd0e60f[_0xcedc('0x21')][_0xcedc('0x4a')]});})[_0xcedc('0xd')](function(_0x544355){_0x52e982['message']=_0x544355;if(!_0x52e982[_0xcedc('0x4b')][_0xcedc('0x4c')])return;return db[_0xcedc('0x4d')]['find']({'attributes':['id',_0xcedc('0x4e')],'where':{'id':_0x52e982[_0xcedc('0x4b')][_0xcedc('0x4c')]}});})[_0xcedc('0xd')](function(_0x5efa07){if(_0x5efa07){_0x52e982[_0xcedc('0x3b')][_0xcedc('0x4f')]({'id':0x0,'priority':0x0,'app':_0xcedc('0x50'),'appdata':_0x5efa07[_0xcedc('0x4e')]+','+(_0x52e982[_0xcedc('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0xcedc('0x51')});}if(!_0x52e982[_0xcedc('0x4b')][_0xcedc('0x52')])return;return db[_0xcedc('0x53')][_0xcedc('0x33')]({'attributes':['id','name'],'where':{'id':_0x52e982['interaction'][_0xcedc('0x52')]}});})[_0xcedc('0xd')](function(_0x2c863d){if(_0x2c863d){_0x52e982[_0xcedc('0x3b')][_0xcedc('0x4f')]({'id':0x0,'priority':0x1,'app':_0xcedc('0x54'),'appdata':_0x2c863d[_0xcedc('0x4e')]+','+(_0x52e982[_0xcedc('0x39')]['waitForTheAssignedQueue']||0x12c),'interval':_0xcedc('0x51')});}return respondWithRpcPromise(_0xcedc('0x55'),'startRouting',_0x52e982);})['then'](function(_0x50e087){_0x13016f(_0x50e087);})[_0xcedc('0x14')](function(_0x575bf2){_0x9046b6(_0x1d6f5f[_0xcedc('0x10')](0x1f4,_0x575bf2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 34cf35b..abab996 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 _0xb35f=['register','length','faxAccount:','./faxAccount.events','save','emit','removeListener'];(function(_0x4fea6f,_0x525c40){var _0x4d148b=function(_0x464a53){while(--_0x464a53){_0x4fea6f['push'](_0x4fea6f['shift']());}};_0x4d148b(++_0x525c40);}(_0xb35f,0x73));var _0xfb35=function(_0x408a25,_0x3d8918){_0x408a25=_0x408a25-0x0;var _0x2d5217=_0xb35f[_0x408a25];return _0x2d5217;};'use strict';var FaxAccountEvents=require(_0xfb35('0x0'));var events=[_0xfb35('0x1'),'remove','update'];function createListener(_0x53401f,_0x156c4f){return function(_0x5aaa13){_0x156c4f[_0xfb35('0x2')](_0x53401f,_0x5aaa13);};}function removeListener(_0x5a8ec8,_0x196149){return function(){FaxAccountEvents[_0xfb35('0x3')](_0x5a8ec8,_0x196149);};}exports[_0xfb35('0x4')]=function(_0x552ec4){for(var _0xb705dc=0x0,_0x250a36=events[_0xfb35('0x5')];_0xb705dc<_0x250a36;_0xb705dc++){var _0x5a2453=events[_0xb705dc];var _0x4c7fa3=createListener(_0xfb35('0x6')+_0x5a2453,_0x552ec4);FaxAccountEvents['on'](_0x5a2453,_0x4c7fa3);}}; \ No newline at end of file +var _0x20ba=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x50cc57,_0xc7084){var _0xea88f=function(_0x2036a8){while(--_0x2036a8){_0x50cc57['push'](_0x50cc57['shift']());}};_0xea88f(++_0xc7084);}(_0x20ba,0x7c));var _0xa20b=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x20ba[_0x2aee2f];return _0x19337f;};'use strict';var FaxAccountEvents=require(_0xa20b('0x0'));var events=[_0xa20b('0x1'),_0xa20b('0x2'),_0xa20b('0x3')];function createListener(_0xb4190a,_0x5e1696){return function(_0x3054d5){_0x5e1696[_0xa20b('0x4')](_0xb4190a,_0x3054d5);};}function removeListener(_0xf663c9,_0x1b4a0f){return function(){FaxAccountEvents[_0xa20b('0x5')](_0xf663c9,_0x1b4a0f);};}exports[_0xa20b('0x6')]=function(_0x217793){for(var _0x14e813=0x0,_0x33030f=events[_0xa20b('0x7')];_0x14e813<_0x33030f;_0x14e813++){var _0x447588=events[_0x14e813];var _0x48c5a0=createListener(_0xa20b('0x8')+_0x447588,_0x217793);FaxAccountEvents['on'](_0x447588,_0x48c5a0);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c72d03e..83a5ef6 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 _0x29c0=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/users','post','create','addDisposition','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller'];(function(_0x46a267,_0x3fa3a0){var _0x8c4854=function(_0x42fa90){while(--_0x42fa90){_0x46a267['push'](_0x46a267['shift']());}};_0x8c4854(++_0x3fa3a0);}(_0x29c0,0x11b));var _0x029c=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x29c0[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x029c('0x0'));var util=require(_0x029c('0x1'));var path=require(_0x029c('0x2'));var timeout=require(_0x029c('0x3'));var express=require(_0x029c('0x4'));var router=express[_0x029c('0x5')]();var fs_extra=require(_0x029c('0x6'));var auth=require(_0x029c('0x7'));var interaction=require(_0x029c('0x8'));var config=require(_0x029c('0x9'));var controller=require(_0x029c('0xa'));router[_0x029c('0xb')]('/',auth[_0x029c('0xc')](),controller[_0x029c('0xd')]);router[_0x029c('0xb')](_0x029c('0xe'),auth[_0x029c('0xc')](),controller[_0x029c('0xf')]);router[_0x029c('0xb')](_0x029c('0x10'),auth[_0x029c('0xc')](),controller[_0x029c('0x11')]);router[_0x029c('0xb')](_0x029c('0x12'),auth[_0x029c('0xc')](),controller[_0x029c('0x13')]);router['get'](_0x029c('0x14'),auth[_0x029c('0xc')](),controller['getAnswers']);router[_0x029c('0xb')](_0x029c('0x15'),auth[_0x029c('0xc')](),controller[_0x029c('0x16')]);router[_0x029c('0xb')](_0x029c('0x17'),auth[_0x029c('0xc')](),controller['getApplications']);router[_0x029c('0xb')]('/:id/messages',auth[_0x029c('0xc')](),controller['getMessages']);router['get'](_0x029c('0x18'),auth['isAuthenticated'](),controller['getAgents']);router[_0x029c('0x19')]('/',auth[_0x029c('0xc')](),controller[_0x029c('0x1a')]);router['post']('/:id/dispositions',auth[_0x029c('0xc')](),controller[_0x029c('0x1b')]);router['post'](_0x029c('0x14'),auth[_0x029c('0xc')](),controller['addAnswer']);router[_0x029c('0x19')](_0x029c('0x15'),auth[_0x029c('0xc')](),controller[_0x029c('0x1c')]);router[_0x029c('0x19')]('/:id/applications',auth[_0x029c('0xc')](),controller[_0x029c('0x1d')]);router[_0x029c('0x19')](_0x029c('0x1e'),auth[_0x029c('0xc')](),controller['addAccountApplications']);router[_0x029c('0x19')](_0x029c('0x1f'),auth[_0x029c('0xc')](),controller[_0x029c('0x20')]);router[_0x029c('0x19')](_0x029c('0x21'),auth[_0x029c('0xc')](),controller[_0x029c('0x22')]);router[_0x029c('0x19')](_0x029c('0x18'),auth[_0x029c('0xc')](),controller[_0x029c('0x23')]);router['put'](_0x029c('0x10'),auth[_0x029c('0xc')](),controller[_0x029c('0x24')]);router[_0x029c('0x25')]('/:id',auth[_0x029c('0xc')](),controller[_0x029c('0x26')]);router[_0x029c('0x25')]('/:id/dispositions',auth[_0x029c('0xc')](),controller[_0x029c('0x27')]);router[_0x029c('0x25')](_0x029c('0x14'),auth[_0x029c('0xc')](),controller[_0x029c('0x28')]);router[_0x029c('0x25')](_0x029c('0x18'),auth[_0x029c('0xc')](),controller[_0x029c('0x29')]);module['exports']=router; \ No newline at end of file +var _0xfdfe=['send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/messages','getMessages','post','addAnswer','/:id/interactions','addInteraction','/:id/applications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xfdfe,0x151));var _0xefdf=function(_0x16104c,_0x11bf26){_0x16104c=_0x16104c-0x0;var _0x26b9e2=_0xfdfe[_0x16104c];return _0x26b9e2;};'use strict';var multer=require(_0xefdf('0x0'));var util=require(_0xefdf('0x1'));var path=require(_0xefdf('0x2'));var timeout=require(_0xefdf('0x3'));var express=require(_0xefdf('0x4'));var router=express[_0xefdf('0x5')]();var fs_extra=require(_0xefdf('0x6'));var auth=require(_0xefdf('0x7'));var interaction=require(_0xefdf('0x8'));var config=require('../../config/environment');var controller=require(_0xefdf('0x9'));router[_0xefdf('0xa')]('/',auth[_0xefdf('0xb')](),controller['index']);router['get'](_0xefdf('0xc'),auth['isAuthenticated'](),controller[_0xefdf('0xd')]);router[_0xefdf('0xa')](_0xefdf('0xe'),auth[_0xefdf('0xb')](),controller[_0xefdf('0xf')]);router[_0xefdf('0xa')](_0xefdf('0x10'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x11')]);router[_0xefdf('0xa')](_0xefdf('0x12'),auth[_0xefdf('0xb')](),controller['getAnswers']);router[_0xefdf('0xa')]('/:id/interactions',auth[_0xefdf('0xb')](),controller['getInteractions']);router[_0xefdf('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0xefdf('0x13')]);router[_0xefdf('0xa')](_0xefdf('0x14'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x15')]);router[_0xefdf('0xa')]('/:id/users',auth[_0xefdf('0xb')](),controller['getAgents']);router[_0xefdf('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0xefdf('0x16')](_0xefdf('0x10'),auth[_0xefdf('0xb')](),controller['addDisposition']);router[_0xefdf('0x16')](_0xefdf('0x12'),auth['isAuthenticated'](),controller[_0xefdf('0x17')]);router[_0xefdf('0x16')](_0xefdf('0x18'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x19')]);router['post'](_0xefdf('0x1a'),auth[_0xefdf('0xb')](),controller['addApplications']);router[_0xefdf('0x16')](_0xefdf('0x1b'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x1c')]);router[_0xefdf('0x16')](_0xefdf('0x1d'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x1e')]);router[_0xefdf('0x16')](_0xefdf('0x1f'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x20')]);router[_0xefdf('0x16')](_0xefdf('0x21'),auth[_0xefdf('0xb')](),controller['addAgents']);router[_0xefdf('0x22')]('/:id',auth[_0xefdf('0xb')](),controller[_0xefdf('0x23')]);router[_0xefdf('0x24')](_0xefdf('0xe'),auth[_0xefdf('0xb')](),controller['destroy']);router['delete'](_0xefdf('0x10'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x25')]);router['delete'](_0xefdf('0x12'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x26')]);router[_0xefdf('0x24')](_0xefdf('0x21'),auth[_0xefdf('0xb')](),controller[_0xefdf('0x27')]);module[_0xefdf('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c7beb97..e9b7553 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 _0xfb46=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfb46,0x1dd));var _0x6fb4=function(_0x2f1d2f,_0x527d85){_0x2f1d2f=_0x2f1d2f-0x0;var _0x2874cf=_0xfb46[_0x2f1d2f];return _0x2874cf;};'use strict';var Sequelize=require(_0x6fb4('0x0'));module[_0x6fb4('0x1')]={'priority':{'type':Sequelize[_0x6fb4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6fb4('0x3')],'allowNull':![],'defaultValue':_0x6fb4('0x4')},'appdata':{'type':Sequelize[_0x6fb4('0x5')]()},'description':{'type':Sequelize[_0x6fb4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1d94=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x5a6a5d,_0x52ff80){var _0x42aae5=function(_0x215fd0){while(--_0x215fd0){_0x5a6a5d['push'](_0x5a6a5d['shift']());}};_0x42aae5(++_0x52ff80);}(_0x1d94,0x67));var _0x41d9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d94[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x41d9('0x0'));module[_0x41d9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x41d9('0x2')},'appdata':{'type':Sequelize[_0x41d9('0x3')]()},'description':{'type':Sequelize[_0x41d9('0x4')]},'interval':{'type':Sequelize[_0x41d9('0x4')],'defaultValue':_0x41d9('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 9e6a909..7624a83 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 _0xd0ed=['rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','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','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','update','then','destroy','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd0ed,0x12e));var _0xdd0e=function(_0x5f48f0,_0x2c75aa){_0x5f48f0=_0x5f48f0-0x0;var _0x1d5f5a=_0xd0ed[_0x5f48f0];return _0x1d5f5a;};'use strict';var emlformat=require(_0xdd0e('0x0'));var rimraf=require(_0xdd0e('0x1'));var zipdir=require(_0xdd0e('0x2'));var jsonpatch=require(_0xdd0e('0x3'));var rp=require(_0xdd0e('0x4'));var moment=require(_0xdd0e('0x5'));var BPromise=require(_0xdd0e('0x6'));var Mustache=require(_0xdd0e('0x7'));var util=require(_0xdd0e('0x8'));var path=require(_0xdd0e('0x9'));var sox=require(_0xdd0e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd0e('0xb'));var squel=require('squel');var crypto=require(_0xdd0e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd0e('0xd'));var querystring=require(_0xdd0e('0xe'));var Papa=require(_0xdd0e('0xf'));var Redis=require(_0xdd0e('0x10'));var authService=require(_0xdd0e('0x11'));var qs=require(_0xdd0e('0x12'));var as=require(_0xdd0e('0x13'));var hardwareService=require(_0xdd0e('0x14'));var logger=require(_0xdd0e('0x15'))(_0xdd0e('0x16'));var utils=require(_0xdd0e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdd0e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20af68,_0x4dea6b){_0x4dea6b=_0x4dea6b||0xcc;return function(_0x406339){if(_0x406339){return _0x20af68[_0xdd0e('0x19')](_0x4dea6b);}return _0x20af68[_0xdd0e('0x1a')](_0x4dea6b)['end']();};}function respondWithResult(_0x97e751,_0x2cbce1){_0x2cbce1=_0x2cbce1||0xc8;return function(_0x28b8d8){if(_0x28b8d8){return _0x97e751['status'](_0x2cbce1)['json'](_0x28b8d8);}};}function respondWithFilteredResult(_0x1d3d97,_0x3c08a7){return function(_0x13d6c6){if(_0x13d6c6){var _0x5627bc=typeof _0x3c08a7[_0xdd0e('0x1b')]===_0xdd0e('0x1c')&&typeof _0x3c08a7['limit']==='undefined';var _0xfbbb8f=_0x13d6c6['count'];var _0x49353e=_0x5627bc?0x0:_0x3c08a7[_0xdd0e('0x1b')];var _0x3eacf8=_0x5627bc?_0x13d6c6[_0xdd0e('0x1d')]:_0x3c08a7[_0xdd0e('0x1b')]+_0x3c08a7[_0xdd0e('0x1e')];var _0x4f8429;if(_0x3eacf8>=_0xfbbb8f){_0x3eacf8=_0xfbbb8f;_0x4f8429=0xc8;}else{_0x4f8429=0xce;}_0x1d3d97['status'](_0x4f8429);return _0x1d3d97['set'](_0xdd0e('0x1f'),_0x49353e+'-'+_0x3eacf8+'/'+_0xfbbb8f)[_0xdd0e('0x20')](_0x13d6c6);}return null;};}function patchUpdates(_0x5b88fe){return function(_0x20ea22){try{jsonpatch[_0xdd0e('0x21')](_0x20ea22,_0x5b88fe,!![]);}catch(_0x409ea0){return BPromise['reject'](_0x409ea0);}return _0x20ea22['save']();};}function saveUpdates(_0x423ded,_0x3b675d){return function(_0x317d26){if(_0x317d26){return _0x317d26[_0xdd0e('0x22')](_0x423ded)[_0xdd0e('0x23')](function(_0x1bee6b){return _0x1bee6b;});}return null;};}function removeEntity(_0x172cb6,_0x9c1ad1){return function(_0x26cab7){if(_0x26cab7){return _0x26cab7[_0xdd0e('0x24')]()[_0xdd0e('0x23')](function(){_0x172cb6[_0xdd0e('0x1a')](0xcc)[_0xdd0e('0x25')]();});}};}function handleEntityNotFound(_0x2383f6,_0x415fbb){return function(_0x5313b8){if(!_0x5313b8){_0x2383f6[_0xdd0e('0x19')](0x194);}return _0x5313b8;};}function handleError(_0x2875f9,_0x485745){_0x485745=_0x485745||0x1f4;return function(_0x4d33e3){logger[_0xdd0e('0x26')](_0x4d33e3[_0xdd0e('0x27')]);if(_0x4d33e3[_0xdd0e('0x28')]){delete _0x4d33e3[_0xdd0e('0x28')];}_0x2875f9[_0xdd0e('0x1a')](_0x485745)[_0xdd0e('0x29')](_0x4d33e3);};}exports[_0xdd0e('0x2a')]=function(_0x32103d,_0x400c79){var _0x35bd85={},_0x409e62={},_0x26ea38={'count':0x0,'rows':[]};var _0x352030=_[_0xdd0e('0x2b')](db[_0xdd0e('0x2c')][_0xdd0e('0x2d')],function(_0x2fc11b){return{'name':_0x2fc11b['fieldName'],'type':_0x2fc11b[_0xdd0e('0x2e')]['key']};});_0x409e62[_0xdd0e('0x2f')]=_[_0xdd0e('0x2b')](_0x352030,_0xdd0e('0x28'));_0x409e62[_0xdd0e('0x30')]=_[_0xdd0e('0x31')](_0x32103d[_0xdd0e('0x30')]);_0x409e62['filters']=_[_0xdd0e('0x32')](_0x409e62[_0xdd0e('0x2f')],_0x409e62[_0xdd0e('0x30')]);_0x35bd85[_0xdd0e('0x33')]=_[_0xdd0e('0x32')](_0x409e62[_0xdd0e('0x2f')],qs[_0xdd0e('0x34')](_0x32103d['query'][_0xdd0e('0x34')]));_0x35bd85[_0xdd0e('0x33')]=_0x35bd85['attributes'][_0xdd0e('0x35')]?_0x35bd85['attributes']:_0x409e62[_0xdd0e('0x2f')];if(!_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x36')](_0xdd0e('0x37'))){_0x35bd85[_0xdd0e('0x1e')]=qs['limit'](_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x1e')]);_0x35bd85['offset']=qs[_0xdd0e('0x1b')](_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x1b')]);}_0x35bd85[_0xdd0e('0x38')]=qs[_0xdd0e('0x39')](_0x32103d['query'][_0xdd0e('0x39')]);_0x35bd85[_0xdd0e('0x3a')]=qs['filters'](_[_0xdd0e('0x3b')](_0x32103d[_0xdd0e('0x30')],_0x409e62[_0xdd0e('0x3c')]),_0x352030);if(_0x32103d['query'][_0xdd0e('0x3d')]){_0x35bd85[_0xdd0e('0x3a')]=_[_0xdd0e('0x3e')](_0x35bd85['where'],{'$or':_[_0xdd0e('0x2b')](_0x352030,function(_0x1ab35d){if(_0x1ab35d[_0xdd0e('0x2e')]!==_0xdd0e('0x3f')){var _0x5243b2={};_0x5243b2[_0x1ab35d['name']]={'$like':'%'+_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x3d')]+'%'};return _0x5243b2;}})});}_0x35bd85=_[_0xdd0e('0x3e')]({},_0x35bd85,_0x32103d[_0xdd0e('0x40')]);var _0x53c9d9={'where':_0x35bd85[_0xdd0e('0x3a')]};return db[_0xdd0e('0x2c')][_0xdd0e('0x1d')](_0x53c9d9)['then'](function(_0x269dbe){_0x26ea38[_0xdd0e('0x1d')]=_0x269dbe;if(_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x41')]){_0x35bd85[_0xdd0e('0x42')]=[{'all':!![]}];}return db[_0xdd0e('0x2c')][_0xdd0e('0x43')](_0x35bd85);})['then'](function(_0x264a07){_0x26ea38[_0xdd0e('0x44')]=_0x264a07;return _0x26ea38;})['then'](respondWithFilteredResult(_0x400c79,_0x35bd85))[_0xdd0e('0x45')](handleError(_0x400c79,null));};exports[_0xdd0e('0x46')]=function(_0x52f067,_0x38f30d){var _0x559b3b={'raw':!![],'where':{'id':_0x52f067[_0xdd0e('0x47')]['id']}},_0x5d796e={};_0x5d796e[_0xdd0e('0x2f')]=_['keys'](db[_0xdd0e('0x2c')][_0xdd0e('0x2d')]);_0x5d796e[_0xdd0e('0x30')]=_[_0xdd0e('0x31')](_0x52f067[_0xdd0e('0x30')]);_0x5d796e['filters']=_['intersection'](_0x5d796e[_0xdd0e('0x2f')],_0x5d796e['query']);_0x559b3b[_0xdd0e('0x33')]=_[_0xdd0e('0x32')](_0x5d796e['model'],qs[_0xdd0e('0x34')](_0x52f067['query'][_0xdd0e('0x34')]));_0x559b3b[_0xdd0e('0x33')]=_0x559b3b[_0xdd0e('0x33')]['length']?_0x559b3b[_0xdd0e('0x33')]:_0x5d796e[_0xdd0e('0x2f')];if(_0x52f067[_0xdd0e('0x30')][_0xdd0e('0x41')]){_0x559b3b[_0xdd0e('0x42')]=[{'all':!![]}];}_0x559b3b=_[_0xdd0e('0x3e')]({},_0x559b3b,_0x52f067[_0xdd0e('0x40')]);return db[_0xdd0e('0x2c')][_0xdd0e('0x48')](_0x559b3b)['then'](handleEntityNotFound(_0x38f30d,null))['then'](respondWithResult(_0x38f30d,null))[_0xdd0e('0x45')](handleError(_0x38f30d,null));};exports['create']=function(_0x1246a6,_0x2b3c54){return db['FaxApplication']['create'](_0x1246a6[_0xdd0e('0x49')],{})[_0xdd0e('0x23')](respondWithResult(_0x2b3c54,0xc9))['catch'](handleError(_0x2b3c54,null));};exports[_0xdd0e('0x22')]=function(_0x5b6dd6,_0x4e6579){if(_0x5b6dd6[_0xdd0e('0x49')]['id']){delete _0x5b6dd6[_0xdd0e('0x49')]['id'];}return db[_0xdd0e('0x2c')][_0xdd0e('0x48')]({'where':{'id':_0x5b6dd6[_0xdd0e('0x47')]['id']}})[_0xdd0e('0x23')](handleEntityNotFound(_0x4e6579,null))['then'](saveUpdates(_0x5b6dd6[_0xdd0e('0x49')],null))[_0xdd0e('0x23')](respondWithResult(_0x4e6579,null))[_0xdd0e('0x45')](handleError(_0x4e6579,null));};exports['destroy']=function(_0x49050f,_0xad1454){return db[_0xdd0e('0x2c')][_0xdd0e('0x48')]({'where':{'id':_0x49050f[_0xdd0e('0x47')]['id']}})[_0xdd0e('0x23')](handleEntityNotFound(_0xad1454,null))[_0xdd0e('0x23')](removeEntity(_0xad1454,null))[_0xdd0e('0x45')](handleError(_0xad1454,null));}; \ No newline at end of file +var _0x6fa7=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x1a2623,_0xbd6f70){var _0xdecd5f=function(_0x26df8e){while(--_0x26df8e){_0x1a2623['push'](_0x1a2623['shift']());}};_0xdecd5f(++_0xbd6f70);}(_0x6fa7,0xc4));var _0x76fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fa7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x76fa('0x0'));var rimraf=require(_0x76fa('0x1'));var zipdir=require(_0x76fa('0x2'));var jsonpatch=require(_0x76fa('0x3'));var rp=require('request-promise');var moment=require(_0x76fa('0x4'));var BPromise=require(_0x76fa('0x5'));var Mustache=require(_0x76fa('0x6'));var util=require(_0x76fa('0x7'));var path=require(_0x76fa('0x8'));var sox=require(_0x76fa('0x9'));var csv=require(_0x76fa('0xa'));var ejs=require(_0x76fa('0xb'));var fs=require('fs');var fs_extra=require(_0x76fa('0xc'));var _=require('lodash');var squel=require(_0x76fa('0xd'));var crypto=require(_0x76fa('0xe'));var jsforce=require(_0x76fa('0xf'));var deskjs=require(_0x76fa('0x10'));var toCsv=require(_0x76fa('0xa'));var querystring=require(_0x76fa('0x11'));var Papa=require(_0x76fa('0x12'));var Redis=require('ioredis');var authService=require(_0x76fa('0x13'));var qs=require(_0x76fa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x76fa('0x15'))('api');var utils=require(_0x76fa('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x76fa('0x17'))['db'];function respondWithStatusCode(_0x406c8f,_0x46443f){_0x46443f=_0x46443f||0xcc;return function(_0x564b32){if(_0x564b32){return _0x406c8f[_0x76fa('0x18')](_0x46443f);}return _0x406c8f[_0x76fa('0x19')](_0x46443f)[_0x76fa('0x1a')]();};}function respondWithResult(_0x1e3d2f,_0x540dbe){_0x540dbe=_0x540dbe||0xc8;return function(_0x42421c){if(_0x42421c){return _0x1e3d2f['status'](_0x540dbe)[_0x76fa('0x1b')](_0x42421c);}};}function respondWithFilteredResult(_0x3f7a5c,_0x4b7991){return function(_0x7d33bf){if(_0x7d33bf){var _0x44fe93=typeof _0x4b7991[_0x76fa('0x1c')]===_0x76fa('0x1d')&&typeof _0x4b7991[_0x76fa('0x1e')]===_0x76fa('0x1d');var _0x25461e=_0x7d33bf[_0x76fa('0x1f')];var _0x55d64c=_0x44fe93?0x0:_0x4b7991[_0x76fa('0x1c')];var _0x437e6a=_0x44fe93?_0x7d33bf['count']:_0x4b7991[_0x76fa('0x1c')]+_0x4b7991['limit'];var _0x3b0e16;if(_0x437e6a>=_0x25461e){_0x437e6a=_0x25461e;_0x3b0e16=0xc8;}else{_0x3b0e16=0xce;}_0x3f7a5c[_0x76fa('0x19')](_0x3b0e16);return _0x3f7a5c[_0x76fa('0x20')](_0x76fa('0x21'),_0x55d64c+'-'+_0x437e6a+'/'+_0x25461e)[_0x76fa('0x1b')](_0x7d33bf);}return null;};}function patchUpdates(_0x48db51){return function(_0x138a62){try{jsonpatch[_0x76fa('0x22')](_0x138a62,_0x48db51,!![]);}catch(_0x2dd1d5){return BPromise[_0x76fa('0x23')](_0x2dd1d5);}return _0x138a62[_0x76fa('0x24')]();};}function saveUpdates(_0x5ad411,_0x388332){return function(_0x16e67d){if(_0x16e67d){return _0x16e67d[_0x76fa('0x25')](_0x5ad411)[_0x76fa('0x26')](function(_0x5b9e64){return _0x5b9e64;});}return null;};}function removeEntity(_0x1016e1,_0x5505c6){return function(_0x5f04ec){if(_0x5f04ec){return _0x5f04ec[_0x76fa('0x27')]()[_0x76fa('0x26')](function(){_0x1016e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x348421,_0x434603){return function(_0x41e0db){if(!_0x41e0db){_0x348421[_0x76fa('0x18')](0x194);}return _0x41e0db;};}function handleError(_0x397d1e,_0x52e4e4){_0x52e4e4=_0x52e4e4||0x1f4;return function(_0x7f3c43){logger[_0x76fa('0x28')](_0x7f3c43[_0x76fa('0x29')]);if(_0x7f3c43[_0x76fa('0x2a')]){delete _0x7f3c43[_0x76fa('0x2a')];}_0x397d1e['status'](_0x52e4e4)[_0x76fa('0x2b')](_0x7f3c43);};}exports[_0x76fa('0x2c')]=function(_0x506466,_0x5dbde6){var _0x371453={},_0x2bfe10={},_0x2a78e9={'count':0x0,'rows':[]};var _0x132a3f=_[_0x76fa('0x2d')](db[_0x76fa('0x2e')][_0x76fa('0x2f')],function(_0x5c6b5a){return{'name':_0x5c6b5a['fieldName'],'type':_0x5c6b5a['type']['key']};});_0x2bfe10['model']=_['map'](_0x132a3f,_0x76fa('0x2a'));_0x2bfe10['query']=_['keys'](_0x506466[_0x76fa('0x30')]);_0x2bfe10[_0x76fa('0x31')]=_['intersection'](_0x2bfe10[_0x76fa('0x32')],_0x2bfe10[_0x76fa('0x30')]);_0x371453[_0x76fa('0x33')]=_[_0x76fa('0x34')](_0x2bfe10['model'],qs[_0x76fa('0x35')](_0x506466[_0x76fa('0x30')][_0x76fa('0x35')]));_0x371453[_0x76fa('0x33')]=_0x371453[_0x76fa('0x33')][_0x76fa('0x36')]?_0x371453[_0x76fa('0x33')]:_0x2bfe10['model'];if(!_0x506466[_0x76fa('0x30')][_0x76fa('0x37')](_0x76fa('0x38'))){_0x371453[_0x76fa('0x1e')]=qs[_0x76fa('0x1e')](_0x506466[_0x76fa('0x30')]['limit']);_0x371453['offset']=qs[_0x76fa('0x1c')](_0x506466[_0x76fa('0x30')]['offset']);}_0x371453[_0x76fa('0x39')]=qs[_0x76fa('0x3a')](_0x506466[_0x76fa('0x30')][_0x76fa('0x3a')]);_0x371453[_0x76fa('0x3b')]=qs[_0x76fa('0x31')](_[_0x76fa('0x3c')](_0x506466[_0x76fa('0x30')],_0x2bfe10[_0x76fa('0x31')]),_0x132a3f);if(_0x506466[_0x76fa('0x30')][_0x76fa('0x3d')]){_0x371453[_0x76fa('0x3b')]=_[_0x76fa('0x3e')](_0x371453[_0x76fa('0x3b')],{'$or':_[_0x76fa('0x2d')](_0x132a3f,function(_0x55cc1e){if(_0x55cc1e[_0x76fa('0x3f')]!==_0x76fa('0x40')){var _0x1ac01e={};_0x1ac01e[_0x55cc1e[_0x76fa('0x2a')]]={'$like':'%'+_0x506466['query'][_0x76fa('0x3d')]+'%'};return _0x1ac01e;}})});}_0x371453=_[_0x76fa('0x3e')]({},_0x371453,_0x506466[_0x76fa('0x41')]);var _0x24ebf7={'where':_0x371453[_0x76fa('0x3b')]};return db['FaxApplication']['count'](_0x24ebf7)[_0x76fa('0x26')](function(_0x497f32){_0x2a78e9['count']=_0x497f32;if(_0x506466[_0x76fa('0x30')]['includeAll']){_0x371453[_0x76fa('0x42')]=[{'all':!![]}];}return db[_0x76fa('0x2e')][_0x76fa('0x43')](_0x371453);})[_0x76fa('0x26')](function(_0x59fc9d){_0x2a78e9[_0x76fa('0x44')]=_0x59fc9d;return _0x2a78e9;})[_0x76fa('0x26')](respondWithFilteredResult(_0x5dbde6,_0x371453))[_0x76fa('0x45')](handleError(_0x5dbde6,null));};exports[_0x76fa('0x46')]=function(_0x21155b,_0x838fd8){var _0x22d1d4={'raw':!![],'where':{'id':_0x21155b[_0x76fa('0x47')]['id']}},_0x375e47={};_0x375e47[_0x76fa('0x32')]=_[_0x76fa('0x48')](db['FaxApplication']['rawAttributes']);_0x375e47[_0x76fa('0x30')]=_[_0x76fa('0x48')](_0x21155b['query']);_0x375e47[_0x76fa('0x31')]=_['intersection'](_0x375e47[_0x76fa('0x32')],_0x375e47['query']);_0x22d1d4[_0x76fa('0x33')]=_[_0x76fa('0x34')](_0x375e47['model'],qs[_0x76fa('0x35')](_0x21155b['query'][_0x76fa('0x35')]));_0x22d1d4[_0x76fa('0x33')]=_0x22d1d4[_0x76fa('0x33')][_0x76fa('0x36')]?_0x22d1d4[_0x76fa('0x33')]:_0x375e47['model'];if(_0x21155b[_0x76fa('0x30')]['includeAll']){_0x22d1d4['include']=[{'all':!![]}];}_0x22d1d4=_[_0x76fa('0x3e')]({},_0x22d1d4,_0x21155b[_0x76fa('0x41')]);return db[_0x76fa('0x2e')][_0x76fa('0x49')](_0x22d1d4)[_0x76fa('0x26')](handleEntityNotFound(_0x838fd8,null))[_0x76fa('0x26')](respondWithResult(_0x838fd8,null))['catch'](handleError(_0x838fd8,null));};exports['create']=function(_0x583d89,_0x21c968){return db['FaxApplication'][_0x76fa('0x4a')](_0x583d89[_0x76fa('0x4b')],{})['then'](respondWithResult(_0x21c968,0xc9))[_0x76fa('0x45')](handleError(_0x21c968,null));};exports[_0x76fa('0x25')]=function(_0x702eb4,_0x3d78cb){if(_0x702eb4[_0x76fa('0x4b')]['id']){delete _0x702eb4['body']['id'];}return db[_0x76fa('0x2e')][_0x76fa('0x49')]({'where':{'id':_0x702eb4[_0x76fa('0x47')]['id']}})[_0x76fa('0x26')](handleEntityNotFound(_0x3d78cb,null))[_0x76fa('0x26')](saveUpdates(_0x702eb4[_0x76fa('0x4b')],null))[_0x76fa('0x26')](respondWithResult(_0x3d78cb,null))[_0x76fa('0x45')](handleError(_0x3d78cb,null));};exports[_0x76fa('0x27')]=function(_0x423365,_0x321faf){return db[_0x76fa('0x2e')][_0x76fa('0x49')]({'where':{'id':_0x423365[_0x76fa('0x47')]['id']}})[_0x76fa('0x26')](handleEntityNotFound(_0x321faf,null))[_0x76fa('0x26')](removeEntity(_0x321faf,null))[_0x76fa('0x45')](handleError(_0x321faf,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d154855..5bdb539 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 _0x35b9=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26a8e5,_0xacbc6e){var _0x1bc013=function(_0x430ec1){while(--_0x430ec1){_0x26a8e5['push'](_0x26a8e5['shift']());}};_0x1bc013(++_0xacbc6e);}(_0x35b9,0x12e));var _0x935b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x35b9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x935b('0x0'));var util=require('util');var logger=require(_0x935b('0x1'))(_0x935b('0x2'));var moment=require(_0x935b('0x3'));var BPromise=require(_0x935b('0x4'));var rp=require(_0x935b('0x5'));var fs=require('fs');var path=require(_0x935b('0x6'));var rimraf=require(_0x935b('0x7'));var config=require(_0x935b('0x8'));var attributes=require(_0x935b('0x9'));module[_0x935b('0xa')]=function(_0x24f4dd,_0x1d35e5){return _0x24f4dd[_0x935b('0xb')]('FaxApplication',attributes,{'tableName':_0x935b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x935b('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdb93=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','FaxApplication','fax_applications','utf8mb4'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0xdb93,0x194));var _0x3db9=function(_0xf7ff4,_0x543a19){_0xf7ff4=_0xf7ff4-0x0;var _0x554e6a=_0xdb93[_0xf7ff4];return _0x554e6a;};'use strict';var _=require(_0x3db9('0x0'));var util=require(_0x3db9('0x1'));var logger=require(_0x3db9('0x2'))(_0x3db9('0x3'));var moment=require(_0x3db9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3db9('0x5'));var rimraf=require(_0x3db9('0x6'));var config=require(_0x3db9('0x7'));var attributes=require('./faxApplication.attributes');module[_0x3db9('0x8')]=function(_0x5c362a,_0x3304de){return _0x5c362a['define'](_0x3db9('0x9'),attributes,{'tableName':_0x3db9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3db9('0xb'),'collate':_0x3db9('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d803efc..a0d026b 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 _0x5646=['request','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','then','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1e46d8,_0x44fe74){var _0x52bd0f=function(_0x30e28a){while(--_0x30e28a){_0x1e46d8['push'](_0x1e46d8['shift']());}};_0x52bd0f(++_0x44fe74);}(_0x5646,0x1b8));var _0x6564=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x5646[_0x421196];return _0x2738af;};'use strict';var _=require(_0x6564('0x0'));var util=require(_0x6564('0x1'));var moment=require(_0x6564('0x2'));var BPromise=require(_0x6564('0x3'));var rs=require(_0x6564('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6564('0x5'))(_0x6564('0x6'));var config=require(_0x6564('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6564('0x8')][_0x6564('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x476edc,_0x296800,_0x308026){return new BPromise(function(_0x4b6c9f,_0x4e9227){return client[_0x6564('0xa')](_0x476edc,_0x308026)['then'](function(_0x4826cf){logger[_0x6564('0xb')]('FaxApplication,\x20%s,\x20%s',_0x296800,'request\x20sent');logger[_0x6564('0xc')](_0x6564('0xd'),_0x296800,_0x6564('0xe'),JSON[_0x6564('0xf')](_0x4826cf));if(_0x4826cf[_0x6564('0x10')]){if(_0x4826cf[_0x6564('0x10')][_0x6564('0x11')]===0x1f4){logger[_0x6564('0x10')]('FaxApplication,\x20%s,\x20%s',_0x296800,_0x4826cf['error'][_0x6564('0x12')]);return _0x4e9227(_0x4826cf['error']['message']);}logger[_0x6564('0x10')](_0x6564('0x13'),_0x296800,_0x4826cf[_0x6564('0x10')][_0x6564('0x12')]);return _0x4b6c9f(_0x4826cf[_0x6564('0x10')][_0x6564('0x12')]);}else{logger['info'](_0x6564('0x13'),_0x296800,_0x6564('0xe'));_0x4b6c9f(_0x4826cf['result'][_0x6564('0x12')]);}})[_0x6564('0x14')](function(_0x175a91){logger[_0x6564('0x10')](_0x6564('0x13'),_0x296800,_0x175a91);_0x4e9227(_0x175a91);});});}exports[_0x6564('0x15')]=function(_0xf58bc){var _0x5dc108=this;return new Promise(function(_0x2596b8,_0x4cabde){return db[_0x6564('0x16')][_0x6564('0x17')](_0xf58bc[_0x6564('0x18')],{'raw':_0xf58bc[_0x6564('0x19')]?_0xf58bc['options'][_0x6564('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf58bc[_0x6564('0x19')]?_0xf58bc[_0x6564('0x19')][_0x6564('0x1b')]||null:null,'attributes':_0xf58bc[_0x6564('0x19')]?_0xf58bc[_0x6564('0x19')]['attributes']||null:null,'limit':_0xf58bc[_0x6564('0x19')]?_0xf58bc[_0x6564('0x19')][_0x6564('0x1c')]||null:null})[_0x6564('0x1d')](function(_0x550e0c){logger[_0x6564('0xb')]('UpdateFaxApplication',_0xf58bc);logger[_0x6564('0xc')](_0x6564('0x15'),_0xf58bc,JSON[_0x6564('0xf')](_0x550e0c));_0x2596b8(_0x550e0c);})[_0x6564('0x14')](function(_0x9f1920){logger[_0x6564('0x10')](_0x6564('0x15'),_0x9f1920[_0x6564('0x12')],_0xf58bc);_0x4cabde(_0x5dc108['error'](0x1f4,_0x9f1920['message']));});});}; \ No newline at end of file +var _0xc497=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','debug','lodash','moment'];(function(_0x2cfb91,_0x5896b8){var _0x31fd04=function(_0x5635c3){while(--_0x5635c3){_0x2cfb91['push'](_0x2cfb91['shift']());}};_0x31fd04(++_0x5896b8);}(_0xc497,0x7a));var _0x7c49=function(_0x149ed5,_0x441f00){_0x149ed5=_0x149ed5-0x0;var _0x3e1ad6=_0xc497[_0x149ed5];return _0x3e1ad6;};'use strict';var _=require(_0x7c49('0x0'));var util=require('util');var moment=require(_0x7c49('0x1'));var BPromise=require(_0x7c49('0x2'));var rs=require(_0x7c49('0x3'));var fs=require('fs');var Redis=require(_0x7c49('0x4'));var db=require(_0x7c49('0x5'))['db'];var utils=require(_0x7c49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7c49('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7c49('0x8')][_0x7c49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x271356,_0x2248ed,_0x3993e1){return new BPromise(function(_0x1eb6f4,_0xefc756){return client[_0x7c49('0xa')](_0x271356,_0x3993e1)['then'](function(_0x3d8430){logger[_0x7c49('0xb')](_0x7c49('0xc'),_0x2248ed,_0x7c49('0xd'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2248ed,_0x7c49('0xd'),JSON[_0x7c49('0xe')](_0x3d8430));if(_0x3d8430[_0x7c49('0xf')]){if(_0x3d8430[_0x7c49('0xf')][_0x7c49('0x10')]===0x1f4){logger[_0x7c49('0xf')](_0x7c49('0xc'),_0x2248ed,_0x3d8430[_0x7c49('0xf')][_0x7c49('0x11')]);return _0xefc756(_0x3d8430[_0x7c49('0xf')][_0x7c49('0x11')]);}logger[_0x7c49('0xf')](_0x7c49('0xc'),_0x2248ed,_0x3d8430[_0x7c49('0xf')][_0x7c49('0x11')]);return _0x1eb6f4(_0x3d8430[_0x7c49('0xf')][_0x7c49('0x11')]);}else{logger['info'](_0x7c49('0xc'),_0x2248ed,_0x7c49('0xd'));_0x1eb6f4(_0x3d8430[_0x7c49('0x12')]['message']);}})[_0x7c49('0x13')](function(_0x361570){logger[_0x7c49('0xf')](_0x7c49('0xc'),_0x2248ed,_0x361570);_0xefc756(_0x361570);});});}exports[_0x7c49('0x14')]=function(_0x2979d9){var _0x1c84bb=this;return new Promise(function(_0xf22598,_0x1e0c60){return db[_0x7c49('0x15')][_0x7c49('0x16')](_0x2979d9[_0x7c49('0x17')],{'raw':_0x2979d9[_0x7c49('0x18')]?_0x2979d9[_0x7c49('0x18')][_0x7c49('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2979d9[_0x7c49('0x18')]?_0x2979d9[_0x7c49('0x18')][_0x7c49('0x1a')]||null:null,'attributes':_0x2979d9['options']?_0x2979d9[_0x7c49('0x18')][_0x7c49('0x1b')]||null:null,'limit':_0x2979d9[_0x7c49('0x18')]?_0x2979d9['options'][_0x7c49('0x1c')]||null:null})[_0x7c49('0x1d')](function(_0x561565){logger[_0x7c49('0xb')]('UpdateFaxApplication',_0x2979d9);logger[_0x7c49('0x1e')](_0x7c49('0x14'),_0x2979d9,JSON[_0x7c49('0xe')](_0x561565));_0xf22598(_0x561565);})[_0x7c49('0x13')](function(_0x3f1f7a){logger[_0x7c49('0xf')]('UpdateFaxApplication',_0x3f1f7a[_0x7c49('0x11')],_0x2979d9);_0x1e0c60(_0x1c84bb[_0x7c49('0xf')](0x1f4,_0x3f1f7a[_0x7c49('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 233a2fc..218ec97 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 _0x8f4c=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x8f4c,0x113));var _0xc8f4=function(_0x1546c2,_0x22e822){_0x1546c2=_0x1546c2-0x0;var _0x24583c=_0x8f4c[_0x1546c2];return _0x24583c;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./faxApplication.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0xc')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router[_0xc8f4('0xf')]('/:id',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x11')](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x2e74e6,_0x2dd14d){var _0x487c0f=function(_0x30355f){while(--_0x30355f){_0x2e74e6['push'](_0x2e74e6['shift']());}};_0x487c0f(++_0x2dd14d);}(_0x9354,0x96));var _0x4935=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0x9354[_0x4dae00];return _0x16bf42;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c1fd7c2..44cbd7e 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 _0x7b84=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7b84,0x17c));var _0x47b8=function(_0x3af621,_0x118b69){_0x3af621=_0x3af621-0x0;var _0x380a29=_0x7b84[_0x3af621];return _0x380a29;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'closed':{'type':Sequelize[_0x47b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47b8('0x3')]},'disposition':{'type':Sequelize[_0x47b8('0x4')]},'secondDisposition':{'type':Sequelize[_0x47b8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x47b8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x47b8('0x3')]},'fax':{'type':Sequelize[_0x47b8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in',_0x47b8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47b8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x47b8('0x7')]}}; \ No newline at end of file +var _0x33af=['out','INTEGER','exports','DATE','STRING','ENUM'];(function(_0x863bdc,_0x31e620){var _0xff62d4=function(_0x114e1c){while(--_0x114e1c){_0x863bdc['push'](_0x863bdc['shift']());}};_0xff62d4(++_0x31e620);}(_0x33af,0xec));var _0xf33a=function(_0x1dd78b,_0x213fd9){_0x1dd78b=_0x1dd78b-0x0;var _0x2d9bf6=_0x33af[_0x1dd78b];return _0x2d9bf6;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf33a('0x1')]},'disposition':{'type':Sequelize[_0xf33a('0x2')]},'secondDisposition':{'type':Sequelize[_0xf33a('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf33a('0x2')]},'note':{'type':Sequelize[_0xf33a('0x2')]},'read1stAt':{'type':Sequelize[_0xf33a('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xf33a('0x3')]('in',_0xf33a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf33a('0x3')]('in',_0xf33a('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xf33a('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index edb87a4..f83e528 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 _0xd9b2=['count','set','Content-Range','destroy','then','stack','name','index','rawAttributes','fieldName','type','getOptions','findAll','fax','user','catch','show','params','model','keys','FaxInteraction','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','FaxMessage','hasOwnProperty','nolimit','order','sort','where','filters','pick','FaxInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','color','emit','removeTags','download','unix','toString','root','tmp','join','server','files','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','moment','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x3d5638,_0xa26995){var _0x2c2455=function(_0x5384e0){while(--_0x5384e0){_0x3d5638['push'](_0x3d5638['shift']());}};_0x2c2455(++_0xa26995);}(_0xd9b2,0xb4));var _0x2d9b=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xd9b2[_0x2d2258];return _0x18e155;};'use strict';var rimraf=require(_0x2d9b('0x0'));var zipdir=require('zip-dir');var moment=require(_0x2d9b('0x1'));var BPromise=require('bluebird');var util=require(_0x2d9b('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x2d9b('0x3'));var Redis=require(_0x2d9b('0x4'));var interaction=require(_0x2d9b('0x5'));var qs=require(_0x2d9b('0x6'));var logger=require(_0x2d9b('0x7'))(_0x2d9b('0x8'));var config=require('../../config/environment');var db=require(_0x2d9b('0x9'))['db'];config[_0x2d9b('0xa')]=_[_0x2d9b('0xb')](config[_0x2d9b('0xa')],{'host':_0x2d9b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d9b('0xa')]));require(_0x2d9b('0xd'))[_0x2d9b('0xe')](socket);function respondWithStatusCode(_0x5d727b,_0x28a2d5){_0x28a2d5=_0x28a2d5||0xcc;return function(_0x493bed){if(_0x493bed){return _0x5d727b[_0x2d9b('0xf')](_0x28a2d5);}return _0x5d727b[_0x2d9b('0x10')](_0x28a2d5)[_0x2d9b('0x11')]();};}function respondWithResult(_0x182b3a,_0x1d6d67){_0x1d6d67=_0x1d6d67||0xc8;return function(_0x202a28){if(_0x202a28){return _0x182b3a[_0x2d9b('0x10')](_0x1d6d67)[_0x2d9b('0x12')](_0x202a28);}};}function respondWithFilteredResult(_0x5ba3c7,_0x5e299c){return function(_0xc71899){if(_0xc71899){var _0xd4b89d=typeof _0x5e299c[_0x2d9b('0x13')]===_0x2d9b('0x14')&&typeof _0x5e299c[_0x2d9b('0x15')]==='undefined';var _0x2f1b56=_0xc71899['count'];var _0x484164=_0xd4b89d?0x0:_0x5e299c[_0x2d9b('0x13')];var _0x102aec=_0xd4b89d?_0xc71899[_0x2d9b('0x16')]:_0x5e299c['offset']+_0x5e299c['limit'];var _0x1d02a0;if(_0x102aec>=_0x2f1b56){_0x102aec=_0x2f1b56;_0x1d02a0=0xc8;}else{_0x1d02a0=0xce;}_0x5ba3c7[_0x2d9b('0x10')](_0x1d02a0);return _0x5ba3c7[_0x2d9b('0x17')](_0x2d9b('0x18'),_0x484164+'-'+_0x102aec+'/'+_0x2f1b56)[_0x2d9b('0x12')](_0xc71899);}return null;};}function saveUpdates(_0xc23202){return function(_0x2b13d3){if(_0x2b13d3){return _0x2b13d3['update'](_0xc23202)['then'](function(_0x542b16){return _0x542b16;});}return null;};}function removeEntity(_0x50fd02){return function(_0x3612f8){if(_0x3612f8){return _0x3612f8[_0x2d9b('0x19')]()[_0x2d9b('0x1a')](function(){_0x50fd02[_0x2d9b('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6c4e){return function(_0x2d8ff1){if(!_0x2d8ff1){_0x2f6c4e[_0x2d9b('0xf')](0x194);}return _0x2d8ff1;};}function handleError(_0x1da875,_0x3346c5){_0x3346c5=_0x3346c5||0x1f4;return function(_0x3d946a){logger['error'](_0x3d946a[_0x2d9b('0x1b')]);if(_0x3d946a[_0x2d9b('0x1c')]){delete _0x3d946a[_0x2d9b('0x1c')];}_0x1da875['status'](_0x3346c5)['send'](_0x3d946a);};}exports[_0x2d9b('0x1d')]=function(_0x3dc29c,_0x30b097){var _0x19eddb={};var _0x39473b=_['map'](db['FaxInteraction'][_0x2d9b('0x1e')],function(_0x39f2b4){return{'name':_0x39f2b4[_0x2d9b('0x1f')],'type':_0x39f2b4[_0x2d9b('0x20')]['key']};});_0x19eddb=qs[_0x2d9b('0x21')](_0x39473b,_0x3dc29c);return interaction[_0x2d9b('0x22')](_0x2d9b('0x23'),_0x3dc29c['query'],_0x3dc29c[_0x2d9b('0x24')],_0x19eddb,_0x39473b)['then'](respondWithFilteredResult(_0x30b097,_0x19eddb))[_0x2d9b('0x25')](handleError(_0x30b097,null));};exports[_0x2d9b('0x26')]=function(_0xd589da,_0x10a8b0){var _0x1e7cba={'raw':![],'where':{'id':_0xd589da[_0x2d9b('0x27')]['id']}},_0x226a3d={};_0x226a3d[_0x2d9b('0x28')]=_[_0x2d9b('0x29')](db[_0x2d9b('0x2a')]['rawAttributes']);_0x226a3d[_0x2d9b('0x2b')]=_['keys'](_0xd589da[_0x2d9b('0x2b')]);_0x226a3d['filters']=_['intersection'](_0x226a3d[_0x2d9b('0x28')],_0x226a3d[_0x2d9b('0x2b')]);_0x1e7cba[_0x2d9b('0x2c')]=_[_0x2d9b('0x2d')](_0x226a3d[_0x2d9b('0x28')],qs['fields'](_0xd589da['query'][_0x2d9b('0x2e')]));_0x1e7cba['attributes']=_0x1e7cba[_0x2d9b('0x2c')][_0x2d9b('0x2f')]?_0x1e7cba[_0x2d9b('0x2c')]:_0x226a3d[_0x2d9b('0x28')];if(_0xd589da[_0x2d9b('0x2b')][_0x2d9b('0x30')]){_0x1e7cba[_0x2d9b('0x31')]=[{'all':!![]}];}_0x1e7cba=_[_0x2d9b('0x32')]({},_0x1e7cba,_0xd589da[_0x2d9b('0x33')]);return db['FaxInteraction'][_0x2d9b('0x34')](_0x1e7cba)['then'](handleEntityNotFound(_0x10a8b0,null))[_0x2d9b('0x1a')](respondWithResult(_0x10a8b0,null))[_0x2d9b('0x25')](handleError(_0x10a8b0,null));};exports[_0x2d9b('0x35')]=function(_0x145338,_0x1f0f3a){return db[_0x2d9b('0x2a')][_0x2d9b('0x35')](_0x145338[_0x2d9b('0x36')],{})[_0x2d9b('0x1a')](respondWithResult(_0x1f0f3a,0xc9))[_0x2d9b('0x25')](handleError(_0x1f0f3a,null));};exports['update']=function(_0x129b80,_0x19b3ce){if(_0x129b80['body']['id']){delete _0x129b80[_0x2d9b('0x36')]['id'];}return db[_0x2d9b('0x2a')][_0x2d9b('0x34')]({'where':{'id':_0x129b80[_0x2d9b('0x27')]['id']}})['then'](handleEntityNotFound(_0x19b3ce,null))[_0x2d9b('0x1a')](saveUpdates(_0x129b80[_0x2d9b('0x36')],null))[_0x2d9b('0x1a')](respondWithResult(_0x19b3ce,null))['catch'](handleError(_0x19b3ce,null));};exports[_0x2d9b('0x19')]=function(_0x334924,_0x427064){return db[_0x2d9b('0x2a')][_0x2d9b('0x34')]({'where':{'id':_0x334924[_0x2d9b('0x27')]['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x427064,null))['then'](removeEntity(_0x427064,null))['catch'](handleError(_0x427064,null));};exports[_0x2d9b('0x37')]=function(_0x529f9b,_0x57611b){return db[_0x2d9b('0x2a')]['describe']()[_0x2d9b('0x1a')](respondWithResult(_0x57611b,null))[_0x2d9b('0x25')](handleError(_0x57611b,null));};exports[_0x2d9b('0x38')]=function(_0x2b7eb3,_0x40a577){return db['FaxMessage'][_0x2d9b('0x34')]({'where':{'id':_0x2b7eb3['params']['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x40a577,null))[_0x2d9b('0x1a')](function(_0x24b17b){if(_0x24b17b){return _0x24b17b[_0x2d9b('0x38')](_0x2b7eb3['body'][_0x2d9b('0x39')],_[_0x2d9b('0x3a')](_0x2b7eb3[_0x2d9b('0x36')],[_0x2d9b('0x39'),'id'])||{});}})[_0x2d9b('0x1a')](respondWithResult(_0x40a577,null))[_0x2d9b('0x25')](handleError(_0x40a577,null));};exports[_0x2d9b('0x3b')]=function(_0x23fbfc,_0x1e728e){var _0x10eefd={'raw':![],'where':{}};var _0x477d44={};var _0x5b328c={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x23fbfc[_0x2d9b('0x27')]['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x1e728e,null))['then'](function(_0x5635c1){if(_0x5635c1){_0x477d44[_0x2d9b('0x28')]=_[_0x2d9b('0x29')](db[_0x2d9b('0x3c')][_0x2d9b('0x1e')]);_0x477d44[_0x2d9b('0x2b')]=_[_0x2d9b('0x29')](_0x23fbfc[_0x2d9b('0x2b')]);_0x477d44['filters']=_[_0x2d9b('0x2d')](_0x477d44['model'],_0x477d44[_0x2d9b('0x2b')]);_0x10eefd[_0x2d9b('0x2c')]=_['intersection'](_0x477d44[_0x2d9b('0x28')],qs[_0x2d9b('0x2e')](_0x23fbfc['query'][_0x2d9b('0x2e')]));_0x10eefd[_0x2d9b('0x2c')]=_0x10eefd[_0x2d9b('0x2c')][_0x2d9b('0x2f')]?_0x10eefd[_0x2d9b('0x2c')]:_0x477d44[_0x2d9b('0x28')];if(!_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x3d')](_0x2d9b('0x3e'))){_0x10eefd[_0x2d9b('0x15')]=qs[_0x2d9b('0x15')](_0x23fbfc['query']['limit']);_0x10eefd[_0x2d9b('0x13')]=qs[_0x2d9b('0x13')](_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x13')]);}_0x10eefd[_0x2d9b('0x3f')]=qs[_0x2d9b('0x40')](_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x40')]);_0x10eefd[_0x2d9b('0x41')]=qs[_0x2d9b('0x42')](_[_0x2d9b('0x43')](_0x23fbfc[_0x2d9b('0x2b')],_0x477d44['filters']));_0x10eefd[_0x2d9b('0x41')][_0x2d9b('0x44')]=_0x5635c1['id'];if(_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x45')]){_0x10eefd['where']=_['merge'](_0x10eefd[_0x2d9b('0x41')],{'$or':_[_0x2d9b('0x46')](_0x10eefd['attributes'],function(_0x876afc){var _0x217042={};_0x217042[_0x876afc]={'$like':'%'+_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x45')]+'%'};return _0x217042;})});}if(_0x23fbfc['query'][_0x2d9b('0x47')]){var _0x5d1317=_0x23fbfc[_0x2d9b('0x2b')]['$gte'][_0x2d9b('0x48')](',');var _0x50c09f={};_0x50c09f[_0x5d1317[0x0]]={'$gte':moment(_0x5d1317[0x1])['format'](_0x2d9b('0x49'))};_0x10eefd[_0x2d9b('0x41')]=_[_0x2d9b('0x32')](_0x10eefd['where'],_0x50c09f);}_0x10eefd=_['merge']({},_0x10eefd,_0x23fbfc['options']);return db['FaxMessage'][_0x2d9b('0x16')]({'where':_0x10eefd['where']})['then'](function(_0x172444){_0x5b328c['count']=_0x172444;if(_0x23fbfc['query'][_0x2d9b('0x30')]){_0x10eefd[_0x2d9b('0x31')]=[{'all':!![]}];}return db[_0x2d9b('0x3c')]['findAll'](_0x10eefd);})['then'](function(_0x2f98a4){_0x5b328c[_0x2d9b('0x4a')]=_0x2f98a4;return _0x5b328c;});}})['then'](respondWithFilteredResult(_0x1e728e,_0x10eefd))[_0x2d9b('0x25')](handleError(_0x1e728e,null));};exports['addTags']=function(_0x240f95,_0x1aebbb){return db[_0x2d9b('0x2a')][_0x2d9b('0x34')]({'where':{'id':_0x240f95[_0x2d9b('0x27')]['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x1aebbb,null))[_0x2d9b('0x1a')](function(_0x243524){if(_0x243524){return _0x243524[_0x2d9b('0x4b')](_0x240f95[_0x2d9b('0x36')][_0x2d9b('0x39')],_['omit'](_0x240f95['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x2d9b('0x22')]({'attributes':['id',_0x2d9b('0x1c'),_0x2d9b('0x4c')],'where':{'id':_0x240f95[_0x2d9b('0x36')]['ids']}});})[_0x2d9b('0x1a')](function(_0x560375){socket[_0x2d9b('0x4d')]('faxInteractionTags:save',{'id':Number(_0x240f95['params']['id']),'tags':_0x560375||[]});return{'id':Number(_0x240f95['params']['id']),'tags':_0x560375||[]};});}})[_0x2d9b('0x1a')](respondWithResult(_0x1aebbb,null))[_0x2d9b('0x25')](handleError(_0x1aebbb,null));};exports['removeTags']=function(_0x6d63b6,_0x59af83){return db['FaxInteraction'][_0x2d9b('0x34')]({'where':{'id':_0x6d63b6[_0x2d9b('0x27')]['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x59af83,null))[_0x2d9b('0x1a')](function(_0x12053b){if(_0x12053b){return _0x12053b[_0x2d9b('0x4e')](_0x6d63b6[_0x2d9b('0x2b')][_0x2d9b('0x39')]);}})[_0x2d9b('0x1a')](respondWithStatusCode(_0x59af83,null))[_0x2d9b('0x25')](handleError(_0x59af83,null));};exports[_0x2d9b('0x4f')]=function(_0x2f93b6,_0x2b4828){var _0xe8cd5=moment()[_0x2d9b('0x50')]()[_0x2d9b('0x51')]();var _0x19ce12=path['join'](config[_0x2d9b('0x52')],'server','files',_0x2d9b('0x53'));var _0x2fb4a9=path[_0x2d9b('0x54')](config['root'],_0x2d9b('0x55'),_0x2d9b('0x56'),'attachments');var _0x231877=path[_0x2d9b('0x54')](_0x19ce12,_0xe8cd5);var _0x4fa29a=util['format'](_0x2d9b('0x57'),_0x2f93b6['params']['id'],_0xe8cd5);var _0x1a1d89=path[_0x2d9b('0x54')](_0x19ce12,_0x4fa29a);var _0xe36156=[];_0xe36156[_0x2d9b('0x58')]({'model':db['Attachment'],'as':_0x2d9b('0x59'),'raw':!![]});var _0x14f631=[{'model':db[_0x2d9b('0x3c')],'as':_0x2d9b('0x5a'),'attributes':['id',_0x2d9b('0x36'),_0x2d9b('0x5b')],'include':_0xe36156}];return db[_0x2d9b('0x2a')]['find']({'where':{'id':_0x2f93b6[_0x2d9b('0x27')]['id']},'include':_0x14f631})['then'](handleEntityNotFound(_0x2b4828,null))[_0x2d9b('0x1a')](function(_0x57712e){if(_0x57712e&&_0x57712e[_0x2d9b('0x5a')]){var _0xa742d8=_0x57712e['get']({'plain':!![]});fs['mkdirSync'](_0x231877);for(var _0x4c307b=0x0;_0x4c307b<_0xa742d8[_0x2d9b('0x5a')]['length'];_0x4c307b++){var _0x4a3dbd=_0xa742d8['Messages'][_0x4c307b][_0x2d9b('0x59')];if(_0x4a3dbd){var _0x1be946=path[_0x2d9b('0x54')](_0x2fb4a9,_0x4a3dbd[_0x2d9b('0x5c')]);if(fs[_0x2d9b('0x5d')](_0x1be946)){fs[_0x2d9b('0x5e')](_0x1be946)[_0x2d9b('0x5f')](fs[_0x2d9b('0x60')](path[_0x2d9b('0x54')](_0x231877,_0x4a3dbd[_0x2d9b('0x5c')])));}}}return BPromise[_0x2d9b('0x61')]()['then'](function(){return new BPromise(function(_0x289b0d,_0x29c08b){zipdir(_0x231877,{'saveTo':_0x1a1d89},function(_0x41b26f,_0x23bbd7){if(_0x41b26f)return _0x29c08b(_0x41b26f);return _0x289b0d(_0x23bbd7);});})[_0x2d9b('0x1a')](function(){return new BPromise(function(_0x46a1a4,_0x304384){rimraf(_0x231877,function(_0x52fc81){if(_0x52fc81)_0x304384(_0x52fc81);return _0x46a1a4();});});})[_0x2d9b('0x1a')](function(){return _0x2b4828[_0x2d9b('0x4f')](_0x1a1d89,_0x4fa29a,function(_0x1f3f23){if(_0x1f3f23){console[_0x2d9b('0x62')](_0x2d9b('0x63'),_0x1f3f23);}else{fs[_0x2d9b('0x64')](_0x1a1d89);}});});});}else{return _0x2b4828[_0x2d9b('0xf')](0xc8);}})['catch'](handleError(_0x2b4828,null));}; \ No newline at end of file +var _0x92bd=['addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','toString','join','root','files','tmp','server','attachments','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','pipe','basename','resolve','log','err','unlinkSync','zip-dir','moment','bluebird','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','user','then','catch','show','params','keys','query','filters','intersection','model','attributes','fields','includeAll','merge','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','sort','pick','where','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll'];(function(_0x503357,_0x1920f3){var _0x48ba12=function(_0x17b04b){while(--_0x17b04b){_0x503357['push'](_0x503357['shift']());}};_0x48ba12(++_0x1920f3);}(_0x92bd,0x86));var _0xd92b=function(_0x5dcc1b,_0x25729b){_0x5dcc1b=_0x5dcc1b-0x0;var _0x46560d=_0x92bd[_0x5dcc1b];return _0x46560d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd92b('0x0'));var moment=require(_0xd92b('0x1'));var BPromise=require(_0xd92b('0x2'));var util=require('util');var path=require(_0xd92b('0x3'));var fs=require('fs');var _=require(_0xd92b('0x4'));var Redis=require('ioredis');var interaction=require(_0xd92b('0x5'));var qs=require(_0xd92b('0x6'));var logger=require(_0xd92b('0x7'))(_0xd92b('0x8'));var config=require(_0xd92b('0x9'));var db=require('../../mysqldb')['db'];config[_0xd92b('0xa')]=_[_0xd92b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd92b('0xc'))(new Redis(config[_0xd92b('0xa')]));require('./faxInteraction.socket')[_0xd92b('0xd')](socket);function respondWithStatusCode(_0x8e5636,_0x529260){_0x529260=_0x529260||0xcc;return function(_0x33e54d){if(_0x33e54d){return _0x8e5636['sendStatus'](_0x529260);}return _0x8e5636['status'](_0x529260)[_0xd92b('0xe')]();};}function respondWithResult(_0x30af72,_0x318b86){_0x318b86=_0x318b86||0xc8;return function(_0x3da4a2){if(_0x3da4a2){return _0x30af72[_0xd92b('0xf')](_0x318b86)[_0xd92b('0x10')](_0x3da4a2);}};}function respondWithFilteredResult(_0x53e408,_0x259b88){return function(_0x1940c2){if(_0x1940c2){var _0x3d61c9=typeof _0x259b88[_0xd92b('0x11')]===_0xd92b('0x12')&&typeof _0x259b88[_0xd92b('0x13')]===_0xd92b('0x12');var _0x37b9a9=_0x1940c2[_0xd92b('0x14')];var _0x26e832=_0x3d61c9?0x0:_0x259b88[_0xd92b('0x11')];var _0x509cd0=_0x3d61c9?_0x1940c2[_0xd92b('0x14')]:_0x259b88['offset']+_0x259b88[_0xd92b('0x13')];var _0x216f03;if(_0x509cd0>=_0x37b9a9){_0x509cd0=_0x37b9a9;_0x216f03=0xc8;}else{_0x216f03=0xce;}_0x53e408[_0xd92b('0xf')](_0x216f03);return _0x53e408[_0xd92b('0x15')](_0xd92b('0x16'),_0x26e832+'-'+_0x509cd0+'/'+_0x37b9a9)[_0xd92b('0x10')](_0x1940c2);}return null;};}function saveUpdates(_0x304ed1){return function(_0x5589b4){if(_0x5589b4){return _0x5589b4[_0xd92b('0x17')](_0x304ed1)['then'](function(_0x413fd0){return _0x413fd0;});}return null;};}function removeEntity(_0x407284){return function(_0x85c86c){if(_0x85c86c){return _0x85c86c[_0xd92b('0x18')]()['then'](function(){_0x407284['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9606){return function(_0x3f34bd){if(!_0x3f34bd){_0x2e9606[_0xd92b('0x19')](0x194);}return _0x3f34bd;};}function handleError(_0x2fbed2,_0x5b243f){_0x5b243f=_0x5b243f||0x1f4;return function(_0x4eeaf4){logger[_0xd92b('0x1a')](_0x4eeaf4[_0xd92b('0x1b')]);if(_0x4eeaf4[_0xd92b('0x1c')]){delete _0x4eeaf4[_0xd92b('0x1c')];}_0x2fbed2['status'](_0x5b243f)['send'](_0x4eeaf4);};}exports[_0xd92b('0x1d')]=function(_0x148b60,_0x582493){var _0x1d202b={};var _0x1fefa9=_[_0xd92b('0x1e')](db[_0xd92b('0x1f')][_0xd92b('0x20')],function(_0x311cac){return{'name':_0x311cac[_0xd92b('0x21')],'type':_0x311cac[_0xd92b('0x22')][_0xd92b('0x23')]};});_0x1d202b=qs[_0xd92b('0x24')](_0x1fefa9,_0x148b60);return interaction['findAll'](_0xd92b('0x25'),_0x148b60['query'],_0x148b60[_0xd92b('0x26')],_0x1d202b,_0x1fefa9)[_0xd92b('0x27')](respondWithFilteredResult(_0x582493,_0x1d202b))[_0xd92b('0x28')](handleError(_0x582493,null));};exports[_0xd92b('0x29')]=function(_0x239e78,_0x50bd89){var _0x28d5e3={'raw':![],'where':{'id':_0x239e78[_0xd92b('0x2a')]['id']}},_0x12e857={};_0x12e857['model']=_[_0xd92b('0x2b')](db['FaxInteraction']['rawAttributes']);_0x12e857['query']=_[_0xd92b('0x2b')](_0x239e78[_0xd92b('0x2c')]);_0x12e857[_0xd92b('0x2d')]=_[_0xd92b('0x2e')](_0x12e857[_0xd92b('0x2f')],_0x12e857[_0xd92b('0x2c')]);_0x28d5e3[_0xd92b('0x30')]=_[_0xd92b('0x2e')](_0x12e857[_0xd92b('0x2f')],qs[_0xd92b('0x31')](_0x239e78[_0xd92b('0x2c')][_0xd92b('0x31')]));_0x28d5e3[_0xd92b('0x30')]=_0x28d5e3[_0xd92b('0x30')]['length']?_0x28d5e3[_0xd92b('0x30')]:_0x12e857[_0xd92b('0x2f')];if(_0x239e78['query'][_0xd92b('0x32')]){_0x28d5e3['include']=[{'all':!![]}];}_0x28d5e3=_[_0xd92b('0x33')]({},_0x28d5e3,_0x239e78['options']);return db['FaxInteraction'][_0xd92b('0x34')](_0x28d5e3)['then'](handleEntityNotFound(_0x50bd89,null))[_0xd92b('0x27')](respondWithResult(_0x50bd89,null))[_0xd92b('0x28')](handleError(_0x50bd89,null));};exports[_0xd92b('0x35')]=function(_0x3b8fa1,_0x24bb12){return db[_0xd92b('0x1f')][_0xd92b('0x35')](_0x3b8fa1[_0xd92b('0x36')],{})[_0xd92b('0x27')](respondWithResult(_0x24bb12,0xc9))['catch'](handleError(_0x24bb12,null));};exports['update']=function(_0x165429,_0x3713c9){if(_0x165429[_0xd92b('0x36')]['id']){delete _0x165429[_0xd92b('0x36')]['id'];}return db[_0xd92b('0x1f')]['find']({'where':{'id':_0x165429['params']['id']}})['then'](handleEntityNotFound(_0x3713c9,null))[_0xd92b('0x27')](saveUpdates(_0x165429[_0xd92b('0x36')],null))['then'](respondWithResult(_0x3713c9,null))['catch'](handleError(_0x3713c9,null));};exports['destroy']=function(_0x26e4fb,_0x398064){return db[_0xd92b('0x1f')]['find']({'where':{'id':_0x26e4fb['params']['id']}})[_0xd92b('0x27')](handleEntityNotFound(_0x398064,null))[_0xd92b('0x27')](removeEntity(_0x398064,null))['catch'](handleError(_0x398064,null));};exports[_0xd92b('0x37')]=function(_0x34025d,_0x5574c4){return db[_0xd92b('0x1f')]['describe']()[_0xd92b('0x27')](respondWithResult(_0x5574c4,null))[_0xd92b('0x28')](handleError(_0x5574c4,null));};exports[_0xd92b('0x38')]=function(_0x1de0b0,_0x522863){return db[_0xd92b('0x39')]['find']({'where':{'id':_0x1de0b0[_0xd92b('0x2a')]['id']}})[_0xd92b('0x27')](handleEntityNotFound(_0x522863,null))[_0xd92b('0x27')](function(_0xf998c0){if(_0xf998c0){return _0xf998c0[_0xd92b('0x38')](_0x1de0b0[_0xd92b('0x36')][_0xd92b('0x3a')],_[_0xd92b('0x3b')](_0x1de0b0[_0xd92b('0x36')],[_0xd92b('0x3a'),'id'])||{});}})[_0xd92b('0x27')](respondWithResult(_0x522863,null))[_0xd92b('0x28')](handleError(_0x522863,null));};exports[_0xd92b('0x3c')]=function(_0x56f10b,_0x3764fa){var _0x46d9e7={'raw':![],'where':{}};var _0x32efcf={};var _0x30cd6e={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xd92b('0x3d')]({'where':{'id':_0x56f10b[_0xd92b('0x2a')]['id']}})[_0xd92b('0x27')](handleEntityNotFound(_0x3764fa,null))[_0xd92b('0x27')](function(_0x6bfe49){if(_0x6bfe49){_0x32efcf[_0xd92b('0x2f')]=_[_0xd92b('0x2b')](db[_0xd92b('0x39')]['rawAttributes']);_0x32efcf[_0xd92b('0x2c')]=_[_0xd92b('0x2b')](_0x56f10b[_0xd92b('0x2c')]);_0x32efcf[_0xd92b('0x2d')]=_[_0xd92b('0x2e')](_0x32efcf[_0xd92b('0x2f')],_0x32efcf[_0xd92b('0x2c')]);_0x46d9e7['attributes']=_['intersection'](_0x32efcf['model'],qs[_0xd92b('0x31')](_0x56f10b[_0xd92b('0x2c')][_0xd92b('0x31')]));_0x46d9e7[_0xd92b('0x30')]=_0x46d9e7['attributes'][_0xd92b('0x3e')]?_0x46d9e7[_0xd92b('0x30')]:_0x32efcf[_0xd92b('0x2f')];if(!_0x56f10b[_0xd92b('0x2c')][_0xd92b('0x3f')](_0xd92b('0x40'))){_0x46d9e7[_0xd92b('0x13')]=qs[_0xd92b('0x13')](_0x56f10b[_0xd92b('0x2c')][_0xd92b('0x13')]);_0x46d9e7['offset']=qs[_0xd92b('0x11')](_0x56f10b['query'][_0xd92b('0x11')]);}_0x46d9e7['order']=qs[_0xd92b('0x41')](_0x56f10b['query'][_0xd92b('0x41')]);_0x46d9e7['where']=qs[_0xd92b('0x2d')](_[_0xd92b('0x42')](_0x56f10b[_0xd92b('0x2c')],_0x32efcf[_0xd92b('0x2d')]));_0x46d9e7[_0xd92b('0x43')][_0xd92b('0x44')]=_0x6bfe49['id'];if(_0x56f10b[_0xd92b('0x2c')][_0xd92b('0x45')]){_0x46d9e7[_0xd92b('0x43')]=_[_0xd92b('0x33')](_0x46d9e7[_0xd92b('0x43')],{'$or':_[_0xd92b('0x1e')](_0x46d9e7['attributes'],function(_0x4b0a9c){var _0x252f62={};_0x252f62[_0x4b0a9c]={'$like':'%'+_0x56f10b['query'][_0xd92b('0x45')]+'%'};return _0x252f62;})});}if(_0x56f10b['query'][_0xd92b('0x46')]){var _0x30a501=_0x56f10b[_0xd92b('0x2c')]['$gte']['split'](',');var _0x4f9302={};_0x4f9302[_0x30a501[0x0]]={'$gte':moment(_0x30a501[0x1])[_0xd92b('0x47')](_0xd92b('0x48'))};_0x46d9e7[_0xd92b('0x43')]=_['merge'](_0x46d9e7['where'],_0x4f9302);}_0x46d9e7=_['merge']({},_0x46d9e7,_0x56f10b[_0xd92b('0x49')]);return db[_0xd92b('0x39')][_0xd92b('0x14')]({'where':_0x46d9e7[_0xd92b('0x43')]})[_0xd92b('0x27')](function(_0x45746c){_0x30cd6e[_0xd92b('0x14')]=_0x45746c;if(_0x56f10b[_0xd92b('0x2c')][_0xd92b('0x32')]){_0x46d9e7[_0xd92b('0x4a')]=[{'all':!![]}];}return db[_0xd92b('0x39')][_0xd92b('0x4b')](_0x46d9e7);})['then'](function(_0x4ca8d9){_0x30cd6e['rows']=_0x4ca8d9;return _0x30cd6e;});}})['then'](respondWithFilteredResult(_0x3764fa,_0x46d9e7))[_0xd92b('0x28')](handleError(_0x3764fa,null));};exports[_0xd92b('0x4c')]=function(_0x2dc54a,_0x213fb8){return db['FaxInteraction'][_0xd92b('0x34')]({'where':{'id':_0x2dc54a['params']['id']}})[_0xd92b('0x27')](handleEntityNotFound(_0x213fb8,null))[_0xd92b('0x27')](function(_0x1a4df0){if(_0x1a4df0){return _0x1a4df0[_0xd92b('0x4d')](_0x2dc54a[_0xd92b('0x36')][_0xd92b('0x3a')],_[_0xd92b('0x3b')](_0x2dc54a[_0xd92b('0x36')],[_0xd92b('0x3a'),'id'])||{})[_0xd92b('0x4e')](function(){return db[_0xd92b('0x4f')][_0xd92b('0x4b')]({'attributes':['id',_0xd92b('0x1c'),_0xd92b('0x50')],'where':{'id':_0x2dc54a[_0xd92b('0x36')][_0xd92b('0x3a')]}});})['then'](function(_0x406997){socket[_0xd92b('0x51')](_0xd92b('0x52'),{'id':Number(_0x2dc54a['params']['id']),'tags':_0x406997||[]});return{'id':Number(_0x2dc54a[_0xd92b('0x2a')]['id']),'tags':_0x406997||[]};});}})[_0xd92b('0x27')](respondWithResult(_0x213fb8,null))[_0xd92b('0x28')](handleError(_0x213fb8,null));};exports[_0xd92b('0x53')]=function(_0x10338b,_0x1c2fe1){return db['FaxInteraction'][_0xd92b('0x34')]({'where':{'id':_0x10338b['params']['id']}})[_0xd92b('0x27')](handleEntityNotFound(_0x1c2fe1,null))['then'](function(_0x950ba1){if(_0x950ba1){return _0x950ba1[_0xd92b('0x53')](_0x10338b['query']['ids']);}})[_0xd92b('0x27')](respondWithStatusCode(_0x1c2fe1,null))[_0xd92b('0x28')](handleError(_0x1c2fe1,null));};exports[_0xd92b('0x54')]=function(_0x2d4172,_0x4979cb){var _0x47ff94=moment()['unix']()[_0xd92b('0x55')]();var _0x3ee985=path[_0xd92b('0x56')](config[_0xd92b('0x57')],'server',_0xd92b('0x58'),_0xd92b('0x59'));var _0x27b67f=path[_0xd92b('0x56')](config[_0xd92b('0x57')],_0xd92b('0x5a'),_0xd92b('0x58'),_0xd92b('0x5b'));var _0x2d8bec=path[_0xd92b('0x56')](_0x3ee985,_0x47ff94);var _0x33b3c0=util[_0xd92b('0x47')]('transcript-%d-%s.zip',_0x2d4172['params']['id'],_0x47ff94);var _0x30f1b6=path['join'](_0x3ee985,_0x33b3c0);var _0x354350=[];_0x354350['push']({'model':db[_0xd92b('0x5c')],'as':_0xd92b('0x5c'),'raw':!![]});var _0x3b2cf2=[{'model':db[_0xd92b('0x39')],'as':_0xd92b('0x5d'),'attributes':['id',_0xd92b('0x36'),_0xd92b('0x5e')],'include':_0x354350}];return db[_0xd92b('0x1f')][_0xd92b('0x34')]({'where':{'id':_0x2d4172[_0xd92b('0x2a')]['id']},'include':_0x3b2cf2})[_0xd92b('0x27')](handleEntityNotFound(_0x4979cb,null))['then'](function(_0xbb76df){if(_0xbb76df&&_0xbb76df['Messages']){var _0x14ef61=_0xbb76df[_0xd92b('0x5f')]({'plain':!![]});fs[_0xd92b('0x60')](_0x2d8bec);for(var _0x444625=0x0;_0x444625<_0x14ef61[_0xd92b('0x5d')][_0xd92b('0x3e')];_0x444625++){var _0x280b49=_0x14ef61[_0xd92b('0x5d')][_0x444625][_0xd92b('0x5c')];if(_0x280b49){var _0x580ff8=path[_0xd92b('0x56')](_0x27b67f,_0x280b49['basename']);if(fs[_0xd92b('0x61')](_0x580ff8)){fs[_0xd92b('0x62')](_0x580ff8)[_0xd92b('0x63')](fs['createWriteStream'](path[_0xd92b('0x56')](_0x2d8bec,_0x280b49[_0xd92b('0x64')])));}}}return BPromise[_0xd92b('0x65')]()[_0xd92b('0x27')](function(){return new BPromise(function(_0x60d0d,_0x11150d){zipdir(_0x2d8bec,{'saveTo':_0x30f1b6},function(_0x4221bc,_0x234193){if(_0x4221bc)return _0x11150d(_0x4221bc);return _0x60d0d(_0x234193);});})[_0xd92b('0x27')](function(){return new BPromise(function(_0x20b0ab,_0x289357){rimraf(_0x2d8bec,function(_0x256820){if(_0x256820)_0x289357(_0x256820);return _0x20b0ab();});});})['then'](function(){return _0x4979cb['download'](_0x30f1b6,_0x33b3c0,function(_0x5c4709){if(_0x5c4709){console[_0xd92b('0x66')](_0xd92b('0x67'),_0x5c4709);}else{fs[_0xd92b('0x68')](_0x30f1b6);}});});});}else{return _0x4979cb[_0xd92b('0x19')](0xc8);}})[_0xd92b('0x28')](handleError(_0x4979cb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bef5eaa..2a6357c 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 _0x7d5e=['update','getUsers','then','setDataValue','findAll','length','emit','hasOwnProperty','hook','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x309991,_0x457e73){var _0x4ca94d=function(_0x294acc){while(--_0x294acc){_0x309991['push'](_0x309991['shift']());}};_0x4ca94d(++_0x457e73);}(_0x7d5e,0xbf));var _0xe7d5=function(_0x5a9781,_0x560943){_0x5a9781=_0x5a9781-0x0;var _0xa8a685=_0x7d5e[_0x5a9781];return _0xa8a685;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xe7d5('0x0'))['db'][_0xe7d5('0x1')];var FaxMessage=require(_0xe7d5('0x0'))['db'][_0xe7d5('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe7d5('0x3')](0x0);var events={'afterCreate':_0xe7d5('0x4'),'afterUpdate':_0xe7d5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x506d76){return function(_0x3d0638,_0x4b540c,_0x3c8d87){_0x3d0638[_0xe7d5('0x6')]({'attributes':['id'],'raw':!![]})[_0xe7d5('0x7')](function(_0x2919c1){_0x3d0638[_0xe7d5('0x8')]('Users',_0x2919c1['map'](function(_0x1583cf){return{'id':_0x1583cf['id']};}));return FaxMessage[_0xe7d5('0x9')]({'where':{'FaxInteractionId':_0x3d0638['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3feb1d){_0x3d0638[_0xe7d5('0x8')]('unreadMessages',_0x3feb1d[_0xe7d5('0xa')]);FaxInteractionEvents[_0xe7d5('0xb')](_0x506d76+':'+_0x3d0638['id'],_0x3d0638);FaxInteractionEvents[_0xe7d5('0xb')](_0x506d76,_0x3d0638);_0x3c8d87(null);})['catch'](_0x3c8d87(null));};}for(var e in events){if(events[_0xe7d5('0xc')](e)){var event=events[e];FaxInteraction[_0xe7d5('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x8143=['setDataValue','Users','findAll','length','emit','catch','exports','events','../../mysqldb','FaxInteraction','FaxMessage','update','remove','getUsers','then'];(function(_0x518ec9,_0x1ad2ad){var _0x568432=function(_0x1cadb9){while(--_0x1cadb9){_0x518ec9['push'](_0x518ec9['shift']());}};_0x568432(++_0x1ad2ad);}(_0x8143,0x1ab));var _0x3814=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8143[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x3814('0x0'));var FaxInteraction=require(_0x3814('0x1'))['db'][_0x3814('0x2')];var FaxMessage=require(_0x3814('0x1'))['db'][_0x3814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3814('0x4'),'afterDestroy':_0x3814('0x5')};function emitEvent(_0x350e60){return function(_0x40f0c3,_0x2dec27,_0x2d708b){_0x40f0c3[_0x3814('0x6')]({'attributes':['id'],'raw':!![]})[_0x3814('0x7')](function(_0x2cd683){_0x40f0c3[_0x3814('0x8')](_0x3814('0x9'),_0x2cd683['map'](function(_0x2f6b0f){return{'id':_0x2f6b0f['id']};}));return FaxMessage[_0x3814('0xa')]({'where':{'FaxInteractionId':_0x40f0c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3814('0x7')](function(_0x782dc5){_0x40f0c3[_0x3814('0x8')]('unreadMessages',_0x782dc5[_0x3814('0xb')]);FaxInteractionEvents[_0x3814('0xc')](_0x350e60+':'+_0x40f0c3['id'],_0x40f0c3);FaxInteractionEvents[_0x3814('0xc')](_0x350e60,_0x40f0c3);_0x2d708b(null);})[_0x3814('0xd')](_0x2d708b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x3814('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index a6bc096..bef5d21 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 _0x9af6=['changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions'];(function(_0x120b46,_0xdcecb){var _0x4c444e=function(_0x2fc9c4){while(--_0x2fc9c4){_0x120b46['push'](_0x120b46['shift']());}};_0x4c444e(++_0xdcecb);}(_0x9af6,0x1d7));var _0x69af=function(_0x120b23,_0xb9810f){_0x120b23=_0x120b23-0x0;var _0x2958eb=_0x9af6[_0x120b23];return _0x2958eb;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var logger=require(_0x69af('0x2'))('api');var moment=require('moment');var BPromise=require(_0x69af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x69af('0x4'));var config=require(_0x69af('0x5'));var attributes=require(_0x69af('0x6'));module['exports']=function(_0x3848c6,_0x54e2f1){return _0x3848c6[_0x69af('0x7')](_0x69af('0x8'),attributes,{'tableName':_0x69af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x17353a,_0x26ecde,_0x6b494a){if(_0x17353a[_0x69af('0xa')](_0x69af('0xb'))){_0x17353a['closedAt']=moment()['format'](_0x69af('0xc'));}_0x6b494a(null,_0x17353a);}}});}; \ No newline at end of file +var _0x5d95=['path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','closed','closedAt','format','../../config/logger','moment','bluebird','request-promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5d95,0x184));var _0x55d9=function(_0x3e0ec0,_0xc124b5){_0x3e0ec0=_0x3e0ec0-0x0;var _0x39f8fa=_0x5d95[_0x3e0ec0];return _0x39f8fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x55d9('0x0'))('api');var moment=require(_0x55d9('0x1'));var BPromise=require(_0x55d9('0x2'));var rp=require(_0x55d9('0x3'));var fs=require('fs');var path=require(_0x55d9('0x4'));var rimraf=require(_0x55d9('0x5'));var config=require(_0x55d9('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x55d9('0x7')]=function(_0x5e1f4b,_0x2aa073){return _0x5e1f4b[_0x55d9('0x8')](_0x55d9('0x9'),attributes,{'tableName':_0x55d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ef1f,_0x5a1dde,_0x4b6623){if(_0x43ef1f['changed'](_0x55d9('0xb'))){_0x43ef1f[_0x55d9('0xc')]=moment()[_0x55d9('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b6623(null,_0x43ef1f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index fff8cd3..590c50d 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 _0x23e1=['AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','limit','debug'];(function(_0x378bba,_0x40a1b1){var _0x2c4353=function(_0x5bc05d){while(--_0x5bc05d){_0x378bba['push'](_0x378bba['shift']());}};_0x2c4353(++_0x40a1b1);}(_0x23e1,0x1da));var _0x123e=function(_0x3492db,_0x169548){_0x3492db=_0x3492db-0x0;var _0xcc12cf=_0x23e1[_0x3492db];return _0xcc12cf;};'use strict';var _=require('lodash');var util=require(_0x123e('0x0'));var moment=require(_0x123e('0x1'));var BPromise=require(_0x123e('0x2'));var rs=require(_0x123e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x123e('0x4'));var logger=require(_0x123e('0x5'))(_0x123e('0x6'));var config=require('../../config/environment');var jayson=require(_0x123e('0x7'));var client=jayson[_0x123e('0x8')][_0x123e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x123e('0xa')],{'host':_0x123e('0xb'),'port':0x18eb});var socket=require(_0x123e('0xc'))(new Redis(config[_0x123e('0xa')]));require(_0x123e('0xd'))[_0x123e('0xe')](socket);function respondWithRpcPromise(_0x3bc2b2,_0x1ba104,_0x30e4f6){return new BPromise(function(_0x2e7d30,_0xa210ea){return client[_0x123e('0xf')](_0x3bc2b2,_0x30e4f6)[_0x123e('0x10')](function(_0x172495){logger[_0x123e('0x11')](_0x123e('0x12'),_0x1ba104,_0x123e('0x13'));logger['debug'](_0x123e('0x14'),_0x1ba104,_0x123e('0x13'),JSON[_0x123e('0x15')](_0x172495));if(_0x172495['error']){if(_0x172495[_0x123e('0x16')]['code']===0x1f4){logger['error'](_0x123e('0x12'),_0x1ba104,_0x172495[_0x123e('0x16')][_0x123e('0x17')]);return _0xa210ea(_0x172495[_0x123e('0x16')][_0x123e('0x17')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1ba104,_0x172495[_0x123e('0x16')][_0x123e('0x17')]);return _0x2e7d30(_0x172495[_0x123e('0x16')][_0x123e('0x17')]);}else{logger[_0x123e('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x1ba104,'request\x20sent');_0x2e7d30(_0x172495['result']['message']);}})[_0x123e('0x18')](function(_0x38429d){logger['error'](_0x123e('0x12'),_0x1ba104,_0x38429d);_0xa210ea(_0x38429d);});});}exports[_0x123e('0x19')]=function(_0x91aeb6){var _0x35e6f6=this;return new Promise(function(_0x3eb8ea,_0x540ed4){return db[_0x123e('0x1a')]['update'](_0x91aeb6[_0x123e('0x1b')],{'raw':_0x91aeb6[_0x123e('0x1c')]?_0x91aeb6[_0x123e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x91aeb6[_0x123e('0x1c')]?_0x91aeb6['options'][_0x123e('0x1d')]||null:null,'attributes':_0x91aeb6[_0x123e('0x1c')]?_0x91aeb6['options'][_0x123e('0x1e')]||null:null,'limit':_0x91aeb6[_0x123e('0x1c')]?_0x91aeb6[_0x123e('0x1c')][_0x123e('0x1f')]||null:null})[_0x123e('0x10')](function(_0x5df034){logger[_0x123e('0x11')]('UpdateFaxInteraction',_0x91aeb6);logger[_0x123e('0x20')](_0x123e('0x19'),_0x91aeb6,JSON['stringify'](_0x5df034));_0x3eb8ea(_0x5df034);})[_0x123e('0x18')](function(_0x13c0c2){logger[_0x123e('0x16')](_0x123e('0x19'),_0x13c0c2[_0x123e('0x17')],_0x91aeb6);_0x540ed4(_0x35e6f6[_0x123e('0x16')](0x1f4,_0x13c0c2[_0x123e('0x17')]));});});};exports[_0x123e('0x21')]=function(_0x2c8ff5){return new Promise(function(_0x48caab,_0x162b21){return db[_0x123e('0x1a')][_0x123e('0x22')]({'where':_0x2c8ff5[_0x123e('0x1c')]?_0x2c8ff5[_0x123e('0x1c')]['where']||null:null})[_0x123e('0x10')](function(_0x543854){if(_0x543854){return _0x543854[_0x123e('0x23')](_0x2c8ff5[_0x123e('0x1b')][_0x123e('0x24')],_['omit'](_0x2c8ff5[_0x123e('0x1b')],[_0x123e('0x24'),'id'])||{});}})[_0x123e('0x25')](function(_0x18644a){logger[_0x123e('0x11')](_0x123e('0x26'),_0x2c8ff5);logger[_0x123e('0x20')]('AddTags',_0x2c8ff5,JSON[_0x123e('0x15')](_0x18644a));_0x48caab(_0x18644a);})[_0x123e('0x18')](function(_0x3282d1){logger['error']('AddTags',_0x3282d1['message'],_0x2c8ff5);_0x162b21(_this['error'](0x1f4,_0x3282d1['message']));});});}; \ No newline at end of file +var _0x7273=['where','attributes','limit','find','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw'];(function(_0x53b1d6,_0xbe6d6c){var _0x9eb530=function(_0x22e83b){while(--_0x22e83b){_0x53b1d6['push'](_0x53b1d6['shift']());}};_0x9eb530(++_0xbe6d6c);}(_0x7273,0x10b));var _0x3727=function(_0x31ca88,_0x418a2f){_0x31ca88=_0x31ca88-0x0;var _0x2760c6=_0x7273[_0x31ca88];return _0x2760c6;};'use strict';var _=require('lodash');var util=require(_0x3727('0x0'));var moment=require(_0x3727('0x1'));var BPromise=require('bluebird');var rs=require(_0x3727('0x2'));var fs=require('fs');var Redis=require(_0x3727('0x3'));var db=require(_0x3727('0x4'))['db'];var utils=require(_0x3727('0x5'));var logger=require('../../config/logger')(_0x3727('0x6'));var config=require(_0x3727('0x7'));var jayson=require(_0x3727('0x8'));var client=jayson[_0x3727('0x9')][_0x3727('0xa')]({'port':0x232a});config[_0x3727('0xb')]=_[_0x3727('0xc')](config[_0x3727('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3727('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x55ac7e,_0x11c0b8,_0x33af26){return new BPromise(function(_0x589af3,_0x1ea796){return client['request'](_0x55ac7e,_0x33af26)[_0x3727('0xd')](function(_0x8ce3ed){logger['info'](_0x3727('0xe'),_0x11c0b8,_0x3727('0xf'));logger[_0x3727('0x10')](_0x3727('0x11'),_0x11c0b8,'request\x20sent',JSON[_0x3727('0x12')](_0x8ce3ed));if(_0x8ce3ed['error']){if(_0x8ce3ed['error'][_0x3727('0x13')]===0x1f4){logger[_0x3727('0x14')](_0x3727('0xe'),_0x11c0b8,_0x8ce3ed[_0x3727('0x14')][_0x3727('0x15')]);return _0x1ea796(_0x8ce3ed['error'][_0x3727('0x15')]);}logger[_0x3727('0x14')](_0x3727('0xe'),_0x11c0b8,_0x8ce3ed['error'][_0x3727('0x15')]);return _0x589af3(_0x8ce3ed[_0x3727('0x14')][_0x3727('0x15')]);}else{logger[_0x3727('0x16')](_0x3727('0xe'),_0x11c0b8,_0x3727('0xf'));_0x589af3(_0x8ce3ed['result'][_0x3727('0x15')]);}})[_0x3727('0x17')](function(_0x20bd63){logger['error'](_0x3727('0xe'),_0x11c0b8,_0x20bd63);_0x1ea796(_0x20bd63);});});}exports[_0x3727('0x18')]=function(_0x64d73){var _0x1f72a7=this;return new Promise(function(_0x282166,_0x20ad1e){return db[_0x3727('0x19')]['update'](_0x64d73[_0x3727('0x1a')],{'raw':_0x64d73[_0x3727('0x1b')]?_0x64d73[_0x3727('0x1b')][_0x3727('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x64d73[_0x3727('0x1b')]?_0x64d73[_0x3727('0x1b')][_0x3727('0x1d')]||null:null,'attributes':_0x64d73[_0x3727('0x1b')]?_0x64d73['options'][_0x3727('0x1e')]||null:null,'limit':_0x64d73[_0x3727('0x1b')]?_0x64d73[_0x3727('0x1b')][_0x3727('0x1f')]||null:null})[_0x3727('0xd')](function(_0x15b8fb){logger[_0x3727('0x16')](_0x3727('0x18'),_0x64d73);logger[_0x3727('0x10')](_0x3727('0x18'),_0x64d73,JSON['stringify'](_0x15b8fb));_0x282166(_0x15b8fb);})[_0x3727('0x17')](function(_0x31e3dc){logger['error'](_0x3727('0x18'),_0x31e3dc[_0x3727('0x15')],_0x64d73);_0x20ad1e(_0x1f72a7[_0x3727('0x14')](0x1f4,_0x31e3dc[_0x3727('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x4c9cf8){return new Promise(function(_0x594b06,_0x465ecd){return db[_0x3727('0x19')][_0x3727('0x20')]({'where':_0x4c9cf8['options']?_0x4c9cf8[_0x3727('0x1b')][_0x3727('0x1d')]||null:null})[_0x3727('0xd')](function(_0x2c302a){if(_0x2c302a){return _0x2c302a['addTags'](_0x4c9cf8[_0x3727('0x1a')][_0x3727('0x21')],_[_0x3727('0x22')](_0x4c9cf8['body'],['ids','id'])||{});}})[_0x3727('0x23')](function(_0xeb4a7d){logger['info'](_0x3727('0x24'),_0x4c9cf8);logger[_0x3727('0x10')](_0x3727('0x24'),_0x4c9cf8,JSON['stringify'](_0xeb4a7d));_0x594b06(_0xeb4a7d);})[_0x3727('0x17')](function(_0x2dcefd){logger['error'](_0x3727('0x24'),_0x2dcefd[_0x3727('0x15')],_0x4c9cf8);_0x465ecd(_this[_0x3727('0x14')](0x1f4,_0x2dcefd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 67d25e3..6e0e7e1 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 _0xe7c6=['./faxInteraction.events','save','remove','register','faxInteraction:'];(function(_0xfe5ffa,_0x19c4ed){var _0x58c97f=function(_0x2a063e){while(--_0x2a063e){_0xfe5ffa['push'](_0xfe5ffa['shift']());}};_0x58c97f(++_0x19c4ed);}(_0xe7c6,0xa5));var _0x6e7c=function(_0x49b205,_0x422fb3){_0x49b205=_0x49b205-0x0;var _0x37b4d4=_0xe7c6[_0x49b205];return _0x37b4d4;};'use strict';var FaxInteractionEvents=require(_0x6e7c('0x0'));var events=[_0x6e7c('0x1'),_0x6e7c('0x2'),'update'];function createListener(_0x3f5829,_0x2fe8b2){return function(_0x13f017){_0x2fe8b2['emit'](_0x3f5829,_0x13f017);};}function removeListener(_0x51ca9c,_0x4f34c7){return function(){FaxInteractionEvents['removeListener'](_0x51ca9c,_0x4f34c7);};}exports[_0x6e7c('0x3')]=function(_0x144948){for(var _0x1a0373=0x0,_0x40f549=events['length'];_0x1a0373<_0x40f549;_0x1a0373++){var _0x5738a3=events[_0x1a0373];var _0x59b06d=createListener(_0x6e7c('0x4')+_0x5738a3,_0x144948);FaxInteractionEvents['on'](_0x5738a3,_0x59b06d);}}; \ No newline at end of file +var _0xe2a4=['length','faxInteraction:','save','remove','update','emit','removeListener'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe2a4,0x1c9));var _0x4e2a=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0xe2a4[_0x3ebb69];return _0x421e59;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x4e2a('0x0'),_0x4e2a('0x1'),_0x4e2a('0x2')];function createListener(_0x340756,_0x5e3313){return function(_0x1a00cb){_0x5e3313[_0x4e2a('0x3')](_0x340756,_0x1a00cb);};}function removeListener(_0x1adad6,_0x584e69){return function(){FaxInteractionEvents[_0x4e2a('0x4')](_0x1adad6,_0x584e69);};}exports['register']=function(_0x37c19a){for(var _0x549431=0x0,_0x3d0fad=events[_0x4e2a('0x5')];_0x549431<_0x3d0fad;_0x549431++){var _0x3ea74c=events[_0x549431];var _0x4b67dd=createListener(_0x4e2a('0x6')+_0x3ea74c,_0x37c19a);FaxInteractionEvents['on'](_0x3ea74c,_0x4b67dd);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7d47889..e5588bd 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 _0x3733=['getMessages','/:id/download','download','post','addMessage','fax','faxinteraction:addtags','tracked','update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages'];(function(_0x426c40,_0x2ae5b8){var _0x536376=function(_0x5ca7c6){while(--_0x5ca7c6){_0x426c40['push'](_0x426c40['shift']());}};_0x536376(++_0x2ae5b8);}(_0x3733,0x93));var _0x3373=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3733[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3373('0x0'));var util=require(_0x3373('0x1'));var path=require(_0x3373('0x2'));var timeout=require(_0x3373('0x3'));var express=require(_0x3373('0x4'));var router=express['Router']();var fs_extra=require(_0x3373('0x5'));var auth=require(_0x3373('0x6'));var interaction=require(_0x3373('0x7'));var config=require('../../config/environment');var controller=require(_0x3373('0x8'));router[_0x3373('0x9')]('/',auth[_0x3373('0xa')](),controller[_0x3373('0xb')]);router[_0x3373('0x9')](_0x3373('0xc'),auth[_0x3373('0xa')](),controller['describe']);router[_0x3373('0x9')](_0x3373('0xd'),auth[_0x3373('0xa')](),controller['show']);router[_0x3373('0x9')](_0x3373('0xe'),auth[_0x3373('0xa')](),controller[_0x3373('0xf')]);router[_0x3373('0x9')](_0x3373('0x10'),auth[_0x3373('0xa')](),controller[_0x3373('0x11')]);router[_0x3373('0x12')]('/',auth[_0x3373('0xa')](),controller['create']);router['post'](_0x3373('0xe'),auth[_0x3373('0xa')](),controller[_0x3373('0x13')]);router['post']('/:id/tags',auth[_0x3373('0xa')](),interaction['tracked'](_0x3373('0x14'),_0x3373('0x15')),controller['addTags']);router['put'](_0x3373('0xd'),auth[_0x3373('0xa')](),interaction[_0x3373('0x16')](_0x3373('0x14'),'faxinteraction:update'),controller[_0x3373('0x17')]);router[_0x3373('0x18')](_0x3373('0xd'),auth[_0x3373('0xa')](),interaction[_0x3373('0x16')]('fax','faxinteraction:destroy'),controller[_0x3373('0x19')]);router[_0x3373('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3373('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x4304=['update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','addTags','/:id','fax','faxinteraction:update'];(function(_0x3e1b08,_0x501bbc){var _0x2987bb=function(_0x182831){while(--_0x182831){_0x3e1b08['push'](_0x3e1b08['shift']());}};_0x2987bb(++_0x501bbc);}(_0x4304,0x199));var _0x4430=function(_0x349c57,_0x262f3b){_0x349c57=_0x349c57-0x0;var _0x293208=_0x4304[_0x349c57];return _0x293208;};'use strict';var multer=require(_0x4430('0x0'));var util=require(_0x4430('0x1'));var path=require(_0x4430('0x2'));var timeout=require(_0x4430('0x3'));var express=require(_0x4430('0x4'));var router=express[_0x4430('0x5')]();var fs_extra=require(_0x4430('0x6'));var auth=require(_0x4430('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4430('0x8'));var controller=require(_0x4430('0x9'));router[_0x4430('0xa')]('/',auth[_0x4430('0xb')](),controller[_0x4430('0xc')]);router[_0x4430('0xa')]('/describe',auth[_0x4430('0xb')](),controller[_0x4430('0xd')]);router['get']('/:id',auth[_0x4430('0xb')](),controller[_0x4430('0xe')]);router[_0x4430('0xa')](_0x4430('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x4430('0xa')](_0x4430('0x10'),auth[_0x4430('0xb')](),controller['download']);router[_0x4430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4430('0x11')](_0x4430('0xf'),auth[_0x4430('0xb')](),controller[_0x4430('0x12')]);router['post'](_0x4430('0x13'),auth[_0x4430('0xb')](),interaction[_0x4430('0x14')]('fax','faxinteraction:addtags'),controller[_0x4430('0x15')]);router['put'](_0x4430('0x16'),auth[_0x4430('0xb')](),interaction[_0x4430('0x14')](_0x4430('0x17'),_0x4430('0x18')),controller[_0x4430('0x19')]);router[_0x4430('0x1a')](_0x4430('0x16'),auth[_0x4430('0xb')](),interaction[_0x4430('0x14')](_0x4430('0x17'),_0x4430('0x1b')),controller[_0x4430('0x1c')]);router[_0x4430('0x1a')](_0x4430('0x13'),auth[_0x4430('0xb')](),controller[_0x4430('0x1d')]);module[_0x4430('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a42b5b0..5bdfc5b 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 _0x6fad=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x2859be,_0x4a4356){var _0x21dad2=function(_0x500d17){while(--_0x500d17){_0x2859be['push'](_0x2859be['shift']());}};_0x21dad2(++_0x4a4356);}(_0x6fad,0x174));var _0xd6fa=function(_0x176c4d,_0x428fe7){_0x176c4d=_0x176c4d-0x0;var _0x3ef765=_0x6fad[_0x176c4d];return _0x3ef765;};'use strict';var Sequelize=require(_0xd6fa('0x0'));module[_0xd6fa('0x1')]={'body':{'type':Sequelize[_0xd6fa('0x2')](_0xd6fa('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd6fa('0x4')]('in','out'),'defaultValue':_0xd6fa('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd6fa('0x6')]}}; \ No newline at end of file +var _0xc964=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc964,0x7e));var _0x4c96=function(_0x316edc,_0x4447e3){_0x316edc=_0x316edc-0x0;var _0x5e9ee9=_0xc964[_0x316edc];return _0x5e9ee9;};'use strict';var Sequelize=require(_0x4c96('0x0'));module[_0x4c96('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4c96('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4c96('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4c96('0x4')]('in','out'),'defaultValue':_0x4c96('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x4c96('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1e39443..7771fea 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 _0xa96b=['UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','ContactId','sequelize','QueryTypes','SELECT','contact','email','format','SIP/%s','channel','motionChannel','EventManager','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','server','attachments','util','path','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','count','set','json','update','destroy','end','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','body','find','describe','accept','sms','acceptMessage','fax','reject'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa96b,0x1d5));var _0xba96=function(_0x48a868,_0x2cf98a){_0x48a868=_0x48a868-0x0;var _0x1de308=_0xa96b[_0x48a868];return _0x1de308;};'use strict';var util=require(_0xba96('0x0'));var path=require(_0xba96('0x1'));var _=require('lodash');var Redis=require(_0xba96('0x2'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xba96('0x3'))(_0xba96('0x4'));var config=require(_0xba96('0x5'));var db=require('../../mysqldb')['db'];config[_0xba96('0x6')]=_['defaults'](config[_0xba96('0x6')],{'host':_0xba96('0x7'),'port':0x18eb});var socket=require(_0xba96('0x8'))(new Redis(config['redis']));require(_0xba96('0x9'))[_0xba96('0xa')](socket);var jayson=require(_0xba96('0xb'));var client=jayson[_0xba96('0xc')]['http']({'port':0x232c});var client9002=jayson[_0xba96('0xc')][_0xba96('0xd')]({'port':0x232a});var interaction_log=require(_0xba96('0x3'))(_0xba96('0xe'));function respondWithRpcPromise(_0x305757,_0x33adab,_0x56c2e3,_0x1ebf75){return new Promise(function(_0x505b45,_0x59b6b3){var _0x5757dd=_0x1ebf75||client;return _0x5757dd[_0xba96('0xf')](_0x305757,_0x56c2e3)[_0xba96('0x10')](function(_0xe241bf){logger[_0xba96('0x11')]('FaxMessage,\x20%s,\x20%s',_0x33adab,_0xba96('0x12'));logger['debug'](_0xba96('0x13'),_0x33adab,_0xba96('0x12'),JSON[_0xba96('0x14')](_0xe241bf));if(_0xe241bf[_0xba96('0x15')]){if(_0xe241bf[_0xba96('0x15')][_0xba96('0x16')]===0x1f4){logger['error'](_0xba96('0x17'),_0x33adab,_0xe241bf[_0xba96('0x15')][_0xba96('0x18')]);return _0x59b6b3(_0xe241bf['error']['message']);}logger['error'](_0xba96('0x17'),_0x33adab,_0xe241bf[_0xba96('0x15')]['message']);return _0x505b45(_0xe241bf[_0xba96('0x15')][_0xba96('0x18')]);}else{logger[_0xba96('0x11')](_0xba96('0x17'),_0x33adab,_0xba96('0x12'));_0x505b45(_0xe241bf[_0xba96('0x19')]['message']);}})[_0xba96('0x1a')](function(_0x393515){logger[_0xba96('0x15')](_0xba96('0x17'),_0x33adab,_0x393515);_0x59b6b3(_0x393515);});});}function respondWithResult(_0x19f05d,_0x453e42){_0x453e42=_0x453e42||0xc8;return function(_0x172b83){if(_0x172b83){return _0x19f05d[_0xba96('0x1b')](_0x453e42)['json'](_0x172b83);}};}function respondWithFilteredResult(_0x224e61,_0xb983af){return function(_0xa01d53){if(_0xa01d53){var _0x3fd382=typeof _0xb983af[_0xba96('0x1c')]===_0xba96('0x1d')&&typeof _0xb983af['limit']===_0xba96('0x1d');var _0x3a7110=_0xa01d53['count'];var _0x3afc59=_0x3fd382?0x0:_0xb983af[_0xba96('0x1c')];var _0x2f0ce5=_0x3fd382?_0xa01d53[_0xba96('0x1e')]:_0xb983af['offset']+_0xb983af['limit'];var _0x19f483;if(_0x2f0ce5>=_0x3a7110){_0x2f0ce5=_0x3a7110;_0x19f483=0xc8;}else{_0x19f483=0xce;}_0x224e61[_0xba96('0x1b')](_0x19f483);return _0x224e61[_0xba96('0x1f')]('Content-Range',_0x3afc59+'-'+_0x2f0ce5+'/'+_0x3a7110)[_0xba96('0x20')](_0xa01d53);}return null;};}function saveUpdates(_0x3009b3){return function(_0x381ead){if(_0x381ead){return _0x381ead[_0xba96('0x21')](_0x3009b3)[_0xba96('0x10')](function(_0xa03680){return _0xa03680;});}return null;};}function removeEntity(_0x420acc){return function(_0x11d224){if(_0x11d224){return _0x11d224[_0xba96('0x22')]()[_0xba96('0x10')](function(){_0x420acc[_0xba96('0x1b')](0xcc)[_0xba96('0x23')]();});}};}function handleEntityNotFound(_0x557ee3){return function(_0x36cf6b){if(!_0x36cf6b){_0x557ee3[_0xba96('0x24')](0x194);}return _0x36cf6b;};}function handleError(_0x371493,_0x297fa4){_0x297fa4=_0x297fa4||0x1f4;return function(_0xe685a8){logger['error'](_0xe685a8[_0xba96('0x25')]);if(_0xe685a8[_0xba96('0x26')]){delete _0xe685a8[_0xba96('0x26')];}_0x371493[_0xba96('0x1b')](_0x297fa4)[_0xba96('0x27')](_0xe685a8);};}exports[_0xba96('0x28')]=function(_0x158801,_0x53fa93){var _0x3b25bf={},_0x264226={},_0x1efbaa={'count':0x0,'rows':[]};var _0x2315ce=_[_0xba96('0x29')](db[_0xba96('0x2a')][_0xba96('0x2b')],function(_0xace930){return{'name':_0xace930['fieldName'],'type':_0xace930[_0xba96('0x2c')][_0xba96('0x2d')]};});_0x264226[_0xba96('0x2e')]=_['map'](_0x2315ce,_0xba96('0x26'));_0x264226[_0xba96('0x2f')]=_[_0xba96('0x30')](_0x158801[_0xba96('0x2f')]);_0x264226['filters']=_[_0xba96('0x31')](_0x264226[_0xba96('0x2e')],_0x264226['query']);_0x3b25bf[_0xba96('0x32')]=_['intersection'](_0x264226[_0xba96('0x2e')],qs[_0xba96('0x33')](_0x158801[_0xba96('0x2f')][_0xba96('0x33')]));_0x3b25bf[_0xba96('0x32')]=_0x3b25bf['attributes'][_0xba96('0x34')]?_0x3b25bf[_0xba96('0x32')]:_0x264226[_0xba96('0x2e')];if(!_0x158801[_0xba96('0x2f')]['hasOwnProperty'](_0xba96('0x35'))){_0x3b25bf['limit']=qs[_0xba96('0x36')](_0x158801['query'][_0xba96('0x36')]);_0x3b25bf[_0xba96('0x1c')]=qs[_0xba96('0x1c')](_0x158801[_0xba96('0x2f')][_0xba96('0x1c')]);}_0x3b25bf[_0xba96('0x37')]=qs[_0xba96('0x38')](_0x158801[_0xba96('0x2f')]['sort']);_0x3b25bf[_0xba96('0x39')]=qs[_0xba96('0x3a')](_['pick'](_0x158801[_0xba96('0x2f')],_0x264226[_0xba96('0x3a')]),_0x2315ce);if(_0x158801[_0xba96('0x2f')][_0xba96('0x3b')]){_0x3b25bf[_0xba96('0x39')]=_[_0xba96('0x3c')](_0x3b25bf['where'],{'$or':_[_0xba96('0x29')](_0x2315ce,function(_0x3adcaa){if(_0x3adcaa['type']!==_0xba96('0x3d')){var _0x4470b7={};_0x4470b7[_0x3adcaa[_0xba96('0x26')]]={'$like':'%'+_0x158801['query'][_0xba96('0x3b')]+'%'};return _0x4470b7;}})});}_0x3b25bf=_[_0xba96('0x3c')]({},_0x3b25bf,_0x158801[_0xba96('0x3e')]);var _0x2f99ad={'where':_0x3b25bf[_0xba96('0x39')]};return db[_0xba96('0x2a')][_0xba96('0x1e')](_0x2f99ad)[_0xba96('0x10')](function(_0xf11a45){_0x1efbaa[_0xba96('0x1e')]=_0xf11a45;if(_0x158801[_0xba96('0x2f')][_0xba96('0x3f')]){_0x3b25bf[_0xba96('0x40')]=[{'all':!![]}];}return db[_0xba96('0x2a')][_0xba96('0x41')](_0x3b25bf);})[_0xba96('0x10')](function(_0x10a5ab){_0x1efbaa[_0xba96('0x42')]=_0x10a5ab;return _0x1efbaa;})[_0xba96('0x10')](respondWithFilteredResult(_0x53fa93,_0x3b25bf))['catch'](handleError(_0x53fa93,null));};exports['show']=function(_0x44cf19,_0x462502){var _0x529a3d={'raw':!![],'where':{'id':_0x44cf19[_0xba96('0x43')]['id']}},_0x4f598c={};_0x4f598c['model']=_[_0xba96('0x30')](db[_0xba96('0x2a')][_0xba96('0x2b')]);_0x4f598c[_0xba96('0x2f')]=_[_0xba96('0x30')](_0x44cf19[_0xba96('0x2f')]);_0x4f598c['filters']=_[_0xba96('0x31')](_0x4f598c[_0xba96('0x2e')],_0x4f598c['query']);_0x529a3d[_0xba96('0x32')]=_['intersection'](_0x4f598c['model'],qs[_0xba96('0x33')](_0x44cf19[_0xba96('0x2f')][_0xba96('0x33')]));_0x529a3d[_0xba96('0x32')]=_0x529a3d['attributes']['length']?_0x529a3d[_0xba96('0x32')]:_0x4f598c[_0xba96('0x2e')];if(_0x44cf19['query'][_0xba96('0x3f')]){_0x529a3d[_0xba96('0x40')]=[{'all':!![]}];}_0x529a3d=_[_0xba96('0x3c')]({},_0x529a3d,_0x44cf19[_0xba96('0x3e')]);return db[_0xba96('0x2a')]['find'](_0x529a3d)['then'](handleEntityNotFound(_0x462502,null))[_0xba96('0x10')](respondWithResult(_0x462502,null))[_0xba96('0x1a')](handleError(_0x462502,null));};exports[_0xba96('0x21')]=function(_0x21c1e2,_0x39dce6){if(_0x21c1e2[_0xba96('0x44')]['id']){delete _0x21c1e2['body']['id'];}return db[_0xba96('0x2a')][_0xba96('0x45')]({'where':{'id':_0x21c1e2['params']['id']}})[_0xba96('0x10')](handleEntityNotFound(_0x39dce6,null))[_0xba96('0x10')](saveUpdates(_0x21c1e2['body'],null))['then'](respondWithResult(_0x39dce6,null))[_0xba96('0x1a')](handleError(_0x39dce6,null));};exports[_0xba96('0x22')]=function(_0x68840e,_0x235479){return db[_0xba96('0x2a')]['find']({'where':{'id':_0x68840e[_0xba96('0x43')]['id']}})[_0xba96('0x10')](handleEntityNotFound(_0x235479,null))[_0xba96('0x10')](removeEntity(_0x235479,null))[_0xba96('0x1a')](handleError(_0x235479,null));};exports[_0xba96('0x46')]=function(_0x4b597d,_0x1c3533){return db['FaxMessage'][_0xba96('0x46')]()[_0xba96('0x10')](respondWithResult(_0x1c3533,null))[_0xba96('0x1a')](handleError(_0x1c3533,null));};exports[_0xba96('0x47')]=function(_0x2254ea,_0x26f44f){var _0x426a45=_0xba96('0x48');return interactionService[_0xba96('0x49')](_0x2254ea,_0x426a45)[_0xba96('0x10')](respondWithResult(_0x26f44f,null))['catch'](handleError(_0x26f44f,null));};exports[_0xba96('0x47')]=function(_0x3826e3,_0x1ba88c){var _0x3f1af6=_0xba96('0x4a');return interactionService[_0xba96('0x49')](_0x3826e3,_0x3f1af6)[_0xba96('0x10')](respondWithResult(_0x1ba88c,null))['catch'](handleError(_0x1ba88c,null));};exports[_0xba96('0x4b')]=function(_0x173cf7,_0x432bc5){var _0x5b6a61={'agent':{},'channel':_0xba96('0x4a')};if(_0x173cf7['body']['id']){delete _0x173cf7[_0xba96('0x44')]['id'];}_0x173cf7[_0xba96('0x44')][_0xba96('0x4c')]=_0x173cf7[_0xba96('0x44')]['UserId']||_0x173cf7[_0xba96('0x4d')]['id'];_0x5b6a61[_0xba96('0x4e')]['id']=_0x173cf7['body'][_0xba96('0x4c')];return db[_0xba96('0x2a')][_0xba96('0x45')]({'where':{'id':_0x173cf7[_0xba96('0x43')]['id'],'UserId':null}})[_0xba96('0x10')](handleEntityNotFound(_0x432bc5,null))[_0xba96('0x10')](function(_0x50fc7d){if(_0x50fc7d){_0x5b6a61[_0xba96('0x18')]=_0x50fc7d['get']({'plain':!![]});return db[_0xba96('0x4f')][_0xba96('0x45')]({'where':{'id':_0x50fc7d[_0xba96('0x50')]}});}return null;})[_0xba96('0x10')](handleEntityNotFound(_0x432bc5,null))[_0xba96('0x10')](function(_0x323def){if(_0x323def){_0x5b6a61[_0xba96('0x51')]=_0x323def['get']({'plain':!![]});interaction_log['info'](_0xba96('0x52'),_0x173cf7[_0xba96('0x4d')]['id'],_0x173cf7[_0xba96('0x4d')]['name'],_0x173cf7[_0xba96('0x4d')][_0xba96('0x53')],_0x5b6a61[_0xba96('0x51')]['id'],_0x173cf7['body']?JSON[_0xba96('0x14')](_0x173cf7[_0xba96('0x44')]):_0xba96('0x54'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5b6a61);}return null;})[_0xba96('0x10')](function(_0x49583c){var _0x4fada7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49583c[_0xba96('0x18')][_0xba96('0x55')];return db[_0xba96('0x56')]['query'](_0x4fada7,{'type':db['Sequelize'][_0xba96('0x57')][_0xba96('0x58')],'raw':!![]})[_0xba96('0x10')](function(_0x264fc5){return _0x264fc5;});})[_0xba96('0x10')](function(_0x5a3834){if(_0x5a3834){_0x5b6a61[_0xba96('0x18')][_0xba96('0x59')]=_0x5a3834[0x0];if(!_0x173cf7[_0xba96('0x44')][_0xba96('0x4c')])return;return db['User'][_0xba96('0x45')]({'where':{'id':_0x173cf7['body'][_0xba96('0x4c')],'role':_0xba96('0x4e')},'attributes':['id',_0xba96('0x26'),'fullname',_0xba96('0x5a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x22d832){if(!_0x22d832)return null;_0x5b6a61[_0xba96('0x18')]['agent']=_0x22d832;return _0x5b6a61;})[_0xba96('0x10')](function(_0x2691ec){if(_0x2691ec){_0x2691ec['message']['interface']=util[_0xba96('0x5b')](_0xba96('0x5c'),_0x173cf7[_0xba96('0x4d')][_0xba96('0x26')]);_0x2691ec[_0xba96('0x18')][_0xba96('0x5d')]=_0x5b6a61['channel'];_0x2691ec[_0xba96('0x18')][_0xba96('0x5e')]=_0x5b6a61[_0xba96('0x5d')];_0x2691ec['message']['event']=_0xba96('0x4b');respondWithRpcPromise(_0xba96('0x5f'),_0xba96('0x5f'),{'event':'rejectmessage','message':_0x2691ec[_0xba96('0x18')]},client9002);return _0x5b6a61;}return null;})[_0xba96('0x10')](respondWithResult(_0x432bc5,null))[_0xba96('0x1a')](handleError(_0x432bc5,null));};exports[_0xba96('0x60')]=function(_0x41644a,_0x1f638b){var _0x134f3f;return db[_0xba96('0x2a')][_0xba96('0x60')](_0x41644a[_0xba96('0x44')],{})[_0xba96('0x10')](function(_0x5cee5c){_0x134f3f=_0x5cee5c;return db[_0xba96('0x61')][_0xba96('0x62')]({'where':{'id':_0x134f3f['ContactId']}});})[_0xba96('0x10')](function(_0x2c5875){if(_[_0xba96('0x63')](_0x2c5875)){return;}else{_0x134f3f[_0xba96('0x4a')]=_0x2c5875[_0xba96('0x4a')];return db[_0xba96('0x64')]['findOne']({'where':{'id':_0x134f3f[_0xba96('0x65')]}});}})[_0xba96('0x10')](function(_0x268fc3){return respondWithRpcPromise('SendFax',_0xba96('0x66'),{'FaxAccountId':_['isNil'](_0x41644a[_0xba96('0x44')])?undefined:_0x41644a['body'][_0xba96('0x67')],'path':_[_0xba96('0x63')](_0x268fc3)?undefined:util[_0xba96('0x5b')]('/var/opt/motion2/server/files/attachments/%s',_0x268fc3[_0xba96('0x68')]),'fax':_[_0xba96('0x63')](_0x134f3f['fax'])?undefined:_0x134f3f['fax'],'AttachmentId':_0x134f3f['AttachmentId']},client9002);})[_0xba96('0x10')](respondWithResult(_0x1f638b,0xc9))[_0xba96('0x1a')](handleError(_0x1f638b,null));};exports[_0xba96('0x69')]=function(_0x24cad6,_0x42e30a){var _0x238f21=path[_0xba96('0x6a')](config['root'],_0xba96('0x6b'),'files',_0xba96('0x6c'));return db[_0xba96('0x2a')][_0xba96('0x45')]({'where':{'id':_0x24cad6['params']['id']},'include':[{'model':db[_0xba96('0x64')],'as':_0xba96('0x64')}]})['then'](handleEntityNotFound(_0x42e30a,null))[_0xba96('0x10')](function(_0x23e918){if(_0x23e918){return _0x42e30a['download'](path[_0xba96('0x6a')](_0x238f21,_0x23e918[_0xba96('0x64')][_0xba96('0x68')]));}})[_0xba96('0x1a')](handleError(_0x42e30a,null));}; \ No newline at end of file +var _0xf0c9=['download','root','files','attachments','Attachment','join','util','path','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','fax-interactions','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','json','undefined','count','offset','status','set','Content-Range','update','end','sendStatus','stack','name','send','FaxMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','length','find','body','destroy','describe','sms','acceptMessage','fax','reject','UserId','user','agent','get','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0xf0c9,0x15f));var _0x9f0c=function(_0x317c38,_0x9d154d){_0x317c38=_0x317c38-0x0;var _0x304c05=_0xf0c9[_0x317c38];return _0x304c05;};'use strict';var util=require(_0x9f0c('0x0'));var path=require(_0x9f0c('0x1'));var _=require('lodash');var Redis=require(_0x9f0c('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x9f0c('0x3'));var logger=require(_0x9f0c('0x4'))('api');var config=require(_0x9f0c('0x5'));var db=require('../../mysqldb')['db'];config[_0x9f0c('0x6')]=_[_0x9f0c('0x7')](config[_0x9f0c('0x6')],{'host':_0x9f0c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f0c('0x6')]));require('./faxMessage.socket')[_0x9f0c('0x9')](socket);var jayson=require(_0x9f0c('0xa'));var client=jayson[_0x9f0c('0xb')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9f0c('0xc')]({'port':0x232a});var interaction_log=require(_0x9f0c('0x4'))(_0x9f0c('0xd'));function respondWithRpcPromise(_0x3fa6cb,_0x3e87f0,_0x353d84,_0x26a9a6){return new Promise(function(_0x1e8a02,_0x3694a9){var _0x1694b1=_0x26a9a6||client;return _0x1694b1['request'](_0x3fa6cb,_0x353d84)[_0x9f0c('0xe')](function(_0x471d91){logger[_0x9f0c('0xf')](_0x9f0c('0x10'),_0x3e87f0,'request\x20sent');logger[_0x9f0c('0x11')](_0x9f0c('0x12'),_0x3e87f0,_0x9f0c('0x13'),JSON['stringify'](_0x471d91));if(_0x471d91['error']){if(_0x471d91[_0x9f0c('0x14')][_0x9f0c('0x15')]===0x1f4){logger[_0x9f0c('0x14')](_0x9f0c('0x10'),_0x3e87f0,_0x471d91[_0x9f0c('0x14')][_0x9f0c('0x16')]);return _0x3694a9(_0x471d91[_0x9f0c('0x14')][_0x9f0c('0x16')]);}logger[_0x9f0c('0x14')](_0x9f0c('0x10'),_0x3e87f0,_0x471d91[_0x9f0c('0x14')][_0x9f0c('0x16')]);return _0x1e8a02(_0x471d91[_0x9f0c('0x14')][_0x9f0c('0x16')]);}else{logger[_0x9f0c('0xf')](_0x9f0c('0x10'),_0x3e87f0,_0x9f0c('0x13'));_0x1e8a02(_0x471d91['result'][_0x9f0c('0x16')]);}})[_0x9f0c('0x17')](function(_0x473795){logger['error'](_0x9f0c('0x10'),_0x3e87f0,_0x473795);_0x3694a9(_0x473795);});});}function respondWithResult(_0x8d0a5a,_0x589793){_0x589793=_0x589793||0xc8;return function(_0x4e2974){if(_0x4e2974){return _0x8d0a5a['status'](_0x589793)[_0x9f0c('0x18')](_0x4e2974);}};}function respondWithFilteredResult(_0x125265,_0x597b86){return function(_0x4f1eec){if(_0x4f1eec){var _0x218256=typeof _0x597b86['offset']===_0x9f0c('0x19')&&typeof _0x597b86['limit']===_0x9f0c('0x19');var _0x5a8a5d=_0x4f1eec[_0x9f0c('0x1a')];var _0x3509d4=_0x218256?0x0:_0x597b86[_0x9f0c('0x1b')];var _0x4b51df=_0x218256?_0x4f1eec[_0x9f0c('0x1a')]:_0x597b86['offset']+_0x597b86['limit'];var _0x27ac6e;if(_0x4b51df>=_0x5a8a5d){_0x4b51df=_0x5a8a5d;_0x27ac6e=0xc8;}else{_0x27ac6e=0xce;}_0x125265[_0x9f0c('0x1c')](_0x27ac6e);return _0x125265[_0x9f0c('0x1d')](_0x9f0c('0x1e'),_0x3509d4+'-'+_0x4b51df+'/'+_0x5a8a5d)[_0x9f0c('0x18')](_0x4f1eec);}return null;};}function saveUpdates(_0x3a44c2){return function(_0x2e80e4){if(_0x2e80e4){return _0x2e80e4[_0x9f0c('0x1f')](_0x3a44c2)[_0x9f0c('0xe')](function(_0x986138){return _0x986138;});}return null;};}function removeEntity(_0x5221ce){return function(_0x22772f){if(_0x22772f){return _0x22772f['destroy']()[_0x9f0c('0xe')](function(){_0x5221ce['status'](0xcc)[_0x9f0c('0x20')]();});}};}function handleEntityNotFound(_0x515065){return function(_0x327f13){if(!_0x327f13){_0x515065[_0x9f0c('0x21')](0x194);}return _0x327f13;};}function handleError(_0x3db569,_0x20b5e8){_0x20b5e8=_0x20b5e8||0x1f4;return function(_0x5635e2){logger[_0x9f0c('0x14')](_0x5635e2[_0x9f0c('0x22')]);if(_0x5635e2[_0x9f0c('0x23')]){delete _0x5635e2[_0x9f0c('0x23')];}_0x3db569[_0x9f0c('0x1c')](_0x20b5e8)[_0x9f0c('0x24')](_0x5635e2);};}exports['index']=function(_0x49ed54,_0x5cb4f9){var _0x4484a4={},_0x590ae9={},_0x5c77bb={'count':0x0,'rows':[]};var _0x33beb7=_['map'](db[_0x9f0c('0x25')]['rawAttributes'],function(_0x10d378){return{'name':_0x10d378[_0x9f0c('0x26')],'type':_0x10d378[_0x9f0c('0x27')][_0x9f0c('0x28')]};});_0x590ae9[_0x9f0c('0x29')]=_['map'](_0x33beb7,_0x9f0c('0x23'));_0x590ae9[_0x9f0c('0x2a')]=_['keys'](_0x49ed54[_0x9f0c('0x2a')]);_0x590ae9[_0x9f0c('0x2b')]=_[_0x9f0c('0x2c')](_0x590ae9[_0x9f0c('0x29')],_0x590ae9[_0x9f0c('0x2a')]);_0x4484a4[_0x9f0c('0x2d')]=_[_0x9f0c('0x2c')](_0x590ae9['model'],qs[_0x9f0c('0x2e')](_0x49ed54[_0x9f0c('0x2a')][_0x9f0c('0x2e')]));_0x4484a4[_0x9f0c('0x2d')]=_0x4484a4['attributes']['length']?_0x4484a4[_0x9f0c('0x2d')]:_0x590ae9[_0x9f0c('0x29')];if(!_0x49ed54['query'][_0x9f0c('0x2f')]('nolimit')){_0x4484a4[_0x9f0c('0x30')]=qs[_0x9f0c('0x30')](_0x49ed54['query'][_0x9f0c('0x30')]);_0x4484a4[_0x9f0c('0x1b')]=qs['offset'](_0x49ed54[_0x9f0c('0x2a')][_0x9f0c('0x1b')]);}_0x4484a4[_0x9f0c('0x31')]=qs[_0x9f0c('0x32')](_0x49ed54[_0x9f0c('0x2a')][_0x9f0c('0x32')]);_0x4484a4['where']=qs['filters'](_['pick'](_0x49ed54[_0x9f0c('0x2a')],_0x590ae9[_0x9f0c('0x2b')]),_0x33beb7);if(_0x49ed54[_0x9f0c('0x2a')][_0x9f0c('0x33')]){_0x4484a4[_0x9f0c('0x34')]=_[_0x9f0c('0x35')](_0x4484a4[_0x9f0c('0x34')],{'$or':_[_0x9f0c('0x36')](_0x33beb7,function(_0x32d8f8){if(_0x32d8f8[_0x9f0c('0x27')]!==_0x9f0c('0x37')){var _0x5d74c0={};_0x5d74c0[_0x32d8f8['name']]={'$like':'%'+_0x49ed54[_0x9f0c('0x2a')][_0x9f0c('0x33')]+'%'};return _0x5d74c0;}})});}_0x4484a4=_[_0x9f0c('0x35')]({},_0x4484a4,_0x49ed54[_0x9f0c('0x38')]);var _0x10ebe3={'where':_0x4484a4[_0x9f0c('0x34')]};return db[_0x9f0c('0x25')][_0x9f0c('0x1a')](_0x10ebe3)['then'](function(_0x459214){_0x5c77bb['count']=_0x459214;if(_0x49ed54[_0x9f0c('0x2a')][_0x9f0c('0x39')]){_0x4484a4[_0x9f0c('0x3a')]=[{'all':!![]}];}return db['FaxMessage'][_0x9f0c('0x3b')](_0x4484a4);})[_0x9f0c('0xe')](function(_0x12a939){_0x5c77bb['rows']=_0x12a939;return _0x5c77bb;})[_0x9f0c('0xe')](respondWithFilteredResult(_0x5cb4f9,_0x4484a4))['catch'](handleError(_0x5cb4f9,null));};exports[_0x9f0c('0x3c')]=function(_0x2f0f88,_0x242cf7){var _0xfe3c00={'raw':!![],'where':{'id':_0x2f0f88[_0x9f0c('0x3d')]['id']}},_0x38b8f7={};_0x38b8f7[_0x9f0c('0x29')]=_[_0x9f0c('0x3e')](db['FaxMessage'][_0x9f0c('0x3f')]);_0x38b8f7['query']=_[_0x9f0c('0x3e')](_0x2f0f88[_0x9f0c('0x2a')]);_0x38b8f7[_0x9f0c('0x2b')]=_[_0x9f0c('0x2c')](_0x38b8f7[_0x9f0c('0x29')],_0x38b8f7[_0x9f0c('0x2a')]);_0xfe3c00[_0x9f0c('0x2d')]=_[_0x9f0c('0x2c')](_0x38b8f7['model'],qs['fields'](_0x2f0f88[_0x9f0c('0x2a')]['fields']));_0xfe3c00[_0x9f0c('0x2d')]=_0xfe3c00[_0x9f0c('0x2d')][_0x9f0c('0x40')]?_0xfe3c00[_0x9f0c('0x2d')]:_0x38b8f7[_0x9f0c('0x29')];if(_0x2f0f88[_0x9f0c('0x2a')][_0x9f0c('0x39')]){_0xfe3c00[_0x9f0c('0x3a')]=[{'all':!![]}];}_0xfe3c00=_[_0x9f0c('0x35')]({},_0xfe3c00,_0x2f0f88[_0x9f0c('0x38')]);return db[_0x9f0c('0x25')][_0x9f0c('0x41')](_0xfe3c00)[_0x9f0c('0xe')](handleEntityNotFound(_0x242cf7,null))['then'](respondWithResult(_0x242cf7,null))[_0x9f0c('0x17')](handleError(_0x242cf7,null));};exports['update']=function(_0x26a95a,_0x20cf3d){if(_0x26a95a[_0x9f0c('0x42')]['id']){delete _0x26a95a['body']['id'];}return db[_0x9f0c('0x25')][_0x9f0c('0x41')]({'where':{'id':_0x26a95a['params']['id']}})[_0x9f0c('0xe')](handleEntityNotFound(_0x20cf3d,null))['then'](saveUpdates(_0x26a95a[_0x9f0c('0x42')],null))[_0x9f0c('0xe')](respondWithResult(_0x20cf3d,null))[_0x9f0c('0x17')](handleError(_0x20cf3d,null));};exports[_0x9f0c('0x43')]=function(_0x5efc5c,_0x21e4ce){return db[_0x9f0c('0x25')][_0x9f0c('0x41')]({'where':{'id':_0x5efc5c[_0x9f0c('0x3d')]['id']}})[_0x9f0c('0xe')](handleEntityNotFound(_0x21e4ce,null))[_0x9f0c('0xe')](removeEntity(_0x21e4ce,null))[_0x9f0c('0x17')](handleError(_0x21e4ce,null));};exports[_0x9f0c('0x44')]=function(_0x3a4a3a,_0x41cf25){return db[_0x9f0c('0x25')]['describe']()[_0x9f0c('0xe')](respondWithResult(_0x41cf25,null))[_0x9f0c('0x17')](handleError(_0x41cf25,null));};exports['accept']=function(_0x43161c,_0x2f575b){var _0x3cd93a=_0x9f0c('0x45');return interactionService[_0x9f0c('0x46')](_0x43161c,_0x3cd93a)[_0x9f0c('0xe')](respondWithResult(_0x2f575b,null))[_0x9f0c('0x17')](handleError(_0x2f575b,null));};exports['accept']=function(_0x4389ed,_0x2a8659){var _0x4efd2d=_0x9f0c('0x47');return interactionService['acceptMessage'](_0x4389ed,_0x4efd2d)[_0x9f0c('0xe')](respondWithResult(_0x2a8659,null))[_0x9f0c('0x17')](handleError(_0x2a8659,null));};exports[_0x9f0c('0x48')]=function(_0xdff421,_0x21df33){var _0x348bb8={'agent':{},'channel':_0x9f0c('0x47')};if(_0xdff421[_0x9f0c('0x42')]['id']){delete _0xdff421['body']['id'];}_0xdff421[_0x9f0c('0x42')][_0x9f0c('0x49')]=_0xdff421[_0x9f0c('0x42')]['UserId']||_0xdff421[_0x9f0c('0x4a')]['id'];_0x348bb8[_0x9f0c('0x4b')]['id']=_0xdff421[_0x9f0c('0x42')][_0x9f0c('0x49')];return db[_0x9f0c('0x25')][_0x9f0c('0x41')]({'where':{'id':_0xdff421[_0x9f0c('0x3d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x21df33,null))['then'](function(_0x17a738){if(_0x17a738){_0x348bb8[_0x9f0c('0x16')]=_0x17a738[_0x9f0c('0x4c')]({'plain':!![]});return db[_0x9f0c('0x4d')][_0x9f0c('0x41')]({'where':{'id':_0x17a738['FaxInteractionId']}});}return null;})[_0x9f0c('0xe')](handleEntityNotFound(_0x21df33,null))[_0x9f0c('0xe')](function(_0x435c03){if(_0x435c03){_0x348bb8['interaction']=_0x435c03[_0x9f0c('0x4c')]({'plain':!![]});interaction_log[_0x9f0c('0xf')](_0x9f0c('0x4e'),_0xdff421[_0x9f0c('0x4a')]['id'],_0xdff421[_0x9f0c('0x4a')][_0x9f0c('0x23')],_0xdff421['user'][_0x9f0c('0x4f')],_0x348bb8['interaction']['id'],_0xdff421[_0x9f0c('0x42')]?JSON[_0x9f0c('0x50')](_0xdff421['body']):_0x9f0c('0x51'));return respondWithRpcPromise(_0x9f0c('0x52'),_0x9f0c('0x53'),_0x348bb8);}return null;})[_0x9f0c('0xe')](function(_0x2d8e52){var _0x4a4637='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d8e52[_0x9f0c('0x16')][_0x9f0c('0x54')];return db[_0x9f0c('0x55')]['query'](_0x4a4637,{'type':db['Sequelize'][_0x9f0c('0x56')][_0x9f0c('0x57')],'raw':!![]})[_0x9f0c('0xe')](function(_0x4394eb){return _0x4394eb;});})[_0x9f0c('0xe')](function(_0x192e0e){if(_0x192e0e){_0x348bb8['message'][_0x9f0c('0x58')]=_0x192e0e[0x0];if(!_0xdff421[_0x9f0c('0x42')][_0x9f0c('0x49')])return;return db[_0x9f0c('0x59')][_0x9f0c('0x41')]({'where':{'id':_0xdff421[_0x9f0c('0x42')][_0x9f0c('0x49')],'role':_0x9f0c('0x4b')},'attributes':['id',_0x9f0c('0x23'),_0x9f0c('0x5a'),_0x9f0c('0x5b'),_0x9f0c('0x5c')],'raw':!![]});}return null;})[_0x9f0c('0xe')](function(_0x142db4){if(!_0x142db4)return null;_0x348bb8['message']['agent']=_0x142db4;return _0x348bb8;})[_0x9f0c('0xe')](function(_0x45ac82){if(_0x45ac82){_0x45ac82[_0x9f0c('0x16')][_0x9f0c('0x5d')]=util[_0x9f0c('0x5e')](_0x9f0c('0x5f'),_0xdff421[_0x9f0c('0x4a')][_0x9f0c('0x23')]);_0x45ac82['message'][_0x9f0c('0x60')]=_0x348bb8['channel'];_0x45ac82[_0x9f0c('0x16')][_0x9f0c('0x61')]=_0x348bb8['channel'];_0x45ac82['message']['event']=_0x9f0c('0x48');respondWithRpcPromise(_0x9f0c('0x62'),'EventManager',{'event':_0x9f0c('0x63'),'message':_0x45ac82[_0x9f0c('0x16')]},client9002);return _0x348bb8;}return null;})['then'](respondWithResult(_0x21df33,null))['catch'](handleError(_0x21df33,null));};exports[_0x9f0c('0x64')]=function(_0xc06307,_0x5cf07e){var _0x222525;return db[_0x9f0c('0x25')]['create'](_0xc06307[_0x9f0c('0x42')],{})[_0x9f0c('0xe')](function(_0x45d208){_0x222525=_0x45d208;return db[_0x9f0c('0x65')][_0x9f0c('0x66')]({'where':{'id':_0x222525['ContactId']}});})['then'](function(_0xbc0f5b){if(_[_0x9f0c('0x67')](_0xbc0f5b)){return;}else{_0x222525[_0x9f0c('0x47')]=_0xbc0f5b[_0x9f0c('0x47')];return db['Attachment'][_0x9f0c('0x66')]({'where':{'id':_0x222525[_0x9f0c('0x68')]}});}})[_0x9f0c('0xe')](function(_0x477889){return respondWithRpcPromise('SendFax',_0x9f0c('0x69'),{'FaxAccountId':_[_0x9f0c('0x67')](_0xc06307[_0x9f0c('0x42')])?undefined:_0xc06307[_0x9f0c('0x42')][_0x9f0c('0x6a')],'path':_[_0x9f0c('0x67')](_0x477889)?undefined:util[_0x9f0c('0x5e')](_0x9f0c('0x6b'),_0x477889[_0x9f0c('0x6c')]),'fax':_[_0x9f0c('0x67')](_0x222525[_0x9f0c('0x47')])?undefined:_0x222525[_0x9f0c('0x47')],'AttachmentId':_0x222525[_0x9f0c('0x68')]},client9002);})[_0x9f0c('0xe')](respondWithResult(_0x5cf07e,0xc9))[_0x9f0c('0x17')](handleError(_0x5cf07e,null));};exports[_0x9f0c('0x6d')]=function(_0x16ef9d,_0x11bad7){var _0x4eb1f5=path['join'](config[_0x9f0c('0x6e')],'server',_0x9f0c('0x6f'),_0x9f0c('0x70'));return db['FaxMessage'][_0x9f0c('0x41')]({'where':{'id':_0x16ef9d[_0x9f0c('0x3d')]['id']},'include':[{'model':db[_0x9f0c('0x71')],'as':_0x9f0c('0x71')}]})[_0x9f0c('0xe')](handleEntityNotFound(_0x11bad7,null))['then'](function(_0x5e6f27){if(_0x5e6f27){return _0x11bad7['download'](path[_0x9f0c('0x72')](_0x4eb1f5,_0x5e6f27[_0x9f0c('0x71')][_0x9f0c('0x6c')]));}})[_0x9f0c('0x17')](handleError(_0x11bad7,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c571698..0664ea2 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 _0x8b52=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update'];(function(_0x49e4a3,_0x5c81ce){var _0x59d414=function(_0x1d5d29){while(--_0x1d5d29){_0x49e4a3['push'](_0x49e4a3['shift']());}};_0x59d414(++_0x5c81ce);}(_0x8b52,0x151));var _0x28b5=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8b52[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require(_0x28b5('0x0'));var FaxMessage=require(_0x28b5('0x1'))['db'][_0x28b5('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x28b5('0x3'),'afterUpdate':_0x28b5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4110e8){return function(_0x3d0e93,_0x3a762e,_0x226981){FaxMessageEvents[_0x28b5('0x5')](_0x4110e8+':'+_0x3d0e93['id'],_0x3d0e93);FaxMessageEvents[_0x28b5('0x5')](_0x4110e8,_0x3d0e93);_0x226981(null);};}for(var e in events){if(events[_0x28b5('0x6')](e)){var event=events[e];FaxMessage[_0x28b5('0x7')](e,emitEvent(event));}}module[_0x28b5('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xa24d=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2e6f3a,_0x57a9cd){var _0x495e13=function(_0x399378){while(--_0x399378){_0x2e6f3a['push'](_0x2e6f3a['shift']());}};_0x495e13(++_0x57a9cd);}(_0xa24d,0x1c1));var _0xda24=function(_0x469ae2,_0x24cd30){_0x469ae2=_0x469ae2-0x0;var _0x5e33e4=_0xa24d[_0x469ae2];return _0x5e33e4;};'use strict';var EventEmitter=require(_0xda24('0x0'));var FaxMessage=require(_0xda24('0x1'))['db'][_0xda24('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xda24('0x3')](0x0);var events={'afterCreate':_0xda24('0x4'),'afterUpdate':_0xda24('0x5'),'afterDestroy':_0xda24('0x6')};function emitEvent(_0x501b16){return function(_0xcc2450,_0x2e6e4f,_0x24a908){FaxMessageEvents[_0xda24('0x7')](_0x501b16+':'+_0xcc2450['id'],_0xcc2450);FaxMessageEvents['emit'](_0x501b16,_0xcc2450);_0x24a908(null);};}for(var e in events){if(events[_0xda24('0x8')](e)){var event=events[e];FaxMessage[_0xda24('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 8531741..790d4a8 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 _0xf772=['direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','utf8mb4','lodash','util','api','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get'];(function(_0x28ffee,_0x230a50){var _0x2b4cf1=function(_0x2be533){while(--_0x2be533){_0x28ffee['push'](_0x28ffee['shift']());}};_0x2b4cf1(++_0x230a50);}(_0xf772,0x143));var _0x2f77=function(_0xebc6bf,_0x457124){_0xebc6bf=_0xebc6bf-0x0;var _0x3cc4a5=_0xf772[_0xebc6bf];return _0x3cc4a5;};'use strict';var _=require(_0x2f77('0x0'));var util=require(_0x2f77('0x1'));var logger=require('../../config/logger')(_0x2f77('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f77('0x3'));var fs=require('fs');var path=require(_0x2f77('0x4'));var rimraf=require('rimraf');var config=require(_0x2f77('0x5'));var attributes=require(_0x2f77('0x6'));module[_0x2f77('0x7')]=function(_0x2149c1,_0x1d5c23){return _0x2149c1[_0x2f77('0x8')]('FaxMessage',attributes,{'tableName':_0x2f77('0x9'),'paranoid':![],'indexes':[{'name':_0x2f77('0xa'),'fields':[_0x2f77('0xb')],'type':_0x2f77('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a24bc,_0x4b11ec,_0x2bb6ea){var _0x202b69=_0x2149c1[_0x2f77('0xd')];var _0x46e56b=_0x1a24bc[_0x2f77('0xe')]({'plain':!![]});if(_0x46e56b[_0x2f77('0xf')][_0x2f77('0x10')]()==='in'||_0x46e56b['direction'][_0x2f77('0x10')]()===_0x2f77('0x11')&&!_0x46e56b[_0x2f77('0x12')]&&!_['isNil'](_0x46e56b['UserId'])){_0x202b69[_0x2f77('0x13')][_0x2f77('0x14')]({'where':{'id':_0x46e56b[_0x2f77('0x15')]}})['then'](function(_0x533076){if(_0x533076){_0x533076[_0x2f77('0x16')]({'lastMsgAt':_0x46e56b[_0x2f77('0x17')],'lastMsgDirection':_0x46e56b[_0x2f77('0xf')][_0x2f77('0x10')]()});}})[_0x2f77('0x18')](function(_0x1b51cb){console['error'](_0x1b51cb);});}_0x2bb6ea();}},'charset':_0x2f77('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9db1=['FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','then','update','createdAt','error','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x2dbdf6,_0x40f023){var _0x596b65=function(_0x949d14){while(--_0x949d14){_0x2dbdf6['push'](_0x2dbdf6['shift']());}};_0x596b65(++_0x40f023);}(_0x9db1,0x1d9));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19db('0x0'));var util=require('util');var logger=require(_0x19db('0x1'))(_0x19db('0x2'));var moment=require('moment');var BPromise=require(_0x19db('0x3'));var rp=require(_0x19db('0x4'));var fs=require('fs');var path=require(_0x19db('0x5'));var rimraf=require('rimraf');var config=require(_0x19db('0x6'));var attributes=require(_0x19db('0x7'));module['exports']=function(_0x4947a0,_0x3b68c0){return _0x4947a0[_0x19db('0x8')](_0x19db('0x9'),attributes,{'tableName':_0x19db('0xa'),'paranoid':![],'indexes':[{'name':_0x19db('0xb'),'fields':[_0x19db('0xc')],'type':_0x19db('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x60b174,_0x4a7090,_0x1cbc89){var _0x1920f3=_0x4947a0[_0x19db('0xe')];var _0x136841=_0x60b174['get']({'plain':!![]});if(_0x136841[_0x19db('0xf')][_0x19db('0x10')]()==='in'||_0x136841[_0x19db('0xf')][_0x19db('0x10')]()===_0x19db('0x11')&&!_0x136841[_0x19db('0x12')]&&!_[_0x19db('0x13')](_0x136841[_0x19db('0x14')])){_0x1920f3[_0x19db('0x15')]['findOne']({'where':{'id':_0x136841['FaxInteractionId']}})[_0x19db('0x16')](function(_0x3bca7d){if(_0x3bca7d){_0x3bca7d[_0x19db('0x17')]({'lastMsgAt':_0x136841[_0x19db('0x18')],'lastMsgDirection':_0x136841[_0x19db('0xf')][_0x19db('0x10')]()});}})['catch'](function(_0xda09d9){console[_0x19db('0x19')](_0xda09d9);});}_0x1cbc89();}},'charset':_0x19db('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index be1c1fe..38621da 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 _0x0a9a=['error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','debug','UpdateFaxMessage','update','raw','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1bc933,_0x46c2de){var _0x238bba=function(_0x5399ef){while(--_0x5399ef){_0x1bc933['push'](_0x1bc933['shift']());}};_0x238bba(++_0x46c2de);}(_0x0a9a,0x183));var _0xa0a9=function(_0x983fb4,_0x4e1eb0){_0x983fb4=_0x983fb4-0x0;var _0x46ca85=_0x0a9a[_0x983fb4];return _0x46ca85;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});config[_0xa0a9('0xa')]=_['defaults'](config[_0xa0a9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0a9('0xb'))(new Redis(config[_0xa0a9('0xa')]));require(_0xa0a9('0xc'))[_0xa0a9('0xd')](socket);function respondWithRpcPromise(_0x4b9b93,_0x2ba0ac,_0x1b5bfb){return new BPromise(function(_0x5ce7e9,_0x5909cf){return client[_0xa0a9('0xe')](_0x4b9b93,_0x1b5bfb)[_0xa0a9('0xf')](function(_0x51d5a5){logger[_0xa0a9('0x10')]('FaxMessage,\x20%s,\x20%s',_0x2ba0ac,_0xa0a9('0x11'));logger['debug'](_0xa0a9('0x12'),_0x2ba0ac,_0xa0a9('0x11'),JSON[_0xa0a9('0x13')](_0x51d5a5));if(_0x51d5a5[_0xa0a9('0x14')]){if(_0x51d5a5[_0xa0a9('0x14')]['code']===0x1f4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);return _0x5909cf(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}logger['error'](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5['error']['message']);return _0x5ce7e9(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}else{logger[_0xa0a9('0x10')](_0xa0a9('0x15'),_0x2ba0ac,'request\x20sent');_0x5ce7e9(_0x51d5a5[_0xa0a9('0x17')][_0xa0a9('0x16')]);}})[_0xa0a9('0x18')](function(_0x27f8d4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x27f8d4);_0x5909cf(_0x27f8d4);});});}exports['CreateFaxMessage']=function(_0x3cdd8c){var _0x3107ce=this;return new Promise(function(_0x4a8e80,_0x53b99d){return db[_0xa0a9('0x19')][_0xa0a9('0x1a')](_0x3cdd8c[_0xa0a9('0x1b')],{'raw':_0x3cdd8c['options']?_0x3cdd8c[_0xa0a9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa0a9('0xf')](function(_0x5e6148){logger[_0xa0a9('0x10')](_0xa0a9('0x1d'),_0x3cdd8c);logger[_0xa0a9('0x1e')](_0xa0a9('0x1d'),_0x3cdd8c,JSON['stringify'](_0x5e6148));_0x4a8e80(_0x5e6148);})[_0xa0a9('0x18')](function(_0x4fb909){logger[_0xa0a9('0x14')](_0xa0a9('0x1d'),_0x4fb909[_0xa0a9('0x16')],_0x3cdd8c);_0x53b99d(_0x3107ce[_0xa0a9('0x14')](0x1f4,_0x4fb909['message']));});});};exports[_0xa0a9('0x1f')]=function(_0xe49d3b){var _0x384cd5=this;return new Promise(function(_0x3f4bea,_0x526dd1){return db[_0xa0a9('0x19')][_0xa0a9('0x20')](_0xe49d3b[_0xa0a9('0x1b')],{'raw':_0xe49d3b['options']?_0xe49d3b['options'][_0xa0a9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x22')]||null:null,'attributes':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x23')]||null:null,'limit':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x24')]||null:null})[_0xa0a9('0xf')](function(_0x554191){logger[_0xa0a9('0x10')](_0xa0a9('0x1f'),_0xe49d3b);logger['debug'](_0xa0a9('0x1f'),_0xe49d3b,JSON[_0xa0a9('0x13')](_0x554191));_0x3f4bea(_0x554191);})['catch'](function(_0x47c19b){logger[_0xa0a9('0x14')]('UpdateFaxMessage',_0x47c19b['message'],_0xe49d3b);_0x526dd1(_0x384cd5[_0xa0a9('0x14')](0x1f4,_0x47c19b[_0xa0a9('0x16')]));});});}; \ No newline at end of file +var _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x425d,0x1e0));var _0xd425=function(_0x77305c,_0x30e10a){_0x77305c=_0x77305c-0x0;var _0x167388=_0x425d[_0x77305c];return _0x167388;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));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});config[_0xd425('0xc')]=_[_0xd425('0xd')](config['redis'],{'host':_0xd425('0xe'),'port':0x18eb});var socket=require(_0xd425('0xf'))(new Redis(config[_0xd425('0xc')]));require(_0xd425('0x10'))[_0xd425('0x11')](socket);function respondWithRpcPromise(_0x2beb20,_0x30111e,_0x1969ba){return new BPromise(function(_0x3a7a01,_0x35a7f4){return client[_0xd425('0x12')](_0x2beb20,_0x1969ba)[_0xd425('0x13')](function(_0x26f6d2){logger[_0xd425('0x14')](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));logger[_0xd425('0x17')](_0xd425('0x18'),_0x30111e,_0xd425('0x16'),JSON[_0xd425('0x19')](_0x26f6d2));if(_0x26f6d2['error']){if(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1b')]===0x1f4){logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x35a7f4(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x3a7a01(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}else{logger['info'](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));_0x3a7a01(_0x26f6d2[_0xd425('0x1d')][_0xd425('0x1c')]);}})['catch'](function(_0x58a0c1){logger['error']('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x58a0c1);_0x35a7f4(_0x58a0c1);});});}exports[_0xd425('0x1e')]=function(_0xb92870){var _0x3c98db=this;return new Promise(function(_0x5e797a,_0x355af0){return db[_0xd425('0x1f')]['create'](_0xb92870[_0xd425('0x20')],{'raw':_0xb92870[_0xd425('0x21')]?_0xb92870[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![]})[_0xd425('0x13')](function(_0xb240c4){logger[_0xd425('0x14')](_0xd425('0x1e'),_0xb92870);logger[_0xd425('0x17')](_0xd425('0x1e'),_0xb92870,JSON[_0xd425('0x19')](_0xb240c4));_0x5e797a(_0xb240c4);})[_0xd425('0x23')](function(_0x47f44a){logger[_0xd425('0x1a')](_0xd425('0x1e'),_0x47f44a[_0xd425('0x1c')],_0xb92870);_0x355af0(_0x3c98db[_0xd425('0x1a')](0x1f4,_0x47f44a[_0xd425('0x1c')]));});});};exports[_0xd425('0x24')]=function(_0x3c3402){var _0x577e4b=this;return new Promise(function(_0x12f951,_0x177de2){return db[_0xd425('0x1f')]['update'](_0x3c3402[_0xd425('0x20')],{'raw':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x25')]||null:null,'attributes':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x26')]||null:null,'limit':_0x3c3402['options']?_0x3c3402[_0xd425('0x21')][_0xd425('0x27')]||null:null})[_0xd425('0x13')](function(_0x3695dd){logger[_0xd425('0x14')](_0xd425('0x24'),_0x3c3402);logger[_0xd425('0x17')](_0xd425('0x24'),_0x3c3402,JSON[_0xd425('0x19')](_0x3695dd));_0x12f951(_0x3695dd);})[_0xd425('0x23')](function(_0x3583b0){logger['error'](_0xd425('0x24'),_0x3583b0[_0xd425('0x1c')],_0x3c3402);_0x177de2(_0x577e4b[_0xd425('0x1a')](0x1f4,_0x3583b0[_0xd425('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2187d9e..bff2c87 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 _0x736e=['./faxMessage.events','remove','emit','removeListener','register','length','faxMessage:'];(function(_0x2230bf,_0x50ffc6){var _0x1818a4=function(_0x402f0d){while(--_0x402f0d){_0x2230bf['push'](_0x2230bf['shift']());}};_0x1818a4(++_0x50ffc6);}(_0x736e,0xbd));var _0xe736=function(_0x134b51,_0x422f2e){_0x134b51=_0x134b51-0x0;var _0x17d8bb=_0x736e[_0x134b51];return _0x17d8bb;};'use strict';var FaxMessageEvents=require(_0xe736('0x0'));var events=['save',_0xe736('0x1'),'update'];function createListener(_0xb61ff2,_0xf9cb57){return function(_0x1d70b4){_0xf9cb57[_0xe736('0x2')](_0xb61ff2,_0x1d70b4);};}function removeListener(_0x297abb,_0x3d01da){return function(){FaxMessageEvents[_0xe736('0x3')](_0x297abb,_0x3d01da);};}exports[_0xe736('0x4')]=function(_0x683b88){for(var _0x52f0d5=0x0,_0x40eff9=events[_0xe736('0x5')];_0x52f0d5<_0x40eff9;_0x52f0d5++){var _0x22f386=events[_0x52f0d5];var _0x3cb330=createListener(_0xe736('0x6')+_0x22f386,_0x683b88);FaxMessageEvents['on'](_0x22f386,_0x3cb330);}}; \ No newline at end of file +var _0xadfc=['./faxMessage.events','save','remove','update','emit','removeListener','register','faxMessage:'];(function(_0x413c19,_0x1e7ea6){var _0x15da71=function(_0x42339e){while(--_0x42339e){_0x413c19['push'](_0x413c19['shift']());}};_0x15da71(++_0x1e7ea6);}(_0xadfc,0x1a8));var _0xcadf=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xadfc[_0x5608a3];return _0x1ed50a;};'use strict';var FaxMessageEvents=require(_0xcadf('0x0'));var events=[_0xcadf('0x1'),_0xcadf('0x2'),_0xcadf('0x3')];function createListener(_0x1a0532,_0x895f9b){return function(_0x5e480f){_0x895f9b[_0xcadf('0x4')](_0x1a0532,_0x5e480f);};}function removeListener(_0x176931,_0x3afe10){return function(){FaxMessageEvents[_0xcadf('0x5')](_0x176931,_0x3afe10);};}exports[_0xcadf('0x6')]=function(_0x2f5f82){for(var _0x5da829=0x0,_0x96eecc=events['length'];_0x5da829<_0x96eecc;_0x5da829++){var _0x210172=events[_0x5da829];var _0x4ea400=createListener(_0xcadf('0x7')+_0x210172,_0x2f5f82);FaxMessageEvents['on'](_0x210172,_0x4ea400);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index aad9ccd..8549474 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','./faxMessage.controller','isAuthenticated','describe','get','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','update','reject','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x376f5f,_0x501f44){var _0x4b89d5=function(_0x4716bc){while(--_0x4716bc){_0x376f5f['push'](_0x376f5f['shift']());}};_0x4b89d5(++_0x501f44);}(_0x70e0,0x17b));var _0x070e=function(_0x2a96f8,_0x1e580e){_0x2a96f8=_0x2a96f8-0x0;var _0xeb674e=_0x70e0[_0x2a96f8];return _0xeb674e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x070e('0xd')]);router[_0x070e('0xe')]('/',auth[_0x070e('0x8')](),interaction[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11')),controller[_0x070e('0x12')]);router[_0x070e('0x13')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/accept',auth[_0x070e('0x8')](),controller['accept']);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x16')]);module[_0x070e('0x17')]=router; \ No newline at end of file +var _0xf4eb=['/:id/accept','accept','/:id/reject','delete','exports','multer','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','tracked','faxmessage:create','create','put'];(function(_0xaaf6a3,_0x46bf1c){var _0x255dbe=function(_0x1698e3){while(--_0x1698e3){_0xaaf6a3['push'](_0xaaf6a3['shift']());}};_0x255dbe(++_0x46bf1c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x18c2f4,_0x32b521){_0x18c2f4=_0x18c2f4-0x0;var _0x7cf6e2=_0xf4eb[_0x18c2f4];return _0x7cf6e2;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xbf4e('0xc')]('fax',_0xbf4e('0xd')),controller[_0xbf4e('0xe')]);router['put'](_0xbf4e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xbf4e('0xf')](_0xbf4e('0x10'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x11')]);router[_0xbf4e('0xf')](_0xbf4e('0x12'),auth['isAuthenticated'](),controller['reject']);router[_0xbf4e('0x13')](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 37e5d90..2c5cba8 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 _0xeca3=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','STRING','name'];(function(_0x1ebf61,_0x3ecb86){var _0x71fe1f=function(_0xfc7f18){while(--_0xfc7f18){_0x1ebf61['push'](_0x1ebf61['shift']());}};_0x71fe1f(++_0x3ecb86);}(_0xeca3,0x13f));var _0x3eca=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xeca3[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0x3eca('0x0'));module['exports']={'name':{'type':Sequelize[_0x3eca('0x1')],'unique':_0x3eca('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3eca('0x1')]},'timeout':{'type':Sequelize[_0x3eca('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3eca('0x4')](_0x3eca('0x5'),'beepall',_0x3eca('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3eca('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2e43=['sequelize','exports','STRING','ENUM','beepall','roundrobin','INTEGER'];(function(_0x4d0d85,_0x3250d3){var _0x290a74=function(_0x4762db){while(--_0x4762db){_0x4d0d85['push'](_0x4d0d85['shift']());}};_0x290a74(++_0x3250d3);}(_0x2e43,0x15e));var _0x32e4=function(_0x57c249,_0x3ef857){_0x57c249=_0x57c249-0x0;var _0x205d5f=_0x2e43[_0x57c249];return _0x205d5f;};'use strict';var Sequelize=require(_0x32e4('0x0'));module[_0x32e4('0x1')]={'name':{'type':Sequelize[_0x32e4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x32e4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x32e4('0x3')]('rrmemory',_0x32e4('0x4'),_0x32e4('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x32e4('0x6')],'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 5ecd149..09d0cb3 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 _0x66c7=['index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','body','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','filter','findAll','User','findAndCountAll','agent','faxPause','createdAt','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','get','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','UserProfileResource','name','send'];(function(_0x170c13,_0x2922e6){var _0x32fc87=function(_0x46d9c1){while(--_0x46d9c1){_0x170c13['push'](_0x170c13['shift']());}};_0x32fc87(++_0x2922e6);}(_0x66c7,0x15c));var _0x766c=function(_0x389723,_0x5ca5c4){_0x389723=_0x389723-0x0;var _0x4d1351=_0x66c7[_0x389723];return _0x4d1351;};'use strict';var BPromise=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var _=require(_0x766c('0x2'));var squel=require('squel');var Redis=require(_0x766c('0x3'));var qs=require(_0x766c('0x4'));var logger=require(_0x766c('0x5'))(_0x766c('0x6'));var config=require(_0x766c('0x7'));var db=require(_0x766c('0x8'))['db'];config['redis']=_[_0x766c('0x9')](config[_0x766c('0xa')],{'host':_0x766c('0xb'),'port':0x18eb});var socket=require(_0x766c('0xc'))(new Redis(config[_0x766c('0xa')]));require(_0x766c('0xd'))[_0x766c('0xe')](socket);function respondWithStatusCode(_0x4488b8,_0x5a4ffb){_0x5a4ffb=_0x5a4ffb||0xcc;return function(_0x4aa73d){if(_0x4aa73d){return _0x4488b8[_0x766c('0xf')](_0x5a4ffb);}return _0x4488b8[_0x766c('0x10')](_0x5a4ffb)[_0x766c('0x11')]();};}function respondWithResult(_0x58cb58,_0x1d360f){_0x1d360f=_0x1d360f||0xc8;return function(_0x4acfc1){if(_0x4acfc1){return _0x58cb58[_0x766c('0x10')](_0x1d360f)[_0x766c('0x12')](_0x4acfc1);}};}function respondWithFilteredResult(_0x67d3b7,_0x125373){return function(_0x2cb982){if(_0x2cb982){var _0x3e3b75=typeof _0x125373[_0x766c('0x13')]===_0x766c('0x14')&&typeof _0x125373[_0x766c('0x15')]===_0x766c('0x14');var _0x1db25d=_0x2cb982[_0x766c('0x16')];var _0x26dbe2=_0x3e3b75?0x0:_0x125373[_0x766c('0x13')];var _0x186914=_0x3e3b75?_0x2cb982['count']:_0x125373['offset']+_0x125373['limit'];var _0x35fcdc;if(_0x186914>=_0x1db25d){_0x186914=_0x1db25d;_0x35fcdc=0xc8;}else{_0x35fcdc=0xce;}_0x67d3b7[_0x766c('0x10')](_0x35fcdc);return _0x67d3b7[_0x766c('0x17')](_0x766c('0x18'),_0x26dbe2+'-'+_0x186914+'/'+_0x1db25d)[_0x766c('0x12')](_0x2cb982);}return null;};}function saveUpdates(_0x357602){return function(_0x4f6c82){if(_0x4f6c82){return _0x4f6c82['update'](_0x357602)[_0x766c('0x19')](function(_0x23c566){return _0x23c566;});}return null;};}function removeEntity(_0x105f60){return function(_0x47c887){if(_0x47c887){return _0x47c887[_0x766c('0x1a')]()[_0x766c('0x19')](function(){var _0x2e4ff6=_0x47c887['get']({'plain':!![]});var _0x4caea3='FaxQueues';return db[_0x766c('0x1b')]['destroy']({'where':{'type':_0x4caea3,'resourceId':_0x2e4ff6['id']}})[_0x766c('0x19')](function(){return _0x47c887;});})[_0x766c('0x19')](function(){_0x105f60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3316b6){return function(_0x330a74){if(!_0x330a74){_0x3316b6[_0x766c('0xf')](0x194);}return _0x330a74;};}function handleError(_0x508ce7,_0x28304f){_0x28304f=_0x28304f||0x1f4;return function(_0x39f65b){logger['error'](_0x39f65b['stack']);if(_0x39f65b['name']){delete _0x39f65b[_0x766c('0x1c')];}_0x508ce7['status'](_0x28304f)[_0x766c('0x1d')](_0x39f65b);};}exports[_0x766c('0x1e')]=function(_0x3e1034,_0x57f7a8){var _0x44659e={};var _0x444310={'count':0x0,'rows':[]};var _0x19cb9b=_[_0x766c('0x1f')](db[_0x766c('0x20')][_0x766c('0x21')],function(_0x5ad1d6){return{'name':_0x5ad1d6[_0x766c('0x22')],'type':_0x5ad1d6[_0x766c('0x23')][_0x766c('0x24')]};});_0x44659e=qs[_0x766c('0x25')](_0x19cb9b,_0x3e1034);var _0x1631af={'where':_0x44659e['where']};return db['FaxQueue'][_0x766c('0x16')](_0x1631af)[_0x766c('0x19')](function(_0x1d5288){_0x444310['count']=_0x1d5288;_0x44659e[_0x766c('0x26')]=qs[_0x766c('0x26')](_0x3e1034['query']);return db[_0x766c('0x20')]['findAll'](_0x44659e);})['then'](function(_0x3a4561){_0x444310[_0x766c('0x27')]=_0x3a4561;return _0x444310;})[_0x766c('0x19')](respondWithFilteredResult(_0x57f7a8,_0x44659e))['catch'](handleError(_0x57f7a8,null));};exports[_0x766c('0x28')]=function(_0x223a75,_0x6fd6e1){var _0x25b731={'raw':!![],'where':{'id':_0x223a75['params']['id']}},_0x175c37={};_0x175c37['model']=_[_0x766c('0x29')](db[_0x766c('0x20')][_0x766c('0x21')]);_0x175c37[_0x766c('0x2a')]=_[_0x766c('0x29')](_0x223a75['query']);_0x175c37[_0x766c('0x2b')]=_[_0x766c('0x2c')](_0x175c37[_0x766c('0x2d')],_0x175c37['query']);_0x25b731[_0x766c('0x2e')]=_['intersection'](_0x175c37['model'],qs[_0x766c('0x2f')](_0x223a75[_0x766c('0x2a')][_0x766c('0x2f')]));_0x25b731[_0x766c('0x2e')]=_0x25b731[_0x766c('0x2e')][_0x766c('0x30')]?_0x25b731['attributes']:_0x175c37['model'];if(_0x223a75[_0x766c('0x2a')][_0x766c('0x31')]){_0x25b731[_0x766c('0x26')]=[{'all':!![]}];}_0x25b731=_[_0x766c('0x32')]({},_0x25b731,_0x223a75[_0x766c('0x33')]);return db[_0x766c('0x20')][_0x766c('0x34')](_0x25b731)[_0x766c('0x19')](handleEntityNotFound(_0x6fd6e1,null))[_0x766c('0x19')](respondWithResult(_0x6fd6e1,null))[_0x766c('0x35')](handleError(_0x6fd6e1,null));};exports[_0x766c('0x36')]=function(_0x18deb3,_0x18b9b0){return db['FaxQueue'][_0x766c('0x36')](_0x18deb3['body'],{})[_0x766c('0x19')](function(_0x532e22){var _0x1e13ee=_0x18deb3[_0x766c('0x37')]['get']({'plain':!![]});if(!_0x1e13ee)throw new Error(_0x766c('0x38'));if(_0x1e13ee[_0x766c('0x39')]==='user'){var _0xdfbca7=_0x532e22['get']({'plain':!![]});var _0x4c9f0f='FaxQueues';return db[_0x766c('0x3a')]['find']({'where':{'name':_0x4c9f0f,'userProfileId':_0x1e13ee[_0x766c('0x3b')]},'raw':!![]})[_0x766c('0x19')](function(_0x3b8636){if(_0x3b8636&&_0x3b8636[_0x766c('0x3c')]===0x0){return db[_0x766c('0x1b')][_0x766c('0x36')]({'name':_0xdfbca7[_0x766c('0x1c')],'resourceId':_0xdfbca7['id'],'type':_0x3b8636[_0x766c('0x1c')],'sectionId':_0x3b8636['id']},{})[_0x766c('0x19')](function(){return _0x532e22;});}else{return _0x532e22;}})['catch'](function(_0x246348){logger[_0x766c('0x3d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x246348);throw _0x246348;});}return _0x532e22;})['then'](respondWithResult(_0x18b9b0,0xc9))['catch'](handleError(_0x18b9b0,null));};exports[_0x766c('0x3e')]=function(_0xe8d1d0,_0x537714){if(_0xe8d1d0[_0x766c('0x3f')]['id']){delete _0xe8d1d0[_0x766c('0x3f')]['id'];}return db['FaxQueue'][_0x766c('0x34')]({'where':{'id':_0xe8d1d0[_0x766c('0x40')]['id']}})['then'](handleEntityNotFound(_0x537714,null))[_0x766c('0x19')](saveUpdates(_0xe8d1d0['body'],null))[_0x766c('0x19')](respondWithResult(_0x537714,null))[_0x766c('0x35')](handleError(_0x537714,null));};exports[_0x766c('0x1a')]=function(_0x1db546,_0x1e573c){return db['FaxQueue'][_0x766c('0x34')]({'where':{'id':_0x1db546[_0x766c('0x40')]['id']}})['then'](handleEntityNotFound(_0x1e573c,null))[_0x766c('0x19')](removeEntity(_0x1e573c,null))[_0x766c('0x35')](handleError(_0x1e573c,null));};exports['describe']=function(_0x48b7a9,_0x39d784){return db[_0x766c('0x20')][_0x766c('0x41')]()['then'](respondWithResult(_0x39d784,null))[_0x766c('0x35')](handleError(_0x39d784,null));};exports[_0x766c('0x42')]=function(_0x88732b,_0x539aa9){var _0x26f96c={'raw':!![],'where':{}},_0x29c771={},_0x529e5c;return db[_0x766c('0x20')][_0x766c('0x43')]({'where':{'id':_0x88732b[_0x766c('0x40')]['id']}})['then'](handleEntityNotFound(_0x539aa9,null))[_0x766c('0x19')](function(_0x5afc34){if(_0x5afc34){_0x529e5c=_0x5afc34['get']({'plain':!![]});_0x29c771['model']=_[_0x766c('0x29')](db[_0x766c('0x44')]['rawAttributes']);_0x29c771[_0x766c('0x2a')]=_[_0x766c('0x29')](_0x88732b[_0x766c('0x2a')]);_0x29c771['filters']=_[_0x766c('0x2c')](_0x29c771['model'],_0x29c771[_0x766c('0x2a')]);_0x26f96c[_0x766c('0x2e')]=_[_0x766c('0x2c')](_0x29c771[_0x766c('0x2d')],qs[_0x766c('0x2f')](_0x88732b[_0x766c('0x2a')][_0x766c('0x2f')]));_0x26f96c[_0x766c('0x2e')]=_0x26f96c[_0x766c('0x2e')]['length']?_0x26f96c[_0x766c('0x2e')]:_0x29c771[_0x766c('0x2d')];if(!_0x88732b[_0x766c('0x2a')][_0x766c('0x45')](_0x766c('0x46'))){_0x26f96c['limit']=qs['limit'](_0x88732b[_0x766c('0x2a')]['limit']);_0x26f96c[_0x766c('0x13')]=qs[_0x766c('0x13')](_0x88732b['query'][_0x766c('0x13')]);}_0x26f96c[_0x766c('0x47')]=qs[_0x766c('0x48')](_0x88732b[_0x766c('0x2a')]['sort']);_0x26f96c[_0x766c('0x49')]=qs[_0x766c('0x2b')](_[_0x766c('0x4a')](_0x88732b[_0x766c('0x2a')],_0x29c771[_0x766c('0x2b')]));_0x26f96c[_0x766c('0x49')][_0x766c('0x4b')]=_0x5afc34['id'];if(_0x88732b[_0x766c('0x2a')][_0x766c('0x4c')]){_0x26f96c[_0x766c('0x49')]=_[_0x766c('0x32')](_0x26f96c['where'],{'$or':_[_0x766c('0x1f')](_0x26f96c[_0x766c('0x2e')],function(_0x3215fb){var _0x547f0a={};_0x547f0a[_0x3215fb]={'$like':'%'+_0x88732b['query'][_0x766c('0x4c')]+'%'};return _0x547f0a;})});}_0x26f96c=_[_0x766c('0x32')]({},_0x26f96c,_0x88732b['options']);return db[_0x766c('0x44')][_0x766c('0x4d')](_0x26f96c);}})[_0x766c('0x19')](function(_0x85a31d){if(_0x85a31d){return db[_0x766c('0x4e')][_0x766c('0x4f')]({'where':{'id':_[_0x766c('0x1f')](_0x85a31d,'UserId'),'role':_0x766c('0x50')},'attributes':['id',_0x766c('0x1c'),_0x766c('0x51'),'updatedAt',_0x766c('0x52')]});}})[_0x766c('0x19')](function(_0x365bfc){if(_0x365bfc){return{'count':_0x365bfc[_0x766c('0x16')],'rows':_['map'](_0x365bfc[_0x766c('0x27')],function(_0x1d291c){return{'membername':_0x1d291c[_0x766c('0x1c')],'UserId':_0x1d291c['id'],'queue_name':_0x529e5c[_0x766c('0x1c')],'FaxQueueId':_0x529e5c['id'],'interface':util[_0x766c('0x53')]('%s/%s',_0x766c('0x54'),_0x1d291c[_0x766c('0x1c')]),'penalty':0x0,'paused':_0x1d291c[_0x766c('0x51')],'createdAt':_0x1d291c['createdAt'],'updatedAt':_0x1d291c[_0x766c('0x55')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x766c('0x19')](respondWithFilteredResult(_0x539aa9,_0x26f96c))[_0x766c('0x35')](handleError(_0x539aa9,null));};exports[_0x766c('0x56')]=function(_0x701a17,_0x16345b){var _0x56c8ed={};var _0x45fdf0={};var _0x3d19d0;var _0x4ed1da;return db[_0x766c('0x20')]['findOne']({'where':{'id':_0x701a17[_0x766c('0x40')]['id']}})[_0x766c('0x19')](handleEntityNotFound(_0x16345b,null))[_0x766c('0x19')](function(_0x4d3e45){if(_0x4d3e45){_0x3d19d0=_0x4d3e45;_0x45fdf0[_0x766c('0x2d')]=_[_0x766c('0x29')](db[_0x766c('0x57')][_0x766c('0x21')]);_0x45fdf0[_0x766c('0x2a')]=_['keys'](_0x701a17['query']);_0x45fdf0['filters']=_[_0x766c('0x2c')](_0x45fdf0[_0x766c('0x2d')],_0x45fdf0[_0x766c('0x2a')]);_0x56c8ed[_0x766c('0x2e')]=_[_0x766c('0x2c')](_0x45fdf0[_0x766c('0x2d')],qs['fields'](_0x701a17['query'][_0x766c('0x2f')]));_0x56c8ed[_0x766c('0x2e')]=_0x56c8ed['attributes'][_0x766c('0x30')]?_0x56c8ed[_0x766c('0x2e')]:_0x45fdf0['model'];_0x56c8ed['order']=qs[_0x766c('0x48')](_0x701a17[_0x766c('0x2a')][_0x766c('0x48')]);_0x56c8ed[_0x766c('0x49')]=qs['filters'](_[_0x766c('0x4a')](_0x701a17[_0x766c('0x2a')],_0x45fdf0[_0x766c('0x2b')]));if(_0x701a17[_0x766c('0x2a')]['filter']){_0x56c8ed['where']=_[_0x766c('0x32')](_0x56c8ed[_0x766c('0x49')],{'$or':_['map'](_0x56c8ed[_0x766c('0x2e')],function(_0x53a84a){var _0x3a7c4e={};_0x3a7c4e[_0x53a84a]={'$like':'%'+_0x701a17[_0x766c('0x2a')]['filter']+'%'};return _0x3a7c4e;})});}_0x56c8ed=_[_0x766c('0x32')]({},_0x56c8ed,_0x701a17[_0x766c('0x33')]);return _0x3d19d0[_0x766c('0x56')](_0x56c8ed);}})['then'](function(_0x43154b){if(_0x43154b){_0x4ed1da=_0x43154b['length'];if(!_0x701a17[_0x766c('0x2a')][_0x766c('0x45')](_0x766c('0x46'))){_0x56c8ed[_0x766c('0x15')]=qs['limit'](_0x701a17[_0x766c('0x2a')][_0x766c('0x15')]);_0x56c8ed[_0x766c('0x13')]=qs['offset'](_0x701a17[_0x766c('0x2a')][_0x766c('0x13')]);}return _0x3d19d0[_0x766c('0x56')](_0x56c8ed);}})['then'](function(_0x492286){if(_0x492286){return _0x492286?{'count':_0x4ed1da,'rows':_0x492286}:null;}})['then'](respondWithResult(_0x16345b,null))[_0x766c('0x35')](handleError(_0x16345b,null));};exports[_0x766c('0x58')]=function(_0x36632e,_0x4003e5){var _0x309751=_0x36632e['body'][_0x766c('0x59')];return db[_0x766c('0x57')]['findAll']({'where':{'id':_0x309751},'attributes':['id'],'include':[{'model':db[_0x766c('0x4e')],'as':_0x766c('0x5a'),'attributes':['id',_0x766c('0x1c'),_0x766c('0x5b'),_0x766c('0x5c'),'interface'],'raw':!![]}]})['then'](function(_0x5a5f8d){if(_0x5a5f8d){var _0x526c7c=_['flatMap'](_0x5a5f8d,function(_0x5a8203){var _0x3d6032=_0x5a8203[_0x766c('0x5d')]({'plain':!![]});return _0x3d6032[_0x766c('0x5a')];});return db['FaxQueue'][_0x766c('0x34')]({'where':{'id':_0x36632e[_0x766c('0x40')]['id']}})[_0x766c('0x19')](function(_0x3d9851){return db[_0x766c('0x5e')]['transaction'](function(_0x2f4792){return _0x3d9851[_0x766c('0x58')](_0x309751,{'transaction':_0x2f4792})[_0x766c('0x19')](function(){return BPromise[_0x766c('0x5f')](_0x526c7c,function(_0xc23b5e){return db['UserFaxQueue'][_0x766c('0x60')]({'where':{'UserId':_0xc23b5e['id'],'FaxQueueId':_0x36632e['params']['id']},'transaction':_0x2f4792});});})[_0x766c('0x19')](function(){_0x526c7c[_0x766c('0x61')](function(_0xdd0045){socket[_0x766c('0x62')](_0x766c('0x63'),{'UserId':_0xdd0045['id'],'FaxQueueId':_0x3d9851['id']});});});});});}})['then'](respondWithStatusCode(_0x4003e5,null))[_0x766c('0x35')](handleError(_0x4003e5,null));};exports['removeTeams']=function(_0x5c771,_0x48980a){return db[_0x766c('0x57')]['findAll']({'where':{'id':_0x5c771[_0x766c('0x2a')][_0x766c('0x59')]},'attributes':['id'],'include':[{'model':db[_0x766c('0x4e')],'as':_0x766c('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x766c('0x19')](handleEntityNotFound(_0x48980a,null))[_0x766c('0x19')](function(_0x47b4ab){var _0x1c03b7=_[_0x766c('0x1f')](_0x47b4ab,'id');var _0x266593=[];var _0x175abf=[];var _0x316d99=squel[_0x766c('0x64')]();_0x316d99[_0x766c('0x65')](_0x766c('0x66'))[_0x766c('0x67')]('team_has_fax_queues','tq')[_0x766c('0x68')](_0x766c('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x766c('0x49')](_0x766c('0x6a'),_0x5c771[_0x766c('0x40')]['id']);for(var _0x4b794c=0x0;_0x4b794c<_0x47b4ab[_0x766c('0x30')];_0x4b794c+=0x1){let _0x53af90=_0x47b4ab[_0x4b794c];for(var _0x21e4d1=0x0;_0x21e4d1<_0x53af90['Agents'][_0x766c('0x30')];_0x21e4d1+=0x1){let _0x467214=_0x53af90['Agents'][_0x21e4d1];var _0x13b9b=_0x316d99['clone']();_0x13b9b['where'](_0x766c('0x6b'),_0x467214['id']);_0x175abf[_0x766c('0x6c')](db[_0x766c('0x5e')][_0x766c('0x2a')](_0x13b9b[_0x766c('0x6d')](),{'type':db['sequelize'][_0x766c('0x6e')]['SELECT']})[_0x766c('0x19')](function(_0x3b3f04){if(_0x3b3f04['length']===0x1){return _0x467214['id'];}else{var _0x33c83c=_['every'](_[_0x766c('0x1f')](_0x3b3f04,_0x766c('0x6f')),function(_0x42ae7e){return _[_0x766c('0x70')](_0x1c03b7,_0x42ae7e);});if(_0x33c83c){return _0x467214['id'];}}}));}}return BPromise['all'](_0x175abf)[_0x766c('0x19')](function(_0x4c7c9f){_0x266593=_(_0x266593)[_0x766c('0x71')](_0x4c7c9f)[_0x766c('0x72')]()[_0x766c('0x73')]();return db['FaxQueue']['find']({'where':{'id':_0x5c771[_0x766c('0x40')]['id']}})[_0x766c('0x19')](function(_0x116c30){return db[_0x766c('0x5e')][_0x766c('0x74')](function(_0x560386){return _0x116c30[_0x766c('0x75')](_0x5c771[_0x766c('0x2a')][_0x766c('0x59')],{'transaction':_0x560386})[_0x766c('0x19')](function(){if(!_[_0x766c('0x76')](_0x266593)){return _0x116c30[_0x766c('0x77')](_0x266593,{'transaction':_0x560386});}})['then'](function(){_0x266593[_0x766c('0x61')](function(_0x3bc31){socket[_0x766c('0x62')](_0x766c('0x78'),{'UserId':_0x3bc31,'FaxQueueId':_0x116c30['id']});});});});});});})[_0x766c('0x19')](respondWithStatusCode(_0x48980a,null))[_0x766c('0x35')](handleError(_0x48980a,null));};exports[_0x766c('0x79')]=function(_0x20c72f,_0x102fff){return db[_0x766c('0x20')][_0x766c('0x34')]({'where':{'id':_0x20c72f[_0x766c('0x40')]['id']}})[_0x766c('0x19')](handleEntityNotFound(_0x102fff,null))['then'](function(_0x1b016e){if(_0x1b016e){return _0x1b016e[_0x766c('0x79')](_0x20c72f['body']['ids'],_[_0x766c('0x7a')](_0x20c72f[_0x766c('0x3f')],[_0x766c('0x59'),'id'])||{})[_0x766c('0x7b')](function(_0x2d3c1c){for(var _0x1f576f=0x0;_0x1f576f<_0x20c72f[_0x766c('0x3f')][_0x766c('0x59')][_0x766c('0x30')];_0x1f576f+=0x1){socket[_0x766c('0x62')](_0x766c('0x63'),{'UserId':Number(_0x20c72f[_0x766c('0x3f')][_0x766c('0x59')][_0x1f576f]),'FaxQueueId':Number(_0x20c72f[_0x766c('0x40')]['id'])});}return _0x2d3c1c;});}})[_0x766c('0x19')](respondWithResult(_0x102fff,null))['catch'](handleError(_0x102fff,null));};exports['removeAgents']=function(_0xca2042,_0xabcd0c){return db[_0x766c('0x20')]['find']({'where':{'id':_0xca2042['params']['id']}})['then'](handleEntityNotFound(_0xabcd0c,null))[_0x766c('0x19')](function(_0x1df434){if(_0x1df434){return _0x1df434[_0x766c('0x77')](_0xca2042[_0x766c('0x2a')][_0x766c('0x59')])['then'](function(){if(_[_0x766c('0x7c')](_0xca2042[_0x766c('0x2a')][_0x766c('0x59')])){for(var _0x6282db=0x0;_0x6282db<_0xca2042[_0x766c('0x2a')]['ids']['length'];_0x6282db+=0x1){socket[_0x766c('0x62')](_0x766c('0x78'),{'UserId':Number(_0xca2042['query'][_0x766c('0x59')][_0x6282db]),'FaxQueueId':Number(_0xca2042[_0x766c('0x40')]['id'])});}}else{socket[_0x766c('0x62')](_0x766c('0x78'),{'UserId':Number(_0xca2042[_0x766c('0x2a')][_0x766c('0x59')]),'FaxQueueId':Number(_0xca2042[_0x766c('0x40')]['id'])});}});}})[_0x766c('0x19')](respondWithStatusCode(_0xabcd0c,null))[_0x766c('0x35')](handleError(_0xabcd0c,null));};exports[_0x766c('0x7d')]=function(_0x4c4d13,_0x412a96){var _0x2f99a6={};var _0x4330c4={};var _0x19744a;var _0x4248be;return db['FaxQueue']['findOne']({'where':{'id':_0x4c4d13[_0x766c('0x40')]['id']}})[_0x766c('0x19')](handleEntityNotFound(_0x412a96,null))[_0x766c('0x19')](function(_0x386a49){if(_0x386a49){_0x19744a=_0x386a49;_0x4330c4[_0x766c('0x2d')]=_[_0x766c('0x29')](db['User'][_0x766c('0x21')]);_0x4330c4[_0x766c('0x2a')]=_[_0x766c('0x29')](_0x4c4d13[_0x766c('0x2a')]);_0x4330c4[_0x766c('0x2b')]=_[_0x766c('0x2c')](_0x4330c4['model'],_0x4330c4[_0x766c('0x2a')]);_0x2f99a6[_0x766c('0x2e')]=_[_0x766c('0x2c')](_0x4330c4['model'],qs[_0x766c('0x2f')](_0x4c4d13['query']['fields']));_0x2f99a6[_0x766c('0x2e')]=_0x2f99a6[_0x766c('0x2e')][_0x766c('0x30')]?_0x2f99a6[_0x766c('0x2e')]:_0x4330c4['model'];_0x2f99a6[_0x766c('0x47')]=qs['sort'](_0x4c4d13[_0x766c('0x2a')][_0x766c('0x48')]);_0x2f99a6[_0x766c('0x49')]=qs[_0x766c('0x2b')](_[_0x766c('0x4a')](_0x4c4d13[_0x766c('0x2a')],_0x4330c4[_0x766c('0x2b')]));if(_0x4c4d13['query'][_0x766c('0x4c')]){_0x2f99a6[_0x766c('0x49')]=_[_0x766c('0x32')](_0x2f99a6[_0x766c('0x49')],{'$or':_[_0x766c('0x1f')](_0x2f99a6['attributes'],function(_0x2fb40d){var _0x2713e1={};_0x2713e1[_0x2fb40d]={'$like':'%'+_0x4c4d13[_0x766c('0x2a')][_0x766c('0x4c')]+'%'};return _0x2713e1;})});}_0x2f99a6=_['merge']({},_0x2f99a6,_0x4c4d13[_0x766c('0x33')]);return _0x19744a['getAgents'](_0x2f99a6);}})[_0x766c('0x19')](function(_0x504b8f){if(_0x504b8f){_0x4248be=_0x504b8f[_0x766c('0x30')];if(!_0x4c4d13[_0x766c('0x2a')][_0x766c('0x45')](_0x766c('0x46'))){_0x2f99a6[_0x766c('0x15')]=qs[_0x766c('0x15')](_0x4c4d13['query'][_0x766c('0x15')]);_0x2f99a6[_0x766c('0x13')]=qs[_0x766c('0x13')](_0x4c4d13[_0x766c('0x2a')][_0x766c('0x13')]);}return _0x19744a[_0x766c('0x7d')](_0x2f99a6);}})[_0x766c('0x19')](function(_0x52f065){if(_0x52f065){return _0x52f065?{'count':_0x4248be,'rows':_0x52f065}:null;}})[_0x766c('0x19')](respondWithResult(_0x412a96,null))[_0x766c('0x35')](handleError(_0x412a96,null));}; \ No newline at end of file +var _0x31f0=['merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','describe','findOne','UserFaxQueue','nolimit','order','sort','pick','FaxQueueId','filter','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','union','transaction','removeAgents','userFaxQueue:remove','addAgents','omit','emit','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','FaxQueues','UserProfileResource','name','send','index','map','rawAttributes','type','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll'];(function(_0x147656,_0x205a15){var _0x37e1e9=function(_0xea78b){while(--_0xea78b){_0x147656['push'](_0x147656['shift']());}};_0x37e1e9(++_0x205a15);}(_0x31f0,0xb7));var _0x031f=function(_0x33f6db,_0x277e76){_0x33f6db=_0x33f6db-0x0;var _0x3bc6d0=_0x31f0[_0x33f6db];return _0x3bc6d0;};'use strict';var BPromise=require(_0x031f('0x0'));var util=require('util');var _=require(_0x031f('0x1'));var squel=require('squel');var Redis=require(_0x031f('0x2'));var qs=require(_0x031f('0x3'));var logger=require(_0x031f('0x4'))(_0x031f('0x5'));var config=require('../../config/environment');var db=require(_0x031f('0x6'))['db'];config[_0x031f('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x031f('0x8'))(new Redis(config['redis']));require(_0x031f('0x9'))[_0x031f('0xa')](socket);function respondWithStatusCode(_0x2569b6,_0x3e41ed){_0x3e41ed=_0x3e41ed||0xcc;return function(_0x4d47c5){if(_0x4d47c5){return _0x2569b6[_0x031f('0xb')](_0x3e41ed);}return _0x2569b6[_0x031f('0xc')](_0x3e41ed)[_0x031f('0xd')]();};}function respondWithResult(_0x439940,_0x3dd729){_0x3dd729=_0x3dd729||0xc8;return function(_0x3b0a17){if(_0x3b0a17){return _0x439940[_0x031f('0xc')](_0x3dd729)[_0x031f('0xe')](_0x3b0a17);}};}function respondWithFilteredResult(_0x4df318,_0x5c3657){return function(_0x353744){if(_0x353744){var _0x28da6e=typeof _0x5c3657[_0x031f('0xf')]===_0x031f('0x10')&&typeof _0x5c3657[_0x031f('0x11')]===_0x031f('0x10');var _0x5d0457=_0x353744[_0x031f('0x12')];var _0x23b40c=_0x28da6e?0x0:_0x5c3657[_0x031f('0xf')];var _0x2e3dfe=_0x28da6e?_0x353744[_0x031f('0x12')]:_0x5c3657['offset']+_0x5c3657['limit'];var _0x1f08db;if(_0x2e3dfe>=_0x5d0457){_0x2e3dfe=_0x5d0457;_0x1f08db=0xc8;}else{_0x1f08db=0xce;}_0x4df318[_0x031f('0xc')](_0x1f08db);return _0x4df318[_0x031f('0x13')](_0x031f('0x14'),_0x23b40c+'-'+_0x2e3dfe+'/'+_0x5d0457)['json'](_0x353744);}return null;};}function saveUpdates(_0x1dc4a7){return function(_0x1d8ac2){if(_0x1d8ac2){return _0x1d8ac2['update'](_0x1dc4a7)[_0x031f('0x15')](function(_0x535e70){return _0x535e70;});}return null;};}function removeEntity(_0x421f75){return function(_0x5f2199){if(_0x5f2199){return _0x5f2199[_0x031f('0x16')]()[_0x031f('0x15')](function(){var _0x1ceddc=_0x5f2199[_0x031f('0x17')]({'plain':!![]});var _0x1b76d6=_0x031f('0x18');return db[_0x031f('0x19')][_0x031f('0x16')]({'where':{'type':_0x1b76d6,'resourceId':_0x1ceddc['id']}})[_0x031f('0x15')](function(){return _0x5f2199;});})['then'](function(){_0x421f75[_0x031f('0xc')](0xcc)[_0x031f('0xd')]();});}};}function handleEntityNotFound(_0x451328){return function(_0x4d6706){if(!_0x4d6706){_0x451328['sendStatus'](0x194);}return _0x4d6706;};}function handleError(_0xa11a2b,_0x4d0f92){_0x4d0f92=_0x4d0f92||0x1f4;return function(_0x3472a2){logger['error'](_0x3472a2['stack']);if(_0x3472a2['name']){delete _0x3472a2[_0x031f('0x1a')];}_0xa11a2b[_0x031f('0xc')](_0x4d0f92)[_0x031f('0x1b')](_0x3472a2);};}exports[_0x031f('0x1c')]=function(_0x494568,_0x374b65){var _0x5a64c0={};var _0x40cb1c={'count':0x0,'rows':[]};var _0x1f5a14=_[_0x031f('0x1d')](db['FaxQueue'][_0x031f('0x1e')],function(_0x3b2a51){return{'name':_0x3b2a51['fieldName'],'type':_0x3b2a51[_0x031f('0x1f')][_0x031f('0x20')]};});_0x5a64c0=qs[_0x031f('0x21')](_0x1f5a14,_0x494568);var _0x5395ea={'where':_0x5a64c0[_0x031f('0x22')]};return db[_0x031f('0x23')][_0x031f('0x12')](_0x5395ea)[_0x031f('0x15')](function(_0xfaa36){_0x40cb1c[_0x031f('0x12')]=_0xfaa36;_0x5a64c0['include']=qs[_0x031f('0x24')](_0x494568[_0x031f('0x25')]);return db[_0x031f('0x23')][_0x031f('0x26')](_0x5a64c0);})[_0x031f('0x15')](function(_0x2d24f0){_0x40cb1c[_0x031f('0x27')]=_0x2d24f0;return _0x40cb1c;})[_0x031f('0x15')](respondWithFilteredResult(_0x374b65,_0x5a64c0))[_0x031f('0x28')](handleError(_0x374b65,null));};exports[_0x031f('0x29')]=function(_0x2cf3a8,_0x5ec564){var _0xced6ff={'raw':!![],'where':{'id':_0x2cf3a8[_0x031f('0x2a')]['id']}},_0xe5f11c={};_0xe5f11c[_0x031f('0x2b')]=_[_0x031f('0x2c')](db[_0x031f('0x23')][_0x031f('0x1e')]);_0xe5f11c[_0x031f('0x25')]=_[_0x031f('0x2c')](_0x2cf3a8[_0x031f('0x25')]);_0xe5f11c[_0x031f('0x2d')]=_[_0x031f('0x2e')](_0xe5f11c[_0x031f('0x2b')],_0xe5f11c['query']);_0xced6ff[_0x031f('0x2f')]=_[_0x031f('0x2e')](_0xe5f11c['model'],qs[_0x031f('0x30')](_0x2cf3a8[_0x031f('0x25')]['fields']));_0xced6ff[_0x031f('0x2f')]=_0xced6ff[_0x031f('0x2f')][_0x031f('0x31')]?_0xced6ff[_0x031f('0x2f')]:_0xe5f11c['model'];if(_0x2cf3a8['query'][_0x031f('0x32')]){_0xced6ff['include']=[{'all':!![]}];}_0xced6ff=_[_0x031f('0x33')]({},_0xced6ff,_0x2cf3a8[_0x031f('0x34')]);return db[_0x031f('0x23')]['find'](_0xced6ff)['then'](handleEntityNotFound(_0x5ec564,null))[_0x031f('0x15')](respondWithResult(_0x5ec564,null))['catch'](handleError(_0x5ec564,null));};exports['create']=function(_0x2d489a,_0x45e3a4){return db[_0x031f('0x23')][_0x031f('0x35')](_0x2d489a[_0x031f('0x36')],{})[_0x031f('0x15')](function(_0x1ffd03){var _0x55c85f=_0x2d489a[_0x031f('0x37')][_0x031f('0x17')]({'plain':!![]});if(!_0x55c85f)throw new Error(_0x031f('0x38'));if(_0x55c85f[_0x031f('0x39')]==='user'){var _0x2be5d1=_0x1ffd03[_0x031f('0x17')]({'plain':!![]});var _0x2dba8b='FaxQueues';return db[_0x031f('0x3a')][_0x031f('0x3b')]({'where':{'name':_0x2dba8b,'userProfileId':_0x55c85f['userProfileId']},'raw':!![]})[_0x031f('0x15')](function(_0x268dc7){if(_0x268dc7&&_0x268dc7['autoAssociation']===0x0){return db['UserProfileResource'][_0x031f('0x35')]({'name':_0x2be5d1[_0x031f('0x1a')],'resourceId':_0x2be5d1['id'],'type':_0x268dc7[_0x031f('0x1a')],'sectionId':_0x268dc7['id']},{})[_0x031f('0x15')](function(){return _0x1ffd03;});}else{return _0x1ffd03;}})[_0x031f('0x28')](function(_0xf0fb95){logger[_0x031f('0x3c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf0fb95);throw _0xf0fb95;});}return _0x1ffd03;})[_0x031f('0x15')](respondWithResult(_0x45e3a4,0xc9))[_0x031f('0x28')](handleError(_0x45e3a4,null));};exports['update']=function(_0x12279a,_0x505e93){if(_0x12279a[_0x031f('0x36')]['id']){delete _0x12279a[_0x031f('0x36')]['id'];}return db['FaxQueue'][_0x031f('0x3b')]({'where':{'id':_0x12279a[_0x031f('0x2a')]['id']}})[_0x031f('0x15')](handleEntityNotFound(_0x505e93,null))['then'](saveUpdates(_0x12279a[_0x031f('0x36')],null))[_0x031f('0x15')](respondWithResult(_0x505e93,null))[_0x031f('0x28')](handleError(_0x505e93,null));};exports[_0x031f('0x16')]=function(_0x177306,_0x193b8f){return db[_0x031f('0x23')][_0x031f('0x3b')]({'where':{'id':_0x177306[_0x031f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x193b8f,null))[_0x031f('0x15')](removeEntity(_0x193b8f,null))[_0x031f('0x28')](handleError(_0x193b8f,null));};exports[_0x031f('0x3d')]=function(_0x3205ce,_0xcf2072){return db[_0x031f('0x23')][_0x031f('0x3d')]()[_0x031f('0x15')](respondWithResult(_0xcf2072,null))[_0x031f('0x28')](handleError(_0xcf2072,null));};exports['getMembers']=function(_0x38539a,_0x5ec593){var _0x512937={'raw':!![],'where':{}},_0x434849={},_0x2359d1;return db[_0x031f('0x23')][_0x031f('0x3e')]({'where':{'id':_0x38539a[_0x031f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5ec593,null))[_0x031f('0x15')](function(_0x365f8c){if(_0x365f8c){_0x2359d1=_0x365f8c[_0x031f('0x17')]({'plain':!![]});_0x434849['model']=_[_0x031f('0x2c')](db[_0x031f('0x3f')][_0x031f('0x1e')]);_0x434849[_0x031f('0x25')]=_[_0x031f('0x2c')](_0x38539a[_0x031f('0x25')]);_0x434849['filters']=_['intersection'](_0x434849[_0x031f('0x2b')],_0x434849['query']);_0x512937[_0x031f('0x2f')]=_[_0x031f('0x2e')](_0x434849['model'],qs[_0x031f('0x30')](_0x38539a['query']['fields']));_0x512937[_0x031f('0x2f')]=_0x512937['attributes'][_0x031f('0x31')]?_0x512937['attributes']:_0x434849[_0x031f('0x2b')];if(!_0x38539a[_0x031f('0x25')]['hasOwnProperty'](_0x031f('0x40'))){_0x512937[_0x031f('0x11')]=qs['limit'](_0x38539a[_0x031f('0x25')]['limit']);_0x512937[_0x031f('0xf')]=qs['offset'](_0x38539a[_0x031f('0x25')][_0x031f('0xf')]);}_0x512937[_0x031f('0x41')]=qs[_0x031f('0x42')](_0x38539a[_0x031f('0x25')]['sort']);_0x512937[_0x031f('0x22')]=qs['filters'](_[_0x031f('0x43')](_0x38539a[_0x031f('0x25')],_0x434849['filters']));_0x512937[_0x031f('0x22')][_0x031f('0x44')]=_0x365f8c['id'];if(_0x38539a['query'][_0x031f('0x45')]){_0x512937[_0x031f('0x22')]=_[_0x031f('0x33')](_0x512937['where'],{'$or':_[_0x031f('0x1d')](_0x512937['attributes'],function(_0x254604){var _0x5a4aa4={};_0x5a4aa4[_0x254604]={'$like':'%'+_0x38539a[_0x031f('0x25')]['filter']+'%'};return _0x5a4aa4;})});}_0x512937=_[_0x031f('0x33')]({},_0x512937,_0x38539a[_0x031f('0x34')]);return db['UserFaxQueue']['findAll'](_0x512937);}})[_0x031f('0x15')](function(_0x10fa4c){if(_0x10fa4c){return db['User'][_0x031f('0x46')]({'where':{'id':_[_0x031f('0x1d')](_0x10fa4c,_0x031f('0x47')),'role':_0x031f('0x48')},'attributes':['id',_0x031f('0x1a'),_0x031f('0x49'),_0x031f('0x4a'),_0x031f('0x4b')]});}})['then'](function(_0xe452c2){if(_0xe452c2){return{'count':_0xe452c2[_0x031f('0x12')],'rows':_[_0x031f('0x1d')](_0xe452c2['rows'],function(_0x3937b7){return{'membername':_0x3937b7[_0x031f('0x1a')],'UserId':_0x3937b7['id'],'queue_name':_0x2359d1['name'],'FaxQueueId':_0x2359d1['id'],'interface':util[_0x031f('0x4c')](_0x031f('0x4d'),_0x031f('0x4e'),_0x3937b7[_0x031f('0x1a')]),'penalty':0x0,'paused':_0x3937b7['faxPause'],'createdAt':_0x3937b7['createdAt'],'updatedAt':_0x3937b7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5ec593,_0x512937))[_0x031f('0x28')](handleError(_0x5ec593,null));};exports[_0x031f('0x4f')]=function(_0x4a7fbb,_0x10531d){var _0x28f026={};var _0x508c4c={};var _0x110495;var _0x26ecb0;return db[_0x031f('0x23')][_0x031f('0x3e')]({'where':{'id':_0x4a7fbb[_0x031f('0x2a')]['id']}})[_0x031f('0x15')](handleEntityNotFound(_0x10531d,null))[_0x031f('0x15')](function(_0x4527e5){if(_0x4527e5){_0x110495=_0x4527e5;_0x508c4c[_0x031f('0x2b')]=_['keys'](db[_0x031f('0x50')]['rawAttributes']);_0x508c4c[_0x031f('0x25')]=_[_0x031f('0x2c')](_0x4a7fbb[_0x031f('0x25')]);_0x508c4c['filters']=_['intersection'](_0x508c4c[_0x031f('0x2b')],_0x508c4c[_0x031f('0x25')]);_0x28f026[_0x031f('0x2f')]=_[_0x031f('0x2e')](_0x508c4c['model'],qs[_0x031f('0x30')](_0x4a7fbb['query']['fields']));_0x28f026[_0x031f('0x2f')]=_0x28f026['attributes']['length']?_0x28f026[_0x031f('0x2f')]:_0x508c4c[_0x031f('0x2b')];_0x28f026[_0x031f('0x41')]=qs[_0x031f('0x42')](_0x4a7fbb[_0x031f('0x25')]['sort']);_0x28f026['where']=qs[_0x031f('0x2d')](_['pick'](_0x4a7fbb[_0x031f('0x25')],_0x508c4c[_0x031f('0x2d')]));if(_0x4a7fbb['query'][_0x031f('0x45')]){_0x28f026[_0x031f('0x22')]=_[_0x031f('0x33')](_0x28f026[_0x031f('0x22')],{'$or':_[_0x031f('0x1d')](_0x28f026[_0x031f('0x2f')],function(_0x5bea08){var _0x58f012={};_0x58f012[_0x5bea08]={'$like':'%'+_0x4a7fbb[_0x031f('0x25')][_0x031f('0x45')]+'%'};return _0x58f012;})});}_0x28f026=_[_0x031f('0x33')]({},_0x28f026,_0x4a7fbb[_0x031f('0x34')]);return _0x110495[_0x031f('0x4f')](_0x28f026);}})[_0x031f('0x15')](function(_0x3cfb21){if(_0x3cfb21){_0x26ecb0=_0x3cfb21['length'];if(!_0x4a7fbb['query']['hasOwnProperty']('nolimit')){_0x28f026[_0x031f('0x11')]=qs[_0x031f('0x11')](_0x4a7fbb[_0x031f('0x25')]['limit']);_0x28f026[_0x031f('0xf')]=qs[_0x031f('0xf')](_0x4a7fbb['query'][_0x031f('0xf')]);}return _0x110495[_0x031f('0x4f')](_0x28f026);}})[_0x031f('0x15')](function(_0x140ccd){if(_0x140ccd){return _0x140ccd?{'count':_0x26ecb0,'rows':_0x140ccd}:null;}})[_0x031f('0x15')](respondWithResult(_0x10531d,null))[_0x031f('0x28')](handleError(_0x10531d,null));};exports[_0x031f('0x51')]=function(_0x5ecbd6,_0x571d15){var _0x8a448f=_0x5ecbd6['body'][_0x031f('0x52')];return db['Team'][_0x031f('0x26')]({'where':{'id':_0x8a448f},'attributes':['id'],'include':[{'model':db[_0x031f('0x53')],'as':_0x031f('0x54'),'attributes':['id','name',_0x031f('0x55'),'voicePause',_0x031f('0x56')],'raw':!![]}]})[_0x031f('0x15')](function(_0x3efa82){if(_0x3efa82){var _0x4e7251=_[_0x031f('0x57')](_0x3efa82,function(_0x398e7c){var _0x3c4b09=_0x398e7c[_0x031f('0x17')]({'plain':!![]});return _0x3c4b09[_0x031f('0x54')];});return db['FaxQueue']['find']({'where':{'id':_0x5ecbd6[_0x031f('0x2a')]['id']}})[_0x031f('0x15')](function(_0x4bc4c7){return db[_0x031f('0x58')]['transaction'](function(_0x2dfff2){return _0x4bc4c7[_0x031f('0x51')](_0x8a448f,{'transaction':_0x2dfff2})[_0x031f('0x15')](function(){return BPromise[_0x031f('0x59')](_0x4e7251,function(_0x52bb92){return db[_0x031f('0x3f')][_0x031f('0x5a')]({'where':{'UserId':_0x52bb92['id'],'FaxQueueId':_0x5ecbd6[_0x031f('0x2a')]['id']},'transaction':_0x2dfff2});});})['then'](function(){_0x4e7251[_0x031f('0x5b')](function(_0xfda893){socket['emit'](_0x031f('0x5c'),{'UserId':_0xfda893['id'],'FaxQueueId':_0x4bc4c7['id']});});});});});}})[_0x031f('0x15')](respondWithStatusCode(_0x571d15,null))[_0x031f('0x28')](handleError(_0x571d15,null));};exports[_0x031f('0x5d')]=function(_0x104025,_0x38a8a4){return db[_0x031f('0x50')]['findAll']({'where':{'id':_0x104025[_0x031f('0x25')][_0x031f('0x52')]},'attributes':['id'],'include':[{'model':db[_0x031f('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x38a8a4,null))[_0x031f('0x15')](function(_0x5bd344){var _0x54f02d=_[_0x031f('0x1d')](_0x5bd344,'id');var _0x184bbd=[];var _0x1c8055=[];var _0x1d6aca=squel[_0x031f('0x5e')]();_0x1d6aca[_0x031f('0x5f')](_0x031f('0x60'))[_0x031f('0x61')](_0x031f('0x62'),'tq')[_0x031f('0x63')](_0x031f('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x031f('0x22')](_0x031f('0x65'),_0x104025[_0x031f('0x2a')]['id']);for(var _0x8290bf=0x0;_0x8290bf<_0x5bd344['length'];_0x8290bf+=0x1){let _0x6970f5=_0x5bd344[_0x8290bf];for(var _0x5329c2=0x0;_0x5329c2<_0x6970f5['Agents'][_0x031f('0x31')];_0x5329c2+=0x1){let _0x2f4d09=_0x6970f5['Agents'][_0x5329c2];var _0x510bb6=_0x1d6aca[_0x031f('0x66')]();_0x510bb6[_0x031f('0x22')](_0x031f('0x67'),_0x2f4d09['id']);_0x1c8055[_0x031f('0x68')](db[_0x031f('0x58')][_0x031f('0x25')](_0x510bb6['toString'](),{'type':db[_0x031f('0x58')][_0x031f('0x69')]['SELECT']})[_0x031f('0x15')](function(_0x2f2e96){if(_0x2f2e96[_0x031f('0x31')]===0x1){return _0x2f4d09['id'];}else{var _0x14fc7e=_[_0x031f('0x6a')](_[_0x031f('0x1d')](_0x2f2e96,_0x031f('0x6b')),function(_0x4e9157){return _[_0x031f('0x6c')](_0x54f02d,_0x4e9157);});if(_0x14fc7e){return _0x2f4d09['id'];}}}));}}return BPromise['all'](_0x1c8055)[_0x031f('0x15')](function(_0x1d5d61){_0x184bbd=_(_0x184bbd)[_0x031f('0x6d')](_0x1d5d61)['compact']()['value']();return db['FaxQueue'][_0x031f('0x3b')]({'where':{'id':_0x104025[_0x031f('0x2a')]['id']}})[_0x031f('0x15')](function(_0x2985fe){return db[_0x031f('0x58')][_0x031f('0x6e')](function(_0x232aa0){return _0x2985fe['removeTeams'](_0x104025['query'][_0x031f('0x52')],{'transaction':_0x232aa0})[_0x031f('0x15')](function(){if(!_['isEmpty'](_0x184bbd)){return _0x2985fe[_0x031f('0x6f')](_0x184bbd,{'transaction':_0x232aa0});}})['then'](function(){_0x184bbd[_0x031f('0x5b')](function(_0x20d85a){socket['emit'](_0x031f('0x70'),{'UserId':_0x20d85a,'FaxQueueId':_0x2985fe['id']});});});});});});})[_0x031f('0x15')](respondWithStatusCode(_0x38a8a4,null))['catch'](handleError(_0x38a8a4,null));};exports[_0x031f('0x71')]=function(_0x3c7dee,_0x1b588e){return db['FaxQueue'][_0x031f('0x3b')]({'where':{'id':_0x3c7dee[_0x031f('0x2a')]['id']}})[_0x031f('0x15')](handleEntityNotFound(_0x1b588e,null))[_0x031f('0x15')](function(_0x11165b){if(_0x11165b){return _0x11165b[_0x031f('0x71')](_0x3c7dee['body'][_0x031f('0x52')],_[_0x031f('0x72')](_0x3c7dee[_0x031f('0x36')],[_0x031f('0x52'),'id'])||{})['spread'](function(_0x33bf51){for(var _0x467a76=0x0;_0x467a76<_0x3c7dee['body'][_0x031f('0x52')][_0x031f('0x31')];_0x467a76+=0x1){socket[_0x031f('0x73')](_0x031f('0x5c'),{'UserId':Number(_0x3c7dee[_0x031f('0x36')][_0x031f('0x52')][_0x467a76]),'FaxQueueId':Number(_0x3c7dee[_0x031f('0x2a')]['id'])});}return _0x33bf51;});}})[_0x031f('0x15')](respondWithResult(_0x1b588e,null))[_0x031f('0x28')](handleError(_0x1b588e,null));};exports[_0x031f('0x6f')]=function(_0x16f7a0,_0x2b7347){return db[_0x031f('0x23')][_0x031f('0x3b')]({'where':{'id':_0x16f7a0[_0x031f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2b7347,null))[_0x031f('0x15')](function(_0x4368d6){if(_0x4368d6){return _0x4368d6[_0x031f('0x6f')](_0x16f7a0[_0x031f('0x25')][_0x031f('0x52')])[_0x031f('0x15')](function(){if(_['isArray'](_0x16f7a0['query']['ids'])){for(var _0x343acc=0x0;_0x343acc<_0x16f7a0[_0x031f('0x25')]['ids'][_0x031f('0x31')];_0x343acc+=0x1){socket[_0x031f('0x73')](_0x031f('0x70'),{'UserId':Number(_0x16f7a0[_0x031f('0x25')]['ids'][_0x343acc]),'FaxQueueId':Number(_0x16f7a0[_0x031f('0x2a')]['id'])});}}else{socket[_0x031f('0x73')](_0x031f('0x70'),{'UserId':Number(_0x16f7a0[_0x031f('0x25')][_0x031f('0x52')]),'FaxQueueId':Number(_0x16f7a0[_0x031f('0x2a')]['id'])});}});}})[_0x031f('0x15')](respondWithStatusCode(_0x2b7347,null))[_0x031f('0x28')](handleError(_0x2b7347,null));};exports[_0x031f('0x74')]=function(_0x3a798a,_0x3e3467){var _0x3eec5b={};var _0x4bd749={};var _0x2541fd;var _0x1f1f0e;return db['FaxQueue'][_0x031f('0x3e')]({'where':{'id':_0x3a798a[_0x031f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3e3467,null))[_0x031f('0x15')](function(_0x3bc88c){if(_0x3bc88c){_0x2541fd=_0x3bc88c;_0x4bd749[_0x031f('0x2b')]=_[_0x031f('0x2c')](db[_0x031f('0x53')][_0x031f('0x1e')]);_0x4bd749[_0x031f('0x25')]=_[_0x031f('0x2c')](_0x3a798a[_0x031f('0x25')]);_0x4bd749['filters']=_[_0x031f('0x2e')](_0x4bd749[_0x031f('0x2b')],_0x4bd749[_0x031f('0x25')]);_0x3eec5b['attributes']=_['intersection'](_0x4bd749[_0x031f('0x2b')],qs['fields'](_0x3a798a[_0x031f('0x25')][_0x031f('0x30')]));_0x3eec5b['attributes']=_0x3eec5b[_0x031f('0x2f')][_0x031f('0x31')]?_0x3eec5b[_0x031f('0x2f')]:_0x4bd749[_0x031f('0x2b')];_0x3eec5b[_0x031f('0x41')]=qs[_0x031f('0x42')](_0x3a798a[_0x031f('0x25')][_0x031f('0x42')]);_0x3eec5b[_0x031f('0x22')]=qs[_0x031f('0x2d')](_[_0x031f('0x43')](_0x3a798a[_0x031f('0x25')],_0x4bd749[_0x031f('0x2d')]));if(_0x3a798a['query']['filter']){_0x3eec5b[_0x031f('0x22')]=_['merge'](_0x3eec5b[_0x031f('0x22')],{'$or':_[_0x031f('0x1d')](_0x3eec5b[_0x031f('0x2f')],function(_0x513dfc){var _0x21f647={};_0x21f647[_0x513dfc]={'$like':'%'+_0x3a798a[_0x031f('0x25')]['filter']+'%'};return _0x21f647;})});}_0x3eec5b=_[_0x031f('0x33')]({},_0x3eec5b,_0x3a798a[_0x031f('0x34')]);return _0x2541fd[_0x031f('0x74')](_0x3eec5b);}})[_0x031f('0x15')](function(_0x348909){if(_0x348909){_0x1f1f0e=_0x348909[_0x031f('0x31')];if(!_0x3a798a[_0x031f('0x25')]['hasOwnProperty'](_0x031f('0x40'))){_0x3eec5b[_0x031f('0x11')]=qs[_0x031f('0x11')](_0x3a798a[_0x031f('0x25')]['limit']);_0x3eec5b['offset']=qs[_0x031f('0xf')](_0x3a798a['query']['offset']);}return _0x2541fd[_0x031f('0x74')](_0x3eec5b);}})['then'](function(_0x579ade){if(_0x579ade){return _0x579ade?{'count':_0x1f1f0e,'rows':_0x579ade}:null;}})[_0x031f('0x15')](respondWithResult(_0x3e3467,null))[_0x031f('0x28')](handleError(_0x3e3467,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e9eb765..10f042f 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 _0xad5a=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2c5042,_0x50fa14){var _0x36edcb=function(_0x31453f){while(--_0x31453f){_0x2c5042['push'](_0x2c5042['shift']());}};_0x36edcb(++_0x50fa14);}(_0xad5a,0x71));var _0xaad5=function(_0x35a961,_0x59aea6){_0x35a961=_0x35a961-0x0;var _0x5819d=_0xad5a[_0x35a961];return _0x5819d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xaad5('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xaad5('0x1')](0x0);var events={'afterCreate':_0xaad5('0x2'),'afterUpdate':_0xaad5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x71ffa8){return function(_0x5ad0af,_0x30a417,_0x413c80){FaxQueueEvents['emit'](_0x71ffa8+':'+_0x5ad0af['id'],_0x5ad0af);FaxQueueEvents[_0xaad5('0x4')](_0x71ffa8,_0x5ad0af);_0x413c80(null);};}for(var e in events){if(events[_0xaad5('0x5')](e)){var event=events[e];FaxQueue[_0xaad5('0x6')](e,emitEvent(event));}}module[_0xaad5('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xa1af=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xa1af,0x19d));var _0xfa1a=function(_0x449003,_0x1ea9c4){_0x449003=_0x449003-0x0;var _0x377bd8=_0xa1af[_0x449003];return _0x377bd8;};'use strict';var EventEmitter=require(_0xfa1a('0x0'));var FaxQueue=require(_0xfa1a('0x1'))['db'][_0xfa1a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa1a('0x3'),'afterDestroy':_0xfa1a('0x4')};function emitEvent(_0x1c73f6){return function(_0x4c3182,_0x1f11ed,_0xebf2b6){FaxQueueEvents[_0xfa1a('0x5')](_0x1c73f6+':'+_0x4c3182['id'],_0x4c3182);FaxQueueEvents[_0xfa1a('0x5')](_0x1c73f6,_0x4c3182);_0xebf2b6(null);};}for(var e in events){if(events[_0xfa1a('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xfa1a('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a3ce142..603608d 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 _0x4a38=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x4a38,0xb7));var _0x84a3=function(_0x2dd413,_0x572887){_0x2dd413=_0x2dd413-0x0;var _0x2ca759=_0x4a38[_0x2dd413];return _0x2ca759;};'use strict';var _=require(_0x84a3('0x0'));var util=require(_0x84a3('0x1'));var logger=require(_0x84a3('0x2'))('api');var moment=require(_0x84a3('0x3'));var BPromise=require(_0x84a3('0x4'));var rp=require(_0x84a3('0x5'));var fs=require('fs');var path=require(_0x84a3('0x6'));var rimraf=require(_0x84a3('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x84a3('0x8')]=function(_0x1bccc2,_0x728dee){return _0x1bccc2[_0x84a3('0x9')](_0x84a3('0xa'),attributes,{'tableName':_0x84a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x175e=['request-promise','rimraf','./faxQueue.attributes','define','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x43a317,_0x254632){var _0x131e67=function(_0x2182bc){while(--_0x2182bc){_0x43a317['push'](_0x43a317['shift']());}};_0x131e67(++_0x254632);}(_0x175e,0x87));var _0xe175=function(_0x1fbdd6,_0x21ad1f){_0x1fbdd6=_0x1fbdd6-0x0;var _0x8a8600=_0x175e[_0x1fbdd6];return _0x8a8600;};'use strict';var _=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));var logger=require(_0xe175('0x2'))(_0xe175('0x3'));var moment=require(_0xe175('0x4'));var BPromise=require('bluebird');var rp=require(_0xe175('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe175('0x6'));var config=require('../../config/environment');var attributes=require(_0xe175('0x7'));module['exports']=function(_0x403fb2,_0x3362da){return _0x403fb2[_0xe175('0x8')]('FaxQueue',attributes,{'tableName':_0xe175('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 0f598f7..92661d3 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 _0x8b26=['socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x398f3c,_0x36a5f7){var _0x576b50=function(_0x241331){while(--_0x241331){_0x398f3c['push'](_0x398f3c['shift']());}};_0x576b50(++_0x36a5f7);}(_0x8b26,0x150));var _0x68b2=function(_0x174283,_0x3fd836){_0x174283=_0x174283-0x0;var _0x139f1a=_0x8b26[_0x174283];return _0x139f1a;};'use strict';var _=require(_0x68b2('0x0'));var util=require(_0x68b2('0x1'));var moment=require(_0x68b2('0x2'));var BPromise=require(_0x68b2('0x3'));var rs=require(_0x68b2('0x4'));var fs=require('fs');var Redis=require(_0x68b2('0x5'));var db=require(_0x68b2('0x6'))['db'];var utils=require(_0x68b2('0x7'));var logger=require('../../config/logger')(_0x68b2('0x8'));var config=require(_0x68b2('0x9'));var jayson=require(_0x68b2('0xa'));var client=jayson['client'][_0x68b2('0xb')]({'port':0x232a});config[_0x68b2('0xc')]=_[_0x68b2('0xd')](config[_0x68b2('0xc')],{'host':_0x68b2('0xe'),'port':0x18eb});var socket=require(_0x68b2('0xf'))(new Redis(config[_0x68b2('0xc')]));require(_0x68b2('0x10'))['register'](socket);function respondWithRpcPromise(_0x3a97eb,_0x1d8dc6,_0x479cf9){return new BPromise(function(_0x2735d1,_0x3925b0){return client[_0x68b2('0x11')](_0x3a97eb,_0x479cf9)['then'](function(_0x4379e6){logger[_0x68b2('0x12')](_0x68b2('0x13'),_0x1d8dc6,_0x68b2('0x14'));logger[_0x68b2('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1d8dc6,'request\x20sent',JSON[_0x68b2('0x16')](_0x4379e6));if(_0x4379e6[_0x68b2('0x17')]){if(_0x4379e6[_0x68b2('0x17')]['code']===0x1f4){logger['error'](_0x68b2('0x13'),_0x1d8dc6,_0x4379e6[_0x68b2('0x17')][_0x68b2('0x18')]);return _0x3925b0(_0x4379e6['error'][_0x68b2('0x18')]);}logger[_0x68b2('0x17')](_0x68b2('0x13'),_0x1d8dc6,_0x4379e6[_0x68b2('0x17')]['message']);return _0x2735d1(_0x4379e6['error'][_0x68b2('0x18')]);}else{logger[_0x68b2('0x12')]('FaxQueue,\x20%s,\x20%s',_0x1d8dc6,_0x68b2('0x14'));_0x2735d1(_0x4379e6['result'][_0x68b2('0x18')]);}})[_0x68b2('0x19')](function(_0x5a99fb){logger[_0x68b2('0x17')](_0x68b2('0x13'),_0x1d8dc6,_0x5a99fb);_0x3925b0(_0x5a99fb);});});}exports[_0x68b2('0x1a')]=function(_0x2ddb54){var _0x1ff84b=this;return new Promise(function(_0x5a911f,_0x182f06){return db[_0x68b2('0x1b')][_0x68b2('0x1c')]({'raw':_0x2ddb54[_0x68b2('0x1d')]?_0x2ddb54[_0x68b2('0x1d')][_0x68b2('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ddb54[_0x68b2('0x1d')]?_0x2ddb54[_0x68b2('0x1d')][_0x68b2('0x1f')]||null:null,'attributes':_0x2ddb54['options']?_0x2ddb54[_0x68b2('0x1d')][_0x68b2('0x20')]||null:null,'limit':_0x2ddb54[_0x68b2('0x1d')]?_0x2ddb54['options'][_0x68b2('0x21')]||null:null,'include':_0x2ddb54[_0x68b2('0x1d')]?_0x2ddb54[_0x68b2('0x1d')]['include']?_[_0x68b2('0x22')](_0x2ddb54[_0x68b2('0x1d')]['include'],function(_0x25e164){return{'model':db[_0x25e164['model']],'as':_0x25e164['as'],'attributes':_0x25e164[_0x68b2('0x20')],'include':_0x25e164[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0x25e164[_0x68b2('0x23')],function(_0x5d5c03){return{'model':db[_0x5d5c03['model']],'as':_0x5d5c03['as'],'attributes':_0x5d5c03['attributes'],'include':_0x5d5c03[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0x5d5c03[_0x68b2('0x23')],function(_0x20709e){return{'model':db[_0x20709e[_0x68b2('0x24')]],'as':_0x20709e['as'],'attributes':_0x20709e[_0x68b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x68b2('0x25')](function(_0x2b8511){logger[_0x68b2('0x12')]('GetFaxQueue',_0x2ddb54);logger[_0x68b2('0x15')](_0x68b2('0x1a'),_0x2ddb54,JSON['stringify'](_0x2b8511));_0x5a911f(_0x2b8511);})[_0x68b2('0x19')](function(_0x2a32c6){logger[_0x68b2('0x17')]('GetFaxQueue',_0x2a32c6[_0x68b2('0x18')],_0x2ddb54);_0x182f06(_0x1ff84b[_0x68b2('0x17')](0x1f4,_0x2a32c6[_0x68b2('0x18')]));});});};exports[_0x68b2('0x26')]=function(_0x4e6e94){var _0x1bb30d=this;return new Promise(function(_0x9bd5ba,_0x215d9b){return db[_0x68b2('0x1b')]['find']({'raw':_0x4e6e94[_0x68b2('0x1d')]?_0x4e6e94[_0x68b2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4e6e94[_0x68b2('0x1d')]?_0x4e6e94['options'][_0x68b2('0x1f')]||null:null,'attributes':_0x4e6e94[_0x68b2('0x1d')]?_0x4e6e94[_0x68b2('0x1d')][_0x68b2('0x20')]||null:null,'include':_0x4e6e94[_0x68b2('0x1d')]?_0x4e6e94[_0x68b2('0x1d')][_0x68b2('0x23')]?_['map'](_0x4e6e94[_0x68b2('0x1d')][_0x68b2('0x23')],function(_0x5cdf3c){return{'model':db[_0x5cdf3c[_0x68b2('0x24')]],'as':_0x5cdf3c['as'],'attributes':_0x5cdf3c[_0x68b2('0x20')],'include':_0x5cdf3c[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0x5cdf3c[_0x68b2('0x23')],function(_0xb26da){return{'model':db[_0xb26da[_0x68b2('0x24')]],'as':_0xb26da['as'],'attributes':_0xb26da[_0x68b2('0x20')],'include':_0xb26da[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0xb26da['include'],function(_0x43bdf6){return{'model':db[_0x43bdf6['model']],'as':_0x43bdf6['as'],'attributes':_0x43bdf6[_0x68b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x68b2('0x25')](function(_0x35bc7c){logger[_0x68b2('0x12')](_0x68b2('0x26'),_0x4e6e94);logger[_0x68b2('0x15')](_0x68b2('0x26'),_0x4e6e94,JSON[_0x68b2('0x16')](_0x35bc7c));_0x9bd5ba(_0x35bc7c);})[_0x68b2('0x19')](function(_0x5ed710){logger['error'](_0x68b2('0x26'),_0x5ed710[_0x68b2('0x18')],_0x4e6e94);_0x215d9b(_0x1bb30d[_0x68b2('0x17')](0x1f4,_0x5ed710['message']));});});}; \ No newline at end of file +var _0xc9c5=['FaxQueue,\x20%s,\x20%s','message','request\x20sent','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowFaxQueue','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','register','request','then','info','debug','error'];(function(_0x1efc33,_0x4e62f5){var _0x57e74a=function(_0x4d0685){while(--_0x4d0685){_0x1efc33['push'](_0x1efc33['shift']());}};_0x57e74a(++_0x4e62f5);}(_0xc9c5,0x199));var _0x5c9c=function(_0x1fe559,_0x25fba7){_0x1fe559=_0x1fe559-0x0;var _0xb5b18c=_0xc9c5[_0x1fe559];return _0xb5b18c;};'use strict';var _=require(_0x5c9c('0x0'));var util=require(_0x5c9c('0x1'));var moment=require(_0x5c9c('0x2'));var BPromise=require(_0x5c9c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c9c('0x4'));var db=require(_0x5c9c('0x5'))['db'];var utils=require(_0x5c9c('0x6'));var logger=require(_0x5c9c('0x7'))(_0x5c9c('0x8'));var config=require('../../config/environment');var jayson=require(_0x5c9c('0x9'));var client=jayson['client'][_0x5c9c('0xa')]({'port':0x232a});config['redis']=_[_0x5c9c('0xb')](config[_0x5c9c('0xc')],{'host':_0x5c9c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c9c('0xc')]));require('./faxQueue.socket')[_0x5c9c('0xe')](socket);function respondWithRpcPromise(_0x195b34,_0x41ad01,_0x19b0c0){return new BPromise(function(_0x465cb3,_0x3abd4e){return client[_0x5c9c('0xf')](_0x195b34,_0x19b0c0)[_0x5c9c('0x10')](function(_0x57dd7e){logger[_0x5c9c('0x11')]('FaxQueue,\x20%s,\x20%s',_0x41ad01,'request\x20sent');logger[_0x5c9c('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x41ad01,'request\x20sent',JSON['stringify'](_0x57dd7e));if(_0x57dd7e[_0x5c9c('0x13')]){if(_0x57dd7e[_0x5c9c('0x13')]['code']===0x1f4){logger[_0x5c9c('0x13')](_0x5c9c('0x14'),_0x41ad01,_0x57dd7e[_0x5c9c('0x13')][_0x5c9c('0x15')]);return _0x3abd4e(_0x57dd7e['error'][_0x5c9c('0x15')]);}logger[_0x5c9c('0x13')](_0x5c9c('0x14'),_0x41ad01,_0x57dd7e[_0x5c9c('0x13')][_0x5c9c('0x15')]);return _0x465cb3(_0x57dd7e[_0x5c9c('0x13')][_0x5c9c('0x15')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x41ad01,_0x5c9c('0x16'));_0x465cb3(_0x57dd7e[_0x5c9c('0x17')][_0x5c9c('0x15')]);}})['catch'](function(_0x40b30d){logger[_0x5c9c('0x13')](_0x5c9c('0x14'),_0x41ad01,_0x40b30d);_0x3abd4e(_0x40b30d);});});}exports[_0x5c9c('0x18')]=function(_0x11be35){var _0x4d7247=this;return new Promise(function(_0x4dadec,_0x3ddf52){return db[_0x5c9c('0x19')][_0x5c9c('0x1a')]({'raw':_0x11be35['options']?_0x11be35[_0x5c9c('0x1b')][_0x5c9c('0x1c')]===undefined?!![]:![]:!![],'where':_0x11be35[_0x5c9c('0x1b')]?_0x11be35[_0x5c9c('0x1b')][_0x5c9c('0x1d')]||null:null,'attributes':_0x11be35[_0x5c9c('0x1b')]?_0x11be35['options'][_0x5c9c('0x1e')]||null:null,'limit':_0x11be35[_0x5c9c('0x1b')]?_0x11be35['options'][_0x5c9c('0x1f')]||null:null,'include':_0x11be35['options']?_0x11be35[_0x5c9c('0x1b')][_0x5c9c('0x20')]?_['map'](_0x11be35['options'][_0x5c9c('0x20')],function(_0x485eb2){return{'model':db[_0x485eb2[_0x5c9c('0x21')]],'as':_0x485eb2['as'],'attributes':_0x485eb2[_0x5c9c('0x1e')],'include':_0x485eb2[_0x5c9c('0x20')]?_['map'](_0x485eb2[_0x5c9c('0x20')],function(_0x91bef9){return{'model':db[_0x91bef9[_0x5c9c('0x21')]],'as':_0x91bef9['as'],'attributes':_0x91bef9['attributes'],'include':_0x91bef9[_0x5c9c('0x20')]?_[_0x5c9c('0x22')](_0x91bef9[_0x5c9c('0x20')],function(_0x215990){return{'model':db[_0x215990[_0x5c9c('0x21')]],'as':_0x215990['as'],'attributes':_0x215990[_0x5c9c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5c9c('0x10')](function(_0x1369b4){logger[_0x5c9c('0x11')](_0x5c9c('0x18'),_0x11be35);logger[_0x5c9c('0x12')](_0x5c9c('0x18'),_0x11be35,JSON['stringify'](_0x1369b4));_0x4dadec(_0x1369b4);})[_0x5c9c('0x23')](function(_0x1d24f4){logger['error'](_0x5c9c('0x18'),_0x1d24f4[_0x5c9c('0x15')],_0x11be35);_0x3ddf52(_0x4d7247[_0x5c9c('0x13')](0x1f4,_0x1d24f4['message']));});});};exports[_0x5c9c('0x24')]=function(_0x3b12b5){var _0x208312=this;return new Promise(function(_0xb000ae,_0x3b6575){return db[_0x5c9c('0x19')][_0x5c9c('0x25')]({'raw':_0x3b12b5[_0x5c9c('0x1b')]?_0x3b12b5[_0x5c9c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3b12b5[_0x5c9c('0x1b')]?_0x3b12b5[_0x5c9c('0x1b')][_0x5c9c('0x1d')]||null:null,'attributes':_0x3b12b5[_0x5c9c('0x1b')]?_0x3b12b5['options'][_0x5c9c('0x1e')]||null:null,'include':_0x3b12b5['options']?_0x3b12b5[_0x5c9c('0x1b')][_0x5c9c('0x20')]?_[_0x5c9c('0x22')](_0x3b12b5[_0x5c9c('0x1b')]['include'],function(_0x1bd4ec){return{'model':db[_0x1bd4ec['model']],'as':_0x1bd4ec['as'],'attributes':_0x1bd4ec[_0x5c9c('0x1e')],'include':_0x1bd4ec[_0x5c9c('0x20')]?_['map'](_0x1bd4ec[_0x5c9c('0x20')],function(_0x2bbc73){return{'model':db[_0x2bbc73[_0x5c9c('0x21')]],'as':_0x2bbc73['as'],'attributes':_0x2bbc73[_0x5c9c('0x1e')],'include':_0x2bbc73[_0x5c9c('0x20')]?_[_0x5c9c('0x22')](_0x2bbc73[_0x5c9c('0x20')],function(_0x3deb2d){return{'model':db[_0x3deb2d[_0x5c9c('0x21')]],'as':_0x3deb2d['as'],'attributes':_0x3deb2d[_0x5c9c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a6cc7){logger[_0x5c9c('0x11')](_0x5c9c('0x24'),_0x3b12b5);logger['debug'](_0x5c9c('0x24'),_0x3b12b5,JSON[_0x5c9c('0x26')](_0x5a6cc7));_0xb000ae(_0x5a6cc7);})[_0x5c9c('0x23')](function(_0x20470b){logger[_0x5c9c('0x13')]('ShowFaxQueue',_0x20470b[_0x5c9c('0x15')],_0x3b12b5);_0x3b6575(_0x208312[_0x5c9c('0x13')](0x1f4,_0x20470b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 099f649..a4b0f4c 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 _0x3bcf=['update','emit','removeListener','length','./faxQueue.events','save','remove'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x3bcf,0xdd));var _0xf3bc=function(_0x191a35,_0x2140be){_0x191a35=_0x191a35-0x0;var _0x1220f3=_0x3bcf[_0x191a35];return _0x1220f3;};'use strict';var FaxQueueEvents=require(_0xf3bc('0x0'));var events=[_0xf3bc('0x1'),_0xf3bc('0x2'),_0xf3bc('0x3')];function createListener(_0x13021e,_0x3a7b98){return function(_0x47c1d5){_0x3a7b98[_0xf3bc('0x4')](_0x13021e,_0x47c1d5);};}function removeListener(_0x412e93,_0x31d88a){return function(){FaxQueueEvents[_0xf3bc('0x5')](_0x412e93,_0x31d88a);};}exports['register']=function(_0x403472){for(var _0x3456d0=0x0,_0x37bae7=events[_0xf3bc('0x6')];_0x3456d0<_0x37bae7;_0x3456d0++){var _0x137de6=events[_0x3456d0];var _0x26960c=createListener('faxQueue:'+_0x137de6,_0x403472);FaxQueueEvents['on'](_0x137de6,_0x26960c);}}; \ No newline at end of file +var _0x1b4d=['removeListener','length','faxQueue:','./faxQueue.events','remove','emit'];(function(_0x2189c3,_0x2b23ef){var _0x3ef4da=function(_0x3c466f){while(--_0x3c466f){_0x2189c3['push'](_0x2189c3['shift']());}};_0x3ef4da(++_0x2b23ef);}(_0x1b4d,0x123));var _0xd1b4=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x1b4d[_0xa1e3e3];return _0xc980e9;};'use strict';var FaxQueueEvents=require(_0xd1b4('0x0'));var events=['save',_0xd1b4('0x1'),'update'];function createListener(_0x2e3a12,_0x431ab2){return function(_0x6c62d0){_0x431ab2[_0xd1b4('0x2')](_0x2e3a12,_0x6c62d0);};}function removeListener(_0x3b1162,_0x2d0ea6){return function(){FaxQueueEvents[_0xd1b4('0x3')](_0x3b1162,_0x2d0ea6);};}exports['register']=function(_0x546831){for(var _0xec1660=0x0,_0x1144b8=events[_0xd1b4('0x4')];_0xec1660<_0x1144b8;_0xec1660++){var _0x2f5359=events[_0xec1660];var _0x5e4937=createListener(_0xd1b4('0x5')+_0x2f5359,_0x546831);FaxQueueEvents['on'](_0x2f5359,_0x5e4937);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ee90118..49aa7d9 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 _0xc2c7=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1ecb71,_0x370253){var _0x402229=function(_0x25796a){while(--_0x25796a){_0x1ecb71['push'](_0x1ecb71['shift']());}};_0x402229(++_0x370253);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3e76f0,_0x41414c){_0x3e76f0=_0x3e76f0-0x0;var _0x188517=_0xc2c7[_0x3e76f0];return _0x188517;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x14')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x14')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7c2c('0x14')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['addAgents']);router[_0x7c2c('0x16')](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['delete'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x19')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1a')]);router[_0x7c2c('0x19')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1b')]);module[_0x7c2c('0x1c')]=router; \ No newline at end of file +var _0xfc65=['/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','update','destroy','delete','removeAgents','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index'];(function(_0x299ddf,_0x1db895){var _0xc713fa=function(_0x3e6e3b){while(--_0x3e6e3b){_0x299ddf['push'](_0x299ddf['shift']());}};_0xc713fa(++_0x1db895);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x10b5be,_0x22d5f6){_0x10b5be=_0x10b5be-0x0;var _0x1d67e3=_0xfc65[_0x10b5be];return _0x1d67e3;};'use strict';var multer=require(_0x5fc6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5fc6('0x1'));var express=require(_0x5fc6('0x2'));var router=express[_0x5fc6('0x3')]();var fs_extra=require(_0x5fc6('0x4'));var auth=require(_0x5fc6('0x5'));var interaction=require(_0x5fc6('0x6'));var config=require(_0x5fc6('0x7'));var controller=require(_0x5fc6('0x8'));router[_0x5fc6('0x9')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xb')]);router[_0x5fc6('0x9')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller[_0x5fc6('0xd')]);router[_0x5fc6('0x9')](_0x5fc6('0xe'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xf')]);router[_0x5fc6('0x9')](_0x5fc6('0x10'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x11')]);router[_0x5fc6('0x9')]('/:id/teams',auth[_0x5fc6('0xa')](),controller['getTeams']);router[_0x5fc6('0x9')](_0x5fc6('0x12'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x13')]);router['post']('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x14')]);router[_0x5fc6('0x15')](_0x5fc6('0x16'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x17')]);router[_0x5fc6('0x15')](_0x5fc6('0x12'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x18')]);router['put']('/:id',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x19')]);router['delete'](_0x5fc6('0xe'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x1a')]);router[_0x5fc6('0x1b')](_0x5fc6('0x16'),auth[_0x5fc6('0xa')](),controller['removeTeams']);router[_0x5fc6('0x1b')](_0x5fc6('0x12'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index e022f57..19a3479 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 _0x088d=['sequelize','exports','STRING','DATE','moment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x088d,0xa9));var _0xd088=function(_0x388f42,_0x42bd67){_0x388f42=_0x388f42-0x0;var _0x563058=_0x088d[_0x388f42];return _0x563058;};'use strict';var moment=require(_0xd088('0x0'));var Sequelize=require(_0xd088('0x1'));module[_0xd088('0x2')]={'uniqueid':{'type':Sequelize[_0xd088('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd088('0x3')]},'joinAt':{'type':Sequelize[_0xd088('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd088('0x4')]},'exitAt':{'type':Sequelize[_0xd088('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb072=['DATE','moment','sequelize','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb072,0x1cd));var _0x2b07=function(_0x768f7c,_0x5dd444){_0x768f7c=_0x768f7c-0x0;var _0x5292f8=_0xb072[_0x768f7c];return _0x5292f8;};'use strict';var moment=require(_0x2b07('0x0'));var Sequelize=require(_0x2b07('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2b07('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2b07('0x2')]},'joinAt':{'type':Sequelize[_0x2b07('0x3')]},'leaveAt':{'type':Sequelize[_0x2b07('0x3')]},'acceptAt':{'type':Sequelize[_0x2b07('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2b07('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 66e92fa..95b2518 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 _0x1306=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1306,0x17a));var _0x6130=function(_0x372960,_0x7e7203){_0x372960=_0x372960-0x0;var _0x34142c=_0x1306[_0x372960];return _0x34142c;};'use strict';var emlformat=require(_0x6130('0x0'));var rimraf=require(_0x6130('0x1'));var zipdir=require(_0x6130('0x2'));var jsonpatch=require(_0x6130('0x3'));var rp=require(_0x6130('0x4'));var moment=require(_0x6130('0x5'));var BPromise=require(_0x6130('0x6'));var Mustache=require(_0x6130('0x7'));var util=require(_0x6130('0x8'));var path=require(_0x6130('0x9'));var sox=require(_0x6130('0xa'));var csv=require(_0x6130('0xb'));var ejs=require(_0x6130('0xc'));var fs=require('fs');var fs_extra=require(_0x6130('0xd'));var _=require(_0x6130('0xe'));var squel=require(_0x6130('0xf'));var crypto=require(_0x6130('0x10'));var jsforce=require(_0x6130('0x11'));var deskjs=require(_0x6130('0x12'));var toCsv=require(_0x6130('0xb'));var querystring=require(_0x6130('0x13'));var Papa=require(_0x6130('0x14'));var Redis=require(_0x6130('0x15'));var authService=require(_0x6130('0x16'));var qs=require(_0x6130('0x17'));var as=require(_0x6130('0x18'));var hardwareService=require(_0x6130('0x19'));var logger=require(_0x6130('0x1a'))(_0x6130('0x1b'));var utils=require('../../config/utils');var config=require(_0x6130('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x6130('0x1d'))['db'];function respondWithStatusCode(_0x2fbf3d,_0x5e0234){_0x5e0234=_0x5e0234||0xcc;return function(_0x1c0339){if(_0x1c0339){return _0x2fbf3d[_0x6130('0x1e')](_0x5e0234);}return _0x2fbf3d[_0x6130('0x1f')](_0x5e0234)[_0x6130('0x20')]();};}function respondWithResult(_0x1d736c,_0x3470e8){_0x3470e8=_0x3470e8||0xc8;return function(_0x4cdac6){if(_0x4cdac6){return _0x1d736c[_0x6130('0x1f')](_0x3470e8)[_0x6130('0x21')](_0x4cdac6);}};}function respondWithFilteredResult(_0x3ef4c1,_0x401a70){return function(_0x4626a2){if(_0x4626a2){var _0x39b444=typeof _0x401a70[_0x6130('0x22')]===_0x6130('0x23')&&typeof _0x401a70[_0x6130('0x24')]==='undefined';var _0x4b9a20=_0x4626a2[_0x6130('0x25')];var _0x49803e=_0x39b444?0x0:_0x401a70[_0x6130('0x22')];var _0xb6575d=_0x39b444?_0x4626a2[_0x6130('0x25')]:_0x401a70[_0x6130('0x22')]+_0x401a70[_0x6130('0x24')];var _0x4b4b35;if(_0xb6575d>=_0x4b9a20){_0xb6575d=_0x4b9a20;_0x4b4b35=0xc8;}else{_0x4b4b35=0xce;}_0x3ef4c1[_0x6130('0x1f')](_0x4b4b35);return _0x3ef4c1['set'](_0x6130('0x26'),_0x49803e+'-'+_0xb6575d+'/'+_0x4b9a20)[_0x6130('0x21')](_0x4626a2);}return null;};}function patchUpdates(_0x18bb78){return function(_0x1839db){try{jsonpatch[_0x6130('0x27')](_0x1839db,_0x18bb78,!![]);}catch(_0x5c8b08){return BPromise['reject'](_0x5c8b08);}return _0x1839db[_0x6130('0x28')]();};}function saveUpdates(_0x534390,_0x30b4f2){return function(_0x289c7b){if(_0x289c7b){return _0x289c7b['update'](_0x534390)['then'](function(_0x54fc67){return _0x54fc67;});}return null;};}function removeEntity(_0x2a8aad,_0x5369e3){return function(_0x371b84){if(_0x371b84){return _0x371b84['destroy']()['then'](function(){_0x2a8aad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5069bf,_0x140468){return function(_0x1ba07d){if(!_0x1ba07d){_0x5069bf['sendStatus'](0x194);}return _0x1ba07d;};}function handleError(_0x188657,_0x552c54){_0x552c54=_0x552c54||0x1f4;return function(_0x306935){logger['error'](_0x306935['stack']);if(_0x306935[_0x6130('0x29')]){delete _0x306935[_0x6130('0x29')];}_0x188657[_0x6130('0x1f')](_0x552c54)[_0x6130('0x2a')](_0x306935);};}exports[_0x6130('0x2b')]=function(_0x392386,_0x2aa0e3){var _0x19eb47={},_0x14dff0={},_0x5809e4={'count':0x0,'rows':[]};var _0x5363cc=_[_0x6130('0x2c')](db[_0x6130('0x2d')][_0x6130('0x2e')],function(_0x4345ac){return{'name':_0x4345ac[_0x6130('0x2f')],'type':_0x4345ac['type'][_0x6130('0x30')]};});_0x14dff0[_0x6130('0x31')]=_[_0x6130('0x2c')](_0x5363cc,_0x6130('0x29'));_0x14dff0[_0x6130('0x32')]=_['keys'](_0x392386[_0x6130('0x32')]);_0x14dff0[_0x6130('0x33')]=_[_0x6130('0x34')](_0x14dff0['model'],_0x14dff0[_0x6130('0x32')]);_0x19eb47[_0x6130('0x35')]=_[_0x6130('0x34')](_0x14dff0[_0x6130('0x31')],qs[_0x6130('0x36')](_0x392386[_0x6130('0x32')][_0x6130('0x36')]));_0x19eb47[_0x6130('0x35')]=_0x19eb47[_0x6130('0x35')]['length']?_0x19eb47[_0x6130('0x35')]:_0x14dff0['model'];if(!_0x392386['query']['hasOwnProperty'](_0x6130('0x37'))){_0x19eb47[_0x6130('0x24')]=qs[_0x6130('0x24')](_0x392386[_0x6130('0x32')][_0x6130('0x24')]);_0x19eb47[_0x6130('0x22')]=qs[_0x6130('0x22')](_0x392386[_0x6130('0x32')]['offset']);}_0x19eb47[_0x6130('0x38')]=qs[_0x6130('0x39')](_0x392386['query'][_0x6130('0x39')]);_0x19eb47[_0x6130('0x3a')]=qs[_0x6130('0x33')](_['pick'](_0x392386[_0x6130('0x32')],_0x14dff0[_0x6130('0x33')]),_0x5363cc);if(_0x392386['query']['filter']){_0x19eb47[_0x6130('0x3a')]=_[_0x6130('0x3b')](_0x19eb47[_0x6130('0x3a')],{'$or':_['map'](_0x5363cc,function(_0x596c98){if(_0x596c98[_0x6130('0x3c')]!==_0x6130('0x3d')){var _0x3c6aac={};_0x3c6aac[_0x596c98[_0x6130('0x29')]]={'$like':'%'+_0x392386[_0x6130('0x32')][_0x6130('0x3e')]+'%'};return _0x3c6aac;}})});}_0x19eb47=_[_0x6130('0x3b')]({},_0x19eb47,_0x392386['options']);var _0x45bfe0={'where':_0x19eb47[_0x6130('0x3a')]};return db[_0x6130('0x2d')][_0x6130('0x25')](_0x45bfe0)[_0x6130('0x3f')](function(_0x3249f2){_0x5809e4[_0x6130('0x25')]=_0x3249f2;if(_0x392386['query'][_0x6130('0x40')]){_0x19eb47[_0x6130('0x41')]=[{'all':!![]}];}return db[_0x6130('0x2d')][_0x6130('0x42')](_0x19eb47);})[_0x6130('0x3f')](function(_0x142385){_0x5809e4[_0x6130('0x43')]=_0x142385;return _0x5809e4;})[_0x6130('0x3f')](respondWithFilteredResult(_0x2aa0e3,_0x19eb47))['catch'](handleError(_0x2aa0e3,null));};exports[_0x6130('0x44')]=function(_0x154891,_0x6eebc6){var _0x4c727b={'raw':!![],'where':{'id':_0x154891[_0x6130('0x45')]['id']}},_0x176506={};_0x176506[_0x6130('0x31')]=_['keys'](db['FaxQueueReport'][_0x6130('0x2e')]);_0x176506[_0x6130('0x32')]=_[_0x6130('0x46')](_0x154891[_0x6130('0x32')]);_0x176506[_0x6130('0x33')]=_['intersection'](_0x176506[_0x6130('0x31')],_0x176506[_0x6130('0x32')]);_0x4c727b['attributes']=_[_0x6130('0x34')](_0x176506[_0x6130('0x31')],qs[_0x6130('0x36')](_0x154891[_0x6130('0x32')][_0x6130('0x36')]));_0x4c727b[_0x6130('0x35')]=_0x4c727b[_0x6130('0x35')][_0x6130('0x47')]?_0x4c727b['attributes']:_0x176506['model'];if(_0x154891[_0x6130('0x32')]['includeAll']){_0x4c727b[_0x6130('0x41')]=[{'all':!![]}];}_0x4c727b=_[_0x6130('0x3b')]({},_0x4c727b,_0x154891[_0x6130('0x48')]);return db[_0x6130('0x2d')][_0x6130('0x49')](_0x4c727b)[_0x6130('0x3f')](handleEntityNotFound(_0x6eebc6,null))[_0x6130('0x3f')](respondWithResult(_0x6eebc6,null))[_0x6130('0x4a')](handleError(_0x6eebc6,null));};exports[_0x6130('0x4b')]=function(_0x19dcb7,_0x3936a8){return db['FaxQueueReport'][_0x6130('0x4b')](_0x19dcb7[_0x6130('0x4c')],{})[_0x6130('0x3f')](respondWithResult(_0x3936a8,0xc9))[_0x6130('0x4a')](handleError(_0x3936a8,null));};exports[_0x6130('0x4d')]=function(_0x13f591,_0x35939b){if(_0x13f591[_0x6130('0x4c')]['id']){delete _0x13f591[_0x6130('0x4c')]['id'];}return db[_0x6130('0x2d')]['find']({'where':{'id':_0x13f591[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x35939b,null))[_0x6130('0x3f')](saveUpdates(_0x13f591[_0x6130('0x4c')],null))[_0x6130('0x3f')](respondWithResult(_0x35939b,null))[_0x6130('0x4a')](handleError(_0x35939b,null));};exports[_0x6130('0x4e')]=function(_0x37ee0c,_0x3a64ef){return db['FaxQueueReport'][_0x6130('0x49')]({'where':{'id':_0x37ee0c[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x3a64ef,null))[_0x6130('0x3f')](removeEntity(_0x3a64ef,null))[_0x6130('0x4a')](handleError(_0x3a64ef,null));};exports[_0x6130('0x4f')]=function(_0x50960d,_0x14e02d){return db[_0x6130('0x2d')][_0x6130('0x4f')]()['then'](respondWithResult(_0x14e02d,null))['catch'](handleError(_0x14e02d,null));}; \ No newline at end of file +var _0x9090=['sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','FaxQueueReport','type','key','keys','query','filters','intersection','model','attributes','fields','length','order'];(function(_0x3bd471,_0x3d8ec2){var _0x28f69f=function(_0x31984c){while(--_0x31984c){_0x3bd471['push'](_0x3bd471['shift']());}};_0x28f69f(++_0x3d8ec2);}(_0x9090,0x17f));var _0x0909=function(_0xb764d9,_0x1a9b5e){_0xb764d9=_0xb764d9-0x0;var _0x4ae8f2=_0x9090[_0xb764d9];return _0x4ae8f2;};'use strict';var emlformat=require(_0x0909('0x0'));var rimraf=require(_0x0909('0x1'));var zipdir=require(_0x0909('0x2'));var jsonpatch=require(_0x0909('0x3'));var rp=require(_0x0909('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0909('0x5'));var util=require(_0x0909('0x6'));var path=require(_0x0909('0x7'));var sox=require('sox');var csv=require(_0x0909('0x8'));var ejs=require(_0x0909('0x9'));var fs=require('fs');var fs_extra=require(_0x0909('0xa'));var _=require(_0x0909('0xb'));var squel=require(_0x0909('0xc'));var crypto=require(_0x0909('0xd'));var jsforce=require(_0x0909('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0909('0x8'));var querystring=require(_0x0909('0xf'));var Papa=require('papaparse');var Redis=require(_0x0909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0909('0x11'));var as=require(_0x0909('0x12'));var hardwareService=require(_0x0909('0x13'));var logger=require(_0x0909('0x14'))('api');var utils=require(_0x0909('0x15'));var config=require(_0x0909('0x16'));var licenseUtil=require(_0x0909('0x17'));var db=require(_0x0909('0x18'))['db'];function respondWithStatusCode(_0x4e900a,_0x32f71a){_0x32f71a=_0x32f71a||0xcc;return function(_0x18c223){if(_0x18c223){return _0x4e900a[_0x0909('0x19')](_0x32f71a);}return _0x4e900a[_0x0909('0x1a')](_0x32f71a)[_0x0909('0x1b')]();};}function respondWithResult(_0xad78e9,_0x3bdd30){_0x3bdd30=_0x3bdd30||0xc8;return function(_0x1811da){if(_0x1811da){return _0xad78e9[_0x0909('0x1a')](_0x3bdd30)[_0x0909('0x1c')](_0x1811da);}};}function respondWithFilteredResult(_0x48ee40,_0x2c5892){return function(_0x1eb8be){if(_0x1eb8be){var _0x96edb6=typeof _0x2c5892[_0x0909('0x1d')]===_0x0909('0x1e')&&typeof _0x2c5892[_0x0909('0x1f')]===_0x0909('0x1e');var _0x14e44c=_0x1eb8be['count'];var _0x3a7089=_0x96edb6?0x0:_0x2c5892[_0x0909('0x1d')];var _0x14976d=_0x96edb6?_0x1eb8be['count']:_0x2c5892[_0x0909('0x1d')]+_0x2c5892[_0x0909('0x1f')];var _0x11455d;if(_0x14976d>=_0x14e44c){_0x14976d=_0x14e44c;_0x11455d=0xc8;}else{_0x11455d=0xce;}_0x48ee40['status'](_0x11455d);return _0x48ee40['set'](_0x0909('0x20'),_0x3a7089+'-'+_0x14976d+'/'+_0x14e44c)['json'](_0x1eb8be);}return null;};}function patchUpdates(_0xf0efcb){return function(_0x2ccf21){try{jsonpatch[_0x0909('0x21')](_0x2ccf21,_0xf0efcb,!![]);}catch(_0x3037c1){return BPromise[_0x0909('0x22')](_0x3037c1);}return _0x2ccf21[_0x0909('0x23')]();};}function saveUpdates(_0x4eec68,_0x46b384){return function(_0x519c9f){if(_0x519c9f){return _0x519c9f[_0x0909('0x24')](_0x4eec68)[_0x0909('0x25')](function(_0x2ea745){return _0x2ea745;});}return null;};}function removeEntity(_0x3e71b9,_0x332b07){return function(_0x510ba6){if(_0x510ba6){return _0x510ba6[_0x0909('0x26')]()[_0x0909('0x25')](function(){_0x3e71b9[_0x0909('0x1a')](0xcc)[_0x0909('0x1b')]();});}};}function handleEntityNotFound(_0xc879d8,_0x53d139){return function(_0x17d9a7){if(!_0x17d9a7){_0xc879d8[_0x0909('0x19')](0x194);}return _0x17d9a7;};}function handleError(_0x202b4c,_0x165847){_0x165847=_0x165847||0x1f4;return function(_0x59bee7){logger[_0x0909('0x27')](_0x59bee7['stack']);if(_0x59bee7['name']){delete _0x59bee7[_0x0909('0x28')];}_0x202b4c[_0x0909('0x1a')](_0x165847)['send'](_0x59bee7);};}exports[_0x0909('0x29')]=function(_0x33ce47,_0x28daaf){var _0x512d7e={},_0x3c7d32={},_0x2775a4={'count':0x0,'rows':[]};var _0xbc1276=_[_0x0909('0x2a')](db[_0x0909('0x2b')]['rawAttributes'],function(_0x1bd9ae){return{'name':_0x1bd9ae['fieldName'],'type':_0x1bd9ae[_0x0909('0x2c')][_0x0909('0x2d')]};});_0x3c7d32['model']=_[_0x0909('0x2a')](_0xbc1276,_0x0909('0x28'));_0x3c7d32['query']=_[_0x0909('0x2e')](_0x33ce47[_0x0909('0x2f')]);_0x3c7d32[_0x0909('0x30')]=_[_0x0909('0x31')](_0x3c7d32[_0x0909('0x32')],_0x3c7d32['query']);_0x512d7e[_0x0909('0x33')]=_[_0x0909('0x31')](_0x3c7d32[_0x0909('0x32')],qs[_0x0909('0x34')](_0x33ce47['query'][_0x0909('0x34')]));_0x512d7e[_0x0909('0x33')]=_0x512d7e[_0x0909('0x33')][_0x0909('0x35')]?_0x512d7e[_0x0909('0x33')]:_0x3c7d32[_0x0909('0x32')];if(!_0x33ce47[_0x0909('0x2f')]['hasOwnProperty']('nolimit')){_0x512d7e[_0x0909('0x1f')]=qs[_0x0909('0x1f')](_0x33ce47[_0x0909('0x2f')][_0x0909('0x1f')]);_0x512d7e[_0x0909('0x1d')]=qs['offset'](_0x33ce47[_0x0909('0x2f')]['offset']);}_0x512d7e[_0x0909('0x36')]=qs[_0x0909('0x37')](_0x33ce47[_0x0909('0x2f')][_0x0909('0x37')]);_0x512d7e[_0x0909('0x38')]=qs['filters'](_[_0x0909('0x39')](_0x33ce47['query'],_0x3c7d32[_0x0909('0x30')]),_0xbc1276);if(_0x33ce47[_0x0909('0x2f')][_0x0909('0x3a')]){_0x512d7e[_0x0909('0x38')]=_[_0x0909('0x3b')](_0x512d7e[_0x0909('0x38')],{'$or':_[_0x0909('0x2a')](_0xbc1276,function(_0x224c65){if(_0x224c65[_0x0909('0x2c')]!==_0x0909('0x3c')){var _0x547a66={};_0x547a66[_0x224c65[_0x0909('0x28')]]={'$like':'%'+_0x33ce47['query'][_0x0909('0x3a')]+'%'};return _0x547a66;}})});}_0x512d7e=_['merge']({},_0x512d7e,_0x33ce47[_0x0909('0x3d')]);var _0x31540b={'where':_0x512d7e[_0x0909('0x38')]};return db[_0x0909('0x2b')][_0x0909('0x3e')](_0x31540b)[_0x0909('0x25')](function(_0x190ef2){_0x2775a4[_0x0909('0x3e')]=_0x190ef2;if(_0x33ce47[_0x0909('0x2f')]['includeAll']){_0x512d7e[_0x0909('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x0909('0x40')](_0x512d7e);})['then'](function(_0x347bde){_0x2775a4[_0x0909('0x41')]=_0x347bde;return _0x2775a4;})[_0x0909('0x25')](respondWithFilteredResult(_0x28daaf,_0x512d7e))[_0x0909('0x42')](handleError(_0x28daaf,null));};exports['show']=function(_0x12caad,_0x196b13){var _0x1ea9f9={'raw':!![],'where':{'id':_0x12caad[_0x0909('0x43')]['id']}},_0x3e808e={};_0x3e808e['model']=_[_0x0909('0x2e')](db[_0x0909('0x2b')]['rawAttributes']);_0x3e808e[_0x0909('0x2f')]=_['keys'](_0x12caad[_0x0909('0x2f')]);_0x3e808e['filters']=_['intersection'](_0x3e808e[_0x0909('0x32')],_0x3e808e[_0x0909('0x2f')]);_0x1ea9f9['attributes']=_['intersection'](_0x3e808e[_0x0909('0x32')],qs['fields'](_0x12caad[_0x0909('0x2f')][_0x0909('0x34')]));_0x1ea9f9['attributes']=_0x1ea9f9['attributes']['length']?_0x1ea9f9[_0x0909('0x33')]:_0x3e808e[_0x0909('0x32')];if(_0x12caad[_0x0909('0x2f')][_0x0909('0x44')]){_0x1ea9f9['include']=[{'all':!![]}];}_0x1ea9f9=_[_0x0909('0x3b')]({},_0x1ea9f9,_0x12caad[_0x0909('0x3d')]);return db[_0x0909('0x2b')][_0x0909('0x45')](_0x1ea9f9)['then'](handleEntityNotFound(_0x196b13,null))['then'](respondWithResult(_0x196b13,null))[_0x0909('0x42')](handleError(_0x196b13,null));};exports[_0x0909('0x46')]=function(_0x3218c6,_0x285863){return db[_0x0909('0x2b')][_0x0909('0x46')](_0x3218c6[_0x0909('0x47')],{})[_0x0909('0x25')](respondWithResult(_0x285863,0xc9))['catch'](handleError(_0x285863,null));};exports[_0x0909('0x24')]=function(_0x2eaf27,_0x5e8f34){if(_0x2eaf27[_0x0909('0x47')]['id']){delete _0x2eaf27['body']['id'];}return db[_0x0909('0x2b')][_0x0909('0x45')]({'where':{'id':_0x2eaf27[_0x0909('0x43')]['id']}})[_0x0909('0x25')](handleEntityNotFound(_0x5e8f34,null))[_0x0909('0x25')](saveUpdates(_0x2eaf27[_0x0909('0x47')],null))[_0x0909('0x25')](respondWithResult(_0x5e8f34,null))['catch'](handleError(_0x5e8f34,null));};exports[_0x0909('0x26')]=function(_0x253884,_0x16c20a){return db[_0x0909('0x2b')][_0x0909('0x45')]({'where':{'id':_0x253884[_0x0909('0x43')]['id']}})['then'](handleEntityNotFound(_0x16c20a,null))[_0x0909('0x25')](removeEntity(_0x16c20a,null))['catch'](handleError(_0x16c20a,null));};exports['describe']=function(_0x5c0974,_0x5cf171){return db[_0x0909('0x2b')][_0x0909('0x48')]()['then'](respondWithResult(_0x5cf171,null))['catch'](handleError(_0x5cf171,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 0a00e3d..2e420b2 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x3d398b,_0x542808){var _0xaf8fd4=function(_0x112ac6){while(--_0x112ac6){_0x3d398b['push'](_0x3d398b['shift']());}};_0xaf8fd4(++_0x542808);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x5fc3[_0x3ff685];return _0x2046c9;};'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')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x563767,_0x13c8f3){var _0x4e67d1=function(_0xdaf32){while(--_0xdaf32){_0x563767['push'](_0x563767['shift']());}};_0x4e67d1(++_0x13c8f3);}(_0x4975,0x86));var _0x5497=function(_0x36b298,_0x1f63e8){_0x36b298=_0x36b298-0x0;var _0x46eb58=_0x4975[_0x36b298];return _0x46eb58;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'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 753e537..ab96df0 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 _0xbe04=['FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','stringify','UpdateFaxQueueReport','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f3968,_0x596606){var _0x35d098=function(_0x56f450){while(--_0x56f450){_0x2f3968['push'](_0x2f3968['shift']());}};_0x35d098(++_0x596606);}(_0xbe04,0xe8));var _0x4be0=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xbe04[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0x4be0('0x0'));var util=require('util');var moment=require(_0x4be0('0x1'));var BPromise=require(_0x4be0('0x2'));var rs=require(_0x4be0('0x3'));var fs=require('fs');var Redis=require(_0x4be0('0x4'));var db=require(_0x4be0('0x5'))['db'];var utils=require(_0x4be0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4be0('0x7'));var jayson=require(_0x4be0('0x8'));var client=jayson[_0x4be0('0x9')][_0x4be0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46d65e,_0x1912bf,_0x2d3cb4){return new BPromise(function(_0x2b69ec,_0x3b939c){return client[_0x4be0('0xb')](_0x46d65e,_0x2d3cb4)[_0x4be0('0xc')](function(_0x399d7e){logger['info'](_0x4be0('0xd'),_0x1912bf,_0x4be0('0xe'));logger[_0x4be0('0xf')](_0x4be0('0x10'),_0x1912bf,_0x4be0('0xe'),JSON['stringify'](_0x399d7e));if(_0x399d7e[_0x4be0('0x11')]){if(_0x399d7e[_0x4be0('0x11')]['code']===0x1f4){logger[_0x4be0('0x11')](_0x4be0('0xd'),_0x1912bf,_0x399d7e[_0x4be0('0x11')][_0x4be0('0x12')]);return _0x3b939c(_0x399d7e[_0x4be0('0x11')][_0x4be0('0x12')]);}logger[_0x4be0('0x11')](_0x4be0('0xd'),_0x1912bf,_0x399d7e[_0x4be0('0x11')][_0x4be0('0x12')]);return _0x2b69ec(_0x399d7e[_0x4be0('0x11')][_0x4be0('0x12')]);}else{logger[_0x4be0('0x13')](_0x4be0('0xd'),_0x1912bf,'request\x20sent');_0x2b69ec(_0x399d7e[_0x4be0('0x14')][_0x4be0('0x12')]);}})[_0x4be0('0x15')](function(_0x38b034){logger[_0x4be0('0x11')](_0x4be0('0xd'),_0x1912bf,_0x38b034);_0x3b939c(_0x38b034);});});}exports[_0x4be0('0x16')]=function(_0x50625c){var _0x1e1177=this;return new Promise(function(_0x542fdb,_0x462823){return db[_0x4be0('0x17')]['create'](_0x50625c[_0x4be0('0x18')],{'raw':_0x50625c[_0x4be0('0x19')]?_0x50625c[_0x4be0('0x19')][_0x4be0('0x1a')]===undefined?!![]:![]:!![]})[_0x4be0('0xc')](function(_0x5593ea){logger[_0x4be0('0x13')]('CreateFaxQueueReport',_0x50625c);logger[_0x4be0('0xf')](_0x4be0('0x16'),_0x50625c,JSON[_0x4be0('0x1b')](_0x5593ea));_0x542fdb(_0x5593ea);})[_0x4be0('0x15')](function(_0xd944ec){logger['error'](_0x4be0('0x16'),_0xd944ec['message'],_0x50625c);_0x462823(_0x1e1177[_0x4be0('0x11')](0x1f4,_0xd944ec[_0x4be0('0x12')]));});});};exports[_0x4be0('0x1c')]=function(_0x4a39ef){var _0x47f9fd=this;return new Promise(function(_0x5c01a3,_0x421fa3){return db[_0x4be0('0x17')]['update'](_0x4a39ef[_0x4be0('0x18')],{'raw':_0x4a39ef[_0x4be0('0x19')]?_0x4a39ef[_0x4be0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a39ef[_0x4be0('0x19')]?_0x4a39ef['options'][_0x4be0('0x1d')]||null:null,'attributes':_0x4a39ef[_0x4be0('0x19')]?_0x4a39ef[_0x4be0('0x19')]['attributes']||null:null,'limit':_0x4a39ef[_0x4be0('0x19')]?_0x4a39ef[_0x4be0('0x19')][_0x4be0('0x1e')]||null:null})['then'](function(_0x2bf3a1){logger[_0x4be0('0x13')]('UpdateFaxQueueReport',_0x4a39ef);logger['debug'](_0x4be0('0x1c'),_0x4a39ef,JSON['stringify'](_0x2bf3a1));_0x5c01a3(_0x2bf3a1);})['catch'](function(_0xb9b315){logger[_0x4be0('0x11')](_0x4be0('0x1c'),_0xb9b315[_0x4be0('0x12')],_0x4a39ef);_0x421fa3(_0x47f9fd[_0x4be0('0x11')](0x1f4,_0xb9b315[_0x4be0('0x12')]));});});}; \ No newline at end of file +var _0x1dfe=['code','message','result','catch','CreateFaxQueueReport','body','options','raw','debug','where','attributes','UpdateFaxQueueReport','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c7c99,_0x3cf724){var _0x1f8b0a=function(_0x5026e8){while(--_0x5026e8){_0x1c7c99['push'](_0x1c7c99['shift']());}};_0x1f8b0a(++_0x3cf724);}(_0x1dfe,0x138));var _0xe1df=function(_0x454ea7,_0x5f2b23){_0x454ea7=_0x454ea7-0x0;var _0x5865aa=_0x1dfe[_0x454ea7];return _0x5865aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1df('0x0'));var BPromise=require(_0xe1df('0x1'));var rs=require(_0xe1df('0x2'));var fs=require('fs');var Redis=require(_0xe1df('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1df('0x4'));var logger=require(_0xe1df('0x5'))(_0xe1df('0x6'));var config=require(_0xe1df('0x7'));var jayson=require(_0xe1df('0x8'));var client=jayson[_0xe1df('0x9')][_0xe1df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c635f,_0x2c51a9,_0x2ad51b){return new BPromise(function(_0x53e2d8,_0x18f363){return client['request'](_0x3c635f,_0x2ad51b)[_0xe1df('0xb')](function(_0x2d16c7){logger[_0xe1df('0xc')](_0xe1df('0xd'),_0x2c51a9,_0xe1df('0xe'));logger['debug'](_0xe1df('0xf'),_0x2c51a9,_0xe1df('0xe'),JSON[_0xe1df('0x10')](_0x2d16c7));if(_0x2d16c7[_0xe1df('0x11')]){if(_0x2d16c7[_0xe1df('0x11')][_0xe1df('0x12')]===0x1f4){logger['error'](_0xe1df('0xd'),_0x2c51a9,_0x2d16c7[_0xe1df('0x11')]['message']);return _0x18f363(_0x2d16c7['error']['message']);}logger[_0xe1df('0x11')](_0xe1df('0xd'),_0x2c51a9,_0x2d16c7[_0xe1df('0x11')][_0xe1df('0x13')]);return _0x53e2d8(_0x2d16c7[_0xe1df('0x11')][_0xe1df('0x13')]);}else{logger[_0xe1df('0xc')](_0xe1df('0xd'),_0x2c51a9,_0xe1df('0xe'));_0x53e2d8(_0x2d16c7[_0xe1df('0x14')][_0xe1df('0x13')]);}})[_0xe1df('0x15')](function(_0x4d2b7a){logger[_0xe1df('0x11')](_0xe1df('0xd'),_0x2c51a9,_0x4d2b7a);_0x18f363(_0x4d2b7a);});});}exports[_0xe1df('0x16')]=function(_0x173186){var _0x31678c=this;return new Promise(function(_0x567a18,_0x48f2a4){return db['FaxQueueReport']['create'](_0x173186[_0xe1df('0x17')],{'raw':_0x173186[_0xe1df('0x18')]?_0x173186[_0xe1df('0x18')][_0xe1df('0x19')]===undefined?!![]:![]:!![]})[_0xe1df('0xb')](function(_0x187d60){logger[_0xe1df('0xc')]('CreateFaxQueueReport',_0x173186);logger[_0xe1df('0x1a')](_0xe1df('0x16'),_0x173186,JSON['stringify'](_0x187d60));_0x567a18(_0x187d60);})[_0xe1df('0x15')](function(_0x5b6f2a){logger[_0xe1df('0x11')](_0xe1df('0x16'),_0x5b6f2a[_0xe1df('0x13')],_0x173186);_0x48f2a4(_0x31678c[_0xe1df('0x11')](0x1f4,_0x5b6f2a[_0xe1df('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x1248a6){var _0xbd4d4b=this;return new Promise(function(_0x202f5d,_0x49cd48){return db['FaxQueueReport']['update'](_0x1248a6['body'],{'raw':_0x1248a6[_0xe1df('0x18')]?_0x1248a6['options'][_0xe1df('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1248a6[_0xe1df('0x18')]?_0x1248a6[_0xe1df('0x18')][_0xe1df('0x1b')]||null:null,'attributes':_0x1248a6[_0xe1df('0x18')]?_0x1248a6[_0xe1df('0x18')][_0xe1df('0x1c')]||null:null,'limit':_0x1248a6[_0xe1df('0x18')]?_0x1248a6[_0xe1df('0x18')]['limit']||null:null})[_0xe1df('0xb')](function(_0x88b6d5){logger['info']('UpdateFaxQueueReport',_0x1248a6);logger[_0xe1df('0x1a')]('UpdateFaxQueueReport',_0x1248a6,JSON[_0xe1df('0x10')](_0x88b6d5));_0x202f5d(_0x88b6d5);})[_0xe1df('0x15')](function(_0x2e50d6){logger[_0xe1df('0x11')](_0xe1df('0x1d'),_0x2e50d6[_0xe1df('0x13')],_0x1248a6);_0x49cd48(_0xbd4d4b['error'](0x1f4,_0x2e50d6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 25b5a59..3a97562 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 _0x30fc=['show','put','/:id','update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x2d9eaa,_0x272c56){var _0x5bf0f8=function(_0x28d427){while(--_0x28d427){_0x2d9eaa['push'](_0x2d9eaa['shift']());}};_0x5bf0f8(++_0x272c56);}(_0x30fc,0x1a3));var _0xc30f=function(_0x5694d3,_0x2e3008){_0x5694d3=_0x5694d3-0x0;var _0x1ca96e=_0x30fc[_0x5694d3];return _0x1ca96e;};'use strict';var multer=require('multer');var util=require(_0xc30f('0x0'));var path=require(_0xc30f('0x1'));var timeout=require('connect-timeout');var express=require(_0xc30f('0x2'));var router=express[_0xc30f('0x3')]();var fs_extra=require(_0xc30f('0x4'));var auth=require(_0xc30f('0x5'));var interaction=require(_0xc30f('0x6'));var config=require(_0xc30f('0x7'));var controller=require(_0xc30f('0x8'));router[_0xc30f('0x9')]('/',auth[_0xc30f('0xa')](),controller[_0xc30f('0xb')]);router[_0xc30f('0x9')]('/describe',auth[_0xc30f('0xa')](),controller[_0xc30f('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc30f('0xd')]);router['post']('/',auth[_0xc30f('0xa')](),controller['create']);router[_0xc30f('0xe')](_0xc30f('0xf'),auth[_0xc30f('0xa')](),controller[_0xc30f('0x10')]);router['delete'](_0xc30f('0xf'),auth[_0xc30f('0xa')](),controller[_0xc30f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1521=['../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','update','delete','util','path','connect-timeout','express','fs-extra'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1521,0x79));var _0x1152=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x1521[_0x37ffea];return _0x2e2615;};'use strict';var multer=require('multer');var util=require(_0x1152('0x0'));var path=require(_0x1152('0x1'));var timeout=require(_0x1152('0x2'));var express=require(_0x1152('0x3'));var router=express['Router']();var fs_extra=require(_0x1152('0x4'));var auth=require(_0x1152('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1152('0x6'));var controller=require(_0x1152('0x7'));router[_0x1152('0x8')]('/',auth['isAuthenticated'](),controller[_0x1152('0x9')]);router[_0x1152('0x8')](_0x1152('0xa'),auth[_0x1152('0xb')](),controller[_0x1152('0xc')]);router['get'](_0x1152('0xd'),auth[_0x1152('0xb')](),controller[_0x1152('0xe')]);router['post']('/',auth[_0x1152('0xb')](),controller[_0x1152('0xf')]);router['put'](_0x1152('0xd'),auth[_0x1152('0xb')](),controller[_0x1152('0x10')]);router[_0x1152('0x11')](_0x1152('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e209809..b6242c2 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x57d2a9,_0x1e834f){var _0x223a1=function(_0x426046){while(--_0x426046){_0x57d2a9['push'](_0x57d2a9['shift']());}};_0x223a1(++_0x1e834f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0xf3cd[_0x2d344f];return _0x2e796b;};'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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x4658fd,_0x2ec8e3){var _0x3ff178=function(_0x281ba1){while(--_0x281ba1){_0x4658fd['push'](_0x4658fd['shift']());}};_0x3ff178(++_0x2ec8e3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xcb91[_0x4b4f24];return _0x1c13d4;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 966081e..89550f5 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 _0x0787=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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'];(function(_0x5857a7,_0x3f8601){var _0x2c35e4=function(_0x1e3492){while(--_0x1e3492){_0x5857a7['push'](_0x5857a7['shift']());}};_0x2c35e4(++_0x3f8601);}(_0x0787,0x123));var _0x7078=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x0787[_0x1f5a63];return _0x30bb7a;};'use strict';var emlformat=require(_0x7078('0x0'));var rimraf=require(_0x7078('0x1'));var zipdir=require(_0x7078('0x2'));var jsonpatch=require(_0x7078('0x3'));var rp=require(_0x7078('0x4'));var moment=require(_0x7078('0x5'));var BPromise=require(_0x7078('0x6'));var Mustache=require('mustache');var util=require(_0x7078('0x7'));var path=require(_0x7078('0x8'));var sox=require(_0x7078('0x9'));var csv=require('to-csv');var ejs=require(_0x7078('0xa'));var fs=require('fs');var fs_extra=require(_0x7078('0xb'));var _=require(_0x7078('0xc'));var squel=require(_0x7078('0xd'));var crypto=require(_0x7078('0xe'));var jsforce=require(_0x7078('0xf'));var deskjs=require(_0x7078('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7078('0x11'));var Papa=require(_0x7078('0x12'));var Redis=require(_0x7078('0x13'));var authService=require(_0x7078('0x14'));var qs=require(_0x7078('0x15'));var as=require(_0x7078('0x16'));var hardwareService=require(_0x7078('0x17'));var logger=require(_0x7078('0x18'))(_0x7078('0x19'));var utils=require(_0x7078('0x1a'));var config=require(_0x7078('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x7078('0x1c'))['db'];function respondWithStatusCode(_0x233a4b,_0x1cd03f){_0x1cd03f=_0x1cd03f||0xcc;return function(_0x2b11e2){if(_0x2b11e2){return _0x233a4b['sendStatus'](_0x1cd03f);}return _0x233a4b[_0x7078('0x1d')](_0x1cd03f)[_0x7078('0x1e')]();};}function respondWithResult(_0x21c7b6,_0x33ece1){_0x33ece1=_0x33ece1||0xc8;return function(_0x93dae0){if(_0x93dae0){return _0x21c7b6[_0x7078('0x1d')](_0x33ece1)['json'](_0x93dae0);}};}function respondWithFilteredResult(_0x3ccfb7,_0x4a49bb){return function(_0x389263){if(_0x389263){var _0x2ad899=typeof _0x4a49bb[_0x7078('0x1f')]==='undefined'&&typeof _0x4a49bb[_0x7078('0x20')]===_0x7078('0x21');var _0x48afce=_0x389263[_0x7078('0x22')];var _0xe6babf=_0x2ad899?0x0:_0x4a49bb[_0x7078('0x1f')];var _0x354d12=_0x2ad899?_0x389263[_0x7078('0x22')]:_0x4a49bb['offset']+_0x4a49bb[_0x7078('0x20')];var _0x4ae8d8;if(_0x354d12>=_0x48afce){_0x354d12=_0x48afce;_0x4ae8d8=0xc8;}else{_0x4ae8d8=0xce;}_0x3ccfb7['status'](_0x4ae8d8);return _0x3ccfb7['set'](_0x7078('0x23'),_0xe6babf+'-'+_0x354d12+'/'+_0x48afce)[_0x7078('0x24')](_0x389263);}return null;};}function patchUpdates(_0x2d785a){return function(_0x3deec3){try{jsonpatch['apply'](_0x3deec3,_0x2d785a,!![]);}catch(_0x3f5f42){return BPromise[_0x7078('0x25')](_0x3f5f42);}return _0x3deec3[_0x7078('0x26')]();};}function saveUpdates(_0x165337,_0x3b70b6){return function(_0x2d7f15){if(_0x2d7f15){return _0x2d7f15[_0x7078('0x27')](_0x165337)[_0x7078('0x28')](function(_0x3d1b9c){return _0x3d1b9c;});}return null;};}function removeEntity(_0x3c862d,_0x4b480c){return function(_0x312ba){if(_0x312ba){return _0x312ba[_0x7078('0x29')]()[_0x7078('0x28')](function(){_0x3c862d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49df1e,_0x2f7ea0){return function(_0x3594ea){if(!_0x3594ea){_0x49df1e[_0x7078('0x2a')](0x194);}return _0x3594ea;};}function handleError(_0x7e3bbc,_0x22ff15){_0x22ff15=_0x22ff15||0x1f4;return function(_0x53c762){logger[_0x7078('0x2b')](_0x53c762[_0x7078('0x2c')]);if(_0x53c762[_0x7078('0x2d')]){delete _0x53c762['name'];}_0x7e3bbc[_0x7078('0x1d')](_0x22ff15)[_0x7078('0x2e')](_0x53c762);};}exports[_0x7078('0x2f')]=function(_0x1d2dd0,_0x2f203c){var _0x465c89={},_0x22e0b5={},_0xe14d84={'count':0x0,'rows':[]};var _0x19e5e6=_[_0x7078('0x30')](db[_0x7078('0x31')][_0x7078('0x32')],function(_0x47db47){return{'name':_0x47db47[_0x7078('0x33')],'type':_0x47db47[_0x7078('0x34')][_0x7078('0x35')]};});_0x22e0b5[_0x7078('0x36')]=_['map'](_0x19e5e6,_0x7078('0x2d'));_0x22e0b5[_0x7078('0x37')]=_['keys'](_0x1d2dd0[_0x7078('0x37')]);_0x22e0b5[_0x7078('0x38')]=_[_0x7078('0x39')](_0x22e0b5[_0x7078('0x36')],_0x22e0b5['query']);_0x465c89[_0x7078('0x3a')]=_[_0x7078('0x39')](_0x22e0b5[_0x7078('0x36')],qs['fields'](_0x1d2dd0['query'][_0x7078('0x3b')]));_0x465c89[_0x7078('0x3a')]=_0x465c89[_0x7078('0x3a')][_0x7078('0x3c')]?_0x465c89[_0x7078('0x3a')]:_0x22e0b5[_0x7078('0x36')];if(!_0x1d2dd0['query']['hasOwnProperty'](_0x7078('0x3d'))){_0x465c89[_0x7078('0x20')]=qs[_0x7078('0x20')](_0x1d2dd0[_0x7078('0x37')][_0x7078('0x20')]);_0x465c89['offset']=qs['offset'](_0x1d2dd0[_0x7078('0x37')]['offset']);}_0x465c89[_0x7078('0x3e')]=qs[_0x7078('0x3f')](_0x1d2dd0['query'][_0x7078('0x3f')]);_0x465c89[_0x7078('0x40')]=qs['filters'](_[_0x7078('0x41')](_0x1d2dd0[_0x7078('0x37')],_0x22e0b5[_0x7078('0x38')]),_0x19e5e6);if(_0x1d2dd0[_0x7078('0x37')]['filter']){_0x465c89[_0x7078('0x40')]=_[_0x7078('0x42')](_0x465c89['where'],{'$or':_[_0x7078('0x30')](_0x19e5e6,function(_0x3ffef7){if(_0x3ffef7[_0x7078('0x34')]!==_0x7078('0x43')){var _0x721054={};_0x721054[_0x3ffef7[_0x7078('0x2d')]]={'$like':'%'+_0x1d2dd0[_0x7078('0x37')]['filter']+'%'};return _0x721054;}})});}_0x465c89=_[_0x7078('0x42')]({},_0x465c89,_0x1d2dd0['options']);var _0x462343={'where':_0x465c89[_0x7078('0x40')]};return db[_0x7078('0x31')][_0x7078('0x22')](_0x462343)['then'](function(_0x20aa14){_0xe14d84[_0x7078('0x22')]=_0x20aa14;if(_0x1d2dd0[_0x7078('0x37')][_0x7078('0x44')]){_0x465c89[_0x7078('0x45')]=[{'all':!![]}];}return db[_0x7078('0x31')][_0x7078('0x46')](_0x465c89);})[_0x7078('0x28')](function(_0x2f90fb){_0xe14d84['rows']=_0x2f90fb;return _0xe14d84;})['then'](respondWithFilteredResult(_0x2f203c,_0x465c89))[_0x7078('0x47')](handleError(_0x2f203c,null));};exports[_0x7078('0x48')]=function(_0x2315bf,_0x29bc63){var _0x26b1af={'raw':!![],'where':{'id':_0x2315bf[_0x7078('0x49')]['id']}},_0x585ae1={};_0x585ae1[_0x7078('0x36')]=_[_0x7078('0x4a')](db[_0x7078('0x31')]['rawAttributes']);_0x585ae1['query']=_[_0x7078('0x4a')](_0x2315bf[_0x7078('0x37')]);_0x585ae1[_0x7078('0x38')]=_['intersection'](_0x585ae1[_0x7078('0x36')],_0x585ae1['query']);_0x26b1af[_0x7078('0x3a')]=_[_0x7078('0x39')](_0x585ae1[_0x7078('0x36')],qs[_0x7078('0x3b')](_0x2315bf[_0x7078('0x37')][_0x7078('0x3b')]));_0x26b1af[_0x7078('0x3a')]=_0x26b1af[_0x7078('0x3a')][_0x7078('0x3c')]?_0x26b1af['attributes']:_0x585ae1[_0x7078('0x36')];if(_0x2315bf[_0x7078('0x37')][_0x7078('0x44')]){_0x26b1af[_0x7078('0x45')]=[{'all':!![]}];}_0x26b1af=_[_0x7078('0x42')]({},_0x26b1af,_0x2315bf['options']);return db[_0x7078('0x31')]['find'](_0x26b1af)[_0x7078('0x28')](handleEntityNotFound(_0x29bc63,null))[_0x7078('0x28')](respondWithResult(_0x29bc63,null))[_0x7078('0x47')](handleError(_0x29bc63,null));};exports[_0x7078('0x4b')]=function(_0x25b58c,_0x1c3c9d){return db[_0x7078('0x31')][_0x7078('0x4b')](_0x25b58c[_0x7078('0x4c')],{})[_0x7078('0x28')](respondWithResult(_0x1c3c9d,0xc9))[_0x7078('0x47')](handleError(_0x1c3c9d,null));};exports[_0x7078('0x27')]=function(_0x93bbb0,_0x3cd32c){if(_0x93bbb0[_0x7078('0x4c')]['id']){delete _0x93bbb0[_0x7078('0x4c')]['id'];}return db[_0x7078('0x31')]['find']({'where':{'id':_0x93bbb0[_0x7078('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cd32c,null))[_0x7078('0x28')](saveUpdates(_0x93bbb0[_0x7078('0x4c')],null))[_0x7078('0x28')](respondWithResult(_0x3cd32c,null))[_0x7078('0x47')](handleError(_0x3cd32c,null));};exports[_0x7078('0x29')]=function(_0x393b8f,_0x25786f){return db[_0x7078('0x31')][_0x7078('0x4d')]({'where':{'id':_0x393b8f[_0x7078('0x49')]['id']}})[_0x7078('0x28')](handleEntityNotFound(_0x25786f,null))[_0x7078('0x28')](removeEntity(_0x25786f,null))[_0x7078('0x47')](handleError(_0x25786f,null));};exports['describe']=function(_0x1db964,_0x5a8031){return db[_0x7078('0x31')][_0x7078('0x4e')]()[_0x7078('0x28')](respondWithResult(_0x5a8031,null))[_0x7078('0x47')](handleError(_0x5a8031,null));}; \ No newline at end of file +var _0xe010=['destroy','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','ejs','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/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','json','apply','reject','update','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','includeAll','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe010,0x17f));var _0x0e01=function(_0x5cb2b9,_0x27d7e2){_0x5cb2b9=_0x5cb2b9-0x0;var _0x34c70b=_0xe010[_0x5cb2b9];return _0x34c70b;};'use strict';var emlformat=require(_0x0e01('0x0'));var rimraf=require(_0x0e01('0x1'));var zipdir=require(_0x0e01('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e01('0x3'));var moment=require(_0x0e01('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0e01('0x5'));var sox=require(_0x0e01('0x6'));var csv=require('to-csv');var ejs=require(_0x0e01('0x7'));var fs=require('fs');var fs_extra=require(_0x0e01('0x8'));var _=require(_0x0e01('0x9'));var squel=require(_0x0e01('0xa'));var crypto=require(_0x0e01('0xb'));var jsforce=require(_0x0e01('0xc'));var deskjs=require(_0x0e01('0xd'));var toCsv=require(_0x0e01('0xe'));var querystring=require(_0x0e01('0xf'));var Papa=require(_0x0e01('0x10'));var Redis=require(_0x0e01('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0e01('0x12'));var hardwareService=require(_0x0e01('0x13'));var logger=require(_0x0e01('0x14'))(_0x0e01('0x15'));var utils=require(_0x0e01('0x16'));var config=require(_0x0e01('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e01('0x18'))['db'];function respondWithStatusCode(_0xe39ec2,_0x4bd128){_0x4bd128=_0x4bd128||0xcc;return function(_0x302be0){if(_0x302be0){return _0xe39ec2[_0x0e01('0x19')](_0x4bd128);}return _0xe39ec2['status'](_0x4bd128)[_0x0e01('0x1a')]();};}function respondWithResult(_0x292474,_0x602f81){_0x602f81=_0x602f81||0xc8;return function(_0x3734a8){if(_0x3734a8){return _0x292474['status'](_0x602f81)['json'](_0x3734a8);}};}function respondWithFilteredResult(_0xca8d8c,_0xb6e7ed){return function(_0x3e888d){if(_0x3e888d){var _0x50cf44=typeof _0xb6e7ed[_0x0e01('0x1b')]===_0x0e01('0x1c')&&typeof _0xb6e7ed[_0x0e01('0x1d')]==='undefined';var _0xf9d68a=_0x3e888d[_0x0e01('0x1e')];var _0x251ae6=_0x50cf44?0x0:_0xb6e7ed[_0x0e01('0x1b')];var _0x264efd=_0x50cf44?_0x3e888d[_0x0e01('0x1e')]:_0xb6e7ed[_0x0e01('0x1b')]+_0xb6e7ed[_0x0e01('0x1d')];var _0x1bd94d;if(_0x264efd>=_0xf9d68a){_0x264efd=_0xf9d68a;_0x1bd94d=0xc8;}else{_0x1bd94d=0xce;}_0xca8d8c[_0x0e01('0x1f')](_0x1bd94d);return _0xca8d8c['set']('Content-Range',_0x251ae6+'-'+_0x264efd+'/'+_0xf9d68a)[_0x0e01('0x20')](_0x3e888d);}return null;};}function patchUpdates(_0x467f75){return function(_0x4a9ee2){try{jsonpatch[_0x0e01('0x21')](_0x4a9ee2,_0x467f75,!![]);}catch(_0x12f16d){return BPromise[_0x0e01('0x22')](_0x12f16d);}return _0x4a9ee2['save']();};}function saveUpdates(_0x45028c,_0x466562){return function(_0x531cab){if(_0x531cab){return _0x531cab[_0x0e01('0x23')](_0x45028c)['then'](function(_0x2083f9){return _0x2083f9;});}return null;};}function removeEntity(_0x562f7d,_0x25bab4){return function(_0x14c725){if(_0x14c725){return _0x14c725['destroy']()['then'](function(){_0x562f7d[_0x0e01('0x1f')](0xcc)[_0x0e01('0x1a')]();});}};}function handleEntityNotFound(_0x11b279,_0x490adf){return function(_0x1c443f){if(!_0x1c443f){_0x11b279[_0x0e01('0x19')](0x194);}return _0x1c443f;};}function handleError(_0x609ec9,_0x412d86){_0x412d86=_0x412d86||0x1f4;return function(_0x5eb6a5){logger[_0x0e01('0x24')](_0x5eb6a5[_0x0e01('0x25')]);if(_0x5eb6a5[_0x0e01('0x26')]){delete _0x5eb6a5[_0x0e01('0x26')];}_0x609ec9[_0x0e01('0x1f')](_0x412d86)[_0x0e01('0x27')](_0x5eb6a5);};}exports[_0x0e01('0x28')]=function(_0x486aae,_0x29692e){var _0x59236e={},_0x4c9050={},_0x43c52d={'count':0x0,'rows':[]};var _0x20db6e=_[_0x0e01('0x29')](db[_0x0e01('0x2a')][_0x0e01('0x2b')],function(_0x5a4c6c){return{'name':_0x5a4c6c[_0x0e01('0x2c')],'type':_0x5a4c6c[_0x0e01('0x2d')]['key']};});_0x4c9050[_0x0e01('0x2e')]=_[_0x0e01('0x29')](_0x20db6e,_0x0e01('0x26'));_0x4c9050[_0x0e01('0x2f')]=_[_0x0e01('0x30')](_0x486aae[_0x0e01('0x2f')]);_0x4c9050[_0x0e01('0x31')]=_[_0x0e01('0x32')](_0x4c9050[_0x0e01('0x2e')],_0x4c9050[_0x0e01('0x2f')]);_0x59236e[_0x0e01('0x33')]=_['intersection'](_0x4c9050[_0x0e01('0x2e')],qs[_0x0e01('0x34')](_0x486aae['query'][_0x0e01('0x34')]));_0x59236e[_0x0e01('0x33')]=_0x59236e['attributes'][_0x0e01('0x35')]?_0x59236e[_0x0e01('0x33')]:_0x4c9050['model'];if(!_0x486aae['query'][_0x0e01('0x36')](_0x0e01('0x37'))){_0x59236e['limit']=qs['limit'](_0x486aae['query']['limit']);_0x59236e[_0x0e01('0x1b')]=qs[_0x0e01('0x1b')](_0x486aae[_0x0e01('0x2f')]['offset']);}_0x59236e[_0x0e01('0x38')]=qs['sort'](_0x486aae[_0x0e01('0x2f')][_0x0e01('0x39')]);_0x59236e[_0x0e01('0x3a')]=qs[_0x0e01('0x31')](_[_0x0e01('0x3b')](_0x486aae['query'],_0x4c9050['filters']),_0x20db6e);if(_0x486aae[_0x0e01('0x2f')][_0x0e01('0x3c')]){_0x59236e[_0x0e01('0x3a')]=_[_0x0e01('0x3d')](_0x59236e[_0x0e01('0x3a')],{'$or':_[_0x0e01('0x29')](_0x20db6e,function(_0x351429){if(_0x351429[_0x0e01('0x2d')]!==_0x0e01('0x3e')){var _0x11cb5c={};_0x11cb5c[_0x351429['name']]={'$like':'%'+_0x486aae[_0x0e01('0x2f')][_0x0e01('0x3c')]+'%'};return _0x11cb5c;}})});}_0x59236e=_[_0x0e01('0x3d')]({},_0x59236e,_0x486aae[_0x0e01('0x3f')]);var _0x3e8c44={'where':_0x59236e['where']};return db[_0x0e01('0x2a')][_0x0e01('0x1e')](_0x3e8c44)[_0x0e01('0x40')](function(_0xa8286c){_0x43c52d[_0x0e01('0x1e')]=_0xa8286c;if(_0x486aae[_0x0e01('0x2f')]['includeAll']){_0x59236e[_0x0e01('0x41')]=[{'all':!![]}];}return db[_0x0e01('0x2a')][_0x0e01('0x42')](_0x59236e);})[_0x0e01('0x40')](function(_0x2332f6){_0x43c52d[_0x0e01('0x43')]=_0x2332f6;return _0x43c52d;})['then'](respondWithFilteredResult(_0x29692e,_0x59236e))[_0x0e01('0x44')](handleError(_0x29692e,null));};exports[_0x0e01('0x45')]=function(_0x1b94a3,_0x14cf18){var _0x13f72a={'raw':!![],'where':{'id':_0x1b94a3[_0x0e01('0x46')]['id']}},_0x13cfa9={};_0x13cfa9[_0x0e01('0x2e')]=_[_0x0e01('0x30')](db['FaxTransferReport']['rawAttributes']);_0x13cfa9[_0x0e01('0x2f')]=_[_0x0e01('0x30')](_0x1b94a3[_0x0e01('0x2f')]);_0x13cfa9['filters']=_[_0x0e01('0x32')](_0x13cfa9['model'],_0x13cfa9[_0x0e01('0x2f')]);_0x13f72a[_0x0e01('0x33')]=_[_0x0e01('0x32')](_0x13cfa9['model'],qs[_0x0e01('0x34')](_0x1b94a3[_0x0e01('0x2f')]['fields']));_0x13f72a[_0x0e01('0x33')]=_0x13f72a[_0x0e01('0x33')]['length']?_0x13f72a[_0x0e01('0x33')]:_0x13cfa9[_0x0e01('0x2e')];if(_0x1b94a3[_0x0e01('0x2f')][_0x0e01('0x47')]){_0x13f72a[_0x0e01('0x41')]=[{'all':!![]}];}_0x13f72a=_[_0x0e01('0x3d')]({},_0x13f72a,_0x1b94a3[_0x0e01('0x3f')]);return db[_0x0e01('0x2a')]['find'](_0x13f72a)[_0x0e01('0x40')](handleEntityNotFound(_0x14cf18,null))[_0x0e01('0x40')](respondWithResult(_0x14cf18,null))[_0x0e01('0x44')](handleError(_0x14cf18,null));};exports['create']=function(_0x2ccf66,_0x518a34){return db[_0x0e01('0x2a')]['create'](_0x2ccf66['body'],{})[_0x0e01('0x40')](respondWithResult(_0x518a34,0xc9))[_0x0e01('0x44')](handleError(_0x518a34,null));};exports['update']=function(_0x213b2d,_0x42a41c){if(_0x213b2d[_0x0e01('0x48')]['id']){delete _0x213b2d[_0x0e01('0x48')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x213b2d[_0x0e01('0x46')]['id']}})[_0x0e01('0x40')](handleEntityNotFound(_0x42a41c,null))[_0x0e01('0x40')](saveUpdates(_0x213b2d[_0x0e01('0x48')],null))[_0x0e01('0x40')](respondWithResult(_0x42a41c,null))[_0x0e01('0x44')](handleError(_0x42a41c,null));};exports[_0x0e01('0x49')]=function(_0x529de6,_0x1d883c){return db['FaxTransferReport'][_0x0e01('0x4a')]({'where':{'id':_0x529de6[_0x0e01('0x46')]['id']}})[_0x0e01('0x40')](handleEntityNotFound(_0x1d883c,null))[_0x0e01('0x40')](removeEntity(_0x1d883c,null))[_0x0e01('0x44')](handleError(_0x1d883c,null));};exports['describe']=function(_0x237808,_0x121978){return db[_0x0e01('0x2a')][_0x0e01('0x4b')]()[_0x0e01('0x40')](respondWithResult(_0x121978,null))[_0x0e01('0x44')](handleError(_0x121978,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 56b6271..e17653b 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 _0x85ed=['../../config/logger','bluebird','path','rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x15de42,_0x5b89ba){var _0x33e374=function(_0x592df2){while(--_0x592df2){_0x15de42['push'](_0x15de42['shift']());}};_0x33e374(++_0x5b89ba);}(_0x85ed,0x18f));var _0xd85e=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x85ed[_0x999b85];return _0x1d7124;};'use strict';var _=require(_0xd85e('0x0'));var util=require('util');var logger=require(_0xd85e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd85e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd85e('0x3'));var rimraf=require(_0xd85e('0x4'));var config=require('../../config/environment');var attributes=require(_0xd85e('0x5'));module['exports']=function(_0x3aa9f6,_0x410564){return _0x3aa9f6[_0xd85e('0x6')](_0xd85e('0x7'),attributes,{'tableName':_0xd85e('0x8'),'paranoid':![],'indexes':[{'name':_0xd85e('0x9'),'fields':[_0xd85e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7a8=['path','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2d5550,_0x5ccce7){var _0x3f9e54=function(_0x1a5aa7){while(--_0x1a5aa7){_0x2d5550['push'](_0x2d5550['shift']());}};_0x3f9e54(++_0x5ccce7);}(_0xb7a8,0x95));var _0x8b7a=function(_0x190e02,_0x462272){_0x190e02=_0x190e02-0x0;var _0x1c5864=_0xb7a8[_0x190e02];return _0x1c5864;};'use strict';var _=require(_0x8b7a('0x0'));var util=require(_0x8b7a('0x1'));var logger=require(_0x8b7a('0x2'))(_0x8b7a('0x3'));var moment=require(_0x8b7a('0x4'));var BPromise=require(_0x8b7a('0x5'));var rp=require(_0x8b7a('0x6'));var fs=require('fs');var path=require(_0x8b7a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8b7a('0x8'));module[_0x8b7a('0x9')]=function(_0x2546d7,_0x350dbf){return _0x2546d7[_0x8b7a('0xa')](_0x8b7a('0xb'),attributes,{'tableName':_0x8b7a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 843fe1c..ead6cee 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 _0x37c8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x569998,_0x361b8d){var _0x2f8256=function(_0x3354f1){while(--_0x3354f1){_0x569998['push'](_0x569998['shift']());}};_0x2f8256(++_0x361b8d);}(_0x37c8,0x78));var _0x837c=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x37c8[_0x4c184d];return _0x23d997;};'use strict';var _=require(_0x837c('0x0'));var util=require(_0x837c('0x1'));var moment=require(_0x837c('0x2'));var BPromise=require(_0x837c('0x3'));var rs=require(_0x837c('0x4'));var fs=require('fs');var Redis=require(_0x837c('0x5'));var db=require(_0x837c('0x6'))['db'];var utils=require(_0x837c('0x7'));var logger=require(_0x837c('0x8'))(_0x837c('0x9'));var config=require(_0x837c('0xa'));var jayson=require(_0x837c('0xb'));var client=jayson[_0x837c('0xc')][_0x837c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ce3a3,_0x446465,_0x5035d1){return new BPromise(function(_0xb76850,_0x560609){return client[_0x837c('0xe')](_0x2ce3a3,_0x5035d1)[_0x837c('0xf')](function(_0xcd365f){logger[_0x837c('0x10')](_0x837c('0x11'),_0x446465,_0x837c('0x12'));logger[_0x837c('0x13')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x446465,_0x837c('0x12'),JSON[_0x837c('0x14')](_0xcd365f));if(_0xcd365f[_0x837c('0x15')]){if(_0xcd365f['error']['code']===0x1f4){logger['error'](_0x837c('0x11'),_0x446465,_0xcd365f[_0x837c('0x15')]['message']);return _0x560609(_0xcd365f[_0x837c('0x15')]['message']);}logger[_0x837c('0x15')](_0x837c('0x11'),_0x446465,_0xcd365f[_0x837c('0x15')][_0x837c('0x16')]);return _0xb76850(_0xcd365f['error'][_0x837c('0x16')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x446465,_0x837c('0x12'));_0xb76850(_0xcd365f[_0x837c('0x17')]['message']);}})[_0x837c('0x18')](function(_0x45b944){logger[_0x837c('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x446465,_0x45b944);_0x560609(_0x45b944);});});} \ No newline at end of file +var _0xdb10=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','lodash','util'];(function(_0x2a6cb3,_0x5a5c62){var _0x27b2c6=function(_0x1dd615){while(--_0x1dd615){_0x2a6cb3['push'](_0x2a6cb3['shift']());}};_0x27b2c6(++_0x5a5c62);}(_0xdb10,0x1ae));var _0x0db1=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0xdb10[_0x51beba];return _0x167ee0;};'use strict';var _=require(_0x0db1('0x0'));var util=require(_0x0db1('0x1'));var moment=require(_0x0db1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0db1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0db1('0x4'));var logger=require(_0x0db1('0x5'))(_0x0db1('0x6'));var config=require(_0x0db1('0x7'));var jayson=require(_0x0db1('0x8'));var client=jayson[_0x0db1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10ec62,_0x35bf4e,_0xd7692f){return new BPromise(function(_0x4971ec,_0x98624d){return client[_0x0db1('0xa')](_0x10ec62,_0xd7692f)['then'](function(_0xa7405f){logger[_0x0db1('0xb')](_0x0db1('0xc'),_0x35bf4e,'request\x20sent');logger[_0x0db1('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x35bf4e,_0x0db1('0xe'),JSON['stringify'](_0xa7405f));if(_0xa7405f[_0x0db1('0xf')]){if(_0xa7405f[_0x0db1('0xf')]['code']===0x1f4){logger[_0x0db1('0xf')](_0x0db1('0xc'),_0x35bf4e,_0xa7405f[_0x0db1('0xf')][_0x0db1('0x10')]);return _0x98624d(_0xa7405f[_0x0db1('0xf')]['message']);}logger[_0x0db1('0xf')](_0x0db1('0xc'),_0x35bf4e,_0xa7405f[_0x0db1('0xf')]['message']);return _0x4971ec(_0xa7405f[_0x0db1('0xf')]['message']);}else{logger[_0x0db1('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x35bf4e,'request\x20sent');_0x4971ec(_0xa7405f[_0x0db1('0x11')]['message']);}})['catch'](function(_0xa335b8){logger[_0x0db1('0xf')](_0x0db1('0xc'),_0x35bf4e,_0xa335b8);_0x98624d(_0xa335b8);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1d23306..537961f 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 _0x73ed=['describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated'];(function(_0x270af6,_0x87f513){var _0x55a014=function(_0x10f83b){while(--_0x10f83b){_0x270af6['push'](_0x270af6['shift']());}};_0x55a014(++_0x87f513);}(_0x73ed,0x93));var _0xd73e=function(_0x545191,_0x4b8ccc){_0x545191=_0x545191-0x0;var _0xb66167=_0x73ed[_0x545191];return _0xb66167;};'use strict';var multer=require(_0xd73e('0x0'));var util=require(_0xd73e('0x1'));var path=require(_0xd73e('0x2'));var timeout=require(_0xd73e('0x3'));var express=require(_0xd73e('0x4'));var router=express[_0xd73e('0x5')]();var fs_extra=require(_0xd73e('0x6'));var auth=require(_0xd73e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd73e('0x8'));var controller=require(_0xd73e('0x9'));router[_0xd73e('0xa')]('/',auth['isAuthenticated'](),controller[_0xd73e('0xb')]);router[_0xd73e('0xa')](_0xd73e('0xc'),auth[_0xd73e('0xd')](),controller[_0xd73e('0xe')]);router[_0xd73e('0xa')](_0xd73e('0xf'),auth[_0xd73e('0xd')](),controller[_0xd73e('0x10')]);router[_0xd73e('0x11')]('/',auth[_0xd73e('0xd')](),controller[_0xd73e('0x12')]);router[_0xd73e('0x13')](_0xd73e('0xf'),auth[_0xd73e('0xd')](),controller[_0xd73e('0x14')]);router[_0xd73e('0x15')](_0xd73e('0xf'),auth['isAuthenticated'](),controller[_0xd73e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1e77=['update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','/describe','describe','get','show','create','put','/:id'];(function(_0x25abb0,_0x1ad9b7){var _0x21f2e2=function(_0x203bea){while(--_0x203bea){_0x25abb0['push'](_0x25abb0['shift']());}};_0x21f2e2(++_0x1ad9b7);}(_0x1e77,0x1df));var _0x71e7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1e77[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x71e7('0x0'));var util=require(_0x71e7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x71e7('0x2'));var router=express['Router']();var fs_extra=require(_0x71e7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x71e7('0x4'));var config=require(_0x71e7('0x5'));var controller=require(_0x71e7('0x6'));router['get']('/',auth[_0x71e7('0x7')](),controller['index']);router['get'](_0x71e7('0x8'),auth[_0x71e7('0x7')](),controller[_0x71e7('0x9')]);router[_0x71e7('0xa')]('/:id',auth[_0x71e7('0x7')](),controller[_0x71e7('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x71e7('0xc')]);router[_0x71e7('0xd')](_0x71e7('0xe'),auth['isAuthenticated'](),controller[_0x71e7('0xf')]);router[_0x71e7('0x10')](_0x71e7('0xe'),auth[_0x71e7('0x7')](),controller[_0x71e7('0x11')]);module[_0x71e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index dfd4b5c..3635542 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 _0x8263=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','util'];(function(_0x4f2fd1,_0x84cc3e){var _0x3918ed=function(_0x672cec){while(--_0x672cec){_0x4f2fd1['push'](_0x4f2fd1['shift']());}};_0x3918ed(++_0x84cc3e);}(_0x8263,0xef));var _0x3826=function(_0x4a075d,_0x250369){_0x4a075d=_0x4a075d-0x0;var _0x275847=_0x8263[_0x4a075d];return _0x275847;};'use strict';var multer=require('multer');var util=require(_0x3826('0x0'));var path=require(_0x3826('0x1'));var timeout=require(_0x3826('0x2'));var express=require(_0x3826('0x3'));var router=express[_0x3826('0x4')]();var fs_extra=require(_0x3826('0x5'));var auth=require(_0x3826('0x6'));var interaction=require(_0x3826('0x7'));var config=require(_0x3826('0x8'));var controller=require(_0x3826('0x9'));router[_0x3826('0xa')]('/',auth[_0x3826('0xb')](),controller[_0x3826('0xc')]);router[_0x3826('0xa')](_0x3826('0xd'),auth[_0x3826('0xb')](),controller[_0x3826('0xe')]);router[_0x3826('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x3826('0xa')](_0x3826('0xf'),auth['isAuthenticated'](),controller[_0x3826('0x10')]);router[_0x3826('0x11')]('/',auth[_0x3826('0xb')](),controller[_0x3826('0x12')]);router[_0x3826('0x11')](_0x3826('0x13'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3826('0x14')]('/:id',auth[_0x3826('0xb')](),controller[_0x3826('0x15')]);router['delete'](_0x3826('0xd'),auth[_0x3826('0xb')](),controller[_0x3826('0x16')]);module[_0x3826('0x17')]=router; \ No newline at end of file +var _0x3c9b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','destroy','exports','multer','path'];(function(_0x5593a1,_0x2726d1){var _0x1cf0e4=function(_0x3f2480){while(--_0x3f2480){_0x5593a1['push'](_0x5593a1['shift']());}};_0x1cf0e4(++_0x2726d1);}(_0x3c9b,0x106));var _0xb3c9=function(_0x3f61f4,_0x14d750){_0x3f61f4=_0x3f61f4-0x0;var _0x4005f6=_0x3c9b[_0x3f61f4];return _0x4005f6;};'use strict';var multer=require(_0xb3c9('0x0'));var util=require('util');var path=require(_0xb3c9('0x1'));var timeout=require(_0xb3c9('0x2'));var express=require(_0xb3c9('0x3'));var router=express[_0xb3c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb3c9('0x5'));var interaction=require(_0xb3c9('0x6'));var config=require('../../config/environment');var controller=require(_0xb3c9('0x7'));router[_0xb3c9('0x8')]('/',auth['isAuthenticated'](),controller[_0xb3c9('0x9')]);router[_0xb3c9('0x8')](_0xb3c9('0xa'),auth[_0xb3c9('0xb')](),controller[_0xb3c9('0xc')]);router[_0xb3c9('0x8')](_0xb3c9('0xd'),auth[_0xb3c9('0xb')](),controller[_0xb3c9('0xe')]);router[_0xb3c9('0x8')](_0xb3c9('0xf'),auth[_0xb3c9('0xb')](),controller[_0xb3c9('0x10')]);router[_0xb3c9('0x11')]('/',auth[_0xb3c9('0xb')](),controller['create']);router[_0xb3c9('0x11')](_0xb3c9('0xd'),auth['isAuthenticated'](),controller[_0xb3c9('0x12')]);router['put'](_0xb3c9('0xa'),auth[_0xb3c9('0xb')](),controller[_0xb3c9('0x13')]);router['delete'](_0xb3c9('0xa'),auth[_0xb3c9('0xb')](),controller[_0xb3c9('0x14')]);module[_0xb3c9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index fb15f11..15a16bc 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 _0x3c58=['integrationTab','sequelize','exports','STRING','basic','ENUM','newTab'];(function(_0x23ab27,_0x33b148){var _0x212bc7=function(_0xe0d563){while(--_0xe0d563){_0x23ab27['push'](_0x23ab27['shift']());}};_0x212bc7(++_0x33b148);}(_0x3c58,0x190));var _0x83c5=function(_0x5e2729,_0x1afa6d){_0x5e2729=_0x5e2729-0x0;var _0x2d51dc=_0x3c58[_0x5e2729];return _0x2d51dc;};'use strict';var Sequelize=require(_0x83c5('0x0'));module[_0x83c5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x83c5('0x2')]},'username':{'type':Sequelize[_0x83c5('0x2')]},'remoteUri':{'type':Sequelize[_0x83c5('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x83c5('0x3')),'defaultValue':_0x83c5('0x3')},'password':{'type':Sequelize[_0x83c5('0x2')]},'consumerKey':{'type':Sequelize[_0x83c5('0x2')]},'consumerSecret':{'type':Sequelize[_0x83c5('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x83c5('0x2')]},'serverUrl':{'type':Sequelize[_0x83c5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x83c5('0x4')]('integrationTab',_0x83c5('0x5')),'defaultValue':_0x83c5('0x6')}}; \ No newline at end of file +var _0x32bc=['integrationTab','sequelize','STRING','ENUM','basic'];(function(_0x5aa8ac,_0x37f6e8){var _0x4b382d=function(_0x284062){while(--_0x284062){_0x5aa8ac['push'](_0x5aa8ac['shift']());}};_0x4b382d(++_0x37f6e8);}(_0x32bc,0x128));var _0xc32b=function(_0x2970f4,_0x171125){_0x2970f4=_0x2970f4-0x0;var _0x15bb2b=_0x32bc[_0x2970f4];return _0x15bb2b;};'use strict';var Sequelize=require(_0xc32b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc32b('0x1')]},'authType':{'type':Sequelize[_0xc32b('0x2')](_0xc32b('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xc32b('0x1')]},'consumerSecret':{'type':Sequelize[_0xc32b('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xc32b('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc32b('0x4'),'newTab'),'defaultValue':_0xc32b('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 4a26e63..c0f8bc8 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 _0xd7c0=['addConfiguration','getSubjects','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','findOne','DeskConfiguration','pick','getConfigurations'];(function(_0x3d29ec,_0x4f103f){var _0x10f26=function(_0x51a4d2){while(--_0x51a4d2){_0x3d29ec['push'](_0x3d29ec['shift']());}};_0x10f26(++_0x4f103f);}(_0xd7c0,0x16f));var _0x0d7c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd7c0[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x0d7c('0x0'));var rimraf=require(_0x0d7c('0x1'));var zipdir=require(_0x0d7c('0x2'));var jsonpatch=require(_0x0d7c('0x3'));var rp=require('request-promise');var moment=require(_0x0d7c('0x4'));var BPromise=require(_0x0d7c('0x5'));var Mustache=require(_0x0d7c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0d7c('0x7'));var csv=require(_0x0d7c('0x8'));var ejs=require(_0x0d7c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0d7c('0xa'));var crypto=require(_0x0d7c('0xb'));var jsforce=require(_0x0d7c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0d7c('0x8'));var querystring=require(_0x0d7c('0xd'));var Papa=require(_0x0d7c('0xe'));var Redis=require(_0x0d7c('0xf'));var authService=require(_0x0d7c('0x10'));var qs=require(_0x0d7c('0x11'));var as=require(_0x0d7c('0x12'));var hardwareService=require(_0x0d7c('0x13'));var logger=require('../../config/logger')(_0x0d7c('0x14'));var utils=require(_0x0d7c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0d7c('0x16'))['db'];var integrations=require(_0x0d7c('0x17'));function respondWithStatusCode(_0x30d5b1,_0x450565){_0x450565=_0x450565||0xcc;return function(_0x2465a0){if(_0x2465a0){return _0x30d5b1['sendStatus'](_0x450565);}return _0x30d5b1[_0x0d7c('0x18')](_0x450565)[_0x0d7c('0x19')]();};}function respondWithResult(_0x3f9e97,_0x2e5009){_0x2e5009=_0x2e5009||0xc8;return function(_0x12c030){if(_0x12c030){return _0x3f9e97[_0x0d7c('0x18')](_0x2e5009)[_0x0d7c('0x1a')](_0x12c030);}};}function respondWithFilteredResult(_0x1ec8ca,_0x16853e){return function(_0x80b8c7){if(_0x80b8c7){var _0x53b9e8=typeof _0x16853e['offset']===_0x0d7c('0x1b')&&typeof _0x16853e[_0x0d7c('0x1c')]===_0x0d7c('0x1b');var _0x405a2e=_0x80b8c7['count'];var _0x5c7cb1=_0x53b9e8?0x0:_0x16853e[_0x0d7c('0x1d')];var _0x494c3a=_0x53b9e8?_0x80b8c7[_0x0d7c('0x1e')]:_0x16853e[_0x0d7c('0x1d')]+_0x16853e[_0x0d7c('0x1c')];var _0x34cca2;if(_0x494c3a>=_0x405a2e){_0x494c3a=_0x405a2e;_0x34cca2=0xc8;}else{_0x34cca2=0xce;}_0x1ec8ca[_0x0d7c('0x18')](_0x34cca2);return _0x1ec8ca['set'](_0x0d7c('0x1f'),_0x5c7cb1+'-'+_0x494c3a+'/'+_0x405a2e)[_0x0d7c('0x1a')](_0x80b8c7);}return null;};}function patchUpdates(_0x46fa24){return function(_0xd00bec){try{jsonpatch[_0x0d7c('0x20')](_0xd00bec,_0x46fa24,!![]);}catch(_0x165dc3){return BPromise['reject'](_0x165dc3);}return _0xd00bec[_0x0d7c('0x21')]();};}function saveUpdates(_0x1b22bf,_0x4d8acd){return function(_0x1c43ad){if(_0x1c43ad){return _0x1c43ad[_0x0d7c('0x22')](_0x1b22bf)[_0x0d7c('0x23')](function(_0x3568b3){return _0x3568b3;});}return null;};}function removeEntity(_0x994a1,_0x5b0a63){return function(_0x1b2319){if(_0x1b2319){return _0x1b2319[_0x0d7c('0x24')]()[_0x0d7c('0x23')](function(){_0x994a1[_0x0d7c('0x18')](0xcc)[_0x0d7c('0x19')]();});}};}function handleEntityNotFound(_0x423986,_0x2a5ff4){return function(_0x2cc354){if(!_0x2cc354){_0x423986['sendStatus'](0x194);}return _0x2cc354;};}function handleError(_0x392303,_0x5ba347){_0x5ba347=_0x5ba347||0x1f4;return function(_0x1f121c){logger['error'](_0x1f121c[_0x0d7c('0x25')]);if(_0x1f121c[_0x0d7c('0x26')]){delete _0x1f121c['name'];}_0x392303[_0x0d7c('0x18')](_0x5ba347)[_0x0d7c('0x27')](_0x1f121c);};}exports[_0x0d7c('0x28')]=function(_0x45a173,_0x4cebea){var _0x1b7528={},_0x3f225a={},_0xa0faa0={'count':0x0,'rows':[]};var _0x40a672=_['map'](db[_0x0d7c('0x29')][_0x0d7c('0x2a')],function(_0x4067d0){return{'name':_0x4067d0[_0x0d7c('0x2b')],'type':_0x4067d0[_0x0d7c('0x2c')][_0x0d7c('0x2d')]};});_0x3f225a[_0x0d7c('0x2e')]=_[_0x0d7c('0x2f')](_0x40a672,_0x0d7c('0x26'));_0x3f225a[_0x0d7c('0x30')]=_[_0x0d7c('0x31')](_0x45a173[_0x0d7c('0x30')]);_0x3f225a['filters']=_[_0x0d7c('0x32')](_0x3f225a[_0x0d7c('0x2e')],_0x3f225a[_0x0d7c('0x30')]);_0x1b7528[_0x0d7c('0x33')]=_[_0x0d7c('0x32')](_0x3f225a[_0x0d7c('0x2e')],qs[_0x0d7c('0x34')](_0x45a173[_0x0d7c('0x30')]['fields']));_0x1b7528[_0x0d7c('0x33')]=_0x1b7528['attributes']['length']?_0x1b7528['attributes']:_0x3f225a[_0x0d7c('0x2e')];if(!_0x45a173[_0x0d7c('0x30')][_0x0d7c('0x35')](_0x0d7c('0x36'))){_0x1b7528[_0x0d7c('0x1c')]=qs[_0x0d7c('0x1c')](_0x45a173['query']['limit']);_0x1b7528['offset']=qs[_0x0d7c('0x1d')](_0x45a173[_0x0d7c('0x30')][_0x0d7c('0x1d')]);}_0x1b7528[_0x0d7c('0x37')]=qs['sort'](_0x45a173[_0x0d7c('0x30')][_0x0d7c('0x38')]);_0x1b7528['where']=qs[_0x0d7c('0x39')](_['pick'](_0x45a173['query'],_0x3f225a[_0x0d7c('0x39')]),_0x40a672);if(_0x45a173['query'][_0x0d7c('0x3a')]){_0x1b7528[_0x0d7c('0x3b')]=_[_0x0d7c('0x3c')](_0x1b7528[_0x0d7c('0x3b')],{'$or':_[_0x0d7c('0x2f')](_0x40a672,function(_0x1b0e4b){if(_0x1b0e4b[_0x0d7c('0x2c')]!==_0x0d7c('0x3d')){var _0x32b521={};_0x32b521[_0x1b0e4b[_0x0d7c('0x26')]]={'$like':'%'+_0x45a173[_0x0d7c('0x30')][_0x0d7c('0x3a')]+'%'};return _0x32b521;}})});}_0x1b7528=_[_0x0d7c('0x3c')]({},_0x1b7528,_0x45a173[_0x0d7c('0x3e')]);var _0xf9515d={'where':_0x1b7528[_0x0d7c('0x3b')]};return db[_0x0d7c('0x29')][_0x0d7c('0x1e')](_0xf9515d)[_0x0d7c('0x23')](function(_0x1b88a5){_0xa0faa0[_0x0d7c('0x1e')]=_0x1b88a5;if(_0x45a173['query'][_0x0d7c('0x3f')]){_0x1b7528[_0x0d7c('0x40')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x1b7528);})[_0x0d7c('0x23')](function(_0x1b847b){_0xa0faa0[_0x0d7c('0x41')]=_0x1b847b;return _0xa0faa0;})[_0x0d7c('0x23')](respondWithFilteredResult(_0x4cebea,_0x1b7528))[_0x0d7c('0x42')](handleError(_0x4cebea,null));};exports[_0x0d7c('0x43')]=function(_0x581599,_0x33c6cf){var _0x18337e={'raw':![],'where':{'id':_0x581599[_0x0d7c('0x44')]['id']}},_0x2a6fd5={};_0x2a6fd5[_0x0d7c('0x2e')]=_['keys'](db[_0x0d7c('0x29')][_0x0d7c('0x2a')]);_0x2a6fd5[_0x0d7c('0x30')]=_[_0x0d7c('0x31')](_0x581599['query']);_0x2a6fd5[_0x0d7c('0x39')]=_[_0x0d7c('0x32')](_0x2a6fd5[_0x0d7c('0x2e')],_0x2a6fd5['query']);_0x18337e['attributes']=_['intersection'](_0x2a6fd5[_0x0d7c('0x2e')],qs['fields'](_0x581599[_0x0d7c('0x30')][_0x0d7c('0x34')]));_0x18337e['attributes']=_0x18337e[_0x0d7c('0x33')][_0x0d7c('0x45')]?_0x18337e[_0x0d7c('0x33')]:_0x2a6fd5[_0x0d7c('0x2e')];if(_0x581599[_0x0d7c('0x30')][_0x0d7c('0x3f')]){_0x18337e[_0x0d7c('0x40')]=[{'all':!![]}];}_0x18337e=_[_0x0d7c('0x3c')]({},_0x18337e,_0x581599[_0x0d7c('0x3e')]);return db[_0x0d7c('0x29')][_0x0d7c('0x46')](_0x18337e)['then'](handleEntityNotFound(_0x33c6cf,null))[_0x0d7c('0x23')](respondWithResult(_0x33c6cf,null))[_0x0d7c('0x42')](handleError(_0x33c6cf,null));};exports[_0x0d7c('0x47')]=function(_0x343ae4,_0x3596b7){return db['DeskAccount'][_0x0d7c('0x47')](_0x343ae4['body'],{})[_0x0d7c('0x23')](respondWithResult(_0x3596b7,0xc9))[_0x0d7c('0x42')](handleError(_0x3596b7,null));};exports['update']=function(_0xc16c95,_0x49baff){if(_0xc16c95[_0x0d7c('0x48')]['id']){delete _0xc16c95['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0xc16c95[_0x0d7c('0x44')]['id']}})[_0x0d7c('0x23')](handleEntityNotFound(_0x49baff,null))[_0x0d7c('0x23')](saveUpdates(_0xc16c95[_0x0d7c('0x48')],null))[_0x0d7c('0x23')](respondWithResult(_0x49baff,null))[_0x0d7c('0x42')](handleError(_0x49baff,null));};exports[_0x0d7c('0x24')]=function(_0x4376dd,_0x4d67c5){return db[_0x0d7c('0x29')][_0x0d7c('0x46')]({'where':{'id':_0x4376dd[_0x0d7c('0x44')]['id']}})[_0x0d7c('0x23')](handleEntityNotFound(_0x4d67c5,null))[_0x0d7c('0x23')](removeEntity(_0x4d67c5,null))[_0x0d7c('0x42')](handleError(_0x4d67c5,null));};exports['getConfigurations']=function(_0x2bad6b,_0x562590,_0x1d4a02){var _0x35a9a2={};var _0x1b5ac6={};var _0x3586c6;var _0x50de4a;return db[_0x0d7c('0x29')][_0x0d7c('0x49')]({'where':{'id':_0x2bad6b[_0x0d7c('0x44')]['id']}})[_0x0d7c('0x23')](handleEntityNotFound(_0x562590,null))[_0x0d7c('0x23')](function(_0x547704){if(_0x547704){_0x3586c6=_0x547704;_0x1b5ac6[_0x0d7c('0x2e')]=_['keys'](db[_0x0d7c('0x4a')][_0x0d7c('0x2a')]);_0x1b5ac6['query']=_['keys'](_0x2bad6b[_0x0d7c('0x30')]);_0x1b5ac6[_0x0d7c('0x39')]=_['intersection'](_0x1b5ac6[_0x0d7c('0x2e')],_0x1b5ac6[_0x0d7c('0x30')]);_0x35a9a2[_0x0d7c('0x33')]=_['intersection'](_0x1b5ac6[_0x0d7c('0x2e')],qs['fields'](_0x2bad6b[_0x0d7c('0x30')][_0x0d7c('0x34')]));_0x35a9a2[_0x0d7c('0x33')]=_0x35a9a2['attributes'][_0x0d7c('0x45')]?_0x35a9a2['attributes']:_0x1b5ac6[_0x0d7c('0x2e')];_0x35a9a2['order']=qs[_0x0d7c('0x38')](_0x2bad6b['query'][_0x0d7c('0x38')]);_0x35a9a2['where']=qs[_0x0d7c('0x39')](_[_0x0d7c('0x4b')](_0x2bad6b[_0x0d7c('0x30')],_0x1b5ac6['filters']));if(_0x2bad6b[_0x0d7c('0x30')][_0x0d7c('0x3a')]){_0x35a9a2[_0x0d7c('0x3b')]=_[_0x0d7c('0x3c')](_0x35a9a2['where'],{'$or':_[_0x0d7c('0x2f')](_0x35a9a2[_0x0d7c('0x33')],function(_0x174819){var _0x21bf85={};_0x21bf85[_0x174819]={'$like':'%'+_0x2bad6b[_0x0d7c('0x30')][_0x0d7c('0x3a')]+'%'};return _0x21bf85;})});}_0x35a9a2=_[_0x0d7c('0x3c')]({},_0x35a9a2,_0x2bad6b[_0x0d7c('0x3e')]);return _0x3586c6[_0x0d7c('0x4c')](_0x35a9a2);}})[_0x0d7c('0x23')](function(_0x37b034){if(_0x37b034){_0x50de4a=_0x37b034['length'];if(!_0x2bad6b['query'][_0x0d7c('0x35')](_0x0d7c('0x36'))){_0x35a9a2['limit']=qs['limit'](_0x2bad6b[_0x0d7c('0x30')][_0x0d7c('0x1c')]);_0x35a9a2[_0x0d7c('0x1d')]=qs[_0x0d7c('0x1d')](_0x2bad6b[_0x0d7c('0x30')]['offset']);}return _0x3586c6['getConfigurations'](_0x35a9a2);}})[_0x0d7c('0x23')](function(_0xe8211){if(_0xe8211){return _0xe8211?{'count':_0x50de4a,'rows':_0xe8211}:null;}})['then'](respondWithResult(_0x562590,null))[_0x0d7c('0x42')](handleError(_0x562590,null));};exports[_0x0d7c('0x4d')]=function(_0x239525,_0x2b4bdb,_0x1bd191){if(_0x239525[_0x0d7c('0x48')]['id']){delete _0x239525[_0x0d7c('0x48')]['id'];}return db['DeskAccount'][_0x0d7c('0x49')]({'where':{'id':_0x239525['params']['id']}})[_0x0d7c('0x23')](handleEntityNotFound(_0x2b4bdb,null))[_0x0d7c('0x23')](function(_0x386fa3){if(_0x386fa3){_0x239525['body']['AccountId']=_0x386fa3['id'];_0x239525[_0x0d7c('0x48')]['Subjects']=integrations[_0x0d7c('0x4e')](_0x239525['body']['channel'],_0x239525[_0x0d7c('0x48')][_0x0d7c('0x2c')]);_0x239525[_0x0d7c('0x48')]['Descriptions']=integrations[_0x0d7c('0x4f')](_0x239525[_0x0d7c('0x48')]['channel'],_0x239525[_0x0d7c('0x48')][_0x0d7c('0x2c')]);return db[_0x0d7c('0x4a')][_0x0d7c('0x47')](_0x239525['body'],{'include':[{'model':db[_0x0d7c('0x50')],'as':'Subjects'},{'model':db[_0x0d7c('0x50')],'as':'Descriptions'}]});}return null;})[_0x0d7c('0x23')](respondWithResult(_0x2b4bdb,null))[_0x0d7c('0x42')](handleError(_0x2b4bdb,null));};exports[_0x0d7c('0x51')]=function(_0x3e7e29,_0x410598,_0x31b960){var _0x4935a8=[{'name':'priority','label':_0x0d7c('0x52'),'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 _0x54ad5f='';return db[_0x0d7c('0x29')]['findOne']({'where':{'id':_0x3e7e29[_0x0d7c('0x44')]['id']},'attributes':['id','remoteUri',_0x0d7c('0x53'),_0x0d7c('0x54'),_0x0d7c('0x55'),'consumerKey',_0x0d7c('0x56'),_0x0d7c('0x57'),_0x0d7c('0x58')]})['then'](handleEntityNotFound(_0x410598,null))[_0x0d7c('0x23')](function(_0x298479){if(_0x298479){_0x54ad5f=_0x298479[_0x0d7c('0x59')];var _0x225acd=_0x54ad5f[_0x0d7c('0x5a')](-0x1);if(_0x225acd==='/'){_0x54ad5f=_0x54ad5f['substring'](0x0,_0x54ad5f[_0x0d7c('0x5b')](_0x225acd));}var _0x243617={'method':_0x0d7c('0x5c'),'uri':util[_0x0d7c('0x5d')](_0x0d7c('0x5e'),_0x54ad5f),'headers':{'Content-Type':_0x0d7c('0x5f'),'Accept':_0x0d7c('0x5f')},'json':!![]};if(_0x298479[_0x0d7c('0x53')]===_0x0d7c('0x60')){_0x243617['headers'][_0x0d7c('0x61')]=util[_0x0d7c('0x5d')](_0x0d7c('0x62'),new Buffer(util[_0x0d7c('0x5d')](_0x0d7c('0x63'),_0x298479[_0x0d7c('0x54')],_0x298479[_0x0d7c('0x55')]))[_0x0d7c('0x64')](_0x0d7c('0x65')));}return rp(_0x243617)[_0x0d7c('0x23')](function(_0xd95681){return _0x4935a8[_0x0d7c('0x66')](_[_0x0d7c('0x2f')](_0xd95681[_0x0d7c('0x67')]['entries'],function(_0x5f5811){return{'id':_0x5f5811[_0x0d7c('0x26')],'name':_0x5f5811['name'],'type':_0x5f5811[_0x0d7c('0x2c')],'active':_0x5f5811[_0x0d7c('0x68')],'label':_0x5f5811[_0x0d7c('0x69')],'custom':!![]};}));});}})['then'](function(_0x50adec){return{'count':_0x50adec[_0x0d7c('0x45')],'rows':_0x50adec};})['then'](respondWithResult(_0x410598,null))['catch'](function(_0x3ee2e4){var _0x36962d=_0x3e7e29['query'][_0x0d7c('0x6a')]?0x1f4:_0x3ee2e4[_0x0d7c('0x6b')]||0x1f4;logger[_0x0d7c('0x6c')](_0x0d7c('0x6d'),_0x0d7c('0x51'),_0x36962d,JSON[_0x0d7c('0x6e')](_0x3ee2e4));delete _0x3ee2e4[_0x0d7c('0x26')];if(_0x36962d===0x191){_0x36962d=0x190;}_0x410598[_0x0d7c('0x18')](_0x36962d)[_0x0d7c('0x27')](_0x3e7e29[_0x0d7c('0x30')][_0x0d7c('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x3ee2e4[_0x0d7c('0x6b')]}:_0x3ee2e4);});}; \ No newline at end of file +var _0xfea1=['error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','DeskAccount','rawAttributes','fieldName','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','options','include','findAll','rows','catch','show','keys','fields','find','create','body','params','getConfigurations','findOne','where','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','headers','Authorization','format','Basic\x20%s','%s:%s','toString','concat','_embedded','active','label'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfea1,0x1d7));var _0x1fea=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0xfea1[_0x2d460c];return _0xf6fc4c;};'use strict';var emlformat=require(_0x1fea('0x0'));var rimraf=require(_0x1fea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fea('0x2'));var rp=require(_0x1fea('0x3'));var moment=require(_0x1fea('0x4'));var BPromise=require(_0x1fea('0x5'));var Mustache=require('mustache');var util=require(_0x1fea('0x6'));var path=require(_0x1fea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1fea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fea('0x9'));var squel=require('squel');var crypto=require(_0x1fea('0xa'));var jsforce=require(_0x1fea('0xb'));var deskjs=require(_0x1fea('0xc'));var toCsv=require(_0x1fea('0xd'));var querystring=require(_0x1fea('0xe'));var Papa=require(_0x1fea('0xf'));var Redis=require(_0x1fea('0x10'));var authService=require(_0x1fea('0x11'));var qs=require(_0x1fea('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1fea('0x13'));var utils=require('../../config/utils');var config=require(_0x1fea('0x14'));var licenseUtil=require(_0x1fea('0x15'));var db=require(_0x1fea('0x16'))['db'];var integrations=require(_0x1fea('0x17'));function respondWithStatusCode(_0x2f9bf4,_0xa6b4e3){_0xa6b4e3=_0xa6b4e3||0xcc;return function(_0x41729e){if(_0x41729e){return _0x2f9bf4[_0x1fea('0x18')](_0xa6b4e3);}return _0x2f9bf4[_0x1fea('0x19')](_0xa6b4e3)[_0x1fea('0x1a')]();};}function respondWithResult(_0xabea4a,_0x222542){_0x222542=_0x222542||0xc8;return function(_0x76ae24){if(_0x76ae24){return _0xabea4a[_0x1fea('0x19')](_0x222542)[_0x1fea('0x1b')](_0x76ae24);}};}function respondWithFilteredResult(_0x5b9177,_0xa25fc4){return function(_0x47faf4){if(_0x47faf4){var _0x61ca80=typeof _0xa25fc4[_0x1fea('0x1c')]==='undefined'&&typeof _0xa25fc4['limit']===_0x1fea('0x1d');var _0x150285=_0x47faf4[_0x1fea('0x1e')];var _0x43f50c=_0x61ca80?0x0:_0xa25fc4[_0x1fea('0x1c')];var _0x588dd8=_0x61ca80?_0x47faf4[_0x1fea('0x1e')]:_0xa25fc4[_0x1fea('0x1c')]+_0xa25fc4[_0x1fea('0x1f')];var _0x27334e;if(_0x588dd8>=_0x150285){_0x588dd8=_0x150285;_0x27334e=0xc8;}else{_0x27334e=0xce;}_0x5b9177[_0x1fea('0x19')](_0x27334e);return _0x5b9177[_0x1fea('0x20')](_0x1fea('0x21'),_0x43f50c+'-'+_0x588dd8+'/'+_0x150285)['json'](_0x47faf4);}return null;};}function patchUpdates(_0x4b0b89){return function(_0x3fb7a4){try{jsonpatch[_0x1fea('0x22')](_0x3fb7a4,_0x4b0b89,!![]);}catch(_0x467099){return BPromise[_0x1fea('0x23')](_0x467099);}return _0x3fb7a4[_0x1fea('0x24')]();};}function saveUpdates(_0x490350,_0x2db5b8){return function(_0x3ba918){if(_0x3ba918){return _0x3ba918[_0x1fea('0x25')](_0x490350)[_0x1fea('0x26')](function(_0x6a3e62){return _0x6a3e62;});}return null;};}function removeEntity(_0xe8546f,_0x38b6a2){return function(_0x478933){if(_0x478933){return _0x478933[_0x1fea('0x27')]()[_0x1fea('0x26')](function(){_0xe8546f[_0x1fea('0x19')](0xcc)[_0x1fea('0x1a')]();});}};}function handleEntityNotFound(_0x364c3e,_0x248d41){return function(_0x211e2a){if(!_0x211e2a){_0x364c3e[_0x1fea('0x18')](0x194);}return _0x211e2a;};}function handleError(_0x2032ae,_0x2d7c4f){_0x2d7c4f=_0x2d7c4f||0x1f4;return function(_0x16b60a){logger['error'](_0x16b60a['stack']);if(_0x16b60a[_0x1fea('0x28')]){delete _0x16b60a[_0x1fea('0x28')];}_0x2032ae[_0x1fea('0x19')](_0x2d7c4f)[_0x1fea('0x29')](_0x16b60a);};}exports[_0x1fea('0x2a')]=function(_0x289931,_0x1a5514){var _0x1d73d4={},_0xe3dd73={},_0x53fc21={'count':0x0,'rows':[]};var _0x2640dd=_['map'](db[_0x1fea('0x2b')][_0x1fea('0x2c')],function(_0x36df04){return{'name':_0x36df04[_0x1fea('0x2d')],'type':_0x36df04['type']['key']};});_0xe3dd73['model']=_[_0x1fea('0x2e')](_0x2640dd,'name');_0xe3dd73['query']=_['keys'](_0x289931[_0x1fea('0x2f')]);_0xe3dd73[_0x1fea('0x30')]=_[_0x1fea('0x31')](_0xe3dd73[_0x1fea('0x32')],_0xe3dd73['query']);_0x1d73d4['attributes']=_[_0x1fea('0x31')](_0xe3dd73[_0x1fea('0x32')],qs['fields'](_0x289931[_0x1fea('0x2f')]['fields']));_0x1d73d4['attributes']=_0x1d73d4[_0x1fea('0x33')][_0x1fea('0x34')]?_0x1d73d4[_0x1fea('0x33')]:_0xe3dd73[_0x1fea('0x32')];if(!_0x289931[_0x1fea('0x2f')][_0x1fea('0x35')](_0x1fea('0x36'))){_0x1d73d4[_0x1fea('0x1f')]=qs[_0x1fea('0x1f')](_0x289931[_0x1fea('0x2f')]['limit']);_0x1d73d4['offset']=qs['offset'](_0x289931[_0x1fea('0x2f')][_0x1fea('0x1c')]);}_0x1d73d4[_0x1fea('0x37')]=qs[_0x1fea('0x38')](_0x289931[_0x1fea('0x2f')][_0x1fea('0x38')]);_0x1d73d4['where']=qs[_0x1fea('0x30')](_[_0x1fea('0x39')](_0x289931[_0x1fea('0x2f')],_0xe3dd73[_0x1fea('0x30')]),_0x2640dd);if(_0x289931[_0x1fea('0x2f')][_0x1fea('0x3a')]){_0x1d73d4['where']=_[_0x1fea('0x3b')](_0x1d73d4['where'],{'$or':_['map'](_0x2640dd,function(_0x4b42c7){if(_0x4b42c7[_0x1fea('0x3c')]!=='VIRTUAL'){var _0xa275ac={};_0xa275ac[_0x4b42c7[_0x1fea('0x28')]]={'$like':'%'+_0x289931[_0x1fea('0x2f')][_0x1fea('0x3a')]+'%'};return _0xa275ac;}})});}_0x1d73d4=_[_0x1fea('0x3b')]({},_0x1d73d4,_0x289931[_0x1fea('0x3d')]);var _0x205fc6={'where':_0x1d73d4['where']};return db[_0x1fea('0x2b')][_0x1fea('0x1e')](_0x205fc6)['then'](function(_0x53bc26){_0x53fc21[_0x1fea('0x1e')]=_0x53bc26;if(_0x289931[_0x1fea('0x2f')]['includeAll']){_0x1d73d4[_0x1fea('0x3e')]=[{'all':!![]}];}return db['DeskAccount'][_0x1fea('0x3f')](_0x1d73d4);})[_0x1fea('0x26')](function(_0x1ca0c1){_0x53fc21[_0x1fea('0x40')]=_0x1ca0c1;return _0x53fc21;})['then'](respondWithFilteredResult(_0x1a5514,_0x1d73d4))[_0x1fea('0x41')](handleError(_0x1a5514,null));};exports[_0x1fea('0x42')]=function(_0x51a756,_0xa497f5){var _0xf6d079={'raw':![],'where':{'id':_0x51a756['params']['id']}},_0x1a4c30={};_0x1a4c30['model']=_[_0x1fea('0x43')](db[_0x1fea('0x2b')]['rawAttributes']);_0x1a4c30['query']=_[_0x1fea('0x43')](_0x51a756['query']);_0x1a4c30[_0x1fea('0x30')]=_[_0x1fea('0x31')](_0x1a4c30[_0x1fea('0x32')],_0x1a4c30[_0x1fea('0x2f')]);_0xf6d079['attributes']=_[_0x1fea('0x31')](_0x1a4c30[_0x1fea('0x32')],qs[_0x1fea('0x44')](_0x51a756['query']['fields']));_0xf6d079['attributes']=_0xf6d079[_0x1fea('0x33')]['length']?_0xf6d079['attributes']:_0x1a4c30[_0x1fea('0x32')];if(_0x51a756[_0x1fea('0x2f')]['includeAll']){_0xf6d079[_0x1fea('0x3e')]=[{'all':!![]}];}_0xf6d079=_[_0x1fea('0x3b')]({},_0xf6d079,_0x51a756[_0x1fea('0x3d')]);return db['DeskAccount'][_0x1fea('0x45')](_0xf6d079)[_0x1fea('0x26')](handleEntityNotFound(_0xa497f5,null))[_0x1fea('0x26')](respondWithResult(_0xa497f5,null))[_0x1fea('0x41')](handleError(_0xa497f5,null));};exports[_0x1fea('0x46')]=function(_0x3a3556,_0x53e388){return db[_0x1fea('0x2b')][_0x1fea('0x46')](_0x3a3556[_0x1fea('0x47')],{})[_0x1fea('0x26')](respondWithResult(_0x53e388,0xc9))[_0x1fea('0x41')](handleError(_0x53e388,null));};exports[_0x1fea('0x25')]=function(_0x12f7d0,_0x4fa33a){if(_0x12f7d0[_0x1fea('0x47')]['id']){delete _0x12f7d0[_0x1fea('0x47')]['id'];}return db[_0x1fea('0x2b')][_0x1fea('0x45')]({'where':{'id':_0x12f7d0[_0x1fea('0x48')]['id']}})[_0x1fea('0x26')](handleEntityNotFound(_0x4fa33a,null))[_0x1fea('0x26')](saveUpdates(_0x12f7d0[_0x1fea('0x47')],null))[_0x1fea('0x26')](respondWithResult(_0x4fa33a,null))[_0x1fea('0x41')](handleError(_0x4fa33a,null));};exports[_0x1fea('0x27')]=function(_0x500afe,_0x108ea6){return db[_0x1fea('0x2b')]['find']({'where':{'id':_0x500afe[_0x1fea('0x48')]['id']}})[_0x1fea('0x26')](handleEntityNotFound(_0x108ea6,null))[_0x1fea('0x26')](removeEntity(_0x108ea6,null))[_0x1fea('0x41')](handleError(_0x108ea6,null));};exports[_0x1fea('0x49')]=function(_0x19a1c0,_0x2b5c22,_0x111e91){var _0xffe9b5={};var _0x37b640={};var _0x51cc0a;var _0x13da35;return db['DeskAccount'][_0x1fea('0x4a')]({'where':{'id':_0x19a1c0[_0x1fea('0x48')]['id']}})[_0x1fea('0x26')](handleEntityNotFound(_0x2b5c22,null))[_0x1fea('0x26')](function(_0x564ec5){if(_0x564ec5){_0x51cc0a=_0x564ec5;_0x37b640['model']=_[_0x1fea('0x43')](db['DeskConfiguration'][_0x1fea('0x2c')]);_0x37b640[_0x1fea('0x2f')]=_[_0x1fea('0x43')](_0x19a1c0[_0x1fea('0x2f')]);_0x37b640['filters']=_[_0x1fea('0x31')](_0x37b640[_0x1fea('0x32')],_0x37b640[_0x1fea('0x2f')]);_0xffe9b5['attributes']=_['intersection'](_0x37b640['model'],qs['fields'](_0x19a1c0[_0x1fea('0x2f')][_0x1fea('0x44')]));_0xffe9b5[_0x1fea('0x33')]=_0xffe9b5['attributes'][_0x1fea('0x34')]?_0xffe9b5[_0x1fea('0x33')]:_0x37b640[_0x1fea('0x32')];_0xffe9b5[_0x1fea('0x37')]=qs[_0x1fea('0x38')](_0x19a1c0[_0x1fea('0x2f')]['sort']);_0xffe9b5[_0x1fea('0x4b')]=qs['filters'](_[_0x1fea('0x39')](_0x19a1c0['query'],_0x37b640[_0x1fea('0x30')]));if(_0x19a1c0[_0x1fea('0x2f')]['filter']){_0xffe9b5[_0x1fea('0x4b')]=_[_0x1fea('0x3b')](_0xffe9b5[_0x1fea('0x4b')],{'$or':_[_0x1fea('0x2e')](_0xffe9b5['attributes'],function(_0x350e8d){var _0x30219a={};_0x30219a[_0x350e8d]={'$like':'%'+_0x19a1c0[_0x1fea('0x2f')][_0x1fea('0x3a')]+'%'};return _0x30219a;})});}_0xffe9b5=_['merge']({},_0xffe9b5,_0x19a1c0[_0x1fea('0x3d')]);return _0x51cc0a[_0x1fea('0x49')](_0xffe9b5);}})['then'](function(_0xcfcfd0){if(_0xcfcfd0){_0x13da35=_0xcfcfd0[_0x1fea('0x34')];if(!_0x19a1c0[_0x1fea('0x2f')][_0x1fea('0x35')](_0x1fea('0x36'))){_0xffe9b5['limit']=qs[_0x1fea('0x1f')](_0x19a1c0[_0x1fea('0x2f')][_0x1fea('0x1f')]);_0xffe9b5[_0x1fea('0x1c')]=qs['offset'](_0x19a1c0[_0x1fea('0x2f')][_0x1fea('0x1c')]);}return _0x51cc0a[_0x1fea('0x49')](_0xffe9b5);}})[_0x1fea('0x26')](function(_0x193847){if(_0x193847){return _0x193847?{'count':_0x13da35,'rows':_0x193847}:null;}})[_0x1fea('0x26')](respondWithResult(_0x2b5c22,null))['catch'](handleError(_0x2b5c22,null));};exports[_0x1fea('0x4c')]=function(_0x451c2a,_0x512feb,_0x5e1d90){if(_0x451c2a[_0x1fea('0x47')]['id']){delete _0x451c2a[_0x1fea('0x47')]['id'];}return db[_0x1fea('0x2b')][_0x1fea('0x4a')]({'where':{'id':_0x451c2a['params']['id']}})[_0x1fea('0x26')](handleEntityNotFound(_0x512feb,null))[_0x1fea('0x26')](function(_0x4f7063){if(_0x4f7063){_0x451c2a[_0x1fea('0x47')][_0x1fea('0x4d')]=_0x4f7063['id'];_0x451c2a[_0x1fea('0x47')][_0x1fea('0x4e')]=integrations[_0x1fea('0x4f')](_0x451c2a[_0x1fea('0x47')]['channel'],_0x451c2a['body'][_0x1fea('0x3c')]);_0x451c2a[_0x1fea('0x47')][_0x1fea('0x50')]=integrations[_0x1fea('0x51')](_0x451c2a[_0x1fea('0x47')][_0x1fea('0x52')],_0x451c2a[_0x1fea('0x47')][_0x1fea('0x3c')]);return db['DeskConfiguration'][_0x1fea('0x46')](_0x451c2a[_0x1fea('0x47')],{'include':[{'model':db[_0x1fea('0x53')],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x1fea('0x26')](respondWithResult(_0x512feb,null))['catch'](handleError(_0x512feb,null));};exports['getFields']=function(_0x43c3c8,_0x8b3042,_0x270b5f){var _0x57d4c0=[{'name':_0x1fea('0x54'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x46fdd2='';return db[_0x1fea('0x2b')][_0x1fea('0x4a')]({'where':{'id':_0x43c3c8[_0x1fea('0x48')]['id']},'attributes':['id','remoteUri',_0x1fea('0x55'),_0x1fea('0x56'),_0x1fea('0x57'),_0x1fea('0x58'),_0x1fea('0x59'),_0x1fea('0x5a'),_0x1fea('0x5b')]})[_0x1fea('0x26')](handleEntityNotFound(_0x8b3042,null))[_0x1fea('0x26')](function(_0x468c72){if(_0x468c72){_0x46fdd2=_0x468c72[_0x1fea('0x5c')];var _0x43c9df=_0x46fdd2[_0x1fea('0x5d')](-0x1);if(_0x43c9df==='/'){_0x46fdd2=_0x46fdd2[_0x1fea('0x5e')](0x0,_0x46fdd2[_0x1fea('0x5f')](_0x43c9df));}var _0x2bb198={'method':_0x1fea('0x60'),'uri':util['format'](_0x1fea('0x61'),_0x46fdd2),'headers':{'Content-Type':_0x1fea('0x62'),'Accept':_0x1fea('0x62')},'json':!![]};if(_0x468c72[_0x1fea('0x55')]==='basic'){_0x2bb198[_0x1fea('0x63')][_0x1fea('0x64')]=util[_0x1fea('0x65')](_0x1fea('0x66'),new Buffer(util[_0x1fea('0x65')](_0x1fea('0x67'),_0x468c72[_0x1fea('0x56')],_0x468c72[_0x1fea('0x57')]))[_0x1fea('0x68')]('base64'));}return rp(_0x2bb198)[_0x1fea('0x26')](function(_0x1bd726){return _0x57d4c0[_0x1fea('0x69')](_[_0x1fea('0x2e')](_0x1bd726[_0x1fea('0x6a')]['entries'],function(_0x36145c){return{'id':_0x36145c[_0x1fea('0x28')],'name':_0x36145c[_0x1fea('0x28')],'type':_0x36145c['type'],'active':_0x36145c[_0x1fea('0x6b')],'label':_0x36145c[_0x1fea('0x6c')],'custom':!![]};}));});}})[_0x1fea('0x26')](function(_0x2c5b52){return{'count':_0x2c5b52[_0x1fea('0x34')],'rows':_0x2c5b52};})[_0x1fea('0x26')](respondWithResult(_0x8b3042,null))['catch'](function(_0x51f094){var _0x40dbca=_0x43c3c8[_0x1fea('0x2f')]['test']?0x1f4:_0x51f094['statusCode']||0x1f4;logger[_0x1fea('0x6d')](_0x1fea('0x6e'),_0x1fea('0x6f'),_0x40dbca,JSON[_0x1fea('0x70')](_0x51f094));delete _0x51f094['name'];if(_0x40dbca===0x191){_0x40dbca=0x190;}_0x8b3042[_0x1fea('0x19')](_0x40dbca)[_0x1fea('0x29')](_0x43c3c8['query'][_0x1fea('0x71')]?{'message':_0x1fea('0x72'),'statusCode':_0x51f094[_0x1fea('0x73')]}:_0x51f094);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3c6d54a..df9b768 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 _0xa263=['moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api'];(function(_0xc6857,_0x1ddbcc){var _0x2a650d=function(_0x1f93bf){while(--_0x1f93bf){_0xc6857['push'](_0xc6857['shift']());}};_0x2a650d(++_0x1ddbcc);}(_0xa263,0x1af));var _0x3a26=function(_0x33ae4d,_0x453318){_0x33ae4d=_0x33ae4d-0x0;var _0x1801d6=_0xa263[_0x33ae4d];return _0x1801d6;};'use strict';var _=require('lodash');var util=require(_0x3a26('0x0'));var logger=require(_0x3a26('0x1'))(_0x3a26('0x2'));var moment=require(_0x3a26('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a26('0x4'));var fs=require('fs');var path=require(_0x3a26('0x5'));var rimraf=require(_0x3a26('0x6'));var config=require(_0x3a26('0x7'));var attributes=require(_0x3a26('0x8'));var integrations=require(_0x3a26('0x9'));module[_0x3a26('0xa')]=function(_0x42b379,_0x6a7391){return _0x42b379[_0x3a26('0xb')](_0x3a26('0xc'),attributes,{'tableName':_0x3a26('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe771=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xe771,0x16a));var _0x1e77=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xe771[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require(_0x1e77('0x0'));var util=require(_0x1e77('0x1'));var logger=require(_0x1e77('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1e77('0x3'));var rp=require(_0x1e77('0x4'));var fs=require('fs');var path=require(_0x1e77('0x5'));var rimraf=require(_0x1e77('0x6'));var config=require(_0x1e77('0x7'));var attributes=require(_0x1e77('0x8'));var integrations=require(_0x1e77('0x9'));module[_0x1e77('0xa')]=function(_0x9113d1,_0x10838b){return _0x9113d1[_0x1e77('0xb')]('DeskAccount',attributes,{'tableName':_0x1e77('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 4acb833..90f0062 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 _0xbda0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowDeskAccount','find','lodash','util'];(function(_0x2ba445,_0x51829d){var _0x193e60=function(_0x2bbe84){while(--_0x2bbe84){_0x2ba445['push'](_0x2ba445['shift']());}};_0x193e60(++_0x51829d);}(_0xbda0,0xc1));var _0x0bda=function(_0xe6e723,_0x5af822){_0xe6e723=_0xe6e723-0x0;var _0x1585b3=_0xbda0[_0xe6e723];return _0x1585b3;};'use strict';var _=require(_0x0bda('0x0'));var util=require(_0x0bda('0x1'));var moment=require(_0x0bda('0x2'));var BPromise=require(_0x0bda('0x3'));var rs=require(_0x0bda('0x4'));var fs=require('fs');var Redis=require(_0x0bda('0x5'));var db=require(_0x0bda('0x6'))['db'];var utils=require(_0x0bda('0x7'));var logger=require(_0x0bda('0x8'))(_0x0bda('0x9'));var config=require('../../config/environment');var jayson=require(_0x0bda('0xa'));var client=jayson[_0x0bda('0xb')][_0x0bda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b68d2,_0x352df3,_0x17f428){return new BPromise(function(_0x51c959,_0x59731a){return client[_0x0bda('0xd')](_0x5b68d2,_0x17f428)[_0x0bda('0xe')](function(_0x3ad022){logger[_0x0bda('0xf')](_0x0bda('0x10'),_0x352df3,_0x0bda('0x11'));logger[_0x0bda('0x12')](_0x0bda('0x13'),_0x352df3,_0x0bda('0x11'),JSON[_0x0bda('0x14')](_0x3ad022));if(_0x3ad022['error']){if(_0x3ad022[_0x0bda('0x15')][_0x0bda('0x16')]===0x1f4){logger[_0x0bda('0x15')](_0x0bda('0x10'),_0x352df3,_0x3ad022[_0x0bda('0x15')][_0x0bda('0x17')]);return _0x59731a(_0x3ad022[_0x0bda('0x15')][_0x0bda('0x17')]);}logger[_0x0bda('0x15')](_0x0bda('0x10'),_0x352df3,_0x3ad022[_0x0bda('0x15')][_0x0bda('0x17')]);return _0x51c959(_0x3ad022[_0x0bda('0x15')]['message']);}else{logger[_0x0bda('0xf')](_0x0bda('0x10'),_0x352df3,_0x0bda('0x11'));_0x51c959(_0x3ad022[_0x0bda('0x18')][_0x0bda('0x17')]);}})[_0x0bda('0x19')](function(_0x876149){logger['error']('DeskAccount,\x20%s,\x20%s',_0x352df3,_0x876149);_0x59731a(_0x876149);});});}exports[_0x0bda('0x1a')]=function(_0x1a2444){var _0x3249ba=this;return new Promise(function(_0x315ed3,_0x3526dd){return db[_0x0bda('0x1b')][_0x0bda('0x1c')]({'raw':_0x1a2444['options']?_0x1a2444[_0x0bda('0x1d')][_0x0bda('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a2444[_0x0bda('0x1d')]?_0x1a2444[_0x0bda('0x1d')][_0x0bda('0x1f')]||null:null,'attributes':_0x1a2444[_0x0bda('0x1d')]?_0x1a2444['options']['attributes']||null:null,'limit':_0x1a2444[_0x0bda('0x1d')]?_0x1a2444[_0x0bda('0x1d')][_0x0bda('0x20')]||null:null,'include':_0x1a2444[_0x0bda('0x1d')]?_0x1a2444[_0x0bda('0x1d')][_0x0bda('0x21')]?_['map'](_0x1a2444[_0x0bda('0x1d')]['include'],function(_0x203678){return{'model':db[_0x203678['model']],'as':_0x203678['as'],'attributes':_0x203678['attributes'],'include':_0x203678['include']?_[_0x0bda('0x22')](_0x203678['include'],function(_0x3b5f70){return{'model':db[_0x3b5f70[_0x0bda('0x23')]],'as':_0x3b5f70['as'],'attributes':_0x3b5f70[_0x0bda('0x24')],'include':_0x3b5f70[_0x0bda('0x21')]?_[_0x0bda('0x22')](_0x3b5f70[_0x0bda('0x21')],function(_0x33b007){return{'model':db[_0x33b007[_0x0bda('0x23')]],'as':_0x33b007['as'],'attributes':_0x33b007[_0x0bda('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0bda('0xe')](function(_0x122967){logger[_0x0bda('0xf')](_0x0bda('0x1a'),_0x1a2444);logger['debug'](_0x0bda('0x1a'),_0x1a2444,JSON[_0x0bda('0x14')](_0x122967));_0x315ed3(_0x122967);})[_0x0bda('0x19')](function(_0x186ef8){logger[_0x0bda('0x15')](_0x0bda('0x1a'),_0x186ef8[_0x0bda('0x17')],_0x1a2444);_0x3526dd(_0x3249ba[_0x0bda('0x15')](0x1f4,_0x186ef8[_0x0bda('0x17')]));});});};exports[_0x0bda('0x25')]=function(_0x1fb2d3){var _0x145798=this;return new Promise(function(_0x4ffe67,_0x33e8b1){return db[_0x0bda('0x1b')][_0x0bda('0x26')]({'raw':_0x1fb2d3[_0x0bda('0x1d')]?_0x1fb2d3[_0x0bda('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1fb2d3[_0x0bda('0x1d')]?_0x1fb2d3['options'][_0x0bda('0x1f')]||null:null,'attributes':_0x1fb2d3[_0x0bda('0x1d')]?_0x1fb2d3['options'][_0x0bda('0x24')]||null:null,'include':_0x1fb2d3[_0x0bda('0x1d')]?_0x1fb2d3['options'][_0x0bda('0x21')]?_[_0x0bda('0x22')](_0x1fb2d3[_0x0bda('0x1d')]['include'],function(_0x43671e){return{'model':db[_0x43671e[_0x0bda('0x23')]],'as':_0x43671e['as'],'attributes':_0x43671e[_0x0bda('0x24')],'include':_0x43671e[_0x0bda('0x21')]?_[_0x0bda('0x22')](_0x43671e[_0x0bda('0x21')],function(_0x5f30f9){return{'model':db[_0x5f30f9[_0x0bda('0x23')]],'as':_0x5f30f9['as'],'attributes':_0x5f30f9[_0x0bda('0x24')],'include':_0x5f30f9[_0x0bda('0x21')]?_[_0x0bda('0x22')](_0x5f30f9[_0x0bda('0x21')],function(_0x1d4d94){return{'model':db[_0x1d4d94[_0x0bda('0x23')]],'as':_0x1d4d94['as'],'attributes':_0x1d4d94[_0x0bda('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0bda('0xe')](function(_0x6415f4){logger['info']('ShowDeskAccount',_0x1fb2d3);logger[_0x0bda('0x12')]('ShowDeskAccount',_0x1fb2d3,JSON[_0x0bda('0x14')](_0x6415f4));_0x4ffe67(_0x6415f4);})[_0x0bda('0x19')](function(_0x33ee95){logger[_0x0bda('0x15')]('ShowDeskAccount',_0x33ee95[_0x0bda('0x17')],_0x1fb2d3);_0x33e8b1(_0x145798[_0x0bda('0x15')](0x1f4,_0x33ee95[_0x0bda('0x17')]));});});}; \ No newline at end of file +var _0xae45=['code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowDeskAccount','find','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1d4611,_0x31e791){var _0x8873f2=function(_0x2cf427){while(--_0x2cf427){_0x1d4611['push'](_0x1d4611['shift']());}};_0x8873f2(++_0x31e791);}(_0xae45,0x13b));var _0x5ae4=function(_0x4de35e,_0x132642){_0x4de35e=_0x4de35e-0x0;var _0x525a81=_0xae45[_0x4de35e];return _0x525a81;};'use strict';var _=require(_0x5ae4('0x0'));var util=require(_0x5ae4('0x1'));var moment=require(_0x5ae4('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ae4('0x3'));var fs=require('fs');var Redis=require(_0x5ae4('0x4'));var db=require(_0x5ae4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ae4('0x6'))(_0x5ae4('0x7'));var config=require(_0x5ae4('0x8'));var jayson=require(_0x5ae4('0x9'));var client=jayson[_0x5ae4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfb9a57,_0x303ad2,_0x4b00a2){return new BPromise(function(_0x4dea4b,_0xa15b31){return client[_0x5ae4('0xb')](_0xfb9a57,_0x4b00a2)['then'](function(_0x413a97){logger[_0x5ae4('0xc')](_0x5ae4('0xd'),_0x303ad2,'request\x20sent');logger[_0x5ae4('0xe')](_0x5ae4('0xf'),_0x303ad2,_0x5ae4('0x10'),JSON['stringify'](_0x413a97));if(_0x413a97[_0x5ae4('0x11')]){if(_0x413a97[_0x5ae4('0x11')][_0x5ae4('0x12')]===0x1f4){logger[_0x5ae4('0x11')]('DeskAccount,\x20%s,\x20%s',_0x303ad2,_0x413a97[_0x5ae4('0x11')][_0x5ae4('0x13')]);return _0xa15b31(_0x413a97[_0x5ae4('0x11')][_0x5ae4('0x13')]);}logger[_0x5ae4('0x11')](_0x5ae4('0xd'),_0x303ad2,_0x413a97[_0x5ae4('0x11')][_0x5ae4('0x13')]);return _0x4dea4b(_0x413a97['error'][_0x5ae4('0x13')]);}else{logger[_0x5ae4('0xc')](_0x5ae4('0xd'),_0x303ad2,_0x5ae4('0x10'));_0x4dea4b(_0x413a97[_0x5ae4('0x14')][_0x5ae4('0x13')]);}})[_0x5ae4('0x15')](function(_0x174bd3){logger[_0x5ae4('0x11')](_0x5ae4('0xd'),_0x303ad2,_0x174bd3);_0xa15b31(_0x174bd3);});});}exports[_0x5ae4('0x16')]=function(_0x4c8e84){var _0x3a3387=this;return new Promise(function(_0x4a0f64,_0x3861a9){return db[_0x5ae4('0x17')][_0x5ae4('0x18')]({'raw':_0x4c8e84[_0x5ae4('0x19')]?_0x4c8e84[_0x5ae4('0x19')][_0x5ae4('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c8e84[_0x5ae4('0x19')]?_0x4c8e84['options'][_0x5ae4('0x1b')]||null:null,'attributes':_0x4c8e84[_0x5ae4('0x19')]?_0x4c8e84[_0x5ae4('0x19')][_0x5ae4('0x1c')]||null:null,'limit':_0x4c8e84['options']?_0x4c8e84[_0x5ae4('0x19')][_0x5ae4('0x1d')]||null:null,'include':_0x4c8e84[_0x5ae4('0x19')]?_0x4c8e84[_0x5ae4('0x19')][_0x5ae4('0x1e')]?_[_0x5ae4('0x1f')](_0x4c8e84[_0x5ae4('0x19')]['include'],function(_0x54c580){return{'model':db[_0x54c580[_0x5ae4('0x20')]],'as':_0x54c580['as'],'attributes':_0x54c580[_0x5ae4('0x1c')],'include':_0x54c580['include']?_['map'](_0x54c580[_0x5ae4('0x1e')],function(_0x417dc4){return{'model':db[_0x417dc4[_0x5ae4('0x20')]],'as':_0x417dc4['as'],'attributes':_0x417dc4[_0x5ae4('0x1c')],'include':_0x417dc4[_0x5ae4('0x1e')]?_[_0x5ae4('0x1f')](_0x417dc4[_0x5ae4('0x1e')],function(_0x111816){return{'model':db[_0x111816[_0x5ae4('0x20')]],'as':_0x111816['as'],'attributes':_0x111816[_0x5ae4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ae4('0x21')](function(_0x555143){logger['info']('GetDeskAccount',_0x4c8e84);logger[_0x5ae4('0xe')](_0x5ae4('0x16'),_0x4c8e84,JSON['stringify'](_0x555143));_0x4a0f64(_0x555143);})[_0x5ae4('0x15')](function(_0x19451d){logger['error'](_0x5ae4('0x16'),_0x19451d[_0x5ae4('0x13')],_0x4c8e84);_0x3861a9(_0x3a3387[_0x5ae4('0x11')](0x1f4,_0x19451d[_0x5ae4('0x13')]));});});};exports[_0x5ae4('0x22')]=function(_0x2108e8){var _0x79f9e=this;return new Promise(function(_0x17af9e,_0x5b07b6){return db[_0x5ae4('0x17')][_0x5ae4('0x23')]({'raw':_0x2108e8[_0x5ae4('0x19')]?_0x2108e8[_0x5ae4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2108e8[_0x5ae4('0x19')]?_0x2108e8[_0x5ae4('0x19')][_0x5ae4('0x1b')]||null:null,'attributes':_0x2108e8[_0x5ae4('0x19')]?_0x2108e8[_0x5ae4('0x19')][_0x5ae4('0x1c')]||null:null,'include':_0x2108e8[_0x5ae4('0x19')]?_0x2108e8['options'][_0x5ae4('0x1e')]?_['map'](_0x2108e8[_0x5ae4('0x19')]['include'],function(_0x485211){return{'model':db[_0x485211['model']],'as':_0x485211['as'],'attributes':_0x485211['attributes'],'include':_0x485211[_0x5ae4('0x1e')]?_[_0x5ae4('0x1f')](_0x485211[_0x5ae4('0x1e')],function(_0x5c69f1){return{'model':db[_0x5c69f1['model']],'as':_0x5c69f1['as'],'attributes':_0x5c69f1['attributes'],'include':_0x5c69f1[_0x5ae4('0x1e')]?_[_0x5ae4('0x1f')](_0x5c69f1[_0x5ae4('0x1e')],function(_0x10f207){return{'model':db[_0x10f207[_0x5ae4('0x20')]],'as':_0x10f207['as'],'attributes':_0x10f207['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c0766){logger['info'](_0x5ae4('0x22'),_0x2108e8);logger[_0x5ae4('0xe')](_0x5ae4('0x22'),_0x2108e8,JSON[_0x5ae4('0x24')](_0x2c0766));_0x17af9e(_0x2c0766);})['catch'](function(_0x1ab909){logger[_0x5ae4('0x11')](_0x5ae4('0x22'),_0x1ab909['message'],_0x2108e8);_0x5b07b6(_0x79f9e[_0x5ae4('0x11')](0x1f4,_0x1ab909['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 338d391..e2f83f4 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x55ca,0x126));var _0xa55c=function(_0x1e2072,_0xe3cc90){_0x1e2072=_0x1e2072-0x0;var _0x22956b=_0x55ca[_0x1e2072];return _0x22956b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x504a30,_0x20c835){var _0x5b2490=function(_0x28d3bd){while(--_0x28d3bd){_0x504a30['push'](_0x504a30['shift']());}};_0x5b2490(++_0x20c835);}(_0x008c,0x188));var _0xc008=function(_0x449e84,_0x505ae7){_0x449e84=_0x449e84-0x0;var _0x72d311=_0x008c[_0x449e84];return _0x72d311;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7588be3..7ff5e64 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 _0xd19b=['exports','STRING','sequelize'];(function(_0x31da7e,_0x1068d7){var _0x2f2b06=function(_0x5b2ef7){while(--_0x5b2ef7){_0x31da7e['push'](_0x31da7e['shift']());}};_0x2f2b06(++_0x1068d7);}(_0xd19b,0x18b));var _0xbd19=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xd19b[_0x2077c2];return _0x312f9f;};'use strict';var Sequelize=require(_0xbd19('0x0'));module[_0xbd19('0x1')]={'name':{'type':Sequelize[_0xbd19('0x2')]},'description':{'type':Sequelize[_0xbd19('0x2')]}}; \ No newline at end of file +var _0x6b7e=['exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6b7e,0x1b8));var _0xe6b7=function(_0x3b709e,_0x137757){_0x3b709e=_0x3b709e-0x0;var _0x41ab0=_0x6b7e[_0x3b709e];return _0x41ab0;};'use strict';var Sequelize=require('sequelize');module[_0xe6b7('0x0')]={'name':{'type':Sequelize[_0xe6b7('0x1')]},'description':{'type':Sequelize[_0xe6b7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b34fc15..8783690 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 _0x1e9e=['keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','merge','create','body','find','findOne','DeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','util','sox','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','key','model','query'];(function(_0x51c4a4,_0x57383a){var _0x393e9a=function(_0x4f5108){while(--_0x4f5108){_0x51c4a4['push'](_0x51c4a4['shift']());}};_0x393e9a(++_0x57383a);}(_0x1e9e,0x15e));var _0xe1e9=function(_0x52d1e7,_0x10d8ef){_0x52d1e7=_0x52d1e7-0x0;var _0x42b16f=_0x1e9e[_0x52d1e7];return _0x42b16f;};'use strict';var emlformat=require(_0xe1e9('0x0'));var rimraf=require(_0xe1e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe1e9('0x2'));var moment=require(_0xe1e9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1e9('0x4'));var path=require('path');var sox=require(_0xe1e9('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe1e9('0x6'));var jsforce=require(_0xe1e9('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xe1e9('0x8'));var querystring=require(_0xe1e9('0x9'));var Papa=require(_0xe1e9('0xa'));var Redis=require(_0xe1e9('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xe1e9('0xc'));var as=require(_0xe1e9('0xd'));var hardwareService=require(_0xe1e9('0xe'));var logger=require(_0xe1e9('0xf'))(_0xe1e9('0x10'));var utils=require('../../config/utils');var config=require(_0xe1e9('0x11'));var licenseUtil=require(_0xe1e9('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x522d21,_0x1eebcb){_0x1eebcb=_0x1eebcb||0xcc;return function(_0x4a50bc){if(_0x4a50bc){return _0x522d21['sendStatus'](_0x1eebcb);}return _0x522d21[_0xe1e9('0x13')](_0x1eebcb)[_0xe1e9('0x14')]();};}function respondWithResult(_0x286e13,_0x373e3e){_0x373e3e=_0x373e3e||0xc8;return function(_0xcf251a){if(_0xcf251a){return _0x286e13['status'](_0x373e3e)[_0xe1e9('0x15')](_0xcf251a);}};}function respondWithFilteredResult(_0xf45f20,_0x403587){return function(_0x55fb32){if(_0x55fb32){var _0x4e44ee=typeof _0x403587['offset']===_0xe1e9('0x16')&&typeof _0x403587[_0xe1e9('0x17')]==='undefined';var _0x1ee136=_0x55fb32[_0xe1e9('0x18')];var _0xa478e=_0x4e44ee?0x0:_0x403587[_0xe1e9('0x19')];var _0x27e780=_0x4e44ee?_0x55fb32[_0xe1e9('0x18')]:_0x403587[_0xe1e9('0x19')]+_0x403587['limit'];var _0x29471a;if(_0x27e780>=_0x1ee136){_0x27e780=_0x1ee136;_0x29471a=0xc8;}else{_0x29471a=0xce;}_0xf45f20[_0xe1e9('0x13')](_0x29471a);return _0xf45f20[_0xe1e9('0x1a')]('Content-Range',_0xa478e+'-'+_0x27e780+'/'+_0x1ee136)[_0xe1e9('0x15')](_0x55fb32);}return null;};}function patchUpdates(_0xe86ce1){return function(_0x2f8401){try{jsonpatch[_0xe1e9('0x1b')](_0x2f8401,_0xe86ce1,!![]);}catch(_0x300188){return BPromise[_0xe1e9('0x1c')](_0x300188);}return _0x2f8401[_0xe1e9('0x1d')]();};}function saveUpdates(_0x6cd0c8,_0x181e76){return function(_0x37266f){if(_0x37266f){return _0x37266f[_0xe1e9('0x1e')](_0x6cd0c8)[_0xe1e9('0x1f')](function(_0x16195c){return _0x16195c;});}return null;};}function removeEntity(_0x4bb443,_0xee837d){return function(_0x102b47){if(_0x102b47){return _0x102b47[_0xe1e9('0x20')]()['then'](function(){_0x4bb443['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x171b4a,_0xdb072e){return function(_0x4214fa){if(!_0x4214fa){_0x171b4a[_0xe1e9('0x21')](0x194);}return _0x4214fa;};}function handleError(_0x1a0005,_0x15653b){_0x15653b=_0x15653b||0x1f4;return function(_0x9cb9cd){logger[_0xe1e9('0x22')](_0x9cb9cd[_0xe1e9('0x23')]);if(_0x9cb9cd[_0xe1e9('0x24')]){delete _0x9cb9cd[_0xe1e9('0x24')];}_0x1a0005[_0xe1e9('0x13')](_0x15653b)[_0xe1e9('0x25')](_0x9cb9cd);};}exports['index']=function(_0x5f4eb0,_0x11d809){var _0x3d6d7a={},_0x53ce2f={},_0x28e501={'count':0x0,'rows':[]};var _0x95f842=_['map'](db[_0xe1e9('0x26')][_0xe1e9('0x27')],function(_0x477002){return{'name':_0x477002[_0xe1e9('0x28')],'type':_0x477002[_0xe1e9('0x29')][_0xe1e9('0x2a')]};});_0x53ce2f[_0xe1e9('0x2b')]=_['map'](_0x95f842,'name');_0x53ce2f[_0xe1e9('0x2c')]=_[_0xe1e9('0x2d')](_0x5f4eb0['query']);_0x53ce2f[_0xe1e9('0x2e')]=_['intersection'](_0x53ce2f[_0xe1e9('0x2b')],_0x53ce2f['query']);_0x3d6d7a[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0x53ce2f['model'],qs[_0xe1e9('0x31')](_0x5f4eb0['query'][_0xe1e9('0x31')]));_0x3d6d7a[_0xe1e9('0x2f')]=_0x3d6d7a[_0xe1e9('0x2f')]['length']?_0x3d6d7a[_0xe1e9('0x2f')]:_0x53ce2f['model'];if(!_0x5f4eb0[_0xe1e9('0x2c')]['hasOwnProperty'](_0xe1e9('0x32'))){_0x3d6d7a[_0xe1e9('0x17')]=qs[_0xe1e9('0x17')](_0x5f4eb0[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x3d6d7a[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0x5f4eb0['query']['offset']);}_0x3d6d7a[_0xe1e9('0x33')]=qs[_0xe1e9('0x34')](_0x5f4eb0['query']['sort']);_0x3d6d7a[_0xe1e9('0x35')]=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0x5f4eb0[_0xe1e9('0x2c')],_0x53ce2f[_0xe1e9('0x2e')]),_0x95f842);if(_0x5f4eb0[_0xe1e9('0x2c')][_0xe1e9('0x37')]){_0x3d6d7a[_0xe1e9('0x35')]=_['merge'](_0x3d6d7a[_0xe1e9('0x35')],{'$or':_[_0xe1e9('0x38')](_0x95f842,function(_0xcebfa5){if(_0xcebfa5['type']!==_0xe1e9('0x39')){var _0x162927={};_0x162927[_0xcebfa5[_0xe1e9('0x24')]]={'$like':'%'+_0x5f4eb0[_0xe1e9('0x2c')][_0xe1e9('0x37')]+'%'};return _0x162927;}})});}_0x3d6d7a=_['merge']({},_0x3d6d7a,_0x5f4eb0[_0xe1e9('0x3a')]);var _0x3a2377={'where':_0x3d6d7a[_0xe1e9('0x35')]};return db[_0xe1e9('0x26')][_0xe1e9('0x18')](_0x3a2377)[_0xe1e9('0x1f')](function(_0x27c174){_0x28e501[_0xe1e9('0x18')]=_0x27c174;if(_0x5f4eb0[_0xe1e9('0x2c')][_0xe1e9('0x3b')]){_0x3d6d7a[_0xe1e9('0x3c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xe1e9('0x3d')](_0x3d6d7a);})[_0xe1e9('0x1f')](function(_0x242f31){_0x28e501[_0xe1e9('0x3e')]=_0x242f31;return _0x28e501;})[_0xe1e9('0x1f')](respondWithFilteredResult(_0x11d809,_0x3d6d7a))[_0xe1e9('0x3f')](handleError(_0x11d809,null));};exports['show']=function(_0x3715b3,_0x3f95a9){var _0x47ffa9={'raw':![],'where':{'id':_0x3715b3[_0xe1e9('0x40')]['id']}},_0x73a410={};_0x73a410[_0xe1e9('0x2b')]=_[_0xe1e9('0x2d')](db[_0xe1e9('0x26')]['rawAttributes']);_0x73a410[_0xe1e9('0x2c')]=_[_0xe1e9('0x2d')](_0x3715b3[_0xe1e9('0x2c')]);_0x73a410[_0xe1e9('0x2e')]=_['intersection'](_0x73a410[_0xe1e9('0x2b')],_0x73a410[_0xe1e9('0x2c')]);_0x47ffa9['attributes']=_[_0xe1e9('0x30')](_0x73a410[_0xe1e9('0x2b')],qs[_0xe1e9('0x31')](_0x3715b3[_0xe1e9('0x2c')][_0xe1e9('0x31')]));_0x47ffa9['attributes']=_0x47ffa9['attributes'][_0xe1e9('0x41')]?_0x47ffa9['attributes']:_0x73a410[_0xe1e9('0x2b')];if(_0x3715b3[_0xe1e9('0x2c')][_0xe1e9('0x3b')]){_0x47ffa9[_0xe1e9('0x3c')]=[{'all':!![]}];}_0x47ffa9=_[_0xe1e9('0x42')]({},_0x47ffa9,_0x3715b3[_0xe1e9('0x3a')]);return db[_0xe1e9('0x26')]['find'](_0x47ffa9)[_0xe1e9('0x1f')](handleEntityNotFound(_0x3f95a9,null))[_0xe1e9('0x1f')](respondWithResult(_0x3f95a9,null))[_0xe1e9('0x3f')](handleError(_0x3f95a9,null));};exports[_0xe1e9('0x43')]=function(_0x23c5fd,_0x7b4ef5){return db[_0xe1e9('0x26')][_0xe1e9('0x43')](_0x23c5fd[_0xe1e9('0x44')],{})['then'](respondWithResult(_0x7b4ef5,0xc9))[_0xe1e9('0x3f')](handleError(_0x7b4ef5,null));};exports[_0xe1e9('0x1e')]=function(_0x419a9e,_0x16b0fd){if(_0x419a9e[_0xe1e9('0x44')]['id']){delete _0x419a9e[_0xe1e9('0x44')]['id'];}return db['DeskConfiguration'][_0xe1e9('0x45')]({'where':{'id':_0x419a9e[_0xe1e9('0x40')]['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x16b0fd,null))['then'](saveUpdates(_0x419a9e['body'],null))[_0xe1e9('0x1f')](respondWithResult(_0x16b0fd,null))[_0xe1e9('0x3f')](handleError(_0x16b0fd,null));};exports[_0xe1e9('0x20')]=function(_0x33b81f,_0x12fc28){return db[_0xe1e9('0x26')][_0xe1e9('0x45')]({'where':{'id':_0x33b81f[_0xe1e9('0x40')]['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x12fc28,null))['then'](removeEntity(_0x12fc28,null))[_0xe1e9('0x3f')](handleError(_0x12fc28,null));};exports['getFields']=function(_0x4ddd8b,_0x5753d5,_0xa13c15){var _0x464789={};var _0x51bb7a={};var _0x110a21;var _0x3f79a5;return db[_0xe1e9('0x26')][_0xe1e9('0x46')]({'where':{'id':_0x4ddd8b['params']['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x5753d5,null))[_0xe1e9('0x1f')](function(_0x58cc13){if(_0x58cc13){_0x110a21=_0x58cc13;_0x51bb7a[_0xe1e9('0x2b')]=_['keys'](db[_0xe1e9('0x47')][_0xe1e9('0x27')]);_0x51bb7a[_0xe1e9('0x2c')]=_[_0xe1e9('0x2d')](_0x4ddd8b[_0xe1e9('0x2c')]);_0x51bb7a[_0xe1e9('0x2e')]=_[_0xe1e9('0x30')](_0x51bb7a[_0xe1e9('0x2b')],_0x51bb7a[_0xe1e9('0x2c')]);_0x464789[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0x51bb7a['model'],qs['fields'](_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x31')]));_0x464789[_0xe1e9('0x2f')]=_0x464789['attributes'][_0xe1e9('0x41')]?_0x464789[_0xe1e9('0x2f')]:_0x51bb7a['model'];_0x464789[_0xe1e9('0x33')]=qs['sort'](_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x34')]);_0x464789[_0xe1e9('0x35')]=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0x4ddd8b[_0xe1e9('0x2c')],_0x51bb7a[_0xe1e9('0x2e')]));if(_0x4ddd8b['query'][_0xe1e9('0x37')]){_0x464789[_0xe1e9('0x35')]=_['merge'](_0x464789['where'],{'$or':_[_0xe1e9('0x38')](_0x464789['attributes'],function(_0x199a07){var _0x44dfaa={};_0x44dfaa[_0x199a07]={'$like':'%'+_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x37')]+'%'};return _0x44dfaa;})});}_0x464789=_[_0xe1e9('0x42')]({},_0x464789,_0x4ddd8b[_0xe1e9('0x3a')]);return _0x110a21[_0xe1e9('0x48')](_0x464789);}})['then'](function(_0x287e6b){if(_0x287e6b){_0x3f79a5=_0x287e6b[_0xe1e9('0x41')];if(!_0x4ddd8b['query'][_0xe1e9('0x49')](_0xe1e9('0x32'))){_0x464789['limit']=qs[_0xe1e9('0x17')](_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x464789[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x19')]);}return _0x110a21[_0xe1e9('0x48')](_0x464789);}})[_0xe1e9('0x1f')](function(_0x3d6eba){if(_0x3d6eba){return _0x3d6eba?{'count':_0x3f79a5,'rows':_0x3d6eba}:null;}})['then'](respondWithResult(_0x5753d5,null))[_0xe1e9('0x3f')](handleError(_0x5753d5,null));};exports[_0xe1e9('0x4a')]=function(_0xc05b2e,_0x151fdd,_0x1d3dcc){var _0x474614={};var _0x193623={};var _0x439ad3;var _0x5f2d1b;return db[_0xe1e9('0x26')][_0xe1e9('0x46')]({'where':{'id':_0xc05b2e[_0xe1e9('0x40')]['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x151fdd,null))['then'](function(_0x5655c8){if(_0x5655c8){_0x439ad3=_0x5655c8;_0x193623[_0xe1e9('0x2b')]=_[_0xe1e9('0x2d')](db[_0xe1e9('0x47')][_0xe1e9('0x27')]);_0x193623[_0xe1e9('0x2c')]=_[_0xe1e9('0x2d')](_0xc05b2e[_0xe1e9('0x2c')]);_0x193623[_0xe1e9('0x2e')]=_[_0xe1e9('0x30')](_0x193623[_0xe1e9('0x2b')],_0x193623['query']);_0x474614[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0x193623['model'],qs[_0xe1e9('0x31')](_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x31')]));_0x474614[_0xe1e9('0x2f')]=_0x474614[_0xe1e9('0x2f')]['length']?_0x474614[_0xe1e9('0x2f')]:_0x193623[_0xe1e9('0x2b')];_0x474614['order']=qs[_0xe1e9('0x34')](_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x34')]);_0x474614['where']=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0xc05b2e['query'],_0x193623['filters']));if(_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x37')]){_0x474614['where']=_[_0xe1e9('0x42')](_0x474614[_0xe1e9('0x35')],{'$or':_[_0xe1e9('0x38')](_0x474614['attributes'],function(_0x5554f4){var _0x3e34dd={};_0x3e34dd[_0x5554f4]={'$like':'%'+_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x37')]+'%'};return _0x3e34dd;})});}_0x474614=_[_0xe1e9('0x42')]({},_0x474614,_0xc05b2e[_0xe1e9('0x3a')]);return _0x439ad3[_0xe1e9('0x4a')](_0x474614);}})[_0xe1e9('0x1f')](function(_0x49d805){if(_0x49d805){_0x5f2d1b=_0x49d805[_0xe1e9('0x41')];if(!_0xc05b2e['query'][_0xe1e9('0x49')]('nolimit')){_0x474614['limit']=qs['limit'](_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x474614[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x19')]);}return _0x439ad3[_0xe1e9('0x4a')](_0x474614);}})['then'](function(_0x34ec00){if(_0x34ec00){return _0x34ec00?{'count':_0x5f2d1b,'rows':_0x34ec00}:null;}})[_0xe1e9('0x1f')](respondWithResult(_0x151fdd,null))[_0xe1e9('0x3f')](handleError(_0x151fdd,null));};exports['getDescriptions']=function(_0x57d540,_0x470d70,_0x4d2ce8){var _0x20d55d={};var _0xc3f6c2={};var _0x281818;var _0xb317cb;return db[_0xe1e9('0x26')]['findOne']({'where':{'id':_0x57d540['params']['id']}})['then'](handleEntityNotFound(_0x470d70,null))[_0xe1e9('0x1f')](function(_0x4b0daf){if(_0x4b0daf){_0x281818=_0x4b0daf;_0xc3f6c2[_0xe1e9('0x2b')]=_['keys'](db[_0xe1e9('0x47')][_0xe1e9('0x27')]);_0xc3f6c2[_0xe1e9('0x2c')]=_['keys'](_0x57d540['query']);_0xc3f6c2[_0xe1e9('0x2e')]=_['intersection'](_0xc3f6c2[_0xe1e9('0x2b')],_0xc3f6c2['query']);_0x20d55d[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0xc3f6c2[_0xe1e9('0x2b')],qs[_0xe1e9('0x31')](_0x57d540['query'][_0xe1e9('0x31')]));_0x20d55d[_0xe1e9('0x2f')]=_0x20d55d[_0xe1e9('0x2f')]['length']?_0x20d55d['attributes']:_0xc3f6c2['model'];_0x20d55d['order']=qs['sort'](_0x57d540[_0xe1e9('0x2c')][_0xe1e9('0x34')]);_0x20d55d[_0xe1e9('0x35')]=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0x57d540['query'],_0xc3f6c2[_0xe1e9('0x2e')]));if(_0x57d540[_0xe1e9('0x2c')][_0xe1e9('0x37')]){_0x20d55d['where']=_['merge'](_0x20d55d[_0xe1e9('0x35')],{'$or':_[_0xe1e9('0x38')](_0x20d55d[_0xe1e9('0x2f')],function(_0x58c57b){var _0x5c848b={};_0x5c848b[_0x58c57b]={'$like':'%'+_0x57d540['query'][_0xe1e9('0x37')]+'%'};return _0x5c848b;})});}_0x20d55d=_['merge']({},_0x20d55d,_0x57d540[_0xe1e9('0x3a')]);return _0x281818['getDescriptions'](_0x20d55d);}})['then'](function(_0x48b952){if(_0x48b952){_0xb317cb=_0x48b952[_0xe1e9('0x41')];if(!_0x57d540['query'][_0xe1e9('0x49')](_0xe1e9('0x32'))){_0x20d55d[_0xe1e9('0x17')]=qs[_0xe1e9('0x17')](_0x57d540[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x20d55d[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0x57d540[_0xe1e9('0x2c')][_0xe1e9('0x19')]);}return _0x281818[_0xe1e9('0x4b')](_0x20d55d);}})[_0xe1e9('0x1f')](function(_0x5ea626){if(_0x5ea626){return _0x5ea626?{'count':_0xb317cb,'rows':_0x5ea626}:null;}})['then'](respondWithResult(_0x470d70,null))[_0xe1e9('0x3f')](handleError(_0x470d70,null));};exports['getTags']=function(_0xb41087,_0x4d42b1,_0x52fcfa){var _0x13446d={};var _0x331e7b={};var _0x16b77f;var _0x23b98b;return db[_0xe1e9('0x26')][_0xe1e9('0x46')]({'where':{'id':_0xb41087['params']['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x4d42b1,null))[_0xe1e9('0x1f')](function(_0x49bf62){if(_0x49bf62){_0x16b77f=_0x49bf62;_0x331e7b[_0xe1e9('0x2b')]=_['keys'](db[_0xe1e9('0x4c')][_0xe1e9('0x27')]);_0x331e7b['query']=_['keys'](_0xb41087[_0xe1e9('0x2c')]);_0x331e7b['filters']=_[_0xe1e9('0x30')](_0x331e7b['model'],_0x331e7b[_0xe1e9('0x2c')]);_0x13446d['attributes']=_[_0xe1e9('0x30')](_0x331e7b[_0xe1e9('0x2b')],qs[_0xe1e9('0x31')](_0xb41087[_0xe1e9('0x2c')]['fields']));_0x13446d['attributes']=_0x13446d[_0xe1e9('0x2f')][_0xe1e9('0x41')]?_0x13446d[_0xe1e9('0x2f')]:_0x331e7b[_0xe1e9('0x2b')];_0x13446d[_0xe1e9('0x33')]=qs[_0xe1e9('0x34')](_0xb41087[_0xe1e9('0x2c')][_0xe1e9('0x34')]);_0x13446d[_0xe1e9('0x35')]=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0xb41087[_0xe1e9('0x2c')],_0x331e7b[_0xe1e9('0x2e')]));if(_0xb41087[_0xe1e9('0x2c')][_0xe1e9('0x37')]){_0x13446d[_0xe1e9('0x35')]=_[_0xe1e9('0x42')](_0x13446d[_0xe1e9('0x35')],{'$or':_['map'](_0x13446d[_0xe1e9('0x2f')],function(_0x491be5){var _0x52c2a7={};_0x52c2a7[_0x491be5]={'$like':'%'+_0xb41087[_0xe1e9('0x2c')]['filter']+'%'};return _0x52c2a7;})});}_0x13446d=_[_0xe1e9('0x42')]({},_0x13446d,_0xb41087[_0xe1e9('0x3a')]);return _0x16b77f['getTags'](_0x13446d);}})[_0xe1e9('0x1f')](function(_0x47f6d4){if(_0x47f6d4){_0x23b98b=_0x47f6d4['length'];if(!_0xb41087[_0xe1e9('0x2c')]['hasOwnProperty'](_0xe1e9('0x32'))){_0x13446d[_0xe1e9('0x17')]=qs['limit'](_0xb41087[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x13446d[_0xe1e9('0x19')]=qs['offset'](_0xb41087['query'][_0xe1e9('0x19')]);}return _0x16b77f['getTags'](_0x13446d);}})[_0xe1e9('0x1f')](function(_0x2faa65){if(_0x2faa65){return _0x2faa65?{'count':_0x23b98b,'rows':_0x2faa65}:null;}})['then'](respondWithResult(_0x4d42b1,null))['catch'](handleError(_0x4d42b1,null));};exports[_0xe1e9('0x4d')]=function(_0xebb6d3,_0x207a19,_0x102b2a){if(_0xebb6d3[_0xe1e9('0x44')]['id']){delete _0xebb6d3['body']['id'];}return db['DeskConfiguration'][_0xe1e9('0x46')]({'where':{'id':_0xebb6d3[_0xe1e9('0x40')]['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x207a19,null))[_0xe1e9('0x1f')](function(_0x2f7e96){if(_0x2f7e96){return _0x2f7e96[_0xe1e9('0x4d')](_0xebb6d3[_0xe1e9('0x44')][_0xe1e9('0x4e')]||[]);}return null;})[_0xe1e9('0x1f')](respondWithResult(_0x207a19,null))[_0xe1e9('0x3f')](handleError(_0x207a19,null));}; \ No newline at end of file +var _0x261d=['error','stack','send','DeskConfiguration','rawAttributes','type','key','model','map','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','DeskField','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x261d,0x131));var _0xd261=function(_0x1471e4,_0x29b559){_0x1471e4=_0x1471e4-0x0;var _0x42e5a2=_0x261d[_0x1471e4];return _0x42e5a2;};'use strict';var emlformat=require(_0xd261('0x0'));var rimraf=require(_0xd261('0x1'));var zipdir=require(_0xd261('0x2'));var jsonpatch=require(_0xd261('0x3'));var rp=require(_0xd261('0x4'));var moment=require(_0xd261('0x5'));var BPromise=require(_0xd261('0x6'));var Mustache=require(_0xd261('0x7'));var util=require(_0xd261('0x8'));var path=require(_0xd261('0x9'));var sox=require(_0xd261('0xa'));var csv=require(_0xd261('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd261('0xc'));var _=require(_0xd261('0xd'));var squel=require(_0xd261('0xe'));var crypto=require('crypto');var jsforce=require(_0xd261('0xf'));var deskjs=require(_0xd261('0x10'));var toCsv=require(_0xd261('0xb'));var querystring=require('querystring');var Papa=require(_0xd261('0x11'));var Redis=require('ioredis');var authService=require(_0xd261('0x12'));var qs=require(_0xd261('0x13'));var as=require(_0xd261('0x14'));var hardwareService=require(_0xd261('0x15'));var logger=require(_0xd261('0x16'))(_0xd261('0x17'));var utils=require(_0xd261('0x18'));var config=require(_0xd261('0x19'));var licenseUtil=require(_0xd261('0x1a'));var db=require(_0xd261('0x1b'))['db'];function respondWithStatusCode(_0x687b2e,_0x31eafe){_0x31eafe=_0x31eafe||0xcc;return function(_0x125e39){if(_0x125e39){return _0x687b2e[_0xd261('0x1c')](_0x31eafe);}return _0x687b2e[_0xd261('0x1d')](_0x31eafe)[_0xd261('0x1e')]();};}function respondWithResult(_0x454381,_0x166775){_0x166775=_0x166775||0xc8;return function(_0xc481be){if(_0xc481be){return _0x454381[_0xd261('0x1d')](_0x166775)[_0xd261('0x1f')](_0xc481be);}};}function respondWithFilteredResult(_0x4af572,_0x38551e){return function(_0x5b49fc){if(_0x5b49fc){var _0x2c34a8=typeof _0x38551e['offset']==='undefined'&&typeof _0x38551e['limit']===_0xd261('0x20');var _0x55ed57=_0x5b49fc[_0xd261('0x21')];var _0x97dbd4=_0x2c34a8?0x0:_0x38551e[_0xd261('0x22')];var _0xc10c00=_0x2c34a8?_0x5b49fc['count']:_0x38551e[_0xd261('0x22')]+_0x38551e[_0xd261('0x23')];var _0x498a52;if(_0xc10c00>=_0x55ed57){_0xc10c00=_0x55ed57;_0x498a52=0xc8;}else{_0x498a52=0xce;}_0x4af572[_0xd261('0x1d')](_0x498a52);return _0x4af572[_0xd261('0x24')](_0xd261('0x25'),_0x97dbd4+'-'+_0xc10c00+'/'+_0x55ed57)[_0xd261('0x1f')](_0x5b49fc);}return null;};}function patchUpdates(_0x5835f2){return function(_0xfe0ea6){try{jsonpatch[_0xd261('0x26')](_0xfe0ea6,_0x5835f2,!![]);}catch(_0x476f61){return BPromise[_0xd261('0x27')](_0x476f61);}return _0xfe0ea6['save']();};}function saveUpdates(_0x12ea0b,_0x2e40d5){return function(_0x53792b){if(_0x53792b){return _0x53792b[_0xd261('0x28')](_0x12ea0b)['then'](function(_0x147f4b){return _0x147f4b;});}return null;};}function removeEntity(_0x1f1e07,_0x1bb400){return function(_0x13379b){if(_0x13379b){return _0x13379b[_0xd261('0x29')]()[_0xd261('0x2a')](function(){_0x1f1e07[_0xd261('0x1d')](0xcc)[_0xd261('0x1e')]();});}};}function handleEntityNotFound(_0x1549a6,_0xaa7fac){return function(_0x5568ef){if(!_0x5568ef){_0x1549a6['sendStatus'](0x194);}return _0x5568ef;};}function handleError(_0x3adf5c,_0x56257a){_0x56257a=_0x56257a||0x1f4;return function(_0x3623da){logger[_0xd261('0x2b')](_0x3623da[_0xd261('0x2c')]);if(_0x3623da['name']){delete _0x3623da['name'];}_0x3adf5c[_0xd261('0x1d')](_0x56257a)[_0xd261('0x2d')](_0x3623da);};}exports['index']=function(_0x9f2670,_0x156ad6){var _0x173a61={},_0x2e0b4d={},_0x3d6911={'count':0x0,'rows':[]};var _0x36c25a=_['map'](db[_0xd261('0x2e')][_0xd261('0x2f')],function(_0x5dab47){return{'name':_0x5dab47['fieldName'],'type':_0x5dab47[_0xd261('0x30')][_0xd261('0x31')]};});_0x2e0b4d[_0xd261('0x32')]=_[_0xd261('0x33')](_0x36c25a,_0xd261('0x34'));_0x2e0b4d['query']=_[_0xd261('0x35')](_0x9f2670[_0xd261('0x36')]);_0x2e0b4d[_0xd261('0x37')]=_['intersection'](_0x2e0b4d[_0xd261('0x32')],_0x2e0b4d[_0xd261('0x36')]);_0x173a61[_0xd261('0x38')]=_[_0xd261('0x39')](_0x2e0b4d[_0xd261('0x32')],qs[_0xd261('0x3a')](_0x9f2670[_0xd261('0x36')]['fields']));_0x173a61[_0xd261('0x38')]=_0x173a61[_0xd261('0x38')][_0xd261('0x3b')]?_0x173a61[_0xd261('0x38')]:_0x2e0b4d[_0xd261('0x32')];if(!_0x9f2670[_0xd261('0x36')][_0xd261('0x3c')](_0xd261('0x3d'))){_0x173a61[_0xd261('0x23')]=qs[_0xd261('0x23')](_0x9f2670[_0xd261('0x36')][_0xd261('0x23')]);_0x173a61[_0xd261('0x22')]=qs[_0xd261('0x22')](_0x9f2670[_0xd261('0x36')][_0xd261('0x22')]);}_0x173a61[_0xd261('0x3e')]=qs[_0xd261('0x3f')](_0x9f2670['query'][_0xd261('0x3f')]);_0x173a61[_0xd261('0x40')]=qs[_0xd261('0x37')](_[_0xd261('0x41')](_0x9f2670[_0xd261('0x36')],_0x2e0b4d[_0xd261('0x37')]),_0x36c25a);if(_0x9f2670[_0xd261('0x36')][_0xd261('0x42')]){_0x173a61['where']=_[_0xd261('0x43')](_0x173a61['where'],{'$or':_[_0xd261('0x33')](_0x36c25a,function(_0x162359){if(_0x162359[_0xd261('0x30')]!==_0xd261('0x44')){var _0x542137={};_0x542137[_0x162359[_0xd261('0x34')]]={'$like':'%'+_0x9f2670['query'][_0xd261('0x42')]+'%'};return _0x542137;}})});}_0x173a61=_[_0xd261('0x43')]({},_0x173a61,_0x9f2670[_0xd261('0x45')]);var _0x206da9={'where':_0x173a61[_0xd261('0x40')]};return db[_0xd261('0x2e')]['count'](_0x206da9)[_0xd261('0x2a')](function(_0x4a9ba8){_0x3d6911[_0xd261('0x21')]=_0x4a9ba8;if(_0x9f2670[_0xd261('0x36')]['includeAll']){_0x173a61[_0xd261('0x46')]=[{'all':!![]}];}return db[_0xd261('0x2e')][_0xd261('0x47')](_0x173a61);})[_0xd261('0x2a')](function(_0x79e486){_0x3d6911['rows']=_0x79e486;return _0x3d6911;})[_0xd261('0x2a')](respondWithFilteredResult(_0x156ad6,_0x173a61))[_0xd261('0x48')](handleError(_0x156ad6,null));};exports[_0xd261('0x49')]=function(_0x4c8d68,_0x1ee28f){var _0x539a72={'raw':![],'where':{'id':_0x4c8d68[_0xd261('0x4a')]['id']}},_0x113e48={};_0x113e48['model']=_[_0xd261('0x35')](db[_0xd261('0x2e')][_0xd261('0x2f')]);_0x113e48['query']=_[_0xd261('0x35')](_0x4c8d68['query']);_0x113e48[_0xd261('0x37')]=_[_0xd261('0x39')](_0x113e48[_0xd261('0x32')],_0x113e48['query']);_0x539a72['attributes']=_[_0xd261('0x39')](_0x113e48['model'],qs[_0xd261('0x3a')](_0x4c8d68[_0xd261('0x36')]['fields']));_0x539a72[_0xd261('0x38')]=_0x539a72[_0xd261('0x38')]['length']?_0x539a72[_0xd261('0x38')]:_0x113e48['model'];if(_0x4c8d68[_0xd261('0x36')][_0xd261('0x4b')]){_0x539a72[_0xd261('0x46')]=[{'all':!![]}];}_0x539a72=_[_0xd261('0x43')]({},_0x539a72,_0x4c8d68[_0xd261('0x45')]);return db[_0xd261('0x2e')][_0xd261('0x4c')](_0x539a72)[_0xd261('0x2a')](handleEntityNotFound(_0x1ee28f,null))[_0xd261('0x2a')](respondWithResult(_0x1ee28f,null))[_0xd261('0x48')](handleError(_0x1ee28f,null));};exports[_0xd261('0x4d')]=function(_0x562ab8,_0x163774){return db[_0xd261('0x2e')]['create'](_0x562ab8[_0xd261('0x4e')],{})['then'](respondWithResult(_0x163774,0xc9))[_0xd261('0x48')](handleError(_0x163774,null));};exports[_0xd261('0x28')]=function(_0x3c6a93,_0x100f91){if(_0x3c6a93[_0xd261('0x4e')]['id']){delete _0x3c6a93['body']['id'];}return db[_0xd261('0x2e')]['find']({'where':{'id':_0x3c6a93[_0xd261('0x4a')]['id']}})[_0xd261('0x2a')](handleEntityNotFound(_0x100f91,null))[_0xd261('0x2a')](saveUpdates(_0x3c6a93[_0xd261('0x4e')],null))[_0xd261('0x2a')](respondWithResult(_0x100f91,null))[_0xd261('0x48')](handleError(_0x100f91,null));};exports[_0xd261('0x29')]=function(_0x3e988b,_0x5ca3a2){return db[_0xd261('0x2e')][_0xd261('0x4c')]({'where':{'id':_0x3e988b[_0xd261('0x4a')]['id']}})[_0xd261('0x2a')](handleEntityNotFound(_0x5ca3a2,null))[_0xd261('0x2a')](removeEntity(_0x5ca3a2,null))['catch'](handleError(_0x5ca3a2,null));};exports['getFields']=function(_0x184e3a,_0x3597f0,_0x4d0f54){var _0x23c13f={};var _0x40f40d={};var _0x525c7e;var _0x26536b;return db[_0xd261('0x2e')]['findOne']({'where':{'id':_0x184e3a[_0xd261('0x4a')]['id']}})[_0xd261('0x2a')](handleEntityNotFound(_0x3597f0,null))[_0xd261('0x2a')](function(_0x13189c){if(_0x13189c){_0x525c7e=_0x13189c;_0x40f40d[_0xd261('0x32')]=_['keys'](db[_0xd261('0x4f')]['rawAttributes']);_0x40f40d[_0xd261('0x36')]=_[_0xd261('0x35')](_0x184e3a[_0xd261('0x36')]);_0x40f40d['filters']=_[_0xd261('0x39')](_0x40f40d['model'],_0x40f40d[_0xd261('0x36')]);_0x23c13f[_0xd261('0x38')]=_[_0xd261('0x39')](_0x40f40d[_0xd261('0x32')],qs[_0xd261('0x3a')](_0x184e3a[_0xd261('0x36')][_0xd261('0x3a')]));_0x23c13f[_0xd261('0x38')]=_0x23c13f[_0xd261('0x38')][_0xd261('0x3b')]?_0x23c13f[_0xd261('0x38')]:_0x40f40d['model'];_0x23c13f['order']=qs[_0xd261('0x3f')](_0x184e3a['query']['sort']);_0x23c13f[_0xd261('0x40')]=qs[_0xd261('0x37')](_['pick'](_0x184e3a[_0xd261('0x36')],_0x40f40d[_0xd261('0x37')]));if(_0x184e3a[_0xd261('0x36')][_0xd261('0x42')]){_0x23c13f[_0xd261('0x40')]=_[_0xd261('0x43')](_0x23c13f[_0xd261('0x40')],{'$or':_[_0xd261('0x33')](_0x23c13f[_0xd261('0x38')],function(_0x5947bd){var _0x440f8d={};_0x440f8d[_0x5947bd]={'$like':'%'+_0x184e3a['query']['filter']+'%'};return _0x440f8d;})});}_0x23c13f=_[_0xd261('0x43')]({},_0x23c13f,_0x184e3a['options']);return _0x525c7e[_0xd261('0x50')](_0x23c13f);}})['then'](function(_0x5a0dd7){if(_0x5a0dd7){_0x26536b=_0x5a0dd7[_0xd261('0x3b')];if(!_0x184e3a[_0xd261('0x36')][_0xd261('0x3c')](_0xd261('0x3d'))){_0x23c13f[_0xd261('0x23')]=qs[_0xd261('0x23')](_0x184e3a[_0xd261('0x36')][_0xd261('0x23')]);_0x23c13f[_0xd261('0x22')]=qs['offset'](_0x184e3a[_0xd261('0x36')][_0xd261('0x22')]);}return _0x525c7e[_0xd261('0x50')](_0x23c13f);}})['then'](function(_0x418e1f){if(_0x418e1f){return _0x418e1f?{'count':_0x26536b,'rows':_0x418e1f}:null;}})[_0xd261('0x2a')](respondWithResult(_0x3597f0,null))[_0xd261('0x48')](handleError(_0x3597f0,null));};exports[_0xd261('0x51')]=function(_0x2aec79,_0x9493be,_0x4a2bde){var _0x262033={};var _0x3b3f19={};var _0x8d0659;var _0x2d4501;return db[_0xd261('0x2e')][_0xd261('0x52')]({'where':{'id':_0x2aec79['params']['id']}})[_0xd261('0x2a')](handleEntityNotFound(_0x9493be,null))['then'](function(_0x1d0eb0){if(_0x1d0eb0){_0x8d0659=_0x1d0eb0;_0x3b3f19[_0xd261('0x32')]=_[_0xd261('0x35')](db[_0xd261('0x4f')][_0xd261('0x2f')]);_0x3b3f19[_0xd261('0x36')]=_[_0xd261('0x35')](_0x2aec79['query']);_0x3b3f19[_0xd261('0x37')]=_[_0xd261('0x39')](_0x3b3f19[_0xd261('0x32')],_0x3b3f19[_0xd261('0x36')]);_0x262033[_0xd261('0x38')]=_[_0xd261('0x39')](_0x3b3f19['model'],qs[_0xd261('0x3a')](_0x2aec79['query'][_0xd261('0x3a')]));_0x262033[_0xd261('0x38')]=_0x262033[_0xd261('0x38')][_0xd261('0x3b')]?_0x262033[_0xd261('0x38')]:_0x3b3f19[_0xd261('0x32')];_0x262033['order']=qs['sort'](_0x2aec79[_0xd261('0x36')]['sort']);_0x262033[_0xd261('0x40')]=qs[_0xd261('0x37')](_[_0xd261('0x41')](_0x2aec79['query'],_0x3b3f19['filters']));if(_0x2aec79[_0xd261('0x36')][_0xd261('0x42')]){_0x262033[_0xd261('0x40')]=_[_0xd261('0x43')](_0x262033[_0xd261('0x40')],{'$or':_[_0xd261('0x33')](_0x262033[_0xd261('0x38')],function(_0x187aa0){var _0x1ad65d={};_0x1ad65d[_0x187aa0]={'$like':'%'+_0x2aec79[_0xd261('0x36')][_0xd261('0x42')]+'%'};return _0x1ad65d;})});}_0x262033=_['merge']({},_0x262033,_0x2aec79[_0xd261('0x45')]);return _0x8d0659[_0xd261('0x51')](_0x262033);}})[_0xd261('0x2a')](function(_0x5ba56e){if(_0x5ba56e){_0x2d4501=_0x5ba56e[_0xd261('0x3b')];if(!_0x2aec79[_0xd261('0x36')][_0xd261('0x3c')](_0xd261('0x3d'))){_0x262033[_0xd261('0x23')]=qs['limit'](_0x2aec79['query'][_0xd261('0x23')]);_0x262033[_0xd261('0x22')]=qs[_0xd261('0x22')](_0x2aec79[_0xd261('0x36')]['offset']);}return _0x8d0659[_0xd261('0x51')](_0x262033);}})[_0xd261('0x2a')](function(_0x19b320){if(_0x19b320){return _0x19b320?{'count':_0x2d4501,'rows':_0x19b320}:null;}})[_0xd261('0x2a')](respondWithResult(_0x9493be,null))[_0xd261('0x48')](handleError(_0x9493be,null));};exports[_0xd261('0x53')]=function(_0xd64288,_0x3b300d,_0xa9dd33){var _0x60227a={};var _0x256de4={};var _0x3334f7;var _0x12b83c;return db[_0xd261('0x2e')][_0xd261('0x52')]({'where':{'id':_0xd64288['params']['id']}})['then'](handleEntityNotFound(_0x3b300d,null))['then'](function(_0x3039f0){if(_0x3039f0){_0x3334f7=_0x3039f0;_0x256de4[_0xd261('0x32')]=_[_0xd261('0x35')](db[_0xd261('0x4f')][_0xd261('0x2f')]);_0x256de4[_0xd261('0x36')]=_['keys'](_0xd64288[_0xd261('0x36')]);_0x256de4[_0xd261('0x37')]=_[_0xd261('0x39')](_0x256de4[_0xd261('0x32')],_0x256de4[_0xd261('0x36')]);_0x60227a[_0xd261('0x38')]=_[_0xd261('0x39')](_0x256de4['model'],qs[_0xd261('0x3a')](_0xd64288[_0xd261('0x36')]['fields']));_0x60227a['attributes']=_0x60227a['attributes'][_0xd261('0x3b')]?_0x60227a[_0xd261('0x38')]:_0x256de4['model'];_0x60227a[_0xd261('0x3e')]=qs['sort'](_0xd64288[_0xd261('0x36')]['sort']);_0x60227a[_0xd261('0x40')]=qs[_0xd261('0x37')](_[_0xd261('0x41')](_0xd64288[_0xd261('0x36')],_0x256de4[_0xd261('0x37')]));if(_0xd64288[_0xd261('0x36')][_0xd261('0x42')]){_0x60227a[_0xd261('0x40')]=_[_0xd261('0x43')](_0x60227a[_0xd261('0x40')],{'$or':_[_0xd261('0x33')](_0x60227a[_0xd261('0x38')],function(_0x5b399e){var _0x3b19cc={};_0x3b19cc[_0x5b399e]={'$like':'%'+_0xd64288[_0xd261('0x36')]['filter']+'%'};return _0x3b19cc;})});}_0x60227a=_[_0xd261('0x43')]({},_0x60227a,_0xd64288[_0xd261('0x45')]);return _0x3334f7['getDescriptions'](_0x60227a);}})['then'](function(_0x1aa6ac){if(_0x1aa6ac){_0x12b83c=_0x1aa6ac[_0xd261('0x3b')];if(!_0xd64288[_0xd261('0x36')][_0xd261('0x3c')]('nolimit')){_0x60227a[_0xd261('0x23')]=qs[_0xd261('0x23')](_0xd64288['query']['limit']);_0x60227a[_0xd261('0x22')]=qs['offset'](_0xd64288[_0xd261('0x36')][_0xd261('0x22')]);}return _0x3334f7[_0xd261('0x53')](_0x60227a);}})['then'](function(_0x3ec6d7){if(_0x3ec6d7){return _0x3ec6d7?{'count':_0x12b83c,'rows':_0x3ec6d7}:null;}})[_0xd261('0x2a')](respondWithResult(_0x3b300d,null))['catch'](handleError(_0x3b300d,null));};exports[_0xd261('0x54')]=function(_0x2455eb,_0x8a75e3,_0x3c3dff){var _0xf947d0={};var _0x174585={};var _0x5ee6f3;var _0x5b1ab5;return db['DeskConfiguration'][_0xd261('0x52')]({'where':{'id':_0x2455eb['params']['id']}})['then'](handleEntityNotFound(_0x8a75e3,null))[_0xd261('0x2a')](function(_0x3e2027){if(_0x3e2027){_0x5ee6f3=_0x3e2027;_0x174585[_0xd261('0x32')]=_[_0xd261('0x35')](db['Tag'][_0xd261('0x2f')]);_0x174585['query']=_[_0xd261('0x35')](_0x2455eb[_0xd261('0x36')]);_0x174585[_0xd261('0x37')]=_[_0xd261('0x39')](_0x174585[_0xd261('0x32')],_0x174585['query']);_0xf947d0[_0xd261('0x38')]=_[_0xd261('0x39')](_0x174585[_0xd261('0x32')],qs[_0xd261('0x3a')](_0x2455eb[_0xd261('0x36')][_0xd261('0x3a')]));_0xf947d0[_0xd261('0x38')]=_0xf947d0['attributes']['length']?_0xf947d0[_0xd261('0x38')]:_0x174585[_0xd261('0x32')];_0xf947d0[_0xd261('0x3e')]=qs[_0xd261('0x3f')](_0x2455eb[_0xd261('0x36')][_0xd261('0x3f')]);_0xf947d0[_0xd261('0x40')]=qs[_0xd261('0x37')](_[_0xd261('0x41')](_0x2455eb['query'],_0x174585[_0xd261('0x37')]));if(_0x2455eb[_0xd261('0x36')][_0xd261('0x42')]){_0xf947d0['where']=_[_0xd261('0x43')](_0xf947d0[_0xd261('0x40')],{'$or':_[_0xd261('0x33')](_0xf947d0['attributes'],function(_0x4f8287){var _0x3ad174={};_0x3ad174[_0x4f8287]={'$like':'%'+_0x2455eb[_0xd261('0x36')][_0xd261('0x42')]+'%'};return _0x3ad174;})});}_0xf947d0=_[_0xd261('0x43')]({},_0xf947d0,_0x2455eb[_0xd261('0x45')]);return _0x5ee6f3['getTags'](_0xf947d0);}})[_0xd261('0x2a')](function(_0x121287){if(_0x121287){_0x5b1ab5=_0x121287['length'];if(!_0x2455eb[_0xd261('0x36')][_0xd261('0x3c')](_0xd261('0x3d'))){_0xf947d0[_0xd261('0x23')]=qs[_0xd261('0x23')](_0x2455eb[_0xd261('0x36')][_0xd261('0x23')]);_0xf947d0['offset']=qs[_0xd261('0x22')](_0x2455eb['query'][_0xd261('0x22')]);}return _0x5ee6f3[_0xd261('0x54')](_0xf947d0);}})[_0xd261('0x2a')](function(_0x2db29c){if(_0x2db29c){return _0x2db29c?{'count':_0x5b1ab5,'rows':_0x2db29c}:null;}})[_0xd261('0x2a')](respondWithResult(_0x8a75e3,null))['catch'](handleError(_0x8a75e3,null));};exports[_0xd261('0x55')]=function(_0x301869,_0x2049b2,_0x258b16){if(_0x301869[_0xd261('0x4e')]['id']){delete _0x301869[_0xd261('0x4e')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x301869[_0xd261('0x4a')]['id']}})[_0xd261('0x2a')](handleEntityNotFound(_0x2049b2,null))[_0xd261('0x2a')](function(_0x469a26){if(_0x469a26){return _0x469a26[_0xd261('0x55')](_0x301869[_0xd261('0x4e')][_0xd261('0x56')]||[]);}return null;})[_0xd261('0x2a')](respondWithResult(_0x2049b2,null))[_0xd261('0x48')](handleError(_0x2049b2,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 915b3ee..b1871fe 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 _0x93dc=['int_desk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93dc,0x161));var _0xc93d=function(_0x1ae611,_0x34dd8b){_0x1ae611=_0x1ae611-0x0;var _0x64fc33=_0x93dc[_0x1ae611];return _0x64fc33;};'use strict';var _=require(_0xc93d('0x0'));var util=require(_0xc93d('0x1'));var logger=require(_0xc93d('0x2'))('api');var moment=require(_0xc93d('0x3'));var BPromise=require(_0xc93d('0x4'));var rp=require(_0xc93d('0x5'));var fs=require('fs');var path=require(_0xc93d('0x6'));var rimraf=require('rimraf');var config=require(_0xc93d('0x7'));var attributes=require(_0xc93d('0x8'));module['exports']=function(_0xf3ab33,_0x41e14b){return _0xf3ab33[_0xc93d('0x9')]('DeskConfiguration',attributes,{'tableName':_0xc93d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab2a=['moment','request-promise','path','rimraf','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xab2a,0x1a1));var _0xaab2=function(_0x194960,_0x2ebbda){_0x194960=_0x194960-0x0;var _0x34deea=_0xab2a[_0x194960];return _0x34deea;};'use strict';var _=require(_0xaab2('0x0'));var util=require(_0xaab2('0x1'));var logger=require(_0xaab2('0x2'))('api');var moment=require(_0xaab2('0x3'));var BPromise=require('bluebird');var rp=require(_0xaab2('0x4'));var fs=require('fs');var path=require(_0xaab2('0x5'));var rimraf=require(_0xaab2('0x6'));var config=require('../../config/environment');var attributes=require(_0xaab2('0x7'));module['exports']=function(_0x5c14f2,_0x53ce4f){return _0x5c14f2['define'](_0xaab2('0x8'),attributes,{'tableName':_0xaab2('0x9'),'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 84e1a8b..a8a6912 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 _0xfdf7=['info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xf65979,_0x202b31){var _0x35f5db=function(_0x2aa9ef){while(--_0x2aa9ef){_0xf65979['push'](_0xf65979['shift']());}};_0x35f5db(++_0x202b31);}(_0xfdf7,0xfa));var _0x7fdf=function(_0x206ca8,_0x34739a){_0x206ca8=_0x206ca8-0x0;var _0x508d10=_0xfdf7[_0x206ca8];return _0x508d10;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7fdf('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fdf('0x1'))['db'];var utils=require(_0x7fdf('0x2'));var logger=require(_0x7fdf('0x3'))(_0x7fdf('0x4'));var config=require('../../config/environment');var jayson=require(_0x7fdf('0x5'));var client=jayson[_0x7fdf('0x6')][_0x7fdf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46d7fa,_0xe31014,_0x289a2c){return new BPromise(function(_0x4ef023,_0x50ffe2){return client[_0x7fdf('0x8')](_0x46d7fa,_0x289a2c)[_0x7fdf('0x9')](function(_0x4f69dd){logger[_0x7fdf('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0xe31014,_0x7fdf('0xb'));logger['debug'](_0x7fdf('0xc'),_0xe31014,_0x7fdf('0xb'),JSON[_0x7fdf('0xd')](_0x4f69dd));if(_0x4f69dd['error']){if(_0x4f69dd[_0x7fdf('0xe')][_0x7fdf('0xf')]===0x1f4){logger[_0x7fdf('0xe')](_0x7fdf('0x10'),_0xe31014,_0x4f69dd[_0x7fdf('0xe')]['message']);return _0x50ffe2(_0x4f69dd[_0x7fdf('0xe')]['message']);}logger[_0x7fdf('0xe')](_0x7fdf('0x10'),_0xe31014,_0x4f69dd[_0x7fdf('0xe')][_0x7fdf('0x11')]);return _0x4ef023(_0x4f69dd[_0x7fdf('0xe')][_0x7fdf('0x11')]);}else{logger[_0x7fdf('0xa')](_0x7fdf('0x10'),_0xe31014,_0x7fdf('0xb'));_0x4ef023(_0x4f69dd[_0x7fdf('0x12')][_0x7fdf('0x11')]);}})[_0x7fdf('0x13')](function(_0xcfa636){logger[_0x7fdf('0xe')](_0x7fdf('0x10'),_0xe31014,_0xcfa636);_0x50ffe2(_0xcfa636);});});} \ No newline at end of file +var _0xee2c=['jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x4c82b5,_0x210d93){var _0x42cc02=function(_0x534491){while(--_0x534491){_0x4c82b5['push'](_0x4c82b5['shift']());}};_0x42cc02(++_0x210d93);}(_0xee2c,0x1c7));var _0xcee2=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xee2c[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xcee2('0x0'));var util=require('util');var moment=require(_0xcee2('0x1'));var BPromise=require(_0xcee2('0x2'));var rs=require(_0xcee2('0x3'));var fs=require('fs');var Redis=require(_0xcee2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcee2('0x5'))(_0xcee2('0x6'));var config=require('../../config/environment');var jayson=require(_0xcee2('0x7'));var client=jayson[_0xcee2('0x8')][_0xcee2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d7611,_0x24ce33,_0x5a8219){return new BPromise(function(_0x52a4ac,_0xea6c3c){return client[_0xcee2('0xa')](_0x3d7611,_0x5a8219)[_0xcee2('0xb')](function(_0x23dd44){logger[_0xcee2('0xc')](_0xcee2('0xd'),_0x24ce33,_0xcee2('0xe'));logger[_0xcee2('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x24ce33,_0xcee2('0xe'),JSON[_0xcee2('0x10')](_0x23dd44));if(_0x23dd44[_0xcee2('0x11')]){if(_0x23dd44[_0xcee2('0x11')][_0xcee2('0x12')]===0x1f4){logger['error'](_0xcee2('0xd'),_0x24ce33,_0x23dd44['error']['message']);return _0xea6c3c(_0x23dd44['error'][_0xcee2('0x13')]);}logger[_0xcee2('0x11')](_0xcee2('0xd'),_0x24ce33,_0x23dd44[_0xcee2('0x11')]['message']);return _0x52a4ac(_0x23dd44[_0xcee2('0x11')][_0xcee2('0x13')]);}else{logger[_0xcee2('0xc')](_0xcee2('0xd'),_0x24ce33,_0xcee2('0xe'));_0x52a4ac(_0x23dd44[_0xcee2('0x14')][_0xcee2('0x13')]);}})[_0xcee2('0x15')](function(_0x45c680){logger['error'](_0xcee2('0xd'),_0x24ce33,_0x45c680);_0xea6c3c(_0x45c680);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8d909db..aa3c840 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 _0x3442=['create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x4535b2,_0x4f07b0){var _0x4c5bab=function(_0x5bf957){while(--_0x5bf957){_0x4535b2['push'](_0x4535b2['shift']());}};_0x4c5bab(++_0x4f07b0);}(_0x3442,0x15a));var _0x2344=function(_0x16cee3,_0x1feb79){_0x16cee3=_0x16cee3-0x0;var _0x3023b3=_0x3442[_0x16cee3];return _0x3023b3;};'use strict';var multer=require('multer');var util=require(_0x2344('0x0'));var path=require(_0x2344('0x1'));var timeout=require(_0x2344('0x2'));var express=require(_0x2344('0x3'));var router=express[_0x2344('0x4')]();var fs_extra=require(_0x2344('0x5'));var auth=require(_0x2344('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2344('0x7'));var controller=require(_0x2344('0x8'));router['get']('/',auth[_0x2344('0x9')](),controller[_0x2344('0xa')]);router[_0x2344('0xb')](_0x2344('0xc'),auth[_0x2344('0x9')](),controller[_0x2344('0xd')]);router[_0x2344('0xe')]('/',auth[_0x2344('0x9')](),controller[_0x2344('0xf')]);router['put'](_0x2344('0xc'),auth[_0x2344('0x9')](),controller[_0x2344('0x10')]);router[_0x2344('0x11')](_0x2344('0xc'),auth[_0x2344('0x9')](),controller['destroy']);module[_0x2344('0x12')]=router; \ No newline at end of file +var _0x5a13=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDeskField.controller','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x47f772,_0x280c6d){var _0xf9d34d=function(_0x1999ed){while(--_0x1999ed){_0x47f772['push'](_0x47f772['shift']());}};_0xf9d34d(++_0x280c6d);}(_0x5a13,0x92));var _0x35a1=function(_0x3935bb,_0x17ba0f){_0x3935bb=_0x3935bb-0x0;var _0x46f524=_0x5a13[_0x3935bb];return _0x46f524;};'use strict';var multer=require('multer');var util=require(_0x35a1('0x0'));var path=require(_0x35a1('0x1'));var timeout=require(_0x35a1('0x2'));var express=require(_0x35a1('0x3'));var router=express[_0x35a1('0x4')]();var fs_extra=require(_0x35a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x35a1('0x6'));var config=require('../../config/environment');var controller=require(_0x35a1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x35a1('0x8')](_0x35a1('0x9'),auth[_0x35a1('0xa')](),controller[_0x35a1('0xb')]);router[_0x35a1('0xc')]('/',auth['isAuthenticated'](),controller[_0x35a1('0xd')]);router[_0x35a1('0xe')](_0x35a1('0x9'),auth[_0x35a1('0xa')](),controller[_0x35a1('0xf')]);router[_0x35a1('0x10')](_0x35a1('0x9'),auth[_0x35a1('0xa')](),controller[_0x35a1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index acde286..c694a6d 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 _0x8a55=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8a55,0x70));var _0x58a5=function(_0x5b143e,_0x1fec76){_0x5b143e=_0x5b143e-0x0;var _0x533d3c=_0x8a55[_0x5b143e];return _0x533d3c;};'use strict';var Sequelize=require(_0x58a5('0x0'));module[_0x58a5('0x1')]={'type':{'type':Sequelize[_0x58a5('0x2')](_0x58a5('0x3'),_0x58a5('0x4'),_0x58a5('0x5'),_0x58a5('0x6'),_0x58a5('0x7')),'defaultValue':_0x58a5('0x3')},'content':{'type':Sequelize[_0x58a5('0x8')]},'key':{'type':Sequelize[_0x58a5('0x8')]},'keyType':{'type':Sequelize[_0x58a5('0x2')](_0x58a5('0x3'),_0x58a5('0x4'),_0x58a5('0x5'))},'keyContent':{'type':Sequelize[_0x58a5('0x8')]},'idField':{'type':Sequelize[_0x58a5('0x8')]},'nameField':{'type':Sequelize[_0x58a5('0x8')]},'customField':{'type':Sequelize[_0x58a5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x58a5('0x8')]}}; \ No newline at end of file +var _0x5ddf=['BOOLEAN','sequelize','exports','string','variable','keyValue','STRING','ENUM','customVariable'];(function(_0x12cbd8,_0x8ef0ce){var _0x2fb1ab=function(_0x57242c){while(--_0x57242c){_0x12cbd8['push'](_0x12cbd8['shift']());}};_0x2fb1ab(++_0x8ef0ce);}(_0x5ddf,0xa3));var _0xf5dd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5ddf[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xf5dd('0x0'));module[_0xf5dd('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf5dd('0x2'),_0xf5dd('0x3'),'customVariable',_0xf5dd('0x4'),'picklist'),'defaultValue':_0xf5dd('0x2')},'content':{'type':Sequelize[_0xf5dd('0x5')]},'key':{'type':Sequelize[_0xf5dd('0x5')]},'keyType':{'type':Sequelize[_0xf5dd('0x6')](_0xf5dd('0x2'),_0xf5dd('0x3'),_0xf5dd('0x7'))},'keyContent':{'type':Sequelize[_0xf5dd('0x5')]},'idField':{'type':Sequelize[_0xf5dd('0x5')]},'nameField':{'type':Sequelize[_0xf5dd('0x5')]},'customField':{'type':Sequelize[_0xf5dd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf5dd('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 8694ca3..1cd18b0 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 _0xdb70=['params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','DeskField','rawAttributes','fieldName','key','map','query','filters','attributes','intersection','fields','length','model','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x501bd2,_0xf8377c){var _0x2d3b90=function(_0x1b523b){while(--_0x1b523b){_0x501bd2['push'](_0x501bd2['shift']());}};_0x2d3b90(++_0xf8377c);}(_0xdb70,0xa0));var _0x0db7=function(_0x2cb9ee,_0x4c757e){_0x2cb9ee=_0x2cb9ee-0x0;var _0x2e15ff=_0xdb70[_0x2cb9ee];return _0x2e15ff;};'use strict';var emlformat=require(_0x0db7('0x0'));var rimraf=require(_0x0db7('0x1'));var zipdir=require(_0x0db7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0db7('0x3'));var moment=require(_0x0db7('0x4'));var BPromise=require(_0x0db7('0x5'));var Mustache=require(_0x0db7('0x6'));var util=require(_0x0db7('0x7'));var path=require(_0x0db7('0x8'));var sox=require(_0x0db7('0x9'));var csv=require(_0x0db7('0xa'));var ejs=require(_0x0db7('0xb'));var fs=require('fs');var fs_extra=require(_0x0db7('0xc'));var _=require(_0x0db7('0xd'));var squel=require('squel');var crypto=require(_0x0db7('0xe'));var jsforce=require(_0x0db7('0xf'));var deskjs=require(_0x0db7('0x10'));var toCsv=require(_0x0db7('0xa'));var querystring=require(_0x0db7('0x11'));var Papa=require(_0x0db7('0x12'));var Redis=require('ioredis');var authService=require(_0x0db7('0x13'));var qs=require(_0x0db7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0db7('0x15'));var logger=require(_0x0db7('0x16'))(_0x0db7('0x17'));var utils=require(_0x0db7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0db7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9aed4f,_0x2959a2){_0x2959a2=_0x2959a2||0xcc;return function(_0x33ec07){if(_0x33ec07){return _0x9aed4f[_0x0db7('0x1a')](_0x2959a2);}return _0x9aed4f[_0x0db7('0x1b')](_0x2959a2)['end']();};}function respondWithResult(_0x76c036,_0x195556){_0x195556=_0x195556||0xc8;return function(_0x45f594){if(_0x45f594){return _0x76c036[_0x0db7('0x1b')](_0x195556)[_0x0db7('0x1c')](_0x45f594);}};}function respondWithFilteredResult(_0x446448,_0x41b2b3){return function(_0x2edbe9){if(_0x2edbe9){var _0xb9127d=typeof _0x41b2b3[_0x0db7('0x1d')]==='undefined'&&typeof _0x41b2b3[_0x0db7('0x1e')]===_0x0db7('0x1f');var _0x18cf37=_0x2edbe9[_0x0db7('0x20')];var _0x31082b=_0xb9127d?0x0:_0x41b2b3[_0x0db7('0x1d')];var _0x52e95e=_0xb9127d?_0x2edbe9['count']:_0x41b2b3[_0x0db7('0x1d')]+_0x41b2b3[_0x0db7('0x1e')];var _0xe9a55d;if(_0x52e95e>=_0x18cf37){_0x52e95e=_0x18cf37;_0xe9a55d=0xc8;}else{_0xe9a55d=0xce;}_0x446448['status'](_0xe9a55d);return _0x446448[_0x0db7('0x21')](_0x0db7('0x22'),_0x31082b+'-'+_0x52e95e+'/'+_0x18cf37)[_0x0db7('0x1c')](_0x2edbe9);}return null;};}function patchUpdates(_0x211fc0){return function(_0x5a0b04){try{jsonpatch[_0x0db7('0x23')](_0x5a0b04,_0x211fc0,!![]);}catch(_0x48feb2){return BPromise[_0x0db7('0x24')](_0x48feb2);}return _0x5a0b04['save']();};}function saveUpdates(_0x59b7e4,_0x135429){return function(_0x156aaa){if(_0x156aaa){return _0x156aaa[_0x0db7('0x25')](_0x59b7e4)[_0x0db7('0x26')](function(_0x18fc1c){return _0x18fc1c;});}return null;};}function removeEntity(_0x368243,_0xc05009){return function(_0x274bf1){if(_0x274bf1){return _0x274bf1[_0x0db7('0x27')]()[_0x0db7('0x26')](function(){_0x368243[_0x0db7('0x1b')](0xcc)[_0x0db7('0x28')]();});}};}function handleEntityNotFound(_0x299c22,_0x55f339){return function(_0x521565){if(!_0x521565){_0x299c22['sendStatus'](0x194);}return _0x521565;};}function handleError(_0x594e6a,_0x568e60){_0x568e60=_0x568e60||0x1f4;return function(_0x5d2e46){logger[_0x0db7('0x29')](_0x5d2e46[_0x0db7('0x2a')]);if(_0x5d2e46[_0x0db7('0x2b')]){delete _0x5d2e46['name'];}_0x594e6a['status'](_0x568e60)[_0x0db7('0x2c')](_0x5d2e46);};}exports[_0x0db7('0x2d')]=function(_0x3f2169,_0x37ade4){var _0x29ed0a={},_0xfc7311={},_0x4ca418={'count':0x0,'rows':[]};var _0x2de626=_['map'](db[_0x0db7('0x2e')][_0x0db7('0x2f')],function(_0x1481aa){return{'name':_0x1481aa[_0x0db7('0x30')],'type':_0x1481aa['type'][_0x0db7('0x31')]};});_0xfc7311['model']=_[_0x0db7('0x32')](_0x2de626,_0x0db7('0x2b'));_0xfc7311[_0x0db7('0x33')]=_['keys'](_0x3f2169[_0x0db7('0x33')]);_0xfc7311[_0x0db7('0x34')]=_['intersection'](_0xfc7311['model'],_0xfc7311[_0x0db7('0x33')]);_0x29ed0a[_0x0db7('0x35')]=_[_0x0db7('0x36')](_0xfc7311['model'],qs['fields'](_0x3f2169[_0x0db7('0x33')][_0x0db7('0x37')]));_0x29ed0a[_0x0db7('0x35')]=_0x29ed0a['attributes'][_0x0db7('0x38')]?_0x29ed0a[_0x0db7('0x35')]:_0xfc7311[_0x0db7('0x39')];if(!_0x3f2169[_0x0db7('0x33')]['hasOwnProperty'](_0x0db7('0x3a'))){_0x29ed0a['limit']=qs[_0x0db7('0x1e')](_0x3f2169['query'][_0x0db7('0x1e')]);_0x29ed0a[_0x0db7('0x1d')]=qs[_0x0db7('0x1d')](_0x3f2169['query']['offset']);}_0x29ed0a[_0x0db7('0x3b')]=qs[_0x0db7('0x3c')](_0x3f2169[_0x0db7('0x33')][_0x0db7('0x3c')]);_0x29ed0a[_0x0db7('0x3d')]=qs[_0x0db7('0x34')](_['pick'](_0x3f2169[_0x0db7('0x33')],_0xfc7311[_0x0db7('0x34')]),_0x2de626);if(_0x3f2169['query'][_0x0db7('0x3e')]){_0x29ed0a['where']=_[_0x0db7('0x3f')](_0x29ed0a['where'],{'$or':_[_0x0db7('0x32')](_0x2de626,function(_0x27ed23){if(_0x27ed23['type']!==_0x0db7('0x40')){var _0x100ef9={};_0x100ef9[_0x27ed23['name']]={'$like':'%'+_0x3f2169[_0x0db7('0x33')]['filter']+'%'};return _0x100ef9;}})});}_0x29ed0a=_[_0x0db7('0x3f')]({},_0x29ed0a,_0x3f2169[_0x0db7('0x41')]);var _0x32c295={'where':_0x29ed0a[_0x0db7('0x3d')]};return db[_0x0db7('0x2e')]['count'](_0x32c295)[_0x0db7('0x26')](function(_0x2545bf){_0x4ca418[_0x0db7('0x20')]=_0x2545bf;if(_0x3f2169[_0x0db7('0x33')][_0x0db7('0x42')]){_0x29ed0a[_0x0db7('0x43')]=[{'all':!![]}];}return db[_0x0db7('0x2e')][_0x0db7('0x44')](_0x29ed0a);})[_0x0db7('0x26')](function(_0x4591fe){_0x4ca418[_0x0db7('0x45')]=_0x4591fe;return _0x4ca418;})[_0x0db7('0x26')](respondWithFilteredResult(_0x37ade4,_0x29ed0a))['catch'](handleError(_0x37ade4,null));};exports[_0x0db7('0x46')]=function(_0x4a9066,_0x23558a){var _0x150936={'raw':!![],'where':{'id':_0x4a9066[_0x0db7('0x47')]['id']}},_0x55732f={};_0x55732f['model']=_[_0x0db7('0x48')](db[_0x0db7('0x2e')][_0x0db7('0x2f')]);_0x55732f[_0x0db7('0x33')]=_[_0x0db7('0x48')](_0x4a9066[_0x0db7('0x33')]);_0x55732f[_0x0db7('0x34')]=_[_0x0db7('0x36')](_0x55732f[_0x0db7('0x39')],_0x55732f['query']);_0x150936['attributes']=_['intersection'](_0x55732f[_0x0db7('0x39')],qs[_0x0db7('0x37')](_0x4a9066[_0x0db7('0x33')][_0x0db7('0x37')]));_0x150936[_0x0db7('0x35')]=_0x150936[_0x0db7('0x35')]['length']?_0x150936[_0x0db7('0x35')]:_0x55732f[_0x0db7('0x39')];if(_0x4a9066['query'][_0x0db7('0x42')]){_0x150936[_0x0db7('0x43')]=[{'all':!![]}];}_0x150936=_[_0x0db7('0x3f')]({},_0x150936,_0x4a9066['options']);return db[_0x0db7('0x2e')][_0x0db7('0x49')](_0x150936)[_0x0db7('0x26')](handleEntityNotFound(_0x23558a,null))[_0x0db7('0x26')](respondWithResult(_0x23558a,null))[_0x0db7('0x4a')](handleError(_0x23558a,null));};exports['create']=function(_0x23d9b3,_0x2388fa){return db[_0x0db7('0x2e')][_0x0db7('0x4b')](_0x23d9b3['body'],{})['then'](respondWithResult(_0x2388fa,0xc9))[_0x0db7('0x4a')](handleError(_0x2388fa,null));};exports['update']=function(_0x534daa,_0x3281bd){if(_0x534daa[_0x0db7('0x4c')]['id']){delete _0x534daa['body']['id'];}return db[_0x0db7('0x2e')][_0x0db7('0x49')]({'where':{'id':_0x534daa[_0x0db7('0x47')]['id']}})[_0x0db7('0x26')](handleEntityNotFound(_0x3281bd,null))['then'](saveUpdates(_0x534daa['body'],null))['then'](respondWithResult(_0x3281bd,null))[_0x0db7('0x4a')](handleError(_0x3281bd,null));};exports[_0x0db7('0x27')]=function(_0x1ac5df,_0x10863b){return db['DeskField'][_0x0db7('0x49')]({'where':{'id':_0x1ac5df['params']['id']}})['then'](handleEntityNotFound(_0x10863b,null))['then'](removeEntity(_0x10863b,null))[_0x0db7('0x4a')](handleError(_0x10863b,null));}; \ No newline at end of file +var _0x1b65=['path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b65,0x1b4));var _0x51b6=function(_0xff16a7,_0x2602f5){_0xff16a7=_0xff16a7-0x0;var _0x1e938a=_0x1b65[_0xff16a7];return _0x1e938a;};'use strict';var emlformat=require(_0x51b6('0x0'));var rimraf=require(_0x51b6('0x1'));var zipdir=require(_0x51b6('0x2'));var jsonpatch=require(_0x51b6('0x3'));var rp=require('request-promise');var moment=require(_0x51b6('0x4'));var BPromise=require(_0x51b6('0x5'));var Mustache=require(_0x51b6('0x6'));var util=require(_0x51b6('0x7'));var path=require(_0x51b6('0x8'));var sox=require(_0x51b6('0x9'));var csv=require(_0x51b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51b6('0xb'));var _=require(_0x51b6('0xc'));var squel=require(_0x51b6('0xd'));var crypto=require(_0x51b6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51b6('0xf'));var toCsv=require(_0x51b6('0xa'));var querystring=require('querystring');var Papa=require(_0x51b6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51b6('0x11'));var as=require(_0x51b6('0x12'));var hardwareService=require(_0x51b6('0x13'));var logger=require(_0x51b6('0x14'))(_0x51b6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51b6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd605,_0x422bd4){_0x422bd4=_0x422bd4||0xcc;return function(_0x4ca143){if(_0x4ca143){return _0x4cd605[_0x51b6('0x17')](_0x422bd4);}return _0x4cd605['status'](_0x422bd4)[_0x51b6('0x18')]();};}function respondWithResult(_0x24a386,_0x2890ee){_0x2890ee=_0x2890ee||0xc8;return function(_0x235d8c){if(_0x235d8c){return _0x24a386[_0x51b6('0x19')](_0x2890ee)[_0x51b6('0x1a')](_0x235d8c);}};}function respondWithFilteredResult(_0x4c6cd0,_0x23549b){return function(_0x596863){if(_0x596863){var _0x39583d=typeof _0x23549b['offset']===_0x51b6('0x1b')&&typeof _0x23549b['limit']===_0x51b6('0x1b');var _0x22ffa3=_0x596863[_0x51b6('0x1c')];var _0x3ae3c7=_0x39583d?0x0:_0x23549b[_0x51b6('0x1d')];var _0x22c6da=_0x39583d?_0x596863['count']:_0x23549b[_0x51b6('0x1d')]+_0x23549b['limit'];var _0x2974f0;if(_0x22c6da>=_0x22ffa3){_0x22c6da=_0x22ffa3;_0x2974f0=0xc8;}else{_0x2974f0=0xce;}_0x4c6cd0[_0x51b6('0x19')](_0x2974f0);return _0x4c6cd0['set'](_0x51b6('0x1e'),_0x3ae3c7+'-'+_0x22c6da+'/'+_0x22ffa3)[_0x51b6('0x1a')](_0x596863);}return null;};}function patchUpdates(_0x3fee21){return function(_0x471783){try{jsonpatch[_0x51b6('0x1f')](_0x471783,_0x3fee21,!![]);}catch(_0x663b44){return BPromise[_0x51b6('0x20')](_0x663b44);}return _0x471783[_0x51b6('0x21')]();};}function saveUpdates(_0x4ab876,_0x35d2ab){return function(_0x11db4e){if(_0x11db4e){return _0x11db4e[_0x51b6('0x22')](_0x4ab876)[_0x51b6('0x23')](function(_0x53e709){return _0x53e709;});}return null;};}function removeEntity(_0x3d3456,_0x3680af){return function(_0x51c013){if(_0x51c013){return _0x51c013['destroy']()[_0x51b6('0x23')](function(){_0x3d3456[_0x51b6('0x19')](0xcc)[_0x51b6('0x18')]();});}};}function handleEntityNotFound(_0x59193e,_0x4c1825){return function(_0x22b91b){if(!_0x22b91b){_0x59193e[_0x51b6('0x17')](0x194);}return _0x22b91b;};}function handleError(_0x8c0881,_0x4a5ff8){_0x4a5ff8=_0x4a5ff8||0x1f4;return function(_0x2842b2){logger[_0x51b6('0x24')](_0x2842b2[_0x51b6('0x25')]);if(_0x2842b2[_0x51b6('0x26')]){delete _0x2842b2[_0x51b6('0x26')];}_0x8c0881[_0x51b6('0x19')](_0x4a5ff8)[_0x51b6('0x27')](_0x2842b2);};}exports[_0x51b6('0x28')]=function(_0x51b505,_0x2dc770){var _0x226018={},_0x276443={},_0x48eb13={'count':0x0,'rows':[]};var _0x38f855=_[_0x51b6('0x29')](db[_0x51b6('0x2a')][_0x51b6('0x2b')],function(_0x5c7c35){return{'name':_0x5c7c35[_0x51b6('0x2c')],'type':_0x5c7c35['type'][_0x51b6('0x2d')]};});_0x276443[_0x51b6('0x2e')]=_['map'](_0x38f855,'name');_0x276443[_0x51b6('0x2f')]=_[_0x51b6('0x30')](_0x51b505['query']);_0x276443[_0x51b6('0x31')]=_[_0x51b6('0x32')](_0x276443['model'],_0x276443[_0x51b6('0x2f')]);_0x226018[_0x51b6('0x33')]=_[_0x51b6('0x32')](_0x276443['model'],qs[_0x51b6('0x34')](_0x51b505['query'][_0x51b6('0x34')]));_0x226018[_0x51b6('0x33')]=_0x226018[_0x51b6('0x33')][_0x51b6('0x35')]?_0x226018[_0x51b6('0x33')]:_0x276443[_0x51b6('0x2e')];if(!_0x51b505[_0x51b6('0x2f')][_0x51b6('0x36')]('nolimit')){_0x226018[_0x51b6('0x37')]=qs[_0x51b6('0x37')](_0x51b505['query'][_0x51b6('0x37')]);_0x226018['offset']=qs[_0x51b6('0x1d')](_0x51b505[_0x51b6('0x2f')][_0x51b6('0x1d')]);}_0x226018['order']=qs[_0x51b6('0x38')](_0x51b505[_0x51b6('0x2f')]['sort']);_0x226018[_0x51b6('0x39')]=qs[_0x51b6('0x31')](_[_0x51b6('0x3a')](_0x51b505[_0x51b6('0x2f')],_0x276443[_0x51b6('0x31')]),_0x38f855);if(_0x51b505[_0x51b6('0x2f')][_0x51b6('0x3b')]){_0x226018[_0x51b6('0x39')]=_[_0x51b6('0x3c')](_0x226018[_0x51b6('0x39')],{'$or':_[_0x51b6('0x29')](_0x38f855,function(_0x234d5e){if(_0x234d5e[_0x51b6('0x3d')]!==_0x51b6('0x3e')){var _0x28d14f={};_0x28d14f[_0x234d5e[_0x51b6('0x26')]]={'$like':'%'+_0x51b505['query'][_0x51b6('0x3b')]+'%'};return _0x28d14f;}})});}_0x226018=_['merge']({},_0x226018,_0x51b505[_0x51b6('0x3f')]);var _0x4ad444={'where':_0x226018[_0x51b6('0x39')]};return db[_0x51b6('0x2a')]['count'](_0x4ad444)[_0x51b6('0x23')](function(_0x2b6dd6){_0x48eb13['count']=_0x2b6dd6;if(_0x51b505[_0x51b6('0x2f')][_0x51b6('0x40')]){_0x226018[_0x51b6('0x41')]=[{'all':!![]}];}return db[_0x51b6('0x2a')][_0x51b6('0x42')](_0x226018);})['then'](function(_0x588a05){_0x48eb13['rows']=_0x588a05;return _0x48eb13;})[_0x51b6('0x23')](respondWithFilteredResult(_0x2dc770,_0x226018))[_0x51b6('0x43')](handleError(_0x2dc770,null));};exports[_0x51b6('0x44')]=function(_0xda309d,_0x2c3f6e){var _0x588fc6={'raw':!![],'where':{'id':_0xda309d[_0x51b6('0x45')]['id']}},_0x498717={};_0x498717[_0x51b6('0x2e')]=_[_0x51b6('0x30')](db['DeskField'][_0x51b6('0x2b')]);_0x498717['query']=_[_0x51b6('0x30')](_0xda309d['query']);_0x498717[_0x51b6('0x31')]=_[_0x51b6('0x32')](_0x498717[_0x51b6('0x2e')],_0x498717['query']);_0x588fc6[_0x51b6('0x33')]=_[_0x51b6('0x32')](_0x498717[_0x51b6('0x2e')],qs[_0x51b6('0x34')](_0xda309d[_0x51b6('0x2f')]['fields']));_0x588fc6[_0x51b6('0x33')]=_0x588fc6[_0x51b6('0x33')]['length']?_0x588fc6[_0x51b6('0x33')]:_0x498717[_0x51b6('0x2e')];if(_0xda309d['query']['includeAll']){_0x588fc6['include']=[{'all':!![]}];}_0x588fc6=_['merge']({},_0x588fc6,_0xda309d['options']);return db['DeskField'][_0x51b6('0x46')](_0x588fc6)['then'](handleEntityNotFound(_0x2c3f6e,null))[_0x51b6('0x23')](respondWithResult(_0x2c3f6e,null))[_0x51b6('0x43')](handleError(_0x2c3f6e,null));};exports[_0x51b6('0x47')]=function(_0x21a7ab,_0x4562c6){return db[_0x51b6('0x2a')]['create'](_0x21a7ab[_0x51b6('0x48')],{})['then'](respondWithResult(_0x4562c6,0xc9))[_0x51b6('0x43')](handleError(_0x4562c6,null));};exports[_0x51b6('0x22')]=function(_0x594bb2,_0x44f9d4){if(_0x594bb2[_0x51b6('0x48')]['id']){delete _0x594bb2[_0x51b6('0x48')]['id'];}return db[_0x51b6('0x2a')]['find']({'where':{'id':_0x594bb2[_0x51b6('0x45')]['id']}})[_0x51b6('0x23')](handleEntityNotFound(_0x44f9d4,null))[_0x51b6('0x23')](saveUpdates(_0x594bb2[_0x51b6('0x48')],null))[_0x51b6('0x23')](respondWithResult(_0x44f9d4,null))[_0x51b6('0x43')](handleError(_0x44f9d4,null));};exports[_0x51b6('0x49')]=function(_0x3c977a,_0x27a4e4){return db[_0x51b6('0x2a')][_0x51b6('0x46')]({'where':{'id':_0x3c977a['params']['id']}})[_0x51b6('0x23')](handleEntityNotFound(_0x27a4e4,null))[_0x51b6('0x23')](removeEntity(_0x27a4e4,null))[_0x51b6('0x43')](handleError(_0x27a4e4,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6c0703e..0a6f1a3 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 _0xc67f=['define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x1e291a,_0x13a9da){var _0x448d8a=function(_0x329ac6){while(--_0x329ac6){_0x1e291a['push'](_0x1e291a['shift']());}};_0x448d8a(++_0x13a9da);}(_0xc67f,0xa5));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc67('0x0'));var util=require(_0xfc67('0x1'));var logger=require(_0xfc67('0x2'))('api');var moment=require(_0xfc67('0x3'));var BPromise=require(_0xfc67('0x4'));var rp=require(_0xfc67('0x5'));var fs=require('fs');var path=require(_0xfc67('0x6'));var rimraf=require(_0xfc67('0x7'));var config=require(_0xfc67('0x8'));var attributes=require(_0xfc67('0x9'));module[_0xfc67('0xa')]=function(_0x2da513,_0x5b6c5b){return _0x2da513[_0xfc67('0xb')](_0xfc67('0xc'),attributes,{'tableName':_0xfc67('0xd'),'paranoid':![],'indexes':[{'name':_0xfc67('0xe'),'fields':['idField',_0xfc67('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5472=['exports','define','DeskField','int_desk_fields','desk_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','./intDeskField.attributes'];(function(_0x3cf907,_0x232dec){var _0x3ab95d=function(_0x3d8f2b){while(--_0x3d8f2b){_0x3cf907['push'](_0x3cf907['shift']());}};_0x3ab95d(++_0x232dec);}(_0x5472,0xe6));var _0x2547=function(_0x2559d2,_0x3b35d1){_0x2559d2=_0x2559d2-0x0;var _0x192e06=_0x5472[_0x2559d2];return _0x192e06;};'use strict';var _=require('lodash');var util=require(_0x2547('0x0'));var logger=require(_0x2547('0x1'))(_0x2547('0x2'));var moment=require(_0x2547('0x3'));var BPromise=require(_0x2547('0x4'));var rp=require(_0x2547('0x5'));var fs=require('fs');var path=require(_0x2547('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2547('0x7'));module[_0x2547('0x8')]=function(_0x39d0d8,_0x21b88f){return _0x39d0d8[_0x2547('0x9')](_0x2547('0xa'),attributes,{'tableName':_0x2547('0xb'),'paranoid':![],'indexes':[{'name':_0x2547('0xc'),'fields':[_0x2547('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 7b375a8..5a4d35f 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 _0x567e=['debug','stringify','error','code','message','info','result','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','DeskField,\x20%s,\x20%s'];(function(_0x268ce8,_0x17ad5e){var _0xa727de=function(_0x269840){while(--_0x269840){_0x268ce8['push'](_0x268ce8['shift']());}};_0xa727de(++_0x17ad5e);}(_0x567e,0x1a9));var _0xe567=function(_0x366a27,_0xc242fb){_0x366a27=_0x366a27-0x0;var _0x5e2804=_0x567e[_0x366a27];return _0x5e2804;};'use strict';var _=require(_0xe567('0x0'));var util=require('util');var moment=require(_0xe567('0x1'));var BPromise=require('bluebird');var rs=require(_0xe567('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe567('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe567('0x4'))(_0xe567('0x5'));var config=require(_0xe567('0x6'));var jayson=require(_0xe567('0x7'));var client=jayson[_0xe567('0x8')][_0xe567('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e3373,_0x578826,_0x366c15){return new BPromise(function(_0x56c018,_0x2a65ec){return client['request'](_0x1e3373,_0x366c15)[_0xe567('0xa')](function(_0x266da5){logger['info'](_0xe567('0xb'),_0x578826,'request\x20sent');logger[_0xe567('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x578826,'request\x20sent',JSON[_0xe567('0xd')](_0x266da5));if(_0x266da5[_0xe567('0xe')]){if(_0x266da5[_0xe567('0xe')][_0xe567('0xf')]===0x1f4){logger[_0xe567('0xe')](_0xe567('0xb'),_0x578826,_0x266da5['error'][_0xe567('0x10')]);return _0x2a65ec(_0x266da5['error']['message']);}logger[_0xe567('0xe')]('DeskField,\x20%s,\x20%s',_0x578826,_0x266da5[_0xe567('0xe')][_0xe567('0x10')]);return _0x56c018(_0x266da5[_0xe567('0xe')]['message']);}else{logger[_0xe567('0x11')](_0xe567('0xb'),_0x578826,'request\x20sent');_0x56c018(_0x266da5[_0xe567('0x12')][_0xe567('0x10')]);}})['catch'](function(_0x7cdd7f){logger[_0xe567('0xe')](_0xe567('0xb'),_0x578826,_0x7cdd7f);_0x2a65ec(_0x7cdd7f);});});} \ No newline at end of file +var _0xeb0a=['DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x3a5d69,_0x1e2796){var _0x281f97=function(_0x2a2dd7){while(--_0x2a2dd7){_0x3a5d69['push'](_0x3a5d69['shift']());}};_0x281f97(++_0x1e2796);}(_0xeb0a,0x1e9));var _0xaeb0=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xeb0a[_0x56a871];return _0x124954;};'use strict';var _=require(_0xaeb0('0x0'));var util=require('util');var moment=require(_0xaeb0('0x1'));var BPromise=require(_0xaeb0('0x2'));var rs=require(_0xaeb0('0x3'));var fs=require('fs');var Redis=require(_0xaeb0('0x4'));var db=require(_0xaeb0('0x5'))['db'];var utils=require(_0xaeb0('0x6'));var logger=require(_0xaeb0('0x7'))(_0xaeb0('0x8'));var config=require(_0xaeb0('0x9'));var jayson=require(_0xaeb0('0xa'));var client=jayson['client'][_0xaeb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a6ee,_0x52ffcc,_0x36698){return new BPromise(function(_0x3cd9f2,_0x489812){return client[_0xaeb0('0xc')](_0x44a6ee,_0x36698)[_0xaeb0('0xd')](function(_0x21bd9f){logger[_0xaeb0('0xe')](_0xaeb0('0xf'),_0x52ffcc,'request\x20sent');logger[_0xaeb0('0x10')](_0xaeb0('0x11'),_0x52ffcc,_0xaeb0('0x12'),JSON['stringify'](_0x21bd9f));if(_0x21bd9f['error']){if(_0x21bd9f[_0xaeb0('0x13')][_0xaeb0('0x14')]===0x1f4){logger[_0xaeb0('0x13')](_0xaeb0('0xf'),_0x52ffcc,_0x21bd9f['error'][_0xaeb0('0x15')]);return _0x489812(_0x21bd9f['error'][_0xaeb0('0x15')]);}logger[_0xaeb0('0x13')](_0xaeb0('0xf'),_0x52ffcc,_0x21bd9f[_0xaeb0('0x13')]['message']);return _0x3cd9f2(_0x21bd9f[_0xaeb0('0x13')][_0xaeb0('0x15')]);}else{logger[_0xaeb0('0xe')](_0xaeb0('0xf'),_0x52ffcc,'request\x20sent');_0x3cd9f2(_0x21bd9f[_0xaeb0('0x16')]['message']);}})[_0xaeb0('0x17')](function(_0x2e3672){logger[_0xaeb0('0x13')](_0xaeb0('0xf'),_0x52ffcc,_0x2e3672);_0x489812(_0x2e3672);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a19d975..5df4b39 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 _0x72b6=['getConfigurations','post','addConfiguration','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations'];(function(_0x4d0a1b,_0x180f34){var _0x4ba2c8=function(_0x42f53f){while(--_0x42f53f){_0x4d0a1b['push'](_0x4d0a1b['shift']());}};_0x4ba2c8(++_0x180f34);}(_0x72b6,0x1e7));var _0x672b=function(_0x16bd5c,_0x431646){_0x16bd5c=_0x16bd5c-0x0;var _0x498385=_0x72b6[_0x16bd5c];return _0x498385;};'use strict';var multer=require(_0x672b('0x0'));var util=require(_0x672b('0x1'));var path=require(_0x672b('0x2'));var timeout=require('connect-timeout');var express=require(_0x672b('0x3'));var router=express[_0x672b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x672b('0x5'));var interaction=require(_0x672b('0x6'));var config=require(_0x672b('0x7'));var controller=require(_0x672b('0x8'));router[_0x672b('0x9')]('/',auth[_0x672b('0xa')](),controller['index']);router[_0x672b('0x9')](_0x672b('0xb'),auth[_0x672b('0xa')](),controller['show']);router[_0x672b('0x9')](_0x672b('0xc'),auth[_0x672b('0xa')](),controller[_0x672b('0xd')]);router[_0x672b('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x672b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x672b('0xe')](_0x672b('0xc'),auth[_0x672b('0xa')](),controller[_0x672b('0xf')]);router[_0x672b('0x10')](_0x672b('0xb'),auth['isAuthenticated'](),controller[_0x672b('0x11')]);router['delete']('/:id',auth[_0x672b('0xa')](),controller[_0x672b('0x12')]);module[_0x672b('0x13')]=router; \ No newline at end of file +var _0xef98=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','/:id','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3d9e8f,_0x197be8){var _0x52dd70=function(_0xe97063){while(--_0xe97063){_0x3d9e8f['push'](_0x3d9e8f['shift']());}};_0x52dd70(++_0x197be8);}(_0xef98,0x1b3));var _0x8ef9=function(_0x5ad1e0,_0x28e0af){_0x5ad1e0=_0x5ad1e0-0x0;var _0xdc8c62=_0xef98[_0x5ad1e0];return _0xdc8c62;};'use strict';var multer=require(_0x8ef9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ef9('0x1'));var express=require(_0x8ef9('0x2'));var router=express['Router']();var fs_extra=require(_0x8ef9('0x3'));var auth=require(_0x8ef9('0x4'));var interaction=require(_0x8ef9('0x5'));var config=require(_0x8ef9('0x6'));var controller=require(_0x8ef9('0x7'));router['get']('/',auth[_0x8ef9('0x8')](),controller[_0x8ef9('0x9')]);router[_0x8ef9('0xa')]('/:id',auth[_0x8ef9('0x8')](),controller[_0x8ef9('0xb')]);router['get'](_0x8ef9('0xc'),auth[_0x8ef9('0x8')](),controller[_0x8ef9('0xd')]);router[_0x8ef9('0xa')](_0x8ef9('0xe'),auth['isAuthenticated'](),controller[_0x8ef9('0xf')]);router['post']('/',auth[_0x8ef9('0x8')](),controller[_0x8ef9('0x10')]);router['post'](_0x8ef9('0xc'),auth[_0x8ef9('0x8')](),controller[_0x8ef9('0x11')]);router[_0x8ef9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8ef9('0x13')]);router['delete'](_0x8ef9('0x14'),auth[_0x8ef9('0x8')](),controller[_0x8ef9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ab9f675..33e25c0 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 _0x3663=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1e1601,_0x46388f){var _0xc7909f=function(_0xd9558f){while(--_0xd9558f){_0x1e1601['push'](_0x1e1601['shift']());}};_0xc7909f(++_0x46388f);}(_0x3663,0x1cf));var _0x3366=function(_0x3d2ea4,_0xbbfa1d){_0x3d2ea4=_0x3d2ea4-0x0;var _0x2c4a59=_0x3663[_0x3d2ea4];return _0x2c4a59;};'use strict';var Sequelize=require(_0x3366('0x0'));module[_0x3366('0x1')]={'name':{'type':Sequelize[_0x3366('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3366('0x2')]},'remoteUri':{'type':Sequelize[_0x3366('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x3366('0x2')]},'clientSecret':{'type':Sequelize[_0x3366('0x2')]},'serverUrl':{'type':Sequelize[_0x3366('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3366('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3366('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x018c=['exports','STRING','sequelize'];(function(_0x4773c6,_0x2d99fe){var _0x1484b1=function(_0x159f3b){while(--_0x159f3b){_0x4773c6['push'](_0x4773c6['shift']());}};_0x1484b1(++_0x2d99fe);}(_0x018c,0xda));var _0xc018=function(_0x4275c4,_0x103627){_0x4275c4=_0x4275c4-0x0;var _0x3c1999=_0x018c[_0x4275c4];return _0x3c1999;};'use strict';var Sequelize=require(_0xc018('0x0'));module[_0xc018('0x1')]={'name':{'type':Sequelize[_0xc018('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc018('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc018('0x2')]},'clientSecret':{'type':Sequelize[_0xc018('0x2')]},'serverUrl':{'type':Sequelize[_0xc018('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc018('0x2')]},'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 e259882..cd2bcf3 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 _0x1753=['phonecall_activity_parties','accountidname','accountidyominame','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','findOne','password','tenantId','clientId','clientSecret','modernAuthentication','data5','access_token','CloudProvider','data7','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','username','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','lastIndexOf','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','test','statusCode','Wrong\x20credentials','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','getConfigurations','Dynamics365Configuration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode'];(function(_0x10c062,_0x210304){var _0x100e3c=function(_0x241d16){while(--_0x241d16){_0x10c062['push'](_0x10c062['shift']());}};_0x100e3c(++_0x210304);}(_0x1753,0x1e6));var _0x3175=function(_0x2b5205,_0x882c3f){_0x2b5205=_0x2b5205-0x0;var _0xefb0e0=_0x1753[_0x2b5205];return _0xefb0e0;};'use strict';var rp=require(_0x3175('0x0'));var util=require(_0x3175('0x1'));var _=require('lodash');var qs=require(_0x3175('0x2'));var logger=require(_0x3175('0x3'))(_0x3175('0x4'));var db=require(_0x3175('0x5'))['db'];var integrations=require(_0x3175('0x6'));function respondWithResult(_0xb48e16,_0x5d92dc){_0x5d92dc=_0x5d92dc||0xc8;return function(_0x261dff){if(_0x261dff){return _0xb48e16[_0x3175('0x7')](_0x5d92dc)[_0x3175('0x8')](_0x261dff);}};}function respondWithFilteredResult(_0x23b968,_0x159087){return function(_0x1deffc){if(_0x1deffc){var _0xa88284=typeof _0x159087[_0x3175('0x9')]===_0x3175('0xa')&&typeof _0x159087[_0x3175('0xb')]===_0x3175('0xa');var _0x32dbee=_0x1deffc['count'];var _0x109f8a=_0xa88284?0x0:_0x159087[_0x3175('0x9')];var _0x2bc0df=_0xa88284?_0x1deffc[_0x3175('0xc')]:_0x159087[_0x3175('0x9')]+_0x159087[_0x3175('0xb')];var _0x3e1b45;if(_0x2bc0df>=_0x32dbee){_0x2bc0df=_0x32dbee;_0x3e1b45=0xc8;}else{_0x3e1b45=0xce;}_0x23b968[_0x3175('0x7')](_0x3e1b45);return _0x23b968[_0x3175('0xd')](_0x3175('0xe'),_0x109f8a+'-'+_0x2bc0df+'/'+_0x32dbee)[_0x3175('0x8')](_0x1deffc);}return null;};}function saveUpdates(_0x1dc34d){return function(_0x29ae14){if(_0x29ae14){return _0x29ae14[_0x3175('0xf')](_0x1dc34d)[_0x3175('0x10')](function(_0x371c74){return _0x371c74;});}return null;};}function removeEntity(_0x31a1d5){return function(_0x476b27){if(_0x476b27){return _0x476b27[_0x3175('0x11')]()[_0x3175('0x10')](function(){_0x31a1d5[_0x3175('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ca35){return function(_0xfd7346){if(!_0xfd7346){_0x16ca35[_0x3175('0x12')](0x194);}return _0xfd7346;};}function handleError(_0x4923b7,_0x4b2525){_0x4b2525=_0x4b2525||0x1f4;return function(_0x520491){logger[_0x3175('0x13')](_0x520491[_0x3175('0x14')]);if(_0x520491[_0x3175('0x15')]){delete _0x520491[_0x3175('0x15')];}_0x4923b7[_0x3175('0x7')](_0x4b2525)[_0x3175('0x16')](_0x520491);};}exports[_0x3175('0x17')]=function(_0x313c07,_0x5e438c){var _0xb7add8={},_0x287e48={},_0x41ad9c={'count':0x0,'rows':[]};var _0x4c1775=_['map'](db[_0x3175('0x18')][_0x3175('0x19')],function(_0xf12687){return{'name':_0xf12687[_0x3175('0x1a')],'type':_0xf12687[_0x3175('0x1b')]['key']};});_0x287e48[_0x3175('0x1c')]=_[_0x3175('0x1d')](_0x4c1775,'name');_0x287e48[_0x3175('0x1e')]=_[_0x3175('0x1f')](_0x313c07[_0x3175('0x1e')]);_0x287e48[_0x3175('0x20')]=_[_0x3175('0x21')](_0x287e48[_0x3175('0x1c')],_0x287e48[_0x3175('0x1e')]);_0xb7add8['attributes']=_[_0x3175('0x21')](_0x287e48[_0x3175('0x1c')],qs['fields'](_0x313c07[_0x3175('0x1e')]['fields']));_0xb7add8[_0x3175('0x22')]=_0xb7add8['attributes'][_0x3175('0x23')]?_0xb7add8[_0x3175('0x22')]:_0x287e48[_0x3175('0x1c')];if(!_0x313c07[_0x3175('0x1e')][_0x3175('0x24')](_0x3175('0x25'))){_0xb7add8[_0x3175('0xb')]=qs[_0x3175('0xb')](_0x313c07[_0x3175('0x1e')][_0x3175('0xb')]);_0xb7add8[_0x3175('0x9')]=qs[_0x3175('0x9')](_0x313c07[_0x3175('0x1e')][_0x3175('0x9')]);}_0xb7add8[_0x3175('0x26')]=qs[_0x3175('0x27')](_0x313c07[_0x3175('0x1e')][_0x3175('0x27')]);_0xb7add8[_0x3175('0x28')]=qs['filters'](_[_0x3175('0x29')](_0x313c07['query'],_0x287e48[_0x3175('0x20')]),_0x4c1775);if(_0x313c07[_0x3175('0x1e')]['filter']){_0xb7add8[_0x3175('0x28')]=_[_0x3175('0x2a')](_0xb7add8[_0x3175('0x28')],{'$or':_[_0x3175('0x1d')](_0x4c1775,function(_0x5658b1){if(_0x5658b1[_0x3175('0x1b')]!==_0x3175('0x2b')){var _0x3643dc={};_0x3643dc[_0x5658b1[_0x3175('0x15')]]={'$like':'%'+_0x313c07[_0x3175('0x1e')][_0x3175('0x2c')]+'%'};return _0x3643dc;}})});}_0xb7add8=_['merge']({},_0xb7add8,_0x313c07[_0x3175('0x2d')]);var _0xb88c21={'where':_0xb7add8['where']};return db[_0x3175('0x18')][_0x3175('0xc')](_0xb88c21)[_0x3175('0x10')](function(_0x27c26e){_0x41ad9c['count']=_0x27c26e;if(_0x313c07['query'][_0x3175('0x2e')]){_0xb7add8[_0x3175('0x2f')]=[{'all':!![]}];}return db[_0x3175('0x18')][_0x3175('0x30')](_0xb7add8);})[_0x3175('0x10')](function(_0x1903f3){_0x41ad9c[_0x3175('0x31')]=_0x1903f3;return _0x41ad9c;})['then'](respondWithFilteredResult(_0x5e438c,_0xb7add8))[_0x3175('0x32')](handleError(_0x5e438c,null));};exports[_0x3175('0x33')]=function(_0x469f9b,_0x339014){var _0x4083b1={'raw':![],'where':{'id':_0x469f9b[_0x3175('0x34')]['id']}},_0x46b5d4={};_0x46b5d4[_0x3175('0x1c')]=_[_0x3175('0x1f')](db['Dynamics365Account'][_0x3175('0x19')]);_0x46b5d4[_0x3175('0x1e')]=_['keys'](_0x469f9b['query']);_0x46b5d4[_0x3175('0x20')]=_[_0x3175('0x21')](_0x46b5d4[_0x3175('0x1c')],_0x46b5d4[_0x3175('0x1e')]);_0x4083b1[_0x3175('0x22')]=_[_0x3175('0x21')](_0x46b5d4[_0x3175('0x1c')],qs['fields'](_0x469f9b[_0x3175('0x1e')][_0x3175('0x35')]));_0x4083b1[_0x3175('0x22')]=_0x4083b1['attributes'][_0x3175('0x23')]?_0x4083b1[_0x3175('0x22')]:_0x46b5d4[_0x3175('0x1c')];if(_0x469f9b[_0x3175('0x1e')][_0x3175('0x2e')]){_0x4083b1['include']=[{'all':!![]}];}_0x4083b1=_['merge']({},_0x4083b1,_0x469f9b[_0x3175('0x2d')]);return db[_0x3175('0x18')]['find'](_0x4083b1)[_0x3175('0x10')](handleEntityNotFound(_0x339014,null))[_0x3175('0x10')](respondWithResult(_0x339014,null))['catch'](handleError(_0x339014,null));};exports['create']=function(_0x4f27d2,_0x52d0eb){return db[_0x3175('0x18')][_0x3175('0x36')](_0x4f27d2[_0x3175('0x37')],{})['then'](respondWithResult(_0x52d0eb,0xc9))[_0x3175('0x32')](handleError(_0x52d0eb,null));};exports[_0x3175('0xf')]=function(_0x31cebe,_0x11f668){if(_0x31cebe[_0x3175('0x37')]['id']){delete _0x31cebe[_0x3175('0x37')]['id'];}return db[_0x3175('0x18')][_0x3175('0x38')]({'where':{'id':_0x31cebe[_0x3175('0x34')]['id']}})['then'](handleEntityNotFound(_0x11f668,null))['then'](saveUpdates(_0x31cebe[_0x3175('0x37')],null))['then'](respondWithResult(_0x11f668,null))['catch'](handleError(_0x11f668,null));};exports[_0x3175('0x11')]=function(_0x2d4214,_0x1fd177){return db[_0x3175('0x18')][_0x3175('0x38')]({'where':{'id':_0x2d4214['params']['id']}})[_0x3175('0x10')](handleEntityNotFound(_0x1fd177,null))[_0x3175('0x10')](removeEntity(_0x1fd177,null))[_0x3175('0x32')](handleError(_0x1fd177,null));};exports[_0x3175('0x39')]=function(_0x34d4a2,_0x26c384){var _0x278302={};var _0x14d6b1={};var _0x2b0e98;var _0x31c075;return db[_0x3175('0x18')]['findOne']({'where':{'id':_0x34d4a2[_0x3175('0x34')]['id']}})[_0x3175('0x10')](handleEntityNotFound(_0x26c384,null))[_0x3175('0x10')](function(_0x2e8979){if(_0x2e8979){_0x2b0e98=_0x2e8979;_0x14d6b1[_0x3175('0x1c')]=_['keys'](db[_0x3175('0x3a')][_0x3175('0x19')]);_0x14d6b1[_0x3175('0x1e')]=_[_0x3175('0x1f')](_0x34d4a2[_0x3175('0x1e')]);_0x14d6b1[_0x3175('0x20')]=_[_0x3175('0x21')](_0x14d6b1[_0x3175('0x1c')],_0x14d6b1[_0x3175('0x1e')]);_0x278302[_0x3175('0x22')]=_[_0x3175('0x21')](_0x14d6b1['model'],qs[_0x3175('0x35')](_0x34d4a2[_0x3175('0x1e')][_0x3175('0x35')]));_0x278302['attributes']=_0x278302['attributes'][_0x3175('0x23')]?_0x278302[_0x3175('0x22')]:_0x14d6b1[_0x3175('0x1c')];_0x278302[_0x3175('0x26')]=qs[_0x3175('0x27')](_0x34d4a2[_0x3175('0x1e')][_0x3175('0x27')]);_0x278302[_0x3175('0x28')]=qs[_0x3175('0x20')](_['pick'](_0x34d4a2['query'],_0x14d6b1['filters']));if(_0x34d4a2['query']['filter']){_0x278302[_0x3175('0x28')]=_[_0x3175('0x2a')](_0x278302['where'],{'$or':_['map'](_0x278302[_0x3175('0x22')],function(_0x4c0043){var _0x8d267c={};_0x8d267c[_0x4c0043]={'$like':'%'+_0x34d4a2[_0x3175('0x1e')][_0x3175('0x2c')]+'%'};return _0x8d267c;})});}_0x278302=_['merge']({},_0x278302,_0x34d4a2[_0x3175('0x2d')]);return _0x2b0e98[_0x3175('0x39')](_0x278302);}})[_0x3175('0x10')](function(_0x1afedd){if(_0x1afedd){_0x31c075=_0x1afedd[_0x3175('0x23')];if(!_0x34d4a2[_0x3175('0x1e')]['hasOwnProperty'](_0x3175('0x25'))){_0x278302[_0x3175('0xb')]=qs[_0x3175('0xb')](_0x34d4a2['query'][_0x3175('0xb')]);_0x278302[_0x3175('0x9')]=qs['offset'](_0x34d4a2[_0x3175('0x1e')][_0x3175('0x9')]);}return _0x2b0e98[_0x3175('0x39')](_0x278302);}})[_0x3175('0x10')](function(_0x389aab){if(_0x389aab){return _0x389aab?{'count':_0x31c075,'rows':_0x389aab}:null;}})[_0x3175('0x10')](respondWithResult(_0x26c384,null))[_0x3175('0x32')](handleError(_0x26c384,null));};exports[_0x3175('0x3b')]=function(_0x3c268d,_0x11ab8f){if(_0x3c268d[_0x3175('0x37')]['id']){delete _0x3c268d[_0x3175('0x37')]['id'];}return db[_0x3175('0x18')]['findOne']({'where':{'id':_0x3c268d[_0x3175('0x34')]['id']}})['then'](handleEntityNotFound(_0x11ab8f,null))[_0x3175('0x10')](function(_0x271015){if(_0x271015){_0x3c268d[_0x3175('0x37')][_0x3175('0x3c')]=_0x271015['id'];_0x3c268d[_0x3175('0x37')][_0x3175('0x3d')]=integrations['getSubjects'](_0x3c268d[_0x3175('0x37')][_0x3175('0x3e')],_0x3c268d[_0x3175('0x37')][_0x3175('0x1b')]);_0x3c268d[_0x3175('0x37')][_0x3175('0x3f')]=integrations[_0x3175('0x40')](_0x3c268d[_0x3175('0x37')][_0x3175('0x3e')],_0x3c268d['body'][_0x3175('0x1b')]);return db[_0x3175('0x3a')][_0x3175('0x36')](_0x3c268d[_0x3175('0x37')],{'include':[{'model':db[_0x3175('0x41')],'as':'Subjects'},{'model':db[_0x3175('0x41')],'as':'Descriptions'}]});}return null;})[_0x3175('0x10')](respondWithResult(_0x11ab8f,null))[_0x3175('0x32')](handleError(_0x11ab8f,null));};function sanitizeRemoteUri(_0x12bef8){var _0x2a05f2=_0x12bef8[_0x3175('0x42')](-0x1);if(_0x2a05f2==='/')return _0x12bef8[_0x3175('0x43')](0x0,_0x12bef8['lastIndexOf'](_0x2a05f2));return _0x12bef8;}function getWebApiUrl(_0xab6160){return util['format'](_0x3175('0x44'),_0xab6160);}exports['getFields']=function(_0x12cdc5,_0x3251f1){var _0x402075=_0x12cdc5[_0x3175('0x1e')][_0x3175('0x45')];var _0x288bb4=_0x402075===_0x3175('0x46')?_0x3175('0x47'):_0x3175('0x48');var _0x3ae79d='';var _0x5105cf='';var _0x1a979f='';var _0x435ac9='';var _0x4912f3='';var _0x393b19='';var _0x4feccb='';var _0x5c0f6b='';var _0x3af831=[_0x3175('0x49'),_0x3175('0x4a'),_0x3175('0x4b'),_0x3175('0x4c'),_0x3175('0x4d'),'subject',_0x3175('0x4e'),_0x3175('0x4f'),_0x3175('0x50'),_0x3175('0x51')];var _0x17f480=[_0x3175('0x52'),_0x3175('0x53'),'actualserviceunits','billedserviceunits','contactidname',_0x3175('0x54'),_0x3175('0x55'),_0x3175('0x56'),_0x3175('0x57'),'createdbyexternalpartyyominame','createdbyname',_0x3175('0x58'),_0x3175('0x59'),_0x3175('0x5a'),_0x3175('0x5b'),_0x3175('0x5c'),'customeridtype',_0x3175('0x5d'),_0x3175('0x5e'),'entitlementidname',_0x3175('0x5f'),_0x3175('0x60'),_0x3175('0x61'),_0x3175('0x62'),_0x3175('0x63'),_0x3175('0x64'),_0x3175('0x65'),_0x3175('0x66'),_0x3175('0x67'),_0x3175('0x68'),_0x3175('0x69'),_0x3175('0x6a'),'modifiedbyexternalpartyyominame',_0x3175('0x6b'),'modifiedbyyominame','modifiedon',_0x3175('0x6c'),_0x3175('0x6d'),_0x3175('0x6e'),_0x3175('0x6f'),_0x3175('0x70'),_0x3175('0x71'),_0x3175('0x72'),_0x3175('0x73'),_0x3175('0x74'),_0x3175('0x75'),'parentcaseidname',_0x3175('0x76'),_0x3175('0x77'),_0x3175('0x78'),'productidname',_0x3175('0x79'),_0x3175('0x7a'),'resolvebykpiidname',_0x3175('0x7b'),_0x3175('0x7c'),_0x3175('0x7d'),_0x3175('0x7e'),'slainvokedidname',_0x3175('0x7f'),'socialprofileidname','statecode','statuscode',_0x3175('0x80'),_0x3175('0x81'),_0x3175('0x82'),_0x3175('0x83'),_0x3175('0x84'),_0x3175('0x85'),'versionnumber'];var _0x1d0cfd=_0x3af831[_0x3175('0x86')](_0x17f480);return db[_0x3175('0x18')][_0x3175('0x87')]({'where':{'id':_0x12cdc5[_0x3175('0x34')]['id']},'attributes':['id','username',_0x3175('0x88'),'remoteUri',_0x3175('0x89'),_0x3175('0x8a'),_0x3175('0x8b'),_0x3175('0x8c')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x3175('0x8d'),'data7']}]})['then'](handleEntityNotFound(_0x3251f1,null))[_0x3175('0x10')](function(_0x5ed619){if(_0x5ed619){if(_0x5ed619['modernAuthentication']){_0x5ed619[_0x3175('0x8e')]=_0x5ed619[_0x3175('0x8f')][_0x3175('0x8d')];_0x5c0f6b=sanitizeRemoteUri(_0x5ed619[_0x3175('0x8f')][_0x3175('0x90')]);_0x4feccb=getWebApiUrl(_0x5c0f6b);return _0x5ed619;}_0x5c0f6b=sanitizeRemoteUri(_0x5ed619[_0x3175('0x91')]);_0x4feccb=getWebApiUrl(_0x5c0f6b);var _0x441c18={'method':_0x3175('0x92'),'uri':_0x3175('0x93')+_0x5ed619[_0x3175('0x89')]+_0x3175('0x94'),'form':{'client_id':_0x5ed619[_0x3175('0x8a')],'resource':_0x5c0f6b,'username':_0x5ed619[_0x3175('0x95')],'password':_0x5ed619['password'],'grant_type':_0x3175('0x88'),'client_secret':_0x5ed619['clientSecret']},'json':!![]};return rp(_0x441c18);}})['then'](function(_0x1c1878){_0x393b19=_0x1c1878[_0x3175('0x8e')];var _0x405fda={'method':'GET','uri':encodeURI(_0x4feccb+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x288bb4+'\x27'),'headers':{'Authorization':_0x3175('0x96')+_0x393b19,'If-None-Match':null,'OData-Version':_0x3175('0x97')},'json':!![]};return rp(_0x405fda);})[_0x3175('0x10')](function(_0x34d5c7){var _0x22f08b=_0x34d5c7[_0x3175('0x98')][0x0];var _0x7a815a=_0x22f08b[_0x3175('0x99')];var _0x4f06df={'method':'GET','uri':_0x4feccb+_0x3175('0x9a')+_0x7a815a+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x3175('0x96')+_0x393b19,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4f06df);})[_0x3175('0x10')](function(_0x4633c8){_0x3ae79d=_0x4633c8;_0x5105cf=_0x3ae79d[_0x3175('0x9b')];_0x5105cf=_['remove'](_0x5105cf,function(_0x3251a4){return!_0x1d0cfd[_0x3175('0x9c')](_0x3251a4[_0x3175('0x9d')]);});var _0x2cf961=[];var _0x3dec33=[];_0x5105cf[_0x3175('0x9e')](function(_0x32516a){if(_0x32516a[_0x3175('0x9f')]){var _0x416af2=_0x32516a[_0x3175('0x9f')][_0x3175('0x43')](_0x32516a[_0x3175('0x9f')]['lastIndexOf']('.')+0x1);if(_0x416af2===_0x3175('0xa0')){_0x2cf961[_0x3175('0xa1')](getSelectList(_0x4feccb,_0x402075,_0x3dec33,_0x3ae79d[_0x3175('0x99')],_0x32516a[_0x3175('0x99')],_0x393b19));}}});return Promise[_0x3175('0xa2')](_0x2cf961);})['then'](function(_0x485486){_0x1a979f=_0x485486[0x0];var _0x328ec4=[];var _0x506f98=[];_0x5105cf['forEach'](function(_0x4181f5){if(!_[_0x3175('0xa3')](_0x4181f5[_0x3175('0x9f')])){var _0x194032=_0x4181f5[_0x3175('0x9f')][_0x3175('0x43')](_0x4181f5['@odata.type']['lastIndexOf']('.')+0x1);if(_0x194032==='BooleanAttributeMetadata'){_0x328ec4[_0x3175('0xa1')](getBooleanList(_0x4feccb,_0x402075,_0x506f98,_0x3ae79d[_0x3175('0x99')],_0x4181f5['MetadataId'],_0x393b19));}}});return Promise[_0x3175('0xa2')](_0x328ec4);})[_0x3175('0x10')](function(_0x4c249a){_0x435ac9=_0x4c249a[0x0];var _0x52f9f9=[];var _0x1696ae=[];_0x5105cf[_0x3175('0x9e')](function(_0x393dfc){if(_0x393dfc[_0x3175('0x9f')]){var _0x122c8e=_0x393dfc[_0x3175('0x9f')][_0x3175('0x43')](_0x393dfc[_0x3175('0x9f')][_0x3175('0xa4')]('.')+0x1);if(_0x122c8e==='StringAttributeMetadata'||_0x122c8e===_0x3175('0xa5')||_0x122c8e===_0x3175('0xa6')||_0x122c8e===_0x3175('0xa7')||_0x122c8e===_0x3175('0xa8')||_0x122c8e===_0x3175('0xa9')||_0x122c8e===_0x3175('0xaa')||_0x122c8e===_0x3175('0xab')||_0x122c8e==='StateAttributeMetadata'||_0x122c8e==='DecimalAttributeMetadata'){_0x52f9f9[_0x3175('0xa1')](getInputList(_0x4feccb,_0x402075,_0x122c8e,_0x1696ae,_0x3ae79d[_0x3175('0x99')],_0x393dfc[_0x3175('0x99')],_0x393b19));}}});return Promise[_0x3175('0xa2')](_0x52f9f9);})['then'](function(_0x2fcde3){_0x4912f3=_0x2fcde3[0x0];var _0x4ad06b=_0x1a979f['concat'](_0x435ac9)[_0x3175('0x86')](_0x4912f3);var _0x4b913f={'count':_0x4ad06b[_0x3175('0x23')],'rows':_0x4ad06b};return _0x4b913f;})['then'](respondWithResult(_0x3251f1,null))[_0x3175('0x32')](function(_0x4ca7b6){var _0x39a8bf=_0x12cdc5[_0x3175('0x1e')][_0x3175('0xac')]?0x1f4:_0x4ca7b6[_0x3175('0xad')]||0x1f4;logger[_0x3175('0x13')](_0x4ca7b6[_0x3175('0x14')]);delete _0x4ca7b6[_0x3175('0x15')];if(_0x39a8bf===0x191){_0x39a8bf=0x190;}_0x3251f1['status'](_0x39a8bf)[_0x3175('0x16')](_0x12cdc5[_0x3175('0x1e')]['test']?{'message':_0x3175('0xae'),'statusCode':_0x4ca7b6[_0x3175('0xad')]}:_0x4ca7b6);});};function getSelectList(_0x5bc9b7,_0x4f005f,_0x20cd47,_0x58c370,_0x5db017,_0x1fe0ad){var _0x4dd125={'method':_0x3175('0xaf'),'uri':_0x5bc9b7+'EntityDefinitions('+_0x58c370+_0x3175('0xb0')+_0x5db017+_0x3175('0xb1')+_0x3175('0xb2'),'headers':{'Authorization':_0x3175('0x96')+_0x1fe0ad,'If-None-Match':null,'OData-Version':_0x3175('0x97')},'json':!![]};return rp(_0x4dd125)['then'](function(_0x4fbd13){var _0x3cff97=[];var _0x1f7151=_0x4fbd13['OptionSet'][_0x3175('0xb3')];_0x1f7151[_0x3175('0x9e')](function(_0x4e6e9e){_0x3cff97[_0x3175('0xa1')]({'name':_0x4e6e9e['Label'][_0x3175('0xb4')][_0x3175('0xb5')],'value':String(_0x4e6e9e['Value'])});});var _0x4e7740={'id':_0x4f005f+'_'+_0x4fbd13['LogicalName'],'name':_0x4fbd13[_0x3175('0xb6')]['UserLocalizedLabel'][_0x3175('0xb5')],'custom':![],'options':_0x3cff97};_0x20cd47[_0x3175('0xa1')](_0x4e7740);return _0x20cd47;});}function getBooleanList(_0x37d3ab,_0x3e75cd,_0x4460dc,_0x3ed2b3,_0x5b81ea,_0x4b123c){var _0x25b463={'method':_0x3175('0xaf'),'uri':_0x37d3ab+'EntityDefinitions('+_0x3ed2b3+')/Attributes('+_0x5b81ea+_0x3175('0xb7'),'headers':{'Authorization':_0x3175('0x96')+_0x4b123c,'If-None-Match':null,'OData-Version':_0x3175('0x97')},'json':!![]};return rp(_0x25b463)[_0x3175('0x10')](function(_0x22d5cd){var _0x540f4f=[];_0x540f4f[_0x3175('0xa1')]({'name':_0x22d5cd[_0x3175('0xb8')][_0x3175('0xb9')][_0x3175('0xb5')]['UserLocalizedLabel'][_0x3175('0xb5')],'value':_0x3175('0xba')},{'name':_0x22d5cd[_0x3175('0xb8')][_0x3175('0xbb')][_0x3175('0xb5')][_0x3175('0xb4')]['Label'],'value':'false'});var _0xd57bf9={'id':_0x3e75cd+'_'+_0x22d5cd[_0x3175('0x9d')],'name':_0x22d5cd[_0x3175('0xb6')][_0x3175('0xb4')]['Label'],'custom':![],'options':_0x540f4f};_0x4460dc[_0x3175('0xa1')](_0xd57bf9);return _0x4460dc;});}function getInputList(_0x4e389e,_0x2a9415,_0x41c640,_0x3e8ea6,_0x17555c,_0x1a89e5,_0x285c5c){var _0x5ef14a={'method':_0x3175('0xaf'),'uri':_0x4e389e+_0x3175('0x9a')+_0x17555c+_0x3175('0xb0')+_0x1a89e5+')/Microsoft.Dynamics.CRM.'+_0x41c640+_0x3175('0xbc'),'headers':{'Authorization':_0x3175('0x96')+_0x285c5c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5ef14a)[_0x3175('0x10')](function(_0x1c1cf0){var _0x3f06c2={'id':_0x2a9415+'_'+_0x1c1cf0[_0x3175('0x9d')],'name':_0x1c1cf0[_0x3175('0xb6')][_0x3175('0xb4')]?_0x1c1cf0[_0x3175('0xb6')][_0x3175('0xb4')][_0x3175('0xb5')]:_0x1c1cf0[_0x3175('0x9d')],'custom':![],'options':[]};_0x3e8ea6['push'](_0x3f06c2);return _0x3e8ea6;});} \ No newline at end of file +var _0xec81=['PhoneCall','title','customerid','caseorigincode','subject','phonenumber','directioncode','accountidname','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','versionnumber','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','https://login.microsoftonline.com/','username','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','@odata.type','substring','push','forEach','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Dynamics365Account','include','findAll','catch','show','keys','includeAll','find','create','body','params','findOne','Dynamics365Configuration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xec81,0x71));var _0x1ec8=function(_0x2ea708,_0x45cca0){_0x2ea708=_0x2ea708-0x0;var _0x2c5c43=_0xec81[_0x2ea708];return _0x2c5c43;};'use strict';var rp=require('request-promise');var util=require(_0x1ec8('0x0'));var _=require('lodash');var qs=require(_0x1ec8('0x1'));var logger=require('../../config/logger')(_0x1ec8('0x2'));var db=require(_0x1ec8('0x3'))['db'];var integrations=require(_0x1ec8('0x4'));function respondWithResult(_0x8c38ea,_0x1ae5d6){_0x1ae5d6=_0x1ae5d6||0xc8;return function(_0x3581b3){if(_0x3581b3){return _0x8c38ea[_0x1ec8('0x5')](_0x1ae5d6)[_0x1ec8('0x6')](_0x3581b3);}};}function respondWithFilteredResult(_0x58ab6d,_0x273c0a){return function(_0x4091ba){if(_0x4091ba){var _0x4cc35e=typeof _0x273c0a[_0x1ec8('0x7')]===_0x1ec8('0x8')&&typeof _0x273c0a['limit']===_0x1ec8('0x8');var _0x2d9916=_0x4091ba[_0x1ec8('0x9')];var _0x3b129b=_0x4cc35e?0x0:_0x273c0a[_0x1ec8('0x7')];var _0x518e40=_0x4cc35e?_0x4091ba[_0x1ec8('0x9')]:_0x273c0a[_0x1ec8('0x7')]+_0x273c0a[_0x1ec8('0xa')];var _0x2123cd;if(_0x518e40>=_0x2d9916){_0x518e40=_0x2d9916;_0x2123cd=0xc8;}else{_0x2123cd=0xce;}_0x58ab6d[_0x1ec8('0x5')](_0x2123cd);return _0x58ab6d[_0x1ec8('0xb')](_0x1ec8('0xc'),_0x3b129b+'-'+_0x518e40+'/'+_0x2d9916)['json'](_0x4091ba);}return null;};}function saveUpdates(_0x37e0f0){return function(_0xd5e08a){if(_0xd5e08a){return _0xd5e08a[_0x1ec8('0xd')](_0x37e0f0)[_0x1ec8('0xe')](function(_0x2bfc13){return _0x2bfc13;});}return null;};}function removeEntity(_0x45ffaa){return function(_0x4bd2d6){if(_0x4bd2d6){return _0x4bd2d6[_0x1ec8('0xf')]()[_0x1ec8('0xe')](function(){_0x45ffaa[_0x1ec8('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141e8e){return function(_0x3e5867){if(!_0x3e5867){_0x141e8e[_0x1ec8('0x10')](0x194);}return _0x3e5867;};}function handleError(_0x2229c2,_0x385413){_0x385413=_0x385413||0x1f4;return function(_0x312adc){logger[_0x1ec8('0x11')](_0x312adc[_0x1ec8('0x12')]);if(_0x312adc['name']){delete _0x312adc[_0x1ec8('0x13')];}_0x2229c2[_0x1ec8('0x5')](_0x385413)[_0x1ec8('0x14')](_0x312adc);};}exports[_0x1ec8('0x15')]=function(_0x2e8e1e,_0x2eccfd){var _0x9d2bad={},_0x30fe9c={},_0x3a27ce={'count':0x0,'rows':[]};var _0x76da3c=_['map'](db['Dynamics365Account'][_0x1ec8('0x16')],function(_0x51f3c8){return{'name':_0x51f3c8[_0x1ec8('0x17')],'type':_0x51f3c8[_0x1ec8('0x18')]['key']};});_0x30fe9c[_0x1ec8('0x19')]=_[_0x1ec8('0x1a')](_0x76da3c,_0x1ec8('0x13'));_0x30fe9c[_0x1ec8('0x1b')]=_['keys'](_0x2e8e1e[_0x1ec8('0x1b')]);_0x30fe9c[_0x1ec8('0x1c')]=_[_0x1ec8('0x1d')](_0x30fe9c[_0x1ec8('0x19')],_0x30fe9c[_0x1ec8('0x1b')]);_0x9d2bad[_0x1ec8('0x1e')]=_[_0x1ec8('0x1d')](_0x30fe9c[_0x1ec8('0x19')],qs[_0x1ec8('0x1f')](_0x2e8e1e[_0x1ec8('0x1b')][_0x1ec8('0x1f')]));_0x9d2bad['attributes']=_0x9d2bad[_0x1ec8('0x1e')][_0x1ec8('0x20')]?_0x9d2bad[_0x1ec8('0x1e')]:_0x30fe9c[_0x1ec8('0x19')];if(!_0x2e8e1e[_0x1ec8('0x1b')]['hasOwnProperty'](_0x1ec8('0x21'))){_0x9d2bad[_0x1ec8('0xa')]=qs[_0x1ec8('0xa')](_0x2e8e1e['query'][_0x1ec8('0xa')]);_0x9d2bad['offset']=qs[_0x1ec8('0x7')](_0x2e8e1e[_0x1ec8('0x1b')][_0x1ec8('0x7')]);}_0x9d2bad[_0x1ec8('0x22')]=qs[_0x1ec8('0x23')](_0x2e8e1e[_0x1ec8('0x1b')][_0x1ec8('0x23')]);_0x9d2bad['where']=qs[_0x1ec8('0x1c')](_[_0x1ec8('0x24')](_0x2e8e1e[_0x1ec8('0x1b')],_0x30fe9c[_0x1ec8('0x1c')]),_0x76da3c);if(_0x2e8e1e[_0x1ec8('0x1b')][_0x1ec8('0x25')]){_0x9d2bad[_0x1ec8('0x26')]=_[_0x1ec8('0x27')](_0x9d2bad[_0x1ec8('0x26')],{'$or':_[_0x1ec8('0x1a')](_0x76da3c,function(_0x12c70c){if(_0x12c70c[_0x1ec8('0x18')]!==_0x1ec8('0x28')){var _0x3be417={};_0x3be417[_0x12c70c[_0x1ec8('0x13')]]={'$like':'%'+_0x2e8e1e[_0x1ec8('0x1b')]['filter']+'%'};return _0x3be417;}})});}_0x9d2bad=_[_0x1ec8('0x27')]({},_0x9d2bad,_0x2e8e1e[_0x1ec8('0x29')]);var _0x5f2c4e={'where':_0x9d2bad[_0x1ec8('0x26')]};return db[_0x1ec8('0x2a')][_0x1ec8('0x9')](_0x5f2c4e)[_0x1ec8('0xe')](function(_0x283baa){_0x3a27ce[_0x1ec8('0x9')]=_0x283baa;if(_0x2e8e1e[_0x1ec8('0x1b')]['includeAll']){_0x9d2bad[_0x1ec8('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x1ec8('0x2c')](_0x9d2bad);})['then'](function(_0xd5c5b){_0x3a27ce['rows']=_0xd5c5b;return _0x3a27ce;})[_0x1ec8('0xe')](respondWithFilteredResult(_0x2eccfd,_0x9d2bad))[_0x1ec8('0x2d')](handleError(_0x2eccfd,null));};exports[_0x1ec8('0x2e')]=function(_0x3e33f1,_0x2a1d35){var _0x1fdded={'raw':![],'where':{'id':_0x3e33f1['params']['id']}},_0x2f12d7={};_0x2f12d7[_0x1ec8('0x19')]=_['keys'](db['Dynamics365Account'][_0x1ec8('0x16')]);_0x2f12d7[_0x1ec8('0x1b')]=_[_0x1ec8('0x2f')](_0x3e33f1[_0x1ec8('0x1b')]);_0x2f12d7[_0x1ec8('0x1c')]=_['intersection'](_0x2f12d7[_0x1ec8('0x19')],_0x2f12d7['query']);_0x1fdded[_0x1ec8('0x1e')]=_[_0x1ec8('0x1d')](_0x2f12d7['model'],qs[_0x1ec8('0x1f')](_0x3e33f1[_0x1ec8('0x1b')][_0x1ec8('0x1f')]));_0x1fdded[_0x1ec8('0x1e')]=_0x1fdded[_0x1ec8('0x1e')][_0x1ec8('0x20')]?_0x1fdded[_0x1ec8('0x1e')]:_0x2f12d7[_0x1ec8('0x19')];if(_0x3e33f1['query'][_0x1ec8('0x30')]){_0x1fdded[_0x1ec8('0x2b')]=[{'all':!![]}];}_0x1fdded=_['merge']({},_0x1fdded,_0x3e33f1['options']);return db[_0x1ec8('0x2a')][_0x1ec8('0x31')](_0x1fdded)['then'](handleEntityNotFound(_0x2a1d35,null))[_0x1ec8('0xe')](respondWithResult(_0x2a1d35,null))[_0x1ec8('0x2d')](handleError(_0x2a1d35,null));};exports[_0x1ec8('0x32')]=function(_0x18e6e0,_0x5ab691){return db[_0x1ec8('0x2a')][_0x1ec8('0x32')](_0x18e6e0[_0x1ec8('0x33')],{})[_0x1ec8('0xe')](respondWithResult(_0x5ab691,0xc9))[_0x1ec8('0x2d')](handleError(_0x5ab691,null));};exports[_0x1ec8('0xd')]=function(_0x2dee2a,_0xb87216){if(_0x2dee2a[_0x1ec8('0x33')]['id']){delete _0x2dee2a['body']['id'];}return db[_0x1ec8('0x2a')][_0x1ec8('0x31')]({'where':{'id':_0x2dee2a['params']['id']}})[_0x1ec8('0xe')](handleEntityNotFound(_0xb87216,null))['then'](saveUpdates(_0x2dee2a[_0x1ec8('0x33')],null))['then'](respondWithResult(_0xb87216,null))['catch'](handleError(_0xb87216,null));};exports[_0x1ec8('0xf')]=function(_0x4464db,_0x2f300b){return db[_0x1ec8('0x2a')][_0x1ec8('0x31')]({'where':{'id':_0x4464db[_0x1ec8('0x34')]['id']}})['then'](handleEntityNotFound(_0x2f300b,null))[_0x1ec8('0xe')](removeEntity(_0x2f300b,null))[_0x1ec8('0x2d')](handleError(_0x2f300b,null));};exports['getConfigurations']=function(_0x2e7451,_0x275093){var _0xa06799={};var _0x4cecfe={};var _0x48de37;var _0x366892;return db[_0x1ec8('0x2a')][_0x1ec8('0x35')]({'where':{'id':_0x2e7451[_0x1ec8('0x34')]['id']}})[_0x1ec8('0xe')](handleEntityNotFound(_0x275093,null))[_0x1ec8('0xe')](function(_0x2ff4e2){if(_0x2ff4e2){_0x48de37=_0x2ff4e2;_0x4cecfe[_0x1ec8('0x19')]=_[_0x1ec8('0x2f')](db[_0x1ec8('0x36')][_0x1ec8('0x16')]);_0x4cecfe[_0x1ec8('0x1b')]=_[_0x1ec8('0x2f')](_0x2e7451[_0x1ec8('0x1b')]);_0x4cecfe[_0x1ec8('0x1c')]=_['intersection'](_0x4cecfe[_0x1ec8('0x19')],_0x4cecfe[_0x1ec8('0x1b')]);_0xa06799[_0x1ec8('0x1e')]=_[_0x1ec8('0x1d')](_0x4cecfe[_0x1ec8('0x19')],qs['fields'](_0x2e7451[_0x1ec8('0x1b')][_0x1ec8('0x1f')]));_0xa06799[_0x1ec8('0x1e')]=_0xa06799[_0x1ec8('0x1e')][_0x1ec8('0x20')]?_0xa06799[_0x1ec8('0x1e')]:_0x4cecfe[_0x1ec8('0x19')];_0xa06799['order']=qs[_0x1ec8('0x23')](_0x2e7451['query'][_0x1ec8('0x23')]);_0xa06799[_0x1ec8('0x26')]=qs[_0x1ec8('0x1c')](_[_0x1ec8('0x24')](_0x2e7451[_0x1ec8('0x1b')],_0x4cecfe['filters']));if(_0x2e7451[_0x1ec8('0x1b')][_0x1ec8('0x25')]){_0xa06799[_0x1ec8('0x26')]=_[_0x1ec8('0x27')](_0xa06799[_0x1ec8('0x26')],{'$or':_[_0x1ec8('0x1a')](_0xa06799[_0x1ec8('0x1e')],function(_0x46cf24){var _0x5bc84c={};_0x5bc84c[_0x46cf24]={'$like':'%'+_0x2e7451[_0x1ec8('0x1b')][_0x1ec8('0x25')]+'%'};return _0x5bc84c;})});}_0xa06799=_[_0x1ec8('0x27')]({},_0xa06799,_0x2e7451[_0x1ec8('0x29')]);return _0x48de37[_0x1ec8('0x37')](_0xa06799);}})[_0x1ec8('0xe')](function(_0x40524b){if(_0x40524b){_0x366892=_0x40524b[_0x1ec8('0x20')];if(!_0x2e7451['query'][_0x1ec8('0x38')]('nolimit')){_0xa06799[_0x1ec8('0xa')]=qs[_0x1ec8('0xa')](_0x2e7451['query'][_0x1ec8('0xa')]);_0xa06799[_0x1ec8('0x7')]=qs['offset'](_0x2e7451[_0x1ec8('0x1b')][_0x1ec8('0x7')]);}return _0x48de37[_0x1ec8('0x37')](_0xa06799);}})[_0x1ec8('0xe')](function(_0x3e9373){if(_0x3e9373){return _0x3e9373?{'count':_0x366892,'rows':_0x3e9373}:null;}})[_0x1ec8('0xe')](respondWithResult(_0x275093,null))[_0x1ec8('0x2d')](handleError(_0x275093,null));};exports[_0x1ec8('0x39')]=function(_0x327e57,_0x534b4e){if(_0x327e57[_0x1ec8('0x33')]['id']){delete _0x327e57[_0x1ec8('0x33')]['id'];}return db[_0x1ec8('0x2a')][_0x1ec8('0x35')]({'where':{'id':_0x327e57[_0x1ec8('0x34')]['id']}})[_0x1ec8('0xe')](handleEntityNotFound(_0x534b4e,null))[_0x1ec8('0xe')](function(_0xaf89a){if(_0xaf89a){_0x327e57[_0x1ec8('0x33')][_0x1ec8('0x3a')]=_0xaf89a['id'];_0x327e57['body']['Subjects']=integrations[_0x1ec8('0x3b')](_0x327e57[_0x1ec8('0x33')]['channel'],_0x327e57[_0x1ec8('0x33')][_0x1ec8('0x18')]);_0x327e57[_0x1ec8('0x33')][_0x1ec8('0x3c')]=integrations[_0x1ec8('0x3d')](_0x327e57[_0x1ec8('0x33')][_0x1ec8('0x3e')],_0x327e57[_0x1ec8('0x33')][_0x1ec8('0x18')]);return db['Dynamics365Configuration'][_0x1ec8('0x32')](_0x327e57[_0x1ec8('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':_0x1ec8('0x3f')},{'model':db['Dynamics365Field'],'as':_0x1ec8('0x3c')}]});}return null;})[_0x1ec8('0xe')](respondWithResult(_0x534b4e,null))['catch'](handleError(_0x534b4e,null));};function sanitizeRemoteUri(_0x2f264b){var _0x53a5c4=_0x2f264b[_0x1ec8('0x40')](-0x1);if(_0x53a5c4==='/')return _0x2f264b['substring'](0x0,_0x2f264b[_0x1ec8('0x41')](_0x53a5c4));return _0x2f264b;}function getWebApiUrl(_0xd6e8ff){return util[_0x1ec8('0x42')](_0x1ec8('0x43'),_0xd6e8ff);}exports[_0x1ec8('0x44')]=function(_0x283fee,_0x1cd8e2){var _0x5cc540=_0x283fee[_0x1ec8('0x1b')][_0x1ec8('0x45')];var _0x1e14c3=_0x5cc540===_0x1ec8('0x46')?_0x1ec8('0x47'):_0x1ec8('0x48');var _0x357df7='';var _0x45ba4d='';var _0x2ef8bb='';var _0x3f373a='';var _0x5df08b='';var _0x4aea87='';var _0x150d7a='';var _0x43912c='';var _0x4e4de1=[_0x1ec8('0x49'),'description',_0x1ec8('0x4a'),'ownerid',_0x1ec8('0x4b'),_0x1ec8('0x4c'),_0x1ec8('0x4d'),'regardingobjectid',_0x1ec8('0x4e'),'phonecall_activity_parties'];var _0x14693e=[_0x1ec8('0x4f'),'accountidyominame','actualserviceunits','billedserviceunits',_0x1ec8('0x50'),_0x1ec8('0x51'),_0x1ec8('0x52'),_0x1ec8('0x53'),'createdbyexternalpartyname',_0x1ec8('0x54'),_0x1ec8('0x55'),'createdbyyominame',_0x1ec8('0x56'),_0x1ec8('0x57'),_0x1ec8('0x58'),_0x1ec8('0x59'),_0x1ec8('0x5a'),_0x1ec8('0x5b'),_0x1ec8('0x5c'),'entitlementidname',_0x1ec8('0x5d'),_0x1ec8('0x5e'),_0x1ec8('0x5f'),_0x1ec8('0x60'),_0x1ec8('0x61'),_0x1ec8('0x62'),_0x1ec8('0x63'),_0x1ec8('0x64'),_0x1ec8('0x65'),'lastonholdtime','masteridname',_0x1ec8('0x66'),_0x1ec8('0x67'),_0x1ec8('0x68'),'modifiedbyyominame',_0x1ec8('0x69'),_0x1ec8('0x6a'),_0x1ec8('0x6b'),_0x1ec8('0x6c'),_0x1ec8('0x6d'),_0x1ec8('0x6e'),_0x1ec8('0x6f'),'overriddencreatedon',_0x1ec8('0x70'),_0x1ec8('0x71'),'owneridyominame',_0x1ec8('0x72'),_0x1ec8('0x73'),_0x1ec8('0x74'),_0x1ec8('0x75'),_0x1ec8('0x76'),_0x1ec8('0x77'),'resolveby',_0x1ec8('0x78'),_0x1ec8('0x79'),_0x1ec8('0x7a'),_0x1ec8('0x7b'),_0x1ec8('0x7c'),_0x1ec8('0x7d'),_0x1ec8('0x7e'),_0x1ec8('0x7f'),'statecode',_0x1ec8('0x80'),'subjectidname',_0x1ec8('0x81'),_0x1ec8('0x82'),'transactioncurrencyidname',_0x1ec8('0x83'),'utcconversiontimezonecode',_0x1ec8('0x84')];var _0x5b5994=_0x4e4de1['concat'](_0x14693e);return db[_0x1ec8('0x2a')][_0x1ec8('0x35')]({'where':{'id':_0x283fee[_0x1ec8('0x34')]['id']},'attributes':['id','username','password',_0x1ec8('0x85'),_0x1ec8('0x86'),_0x1ec8('0x87'),_0x1ec8('0x88'),_0x1ec8('0x89')],'include':[{'model':db['CloudProvider'],'as':_0x1ec8('0x8a'),'attributes':['id',_0x1ec8('0x8b'),'data7']}]})['then'](handleEntityNotFound(_0x1cd8e2,null))[_0x1ec8('0xe')](function(_0x4ca6fe){if(_0x4ca6fe){if(_0x4ca6fe[_0x1ec8('0x89')]){_0x4ca6fe[_0x1ec8('0x8c')]=_0x4ca6fe['CloudProvider']['data5'];_0x43912c=sanitizeRemoteUri(_0x4ca6fe[_0x1ec8('0x8a')][_0x1ec8('0x8d')]);_0x150d7a=getWebApiUrl(_0x43912c);return _0x4ca6fe;}_0x43912c=sanitizeRemoteUri(_0x4ca6fe[_0x1ec8('0x85')]);_0x150d7a=getWebApiUrl(_0x43912c);var _0x54cf60={'method':'POST','uri':_0x1ec8('0x8e')+_0x4ca6fe[_0x1ec8('0x86')]+'/oauth2/token','form':{'client_id':_0x4ca6fe[_0x1ec8('0x87')],'resource':_0x43912c,'username':_0x4ca6fe[_0x1ec8('0x8f')],'password':_0x4ca6fe[_0x1ec8('0x90')],'grant_type':_0x1ec8('0x90'),'client_secret':_0x4ca6fe['clientSecret']},'json':!![]};return rp(_0x54cf60);}})[_0x1ec8('0xe')](function(_0x25e64b){_0x4aea87=_0x25e64b[_0x1ec8('0x8c')];var _0x3064be={'method':_0x1ec8('0x91'),'uri':encodeURI(_0x150d7a+_0x1ec8('0x92')+_0x1e14c3+'\x27'),'headers':{'Authorization':_0x1ec8('0x93')+_0x4aea87,'If-None-Match':null,'OData-Version':_0x1ec8('0x94')},'json':!![]};return rp(_0x3064be);})['then'](function(_0x5a8bb3){var _0x349af4=_0x5a8bb3[_0x1ec8('0x95')][0x0];var _0x4e2cf3=_0x349af4[_0x1ec8('0x96')];var _0x5fa102={'method':_0x1ec8('0x91'),'uri':_0x150d7a+'EntityDefinitions('+_0x4e2cf3+_0x1ec8('0x97'),'headers':{'Authorization':_0x1ec8('0x93')+_0x4aea87,'If-None-Match':null,'OData-Version':_0x1ec8('0x94')},'json':!![]};return rp(_0x5fa102);})[_0x1ec8('0xe')](function(_0x25c634){_0x357df7=_0x25c634;_0x45ba4d=_0x357df7[_0x1ec8('0x98')];_0x45ba4d=_[_0x1ec8('0x99')](_0x45ba4d,function(_0x3edf10){return!_0x5b5994['includes'](_0x3edf10[_0x1ec8('0x9a')]);});var _0x2c562b=[];var _0x3eb594=[];_0x45ba4d['forEach'](function(_0x355c38){if(_0x355c38[_0x1ec8('0x9b')]){var _0x4f464f=_0x355c38[_0x1ec8('0x9b')][_0x1ec8('0x9c')](_0x355c38['@odata.type'][_0x1ec8('0x41')]('.')+0x1);if(_0x4f464f==='PicklistAttributeMetadata'){_0x2c562b[_0x1ec8('0x9d')](getSelectList(_0x150d7a,_0x5cc540,_0x3eb594,_0x357df7[_0x1ec8('0x96')],_0x355c38[_0x1ec8('0x96')],_0x4aea87));}}});return Promise['all'](_0x2c562b);})[_0x1ec8('0xe')](function(_0x4570b7){_0x2ef8bb=_0x4570b7[0x0];var _0x2a06fd=[];var _0x45e33d=[];_0x45ba4d[_0x1ec8('0x9e')](function(_0x3768cd){if(!_[_0x1ec8('0x9f')](_0x3768cd[_0x1ec8('0x9b')])){var _0x35f771=_0x3768cd['@odata.type']['substring'](_0x3768cd[_0x1ec8('0x9b')][_0x1ec8('0x41')]('.')+0x1);if(_0x35f771==='BooleanAttributeMetadata'){_0x2a06fd[_0x1ec8('0x9d')](getBooleanList(_0x150d7a,_0x5cc540,_0x45e33d,_0x357df7[_0x1ec8('0x96')],_0x3768cd[_0x1ec8('0x96')],_0x4aea87));}}});return Promise[_0x1ec8('0xa0')](_0x2a06fd);})[_0x1ec8('0xe')](function(_0x29cd03){_0x3f373a=_0x29cd03[0x0];var _0x5a33ed=[];var _0x47231a=[];_0x45ba4d['forEach'](function(_0x2b9513){if(_0x2b9513[_0x1ec8('0x9b')]){var _0x2c523d=_0x2b9513[_0x1ec8('0x9b')][_0x1ec8('0x9c')](_0x2b9513[_0x1ec8('0x9b')]['lastIndexOf']('.')+0x1);if(_0x2c523d===_0x1ec8('0xa1')||_0x2c523d===_0x1ec8('0xa2')||_0x2c523d==='BigIntAttributeMetadata'||_0x2c523d===_0x1ec8('0xa3')||_0x2c523d==='MemoAttributeMetadata'||_0x2c523d===_0x1ec8('0xa4')||_0x2c523d==='StatusAttributeMetadata'||_0x2c523d===_0x1ec8('0xa5')||_0x2c523d===_0x1ec8('0xa6')||_0x2c523d===_0x1ec8('0xa7')){_0x5a33ed[_0x1ec8('0x9d')](getInputList(_0x150d7a,_0x5cc540,_0x2c523d,_0x47231a,_0x357df7[_0x1ec8('0x96')],_0x2b9513[_0x1ec8('0x96')],_0x4aea87));}}});return Promise[_0x1ec8('0xa0')](_0x5a33ed);})[_0x1ec8('0xe')](function(_0x385c85){_0x5df08b=_0x385c85[0x0];var _0x5a3af1=_0x2ef8bb['concat'](_0x3f373a)[_0x1ec8('0xa8')](_0x5df08b);var _0x26b74f={'count':_0x5a3af1['length'],'rows':_0x5a3af1};return _0x26b74f;})[_0x1ec8('0xe')](respondWithResult(_0x1cd8e2,null))[_0x1ec8('0x2d')](function(_0x542c96){var _0x52403c=_0x283fee[_0x1ec8('0x1b')]['test']?0x1f4:_0x542c96['statusCode']||0x1f4;logger['error'](_0x542c96['stack']);delete _0x542c96['name'];if(_0x52403c===0x191){_0x52403c=0x190;}_0x1cd8e2['status'](_0x52403c)[_0x1ec8('0x14')](_0x283fee[_0x1ec8('0x1b')][_0x1ec8('0xa9')]?{'message':'Wrong\x20credentials','statusCode':_0x542c96['statusCode']}:_0x542c96);});};function getSelectList(_0x30e137,_0x2f9a16,_0x7bef87,_0x1677c9,_0x2b96b3,_0xd3fc33){var _0x46c9ba={'method':'GET','uri':_0x30e137+'EntityDefinitions('+_0x1677c9+_0x1ec8('0xaa')+_0x2b96b3+_0x1ec8('0xab')+_0x1ec8('0xac'),'headers':{'Authorization':'Bearer\x20'+_0xd3fc33,'If-None-Match':null,'OData-Version':_0x1ec8('0x94')},'json':!![]};return rp(_0x46c9ba)['then'](function(_0x16e46d){var _0x350b2c=[];var _0x5d0275=_0x16e46d[_0x1ec8('0xad')][_0x1ec8('0xae')];_0x5d0275[_0x1ec8('0x9e')](function(_0x356667){_0x350b2c['push']({'name':_0x356667[_0x1ec8('0xaf')][_0x1ec8('0xb0')]['Label'],'value':String(_0x356667[_0x1ec8('0xb1')])});});var _0x3ef22a={'id':_0x2f9a16+'_'+_0x16e46d[_0x1ec8('0x9a')],'name':_0x16e46d[_0x1ec8('0xb2')]['UserLocalizedLabel'][_0x1ec8('0xaf')],'custom':![],'options':_0x350b2c};_0x7bef87[_0x1ec8('0x9d')](_0x3ef22a);return _0x7bef87;});}function getBooleanList(_0x1480aa,_0xd29d38,_0x253523,_0x493f11,_0x236c0a,_0x2bc56a){var _0x2d0df7={'method':_0x1ec8('0x91'),'uri':_0x1480aa+_0x1ec8('0xb3')+_0x493f11+')/Attributes('+_0x236c0a+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x2bc56a,'If-None-Match':null,'OData-Version':_0x1ec8('0x94')},'json':!![]};return rp(_0x2d0df7)[_0x1ec8('0xe')](function(_0x2fb8e7){var _0x19d93b=[];_0x19d93b['push']({'name':_0x2fb8e7[_0x1ec8('0xad')][_0x1ec8('0xb4')][_0x1ec8('0xaf')][_0x1ec8('0xb0')][_0x1ec8('0xaf')],'value':_0x1ec8('0xb5')},{'name':_0x2fb8e7['OptionSet']['FalseOption'][_0x1ec8('0xaf')][_0x1ec8('0xb0')]['Label'],'value':_0x1ec8('0xb6')});var _0x3e8d5f={'id':_0xd29d38+'_'+_0x2fb8e7[_0x1ec8('0x9a')],'name':_0x2fb8e7[_0x1ec8('0xb2')]['UserLocalizedLabel'][_0x1ec8('0xaf')],'custom':![],'options':_0x19d93b};_0x253523[_0x1ec8('0x9d')](_0x3e8d5f);return _0x253523;});}function getInputList(_0x379715,_0x4cd473,_0x2233cb,_0x309562,_0x11e00f,_0xb4aab1,_0x18f5c6){var _0x4c0a5a={'method':_0x1ec8('0x91'),'uri':_0x379715+_0x1ec8('0xb3')+_0x11e00f+_0x1ec8('0xaa')+_0xb4aab1+_0x1ec8('0xb7')+_0x2233cb+_0x1ec8('0xb8'),'headers':{'Authorization':'Bearer\x20'+_0x18f5c6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c0a5a)['then'](function(_0x83582b){var _0x297fa6={'id':_0x4cd473+'_'+_0x83582b[_0x1ec8('0x9a')],'name':_0x83582b['DisplayName'][_0x1ec8('0xb0')]?_0x83582b['DisplayName'][_0x1ec8('0xb0')][_0x1ec8('0xaf')]:_0x83582b[_0x1ec8('0x9a')],'custom':![],'options':[]};_0x309562[_0x1ec8('0x9d')](_0x297fa6);return _0x309562;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 66dd2a7..71c17bb 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2aeb5b,_0x522bfb){var _0x59e4c2=function(_0x511eca){while(--_0x511eca){_0x2aeb5b['push'](_0x2aeb5b['shift']());}};_0x59e4c2(++_0x522bfb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1edd8e,_0x5d64a3){var _0x1598f2=function(_0x4c862a){while(--_0x4c862a){_0x1edd8e['push'](_0x1edd8e['shift']());}};_0x1598f2(++_0x5d64a3);}(_0xe706,0xa3));var _0x6e70=function(_0x2d1be7,_0x3df12e){_0x2d1be7=_0x2d1be7-0x0;var _0x4abad8=_0xe706[_0x2d1be7];return _0x4abad8;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'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 f39981e..b57ac42 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 _0x916c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis'];(function(_0x53068e,_0x2412eb){var _0x4d7d92=function(_0x469fd3){while(--_0x469fd3){_0x53068e['push'](_0x53068e['shift']());}};_0x4d7d92(++_0x2412eb);}(_0x916c,0x93));var _0xc916=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x916c[_0x5be795];return _0x4e8a3b;};'use strict';var _=require('lodash');var util=require(_0xc916('0x0'));var moment=require(_0xc916('0x1'));var BPromise=require(_0xc916('0x2'));var rs=require(_0xc916('0x3'));var fs=require('fs');var Redis=require(_0xc916('0x4'));var db=require(_0xc916('0x5'))['db'];var utils=require(_0xc916('0x6'));var logger=require(_0xc916('0x7'))(_0xc916('0x8'));var config=require(_0xc916('0x9'));var jayson=require(_0xc916('0xa'));var client=jayson[_0xc916('0xb')][_0xc916('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d8871,_0x576f69,_0xafb59b){return new BPromise(function(_0x47f93f,_0x308753){return client['request'](_0x4d8871,_0xafb59b)[_0xc916('0xd')](function(_0x54f032){logger[_0xc916('0xe')](_0xc916('0xf'),_0x576f69,_0xc916('0x10'));logger[_0xc916('0x11')](_0xc916('0x12'),_0x576f69,'request\x20sent',JSON[_0xc916('0x13')](_0x54f032));if(_0x54f032['error']){if(_0x54f032[_0xc916('0x14')][_0xc916('0x15')]===0x1f4){logger[_0xc916('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x576f69,_0x54f032[_0xc916('0x14')][_0xc916('0x16')]);return _0x308753(_0x54f032[_0xc916('0x14')]['message']);}logger['error'](_0xc916('0xf'),_0x576f69,_0x54f032['error'][_0xc916('0x16')]);return _0x47f93f(_0x54f032['error'][_0xc916('0x16')]);}else{logger[_0xc916('0xe')](_0xc916('0xf'),_0x576f69,'request\x20sent');_0x47f93f(_0x54f032[_0xc916('0x17')][_0xc916('0x16')]);}})['catch'](function(_0x12adec){logger[_0xc916('0x14')](_0xc916('0xf'),_0x576f69,_0x12adec);_0x308753(_0x12adec);});});}exports[_0xc916('0x18')]=function(_0x58c4cb){var _0x32d8cc=this;return new Promise(function(_0xe4e75c,_0x1dd2a5){return db[_0xc916('0x19')][_0xc916('0x1a')]({'raw':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb[_0xc916('0x1b')][_0xc916('0x1c')]===undefined?!![]:![]:!![],'where':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb[_0xc916('0x1b')][_0xc916('0x1d')]||null:null,'attributes':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb[_0xc916('0x1b')][_0xc916('0x1e')]||null:null,'limit':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb['options'][_0xc916('0x1f')]||null:null,'include':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb[_0xc916('0x1b')][_0xc916('0x20')]?_[_0xc916('0x21')](_0x58c4cb[_0xc916('0x1b')][_0xc916('0x20')],function(_0x176657){return{'model':db[_0x176657[_0xc916('0x22')]],'as':_0x176657['as'],'attributes':_0x176657['attributes'],'include':_0x176657['include']?_[_0xc916('0x21')](_0x176657['include'],function(_0x3250d7){return{'model':db[_0x3250d7[_0xc916('0x22')]],'as':_0x3250d7['as'],'attributes':_0x3250d7[_0xc916('0x1e')],'include':_0x3250d7[_0xc916('0x20')]?_['map'](_0x3250d7[_0xc916('0x20')],function(_0x366ca1){return{'model':db[_0x366ca1['model']],'as':_0x366ca1['as'],'attributes':_0x366ca1[_0xc916('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc916('0xd')](function(_0x3dd568){logger['info'](_0xc916('0x18'),_0x58c4cb);logger['debug'](_0xc916('0x18'),_0x58c4cb,JSON[_0xc916('0x13')](_0x3dd568));_0xe4e75c(_0x3dd568);})[_0xc916('0x23')](function(_0x1c7ef4){logger[_0xc916('0x14')](_0xc916('0x18'),_0x1c7ef4[_0xc916('0x16')],_0x58c4cb);_0x1dd2a5(_0x32d8cc[_0xc916('0x14')](0x1f4,_0x1c7ef4[_0xc916('0x16')]));});});};exports['ShowDynamics365Account']=function(_0x46265b){var _0xfc7945=this;return new Promise(function(_0x20f0ba,_0x2ac958){return db['Dynamics365Account'][_0xc916('0x24')]({'raw':_0x46265b[_0xc916('0x1b')]?_0x46265b[_0xc916('0x1b')][_0xc916('0x1c')]===undefined?!![]:![]:!![],'where':_0x46265b['options']?_0x46265b[_0xc916('0x1b')][_0xc916('0x1d')]||null:null,'attributes':_0x46265b[_0xc916('0x1b')]?_0x46265b[_0xc916('0x1b')][_0xc916('0x1e')]||null:null,'include':_0x46265b[_0xc916('0x1b')]?_0x46265b['options'][_0xc916('0x20')]?_['map'](_0x46265b[_0xc916('0x1b')][_0xc916('0x20')],function(_0x1df494){return{'model':db[_0x1df494[_0xc916('0x22')]],'as':_0x1df494['as'],'attributes':_0x1df494['attributes'],'include':_0x1df494['include']?_['map'](_0x1df494['include'],function(_0x198784){return{'model':db[_0x198784['model']],'as':_0x198784['as'],'attributes':_0x198784[_0xc916('0x1e')],'include':_0x198784[_0xc916('0x20')]?_['map'](_0x198784['include'],function(_0xc11cfc){return{'model':db[_0xc11cfc[_0xc916('0x22')]],'as':_0xc11cfc['as'],'attributes':_0xc11cfc[_0xc916('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc916('0xd')](function(_0x308640){logger['info'](_0xc916('0x25'),_0x46265b);logger[_0xc916('0x11')](_0xc916('0x25'),_0x46265b,JSON[_0xc916('0x13')](_0x308640));_0x20f0ba(_0x308640);})[_0xc916('0x23')](function(_0x2dcdc4){logger[_0xc916('0x14')](_0xc916('0x25'),_0x2dcdc4[_0xc916('0x16')],_0x46265b);_0x2ac958(_0xfc7945['error'](0x1f4,_0x2dcdc4['message']));});});}; \ No newline at end of file +var _0xb9e7=['request\x20sent','debug','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','map','include','model','then','catch','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s'];(function(_0x12e594,_0x4b6fce){var _0x119298=function(_0x4fc7c6){while(--_0x4fc7c6){_0x12e594['push'](_0x12e594['shift']());}};_0x119298(++_0x4b6fce);}(_0xb9e7,0x1c5));var _0x7b9e=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0xb9e7[_0x292423];return _0x2801cb;};'use strict';var _=require(_0x7b9e('0x0'));var util=require(_0x7b9e('0x1'));var moment=require('moment');var BPromise=require(_0x7b9e('0x2'));var rs=require(_0x7b9e('0x3'));var fs=require('fs');var Redis=require(_0x7b9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9e('0x5'));var logger=require(_0x7b9e('0x6'))(_0x7b9e('0x7'));var config=require(_0x7b9e('0x8'));var jayson=require(_0x7b9e('0x9'));var client=jayson[_0x7b9e('0xa')][_0x7b9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4991dd,_0x3155c3,_0x411384){return new BPromise(function(_0x286ed1,_0x25603c){return client[_0x7b9e('0xc')](_0x4991dd,_0x411384)['then'](function(_0x3f4403){logger[_0x7b9e('0xd')](_0x7b9e('0xe'),_0x3155c3,_0x7b9e('0xf'));logger[_0x7b9e('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3155c3,'request\x20sent',JSON[_0x7b9e('0x11')](_0x3f4403));if(_0x3f4403[_0x7b9e('0x12')]){if(_0x3f4403[_0x7b9e('0x12')][_0x7b9e('0x13')]===0x1f4){logger['error'](_0x7b9e('0xe'),_0x3155c3,_0x3f4403[_0x7b9e('0x12')][_0x7b9e('0x14')]);return _0x25603c(_0x3f4403[_0x7b9e('0x12')][_0x7b9e('0x14')]);}logger['error'](_0x7b9e('0xe'),_0x3155c3,_0x3f4403[_0x7b9e('0x12')]['message']);return _0x286ed1(_0x3f4403[_0x7b9e('0x12')]['message']);}else{logger[_0x7b9e('0xd')](_0x7b9e('0xe'),_0x3155c3,_0x7b9e('0xf'));_0x286ed1(_0x3f4403[_0x7b9e('0x15')]['message']);}})['catch'](function(_0x5659bc){logger[_0x7b9e('0x12')](_0x7b9e('0xe'),_0x3155c3,_0x5659bc);_0x25603c(_0x5659bc);});});}exports[_0x7b9e('0x16')]=function(_0x432ec9){var _0x275ab7=this;return new Promise(function(_0x2b8901,_0x47f681){return db[_0x7b9e('0x17')][_0x7b9e('0x18')]({'raw':_0x432ec9[_0x7b9e('0x19')]?_0x432ec9[_0x7b9e('0x19')][_0x7b9e('0x1a')]===undefined?!![]:![]:!![],'where':_0x432ec9[_0x7b9e('0x19')]?_0x432ec9[_0x7b9e('0x19')][_0x7b9e('0x1b')]||null:null,'attributes':_0x432ec9[_0x7b9e('0x19')]?_0x432ec9['options'][_0x7b9e('0x1c')]||null:null,'limit':_0x432ec9['options']?_0x432ec9[_0x7b9e('0x19')]['limit']||null:null,'include':_0x432ec9['options']?_0x432ec9[_0x7b9e('0x19')]['include']?_[_0x7b9e('0x1d')](_0x432ec9[_0x7b9e('0x19')][_0x7b9e('0x1e')],function(_0x13cacc){return{'model':db[_0x13cacc[_0x7b9e('0x1f')]],'as':_0x13cacc['as'],'attributes':_0x13cacc[_0x7b9e('0x1c')],'include':_0x13cacc[_0x7b9e('0x1e')]?_[_0x7b9e('0x1d')](_0x13cacc[_0x7b9e('0x1e')],function(_0x21e614){return{'model':db[_0x21e614[_0x7b9e('0x1f')]],'as':_0x21e614['as'],'attributes':_0x21e614[_0x7b9e('0x1c')],'include':_0x21e614[_0x7b9e('0x1e')]?_['map'](_0x21e614[_0x7b9e('0x1e')],function(_0x5f43f8){return{'model':db[_0x5f43f8[_0x7b9e('0x1f')]],'as':_0x5f43f8['as'],'attributes':_0x5f43f8[_0x7b9e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7b9e('0x20')](function(_0x4b0268){logger['info'](_0x7b9e('0x16'),_0x432ec9);logger['debug'](_0x7b9e('0x16'),_0x432ec9,JSON[_0x7b9e('0x11')](_0x4b0268));_0x2b8901(_0x4b0268);})[_0x7b9e('0x21')](function(_0x3efb7b){logger[_0x7b9e('0x12')](_0x7b9e('0x16'),_0x3efb7b[_0x7b9e('0x14')],_0x432ec9);_0x47f681(_0x275ab7['error'](0x1f4,_0x3efb7b[_0x7b9e('0x14')]));});});};exports[_0x7b9e('0x22')]=function(_0x43eed3){var _0x29fa99=this;return new Promise(function(_0x23eaea,_0x2ea77d){return db[_0x7b9e('0x17')][_0x7b9e('0x23')]({'raw':_0x43eed3[_0x7b9e('0x19')]?_0x43eed3[_0x7b9e('0x19')][_0x7b9e('0x1a')]===undefined?!![]:![]:!![],'where':_0x43eed3[_0x7b9e('0x19')]?_0x43eed3[_0x7b9e('0x19')][_0x7b9e('0x1b')]||null:null,'attributes':_0x43eed3[_0x7b9e('0x19')]?_0x43eed3[_0x7b9e('0x19')][_0x7b9e('0x1c')]||null:null,'include':_0x43eed3[_0x7b9e('0x19')]?_0x43eed3[_0x7b9e('0x19')]['include']?_[_0x7b9e('0x1d')](_0x43eed3[_0x7b9e('0x19')]['include'],function(_0x13ad3f){return{'model':db[_0x13ad3f[_0x7b9e('0x1f')]],'as':_0x13ad3f['as'],'attributes':_0x13ad3f[_0x7b9e('0x1c')],'include':_0x13ad3f[_0x7b9e('0x1e')]?_['map'](_0x13ad3f['include'],function(_0x1bc093){return{'model':db[_0x1bc093[_0x7b9e('0x1f')]],'as':_0x1bc093['as'],'attributes':_0x1bc093[_0x7b9e('0x1c')],'include':_0x1bc093[_0x7b9e('0x1e')]?_[_0x7b9e('0x1d')](_0x1bc093['include'],function(_0x44ee5f){return{'model':db[_0x44ee5f[_0x7b9e('0x1f')]],'as':_0x44ee5f['as'],'attributes':_0x44ee5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b9e('0x20')](function(_0x478376){logger[_0x7b9e('0xd')](_0x7b9e('0x22'),_0x43eed3);logger[_0x7b9e('0x10')]('ShowDynamics365Account',_0x43eed3,JSON['stringify'](_0x478376));_0x23eaea(_0x478376);})[_0x7b9e('0x21')](function(_0x4868eb){logger[_0x7b9e('0x12')](_0x7b9e('0x22'),_0x4868eb[_0x7b9e('0x14')],_0x43eed3);_0x2ea77d(_0x29fa99[_0x7b9e('0x12')](0x1f4,_0x4868eb[_0x7b9e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5a9f2d1..f6381b3 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 _0x4689=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x4689,0xf2));var _0x9468=function(_0x51dd35,_0x3400d6){_0x51dd35=_0x51dd35-0x0;var _0x101211=_0x4689[_0x51dd35];return _0x101211;};'use strict';var multer=require('multer');var util=require(_0x9468('0x0'));var path=require(_0x9468('0x1'));var timeout=require(_0x9468('0x2'));var express=require('express');var router=express[_0x9468('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9468('0x4'));var interaction=require(_0x9468('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x9468('0x6')]('/',auth[_0x9468('0x7')](),controller[_0x9468('0x8')]);router['get'](_0x9468('0x9'),auth[_0x9468('0x7')](),controller[_0x9468('0xa')]);router[_0x9468('0x6')](_0x9468('0xb'),auth[_0x9468('0x7')](),controller[_0x9468('0xc')]);router[_0x9468('0x6')](_0x9468('0xd'),auth[_0x9468('0x7')](),controller[_0x9468('0xe')]);router[_0x9468('0x6')](_0x9468('0xf'),auth[_0x9468('0x7')](),controller[_0x9468('0x10')]);router[_0x9468('0x11')]('/',auth[_0x9468('0x7')](),controller[_0x9468('0x12')]);router['put'](_0x9468('0x9'),auth[_0x9468('0x7')](),controller['update']);router[_0x9468('0x13')](_0x9468('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9468('0x14')]=router; \ No newline at end of file +var _0x285b=['getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects'];(function(_0x4d4339,_0x33e314){var _0x24b8d8=function(_0x1a8323){while(--_0x1a8323){_0x4d4339['push'](_0x4d4339['shift']());}};_0x24b8d8(++_0x33e314);}(_0x285b,0x171));var _0xb285=function(_0x232dd2,_0x28c2dc){_0x232dd2=_0x232dd2-0x0;var _0x37d1a1=_0x285b[_0x232dd2];return _0x37d1a1;};'use strict';var multer=require(_0xb285('0x0'));var util=require('util');var path=require(_0xb285('0x1'));var timeout=require(_0xb285('0x2'));var express=require('express');var router=express[_0xb285('0x3')]();var fs_extra=require(_0xb285('0x4'));var auth=require(_0xb285('0x5'));var interaction=require(_0xb285('0x6'));var config=require(_0xb285('0x7'));var controller=require(_0xb285('0x8'));router[_0xb285('0x9')]('/',auth[_0xb285('0xa')](),controller[_0xb285('0xb')]);router[_0xb285('0x9')]('/:id',auth[_0xb285('0xa')](),controller[_0xb285('0xc')]);router[_0xb285('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb285('0xd')]);router[_0xb285('0x9')](_0xb285('0xe'),auth[_0xb285('0xa')](),controller['getSubjects']);router[_0xb285('0x9')]('/:id/descriptions',auth[_0xb285('0xa')](),controller[_0xb285('0xf')]);router[_0xb285('0x10')]('/',auth[_0xb285('0xa')](),controller[_0xb285('0x11')]);router[_0xb285('0x12')](_0xb285('0x13'),auth[_0xb285('0xa')](),controller[_0xb285('0x14')]);router[_0xb285('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb285('0x16')]);module[_0xb285('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d9b1632..2c3b775 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 _0xa209=['contact','sequelize','exports','STRING','ENUM','incident'];(function(_0x2d8bf4,_0x12b56c){var _0x34602d=function(_0xf5dd6d){while(--_0xf5dd6d){_0x2d8bf4['push'](_0x2d8bf4['shift']());}};_0x34602d(++_0x12b56c);}(_0xa209,0x1c9));var _0x9a20=function(_0x409e44,_0x423c2e){_0x409e44=_0x409e44-0x0;var _0x1e9e30=_0xa209[_0x409e44];return _0x1e9e30;};'use strict';var Sequelize=require(_0x9a20('0x0'));module[_0x9a20('0x1')]={'name':{'type':Sequelize[_0x9a20('0x2')]},'description':{'type':Sequelize[_0x9a20('0x2')]},'ticketType':{'type':Sequelize[_0x9a20('0x3')](_0x9a20('0x4'),'phonecall'),'defaultValue':_0x9a20('0x4')},'moduleCreate':{'type':Sequelize[_0x9a20('0x3')](_0x9a20('0x5'),'nothing'),'defaultValue':_0x9a20('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9a20('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xc8c9=['BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact','nothing'];(function(_0x3bd9f4,_0x37ec4a){var _0x249d8f=function(_0x15a6a7){while(--_0x15a6a7){_0x3bd9f4['push'](_0x3bd9f4['shift']());}};_0x249d8f(++_0x37ec4a);}(_0xc8c9,0xeb));var _0x9c8c=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0xc8c9[_0x44ca6e];return _0x2edab2;};'use strict';var Sequelize=require(_0x9c8c('0x0'));module[_0x9c8c('0x1')]={'name':{'type':Sequelize[_0x9c8c('0x2')]},'description':{'type':Sequelize[_0x9c8c('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x9c8c('0x3'),_0x9c8c('0x4')),'defaultValue':_0x9c8c('0x3')},'moduleCreate':{'type':Sequelize[_0x9c8c('0x5')](_0x9c8c('0x6'),_0x9c8c('0x7')),'defaultValue':_0x9c8c('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9c8c('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9c8c('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2452dd9..ada5f6f 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 _0x217c=['include','findAll','show','find','catch','body','params','getFields','findOne','Dynamics365Field','filter','getSubjects','getDescriptions','order','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll'];(function(_0x1c15df,_0x241539){var _0x41c9ce=function(_0x49fb1){while(--_0x49fb1){_0x1c15df['push'](_0x1c15df['shift']());}};_0x41c9ce(++_0x241539);}(_0x217c,0x1f4));var _0xc217=function(_0x389b5b,_0x1adb11){_0x389b5b=_0x389b5b-0x0;var _0xf93e95=_0x217c[_0x389b5b];return _0xf93e95;};'use strict';var emlformat=require(_0xc217('0x0'));var rimraf=require(_0xc217('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc217('0x2'));var rp=require(_0xc217('0x3'));var moment=require(_0xc217('0x4'));var BPromise=require(_0xc217('0x5'));var Mustache=require('mustache');var util=require(_0xc217('0x6'));var path=require(_0xc217('0x7'));var sox=require(_0xc217('0x8'));var csv=require(_0xc217('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc217('0xa'));var _=require(_0xc217('0xb'));var squel=require(_0xc217('0xc'));var crypto=require(_0xc217('0xd'));var jsforce=require(_0xc217('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc217('0xf'));var Papa=require(_0xc217('0x10'));var Redis=require(_0xc217('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc217('0x12'));var as=require(_0xc217('0x13'));var hardwareService=require(_0xc217('0x14'));var logger=require(_0xc217('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc217('0x16'));var licenseUtil=require(_0xc217('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17db0c,_0x29e65d){_0x29e65d=_0x29e65d||0xcc;return function(_0x4d1bf5){if(_0x4d1bf5){return _0x17db0c['sendStatus'](_0x29e65d);}return _0x17db0c['status'](_0x29e65d)['end']();};}function respondWithResult(_0x4f71ec,_0x1992ad){_0x1992ad=_0x1992ad||0xc8;return function(_0x5d68c0){if(_0x5d68c0){return _0x4f71ec[_0xc217('0x18')](_0x1992ad)[_0xc217('0x19')](_0x5d68c0);}};}function respondWithFilteredResult(_0x42ea56,_0x2a12b6){return function(_0x19a469){if(_0x19a469){var _0x123dc3=typeof _0x2a12b6[_0xc217('0x1a')]===_0xc217('0x1b')&&typeof _0x2a12b6[_0xc217('0x1c')]===_0xc217('0x1b');var _0x1193c3=_0x19a469[_0xc217('0x1d')];var _0x51341c=_0x123dc3?0x0:_0x2a12b6[_0xc217('0x1a')];var _0x5671c9=_0x123dc3?_0x19a469[_0xc217('0x1d')]:_0x2a12b6[_0xc217('0x1a')]+_0x2a12b6[_0xc217('0x1c')];var _0x337436;if(_0x5671c9>=_0x1193c3){_0x5671c9=_0x1193c3;_0x337436=0xc8;}else{_0x337436=0xce;}_0x42ea56['status'](_0x337436);return _0x42ea56[_0xc217('0x1e')](_0xc217('0x1f'),_0x51341c+'-'+_0x5671c9+'/'+_0x1193c3)['json'](_0x19a469);}return null;};}function patchUpdates(_0x2db9c2){return function(_0x11e911){try{jsonpatch[_0xc217('0x20')](_0x11e911,_0x2db9c2,!![]);}catch(_0x18d617){return BPromise[_0xc217('0x21')](_0x18d617);}return _0x11e911[_0xc217('0x22')]();};}function saveUpdates(_0x3b27f6,_0x3a37b2){return function(_0x957fb9){if(_0x957fb9){return _0x957fb9[_0xc217('0x23')](_0x3b27f6)['then'](function(_0x3b3b62){return _0x3b3b62;});}return null;};}function removeEntity(_0x5b3dc9,_0x40e840){return function(_0x2fbc35){if(_0x2fbc35){return _0x2fbc35[_0xc217('0x24')]()[_0xc217('0x25')](function(){_0x5b3dc9[_0xc217('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462373,_0x2010d9){return function(_0x2e8cd9){if(!_0x2e8cd9){_0x462373[_0xc217('0x26')](0x194);}return _0x2e8cd9;};}function handleError(_0x4dba14,_0x5b05fb){_0x5b05fb=_0x5b05fb||0x1f4;return function(_0x55d02f){logger[_0xc217('0x27')](_0x55d02f[_0xc217('0x28')]);if(_0x55d02f[_0xc217('0x29')]){delete _0x55d02f[_0xc217('0x29')];}_0x4dba14[_0xc217('0x18')](_0x5b05fb)[_0xc217('0x2a')](_0x55d02f);};}exports[_0xc217('0x2b')]=function(_0x123207,_0x5c6834){var _0x3e31c4={},_0x1fac38={},_0x534dc4={'count':0x0,'rows':[]};var _0x4a2120=_[_0xc217('0x2c')](db[_0xc217('0x2d')][_0xc217('0x2e')],function(_0x2b86e7){return{'name':_0x2b86e7[_0xc217('0x2f')],'type':_0x2b86e7[_0xc217('0x30')][_0xc217('0x31')]};});_0x1fac38['model']=_[_0xc217('0x2c')](_0x4a2120,_0xc217('0x29'));_0x1fac38[_0xc217('0x32')]=_[_0xc217('0x33')](_0x123207[_0xc217('0x32')]);_0x1fac38[_0xc217('0x34')]=_['intersection'](_0x1fac38[_0xc217('0x35')],_0x1fac38[_0xc217('0x32')]);_0x3e31c4[_0xc217('0x36')]=_[_0xc217('0x37')](_0x1fac38['model'],qs[_0xc217('0x38')](_0x123207[_0xc217('0x32')][_0xc217('0x38')]));_0x3e31c4['attributes']=_0x3e31c4[_0xc217('0x36')][_0xc217('0x39')]?_0x3e31c4[_0xc217('0x36')]:_0x1fac38[_0xc217('0x35')];if(!_0x123207[_0xc217('0x32')][_0xc217('0x3a')](_0xc217('0x3b'))){_0x3e31c4['limit']=qs['limit'](_0x123207[_0xc217('0x32')][_0xc217('0x1c')]);_0x3e31c4[_0xc217('0x1a')]=qs['offset'](_0x123207['query'][_0xc217('0x1a')]);}_0x3e31c4['order']=qs[_0xc217('0x3c')](_0x123207['query']['sort']);_0x3e31c4[_0xc217('0x3d')]=qs[_0xc217('0x34')](_[_0xc217('0x3e')](_0x123207[_0xc217('0x32')],_0x1fac38[_0xc217('0x34')]),_0x4a2120);if(_0x123207[_0xc217('0x32')]['filter']){_0x3e31c4[_0xc217('0x3d')]=_[_0xc217('0x3f')](_0x3e31c4[_0xc217('0x3d')],{'$or':_[_0xc217('0x2c')](_0x4a2120,function(_0x3b2c79){if(_0x3b2c79['type']!==_0xc217('0x40')){var _0x460b4f={};_0x460b4f[_0x3b2c79['name']]={'$like':'%'+_0x123207[_0xc217('0x32')]['filter']+'%'};return _0x460b4f;}})});}_0x3e31c4=_[_0xc217('0x3f')]({},_0x3e31c4,_0x123207[_0xc217('0x41')]);var _0x2788ea={'where':_0x3e31c4[_0xc217('0x3d')]};return db[_0xc217('0x2d')][_0xc217('0x1d')](_0x2788ea)['then'](function(_0xda378){_0x534dc4[_0xc217('0x1d')]=_0xda378;if(_0x123207[_0xc217('0x32')][_0xc217('0x42')]){_0x3e31c4[_0xc217('0x43')]=[{'all':!![]}];}return db[_0xc217('0x2d')][_0xc217('0x44')](_0x3e31c4);})['then'](function(_0x4b2168){_0x534dc4['rows']=_0x4b2168;return _0x534dc4;})['then'](respondWithFilteredResult(_0x5c6834,_0x3e31c4))['catch'](handleError(_0x5c6834,null));};exports[_0xc217('0x45')]=function(_0x5d372c,_0x29b3cd){var _0x5a983f={'raw':![],'where':{'id':_0x5d372c['params']['id']}},_0x5e4fbb={};_0x5e4fbb[_0xc217('0x35')]=_[_0xc217('0x33')](db[_0xc217('0x2d')][_0xc217('0x2e')]);_0x5e4fbb[_0xc217('0x32')]=_[_0xc217('0x33')](_0x5d372c[_0xc217('0x32')]);_0x5e4fbb[_0xc217('0x34')]=_[_0xc217('0x37')](_0x5e4fbb[_0xc217('0x35')],_0x5e4fbb[_0xc217('0x32')]);_0x5a983f[_0xc217('0x36')]=_[_0xc217('0x37')](_0x5e4fbb[_0xc217('0x35')],qs[_0xc217('0x38')](_0x5d372c[_0xc217('0x32')][_0xc217('0x38')]));_0x5a983f[_0xc217('0x36')]=_0x5a983f['attributes']['length']?_0x5a983f[_0xc217('0x36')]:_0x5e4fbb['model'];if(_0x5d372c[_0xc217('0x32')][_0xc217('0x42')]){_0x5a983f['include']=[{'all':!![]}];}_0x5a983f=_[_0xc217('0x3f')]({},_0x5a983f,_0x5d372c[_0xc217('0x41')]);return db[_0xc217('0x2d')][_0xc217('0x46')](_0x5a983f)[_0xc217('0x25')](handleEntityNotFound(_0x29b3cd,null))[_0xc217('0x25')](respondWithResult(_0x29b3cd,null))[_0xc217('0x47')](handleError(_0x29b3cd,null));};exports['create']=function(_0x9b0807,_0x172fc8){return db[_0xc217('0x2d')]['create'](_0x9b0807[_0xc217('0x48')],{})[_0xc217('0x25')](respondWithResult(_0x172fc8,0xc9))['catch'](handleError(_0x172fc8,null));};exports[_0xc217('0x23')]=function(_0x2329cd,_0x303f85){if(_0x2329cd['body']['id']){delete _0x2329cd[_0xc217('0x48')]['id'];}return db[_0xc217('0x2d')][_0xc217('0x46')]({'where':{'id':_0x2329cd[_0xc217('0x49')]['id']}})[_0xc217('0x25')](handleEntityNotFound(_0x303f85,null))['then'](saveUpdates(_0x2329cd['body'],null))['then'](respondWithResult(_0x303f85,null))[_0xc217('0x47')](handleError(_0x303f85,null));};exports[_0xc217('0x24')]=function(_0x9ca6d6,_0x1190f0){return db[_0xc217('0x2d')]['find']({'where':{'id':_0x9ca6d6[_0xc217('0x49')]['id']}})[_0xc217('0x25')](handleEntityNotFound(_0x1190f0,null))[_0xc217('0x25')](removeEntity(_0x1190f0,null))['catch'](handleError(_0x1190f0,null));};exports[_0xc217('0x4a')]=function(_0x440bd4,_0x4d914c,_0x4ea78a){var _0x4d09f1={};var _0x13131e={};var _0x19b98a;var _0x55cd71;return db['Dynamics365Configuration'][_0xc217('0x4b')]({'where':{'id':_0x440bd4['params']['id']}})['then'](handleEntityNotFound(_0x4d914c,null))[_0xc217('0x25')](function(_0x5bfff0){if(_0x5bfff0){_0x19b98a=_0x5bfff0;_0x13131e[_0xc217('0x35')]=_[_0xc217('0x33')](db[_0xc217('0x4c')]['rawAttributes']);_0x13131e['query']=_[_0xc217('0x33')](_0x440bd4[_0xc217('0x32')]);_0x13131e[_0xc217('0x34')]=_['intersection'](_0x13131e['model'],_0x13131e['query']);_0x4d09f1['attributes']=_[_0xc217('0x37')](_0x13131e[_0xc217('0x35')],qs[_0xc217('0x38')](_0x440bd4[_0xc217('0x32')]['fields']));_0x4d09f1[_0xc217('0x36')]=_0x4d09f1[_0xc217('0x36')][_0xc217('0x39')]?_0x4d09f1[_0xc217('0x36')]:_0x13131e[_0xc217('0x35')];_0x4d09f1['order']=qs['sort'](_0x440bd4[_0xc217('0x32')][_0xc217('0x3c')]);_0x4d09f1['where']=qs[_0xc217('0x34')](_[_0xc217('0x3e')](_0x440bd4[_0xc217('0x32')],_0x13131e['filters']));if(_0x440bd4[_0xc217('0x32')][_0xc217('0x4d')]){_0x4d09f1['where']=_[_0xc217('0x3f')](_0x4d09f1['where'],{'$or':_[_0xc217('0x2c')](_0x4d09f1['attributes'],function(_0x4e90e7){var _0x25d8ba={};_0x25d8ba[_0x4e90e7]={'$like':'%'+_0x440bd4[_0xc217('0x32')][_0xc217('0x4d')]+'%'};return _0x25d8ba;})});}_0x4d09f1=_[_0xc217('0x3f')]({},_0x4d09f1,_0x440bd4[_0xc217('0x41')]);return _0x19b98a['getFields'](_0x4d09f1);}})[_0xc217('0x25')](function(_0x447020){if(_0x447020){_0x55cd71=_0x447020[_0xc217('0x39')];if(!_0x440bd4['query'][_0xc217('0x3a')]('nolimit')){_0x4d09f1[_0xc217('0x1c')]=qs[_0xc217('0x1c')](_0x440bd4[_0xc217('0x32')]['limit']);_0x4d09f1['offset']=qs['offset'](_0x440bd4[_0xc217('0x32')][_0xc217('0x1a')]);}return _0x19b98a['getFields'](_0x4d09f1);}})[_0xc217('0x25')](function(_0x2ddeac){if(_0x2ddeac){return _0x2ddeac?{'count':_0x55cd71,'rows':_0x2ddeac}:null;}})['then'](respondWithResult(_0x4d914c,null))[_0xc217('0x47')](handleError(_0x4d914c,null));};exports[_0xc217('0x4e')]=function(_0x324976,_0x5e2676,_0x3a0813){var _0x27a926={};var _0x207f3a={};var _0x405699;var _0x6ead7c;return db[_0xc217('0x2d')][_0xc217('0x4b')]({'where':{'id':_0x324976['params']['id']}})[_0xc217('0x25')](handleEntityNotFound(_0x5e2676,null))[_0xc217('0x25')](function(_0x46e0cb){if(_0x46e0cb){_0x405699=_0x46e0cb;_0x207f3a[_0xc217('0x35')]=_['keys'](db[_0xc217('0x4c')]['rawAttributes']);_0x207f3a['query']=_[_0xc217('0x33')](_0x324976[_0xc217('0x32')]);_0x207f3a[_0xc217('0x34')]=_[_0xc217('0x37')](_0x207f3a['model'],_0x207f3a['query']);_0x27a926['attributes']=_[_0xc217('0x37')](_0x207f3a[_0xc217('0x35')],qs[_0xc217('0x38')](_0x324976[_0xc217('0x32')][_0xc217('0x38')]));_0x27a926['attributes']=_0x27a926[_0xc217('0x36')][_0xc217('0x39')]?_0x27a926[_0xc217('0x36')]:_0x207f3a[_0xc217('0x35')];_0x27a926['order']=qs[_0xc217('0x3c')](_0x324976['query']['sort']);_0x27a926[_0xc217('0x3d')]=qs[_0xc217('0x34')](_[_0xc217('0x3e')](_0x324976[_0xc217('0x32')],_0x207f3a[_0xc217('0x34')]));if(_0x324976[_0xc217('0x32')][_0xc217('0x4d')]){_0x27a926['where']=_[_0xc217('0x3f')](_0x27a926['where'],{'$or':_['map'](_0x27a926[_0xc217('0x36')],function(_0x33d4f3){var _0x117f70={};_0x117f70[_0x33d4f3]={'$like':'%'+_0x324976[_0xc217('0x32')][_0xc217('0x4d')]+'%'};return _0x117f70;})});}_0x27a926=_[_0xc217('0x3f')]({},_0x27a926,_0x324976['options']);return _0x405699[_0xc217('0x4e')](_0x27a926);}})['then'](function(_0x1a57b2){if(_0x1a57b2){_0x6ead7c=_0x1a57b2[_0xc217('0x39')];if(!_0x324976['query'][_0xc217('0x3a')](_0xc217('0x3b'))){_0x27a926[_0xc217('0x1c')]=qs[_0xc217('0x1c')](_0x324976[_0xc217('0x32')]['limit']);_0x27a926[_0xc217('0x1a')]=qs['offset'](_0x324976[_0xc217('0x32')][_0xc217('0x1a')]);}return _0x405699[_0xc217('0x4e')](_0x27a926);}})[_0xc217('0x25')](function(_0x1fe600){if(_0x1fe600){return _0x1fe600?{'count':_0x6ead7c,'rows':_0x1fe600}:null;}})[_0xc217('0x25')](respondWithResult(_0x5e2676,null))[_0xc217('0x47')](handleError(_0x5e2676,null));};exports[_0xc217('0x4f')]=function(_0x3cb4ae,_0x183e85,_0x2e06b0){var _0x4f27d1={};var _0x44cc30={};var _0x56eda5;var _0x55b638;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3cb4ae[_0xc217('0x49')]['id']}})[_0xc217('0x25')](handleEntityNotFound(_0x183e85,null))['then'](function(_0x4bdc34){if(_0x4bdc34){_0x56eda5=_0x4bdc34;_0x44cc30[_0xc217('0x35')]=_[_0xc217('0x33')](db[_0xc217('0x4c')]['rawAttributes']);_0x44cc30[_0xc217('0x32')]=_[_0xc217('0x33')](_0x3cb4ae['query']);_0x44cc30['filters']=_['intersection'](_0x44cc30[_0xc217('0x35')],_0x44cc30[_0xc217('0x32')]);_0x4f27d1[_0xc217('0x36')]=_[_0xc217('0x37')](_0x44cc30[_0xc217('0x35')],qs[_0xc217('0x38')](_0x3cb4ae[_0xc217('0x32')][_0xc217('0x38')]));_0x4f27d1['attributes']=_0x4f27d1[_0xc217('0x36')][_0xc217('0x39')]?_0x4f27d1[_0xc217('0x36')]:_0x44cc30['model'];_0x4f27d1[_0xc217('0x50')]=qs[_0xc217('0x3c')](_0x3cb4ae['query'][_0xc217('0x3c')]);_0x4f27d1[_0xc217('0x3d')]=qs[_0xc217('0x34')](_[_0xc217('0x3e')](_0x3cb4ae['query'],_0x44cc30[_0xc217('0x34')]));if(_0x3cb4ae['query'][_0xc217('0x4d')]){_0x4f27d1[_0xc217('0x3d')]=_['merge'](_0x4f27d1[_0xc217('0x3d')],{'$or':_[_0xc217('0x2c')](_0x4f27d1[_0xc217('0x36')],function(_0x11f9db){var _0x2f2ff6={};_0x2f2ff6[_0x11f9db]={'$like':'%'+_0x3cb4ae[_0xc217('0x32')][_0xc217('0x4d')]+'%'};return _0x2f2ff6;})});}_0x4f27d1=_[_0xc217('0x3f')]({},_0x4f27d1,_0x3cb4ae['options']);return _0x56eda5[_0xc217('0x4f')](_0x4f27d1);}})[_0xc217('0x25')](function(_0x7da751){if(_0x7da751){_0x55b638=_0x7da751[_0xc217('0x39')];if(!_0x3cb4ae[_0xc217('0x32')][_0xc217('0x3a')]('nolimit')){_0x4f27d1[_0xc217('0x1c')]=qs['limit'](_0x3cb4ae[_0xc217('0x32')][_0xc217('0x1c')]);_0x4f27d1[_0xc217('0x1a')]=qs[_0xc217('0x1a')](_0x3cb4ae[_0xc217('0x32')][_0xc217('0x1a')]);}return _0x56eda5[_0xc217('0x4f')](_0x4f27d1);}})[_0xc217('0x25')](function(_0x4ccab8){if(_0x4ccab8){return _0x4ccab8?{'count':_0x55b638,'rows':_0x4ccab8}:null;}})[_0xc217('0x25')](respondWithResult(_0x183e85,null))[_0xc217('0x47')](handleError(_0x183e85,null));}; \ No newline at end of file +var _0x6c32=['type','key','map','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x6c32,0x1c9));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x26c3('0x0'));var rimraf=require(_0x26c3('0x1'));var zipdir=require(_0x26c3('0x2'));var jsonpatch=require(_0x26c3('0x3'));var rp=require(_0x26c3('0x4'));var moment=require('moment');var BPromise=require(_0x26c3('0x5'));var Mustache=require('mustache');var util=require(_0x26c3('0x6'));var path=require(_0x26c3('0x7'));var sox=require(_0x26c3('0x8'));var csv=require(_0x26c3('0x9'));var ejs=require(_0x26c3('0xa'));var fs=require('fs');var fs_extra=require(_0x26c3('0xb'));var _=require(_0x26c3('0xc'));var squel=require(_0x26c3('0xd'));var crypto=require(_0x26c3('0xe'));var jsforce=require(_0x26c3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x26c3('0x9'));var querystring=require(_0x26c3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x26c3('0x11'));var qs=require(_0x26c3('0x12'));var as=require(_0x26c3('0x13'));var hardwareService=require(_0x26c3('0x14'));var logger=require('../../config/logger')(_0x26c3('0x15'));var utils=require(_0x26c3('0x16'));var config=require(_0x26c3('0x17'));var licenseUtil=require(_0x26c3('0x18'));var db=require(_0x26c3('0x19'))['db'];function respondWithStatusCode(_0x10048c,_0x2d589f){_0x2d589f=_0x2d589f||0xcc;return function(_0x26b595){if(_0x26b595){return _0x10048c[_0x26c3('0x1a')](_0x2d589f);}return _0x10048c['status'](_0x2d589f)[_0x26c3('0x1b')]();};}function respondWithResult(_0x1b3925,_0x1f25a3){_0x1f25a3=_0x1f25a3||0xc8;return function(_0x214056){if(_0x214056){return _0x1b3925[_0x26c3('0x1c')](_0x1f25a3)[_0x26c3('0x1d')](_0x214056);}};}function respondWithFilteredResult(_0x190ce4,_0x36de8a){return function(_0x10ac6a){if(_0x10ac6a){var _0x2d057c=typeof _0x36de8a['offset']==='undefined'&&typeof _0x36de8a[_0x26c3('0x1e')]===_0x26c3('0x1f');var _0x46c3fb=_0x10ac6a[_0x26c3('0x20')];var _0x3f3d20=_0x2d057c?0x0:_0x36de8a[_0x26c3('0x21')];var _0xcce06b=_0x2d057c?_0x10ac6a[_0x26c3('0x20')]:_0x36de8a[_0x26c3('0x21')]+_0x36de8a[_0x26c3('0x1e')];var _0x57f94a;if(_0xcce06b>=_0x46c3fb){_0xcce06b=_0x46c3fb;_0x57f94a=0xc8;}else{_0x57f94a=0xce;}_0x190ce4[_0x26c3('0x1c')](_0x57f94a);return _0x190ce4[_0x26c3('0x22')]('Content-Range',_0x3f3d20+'-'+_0xcce06b+'/'+_0x46c3fb)[_0x26c3('0x1d')](_0x10ac6a);}return null;};}function patchUpdates(_0x1d47a8){return function(_0x226e65){try{jsonpatch[_0x26c3('0x23')](_0x226e65,_0x1d47a8,!![]);}catch(_0x29a863){return BPromise[_0x26c3('0x24')](_0x29a863);}return _0x226e65[_0x26c3('0x25')]();};}function saveUpdates(_0xe37524,_0x1a7ba6){return function(_0x327c4f){if(_0x327c4f){return _0x327c4f['update'](_0xe37524)[_0x26c3('0x26')](function(_0xc9a543){return _0xc9a543;});}return null;};}function removeEntity(_0x14d3e7,_0x2c1aa3){return function(_0x483080){if(_0x483080){return _0x483080[_0x26c3('0x27')]()[_0x26c3('0x26')](function(){_0x14d3e7[_0x26c3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dbd36,_0x245d6){return function(_0x2a458d){if(!_0x2a458d){_0x5dbd36[_0x26c3('0x1a')](0x194);}return _0x2a458d;};}function handleError(_0x4a2a8b,_0x15403f){_0x15403f=_0x15403f||0x1f4;return function(_0x15209b){logger['error'](_0x15209b[_0x26c3('0x28')]);if(_0x15209b[_0x26c3('0x29')]){delete _0x15209b[_0x26c3('0x29')];}_0x4a2a8b[_0x26c3('0x1c')](_0x15403f)[_0x26c3('0x2a')](_0x15209b);};}exports[_0x26c3('0x2b')]=function(_0x436c17,_0x4f896d){var _0x503df0={},_0x1eb6b8={},_0x517a99={'count':0x0,'rows':[]};var _0x79b2a2=_['map'](db[_0x26c3('0x2c')][_0x26c3('0x2d')],function(_0x1cc0a4){return{'name':_0x1cc0a4[_0x26c3('0x2e')],'type':_0x1cc0a4[_0x26c3('0x2f')][_0x26c3('0x30')]};});_0x1eb6b8['model']=_[_0x26c3('0x31')](_0x79b2a2,'name');_0x1eb6b8[_0x26c3('0x32')]=_[_0x26c3('0x33')](_0x436c17[_0x26c3('0x32')]);_0x1eb6b8['filters']=_['intersection'](_0x1eb6b8['model'],_0x1eb6b8['query']);_0x503df0[_0x26c3('0x34')]=_[_0x26c3('0x35')](_0x1eb6b8[_0x26c3('0x36')],qs[_0x26c3('0x37')](_0x436c17[_0x26c3('0x32')][_0x26c3('0x37')]));_0x503df0[_0x26c3('0x34')]=_0x503df0[_0x26c3('0x34')][_0x26c3('0x38')]?_0x503df0['attributes']:_0x1eb6b8[_0x26c3('0x36')];if(!_0x436c17[_0x26c3('0x32')]['hasOwnProperty'](_0x26c3('0x39'))){_0x503df0[_0x26c3('0x1e')]=qs[_0x26c3('0x1e')](_0x436c17[_0x26c3('0x32')][_0x26c3('0x1e')]);_0x503df0[_0x26c3('0x21')]=qs[_0x26c3('0x21')](_0x436c17['query'][_0x26c3('0x21')]);}_0x503df0[_0x26c3('0x3a')]=qs[_0x26c3('0x3b')](_0x436c17[_0x26c3('0x32')][_0x26c3('0x3b')]);_0x503df0[_0x26c3('0x3c')]=qs[_0x26c3('0x3d')](_[_0x26c3('0x3e')](_0x436c17['query'],_0x1eb6b8[_0x26c3('0x3d')]),_0x79b2a2);if(_0x436c17[_0x26c3('0x32')][_0x26c3('0x3f')]){_0x503df0[_0x26c3('0x3c')]=_[_0x26c3('0x40')](_0x503df0[_0x26c3('0x3c')],{'$or':_[_0x26c3('0x31')](_0x79b2a2,function(_0x4c7e9a){if(_0x4c7e9a[_0x26c3('0x2f')]!==_0x26c3('0x41')){var _0x40d893={};_0x40d893[_0x4c7e9a[_0x26c3('0x29')]]={'$like':'%'+_0x436c17['query'][_0x26c3('0x3f')]+'%'};return _0x40d893;}})});}_0x503df0=_['merge']({},_0x503df0,_0x436c17[_0x26c3('0x42')]);var _0x192405={'where':_0x503df0[_0x26c3('0x3c')]};return db[_0x26c3('0x2c')][_0x26c3('0x20')](_0x192405)[_0x26c3('0x26')](function(_0xdff84){_0x517a99[_0x26c3('0x20')]=_0xdff84;if(_0x436c17[_0x26c3('0x32')][_0x26c3('0x43')]){_0x503df0[_0x26c3('0x44')]=[{'all':!![]}];}return db[_0x26c3('0x2c')][_0x26c3('0x45')](_0x503df0);})[_0x26c3('0x26')](function(_0xa34b5){_0x517a99[_0x26c3('0x46')]=_0xa34b5;return _0x517a99;})[_0x26c3('0x26')](respondWithFilteredResult(_0x4f896d,_0x503df0))['catch'](handleError(_0x4f896d,null));};exports[_0x26c3('0x47')]=function(_0x501770,_0x23a0b3){var _0x5014e3={'raw':![],'where':{'id':_0x501770[_0x26c3('0x48')]['id']}},_0x308072={};_0x308072['model']=_[_0x26c3('0x33')](db[_0x26c3('0x2c')][_0x26c3('0x2d')]);_0x308072['query']=_[_0x26c3('0x33')](_0x501770['query']);_0x308072[_0x26c3('0x3d')]=_['intersection'](_0x308072[_0x26c3('0x36')],_0x308072[_0x26c3('0x32')]);_0x5014e3[_0x26c3('0x34')]=_['intersection'](_0x308072[_0x26c3('0x36')],qs[_0x26c3('0x37')](_0x501770[_0x26c3('0x32')][_0x26c3('0x37')]));_0x5014e3[_0x26c3('0x34')]=_0x5014e3[_0x26c3('0x34')][_0x26c3('0x38')]?_0x5014e3['attributes']:_0x308072[_0x26c3('0x36')];if(_0x501770[_0x26c3('0x32')][_0x26c3('0x43')]){_0x5014e3[_0x26c3('0x44')]=[{'all':!![]}];}_0x5014e3=_['merge']({},_0x5014e3,_0x501770[_0x26c3('0x42')]);return db[_0x26c3('0x2c')][_0x26c3('0x49')](_0x5014e3)[_0x26c3('0x26')](handleEntityNotFound(_0x23a0b3,null))['then'](respondWithResult(_0x23a0b3,null))[_0x26c3('0x4a')](handleError(_0x23a0b3,null));};exports[_0x26c3('0x4b')]=function(_0x5348c8,_0x2cb60d){return db['Dynamics365Configuration'][_0x26c3('0x4b')](_0x5348c8[_0x26c3('0x4c')],{})['then'](respondWithResult(_0x2cb60d,0xc9))[_0x26c3('0x4a')](handleError(_0x2cb60d,null));};exports[_0x26c3('0x4d')]=function(_0x27df34,_0xbfc8f1){if(_0x27df34['body']['id']){delete _0x27df34[_0x26c3('0x4c')]['id'];}return db[_0x26c3('0x2c')][_0x26c3('0x49')]({'where':{'id':_0x27df34[_0x26c3('0x48')]['id']}})['then'](handleEntityNotFound(_0xbfc8f1,null))[_0x26c3('0x26')](saveUpdates(_0x27df34['body'],null))['then'](respondWithResult(_0xbfc8f1,null))[_0x26c3('0x4a')](handleError(_0xbfc8f1,null));};exports[_0x26c3('0x27')]=function(_0x7e885f,_0x36bb54){return db[_0x26c3('0x2c')][_0x26c3('0x49')]({'where':{'id':_0x7e885f[_0x26c3('0x48')]['id']}})[_0x26c3('0x26')](handleEntityNotFound(_0x36bb54,null))['then'](removeEntity(_0x36bb54,null))[_0x26c3('0x4a')](handleError(_0x36bb54,null));};exports[_0x26c3('0x4e')]=function(_0x318342,_0x311a19,_0x870636){var _0x5deb9a={};var _0xfad89c={};var _0x2a372e;var _0x591f58;return db[_0x26c3('0x2c')][_0x26c3('0x4f')]({'where':{'id':_0x318342['params']['id']}})[_0x26c3('0x26')](handleEntityNotFound(_0x311a19,null))['then'](function(_0x2e5aed){if(_0x2e5aed){_0x2a372e=_0x2e5aed;_0xfad89c[_0x26c3('0x36')]=_[_0x26c3('0x33')](db[_0x26c3('0x50')]['rawAttributes']);_0xfad89c[_0x26c3('0x32')]=_[_0x26c3('0x33')](_0x318342[_0x26c3('0x32')]);_0xfad89c['filters']=_[_0x26c3('0x35')](_0xfad89c[_0x26c3('0x36')],_0xfad89c[_0x26c3('0x32')]);_0x5deb9a['attributes']=_[_0x26c3('0x35')](_0xfad89c[_0x26c3('0x36')],qs[_0x26c3('0x37')](_0x318342[_0x26c3('0x32')][_0x26c3('0x37')]));_0x5deb9a[_0x26c3('0x34')]=_0x5deb9a['attributes'][_0x26c3('0x38')]?_0x5deb9a['attributes']:_0xfad89c[_0x26c3('0x36')];_0x5deb9a['order']=qs[_0x26c3('0x3b')](_0x318342[_0x26c3('0x32')][_0x26c3('0x3b')]);_0x5deb9a['where']=qs[_0x26c3('0x3d')](_[_0x26c3('0x3e')](_0x318342[_0x26c3('0x32')],_0xfad89c[_0x26c3('0x3d')]));if(_0x318342[_0x26c3('0x32')][_0x26c3('0x3f')]){_0x5deb9a[_0x26c3('0x3c')]=_[_0x26c3('0x40')](_0x5deb9a['where'],{'$or':_[_0x26c3('0x31')](_0x5deb9a[_0x26c3('0x34')],function(_0x25b92c){var _0x581d73={};_0x581d73[_0x25b92c]={'$like':'%'+_0x318342['query'][_0x26c3('0x3f')]+'%'};return _0x581d73;})});}_0x5deb9a=_[_0x26c3('0x40')]({},_0x5deb9a,_0x318342[_0x26c3('0x42')]);return _0x2a372e[_0x26c3('0x4e')](_0x5deb9a);}})[_0x26c3('0x26')](function(_0x43e9a4){if(_0x43e9a4){_0x591f58=_0x43e9a4[_0x26c3('0x38')];if(!_0x318342['query'][_0x26c3('0x51')](_0x26c3('0x39'))){_0x5deb9a[_0x26c3('0x1e')]=qs[_0x26c3('0x1e')](_0x318342['query']['limit']);_0x5deb9a[_0x26c3('0x21')]=qs['offset'](_0x318342[_0x26c3('0x32')]['offset']);}return _0x2a372e[_0x26c3('0x4e')](_0x5deb9a);}})[_0x26c3('0x26')](function(_0x5321e1){if(_0x5321e1){return _0x5321e1?{'count':_0x591f58,'rows':_0x5321e1}:null;}})['then'](respondWithResult(_0x311a19,null))[_0x26c3('0x4a')](handleError(_0x311a19,null));};exports['getSubjects']=function(_0x15e7e7,_0x276719,_0x2ed4f4){var _0x5b49d7={};var _0x5e4e67={};var _0x1fe711;var _0x389b34;return db['Dynamics365Configuration'][_0x26c3('0x4f')]({'where':{'id':_0x15e7e7[_0x26c3('0x48')]['id']}})[_0x26c3('0x26')](handleEntityNotFound(_0x276719,null))['then'](function(_0x549a28){if(_0x549a28){_0x1fe711=_0x549a28;_0x5e4e67['model']=_[_0x26c3('0x33')](db[_0x26c3('0x50')][_0x26c3('0x2d')]);_0x5e4e67['query']=_['keys'](_0x15e7e7['query']);_0x5e4e67[_0x26c3('0x3d')]=_[_0x26c3('0x35')](_0x5e4e67['model'],_0x5e4e67['query']);_0x5b49d7[_0x26c3('0x34')]=_[_0x26c3('0x35')](_0x5e4e67['model'],qs[_0x26c3('0x37')](_0x15e7e7['query'][_0x26c3('0x37')]));_0x5b49d7[_0x26c3('0x34')]=_0x5b49d7[_0x26c3('0x34')][_0x26c3('0x38')]?_0x5b49d7[_0x26c3('0x34')]:_0x5e4e67[_0x26c3('0x36')];_0x5b49d7['order']=qs[_0x26c3('0x3b')](_0x15e7e7[_0x26c3('0x32')][_0x26c3('0x3b')]);_0x5b49d7[_0x26c3('0x3c')]=qs['filters'](_[_0x26c3('0x3e')](_0x15e7e7[_0x26c3('0x32')],_0x5e4e67[_0x26c3('0x3d')]));if(_0x15e7e7[_0x26c3('0x32')][_0x26c3('0x3f')]){_0x5b49d7[_0x26c3('0x3c')]=_['merge'](_0x5b49d7[_0x26c3('0x3c')],{'$or':_[_0x26c3('0x31')](_0x5b49d7[_0x26c3('0x34')],function(_0x21fd12){var _0xc4cbf5={};_0xc4cbf5[_0x21fd12]={'$like':'%'+_0x15e7e7['query'][_0x26c3('0x3f')]+'%'};return _0xc4cbf5;})});}_0x5b49d7=_[_0x26c3('0x40')]({},_0x5b49d7,_0x15e7e7[_0x26c3('0x42')]);return _0x1fe711['getSubjects'](_0x5b49d7);}})[_0x26c3('0x26')](function(_0x33fe27){if(_0x33fe27){_0x389b34=_0x33fe27[_0x26c3('0x38')];if(!_0x15e7e7[_0x26c3('0x32')]['hasOwnProperty'](_0x26c3('0x39'))){_0x5b49d7['limit']=qs[_0x26c3('0x1e')](_0x15e7e7['query'][_0x26c3('0x1e')]);_0x5b49d7[_0x26c3('0x21')]=qs[_0x26c3('0x21')](_0x15e7e7[_0x26c3('0x32')][_0x26c3('0x21')]);}return _0x1fe711[_0x26c3('0x52')](_0x5b49d7);}})[_0x26c3('0x26')](function(_0x4bd855){if(_0x4bd855){return _0x4bd855?{'count':_0x389b34,'rows':_0x4bd855}:null;}})[_0x26c3('0x26')](respondWithResult(_0x276719,null))[_0x26c3('0x4a')](handleError(_0x276719,null));};exports[_0x26c3('0x53')]=function(_0x2e3304,_0x51e7d8,_0x4ad2b7){var _0x4c7375={};var _0x307b1d={};var _0x44c104;var _0x38fe02;return db[_0x26c3('0x2c')]['findOne']({'where':{'id':_0x2e3304[_0x26c3('0x48')]['id']}})[_0x26c3('0x26')](handleEntityNotFound(_0x51e7d8,null))[_0x26c3('0x26')](function(_0x55e3ac){if(_0x55e3ac){_0x44c104=_0x55e3ac;_0x307b1d['model']=_[_0x26c3('0x33')](db['Dynamics365Field'][_0x26c3('0x2d')]);_0x307b1d['query']=_[_0x26c3('0x33')](_0x2e3304[_0x26c3('0x32')]);_0x307b1d[_0x26c3('0x3d')]=_[_0x26c3('0x35')](_0x307b1d[_0x26c3('0x36')],_0x307b1d['query']);_0x4c7375[_0x26c3('0x34')]=_[_0x26c3('0x35')](_0x307b1d[_0x26c3('0x36')],qs[_0x26c3('0x37')](_0x2e3304[_0x26c3('0x32')]['fields']));_0x4c7375[_0x26c3('0x34')]=_0x4c7375[_0x26c3('0x34')][_0x26c3('0x38')]?_0x4c7375['attributes']:_0x307b1d['model'];_0x4c7375[_0x26c3('0x3a')]=qs[_0x26c3('0x3b')](_0x2e3304[_0x26c3('0x32')][_0x26c3('0x3b')]);_0x4c7375[_0x26c3('0x3c')]=qs[_0x26c3('0x3d')](_[_0x26c3('0x3e')](_0x2e3304[_0x26c3('0x32')],_0x307b1d[_0x26c3('0x3d')]));if(_0x2e3304[_0x26c3('0x32')][_0x26c3('0x3f')]){_0x4c7375[_0x26c3('0x3c')]=_['merge'](_0x4c7375[_0x26c3('0x3c')],{'$or':_[_0x26c3('0x31')](_0x4c7375['attributes'],function(_0x51b86a){var _0x19d3ee={};_0x19d3ee[_0x51b86a]={'$like':'%'+_0x2e3304[_0x26c3('0x32')][_0x26c3('0x3f')]+'%'};return _0x19d3ee;})});}_0x4c7375=_[_0x26c3('0x40')]({},_0x4c7375,_0x2e3304[_0x26c3('0x42')]);return _0x44c104['getDescriptions'](_0x4c7375);}})['then'](function(_0x170670){if(_0x170670){_0x38fe02=_0x170670[_0x26c3('0x38')];if(!_0x2e3304[_0x26c3('0x32')]['hasOwnProperty']('nolimit')){_0x4c7375['limit']=qs[_0x26c3('0x1e')](_0x2e3304['query'][_0x26c3('0x1e')]);_0x4c7375[_0x26c3('0x21')]=qs['offset'](_0x2e3304[_0x26c3('0x32')][_0x26c3('0x21')]);}return _0x44c104[_0x26c3('0x53')](_0x4c7375);}})['then'](function(_0x17941e){if(_0x17941e){return _0x17941e?{'count':_0x38fe02,'rows':_0x17941e}:null;}})[_0x26c3('0x26')](respondWithResult(_0x51e7d8,null))[_0x26c3('0x4a')](handleError(_0x51e7d8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1e5921e..a48403d 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 _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x16e86c,_0x3be3e2){_0x16e86c=_0x16e86c-0x0;var _0x57d7db=_0x6f0d[_0x16e86c];return _0x57d7db;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe14d,0x1ee));var _0xde14=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xe14d[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('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 0cc16b4..f28c581 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 _0x8af4=['error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0x8af4,0x74));var _0x48af=function(_0x57d3d9,_0x2d605b){_0x57d3d9=_0x57d3d9-0x0;var _0x46730c=_0x8af4[_0x57d3d9];return _0x46730c;};'use strict';var _=require(_0x48af('0x0'));var util=require(_0x48af('0x1'));var moment=require('moment');var BPromise=require(_0x48af('0x2'));var rs=require(_0x48af('0x3'));var fs=require('fs');var Redis=require(_0x48af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x48af('0x5'));var logger=require(_0x48af('0x6'))('rpc');var config=require(_0x48af('0x7'));var jayson=require(_0x48af('0x8'));var client=jayson[_0x48af('0x9')][_0x48af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31e95e,_0x54bbae,_0x34a9a9){return new BPromise(function(_0x298bca,_0x166667){return client[_0x48af('0xb')](_0x31e95e,_0x34a9a9)[_0x48af('0xc')](function(_0x97cba1){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x54bbae,_0x48af('0xd'));logger[_0x48af('0xe')](_0x48af('0xf'),_0x54bbae,_0x48af('0xd'),JSON['stringify'](_0x97cba1));if(_0x97cba1[_0x48af('0x10')]){if(_0x97cba1[_0x48af('0x10')][_0x48af('0x11')]===0x1f4){logger[_0x48af('0x10')](_0x48af('0x12'),_0x54bbae,_0x97cba1[_0x48af('0x10')][_0x48af('0x13')]);return _0x166667(_0x97cba1['error']['message']);}logger[_0x48af('0x10')](_0x48af('0x12'),_0x54bbae,_0x97cba1[_0x48af('0x10')][_0x48af('0x13')]);return _0x298bca(_0x97cba1[_0x48af('0x10')][_0x48af('0x13')]);}else{logger['info'](_0x48af('0x12'),_0x54bbae,_0x48af('0xd'));_0x298bca(_0x97cba1[_0x48af('0x14')][_0x48af('0x13')]);}})[_0x48af('0x15')](function(_0x6f206){logger[_0x48af('0x10')](_0x48af('0x12'),_0x54bbae,_0x6f206);_0x166667(_0x6f206);});});} \ No newline at end of file +var _0xfb23=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x1035a8,_0x39a740){var _0x5be55e=function(_0x3796bb){while(--_0x3796bb){_0x1035a8['push'](_0x1035a8['shift']());}};_0x5be55e(++_0x39a740);}(_0xfb23,0xed));var _0x3fb2=function(_0x580b54,_0x115e0e){_0x580b54=_0x580b54-0x0;var _0x5b44d4=_0xfb23[_0x580b54];return _0x5b44d4;};'use strict';var _=require(_0x3fb2('0x0'));var util=require(_0x3fb2('0x1'));var moment=require(_0x3fb2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fb2('0x3'));var db=require(_0x3fb2('0x4'))['db'];var utils=require(_0x3fb2('0x5'));var logger=require(_0x3fb2('0x6'))(_0x3fb2('0x7'));var config=require(_0x3fb2('0x8'));var jayson=require(_0x3fb2('0x9'));var client=jayson[_0x3fb2('0xa')][_0x3fb2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c3f94,_0x372d72,_0x28e8ff){return new BPromise(function(_0x455194,_0x56acb1){return client[_0x3fb2('0xc')](_0x4c3f94,_0x28e8ff)[_0x3fb2('0xd')](function(_0x116e56){logger[_0x3fb2('0xe')](_0x3fb2('0xf'),_0x372d72,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x372d72,_0x3fb2('0x10'),JSON['stringify'](_0x116e56));if(_0x116e56[_0x3fb2('0x11')]){if(_0x116e56[_0x3fb2('0x11')][_0x3fb2('0x12')]===0x1f4){logger[_0x3fb2('0x11')](_0x3fb2('0xf'),_0x372d72,_0x116e56['error'][_0x3fb2('0x13')]);return _0x56acb1(_0x116e56[_0x3fb2('0x11')][_0x3fb2('0x13')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x372d72,_0x116e56[_0x3fb2('0x11')][_0x3fb2('0x13')]);return _0x455194(_0x116e56[_0x3fb2('0x11')][_0x3fb2('0x13')]);}else{logger[_0x3fb2('0xe')](_0x3fb2('0xf'),_0x372d72,_0x3fb2('0x10'));_0x455194(_0x116e56[_0x3fb2('0x14')]['message']);}})[_0x3fb2('0x15')](function(_0x19922a){logger['error'](_0x3fb2('0xf'),_0x372d72,_0x19922a);_0x56acb1(_0x19922a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4c82de5..355e46a 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 _0x89bb=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x89bb,0x10e));var _0xb89b=function(_0x4e4249,_0x12d4ac){_0x4e4249=_0x4e4249-0x0;var _0x35263a=_0x89bb[_0x4e4249];return _0x35263a;};'use strict';var multer=require(_0xb89b('0x0'));var util=require(_0xb89b('0x1'));var path=require(_0xb89b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb89b('0x3'));var router=express['Router']();var fs_extra=require(_0xb89b('0x4'));var auth=require(_0xb89b('0x5'));var interaction=require(_0xb89b('0x6'));var config=require(_0xb89b('0x7'));var controller=require(_0xb89b('0x8'));router[_0xb89b('0x9')]('/',auth[_0xb89b('0xa')](),controller[_0xb89b('0xb')]);router[_0xb89b('0x9')](_0xb89b('0xc'),auth[_0xb89b('0xa')](),controller[_0xb89b('0xd')]);router['post']('/',auth[_0xb89b('0xa')](),controller[_0xb89b('0xe')]);router[_0xb89b('0xf')](_0xb89b('0xc'),auth[_0xb89b('0xa')](),controller[_0xb89b('0x10')]);router[_0xb89b('0x11')](_0xb89b('0xc'),auth['isAuthenticated'](),controller[_0xb89b('0x12')]);module[_0xb89b('0x13')]=router; \ No newline at end of file +var _0xc25e=['update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc25e,0x10e));var _0xec25=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc25e[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0xec25('0x0'));var util=require(_0xec25('0x1'));var path=require('path');var timeout=require(_0xec25('0x2'));var express=require(_0xec25('0x3'));var router=express['Router']();var fs_extra=require(_0xec25('0x4'));var auth=require(_0xec25('0x5'));var interaction=require(_0xec25('0x6'));var config=require(_0xec25('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xec25('0x8')]('/',auth[_0xec25('0x9')](),controller[_0xec25('0xa')]);router[_0xec25('0x8')](_0xec25('0xb'),auth[_0xec25('0x9')](),controller['show']);router[_0xec25('0xc')]('/',auth[_0xec25('0x9')](),controller[_0xec25('0xd')]);router[_0xec25('0xe')](_0xec25('0xb'),auth[_0xec25('0x9')](),controller[_0xec25('0xf')]);router[_0xec25('0x10')](_0xec25('0xb'),auth['isAuthenticated'](),controller[_0xec25('0x11')]);module[_0xec25('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 70fc846..97c4a88 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 _0x6cf4=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6cf4,0x1c6));var _0x46cf=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x6cf4[_0x77d310];return _0x2cdce4;};'use strict';var Sequelize=require(_0x46cf('0x0'));module['exports']={'type':{'type':Sequelize[_0x46cf('0x1')](_0x46cf('0x2'),_0x46cf('0x3'),_0x46cf('0x4'),'keyValue',_0x46cf('0x5')),'defaultValue':_0x46cf('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x46cf('0x6')]},'keyType':{'type':Sequelize[_0x46cf('0x1')](_0x46cf('0x2'),_0x46cf('0x3'),_0x46cf('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x46cf('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x46cf('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x46cf('0x6')]}}; \ No newline at end of file +var _0xf312=['ENUM','variable','sequelize','exports','string','customVariable','keyValue','STRING'];(function(_0xc92e85,_0x49b5d4){var _0x20736d=function(_0x908a78){while(--_0x908a78){_0xc92e85['push'](_0xc92e85['shift']());}};_0x20736d(++_0x49b5d4);}(_0xf312,0x15a));var _0x2f31=function(_0x4afaaa,_0x8a532a){_0x4afaaa=_0x4afaaa-0x0;var _0x27101b=_0xf312[_0x4afaaa];return _0x27101b;};'use strict';var Sequelize=require(_0x2f31('0x0'));module[_0x2f31('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2f31('0x2'),'variable',_0x2f31('0x3'),_0x2f31('0x4'),'picklist'),'defaultValue':_0x2f31('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2f31('0x5')]},'keyType':{'type':Sequelize[_0x2f31('0x6')](_0x2f31('0x2'),_0x2f31('0x7'),_0x2f31('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2f31('0x5')]},'nameField':{'type':Sequelize[_0x2f31('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2f31('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 81c5960..6061907 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 _0x8a76=['status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','name','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','map','includeAll','include','show','length','options','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5497f8,_0xc92a33){var _0x4d788c=function(_0x2a0214){while(--_0x2a0214){_0x5497f8['push'](_0x5497f8['shift']());}};_0x4d788c(++_0xc92a33);}(_0x8a76,0x141));var _0x68a7=function(_0x6ca440,_0x3c2c86){_0x6ca440=_0x6ca440-0x0;var _0x447620=_0x8a76[_0x6ca440];return _0x447620;};'use strict';var emlformat=require(_0x68a7('0x0'));var rimraf=require(_0x68a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68a7('0x2'));var rp=require('request-promise');var moment=require(_0x68a7('0x3'));var BPromise=require(_0x68a7('0x4'));var Mustache=require('mustache');var util=require(_0x68a7('0x5'));var path=require(_0x68a7('0x6'));var sox=require(_0x68a7('0x7'));var csv=require(_0x68a7('0x8'));var ejs=require(_0x68a7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68a7('0xa'));var squel=require(_0x68a7('0xb'));var crypto=require('crypto');var jsforce=require(_0x68a7('0xc'));var deskjs=require(_0x68a7('0xd'));var toCsv=require(_0x68a7('0x8'));var querystring=require(_0x68a7('0xe'));var Papa=require(_0x68a7('0xf'));var Redis=require(_0x68a7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x68a7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68a7('0x12'));var logger=require(_0x68a7('0x13'))(_0x68a7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x68a7('0x15'));var db=require(_0x68a7('0x16'))['db'];function respondWithStatusCode(_0x8903a9,_0xfdb509){_0xfdb509=_0xfdb509||0xcc;return function(_0x19bbc0){if(_0x19bbc0){return _0x8903a9[_0x68a7('0x17')](_0xfdb509);}return _0x8903a9['status'](_0xfdb509)['end']();};}function respondWithResult(_0x564ac5,_0x5570a7){_0x5570a7=_0x5570a7||0xc8;return function(_0x1e333f){if(_0x1e333f){return _0x564ac5[_0x68a7('0x18')](_0x5570a7)[_0x68a7('0x19')](_0x1e333f);}};}function respondWithFilteredResult(_0x2f789a,_0x54832b){return function(_0x2b4cf4){if(_0x2b4cf4){var _0x481108=typeof _0x54832b[_0x68a7('0x1a')]===_0x68a7('0x1b')&&typeof _0x54832b['limit']==='undefined';var _0x2f88b2=_0x2b4cf4[_0x68a7('0x1c')];var _0x332587=_0x481108?0x0:_0x54832b['offset'];var _0x25fa16=_0x481108?_0x2b4cf4['count']:_0x54832b[_0x68a7('0x1a')]+_0x54832b[_0x68a7('0x1d')];var _0x520378;if(_0x25fa16>=_0x2f88b2){_0x25fa16=_0x2f88b2;_0x520378=0xc8;}else{_0x520378=0xce;}_0x2f789a[_0x68a7('0x18')](_0x520378);return _0x2f789a[_0x68a7('0x1e')]('Content-Range',_0x332587+'-'+_0x25fa16+'/'+_0x2f88b2)[_0x68a7('0x19')](_0x2b4cf4);}return null;};}function patchUpdates(_0x1c27a2){return function(_0x406e43){try{jsonpatch[_0x68a7('0x1f')](_0x406e43,_0x1c27a2,!![]);}catch(_0x42a030){return BPromise[_0x68a7('0x20')](_0x42a030);}return _0x406e43[_0x68a7('0x21')]();};}function saveUpdates(_0x2936c0,_0x245db7){return function(_0x5cc218){if(_0x5cc218){return _0x5cc218[_0x68a7('0x22')](_0x2936c0)['then'](function(_0x373b9e){return _0x373b9e;});}return null;};}function removeEntity(_0x4b20e4,_0x4ed545){return function(_0x1d01ce){if(_0x1d01ce){return _0x1d01ce['destroy']()[_0x68a7('0x23')](function(){_0x4b20e4[_0x68a7('0x18')](0xcc)[_0x68a7('0x24')]();});}};}function handleEntityNotFound(_0x141919,_0x3f8af5){return function(_0x3b3bc5){if(!_0x3b3bc5){_0x141919['sendStatus'](0x194);}return _0x3b3bc5;};}function handleError(_0x396afa,_0x26b803){_0x26b803=_0x26b803||0x1f4;return function(_0x2b95a1){logger[_0x68a7('0x25')](_0x2b95a1['stack']);if(_0x2b95a1[_0x68a7('0x26')]){delete _0x2b95a1[_0x68a7('0x26')];}_0x396afa[_0x68a7('0x18')](_0x26b803)['send'](_0x2b95a1);};}exports[_0x68a7('0x27')]=function(_0x44048b,_0x435d48){var _0x3dee0e={},_0xa95552={},_0x52643c={'count':0x0,'rows':[]};var _0x26615d=_['map'](db[_0x68a7('0x28')][_0x68a7('0x29')],function(_0x537628){return{'name':_0x537628[_0x68a7('0x2a')],'type':_0x537628[_0x68a7('0x2b')][_0x68a7('0x2c')]};});_0xa95552[_0x68a7('0x2d')]=_['map'](_0x26615d,'name');_0xa95552[_0x68a7('0x2e')]=_[_0x68a7('0x2f')](_0x44048b[_0x68a7('0x2e')]);_0xa95552['filters']=_[_0x68a7('0x30')](_0xa95552[_0x68a7('0x2d')],_0xa95552[_0x68a7('0x2e')]);_0x3dee0e[_0x68a7('0x31')]=_[_0x68a7('0x30')](_0xa95552[_0x68a7('0x2d')],qs['fields'](_0x44048b[_0x68a7('0x2e')][_0x68a7('0x32')]));_0x3dee0e['attributes']=_0x3dee0e[_0x68a7('0x31')]['length']?_0x3dee0e[_0x68a7('0x31')]:_0xa95552[_0x68a7('0x2d')];if(!_0x44048b[_0x68a7('0x2e')][_0x68a7('0x33')]('nolimit')){_0x3dee0e['limit']=qs[_0x68a7('0x1d')](_0x44048b[_0x68a7('0x2e')][_0x68a7('0x1d')]);_0x3dee0e['offset']=qs['offset'](_0x44048b[_0x68a7('0x2e')][_0x68a7('0x1a')]);}_0x3dee0e[_0x68a7('0x34')]=qs['sort'](_0x44048b[_0x68a7('0x2e')][_0x68a7('0x35')]);_0x3dee0e[_0x68a7('0x36')]=qs[_0x68a7('0x37')](_['pick'](_0x44048b['query'],_0xa95552['filters']),_0x26615d);if(_0x44048b[_0x68a7('0x2e')][_0x68a7('0x38')]){_0x3dee0e['where']=_[_0x68a7('0x39')](_0x3dee0e[_0x68a7('0x36')],{'$or':_[_0x68a7('0x3a')](_0x26615d,function(_0x17349c){if(_0x17349c[_0x68a7('0x2b')]!=='VIRTUAL'){var _0x31addb={};_0x31addb[_0x17349c[_0x68a7('0x26')]]={'$like':'%'+_0x44048b['query'][_0x68a7('0x38')]+'%'};return _0x31addb;}})});}_0x3dee0e=_[_0x68a7('0x39')]({},_0x3dee0e,_0x44048b['options']);var _0x139fdd={'where':_0x3dee0e[_0x68a7('0x36')]};return db['Dynamics365Field'][_0x68a7('0x1c')](_0x139fdd)[_0x68a7('0x23')](function(_0x2c1eea){_0x52643c[_0x68a7('0x1c')]=_0x2c1eea;if(_0x44048b[_0x68a7('0x2e')][_0x68a7('0x3b')]){_0x3dee0e[_0x68a7('0x3c')]=[{'all':!![]}];}return db[_0x68a7('0x28')]['findAll'](_0x3dee0e);})[_0x68a7('0x23')](function(_0x5f3e6d){_0x52643c['rows']=_0x5f3e6d;return _0x52643c;})['then'](respondWithFilteredResult(_0x435d48,_0x3dee0e))['catch'](handleError(_0x435d48,null));};exports[_0x68a7('0x3d')]=function(_0x4a75a4,_0x19912f){var _0x34eb00={'raw':!![],'where':{'id':_0x4a75a4['params']['id']}},_0x1ffc83={};_0x1ffc83['model']=_[_0x68a7('0x2f')](db[_0x68a7('0x28')][_0x68a7('0x29')]);_0x1ffc83[_0x68a7('0x2e')]=_[_0x68a7('0x2f')](_0x4a75a4[_0x68a7('0x2e')]);_0x1ffc83['filters']=_[_0x68a7('0x30')](_0x1ffc83['model'],_0x1ffc83[_0x68a7('0x2e')]);_0x34eb00[_0x68a7('0x31')]=_[_0x68a7('0x30')](_0x1ffc83['model'],qs[_0x68a7('0x32')](_0x4a75a4[_0x68a7('0x2e')][_0x68a7('0x32')]));_0x34eb00[_0x68a7('0x31')]=_0x34eb00[_0x68a7('0x31')][_0x68a7('0x3e')]?_0x34eb00[_0x68a7('0x31')]:_0x1ffc83[_0x68a7('0x2d')];if(_0x4a75a4[_0x68a7('0x2e')][_0x68a7('0x3b')]){_0x34eb00[_0x68a7('0x3c')]=[{'all':!![]}];}_0x34eb00=_[_0x68a7('0x39')]({},_0x34eb00,_0x4a75a4[_0x68a7('0x3f')]);return db[_0x68a7('0x28')][_0x68a7('0x40')](_0x34eb00)[_0x68a7('0x23')](handleEntityNotFound(_0x19912f,null))[_0x68a7('0x23')](respondWithResult(_0x19912f,null))[_0x68a7('0x41')](handleError(_0x19912f,null));};exports[_0x68a7('0x42')]=function(_0x3e87ff,_0x261f96){return db[_0x68a7('0x28')][_0x68a7('0x42')](_0x3e87ff['body'],{})[_0x68a7('0x23')](respondWithResult(_0x261f96,0xc9))[_0x68a7('0x41')](handleError(_0x261f96,null));};exports['update']=function(_0x32b899,_0xa60969){if(_0x32b899[_0x68a7('0x43')]['id']){delete _0x32b899[_0x68a7('0x43')]['id'];}return db[_0x68a7('0x28')][_0x68a7('0x40')]({'where':{'id':_0x32b899['params']['id']}})[_0x68a7('0x23')](handleEntityNotFound(_0xa60969,null))[_0x68a7('0x23')](saveUpdates(_0x32b899['body'],null))[_0x68a7('0x23')](respondWithResult(_0xa60969,null))[_0x68a7('0x41')](handleError(_0xa60969,null));};exports[_0x68a7('0x44')]=function(_0xd552d2,_0x370031){return db[_0x68a7('0x28')]['find']({'where':{'id':_0xd552d2['params']['id']}})['then'](handleEntityNotFound(_0x370031,null))[_0x68a7('0x23')](removeEntity(_0x370031,null))[_0x68a7('0x41')](handleError(_0x370031,null));}; \ No newline at end of file +var _0x6c78=['lodash','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','undefined','limit','count','offset','set','apply','reject','update','then','destroy','end','error','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','filters','includeAll','create','body','find','eml-format','rimraf','fast-json-patch','moment','to-csv','ejs','fs-extra'];(function(_0x3e2a69,_0x49e167){var _0x41c3f0=function(_0x27895d){while(--_0x27895d){_0x3e2a69['push'](_0x3e2a69['shift']());}};_0x41c3f0(++_0x49e167);}(_0x6c78,0x10d));var _0x86c7=function(_0x4d5beb,_0x4683d3){_0x4d5beb=_0x4d5beb-0x0;var _0x19a22e=_0x6c78[_0x4d5beb];return _0x19a22e;};'use strict';var emlformat=require(_0x86c7('0x0'));var rimraf=require(_0x86c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86c7('0x2'));var rp=require('request-promise');var moment=require(_0x86c7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x86c7('0x4'));var ejs=require(_0x86c7('0x5'));var fs=require('fs');var fs_extra=require(_0x86c7('0x6'));var _=require(_0x86c7('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x86c7('0x4'));var querystring=require(_0x86c7('0x8'));var Papa=require(_0x86c7('0x9'));var Redis=require(_0x86c7('0xa'));var authService=require(_0x86c7('0xb'));var qs=require(_0x86c7('0xc'));var as=require(_0x86c7('0xd'));var hardwareService=require(_0x86c7('0xe'));var logger=require(_0x86c7('0xf'))(_0x86c7('0x10'));var utils=require(_0x86c7('0x11'));var config=require(_0x86c7('0x12'));var licenseUtil=require(_0x86c7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2888ff,_0x1f0460){_0x1f0460=_0x1f0460||0xcc;return function(_0x45cbb6){if(_0x45cbb6){return _0x2888ff[_0x86c7('0x14')](_0x1f0460);}return _0x2888ff[_0x86c7('0x15')](_0x1f0460)['end']();};}function respondWithResult(_0x5c1865,_0x55b2bc){_0x55b2bc=_0x55b2bc||0xc8;return function(_0x4b0856){if(_0x4b0856){return _0x5c1865['status'](_0x55b2bc)[_0x86c7('0x16')](_0x4b0856);}};}function respondWithFilteredResult(_0x5c5b61,_0x5d3ede){return function(_0x4971c9){if(_0x4971c9){var _0x4bb85f=typeof _0x5d3ede['offset']===_0x86c7('0x17')&&typeof _0x5d3ede[_0x86c7('0x18')]==='undefined';var _0x354c6b=_0x4971c9[_0x86c7('0x19')];var _0x28b1c0=_0x4bb85f?0x0:_0x5d3ede[_0x86c7('0x1a')];var _0xc66ced=_0x4bb85f?_0x4971c9[_0x86c7('0x19')]:_0x5d3ede[_0x86c7('0x1a')]+_0x5d3ede[_0x86c7('0x18')];var _0x2afc01;if(_0xc66ced>=_0x354c6b){_0xc66ced=_0x354c6b;_0x2afc01=0xc8;}else{_0x2afc01=0xce;}_0x5c5b61[_0x86c7('0x15')](_0x2afc01);return _0x5c5b61[_0x86c7('0x1b')]('Content-Range',_0x28b1c0+'-'+_0xc66ced+'/'+_0x354c6b)['json'](_0x4971c9);}return null;};}function patchUpdates(_0x46fda9){return function(_0x2a7cb3){try{jsonpatch[_0x86c7('0x1c')](_0x2a7cb3,_0x46fda9,!![]);}catch(_0x1b3e14){return BPromise[_0x86c7('0x1d')](_0x1b3e14);}return _0x2a7cb3['save']();};}function saveUpdates(_0x3197f7,_0x57a76f){return function(_0x19e661){if(_0x19e661){return _0x19e661[_0x86c7('0x1e')](_0x3197f7)[_0x86c7('0x1f')](function(_0x40a5cd){return _0x40a5cd;});}return null;};}function removeEntity(_0x560636,_0x3c72d5){return function(_0x2d8e5a){if(_0x2d8e5a){return _0x2d8e5a[_0x86c7('0x20')]()[_0x86c7('0x1f')](function(){_0x560636[_0x86c7('0x15')](0xcc)[_0x86c7('0x21')]();});}};}function handleEntityNotFound(_0x2f062f,_0x417139){return function(_0x35dca5){if(!_0x35dca5){_0x2f062f['sendStatus'](0x194);}return _0x35dca5;};}function handleError(_0x18b2dc,_0x5416d5){_0x5416d5=_0x5416d5||0x1f4;return function(_0x2e2dee){logger[_0x86c7('0x22')](_0x2e2dee['stack']);if(_0x2e2dee[_0x86c7('0x23')]){delete _0x2e2dee[_0x86c7('0x23')];}_0x18b2dc[_0x86c7('0x15')](_0x5416d5)[_0x86c7('0x24')](_0x2e2dee);};}exports[_0x86c7('0x25')]=function(_0x1ab7b0,_0x4b65c0){var _0x3e4e72={},_0x1ba32c={},_0x854fd4={'count':0x0,'rows':[]};var _0x3abcef=_['map'](db[_0x86c7('0x26')][_0x86c7('0x27')],function(_0x7799d){return{'name':_0x7799d[_0x86c7('0x28')],'type':_0x7799d[_0x86c7('0x29')][_0x86c7('0x2a')]};});_0x1ba32c[_0x86c7('0x2b')]=_[_0x86c7('0x2c')](_0x3abcef,_0x86c7('0x23'));_0x1ba32c[_0x86c7('0x2d')]=_['keys'](_0x1ab7b0[_0x86c7('0x2d')]);_0x1ba32c['filters']=_[_0x86c7('0x2e')](_0x1ba32c[_0x86c7('0x2b')],_0x1ba32c[_0x86c7('0x2d')]);_0x3e4e72[_0x86c7('0x2f')]=_[_0x86c7('0x2e')](_0x1ba32c[_0x86c7('0x2b')],qs[_0x86c7('0x30')](_0x1ab7b0[_0x86c7('0x2d')]['fields']));_0x3e4e72[_0x86c7('0x2f')]=_0x3e4e72[_0x86c7('0x2f')][_0x86c7('0x31')]?_0x3e4e72[_0x86c7('0x2f')]:_0x1ba32c[_0x86c7('0x2b')];if(!_0x1ab7b0[_0x86c7('0x2d')][_0x86c7('0x32')]('nolimit')){_0x3e4e72[_0x86c7('0x18')]=qs['limit'](_0x1ab7b0['query'][_0x86c7('0x18')]);_0x3e4e72[_0x86c7('0x1a')]=qs['offset'](_0x1ab7b0[_0x86c7('0x2d')]['offset']);}_0x3e4e72[_0x86c7('0x33')]=qs[_0x86c7('0x34')](_0x1ab7b0[_0x86c7('0x2d')]['sort']);_0x3e4e72[_0x86c7('0x35')]=qs['filters'](_[_0x86c7('0x36')](_0x1ab7b0[_0x86c7('0x2d')],_0x1ba32c['filters']),_0x3abcef);if(_0x1ab7b0[_0x86c7('0x2d')]['filter']){_0x3e4e72['where']=_[_0x86c7('0x37')](_0x3e4e72['where'],{'$or':_[_0x86c7('0x2c')](_0x3abcef,function(_0x30f47e){if(_0x30f47e[_0x86c7('0x29')]!==_0x86c7('0x38')){var _0x3593ea={};_0x3593ea[_0x30f47e[_0x86c7('0x23')]]={'$like':'%'+_0x1ab7b0[_0x86c7('0x2d')]['filter']+'%'};return _0x3593ea;}})});}_0x3e4e72=_['merge']({},_0x3e4e72,_0x1ab7b0[_0x86c7('0x39')]);var _0x1def51={'where':_0x3e4e72['where']};return db[_0x86c7('0x26')][_0x86c7('0x19')](_0x1def51)[_0x86c7('0x1f')](function(_0x24e5bf){_0x854fd4[_0x86c7('0x19')]=_0x24e5bf;if(_0x1ab7b0[_0x86c7('0x2d')]['includeAll']){_0x3e4e72[_0x86c7('0x3a')]=[{'all':!![]}];}return db[_0x86c7('0x26')][_0x86c7('0x3b')](_0x3e4e72);})[_0x86c7('0x1f')](function(_0x448a64){_0x854fd4['rows']=_0x448a64;return _0x854fd4;})['then'](respondWithFilteredResult(_0x4b65c0,_0x3e4e72))[_0x86c7('0x3c')](handleError(_0x4b65c0,null));};exports[_0x86c7('0x3d')]=function(_0x2f88de,_0x2e44fb){var _0xe1ad35={'raw':!![],'where':{'id':_0x2f88de[_0x86c7('0x3e')]['id']}},_0x333391={};_0x333391['model']=_[_0x86c7('0x3f')](db[_0x86c7('0x26')]['rawAttributes']);_0x333391[_0x86c7('0x2d')]=_['keys'](_0x2f88de[_0x86c7('0x2d')]);_0x333391[_0x86c7('0x40')]=_[_0x86c7('0x2e')](_0x333391[_0x86c7('0x2b')],_0x333391[_0x86c7('0x2d')]);_0xe1ad35[_0x86c7('0x2f')]=_['intersection'](_0x333391[_0x86c7('0x2b')],qs['fields'](_0x2f88de[_0x86c7('0x2d')][_0x86c7('0x30')]));_0xe1ad35[_0x86c7('0x2f')]=_0xe1ad35[_0x86c7('0x2f')][_0x86c7('0x31')]?_0xe1ad35[_0x86c7('0x2f')]:_0x333391[_0x86c7('0x2b')];if(_0x2f88de[_0x86c7('0x2d')][_0x86c7('0x41')]){_0xe1ad35[_0x86c7('0x3a')]=[{'all':!![]}];}_0xe1ad35=_[_0x86c7('0x37')]({},_0xe1ad35,_0x2f88de[_0x86c7('0x39')]);return db[_0x86c7('0x26')]['find'](_0xe1ad35)['then'](handleEntityNotFound(_0x2e44fb,null))[_0x86c7('0x1f')](respondWithResult(_0x2e44fb,null))[_0x86c7('0x3c')](handleError(_0x2e44fb,null));};exports['create']=function(_0xfb7a8a,_0x987fd2){return db[_0x86c7('0x26')][_0x86c7('0x42')](_0xfb7a8a['body'],{})['then'](respondWithResult(_0x987fd2,0xc9))[_0x86c7('0x3c')](handleError(_0x987fd2,null));};exports['update']=function(_0x52c920,_0x13bbd0){if(_0x52c920[_0x86c7('0x43')]['id']){delete _0x52c920[_0x86c7('0x43')]['id'];}return db[_0x86c7('0x26')]['find']({'where':{'id':_0x52c920[_0x86c7('0x3e')]['id']}})[_0x86c7('0x1f')](handleEntityNotFound(_0x13bbd0,null))[_0x86c7('0x1f')](saveUpdates(_0x52c920[_0x86c7('0x43')],null))['then'](respondWithResult(_0x13bbd0,null))[_0x86c7('0x3c')](handleError(_0x13bbd0,null));};exports[_0x86c7('0x20')]=function(_0x17dc52,_0x406607){return db['Dynamics365Field'][_0x86c7('0x44')]({'where':{'id':_0x17dc52[_0x86c7('0x3e')]['id']}})[_0x86c7('0x1f')](handleEntityNotFound(_0x406607,null))[_0x86c7('0x1f')](removeEntity(_0x406607,null))[_0x86c7('0x3c')](handleError(_0x406607,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 093300d..526ebc6 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 _0xf42a=['dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields'];(function(_0x2437a1,_0x4dfb16){var _0x4f20dc=function(_0x55ac01){while(--_0x55ac01){_0x2437a1['push'](_0x2437a1['shift']());}};_0x4f20dc(++_0x4dfb16);}(_0xf42a,0x16a));var _0xaf42=function(_0x4016fb,_0x74bf7c){_0x4016fb=_0x4016fb-0x0;var _0x114166=_0xf42a[_0x4016fb];return _0x114166;};'use strict';var _=require(_0xaf42('0x0'));var util=require(_0xaf42('0x1'));var logger=require(_0xaf42('0x2'))(_0xaf42('0x3'));var moment=require(_0xaf42('0x4'));var BPromise=require(_0xaf42('0x5'));var rp=require(_0xaf42('0x6'));var fs=require('fs');var path=require(_0xaf42('0x7'));var rimraf=require('rimraf');var config=require(_0xaf42('0x8'));var attributes=require(_0xaf42('0x9'));module[_0xaf42('0xa')]=function(_0x3cfac7,_0x4611ec){return _0x3cfac7[_0xaf42('0xb')]('Dynamics365Field',attributes,{'tableName':_0xaf42('0xc'),'paranoid':![],'indexes':[{'name':_0xaf42('0xd'),'fields':['idField',_0xaf42('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e1c=['int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','api','bluebird','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x11afd1,_0x4d62ff){var _0x5e8b34=function(_0x77b8b7){while(--_0x77b8b7){_0x11afd1['push'](_0x11afd1['shift']());}};_0x5e8b34(++_0x4d62ff);}(_0x0e1c,0x148));var _0xc0e1=function(_0x1b950c,_0x2843b7){_0x1b950c=_0x1b950c-0x0;var _0x20510b=_0x0e1c[_0x1b950c];return _0x20510b;};'use strict';var _=require(_0xc0e1('0x0'));var util=require(_0xc0e1('0x1'));var logger=require('../../config/logger')(_0xc0e1('0x2'));var moment=require('moment');var BPromise=require(_0xc0e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0e1('0x4'));var rimraf=require(_0xc0e1('0x5'));var config=require('../../config/environment');var attributes=require(_0xc0e1('0x6'));module[_0xc0e1('0x7')]=function(_0x5d507b,_0x3bae0d){return _0x5d507b[_0xc0e1('0x8')](_0xc0e1('0x9'),attributes,{'tableName':_0xc0e1('0xa'),'paranoid':![],'indexes':[{'name':_0xc0e1('0xb'),'fields':['idField',_0xc0e1('0xc')],'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 b1c8001..9ab61a4 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 _0xdc30=['rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x10ca28,_0x53392f){var _0x52d77f=function(_0x4ffa95){while(--_0x4ffa95){_0x10ca28['push'](_0x10ca28['shift']());}};_0x52d77f(++_0x53392f);}(_0xdc30,0x109));var _0x0dc3=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xdc30[_0x2e2681];return _0x368a64;};'use strict';var _=require('lodash');var util=require(_0x0dc3('0x0'));var moment=require(_0x0dc3('0x1'));var BPromise=require(_0x0dc3('0x2'));var rs=require(_0x0dc3('0x3'));var fs=require('fs');var Redis=require(_0x0dc3('0x4'));var db=require(_0x0dc3('0x5'))['db'];var utils=require(_0x0dc3('0x6'));var logger=require(_0x0dc3('0x7'))(_0x0dc3('0x8'));var config=require(_0x0dc3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0dc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6260,_0x4d1769,_0x35f876){return new BPromise(function(_0x1d1c1b,_0x4dd5f0){return client[_0x0dc3('0xb')](_0x3e6260,_0x35f876)[_0x0dc3('0xc')](function(_0x8f8460){logger[_0x0dc3('0xd')](_0x0dc3('0xe'),_0x4d1769,_0x0dc3('0xf'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4d1769,_0x0dc3('0xf'),JSON['stringify'](_0x8f8460));if(_0x8f8460[_0x0dc3('0x10')]){if(_0x8f8460[_0x0dc3('0x10')][_0x0dc3('0x11')]===0x1f4){logger[_0x0dc3('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4d1769,_0x8f8460[_0x0dc3('0x10')][_0x0dc3('0x12')]);return _0x4dd5f0(_0x8f8460['error'][_0x0dc3('0x12')]);}logger[_0x0dc3('0x10')](_0x0dc3('0xe'),_0x4d1769,_0x8f8460['error']['message']);return _0x1d1c1b(_0x8f8460['error']['message']);}else{logger['info'](_0x0dc3('0xe'),_0x4d1769,_0x0dc3('0xf'));_0x1d1c1b(_0x8f8460[_0x0dc3('0x13')][_0x0dc3('0x12')]);}})[_0x0dc3('0x14')](function(_0x5322d0){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4d1769,_0x5322d0);_0x4dd5f0(_0x5322d0);});});} \ No newline at end of file +var _0x1bca=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error'];(function(_0x187bc4,_0x40cee0){var _0x3a8944=function(_0x32e018){while(--_0x32e018){_0x187bc4['push'](_0x187bc4['shift']());}};_0x3a8944(++_0x40cee0);}(_0x1bca,0x1e6));var _0xa1bc=function(_0x19f716,_0x498681){_0x19f716=_0x19f716-0x0;var _0xfaa946=_0x1bca[_0x19f716];return _0xfaa946;};'use strict';var _=require(_0xa1bc('0x0'));var util=require(_0xa1bc('0x1'));var moment=require('moment');var BPromise=require(_0xa1bc('0x2'));var rs=require(_0xa1bc('0x3'));var fs=require('fs');var Redis=require(_0xa1bc('0x4'));var db=require(_0xa1bc('0x5'))['db'];var utils=require(_0xa1bc('0x6'));var logger=require(_0xa1bc('0x7'))(_0xa1bc('0x8'));var config=require(_0xa1bc('0x9'));var jayson=require(_0xa1bc('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10c051,_0x315873,_0x3fc756){return new BPromise(function(_0x9b83e6,_0x2e9fa6){return client['request'](_0x10c051,_0x3fc756)[_0xa1bc('0xb')](function(_0x2381db){logger[_0xa1bc('0xc')](_0xa1bc('0xd'),_0x315873,_0xa1bc('0xe'));logger[_0xa1bc('0xf')](_0xa1bc('0x10'),_0x315873,_0xa1bc('0xe'),JSON['stringify'](_0x2381db));if(_0x2381db[_0xa1bc('0x11')]){if(_0x2381db['error'][_0xa1bc('0x12')]===0x1f4){logger[_0xa1bc('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x315873,_0x2381db['error'][_0xa1bc('0x13')]);return _0x2e9fa6(_0x2381db[_0xa1bc('0x11')][_0xa1bc('0x13')]);}logger[_0xa1bc('0x11')](_0xa1bc('0xd'),_0x315873,_0x2381db[_0xa1bc('0x11')]['message']);return _0x9b83e6(_0x2381db[_0xa1bc('0x11')][_0xa1bc('0x13')]);}else{logger[_0xa1bc('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x315873,_0xa1bc('0xe'));_0x9b83e6(_0x2381db['result'][_0xa1bc('0x13')]);}})[_0xa1bc('0x14')](function(_0x545553){logger[_0xa1bc('0x11')](_0xa1bc('0xd'),_0x315873,_0x545553);_0x2e9fa6(_0x545553);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ec773e9..d2310f7 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 _0x0f73=['create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x888dc8,_0x3fabbd){var _0x400c40=function(_0x3e6643){while(--_0x3e6643){_0x888dc8['push'](_0x888dc8['shift']());}};_0x400c40(++_0x3fabbd);}(_0x0f73,0x1c0));var _0x30f7=function(_0x41dae8,_0x585948){_0x41dae8=_0x41dae8-0x0;var _0x5b9f49=_0x0f73[_0x41dae8];return _0x5b9f49;};'use strict';var multer=require(_0x30f7('0x0'));var util=require(_0x30f7('0x1'));var path=require(_0x30f7('0x2'));var timeout=require(_0x30f7('0x3'));var express=require(_0x30f7('0x4'));var router=express[_0x30f7('0x5')]();var fs_extra=require(_0x30f7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x30f7('0x7'));var config=require(_0x30f7('0x8'));var controller=require(_0x30f7('0x9'));router[_0x30f7('0xa')]('/',auth[_0x30f7('0xb')](),controller[_0x30f7('0xc')]);router['get'](_0x30f7('0xd'),auth['isAuthenticated'](),controller[_0x30f7('0xe')]);router['get'](_0x30f7('0xf'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x10')]);router[_0x30f7('0xa')](_0x30f7('0x11'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x12')]);router[_0x30f7('0x13')]('/',auth[_0x30f7('0xb')](),controller[_0x30f7('0x14')]);router[_0x30f7('0x13')](_0x30f7('0xf'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x15')]);router[_0x30f7('0x16')](_0x30f7('0xd'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x17')]);router['delete'](_0x30f7('0xd'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x18')]);module[_0x30f7('0x19')]=router; \ No newline at end of file +var _0xd3de=['post','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x5accad,_0x5791e0){var _0x5768c7=function(_0x701df9){while(--_0x701df9){_0x5accad['push'](_0x5accad['shift']());}};_0x5768c7(++_0x5791e0);}(_0xd3de,0x194));var _0xed3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd3de[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xed3d('0x0'));var util=require(_0xed3d('0x1'));var path=require(_0xed3d('0x2'));var timeout=require(_0xed3d('0x3'));var express=require(_0xed3d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xed3d('0x5'));var config=require('../../config/environment');var controller=require(_0xed3d('0x6'));router[_0xed3d('0x7')]('/',auth['isAuthenticated'](),controller[_0xed3d('0x8')]);router[_0xed3d('0x7')](_0xed3d('0x9'),auth[_0xed3d('0xa')](),controller[_0xed3d('0xb')]);router[_0xed3d('0x7')](_0xed3d('0xc'),auth['isAuthenticated'](),controller[_0xed3d('0xd')]);router['get'](_0xed3d('0xe'),auth['isAuthenticated'](),controller[_0xed3d('0xf')]);router[_0xed3d('0x10')]('/',auth['isAuthenticated'](),controller[_0xed3d('0x11')]);router[_0xed3d('0x10')]('/:id/configurations',auth[_0xed3d('0xa')](),controller['addConfiguration']);router[_0xed3d('0x12')](_0xed3d('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xed3d('0x13')](_0xed3d('0x9'),auth[_0xed3d('0xa')](),controller[_0xed3d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ae4b651..1540472 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 _0x4325=['exports','STRING','username','remoteUri','sequelize'];(function(_0x56db9d,_0x2f421d){var _0x23325d=function(_0x386eba){while(--_0x386eba){_0x56db9d['push'](_0x56db9d['shift']());}};_0x23325d(++_0x2f421d);}(_0x4325,0x1da));var _0x5432=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4325[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5432('0x2')]},'username':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5432('0x4')},'serverUrl':{'type':Sequelize[_0x5432('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0x229c63,_0x30b7de){var _0x374d4f=function(_0x3c5074){while(--_0x3c5074){_0x229c63['push'](_0x229c63['shift']());}};_0x374d4f(++_0x30b7de);}(_0x236c,0x155));var _0xc236=function(_0x3896fa,_0x5830d4){_0x3896fa=_0x3896fa-0x0;var _0x1ce7be=_0x236c[_0x3896fa];return _0x1ce7be;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 64c6575..9ad96c3 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 _0x34b7=['catch','show','includeAll','create','body','find','getConfigurations','findOne','params','FreshdeskConfiguration','length','order','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','includes','default','custom_text','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','include','rows'];(function(_0x570f07,_0x5ceae2){var _0x286e02=function(_0x5b8bb5){while(--_0x5b8bb5){_0x570f07['push'](_0x570f07['shift']());}};_0x286e02(++_0x5ceae2);}(_0x34b7,0x196));var _0x734b=function(_0x1789bc,_0x1acf84){_0x1789bc=_0x1789bc-0x0;var _0x35efd1=_0x34b7[_0x1789bc];return _0x35efd1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];var integrations=require(_0x734b('0x18'));function respondWithStatusCode(_0x189a82,_0xff9ddf){_0xff9ddf=_0xff9ddf||0xcc;return function(_0x145ec3){if(_0x145ec3){return _0x189a82[_0x734b('0x19')](_0xff9ddf);}return _0x189a82['status'](_0xff9ddf)[_0x734b('0x1a')]();};}function respondWithResult(_0x252510,_0x47791c){_0x47791c=_0x47791c||0xc8;return function(_0xd1ab2a){if(_0xd1ab2a){return _0x252510[_0x734b('0x1b')](_0x47791c)[_0x734b('0x1c')](_0xd1ab2a);}};}function respondWithFilteredResult(_0x2372bd,_0x2c03bd){return function(_0xa6d111){if(_0xa6d111){var _0x4b8c63=typeof _0x2c03bd[_0x734b('0x1d')]==='undefined'&&typeof _0x2c03bd[_0x734b('0x1e')]===_0x734b('0x1f');var _0xfb661a=_0xa6d111[_0x734b('0x20')];var _0x4d3b9c=_0x4b8c63?0x0:_0x2c03bd['offset'];var _0xcd12a1=_0x4b8c63?_0xa6d111[_0x734b('0x20')]:_0x2c03bd[_0x734b('0x1d')]+_0x2c03bd[_0x734b('0x1e')];var _0x1c605c;if(_0xcd12a1>=_0xfb661a){_0xcd12a1=_0xfb661a;_0x1c605c=0xc8;}else{_0x1c605c=0xce;}_0x2372bd[_0x734b('0x1b')](_0x1c605c);return _0x2372bd[_0x734b('0x21')](_0x734b('0x22'),_0x4d3b9c+'-'+_0xcd12a1+'/'+_0xfb661a)[_0x734b('0x1c')](_0xa6d111);}return null;};}function patchUpdates(_0x1d2b27){return function(_0x7060f8){try{jsonpatch[_0x734b('0x23')](_0x7060f8,_0x1d2b27,!![]);}catch(_0x477d6d){return BPromise[_0x734b('0x24')](_0x477d6d);}return _0x7060f8['save']();};}function saveUpdates(_0x1e4dcc,_0x7856d7){return function(_0x4f98a7){if(_0x4f98a7){return _0x4f98a7[_0x734b('0x25')](_0x1e4dcc)[_0x734b('0x26')](function(_0x1a7908){return _0x1a7908;});}return null;};}function removeEntity(_0x11fb8e,_0x46d432){return function(_0x26d118){if(_0x26d118){return _0x26d118[_0x734b('0x27')]()[_0x734b('0x26')](function(){_0x11fb8e[_0x734b('0x1b')](0xcc)[_0x734b('0x1a')]();});}};}function handleEntityNotFound(_0x44ffa9,_0x148abe){return function(_0x3bb651){if(!_0x3bb651){_0x44ffa9['sendStatus'](0x194);}return _0x3bb651;};}function handleError(_0x49732b,_0x13cc5a){_0x13cc5a=_0x13cc5a||0x1f4;return function(_0x3680a0){logger['error'](_0x3680a0[_0x734b('0x28')]);if(_0x3680a0[_0x734b('0x29')]){delete _0x3680a0[_0x734b('0x29')];}_0x49732b[_0x734b('0x1b')](_0x13cc5a)[_0x734b('0x2a')](_0x3680a0);};}exports[_0x734b('0x2b')]=function(_0x3ba39c,_0x5c6c5d){var _0x1f3652={},_0x436efe={},_0x42e9ae={'count':0x0,'rows':[]};var _0x241c89=_[_0x734b('0x2c')](db[_0x734b('0x2d')][_0x734b('0x2e')],function(_0x21ed3c){return{'name':_0x21ed3c[_0x734b('0x2f')],'type':_0x21ed3c[_0x734b('0x30')]['key']};});_0x436efe[_0x734b('0x31')]=_[_0x734b('0x2c')](_0x241c89,'name');_0x436efe[_0x734b('0x32')]=_[_0x734b('0x33')](_0x3ba39c[_0x734b('0x32')]);_0x436efe[_0x734b('0x34')]=_[_0x734b('0x35')](_0x436efe[_0x734b('0x31')],_0x436efe[_0x734b('0x32')]);_0x1f3652[_0x734b('0x36')]=_[_0x734b('0x35')](_0x436efe[_0x734b('0x31')],qs[_0x734b('0x37')](_0x3ba39c[_0x734b('0x32')][_0x734b('0x37')]));_0x1f3652[_0x734b('0x36')]=_0x1f3652[_0x734b('0x36')]['length']?_0x1f3652[_0x734b('0x36')]:_0x436efe['model'];if(!_0x3ba39c[_0x734b('0x32')][_0x734b('0x38')](_0x734b('0x39'))){_0x1f3652[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3ba39c[_0x734b('0x32')]['limit']);_0x1f3652['offset']=qs[_0x734b('0x1d')](_0x3ba39c['query'][_0x734b('0x1d')]);}_0x1f3652['order']=qs[_0x734b('0x3a')](_0x3ba39c['query'][_0x734b('0x3a')]);_0x1f3652['where']=qs[_0x734b('0x34')](_[_0x734b('0x3b')](_0x3ba39c[_0x734b('0x32')],_0x436efe[_0x734b('0x34')]),_0x241c89);if(_0x3ba39c[_0x734b('0x32')][_0x734b('0x3c')]){_0x1f3652[_0x734b('0x3d')]=_['merge'](_0x1f3652[_0x734b('0x3d')],{'$or':_[_0x734b('0x2c')](_0x241c89,function(_0x58db39){if(_0x58db39[_0x734b('0x30')]!==_0x734b('0x3e')){var _0x2bb422={};_0x2bb422[_0x58db39[_0x734b('0x29')]]={'$like':'%'+_0x3ba39c['query'][_0x734b('0x3c')]+'%'};return _0x2bb422;}})});}_0x1f3652=_[_0x734b('0x3f')]({},_0x1f3652,_0x3ba39c['options']);var _0x40674c={'where':_0x1f3652[_0x734b('0x3d')]};return db['FreshdeskAccount'][_0x734b('0x20')](_0x40674c)[_0x734b('0x26')](function(_0x2820f9){_0x42e9ae[_0x734b('0x20')]=_0x2820f9;if(_0x3ba39c['query']['includeAll']){_0x1f3652[_0x734b('0x40')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x1f3652);})[_0x734b('0x26')](function(_0x50bde2){_0x42e9ae[_0x734b('0x41')]=_0x50bde2;return _0x42e9ae;})['then'](respondWithFilteredResult(_0x5c6c5d,_0x1f3652))[_0x734b('0x42')](handleError(_0x5c6c5d,null));};exports[_0x734b('0x43')]=function(_0xe4fe38,_0x4c3fdc){var _0x5cf3a0={'raw':![],'where':{'id':_0xe4fe38['params']['id']}},_0x2e1aa8={};_0x2e1aa8['model']=_[_0x734b('0x33')](db[_0x734b('0x2d')]['rawAttributes']);_0x2e1aa8[_0x734b('0x32')]=_['keys'](_0xe4fe38[_0x734b('0x32')]);_0x2e1aa8[_0x734b('0x34')]=_[_0x734b('0x35')](_0x2e1aa8['model'],_0x2e1aa8[_0x734b('0x32')]);_0x5cf3a0[_0x734b('0x36')]=_[_0x734b('0x35')](_0x2e1aa8[_0x734b('0x31')],qs['fields'](_0xe4fe38['query']['fields']));_0x5cf3a0[_0x734b('0x36')]=_0x5cf3a0['attributes']['length']?_0x5cf3a0[_0x734b('0x36')]:_0x2e1aa8['model'];if(_0xe4fe38[_0x734b('0x32')][_0x734b('0x44')]){_0x5cf3a0[_0x734b('0x40')]=[{'all':!![]}];}_0x5cf3a0=_[_0x734b('0x3f')]({},_0x5cf3a0,_0xe4fe38['options']);return db[_0x734b('0x2d')]['find'](_0x5cf3a0)[_0x734b('0x26')](handleEntityNotFound(_0x4c3fdc,null))[_0x734b('0x26')](respondWithResult(_0x4c3fdc,null))[_0x734b('0x42')](handleError(_0x4c3fdc,null));};exports['create']=function(_0x370326,_0x4c3efb){return db[_0x734b('0x2d')][_0x734b('0x45')](_0x370326['body'],{})[_0x734b('0x26')](respondWithResult(_0x4c3efb,0xc9))[_0x734b('0x42')](handleError(_0x4c3efb,null));};exports[_0x734b('0x25')]=function(_0x38125a,_0x21e127){if(_0x38125a['body']['id']){delete _0x38125a[_0x734b('0x46')]['id'];}return db['FreshdeskAccount'][_0x734b('0x47')]({'where':{'id':_0x38125a['params']['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x21e127,null))[_0x734b('0x26')](saveUpdates(_0x38125a[_0x734b('0x46')],null))[_0x734b('0x26')](respondWithResult(_0x21e127,null))[_0x734b('0x42')](handleError(_0x21e127,null));};exports['destroy']=function(_0x4c0378,_0x484156){return db[_0x734b('0x2d')][_0x734b('0x47')]({'where':{'id':_0x4c0378['params']['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x484156,null))[_0x734b('0x26')](removeEntity(_0x484156,null))['catch'](handleError(_0x484156,null));};exports[_0x734b('0x48')]=function(_0x3a9749,_0x44e6d2,_0x4d6501){var _0x2e95aa={};var _0x226f6c={};var _0x423b22;var _0xe605be;return db['FreshdeskAccount'][_0x734b('0x49')]({'where':{'id':_0x3a9749[_0x734b('0x4a')]['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x44e6d2,null))[_0x734b('0x26')](function(_0x4b65bf){if(_0x4b65bf){_0x423b22=_0x4b65bf;_0x226f6c[_0x734b('0x31')]=_['keys'](db[_0x734b('0x4b')][_0x734b('0x2e')]);_0x226f6c[_0x734b('0x32')]=_[_0x734b('0x33')](_0x3a9749['query']);_0x226f6c[_0x734b('0x34')]=_[_0x734b('0x35')](_0x226f6c['model'],_0x226f6c['query']);_0x2e95aa[_0x734b('0x36')]=_['intersection'](_0x226f6c[_0x734b('0x31')],qs[_0x734b('0x37')](_0x3a9749[_0x734b('0x32')]['fields']));_0x2e95aa[_0x734b('0x36')]=_0x2e95aa['attributes'][_0x734b('0x4c')]?_0x2e95aa[_0x734b('0x36')]:_0x226f6c[_0x734b('0x31')];_0x2e95aa[_0x734b('0x4d')]=qs['sort'](_0x3a9749[_0x734b('0x32')]['sort']);_0x2e95aa[_0x734b('0x3d')]=qs[_0x734b('0x34')](_[_0x734b('0x3b')](_0x3a9749['query'],_0x226f6c[_0x734b('0x34')]));if(_0x3a9749['query'][_0x734b('0x3c')]){_0x2e95aa[_0x734b('0x3d')]=_[_0x734b('0x3f')](_0x2e95aa[_0x734b('0x3d')],{'$or':_['map'](_0x2e95aa[_0x734b('0x36')],function(_0x48c613){var _0x44e876={};_0x44e876[_0x48c613]={'$like':'%'+_0x3a9749[_0x734b('0x32')][_0x734b('0x3c')]+'%'};return _0x44e876;})});}_0x2e95aa=_['merge']({},_0x2e95aa,_0x3a9749[_0x734b('0x4e')]);return _0x423b22[_0x734b('0x48')](_0x2e95aa);}})[_0x734b('0x26')](function(_0x3b16bb){if(_0x3b16bb){_0xe605be=_0x3b16bb[_0x734b('0x4c')];if(!_0x3a9749[_0x734b('0x32')][_0x734b('0x38')]('nolimit')){_0x2e95aa[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3a9749[_0x734b('0x32')]['limit']);_0x2e95aa['offset']=qs[_0x734b('0x1d')](_0x3a9749[_0x734b('0x32')][_0x734b('0x1d')]);}return _0x423b22[_0x734b('0x48')](_0x2e95aa);}})['then'](function(_0x565a2e){if(_0x565a2e){return _0x565a2e?{'count':_0xe605be,'rows':_0x565a2e}:null;}})['then'](respondWithResult(_0x44e6d2,null))[_0x734b('0x42')](handleError(_0x44e6d2,null));};exports[_0x734b('0x4f')]=function(_0x1f9cfe,_0x292c68,_0x1b57c5){if(_0x1f9cfe[_0x734b('0x46')]['id']){delete _0x1f9cfe[_0x734b('0x46')]['id'];}return db[_0x734b('0x2d')][_0x734b('0x49')]({'where':{'id':_0x1f9cfe[_0x734b('0x4a')]['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x292c68,null))[_0x734b('0x26')](function(_0x43951a){if(_0x43951a){_0x1f9cfe[_0x734b('0x46')][_0x734b('0x50')]=_0x43951a['id'];_0x1f9cfe[_0x734b('0x46')][_0x734b('0x51')]=integrations[_0x734b('0x52')](_0x1f9cfe[_0x734b('0x46')][_0x734b('0x53')],_0x1f9cfe[_0x734b('0x46')]['type']);_0x1f9cfe[_0x734b('0x46')][_0x734b('0x54')]=integrations[_0x734b('0x55')](_0x1f9cfe[_0x734b('0x46')][_0x734b('0x53')],_0x1f9cfe['body'][_0x734b('0x30')]);return db[_0x734b('0x4b')][_0x734b('0x45')](_0x1f9cfe[_0x734b('0x46')],{'include':[{'model':db[_0x734b('0x56')],'as':_0x734b('0x51')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x292c68,null))['catch'](handleError(_0x292c68,null));};exports['getFields']=function(_0x3ce4bc,_0x30ffea,_0x16c9d2){var _0xb23b61='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x3ce4bc[_0x734b('0x4a')]['id']},'attributes':['id',_0x734b('0x57'),_0x734b('0x58')]})[_0x734b('0x26')](handleEntityNotFound(_0x30ffea,null))['then'](function(_0x3b364c){if(_0x3b364c){_0xb23b61=_0x3b364c[_0x734b('0x57')];var _0x200f2d=_0xb23b61[_0x734b('0x59')](-0x1);if(_0x200f2d==='/'){_0xb23b61=_0xb23b61['substring'](0x0,_0xb23b61[_0x734b('0x5a')](_0x200f2d));}return rp({'method':'GET','uri':util[_0x734b('0x5b')](_0x734b('0x5c'),_0xb23b61,_0x734b('0x5d')),'headers':{'Authorization':util[_0x734b('0x5b')](_0x734b('0x5e'),new Buffer(util['format'](_0x734b('0x5f'),_0x3b364c[_0x734b('0x58')]))[_0x734b('0x60')](_0x734b('0x61')))},'json':!![]});}})[_0x734b('0x26')](function(_0x599ed1){if(_0x599ed1){var _0x475ecd=[_0x734b('0x62'),_0x734b('0x63'),_0x734b('0x64'),'description',_0x734b('0x1b'),_0x734b('0x65'),_0x734b('0x66'),_0x734b('0x67'),_0x734b('0x68'),'group',_0x734b('0x69')];_['remove'](_0x599ed1,function(_0x460868){return _0x475ecd[_0x734b('0x6a')](_0x460868[_0x734b('0x29')])||!_0x460868[_0x734b('0x6b')]&&_0x460868[_0x734b('0x30')]!==_0x734b('0x6c')&&_0x460868['type']!=='custom_dropdown';});return{'count':_0x599ed1['length'],'rows':_[_0x734b('0x2c')](_0x599ed1,function(_0x540ce8){return{'id':_0x540ce8[_0x734b('0x29')],'name':_0x540ce8[_0x734b('0x6d')],'custom':!_0x540ce8['default'],'options':_0x540ce8[_0x734b('0x6e')]?_[_0x734b('0x2c')](_0x540ce8[_0x734b('0x6e')],function(_0x2a3c8d){return{'name':_[_0x734b('0x6f')](_0x2a3c8d),'value':_0x2a3c8d};}):[]};})};}})[_0x734b('0x26')](respondWithResult(_0x30ffea,null))[_0x734b('0x42')](function(_0x45f05b){var _0x408625=_0x3ce4bc[_0x734b('0x32')]['test']?0x1f4:_0x45f05b[_0x734b('0x70')]||0x1f4;logger[_0x734b('0x71')](_0x734b('0x72'),'getFields',_0x408625,JSON[_0x734b('0x73')](_0x45f05b));delete _0x45f05b[_0x734b('0x29')];if(_0x408625===0x191){_0x408625=0x190;}_0x30ffea[_0x734b('0x1b')](_0x408625)[_0x734b('0x2a')](_0x3ce4bc[_0x734b('0x32')][_0x734b('0x74')]?{'message':_0x734b('0x75'),'statusCode':_0x45f05b[_0x734b('0x70')]}:_0x45f05b);});}; \ No newline at end of file +var _0xb01a=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type'];(function(_0x3bea4,_0x56a1a5){var _0xf8e956=function(_0x489bd7){while(--_0x489bd7){_0x3bea4['push'](_0x3bea4['shift']());}};_0xf8e956(++_0x56a1a5);}(_0xb01a,0x1a1));var _0xab01=function(_0x3c371a,_0x3893fa){_0x3c371a=_0x3c371a-0x0;var _0x1ad099=_0xb01a[_0x3c371a];return _0x1ad099;};'use strict';var emlformat=require(_0xab01('0x0'));var rimraf=require(_0xab01('0x1'));var zipdir=require(_0xab01('0x2'));var jsonpatch=require(_0xab01('0x3'));var rp=require(_0xab01('0x4'));var moment=require(_0xab01('0x5'));var BPromise=require(_0xab01('0x6'));var Mustache=require(_0xab01('0x7'));var util=require(_0xab01('0x8'));var path=require(_0xab01('0x9'));var sox=require(_0xab01('0xa'));var csv=require(_0xab01('0xb'));var ejs=require(_0xab01('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab01('0xd'));var squel=require(_0xab01('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab01('0xf'));var toCsv=require(_0xab01('0xb'));var querystring=require('querystring');var Papa=require(_0xab01('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xab01('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab01('0x12'));var logger=require(_0xab01('0x13'))('api');var utils=require(_0xab01('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab01('0x15'))['db'];var integrations=require(_0xab01('0x16'));function respondWithStatusCode(_0x1ededa,_0xe9d23c){_0xe9d23c=_0xe9d23c||0xcc;return function(_0x449402){if(_0x449402){return _0x1ededa[_0xab01('0x17')](_0xe9d23c);}return _0x1ededa[_0xab01('0x18')](_0xe9d23c)[_0xab01('0x19')]();};}function respondWithResult(_0x509ceb,_0x4812c6){_0x4812c6=_0x4812c6||0xc8;return function(_0x512124){if(_0x512124){return _0x509ceb['status'](_0x4812c6)[_0xab01('0x1a')](_0x512124);}};}function respondWithFilteredResult(_0x4c0557,_0x2bfa8a){return function(_0x2d9c23){if(_0x2d9c23){var _0x26af11=typeof _0x2bfa8a[_0xab01('0x1b')]==='undefined'&&typeof _0x2bfa8a[_0xab01('0x1c')]==='undefined';var _0x2adbe5=_0x2d9c23[_0xab01('0x1d')];var _0x47e994=_0x26af11?0x0:_0x2bfa8a['offset'];var _0x22dd53=_0x26af11?_0x2d9c23[_0xab01('0x1d')]:_0x2bfa8a[_0xab01('0x1b')]+_0x2bfa8a[_0xab01('0x1c')];var _0x290d30;if(_0x22dd53>=_0x2adbe5){_0x22dd53=_0x2adbe5;_0x290d30=0xc8;}else{_0x290d30=0xce;}_0x4c0557[_0xab01('0x18')](_0x290d30);return _0x4c0557[_0xab01('0x1e')](_0xab01('0x1f'),_0x47e994+'-'+_0x22dd53+'/'+_0x2adbe5)[_0xab01('0x1a')](_0x2d9c23);}return null;};}function patchUpdates(_0x331daf){return function(_0x50d0bd){try{jsonpatch[_0xab01('0x20')](_0x50d0bd,_0x331daf,!![]);}catch(_0x80802a){return BPromise[_0xab01('0x21')](_0x80802a);}return _0x50d0bd[_0xab01('0x22')]();};}function saveUpdates(_0x405c93,_0x180344){return function(_0x380176){if(_0x380176){return _0x380176[_0xab01('0x23')](_0x405c93)['then'](function(_0x3fba2e){return _0x3fba2e;});}return null;};}function removeEntity(_0x152d5e,_0x27b430){return function(_0x343ae6){if(_0x343ae6){return _0x343ae6[_0xab01('0x24')]()[_0xab01('0x25')](function(){_0x152d5e[_0xab01('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1efebe,_0x16a719){return function(_0x2758d){if(!_0x2758d){_0x1efebe[_0xab01('0x17')](0x194);}return _0x2758d;};}function handleError(_0x27e549,_0x46088d){_0x46088d=_0x46088d||0x1f4;return function(_0x46af29){logger['error'](_0x46af29[_0xab01('0x26')]);if(_0x46af29[_0xab01('0x27')]){delete _0x46af29[_0xab01('0x27')];}_0x27e549[_0xab01('0x18')](_0x46088d)[_0xab01('0x28')](_0x46af29);};}exports[_0xab01('0x29')]=function(_0x51a927,_0x3c2474){var _0x209e10={},_0x4a22c0={},_0x65afdd={'count':0x0,'rows':[]};var _0x16cc49=_[_0xab01('0x2a')](db[_0xab01('0x2b')][_0xab01('0x2c')],function(_0x18b4de){return{'name':_0x18b4de[_0xab01('0x2d')],'type':_0x18b4de[_0xab01('0x2e')]['key']};});_0x4a22c0[_0xab01('0x2f')]=_[_0xab01('0x2a')](_0x16cc49,'name');_0x4a22c0[_0xab01('0x30')]=_[_0xab01('0x31')](_0x51a927[_0xab01('0x30')]);_0x4a22c0[_0xab01('0x32')]=_[_0xab01('0x33')](_0x4a22c0[_0xab01('0x2f')],_0x4a22c0['query']);_0x209e10[_0xab01('0x34')]=_[_0xab01('0x33')](_0x4a22c0[_0xab01('0x2f')],qs[_0xab01('0x35')](_0x51a927[_0xab01('0x30')][_0xab01('0x35')]));_0x209e10[_0xab01('0x34')]=_0x209e10['attributes']['length']?_0x209e10['attributes']:_0x4a22c0[_0xab01('0x2f')];if(!_0x51a927[_0xab01('0x30')][_0xab01('0x36')](_0xab01('0x37'))){_0x209e10[_0xab01('0x1c')]=qs[_0xab01('0x1c')](_0x51a927[_0xab01('0x30')][_0xab01('0x1c')]);_0x209e10[_0xab01('0x1b')]=qs[_0xab01('0x1b')](_0x51a927[_0xab01('0x30')][_0xab01('0x1b')]);}_0x209e10[_0xab01('0x38')]=qs[_0xab01('0x39')](_0x51a927[_0xab01('0x30')][_0xab01('0x39')]);_0x209e10['where']=qs['filters'](_[_0xab01('0x3a')](_0x51a927[_0xab01('0x30')],_0x4a22c0['filters']),_0x16cc49);if(_0x51a927[_0xab01('0x30')][_0xab01('0x3b')]){_0x209e10[_0xab01('0x3c')]=_['merge'](_0x209e10[_0xab01('0x3c')],{'$or':_['map'](_0x16cc49,function(_0x535b32){if(_0x535b32[_0xab01('0x2e')]!==_0xab01('0x3d')){var _0x595017={};_0x595017[_0x535b32[_0xab01('0x27')]]={'$like':'%'+_0x51a927[_0xab01('0x30')]['filter']+'%'};return _0x595017;}})});}_0x209e10=_[_0xab01('0x3e')]({},_0x209e10,_0x51a927[_0xab01('0x3f')]);var _0x265ec9={'where':_0x209e10[_0xab01('0x3c')]};return db[_0xab01('0x2b')][_0xab01('0x1d')](_0x265ec9)['then'](function(_0x109ad6){_0x65afdd[_0xab01('0x1d')]=_0x109ad6;if(_0x51a927[_0xab01('0x30')][_0xab01('0x40')]){_0x209e10[_0xab01('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x209e10);})['then'](function(_0x3132d5){_0x65afdd[_0xab01('0x42')]=_0x3132d5;return _0x65afdd;})['then'](respondWithFilteredResult(_0x3c2474,_0x209e10))[_0xab01('0x43')](handleError(_0x3c2474,null));};exports[_0xab01('0x44')]=function(_0x1df4d9,_0x7d039e){var _0x3ef323={'raw':![],'where':{'id':_0x1df4d9[_0xab01('0x45')]['id']}},_0x1cb057={};_0x1cb057[_0xab01('0x2f')]=_[_0xab01('0x31')](db[_0xab01('0x2b')][_0xab01('0x2c')]);_0x1cb057[_0xab01('0x30')]=_[_0xab01('0x31')](_0x1df4d9[_0xab01('0x30')]);_0x1cb057[_0xab01('0x32')]=_[_0xab01('0x33')](_0x1cb057[_0xab01('0x2f')],_0x1cb057['query']);_0x3ef323['attributes']=_[_0xab01('0x33')](_0x1cb057[_0xab01('0x2f')],qs[_0xab01('0x35')](_0x1df4d9[_0xab01('0x30')][_0xab01('0x35')]));_0x3ef323[_0xab01('0x34')]=_0x3ef323['attributes'][_0xab01('0x46')]?_0x3ef323[_0xab01('0x34')]:_0x1cb057['model'];if(_0x1df4d9[_0xab01('0x30')][_0xab01('0x40')]){_0x3ef323[_0xab01('0x41')]=[{'all':!![]}];}_0x3ef323=_['merge']({},_0x3ef323,_0x1df4d9[_0xab01('0x3f')]);return db[_0xab01('0x2b')][_0xab01('0x47')](_0x3ef323)[_0xab01('0x25')](handleEntityNotFound(_0x7d039e,null))[_0xab01('0x25')](respondWithResult(_0x7d039e,null))['catch'](handleError(_0x7d039e,null));};exports[_0xab01('0x48')]=function(_0x5e5847,_0x79fa9f){return db[_0xab01('0x2b')][_0xab01('0x48')](_0x5e5847['body'],{})[_0xab01('0x25')](respondWithResult(_0x79fa9f,0xc9))[_0xab01('0x43')](handleError(_0x79fa9f,null));};exports[_0xab01('0x23')]=function(_0x1b11c4,_0x5e4316){if(_0x1b11c4[_0xab01('0x49')]['id']){delete _0x1b11c4[_0xab01('0x49')]['id'];}return db[_0xab01('0x2b')][_0xab01('0x47')]({'where':{'id':_0x1b11c4[_0xab01('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e4316,null))[_0xab01('0x25')](saveUpdates(_0x1b11c4[_0xab01('0x49')],null))['then'](respondWithResult(_0x5e4316,null))[_0xab01('0x43')](handleError(_0x5e4316,null));};exports[_0xab01('0x24')]=function(_0x182d45,_0x1ccdbd){return db[_0xab01('0x2b')][_0xab01('0x47')]({'where':{'id':_0x182d45[_0xab01('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ccdbd,null))['then'](removeEntity(_0x1ccdbd,null))[_0xab01('0x43')](handleError(_0x1ccdbd,null));};exports[_0xab01('0x4a')]=function(_0x1a0a14,_0x35ac7b,_0x4de07a){var _0x4d181a={};var _0x7eec31={};var _0x460fb7;var _0x1f1b6f;return db[_0xab01('0x2b')][_0xab01('0x4b')]({'where':{'id':_0x1a0a14[_0xab01('0x45')]['id']}})[_0xab01('0x25')](handleEntityNotFound(_0x35ac7b,null))['then'](function(_0x4f2af6){if(_0x4f2af6){_0x460fb7=_0x4f2af6;_0x7eec31[_0xab01('0x2f')]=_[_0xab01('0x31')](db[_0xab01('0x4c')][_0xab01('0x2c')]);_0x7eec31[_0xab01('0x30')]=_['keys'](_0x1a0a14['query']);_0x7eec31['filters']=_[_0xab01('0x33')](_0x7eec31[_0xab01('0x2f')],_0x7eec31[_0xab01('0x30')]);_0x4d181a[_0xab01('0x34')]=_[_0xab01('0x33')](_0x7eec31[_0xab01('0x2f')],qs[_0xab01('0x35')](_0x1a0a14[_0xab01('0x30')]['fields']));_0x4d181a[_0xab01('0x34')]=_0x4d181a[_0xab01('0x34')][_0xab01('0x46')]?_0x4d181a[_0xab01('0x34')]:_0x7eec31[_0xab01('0x2f')];_0x4d181a[_0xab01('0x38')]=qs[_0xab01('0x39')](_0x1a0a14[_0xab01('0x30')][_0xab01('0x39')]);_0x4d181a[_0xab01('0x3c')]=qs[_0xab01('0x32')](_[_0xab01('0x3a')](_0x1a0a14[_0xab01('0x30')],_0x7eec31[_0xab01('0x32')]));if(_0x1a0a14[_0xab01('0x30')][_0xab01('0x3b')]){_0x4d181a[_0xab01('0x3c')]=_['merge'](_0x4d181a[_0xab01('0x3c')],{'$or':_[_0xab01('0x2a')](_0x4d181a['attributes'],function(_0xacd26f){var _0x40a3ab={};_0x40a3ab[_0xacd26f]={'$like':'%'+_0x1a0a14[_0xab01('0x30')][_0xab01('0x3b')]+'%'};return _0x40a3ab;})});}_0x4d181a=_[_0xab01('0x3e')]({},_0x4d181a,_0x1a0a14[_0xab01('0x3f')]);return _0x460fb7['getConfigurations'](_0x4d181a);}})[_0xab01('0x25')](function(_0x96867e){if(_0x96867e){_0x1f1b6f=_0x96867e['length'];if(!_0x1a0a14['query']['hasOwnProperty'](_0xab01('0x37'))){_0x4d181a[_0xab01('0x1c')]=qs[_0xab01('0x1c')](_0x1a0a14[_0xab01('0x30')][_0xab01('0x1c')]);_0x4d181a['offset']=qs[_0xab01('0x1b')](_0x1a0a14[_0xab01('0x30')][_0xab01('0x1b')]);}return _0x460fb7[_0xab01('0x4a')](_0x4d181a);}})[_0xab01('0x25')](function(_0x117477){if(_0x117477){return _0x117477?{'count':_0x1f1b6f,'rows':_0x117477}:null;}})[_0xab01('0x25')](respondWithResult(_0x35ac7b,null))[_0xab01('0x43')](handleError(_0x35ac7b,null));};exports[_0xab01('0x4d')]=function(_0x4a260b,_0x9f3dba,_0x3a5f47){if(_0x4a260b['body']['id']){delete _0x4a260b[_0xab01('0x49')]['id'];}return db[_0xab01('0x2b')][_0xab01('0x4b')]({'where':{'id':_0x4a260b[_0xab01('0x45')]['id']}})[_0xab01('0x25')](handleEntityNotFound(_0x9f3dba,null))[_0xab01('0x25')](function(_0x5505da){if(_0x5505da){_0x4a260b[_0xab01('0x49')][_0xab01('0x4e')]=_0x5505da['id'];_0x4a260b[_0xab01('0x49')][_0xab01('0x4f')]=integrations[_0xab01('0x50')](_0x4a260b[_0xab01('0x49')]['channel'],_0x4a260b[_0xab01('0x49')][_0xab01('0x2e')]);_0x4a260b['body'][_0xab01('0x51')]=integrations['getDescriptions'](_0x4a260b['body'][_0xab01('0x52')],_0x4a260b['body']['type']);return db[_0xab01('0x4c')]['create'](_0x4a260b[_0xab01('0x49')],{'include':[{'model':db[_0xab01('0x53')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0xab01('0x25')](respondWithResult(_0x9f3dba,null))[_0xab01('0x43')](handleError(_0x9f3dba,null));};exports[_0xab01('0x54')]=function(_0x38e126,_0x15e56b,_0x445263){var _0x1cf09f='';return db[_0xab01('0x2b')]['findOne']({'where':{'id':_0x38e126['params']['id']},'attributes':['id',_0xab01('0x55'),_0xab01('0x56')]})[_0xab01('0x25')](handleEntityNotFound(_0x15e56b,null))[_0xab01('0x25')](function(_0x1a9904){if(_0x1a9904){_0x1cf09f=_0x1a9904['remoteUri'];var _0x46ac1e=_0x1cf09f[_0xab01('0x57')](-0x1);if(_0x46ac1e==='/'){_0x1cf09f=_0x1cf09f[_0xab01('0x58')](0x0,_0x1cf09f[_0xab01('0x59')](_0x46ac1e));}return rp({'method':'GET','uri':util['format'](_0xab01('0x5a'),_0x1cf09f,_0xab01('0x5b')),'headers':{'Authorization':util[_0xab01('0x5c')](_0xab01('0x5d'),new Buffer(util[_0xab01('0x5c')]('%s:X',_0x1a9904[_0xab01('0x56')]))[_0xab01('0x5e')](_0xab01('0x5f')))},'json':!![]});}})[_0xab01('0x25')](function(_0xb682dc){if(_0xb682dc){var _0x16d2ee=[_0xab01('0x60'),_0xab01('0x61'),'agent',_0xab01('0x62'),_0xab01('0x18'),_0xab01('0x63'),_0xab01('0x64'),_0xab01('0x65'),_0xab01('0x66'),_0xab01('0x64'),_0xab01('0x67')];_[_0xab01('0x68')](_0xb682dc,function(_0x5db277){return _0x16d2ee[_0xab01('0x69')](_0x5db277[_0xab01('0x27')])||!_0x5db277[_0xab01('0x6a')]&&_0x5db277['type']!==_0xab01('0x6b')&&_0x5db277['type']!==_0xab01('0x6c');});return{'count':_0xb682dc['length'],'rows':_[_0xab01('0x2a')](_0xb682dc,function(_0x3ad39c){return{'id':_0x3ad39c[_0xab01('0x27')],'name':_0x3ad39c['label'],'custom':!_0x3ad39c[_0xab01('0x6a')],'options':_0x3ad39c[_0xab01('0x6d')]?_[_0xab01('0x2a')](_0x3ad39c[_0xab01('0x6d')],function(_0x584a0b){return{'name':_[_0xab01('0x6e')](_0x584a0b),'value':_0x584a0b};}):[]};})};}})[_0xab01('0x25')](respondWithResult(_0x15e56b,null))[_0xab01('0x43')](function(_0x389b29){var _0x3ed1a8=_0x38e126[_0xab01('0x30')][_0xab01('0x6f')]?0x1f4:_0x389b29['statusCode']||0x1f4;logger[_0xab01('0x70')](_0xab01('0x71'),_0xab01('0x54'),_0x3ed1a8,JSON[_0xab01('0x72')](_0x389b29));delete _0x389b29['name'];if(_0x3ed1a8===0x191){_0x3ed1a8=0x190;}_0x15e56b[_0xab01('0x18')](_0x3ed1a8)['send'](_0x38e126[_0xab01('0x30')][_0xab01('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x389b29[_0xab01('0x73')]}:_0x389b29);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d92058c..1f3e9f3 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 _0x8fb1=['../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','api','bluebird','request-promise','path'];(function(_0x4f9d3e,_0x4206bc){var _0x393612=function(_0x38f666){while(--_0x38f666){_0x4f9d3e['push'](_0x4f9d3e['shift']());}};_0x393612(++_0x4206bc);}(_0x8fb1,0x19d));var _0x18fb=function(_0x255f5f,_0x120a85){_0x255f5f=_0x255f5f-0x0;var _0x1982ec=_0x8fb1[_0x255f5f];return _0x1982ec;};'use strict';var _=require('lodash');var util=require(_0x18fb('0x0'));var logger=require('../../config/logger')(_0x18fb('0x1'));var moment=require('moment');var BPromise=require(_0x18fb('0x2'));var rp=require(_0x18fb('0x3'));var fs=require('fs');var path=require(_0x18fb('0x4'));var rimraf=require('rimraf');var config=require(_0x18fb('0x5'));var attributes=require(_0x18fb('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x18fb('0x7')]=function(_0x1fedb4,_0x621fb6){return _0x1fedb4[_0x18fb('0x8')](_0x18fb('0x9'),attributes,{'tableName':_0x18fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x456a=['request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','api','moment','bluebird'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x456a,0x11b));var _0xa456=function(_0x590554,_0x229364){_0x590554=_0x590554-0x0;var _0x57b494=_0x456a[_0x590554];return _0x57b494;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa456('0x0'));var moment=require(_0xa456('0x1'));var BPromise=require(_0xa456('0x2'));var rp=require(_0xa456('0x3'));var fs=require('fs');var path=require(_0xa456('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa456('0x5'));var integrations=require(_0xa456('0x6'));module[_0xa456('0x7')]=function(_0x33fc9c,_0x5ad249){return _0x33fc9c[_0xa456('0x8')](_0xa456('0x9'),attributes,{'tableName':_0xa456('0xa'),'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 8b790be..2c1c6c8 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 _0x4dc7=['info','result','catch','FreshdeskAccount','findAll','options','attributes','limit','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x548698,_0x3c952e){var _0xd924e3=function(_0x53f180){while(--_0x53f180){_0x548698['push'](_0x548698['shift']());}};_0xd924e3(++_0x3c952e);}(_0x4dc7,0x182));var _0x74dc=function(_0x5141dc,_0x5f271a){_0x5141dc=_0x5141dc-0x0;var _0x396104=_0x4dc7[_0x5141dc];return _0x396104;};'use strict';var _=require(_0x74dc('0x0'));var util=require(_0x74dc('0x1'));var moment=require(_0x74dc('0x2'));var BPromise=require(_0x74dc('0x3'));var rs=require(_0x74dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x74dc('0x5'));var logger=require(_0x74dc('0x6'))(_0x74dc('0x7'));var config=require(_0x74dc('0x8'));var jayson=require(_0x74dc('0x9'));var client=jayson['client'][_0x74dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41239c,_0x534af2,_0xd08fd9){return new BPromise(function(_0x33caef,_0x2a3c60){return client[_0x74dc('0xb')](_0x41239c,_0xd08fd9)[_0x74dc('0xc')](function(_0x51d48a){logger['info'](_0x74dc('0xd'),_0x534af2,_0x74dc('0xe'));logger[_0x74dc('0xf')](_0x74dc('0x10'),_0x534af2,'request\x20sent',JSON[_0x74dc('0x11')](_0x51d48a));if(_0x51d48a['error']){if(_0x51d48a[_0x74dc('0x12')][_0x74dc('0x13')]===0x1f4){logger[_0x74dc('0x12')](_0x74dc('0xd'),_0x534af2,_0x51d48a[_0x74dc('0x12')][_0x74dc('0x14')]);return _0x2a3c60(_0x51d48a[_0x74dc('0x12')][_0x74dc('0x14')]);}logger[_0x74dc('0x12')](_0x74dc('0xd'),_0x534af2,_0x51d48a['error']['message']);return _0x33caef(_0x51d48a[_0x74dc('0x12')][_0x74dc('0x14')]);}else{logger[_0x74dc('0x15')](_0x74dc('0xd'),_0x534af2,'request\x20sent');_0x33caef(_0x51d48a[_0x74dc('0x16')]['message']);}})[_0x74dc('0x17')](function(_0x4f1a67){logger[_0x74dc('0x12')](_0x74dc('0xd'),_0x534af2,_0x4f1a67);_0x2a3c60(_0x4f1a67);});});}exports['GetFreshdeskAccount']=function(_0x45c9ca){var _0x213d1f=this;return new Promise(function(_0x51b720,_0x152ce0){return db[_0x74dc('0x18')][_0x74dc('0x19')]({'raw':_0x45c9ca[_0x74dc('0x1a')]?_0x45c9ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x45c9ca['options']?_0x45c9ca[_0x74dc('0x1a')]['where']||null:null,'attributes':_0x45c9ca['options']?_0x45c9ca[_0x74dc('0x1a')][_0x74dc('0x1b')]||null:null,'limit':_0x45c9ca[_0x74dc('0x1a')]?_0x45c9ca[_0x74dc('0x1a')][_0x74dc('0x1c')]||null:null,'include':_0x45c9ca[_0x74dc('0x1a')]?_0x45c9ca[_0x74dc('0x1a')][_0x74dc('0x1d')]?_['map'](_0x45c9ca['options'][_0x74dc('0x1d')],function(_0x33557c){return{'model':db[_0x33557c[_0x74dc('0x1e')]],'as':_0x33557c['as'],'attributes':_0x33557c[_0x74dc('0x1b')],'include':_0x33557c[_0x74dc('0x1d')]?_[_0x74dc('0x1f')](_0x33557c[_0x74dc('0x1d')],function(_0x2c3c8b){return{'model':db[_0x2c3c8b['model']],'as':_0x2c3c8b['as'],'attributes':_0x2c3c8b[_0x74dc('0x1b')],'include':_0x2c3c8b[_0x74dc('0x1d')]?_['map'](_0x2c3c8b[_0x74dc('0x1d')],function(_0x1c095e){return{'model':db[_0x1c095e[_0x74dc('0x1e')]],'as':_0x1c095e['as'],'attributes':_0x1c095e['attributes']};}):[]};}):[]};}):[]:[]})[_0x74dc('0xc')](function(_0x3dfbe4){logger[_0x74dc('0x15')]('GetFreshdeskAccount',_0x45c9ca);logger[_0x74dc('0xf')]('GetFreshdeskAccount',_0x45c9ca,JSON['stringify'](_0x3dfbe4));_0x51b720(_0x3dfbe4);})[_0x74dc('0x17')](function(_0x2d205e){logger[_0x74dc('0x12')](_0x74dc('0x20'),_0x2d205e['message'],_0x45c9ca);_0x152ce0(_0x213d1f[_0x74dc('0x12')](0x1f4,_0x2d205e[_0x74dc('0x14')]));});});};exports[_0x74dc('0x21')]=function(_0x5a71ad){var _0x1809ac=this;return new Promise(function(_0xfd5537,_0x20a971){return db['FreshdeskAccount'][_0x74dc('0x22')]({'raw':_0x5a71ad[_0x74dc('0x1a')]?_0x5a71ad[_0x74dc('0x1a')][_0x74dc('0x23')]===undefined?!![]:![]:!![],'where':_0x5a71ad[_0x74dc('0x1a')]?_0x5a71ad[_0x74dc('0x1a')][_0x74dc('0x24')]||null:null,'attributes':_0x5a71ad['options']?_0x5a71ad[_0x74dc('0x1a')][_0x74dc('0x1b')]||null:null,'include':_0x5a71ad[_0x74dc('0x1a')]?_0x5a71ad[_0x74dc('0x1a')][_0x74dc('0x1d')]?_[_0x74dc('0x1f')](_0x5a71ad[_0x74dc('0x1a')]['include'],function(_0x69a58){return{'model':db[_0x69a58[_0x74dc('0x1e')]],'as':_0x69a58['as'],'attributes':_0x69a58[_0x74dc('0x1b')],'include':_0x69a58[_0x74dc('0x1d')]?_[_0x74dc('0x1f')](_0x69a58[_0x74dc('0x1d')],function(_0x57ebda){return{'model':db[_0x57ebda['model']],'as':_0x57ebda['as'],'attributes':_0x57ebda['attributes'],'include':_0x57ebda[_0x74dc('0x1d')]?_[_0x74dc('0x1f')](_0x57ebda['include'],function(_0x47ebc2){return{'model':db[_0x47ebc2[_0x74dc('0x1e')]],'as':_0x47ebc2['as'],'attributes':_0x47ebc2[_0x74dc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x74dc('0xc')](function(_0x10f706){logger[_0x74dc('0x15')]('ShowFreshdeskAccount',_0x5a71ad);logger['debug'](_0x74dc('0x21'),_0x5a71ad,JSON[_0x74dc('0x11')](_0x10f706));_0xfd5537(_0x10f706);})[_0x74dc('0x17')](function(_0x3f3bd6){logger[_0x74dc('0x12')](_0x74dc('0x21'),_0x3f3bd6[_0x74dc('0x14')],_0x5a71ad);_0x20a971(_0x1809ac[_0x74dc('0x12')](0x1f4,_0x3f3bd6[_0x74dc('0x14')]));});});}; \ No newline at end of file +var _0xf278=['FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowFreshdeskAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x472754,_0x246c3e){var _0x590d84=function(_0x5b7a19){while(--_0x5b7a19){_0x472754['push'](_0x472754['shift']());}};_0x590d84(++_0x246c3e);}(_0xf278,0xc8));var _0x8f27=function(_0x507ef4,_0x4441f9){_0x507ef4=_0x507ef4-0x0;var _0x2c6986=_0xf278[_0x507ef4];return _0x2c6986;};'use strict';var _=require(_0x8f27('0x0'));var util=require(_0x8f27('0x1'));var moment=require(_0x8f27('0x2'));var BPromise=require(_0x8f27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f27('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f27('0x5'));var logger=require(_0x8f27('0x6'))(_0x8f27('0x7'));var config=require(_0x8f27('0x8'));var jayson=require(_0x8f27('0x9'));var client=jayson['client'][_0x8f27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bc2f0,_0x1af99b,_0x5273f5){return new BPromise(function(_0x17c68a,_0x526b36){return client['request'](_0x4bc2f0,_0x5273f5)[_0x8f27('0xb')](function(_0x316817){logger[_0x8f27('0xc')](_0x8f27('0xd'),_0x1af99b,_0x8f27('0xe'));logger[_0x8f27('0xf')](_0x8f27('0x10'),_0x1af99b,'request\x20sent',JSON['stringify'](_0x316817));if(_0x316817[_0x8f27('0x11')]){if(_0x316817[_0x8f27('0x11')][_0x8f27('0x12')]===0x1f4){logger[_0x8f27('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x1af99b,_0x316817[_0x8f27('0x11')][_0x8f27('0x13')]);return _0x526b36(_0x316817[_0x8f27('0x11')][_0x8f27('0x13')]);}logger[_0x8f27('0x11')](_0x8f27('0xd'),_0x1af99b,_0x316817[_0x8f27('0x11')][_0x8f27('0x13')]);return _0x17c68a(_0x316817[_0x8f27('0x11')][_0x8f27('0x13')]);}else{logger['info'](_0x8f27('0xd'),_0x1af99b,'request\x20sent');_0x17c68a(_0x316817[_0x8f27('0x14')]['message']);}})[_0x8f27('0x15')](function(_0x28c212){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x1af99b,_0x28c212);_0x526b36(_0x28c212);});});}exports[_0x8f27('0x16')]=function(_0x33fbca){var _0x14bdb7=this;return new Promise(function(_0xcff856,_0x14fe58){return db[_0x8f27('0x17')][_0x8f27('0x18')]({'raw':_0x33fbca[_0x8f27('0x19')]?_0x33fbca['options']['raw']===undefined?!![]:![]:!![],'where':_0x33fbca[_0x8f27('0x19')]?_0x33fbca[_0x8f27('0x19')][_0x8f27('0x1a')]||null:null,'attributes':_0x33fbca[_0x8f27('0x19')]?_0x33fbca[_0x8f27('0x19')][_0x8f27('0x1b')]||null:null,'limit':_0x33fbca[_0x8f27('0x19')]?_0x33fbca[_0x8f27('0x19')][_0x8f27('0x1c')]||null:null,'include':_0x33fbca[_0x8f27('0x19')]?_0x33fbca[_0x8f27('0x19')][_0x8f27('0x1d')]?_[_0x8f27('0x1e')](_0x33fbca[_0x8f27('0x19')][_0x8f27('0x1d')],function(_0x2b4ae6){return{'model':db[_0x2b4ae6['model']],'as':_0x2b4ae6['as'],'attributes':_0x2b4ae6[_0x8f27('0x1b')],'include':_0x2b4ae6[_0x8f27('0x1d')]?_['map'](_0x2b4ae6[_0x8f27('0x1d')],function(_0x21983c){return{'model':db[_0x21983c[_0x8f27('0x1f')]],'as':_0x21983c['as'],'attributes':_0x21983c['attributes'],'include':_0x21983c[_0x8f27('0x1d')]?_['map'](_0x21983c[_0x8f27('0x1d')],function(_0x35dbab){return{'model':db[_0x35dbab[_0x8f27('0x1f')]],'as':_0x35dbab['as'],'attributes':_0x35dbab[_0x8f27('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8f27('0xb')](function(_0x3129aa){logger[_0x8f27('0xc')]('GetFreshdeskAccount',_0x33fbca);logger[_0x8f27('0xf')](_0x8f27('0x16'),_0x33fbca,JSON[_0x8f27('0x20')](_0x3129aa));_0xcff856(_0x3129aa);})['catch'](function(_0x9773e2){logger[_0x8f27('0x11')]('GetFreshdeskAccount',_0x9773e2[_0x8f27('0x13')],_0x33fbca);_0x14fe58(_0x14bdb7[_0x8f27('0x11')](0x1f4,_0x9773e2[_0x8f27('0x13')]));});});};exports[_0x8f27('0x21')]=function(_0x1c279c){var _0x5ae266=this;return new Promise(function(_0xeee618,_0x113711){return db[_0x8f27('0x17')][_0x8f27('0x22')]({'raw':_0x1c279c[_0x8f27('0x19')]?_0x1c279c[_0x8f27('0x19')][_0x8f27('0x23')]===undefined?!![]:![]:!![],'where':_0x1c279c[_0x8f27('0x19')]?_0x1c279c[_0x8f27('0x19')][_0x8f27('0x1a')]||null:null,'attributes':_0x1c279c[_0x8f27('0x19')]?_0x1c279c['options'][_0x8f27('0x1b')]||null:null,'include':_0x1c279c[_0x8f27('0x19')]?_0x1c279c[_0x8f27('0x19')][_0x8f27('0x1d')]?_[_0x8f27('0x1e')](_0x1c279c[_0x8f27('0x19')]['include'],function(_0x10ab47){return{'model':db[_0x10ab47[_0x8f27('0x1f')]],'as':_0x10ab47['as'],'attributes':_0x10ab47[_0x8f27('0x1b')],'include':_0x10ab47[_0x8f27('0x1d')]?_[_0x8f27('0x1e')](_0x10ab47['include'],function(_0x2e5d88){return{'model':db[_0x2e5d88[_0x8f27('0x1f')]],'as':_0x2e5d88['as'],'attributes':_0x2e5d88[_0x8f27('0x1b')],'include':_0x2e5d88[_0x8f27('0x1d')]?_[_0x8f27('0x1e')](_0x2e5d88[_0x8f27('0x1d')],function(_0x255a6c){return{'model':db[_0x255a6c[_0x8f27('0x1f')]],'as':_0x255a6c['as'],'attributes':_0x255a6c[_0x8f27('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8f27('0xb')](function(_0x3489ca){logger[_0x8f27('0xc')](_0x8f27('0x21'),_0x1c279c);logger['debug'](_0x8f27('0x21'),_0x1c279c,JSON[_0x8f27('0x20')](_0x3489ca));_0xeee618(_0x3489ca);})[_0x8f27('0x15')](function(_0x52dbdb){logger['error'](_0x8f27('0x21'),_0x52dbdb['message'],_0x1c279c);_0x113711(_0x5ae266[_0x8f27('0x11')](0x1f4,_0x52dbdb[_0x8f27('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c8c95d6..cb27ff3 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 _0xd2b1=['getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','get','show','/:id/fields','getFields','/:id/subjects'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xd2b1,0x1aa));var _0x1d2b=function(_0x29acef,_0x3fa99b){_0x29acef=_0x29acef-0x0;var _0x66385d=_0xd2b1[_0x29acef];return _0x66385d;};'use strict';var multer=require(_0x1d2b('0x0'));var util=require(_0x1d2b('0x1'));var path=require('path');var timeout=require(_0x1d2b('0x2'));var express=require(_0x1d2b('0x3'));var router=express[_0x1d2b('0x4')]();var fs_extra=require(_0x1d2b('0x5'));var auth=require(_0x1d2b('0x6'));var interaction=require(_0x1d2b('0x7'));var config=require(_0x1d2b('0x8'));var controller=require(_0x1d2b('0x9'));router['get']('/',auth[_0x1d2b('0xa')](),controller['index']);router[_0x1d2b('0xb')]('/:id',auth[_0x1d2b('0xa')](),controller[_0x1d2b('0xc')]);router[_0x1d2b('0xb')](_0x1d2b('0xd'),auth[_0x1d2b('0xa')](),controller[_0x1d2b('0xe')]);router['get'](_0x1d2b('0xf'),auth[_0x1d2b('0xa')](),controller[_0x1d2b('0x10')]);router['get'](_0x1d2b('0x11'),auth[_0x1d2b('0xa')](),controller['getDescriptions']);router[_0x1d2b('0xb')](_0x1d2b('0x12'),auth[_0x1d2b('0xa')](),controller[_0x1d2b('0x13')]);router[_0x1d2b('0x14')]('/',auth['isAuthenticated'](),controller[_0x1d2b('0x15')]);router['post'](_0x1d2b('0x12'),auth[_0x1d2b('0xa')](),controller[_0x1d2b('0x16')]);router[_0x1d2b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x1d2b('0x18')]);router['delete']('/:id',auth[_0x1d2b('0xa')](),controller[_0x1d2b('0x19')]);module['exports']=router; \ No newline at end of file +var _0x69b2=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','/:id/tags','setTags','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','/:id/fields'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x69b2,0xfc));var _0x269b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x69b2[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x269b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x269b('0x1'));var express=require(_0x269b('0x2'));var router=express[_0x269b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x269b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x269b('0x5'));var controller=require(_0x269b('0x6'));router[_0x269b('0x7')]('/',auth['isAuthenticated'](),controller[_0x269b('0x8')]);router['get'](_0x269b('0x9'),auth['isAuthenticated'](),controller[_0x269b('0xa')]);router[_0x269b('0x7')](_0x269b('0xb'),auth[_0x269b('0xc')](),controller[_0x269b('0xd')]);router['get'](_0x269b('0xe'),auth[_0x269b('0xc')](),controller[_0x269b('0xf')]);router[_0x269b('0x7')](_0x269b('0x10'),auth['isAuthenticated'](),controller[_0x269b('0x11')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x269b('0xc')](),controller[_0x269b('0x12')]);router['post'](_0x269b('0x13'),auth['isAuthenticated'](),controller[_0x269b('0x14')]);router['put'](_0x269b('0x9'),auth[_0x269b('0xc')](),controller[_0x269b('0x15')]);router[_0x269b('0x16')](_0x269b('0x9'),auth[_0x269b('0xc')](),controller[_0x269b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c307297..8a52033 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 _0xa4ae=['exports','STRING'];(function(_0x40e412,_0x55f74d){var _0x4f2fb6=function(_0x36ca6f){while(--_0x36ca6f){_0x40e412['push'](_0x40e412['shift']());}};_0x4f2fb6(++_0x55f74d);}(_0xa4ae,0x12a));var _0xea4a=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0xa4ae[_0x44fef1];return _0x3c3a04;};'use strict';var Sequelize=require('sequelize');module[_0xea4a('0x0')]={'name':{'type':Sequelize[_0xea4a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf995=['sequelize','STRING'];(function(_0x3055a3,_0x5b7626){var _0x47d576=function(_0x423715){while(--_0x423715){_0x3055a3['push'](_0x3055a3['shift']());}};_0x47d576(++_0x5b7626);}(_0xf995,0x1f2));var _0x5f99=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf995[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x5f99('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f99('0x1')]},'description':{'type':Sequelize[_0x5f99('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index be44a22..afe3174 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 _0xd97b=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','rows','keys','rawAttributes','include','catch','create','body','find','params','getFields','findOne','order','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format'];(function(_0x27f8ab,_0x134841){var _0x508566=function(_0x3b819b){while(--_0x3b819b){_0x27f8ab['push'](_0x27f8ab['shift']());}};_0x508566(++_0x134841);}(_0xd97b,0x1ad));var _0xbd97=function(_0x12ad6b,_0x42b30f){_0x12ad6b=_0x12ad6b-0x0;var _0x287db6=_0xd97b[_0x12ad6b];return _0x287db6;};'use strict';var emlformat=require(_0xbd97('0x0'));var rimraf=require(_0xbd97('0x1'));var zipdir=require(_0xbd97('0x2'));var jsonpatch=require(_0xbd97('0x3'));var rp=require(_0xbd97('0x4'));var moment=require(_0xbd97('0x5'));var BPromise=require(_0xbd97('0x6'));var Mustache=require(_0xbd97('0x7'));var util=require(_0xbd97('0x8'));var path=require(_0xbd97('0x9'));var sox=require('sox');var csv=require(_0xbd97('0xa'));var ejs=require(_0xbd97('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd97('0xc'));var squel=require('squel');var crypto=require(_0xbd97('0xd'));var jsforce=require(_0xbd97('0xe'));var deskjs=require(_0xbd97('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbd97('0x10'));var Papa=require(_0xbd97('0x11'));var Redis=require(_0xbd97('0x12'));var authService=require(_0xbd97('0x13'));var qs=require(_0xbd97('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd97('0x15'));var logger=require(_0xbd97('0x16'))(_0xbd97('0x17'));var utils=require('../../config/utils');var config=require(_0xbd97('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd97('0x19'))['db'];function respondWithStatusCode(_0xb98d84,_0x1ed0bb){_0x1ed0bb=_0x1ed0bb||0xcc;return function(_0x3c658e){if(_0x3c658e){return _0xb98d84[_0xbd97('0x1a')](_0x1ed0bb);}return _0xb98d84[_0xbd97('0x1b')](_0x1ed0bb)[_0xbd97('0x1c')]();};}function respondWithResult(_0x3ef1c0,_0xc4b678){_0xc4b678=_0xc4b678||0xc8;return function(_0x1f1aa4){if(_0x1f1aa4){return _0x3ef1c0[_0xbd97('0x1b')](_0xc4b678)['json'](_0x1f1aa4);}};}function respondWithFilteredResult(_0x5ca70e,_0x608b6e){return function(_0xd83e7d){if(_0xd83e7d){var _0x180970=typeof _0x608b6e[_0xbd97('0x1d')]==='undefined'&&typeof _0x608b6e[_0xbd97('0x1e')]===_0xbd97('0x1f');var _0x5435c4=_0xd83e7d['count'];var _0x232e70=_0x180970?0x0:_0x608b6e['offset'];var _0x3b3211=_0x180970?_0xd83e7d[_0xbd97('0x20')]:_0x608b6e[_0xbd97('0x1d')]+_0x608b6e[_0xbd97('0x1e')];var _0x32f58c;if(_0x3b3211>=_0x5435c4){_0x3b3211=_0x5435c4;_0x32f58c=0xc8;}else{_0x32f58c=0xce;}_0x5ca70e[_0xbd97('0x1b')](_0x32f58c);return _0x5ca70e[_0xbd97('0x21')](_0xbd97('0x22'),_0x232e70+'-'+_0x3b3211+'/'+_0x5435c4)[_0xbd97('0x23')](_0xd83e7d);}return null;};}function patchUpdates(_0x3aaa0b){return function(_0x5efe18){try{jsonpatch[_0xbd97('0x24')](_0x5efe18,_0x3aaa0b,!![]);}catch(_0x3f5434){return BPromise[_0xbd97('0x25')](_0x3f5434);}return _0x5efe18['save']();};}function saveUpdates(_0x3c93da,_0x1e2919){return function(_0x293407){if(_0x293407){return _0x293407[_0xbd97('0x26')](_0x3c93da)['then'](function(_0x41870c){return _0x41870c;});}return null;};}function removeEntity(_0x4a9558,_0x23c2a8){return function(_0x2887ee){if(_0x2887ee){return _0x2887ee[_0xbd97('0x27')]()['then'](function(){_0x4a9558[_0xbd97('0x1b')](0xcc)[_0xbd97('0x1c')]();});}};}function handleEntityNotFound(_0x2ac5ca,_0x4dbe52){return function(_0x454161){if(!_0x454161){_0x2ac5ca[_0xbd97('0x1a')](0x194);}return _0x454161;};}function handleError(_0x22a3ff,_0x5d1255){_0x5d1255=_0x5d1255||0x1f4;return function(_0x1bc75f){logger[_0xbd97('0x28')](_0x1bc75f[_0xbd97('0x29')]);if(_0x1bc75f['name']){delete _0x1bc75f[_0xbd97('0x2a')];}_0x22a3ff[_0xbd97('0x1b')](_0x5d1255)[_0xbd97('0x2b')](_0x1bc75f);};}exports[_0xbd97('0x2c')]=function(_0x37de42,_0x16c6d0){var _0x4d9676={},_0x427d94={},_0x4f8534={'count':0x0,'rows':[]};var _0x391730=_[_0xbd97('0x2d')](db[_0xbd97('0x2e')]['rawAttributes'],function(_0xfd2128){return{'name':_0xfd2128[_0xbd97('0x2f')],'type':_0xfd2128[_0xbd97('0x30')][_0xbd97('0x31')]};});_0x427d94[_0xbd97('0x32')]=_[_0xbd97('0x2d')](_0x391730,_0xbd97('0x2a'));_0x427d94['query']=_['keys'](_0x37de42[_0xbd97('0x33')]);_0x427d94[_0xbd97('0x34')]=_[_0xbd97('0x35')](_0x427d94[_0xbd97('0x32')],_0x427d94['query']);_0x4d9676['attributes']=_[_0xbd97('0x35')](_0x427d94[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x37de42['query'][_0xbd97('0x36')]));_0x4d9676[_0xbd97('0x37')]=_0x4d9676[_0xbd97('0x37')][_0xbd97('0x38')]?_0x4d9676['attributes']:_0x427d94['model'];if(!_0x37de42[_0xbd97('0x33')][_0xbd97('0x39')](_0xbd97('0x3a'))){_0x4d9676[_0xbd97('0x1e')]=qs[_0xbd97('0x1e')](_0x37de42[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x4d9676[_0xbd97('0x1d')]=qs[_0xbd97('0x1d')](_0x37de42[_0xbd97('0x33')][_0xbd97('0x1d')]);}_0x4d9676['order']=qs[_0xbd97('0x3b')](_0x37de42['query'][_0xbd97('0x3b')]);_0x4d9676[_0xbd97('0x3c')]=qs['filters'](_[_0xbd97('0x3d')](_0x37de42[_0xbd97('0x33')],_0x427d94[_0xbd97('0x34')]),_0x391730);if(_0x37de42[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x4d9676[_0xbd97('0x3c')]=_['merge'](_0x4d9676['where'],{'$or':_[_0xbd97('0x2d')](_0x391730,function(_0x5b49f9){if(_0x5b49f9['type']!=='VIRTUAL'){var _0x3f94c9={};_0x3f94c9[_0x5b49f9[_0xbd97('0x2a')]]={'$like':'%'+_0x37de42['query'][_0xbd97('0x3e')]+'%'};return _0x3f94c9;}})});}_0x4d9676=_[_0xbd97('0x3f')]({},_0x4d9676,_0x37de42[_0xbd97('0x40')]);var _0xc76121={'where':_0x4d9676[_0xbd97('0x3c')]};return db[_0xbd97('0x2e')][_0xbd97('0x20')](_0xc76121)[_0xbd97('0x41')](function(_0x287824){_0x4f8534[_0xbd97('0x20')]=_0x287824;if(_0x37de42[_0xbd97('0x33')][_0xbd97('0x42')]){_0x4d9676['include']=[{'all':!![]}];}return db[_0xbd97('0x2e')]['findAll'](_0x4d9676);})['then'](function(_0x3f0ba5){_0x4f8534[_0xbd97('0x43')]=_0x3f0ba5;return _0x4f8534;})[_0xbd97('0x41')](respondWithFilteredResult(_0x16c6d0,_0x4d9676))['catch'](handleError(_0x16c6d0,null));};exports['show']=function(_0x49a091,_0x496012){var _0x500dd8={'raw':![],'where':{'id':_0x49a091['params']['id']}},_0x2b29e2={};_0x2b29e2[_0xbd97('0x32')]=_[_0xbd97('0x44')](db['FreshdeskConfiguration'][_0xbd97('0x45')]);_0x2b29e2[_0xbd97('0x33')]=_[_0xbd97('0x44')](_0x49a091[_0xbd97('0x33')]);_0x2b29e2[_0xbd97('0x34')]=_[_0xbd97('0x35')](_0x2b29e2['model'],_0x2b29e2[_0xbd97('0x33')]);_0x500dd8[_0xbd97('0x37')]=_['intersection'](_0x2b29e2[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x49a091['query']['fields']));_0x500dd8['attributes']=_0x500dd8[_0xbd97('0x37')][_0xbd97('0x38')]?_0x500dd8['attributes']:_0x2b29e2[_0xbd97('0x32')];if(_0x49a091[_0xbd97('0x33')][_0xbd97('0x42')]){_0x500dd8[_0xbd97('0x46')]=[{'all':!![]}];}_0x500dd8=_['merge']({},_0x500dd8,_0x49a091[_0xbd97('0x40')]);return db[_0xbd97('0x2e')]['find'](_0x500dd8)[_0xbd97('0x41')](handleEntityNotFound(_0x496012,null))[_0xbd97('0x41')](respondWithResult(_0x496012,null))[_0xbd97('0x47')](handleError(_0x496012,null));};exports[_0xbd97('0x48')]=function(_0x126ead,_0x1c5cc2){return db[_0xbd97('0x2e')][_0xbd97('0x48')](_0x126ead['body'],{})[_0xbd97('0x41')](respondWithResult(_0x1c5cc2,0xc9))['catch'](handleError(_0x1c5cc2,null));};exports['update']=function(_0x58192b,_0x22dcdc){if(_0x58192b[_0xbd97('0x49')]['id']){delete _0x58192b['body']['id'];}return db['FreshdeskConfiguration'][_0xbd97('0x4a')]({'where':{'id':_0x58192b[_0xbd97('0x4b')]['id']}})['then'](handleEntityNotFound(_0x22dcdc,null))[_0xbd97('0x41')](saveUpdates(_0x58192b['body'],null))[_0xbd97('0x41')](respondWithResult(_0x22dcdc,null))['catch'](handleError(_0x22dcdc,null));};exports[_0xbd97('0x27')]=function(_0xe7ed29,_0x57b170){return db[_0xbd97('0x2e')][_0xbd97('0x4a')]({'where':{'id':_0xe7ed29[_0xbd97('0x4b')]['id']}})[_0xbd97('0x41')](handleEntityNotFound(_0x57b170,null))['then'](removeEntity(_0x57b170,null))[_0xbd97('0x47')](handleError(_0x57b170,null));};exports[_0xbd97('0x4c')]=function(_0x40dea1,_0x58313a,_0x20961b){var _0x4996f4={};var _0x550672={};var _0x3e4a02;var _0x3c9ec8;return db[_0xbd97('0x2e')][_0xbd97('0x4d')]({'where':{'id':_0x40dea1[_0xbd97('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58313a,null))[_0xbd97('0x41')](function(_0x42caa2){if(_0x42caa2){_0x3e4a02=_0x42caa2;_0x550672[_0xbd97('0x32')]=_[_0xbd97('0x44')](db['FreshdeskField'][_0xbd97('0x45')]);_0x550672[_0xbd97('0x33')]=_[_0xbd97('0x44')](_0x40dea1[_0xbd97('0x33')]);_0x550672[_0xbd97('0x34')]=_['intersection'](_0x550672[_0xbd97('0x32')],_0x550672['query']);_0x4996f4[_0xbd97('0x37')]=_[_0xbd97('0x35')](_0x550672['model'],qs[_0xbd97('0x36')](_0x40dea1['query'][_0xbd97('0x36')]));_0x4996f4[_0xbd97('0x37')]=_0x4996f4[_0xbd97('0x37')][_0xbd97('0x38')]?_0x4996f4[_0xbd97('0x37')]:_0x550672[_0xbd97('0x32')];_0x4996f4[_0xbd97('0x4e')]=qs[_0xbd97('0x3b')](_0x40dea1['query'][_0xbd97('0x3b')]);_0x4996f4['where']=qs[_0xbd97('0x34')](_[_0xbd97('0x3d')](_0x40dea1[_0xbd97('0x33')],_0x550672['filters']));if(_0x40dea1[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x4996f4[_0xbd97('0x3c')]=_[_0xbd97('0x3f')](_0x4996f4[_0xbd97('0x3c')],{'$or':_[_0xbd97('0x2d')](_0x4996f4[_0xbd97('0x37')],function(_0x4cf671){var _0x425f91={};_0x425f91[_0x4cf671]={'$like':'%'+_0x40dea1[_0xbd97('0x33')][_0xbd97('0x3e')]+'%'};return _0x425f91;})});}_0x4996f4=_[_0xbd97('0x3f')]({},_0x4996f4,_0x40dea1[_0xbd97('0x40')]);return _0x3e4a02[_0xbd97('0x4c')](_0x4996f4);}})[_0xbd97('0x41')](function(_0x5762c5){if(_0x5762c5){_0x3c9ec8=_0x5762c5['length'];if(!_0x40dea1['query'][_0xbd97('0x39')](_0xbd97('0x3a'))){_0x4996f4[_0xbd97('0x1e')]=qs[_0xbd97('0x1e')](_0x40dea1[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x4996f4[_0xbd97('0x1d')]=qs[_0xbd97('0x1d')](_0x40dea1[_0xbd97('0x33')][_0xbd97('0x1d')]);}return _0x3e4a02[_0xbd97('0x4c')](_0x4996f4);}})[_0xbd97('0x41')](function(_0x357221){if(_0x357221){return _0x357221?{'count':_0x3c9ec8,'rows':_0x357221}:null;}})[_0xbd97('0x41')](respondWithResult(_0x58313a,null))[_0xbd97('0x47')](handleError(_0x58313a,null));};exports[_0xbd97('0x4f')]=function(_0x2f54eb,_0x1cd26a,_0x2f898a){var _0x5906f6={};var _0x176de0={};var _0xdebc90;var _0xa0c13b;return db['FreshdeskConfiguration'][_0xbd97('0x4d')]({'where':{'id':_0x2f54eb[_0xbd97('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1cd26a,null))[_0xbd97('0x41')](function(_0x270c84){if(_0x270c84){_0xdebc90=_0x270c84;_0x176de0[_0xbd97('0x32')]=_[_0xbd97('0x44')](db[_0xbd97('0x50')][_0xbd97('0x45')]);_0x176de0[_0xbd97('0x33')]=_[_0xbd97('0x44')](_0x2f54eb['query']);_0x176de0[_0xbd97('0x34')]=_['intersection'](_0x176de0['model'],_0x176de0['query']);_0x5906f6[_0xbd97('0x37')]=_[_0xbd97('0x35')](_0x176de0[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x36')]));_0x5906f6[_0xbd97('0x37')]=_0x5906f6[_0xbd97('0x37')][_0xbd97('0x38')]?_0x5906f6[_0xbd97('0x37')]:_0x176de0[_0xbd97('0x32')];_0x5906f6['order']=qs[_0xbd97('0x3b')](_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x3b')]);_0x5906f6[_0xbd97('0x3c')]=qs[_0xbd97('0x34')](_[_0xbd97('0x3d')](_0x2f54eb['query'],_0x176de0[_0xbd97('0x34')]));if(_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x5906f6['where']=_['merge'](_0x5906f6[_0xbd97('0x3c')],{'$or':_['map'](_0x5906f6['attributes'],function(_0x16ab9e){var _0x196606={};_0x196606[_0x16ab9e]={'$like':'%'+_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x3e')]+'%'};return _0x196606;})});}_0x5906f6=_[_0xbd97('0x3f')]({},_0x5906f6,_0x2f54eb['options']);return _0xdebc90['getSubjects'](_0x5906f6);}})[_0xbd97('0x41')](function(_0xca99c7){if(_0xca99c7){_0xa0c13b=_0xca99c7[_0xbd97('0x38')];if(!_0x2f54eb['query'][_0xbd97('0x39')]('nolimit')){_0x5906f6['limit']=qs[_0xbd97('0x1e')](_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x5906f6['offset']=qs[_0xbd97('0x1d')](_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x1d')]);}return _0xdebc90['getSubjects'](_0x5906f6);}})[_0xbd97('0x41')](function(_0x5aff27){if(_0x5aff27){return _0x5aff27?{'count':_0xa0c13b,'rows':_0x5aff27}:null;}})[_0xbd97('0x41')](respondWithResult(_0x1cd26a,null))['catch'](handleError(_0x1cd26a,null));};exports[_0xbd97('0x51')]=function(_0x38b21f,_0x127ffc,_0x1f0cea){var _0x57c629={};var _0x275de5={};var _0x3c5b43;var _0x37df70;return db[_0xbd97('0x2e')][_0xbd97('0x4d')]({'where':{'id':_0x38b21f[_0xbd97('0x4b')]['id']}})[_0xbd97('0x41')](handleEntityNotFound(_0x127ffc,null))[_0xbd97('0x41')](function(_0x31ce0d){if(_0x31ce0d){_0x3c5b43=_0x31ce0d;_0x275de5['model']=_[_0xbd97('0x44')](db[_0xbd97('0x50')][_0xbd97('0x45')]);_0x275de5['query']=_['keys'](_0x38b21f['query']);_0x275de5[_0xbd97('0x34')]=_[_0xbd97('0x35')](_0x275de5['model'],_0x275de5[_0xbd97('0x33')]);_0x57c629['attributes']=_[_0xbd97('0x35')](_0x275de5[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x38b21f[_0xbd97('0x33')][_0xbd97('0x36')]));_0x57c629[_0xbd97('0x37')]=_0x57c629[_0xbd97('0x37')][_0xbd97('0x38')]?_0x57c629[_0xbd97('0x37')]:_0x275de5[_0xbd97('0x32')];_0x57c629[_0xbd97('0x4e')]=qs[_0xbd97('0x3b')](_0x38b21f[_0xbd97('0x33')]['sort']);_0x57c629['where']=qs[_0xbd97('0x34')](_['pick'](_0x38b21f['query'],_0x275de5[_0xbd97('0x34')]));if(_0x38b21f[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x57c629[_0xbd97('0x3c')]=_['merge'](_0x57c629[_0xbd97('0x3c')],{'$or':_['map'](_0x57c629[_0xbd97('0x37')],function(_0x4e2b95){var _0x7fade0={};_0x7fade0[_0x4e2b95]={'$like':'%'+_0x38b21f[_0xbd97('0x33')][_0xbd97('0x3e')]+'%'};return _0x7fade0;})});}_0x57c629=_[_0xbd97('0x3f')]({},_0x57c629,_0x38b21f[_0xbd97('0x40')]);return _0x3c5b43['getDescriptions'](_0x57c629);}})['then'](function(_0x70c7a5){if(_0x70c7a5){_0x37df70=_0x70c7a5['length'];if(!_0x38b21f[_0xbd97('0x33')][_0xbd97('0x39')](_0xbd97('0x3a'))){_0x57c629[_0xbd97('0x1e')]=qs[_0xbd97('0x1e')](_0x38b21f[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x57c629['offset']=qs[_0xbd97('0x1d')](_0x38b21f[_0xbd97('0x33')][_0xbd97('0x1d')]);}return _0x3c5b43[_0xbd97('0x51')](_0x57c629);}})['then'](function(_0x289012){if(_0x289012){return _0x289012?{'count':_0x37df70,'rows':_0x289012}:null;}})[_0xbd97('0x41')](respondWithResult(_0x127ffc,null))[_0xbd97('0x47')](handleError(_0x127ffc,null));};exports[_0xbd97('0x52')]=function(_0x1d63ea,_0x2ff362,_0x22c1ee){var _0x2d189a={};var _0x4a41e8={};var _0x204e6d;var _0x216cc7;return db[_0xbd97('0x2e')][_0xbd97('0x4d')]({'where':{'id':_0x1d63ea[_0xbd97('0x4b')]['id']}})[_0xbd97('0x41')](handleEntityNotFound(_0x2ff362,null))[_0xbd97('0x41')](function(_0x12f803){if(_0x12f803){_0x204e6d=_0x12f803;_0x4a41e8[_0xbd97('0x32')]=_['keys'](db[_0xbd97('0x53')]['rawAttributes']);_0x4a41e8[_0xbd97('0x33')]=_[_0xbd97('0x44')](_0x1d63ea[_0xbd97('0x33')]);_0x4a41e8[_0xbd97('0x34')]=_[_0xbd97('0x35')](_0x4a41e8[_0xbd97('0x32')],_0x4a41e8['query']);_0x2d189a[_0xbd97('0x37')]=_[_0xbd97('0x35')](_0x4a41e8[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x1d63ea[_0xbd97('0x33')][_0xbd97('0x36')]));_0x2d189a[_0xbd97('0x37')]=_0x2d189a[_0xbd97('0x37')][_0xbd97('0x38')]?_0x2d189a[_0xbd97('0x37')]:_0x4a41e8[_0xbd97('0x32')];_0x2d189a[_0xbd97('0x4e')]=qs[_0xbd97('0x3b')](_0x1d63ea[_0xbd97('0x33')]['sort']);_0x2d189a['where']=qs[_0xbd97('0x34')](_[_0xbd97('0x3d')](_0x1d63ea[_0xbd97('0x33')],_0x4a41e8[_0xbd97('0x34')]));if(_0x1d63ea[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x2d189a['where']=_[_0xbd97('0x3f')](_0x2d189a['where'],{'$or':_[_0xbd97('0x2d')](_0x2d189a[_0xbd97('0x37')],function(_0x53485c){var _0x154cc4={};_0x154cc4[_0x53485c]={'$like':'%'+_0x1d63ea['query']['filter']+'%'};return _0x154cc4;})});}_0x2d189a=_[_0xbd97('0x3f')]({},_0x2d189a,_0x1d63ea[_0xbd97('0x40')]);return _0x204e6d['getTags'](_0x2d189a);}})[_0xbd97('0x41')](function(_0x844f6c){if(_0x844f6c){_0x216cc7=_0x844f6c[_0xbd97('0x38')];if(!_0x1d63ea[_0xbd97('0x33')]['hasOwnProperty']('nolimit')){_0x2d189a[_0xbd97('0x1e')]=qs['limit'](_0x1d63ea[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x2d189a[_0xbd97('0x1d')]=qs[_0xbd97('0x1d')](_0x1d63ea['query'][_0xbd97('0x1d')]);}return _0x204e6d['getTags'](_0x2d189a);}})[_0xbd97('0x41')](function(_0xa9e983){if(_0xa9e983){return _0xa9e983?{'count':_0x216cc7,'rows':_0xa9e983}:null;}})[_0xbd97('0x41')](respondWithResult(_0x2ff362,null))[_0xbd97('0x47')](handleError(_0x2ff362,null));};exports[_0xbd97('0x54')]=function(_0x437c89,_0x2cea8a,_0x39135c){if(_0x437c89[_0xbd97('0x49')]['id']){delete _0x437c89[_0xbd97('0x49')]['id'];}return db[_0xbd97('0x2e')][_0xbd97('0x4d')]({'where':{'id':_0x437c89[_0xbd97('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2cea8a,null))[_0xbd97('0x41')](function(_0x16aacb){if(_0x16aacb){return _0x16aacb[_0xbd97('0x54')](_0x437c89['body'][_0xbd97('0x55')]||[]);}return null;})[_0xbd97('0x41')](respondWithResult(_0x2cea8a,null))['catch'](handleError(_0x2cea8a,null));}; \ No newline at end of file +var _0x9f29=['update','then','destroy','sendStatus','error','stack','name','FreshdeskConfiguration','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','getFields','findOne','pick','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','save'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x9f29,0x155));var _0x99f2=function(_0x3019d4,_0x2a8b22){_0x3019d4=_0x3019d4-0x0;var _0x2351af=_0x9f29[_0x3019d4];return _0x2351af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99f2('0x1'));var rp=require(_0x99f2('0x2'));var moment=require(_0x99f2('0x3'));var BPromise=require(_0x99f2('0x4'));var Mustache=require('mustache');var util=require(_0x99f2('0x5'));var path=require(_0x99f2('0x6'));var sox=require(_0x99f2('0x7'));var csv=require(_0x99f2('0x8'));var ejs=require(_0x99f2('0x9'));var fs=require('fs');var fs_extra=require(_0x99f2('0xa'));var _=require(_0x99f2('0xb'));var squel=require(_0x99f2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99f2('0xd'));var toCsv=require(_0x99f2('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x99f2('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99f2('0xf'));var logger=require(_0x99f2('0x10'))(_0x99f2('0x11'));var utils=require(_0x99f2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x99f2('0x13'));var db=require(_0x99f2('0x14'))['db'];function respondWithStatusCode(_0x4435f9,_0x3f0444){_0x3f0444=_0x3f0444||0xcc;return function(_0x24f103){if(_0x24f103){return _0x4435f9['sendStatus'](_0x3f0444);}return _0x4435f9[_0x99f2('0x15')](_0x3f0444)[_0x99f2('0x16')]();};}function respondWithResult(_0x3a6d64,_0x4c131a){_0x4c131a=_0x4c131a||0xc8;return function(_0x5be7a2){if(_0x5be7a2){return _0x3a6d64[_0x99f2('0x15')](_0x4c131a)['json'](_0x5be7a2);}};}function respondWithFilteredResult(_0x4ac3a2,_0x474d39){return function(_0x3dfb0b){if(_0x3dfb0b){var _0x1866b3=typeof _0x474d39[_0x99f2('0x17')]===_0x99f2('0x18')&&typeof _0x474d39['limit']===_0x99f2('0x18');var _0x421766=_0x3dfb0b[_0x99f2('0x19')];var _0x1e5ff1=_0x1866b3?0x0:_0x474d39[_0x99f2('0x17')];var _0x347d8d=_0x1866b3?_0x3dfb0b[_0x99f2('0x19')]:_0x474d39[_0x99f2('0x17')]+_0x474d39[_0x99f2('0x1a')];var _0x484f1b;if(_0x347d8d>=_0x421766){_0x347d8d=_0x421766;_0x484f1b=0xc8;}else{_0x484f1b=0xce;}_0x4ac3a2[_0x99f2('0x15')](_0x484f1b);return _0x4ac3a2['set'](_0x99f2('0x1b'),_0x1e5ff1+'-'+_0x347d8d+'/'+_0x421766)['json'](_0x3dfb0b);}return null;};}function patchUpdates(_0x57974f){return function(_0x3af7a3){try{jsonpatch['apply'](_0x3af7a3,_0x57974f,!![]);}catch(_0xd8d553){return BPromise['reject'](_0xd8d553);}return _0x3af7a3[_0x99f2('0x1c')]();};}function saveUpdates(_0x154440,_0x1dd40b){return function(_0x2c957a){if(_0x2c957a){return _0x2c957a[_0x99f2('0x1d')](_0x154440)[_0x99f2('0x1e')](function(_0x4d1635){return _0x4d1635;});}return null;};}function removeEntity(_0x2f56e4,_0x1787d0){return function(_0x4f611a){if(_0x4f611a){return _0x4f611a[_0x99f2('0x1f')]()['then'](function(){_0x2f56e4['status'](0xcc)[_0x99f2('0x16')]();});}};}function handleEntityNotFound(_0x4e1c64,_0x4a2f30){return function(_0x472c21){if(!_0x472c21){_0x4e1c64[_0x99f2('0x20')](0x194);}return _0x472c21;};}function handleError(_0x14802d,_0x227152){_0x227152=_0x227152||0x1f4;return function(_0x1ca39b){logger[_0x99f2('0x21')](_0x1ca39b[_0x99f2('0x22')]);if(_0x1ca39b[_0x99f2('0x23')]){delete _0x1ca39b[_0x99f2('0x23')];}_0x14802d['status'](_0x227152)['send'](_0x1ca39b);};}exports['index']=function(_0x20a3db,_0x1ebaaf){var _0x4e0432={},_0x25702c={},_0x5d79a1={'count':0x0,'rows':[]};var _0x148dcc=_['map'](db[_0x99f2('0x24')][_0x99f2('0x25')],function(_0x490705){return{'name':_0x490705['fieldName'],'type':_0x490705[_0x99f2('0x26')]['key']};});_0x25702c[_0x99f2('0x27')]=_[_0x99f2('0x28')](_0x148dcc,_0x99f2('0x23'));_0x25702c['query']=_[_0x99f2('0x29')](_0x20a3db[_0x99f2('0x2a')]);_0x25702c[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x25702c[_0x99f2('0x27')],_0x25702c[_0x99f2('0x2a')]);_0x4e0432[_0x99f2('0x2d')]=_[_0x99f2('0x2c')](_0x25702c['model'],qs[_0x99f2('0x2e')](_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x2e')]));_0x4e0432[_0x99f2('0x2d')]=_0x4e0432[_0x99f2('0x2d')][_0x99f2('0x2f')]?_0x4e0432[_0x99f2('0x2d')]:_0x25702c[_0x99f2('0x27')];if(!_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x30')](_0x99f2('0x31'))){_0x4e0432[_0x99f2('0x1a')]=qs[_0x99f2('0x1a')](_0x20a3db[_0x99f2('0x2a')]['limit']);_0x4e0432['offset']=qs[_0x99f2('0x17')](_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x17')]);}_0x4e0432[_0x99f2('0x32')]=qs[_0x99f2('0x33')](_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x33')]);_0x4e0432[_0x99f2('0x34')]=qs['filters'](_['pick'](_0x20a3db[_0x99f2('0x2a')],_0x25702c['filters']),_0x148dcc);if(_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x35')]){_0x4e0432[_0x99f2('0x34')]=_[_0x99f2('0x36')](_0x4e0432[_0x99f2('0x34')],{'$or':_[_0x99f2('0x28')](_0x148dcc,function(_0x3a098c){if(_0x3a098c['type']!==_0x99f2('0x37')){var _0x220e9d={};_0x220e9d[_0x3a098c[_0x99f2('0x23')]]={'$like':'%'+_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x35')]+'%'};return _0x220e9d;}})});}_0x4e0432=_['merge']({},_0x4e0432,_0x20a3db['options']);var _0x1ada3b={'where':_0x4e0432['where']};return db[_0x99f2('0x24')][_0x99f2('0x19')](_0x1ada3b)[_0x99f2('0x1e')](function(_0x5d091e){_0x5d79a1[_0x99f2('0x19')]=_0x5d091e;if(_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x38')]){_0x4e0432[_0x99f2('0x39')]=[{'all':!![]}];}return db[_0x99f2('0x24')]['findAll'](_0x4e0432);})['then'](function(_0x31c410){_0x5d79a1['rows']=_0x31c410;return _0x5d79a1;})[_0x99f2('0x1e')](respondWithFilteredResult(_0x1ebaaf,_0x4e0432))[_0x99f2('0x3a')](handleError(_0x1ebaaf,null));};exports[_0x99f2('0x3b')]=function(_0x516192,_0x47535a){var _0x19e4df={'raw':![],'where':{'id':_0x516192[_0x99f2('0x3c')]['id']}},_0x3aba47={};_0x3aba47[_0x99f2('0x27')]=_[_0x99f2('0x29')](db[_0x99f2('0x24')]['rawAttributes']);_0x3aba47[_0x99f2('0x2a')]=_['keys'](_0x516192[_0x99f2('0x2a')]);_0x3aba47[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x3aba47[_0x99f2('0x27')],_0x3aba47[_0x99f2('0x2a')]);_0x19e4df[_0x99f2('0x2d')]=_[_0x99f2('0x2c')](_0x3aba47['model'],qs[_0x99f2('0x2e')](_0x516192[_0x99f2('0x2a')][_0x99f2('0x2e')]));_0x19e4df[_0x99f2('0x2d')]=_0x19e4df[_0x99f2('0x2d')][_0x99f2('0x2f')]?_0x19e4df['attributes']:_0x3aba47[_0x99f2('0x27')];if(_0x516192[_0x99f2('0x2a')]['includeAll']){_0x19e4df['include']=[{'all':!![]}];}_0x19e4df=_[_0x99f2('0x36')]({},_0x19e4df,_0x516192[_0x99f2('0x3d')]);return db[_0x99f2('0x24')][_0x99f2('0x3e')](_0x19e4df)[_0x99f2('0x1e')](handleEntityNotFound(_0x47535a,null))['then'](respondWithResult(_0x47535a,null))[_0x99f2('0x3a')](handleError(_0x47535a,null));};exports[_0x99f2('0x3f')]=function(_0x43f3a1,_0x3e90d3){return db[_0x99f2('0x24')][_0x99f2('0x3f')](_0x43f3a1['body'],{})[_0x99f2('0x1e')](respondWithResult(_0x3e90d3,0xc9))[_0x99f2('0x3a')](handleError(_0x3e90d3,null));};exports[_0x99f2('0x1d')]=function(_0x51b8e0,_0x2fde95){if(_0x51b8e0[_0x99f2('0x40')]['id']){delete _0x51b8e0[_0x99f2('0x40')]['id'];}return db[_0x99f2('0x24')][_0x99f2('0x3e')]({'where':{'id':_0x51b8e0[_0x99f2('0x3c')]['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x2fde95,null))[_0x99f2('0x1e')](saveUpdates(_0x51b8e0[_0x99f2('0x40')],null))[_0x99f2('0x1e')](respondWithResult(_0x2fde95,null))[_0x99f2('0x3a')](handleError(_0x2fde95,null));};exports[_0x99f2('0x1f')]=function(_0x2b12e5,_0x108ac3){return db[_0x99f2('0x24')][_0x99f2('0x3e')]({'where':{'id':_0x2b12e5[_0x99f2('0x3c')]['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x108ac3,null))['then'](removeEntity(_0x108ac3,null))['catch'](handleError(_0x108ac3,null));};exports[_0x99f2('0x41')]=function(_0x3bdac3,_0x43fd26,_0x32d02e){var _0x7206bf={};var _0x1172fd={};var _0x140c97;var _0x311412;return db[_0x99f2('0x24')][_0x99f2('0x42')]({'where':{'id':_0x3bdac3[_0x99f2('0x3c')]['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x43fd26,null))[_0x99f2('0x1e')](function(_0x4df7df){if(_0x4df7df){_0x140c97=_0x4df7df;_0x1172fd[_0x99f2('0x27')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x1172fd[_0x99f2('0x2a')]=_[_0x99f2('0x29')](_0x3bdac3[_0x99f2('0x2a')]);_0x1172fd[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x1172fd[_0x99f2('0x27')],_0x1172fd[_0x99f2('0x2a')]);_0x7206bf[_0x99f2('0x2d')]=_[_0x99f2('0x2c')](_0x1172fd[_0x99f2('0x27')],qs[_0x99f2('0x2e')](_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x2e')]));_0x7206bf[_0x99f2('0x2d')]=_0x7206bf[_0x99f2('0x2d')]['length']?_0x7206bf[_0x99f2('0x2d')]:_0x1172fd[_0x99f2('0x27')];_0x7206bf['order']=qs[_0x99f2('0x33')](_0x3bdac3['query']['sort']);_0x7206bf[_0x99f2('0x34')]=qs[_0x99f2('0x2b')](_[_0x99f2('0x43')](_0x3bdac3[_0x99f2('0x2a')],_0x1172fd[_0x99f2('0x2b')]));if(_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x35')]){_0x7206bf['where']=_[_0x99f2('0x36')](_0x7206bf[_0x99f2('0x34')],{'$or':_['map'](_0x7206bf[_0x99f2('0x2d')],function(_0x245c4d){var _0x543112={};_0x543112[_0x245c4d]={'$like':'%'+_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x35')]+'%'};return _0x543112;})});}_0x7206bf=_[_0x99f2('0x36')]({},_0x7206bf,_0x3bdac3[_0x99f2('0x3d')]);return _0x140c97['getFields'](_0x7206bf);}})[_0x99f2('0x1e')](function(_0x5d3a72){if(_0x5d3a72){_0x311412=_0x5d3a72[_0x99f2('0x2f')];if(!_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x30')](_0x99f2('0x31'))){_0x7206bf[_0x99f2('0x1a')]=qs[_0x99f2('0x1a')](_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x1a')]);_0x7206bf['offset']=qs[_0x99f2('0x17')](_0x3bdac3['query'][_0x99f2('0x17')]);}return _0x140c97['getFields'](_0x7206bf);}})[_0x99f2('0x1e')](function(_0x27adc8){if(_0x27adc8){return _0x27adc8?{'count':_0x311412,'rows':_0x27adc8}:null;}})[_0x99f2('0x1e')](respondWithResult(_0x43fd26,null))[_0x99f2('0x3a')](handleError(_0x43fd26,null));};exports[_0x99f2('0x44')]=function(_0x72e7a8,_0x169303,_0x7568d4){var _0xe58073={};var _0x373c35={};var _0x58c1f2;var _0x594b69;return db[_0x99f2('0x24')][_0x99f2('0x42')]({'where':{'id':_0x72e7a8[_0x99f2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x169303,null))[_0x99f2('0x1e')](function(_0x97974f){if(_0x97974f){_0x58c1f2=_0x97974f;_0x373c35[_0x99f2('0x27')]=_['keys'](db[_0x99f2('0x45')][_0x99f2('0x25')]);_0x373c35[_0x99f2('0x2a')]=_[_0x99f2('0x29')](_0x72e7a8[_0x99f2('0x2a')]);_0x373c35[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x373c35['model'],_0x373c35[_0x99f2('0x2a')]);_0xe58073[_0x99f2('0x2d')]=_[_0x99f2('0x2c')](_0x373c35[_0x99f2('0x27')],qs[_0x99f2('0x2e')](_0x72e7a8['query'][_0x99f2('0x2e')]));_0xe58073[_0x99f2('0x2d')]=_0xe58073[_0x99f2('0x2d')]['length']?_0xe58073[_0x99f2('0x2d')]:_0x373c35[_0x99f2('0x27')];_0xe58073['order']=qs[_0x99f2('0x33')](_0x72e7a8[_0x99f2('0x2a')][_0x99f2('0x33')]);_0xe58073[_0x99f2('0x34')]=qs[_0x99f2('0x2b')](_['pick'](_0x72e7a8[_0x99f2('0x2a')],_0x373c35[_0x99f2('0x2b')]));if(_0x72e7a8[_0x99f2('0x2a')][_0x99f2('0x35')]){_0xe58073[_0x99f2('0x34')]=_[_0x99f2('0x36')](_0xe58073['where'],{'$or':_[_0x99f2('0x28')](_0xe58073['attributes'],function(_0x36dd39){var _0x3ac6f7={};_0x3ac6f7[_0x36dd39]={'$like':'%'+_0x72e7a8[_0x99f2('0x2a')][_0x99f2('0x35')]+'%'};return _0x3ac6f7;})});}_0xe58073=_[_0x99f2('0x36')]({},_0xe58073,_0x72e7a8[_0x99f2('0x3d')]);return _0x58c1f2[_0x99f2('0x44')](_0xe58073);}})[_0x99f2('0x1e')](function(_0x534e98){if(_0x534e98){_0x594b69=_0x534e98[_0x99f2('0x2f')];if(!_0x72e7a8['query'][_0x99f2('0x30')](_0x99f2('0x31'))){_0xe58073['limit']=qs[_0x99f2('0x1a')](_0x72e7a8[_0x99f2('0x2a')]['limit']);_0xe58073[_0x99f2('0x17')]=qs[_0x99f2('0x17')](_0x72e7a8['query'][_0x99f2('0x17')]);}return _0x58c1f2[_0x99f2('0x44')](_0xe58073);}})[_0x99f2('0x1e')](function(_0xfc6272){if(_0xfc6272){return _0xfc6272?{'count':_0x594b69,'rows':_0xfc6272}:null;}})[_0x99f2('0x1e')](respondWithResult(_0x169303,null))[_0x99f2('0x3a')](handleError(_0x169303,null));};exports[_0x99f2('0x46')]=function(_0x226f0d,_0x18e21c,_0x5ec981){var _0x567787={};var _0x1cbc05={};var _0x39d872;var _0x280195;return db[_0x99f2('0x24')]['findOne']({'where':{'id':_0x226f0d[_0x99f2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x18e21c,null))[_0x99f2('0x1e')](function(_0x3d5816){if(_0x3d5816){_0x39d872=_0x3d5816;_0x1cbc05[_0x99f2('0x27')]=_[_0x99f2('0x29')](db[_0x99f2('0x45')][_0x99f2('0x25')]);_0x1cbc05[_0x99f2('0x2a')]=_[_0x99f2('0x29')](_0x226f0d[_0x99f2('0x2a')]);_0x1cbc05['filters']=_[_0x99f2('0x2c')](_0x1cbc05['model'],_0x1cbc05['query']);_0x567787['attributes']=_[_0x99f2('0x2c')](_0x1cbc05[_0x99f2('0x27')],qs['fields'](_0x226f0d[_0x99f2('0x2a')][_0x99f2('0x2e')]));_0x567787[_0x99f2('0x2d')]=_0x567787['attributes']['length']?_0x567787['attributes']:_0x1cbc05[_0x99f2('0x27')];_0x567787['order']=qs[_0x99f2('0x33')](_0x226f0d[_0x99f2('0x2a')][_0x99f2('0x33')]);_0x567787[_0x99f2('0x34')]=qs[_0x99f2('0x2b')](_['pick'](_0x226f0d[_0x99f2('0x2a')],_0x1cbc05[_0x99f2('0x2b')]));if(_0x226f0d['query'][_0x99f2('0x35')]){_0x567787['where']=_['merge'](_0x567787[_0x99f2('0x34')],{'$or':_[_0x99f2('0x28')](_0x567787[_0x99f2('0x2d')],function(_0x195656){var _0x3dca6f={};_0x3dca6f[_0x195656]={'$like':'%'+_0x226f0d[_0x99f2('0x2a')]['filter']+'%'};return _0x3dca6f;})});}_0x567787=_[_0x99f2('0x36')]({},_0x567787,_0x226f0d['options']);return _0x39d872['getDescriptions'](_0x567787);}})[_0x99f2('0x1e')](function(_0x1b9fdc){if(_0x1b9fdc){_0x280195=_0x1b9fdc[_0x99f2('0x2f')];if(!_0x226f0d[_0x99f2('0x2a')]['hasOwnProperty'](_0x99f2('0x31'))){_0x567787['limit']=qs[_0x99f2('0x1a')](_0x226f0d[_0x99f2('0x2a')][_0x99f2('0x1a')]);_0x567787[_0x99f2('0x17')]=qs[_0x99f2('0x17')](_0x226f0d['query']['offset']);}return _0x39d872[_0x99f2('0x46')](_0x567787);}})['then'](function(_0x502e4c){if(_0x502e4c){return _0x502e4c?{'count':_0x280195,'rows':_0x502e4c}:null;}})[_0x99f2('0x1e')](respondWithResult(_0x18e21c,null))[_0x99f2('0x3a')](handleError(_0x18e21c,null));};exports[_0x99f2('0x47')]=function(_0x2e4782,_0x1e1893,_0x1c311f){var _0x389d2d={};var _0x47a268={};var _0x30d4b8;var _0x5f3426;return db['FreshdeskConfiguration'][_0x99f2('0x42')]({'where':{'id':_0x2e4782[_0x99f2('0x3c')]['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x1e1893,null))[_0x99f2('0x1e')](function(_0x1417f1){if(_0x1417f1){_0x30d4b8=_0x1417f1;_0x47a268[_0x99f2('0x27')]=_[_0x99f2('0x29')](db[_0x99f2('0x48')][_0x99f2('0x25')]);_0x47a268[_0x99f2('0x2a')]=_[_0x99f2('0x29')](_0x2e4782[_0x99f2('0x2a')]);_0x47a268[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x47a268[_0x99f2('0x27')],_0x47a268['query']);_0x389d2d[_0x99f2('0x2d')]=_['intersection'](_0x47a268[_0x99f2('0x27')],qs[_0x99f2('0x2e')](_0x2e4782[_0x99f2('0x2a')]['fields']));_0x389d2d['attributes']=_0x389d2d[_0x99f2('0x2d')][_0x99f2('0x2f')]?_0x389d2d[_0x99f2('0x2d')]:_0x47a268[_0x99f2('0x27')];_0x389d2d[_0x99f2('0x32')]=qs[_0x99f2('0x33')](_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x33')]);_0x389d2d[_0x99f2('0x34')]=qs[_0x99f2('0x2b')](_['pick'](_0x2e4782[_0x99f2('0x2a')],_0x47a268[_0x99f2('0x2b')]));if(_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x35')]){_0x389d2d[_0x99f2('0x34')]=_[_0x99f2('0x36')](_0x389d2d[_0x99f2('0x34')],{'$or':_[_0x99f2('0x28')](_0x389d2d[_0x99f2('0x2d')],function(_0x152f81){var _0x5060e7={};_0x5060e7[_0x152f81]={'$like':'%'+_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x35')]+'%'};return _0x5060e7;})});}_0x389d2d=_[_0x99f2('0x36')]({},_0x389d2d,_0x2e4782['options']);return _0x30d4b8[_0x99f2('0x47')](_0x389d2d);}})[_0x99f2('0x1e')](function(_0x2abd81){if(_0x2abd81){_0x5f3426=_0x2abd81[_0x99f2('0x2f')];if(!_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x30')](_0x99f2('0x31'))){_0x389d2d[_0x99f2('0x1a')]=qs[_0x99f2('0x1a')](_0x2e4782['query']['limit']);_0x389d2d[_0x99f2('0x17')]=qs['offset'](_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x17')]);}return _0x30d4b8[_0x99f2('0x47')](_0x389d2d);}})[_0x99f2('0x1e')](function(_0x7326fc){if(_0x7326fc){return _0x7326fc?{'count':_0x5f3426,'rows':_0x7326fc}:null;}})[_0x99f2('0x1e')](respondWithResult(_0x1e1893,null))[_0x99f2('0x3a')](handleError(_0x1e1893,null));};exports['setTags']=function(_0x4bfb90,_0x158918,_0xbfb6b4){if(_0x4bfb90[_0x99f2('0x40')]['id']){delete _0x4bfb90[_0x99f2('0x40')]['id'];}return db['FreshdeskConfiguration'][_0x99f2('0x42')]({'where':{'id':_0x4bfb90['params']['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x158918,null))[_0x99f2('0x1e')](function(_0x4aefca){if(_0x4aefca){return _0x4aefca[_0x99f2('0x49')](_0x4bfb90[_0x99f2('0x40')]['ids']||[]);}return null;})[_0x99f2('0x1e')](respondWithResult(_0x158918,null))[_0x99f2('0x3a')](handleError(_0x158918,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8d2b891..1d233ff 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 _0xb97d=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1a7697,_0x469f4e){var _0x4d2dc8=function(_0x1f6849){while(--_0x1f6849){_0x1a7697['push'](_0x1a7697['shift']());}};_0x4d2dc8(++_0x469f4e);}(_0xb97d,0x115));var _0xdb97=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb97d[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xdb97('0x0'));var util=require(_0xdb97('0x1'));var logger=require(_0xdb97('0x2'))(_0xdb97('0x3'));var moment=require(_0xdb97('0x4'));var BPromise=require(_0xdb97('0x5'));var rp=require(_0xdb97('0x6'));var fs=require('fs');var path=require(_0xdb97('0x7'));var rimraf=require(_0xdb97('0x8'));var config=require(_0xdb97('0x9'));var attributes=require(_0xdb97('0xa'));module[_0xdb97('0xb')]=function(_0x3ee5bd,_0x1f14c4){return _0x3ee5bd['define'](_0xdb97('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ec7=['util','../../config/logger','moment','bluebird','request-promise','path','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x239b5a,_0x56199a){var _0x5a701c=function(_0x3cdf2d){while(--_0x3cdf2d){_0x239b5a['push'](_0x239b5a['shift']());}};_0x5a701c(++_0x56199a);}(_0x1ec7,0xaa));var _0x71ec=function(_0x29540a,_0x3ecbe0){_0x29540a=_0x29540a-0x0;var _0x332be5=_0x1ec7[_0x29540a];return _0x332be5;};'use strict';var _=require('lodash');var util=require(_0x71ec('0x0'));var logger=require(_0x71ec('0x1'))('api');var moment=require(_0x71ec('0x2'));var BPromise=require(_0x71ec('0x3'));var rp=require(_0x71ec('0x4'));var fs=require('fs');var path=require(_0x71ec('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71ec('0x6'));module[_0x71ec('0x7')]=function(_0x243896,_0x33d8ee){return _0x243896['define'](_0x71ec('0x8'),attributes,{'tableName':_0x71ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 392d561..370e91a 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 _0x3243=['client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x17093e,_0x4b3a88){var _0x49fb28=function(_0xc0afa3){while(--_0xc0afa3){_0x17093e['push'](_0x17093e['shift']());}};_0x49fb28(++_0x4b3a88);}(_0x3243,0x76));var _0x3324=function(_0x4aaf1e,_0x45f564){_0x4aaf1e=_0x4aaf1e-0x0;var _0x154c3=_0x3243[_0x4aaf1e];return _0x154c3;};'use strict';var _=require(_0x3324('0x0'));var util=require('util');var moment=require(_0x3324('0x1'));var BPromise=require(_0x3324('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3324('0x3'))['db'];var utils=require(_0x3324('0x4'));var logger=require(_0x3324('0x5'))(_0x3324('0x6'));var config=require('../../config/environment');var jayson=require(_0x3324('0x7'));var client=jayson[_0x3324('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2789,_0x5d6bac,_0x4068ed){return new BPromise(function(_0x97e09e,_0x9bd923){return client[_0x3324('0x9')](_0x1e2789,_0x4068ed)['then'](function(_0x2092f3){logger[_0x3324('0xa')](_0x3324('0xb'),_0x5d6bac,'request\x20sent');logger[_0x3324('0xc')](_0x3324('0xd'),_0x5d6bac,'request\x20sent',JSON[_0x3324('0xe')](_0x2092f3));if(_0x2092f3[_0x3324('0xf')]){if(_0x2092f3[_0x3324('0xf')][_0x3324('0x10')]===0x1f4){logger[_0x3324('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5d6bac,_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);return _0x9bd923(_0x2092f3[_0x3324('0xf')]['message']);}logger[_0x3324('0xf')](_0x3324('0xb'),_0x5d6bac,_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);return _0x97e09e(_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);}else{logger[_0x3324('0xa')](_0x3324('0xb'),_0x5d6bac,_0x3324('0x12'));_0x97e09e(_0x2092f3[_0x3324('0x13')][_0x3324('0x11')]);}})[_0x3324('0x14')](function(_0x90933a){logger[_0x3324('0xf')](_0x3324('0xb'),_0x5d6bac,_0x90933a);_0x9bd923(_0x90933a);});});} \ No newline at end of file +var _0xae59=['../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x42b32f,_0x40b58d){var _0x13d723=function(_0x452311){while(--_0x452311){_0x42b32f['push'](_0x42b32f['shift']());}};_0x13d723(++_0x40b58d);}(_0xae59,0xf1));var _0x9ae5=function(_0x469345,_0x521620){_0x469345=_0x469345-0x0;var _0x12a136=_0xae59[_0x469345];return _0x12a136;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ae5('0x0'));var BPromise=require(_0x9ae5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ae5('0x2'));var db=require(_0x9ae5('0x3'))['db'];var utils=require(_0x9ae5('0x4'));var logger=require(_0x9ae5('0x5'))('rpc');var config=require(_0x9ae5('0x6'));var jayson=require(_0x9ae5('0x7'));var client=jayson[_0x9ae5('0x8')][_0x9ae5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ca9dd,_0x4afeef,_0x2c8533){return new BPromise(function(_0x2f34b8,_0x45c82c){return client[_0x9ae5('0xa')](_0x2ca9dd,_0x2c8533)['then'](function(_0x1fbe29){logger[_0x9ae5('0xb')](_0x9ae5('0xc'),_0x4afeef,'request\x20sent');logger[_0x9ae5('0xd')](_0x9ae5('0xe'),_0x4afeef,_0x9ae5('0xf'),JSON[_0x9ae5('0x10')](_0x1fbe29));if(_0x1fbe29[_0x9ae5('0x11')]){if(_0x1fbe29[_0x9ae5('0x11')]['code']===0x1f4){logger[_0x9ae5('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4afeef,_0x1fbe29[_0x9ae5('0x11')]['message']);return _0x45c82c(_0x1fbe29[_0x9ae5('0x11')][_0x9ae5('0x12')]);}logger[_0x9ae5('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4afeef,_0x1fbe29[_0x9ae5('0x11')][_0x9ae5('0x12')]);return _0x2f34b8(_0x1fbe29['error'][_0x9ae5('0x12')]);}else{logger[_0x9ae5('0xb')](_0x9ae5('0xc'),_0x4afeef,_0x9ae5('0xf'));_0x2f34b8(_0x1fbe29['result'][_0x9ae5('0x12')]);}})['catch'](function(_0xbd9de3){logger[_0x9ae5('0x11')](_0x9ae5('0xc'),_0x4afeef,_0xbd9de3);_0x45c82c(_0xbd9de3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 078c742..6cc139c 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 _0xd7e7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','multer','path','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7e7,0xc8));var _0x7d7e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd7e7[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x7d7e('0x0'));var util=require('util');var path=require(_0x7d7e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7d7e('0x2')]();var fs_extra=require(_0x7d7e('0x3'));var auth=require(_0x7d7e('0x4'));var interaction=require(_0x7d7e('0x5'));var config=require(_0x7d7e('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x7d7e('0x7')]('/',auth[_0x7d7e('0x8')](),controller[_0x7d7e('0x9')]);router['get']('/:id',auth[_0x7d7e('0x8')](),controller[_0x7d7e('0xa')]);router[_0x7d7e('0xb')]('/',auth[_0x7d7e('0x8')](),controller[_0x7d7e('0xc')]);router[_0x7d7e('0xd')](_0x7d7e('0xe'),auth[_0x7d7e('0x8')](),controller[_0x7d7e('0xf')]);router['delete'](_0x7d7e('0xe'),auth[_0x7d7e('0x8')](),controller[_0x7d7e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7c4c=['show','post','create','put','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x7c4c,0xb9));var _0xc7c4=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x7c4c[_0x158f01];return _0x5ef74e;};'use strict';var multer=require('multer');var util=require(_0xc7c4('0x0'));var path=require(_0xc7c4('0x1'));var timeout=require(_0xc7c4('0x2'));var express=require('express');var router=express[_0xc7c4('0x3')]();var fs_extra=require(_0xc7c4('0x4'));var auth=require(_0xc7c4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc7c4('0x6'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0xc7c4('0x7')](),controller['index']);router[_0xc7c4('0x8')](_0xc7c4('0x9'),auth[_0xc7c4('0x7')](),controller[_0xc7c4('0xa')]);router[_0xc7c4('0xb')]('/',auth[_0xc7c4('0x7')](),controller[_0xc7c4('0xc')]);router[_0xc7c4('0xd')]('/:id',auth[_0xc7c4('0x7')](),controller['update']);router['delete'](_0xc7c4('0x9'),auth['isAuthenticated'](),controller[_0xc7c4('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index cf999f2..893ee22 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 _0xa038=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x3307de,_0x56060e){var _0x25bc40=function(_0x52baca){while(--_0x52baca){_0x3307de['push'](_0x3307de['shift']());}};_0x25bc40(++_0x56060e);}(_0xa038,0x1e1));var _0x8a03=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xa038[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0x8a03('0x0'));module[_0x8a03('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8a03('0x2'),_0x8a03('0x3'),_0x8a03('0x4'),_0x8a03('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8a03('0x6')]},'keyType':{'type':Sequelize[_0x8a03('0x7')]('string',_0x8a03('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x8a03('0x6')]},'idField':{'type':Sequelize[_0x8a03('0x6')]},'nameField':{'type':Sequelize[_0x8a03('0x6')]},'customField':{'type':Sequelize[_0x8a03('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a03('0x6')]}}; \ No newline at end of file +var _0x16e1=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x16e1,0x138));var _0x116e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x16e1[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0x116e('0x0')]={'type':{'type':Sequelize[_0x116e('0x1')](_0x116e('0x2'),_0x116e('0x3'),_0x116e('0x4'),_0x116e('0x5'),_0x116e('0x6')),'defaultValue':_0x116e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x116e('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x116e('0x2'),_0x116e('0x3'),_0x116e('0x4'))},'keyContent':{'type':Sequelize[_0x116e('0x7')]},'idField':{'type':Sequelize[_0x116e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x116e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x116e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index fb212ba..4de7f68 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 _0xb921=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','index','FreshdeskField','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x14e30d,_0x160848){var _0x260a59=function(_0x57eba5){while(--_0x57eba5){_0x14e30d['push'](_0x14e30d['shift']());}};_0x260a59(++_0x160848);}(_0xb921,0x16a));var _0x1b92=function(_0x4a73dd,_0x58e46c){_0x4a73dd=_0x4a73dd-0x0;var _0x279e6b=_0xb921[_0x4a73dd];return _0x279e6b;};'use strict';var emlformat=require(_0x1b92('0x0'));var rimraf=require(_0x1b92('0x1'));var zipdir=require(_0x1b92('0x2'));var jsonpatch=require(_0x1b92('0x3'));var rp=require(_0x1b92('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b92('0x5'));var util=require(_0x1b92('0x6'));var path=require(_0x1b92('0x7'));var sox=require(_0x1b92('0x8'));var csv=require(_0x1b92('0x9'));var ejs=require(_0x1b92('0xa'));var fs=require('fs');var fs_extra=require(_0x1b92('0xb'));var _=require(_0x1b92('0xc'));var squel=require(_0x1b92('0xd'));var crypto=require(_0x1b92('0xe'));var jsforce=require(_0x1b92('0xf'));var deskjs=require(_0x1b92('0x10'));var toCsv=require(_0x1b92('0x9'));var querystring=require(_0x1b92('0x11'));var Papa=require(_0x1b92('0x12'));var Redis=require('ioredis');var authService=require(_0x1b92('0x13'));var qs=require(_0x1b92('0x14'));var as=require(_0x1b92('0x15'));var hardwareService=require(_0x1b92('0x16'));var logger=require(_0x1b92('0x17'))(_0x1b92('0x18'));var utils=require(_0x1b92('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1b92('0x1a'));var db=require(_0x1b92('0x1b'))['db'];function respondWithStatusCode(_0x5a1ca5,_0x81cbe0){_0x81cbe0=_0x81cbe0||0xcc;return function(_0x29a7ed){if(_0x29a7ed){return _0x5a1ca5[_0x1b92('0x1c')](_0x81cbe0);}return _0x5a1ca5[_0x1b92('0x1d')](_0x81cbe0)[_0x1b92('0x1e')]();};}function respondWithResult(_0x290be6,_0x1d33bf){_0x1d33bf=_0x1d33bf||0xc8;return function(_0x4bbb76){if(_0x4bbb76){return _0x290be6[_0x1b92('0x1d')](_0x1d33bf)['json'](_0x4bbb76);}};}function respondWithFilteredResult(_0x1a559b,_0x511a97){return function(_0x694d4f){if(_0x694d4f){var _0x523285=typeof _0x511a97[_0x1b92('0x1f')]===_0x1b92('0x20')&&typeof _0x511a97[_0x1b92('0x21')]==='undefined';var _0x2d171f=_0x694d4f[_0x1b92('0x22')];var _0x289523=_0x523285?0x0:_0x511a97[_0x1b92('0x1f')];var _0x4368dc=_0x523285?_0x694d4f['count']:_0x511a97[_0x1b92('0x1f')]+_0x511a97[_0x1b92('0x21')];var _0x30b0d8;if(_0x4368dc>=_0x2d171f){_0x4368dc=_0x2d171f;_0x30b0d8=0xc8;}else{_0x30b0d8=0xce;}_0x1a559b['status'](_0x30b0d8);return _0x1a559b[_0x1b92('0x23')](_0x1b92('0x24'),_0x289523+'-'+_0x4368dc+'/'+_0x2d171f)[_0x1b92('0x25')](_0x694d4f);}return null;};}function patchUpdates(_0x4bfc51){return function(_0x1d9d28){try{jsonpatch['apply'](_0x1d9d28,_0x4bfc51,!![]);}catch(_0x39ef4e){return BPromise[_0x1b92('0x26')](_0x39ef4e);}return _0x1d9d28['save']();};}function saveUpdates(_0x4ea25f,_0x34c5c9){return function(_0x311487){if(_0x311487){return _0x311487[_0x1b92('0x27')](_0x4ea25f)[_0x1b92('0x28')](function(_0x41fc82){return _0x41fc82;});}return null;};}function removeEntity(_0x186030,_0x48cdf1){return function(_0x3be220){if(_0x3be220){return _0x3be220[_0x1b92('0x29')]()[_0x1b92('0x28')](function(){_0x186030[_0x1b92('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f0e1b,_0x53025e){return function(_0x4369e2){if(!_0x4369e2){_0x3f0e1b[_0x1b92('0x1c')](0x194);}return _0x4369e2;};}function handleError(_0x1abb9a,_0x3c1fa1){_0x3c1fa1=_0x3c1fa1||0x1f4;return function(_0x3e353){logger[_0x1b92('0x2a')](_0x3e353[_0x1b92('0x2b')]);if(_0x3e353[_0x1b92('0x2c')]){delete _0x3e353['name'];}_0x1abb9a['status'](_0x3c1fa1)['send'](_0x3e353);};}exports[_0x1b92('0x2d')]=function(_0x525d05,_0x2c4e02){var _0x5d006b={},_0x462949={},_0x4656aa={'count':0x0,'rows':[]};var _0x26f832=_['map'](db[_0x1b92('0x2e')][_0x1b92('0x2f')],function(_0x55eafd){return{'name':_0x55eafd['fieldName'],'type':_0x55eafd[_0x1b92('0x30')][_0x1b92('0x31')]};});_0x462949[_0x1b92('0x32')]=_[_0x1b92('0x33')](_0x26f832,_0x1b92('0x2c'));_0x462949['query']=_[_0x1b92('0x34')](_0x525d05[_0x1b92('0x35')]);_0x462949[_0x1b92('0x36')]=_[_0x1b92('0x37')](_0x462949[_0x1b92('0x32')],_0x462949[_0x1b92('0x35')]);_0x5d006b[_0x1b92('0x38')]=_['intersection'](_0x462949[_0x1b92('0x32')],qs[_0x1b92('0x39')](_0x525d05['query'][_0x1b92('0x39')]));_0x5d006b[_0x1b92('0x38')]=_0x5d006b[_0x1b92('0x38')]['length']?_0x5d006b[_0x1b92('0x38')]:_0x462949[_0x1b92('0x32')];if(!_0x525d05['query']['hasOwnProperty'](_0x1b92('0x3a'))){_0x5d006b[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x525d05[_0x1b92('0x35')]['limit']);_0x5d006b['offset']=qs['offset'](_0x525d05[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x5d006b[_0x1b92('0x3b')]=qs[_0x1b92('0x3c')](_0x525d05[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x5d006b[_0x1b92('0x3d')]=qs['filters'](_[_0x1b92('0x3e')](_0x525d05[_0x1b92('0x35')],_0x462949['filters']),_0x26f832);if(_0x525d05[_0x1b92('0x35')][_0x1b92('0x3f')]){_0x5d006b[_0x1b92('0x3d')]=_[_0x1b92('0x40')](_0x5d006b[_0x1b92('0x3d')],{'$or':_[_0x1b92('0x33')](_0x26f832,function(_0x115e5f){if(_0x115e5f[_0x1b92('0x30')]!==_0x1b92('0x41')){var _0x14571e={};_0x14571e[_0x115e5f['name']]={'$like':'%'+_0x525d05[_0x1b92('0x35')]['filter']+'%'};return _0x14571e;}})});}_0x5d006b=_[_0x1b92('0x40')]({},_0x5d006b,_0x525d05['options']);var _0x4589fb={'where':_0x5d006b[_0x1b92('0x3d')]};return db[_0x1b92('0x2e')][_0x1b92('0x22')](_0x4589fb)[_0x1b92('0x28')](function(_0x29cda5){_0x4656aa[_0x1b92('0x22')]=_0x29cda5;if(_0x525d05[_0x1b92('0x35')][_0x1b92('0x42')]){_0x5d006b['include']=[{'all':!![]}];}return db[_0x1b92('0x2e')]['findAll'](_0x5d006b);})[_0x1b92('0x28')](function(_0x1e945){_0x4656aa[_0x1b92('0x43')]=_0x1e945;return _0x4656aa;})[_0x1b92('0x28')](respondWithFilteredResult(_0x2c4e02,_0x5d006b))['catch'](handleError(_0x2c4e02,null));};exports[_0x1b92('0x44')]=function(_0xfb5b49,_0x133500){var _0x469a88={'raw':!![],'where':{'id':_0xfb5b49[_0x1b92('0x45')]['id']}},_0xd3f7b0={};_0xd3f7b0['model']=_[_0x1b92('0x34')](db[_0x1b92('0x2e')][_0x1b92('0x2f')]);_0xd3f7b0[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0xfb5b49[_0x1b92('0x35')]);_0xd3f7b0['filters']=_[_0x1b92('0x37')](_0xd3f7b0[_0x1b92('0x32')],_0xd3f7b0['query']);_0x469a88[_0x1b92('0x38')]=_['intersection'](_0xd3f7b0[_0x1b92('0x32')],qs[_0x1b92('0x39')](_0xfb5b49[_0x1b92('0x35')]['fields']));_0x469a88[_0x1b92('0x38')]=_0x469a88[_0x1b92('0x38')]['length']?_0x469a88['attributes']:_0xd3f7b0['model'];if(_0xfb5b49[_0x1b92('0x35')][_0x1b92('0x42')]){_0x469a88[_0x1b92('0x46')]=[{'all':!![]}];}_0x469a88=_[_0x1b92('0x40')]({},_0x469a88,_0xfb5b49[_0x1b92('0x47')]);return db[_0x1b92('0x2e')]['find'](_0x469a88)[_0x1b92('0x28')](handleEntityNotFound(_0x133500,null))[_0x1b92('0x28')](respondWithResult(_0x133500,null))['catch'](handleError(_0x133500,null));};exports[_0x1b92('0x48')]=function(_0x30dbb0,_0x121be9){return db['FreshdeskField'][_0x1b92('0x48')](_0x30dbb0[_0x1b92('0x49')],{})[_0x1b92('0x28')](respondWithResult(_0x121be9,0xc9))[_0x1b92('0x4a')](handleError(_0x121be9,null));};exports[_0x1b92('0x27')]=function(_0x5ac096,_0x142d28){if(_0x5ac096[_0x1b92('0x49')]['id']){delete _0x5ac096[_0x1b92('0x49')]['id'];}return db[_0x1b92('0x2e')][_0x1b92('0x4b')]({'where':{'id':_0x5ac096['params']['id']}})['then'](handleEntityNotFound(_0x142d28,null))[_0x1b92('0x28')](saveUpdates(_0x5ac096[_0x1b92('0x49')],null))[_0x1b92('0x28')](respondWithResult(_0x142d28,null))[_0x1b92('0x4a')](handleError(_0x142d28,null));};exports['destroy']=function(_0x4e0954,_0xfdae28){return db['FreshdeskField'][_0x1b92('0x4b')]({'where':{'id':_0x4e0954[_0x1b92('0x45')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0xfdae28,null))['then'](removeEntity(_0xfdae28,null))[_0x1b92('0x4a')](handleError(_0xfdae28,null));}; \ No newline at end of file +var _0x0eaa=['filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','FreshdeskField','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x20955b,_0x5c4c24){_0x20955b=_0x20955b-0x0;var _0xfe3f6a=_0x0eaa[_0x20955b];return _0xfe3f6a;};'use strict';var emlformat=require(_0xa0ea('0x0'));var rimraf=require(_0xa0ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0ea('0x2'));var moment=require(_0xa0ea('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa0ea('0x4'));var util=require(_0xa0ea('0x5'));var path=require(_0xa0ea('0x6'));var sox=require(_0xa0ea('0x7'));var csv=require(_0xa0ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0ea('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa0ea('0xa'));var jsforce=require(_0xa0ea('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa0ea('0xc'));var Papa=require(_0xa0ea('0xd'));var Redis=require(_0xa0ea('0xe'));var authService=require(_0xa0ea('0xf'));var qs=require(_0xa0ea('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0ea('0x11'));var logger=require(_0xa0ea('0x12'))(_0xa0ea('0x13'));var utils=require(_0xa0ea('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa0ea('0x15'));var db=require(_0xa0ea('0x16'))['db'];function respondWithStatusCode(_0x43b1b5,_0x41216c){_0x41216c=_0x41216c||0xcc;return function(_0x3eda1d){if(_0x3eda1d){return _0x43b1b5['sendStatus'](_0x41216c);}return _0x43b1b5[_0xa0ea('0x17')](_0x41216c)[_0xa0ea('0x18')]();};}function respondWithResult(_0x58c0fa,_0x3970e5){_0x3970e5=_0x3970e5||0xc8;return function(_0x183062){if(_0x183062){return _0x58c0fa[_0xa0ea('0x17')](_0x3970e5)[_0xa0ea('0x19')](_0x183062);}};}function respondWithFilteredResult(_0x4d7f34,_0x128680){return function(_0x67dc10){if(_0x67dc10){var _0x4274c2=typeof _0x128680[_0xa0ea('0x1a')]===_0xa0ea('0x1b')&&typeof _0x128680[_0xa0ea('0x1c')]===_0xa0ea('0x1b');var _0x324555=_0x67dc10[_0xa0ea('0x1d')];var _0x405f7f=_0x4274c2?0x0:_0x128680['offset'];var _0x4ca082=_0x4274c2?_0x67dc10[_0xa0ea('0x1d')]:_0x128680[_0xa0ea('0x1a')]+_0x128680[_0xa0ea('0x1c')];var _0x1887c3;if(_0x4ca082>=_0x324555){_0x4ca082=_0x324555;_0x1887c3=0xc8;}else{_0x1887c3=0xce;}_0x4d7f34[_0xa0ea('0x17')](_0x1887c3);return _0x4d7f34[_0xa0ea('0x1e')](_0xa0ea('0x1f'),_0x405f7f+'-'+_0x4ca082+'/'+_0x324555)['json'](_0x67dc10);}return null;};}function patchUpdates(_0x916f1){return function(_0x2f8518){try{jsonpatch[_0xa0ea('0x20')](_0x2f8518,_0x916f1,!![]);}catch(_0x592dec){return BPromise[_0xa0ea('0x21')](_0x592dec);}return _0x2f8518[_0xa0ea('0x22')]();};}function saveUpdates(_0x45fda4,_0x12cda2){return function(_0x2b5af5){if(_0x2b5af5){return _0x2b5af5[_0xa0ea('0x23')](_0x45fda4)['then'](function(_0x35faa4){return _0x35faa4;});}return null;};}function removeEntity(_0x5c0ec3,_0x4d494e){return function(_0x259175){if(_0x259175){return _0x259175[_0xa0ea('0x24')]()[_0xa0ea('0x25')](function(){_0x5c0ec3['status'](0xcc)[_0xa0ea('0x18')]();});}};}function handleEntityNotFound(_0x5d2d73,_0x391951){return function(_0x51cfbd){if(!_0x51cfbd){_0x5d2d73[_0xa0ea('0x26')](0x194);}return _0x51cfbd;};}function handleError(_0x26b6f1,_0x35c247){_0x35c247=_0x35c247||0x1f4;return function(_0x3b4e62){logger[_0xa0ea('0x27')](_0x3b4e62[_0xa0ea('0x28')]);if(_0x3b4e62[_0xa0ea('0x29')]){delete _0x3b4e62[_0xa0ea('0x29')];}_0x26b6f1['status'](_0x35c247)[_0xa0ea('0x2a')](_0x3b4e62);};}exports['index']=function(_0x21640c,_0xc3cd24){var _0x1ee6ff={},_0x705022={},_0x389050={'count':0x0,'rows':[]};var _0x129130=_['map'](db[_0xa0ea('0x2b')]['rawAttributes'],function(_0x210ce3){return{'name':_0x210ce3['fieldName'],'type':_0x210ce3[_0xa0ea('0x2c')][_0xa0ea('0x2d')]};});_0x705022[_0xa0ea('0x2e')]=_['map'](_0x129130,_0xa0ea('0x29'));_0x705022[_0xa0ea('0x2f')]=_['keys'](_0x21640c[_0xa0ea('0x2f')]);_0x705022[_0xa0ea('0x30')]=_[_0xa0ea('0x31')](_0x705022['model'],_0x705022['query']);_0x1ee6ff[_0xa0ea('0x32')]=_[_0xa0ea('0x31')](_0x705022[_0xa0ea('0x2e')],qs['fields'](_0x21640c[_0xa0ea('0x2f')][_0xa0ea('0x33')]));_0x1ee6ff[_0xa0ea('0x32')]=_0x1ee6ff[_0xa0ea('0x32')][_0xa0ea('0x34')]?_0x1ee6ff['attributes']:_0x705022['model'];if(!_0x21640c[_0xa0ea('0x2f')]['hasOwnProperty'](_0xa0ea('0x35'))){_0x1ee6ff[_0xa0ea('0x1c')]=qs[_0xa0ea('0x1c')](_0x21640c[_0xa0ea('0x2f')][_0xa0ea('0x1c')]);_0x1ee6ff['offset']=qs[_0xa0ea('0x1a')](_0x21640c[_0xa0ea('0x2f')][_0xa0ea('0x1a')]);}_0x1ee6ff[_0xa0ea('0x36')]=qs[_0xa0ea('0x37')](_0x21640c[_0xa0ea('0x2f')][_0xa0ea('0x37')]);_0x1ee6ff[_0xa0ea('0x38')]=qs[_0xa0ea('0x30')](_[_0xa0ea('0x39')](_0x21640c['query'],_0x705022[_0xa0ea('0x30')]),_0x129130);if(_0x21640c['query'][_0xa0ea('0x3a')]){_0x1ee6ff['where']=_[_0xa0ea('0x3b')](_0x1ee6ff['where'],{'$or':_[_0xa0ea('0x3c')](_0x129130,function(_0x2a6aff){if(_0x2a6aff[_0xa0ea('0x2c')]!==_0xa0ea('0x3d')){var _0x4b6d57={};_0x4b6d57[_0x2a6aff[_0xa0ea('0x29')]]={'$like':'%'+_0x21640c[_0xa0ea('0x2f')][_0xa0ea('0x3a')]+'%'};return _0x4b6d57;}})});}_0x1ee6ff=_[_0xa0ea('0x3b')]({},_0x1ee6ff,_0x21640c[_0xa0ea('0x3e')]);var _0x396d61={'where':_0x1ee6ff[_0xa0ea('0x38')]};return db[_0xa0ea('0x2b')][_0xa0ea('0x1d')](_0x396d61)['then'](function(_0x26afe5){_0x389050['count']=_0x26afe5;if(_0x21640c[_0xa0ea('0x2f')][_0xa0ea('0x3f')]){_0x1ee6ff[_0xa0ea('0x40')]=[{'all':!![]}];}return db[_0xa0ea('0x2b')][_0xa0ea('0x41')](_0x1ee6ff);})[_0xa0ea('0x25')](function(_0x209081){_0x389050[_0xa0ea('0x42')]=_0x209081;return _0x389050;})[_0xa0ea('0x25')](respondWithFilteredResult(_0xc3cd24,_0x1ee6ff))[_0xa0ea('0x43')](handleError(_0xc3cd24,null));};exports[_0xa0ea('0x44')]=function(_0x3c32fd,_0x20e580){var _0x37e38b={'raw':!![],'where':{'id':_0x3c32fd['params']['id']}},_0x3139ad={};_0x3139ad[_0xa0ea('0x2e')]=_['keys'](db[_0xa0ea('0x2b')]['rawAttributes']);_0x3139ad['query']=_['keys'](_0x3c32fd['query']);_0x3139ad[_0xa0ea('0x30')]=_[_0xa0ea('0x31')](_0x3139ad['model'],_0x3139ad[_0xa0ea('0x2f')]);_0x37e38b[_0xa0ea('0x32')]=_[_0xa0ea('0x31')](_0x3139ad['model'],qs['fields'](_0x3c32fd['query'][_0xa0ea('0x33')]));_0x37e38b[_0xa0ea('0x32')]=_0x37e38b[_0xa0ea('0x32')][_0xa0ea('0x34')]?_0x37e38b[_0xa0ea('0x32')]:_0x3139ad[_0xa0ea('0x2e')];if(_0x3c32fd[_0xa0ea('0x2f')][_0xa0ea('0x3f')]){_0x37e38b[_0xa0ea('0x40')]=[{'all':!![]}];}_0x37e38b=_[_0xa0ea('0x3b')]({},_0x37e38b,_0x3c32fd[_0xa0ea('0x3e')]);return db[_0xa0ea('0x2b')]['find'](_0x37e38b)[_0xa0ea('0x25')](handleEntityNotFound(_0x20e580,null))[_0xa0ea('0x25')](respondWithResult(_0x20e580,null))[_0xa0ea('0x43')](handleError(_0x20e580,null));};exports[_0xa0ea('0x45')]=function(_0x4f4f3e,_0x482601){return db[_0xa0ea('0x2b')][_0xa0ea('0x45')](_0x4f4f3e[_0xa0ea('0x46')],{})[_0xa0ea('0x25')](respondWithResult(_0x482601,0xc9))[_0xa0ea('0x43')](handleError(_0x482601,null));};exports[_0xa0ea('0x23')]=function(_0x219540,_0x361210){if(_0x219540[_0xa0ea('0x46')]['id']){delete _0x219540[_0xa0ea('0x46')]['id'];}return db['FreshdeskField'][_0xa0ea('0x47')]({'where':{'id':_0x219540[_0xa0ea('0x48')]['id']}})[_0xa0ea('0x25')](handleEntityNotFound(_0x361210,null))[_0xa0ea('0x25')](saveUpdates(_0x219540[_0xa0ea('0x46')],null))[_0xa0ea('0x25')](respondWithResult(_0x361210,null))[_0xa0ea('0x43')](handleError(_0x361210,null));};exports['destroy']=function(_0x140155,_0x176f68){return db['FreshdeskField'][_0xa0ea('0x47')]({'where':{'id':_0x140155['params']['id']}})[_0xa0ea('0x25')](handleEntityNotFound(_0x176f68,null))[_0xa0ea('0x25')](removeEntity(_0x176f68,null))[_0xa0ea('0x43')](handleError(_0x176f68,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index acbcc6e..3d59f18 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 _0xfe52=['FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x11bf1d,_0xec50a7){var _0x4955e3=function(_0x51edb0){while(--_0x51edb0){_0x11bf1d['push'](_0x11bf1d['shift']());}};_0x4955e3(++_0xec50a7);}(_0xfe52,0x1a8));var _0x2fe5=function(_0x1b919f,_0xec3f28){_0x1b919f=_0x1b919f-0x0;var _0x4c8244=_0xfe52[_0x1b919f];return _0x4c8244;};'use strict';var _=require(_0x2fe5('0x0'));var util=require(_0x2fe5('0x1'));var logger=require(_0x2fe5('0x2'))('api');var moment=require(_0x2fe5('0x3'));var BPromise=require('bluebird');var rp=require(_0x2fe5('0x4'));var fs=require('fs');var path=require(_0x2fe5('0x5'));var rimraf=require(_0x2fe5('0x6'));var config=require(_0x2fe5('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x2fe5('0x8')]=function(_0x2251ef,_0x1e24e7){return _0x2251ef[_0x2fe5('0x9')](_0x2fe5('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2fe5('0xb'),'fields':[_0x2fe5('0xc'),_0x2fe5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bdb=['FieldId','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','idField'];(function(_0x4cc588,_0x4a9bc4){var _0x36619d=function(_0x12ee64){while(--_0x12ee64){_0x4cc588['push'](_0x4cc588['shift']());}};_0x36619d(++_0x4a9bc4);}(_0x2bdb,0x105));var _0xb2bd=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0x2bdb[_0x2649e2];return _0x4797d4;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var logger=require(_0xb2bd('0x1'))('api');var moment=require(_0xb2bd('0x2'));var BPromise=require(_0xb2bd('0x3'));var rp=require(_0xb2bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var attributes=require(_0xb2bd('0x7'));module[_0xb2bd('0x8')]=function(_0x461137,_0x2ef40b){return _0x461137[_0xb2bd('0x9')]('FreshdeskField',attributes,{'tableName':_0xb2bd('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xb2bd('0xb'),_0xb2bd('0xc')],'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 d7bb344..10545c6 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 _0xd37a=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3ac733,_0x23e93b){var _0xdf68e1=function(_0x3df2fd){while(--_0x3df2fd){_0x3ac733['push'](_0x3ac733['shift']());}};_0xdf68e1(++_0x23e93b);}(_0xd37a,0x157));var _0xad37=function(_0x310994,_0x22016d){_0x310994=_0x310994-0x0;var _0x323e1b=_0xd37a[_0x310994];return _0x323e1b;};'use strict';var _=require(_0xad37('0x0'));var util=require(_0xad37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xad37('0x2'));var fs=require('fs');var Redis=require(_0xad37('0x3'));var db=require(_0xad37('0x4'))['db'];var utils=require(_0xad37('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xad37('0x6'));var jayson=require(_0xad37('0x7'));var client=jayson['client'][_0xad37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x128deb,_0x240f9c,_0x526be3){return new BPromise(function(_0x364685,_0x5b4b2b){return client['request'](_0x128deb,_0x526be3)['then'](function(_0x5017bc){logger[_0xad37('0x9')](_0xad37('0xa'),_0x240f9c,_0xad37('0xb'));logger[_0xad37('0xc')](_0xad37('0xd'),_0x240f9c,'request\x20sent',JSON[_0xad37('0xe')](_0x5017bc));if(_0x5017bc[_0xad37('0xf')]){if(_0x5017bc['error']['code']===0x1f4){logger[_0xad37('0xf')](_0xad37('0xa'),_0x240f9c,_0x5017bc[_0xad37('0xf')][_0xad37('0x10')]);return _0x5b4b2b(_0x5017bc[_0xad37('0xf')][_0xad37('0x10')]);}logger[_0xad37('0xf')](_0xad37('0xa'),_0x240f9c,_0x5017bc[_0xad37('0xf')][_0xad37('0x10')]);return _0x364685(_0x5017bc[_0xad37('0xf')][_0xad37('0x10')]);}else{logger[_0xad37('0x9')](_0xad37('0xa'),_0x240f9c,_0xad37('0xb'));_0x364685(_0x5017bc[_0xad37('0x11')][_0xad37('0x10')]);}})[_0xad37('0x12')](function(_0xe6fe8f){logger['error'](_0xad37('0xa'),_0x240f9c,_0xe6fe8f);_0x5b4b2b(_0xe6fe8f);});});} \ No newline at end of file +var _0x7992=['error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xec0ba3,_0x412d84){var _0x194af9=function(_0x3deb36){while(--_0x3deb36){_0xec0ba3['push'](_0xec0ba3['shift']());}};_0x194af9(++_0x412d84);}(_0x7992,0x1a9));var _0x2799=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x7992[_0x3f55de];return _0x2698de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2799('0x0'));var BPromise=require('bluebird');var rs=require(_0x2799('0x1'));var fs=require('fs');var Redis=require(_0x2799('0x2'));var db=require(_0x2799('0x3'))['db'];var utils=require(_0x2799('0x4'));var logger=require(_0x2799('0x5'))(_0x2799('0x6'));var config=require('../../config/environment');var jayson=require(_0x2799('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43aa66,_0x1e342c,_0x2ec84a){return new BPromise(function(_0x4deb33,_0x175004){return client[_0x2799('0x8')](_0x43aa66,_0x2ec84a)['then'](function(_0x548122){logger[_0x2799('0x9')](_0x2799('0xa'),_0x1e342c,_0x2799('0xb'));logger[_0x2799('0xc')](_0x2799('0xd'),_0x1e342c,_0x2799('0xb'),JSON[_0x2799('0xe')](_0x548122));if(_0x548122['error']){if(_0x548122[_0x2799('0xf')][_0x2799('0x10')]===0x1f4){logger[_0x2799('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x1e342c,_0x548122[_0x2799('0xf')][_0x2799('0x11')]);return _0x175004(_0x548122['error'][_0x2799('0x11')]);}logger[_0x2799('0xf')](_0x2799('0xa'),_0x1e342c,_0x548122[_0x2799('0xf')]['message']);return _0x4deb33(_0x548122[_0x2799('0xf')][_0x2799('0x11')]);}else{logger[_0x2799('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x1e342c,_0x2799('0xb'));_0x4deb33(_0x548122[_0x2799('0x12')][_0x2799('0x11')]);}})[_0x2799('0x13')](function(_0x4a99b5){logger[_0x2799('0xf')](_0x2799('0xa'),_0x1e342c,_0x4a99b5);_0x175004(_0x4a99b5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 7f99a2d..69ab73c 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 _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','destroy','path','connect-timeout','express','fs-extra'];(function(_0x162f48,_0x5b20ee){var _0x31f414=function(_0x1f86f3){while(--_0x1f86f3){_0x162f48['push'](_0x162f48['shift']());}};_0x31f414(++_0x5b20ee);}(_0x4522,0x1a0));var _0x2452=function(_0x1911a4,_0x445fb6){_0x1911a4=_0x1911a4-0x0;var _0x4447b2=_0x4522[_0x1911a4];return _0x4447b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['get']('/:id/fields',auth[_0x2452('0x9')](),controller['getFields']);router['post']('/',auth[_0x2452('0x9')](),controller[_0x2452('0xf')]);router[_0x2452('0x10')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x11')]);router[_0x2452('0x12')](_0x2452('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2452('0xb'),auth['isAuthenticated'](),controller[_0x2452('0x13')]);module['exports']=router; \ No newline at end of file +var _0xae60=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x44dbd0,_0x2cae97){var _0x4ea7ed=function(_0x2a8122){while(--_0x2a8122){_0x44dbd0['push'](_0x44dbd0['shift']());}};_0x4ea7ed(++_0x2cae97);}(_0xae60,0x1c7));var _0x0ae6=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xae60[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var fs_extra=require(_0x0ae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x0ae6('0x8')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xa')]);router[_0x0ae6('0x8')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0x8')]('/:id/configurations',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x8')](_0x0ae6('0xe'),auth['isAuthenticated'](),controller[_0x0ae6('0xf')]);router[_0x0ae6('0x10')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x11')]);router[_0x0ae6('0x10')](_0x0ae6('0x12'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x13')]);router[_0x0ae6('0x14')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x15')]);router[_0x0ae6('0x16')](_0x0ae6('0xb'),auth['isAuthenticated'](),controller[_0x0ae6('0x17')]);module[_0x0ae6('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 67df964..9f358db 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 _0x1c9a=['sequelize','STRING','username','remoteUri'];(function(_0x2131ee,_0xc8ad4a){var _0x5e3c9c=function(_0x8289c5){while(--_0x8289c5){_0x2131ee['push'](_0x2131ee['shift']());}};_0x5e3c9c(++_0xc8ad4a);}(_0x1c9a,0x98));var _0xa1c9=function(_0x2400be,_0x1ec945){_0x2400be=_0x2400be-0x0;var _0x2deba9=_0x1c9a[_0x2400be];return _0x2deba9;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c9('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa1c9('0x1')],'unique':_0xa1c9('0x2')},'apiKey':{'type':Sequelize[_0xa1c9('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa1c9('0x3')},'serverUrl':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2272=['sequelize','exports','STRING','remoteUri'];(function(_0x5b406e,_0xcd06bc){var _0xe7d242=function(_0x3fc6cc){while(--_0x3fc6cc){_0x5b406e['push'](_0x5b406e['shift']());}};_0xe7d242(++_0xcd06bc);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'name':{'type':Sequelize[_0x2227('0x2')]},'description':{'type':Sequelize[_0x2227('0x2')]},'username':{'type':Sequelize[_0x2227('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2227('0x2')]},'remoteUri':{'type':Sequelize[_0x2227('0x2')],'unique':_0x2227('0x3')},'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 fd8f5e8..1ed18bd 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 _0xf4f6=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','username','remoteUri','GET','format','/api/selector/owners','apiKey','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName'];(function(_0x4d578c,_0x4d2ed2){var _0xf41cac=function(_0x4edde3){while(--_0x4edde3){_0x4d578c['push'](_0x4d578c['shift']());}};_0xf41cac(++_0x4d2ed2);}(_0xf4f6,0x16c));var _0x6f4f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xf4f6[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x6f4f('0x0'));var rimraf=require(_0x6f4f('0x1'));var zipdir=require(_0x6f4f('0x2'));var jsonpatch=require(_0x6f4f('0x3'));var rp=require(_0x6f4f('0x4'));var moment=require(_0x6f4f('0x5'));var BPromise=require(_0x6f4f('0x6'));var Mustache=require(_0x6f4f('0x7'));var util=require(_0x6f4f('0x8'));var path=require(_0x6f4f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f4f('0xa'));var fs=require('fs');var fs_extra=require(_0x6f4f('0xb'));var _=require(_0x6f4f('0xc'));var squel=require(_0x6f4f('0xd'));var crypto=require(_0x6f4f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6f4f('0xf'));var toCsv=require(_0x6f4f('0x10'));var querystring=require(_0x6f4f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6f4f('0x12'));var qs=require(_0x6f4f('0x13'));var as=require(_0x6f4f('0x14'));var hardwareService=require(_0x6f4f('0x15'));var logger=require(_0x6f4f('0x16'))(_0x6f4f('0x17'));var utils=require(_0x6f4f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6f4f('0x19'));var db=require(_0x6f4f('0x1a'))['db'];var integrations=require(_0x6f4f('0x1b'));function respondWithStatusCode(_0x363391,_0x2b12f8){_0x2b12f8=_0x2b12f8||0xcc;return function(_0x1c5f0d){if(_0x1c5f0d){return _0x363391[_0x6f4f('0x1c')](_0x2b12f8);}return _0x363391[_0x6f4f('0x1d')](_0x2b12f8)[_0x6f4f('0x1e')]();};}function respondWithResult(_0x4fa903,_0x44342a){_0x44342a=_0x44342a||0xc8;return function(_0x36607b){if(_0x36607b){return _0x4fa903[_0x6f4f('0x1d')](_0x44342a)[_0x6f4f('0x1f')](_0x36607b);}};}function respondWithFilteredResult(_0xf65e08,_0x114e61){return function(_0x24f619){if(_0x24f619){var _0xf3b4af=typeof _0x114e61[_0x6f4f('0x20')]==='undefined'&&typeof _0x114e61['limit']===_0x6f4f('0x21');var _0x1c243a=_0x24f619['count'];var _0x4a3e11=_0xf3b4af?0x0:_0x114e61[_0x6f4f('0x20')];var _0x3a831d=_0xf3b4af?_0x24f619[_0x6f4f('0x22')]:_0x114e61['offset']+_0x114e61[_0x6f4f('0x23')];var _0x262861;if(_0x3a831d>=_0x1c243a){_0x3a831d=_0x1c243a;_0x262861=0xc8;}else{_0x262861=0xce;}_0xf65e08['status'](_0x262861);return _0xf65e08[_0x6f4f('0x24')](_0x6f4f('0x25'),_0x4a3e11+'-'+_0x3a831d+'/'+_0x1c243a)[_0x6f4f('0x1f')](_0x24f619);}return null;};}function patchUpdates(_0x4a00d9){return function(_0x3b76f5){try{jsonpatch[_0x6f4f('0x26')](_0x3b76f5,_0x4a00d9,!![]);}catch(_0x2642f1){return BPromise[_0x6f4f('0x27')](_0x2642f1);}return _0x3b76f5[_0x6f4f('0x28')]();};}function saveUpdates(_0x266d3a,_0x40a497){return function(_0x392d53){if(_0x392d53){return _0x392d53[_0x6f4f('0x29')](_0x266d3a)[_0x6f4f('0x2a')](function(_0x2d3c35){return _0x2d3c35;});}return null;};}function removeEntity(_0x89f23d,_0x2f43d4){return function(_0x22c90a){if(_0x22c90a){return _0x22c90a[_0x6f4f('0x2b')]()[_0x6f4f('0x2a')](function(){_0x89f23d['status'](0xcc)[_0x6f4f('0x1e')]();});}};}function handleEntityNotFound(_0x2540d2,_0xc59bf7){return function(_0x1dded){if(!_0x1dded){_0x2540d2[_0x6f4f('0x1c')](0x194);}return _0x1dded;};}function handleError(_0x700f1d,_0x1b6016){_0x1b6016=_0x1b6016||0x1f4;return function(_0xa89e95){logger[_0x6f4f('0x2c')](_0xa89e95[_0x6f4f('0x2d')]);if(_0xa89e95[_0x6f4f('0x2e')]){delete _0xa89e95['name'];}_0x700f1d[_0x6f4f('0x1d')](_0x1b6016)['send'](_0xa89e95);};}exports[_0x6f4f('0x2f')]=function(_0x521cdc,_0x436ed6){var _0x190e5e={},_0x30ea67={},_0x1caf71={'count':0x0,'rows':[]};var _0x59b276=_[_0x6f4f('0x30')](db[_0x6f4f('0x31')][_0x6f4f('0x32')],function(_0x47e1ad){return{'name':_0x47e1ad[_0x6f4f('0x33')],'type':_0x47e1ad[_0x6f4f('0x34')][_0x6f4f('0x35')]};});_0x30ea67[_0x6f4f('0x36')]=_[_0x6f4f('0x30')](_0x59b276,_0x6f4f('0x2e'));_0x30ea67[_0x6f4f('0x37')]=_[_0x6f4f('0x38')](_0x521cdc[_0x6f4f('0x37')]);_0x30ea67[_0x6f4f('0x39')]=_[_0x6f4f('0x3a')](_0x30ea67[_0x6f4f('0x36')],_0x30ea67[_0x6f4f('0x37')]);_0x190e5e[_0x6f4f('0x3b')]=_[_0x6f4f('0x3a')](_0x30ea67[_0x6f4f('0x36')],qs[_0x6f4f('0x3c')](_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x3c')]));_0x190e5e[_0x6f4f('0x3b')]=_0x190e5e[_0x6f4f('0x3b')][_0x6f4f('0x3d')]?_0x190e5e[_0x6f4f('0x3b')]:_0x30ea67[_0x6f4f('0x36')];if(!_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x3e')](_0x6f4f('0x3f'))){_0x190e5e[_0x6f4f('0x23')]=qs[_0x6f4f('0x23')](_0x521cdc['query'][_0x6f4f('0x23')]);_0x190e5e[_0x6f4f('0x20')]=qs[_0x6f4f('0x20')](_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x20')]);}_0x190e5e[_0x6f4f('0x40')]=qs[_0x6f4f('0x41')](_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x41')]);_0x190e5e[_0x6f4f('0x42')]=qs[_0x6f4f('0x39')](_[_0x6f4f('0x43')](_0x521cdc[_0x6f4f('0x37')],_0x30ea67[_0x6f4f('0x39')]),_0x59b276);if(_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x44')]){_0x190e5e[_0x6f4f('0x42')]=_['merge'](_0x190e5e[_0x6f4f('0x42')],{'$or':_[_0x6f4f('0x30')](_0x59b276,function(_0x57a7e8){if(_0x57a7e8[_0x6f4f('0x34')]!==_0x6f4f('0x45')){var _0x41c2ec={};_0x41c2ec[_0x57a7e8[_0x6f4f('0x2e')]]={'$like':'%'+_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x44')]+'%'};return _0x41c2ec;}})});}_0x190e5e=_[_0x6f4f('0x46')]({},_0x190e5e,_0x521cdc[_0x6f4f('0x47')]);var _0x5c7e8a={'where':_0x190e5e['where']};return db[_0x6f4f('0x31')][_0x6f4f('0x22')](_0x5c7e8a)[_0x6f4f('0x2a')](function(_0x281aaf){_0x1caf71['count']=_0x281aaf;if(_0x521cdc[_0x6f4f('0x37')]['includeAll']){_0x190e5e[_0x6f4f('0x48')]=[{'all':!![]}];}return db[_0x6f4f('0x31')]['findAll'](_0x190e5e);})[_0x6f4f('0x2a')](function(_0x10e969){_0x1caf71[_0x6f4f('0x49')]=_0x10e969;return _0x1caf71;})['then'](respondWithFilteredResult(_0x436ed6,_0x190e5e))[_0x6f4f('0x4a')](handleError(_0x436ed6,null));};exports[_0x6f4f('0x4b')]=function(_0x532a85,_0x59d080){var _0x106df9={'raw':![],'where':{'id':_0x532a85[_0x6f4f('0x4c')]['id']}},_0x3e8bb5={};_0x3e8bb5[_0x6f4f('0x36')]=_['keys'](db[_0x6f4f('0x31')][_0x6f4f('0x32')]);_0x3e8bb5[_0x6f4f('0x37')]=_['keys'](_0x532a85[_0x6f4f('0x37')]);_0x3e8bb5[_0x6f4f('0x39')]=_['intersection'](_0x3e8bb5['model'],_0x3e8bb5[_0x6f4f('0x37')]);_0x106df9[_0x6f4f('0x3b')]=_[_0x6f4f('0x3a')](_0x3e8bb5[_0x6f4f('0x36')],qs[_0x6f4f('0x3c')](_0x532a85[_0x6f4f('0x37')]['fields']));_0x106df9[_0x6f4f('0x3b')]=_0x106df9[_0x6f4f('0x3b')][_0x6f4f('0x3d')]?_0x106df9[_0x6f4f('0x3b')]:_0x3e8bb5[_0x6f4f('0x36')];if(_0x532a85[_0x6f4f('0x37')][_0x6f4f('0x4d')]){_0x106df9[_0x6f4f('0x48')]=[{'all':!![]}];}_0x106df9=_['merge']({},_0x106df9,_0x532a85['options']);return db[_0x6f4f('0x31')]['find'](_0x106df9)[_0x6f4f('0x2a')](handleEntityNotFound(_0x59d080,null))[_0x6f4f('0x2a')](respondWithResult(_0x59d080,null))[_0x6f4f('0x4a')](handleError(_0x59d080,null));};exports[_0x6f4f('0x4e')]=function(_0x280b7e,_0x334a8e){return db['FreshsalesAccount'][_0x6f4f('0x4e')](_0x280b7e[_0x6f4f('0x4f')],{})[_0x6f4f('0x2a')](respondWithResult(_0x334a8e,0xc9))['catch'](handleError(_0x334a8e,null));};exports[_0x6f4f('0x29')]=function(_0x1f5282,_0xbe5eb5){if(_0x1f5282[_0x6f4f('0x4f')]['id']){delete _0x1f5282[_0x6f4f('0x4f')]['id'];}return db[_0x6f4f('0x31')][_0x6f4f('0x50')]({'where':{'id':_0x1f5282[_0x6f4f('0x4c')]['id']}})[_0x6f4f('0x2a')](handleEntityNotFound(_0xbe5eb5,null))[_0x6f4f('0x2a')](saveUpdates(_0x1f5282[_0x6f4f('0x4f')],null))[_0x6f4f('0x2a')](respondWithResult(_0xbe5eb5,null))['catch'](handleError(_0xbe5eb5,null));};exports['destroy']=function(_0x571f4b,_0x5bb21e){return db['FreshsalesAccount']['find']({'where':{'id':_0x571f4b['params']['id']}})[_0x6f4f('0x2a')](handleEntityNotFound(_0x5bb21e,null))[_0x6f4f('0x2a')](removeEntity(_0x5bb21e,null))[_0x6f4f('0x4a')](handleError(_0x5bb21e,null));};exports[_0x6f4f('0x51')]=function(_0x5b06a2,_0x47be5a,_0x54c5c2){var _0x14a1cb={};var _0x2ddff2={};var _0x465833;var _0x469931;return db[_0x6f4f('0x31')][_0x6f4f('0x52')]({'where':{'id':_0x5b06a2[_0x6f4f('0x4c')]['id']}})[_0x6f4f('0x2a')](handleEntityNotFound(_0x47be5a,null))[_0x6f4f('0x2a')](function(_0x4cdb0c){if(_0x4cdb0c){_0x465833=_0x4cdb0c;_0x2ddff2[_0x6f4f('0x36')]=_[_0x6f4f('0x38')](db[_0x6f4f('0x53')][_0x6f4f('0x32')]);_0x2ddff2[_0x6f4f('0x37')]=_[_0x6f4f('0x38')](_0x5b06a2[_0x6f4f('0x37')]);_0x2ddff2[_0x6f4f('0x39')]=_[_0x6f4f('0x3a')](_0x2ddff2[_0x6f4f('0x36')],_0x2ddff2[_0x6f4f('0x37')]);_0x14a1cb[_0x6f4f('0x3b')]=_[_0x6f4f('0x3a')](_0x2ddff2[_0x6f4f('0x36')],qs['fields'](_0x5b06a2[_0x6f4f('0x37')][_0x6f4f('0x3c')]));_0x14a1cb[_0x6f4f('0x3b')]=_0x14a1cb[_0x6f4f('0x3b')][_0x6f4f('0x3d')]?_0x14a1cb[_0x6f4f('0x3b')]:_0x2ddff2[_0x6f4f('0x36')];_0x14a1cb[_0x6f4f('0x40')]=qs['sort'](_0x5b06a2[_0x6f4f('0x37')][_0x6f4f('0x41')]);_0x14a1cb[_0x6f4f('0x42')]=qs['filters'](_['pick'](_0x5b06a2[_0x6f4f('0x37')],_0x2ddff2['filters']));if(_0x5b06a2['query'][_0x6f4f('0x44')]){_0x14a1cb[_0x6f4f('0x42')]=_['merge'](_0x14a1cb[_0x6f4f('0x42')],{'$or':_[_0x6f4f('0x30')](_0x14a1cb[_0x6f4f('0x3b')],function(_0x192b81){var _0x275ce4={};_0x275ce4[_0x192b81]={'$like':'%'+_0x5b06a2['query'][_0x6f4f('0x44')]+'%'};return _0x275ce4;})});}_0x14a1cb=_[_0x6f4f('0x46')]({},_0x14a1cb,_0x5b06a2[_0x6f4f('0x47')]);return _0x465833[_0x6f4f('0x51')](_0x14a1cb);}})[_0x6f4f('0x2a')](function(_0x3f6e44){if(_0x3f6e44){_0x469931=_0x3f6e44[_0x6f4f('0x3d')];if(!_0x5b06a2[_0x6f4f('0x37')]['hasOwnProperty'](_0x6f4f('0x3f'))){_0x14a1cb[_0x6f4f('0x23')]=qs[_0x6f4f('0x23')](_0x5b06a2['query'][_0x6f4f('0x23')]);_0x14a1cb[_0x6f4f('0x20')]=qs[_0x6f4f('0x20')](_0x5b06a2[_0x6f4f('0x37')][_0x6f4f('0x20')]);}return _0x465833[_0x6f4f('0x51')](_0x14a1cb);}})[_0x6f4f('0x2a')](function(_0x445557){if(_0x445557){return _0x445557?{'count':_0x469931,'rows':_0x445557}:null;}})['then'](respondWithResult(_0x47be5a,null))[_0x6f4f('0x4a')](handleError(_0x47be5a,null));};exports[_0x6f4f('0x54')]=function(_0x5f0f0c,_0xc4fa66,_0x459d64){if(_0x5f0f0c[_0x6f4f('0x4f')]['id']){delete _0x5f0f0c[_0x6f4f('0x4f')]['id'];}return db[_0x6f4f('0x31')]['findOne']({'where':{'id':_0x5f0f0c[_0x6f4f('0x4c')]['id']}})[_0x6f4f('0x2a')](handleEntityNotFound(_0xc4fa66,null))[_0x6f4f('0x2a')](function(_0x46fb1){if(_0x46fb1){_0x5f0f0c['body']['AccountId']=_0x46fb1['id'];_0x5f0f0c['body']['Subjects']=integrations[_0x6f4f('0x55')](_0x5f0f0c[_0x6f4f('0x4f')][_0x6f4f('0x56')],_0x5f0f0c[_0x6f4f('0x4f')][_0x6f4f('0x34')]);_0x5f0f0c[_0x6f4f('0x4f')][_0x6f4f('0x57')]=integrations[_0x6f4f('0x58')](_0x5f0f0c[_0x6f4f('0x4f')]['channel'],_0x5f0f0c[_0x6f4f('0x4f')]['type']);return db[_0x6f4f('0x53')][_0x6f4f('0x4e')](_0x5f0f0c[_0x6f4f('0x4f')],{'include':[{'model':db[_0x6f4f('0x59')],'as':_0x6f4f('0x5a')},{'model':db['FreshsalesField'],'as':_0x6f4f('0x57')}]});}return null;})[_0x6f4f('0x2a')](respondWithResult(_0xc4fa66,null))['catch'](handleError(_0xc4fa66,null));};exports['getFields']=function(_0x2d2b35,_0x319726,_0x276148){var _0x6af37e='';var _0x1fd2ed='';return db['FreshsalesAccount'][_0x6f4f('0x52')]({'where':{'id':_0x2d2b35[_0x6f4f('0x4c')]['id']},'attributes':['id',_0x6f4f('0x5b'),_0x6f4f('0x5c'),'apiKey']})['then'](handleEntityNotFound(_0x319726,null))['then'](function(_0x36f34d){if(_0x36f34d){_0x1fd2ed=_0x36f34d['username'];_0x6af37e=_0x36f34d['remoteUri'];var _0x2f4e7a=_0x36f34d[_0x6f4f('0x5c')]['slice'](-0x1);if(_0x2f4e7a==='/'){_0x6af37e=_0x6af37e['substring'](0x0,_0x6af37e['lastIndexOf'](_0x2f4e7a));}return rp({'method':_0x6f4f('0x5d'),'uri':util[_0x6f4f('0x5e')]('%s%s',_0x6af37e,_0x6f4f('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x36f34d[_0x6f4f('0x60')]},'json':!![]});}})[_0x6f4f('0x2a')](function(_0x1594cf){if(_0x1594cf){var _0x47aafc=_0x1594cf[_0x6f4f('0x61')];var _0x32212f=![];var _0x46ece2=null;for(_0x46ece2=0x0;_0x46ece2<_0x47aafc[_0x6f4f('0x3d')];_0x46ece2++){if(_0x47aafc[_0x46ece2]['email']===_0x1fd2ed){_0x32212f=!![];}}if(_0x32212f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x6f4f('0x2a')](respondWithResult(_0x319726,null))[_0x6f4f('0x4a')](function(_0x2dc0fb){var _0x2fd50b=_0x2d2b35['query'][_0x6f4f('0x62')]?0x1f4:_0x2dc0fb[_0x6f4f('0x63')]||0x1f4;logger['error'](_0x6f4f('0x64'),_0x6f4f('0x65'),_0x2fd50b,JSON[_0x6f4f('0x66')](_0x2dc0fb));delete _0x2dc0fb[_0x6f4f('0x2e')];if(_0x2fd50b===0x191){_0x2fd50b=0x190;}_0x319726[_0x6f4f('0x1d')](_0x2fd50b)[_0x6f4f('0x67')](_0x2d2b35[_0x6f4f('0x37')][_0x6f4f('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x2dc0fb[_0x6f4f('0x63')]}:_0x2dc0fb);});}; \ No newline at end of file +var _0x2c8f=['filters','pick','filter','merge','include','findAll','rows','params','options','find','catch','create','body','destroy','findOne','FreshsalesConfiguration','length','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where'];(function(_0x499f76,_0x32d064){var _0x378a23=function(_0x30ab96){while(--_0x30ab96){_0x499f76['push'](_0x499f76['shift']());}};_0x378a23(++_0x32d064);}(_0x2c8f,0x8a));var _0xf2c8=function(_0x19a79e,_0x46fc2b){_0x19a79e=_0x19a79e-0x0;var _0x229678=_0x2c8f[_0x19a79e];return _0x229678;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2c8('0x0'));var zipdir=require(_0xf2c8('0x1'));var jsonpatch=require(_0xf2c8('0x2'));var rp=require(_0xf2c8('0x3'));var moment=require(_0xf2c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf2c8('0x5'));var util=require(_0xf2c8('0x6'));var path=require('path');var sox=require(_0xf2c8('0x7'));var csv=require('to-csv');var ejs=require(_0xf2c8('0x8'));var fs=require('fs');var fs_extra=require(_0xf2c8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf2c8('0xa'));var jsforce=require(_0xf2c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf2c8('0xc'));var querystring=require(_0xf2c8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf2c8('0xe'));var qs=require(_0xf2c8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2c8('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf2c8('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf2c8('0x12'))['db'];var integrations=require(_0xf2c8('0x13'));function respondWithStatusCode(_0x82786e,_0x4dace6){_0x4dace6=_0x4dace6||0xcc;return function(_0x4cd76f){if(_0x4cd76f){return _0x82786e['sendStatus'](_0x4dace6);}return _0x82786e[_0xf2c8('0x14')](_0x4dace6)[_0xf2c8('0x15')]();};}function respondWithResult(_0x2a2bbf,_0x5f0fdf){_0x5f0fdf=_0x5f0fdf||0xc8;return function(_0x1b7d35){if(_0x1b7d35){return _0x2a2bbf[_0xf2c8('0x14')](_0x5f0fdf)[_0xf2c8('0x16')](_0x1b7d35);}};}function respondWithFilteredResult(_0x426610,_0x36591c){return function(_0x3b8dc6){if(_0x3b8dc6){var _0x347842=typeof _0x36591c[_0xf2c8('0x17')]==='undefined'&&typeof _0x36591c[_0xf2c8('0x18')]===_0xf2c8('0x19');var _0x1103af=_0x3b8dc6[_0xf2c8('0x1a')];var _0x586867=_0x347842?0x0:_0x36591c[_0xf2c8('0x17')];var _0x52ce21=_0x347842?_0x3b8dc6[_0xf2c8('0x1a')]:_0x36591c[_0xf2c8('0x17')]+_0x36591c['limit'];var _0x3c2743;if(_0x52ce21>=_0x1103af){_0x52ce21=_0x1103af;_0x3c2743=0xc8;}else{_0x3c2743=0xce;}_0x426610['status'](_0x3c2743);return _0x426610[_0xf2c8('0x1b')](_0xf2c8('0x1c'),_0x586867+'-'+_0x52ce21+'/'+_0x1103af)[_0xf2c8('0x16')](_0x3b8dc6);}return null;};}function patchUpdates(_0x275c8e){return function(_0x32b184){try{jsonpatch[_0xf2c8('0x1d')](_0x32b184,_0x275c8e,!![]);}catch(_0x7f8a6e){return BPromise[_0xf2c8('0x1e')](_0x7f8a6e);}return _0x32b184['save']();};}function saveUpdates(_0x3e9244,_0x1bebef){return function(_0x40f5e9){if(_0x40f5e9){return _0x40f5e9[_0xf2c8('0x1f')](_0x3e9244)[_0xf2c8('0x20')](function(_0x10c03e){return _0x10c03e;});}return null;};}function removeEntity(_0x32a967,_0x44f8fb){return function(_0x4fc058){if(_0x4fc058){return _0x4fc058['destroy']()[_0xf2c8('0x20')](function(){_0x32a967[_0xf2c8('0x14')](0xcc)[_0xf2c8('0x15')]();});}};}function handleEntityNotFound(_0x4c6ae8,_0x2e7f1d){return function(_0x389c09){if(!_0x389c09){_0x4c6ae8[_0xf2c8('0x21')](0x194);}return _0x389c09;};}function handleError(_0x4d97e9,_0x5eda0e){_0x5eda0e=_0x5eda0e||0x1f4;return function(_0x409830){logger[_0xf2c8('0x22')](_0x409830[_0xf2c8('0x23')]);if(_0x409830['name']){delete _0x409830[_0xf2c8('0x24')];}_0x4d97e9['status'](_0x5eda0e)[_0xf2c8('0x25')](_0x409830);};}exports[_0xf2c8('0x26')]=function(_0x2713f6,_0x2fb36e){var _0x3027ed={},_0x27c28d={},_0x2d652c={'count':0x0,'rows':[]};var _0x305f6c=_[_0xf2c8('0x27')](db[_0xf2c8('0x28')][_0xf2c8('0x29')],function(_0xe0a3a5){return{'name':_0xe0a3a5[_0xf2c8('0x2a')],'type':_0xe0a3a5['type']['key']};});_0x27c28d[_0xf2c8('0x2b')]=_[_0xf2c8('0x27')](_0x305f6c,'name');_0x27c28d[_0xf2c8('0x2c')]=_[_0xf2c8('0x2d')](_0x2713f6[_0xf2c8('0x2c')]);_0x27c28d['filters']=_[_0xf2c8('0x2e')](_0x27c28d[_0xf2c8('0x2b')],_0x27c28d[_0xf2c8('0x2c')]);_0x3027ed[_0xf2c8('0x2f')]=_['intersection'](_0x27c28d[_0xf2c8('0x2b')],qs[_0xf2c8('0x30')](_0x2713f6[_0xf2c8('0x2c')][_0xf2c8('0x30')]));_0x3027ed[_0xf2c8('0x2f')]=_0x3027ed[_0xf2c8('0x2f')]['length']?_0x3027ed[_0xf2c8('0x2f')]:_0x27c28d[_0xf2c8('0x2b')];if(!_0x2713f6[_0xf2c8('0x2c')][_0xf2c8('0x31')]('nolimit')){_0x3027ed[_0xf2c8('0x18')]=qs['limit'](_0x2713f6[_0xf2c8('0x2c')][_0xf2c8('0x18')]);_0x3027ed['offset']=qs['offset'](_0x2713f6['query'][_0xf2c8('0x17')]);}_0x3027ed['order']=qs[_0xf2c8('0x32')](_0x2713f6[_0xf2c8('0x2c')][_0xf2c8('0x32')]);_0x3027ed[_0xf2c8('0x33')]=qs[_0xf2c8('0x34')](_[_0xf2c8('0x35')](_0x2713f6[_0xf2c8('0x2c')],_0x27c28d[_0xf2c8('0x34')]),_0x305f6c);if(_0x2713f6['query'][_0xf2c8('0x36')]){_0x3027ed[_0xf2c8('0x33')]=_[_0xf2c8('0x37')](_0x3027ed[_0xf2c8('0x33')],{'$or':_[_0xf2c8('0x27')](_0x305f6c,function(_0xb6105c){if(_0xb6105c['type']!=='VIRTUAL'){var _0x160076={};_0x160076[_0xb6105c[_0xf2c8('0x24')]]={'$like':'%'+_0x2713f6[_0xf2c8('0x2c')][_0xf2c8('0x36')]+'%'};return _0x160076;}})});}_0x3027ed=_[_0xf2c8('0x37')]({},_0x3027ed,_0x2713f6['options']);var _0x36de78={'where':_0x3027ed[_0xf2c8('0x33')]};return db[_0xf2c8('0x28')]['count'](_0x36de78)[_0xf2c8('0x20')](function(_0x3c3b53){_0x2d652c[_0xf2c8('0x1a')]=_0x3c3b53;if(_0x2713f6[_0xf2c8('0x2c')]['includeAll']){_0x3027ed[_0xf2c8('0x38')]=[{'all':!![]}];}return db[_0xf2c8('0x28')][_0xf2c8('0x39')](_0x3027ed);})[_0xf2c8('0x20')](function(_0x40e3cc){_0x2d652c[_0xf2c8('0x3a')]=_0x40e3cc;return _0x2d652c;})[_0xf2c8('0x20')](respondWithFilteredResult(_0x2fb36e,_0x3027ed))['catch'](handleError(_0x2fb36e,null));};exports['show']=function(_0x89dd66,_0x3268d7){var _0x45823e={'raw':![],'where':{'id':_0x89dd66[_0xf2c8('0x3b')]['id']}},_0x58e890={};_0x58e890[_0xf2c8('0x2b')]=_['keys'](db[_0xf2c8('0x28')][_0xf2c8('0x29')]);_0x58e890[_0xf2c8('0x2c')]=_[_0xf2c8('0x2d')](_0x89dd66['query']);_0x58e890[_0xf2c8('0x34')]=_[_0xf2c8('0x2e')](_0x58e890[_0xf2c8('0x2b')],_0x58e890[_0xf2c8('0x2c')]);_0x45823e[_0xf2c8('0x2f')]=_['intersection'](_0x58e890[_0xf2c8('0x2b')],qs['fields'](_0x89dd66[_0xf2c8('0x2c')][_0xf2c8('0x30')]));_0x45823e[_0xf2c8('0x2f')]=_0x45823e[_0xf2c8('0x2f')]['length']?_0x45823e[_0xf2c8('0x2f')]:_0x58e890[_0xf2c8('0x2b')];if(_0x89dd66[_0xf2c8('0x2c')]['includeAll']){_0x45823e[_0xf2c8('0x38')]=[{'all':!![]}];}_0x45823e=_[_0xf2c8('0x37')]({},_0x45823e,_0x89dd66[_0xf2c8('0x3c')]);return db['FreshsalesAccount'][_0xf2c8('0x3d')](_0x45823e)[_0xf2c8('0x20')](handleEntityNotFound(_0x3268d7,null))[_0xf2c8('0x20')](respondWithResult(_0x3268d7,null))[_0xf2c8('0x3e')](handleError(_0x3268d7,null));};exports[_0xf2c8('0x3f')]=function(_0x1ef6ce,_0x5990cc){return db[_0xf2c8('0x28')][_0xf2c8('0x3f')](_0x1ef6ce['body'],{})['then'](respondWithResult(_0x5990cc,0xc9))[_0xf2c8('0x3e')](handleError(_0x5990cc,null));};exports[_0xf2c8('0x1f')]=function(_0x378ee7,_0x16577f){if(_0x378ee7[_0xf2c8('0x40')]['id']){delete _0x378ee7[_0xf2c8('0x40')]['id'];}return db[_0xf2c8('0x28')][_0xf2c8('0x3d')]({'where':{'id':_0x378ee7['params']['id']}})[_0xf2c8('0x20')](handleEntityNotFound(_0x16577f,null))['then'](saveUpdates(_0x378ee7[_0xf2c8('0x40')],null))[_0xf2c8('0x20')](respondWithResult(_0x16577f,null))[_0xf2c8('0x3e')](handleError(_0x16577f,null));};exports[_0xf2c8('0x41')]=function(_0x54120c,_0x5e0b81){return db[_0xf2c8('0x28')][_0xf2c8('0x3d')]({'where':{'id':_0x54120c[_0xf2c8('0x3b')]['id']}})[_0xf2c8('0x20')](handleEntityNotFound(_0x5e0b81,null))[_0xf2c8('0x20')](removeEntity(_0x5e0b81,null))['catch'](handleError(_0x5e0b81,null));};exports['getConfigurations']=function(_0x57341b,_0x340fb7,_0x1e8004){var _0x338bb9={};var _0x2db08a={};var _0x41e4d0;var _0x588b01;return db[_0xf2c8('0x28')][_0xf2c8('0x42')]({'where':{'id':_0x57341b['params']['id']}})[_0xf2c8('0x20')](handleEntityNotFound(_0x340fb7,null))[_0xf2c8('0x20')](function(_0x2d81cc){if(_0x2d81cc){_0x41e4d0=_0x2d81cc;_0x2db08a[_0xf2c8('0x2b')]=_[_0xf2c8('0x2d')](db[_0xf2c8('0x43')][_0xf2c8('0x29')]);_0x2db08a[_0xf2c8('0x2c')]=_['keys'](_0x57341b[_0xf2c8('0x2c')]);_0x2db08a['filters']=_[_0xf2c8('0x2e')](_0x2db08a['model'],_0x2db08a[_0xf2c8('0x2c')]);_0x338bb9['attributes']=_[_0xf2c8('0x2e')](_0x2db08a['model'],qs[_0xf2c8('0x30')](_0x57341b[_0xf2c8('0x2c')][_0xf2c8('0x30')]));_0x338bb9[_0xf2c8('0x2f')]=_0x338bb9[_0xf2c8('0x2f')][_0xf2c8('0x44')]?_0x338bb9[_0xf2c8('0x2f')]:_0x2db08a[_0xf2c8('0x2b')];_0x338bb9['order']=qs[_0xf2c8('0x32')](_0x57341b['query'][_0xf2c8('0x32')]);_0x338bb9[_0xf2c8('0x33')]=qs['filters'](_['pick'](_0x57341b[_0xf2c8('0x2c')],_0x2db08a[_0xf2c8('0x34')]));if(_0x57341b[_0xf2c8('0x2c')]['filter']){_0x338bb9[_0xf2c8('0x33')]=_['merge'](_0x338bb9[_0xf2c8('0x33')],{'$or':_['map'](_0x338bb9[_0xf2c8('0x2f')],function(_0x373438){var _0x52e5bc={};_0x52e5bc[_0x373438]={'$like':'%'+_0x57341b[_0xf2c8('0x2c')][_0xf2c8('0x36')]+'%'};return _0x52e5bc;})});}_0x338bb9=_['merge']({},_0x338bb9,_0x57341b[_0xf2c8('0x3c')]);return _0x41e4d0['getConfigurations'](_0x338bb9);}})[_0xf2c8('0x20')](function(_0x23562e){if(_0x23562e){_0x588b01=_0x23562e[_0xf2c8('0x44')];if(!_0x57341b[_0xf2c8('0x2c')][_0xf2c8('0x31')](_0xf2c8('0x45'))){_0x338bb9[_0xf2c8('0x18')]=qs[_0xf2c8('0x18')](_0x57341b[_0xf2c8('0x2c')][_0xf2c8('0x18')]);_0x338bb9[_0xf2c8('0x17')]=qs[_0xf2c8('0x17')](_0x57341b[_0xf2c8('0x2c')][_0xf2c8('0x17')]);}return _0x41e4d0[_0xf2c8('0x46')](_0x338bb9);}})[_0xf2c8('0x20')](function(_0x21478e){if(_0x21478e){return _0x21478e?{'count':_0x588b01,'rows':_0x21478e}:null;}})[_0xf2c8('0x20')](respondWithResult(_0x340fb7,null))[_0xf2c8('0x3e')](handleError(_0x340fb7,null));};exports[_0xf2c8('0x47')]=function(_0x358ae7,_0x317da3,_0x1ca538){if(_0x358ae7[_0xf2c8('0x40')]['id']){delete _0x358ae7[_0xf2c8('0x40')]['id'];}return db[_0xf2c8('0x28')][_0xf2c8('0x42')]({'where':{'id':_0x358ae7['params']['id']}})['then'](handleEntityNotFound(_0x317da3,null))[_0xf2c8('0x20')](function(_0x5eedc2){if(_0x5eedc2){_0x358ae7[_0xf2c8('0x40')]['AccountId']=_0x5eedc2['id'];_0x358ae7[_0xf2c8('0x40')][_0xf2c8('0x48')]=integrations[_0xf2c8('0x49')](_0x358ae7[_0xf2c8('0x40')]['channel'],_0x358ae7[_0xf2c8('0x40')][_0xf2c8('0x4a')]);_0x358ae7['body'][_0xf2c8('0x4b')]=integrations[_0xf2c8('0x4c')](_0x358ae7[_0xf2c8('0x40')][_0xf2c8('0x4d')],_0x358ae7['body'][_0xf2c8('0x4a')]);return db['FreshsalesConfiguration'][_0xf2c8('0x3f')](_0x358ae7[_0xf2c8('0x40')],{'include':[{'model':db['FreshsalesField'],'as':_0xf2c8('0x48')},{'model':db[_0xf2c8('0x4e')],'as':_0xf2c8('0x4b')}]});}return null;})['then'](respondWithResult(_0x317da3,null))[_0xf2c8('0x3e')](handleError(_0x317da3,null));};exports[_0xf2c8('0x4f')]=function(_0x1b1e6b,_0x567045,_0xbb5d60){var _0x55f410='';var _0x5bb542='';return db[_0xf2c8('0x28')][_0xf2c8('0x42')]({'where':{'id':_0x1b1e6b[_0xf2c8('0x3b')]['id']},'attributes':['id',_0xf2c8('0x50'),_0xf2c8('0x51'),_0xf2c8('0x52')]})[_0xf2c8('0x20')](handleEntityNotFound(_0x567045,null))[_0xf2c8('0x20')](function(_0x353fb9){if(_0x353fb9){_0x5bb542=_0x353fb9[_0xf2c8('0x50')];_0x55f410=_0x353fb9[_0xf2c8('0x51')];var _0x34e1d2=_0x353fb9[_0xf2c8('0x51')][_0xf2c8('0x53')](-0x1);if(_0x34e1d2==='/'){_0x55f410=_0x55f410['substring'](0x0,_0x55f410[_0xf2c8('0x54')](_0x34e1d2));}return rp({'method':'GET','uri':util['format'](_0xf2c8('0x55'),_0x55f410,_0xf2c8('0x56')),'headers':{'Authorization':_0xf2c8('0x57')+_0x353fb9[_0xf2c8('0x52')]},'json':!![]});}})[_0xf2c8('0x20')](function(_0x274001){if(_0x274001){var _0x4306ff=_0x274001[_0xf2c8('0x58')];var _0x22e466=![];var _0x13da30=null;for(_0x13da30=0x0;_0x13da30<_0x4306ff[_0xf2c8('0x44')];_0x13da30++){if(_0x4306ff[_0x13da30]['email']===_0x5bb542){_0x22e466=!![];}}if(_0x22e466){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf2c8('0x59')});}}})[_0xf2c8('0x20')](respondWithResult(_0x567045,null))[_0xf2c8('0x3e')](function(_0x357ea2){var _0x58c407=_0x1b1e6b[_0xf2c8('0x2c')][_0xf2c8('0x5a')]?0x1f4:_0x357ea2[_0xf2c8('0x5b')]||0x1f4;logger[_0xf2c8('0x22')](_0xf2c8('0x5c'),'getFields',_0x58c407,JSON[_0xf2c8('0x5d')](_0x357ea2));delete _0x357ea2['name'];if(_0x58c407===0x191){_0x58c407=0x190;}_0x567045[_0xf2c8('0x14')](_0x58c407)[_0xf2c8('0x25')](_0x1b1e6b[_0xf2c8('0x2c')][_0xf2c8('0x5a')]?{'message':_0xf2c8('0x5e'),'statusCode':_0x357ea2['statusCode']}:_0x357ea2);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 77b59d0..dcffe64 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0x5496,0x175));var _0x6549=function(_0x2e2be8,_0x54b2e9){_0x2e2be8=_0x2e2be8-0x0;var _0x44417f=_0x5496[_0x2e2be8];return _0x44417f;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x627e=['path','rimraf','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x230c53,_0x488a8a){var _0x397074=function(_0x25a3c4){while(--_0x25a3c4){_0x230c53['push'](_0x230c53['shift']());}};_0x397074(++_0x488a8a);}(_0x627e,0x14a));var _0xe627=function(_0x52326c,_0xdedaab){_0x52326c=_0x52326c-0x0;var _0x44a038=_0x627e[_0x52326c];return _0x44a038;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe627('0x8')]=function(_0x3f2791,_0x45e49a){return _0x3f2791[_0xe627('0x9')](_0xe627('0xa'),attributes,{'tableName':_0xe627('0xb'),'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 c666aad..fb0278a 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 _0x47c5=['include','model','attributes','map','GetFreshsalesAccount','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw'];(function(_0x27ab3b,_0x4ba1b9){var _0x5cf92f=function(_0x4102f6){while(--_0x4102f6){_0x27ab3b['push'](_0x27ab3b['shift']());}};_0x5cf92f(++_0x4ba1b9);}(_0x47c5,0x165));var _0x547c=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x47c5[_0x57cb4f];return _0x29bb45;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['GetFreshsalesAccount']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')]({'raw':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options'][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options']['where']||null:null,'attributes':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['attributes']||null:null,'limit':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['limit']||null:null,'include':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')]?_['map'](_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')],function(_0x470694){return{'model':db[_0x470694[_0x547c('0x1d')]],'as':_0x470694['as'],'attributes':_0x470694[_0x547c('0x1e')],'include':_0x470694[_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x470694[_0x547c('0x1c')],function(_0x507895){return{'model':db[_0x507895[_0x547c('0x1d')]],'as':_0x507895['as'],'attributes':_0x507895['attributes'],'include':_0x507895['include']?_['map'](_0x507895['include'],function(_0x2c725d){return{'model':db[_0x2c725d['model']],'as':_0x2c725d['as'],'attributes':_0x2c725d[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea493){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x3ea493));_0xeb059e(_0x3ea493);})[_0x547c('0x17')](function(_0x569924){logger['error'](_0x547c('0x20'),_0x569924['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x569924[_0x547c('0x15')]));});});};exports[_0x547c('0x21')]=function(_0x1695be){var _0x4652e7=this;return new Promise(function(_0x51e6e7,_0x342c10){return db['FreshsalesAccount']['find']({'raw':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x22')]||null:null,'attributes':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1e')]||null:null,'include':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x1695be[_0x547c('0x1a')]['include'],function(_0x3afc28){return{'model':db[_0x3afc28['model']],'as':_0x3afc28['as'],'attributes':_0x3afc28['attributes'],'include':_0x3afc28['include']?_[_0x547c('0x1f')](_0x3afc28[_0x547c('0x1c')],function(_0x31c7d3){return{'model':db[_0x31c7d3[_0x547c('0x1d')]],'as':_0x31c7d3['as'],'attributes':_0x31c7d3[_0x547c('0x1e')],'include':_0x31c7d3[_0x547c('0x1c')]?_['map'](_0x31c7d3['include'],function(_0x5ea2c7){return{'model':db[_0x5ea2c7[_0x547c('0x1d')]],'as':_0x5ea2c7['as'],'attributes':_0x5ea2c7[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x547c('0xc')](function(_0x44687e){logger[_0x547c('0xd')](_0x547c('0x21'),_0x1695be);logger['debug'](_0x547c('0x21'),_0x1695be,JSON['stringify'](_0x44687e));_0x51e6e7(_0x44687e);})[_0x547c('0x17')](function(_0x18fcc5){logger['error'](_0x547c('0x21'),_0x18fcc5['message'],_0x1695be);_0x342c10(_0x4652e7['error'](0x1f4,_0x18fcc5[_0x547c('0x15')]));});});}; \ No newline at end of file +var _0x82c4=['findAll','options','raw','attributes','include','map','model','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x82c4,0x1ca));var _0x482c=function(_0x47a4af,_0x4ef90b){_0x47a4af=_0x47a4af-0x0;var _0x25a0b1=_0x82c4[_0x47a4af];return _0x25a0b1;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['FreshsalesAccount'][_0x482c('0x16')]({'raw':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['where']||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x19')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['limit']||null:null,'include':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x5b6f7e['options'][_0x482c('0x1a')],function(_0x579d2f){return{'model':db[_0x579d2f[_0x482c('0x1c')]],'as':_0x579d2f['as'],'attributes':_0x579d2f[_0x482c('0x19')],'include':_0x579d2f['include']?_[_0x482c('0x1b')](_0x579d2f['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1c')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x19')],'include':_0x589bc6[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x589bc6[_0x482c('0x1a')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1c')]],'as':_0x215826['as'],'attributes':_0x215826['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0xa')](function(_0x255417){logger['info'](_0x482c('0x15'),_0x5b6f7e);logger['debug']('GetFreshsalesAccount',_0x5b6f7e,JSON[_0x482c('0xf')](_0x255417));_0x258148(_0x255417);})['catch'](function(_0x1ac1c4){logger[_0x482c('0x10')](_0x482c('0x15'),_0x1ac1c4[_0x482c('0x12')],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x1ac1c4[_0x482c('0x12')]));});});};exports[_0x482c('0x1d')]=function(_0x3e9b22){var _0x24b4df=this;return new Promise(function(_0x2d3800,_0x3135a7){return db[_0x482c('0x1e')][_0x482c('0x1f')]({'raw':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')]['where']||null:null,'attributes':_0x3e9b22['options']?_0x3e9b22['options'][_0x482c('0x19')]||null:null,'include':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x1a')]?_['map'](_0x3e9b22[_0x482c('0x17')]['include'],function(_0x31428c){return{'model':db[_0x31428c[_0x482c('0x1c')]],'as':_0x31428c['as'],'attributes':_0x31428c[_0x482c('0x19')],'include':_0x31428c[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x31428c[_0x482c('0x1a')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1c')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x1b')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1c')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cbaa){logger[_0x482c('0xb')](_0x482c('0x1d'),_0x3e9b22);logger[_0x482c('0xe')]('ShowFreshsalesAccount',_0x3e9b22,JSON[_0x482c('0xf')](_0x29cbaa));_0x2d3800(_0x29cbaa);})['catch'](function(_0x1de7f4){logger['error'](_0x482c('0x1d'),_0x1de7f4['message'],_0x3e9b22);_0x3135a7(_0x24b4df[_0x482c('0x10')](0x1f4,_0x1de7f4[_0x482c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d2056c2..3d23978 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 _0x4eb4=['./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','/:id','update','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9b9e0a,_0x253d5c){var _0x22432f=function(_0x570bd4){while(--_0x570bd4){_0x9b9e0a['push'](_0x9b9e0a['shift']());}};_0x22432f(++_0x253d5c);}(_0x4eb4,0x1de));var _0x44eb=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x4eb4[_0x2b45b5];return _0x1d9c06;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x44eb('0x0'));var timeout=require(_0x44eb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x44eb('0x2'));var auth=require(_0x44eb('0x3'));var interaction=require(_0x44eb('0x4'));var config=require(_0x44eb('0x5'));var controller=require(_0x44eb('0x6'));router[_0x44eb('0x7')]('/',auth[_0x44eb('0x8')](),controller[_0x44eb('0x9')]);router[_0x44eb('0x7')]('/:id',auth[_0x44eb('0x8')](),controller[_0x44eb('0xa')]);router['get'](_0x44eb('0xb'),auth[_0x44eb('0x8')](),controller[_0x44eb('0xc')]);router[_0x44eb('0x7')](_0x44eb('0xd'),auth[_0x44eb('0x8')](),controller[_0x44eb('0xe')]);router[_0x44eb('0x7')](_0x44eb('0xf'),auth[_0x44eb('0x8')](),controller[_0x44eb('0x10')]);router[_0x44eb('0x11')]('/',auth[_0x44eb('0x8')](),controller['create']);router[_0x44eb('0x12')](_0x44eb('0x13'),auth['isAuthenticated'](),controller[_0x44eb('0x14')]);router['delete'](_0x44eb('0x13'),auth[_0x44eb('0x8')](),controller['destroy']);module[_0x44eb('0x15')]=router; \ No newline at end of file +var _0x5914=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/fields','getFields','put','update','destroy','exports','util'];(function(_0x2f0257,_0x5d0dab){var _0x5aace0=function(_0x5f1d01){while(--_0x5f1d01){_0x2f0257['push'](_0x2f0257['shift']());}};_0x5aace0(++_0x5d0dab);}(_0x5914,0x1f3));var _0x4591=function(_0xb7c15b,_0x438982){_0xb7c15b=_0xb7c15b-0x0;var _0x2769e9=_0x5914[_0xb7c15b];return _0x2769e9;};'use strict';var multer=require('multer');var util=require(_0x4591('0x0'));var path=require(_0x4591('0x1'));var timeout=require('connect-timeout');var express=require(_0x4591('0x2'));var router=express[_0x4591('0x3')]();var fs_extra=require(_0x4591('0x4'));var auth=require(_0x4591('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4591('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x4591('0x7')](),controller[_0x4591('0x8')]);router[_0x4591('0x9')](_0x4591('0xa'),auth[_0x4591('0x7')](),controller[_0x4591('0xb')]);router['get'](_0x4591('0xc'),auth[_0x4591('0x7')](),controller[_0x4591('0xd')]);router[_0x4591('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x4591('0x9')](_0x4591('0xe'),auth[_0x4591('0x7')](),controller[_0x4591('0xf')]);router['post']('/',auth[_0x4591('0x7')](),controller['create']);router[_0x4591('0x10')](_0x4591('0xa'),auth[_0x4591('0x7')](),controller[_0x4591('0x11')]);router['delete'](_0x4591('0xa'),auth['isAuthenticated'](),controller[_0x4591('0x12')]);module[_0x4591('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1b9a8fd..273cc8c 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 _0x00de=['sequelize','exports','STRING'];(function(_0x530f6f,_0x136bc2){var _0x54761f=function(_0x16e1c1){while(--_0x16e1c1){_0x530f6f['push'](_0x530f6f['shift']());}};_0x54761f(++_0x136bc2);}(_0x00de,0xba));var _0xe00d=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x00de[_0x4a0e68];return _0x4fb274;};'use strict';var Sequelize=require(_0xe00d('0x0'));module[_0xe00d('0x1')]={'name':{'type':Sequelize[_0xe00d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb929=['sequelize','exports','STRING'];(function(_0x191ff0,_0x50515a){var _0x1003ac=function(_0x3c920d){while(--_0x3c920d){_0x191ff0['push'](_0x191ff0['shift']());}};_0x1003ac(++_0x50515a);}(_0xb929,0xea));var _0x9b92=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb929[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x9b92('0x0'));module[_0x9b92('0x1')]={'name':{'type':Sequelize[_0x9b92('0x2')]},'description':{'type':Sequelize[_0x9b92('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 347727d..5f6b24e 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 _0xa245=['FreshsalesField','pick','getSubjects','getDescriptions','getFields','eml-format','rimraf','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','FreshsalesConfiguration','includeAll','include','rows','catch','show','params','keys','options','find','create','body','findOne'];(function(_0x39dadd,_0x5e021f){var _0x52c414=function(_0x2fff0a){while(--_0x2fff0a){_0x39dadd['push'](_0x39dadd['shift']());}};_0x52c414(++_0x5e021f);}(_0xa245,0x195));var _0x5a24=function(_0x15d08f,_0x37ce88){_0x15d08f=_0x15d08f-0x0;var _0x4a0056=_0xa245[_0x15d08f];return _0x4a0056;};'use strict';var emlformat=require(_0x5a24('0x0'));var rimraf=require(_0x5a24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5a24('0x2'));var moment=require(_0x5a24('0x3'));var BPromise=require(_0x5a24('0x4'));var Mustache=require(_0x5a24('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5a24('0x6'));var fs=require('fs');var fs_extra=require(_0x5a24('0x7'));var _=require(_0x5a24('0x8'));var squel=require('squel');var crypto=require(_0x5a24('0x9'));var jsforce=require(_0x5a24('0xa'));var deskjs=require(_0x5a24('0xb'));var toCsv=require(_0x5a24('0xc'));var querystring=require(_0x5a24('0xd'));var Papa=require(_0x5a24('0xe'));var Redis=require(_0x5a24('0xf'));var authService=require(_0x5a24('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5a24('0x11'));var hardwareService=require(_0x5a24('0x12'));var logger=require(_0x5a24('0x13'))('api');var utils=require(_0x5a24('0x14'));var config=require(_0x5a24('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a24('0x16'))['db'];function respondWithStatusCode(_0x34918d,_0x26d819){_0x26d819=_0x26d819||0xcc;return function(_0x246972){if(_0x246972){return _0x34918d[_0x5a24('0x17')](_0x26d819);}return _0x34918d[_0x5a24('0x18')](_0x26d819)[_0x5a24('0x19')]();};}function respondWithResult(_0x2d994c,_0x1d4da0){_0x1d4da0=_0x1d4da0||0xc8;return function(_0x23ef8c){if(_0x23ef8c){return _0x2d994c[_0x5a24('0x18')](_0x1d4da0)['json'](_0x23ef8c);}};}function respondWithFilteredResult(_0x12f0d8,_0xd68d7b){return function(_0x1c9e7e){if(_0x1c9e7e){var _0x18fd14=typeof _0xd68d7b[_0x5a24('0x1a')]===_0x5a24('0x1b')&&typeof _0xd68d7b['limit']===_0x5a24('0x1b');var _0xba16bd=_0x1c9e7e['count'];var _0x3bfd6a=_0x18fd14?0x0:_0xd68d7b['offset'];var _0x2aed95=_0x18fd14?_0x1c9e7e[_0x5a24('0x1c')]:_0xd68d7b['offset']+_0xd68d7b[_0x5a24('0x1d')];var _0x1a44aa;if(_0x2aed95>=_0xba16bd){_0x2aed95=_0xba16bd;_0x1a44aa=0xc8;}else{_0x1a44aa=0xce;}_0x12f0d8[_0x5a24('0x18')](_0x1a44aa);return _0x12f0d8[_0x5a24('0x1e')]('Content-Range',_0x3bfd6a+'-'+_0x2aed95+'/'+_0xba16bd)[_0x5a24('0x1f')](_0x1c9e7e);}return null;};}function patchUpdates(_0x2ba9bd){return function(_0x279957){try{jsonpatch[_0x5a24('0x20')](_0x279957,_0x2ba9bd,!![]);}catch(_0x36c9df){return BPromise[_0x5a24('0x21')](_0x36c9df);}return _0x279957[_0x5a24('0x22')]();};}function saveUpdates(_0x25da4e,_0x5f09c5){return function(_0x5de749){if(_0x5de749){return _0x5de749[_0x5a24('0x23')](_0x25da4e)['then'](function(_0x1bfee6){return _0x1bfee6;});}return null;};}function removeEntity(_0xaf265b,_0x17cdb0){return function(_0x349cc8){if(_0x349cc8){return _0x349cc8[_0x5a24('0x24')]()[_0x5a24('0x25')](function(){_0xaf265b['status'](0xcc)[_0x5a24('0x19')]();});}};}function handleEntityNotFound(_0x55f286,_0x55bb08){return function(_0x232b05){if(!_0x232b05){_0x55f286[_0x5a24('0x17')](0x194);}return _0x232b05;};}function handleError(_0x11560b,_0x28dcea){_0x28dcea=_0x28dcea||0x1f4;return function(_0x54507e){logger[_0x5a24('0x26')](_0x54507e[_0x5a24('0x27')]);if(_0x54507e[_0x5a24('0x28')]){delete _0x54507e[_0x5a24('0x28')];}_0x11560b[_0x5a24('0x18')](_0x28dcea)[_0x5a24('0x29')](_0x54507e);};}exports[_0x5a24('0x2a')]=function(_0x2099bb,_0x290fd2){var _0x7d5ec2={},_0x25fb1c={},_0x30eb46={'count':0x0,'rows':[]};var _0x24c8e2=_[_0x5a24('0x2b')](db['FreshsalesConfiguration'][_0x5a24('0x2c')],function(_0x4b1715){return{'name':_0x4b1715[_0x5a24('0x2d')],'type':_0x4b1715[_0x5a24('0x2e')]['key']};});_0x25fb1c[_0x5a24('0x2f')]=_[_0x5a24('0x2b')](_0x24c8e2,_0x5a24('0x28'));_0x25fb1c['query']=_['keys'](_0x2099bb['query']);_0x25fb1c[_0x5a24('0x30')]=_[_0x5a24('0x31')](_0x25fb1c['model'],_0x25fb1c[_0x5a24('0x32')]);_0x7d5ec2[_0x5a24('0x33')]=_['intersection'](_0x25fb1c[_0x5a24('0x2f')],qs[_0x5a24('0x34')](_0x2099bb[_0x5a24('0x32')][_0x5a24('0x34')]));_0x7d5ec2[_0x5a24('0x33')]=_0x7d5ec2[_0x5a24('0x33')][_0x5a24('0x35')]?_0x7d5ec2[_0x5a24('0x33')]:_0x25fb1c['model'];if(!_0x2099bb['query'][_0x5a24('0x36')](_0x5a24('0x37'))){_0x7d5ec2[_0x5a24('0x1d')]=qs[_0x5a24('0x1d')](_0x2099bb[_0x5a24('0x32')][_0x5a24('0x1d')]);_0x7d5ec2['offset']=qs[_0x5a24('0x1a')](_0x2099bb['query']['offset']);}_0x7d5ec2[_0x5a24('0x38')]=qs[_0x5a24('0x39')](_0x2099bb[_0x5a24('0x32')][_0x5a24('0x39')]);_0x7d5ec2['where']=qs['filters'](_['pick'](_0x2099bb[_0x5a24('0x32')],_0x25fb1c[_0x5a24('0x30')]),_0x24c8e2);if(_0x2099bb[_0x5a24('0x32')][_0x5a24('0x3a')]){_0x7d5ec2[_0x5a24('0x3b')]=_['merge'](_0x7d5ec2[_0x5a24('0x3b')],{'$or':_[_0x5a24('0x2b')](_0x24c8e2,function(_0x5bbe04){if(_0x5bbe04['type']!==_0x5a24('0x3c')){var _0x2d982b={};_0x2d982b[_0x5bbe04[_0x5a24('0x28')]]={'$like':'%'+_0x2099bb[_0x5a24('0x32')][_0x5a24('0x3a')]+'%'};return _0x2d982b;}})});}_0x7d5ec2=_[_0x5a24('0x3d')]({},_0x7d5ec2,_0x2099bb['options']);var _0x34da13={'where':_0x7d5ec2[_0x5a24('0x3b')]};return db[_0x5a24('0x3e')]['count'](_0x34da13)[_0x5a24('0x25')](function(_0x106db4){_0x30eb46[_0x5a24('0x1c')]=_0x106db4;if(_0x2099bb['query'][_0x5a24('0x3f')]){_0x7d5ec2[_0x5a24('0x40')]=[{'all':!![]}];}return db[_0x5a24('0x3e')]['findAll'](_0x7d5ec2);})[_0x5a24('0x25')](function(_0x1971c3){_0x30eb46[_0x5a24('0x41')]=_0x1971c3;return _0x30eb46;})[_0x5a24('0x25')](respondWithFilteredResult(_0x290fd2,_0x7d5ec2))[_0x5a24('0x42')](handleError(_0x290fd2,null));};exports[_0x5a24('0x43')]=function(_0x32e238,_0x205d34){var _0x2598e0={'raw':![],'where':{'id':_0x32e238[_0x5a24('0x44')]['id']}},_0x19e6fc={};_0x19e6fc[_0x5a24('0x2f')]=_[_0x5a24('0x45')](db[_0x5a24('0x3e')][_0x5a24('0x2c')]);_0x19e6fc[_0x5a24('0x32')]=_[_0x5a24('0x45')](_0x32e238[_0x5a24('0x32')]);_0x19e6fc[_0x5a24('0x30')]=_[_0x5a24('0x31')](_0x19e6fc[_0x5a24('0x2f')],_0x19e6fc[_0x5a24('0x32')]);_0x2598e0[_0x5a24('0x33')]=_[_0x5a24('0x31')](_0x19e6fc['model'],qs[_0x5a24('0x34')](_0x32e238[_0x5a24('0x32')]['fields']));_0x2598e0[_0x5a24('0x33')]=_0x2598e0[_0x5a24('0x33')][_0x5a24('0x35')]?_0x2598e0['attributes']:_0x19e6fc['model'];if(_0x32e238[_0x5a24('0x32')][_0x5a24('0x3f')]){_0x2598e0[_0x5a24('0x40')]=[{'all':!![]}];}_0x2598e0=_[_0x5a24('0x3d')]({},_0x2598e0,_0x32e238[_0x5a24('0x46')]);return db[_0x5a24('0x3e')][_0x5a24('0x47')](_0x2598e0)['then'](handleEntityNotFound(_0x205d34,null))[_0x5a24('0x25')](respondWithResult(_0x205d34,null))[_0x5a24('0x42')](handleError(_0x205d34,null));};exports[_0x5a24('0x48')]=function(_0x2a9eea,_0x252318){return db[_0x5a24('0x3e')]['create'](_0x2a9eea[_0x5a24('0x49')],{})[_0x5a24('0x25')](respondWithResult(_0x252318,0xc9))[_0x5a24('0x42')](handleError(_0x252318,null));};exports[_0x5a24('0x23')]=function(_0xbbbef9,_0x31cbe0){if(_0xbbbef9[_0x5a24('0x49')]['id']){delete _0xbbbef9[_0x5a24('0x49')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0xbbbef9[_0x5a24('0x44')]['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x31cbe0,null))['then'](saveUpdates(_0xbbbef9[_0x5a24('0x49')],null))[_0x5a24('0x25')](respondWithResult(_0x31cbe0,null))['catch'](handleError(_0x31cbe0,null));};exports[_0x5a24('0x24')]=function(_0x26e924,_0x4c383a){return db['FreshsalesConfiguration'][_0x5a24('0x47')]({'where':{'id':_0x26e924[_0x5a24('0x44')]['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x4c383a,null))[_0x5a24('0x25')](removeEntity(_0x4c383a,null))['catch'](handleError(_0x4c383a,null));};exports['getSubjects']=function(_0x10aecd,_0x21d35c,_0x58b146){var _0x1e99f6={};var _0x367824={};var _0x5c1974;var _0x5ac292;return db[_0x5a24('0x3e')][_0x5a24('0x4a')]({'where':{'id':_0x10aecd[_0x5a24('0x44')]['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x21d35c,null))[_0x5a24('0x25')](function(_0x3f7314){if(_0x3f7314){_0x5c1974=_0x3f7314;_0x367824[_0x5a24('0x2f')]=_[_0x5a24('0x45')](db[_0x5a24('0x4b')][_0x5a24('0x2c')]);_0x367824[_0x5a24('0x32')]=_[_0x5a24('0x45')](_0x10aecd[_0x5a24('0x32')]);_0x367824[_0x5a24('0x30')]=_['intersection'](_0x367824['model'],_0x367824[_0x5a24('0x32')]);_0x1e99f6[_0x5a24('0x33')]=_[_0x5a24('0x31')](_0x367824['model'],qs['fields'](_0x10aecd[_0x5a24('0x32')]['fields']));_0x1e99f6[_0x5a24('0x33')]=_0x1e99f6[_0x5a24('0x33')][_0x5a24('0x35')]?_0x1e99f6[_0x5a24('0x33')]:_0x367824[_0x5a24('0x2f')];_0x1e99f6[_0x5a24('0x38')]=qs[_0x5a24('0x39')](_0x10aecd[_0x5a24('0x32')][_0x5a24('0x39')]);_0x1e99f6[_0x5a24('0x3b')]=qs['filters'](_[_0x5a24('0x4c')](_0x10aecd[_0x5a24('0x32')],_0x367824[_0x5a24('0x30')]));if(_0x10aecd['query'][_0x5a24('0x3a')]){_0x1e99f6[_0x5a24('0x3b')]=_[_0x5a24('0x3d')](_0x1e99f6[_0x5a24('0x3b')],{'$or':_[_0x5a24('0x2b')](_0x1e99f6[_0x5a24('0x33')],function(_0x339895){var _0x49443e={};_0x49443e[_0x339895]={'$like':'%'+_0x10aecd['query'][_0x5a24('0x3a')]+'%'};return _0x49443e;})});}_0x1e99f6=_[_0x5a24('0x3d')]({},_0x1e99f6,_0x10aecd['options']);return _0x5c1974[_0x5a24('0x4d')](_0x1e99f6);}})[_0x5a24('0x25')](function(_0x19c2bd){if(_0x19c2bd){_0x5ac292=_0x19c2bd['length'];if(!_0x10aecd[_0x5a24('0x32')][_0x5a24('0x36')](_0x5a24('0x37'))){_0x1e99f6['limit']=qs[_0x5a24('0x1d')](_0x10aecd[_0x5a24('0x32')]['limit']);_0x1e99f6['offset']=qs['offset'](_0x10aecd['query'][_0x5a24('0x1a')]);}return _0x5c1974['getSubjects'](_0x1e99f6);}})['then'](function(_0x43cf15){if(_0x43cf15){return _0x43cf15?{'count':_0x5ac292,'rows':_0x43cf15}:null;}})[_0x5a24('0x25')](respondWithResult(_0x21d35c,null))[_0x5a24('0x42')](handleError(_0x21d35c,null));};exports[_0x5a24('0x4e')]=function(_0x554a44,_0x320a4a,_0x120506){var _0x399417={};var _0x573105={};var _0x517a19;var _0x49d32b;return db[_0x5a24('0x3e')]['findOne']({'where':{'id':_0x554a44['params']['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x320a4a,null))[_0x5a24('0x25')](function(_0x3f6702){if(_0x3f6702){_0x517a19=_0x3f6702;_0x573105[_0x5a24('0x2f')]=_[_0x5a24('0x45')](db[_0x5a24('0x4b')][_0x5a24('0x2c')]);_0x573105[_0x5a24('0x32')]=_['keys'](_0x554a44['query']);_0x573105['filters']=_[_0x5a24('0x31')](_0x573105[_0x5a24('0x2f')],_0x573105[_0x5a24('0x32')]);_0x399417[_0x5a24('0x33')]=_[_0x5a24('0x31')](_0x573105['model'],qs[_0x5a24('0x34')](_0x554a44[_0x5a24('0x32')][_0x5a24('0x34')]));_0x399417['attributes']=_0x399417[_0x5a24('0x33')][_0x5a24('0x35')]?_0x399417[_0x5a24('0x33')]:_0x573105['model'];_0x399417[_0x5a24('0x38')]=qs[_0x5a24('0x39')](_0x554a44[_0x5a24('0x32')][_0x5a24('0x39')]);_0x399417[_0x5a24('0x3b')]=qs['filters'](_[_0x5a24('0x4c')](_0x554a44['query'],_0x573105['filters']));if(_0x554a44[_0x5a24('0x32')][_0x5a24('0x3a')]){_0x399417['where']=_[_0x5a24('0x3d')](_0x399417[_0x5a24('0x3b')],{'$or':_[_0x5a24('0x2b')](_0x399417[_0x5a24('0x33')],function(_0x19e821){var _0x4d96a0={};_0x4d96a0[_0x19e821]={'$like':'%'+_0x554a44[_0x5a24('0x32')][_0x5a24('0x3a')]+'%'};return _0x4d96a0;})});}_0x399417=_[_0x5a24('0x3d')]({},_0x399417,_0x554a44[_0x5a24('0x46')]);return _0x517a19[_0x5a24('0x4e')](_0x399417);}})['then'](function(_0x34416){if(_0x34416){_0x49d32b=_0x34416[_0x5a24('0x35')];if(!_0x554a44[_0x5a24('0x32')][_0x5a24('0x36')]('nolimit')){_0x399417['limit']=qs[_0x5a24('0x1d')](_0x554a44[_0x5a24('0x32')][_0x5a24('0x1d')]);_0x399417[_0x5a24('0x1a')]=qs['offset'](_0x554a44['query']['offset']);}return _0x517a19[_0x5a24('0x4e')](_0x399417);}})[_0x5a24('0x25')](function(_0x1db41b){if(_0x1db41b){return _0x1db41b?{'count':_0x49d32b,'rows':_0x1db41b}:null;}})[_0x5a24('0x25')](respondWithResult(_0x320a4a,null))['catch'](handleError(_0x320a4a,null));};exports[_0x5a24('0x4f')]=function(_0x3d3194,_0x2a3696,_0x258d26){var _0x29b630={};var _0xe7e175={};var _0x2879ab;var _0x19cb99;return db[_0x5a24('0x3e')][_0x5a24('0x4a')]({'where':{'id':_0x3d3194[_0x5a24('0x44')]['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x2a3696,null))['then'](function(_0x41286c){if(_0x41286c){_0x2879ab=_0x41286c;_0xe7e175['model']=_[_0x5a24('0x45')](db[_0x5a24('0x4b')][_0x5a24('0x2c')]);_0xe7e175[_0x5a24('0x32')]=_[_0x5a24('0x45')](_0x3d3194['query']);_0xe7e175['filters']=_[_0x5a24('0x31')](_0xe7e175[_0x5a24('0x2f')],_0xe7e175[_0x5a24('0x32')]);_0x29b630['attributes']=_['intersection'](_0xe7e175['model'],qs['fields'](_0x3d3194[_0x5a24('0x32')]['fields']));_0x29b630[_0x5a24('0x33')]=_0x29b630[_0x5a24('0x33')][_0x5a24('0x35')]?_0x29b630[_0x5a24('0x33')]:_0xe7e175['model'];_0x29b630['order']=qs['sort'](_0x3d3194['query'][_0x5a24('0x39')]);_0x29b630[_0x5a24('0x3b')]=qs[_0x5a24('0x30')](_['pick'](_0x3d3194['query'],_0xe7e175['filters']));if(_0x3d3194[_0x5a24('0x32')][_0x5a24('0x3a')]){_0x29b630['where']=_[_0x5a24('0x3d')](_0x29b630[_0x5a24('0x3b')],{'$or':_[_0x5a24('0x2b')](_0x29b630[_0x5a24('0x33')],function(_0x5d5290){var _0x12812a={};_0x12812a[_0x5d5290]={'$like':'%'+_0x3d3194['query'][_0x5a24('0x3a')]+'%'};return _0x12812a;})});}_0x29b630=_[_0x5a24('0x3d')]({},_0x29b630,_0x3d3194[_0x5a24('0x46')]);return _0x2879ab[_0x5a24('0x4f')](_0x29b630);}})[_0x5a24('0x25')](function(_0x2637ae){if(_0x2637ae){_0x19cb99=_0x2637ae[_0x5a24('0x35')];if(!_0x3d3194[_0x5a24('0x32')][_0x5a24('0x36')](_0x5a24('0x37'))){_0x29b630[_0x5a24('0x1d')]=qs[_0x5a24('0x1d')](_0x3d3194[_0x5a24('0x32')][_0x5a24('0x1d')]);_0x29b630['offset']=qs['offset'](_0x3d3194[_0x5a24('0x32')]['offset']);}return _0x2879ab[_0x5a24('0x4f')](_0x29b630);}})[_0x5a24('0x25')](function(_0xd3920f){if(_0xd3920f){return _0xd3920f?{'count':_0x19cb99,'rows':_0xd3920f}:null;}})[_0x5a24('0x25')](respondWithResult(_0x2a3696,null))['catch'](handleError(_0x2a3696,null));}; \ No newline at end of file +var _0xb48e=['filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll','then','rows','show','include','catch','create','body','update','find','params','getSubjects','findOne','sort','pick','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys'];(function(_0x12a369,_0x152665){var _0x4161eb=function(_0x49fabf){while(--_0x49fabf){_0x12a369['push'](_0x12a369['shift']());}};_0x4161eb(++_0x152665);}(_0xb48e,0x169));var _0xeb48=function(_0x37995f,_0x44ab9e){_0x37995f=_0x37995f-0x0;var _0x426c07=_0xb48e[_0x37995f];return _0x426c07;};'use strict';var emlformat=require(_0xeb48('0x0'));var rimraf=require(_0xeb48('0x1'));var zipdir=require(_0xeb48('0x2'));var jsonpatch=require(_0xeb48('0x3'));var rp=require(_0xeb48('0x4'));var moment=require(_0xeb48('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb48('0x6'));var util=require('util');var path=require(_0xeb48('0x7'));var sox=require(_0xeb48('0x8'));var csv=require(_0xeb48('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb48('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeb48('0xb'));var jsforce=require(_0xeb48('0xc'));var deskjs=require(_0xeb48('0xd'));var toCsv=require(_0xeb48('0x9'));var querystring=require(_0xeb48('0xe'));var Papa=require(_0xeb48('0xf'));var Redis=require(_0xeb48('0x10'));var authService=require(_0xeb48('0x11'));var qs=require(_0xeb48('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb48('0x13'));var logger=require(_0xeb48('0x14'))('api');var utils=require(_0xeb48('0x15'));var config=require(_0xeb48('0x16'));var licenseUtil=require(_0xeb48('0x17'));var db=require(_0xeb48('0x18'))['db'];function respondWithStatusCode(_0x3b43c3,_0x499239){_0x499239=_0x499239||0xcc;return function(_0x5b30b2){if(_0x5b30b2){return _0x3b43c3[_0xeb48('0x19')](_0x499239);}return _0x3b43c3['status'](_0x499239)[_0xeb48('0x1a')]();};}function respondWithResult(_0x890fc2,_0xaacad2){_0xaacad2=_0xaacad2||0xc8;return function(_0x47d156){if(_0x47d156){return _0x890fc2[_0xeb48('0x1b')](_0xaacad2)[_0xeb48('0x1c')](_0x47d156);}};}function respondWithFilteredResult(_0x1a8785,_0x3ef331){return function(_0x53f667){if(_0x53f667){var _0x191613=typeof _0x3ef331[_0xeb48('0x1d')]===_0xeb48('0x1e')&&typeof _0x3ef331[_0xeb48('0x1f')]==='undefined';var _0x53368b=_0x53f667[_0xeb48('0x20')];var _0x50d12c=_0x191613?0x0:_0x3ef331[_0xeb48('0x1d')];var _0x5c2a41=_0x191613?_0x53f667[_0xeb48('0x20')]:_0x3ef331[_0xeb48('0x1d')]+_0x3ef331[_0xeb48('0x1f')];var _0x390704;if(_0x5c2a41>=_0x53368b){_0x5c2a41=_0x53368b;_0x390704=0xc8;}else{_0x390704=0xce;}_0x1a8785[_0xeb48('0x1b')](_0x390704);return _0x1a8785['set'](_0xeb48('0x21'),_0x50d12c+'-'+_0x5c2a41+'/'+_0x53368b)[_0xeb48('0x1c')](_0x53f667);}return null;};}function patchUpdates(_0x14f957){return function(_0x593c1d){try{jsonpatch[_0xeb48('0x22')](_0x593c1d,_0x14f957,!![]);}catch(_0x2d2ee1){return BPromise[_0xeb48('0x23')](_0x2d2ee1);}return _0x593c1d['save']();};}function saveUpdates(_0x575efb,_0x2600fe){return function(_0x57c278){if(_0x57c278){return _0x57c278['update'](_0x575efb)['then'](function(_0x1dc2c8){return _0x1dc2c8;});}return null;};}function removeEntity(_0x5e9cb4,_0x5088b9){return function(_0x3b6e1f){if(_0x3b6e1f){return _0x3b6e1f[_0xeb48('0x24')]()['then'](function(){_0x5e9cb4[_0xeb48('0x1b')](0xcc)[_0xeb48('0x1a')]();});}};}function handleEntityNotFound(_0x199ace,_0x20ae57){return function(_0x31d61b){if(!_0x31d61b){_0x199ace[_0xeb48('0x19')](0x194);}return _0x31d61b;};}function handleError(_0x2b18b4,_0x466249){_0x466249=_0x466249||0x1f4;return function(_0xe8d128){logger[_0xeb48('0x25')](_0xe8d128[_0xeb48('0x26')]);if(_0xe8d128[_0xeb48('0x27')]){delete _0xe8d128['name'];}_0x2b18b4[_0xeb48('0x1b')](_0x466249)[_0xeb48('0x28')](_0xe8d128);};}exports[_0xeb48('0x29')]=function(_0x214b34,_0x41a24a){var _0x22c8a9={},_0x562792={},_0x2d875f={'count':0x0,'rows':[]};var _0x344765=_[_0xeb48('0x2a')](db['FreshsalesConfiguration'][_0xeb48('0x2b')],function(_0x52255d){return{'name':_0x52255d[_0xeb48('0x2c')],'type':_0x52255d[_0xeb48('0x2d')][_0xeb48('0x2e')]};});_0x562792[_0xeb48('0x2f')]=_[_0xeb48('0x2a')](_0x344765,_0xeb48('0x27'));_0x562792['query']=_[_0xeb48('0x30')](_0x214b34['query']);_0x562792[_0xeb48('0x31')]=_['intersection'](_0x562792[_0xeb48('0x2f')],_0x562792[_0xeb48('0x32')]);_0x22c8a9[_0xeb48('0x33')]=_[_0xeb48('0x34')](_0x562792[_0xeb48('0x2f')],qs[_0xeb48('0x35')](_0x214b34['query'][_0xeb48('0x35')]));_0x22c8a9[_0xeb48('0x33')]=_0x22c8a9['attributes'][_0xeb48('0x36')]?_0x22c8a9[_0xeb48('0x33')]:_0x562792[_0xeb48('0x2f')];if(!_0x214b34[_0xeb48('0x32')][_0xeb48('0x37')](_0xeb48('0x38'))){_0x22c8a9['limit']=qs[_0xeb48('0x1f')](_0x214b34[_0xeb48('0x32')]['limit']);_0x22c8a9[_0xeb48('0x1d')]=qs[_0xeb48('0x1d')](_0x214b34['query'][_0xeb48('0x1d')]);}_0x22c8a9[_0xeb48('0x39')]=qs['sort'](_0x214b34['query']['sort']);_0x22c8a9[_0xeb48('0x3a')]=qs[_0xeb48('0x31')](_['pick'](_0x214b34[_0xeb48('0x32')],_0x562792[_0xeb48('0x31')]),_0x344765);if(_0x214b34[_0xeb48('0x32')][_0xeb48('0x3b')]){_0x22c8a9[_0xeb48('0x3a')]=_['merge'](_0x22c8a9['where'],{'$or':_[_0xeb48('0x2a')](_0x344765,function(_0x49ed2b){if(_0x49ed2b[_0xeb48('0x2d')]!==_0xeb48('0x3c')){var _0xdeac06={};_0xdeac06[_0x49ed2b[_0xeb48('0x27')]]={'$like':'%'+_0x214b34[_0xeb48('0x32')]['filter']+'%'};return _0xdeac06;}})});}_0x22c8a9=_[_0xeb48('0x3d')]({},_0x22c8a9,_0x214b34[_0xeb48('0x3e')]);var _0x16adc9={'where':_0x22c8a9[_0xeb48('0x3a')]};return db[_0xeb48('0x3f')][_0xeb48('0x20')](_0x16adc9)['then'](function(_0x2d2a78){_0x2d875f[_0xeb48('0x20')]=_0x2d2a78;if(_0x214b34[_0xeb48('0x32')][_0xeb48('0x40')]){_0x22c8a9['include']=[{'all':!![]}];}return db[_0xeb48('0x3f')]['findAll'](_0x22c8a9);})[_0xeb48('0x41')](function(_0x4f8bd8){_0x2d875f[_0xeb48('0x42')]=_0x4f8bd8;return _0x2d875f;})[_0xeb48('0x41')](respondWithFilteredResult(_0x41a24a,_0x22c8a9))['catch'](handleError(_0x41a24a,null));};exports[_0xeb48('0x43')]=function(_0x58a74a,_0x24399c){var _0x490831={'raw':![],'where':{'id':_0x58a74a['params']['id']}},_0x5bd75f={};_0x5bd75f[_0xeb48('0x2f')]=_[_0xeb48('0x30')](db[_0xeb48('0x3f')][_0xeb48('0x2b')]);_0x5bd75f[_0xeb48('0x32')]=_[_0xeb48('0x30')](_0x58a74a[_0xeb48('0x32')]);_0x5bd75f[_0xeb48('0x31')]=_['intersection'](_0x5bd75f['model'],_0x5bd75f[_0xeb48('0x32')]);_0x490831[_0xeb48('0x33')]=_[_0xeb48('0x34')](_0x5bd75f[_0xeb48('0x2f')],qs[_0xeb48('0x35')](_0x58a74a['query'][_0xeb48('0x35')]));_0x490831[_0xeb48('0x33')]=_0x490831[_0xeb48('0x33')][_0xeb48('0x36')]?_0x490831['attributes']:_0x5bd75f[_0xeb48('0x2f')];if(_0x58a74a[_0xeb48('0x32')][_0xeb48('0x40')]){_0x490831[_0xeb48('0x44')]=[{'all':!![]}];}_0x490831=_['merge']({},_0x490831,_0x58a74a[_0xeb48('0x3e')]);return db[_0xeb48('0x3f')]['find'](_0x490831)[_0xeb48('0x41')](handleEntityNotFound(_0x24399c,null))['then'](respondWithResult(_0x24399c,null))[_0xeb48('0x45')](handleError(_0x24399c,null));};exports[_0xeb48('0x46')]=function(_0x185826,_0x2263bd){return db[_0xeb48('0x3f')][_0xeb48('0x46')](_0x185826[_0xeb48('0x47')],{})[_0xeb48('0x41')](respondWithResult(_0x2263bd,0xc9))['catch'](handleError(_0x2263bd,null));};exports[_0xeb48('0x48')]=function(_0x41b57c,_0x173424){if(_0x41b57c[_0xeb48('0x47')]['id']){delete _0x41b57c[_0xeb48('0x47')]['id'];}return db[_0xeb48('0x3f')][_0xeb48('0x49')]({'where':{'id':_0x41b57c[_0xeb48('0x4a')]['id']}})[_0xeb48('0x41')](handleEntityNotFound(_0x173424,null))[_0xeb48('0x41')](saveUpdates(_0x41b57c[_0xeb48('0x47')],null))[_0xeb48('0x41')](respondWithResult(_0x173424,null))[_0xeb48('0x45')](handleError(_0x173424,null));};exports['destroy']=function(_0x37fd71,_0x1fd4d4){return db[_0xeb48('0x3f')][_0xeb48('0x49')]({'where':{'id':_0x37fd71['params']['id']}})['then'](handleEntityNotFound(_0x1fd4d4,null))[_0xeb48('0x41')](removeEntity(_0x1fd4d4,null))[_0xeb48('0x45')](handleError(_0x1fd4d4,null));};exports[_0xeb48('0x4b')]=function(_0x2822d3,_0xc40bca,_0x178162){var _0x12aa77={};var _0x3f5c65={};var _0x59c051;var _0x3549a7;return db[_0xeb48('0x3f')][_0xeb48('0x4c')]({'where':{'id':_0x2822d3[_0xeb48('0x4a')]['id']}})[_0xeb48('0x41')](handleEntityNotFound(_0xc40bca,null))[_0xeb48('0x41')](function(_0xde6536){if(_0xde6536){_0x59c051=_0xde6536;_0x3f5c65['model']=_[_0xeb48('0x30')](db['FreshsalesField'][_0xeb48('0x2b')]);_0x3f5c65[_0xeb48('0x32')]=_[_0xeb48('0x30')](_0x2822d3[_0xeb48('0x32')]);_0x3f5c65[_0xeb48('0x31')]=_[_0xeb48('0x34')](_0x3f5c65[_0xeb48('0x2f')],_0x3f5c65[_0xeb48('0x32')]);_0x12aa77[_0xeb48('0x33')]=_[_0xeb48('0x34')](_0x3f5c65['model'],qs[_0xeb48('0x35')](_0x2822d3[_0xeb48('0x32')]['fields']));_0x12aa77[_0xeb48('0x33')]=_0x12aa77['attributes']['length']?_0x12aa77[_0xeb48('0x33')]:_0x3f5c65['model'];_0x12aa77['order']=qs[_0xeb48('0x4d')](_0x2822d3[_0xeb48('0x32')][_0xeb48('0x4d')]);_0x12aa77[_0xeb48('0x3a')]=qs[_0xeb48('0x31')](_[_0xeb48('0x4e')](_0x2822d3[_0xeb48('0x32')],_0x3f5c65['filters']));if(_0x2822d3['query'][_0xeb48('0x3b')]){_0x12aa77[_0xeb48('0x3a')]=_[_0xeb48('0x3d')](_0x12aa77[_0xeb48('0x3a')],{'$or':_[_0xeb48('0x2a')](_0x12aa77['attributes'],function(_0x387557){var _0x50610d={};_0x50610d[_0x387557]={'$like':'%'+_0x2822d3[_0xeb48('0x32')][_0xeb48('0x3b')]+'%'};return _0x50610d;})});}_0x12aa77=_[_0xeb48('0x3d')]({},_0x12aa77,_0x2822d3[_0xeb48('0x3e')]);return _0x59c051[_0xeb48('0x4b')](_0x12aa77);}})[_0xeb48('0x41')](function(_0xa54a06){if(_0xa54a06){_0x3549a7=_0xa54a06['length'];if(!_0x2822d3[_0xeb48('0x32')]['hasOwnProperty'](_0xeb48('0x38'))){_0x12aa77['limit']=qs['limit'](_0x2822d3['query']['limit']);_0x12aa77[_0xeb48('0x1d')]=qs[_0xeb48('0x1d')](_0x2822d3[_0xeb48('0x32')]['offset']);}return _0x59c051[_0xeb48('0x4b')](_0x12aa77);}})[_0xeb48('0x41')](function(_0x2aaea0){if(_0x2aaea0){return _0x2aaea0?{'count':_0x3549a7,'rows':_0x2aaea0}:null;}})[_0xeb48('0x41')](respondWithResult(_0xc40bca,null))['catch'](handleError(_0xc40bca,null));};exports[_0xeb48('0x4f')]=function(_0x567c86,_0x4ba9e5,_0x5ade4c){var _0x458b35={};var _0x50525c={};var _0x49f565;var _0xb4f0fa;return db['FreshsalesConfiguration'][_0xeb48('0x4c')]({'where':{'id':_0x567c86[_0xeb48('0x4a')]['id']}})[_0xeb48('0x41')](handleEntityNotFound(_0x4ba9e5,null))[_0xeb48('0x41')](function(_0x50515d){if(_0x50515d){_0x49f565=_0x50515d;_0x50525c['model']=_[_0xeb48('0x30')](db[_0xeb48('0x50')][_0xeb48('0x2b')]);_0x50525c[_0xeb48('0x32')]=_['keys'](_0x567c86[_0xeb48('0x32')]);_0x50525c[_0xeb48('0x31')]=_[_0xeb48('0x34')](_0x50525c['model'],_0x50525c[_0xeb48('0x32')]);_0x458b35[_0xeb48('0x33')]=_[_0xeb48('0x34')](_0x50525c[_0xeb48('0x2f')],qs[_0xeb48('0x35')](_0x567c86[_0xeb48('0x32')][_0xeb48('0x35')]));_0x458b35[_0xeb48('0x33')]=_0x458b35[_0xeb48('0x33')][_0xeb48('0x36')]?_0x458b35[_0xeb48('0x33')]:_0x50525c[_0xeb48('0x2f')];_0x458b35[_0xeb48('0x39')]=qs[_0xeb48('0x4d')](_0x567c86[_0xeb48('0x32')]['sort']);_0x458b35[_0xeb48('0x3a')]=qs['filters'](_[_0xeb48('0x4e')](_0x567c86[_0xeb48('0x32')],_0x50525c[_0xeb48('0x31')]));if(_0x567c86[_0xeb48('0x32')][_0xeb48('0x3b')]){_0x458b35[_0xeb48('0x3a')]=_['merge'](_0x458b35[_0xeb48('0x3a')],{'$or':_[_0xeb48('0x2a')](_0x458b35['attributes'],function(_0x4dda7f){var _0x535cb3={};_0x535cb3[_0x4dda7f]={'$like':'%'+_0x567c86[_0xeb48('0x32')][_0xeb48('0x3b')]+'%'};return _0x535cb3;})});}_0x458b35=_['merge']({},_0x458b35,_0x567c86['options']);return _0x49f565[_0xeb48('0x4f')](_0x458b35);}})[_0xeb48('0x41')](function(_0x260fa1){if(_0x260fa1){_0xb4f0fa=_0x260fa1['length'];if(!_0x567c86[_0xeb48('0x32')][_0xeb48('0x37')]('nolimit')){_0x458b35[_0xeb48('0x1f')]=qs[_0xeb48('0x1f')](_0x567c86[_0xeb48('0x32')]['limit']);_0x458b35[_0xeb48('0x1d')]=qs[_0xeb48('0x1d')](_0x567c86[_0xeb48('0x32')][_0xeb48('0x1d')]);}return _0x49f565['getDescriptions'](_0x458b35);}})[_0xeb48('0x41')](function(_0x224f21){if(_0x224f21){return _0x224f21?{'count':_0xb4f0fa,'rows':_0x224f21}:null;}})[_0xeb48('0x41')](respondWithResult(_0x4ba9e5,null))[_0xeb48('0x45')](handleError(_0x4ba9e5,null));};exports[_0xeb48('0x51')]=function(_0x267d7f,_0x22ffcd,_0x416ea1){var _0xa7b759={};var _0x46952e={};var _0x3d71e4;var _0x4117b0;return db['FreshsalesConfiguration'][_0xeb48('0x4c')]({'where':{'id':_0x267d7f[_0xeb48('0x4a')]['id']}})['then'](handleEntityNotFound(_0x22ffcd,null))['then'](function(_0x199964){if(_0x199964){_0x3d71e4=_0x199964;_0x46952e[_0xeb48('0x2f')]=_[_0xeb48('0x30')](db[_0xeb48('0x50')]['rawAttributes']);_0x46952e[_0xeb48('0x32')]=_[_0xeb48('0x30')](_0x267d7f[_0xeb48('0x32')]);_0x46952e[_0xeb48('0x31')]=_[_0xeb48('0x34')](_0x46952e[_0xeb48('0x2f')],_0x46952e[_0xeb48('0x32')]);_0xa7b759[_0xeb48('0x33')]=_[_0xeb48('0x34')](_0x46952e[_0xeb48('0x2f')],qs[_0xeb48('0x35')](_0x267d7f['query'][_0xeb48('0x35')]));_0xa7b759[_0xeb48('0x33')]=_0xa7b759[_0xeb48('0x33')][_0xeb48('0x36')]?_0xa7b759['attributes']:_0x46952e[_0xeb48('0x2f')];_0xa7b759[_0xeb48('0x39')]=qs['sort'](_0x267d7f[_0xeb48('0x32')][_0xeb48('0x4d')]);_0xa7b759[_0xeb48('0x3a')]=qs['filters'](_[_0xeb48('0x4e')](_0x267d7f['query'],_0x46952e[_0xeb48('0x31')]));if(_0x267d7f[_0xeb48('0x32')][_0xeb48('0x3b')]){_0xa7b759['where']=_[_0xeb48('0x3d')](_0xa7b759[_0xeb48('0x3a')],{'$or':_['map'](_0xa7b759[_0xeb48('0x33')],function(_0x27a1be){var _0x45f6bd={};_0x45f6bd[_0x27a1be]={'$like':'%'+_0x267d7f[_0xeb48('0x32')]['filter']+'%'};return _0x45f6bd;})});}_0xa7b759=_['merge']({},_0xa7b759,_0x267d7f[_0xeb48('0x3e')]);return _0x3d71e4[_0xeb48('0x51')](_0xa7b759);}})[_0xeb48('0x41')](function(_0x4b4812){if(_0x4b4812){_0x4117b0=_0x4b4812[_0xeb48('0x36')];if(!_0x267d7f[_0xeb48('0x32')][_0xeb48('0x37')](_0xeb48('0x38'))){_0xa7b759[_0xeb48('0x1f')]=qs[_0xeb48('0x1f')](_0x267d7f[_0xeb48('0x32')][_0xeb48('0x1f')]);_0xa7b759['offset']=qs[_0xeb48('0x1d')](_0x267d7f[_0xeb48('0x32')][_0xeb48('0x1d')]);}return _0x3d71e4[_0xeb48('0x51')](_0xa7b759);}})[_0xeb48('0x41')](function(_0x5c4f4c){if(_0x5c4f4c){return _0x5c4f4c?{'count':_0x4117b0,'rows':_0x5c4f4c}:null;}})[_0xeb48('0x41')](respondWithResult(_0x22ffcd,null))[_0xeb48('0x45')](handleError(_0x22ffcd,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9874b0d..bcf1107 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 _0x7ae3=['exports','FreshsalesConfiguration','util','../../config/logger','api','moment','path','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x7ae3,0x185));var _0x37ae=function(_0x45bee1,_0x4267e6){_0x45bee1=_0x45bee1-0x0;var _0x101884=_0x7ae3[_0x45bee1];return _0x101884;};'use strict';var _=require('lodash');var util=require(_0x37ae('0x0'));var logger=require(_0x37ae('0x1'))(_0x37ae('0x2'));var moment=require(_0x37ae('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37ae('0x4'));var rimraf=require('rimraf');var config=require(_0x37ae('0x5'));var attributes=require(_0x37ae('0x6'));module[_0x37ae('0x7')]=function(_0x264933,_0x4e3ea5){return _0x264933['define'](_0x37ae('0x8'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a3e=['bluebird','request-promise','path','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api'];(function(_0xead639,_0x58a241){var _0x4e5b2b=function(_0x2b17c1){while(--_0x2b17c1){_0xead639['push'](_0xead639['shift']());}};_0x4e5b2b(++_0x58a241);}(_0x2a3e,0xf0));var _0xe2a3=function(_0x216689,_0x52b5e3){_0x216689=_0x216689-0x0;var _0xbea7a8=_0x2a3e[_0x216689];return _0xbea7a8;};'use strict';var _=require(_0xe2a3('0x0'));var util=require(_0xe2a3('0x1'));var logger=require('../../config/logger')(_0xe2a3('0x2'));var moment=require('moment');var BPromise=require(_0xe2a3('0x3'));var rp=require(_0xe2a3('0x4'));var fs=require('fs');var path=require(_0xe2a3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xe2a3('0x6')]=function(_0x515aca,_0x13524f){return _0x515aca['define'](_0xe2a3('0x7'),attributes,{'tableName':_0xe2a3('0x8'),'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 18a2f42..5d9913d 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 _0x0a83=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0a83,0x16d));var _0x30a8=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x0a83[_0xb833b1];return _0x1ab87a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30a8('0x0'));var BPromise=require(_0x30a8('0x1'));var rs=require(_0x30a8('0x2'));var fs=require('fs');var Redis=require(_0x30a8('0x3'));var db=require(_0x30a8('0x4'))['db'];var utils=require(_0x30a8('0x5'));var logger=require(_0x30a8('0x6'))(_0x30a8('0x7'));var config=require(_0x30a8('0x8'));var jayson=require(_0x30a8('0x9'));var client=jayson[_0x30a8('0xa')][_0x30a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46886f,_0x198198,_0x48ccf7){return new BPromise(function(_0x5d75bb,_0x7b2c4f){return client[_0x30a8('0xc')](_0x46886f,_0x48ccf7)['then'](function(_0x4ecd8a){logger[_0x30a8('0xd')](_0x30a8('0xe'),_0x198198,'request\x20sent');logger[_0x30a8('0xf')](_0x30a8('0x10'),_0x198198,_0x30a8('0x11'),JSON[_0x30a8('0x12')](_0x4ecd8a));if(_0x4ecd8a[_0x30a8('0x13')]){if(_0x4ecd8a[_0x30a8('0x13')]['code']===0x1f4){logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x4ecd8a[_0x30a8('0x13')][_0x30a8('0x14')]);return _0x7b2c4f(_0x4ecd8a[_0x30a8('0x13')]['message']);}logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x4ecd8a['error'][_0x30a8('0x14')]);return _0x5d75bb(_0x4ecd8a[_0x30a8('0x13')][_0x30a8('0x14')]);}else{logger[_0x30a8('0xd')](_0x30a8('0xe'),_0x198198,'request\x20sent');_0x5d75bb(_0x4ecd8a[_0x30a8('0x15')][_0x30a8('0x14')]);}})[_0x30a8('0x16')](function(_0x3a3652){logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x3a3652);_0x7b2c4f(_0x3a3652);});});} \ No newline at end of file +var _0xe8e4=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird'];(function(_0x1b5fff,_0x4a7dad){var _0x31cc64=function(_0x5d8eb1){while(--_0x5d8eb1){_0x1b5fff['push'](_0x1b5fff['shift']());}};_0x31cc64(++_0x4a7dad);}(_0xe8e4,0x162));var _0x4e8e=function(_0x476b1b,_0x3f75f6){_0x476b1b=_0x476b1b-0x0;var _0x16bd83=_0xe8e4[_0x476b1b];return _0x16bd83;};'use strict';var _=require(_0x4e8e('0x0'));var util=require(_0x4e8e('0x1'));var moment=require('moment');var BPromise=require(_0x4e8e('0x2'));var rs=require(_0x4e8e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e8e('0x4'))['db'];var utils=require(_0x4e8e('0x5'));var logger=require(_0x4e8e('0x6'))(_0x4e8e('0x7'));var config=require('../../config/environment');var jayson=require(_0x4e8e('0x8'));var client=jayson[_0x4e8e('0x9')][_0x4e8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x204af0,_0x32ea8b,_0x55970d){return new BPromise(function(_0x2a2d9d,_0x3dde32){return client[_0x4e8e('0xb')](_0x204af0,_0x55970d)['then'](function(_0x3bd512){logger[_0x4e8e('0xc')](_0x4e8e('0xd'),_0x32ea8b,_0x4e8e('0xe'));logger[_0x4e8e('0xf')](_0x4e8e('0x10'),_0x32ea8b,_0x4e8e('0xe'),JSON['stringify'](_0x3bd512));if(_0x3bd512[_0x4e8e('0x11')]){if(_0x3bd512[_0x4e8e('0x11')][_0x4e8e('0x12')]===0x1f4){logger['error'](_0x4e8e('0xd'),_0x32ea8b,_0x3bd512[_0x4e8e('0x11')][_0x4e8e('0x13')]);return _0x3dde32(_0x3bd512['error'][_0x4e8e('0x13')]);}logger[_0x4e8e('0x11')](_0x4e8e('0xd'),_0x32ea8b,_0x3bd512[_0x4e8e('0x11')]['message']);return _0x2a2d9d(_0x3bd512[_0x4e8e('0x11')][_0x4e8e('0x13')]);}else{logger[_0x4e8e('0xc')](_0x4e8e('0xd'),_0x32ea8b,'request\x20sent');_0x2a2d9d(_0x3bd512[_0x4e8e('0x14')]['message']);}})['catch'](function(_0x1f817c){logger[_0x4e8e('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x32ea8b,_0x1f817c);_0x3dde32(_0x1f817c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7620689..d68985f 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 _0xe64a=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','show','post'];(function(_0x1ca361,_0x573b1c){var _0x454618=function(_0x50531a){while(--_0x50531a){_0x1ca361['push'](_0x1ca361['shift']());}};_0x454618(++_0x573b1c);}(_0xe64a,0x1e0));var _0xae64=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe64a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var path=require(_0xae64('0x2'));var timeout=require(_0xae64('0x3'));var express=require(_0xae64('0x4'));var router=express[_0xae64('0x5')]();var fs_extra=require(_0xae64('0x6'));var auth=require(_0xae64('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xae64('0x8')](),controller[_0xae64('0x9')]);router[_0xae64('0xa')](_0xae64('0xb'),auth[_0xae64('0x8')](),controller[_0xae64('0xc')]);router[_0xae64('0xd')]('/',auth[_0xae64('0x8')](),controller[_0xae64('0xe')]);router[_0xae64('0xf')](_0xae64('0xb'),auth['isAuthenticated'](),controller[_0xae64('0x10')]);router['delete']('/:id',auth[_0xae64('0x8')](),controller[_0xae64('0x11')]);module[_0xae64('0x12')]=router; \ No newline at end of file +var _0x9567=['../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','get','/:id','show','create','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xe10254,_0x54a924){var _0x286ef9=function(_0x169e41){while(--_0x169e41){_0xe10254['push'](_0xe10254['shift']());}};_0x286ef9(++_0x54a924);}(_0x9567,0xdc));var _0x7956=function(_0x95c465,_0x1f7f82){_0x95c465=_0x95c465-0x0;var _0x386c2d=_0x9567[_0x95c465];return _0x386c2d;};'use strict';var multer=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var path=require(_0x7956('0x2'));var timeout=require(_0x7956('0x3'));var express=require(_0x7956('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7956('0x5'));var interaction=require(_0x7956('0x6'));var config=require('../../config/environment');var controller=require(_0x7956('0x7'));router['get']('/',auth[_0x7956('0x8')](),controller['index']);router[_0x7956('0x9')](_0x7956('0xa'),auth['isAuthenticated'](),controller[_0x7956('0xb')]);router['post']('/',auth[_0x7956('0x8')](),controller[_0x7956('0xc')]);router['put'](_0x7956('0xa'),auth[_0x7956('0x8')](),controller['update']);router[_0x7956('0xd')](_0x7956('0xa'),auth[_0x7956('0x8')](),controller['destroy']);module[_0x7956('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index fc273f4..1740786 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 _0x4676=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist','STRING'];(function(_0x3d1b84,_0x36ecb2){var _0x9d757=function(_0x267e26){while(--_0x267e26){_0x3d1b84['push'](_0x3d1b84['shift']());}};_0x9d757(++_0x36ecb2);}(_0x4676,0x1c4));var _0x6467=function(_0xaae166,_0xa5e4db){_0xaae166=_0xaae166-0x0;var _0x4b34bf=_0x4676[_0xaae166];return _0x4b34bf;};'use strict';var Sequelize=require(_0x6467('0x0'));module[_0x6467('0x1')]={'type':{'type':Sequelize[_0x6467('0x2')](_0x6467('0x3'),'variable',_0x6467('0x4'),'keyValue',_0x6467('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6467('0x6')]},'key':{'type':Sequelize[_0x6467('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6467('0x7'),_0x6467('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6467('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6467('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6467('0x6')]}}; \ No newline at end of file +var _0x63bf=['sequelize','exports','string','keyValue','picklist','STRING','ENUM','customVariable'];(function(_0x18d565,_0x51fc8c){var _0x17f844=function(_0x6cd19){while(--_0x6cd19){_0x18d565['push'](_0x18d565['shift']());}};_0x17f844(++_0x51fc8c);}(_0x63bf,0x80));var _0xf63b=function(_0x48404e,_0x56301d){_0x48404e=_0x48404e-0x0;var _0x3ef9f4=_0x63bf[_0x48404e];return _0x3ef9f4;};'use strict';var Sequelize=require(_0xf63b('0x0'));module[_0xf63b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf63b('0x2'),'variable','customVariable',_0xf63b('0x3'),_0xf63b('0x4')),'defaultValue':_0xf63b('0x2')},'content':{'type':Sequelize[_0xf63b('0x5')]},'key':{'type':Sequelize[_0xf63b('0x5')]},'keyType':{'type':Sequelize[_0xf63b('0x6')](_0xf63b('0x2'),'variable',_0xf63b('0x7'))},'keyContent':{'type':Sequelize[_0xf63b('0x5')]},'idField':{'type':Sequelize[_0xf63b('0x5')]},'nameField':{'type':Sequelize[_0xf63b('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf63b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c8bfdcc..41a76f8 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 _0xcda8=['limit','count','set','Content-Range','apply','reject','destroy','end','error','stack','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','then','rows','catch','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x44f65c,_0x55e30c){var _0x4d9573=function(_0x2055cf){while(--_0x2055cf){_0x44f65c['push'](_0x44f65c['shift']());}};_0x4d9573(++_0x55e30c);}(_0xcda8,0x10a));var _0x8cda=function(_0x1952e6,_0x20b617){_0x1952e6=_0x1952e6-0x0;var _0x5d8f9d=_0xcda8[_0x1952e6];return _0x5d8f9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cda('0x0'));var zipdir=require(_0x8cda('0x1'));var jsonpatch=require(_0x8cda('0x2'));var rp=require(_0x8cda('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cda('0x4'));var util=require(_0x8cda('0x5'));var path=require(_0x8cda('0x6'));var sox=require(_0x8cda('0x7'));var csv=require(_0x8cda('0x8'));var ejs=require(_0x8cda('0x9'));var fs=require('fs');var fs_extra=require(_0x8cda('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8cda('0xb'));var jsforce=require(_0x8cda('0xc'));var deskjs=require(_0x8cda('0xd'));var toCsv=require(_0x8cda('0x8'));var querystring=require('querystring');var Papa=require(_0x8cda('0xe'));var Redis=require(_0x8cda('0xf'));var authService=require(_0x8cda('0x10'));var qs=require(_0x8cda('0x11'));var as=require(_0x8cda('0x12'));var hardwareService=require(_0x8cda('0x13'));var logger=require(_0x8cda('0x14'))(_0x8cda('0x15'));var utils=require(_0x8cda('0x16'));var config=require(_0x8cda('0x17'));var licenseUtil=require(_0x8cda('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36c364,_0x205498){_0x205498=_0x205498||0xcc;return function(_0x365a04){if(_0x365a04){return _0x36c364[_0x8cda('0x19')](_0x205498);}return _0x36c364[_0x8cda('0x1a')](_0x205498)['end']();};}function respondWithResult(_0x5905ae,_0x191910){_0x191910=_0x191910||0xc8;return function(_0x4b8b08){if(_0x4b8b08){return _0x5905ae['status'](_0x191910)[_0x8cda('0x1b')](_0x4b8b08);}};}function respondWithFilteredResult(_0x20c83a,_0x513b04){return function(_0x50562a){if(_0x50562a){var _0x345e73=typeof _0x513b04[_0x8cda('0x1c')]===_0x8cda('0x1d')&&typeof _0x513b04[_0x8cda('0x1e')]===_0x8cda('0x1d');var _0x38c502=_0x50562a[_0x8cda('0x1f')];var _0xd723=_0x345e73?0x0:_0x513b04['offset'];var _0xa73631=_0x345e73?_0x50562a['count']:_0x513b04[_0x8cda('0x1c')]+_0x513b04[_0x8cda('0x1e')];var _0x4f7aa6;if(_0xa73631>=_0x38c502){_0xa73631=_0x38c502;_0x4f7aa6=0xc8;}else{_0x4f7aa6=0xce;}_0x20c83a['status'](_0x4f7aa6);return _0x20c83a[_0x8cda('0x20')](_0x8cda('0x21'),_0xd723+'-'+_0xa73631+'/'+_0x38c502)[_0x8cda('0x1b')](_0x50562a);}return null;};}function patchUpdates(_0xd35b31){return function(_0x4761f4){try{jsonpatch[_0x8cda('0x22')](_0x4761f4,_0xd35b31,!![]);}catch(_0x3e7d4e){return BPromise[_0x8cda('0x23')](_0x3e7d4e);}return _0x4761f4['save']();};}function saveUpdates(_0x519542,_0x5a064d){return function(_0x4efbdd){if(_0x4efbdd){return _0x4efbdd['update'](_0x519542)['then'](function(_0x21c4a5){return _0x21c4a5;});}return null;};}function removeEntity(_0x174543,_0x2e9476){return function(_0x3e0361){if(_0x3e0361){return _0x3e0361[_0x8cda('0x24')]()['then'](function(){_0x174543[_0x8cda('0x1a')](0xcc)[_0x8cda('0x25')]();});}};}function handleEntityNotFound(_0xa29f17,_0x44dd67){return function(_0x28d246){if(!_0x28d246){_0xa29f17[_0x8cda('0x19')](0x194);}return _0x28d246;};}function handleError(_0x4abff6,_0x10ebaf){_0x10ebaf=_0x10ebaf||0x1f4;return function(_0x541053){logger[_0x8cda('0x26')](_0x541053[_0x8cda('0x27')]);if(_0x541053['name']){delete _0x541053['name'];}_0x4abff6[_0x8cda('0x1a')](_0x10ebaf)[_0x8cda('0x28')](_0x541053);};}exports[_0x8cda('0x29')]=function(_0x5e174b,_0x2a1a81){var _0x81f55e={},_0x24db6e={},_0x5881e3={'count':0x0,'rows':[]};var _0x87882c=_[_0x8cda('0x2a')](db[_0x8cda('0x2b')][_0x8cda('0x2c')],function(_0x5d46ae){return{'name':_0x5d46ae[_0x8cda('0x2d')],'type':_0x5d46ae[_0x8cda('0x2e')][_0x8cda('0x2f')]};});_0x24db6e[_0x8cda('0x30')]=_['map'](_0x87882c,_0x8cda('0x31'));_0x24db6e[_0x8cda('0x32')]=_['keys'](_0x5e174b[_0x8cda('0x32')]);_0x24db6e[_0x8cda('0x33')]=_['intersection'](_0x24db6e[_0x8cda('0x30')],_0x24db6e[_0x8cda('0x32')]);_0x81f55e['attributes']=_[_0x8cda('0x34')](_0x24db6e[_0x8cda('0x30')],qs[_0x8cda('0x35')](_0x5e174b[_0x8cda('0x32')][_0x8cda('0x35')]));_0x81f55e[_0x8cda('0x36')]=_0x81f55e[_0x8cda('0x36')][_0x8cda('0x37')]?_0x81f55e[_0x8cda('0x36')]:_0x24db6e[_0x8cda('0x30')];if(!_0x5e174b[_0x8cda('0x32')][_0x8cda('0x38')](_0x8cda('0x39'))){_0x81f55e[_0x8cda('0x1e')]=qs[_0x8cda('0x1e')](_0x5e174b[_0x8cda('0x32')]['limit']);_0x81f55e[_0x8cda('0x1c')]=qs['offset'](_0x5e174b[_0x8cda('0x32')][_0x8cda('0x1c')]);}_0x81f55e[_0x8cda('0x3a')]=qs['sort'](_0x5e174b[_0x8cda('0x32')][_0x8cda('0x3b')]);_0x81f55e['where']=qs[_0x8cda('0x33')](_['pick'](_0x5e174b[_0x8cda('0x32')],_0x24db6e[_0x8cda('0x33')]),_0x87882c);if(_0x5e174b[_0x8cda('0x32')][_0x8cda('0x3c')]){_0x81f55e[_0x8cda('0x3d')]=_[_0x8cda('0x3e')](_0x81f55e[_0x8cda('0x3d')],{'$or':_[_0x8cda('0x2a')](_0x87882c,function(_0x53935d){if(_0x53935d['type']!==_0x8cda('0x3f')){var _0xf35344={};_0xf35344[_0x53935d[_0x8cda('0x31')]]={'$like':'%'+_0x5e174b[_0x8cda('0x32')][_0x8cda('0x3c')]+'%'};return _0xf35344;}})});}_0x81f55e=_[_0x8cda('0x3e')]({},_0x81f55e,_0x5e174b[_0x8cda('0x40')]);var _0x3b5073={'where':_0x81f55e[_0x8cda('0x3d')]};return db['FreshsalesField'][_0x8cda('0x1f')](_0x3b5073)['then'](function(_0x4a32bb){_0x5881e3[_0x8cda('0x1f')]=_0x4a32bb;if(_0x5e174b[_0x8cda('0x32')][_0x8cda('0x41')]){_0x81f55e['include']=[{'all':!![]}];}return db[_0x8cda('0x2b')]['findAll'](_0x81f55e);})[_0x8cda('0x42')](function(_0x25aeb8){_0x5881e3[_0x8cda('0x43')]=_0x25aeb8;return _0x5881e3;})[_0x8cda('0x42')](respondWithFilteredResult(_0x2a1a81,_0x81f55e))[_0x8cda('0x44')](handleError(_0x2a1a81,null));};exports['show']=function(_0x2e5c0f,_0x598403){var _0xb6619a={'raw':!![],'where':{'id':_0x2e5c0f[_0x8cda('0x45')]['id']}},_0x194bc9={};_0x194bc9[_0x8cda('0x30')]=_[_0x8cda('0x46')](db['FreshsalesField'][_0x8cda('0x2c')]);_0x194bc9['query']=_[_0x8cda('0x46')](_0x2e5c0f[_0x8cda('0x32')]);_0x194bc9[_0x8cda('0x33')]=_[_0x8cda('0x34')](_0x194bc9['model'],_0x194bc9[_0x8cda('0x32')]);_0xb6619a[_0x8cda('0x36')]=_['intersection'](_0x194bc9[_0x8cda('0x30')],qs['fields'](_0x2e5c0f[_0x8cda('0x32')][_0x8cda('0x35')]));_0xb6619a[_0x8cda('0x36')]=_0xb6619a[_0x8cda('0x36')][_0x8cda('0x37')]?_0xb6619a['attributes']:_0x194bc9[_0x8cda('0x30')];if(_0x2e5c0f[_0x8cda('0x32')][_0x8cda('0x41')]){_0xb6619a['include']=[{'all':!![]}];}_0xb6619a=_[_0x8cda('0x3e')]({},_0xb6619a,_0x2e5c0f[_0x8cda('0x40')]);return db[_0x8cda('0x2b')][_0x8cda('0x47')](_0xb6619a)['then'](handleEntityNotFound(_0x598403,null))['then'](respondWithResult(_0x598403,null))['catch'](handleError(_0x598403,null));};exports[_0x8cda('0x48')]=function(_0x420fa1,_0x5b8dab){return db[_0x8cda('0x2b')]['create'](_0x420fa1['body'],{})[_0x8cda('0x42')](respondWithResult(_0x5b8dab,0xc9))[_0x8cda('0x44')](handleError(_0x5b8dab,null));};exports['update']=function(_0x24649b,_0x32d92f){if(_0x24649b[_0x8cda('0x49')]['id']){delete _0x24649b['body']['id'];}return db[_0x8cda('0x2b')][_0x8cda('0x47')]({'where':{'id':_0x24649b[_0x8cda('0x45')]['id']}})[_0x8cda('0x42')](handleEntityNotFound(_0x32d92f,null))[_0x8cda('0x42')](saveUpdates(_0x24649b[_0x8cda('0x49')],null))[_0x8cda('0x42')](respondWithResult(_0x32d92f,null))[_0x8cda('0x44')](handleError(_0x32d92f,null));};exports['destroy']=function(_0x50b796,_0x470421){return db[_0x8cda('0x2b')][_0x8cda('0x47')]({'where':{'id':_0x50b796[_0x8cda('0x45')]['id']}})[_0x8cda('0x42')](handleEntityNotFound(_0x470421,null))['then'](removeEntity(_0x470421,null))[_0x8cda('0x44')](handleError(_0x470421,null));}; \ No newline at end of file +var _0x5439=['count','limit','set','reject','save','update','then','destroy','end','error','stack','name','index','map','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshsalesField','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x57ec1a,_0x2b7624){var _0x2159ad=function(_0x4738b4){while(--_0x4738b4){_0x57ec1a['push'](_0x57ec1a['shift']());}};_0x2159ad(++_0x2b7624);}(_0x5439,0x158));var _0x9543=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5439[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x9543('0x0'));var rimraf=require(_0x9543('0x1'));var zipdir=require(_0x9543('0x2'));var jsonpatch=require(_0x9543('0x3'));var rp=require(_0x9543('0x4'));var moment=require(_0x9543('0x5'));var BPromise=require(_0x9543('0x6'));var Mustache=require(_0x9543('0x7'));var util=require(_0x9543('0x8'));var path=require(_0x9543('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9543('0xa'));var fs=require('fs');var fs_extra=require(_0x9543('0xb'));var _=require(_0x9543('0xc'));var squel=require('squel');var crypto=require(_0x9543('0xd'));var jsforce=require(_0x9543('0xe'));var deskjs=require(_0x9543('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9543('0x10'));var Papa=require(_0x9543('0x11'));var Redis=require(_0x9543('0x12'));var authService=require(_0x9543('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9543('0x14'));var hardwareService=require(_0x9543('0x15'));var logger=require(_0x9543('0x16'))('api');var utils=require(_0x9543('0x17'));var config=require(_0x9543('0x18'));var licenseUtil=require(_0x9543('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cebd5,_0xe1acfe){_0xe1acfe=_0xe1acfe||0xcc;return function(_0x5074b2){if(_0x5074b2){return _0x2cebd5[_0x9543('0x1a')](_0xe1acfe);}return _0x2cebd5[_0x9543('0x1b')](_0xe1acfe)['end']();};}function respondWithResult(_0x20a874,_0x4f82fb){_0x4f82fb=_0x4f82fb||0xc8;return function(_0x3b3595){if(_0x3b3595){return _0x20a874[_0x9543('0x1b')](_0x4f82fb)[_0x9543('0x1c')](_0x3b3595);}};}function respondWithFilteredResult(_0x1bc106,_0x19f2a5){return function(_0x15b77d){if(_0x15b77d){var _0x2df824=typeof _0x19f2a5[_0x9543('0x1d')]===_0x9543('0x1e')&&typeof _0x19f2a5['limit']===_0x9543('0x1e');var _0x17c863=_0x15b77d[_0x9543('0x1f')];var _0x2e2fa5=_0x2df824?0x0:_0x19f2a5[_0x9543('0x1d')];var _0x2aea59=_0x2df824?_0x15b77d[_0x9543('0x1f')]:_0x19f2a5[_0x9543('0x1d')]+_0x19f2a5[_0x9543('0x20')];var _0x252b1c;if(_0x2aea59>=_0x17c863){_0x2aea59=_0x17c863;_0x252b1c=0xc8;}else{_0x252b1c=0xce;}_0x1bc106['status'](_0x252b1c);return _0x1bc106[_0x9543('0x21')]('Content-Range',_0x2e2fa5+'-'+_0x2aea59+'/'+_0x17c863)[_0x9543('0x1c')](_0x15b77d);}return null;};}function patchUpdates(_0x88f151){return function(_0x55c237){try{jsonpatch['apply'](_0x55c237,_0x88f151,!![]);}catch(_0x4dbb12){return BPromise[_0x9543('0x22')](_0x4dbb12);}return _0x55c237[_0x9543('0x23')]();};}function saveUpdates(_0x1c308e,_0x4f8609){return function(_0x1e24b9){if(_0x1e24b9){return _0x1e24b9[_0x9543('0x24')](_0x1c308e)[_0x9543('0x25')](function(_0x5b414e){return _0x5b414e;});}return null;};}function removeEntity(_0x272218,_0x5e0388){return function(_0x3b66e8){if(_0x3b66e8){return _0x3b66e8[_0x9543('0x26')]()[_0x9543('0x25')](function(){_0x272218[_0x9543('0x1b')](0xcc)[_0x9543('0x27')]();});}};}function handleEntityNotFound(_0x16f627,_0x27bcec){return function(_0x21d5ff){if(!_0x21d5ff){_0x16f627['sendStatus'](0x194);}return _0x21d5ff;};}function handleError(_0x5934fb,_0x365cf7){_0x365cf7=_0x365cf7||0x1f4;return function(_0x49f080){logger[_0x9543('0x28')](_0x49f080[_0x9543('0x29')]);if(_0x49f080[_0x9543('0x2a')]){delete _0x49f080[_0x9543('0x2a')];}_0x5934fb[_0x9543('0x1b')](_0x365cf7)['send'](_0x49f080);};}exports[_0x9543('0x2b')]=function(_0x1218d2,_0x5067d7){var _0x455e11={},_0x1432c5={},_0x358353={'count':0x0,'rows':[]};var _0xb8714c=_[_0x9543('0x2c')](db['FreshsalesField']['rawAttributes'],function(_0x641964){return{'name':_0x641964['fieldName'],'type':_0x641964[_0x9543('0x2d')][_0x9543('0x2e')]};});_0x1432c5['model']=_[_0x9543('0x2c')](_0xb8714c,_0x9543('0x2a'));_0x1432c5[_0x9543('0x2f')]=_[_0x9543('0x30')](_0x1218d2['query']);_0x1432c5['filters']=_[_0x9543('0x31')](_0x1432c5[_0x9543('0x32')],_0x1432c5['query']);_0x455e11[_0x9543('0x33')]=_['intersection'](_0x1432c5[_0x9543('0x32')],qs[_0x9543('0x34')](_0x1218d2[_0x9543('0x2f')]['fields']));_0x455e11[_0x9543('0x33')]=_0x455e11[_0x9543('0x33')][_0x9543('0x35')]?_0x455e11[_0x9543('0x33')]:_0x1432c5[_0x9543('0x32')];if(!_0x1218d2[_0x9543('0x2f')][_0x9543('0x36')](_0x9543('0x37'))){_0x455e11[_0x9543('0x20')]=qs[_0x9543('0x20')](_0x1218d2['query']['limit']);_0x455e11['offset']=qs[_0x9543('0x1d')](_0x1218d2[_0x9543('0x2f')][_0x9543('0x1d')]);}_0x455e11['order']=qs[_0x9543('0x38')](_0x1218d2['query'][_0x9543('0x38')]);_0x455e11[_0x9543('0x39')]=qs[_0x9543('0x3a')](_[_0x9543('0x3b')](_0x1218d2[_0x9543('0x2f')],_0x1432c5[_0x9543('0x3a')]),_0xb8714c);if(_0x1218d2[_0x9543('0x2f')][_0x9543('0x3c')]){_0x455e11[_0x9543('0x39')]=_[_0x9543('0x3d')](_0x455e11[_0x9543('0x39')],{'$or':_[_0x9543('0x2c')](_0xb8714c,function(_0x22f62d){if(_0x22f62d['type']!==_0x9543('0x3e')){var _0x3cc9f7={};_0x3cc9f7[_0x22f62d[_0x9543('0x2a')]]={'$like':'%'+_0x1218d2['query']['filter']+'%'};return _0x3cc9f7;}})});}_0x455e11=_[_0x9543('0x3d')]({},_0x455e11,_0x1218d2[_0x9543('0x3f')]);var _0x2a1667={'where':_0x455e11['where']};return db['FreshsalesField']['count'](_0x2a1667)['then'](function(_0x17bfc2){_0x358353[_0x9543('0x1f')]=_0x17bfc2;if(_0x1218d2['query'][_0x9543('0x40')]){_0x455e11[_0x9543('0x41')]=[{'all':!![]}];}return db[_0x9543('0x42')][_0x9543('0x43')](_0x455e11);})['then'](function(_0x11d324){_0x358353['rows']=_0x11d324;return _0x358353;})['then'](respondWithFilteredResult(_0x5067d7,_0x455e11))[_0x9543('0x44')](handleError(_0x5067d7,null));};exports[_0x9543('0x45')]=function(_0x3ba520,_0x2ab07d){var _0x3297c9={'raw':!![],'where':{'id':_0x3ba520[_0x9543('0x46')]['id']}},_0xfe23b0={};_0xfe23b0[_0x9543('0x32')]=_[_0x9543('0x30')](db['FreshsalesField'][_0x9543('0x47')]);_0xfe23b0[_0x9543('0x2f')]=_['keys'](_0x3ba520[_0x9543('0x2f')]);_0xfe23b0[_0x9543('0x3a')]=_[_0x9543('0x31')](_0xfe23b0['model'],_0xfe23b0[_0x9543('0x2f')]);_0x3297c9[_0x9543('0x33')]=_[_0x9543('0x31')](_0xfe23b0['model'],qs[_0x9543('0x34')](_0x3ba520[_0x9543('0x2f')][_0x9543('0x34')]));_0x3297c9[_0x9543('0x33')]=_0x3297c9['attributes']['length']?_0x3297c9[_0x9543('0x33')]:_0xfe23b0[_0x9543('0x32')];if(_0x3ba520['query'][_0x9543('0x40')]){_0x3297c9[_0x9543('0x41')]=[{'all':!![]}];}_0x3297c9=_[_0x9543('0x3d')]({},_0x3297c9,_0x3ba520[_0x9543('0x3f')]);return db[_0x9543('0x42')][_0x9543('0x48')](_0x3297c9)[_0x9543('0x25')](handleEntityNotFound(_0x2ab07d,null))[_0x9543('0x25')](respondWithResult(_0x2ab07d,null))[_0x9543('0x44')](handleError(_0x2ab07d,null));};exports[_0x9543('0x49')]=function(_0x5588af,_0x133f0a){return db['FreshsalesField'][_0x9543('0x49')](_0x5588af[_0x9543('0x4a')],{})['then'](respondWithResult(_0x133f0a,0xc9))[_0x9543('0x44')](handleError(_0x133f0a,null));};exports[_0x9543('0x24')]=function(_0x4a9daa,_0x2e0859){if(_0x4a9daa[_0x9543('0x4a')]['id']){delete _0x4a9daa[_0x9543('0x4a')]['id'];}return db[_0x9543('0x42')][_0x9543('0x48')]({'where':{'id':_0x4a9daa[_0x9543('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e0859,null))['then'](saveUpdates(_0x4a9daa[_0x9543('0x4a')],null))[_0x9543('0x25')](respondWithResult(_0x2e0859,null))[_0x9543('0x44')](handleError(_0x2e0859,null));};exports[_0x9543('0x26')]=function(_0x2890f3,_0x2498d3){return db[_0x9543('0x42')][_0x9543('0x48')]({'where':{'id':_0x2890f3['params']['id']}})[_0x9543('0x25')](handleEntityNotFound(_0x2498d3,null))[_0x9543('0x25')](removeEntity(_0x2498d3,null))['catch'](handleError(_0x2498d3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index bcf2e03..bf0bac1 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 _0x13eb=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId'];(function(_0x42a392,_0x25167e){var _0x1cdea5=function(_0x5e07e6){while(--_0x5e07e6){_0x42a392['push'](_0x42a392['shift']());}};_0x1cdea5(++_0x25167e);}(_0x13eb,0x8f));var _0xb13e=function(_0x15070a,_0x522955){_0x15070a=_0x15070a-0x0;var _0x251d50=_0x13eb[_0x15070a];return _0x251d50;};'use strict';var _=require(_0xb13e('0x0'));var util=require(_0xb13e('0x1'));var logger=require('../../config/logger')(_0xb13e('0x2'));var moment=require(_0xb13e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb13e('0x4'));var fs=require('fs');var path=require(_0xb13e('0x5'));var rimraf=require(_0xb13e('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xb13e('0x7')]=function(_0xaadc20,_0x382048){return _0xaadc20[_0xb13e('0x8')](_0xb13e('0x9'),attributes,{'tableName':_0xb13e('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb13e('0xb'),_0xb13e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79a3=['api','bluebird','../../config/environment','./intFreshsalesField.attributes','exports','freshsales_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x79a3,0x80));var _0x379a=function(_0x3dd6af,_0x3776df){_0x3dd6af=_0x3dd6af-0x0;var _0x346dd8=_0x79a3[_0x3dd6af];return _0x346dd8;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var logger=require(_0x379a('0x1'))(_0x379a('0x2'));var moment=require('moment');var BPromise=require(_0x379a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x379a('0x4'));var attributes=require(_0x379a('0x5'));module[_0x379a('0x6')]=function(_0x14907a,_0x9e6da6){return _0x14907a['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x379a('0x7'),'fields':[_0x379a('0x8'),_0x379a('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index bff95f7..987b6ff 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 _0x71ab=['http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x114338,_0xe80b3d){var _0x3f8b09=function(_0x1771fc){while(--_0x1771fc){_0x114338['push'](_0x114338['shift']());}};_0x3f8b09(++_0xe80b3d);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file +var _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x424c76,_0x18cbee){var _0x22e21a=function(_0x41d6f2){while(--_0x41d6f2){_0x424c76['push'](_0x424c76['shift']());}};_0x22e21a(++_0x18cbee);}(_0xda19,0xd5));var _0x9da1=function(_0x21cdd3,_0xb30778){_0x21cdd3=_0x21cdd3-0x0;var _0x220a72=_0xda19[_0x21cdd3];return _0x220a72;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 96fb333..867749c 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 _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(_0x25d55c,_0x147d2d){var _0x39c269=function(_0x1dd270){while(--_0x1dd270){_0x25d55c['push'](_0x25d55c['shift']());}};_0x39c269(++_0x147d2d);}(_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 +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(_0x483d1b,_0x38bfb3){var _0x3504e6=function(_0x23e56b){while(--_0x23e56b){_0x483d1b['push'](_0x483d1b['shift']());}};_0x3504e6(++_0x38bfb3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index f404a8d..6354e46 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 _0xa613=['username','integrationTab','newTab','sequelize','STRING'];(function(_0xe79ec4,_0x19750c){var _0x197e8a=function(_0x4c638a){while(--_0x4c638a){_0xe79ec4['push'](_0xe79ec4['shift']());}};_0x197e8a(++_0x19750c);}(_0xa613,0x8a));var _0x3a61=function(_0x26236f,_0x36916c){_0x26236f=_0x26236f-0x0;var _0x11c59f=_0xa613[_0x26236f];return _0x11c59f;};'use strict';var Sequelize=require(_0x3a61('0x0'));module['exports']={'name':{'type':Sequelize[_0x3a61('0x1')]},'description':{'type':Sequelize[_0x3a61('0x1')]},'username':{'type':Sequelize[_0x3a61('0x1')],'unique':_0x3a61('0x2')},'remoteUri':{'type':Sequelize[_0x3a61('0x1')]},'password':{'type':Sequelize[_0x3a61('0x1')]},'clientId':{'type':Sequelize[_0x3a61('0x1')]},'clientSecret':{'type':Sequelize[_0x3a61('0x1')]},'securityToken':{'type':Sequelize[_0x3a61('0x1')]},'serverUrl':{'type':Sequelize[_0x3a61('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3a61('0x3'),_0x3a61('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2d85=['newTab','sequelize','exports','STRING','integrationTab'];(function(_0x36c8c2,_0x3f9c34){var _0x1ff2e5=function(_0x5718d7){while(--_0x5718d7){_0x36c8c2['push'](_0x36c8c2['shift']());}};_0x1ff2e5(++_0x3f9c34);}(_0x2d85,0xd8));var _0x52d8=function(_0xba34da,_0x23d1c0){_0xba34da=_0xba34da-0x0;var _0x440004=_0x2d85[_0xba34da];return _0x440004;};'use strict';var Sequelize=require(_0x52d8('0x0'));module[_0x52d8('0x1')]={'name':{'type':Sequelize[_0x52d8('0x2')]},'description':{'type':Sequelize[_0x52d8('0x2')]},'username':{'type':Sequelize[_0x52d8('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x52d8('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x52d8('0x2')]},'clientSecret':{'type':Sequelize[_0x52d8('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x52d8('0x3'),_0x52d8('0x4')),'defaultValue':_0x52d8('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 4364c30..0ea432c 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 _0x44e4=['../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','update','then','destroy','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','length','addConfiguration','getSubjects','getDescriptions','channel','Subjects','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','password','substring','lastIndexOf','Connection','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x40a364,_0x7aa2e4){var _0x3434d1=function(_0x2e7e4a){while(--_0x2e7e4a){_0x40a364['push'](_0x40a364['shift']());}};_0x3434d1(++_0x7aa2e4);}(_0x44e4,0xde));var _0x444e=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x44e4[_0x2b31a8];return _0x1175a5;};'use strict';var emlformat=require(_0x444e('0x0'));var rimraf=require(_0x444e('0x1'));var zipdir=require(_0x444e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x444e('0x3'));var Mustache=require('mustache');var util=require(_0x444e('0x4'));var path=require(_0x444e('0x5'));var sox=require(_0x444e('0x6'));var csv=require(_0x444e('0x7'));var ejs=require(_0x444e('0x8'));var fs=require('fs');var fs_extra=require(_0x444e('0x9'));var _=require(_0x444e('0xa'));var squel=require(_0x444e('0xb'));var crypto=require(_0x444e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x444e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x444e('0xe'));var Papa=require('papaparse');var Redis=require(_0x444e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x444e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x444e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x444e('0x12'));var config=require(_0x444e('0x13'));var licenseUtil=require(_0x444e('0x14'));var db=require(_0x444e('0x15'))['db'];var integrations=require(_0x444e('0x16'));function respondWithStatusCode(_0x3179b4,_0x5e9c98){_0x5e9c98=_0x5e9c98||0xcc;return function(_0x11087f){if(_0x11087f){return _0x3179b4[_0x444e('0x17')](_0x5e9c98);}return _0x3179b4[_0x444e('0x18')](_0x5e9c98)[_0x444e('0x19')]();};}function respondWithResult(_0x588931,_0xa6be8f){_0xa6be8f=_0xa6be8f||0xc8;return function(_0x1db231){if(_0x1db231){return _0x588931['status'](_0xa6be8f)['json'](_0x1db231);}};}function respondWithFilteredResult(_0x258b41,_0x29efb4){return function(_0x253b44){if(_0x253b44){var _0x13b511=typeof _0x29efb4[_0x444e('0x1a')]===_0x444e('0x1b')&&typeof _0x29efb4[_0x444e('0x1c')]===_0x444e('0x1b');var _0x55a93c=_0x253b44[_0x444e('0x1d')];var _0x22161f=_0x13b511?0x0:_0x29efb4[_0x444e('0x1a')];var _0x22ef75=_0x13b511?_0x253b44[_0x444e('0x1d')]:_0x29efb4[_0x444e('0x1a')]+_0x29efb4[_0x444e('0x1c')];var _0x4e5445;if(_0x22ef75>=_0x55a93c){_0x22ef75=_0x55a93c;_0x4e5445=0xc8;}else{_0x4e5445=0xce;}_0x258b41[_0x444e('0x18')](_0x4e5445);return _0x258b41[_0x444e('0x1e')]('Content-Range',_0x22161f+'-'+_0x22ef75+'/'+_0x55a93c)['json'](_0x253b44);}return null;};}function patchUpdates(_0x4ccd47){return function(_0x4722b9){try{jsonpatch[_0x444e('0x1f')](_0x4722b9,_0x4ccd47,!![]);}catch(_0x4909f0){return BPromise['reject'](_0x4909f0);}return _0x4722b9[_0x444e('0x20')]();};}function saveUpdates(_0x570db9,_0x2398c3){return function(_0x1aa424){if(_0x1aa424){return _0x1aa424[_0x444e('0x21')](_0x570db9)[_0x444e('0x22')](function(_0x3fc15b){return _0x3fc15b;});}return null;};}function removeEntity(_0x3c43e5,_0x90ec27){return function(_0x317f17){if(_0x317f17){return _0x317f17[_0x444e('0x23')]()['then'](function(){_0x3c43e5[_0x444e('0x18')](0xcc)[_0x444e('0x19')]();});}};}function handleEntityNotFound(_0x4935c9,_0x2be63b){return function(_0xbc8b7e){if(!_0xbc8b7e){_0x4935c9[_0x444e('0x17')](0x194);}return _0xbc8b7e;};}function handleError(_0x2270f8,_0x51f5b7){_0x51f5b7=_0x51f5b7||0x1f4;return function(_0x421a4c){logger['error'](_0x421a4c['stack']);if(_0x421a4c[_0x444e('0x24')]){delete _0x421a4c[_0x444e('0x24')];}_0x2270f8['status'](_0x51f5b7)[_0x444e('0x25')](_0x421a4c);};}exports['index']=function(_0x32cc04,_0x367d6c){var _0x342ef5={},_0x1d4d81={},_0x1af055={'count':0x0,'rows':[]};var _0x27a738=_[_0x444e('0x26')](db[_0x444e('0x27')][_0x444e('0x28')],function(_0x516d77){return{'name':_0x516d77[_0x444e('0x29')],'type':_0x516d77[_0x444e('0x2a')][_0x444e('0x2b')]};});_0x1d4d81[_0x444e('0x2c')]=_[_0x444e('0x26')](_0x27a738,_0x444e('0x24'));_0x1d4d81[_0x444e('0x2d')]=_[_0x444e('0x2e')](_0x32cc04[_0x444e('0x2d')]);_0x1d4d81['filters']=_[_0x444e('0x2f')](_0x1d4d81['model'],_0x1d4d81[_0x444e('0x2d')]);_0x342ef5[_0x444e('0x30')]=_['intersection'](_0x1d4d81['model'],qs[_0x444e('0x31')](_0x32cc04[_0x444e('0x2d')]['fields']));_0x342ef5[_0x444e('0x30')]=_0x342ef5['attributes']['length']?_0x342ef5[_0x444e('0x30')]:_0x1d4d81[_0x444e('0x2c')];if(!_0x32cc04[_0x444e('0x2d')][_0x444e('0x32')](_0x444e('0x33'))){_0x342ef5['limit']=qs[_0x444e('0x1c')](_0x32cc04['query'][_0x444e('0x1c')]);_0x342ef5[_0x444e('0x1a')]=qs[_0x444e('0x1a')](_0x32cc04['query'][_0x444e('0x1a')]);}_0x342ef5[_0x444e('0x34')]=qs[_0x444e('0x35')](_0x32cc04[_0x444e('0x2d')][_0x444e('0x35')]);_0x342ef5['where']=qs[_0x444e('0x36')](_[_0x444e('0x37')](_0x32cc04[_0x444e('0x2d')],_0x1d4d81[_0x444e('0x36')]),_0x27a738);if(_0x32cc04['query']['filter']){_0x342ef5[_0x444e('0x38')]=_['merge'](_0x342ef5[_0x444e('0x38')],{'$or':_[_0x444e('0x26')](_0x27a738,function(_0x150f23){if(_0x150f23[_0x444e('0x2a')]!=='VIRTUAL'){var _0x2cb086={};_0x2cb086[_0x150f23[_0x444e('0x24')]]={'$like':'%'+_0x32cc04[_0x444e('0x2d')][_0x444e('0x39')]+'%'};return _0x2cb086;}})});}_0x342ef5=_[_0x444e('0x3a')]({},_0x342ef5,_0x32cc04['options']);var _0x1b80c5={'where':_0x342ef5[_0x444e('0x38')]};return db[_0x444e('0x27')]['count'](_0x1b80c5)[_0x444e('0x22')](function(_0x20bca1){_0x1af055[_0x444e('0x1d')]=_0x20bca1;if(_0x32cc04['query'][_0x444e('0x3b')]){_0x342ef5['include']=[{'all':!![]}];}return db[_0x444e('0x27')][_0x444e('0x3c')](_0x342ef5);})[_0x444e('0x22')](function(_0x1c5b4a){_0x1af055[_0x444e('0x3d')]=_0x1c5b4a;return _0x1af055;})[_0x444e('0x22')](respondWithFilteredResult(_0x367d6c,_0x342ef5))[_0x444e('0x3e')](handleError(_0x367d6c,null));};exports[_0x444e('0x3f')]=function(_0x112caa,_0x32bf75){var _0x541fb2={'raw':![],'where':{'id':_0x112caa['params']['id']}},_0xe7a4f9={};_0xe7a4f9[_0x444e('0x2c')]=_[_0x444e('0x2e')](db[_0x444e('0x27')][_0x444e('0x28')]);_0xe7a4f9[_0x444e('0x2d')]=_[_0x444e('0x2e')](_0x112caa[_0x444e('0x2d')]);_0xe7a4f9[_0x444e('0x36')]=_['intersection'](_0xe7a4f9[_0x444e('0x2c')],_0xe7a4f9[_0x444e('0x2d')]);_0x541fb2['attributes']=_[_0x444e('0x2f')](_0xe7a4f9[_0x444e('0x2c')],qs[_0x444e('0x31')](_0x112caa[_0x444e('0x2d')][_0x444e('0x31')]));_0x541fb2[_0x444e('0x30')]=_0x541fb2[_0x444e('0x30')]['length']?_0x541fb2[_0x444e('0x30')]:_0xe7a4f9['model'];if(_0x112caa[_0x444e('0x2d')][_0x444e('0x3b')]){_0x541fb2[_0x444e('0x40')]=[{'all':!![]}];}_0x541fb2=_[_0x444e('0x3a')]({},_0x541fb2,_0x112caa[_0x444e('0x41')]);return db[_0x444e('0x27')][_0x444e('0x42')](_0x541fb2)['then'](handleEntityNotFound(_0x32bf75,null))[_0x444e('0x22')](respondWithResult(_0x32bf75,null))[_0x444e('0x3e')](handleError(_0x32bf75,null));};exports[_0x444e('0x43')]=function(_0x225655,_0x492c47){return db[_0x444e('0x27')][_0x444e('0x43')](_0x225655[_0x444e('0x44')],{})[_0x444e('0x22')](respondWithResult(_0x492c47,0xc9))[_0x444e('0x3e')](handleError(_0x492c47,null));};exports['update']=function(_0x58c2f4,_0x2e8b21){if(_0x58c2f4['body']['id']){delete _0x58c2f4[_0x444e('0x44')]['id'];}return db[_0x444e('0x27')][_0x444e('0x42')]({'where':{'id':_0x58c2f4[_0x444e('0x45')]['id']}})[_0x444e('0x22')](handleEntityNotFound(_0x2e8b21,null))['then'](saveUpdates(_0x58c2f4[_0x444e('0x44')],null))['then'](respondWithResult(_0x2e8b21,null))[_0x444e('0x3e')](handleError(_0x2e8b21,null));};exports[_0x444e('0x23')]=function(_0x1fa6e4,_0x15d1d7){return db[_0x444e('0x27')][_0x444e('0x42')]({'where':{'id':_0x1fa6e4[_0x444e('0x45')]['id']}})[_0x444e('0x22')](handleEntityNotFound(_0x15d1d7,null))[_0x444e('0x22')](removeEntity(_0x15d1d7,null))[_0x444e('0x3e')](handleError(_0x15d1d7,null));};exports[_0x444e('0x46')]=function(_0x5962ca,_0x5e5b14,_0x120114){var _0x25ba6c={};var _0x1f134d={};var _0xbad4ec;var _0x3c09c5;return db['SalesforceAccount'][_0x444e('0x47')]({'where':{'id':_0x5962ca['params']['id']}})[_0x444e('0x22')](handleEntityNotFound(_0x5e5b14,null))[_0x444e('0x22')](function(_0x14a5ed){if(_0x14a5ed){_0xbad4ec=_0x14a5ed;_0x1f134d[_0x444e('0x2c')]=_[_0x444e('0x2e')](db[_0x444e('0x48')][_0x444e('0x28')]);_0x1f134d['query']=_[_0x444e('0x2e')](_0x5962ca[_0x444e('0x2d')]);_0x1f134d[_0x444e('0x36')]=_[_0x444e('0x2f')](_0x1f134d[_0x444e('0x2c')],_0x1f134d[_0x444e('0x2d')]);_0x25ba6c[_0x444e('0x30')]=_[_0x444e('0x2f')](_0x1f134d[_0x444e('0x2c')],qs[_0x444e('0x31')](_0x5962ca[_0x444e('0x2d')][_0x444e('0x31')]));_0x25ba6c['attributes']=_0x25ba6c[_0x444e('0x30')][_0x444e('0x49')]?_0x25ba6c[_0x444e('0x30')]:_0x1f134d[_0x444e('0x2c')];_0x25ba6c[_0x444e('0x34')]=qs['sort'](_0x5962ca[_0x444e('0x2d')]['sort']);_0x25ba6c[_0x444e('0x38')]=qs[_0x444e('0x36')](_['pick'](_0x5962ca[_0x444e('0x2d')],_0x1f134d[_0x444e('0x36')]));if(_0x5962ca[_0x444e('0x2d')][_0x444e('0x39')]){_0x25ba6c[_0x444e('0x38')]=_[_0x444e('0x3a')](_0x25ba6c['where'],{'$or':_['map'](_0x25ba6c[_0x444e('0x30')],function(_0x88a63b){var _0x219d0b={};_0x219d0b[_0x88a63b]={'$like':'%'+_0x5962ca[_0x444e('0x2d')][_0x444e('0x39')]+'%'};return _0x219d0b;})});}_0x25ba6c=_[_0x444e('0x3a')]({},_0x25ba6c,_0x5962ca['options']);return _0xbad4ec[_0x444e('0x46')](_0x25ba6c);}})[_0x444e('0x22')](function(_0x2a11a7){if(_0x2a11a7){_0x3c09c5=_0x2a11a7[_0x444e('0x49')];if(!_0x5962ca['query'][_0x444e('0x32')](_0x444e('0x33'))){_0x25ba6c[_0x444e('0x1c')]=qs[_0x444e('0x1c')](_0x5962ca[_0x444e('0x2d')][_0x444e('0x1c')]);_0x25ba6c['offset']=qs['offset'](_0x5962ca[_0x444e('0x2d')][_0x444e('0x1a')]);}return _0xbad4ec[_0x444e('0x46')](_0x25ba6c);}})[_0x444e('0x22')](function(_0x591670){if(_0x591670){return _0x591670?{'count':_0x3c09c5,'rows':_0x591670}:null;}})['then'](respondWithResult(_0x5e5b14,null))[_0x444e('0x3e')](handleError(_0x5e5b14,null));};exports[_0x444e('0x4a')]=function(_0x218445,_0x3e99c3,_0x5dd335){if(_0x218445['body']['id']){delete _0x218445[_0x444e('0x44')]['id'];}return db[_0x444e('0x27')][_0x444e('0x47')]({'where':{'id':_0x218445[_0x444e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e99c3,null))[_0x444e('0x22')](function(_0x15825d){if(_0x15825d){_0x218445[_0x444e('0x44')]['AccountId']=_0x15825d['id'];_0x218445[_0x444e('0x44')]['Subjects']=integrations[_0x444e('0x4b')](_0x218445[_0x444e('0x44')]['channel'],_0x218445[_0x444e('0x44')][_0x444e('0x2a')]);_0x218445[_0x444e('0x44')]['Descriptions']=integrations[_0x444e('0x4c')](_0x218445[_0x444e('0x44')][_0x444e('0x4d')],_0x218445[_0x444e('0x44')]['type']);return db[_0x444e('0x48')][_0x444e('0x43')](_0x218445['body'],{'include':[{'model':db['SalesforceField'],'as':_0x444e('0x4e')},{'model':db['SalesforceField'],'as':_0x444e('0x4f')}]});}return null;})[_0x444e('0x22')](respondWithResult(_0x3e99c3,null))[_0x444e('0x3e')](handleError(_0x3e99c3,null));};exports[_0x444e('0x50')]=function(_0xd8d84b,_0x1324c6,_0x366670){var _0x2fd06a;var _0x32b525='';var _0x19f7fe=_0x444e('0x51');return db[_0x444e('0x27')][_0x444e('0x47')]({'where':{'id':_0xd8d84b[_0x444e('0x45')]['id']},'attributes':['id',_0x444e('0x52'),_0x444e('0x53'),_0x444e('0x54'),'username',_0x444e('0x55'),'securityToken']})[_0x444e('0x22')](handleEntityNotFound(_0x1324c6,null))['then'](function(_0x54e607){if(_0x54e607){_0x32b525=_0x54e607[_0x444e('0x52')];var _0x3ea221=_0x32b525['slice'](-0x1);if(_0x3ea221==='/'){_0x32b525=_0x32b525[_0x444e('0x56')](0x0,_0x32b525[_0x444e('0x57')](_0x3ea221));}_0x2fd06a=new jsforce[(_0x444e('0x58'))]({'oauth2':{'loginUrl':_0x32b525,'clientId':_0x54e607['clientId'],'clientSecret':_0x54e607[_0x444e('0x54')]}});return _0x2fd06a[_0x444e('0x59')](_0x54e607[_0x444e('0x5a')],_0x54e607[_0x444e('0x55')][_0x444e('0x5b')](_0x54e607['securityToken']));}})[_0x444e('0x22')](function(_0x2b282c){if(_0x2b282c){if(!_[_0x444e('0x5c')](_0xd8d84b['query'][_0x444e('0x5d')])){_0x19f7fe=_0xd8d84b[_0x444e('0x2d')][_0x444e('0x5d')];}return _0x2fd06a[_0x444e('0x5e')](_0x19f7fe)[_0x444e('0x5f')]();}})['then'](function(_0x29779c){var _0x26b5d4=[_0x444e('0x60'),_0x444e('0x61'),_0x444e('0x62'),_0x444e('0x63'),_0x444e('0x64'),_0x444e('0x65')];var _0x4eea63=[_0x444e('0x66'),_0x444e('0x67'),_0x444e('0x68'),_0x444e('0x69'),_0x444e('0x6a'),_0x444e('0x6b'),_0x444e('0x6c')];if(_0x29779c){_[_0x444e('0x6d')](_0x29779c['fields'],function(_0x57558f){return _0x26b5d4[_0x444e('0x6e')](_0x57558f[_0x444e('0x24')])||!_0x4eea63[_0x444e('0x6e')](_0x57558f[_0x444e('0x2a')]);});return{'count':_0x29779c[_0x444e('0x31')]['length'],'rows':_[_0x444e('0x26')](_0x29779c['fields'],function(_0x12ebec){return{'id':_0x12ebec[_0x444e('0x24')],'name':_0x12ebec[_0x444e('0x6f')],'custom':_0x12ebec['custom'],'options':_0x12ebec[_0x444e('0x70')]['length']>0x0?_[_0x444e('0x26')](_0x12ebec[_0x444e('0x70')],function(_0xd0129a){return{'name':_0xd0129a[_0x444e('0x6f')],'value':_0xd0129a[_0x444e('0x71')]};}):_0x12ebec[_0x444e('0x2a')]==_0x444e('0x69')?[{'name':_0x444e('0x72'),'value':_0x444e('0x73')},{'name':'False','value':_0x444e('0x74')}]:[]};})};}})[_0x444e('0x22')](respondWithResult(_0x1324c6,null))[_0x444e('0x3e')](function(_0x263f41){var _0x560db7=_0xd8d84b['query'][_0x444e('0x75')]?0x1f4:_0x263f41[_0x444e('0x76')]||0x1f4;logger[_0x444e('0x77')](_0x444e('0x78'),_0x444e('0x50'),_0x560db7,JSON['stringify'](_0x263f41));delete _0x263f41[_0x444e('0x24')];if(_0x560db7===0x191){_0x560db7=0x190;}_0x1324c6[_0x444e('0x18')](_0x560db7)['send'](_0xd8d84b['query'][_0x444e('0x75')]?{'message':_0x444e('0x79'),'statusCode':_0x263f41[_0x444e('0x76')]}:_0x263f41);});}; \ No newline at end of file +var _0x21f2=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','stack','name','send','SalesforceAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','rawAttributes','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','channel','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','username','password','substring','lastIndexOf','Connection','login','concat','securityToken','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','textarea','phone','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x21f2,0x6a));var _0x221f=function(_0x204e4c,_0x2d36a5){_0x204e4c=_0x204e4c-0x0;var _0x3684a7=_0x21f2[_0x204e4c];return _0x3684a7;};'use strict';var emlformat=require(_0x221f('0x0'));var rimraf=require(_0x221f('0x1'));var zipdir=require(_0x221f('0x2'));var jsonpatch=require(_0x221f('0x3'));var rp=require(_0x221f('0x4'));var moment=require('moment');var BPromise=require(_0x221f('0x5'));var Mustache=require(_0x221f('0x6'));var util=require(_0x221f('0x7'));var path=require('path');var sox=require(_0x221f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x221f('0x9'));var _=require(_0x221f('0xa'));var squel=require(_0x221f('0xb'));var crypto=require('crypto');var jsforce=require(_0x221f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x221f('0xd'));var Papa=require(_0x221f('0xe'));var Redis=require(_0x221f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x221f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x221f('0x11'));var logger=require(_0x221f('0x12'))('api');var utils=require(_0x221f('0x13'));var config=require(_0x221f('0x14'));var licenseUtil=require(_0x221f('0x15'));var db=require(_0x221f('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x254a21,_0x254c8f){_0x254c8f=_0x254c8f||0xcc;return function(_0x4d550c){if(_0x4d550c){return _0x254a21['sendStatus'](_0x254c8f);}return _0x254a21[_0x221f('0x17')](_0x254c8f)['end']();};}function respondWithResult(_0x16ed3f,_0x4d435f){_0x4d435f=_0x4d435f||0xc8;return function(_0x5d309a){if(_0x5d309a){return _0x16ed3f['status'](_0x4d435f)[_0x221f('0x18')](_0x5d309a);}};}function respondWithFilteredResult(_0x2c2a97,_0x38b37c){return function(_0x155848){if(_0x155848){var _0x4864b4=typeof _0x38b37c[_0x221f('0x19')]===_0x221f('0x1a')&&typeof _0x38b37c[_0x221f('0x1b')]===_0x221f('0x1a');var _0x580c29=_0x155848[_0x221f('0x1c')];var _0x1f9c70=_0x4864b4?0x0:_0x38b37c[_0x221f('0x19')];var _0x349855=_0x4864b4?_0x155848['count']:_0x38b37c[_0x221f('0x19')]+_0x38b37c[_0x221f('0x1b')];var _0x24d2be;if(_0x349855>=_0x580c29){_0x349855=_0x580c29;_0x24d2be=0xc8;}else{_0x24d2be=0xce;}_0x2c2a97['status'](_0x24d2be);return _0x2c2a97[_0x221f('0x1d')](_0x221f('0x1e'),_0x1f9c70+'-'+_0x349855+'/'+_0x580c29)['json'](_0x155848);}return null;};}function patchUpdates(_0x4aa913){return function(_0x1465ac){try{jsonpatch[_0x221f('0x1f')](_0x1465ac,_0x4aa913,!![]);}catch(_0x1936e0){return BPromise[_0x221f('0x20')](_0x1936e0);}return _0x1465ac['save']();};}function saveUpdates(_0x53584f,_0x32d89f){return function(_0x2fee88){if(_0x2fee88){return _0x2fee88[_0x221f('0x21')](_0x53584f)['then'](function(_0x5ab49f){return _0x5ab49f;});}return null;};}function removeEntity(_0x57fec4,_0x1ad962){return function(_0x3be249){if(_0x3be249){return _0x3be249[_0x221f('0x22')]()[_0x221f('0x23')](function(){_0x57fec4['status'](0xcc)[_0x221f('0x24')]();});}};}function handleEntityNotFound(_0x288ac5,_0xb23e5c){return function(_0x5af112){if(!_0x5af112){_0x288ac5[_0x221f('0x25')](0x194);}return _0x5af112;};}function handleError(_0x6e5c55,_0x10d09d){_0x10d09d=_0x10d09d||0x1f4;return function(_0x2887e7){logger['error'](_0x2887e7[_0x221f('0x26')]);if(_0x2887e7[_0x221f('0x27')]){delete _0x2887e7[_0x221f('0x27')];}_0x6e5c55[_0x221f('0x17')](_0x10d09d)[_0x221f('0x28')](_0x2887e7);};}exports['index']=function(_0xbd6496,_0x560bbc){var _0x589f65={},_0x13b239={},_0xb53624={'count':0x0,'rows':[]};var _0x20f2b3=_['map'](db[_0x221f('0x29')]['rawAttributes'],function(_0x437c74){return{'name':_0x437c74[_0x221f('0x2a')],'type':_0x437c74['type'][_0x221f('0x2b')]};});_0x13b239[_0x221f('0x2c')]=_['map'](_0x20f2b3,_0x221f('0x27'));_0x13b239[_0x221f('0x2d')]=_[_0x221f('0x2e')](_0xbd6496[_0x221f('0x2d')]);_0x13b239[_0x221f('0x2f')]=_[_0x221f('0x30')](_0x13b239[_0x221f('0x2c')],_0x13b239[_0x221f('0x2d')]);_0x589f65[_0x221f('0x31')]=_[_0x221f('0x30')](_0x13b239[_0x221f('0x2c')],qs[_0x221f('0x32')](_0xbd6496[_0x221f('0x2d')][_0x221f('0x32')]));_0x589f65[_0x221f('0x31')]=_0x589f65[_0x221f('0x31')][_0x221f('0x33')]?_0x589f65[_0x221f('0x31')]:_0x13b239['model'];if(!_0xbd6496['query'][_0x221f('0x34')]('nolimit')){_0x589f65['limit']=qs[_0x221f('0x1b')](_0xbd6496[_0x221f('0x2d')]['limit']);_0x589f65[_0x221f('0x19')]=qs[_0x221f('0x19')](_0xbd6496[_0x221f('0x2d')][_0x221f('0x19')]);}_0x589f65[_0x221f('0x35')]=qs['sort'](_0xbd6496['query'][_0x221f('0x36')]);_0x589f65['where']=qs['filters'](_[_0x221f('0x37')](_0xbd6496['query'],_0x13b239[_0x221f('0x2f')]),_0x20f2b3);if(_0xbd6496[_0x221f('0x2d')][_0x221f('0x38')]){_0x589f65[_0x221f('0x39')]=_[_0x221f('0x3a')](_0x589f65[_0x221f('0x39')],{'$or':_[_0x221f('0x3b')](_0x20f2b3,function(_0x55dee4){if(_0x55dee4[_0x221f('0x3c')]!==_0x221f('0x3d')){var _0x34e7af={};_0x34e7af[_0x55dee4['name']]={'$like':'%'+_0xbd6496['query']['filter']+'%'};return _0x34e7af;}})});}_0x589f65=_['merge']({},_0x589f65,_0xbd6496[_0x221f('0x3e')]);var _0x4037a1={'where':_0x589f65[_0x221f('0x39')]};return db[_0x221f('0x29')][_0x221f('0x1c')](_0x4037a1)['then'](function(_0x4216c8){_0xb53624[_0x221f('0x1c')]=_0x4216c8;if(_0xbd6496[_0x221f('0x2d')][_0x221f('0x3f')]){_0x589f65['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x221f('0x40')](_0x589f65);})[_0x221f('0x23')](function(_0x5370b8){_0xb53624[_0x221f('0x41')]=_0x5370b8;return _0xb53624;})['then'](respondWithFilteredResult(_0x560bbc,_0x589f65))['catch'](handleError(_0x560bbc,null));};exports['show']=function(_0x11da66,_0x1ecc5a){var _0xad48fc={'raw':![],'where':{'id':_0x11da66['params']['id']}},_0x408e11={};_0x408e11[_0x221f('0x2c')]=_[_0x221f('0x2e')](db[_0x221f('0x29')][_0x221f('0x42')]);_0x408e11[_0x221f('0x2d')]=_[_0x221f('0x2e')](_0x11da66[_0x221f('0x2d')]);_0x408e11[_0x221f('0x2f')]=_[_0x221f('0x30')](_0x408e11[_0x221f('0x2c')],_0x408e11[_0x221f('0x2d')]);_0xad48fc[_0x221f('0x31')]=_['intersection'](_0x408e11[_0x221f('0x2c')],qs[_0x221f('0x32')](_0x11da66[_0x221f('0x2d')][_0x221f('0x32')]));_0xad48fc[_0x221f('0x31')]=_0xad48fc['attributes']['length']?_0xad48fc[_0x221f('0x31')]:_0x408e11[_0x221f('0x2c')];if(_0x11da66[_0x221f('0x2d')]['includeAll']){_0xad48fc['include']=[{'all':!![]}];}_0xad48fc=_[_0x221f('0x3a')]({},_0xad48fc,_0x11da66['options']);return db[_0x221f('0x29')][_0x221f('0x43')](_0xad48fc)[_0x221f('0x23')](handleEntityNotFound(_0x1ecc5a,null))[_0x221f('0x23')](respondWithResult(_0x1ecc5a,null))[_0x221f('0x44')](handleError(_0x1ecc5a,null));};exports[_0x221f('0x45')]=function(_0x26d465,_0x126706){return db[_0x221f('0x29')]['create'](_0x26d465[_0x221f('0x46')],{})[_0x221f('0x23')](respondWithResult(_0x126706,0xc9))[_0x221f('0x44')](handleError(_0x126706,null));};exports['update']=function(_0x34465c,_0x2b3621){if(_0x34465c[_0x221f('0x46')]['id']){delete _0x34465c[_0x221f('0x46')]['id'];}return db[_0x221f('0x29')][_0x221f('0x43')]({'where':{'id':_0x34465c['params']['id']}})[_0x221f('0x23')](handleEntityNotFound(_0x2b3621,null))['then'](saveUpdates(_0x34465c[_0x221f('0x46')],null))[_0x221f('0x23')](respondWithResult(_0x2b3621,null))[_0x221f('0x44')](handleError(_0x2b3621,null));};exports[_0x221f('0x22')]=function(_0x4bdff9,_0xb40c65){return db[_0x221f('0x29')][_0x221f('0x43')]({'where':{'id':_0x4bdff9[_0x221f('0x47')]['id']}})[_0x221f('0x23')](handleEntityNotFound(_0xb40c65,null))[_0x221f('0x23')](removeEntity(_0xb40c65,null))['catch'](handleError(_0xb40c65,null));};exports[_0x221f('0x48')]=function(_0x3d6017,_0x1537fe,_0x51c825){var _0x29b8b8={};var _0x50a5e9={};var _0x15cdf8;var _0x49e546;return db[_0x221f('0x29')][_0x221f('0x49')]({'where':{'id':_0x3d6017[_0x221f('0x47')]['id']}})[_0x221f('0x23')](handleEntityNotFound(_0x1537fe,null))[_0x221f('0x23')](function(_0xb981f1){if(_0xb981f1){_0x15cdf8=_0xb981f1;_0x50a5e9['model']=_[_0x221f('0x2e')](db[_0x221f('0x4a')]['rawAttributes']);_0x50a5e9[_0x221f('0x2d')]=_[_0x221f('0x2e')](_0x3d6017['query']);_0x50a5e9['filters']=_[_0x221f('0x30')](_0x50a5e9['model'],_0x50a5e9[_0x221f('0x2d')]);_0x29b8b8['attributes']=_[_0x221f('0x30')](_0x50a5e9[_0x221f('0x2c')],qs['fields'](_0x3d6017[_0x221f('0x2d')][_0x221f('0x32')]));_0x29b8b8[_0x221f('0x31')]=_0x29b8b8[_0x221f('0x31')][_0x221f('0x33')]?_0x29b8b8['attributes']:_0x50a5e9[_0x221f('0x2c')];_0x29b8b8[_0x221f('0x35')]=qs[_0x221f('0x36')](_0x3d6017[_0x221f('0x2d')][_0x221f('0x36')]);_0x29b8b8[_0x221f('0x39')]=qs[_0x221f('0x2f')](_[_0x221f('0x37')](_0x3d6017['query'],_0x50a5e9[_0x221f('0x2f')]));if(_0x3d6017[_0x221f('0x2d')][_0x221f('0x38')]){_0x29b8b8[_0x221f('0x39')]=_[_0x221f('0x3a')](_0x29b8b8[_0x221f('0x39')],{'$or':_[_0x221f('0x3b')](_0x29b8b8[_0x221f('0x31')],function(_0x397416){var _0x4e5d64={};_0x4e5d64[_0x397416]={'$like':'%'+_0x3d6017[_0x221f('0x2d')][_0x221f('0x38')]+'%'};return _0x4e5d64;})});}_0x29b8b8=_[_0x221f('0x3a')]({},_0x29b8b8,_0x3d6017[_0x221f('0x3e')]);return _0x15cdf8['getConfigurations'](_0x29b8b8);}})[_0x221f('0x23')](function(_0x592442){if(_0x592442){_0x49e546=_0x592442[_0x221f('0x33')];if(!_0x3d6017[_0x221f('0x2d')][_0x221f('0x34')](_0x221f('0x4b'))){_0x29b8b8[_0x221f('0x1b')]=qs[_0x221f('0x1b')](_0x3d6017['query']['limit']);_0x29b8b8['offset']=qs['offset'](_0x3d6017[_0x221f('0x2d')][_0x221f('0x19')]);}return _0x15cdf8['getConfigurations'](_0x29b8b8);}})['then'](function(_0x24bdaa){if(_0x24bdaa){return _0x24bdaa?{'count':_0x49e546,'rows':_0x24bdaa}:null;}})[_0x221f('0x23')](respondWithResult(_0x1537fe,null))[_0x221f('0x44')](handleError(_0x1537fe,null));};exports[_0x221f('0x4c')]=function(_0x33bd12,_0x38985d,_0x1704f3){if(_0x33bd12[_0x221f('0x46')]['id']){delete _0x33bd12[_0x221f('0x46')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x33bd12[_0x221f('0x47')]['id']}})[_0x221f('0x23')](handleEntityNotFound(_0x38985d,null))[_0x221f('0x23')](function(_0x589f15){if(_0x589f15){_0x33bd12[_0x221f('0x46')][_0x221f('0x4d')]=_0x589f15['id'];_0x33bd12[_0x221f('0x46')][_0x221f('0x4e')]=integrations['getSubjects'](_0x33bd12[_0x221f('0x46')][_0x221f('0x4f')],_0x33bd12['body'][_0x221f('0x3c')]);_0x33bd12[_0x221f('0x46')]['Descriptions']=integrations['getDescriptions'](_0x33bd12[_0x221f('0x46')][_0x221f('0x4f')],_0x33bd12['body'][_0x221f('0x3c')]);return db['SalesforceConfiguration'][_0x221f('0x45')](_0x33bd12[_0x221f('0x46')],{'include':[{'model':db[_0x221f('0x50')],'as':_0x221f('0x4e')},{'model':db[_0x221f('0x50')],'as':_0x221f('0x51')}]});}return null;})[_0x221f('0x23')](respondWithResult(_0x38985d,null))[_0x221f('0x44')](handleError(_0x38985d,null));};exports['getFields']=function(_0x1050e,_0x310454,_0x220b53){var _0x2a17ce;var _0x35d3b8='';var _0x363cde=_0x221f('0x52');return db['SalesforceAccount'][_0x221f('0x49')]({'where':{'id':_0x1050e[_0x221f('0x47')]['id']},'attributes':['id',_0x221f('0x53'),_0x221f('0x54'),_0x221f('0x55'),_0x221f('0x56'),_0x221f('0x57'),'securityToken']})[_0x221f('0x23')](handleEntityNotFound(_0x310454,null))['then'](function(_0x2483d6){if(_0x2483d6){_0x35d3b8=_0x2483d6['remoteUri'];var _0x425b1e=_0x35d3b8['slice'](-0x1);if(_0x425b1e==='/'){_0x35d3b8=_0x35d3b8[_0x221f('0x58')](0x0,_0x35d3b8[_0x221f('0x59')](_0x425b1e));}_0x2a17ce=new jsforce[(_0x221f('0x5a'))]({'oauth2':{'loginUrl':_0x35d3b8,'clientId':_0x2483d6[_0x221f('0x54')],'clientSecret':_0x2483d6[_0x221f('0x55')]}});return _0x2a17ce[_0x221f('0x5b')](_0x2483d6[_0x221f('0x56')],_0x2483d6[_0x221f('0x57')][_0x221f('0x5c')](_0x2483d6[_0x221f('0x5d')]));}})['then'](function(_0x44ae0){if(_0x44ae0){if(!_['isNil'](_0x1050e['query'][_0x221f('0x5e')])){_0x363cde=_0x1050e[_0x221f('0x2d')][_0x221f('0x5e')];}return _0x2a17ce['sobject'](_0x363cde)[_0x221f('0x5f')]();}})[_0x221f('0x23')](function(_0x280176){var _0x68d877=[_0x221f('0x60'),'ActivityDate',_0x221f('0x61'),_0x221f('0x62'),_0x221f('0x63'),_0x221f('0x64')];var _0x369d9b=[_0x221f('0x65'),'int',_0x221f('0x66'),_0x221f('0x67'),'email',_0x221f('0x68'),_0x221f('0x69')];if(_0x280176){_['remove'](_0x280176[_0x221f('0x32')],function(_0x566232){return _0x68d877[_0x221f('0x6a')](_0x566232[_0x221f('0x27')])||!_0x369d9b[_0x221f('0x6a')](_0x566232[_0x221f('0x3c')]);});return{'count':_0x280176[_0x221f('0x32')][_0x221f('0x33')],'rows':_[_0x221f('0x3b')](_0x280176[_0x221f('0x32')],function(_0x2cd955){return{'id':_0x2cd955[_0x221f('0x27')],'name':_0x2cd955[_0x221f('0x6b')],'custom':_0x2cd955[_0x221f('0x6c')],'options':_0x2cd955[_0x221f('0x6d')][_0x221f('0x33')]>0x0?_[_0x221f('0x3b')](_0x2cd955[_0x221f('0x6d')],function(_0x21b87e){return{'name':_0x21b87e[_0x221f('0x6b')],'value':_0x21b87e[_0x221f('0x6e')]};}):_0x2cd955[_0x221f('0x3c')]=='boolean'?[{'name':'True','value':_0x221f('0x6f')},{'name':_0x221f('0x70'),'value':_0x221f('0x71')}]:[]};})};}})[_0x221f('0x23')](respondWithResult(_0x310454,null))[_0x221f('0x44')](function(_0x4d346d){var _0x3ff350=_0x1050e[_0x221f('0x2d')][_0x221f('0x72')]?0x1f4:_0x4d346d[_0x221f('0x73')]||0x1f4;logger[_0x221f('0x74')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3ff350,JSON[_0x221f('0x75')](_0x4d346d));delete _0x4d346d[_0x221f('0x27')];if(_0x3ff350===0x191){_0x3ff350=0x190;}_0x310454[_0x221f('0x17')](_0x3ff350)[_0x221f('0x28')](_0x1050e[_0x221f('0x2d')][_0x221f('0x72')]?{'message':_0x221f('0x76'),'statusCode':_0x4d346d[_0x221f('0x73')]}:_0x4d346d);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 146bed5..abbd371 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 _0x0a9c=['util','../../config/logger','moment','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x0a9c,0x18b));var _0xc0a9=function(_0x495d0f,_0x56f9ec){_0x495d0f=_0x495d0f-0x0;var _0x12a131=_0x0a9c[_0x495d0f];return _0x12a131;};'use strict';var _=require(_0xc0a9('0x0'));var util=require(_0xc0a9('0x1'));var logger=require(_0xc0a9('0x2'))('api');var moment=require(_0xc0a9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0a9('0x4'));var fs=require('fs');var path=require(_0xc0a9('0x5'));var rimraf=require(_0xc0a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xc0a9('0x7'));var integrations=require(_0xc0a9('0x8'));module[_0xc0a9('0x9')]=function(_0x17a689,_0x11d65d){return _0x17a689[_0xc0a9('0xa')](_0xc0a9('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x357b=['path','../../config/environment','./intSalesforceAccount.attributes','exports','define','int_salesforce_accounts','lodash','util','api','bluebird'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x357b,0x164));var _0xb357=function(_0x1ed3ed,_0xdc9dbc){_0x1ed3ed=_0x1ed3ed-0x0;var _0x262d27=_0x357b[_0x1ed3ed];return _0x262d27;};'use strict';var _=require(_0xb357('0x0'));var util=require(_0xb357('0x1'));var logger=require('../../config/logger')(_0xb357('0x2'));var moment=require('moment');var BPromise=require(_0xb357('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb357('0x4'));var rimraf=require('rimraf');var config=require(_0xb357('0x5'));var attributes=require(_0xb357('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xb357('0x7')]=function(_0x2d1f6c,_0x17fd6e){return _0x2d1f6c[_0xb357('0x8')]('SalesforceAccount',attributes,{'tableName':_0xb357('0x9'),'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 e281fa6..8b6d795 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 _0x3eef=['raw','ShowSalesforceAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','map','include','model','GetSalesforceAccount','debug','SalesforceAccount','find'];(function(_0x49b58c,_0x3b6cb9){var _0x9c1b64=function(_0x275d75){while(--_0x275d75){_0x49b58c['push'](_0x49b58c['shift']());}};_0x9c1b64(++_0x3b6cb9);}(_0x3eef,0xe0));var _0xf3ee=function(_0x365cbd,_0x227903){_0x365cbd=_0x365cbd-0x0;var _0x1d4d20=_0x3eef[_0x365cbd];return _0x1d4d20;};'use strict';var _=require(_0xf3ee('0x0'));var util=require(_0xf3ee('0x1'));var moment=require(_0xf3ee('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3ee('0x4'))['db'];var utils=require(_0xf3ee('0x5'));var logger=require(_0xf3ee('0x6'))(_0xf3ee('0x7'));var config=require(_0xf3ee('0x8'));var jayson=require(_0xf3ee('0x9'));var client=jayson['client'][_0xf3ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bcda6,_0x4d22a7,_0x7ce3c9){return new BPromise(function(_0x363374,_0x161302){return client[_0xf3ee('0xb')](_0x5bcda6,_0x7ce3c9)[_0xf3ee('0xc')](function(_0x259d51){logger[_0xf3ee('0xd')](_0xf3ee('0xe'),_0x4d22a7,_0xf3ee('0xf'));logger['debug'](_0xf3ee('0x10'),_0x4d22a7,'request\x20sent',JSON[_0xf3ee('0x11')](_0x259d51));if(_0x259d51[_0xf3ee('0x12')]){if(_0x259d51[_0xf3ee('0x12')][_0xf3ee('0x13')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4d22a7,_0x259d51['error'][_0xf3ee('0x14')]);return _0x161302(_0x259d51[_0xf3ee('0x12')][_0xf3ee('0x14')]);}logger[_0xf3ee('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x4d22a7,_0x259d51[_0xf3ee('0x12')][_0xf3ee('0x14')]);return _0x363374(_0x259d51['error'][_0xf3ee('0x14')]);}else{logger[_0xf3ee('0xd')](_0xf3ee('0xe'),_0x4d22a7,_0xf3ee('0xf'));_0x363374(_0x259d51[_0xf3ee('0x15')][_0xf3ee('0x14')]);}})[_0xf3ee('0x16')](function(_0x59ff71){logger[_0xf3ee('0x12')](_0xf3ee('0xe'),_0x4d22a7,_0x59ff71);_0x161302(_0x59ff71);});});}exports['GetSalesforceAccount']=function(_0x4afeed){var _0x37eb47=this;return new Promise(function(_0x1eb2c2,_0x301162){return db['SalesforceAccount'][_0xf3ee('0x17')]({'raw':_0x4afeed[_0xf3ee('0x18')]?_0x4afeed['options']['raw']===undefined?!![]:![]:!![],'where':_0x4afeed['options']?_0x4afeed[_0xf3ee('0x18')][_0xf3ee('0x19')]||null:null,'attributes':_0x4afeed[_0xf3ee('0x18')]?_0x4afeed[_0xf3ee('0x18')][_0xf3ee('0x1a')]||null:null,'limit':_0x4afeed[_0xf3ee('0x18')]?_0x4afeed[_0xf3ee('0x18')][_0xf3ee('0x1b')]||null:null,'include':_0x4afeed['options']?_0x4afeed[_0xf3ee('0x18')]['include']?_[_0xf3ee('0x1c')](_0x4afeed[_0xf3ee('0x18')][_0xf3ee('0x1d')],function(_0x6b5fa2){return{'model':db[_0x6b5fa2[_0xf3ee('0x1e')]],'as':_0x6b5fa2['as'],'attributes':_0x6b5fa2[_0xf3ee('0x1a')],'include':_0x6b5fa2[_0xf3ee('0x1d')]?_[_0xf3ee('0x1c')](_0x6b5fa2[_0xf3ee('0x1d')],function(_0x356e01){return{'model':db[_0x356e01[_0xf3ee('0x1e')]],'as':_0x356e01['as'],'attributes':_0x356e01[_0xf3ee('0x1a')],'include':_0x356e01[_0xf3ee('0x1d')]?_['map'](_0x356e01[_0xf3ee('0x1d')],function(_0x1314c3){return{'model':db[_0x1314c3['model']],'as':_0x1314c3['as'],'attributes':_0x1314c3[_0xf3ee('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf3ee('0xc')](function(_0x3dd84e){logger[_0xf3ee('0xd')](_0xf3ee('0x1f'),_0x4afeed);logger[_0xf3ee('0x20')](_0xf3ee('0x1f'),_0x4afeed,JSON[_0xf3ee('0x11')](_0x3dd84e));_0x1eb2c2(_0x3dd84e);})[_0xf3ee('0x16')](function(_0x53c17c){logger['error']('GetSalesforceAccount',_0x53c17c[_0xf3ee('0x14')],_0x4afeed);_0x301162(_0x37eb47[_0xf3ee('0x12')](0x1f4,_0x53c17c[_0xf3ee('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x166364){var _0x192937=this;return new Promise(function(_0x3caa6f,_0x370ab1){return db[_0xf3ee('0x21')][_0xf3ee('0x22')]({'raw':_0x166364[_0xf3ee('0x18')]?_0x166364[_0xf3ee('0x18')][_0xf3ee('0x23')]===undefined?!![]:![]:!![],'where':_0x166364[_0xf3ee('0x18')]?_0x166364[_0xf3ee('0x18')]['where']||null:null,'attributes':_0x166364[_0xf3ee('0x18')]?_0x166364[_0xf3ee('0x18')]['attributes']||null:null,'include':_0x166364['options']?_0x166364[_0xf3ee('0x18')][_0xf3ee('0x1d')]?_[_0xf3ee('0x1c')](_0x166364[_0xf3ee('0x18')][_0xf3ee('0x1d')],function(_0x13aa98){return{'model':db[_0x13aa98['model']],'as':_0x13aa98['as'],'attributes':_0x13aa98['attributes'],'include':_0x13aa98[_0xf3ee('0x1d')]?_['map'](_0x13aa98['include'],function(_0x3663e8){return{'model':db[_0x3663e8[_0xf3ee('0x1e')]],'as':_0x3663e8['as'],'attributes':_0x3663e8[_0xf3ee('0x1a')],'include':_0x3663e8[_0xf3ee('0x1d')]?_[_0xf3ee('0x1c')](_0x3663e8[_0xf3ee('0x1d')],function(_0xbbae89){return{'model':db[_0xbbae89[_0xf3ee('0x1e')]],'as':_0xbbae89['as'],'attributes':_0xbbae89['attributes']};}):[]};}):[]};}):[]:[]})[_0xf3ee('0xc')](function(_0x25bd61){logger['info'](_0xf3ee('0x24'),_0x166364);logger[_0xf3ee('0x20')]('ShowSalesforceAccount',_0x166364,JSON[_0xf3ee('0x11')](_0x25bd61));_0x3caa6f(_0x25bd61);})[_0xf3ee('0x16')](function(_0x4532f9){logger[_0xf3ee('0x12')](_0xf3ee('0x24'),_0x4532f9[_0xf3ee('0x14')],_0x166364);_0x370ab1(_0x192937[_0xf3ee('0x12')](0x1f4,_0x4532f9[_0xf3ee('0x14')]));});});}; \ No newline at end of file +var _0x47a1=['stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','SalesforceAccount','find','ShowSalesforceAccount','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1d3639,_0x2b9506){var _0x344fd1=function(_0x48aea0){while(--_0x48aea0){_0x1d3639['push'](_0x1d3639['shift']());}};_0x344fd1(++_0x2b9506);}(_0x47a1,0xbd));var _0x147a=function(_0x5b1669,_0x244898){_0x5b1669=_0x5b1669-0x0;var _0xe28953=_0x47a1[_0x5b1669];return _0xe28953;};'use strict';var _=require(_0x147a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x147a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x147a('0x2'));var db=require(_0x147a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x147a('0x4'))(_0x147a('0x5'));var config=require(_0x147a('0x6'));var jayson=require(_0x147a('0x7'));var client=jayson[_0x147a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a0a85,_0x312654,_0x130a3b){return new BPromise(function(_0x28a263,_0x375c68){return client[_0x147a('0x9')](_0x2a0a85,_0x130a3b)[_0x147a('0xa')](function(_0x5c80cf){logger[_0x147a('0xb')](_0x147a('0xc'),_0x312654,'request\x20sent');logger[_0x147a('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x312654,_0x147a('0xe'),JSON[_0x147a('0xf')](_0x5c80cf));if(_0x5c80cf[_0x147a('0x10')]){if(_0x5c80cf['error'][_0x147a('0x11')]===0x1f4){logger[_0x147a('0x10')](_0x147a('0xc'),_0x312654,_0x5c80cf['error'][_0x147a('0x12')]);return _0x375c68(_0x5c80cf[_0x147a('0x10')][_0x147a('0x12')]);}logger[_0x147a('0x10')](_0x147a('0xc'),_0x312654,_0x5c80cf[_0x147a('0x10')][_0x147a('0x12')]);return _0x28a263(_0x5c80cf[_0x147a('0x10')][_0x147a('0x12')]);}else{logger['info'](_0x147a('0xc'),_0x312654,'request\x20sent');_0x28a263(_0x5c80cf[_0x147a('0x13')][_0x147a('0x12')]);}})[_0x147a('0x14')](function(_0xac7ef5){logger[_0x147a('0x10')](_0x147a('0xc'),_0x312654,_0xac7ef5);_0x375c68(_0xac7ef5);});});}exports['GetSalesforceAccount']=function(_0x51fd3a){var _0x590a79=this;return new Promise(function(_0x427ffd,_0x19848e){return db['SalesforceAccount'][_0x147a('0x15')]({'raw':_0x51fd3a['options']?_0x51fd3a[_0x147a('0x16')][_0x147a('0x17')]===undefined?!![]:![]:!![],'where':_0x51fd3a[_0x147a('0x16')]?_0x51fd3a[_0x147a('0x16')][_0x147a('0x18')]||null:null,'attributes':_0x51fd3a[_0x147a('0x16')]?_0x51fd3a[_0x147a('0x16')][_0x147a('0x19')]||null:null,'limit':_0x51fd3a[_0x147a('0x16')]?_0x51fd3a[_0x147a('0x16')][_0x147a('0x1a')]||null:null,'include':_0x51fd3a['options']?_0x51fd3a[_0x147a('0x16')][_0x147a('0x1b')]?_[_0x147a('0x1c')](_0x51fd3a[_0x147a('0x16')][_0x147a('0x1b')],function(_0x5059f7){return{'model':db[_0x5059f7[_0x147a('0x1d')]],'as':_0x5059f7['as'],'attributes':_0x5059f7['attributes'],'include':_0x5059f7['include']?_['map'](_0x5059f7[_0x147a('0x1b')],function(_0x5774cb){return{'model':db[_0x5774cb[_0x147a('0x1d')]],'as':_0x5774cb['as'],'attributes':_0x5774cb['attributes'],'include':_0x5774cb[_0x147a('0x1b')]?_[_0x147a('0x1c')](_0x5774cb[_0x147a('0x1b')],function(_0x534e3a){return{'model':db[_0x534e3a['model']],'as':_0x534e3a['as'],'attributes':_0x534e3a[_0x147a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x147a('0xa')](function(_0x3131e9){logger[_0x147a('0xb')](_0x147a('0x1e'),_0x51fd3a);logger[_0x147a('0xd')](_0x147a('0x1e'),_0x51fd3a,JSON[_0x147a('0xf')](_0x3131e9));_0x427ffd(_0x3131e9);})['catch'](function(_0x346c78){logger[_0x147a('0x10')](_0x147a('0x1e'),_0x346c78[_0x147a('0x12')],_0x51fd3a);_0x19848e(_0x590a79['error'](0x1f4,_0x346c78['message']));});});};exports['ShowSalesforceAccount']=function(_0x3a7189){var _0x2f5bc7=this;return new Promise(function(_0x59ccf5,_0x45c3d3){return db[_0x147a('0x1f')][_0x147a('0x20')]({'raw':_0x3a7189[_0x147a('0x16')]?_0x3a7189[_0x147a('0x16')][_0x147a('0x17')]===undefined?!![]:![]:!![],'where':_0x3a7189['options']?_0x3a7189['options']['where']||null:null,'attributes':_0x3a7189[_0x147a('0x16')]?_0x3a7189[_0x147a('0x16')]['attributes']||null:null,'include':_0x3a7189[_0x147a('0x16')]?_0x3a7189[_0x147a('0x16')]['include']?_[_0x147a('0x1c')](_0x3a7189[_0x147a('0x16')][_0x147a('0x1b')],function(_0x5d87b1){return{'model':db[_0x5d87b1['model']],'as':_0x5d87b1['as'],'attributes':_0x5d87b1[_0x147a('0x19')],'include':_0x5d87b1['include']?_[_0x147a('0x1c')](_0x5d87b1[_0x147a('0x1b')],function(_0x2a7a6f){return{'model':db[_0x2a7a6f[_0x147a('0x1d')]],'as':_0x2a7a6f['as'],'attributes':_0x2a7a6f[_0x147a('0x19')],'include':_0x2a7a6f[_0x147a('0x1b')]?_[_0x147a('0x1c')](_0x2a7a6f[_0x147a('0x1b')],function(_0x140f7b){return{'model':db[_0x140f7b[_0x147a('0x1d')]],'as':_0x140f7b['as'],'attributes':_0x140f7b[_0x147a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x147a('0xa')](function(_0x123bfc){logger[_0x147a('0xb')]('ShowSalesforceAccount',_0x3a7189);logger['debug'](_0x147a('0x21'),_0x3a7189,JSON[_0x147a('0xf')](_0x123bfc));_0x59ccf5(_0x123bfc);})[_0x147a('0x14')](function(_0x275321){logger[_0x147a('0x10')](_0x147a('0x21'),_0x275321[_0x147a('0x12')],_0x3a7189);_0x45c3d3(_0x2f5bc7[_0x147a('0x10')](0x1f4,_0x275321[_0x147a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 543d22c..e2f262d 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0x3609df,_0x13bc20){_0x3609df=_0x3609df-0x0;var _0x22ab78=_0x2032[_0x3609df];return _0x22ab78;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdb28,0x106));var _0x8db2=function(_0x435646,_0x43a14d){_0x435646=_0x435646-0x0;var _0x40923b=_0xdb28[_0x435646];return _0x40923b;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index aae5951..9fe7e7b 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 _0x34f9=['STRING','ENUM','Task','contact_lead','contact','account_contact_lead','account','nothing','lead','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x34f9,0xfb));var _0x934f=function(_0x1f0203,_0x2f9046){_0x1f0203=_0x1f0203-0x0;var _0x39e381=_0x34f9[_0x1f0203];return _0x39e381;};'use strict';var Sequelize=require(_0x934f('0x0'));module[_0x934f('0x1')]={'name':{'type':Sequelize[_0x934f('0x2')]},'description':{'type':Sequelize[_0x934f('0x2')]},'ticketType':{'type':Sequelize[_0x934f('0x3')](_0x934f('0x4'),'Case'),'defaultValue':_0x934f('0x4')},'moduleSearch':{'type':Sequelize[_0x934f('0x3')](_0x934f('0x5'),_0x934f('0x6'),'lead',_0x934f('0x7'),_0x934f('0x8')),'defaultValue':_0x934f('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x934f('0x9'),_0x934f('0x6'),_0x934f('0xa'),_0x934f('0x8')),'defaultValue':_0x934f('0xa')},'leadId':{'type':Sequelize[_0x934f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x934f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x934f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x934f('0x2')]}}; \ No newline at end of file +var _0x306e=['nothing','contact','account','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','lead','account_contact_lead'];(function(_0x2b57fc,_0x4b3658){var _0x5bf238=function(_0x21661a){while(--_0x21661a){_0x2b57fc['push'](_0x2b57fc['shift']());}};_0x5bf238(++_0x4b3658);}(_0x306e,0x13b));var _0xe306=function(_0x28695e,_0x96594f){_0x28695e=_0x28695e-0x0;var _0x1f1ffa=_0x306e[_0x28695e];return _0x1f1ffa;};'use strict';var Sequelize=require(_0xe306('0x0'));module[_0xe306('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe306('0x2')]},'ticketType':{'type':Sequelize[_0xe306('0x3')](_0xe306('0x4'),_0xe306('0x5')),'defaultValue':_0xe306('0x4')},'moduleSearch':{'type':Sequelize[_0xe306('0x3')](_0xe306('0x6'),'contact',_0xe306('0x7'),_0xe306('0x8'),'account'),'defaultValue':_0xe306('0x6')},'moduleCreate':{'type':Sequelize[_0xe306('0x3')](_0xe306('0x9'),_0xe306('0xa'),_0xe306('0x7'),_0xe306('0xb')),'defaultValue':_0xe306('0x7')},'leadId':{'type':Sequelize[_0xe306('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe306('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xe306('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index d8b64b5..0c48024 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 _0xbdaa=['then','destroy','error','stack','name','send','map','SalesforceConfiguration','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','rows','params','rawAttributes','options','find','catch','create','body','getFields','pick','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbdaa,0x16f));var _0xabda=function(_0xf7b340,_0x5877b1){_0xf7b340=_0xf7b340-0x0;var _0x124440=_0xbdaa[_0xf7b340];return _0x124440;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabda('0x0'));var zipdir=require(_0xabda('0x1'));var jsonpatch=require(_0xabda('0x2'));var rp=require(_0xabda('0x3'));var moment=require(_0xabda('0x4'));var BPromise=require(_0xabda('0x5'));var Mustache=require(_0xabda('0x6'));var util=require(_0xabda('0x7'));var path=require(_0xabda('0x8'));var sox=require(_0xabda('0x9'));var csv=require(_0xabda('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabda('0xb'));var _=require('lodash');var squel=require(_0xabda('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabda('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabda('0xe'));var Redis=require(_0xabda('0xf'));var authService=require(_0xabda('0x10'));var qs=require(_0xabda('0x11'));var as=require(_0xabda('0x12'));var hardwareService=require(_0xabda('0x13'));var logger=require(_0xabda('0x14'))('api');var utils=require(_0xabda('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabda('0x16'));var db=require(_0xabda('0x17'))['db'];function respondWithStatusCode(_0x10b4e2,_0x3a54dc){_0x3a54dc=_0x3a54dc||0xcc;return function(_0x5831db){if(_0x5831db){return _0x10b4e2[_0xabda('0x18')](_0x3a54dc);}return _0x10b4e2[_0xabda('0x19')](_0x3a54dc)[_0xabda('0x1a')]();};}function respondWithResult(_0x3fc661,_0x161d19){_0x161d19=_0x161d19||0xc8;return function(_0x658a04){if(_0x658a04){return _0x3fc661[_0xabda('0x19')](_0x161d19)[_0xabda('0x1b')](_0x658a04);}};}function respondWithFilteredResult(_0x2bf54f,_0x133087){return function(_0x309765){if(_0x309765){var _0x2d505b=typeof _0x133087[_0xabda('0x1c')]===_0xabda('0x1d')&&typeof _0x133087[_0xabda('0x1e')]==='undefined';var _0x503c8a=_0x309765[_0xabda('0x1f')];var _0x1a3c1c=_0x2d505b?0x0:_0x133087[_0xabda('0x1c')];var _0x45b997=_0x2d505b?_0x309765['count']:_0x133087['offset']+_0x133087[_0xabda('0x1e')];var _0x3ec4a0;if(_0x45b997>=_0x503c8a){_0x45b997=_0x503c8a;_0x3ec4a0=0xc8;}else{_0x3ec4a0=0xce;}_0x2bf54f[_0xabda('0x19')](_0x3ec4a0);return _0x2bf54f[_0xabda('0x20')](_0xabda('0x21'),_0x1a3c1c+'-'+_0x45b997+'/'+_0x503c8a)[_0xabda('0x1b')](_0x309765);}return null;};}function patchUpdates(_0x2862de){return function(_0x11a858){try{jsonpatch[_0xabda('0x22')](_0x11a858,_0x2862de,!![]);}catch(_0x35ea16){return BPromise[_0xabda('0x23')](_0x35ea16);}return _0x11a858[_0xabda('0x24')]();};}function saveUpdates(_0x5be169,_0x3cfb40){return function(_0x82ae6c){if(_0x82ae6c){return _0x82ae6c[_0xabda('0x25')](_0x5be169)[_0xabda('0x26')](function(_0x42d75a){return _0x42d75a;});}return null;};}function removeEntity(_0x5d62cd,_0x3f4012){return function(_0x496cde){if(_0x496cde){return _0x496cde[_0xabda('0x27')]()[_0xabda('0x26')](function(){_0x5d62cd[_0xabda('0x19')](0xcc)[_0xabda('0x1a')]();});}};}function handleEntityNotFound(_0x2dfc1b,_0x2a5db0){return function(_0xc44aed){if(!_0xc44aed){_0x2dfc1b['sendStatus'](0x194);}return _0xc44aed;};}function handleError(_0x3e3cc1,_0x127a0b){_0x127a0b=_0x127a0b||0x1f4;return function(_0x4993d0){logger[_0xabda('0x28')](_0x4993d0[_0xabda('0x29')]);if(_0x4993d0[_0xabda('0x2a')]){delete _0x4993d0['name'];}_0x3e3cc1[_0xabda('0x19')](_0x127a0b)[_0xabda('0x2b')](_0x4993d0);};}exports['index']=function(_0x5e0d11,_0x237ddb){var _0x31b0cd={},_0x536d3f={},_0x4e0393={'count':0x0,'rows':[]};var _0x1f5616=_[_0xabda('0x2c')](db[_0xabda('0x2d')]['rawAttributes'],function(_0x5b8d4a){return{'name':_0x5b8d4a[_0xabda('0x2e')],'type':_0x5b8d4a[_0xabda('0x2f')][_0xabda('0x30')]};});_0x536d3f[_0xabda('0x31')]=_[_0xabda('0x2c')](_0x1f5616,_0xabda('0x2a'));_0x536d3f['query']=_[_0xabda('0x32')](_0x5e0d11[_0xabda('0x33')]);_0x536d3f['filters']=_[_0xabda('0x34')](_0x536d3f[_0xabda('0x31')],_0x536d3f[_0xabda('0x33')]);_0x31b0cd[_0xabda('0x35')]=_[_0xabda('0x34')](_0x536d3f['model'],qs[_0xabda('0x36')](_0x5e0d11[_0xabda('0x33')][_0xabda('0x36')]));_0x31b0cd[_0xabda('0x35')]=_0x31b0cd[_0xabda('0x35')][_0xabda('0x37')]?_0x31b0cd['attributes']:_0x536d3f[_0xabda('0x31')];if(!_0x5e0d11[_0xabda('0x33')][_0xabda('0x38')](_0xabda('0x39'))){_0x31b0cd['limit']=qs['limit'](_0x5e0d11[_0xabda('0x33')][_0xabda('0x1e')]);_0x31b0cd[_0xabda('0x1c')]=qs[_0xabda('0x1c')](_0x5e0d11[_0xabda('0x33')]['offset']);}_0x31b0cd[_0xabda('0x3a')]=qs['sort'](_0x5e0d11[_0xabda('0x33')][_0xabda('0x3b')]);_0x31b0cd[_0xabda('0x3c')]=qs[_0xabda('0x3d')](_['pick'](_0x5e0d11[_0xabda('0x33')],_0x536d3f[_0xabda('0x3d')]),_0x1f5616);if(_0x5e0d11[_0xabda('0x33')]['filter']){_0x31b0cd['where']=_[_0xabda('0x3e')](_0x31b0cd[_0xabda('0x3c')],{'$or':_[_0xabda('0x2c')](_0x1f5616,function(_0x24b1ca){if(_0x24b1ca[_0xabda('0x2f')]!==_0xabda('0x3f')){var _0x563737={};_0x563737[_0x24b1ca[_0xabda('0x2a')]]={'$like':'%'+_0x5e0d11['query'][_0xabda('0x40')]+'%'};return _0x563737;}})});}_0x31b0cd=_[_0xabda('0x3e')]({},_0x31b0cd,_0x5e0d11['options']);var _0x3062bf={'where':_0x31b0cd['where']};return db[_0xabda('0x2d')][_0xabda('0x1f')](_0x3062bf)['then'](function(_0x2aefbb){_0x4e0393[_0xabda('0x1f')]=_0x2aefbb;if(_0x5e0d11['query'][_0xabda('0x41')]){_0x31b0cd[_0xabda('0x42')]=[{'all':!![]}];}return db[_0xabda('0x2d')]['findAll'](_0x31b0cd);})[_0xabda('0x26')](function(_0x52f347){_0x4e0393[_0xabda('0x43')]=_0x52f347;return _0x4e0393;})[_0xabda('0x26')](respondWithFilteredResult(_0x237ddb,_0x31b0cd))['catch'](handleError(_0x237ddb,null));};exports['show']=function(_0x17dba7,_0x452096){var _0x245430={'raw':![],'where':{'id':_0x17dba7[_0xabda('0x44')]['id']}},_0x51a691={};_0x51a691[_0xabda('0x31')]=_[_0xabda('0x32')](db[_0xabda('0x2d')][_0xabda('0x45')]);_0x51a691['query']=_['keys'](_0x17dba7['query']);_0x51a691[_0xabda('0x3d')]=_[_0xabda('0x34')](_0x51a691[_0xabda('0x31')],_0x51a691['query']);_0x245430[_0xabda('0x35')]=_[_0xabda('0x34')](_0x51a691['model'],qs[_0xabda('0x36')](_0x17dba7['query'][_0xabda('0x36')]));_0x245430[_0xabda('0x35')]=_0x245430[_0xabda('0x35')][_0xabda('0x37')]?_0x245430[_0xabda('0x35')]:_0x51a691[_0xabda('0x31')];if(_0x17dba7[_0xabda('0x33')]['includeAll']){_0x245430[_0xabda('0x42')]=[{'all':!![]}];}_0x245430=_['merge']({},_0x245430,_0x17dba7[_0xabda('0x46')]);return db[_0xabda('0x2d')][_0xabda('0x47')](_0x245430)[_0xabda('0x26')](handleEntityNotFound(_0x452096,null))['then'](respondWithResult(_0x452096,null))[_0xabda('0x48')](handleError(_0x452096,null));};exports[_0xabda('0x49')]=function(_0x2fcbbc,_0x41fea8){return db[_0xabda('0x2d')][_0xabda('0x49')](_0x2fcbbc[_0xabda('0x4a')],{})[_0xabda('0x26')](respondWithResult(_0x41fea8,0xc9))[_0xabda('0x48')](handleError(_0x41fea8,null));};exports[_0xabda('0x25')]=function(_0x5c8e10,_0x378921){if(_0x5c8e10['body']['id']){delete _0x5c8e10[_0xabda('0x4a')]['id'];}return db[_0xabda('0x2d')][_0xabda('0x47')]({'where':{'id':_0x5c8e10[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x378921,null))[_0xabda('0x26')](saveUpdates(_0x5c8e10[_0xabda('0x4a')],null))[_0xabda('0x26')](respondWithResult(_0x378921,null))[_0xabda('0x48')](handleError(_0x378921,null));};exports[_0xabda('0x27')]=function(_0xa19d52,_0x230fec){return db[_0xabda('0x2d')][_0xabda('0x47')]({'where':{'id':_0xa19d52[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x230fec,null))[_0xabda('0x26')](removeEntity(_0x230fec,null))[_0xabda('0x48')](handleError(_0x230fec,null));};exports[_0xabda('0x4b')]=function(_0x5080e6,_0x5bfc05,_0x6eebfc){var _0x157da3={};var _0x3ac61e={};var _0x2c88fc;var _0xc9bafb;return db[_0xabda('0x2d')]['findOne']({'where':{'id':_0x5080e6[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x5bfc05,null))['then'](function(_0x560fd4){if(_0x560fd4){_0x2c88fc=_0x560fd4;_0x3ac61e['model']=_['keys'](db['SalesforceField'][_0xabda('0x45')]);_0x3ac61e[_0xabda('0x33')]=_[_0xabda('0x32')](_0x5080e6['query']);_0x3ac61e[_0xabda('0x3d')]=_[_0xabda('0x34')](_0x3ac61e[_0xabda('0x31')],_0x3ac61e[_0xabda('0x33')]);_0x157da3[_0xabda('0x35')]=_[_0xabda('0x34')](_0x3ac61e[_0xabda('0x31')],qs['fields'](_0x5080e6[_0xabda('0x33')][_0xabda('0x36')]));_0x157da3['attributes']=_0x157da3[_0xabda('0x35')]['length']?_0x157da3['attributes']:_0x3ac61e[_0xabda('0x31')];_0x157da3[_0xabda('0x3a')]=qs['sort'](_0x5080e6[_0xabda('0x33')][_0xabda('0x3b')]);_0x157da3[_0xabda('0x3c')]=qs['filters'](_[_0xabda('0x4c')](_0x5080e6[_0xabda('0x33')],_0x3ac61e[_0xabda('0x3d')]));if(_0x5080e6[_0xabda('0x33')][_0xabda('0x40')]){_0x157da3['where']=_[_0xabda('0x3e')](_0x157da3['where'],{'$or':_['map'](_0x157da3[_0xabda('0x35')],function(_0x4e8745){var _0x331e3e={};_0x331e3e[_0x4e8745]={'$like':'%'+_0x5080e6[_0xabda('0x33')]['filter']+'%'};return _0x331e3e;})});}_0x157da3=_['merge']({},_0x157da3,_0x5080e6[_0xabda('0x46')]);return _0x2c88fc[_0xabda('0x4b')](_0x157da3);}})['then'](function(_0xffaa72){if(_0xffaa72){_0xc9bafb=_0xffaa72[_0xabda('0x37')];if(!_0x5080e6['query']['hasOwnProperty'](_0xabda('0x39'))){_0x157da3[_0xabda('0x1e')]=qs['limit'](_0x5080e6[_0xabda('0x33')][_0xabda('0x1e')]);_0x157da3['offset']=qs['offset'](_0x5080e6[_0xabda('0x33')]['offset']);}return _0x2c88fc[_0xabda('0x4b')](_0x157da3);}})['then'](function(_0x202760){if(_0x202760){return _0x202760?{'count':_0xc9bafb,'rows':_0x202760}:null;}})[_0xabda('0x26')](respondWithResult(_0x5bfc05,null))[_0xabda('0x48')](handleError(_0x5bfc05,null));};exports['getSubjects']=function(_0x28f5d0,_0x12872d,_0x135d4c){var _0x34a99c={};var _0x371dec={};var _0x6427c4;var _0x140468;return db[_0xabda('0x2d')][_0xabda('0x4d')]({'where':{'id':_0x28f5d0[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x12872d,null))[_0xabda('0x26')](function(_0x43eb82){if(_0x43eb82){_0x6427c4=_0x43eb82;_0x371dec[_0xabda('0x31')]=_['keys'](db[_0xabda('0x4e')][_0xabda('0x45')]);_0x371dec[_0xabda('0x33')]=_[_0xabda('0x32')](_0x28f5d0['query']);_0x371dec[_0xabda('0x3d')]=_[_0xabda('0x34')](_0x371dec[_0xabda('0x31')],_0x371dec[_0xabda('0x33')]);_0x34a99c[_0xabda('0x35')]=_[_0xabda('0x34')](_0x371dec[_0xabda('0x31')],qs[_0xabda('0x36')](_0x28f5d0[_0xabda('0x33')][_0xabda('0x36')]));_0x34a99c[_0xabda('0x35')]=_0x34a99c[_0xabda('0x35')][_0xabda('0x37')]?_0x34a99c[_0xabda('0x35')]:_0x371dec[_0xabda('0x31')];_0x34a99c['order']=qs[_0xabda('0x3b')](_0x28f5d0[_0xabda('0x33')][_0xabda('0x3b')]);_0x34a99c[_0xabda('0x3c')]=qs[_0xabda('0x3d')](_['pick'](_0x28f5d0[_0xabda('0x33')],_0x371dec[_0xabda('0x3d')]));if(_0x28f5d0[_0xabda('0x33')][_0xabda('0x40')]){_0x34a99c['where']=_[_0xabda('0x3e')](_0x34a99c[_0xabda('0x3c')],{'$or':_[_0xabda('0x2c')](_0x34a99c[_0xabda('0x35')],function(_0x362314){var _0x8df818={};_0x8df818[_0x362314]={'$like':'%'+_0x28f5d0[_0xabda('0x33')][_0xabda('0x40')]+'%'};return _0x8df818;})});}_0x34a99c=_[_0xabda('0x3e')]({},_0x34a99c,_0x28f5d0['options']);return _0x6427c4[_0xabda('0x4f')](_0x34a99c);}})[_0xabda('0x26')](function(_0x4211cf){if(_0x4211cf){_0x140468=_0x4211cf['length'];if(!_0x28f5d0[_0xabda('0x33')][_0xabda('0x38')](_0xabda('0x39'))){_0x34a99c[_0xabda('0x1e')]=qs['limit'](_0x28f5d0['query'][_0xabda('0x1e')]);_0x34a99c[_0xabda('0x1c')]=qs['offset'](_0x28f5d0['query'][_0xabda('0x1c')]);}return _0x6427c4[_0xabda('0x4f')](_0x34a99c);}})[_0xabda('0x26')](function(_0x467c53){if(_0x467c53){return _0x467c53?{'count':_0x140468,'rows':_0x467c53}:null;}})[_0xabda('0x26')](respondWithResult(_0x12872d,null))[_0xabda('0x48')](handleError(_0x12872d,null));};exports['getDescriptions']=function(_0x464a0b,_0x42865b,_0x5ef4af){var _0x4ae82a={};var _0x4e5dc4={};var _0x1fc0d8;var _0x351daf;return db[_0xabda('0x2d')][_0xabda('0x4d')]({'where':{'id':_0x464a0b[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x42865b,null))[_0xabda('0x26')](function(_0x4cc750){if(_0x4cc750){_0x1fc0d8=_0x4cc750;_0x4e5dc4[_0xabda('0x31')]=_[_0xabda('0x32')](db[_0xabda('0x4e')]['rawAttributes']);_0x4e5dc4[_0xabda('0x33')]=_[_0xabda('0x32')](_0x464a0b[_0xabda('0x33')]);_0x4e5dc4[_0xabda('0x3d')]=_[_0xabda('0x34')](_0x4e5dc4['model'],_0x4e5dc4[_0xabda('0x33')]);_0x4ae82a[_0xabda('0x35')]=_[_0xabda('0x34')](_0x4e5dc4['model'],qs['fields'](_0x464a0b[_0xabda('0x33')][_0xabda('0x36')]));_0x4ae82a[_0xabda('0x35')]=_0x4ae82a[_0xabda('0x35')][_0xabda('0x37')]?_0x4ae82a['attributes']:_0x4e5dc4['model'];_0x4ae82a['order']=qs['sort'](_0x464a0b[_0xabda('0x33')][_0xabda('0x3b')]);_0x4ae82a[_0xabda('0x3c')]=qs[_0xabda('0x3d')](_[_0xabda('0x4c')](_0x464a0b['query'],_0x4e5dc4[_0xabda('0x3d')]));if(_0x464a0b['query'][_0xabda('0x40')]){_0x4ae82a['where']=_[_0xabda('0x3e')](_0x4ae82a['where'],{'$or':_['map'](_0x4ae82a['attributes'],function(_0x5eb572){var _0x2a6c86={};_0x2a6c86[_0x5eb572]={'$like':'%'+_0x464a0b[_0xabda('0x33')][_0xabda('0x40')]+'%'};return _0x2a6c86;})});}_0x4ae82a=_['merge']({},_0x4ae82a,_0x464a0b['options']);return _0x1fc0d8[_0xabda('0x50')](_0x4ae82a);}})[_0xabda('0x26')](function(_0x57a822){if(_0x57a822){_0x351daf=_0x57a822[_0xabda('0x37')];if(!_0x464a0b[_0xabda('0x33')][_0xabda('0x38')](_0xabda('0x39'))){_0x4ae82a[_0xabda('0x1e')]=qs[_0xabda('0x1e')](_0x464a0b[_0xabda('0x33')][_0xabda('0x1e')]);_0x4ae82a[_0xabda('0x1c')]=qs[_0xabda('0x1c')](_0x464a0b[_0xabda('0x33')]['offset']);}return _0x1fc0d8[_0xabda('0x50')](_0x4ae82a);}})[_0xabda('0x26')](function(_0x373644){if(_0x373644){return _0x373644?{'count':_0x351daf,'rows':_0x373644}:null;}})[_0xabda('0x26')](respondWithResult(_0x42865b,null))['catch'](handleError(_0x42865b,null));}; \ No newline at end of file +var _0x2690=['getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','destroy','getFields','SalesforceField','map','nolimit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2690,0xa7));var _0x0269=function(_0x252ef1,_0x2e0041){_0x252ef1=_0x252ef1-0x0;var _0x25817c=_0x2690[_0x252ef1];return _0x25817c;};'use strict';var emlformat=require(_0x0269('0x0'));var rimraf=require(_0x0269('0x1'));var zipdir=require(_0x0269('0x2'));var jsonpatch=require(_0x0269('0x3'));var rp=require(_0x0269('0x4'));var moment=require(_0x0269('0x5'));var BPromise=require(_0x0269('0x6'));var Mustache=require(_0x0269('0x7'));var util=require(_0x0269('0x8'));var path=require(_0x0269('0x9'));var sox=require('sox');var csv=require(_0x0269('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0269('0xb'));var _=require(_0x0269('0xc'));var squel=require(_0x0269('0xd'));var crypto=require('crypto');var jsforce=require(_0x0269('0xe'));var deskjs=require(_0x0269('0xf'));var toCsv=require(_0x0269('0xa'));var querystring=require('querystring');var Papa=require(_0x0269('0x10'));var Redis=require(_0x0269('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0269('0x12'));var as=require(_0x0269('0x13'));var hardwareService=require(_0x0269('0x14'));var logger=require('../../config/logger')(_0x0269('0x15'));var utils=require(_0x0269('0x16'));var config=require(_0x0269('0x17'));var licenseUtil=require(_0x0269('0x18'));var db=require(_0x0269('0x19'))['db'];function respondWithStatusCode(_0x286dd2,_0x1da87a){_0x1da87a=_0x1da87a||0xcc;return function(_0x2eebb3){if(_0x2eebb3){return _0x286dd2[_0x0269('0x1a')](_0x1da87a);}return _0x286dd2['status'](_0x1da87a)[_0x0269('0x1b')]();};}function respondWithResult(_0x371c18,_0x31392e){_0x31392e=_0x31392e||0xc8;return function(_0x5e502b){if(_0x5e502b){return _0x371c18[_0x0269('0x1c')](_0x31392e)[_0x0269('0x1d')](_0x5e502b);}};}function respondWithFilteredResult(_0x4af045,_0x1693ea){return function(_0x4362c6){if(_0x4362c6){var _0x3731b5=typeof _0x1693ea[_0x0269('0x1e')]==='undefined'&&typeof _0x1693ea['limit']===_0x0269('0x1f');var _0x4f46f3=_0x4362c6[_0x0269('0x20')];var _0x4b3a8b=_0x3731b5?0x0:_0x1693ea['offset'];var _0x18799b=_0x3731b5?_0x4362c6[_0x0269('0x20')]:_0x1693ea[_0x0269('0x1e')]+_0x1693ea[_0x0269('0x21')];var _0x408526;if(_0x18799b>=_0x4f46f3){_0x18799b=_0x4f46f3;_0x408526=0xc8;}else{_0x408526=0xce;}_0x4af045['status'](_0x408526);return _0x4af045[_0x0269('0x22')](_0x0269('0x23'),_0x4b3a8b+'-'+_0x18799b+'/'+_0x4f46f3)['json'](_0x4362c6);}return null;};}function patchUpdates(_0x39b5ef){return function(_0x1e9838){try{jsonpatch[_0x0269('0x24')](_0x1e9838,_0x39b5ef,!![]);}catch(_0x4c8472){return BPromise[_0x0269('0x25')](_0x4c8472);}return _0x1e9838['save']();};}function saveUpdates(_0x3218ea,_0x1fcef6){return function(_0x2f9a91){if(_0x2f9a91){return _0x2f9a91[_0x0269('0x26')](_0x3218ea)[_0x0269('0x27')](function(_0x4a77e0){return _0x4a77e0;});}return null;};}function removeEntity(_0x592a13,_0x4ffe2f){return function(_0x2714cf){if(_0x2714cf){return _0x2714cf['destroy']()['then'](function(){_0x592a13[_0x0269('0x1c')](0xcc)[_0x0269('0x1b')]();});}};}function handleEntityNotFound(_0xe15c90,_0x18d4aa){return function(_0x58329b){if(!_0x58329b){_0xe15c90[_0x0269('0x1a')](0x194);}return _0x58329b;};}function handleError(_0x162b8d,_0x5419ca){_0x5419ca=_0x5419ca||0x1f4;return function(_0x10dca0){logger[_0x0269('0x28')](_0x10dca0[_0x0269('0x29')]);if(_0x10dca0['name']){delete _0x10dca0[_0x0269('0x2a')];}_0x162b8d[_0x0269('0x1c')](_0x5419ca)['send'](_0x10dca0);};}exports[_0x0269('0x2b')]=function(_0x3ecbec,_0x573155){var _0x544cea={},_0x378155={},_0x2f3d50={'count':0x0,'rows':[]};var _0xefc19f=_['map'](db[_0x0269('0x2c')][_0x0269('0x2d')],function(_0x29f6c9){return{'name':_0x29f6c9['fieldName'],'type':_0x29f6c9[_0x0269('0x2e')][_0x0269('0x2f')]};});_0x378155[_0x0269('0x30')]=_['map'](_0xefc19f,'name');_0x378155[_0x0269('0x31')]=_[_0x0269('0x32')](_0x3ecbec[_0x0269('0x31')]);_0x378155[_0x0269('0x33')]=_[_0x0269('0x34')](_0x378155['model'],_0x378155[_0x0269('0x31')]);_0x544cea[_0x0269('0x35')]=_[_0x0269('0x34')](_0x378155[_0x0269('0x30')],qs['fields'](_0x3ecbec[_0x0269('0x31')][_0x0269('0x36')]));_0x544cea[_0x0269('0x35')]=_0x544cea[_0x0269('0x35')][_0x0269('0x37')]?_0x544cea[_0x0269('0x35')]:_0x378155[_0x0269('0x30')];if(!_0x3ecbec[_0x0269('0x31')][_0x0269('0x38')]('nolimit')){_0x544cea[_0x0269('0x21')]=qs[_0x0269('0x21')](_0x3ecbec[_0x0269('0x31')][_0x0269('0x21')]);_0x544cea[_0x0269('0x1e')]=qs['offset'](_0x3ecbec[_0x0269('0x31')][_0x0269('0x1e')]);}_0x544cea[_0x0269('0x39')]=qs[_0x0269('0x3a')](_0x3ecbec[_0x0269('0x31')]['sort']);_0x544cea['where']=qs['filters'](_[_0x0269('0x3b')](_0x3ecbec['query'],_0x378155['filters']),_0xefc19f);if(_0x3ecbec[_0x0269('0x31')][_0x0269('0x3c')]){_0x544cea[_0x0269('0x3d')]=_[_0x0269('0x3e')](_0x544cea[_0x0269('0x3d')],{'$or':_['map'](_0xefc19f,function(_0x284ccc){if(_0x284ccc[_0x0269('0x2e')]!=='VIRTUAL'){var _0x4f17be={};_0x4f17be[_0x284ccc[_0x0269('0x2a')]]={'$like':'%'+_0x3ecbec['query'][_0x0269('0x3c')]+'%'};return _0x4f17be;}})});}_0x544cea=_[_0x0269('0x3e')]({},_0x544cea,_0x3ecbec[_0x0269('0x3f')]);var _0x1cd204={'where':_0x544cea[_0x0269('0x3d')]};return db['SalesforceConfiguration'][_0x0269('0x20')](_0x1cd204)[_0x0269('0x27')](function(_0x200960){_0x2f3d50['count']=_0x200960;if(_0x3ecbec[_0x0269('0x31')][_0x0269('0x40')]){_0x544cea[_0x0269('0x41')]=[{'all':!![]}];}return db[_0x0269('0x2c')][_0x0269('0x42')](_0x544cea);})[_0x0269('0x27')](function(_0x17ab83){_0x2f3d50[_0x0269('0x43')]=_0x17ab83;return _0x2f3d50;})[_0x0269('0x27')](respondWithFilteredResult(_0x573155,_0x544cea))[_0x0269('0x44')](handleError(_0x573155,null));};exports[_0x0269('0x45')]=function(_0x382949,_0x2749de){var _0x35c927={'raw':![],'where':{'id':_0x382949['params']['id']}},_0x39e9e5={};_0x39e9e5['model']=_['keys'](db[_0x0269('0x2c')]['rawAttributes']);_0x39e9e5[_0x0269('0x31')]=_[_0x0269('0x32')](_0x382949['query']);_0x39e9e5['filters']=_[_0x0269('0x34')](_0x39e9e5[_0x0269('0x30')],_0x39e9e5['query']);_0x35c927[_0x0269('0x35')]=_[_0x0269('0x34')](_0x39e9e5[_0x0269('0x30')],qs[_0x0269('0x36')](_0x382949[_0x0269('0x31')][_0x0269('0x36')]));_0x35c927[_0x0269('0x35')]=_0x35c927[_0x0269('0x35')][_0x0269('0x37')]?_0x35c927['attributes']:_0x39e9e5[_0x0269('0x30')];if(_0x382949[_0x0269('0x31')]['includeAll']){_0x35c927[_0x0269('0x41')]=[{'all':!![]}];}_0x35c927=_[_0x0269('0x3e')]({},_0x35c927,_0x382949[_0x0269('0x3f')]);return db[_0x0269('0x2c')]['find'](_0x35c927)[_0x0269('0x27')](handleEntityNotFound(_0x2749de,null))['then'](respondWithResult(_0x2749de,null))[_0x0269('0x44')](handleError(_0x2749de,null));};exports[_0x0269('0x46')]=function(_0x452949,_0x15ee1e){return db[_0x0269('0x2c')][_0x0269('0x46')](_0x452949[_0x0269('0x47')],{})[_0x0269('0x27')](respondWithResult(_0x15ee1e,0xc9))[_0x0269('0x44')](handleError(_0x15ee1e,null));};exports[_0x0269('0x26')]=function(_0x4620ab,_0x351dec){if(_0x4620ab['body']['id']){delete _0x4620ab[_0x0269('0x47')]['id'];}return db['SalesforceConfiguration'][_0x0269('0x48')]({'where':{'id':_0x4620ab[_0x0269('0x49')]['id']}})[_0x0269('0x27')](handleEntityNotFound(_0x351dec,null))[_0x0269('0x27')](saveUpdates(_0x4620ab[_0x0269('0x47')],null))[_0x0269('0x27')](respondWithResult(_0x351dec,null))[_0x0269('0x44')](handleError(_0x351dec,null));};exports[_0x0269('0x4a')]=function(_0x5d33a4,_0x108c72){return db[_0x0269('0x2c')][_0x0269('0x48')]({'where':{'id':_0x5d33a4[_0x0269('0x49')]['id']}})[_0x0269('0x27')](handleEntityNotFound(_0x108c72,null))[_0x0269('0x27')](removeEntity(_0x108c72,null))['catch'](handleError(_0x108c72,null));};exports[_0x0269('0x4b')]=function(_0x498620,_0x4f80fa,_0x111bd7){var _0x1f6cdb={};var _0x5aa2c3={};var _0x23ca5f;var _0x1d8f99;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x498620['params']['id']}})[_0x0269('0x27')](handleEntityNotFound(_0x4f80fa,null))[_0x0269('0x27')](function(_0x181b9b){if(_0x181b9b){_0x23ca5f=_0x181b9b;_0x5aa2c3[_0x0269('0x30')]=_[_0x0269('0x32')](db[_0x0269('0x4c')][_0x0269('0x2d')]);_0x5aa2c3['query']=_[_0x0269('0x32')](_0x498620[_0x0269('0x31')]);_0x5aa2c3['filters']=_[_0x0269('0x34')](_0x5aa2c3['model'],_0x5aa2c3['query']);_0x1f6cdb[_0x0269('0x35')]=_[_0x0269('0x34')](_0x5aa2c3['model'],qs['fields'](_0x498620[_0x0269('0x31')][_0x0269('0x36')]));_0x1f6cdb[_0x0269('0x35')]=_0x1f6cdb[_0x0269('0x35')]['length']?_0x1f6cdb[_0x0269('0x35')]:_0x5aa2c3[_0x0269('0x30')];_0x1f6cdb[_0x0269('0x39')]=qs['sort'](_0x498620['query'][_0x0269('0x3a')]);_0x1f6cdb[_0x0269('0x3d')]=qs[_0x0269('0x33')](_[_0x0269('0x3b')](_0x498620['query'],_0x5aa2c3['filters']));if(_0x498620[_0x0269('0x31')][_0x0269('0x3c')]){_0x1f6cdb[_0x0269('0x3d')]=_[_0x0269('0x3e')](_0x1f6cdb[_0x0269('0x3d')],{'$or':_[_0x0269('0x4d')](_0x1f6cdb[_0x0269('0x35')],function(_0x2f9431){var _0x587bb1={};_0x587bb1[_0x2f9431]={'$like':'%'+_0x498620['query'][_0x0269('0x3c')]+'%'};return _0x587bb1;})});}_0x1f6cdb=_[_0x0269('0x3e')]({},_0x1f6cdb,_0x498620['options']);return _0x23ca5f[_0x0269('0x4b')](_0x1f6cdb);}})[_0x0269('0x27')](function(_0x20aa72){if(_0x20aa72){_0x1d8f99=_0x20aa72[_0x0269('0x37')];if(!_0x498620[_0x0269('0x31')][_0x0269('0x38')](_0x0269('0x4e'))){_0x1f6cdb[_0x0269('0x21')]=qs[_0x0269('0x21')](_0x498620[_0x0269('0x31')][_0x0269('0x21')]);_0x1f6cdb[_0x0269('0x1e')]=qs[_0x0269('0x1e')](_0x498620[_0x0269('0x31')][_0x0269('0x1e')]);}return _0x23ca5f['getFields'](_0x1f6cdb);}})[_0x0269('0x27')](function(_0x334eb7){if(_0x334eb7){return _0x334eb7?{'count':_0x1d8f99,'rows':_0x334eb7}:null;}})[_0x0269('0x27')](respondWithResult(_0x4f80fa,null))[_0x0269('0x44')](handleError(_0x4f80fa,null));};exports[_0x0269('0x4f')]=function(_0x4aa3a8,_0x1f52bb,_0x271e6b){var _0x1a71ab={};var _0x1af5d5={};var _0x2767af;var _0x3d80bf;return db[_0x0269('0x2c')][_0x0269('0x50')]({'where':{'id':_0x4aa3a8[_0x0269('0x49')]['id']}})[_0x0269('0x27')](handleEntityNotFound(_0x1f52bb,null))['then'](function(_0x6e8fd4){if(_0x6e8fd4){_0x2767af=_0x6e8fd4;_0x1af5d5[_0x0269('0x30')]=_[_0x0269('0x32')](db[_0x0269('0x4c')][_0x0269('0x2d')]);_0x1af5d5[_0x0269('0x31')]=_[_0x0269('0x32')](_0x4aa3a8['query']);_0x1af5d5[_0x0269('0x33')]=_[_0x0269('0x34')](_0x1af5d5[_0x0269('0x30')],_0x1af5d5[_0x0269('0x31')]);_0x1a71ab[_0x0269('0x35')]=_[_0x0269('0x34')](_0x1af5d5[_0x0269('0x30')],qs['fields'](_0x4aa3a8[_0x0269('0x31')]['fields']));_0x1a71ab[_0x0269('0x35')]=_0x1a71ab[_0x0269('0x35')][_0x0269('0x37')]?_0x1a71ab[_0x0269('0x35')]:_0x1af5d5[_0x0269('0x30')];_0x1a71ab[_0x0269('0x39')]=qs['sort'](_0x4aa3a8[_0x0269('0x31')]['sort']);_0x1a71ab[_0x0269('0x3d')]=qs[_0x0269('0x33')](_[_0x0269('0x3b')](_0x4aa3a8[_0x0269('0x31')],_0x1af5d5[_0x0269('0x33')]));if(_0x4aa3a8['query'][_0x0269('0x3c')]){_0x1a71ab['where']=_[_0x0269('0x3e')](_0x1a71ab[_0x0269('0x3d')],{'$or':_[_0x0269('0x4d')](_0x1a71ab[_0x0269('0x35')],function(_0x433b37){var _0x3cb983={};_0x3cb983[_0x433b37]={'$like':'%'+_0x4aa3a8[_0x0269('0x31')][_0x0269('0x3c')]+'%'};return _0x3cb983;})});}_0x1a71ab=_[_0x0269('0x3e')]({},_0x1a71ab,_0x4aa3a8[_0x0269('0x3f')]);return _0x2767af[_0x0269('0x4f')](_0x1a71ab);}})['then'](function(_0x2c35d4){if(_0x2c35d4){_0x3d80bf=_0x2c35d4[_0x0269('0x37')];if(!_0x4aa3a8[_0x0269('0x31')][_0x0269('0x38')](_0x0269('0x4e'))){_0x1a71ab[_0x0269('0x21')]=qs[_0x0269('0x21')](_0x4aa3a8[_0x0269('0x31')][_0x0269('0x21')]);_0x1a71ab[_0x0269('0x1e')]=qs['offset'](_0x4aa3a8['query'][_0x0269('0x1e')]);}return _0x2767af[_0x0269('0x4f')](_0x1a71ab);}})[_0x0269('0x27')](function(_0x5df597){if(_0x5df597){return _0x5df597?{'count':_0x3d80bf,'rows':_0x5df597}:null;}})[_0x0269('0x27')](respondWithResult(_0x1f52bb,null))[_0x0269('0x44')](handleError(_0x1f52bb,null));};exports[_0x0269('0x51')]=function(_0x1fa038,_0x41bd5f,_0x549b80){var _0xbb19bd={};var _0x4bb2b9={};var _0x34cb34;var _0x3a4ad5;return db[_0x0269('0x2c')]['findOne']({'where':{'id':_0x1fa038[_0x0269('0x49')]['id']}})[_0x0269('0x27')](handleEntityNotFound(_0x41bd5f,null))['then'](function(_0x199405){if(_0x199405){_0x34cb34=_0x199405;_0x4bb2b9['model']=_['keys'](db[_0x0269('0x4c')]['rawAttributes']);_0x4bb2b9[_0x0269('0x31')]=_['keys'](_0x1fa038[_0x0269('0x31')]);_0x4bb2b9['filters']=_[_0x0269('0x34')](_0x4bb2b9[_0x0269('0x30')],_0x4bb2b9['query']);_0xbb19bd[_0x0269('0x35')]=_['intersection'](_0x4bb2b9[_0x0269('0x30')],qs[_0x0269('0x36')](_0x1fa038[_0x0269('0x31')][_0x0269('0x36')]));_0xbb19bd[_0x0269('0x35')]=_0xbb19bd[_0x0269('0x35')][_0x0269('0x37')]?_0xbb19bd[_0x0269('0x35')]:_0x4bb2b9[_0x0269('0x30')];_0xbb19bd['order']=qs[_0x0269('0x3a')](_0x1fa038[_0x0269('0x31')][_0x0269('0x3a')]);_0xbb19bd[_0x0269('0x3d')]=qs[_0x0269('0x33')](_[_0x0269('0x3b')](_0x1fa038[_0x0269('0x31')],_0x4bb2b9[_0x0269('0x33')]));if(_0x1fa038[_0x0269('0x31')][_0x0269('0x3c')]){_0xbb19bd['where']=_['merge'](_0xbb19bd[_0x0269('0x3d')],{'$or':_[_0x0269('0x4d')](_0xbb19bd[_0x0269('0x35')],function(_0x3ddf87){var _0x22ce77={};_0x22ce77[_0x3ddf87]={'$like':'%'+_0x1fa038[_0x0269('0x31')][_0x0269('0x3c')]+'%'};return _0x22ce77;})});}_0xbb19bd=_['merge']({},_0xbb19bd,_0x1fa038[_0x0269('0x3f')]);return _0x34cb34[_0x0269('0x51')](_0xbb19bd);}})[_0x0269('0x27')](function(_0x18c8b5){if(_0x18c8b5){_0x3a4ad5=_0x18c8b5[_0x0269('0x37')];if(!_0x1fa038['query'][_0x0269('0x38')](_0x0269('0x4e'))){_0xbb19bd[_0x0269('0x21')]=qs[_0x0269('0x21')](_0x1fa038['query']['limit']);_0xbb19bd[_0x0269('0x1e')]=qs[_0x0269('0x1e')](_0x1fa038[_0x0269('0x31')]['offset']);}return _0x34cb34[_0x0269('0x51')](_0xbb19bd);}})[_0x0269('0x27')](function(_0xb313e6){if(_0xb313e6){return _0xb313e6?{'count':_0x3a4ad5,'rows':_0xb313e6}:null;}})[_0x0269('0x27')](respondWithResult(_0x41bd5f,null))[_0x0269('0x44')](handleError(_0x41bd5f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index dd3ae9a..cff76be 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 _0x6d39=['exports','define','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes'];(function(_0x471f2f,_0x5d5d3f){var _0x161e92=function(_0x31ec9e){while(--_0x31ec9e){_0x471f2f['push'](_0x471f2f['shift']());}};_0x161e92(++_0x5d5d3f);}(_0x6d39,0x12f));var _0x96d3=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x6d39[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0x96d3('0x0'));var logger=require(_0x96d3('0x1'))(_0x96d3('0x2'));var moment=require(_0x96d3('0x3'));var BPromise=require(_0x96d3('0x4'));var rp=require(_0x96d3('0x5'));var fs=require('fs');var path=require(_0x96d3('0x6'));var rimraf=require(_0x96d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x96d3('0x8'));module[_0x96d3('0x9')]=function(_0x348bb3,_0x11975d){return _0x348bb3[_0x96d3('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x96d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31e1=['rimraf','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','lodash','bluebird','request-promise','path'];(function(_0x115334,_0x531e39){var _0x4b12df=function(_0x3b3984){while(--_0x3b3984){_0x115334['push'](_0x115334['shift']());}};_0x4b12df(++_0x531e39);}(_0x31e1,0x64));var _0x131e=function(_0xfe501,_0x11b488){_0xfe501=_0xfe501-0x0;var _0x72fe1d=_0x31e1[_0xfe501];return _0x72fe1d;};'use strict';var _=require(_0x131e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x131e('0x1'));var rp=require(_0x131e('0x2'));var fs=require('fs');var path=require(_0x131e('0x3'));var rimraf=require(_0x131e('0x4'));var config=require('../../config/environment');var attributes=require(_0x131e('0x5'));module[_0x131e('0x6')]=function(_0x3b8197,_0x38ed71){return _0x3b8197['define']('SalesforceConfiguration',attributes,{'tableName':_0x131e('0x7'),'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 fffced6..8105d2e 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 _0x12ca=['then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2c9ee8,_0x551fd5){var _0x5c0a6a=function(_0x357720){while(--_0x357720){_0x2c9ee8['push'](_0x2c9ee8['shift']());}};_0x5c0a6a(++_0x551fd5);}(_0x12ca,0x9c));var _0xa12c=function(_0x198480,_0x574b93){_0x198480=_0x198480-0x0;var _0x58dff5=_0x12ca[_0x198480];return _0x58dff5;};'use strict';var _=require(_0xa12c('0x0'));var util=require(_0xa12c('0x1'));var moment=require('moment');var BPromise=require(_0xa12c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa12c('0x3'))['db'];var utils=require(_0xa12c('0x4'));var logger=require(_0xa12c('0x5'))(_0xa12c('0x6'));var config=require(_0xa12c('0x7'));var jayson=require(_0xa12c('0x8'));var client=jayson[_0xa12c('0x9')][_0xa12c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfc8278,_0x4f5f2c,_0x5b1932){return new BPromise(function(_0x1ca945,_0x352f47){return client[_0xa12c('0xb')](_0xfc8278,_0x5b1932)[_0xa12c('0xc')](function(_0x3fb1fe){logger[_0xa12c('0xd')](_0xa12c('0xe'),_0x4f5f2c,_0xa12c('0xf'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4f5f2c,_0xa12c('0xf'),JSON['stringify'](_0x3fb1fe));if(_0x3fb1fe[_0xa12c('0x10')]){if(_0x3fb1fe['error'][_0xa12c('0x11')]===0x1f4){logger[_0xa12c('0x10')](_0xa12c('0xe'),_0x4f5f2c,_0x3fb1fe['error'][_0xa12c('0x12')]);return _0x352f47(_0x3fb1fe[_0xa12c('0x10')]['message']);}logger[_0xa12c('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f5f2c,_0x3fb1fe['error']['message']);return _0x1ca945(_0x3fb1fe[_0xa12c('0x10')][_0xa12c('0x12')]);}else{logger[_0xa12c('0xd')](_0xa12c('0xe'),_0x4f5f2c,_0xa12c('0xf'));_0x1ca945(_0x3fb1fe[_0xa12c('0x13')]['message']);}})[_0xa12c('0x14')](function(_0x39d8da){logger[_0xa12c('0x10')](_0xa12c('0xe'),_0x4f5f2c,_0x39d8da);_0x352f47(_0x39d8da);});});} \ No newline at end of file +var _0xd876=['error','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0xd876,0x181));var _0x6d87=function(_0x4db97b,_0x12d4f4){_0x4db97b=_0x4db97b-0x0;var _0x2a715d=_0xd876[_0x4db97b];return _0x2a715d;};'use strict';var _=require(_0x6d87('0x0'));var util=require(_0x6d87('0x1'));var moment=require(_0x6d87('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d87('0x3'));var db=require(_0x6d87('0x4'))['db'];var utils=require(_0x6d87('0x5'));var logger=require(_0x6d87('0x6'))('rpc');var config=require(_0x6d87('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d1b7f,_0x53d15c,_0x101b08){return new BPromise(function(_0x39267a,_0x473b04){return client[_0x6d87('0x9')](_0x1d1b7f,_0x101b08)['then'](function(_0x2e1450){logger[_0x6d87('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x53d15c,_0x6d87('0xb'));logger[_0x6d87('0xc')](_0x6d87('0xd'),_0x53d15c,_0x6d87('0xb'),JSON['stringify'](_0x2e1450));if(_0x2e1450['error']){if(_0x2e1450[_0x6d87('0xe')]['code']===0x1f4){logger[_0x6d87('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x53d15c,_0x2e1450['error'][_0x6d87('0xf')]);return _0x473b04(_0x2e1450['error'][_0x6d87('0xf')]);}logger['error'](_0x6d87('0x10'),_0x53d15c,_0x2e1450[_0x6d87('0xe')]['message']);return _0x39267a(_0x2e1450[_0x6d87('0xe')][_0x6d87('0xf')]);}else{logger[_0x6d87('0xa')](_0x6d87('0x10'),_0x53d15c,_0x6d87('0xb'));_0x39267a(_0x2e1450[_0x6d87('0x11')][_0x6d87('0xf')]);}})[_0x6d87('0x12')](function(_0xffed4a){logger[_0x6d87('0xe')](_0x6d87('0x10'),_0x53d15c,_0xffed4a);_0x473b04(_0xffed4a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c171bb4..c3db12e 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 _0x00ee=['get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x17b98a,_0x49b017){var _0x5c62eb=function(_0xc17454){while(--_0xc17454){_0x17b98a['push'](_0x17b98a['shift']());}};_0x5c62eb(++_0x49b017);}(_0x00ee,0xe2));var _0xe00e=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x00ee[_0x1aba25];return _0x47d997;};'use strict';var multer=require(_0xe00e('0x0'));var util=require(_0xe00e('0x1'));var path=require(_0xe00e('0x2'));var timeout=require(_0xe00e('0x3'));var express=require('express');var router=express[_0xe00e('0x4')]();var fs_extra=require(_0xe00e('0x5'));var auth=require(_0xe00e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe00e('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe00e('0x8')]('/:id',auth[_0xe00e('0x9')](),controller[_0xe00e('0xa')]);router[_0xe00e('0xb')]('/',auth['isAuthenticated'](),controller[_0xe00e('0xc')]);router[_0xe00e('0xd')](_0xe00e('0xe'),auth[_0xe00e('0x9')](),controller['update']);router[_0xe00e('0xf')](_0xe00e('0xe'),auth[_0xe00e('0x9')](),controller[_0xe00e('0x10')]);module[_0xe00e('0x11')]=router; \ No newline at end of file +var _0x05e3=['update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x496854,_0x3565e1){var _0x45e073=function(_0xf1ac80){while(--_0xf1ac80){_0x496854['push'](_0x496854['shift']());}};_0x45e073(++_0x3565e1);}(_0x05e3,0x69));var _0x305e=function(_0x301dce,_0x5c03c4){_0x301dce=_0x301dce-0x0;var _0x494ac3=_0x05e3[_0x301dce];return _0x494ac3;};'use strict';var multer=require('multer');var util=require(_0x305e('0x0'));var path=require(_0x305e('0x1'));var timeout=require('connect-timeout');var express=require(_0x305e('0x2'));var router=express[_0x305e('0x3')]();var fs_extra=require(_0x305e('0x4'));var auth=require(_0x305e('0x5'));var interaction=require(_0x305e('0x6'));var config=require(_0x305e('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x305e('0x8')](),controller[_0x305e('0x9')]);router[_0x305e('0xa')](_0x305e('0xb'),auth['isAuthenticated'](),controller[_0x305e('0xc')]);router[_0x305e('0xd')]('/',auth[_0x305e('0x8')](),controller['create']);router['put'](_0x305e('0xb'),auth['isAuthenticated'](),controller[_0x305e('0xe')]);router['delete'](_0x305e('0xb'),auth[_0x305e('0x8')](),controller[_0x305e('0xf')]);module[_0x305e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 57d3125..10449df 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 _0xea26=['ENUM','string','customVariable','picklist','STRING','variable','sequelize','exports'];(function(_0x555503,_0x36e3e7){var _0x2c258e=function(_0xd3dd11){while(--_0xd3dd11){_0x555503['push'](_0x555503['shift']());}};_0x2c258e(++_0x36e3e7);}(_0xea26,0x16e));var _0x6ea2=function(_0x1c039a,_0x49d513){_0x1c039a=_0x1c039a-0x0;var _0x5249ae=_0xea26[_0x1c039a];return _0x5249ae;};'use strict';var Sequelize=require(_0x6ea2('0x0'));module[_0x6ea2('0x1')]={'type':{'type':Sequelize[_0x6ea2('0x2')](_0x6ea2('0x3'),'variable',_0x6ea2('0x4'),'keyValue',_0x6ea2('0x5')),'defaultValue':_0x6ea2('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6ea2('0x6')]},'keyType':{'type':Sequelize[_0x6ea2('0x2')](_0x6ea2('0x3'),_0x6ea2('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x6ea2('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x6ea2('0x6')]}}; \ No newline at end of file +var _0xed9a=['ENUM','exports','variable','customVariable','picklist','string','STRING'];(function(_0xc123c4,_0x4ee64c){var _0x2b1056=function(_0x9f8619){while(--_0x9f8619){_0xc123c4['push'](_0xc123c4['shift']());}};_0x2b1056(++_0x4ee64c);}(_0xed9a,0x13c));var _0xaed9=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xed9a[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xaed9('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xaed9('0x1'),_0xaed9('0x2'),'keyValue',_0xaed9('0x3')),'defaultValue':_0xaed9('0x4')},'content':{'type':Sequelize[_0xaed9('0x5')]},'key':{'type':Sequelize[_0xaed9('0x5')]},'keyType':{'type':Sequelize[_0xaed9('0x6')](_0xaed9('0x4'),_0xaed9('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0xaed9('0x5')]},'idField':{'type':Sequelize[_0xaed9('0x5')]},'variableName':{'type':Sequelize[_0xaed9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index fdcdfb2..04c948f 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 _0x1540=['params','length','include','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x1b4e76,_0x17942c){var _0x5e64e3=function(_0x3e4799){while(--_0x3e4799){_0x1b4e76['push'](_0x1b4e76['shift']());}};_0x5e64e3(++_0x17942c);}(_0x1540,0x1c4));var _0x0154=function(_0x8438b5,_0x2190ac){_0x8438b5=_0x8438b5-0x0;var _0x1e16d3=_0x1540[_0x8438b5];return _0x1e16d3;};'use strict';var emlformat=require(_0x0154('0x0'));var rimraf=require(_0x0154('0x1'));var zipdir=require(_0x0154('0x2'));var jsonpatch=require(_0x0154('0x3'));var rp=require(_0x0154('0x4'));var moment=require(_0x0154('0x5'));var BPromise=require(_0x0154('0x6'));var Mustache=require(_0x0154('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0154('0x8'));var csv=require(_0x0154('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0154('0xa'));var _=require(_0x0154('0xb'));var squel=require(_0x0154('0xc'));var crypto=require(_0x0154('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0154('0x9'));var querystring=require(_0x0154('0xe'));var Papa=require('papaparse');var Redis=require(_0x0154('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0154('0x10'));var as=require(_0x0154('0x11'));var hardwareService=require(_0x0154('0x12'));var logger=require(_0x0154('0x13'))('api');var utils=require(_0x0154('0x14'));var config=require(_0x0154('0x15'));var licenseUtil=require(_0x0154('0x16'));var db=require(_0x0154('0x17'))['db'];function respondWithStatusCode(_0x449842,_0x84df67){_0x84df67=_0x84df67||0xcc;return function(_0x48ac2d){if(_0x48ac2d){return _0x449842[_0x0154('0x18')](_0x84df67);}return _0x449842['status'](_0x84df67)[_0x0154('0x19')]();};}function respondWithResult(_0x18b21a,_0x4360ce){_0x4360ce=_0x4360ce||0xc8;return function(_0x5df349){if(_0x5df349){return _0x18b21a['status'](_0x4360ce)[_0x0154('0x1a')](_0x5df349);}};}function respondWithFilteredResult(_0x45e7f2,_0x2055be){return function(_0x104628){if(_0x104628){var _0x78072c=typeof _0x2055be[_0x0154('0x1b')]===_0x0154('0x1c')&&typeof _0x2055be[_0x0154('0x1d')]===_0x0154('0x1c');var _0x541dad=_0x104628[_0x0154('0x1e')];var _0x129364=_0x78072c?0x0:_0x2055be[_0x0154('0x1b')];var _0x1e01d2=_0x78072c?_0x104628[_0x0154('0x1e')]:_0x2055be['offset']+_0x2055be[_0x0154('0x1d')];var _0x2e202c;if(_0x1e01d2>=_0x541dad){_0x1e01d2=_0x541dad;_0x2e202c=0xc8;}else{_0x2e202c=0xce;}_0x45e7f2[_0x0154('0x1f')](_0x2e202c);return _0x45e7f2[_0x0154('0x20')](_0x0154('0x21'),_0x129364+'-'+_0x1e01d2+'/'+_0x541dad)[_0x0154('0x1a')](_0x104628);}return null;};}function patchUpdates(_0x48e7da){return function(_0x11d4ef){try{jsonpatch[_0x0154('0x22')](_0x11d4ef,_0x48e7da,!![]);}catch(_0x55453d){return BPromise[_0x0154('0x23')](_0x55453d);}return _0x11d4ef[_0x0154('0x24')]();};}function saveUpdates(_0xf380a0,_0xc9b08a){return function(_0x521f0b){if(_0x521f0b){return _0x521f0b['update'](_0xf380a0)['then'](function(_0x976c07){return _0x976c07;});}return null;};}function removeEntity(_0x221f7a,_0x5a54ba){return function(_0x5a59af){if(_0x5a59af){return _0x5a59af[_0x0154('0x25')]()[_0x0154('0x26')](function(){_0x221f7a['status'](0xcc)[_0x0154('0x19')]();});}};}function handleEntityNotFound(_0x5b186e,_0xcb346f){return function(_0x426243){if(!_0x426243){_0x5b186e[_0x0154('0x18')](0x194);}return _0x426243;};}function handleError(_0x2aad6c,_0x298e79){_0x298e79=_0x298e79||0x1f4;return function(_0x5f07e6){logger[_0x0154('0x27')](_0x5f07e6[_0x0154('0x28')]);if(_0x5f07e6['name']){delete _0x5f07e6[_0x0154('0x29')];}_0x2aad6c['status'](_0x298e79)['send'](_0x5f07e6);};}exports[_0x0154('0x2a')]=function(_0x187917,_0x297fba){var _0x37e7df={},_0x18e508={},_0x44fe97={'count':0x0,'rows':[]};var _0x109885=_[_0x0154('0x2b')](db[_0x0154('0x2c')][_0x0154('0x2d')],function(_0x13a0fc){return{'name':_0x13a0fc[_0x0154('0x2e')],'type':_0x13a0fc[_0x0154('0x2f')]['key']};});_0x18e508['model']=_[_0x0154('0x2b')](_0x109885,_0x0154('0x29'));_0x18e508[_0x0154('0x30')]=_[_0x0154('0x31')](_0x187917['query']);_0x18e508[_0x0154('0x32')]=_['intersection'](_0x18e508[_0x0154('0x33')],_0x18e508[_0x0154('0x30')]);_0x37e7df[_0x0154('0x34')]=_[_0x0154('0x35')](_0x18e508[_0x0154('0x33')],qs[_0x0154('0x36')](_0x187917[_0x0154('0x30')]['fields']));_0x37e7df[_0x0154('0x34')]=_0x37e7df[_0x0154('0x34')]['length']?_0x37e7df['attributes']:_0x18e508[_0x0154('0x33')];if(!_0x187917[_0x0154('0x30')]['hasOwnProperty']('nolimit')){_0x37e7df[_0x0154('0x1d')]=qs[_0x0154('0x1d')](_0x187917['query'][_0x0154('0x1d')]);_0x37e7df['offset']=qs[_0x0154('0x1b')](_0x187917[_0x0154('0x30')][_0x0154('0x1b')]);}_0x37e7df[_0x0154('0x37')]=qs[_0x0154('0x38')](_0x187917['query'][_0x0154('0x38')]);_0x37e7df[_0x0154('0x39')]=qs[_0x0154('0x32')](_[_0x0154('0x3a')](_0x187917[_0x0154('0x30')],_0x18e508['filters']),_0x109885);if(_0x187917['query'][_0x0154('0x3b')]){_0x37e7df[_0x0154('0x39')]=_[_0x0154('0x3c')](_0x37e7df[_0x0154('0x39')],{'$or':_[_0x0154('0x2b')](_0x109885,function(_0x3b2948){if(_0x3b2948[_0x0154('0x2f')]!==_0x0154('0x3d')){var _0xe4ad3e={};_0xe4ad3e[_0x3b2948[_0x0154('0x29')]]={'$like':'%'+_0x187917[_0x0154('0x30')][_0x0154('0x3b')]+'%'};return _0xe4ad3e;}})});}_0x37e7df=_[_0x0154('0x3c')]({},_0x37e7df,_0x187917[_0x0154('0x3e')]);var _0x50c1cb={'where':_0x37e7df[_0x0154('0x39')]};return db[_0x0154('0x2c')][_0x0154('0x1e')](_0x50c1cb)[_0x0154('0x26')](function(_0x14079d){_0x44fe97['count']=_0x14079d;if(_0x187917['query'][_0x0154('0x3f')]){_0x37e7df['include']=[{'all':!![]}];}return db['SalesforceField'][_0x0154('0x40')](_0x37e7df);})['then'](function(_0x154c03){_0x44fe97[_0x0154('0x41')]=_0x154c03;return _0x44fe97;})['then'](respondWithFilteredResult(_0x297fba,_0x37e7df))['catch'](handleError(_0x297fba,null));};exports['show']=function(_0x227e63,_0x28520b){var _0x5ae30a={'raw':!![],'where':{'id':_0x227e63[_0x0154('0x42')]['id']}},_0x5cecc0={};_0x5cecc0[_0x0154('0x33')]=_[_0x0154('0x31')](db[_0x0154('0x2c')][_0x0154('0x2d')]);_0x5cecc0[_0x0154('0x30')]=_['keys'](_0x227e63[_0x0154('0x30')]);_0x5cecc0['filters']=_['intersection'](_0x5cecc0[_0x0154('0x33')],_0x5cecc0[_0x0154('0x30')]);_0x5ae30a[_0x0154('0x34')]=_['intersection'](_0x5cecc0[_0x0154('0x33')],qs[_0x0154('0x36')](_0x227e63[_0x0154('0x30')][_0x0154('0x36')]));_0x5ae30a[_0x0154('0x34')]=_0x5ae30a[_0x0154('0x34')][_0x0154('0x43')]?_0x5ae30a[_0x0154('0x34')]:_0x5cecc0[_0x0154('0x33')];if(_0x227e63[_0x0154('0x30')][_0x0154('0x3f')]){_0x5ae30a[_0x0154('0x44')]=[{'all':!![]}];}_0x5ae30a=_[_0x0154('0x3c')]({},_0x5ae30a,_0x227e63[_0x0154('0x3e')]);return db[_0x0154('0x2c')]['find'](_0x5ae30a)[_0x0154('0x26')](handleEntityNotFound(_0x28520b,null))[_0x0154('0x26')](respondWithResult(_0x28520b,null))[_0x0154('0x45')](handleError(_0x28520b,null));};exports['create']=function(_0x76a71e,_0x5d6765){return db[_0x0154('0x2c')][_0x0154('0x46')](_0x76a71e[_0x0154('0x47')],{})['then'](respondWithResult(_0x5d6765,0xc9))['catch'](handleError(_0x5d6765,null));};exports[_0x0154('0x48')]=function(_0x587e55,_0x17a364){if(_0x587e55[_0x0154('0x47')]['id']){delete _0x587e55[_0x0154('0x47')]['id'];}return db['SalesforceField'][_0x0154('0x49')]({'where':{'id':_0x587e55[_0x0154('0x42')]['id']}})['then'](handleEntityNotFound(_0x17a364,null))[_0x0154('0x26')](saveUpdates(_0x587e55[_0x0154('0x47')],null))[_0x0154('0x26')](respondWithResult(_0x17a364,null))[_0x0154('0x45')](handleError(_0x17a364,null));};exports[_0x0154('0x25')]=function(_0x3bc53c,_0x1532fc){return db[_0x0154('0x2c')][_0x0154('0x49')]({'where':{'id':_0x3bc53c['params']['id']}})[_0x0154('0x26')](handleEntityNotFound(_0x1532fc,null))[_0x0154('0x26')](removeEntity(_0x1532fc,null))[_0x0154('0x45')](handleError(_0x1532fc,null));}; \ No newline at end of file +var _0xccf3=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','map','SalesforceField','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','catch','create','body','find','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x284538,_0x54e438){var _0x5becaf=function(_0x40803e){while(--_0x40803e){_0x284538['push'](_0x284538['shift']());}};_0x5becaf(++_0x54e438);}(_0xccf3,0x110));var _0x3ccf=function(_0x39e47c,_0x5080ed){_0x39e47c=_0x39e47c-0x0;var _0x1bc08b=_0xccf3[_0x39e47c];return _0x1bc08b;};'use strict';var emlformat=require(_0x3ccf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ccf('0x1'));var rp=require(_0x3ccf('0x2'));var moment=require('moment');var BPromise=require(_0x3ccf('0x3'));var Mustache=require(_0x3ccf('0x4'));var util=require(_0x3ccf('0x5'));var path=require(_0x3ccf('0x6'));var sox=require(_0x3ccf('0x7'));var csv=require(_0x3ccf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ccf('0x9'));var _=require(_0x3ccf('0xa'));var squel=require(_0x3ccf('0xb'));var crypto=require(_0x3ccf('0xc'));var jsforce=require(_0x3ccf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3ccf('0x8'));var querystring=require('querystring');var Papa=require(_0x3ccf('0xe'));var Redis=require('ioredis');var authService=require(_0x3ccf('0xf'));var qs=require(_0x3ccf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ccf('0x11'))(_0x3ccf('0x12'));var utils=require(_0x3ccf('0x13'));var config=require(_0x3ccf('0x14'));var licenseUtil=require(_0x3ccf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c0c86,_0x351087){_0x351087=_0x351087||0xcc;return function(_0x5ebc6f){if(_0x5ebc6f){return _0x3c0c86[_0x3ccf('0x16')](_0x351087);}return _0x3c0c86['status'](_0x351087)[_0x3ccf('0x17')]();};}function respondWithResult(_0x1c6d2c,_0x52567f){_0x52567f=_0x52567f||0xc8;return function(_0x4a2ecc){if(_0x4a2ecc){return _0x1c6d2c['status'](_0x52567f)[_0x3ccf('0x18')](_0x4a2ecc);}};}function respondWithFilteredResult(_0x2c5e01,_0xb9faa7){return function(_0x3afdf8){if(_0x3afdf8){var _0x47e094=typeof _0xb9faa7[_0x3ccf('0x19')]===_0x3ccf('0x1a')&&typeof _0xb9faa7[_0x3ccf('0x1b')]===_0x3ccf('0x1a');var _0xc2b9b9=_0x3afdf8[_0x3ccf('0x1c')];var _0x467c8d=_0x47e094?0x0:_0xb9faa7[_0x3ccf('0x19')];var _0xa7ead4=_0x47e094?_0x3afdf8[_0x3ccf('0x1c')]:_0xb9faa7[_0x3ccf('0x19')]+_0xb9faa7[_0x3ccf('0x1b')];var _0x5394d6;if(_0xa7ead4>=_0xc2b9b9){_0xa7ead4=_0xc2b9b9;_0x5394d6=0xc8;}else{_0x5394d6=0xce;}_0x2c5e01['status'](_0x5394d6);return _0x2c5e01[_0x3ccf('0x1d')](_0x3ccf('0x1e'),_0x467c8d+'-'+_0xa7ead4+'/'+_0xc2b9b9)['json'](_0x3afdf8);}return null;};}function patchUpdates(_0x39036a){return function(_0x5906ba){try{jsonpatch[_0x3ccf('0x1f')](_0x5906ba,_0x39036a,!![]);}catch(_0xbcb389){return BPromise[_0x3ccf('0x20')](_0xbcb389);}return _0x5906ba[_0x3ccf('0x21')]();};}function saveUpdates(_0x86fbba,_0x32baa0){return function(_0x8ce503){if(_0x8ce503){return _0x8ce503[_0x3ccf('0x22')](_0x86fbba)[_0x3ccf('0x23')](function(_0x33f7ac){return _0x33f7ac;});}return null;};}function removeEntity(_0x227669,_0x3dae3b){return function(_0x21bc46){if(_0x21bc46){return _0x21bc46[_0x3ccf('0x24')]()[_0x3ccf('0x23')](function(){_0x227669[_0x3ccf('0x25')](0xcc)[_0x3ccf('0x17')]();});}};}function handleEntityNotFound(_0xc20442,_0x3477c1){return function(_0x322291){if(!_0x322291){_0xc20442[_0x3ccf('0x16')](0x194);}return _0x322291;};}function handleError(_0x2e072e,_0x212c4b){_0x212c4b=_0x212c4b||0x1f4;return function(_0x13bfa3){logger[_0x3ccf('0x26')](_0x13bfa3[_0x3ccf('0x27')]);if(_0x13bfa3[_0x3ccf('0x28')]){delete _0x13bfa3[_0x3ccf('0x28')];}_0x2e072e['status'](_0x212c4b)[_0x3ccf('0x29')](_0x13bfa3);};}exports['index']=function(_0x287f16,_0x2f5121){var _0x4508ad={},_0x460c69={},_0x165595={'count':0x0,'rows':[]};var _0x151750=_[_0x3ccf('0x2a')](db[_0x3ccf('0x2b')][_0x3ccf('0x2c')],function(_0x4062eb){return{'name':_0x4062eb['fieldName'],'type':_0x4062eb['type'][_0x3ccf('0x2d')]};});_0x460c69[_0x3ccf('0x2e')]=_[_0x3ccf('0x2a')](_0x151750,_0x3ccf('0x28'));_0x460c69['query']=_['keys'](_0x287f16[_0x3ccf('0x2f')]);_0x460c69[_0x3ccf('0x30')]=_['intersection'](_0x460c69['model'],_0x460c69[_0x3ccf('0x2f')]);_0x4508ad['attributes']=_[_0x3ccf('0x31')](_0x460c69[_0x3ccf('0x2e')],qs[_0x3ccf('0x32')](_0x287f16[_0x3ccf('0x2f')][_0x3ccf('0x32')]));_0x4508ad['attributes']=_0x4508ad[_0x3ccf('0x33')][_0x3ccf('0x34')]?_0x4508ad[_0x3ccf('0x33')]:_0x460c69[_0x3ccf('0x2e')];if(!_0x287f16[_0x3ccf('0x2f')][_0x3ccf('0x35')](_0x3ccf('0x36'))){_0x4508ad[_0x3ccf('0x1b')]=qs[_0x3ccf('0x1b')](_0x287f16[_0x3ccf('0x2f')][_0x3ccf('0x1b')]);_0x4508ad[_0x3ccf('0x19')]=qs[_0x3ccf('0x19')](_0x287f16['query'][_0x3ccf('0x19')]);}_0x4508ad[_0x3ccf('0x37')]=qs[_0x3ccf('0x38')](_0x287f16[_0x3ccf('0x2f')][_0x3ccf('0x38')]);_0x4508ad['where']=qs['filters'](_[_0x3ccf('0x39')](_0x287f16[_0x3ccf('0x2f')],_0x460c69['filters']),_0x151750);if(_0x287f16[_0x3ccf('0x2f')][_0x3ccf('0x3a')]){_0x4508ad[_0x3ccf('0x3b')]=_[_0x3ccf('0x3c')](_0x4508ad[_0x3ccf('0x3b')],{'$or':_[_0x3ccf('0x2a')](_0x151750,function(_0x315add){if(_0x315add[_0x3ccf('0x3d')]!==_0x3ccf('0x3e')){var _0x560886={};_0x560886[_0x315add[_0x3ccf('0x28')]]={'$like':'%'+_0x287f16[_0x3ccf('0x2f')][_0x3ccf('0x3a')]+'%'};return _0x560886;}})});}_0x4508ad=_[_0x3ccf('0x3c')]({},_0x4508ad,_0x287f16[_0x3ccf('0x3f')]);var _0x26c31c={'where':_0x4508ad[_0x3ccf('0x3b')]};return db[_0x3ccf('0x2b')]['count'](_0x26c31c)[_0x3ccf('0x23')](function(_0x545eee){_0x165595['count']=_0x545eee;if(_0x287f16[_0x3ccf('0x2f')][_0x3ccf('0x40')]){_0x4508ad['include']=[{'all':!![]}];}return db['SalesforceField'][_0x3ccf('0x41')](_0x4508ad);})[_0x3ccf('0x23')](function(_0x5cc4f2){_0x165595[_0x3ccf('0x42')]=_0x5cc4f2;return _0x165595;})[_0x3ccf('0x23')](respondWithFilteredResult(_0x2f5121,_0x4508ad))['catch'](handleError(_0x2f5121,null));};exports['show']=function(_0x113d43,_0x321466){var _0xd12628={'raw':!![],'where':{'id':_0x113d43[_0x3ccf('0x43')]['id']}},_0x311d25={};_0x311d25[_0x3ccf('0x2e')]=_[_0x3ccf('0x44')](db[_0x3ccf('0x2b')]['rawAttributes']);_0x311d25[_0x3ccf('0x2f')]=_[_0x3ccf('0x44')](_0x113d43[_0x3ccf('0x2f')]);_0x311d25['filters']=_[_0x3ccf('0x31')](_0x311d25[_0x3ccf('0x2e')],_0x311d25[_0x3ccf('0x2f')]);_0xd12628[_0x3ccf('0x33')]=_[_0x3ccf('0x31')](_0x311d25[_0x3ccf('0x2e')],qs[_0x3ccf('0x32')](_0x113d43[_0x3ccf('0x2f')][_0x3ccf('0x32')]));_0xd12628['attributes']=_0xd12628[_0x3ccf('0x33')][_0x3ccf('0x34')]?_0xd12628[_0x3ccf('0x33')]:_0x311d25[_0x3ccf('0x2e')];if(_0x113d43[_0x3ccf('0x2f')][_0x3ccf('0x40')]){_0xd12628[_0x3ccf('0x45')]=[{'all':!![]}];}_0xd12628=_[_0x3ccf('0x3c')]({},_0xd12628,_0x113d43[_0x3ccf('0x3f')]);return db['SalesforceField']['find'](_0xd12628)[_0x3ccf('0x23')](handleEntityNotFound(_0x321466,null))[_0x3ccf('0x23')](respondWithResult(_0x321466,null))[_0x3ccf('0x46')](handleError(_0x321466,null));};exports['create']=function(_0xb6d6a5,_0x359811){return db['SalesforceField'][_0x3ccf('0x47')](_0xb6d6a5[_0x3ccf('0x48')],{})[_0x3ccf('0x23')](respondWithResult(_0x359811,0xc9))['catch'](handleError(_0x359811,null));};exports[_0x3ccf('0x22')]=function(_0x528967,_0x4c40de){if(_0x528967[_0x3ccf('0x48')]['id']){delete _0x528967[_0x3ccf('0x48')]['id'];}return db[_0x3ccf('0x2b')][_0x3ccf('0x49')]({'where':{'id':_0x528967[_0x3ccf('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c40de,null))['then'](saveUpdates(_0x528967[_0x3ccf('0x48')],null))[_0x3ccf('0x23')](respondWithResult(_0x4c40de,null))[_0x3ccf('0x46')](handleError(_0x4c40de,null));};exports[_0x3ccf('0x24')]=function(_0x313aaf,_0x58a0a8){return db['SalesforceField']['find']({'where':{'id':_0x313aaf[_0x3ccf('0x43')]['id']}})[_0x3ccf('0x23')](handleEntityNotFound(_0x58a0a8,null))[_0x3ccf('0x23')](removeEntity(_0x58a0a8,null))[_0x3ccf('0x46')](handleError(_0x58a0a8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index bd35bc8..db21d16 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 _0x4016=['rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4657fc,_0x1bd9d0){var _0xc29874=function(_0x2810cf){while(--_0x2810cf){_0x4657fc['push'](_0x4657fc['shift']());}};_0xc29874(++_0x1bd9d0);}(_0x4016,0x190));var _0x6401=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4016[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x6401('0x0'));var logger=require(_0x6401('0x1'))(_0x6401('0x2'));var moment=require(_0x6401('0x3'));var BPromise=require('bluebird');var rp=require(_0x6401('0x4'));var fs=require('fs');var path=require(_0x6401('0x5'));var rimraf=require(_0x6401('0x6'));var config=require('../../config/environment');var attributes=require(_0x6401('0x7'));module[_0x6401('0x8')]=function(_0x26faa1,_0x40c455){return _0x26faa1[_0x6401('0x9')](_0x6401('0xa'),attributes,{'tableName':_0x6401('0xb'),'paranoid':![],'indexes':[{'name':_0x6401('0xc'),'fields':['idField',_0x6401('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc65b=['define','SalesforceField','int_salesforce_fields','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xc65b,0x112));var _0xbc65=function(_0x5b374e,_0x244e02){_0x5b374e=_0x5b374e-0x0;var _0x5da9a4=_0xc65b[_0x5b374e];return _0x5da9a4;};'use strict';var _=require(_0xbc65('0x0'));var util=require(_0xbc65('0x1'));var logger=require(_0xbc65('0x2'))('api');var moment=require(_0xbc65('0x3'));var BPromise=require(_0xbc65('0x4'));var rp=require(_0xbc65('0x5'));var fs=require('fs');var path=require(_0xbc65('0x6'));var rimraf=require(_0xbc65('0x7'));var config=require(_0xbc65('0x8'));var attributes=require(_0xbc65('0x9'));module[_0xbc65('0xa')]=function(_0x3cf04b,_0xdf4b74){return _0x3cf04b[_0xbc65('0xb')](_0xbc65('0xc'),attributes,{'tableName':_0xbc65('0xd'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xbc65('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 034680f..562355e 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 _0x7784=['error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7784,0x15e));var _0x4778=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7784[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4778('0x0'));var util=require(_0x4778('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4778('0x2'));var fs=require('fs');var Redis=require(_0x4778('0x3'));var db=require(_0x4778('0x4'))['db'];var utils=require(_0x4778('0x5'));var logger=require(_0x4778('0x6'))(_0x4778('0x7'));var config=require(_0x4778('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4778('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31355c,_0x43c7dc,_0x595350){return new BPromise(function(_0x1b2f62,_0x142938){return client[_0x4778('0xa')](_0x31355c,_0x595350)[_0x4778('0xb')](function(_0x32dd59){logger[_0x4778('0xc')](_0x4778('0xd'),_0x43c7dc,_0x4778('0xe'));logger[_0x4778('0xf')](_0x4778('0x10'),_0x43c7dc,_0x4778('0xe'),JSON[_0x4778('0x11')](_0x32dd59));if(_0x32dd59['error']){if(_0x32dd59[_0x4778('0x12')][_0x4778('0x13')]===0x1f4){logger[_0x4778('0x12')](_0x4778('0xd'),_0x43c7dc,_0x32dd59['error']['message']);return _0x142938(_0x32dd59[_0x4778('0x12')]['message']);}logger[_0x4778('0x12')](_0x4778('0xd'),_0x43c7dc,_0x32dd59['error'][_0x4778('0x14')]);return _0x1b2f62(_0x32dd59['error'][_0x4778('0x14')]);}else{logger[_0x4778('0xc')](_0x4778('0xd'),_0x43c7dc,'request\x20sent');_0x1b2f62(_0x32dd59[_0x4778('0x15')]['message']);}})[_0x4778('0x16')](function(_0x5f4561){logger[_0x4778('0x12')](_0x4778('0xd'),_0x43c7dc,_0x5f4561);_0x142938(_0x5f4561);});});} \ No newline at end of file +var _0x4da3=['client','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x4da3,0xc5));var _0x34da=function(_0x238b26,_0x1b18e9){_0x238b26=_0x238b26-0x0;var _0x48d5a2=_0x4da3[_0x238b26];return _0x48d5a2;};'use strict';var _=require(_0x34da('0x0'));var util=require(_0x34da('0x1'));var moment=require(_0x34da('0x2'));var BPromise=require(_0x34da('0x3'));var rs=require(_0x34da('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34da('0x5'))['db'];var utils=require(_0x34da('0x6'));var logger=require(_0x34da('0x7'))(_0x34da('0x8'));var config=require('../../config/environment');var jayson=require(_0x34da('0x9'));var client=jayson[_0x34da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f549a,_0x33acdc,_0xca88e8){return new BPromise(function(_0x5df777,_0x3c5951){return client[_0x34da('0xb')](_0x2f549a,_0xca88e8)[_0x34da('0xc')](function(_0x44b960){logger[_0x34da('0xd')]('SalesforceField,\x20%s,\x20%s',_0x33acdc,_0x34da('0xe'));logger['debug'](_0x34da('0xf'),_0x33acdc,_0x34da('0xe'),JSON[_0x34da('0x10')](_0x44b960));if(_0x44b960['error']){if(_0x44b960[_0x34da('0x11')][_0x34da('0x12')]===0x1f4){logger[_0x34da('0x11')](_0x34da('0x13'),_0x33acdc,_0x44b960[_0x34da('0x11')][_0x34da('0x14')]);return _0x3c5951(_0x44b960[_0x34da('0x11')][_0x34da('0x14')]);}logger[_0x34da('0x11')](_0x34da('0x13'),_0x33acdc,_0x44b960['error'][_0x34da('0x14')]);return _0x5df777(_0x44b960[_0x34da('0x11')][_0x34da('0x14')]);}else{logger['info'](_0x34da('0x13'),_0x33acdc,_0x34da('0xe'));_0x5df777(_0x44b960[_0x34da('0x15')]['message']);}})[_0x34da('0x16')](function(_0x3b7392){logger[_0x34da('0x11')]('SalesforceField,\x20%s,\x20%s',_0x33acdc,_0x3b7392);_0x3c5951(_0x3b7392);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a2c05c9..08a8398 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 _0xf485=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x155496,_0x313cf7){var _0x5b657d=function(_0x50fc4b){while(--_0x50fc4b){_0x155496['push'](_0x155496['shift']());}};_0x5b657d(++_0x313cf7);}(_0xf485,0x1af));var _0x5f48=function(_0x2e0cfe,_0x4b8709){_0x2e0cfe=_0x2e0cfe-0x0;var _0x4bd6c5=_0xf485[_0x2e0cfe];return _0x4bd6c5;};'use strict';var multer=require(_0x5f48('0x0'));var util=require('util');var path=require(_0x5f48('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f48('0x2'));var router=express[_0x5f48('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5f48('0x4'));var interaction=require(_0x5f48('0x5'));var config=require(_0x5f48('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x5f48('0x7')]('/',auth[_0x5f48('0x8')](),controller[_0x5f48('0x9')]);router[_0x5f48('0x7')](_0x5f48('0xa'),auth[_0x5f48('0x8')](),controller[_0x5f48('0xb')]);router[_0x5f48('0x7')](_0x5f48('0xc'),auth['isAuthenticated'](),controller[_0x5f48('0xd')]);router[_0x5f48('0x7')](_0x5f48('0xe'),auth[_0x5f48('0x8')](),controller[_0x5f48('0xf')]);router[_0x5f48('0x10')]('/',auth[_0x5f48('0x8')](),controller['create']);router[_0x5f48('0x10')](_0x5f48('0xc'),auth['isAuthenticated'](),controller[_0x5f48('0x11')]);router[_0x5f48('0x12')](_0x5f48('0xa'),auth[_0x5f48('0x8')](),controller[_0x5f48('0x13')]);router['delete']('/:id',auth[_0x5f48('0x8')](),controller[_0x5f48('0x14')]);module[_0x5f48('0x15')]=router; \ No newline at end of file +var _0x7e35=['/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7e35,0xc9));var _0x57e3=function(_0x206b5c,_0x1112b3){_0x206b5c=_0x206b5c-0x0;var _0xb7a208=_0x7e35[_0x206b5c];return _0xb7a208;};'use strict';var multer=require(_0x57e3('0x0'));var util=require(_0x57e3('0x1'));var path=require(_0x57e3('0x2'));var timeout=require(_0x57e3('0x3'));var express=require(_0x57e3('0x4'));var router=express[_0x57e3('0x5')]();var fs_extra=require(_0x57e3('0x6'));var auth=require(_0x57e3('0x7'));var interaction=require(_0x57e3('0x8'));var config=require(_0x57e3('0x9'));var controller=require(_0x57e3('0xa'));router[_0x57e3('0xb')]('/',auth['isAuthenticated'](),controller[_0x57e3('0xc')]);router[_0x57e3('0xb')](_0x57e3('0xd'),auth[_0x57e3('0xe')](),controller['show']);router[_0x57e3('0xb')](_0x57e3('0xf'),auth[_0x57e3('0xe')](),controller['getConfigurations']);router[_0x57e3('0xb')](_0x57e3('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x57e3('0x11')]('/',auth[_0x57e3('0xe')](),controller[_0x57e3('0x12')]);router[_0x57e3('0x11')](_0x57e3('0xf'),auth[_0x57e3('0xe')](),controller[_0x57e3('0x13')]);router['put'](_0x57e3('0xd'),auth[_0x57e3('0xe')](),controller[_0x57e3('0x14')]);router[_0x57e3('0x15')](_0x57e3('0xd'),auth[_0x57e3('0xe')](),controller[_0x57e3('0x16')]);module[_0x57e3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8f22b80..5c9469e 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 _0x901a=['remoteUri','sequelize','exports','STRING'];(function(_0x59088b,_0x41f8f1){var _0x27522d=function(_0x1d6ab8){while(--_0x1d6ab8){_0x59088b['push'](_0x59088b['shift']());}};_0x27522d(++_0x41f8f1);}(_0x901a,0xa5));var _0xa901=function(_0x5c0693,_0x1c78c0){_0x5c0693=_0x5c0693-0x0;var _0xd6334b=_0x901a[_0x5c0693];return _0xd6334b;};'use strict';var Sequelize=require(_0xa901('0x0'));module[_0xa901('0x1')]={'name':{'type':Sequelize[_0xa901('0x2')]},'description':{'type':Sequelize[_0xa901('0x2')]},'username':{'type':Sequelize[_0xa901('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa901('0x2')]},'email':{'type':Sequelize[_0xa901('0x2')]},'remoteUri':{'type':Sequelize[_0xa901('0x2')],'unique':_0xa901('0x3')},'serverUrl':{'type':Sequelize[_0xa901('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3fa3=['username','remoteUri','sequelize','exports','STRING'];(function(_0x104315,_0x59075c){var _0x441098=function(_0x59d418){while(--_0x59d418){_0x104315['push'](_0x104315['shift']());}};_0x441098(++_0x59075c);}(_0x3fa3,0xe3));var _0x33fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fa3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x33fa('0x0'));module[_0x33fa('0x1')]={'name':{'type':Sequelize[_0x33fa('0x2')]},'description':{'type':Sequelize[_0x33fa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x33fa('0x3')},'password':{'type':Sequelize[_0x33fa('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x33fa('0x2')],'unique':_0x33fa('0x4')},'serverUrl':{'type':Sequelize[_0x33fa('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e6904e9..247d7e0 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 _0xb7c2=['opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','incident_state','problem_id','company','activity_due','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','category','password','email','remoteUri','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','ServiceNow\x20error:\x20','statusCode','error','test','Wrong\x20credentials','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','ServicenowField','Subjects','getFields','knowledge','close_code','notify','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','sys_updated_by'];(function(_0x586b36,_0x2020f7){var _0x3354ff=function(_0x5bb74e){while(--_0x5bb74e){_0x586b36['push'](_0x586b36['shift']());}};_0x3354ff(++_0x2020f7);}(_0xb7c2,0x10a));var _0x2b7c=function(_0x3c3430,_0x40d55c){_0x3c3430=_0x3c3430-0x0;var _0x1bfb82=_0xb7c2[_0x3c3430];return _0x1bfb82;};'use strict';var emlformat=require(_0x2b7c('0x0'));var rimraf=require(_0x2b7c('0x1'));var zipdir=require(_0x2b7c('0x2'));var jsonpatch=require(_0x2b7c('0x3'));var rp=require(_0x2b7c('0x4'));var moment=require('moment');var BPromise=require(_0x2b7c('0x5'));var Mustache=require('mustache');var util=require(_0x2b7c('0x6'));var path=require(_0x2b7c('0x7'));var sox=require(_0x2b7c('0x8'));var csv=require(_0x2b7c('0x9'));var ejs=require(_0x2b7c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b7c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b7c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2b7c('0x9'));var querystring=require(_0x2b7c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b7c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2b7c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b7c('0x10'))(_0x2b7c('0x11'));var utils=require(_0x2b7c('0x12'));var config=require(_0x2b7c('0x13'));var licenseUtil=require(_0x2b7c('0x14'));var db=require(_0x2b7c('0x15'))['db'];var integrations=require(_0x2b7c('0x16'));function respondWithStatusCode(_0x1b0191,_0x5cddd1){_0x5cddd1=_0x5cddd1||0xcc;return function(_0x551963){if(_0x551963){return _0x1b0191[_0x2b7c('0x17')](_0x5cddd1);}return _0x1b0191['status'](_0x5cddd1)[_0x2b7c('0x18')]();};}function respondWithResult(_0x157344,_0x5e97c9){_0x5e97c9=_0x5e97c9||0xc8;return function(_0x5322bb){if(_0x5322bb){return _0x157344[_0x2b7c('0x19')](_0x5e97c9)[_0x2b7c('0x1a')](_0x5322bb);}};}function respondWithFilteredResult(_0x116e71,_0x34f909){return function(_0x1c0bdb){if(_0x1c0bdb){var _0x4dba1f=typeof _0x34f909['offset']==='undefined'&&typeof _0x34f909['limit']===_0x2b7c('0x1b');var _0x125c7c=_0x1c0bdb[_0x2b7c('0x1c')];var _0x5bc4aa=_0x4dba1f?0x0:_0x34f909['offset'];var _0x19c240=_0x4dba1f?_0x1c0bdb['count']:_0x34f909['offset']+_0x34f909[_0x2b7c('0x1d')];var _0x309f60;if(_0x19c240>=_0x125c7c){_0x19c240=_0x125c7c;_0x309f60=0xc8;}else{_0x309f60=0xce;}_0x116e71['status'](_0x309f60);return _0x116e71[_0x2b7c('0x1e')](_0x2b7c('0x1f'),_0x5bc4aa+'-'+_0x19c240+'/'+_0x125c7c)[_0x2b7c('0x1a')](_0x1c0bdb);}return null;};}function patchUpdates(_0xf1436a){return function(_0x3166b0){try{jsonpatch[_0x2b7c('0x20')](_0x3166b0,_0xf1436a,!![]);}catch(_0x43f9b5){return BPromise[_0x2b7c('0x21')](_0x43f9b5);}return _0x3166b0[_0x2b7c('0x22')]();};}function saveUpdates(_0x384ac3,_0x1537b9){return function(_0x396af9){if(_0x396af9){return _0x396af9[_0x2b7c('0x23')](_0x384ac3)[_0x2b7c('0x24')](function(_0x4437d1){return _0x4437d1;});}return null;};}function removeEntity(_0x18cf63,_0x2f5d2d){return function(_0x396e11){if(_0x396e11){return _0x396e11[_0x2b7c('0x25')]()[_0x2b7c('0x24')](function(){_0x18cf63[_0x2b7c('0x19')](0xcc)[_0x2b7c('0x18')]();});}};}function handleEntityNotFound(_0x11443f,_0x48ca9b){return function(_0x235d50){if(!_0x235d50){_0x11443f[_0x2b7c('0x17')](0x194);}return _0x235d50;};}function handleError(_0x392fc6,_0x3ce214){_0x3ce214=_0x3ce214||0x1f4;return function(_0x47f8ae){logger['error'](_0x47f8ae[_0x2b7c('0x26')]);if(_0x47f8ae[_0x2b7c('0x27')]){delete _0x47f8ae[_0x2b7c('0x27')];}_0x392fc6[_0x2b7c('0x19')](_0x3ce214)[_0x2b7c('0x28')](_0x47f8ae);};}exports[_0x2b7c('0x29')]=function(_0x173840,_0xfb3a3c){var _0x3d8ca={},_0x26a64d={},_0x5647b6={'count':0x0,'rows':[]};var _0x5ac08f=_[_0x2b7c('0x2a')](db[_0x2b7c('0x2b')][_0x2b7c('0x2c')],function(_0x3f7b7f){return{'name':_0x3f7b7f[_0x2b7c('0x2d')],'type':_0x3f7b7f[_0x2b7c('0x2e')][_0x2b7c('0x2f')]};});_0x26a64d[_0x2b7c('0x30')]=_['map'](_0x5ac08f,_0x2b7c('0x27'));_0x26a64d[_0x2b7c('0x31')]=_[_0x2b7c('0x32')](_0x173840[_0x2b7c('0x31')]);_0x26a64d[_0x2b7c('0x33')]=_[_0x2b7c('0x34')](_0x26a64d['model'],_0x26a64d['query']);_0x3d8ca[_0x2b7c('0x35')]=_['intersection'](_0x26a64d['model'],qs['fields'](_0x173840['query'][_0x2b7c('0x36')]));_0x3d8ca[_0x2b7c('0x35')]=_0x3d8ca[_0x2b7c('0x35')][_0x2b7c('0x37')]?_0x3d8ca[_0x2b7c('0x35')]:_0x26a64d[_0x2b7c('0x30')];if(!_0x173840[_0x2b7c('0x31')]['hasOwnProperty'](_0x2b7c('0x38'))){_0x3d8ca[_0x2b7c('0x1d')]=qs[_0x2b7c('0x1d')](_0x173840[_0x2b7c('0x31')][_0x2b7c('0x1d')]);_0x3d8ca['offset']=qs['offset'](_0x173840['query'][_0x2b7c('0x39')]);}_0x3d8ca[_0x2b7c('0x3a')]=qs['sort'](_0x173840['query']['sort']);_0x3d8ca[_0x2b7c('0x3b')]=qs['filters'](_[_0x2b7c('0x3c')](_0x173840['query'],_0x26a64d[_0x2b7c('0x33')]),_0x5ac08f);if(_0x173840['query'][_0x2b7c('0x3d')]){_0x3d8ca[_0x2b7c('0x3b')]=_[_0x2b7c('0x3e')](_0x3d8ca[_0x2b7c('0x3b')],{'$or':_[_0x2b7c('0x2a')](_0x5ac08f,function(_0x89e35){if(_0x89e35[_0x2b7c('0x2e')]!=='VIRTUAL'){var _0x3b818b={};_0x3b818b[_0x89e35[_0x2b7c('0x27')]]={'$like':'%'+_0x173840[_0x2b7c('0x31')][_0x2b7c('0x3d')]+'%'};return _0x3b818b;}})});}_0x3d8ca=_[_0x2b7c('0x3e')]({},_0x3d8ca,_0x173840[_0x2b7c('0x3f')]);var _0x440001={'where':_0x3d8ca[_0x2b7c('0x3b')]};return db[_0x2b7c('0x2b')][_0x2b7c('0x1c')](_0x440001)[_0x2b7c('0x24')](function(_0x3dc22f){_0x5647b6[_0x2b7c('0x1c')]=_0x3dc22f;if(_0x173840[_0x2b7c('0x31')][_0x2b7c('0x40')]){_0x3d8ca[_0x2b7c('0x41')]=[{'all':!![]}];}return db[_0x2b7c('0x2b')]['findAll'](_0x3d8ca);})[_0x2b7c('0x24')](function(_0x303dca){_0x5647b6[_0x2b7c('0x42')]=_0x303dca;return _0x5647b6;})[_0x2b7c('0x24')](respondWithFilteredResult(_0xfb3a3c,_0x3d8ca))['catch'](handleError(_0xfb3a3c,null));};exports[_0x2b7c('0x43')]=function(_0x54f749,_0x4c73ba){var _0x2ab218={'raw':![],'where':{'id':_0x54f749[_0x2b7c('0x44')]['id']}},_0x35590c={};_0x35590c[_0x2b7c('0x30')]=_[_0x2b7c('0x32')](db[_0x2b7c('0x2b')]['rawAttributes']);_0x35590c[_0x2b7c('0x31')]=_[_0x2b7c('0x32')](_0x54f749[_0x2b7c('0x31')]);_0x35590c[_0x2b7c('0x33')]=_[_0x2b7c('0x34')](_0x35590c['model'],_0x35590c['query']);_0x2ab218[_0x2b7c('0x35')]=_[_0x2b7c('0x34')](_0x35590c[_0x2b7c('0x30')],qs[_0x2b7c('0x36')](_0x54f749[_0x2b7c('0x31')][_0x2b7c('0x36')]));_0x2ab218['attributes']=_0x2ab218['attributes']['length']?_0x2ab218[_0x2b7c('0x35')]:_0x35590c[_0x2b7c('0x30')];if(_0x54f749[_0x2b7c('0x31')][_0x2b7c('0x40')]){_0x2ab218[_0x2b7c('0x41')]=[{'all':!![]}];}_0x2ab218=_['merge']({},_0x2ab218,_0x54f749[_0x2b7c('0x3f')]);return db['ServicenowAccount'][_0x2b7c('0x45')](_0x2ab218)[_0x2b7c('0x24')](handleEntityNotFound(_0x4c73ba,null))[_0x2b7c('0x24')](respondWithResult(_0x4c73ba,null))[_0x2b7c('0x46')](handleError(_0x4c73ba,null));};exports[_0x2b7c('0x47')]=function(_0xda6aad,_0x45b9c7){return db[_0x2b7c('0x2b')][_0x2b7c('0x47')](_0xda6aad[_0x2b7c('0x48')],{})[_0x2b7c('0x24')](respondWithResult(_0x45b9c7,0xc9))['catch'](handleError(_0x45b9c7,null));};exports[_0x2b7c('0x23')]=function(_0x209a1f,_0x4e9cf9){if(_0x209a1f[_0x2b7c('0x48')]['id']){delete _0x209a1f[_0x2b7c('0x48')]['id'];}return db[_0x2b7c('0x2b')][_0x2b7c('0x45')]({'where':{'id':_0x209a1f[_0x2b7c('0x44')]['id']}})[_0x2b7c('0x24')](handleEntityNotFound(_0x4e9cf9,null))[_0x2b7c('0x24')](saveUpdates(_0x209a1f[_0x2b7c('0x48')],null))[_0x2b7c('0x24')](respondWithResult(_0x4e9cf9,null))[_0x2b7c('0x46')](handleError(_0x4e9cf9,null));};exports['destroy']=function(_0x4da6b8,_0x143a0b){return db['ServicenowAccount'][_0x2b7c('0x45')]({'where':{'id':_0x4da6b8[_0x2b7c('0x44')]['id']}})[_0x2b7c('0x24')](handleEntityNotFound(_0x143a0b,null))[_0x2b7c('0x24')](removeEntity(_0x143a0b,null))[_0x2b7c('0x46')](handleError(_0x143a0b,null));};exports['getConfigurations']=function(_0x57b52b,_0x50a6af,_0xfc2adc){var _0x31edff={};var _0x23a882={};var _0x4a4da8;var _0x5e9c6b;return db[_0x2b7c('0x2b')][_0x2b7c('0x49')]({'where':{'id':_0x57b52b['params']['id']}})[_0x2b7c('0x24')](handleEntityNotFound(_0x50a6af,null))[_0x2b7c('0x24')](function(_0x43e092){if(_0x43e092){_0x4a4da8=_0x43e092;_0x23a882[_0x2b7c('0x30')]=_[_0x2b7c('0x32')](db[_0x2b7c('0x4a')][_0x2b7c('0x2c')]);_0x23a882['query']=_[_0x2b7c('0x32')](_0x57b52b[_0x2b7c('0x31')]);_0x23a882[_0x2b7c('0x33')]=_[_0x2b7c('0x34')](_0x23a882['model'],_0x23a882[_0x2b7c('0x31')]);_0x31edff[_0x2b7c('0x35')]=_[_0x2b7c('0x34')](_0x23a882[_0x2b7c('0x30')],qs['fields'](_0x57b52b[_0x2b7c('0x31')][_0x2b7c('0x36')]));_0x31edff[_0x2b7c('0x35')]=_0x31edff['attributes'][_0x2b7c('0x37')]?_0x31edff['attributes']:_0x23a882['model'];_0x31edff[_0x2b7c('0x3a')]=qs['sort'](_0x57b52b[_0x2b7c('0x31')]['sort']);_0x31edff[_0x2b7c('0x3b')]=qs[_0x2b7c('0x33')](_[_0x2b7c('0x3c')](_0x57b52b['query'],_0x23a882['filters']));if(_0x57b52b[_0x2b7c('0x31')][_0x2b7c('0x3d')]){_0x31edff[_0x2b7c('0x3b')]=_[_0x2b7c('0x3e')](_0x31edff[_0x2b7c('0x3b')],{'$or':_[_0x2b7c('0x2a')](_0x31edff[_0x2b7c('0x35')],function(_0xd5b567){var _0x479a12={};_0x479a12[_0xd5b567]={'$like':'%'+_0x57b52b[_0x2b7c('0x31')][_0x2b7c('0x3d')]+'%'};return _0x479a12;})});}_0x31edff=_[_0x2b7c('0x3e')]({},_0x31edff,_0x57b52b['options']);return _0x4a4da8[_0x2b7c('0x4b')](_0x31edff);}})['then'](function(_0x337f74){if(_0x337f74){_0x5e9c6b=_0x337f74[_0x2b7c('0x37')];if(!_0x57b52b[_0x2b7c('0x31')]['hasOwnProperty']('nolimit')){_0x31edff[_0x2b7c('0x1d')]=qs['limit'](_0x57b52b['query'][_0x2b7c('0x1d')]);_0x31edff[_0x2b7c('0x39')]=qs[_0x2b7c('0x39')](_0x57b52b[_0x2b7c('0x31')][_0x2b7c('0x39')]);}return _0x4a4da8[_0x2b7c('0x4b')](_0x31edff);}})[_0x2b7c('0x24')](function(_0x429937){if(_0x429937){return _0x429937?{'count':_0x5e9c6b,'rows':_0x429937}:null;}})[_0x2b7c('0x24')](respondWithResult(_0x50a6af,null))['catch'](handleError(_0x50a6af,null));};exports[_0x2b7c('0x4c')]=function(_0x5ab168,_0x4a6151,_0x57a7bf){if(_0x5ab168[_0x2b7c('0x48')]['id']){delete _0x5ab168[_0x2b7c('0x48')]['id'];}return db[_0x2b7c('0x2b')][_0x2b7c('0x49')]({'where':{'id':_0x5ab168[_0x2b7c('0x44')]['id']}})[_0x2b7c('0x24')](handleEntityNotFound(_0x4a6151,null))[_0x2b7c('0x24')](function(_0x7c9f24){if(_0x7c9f24){_0x5ab168['body']['AccountId']=_0x7c9f24['id'];_0x5ab168[_0x2b7c('0x48')]['Subjects']=integrations[_0x2b7c('0x4d')](_0x5ab168[_0x2b7c('0x48')][_0x2b7c('0x4e')],_0x5ab168['body'][_0x2b7c('0x2e')]);_0x5ab168[_0x2b7c('0x48')][_0x2b7c('0x4f')]=integrations['getDescriptions'](_0x5ab168[_0x2b7c('0x48')]['channel'],_0x5ab168['body'][_0x2b7c('0x2e')]);return db['ServicenowConfiguration'][_0x2b7c('0x47')](_0x5ab168[_0x2b7c('0x48')],{'include':[{'model':db[_0x2b7c('0x50')],'as':_0x2b7c('0x51')},{'model':db[_0x2b7c('0x50')],'as':'Descriptions'}]});}return null;})[_0x2b7c('0x24')](respondWithResult(_0x4a6151,null))[_0x2b7c('0x46')](handleError(_0x4a6151,null));};exports[_0x2b7c('0x52')]=function(_0x40978f,_0x43ff43,_0x5c1c9f){var _0x4b27ca=['made_sla','hold_reason',_0x2b7c('0x53'),'subcategory',_0x2b7c('0x54'),_0x2b7c('0x55'),'incident_state',_0x2b7c('0x56'),'category'];var _0x4deec0=[_0x2b7c('0x57'),'made_sla',_0x2b7c('0x58'),_0x2b7c('0x59'),_0x2b7c('0x5a'),_0x2b7c('0x5b'),'child_incidents',_0x2b7c('0x5c'),_0x2b7c('0x5d'),_0x2b7c('0x5e'),'resolved_by',_0x2b7c('0x5f'),_0x2b7c('0x60'),_0x2b7c('0x61'),_0x2b7c('0x62'),_0x2b7c('0x63'),'state',_0x2b7c('0x64'),'knowledge',_0x2b7c('0x3a'),_0x2b7c('0x65'),_0x2b7c('0x66'),_0x2b7c('0x67'),_0x2b7c('0x68'),_0x2b7c('0x69'),_0x2b7c('0x6a'),_0x2b7c('0x6b'),_0x2b7c('0x6c'),'priority',_0x2b7c('0x6d'),_0x2b7c('0x6e'),'time_worked',_0x2b7c('0x6f'),_0x2b7c('0x70'),_0x2b7c('0x71'),'group_list',_0x2b7c('0x72'),_0x2b7c('0x73'),_0x2b7c('0x74'),_0x2b7c('0x75'),_0x2b7c('0x76'),_0x2b7c('0x77'),_0x2b7c('0x78'),_0x2b7c('0x79'),_0x2b7c('0x54'),'correlation_display',_0x2b7c('0x7a'),'work_start',_0x2b7c('0x7b'),_0x2b7c('0x7c'),_0x2b7c('0x7d'),_0x2b7c('0x7e'),_0x2b7c('0x7f'),'notify',_0x2b7c('0x80'),_0x2b7c('0x81'),_0x2b7c('0x82'),'follow_up',_0x2b7c('0x83'),_0x2b7c('0x84'),_0x2b7c('0x85'),_0x2b7c('0x86'),_0x2b7c('0x87'),'urgency',_0x2b7c('0x88'),_0x2b7c('0x89'),'reassignment_count',_0x2b7c('0x8a'),'assigned_to',_0x2b7c('0x56'),_0x2b7c('0x8b'),_0x2b7c('0x8c'),'approval',_0x2b7c('0x8d'),_0x2b7c('0x8e'),_0x2b7c('0x8f'),'reopen_count',_0x2b7c('0x90'),_0x2b7c('0x91'),_0x2b7c('0x92'),_0x2b7c('0x93'),_0x2b7c('0x94'),_0x2b7c('0x95')];var _0x578abc='';var _0x2d395b='';var _0x99dba8=[];var _0x41bf5f='';var _0x56083e='';var _0x773766=[];var _0x2b2adc='';var _0x2ef194='';var _0x1f3553={};var _0x392f88='';return db[_0x2b7c('0x2b')]['findOne']({'where':{'id':_0x40978f[_0x2b7c('0x44')]['id']},'attributes':['id','username',_0x2b7c('0x96'),_0x2b7c('0x97'),_0x2b7c('0x98'),'serverUrl']})[_0x2b7c('0x24')](handleEntityNotFound(_0x43ff43,null))[_0x2b7c('0x24')](function(_0x3c7a05){if(_0x3c7a05){_0x392f88=_0x3c7a05[_0x2b7c('0x98')];var _0x84d013=_0x392f88['slice'](-0x1);if(_0x84d013==='/'){_0x392f88=_0x392f88['substring'](0x0,_0x392f88['lastIndexOf'](_0x84d013));}_0x2ef194=util[_0x2b7c('0x99')](_0x2b7c('0x9a'),_0x392f88);_0x2b2adc=util[_0x2b7c('0x99')]('%s/api/now/table/',_0x392f88);_0x1f3553={'user':_0x3c7a05['username'],'pass':_0x3c7a05['password']};var _0x45c57d={'method':_0x2b7c('0x9b'),'uri':_0x2ef194+_0x2b7c('0x9c'),'auth':_0x1f3553,'json':!![]};return rp(_0x45c57d);}})['then'](function(_0xd83ebb){if(_0xd83ebb[_0x2b7c('0x9d')]['length']>0x0){_0x578abc=_0xd83ebb[_0x2b7c('0x9d')];}console['log'](_0x2b7c('0x9e'),_0x578abc);_0x773766=[];_0x2d395b=Object[_0x2b7c('0x9f')]([],_0x578abc);_[_0x2b7c('0xa0')](_0x2d395b,function(_0x2db755){return!_0x4b27ca[_0x2b7c('0xa1')](_0x2db755['name']);});_0x2d395b['forEach'](function(_0x3cf3b0){var _0x119f42=createFieldObject(_0x2b2adc,_0x1f3553,_0x3cf3b0[_0x2b7c('0xa2')],_0x3cf3b0[_0x2b7c('0x27')],_0x3cf3b0[_0x2b7c('0xa3')],![]);_0x773766[_0x2b7c('0xa4')](_0x119f42);});return Promise['all'](_0x773766);})[_0x2b7c('0x24')](function(_0x246d66){_0x99dba8=_0x246d66;_0x41bf5f=Object[_0x2b7c('0x9f')]([],_0x578abc);console[_0x2b7c('0xa5')](_0x2b7c('0xa6'),_0x578abc);_[_0x2b7c('0xa0')](_0x41bf5f,function(_0x1244b5){return _0x4deec0[_0x2b7c('0xa1')](_0x1244b5[_0x2b7c('0x27')]);});console[_0x2b7c('0xa5')](_0x2b7c('0xa7'),_0x41bf5f);_0x773766=[];_0x41bf5f['forEach'](function(_0x7f2788){var _0x47f1f3=createFieldObject(_0x2b2adc,_0x1f3553,_0x7f2788[_0x2b7c('0xa2')],_0x7f2788[_0x2b7c('0x27')],_0x7f2788[_0x2b7c('0xa3')],!![]);_0x773766[_0x2b7c('0xa4')](_0x47f1f3);});return Promise[_0x2b7c('0xa8')](_0x773766);})[_0x2b7c('0x24')](function(_0x15c83a){_0x56083e=_0x15c83a;var _0x508e98=_0x99dba8['concat'](_0x56083e);return{'count':_0x508e98['length'],'rows':_0x508e98};})[_0x2b7c('0x24')](respondWithResult(_0x43ff43,null))['catch'](function(_0x398f82){console[_0x2b7c('0xa5')](_0x2b7c('0xa9')+_0x398f82);var _0x49839b=_0x40978f['query']['test']?0x1f4:_0x398f82[_0x2b7c('0xaa')]||0x1f4;logger[_0x2b7c('0xab')](_0x398f82[_0x2b7c('0x26')]);delete _0x398f82[_0x2b7c('0x27')];if(_0x49839b===0x191){_0x49839b=0x190;}_0x43ff43['status'](_0x49839b)[_0x2b7c('0x28')](_0x40978f['query'][_0x2b7c('0xac')]?{'message':_0x2b7c('0xad'),'statusCode':_0x398f82['statusCode']}:_0x398f82);});};function createFieldObject(_0x577c93,_0xe25618,_0x54a063,_0x3814e9,_0xa210fa,_0x496b84){return new Promise(function(_0x2a8ef0,_0x59c1d6){var _0x49604b={'id':_0x3814e9,'name':_0xa210fa,'custom':_0x496b84};if(_0x54a063===_0x2b7c('0xae')){_0x49604b['options']=[{'name':'True','value':_0x2b7c('0xaf')},{'name':_0x2b7c('0xb0'),'value':'false'}];_0x2a8ef0(_0x49604b);}else{var _0x4c5840={'method':'GET','uri':_0x577c93+_0x2b7c('0xb1')+_0x3814e9,'auth':_0xe25618,'json':!![]};return rp(_0x4c5840)[_0x2b7c('0x24')](function(_0x56fb64){var _0x4d30c4=[];if(_0x56fb64['result'][_0x2b7c('0x37')]>0x0){_0x56fb64[_0x2b7c('0x9d')]['forEach'](function(_0x47eac6){if(_0x47eac6[_0x2b7c('0xb2')]===_0x2b7c('0xb3')){var _0x17eba8={'name':_0x47eac6[_0x2b7c('0xa3')],'value':_0x47eac6[_0x2b7c('0xb4')]};_0x4d30c4[_0x2b7c('0xa4')](_0x17eba8);}});}_0x49604b[_0x2b7c('0x3f')]=_0x4d30c4;if(_0x49604b['options'][_0x2b7c('0x37')]>0x0){_0x2a8ef0(_0x49604b);}else{if(_0x496b84==![]){_0x2a8ef0();}else{_0x2a8ef0(_0x49604b);}}});}});} \ No newline at end of file +var _0x78fa=['contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','severity','comments','sla_due','approval','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','category','username','password','email','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','forEach','internalType','push','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','stack','send','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','name','index','ServicenowAccount','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','create','catch','body','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','impact','active','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident'];(function(_0x1f80b5,_0x216bc7){var _0x1fb29f=function(_0x375f72){while(--_0x375f72){_0x1f80b5['push'](_0x1f80b5['shift']());}};_0x1fb29f(++_0x216bc7);}(_0x78fa,0x1b0));var _0xa78f=function(_0x248c00,_0x12c72e){_0x248c00=_0x248c00-0x0;var _0x13dffe=_0x78fa[_0x248c00];return _0x13dffe;};'use strict';var emlformat=require(_0xa78f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa78f('0x1'));var jsonpatch=require(_0xa78f('0x2'));var rp=require(_0xa78f('0x3'));var moment=require(_0xa78f('0x4'));var BPromise=require(_0xa78f('0x5'));var Mustache=require(_0xa78f('0x6'));var util=require('util');var path=require(_0xa78f('0x7'));var sox=require(_0xa78f('0x8'));var csv=require(_0xa78f('0x9'));var ejs=require(_0xa78f('0xa'));var fs=require('fs');var fs_extra=require(_0xa78f('0xb'));var _=require(_0xa78f('0xc'));var squel=require('squel');var crypto=require(_0xa78f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa78f('0x9'));var querystring=require('querystring');var Papa=require(_0xa78f('0xe'));var Redis=require('ioredis');var authService=require(_0xa78f('0xf'));var qs=require(_0xa78f('0x10'));var as=require(_0xa78f('0x11'));var hardwareService=require(_0xa78f('0x12'));var logger=require(_0xa78f('0x13'))(_0xa78f('0x14'));var utils=require('../../config/utils');var config=require(_0xa78f('0x15'));var licenseUtil=require(_0xa78f('0x16'));var db=require(_0xa78f('0x17'))['db'];var integrations=require(_0xa78f('0x18'));function respondWithStatusCode(_0xa4f988,_0x951da){_0x951da=_0x951da||0xcc;return function(_0x12e7d5){if(_0x12e7d5){return _0xa4f988[_0xa78f('0x19')](_0x951da);}return _0xa4f988[_0xa78f('0x1a')](_0x951da)[_0xa78f('0x1b')]();};}function respondWithResult(_0x2125fa,_0x49d7c3){_0x49d7c3=_0x49d7c3||0xc8;return function(_0x8df132){if(_0x8df132){return _0x2125fa['status'](_0x49d7c3)[_0xa78f('0x1c')](_0x8df132);}};}function respondWithFilteredResult(_0x159b30,_0x530162){return function(_0x2c9fec){if(_0x2c9fec){var _0x42fa9a=typeof _0x530162[_0xa78f('0x1d')]===_0xa78f('0x1e')&&typeof _0x530162['limit']===_0xa78f('0x1e');var _0x5a6093=_0x2c9fec[_0xa78f('0x1f')];var _0x4330e3=_0x42fa9a?0x0:_0x530162[_0xa78f('0x1d')];var _0x336ecb=_0x42fa9a?_0x2c9fec[_0xa78f('0x1f')]:_0x530162[_0xa78f('0x1d')]+_0x530162[_0xa78f('0x20')];var _0x5e9093;if(_0x336ecb>=_0x5a6093){_0x336ecb=_0x5a6093;_0x5e9093=0xc8;}else{_0x5e9093=0xce;}_0x159b30[_0xa78f('0x1a')](_0x5e9093);return _0x159b30[_0xa78f('0x21')]('Content-Range',_0x4330e3+'-'+_0x336ecb+'/'+_0x5a6093)['json'](_0x2c9fec);}return null;};}function patchUpdates(_0x34beef){return function(_0x4751be){try{jsonpatch[_0xa78f('0x22')](_0x4751be,_0x34beef,!![]);}catch(_0x3a09ab){return BPromise[_0xa78f('0x23')](_0x3a09ab);}return _0x4751be[_0xa78f('0x24')]();};}function saveUpdates(_0x24fcc0,_0x4f5f66){return function(_0x14b4bf){if(_0x14b4bf){return _0x14b4bf[_0xa78f('0x25')](_0x24fcc0)[_0xa78f('0x26')](function(_0x3ca92e){return _0x3ca92e;});}return null;};}function removeEntity(_0x5124d1,_0x2e3348){return function(_0x42c1b5){if(_0x42c1b5){return _0x42c1b5[_0xa78f('0x27')]()[_0xa78f('0x26')](function(){_0x5124d1[_0xa78f('0x1a')](0xcc)[_0xa78f('0x1b')]();});}};}function handleEntityNotFound(_0x332f7d,_0x5ca0f6){return function(_0x11a8c7){if(!_0x11a8c7){_0x332f7d[_0xa78f('0x19')](0x194);}return _0x11a8c7;};}function handleError(_0x235324,_0x10dc79){_0x10dc79=_0x10dc79||0x1f4;return function(_0x172351){logger['error'](_0x172351['stack']);if(_0x172351['name']){delete _0x172351[_0xa78f('0x28')];}_0x235324[_0xa78f('0x1a')](_0x10dc79)['send'](_0x172351);};}exports[_0xa78f('0x29')]=function(_0x2b69c8,_0x3320cf){var _0x5cfe50={},_0x43c27e={},_0x30a4fb={'count':0x0,'rows':[]};var _0x1227d1=_['map'](db[_0xa78f('0x2a')][_0xa78f('0x2b')],function(_0x397b7b){return{'name':_0x397b7b[_0xa78f('0x2c')],'type':_0x397b7b[_0xa78f('0x2d')][_0xa78f('0x2e')]};});_0x43c27e['model']=_[_0xa78f('0x2f')](_0x1227d1,_0xa78f('0x28'));_0x43c27e[_0xa78f('0x30')]=_['keys'](_0x2b69c8['query']);_0x43c27e[_0xa78f('0x31')]=_[_0xa78f('0x32')](_0x43c27e[_0xa78f('0x33')],_0x43c27e[_0xa78f('0x30')]);_0x5cfe50[_0xa78f('0x34')]=_[_0xa78f('0x32')](_0x43c27e[_0xa78f('0x33')],qs[_0xa78f('0x35')](_0x2b69c8[_0xa78f('0x30')]['fields']));_0x5cfe50[_0xa78f('0x34')]=_0x5cfe50[_0xa78f('0x34')]['length']?_0x5cfe50[_0xa78f('0x34')]:_0x43c27e[_0xa78f('0x33')];if(!_0x2b69c8['query']['hasOwnProperty'](_0xa78f('0x36'))){_0x5cfe50[_0xa78f('0x20')]=qs[_0xa78f('0x20')](_0x2b69c8[_0xa78f('0x30')][_0xa78f('0x20')]);_0x5cfe50[_0xa78f('0x1d')]=qs[_0xa78f('0x1d')](_0x2b69c8[_0xa78f('0x30')]['offset']);}_0x5cfe50['order']=qs[_0xa78f('0x37')](_0x2b69c8[_0xa78f('0x30')][_0xa78f('0x37')]);_0x5cfe50[_0xa78f('0x38')]=qs[_0xa78f('0x31')](_[_0xa78f('0x39')](_0x2b69c8[_0xa78f('0x30')],_0x43c27e[_0xa78f('0x31')]),_0x1227d1);if(_0x2b69c8['query'][_0xa78f('0x3a')]){_0x5cfe50[_0xa78f('0x38')]=_[_0xa78f('0x3b')](_0x5cfe50[_0xa78f('0x38')],{'$or':_[_0xa78f('0x2f')](_0x1227d1,function(_0x4fd236){if(_0x4fd236[_0xa78f('0x2d')]!==_0xa78f('0x3c')){var _0xe9e7d4={};_0xe9e7d4[_0x4fd236[_0xa78f('0x28')]]={'$like':'%'+_0x2b69c8[_0xa78f('0x30')][_0xa78f('0x3a')]+'%'};return _0xe9e7d4;}})});}_0x5cfe50=_[_0xa78f('0x3b')]({},_0x5cfe50,_0x2b69c8[_0xa78f('0x3d')]);var _0x214098={'where':_0x5cfe50[_0xa78f('0x38')]};return db['ServicenowAccount'][_0xa78f('0x1f')](_0x214098)[_0xa78f('0x26')](function(_0x5b1870){_0x30a4fb['count']=_0x5b1870;if(_0x2b69c8[_0xa78f('0x30')][_0xa78f('0x3e')]){_0x5cfe50[_0xa78f('0x3f')]=[{'all':!![]}];}return db[_0xa78f('0x2a')]['findAll'](_0x5cfe50);})['then'](function(_0x1e8af9){_0x30a4fb[_0xa78f('0x40')]=_0x1e8af9;return _0x30a4fb;})[_0xa78f('0x26')](respondWithFilteredResult(_0x3320cf,_0x5cfe50))['catch'](handleError(_0x3320cf,null));};exports[_0xa78f('0x41')]=function(_0xf6e382,_0x5c01a1){var _0x4659db={'raw':![],'where':{'id':_0xf6e382[_0xa78f('0x42')]['id']}},_0x22d62d={};_0x22d62d[_0xa78f('0x33')]=_[_0xa78f('0x43')](db[_0xa78f('0x2a')]['rawAttributes']);_0x22d62d[_0xa78f('0x30')]=_[_0xa78f('0x43')](_0xf6e382[_0xa78f('0x30')]);_0x22d62d[_0xa78f('0x31')]=_[_0xa78f('0x32')](_0x22d62d[_0xa78f('0x33')],_0x22d62d[_0xa78f('0x30')]);_0x4659db['attributes']=_['intersection'](_0x22d62d[_0xa78f('0x33')],qs[_0xa78f('0x35')](_0xf6e382[_0xa78f('0x30')][_0xa78f('0x35')]));_0x4659db[_0xa78f('0x34')]=_0x4659db[_0xa78f('0x34')][_0xa78f('0x44')]?_0x4659db[_0xa78f('0x34')]:_0x22d62d[_0xa78f('0x33')];if(_0xf6e382['query']['includeAll']){_0x4659db[_0xa78f('0x3f')]=[{'all':!![]}];}_0x4659db=_[_0xa78f('0x3b')]({},_0x4659db,_0xf6e382[_0xa78f('0x3d')]);return db[_0xa78f('0x2a')][_0xa78f('0x45')](_0x4659db)['then'](handleEntityNotFound(_0x5c01a1,null))[_0xa78f('0x26')](respondWithResult(_0x5c01a1,null))['catch'](handleError(_0x5c01a1,null));};exports[_0xa78f('0x46')]=function(_0x4c4ef4,_0x2bb045){return db[_0xa78f('0x2a')][_0xa78f('0x46')](_0x4c4ef4['body'],{})['then'](respondWithResult(_0x2bb045,0xc9))[_0xa78f('0x47')](handleError(_0x2bb045,null));};exports[_0xa78f('0x25')]=function(_0x301706,_0x2e4982){if(_0x301706[_0xa78f('0x48')]['id']){delete _0x301706['body']['id'];}return db[_0xa78f('0x2a')][_0xa78f('0x45')]({'where':{'id':_0x301706[_0xa78f('0x42')]['id']}})[_0xa78f('0x26')](handleEntityNotFound(_0x2e4982,null))[_0xa78f('0x26')](saveUpdates(_0x301706[_0xa78f('0x48')],null))[_0xa78f('0x26')](respondWithResult(_0x2e4982,null))['catch'](handleError(_0x2e4982,null));};exports[_0xa78f('0x27')]=function(_0x1b7b37,_0x39db38){return db[_0xa78f('0x2a')]['find']({'where':{'id':_0x1b7b37[_0xa78f('0x42')]['id']}})[_0xa78f('0x26')](handleEntityNotFound(_0x39db38,null))[_0xa78f('0x26')](removeEntity(_0x39db38,null))[_0xa78f('0x47')](handleError(_0x39db38,null));};exports[_0xa78f('0x49')]=function(_0x17f70b,_0x4c98e3,_0xaab3f9){var _0x1d2094={};var _0x3844f6={};var _0x34e6d4;var _0x2ea3a8;return db[_0xa78f('0x2a')][_0xa78f('0x4a')]({'where':{'id':_0x17f70b[_0xa78f('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c98e3,null))[_0xa78f('0x26')](function(_0x128a25){if(_0x128a25){_0x34e6d4=_0x128a25;_0x3844f6[_0xa78f('0x33')]=_[_0xa78f('0x43')](db[_0xa78f('0x4b')][_0xa78f('0x2b')]);_0x3844f6[_0xa78f('0x30')]=_[_0xa78f('0x43')](_0x17f70b[_0xa78f('0x30')]);_0x3844f6[_0xa78f('0x31')]=_[_0xa78f('0x32')](_0x3844f6[_0xa78f('0x33')],_0x3844f6[_0xa78f('0x30')]);_0x1d2094[_0xa78f('0x34')]=_['intersection'](_0x3844f6[_0xa78f('0x33')],qs['fields'](_0x17f70b[_0xa78f('0x30')][_0xa78f('0x35')]));_0x1d2094[_0xa78f('0x34')]=_0x1d2094[_0xa78f('0x34')][_0xa78f('0x44')]?_0x1d2094[_0xa78f('0x34')]:_0x3844f6[_0xa78f('0x33')];_0x1d2094[_0xa78f('0x4c')]=qs[_0xa78f('0x37')](_0x17f70b[_0xa78f('0x30')]['sort']);_0x1d2094[_0xa78f('0x38')]=qs['filters'](_[_0xa78f('0x39')](_0x17f70b['query'],_0x3844f6[_0xa78f('0x31')]));if(_0x17f70b[_0xa78f('0x30')][_0xa78f('0x3a')]){_0x1d2094[_0xa78f('0x38')]=_[_0xa78f('0x3b')](_0x1d2094[_0xa78f('0x38')],{'$or':_[_0xa78f('0x2f')](_0x1d2094[_0xa78f('0x34')],function(_0x422c41){var _0x160a7c={};_0x160a7c[_0x422c41]={'$like':'%'+_0x17f70b[_0xa78f('0x30')][_0xa78f('0x3a')]+'%'};return _0x160a7c;})});}_0x1d2094=_[_0xa78f('0x3b')]({},_0x1d2094,_0x17f70b[_0xa78f('0x3d')]);return _0x34e6d4[_0xa78f('0x49')](_0x1d2094);}})['then'](function(_0x56e450){if(_0x56e450){_0x2ea3a8=_0x56e450[_0xa78f('0x44')];if(!_0x17f70b[_0xa78f('0x30')][_0xa78f('0x4d')](_0xa78f('0x36'))){_0x1d2094[_0xa78f('0x20')]=qs[_0xa78f('0x20')](_0x17f70b[_0xa78f('0x30')][_0xa78f('0x20')]);_0x1d2094['offset']=qs[_0xa78f('0x1d')](_0x17f70b['query'][_0xa78f('0x1d')]);}return _0x34e6d4[_0xa78f('0x49')](_0x1d2094);}})[_0xa78f('0x26')](function(_0x5ae005){if(_0x5ae005){return _0x5ae005?{'count':_0x2ea3a8,'rows':_0x5ae005}:null;}})[_0xa78f('0x26')](respondWithResult(_0x4c98e3,null))['catch'](handleError(_0x4c98e3,null));};exports['addConfiguration']=function(_0x51a995,_0x2215e8,_0x3487a7){if(_0x51a995[_0xa78f('0x48')]['id']){delete _0x51a995[_0xa78f('0x48')]['id'];}return db['ServicenowAccount'][_0xa78f('0x4a')]({'where':{'id':_0x51a995['params']['id']}})[_0xa78f('0x26')](handleEntityNotFound(_0x2215e8,null))[_0xa78f('0x26')](function(_0x3a1246){if(_0x3a1246){_0x51a995[_0xa78f('0x48')]['AccountId']=_0x3a1246['id'];_0x51a995[_0xa78f('0x48')]['Subjects']=integrations['getSubjects'](_0x51a995[_0xa78f('0x48')][_0xa78f('0x4e')],_0x51a995[_0xa78f('0x48')]['type']);_0x51a995['body'][_0xa78f('0x4f')]=integrations[_0xa78f('0x50')](_0x51a995[_0xa78f('0x48')][_0xa78f('0x4e')],_0x51a995['body'][_0xa78f('0x2d')]);return db[_0xa78f('0x4b')][_0xa78f('0x46')](_0x51a995[_0xa78f('0x48')],{'include':[{'model':db[_0xa78f('0x51')],'as':_0xa78f('0x52')},{'model':db[_0xa78f('0x51')],'as':_0xa78f('0x4f')}]});}return null;})[_0xa78f('0x26')](respondWithResult(_0x2215e8,null))[_0xa78f('0x47')](handleError(_0x2215e8,null));};exports[_0xa78f('0x53')]=function(_0x547ba8,_0x284087,_0x3354d0){var _0x29aa90=[_0xa78f('0x54'),_0xa78f('0x55'),_0xa78f('0x56'),_0xa78f('0x57'),_0xa78f('0x58'),_0xa78f('0x59'),_0xa78f('0x5a'),'severity','category'];var _0xe3bcb5=[_0xa78f('0x5b'),_0xa78f('0x54'),_0xa78f('0x5c'),_0xa78f('0x5d'),_0xa78f('0x5e'),_0xa78f('0x5f'),'child_incidents',_0xa78f('0x55'),_0xa78f('0x60'),_0xa78f('0x61'),'resolved_by','sys_updated_by',_0xa78f('0x62'),_0xa78f('0x63'),_0xa78f('0x64'),_0xa78f('0x65'),_0xa78f('0x66'),_0xa78f('0x67'),_0xa78f('0x56'),'order',_0xa78f('0x68'),_0xa78f('0x69'),'cmdb_ci','delivery_plan',_0xa78f('0x6a'),_0xa78f('0x6b'),'work_notes_list','business_service','priority',_0xa78f('0x6c'),_0xa78f('0x6d'),_0xa78f('0x6e'),_0xa78f('0x6f'),_0xa78f('0x70'),_0xa78f('0x71'),'group_list',_0xa78f('0x72'),_0xa78f('0x73'),_0xa78f('0x74'),_0xa78f('0x75'),_0xa78f('0x76'),_0xa78f('0x57'),_0xa78f('0x77'),_0xa78f('0x78'),_0xa78f('0x58'),_0xa78f('0x79'),_0xa78f('0x7a'),'work_start','assignment_group',_0xa78f('0x7b'),_0xa78f('0x7c'),_0xa78f('0x7d'),_0xa78f('0x7e'),_0xa78f('0x59'),_0xa78f('0x7f'),_0xa78f('0x80'),_0xa78f('0x81'),_0xa78f('0x82'),_0xa78f('0x83'),'sys_id',_0xa78f('0x84'),_0xa78f('0x85'),_0xa78f('0x5a'),_0xa78f('0x86'),_0xa78f('0x87'),_0xa78f('0x88'),_0xa78f('0x89'),'activity_due',_0xa78f('0x8a'),_0xa78f('0x8b'),_0xa78f('0x8c'),_0xa78f('0x8d'),_0xa78f('0x8e'),'comments_and_work_notes',_0xa78f('0x8f'),_0xa78f('0x90'),'reopen_count',_0xa78f('0x91'),'escalation',_0xa78f('0x92'),_0xa78f('0x93'),_0xa78f('0x94'),_0xa78f('0x95')];var _0x5aec57='';var _0x3e9356='';var _0x4a98e0=[];var _0x10be64='';var _0x27d666='';var _0x3365ee=[];var _0x4f2fa0='';var _0x12ee82='';var _0x584a9a={};var _0x20fa3e='';return db[_0xa78f('0x2a')]['findOne']({'where':{'id':_0x547ba8[_0xa78f('0x42')]['id']},'attributes':['id',_0xa78f('0x96'),_0xa78f('0x97'),_0xa78f('0x98'),'remoteUri',_0xa78f('0x99')]})[_0xa78f('0x26')](handleEntityNotFound(_0x284087,null))[_0xa78f('0x26')](function(_0x10466c){if(_0x10466c){_0x20fa3e=_0x10466c['remoteUri'];var _0x103a6c=_0x20fa3e[_0xa78f('0x9a')](-0x1);if(_0x103a6c==='/'){_0x20fa3e=_0x20fa3e[_0xa78f('0x9b')](0x0,_0x20fa3e['lastIndexOf'](_0x103a6c));}_0x12ee82=util[_0xa78f('0x9c')](_0xa78f('0x9d'),_0x20fa3e);_0x4f2fa0=util['format'](_0xa78f('0x9e'),_0x20fa3e);_0x584a9a={'user':_0x10466c[_0xa78f('0x96')],'pass':_0x10466c['password']};var _0x9120db={'method':_0xa78f('0x9f'),'uri':_0x12ee82+_0xa78f('0xa0'),'auth':_0x584a9a,'json':!![]};return rp(_0x9120db);}})[_0xa78f('0x26')](function(_0x3ee5d7){if(_0x3ee5d7[_0xa78f('0xa1')][_0xa78f('0x44')]>0x0){_0x5aec57=_0x3ee5d7[_0xa78f('0xa1')];}console[_0xa78f('0xa2')](_0xa78f('0xa3'),_0x5aec57);_0x3365ee=[];_0x3e9356=Object['assign']([],_0x5aec57);_[_0xa78f('0xa4')](_0x3e9356,function(_0x34732a){return!_0x29aa90['includes'](_0x34732a[_0xa78f('0x28')]);});_0x3e9356[_0xa78f('0xa5')](function(_0x38e960){var _0x319ba2=createFieldObject(_0x4f2fa0,_0x584a9a,_0x38e960[_0xa78f('0xa6')],_0x38e960[_0xa78f('0x28')],_0x38e960['label'],![]);_0x3365ee[_0xa78f('0xa7')](_0x319ba2);});return Promise['all'](_0x3365ee);})[_0xa78f('0x26')](function(_0xbe5558){_0x4a98e0=_0xbe5558;_0x10be64=Object[_0xa78f('0xa8')]([],_0x5aec57);console[_0xa78f('0xa2')](_0xa78f('0xa9'),_0x5aec57);_['remove'](_0x10be64,function(_0x1466a3){return _0xe3bcb5['includes'](_0x1466a3[_0xa78f('0x28')]);});console['log'](_0xa78f('0xaa'),_0x10be64);_0x3365ee=[];_0x10be64[_0xa78f('0xa5')](function(_0x63047f){var _0x3d1d4d=createFieldObject(_0x4f2fa0,_0x584a9a,_0x63047f[_0xa78f('0xa6')],_0x63047f[_0xa78f('0x28')],_0x63047f[_0xa78f('0xab')],!![]);_0x3365ee[_0xa78f('0xa7')](_0x3d1d4d);});return Promise[_0xa78f('0xac')](_0x3365ee);})[_0xa78f('0x26')](function(_0x1cea92){_0x27d666=_0x1cea92;var _0x53207d=_0x4a98e0[_0xa78f('0xad')](_0x27d666);return{'count':_0x53207d[_0xa78f('0x44')],'rows':_0x53207d};})[_0xa78f('0x26')](respondWithResult(_0x284087,null))[_0xa78f('0x47')](function(_0x23842b){console['log'](_0xa78f('0xae')+_0x23842b);var _0x362f90=_0x547ba8[_0xa78f('0x30')][_0xa78f('0xaf')]?0x1f4:_0x23842b[_0xa78f('0xb0')]||0x1f4;logger[_0xa78f('0xb1')](_0x23842b[_0xa78f('0xb2')]);delete _0x23842b[_0xa78f('0x28')];if(_0x362f90===0x191){_0x362f90=0x190;}_0x284087[_0xa78f('0x1a')](_0x362f90)[_0xa78f('0xb3')](_0x547ba8[_0xa78f('0x30')][_0xa78f('0xaf')]?{'message':_0xa78f('0xb4'),'statusCode':_0x23842b[_0xa78f('0xb0')]}:_0x23842b);});};function createFieldObject(_0x2dc1d2,_0x354795,_0x5694ff,_0x19f2df,_0x216774,_0x217fe3){return new Promise(function(_0x59f34b,_0x446860){var _0x2f4410={'id':_0x19f2df,'name':_0x216774,'custom':_0x217fe3};if(_0x5694ff===_0xa78f('0xb5')){_0x2f4410[_0xa78f('0x3d')]=[{'name':_0xa78f('0xb6'),'value':_0xa78f('0xb7')},{'name':_0xa78f('0xb8'),'value':'false'}];_0x59f34b(_0x2f4410);}else{var _0x391b5e={'method':_0xa78f('0x9f'),'uri':_0x2dc1d2+_0xa78f('0xb9')+_0x19f2df,'auth':_0x354795,'json':!![]};return rp(_0x391b5e)['then'](function(_0x9d85cc){var _0x5018eb=[];if(_0x9d85cc[_0xa78f('0xa1')][_0xa78f('0x44')]>0x0){_0x9d85cc['result'][_0xa78f('0xa5')](function(_0x374b62){if(_0x374b62[_0xa78f('0xba')]===_0xa78f('0xbb')){var _0x290b51={'name':_0x374b62[_0xa78f('0xab')],'value':_0x374b62['value']};_0x5018eb[_0xa78f('0xa7')](_0x290b51);}});}_0x2f4410[_0xa78f('0x3d')]=_0x5018eb;if(_0x2f4410[_0xa78f('0x3d')][_0xa78f('0x44')]>0x0){_0x59f34b(_0x2f4410);}else{if(_0x217fe3==![]){_0x59f34b();}else{_0x59f34b(_0x2f4410);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 26d091c..c24eb4c 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 _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x268f32,_0x1aaa92){var _0x7f063f=function(_0x3c2892){while(--_0x3c2892){_0x268f32['push'](_0x268f32['shift']());}};_0x7f063f(++_0x1aaa92);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2eb2[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x368d3a,_0x40df90){var _0x3b36d5=function(_0x1f748e){while(--_0x1f748e){_0x368d3a['push'](_0x368d3a['shift']());}};_0x3b36d5(++_0x40df90);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x2eb2[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('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 6602d9c..32ec0af 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 _0x4ec5=['model','stringify','ShowServicenowAccount','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','where','options','attributes','include','map'];(function(_0x211aac,_0x5c5ef9){var _0x54d3bb=function(_0x394762){while(--_0x394762){_0x211aac['push'](_0x211aac['shift']());}};_0x54d3bb(++_0x5c5ef9);}(_0x4ec5,0x9f));var _0x54ec=function(_0x57e7f8,_0x328bcd){_0x57e7f8=_0x57e7f8-0x0;var _0x39f93b=_0x4ec5[_0x57e7f8];return _0x39f93b;};'use strict';var _=require(_0x54ec('0x0'));var util=require(_0x54ec('0x1'));var moment=require(_0x54ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x54ec('0x3'));var fs=require('fs');var Redis=require(_0x54ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x54ec('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x54ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54ec('0x7')][_0x54ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eea6c,_0x1359e0,_0x35d299){return new BPromise(function(_0x3b46d5,_0x31e21b){return client['request'](_0x5eea6c,_0x35d299)[_0x54ec('0x9')](function(_0xeb5a70){logger[_0x54ec('0xa')](_0x54ec('0xb'),_0x1359e0,'request\x20sent');logger[_0x54ec('0xc')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1359e0,'request\x20sent',JSON['stringify'](_0xeb5a70));if(_0xeb5a70['error']){if(_0xeb5a70[_0x54ec('0xd')][_0x54ec('0xe')]===0x1f4){logger[_0x54ec('0xd')](_0x54ec('0xb'),_0x1359e0,_0xeb5a70[_0x54ec('0xd')][_0x54ec('0xf')]);return _0x31e21b(_0xeb5a70[_0x54ec('0xd')][_0x54ec('0xf')]);}logger[_0x54ec('0xd')](_0x54ec('0xb'),_0x1359e0,_0xeb5a70[_0x54ec('0xd')][_0x54ec('0xf')]);return _0x3b46d5(_0xeb5a70['error']['message']);}else{logger[_0x54ec('0xa')](_0x54ec('0xb'),_0x1359e0,_0x54ec('0x10'));_0x3b46d5(_0xeb5a70[_0x54ec('0x11')][_0x54ec('0xf')]);}})[_0x54ec('0x12')](function(_0x24fec3){logger[_0x54ec('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1359e0,_0x24fec3);_0x31e21b(_0x24fec3);});});}exports[_0x54ec('0x13')]=function(_0x198727){var _0x5a7dc7=this;return new Promise(function(_0x25cede,_0x19e0d1){return db[_0x54ec('0x14')][_0x54ec('0x15')]({'raw':_0x198727['options']?_0x198727['options']['raw']===undefined?!![]:![]:!![],'where':_0x198727['options']?_0x198727['options'][_0x54ec('0x16')]||null:null,'attributes':_0x198727[_0x54ec('0x17')]?_0x198727[_0x54ec('0x17')][_0x54ec('0x18')]||null:null,'limit':_0x198727[_0x54ec('0x17')]?_0x198727[_0x54ec('0x17')]['limit']||null:null,'include':_0x198727[_0x54ec('0x17')]?_0x198727[_0x54ec('0x17')][_0x54ec('0x19')]?_[_0x54ec('0x1a')](_0x198727[_0x54ec('0x17')][_0x54ec('0x19')],function(_0x195c0c){return{'model':db[_0x195c0c['model']],'as':_0x195c0c['as'],'attributes':_0x195c0c[_0x54ec('0x18')],'include':_0x195c0c['include']?_['map'](_0x195c0c[_0x54ec('0x19')],function(_0x5477da){return{'model':db[_0x5477da['model']],'as':_0x5477da['as'],'attributes':_0x5477da[_0x54ec('0x18')],'include':_0x5477da['include']?_[_0x54ec('0x1a')](_0x5477da['include'],function(_0x80cf77){return{'model':db[_0x80cf77[_0x54ec('0x1b')]],'as':_0x80cf77['as'],'attributes':_0x80cf77['attributes']};}):[]};}):[]};}):[]:[]})[_0x54ec('0x9')](function(_0x50695f){logger[_0x54ec('0xa')](_0x54ec('0x13'),_0x198727);logger[_0x54ec('0xc')]('GetServicenowAccount',_0x198727,JSON[_0x54ec('0x1c')](_0x50695f));_0x25cede(_0x50695f);})[_0x54ec('0x12')](function(_0x4bcef1){logger[_0x54ec('0xd')]('GetServicenowAccount',_0x4bcef1[_0x54ec('0xf')],_0x198727);_0x19e0d1(_0x5a7dc7[_0x54ec('0xd')](0x1f4,_0x4bcef1['message']));});});};exports[_0x54ec('0x1d')]=function(_0x321612){var _0x591ced=this;return new Promise(function(_0x524f54,_0x2cb121){return db[_0x54ec('0x14')]['find']({'raw':_0x321612['options']?_0x321612[_0x54ec('0x17')][_0x54ec('0x1e')]===undefined?!![]:![]:!![],'where':_0x321612[_0x54ec('0x17')]?_0x321612['options'][_0x54ec('0x16')]||null:null,'attributes':_0x321612[_0x54ec('0x17')]?_0x321612[_0x54ec('0x17')][_0x54ec('0x18')]||null:null,'include':_0x321612[_0x54ec('0x17')]?_0x321612['options'][_0x54ec('0x19')]?_[_0x54ec('0x1a')](_0x321612[_0x54ec('0x17')]['include'],function(_0x158c5d){return{'model':db[_0x158c5d['model']],'as':_0x158c5d['as'],'attributes':_0x158c5d[_0x54ec('0x18')],'include':_0x158c5d['include']?_[_0x54ec('0x1a')](_0x158c5d[_0x54ec('0x19')],function(_0x5577e6){return{'model':db[_0x5577e6[_0x54ec('0x1b')]],'as':_0x5577e6['as'],'attributes':_0x5577e6[_0x54ec('0x18')],'include':_0x5577e6[_0x54ec('0x19')]?_[_0x54ec('0x1a')](_0x5577e6[_0x54ec('0x19')],function(_0x5914ba){return{'model':db[_0x5914ba[_0x54ec('0x1b')]],'as':_0x5914ba['as'],'attributes':_0x5914ba[_0x54ec('0x18')]};}):[]};}):[]};}):[]:[]})[_0x54ec('0x9')](function(_0x58e5b8){logger[_0x54ec('0xa')]('ShowServicenowAccount',_0x321612);logger[_0x54ec('0xc')]('ShowServicenowAccount',_0x321612,JSON[_0x54ec('0x1c')](_0x58e5b8));_0x524f54(_0x58e5b8);})['catch'](function(_0x3b3cd3){logger[_0x54ec('0xd')](_0x54ec('0x1d'),_0x3b3cd3[_0x54ec('0xf')],_0x321612);_0x2cb121(_0x591ced[_0x54ec('0xd')](0x1f4,_0x3b3cd3['message']));});});}; \ No newline at end of file +var _0x9010=['../../config/logger','jayson/promise','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount','findAll','options','where','include','model','map','ServicenowAccount','find','raw','attributes','ShowServicenowAccount','debug','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x5247f1,_0x16defa){var _0x18b6fa=function(_0x189b5d){while(--_0x189b5d){_0x5247f1['push'](_0x5247f1['shift']());}};_0x18b6fa(++_0x16defa);}(_0x9010,0x7e));var _0x0901=function(_0x2e013a,_0x46fcb1){_0x2e013a=_0x2e013a-0x0;var _0x4163f8=_0x9010[_0x2e013a];return _0x4163f8;};'use strict';var _=require(_0x0901('0x0'));var util=require(_0x0901('0x1'));var moment=require(_0x0901('0x2'));var BPromise=require(_0x0901('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0901('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0901('0x5'));var logger=require(_0x0901('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0901('0x7'));var client=jayson['client'][_0x0901('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58774d,_0x5af0b1,_0x2a8fc1){return new BPromise(function(_0x21f4ee,_0x2a2861){return client['request'](_0x58774d,_0x2a8fc1)[_0x0901('0x9')](function(_0x5638bb){logger['info'](_0x0901('0xa'),_0x5af0b1,_0x0901('0xb'));logger['debug'](_0x0901('0xc'),_0x5af0b1,'request\x20sent',JSON[_0x0901('0xd')](_0x5638bb));if(_0x5638bb[_0x0901('0xe')]){if(_0x5638bb[_0x0901('0xe')][_0x0901('0xf')]===0x1f4){logger[_0x0901('0xe')](_0x0901('0xa'),_0x5af0b1,_0x5638bb['error'][_0x0901('0x10')]);return _0x2a2861(_0x5638bb[_0x0901('0xe')]['message']);}logger[_0x0901('0xe')](_0x0901('0xa'),_0x5af0b1,_0x5638bb['error'][_0x0901('0x10')]);return _0x21f4ee(_0x5638bb[_0x0901('0xe')][_0x0901('0x10')]);}else{logger[_0x0901('0x11')](_0x0901('0xa'),_0x5af0b1,'request\x20sent');_0x21f4ee(_0x5638bb[_0x0901('0x12')][_0x0901('0x10')]);}})[_0x0901('0x13')](function(_0x194e7d){logger[_0x0901('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5af0b1,_0x194e7d);_0x2a2861(_0x194e7d);});});}exports[_0x0901('0x14')]=function(_0x52c140){var _0x5ca995=this;return new Promise(function(_0x4c7b46,_0x261158){return db['ServicenowAccount'][_0x0901('0x15')]({'raw':_0x52c140[_0x0901('0x16')]?_0x52c140[_0x0901('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x52c140[_0x0901('0x16')]?_0x52c140[_0x0901('0x16')][_0x0901('0x17')]||null:null,'attributes':_0x52c140[_0x0901('0x16')]?_0x52c140[_0x0901('0x16')]['attributes']||null:null,'limit':_0x52c140['options']?_0x52c140[_0x0901('0x16')]['limit']||null:null,'include':_0x52c140[_0x0901('0x16')]?_0x52c140[_0x0901('0x16')]['include']?_['map'](_0x52c140['options'][_0x0901('0x18')],function(_0x1a91f5){return{'model':db[_0x1a91f5[_0x0901('0x19')]],'as':_0x1a91f5['as'],'attributes':_0x1a91f5['attributes'],'include':_0x1a91f5[_0x0901('0x18')]?_[_0x0901('0x1a')](_0x1a91f5[_0x0901('0x18')],function(_0x2e0248){return{'model':db[_0x2e0248['model']],'as':_0x2e0248['as'],'attributes':_0x2e0248['attributes'],'include':_0x2e0248['include']?_[_0x0901('0x1a')](_0x2e0248['include'],function(_0x456b66){return{'model':db[_0x456b66[_0x0901('0x19')]],'as':_0x456b66['as'],'attributes':_0x456b66['attributes']};}):[]};}):[]};}):[]:[]})[_0x0901('0x9')](function(_0x230ede){logger[_0x0901('0x11')](_0x0901('0x14'),_0x52c140);logger['debug'](_0x0901('0x14'),_0x52c140,JSON['stringify'](_0x230ede));_0x4c7b46(_0x230ede);})[_0x0901('0x13')](function(_0x3ba863){logger[_0x0901('0xe')]('GetServicenowAccount',_0x3ba863[_0x0901('0x10')],_0x52c140);_0x261158(_0x5ca995[_0x0901('0xe')](0x1f4,_0x3ba863[_0x0901('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x223b3c){var _0xa3709b=this;return new Promise(function(_0x262099,_0x27c633){return db[_0x0901('0x1b')][_0x0901('0x1c')]({'raw':_0x223b3c[_0x0901('0x16')]?_0x223b3c[_0x0901('0x16')][_0x0901('0x1d')]===undefined?!![]:![]:!![],'where':_0x223b3c[_0x0901('0x16')]?_0x223b3c[_0x0901('0x16')][_0x0901('0x17')]||null:null,'attributes':_0x223b3c[_0x0901('0x16')]?_0x223b3c[_0x0901('0x16')]['attributes']||null:null,'include':_0x223b3c[_0x0901('0x16')]?_0x223b3c[_0x0901('0x16')]['include']?_['map'](_0x223b3c['options']['include'],function(_0x352c3f){return{'model':db[_0x352c3f['model']],'as':_0x352c3f['as'],'attributes':_0x352c3f[_0x0901('0x1e')],'include':_0x352c3f[_0x0901('0x18')]?_[_0x0901('0x1a')](_0x352c3f[_0x0901('0x18')],function(_0x2e713c){return{'model':db[_0x2e713c[_0x0901('0x19')]],'as':_0x2e713c['as'],'attributes':_0x2e713c[_0x0901('0x1e')],'include':_0x2e713c[_0x0901('0x18')]?_[_0x0901('0x1a')](_0x2e713c[_0x0901('0x18')],function(_0x27e7c0){return{'model':db[_0x27e7c0[_0x0901('0x19')]],'as':_0x27e7c0['as'],'attributes':_0x27e7c0[_0x0901('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0901('0x9')](function(_0x267a52){logger[_0x0901('0x11')](_0x0901('0x1f'),_0x223b3c);logger[_0x0901('0x20')]('ShowServicenowAccount',_0x223b3c,JSON['stringify'](_0x267a52));_0x262099(_0x267a52);})['catch'](function(_0x5e5bbc){logger[_0x0901('0xe')]('ShowServicenowAccount',_0x5e5bbc[_0x0901('0x10')],_0x223b3c);_0x27c633(_0xa3709b[_0x0901('0xe')](0x1f4,_0x5e5bbc[_0x0901('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 935e2fa..5b71fa5 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 _0x7909=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x7909,0x140));var _0x9790=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7909[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x9790('0x0'));var util=require('util');var path=require(_0x9790('0x1'));var timeout=require(_0x9790('0x2'));var express=require(_0x9790('0x3'));var router=express[_0x9790('0x4')]();var fs_extra=require(_0x9790('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9790('0x6'));var controller=require(_0x9790('0x7'));router[_0x9790('0x8')]('/',auth[_0x9790('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9790('0xa')]);router[_0x9790('0x8')](_0x9790('0xb'),auth[_0x9790('0x9')](),controller[_0x9790('0xc')]);router[_0x9790('0x8')](_0x9790('0xd'),auth[_0x9790('0x9')](),controller[_0x9790('0xe')]);router[_0x9790('0x8')](_0x9790('0xf'),auth[_0x9790('0x9')](),controller[_0x9790('0x10')]);router['post']('/',auth[_0x9790('0x9')](),controller['create']);router[_0x9790('0x11')](_0x9790('0x12'),auth[_0x9790('0x9')](),controller[_0x9790('0x13')]);router['delete']('/:id',auth[_0x9790('0x9')](),controller[_0x9790('0x14')]);module[_0x9790('0x15')]=router; \ No newline at end of file +var _0xf6cf=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0xf6cf,0xc9));var _0xff6c=function(_0x1a3dfa,_0x17b923){_0x1a3dfa=_0x1a3dfa-0x0;var _0x4148c4=_0xf6cf[_0x1a3dfa];return _0x4148c4;};'use strict';var multer=require(_0xff6c('0x0'));var util=require(_0xff6c('0x1'));var path=require(_0xff6c('0x2'));var timeout=require('connect-timeout');var express=require(_0xff6c('0x3'));var router=express['Router']();var fs_extra=require(_0xff6c('0x4'));var auth=require(_0xff6c('0x5'));var interaction=require(_0xff6c('0x6'));var config=require(_0xff6c('0x7'));var controller=require(_0xff6c('0x8'));router[_0xff6c('0x9')]('/',auth[_0xff6c('0xa')](),controller[_0xff6c('0xb')]);router[_0xff6c('0x9')](_0xff6c('0xc'),auth[_0xff6c('0xa')](),controller['show']);router[_0xff6c('0x9')](_0xff6c('0xd'),auth[_0xff6c('0xa')](),controller[_0xff6c('0xe')]);router[_0xff6c('0x9')](_0xff6c('0xf'),auth[_0xff6c('0xa')](),controller[_0xff6c('0x10')]);router[_0xff6c('0x9')](_0xff6c('0x11'),auth[_0xff6c('0xa')](),controller[_0xff6c('0x12')]);router[_0xff6c('0x13')]('/',auth[_0xff6c('0xa')](),controller[_0xff6c('0x14')]);router['put'](_0xff6c('0xc'),auth[_0xff6c('0xa')](),controller[_0xff6c('0x15')]);router[_0xff6c('0x16')](_0xff6c('0xc'),auth[_0xff6c('0xa')](),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 c261c8d..40227e4 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 _0x648a=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x648a,0x116));var _0xa648=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x648a[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0xa648('0x0'));module[_0xa648('0x1')]={'name':{'type':Sequelize[_0xa648('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x00f6=['STRING','sequelize','exports'];(function(_0x37c853,_0x3755b8){var _0xf2de14=function(_0x2c8e06){while(--_0x2c8e06){_0x37c853['push'](_0x37c853['shift']());}};_0xf2de14(++_0x3755b8);}(_0x00f6,0x16f));var _0x600f=function(_0x5c13af,_0x2c2273){_0x5c13af=_0x5c13af-0x0;var _0x27f93e=_0x00f6[_0x5c13af];return _0x27f93e;};'use strict';var Sequelize=require(_0x600f('0x0'));module[_0x600f('0x1')]={'name':{'type':Sequelize[_0x600f('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 a291685..7f65348 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 _0x1005=['fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','rows','show','params','keys','find','create','catch','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir'];(function(_0x2e4e67,_0x4e9853){var _0x268124=function(_0x291e46){while(--_0x291e46){_0x2e4e67['push'](_0x2e4e67['shift']());}};_0x268124(++_0x4e9853);}(_0x1005,0x189));var _0x5100=function(_0x1d3815,_0x3f9f7a){_0x1d3815=_0x1d3815-0x0;var _0x3fee01=_0x1005[_0x1d3815];return _0x3fee01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5100('0x0'));var zipdir=require(_0x5100('0x1'));var jsonpatch=require(_0x5100('0x2'));var rp=require('request-promise');var moment=require(_0x5100('0x3'));var BPromise=require(_0x5100('0x4'));var Mustache=require('mustache');var util=require(_0x5100('0x5'));var path=require(_0x5100('0x6'));var sox=require(_0x5100('0x7'));var csv=require('to-csv');var ejs=require(_0x5100('0x8'));var fs=require('fs');var fs_extra=require(_0x5100('0x9'));var _=require('lodash');var squel=require(_0x5100('0xa'));var crypto=require(_0x5100('0xb'));var jsforce=require(_0x5100('0xc'));var deskjs=require(_0x5100('0xd'));var toCsv=require(_0x5100('0xe'));var querystring=require(_0x5100('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5100('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5100('0x11'));var hardwareService=require(_0x5100('0x12'));var logger=require(_0x5100('0x13'))(_0x5100('0x14'));var utils=require(_0x5100('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5100('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d0655,_0xdd409f){_0xdd409f=_0xdd409f||0xcc;return function(_0x56af69){if(_0x56af69){return _0x4d0655['sendStatus'](_0xdd409f);}return _0x4d0655['status'](_0xdd409f)[_0x5100('0x17')]();};}function respondWithResult(_0x5bc0cd,_0x5bd68e){_0x5bd68e=_0x5bd68e||0xc8;return function(_0x542da6){if(_0x542da6){return _0x5bc0cd[_0x5100('0x18')](_0x5bd68e)[_0x5100('0x19')](_0x542da6);}};}function respondWithFilteredResult(_0xa7ab0d,_0x1f46f9){return function(_0x5b12fa){if(_0x5b12fa){var _0x19b980=typeof _0x1f46f9[_0x5100('0x1a')]===_0x5100('0x1b')&&typeof _0x1f46f9[_0x5100('0x1c')]===_0x5100('0x1b');var _0x4b9aef=_0x5b12fa[_0x5100('0x1d')];var _0xae12f8=_0x19b980?0x0:_0x1f46f9[_0x5100('0x1a')];var _0x57b836=_0x19b980?_0x5b12fa['count']:_0x1f46f9[_0x5100('0x1a')]+_0x1f46f9[_0x5100('0x1c')];var _0x1dffc1;if(_0x57b836>=_0x4b9aef){_0x57b836=_0x4b9aef;_0x1dffc1=0xc8;}else{_0x1dffc1=0xce;}_0xa7ab0d[_0x5100('0x18')](_0x1dffc1);return _0xa7ab0d[_0x5100('0x1e')](_0x5100('0x1f'),_0xae12f8+'-'+_0x57b836+'/'+_0x4b9aef)['json'](_0x5b12fa);}return null;};}function patchUpdates(_0x183e25){return function(_0x1e427f){try{jsonpatch[_0x5100('0x20')](_0x1e427f,_0x183e25,!![]);}catch(_0x1fb594){return BPromise[_0x5100('0x21')](_0x1fb594);}return _0x1e427f[_0x5100('0x22')]();};}function saveUpdates(_0x55c529,_0x3f11cf){return function(_0x38d294){if(_0x38d294){return _0x38d294[_0x5100('0x23')](_0x55c529)[_0x5100('0x24')](function(_0x5c76d6){return _0x5c76d6;});}return null;};}function removeEntity(_0x183d81,_0x3c962b){return function(_0x805b6a){if(_0x805b6a){return _0x805b6a[_0x5100('0x25')]()['then'](function(){_0x183d81['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x378692,_0x5ed179){return function(_0x344aa1){if(!_0x344aa1){_0x378692[_0x5100('0x26')](0x194);}return _0x344aa1;};}function handleError(_0x28c889,_0x57249a){_0x57249a=_0x57249a||0x1f4;return function(_0x5861ab){logger['error'](_0x5861ab['stack']);if(_0x5861ab[_0x5100('0x27')]){delete _0x5861ab['name'];}_0x28c889[_0x5100('0x18')](_0x57249a)[_0x5100('0x28')](_0x5861ab);};}exports[_0x5100('0x29')]=function(_0x18dda9,_0x20b9cd){var _0x31aab2={},_0x29cbf8={},_0x29a07f={'count':0x0,'rows':[]};var _0x1fad74=_[_0x5100('0x2a')](db[_0x5100('0x2b')][_0x5100('0x2c')],function(_0x15c627){return{'name':_0x15c627[_0x5100('0x2d')],'type':_0x15c627[_0x5100('0x2e')][_0x5100('0x2f')]};});_0x29cbf8[_0x5100('0x30')]=_[_0x5100('0x2a')](_0x1fad74,_0x5100('0x27'));_0x29cbf8['query']=_['keys'](_0x18dda9[_0x5100('0x31')]);_0x29cbf8[_0x5100('0x32')]=_['intersection'](_0x29cbf8['model'],_0x29cbf8[_0x5100('0x31')]);_0x31aab2[_0x5100('0x33')]=_[_0x5100('0x34')](_0x29cbf8[_0x5100('0x30')],qs[_0x5100('0x35')](_0x18dda9[_0x5100('0x31')]['fields']));_0x31aab2['attributes']=_0x31aab2[_0x5100('0x33')][_0x5100('0x36')]?_0x31aab2[_0x5100('0x33')]:_0x29cbf8[_0x5100('0x30')];if(!_0x18dda9[_0x5100('0x31')][_0x5100('0x37')](_0x5100('0x38'))){_0x31aab2[_0x5100('0x1c')]=qs[_0x5100('0x1c')](_0x18dda9[_0x5100('0x31')]['limit']);_0x31aab2[_0x5100('0x1a')]=qs[_0x5100('0x1a')](_0x18dda9[_0x5100('0x31')][_0x5100('0x1a')]);}_0x31aab2[_0x5100('0x39')]=qs['sort'](_0x18dda9['query'][_0x5100('0x3a')]);_0x31aab2['where']=qs['filters'](_[_0x5100('0x3b')](_0x18dda9['query'],_0x29cbf8[_0x5100('0x32')]),_0x1fad74);if(_0x18dda9[_0x5100('0x31')][_0x5100('0x3c')]){_0x31aab2['where']=_[_0x5100('0x3d')](_0x31aab2[_0x5100('0x3e')],{'$or':_[_0x5100('0x2a')](_0x1fad74,function(_0x1a3f1b){if(_0x1a3f1b[_0x5100('0x2e')]!=='VIRTUAL'){var _0x38c106={};_0x38c106[_0x1a3f1b[_0x5100('0x27')]]={'$like':'%'+_0x18dda9[_0x5100('0x31')][_0x5100('0x3c')]+'%'};return _0x38c106;}})});}_0x31aab2=_[_0x5100('0x3d')]({},_0x31aab2,_0x18dda9[_0x5100('0x3f')]);var _0x3a30f5={'where':_0x31aab2[_0x5100('0x3e')]};return db[_0x5100('0x2b')][_0x5100('0x1d')](_0x3a30f5)[_0x5100('0x24')](function(_0x42a6b7){_0x29a07f[_0x5100('0x1d')]=_0x42a6b7;if(_0x18dda9[_0x5100('0x31')][_0x5100('0x40')]){_0x31aab2[_0x5100('0x41')]=[{'all':!![]}];}return db[_0x5100('0x2b')]['findAll'](_0x31aab2);})[_0x5100('0x24')](function(_0x4fdf5c){_0x29a07f[_0x5100('0x42')]=_0x4fdf5c;return _0x29a07f;})[_0x5100('0x24')](respondWithFilteredResult(_0x20b9cd,_0x31aab2))['catch'](handleError(_0x20b9cd,null));};exports[_0x5100('0x43')]=function(_0x5cd723,_0x4de8c4){var _0x288256={'raw':![],'where':{'id':_0x5cd723[_0x5100('0x44')]['id']}},_0x47e2b2={};_0x47e2b2[_0x5100('0x30')]=_[_0x5100('0x45')](db[_0x5100('0x2b')][_0x5100('0x2c')]);_0x47e2b2[_0x5100('0x31')]=_[_0x5100('0x45')](_0x5cd723[_0x5100('0x31')]);_0x47e2b2[_0x5100('0x32')]=_[_0x5100('0x34')](_0x47e2b2[_0x5100('0x30')],_0x47e2b2[_0x5100('0x31')]);_0x288256[_0x5100('0x33')]=_['intersection'](_0x47e2b2[_0x5100('0x30')],qs[_0x5100('0x35')](_0x5cd723[_0x5100('0x31')][_0x5100('0x35')]));_0x288256[_0x5100('0x33')]=_0x288256[_0x5100('0x33')]['length']?_0x288256[_0x5100('0x33')]:_0x47e2b2[_0x5100('0x30')];if(_0x5cd723[_0x5100('0x31')]['includeAll']){_0x288256[_0x5100('0x41')]=[{'all':!![]}];}_0x288256=_[_0x5100('0x3d')]({},_0x288256,_0x5cd723['options']);return db[_0x5100('0x2b')][_0x5100('0x46')](_0x288256)[_0x5100('0x24')](handleEntityNotFound(_0x4de8c4,null))[_0x5100('0x24')](respondWithResult(_0x4de8c4,null))['catch'](handleError(_0x4de8c4,null));};exports[_0x5100('0x47')]=function(_0xad7720,_0x315daf){return db['ServicenowConfiguration'][_0x5100('0x47')](_0xad7720['body'],{})[_0x5100('0x24')](respondWithResult(_0x315daf,0xc9))[_0x5100('0x48')](handleError(_0x315daf,null));};exports[_0x5100('0x23')]=function(_0x3c9157,_0x2e752c){if(_0x3c9157[_0x5100('0x49')]['id']){delete _0x3c9157[_0x5100('0x49')]['id'];}return db[_0x5100('0x2b')][_0x5100('0x46')]({'where':{'id':_0x3c9157[_0x5100('0x44')]['id']}})[_0x5100('0x24')](handleEntityNotFound(_0x2e752c,null))[_0x5100('0x24')](saveUpdates(_0x3c9157[_0x5100('0x49')],null))['then'](respondWithResult(_0x2e752c,null))['catch'](handleError(_0x2e752c,null));};exports[_0x5100('0x25')]=function(_0x128710,_0x3e7351){return db['ServicenowConfiguration'][_0x5100('0x46')]({'where':{'id':_0x128710[_0x5100('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e7351,null))[_0x5100('0x24')](removeEntity(_0x3e7351,null))[_0x5100('0x48')](handleError(_0x3e7351,null));};exports[_0x5100('0x4a')]=function(_0x2e3582,_0x2b1a3a,_0x9e0688){var _0x36331d={};var _0xf1e062={};var _0x5eaa1f;var _0x3693d8;return db['ServicenowConfiguration'][_0x5100('0x4b')]({'where':{'id':_0x2e3582['params']['id']}})['then'](handleEntityNotFound(_0x2b1a3a,null))[_0x5100('0x24')](function(_0x1338af){if(_0x1338af){_0x5eaa1f=_0x1338af;_0xf1e062['model']=_[_0x5100('0x45')](db['ServicenowField'][_0x5100('0x2c')]);_0xf1e062[_0x5100('0x31')]=_['keys'](_0x2e3582['query']);_0xf1e062[_0x5100('0x32')]=_[_0x5100('0x34')](_0xf1e062[_0x5100('0x30')],_0xf1e062[_0x5100('0x31')]);_0x36331d[_0x5100('0x33')]=_['intersection'](_0xf1e062[_0x5100('0x30')],qs[_0x5100('0x35')](_0x2e3582['query'][_0x5100('0x35')]));_0x36331d['attributes']=_0x36331d[_0x5100('0x33')][_0x5100('0x36')]?_0x36331d[_0x5100('0x33')]:_0xf1e062[_0x5100('0x30')];_0x36331d['order']=qs[_0x5100('0x3a')](_0x2e3582[_0x5100('0x31')][_0x5100('0x3a')]);_0x36331d['where']=qs[_0x5100('0x32')](_[_0x5100('0x3b')](_0x2e3582[_0x5100('0x31')],_0xf1e062[_0x5100('0x32')]));if(_0x2e3582['query'][_0x5100('0x3c')]){_0x36331d[_0x5100('0x3e')]=_[_0x5100('0x3d')](_0x36331d[_0x5100('0x3e')],{'$or':_['map'](_0x36331d[_0x5100('0x33')],function(_0x313b36){var _0x31af2d={};_0x31af2d[_0x313b36]={'$like':'%'+_0x2e3582[_0x5100('0x31')][_0x5100('0x3c')]+'%'};return _0x31af2d;})});}_0x36331d=_['merge']({},_0x36331d,_0x2e3582[_0x5100('0x3f')]);return _0x5eaa1f[_0x5100('0x4a')](_0x36331d);}})['then'](function(_0x27b324){if(_0x27b324){_0x3693d8=_0x27b324[_0x5100('0x36')];if(!_0x2e3582[_0x5100('0x31')][_0x5100('0x37')]('nolimit')){_0x36331d['limit']=qs['limit'](_0x2e3582[_0x5100('0x31')][_0x5100('0x1c')]);_0x36331d[_0x5100('0x1a')]=qs[_0x5100('0x1a')](_0x2e3582['query']['offset']);}return _0x5eaa1f['getFields'](_0x36331d);}})['then'](function(_0x2dc437){if(_0x2dc437){return _0x2dc437?{'count':_0x3693d8,'rows':_0x2dc437}:null;}})[_0x5100('0x24')](respondWithResult(_0x2b1a3a,null))[_0x5100('0x48')](handleError(_0x2b1a3a,null));};exports['getSubjects']=function(_0x29468e,_0x5e93e6,_0x5847e6){var _0x3633e1={};var _0x4be6f8={};var _0x439371;var _0x59b8eb;return db[_0x5100('0x2b')][_0x5100('0x4b')]({'where':{'id':_0x29468e[_0x5100('0x44')]['id']}})[_0x5100('0x24')](handleEntityNotFound(_0x5e93e6,null))[_0x5100('0x24')](function(_0x13c19e){if(_0x13c19e){_0x439371=_0x13c19e;_0x4be6f8[_0x5100('0x30')]=_[_0x5100('0x45')](db[_0x5100('0x4c')][_0x5100('0x2c')]);_0x4be6f8[_0x5100('0x31')]=_['keys'](_0x29468e[_0x5100('0x31')]);_0x4be6f8[_0x5100('0x32')]=_[_0x5100('0x34')](_0x4be6f8['model'],_0x4be6f8[_0x5100('0x31')]);_0x3633e1[_0x5100('0x33')]=_[_0x5100('0x34')](_0x4be6f8[_0x5100('0x30')],qs['fields'](_0x29468e['query'][_0x5100('0x35')]));_0x3633e1['attributes']=_0x3633e1[_0x5100('0x33')][_0x5100('0x36')]?_0x3633e1[_0x5100('0x33')]:_0x4be6f8[_0x5100('0x30')];_0x3633e1[_0x5100('0x39')]=qs['sort'](_0x29468e['query'][_0x5100('0x3a')]);_0x3633e1['where']=qs[_0x5100('0x32')](_[_0x5100('0x3b')](_0x29468e['query'],_0x4be6f8[_0x5100('0x32')]));if(_0x29468e[_0x5100('0x31')][_0x5100('0x3c')]){_0x3633e1[_0x5100('0x3e')]=_[_0x5100('0x3d')](_0x3633e1[_0x5100('0x3e')],{'$or':_[_0x5100('0x2a')](_0x3633e1[_0x5100('0x33')],function(_0x590296){var _0x387773={};_0x387773[_0x590296]={'$like':'%'+_0x29468e[_0x5100('0x31')]['filter']+'%'};return _0x387773;})});}_0x3633e1=_[_0x5100('0x3d')]({},_0x3633e1,_0x29468e[_0x5100('0x3f')]);return _0x439371[_0x5100('0x4d')](_0x3633e1);}})[_0x5100('0x24')](function(_0x18fc06){if(_0x18fc06){_0x59b8eb=_0x18fc06['length'];if(!_0x29468e[_0x5100('0x31')][_0x5100('0x37')](_0x5100('0x38'))){_0x3633e1[_0x5100('0x1c')]=qs['limit'](_0x29468e[_0x5100('0x31')][_0x5100('0x1c')]);_0x3633e1[_0x5100('0x1a')]=qs[_0x5100('0x1a')](_0x29468e['query']['offset']);}return _0x439371['getSubjects'](_0x3633e1);}})['then'](function(_0x1adf75){if(_0x1adf75){return _0x1adf75?{'count':_0x59b8eb,'rows':_0x1adf75}:null;}})[_0x5100('0x24')](respondWithResult(_0x5e93e6,null))['catch'](handleError(_0x5e93e6,null));};exports[_0x5100('0x4e')]=function(_0x243d74,_0x1946a2,_0x4a4757){var _0x333c19={};var _0x251923={};var _0x24d2f9;var _0x1cc83b;return db[_0x5100('0x2b')][_0x5100('0x4b')]({'where':{'id':_0x243d74['params']['id']}})[_0x5100('0x24')](handleEntityNotFound(_0x1946a2,null))[_0x5100('0x24')](function(_0x5599fd){if(_0x5599fd){_0x24d2f9=_0x5599fd;_0x251923[_0x5100('0x30')]=_['keys'](db[_0x5100('0x4c')][_0x5100('0x2c')]);_0x251923[_0x5100('0x31')]=_[_0x5100('0x45')](_0x243d74[_0x5100('0x31')]);_0x251923[_0x5100('0x32')]=_['intersection'](_0x251923[_0x5100('0x30')],_0x251923[_0x5100('0x31')]);_0x333c19[_0x5100('0x33')]=_[_0x5100('0x34')](_0x251923[_0x5100('0x30')],qs[_0x5100('0x35')](_0x243d74[_0x5100('0x31')][_0x5100('0x35')]));_0x333c19['attributes']=_0x333c19[_0x5100('0x33')][_0x5100('0x36')]?_0x333c19[_0x5100('0x33')]:_0x251923[_0x5100('0x30')];_0x333c19[_0x5100('0x39')]=qs[_0x5100('0x3a')](_0x243d74[_0x5100('0x31')][_0x5100('0x3a')]);_0x333c19['where']=qs['filters'](_[_0x5100('0x3b')](_0x243d74[_0x5100('0x31')],_0x251923['filters']));if(_0x243d74[_0x5100('0x31')][_0x5100('0x3c')]){_0x333c19['where']=_[_0x5100('0x3d')](_0x333c19[_0x5100('0x3e')],{'$or':_[_0x5100('0x2a')](_0x333c19['attributes'],function(_0x28534d){var _0x4a71ad={};_0x4a71ad[_0x28534d]={'$like':'%'+_0x243d74[_0x5100('0x31')][_0x5100('0x3c')]+'%'};return _0x4a71ad;})});}_0x333c19=_['merge']({},_0x333c19,_0x243d74['options']);return _0x24d2f9[_0x5100('0x4e')](_0x333c19);}})[_0x5100('0x24')](function(_0x389194){if(_0x389194){_0x1cc83b=_0x389194['length'];if(!_0x243d74[_0x5100('0x31')][_0x5100('0x37')](_0x5100('0x38'))){_0x333c19[_0x5100('0x1c')]=qs[_0x5100('0x1c')](_0x243d74[_0x5100('0x31')][_0x5100('0x1c')]);_0x333c19['offset']=qs[_0x5100('0x1a')](_0x243d74[_0x5100('0x31')][_0x5100('0x1a')]);}return _0x24d2f9[_0x5100('0x4e')](_0x333c19);}})[_0x5100('0x24')](function(_0x581b8f){if(_0x581b8f){return _0x581b8f?{'count':_0x1cc83b,'rows':_0x581b8f}:null;}})['then'](respondWithResult(_0x1946a2,null))[_0x5100('0x48')](handleError(_0x1946a2,null));}; \ No newline at end of file +var _0x0b57=['../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','ServicenowConfiguration','catch','show','params','include','find','create','body','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2c32ae,_0xc93333){var _0xbc3d35=function(_0x34ae92){while(--_0x34ae92){_0x2c32ae['push'](_0x2c32ae['shift']());}};_0xbc3d35(++_0xc93333);}(_0x0b57,0x1d0));var _0x70b5=function(_0x3f48e0,_0x453a44){_0x3f48e0=_0x3f48e0-0x0;var _0x2333e1=_0x0b57[_0x3f48e0];return _0x2333e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x70b5('0x0'));var zipdir=require(_0x70b5('0x1'));var jsonpatch=require(_0x70b5('0x2'));var rp=require(_0x70b5('0x3'));var moment=require(_0x70b5('0x4'));var BPromise=require(_0x70b5('0x5'));var Mustache=require(_0x70b5('0x6'));var util=require(_0x70b5('0x7'));var path=require(_0x70b5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x70b5('0x9'));var fs=require('fs');var fs_extra=require(_0x70b5('0xa'));var _=require(_0x70b5('0xb'));var squel=require(_0x70b5('0xc'));var crypto=require(_0x70b5('0xd'));var jsforce=require(_0x70b5('0xe'));var deskjs=require(_0x70b5('0xf'));var toCsv=require(_0x70b5('0x10'));var querystring=require(_0x70b5('0x11'));var Papa=require('papaparse');var Redis=require(_0x70b5('0x12'));var authService=require(_0x70b5('0x13'));var qs=require(_0x70b5('0x14'));var as=require(_0x70b5('0x15'));var hardwareService=require(_0x70b5('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x70b5('0x17'));var licenseUtil=require(_0x70b5('0x18'));var db=require(_0x70b5('0x19'))['db'];function respondWithStatusCode(_0x223038,_0x44ae28){_0x44ae28=_0x44ae28||0xcc;return function(_0x2bb5e1){if(_0x2bb5e1){return _0x223038[_0x70b5('0x1a')](_0x44ae28);}return _0x223038[_0x70b5('0x1b')](_0x44ae28)[_0x70b5('0x1c')]();};}function respondWithResult(_0x43b96c,_0x2c2618){_0x2c2618=_0x2c2618||0xc8;return function(_0x4b6aa0){if(_0x4b6aa0){return _0x43b96c[_0x70b5('0x1b')](_0x2c2618)[_0x70b5('0x1d')](_0x4b6aa0);}};}function respondWithFilteredResult(_0x2c9e7f,_0x25cad8){return function(_0x2ee12f){if(_0x2ee12f){var _0x2d0fab=typeof _0x25cad8[_0x70b5('0x1e')]===_0x70b5('0x1f')&&typeof _0x25cad8[_0x70b5('0x20')]===_0x70b5('0x1f');var _0x4e1344=_0x2ee12f[_0x70b5('0x21')];var _0x66c9ad=_0x2d0fab?0x0:_0x25cad8['offset'];var _0x20acaa=_0x2d0fab?_0x2ee12f['count']:_0x25cad8[_0x70b5('0x1e')]+_0x25cad8[_0x70b5('0x20')];var _0x389576;if(_0x20acaa>=_0x4e1344){_0x20acaa=_0x4e1344;_0x389576=0xc8;}else{_0x389576=0xce;}_0x2c9e7f[_0x70b5('0x1b')](_0x389576);return _0x2c9e7f[_0x70b5('0x22')](_0x70b5('0x23'),_0x66c9ad+'-'+_0x20acaa+'/'+_0x4e1344)[_0x70b5('0x1d')](_0x2ee12f);}return null;};}function patchUpdates(_0x28aed3){return function(_0x4e50f9){try{jsonpatch['apply'](_0x4e50f9,_0x28aed3,!![]);}catch(_0x24694a){return BPromise[_0x70b5('0x24')](_0x24694a);}return _0x4e50f9['save']();};}function saveUpdates(_0x166aa9,_0x1e7556){return function(_0x47e656){if(_0x47e656){return _0x47e656[_0x70b5('0x25')](_0x166aa9)[_0x70b5('0x26')](function(_0x2152e8){return _0x2152e8;});}return null;};}function removeEntity(_0xb74621,_0x448b0f){return function(_0x59d8e2){if(_0x59d8e2){return _0x59d8e2[_0x70b5('0x27')]()[_0x70b5('0x26')](function(){_0xb74621[_0x70b5('0x1b')](0xcc)[_0x70b5('0x1c')]();});}};}function handleEntityNotFound(_0xa0871b,_0x22b76a){return function(_0x2bdd19){if(!_0x2bdd19){_0xa0871b['sendStatus'](0x194);}return _0x2bdd19;};}function handleError(_0x8d6091,_0x3b4aba){_0x3b4aba=_0x3b4aba||0x1f4;return function(_0x5a2481){logger[_0x70b5('0x28')](_0x5a2481[_0x70b5('0x29')]);if(_0x5a2481[_0x70b5('0x2a')]){delete _0x5a2481[_0x70b5('0x2a')];}_0x8d6091[_0x70b5('0x1b')](_0x3b4aba)[_0x70b5('0x2b')](_0x5a2481);};}exports[_0x70b5('0x2c')]=function(_0x16e73e,_0xf7e0a9){var _0x2540ac={},_0x134c84={},_0x574c26={'count':0x0,'rows':[]};var _0x5217a5=_[_0x70b5('0x2d')](db['ServicenowConfiguration'][_0x70b5('0x2e')],function(_0xc48168){return{'name':_0xc48168[_0x70b5('0x2f')],'type':_0xc48168[_0x70b5('0x30')]['key']};});_0x134c84[_0x70b5('0x31')]=_[_0x70b5('0x2d')](_0x5217a5,'name');_0x134c84[_0x70b5('0x32')]=_[_0x70b5('0x33')](_0x16e73e['query']);_0x134c84[_0x70b5('0x34')]=_[_0x70b5('0x35')](_0x134c84[_0x70b5('0x31')],_0x134c84[_0x70b5('0x32')]);_0x2540ac[_0x70b5('0x36')]=_[_0x70b5('0x35')](_0x134c84[_0x70b5('0x31')],qs[_0x70b5('0x37')](_0x16e73e[_0x70b5('0x32')][_0x70b5('0x37')]));_0x2540ac[_0x70b5('0x36')]=_0x2540ac[_0x70b5('0x36')][_0x70b5('0x38')]?_0x2540ac[_0x70b5('0x36')]:_0x134c84[_0x70b5('0x31')];if(!_0x16e73e[_0x70b5('0x32')]['hasOwnProperty'](_0x70b5('0x39'))){_0x2540ac[_0x70b5('0x20')]=qs['limit'](_0x16e73e[_0x70b5('0x32')][_0x70b5('0x20')]);_0x2540ac['offset']=qs[_0x70b5('0x1e')](_0x16e73e[_0x70b5('0x32')]['offset']);}_0x2540ac[_0x70b5('0x3a')]=qs[_0x70b5('0x3b')](_0x16e73e[_0x70b5('0x32')]['sort']);_0x2540ac[_0x70b5('0x3c')]=qs[_0x70b5('0x34')](_[_0x70b5('0x3d')](_0x16e73e[_0x70b5('0x32')],_0x134c84[_0x70b5('0x34')]),_0x5217a5);if(_0x16e73e[_0x70b5('0x32')][_0x70b5('0x3e')]){_0x2540ac[_0x70b5('0x3c')]=_['merge'](_0x2540ac[_0x70b5('0x3c')],{'$or':_[_0x70b5('0x2d')](_0x5217a5,function(_0x3d6a1){if(_0x3d6a1[_0x70b5('0x30')]!==_0x70b5('0x3f')){var _0x40fde1={};_0x40fde1[_0x3d6a1[_0x70b5('0x2a')]]={'$like':'%'+_0x16e73e[_0x70b5('0x32')][_0x70b5('0x3e')]+'%'};return _0x40fde1;}})});}_0x2540ac=_[_0x70b5('0x40')]({},_0x2540ac,_0x16e73e[_0x70b5('0x41')]);var _0x3c13c3={'where':_0x2540ac[_0x70b5('0x3c')]};return db['ServicenowConfiguration']['count'](_0x3c13c3)[_0x70b5('0x26')](function(_0x52bb56){_0x574c26[_0x70b5('0x21')]=_0x52bb56;if(_0x16e73e[_0x70b5('0x32')][_0x70b5('0x42')]){_0x2540ac['include']=[{'all':!![]}];}return db[_0x70b5('0x43')]['findAll'](_0x2540ac);})['then'](function(_0x1050b8){_0x574c26['rows']=_0x1050b8;return _0x574c26;})[_0x70b5('0x26')](respondWithFilteredResult(_0xf7e0a9,_0x2540ac))[_0x70b5('0x44')](handleError(_0xf7e0a9,null));};exports[_0x70b5('0x45')]=function(_0x173ea3,_0x5118fc){var _0x333f36={'raw':![],'where':{'id':_0x173ea3[_0x70b5('0x46')]['id']}},_0x2adc41={};_0x2adc41['model']=_[_0x70b5('0x33')](db['ServicenowConfiguration'][_0x70b5('0x2e')]);_0x2adc41[_0x70b5('0x32')]=_[_0x70b5('0x33')](_0x173ea3[_0x70b5('0x32')]);_0x2adc41['filters']=_[_0x70b5('0x35')](_0x2adc41[_0x70b5('0x31')],_0x2adc41[_0x70b5('0x32')]);_0x333f36['attributes']=_[_0x70b5('0x35')](_0x2adc41[_0x70b5('0x31')],qs[_0x70b5('0x37')](_0x173ea3[_0x70b5('0x32')][_0x70b5('0x37')]));_0x333f36[_0x70b5('0x36')]=_0x333f36[_0x70b5('0x36')][_0x70b5('0x38')]?_0x333f36['attributes']:_0x2adc41[_0x70b5('0x31')];if(_0x173ea3[_0x70b5('0x32')]['includeAll']){_0x333f36[_0x70b5('0x47')]=[{'all':!![]}];}_0x333f36=_[_0x70b5('0x40')]({},_0x333f36,_0x173ea3['options']);return db[_0x70b5('0x43')][_0x70b5('0x48')](_0x333f36)['then'](handleEntityNotFound(_0x5118fc,null))[_0x70b5('0x26')](respondWithResult(_0x5118fc,null))[_0x70b5('0x44')](handleError(_0x5118fc,null));};exports[_0x70b5('0x49')]=function(_0xc08715,_0x554abc){return db[_0x70b5('0x43')][_0x70b5('0x49')](_0xc08715[_0x70b5('0x4a')],{})['then'](respondWithResult(_0x554abc,0xc9))['catch'](handleError(_0x554abc,null));};exports[_0x70b5('0x25')]=function(_0x998676,_0x51ab9c){if(_0x998676['body']['id']){delete _0x998676[_0x70b5('0x4a')]['id'];}return db['ServicenowConfiguration'][_0x70b5('0x48')]({'where':{'id':_0x998676['params']['id']}})['then'](handleEntityNotFound(_0x51ab9c,null))[_0x70b5('0x26')](saveUpdates(_0x998676[_0x70b5('0x4a')],null))['then'](respondWithResult(_0x51ab9c,null))['catch'](handleError(_0x51ab9c,null));};exports['destroy']=function(_0x11d838,_0x36bac1){return db[_0x70b5('0x43')][_0x70b5('0x48')]({'where':{'id':_0x11d838[_0x70b5('0x46')]['id']}})[_0x70b5('0x26')](handleEntityNotFound(_0x36bac1,null))[_0x70b5('0x26')](removeEntity(_0x36bac1,null))[_0x70b5('0x44')](handleError(_0x36bac1,null));};exports[_0x70b5('0x4b')]=function(_0x3fa4d1,_0x4528fc,_0x2da6b0){var _0x366267={};var _0x2cdbdb={};var _0xaa7c;var _0x379e56;return db['ServicenowConfiguration'][_0x70b5('0x4c')]({'where':{'id':_0x3fa4d1[_0x70b5('0x46')]['id']}})[_0x70b5('0x26')](handleEntityNotFound(_0x4528fc,null))[_0x70b5('0x26')](function(_0x49d1ea){if(_0x49d1ea){_0xaa7c=_0x49d1ea;_0x2cdbdb[_0x70b5('0x31')]=_[_0x70b5('0x33')](db[_0x70b5('0x4d')][_0x70b5('0x2e')]);_0x2cdbdb['query']=_[_0x70b5('0x33')](_0x3fa4d1[_0x70b5('0x32')]);_0x2cdbdb[_0x70b5('0x34')]=_[_0x70b5('0x35')](_0x2cdbdb[_0x70b5('0x31')],_0x2cdbdb[_0x70b5('0x32')]);_0x366267['attributes']=_[_0x70b5('0x35')](_0x2cdbdb['model'],qs[_0x70b5('0x37')](_0x3fa4d1[_0x70b5('0x32')][_0x70b5('0x37')]));_0x366267['attributes']=_0x366267[_0x70b5('0x36')][_0x70b5('0x38')]?_0x366267[_0x70b5('0x36')]:_0x2cdbdb[_0x70b5('0x31')];_0x366267[_0x70b5('0x3a')]=qs[_0x70b5('0x3b')](_0x3fa4d1['query']['sort']);_0x366267['where']=qs[_0x70b5('0x34')](_['pick'](_0x3fa4d1['query'],_0x2cdbdb[_0x70b5('0x34')]));if(_0x3fa4d1[_0x70b5('0x32')][_0x70b5('0x3e')]){_0x366267[_0x70b5('0x3c')]=_[_0x70b5('0x40')](_0x366267[_0x70b5('0x3c')],{'$or':_['map'](_0x366267['attributes'],function(_0x2c4900){var _0xfbd1e7={};_0xfbd1e7[_0x2c4900]={'$like':'%'+_0x3fa4d1[_0x70b5('0x32')][_0x70b5('0x3e')]+'%'};return _0xfbd1e7;})});}_0x366267=_['merge']({},_0x366267,_0x3fa4d1[_0x70b5('0x41')]);return _0xaa7c[_0x70b5('0x4b')](_0x366267);}})[_0x70b5('0x26')](function(_0x31fc06){if(_0x31fc06){_0x379e56=_0x31fc06[_0x70b5('0x38')];if(!_0x3fa4d1[_0x70b5('0x32')][_0x70b5('0x4e')](_0x70b5('0x39'))){_0x366267['limit']=qs[_0x70b5('0x20')](_0x3fa4d1[_0x70b5('0x32')][_0x70b5('0x20')]);_0x366267[_0x70b5('0x1e')]=qs['offset'](_0x3fa4d1[_0x70b5('0x32')]['offset']);}return _0xaa7c[_0x70b5('0x4b')](_0x366267);}})[_0x70b5('0x26')](function(_0x3e4eaf){if(_0x3e4eaf){return _0x3e4eaf?{'count':_0x379e56,'rows':_0x3e4eaf}:null;}})['then'](respondWithResult(_0x4528fc,null))['catch'](handleError(_0x4528fc,null));};exports[_0x70b5('0x4f')]=function(_0x548487,_0x236e01,_0x4e22a2){var _0x57a66c={};var _0x5f1fc6={};var _0x570204;var _0x580eaf;return db['ServicenowConfiguration'][_0x70b5('0x4c')]({'where':{'id':_0x548487['params']['id']}})[_0x70b5('0x26')](handleEntityNotFound(_0x236e01,null))[_0x70b5('0x26')](function(_0x5c77d2){if(_0x5c77d2){_0x570204=_0x5c77d2;_0x5f1fc6[_0x70b5('0x31')]=_[_0x70b5('0x33')](db[_0x70b5('0x4d')][_0x70b5('0x2e')]);_0x5f1fc6[_0x70b5('0x32')]=_['keys'](_0x548487['query']);_0x5f1fc6[_0x70b5('0x34')]=_[_0x70b5('0x35')](_0x5f1fc6[_0x70b5('0x31')],_0x5f1fc6['query']);_0x57a66c['attributes']=_[_0x70b5('0x35')](_0x5f1fc6[_0x70b5('0x31')],qs[_0x70b5('0x37')](_0x548487['query']['fields']));_0x57a66c[_0x70b5('0x36')]=_0x57a66c[_0x70b5('0x36')]['length']?_0x57a66c[_0x70b5('0x36')]:_0x5f1fc6[_0x70b5('0x31')];_0x57a66c[_0x70b5('0x3a')]=qs[_0x70b5('0x3b')](_0x548487[_0x70b5('0x32')][_0x70b5('0x3b')]);_0x57a66c[_0x70b5('0x3c')]=qs['filters'](_['pick'](_0x548487[_0x70b5('0x32')],_0x5f1fc6[_0x70b5('0x34')]));if(_0x548487[_0x70b5('0x32')][_0x70b5('0x3e')]){_0x57a66c['where']=_['merge'](_0x57a66c['where'],{'$or':_[_0x70b5('0x2d')](_0x57a66c[_0x70b5('0x36')],function(_0x2dad18){var _0x487b4b={};_0x487b4b[_0x2dad18]={'$like':'%'+_0x548487['query'][_0x70b5('0x3e')]+'%'};return _0x487b4b;})});}_0x57a66c=_[_0x70b5('0x40')]({},_0x57a66c,_0x548487[_0x70b5('0x41')]);return _0x570204['getSubjects'](_0x57a66c);}})[_0x70b5('0x26')](function(_0x5d2e03){if(_0x5d2e03){_0x580eaf=_0x5d2e03[_0x70b5('0x38')];if(!_0x548487['query'][_0x70b5('0x4e')](_0x70b5('0x39'))){_0x57a66c[_0x70b5('0x20')]=qs['limit'](_0x548487['query'][_0x70b5('0x20')]);_0x57a66c[_0x70b5('0x1e')]=qs[_0x70b5('0x1e')](_0x548487['query'][_0x70b5('0x1e')]);}return _0x570204[_0x70b5('0x4f')](_0x57a66c);}})[_0x70b5('0x26')](function(_0x18d441){if(_0x18d441){return _0x18d441?{'count':_0x580eaf,'rows':_0x18d441}:null;}})[_0x70b5('0x26')](respondWithResult(_0x236e01,null))[_0x70b5('0x44')](handleError(_0x236e01,null));};exports[_0x70b5('0x50')]=function(_0x428ee5,_0x1b5f52,_0x5dd5f3){var _0x73a740={};var _0x1c0789={};var _0x2212ac;var _0x30e316;return db[_0x70b5('0x43')]['findOne']({'where':{'id':_0x428ee5[_0x70b5('0x46')]['id']}})[_0x70b5('0x26')](handleEntityNotFound(_0x1b5f52,null))[_0x70b5('0x26')](function(_0xa99c84){if(_0xa99c84){_0x2212ac=_0xa99c84;_0x1c0789[_0x70b5('0x31')]=_[_0x70b5('0x33')](db[_0x70b5('0x4d')][_0x70b5('0x2e')]);_0x1c0789['query']=_[_0x70b5('0x33')](_0x428ee5['query']);_0x1c0789[_0x70b5('0x34')]=_['intersection'](_0x1c0789[_0x70b5('0x31')],_0x1c0789[_0x70b5('0x32')]);_0x73a740['attributes']=_[_0x70b5('0x35')](_0x1c0789[_0x70b5('0x31')],qs[_0x70b5('0x37')](_0x428ee5[_0x70b5('0x32')]['fields']));_0x73a740[_0x70b5('0x36')]=_0x73a740[_0x70b5('0x36')][_0x70b5('0x38')]?_0x73a740[_0x70b5('0x36')]:_0x1c0789[_0x70b5('0x31')];_0x73a740[_0x70b5('0x3a')]=qs[_0x70b5('0x3b')](_0x428ee5[_0x70b5('0x32')][_0x70b5('0x3b')]);_0x73a740[_0x70b5('0x3c')]=qs[_0x70b5('0x34')](_[_0x70b5('0x3d')](_0x428ee5[_0x70b5('0x32')],_0x1c0789[_0x70b5('0x34')]));if(_0x428ee5['query'][_0x70b5('0x3e')]){_0x73a740[_0x70b5('0x3c')]=_['merge'](_0x73a740[_0x70b5('0x3c')],{'$or':_[_0x70b5('0x2d')](_0x73a740[_0x70b5('0x36')],function(_0x4ddb73){var _0x5182c2={};_0x5182c2[_0x4ddb73]={'$like':'%'+_0x428ee5[_0x70b5('0x32')][_0x70b5('0x3e')]+'%'};return _0x5182c2;})});}_0x73a740=_[_0x70b5('0x40')]({},_0x73a740,_0x428ee5[_0x70b5('0x41')]);return _0x2212ac[_0x70b5('0x50')](_0x73a740);}})[_0x70b5('0x26')](function(_0x264425){if(_0x264425){_0x30e316=_0x264425[_0x70b5('0x38')];if(!_0x428ee5[_0x70b5('0x32')][_0x70b5('0x4e')](_0x70b5('0x39'))){_0x73a740[_0x70b5('0x20')]=qs[_0x70b5('0x20')](_0x428ee5['query'][_0x70b5('0x20')]);_0x73a740[_0x70b5('0x1e')]=qs[_0x70b5('0x1e')](_0x428ee5['query'][_0x70b5('0x1e')]);}return _0x2212ac[_0x70b5('0x50')](_0x73a740);}})[_0x70b5('0x26')](function(_0x4a2f0d){if(_0x4a2f0d){return _0x4a2f0d?{'count':_0x30e316,'rows':_0x4a2f0d}:null;}})['then'](respondWithResult(_0x1b5f52,null))[_0x70b5('0x44')](handleError(_0x1b5f52,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1b70041..7f6c44d 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 _0x93e9=['moment','bluebird','request-promise','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x2e85c2,_0x54dc93){var _0x5818bf=function(_0x42c679){while(--_0x42c679){_0x2e85c2['push'](_0x2e85c2['shift']());}};_0x5818bf(++_0x54dc93);}(_0x93e9,0xcc));var _0x993e=function(_0x285e4f,_0x531eae){_0x285e4f=_0x285e4f-0x0;var _0x3e2160=_0x93e9[_0x285e4f];return _0x3e2160;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd027=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7d02('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7d02('0x1'));var BPromise=require(_0x7d02('0x2'));var rp=require(_0x7d02('0x3'));var fs=require('fs');var path=require(_0x7d02('0x4'));var rimraf=require(_0x7d02('0x5'));var config=require(_0x7d02('0x6'));var attributes=require(_0x7d02('0x7'));module[_0x7d02('0x8')]=function(_0x50824f,_0x1e75e2){return _0x50824f[_0x7d02('0x9')](_0x7d02('0xa'),attributes,{'tableName':_0x7d02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 16015b5..98fbb76 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 _0xbeb1=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbeb1,0x9b));var _0x1beb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbeb1[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x1beb('0x0'));var util=require(_0x1beb('0x1'));var moment=require(_0x1beb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1beb('0x3'));var db=require(_0x1beb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1beb('0x5'))(_0x1beb('0x6'));var config=require(_0x1beb('0x7'));var jayson=require(_0x1beb('0x8'));var client=jayson[_0x1beb('0x9')][_0x1beb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1149d7,_0x3c0db7,_0x25aa9d){return new BPromise(function(_0xffab57,_0x5ece76){return client[_0x1beb('0xb')](_0x1149d7,_0x25aa9d)[_0x1beb('0xc')](function(_0x11af3c){logger[_0x1beb('0xd')](_0x1beb('0xe'),_0x3c0db7,_0x1beb('0xf'));logger[_0x1beb('0x10')](_0x1beb('0x11'),_0x3c0db7,_0x1beb('0xf'),JSON[_0x1beb('0x12')](_0x11af3c));if(_0x11af3c[_0x1beb('0x13')]){if(_0x11af3c[_0x1beb('0x13')][_0x1beb('0x14')]===0x1f4){logger[_0x1beb('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3c0db7,_0x11af3c[_0x1beb('0x13')]['message']);return _0x5ece76(_0x11af3c['error'][_0x1beb('0x15')]);}logger[_0x1beb('0x13')](_0x1beb('0xe'),_0x3c0db7,_0x11af3c[_0x1beb('0x13')]['message']);return _0xffab57(_0x11af3c[_0x1beb('0x13')][_0x1beb('0x15')]);}else{logger[_0x1beb('0xd')](_0x1beb('0xe'),_0x3c0db7,_0x1beb('0xf'));_0xffab57(_0x11af3c[_0x1beb('0x16')][_0x1beb('0x15')]);}})[_0x1beb('0x17')](function(_0x48c464){logger[_0x1beb('0x13')](_0x1beb('0xe'),_0x3c0db7,_0x48c464);_0x5ece76(_0x48c464);});});} \ No newline at end of file +var _0x3dc3=['ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1ee0ef,_0x313286){var _0x160235=function(_0x3b2aba){while(--_0x3b2aba){_0x1ee0ef['push'](_0x1ee0ef['shift']());}};_0x160235(++_0x313286);}(_0x3dc3,0xea));var _0x33dc=function(_0x50ca21,_0x530d37){_0x50ca21=_0x50ca21-0x0;var _0x375487=_0x3dc3[_0x50ca21];return _0x375487;};'use strict';var _=require(_0x33dc('0x0'));var util=require('util');var moment=require(_0x33dc('0x1'));var BPromise=require(_0x33dc('0x2'));var rs=require(_0x33dc('0x3'));var fs=require('fs');var Redis=require(_0x33dc('0x4'));var db=require(_0x33dc('0x5'))['db'];var utils=require(_0x33dc('0x6'));var logger=require(_0x33dc('0x7'))(_0x33dc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x33dc('0x9')][_0x33dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x280d28,_0x4739d0,_0x8876c8){return new BPromise(function(_0x2747ba,_0x3ab27a){return client['request'](_0x280d28,_0x8876c8)[_0x33dc('0xb')](function(_0x29f533){logger[_0x33dc('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4739d0,_0x33dc('0xd'));logger[_0x33dc('0xe')](_0x33dc('0xf'),_0x4739d0,'request\x20sent',JSON[_0x33dc('0x10')](_0x29f533));if(_0x29f533[_0x33dc('0x11')]){if(_0x29f533['error']['code']===0x1f4){logger['error'](_0x33dc('0x12'),_0x4739d0,_0x29f533[_0x33dc('0x11')][_0x33dc('0x13')]);return _0x3ab27a(_0x29f533[_0x33dc('0x11')][_0x33dc('0x13')]);}logger['error'](_0x33dc('0x12'),_0x4739d0,_0x29f533['error']['message']);return _0x2747ba(_0x29f533[_0x33dc('0x11')][_0x33dc('0x13')]);}else{logger[_0x33dc('0xc')](_0x33dc('0x12'),_0x4739d0,_0x33dc('0xd'));_0x2747ba(_0x29f533[_0x33dc('0x14')][_0x33dc('0x13')]);}})['catch'](function(_0x4ee372){logger[_0x33dc('0x11')](_0x33dc('0x12'),_0x4739d0,_0x4ee372);_0x3ab27a(_0x4ee372);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 22119cc..36a9d11 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 _0xd164=['util','path','express','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x59c86e,_0x38ce57){var _0x48a50e=function(_0x1eeda5){while(--_0x1eeda5){_0x59c86e['push'](_0x59c86e['shift']());}};_0x48a50e(++_0x38ce57);}(_0xd164,0x120));var _0x4d16=function(_0x1daa7e,_0xc9104a){_0x1daa7e=_0x1daa7e-0x0;var _0x4f09ca=_0xd164[_0x1daa7e];return _0x4f09ca;};'use strict';var multer=require('multer');var util=require(_0x4d16('0x0'));var path=require(_0x4d16('0x1'));var timeout=require('connect-timeout');var express=require(_0x4d16('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d16('0x3'));var config=require(_0x4d16('0x4'));var controller=require(_0x4d16('0x5'));router[_0x4d16('0x6')]('/',auth[_0x4d16('0x7')](),controller[_0x4d16('0x8')]);router[_0x4d16('0x6')](_0x4d16('0x9'),auth[_0x4d16('0x7')](),controller[_0x4d16('0xa')]);router[_0x4d16('0xb')]('/',auth['isAuthenticated'](),controller[_0x4d16('0xc')]);router[_0x4d16('0xd')](_0x4d16('0x9'),auth[_0x4d16('0x7')](),controller[_0x4d16('0xe')]);router[_0x4d16('0xf')](_0x4d16('0x9'),auth[_0x4d16('0x7')](),controller[_0x4d16('0x10')]);module[_0x4d16('0x11')]=router; \ No newline at end of file +var _0x4e30=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index'];(function(_0x2388ef,_0x440144){var _0x2fc04b=function(_0x34568b){while(--_0x34568b){_0x2388ef['push'](_0x2388ef['shift']());}};_0x2fc04b(++_0x440144);}(_0x4e30,0x112));var _0x04e3=function(_0x33ae5b,_0x308271){_0x33ae5b=_0x33ae5b-0x0;var _0x3de84f=_0x4e30[_0x33ae5b];return _0x3de84f;};'use strict';var multer=require('multer');var util=require(_0x04e3('0x0'));var path=require(_0x04e3('0x1'));var timeout=require(_0x04e3('0x2'));var express=require(_0x04e3('0x3'));var router=express[_0x04e3('0x4')]();var fs_extra=require(_0x04e3('0x5'));var auth=require(_0x04e3('0x6'));var interaction=require(_0x04e3('0x7'));var config=require(_0x04e3('0x8'));var controller=require(_0x04e3('0x9'));router[_0x04e3('0xa')]('/',auth['isAuthenticated'](),controller[_0x04e3('0xb')]);router['get']('/:id',auth[_0x04e3('0xc')](),controller[_0x04e3('0xd')]);router[_0x04e3('0xe')]('/',auth[_0x04e3('0xc')](),controller[_0x04e3('0xf')]);router[_0x04e3('0x10')](_0x04e3('0x11'),auth[_0x04e3('0xc')](),controller[_0x04e3('0x12')]);router[_0x04e3('0x13')](_0x04e3('0x11'),auth[_0x04e3('0xc')](),controller[_0x04e3('0x14')]);module[_0x04e3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b6a1809..096c41b 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 _0x22a5=['string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x3ec630,_0x3ee528){var _0x5f3ef6=function(_0x8c938b){while(--_0x8c938b){_0x3ec630['push'](_0x3ec630['shift']());}};_0x5f3ef6(++_0x3ee528);}(_0x22a5,0x103));var _0x522a=function(_0x50cae0,_0x18f3eb){_0x50cae0=_0x50cae0-0x0;var _0x769359=_0x22a5[_0x50cae0];return _0x769359;};'use strict';var Sequelize=require(_0x522a('0x0'));module[_0x522a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x522a('0x2'),'variable',_0x522a('0x3'),_0x522a('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x522a('0x5')]},'key':{'type':Sequelize[_0x522a('0x5')]},'keyType':{'type':Sequelize[_0x522a('0x6')](_0x522a('0x2'),_0x522a('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x522a('0x5')]},'idField':{'type':Sequelize[_0x522a('0x5')]},'nameField':{'type':Sequelize[_0x522a('0x5')]},'customField':{'type':Sequelize[_0x522a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3100=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x3100,0xf6));var _0x0310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3100[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0310('0x0'));module[_0x0310('0x1')]={'type':{'type':Sequelize[_0x0310('0x2')]('string',_0x0310('0x3'),_0x0310('0x4'),'keyValue',_0x0310('0x5')),'defaultValue':_0x0310('0x6')},'content':{'type':Sequelize[_0x0310('0x7')]},'key':{'type':Sequelize[_0x0310('0x7')]},'keyType':{'type':Sequelize[_0x0310('0x2')]('string',_0x0310('0x3'),_0x0310('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0310('0x7')]},'nameField':{'type':Sequelize[_0x0310('0x7')]},'customField':{'type':Sequelize[_0x0310('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ef08d58..e364480 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 _0xa56e=['pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where'];(function(_0x26b00e,_0x245a09){var _0x3764c3=function(_0x30fe77){while(--_0x30fe77){_0x26b00e['push'](_0x26b00e['shift']());}};_0x3764c3(++_0x245a09);}(_0xa56e,0xee));var _0xea56=function(_0xf2a7a5,_0x322667){_0xf2a7a5=_0xf2a7a5-0x0;var _0x5c494b=_0xa56e[_0xf2a7a5];return _0x5c494b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea56('0x0'));var zipdir=require(_0xea56('0x1'));var jsonpatch=require(_0xea56('0x2'));var rp=require(_0xea56('0x3'));var moment=require(_0xea56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea56('0x5'));var util=require(_0xea56('0x6'));var path=require(_0xea56('0x7'));var sox=require('sox');var csv=require(_0xea56('0x8'));var ejs=require(_0xea56('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea56('0xa'));var squel=require(_0xea56('0xb'));var crypto=require(_0xea56('0xc'));var jsforce=require(_0xea56('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea56('0x8'));var querystring=require(_0xea56('0xe'));var Papa=require('papaparse');var Redis=require(_0xea56('0xf'));var authService=require(_0xea56('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xea56('0x11'));var hardwareService=require(_0xea56('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xea56('0x13'));var config=require(_0xea56('0x14'));var licenseUtil=require(_0xea56('0x15'));var db=require(_0xea56('0x16'))['db'];function respondWithStatusCode(_0x14e280,_0x24e309){_0x24e309=_0x24e309||0xcc;return function(_0x43e808){if(_0x43e808){return _0x14e280[_0xea56('0x17')](_0x24e309);}return _0x14e280[_0xea56('0x18')](_0x24e309)[_0xea56('0x19')]();};}function respondWithResult(_0x1022c9,_0x1d4765){_0x1d4765=_0x1d4765||0xc8;return function(_0xc97c01){if(_0xc97c01){return _0x1022c9[_0xea56('0x18')](_0x1d4765)[_0xea56('0x1a')](_0xc97c01);}};}function respondWithFilteredResult(_0xbc040,_0x3d4cf3){return function(_0x3b13f3){if(_0x3b13f3){var _0x228e8a=typeof _0x3d4cf3[_0xea56('0x1b')]===_0xea56('0x1c')&&typeof _0x3d4cf3[_0xea56('0x1d')]==='undefined';var _0x1f3505=_0x3b13f3[_0xea56('0x1e')];var _0x927d4a=_0x228e8a?0x0:_0x3d4cf3[_0xea56('0x1b')];var _0xbfc889=_0x228e8a?_0x3b13f3[_0xea56('0x1e')]:_0x3d4cf3[_0xea56('0x1b')]+_0x3d4cf3[_0xea56('0x1d')];var _0x2c7b27;if(_0xbfc889>=_0x1f3505){_0xbfc889=_0x1f3505;_0x2c7b27=0xc8;}else{_0x2c7b27=0xce;}_0xbc040[_0xea56('0x18')](_0x2c7b27);return _0xbc040['set'](_0xea56('0x1f'),_0x927d4a+'-'+_0xbfc889+'/'+_0x1f3505)['json'](_0x3b13f3);}return null;};}function patchUpdates(_0x4d6ddd){return function(_0x4c79b0){try{jsonpatch[_0xea56('0x20')](_0x4c79b0,_0x4d6ddd,!![]);}catch(_0x95344d){return BPromise[_0xea56('0x21')](_0x95344d);}return _0x4c79b0[_0xea56('0x22')]();};}function saveUpdates(_0x3a17ff,_0x2b8dd3){return function(_0xa0f4cb){if(_0xa0f4cb){return _0xa0f4cb[_0xea56('0x23')](_0x3a17ff)[_0xea56('0x24')](function(_0xf9b168){return _0xf9b168;});}return null;};}function removeEntity(_0x2a7402,_0x4921dc){return function(_0x22790a){if(_0x22790a){return _0x22790a[_0xea56('0x25')]()[_0xea56('0x24')](function(){_0x2a7402['status'](0xcc)[_0xea56('0x19')]();});}};}function handleEntityNotFound(_0x3257f5,_0x2060cb){return function(_0x59a180){if(!_0x59a180){_0x3257f5[_0xea56('0x17')](0x194);}return _0x59a180;};}function handleError(_0x46f61f,_0x396f87){_0x396f87=_0x396f87||0x1f4;return function(_0x4442be){logger[_0xea56('0x26')](_0x4442be['stack']);if(_0x4442be[_0xea56('0x27')]){delete _0x4442be[_0xea56('0x27')];}_0x46f61f['status'](_0x396f87)[_0xea56('0x28')](_0x4442be);};}exports[_0xea56('0x29')]=function(_0x564bd7,_0x408f8c){var _0x5ad37e={},_0x1d6254={},_0x58704e={'count':0x0,'rows':[]};var _0x51fe74=_[_0xea56('0x2a')](db[_0xea56('0x2b')][_0xea56('0x2c')],function(_0x1eb3ab){return{'name':_0x1eb3ab['fieldName'],'type':_0x1eb3ab['type'][_0xea56('0x2d')]};});_0x1d6254['model']=_['map'](_0x51fe74,_0xea56('0x27'));_0x1d6254[_0xea56('0x2e')]=_[_0xea56('0x2f')](_0x564bd7[_0xea56('0x2e')]);_0x1d6254[_0xea56('0x30')]=_[_0xea56('0x31')](_0x1d6254[_0xea56('0x32')],_0x1d6254[_0xea56('0x2e')]);_0x5ad37e[_0xea56('0x33')]=_['intersection'](_0x1d6254['model'],qs['fields'](_0x564bd7[_0xea56('0x2e')][_0xea56('0x34')]));_0x5ad37e[_0xea56('0x33')]=_0x5ad37e[_0xea56('0x33')][_0xea56('0x35')]?_0x5ad37e[_0xea56('0x33')]:_0x1d6254[_0xea56('0x32')];if(!_0x564bd7['query']['hasOwnProperty'](_0xea56('0x36'))){_0x5ad37e[_0xea56('0x1d')]=qs['limit'](_0x564bd7['query'][_0xea56('0x1d')]);_0x5ad37e[_0xea56('0x1b')]=qs[_0xea56('0x1b')](_0x564bd7[_0xea56('0x2e')]['offset']);}_0x5ad37e[_0xea56('0x37')]=qs['sort'](_0x564bd7[_0xea56('0x2e')][_0xea56('0x38')]);_0x5ad37e[_0xea56('0x39')]=qs['filters'](_[_0xea56('0x3a')](_0x564bd7[_0xea56('0x2e')],_0x1d6254[_0xea56('0x30')]),_0x51fe74);if(_0x564bd7[_0xea56('0x2e')][_0xea56('0x3b')]){_0x5ad37e[_0xea56('0x39')]=_['merge'](_0x5ad37e[_0xea56('0x39')],{'$or':_[_0xea56('0x2a')](_0x51fe74,function(_0x5d5f8c){if(_0x5d5f8c[_0xea56('0x3c')]!==_0xea56('0x3d')){var _0x537b20={};_0x537b20[_0x5d5f8c[_0xea56('0x27')]]={'$like':'%'+_0x564bd7[_0xea56('0x2e')][_0xea56('0x3b')]+'%'};return _0x537b20;}})});}_0x5ad37e=_[_0xea56('0x3e')]({},_0x5ad37e,_0x564bd7['options']);var _0x35dc95={'where':_0x5ad37e[_0xea56('0x39')]};return db[_0xea56('0x2b')][_0xea56('0x1e')](_0x35dc95)[_0xea56('0x24')](function(_0x4dfe36){_0x58704e[_0xea56('0x1e')]=_0x4dfe36;if(_0x564bd7['query']['includeAll']){_0x5ad37e[_0xea56('0x3f')]=[{'all':!![]}];}return db[_0xea56('0x2b')][_0xea56('0x40')](_0x5ad37e);})['then'](function(_0x59c2b5){_0x58704e[_0xea56('0x41')]=_0x59c2b5;return _0x58704e;})[_0xea56('0x24')](respondWithFilteredResult(_0x408f8c,_0x5ad37e))[_0xea56('0x42')](handleError(_0x408f8c,null));};exports[_0xea56('0x43')]=function(_0x212ffc,_0x59eba9){var _0xe9fe35={'raw':!![],'where':{'id':_0x212ffc[_0xea56('0x44')]['id']}},_0x43d66d={};_0x43d66d[_0xea56('0x32')]=_['keys'](db[_0xea56('0x2b')]['rawAttributes']);_0x43d66d['query']=_[_0xea56('0x2f')](_0x212ffc[_0xea56('0x2e')]);_0x43d66d['filters']=_[_0xea56('0x31')](_0x43d66d['model'],_0x43d66d[_0xea56('0x2e')]);_0xe9fe35[_0xea56('0x33')]=_[_0xea56('0x31')](_0x43d66d[_0xea56('0x32')],qs[_0xea56('0x34')](_0x212ffc[_0xea56('0x2e')][_0xea56('0x34')]));_0xe9fe35[_0xea56('0x33')]=_0xe9fe35[_0xea56('0x33')]['length']?_0xe9fe35[_0xea56('0x33')]:_0x43d66d[_0xea56('0x32')];if(_0x212ffc[_0xea56('0x2e')][_0xea56('0x45')]){_0xe9fe35[_0xea56('0x3f')]=[{'all':!![]}];}_0xe9fe35=_['merge']({},_0xe9fe35,_0x212ffc[_0xea56('0x46')]);return db[_0xea56('0x2b')][_0xea56('0x47')](_0xe9fe35)[_0xea56('0x24')](handleEntityNotFound(_0x59eba9,null))[_0xea56('0x24')](respondWithResult(_0x59eba9,null))[_0xea56('0x42')](handleError(_0x59eba9,null));};exports[_0xea56('0x48')]=function(_0x1baf48,_0x47b71f){return db[_0xea56('0x2b')][_0xea56('0x48')](_0x1baf48[_0xea56('0x49')],{})[_0xea56('0x24')](respondWithResult(_0x47b71f,0xc9))[_0xea56('0x42')](handleError(_0x47b71f,null));};exports['update']=function(_0x2a391a,_0x4d223f){if(_0x2a391a['body']['id']){delete _0x2a391a[_0xea56('0x49')]['id'];}return db[_0xea56('0x2b')][_0xea56('0x47')]({'where':{'id':_0x2a391a[_0xea56('0x44')]['id']}})[_0xea56('0x24')](handleEntityNotFound(_0x4d223f,null))[_0xea56('0x24')](saveUpdates(_0x2a391a['body'],null))['then'](respondWithResult(_0x4d223f,null))[_0xea56('0x42')](handleError(_0x4d223f,null));};exports[_0xea56('0x25')]=function(_0x23e467,_0x661ee7){return db[_0xea56('0x2b')][_0xea56('0x47')]({'where':{'id':_0x23e467[_0xea56('0x44')]['id']}})[_0xea56('0x24')](handleEntityNotFound(_0x661ee7,null))[_0xea56('0x24')](removeEntity(_0x661ee7,null))['catch'](handleError(_0x661ee7,null));}; \ No newline at end of file +var _0x9b73=['rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','end','error','stack','name','send','map','ServicenowField'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x9b73,0x6c));var _0x39b7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9b73[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39b7('0x0'));var zipdir=require(_0x39b7('0x1'));var jsonpatch=require(_0x39b7('0x2'));var rp=require(_0x39b7('0x3'));var moment=require(_0x39b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39b7('0x5'));var util=require(_0x39b7('0x6'));var path=require(_0x39b7('0x7'));var sox=require(_0x39b7('0x8'));var csv=require(_0x39b7('0x9'));var ejs=require(_0x39b7('0xa'));var fs=require('fs');var fs_extra=require(_0x39b7('0xb'));var _=require(_0x39b7('0xc'));var squel=require(_0x39b7('0xd'));var crypto=require('crypto');var jsforce=require(_0x39b7('0xe'));var deskjs=require(_0x39b7('0xf'));var toCsv=require(_0x39b7('0x9'));var querystring=require(_0x39b7('0x10'));var Papa=require(_0x39b7('0x11'));var Redis=require(_0x39b7('0x12'));var authService=require(_0x39b7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x39b7('0x14'));var hardwareService=require(_0x39b7('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x39b7('0x16'));var licenseUtil=require(_0x39b7('0x17'));var db=require(_0x39b7('0x18'))['db'];function respondWithStatusCode(_0x3e5d88,_0x10efdd){_0x10efdd=_0x10efdd||0xcc;return function(_0x37ed55){if(_0x37ed55){return _0x3e5d88[_0x39b7('0x19')](_0x10efdd);}return _0x3e5d88[_0x39b7('0x1a')](_0x10efdd)['end']();};}function respondWithResult(_0x4dd7af,_0x32f096){_0x32f096=_0x32f096||0xc8;return function(_0x13e379){if(_0x13e379){return _0x4dd7af[_0x39b7('0x1a')](_0x32f096)['json'](_0x13e379);}};}function respondWithFilteredResult(_0x4ad9dc,_0x5e4698){return function(_0x3c6cdc){if(_0x3c6cdc){var _0x9aea1d=typeof _0x5e4698[_0x39b7('0x1b')]===_0x39b7('0x1c')&&typeof _0x5e4698[_0x39b7('0x1d')]===_0x39b7('0x1c');var _0x48433f=_0x3c6cdc[_0x39b7('0x1e')];var _0x3acbe2=_0x9aea1d?0x0:_0x5e4698[_0x39b7('0x1b')];var _0x1a48fb=_0x9aea1d?_0x3c6cdc[_0x39b7('0x1e')]:_0x5e4698[_0x39b7('0x1b')]+_0x5e4698[_0x39b7('0x1d')];var _0x35e904;if(_0x1a48fb>=_0x48433f){_0x1a48fb=_0x48433f;_0x35e904=0xc8;}else{_0x35e904=0xce;}_0x4ad9dc[_0x39b7('0x1a')](_0x35e904);return _0x4ad9dc[_0x39b7('0x1f')](_0x39b7('0x20'),_0x3acbe2+'-'+_0x1a48fb+'/'+_0x48433f)[_0x39b7('0x21')](_0x3c6cdc);}return null;};}function patchUpdates(_0x4ede5d){return function(_0x241941){try{jsonpatch[_0x39b7('0x22')](_0x241941,_0x4ede5d,!![]);}catch(_0x2599c2){return BPromise['reject'](_0x2599c2);}return _0x241941[_0x39b7('0x23')]();};}function saveUpdates(_0x518626,_0x58aff6){return function(_0xa7eebd){if(_0xa7eebd){return _0xa7eebd['update'](_0x518626)[_0x39b7('0x24')](function(_0x2c07de){return _0x2c07de;});}return null;};}function removeEntity(_0x37fd74,_0x5a6f7a){return function(_0x43d605){if(_0x43d605){return _0x43d605['destroy']()['then'](function(){_0x37fd74[_0x39b7('0x1a')](0xcc)[_0x39b7('0x25')]();});}};}function handleEntityNotFound(_0x5b3af4,_0x2442ac){return function(_0x25667a){if(!_0x25667a){_0x5b3af4[_0x39b7('0x19')](0x194);}return _0x25667a;};}function handleError(_0xc6cd9,_0x3a4383){_0x3a4383=_0x3a4383||0x1f4;return function(_0x1a75ff){logger[_0x39b7('0x26')](_0x1a75ff[_0x39b7('0x27')]);if(_0x1a75ff[_0x39b7('0x28')]){delete _0x1a75ff[_0x39b7('0x28')];}_0xc6cd9['status'](_0x3a4383)[_0x39b7('0x29')](_0x1a75ff);};}exports['index']=function(_0x2e870f,_0x38720b){var _0x3af374={},_0x4ecaa2={},_0x5e4932={'count':0x0,'rows':[]};var _0x138d98=_[_0x39b7('0x2a')](db[_0x39b7('0x2b')][_0x39b7('0x2c')],function(_0x62d766){return{'name':_0x62d766['fieldName'],'type':_0x62d766[_0x39b7('0x2d')][_0x39b7('0x2e')]};});_0x4ecaa2[_0x39b7('0x2f')]=_[_0x39b7('0x2a')](_0x138d98,_0x39b7('0x28'));_0x4ecaa2[_0x39b7('0x30')]=_['keys'](_0x2e870f[_0x39b7('0x30')]);_0x4ecaa2[_0x39b7('0x31')]=_[_0x39b7('0x32')](_0x4ecaa2[_0x39b7('0x2f')],_0x4ecaa2[_0x39b7('0x30')]);_0x3af374[_0x39b7('0x33')]=_['intersection'](_0x4ecaa2['model'],qs['fields'](_0x2e870f[_0x39b7('0x30')][_0x39b7('0x34')]));_0x3af374[_0x39b7('0x33')]=_0x3af374[_0x39b7('0x33')]['length']?_0x3af374['attributes']:_0x4ecaa2[_0x39b7('0x2f')];if(!_0x2e870f['query'][_0x39b7('0x35')](_0x39b7('0x36'))){_0x3af374[_0x39b7('0x1d')]=qs[_0x39b7('0x1d')](_0x2e870f['query']['limit']);_0x3af374[_0x39b7('0x1b')]=qs[_0x39b7('0x1b')](_0x2e870f[_0x39b7('0x30')][_0x39b7('0x1b')]);}_0x3af374['order']=qs[_0x39b7('0x37')](_0x2e870f[_0x39b7('0x30')][_0x39b7('0x37')]);_0x3af374[_0x39b7('0x38')]=qs[_0x39b7('0x31')](_[_0x39b7('0x39')](_0x2e870f[_0x39b7('0x30')],_0x4ecaa2['filters']),_0x138d98);if(_0x2e870f[_0x39b7('0x30')][_0x39b7('0x3a')]){_0x3af374[_0x39b7('0x38')]=_[_0x39b7('0x3b')](_0x3af374['where'],{'$or':_[_0x39b7('0x2a')](_0x138d98,function(_0x3335dc){if(_0x3335dc['type']!==_0x39b7('0x3c')){var _0x48aa5f={};_0x48aa5f[_0x3335dc[_0x39b7('0x28')]]={'$like':'%'+_0x2e870f[_0x39b7('0x30')][_0x39b7('0x3a')]+'%'};return _0x48aa5f;}})});}_0x3af374=_[_0x39b7('0x3b')]({},_0x3af374,_0x2e870f[_0x39b7('0x3d')]);var _0xf4f215={'where':_0x3af374[_0x39b7('0x38')]};return db[_0x39b7('0x2b')][_0x39b7('0x1e')](_0xf4f215)[_0x39b7('0x24')](function(_0x52de68){_0x5e4932['count']=_0x52de68;if(_0x2e870f[_0x39b7('0x30')][_0x39b7('0x3e')]){_0x3af374[_0x39b7('0x3f')]=[{'all':!![]}];}return db[_0x39b7('0x2b')][_0x39b7('0x40')](_0x3af374);})[_0x39b7('0x24')](function(_0x1acec1){_0x5e4932[_0x39b7('0x41')]=_0x1acec1;return _0x5e4932;})[_0x39b7('0x24')](respondWithFilteredResult(_0x38720b,_0x3af374))[_0x39b7('0x42')](handleError(_0x38720b,null));};exports[_0x39b7('0x43')]=function(_0x128076,_0x99a996){var _0x489b45={'raw':!![],'where':{'id':_0x128076[_0x39b7('0x44')]['id']}},_0x1cc7cc={};_0x1cc7cc[_0x39b7('0x2f')]=_['keys'](db[_0x39b7('0x2b')]['rawAttributes']);_0x1cc7cc['query']=_[_0x39b7('0x45')](_0x128076[_0x39b7('0x30')]);_0x1cc7cc[_0x39b7('0x31')]=_[_0x39b7('0x32')](_0x1cc7cc[_0x39b7('0x2f')],_0x1cc7cc['query']);_0x489b45['attributes']=_[_0x39b7('0x32')](_0x1cc7cc[_0x39b7('0x2f')],qs[_0x39b7('0x34')](_0x128076[_0x39b7('0x30')]['fields']));_0x489b45['attributes']=_0x489b45[_0x39b7('0x33')][_0x39b7('0x46')]?_0x489b45[_0x39b7('0x33')]:_0x1cc7cc['model'];if(_0x128076[_0x39b7('0x30')]['includeAll']){_0x489b45[_0x39b7('0x3f')]=[{'all':!![]}];}_0x489b45=_[_0x39b7('0x3b')]({},_0x489b45,_0x128076[_0x39b7('0x3d')]);return db['ServicenowField'][_0x39b7('0x47')](_0x489b45)['then'](handleEntityNotFound(_0x99a996,null))[_0x39b7('0x24')](respondWithResult(_0x99a996,null))[_0x39b7('0x42')](handleError(_0x99a996,null));};exports[_0x39b7('0x48')]=function(_0x2708e4,_0x1c1621){return db['ServicenowField'][_0x39b7('0x48')](_0x2708e4[_0x39b7('0x49')],{})[_0x39b7('0x24')](respondWithResult(_0x1c1621,0xc9))[_0x39b7('0x42')](handleError(_0x1c1621,null));};exports[_0x39b7('0x4a')]=function(_0xcc44e9,_0x563d17){if(_0xcc44e9[_0x39b7('0x49')]['id']){delete _0xcc44e9[_0x39b7('0x49')]['id'];}return db[_0x39b7('0x2b')][_0x39b7('0x47')]({'where':{'id':_0xcc44e9[_0x39b7('0x44')]['id']}})[_0x39b7('0x24')](handleEntityNotFound(_0x563d17,null))[_0x39b7('0x24')](saveUpdates(_0xcc44e9[_0x39b7('0x49')],null))[_0x39b7('0x24')](respondWithResult(_0x563d17,null))[_0x39b7('0x42')](handleError(_0x563d17,null));};exports[_0x39b7('0x4b')]=function(_0x4d43a6,_0x53a7f9){return db[_0x39b7('0x2b')][_0x39b7('0x47')]({'where':{'id':_0x4d43a6[_0x39b7('0x44')]['id']}})[_0x39b7('0x24')](handleEntityNotFound(_0x53a7f9,null))[_0x39b7('0x24')](removeEntity(_0x53a7f9,null))[_0x39b7('0x42')](handleError(_0x53a7f9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a157962..46d5a44 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 _0x2e28=['idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x8544c0,_0x3095e7){var _0x1d0b9c=function(_0x5656e4){while(--_0x5656e4){_0x8544c0['push'](_0x8544c0['shift']());}};_0x1d0b9c(++_0x3095e7);}(_0x2e28,0x12e));var _0x82e2=function(_0x513315,_0x30ae66){_0x513315=_0x513315-0x0;var _0x1ceb7b=_0x2e28[_0x513315];return _0x1ceb7b;};'use strict';var _=require('lodash');var util=require(_0x82e2('0x0'));var logger=require(_0x82e2('0x1'))(_0x82e2('0x2'));var moment=require(_0x82e2('0x3'));var BPromise=require(_0x82e2('0x4'));var rp=require(_0x82e2('0x5'));var fs=require('fs');var path=require(_0x82e2('0x6'));var rimraf=require(_0x82e2('0x7'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x82e2('0x8')]=function(_0x51e0dc,_0x1f3ede){return _0x51e0dc[_0x82e2('0x9')](_0x82e2('0xa'),attributes,{'tableName':_0x82e2('0xb'),'paranoid':![],'indexes':[{'name':_0x82e2('0xc'),'fields':[_0x82e2('0xd'),_0x82e2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7075=['moment','request-promise','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x634636,_0x4cfe32){var _0x178457=function(_0x5ad403){while(--_0x5ad403){_0x634636['push'](_0x634636['shift']());}};_0x178457(++_0x4cfe32);}(_0x7075,0x169));var _0x5707=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7075[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x5707('0x0'));var logger=require(_0x5707('0x1'))(_0x5707('0x2'));var moment=require(_0x5707('0x3'));var BPromise=require('bluebird');var rp=require(_0x5707('0x4'));var fs=require('fs');var path=require(_0x5707('0x5'));var rimraf=require(_0x5707('0x6'));var config=require('../../config/environment');var attributes=require(_0x5707('0x7'));module[_0x5707('0x8')]=function(_0x2d7ec8,_0xe67f79){return _0x2d7ec8[_0x5707('0x9')](_0x5707('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x5707('0xb'),'fields':[_0x5707('0xc'),_0x5707('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index e251ce9..3ac3f3f 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x528e77,_0x272034){var _0x2b858a=function(_0x5594fa){while(--_0x5594fa){_0x528e77['push'](_0x528e77['shift']());}};_0x2b858a(++_0x272034);}(_0xaa88,0x137));var _0x8aa8=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xaa88[_0x90f34f];return _0x4b18cf;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xda3f,0xec));var _0xfda3=function(_0x4608e9,_0x23b286){_0x4608e9=_0x4608e9-0x0;var _0x492cbb=_0xda3f[_0x4608e9];return _0x492cbb;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0cf48f8..94e4908 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(_0x4a9bc8,_0x36b0a3){var _0x4e4fd8=function(_0x1ea06f){while(--_0x1ea06f){_0x4a9bc8['push'](_0x4a9bc8['shift']());}};_0x4e4fd8(++_0x36b0a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0xe351f3,_0x3aea13){var _0x490a4c=function(_0xfe43a9){while(--_0xfe43a9){_0xe351f3['push'](_0xe351f3['shift']());}};_0x490a4c(++_0x3aea13);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 06b95fb..fafdbce 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(_0x40d85b,_0x40b222){var _0x25df88=function(_0x1ad788){while(--_0x1ad788){_0x40d85b['push'](_0x40d85b['shift']());}};_0x25df88(++_0x40b222);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x4434d4,_0x3f6eb6){var _0x4a8887=function(_0x1872f0){while(--_0x1872f0){_0x4434d4['push'](_0x4434d4['shift']());}};_0x4a8887(++_0x3f6eb6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 d28c61d..ba3de96 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 _0x9277=['SugarcrmConfiguration','filter','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','values','module_fields','includes','label','endsWith','statusCode','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','catch','show','keys','rawAttributes','options','find','create','body','params','getConfigurations','findOne'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9277,0x195));var _0x7927=function(_0x53618a,_0x3ce1c8){_0x53618a=_0x53618a-0x0;var _0x588ddb=_0x9277[_0x53618a];return _0x588ddb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7927('0x0'));var jsonpatch=require(_0x7927('0x1'));var rp=require(_0x7927('0x2'));var moment=require(_0x7927('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7927('0x4'));var path=require(_0x7927('0x5'));var sox=require(_0x7927('0x6'));var csv=require('to-csv');var ejs=require(_0x7927('0x7'));var fs=require('fs');var fs_extra=require(_0x7927('0x8'));var _=require(_0x7927('0x9'));var squel=require(_0x7927('0xa'));var crypto=require('crypto');var jsforce=require(_0x7927('0xb'));var deskjs=require(_0x7927('0xc'));var toCsv=require(_0x7927('0xd'));var querystring=require(_0x7927('0xe'));var Papa=require(_0x7927('0xf'));var Redis=require(_0x7927('0x10'));var authService=require(_0x7927('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7927('0x12'));var hardwareService=require(_0x7927('0x13'));var logger=require(_0x7927('0x14'))(_0x7927('0x15'));var utils=require(_0x7927('0x16'));var config=require(_0x7927('0x17'));var licenseUtil=require(_0x7927('0x18'));var db=require(_0x7927('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x46d796,_0x5ac794){_0x5ac794=_0x5ac794||0xcc;return function(_0x1964c0){if(_0x1964c0){return _0x46d796[_0x7927('0x1a')](_0x5ac794);}return _0x46d796[_0x7927('0x1b')](_0x5ac794)['end']();};}function respondWithResult(_0x454da0,_0x2091b7){_0x2091b7=_0x2091b7||0xc8;return function(_0x3be15e){if(_0x3be15e){return _0x454da0[_0x7927('0x1b')](_0x2091b7)[_0x7927('0x1c')](_0x3be15e);}};}function respondWithFilteredResult(_0x336164,_0x2eb2a2){return function(_0x199f14){if(_0x199f14){var _0x27f332=typeof _0x2eb2a2[_0x7927('0x1d')]===_0x7927('0x1e')&&typeof _0x2eb2a2[_0x7927('0x1f')]===_0x7927('0x1e');var _0x43cf3=_0x199f14[_0x7927('0x20')];var _0x454615=_0x27f332?0x0:_0x2eb2a2[_0x7927('0x1d')];var _0x4db4de=_0x27f332?_0x199f14['count']:_0x2eb2a2[_0x7927('0x1d')]+_0x2eb2a2[_0x7927('0x1f')];var _0x1c3d56;if(_0x4db4de>=_0x43cf3){_0x4db4de=_0x43cf3;_0x1c3d56=0xc8;}else{_0x1c3d56=0xce;}_0x336164[_0x7927('0x1b')](_0x1c3d56);return _0x336164[_0x7927('0x21')](_0x7927('0x22'),_0x454615+'-'+_0x4db4de+'/'+_0x43cf3)[_0x7927('0x1c')](_0x199f14);}return null;};}function patchUpdates(_0x2a176e){return function(_0x3eae0a){try{jsonpatch[_0x7927('0x23')](_0x3eae0a,_0x2a176e,!![]);}catch(_0x40afa3){return BPromise[_0x7927('0x24')](_0x40afa3);}return _0x3eae0a[_0x7927('0x25')]();};}function saveUpdates(_0x28071d,_0x2be819){return function(_0xc9af99){if(_0xc9af99){return _0xc9af99[_0x7927('0x26')](_0x28071d)[_0x7927('0x27')](function(_0x1333f2){return _0x1333f2;});}return null;};}function removeEntity(_0xe499dc,_0x96a0c9){return function(_0x15187f){if(_0x15187f){return _0x15187f[_0x7927('0x28')]()[_0x7927('0x27')](function(){_0xe499dc[_0x7927('0x1b')](0xcc)[_0x7927('0x29')]();});}};}function handleEntityNotFound(_0x5858e3,_0x9dba05){return function(_0x5b3d8b){if(!_0x5b3d8b){_0x5858e3[_0x7927('0x1a')](0x194);}return _0x5b3d8b;};}function handleError(_0x3e59a6,_0x2750ce){_0x2750ce=_0x2750ce||0x1f4;return function(_0x8459f4){logger[_0x7927('0x2a')](_0x8459f4['stack']);if(_0x8459f4[_0x7927('0x2b')]){delete _0x8459f4[_0x7927('0x2b')];}_0x3e59a6[_0x7927('0x1b')](_0x2750ce)[_0x7927('0x2c')](_0x8459f4);};}exports[_0x7927('0x2d')]=function(_0x578d9c,_0x26bd40){var _0x3917b5={},_0x392eaf={},_0x2910a9={'count':0x0,'rows':[]};var _0x3abcbc=_[_0x7927('0x2e')](db[_0x7927('0x2f')]['rawAttributes'],function(_0x57139b){return{'name':_0x57139b[_0x7927('0x30')],'type':_0x57139b[_0x7927('0x31')][_0x7927('0x32')]};});_0x392eaf[_0x7927('0x33')]=_['map'](_0x3abcbc,'name');_0x392eaf[_0x7927('0x34')]=_['keys'](_0x578d9c[_0x7927('0x34')]);_0x392eaf[_0x7927('0x35')]=_[_0x7927('0x36')](_0x392eaf[_0x7927('0x33')],_0x392eaf[_0x7927('0x34')]);_0x3917b5['attributes']=_[_0x7927('0x36')](_0x392eaf['model'],qs[_0x7927('0x37')](_0x578d9c['query'][_0x7927('0x37')]));_0x3917b5[_0x7927('0x38')]=_0x3917b5['attributes'][_0x7927('0x39')]?_0x3917b5[_0x7927('0x38')]:_0x392eaf['model'];if(!_0x578d9c[_0x7927('0x34')][_0x7927('0x3a')](_0x7927('0x3b'))){_0x3917b5['limit']=qs[_0x7927('0x1f')](_0x578d9c[_0x7927('0x34')][_0x7927('0x1f')]);_0x3917b5[_0x7927('0x1d')]=qs[_0x7927('0x1d')](_0x578d9c[_0x7927('0x34')][_0x7927('0x1d')]);}_0x3917b5[_0x7927('0x3c')]=qs['sort'](_0x578d9c[_0x7927('0x34')][_0x7927('0x3d')]);_0x3917b5[_0x7927('0x3e')]=qs[_0x7927('0x35')](_[_0x7927('0x3f')](_0x578d9c[_0x7927('0x34')],_0x392eaf[_0x7927('0x35')]),_0x3abcbc);if(_0x578d9c[_0x7927('0x34')]['filter']){_0x3917b5['where']=_['merge'](_0x3917b5[_0x7927('0x3e')],{'$or':_[_0x7927('0x2e')](_0x3abcbc,function(_0x1de4d1){if(_0x1de4d1[_0x7927('0x31')]!==_0x7927('0x40')){var _0x103911={};_0x103911[_0x1de4d1[_0x7927('0x2b')]]={'$like':'%'+_0x578d9c[_0x7927('0x34')]['filter']+'%'};return _0x103911;}})});}_0x3917b5=_[_0x7927('0x41')]({},_0x3917b5,_0x578d9c['options']);var _0x3ab01a={'where':_0x3917b5[_0x7927('0x3e')]};return db[_0x7927('0x2f')][_0x7927('0x20')](_0x3ab01a)[_0x7927('0x27')](function(_0x382cc6){_0x2910a9[_0x7927('0x20')]=_0x382cc6;if(_0x578d9c[_0x7927('0x34')][_0x7927('0x42')]){_0x3917b5[_0x7927('0x43')]=[{'all':!![]}];}return db[_0x7927('0x2f')]['findAll'](_0x3917b5);})[_0x7927('0x27')](function(_0x28cec7){_0x2910a9['rows']=_0x28cec7;return _0x2910a9;})[_0x7927('0x27')](respondWithFilteredResult(_0x26bd40,_0x3917b5))[_0x7927('0x44')](handleError(_0x26bd40,null));};exports[_0x7927('0x45')]=function(_0x5d5058,_0x51e937){var _0x5f1076={'raw':![],'where':{'id':_0x5d5058['params']['id']}},_0xdbcedc={};_0xdbcedc[_0x7927('0x33')]=_[_0x7927('0x46')](db[_0x7927('0x2f')][_0x7927('0x47')]);_0xdbcedc[_0x7927('0x34')]=_[_0x7927('0x46')](_0x5d5058['query']);_0xdbcedc[_0x7927('0x35')]=_[_0x7927('0x36')](_0xdbcedc[_0x7927('0x33')],_0xdbcedc[_0x7927('0x34')]);_0x5f1076['attributes']=_[_0x7927('0x36')](_0xdbcedc[_0x7927('0x33')],qs['fields'](_0x5d5058[_0x7927('0x34')][_0x7927('0x37')]));_0x5f1076['attributes']=_0x5f1076['attributes'][_0x7927('0x39')]?_0x5f1076[_0x7927('0x38')]:_0xdbcedc['model'];if(_0x5d5058[_0x7927('0x34')][_0x7927('0x42')]){_0x5f1076[_0x7927('0x43')]=[{'all':!![]}];}_0x5f1076=_[_0x7927('0x41')]({},_0x5f1076,_0x5d5058[_0x7927('0x48')]);return db['SugarcrmAccount'][_0x7927('0x49')](_0x5f1076)[_0x7927('0x27')](handleEntityNotFound(_0x51e937,null))[_0x7927('0x27')](respondWithResult(_0x51e937,null))['catch'](handleError(_0x51e937,null));};exports[_0x7927('0x4a')]=function(_0x559ba9,_0x4d7f64){return db[_0x7927('0x2f')]['create'](_0x559ba9[_0x7927('0x4b')],{})[_0x7927('0x27')](respondWithResult(_0x4d7f64,0xc9))[_0x7927('0x44')](handleError(_0x4d7f64,null));};exports['update']=function(_0x3f5f6e,_0x38a2dd){if(_0x3f5f6e[_0x7927('0x4b')]['id']){delete _0x3f5f6e[_0x7927('0x4b')]['id'];}return db[_0x7927('0x2f')][_0x7927('0x49')]({'where':{'id':_0x3f5f6e[_0x7927('0x4c')]['id']}})[_0x7927('0x27')](handleEntityNotFound(_0x38a2dd,null))[_0x7927('0x27')](saveUpdates(_0x3f5f6e[_0x7927('0x4b')],null))[_0x7927('0x27')](respondWithResult(_0x38a2dd,null))[_0x7927('0x44')](handleError(_0x38a2dd,null));};exports[_0x7927('0x28')]=function(_0x3e7638,_0x1b8e1c){return db[_0x7927('0x2f')][_0x7927('0x49')]({'where':{'id':_0x3e7638[_0x7927('0x4c')]['id']}})[_0x7927('0x27')](handleEntityNotFound(_0x1b8e1c,null))[_0x7927('0x27')](removeEntity(_0x1b8e1c,null))[_0x7927('0x44')](handleError(_0x1b8e1c,null));};exports[_0x7927('0x4d')]=function(_0x11acd7,_0x3cfc5a,_0x459c35){var _0x3c7f1c={};var _0x24841e={};var _0x32cf67;var _0x590830;return db[_0x7927('0x2f')][_0x7927('0x4e')]({'where':{'id':_0x11acd7[_0x7927('0x4c')]['id']}})[_0x7927('0x27')](handleEntityNotFound(_0x3cfc5a,null))[_0x7927('0x27')](function(_0x33f8c1){if(_0x33f8c1){_0x32cf67=_0x33f8c1;_0x24841e['model']=_[_0x7927('0x46')](db[_0x7927('0x4f')]['rawAttributes']);_0x24841e[_0x7927('0x34')]=_[_0x7927('0x46')](_0x11acd7[_0x7927('0x34')]);_0x24841e[_0x7927('0x35')]=_['intersection'](_0x24841e[_0x7927('0x33')],_0x24841e[_0x7927('0x34')]);_0x3c7f1c['attributes']=_[_0x7927('0x36')](_0x24841e[_0x7927('0x33')],qs['fields'](_0x11acd7[_0x7927('0x34')]['fields']));_0x3c7f1c[_0x7927('0x38')]=_0x3c7f1c[_0x7927('0x38')][_0x7927('0x39')]?_0x3c7f1c[_0x7927('0x38')]:_0x24841e[_0x7927('0x33')];_0x3c7f1c[_0x7927('0x3c')]=qs[_0x7927('0x3d')](_0x11acd7[_0x7927('0x34')][_0x7927('0x3d')]);_0x3c7f1c[_0x7927('0x3e')]=qs['filters'](_[_0x7927('0x3f')](_0x11acd7[_0x7927('0x34')],_0x24841e['filters']));if(_0x11acd7[_0x7927('0x34')][_0x7927('0x50')]){_0x3c7f1c[_0x7927('0x3e')]=_[_0x7927('0x41')](_0x3c7f1c[_0x7927('0x3e')],{'$or':_[_0x7927('0x2e')](_0x3c7f1c[_0x7927('0x38')],function(_0x3cfe20){var _0x39eca8={};_0x39eca8[_0x3cfe20]={'$like':'%'+_0x11acd7[_0x7927('0x34')][_0x7927('0x50')]+'%'};return _0x39eca8;})});}_0x3c7f1c=_[_0x7927('0x41')]({},_0x3c7f1c,_0x11acd7[_0x7927('0x48')]);return _0x32cf67[_0x7927('0x4d')](_0x3c7f1c);}})[_0x7927('0x27')](function(_0x12e1f4){if(_0x12e1f4){_0x590830=_0x12e1f4[_0x7927('0x39')];if(!_0x11acd7['query'][_0x7927('0x3a')]('nolimit')){_0x3c7f1c[_0x7927('0x1f')]=qs[_0x7927('0x1f')](_0x11acd7[_0x7927('0x34')]['limit']);_0x3c7f1c[_0x7927('0x1d')]=qs[_0x7927('0x1d')](_0x11acd7['query']['offset']);}return _0x32cf67['getConfigurations'](_0x3c7f1c);}})[_0x7927('0x27')](function(_0x45f5ca){if(_0x45f5ca){return _0x45f5ca?{'count':_0x590830,'rows':_0x45f5ca}:null;}})[_0x7927('0x27')](respondWithResult(_0x3cfc5a,null))[_0x7927('0x44')](handleError(_0x3cfc5a,null));};exports[_0x7927('0x51')]=function(_0x1d5c31,_0x5ae646,_0x2221c1){if(_0x1d5c31['body']['id']){delete _0x1d5c31[_0x7927('0x4b')]['id'];}return db[_0x7927('0x2f')][_0x7927('0x4e')]({'where':{'id':_0x1d5c31[_0x7927('0x4c')]['id']}})[_0x7927('0x27')](handleEntityNotFound(_0x5ae646,null))[_0x7927('0x27')](function(_0x529090){if(_0x529090){_0x1d5c31[_0x7927('0x4b')][_0x7927('0x52')]=_0x529090['id'];_0x1d5c31['body']['Subjects']=integrations[_0x7927('0x53')](_0x1d5c31[_0x7927('0x4b')]['channel'],_0x1d5c31[_0x7927('0x4b')][_0x7927('0x31')]);_0x1d5c31[_0x7927('0x4b')][_0x7927('0x54')]=integrations[_0x7927('0x55')](_0x1d5c31[_0x7927('0x4b')][_0x7927('0x56')],_0x1d5c31[_0x7927('0x4b')]['type']);return db[_0x7927('0x4f')][_0x7927('0x4a')](_0x1d5c31['body'],{'include':[{'model':db[_0x7927('0x57')],'as':_0x7927('0x58')},{'model':db[_0x7927('0x57')],'as':_0x7927('0x54')}]});}return null;})[_0x7927('0x27')](respondWithResult(_0x5ae646,null))[_0x7927('0x44')](handleError(_0x5ae646,null));};exports[_0x7927('0x59')]=function(_0x58215f,_0x5e6e40,_0x50f5a6){var _0x2c70ce='';var _0x563732=['id',_0x7927('0x2b'),_0x7927('0x5a'),_0x7927('0x5b'),'description',_0x7927('0x5c'),'duration_hours',_0x7927('0x5d'),_0x7927('0x5e'),_0x7927('0x5f'),_0x7927('0x60'),_0x7927('0x61')];return db[_0x7927('0x2f')][_0x7927('0x4e')]({'where':{'id':_0x58215f[_0x7927('0x4c')]['id']},'attributes':['id','username',_0x7927('0x62'),_0x7927('0x63')]})[_0x7927('0x27')](handleEntityNotFound(_0x5e6e40,null))[_0x7927('0x27')](function(_0x203367){if(_0x203367){_0x2c70ce=_0x203367[_0x7927('0x63')];var _0x4d8e48=_0x2c70ce[_0x7927('0x64')](-0x1);if(_0x4d8e48==='/'){_0x2c70ce=_0x2c70ce[_0x7927('0x65')](0x0,_0x2c70ce['lastIndexOf'](_0x4d8e48));}return rp({'method':_0x7927('0x66'),'uri':util[_0x7927('0x67')](_0x7927('0x68'),_0x2c70ce,_0x7927('0x69')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x7927('0x6a'),'rest_data':JSON[_0x7927('0x6b')]({'user_auth':{'user_name':_0x203367[_0x7927('0x6c')],'password':_0x203367[_0x7927('0x62')],'encryption':_0x7927('0x6d')},'application':_0x7927('0x6e')})}});}})[_0x7927('0x27')](function(_0x49b18d){if(_0x49b18d&&_0x49b18d['name']!==_0x7927('0x6f')&&_0x49b18d[_0x7927('0x2b')]!=='Password\x20Expired'){return rp({'method':_0x7927('0x66'),'uri':util[_0x7927('0x67')](_0x7927('0x68'),_0x2c70ce,_0x7927('0x69')),'json':!![],'form':{'method':_0x7927('0x70'),'input_type':_0x7927('0x6a'),'response_type':_0x7927('0x6a'),'rest_data':JSON['stringify']({'session':_0x49b18d['id'],'module_name':'Calls'})}})[_0x7927('0x27')](function(_0xc87f18){if(_0xc87f18){var _0x4f5cbf=_[_0x7927('0x71')](_0xc87f18[_0x7927('0x72')]);_['remove'](_0x4f5cbf,function(_0x5870c5){return _0x563732[_0x7927('0x73')](_0x5870c5[_0x7927('0x2b')]);});return{'count':_0x4f5cbf[_0x7927('0x39')],'rows':_[_0x7927('0x2e')](_0x4f5cbf,function(_0x3491ac){return{'id':_0x3491ac[_0x7927('0x2b')],'name':_0x3491ac[_0x7927('0x74')],'custom':_[_0x7927('0x75')](_0x3491ac['name'],'_c')?!![]:![],'options':_0x3491ac[_0x7927('0x48')]?_[_0x7927('0x2e')](_[_0x7927('0x71')](_0x3491ac['options']),function(_0x25dc6c){return{'name':_0x25dc6c['value'],'value':_0x25dc6c[_0x7927('0x2b')]};}):[]};})};}})[_0x7927('0x27')](respondWithResult(_0x5e6e40,null))[_0x7927('0x44')](function(_0xcb19fa){var _0x16c903=_0x58215f[_0x7927('0x34')]['test']?0x1f4:_0xcb19fa[_0x7927('0x76')]||0x1f4;logger[_0x7927('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x7927('0x59'),_0x16c903,JSON[_0x7927('0x6b')](_0xcb19fa));delete _0xcb19fa[_0x7927('0x2b')];if(_0x16c903===0x191){_0x16c903=0x190;}_0x5e6e40[_0x7927('0x1b')](_0x16c903)[_0x7927('0x2c')](_0x58215f[_0x7927('0x34')][_0x7927('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0xcb19fa[_0x7927('0x76')]}:_0xcb19fa);});}else{var _0x1b5626=0x1f4;_0x5e6e40[_0x7927('0x1b')](_0x1b5626)[_0x7927('0x2c')]({'message':_0x7927('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xf45d=['getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','duration_hours','parent_id','parent_type','parent_name','direction','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','PLAIN','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','Content-Range','save','update','destroy','then','stack','name','index','rawAttributes','fieldName','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','SugarcrmAccount','catch','show','params','includeAll','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','Subjects'];(function(_0x1feb65,_0x59d59b){var _0xb2dbb3=function(_0x13c353){while(--_0x13c353){_0x1feb65['push'](_0x1feb65['shift']());}};_0xb2dbb3(++_0x59d59b);}(_0xf45d,0x9a));var _0xdf45=function(_0x503ef4,_0x4b6903){_0x503ef4=_0x503ef4-0x0;var _0xd3aeb=_0xf45d[_0x503ef4];return _0xd3aeb;};'use strict';var emlformat=require(_0xdf45('0x0'));var rimraf=require(_0xdf45('0x1'));var zipdir=require(_0xdf45('0x2'));var jsonpatch=require(_0xdf45('0x3'));var rp=require(_0xdf45('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf45('0x5'));var util=require(_0xdf45('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xdf45('0x7'));var ejs=require(_0xdf45('0x8'));var fs=require('fs');var fs_extra=require(_0xdf45('0x9'));var _=require(_0xdf45('0xa'));var squel=require(_0xdf45('0xb'));var crypto=require(_0xdf45('0xc'));var jsforce=require(_0xdf45('0xd'));var deskjs=require(_0xdf45('0xe'));var toCsv=require(_0xdf45('0x7'));var querystring=require(_0xdf45('0xf'));var Papa=require('papaparse');var Redis=require(_0xdf45('0x10'));var authService=require(_0xdf45('0x11'));var qs=require(_0xdf45('0x12'));var as=require(_0xdf45('0x13'));var hardwareService=require(_0xdf45('0x14'));var logger=require(_0xdf45('0x15'))('api');var utils=require(_0xdf45('0x16'));var config=require(_0xdf45('0x17'));var licenseUtil=require(_0xdf45('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56be00,_0x5d8bf2){_0x5d8bf2=_0x5d8bf2||0xcc;return function(_0x5bdd7d){if(_0x5bdd7d){return _0x56be00[_0xdf45('0x19')](_0x5d8bf2);}return _0x56be00[_0xdf45('0x1a')](_0x5d8bf2)[_0xdf45('0x1b')]();};}function respondWithResult(_0x131c37,_0x451937){_0x451937=_0x451937||0xc8;return function(_0x24c67c){if(_0x24c67c){return _0x131c37[_0xdf45('0x1a')](_0x451937)[_0xdf45('0x1c')](_0x24c67c);}};}function respondWithFilteredResult(_0x137fae,_0x455459){return function(_0x59f0aa){if(_0x59f0aa){var _0x49040e=typeof _0x455459[_0xdf45('0x1d')]==='undefined'&&typeof _0x455459['limit']==='undefined';var _0x53d866=_0x59f0aa[_0xdf45('0x1e')];var _0x1d23a9=_0x49040e?0x0:_0x455459[_0xdf45('0x1d')];var _0x9d62ae=_0x49040e?_0x59f0aa[_0xdf45('0x1e')]:_0x455459[_0xdf45('0x1d')]+_0x455459['limit'];var _0x2fb5e8;if(_0x9d62ae>=_0x53d866){_0x9d62ae=_0x53d866;_0x2fb5e8=0xc8;}else{_0x2fb5e8=0xce;}_0x137fae[_0xdf45('0x1a')](_0x2fb5e8);return _0x137fae['set'](_0xdf45('0x1f'),_0x1d23a9+'-'+_0x9d62ae+'/'+_0x53d866)['json'](_0x59f0aa);}return null;};}function patchUpdates(_0x449d3c){return function(_0x40b8e3){try{jsonpatch['apply'](_0x40b8e3,_0x449d3c,!![]);}catch(_0x26fd71){return BPromise['reject'](_0x26fd71);}return _0x40b8e3[_0xdf45('0x20')]();};}function saveUpdates(_0x1a6e0d,_0xc6fa7e){return function(_0x2ea4ac){if(_0x2ea4ac){return _0x2ea4ac[_0xdf45('0x21')](_0x1a6e0d)['then'](function(_0x49c38c){return _0x49c38c;});}return null;};}function removeEntity(_0x5ba1f0,_0x82bd3d){return function(_0x41ca9e){if(_0x41ca9e){return _0x41ca9e[_0xdf45('0x22')]()[_0xdf45('0x23')](function(){_0x5ba1f0['status'](0xcc)[_0xdf45('0x1b')]();});}};}function handleEntityNotFound(_0x3ae1f1,_0x517ed9){return function(_0x10a3fc){if(!_0x10a3fc){_0x3ae1f1[_0xdf45('0x19')](0x194);}return _0x10a3fc;};}function handleError(_0x3ca689,_0x5a2fc6){_0x5a2fc6=_0x5a2fc6||0x1f4;return function(_0x56b826){logger['error'](_0x56b826[_0xdf45('0x24')]);if(_0x56b826[_0xdf45('0x25')]){delete _0x56b826[_0xdf45('0x25')];}_0x3ca689[_0xdf45('0x1a')](_0x5a2fc6)['send'](_0x56b826);};}exports[_0xdf45('0x26')]=function(_0x584cae,_0xce5e62){var _0x325d37={},_0x1978a1={},_0x2b9664={'count':0x0,'rows':[]};var _0x288d53=_['map'](db['SugarcrmAccount'][_0xdf45('0x27')],function(_0x57ef4f){return{'name':_0x57ef4f[_0xdf45('0x28')],'type':_0x57ef4f['type']['key']};});_0x1978a1['model']=_[_0xdf45('0x29')](_0x288d53,_0xdf45('0x25'));_0x1978a1['query']=_[_0xdf45('0x2a')](_0x584cae[_0xdf45('0x2b')]);_0x1978a1[_0xdf45('0x2c')]=_[_0xdf45('0x2d')](_0x1978a1[_0xdf45('0x2e')],_0x1978a1[_0xdf45('0x2b')]);_0x325d37['attributes']=_[_0xdf45('0x2d')](_0x1978a1[_0xdf45('0x2e')],qs[_0xdf45('0x2f')](_0x584cae[_0xdf45('0x2b')]['fields']));_0x325d37[_0xdf45('0x30')]=_0x325d37['attributes'][_0xdf45('0x31')]?_0x325d37[_0xdf45('0x30')]:_0x1978a1[_0xdf45('0x2e')];if(!_0x584cae['query'][_0xdf45('0x32')]('nolimit')){_0x325d37[_0xdf45('0x33')]=qs[_0xdf45('0x33')](_0x584cae[_0xdf45('0x2b')][_0xdf45('0x33')]);_0x325d37[_0xdf45('0x1d')]=qs[_0xdf45('0x1d')](_0x584cae[_0xdf45('0x2b')][_0xdf45('0x1d')]);}_0x325d37[_0xdf45('0x34')]=qs[_0xdf45('0x35')](_0x584cae[_0xdf45('0x2b')][_0xdf45('0x35')]);_0x325d37[_0xdf45('0x36')]=qs[_0xdf45('0x2c')](_[_0xdf45('0x37')](_0x584cae[_0xdf45('0x2b')],_0x1978a1['filters']),_0x288d53);if(_0x584cae[_0xdf45('0x2b')][_0xdf45('0x38')]){_0x325d37[_0xdf45('0x36')]=_[_0xdf45('0x39')](_0x325d37['where'],{'$or':_[_0xdf45('0x29')](_0x288d53,function(_0xe0d9f5){if(_0xe0d9f5[_0xdf45('0x3a')]!=='VIRTUAL'){var _0x3f64ff={};_0x3f64ff[_0xe0d9f5[_0xdf45('0x25')]]={'$like':'%'+_0x584cae['query'][_0xdf45('0x38')]+'%'};return _0x3f64ff;}})});}_0x325d37=_['merge']({},_0x325d37,_0x584cae['options']);var _0x3c084f={'where':_0x325d37[_0xdf45('0x36')]};return db[_0xdf45('0x3b')][_0xdf45('0x1e')](_0x3c084f)[_0xdf45('0x23')](function(_0x4b3718){_0x2b9664['count']=_0x4b3718;if(_0x584cae[_0xdf45('0x2b')]['includeAll']){_0x325d37['include']=[{'all':!![]}];}return db[_0xdf45('0x3b')]['findAll'](_0x325d37);})[_0xdf45('0x23')](function(_0x5d8ebc){_0x2b9664['rows']=_0x5d8ebc;return _0x2b9664;})[_0xdf45('0x23')](respondWithFilteredResult(_0xce5e62,_0x325d37))[_0xdf45('0x3c')](handleError(_0xce5e62,null));};exports[_0xdf45('0x3d')]=function(_0x8fe711,_0x585efc){var _0x2e2dd2={'raw':![],'where':{'id':_0x8fe711[_0xdf45('0x3e')]['id']}},_0x2493ac={};_0x2493ac[_0xdf45('0x2e')]=_['keys'](db['SugarcrmAccount'][_0xdf45('0x27')]);_0x2493ac['query']=_[_0xdf45('0x2a')](_0x8fe711[_0xdf45('0x2b')]);_0x2493ac[_0xdf45('0x2c')]=_[_0xdf45('0x2d')](_0x2493ac[_0xdf45('0x2e')],_0x2493ac[_0xdf45('0x2b')]);_0x2e2dd2[_0xdf45('0x30')]=_[_0xdf45('0x2d')](_0x2493ac['model'],qs['fields'](_0x8fe711[_0xdf45('0x2b')][_0xdf45('0x2f')]));_0x2e2dd2[_0xdf45('0x30')]=_0x2e2dd2['attributes'][_0xdf45('0x31')]?_0x2e2dd2[_0xdf45('0x30')]:_0x2493ac['model'];if(_0x8fe711[_0xdf45('0x2b')][_0xdf45('0x3f')]){_0x2e2dd2['include']=[{'all':!![]}];}_0x2e2dd2=_[_0xdf45('0x39')]({},_0x2e2dd2,_0x8fe711[_0xdf45('0x40')]);return db[_0xdf45('0x3b')][_0xdf45('0x41')](_0x2e2dd2)[_0xdf45('0x23')](handleEntityNotFound(_0x585efc,null))[_0xdf45('0x23')](respondWithResult(_0x585efc,null))['catch'](handleError(_0x585efc,null));};exports[_0xdf45('0x42')]=function(_0x3d4a79,_0x262592){return db[_0xdf45('0x3b')][_0xdf45('0x42')](_0x3d4a79[_0xdf45('0x43')],{})[_0xdf45('0x23')](respondWithResult(_0x262592,0xc9))[_0xdf45('0x3c')](handleError(_0x262592,null));};exports['update']=function(_0xae85db,_0x5495b0){if(_0xae85db[_0xdf45('0x43')]['id']){delete _0xae85db['body']['id'];}return db[_0xdf45('0x3b')][_0xdf45('0x41')]({'where':{'id':_0xae85db['params']['id']}})[_0xdf45('0x23')](handleEntityNotFound(_0x5495b0,null))[_0xdf45('0x23')](saveUpdates(_0xae85db[_0xdf45('0x43')],null))[_0xdf45('0x23')](respondWithResult(_0x5495b0,null))[_0xdf45('0x3c')](handleError(_0x5495b0,null));};exports[_0xdf45('0x22')]=function(_0x34f9cb,_0x59c89e){return db[_0xdf45('0x3b')][_0xdf45('0x41')]({'where':{'id':_0x34f9cb[_0xdf45('0x3e')]['id']}})['then'](handleEntityNotFound(_0x59c89e,null))['then'](removeEntity(_0x59c89e,null))[_0xdf45('0x3c')](handleError(_0x59c89e,null));};exports[_0xdf45('0x44')]=function(_0xd75b54,_0x1a42f8,_0x3f49f3){var _0x39d311={};var _0x2b6ad3={};var _0x1b5052;var _0xa8f1e2;return db[_0xdf45('0x3b')][_0xdf45('0x45')]({'where':{'id':_0xd75b54[_0xdf45('0x3e')]['id']}})[_0xdf45('0x23')](handleEntityNotFound(_0x1a42f8,null))[_0xdf45('0x23')](function(_0x347e7c){if(_0x347e7c){_0x1b5052=_0x347e7c;_0x2b6ad3[_0xdf45('0x2e')]=_[_0xdf45('0x2a')](db[_0xdf45('0x46')][_0xdf45('0x27')]);_0x2b6ad3[_0xdf45('0x2b')]=_[_0xdf45('0x2a')](_0xd75b54[_0xdf45('0x2b')]);_0x2b6ad3[_0xdf45('0x2c')]=_[_0xdf45('0x2d')](_0x2b6ad3['model'],_0x2b6ad3['query']);_0x39d311[_0xdf45('0x30')]=_['intersection'](_0x2b6ad3[_0xdf45('0x2e')],qs['fields'](_0xd75b54['query'][_0xdf45('0x2f')]));_0x39d311[_0xdf45('0x30')]=_0x39d311[_0xdf45('0x30')][_0xdf45('0x31')]?_0x39d311[_0xdf45('0x30')]:_0x2b6ad3[_0xdf45('0x2e')];_0x39d311[_0xdf45('0x34')]=qs['sort'](_0xd75b54[_0xdf45('0x2b')][_0xdf45('0x35')]);_0x39d311[_0xdf45('0x36')]=qs[_0xdf45('0x2c')](_[_0xdf45('0x37')](_0xd75b54[_0xdf45('0x2b')],_0x2b6ad3[_0xdf45('0x2c')]));if(_0xd75b54[_0xdf45('0x2b')]['filter']){_0x39d311[_0xdf45('0x36')]=_[_0xdf45('0x39')](_0x39d311[_0xdf45('0x36')],{'$or':_[_0xdf45('0x29')](_0x39d311['attributes'],function(_0x1080f3){var _0x52b11d={};_0x52b11d[_0x1080f3]={'$like':'%'+_0xd75b54['query'][_0xdf45('0x38')]+'%'};return _0x52b11d;})});}_0x39d311=_[_0xdf45('0x39')]({},_0x39d311,_0xd75b54[_0xdf45('0x40')]);return _0x1b5052[_0xdf45('0x44')](_0x39d311);}})[_0xdf45('0x23')](function(_0x5ad6af){if(_0x5ad6af){_0xa8f1e2=_0x5ad6af[_0xdf45('0x31')];if(!_0xd75b54['query'][_0xdf45('0x32')](_0xdf45('0x47'))){_0x39d311[_0xdf45('0x33')]=qs['limit'](_0xd75b54['query'][_0xdf45('0x33')]);_0x39d311[_0xdf45('0x1d')]=qs[_0xdf45('0x1d')](_0xd75b54[_0xdf45('0x2b')][_0xdf45('0x1d')]);}return _0x1b5052['getConfigurations'](_0x39d311);}})['then'](function(_0x481f18){if(_0x481f18){return _0x481f18?{'count':_0xa8f1e2,'rows':_0x481f18}:null;}})['then'](respondWithResult(_0x1a42f8,null))['catch'](handleError(_0x1a42f8,null));};exports[_0xdf45('0x48')]=function(_0x5ce47a,_0x153643,_0xbda834){if(_0x5ce47a[_0xdf45('0x43')]['id']){delete _0x5ce47a[_0xdf45('0x43')]['id'];}return db[_0xdf45('0x3b')][_0xdf45('0x45')]({'where':{'id':_0x5ce47a['params']['id']}})[_0xdf45('0x23')](handleEntityNotFound(_0x153643,null))[_0xdf45('0x23')](function(_0x479853){if(_0x479853){_0x5ce47a[_0xdf45('0x43')]['AccountId']=_0x479853['id'];_0x5ce47a[_0xdf45('0x43')][_0xdf45('0x49')]=integrations[_0xdf45('0x4a')](_0x5ce47a[_0xdf45('0x43')][_0xdf45('0x4b')],_0x5ce47a[_0xdf45('0x43')][_0xdf45('0x3a')]);_0x5ce47a[_0xdf45('0x43')][_0xdf45('0x4c')]=integrations[_0xdf45('0x4d')](_0x5ce47a['body'][_0xdf45('0x4b')],_0x5ce47a[_0xdf45('0x43')][_0xdf45('0x3a')]);return db[_0xdf45('0x46')][_0xdf45('0x42')](_0x5ce47a['body'],{'include':[{'model':db[_0xdf45('0x4e')],'as':_0xdf45('0x49')},{'model':db[_0xdf45('0x4e')],'as':_0xdf45('0x4c')}]});}return null;})[_0xdf45('0x23')](respondWithResult(_0x153643,null))[_0xdf45('0x3c')](handleError(_0x153643,null));};exports[_0xdf45('0x4f')]=function(_0x2da5c5,_0x1f871a,_0x1ecd1a){var _0x52dd31='';var _0x3c9d7a=['id','name',_0xdf45('0x50'),_0xdf45('0x51'),'description','date_start',_0xdf45('0x52'),'duration_minutes',_0xdf45('0x53'),_0xdf45('0x54'),_0xdf45('0x55'),_0xdf45('0x56')];return db[_0xdf45('0x3b')]['findOne']({'where':{'id':_0x2da5c5[_0xdf45('0x3e')]['id']},'attributes':['id','username','password',_0xdf45('0x57')]})['then'](handleEntityNotFound(_0x1f871a,null))[_0xdf45('0x23')](function(_0xdceb13){if(_0xdceb13){_0x52dd31=_0xdceb13[_0xdf45('0x57')];var _0x37dcc0=_0x52dd31[_0xdf45('0x58')](-0x1);if(_0x37dcc0==='/'){_0x52dd31=_0x52dd31[_0xdf45('0x59')](0x0,_0x52dd31[_0xdf45('0x5a')](_0x37dcc0));}return rp({'method':_0xdf45('0x5b'),'uri':util[_0xdf45('0x5c')](_0xdf45('0x5d'),_0x52dd31,_0xdf45('0x5e')),'json':!![],'form':{'method':_0xdf45('0x5f'),'input_type':_0xdf45('0x60'),'response_type':_0xdf45('0x60'),'rest_data':JSON[_0xdf45('0x61')]({'user_auth':{'user_name':_0xdceb13[_0xdf45('0x62')],'password':_0xdceb13[_0xdf45('0x63')],'encryption':_0xdf45('0x64')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xdf45('0x23')](function(_0x234aed){if(_0x234aed&&_0x234aed[_0xdf45('0x25')]!==_0xdf45('0x65')&&_0x234aed[_0xdf45('0x25')]!==_0xdf45('0x66')){return rp({'method':_0xdf45('0x5b'),'uri':util['format']('%s%s',_0x52dd31,_0xdf45('0x5e')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xdf45('0x60'),'response_type':_0xdf45('0x60'),'rest_data':JSON[_0xdf45('0x61')]({'session':_0x234aed['id'],'module_name':_0xdf45('0x67')})}})[_0xdf45('0x23')](function(_0xff2619){if(_0xff2619){var _0x2a647a=_[_0xdf45('0x68')](_0xff2619[_0xdf45('0x69')]);_[_0xdf45('0x6a')](_0x2a647a,function(_0x1e83a1){return _0x3c9d7a[_0xdf45('0x6b')](_0x1e83a1[_0xdf45('0x25')]);});return{'count':_0x2a647a['length'],'rows':_[_0xdf45('0x29')](_0x2a647a,function(_0x5e19b2){return{'id':_0x5e19b2[_0xdf45('0x25')],'name':_0x5e19b2[_0xdf45('0x6c')],'custom':_['endsWith'](_0x5e19b2[_0xdf45('0x25')],'_c')?!![]:![],'options':_0x5e19b2[_0xdf45('0x40')]?_[_0xdf45('0x29')](_[_0xdf45('0x68')](_0x5e19b2['options']),function(_0x3df38d){return{'name':_0x3df38d['value'],'value':_0x3df38d[_0xdf45('0x25')]};}):[]};})};}})[_0xdf45('0x23')](respondWithResult(_0x1f871a,null))[_0xdf45('0x3c')](function(_0x577e83){var _0x3fd7f4=_0x2da5c5['query'][_0xdf45('0x6d')]?0x1f4:_0x577e83[_0xdf45('0x6e')]||0x1f4;logger['error'](_0xdf45('0x6f'),_0xdf45('0x4f'),_0x3fd7f4,JSON['stringify'](_0x577e83));delete _0x577e83[_0xdf45('0x25')];if(_0x3fd7f4===0x191){_0x3fd7f4=0x190;}_0x1f871a[_0xdf45('0x1a')](_0x3fd7f4)['send'](_0x2da5c5['query'][_0xdf45('0x6d')]?{'message':_0xdf45('0x70'),'statusCode':_0x577e83['statusCode']}:_0x577e83);});}else{var _0x1d1089=0x1f4;_0x1f871a[_0xdf45('0x1a')](_0x1d1089)[_0xdf45('0x71')]({'message':_0xdf45('0x70'),'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 f85f47f..33d95e2 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 _0x7d60=['rimraf','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x999255,_0x426e0b){var _0x192f4e=function(_0xe5ed3e){while(--_0xe5ed3e){_0x999255['push'](_0x999255['shift']());}};_0x192f4e(++_0x426e0b);}(_0x7d60,0xd0));var _0x07d6=function(_0x1c5341,_0x223383){_0x1c5341=_0x1c5341-0x0;var _0x4215c0=_0x7d60[_0x1c5341];return _0x4215c0;};'use strict';var _=require(_0x07d6('0x0'));var util=require(_0x07d6('0x1'));var logger=require(_0x07d6('0x2'))(_0x07d6('0x3'));var moment=require(_0x07d6('0x4'));var BPromise=require(_0x07d6('0x5'));var rp=require(_0x07d6('0x6'));var fs=require('fs');var path=require(_0x07d6('0x7'));var rimraf=require(_0x07d6('0x8'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x07d6('0x9'));module['exports']=function(_0x1d70f9,_0x453256){return _0x1d70f9[_0x07d6('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x07d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x025e=['define','int_sugarcrm_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x025e,0x116));var _0xe025=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x025e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xe025('0x0'));var util=require('util');var logger=require(_0xe025('0x1'))(_0xe025('0x2'));var moment=require('moment');var BPromise=require(_0xe025('0x3'));var rp=require(_0xe025('0x4'));var fs=require('fs');var path=require(_0xe025('0x5'));var rimraf=require(_0xe025('0x6'));var config=require('../../config/environment');var attributes=require(_0xe025('0x7'));var integrations=require(_0xe025('0x8'));module[_0xe025('0x9')]=function(_0x35bc00,_0x4f5d18){return _0x35bc00[_0xe025('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xe025('0xb'),'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 ddf6af2..e47fbed 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 _0xbba5=['include','map','model','GetSugarcrmAccount','find','ShowSugarcrmAccount','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit'];(function(_0x30ce7d,_0x20293f){var _0x48e89c=function(_0xe2ec32){while(--_0xe2ec32){_0x30ce7d['push'](_0x30ce7d['shift']());}};_0x48e89c(++_0x20293f);}(_0xbba5,0x11e));var _0x5bba=function(_0x1eda12,_0x4133e2){_0x1eda12=_0x1eda12-0x0;var _0x324067=_0xbba5[_0x1eda12];return _0x324067;};'use strict';var _=require('lodash');var util=require(_0x5bba('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bba('0x1'));var db=require(_0x5bba('0x2'))['db'];var utils=require(_0x5bba('0x3'));var logger=require(_0x5bba('0x4'))(_0x5bba('0x5'));var config=require(_0x5bba('0x6'));var jayson=require(_0x5bba('0x7'));var client=jayson[_0x5bba('0x8')][_0x5bba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x317e3e,_0x52784e,_0x45fd7){return new BPromise(function(_0x3f2437,_0x31de19){return client[_0x5bba('0xa')](_0x317e3e,_0x45fd7)[_0x5bba('0xb')](function(_0x5066d2){logger[_0x5bba('0xc')](_0x5bba('0xd'),_0x52784e,'request\x20sent');logger[_0x5bba('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x52784e,_0x5bba('0xf'),JSON[_0x5bba('0x10')](_0x5066d2));if(_0x5066d2[_0x5bba('0x11')]){if(_0x5066d2[_0x5bba('0x11')][_0x5bba('0x12')]===0x1f4){logger[_0x5bba('0x11')](_0x5bba('0xd'),_0x52784e,_0x5066d2[_0x5bba('0x11')][_0x5bba('0x13')]);return _0x31de19(_0x5066d2[_0x5bba('0x11')][_0x5bba('0x13')]);}logger[_0x5bba('0x11')](_0x5bba('0xd'),_0x52784e,_0x5066d2[_0x5bba('0x11')]['message']);return _0x3f2437(_0x5066d2[_0x5bba('0x11')][_0x5bba('0x13')]);}else{logger[_0x5bba('0xc')](_0x5bba('0xd'),_0x52784e,_0x5bba('0xf'));_0x3f2437(_0x5066d2[_0x5bba('0x14')][_0x5bba('0x13')]);}})[_0x5bba('0x15')](function(_0x5f0f56){logger['error'](_0x5bba('0xd'),_0x52784e,_0x5f0f56);_0x31de19(_0x5f0f56);});});}exports['GetSugarcrmAccount']=function(_0x199ef2){var _0x24a944=this;return new Promise(function(_0x32064a,_0x5df108){return db[_0x5bba('0x16')][_0x5bba('0x17')]({'raw':_0x199ef2[_0x5bba('0x18')]?_0x199ef2[_0x5bba('0x18')][_0x5bba('0x19')]===undefined?!![]:![]:!![],'where':_0x199ef2[_0x5bba('0x18')]?_0x199ef2[_0x5bba('0x18')][_0x5bba('0x1a')]||null:null,'attributes':_0x199ef2[_0x5bba('0x18')]?_0x199ef2[_0x5bba('0x18')][_0x5bba('0x1b')]||null:null,'limit':_0x199ef2[_0x5bba('0x18')]?_0x199ef2[_0x5bba('0x18')][_0x5bba('0x1c')]||null:null,'include':_0x199ef2[_0x5bba('0x18')]?_0x199ef2['options'][_0x5bba('0x1d')]?_[_0x5bba('0x1e')](_0x199ef2[_0x5bba('0x18')][_0x5bba('0x1d')],function(_0x1e8dc7){return{'model':db[_0x1e8dc7[_0x5bba('0x1f')]],'as':_0x1e8dc7['as'],'attributes':_0x1e8dc7[_0x5bba('0x1b')],'include':_0x1e8dc7[_0x5bba('0x1d')]?_['map'](_0x1e8dc7[_0x5bba('0x1d')],function(_0x16763c){return{'model':db[_0x16763c['model']],'as':_0x16763c['as'],'attributes':_0x16763c[_0x5bba('0x1b')],'include':_0x16763c[_0x5bba('0x1d')]?_[_0x5bba('0x1e')](_0x16763c['include'],function(_0x6112d2){return{'model':db[_0x6112d2[_0x5bba('0x1f')]],'as':_0x6112d2['as'],'attributes':_0x6112d2[_0x5bba('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bb7e7){logger['info'](_0x5bba('0x20'),_0x199ef2);logger[_0x5bba('0xe')](_0x5bba('0x20'),_0x199ef2,JSON['stringify'](_0x3bb7e7));_0x32064a(_0x3bb7e7);})['catch'](function(_0x5da60a){logger[_0x5bba('0x11')](_0x5bba('0x20'),_0x5da60a[_0x5bba('0x13')],_0x199ef2);_0x5df108(_0x24a944[_0x5bba('0x11')](0x1f4,_0x5da60a[_0x5bba('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x528739){var _0x1829a2=this;return new Promise(function(_0x52e9d9,_0x44f0ad){return db[_0x5bba('0x16')][_0x5bba('0x21')]({'raw':_0x528739['options']?_0x528739[_0x5bba('0x18')][_0x5bba('0x19')]===undefined?!![]:![]:!![],'where':_0x528739['options']?_0x528739[_0x5bba('0x18')][_0x5bba('0x1a')]||null:null,'attributes':_0x528739[_0x5bba('0x18')]?_0x528739[_0x5bba('0x18')][_0x5bba('0x1b')]||null:null,'include':_0x528739[_0x5bba('0x18')]?_0x528739['options'][_0x5bba('0x1d')]?_['map'](_0x528739['options'][_0x5bba('0x1d')],function(_0x4aa844){return{'model':db[_0x4aa844[_0x5bba('0x1f')]],'as':_0x4aa844['as'],'attributes':_0x4aa844[_0x5bba('0x1b')],'include':_0x4aa844[_0x5bba('0x1d')]?_[_0x5bba('0x1e')](_0x4aa844[_0x5bba('0x1d')],function(_0x740572){return{'model':db[_0x740572['model']],'as':_0x740572['as'],'attributes':_0x740572['attributes'],'include':_0x740572[_0x5bba('0x1d')]?_[_0x5bba('0x1e')](_0x740572[_0x5bba('0x1d')],function(_0x33d6f5){return{'model':db[_0x33d6f5[_0x5bba('0x1f')]],'as':_0x33d6f5['as'],'attributes':_0x33d6f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bba('0xb')](function(_0x100869){logger[_0x5bba('0xc')](_0x5bba('0x22'),_0x528739);logger[_0x5bba('0xe')]('ShowSugarcrmAccount',_0x528739,JSON[_0x5bba('0x10')](_0x100869));_0x52e9d9(_0x100869);})[_0x5bba('0x15')](function(_0x264e45){logger[_0x5bba('0x11')](_0x5bba('0x22'),_0x264e45[_0x5bba('0x13')],_0x528739);_0x44f0ad(_0x1829a2[_0x5bba('0x11')](0x1f4,_0x264e45[_0x5bba('0x13')]));});});}; \ No newline at end of file +var _0x00bb=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map','model','ShowSugarcrmAccount','raw','lodash','util','randomstring'];(function(_0x523a01,_0x3ba342){var _0xffb25b=function(_0x8fa6fb){while(--_0x8fa6fb){_0x523a01['push'](_0x523a01['shift']());}};_0xffb25b(++_0x3ba342);}(_0x00bb,0x19d));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb00b('0x2'));var fs=require('fs');var Redis=require(_0xb00b('0x3'));var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb00b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb00b('0x7')][_0xb00b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27fa98,_0x9d4031,_0x401089){return new BPromise(function(_0x39cee2,_0x538c2c){return client[_0xb00b('0x9')](_0x27fa98,_0x401089)[_0xb00b('0xa')](function(_0x31b72d){logger[_0xb00b('0xb')](_0xb00b('0xc'),_0x9d4031,'request\x20sent');logger[_0xb00b('0xd')](_0xb00b('0xe'),_0x9d4031,_0xb00b('0xf'),JSON[_0xb00b('0x10')](_0x31b72d));if(_0x31b72d[_0xb00b('0x11')]){if(_0x31b72d[_0xb00b('0x11')]['code']===0x1f4){logger[_0xb00b('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x9d4031,_0x31b72d[_0xb00b('0x11')][_0xb00b('0x12')]);return _0x538c2c(_0x31b72d[_0xb00b('0x11')]['message']);}logger[_0xb00b('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x9d4031,_0x31b72d['error'][_0xb00b('0x12')]);return _0x39cee2(_0x31b72d[_0xb00b('0x11')][_0xb00b('0x12')]);}else{logger[_0xb00b('0xb')](_0xb00b('0xc'),_0x9d4031,_0xb00b('0xf'));_0x39cee2(_0x31b72d[_0xb00b('0x13')][_0xb00b('0x12')]);}})[_0xb00b('0x14')](function(_0x363536){logger[_0xb00b('0x11')](_0xb00b('0xc'),_0x9d4031,_0x363536);_0x538c2c(_0x363536);});});}exports[_0xb00b('0x15')]=function(_0x4b9c9b){var _0x25be44=this;return new Promise(function(_0x4bc055,_0xf6382d){return db[_0xb00b('0x16')][_0xb00b('0x17')]({'raw':_0x4b9c9b[_0xb00b('0x18')]?_0x4b9c9b[_0xb00b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4b9c9b[_0xb00b('0x18')]?_0x4b9c9b[_0xb00b('0x18')][_0xb00b('0x19')]||null:null,'attributes':_0x4b9c9b[_0xb00b('0x18')]?_0x4b9c9b['options'][_0xb00b('0x1a')]||null:null,'limit':_0x4b9c9b[_0xb00b('0x18')]?_0x4b9c9b['options']['limit']||null:null,'include':_0x4b9c9b[_0xb00b('0x18')]?_0x4b9c9b['options'][_0xb00b('0x1b')]?_['map'](_0x4b9c9b[_0xb00b('0x18')][_0xb00b('0x1b')],function(_0x52a7f6){return{'model':db[_0x52a7f6['model']],'as':_0x52a7f6['as'],'attributes':_0x52a7f6[_0xb00b('0x1a')],'include':_0x52a7f6[_0xb00b('0x1b')]?_[_0xb00b('0x1c')](_0x52a7f6[_0xb00b('0x1b')],function(_0xb5ddaf){return{'model':db[_0xb5ddaf[_0xb00b('0x1d')]],'as':_0xb5ddaf['as'],'attributes':_0xb5ddaf[_0xb00b('0x1a')],'include':_0xb5ddaf['include']?_[_0xb00b('0x1c')](_0xb5ddaf[_0xb00b('0x1b')],function(_0x4b0e70){return{'model':db[_0x4b0e70['model']],'as':_0x4b0e70['as'],'attributes':_0x4b0e70[_0xb00b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb00b('0xa')](function(_0x1e4fd8){logger[_0xb00b('0xb')](_0xb00b('0x15'),_0x4b9c9b);logger[_0xb00b('0xd')](_0xb00b('0x15'),_0x4b9c9b,JSON[_0xb00b('0x10')](_0x1e4fd8));_0x4bc055(_0x1e4fd8);})['catch'](function(_0x55e45e){logger['error'](_0xb00b('0x15'),_0x55e45e['message'],_0x4b9c9b);_0xf6382d(_0x25be44[_0xb00b('0x11')](0x1f4,_0x55e45e[_0xb00b('0x12')]));});});};exports[_0xb00b('0x1e')]=function(_0x576f86){var _0x541701=this;return new Promise(function(_0x39f5dc,_0xed6646){return db[_0xb00b('0x16')]['find']({'raw':_0x576f86[_0xb00b('0x18')]?_0x576f86[_0xb00b('0x18')][_0xb00b('0x1f')]===undefined?!![]:![]:!![],'where':_0x576f86[_0xb00b('0x18')]?_0x576f86[_0xb00b('0x18')]['where']||null:null,'attributes':_0x576f86[_0xb00b('0x18')]?_0x576f86[_0xb00b('0x18')][_0xb00b('0x1a')]||null:null,'include':_0x576f86[_0xb00b('0x18')]?_0x576f86[_0xb00b('0x18')][_0xb00b('0x1b')]?_['map'](_0x576f86[_0xb00b('0x18')][_0xb00b('0x1b')],function(_0x44188a){return{'model':db[_0x44188a['model']],'as':_0x44188a['as'],'attributes':_0x44188a[_0xb00b('0x1a')],'include':_0x44188a['include']?_[_0xb00b('0x1c')](_0x44188a[_0xb00b('0x1b')],function(_0x4287e4){return{'model':db[_0x4287e4[_0xb00b('0x1d')]],'as':_0x4287e4['as'],'attributes':_0x4287e4[_0xb00b('0x1a')],'include':_0x4287e4[_0xb00b('0x1b')]?_[_0xb00b('0x1c')](_0x4287e4['include'],function(_0x2c214b){return{'model':db[_0x2c214b[_0xb00b('0x1d')]],'as':_0x2c214b['as'],'attributes':_0x2c214b[_0xb00b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb00b('0xa')](function(_0x5cfd07){logger[_0xb00b('0xb')](_0xb00b('0x1e'),_0x576f86);logger[_0xb00b('0xd')](_0xb00b('0x1e'),_0x576f86,JSON['stringify'](_0x5cfd07));_0x39f5dc(_0x5cfd07);})[_0xb00b('0x14')](function(_0x39498a){logger[_0xb00b('0x11')](_0xb00b('0x1e'),_0x39498a[_0xb00b('0x12')],_0x576f86);_0xed6646(_0x541701['error'](0x1f4,_0x39498a['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3fb6993..9c98de8 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 _0xeea1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x9de82c,_0x573e29){var _0x4431e3=function(_0x55ec6f){while(--_0x55ec6f){_0x9de82c['push'](_0x9de82c['shift']());}};_0x4431e3(++_0x573e29);}(_0xeea1,0x1c7));var _0x1eea=function(_0x559fa6,_0x58609d){_0x559fa6=_0x559fa6-0x0;var _0x815bc6=_0xeea1[_0x559fa6];return _0x815bc6;};'use strict';var multer=require(_0x1eea('0x0'));var util=require(_0x1eea('0x1'));var path=require(_0x1eea('0x2'));var timeout=require(_0x1eea('0x3'));var express=require(_0x1eea('0x4'));var router=express[_0x1eea('0x5')]();var fs_extra=require(_0x1eea('0x6'));var auth=require(_0x1eea('0x7'));var interaction=require(_0x1eea('0x8'));var config=require('../../config/environment');var controller=require(_0x1eea('0x9'));router[_0x1eea('0xa')]('/',auth[_0x1eea('0xb')](),controller[_0x1eea('0xc')]);router['get'](_0x1eea('0xd'),auth[_0x1eea('0xb')](),controller[_0x1eea('0xe')]);router[_0x1eea('0xa')](_0x1eea('0xf'),auth[_0x1eea('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x1eea('0xb')](),controller[_0x1eea('0x10')]);router['get'](_0x1eea('0x11'),auth[_0x1eea('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0x1eea('0xb')](),controller[_0x1eea('0x12')]);router[_0x1eea('0x13')](_0x1eea('0xd'),auth[_0x1eea('0xb')](),controller['update']);router[_0x1eea('0x14')]('/:id',auth[_0x1eea('0xb')](),controller[_0x1eea('0x15')]);module[_0x1eea('0x16')]=router; \ No newline at end of file +var _0x2863=['/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x2863,0xdb));var _0x3286=function(_0x984eb0,_0x1fce43){_0x984eb0=_0x984eb0-0x0;var _0x3469a7=_0x2863[_0x984eb0];return _0x3469a7;};'use strict';var multer=require('multer');var util=require(_0x3286('0x0'));var path=require(_0x3286('0x1'));var timeout=require(_0x3286('0x2'));var express=require('express');var router=express[_0x3286('0x3')]();var fs_extra=require(_0x3286('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3286('0x5'));var config=require(_0x3286('0x6'));var controller=require(_0x3286('0x7'));router[_0x3286('0x8')]('/',auth[_0x3286('0x9')](),controller[_0x3286('0xa')]);router['get'](_0x3286('0xb'),auth[_0x3286('0x9')](),controller[_0x3286('0xc')]);router[_0x3286('0x8')](_0x3286('0xd'),auth[_0x3286('0x9')](),controller[_0x3286('0xe')]);router['get']('/:id/subjects',auth[_0x3286('0x9')](),controller['getSubjects']);router[_0x3286('0x8')](_0x3286('0xf'),auth[_0x3286('0x9')](),controller[_0x3286('0x10')]);router[_0x3286('0x11')]('/',auth['isAuthenticated'](),controller[_0x3286('0x12')]);router['put']('/:id',auth[_0x3286('0x9')](),controller[_0x3286('0x13')]);router[_0x3286('0x14')](_0x3286('0xb'),auth[_0x3286('0x9')](),controller[_0x3286('0x15')]);module[_0x3286('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 77a73c8..21cb4ce 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 _0x97bd=['exports','STRING','sequelize'];(function(_0x5927a2,_0xd41f21){var _0x242579=function(_0x38aad3){while(--_0x38aad3){_0x5927a2['push'](_0x5927a2['shift']());}};_0x242579(++_0xd41f21);}(_0x97bd,0x194));var _0xd97b=function(_0x119f18,_0x32f881){_0x119f18=_0x119f18-0x0;var _0x1eb51d=_0x97bd[_0x119f18];return _0x1eb51d;};'use strict';var Sequelize=require(_0xd97b('0x0'));module[_0xd97b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd97b('0x2')]}}; \ No newline at end of file +var _0x80f0=['exports','STRING','sequelize'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x80f0,0x7a));var _0x080f=function(_0xd667f2,_0x58aa57){_0xd667f2=_0xd667f2-0x0;var _0x164885=_0x80f0[_0xd667f2];return _0x164885;};'use strict';var Sequelize=require(_0x080f('0x0'));module[_0x080f('0x1')]={'name':{'type':Sequelize[_0x080f('0x2')]},'description':{'type':Sequelize[_0x080f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 0a0ed31..b835742 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 _0x2603=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','catch','body','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','rimraf','zip-dir','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x23c03c,_0x249733){var _0x1a8c79=function(_0x5cb43c){while(--_0x5cb43c){_0x23c03c['push'](_0x23c03c['shift']());}};_0x1a8c79(++_0x249733);}(_0x2603,0x82));var _0x3260=function(_0x1ddd0,_0x15f9f4){_0x1ddd0=_0x1ddd0-0x0;var _0x4d86d0=_0x2603[_0x1ddd0];return _0x4d86d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3260('0x0'));var zipdir=require(_0x3260('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3260('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3260('0x3'));var sox=require(_0x3260('0x4'));var csv=require('to-csv');var ejs=require(_0x3260('0x5'));var fs=require('fs');var fs_extra=require(_0x3260('0x6'));var _=require(_0x3260('0x7'));var squel=require('squel');var crypto=require(_0x3260('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3260('0x9'));var toCsv=require('to-csv');var querystring=require(_0x3260('0xa'));var Papa=require(_0x3260('0xb'));var Redis=require(_0x3260('0xc'));var authService=require(_0x3260('0xd'));var qs=require(_0x3260('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3260('0xf'));var logger=require(_0x3260('0x10'))('api');var utils=require(_0x3260('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x3260('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53520d,_0x404ac4){_0x404ac4=_0x404ac4||0xcc;return function(_0x2592e0){if(_0x2592e0){return _0x53520d[_0x3260('0x13')](_0x404ac4);}return _0x53520d[_0x3260('0x14')](_0x404ac4)[_0x3260('0x15')]();};}function respondWithResult(_0x26ab2b,_0x2b6e14){_0x2b6e14=_0x2b6e14||0xc8;return function(_0xf4d388){if(_0xf4d388){return _0x26ab2b[_0x3260('0x14')](_0x2b6e14)[_0x3260('0x16')](_0xf4d388);}};}function respondWithFilteredResult(_0x3b0a0f,_0x3ce455){return function(_0x1d163d){if(_0x1d163d){var _0x21830b=typeof _0x3ce455[_0x3260('0x17')]===_0x3260('0x18')&&typeof _0x3ce455[_0x3260('0x19')]==='undefined';var _0x319f26=_0x1d163d[_0x3260('0x1a')];var _0x54f56c=_0x21830b?0x0:_0x3ce455[_0x3260('0x17')];var _0x4700dc=_0x21830b?_0x1d163d[_0x3260('0x1a')]:_0x3ce455[_0x3260('0x17')]+_0x3ce455['limit'];var _0x8e22be;if(_0x4700dc>=_0x319f26){_0x4700dc=_0x319f26;_0x8e22be=0xc8;}else{_0x8e22be=0xce;}_0x3b0a0f[_0x3260('0x14')](_0x8e22be);return _0x3b0a0f[_0x3260('0x1b')](_0x3260('0x1c'),_0x54f56c+'-'+_0x4700dc+'/'+_0x319f26)['json'](_0x1d163d);}return null;};}function patchUpdates(_0x4e4ef3){return function(_0x2b23bf){try{jsonpatch[_0x3260('0x1d')](_0x2b23bf,_0x4e4ef3,!![]);}catch(_0x409ce1){return BPromise['reject'](_0x409ce1);}return _0x2b23bf[_0x3260('0x1e')]();};}function saveUpdates(_0x194153,_0x2ca8f9){return function(_0x224644){if(_0x224644){return _0x224644[_0x3260('0x1f')](_0x194153)[_0x3260('0x20')](function(_0x29914c){return _0x29914c;});}return null;};}function removeEntity(_0x3ae31b,_0xb32a74){return function(_0x4ea158){if(_0x4ea158){return _0x4ea158[_0x3260('0x21')]()[_0x3260('0x20')](function(){_0x3ae31b[_0x3260('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c4ea,_0xbd9b07){return function(_0x106984){if(!_0x106984){_0x27c4ea[_0x3260('0x13')](0x194);}return _0x106984;};}function handleError(_0x47ecf2,_0x589ba5){_0x589ba5=_0x589ba5||0x1f4;return function(_0x39cb31){logger[_0x3260('0x22')](_0x39cb31[_0x3260('0x23')]);if(_0x39cb31[_0x3260('0x24')]){delete _0x39cb31[_0x3260('0x24')];}_0x47ecf2[_0x3260('0x14')](_0x589ba5)[_0x3260('0x25')](_0x39cb31);};}exports[_0x3260('0x26')]=function(_0x5a8831,_0x36d87f){var _0x2b382b={},_0x4e36fc={},_0x55817f={'count':0x0,'rows':[]};var _0x47b1ed=_[_0x3260('0x27')](db[_0x3260('0x28')][_0x3260('0x29')],function(_0x2325a9){return{'name':_0x2325a9[_0x3260('0x2a')],'type':_0x2325a9[_0x3260('0x2b')][_0x3260('0x2c')]};});_0x4e36fc[_0x3260('0x2d')]=_[_0x3260('0x27')](_0x47b1ed,_0x3260('0x24'));_0x4e36fc['query']=_[_0x3260('0x2e')](_0x5a8831[_0x3260('0x2f')]);_0x4e36fc[_0x3260('0x30')]=_[_0x3260('0x31')](_0x4e36fc[_0x3260('0x2d')],_0x4e36fc[_0x3260('0x2f')]);_0x2b382b[_0x3260('0x32')]=_[_0x3260('0x31')](_0x4e36fc[_0x3260('0x2d')],qs[_0x3260('0x33')](_0x5a8831['query'][_0x3260('0x33')]));_0x2b382b['attributes']=_0x2b382b[_0x3260('0x32')][_0x3260('0x34')]?_0x2b382b[_0x3260('0x32')]:_0x4e36fc[_0x3260('0x2d')];if(!_0x5a8831[_0x3260('0x2f')][_0x3260('0x35')](_0x3260('0x36'))){_0x2b382b['limit']=qs[_0x3260('0x19')](_0x5a8831[_0x3260('0x2f')][_0x3260('0x19')]);_0x2b382b[_0x3260('0x17')]=qs['offset'](_0x5a8831[_0x3260('0x2f')][_0x3260('0x17')]);}_0x2b382b['order']=qs['sort'](_0x5a8831[_0x3260('0x2f')][_0x3260('0x37')]);_0x2b382b[_0x3260('0x38')]=qs[_0x3260('0x30')](_[_0x3260('0x39')](_0x5a8831[_0x3260('0x2f')],_0x4e36fc[_0x3260('0x30')]),_0x47b1ed);if(_0x5a8831[_0x3260('0x2f')][_0x3260('0x3a')]){_0x2b382b['where']=_['merge'](_0x2b382b[_0x3260('0x38')],{'$or':_[_0x3260('0x27')](_0x47b1ed,function(_0x13d5b3){if(_0x13d5b3[_0x3260('0x2b')]!==_0x3260('0x3b')){var _0x5b86d7={};_0x5b86d7[_0x13d5b3['name']]={'$like':'%'+_0x5a8831[_0x3260('0x2f')][_0x3260('0x3a')]+'%'};return _0x5b86d7;}})});}_0x2b382b=_[_0x3260('0x3c')]({},_0x2b382b,_0x5a8831[_0x3260('0x3d')]);var _0x3096b4={'where':_0x2b382b[_0x3260('0x38')]};return db[_0x3260('0x28')][_0x3260('0x1a')](_0x3096b4)[_0x3260('0x20')](function(_0x5952b1){_0x55817f[_0x3260('0x1a')]=_0x5952b1;if(_0x5a8831[_0x3260('0x2f')]['includeAll']){_0x2b382b[_0x3260('0x3e')]=[{'all':!![]}];}return db[_0x3260('0x28')][_0x3260('0x3f')](_0x2b382b);})[_0x3260('0x20')](function(_0x4f58c6){_0x55817f[_0x3260('0x40')]=_0x4f58c6;return _0x55817f;})[_0x3260('0x20')](respondWithFilteredResult(_0x36d87f,_0x2b382b))['catch'](handleError(_0x36d87f,null));};exports[_0x3260('0x41')]=function(_0x426a76,_0x5d5802){var _0x40545f={'raw':![],'where':{'id':_0x426a76[_0x3260('0x42')]['id']}},_0x5b20a8={};_0x5b20a8[_0x3260('0x2d')]=_[_0x3260('0x2e')](db['SugarcrmConfiguration'][_0x3260('0x29')]);_0x5b20a8[_0x3260('0x2f')]=_['keys'](_0x426a76[_0x3260('0x2f')]);_0x5b20a8[_0x3260('0x30')]=_['intersection'](_0x5b20a8[_0x3260('0x2d')],_0x5b20a8[_0x3260('0x2f')]);_0x40545f[_0x3260('0x32')]=_[_0x3260('0x31')](_0x5b20a8[_0x3260('0x2d')],qs[_0x3260('0x33')](_0x426a76['query'][_0x3260('0x33')]));_0x40545f[_0x3260('0x32')]=_0x40545f[_0x3260('0x32')][_0x3260('0x34')]?_0x40545f['attributes']:_0x5b20a8[_0x3260('0x2d')];if(_0x426a76['query'][_0x3260('0x43')]){_0x40545f[_0x3260('0x3e')]=[{'all':!![]}];}_0x40545f=_[_0x3260('0x3c')]({},_0x40545f,_0x426a76[_0x3260('0x3d')]);return db[_0x3260('0x28')][_0x3260('0x44')](_0x40545f)[_0x3260('0x20')](handleEntityNotFound(_0x5d5802,null))[_0x3260('0x20')](respondWithResult(_0x5d5802,null))[_0x3260('0x45')](handleError(_0x5d5802,null));};exports['create']=function(_0x3db614,_0x27dc51){return db['SugarcrmConfiguration']['create'](_0x3db614[_0x3260('0x46')],{})[_0x3260('0x20')](respondWithResult(_0x27dc51,0xc9))[_0x3260('0x45')](handleError(_0x27dc51,null));};exports['update']=function(_0x1fa532,_0x30c168){if(_0x1fa532[_0x3260('0x46')]['id']){delete _0x1fa532[_0x3260('0x46')]['id'];}return db[_0x3260('0x28')][_0x3260('0x44')]({'where':{'id':_0x1fa532[_0x3260('0x42')]['id']}})[_0x3260('0x20')](handleEntityNotFound(_0x30c168,null))[_0x3260('0x20')](saveUpdates(_0x1fa532[_0x3260('0x46')],null))['then'](respondWithResult(_0x30c168,null))[_0x3260('0x45')](handleError(_0x30c168,null));};exports[_0x3260('0x21')]=function(_0x46ec84,_0xdf3761){return db[_0x3260('0x28')]['find']({'where':{'id':_0x46ec84[_0x3260('0x42')]['id']}})['then'](handleEntityNotFound(_0xdf3761,null))[_0x3260('0x20')](removeEntity(_0xdf3761,null))[_0x3260('0x45')](handleError(_0xdf3761,null));};exports[_0x3260('0x47')]=function(_0x3c6eaf,_0x10af52,_0x874752){var _0x443bfa={};var _0x1dacc2={};var _0x2b4804;var _0x10e69a;return db[_0x3260('0x28')][_0x3260('0x48')]({'where':{'id':_0x3c6eaf[_0x3260('0x42')]['id']}})['then'](handleEntityNotFound(_0x10af52,null))[_0x3260('0x20')](function(_0x22fbfe){if(_0x22fbfe){_0x2b4804=_0x22fbfe;_0x1dacc2['model']=_[_0x3260('0x2e')](db[_0x3260('0x49')][_0x3260('0x29')]);_0x1dacc2[_0x3260('0x2f')]=_[_0x3260('0x2e')](_0x3c6eaf[_0x3260('0x2f')]);_0x1dacc2[_0x3260('0x30')]=_[_0x3260('0x31')](_0x1dacc2[_0x3260('0x2d')],_0x1dacc2[_0x3260('0x2f')]);_0x443bfa[_0x3260('0x32')]=_[_0x3260('0x31')](_0x1dacc2['model'],qs['fields'](_0x3c6eaf[_0x3260('0x2f')][_0x3260('0x33')]));_0x443bfa[_0x3260('0x32')]=_0x443bfa[_0x3260('0x32')][_0x3260('0x34')]?_0x443bfa[_0x3260('0x32')]:_0x1dacc2['model'];_0x443bfa[_0x3260('0x4a')]=qs[_0x3260('0x37')](_0x3c6eaf[_0x3260('0x2f')]['sort']);_0x443bfa[_0x3260('0x38')]=qs[_0x3260('0x30')](_['pick'](_0x3c6eaf[_0x3260('0x2f')],_0x1dacc2['filters']));if(_0x3c6eaf['query'][_0x3260('0x3a')]){_0x443bfa[_0x3260('0x38')]=_[_0x3260('0x3c')](_0x443bfa[_0x3260('0x38')],{'$or':_[_0x3260('0x27')](_0x443bfa[_0x3260('0x32')],function(_0xa3d38e){var _0x3d1ae9={};_0x3d1ae9[_0xa3d38e]={'$like':'%'+_0x3c6eaf[_0x3260('0x2f')]['filter']+'%'};return _0x3d1ae9;})});}_0x443bfa=_[_0x3260('0x3c')]({},_0x443bfa,_0x3c6eaf[_0x3260('0x3d')]);return _0x2b4804[_0x3260('0x47')](_0x443bfa);}})['then'](function(_0x1400d1){if(_0x1400d1){_0x10e69a=_0x1400d1[_0x3260('0x34')];if(!_0x3c6eaf[_0x3260('0x2f')][_0x3260('0x35')](_0x3260('0x36'))){_0x443bfa[_0x3260('0x19')]=qs[_0x3260('0x19')](_0x3c6eaf['query'][_0x3260('0x19')]);_0x443bfa['offset']=qs[_0x3260('0x17')](_0x3c6eaf[_0x3260('0x2f')][_0x3260('0x17')]);}return _0x2b4804[_0x3260('0x47')](_0x443bfa);}})[_0x3260('0x20')](function(_0x5145db){if(_0x5145db){return _0x5145db?{'count':_0x10e69a,'rows':_0x5145db}:null;}})['then'](respondWithResult(_0x10af52,null))[_0x3260('0x45')](handleError(_0x10af52,null));};exports['getSubjects']=function(_0x51776f,_0x5e0ac6,_0x54f7b0){var _0xcb45e9={};var _0x4851c2={};var _0x2994fb;var _0x2bc330;return db[_0x3260('0x28')]['findOne']({'where':{'id':_0x51776f['params']['id']}})['then'](handleEntityNotFound(_0x5e0ac6,null))[_0x3260('0x20')](function(_0xc81b04){if(_0xc81b04){_0x2994fb=_0xc81b04;_0x4851c2[_0x3260('0x2d')]=_[_0x3260('0x2e')](db[_0x3260('0x49')][_0x3260('0x29')]);_0x4851c2[_0x3260('0x2f')]=_[_0x3260('0x2e')](_0x51776f[_0x3260('0x2f')]);_0x4851c2['filters']=_[_0x3260('0x31')](_0x4851c2[_0x3260('0x2d')],_0x4851c2[_0x3260('0x2f')]);_0xcb45e9[_0x3260('0x32')]=_[_0x3260('0x31')](_0x4851c2['model'],qs[_0x3260('0x33')](_0x51776f[_0x3260('0x2f')][_0x3260('0x33')]));_0xcb45e9[_0x3260('0x32')]=_0xcb45e9[_0x3260('0x32')][_0x3260('0x34')]?_0xcb45e9[_0x3260('0x32')]:_0x4851c2['model'];_0xcb45e9[_0x3260('0x4a')]=qs['sort'](_0x51776f[_0x3260('0x2f')][_0x3260('0x37')]);_0xcb45e9[_0x3260('0x38')]=qs[_0x3260('0x30')](_[_0x3260('0x39')](_0x51776f[_0x3260('0x2f')],_0x4851c2[_0x3260('0x30')]));if(_0x51776f['query'][_0x3260('0x3a')]){_0xcb45e9[_0x3260('0x38')]=_[_0x3260('0x3c')](_0xcb45e9[_0x3260('0x38')],{'$or':_[_0x3260('0x27')](_0xcb45e9['attributes'],function(_0x37f081){var _0x348f41={};_0x348f41[_0x37f081]={'$like':'%'+_0x51776f[_0x3260('0x2f')][_0x3260('0x3a')]+'%'};return _0x348f41;})});}_0xcb45e9=_['merge']({},_0xcb45e9,_0x51776f[_0x3260('0x3d')]);return _0x2994fb[_0x3260('0x4b')](_0xcb45e9);}})['then'](function(_0x24b796){if(_0x24b796){_0x2bc330=_0x24b796[_0x3260('0x34')];if(!_0x51776f['query'][_0x3260('0x35')]('nolimit')){_0xcb45e9[_0x3260('0x19')]=qs['limit'](_0x51776f[_0x3260('0x2f')]['limit']);_0xcb45e9[_0x3260('0x17')]=qs['offset'](_0x51776f['query'][_0x3260('0x17')]);}return _0x2994fb[_0x3260('0x4b')](_0xcb45e9);}})[_0x3260('0x20')](function(_0xf8e723){if(_0xf8e723){return _0xf8e723?{'count':_0x2bc330,'rows':_0xf8e723}:null;}})[_0x3260('0x20')](respondWithResult(_0x5e0ac6,null))[_0x3260('0x45')](handleError(_0x5e0ac6,null));};exports[_0x3260('0x4c')]=function(_0x35eba6,_0x14c317,_0x2656ed){var _0xeb298e={};var _0x21fc44={};var _0x1ad586;var _0x43cb20;return db[_0x3260('0x28')]['findOne']({'where':{'id':_0x35eba6['params']['id']}})[_0x3260('0x20')](handleEntityNotFound(_0x14c317,null))[_0x3260('0x20')](function(_0x65da0e){if(_0x65da0e){_0x1ad586=_0x65da0e;_0x21fc44[_0x3260('0x2d')]=_[_0x3260('0x2e')](db[_0x3260('0x49')]['rawAttributes']);_0x21fc44['query']=_[_0x3260('0x2e')](_0x35eba6['query']);_0x21fc44['filters']=_[_0x3260('0x31')](_0x21fc44[_0x3260('0x2d')],_0x21fc44['query']);_0xeb298e[_0x3260('0x32')]=_[_0x3260('0x31')](_0x21fc44['model'],qs[_0x3260('0x33')](_0x35eba6[_0x3260('0x2f')][_0x3260('0x33')]));_0xeb298e[_0x3260('0x32')]=_0xeb298e['attributes'][_0x3260('0x34')]?_0xeb298e[_0x3260('0x32')]:_0x21fc44['model'];_0xeb298e[_0x3260('0x4a')]=qs[_0x3260('0x37')](_0x35eba6[_0x3260('0x2f')]['sort']);_0xeb298e['where']=qs[_0x3260('0x30')](_[_0x3260('0x39')](_0x35eba6[_0x3260('0x2f')],_0x21fc44[_0x3260('0x30')]));if(_0x35eba6['query'][_0x3260('0x3a')]){_0xeb298e[_0x3260('0x38')]=_[_0x3260('0x3c')](_0xeb298e[_0x3260('0x38')],{'$or':_[_0x3260('0x27')](_0xeb298e[_0x3260('0x32')],function(_0xdec799){var _0x15c8a8={};_0x15c8a8[_0xdec799]={'$like':'%'+_0x35eba6[_0x3260('0x2f')][_0x3260('0x3a')]+'%'};return _0x15c8a8;})});}_0xeb298e=_[_0x3260('0x3c')]({},_0xeb298e,_0x35eba6['options']);return _0x1ad586['getDescriptions'](_0xeb298e);}})[_0x3260('0x20')](function(_0x2ed8fd){if(_0x2ed8fd){_0x43cb20=_0x2ed8fd[_0x3260('0x34')];if(!_0x35eba6['query'][_0x3260('0x35')]('nolimit')){_0xeb298e[_0x3260('0x19')]=qs[_0x3260('0x19')](_0x35eba6[_0x3260('0x2f')][_0x3260('0x19')]);_0xeb298e[_0x3260('0x17')]=qs[_0x3260('0x17')](_0x35eba6['query'][_0x3260('0x17')]);}return _0x1ad586[_0x3260('0x4c')](_0xeb298e);}})['then'](function(_0x2f3d59){if(_0x2f3d59){return _0x2f3d59?{'count':_0x43cb20,'rows':_0x2f3d59}:null;}})[_0x3260('0x20')](respondWithResult(_0x14c317,null))['catch'](handleError(_0x14c317,null));}; \ No newline at end of file +var _0x3cc9=['merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','findOne','SugarcrmField','order','sort','filter','options','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick'];(function(_0x4c3feb,_0x28166b){var _0x53ea2c=function(_0x5f2c08){while(--_0x5f2c08){_0x4c3feb['push'](_0x4c3feb['shift']());}};_0x53ea2c(++_0x28166b);}(_0x3cc9,0xb1));var _0x93cc=function(_0x3ea2ca,_0x1eb0d5){_0x3ea2ca=_0x3ea2ca-0x0;var _0x1efe01=_0x3cc9[_0x3ea2ca];return _0x1efe01;};'use strict';var emlformat=require(_0x93cc('0x0'));var rimraf=require(_0x93cc('0x1'));var zipdir=require(_0x93cc('0x2'));var jsonpatch=require(_0x93cc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x93cc('0x4'));var Mustache=require(_0x93cc('0x5'));var util=require(_0x93cc('0x6'));var path=require(_0x93cc('0x7'));var sox=require(_0x93cc('0x8'));var csv=require(_0x93cc('0x9'));var ejs=require(_0x93cc('0xa'));var fs=require('fs');var fs_extra=require(_0x93cc('0xb'));var _=require(_0x93cc('0xc'));var squel=require('squel');var crypto=require(_0x93cc('0xd'));var jsforce=require(_0x93cc('0xe'));var deskjs=require(_0x93cc('0xf'));var toCsv=require(_0x93cc('0x9'));var querystring=require(_0x93cc('0x10'));var Papa=require('papaparse');var Redis=require(_0x93cc('0x11'));var authService=require(_0x93cc('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93cc('0x13'));var logger=require(_0x93cc('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x93cc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55abac,_0x5301e6){_0x5301e6=_0x5301e6||0xcc;return function(_0x1463d5){if(_0x1463d5){return _0x55abac[_0x93cc('0x16')](_0x5301e6);}return _0x55abac['status'](_0x5301e6)[_0x93cc('0x17')]();};}function respondWithResult(_0x3f2d0a,_0x24c149){_0x24c149=_0x24c149||0xc8;return function(_0x39e95a){if(_0x39e95a){return _0x3f2d0a[_0x93cc('0x18')](_0x24c149)[_0x93cc('0x19')](_0x39e95a);}};}function respondWithFilteredResult(_0x16203a,_0x435ead){return function(_0x37e151){if(_0x37e151){var _0x213ffd=typeof _0x435ead[_0x93cc('0x1a')]===_0x93cc('0x1b')&&typeof _0x435ead[_0x93cc('0x1c')]==='undefined';var _0x4c590f=_0x37e151[_0x93cc('0x1d')];var _0x1f4ce7=_0x213ffd?0x0:_0x435ead['offset'];var _0x41eac7=_0x213ffd?_0x37e151[_0x93cc('0x1d')]:_0x435ead[_0x93cc('0x1a')]+_0x435ead[_0x93cc('0x1c')];var _0x4673ac;if(_0x41eac7>=_0x4c590f){_0x41eac7=_0x4c590f;_0x4673ac=0xc8;}else{_0x4673ac=0xce;}_0x16203a[_0x93cc('0x18')](_0x4673ac);return _0x16203a[_0x93cc('0x1e')]('Content-Range',_0x1f4ce7+'-'+_0x41eac7+'/'+_0x4c590f)[_0x93cc('0x19')](_0x37e151);}return null;};}function patchUpdates(_0x50cacd){return function(_0x2e8e80){try{jsonpatch[_0x93cc('0x1f')](_0x2e8e80,_0x50cacd,!![]);}catch(_0x3722f5){return BPromise['reject'](_0x3722f5);}return _0x2e8e80[_0x93cc('0x20')]();};}function saveUpdates(_0x2ec29b,_0x46cb68){return function(_0x48b121){if(_0x48b121){return _0x48b121['update'](_0x2ec29b)[_0x93cc('0x21')](function(_0x3b496c){return _0x3b496c;});}return null;};}function removeEntity(_0x5430d8,_0x2220f3){return function(_0x2a40bc){if(_0x2a40bc){return _0x2a40bc[_0x93cc('0x22')]()[_0x93cc('0x21')](function(){_0x5430d8[_0x93cc('0x18')](0xcc)[_0x93cc('0x17')]();});}};}function handleEntityNotFound(_0x5d8ede,_0x26649d){return function(_0x1fe4ca){if(!_0x1fe4ca){_0x5d8ede[_0x93cc('0x16')](0x194);}return _0x1fe4ca;};}function handleError(_0x3cdf02,_0x3be944){_0x3be944=_0x3be944||0x1f4;return function(_0x151d27){logger[_0x93cc('0x23')](_0x151d27[_0x93cc('0x24')]);if(_0x151d27[_0x93cc('0x25')]){delete _0x151d27[_0x93cc('0x25')];}_0x3cdf02[_0x93cc('0x18')](_0x3be944)['send'](_0x151d27);};}exports[_0x93cc('0x26')]=function(_0x1a55c9,_0x29ad3d){var _0x3a99d1={},_0x2e773c={},_0x30f865={'count':0x0,'rows':[]};var _0x3d5c4c=_[_0x93cc('0x27')](db[_0x93cc('0x28')][_0x93cc('0x29')],function(_0x12da6a){return{'name':_0x12da6a['fieldName'],'type':_0x12da6a['type'][_0x93cc('0x2a')]};});_0x2e773c[_0x93cc('0x2b')]=_['map'](_0x3d5c4c,'name');_0x2e773c[_0x93cc('0x2c')]=_[_0x93cc('0x2d')](_0x1a55c9['query']);_0x2e773c[_0x93cc('0x2e')]=_[_0x93cc('0x2f')](_0x2e773c[_0x93cc('0x2b')],_0x2e773c[_0x93cc('0x2c')]);_0x3a99d1['attributes']=_[_0x93cc('0x2f')](_0x2e773c[_0x93cc('0x2b')],qs['fields'](_0x1a55c9['query'][_0x93cc('0x30')]));_0x3a99d1[_0x93cc('0x31')]=_0x3a99d1['attributes'][_0x93cc('0x32')]?_0x3a99d1[_0x93cc('0x31')]:_0x2e773c[_0x93cc('0x2b')];if(!_0x1a55c9[_0x93cc('0x2c')][_0x93cc('0x33')]('nolimit')){_0x3a99d1[_0x93cc('0x1c')]=qs['limit'](_0x1a55c9[_0x93cc('0x2c')][_0x93cc('0x1c')]);_0x3a99d1[_0x93cc('0x1a')]=qs['offset'](_0x1a55c9['query'][_0x93cc('0x1a')]);}_0x3a99d1['order']=qs['sort'](_0x1a55c9[_0x93cc('0x2c')]['sort']);_0x3a99d1[_0x93cc('0x34')]=qs['filters'](_[_0x93cc('0x35')](_0x1a55c9[_0x93cc('0x2c')],_0x2e773c['filters']),_0x3d5c4c);if(_0x1a55c9[_0x93cc('0x2c')]['filter']){_0x3a99d1['where']=_[_0x93cc('0x36')](_0x3a99d1['where'],{'$or':_[_0x93cc('0x27')](_0x3d5c4c,function(_0x26513b){if(_0x26513b['type']!==_0x93cc('0x37')){var _0xd976b3={};_0xd976b3[_0x26513b[_0x93cc('0x25')]]={'$like':'%'+_0x1a55c9[_0x93cc('0x2c')]['filter']+'%'};return _0xd976b3;}})});}_0x3a99d1=_['merge']({},_0x3a99d1,_0x1a55c9['options']);var _0x3c3358={'where':_0x3a99d1[_0x93cc('0x34')]};return db[_0x93cc('0x28')]['count'](_0x3c3358)['then'](function(_0x350a4f){_0x30f865[_0x93cc('0x1d')]=_0x350a4f;if(_0x1a55c9[_0x93cc('0x2c')][_0x93cc('0x38')]){_0x3a99d1[_0x93cc('0x39')]=[{'all':!![]}];}return db[_0x93cc('0x28')][_0x93cc('0x3a')](_0x3a99d1);})[_0x93cc('0x21')](function(_0x10c20c){_0x30f865[_0x93cc('0x3b')]=_0x10c20c;return _0x30f865;})[_0x93cc('0x21')](respondWithFilteredResult(_0x29ad3d,_0x3a99d1))[_0x93cc('0x3c')](handleError(_0x29ad3d,null));};exports[_0x93cc('0x3d')]=function(_0x204b23,_0x5b4f0e){var _0x1b4127={'raw':![],'where':{'id':_0x204b23[_0x93cc('0x3e')]['id']}},_0x204c62={};_0x204c62[_0x93cc('0x2b')]=_[_0x93cc('0x2d')](db['SugarcrmConfiguration'][_0x93cc('0x29')]);_0x204c62[_0x93cc('0x2c')]=_[_0x93cc('0x2d')](_0x204b23[_0x93cc('0x2c')]);_0x204c62[_0x93cc('0x2e')]=_[_0x93cc('0x2f')](_0x204c62[_0x93cc('0x2b')],_0x204c62[_0x93cc('0x2c')]);_0x1b4127[_0x93cc('0x31')]=_['intersection'](_0x204c62[_0x93cc('0x2b')],qs['fields'](_0x204b23['query'][_0x93cc('0x30')]));_0x1b4127['attributes']=_0x1b4127[_0x93cc('0x31')][_0x93cc('0x32')]?_0x1b4127[_0x93cc('0x31')]:_0x204c62[_0x93cc('0x2b')];if(_0x204b23[_0x93cc('0x2c')]['includeAll']){_0x1b4127[_0x93cc('0x39')]=[{'all':!![]}];}_0x1b4127=_[_0x93cc('0x36')]({},_0x1b4127,_0x204b23['options']);return db[_0x93cc('0x28')][_0x93cc('0x3f')](_0x1b4127)[_0x93cc('0x21')](handleEntityNotFound(_0x5b4f0e,null))[_0x93cc('0x21')](respondWithResult(_0x5b4f0e,null))['catch'](handleError(_0x5b4f0e,null));};exports[_0x93cc('0x40')]=function(_0x4121a4,_0x1775e1){return db[_0x93cc('0x28')][_0x93cc('0x40')](_0x4121a4[_0x93cc('0x41')],{})[_0x93cc('0x21')](respondWithResult(_0x1775e1,0xc9))[_0x93cc('0x3c')](handleError(_0x1775e1,null));};exports[_0x93cc('0x42')]=function(_0x237bb7,_0xcd9c08){if(_0x237bb7[_0x93cc('0x41')]['id']){delete _0x237bb7[_0x93cc('0x41')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x237bb7['params']['id']}})['then'](handleEntityNotFound(_0xcd9c08,null))[_0x93cc('0x21')](saveUpdates(_0x237bb7[_0x93cc('0x41')],null))[_0x93cc('0x21')](respondWithResult(_0xcd9c08,null))[_0x93cc('0x3c')](handleError(_0xcd9c08,null));};exports[_0x93cc('0x22')]=function(_0x1f7cd9,_0x1a8d2d){return db[_0x93cc('0x28')][_0x93cc('0x3f')]({'where':{'id':_0x1f7cd9[_0x93cc('0x3e')]['id']}})[_0x93cc('0x21')](handleEntityNotFound(_0x1a8d2d,null))[_0x93cc('0x21')](removeEntity(_0x1a8d2d,null))[_0x93cc('0x3c')](handleError(_0x1a8d2d,null));};exports['getFields']=function(_0x2c43ee,_0x4d558d,_0x39dcde){var _0xb9288b={};var _0x14a07a={};var _0x1881c8;var _0x16f5d5;return db['SugarcrmConfiguration'][_0x93cc('0x43')]({'where':{'id':_0x2c43ee['params']['id']}})[_0x93cc('0x21')](handleEntityNotFound(_0x4d558d,null))[_0x93cc('0x21')](function(_0x506ae2){if(_0x506ae2){_0x1881c8=_0x506ae2;_0x14a07a[_0x93cc('0x2b')]=_[_0x93cc('0x2d')](db[_0x93cc('0x44')][_0x93cc('0x29')]);_0x14a07a[_0x93cc('0x2c')]=_[_0x93cc('0x2d')](_0x2c43ee[_0x93cc('0x2c')]);_0x14a07a[_0x93cc('0x2e')]=_[_0x93cc('0x2f')](_0x14a07a[_0x93cc('0x2b')],_0x14a07a['query']);_0xb9288b[_0x93cc('0x31')]=_[_0x93cc('0x2f')](_0x14a07a[_0x93cc('0x2b')],qs[_0x93cc('0x30')](_0x2c43ee[_0x93cc('0x2c')][_0x93cc('0x30')]));_0xb9288b[_0x93cc('0x31')]=_0xb9288b[_0x93cc('0x31')][_0x93cc('0x32')]?_0xb9288b[_0x93cc('0x31')]:_0x14a07a[_0x93cc('0x2b')];_0xb9288b[_0x93cc('0x45')]=qs[_0x93cc('0x46')](_0x2c43ee[_0x93cc('0x2c')][_0x93cc('0x46')]);_0xb9288b[_0x93cc('0x34')]=qs[_0x93cc('0x2e')](_[_0x93cc('0x35')](_0x2c43ee[_0x93cc('0x2c')],_0x14a07a[_0x93cc('0x2e')]));if(_0x2c43ee[_0x93cc('0x2c')][_0x93cc('0x47')]){_0xb9288b[_0x93cc('0x34')]=_[_0x93cc('0x36')](_0xb9288b[_0x93cc('0x34')],{'$or':_[_0x93cc('0x27')](_0xb9288b[_0x93cc('0x31')],function(_0x2f8890){var _0x1cb470={};_0x1cb470[_0x2f8890]={'$like':'%'+_0x2c43ee[_0x93cc('0x2c')][_0x93cc('0x47')]+'%'};return _0x1cb470;})});}_0xb9288b=_[_0x93cc('0x36')]({},_0xb9288b,_0x2c43ee[_0x93cc('0x48')]);return _0x1881c8[_0x93cc('0x49')](_0xb9288b);}})[_0x93cc('0x21')](function(_0x30c7d7){if(_0x30c7d7){_0x16f5d5=_0x30c7d7['length'];if(!_0x2c43ee[_0x93cc('0x2c')][_0x93cc('0x33')](_0x93cc('0x4a'))){_0xb9288b['limit']=qs[_0x93cc('0x1c')](_0x2c43ee[_0x93cc('0x2c')][_0x93cc('0x1c')]);_0xb9288b['offset']=qs['offset'](_0x2c43ee[_0x93cc('0x2c')]['offset']);}return _0x1881c8['getFields'](_0xb9288b);}})[_0x93cc('0x21')](function(_0x2a459e){if(_0x2a459e){return _0x2a459e?{'count':_0x16f5d5,'rows':_0x2a459e}:null;}})[_0x93cc('0x21')](respondWithResult(_0x4d558d,null))[_0x93cc('0x3c')](handleError(_0x4d558d,null));};exports[_0x93cc('0x4b')]=function(_0x482ce1,_0x4cc0f7,_0x3572fa){var _0x23d7bd={};var _0x5175f4={};var _0x27d6;var _0x129d0a;return db['SugarcrmConfiguration'][_0x93cc('0x43')]({'where':{'id':_0x482ce1[_0x93cc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4cc0f7,null))[_0x93cc('0x21')](function(_0xb1e546){if(_0xb1e546){_0x27d6=_0xb1e546;_0x5175f4[_0x93cc('0x2b')]=_[_0x93cc('0x2d')](db[_0x93cc('0x44')][_0x93cc('0x29')]);_0x5175f4[_0x93cc('0x2c')]=_[_0x93cc('0x2d')](_0x482ce1[_0x93cc('0x2c')]);_0x5175f4['filters']=_[_0x93cc('0x2f')](_0x5175f4[_0x93cc('0x2b')],_0x5175f4[_0x93cc('0x2c')]);_0x23d7bd[_0x93cc('0x31')]=_['intersection'](_0x5175f4[_0x93cc('0x2b')],qs[_0x93cc('0x30')](_0x482ce1[_0x93cc('0x2c')][_0x93cc('0x30')]));_0x23d7bd[_0x93cc('0x31')]=_0x23d7bd['attributes'][_0x93cc('0x32')]?_0x23d7bd[_0x93cc('0x31')]:_0x5175f4['model'];_0x23d7bd[_0x93cc('0x45')]=qs[_0x93cc('0x46')](_0x482ce1[_0x93cc('0x2c')][_0x93cc('0x46')]);_0x23d7bd[_0x93cc('0x34')]=qs['filters'](_['pick'](_0x482ce1[_0x93cc('0x2c')],_0x5175f4[_0x93cc('0x2e')]));if(_0x482ce1[_0x93cc('0x2c')][_0x93cc('0x47')]){_0x23d7bd[_0x93cc('0x34')]=_[_0x93cc('0x36')](_0x23d7bd['where'],{'$or':_[_0x93cc('0x27')](_0x23d7bd[_0x93cc('0x31')],function(_0x1dd23b){var _0x3e4d0b={};_0x3e4d0b[_0x1dd23b]={'$like':'%'+_0x482ce1[_0x93cc('0x2c')][_0x93cc('0x47')]+'%'};return _0x3e4d0b;})});}_0x23d7bd=_[_0x93cc('0x36')]({},_0x23d7bd,_0x482ce1[_0x93cc('0x48')]);return _0x27d6['getSubjects'](_0x23d7bd);}})[_0x93cc('0x21')](function(_0x4c2c7){if(_0x4c2c7){_0x129d0a=_0x4c2c7['length'];if(!_0x482ce1[_0x93cc('0x2c')]['hasOwnProperty'](_0x93cc('0x4a'))){_0x23d7bd[_0x93cc('0x1c')]=qs[_0x93cc('0x1c')](_0x482ce1[_0x93cc('0x2c')][_0x93cc('0x1c')]);_0x23d7bd[_0x93cc('0x1a')]=qs[_0x93cc('0x1a')](_0x482ce1[_0x93cc('0x2c')][_0x93cc('0x1a')]);}return _0x27d6['getSubjects'](_0x23d7bd);}})[_0x93cc('0x21')](function(_0xc0385b){if(_0xc0385b){return _0xc0385b?{'count':_0x129d0a,'rows':_0xc0385b}:null;}})[_0x93cc('0x21')](respondWithResult(_0x4cc0f7,null))[_0x93cc('0x3c')](handleError(_0x4cc0f7,null));};exports['getDescriptions']=function(_0x36c3f4,_0x21fda1,_0x3acf9b){var _0x3f903a={};var _0x119b15={};var _0x3a3024;var _0x15455a;return db[_0x93cc('0x28')][_0x93cc('0x43')]({'where':{'id':_0x36c3f4['params']['id']}})[_0x93cc('0x21')](handleEntityNotFound(_0x21fda1,null))[_0x93cc('0x21')](function(_0x1319d3){if(_0x1319d3){_0x3a3024=_0x1319d3;_0x119b15[_0x93cc('0x2b')]=_['keys'](db[_0x93cc('0x44')][_0x93cc('0x29')]);_0x119b15[_0x93cc('0x2c')]=_['keys'](_0x36c3f4[_0x93cc('0x2c')]);_0x119b15[_0x93cc('0x2e')]=_[_0x93cc('0x2f')](_0x119b15['model'],_0x119b15['query']);_0x3f903a[_0x93cc('0x31')]=_['intersection'](_0x119b15['model'],qs['fields'](_0x36c3f4[_0x93cc('0x2c')][_0x93cc('0x30')]));_0x3f903a[_0x93cc('0x31')]=_0x3f903a[_0x93cc('0x31')][_0x93cc('0x32')]?_0x3f903a[_0x93cc('0x31')]:_0x119b15[_0x93cc('0x2b')];_0x3f903a[_0x93cc('0x45')]=qs[_0x93cc('0x46')](_0x36c3f4[_0x93cc('0x2c')]['sort']);_0x3f903a[_0x93cc('0x34')]=qs[_0x93cc('0x2e')](_[_0x93cc('0x35')](_0x36c3f4[_0x93cc('0x2c')],_0x119b15[_0x93cc('0x2e')]));if(_0x36c3f4[_0x93cc('0x2c')][_0x93cc('0x47')]){_0x3f903a[_0x93cc('0x34')]=_['merge'](_0x3f903a['where'],{'$or':_[_0x93cc('0x27')](_0x3f903a[_0x93cc('0x31')],function(_0x3fe647){var _0x34a8b6={};_0x34a8b6[_0x3fe647]={'$like':'%'+_0x36c3f4[_0x93cc('0x2c')][_0x93cc('0x47')]+'%'};return _0x34a8b6;})});}_0x3f903a=_[_0x93cc('0x36')]({},_0x3f903a,_0x36c3f4[_0x93cc('0x48')]);return _0x3a3024[_0x93cc('0x4c')](_0x3f903a);}})['then'](function(_0xf1569){if(_0xf1569){_0x15455a=_0xf1569[_0x93cc('0x32')];if(!_0x36c3f4[_0x93cc('0x2c')][_0x93cc('0x33')](_0x93cc('0x4a'))){_0x3f903a[_0x93cc('0x1c')]=qs[_0x93cc('0x1c')](_0x36c3f4[_0x93cc('0x2c')][_0x93cc('0x1c')]);_0x3f903a['offset']=qs[_0x93cc('0x1a')](_0x36c3f4['query'][_0x93cc('0x1a')]);}return _0x3a3024[_0x93cc('0x4c')](_0x3f903a);}})[_0x93cc('0x21')](function(_0x4d55ef){if(_0x4d55ef){return _0x4d55ef?{'count':_0x15455a,'rows':_0x4d55ef}:null;}})[_0x93cc('0x21')](respondWithResult(_0x21fda1,null))[_0x93cc('0x3c')](handleError(_0x21fda1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e812f5c..cb1ef36 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 _0xba7f=['define','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes'];(function(_0x119a2a,_0x52a94f){var _0x22d268=function(_0x40714c){while(--_0x40714c){_0x119a2a['push'](_0x119a2a['shift']());}};_0x22d268(++_0x52a94f);}(_0xba7f,0x6e));var _0xfba7=function(_0x82b028,_0x5bece1){_0x82b028=_0x82b028-0x0;var _0x594a8b=_0xba7f[_0x82b028];return _0x594a8b;};'use strict';var _=require(_0xfba7('0x0'));var util=require(_0xfba7('0x1'));var logger=require(_0xfba7('0x2'))(_0xfba7('0x3'));var moment=require(_0xfba7('0x4'));var BPromise=require(_0xfba7('0x5'));var rp=require(_0xfba7('0x6'));var fs=require('fs');var path=require(_0xfba7('0x7'));var rimraf=require(_0xfba7('0x8'));var config=require('../../config/environment');var attributes=require(_0xfba7('0x9'));module['exports']=function(_0x3fb967,_0x2999a5){return _0x3fb967[_0xfba7('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0xfba7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd354=['SugarcrmConfiguration','lodash','../../config/logger','api','moment','rimraf','./intSugarcrmConfiguration.attributes','define'];(function(_0x577bb0,_0x11859f){var _0x46916d=function(_0x4bd14a){while(--_0x4bd14a){_0x577bb0['push'](_0x577bb0['shift']());}};_0x46916d(++_0x11859f);}(_0xd354,0xa1));var _0x4d35=function(_0x5b1974,_0x439bfe){_0x5b1974=_0x5b1974-0x0;var _0x462f78=_0xd354[_0x5b1974];return _0x462f78;};'use strict';var _=require(_0x4d35('0x0'));var util=require('util');var logger=require(_0x4d35('0x1'))(_0x4d35('0x2'));var moment=require(_0x4d35('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d35('0x4'));var config=require('../../config/environment');var attributes=require(_0x4d35('0x5'));module['exports']=function(_0x459b2f,_0x5ae053){return _0x459b2f[_0x4d35('0x6')](_0x4d35('0x7'),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 a557cb8..a302bf7 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 _0x7280=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x334e39,_0x16f47f){var _0x158b6c=function(_0x20d713){while(--_0x20d713){_0x334e39['push'](_0x334e39['shift']());}};_0x158b6c(++_0x16f47f);}(_0x7280,0x1c0));var _0x0728=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7280[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x0728('0x0'));var util=require(_0x0728('0x1'));var moment=require(_0x0728('0x2'));var BPromise=require(_0x0728('0x3'));var rs=require(_0x0728('0x4'));var fs=require('fs');var Redis=require(_0x0728('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0728('0x6'));var logger=require(_0x0728('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0728('0x8'));var client=jayson[_0x0728('0x9')][_0x0728('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428569,_0x2f4c2f,_0x4851ab){return new BPromise(function(_0x56d01f,_0x249dac){return client[_0x0728('0xb')](_0x428569,_0x4851ab)[_0x0728('0xc')](function(_0x1da321){logger[_0x0728('0xd')](_0x0728('0xe'),_0x2f4c2f,_0x0728('0xf'));logger[_0x0728('0x10')](_0x0728('0x11'),_0x2f4c2f,_0x0728('0xf'),JSON['stringify'](_0x1da321));if(_0x1da321['error']){if(_0x1da321[_0x0728('0x12')]['code']===0x1f4){logger['error'](_0x0728('0xe'),_0x2f4c2f,_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);return _0x249dac(_0x1da321[_0x0728('0x12')]['message']);}logger[_0x0728('0x12')](_0x0728('0xe'),_0x2f4c2f,_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);return _0x56d01f(_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);}else{logger[_0x0728('0xd')](_0x0728('0xe'),_0x2f4c2f,_0x0728('0xf'));_0x56d01f(_0x1da321[_0x0728('0x14')][_0x0728('0x13')]);}})['catch'](function(_0x2e6e0f){logger[_0x0728('0x12')](_0x0728('0xe'),_0x2f4c2f,_0x2e6e0f);_0x249dac(_0x2e6e0f);});});} \ No newline at end of file +var _0x7e58=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message'];(function(_0x33baff,_0x467090){var _0x52916c=function(_0x2d8a0e){while(--_0x2d8a0e){_0x33baff['push'](_0x33baff['shift']());}};_0x52916c(++_0x467090);}(_0x7e58,0xaa));var _0x87e5=function(_0xf205cd,_0x547dc9){_0xf205cd=_0xf205cd-0x0;var _0x28e686=_0x7e58[_0xf205cd];return _0x28e686;};'use strict';var _=require(_0x87e5('0x0'));var util=require(_0x87e5('0x1'));var moment=require(_0x87e5('0x2'));var BPromise=require(_0x87e5('0x3'));var rs=require(_0x87e5('0x4'));var fs=require('fs');var Redis=require(_0x87e5('0x5'));var db=require(_0x87e5('0x6'))['db'];var utils=require(_0x87e5('0x7'));var logger=require(_0x87e5('0x8'))(_0x87e5('0x9'));var config=require(_0x87e5('0xa'));var jayson=require(_0x87e5('0xb'));var client=jayson['client'][_0x87e5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x590d3f,_0x33a75d,_0x397853){return new BPromise(function(_0x21b84a,_0x186856){return client[_0x87e5('0xd')](_0x590d3f,_0x397853)[_0x87e5('0xe')](function(_0x13c26f){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x33a75d,_0x87e5('0xf'));logger['debug'](_0x87e5('0x10'),_0x33a75d,_0x87e5('0xf'),JSON[_0x87e5('0x11')](_0x13c26f));if(_0x13c26f[_0x87e5('0x12')]){if(_0x13c26f[_0x87e5('0x12')][_0x87e5('0x13')]===0x1f4){logger[_0x87e5('0x12')](_0x87e5('0x14'),_0x33a75d,_0x13c26f['error'][_0x87e5('0x15')]);return _0x186856(_0x13c26f[_0x87e5('0x12')]['message']);}logger[_0x87e5('0x12')](_0x87e5('0x14'),_0x33a75d,_0x13c26f[_0x87e5('0x12')][_0x87e5('0x15')]);return _0x21b84a(_0x13c26f[_0x87e5('0x12')][_0x87e5('0x15')]);}else{logger['info'](_0x87e5('0x14'),_0x33a75d,_0x87e5('0xf'));_0x21b84a(_0x13c26f[_0x87e5('0x16')][_0x87e5('0x15')]);}})[_0x87e5('0x17')](function(_0x1687fe){logger[_0x87e5('0x12')](_0x87e5('0x14'),_0x33a75d,_0x1687fe);_0x186856(_0x1687fe);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 70bfb51..4322e83 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 _0xe9a8=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','multer'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe9a8,0xef));var _0x8e9a=function(_0x522104,_0x260bde){_0x522104=_0x522104-0x0;var _0x552027=_0xe9a8[_0x522104];return _0x552027;};'use strict';var multer=require(_0x8e9a('0x0'));var util=require(_0x8e9a('0x1'));var path=require('path');var timeout=require(_0x8e9a('0x2'));var express=require(_0x8e9a('0x3'));var router=express['Router']();var fs_extra=require(_0x8e9a('0x4'));var auth=require(_0x8e9a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8e9a('0x6'));var controller=require(_0x8e9a('0x7'));router[_0x8e9a('0x8')]('/',auth[_0x8e9a('0x9')](),controller[_0x8e9a('0xa')]);router[_0x8e9a('0x8')](_0x8e9a('0xb'),auth[_0x8e9a('0x9')](),controller['show']);router[_0x8e9a('0xc')]('/',auth[_0x8e9a('0x9')](),controller[_0x8e9a('0xd')]);router['put'](_0x8e9a('0xb'),auth[_0x8e9a('0x9')](),controller[_0x8e9a('0xe')]);router[_0x8e9a('0xf')](_0x8e9a('0xb'),auth[_0x8e9a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd869=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0xd869,0x7f));var _0x9d86=function(_0x299214,_0x2bab88){_0x299214=_0x299214-0x0;var _0x4d89c1=_0xd869[_0x299214];return _0x4d89c1;};'use strict';var multer=require('multer');var util=require(_0x9d86('0x0'));var path=require(_0x9d86('0x1'));var timeout=require(_0x9d86('0x2'));var express=require('express');var router=express[_0x9d86('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9d86('0x4'));var interaction=require(_0x9d86('0x5'));var config=require(_0x9d86('0x6'));var controller=require(_0x9d86('0x7'));router[_0x9d86('0x8')]('/',auth[_0x9d86('0x9')](),controller[_0x9d86('0xa')]);router[_0x9d86('0x8')]('/:id',auth[_0x9d86('0x9')](),controller[_0x9d86('0xb')]);router[_0x9d86('0xc')]('/',auth['isAuthenticated'](),controller[_0x9d86('0xd')]);router[_0x9d86('0xe')](_0x9d86('0xf'),auth['isAuthenticated'](),controller[_0x9d86('0x10')]);router[_0x9d86('0x11')](_0x9d86('0xf'),auth[_0x9d86('0x9')](),controller[_0x9d86('0x12')]);module[_0x9d86('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8531e98..34d490c 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 _0x6e41=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x1f3dab,_0x333eab){var _0x14b30f=function(_0x7d5e65){while(--_0x7d5e65){_0x1f3dab['push'](_0x1f3dab['shift']());}};_0x14b30f(++_0x333eab);}(_0x6e41,0x1f1));var _0x16e4=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x6e41[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0x16e4('0x0'));module[_0x16e4('0x1')]={'type':{'type':Sequelize[_0x16e4('0x2')](_0x16e4('0x3'),_0x16e4('0x4'),'customVariable',_0x16e4('0x5'),'picklist'),'defaultValue':_0x16e4('0x3')},'content':{'type':Sequelize[_0x16e4('0x6')]},'key':{'type':Sequelize[_0x16e4('0x6')]},'keyType':{'type':Sequelize[_0x16e4('0x2')]('string',_0x16e4('0x4'),_0x16e4('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x16e4('0x6')]},'nameField':{'type':Sequelize[_0x16e4('0x6')]},'customField':{'type':Sequelize[_0x16e4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16e4('0x6')]}}; \ No newline at end of file +var _0x9473=['exports','ENUM','string','keyValue','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x17c6df,_0xe4fcb5){var _0x54e3c4=function(_0x579b70){while(--_0x579b70){_0x17c6df['push'](_0x17c6df['shift']());}};_0x54e3c4(++_0xe4fcb5);}(_0x9473,0xd7));var _0x3947=function(_0x1325d8,_0xdaf072){_0x1325d8=_0x1325d8-0x0;var _0x2796fd=_0x9473[_0x1325d8];return _0x2796fd;};'use strict';var Sequelize=require(_0x3947('0x0'));module[_0x3947('0x1')]={'type':{'type':Sequelize[_0x3947('0x2')](_0x3947('0x3'),'variable','customVariable',_0x3947('0x4'),'picklist'),'defaultValue':_0x3947('0x3')},'content':{'type':Sequelize[_0x3947('0x5')]},'key':{'type':Sequelize[_0x3947('0x5')]},'keyType':{'type':Sequelize[_0x3947('0x2')](_0x3947('0x3'),_0x3947('0x6'),_0x3947('0x7'))},'keyContent':{'type':Sequelize[_0x3947('0x5')]},'idField':{'type':Sequelize[_0x3947('0x5')]},'nameField':{'type':Sequelize[_0x3947('0x5')]},'customField':{'type':Sequelize[_0x3947('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3947('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e69b228..6f91c89 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 _0x4f0b=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','end','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','then','includeAll','include','findAll','show','params','catch','create','body','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3ceb6c,_0x554602){var _0x256814=function(_0x7800cf){while(--_0x7800cf){_0x3ceb6c['push'](_0x3ceb6c['shift']());}};_0x256814(++_0x554602);}(_0x4f0b,0x96));var _0xb4f0=function(_0x249da4,_0x81b7b5){_0x249da4=_0x249da4-0x0;var _0x4f23b5=_0x4f0b[_0x249da4];return _0x4f23b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4f0('0x0'));var zipdir=require(_0xb4f0('0x1'));var jsonpatch=require(_0xb4f0('0x2'));var rp=require(_0xb4f0('0x3'));var moment=require('moment');var BPromise=require(_0xb4f0('0x4'));var Mustache=require(_0xb4f0('0x5'));var util=require(_0xb4f0('0x6'));var path=require(_0xb4f0('0x7'));var sox=require(_0xb4f0('0x8'));var csv=require(_0xb4f0('0x9'));var ejs=require(_0xb4f0('0xa'));var fs=require('fs');var fs_extra=require(_0xb4f0('0xb'));var _=require(_0xb4f0('0xc'));var squel=require(_0xb4f0('0xd'));var crypto=require(_0xb4f0('0xe'));var jsforce=require(_0xb4f0('0xf'));var deskjs=require(_0xb4f0('0x10'));var toCsv=require(_0xb4f0('0x9'));var querystring=require(_0xb4f0('0x11'));var Papa=require(_0xb4f0('0x12'));var Redis=require(_0xb4f0('0x13'));var authService=require(_0xb4f0('0x14'));var qs=require(_0xb4f0('0x15'));var as=require(_0xb4f0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb4f0('0x17'));var utils=require(_0xb4f0('0x18'));var config=require(_0xb4f0('0x19'));var licenseUtil=require(_0xb4f0('0x1a'));var db=require(_0xb4f0('0x1b'))['db'];function respondWithStatusCode(_0x1db6ac,_0x35b47e){_0x35b47e=_0x35b47e||0xcc;return function(_0x49f291){if(_0x49f291){return _0x1db6ac[_0xb4f0('0x1c')](_0x35b47e);}return _0x1db6ac[_0xb4f0('0x1d')](_0x35b47e)['end']();};}function respondWithResult(_0x98acc1,_0x4577df){_0x4577df=_0x4577df||0xc8;return function(_0x38b062){if(_0x38b062){return _0x98acc1[_0xb4f0('0x1d')](_0x4577df)[_0xb4f0('0x1e')](_0x38b062);}};}function respondWithFilteredResult(_0x7796df,_0x4e8515){return function(_0x9d3503){if(_0x9d3503){var _0x117880=typeof _0x4e8515['offset']===_0xb4f0('0x1f')&&typeof _0x4e8515['limit']===_0xb4f0('0x1f');var _0x25256b=_0x9d3503[_0xb4f0('0x20')];var _0x234665=_0x117880?0x0:_0x4e8515['offset'];var _0x44b51a=_0x117880?_0x9d3503[_0xb4f0('0x20')]:_0x4e8515[_0xb4f0('0x21')]+_0x4e8515[_0xb4f0('0x22')];var _0x1c8d6b;if(_0x44b51a>=_0x25256b){_0x44b51a=_0x25256b;_0x1c8d6b=0xc8;}else{_0x1c8d6b=0xce;}_0x7796df['status'](_0x1c8d6b);return _0x7796df[_0xb4f0('0x23')](_0xb4f0('0x24'),_0x234665+'-'+_0x44b51a+'/'+_0x25256b)[_0xb4f0('0x1e')](_0x9d3503);}return null;};}function patchUpdates(_0xc5bda3){return function(_0x21031d){try{jsonpatch[_0xb4f0('0x25')](_0x21031d,_0xc5bda3,!![]);}catch(_0x56a191){return BPromise['reject'](_0x56a191);}return _0x21031d['save']();};}function saveUpdates(_0xa4fa7e,_0x102ea2){return function(_0x4ef645){if(_0x4ef645){return _0x4ef645[_0xb4f0('0x26')](_0xa4fa7e)['then'](function(_0x169237){return _0x169237;});}return null;};}function removeEntity(_0x4612dd,_0x3fb518){return function(_0x3f26e0){if(_0x3f26e0){return _0x3f26e0['destroy']()['then'](function(){_0x4612dd[_0xb4f0('0x1d')](0xcc)[_0xb4f0('0x27')]();});}};}function handleEntityNotFound(_0x8b862e,_0x14b9b0){return function(_0x1b555c){if(!_0x1b555c){_0x8b862e[_0xb4f0('0x1c')](0x194);}return _0x1b555c;};}function handleError(_0x328a15,_0x165c29){_0x165c29=_0x165c29||0x1f4;return function(_0x36e28b){logger[_0xb4f0('0x28')](_0x36e28b[_0xb4f0('0x29')]);if(_0x36e28b[_0xb4f0('0x2a')]){delete _0x36e28b[_0xb4f0('0x2a')];}_0x328a15[_0xb4f0('0x1d')](_0x165c29)[_0xb4f0('0x2b')](_0x36e28b);};}exports[_0xb4f0('0x2c')]=function(_0x4452ef,_0xc2d60d){var _0x577d3c={},_0x3f37cf={},_0x4c89a1={'count':0x0,'rows':[]};var _0x372027=_[_0xb4f0('0x2d')](db[_0xb4f0('0x2e')][_0xb4f0('0x2f')],function(_0x373fad){return{'name':_0x373fad['fieldName'],'type':_0x373fad[_0xb4f0('0x30')][_0xb4f0('0x31')]};});_0x3f37cf[_0xb4f0('0x32')]=_[_0xb4f0('0x2d')](_0x372027,_0xb4f0('0x2a'));_0x3f37cf['query']=_[_0xb4f0('0x33')](_0x4452ef[_0xb4f0('0x34')]);_0x3f37cf[_0xb4f0('0x35')]=_[_0xb4f0('0x36')](_0x3f37cf[_0xb4f0('0x32')],_0x3f37cf[_0xb4f0('0x34')]);_0x577d3c[_0xb4f0('0x37')]=_[_0xb4f0('0x36')](_0x3f37cf[_0xb4f0('0x32')],qs[_0xb4f0('0x38')](_0x4452ef[_0xb4f0('0x34')]['fields']));_0x577d3c[_0xb4f0('0x37')]=_0x577d3c[_0xb4f0('0x37')]['length']?_0x577d3c[_0xb4f0('0x37')]:_0x3f37cf['model'];if(!_0x4452ef[_0xb4f0('0x34')][_0xb4f0('0x39')](_0xb4f0('0x3a'))){_0x577d3c['limit']=qs['limit'](_0x4452ef[_0xb4f0('0x34')]['limit']);_0x577d3c['offset']=qs[_0xb4f0('0x21')](_0x4452ef[_0xb4f0('0x34')][_0xb4f0('0x21')]);}_0x577d3c[_0xb4f0('0x3b')]=qs[_0xb4f0('0x3c')](_0x4452ef[_0xb4f0('0x34')][_0xb4f0('0x3c')]);_0x577d3c['where']=qs[_0xb4f0('0x35')](_[_0xb4f0('0x3d')](_0x4452ef['query'],_0x3f37cf[_0xb4f0('0x35')]),_0x372027);if(_0x4452ef['query']['filter']){_0x577d3c[_0xb4f0('0x3e')]=_[_0xb4f0('0x3f')](_0x577d3c[_0xb4f0('0x3e')],{'$or':_[_0xb4f0('0x2d')](_0x372027,function(_0x3a0e89){if(_0x3a0e89[_0xb4f0('0x30')]!==_0xb4f0('0x40')){var _0x5f5779={};_0x5f5779[_0x3a0e89[_0xb4f0('0x2a')]]={'$like':'%'+_0x4452ef[_0xb4f0('0x34')]['filter']+'%'};return _0x5f5779;}})});}_0x577d3c=_[_0xb4f0('0x3f')]({},_0x577d3c,_0x4452ef[_0xb4f0('0x41')]);var _0x2ea4a3={'where':_0x577d3c[_0xb4f0('0x3e')]};return db['SugarcrmField'][_0xb4f0('0x20')](_0x2ea4a3)[_0xb4f0('0x42')](function(_0x2f66b4){_0x4c89a1[_0xb4f0('0x20')]=_0x2f66b4;if(_0x4452ef['query'][_0xb4f0('0x43')]){_0x577d3c[_0xb4f0('0x44')]=[{'all':!![]}];}return db['SugarcrmField'][_0xb4f0('0x45')](_0x577d3c);})[_0xb4f0('0x42')](function(_0x3aec4b){_0x4c89a1['rows']=_0x3aec4b;return _0x4c89a1;})[_0xb4f0('0x42')](respondWithFilteredResult(_0xc2d60d,_0x577d3c))['catch'](handleError(_0xc2d60d,null));};exports[_0xb4f0('0x46')]=function(_0x49116c,_0x276685){var _0x308009={'raw':!![],'where':{'id':_0x49116c[_0xb4f0('0x47')]['id']}},_0x12ac99={};_0x12ac99[_0xb4f0('0x32')]=_['keys'](db[_0xb4f0('0x2e')][_0xb4f0('0x2f')]);_0x12ac99[_0xb4f0('0x34')]=_['keys'](_0x49116c[_0xb4f0('0x34')]);_0x12ac99[_0xb4f0('0x35')]=_[_0xb4f0('0x36')](_0x12ac99[_0xb4f0('0x32')],_0x12ac99[_0xb4f0('0x34')]);_0x308009[_0xb4f0('0x37')]=_[_0xb4f0('0x36')](_0x12ac99[_0xb4f0('0x32')],qs['fields'](_0x49116c[_0xb4f0('0x34')][_0xb4f0('0x38')]));_0x308009[_0xb4f0('0x37')]=_0x308009[_0xb4f0('0x37')]['length']?_0x308009['attributes']:_0x12ac99[_0xb4f0('0x32')];if(_0x49116c['query'][_0xb4f0('0x43')]){_0x308009[_0xb4f0('0x44')]=[{'all':!![]}];}_0x308009=_['merge']({},_0x308009,_0x49116c[_0xb4f0('0x41')]);return db['SugarcrmField']['find'](_0x308009)[_0xb4f0('0x42')](handleEntityNotFound(_0x276685,null))['then'](respondWithResult(_0x276685,null))[_0xb4f0('0x48')](handleError(_0x276685,null));};exports[_0xb4f0('0x49')]=function(_0x852a4c,_0x2497ae){return db['SugarcrmField'][_0xb4f0('0x49')](_0x852a4c['body'],{})[_0xb4f0('0x42')](respondWithResult(_0x2497ae,0xc9))[_0xb4f0('0x48')](handleError(_0x2497ae,null));};exports[_0xb4f0('0x26')]=function(_0xc338b6,_0x5c2b39){if(_0xc338b6[_0xb4f0('0x4a')]['id']){delete _0xc338b6[_0xb4f0('0x4a')]['id'];}return db[_0xb4f0('0x2e')]['find']({'where':{'id':_0xc338b6[_0xb4f0('0x47')]['id']}})[_0xb4f0('0x42')](handleEntityNotFound(_0x5c2b39,null))[_0xb4f0('0x42')](saveUpdates(_0xc338b6[_0xb4f0('0x4a')],null))[_0xb4f0('0x42')](respondWithResult(_0x5c2b39,null))['catch'](handleError(_0x5c2b39,null));};exports[_0xb4f0('0x4b')]=function(_0x4dac8d,_0x41b5e1){return db['SugarcrmField'][_0xb4f0('0x4c')]({'where':{'id':_0x4dac8d['params']['id']}})[_0xb4f0('0x42')](handleEntityNotFound(_0x41b5e1,null))[_0xb4f0('0x42')](removeEntity(_0x41b5e1,null))[_0xb4f0('0x48')](handleError(_0x41b5e1,null));}; \ No newline at end of file +var _0xe2b5=['moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','SugarcrmField','catch','params','keys','intersection','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0xe2b5,0x90));var _0x5e2b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe2b5[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x5e2b('0x0'));var rimraf=require(_0x5e2b('0x1'));var zipdir=require(_0x5e2b('0x2'));var jsonpatch=require(_0x5e2b('0x3'));var rp=require('request-promise');var moment=require(_0x5e2b('0x4'));var BPromise=require(_0x5e2b('0x5'));var Mustache=require('mustache');var util=require(_0x5e2b('0x6'));var path=require(_0x5e2b('0x7'));var sox=require(_0x5e2b('0x8'));var csv=require(_0x5e2b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e2b('0xa'));var _=require('lodash');var squel=require(_0x5e2b('0xb'));var crypto=require(_0x5e2b('0xc'));var jsforce=require(_0x5e2b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e2b('0xe'));var Redis=require('ioredis');var authService=require(_0x5e2b('0xf'));var qs=require(_0x5e2b('0x10'));var as=require(_0x5e2b('0x11'));var hardwareService=require(_0x5e2b('0x12'));var logger=require(_0x5e2b('0x13'))(_0x5e2b('0x14'));var utils=require(_0x5e2b('0x15'));var config=require(_0x5e2b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e2b('0x17'))['db'];function respondWithStatusCode(_0x539766,_0x574519){_0x574519=_0x574519||0xcc;return function(_0x325fe7){if(_0x325fe7){return _0x539766[_0x5e2b('0x18')](_0x574519);}return _0x539766['status'](_0x574519)['end']();};}function respondWithResult(_0x3091c5,_0x4c1d8f){_0x4c1d8f=_0x4c1d8f||0xc8;return function(_0x18cdd5){if(_0x18cdd5){return _0x3091c5[_0x5e2b('0x19')](_0x4c1d8f)['json'](_0x18cdd5);}};}function respondWithFilteredResult(_0x2a28d1,_0x52ed4c){return function(_0x582ce9){if(_0x582ce9){var _0x14f08e=typeof _0x52ed4c['offset']===_0x5e2b('0x1a')&&typeof _0x52ed4c[_0x5e2b('0x1b')]===_0x5e2b('0x1a');var _0x32fea5=_0x582ce9[_0x5e2b('0x1c')];var _0x44e419=_0x14f08e?0x0:_0x52ed4c[_0x5e2b('0x1d')];var _0x6e4c6=_0x14f08e?_0x582ce9[_0x5e2b('0x1c')]:_0x52ed4c[_0x5e2b('0x1d')]+_0x52ed4c['limit'];var _0x26b2fc;if(_0x6e4c6>=_0x32fea5){_0x6e4c6=_0x32fea5;_0x26b2fc=0xc8;}else{_0x26b2fc=0xce;}_0x2a28d1[_0x5e2b('0x19')](_0x26b2fc);return _0x2a28d1[_0x5e2b('0x1e')](_0x5e2b('0x1f'),_0x44e419+'-'+_0x6e4c6+'/'+_0x32fea5)[_0x5e2b('0x20')](_0x582ce9);}return null;};}function patchUpdates(_0x1febe7){return function(_0x1f4a46){try{jsonpatch[_0x5e2b('0x21')](_0x1f4a46,_0x1febe7,!![]);}catch(_0x1c56ba){return BPromise[_0x5e2b('0x22')](_0x1c56ba);}return _0x1f4a46[_0x5e2b('0x23')]();};}function saveUpdates(_0x195403,_0x329452){return function(_0x403403){if(_0x403403){return _0x403403[_0x5e2b('0x24')](_0x195403)[_0x5e2b('0x25')](function(_0x35cea5){return _0x35cea5;});}return null;};}function removeEntity(_0x1c3bb4,_0x5895e5){return function(_0xbdf943){if(_0xbdf943){return _0xbdf943[_0x5e2b('0x26')]()[_0x5e2b('0x25')](function(){_0x1c3bb4['status'](0xcc)[_0x5e2b('0x27')]();});}};}function handleEntityNotFound(_0x26a4fa,_0x43b354){return function(_0x1b89d2){if(!_0x1b89d2){_0x26a4fa['sendStatus'](0x194);}return _0x1b89d2;};}function handleError(_0x5f0765,_0x41fb61){_0x41fb61=_0x41fb61||0x1f4;return function(_0x3da5b7){logger[_0x5e2b('0x28')](_0x3da5b7[_0x5e2b('0x29')]);if(_0x3da5b7[_0x5e2b('0x2a')]){delete _0x3da5b7[_0x5e2b('0x2a')];}_0x5f0765['status'](_0x41fb61)['send'](_0x3da5b7);};}exports[_0x5e2b('0x2b')]=function(_0x233894,_0x1a760c){var _0x43277d={},_0xffe396={},_0x2a38a0={'count':0x0,'rows':[]};var _0x3a311f=_[_0x5e2b('0x2c')](db['SugarcrmField'][_0x5e2b('0x2d')],function(_0x5df5f2){return{'name':_0x5df5f2[_0x5e2b('0x2e')],'type':_0x5df5f2['type'][_0x5e2b('0x2f')]};});_0xffe396[_0x5e2b('0x30')]=_['map'](_0x3a311f,_0x5e2b('0x2a'));_0xffe396[_0x5e2b('0x31')]=_['keys'](_0x233894[_0x5e2b('0x31')]);_0xffe396[_0x5e2b('0x32')]=_['intersection'](_0xffe396[_0x5e2b('0x30')],_0xffe396[_0x5e2b('0x31')]);_0x43277d[_0x5e2b('0x33')]=_['intersection'](_0xffe396[_0x5e2b('0x30')],qs[_0x5e2b('0x34')](_0x233894[_0x5e2b('0x31')][_0x5e2b('0x34')]));_0x43277d['attributes']=_0x43277d[_0x5e2b('0x33')][_0x5e2b('0x35')]?_0x43277d[_0x5e2b('0x33')]:_0xffe396[_0x5e2b('0x30')];if(!_0x233894[_0x5e2b('0x31')][_0x5e2b('0x36')](_0x5e2b('0x37'))){_0x43277d[_0x5e2b('0x1b')]=qs[_0x5e2b('0x1b')](_0x233894['query'][_0x5e2b('0x1b')]);_0x43277d[_0x5e2b('0x1d')]=qs['offset'](_0x233894['query'][_0x5e2b('0x1d')]);}_0x43277d[_0x5e2b('0x38')]=qs[_0x5e2b('0x39')](_0x233894[_0x5e2b('0x31')][_0x5e2b('0x39')]);_0x43277d['where']=qs[_0x5e2b('0x32')](_[_0x5e2b('0x3a')](_0x233894[_0x5e2b('0x31')],_0xffe396['filters']),_0x3a311f);if(_0x233894[_0x5e2b('0x31')]['filter']){_0x43277d[_0x5e2b('0x3b')]=_[_0x5e2b('0x3c')](_0x43277d[_0x5e2b('0x3b')],{'$or':_[_0x5e2b('0x2c')](_0x3a311f,function(_0x404458){if(_0x404458[_0x5e2b('0x3d')]!=='VIRTUAL'){var _0x4371dc={};_0x4371dc[_0x404458['name']]={'$like':'%'+_0x233894[_0x5e2b('0x31')][_0x5e2b('0x3e')]+'%'};return _0x4371dc;}})});}_0x43277d=_[_0x5e2b('0x3c')]({},_0x43277d,_0x233894[_0x5e2b('0x3f')]);var _0x1d8c86={'where':_0x43277d[_0x5e2b('0x3b')]};return db['SugarcrmField'][_0x5e2b('0x1c')](_0x1d8c86)['then'](function(_0x13e732){_0x2a38a0[_0x5e2b('0x1c')]=_0x13e732;if(_0x233894[_0x5e2b('0x31')][_0x5e2b('0x40')]){_0x43277d[_0x5e2b('0x41')]=[{'all':!![]}];}return db[_0x5e2b('0x42')]['findAll'](_0x43277d);})[_0x5e2b('0x25')](function(_0xee253f){_0x2a38a0['rows']=_0xee253f;return _0x2a38a0;})[_0x5e2b('0x25')](respondWithFilteredResult(_0x1a760c,_0x43277d))[_0x5e2b('0x43')](handleError(_0x1a760c,null));};exports['show']=function(_0x1a1692,_0x1a9847){var _0x3172f7={'raw':!![],'where':{'id':_0x1a1692[_0x5e2b('0x44')]['id']}},_0x313883={};_0x313883[_0x5e2b('0x30')]=_[_0x5e2b('0x45')](db[_0x5e2b('0x42')][_0x5e2b('0x2d')]);_0x313883[_0x5e2b('0x31')]=_['keys'](_0x1a1692['query']);_0x313883[_0x5e2b('0x32')]=_[_0x5e2b('0x46')](_0x313883[_0x5e2b('0x30')],_0x313883[_0x5e2b('0x31')]);_0x3172f7['attributes']=_[_0x5e2b('0x46')](_0x313883[_0x5e2b('0x30')],qs[_0x5e2b('0x34')](_0x1a1692[_0x5e2b('0x31')][_0x5e2b('0x34')]));_0x3172f7[_0x5e2b('0x33')]=_0x3172f7[_0x5e2b('0x33')][_0x5e2b('0x35')]?_0x3172f7[_0x5e2b('0x33')]:_0x313883[_0x5e2b('0x30')];if(_0x1a1692['query'][_0x5e2b('0x40')]){_0x3172f7[_0x5e2b('0x41')]=[{'all':!![]}];}_0x3172f7=_[_0x5e2b('0x3c')]({},_0x3172f7,_0x1a1692[_0x5e2b('0x3f')]);return db['SugarcrmField']['find'](_0x3172f7)[_0x5e2b('0x25')](handleEntityNotFound(_0x1a9847,null))['then'](respondWithResult(_0x1a9847,null))[_0x5e2b('0x43')](handleError(_0x1a9847,null));};exports[_0x5e2b('0x47')]=function(_0x34fcd0,_0xbad77d){return db[_0x5e2b('0x42')][_0x5e2b('0x47')](_0x34fcd0[_0x5e2b('0x48')],{})[_0x5e2b('0x25')](respondWithResult(_0xbad77d,0xc9))[_0x5e2b('0x43')](handleError(_0xbad77d,null));};exports[_0x5e2b('0x24')]=function(_0x32da5d,_0x5e112f){if(_0x32da5d[_0x5e2b('0x48')]['id']){delete _0x32da5d[_0x5e2b('0x48')]['id'];}return db[_0x5e2b('0x42')][_0x5e2b('0x49')]({'where':{'id':_0x32da5d[_0x5e2b('0x44')]['id']}})[_0x5e2b('0x25')](handleEntityNotFound(_0x5e112f,null))[_0x5e2b('0x25')](saveUpdates(_0x32da5d[_0x5e2b('0x48')],null))[_0x5e2b('0x25')](respondWithResult(_0x5e112f,null))[_0x5e2b('0x43')](handleError(_0x5e112f,null));};exports[_0x5e2b('0x26')]=function(_0x33048b,_0x642558){return db[_0x5e2b('0x42')][_0x5e2b('0x49')]({'where':{'id':_0x33048b[_0x5e2b('0x44')]['id']}})[_0x5e2b('0x25')](handleEntityNotFound(_0x642558,null))[_0x5e2b('0x25')](removeEntity(_0x642558,null))[_0x5e2b('0x43')](handleError(_0x642558,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d98de06..bbdedb3 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 _0x0718=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0718,0xd6));var _0x8071=function(_0x2a6571,_0xf1567c){_0x2a6571=_0x2a6571-0x0;var _0xdf7731=_0x0718[_0x2a6571];return _0xdf7731;};'use strict';var _=require(_0x8071('0x0'));var util=require(_0x8071('0x1'));var logger=require(_0x8071('0x2'))('api');var moment=require(_0x8071('0x3'));var BPromise=require(_0x8071('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8071('0x5'));var rimraf=require('rimraf');var config=require(_0x8071('0x6'));var attributes=require(_0x8071('0x7'));module[_0x8071('0x8')]=function(_0x1732d8,_0x11f982){return _0x1732d8[_0x8071('0x9')](_0x8071('0xa'),attributes,{'tableName':_0x8071('0xb'),'paranoid':![],'indexes':[{'name':_0x8071('0xc'),'fields':[_0x8071('0xd'),_0x8071('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ca=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmField.attributes','define'];(function(_0x312b37,_0x19f474){var _0x2e5f91=function(_0x19473d){while(--_0x19473d){_0x312b37['push'](_0x312b37['shift']());}};_0x2e5f91(++_0x19f474);}(_0xa4ca,0xc8));var _0xaa4c=function(_0x237323,_0x3895ba){_0x237323=_0x237323-0x0;var _0xf295d=_0xa4ca[_0x237323];return _0xf295d;};'use strict';var _=require(_0xaa4c('0x0'));var util=require(_0xaa4c('0x1'));var logger=require(_0xaa4c('0x2'))(_0xaa4c('0x3'));var moment=require(_0xaa4c('0x4'));var BPromise=require(_0xaa4c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa4c('0x6'));var rimraf=require(_0xaa4c('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa4c('0x8'));module['exports']=function(_0x337873,_0x169c80){return _0x337873[_0xaa4c('0x9')](_0xaa4c('0xa'),attributes,{'tableName':_0xaa4c('0xb'),'paranoid':![],'indexes':[{'name':_0xaa4c('0xc'),'fields':[_0xaa4c('0xd'),_0xaa4c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 9d52317..ba3471a 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 _0x1cc9=['../../config/logger','../../config/environment','jayson/promise','client','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x157c09,_0x321dee){var _0x1db4d0=function(_0x400df9){while(--_0x400df9){_0x157c09['push'](_0x157c09['shift']());}};_0x1db4d0(++_0x321dee);}(_0x1cc9,0x7d));var _0x91cc=function(_0xd6ecce,_0x38ce20){_0xd6ecce=_0xd6ecce-0x0;var _0x22e1af=_0x1cc9[_0xd6ecce];return _0x22e1af;};'use strict';var _=require(_0x91cc('0x0'));var util=require(_0x91cc('0x1'));var moment=require('moment');var BPromise=require(_0x91cc('0x2'));var rs=require(_0x91cc('0x3'));var fs=require('fs');var Redis=require(_0x91cc('0x4'));var db=require(_0x91cc('0x5'))['db'];var utils=require(_0x91cc('0x6'));var logger=require(_0x91cc('0x7'))('rpc');var config=require(_0x91cc('0x8'));var jayson=require(_0x91cc('0x9'));var client=jayson[_0x91cc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1841e4,_0x5046ca,_0x38a6cb){return new BPromise(function(_0x191306,_0x331ada){return client[_0x91cc('0xb')](_0x1841e4,_0x38a6cb)['then'](function(_0x2d41aa){logger[_0x91cc('0xc')](_0x91cc('0xd'),_0x5046ca,_0x91cc('0xe'));logger[_0x91cc('0xf')](_0x91cc('0x10'),_0x5046ca,_0x91cc('0xe'),JSON[_0x91cc('0x11')](_0x2d41aa));if(_0x2d41aa['error']){if(_0x2d41aa['error'][_0x91cc('0x12')]===0x1f4){logger[_0x91cc('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x5046ca,_0x2d41aa[_0x91cc('0x13')][_0x91cc('0x14')]);return _0x331ada(_0x2d41aa[_0x91cc('0x13')][_0x91cc('0x14')]);}logger[_0x91cc('0x13')](_0x91cc('0xd'),_0x5046ca,_0x2d41aa[_0x91cc('0x13')][_0x91cc('0x14')]);return _0x191306(_0x2d41aa[_0x91cc('0x13')][_0x91cc('0x14')]);}else{logger[_0x91cc('0xc')](_0x91cc('0xd'),_0x5046ca,_0x91cc('0xe'));_0x191306(_0x2d41aa[_0x91cc('0x15')][_0x91cc('0x14')]);}})['catch'](function(_0xf72f6b){logger[_0x91cc('0x13')](_0x91cc('0xd'),_0x5046ca,_0xf72f6b);_0x331ada(_0xf72f6b);});});} \ No newline at end of file +var _0xc8e3=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x509a6d,_0x4f7290){var _0x4e04bd=function(_0x5e40e8){while(--_0x5e40e8){_0x509a6d['push'](_0x509a6d['shift']());}};_0x4e04bd(++_0x4f7290);}(_0xc8e3,0xbc));var _0x3c8e=function(_0x578d9b,_0x486d55){_0x578d9b=_0x578d9b-0x0;var _0x26bdda=_0xc8e3[_0x578d9b];return _0x26bdda;};'use strict';var _=require(_0x3c8e('0x0'));var util=require(_0x3c8e('0x1'));var moment=require(_0x3c8e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c8e('0x3'));var fs=require('fs');var Redis=require(_0x3c8e('0x4'));var db=require(_0x3c8e('0x5'))['db'];var utils=require(_0x3c8e('0x6'));var logger=require('../../config/logger')(_0x3c8e('0x7'));var config=require(_0x3c8e('0x8'));var jayson=require(_0x3c8e('0x9'));var client=jayson[_0x3c8e('0xa')][_0x3c8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bccee,_0x16c7b6,_0x5017d0){return new BPromise(function(_0x2e4c64,_0x2a77ab){return client['request'](_0x5bccee,_0x5017d0)[_0x3c8e('0xc')](function(_0x2d3e7a){logger['info'](_0x3c8e('0xd'),_0x16c7b6,_0x3c8e('0xe'));logger['debug'](_0x3c8e('0xf'),_0x16c7b6,_0x3c8e('0xe'),JSON[_0x3c8e('0x10')](_0x2d3e7a));if(_0x2d3e7a['error']){if(_0x2d3e7a[_0x3c8e('0x11')][_0x3c8e('0x12')]===0x1f4){logger[_0x3c8e('0x11')](_0x3c8e('0xd'),_0x16c7b6,_0x2d3e7a[_0x3c8e('0x11')]['message']);return _0x2a77ab(_0x2d3e7a[_0x3c8e('0x11')]['message']);}logger[_0x3c8e('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x16c7b6,_0x2d3e7a[_0x3c8e('0x11')]['message']);return _0x2e4c64(_0x2d3e7a[_0x3c8e('0x11')][_0x3c8e('0x13')]);}else{logger[_0x3c8e('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x16c7b6,_0x3c8e('0xe'));_0x2e4c64(_0x2d3e7a[_0x3c8e('0x15')][_0x3c8e('0x13')]);}})[_0x3c8e('0x16')](function(_0x3e748f){logger[_0x3c8e('0x11')](_0x3c8e('0xd'),_0x16c7b6,_0x3e748f);_0x2a77ab(_0x3e748f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ab63db0..061751e 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 _0x4262=['/:id','show','getConfigurations','/:id/fields','create','post','/:id/configurations','put','update','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x4ad296,_0x15f440){var _0x2cf3fe=function(_0x25153e){while(--_0x25153e){_0x4ad296['push'](_0x4ad296['shift']());}};_0x2cf3fe(++_0x15f440);}(_0x4262,0x15f));var _0x2426=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4262[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var path=require(_0x2426('0x2'));var timeout=require('connect-timeout');var express=require(_0x2426('0x3'));var router=express['Router']();var fs_extra=require(_0x2426('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2426('0x5'));var controller=require(_0x2426('0x6'));router[_0x2426('0x7')]('/',auth[_0x2426('0x8')](),controller['index']);router[_0x2426('0x7')](_0x2426('0x9'),auth[_0x2426('0x8')](),controller[_0x2426('0xa')]);router[_0x2426('0x7')]('/:id/configurations',auth[_0x2426('0x8')](),controller[_0x2426('0xb')]);router[_0x2426('0x7')](_0x2426('0xc'),auth[_0x2426('0x8')](),controller['getFields']);router['post']('/',auth[_0x2426('0x8')](),controller[_0x2426('0xd')]);router[_0x2426('0xe')](_0x2426('0xf'),auth[_0x2426('0x8')](),controller['addConfiguration']);router[_0x2426('0x10')](_0x2426('0x9'),auth[_0x2426('0x8')](),controller[_0x2426('0x11')]);router['delete'](_0x2426('0x9'),auth[_0x2426('0x8')](),controller[_0x2426('0x12')]);module[_0x2426('0x13')]=router; \ No newline at end of file +var _0x818f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x818f,0x1da));var _0xf818=function(_0x4c866f,_0x244368){_0x4c866f=_0x4c866f-0x0;var _0x2221b2=_0x818f[_0x4c866f];return _0x2221b2;};'use strict';var multer=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var path=require(_0xf818('0x2'));var timeout=require(_0xf818('0x3'));var express=require(_0xf818('0x4'));var router=express[_0xf818('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf818('0x6'));var interaction=require(_0xf818('0x7'));var config=require(_0xf818('0x8'));var controller=require(_0xf818('0x9'));router[_0xf818('0xa')]('/',auth[_0xf818('0xb')](),controller[_0xf818('0xc')]);router[_0xf818('0xa')](_0xf818('0xd'),auth['isAuthenticated'](),controller[_0xf818('0xe')]);router[_0xf818('0xa')](_0xf818('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf818('0xa')](_0xf818('0x10'),auth[_0xf818('0xb')](),controller[_0xf818('0x11')]);router[_0xf818('0x12')]('/',auth['isAuthenticated'](),controller[_0xf818('0x13')]);router[_0xf818('0x12')](_0xf818('0xf'),auth[_0xf818('0xb')](),controller[_0xf818('0x14')]);router['put']('/:id',auth[_0xf818('0xb')](),controller[_0xf818('0x15')]);router[_0xf818('0x16')](_0xf818('0xd'),auth['isAuthenticated'](),controller[_0xf818('0x17')]);module[_0xf818('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a9653fd..081c580 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 _0xac26=['exports','STRING','HelpDesk','sequelize'];(function(_0x1d1967,_0x52b368){var _0x5d6ce0=function(_0x41f793){while(--_0x41f793){_0x1d1967['push'](_0x1d1967['shift']());}};_0x5d6ce0(++_0x52b368);}(_0xac26,0x14b));var _0x6ac2=function(_0x36cec9,_0x7e7a62){_0x36cec9=_0x36cec9-0x0;var _0x44bcaa=_0xac26[_0x36cec9];return _0x44bcaa;};'use strict';var Sequelize=require(_0x6ac2('0x0'));module[_0x6ac2('0x1')]={'name':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6ac2('0x2')]},'username':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![],'defaultValue':_0x6ac2('0x3')},'remoteUri':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6d81=['HelpDesk','STRING'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x6d81,0xa1));var _0x16d8=function(_0x215ec9,_0x13ec68){_0x215ec9=_0x215ec9-0x0;var _0xfe2c77=_0x6d81[_0x215ec9];return _0xfe2c77;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x16d8('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x16d8('0x0')]},'username':{'type':Sequelize[_0x16d8('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x16d8('0x0')],'allowNull':![],'defaultValue':_0x16d8('0x1')},'remoteUri':{'type':Sequelize[_0x16d8('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x16d8('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x16d8('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 01456da..acb45f3 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 _0x533c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','limit','count','Content-Range','json','apply','save','update','then','end','sendStatus','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','filters','intersection','attributes','fields','query','length','model','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','show','params','keys','create','body','catch','destroy','find','getConfigurations','VtigerConfiguration','order','pick','addConfiguration','findOne','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','%s/webservice.php','GET','success','login','result','token','autogenerated','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','value','log','statusCode','stringify','test','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0x533c,0x1af));var _0xc533=function(_0x30e211,_0x32e11b){_0x30e211=_0x30e211-0x0;var _0x2c1ec1=_0x533c[_0x30e211];return _0x2c1ec1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc533('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc533('0x1'));var rp=require('request-promise');var moment=require(_0xc533('0x2'));var BPromise=require(_0xc533('0x3'));var Mustache=require(_0xc533('0x4'));var util=require('util');var path=require(_0xc533('0x5'));var sox=require('sox');var csv=require(_0xc533('0x6'));var ejs=require(_0xc533('0x7'));var fs=require('fs');var fs_extra=require(_0xc533('0x8'));var _=require(_0xc533('0x9'));var squel=require('squel');var crypto=require(_0xc533('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc533('0xb'));var toCsv=require(_0xc533('0x6'));var querystring=require(_0xc533('0xc'));var Papa=require(_0xc533('0xd'));var Redis=require(_0xc533('0xe'));var authService=require(_0xc533('0xf'));var qs=require(_0xc533('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc533('0x11'));var logger=require(_0xc533('0x12'))(_0xc533('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc533('0x14'));var db=require(_0xc533('0x15'))['db'];var integrations=require(_0xc533('0x16'));function respondWithStatusCode(_0x3b1d41,_0x45d771){_0x45d771=_0x45d771||0xcc;return function(_0x5bb02f){if(_0x5bb02f){return _0x3b1d41['sendStatus'](_0x45d771);}return _0x3b1d41[_0xc533('0x17')](_0x45d771)['end']();};}function respondWithResult(_0x44a50a,_0x408629){_0x408629=_0x408629||0xc8;return function(_0x3d9a73){if(_0x3d9a73){return _0x44a50a[_0xc533('0x17')](_0x408629)['json'](_0x3d9a73);}};}function respondWithFilteredResult(_0x273767,_0x1f2e6a){return function(_0x30a361){if(_0x30a361){var _0x27f5b0=typeof _0x1f2e6a[_0xc533('0x18')]==='undefined'&&typeof _0x1f2e6a[_0xc533('0x19')]==='undefined';var _0x30ccb6=_0x30a361[_0xc533('0x1a')];var _0x2cadad=_0x27f5b0?0x0:_0x1f2e6a[_0xc533('0x18')];var _0x5af848=_0x27f5b0?_0x30a361[_0xc533('0x1a')]:_0x1f2e6a[_0xc533('0x18')]+_0x1f2e6a['limit'];var _0xa1e1d5;if(_0x5af848>=_0x30ccb6){_0x5af848=_0x30ccb6;_0xa1e1d5=0xc8;}else{_0xa1e1d5=0xce;}_0x273767[_0xc533('0x17')](_0xa1e1d5);return _0x273767['set'](_0xc533('0x1b'),_0x2cadad+'-'+_0x5af848+'/'+_0x30ccb6)[_0xc533('0x1c')](_0x30a361);}return null;};}function patchUpdates(_0x5320f2){return function(_0x169d59){try{jsonpatch[_0xc533('0x1d')](_0x169d59,_0x5320f2,!![]);}catch(_0x4ac768){return BPromise['reject'](_0x4ac768);}return _0x169d59[_0xc533('0x1e')]();};}function saveUpdates(_0x28fb87,_0x2285fb){return function(_0x2daabf){if(_0x2daabf){return _0x2daabf[_0xc533('0x1f')](_0x28fb87)[_0xc533('0x20')](function(_0x495759){return _0x495759;});}return null;};}function removeEntity(_0x12dc83,_0x3cfce3){return function(_0x11731e){if(_0x11731e){return _0x11731e['destroy']()[_0xc533('0x20')](function(){_0x12dc83[_0xc533('0x17')](0xcc)[_0xc533('0x21')]();});}};}function handleEntityNotFound(_0x46bda8,_0x1742fb){return function(_0x4ffdfb){if(!_0x4ffdfb){_0x46bda8[_0xc533('0x22')](0x194);}return _0x4ffdfb;};}function handleError(_0x462fb3,_0x39e413){_0x39e413=_0x39e413||0x1f4;return function(_0xdabf85){logger[_0xc533('0x23')](_0xdabf85['stack']);if(_0xdabf85['name']){delete _0xdabf85[_0xc533('0x24')];}_0x462fb3[_0xc533('0x17')](_0x39e413)[_0xc533('0x25')](_0xdabf85);};}exports[_0xc533('0x26')]=function(_0x498beb,_0x5a80f1){var _0x11250c={},_0x39be75={},_0x59bf3f={'count':0x0,'rows':[]};var _0x2fd403=_[_0xc533('0x27')](db[_0xc533('0x28')][_0xc533('0x29')],function(_0x4721d2){return{'name':_0x4721d2[_0xc533('0x2a')],'type':_0x4721d2[_0xc533('0x2b')]['key']};});_0x39be75['model']=_[_0xc533('0x27')](_0x2fd403,_0xc533('0x24'));_0x39be75['query']=_['keys'](_0x498beb['query']);_0x39be75[_0xc533('0x2c')]=_[_0xc533('0x2d')](_0x39be75['model'],_0x39be75['query']);_0x11250c[_0xc533('0x2e')]=_[_0xc533('0x2d')](_0x39be75['model'],qs[_0xc533('0x2f')](_0x498beb[_0xc533('0x30')][_0xc533('0x2f')]));_0x11250c[_0xc533('0x2e')]=_0x11250c[_0xc533('0x2e')][_0xc533('0x31')]?_0x11250c[_0xc533('0x2e')]:_0x39be75[_0xc533('0x32')];if(!_0x498beb[_0xc533('0x30')][_0xc533('0x33')]('nolimit')){_0x11250c[_0xc533('0x19')]=qs['limit'](_0x498beb['query'][_0xc533('0x19')]);_0x11250c[_0xc533('0x18')]=qs['offset'](_0x498beb[_0xc533('0x30')][_0xc533('0x18')]);}_0x11250c['order']=qs[_0xc533('0x34')](_0x498beb['query'][_0xc533('0x34')]);_0x11250c[_0xc533('0x35')]=qs[_0xc533('0x2c')](_['pick'](_0x498beb[_0xc533('0x30')],_0x39be75[_0xc533('0x2c')]),_0x2fd403);if(_0x498beb[_0xc533('0x30')][_0xc533('0x36')]){_0x11250c[_0xc533('0x35')]=_[_0xc533('0x37')](_0x11250c['where'],{'$or':_[_0xc533('0x27')](_0x2fd403,function(_0x408512){if(_0x408512[_0xc533('0x2b')]!=='VIRTUAL'){var _0x78be14={};_0x78be14[_0x408512[_0xc533('0x24')]]={'$like':'%'+_0x498beb['query']['filter']+'%'};return _0x78be14;}})});}_0x11250c=_['merge']({},_0x11250c,_0x498beb[_0xc533('0x38')]);var _0x1247a5={'where':_0x11250c[_0xc533('0x35')]};return db['VtigerAccount']['count'](_0x1247a5)[_0xc533('0x20')](function(_0x1c4de8){_0x59bf3f[_0xc533('0x1a')]=_0x1c4de8;if(_0x498beb[_0xc533('0x30')][_0xc533('0x39')]){_0x11250c[_0xc533('0x3a')]=[{'all':!![]}];}return db['VtigerAccount'][_0xc533('0x3b')](_0x11250c);})[_0xc533('0x20')](function(_0x4e72f3){_0x59bf3f['rows']=_0x4e72f3;return _0x59bf3f;})['then'](respondWithFilteredResult(_0x5a80f1,_0x11250c))['catch'](handleError(_0x5a80f1,null));};exports[_0xc533('0x3c')]=function(_0x4d85bf,_0x2fa81c){var _0x22c4c4={'raw':![],'where':{'id':_0x4d85bf[_0xc533('0x3d')]['id']}},_0x50eddf={};_0x50eddf[_0xc533('0x32')]=_['keys'](db[_0xc533('0x28')][_0xc533('0x29')]);_0x50eddf[_0xc533('0x30')]=_[_0xc533('0x3e')](_0x4d85bf['query']);_0x50eddf[_0xc533('0x2c')]=_['intersection'](_0x50eddf[_0xc533('0x32')],_0x50eddf['query']);_0x22c4c4[_0xc533('0x2e')]=_[_0xc533('0x2d')](_0x50eddf[_0xc533('0x32')],qs[_0xc533('0x2f')](_0x4d85bf['query']['fields']));_0x22c4c4[_0xc533('0x2e')]=_0x22c4c4[_0xc533('0x2e')][_0xc533('0x31')]?_0x22c4c4['attributes']:_0x50eddf['model'];if(_0x4d85bf[_0xc533('0x30')][_0xc533('0x39')]){_0x22c4c4[_0xc533('0x3a')]=[{'all':!![]}];}_0x22c4c4=_[_0xc533('0x37')]({},_0x22c4c4,_0x4d85bf['options']);return db[_0xc533('0x28')]['find'](_0x22c4c4)['then'](handleEntityNotFound(_0x2fa81c,null))[_0xc533('0x20')](respondWithResult(_0x2fa81c,null))['catch'](handleError(_0x2fa81c,null));};exports[_0xc533('0x3f')]=function(_0x419f99,_0x5b1bd3){return db[_0xc533('0x28')][_0xc533('0x3f')](_0x419f99[_0xc533('0x40')],{})[_0xc533('0x20')](respondWithResult(_0x5b1bd3,0xc9))[_0xc533('0x41')](handleError(_0x5b1bd3,null));};exports[_0xc533('0x1f')]=function(_0x4d2c63,_0x3b657a){if(_0x4d2c63[_0xc533('0x40')]['id']){delete _0x4d2c63[_0xc533('0x40')]['id'];}return db[_0xc533('0x28')]['find']({'where':{'id':_0x4d2c63['params']['id']}})['then'](handleEntityNotFound(_0x3b657a,null))[_0xc533('0x20')](saveUpdates(_0x4d2c63['body'],null))['then'](respondWithResult(_0x3b657a,null))['catch'](handleError(_0x3b657a,null));};exports[_0xc533('0x42')]=function(_0x5a7838,_0x40b373){return db[_0xc533('0x28')][_0xc533('0x43')]({'where':{'id':_0x5a7838[_0xc533('0x3d')]['id']}})['then'](handleEntityNotFound(_0x40b373,null))['then'](removeEntity(_0x40b373,null))['catch'](handleError(_0x40b373,null));};exports[_0xc533('0x44')]=function(_0x326421,_0x4c687e,_0x5388f9){var _0x135df9={};var _0x49e31d={};var _0x46a2c0;var _0x8cb586;return db[_0xc533('0x28')]['findOne']({'where':{'id':_0x326421[_0xc533('0x3d')]['id']}})[_0xc533('0x20')](handleEntityNotFound(_0x4c687e,null))[_0xc533('0x20')](function(_0x7bdc73){if(_0x7bdc73){_0x46a2c0=_0x7bdc73;_0x49e31d[_0xc533('0x32')]=_[_0xc533('0x3e')](db[_0xc533('0x45')][_0xc533('0x29')]);_0x49e31d[_0xc533('0x30')]=_['keys'](_0x326421[_0xc533('0x30')]);_0x49e31d[_0xc533('0x2c')]=_[_0xc533('0x2d')](_0x49e31d['model'],_0x49e31d[_0xc533('0x30')]);_0x135df9[_0xc533('0x2e')]=_[_0xc533('0x2d')](_0x49e31d[_0xc533('0x32')],qs[_0xc533('0x2f')](_0x326421[_0xc533('0x30')][_0xc533('0x2f')]));_0x135df9['attributes']=_0x135df9[_0xc533('0x2e')][_0xc533('0x31')]?_0x135df9[_0xc533('0x2e')]:_0x49e31d[_0xc533('0x32')];_0x135df9[_0xc533('0x46')]=qs[_0xc533('0x34')](_0x326421[_0xc533('0x30')][_0xc533('0x34')]);_0x135df9[_0xc533('0x35')]=qs[_0xc533('0x2c')](_[_0xc533('0x47')](_0x326421[_0xc533('0x30')],_0x49e31d[_0xc533('0x2c')]));if(_0x326421['query'][_0xc533('0x36')]){_0x135df9[_0xc533('0x35')]=_[_0xc533('0x37')](_0x135df9[_0xc533('0x35')],{'$or':_[_0xc533('0x27')](_0x135df9['attributes'],function(_0x42e2b8){var _0x4bfc1a={};_0x4bfc1a[_0x42e2b8]={'$like':'%'+_0x326421['query'][_0xc533('0x36')]+'%'};return _0x4bfc1a;})});}_0x135df9=_[_0xc533('0x37')]({},_0x135df9,_0x326421[_0xc533('0x38')]);return _0x46a2c0[_0xc533('0x44')](_0x135df9);}})['then'](function(_0x13fb4f){if(_0x13fb4f){_0x8cb586=_0x13fb4f[_0xc533('0x31')];if(!_0x326421['query']['hasOwnProperty']('nolimit')){_0x135df9['limit']=qs['limit'](_0x326421[_0xc533('0x30')][_0xc533('0x19')]);_0x135df9[_0xc533('0x18')]=qs['offset'](_0x326421[_0xc533('0x30')][_0xc533('0x18')]);}return _0x46a2c0[_0xc533('0x44')](_0x135df9);}})[_0xc533('0x20')](function(_0x55db8c){if(_0x55db8c){return _0x55db8c?{'count':_0x8cb586,'rows':_0x55db8c}:null;}})[_0xc533('0x20')](respondWithResult(_0x4c687e,null))[_0xc533('0x41')](handleError(_0x4c687e,null));};exports[_0xc533('0x48')]=function(_0x5afcdb,_0x1a7287,_0x24803f){if(_0x5afcdb[_0xc533('0x40')]['id']){delete _0x5afcdb[_0xc533('0x40')]['id'];}return db[_0xc533('0x28')][_0xc533('0x49')]({'where':{'id':_0x5afcdb[_0xc533('0x3d')]['id']}})[_0xc533('0x20')](handleEntityNotFound(_0x1a7287,null))[_0xc533('0x20')](function(_0x4ff40e){if(_0x4ff40e){_0x5afcdb[_0xc533('0x40')]['AccountId']=_0x4ff40e['id'];_0x5afcdb[_0xc533('0x40')][_0xc533('0x4a')]=integrations[_0xc533('0x4b')](_0x5afcdb[_0xc533('0x40')][_0xc533('0x4c')],_0x5afcdb[_0xc533('0x40')][_0xc533('0x2b')]);_0x5afcdb[_0xc533('0x40')]['Descriptions']=integrations[_0xc533('0x4d')](_0x5afcdb['body'][_0xc533('0x4c')],_0x5afcdb[_0xc533('0x40')][_0xc533('0x2b')]);return db[_0xc533('0x45')]['create'](_0x5afcdb[_0xc533('0x40')],{'include':[{'model':db['VtigerField'],'as':_0xc533('0x4a')},{'model':db[_0xc533('0x4e')],'as':_0xc533('0x4f')}]});}return null;})[_0xc533('0x20')](respondWithResult(_0x1a7287,null))[_0xc533('0x41')](handleError(_0x1a7287,null));};var md5=require(_0xc533('0x50'));exports[_0xc533('0x51')]=function(_0x2476a7,_0x1ade7b,_0x35e8dc){var _0x1b421d=null;var _0x40e68e=null;var _0x1f974b=null;var _0x2251c0=null;var _0x5ab5b1='';return db[_0xc533('0x28')][_0xc533('0x49')]({'where':{'id':_0x2476a7[_0xc533('0x3d')]['id']},'attributes':['id',_0xc533('0x24'),_0xc533('0x52'),_0xc533('0x53'),_0xc533('0x54'),_0xc533('0x55'),_0xc533('0x56'),'accessKey']})['then'](handleEntityNotFound(_0x1ade7b,null))[_0xc533('0x20')](function(_0x47327d){if(_0x47327d){_0x1b421d=_0x47327d['username'];_0x40e68e=_0x47327d[_0xc533('0x57')];_0x1f974b=_0x47327d[_0xc533('0x54')];_0x5ab5b1=_0x47327d[_0xc533('0x55')];var _0x116103=_0x5ab5b1[_0xc533('0x58')](-0x1);if(_0x116103==='/'){_0x5ab5b1=_0x5ab5b1['substring'](0x0,_0x5ab5b1[_0xc533('0x59')](_0x116103));}_0x2251c0=util['format'](_0xc533('0x5a'),_0x5ab5b1);var _0x542478={'method':_0xc533('0x5b'),'uri':_0x2251c0,'qs':{'operation':'getchallenge','username':_0x47327d[_0xc533('0x52')]},'json':!![]};return rp(_0x542478);}})[_0xc533('0x20')](function(_0x26df00){if(_0x26df00[_0xc533('0x5c')]){var _0x255a0d={'method':'POST','uri':_0x2251c0,'form':{'operation':_0xc533('0x5d'),'username':_0x1b421d,'accessKey':md5(_0x26df00[_0xc533('0x5e')][_0xc533('0x5f')]+_0x40e68e)},'json':!![]};return rp(_0x255a0d);}})['then'](function(_0x347b37){if(_0x347b37[_0xc533('0x5c')]){var _0x7587cf={'method':_0xc533('0x5b'),'uri':_0x2251c0,'qs':{'operation':'describe','username':_0x1b421d,'sessionName':_0x347b37[_0xc533('0x5e')]['sessionName'],'elementType':_0x1f974b},'json':!![]};return rp(_0x7587cf);}})['then'](function(_0x1813b8){if(_0x1813b8['success']){var _0x4da58c=[_0xc533('0x60'),'reference','owner'];_[_0xc533('0x61')](_0x1813b8[_0xc533('0x5e')][_0xc533('0x2f')],function(_0x52ab14){return _0x4da58c[_0xc533('0x62')](_0x52ab14[_0xc533('0x2b')][_0xc533('0x24')]);});_[_0xc533('0x61')](_0x1813b8['result'][_0xc533('0x2f')],function(_0x4ab4dc){return _0x4ab4dc['editable']===_0xc533('0x63');});return{'count':_0x1813b8[_0xc533('0x5e')][_0xc533('0x2f')][_0xc533('0x31')],'rows':_[_0xc533('0x27')](_0x1813b8[_0xc533('0x5e')][_0xc533('0x2f')],function(_0x2d3ab8){return{'id':_0x2d3ab8[_0xc533('0x24')],'name':_0x2d3ab8[_0xc533('0x64')],'custom':_[_0xc533('0x65')](_0x2d3ab8[_0xc533('0x24')],_0xc533('0x66'))?!![]:![],'options':_0x2d3ab8[_0xc533('0x2b')][_0xc533('0x24')]===_0xc533('0x67')&&_0x2d3ab8[_0xc533('0x2b')]['picklistValues']['length']>0x0?_[_0xc533('0x27')](_0x2d3ab8['type'][_0xc533('0x68')],function(_0x13978c){return{'name':_0x13978c[_0xc533('0x64')],'value':_0x13978c[_0xc533('0x69')]};}):[]};})};}})[_0xc533('0x20')](respondWithResult(_0x1ade7b,null))[_0xc533('0x41')](function(_0x4af723){console[_0xc533('0x6a')]('vTiger\x20error:\x20'+_0x4af723);var _0x4861d2=_0x2476a7[_0xc533('0x30')]['test']?0x1f4:_0x4af723[_0xc533('0x6b')]||0x1f4;logger[_0xc533('0x23')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4861d2,JSON[_0xc533('0x6c')](_0x4af723));delete _0x4af723['name'];if(_0x4861d2===0x191){_0x4861d2=0x190;}_0x1ade7b[_0xc533('0x17')](_0x4861d2)[_0xc533('0x25')](_0x2476a7[_0xc533('0x30')][_0xc533('0x6d')]?{'message':_0xc533('0x6e'),'statusCode':_0x4af723[_0xc533('0x6b')]}:_0x4af723);});}; \ No newline at end of file +var _0x3d3d=['username','slice','lastIndexOf','format','GET','getchallenge','POST','login','result','token','describe','sessionName','success','autogenerated','reference','owner','remove','editable','false','label','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','count','limit','set','Content-Range','reject','save','update','then','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','description','moduleName','serverUrl'];(function(_0x10969e,_0x263e0d){var _0x4541f9=function(_0x1427f6){while(--_0x1427f6){_0x10969e['push'](_0x10969e['shift']());}};_0x4541f9(++_0x263e0d);}(_0x3d3d,0x95));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3d3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3d3('0x1'));var rp=require(_0xd3d3('0x2'));var moment=require(_0xd3d3('0x3'));var BPromise=require(_0xd3d3('0x4'));var Mustache=require(_0xd3d3('0x5'));var util=require(_0xd3d3('0x6'));var path=require(_0xd3d3('0x7'));var sox=require('sox');var csv=require(_0xd3d3('0x8'));var ejs=require(_0xd3d3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd3d3('0xa'));var crypto=require(_0xd3d3('0xb'));var jsforce=require(_0xd3d3('0xc'));var deskjs=require(_0xd3d3('0xd'));var toCsv=require(_0xd3d3('0x8'));var querystring=require(_0xd3d3('0xe'));var Papa=require(_0xd3d3('0xf'));var Redis=require('ioredis');var authService=require(_0xd3d3('0x10'));var qs=require(_0xd3d3('0x11'));var as=require(_0xd3d3('0x12'));var hardwareService=require(_0xd3d3('0x13'));var logger=require(_0xd3d3('0x14'))(_0xd3d3('0x15'));var utils=require(_0xd3d3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd3d3('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd3d3('0x18'));function respondWithStatusCode(_0x34ed6a,_0x511181){_0x511181=_0x511181||0xcc;return function(_0x19ab57){if(_0x19ab57){return _0x34ed6a[_0xd3d3('0x19')](_0x511181);}return _0x34ed6a['status'](_0x511181)[_0xd3d3('0x1a')]();};}function respondWithResult(_0x5ba870,_0x1c315c){_0x1c315c=_0x1c315c||0xc8;return function(_0x14a7c6){if(_0x14a7c6){return _0x5ba870[_0xd3d3('0x1b')](_0x1c315c)[_0xd3d3('0x1c')](_0x14a7c6);}};}function respondWithFilteredResult(_0x4608a,_0x333474){return function(_0x1f2118){if(_0x1f2118){var _0x371f06=typeof _0x333474[_0xd3d3('0x1d')]==='undefined'&&typeof _0x333474['limit']==='undefined';var _0x54d246=_0x1f2118['count'];var _0x5add01=_0x371f06?0x0:_0x333474[_0xd3d3('0x1d')];var _0x16aab1=_0x371f06?_0x1f2118[_0xd3d3('0x1e')]:_0x333474[_0xd3d3('0x1d')]+_0x333474[_0xd3d3('0x1f')];var _0x165f8d;if(_0x16aab1>=_0x54d246){_0x16aab1=_0x54d246;_0x165f8d=0xc8;}else{_0x165f8d=0xce;}_0x4608a['status'](_0x165f8d);return _0x4608a[_0xd3d3('0x20')](_0xd3d3('0x21'),_0x5add01+'-'+_0x16aab1+'/'+_0x54d246)[_0xd3d3('0x1c')](_0x1f2118);}return null;};}function patchUpdates(_0x5b41a5){return function(_0x326dda){try{jsonpatch['apply'](_0x326dda,_0x5b41a5,!![]);}catch(_0x1b6d53){return BPromise[_0xd3d3('0x22')](_0x1b6d53);}return _0x326dda[_0xd3d3('0x23')]();};}function saveUpdates(_0x11c7a8,_0x4ba13c){return function(_0x44a92d){if(_0x44a92d){return _0x44a92d[_0xd3d3('0x24')](_0x11c7a8)[_0xd3d3('0x25')](function(_0x223495){return _0x223495;});}return null;};}function removeEntity(_0x46daad,_0x5a6dc7){return function(_0x44ae5e){if(_0x44ae5e){return _0x44ae5e['destroy']()[_0xd3d3('0x25')](function(){_0x46daad[_0xd3d3('0x1b')](0xcc)[_0xd3d3('0x1a')]();});}};}function handleEntityNotFound(_0x42c7bc,_0x522e0d){return function(_0x5aad15){if(!_0x5aad15){_0x42c7bc['sendStatus'](0x194);}return _0x5aad15;};}function handleError(_0x4e2edb,_0x25603e){_0x25603e=_0x25603e||0x1f4;return function(_0x290370){logger['error'](_0x290370['stack']);if(_0x290370[_0xd3d3('0x26')]){delete _0x290370[_0xd3d3('0x26')];}_0x4e2edb[_0xd3d3('0x1b')](_0x25603e)[_0xd3d3('0x27')](_0x290370);};}exports[_0xd3d3('0x28')]=function(_0x4bf952,_0xb58ef5){var _0x5a0b54={},_0x1885bc={},_0x2c6aef={'count':0x0,'rows':[]};var _0x11a500=_[_0xd3d3('0x29')](db[_0xd3d3('0x2a')][_0xd3d3('0x2b')],function(_0x504317){return{'name':_0x504317[_0xd3d3('0x2c')],'type':_0x504317[_0xd3d3('0x2d')][_0xd3d3('0x2e')]};});_0x1885bc['model']=_['map'](_0x11a500,_0xd3d3('0x26'));_0x1885bc[_0xd3d3('0x2f')]=_[_0xd3d3('0x30')](_0x4bf952[_0xd3d3('0x2f')]);_0x1885bc[_0xd3d3('0x31')]=_[_0xd3d3('0x32')](_0x1885bc[_0xd3d3('0x33')],_0x1885bc['query']);_0x5a0b54[_0xd3d3('0x34')]=_[_0xd3d3('0x32')](_0x1885bc[_0xd3d3('0x33')],qs[_0xd3d3('0x35')](_0x4bf952[_0xd3d3('0x2f')][_0xd3d3('0x35')]));_0x5a0b54[_0xd3d3('0x34')]=_0x5a0b54[_0xd3d3('0x34')][_0xd3d3('0x36')]?_0x5a0b54[_0xd3d3('0x34')]:_0x1885bc['model'];if(!_0x4bf952[_0xd3d3('0x2f')]['hasOwnProperty'](_0xd3d3('0x37'))){_0x5a0b54[_0xd3d3('0x1f')]=qs[_0xd3d3('0x1f')](_0x4bf952[_0xd3d3('0x2f')]['limit']);_0x5a0b54[_0xd3d3('0x1d')]=qs['offset'](_0x4bf952['query'][_0xd3d3('0x1d')]);}_0x5a0b54[_0xd3d3('0x38')]=qs[_0xd3d3('0x39')](_0x4bf952['query'][_0xd3d3('0x39')]);_0x5a0b54[_0xd3d3('0x3a')]=qs[_0xd3d3('0x31')](_[_0xd3d3('0x3b')](_0x4bf952[_0xd3d3('0x2f')],_0x1885bc[_0xd3d3('0x31')]),_0x11a500);if(_0x4bf952[_0xd3d3('0x2f')][_0xd3d3('0x3c')]){_0x5a0b54[_0xd3d3('0x3a')]=_[_0xd3d3('0x3d')](_0x5a0b54['where'],{'$or':_[_0xd3d3('0x29')](_0x11a500,function(_0x4f74e7){if(_0x4f74e7[_0xd3d3('0x2d')]!=='VIRTUAL'){var _0x43a704={};_0x43a704[_0x4f74e7['name']]={'$like':'%'+_0x4bf952[_0xd3d3('0x2f')][_0xd3d3('0x3c')]+'%'};return _0x43a704;}})});}_0x5a0b54=_[_0xd3d3('0x3d')]({},_0x5a0b54,_0x4bf952[_0xd3d3('0x3e')]);var _0x80e8f0={'where':_0x5a0b54[_0xd3d3('0x3a')]};return db[_0xd3d3('0x2a')]['count'](_0x80e8f0)[_0xd3d3('0x25')](function(_0x8a671d){_0x2c6aef[_0xd3d3('0x1e')]=_0x8a671d;if(_0x4bf952['query'][_0xd3d3('0x3f')]){_0x5a0b54[_0xd3d3('0x40')]=[{'all':!![]}];}return db[_0xd3d3('0x2a')][_0xd3d3('0x41')](_0x5a0b54);})[_0xd3d3('0x25')](function(_0x32a3dd){_0x2c6aef[_0xd3d3('0x42')]=_0x32a3dd;return _0x2c6aef;})[_0xd3d3('0x25')](respondWithFilteredResult(_0xb58ef5,_0x5a0b54))[_0xd3d3('0x43')](handleError(_0xb58ef5,null));};exports[_0xd3d3('0x44')]=function(_0x17069f,_0x49d8fb){var _0x683687={'raw':![],'where':{'id':_0x17069f[_0xd3d3('0x45')]['id']}},_0x4db36b={};_0x4db36b[_0xd3d3('0x33')]=_['keys'](db[_0xd3d3('0x2a')]['rawAttributes']);_0x4db36b[_0xd3d3('0x2f')]=_['keys'](_0x17069f['query']);_0x4db36b[_0xd3d3('0x31')]=_[_0xd3d3('0x32')](_0x4db36b[_0xd3d3('0x33')],_0x4db36b['query']);_0x683687['attributes']=_[_0xd3d3('0x32')](_0x4db36b[_0xd3d3('0x33')],qs[_0xd3d3('0x35')](_0x17069f[_0xd3d3('0x2f')][_0xd3d3('0x35')]));_0x683687['attributes']=_0x683687[_0xd3d3('0x34')][_0xd3d3('0x36')]?_0x683687['attributes']:_0x4db36b[_0xd3d3('0x33')];if(_0x17069f['query']['includeAll']){_0x683687[_0xd3d3('0x40')]=[{'all':!![]}];}_0x683687=_['merge']({},_0x683687,_0x17069f[_0xd3d3('0x3e')]);return db[_0xd3d3('0x2a')][_0xd3d3('0x46')](_0x683687)[_0xd3d3('0x25')](handleEntityNotFound(_0x49d8fb,null))['then'](respondWithResult(_0x49d8fb,null))[_0xd3d3('0x43')](handleError(_0x49d8fb,null));};exports[_0xd3d3('0x47')]=function(_0x4dda19,_0x1418aa){return db[_0xd3d3('0x2a')][_0xd3d3('0x47')](_0x4dda19['body'],{})[_0xd3d3('0x25')](respondWithResult(_0x1418aa,0xc9))[_0xd3d3('0x43')](handleError(_0x1418aa,null));};exports[_0xd3d3('0x24')]=function(_0x45bbcc,_0x276f83){if(_0x45bbcc[_0xd3d3('0x48')]['id']){delete _0x45bbcc[_0xd3d3('0x48')]['id'];}return db[_0xd3d3('0x2a')][_0xd3d3('0x46')]({'where':{'id':_0x45bbcc[_0xd3d3('0x45')]['id']}})[_0xd3d3('0x25')](handleEntityNotFound(_0x276f83,null))[_0xd3d3('0x25')](saveUpdates(_0x45bbcc['body'],null))['then'](respondWithResult(_0x276f83,null))[_0xd3d3('0x43')](handleError(_0x276f83,null));};exports[_0xd3d3('0x49')]=function(_0x475e77,_0x47c359){return db[_0xd3d3('0x2a')][_0xd3d3('0x46')]({'where':{'id':_0x475e77['params']['id']}})[_0xd3d3('0x25')](handleEntityNotFound(_0x47c359,null))['then'](removeEntity(_0x47c359,null))[_0xd3d3('0x43')](handleError(_0x47c359,null));};exports[_0xd3d3('0x4a')]=function(_0x3cd549,_0x2f8960,_0x4ac422){var _0x7df41d={};var _0x5245ae={};var _0x2782c2;var _0x592ae1;return db['VtigerAccount'][_0xd3d3('0x4b')]({'where':{'id':_0x3cd549[_0xd3d3('0x45')]['id']}})[_0xd3d3('0x25')](handleEntityNotFound(_0x2f8960,null))[_0xd3d3('0x25')](function(_0x2eff05){if(_0x2eff05){_0x2782c2=_0x2eff05;_0x5245ae['model']=_['keys'](db['VtigerConfiguration'][_0xd3d3('0x2b')]);_0x5245ae[_0xd3d3('0x2f')]=_['keys'](_0x3cd549[_0xd3d3('0x2f')]);_0x5245ae['filters']=_['intersection'](_0x5245ae['model'],_0x5245ae['query']);_0x7df41d[_0xd3d3('0x34')]=_[_0xd3d3('0x32')](_0x5245ae[_0xd3d3('0x33')],qs[_0xd3d3('0x35')](_0x3cd549['query'][_0xd3d3('0x35')]));_0x7df41d[_0xd3d3('0x34')]=_0x7df41d[_0xd3d3('0x34')][_0xd3d3('0x36')]?_0x7df41d[_0xd3d3('0x34')]:_0x5245ae['model'];_0x7df41d['order']=qs[_0xd3d3('0x39')](_0x3cd549['query'][_0xd3d3('0x39')]);_0x7df41d['where']=qs[_0xd3d3('0x31')](_[_0xd3d3('0x3b')](_0x3cd549[_0xd3d3('0x2f')],_0x5245ae[_0xd3d3('0x31')]));if(_0x3cd549['query']['filter']){_0x7df41d['where']=_[_0xd3d3('0x3d')](_0x7df41d[_0xd3d3('0x3a')],{'$or':_[_0xd3d3('0x29')](_0x7df41d[_0xd3d3('0x34')],function(_0x37bcb2){var _0x3cfb51={};_0x3cfb51[_0x37bcb2]={'$like':'%'+_0x3cd549[_0xd3d3('0x2f')][_0xd3d3('0x3c')]+'%'};return _0x3cfb51;})});}_0x7df41d=_[_0xd3d3('0x3d')]({},_0x7df41d,_0x3cd549['options']);return _0x2782c2[_0xd3d3('0x4a')](_0x7df41d);}})[_0xd3d3('0x25')](function(_0x2d9d93){if(_0x2d9d93){_0x592ae1=_0x2d9d93[_0xd3d3('0x36')];if(!_0x3cd549[_0xd3d3('0x2f')][_0xd3d3('0x4c')](_0xd3d3('0x37'))){_0x7df41d[_0xd3d3('0x1f')]=qs[_0xd3d3('0x1f')](_0x3cd549['query'][_0xd3d3('0x1f')]);_0x7df41d[_0xd3d3('0x1d')]=qs[_0xd3d3('0x1d')](_0x3cd549[_0xd3d3('0x2f')]['offset']);}return _0x2782c2['getConfigurations'](_0x7df41d);}})[_0xd3d3('0x25')](function(_0x9fe03a){if(_0x9fe03a){return _0x9fe03a?{'count':_0x592ae1,'rows':_0x9fe03a}:null;}})[_0xd3d3('0x25')](respondWithResult(_0x2f8960,null))[_0xd3d3('0x43')](handleError(_0x2f8960,null));};exports[_0xd3d3('0x4d')]=function(_0xe69b86,_0x25dbfb,_0x16b693){if(_0xe69b86['body']['id']){delete _0xe69b86[_0xd3d3('0x48')]['id'];}return db[_0xd3d3('0x2a')][_0xd3d3('0x4b')]({'where':{'id':_0xe69b86[_0xd3d3('0x45')]['id']}})[_0xd3d3('0x25')](handleEntityNotFound(_0x25dbfb,null))['then'](function(_0x11974f){if(_0x11974f){_0xe69b86[_0xd3d3('0x48')]['AccountId']=_0x11974f['id'];_0xe69b86['body'][_0xd3d3('0x4e')]=integrations[_0xd3d3('0x4f')](_0xe69b86[_0xd3d3('0x48')][_0xd3d3('0x50')],_0xe69b86[_0xd3d3('0x48')][_0xd3d3('0x2d')]);_0xe69b86[_0xd3d3('0x48')]['Descriptions']=integrations[_0xd3d3('0x51')](_0xe69b86[_0xd3d3('0x48')]['channel'],_0xe69b86[_0xd3d3('0x48')]['type']);return db['VtigerConfiguration']['create'](_0xe69b86[_0xd3d3('0x48')],{'include':[{'model':db[_0xd3d3('0x52')],'as':_0xd3d3('0x4e')},{'model':db[_0xd3d3('0x52')],'as':_0xd3d3('0x53')}]});}return null;})[_0xd3d3('0x25')](respondWithResult(_0x25dbfb,null))[_0xd3d3('0x43')](handleError(_0x25dbfb,null));};var md5=require(_0xd3d3('0x54'));exports[_0xd3d3('0x55')]=function(_0x31a720,_0x151ee0,_0x24396f){var _0x501c85=null;var _0x13ed53=null;var _0xed4e6f=null;var _0x9387f0=null;var _0x7765ca='';return db['VtigerAccount'][_0xd3d3('0x4b')]({'where':{'id':_0x31a720['params']['id']},'attributes':['id',_0xd3d3('0x26'),'username',_0xd3d3('0x56'),_0xd3d3('0x57'),'remoteUri',_0xd3d3('0x58'),'accessKey']})[_0xd3d3('0x25')](handleEntityNotFound(_0x151ee0,null))[_0xd3d3('0x25')](function(_0x1b3f2a){if(_0x1b3f2a){_0x501c85=_0x1b3f2a[_0xd3d3('0x59')];_0x13ed53=_0x1b3f2a['accessKey'];_0xed4e6f=_0x1b3f2a[_0xd3d3('0x57')];_0x7765ca=_0x1b3f2a['remoteUri'];var _0x44616c=_0x7765ca[_0xd3d3('0x5a')](-0x1);if(_0x44616c==='/'){_0x7765ca=_0x7765ca['substring'](0x0,_0x7765ca[_0xd3d3('0x5b')](_0x44616c));}_0x9387f0=util[_0xd3d3('0x5c')]('%s/webservice.php',_0x7765ca);var _0x27757d={'method':_0xd3d3('0x5d'),'uri':_0x9387f0,'qs':{'operation':_0xd3d3('0x5e'),'username':_0x1b3f2a['username']},'json':!![]};return rp(_0x27757d);}})[_0xd3d3('0x25')](function(_0x57c645){if(_0x57c645['success']){var _0x53aae7={'method':_0xd3d3('0x5f'),'uri':_0x9387f0,'form':{'operation':_0xd3d3('0x60'),'username':_0x501c85,'accessKey':md5(_0x57c645[_0xd3d3('0x61')][_0xd3d3('0x62')]+_0x13ed53)},'json':!![]};return rp(_0x53aae7);}})[_0xd3d3('0x25')](function(_0xecd8d8){if(_0xecd8d8['success']){var _0x49904e={'method':_0xd3d3('0x5d'),'uri':_0x9387f0,'qs':{'operation':_0xd3d3('0x63'),'username':_0x501c85,'sessionName':_0xecd8d8[_0xd3d3('0x61')][_0xd3d3('0x64')],'elementType':_0xed4e6f},'json':!![]};return rp(_0x49904e);}})[_0xd3d3('0x25')](function(_0x28e077){if(_0x28e077[_0xd3d3('0x65')]){var _0x2a224e=[_0xd3d3('0x66'),_0xd3d3('0x67'),_0xd3d3('0x68')];_[_0xd3d3('0x69')](_0x28e077[_0xd3d3('0x61')]['fields'],function(_0x42b185){return _0x2a224e['includes'](_0x42b185['type'][_0xd3d3('0x26')]);});_[_0xd3d3('0x69')](_0x28e077[_0xd3d3('0x61')][_0xd3d3('0x35')],function(_0x184d40){return _0x184d40[_0xd3d3('0x6a')]===_0xd3d3('0x6b');});return{'count':_0x28e077[_0xd3d3('0x61')][_0xd3d3('0x35')][_0xd3d3('0x36')],'rows':_[_0xd3d3('0x29')](_0x28e077[_0xd3d3('0x61')]['fields'],function(_0x210f5f){return{'id':_0x210f5f[_0xd3d3('0x26')],'name':_0x210f5f[_0xd3d3('0x6c')],'custom':_['startsWith'](_0x210f5f[_0xd3d3('0x26')],_0xd3d3('0x6d'))?!![]:![],'options':_0x210f5f[_0xd3d3('0x2d')][_0xd3d3('0x26')]===_0xd3d3('0x6e')&&_0x210f5f[_0xd3d3('0x2d')]['picklistValues']['length']>0x0?_[_0xd3d3('0x29')](_0x210f5f[_0xd3d3('0x2d')][_0xd3d3('0x6f')],function(_0x19be8b){return{'name':_0x19be8b[_0xd3d3('0x6c')],'value':_0x19be8b['value']};}):[]};})};}})[_0xd3d3('0x25')](respondWithResult(_0x151ee0,null))[_0xd3d3('0x43')](function(_0x3c5599){console[_0xd3d3('0x70')](_0xd3d3('0x71')+_0x3c5599);var _0x21ef61=_0x31a720['query'][_0xd3d3('0x72')]?0x1f4:_0x3c5599[_0xd3d3('0x73')]||0x1f4;logger[_0xd3d3('0x74')](_0xd3d3('0x75'),_0xd3d3('0x55'),_0x21ef61,JSON[_0xd3d3('0x76')](_0x3c5599));delete _0x3c5599['name'];if(_0x21ef61===0x191){_0x21ef61=0x190;}_0x151ee0[_0xd3d3('0x1b')](_0x21ef61)[_0xd3d3('0x27')](_0x31a720['query'][_0xd3d3('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x3c5599['statusCode']}:_0x3c5599);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 1e88d66..433a8ef 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 _0xa1bb=['VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x509548,_0x183f40){var _0x380d59=function(_0x51a5ff){while(--_0x51a5ff){_0x509548['push'](_0x509548['shift']());}};_0x380d59(++_0x183f40);}(_0xa1bb,0x136));var _0xba1b=function(_0x424059,_0x1af682){_0x424059=_0x424059-0x0;var _0x4f7d28=_0xa1bb[_0x424059];return _0x4f7d28;};'use strict';var _=require('lodash');var util=require(_0xba1b('0x0'));var logger=require(_0xba1b('0x1'))(_0xba1b('0x2'));var moment=require('moment');var BPromise=require(_0xba1b('0x3'));var rp=require(_0xba1b('0x4'));var fs=require('fs');var path=require(_0xba1b('0x5'));var rimraf=require(_0xba1b('0x6'));var config=require(_0xba1b('0x7'));var attributes=require(_0xba1b('0x8'));var integrations=require(_0xba1b('0x9'));module[_0xba1b('0xa')]=function(_0x5bba9d,_0x3cad35){return _0x5bba9d[_0xba1b('0xb')](_0xba1b('0xc'),attributes,{'tableName':_0xba1b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33ec=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','define','VtigerAccount'];(function(_0x43a874,_0x4d90eb){var _0x5a75f9=function(_0x2e3f14){while(--_0x2e3f14){_0x43a874['push'](_0x43a874['shift']());}};_0x5a75f9(++_0x4d90eb);}(_0x33ec,0x96));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc33e('0x0'));var logger=require(_0xc33e('0x1'))(_0xc33e('0x2'));var moment=require('moment');var BPromise=require(_0xc33e('0x3'));var rp=require(_0xc33e('0x4'));var fs=require('fs');var path=require(_0xc33e('0x5'));var rimraf=require('rimraf');var config=require(_0xc33e('0x6'));var attributes=require(_0xc33e('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3d2a98,_0x1d6fbc){return _0x3d2a98[_0xc33e('0x8')](_0xc33e('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 9311faf..3be0782 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 _0x0abf=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowVtigerAccount','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x53e8af,_0x3fade5){var _0x5cbc77=function(_0x59bf9e){while(--_0x59bf9e){_0x53e8af['push'](_0x53e8af['shift']());}};_0x5cbc77(++_0x3fade5);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0abf[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')]({'raw':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1a')]||null:null,'attributes':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')]['attributes']||null:null,'limit':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1b')]||null:null,'include':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x18bb37){return{'model':db[_0x18bb37[_0xf0ab('0x1e')]],'as':_0x18bb37['as'],'attributes':_0x18bb37['attributes'],'include':_0x18bb37['include']?_['map'](_0x18bb37[_0xf0ab('0x1c')],function(_0x4f0caf){return{'model':db[_0x4f0caf[_0xf0ab('0x1e')]],'as':_0x4f0caf['as'],'attributes':_0x4f0caf[_0xf0ab('0x1f')],'include':_0x4f0caf['include']?_[_0xf0ab('0x1d')](_0x4f0caf[_0xf0ab('0x1c')],function(_0x10bf5f){return{'model':db[_0x10bf5f[_0xf0ab('0x1e')]],'as':_0x10bf5f['as'],'attributes':_0x10bf5f[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0da7){logger['info']('GetVtigerAccount',_0x1803f0);logger[_0xf0ab('0x20')](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x2d0da7));_0x776619(_0x2d0da7);})[_0xf0ab('0x14')](function(_0x43476c){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x43476c[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x43476c[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x21')]=function(_0x199753){var _0x58cbe1=this;return new Promise(function(_0x1e1ffb,_0x35973a){return db['VtigerAccount']['find']({'raw':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x199753['options']?_0x199753['options'][_0xf0ab('0x1a')]||null:null,'attributes':_0x199753['options']?_0x199753[_0xf0ab('0x18')]['attributes']||null:null,'include':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')]['include']?_['map'](_0x199753[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x2a3fac){return{'model':db[_0x2a3fac[_0xf0ab('0x1e')]],'as':_0x2a3fac['as'],'attributes':_0x2a3fac[_0xf0ab('0x1f')],'include':_0x2a3fac[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a3fac[_0xf0ab('0x1c')],function(_0x2a2f5d){return{'model':db[_0x2a2f5d[_0xf0ab('0x1e')]],'as':_0x2a2f5d['as'],'attributes':_0x2a2f5d[_0xf0ab('0x1f')],'include':_0x2a2f5d[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a2f5d[_0xf0ab('0x1c')],function(_0x5d8443){return{'model':db[_0x5d8443[_0xf0ab('0x1e')]],'as':_0x5d8443['as'],'attributes':_0x5d8443[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf0ab('0x22')](function(_0x5c9192){logger[_0xf0ab('0xb')](_0xf0ab('0x21'),_0x199753);logger[_0xf0ab('0x20')]('ShowVtigerAccount',_0x199753,JSON[_0xf0ab('0xe')](_0x5c9192));_0x1e1ffb(_0x5c9192);})['catch'](function(_0xda3971){logger['error'](_0xf0ab('0x21'),_0xda3971[_0xf0ab('0x11')],_0x199753);_0x35973a(_0x58cbe1[_0xf0ab('0xf')](0x1f4,_0xda3971[_0xf0ab('0x11')]));});});}; \ No newline at end of file +var _0xed3c=['catch','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xed3c,0x1a6));var _0xced3=function(_0x1ec1fa,_0x3efb52){_0x1ec1fa=_0x1ec1fa-0x0;var _0x3e00f0=_0xed3c[_0x1ec1fa];return _0x3e00f0;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4795cd,_0x510164,_0x5ca701){return new BPromise(function(_0x851bd3,_0x5f2f90){return client['request'](_0x4795cd,_0x5ca701)['then'](function(_0x19a727){logger[_0xced3('0xb')](_0xced3('0xc'),_0x510164,_0xced3('0xd'));logger[_0xced3('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x510164,_0xced3('0xd'),JSON[_0xced3('0xf')](_0x19a727));if(_0x19a727[_0xced3('0x10')]){if(_0x19a727['error'][_0xced3('0x11')]===0x1f4){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);return _0x5f2f90(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}logger['error'](_0xced3('0xc'),_0x510164,_0x19a727['error'][_0xced3('0x12')]);return _0x851bd3(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}else{logger[_0xced3('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x510164,_0xced3('0xd'));_0x851bd3(_0x19a727[_0xced3('0x13')]['message']);}})[_0xced3('0x14')](function(_0x37e2d5){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x37e2d5);_0x5f2f90(_0x37e2d5);});});}exports['GetVtigerAccount']=function(_0x4569af){var _0x4a3afe=this;return new Promise(function(_0x353580,_0x4480a6){return db[_0xced3('0x15')][_0xced3('0x16')]({'raw':_0x4569af[_0xced3('0x17')]?_0x4569af[_0xced3('0x17')][_0xced3('0x18')]===undefined?!![]:![]:!![],'where':_0x4569af[_0xced3('0x17')]?_0x4569af[_0xced3('0x17')][_0xced3('0x19')]||null:null,'attributes':_0x4569af[_0xced3('0x17')]?_0x4569af['options']['attributes']||null:null,'limit':_0x4569af['options']?_0x4569af[_0xced3('0x17')][_0xced3('0x1a')]||null:null,'include':_0x4569af[_0xced3('0x17')]?_0x4569af['options'][_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x4569af['options']['include'],function(_0x3adf14){return{'model':db[_0x3adf14[_0xced3('0x1d')]],'as':_0x3adf14['as'],'attributes':_0x3adf14[_0xced3('0x1e')],'include':_0x3adf14[_0xced3('0x1b')]?_['map'](_0x3adf14[_0xced3('0x1b')],function(_0x23f92b){return{'model':db[_0x23f92b['model']],'as':_0x23f92b['as'],'attributes':_0x23f92b[_0xced3('0x1e')],'include':_0x23f92b['include']?_[_0xced3('0x1c')](_0x23f92b[_0xced3('0x1b')],function(_0x3b728d){return{'model':db[_0x3b728d[_0xced3('0x1d')]],'as':_0x3b728d['as'],'attributes':_0x3b728d[_0xced3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5454c0){logger[_0xced3('0xb')]('GetVtigerAccount',_0x4569af);logger[_0xced3('0xe')](_0xced3('0x1f'),_0x4569af,JSON['stringify'](_0x5454c0));_0x353580(_0x5454c0);})[_0xced3('0x14')](function(_0x4024fa){logger[_0xced3('0x10')](_0xced3('0x1f'),_0x4024fa[_0xced3('0x12')],_0x4569af);_0x4480a6(_0x4a3afe[_0xced3('0x10')](0x1f4,_0x4024fa[_0xced3('0x12')]));});});};exports[_0xced3('0x20')]=function(_0x116cc7){var _0x559b8e=this;return new Promise(function(_0xa78899,_0x1b8baa){return db[_0xced3('0x15')][_0xced3('0x21')]({'raw':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x18')]===undefined?!![]:![]:!![],'where':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x19')]||null:null,'attributes':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x1e')]||null:null,'include':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x116cc7[_0xced3('0x17')][_0xced3('0x1b')],function(_0xcd0fe3){return{'model':db[_0xcd0fe3[_0xced3('0x1d')]],'as':_0xcd0fe3['as'],'attributes':_0xcd0fe3['attributes'],'include':_0xcd0fe3[_0xced3('0x1b')]?_['map'](_0xcd0fe3[_0xced3('0x1b')],function(_0x28f674){return{'model':db[_0x28f674[_0xced3('0x1d')]],'as':_0x28f674['as'],'attributes':_0x28f674[_0xced3('0x1e')],'include':_0x28f674[_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x28f674[_0xced3('0x1b')],function(_0x340be1){return{'model':db[_0x340be1[_0xced3('0x1d')]],'as':_0x340be1['as'],'attributes':_0x340be1[_0xced3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x342c11){logger[_0xced3('0xb')]('ShowVtigerAccount',_0x116cc7);logger[_0xced3('0xe')](_0xced3('0x20'),_0x116cc7,JSON[_0xced3('0xf')](_0x342c11));_0xa78899(_0x342c11);})['catch'](function(_0x59c3aa){logger[_0xced3('0x10')]('ShowVtigerAccount',_0x59c3aa[_0xced3('0x12')],_0x116cc7);_0x1b8baa(_0x559b8e[_0xced3('0x10')](0x1f4,_0x59c3aa['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 23dd3e0..83cc942 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 _0x5a2b=['/:id/descriptions','getDescriptions','post','put','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5a2b,0xf8));var _0xb5a2=function(_0x2702cb,_0x2ee131){_0x2702cb=_0x2702cb-0x0;var _0x16da7c=_0x5a2b[_0x2702cb];return _0x16da7c;};'use strict';var multer=require('multer');var util=require(_0xb5a2('0x0'));var path=require('path');var timeout=require(_0xb5a2('0x1'));var express=require(_0xb5a2('0x2'));var router=express[_0xb5a2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb5a2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb5a2('0x5'));var controller=require(_0xb5a2('0x6'));router[_0xb5a2('0x7')]('/',auth[_0xb5a2('0x8')](),controller['index']);router[_0xb5a2('0x7')]('/:id',auth[_0xb5a2('0x8')](),controller[_0xb5a2('0x9')]);router['get'](_0xb5a2('0xa'),auth[_0xb5a2('0x8')](),controller[_0xb5a2('0xb')]);router[_0xb5a2('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xb5a2('0x7')](_0xb5a2('0xc'),auth['isAuthenticated'](),controller[_0xb5a2('0xd')]);router[_0xb5a2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb5a2('0xf')]('/:id',auth[_0xb5a2('0x8')](),controller['update']);router[_0xb5a2('0x10')](_0xb5a2('0x11'),auth[_0xb5a2('0x8')](),controller[_0xb5a2('0x12')]);module[_0xb5a2('0x13')]=router; \ No newline at end of file +var _0x2430=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2430,0x131));var _0x0243=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x2430[_0x35d8af];return _0x1d08b0;};'use strict';var multer=require(_0x0243('0x0'));var util=require(_0x0243('0x1'));var path=require(_0x0243('0x2'));var timeout=require(_0x0243('0x3'));var express=require('express');var router=express[_0x0243('0x4')]();var fs_extra=require(_0x0243('0x5'));var auth=require(_0x0243('0x6'));var interaction=require(_0x0243('0x7'));var config=require('../../config/environment');var controller=require(_0x0243('0x8'));router[_0x0243('0x9')]('/',auth['isAuthenticated'](),controller[_0x0243('0xa')]);router[_0x0243('0x9')]('/:id',auth[_0x0243('0xb')](),controller[_0x0243('0xc')]);router[_0x0243('0x9')](_0x0243('0xd'),auth[_0x0243('0xb')](),controller['getFields']);router[_0x0243('0x9')]('/:id/subjects',auth[_0x0243('0xb')](),controller[_0x0243('0xe')]);router[_0x0243('0x9')](_0x0243('0xf'),auth['isAuthenticated'](),controller[_0x0243('0x10')]);router[_0x0243('0x11')]('/',auth['isAuthenticated'](),controller[_0x0243('0x12')]);router[_0x0243('0x13')]('/:id',auth[_0x0243('0xb')](),controller[_0x0243('0x14')]);router['delete']('/:id',auth[_0x0243('0xb')](),controller[_0x0243('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 58e3908..76a0566 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 _0x2474=['exports','STRING'];(function(_0x3a4794,_0x95f9e0){var _0x54929f=function(_0x191839){while(--_0x191839){_0x3a4794['push'](_0x3a4794['shift']());}};_0x54929f(++_0x95f9e0);}(_0x2474,0x1ee));var _0x4247=function(_0x3dc359,_0x29709e){_0x3dc359=_0x3dc359-0x0;var _0x4e75cd=_0x2474[_0x3dc359];return _0x4e75cd;};'use strict';var Sequelize=require('sequelize');module[_0x4247('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4247('0x1')]}}; \ No newline at end of file +var _0xf851=['sequelize','STRING'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0xf851,0x80));var _0x1f85=function(_0x38cd4c,_0x2702cf){_0x38cd4c=_0x38cd4c-0x0;var _0x31f5a4=_0xf851[_0x38cd4c];return _0x31f5a4;};'use strict';var Sequelize=require(_0x1f85('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f85('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3dbf896..5b8e1b6 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 _0x6719=['findOne','hasOwnProperty','getSubjects','VtigerField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','name','send','index','map','VtigerConfiguration','type','query','keys','intersection','attributes','model','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','show','rawAttributes','length','includeAll','find','catch','create','body','params','getFields'];(function(_0x1621d8,_0x4756bf){var _0x6883c7=function(_0x3ed06c){while(--_0x3ed06c){_0x1621d8['push'](_0x1621d8['shift']());}};_0x6883c7(++_0x4756bf);}(_0x6719,0x139));var _0x9671=function(_0xb0c152,_0x1d37a9){_0xb0c152=_0xb0c152-0x0;var _0x2fc458=_0x6719[_0xb0c152];return _0x2fc458;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9671('0x0'));var zipdir=require(_0x9671('0x1'));var jsonpatch=require(_0x9671('0x2'));var rp=require(_0x9671('0x3'));var moment=require(_0x9671('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9671('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9671('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9671('0x7'));var _=require(_0x9671('0x8'));var squel=require(_0x9671('0x9'));var crypto=require(_0x9671('0xa'));var jsforce=require(_0x9671('0xb'));var deskjs=require(_0x9671('0xc'));var toCsv=require(_0x9671('0x6'));var querystring=require(_0x9671('0xd'));var Papa=require(_0x9671('0xe'));var Redis=require(_0x9671('0xf'));var authService=require(_0x9671('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9671('0x11'));var hardwareService=require(_0x9671('0x12'));var logger=require(_0x9671('0x13'))(_0x9671('0x14'));var utils=require(_0x9671('0x15'));var config=require(_0x9671('0x16'));var licenseUtil=require(_0x9671('0x17'));var db=require(_0x9671('0x18'))['db'];function respondWithStatusCode(_0x4fd91b,_0xd91700){_0xd91700=_0xd91700||0xcc;return function(_0x5ed7f3){if(_0x5ed7f3){return _0x4fd91b[_0x9671('0x19')](_0xd91700);}return _0x4fd91b[_0x9671('0x1a')](_0xd91700)[_0x9671('0x1b')]();};}function respondWithResult(_0x35a86b,_0x285dc0){_0x285dc0=_0x285dc0||0xc8;return function(_0x10fd9d){if(_0x10fd9d){return _0x35a86b[_0x9671('0x1a')](_0x285dc0)[_0x9671('0x1c')](_0x10fd9d);}};}function respondWithFilteredResult(_0x843045,_0xcd2b35){return function(_0x2c5da7){if(_0x2c5da7){var _0x3c552c=typeof _0xcd2b35['offset']==='undefined'&&typeof _0xcd2b35[_0x9671('0x1d')]===_0x9671('0x1e');var _0x20a4d0=_0x2c5da7[_0x9671('0x1f')];var _0x2e94b8=_0x3c552c?0x0:_0xcd2b35[_0x9671('0x20')];var _0x51c1c2=_0x3c552c?_0x2c5da7[_0x9671('0x1f')]:_0xcd2b35[_0x9671('0x20')]+_0xcd2b35['limit'];var _0xc78244;if(_0x51c1c2>=_0x20a4d0){_0x51c1c2=_0x20a4d0;_0xc78244=0xc8;}else{_0xc78244=0xce;}_0x843045['status'](_0xc78244);return _0x843045[_0x9671('0x21')](_0x9671('0x22'),_0x2e94b8+'-'+_0x51c1c2+'/'+_0x20a4d0)[_0x9671('0x1c')](_0x2c5da7);}return null;};}function patchUpdates(_0x1c57ac){return function(_0x9196d9){try{jsonpatch[_0x9671('0x23')](_0x9196d9,_0x1c57ac,!![]);}catch(_0x4864c3){return BPromise[_0x9671('0x24')](_0x4864c3);}return _0x9196d9['save']();};}function saveUpdates(_0x20af1f,_0x59c964){return function(_0x8a17f2){if(_0x8a17f2){return _0x8a17f2['update'](_0x20af1f)[_0x9671('0x25')](function(_0x58d389){return _0x58d389;});}return null;};}function removeEntity(_0x1a4c0a,_0x4bfce2){return function(_0x15bf58){if(_0x15bf58){return _0x15bf58[_0x9671('0x26')]()[_0x9671('0x25')](function(){_0x1a4c0a['status'](0xcc)[_0x9671('0x1b')]();});}};}function handleEntityNotFound(_0x598e42,_0x4024b5){return function(_0x515c62){if(!_0x515c62){_0x598e42[_0x9671('0x19')](0x194);}return _0x515c62;};}function handleError(_0x45633a,_0x146127){_0x146127=_0x146127||0x1f4;return function(_0x3d10fb){logger['error'](_0x3d10fb['stack']);if(_0x3d10fb[_0x9671('0x27')]){delete _0x3d10fb[_0x9671('0x27')];}_0x45633a[_0x9671('0x1a')](_0x146127)[_0x9671('0x28')](_0x3d10fb);};}exports[_0x9671('0x29')]=function(_0x40c82c,_0x56a5f2){var _0x341f94={},_0x19f30d={},_0x27eb0c={'count':0x0,'rows':[]};var _0x5d7957=_[_0x9671('0x2a')](db[_0x9671('0x2b')]['rawAttributes'],function(_0x3395c4){return{'name':_0x3395c4['fieldName'],'type':_0x3395c4[_0x9671('0x2c')]['key']};});_0x19f30d['model']=_['map'](_0x5d7957,_0x9671('0x27'));_0x19f30d[_0x9671('0x2d')]=_[_0x9671('0x2e')](_0x40c82c[_0x9671('0x2d')]);_0x19f30d['filters']=_[_0x9671('0x2f')](_0x19f30d['model'],_0x19f30d[_0x9671('0x2d')]);_0x341f94[_0x9671('0x30')]=_[_0x9671('0x2f')](_0x19f30d[_0x9671('0x31')],qs['fields'](_0x40c82c[_0x9671('0x2d')][_0x9671('0x32')]));_0x341f94[_0x9671('0x30')]=_0x341f94[_0x9671('0x30')]['length']?_0x341f94[_0x9671('0x30')]:_0x19f30d[_0x9671('0x31')];if(!_0x40c82c[_0x9671('0x2d')]['hasOwnProperty'](_0x9671('0x33'))){_0x341f94[_0x9671('0x1d')]=qs[_0x9671('0x1d')](_0x40c82c[_0x9671('0x2d')][_0x9671('0x1d')]);_0x341f94[_0x9671('0x20')]=qs[_0x9671('0x20')](_0x40c82c[_0x9671('0x2d')][_0x9671('0x20')]);}_0x341f94[_0x9671('0x34')]=qs[_0x9671('0x35')](_0x40c82c[_0x9671('0x2d')][_0x9671('0x35')]);_0x341f94[_0x9671('0x36')]=qs[_0x9671('0x37')](_[_0x9671('0x38')](_0x40c82c['query'],_0x19f30d[_0x9671('0x37')]),_0x5d7957);if(_0x40c82c['query'][_0x9671('0x39')]){_0x341f94['where']=_['merge'](_0x341f94[_0x9671('0x36')],{'$or':_[_0x9671('0x2a')](_0x5d7957,function(_0x2c752f){if(_0x2c752f[_0x9671('0x2c')]!==_0x9671('0x3a')){var _0xa5ed54={};_0xa5ed54[_0x2c752f[_0x9671('0x27')]]={'$like':'%'+_0x40c82c[_0x9671('0x2d')][_0x9671('0x39')]+'%'};return _0xa5ed54;}})});}_0x341f94=_[_0x9671('0x3b')]({},_0x341f94,_0x40c82c[_0x9671('0x3c')]);var _0x79b82a={'where':_0x341f94[_0x9671('0x36')]};return db[_0x9671('0x2b')][_0x9671('0x1f')](_0x79b82a)[_0x9671('0x25')](function(_0x161fc9){_0x27eb0c[_0x9671('0x1f')]=_0x161fc9;if(_0x40c82c[_0x9671('0x2d')]['includeAll']){_0x341f94[_0x9671('0x3d')]=[{'all':!![]}];}return db[_0x9671('0x2b')]['findAll'](_0x341f94);})[_0x9671('0x25')](function(_0x5b1901){_0x27eb0c['rows']=_0x5b1901;return _0x27eb0c;})[_0x9671('0x25')](respondWithFilteredResult(_0x56a5f2,_0x341f94))['catch'](handleError(_0x56a5f2,null));};exports[_0x9671('0x3e')]=function(_0x1782c7,_0x1c0399){var _0x1fadaf={'raw':![],'where':{'id':_0x1782c7['params']['id']}},_0x34078e={};_0x34078e[_0x9671('0x31')]=_[_0x9671('0x2e')](db[_0x9671('0x2b')][_0x9671('0x3f')]);_0x34078e[_0x9671('0x2d')]=_['keys'](_0x1782c7[_0x9671('0x2d')]);_0x34078e[_0x9671('0x37')]=_['intersection'](_0x34078e[_0x9671('0x31')],_0x34078e[_0x9671('0x2d')]);_0x1fadaf['attributes']=_['intersection'](_0x34078e[_0x9671('0x31')],qs[_0x9671('0x32')](_0x1782c7[_0x9671('0x2d')]['fields']));_0x1fadaf[_0x9671('0x30')]=_0x1fadaf[_0x9671('0x30')][_0x9671('0x40')]?_0x1fadaf[_0x9671('0x30')]:_0x34078e['model'];if(_0x1782c7['query'][_0x9671('0x41')]){_0x1fadaf['include']=[{'all':!![]}];}_0x1fadaf=_[_0x9671('0x3b')]({},_0x1fadaf,_0x1782c7[_0x9671('0x3c')]);return db[_0x9671('0x2b')][_0x9671('0x42')](_0x1fadaf)[_0x9671('0x25')](handleEntityNotFound(_0x1c0399,null))[_0x9671('0x25')](respondWithResult(_0x1c0399,null))[_0x9671('0x43')](handleError(_0x1c0399,null));};exports[_0x9671('0x44')]=function(_0xec2656,_0x46c285){return db[_0x9671('0x2b')]['create'](_0xec2656[_0x9671('0x45')],{})[_0x9671('0x25')](respondWithResult(_0x46c285,0xc9))[_0x9671('0x43')](handleError(_0x46c285,null));};exports['update']=function(_0x194241,_0x585dc9){if(_0x194241[_0x9671('0x45')]['id']){delete _0x194241[_0x9671('0x45')]['id'];}return db['VtigerConfiguration'][_0x9671('0x42')]({'where':{'id':_0x194241[_0x9671('0x46')]['id']}})[_0x9671('0x25')](handleEntityNotFound(_0x585dc9,null))[_0x9671('0x25')](saveUpdates(_0x194241[_0x9671('0x45')],null))['then'](respondWithResult(_0x585dc9,null))[_0x9671('0x43')](handleError(_0x585dc9,null));};exports['destroy']=function(_0xfcd491,_0xb8f9ea){return db[_0x9671('0x2b')][_0x9671('0x42')]({'where':{'id':_0xfcd491[_0x9671('0x46')]['id']}})[_0x9671('0x25')](handleEntityNotFound(_0xb8f9ea,null))[_0x9671('0x25')](removeEntity(_0xb8f9ea,null))[_0x9671('0x43')](handleError(_0xb8f9ea,null));};exports[_0x9671('0x47')]=function(_0x3a8e7a,_0x40f359,_0x1c9ae9){var _0x5e763a={};var _0x2e9fb2={};var _0x3b4759;var _0x5a90a0;return db['VtigerConfiguration'][_0x9671('0x48')]({'where':{'id':_0x3a8e7a[_0x9671('0x46')]['id']}})[_0x9671('0x25')](handleEntityNotFound(_0x40f359,null))['then'](function(_0x5e581a){if(_0x5e581a){_0x3b4759=_0x5e581a;_0x2e9fb2[_0x9671('0x31')]=_[_0x9671('0x2e')](db['VtigerField']['rawAttributes']);_0x2e9fb2[_0x9671('0x2d')]=_['keys'](_0x3a8e7a['query']);_0x2e9fb2['filters']=_['intersection'](_0x2e9fb2['model'],_0x2e9fb2[_0x9671('0x2d')]);_0x5e763a[_0x9671('0x30')]=_['intersection'](_0x2e9fb2[_0x9671('0x31')],qs['fields'](_0x3a8e7a[_0x9671('0x2d')][_0x9671('0x32')]));_0x5e763a['attributes']=_0x5e763a[_0x9671('0x30')][_0x9671('0x40')]?_0x5e763a[_0x9671('0x30')]:_0x2e9fb2[_0x9671('0x31')];_0x5e763a[_0x9671('0x34')]=qs[_0x9671('0x35')](_0x3a8e7a[_0x9671('0x2d')][_0x9671('0x35')]);_0x5e763a['where']=qs[_0x9671('0x37')](_[_0x9671('0x38')](_0x3a8e7a[_0x9671('0x2d')],_0x2e9fb2[_0x9671('0x37')]));if(_0x3a8e7a[_0x9671('0x2d')]['filter']){_0x5e763a[_0x9671('0x36')]=_['merge'](_0x5e763a[_0x9671('0x36')],{'$or':_[_0x9671('0x2a')](_0x5e763a[_0x9671('0x30')],function(_0x4bf3a5){var _0x1f294c={};_0x1f294c[_0x4bf3a5]={'$like':'%'+_0x3a8e7a[_0x9671('0x2d')]['filter']+'%'};return _0x1f294c;})});}_0x5e763a=_['merge']({},_0x5e763a,_0x3a8e7a[_0x9671('0x3c')]);return _0x3b4759[_0x9671('0x47')](_0x5e763a);}})[_0x9671('0x25')](function(_0xd21bf8){if(_0xd21bf8){_0x5a90a0=_0xd21bf8[_0x9671('0x40')];if(!_0x3a8e7a[_0x9671('0x2d')][_0x9671('0x49')]('nolimit')){_0x5e763a['limit']=qs[_0x9671('0x1d')](_0x3a8e7a[_0x9671('0x2d')][_0x9671('0x1d')]);_0x5e763a['offset']=qs[_0x9671('0x20')](_0x3a8e7a[_0x9671('0x2d')]['offset']);}return _0x3b4759[_0x9671('0x47')](_0x5e763a);}})[_0x9671('0x25')](function(_0x643895){if(_0x643895){return _0x643895?{'count':_0x5a90a0,'rows':_0x643895}:null;}})['then'](respondWithResult(_0x40f359,null))[_0x9671('0x43')](handleError(_0x40f359,null));};exports[_0x9671('0x4a')]=function(_0x29d515,_0x32ed10,_0x52c760){var _0x5bfe7c={};var _0x53c8a7={};var _0x23fc46;var _0x552759;return db['VtigerConfiguration'][_0x9671('0x48')]({'where':{'id':_0x29d515['params']['id']}})[_0x9671('0x25')](handleEntityNotFound(_0x32ed10,null))[_0x9671('0x25')](function(_0x367a57){if(_0x367a57){_0x23fc46=_0x367a57;_0x53c8a7[_0x9671('0x31')]=_[_0x9671('0x2e')](db[_0x9671('0x4b')]['rawAttributes']);_0x53c8a7['query']=_[_0x9671('0x2e')](_0x29d515['query']);_0x53c8a7['filters']=_['intersection'](_0x53c8a7[_0x9671('0x31')],_0x53c8a7[_0x9671('0x2d')]);_0x5bfe7c['attributes']=_[_0x9671('0x2f')](_0x53c8a7[_0x9671('0x31')],qs[_0x9671('0x32')](_0x29d515[_0x9671('0x2d')][_0x9671('0x32')]));_0x5bfe7c['attributes']=_0x5bfe7c[_0x9671('0x30')][_0x9671('0x40')]?_0x5bfe7c[_0x9671('0x30')]:_0x53c8a7[_0x9671('0x31')];_0x5bfe7c['order']=qs[_0x9671('0x35')](_0x29d515['query'][_0x9671('0x35')]);_0x5bfe7c['where']=qs[_0x9671('0x37')](_[_0x9671('0x38')](_0x29d515['query'],_0x53c8a7[_0x9671('0x37')]));if(_0x29d515[_0x9671('0x2d')][_0x9671('0x39')]){_0x5bfe7c[_0x9671('0x36')]=_[_0x9671('0x3b')](_0x5bfe7c[_0x9671('0x36')],{'$or':_[_0x9671('0x2a')](_0x5bfe7c[_0x9671('0x30')],function(_0x5d8868){var _0x3e0bc8={};_0x3e0bc8[_0x5d8868]={'$like':'%'+_0x29d515[_0x9671('0x2d')][_0x9671('0x39')]+'%'};return _0x3e0bc8;})});}_0x5bfe7c=_[_0x9671('0x3b')]({},_0x5bfe7c,_0x29d515[_0x9671('0x3c')]);return _0x23fc46[_0x9671('0x4a')](_0x5bfe7c);}})[_0x9671('0x25')](function(_0x1ef0e8){if(_0x1ef0e8){_0x552759=_0x1ef0e8[_0x9671('0x40')];if(!_0x29d515[_0x9671('0x2d')][_0x9671('0x49')](_0x9671('0x33'))){_0x5bfe7c['limit']=qs['limit'](_0x29d515['query'][_0x9671('0x1d')]);_0x5bfe7c[_0x9671('0x20')]=qs[_0x9671('0x20')](_0x29d515[_0x9671('0x2d')][_0x9671('0x20')]);}return _0x23fc46[_0x9671('0x4a')](_0x5bfe7c);}})[_0x9671('0x25')](function(_0x157c88){if(_0x157c88){return _0x157c88?{'count':_0x552759,'rows':_0x157c88}:null;}})[_0x9671('0x25')](respondWithResult(_0x32ed10,null))[_0x9671('0x43')](handleError(_0x32ed10,null));};exports['getDescriptions']=function(_0x22b021,_0x4c8be6,_0x417f63){var _0xff29e3={};var _0x1f5bc9={};var _0x2cd1b3;var _0x4c58c3;return db[_0x9671('0x2b')]['findOne']({'where':{'id':_0x22b021[_0x9671('0x46')]['id']}})[_0x9671('0x25')](handleEntityNotFound(_0x4c8be6,null))[_0x9671('0x25')](function(_0x3bc763){if(_0x3bc763){_0x2cd1b3=_0x3bc763;_0x1f5bc9[_0x9671('0x31')]=_[_0x9671('0x2e')](db[_0x9671('0x4b')][_0x9671('0x3f')]);_0x1f5bc9[_0x9671('0x2d')]=_['keys'](_0x22b021['query']);_0x1f5bc9[_0x9671('0x37')]=_[_0x9671('0x2f')](_0x1f5bc9[_0x9671('0x31')],_0x1f5bc9[_0x9671('0x2d')]);_0xff29e3[_0x9671('0x30')]=_['intersection'](_0x1f5bc9[_0x9671('0x31')],qs[_0x9671('0x32')](_0x22b021[_0x9671('0x2d')][_0x9671('0x32')]));_0xff29e3[_0x9671('0x30')]=_0xff29e3[_0x9671('0x30')][_0x9671('0x40')]?_0xff29e3['attributes']:_0x1f5bc9['model'];_0xff29e3[_0x9671('0x34')]=qs[_0x9671('0x35')](_0x22b021[_0x9671('0x2d')][_0x9671('0x35')]);_0xff29e3[_0x9671('0x36')]=qs[_0x9671('0x37')](_[_0x9671('0x38')](_0x22b021[_0x9671('0x2d')],_0x1f5bc9[_0x9671('0x37')]));if(_0x22b021[_0x9671('0x2d')][_0x9671('0x39')]){_0xff29e3['where']=_['merge'](_0xff29e3[_0x9671('0x36')],{'$or':_[_0x9671('0x2a')](_0xff29e3[_0x9671('0x30')],function(_0xe6275c){var _0x5232e5={};_0x5232e5[_0xe6275c]={'$like':'%'+_0x22b021[_0x9671('0x2d')][_0x9671('0x39')]+'%'};return _0x5232e5;})});}_0xff29e3=_[_0x9671('0x3b')]({},_0xff29e3,_0x22b021[_0x9671('0x3c')]);return _0x2cd1b3['getDescriptions'](_0xff29e3);}})[_0x9671('0x25')](function(_0x2c1725){if(_0x2c1725){_0x4c58c3=_0x2c1725['length'];if(!_0x22b021[_0x9671('0x2d')]['hasOwnProperty'](_0x9671('0x33'))){_0xff29e3[_0x9671('0x1d')]=qs['limit'](_0x22b021[_0x9671('0x2d')][_0x9671('0x1d')]);_0xff29e3[_0x9671('0x20')]=qs[_0x9671('0x20')](_0x22b021[_0x9671('0x2d')][_0x9671('0x20')]);}return _0x2cd1b3[_0x9671('0x4c')](_0xff29e3);}})['then'](function(_0x39644a){if(_0x39644a){return _0x39644a?{'count':_0x4c58c3,'rows':_0x39644a}:null;}})[_0x9671('0x25')](respondWithResult(_0x4c8be6,null))[_0x9671('0x43')](handleError(_0x4c8be6,null));}; \ No newline at end of file +var _0xa000=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','update','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','squel'];(function(_0x1e8aab,_0x27d782){var _0x528966=function(_0x1d47dd){while(--_0x1d47dd){_0x1e8aab['push'](_0x1e8aab['shift']());}};_0x528966(++_0x27d782);}(_0xa000,0x177));var _0x0a00=function(_0x25f2da,_0x2bc56f){_0x25f2da=_0x25f2da-0x0;var _0x1ef2e1=_0xa000[_0x25f2da];return _0x1ef2e1;};'use strict';var emlformat=require(_0x0a00('0x0'));var rimraf=require(_0x0a00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a00('0x2'));var rp=require('request-promise');var moment=require(_0x0a00('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a00('0x4'));var util=require(_0x0a00('0x5'));var path=require('path');var sox=require(_0x0a00('0x6'));var csv=require(_0x0a00('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a00('0x8'));var _=require('lodash');var squel=require(_0x0a00('0x9'));var crypto=require(_0x0a00('0xa'));var jsforce=require(_0x0a00('0xb'));var deskjs=require(_0x0a00('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0a00('0xd'));var Papa=require(_0x0a00('0xe'));var Redis=require(_0x0a00('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0a00('0x10'));var as=require(_0x0a00('0x11'));var hardwareService=require(_0x0a00('0x12'));var logger=require('../../config/logger')(_0x0a00('0x13'));var utils=require('../../config/utils');var config=require(_0x0a00('0x14'));var licenseUtil=require(_0x0a00('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30247,_0x37faaa){_0x37faaa=_0x37faaa||0xcc;return function(_0x1e2cb2){if(_0x1e2cb2){return _0x30247[_0x0a00('0x16')](_0x37faaa);}return _0x30247[_0x0a00('0x17')](_0x37faaa)[_0x0a00('0x18')]();};}function respondWithResult(_0x26f286,_0x2e9fc0){_0x2e9fc0=_0x2e9fc0||0xc8;return function(_0x38fcae){if(_0x38fcae){return _0x26f286['status'](_0x2e9fc0)[_0x0a00('0x19')](_0x38fcae);}};}function respondWithFilteredResult(_0x282194,_0x3bb494){return function(_0x4dad6d){if(_0x4dad6d){var _0x4033e7=typeof _0x3bb494[_0x0a00('0x1a')]==='undefined'&&typeof _0x3bb494[_0x0a00('0x1b')]==='undefined';var _0x5444bd=_0x4dad6d[_0x0a00('0x1c')];var _0x2bfb4a=_0x4033e7?0x0:_0x3bb494['offset'];var _0x14f674=_0x4033e7?_0x4dad6d['count']:_0x3bb494[_0x0a00('0x1a')]+_0x3bb494[_0x0a00('0x1b')];var _0x21fe0c;if(_0x14f674>=_0x5444bd){_0x14f674=_0x5444bd;_0x21fe0c=0xc8;}else{_0x21fe0c=0xce;}_0x282194[_0x0a00('0x17')](_0x21fe0c);return _0x282194[_0x0a00('0x1d')](_0x0a00('0x1e'),_0x2bfb4a+'-'+_0x14f674+'/'+_0x5444bd)['json'](_0x4dad6d);}return null;};}function patchUpdates(_0x37ff9f){return function(_0xfb3245){try{jsonpatch[_0x0a00('0x1f')](_0xfb3245,_0x37ff9f,!![]);}catch(_0x57fdaa){return BPromise['reject'](_0x57fdaa);}return _0xfb3245[_0x0a00('0x20')]();};}function saveUpdates(_0x424af6,_0x35253b){return function(_0x160098){if(_0x160098){return _0x160098['update'](_0x424af6)[_0x0a00('0x21')](function(_0x1a61f9){return _0x1a61f9;});}return null;};}function removeEntity(_0x4ea2e1,_0x3a7ceb){return function(_0x4b8c06){if(_0x4b8c06){return _0x4b8c06[_0x0a00('0x22')]()[_0x0a00('0x21')](function(){_0x4ea2e1['status'](0xcc)[_0x0a00('0x18')]();});}};}function handleEntityNotFound(_0x47ce7e,_0x744ccc){return function(_0x84b43b){if(!_0x84b43b){_0x47ce7e[_0x0a00('0x16')](0x194);}return _0x84b43b;};}function handleError(_0x1f9414,_0x3d37b4){_0x3d37b4=_0x3d37b4||0x1f4;return function(_0x32afe2){logger[_0x0a00('0x23')](_0x32afe2[_0x0a00('0x24')]);if(_0x32afe2['name']){delete _0x32afe2[_0x0a00('0x25')];}_0x1f9414['status'](_0x3d37b4)['send'](_0x32afe2);};}exports[_0x0a00('0x26')]=function(_0x2e9f78,_0x141f06){var _0x42ebbb={},_0x186a71={},_0x30c952={'count':0x0,'rows':[]};var _0x3accba=_[_0x0a00('0x27')](db[_0x0a00('0x28')][_0x0a00('0x29')],function(_0x153e06){return{'name':_0x153e06['fieldName'],'type':_0x153e06[_0x0a00('0x2a')][_0x0a00('0x2b')]};});_0x186a71[_0x0a00('0x2c')]=_[_0x0a00('0x27')](_0x3accba,_0x0a00('0x25'));_0x186a71[_0x0a00('0x2d')]=_[_0x0a00('0x2e')](_0x2e9f78[_0x0a00('0x2d')]);_0x186a71['filters']=_[_0x0a00('0x2f')](_0x186a71[_0x0a00('0x2c')],_0x186a71[_0x0a00('0x2d')]);_0x42ebbb[_0x0a00('0x30')]=_['intersection'](_0x186a71['model'],qs[_0x0a00('0x31')](_0x2e9f78['query'][_0x0a00('0x31')]));_0x42ebbb[_0x0a00('0x30')]=_0x42ebbb[_0x0a00('0x30')][_0x0a00('0x32')]?_0x42ebbb[_0x0a00('0x30')]:_0x186a71[_0x0a00('0x2c')];if(!_0x2e9f78[_0x0a00('0x2d')][_0x0a00('0x33')](_0x0a00('0x34'))){_0x42ebbb[_0x0a00('0x1b')]=qs[_0x0a00('0x1b')](_0x2e9f78[_0x0a00('0x2d')][_0x0a00('0x1b')]);_0x42ebbb[_0x0a00('0x1a')]=qs['offset'](_0x2e9f78[_0x0a00('0x2d')][_0x0a00('0x1a')]);}_0x42ebbb[_0x0a00('0x35')]=qs[_0x0a00('0x36')](_0x2e9f78['query'][_0x0a00('0x36')]);_0x42ebbb[_0x0a00('0x37')]=qs[_0x0a00('0x38')](_[_0x0a00('0x39')](_0x2e9f78[_0x0a00('0x2d')],_0x186a71['filters']),_0x3accba);if(_0x2e9f78[_0x0a00('0x2d')]['filter']){_0x42ebbb['where']=_['merge'](_0x42ebbb[_0x0a00('0x37')],{'$or':_[_0x0a00('0x27')](_0x3accba,function(_0x357aa7){if(_0x357aa7[_0x0a00('0x2a')]!==_0x0a00('0x3a')){var _0x3e8d7c={};_0x3e8d7c[_0x357aa7[_0x0a00('0x25')]]={'$like':'%'+_0x2e9f78[_0x0a00('0x2d')][_0x0a00('0x3b')]+'%'};return _0x3e8d7c;}})});}_0x42ebbb=_[_0x0a00('0x3c')]({},_0x42ebbb,_0x2e9f78[_0x0a00('0x3d')]);var _0x499619={'where':_0x42ebbb['where']};return db[_0x0a00('0x28')][_0x0a00('0x1c')](_0x499619)['then'](function(_0x12bf4e){_0x30c952[_0x0a00('0x1c')]=_0x12bf4e;if(_0x2e9f78['query']['includeAll']){_0x42ebbb['include']=[{'all':!![]}];}return db[_0x0a00('0x28')][_0x0a00('0x3e')](_0x42ebbb);})[_0x0a00('0x21')](function(_0xdd205a){_0x30c952[_0x0a00('0x3f')]=_0xdd205a;return _0x30c952;})[_0x0a00('0x21')](respondWithFilteredResult(_0x141f06,_0x42ebbb))[_0x0a00('0x40')](handleError(_0x141f06,null));};exports[_0x0a00('0x41')]=function(_0x1a6daf,_0xfe3503){var _0x188eb2={'raw':![],'where':{'id':_0x1a6daf[_0x0a00('0x42')]['id']}},_0x15112f={};_0x15112f[_0x0a00('0x2c')]=_[_0x0a00('0x2e')](db['VtigerConfiguration'][_0x0a00('0x29')]);_0x15112f[_0x0a00('0x2d')]=_[_0x0a00('0x2e')](_0x1a6daf[_0x0a00('0x2d')]);_0x15112f[_0x0a00('0x38')]=_['intersection'](_0x15112f[_0x0a00('0x2c')],_0x15112f[_0x0a00('0x2d')]);_0x188eb2[_0x0a00('0x30')]=_['intersection'](_0x15112f[_0x0a00('0x2c')],qs[_0x0a00('0x31')](_0x1a6daf[_0x0a00('0x2d')][_0x0a00('0x31')]));_0x188eb2['attributes']=_0x188eb2['attributes'][_0x0a00('0x32')]?_0x188eb2['attributes']:_0x15112f[_0x0a00('0x2c')];if(_0x1a6daf[_0x0a00('0x2d')][_0x0a00('0x43')]){_0x188eb2['include']=[{'all':!![]}];}_0x188eb2=_[_0x0a00('0x3c')]({},_0x188eb2,_0x1a6daf[_0x0a00('0x3d')]);return db[_0x0a00('0x28')][_0x0a00('0x44')](_0x188eb2)[_0x0a00('0x21')](handleEntityNotFound(_0xfe3503,null))[_0x0a00('0x21')](respondWithResult(_0xfe3503,null))[_0x0a00('0x40')](handleError(_0xfe3503,null));};exports[_0x0a00('0x45')]=function(_0x23cc8d,_0x5316b8){return db[_0x0a00('0x28')][_0x0a00('0x45')](_0x23cc8d[_0x0a00('0x46')],{})[_0x0a00('0x21')](respondWithResult(_0x5316b8,0xc9))[_0x0a00('0x40')](handleError(_0x5316b8,null));};exports[_0x0a00('0x47')]=function(_0x5c1552,_0x351eee){if(_0x5c1552[_0x0a00('0x46')]['id']){delete _0x5c1552[_0x0a00('0x46')]['id'];}return db[_0x0a00('0x28')]['find']({'where':{'id':_0x5c1552[_0x0a00('0x42')]['id']}})[_0x0a00('0x21')](handleEntityNotFound(_0x351eee,null))[_0x0a00('0x21')](saveUpdates(_0x5c1552[_0x0a00('0x46')],null))[_0x0a00('0x21')](respondWithResult(_0x351eee,null))['catch'](handleError(_0x351eee,null));};exports['destroy']=function(_0x3ce2db,_0x4f178b){return db[_0x0a00('0x28')][_0x0a00('0x44')]({'where':{'id':_0x3ce2db['params']['id']}})[_0x0a00('0x21')](handleEntityNotFound(_0x4f178b,null))[_0x0a00('0x21')](removeEntity(_0x4f178b,null))[_0x0a00('0x40')](handleError(_0x4f178b,null));};exports['getFields']=function(_0x355559,_0x11a2e9,_0x429e9b){var _0x1b72b8={};var _0xacc791={};var _0x5b4717;var _0x4c727f;return db['VtigerConfiguration'][_0x0a00('0x48')]({'where':{'id':_0x355559[_0x0a00('0x42')]['id']}})[_0x0a00('0x21')](handleEntityNotFound(_0x11a2e9,null))[_0x0a00('0x21')](function(_0x4aefdf){if(_0x4aefdf){_0x5b4717=_0x4aefdf;_0xacc791[_0x0a00('0x2c')]=_[_0x0a00('0x2e')](db[_0x0a00('0x49')]['rawAttributes']);_0xacc791[_0x0a00('0x2d')]=_[_0x0a00('0x2e')](_0x355559[_0x0a00('0x2d')]);_0xacc791['filters']=_[_0x0a00('0x2f')](_0xacc791[_0x0a00('0x2c')],_0xacc791[_0x0a00('0x2d')]);_0x1b72b8['attributes']=_[_0x0a00('0x2f')](_0xacc791['model'],qs[_0x0a00('0x31')](_0x355559[_0x0a00('0x2d')][_0x0a00('0x31')]));_0x1b72b8[_0x0a00('0x30')]=_0x1b72b8[_0x0a00('0x30')][_0x0a00('0x32')]?_0x1b72b8[_0x0a00('0x30')]:_0xacc791[_0x0a00('0x2c')];_0x1b72b8[_0x0a00('0x35')]=qs[_0x0a00('0x36')](_0x355559['query']['sort']);_0x1b72b8['where']=qs[_0x0a00('0x38')](_['pick'](_0x355559[_0x0a00('0x2d')],_0xacc791[_0x0a00('0x38')]));if(_0x355559[_0x0a00('0x2d')][_0x0a00('0x3b')]){_0x1b72b8[_0x0a00('0x37')]=_['merge'](_0x1b72b8[_0x0a00('0x37')],{'$or':_['map'](_0x1b72b8[_0x0a00('0x30')],function(_0x490199){var _0x3490fe={};_0x3490fe[_0x490199]={'$like':'%'+_0x355559[_0x0a00('0x2d')]['filter']+'%'};return _0x3490fe;})});}_0x1b72b8=_['merge']({},_0x1b72b8,_0x355559[_0x0a00('0x3d')]);return _0x5b4717[_0x0a00('0x4a')](_0x1b72b8);}})[_0x0a00('0x21')](function(_0xb86241){if(_0xb86241){_0x4c727f=_0xb86241[_0x0a00('0x32')];if(!_0x355559[_0x0a00('0x2d')][_0x0a00('0x33')]('nolimit')){_0x1b72b8[_0x0a00('0x1b')]=qs[_0x0a00('0x1b')](_0x355559['query']['limit']);_0x1b72b8[_0x0a00('0x1a')]=qs['offset'](_0x355559[_0x0a00('0x2d')][_0x0a00('0x1a')]);}return _0x5b4717['getFields'](_0x1b72b8);}})[_0x0a00('0x21')](function(_0x47d273){if(_0x47d273){return _0x47d273?{'count':_0x4c727f,'rows':_0x47d273}:null;}})[_0x0a00('0x21')](respondWithResult(_0x11a2e9,null))[_0x0a00('0x40')](handleError(_0x11a2e9,null));};exports[_0x0a00('0x4b')]=function(_0xcbc971,_0x524d36,_0x5627c8){var _0x49dc0c={};var _0x18dcb3={};var _0x5c3cc6;var _0x3cd59b;return db[_0x0a00('0x28')][_0x0a00('0x48')]({'where':{'id':_0xcbc971[_0x0a00('0x42')]['id']}})[_0x0a00('0x21')](handleEntityNotFound(_0x524d36,null))[_0x0a00('0x21')](function(_0x1f1c94){if(_0x1f1c94){_0x5c3cc6=_0x1f1c94;_0x18dcb3[_0x0a00('0x2c')]=_[_0x0a00('0x2e')](db['VtigerField'][_0x0a00('0x29')]);_0x18dcb3['query']=_[_0x0a00('0x2e')](_0xcbc971[_0x0a00('0x2d')]);_0x18dcb3[_0x0a00('0x38')]=_['intersection'](_0x18dcb3['model'],_0x18dcb3['query']);_0x49dc0c[_0x0a00('0x30')]=_[_0x0a00('0x2f')](_0x18dcb3['model'],qs[_0x0a00('0x31')](_0xcbc971['query'][_0x0a00('0x31')]));_0x49dc0c[_0x0a00('0x30')]=_0x49dc0c[_0x0a00('0x30')]['length']?_0x49dc0c[_0x0a00('0x30')]:_0x18dcb3[_0x0a00('0x2c')];_0x49dc0c[_0x0a00('0x35')]=qs[_0x0a00('0x36')](_0xcbc971[_0x0a00('0x2d')]['sort']);_0x49dc0c[_0x0a00('0x37')]=qs['filters'](_[_0x0a00('0x39')](_0xcbc971['query'],_0x18dcb3[_0x0a00('0x38')]));if(_0xcbc971[_0x0a00('0x2d')][_0x0a00('0x3b')]){_0x49dc0c['where']=_[_0x0a00('0x3c')](_0x49dc0c[_0x0a00('0x37')],{'$or':_[_0x0a00('0x27')](_0x49dc0c[_0x0a00('0x30')],function(_0x365c05){var _0x5350d7={};_0x5350d7[_0x365c05]={'$like':'%'+_0xcbc971[_0x0a00('0x2d')][_0x0a00('0x3b')]+'%'};return _0x5350d7;})});}_0x49dc0c=_['merge']({},_0x49dc0c,_0xcbc971['options']);return _0x5c3cc6['getSubjects'](_0x49dc0c);}})[_0x0a00('0x21')](function(_0x41e4ab){if(_0x41e4ab){_0x3cd59b=_0x41e4ab['length'];if(!_0xcbc971[_0x0a00('0x2d')][_0x0a00('0x33')]('nolimit')){_0x49dc0c['limit']=qs[_0x0a00('0x1b')](_0xcbc971[_0x0a00('0x2d')][_0x0a00('0x1b')]);_0x49dc0c['offset']=qs[_0x0a00('0x1a')](_0xcbc971[_0x0a00('0x2d')]['offset']);}return _0x5c3cc6[_0x0a00('0x4b')](_0x49dc0c);}})['then'](function(_0x19fc9a){if(_0x19fc9a){return _0x19fc9a?{'count':_0x3cd59b,'rows':_0x19fc9a}:null;}})['then'](respondWithResult(_0x524d36,null))[_0x0a00('0x40')](handleError(_0x524d36,null));};exports['getDescriptions']=function(_0x3d48b6,_0x128c9b,_0x12d2e9){var _0x260dba={};var _0x4773c5={};var _0x4fec54;var _0x5d456c;return db['VtigerConfiguration'][_0x0a00('0x48')]({'where':{'id':_0x3d48b6['params']['id']}})['then'](handleEntityNotFound(_0x128c9b,null))['then'](function(_0xd6f9fd){if(_0xd6f9fd){_0x4fec54=_0xd6f9fd;_0x4773c5[_0x0a00('0x2c')]=_[_0x0a00('0x2e')](db[_0x0a00('0x49')][_0x0a00('0x29')]);_0x4773c5[_0x0a00('0x2d')]=_[_0x0a00('0x2e')](_0x3d48b6['query']);_0x4773c5[_0x0a00('0x38')]=_[_0x0a00('0x2f')](_0x4773c5[_0x0a00('0x2c')],_0x4773c5[_0x0a00('0x2d')]);_0x260dba[_0x0a00('0x30')]=_['intersection'](_0x4773c5[_0x0a00('0x2c')],qs[_0x0a00('0x31')](_0x3d48b6[_0x0a00('0x2d')][_0x0a00('0x31')]));_0x260dba[_0x0a00('0x30')]=_0x260dba[_0x0a00('0x30')][_0x0a00('0x32')]?_0x260dba[_0x0a00('0x30')]:_0x4773c5[_0x0a00('0x2c')];_0x260dba[_0x0a00('0x35')]=qs[_0x0a00('0x36')](_0x3d48b6[_0x0a00('0x2d')][_0x0a00('0x36')]);_0x260dba[_0x0a00('0x37')]=qs['filters'](_['pick'](_0x3d48b6[_0x0a00('0x2d')],_0x4773c5[_0x0a00('0x38')]));if(_0x3d48b6[_0x0a00('0x2d')]['filter']){_0x260dba['where']=_[_0x0a00('0x3c')](_0x260dba['where'],{'$or':_['map'](_0x260dba[_0x0a00('0x30')],function(_0x17a604){var _0x49e84a={};_0x49e84a[_0x17a604]={'$like':'%'+_0x3d48b6['query'][_0x0a00('0x3b')]+'%'};return _0x49e84a;})});}_0x260dba=_[_0x0a00('0x3c')]({},_0x260dba,_0x3d48b6[_0x0a00('0x3d')]);return _0x4fec54[_0x0a00('0x4c')](_0x260dba);}})[_0x0a00('0x21')](function(_0x3d741d){if(_0x3d741d){_0x5d456c=_0x3d741d[_0x0a00('0x32')];if(!_0x3d48b6['query'][_0x0a00('0x33')](_0x0a00('0x34'))){_0x260dba[_0x0a00('0x1b')]=qs[_0x0a00('0x1b')](_0x3d48b6['query'][_0x0a00('0x1b')]);_0x260dba[_0x0a00('0x1a')]=qs[_0x0a00('0x1a')](_0x3d48b6['query']['offset']);}return _0x4fec54[_0x0a00('0x4c')](_0x260dba);}})[_0x0a00('0x21')](function(_0x26fe46){if(_0x26fe46){return _0x26fe46?{'count':_0x5d456c,'rows':_0x26fe46}:null;}})[_0x0a00('0x21')](respondWithResult(_0x128c9b,null))[_0x0a00('0x40')](handleError(_0x128c9b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2762e7f..998b4f0 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 _0xda68=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','VtigerConfiguration','int_vtiger_configurations'];(function(_0x4c19a1,_0x15197f){var _0x58ac50=function(_0x7c08c1){while(--_0x7c08c1){_0x4c19a1['push'](_0x4c19a1['shift']());}};_0x58ac50(++_0x15197f);}(_0xda68,0x18c));var _0x8da6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8da6('0x0'));var logger=require(_0x8da6('0x1'))(_0x8da6('0x2'));var moment=require(_0x8da6('0x3'));var BPromise=require(_0x8da6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8da6('0x5'));var rimraf=require(_0x8da6('0x6'));var config=require(_0x8da6('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x8da6('0x8')]=function(_0x3bff25,_0x2f0a14){return _0x3bff25['define'](_0x8da6('0x9'),attributes,{'tableName':_0x8da6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbab2=['moment','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x230951,_0x4dad52){var _0xeb26b1=function(_0x25776c){while(--_0x25776c){_0x230951['push'](_0x230951['shift']());}};_0xeb26b1(++_0x4dad52);}(_0xbab2,0x81));var _0x2bab=function(_0x5cb406,_0x31fa14){_0x5cb406=_0x5cb406-0x0;var _0x4fbef7=_0xbab2[_0x5cb406];return _0x4fbef7;};'use strict';var _=require(_0x2bab('0x0'));var util=require(_0x2bab('0x1'));var logger=require(_0x2bab('0x2'))('api');var moment=require(_0x2bab('0x3'));var BPromise=require('bluebird');var rp=require(_0x2bab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2bab('0x5'));var config=require(_0x2bab('0x6'));var attributes=require(_0x2bab('0x7'));module[_0x2bab('0x8')]=function(_0x13b7be,_0xa4e04e){return _0x13b7be[_0x2bab('0x9')](_0x2bab('0xa'),attributes,{'tableName':_0x2bab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index ef30d8a..0c669f0 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 _0x9349=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9349,0x1a4));var _0x9934=function(_0x42c9b7,_0x53656f){_0x42c9b7=_0x42c9b7-0x0;var _0x2842d9=_0x9349[_0x42c9b7];return _0x2842d9;};'use strict';var _=require(_0x9934('0x0'));var util=require('util');var moment=require(_0x9934('0x1'));var BPromise=require(_0x9934('0x2'));var rs=require(_0x9934('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9934('0x4'))['db'];var utils=require(_0x9934('0x5'));var logger=require(_0x9934('0x6'))(_0x9934('0x7'));var config=require(_0x9934('0x8'));var jayson=require(_0x9934('0x9'));var client=jayson[_0x9934('0xa')][_0x9934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f466e,_0x27a034,_0x573206){return new BPromise(function(_0x4ede11,_0x56fe40){return client[_0x9934('0xc')](_0x3f466e,_0x573206)[_0x9934('0xd')](function(_0x4bf4c8){logger[_0x9934('0xe')](_0x9934('0xf'),_0x27a034,_0x9934('0x10'));logger['debug'](_0x9934('0x11'),_0x27a034,_0x9934('0x10'),JSON[_0x9934('0x12')](_0x4bf4c8));if(_0x4bf4c8[_0x9934('0x13')]){if(_0x4bf4c8[_0x9934('0x13')][_0x9934('0x14')]===0x1f4){logger[_0x9934('0x13')](_0x9934('0xf'),_0x27a034,_0x4bf4c8['error'][_0x9934('0x15')]);return _0x56fe40(_0x4bf4c8[_0x9934('0x13')]['message']);}logger[_0x9934('0x13')](_0x9934('0xf'),_0x27a034,_0x4bf4c8[_0x9934('0x13')][_0x9934('0x15')]);return _0x4ede11(_0x4bf4c8['error'][_0x9934('0x15')]);}else{logger['info'](_0x9934('0xf'),_0x27a034,_0x9934('0x10'));_0x4ede11(_0x4bf4c8['result'][_0x9934('0x15')]);}})[_0x9934('0x16')](function(_0x100c84){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x27a034,_0x100c84);_0x56fe40(_0x100c84);});});} \ No newline at end of file +var _0xd378=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','request\x20sent'];(function(_0x4b8ad8,_0x20b25b){var _0x579f26=function(_0x278399){while(--_0x278399){_0x4b8ad8['push'](_0x4b8ad8['shift']());}};_0x579f26(++_0x20b25b);}(_0xd378,0x91));var _0x8d37=function(_0x40b3b5,_0x5cde7c){_0x40b3b5=_0x40b3b5-0x0;var _0x2253a7=_0xd378[_0x40b3b5];return _0x2253a7;};'use strict';var _=require(_0x8d37('0x0'));var util=require(_0x8d37('0x1'));var moment=require(_0x8d37('0x2'));var BPromise=require(_0x8d37('0x3'));var rs=require(_0x8d37('0x4'));var fs=require('fs');var Redis=require(_0x8d37('0x5'));var db=require(_0x8d37('0x6'))['db'];var utils=require(_0x8d37('0x7'));var logger=require(_0x8d37('0x8'))(_0x8d37('0x9'));var config=require(_0x8d37('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8d37('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea588,_0x121446,_0x182f54){return new BPromise(function(_0x217a36,_0x1f1ced){return client[_0x8d37('0xc')](_0x3ea588,_0x182f54)[_0x8d37('0xd')](function(_0x48fb07){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x121446,'request\x20sent');logger[_0x8d37('0xe')](_0x8d37('0xf'),_0x121446,'request\x20sent',JSON[_0x8d37('0x10')](_0x48fb07));if(_0x48fb07[_0x8d37('0x11')]){if(_0x48fb07[_0x8d37('0x11')][_0x8d37('0x12')]===0x1f4){logger['error'](_0x8d37('0x13'),_0x121446,_0x48fb07[_0x8d37('0x11')][_0x8d37('0x14')]);return _0x1f1ced(_0x48fb07[_0x8d37('0x11')][_0x8d37('0x14')]);}logger[_0x8d37('0x11')](_0x8d37('0x13'),_0x121446,_0x48fb07[_0x8d37('0x11')][_0x8d37('0x14')]);return _0x217a36(_0x48fb07[_0x8d37('0x11')][_0x8d37('0x14')]);}else{logger[_0x8d37('0x15')](_0x8d37('0x13'),_0x121446,_0x8d37('0x16'));_0x217a36(_0x48fb07[_0x8d37('0x17')][_0x8d37('0x14')]);}})['catch'](function(_0x495d46){logger['error'](_0x8d37('0x13'),_0x121446,_0x495d46);_0x1f1ced(_0x495d46);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6771bdc..b566223 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 _0x00a2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','show','isAuthenticated','create','put','update','delete','exports','multer','connect-timeout'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x00a2,0x1b8));var _0x200a=function(_0x490a3e,_0x14cf9c){_0x490a3e=_0x490a3e-0x0;var _0x4f1000=_0x00a2[_0x490a3e];return _0x4f1000;};'use strict';var multer=require(_0x200a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x200a('0x1'));var express=require('express');var router=express[_0x200a('0x2')]();var fs_extra=require(_0x200a('0x3'));var auth=require(_0x200a('0x4'));var interaction=require(_0x200a('0x5'));var config=require(_0x200a('0x6'));var controller=require(_0x200a('0x7'));router[_0x200a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x200a('0x9'),auth['isAuthenticated'](),controller[_0x200a('0xa')]);router['post']('/',auth[_0x200a('0xb')](),controller[_0x200a('0xc')]);router[_0x200a('0xd')](_0x200a('0x9'),auth['isAuthenticated'](),controller[_0x200a('0xe')]);router[_0x200a('0xf')](_0x200a('0x9'),auth[_0x200a('0xb')](),controller['destroy']);module[_0x200a('0x10')]=router; \ No newline at end of file +var _0x5cdb=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','delete','exports','multer'];(function(_0x547e1d,_0x213e23){var _0x31cd5c=function(_0x232f77){while(--_0x232f77){_0x547e1d['push'](_0x547e1d['shift']());}};_0x31cd5c(++_0x213e23);}(_0x5cdb,0xc2));var _0xb5cd=function(_0x779b4d,_0x1ad17f){_0x779b4d=_0x779b4d-0x0;var _0x14447e=_0x5cdb[_0x779b4d];return _0x14447e;};'use strict';var multer=require(_0xb5cd('0x0'));var util=require(_0xb5cd('0x1'));var path=require(_0xb5cd('0x2'));var timeout=require(_0xb5cd('0x3'));var express=require(_0xb5cd('0x4'));var router=express[_0xb5cd('0x5')]();var fs_extra=require(_0xb5cd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb5cd('0x7'));var config=require(_0xb5cd('0x8'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0xb5cd('0x9')](),controller['index']);router[_0xb5cd('0xa')](_0xb5cd('0xb'),auth[_0xb5cd('0x9')](),controller[_0xb5cd('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb5cd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb5cd('0xd')](_0xb5cd('0xb'),auth[_0xb5cd('0x9')](),controller['destroy']);module[_0xb5cd('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4e105e4..fed6262 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 _0xdebf=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdebf,0x13c));var _0xfdeb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdebf[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xfdeb('0x0'));module[_0xfdeb('0x1')]={'type':{'type':Sequelize[_0xfdeb('0x2')](_0xfdeb('0x3'),_0xfdeb('0x4'),_0xfdeb('0x5'),_0xfdeb('0x6'),_0xfdeb('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfdeb('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xfdeb('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfdeb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfdeb('0x8')]}}; \ No newline at end of file +var _0x41cd=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x568177,_0x5b31dc){var _0x5c1dd0=function(_0x37d212){while(--_0x37d212){_0x568177['push'](_0x568177['shift']());}};_0x5c1dd0(++_0x5b31dc);}(_0x41cd,0xfc));var _0xd41c=function(_0x9c5247,_0x187a01){_0x9c5247=_0x9c5247-0x0;var _0x1dc166=_0x41cd[_0x9c5247];return _0x1dc166;};'use strict';var Sequelize=require(_0xd41c('0x0'));module[_0xd41c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd41c('0x2'),_0xd41c('0x3'),_0xd41c('0x4'),_0xd41c('0x5'),_0xd41c('0x6')),'defaultValue':_0xd41c('0x2')},'content':{'type':Sequelize[_0xd41c('0x7')]},'key':{'type':Sequelize[_0xd41c('0x7')]},'keyType':{'type':Sequelize[_0xd41c('0x8')](_0xd41c('0x2'),_0xd41c('0x3'),_0xd41c('0x4'))},'keyContent':{'type':Sequelize[_0xd41c('0x7')]},'idField':{'type':Sequelize[_0xd41c('0x7')]},'nameField':{'type':Sequelize[_0xd41c('0x7')]},'customField':{'type':Sequelize[_0xd41c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd41c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ea2016e..bbe8f43 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 _0xab1a=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VtigerField','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1d9414,_0x5d19bb){var _0x217ec5=function(_0x55aac1){while(--_0x55aac1){_0x1d9414['push'](_0x1d9414['shift']());}};_0x217ec5(++_0x5d19bb);}(_0xab1a,0x151));var _0xaab1=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0xab1a[_0x487ab4];return _0x3bef77;};'use strict';var emlformat=require(_0xaab1('0x0'));var rimraf=require(_0xaab1('0x1'));var zipdir=require(_0xaab1('0x2'));var jsonpatch=require(_0xaab1('0x3'));var rp=require('request-promise');var moment=require(_0xaab1('0x4'));var BPromise=require(_0xaab1('0x5'));var Mustache=require(_0xaab1('0x6'));var util=require(_0xaab1('0x7'));var path=require('path');var sox=require(_0xaab1('0x8'));var csv=require(_0xaab1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaab1('0xa'));var _=require(_0xaab1('0xb'));var squel=require(_0xaab1('0xc'));var crypto=require(_0xaab1('0xd'));var jsforce=require(_0xaab1('0xe'));var deskjs=require(_0xaab1('0xf'));var toCsv=require(_0xaab1('0x9'));var querystring=require(_0xaab1('0x10'));var Papa=require(_0xaab1('0x11'));var Redis=require(_0xaab1('0x12'));var authService=require(_0xaab1('0x13'));var qs=require(_0xaab1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaab1('0x15'));var utils=require(_0xaab1('0x16'));var config=require(_0xaab1('0x17'));var licenseUtil=require(_0xaab1('0x18'));var db=require(_0xaab1('0x19'))['db'];function respondWithStatusCode(_0x4e45ce,_0x3ce75f){_0x3ce75f=_0x3ce75f||0xcc;return function(_0x23bde5){if(_0x23bde5){return _0x4e45ce[_0xaab1('0x1a')](_0x3ce75f);}return _0x4e45ce[_0xaab1('0x1b')](_0x3ce75f)['end']();};}function respondWithResult(_0x32e764,_0x204b8a){_0x204b8a=_0x204b8a||0xc8;return function(_0x5695df){if(_0x5695df){return _0x32e764['status'](_0x204b8a)[_0xaab1('0x1c')](_0x5695df);}};}function respondWithFilteredResult(_0x2a300f,_0x574979){return function(_0x2a4485){if(_0x2a4485){var _0x356dd7=typeof _0x574979[_0xaab1('0x1d')]===_0xaab1('0x1e')&&typeof _0x574979[_0xaab1('0x1f')]===_0xaab1('0x1e');var _0x2c9f3b=_0x2a4485['count'];var _0x13ba55=_0x356dd7?0x0:_0x574979[_0xaab1('0x1d')];var _0x54fd0f=_0x356dd7?_0x2a4485[_0xaab1('0x20')]:_0x574979['offset']+_0x574979[_0xaab1('0x1f')];var _0x52672e;if(_0x54fd0f>=_0x2c9f3b){_0x54fd0f=_0x2c9f3b;_0x52672e=0xc8;}else{_0x52672e=0xce;}_0x2a300f['status'](_0x52672e);return _0x2a300f[_0xaab1('0x21')](_0xaab1('0x22'),_0x13ba55+'-'+_0x54fd0f+'/'+_0x2c9f3b)['json'](_0x2a4485);}return null;};}function patchUpdates(_0x3bb39a){return function(_0x175546){try{jsonpatch[_0xaab1('0x23')](_0x175546,_0x3bb39a,!![]);}catch(_0x4cea72){return BPromise[_0xaab1('0x24')](_0x4cea72);}return _0x175546['save']();};}function saveUpdates(_0x27e72c,_0x17a353){return function(_0x524b7e){if(_0x524b7e){return _0x524b7e[_0xaab1('0x25')](_0x27e72c)[_0xaab1('0x26')](function(_0x470ef0){return _0x470ef0;});}return null;};}function removeEntity(_0x527d6e,_0x2fb93d){return function(_0x495d1d){if(_0x495d1d){return _0x495d1d[_0xaab1('0x27')]()[_0xaab1('0x26')](function(){_0x527d6e[_0xaab1('0x1b')](0xcc)[_0xaab1('0x28')]();});}};}function handleEntityNotFound(_0x5a85c5,_0x3b745c){return function(_0x29496a){if(!_0x29496a){_0x5a85c5[_0xaab1('0x1a')](0x194);}return _0x29496a;};}function handleError(_0x3d3b06,_0xbf15f8){_0xbf15f8=_0xbf15f8||0x1f4;return function(_0x4e213f){logger['error'](_0x4e213f[_0xaab1('0x29')]);if(_0x4e213f[_0xaab1('0x2a')]){delete _0x4e213f[_0xaab1('0x2a')];}_0x3d3b06[_0xaab1('0x1b')](_0xbf15f8)[_0xaab1('0x2b')](_0x4e213f);};}exports['index']=function(_0x3fbfe7,_0x7dc02f){var _0x51207b={},_0x5f38e3={},_0x2fd8a0={'count':0x0,'rows':[]};var _0x213050=_[_0xaab1('0x2c')](db['VtigerField']['rawAttributes'],function(_0x28ad87){return{'name':_0x28ad87[_0xaab1('0x2d')],'type':_0x28ad87['type']['key']};});_0x5f38e3['model']=_[_0xaab1('0x2c')](_0x213050,_0xaab1('0x2a'));_0x5f38e3[_0xaab1('0x2e')]=_[_0xaab1('0x2f')](_0x3fbfe7[_0xaab1('0x2e')]);_0x5f38e3[_0xaab1('0x30')]=_[_0xaab1('0x31')](_0x5f38e3[_0xaab1('0x32')],_0x5f38e3[_0xaab1('0x2e')]);_0x51207b['attributes']=_['intersection'](_0x5f38e3['model'],qs['fields'](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x33')]));_0x51207b[_0xaab1('0x34')]=_0x51207b[_0xaab1('0x34')][_0xaab1('0x35')]?_0x51207b[_0xaab1('0x34')]:_0x5f38e3['model'];if(!_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x36')](_0xaab1('0x37'))){_0x51207b[_0xaab1('0x1f')]=qs[_0xaab1('0x1f')](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x1f')]);_0x51207b[_0xaab1('0x1d')]=qs['offset'](_0x3fbfe7['query'][_0xaab1('0x1d')]);}_0x51207b[_0xaab1('0x38')]=qs[_0xaab1('0x39')](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x39')]);_0x51207b['where']=qs['filters'](_[_0xaab1('0x3a')](_0x3fbfe7[_0xaab1('0x2e')],_0x5f38e3['filters']),_0x213050);if(_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x3b')]){_0x51207b[_0xaab1('0x3c')]=_[_0xaab1('0x3d')](_0x51207b[_0xaab1('0x3c')],{'$or':_[_0xaab1('0x2c')](_0x213050,function(_0x49c345){if(_0x49c345['type']!==_0xaab1('0x3e')){var _0x38c0bd={};_0x38c0bd[_0x49c345[_0xaab1('0x2a')]]={'$like':'%'+_0x3fbfe7[_0xaab1('0x2e')]['filter']+'%'};return _0x38c0bd;}})});}_0x51207b=_[_0xaab1('0x3d')]({},_0x51207b,_0x3fbfe7[_0xaab1('0x3f')]);var _0x4b653b={'where':_0x51207b[_0xaab1('0x3c')]};return db[_0xaab1('0x40')]['count'](_0x4b653b)[_0xaab1('0x26')](function(_0x28038f){_0x2fd8a0[_0xaab1('0x20')]=_0x28038f;if(_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x41')]){_0x51207b[_0xaab1('0x42')]=[{'all':!![]}];}return db[_0xaab1('0x40')][_0xaab1('0x43')](_0x51207b);})[_0xaab1('0x26')](function(_0xb16fb1){_0x2fd8a0['rows']=_0xb16fb1;return _0x2fd8a0;})[_0xaab1('0x26')](respondWithFilteredResult(_0x7dc02f,_0x51207b))[_0xaab1('0x44')](handleError(_0x7dc02f,null));};exports['show']=function(_0x471b85,_0x3e75c0){var _0x2e875c={'raw':!![],'where':{'id':_0x471b85[_0xaab1('0x45')]['id']}},_0xec88c9={};_0xec88c9['model']=_[_0xaab1('0x2f')](db[_0xaab1('0x40')]['rawAttributes']);_0xec88c9[_0xaab1('0x2e')]=_['keys'](_0x471b85[_0xaab1('0x2e')]);_0xec88c9[_0xaab1('0x30')]=_[_0xaab1('0x31')](_0xec88c9[_0xaab1('0x32')],_0xec88c9['query']);_0x2e875c[_0xaab1('0x34')]=_[_0xaab1('0x31')](_0xec88c9[_0xaab1('0x32')],qs[_0xaab1('0x33')](_0x471b85[_0xaab1('0x2e')]['fields']));_0x2e875c[_0xaab1('0x34')]=_0x2e875c[_0xaab1('0x34')][_0xaab1('0x35')]?_0x2e875c['attributes']:_0xec88c9[_0xaab1('0x32')];if(_0x471b85[_0xaab1('0x2e')][_0xaab1('0x41')]){_0x2e875c[_0xaab1('0x42')]=[{'all':!![]}];}_0x2e875c=_[_0xaab1('0x3d')]({},_0x2e875c,_0x471b85[_0xaab1('0x3f')]);return db[_0xaab1('0x40')][_0xaab1('0x46')](_0x2e875c)[_0xaab1('0x26')](handleEntityNotFound(_0x3e75c0,null))['then'](respondWithResult(_0x3e75c0,null))[_0xaab1('0x44')](handleError(_0x3e75c0,null));};exports[_0xaab1('0x47')]=function(_0x4d0b95,_0xb77b34){return db['VtigerField'][_0xaab1('0x47')](_0x4d0b95[_0xaab1('0x48')],{})[_0xaab1('0x26')](respondWithResult(_0xb77b34,0xc9))['catch'](handleError(_0xb77b34,null));};exports[_0xaab1('0x25')]=function(_0x563c5d,_0x319a61){if(_0x563c5d['body']['id']){delete _0x563c5d['body']['id'];}return db['VtigerField'][_0xaab1('0x46')]({'where':{'id':_0x563c5d[_0xaab1('0x45')]['id']}})[_0xaab1('0x26')](handleEntityNotFound(_0x319a61,null))[_0xaab1('0x26')](saveUpdates(_0x563c5d['body'],null))[_0xaab1('0x26')](respondWithResult(_0x319a61,null))['catch'](handleError(_0x319a61,null));};exports[_0xaab1('0x27')]=function(_0x60640b,_0x4a2c3f){return db['VtigerField']['find']({'where':{'id':_0x60640b['params']['id']}})[_0xaab1('0x26')](handleEntityNotFound(_0x4a2c3f,null))[_0xaab1('0x26')](removeEntity(_0x4a2c3f,null))[_0xaab1('0x44')](handleError(_0x4a2c3f,null));}; \ No newline at end of file +var _0x475f=['set','reject','save','update','then','end','sendStatus','error','stack','name','send','VtigerField','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','length','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count'];(function(_0x2b6e4c,_0x49280d){var _0x3d84e9=function(_0x19c4e4){while(--_0x19c4e4){_0x2b6e4c['push'](_0x2b6e4c['shift']());}};_0x3d84e9(++_0x49280d);}(_0x475f,0x146));var _0xf475=function(_0x351065,_0xe5cbac){_0x351065=_0x351065-0x0;var _0x148ad6=_0x475f[_0x351065];return _0x148ad6;};'use strict';var emlformat=require(_0xf475('0x0'));var rimraf=require(_0xf475('0x1'));var zipdir=require(_0xf475('0x2'));var jsonpatch=require(_0xf475('0x3'));var rp=require('request-promise');var moment=require(_0xf475('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf475('0x5'));var path=require(_0xf475('0x6'));var sox=require(_0xf475('0x7'));var csv=require(_0xf475('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf475('0x9'));var _=require(_0xf475('0xa'));var squel=require(_0xf475('0xb'));var crypto=require(_0xf475('0xc'));var jsforce=require(_0xf475('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf475('0x8'));var querystring=require(_0xf475('0xe'));var Papa=require(_0xf475('0xf'));var Redis=require(_0xf475('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf475('0x11'));var hardwareService=require(_0xf475('0x12'));var logger=require(_0xf475('0x13'))('api');var utils=require(_0xf475('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf475('0x15'));var db=require(_0xf475('0x16'))['db'];function respondWithStatusCode(_0x44becd,_0x50cb20){_0x50cb20=_0x50cb20||0xcc;return function(_0x514d8b){if(_0x514d8b){return _0x44becd['sendStatus'](_0x50cb20);}return _0x44becd[_0xf475('0x17')](_0x50cb20)['end']();};}function respondWithResult(_0x4a56da,_0x3d82df){_0x3d82df=_0x3d82df||0xc8;return function(_0x541731){if(_0x541731){return _0x4a56da[_0xf475('0x17')](_0x3d82df)[_0xf475('0x18')](_0x541731);}};}function respondWithFilteredResult(_0x57a012,_0x249118){return function(_0x4994d9){if(_0x4994d9){var _0xd5993e=typeof _0x249118[_0xf475('0x19')]===_0xf475('0x1a')&&typeof _0x249118[_0xf475('0x1b')]===_0xf475('0x1a');var _0x941df8=_0x4994d9[_0xf475('0x1c')];var _0xd33ae3=_0xd5993e?0x0:_0x249118['offset'];var _0x2e7c69=_0xd5993e?_0x4994d9[_0xf475('0x1c')]:_0x249118[_0xf475('0x19')]+_0x249118[_0xf475('0x1b')];var _0x12d911;if(_0x2e7c69>=_0x941df8){_0x2e7c69=_0x941df8;_0x12d911=0xc8;}else{_0x12d911=0xce;}_0x57a012[_0xf475('0x17')](_0x12d911);return _0x57a012[_0xf475('0x1d')]('Content-Range',_0xd33ae3+'-'+_0x2e7c69+'/'+_0x941df8)[_0xf475('0x18')](_0x4994d9);}return null;};}function patchUpdates(_0xeed53){return function(_0x33ac91){try{jsonpatch['apply'](_0x33ac91,_0xeed53,!![]);}catch(_0xadf42b){return BPromise[_0xf475('0x1e')](_0xadf42b);}return _0x33ac91[_0xf475('0x1f')]();};}function saveUpdates(_0xcdd6ec,_0x44c3c2){return function(_0x214b33){if(_0x214b33){return _0x214b33[_0xf475('0x20')](_0xcdd6ec)[_0xf475('0x21')](function(_0x4af611){return _0x4af611;});}return null;};}function removeEntity(_0x4e01a2,_0x503c7c){return function(_0x11cad0){if(_0x11cad0){return _0x11cad0['destroy']()['then'](function(){_0x4e01a2['status'](0xcc)[_0xf475('0x22')]();});}};}function handleEntityNotFound(_0x29e5e3,_0x11024b){return function(_0x24ff09){if(!_0x24ff09){_0x29e5e3[_0xf475('0x23')](0x194);}return _0x24ff09;};}function handleError(_0x1e95e3,_0x47b191){_0x47b191=_0x47b191||0x1f4;return function(_0x16d768){logger[_0xf475('0x24')](_0x16d768[_0xf475('0x25')]);if(_0x16d768['name']){delete _0x16d768[_0xf475('0x26')];}_0x1e95e3[_0xf475('0x17')](_0x47b191)[_0xf475('0x27')](_0x16d768);};}exports['index']=function(_0x307a4f,_0x1ac63d){var _0x374a67={},_0x150f33={},_0x231e32={'count':0x0,'rows':[]};var _0x294916=_['map'](db[_0xf475('0x28')][_0xf475('0x29')],function(_0x1171be){return{'name':_0x1171be[_0xf475('0x2a')],'type':_0x1171be['type']['key']};});_0x150f33[_0xf475('0x2b')]=_[_0xf475('0x2c')](_0x294916,'name');_0x150f33[_0xf475('0x2d')]=_[_0xf475('0x2e')](_0x307a4f[_0xf475('0x2d')]);_0x150f33[_0xf475('0x2f')]=_['intersection'](_0x150f33['model'],_0x150f33[_0xf475('0x2d')]);_0x374a67[_0xf475('0x30')]=_[_0xf475('0x31')](_0x150f33[_0xf475('0x2b')],qs[_0xf475('0x32')](_0x307a4f[_0xf475('0x2d')][_0xf475('0x32')]));_0x374a67[_0xf475('0x30')]=_0x374a67['attributes']['length']?_0x374a67[_0xf475('0x30')]:_0x150f33[_0xf475('0x2b')];if(!_0x307a4f[_0xf475('0x2d')][_0xf475('0x33')](_0xf475('0x34'))){_0x374a67[_0xf475('0x1b')]=qs[_0xf475('0x1b')](_0x307a4f[_0xf475('0x2d')][_0xf475('0x1b')]);_0x374a67[_0xf475('0x19')]=qs['offset'](_0x307a4f[_0xf475('0x2d')][_0xf475('0x19')]);}_0x374a67[_0xf475('0x35')]=qs[_0xf475('0x36')](_0x307a4f[_0xf475('0x2d')][_0xf475('0x36')]);_0x374a67[_0xf475('0x37')]=qs['filters'](_[_0xf475('0x38')](_0x307a4f[_0xf475('0x2d')],_0x150f33[_0xf475('0x2f')]),_0x294916);if(_0x307a4f['query'][_0xf475('0x39')]){_0x374a67[_0xf475('0x37')]=_[_0xf475('0x3a')](_0x374a67[_0xf475('0x37')],{'$or':_[_0xf475('0x2c')](_0x294916,function(_0x58dc30){if(_0x58dc30['type']!==_0xf475('0x3b')){var _0x5f0283={};_0x5f0283[_0x58dc30[_0xf475('0x26')]]={'$like':'%'+_0x307a4f[_0xf475('0x2d')][_0xf475('0x39')]+'%'};return _0x5f0283;}})});}_0x374a67=_[_0xf475('0x3a')]({},_0x374a67,_0x307a4f['options']);var _0x284f72={'where':_0x374a67[_0xf475('0x37')]};return db['VtigerField']['count'](_0x284f72)[_0xf475('0x21')](function(_0x4fd17e){_0x231e32['count']=_0x4fd17e;if(_0x307a4f[_0xf475('0x2d')][_0xf475('0x3c')]){_0x374a67[_0xf475('0x3d')]=[{'all':!![]}];}return db[_0xf475('0x28')]['findAll'](_0x374a67);})[_0xf475('0x21')](function(_0x120670){_0x231e32[_0xf475('0x3e')]=_0x120670;return _0x231e32;})[_0xf475('0x21')](respondWithFilteredResult(_0x1ac63d,_0x374a67))[_0xf475('0x3f')](handleError(_0x1ac63d,null));};exports[_0xf475('0x40')]=function(_0x45ae03,_0xb7f9f2){var _0x2dd0d5={'raw':!![],'where':{'id':_0x45ae03['params']['id']}},_0x10d526={};_0x10d526[_0xf475('0x2b')]=_[_0xf475('0x2e')](db[_0xf475('0x28')]['rawAttributes']);_0x10d526[_0xf475('0x2d')]=_[_0xf475('0x2e')](_0x45ae03[_0xf475('0x2d')]);_0x10d526[_0xf475('0x2f')]=_[_0xf475('0x31')](_0x10d526[_0xf475('0x2b')],_0x10d526['query']);_0x2dd0d5[_0xf475('0x30')]=_[_0xf475('0x31')](_0x10d526[_0xf475('0x2b')],qs[_0xf475('0x32')](_0x45ae03[_0xf475('0x2d')][_0xf475('0x32')]));_0x2dd0d5['attributes']=_0x2dd0d5['attributes'][_0xf475('0x41')]?_0x2dd0d5['attributes']:_0x10d526['model'];if(_0x45ae03[_0xf475('0x2d')][_0xf475('0x3c')]){_0x2dd0d5[_0xf475('0x3d')]=[{'all':!![]}];}_0x2dd0d5=_[_0xf475('0x3a')]({},_0x2dd0d5,_0x45ae03['options']);return db[_0xf475('0x28')][_0xf475('0x42')](_0x2dd0d5)[_0xf475('0x21')](handleEntityNotFound(_0xb7f9f2,null))['then'](respondWithResult(_0xb7f9f2,null))[_0xf475('0x3f')](handleError(_0xb7f9f2,null));};exports['create']=function(_0x29abcd,_0x4df0fd){return db[_0xf475('0x28')][_0xf475('0x43')](_0x29abcd[_0xf475('0x44')],{})[_0xf475('0x21')](respondWithResult(_0x4df0fd,0xc9))['catch'](handleError(_0x4df0fd,null));};exports[_0xf475('0x20')]=function(_0x153d35,_0x237cb0){if(_0x153d35[_0xf475('0x44')]['id']){delete _0x153d35['body']['id'];}return db[_0xf475('0x28')][_0xf475('0x42')]({'where':{'id':_0x153d35[_0xf475('0x45')]['id']}})[_0xf475('0x21')](handleEntityNotFound(_0x237cb0,null))[_0xf475('0x21')](saveUpdates(_0x153d35[_0xf475('0x44')],null))[_0xf475('0x21')](respondWithResult(_0x237cb0,null))[_0xf475('0x3f')](handleError(_0x237cb0,null));};exports[_0xf475('0x46')]=function(_0x307803,_0x1e33f6){return db[_0xf475('0x28')][_0xf475('0x42')]({'where':{'id':_0x307803[_0xf475('0x45')]['id']}})[_0xf475('0x21')](handleEntityNotFound(_0x1e33f6,null))[_0xf475('0x21')](removeEntity(_0x1e33f6,null))[_0xf475('0x3f')](handleError(_0x1e33f6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9bf6686..db9bb8f 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 _0x6b19=['moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','idField','FieldId','util','api'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x6b19,0x15d));var _0x96b1=function(_0xb91dcb,_0x3f6f2d){_0xb91dcb=_0xb91dcb-0x0;var _0x8e2e5b=_0x6b19[_0xb91dcb];return _0x8e2e5b;};'use strict';var _=require('lodash');var util=require(_0x96b1('0x0'));var logger=require('../../config/logger')(_0x96b1('0x1'));var moment=require(_0x96b1('0x2'));var BPromise=require(_0x96b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96b1('0x4'));var rimraf=require(_0x96b1('0x5'));var config=require(_0x96b1('0x6'));var attributes=require(_0x96b1('0x7'));module[_0x96b1('0x8')]=function(_0x18b15a,_0x4c12fb){return _0x18b15a[_0x96b1('0x9')](_0x96b1('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x96b1('0xb'),_0x96b1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65db=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports'];(function(_0x43c345,_0x4efb4d){var _0x138bfc=function(_0x248984){while(--_0x248984){_0x43c345['push'](_0x43c345['shift']());}};_0x138bfc(++_0x4efb4d);}(_0x65db,0xba));var _0xb65d=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x65db[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xb65d('0x0'));var util=require(_0xb65d('0x1'));var logger=require(_0xb65d('0x2'))(_0xb65d('0x3'));var moment=require('moment');var BPromise=require(_0xb65d('0x4'));var rp=require(_0xb65d('0x5'));var fs=require('fs');var path=require(_0xb65d('0x6'));var rimraf=require(_0xb65d('0x7'));var config=require('../../config/environment');var attributes=require(_0xb65d('0x8'));module[_0xb65d('0x9')]=function(_0x197fee,_0x19c731){return _0x197fee['define']('VtigerField',attributes,{'tableName':_0xb65d('0xa'),'paranoid':![],'indexes':[{'name':_0xb65d('0xb'),'fields':[_0xb65d('0xc'),_0xb65d('0xd')],'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 2261d7b..4b5f373 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 _0x0f89=['jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2f0c46,_0x6baaee){var _0x1ea4c4=function(_0xf406db){while(--_0xf406db){_0x2f0c46['push'](_0x2f0c46['shift']());}};_0x1ea4c4(++_0x6baaee);}(_0x0f89,0x1f1));var _0x90f8=function(_0x5c6edf,_0x3a8514){_0x5c6edf=_0x5c6edf-0x0;var _0x545039=_0x0f89[_0x5c6edf];return _0x545039;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var moment=require(_0x90f8('0x2'));var BPromise=require(_0x90f8('0x3'));var rs=require(_0x90f8('0x4'));var fs=require('fs');var Redis=require(_0x90f8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x90f8('0x6'));var logger=require(_0x90f8('0x7'))(_0x90f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x90f8('0x9'));var client=jayson[_0x90f8('0xa')][_0x90f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cdb80,_0x25c88b,_0x23d553){return new BPromise(function(_0xb0a707,_0x31940c){return client[_0x90f8('0xc')](_0x5cdb80,_0x23d553)['then'](function(_0x3a70bf){logger[_0x90f8('0xd')](_0x90f8('0xe'),_0x25c88b,_0x90f8('0xf'));logger['debug'](_0x90f8('0x10'),_0x25c88b,_0x90f8('0xf'),JSON[_0x90f8('0x11')](_0x3a70bf));if(_0x3a70bf[_0x90f8('0x12')]){if(_0x3a70bf['error']['code']===0x1f4){logger['error'](_0x90f8('0xe'),_0x25c88b,_0x3a70bf[_0x90f8('0x12')]['message']);return _0x31940c(_0x3a70bf[_0x90f8('0x12')][_0x90f8('0x13')]);}logger[_0x90f8('0x12')](_0x90f8('0xe'),_0x25c88b,_0x3a70bf[_0x90f8('0x12')][_0x90f8('0x13')]);return _0xb0a707(_0x3a70bf['error'][_0x90f8('0x13')]);}else{logger['info'](_0x90f8('0xe'),_0x25c88b,'request\x20sent');_0xb0a707(_0x3a70bf[_0x90f8('0x14')][_0x90f8('0x13')]);}})[_0x90f8('0x15')](function(_0x15f20d){logger[_0x90f8('0x12')](_0x90f8('0xe'),_0x25c88b,_0x15f20d);_0x31940c(_0x15f20d);});});} \ No newline at end of file +var _0xca5a=['request','info','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1362e0,_0x2ac729){var _0x3a73d2=function(_0x288d26){while(--_0x288d26){_0x1362e0['push'](_0x1362e0['shift']());}};_0x3a73d2(++_0x2ac729);}(_0xca5a,0x82));var _0xaca5=function(_0x33ef0b,_0x8b7f37){_0x33ef0b=_0x33ef0b-0x0;var _0x52be16=_0xca5a[_0x33ef0b];return _0x52be16;};'use strict';var _=require('lodash');var util=require(_0xaca5('0x0'));var moment=require('moment');var BPromise=require(_0xaca5('0x1'));var rs=require(_0xaca5('0x2'));var fs=require('fs');var Redis=require(_0xaca5('0x3'));var db=require(_0xaca5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaca5('0x5'))(_0xaca5('0x6'));var config=require(_0xaca5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaca5('0x8')][_0xaca5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a0f2a,_0x6a8d7a,_0x3b964c){return new BPromise(function(_0x45ab7a,_0x57b63d){return client[_0xaca5('0xa')](_0x1a0f2a,_0x3b964c)['then'](function(_0x367b3f){logger[_0xaca5('0xb')]('VtigerField,\x20%s,\x20%s',_0x6a8d7a,_0xaca5('0xc'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x6a8d7a,'request\x20sent',JSON[_0xaca5('0xd')](_0x367b3f));if(_0x367b3f[_0xaca5('0xe')]){if(_0x367b3f[_0xaca5('0xe')][_0xaca5('0xf')]===0x1f4){logger[_0xaca5('0xe')](_0xaca5('0x10'),_0x6a8d7a,_0x367b3f[_0xaca5('0xe')][_0xaca5('0x11')]);return _0x57b63d(_0x367b3f[_0xaca5('0xe')][_0xaca5('0x11')]);}logger['error'](_0xaca5('0x10'),_0x6a8d7a,_0x367b3f['error'][_0xaca5('0x11')]);return _0x45ab7a(_0x367b3f[_0xaca5('0xe')][_0xaca5('0x11')]);}else{logger[_0xaca5('0xb')](_0xaca5('0x10'),_0x6a8d7a,_0xaca5('0xc'));_0x45ab7a(_0x367b3f[_0xaca5('0x12')][_0xaca5('0x11')]);}})[_0xaca5('0x13')](function(_0x418cef){logger[_0xaca5('0xe')](_0xaca5('0x10'),_0x6a8d7a,_0x418cef);_0x57b63d(_0x418cef);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 91fb356..ba837e6 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 _0x41a6=['/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x41a6,0x65));var _0x641a=function(_0x4b9617,_0x1bdf76){_0x4b9617=_0x4b9617-0x0;var _0x5f04ab=_0x41a6[_0x4b9617];return _0x5f04ab;};'use strict';var multer=require(_0x641a('0x0'));var util=require('util');var path=require(_0x641a('0x1'));var timeout=require(_0x641a('0x2'));var express=require(_0x641a('0x3'));var router=express[_0x641a('0x4')]();var fs_extra=require(_0x641a('0x5'));var auth=require(_0x641a('0x6'));var interaction=require(_0x641a('0x7'));var config=require(_0x641a('0x8'));var controller=require('./intZendeskAccount.controller');router[_0x641a('0x9')]('/',auth[_0x641a('0xa')](),controller[_0x641a('0xb')]);router[_0x641a('0x9')](_0x641a('0xc'),auth[_0x641a('0xa')](),controller[_0x641a('0xd')]);router[_0x641a('0x9')](_0x641a('0xe'),auth['isAuthenticated'](),controller[_0x641a('0xf')]);router['get']('/:id/fields',auth[_0x641a('0xa')](),controller[_0x641a('0x10')]);router[_0x641a('0x11')]('/',auth[_0x641a('0xa')](),controller['create']);router[_0x641a('0x11')](_0x641a('0xe'),auth[_0x641a('0xa')](),controller[_0x641a('0x12')]);router[_0x641a('0x13')](_0x641a('0xc'),auth['isAuthenticated'](),controller[_0x641a('0x14')]);router[_0x641a('0x15')](_0x641a('0xc'),auth[_0x641a('0xa')](),controller[_0x641a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x351c=['post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','getFields'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x351c,0xd5));var _0xc351=function(_0x216cbf,_0x9ef74a){_0x216cbf=_0x216cbf-0x0;var _0x4bf3dc=_0x351c[_0x216cbf];return _0x4bf3dc;};'use strict';var multer=require('multer');var util=require(_0xc351('0x0'));var path=require(_0xc351('0x1'));var timeout=require(_0xc351('0x2'));var express=require(_0xc351('0x3'));var router=express[_0xc351('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc351('0x5'));var interaction=require(_0xc351('0x6'));var config=require(_0xc351('0x7'));var controller=require(_0xc351('0x8'));router['get']('/',auth[_0xc351('0x9')](),controller[_0xc351('0xa')]);router['get'](_0xc351('0xb'),auth[_0xc351('0x9')](),controller[_0xc351('0xc')]);router[_0xc351('0xd')](_0xc351('0xe'),auth['isAuthenticated'](),controller[_0xc351('0xf')]);router[_0xc351('0xd')]('/:id/fields',auth[_0xc351('0x9')](),controller[_0xc351('0x10')]);router[_0xc351('0x11')]('/',auth[_0xc351('0x9')](),controller['create']);router[_0xc351('0x11')](_0xc351('0xe'),auth[_0xc351('0x9')](),controller[_0xc351('0x12')]);router[_0xc351('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc351('0x14')]('/:id',auth[_0xc351('0x9')](),controller[_0xc351('0x15')]);module[_0xc351('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5f91122..7dfc820 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 _0xc838=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','newTab'];(function(_0x2e556e,_0x17da28){var _0x4b2ba3=function(_0x46db08){while(--_0x46db08){_0x2e556e['push'](_0x2e556e['shift']());}};_0x4b2ba3(++_0x17da28);}(_0xc838,0xbd));var _0x8c83=function(_0x31164c,_0x4b6325){_0x31164c=_0x31164c-0x0;var _0x509e10=_0xc838[_0x31164c];return _0x509e10;};'use strict';var Sequelize=require(_0x8c83('0x0'));module[_0x8c83('0x1')]={'name':{'type':Sequelize[_0x8c83('0x2')]},'description':{'type':Sequelize[_0x8c83('0x2')]},'username':{'type':Sequelize[_0x8c83('0x2')],'unique':_0x8c83('0x3')},'password':{'type':Sequelize[_0x8c83('0x2')]},'token':{'type':Sequelize[_0x8c83('0x2')]},'remoteUri':{'type':Sequelize[_0x8c83('0x2')],'unique':_0x8c83('0x4')},'authType':{'type':Sequelize[_0x8c83('0x5')](_0x8c83('0x6'),_0x8c83('0x7')),'defaultValue':_0x8c83('0x6')},'serverUrl':{'type':Sequelize[_0x8c83('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x8c83('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x79a3=['newTab','integrationTab','sequelize','STRING','username','remoteUri','ENUM','password','token'];(function(_0x9ad905,_0x32ec83){var _0x40e578=function(_0x332067){while(--_0x332067){_0x9ad905['push'](_0x9ad905['shift']());}};_0x40e578(++_0x32ec83);}(_0x79a3,0x80));var _0x379a=function(_0x112f76,_0x33b204){_0x112f76=_0x112f76-0x0;var _0x47109f=_0x79a3[_0x112f76];return _0x47109f;};'use strict';var Sequelize=require(_0x379a('0x0'));module['exports']={'name':{'type':Sequelize[_0x379a('0x1')]},'description':{'type':Sequelize[_0x379a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x379a('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x379a('0x3')},'authType':{'type':Sequelize[_0x379a('0x4')](_0x379a('0x5'),_0x379a('0x6')),'defaultValue':_0x379a('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x379a('0x7')),'defaultValue':_0x379a('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 54d0e2c..eabf29f 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 _0xe706=['getConfigurations','findOne','ZendeskConfiguration','pick','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','channel','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','GET','format','password','headers','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','show','includeAll','include','find','create','body','catch','params'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xe706,0xa3));var _0x6e70=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0xe706[_0x50abc4];return _0x5a745d;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];var integrations=require(_0x6e70('0x1d'));function respondWithStatusCode(_0x3b38f3,_0x310eb7){_0x310eb7=_0x310eb7||0xcc;return function(_0xa1eb74){if(_0xa1eb74){return _0x3b38f3[_0x6e70('0x1e')](_0x310eb7);}return _0x3b38f3['status'](_0x310eb7)['end']();};}function respondWithResult(_0x48bc72,_0x257e81){_0x257e81=_0x257e81||0xc8;return function(_0x5a37a6){if(_0x5a37a6){return _0x48bc72['status'](_0x257e81)[_0x6e70('0x1f')](_0x5a37a6);}};}function respondWithFilteredResult(_0x22c50c,_0x5d9263){return function(_0x24f3ac){if(_0x24f3ac){var _0x5c3fe7=typeof _0x5d9263[_0x6e70('0x20')]===_0x6e70('0x21')&&typeof _0x5d9263['limit']==='undefined';var _0x3bd572=_0x24f3ac['count'];var _0x28a21f=_0x5c3fe7?0x0:_0x5d9263[_0x6e70('0x20')];var _0x53acdc=_0x5c3fe7?_0x24f3ac['count']:_0x5d9263[_0x6e70('0x20')]+_0x5d9263[_0x6e70('0x22')];var _0x2368eb;if(_0x53acdc>=_0x3bd572){_0x53acdc=_0x3bd572;_0x2368eb=0xc8;}else{_0x2368eb=0xce;}_0x22c50c[_0x6e70('0x23')](_0x2368eb);return _0x22c50c[_0x6e70('0x24')](_0x6e70('0x25'),_0x28a21f+'-'+_0x53acdc+'/'+_0x3bd572)[_0x6e70('0x1f')](_0x24f3ac);}return null;};}function patchUpdates(_0x44a49f){return function(_0x29326f){try{jsonpatch[_0x6e70('0x26')](_0x29326f,_0x44a49f,!![]);}catch(_0x4a0cfe){return BPromise[_0x6e70('0x27')](_0x4a0cfe);}return _0x29326f[_0x6e70('0x28')]();};}function saveUpdates(_0x27b294,_0x502b2d){return function(_0x3ccd87){if(_0x3ccd87){return _0x3ccd87[_0x6e70('0x29')](_0x27b294)[_0x6e70('0x2a')](function(_0x50da2c){return _0x50da2c;});}return null;};}function removeEntity(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(_0x50aec2){return _0x50aec2['destroy']()[_0x6e70('0x2a')](function(){_0x10fc91[_0x6e70('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecdf1,_0x1196ed){return function(_0x5f268f){if(!_0x5f268f){_0x3ecdf1[_0x6e70('0x1e')](0x194);}return _0x5f268f;};}function handleError(_0x67fb43,_0x2bb231){_0x2bb231=_0x2bb231||0x1f4;return function(_0x4a67ac){logger['error'](_0x4a67ac[_0x6e70('0x2b')]);if(_0x4a67ac[_0x6e70('0x2c')]){delete _0x4a67ac[_0x6e70('0x2c')];}_0x67fb43[_0x6e70('0x23')](_0x2bb231)[_0x6e70('0x2d')](_0x4a67ac);};}exports['index']=function(_0x1952ea,_0x406f29){var _0xecf336={},_0x2864a0={},_0x396a67={'count':0x0,'rows':[]};var _0x20a225=_[_0x6e70('0x2e')](db[_0x6e70('0x2f')][_0x6e70('0x30')],function(_0x3a5d30){return{'name':_0x3a5d30['fieldName'],'type':_0x3a5d30[_0x6e70('0x31')]['key']};});_0x2864a0[_0x6e70('0x32')]=_['map'](_0x20a225,_0x6e70('0x2c'));_0x2864a0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1952ea['query']);_0x2864a0[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x2864a0['model'],_0x2864a0[_0x6e70('0x33')]);_0xecf336[_0x6e70('0x37')]=_['intersection'](_0x2864a0[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x38')]));_0xecf336[_0x6e70('0x37')]=_0xecf336[_0x6e70('0x37')][_0x6e70('0x39')]?_0xecf336[_0x6e70('0x37')]:_0x2864a0[_0x6e70('0x32')];if(!_0x1952ea[_0x6e70('0x33')]['hasOwnProperty'](_0x6e70('0x3a'))){_0xecf336['limit']=qs[_0x6e70('0x22')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x22')]);_0xecf336[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x20')]);}_0xecf336[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3c')]);_0xecf336[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_['pick'](_0x1952ea['query'],_0x2864a0['filters']),_0x20a225);if(_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]){_0xecf336[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0xecf336[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x20a225,function(_0x572a71){if(_0x572a71[_0x6e70('0x31')]!==_0x6e70('0x40')){var _0x1c5cde={};_0x1c5cde[_0x572a71[_0x6e70('0x2c')]]={'$like':'%'+_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]+'%'};return _0x1c5cde;}})});}_0xecf336=_[_0x6e70('0x3f')]({},_0xecf336,_0x1952ea[_0x6e70('0x41')]);var _0x5be100={'where':_0xecf336[_0x6e70('0x3d')]};return db[_0x6e70('0x2f')][_0x6e70('0x42')](_0x5be100)[_0x6e70('0x2a')](function(_0x201da9){_0x396a67[_0x6e70('0x42')]=_0x201da9;if(_0x1952ea[_0x6e70('0x33')]['includeAll']){_0xecf336['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x6e70('0x43')](_0xecf336);})[_0x6e70('0x2a')](function(_0x83847b){_0x396a67[_0x6e70('0x44')]=_0x83847b;return _0x396a67;})[_0x6e70('0x2a')](respondWithFilteredResult(_0x406f29,_0xecf336))['catch'](handleError(_0x406f29,null));};exports[_0x6e70('0x45')]=function(_0x2a58d7,_0x2a2aca){var _0x52b197={'raw':![],'where':{'id':_0x2a58d7['params']['id']}},_0x544ad0={};_0x544ad0[_0x6e70('0x32')]=_['keys'](db[_0x6e70('0x2f')][_0x6e70('0x30')]);_0x544ad0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x2a58d7['query']);_0x544ad0[_0x6e70('0x35')]=_['intersection'](_0x544ad0[_0x6e70('0x32')],_0x544ad0[_0x6e70('0x33')]);_0x52b197[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x544ad0['model'],qs[_0x6e70('0x38')](_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x38')]));_0x52b197[_0x6e70('0x37')]=_0x52b197[_0x6e70('0x37')][_0x6e70('0x39')]?_0x52b197[_0x6e70('0x37')]:_0x544ad0['model'];if(_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x46')]){_0x52b197[_0x6e70('0x47')]=[{'all':!![]}];}_0x52b197=_[_0x6e70('0x3f')]({},_0x52b197,_0x2a58d7[_0x6e70('0x41')]);return db[_0x6e70('0x2f')][_0x6e70('0x48')](_0x52b197)['then'](handleEntityNotFound(_0x2a2aca,null))[_0x6e70('0x2a')](respondWithResult(_0x2a2aca,null))['catch'](handleError(_0x2a2aca,null));};exports[_0x6e70('0x49')]=function(_0x3836e4,_0x4b351e){return db['ZendeskAccount'][_0x6e70('0x49')](_0x3836e4[_0x6e70('0x4a')],{})[_0x6e70('0x2a')](respondWithResult(_0x4b351e,0xc9))['catch'](handleError(_0x4b351e,null));};exports['update']=function(_0x238ebb,_0x11ac3d){if(_0x238ebb[_0x6e70('0x4a')]['id']){delete _0x238ebb[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x238ebb['params']['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x11ac3d,null))[_0x6e70('0x2a')](saveUpdates(_0x238ebb[_0x6e70('0x4a')],null))[_0x6e70('0x2a')](respondWithResult(_0x11ac3d,null))[_0x6e70('0x4b')](handleError(_0x11ac3d,null));};exports['destroy']=function(_0x4ae901,_0x2c5538){return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4ae901[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x2c5538,null))['then'](removeEntity(_0x2c5538,null))[_0x6e70('0x4b')](handleError(_0x2c5538,null));};exports[_0x6e70('0x4d')]=function(_0x1fa320,_0x23ebfb,_0x3aba34){var _0x4a111a={};var _0x1142cd={};var _0x1dd242;var _0x2c20d3;return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x1fa320[_0x6e70('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23ebfb,null))[_0x6e70('0x2a')](function(_0x8d425d){if(_0x8d425d){_0x1dd242=_0x8d425d;_0x1142cd['model']=_[_0x6e70('0x34')](db[_0x6e70('0x4f')]['rawAttributes']);_0x1142cd[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1fa320[_0x6e70('0x33')]);_0x1142cd[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x1142cd['model'],_0x1142cd[_0x6e70('0x33')]);_0x4a111a[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x1142cd[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x38')]));_0x4a111a[_0x6e70('0x37')]=_0x4a111a[_0x6e70('0x37')][_0x6e70('0x39')]?_0x4a111a[_0x6e70('0x37')]:_0x1142cd[_0x6e70('0x32')];_0x4a111a[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3c')]);_0x4a111a[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_[_0x6e70('0x50')](_0x1fa320[_0x6e70('0x33')],_0x1142cd['filters']));if(_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3e')]){_0x4a111a[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0x4a111a[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x4a111a['attributes'],function(_0x42bd85){var _0x6cabf0={};_0x6cabf0[_0x42bd85]={'$like':'%'+_0x1fa320['query'][_0x6e70('0x3e')]+'%'};return _0x6cabf0;})});}_0x4a111a=_[_0x6e70('0x3f')]({},_0x4a111a,_0x1fa320[_0x6e70('0x41')]);return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2f9be4){if(_0x2f9be4){_0x2c20d3=_0x2f9be4[_0x6e70('0x39')];if(!_0x1fa320[_0x6e70('0x33')][_0x6e70('0x51')](_0x6e70('0x3a'))){_0x4a111a[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x1fa320['query']['limit']);_0x4a111a[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x20')]);}return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2e972b){if(_0x2e972b){return _0x2e972b?{'count':_0x2c20d3,'rows':_0x2e972b}:null;}})[_0x6e70('0x2a')](respondWithResult(_0x23ebfb,null))['catch'](handleError(_0x23ebfb,null));};exports['addConfiguration']=function(_0x355708,_0x47fbed,_0x2a8fb7){if(_0x355708[_0x6e70('0x4a')]['id']){delete _0x355708[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x355708[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x47fbed,null))[_0x6e70('0x2a')](function(_0x570115){if(_0x570115){_0x355708[_0x6e70('0x4a')][_0x6e70('0x52')]=_0x570115['id'];_0x355708[_0x6e70('0x4a')][_0x6e70('0x53')]=integrations[_0x6e70('0x54')](_0x355708['body']['channel'],_0x355708['body'][_0x6e70('0x31')]);_0x355708[_0x6e70('0x4a')][_0x6e70('0x55')]=integrations['getDescriptions'](_0x355708['body'][_0x6e70('0x56')],_0x355708[_0x6e70('0x4a')][_0x6e70('0x31')]);return db[_0x6e70('0x4f')][_0x6e70('0x49')](_0x355708[_0x6e70('0x4a')],{'include':[{'model':db['ZendeskField'],'as':_0x6e70('0x53')},{'model':db[_0x6e70('0x57')],'as':_0x6e70('0x55')}]});}return null;})[_0x6e70('0x2a')](respondWithResult(_0x47fbed,null))['catch'](handleError(_0x47fbed,null));};exports[_0x6e70('0x58')]=function(_0x531097,_0x5b4046,_0x30487b){var _0x3249a5='';return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x531097[_0x6e70('0x4c')]['id']},'attributes':['id',_0x6e70('0x59'),'password',_0x6e70('0x5a'),_0x6e70('0x5b'),_0x6e70('0x5c')]})[_0x6e70('0x2a')](handleEntityNotFound(_0x5b4046,null))[_0x6e70('0x2a')](function(_0x13c092){if(_0x13c092){_0x3249a5=_0x13c092[_0x6e70('0x5c')];var _0xd9b4a9=_0x3249a5[_0x6e70('0x5d')](-0x1);if(_0xd9b4a9==='/'){_0x3249a5=_0x3249a5[_0x6e70('0x5e')](0x0,_0x3249a5['lastIndexOf'](_0xd9b4a9));}var _0x44c877={'method':_0x6e70('0x5f'),'uri':util[_0x6e70('0x60')]('%s/%s',_0x3249a5,'ticket_fields'),'json':!![]};switch(_0x13c092[_0x6e70('0x5b')]){case _0x6e70('0x61'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util['format']('%s:%s',_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x61')]))['toString'](_0x6e70('0x64')))};break;case _0x6e70('0x5a'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util[_0x6e70('0x60')](_0x6e70('0x65'),_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x5a')]))[_0x6e70('0x66')](_0x6e70('0x64')))};break;default:throw new db[(_0x6e70('0x67'))][(_0x6e70('0x68'))](_0x6e70('0x69'));}return rp(_0x44c877);}})['then'](function(_0x5b3cb0){if(_0x5b3cb0){var _0x39ed95=['subject',_0x6e70('0x6a'),'group','assignee'];_[_0x6e70('0x6b')](_0x5b3cb0['ticket_fields'],function(_0x576069){return _0x39ed95[_0x6e70('0x6c')](_0x576069[_0x6e70('0x31')]);});return{'count':_0x5b3cb0[_0x6e70('0x6d')]['length'],'rows':_['map'](_0x5b3cb0['ticket_fields'],function(_0x3e7be7){return{'id':_0x3e7be7['id'],'name':_0x3e7be7['position']>0x7?_0x3e7be7[_0x6e70('0x6e')]:_0x3e7be7[_0x6e70('0x31')],'custom':_0x3e7be7[_0x6e70('0x6f')]>0x7?!![]:![],'options':_0x3e7be7[_0x6e70('0x70')]?_0x3e7be7[_0x6e70('0x70')]:_0x3e7be7[_0x6e70('0x71')]?_0x3e7be7[_0x6e70('0x71')]:[]};})};}})['then'](respondWithResult(_0x5b4046,null))[_0x6e70('0x4b')](function(_0x2493b0){var _0xb649a6=_0x531097['query'][_0x6e70('0x72')]?0x1f4:_0x2493b0[_0x6e70('0x73')]||0x1f4;logger[_0x6e70('0x74')](_0x6e70('0x75'),_0x6e70('0x58'),_0xb649a6,JSON[_0x6e70('0x76')](_0x2493b0));delete _0x2493b0[_0x6e70('0x2c')];if(_0xb649a6===0x191){_0xb649a6=0x190;}_0x5b4046[_0x6e70('0x23')](_0xb649a6)[_0x6e70('0x2d')](_0x531097['query'][_0x6e70('0x72')]?{'message':_0x6e70('0x77'),'statusCode':_0x2493b0['statusCode']}:_0x2493b0);});}; \ No newline at end of file +var _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x433f99,_0x555e71){_0x433f99=_0x433f99-0x0;var _0xce5fca=_0xbc9d[_0x433f99];return _0xce5fca;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a403db5..ac9d64f 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 _0x6964=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskAccount','lodash','util','api','moment'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x6964,0x11c));var _0x4696=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x6964[_0x5a26f5];return _0x2e9ef7;};'use strict';var _=require(_0x4696('0x0'));var util=require(_0x4696('0x1'));var logger=require('../../config/logger')(_0x4696('0x2'));var moment=require(_0x4696('0x3'));var BPromise=require(_0x4696('0x4'));var rp=require(_0x4696('0x5'));var fs=require('fs');var path=require(_0x4696('0x6'));var rimraf=require(_0x4696('0x7'));var config=require(_0x4696('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4696('0x9')]=function(_0x9c6d3,_0x1c8e84){return _0x9c6d3[_0x4696('0xa')](_0x4696('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db7=['api','moment','request-promise','../../config/environment','exports','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x336e7a,_0x211e1a){var _0x3764db=function(_0x19fdbd){while(--_0x19fdbd){_0x336e7a['push'](_0x336e7a['shift']());}};_0x3764db(++_0x211e1a);}(_0x1db7,0x138));var _0x71db=function(_0x175516,_0x5be391){_0x175516=_0x175516-0x0;var _0x2da998=_0x1db7[_0x175516];return _0x2da998;};'use strict';var _=require(_0x71db('0x0'));var util=require(_0x71db('0x1'));var logger=require(_0x71db('0x2'))(_0x71db('0x3'));var moment=require(_0x71db('0x4'));var BPromise=require('bluebird');var rp=require(_0x71db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x71db('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x71db('0x7')]=function(_0x396b6d,_0x31ce3d){return _0x396b6d['define']('ZendeskAccount',attributes,{'tableName':_0x71db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index dea1eaf..d187fb7 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 _0xc640=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ZendeskAccount','findAll','options','where','attributes','include','map','model','debug','GetZendeskAccount','catch','ShowZendeskAccount','find','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc640,0x1ab));var _0x0c64=function(_0x4a8ace,_0x1d94ff){_0x4a8ace=_0x4a8ace-0x0;var _0xb6d6b8=_0xc640[_0x4a8ace];return _0xb6d6b8;};'use strict';var _=require(_0x0c64('0x0'));var util=require(_0x0c64('0x1'));var moment=require(_0x0c64('0x2'));var BPromise=require(_0x0c64('0x3'));var rs=require(_0x0c64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c64('0x5'))['db'];var utils=require(_0x0c64('0x6'));var logger=require(_0x0c64('0x7'))(_0x0c64('0x8'));var config=require(_0x0c64('0x9'));var jayson=require(_0x0c64('0xa'));var client=jayson['client'][_0x0c64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x300a64,_0x13bdb7,_0x532846){return new BPromise(function(_0x490f41,_0x279684){return client[_0x0c64('0xc')](_0x300a64,_0x532846)[_0x0c64('0xd')](function(_0x28b054){logger[_0x0c64('0xe')](_0x0c64('0xf'),_0x13bdb7,_0x0c64('0x10'));logger['debug'](_0x0c64('0x11'),_0x13bdb7,_0x0c64('0x10'),JSON[_0x0c64('0x12')](_0x28b054));if(_0x28b054[_0x0c64('0x13')]){if(_0x28b054[_0x0c64('0x13')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x13bdb7,_0x28b054['error']['message']);return _0x279684(_0x28b054[_0x0c64('0x13')][_0x0c64('0x14')]);}logger['error'](_0x0c64('0xf'),_0x13bdb7,_0x28b054['error'][_0x0c64('0x14')]);return _0x490f41(_0x28b054[_0x0c64('0x13')][_0x0c64('0x14')]);}else{logger[_0x0c64('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x13bdb7,'request\x20sent');_0x490f41(_0x28b054[_0x0c64('0x15')][_0x0c64('0x14')]);}})['catch'](function(_0x55c147){logger[_0x0c64('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x13bdb7,_0x55c147);_0x279684(_0x55c147);});});}exports['GetZendeskAccount']=function(_0x391047){var _0x91763e=this;return new Promise(function(_0x37557a,_0x3f366e){return db[_0x0c64('0x16')][_0x0c64('0x17')]({'raw':_0x391047[_0x0c64('0x18')]?_0x391047['options']['raw']===undefined?!![]:![]:!![],'where':_0x391047[_0x0c64('0x18')]?_0x391047['options'][_0x0c64('0x19')]||null:null,'attributes':_0x391047[_0x0c64('0x18')]?_0x391047[_0x0c64('0x18')][_0x0c64('0x1a')]||null:null,'limit':_0x391047['options']?_0x391047[_0x0c64('0x18')]['limit']||null:null,'include':_0x391047['options']?_0x391047[_0x0c64('0x18')][_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x391047[_0x0c64('0x18')][_0x0c64('0x1b')],function(_0x39cd4e){return{'model':db[_0x39cd4e['model']],'as':_0x39cd4e['as'],'attributes':_0x39cd4e[_0x0c64('0x1a')],'include':_0x39cd4e[_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x39cd4e[_0x0c64('0x1b')],function(_0x34002b){return{'model':db[_0x34002b[_0x0c64('0x1d')]],'as':_0x34002b['as'],'attributes':_0x34002b['attributes'],'include':_0x34002b[_0x0c64('0x1b')]?_['map'](_0x34002b[_0x0c64('0x1b')],function(_0x5bb891){return{'model':db[_0x5bb891[_0x0c64('0x1d')]],'as':_0x5bb891['as'],'attributes':_0x5bb891[_0x0c64('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0c64('0xd')](function(_0x48f9cc){logger[_0x0c64('0xe')]('GetZendeskAccount',_0x391047);logger[_0x0c64('0x1e')](_0x0c64('0x1f'),_0x391047,JSON[_0x0c64('0x12')](_0x48f9cc));_0x37557a(_0x48f9cc);})[_0x0c64('0x20')](function(_0x1ee941){logger['error'](_0x0c64('0x1f'),_0x1ee941[_0x0c64('0x14')],_0x391047);_0x3f366e(_0x91763e[_0x0c64('0x13')](0x1f4,_0x1ee941[_0x0c64('0x14')]));});});};exports[_0x0c64('0x21')]=function(_0x4754fa){var _0x3f61cc=this;return new Promise(function(_0x4b7b1f,_0x507f7c){return db['ZendeskAccount'][_0x0c64('0x22')]({'raw':_0x4754fa[_0x0c64('0x18')]?_0x4754fa['options'][_0x0c64('0x23')]===undefined?!![]:![]:!![],'where':_0x4754fa[_0x0c64('0x18')]?_0x4754fa['options']['where']||null:null,'attributes':_0x4754fa[_0x0c64('0x18')]?_0x4754fa[_0x0c64('0x18')][_0x0c64('0x1a')]||null:null,'include':_0x4754fa[_0x0c64('0x18')]?_0x4754fa[_0x0c64('0x18')][_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x4754fa[_0x0c64('0x18')][_0x0c64('0x1b')],function(_0x166482){return{'model':db[_0x166482[_0x0c64('0x1d')]],'as':_0x166482['as'],'attributes':_0x166482[_0x0c64('0x1a')],'include':_0x166482[_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x166482[_0x0c64('0x1b')],function(_0x43bc9){return{'model':db[_0x43bc9[_0x0c64('0x1d')]],'as':_0x43bc9['as'],'attributes':_0x43bc9[_0x0c64('0x1a')],'include':_0x43bc9[_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x43bc9['include'],function(_0x206188){return{'model':db[_0x206188[_0x0c64('0x1d')]],'as':_0x206188['as'],'attributes':_0x206188[_0x0c64('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0c64('0xd')](function(_0x586acc){logger[_0x0c64('0xe')](_0x0c64('0x21'),_0x4754fa);logger['debug']('ShowZendeskAccount',_0x4754fa,JSON[_0x0c64('0x12')](_0x586acc));_0x4b7b1f(_0x586acc);})[_0x0c64('0x20')](function(_0x5ddeb0){logger[_0x0c64('0x13')]('ShowZendeskAccount',_0x5ddeb0[_0x0c64('0x14')],_0x4754fa);_0x507f7c(_0x3f61cc[_0x0c64('0x13')](0x1f4,_0x5ddeb0[_0x0c64('0x14')]));});});}; \ No newline at end of file +var _0xd5b1=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowZendeskAccount','debug','lodash','bluebird'];(function(_0x184b1e,_0x35d3d9){var _0x51900b=function(_0x4a1d5d){while(--_0x4a1d5d){_0x184b1e['push'](_0x184b1e['shift']());}};_0x51900b(++_0x35d3d9);}(_0xd5b1,0x116));var _0x1d5b=function(_0x2943d9,_0x12fe5d){_0x2943d9=_0x2943d9-0x0;var _0x49313b=_0xd5b1[_0x2943d9];return _0x49313b;};'use strict';var _=require(_0x1d5b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1d5b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d5b('0x2'));var db=require(_0x1d5b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d5b('0x4'))('rpc');var config=require(_0x1d5b('0x5'));var jayson=require(_0x1d5b('0x6'));var client=jayson[_0x1d5b('0x7')][_0x1d5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1aba5a,_0x29b1c6,_0x4a8370){return new BPromise(function(_0x7c8b0e,_0x23f05a){return client[_0x1d5b('0x9')](_0x1aba5a,_0x4a8370)[_0x1d5b('0xa')](function(_0x32066f){logger[_0x1d5b('0xb')](_0x1d5b('0xc'),_0x29b1c6,_0x1d5b('0xd'));logger['debug'](_0x1d5b('0xe'),_0x29b1c6,'request\x20sent',JSON[_0x1d5b('0xf')](_0x32066f));if(_0x32066f[_0x1d5b('0x10')]){if(_0x32066f[_0x1d5b('0x10')][_0x1d5b('0x11')]===0x1f4){logger[_0x1d5b('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x29b1c6,_0x32066f[_0x1d5b('0x10')][_0x1d5b('0x12')]);return _0x23f05a(_0x32066f[_0x1d5b('0x10')][_0x1d5b('0x12')]);}logger[_0x1d5b('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x29b1c6,_0x32066f[_0x1d5b('0x10')][_0x1d5b('0x12')]);return _0x7c8b0e(_0x32066f[_0x1d5b('0x10')]['message']);}else{logger[_0x1d5b('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x29b1c6,_0x1d5b('0xd'));_0x7c8b0e(_0x32066f[_0x1d5b('0x13')][_0x1d5b('0x12')]);}})[_0x1d5b('0x14')](function(_0x22ff82){logger[_0x1d5b('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x29b1c6,_0x22ff82);_0x23f05a(_0x22ff82);});});}exports[_0x1d5b('0x15')]=function(_0x25b1e8){var _0x333b25=this;return new Promise(function(_0x3907f9,_0x29834a){return db[_0x1d5b('0x16')][_0x1d5b('0x17')]({'raw':_0x25b1e8['options']?_0x25b1e8[_0x1d5b('0x18')][_0x1d5b('0x19')]===undefined?!![]:![]:!![],'where':_0x25b1e8[_0x1d5b('0x18')]?_0x25b1e8['options'][_0x1d5b('0x1a')]||null:null,'attributes':_0x25b1e8[_0x1d5b('0x18')]?_0x25b1e8['options'][_0x1d5b('0x1b')]||null:null,'limit':_0x25b1e8['options']?_0x25b1e8[_0x1d5b('0x18')][_0x1d5b('0x1c')]||null:null,'include':_0x25b1e8[_0x1d5b('0x18')]?_0x25b1e8[_0x1d5b('0x18')][_0x1d5b('0x1d')]?_[_0x1d5b('0x1e')](_0x25b1e8['options'][_0x1d5b('0x1d')],function(_0x129bd7){return{'model':db[_0x129bd7[_0x1d5b('0x1f')]],'as':_0x129bd7['as'],'attributes':_0x129bd7[_0x1d5b('0x1b')],'include':_0x129bd7[_0x1d5b('0x1d')]?_[_0x1d5b('0x1e')](_0x129bd7['include'],function(_0x556e86){return{'model':db[_0x556e86[_0x1d5b('0x1f')]],'as':_0x556e86['as'],'attributes':_0x556e86['attributes'],'include':_0x556e86[_0x1d5b('0x1d')]?_[_0x1d5b('0x1e')](_0x556e86['include'],function(_0x58f7b5){return{'model':db[_0x58f7b5[_0x1d5b('0x1f')]],'as':_0x58f7b5['as'],'attributes':_0x58f7b5[_0x1d5b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1d5b('0xa')](function(_0x3630af){logger[_0x1d5b('0xb')](_0x1d5b('0x15'),_0x25b1e8);logger['debug']('GetZendeskAccount',_0x25b1e8,JSON[_0x1d5b('0xf')](_0x3630af));_0x3907f9(_0x3630af);})['catch'](function(_0x2904de){logger[_0x1d5b('0x10')](_0x1d5b('0x15'),_0x2904de[_0x1d5b('0x12')],_0x25b1e8);_0x29834a(_0x333b25[_0x1d5b('0x10')](0x1f4,_0x2904de[_0x1d5b('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x256f38){var _0x3b3286=this;return new Promise(function(_0xb2d930,_0x2b3a97){return db[_0x1d5b('0x16')][_0x1d5b('0x20')]({'raw':_0x256f38[_0x1d5b('0x18')]?_0x256f38[_0x1d5b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x256f38[_0x1d5b('0x18')]?_0x256f38[_0x1d5b('0x18')]['where']||null:null,'attributes':_0x256f38['options']?_0x256f38[_0x1d5b('0x18')][_0x1d5b('0x1b')]||null:null,'include':_0x256f38[_0x1d5b('0x18')]?_0x256f38[_0x1d5b('0x18')]['include']?_['map'](_0x256f38['options'][_0x1d5b('0x1d')],function(_0x347fb4){return{'model':db[_0x347fb4['model']],'as':_0x347fb4['as'],'attributes':_0x347fb4[_0x1d5b('0x1b')],'include':_0x347fb4['include']?_['map'](_0x347fb4[_0x1d5b('0x1d')],function(_0x5e0b27){return{'model':db[_0x5e0b27['model']],'as':_0x5e0b27['as'],'attributes':_0x5e0b27['attributes'],'include':_0x5e0b27['include']?_['map'](_0x5e0b27[_0x1d5b('0x1d')],function(_0x8e8666){return{'model':db[_0x8e8666[_0x1d5b('0x1f')]],'as':_0x8e8666['as'],'attributes':_0x8e8666[_0x1d5b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1d5b('0xa')](function(_0x5bf0a2){logger[_0x1d5b('0xb')](_0x1d5b('0x21'),_0x256f38);logger[_0x1d5b('0x22')](_0x1d5b('0x21'),_0x256f38,JSON[_0x1d5b('0xf')](_0x5bf0a2));_0xb2d930(_0x5bf0a2);})[_0x1d5b('0x14')](function(_0x3f6572){logger['error'](_0x1d5b('0x21'),_0x3f6572[_0x1d5b('0x12')],_0x256f38);_0x2b3a97(_0x3b3286[_0x1d5b('0x10')](0x1f4,_0x3f6572['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index e5c6d83..5a0cb70 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4a3a6f,_0x18824a){_0x4a3a6f=_0x4a3a6f-0x0;var _0x99835a=_0x9ffd[_0x4a3a6f];return _0x99835a;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file +var _0xe706=['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','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x11a854,_0x3e5408){var _0x16c2ab=function(_0x38d344){while(--_0x38d344){_0x11a854['push'](_0x11a854['shift']());}};_0x16c2ab(++_0x3e5408);}(_0xe706,0xa3));var _0x6e70=function(_0x1e8461,_0x5e1500){_0x1e8461=_0x1e8461-0x0;var _0x528f4d=_0xe706[_0x1e8461];return _0x528f4d;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 1dbc4ba..fbef23c 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 _0x0b93=['sequelize'];(function(_0x5c533c,_0x519d54){var _0x1c58aa=function(_0x13bd55){while(--_0x13bd55){_0x5c533c['push'](_0x5c533c['shift']());}};_0x1c58aa(++_0x519d54);}(_0x0b93,0x111));var _0x30b9=function(_0x3e56c7,_0x334c9b){_0x3e56c7=_0x3e56c7-0x0;var _0x4fef94=_0x0b93[_0x3e56c7];return _0x4fef94;};'use strict';var Sequelize=require(_0x30b9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc135=['exports','STRING','sequelize'];(function(_0xbfe7d3,_0xd501f2){var _0x2a10f5=function(_0x423388){while(--_0x423388){_0xbfe7d3['push'](_0xbfe7d3['shift']());}};_0x2a10f5(++_0xd501f2);}(_0xc135,0x1f4));var _0x5c13=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc135[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5c13('0x0'));module[_0x5c13('0x1')]={'name':{'type':Sequelize[_0x5c13('0x2')]},'description':{'type':Sequelize[_0x5c13('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2044cf6..277eecf 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 _0x0a5b=['keys','rawAttributes','find','create','body','update','getFields','findOne','ZendeskField','catch','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','map','ZendeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x0a5b,0x163));var _0xb0a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a5b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb0a5('0x0'));var rimraf=require(_0xb0a5('0x1'));var zipdir=require(_0xb0a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0a5('0x3'));var moment=require(_0xb0a5('0x4'));var BPromise=require(_0xb0a5('0x5'));var Mustache=require('mustache');var util=require(_0xb0a5('0x6'));var path=require(_0xb0a5('0x7'));var sox=require('sox');var csv=require(_0xb0a5('0x8'));var ejs=require(_0xb0a5('0x9'));var fs=require('fs');var fs_extra=require(_0xb0a5('0xa'));var _=require('lodash');var squel=require(_0xb0a5('0xb'));var crypto=require(_0xb0a5('0xc'));var jsforce=require(_0xb0a5('0xd'));var deskjs=require(_0xb0a5('0xe'));var toCsv=require(_0xb0a5('0x8'));var querystring=require('querystring');var Papa=require(_0xb0a5('0xf'));var Redis=require(_0xb0a5('0x10'));var authService=require(_0xb0a5('0x11'));var qs=require(_0xb0a5('0x12'));var as=require(_0xb0a5('0x13'));var hardwareService=require(_0xb0a5('0x14'));var logger=require(_0xb0a5('0x15'))(_0xb0a5('0x16'));var utils=require('../../config/utils');var config=require(_0xb0a5('0x17'));var licenseUtil=require(_0xb0a5('0x18'));var db=require(_0xb0a5('0x19'))['db'];function respondWithStatusCode(_0x4f0b69,_0x5efd35){_0x5efd35=_0x5efd35||0xcc;return function(_0x412a4e){if(_0x412a4e){return _0x4f0b69[_0xb0a5('0x1a')](_0x5efd35);}return _0x4f0b69[_0xb0a5('0x1b')](_0x5efd35)[_0xb0a5('0x1c')]();};}function respondWithResult(_0x3066c7,_0x39d7f6){_0x39d7f6=_0x39d7f6||0xc8;return function(_0x63a40a){if(_0x63a40a){return _0x3066c7[_0xb0a5('0x1b')](_0x39d7f6)[_0xb0a5('0x1d')](_0x63a40a);}};}function respondWithFilteredResult(_0x17111f,_0x1defd9){return function(_0x219f50){if(_0x219f50){var _0x367d1f=typeof _0x1defd9[_0xb0a5('0x1e')]===_0xb0a5('0x1f')&&typeof _0x1defd9[_0xb0a5('0x20')]==='undefined';var _0x59e873=_0x219f50['count'];var _0x37602f=_0x367d1f?0x0:_0x1defd9['offset'];var _0x3fd771=_0x367d1f?_0x219f50[_0xb0a5('0x21')]:_0x1defd9[_0xb0a5('0x1e')]+_0x1defd9[_0xb0a5('0x20')];var _0x37372a;if(_0x3fd771>=_0x59e873){_0x3fd771=_0x59e873;_0x37372a=0xc8;}else{_0x37372a=0xce;}_0x17111f['status'](_0x37372a);return _0x17111f[_0xb0a5('0x22')]('Content-Range',_0x37602f+'-'+_0x3fd771+'/'+_0x59e873)[_0xb0a5('0x1d')](_0x219f50);}return null;};}function patchUpdates(_0x440698){return function(_0x8fb61b){try{jsonpatch[_0xb0a5('0x23')](_0x8fb61b,_0x440698,!![]);}catch(_0x50b522){return BPromise[_0xb0a5('0x24')](_0x50b522);}return _0x8fb61b['save']();};}function saveUpdates(_0x45fa50,_0x144dbf){return function(_0x5c3e44){if(_0x5c3e44){return _0x5c3e44['update'](_0x45fa50)[_0xb0a5('0x25')](function(_0x5e6e5f){return _0x5e6e5f;});}return null;};}function removeEntity(_0x3510cf,_0x3d9888){return function(_0x206913){if(_0x206913){return _0x206913[_0xb0a5('0x26')]()[_0xb0a5('0x25')](function(){_0x3510cf[_0xb0a5('0x1b')](0xcc)[_0xb0a5('0x1c')]();});}};}function handleEntityNotFound(_0x88be3b,_0x2ab83){return function(_0x82e0f0){if(!_0x82e0f0){_0x88be3b[_0xb0a5('0x1a')](0x194);}return _0x82e0f0;};}function handleError(_0x2758ea,_0x309475){_0x309475=_0x309475||0x1f4;return function(_0x4de0e1){logger[_0xb0a5('0x27')](_0x4de0e1[_0xb0a5('0x28')]);if(_0x4de0e1[_0xb0a5('0x29')]){delete _0x4de0e1[_0xb0a5('0x29')];}_0x2758ea['status'](_0x309475)[_0xb0a5('0x2a')](_0x4de0e1);};}exports['index']=function(_0xed8a17,_0x4d9e32){var _0x12462a={},_0xcbffd8={},_0x30a2f2={'count':0x0,'rows':[]};var _0x5316f5=_[_0xb0a5('0x2b')](db[_0xb0a5('0x2c')]['rawAttributes'],function(_0x32569d){return{'name':_0x32569d[_0xb0a5('0x2d')],'type':_0x32569d[_0xb0a5('0x2e')][_0xb0a5('0x2f')]};});_0xcbffd8[_0xb0a5('0x30')]=_[_0xb0a5('0x2b')](_0x5316f5,'name');_0xcbffd8[_0xb0a5('0x31')]=_['keys'](_0xed8a17[_0xb0a5('0x31')]);_0xcbffd8[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0xcbffd8[_0xb0a5('0x30')],_0xcbffd8[_0xb0a5('0x31')]);_0x12462a[_0xb0a5('0x34')]=_['intersection'](_0xcbffd8[_0xb0a5('0x30')],qs[_0xb0a5('0x35')](_0xed8a17['query'][_0xb0a5('0x35')]));_0x12462a[_0xb0a5('0x34')]=_0x12462a[_0xb0a5('0x34')][_0xb0a5('0x36')]?_0x12462a['attributes']:_0xcbffd8[_0xb0a5('0x30')];if(!_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x37')](_0xb0a5('0x38'))){_0x12462a['limit']=qs['limit'](_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x20')]);_0x12462a[_0xb0a5('0x1e')]=qs[_0xb0a5('0x1e')](_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x1e')]);}_0x12462a[_0xb0a5('0x39')]=qs[_0xb0a5('0x3a')](_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x3a')]);_0x12462a[_0xb0a5('0x3b')]=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0xed8a17[_0xb0a5('0x31')],_0xcbffd8[_0xb0a5('0x32')]),_0x5316f5);if(_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x3d')]){_0x12462a[_0xb0a5('0x3b')]=_[_0xb0a5('0x3e')](_0x12462a[_0xb0a5('0x3b')],{'$or':_['map'](_0x5316f5,function(_0x5a6653){if(_0x5a6653[_0xb0a5('0x2e')]!==_0xb0a5('0x3f')){var _0x107c89={};_0x107c89[_0x5a6653[_0xb0a5('0x29')]]={'$like':'%'+_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x3d')]+'%'};return _0x107c89;}})});}_0x12462a=_[_0xb0a5('0x3e')]({},_0x12462a,_0xed8a17[_0xb0a5('0x40')]);var _0x10fd63={'where':_0x12462a[_0xb0a5('0x3b')]};return db['ZendeskConfiguration'][_0xb0a5('0x21')](_0x10fd63)[_0xb0a5('0x25')](function(_0x54fbf1){_0x30a2f2[_0xb0a5('0x21')]=_0x54fbf1;if(_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x41')]){_0x12462a[_0xb0a5('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb0a5('0x43')](_0x12462a);})[_0xb0a5('0x25')](function(_0x31b3d7){_0x30a2f2['rows']=_0x31b3d7;return _0x30a2f2;})[_0xb0a5('0x25')](respondWithFilteredResult(_0x4d9e32,_0x12462a))['catch'](handleError(_0x4d9e32,null));};exports[_0xb0a5('0x44')]=function(_0x28b053,_0x57380b){var _0x4017f0={'raw':![],'where':{'id':_0x28b053[_0xb0a5('0x45')]['id']}},_0x4f45df={};_0x4f45df[_0xb0a5('0x30')]=_[_0xb0a5('0x46')](db['ZendeskConfiguration'][_0xb0a5('0x47')]);_0x4f45df[_0xb0a5('0x31')]=_['keys'](_0x28b053[_0xb0a5('0x31')]);_0x4f45df[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x4f45df['model'],_0x4f45df[_0xb0a5('0x31')]);_0x4017f0['attributes']=_['intersection'](_0x4f45df[_0xb0a5('0x30')],qs[_0xb0a5('0x35')](_0x28b053[_0xb0a5('0x31')][_0xb0a5('0x35')]));_0x4017f0[_0xb0a5('0x34')]=_0x4017f0['attributes'][_0xb0a5('0x36')]?_0x4017f0[_0xb0a5('0x34')]:_0x4f45df[_0xb0a5('0x30')];if(_0x28b053[_0xb0a5('0x31')][_0xb0a5('0x41')]){_0x4017f0['include']=[{'all':!![]}];}_0x4017f0=_[_0xb0a5('0x3e')]({},_0x4017f0,_0x28b053['options']);return db[_0xb0a5('0x2c')][_0xb0a5('0x48')](_0x4017f0)[_0xb0a5('0x25')](handleEntityNotFound(_0x57380b,null))[_0xb0a5('0x25')](respondWithResult(_0x57380b,null))['catch'](handleError(_0x57380b,null));};exports[_0xb0a5('0x49')]=function(_0x52ffee,_0x1807de){return db[_0xb0a5('0x2c')][_0xb0a5('0x49')](_0x52ffee[_0xb0a5('0x4a')],{})[_0xb0a5('0x25')](respondWithResult(_0x1807de,0xc9))['catch'](handleError(_0x1807de,null));};exports[_0xb0a5('0x4b')]=function(_0x4774d1,_0x46f473){if(_0x4774d1[_0xb0a5('0x4a')]['id']){delete _0x4774d1[_0xb0a5('0x4a')]['id'];}return db[_0xb0a5('0x2c')][_0xb0a5('0x48')]({'where':{'id':_0x4774d1['params']['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x46f473,null))[_0xb0a5('0x25')](saveUpdates(_0x4774d1[_0xb0a5('0x4a')],null))[_0xb0a5('0x25')](respondWithResult(_0x46f473,null))['catch'](handleError(_0x46f473,null));};exports[_0xb0a5('0x26')]=function(_0x357176,_0x4ce278){return db[_0xb0a5('0x2c')][_0xb0a5('0x48')]({'where':{'id':_0x357176[_0xb0a5('0x45')]['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x4ce278,null))['then'](removeEntity(_0x4ce278,null))['catch'](handleError(_0x4ce278,null));};exports[_0xb0a5('0x4c')]=function(_0x34ed76,_0x3d24bc,_0x19ca8a){var _0x49ed8a={};var _0x4736e1={};var _0x4ee8b5;var _0x11adc9;return db[_0xb0a5('0x2c')][_0xb0a5('0x4d')]({'where':{'id':_0x34ed76['params']['id']}})['then'](handleEntityNotFound(_0x3d24bc,null))[_0xb0a5('0x25')](function(_0x40afcf){if(_0x40afcf){_0x4ee8b5=_0x40afcf;_0x4736e1[_0xb0a5('0x30')]=_[_0xb0a5('0x46')](db[_0xb0a5('0x4e')][_0xb0a5('0x47')]);_0x4736e1['query']=_['keys'](_0x34ed76[_0xb0a5('0x31')]);_0x4736e1[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x4736e1[_0xb0a5('0x30')],_0x4736e1['query']);_0x49ed8a[_0xb0a5('0x34')]=_[_0xb0a5('0x33')](_0x4736e1['model'],qs[_0xb0a5('0x35')](_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x35')]));_0x49ed8a[_0xb0a5('0x34')]=_0x49ed8a[_0xb0a5('0x34')][_0xb0a5('0x36')]?_0x49ed8a[_0xb0a5('0x34')]:_0x4736e1[_0xb0a5('0x30')];_0x49ed8a['order']=qs[_0xb0a5('0x3a')](_0x34ed76['query'][_0xb0a5('0x3a')]);_0x49ed8a['where']=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0x34ed76['query'],_0x4736e1[_0xb0a5('0x32')]));if(_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x3d')]){_0x49ed8a[_0xb0a5('0x3b')]=_[_0xb0a5('0x3e')](_0x49ed8a['where'],{'$or':_[_0xb0a5('0x2b')](_0x49ed8a[_0xb0a5('0x34')],function(_0x420f47){var _0x14a780={};_0x14a780[_0x420f47]={'$like':'%'+_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x3d')]+'%'};return _0x14a780;})});}_0x49ed8a=_[_0xb0a5('0x3e')]({},_0x49ed8a,_0x34ed76['options']);return _0x4ee8b5[_0xb0a5('0x4c')](_0x49ed8a);}})[_0xb0a5('0x25')](function(_0xbcd4a0){if(_0xbcd4a0){_0x11adc9=_0xbcd4a0['length'];if(!_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x37')](_0xb0a5('0x38'))){_0x49ed8a['limit']=qs['limit'](_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x20')]);_0x49ed8a[_0xb0a5('0x1e')]=qs[_0xb0a5('0x1e')](_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x1e')]);}return _0x4ee8b5['getFields'](_0x49ed8a);}})[_0xb0a5('0x25')](function(_0x18570f){if(_0x18570f){return _0x18570f?{'count':_0x11adc9,'rows':_0x18570f}:null;}})[_0xb0a5('0x25')](respondWithResult(_0x3d24bc,null))[_0xb0a5('0x4f')](handleError(_0x3d24bc,null));};exports['getSubjects']=function(_0x4e3cd3,_0x47a255,_0x4105e1){var _0x5a7d9f={};var _0x71f89e={};var _0x5634b7;var _0x121c90;return db[_0xb0a5('0x2c')]['findOne']({'where':{'id':_0x4e3cd3['params']['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x47a255,null))[_0xb0a5('0x25')](function(_0x413d08){if(_0x413d08){_0x5634b7=_0x413d08;_0x71f89e[_0xb0a5('0x30')]=_[_0xb0a5('0x46')](db['ZendeskField'][_0xb0a5('0x47')]);_0x71f89e[_0xb0a5('0x31')]=_[_0xb0a5('0x46')](_0x4e3cd3[_0xb0a5('0x31')]);_0x71f89e[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x71f89e[_0xb0a5('0x30')],_0x71f89e[_0xb0a5('0x31')]);_0x5a7d9f[_0xb0a5('0x34')]=_[_0xb0a5('0x33')](_0x71f89e[_0xb0a5('0x30')],qs[_0xb0a5('0x35')](_0x4e3cd3[_0xb0a5('0x31')]['fields']));_0x5a7d9f[_0xb0a5('0x34')]=_0x5a7d9f[_0xb0a5('0x34')]['length']?_0x5a7d9f['attributes']:_0x71f89e['model'];_0x5a7d9f[_0xb0a5('0x39')]=qs[_0xb0a5('0x3a')](_0x4e3cd3['query'][_0xb0a5('0x3a')]);_0x5a7d9f[_0xb0a5('0x3b')]=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0x4e3cd3[_0xb0a5('0x31')],_0x71f89e[_0xb0a5('0x32')]));if(_0x4e3cd3[_0xb0a5('0x31')][_0xb0a5('0x3d')]){_0x5a7d9f[_0xb0a5('0x3b')]=_[_0xb0a5('0x3e')](_0x5a7d9f[_0xb0a5('0x3b')],{'$or':_['map'](_0x5a7d9f[_0xb0a5('0x34')],function(_0x5aa1c0){var _0x25a453={};_0x25a453[_0x5aa1c0]={'$like':'%'+_0x4e3cd3[_0xb0a5('0x31')][_0xb0a5('0x3d')]+'%'};return _0x25a453;})});}_0x5a7d9f=_['merge']({},_0x5a7d9f,_0x4e3cd3['options']);return _0x5634b7['getSubjects'](_0x5a7d9f);}})[_0xb0a5('0x25')](function(_0x318aba){if(_0x318aba){_0x121c90=_0x318aba[_0xb0a5('0x36')];if(!_0x4e3cd3[_0xb0a5('0x31')][_0xb0a5('0x37')](_0xb0a5('0x38'))){_0x5a7d9f[_0xb0a5('0x20')]=qs[_0xb0a5('0x20')](_0x4e3cd3[_0xb0a5('0x31')][_0xb0a5('0x20')]);_0x5a7d9f[_0xb0a5('0x1e')]=qs[_0xb0a5('0x1e')](_0x4e3cd3['query'][_0xb0a5('0x1e')]);}return _0x5634b7[_0xb0a5('0x50')](_0x5a7d9f);}})[_0xb0a5('0x25')](function(_0x124473){if(_0x124473){return _0x124473?{'count':_0x121c90,'rows':_0x124473}:null;}})[_0xb0a5('0x25')](respondWithResult(_0x47a255,null))[_0xb0a5('0x4f')](handleError(_0x47a255,null));};exports[_0xb0a5('0x51')]=function(_0x3c9327,_0x4ff1d6,_0x179b10){var _0x35715a={};var _0x307cf6={};var _0x3f5663;var _0x3a6aec;return db[_0xb0a5('0x2c')]['findOne']({'where':{'id':_0x3c9327['params']['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x4ff1d6,null))[_0xb0a5('0x25')](function(_0x1f5a1d){if(_0x1f5a1d){_0x3f5663=_0x1f5a1d;_0x307cf6['model']=_[_0xb0a5('0x46')](db[_0xb0a5('0x4e')][_0xb0a5('0x47')]);_0x307cf6[_0xb0a5('0x31')]=_[_0xb0a5('0x46')](_0x3c9327['query']);_0x307cf6[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x307cf6[_0xb0a5('0x30')],_0x307cf6['query']);_0x35715a[_0xb0a5('0x34')]=_[_0xb0a5('0x33')](_0x307cf6[_0xb0a5('0x30')],qs[_0xb0a5('0x35')](_0x3c9327['query'][_0xb0a5('0x35')]));_0x35715a[_0xb0a5('0x34')]=_0x35715a[_0xb0a5('0x34')][_0xb0a5('0x36')]?_0x35715a[_0xb0a5('0x34')]:_0x307cf6[_0xb0a5('0x30')];_0x35715a[_0xb0a5('0x39')]=qs['sort'](_0x3c9327['query'][_0xb0a5('0x3a')]);_0x35715a[_0xb0a5('0x3b')]=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0x3c9327[_0xb0a5('0x31')],_0x307cf6['filters']));if(_0x3c9327[_0xb0a5('0x31')][_0xb0a5('0x3d')]){_0x35715a[_0xb0a5('0x3b')]=_['merge'](_0x35715a[_0xb0a5('0x3b')],{'$or':_[_0xb0a5('0x2b')](_0x35715a['attributes'],function(_0xa4e2bc){var _0xb58f99={};_0xb58f99[_0xa4e2bc]={'$like':'%'+_0x3c9327['query'][_0xb0a5('0x3d')]+'%'};return _0xb58f99;})});}_0x35715a=_[_0xb0a5('0x3e')]({},_0x35715a,_0x3c9327[_0xb0a5('0x40')]);return _0x3f5663[_0xb0a5('0x51')](_0x35715a);}})['then'](function(_0x580564){if(_0x580564){_0x3a6aec=_0x580564[_0xb0a5('0x36')];if(!_0x3c9327['query'][_0xb0a5('0x37')]('nolimit')){_0x35715a[_0xb0a5('0x20')]=qs[_0xb0a5('0x20')](_0x3c9327['query'][_0xb0a5('0x20')]);_0x35715a[_0xb0a5('0x1e')]=qs[_0xb0a5('0x1e')](_0x3c9327['query']['offset']);}return _0x3f5663[_0xb0a5('0x51')](_0x35715a);}})[_0xb0a5('0x25')](function(_0xe39c7f){if(_0xe39c7f){return _0xe39c7f?{'count':_0x3a6aec,'rows':_0xe39c7f}:null;}})[_0xb0a5('0x25')](respondWithResult(_0x4ff1d6,null))[_0xb0a5('0x4f')](handleError(_0x4ff1d6,null));};exports['getTags']=function(_0x36e51b,_0x300e8a,_0x359dbe){var _0x359ca9={};var _0x22b400={};var _0x50d896;var _0x2fb4c5;return db[_0xb0a5('0x2c')][_0xb0a5('0x4d')]({'where':{'id':_0x36e51b[_0xb0a5('0x45')]['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x300e8a,null))['then'](function(_0x4bd6ac){if(_0x4bd6ac){_0x50d896=_0x4bd6ac;_0x22b400[_0xb0a5('0x30')]=_[_0xb0a5('0x46')](db['Tag']['rawAttributes']);_0x22b400[_0xb0a5('0x31')]=_[_0xb0a5('0x46')](_0x36e51b[_0xb0a5('0x31')]);_0x22b400[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x22b400[_0xb0a5('0x30')],_0x22b400[_0xb0a5('0x31')]);_0x359ca9[_0xb0a5('0x34')]=_['intersection'](_0x22b400['model'],qs['fields'](_0x36e51b[_0xb0a5('0x31')][_0xb0a5('0x35')]));_0x359ca9[_0xb0a5('0x34')]=_0x359ca9['attributes'][_0xb0a5('0x36')]?_0x359ca9[_0xb0a5('0x34')]:_0x22b400['model'];_0x359ca9[_0xb0a5('0x39')]=qs[_0xb0a5('0x3a')](_0x36e51b[_0xb0a5('0x31')][_0xb0a5('0x3a')]);_0x359ca9[_0xb0a5('0x3b')]=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0x36e51b[_0xb0a5('0x31')],_0x22b400['filters']));if(_0x36e51b['query']['filter']){_0x359ca9[_0xb0a5('0x3b')]=_[_0xb0a5('0x3e')](_0x359ca9['where'],{'$or':_[_0xb0a5('0x2b')](_0x359ca9[_0xb0a5('0x34')],function(_0x4cb55b){var _0x2aa27f={};_0x2aa27f[_0x4cb55b]={'$like':'%'+_0x36e51b[_0xb0a5('0x31')]['filter']+'%'};return _0x2aa27f;})});}_0x359ca9=_[_0xb0a5('0x3e')]({},_0x359ca9,_0x36e51b['options']);return _0x50d896['getTags'](_0x359ca9);}})['then'](function(_0x520457){if(_0x520457){_0x2fb4c5=_0x520457[_0xb0a5('0x36')];if(!_0x36e51b[_0xb0a5('0x31')][_0xb0a5('0x37')](_0xb0a5('0x38'))){_0x359ca9['limit']=qs[_0xb0a5('0x20')](_0x36e51b[_0xb0a5('0x31')]['limit']);_0x359ca9['offset']=qs[_0xb0a5('0x1e')](_0x36e51b[_0xb0a5('0x31')][_0xb0a5('0x1e')]);}return _0x50d896[_0xb0a5('0x52')](_0x359ca9);}})[_0xb0a5('0x25')](function(_0x4f9e90){if(_0x4f9e90){return _0x4f9e90?{'count':_0x2fb4c5,'rows':_0x4f9e90}:null;}})[_0xb0a5('0x25')](respondWithResult(_0x300e8a,null))[_0xb0a5('0x4f')](handleError(_0x300e8a,null));};exports[_0xb0a5('0x53')]=function(_0x38b622,_0x63fbde,_0x32048d){if(_0x38b622['body']['id']){delete _0x38b622[_0xb0a5('0x4a')]['id'];}return db[_0xb0a5('0x2c')]['findOne']({'where':{'id':_0x38b622['params']['id']}})['then'](handleEntityNotFound(_0x63fbde,null))[_0xb0a5('0x25')](function(_0x5adc1f){if(_0x5adc1f){return _0x5adc1f[_0xb0a5('0x53')](_0x38b622['body'][_0xb0a5('0x54')]||[]);}return null;})[_0xb0a5('0x25')](respondWithResult(_0x63fbde,null))['catch'](handleError(_0x63fbde,null));}; \ No newline at end of file +var _0x06a5=['intersection','attributes','fields','sort','where','filters','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','getFields','findOne','ZendeskField','order','pick','nolimit','getSubjects','hasOwnProperty','getDescriptions','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskConfiguration','type','key','model','map','query','keys'];(function(_0x4b9997,_0x7d683b){var _0x133bb3=function(_0x4ab6fe){while(--_0x4ab6fe){_0x4b9997['push'](_0x4b9997['shift']());}};_0x133bb3(++_0x7d683b);}(_0x06a5,0x71));var _0x506a=function(_0xaed222,_0x14be57){_0xaed222=_0xaed222-0x0;var _0x2ecd45=_0x06a5[_0xaed222];return _0x2ecd45;};'use strict';var emlformat=require(_0x506a('0x0'));var rimraf=require(_0x506a('0x1'));var zipdir=require(_0x506a('0x2'));var jsonpatch=require(_0x506a('0x3'));var rp=require(_0x506a('0x4'));var moment=require('moment');var BPromise=require(_0x506a('0x5'));var Mustache=require(_0x506a('0x6'));var util=require(_0x506a('0x7'));var path=require(_0x506a('0x8'));var sox=require(_0x506a('0x9'));var csv=require(_0x506a('0xa'));var ejs=require(_0x506a('0xb'));var fs=require('fs');var fs_extra=require(_0x506a('0xc'));var _=require(_0x506a('0xd'));var squel=require('squel');var crypto=require(_0x506a('0xe'));var jsforce=require(_0x506a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x506a('0xa'));var querystring=require(_0x506a('0x10'));var Papa=require(_0x506a('0x11'));var Redis=require('ioredis');var authService=require(_0x506a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x506a('0x13'));var logger=require(_0x506a('0x14'))(_0x506a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x506a('0x16'));var db=require(_0x506a('0x17'))['db'];function respondWithStatusCode(_0x2a6133,_0x43eeb6){_0x43eeb6=_0x43eeb6||0xcc;return function(_0x36933e){if(_0x36933e){return _0x2a6133[_0x506a('0x18')](_0x43eeb6);}return _0x2a6133[_0x506a('0x19')](_0x43eeb6)[_0x506a('0x1a')]();};}function respondWithResult(_0x1cad95,_0x1ae952){_0x1ae952=_0x1ae952||0xc8;return function(_0x20d28b){if(_0x20d28b){return _0x1cad95['status'](_0x1ae952)['json'](_0x20d28b);}};}function respondWithFilteredResult(_0x402a91,_0x47ad70){return function(_0x290e1e){if(_0x290e1e){var _0x2479aa=typeof _0x47ad70[_0x506a('0x1b')]==='undefined'&&typeof _0x47ad70[_0x506a('0x1c')]==='undefined';var _0x1677e2=_0x290e1e[_0x506a('0x1d')];var _0x3a823f=_0x2479aa?0x0:_0x47ad70[_0x506a('0x1b')];var _0x1bfdf6=_0x2479aa?_0x290e1e[_0x506a('0x1d')]:_0x47ad70[_0x506a('0x1b')]+_0x47ad70[_0x506a('0x1c')];var _0x206b7d;if(_0x1bfdf6>=_0x1677e2){_0x1bfdf6=_0x1677e2;_0x206b7d=0xc8;}else{_0x206b7d=0xce;}_0x402a91[_0x506a('0x19')](_0x206b7d);return _0x402a91[_0x506a('0x1e')]('Content-Range',_0x3a823f+'-'+_0x1bfdf6+'/'+_0x1677e2)[_0x506a('0x1f')](_0x290e1e);}return null;};}function patchUpdates(_0x3e2155){return function(_0x334bba){try{jsonpatch[_0x506a('0x20')](_0x334bba,_0x3e2155,!![]);}catch(_0x5d90fd){return BPromise[_0x506a('0x21')](_0x5d90fd);}return _0x334bba[_0x506a('0x22')]();};}function saveUpdates(_0x50680a,_0x571305){return function(_0x2711eb){if(_0x2711eb){return _0x2711eb[_0x506a('0x23')](_0x50680a)[_0x506a('0x24')](function(_0x231ebb){return _0x231ebb;});}return null;};}function removeEntity(_0x915d0f,_0x213ade){return function(_0x2beb39){if(_0x2beb39){return _0x2beb39[_0x506a('0x25')]()['then'](function(){_0x915d0f[_0x506a('0x19')](0xcc)[_0x506a('0x1a')]();});}};}function handleEntityNotFound(_0x719e66,_0xe7a6a3){return function(_0x5cdd81){if(!_0x5cdd81){_0x719e66['sendStatus'](0x194);}return _0x5cdd81;};}function handleError(_0x9b101f,_0x1a7220){_0x1a7220=_0x1a7220||0x1f4;return function(_0x4664eb){logger['error'](_0x4664eb[_0x506a('0x26')]);if(_0x4664eb[_0x506a('0x27')]){delete _0x4664eb[_0x506a('0x27')];}_0x9b101f['status'](_0x1a7220)[_0x506a('0x28')](_0x4664eb);};}exports[_0x506a('0x29')]=function(_0xacd23f,_0x29ff26){var _0x4c3543={},_0x317311={},_0x36cee4={'count':0x0,'rows':[]};var _0x497f86=_['map'](db[_0x506a('0x2a')]['rawAttributes'],function(_0x1a890d){return{'name':_0x1a890d['fieldName'],'type':_0x1a890d[_0x506a('0x2b')][_0x506a('0x2c')]};});_0x317311[_0x506a('0x2d')]=_[_0x506a('0x2e')](_0x497f86,_0x506a('0x27'));_0x317311[_0x506a('0x2f')]=_[_0x506a('0x30')](_0xacd23f[_0x506a('0x2f')]);_0x317311['filters']=_[_0x506a('0x31')](_0x317311[_0x506a('0x2d')],_0x317311[_0x506a('0x2f')]);_0x4c3543[_0x506a('0x32')]=_[_0x506a('0x31')](_0x317311[_0x506a('0x2d')],qs[_0x506a('0x33')](_0xacd23f[_0x506a('0x2f')]['fields']));_0x4c3543[_0x506a('0x32')]=_0x4c3543[_0x506a('0x32')]['length']?_0x4c3543[_0x506a('0x32')]:_0x317311['model'];if(!_0xacd23f['query']['hasOwnProperty']('nolimit')){_0x4c3543[_0x506a('0x1c')]=qs[_0x506a('0x1c')](_0xacd23f[_0x506a('0x2f')][_0x506a('0x1c')]);_0x4c3543[_0x506a('0x1b')]=qs['offset'](_0xacd23f['query'][_0x506a('0x1b')]);}_0x4c3543['order']=qs[_0x506a('0x34')](_0xacd23f[_0x506a('0x2f')][_0x506a('0x34')]);_0x4c3543[_0x506a('0x35')]=qs[_0x506a('0x36')](_['pick'](_0xacd23f['query'],_0x317311[_0x506a('0x36')]),_0x497f86);if(_0xacd23f[_0x506a('0x2f')]['filter']){_0x4c3543[_0x506a('0x35')]=_[_0x506a('0x37')](_0x4c3543[_0x506a('0x35')],{'$or':_[_0x506a('0x2e')](_0x497f86,function(_0x5c17b1){if(_0x5c17b1[_0x506a('0x2b')]!==_0x506a('0x38')){var _0x2c200c={};_0x2c200c[_0x5c17b1[_0x506a('0x27')]]={'$like':'%'+_0xacd23f[_0x506a('0x2f')][_0x506a('0x39')]+'%'};return _0x2c200c;}})});}_0x4c3543=_['merge']({},_0x4c3543,_0xacd23f['options']);var _0x453cbb={'where':_0x4c3543[_0x506a('0x35')]};return db[_0x506a('0x2a')][_0x506a('0x1d')](_0x453cbb)[_0x506a('0x24')](function(_0x4a46bf){_0x36cee4[_0x506a('0x1d')]=_0x4a46bf;if(_0xacd23f['query']['includeAll']){_0x4c3543[_0x506a('0x3a')]=[{'all':!![]}];}return db[_0x506a('0x2a')][_0x506a('0x3b')](_0x4c3543);})[_0x506a('0x24')](function(_0x5e6b56){_0x36cee4[_0x506a('0x3c')]=_0x5e6b56;return _0x36cee4;})['then'](respondWithFilteredResult(_0x29ff26,_0x4c3543))[_0x506a('0x3d')](handleError(_0x29ff26,null));};exports[_0x506a('0x3e')]=function(_0x89ace3,_0x56ed4){var _0xc79d61={'raw':![],'where':{'id':_0x89ace3[_0x506a('0x3f')]['id']}},_0x2291b9={};_0x2291b9[_0x506a('0x2d')]=_[_0x506a('0x30')](db[_0x506a('0x2a')][_0x506a('0x40')]);_0x2291b9[_0x506a('0x2f')]=_[_0x506a('0x30')](_0x89ace3[_0x506a('0x2f')]);_0x2291b9['filters']=_[_0x506a('0x31')](_0x2291b9[_0x506a('0x2d')],_0x2291b9['query']);_0xc79d61[_0x506a('0x32')]=_[_0x506a('0x31')](_0x2291b9[_0x506a('0x2d')],qs['fields'](_0x89ace3['query'][_0x506a('0x33')]));_0xc79d61[_0x506a('0x32')]=_0xc79d61[_0x506a('0x32')][_0x506a('0x41')]?_0xc79d61[_0x506a('0x32')]:_0x2291b9[_0x506a('0x2d')];if(_0x89ace3[_0x506a('0x2f')]['includeAll']){_0xc79d61[_0x506a('0x3a')]=[{'all':!![]}];}_0xc79d61=_[_0x506a('0x37')]({},_0xc79d61,_0x89ace3[_0x506a('0x42')]);return db[_0x506a('0x2a')][_0x506a('0x43')](_0xc79d61)[_0x506a('0x24')](handleEntityNotFound(_0x56ed4,null))[_0x506a('0x24')](respondWithResult(_0x56ed4,null))[_0x506a('0x3d')](handleError(_0x56ed4,null));};exports[_0x506a('0x44')]=function(_0x40016e,_0x18e398){return db[_0x506a('0x2a')]['create'](_0x40016e['body'],{})[_0x506a('0x24')](respondWithResult(_0x18e398,0xc9))[_0x506a('0x3d')](handleError(_0x18e398,null));};exports[_0x506a('0x23')]=function(_0x4cb9a3,_0x4cd856){if(_0x4cb9a3[_0x506a('0x45')]['id']){delete _0x4cb9a3[_0x506a('0x45')]['id'];}return db['ZendeskConfiguration'][_0x506a('0x43')]({'where':{'id':_0x4cb9a3['params']['id']}})[_0x506a('0x24')](handleEntityNotFound(_0x4cd856,null))[_0x506a('0x24')](saveUpdates(_0x4cb9a3[_0x506a('0x45')],null))[_0x506a('0x24')](respondWithResult(_0x4cd856,null))['catch'](handleError(_0x4cd856,null));};exports[_0x506a('0x25')]=function(_0x17aa71,_0x169bf1){return db[_0x506a('0x2a')][_0x506a('0x43')]({'where':{'id':_0x17aa71[_0x506a('0x3f')]['id']}})[_0x506a('0x24')](handleEntityNotFound(_0x169bf1,null))[_0x506a('0x24')](removeEntity(_0x169bf1,null))[_0x506a('0x3d')](handleError(_0x169bf1,null));};exports[_0x506a('0x46')]=function(_0x28cf52,_0x3186d8,_0xdfdfaf){var _0xcc7992={};var _0x3c0614={};var _0x4a3ccf;var _0x22274e;return db[_0x506a('0x2a')][_0x506a('0x47')]({'where':{'id':_0x28cf52[_0x506a('0x3f')]['id']}})[_0x506a('0x24')](handleEntityNotFound(_0x3186d8,null))['then'](function(_0x29a0f3){if(_0x29a0f3){_0x4a3ccf=_0x29a0f3;_0x3c0614[_0x506a('0x2d')]=_[_0x506a('0x30')](db[_0x506a('0x48')][_0x506a('0x40')]);_0x3c0614[_0x506a('0x2f')]=_['keys'](_0x28cf52['query']);_0x3c0614['filters']=_['intersection'](_0x3c0614[_0x506a('0x2d')],_0x3c0614[_0x506a('0x2f')]);_0xcc7992[_0x506a('0x32')]=_[_0x506a('0x31')](_0x3c0614[_0x506a('0x2d')],qs[_0x506a('0x33')](_0x28cf52[_0x506a('0x2f')][_0x506a('0x33')]));_0xcc7992[_0x506a('0x32')]=_0xcc7992[_0x506a('0x32')]['length']?_0xcc7992['attributes']:_0x3c0614[_0x506a('0x2d')];_0xcc7992[_0x506a('0x49')]=qs[_0x506a('0x34')](_0x28cf52['query']['sort']);_0xcc7992['where']=qs[_0x506a('0x36')](_[_0x506a('0x4a')](_0x28cf52['query'],_0x3c0614[_0x506a('0x36')]));if(_0x28cf52[_0x506a('0x2f')]['filter']){_0xcc7992['where']=_['merge'](_0xcc7992[_0x506a('0x35')],{'$or':_[_0x506a('0x2e')](_0xcc7992['attributes'],function(_0x5e0475){var _0x32865f={};_0x32865f[_0x5e0475]={'$like':'%'+_0x28cf52[_0x506a('0x2f')][_0x506a('0x39')]+'%'};return _0x32865f;})});}_0xcc7992=_[_0x506a('0x37')]({},_0xcc7992,_0x28cf52[_0x506a('0x42')]);return _0x4a3ccf[_0x506a('0x46')](_0xcc7992);}})['then'](function(_0x2f7f6e){if(_0x2f7f6e){_0x22274e=_0x2f7f6e[_0x506a('0x41')];if(!_0x28cf52[_0x506a('0x2f')]['hasOwnProperty'](_0x506a('0x4b'))){_0xcc7992[_0x506a('0x1c')]=qs[_0x506a('0x1c')](_0x28cf52['query'][_0x506a('0x1c')]);_0xcc7992[_0x506a('0x1b')]=qs[_0x506a('0x1b')](_0x28cf52[_0x506a('0x2f')][_0x506a('0x1b')]);}return _0x4a3ccf['getFields'](_0xcc7992);}})[_0x506a('0x24')](function(_0x239a54){if(_0x239a54){return _0x239a54?{'count':_0x22274e,'rows':_0x239a54}:null;}})[_0x506a('0x24')](respondWithResult(_0x3186d8,null))[_0x506a('0x3d')](handleError(_0x3186d8,null));};exports[_0x506a('0x4c')]=function(_0x36b455,_0x2f848e,_0x481c66){var _0x159dbc={};var _0x176a8d={};var _0x173055;var _0x2c4a2a;return db[_0x506a('0x2a')][_0x506a('0x47')]({'where':{'id':_0x36b455[_0x506a('0x3f')]['id']}})[_0x506a('0x24')](handleEntityNotFound(_0x2f848e,null))[_0x506a('0x24')](function(_0x3a8921){if(_0x3a8921){_0x173055=_0x3a8921;_0x176a8d['model']=_['keys'](db[_0x506a('0x48')][_0x506a('0x40')]);_0x176a8d[_0x506a('0x2f')]=_['keys'](_0x36b455[_0x506a('0x2f')]);_0x176a8d['filters']=_[_0x506a('0x31')](_0x176a8d[_0x506a('0x2d')],_0x176a8d[_0x506a('0x2f')]);_0x159dbc['attributes']=_['intersection'](_0x176a8d['model'],qs[_0x506a('0x33')](_0x36b455[_0x506a('0x2f')][_0x506a('0x33')]));_0x159dbc[_0x506a('0x32')]=_0x159dbc[_0x506a('0x32')][_0x506a('0x41')]?_0x159dbc[_0x506a('0x32')]:_0x176a8d[_0x506a('0x2d')];_0x159dbc[_0x506a('0x49')]=qs[_0x506a('0x34')](_0x36b455['query']['sort']);_0x159dbc[_0x506a('0x35')]=qs[_0x506a('0x36')](_['pick'](_0x36b455[_0x506a('0x2f')],_0x176a8d['filters']));if(_0x36b455[_0x506a('0x2f')][_0x506a('0x39')]){_0x159dbc['where']=_[_0x506a('0x37')](_0x159dbc[_0x506a('0x35')],{'$or':_[_0x506a('0x2e')](_0x159dbc[_0x506a('0x32')],function(_0x309ec0){var _0x326be3={};_0x326be3[_0x309ec0]={'$like':'%'+_0x36b455[_0x506a('0x2f')][_0x506a('0x39')]+'%'};return _0x326be3;})});}_0x159dbc=_[_0x506a('0x37')]({},_0x159dbc,_0x36b455[_0x506a('0x42')]);return _0x173055[_0x506a('0x4c')](_0x159dbc);}})[_0x506a('0x24')](function(_0x21216e){if(_0x21216e){_0x2c4a2a=_0x21216e[_0x506a('0x41')];if(!_0x36b455[_0x506a('0x2f')][_0x506a('0x4d')]('nolimit')){_0x159dbc[_0x506a('0x1c')]=qs[_0x506a('0x1c')](_0x36b455[_0x506a('0x2f')][_0x506a('0x1c')]);_0x159dbc['offset']=qs[_0x506a('0x1b')](_0x36b455[_0x506a('0x2f')][_0x506a('0x1b')]);}return _0x173055[_0x506a('0x4c')](_0x159dbc);}})[_0x506a('0x24')](function(_0x2035dc){if(_0x2035dc){return _0x2035dc?{'count':_0x2c4a2a,'rows':_0x2035dc}:null;}})['then'](respondWithResult(_0x2f848e,null))['catch'](handleError(_0x2f848e,null));};exports['getDescriptions']=function(_0x104d90,_0xbea84,_0x542513){var _0x107ca5={};var _0x2da263={};var _0x2cd97c;var _0x1a4f87;return db[_0x506a('0x2a')]['findOne']({'where':{'id':_0x104d90[_0x506a('0x3f')]['id']}})['then'](handleEntityNotFound(_0xbea84,null))['then'](function(_0x22eb8a){if(_0x22eb8a){_0x2cd97c=_0x22eb8a;_0x2da263[_0x506a('0x2d')]=_[_0x506a('0x30')](db[_0x506a('0x48')]['rawAttributes']);_0x2da263['query']=_['keys'](_0x104d90[_0x506a('0x2f')]);_0x2da263[_0x506a('0x36')]=_[_0x506a('0x31')](_0x2da263['model'],_0x2da263[_0x506a('0x2f')]);_0x107ca5[_0x506a('0x32')]=_[_0x506a('0x31')](_0x2da263['model'],qs['fields'](_0x104d90[_0x506a('0x2f')][_0x506a('0x33')]));_0x107ca5[_0x506a('0x32')]=_0x107ca5[_0x506a('0x32')][_0x506a('0x41')]?_0x107ca5['attributes']:_0x2da263[_0x506a('0x2d')];_0x107ca5[_0x506a('0x49')]=qs[_0x506a('0x34')](_0x104d90[_0x506a('0x2f')][_0x506a('0x34')]);_0x107ca5[_0x506a('0x35')]=qs[_0x506a('0x36')](_[_0x506a('0x4a')](_0x104d90[_0x506a('0x2f')],_0x2da263['filters']));if(_0x104d90[_0x506a('0x2f')][_0x506a('0x39')]){_0x107ca5[_0x506a('0x35')]=_[_0x506a('0x37')](_0x107ca5[_0x506a('0x35')],{'$or':_[_0x506a('0x2e')](_0x107ca5[_0x506a('0x32')],function(_0xb037b2){var _0x24c5d0={};_0x24c5d0[_0xb037b2]={'$like':'%'+_0x104d90[_0x506a('0x2f')][_0x506a('0x39')]+'%'};return _0x24c5d0;})});}_0x107ca5=_[_0x506a('0x37')]({},_0x107ca5,_0x104d90[_0x506a('0x42')]);return _0x2cd97c['getDescriptions'](_0x107ca5);}})[_0x506a('0x24')](function(_0x14f0fe){if(_0x14f0fe){_0x1a4f87=_0x14f0fe[_0x506a('0x41')];if(!_0x104d90[_0x506a('0x2f')][_0x506a('0x4d')](_0x506a('0x4b'))){_0x107ca5['limit']=qs[_0x506a('0x1c')](_0x104d90[_0x506a('0x2f')][_0x506a('0x1c')]);_0x107ca5[_0x506a('0x1b')]=qs['offset'](_0x104d90[_0x506a('0x2f')][_0x506a('0x1b')]);}return _0x2cd97c[_0x506a('0x4e')](_0x107ca5);}})['then'](function(_0x153e94){if(_0x153e94){return _0x153e94?{'count':_0x1a4f87,'rows':_0x153e94}:null;}})[_0x506a('0x24')](respondWithResult(_0xbea84,null))[_0x506a('0x3d')](handleError(_0xbea84,null));};exports['getTags']=function(_0x4a8fa9,_0x2eacd5,_0x439961){var _0x474e46={};var _0x4ef85b={};var _0x2d674c;var _0x46e5bf;return db[_0x506a('0x2a')]['findOne']({'where':{'id':_0x4a8fa9[_0x506a('0x3f')]['id']}})[_0x506a('0x24')](handleEntityNotFound(_0x2eacd5,null))['then'](function(_0x44ad29){if(_0x44ad29){_0x2d674c=_0x44ad29;_0x4ef85b[_0x506a('0x2d')]=_[_0x506a('0x30')](db[_0x506a('0x4f')][_0x506a('0x40')]);_0x4ef85b[_0x506a('0x2f')]=_[_0x506a('0x30')](_0x4a8fa9['query']);_0x4ef85b[_0x506a('0x36')]=_[_0x506a('0x31')](_0x4ef85b[_0x506a('0x2d')],_0x4ef85b[_0x506a('0x2f')]);_0x474e46[_0x506a('0x32')]=_['intersection'](_0x4ef85b[_0x506a('0x2d')],qs[_0x506a('0x33')](_0x4a8fa9[_0x506a('0x2f')][_0x506a('0x33')]));_0x474e46[_0x506a('0x32')]=_0x474e46[_0x506a('0x32')]['length']?_0x474e46[_0x506a('0x32')]:_0x4ef85b[_0x506a('0x2d')];_0x474e46[_0x506a('0x49')]=qs[_0x506a('0x34')](_0x4a8fa9[_0x506a('0x2f')][_0x506a('0x34')]);_0x474e46['where']=qs[_0x506a('0x36')](_[_0x506a('0x4a')](_0x4a8fa9[_0x506a('0x2f')],_0x4ef85b['filters']));if(_0x4a8fa9[_0x506a('0x2f')]['filter']){_0x474e46[_0x506a('0x35')]=_[_0x506a('0x37')](_0x474e46[_0x506a('0x35')],{'$or':_[_0x506a('0x2e')](_0x474e46[_0x506a('0x32')],function(_0x3edcc9){var _0x215188={};_0x215188[_0x3edcc9]={'$like':'%'+_0x4a8fa9[_0x506a('0x2f')][_0x506a('0x39')]+'%'};return _0x215188;})});}_0x474e46=_[_0x506a('0x37')]({},_0x474e46,_0x4a8fa9[_0x506a('0x42')]);return _0x2d674c['getTags'](_0x474e46);}})[_0x506a('0x24')](function(_0x2f326c){if(_0x2f326c){_0x46e5bf=_0x2f326c[_0x506a('0x41')];if(!_0x4a8fa9[_0x506a('0x2f')][_0x506a('0x4d')](_0x506a('0x4b'))){_0x474e46[_0x506a('0x1c')]=qs[_0x506a('0x1c')](_0x4a8fa9[_0x506a('0x2f')][_0x506a('0x1c')]);_0x474e46[_0x506a('0x1b')]=qs[_0x506a('0x1b')](_0x4a8fa9[_0x506a('0x2f')]['offset']);}return _0x2d674c['getTags'](_0x474e46);}})[_0x506a('0x24')](function(_0x47fcd1){if(_0x47fcd1){return _0x47fcd1?{'count':_0x46e5bf,'rows':_0x47fcd1}:null;}})[_0x506a('0x24')](respondWithResult(_0x2eacd5,null))[_0x506a('0x3d')](handleError(_0x2eacd5,null));};exports[_0x506a('0x50')]=function(_0x558506,_0x2fce07,_0x55b5d9){if(_0x558506[_0x506a('0x45')]['id']){delete _0x558506['body']['id'];}return db['ZendeskConfiguration'][_0x506a('0x47')]({'where':{'id':_0x558506[_0x506a('0x3f')]['id']}})[_0x506a('0x24')](handleEntityNotFound(_0x2fce07,null))['then'](function(_0x322984){if(_0x322984){return _0x322984[_0x506a('0x50')](_0x558506['body']['ids']||[]);}return null;})[_0x506a('0x24')](respondWithResult(_0x2fce07,null))[_0x506a('0x3d')](handleError(_0x2fce07,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 641bab4..769b6fa 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 _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x3b4e2f,_0x206d7b){var _0xe65be6=function(_0x21ee60){while(--_0x21ee60){_0x3b4e2f['push'](_0x3b4e2f['shift']());}};_0xe65be6(++_0x206d7b);}(_0xdb94,0xab));var _0x4db9=function(_0xe86b03,_0x4f1d99){_0xe86b03=_0xe86b03-0x0;var _0x2711d6=_0xdb94[_0xe86b03];return _0x2711d6;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2cf=['request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','util','api','bluebird'];(function(_0x54ec3f,_0x57c956){var _0x5ef410=function(_0x363317){while(--_0x363317){_0x54ec3f['push'](_0x54ec3f['shift']());}};_0x5ef410(++_0x57c956);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x340916,_0x2b1417){_0x340916=_0x340916-0x0;var _0x489be0=_0xe2cf[_0x340916];return _0x489be0;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var logger=require('../../config/logger')(_0xfe2c('0x1'));var moment=require('moment');var BPromise=require(_0xfe2c('0x2'));var rp=require(_0xfe2c('0x3'));var fs=require('fs');var path=require(_0xfe2c('0x4'));var rimraf=require(_0xfe2c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe2c('0x6'));module[_0xfe2c('0x7')]=function(_0x55bb12,_0x4fa079){return _0x55bb12[_0xfe2c('0x8')](_0xfe2c('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index de5eac1..c0ea88a 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 _0x8003=['jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x8003,0x1ad));var _0x3800=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x8003[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x3800('0x0'));var util=require('util');var moment=require(_0x3800('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3800('0x2'));var db=require(_0x3800('0x3'))['db'];var utils=require(_0x3800('0x4'));var logger=require(_0x3800('0x5'))(_0x3800('0x6'));var config=require(_0x3800('0x7'));var jayson=require(_0x3800('0x8'));var client=jayson[_0x3800('0x9')][_0x3800('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ae83f,_0x12d9d4,_0x5a909e){return new BPromise(function(_0x27754d,_0x25922a){return client[_0x3800('0xb')](_0x2ae83f,_0x5a909e)['then'](function(_0x595f6f){logger[_0x3800('0xc')](_0x3800('0xd'),_0x12d9d4,_0x3800('0xe'));logger[_0x3800('0xf')](_0x3800('0x10'),_0x12d9d4,_0x3800('0xe'),JSON[_0x3800('0x11')](_0x595f6f));if(_0x595f6f[_0x3800('0x12')]){if(_0x595f6f[_0x3800('0x12')][_0x3800('0x13')]===0x1f4){logger['error'](_0x3800('0xd'),_0x12d9d4,_0x595f6f[_0x3800('0x12')]['message']);return _0x25922a(_0x595f6f[_0x3800('0x12')][_0x3800('0x14')]);}logger[_0x3800('0x12')](_0x3800('0xd'),_0x12d9d4,_0x595f6f[_0x3800('0x12')]['message']);return _0x27754d(_0x595f6f[_0x3800('0x12')][_0x3800('0x14')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x12d9d4,_0x3800('0xe'));_0x27754d(_0x595f6f[_0x3800('0x15')][_0x3800('0x14')]);}})[_0x3800('0x16')](function(_0x7e117a){logger[_0x3800('0x12')](_0x3800('0xd'),_0x12d9d4,_0x7e117a);_0x25922a(_0x7e117a);});});} \ No newline at end of file +var _0x26ff=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3fdb70,_0xc155eb){var _0x51cf7d=function(_0x522531){while(--_0x522531){_0x3fdb70['push'](_0x3fdb70['shift']());}};_0x51cf7d(++_0xc155eb);}(_0x26ff,0x162));var _0xf26f=function(_0x5e2797,_0x1b1d44){_0x5e2797=_0x5e2797-0x0;var _0x5d5cb6=_0x26ff[_0x5e2797];return _0x5d5cb6;};'use strict';var _=require(_0xf26f('0x0'));var util=require(_0xf26f('0x1'));var moment=require('moment');var BPromise=require(_0xf26f('0x2'));var rs=require(_0xf26f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf26f('0x4'))['db'];var utils=require(_0xf26f('0x5'));var logger=require('../../config/logger')(_0xf26f('0x6'));var config=require(_0xf26f('0x7'));var jayson=require(_0xf26f('0x8'));var client=jayson['client'][_0xf26f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5804b9,_0x1d910f,_0x13a1b9){return new BPromise(function(_0x654f9f,_0x525a33){return client[_0xf26f('0xa')](_0x5804b9,_0x13a1b9)[_0xf26f('0xb')](function(_0x45bfd2){logger['info'](_0xf26f('0xc'),_0x1d910f,_0xf26f('0xd'));logger[_0xf26f('0xe')](_0xf26f('0xf'),_0x1d910f,'request\x20sent',JSON[_0xf26f('0x10')](_0x45bfd2));if(_0x45bfd2[_0xf26f('0x11')]){if(_0x45bfd2[_0xf26f('0x11')][_0xf26f('0x12')]===0x1f4){logger[_0xf26f('0x11')](_0xf26f('0xc'),_0x1d910f,_0x45bfd2[_0xf26f('0x11')][_0xf26f('0x13')]);return _0x525a33(_0x45bfd2[_0xf26f('0x11')][_0xf26f('0x13')]);}logger[_0xf26f('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d910f,_0x45bfd2[_0xf26f('0x11')]['message']);return _0x654f9f(_0x45bfd2[_0xf26f('0x11')]['message']);}else{logger[_0xf26f('0x14')](_0xf26f('0xc'),_0x1d910f,'request\x20sent');_0x654f9f(_0x45bfd2[_0xf26f('0x15')]['message']);}})[_0xf26f('0x16')](function(_0x557e6b){logger[_0xf26f('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d910f,_0x557e6b);_0x525a33(_0x557e6b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 798db42..b1ed3b4 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 _0xc748=['./intZendeskField.controller','get','isAuthenticated','index','show','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5847ab,_0x306925){var _0x15dbd2=function(_0x57a129){while(--_0x57a129){_0x5847ab['push'](_0x5847ab['shift']());}};_0x15dbd2(++_0x306925);}(_0xc748,0x13a));var _0x8c74=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0xc748[_0x3fd3a3];return _0xa3e4d5;};'use strict';var multer=require(_0x8c74('0x0'));var util=require(_0x8c74('0x1'));var path=require(_0x8c74('0x2'));var timeout=require(_0x8c74('0x3'));var express=require(_0x8c74('0x4'));var router=express[_0x8c74('0x5')]();var fs_extra=require(_0x8c74('0x6'));var auth=require(_0x8c74('0x7'));var interaction=require(_0x8c74('0x8'));var config=require(_0x8c74('0x9'));var controller=require(_0x8c74('0xa'));router[_0x8c74('0xb')]('/',auth[_0x8c74('0xc')](),controller[_0x8c74('0xd')]);router[_0x8c74('0xb')]('/:id',auth[_0x8c74('0xc')](),controller[_0x8c74('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8c74('0xf')]);router[_0x8c74('0x10')]('/:id',auth[_0x8c74('0xc')](),controller[_0x8c74('0x11')]);router['delete']('/:id',auth[_0x8c74('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4bfd=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x4bfd,0xb5));var _0xd4bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4bfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd4bf('0x0'));var util=require(_0xd4bf('0x1'));var path=require('path');var timeout=require(_0xd4bf('0x2'));var express=require(_0xd4bf('0x3'));var router=express[_0xd4bf('0x4')]();var fs_extra=require(_0xd4bf('0x5'));var auth=require(_0xd4bf('0x6'));var interaction=require(_0xd4bf('0x7'));var config=require(_0xd4bf('0x8'));var controller=require(_0xd4bf('0x9'));router[_0xd4bf('0xa')]('/',auth[_0xd4bf('0xb')](),controller[_0xd4bf('0xc')]);router['get'](_0xd4bf('0xd'),auth[_0xd4bf('0xb')](),controller[_0xd4bf('0xe')]);router[_0xd4bf('0xf')]('/',auth[_0xd4bf('0xb')](),controller[_0xd4bf('0x10')]);router[_0xd4bf('0x11')](_0xd4bf('0xd'),auth[_0xd4bf('0xb')](),controller[_0xd4bf('0x12')]);router[_0xd4bf('0x13')](_0xd4bf('0xd'),auth[_0xd4bf('0xb')](),controller[_0xd4bf('0x14')]);module[_0xd4bf('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c20b22f..a43387b 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 _0xdcaa=['string','customVariable','picklist','ENUM','variable','STRING','BOOLEAN','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdcaa,0x19c));var _0xadca=function(_0x1abb30,_0x2d964a){_0x1abb30=_0x1abb30-0x0;var _0x3eb779=_0xdcaa[_0x1abb30];return _0x3eb779;};'use strict';var Sequelize=require(_0xadca('0x0'));module[_0xadca('0x1')]={'type':{'type':Sequelize['ENUM'](_0xadca('0x2'),'variable',_0xadca('0x3'),'keyValue',_0xadca('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xadca('0x5')]('string',_0xadca('0x6'),_0xadca('0x3'))},'keyContent':{'type':Sequelize[_0xadca('0x7')]},'idField':{'type':Sequelize[_0xadca('0x7')]},'nameField':{'type':Sequelize[_0xadca('0x7')]},'customField':{'type':Sequelize[_0xadca('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xadca('0x7')]}}; \ No newline at end of file +var _0xdbe5=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x5676c5,_0x4046be){var _0x32a961=function(_0x19f7a9){while(--_0x19f7a9){_0x5676c5['push'](_0x5676c5['shift']());}};_0x32a961(++_0x4046be);}(_0xdbe5,0x103));var _0x5dbe=function(_0x21f7d2,_0x3bdee0){_0x21f7d2=_0x21f7d2-0x0;var _0x2fc529=_0xdbe5[_0x21f7d2];return _0x2fc529;};'use strict';var Sequelize=require(_0x5dbe('0x0'));module[_0x5dbe('0x1')]={'type':{'type':Sequelize[_0x5dbe('0x2')](_0x5dbe('0x3'),_0x5dbe('0x4'),_0x5dbe('0x5'),_0x5dbe('0x6'),'picklist'),'defaultValue':_0x5dbe('0x3')},'content':{'type':Sequelize[_0x5dbe('0x7')]},'key':{'type':Sequelize[_0x5dbe('0x7')]},'keyType':{'type':Sequelize[_0x5dbe('0x2')](_0x5dbe('0x3'),_0x5dbe('0x4'),_0x5dbe('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5dbe('0x7')]},'nameField':{'type':Sequelize[_0x5dbe('0x7')]},'customField':{'type':Sequelize[_0x5dbe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5dbe('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6a22379..f2bea42 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 _0x7834=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','map','ZendeskField','fieldName','key','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end'];(function(_0x4ffca4,_0x1dfad4){var _0xc7336e=function(_0x436f5d){while(--_0x436f5d){_0x4ffca4['push'](_0x4ffca4['shift']());}};_0xc7336e(++_0x1dfad4);}(_0x7834,0x13f));var _0x4783=function(_0x99250c,_0x4603c0){_0x99250c=_0x99250c-0x0;var _0x3927d5=_0x7834[_0x99250c];return _0x3927d5;};'use strict';var emlformat=require(_0x4783('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4783('0x1'));var rp=require('request-promise');var moment=require(_0x4783('0x2'));var BPromise=require(_0x4783('0x3'));var Mustache=require(_0x4783('0x4'));var util=require(_0x4783('0x5'));var path=require(_0x4783('0x6'));var sox=require(_0x4783('0x7'));var csv=require(_0x4783('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4783('0x9'));var _=require(_0x4783('0xa'));var squel=require('squel');var crypto=require(_0x4783('0xb'));var jsforce=require(_0x4783('0xc'));var deskjs=require(_0x4783('0xd'));var toCsv=require(_0x4783('0x8'));var querystring=require(_0x4783('0xe'));var Papa=require(_0x4783('0xf'));var Redis=require('ioredis');var authService=require(_0x4783('0x10'));var qs=require(_0x4783('0x11'));var as=require(_0x4783('0x12'));var hardwareService=require(_0x4783('0x13'));var logger=require(_0x4783('0x14'))(_0x4783('0x15'));var utils=require(_0x4783('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4783('0x17'))['db'];function respondWithStatusCode(_0x85087d,_0x4ce944){_0x4ce944=_0x4ce944||0xcc;return function(_0x2afbdc){if(_0x2afbdc){return _0x85087d['sendStatus'](_0x4ce944);}return _0x85087d[_0x4783('0x18')](_0x4ce944)[_0x4783('0x19')]();};}function respondWithResult(_0x41d853,_0xecb9f9){_0xecb9f9=_0xecb9f9||0xc8;return function(_0x230ae6){if(_0x230ae6){return _0x41d853['status'](_0xecb9f9)[_0x4783('0x1a')](_0x230ae6);}};}function respondWithFilteredResult(_0x225443,_0x11e996){return function(_0x20788f){if(_0x20788f){var _0x3cb485=typeof _0x11e996[_0x4783('0x1b')]===_0x4783('0x1c')&&typeof _0x11e996[_0x4783('0x1d')]===_0x4783('0x1c');var _0x28c979=_0x20788f[_0x4783('0x1e')];var _0x323a90=_0x3cb485?0x0:_0x11e996['offset'];var _0x465ed7=_0x3cb485?_0x20788f[_0x4783('0x1e')]:_0x11e996['offset']+_0x11e996[_0x4783('0x1d')];var _0x4a9dc8;if(_0x465ed7>=_0x28c979){_0x465ed7=_0x28c979;_0x4a9dc8=0xc8;}else{_0x4a9dc8=0xce;}_0x225443[_0x4783('0x18')](_0x4a9dc8);return _0x225443[_0x4783('0x1f')](_0x4783('0x20'),_0x323a90+'-'+_0x465ed7+'/'+_0x28c979)[_0x4783('0x1a')](_0x20788f);}return null;};}function patchUpdates(_0x1b5e90){return function(_0x2772b3){try{jsonpatch[_0x4783('0x21')](_0x2772b3,_0x1b5e90,!![]);}catch(_0x4e15d7){return BPromise[_0x4783('0x22')](_0x4e15d7);}return _0x2772b3['save']();};}function saveUpdates(_0x429801,_0x2d592f){return function(_0x46ada4){if(_0x46ada4){return _0x46ada4[_0x4783('0x23')](_0x429801)[_0x4783('0x24')](function(_0x54529d){return _0x54529d;});}return null;};}function removeEntity(_0x2633e6,_0x16ee3a){return function(_0xba686e){if(_0xba686e){return _0xba686e[_0x4783('0x25')]()[_0x4783('0x24')](function(){_0x2633e6[_0x4783('0x18')](0xcc)[_0x4783('0x19')]();});}};}function handleEntityNotFound(_0x48da76,_0x22d276){return function(_0x3e45d2){if(!_0x3e45d2){_0x48da76['sendStatus'](0x194);}return _0x3e45d2;};}function handleError(_0x5f2ed1,_0x1d3e22){_0x1d3e22=_0x1d3e22||0x1f4;return function(_0xb5f71c){logger['error'](_0xb5f71c[_0x4783('0x26')]);if(_0xb5f71c['name']){delete _0xb5f71c['name'];}_0x5f2ed1['status'](_0x1d3e22)['send'](_0xb5f71c);};}exports['index']=function(_0x59e49b,_0x250b9d){var _0x589082={},_0x3a996c={},_0x455559={'count':0x0,'rows':[]};var _0x424806=_[_0x4783('0x27')](db[_0x4783('0x28')]['rawAttributes'],function(_0x1e23f4){return{'name':_0x1e23f4[_0x4783('0x29')],'type':_0x1e23f4['type'][_0x4783('0x2a')]};});_0x3a996c[_0x4783('0x2b')]=_['map'](_0x424806,_0x4783('0x2c'));_0x3a996c['query']=_[_0x4783('0x2d')](_0x59e49b['query']);_0x3a996c[_0x4783('0x2e')]=_[_0x4783('0x2f')](_0x3a996c['model'],_0x3a996c[_0x4783('0x30')]);_0x589082[_0x4783('0x31')]=_[_0x4783('0x2f')](_0x3a996c[_0x4783('0x2b')],qs['fields'](_0x59e49b[_0x4783('0x30')][_0x4783('0x32')]));_0x589082[_0x4783('0x31')]=_0x589082[_0x4783('0x31')]['length']?_0x589082[_0x4783('0x31')]:_0x3a996c[_0x4783('0x2b')];if(!_0x59e49b['query'][_0x4783('0x33')](_0x4783('0x34'))){_0x589082[_0x4783('0x1d')]=qs[_0x4783('0x1d')](_0x59e49b[_0x4783('0x30')]['limit']);_0x589082[_0x4783('0x1b')]=qs['offset'](_0x59e49b['query'][_0x4783('0x1b')]);}_0x589082[_0x4783('0x35')]=qs[_0x4783('0x36')](_0x59e49b['query'][_0x4783('0x36')]);_0x589082['where']=qs[_0x4783('0x2e')](_['pick'](_0x59e49b[_0x4783('0x30')],_0x3a996c[_0x4783('0x2e')]),_0x424806);if(_0x59e49b[_0x4783('0x30')]['filter']){_0x589082[_0x4783('0x37')]=_['merge'](_0x589082[_0x4783('0x37')],{'$or':_[_0x4783('0x27')](_0x424806,function(_0x85209b){if(_0x85209b[_0x4783('0x38')]!=='VIRTUAL'){var _0x172958={};_0x172958[_0x85209b[_0x4783('0x2c')]]={'$like':'%'+_0x59e49b[_0x4783('0x30')]['filter']+'%'};return _0x172958;}})});}_0x589082=_[_0x4783('0x39')]({},_0x589082,_0x59e49b[_0x4783('0x3a')]);var _0x1ebdc8={'where':_0x589082['where']};return db['ZendeskField'][_0x4783('0x1e')](_0x1ebdc8)[_0x4783('0x24')](function(_0x373208){_0x455559[_0x4783('0x1e')]=_0x373208;if(_0x59e49b[_0x4783('0x30')][_0x4783('0x3b')]){_0x589082[_0x4783('0x3c')]=[{'all':!![]}];}return db[_0x4783('0x28')][_0x4783('0x3d')](_0x589082);})['then'](function(_0x49e41a){_0x455559[_0x4783('0x3e')]=_0x49e41a;return _0x455559;})['then'](respondWithFilteredResult(_0x250b9d,_0x589082))[_0x4783('0x3f')](handleError(_0x250b9d,null));};exports[_0x4783('0x40')]=function(_0x4708be,_0x3df302){var _0x5e5bc7={'raw':!![],'where':{'id':_0x4708be[_0x4783('0x41')]['id']}},_0x409ac6={};_0x409ac6[_0x4783('0x2b')]=_['keys'](db['ZendeskField'][_0x4783('0x42')]);_0x409ac6[_0x4783('0x30')]=_['keys'](_0x4708be[_0x4783('0x30')]);_0x409ac6['filters']=_[_0x4783('0x2f')](_0x409ac6[_0x4783('0x2b')],_0x409ac6[_0x4783('0x30')]);_0x5e5bc7[_0x4783('0x31')]=_[_0x4783('0x2f')](_0x409ac6[_0x4783('0x2b')],qs[_0x4783('0x32')](_0x4708be[_0x4783('0x30')]['fields']));_0x5e5bc7['attributes']=_0x5e5bc7[_0x4783('0x31')]['length']?_0x5e5bc7[_0x4783('0x31')]:_0x409ac6[_0x4783('0x2b')];if(_0x4708be[_0x4783('0x30')][_0x4783('0x3b')]){_0x5e5bc7[_0x4783('0x3c')]=[{'all':!![]}];}_0x5e5bc7=_[_0x4783('0x39')]({},_0x5e5bc7,_0x4708be[_0x4783('0x3a')]);return db[_0x4783('0x28')][_0x4783('0x43')](_0x5e5bc7)[_0x4783('0x24')](handleEntityNotFound(_0x3df302,null))[_0x4783('0x24')](respondWithResult(_0x3df302,null))[_0x4783('0x3f')](handleError(_0x3df302,null));};exports['create']=function(_0x5f44f9,_0xb416de){return db[_0x4783('0x28')]['create'](_0x5f44f9['body'],{})[_0x4783('0x24')](respondWithResult(_0xb416de,0xc9))[_0x4783('0x3f')](handleError(_0xb416de,null));};exports[_0x4783('0x23')]=function(_0x5b248f,_0x3dbd65){if(_0x5b248f['body']['id']){delete _0x5b248f[_0x4783('0x44')]['id'];}return db[_0x4783('0x28')]['find']({'where':{'id':_0x5b248f['params']['id']}})['then'](handleEntityNotFound(_0x3dbd65,null))[_0x4783('0x24')](saveUpdates(_0x5b248f[_0x4783('0x44')],null))['then'](respondWithResult(_0x3dbd65,null))[_0x4783('0x3f')](handleError(_0x3dbd65,null));};exports[_0x4783('0x25')]=function(_0x51a14f,_0x447ab9){return db['ZendeskField'][_0x4783('0x43')]({'where':{'id':_0x51a14f['params']['id']}})[_0x4783('0x24')](handleEntityNotFound(_0x447ab9,null))['then'](removeEntity(_0x447ab9,null))[_0x4783('0x3f')](handleError(_0x447ab9,null));}; \ No newline at end of file +var _0x1756=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ZendeskField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','create','catch','body','find','params','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1756,0x1ee));var _0x6175=function(_0xad1bd7,_0x440add){_0xad1bd7=_0xad1bd7-0x0;var _0x4bb97a=_0x1756[_0xad1bd7];return _0x4bb97a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6175('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6175('0x1'));var rp=require(_0x6175('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6175('0x3'));var util=require('util');var path=require(_0x6175('0x4'));var sox=require(_0x6175('0x5'));var csv=require(_0x6175('0x6'));var ejs=require(_0x6175('0x7'));var fs=require('fs');var fs_extra=require(_0x6175('0x8'));var _=require(_0x6175('0x9'));var squel=require(_0x6175('0xa'));var crypto=require(_0x6175('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6175('0xc'));var toCsv=require(_0x6175('0x6'));var querystring=require(_0x6175('0xd'));var Papa=require('papaparse');var Redis=require(_0x6175('0xe'));var authService=require(_0x6175('0xf'));var qs=require(_0x6175('0x10'));var as=require(_0x6175('0x11'));var hardwareService=require(_0x6175('0x12'));var logger=require('../../config/logger')(_0x6175('0x13'));var utils=require(_0x6175('0x14'));var config=require(_0x6175('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d657f,_0x5830d7){_0x5830d7=_0x5830d7||0xcc;return function(_0x29ae73){if(_0x29ae73){return _0x4d657f['sendStatus'](_0x5830d7);}return _0x4d657f[_0x6175('0x16')](_0x5830d7)[_0x6175('0x17')]();};}function respondWithResult(_0x605416,_0x48c4a5){_0x48c4a5=_0x48c4a5||0xc8;return function(_0x7f6da0){if(_0x7f6da0){return _0x605416[_0x6175('0x16')](_0x48c4a5)[_0x6175('0x18')](_0x7f6da0);}};}function respondWithFilteredResult(_0x3dada4,_0x9f9c49){return function(_0x552df6){if(_0x552df6){var _0xc87ff1=typeof _0x9f9c49[_0x6175('0x19')]===_0x6175('0x1a')&&typeof _0x9f9c49[_0x6175('0x1b')]===_0x6175('0x1a');var _0x5311b3=_0x552df6[_0x6175('0x1c')];var _0x1a90e6=_0xc87ff1?0x0:_0x9f9c49['offset'];var _0x1f4ab4=_0xc87ff1?_0x552df6[_0x6175('0x1c')]:_0x9f9c49['offset']+_0x9f9c49[_0x6175('0x1b')];var _0x5622af;if(_0x1f4ab4>=_0x5311b3){_0x1f4ab4=_0x5311b3;_0x5622af=0xc8;}else{_0x5622af=0xce;}_0x3dada4[_0x6175('0x16')](_0x5622af);return _0x3dada4[_0x6175('0x1d')](_0x6175('0x1e'),_0x1a90e6+'-'+_0x1f4ab4+'/'+_0x5311b3)['json'](_0x552df6);}return null;};}function patchUpdates(_0x22e8c6){return function(_0x17d764){try{jsonpatch[_0x6175('0x1f')](_0x17d764,_0x22e8c6,!![]);}catch(_0x34aaa1){return BPromise['reject'](_0x34aaa1);}return _0x17d764[_0x6175('0x20')]();};}function saveUpdates(_0x296eac,_0x173943){return function(_0x33e793){if(_0x33e793){return _0x33e793[_0x6175('0x21')](_0x296eac)[_0x6175('0x22')](function(_0x2192de){return _0x2192de;});}return null;};}function removeEntity(_0x1b8060,_0x47b883){return function(_0x579f29){if(_0x579f29){return _0x579f29[_0x6175('0x23')]()[_0x6175('0x22')](function(){_0x1b8060['status'](0xcc)[_0x6175('0x17')]();});}};}function handleEntityNotFound(_0x567ad4,_0x1ce192){return function(_0x316b20){if(!_0x316b20){_0x567ad4['sendStatus'](0x194);}return _0x316b20;};}function handleError(_0x382a28,_0xbfaf42){_0xbfaf42=_0xbfaf42||0x1f4;return function(_0x46ac7a){logger[_0x6175('0x24')](_0x46ac7a[_0x6175('0x25')]);if(_0x46ac7a[_0x6175('0x26')]){delete _0x46ac7a['name'];}_0x382a28[_0x6175('0x16')](_0xbfaf42)['send'](_0x46ac7a);};}exports[_0x6175('0x27')]=function(_0x27e0e5,_0x54a72f){var _0x7fbd67={},_0x4b4c10={},_0xfaddc8={'count':0x0,'rows':[]};var _0x1e291c=_[_0x6175('0x28')](db[_0x6175('0x29')][_0x6175('0x2a')],function(_0x13e896){return{'name':_0x13e896['fieldName'],'type':_0x13e896[_0x6175('0x2b')][_0x6175('0x2c')]};});_0x4b4c10[_0x6175('0x2d')]=_[_0x6175('0x28')](_0x1e291c,'name');_0x4b4c10[_0x6175('0x2e')]=_['keys'](_0x27e0e5['query']);_0x4b4c10[_0x6175('0x2f')]=_[_0x6175('0x30')](_0x4b4c10[_0x6175('0x2d')],_0x4b4c10[_0x6175('0x2e')]);_0x7fbd67[_0x6175('0x31')]=_['intersection'](_0x4b4c10[_0x6175('0x2d')],qs[_0x6175('0x32')](_0x27e0e5[_0x6175('0x2e')][_0x6175('0x32')]));_0x7fbd67[_0x6175('0x31')]=_0x7fbd67[_0x6175('0x31')][_0x6175('0x33')]?_0x7fbd67[_0x6175('0x31')]:_0x4b4c10[_0x6175('0x2d')];if(!_0x27e0e5[_0x6175('0x2e')][_0x6175('0x34')](_0x6175('0x35'))){_0x7fbd67['limit']=qs[_0x6175('0x1b')](_0x27e0e5[_0x6175('0x2e')]['limit']);_0x7fbd67['offset']=qs['offset'](_0x27e0e5[_0x6175('0x2e')]['offset']);}_0x7fbd67[_0x6175('0x36')]=qs[_0x6175('0x37')](_0x27e0e5['query']['sort']);_0x7fbd67[_0x6175('0x38')]=qs['filters'](_[_0x6175('0x39')](_0x27e0e5[_0x6175('0x2e')],_0x4b4c10[_0x6175('0x2f')]),_0x1e291c);if(_0x27e0e5['query'][_0x6175('0x3a')]){_0x7fbd67[_0x6175('0x38')]=_[_0x6175('0x3b')](_0x7fbd67['where'],{'$or':_[_0x6175('0x28')](_0x1e291c,function(_0x4ca69c){if(_0x4ca69c['type']!==_0x6175('0x3c')){var _0x41b9f7={};_0x41b9f7[_0x4ca69c[_0x6175('0x26')]]={'$like':'%'+_0x27e0e5['query'][_0x6175('0x3a')]+'%'};return _0x41b9f7;}})});}_0x7fbd67=_[_0x6175('0x3b')]({},_0x7fbd67,_0x27e0e5[_0x6175('0x3d')]);var _0x5fe09f={'where':_0x7fbd67[_0x6175('0x38')]};return db['ZendeskField'][_0x6175('0x1c')](_0x5fe09f)['then'](function(_0x3114f1){_0xfaddc8[_0x6175('0x1c')]=_0x3114f1;if(_0x27e0e5['query']['includeAll']){_0x7fbd67[_0x6175('0x3e')]=[{'all':!![]}];}return db['ZendeskField'][_0x6175('0x3f')](_0x7fbd67);})[_0x6175('0x22')](function(_0x37a53b){_0xfaddc8[_0x6175('0x40')]=_0x37a53b;return _0xfaddc8;})['then'](respondWithFilteredResult(_0x54a72f,_0x7fbd67))['catch'](handleError(_0x54a72f,null));};exports[_0x6175('0x41')]=function(_0x3703d8,_0x449790){var _0x16cfe4={'raw':!![],'where':{'id':_0x3703d8['params']['id']}},_0x162cec={};_0x162cec[_0x6175('0x2d')]=_[_0x6175('0x42')](db[_0x6175('0x29')][_0x6175('0x2a')]);_0x162cec[_0x6175('0x2e')]=_[_0x6175('0x42')](_0x3703d8['query']);_0x162cec[_0x6175('0x2f')]=_[_0x6175('0x30')](_0x162cec[_0x6175('0x2d')],_0x162cec[_0x6175('0x2e')]);_0x16cfe4['attributes']=_[_0x6175('0x30')](_0x162cec[_0x6175('0x2d')],qs[_0x6175('0x32')](_0x3703d8[_0x6175('0x2e')]['fields']));_0x16cfe4[_0x6175('0x31')]=_0x16cfe4[_0x6175('0x31')][_0x6175('0x33')]?_0x16cfe4[_0x6175('0x31')]:_0x162cec[_0x6175('0x2d')];if(_0x3703d8[_0x6175('0x2e')][_0x6175('0x43')]){_0x16cfe4['include']=[{'all':!![]}];}_0x16cfe4=_[_0x6175('0x3b')]({},_0x16cfe4,_0x3703d8[_0x6175('0x3d')]);return db[_0x6175('0x29')]['find'](_0x16cfe4)[_0x6175('0x22')](handleEntityNotFound(_0x449790,null))[_0x6175('0x22')](respondWithResult(_0x449790,null))['catch'](handleError(_0x449790,null));};exports[_0x6175('0x44')]=function(_0x22a4bb,_0x21582b){return db[_0x6175('0x29')][_0x6175('0x44')](_0x22a4bb['body'],{})['then'](respondWithResult(_0x21582b,0xc9))[_0x6175('0x45')](handleError(_0x21582b,null));};exports[_0x6175('0x21')]=function(_0x50794f,_0x3965ce){if(_0x50794f[_0x6175('0x46')]['id']){delete _0x50794f['body']['id'];}return db[_0x6175('0x29')][_0x6175('0x47')]({'where':{'id':_0x50794f[_0x6175('0x48')]['id']}})['then'](handleEntityNotFound(_0x3965ce,null))[_0x6175('0x22')](saveUpdates(_0x50794f[_0x6175('0x46')],null))[_0x6175('0x22')](respondWithResult(_0x3965ce,null))[_0x6175('0x45')](handleError(_0x3965ce,null));};exports[_0x6175('0x23')]=function(_0x1a9431,_0x5513d6){return db[_0x6175('0x29')][_0x6175('0x47')]({'where':{'id':_0x1a9431[_0x6175('0x48')]['id']}})[_0x6175('0x22')](handleEntityNotFound(_0x5513d6,null))[_0x6175('0x22')](removeEntity(_0x5513d6,null))['catch'](handleError(_0x5513d6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 641a600..7f7b5d4 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 _0xf744=['bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x5aee2d,_0x111038){var _0x4daa97=function(_0xa2da52){while(--_0xa2da52){_0x5aee2d['push'](_0x5aee2d['shift']());}};_0x4daa97(++_0x111038);}(_0xf744,0xdd));var _0x4f74=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xf744[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x4f74('0x0'));var util=require(_0x4f74('0x1'));var logger=require(_0x4f74('0x2'))('api');var moment=require(_0x4f74('0x3'));var BPromise=require(_0x4f74('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f74('0x5'));var rimraf=require(_0x4f74('0x6'));var config=require(_0x4f74('0x7'));var attributes=require(_0x4f74('0x8'));module[_0x4f74('0x9')]=function(_0x21abab,_0x48cf14){return _0x21abab[_0x4f74('0xa')]('ZendeskField',attributes,{'tableName':_0x4f74('0xb'),'paranoid':![],'indexes':[{'name':_0x4f74('0xc'),'fields':[_0x4f74('0xd'),_0x4f74('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22a4=['path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x599d0b,_0x59e614){var _0x58eacd=function(_0x3a505c){while(--_0x3a505c){_0x599d0b['push'](_0x599d0b['shift']());}};_0x58eacd(++_0x59e614);}(_0x22a4,0x1bc));var _0x422a=function(_0x167107,_0x487e91){_0x167107=_0x167107-0x0;var _0x4ae324=_0x22a4[_0x167107];return _0x4ae324;};'use strict';var _=require(_0x422a('0x0'));var util=require(_0x422a('0x1'));var logger=require(_0x422a('0x2'))(_0x422a('0x3'));var moment=require(_0x422a('0x4'));var BPromise=require(_0x422a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x422a('0x6'));var rimraf=require(_0x422a('0x7'));var config=require(_0x422a('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x422a('0x9')]=function(_0x3aeb04,_0x5bab08){return _0x3aeb04[_0x422a('0xa')](_0x422a('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x422a('0xc'),'fields':[_0x422a('0xd'),_0x422a('0xe')],'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 937a1ee..91b7b6e 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 _0x7ec9=['request','then','info','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ZendeskField,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x559b2d,_0x18cc0f){var _0x16f956=function(_0x17ad10){while(--_0x17ad10){_0x559b2d['push'](_0x559b2d['shift']());}};_0x16f956(++_0x18cc0f);}(_0x7ec9,0x19a));var _0x97ec=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x7ec9[_0x2136a6];return _0x55b948;};'use strict';var _=require(_0x97ec('0x0'));var util=require(_0x97ec('0x1'));var moment=require('moment');var BPromise=require(_0x97ec('0x2'));var rs=require(_0x97ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x97ec('0x5'))('rpc');var config=require(_0x97ec('0x6'));var jayson=require(_0x97ec('0x7'));var client=jayson[_0x97ec('0x8')][_0x97ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57c6e7,_0x3cece6,_0x5a0fc4){return new BPromise(function(_0x5c0eea,_0x34476d){return client[_0x97ec('0xa')](_0x57c6e7,_0x5a0fc4)[_0x97ec('0xb')](function(_0x278249){logger[_0x97ec('0xc')]('ZendeskField,\x20%s,\x20%s',_0x3cece6,'request\x20sent');logger['debug'](_0x97ec('0xd'),_0x3cece6,_0x97ec('0xe'),JSON['stringify'](_0x278249));if(_0x278249[_0x97ec('0xf')]){if(_0x278249['error'][_0x97ec('0x10')]===0x1f4){logger[_0x97ec('0xf')]('ZendeskField,\x20%s,\x20%s',_0x3cece6,_0x278249[_0x97ec('0xf')]['message']);return _0x34476d(_0x278249[_0x97ec('0xf')][_0x97ec('0x11')]);}logger[_0x97ec('0xf')]('ZendeskField,\x20%s,\x20%s',_0x3cece6,_0x278249[_0x97ec('0xf')][_0x97ec('0x11')]);return _0x5c0eea(_0x278249[_0x97ec('0xf')]['message']);}else{logger[_0x97ec('0xc')]('ZendeskField,\x20%s,\x20%s',_0x3cece6,_0x97ec('0xe'));_0x5c0eea(_0x278249[_0x97ec('0x12')]['message']);}})[_0x97ec('0x13')](function(_0x294b94){logger[_0x97ec('0xf')](_0x97ec('0x14'),_0x3cece6,_0x294b94);_0x34476d(_0x294b94);});});} \ No newline at end of file +var _0x625b=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ZendeskField,\x20%s,\x20%s'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x625b,0xfa));var _0xb625=function(_0x3e64b6,_0x490eee){_0x3e64b6=_0x3e64b6-0x0;var _0xc1fe54=_0x625b[_0x3e64b6];return _0xc1fe54;};'use strict';var _=require(_0xb625('0x0'));var util=require(_0xb625('0x1'));var moment=require(_0xb625('0x2'));var BPromise=require(_0xb625('0x3'));var rs=require(_0xb625('0x4'));var fs=require('fs');var Redis=require(_0xb625('0x5'));var db=require(_0xb625('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb625('0x7'))(_0xb625('0x8'));var config=require(_0xb625('0x9'));var jayson=require(_0xb625('0xa'));var client=jayson[_0xb625('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cfeb4,_0x547354,_0xc77d0e){return new BPromise(function(_0x48b06e,_0x507fe3){return client['request'](_0x1cfeb4,_0xc77d0e)['then'](function(_0x2a55ec){logger[_0xb625('0xc')](_0xb625('0xd'),_0x547354,_0xb625('0xe'));logger[_0xb625('0xf')](_0xb625('0x10'),_0x547354,_0xb625('0xe'),JSON[_0xb625('0x11')](_0x2a55ec));if(_0x2a55ec[_0xb625('0x12')]){if(_0x2a55ec[_0xb625('0x12')]['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x547354,_0x2a55ec['error']['message']);return _0x507fe3(_0x2a55ec['error']['message']);}logger['error'](_0xb625('0xd'),_0x547354,_0x2a55ec['error']['message']);return _0x48b06e(_0x2a55ec[_0xb625('0x12')]['message']);}else{logger[_0xb625('0xc')](_0xb625('0xd'),_0x547354,'request\x20sent');_0x48b06e(_0x2a55ec[_0xb625('0x13')][_0xb625('0x14')]);}})[_0xb625('0x15')](function(_0x40cc6f){logger['error'](_0xb625('0xd'),_0x547354,_0x40cc6f);_0x507fe3(_0x40cc6f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ce0927c..e3da736 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 _0x3a2a=['get','index','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','put','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller'];(function(_0x1b2748,_0x159312){var _0xb28c40=function(_0x2eef84){while(--_0x2eef84){_0x1b2748['push'](_0x1b2748['shift']());}};_0xb28c40(++_0x159312);}(_0x3a2a,0x1db));var _0xa3a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a2a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa3a2('0x0'));var util=require(_0xa3a2('0x1'));var path=require(_0xa3a2('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3a2('0x3'));var router=express['Router']();var fs_extra=require(_0xa3a2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa3a2('0x5'));var config=require(_0xa3a2('0x6'));var controller=require(_0xa3a2('0x7'));router[_0xa3a2('0x8')]('/',auth['isAuthenticated'](),controller[_0xa3a2('0x9')]);router[_0xa3a2('0x8')]('/:id',auth[_0xa3a2('0xa')](),controller[_0xa3a2('0xb')]);router[_0xa3a2('0x8')]('/:id/configurations',auth[_0xa3a2('0xa')](),controller[_0xa3a2('0xc')]);router['get'](_0xa3a2('0xd'),auth[_0xa3a2('0xa')](),controller[_0xa3a2('0xe')]);router[_0xa3a2('0xf')]('/',auth[_0xa3a2('0xa')](),controller[_0xa3a2('0x10')]);router[_0xa3a2('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa3a2('0x11')]('/:id',auth[_0xa3a2('0xa')](),controller['update']);router['delete'](_0xa3a2('0x12'),auth['isAuthenticated'](),controller[_0xa3a2('0x13')]);module[_0xa3a2('0x14')]=router; \ No newline at end of file +var _0xa988=['/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xa988,0x19f));var _0x8a98=function(_0x58da0,_0x459cc5){_0x58da0=_0x58da0-0x0;var _0x5b5c11=_0xa988[_0x58da0];return _0x5b5c11;};'use strict';var multer=require('multer');var util=require(_0x8a98('0x0'));var path=require(_0x8a98('0x1'));var timeout=require(_0x8a98('0x2'));var express=require(_0x8a98('0x3'));var router=express[_0x8a98('0x4')]();var fs_extra=require(_0x8a98('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8a98('0x6'));var config=require('../../config/environment');var controller=require(_0x8a98('0x7'));router[_0x8a98('0x8')]('/',auth[_0x8a98('0x9')](),controller[_0x8a98('0xa')]);router['get'](_0x8a98('0xb'),auth['isAuthenticated'](),controller[_0x8a98('0xc')]);router[_0x8a98('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8a98('0xd')]);router['get'](_0x8a98('0xe'),auth[_0x8a98('0x9')](),controller[_0x8a98('0xf')]);router[_0x8a98('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8a98('0x10')](_0x8a98('0x11'),auth['isAuthenticated'](),controller[_0x8a98('0x12')]);router[_0x8a98('0x13')](_0x8a98('0xb'),auth['isAuthenticated'](),controller[_0x8a98('0x14')]);router[_0x8a98('0x15')](_0x8a98('0xb'),auth[_0x8a98('0x9')](),controller[_0x8a98('0x16')]);module[_0x8a98('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index d5f6a71..5ea22ad 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 _0xf109=['exports','STRING','sequelize'];(function(_0x251c6d,_0x4652d1){var _0x4f0bf3=function(_0x105b36){while(--_0x105b36){_0x251c6d['push'](_0x251c6d['shift']());}};_0x4f0bf3(++_0x4652d1);}(_0xf109,0xce));var _0x9f10=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xf109[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'name':{'type':Sequelize[_0x9f10('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9f10('0x2')]},'clientSecret':{'type':Sequelize[_0x9f10('0x2')]},'serverUrl':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x9f10('0x2')]},'refreshToken':{'type':Sequelize[_0x9f10('0x2')]}}; \ No newline at end of file +var _0xb821=['STRING','exports'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0xb821,0xa7));var _0x1b82=function(_0x4b39e2,_0x16991a){_0x4b39e2=_0x4b39e2-0x0;var _0x4127a8=_0xb821[_0x4b39e2];return _0x4127a8;};'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 d1a59f0..ca792b4 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 _0xfec8=['Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','ZohoAccount','type','model','map','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','rawAttributes','fields','include','options','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','order','hasOwnProperty','AccountId','channel','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfec8,0x107));var _0x8fec=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xfec8[_0x3e7e96];return _0x13f6f0;};'use strict';var emlformat=require(_0x8fec('0x0'));var rimraf=require(_0x8fec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fec('0x2'));var rp=require('request-promise');var moment=require(_0x8fec('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8fec('0x4'));var path=require(_0x8fec('0x5'));var sox=require(_0x8fec('0x6'));var csv=require('to-csv');var ejs=require(_0x8fec('0x7'));var fs=require('fs');var fs_extra=require(_0x8fec('0x8'));var _=require(_0x8fec('0x9'));var squel=require(_0x8fec('0xa'));var crypto=require(_0x8fec('0xb'));var jsforce=require(_0x8fec('0xc'));var deskjs=require(_0x8fec('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8fec('0xe'));var Papa=require('papaparse');var Redis=require(_0x8fec('0xf'));var authService=require(_0x8fec('0x10'));var qs=require(_0x8fec('0x11'));var as=require(_0x8fec('0x12'));var hardwareService=require(_0x8fec('0x13'));var logger=require(_0x8fec('0x14'))(_0x8fec('0x15'));var utils=require(_0x8fec('0x16'));var config=require(_0x8fec('0x17'));var licenseUtil=require(_0x8fec('0x18'));var db=require(_0x8fec('0x19'))['db'];var integrations=require(_0x8fec('0x1a'));function respondWithStatusCode(_0x4a43bb,_0x362761){_0x362761=_0x362761||0xcc;return function(_0x114f60){if(_0x114f60){return _0x4a43bb[_0x8fec('0x1b')](_0x362761);}return _0x4a43bb[_0x8fec('0x1c')](_0x362761)[_0x8fec('0x1d')]();};}function respondWithResult(_0x652e36,_0x1d7ab8){_0x1d7ab8=_0x1d7ab8||0xc8;return function(_0x4c036f){if(_0x4c036f){return _0x652e36['status'](_0x1d7ab8)['json'](_0x4c036f);}};}function respondWithFilteredResult(_0x5b2ded,_0x1a841b){return function(_0x1fe9c5){if(_0x1fe9c5){var _0x338180=typeof _0x1a841b[_0x8fec('0x1e')]===_0x8fec('0x1f')&&typeof _0x1a841b[_0x8fec('0x20')]===_0x8fec('0x1f');var _0x79aae3=_0x1fe9c5['count'];var _0x58fb6f=_0x338180?0x0:_0x1a841b[_0x8fec('0x1e')];var _0x1237f2=_0x338180?_0x1fe9c5[_0x8fec('0x21')]:_0x1a841b[_0x8fec('0x1e')]+_0x1a841b[_0x8fec('0x20')];var _0x235d6f;if(_0x1237f2>=_0x79aae3){_0x1237f2=_0x79aae3;_0x235d6f=0xc8;}else{_0x235d6f=0xce;}_0x5b2ded[_0x8fec('0x1c')](_0x235d6f);return _0x5b2ded[_0x8fec('0x22')](_0x8fec('0x23'),_0x58fb6f+'-'+_0x1237f2+'/'+_0x79aae3)[_0x8fec('0x24')](_0x1fe9c5);}return null;};}function patchUpdates(_0x5183c3){return function(_0x32b4c7){try{jsonpatch['apply'](_0x32b4c7,_0x5183c3,!![]);}catch(_0x1b404d){return BPromise[_0x8fec('0x25')](_0x1b404d);}return _0x32b4c7[_0x8fec('0x26')]();};}function saveUpdates(_0x66f18c,_0x32ce0a){return function(_0x1b54a7){if(_0x1b54a7){return _0x1b54a7[_0x8fec('0x27')](_0x66f18c)[_0x8fec('0x28')](function(_0x1ef3df){return _0x1ef3df;});}return null;};}function removeEntity(_0x304df3,_0x1a25f0){return function(_0xee42a3){if(_0xee42a3){return _0xee42a3['destroy']()[_0x8fec('0x28')](function(){_0x304df3[_0x8fec('0x1c')](0xcc)[_0x8fec('0x1d')]();});}};}function handleEntityNotFound(_0x4edd39,_0x1bad84){return function(_0x44c988){if(!_0x44c988){_0x4edd39[_0x8fec('0x1b')](0x194);}return _0x44c988;};}function handleError(_0x2f018e,_0x1049f0){_0x1049f0=_0x1049f0||0x1f4;return function(_0x5522ac){logger[_0x8fec('0x29')](_0x5522ac[_0x8fec('0x2a')]);if(_0x5522ac[_0x8fec('0x2b')]){delete _0x5522ac['name'];}_0x2f018e[_0x8fec('0x1c')](_0x1049f0)['send'](_0x5522ac);};}exports['index']=function(_0xdf7b80,_0x3a8d3e){var _0x362ba1={},_0x5983b7={},_0x3ca793={'count':0x0,'rows':[]};var _0x2dee1e=_['map'](db[_0x8fec('0x2c')]['rawAttributes'],function(_0x5e6472){return{'name':_0x5e6472['fieldName'],'type':_0x5e6472[_0x8fec('0x2d')]['key']};});_0x5983b7[_0x8fec('0x2e')]=_[_0x8fec('0x2f')](_0x2dee1e,_0x8fec('0x2b'));_0x5983b7[_0x8fec('0x30')]=_['keys'](_0xdf7b80[_0x8fec('0x30')]);_0x5983b7[_0x8fec('0x31')]=_[_0x8fec('0x32')](_0x5983b7[_0x8fec('0x2e')],_0x5983b7[_0x8fec('0x30')]);_0x362ba1[_0x8fec('0x33')]=_[_0x8fec('0x32')](_0x5983b7[_0x8fec('0x2e')],qs['fields'](_0xdf7b80[_0x8fec('0x30')]['fields']));_0x362ba1[_0x8fec('0x33')]=_0x362ba1[_0x8fec('0x33')][_0x8fec('0x34')]?_0x362ba1['attributes']:_0x5983b7['model'];if(!_0xdf7b80[_0x8fec('0x30')]['hasOwnProperty'](_0x8fec('0x35'))){_0x362ba1[_0x8fec('0x20')]=qs[_0x8fec('0x20')](_0xdf7b80[_0x8fec('0x30')]['limit']);_0x362ba1['offset']=qs['offset'](_0xdf7b80['query'][_0x8fec('0x1e')]);}_0x362ba1['order']=qs['sort'](_0xdf7b80[_0x8fec('0x30')][_0x8fec('0x36')]);_0x362ba1[_0x8fec('0x37')]=qs[_0x8fec('0x31')](_[_0x8fec('0x38')](_0xdf7b80[_0x8fec('0x30')],_0x5983b7[_0x8fec('0x31')]),_0x2dee1e);if(_0xdf7b80[_0x8fec('0x30')][_0x8fec('0x39')]){_0x362ba1[_0x8fec('0x37')]=_[_0x8fec('0x3a')](_0x362ba1[_0x8fec('0x37')],{'$or':_[_0x8fec('0x2f')](_0x2dee1e,function(_0x251f8c){if(_0x251f8c[_0x8fec('0x2d')]!==_0x8fec('0x3b')){var _0x2f47f4={};_0x2f47f4[_0x251f8c[_0x8fec('0x2b')]]={'$like':'%'+_0xdf7b80['query'][_0x8fec('0x39')]+'%'};return _0x2f47f4;}})});}_0x362ba1=_['merge']({},_0x362ba1,_0xdf7b80['options']);var _0x110c87={'where':_0x362ba1[_0x8fec('0x37')]};return db[_0x8fec('0x2c')][_0x8fec('0x21')](_0x110c87)['then'](function(_0x1d2944){_0x3ca793['count']=_0x1d2944;if(_0xdf7b80[_0x8fec('0x30')][_0x8fec('0x3c')]){_0x362ba1['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x8fec('0x3d')](_0x362ba1);})['then'](function(_0x122807){_0x3ca793[_0x8fec('0x3e')]=_0x122807;return _0x3ca793;})['then'](respondWithFilteredResult(_0x3a8d3e,_0x362ba1))[_0x8fec('0x3f')](handleError(_0x3a8d3e,null));};exports['show']=function(_0x4f903a,_0x160c8f){var _0x4e2576={'raw':![],'where':{'id':_0x4f903a[_0x8fec('0x40')]['id']}},_0x32ce80={};_0x32ce80[_0x8fec('0x2e')]=_[_0x8fec('0x41')](db[_0x8fec('0x2c')][_0x8fec('0x42')]);_0x32ce80[_0x8fec('0x30')]=_[_0x8fec('0x41')](_0x4f903a['query']);_0x32ce80[_0x8fec('0x31')]=_['intersection'](_0x32ce80[_0x8fec('0x2e')],_0x32ce80[_0x8fec('0x30')]);_0x4e2576[_0x8fec('0x33')]=_[_0x8fec('0x32')](_0x32ce80['model'],qs[_0x8fec('0x43')](_0x4f903a[_0x8fec('0x30')]['fields']));_0x4e2576[_0x8fec('0x33')]=_0x4e2576[_0x8fec('0x33')][_0x8fec('0x34')]?_0x4e2576[_0x8fec('0x33')]:_0x32ce80[_0x8fec('0x2e')];if(_0x4f903a[_0x8fec('0x30')]['includeAll']){_0x4e2576[_0x8fec('0x44')]=[{'all':!![]}];}_0x4e2576=_[_0x8fec('0x3a')]({},_0x4e2576,_0x4f903a[_0x8fec('0x45')]);return db[_0x8fec('0x2c')][_0x8fec('0x46')](_0x4e2576)['then'](handleEntityNotFound(_0x160c8f,null))[_0x8fec('0x28')](respondWithResult(_0x160c8f,null))['catch'](handleError(_0x160c8f,null));};exports[_0x8fec('0x47')]=function(_0x7c957b,_0xe5f03){return db[_0x8fec('0x2c')][_0x8fec('0x47')](_0x7c957b[_0x8fec('0x48')],{})[_0x8fec('0x28')](respondWithResult(_0xe5f03,0xc9))['catch'](handleError(_0xe5f03,null));};exports['update']=function(_0x2f2979,_0x45ad76){if(_0x2f2979[_0x8fec('0x48')]['id']){delete _0x2f2979[_0x8fec('0x48')]['id'];}return db[_0x8fec('0x2c')]['find']({'where':{'id':_0x2f2979[_0x8fec('0x40')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x45ad76,null))[_0x8fec('0x28')](saveUpdates(_0x2f2979[_0x8fec('0x48')],null))['then'](respondWithResult(_0x45ad76,null))[_0x8fec('0x3f')](handleError(_0x45ad76,null));};exports[_0x8fec('0x49')]=function(_0x2f575d,_0xa08a6){return db['ZohoAccount'][_0x8fec('0x46')]({'where':{'id':_0x2f575d[_0x8fec('0x40')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0xa08a6,null))[_0x8fec('0x28')](removeEntity(_0xa08a6,null))[_0x8fec('0x3f')](handleError(_0xa08a6,null));};exports[_0x8fec('0x4a')]=function(_0x589f80,_0x3c3f1d,_0x4f427b){var _0xbe937c={};var _0x361cde={};var _0x153ceb;var _0x14e878;return db[_0x8fec('0x2c')][_0x8fec('0x4b')]({'where':{'id':_0x589f80[_0x8fec('0x40')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x3c3f1d,null))[_0x8fec('0x28')](function(_0x5535cb){if(_0x5535cb){_0x153ceb=_0x5535cb;_0x361cde[_0x8fec('0x2e')]=_[_0x8fec('0x41')](db[_0x8fec('0x4c')][_0x8fec('0x42')]);_0x361cde[_0x8fec('0x30')]=_[_0x8fec('0x41')](_0x589f80['query']);_0x361cde[_0x8fec('0x31')]=_['intersection'](_0x361cde[_0x8fec('0x2e')],_0x361cde[_0x8fec('0x30')]);_0xbe937c[_0x8fec('0x33')]=_[_0x8fec('0x32')](_0x361cde[_0x8fec('0x2e')],qs['fields'](_0x589f80[_0x8fec('0x30')][_0x8fec('0x43')]));_0xbe937c[_0x8fec('0x33')]=_0xbe937c[_0x8fec('0x33')][_0x8fec('0x34')]?_0xbe937c[_0x8fec('0x33')]:_0x361cde[_0x8fec('0x2e')];_0xbe937c[_0x8fec('0x4d')]=qs[_0x8fec('0x36')](_0x589f80[_0x8fec('0x30')]['sort']);_0xbe937c[_0x8fec('0x37')]=qs['filters'](_['pick'](_0x589f80[_0x8fec('0x30')],_0x361cde[_0x8fec('0x31')]));if(_0x589f80[_0x8fec('0x30')]['filter']){_0xbe937c[_0x8fec('0x37')]=_[_0x8fec('0x3a')](_0xbe937c[_0x8fec('0x37')],{'$or':_[_0x8fec('0x2f')](_0xbe937c['attributes'],function(_0x2ee2ee){var _0x56bb8b={};_0x56bb8b[_0x2ee2ee]={'$like':'%'+_0x589f80[_0x8fec('0x30')][_0x8fec('0x39')]+'%'};return _0x56bb8b;})});}_0xbe937c=_[_0x8fec('0x3a')]({},_0xbe937c,_0x589f80[_0x8fec('0x45')]);return _0x153ceb[_0x8fec('0x4a')](_0xbe937c);}})[_0x8fec('0x28')](function(_0x535cd9){if(_0x535cd9){_0x14e878=_0x535cd9[_0x8fec('0x34')];if(!_0x589f80[_0x8fec('0x30')][_0x8fec('0x4e')](_0x8fec('0x35'))){_0xbe937c[_0x8fec('0x20')]=qs[_0x8fec('0x20')](_0x589f80['query'][_0x8fec('0x20')]);_0xbe937c[_0x8fec('0x1e')]=qs[_0x8fec('0x1e')](_0x589f80['query']['offset']);}return _0x153ceb[_0x8fec('0x4a')](_0xbe937c);}})['then'](function(_0x400d5b){if(_0x400d5b){return _0x400d5b?{'count':_0x14e878,'rows':_0x400d5b}:null;}})[_0x8fec('0x28')](respondWithResult(_0x3c3f1d,null))['catch'](handleError(_0x3c3f1d,null));};exports['addConfiguration']=function(_0x254734,_0x4fa162,_0x1559c6){if(_0x254734['body']['id']){delete _0x254734[_0x8fec('0x48')]['id'];}return db[_0x8fec('0x2c')]['findOne']({'where':{'id':_0x254734[_0x8fec('0x40')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x4fa162,null))[_0x8fec('0x28')](function(_0x58e26b){if(_0x58e26b){_0x254734[_0x8fec('0x48')][_0x8fec('0x4f')]=_0x58e26b['id'];_0x254734['body']['Subjects']=integrations['getSubjects'](_0x254734['body'][_0x8fec('0x50')],_0x254734['body'][_0x8fec('0x2d')]);_0x254734[_0x8fec('0x48')][_0x8fec('0x51')]=integrations['getDescriptions'](_0x254734['body']['channel'],_0x254734[_0x8fec('0x48')][_0x8fec('0x2d')]);return db[_0x8fec('0x4c')][_0x8fec('0x47')](_0x254734['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x8fec('0x51')}]});}return null;})[_0x8fec('0x28')](respondWithResult(_0x4fa162,null))[_0x8fec('0x3f')](handleError(_0x4fa162,null));};function getAccessToken(_0x194d98){return new Promise(function(_0x2f3ff0,_0xe56fd2){var _0x58a4b0;switch(_0x194d98[_0x8fec('0x52')]){case'US':_0x58a4b0=_0x8fec('0x53');break;case'AU':_0x58a4b0=_0x8fec('0x54');break;case'EU':_0x58a4b0=_0x8fec('0x55');break;case'IN':_0x58a4b0=_0x8fec('0x56');break;case'CN':_0x58a4b0='https://accounts.zoho.com.cn';break;default:_0x58a4b0=_0x8fec('0x55');break;}var _0x4b79b5={'method':'POST','uri':_0x58a4b0+'/oauth/v2/token','qs':{'refresh_token':_0x194d98[_0x8fec('0x57')],'client_id':_0x194d98[_0x8fec('0x58')],'client_secret':_0x194d98[_0x8fec('0x59')],'grant_type':_0x8fec('0x5a')},'json':!![]};return rp(_0x4b79b5)[_0x8fec('0x28')](function(_0x5920c7){if(_0x5920c7['access_token']){_0x2f3ff0(_0x5920c7[_0x8fec('0x5b')]);}else{_0xe56fd2(_0x8fec('0x5c'));}})[_0x8fec('0x3f')](function(_0x575a83){_0xe56fd2(_0x575a83);});});}exports[_0x8fec('0x5d')]=function(_0x5ab9f2,_0x1469d3,_0x1d87aa){var _0x144a71,_0x141722,_0x3802b8,_0x126406,_0x285453;return db[_0x8fec('0x2c')][_0x8fec('0x4b')]({'where':{'id':_0x5ab9f2[_0x8fec('0x40')]['id']},'attributes':['id',_0x8fec('0x5e'),_0x8fec('0x52'),_0x8fec('0x58'),_0x8fec('0x59'),_0x8fec('0x5f'),_0x8fec('0x60'),_0x8fec('0x57')]})[_0x8fec('0x28')](handleEntityNotFound(_0x1469d3,null))['then'](function(_0x534b17){_0x285453=_0x534b17;_0x144a71=_0x285453[_0x8fec('0x5e')];_0x141722=_0x144a71===_0x8fec('0x61')?'eu':'com';_0x3802b8=_0x285453[_0x8fec('0x5f')];var _0xd8907=_0x3802b8[_0x8fec('0x62')](-0x1);if(_0xd8907==='/'||_0xd8907==='\x5c'||_0xd8907===':'){_0x3802b8=_0x3802b8['substring'](0x0,_0x3802b8['lastIndexOf'](_0xd8907));}if(!_0x285453[_0x8fec('0x57')]){throw new Error(_0x8fec('0x63'));}return getAccessToken(_0x285453);})['then'](function(_0x13d433){if(_0x13d433){return rp({'method':_0x8fec('0x64'),'uri':util[_0x8fec('0x65')](_0x8fec('0x66'),_0x141722),'qs':{'module':_0x8fec('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x13d433},'json':!![]});}})[_0x8fec('0x28')](function(_0x34fd8d){if(_0x34fd8d){if(_0x34fd8d['response']&&_0x34fd8d[_0x8fec('0x68')][_0x8fec('0x29')]){throw new Error(_0x34fd8d[_0x8fec('0x68')][_0x8fec('0x29')][_0x8fec('0x69')]);}var _0x460873=[];var _0x41d2db=[];var _0x2cb457=['Owner','Subject','Description','WhoId',_0x8fec('0x6a'),_0x8fec('0x6b'),'Call_Start_Time',_0x8fec('0x6c')];_0x41d2db=_[_0x8fec('0x6d')](_0x34fd8d[_0x8fec('0x43')],function(_0x475a5b){return _0x2cb457[_0x8fec('0x6e')](_0x475a5b[_0x8fec('0x6f')]);});for(var _0x71f8d4=0x0;_0x71f8d4<_0x41d2db[_0x8fec('0x34')];_0x71f8d4++){if(_0x41d2db[_0x71f8d4][_0x8fec('0x70')]===![]){_0x460873['push']({'id':_0x41d2db[_0x71f8d4]['id'],'name':_0x41d2db[_0x71f8d4][_0x8fec('0x71')],'custom':_0x41d2db[_0x71f8d4][_0x8fec('0x72')],'options':_0x41d2db[_0x71f8d4][_0x8fec('0x73')]===_0x8fec('0x74')&&_0x41d2db[_0x71f8d4][_0x8fec('0x75')][_0x8fec('0x34')]>-0x1?_['map'](_0x41d2db[_0x71f8d4]['pick_list_values'],function(_0x17829d){return{'name':_0x17829d,'value':_0x17829d};}):[]});}}return{'count':_0x460873[_0x8fec('0x34')],'rows':_0x460873};}else{return{'count':0x0,'rows':[]};}})[_0x8fec('0x28')](respondWithResult(_0x1469d3,null))[_0x8fec('0x3f')](function(_0x5a886e){var _0x1281fb=_0x5ab9f2['query']['test']?0x1f4:_0x5a886e[_0x8fec('0x76')]||0x1f4;logger[_0x8fec('0x29')](_0x8fec('0x77'),_0x8fec('0x5d'),_0x1281fb,JSON[_0x8fec('0x78')](_0x5a886e));delete _0x5a886e[_0x8fec('0x2b')];if(_0x1281fb===0x191){_0x1281fb=0x190;}_0x1469d3[_0x8fec('0x1c')](_0x1281fb)['send'](_0x5ab9f2[_0x8fec('0x30')][_0x8fec('0x79')]?{'message':_0x8fec('0x7a'),'statusCode':_0x5a886e[_0x8fec('0x76')]}:_0x5a886e);});}; \ No newline at end of file +var _0xb0dc=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','sendStatus','name','send','map','ZohoAccount','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','type','VIRTUAL','merge','options','where','includeAll','findAll','rows','catch','show','intersection','find','create','body','update','destroy','params','getConfigurations','findOne','ZohoConfiguration','rawAttributes','pick','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','clientSecret','serverUrl','code','refreshToken','host','zoho.eu','com','slice','substring','lastIndexOf','GET','format','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xb0dc,0x101));var _0xcb0d=function(_0x17b012,_0x276485){_0x17b012=_0x17b012-0x0;var _0x5f3943=_0xb0dc[_0x17b012];return _0x5f3943;};'use strict';var emlformat=require(_0xcb0d('0x0'));var rimraf=require(_0xcb0d('0x1'));var zipdir=require(_0xcb0d('0x2'));var jsonpatch=require(_0xcb0d('0x3'));var rp=require(_0xcb0d('0x4'));var moment=require(_0xcb0d('0x5'));var BPromise=require(_0xcb0d('0x6'));var Mustache=require(_0xcb0d('0x7'));var util=require('util');var path=require(_0xcb0d('0x8'));var sox=require(_0xcb0d('0x9'));var csv=require(_0xcb0d('0xa'));var ejs=require(_0xcb0d('0xb'));var fs=require('fs');var fs_extra=require(_0xcb0d('0xc'));var _=require(_0xcb0d('0xd'));var squel=require(_0xcb0d('0xe'));var crypto=require(_0xcb0d('0xf'));var jsforce=require(_0xcb0d('0x10'));var deskjs=require(_0xcb0d('0x11'));var toCsv=require('to-csv');var querystring=require(_0xcb0d('0x12'));var Papa=require(_0xcb0d('0x13'));var Redis=require(_0xcb0d('0x14'));var authService=require(_0xcb0d('0x15'));var qs=require(_0xcb0d('0x16'));var as=require(_0xcb0d('0x17'));var hardwareService=require(_0xcb0d('0x18'));var logger=require(_0xcb0d('0x19'))('api');var utils=require(_0xcb0d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcb0d('0x1b'))['db'];var integrations=require(_0xcb0d('0x1c'));function respondWithStatusCode(_0x906558,_0x38ab08){_0x38ab08=_0x38ab08||0xcc;return function(_0x8890b){if(_0x8890b){return _0x906558['sendStatus'](_0x38ab08);}return _0x906558[_0xcb0d('0x1d')](_0x38ab08)[_0xcb0d('0x1e')]();};}function respondWithResult(_0x4afd3e,_0x5e9d85){_0x5e9d85=_0x5e9d85||0xc8;return function(_0x25ddbe){if(_0x25ddbe){return _0x4afd3e[_0xcb0d('0x1d')](_0x5e9d85)[_0xcb0d('0x1f')](_0x25ddbe);}};}function respondWithFilteredResult(_0x5208e2,_0x516b2e){return function(_0x4fae7a){if(_0x4fae7a){var _0x251f74=typeof _0x516b2e[_0xcb0d('0x20')]===_0xcb0d('0x21')&&typeof _0x516b2e[_0xcb0d('0x22')]===_0xcb0d('0x21');var _0x1bdfac=_0x4fae7a[_0xcb0d('0x23')];var _0x41e5f3=_0x251f74?0x0:_0x516b2e[_0xcb0d('0x20')];var _0x16408c=_0x251f74?_0x4fae7a['count']:_0x516b2e[_0xcb0d('0x20')]+_0x516b2e[_0xcb0d('0x22')];var _0x30320b;if(_0x16408c>=_0x1bdfac){_0x16408c=_0x1bdfac;_0x30320b=0xc8;}else{_0x30320b=0xce;}_0x5208e2[_0xcb0d('0x1d')](_0x30320b);return _0x5208e2[_0xcb0d('0x24')](_0xcb0d('0x25'),_0x41e5f3+'-'+_0x16408c+'/'+_0x1bdfac)[_0xcb0d('0x1f')](_0x4fae7a);}return null;};}function patchUpdates(_0x5ac809){return function(_0xedaea2){try{jsonpatch[_0xcb0d('0x26')](_0xedaea2,_0x5ac809,!![]);}catch(_0x3307ad){return BPromise['reject'](_0x3307ad);}return _0xedaea2[_0xcb0d('0x27')]();};}function saveUpdates(_0x2e708f,_0x4ee7be){return function(_0x334159){if(_0x334159){return _0x334159['update'](_0x2e708f)[_0xcb0d('0x28')](function(_0x15ff4a){return _0x15ff4a;});}return null;};}function removeEntity(_0x55a8a1,_0x303a8f){return function(_0x7579d8){if(_0x7579d8){return _0x7579d8['destroy']()[_0xcb0d('0x28')](function(){_0x55a8a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37505b,_0x244c89){return function(_0x1fe77e){if(!_0x1fe77e){_0x37505b[_0xcb0d('0x29')](0x194);}return _0x1fe77e;};}function handleError(_0x5dbb61,_0xcafaa1){_0xcafaa1=_0xcafaa1||0x1f4;return function(_0x458f08){logger['error'](_0x458f08['stack']);if(_0x458f08[_0xcb0d('0x2a')]){delete _0x458f08['name'];}_0x5dbb61['status'](_0xcafaa1)[_0xcb0d('0x2b')](_0x458f08);};}exports['index']=function(_0x3ac2e2,_0x3a63e3){var _0x2a7e60={},_0x3241ec={},_0x27373b={'count':0x0,'rows':[]};var _0x140140=_[_0xcb0d('0x2c')](db[_0xcb0d('0x2d')]['rawAttributes'],function(_0x490a2f){return{'name':_0x490a2f[_0xcb0d('0x2e')],'type':_0x490a2f['type']['key']};});_0x3241ec[_0xcb0d('0x2f')]=_[_0xcb0d('0x2c')](_0x140140,_0xcb0d('0x2a'));_0x3241ec[_0xcb0d('0x30')]=_[_0xcb0d('0x31')](_0x3ac2e2[_0xcb0d('0x30')]);_0x3241ec[_0xcb0d('0x32')]=_['intersection'](_0x3241ec[_0xcb0d('0x2f')],_0x3241ec[_0xcb0d('0x30')]);_0x2a7e60[_0xcb0d('0x33')]=_['intersection'](_0x3241ec[_0xcb0d('0x2f')],qs['fields'](_0x3ac2e2[_0xcb0d('0x30')][_0xcb0d('0x34')]));_0x2a7e60['attributes']=_0x2a7e60['attributes'][_0xcb0d('0x35')]?_0x2a7e60['attributes']:_0x3241ec['model'];if(!_0x3ac2e2[_0xcb0d('0x30')][_0xcb0d('0x36')](_0xcb0d('0x37'))){_0x2a7e60[_0xcb0d('0x22')]=qs[_0xcb0d('0x22')](_0x3ac2e2[_0xcb0d('0x30')][_0xcb0d('0x22')]);_0x2a7e60[_0xcb0d('0x20')]=qs[_0xcb0d('0x20')](_0x3ac2e2[_0xcb0d('0x30')][_0xcb0d('0x20')]);}_0x2a7e60[_0xcb0d('0x38')]=qs['sort'](_0x3ac2e2['query'][_0xcb0d('0x39')]);_0x2a7e60['where']=qs[_0xcb0d('0x32')](_['pick'](_0x3ac2e2[_0xcb0d('0x30')],_0x3241ec[_0xcb0d('0x32')]),_0x140140);if(_0x3ac2e2['query'][_0xcb0d('0x3a')]){_0x2a7e60['where']=_['merge'](_0x2a7e60['where'],{'$or':_[_0xcb0d('0x2c')](_0x140140,function(_0x32bea3){if(_0x32bea3[_0xcb0d('0x3b')]!==_0xcb0d('0x3c')){var _0xa8d737={};_0xa8d737[_0x32bea3[_0xcb0d('0x2a')]]={'$like':'%'+_0x3ac2e2[_0xcb0d('0x30')][_0xcb0d('0x3a')]+'%'};return _0xa8d737;}})});}_0x2a7e60=_[_0xcb0d('0x3d')]({},_0x2a7e60,_0x3ac2e2[_0xcb0d('0x3e')]);var _0x41a50a={'where':_0x2a7e60[_0xcb0d('0x3f')]};return db[_0xcb0d('0x2d')]['count'](_0x41a50a)['then'](function(_0x44d658){_0x27373b[_0xcb0d('0x23')]=_0x44d658;if(_0x3ac2e2['query'][_0xcb0d('0x40')]){_0x2a7e60['include']=[{'all':!![]}];}return db[_0xcb0d('0x2d')][_0xcb0d('0x41')](_0x2a7e60);})[_0xcb0d('0x28')](function(_0x2cae07){_0x27373b[_0xcb0d('0x42')]=_0x2cae07;return _0x27373b;})[_0xcb0d('0x28')](respondWithFilteredResult(_0x3a63e3,_0x2a7e60))[_0xcb0d('0x43')](handleError(_0x3a63e3,null));};exports[_0xcb0d('0x44')]=function(_0x141e6d,_0x609b51){var _0x245987={'raw':![],'where':{'id':_0x141e6d['params']['id']}},_0xc35c8={};_0xc35c8[_0xcb0d('0x2f')]=_[_0xcb0d('0x31')](db[_0xcb0d('0x2d')]['rawAttributes']);_0xc35c8[_0xcb0d('0x30')]=_[_0xcb0d('0x31')](_0x141e6d[_0xcb0d('0x30')]);_0xc35c8['filters']=_[_0xcb0d('0x45')](_0xc35c8[_0xcb0d('0x2f')],_0xc35c8[_0xcb0d('0x30')]);_0x245987[_0xcb0d('0x33')]=_[_0xcb0d('0x45')](_0xc35c8[_0xcb0d('0x2f')],qs[_0xcb0d('0x34')](_0x141e6d[_0xcb0d('0x30')]['fields']));_0x245987['attributes']=_0x245987['attributes'][_0xcb0d('0x35')]?_0x245987[_0xcb0d('0x33')]:_0xc35c8['model'];if(_0x141e6d[_0xcb0d('0x30')][_0xcb0d('0x40')]){_0x245987['include']=[{'all':!![]}];}_0x245987=_['merge']({},_0x245987,_0x141e6d[_0xcb0d('0x3e')]);return db[_0xcb0d('0x2d')][_0xcb0d('0x46')](_0x245987)['then'](handleEntityNotFound(_0x609b51,null))[_0xcb0d('0x28')](respondWithResult(_0x609b51,null))[_0xcb0d('0x43')](handleError(_0x609b51,null));};exports[_0xcb0d('0x47')]=function(_0x1c3eb8,_0x52605d){return db['ZohoAccount']['create'](_0x1c3eb8[_0xcb0d('0x48')],{})[_0xcb0d('0x28')](respondWithResult(_0x52605d,0xc9))['catch'](handleError(_0x52605d,null));};exports[_0xcb0d('0x49')]=function(_0x4ed77e,_0x480714){if(_0x4ed77e[_0xcb0d('0x48')]['id']){delete _0x4ed77e[_0xcb0d('0x48')]['id'];}return db['ZohoAccount'][_0xcb0d('0x46')]({'where':{'id':_0x4ed77e['params']['id']}})[_0xcb0d('0x28')](handleEntityNotFound(_0x480714,null))[_0xcb0d('0x28')](saveUpdates(_0x4ed77e['body'],null))[_0xcb0d('0x28')](respondWithResult(_0x480714,null))[_0xcb0d('0x43')](handleError(_0x480714,null));};exports[_0xcb0d('0x4a')]=function(_0x35852e,_0x52bf36){return db[_0xcb0d('0x2d')][_0xcb0d('0x46')]({'where':{'id':_0x35852e[_0xcb0d('0x4b')]['id']}})[_0xcb0d('0x28')](handleEntityNotFound(_0x52bf36,null))[_0xcb0d('0x28')](removeEntity(_0x52bf36,null))[_0xcb0d('0x43')](handleError(_0x52bf36,null));};exports[_0xcb0d('0x4c')]=function(_0x38eb43,_0x5a05a8,_0x67a652){var _0x49e879={};var _0x17db81={};var _0x1ae2b0;var _0x4cbda1;return db[_0xcb0d('0x2d')][_0xcb0d('0x4d')]({'where':{'id':_0x38eb43[_0xcb0d('0x4b')]['id']}})[_0xcb0d('0x28')](handleEntityNotFound(_0x5a05a8,null))[_0xcb0d('0x28')](function(_0x35f48c){if(_0x35f48c){_0x1ae2b0=_0x35f48c;_0x17db81[_0xcb0d('0x2f')]=_[_0xcb0d('0x31')](db[_0xcb0d('0x4e')][_0xcb0d('0x4f')]);_0x17db81[_0xcb0d('0x30')]=_[_0xcb0d('0x31')](_0x38eb43[_0xcb0d('0x30')]);_0x17db81[_0xcb0d('0x32')]=_[_0xcb0d('0x45')](_0x17db81[_0xcb0d('0x2f')],_0x17db81[_0xcb0d('0x30')]);_0x49e879[_0xcb0d('0x33')]=_[_0xcb0d('0x45')](_0x17db81[_0xcb0d('0x2f')],qs[_0xcb0d('0x34')](_0x38eb43[_0xcb0d('0x30')][_0xcb0d('0x34')]));_0x49e879[_0xcb0d('0x33')]=_0x49e879['attributes'][_0xcb0d('0x35')]?_0x49e879[_0xcb0d('0x33')]:_0x17db81['model'];_0x49e879[_0xcb0d('0x38')]=qs[_0xcb0d('0x39')](_0x38eb43[_0xcb0d('0x30')][_0xcb0d('0x39')]);_0x49e879[_0xcb0d('0x3f')]=qs['filters'](_[_0xcb0d('0x50')](_0x38eb43[_0xcb0d('0x30')],_0x17db81[_0xcb0d('0x32')]));if(_0x38eb43[_0xcb0d('0x30')][_0xcb0d('0x3a')]){_0x49e879[_0xcb0d('0x3f')]=_[_0xcb0d('0x3d')](_0x49e879[_0xcb0d('0x3f')],{'$or':_[_0xcb0d('0x2c')](_0x49e879[_0xcb0d('0x33')],function(_0x47d9e6){var _0x16a4fc={};_0x16a4fc[_0x47d9e6]={'$like':'%'+_0x38eb43[_0xcb0d('0x30')][_0xcb0d('0x3a')]+'%'};return _0x16a4fc;})});}_0x49e879=_[_0xcb0d('0x3d')]({},_0x49e879,_0x38eb43[_0xcb0d('0x3e')]);return _0x1ae2b0['getConfigurations'](_0x49e879);}})[_0xcb0d('0x28')](function(_0x54592b){if(_0x54592b){_0x4cbda1=_0x54592b[_0xcb0d('0x35')];if(!_0x38eb43[_0xcb0d('0x30')][_0xcb0d('0x36')]('nolimit')){_0x49e879['limit']=qs[_0xcb0d('0x22')](_0x38eb43[_0xcb0d('0x30')]['limit']);_0x49e879[_0xcb0d('0x20')]=qs[_0xcb0d('0x20')](_0x38eb43[_0xcb0d('0x30')][_0xcb0d('0x20')]);}return _0x1ae2b0[_0xcb0d('0x4c')](_0x49e879);}})[_0xcb0d('0x28')](function(_0x563723){if(_0x563723){return _0x563723?{'count':_0x4cbda1,'rows':_0x563723}:null;}})['then'](respondWithResult(_0x5a05a8,null))[_0xcb0d('0x43')](handleError(_0x5a05a8,null));};exports['addConfiguration']=function(_0x3b198e,_0x37d2f6,_0x4a2658){if(_0x3b198e[_0xcb0d('0x48')]['id']){delete _0x3b198e[_0xcb0d('0x48')]['id'];}return db['ZohoAccount'][_0xcb0d('0x4d')]({'where':{'id':_0x3b198e['params']['id']}})[_0xcb0d('0x28')](handleEntityNotFound(_0x37d2f6,null))[_0xcb0d('0x28')](function(_0x1cc4b9){if(_0x1cc4b9){_0x3b198e[_0xcb0d('0x48')][_0xcb0d('0x51')]=_0x1cc4b9['id'];_0x3b198e[_0xcb0d('0x48')][_0xcb0d('0x52')]=integrations[_0xcb0d('0x53')](_0x3b198e[_0xcb0d('0x48')][_0xcb0d('0x54')],_0x3b198e[_0xcb0d('0x48')][_0xcb0d('0x3b')]);_0x3b198e['body']['Descriptions']=integrations[_0xcb0d('0x55')](_0x3b198e[_0xcb0d('0x48')]['channel'],_0x3b198e[_0xcb0d('0x48')][_0xcb0d('0x3b')]);return db[_0xcb0d('0x4e')]['create'](_0x3b198e['body'],{'include':[{'model':db[_0xcb0d('0x56')],'as':'Subjects'},{'model':db[_0xcb0d('0x56')],'as':_0xcb0d('0x57')}]});}return null;})[_0xcb0d('0x28')](respondWithResult(_0x37d2f6,null))[_0xcb0d('0x43')](handleError(_0x37d2f6,null));};function getAccessToken(_0x16c4ae){return new Promise(function(_0x4adf5a,_0x5183ab){var _0x2f0a4a;switch(_0x16c4ae[_0xcb0d('0x58')]){case'US':_0x2f0a4a=_0xcb0d('0x59');break;case'AU':_0x2f0a4a=_0xcb0d('0x5a');break;case'EU':_0x2f0a4a=_0xcb0d('0x5b');break;case'IN':_0x2f0a4a=_0xcb0d('0x5c');break;case'CN':_0x2f0a4a='https://accounts.zoho.com.cn';break;default:_0x2f0a4a=_0xcb0d('0x5b');break;}var _0xc6e636={'method':_0xcb0d('0x5d'),'uri':_0x2f0a4a+_0xcb0d('0x5e'),'qs':{'refresh_token':_0x16c4ae['refreshToken'],'client_id':_0x16c4ae[_0xcb0d('0x5f')],'client_secret':_0x16c4ae['clientSecret'],'grant_type':_0xcb0d('0x60')},'json':!![]};return rp(_0xc6e636)[_0xcb0d('0x28')](function(_0x49b422){if(_0x49b422[_0xcb0d('0x61')]){_0x4adf5a(_0x49b422[_0xcb0d('0x61')]);}else{_0x5183ab(_0xcb0d('0x62'));}})[_0xcb0d('0x43')](function(_0x5d6a0b){_0x5183ab(_0x5d6a0b);});});}exports['getFields']=function(_0x3972a2,_0x4d9f5e,_0x2bc1d9){var _0x475dc0,_0x46b55c,_0x4dc1b7,_0x4ded2c,_0x591c40;return db[_0xcb0d('0x2d')][_0xcb0d('0x4d')]({'where':{'id':_0x3972a2[_0xcb0d('0x4b')]['id']},'attributes':['id','host',_0xcb0d('0x58'),_0xcb0d('0x5f'),_0xcb0d('0x63'),_0xcb0d('0x64'),_0xcb0d('0x65'),_0xcb0d('0x66')]})['then'](handleEntityNotFound(_0x4d9f5e,null))[_0xcb0d('0x28')](function(_0x312ac5){_0x591c40=_0x312ac5;_0x475dc0=_0x591c40[_0xcb0d('0x67')];_0x46b55c=_0x475dc0===_0xcb0d('0x68')?'eu':_0xcb0d('0x69');_0x4dc1b7=_0x591c40[_0xcb0d('0x64')];var _0x54e5ed=_0x4dc1b7[_0xcb0d('0x6a')](-0x1);if(_0x54e5ed==='/'||_0x54e5ed==='\x5c'||_0x54e5ed===':'){_0x4dc1b7=_0x4dc1b7[_0xcb0d('0x6b')](0x0,_0x4dc1b7[_0xcb0d('0x6c')](_0x54e5ed));}if(!_0x591c40[_0xcb0d('0x66')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x591c40);})[_0xcb0d('0x28')](function(_0x550db2){if(_0x550db2){return rp({'method':_0xcb0d('0x6d'),'uri':util[_0xcb0d('0x6e')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x46b55c),'qs':{'module':'Calls'},'headers':{'Authorization':_0xcb0d('0x6f')+_0x550db2},'json':!![]});}})[_0xcb0d('0x28')](function(_0x43a6d1){if(_0x43a6d1){if(_0x43a6d1[_0xcb0d('0x70')]&&_0x43a6d1['response'][_0xcb0d('0x71')]){throw new Error(_0x43a6d1[_0xcb0d('0x70')][_0xcb0d('0x71')][_0xcb0d('0x72')]);}var _0x24c46f=[];var _0x227202=[];var _0x5935a3=[_0xcb0d('0x73'),_0xcb0d('0x74'),_0xcb0d('0x75'),_0xcb0d('0x76'),_0xcb0d('0x77'),'Call_Result','Call_Start_Time',_0xcb0d('0x78')];_0x227202=_['remove'](_0x43a6d1[_0xcb0d('0x34')],function(_0x30b9bb){return _0x5935a3[_0xcb0d('0x79')](_0x30b9bb[_0xcb0d('0x7a')]);});for(var _0x3d6652=0x0;_0x3d6652<_0x227202[_0xcb0d('0x35')];_0x3d6652++){if(_0x227202[_0x3d6652][_0xcb0d('0x7b')]===![]){_0x24c46f[_0xcb0d('0x7c')]({'id':_0x227202[_0x3d6652]['id'],'name':_0x227202[_0x3d6652][_0xcb0d('0x7d')],'custom':_0x227202[_0x3d6652][_0xcb0d('0x7e')],'options':_0x227202[_0x3d6652][_0xcb0d('0x7f')]===_0xcb0d('0x80')&&_0x227202[_0x3d6652]['pick_list_values'][_0xcb0d('0x35')]>-0x1?_[_0xcb0d('0x2c')](_0x227202[_0x3d6652]['pick_list_values'],function(_0x1f7ba5){return{'name':_0x1f7ba5,'value':_0x1f7ba5};}):[]});}}return{'count':_0x24c46f[_0xcb0d('0x35')],'rows':_0x24c46f};}else{return{'count':0x0,'rows':[]};}})[_0xcb0d('0x28')](respondWithResult(_0x4d9f5e,null))[_0xcb0d('0x43')](function(_0x384754){var _0xd502fe=_0x3972a2[_0xcb0d('0x30')][_0xcb0d('0x81')]?0x1f4:_0x384754[_0xcb0d('0x82')]||0x1f4;logger[_0xcb0d('0x71')](_0xcb0d('0x83'),'getFields',_0xd502fe,JSON[_0xcb0d('0x84')](_0x384754));delete _0x384754['name'];if(_0xd502fe===0x191){_0xd502fe=0x190;}_0x4d9f5e[_0xcb0d('0x1d')](_0xd502fe)[_0xcb0d('0x2b')](_0x3972a2[_0xcb0d('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x384754['statusCode']}:_0x384754);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 73f128a..0f95840 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 _0xf741=['then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','https://accounts.zoho.eu','POST','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','slice','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded'];(function(_0x38a2a9,_0xb5ecd5){var _0x3d7053=function(_0x5c1412){while(--_0x5c1412){_0x38a2a9['push'](_0x38a2a9['shift']());}};_0x3d7053(++_0xb5ecd5);}(_0xf741,0xb6));var _0x1f74=function(_0x1a085b,_0x28fd55){_0x1a085b=_0x1a085b-0x0;var _0xacff4=_0xf741[_0x1a085b];return _0xacff4;};'use strict';var _=require(_0x1f74('0x0'));var util=require(_0x1f74('0x1'));var logger=require(_0x1f74('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f74('0x3'));var rp=require(_0x1f74('0x4'));var fs=require('fs');var path=require(_0x1f74('0x5'));var rimraf=require('rimraf');var config=require(_0x1f74('0x6'));var attributes=require(_0x1f74('0x7'));var integrations=require(_0x1f74('0x8'));module[_0x1f74('0x9')]=function(_0x55ed9a,_0x2b8adb){return _0x55ed9a[_0x1f74('0xa')](_0x1f74('0xb'),attributes,{'tableName':_0x1f74('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xbceb4b,_0xe9de29,_0xf89f62){if(_0xbceb4b[_0x1f74('0xd')]('zone')||_0xbceb4b[_0x1f74('0xd')](_0x1f74('0xe'))||_0xbceb4b[_0x1f74('0xd')](_0x1f74('0xf'))||_0xbceb4b[_0x1f74('0xd')](_0x1f74('0x10'))||_0xbceb4b[_0x1f74('0xd')](_0x1f74('0x11'))||_0xbceb4b[_0x1f74('0xd')]('host')){var _0x5bc0b5,_0x2e872e;_0x5bc0b5=_0xbceb4b[_0x1f74('0xe')];var _0x422f2d=_0x5bc0b5[_0x1f74('0x12')](-0x1);if(_0x422f2d==='/'||_0x422f2d==='\x5c'||_0x422f2d===':'){_0x5bc0b5=_0x5bc0b5['substring'](0x0,_0x5bc0b5[_0x1f74('0x13')](_0x422f2d));}switch(_0xbceb4b[_0x1f74('0x14')]){case'US':_0x2e872e=_0x1f74('0x15');break;case'AU':_0x2e872e=_0x1f74('0x16');break;case'IN':_0x2e872e=_0x1f74('0x17');break;case'CN':_0x2e872e=_0x1f74('0x18');break;default:_0x2e872e='https://accounts.zoho.eu';break;}var _0x20058e={'method':'POST','uri':_0x2e872e+_0x1f74('0x19'),'form':{'grant_type':_0x1f74('0x1a'),'client_id':_0xbceb4b['clientId'],'client_secret':_0xbceb4b[_0x1f74('0x10')],'redirect_uri':_0xbceb4b[_0x1f74('0xe')],'code':_0xbceb4b[_0x1f74('0x11')]},'headers':{'Content-Type':_0x1f74('0x1b')}};return rp(_0x20058e)[_0x1f74('0x1c')](function(_0x13dfd4){var _0x17d0bd=JSON[_0x1f74('0x1d')](_0x13dfd4);if(_0x17d0bd[_0x1f74('0x1e')]){_0xbceb4b[_0x1f74('0x1f')]=_0x17d0bd['refresh_token'];logger[_0x1f74('0x20')](util[_0x1f74('0x21')](_0x1f74('0x22'),_0xbceb4b[_0x1f74('0x23')],_0xbceb4b['id']));}else{logger[_0x1f74('0x24')](util[_0x1f74('0x21')](_0x1f74('0x25'),_0xbceb4b['name'],_0xbceb4b['id']),util[_0x1f74('0x26')](_0x17d0bd,{'showHidden':![],'depth':null}));}return _0xf89f62(null,_0xe9de29);})['catch'](function(_0x4e6482){logger[_0x1f74('0x24')](util[_0x1f74('0x21')](_0x1f74('0x25'),_0xbceb4b[_0x1f74('0x23')],_0xbceb4b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xf89f62(_0x4e6482);});}else{return _0xf89f62(null,_0xe9de29);}},'beforeUpdate':function(_0xb91528,_0x7ef73,_0x5cfb44){if(_0xb91528[_0x1f74('0xd')](_0x1f74('0x14'))||_0xb91528[_0x1f74('0xd')](_0x1f74('0xe'))||_0xb91528[_0x1f74('0xd')](_0x1f74('0xf'))||_0xb91528['changed']('clientSecret')||_0xb91528[_0x1f74('0xd')]('code')||_0xb91528[_0x1f74('0xd')]('host')){var _0x47bb56,_0x303df0;_0x47bb56=_0xb91528[_0x1f74('0xe')];var _0x319178=_0x47bb56[_0x1f74('0x12')](-0x1);if(_0x319178==='/'||_0x319178==='\x5c'||_0x319178===':'){_0x47bb56=_0x47bb56[_0x1f74('0x27')](0x0,_0x47bb56['lastIndexOf'](_0x319178));}switch(_0xb91528[_0x1f74('0x14')]){case'US':_0x303df0='https://accounts.zoho.com';break;case'AU':_0x303df0=_0x1f74('0x16');break;case'IN':_0x303df0=_0x1f74('0x17');break;case'CN':_0x303df0=_0x1f74('0x18');break;default:_0x303df0=_0x1f74('0x28');break;}var _0x30c2bc={'method':_0x1f74('0x29'),'uri':_0x303df0+_0x1f74('0x19'),'form':{'grant_type':'authorization_code','client_id':_0xb91528[_0x1f74('0xf')],'client_secret':_0xb91528['clientSecret'],'redirect_uri':_0xb91528['serverUrl'],'code':_0xb91528[_0x1f74('0x11')]},'headers':{'Content-Type':_0x1f74('0x1b')}};return rp(_0x30c2bc)[_0x1f74('0x1c')](function(_0x420f85){var _0x2451ad=JSON['parse'](_0x420f85);if(_0x2451ad[_0x1f74('0x1e')]){_0xb91528[_0x1f74('0x1f')]=_0x2451ad[_0x1f74('0x1e')];logger['info'](util[_0x1f74('0x21')](_0x1f74('0x22'),_0xb91528[_0x1f74('0x23')],_0xb91528['id']));}else{logger['error'](util[_0x1f74('0x21')](_0x1f74('0x25'),_0xb91528[_0x1f74('0x23')],_0xb91528['id']),util[_0x1f74('0x26')](_0x2451ad,{'showHidden':![],'depth':null}));}return _0x5cfb44(null,_0x7ef73);})['catch'](function(_0x5b6add){logger[_0x1f74('0x24')](util['format'](_0x1f74('0x25'),_0xb91528['name'],_0xb91528['id']),util[_0x1f74('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x5cfb44(_0x5b6add);});}else{return _0x5cfb44(null,_0x7ef73);}}}});}; \ No newline at end of file +var _0x65c9=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','substring','https://accounts.zoho.eu','authorization_code','parse','catch','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice'];(function(_0x4c15fb,_0x58cd63){var _0x43fb51=function(_0x52d63b){while(--_0x52d63b){_0x4c15fb['push'](_0x4c15fb['shift']());}};_0x43fb51(++_0x58cd63);}(_0x65c9,0x152));var _0x965c=function(_0x147625,_0x142960){_0x147625=_0x147625-0x0;var _0x23824e=_0x65c9[_0x147625];return _0x23824e;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var logger=require(_0x965c('0x2'))(_0x965c('0x3'));var moment=require('moment');var BPromise=require(_0x965c('0x4'));var rp=require(_0x965c('0x5'));var fs=require('fs');var path=require(_0x965c('0x6'));var rimraf=require(_0x965c('0x7'));var config=require(_0x965c('0x8'));var attributes=require(_0x965c('0x9'));var integrations=require(_0x965c('0xa'));module[_0x965c('0xb')]=function(_0x3fefa5,_0x56238b){return _0x3fefa5[_0x965c('0xc')](_0x965c('0xd'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d900e,_0x1b98e2,_0x441cb0){if(_0x3d900e[_0x965c('0xe')](_0x965c('0xf'))||_0x3d900e[_0x965c('0xe')](_0x965c('0x10'))||_0x3d900e['changed'](_0x965c('0x11'))||_0x3d900e[_0x965c('0xe')](_0x965c('0x12'))||_0x3d900e['changed'](_0x965c('0x13'))||_0x3d900e[_0x965c('0xe')](_0x965c('0x14'))){var _0x2cfb31,_0x200197;_0x2cfb31=_0x3d900e['serverUrl'];var _0x203162=_0x2cfb31[_0x965c('0x15')](-0x1);if(_0x203162==='/'||_0x203162==='\x5c'||_0x203162===':'){_0x2cfb31=_0x2cfb31['substring'](0x0,_0x2cfb31[_0x965c('0x16')](_0x203162));}switch(_0x3d900e[_0x965c('0xf')]){case'US':_0x200197=_0x965c('0x17');break;case'AU':_0x200197=_0x965c('0x18');break;case'IN':_0x200197=_0x965c('0x19');break;case'CN':_0x200197=_0x965c('0x1a');break;default:_0x200197='https://accounts.zoho.eu';break;}var _0x57b802={'method':_0x965c('0x1b'),'uri':_0x200197+_0x965c('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x3d900e[_0x965c('0x11')],'client_secret':_0x3d900e['clientSecret'],'redirect_uri':_0x3d900e[_0x965c('0x10')],'code':_0x3d900e[_0x965c('0x13')]},'headers':{'Content-Type':_0x965c('0x1d')}};return rp(_0x57b802)[_0x965c('0x1e')](function(_0x3f3919){var _0x2bb523=JSON['parse'](_0x3f3919);if(_0x2bb523[_0x965c('0x1f')]){_0x3d900e[_0x965c('0x20')]=_0x2bb523[_0x965c('0x1f')];logger[_0x965c('0x21')](util[_0x965c('0x22')](_0x965c('0x23'),_0x3d900e[_0x965c('0x24')],_0x3d900e['id']));}else{logger['error'](util[_0x965c('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3d900e[_0x965c('0x24')],_0x3d900e['id']),util[_0x965c('0x25')](_0x2bb523,{'showHidden':![],'depth':null}));}return _0x441cb0(null,_0x1b98e2);})['catch'](function(_0x2b3415){logger[_0x965c('0x26')](util[_0x965c('0x22')](_0x965c('0x27'),_0x3d900e[_0x965c('0x24')],_0x3d900e['id']),util[_0x965c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x441cb0(_0x2b3415);});}else{return _0x441cb0(null,_0x1b98e2);}},'beforeUpdate':function(_0x593a77,_0x284ad0,_0x3b7c1d){if(_0x593a77['changed'](_0x965c('0xf'))||_0x593a77[_0x965c('0xe')](_0x965c('0x10'))||_0x593a77['changed'](_0x965c('0x11'))||_0x593a77[_0x965c('0xe')](_0x965c('0x12'))||_0x593a77[_0x965c('0xe')]('code')||_0x593a77['changed'](_0x965c('0x14'))){var _0x4bbf81,_0x42f2d4;_0x4bbf81=_0x593a77['serverUrl'];var _0x3330c5=_0x4bbf81['slice'](-0x1);if(_0x3330c5==='/'||_0x3330c5==='\x5c'||_0x3330c5===':'){_0x4bbf81=_0x4bbf81[_0x965c('0x28')](0x0,_0x4bbf81[_0x965c('0x16')](_0x3330c5));}switch(_0x593a77[_0x965c('0xf')]){case'US':_0x42f2d4='https://accounts.zoho.com';break;case'AU':_0x42f2d4=_0x965c('0x18');break;case'IN':_0x42f2d4='https://accounts.zoho.in';break;case'CN':_0x42f2d4=_0x965c('0x1a');break;default:_0x42f2d4=_0x965c('0x29');break;}var _0x55ea67={'method':_0x965c('0x1b'),'uri':_0x42f2d4+_0x965c('0x1c'),'form':{'grant_type':_0x965c('0x2a'),'client_id':_0x593a77['clientId'],'client_secret':_0x593a77[_0x965c('0x12')],'redirect_uri':_0x593a77[_0x965c('0x10')],'code':_0x593a77[_0x965c('0x13')]},'headers':{'Content-Type':_0x965c('0x1d')}};return rp(_0x55ea67)[_0x965c('0x1e')](function(_0x1e17a0){var _0x431030=JSON[_0x965c('0x2b')](_0x1e17a0);if(_0x431030[_0x965c('0x1f')]){_0x593a77[_0x965c('0x20')]=_0x431030[_0x965c('0x1f')];logger[_0x965c('0x21')](util[_0x965c('0x22')](_0x965c('0x23'),_0x593a77[_0x965c('0x24')],_0x593a77['id']));}else{logger[_0x965c('0x26')](util[_0x965c('0x22')](_0x965c('0x27'),_0x593a77[_0x965c('0x24')],_0x593a77['id']),util['inspect'](_0x431030,{'showHidden':![],'depth':null}));}return _0x3b7c1d(null,_0x284ad0);})[_0x965c('0x2c')](function(_0xe2ce1d){logger[_0x965c('0x26')](util[_0x965c('0x22')](_0x965c('0x27'),_0x593a77[_0x965c('0x24')],_0x593a77['id']),util[_0x965c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3b7c1d(_0xe2ce1d);});}else{return _0x3b7c1d(null,_0x284ad0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index e63f649..ad6f4d6 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 _0x6372=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','ZohoAccount','findAll','options','raw','attributes','include','map','model','GetZohoAccount','ShowZohoAccount','find','where','lodash','moment'];(function(_0x5da21c,_0x340f8b){var _0x3b72fa=function(_0x3aae43){while(--_0x3aae43){_0x5da21c['push'](_0x5da21c['shift']());}};_0x3b72fa(++_0x340f8b);}(_0x6372,0x1b8));var _0x2637=function(_0x2cc3c1,_0xa43650){_0x2cc3c1=_0x2cc3c1-0x0;var _0x4c4f66=_0x6372[_0x2cc3c1];return _0x4c4f66;};'use strict';var _=require(_0x2637('0x0'));var util=require('util');var moment=require(_0x2637('0x1'));var BPromise=require('bluebird');var rs=require(_0x2637('0x2'));var fs=require('fs');var Redis=require(_0x2637('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2637('0x4'));var logger=require(_0x2637('0x5'))(_0x2637('0x6'));var config=require(_0x2637('0x7'));var jayson=require(_0x2637('0x8'));var client=jayson['client'][_0x2637('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54bdd1,_0x4f8521,_0x49383d){return new BPromise(function(_0x30abde,_0x5a4748){return client['request'](_0x54bdd1,_0x49383d)[_0x2637('0xa')](function(_0x2dbcb5){logger[_0x2637('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x4f8521,'request\x20sent');logger[_0x2637('0xc')](_0x2637('0xd'),_0x4f8521,_0x2637('0xe'),JSON[_0x2637('0xf')](_0x2dbcb5));if(_0x2dbcb5[_0x2637('0x10')]){if(_0x2dbcb5[_0x2637('0x10')][_0x2637('0x11')]===0x1f4){logger[_0x2637('0x10')](_0x2637('0x12'),_0x4f8521,_0x2dbcb5['error'][_0x2637('0x13')]);return _0x5a4748(_0x2dbcb5[_0x2637('0x10')][_0x2637('0x13')]);}logger['error'](_0x2637('0x12'),_0x4f8521,_0x2dbcb5[_0x2637('0x10')][_0x2637('0x13')]);return _0x30abde(_0x2dbcb5[_0x2637('0x10')]['message']);}else{logger[_0x2637('0xb')](_0x2637('0x12'),_0x4f8521,_0x2637('0xe'));_0x30abde(_0x2dbcb5[_0x2637('0x14')][_0x2637('0x13')]);}})[_0x2637('0x15')](function(_0x567d3c){logger['error'](_0x2637('0x12'),_0x4f8521,_0x567d3c);_0x5a4748(_0x567d3c);});});}exports['GetZohoAccount']=function(_0x4f44d7){var _0x3dcb2e=this;return new Promise(function(_0x1e9598,_0x4d3266){return db[_0x2637('0x16')][_0x2637('0x17')]({'raw':_0x4f44d7[_0x2637('0x18')]?_0x4f44d7['options'][_0x2637('0x19')]===undefined?!![]:![]:!![],'where':_0x4f44d7[_0x2637('0x18')]?_0x4f44d7[_0x2637('0x18')]['where']||null:null,'attributes':_0x4f44d7[_0x2637('0x18')]?_0x4f44d7[_0x2637('0x18')][_0x2637('0x1a')]||null:null,'limit':_0x4f44d7['options']?_0x4f44d7[_0x2637('0x18')]['limit']||null:null,'include':_0x4f44d7[_0x2637('0x18')]?_0x4f44d7[_0x2637('0x18')][_0x2637('0x1b')]?_['map'](_0x4f44d7['options'][_0x2637('0x1b')],function(_0x5e6d31){return{'model':db[_0x5e6d31['model']],'as':_0x5e6d31['as'],'attributes':_0x5e6d31['attributes'],'include':_0x5e6d31[_0x2637('0x1b')]?_[_0x2637('0x1c')](_0x5e6d31[_0x2637('0x1b')],function(_0x3d3bd9){return{'model':db[_0x3d3bd9[_0x2637('0x1d')]],'as':_0x3d3bd9['as'],'attributes':_0x3d3bd9[_0x2637('0x1a')],'include':_0x3d3bd9[_0x2637('0x1b')]?_[_0x2637('0x1c')](_0x3d3bd9['include'],function(_0x13a4a8){return{'model':db[_0x13a4a8[_0x2637('0x1d')]],'as':_0x13a4a8['as'],'attributes':_0x13a4a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2637('0xa')](function(_0x2d3f28){logger[_0x2637('0xb')](_0x2637('0x1e'),_0x4f44d7);logger['debug'](_0x2637('0x1e'),_0x4f44d7,JSON[_0x2637('0xf')](_0x2d3f28));_0x1e9598(_0x2d3f28);})[_0x2637('0x15')](function(_0x27f326){logger[_0x2637('0x10')]('GetZohoAccount',_0x27f326['message'],_0x4f44d7);_0x4d3266(_0x3dcb2e[_0x2637('0x10')](0x1f4,_0x27f326['message']));});});};exports[_0x2637('0x1f')]=function(_0xaa5292){var _0x2d1628=this;return new Promise(function(_0x39fd9e,_0x40e343){return db[_0x2637('0x16')][_0x2637('0x20')]({'raw':_0xaa5292[_0x2637('0x18')]?_0xaa5292[_0x2637('0x18')][_0x2637('0x19')]===undefined?!![]:![]:!![],'where':_0xaa5292[_0x2637('0x18')]?_0xaa5292[_0x2637('0x18')][_0x2637('0x21')]||null:null,'attributes':_0xaa5292[_0x2637('0x18')]?_0xaa5292[_0x2637('0x18')][_0x2637('0x1a')]||null:null,'include':_0xaa5292[_0x2637('0x18')]?_0xaa5292['options'][_0x2637('0x1b')]?_[_0x2637('0x1c')](_0xaa5292['options']['include'],function(_0x3b4a0f){return{'model':db[_0x3b4a0f[_0x2637('0x1d')]],'as':_0x3b4a0f['as'],'attributes':_0x3b4a0f[_0x2637('0x1a')],'include':_0x3b4a0f[_0x2637('0x1b')]?_[_0x2637('0x1c')](_0x3b4a0f[_0x2637('0x1b')],function(_0x3107e5){return{'model':db[_0x3107e5[_0x2637('0x1d')]],'as':_0x3107e5['as'],'attributes':_0x3107e5[_0x2637('0x1a')],'include':_0x3107e5[_0x2637('0x1b')]?_[_0x2637('0x1c')](_0x3107e5[_0x2637('0x1b')],function(_0x4bdb3c){return{'model':db[_0x4bdb3c[_0x2637('0x1d')]],'as':_0x4bdb3c['as'],'attributes':_0x4bdb3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2637('0xa')](function(_0x44b93b){logger[_0x2637('0xb')](_0x2637('0x1f'),_0xaa5292);logger[_0x2637('0xc')](_0x2637('0x1f'),_0xaa5292,JSON[_0x2637('0xf')](_0x44b93b));_0x39fd9e(_0x44b93b);})[_0x2637('0x15')](function(_0x31df33){logger[_0x2637('0x10')](_0x2637('0x1f'),_0x31df33[_0x2637('0x13')],_0xaa5292);_0x40e343(_0x2d1628[_0x2637('0x10')](0x1f4,_0x31df33[_0x2637('0x13')]));});});}; \ No newline at end of file +var _0xb5fb=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','GetZohoAccount','findAll','options','where','limit','map','include','model','attributes','then','ShowZohoAccount','ZohoAccount','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xd1f099,_0x48a728){var _0x5db86d=function(_0x81c62f){while(--_0x81c62f){_0xd1f099['push'](_0xd1f099['shift']());}};_0x5db86d(++_0x48a728);}(_0xb5fb,0x172));var _0xbb5f=function(_0x7d5b1b,_0x20e692){_0x7d5b1b=_0x7d5b1b-0x0;var _0x51988c=_0xb5fb[_0x7d5b1b];return _0x51988c;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var moment=require(_0xbb5f('0x2'));var BPromise=require(_0xbb5f('0x3'));var rs=require(_0xbb5f('0x4'));var fs=require('fs');var Redis=require(_0xbb5f('0x5'));var db=require(_0xbb5f('0x6'))['db'];var utils=require(_0xbb5f('0x7'));var logger=require(_0xbb5f('0x8'))(_0xbb5f('0x9'));var config=require(_0xbb5f('0xa'));var jayson=require(_0xbb5f('0xb'));var client=jayson[_0xbb5f('0xc')][_0xbb5f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x487a1a,_0x597050,_0x317cd9){return new BPromise(function(_0x5e7943,_0x5b91){return client[_0xbb5f('0xe')](_0x487a1a,_0x317cd9)['then'](function(_0x4f13a9){logger[_0xbb5f('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x597050,_0xbb5f('0x10'));logger[_0xbb5f('0x11')](_0xbb5f('0x12'),_0x597050,_0xbb5f('0x10'),JSON[_0xbb5f('0x13')](_0x4f13a9));if(_0x4f13a9[_0xbb5f('0x14')]){if(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x15')]===0x1f4){logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9['error'][_0xbb5f('0x17')]);return _0x5b91(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9[_0xbb5f('0x14')]['message']);return _0x5e7943(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}else{logger[_0xbb5f('0xf')](_0xbb5f('0x16'),_0x597050,'request\x20sent');_0x5e7943(_0x4f13a9['result'][_0xbb5f('0x17')]);}})['catch'](function(_0xdf4ec8){logger[_0xbb5f('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x597050,_0xdf4ec8);_0x5b91(_0xdf4ec8);});});}exports[_0xbb5f('0x18')]=function(_0x4cc050){var _0x313a0e=this;return new Promise(function(_0xca33c1,_0x5944f9){return db['ZohoAccount'][_0xbb5f('0x19')]({'raw':_0x4cc050[_0xbb5f('0x1a')]?_0x4cc050[_0xbb5f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4cc050[_0xbb5f('0x1a')]?_0x4cc050['options'][_0xbb5f('0x1b')]||null:null,'attributes':_0x4cc050[_0xbb5f('0x1a')]?_0x4cc050[_0xbb5f('0x1a')]['attributes']||null:null,'limit':_0x4cc050[_0xbb5f('0x1a')]?_0x4cc050['options'][_0xbb5f('0x1c')]||null:null,'include':_0x4cc050['options']?_0x4cc050[_0xbb5f('0x1a')]['include']?_[_0xbb5f('0x1d')](_0x4cc050['options'][_0xbb5f('0x1e')],function(_0xb35efe){return{'model':db[_0xb35efe[_0xbb5f('0x1f')]],'as':_0xb35efe['as'],'attributes':_0xb35efe['attributes'],'include':_0xb35efe[_0xbb5f('0x1e')]?_['map'](_0xb35efe['include'],function(_0x41be1c){return{'model':db[_0x41be1c[_0xbb5f('0x1f')]],'as':_0x41be1c['as'],'attributes':_0x41be1c[_0xbb5f('0x20')],'include':_0x41be1c[_0xbb5f('0x1e')]?_[_0xbb5f('0x1d')](_0x41be1c[_0xbb5f('0x1e')],function(_0x150e10){return{'model':db[_0x150e10[_0xbb5f('0x1f')]],'as':_0x150e10['as'],'attributes':_0x150e10[_0xbb5f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbb5f('0x21')](function(_0xa87ebb){logger[_0xbb5f('0xf')](_0xbb5f('0x18'),_0x4cc050);logger[_0xbb5f('0x11')](_0xbb5f('0x18'),_0x4cc050,JSON[_0xbb5f('0x13')](_0xa87ebb));_0xca33c1(_0xa87ebb);})['catch'](function(_0x5a2f1a){logger[_0xbb5f('0x14')](_0xbb5f('0x18'),_0x5a2f1a['message'],_0x4cc050);_0x5944f9(_0x313a0e[_0xbb5f('0x14')](0x1f4,_0x5a2f1a['message']));});});};exports[_0xbb5f('0x22')]=function(_0x30641a){var _0xa2adf2=this;return new Promise(function(_0x24e8c2,_0x22d528){return db[_0xbb5f('0x23')]['find']({'raw':_0x30641a[_0xbb5f('0x1a')]?_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x24')]===undefined?!![]:![]:!![],'where':_0x30641a[_0xbb5f('0x1a')]?_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x1b')]||null:null,'attributes':_0x30641a[_0xbb5f('0x1a')]?_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x20')]||null:null,'include':_0x30641a[_0xbb5f('0x1a')]?_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x1e')]?_['map'](_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x1e')],function(_0x543b0e){return{'model':db[_0x543b0e[_0xbb5f('0x1f')]],'as':_0x543b0e['as'],'attributes':_0x543b0e['attributes'],'include':_0x543b0e[_0xbb5f('0x1e')]?_['map'](_0x543b0e['include'],function(_0x25c061){return{'model':db[_0x25c061[_0xbb5f('0x1f')]],'as':_0x25c061['as'],'attributes':_0x25c061[_0xbb5f('0x20')],'include':_0x25c061[_0xbb5f('0x1e')]?_[_0xbb5f('0x1d')](_0x25c061[_0xbb5f('0x1e')],function(_0x7769fe){return{'model':db[_0x7769fe[_0xbb5f('0x1f')]],'as':_0x7769fe['as'],'attributes':_0x7769fe[_0xbb5f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbb5f('0x21')](function(_0x2eb51a){logger[_0xbb5f('0xf')](_0xbb5f('0x22'),_0x30641a);logger['debug'](_0xbb5f('0x22'),_0x30641a,JSON[_0xbb5f('0x13')](_0x2eb51a));_0x24e8c2(_0x2eb51a);})[_0xbb5f('0x25')](function(_0x39a895){logger['error'](_0xbb5f('0x22'),_0x39a895['message'],_0x30641a);_0x22d528(_0xa2adf2[_0xbb5f('0x14')](0x1f4,_0x39a895[_0xbb5f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 54bb7a9..3fccba1 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 _0x07dd=['isAuthenticated','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xcd3d34,_0x5a5acc){var _0x490679=function(_0x4cf368){while(--_0x4cf368){_0xcd3d34['push'](_0xcd3d34['shift']());}};_0x490679(++_0x5a5acc);}(_0x07dd,0x1c4));var _0xd07d=function(_0xa07178,_0x3e6d1c){_0xa07178=_0xa07178-0x0;var _0x2e4eb9=_0x07dd[_0xa07178];return _0x2e4eb9;};'use strict';var multer=require('multer');var util=require(_0xd07d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd07d('0x1'));var router=express[_0xd07d('0x2')]();var fs_extra=require(_0xd07d('0x3'));var auth=require(_0xd07d('0x4'));var interaction=require(_0xd07d('0x5'));var config=require(_0xd07d('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xd07d('0x7')]('/',auth[_0xd07d('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd07d('0x7')](_0xd07d('0x9'),auth[_0xd07d('0x8')](),controller['getFields']);router[_0xd07d('0x7')](_0xd07d('0xa'),auth[_0xd07d('0x8')](),controller['getSubjects']);router['get'](_0xd07d('0xb'),auth[_0xd07d('0x8')](),controller[_0xd07d('0xc')]);router[_0xd07d('0xd')]('/',auth['isAuthenticated'](),controller[_0xd07d('0xe')]);router[_0xd07d('0xf')](_0xd07d('0x10'),auth[_0xd07d('0x8')](),controller[_0xd07d('0x11')]);router[_0xd07d('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd07d('0x13')]=router; \ No newline at end of file +var _0xd863=['/:id/fields','getFields','/:id/subjects','getSubjects','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x387862,_0x3c5c4e){var _0x16d405=function(_0x113b00){while(--_0x113b00){_0x387862['push'](_0x387862['shift']());}};_0x16d405(++_0x3c5c4e);}(_0xd863,0x168));var _0x3d86=function(_0x9d7399,_0x3765c8){_0x9d7399=_0x9d7399-0x0;var _0x4200d4=_0xd863[_0x9d7399];return _0x4200d4;};'use strict';var multer=require(_0x3d86('0x0'));var util=require(_0x3d86('0x1'));var path=require(_0x3d86('0x2'));var timeout=require(_0x3d86('0x3'));var express=require(_0x3d86('0x4'));var router=express[_0x3d86('0x5')]();var fs_extra=require(_0x3d86('0x6'));var auth=require(_0x3d86('0x7'));var interaction=require(_0x3d86('0x8'));var config=require(_0x3d86('0x9'));var controller=require(_0x3d86('0xa'));router[_0x3d86('0xb')]('/',auth[_0x3d86('0xc')](),controller[_0x3d86('0xd')]);router['get'](_0x3d86('0xe'),auth[_0x3d86('0xc')](),controller['show']);router['get'](_0x3d86('0xf'),auth[_0x3d86('0xc')](),controller[_0x3d86('0x10')]);router[_0x3d86('0xb')](_0x3d86('0x11'),auth[_0x3d86('0xc')](),controller[_0x3d86('0x12')]);router[_0x3d86('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3d86('0x13')]('/',auth[_0x3d86('0xc')](),controller['create']);router[_0x3d86('0x14')]('/:id',auth[_0x3d86('0xc')](),controller[_0x3d86('0x15')]);router[_0x3d86('0x16')](_0x3d86('0xe'),auth[_0x3d86('0xc')](),controller[_0x3d86('0x17')]);module[_0x3d86('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e4d9ca0..90df39d 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 _0x7dd1=['nothing','lead','contact_lead','exports','STRING','ENUM','contact'];(function(_0x35d900,_0x30044e){var _0x154e19=function(_0x528bd4){while(--_0x528bd4){_0x35d900['push'](_0x35d900['shift']());}};_0x154e19(++_0x30044e);}(_0x7dd1,0xf1));var _0x17dd=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x7dd1[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require('sequelize');module[_0x17dd('0x0')]={'name':{'type':Sequelize[_0x17dd('0x1')]},'moduleCreate':{'type':Sequelize[_0x17dd('0x2')]('lead',_0x17dd('0x3'),_0x17dd('0x4')),'defaultValue':_0x17dd('0x5')},'moduleSearch':{'type':Sequelize[_0x17dd('0x2')](_0x17dd('0x6'),_0x17dd('0x3'),'lead'),'defaultValue':_0x17dd('0x6')},'description':{'type':Sequelize[_0x17dd('0x1')]}}; \ No newline at end of file +var _0x3fff=['STRING','ENUM','nothing','lead','contact_lead','contact','exports'];(function(_0xe2bfc7,_0x2d0fb8){var _0x453bde=function(_0x2a8d51){while(--_0x2a8d51){_0xe2bfc7['push'](_0xe2bfc7['shift']());}};_0x453bde(++_0x2d0fb8);}(_0x3fff,0x68));var _0xf3ff=function(_0x17632f,_0x242f62){_0x17632f=_0x17632f-0x0;var _0x10e18d=_0x3fff[_0x17632f];return _0x10e18d;};'use strict';var Sequelize=require('sequelize');module[_0xf3ff('0x0')]={'name':{'type':Sequelize[_0xf3ff('0x1')]},'moduleCreate':{'type':Sequelize[_0xf3ff('0x2')]('lead','contact',_0xf3ff('0x3')),'defaultValue':_0xf3ff('0x4')},'moduleSearch':{'type':Sequelize[_0xf3ff('0x2')](_0xf3ff('0x5'),_0xf3ff('0x6'),_0xf3ff('0x4')),'defaultValue':_0xf3ff('0x5')},'description':{'type':Sequelize[_0xf3ff('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1e827ce..d573f50 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 _0x05b0=['order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','ZohoConfiguration','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','rawAttributes','length','includeAll','find','catch','create','body','update','params','getFields','findOne','ZohoField'];(function(_0x274019,_0x33d2c5){var _0x52169e=function(_0x2783dc){while(--_0x2783dc){_0x274019['push'](_0x274019['shift']());}};_0x52169e(++_0x33d2c5);}(_0x05b0,0x1e9));var _0x005b=function(_0x2f2e97,_0x222107){_0x2f2e97=_0x2f2e97-0x0;var _0x53fd00=_0x05b0[_0x2f2e97];return _0x53fd00;};'use strict';var emlformat=require(_0x005b('0x0'));var rimraf=require(_0x005b('0x1'));var zipdir=require(_0x005b('0x2'));var jsonpatch=require(_0x005b('0x3'));var rp=require(_0x005b('0x4'));var moment=require('moment');var BPromise=require(_0x005b('0x5'));var Mustache=require('mustache');var util=require(_0x005b('0x6'));var path=require('path');var sox=require(_0x005b('0x7'));var csv=require(_0x005b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x005b('0x9'));var _=require(_0x005b('0xa'));var squel=require(_0x005b('0xb'));var crypto=require('crypto');var jsforce=require(_0x005b('0xc'));var deskjs=require(_0x005b('0xd'));var toCsv=require(_0x005b('0x8'));var querystring=require('querystring');var Papa=require(_0x005b('0xe'));var Redis=require(_0x005b('0xf'));var authService=require(_0x005b('0x10'));var qs=require(_0x005b('0x11'));var as=require(_0x005b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x005b('0x13'))(_0x005b('0x14'));var utils=require(_0x005b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x005b('0x16'));var db=require(_0x005b('0x17'))['db'];function respondWithStatusCode(_0x1b2e58,_0x4970c3){_0x4970c3=_0x4970c3||0xcc;return function(_0x1162de){if(_0x1162de){return _0x1b2e58[_0x005b('0x18')](_0x4970c3);}return _0x1b2e58[_0x005b('0x19')](_0x4970c3)[_0x005b('0x1a')]();};}function respondWithResult(_0x173073,_0x9957ae){_0x9957ae=_0x9957ae||0xc8;return function(_0x373a92){if(_0x373a92){return _0x173073[_0x005b('0x19')](_0x9957ae)[_0x005b('0x1b')](_0x373a92);}};}function respondWithFilteredResult(_0x1b0201,_0x1505b4){return function(_0x39eddf){if(_0x39eddf){var _0xbea9a=typeof _0x1505b4[_0x005b('0x1c')]===_0x005b('0x1d')&&typeof _0x1505b4[_0x005b('0x1e')]===_0x005b('0x1d');var _0x23d783=_0x39eddf[_0x005b('0x1f')];var _0x37ecfc=_0xbea9a?0x0:_0x1505b4['offset'];var _0x171aca=_0xbea9a?_0x39eddf['count']:_0x1505b4[_0x005b('0x1c')]+_0x1505b4[_0x005b('0x1e')];var _0x5960fc;if(_0x171aca>=_0x23d783){_0x171aca=_0x23d783;_0x5960fc=0xc8;}else{_0x5960fc=0xce;}_0x1b0201[_0x005b('0x19')](_0x5960fc);return _0x1b0201['set'](_0x005b('0x20'),_0x37ecfc+'-'+_0x171aca+'/'+_0x23d783)[_0x005b('0x1b')](_0x39eddf);}return null;};}function patchUpdates(_0x32dc64){return function(_0x39d31f){try{jsonpatch[_0x005b('0x21')](_0x39d31f,_0x32dc64,!![]);}catch(_0x43215e){return BPromise[_0x005b('0x22')](_0x43215e);}return _0x39d31f['save']();};}function saveUpdates(_0x4b806f,_0x6bdedd){return function(_0x21480c){if(_0x21480c){return _0x21480c['update'](_0x4b806f)[_0x005b('0x23')](function(_0x3804d1){return _0x3804d1;});}return null;};}function removeEntity(_0xe1bee7,_0xb6b045){return function(_0x59fa57){if(_0x59fa57){return _0x59fa57[_0x005b('0x24')]()['then'](function(){_0xe1bee7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b106c,_0x34c74d){return function(_0x54ddc6){if(!_0x54ddc6){_0x2b106c['sendStatus'](0x194);}return _0x54ddc6;};}function handleError(_0x2a79d5,_0x28f707){_0x28f707=_0x28f707||0x1f4;return function(_0x132284){logger[_0x005b('0x25')](_0x132284[_0x005b('0x26')]);if(_0x132284[_0x005b('0x27')]){delete _0x132284[_0x005b('0x27')];}_0x2a79d5['status'](_0x28f707)['send'](_0x132284);};}exports[_0x005b('0x28')]=function(_0x4df994,_0x3e9902){var _0x4ac7aa={},_0x5669de={},_0x465ca6={'count':0x0,'rows':[]};var _0x3f598d=_[_0x005b('0x29')](db[_0x005b('0x2a')]['rawAttributes'],function(_0xa433ee){return{'name':_0xa433ee[_0x005b('0x2b')],'type':_0xa433ee[_0x005b('0x2c')][_0x005b('0x2d')]};});_0x5669de['model']=_[_0x005b('0x29')](_0x3f598d,_0x005b('0x27'));_0x5669de[_0x005b('0x2e')]=_[_0x005b('0x2f')](_0x4df994['query']);_0x5669de['filters']=_[_0x005b('0x30')](_0x5669de[_0x005b('0x31')],_0x5669de[_0x005b('0x2e')]);_0x4ac7aa['attributes']=_['intersection'](_0x5669de['model'],qs[_0x005b('0x32')](_0x4df994[_0x005b('0x2e')][_0x005b('0x32')]));_0x4ac7aa[_0x005b('0x33')]=_0x4ac7aa[_0x005b('0x33')]['length']?_0x4ac7aa['attributes']:_0x5669de[_0x005b('0x31')];if(!_0x4df994[_0x005b('0x2e')][_0x005b('0x34')](_0x005b('0x35'))){_0x4ac7aa[_0x005b('0x1e')]=qs[_0x005b('0x1e')](_0x4df994[_0x005b('0x2e')][_0x005b('0x1e')]);_0x4ac7aa[_0x005b('0x1c')]=qs[_0x005b('0x1c')](_0x4df994[_0x005b('0x2e')][_0x005b('0x1c')]);}_0x4ac7aa['order']=qs['sort'](_0x4df994[_0x005b('0x2e')][_0x005b('0x36')]);_0x4ac7aa['where']=qs[_0x005b('0x37')](_[_0x005b('0x38')](_0x4df994[_0x005b('0x2e')],_0x5669de[_0x005b('0x37')]),_0x3f598d);if(_0x4df994[_0x005b('0x2e')]['filter']){_0x4ac7aa[_0x005b('0x39')]=_[_0x005b('0x3a')](_0x4ac7aa[_0x005b('0x39')],{'$or':_['map'](_0x3f598d,function(_0x52cc3b){if(_0x52cc3b[_0x005b('0x2c')]!==_0x005b('0x3b')){var _0x47b301={};_0x47b301[_0x52cc3b['name']]={'$like':'%'+_0x4df994[_0x005b('0x2e')][_0x005b('0x3c')]+'%'};return _0x47b301;}})});}_0x4ac7aa=_['merge']({},_0x4ac7aa,_0x4df994[_0x005b('0x3d')]);var _0x4fae85={'where':_0x4ac7aa['where']};return db[_0x005b('0x2a')][_0x005b('0x1f')](_0x4fae85)[_0x005b('0x23')](function(_0x441497){_0x465ca6[_0x005b('0x1f')]=_0x441497;if(_0x4df994[_0x005b('0x2e')]['includeAll']){_0x4ac7aa[_0x005b('0x3e')]=[{'all':!![]}];}return db[_0x005b('0x2a')][_0x005b('0x3f')](_0x4ac7aa);})[_0x005b('0x23')](function(_0x145bad){_0x465ca6[_0x005b('0x40')]=_0x145bad;return _0x465ca6;})[_0x005b('0x23')](respondWithFilteredResult(_0x3e9902,_0x4ac7aa))['catch'](handleError(_0x3e9902,null));};exports[_0x005b('0x41')]=function(_0x4bcade,_0x41a592){var _0x14fc12={'raw':![],'where':{'id':_0x4bcade['params']['id']}},_0x51b2bd={};_0x51b2bd[_0x005b('0x31')]=_['keys'](db[_0x005b('0x2a')][_0x005b('0x42')]);_0x51b2bd['query']=_['keys'](_0x4bcade['query']);_0x51b2bd[_0x005b('0x37')]=_[_0x005b('0x30')](_0x51b2bd['model'],_0x51b2bd[_0x005b('0x2e')]);_0x14fc12[_0x005b('0x33')]=_[_0x005b('0x30')](_0x51b2bd['model'],qs[_0x005b('0x32')](_0x4bcade[_0x005b('0x2e')][_0x005b('0x32')]));_0x14fc12[_0x005b('0x33')]=_0x14fc12[_0x005b('0x33')][_0x005b('0x43')]?_0x14fc12['attributes']:_0x51b2bd[_0x005b('0x31')];if(_0x4bcade[_0x005b('0x2e')][_0x005b('0x44')]){_0x14fc12['include']=[{'all':!![]}];}_0x14fc12=_[_0x005b('0x3a')]({},_0x14fc12,_0x4bcade['options']);return db[_0x005b('0x2a')][_0x005b('0x45')](_0x14fc12)[_0x005b('0x23')](handleEntityNotFound(_0x41a592,null))[_0x005b('0x23')](respondWithResult(_0x41a592,null))[_0x005b('0x46')](handleError(_0x41a592,null));};exports[_0x005b('0x47')]=function(_0x462650,_0x5b5d0e){return db[_0x005b('0x2a')][_0x005b('0x47')](_0x462650[_0x005b('0x48')],{})[_0x005b('0x23')](respondWithResult(_0x5b5d0e,0xc9))['catch'](handleError(_0x5b5d0e,null));};exports[_0x005b('0x49')]=function(_0x58a1ca,_0x451157){if(_0x58a1ca[_0x005b('0x48')]['id']){delete _0x58a1ca[_0x005b('0x48')]['id'];}return db[_0x005b('0x2a')][_0x005b('0x45')]({'where':{'id':_0x58a1ca[_0x005b('0x4a')]['id']}})[_0x005b('0x23')](handleEntityNotFound(_0x451157,null))[_0x005b('0x23')](saveUpdates(_0x58a1ca[_0x005b('0x48')],null))[_0x005b('0x23')](respondWithResult(_0x451157,null))[_0x005b('0x46')](handleError(_0x451157,null));};exports[_0x005b('0x24')]=function(_0x5dda19,_0x4ff1cc){return db[_0x005b('0x2a')]['find']({'where':{'id':_0x5dda19[_0x005b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ff1cc,null))['then'](removeEntity(_0x4ff1cc,null))[_0x005b('0x46')](handleError(_0x4ff1cc,null));};exports[_0x005b('0x4b')]=function(_0x2edf3c,_0x5d4c97,_0x287134){var _0x41a310={};var _0x363443={};var _0x4aea00;var _0x444710;return db['ZohoConfiguration'][_0x005b('0x4c')]({'where':{'id':_0x2edf3c[_0x005b('0x4a')]['id']}})[_0x005b('0x23')](handleEntityNotFound(_0x5d4c97,null))['then'](function(_0x34554c){if(_0x34554c){_0x4aea00=_0x34554c;_0x363443['model']=_[_0x005b('0x2f')](db[_0x005b('0x4d')][_0x005b('0x42')]);_0x363443['query']=_[_0x005b('0x2f')](_0x2edf3c[_0x005b('0x2e')]);_0x363443[_0x005b('0x37')]=_['intersection'](_0x363443[_0x005b('0x31')],_0x363443['query']);_0x41a310['attributes']=_[_0x005b('0x30')](_0x363443[_0x005b('0x31')],qs[_0x005b('0x32')](_0x2edf3c[_0x005b('0x2e')]['fields']));_0x41a310[_0x005b('0x33')]=_0x41a310[_0x005b('0x33')][_0x005b('0x43')]?_0x41a310['attributes']:_0x363443[_0x005b('0x31')];_0x41a310[_0x005b('0x4e')]=qs[_0x005b('0x36')](_0x2edf3c[_0x005b('0x2e')][_0x005b('0x36')]);_0x41a310[_0x005b('0x39')]=qs['filters'](_[_0x005b('0x38')](_0x2edf3c['query'],_0x363443['filters']));if(_0x2edf3c[_0x005b('0x2e')]['filter']){_0x41a310[_0x005b('0x39')]=_[_0x005b('0x3a')](_0x41a310['where'],{'$or':_[_0x005b('0x29')](_0x41a310[_0x005b('0x33')],function(_0x1c8159){var _0x25616f={};_0x25616f[_0x1c8159]={'$like':'%'+_0x2edf3c[_0x005b('0x2e')][_0x005b('0x3c')]+'%'};return _0x25616f;})});}_0x41a310=_['merge']({},_0x41a310,_0x2edf3c['options']);return _0x4aea00[_0x005b('0x4b')](_0x41a310);}})[_0x005b('0x23')](function(_0x4314f9){if(_0x4314f9){_0x444710=_0x4314f9['length'];if(!_0x2edf3c[_0x005b('0x2e')]['hasOwnProperty']('nolimit')){_0x41a310[_0x005b('0x1e')]=qs['limit'](_0x2edf3c[_0x005b('0x2e')][_0x005b('0x1e')]);_0x41a310[_0x005b('0x1c')]=qs[_0x005b('0x1c')](_0x2edf3c[_0x005b('0x2e')][_0x005b('0x1c')]);}return _0x4aea00[_0x005b('0x4b')](_0x41a310);}})['then'](function(_0x3e3fb8){if(_0x3e3fb8){return _0x3e3fb8?{'count':_0x444710,'rows':_0x3e3fb8}:null;}})[_0x005b('0x23')](respondWithResult(_0x5d4c97,null))[_0x005b('0x46')](handleError(_0x5d4c97,null));};exports['getSubjects']=function(_0x2435c8,_0x5628a7,_0x1644cd){var _0x3f27c1={};var _0xdc6067={};var _0x4ddffc;var _0x35d51a;return db[_0x005b('0x2a')][_0x005b('0x4c')]({'where':{'id':_0x2435c8[_0x005b('0x4a')]['id']}})[_0x005b('0x23')](handleEntityNotFound(_0x5628a7,null))[_0x005b('0x23')](function(_0x4ba533){if(_0x4ba533){_0x4ddffc=_0x4ba533;_0xdc6067[_0x005b('0x31')]=_['keys'](db[_0x005b('0x4d')][_0x005b('0x42')]);_0xdc6067[_0x005b('0x2e')]=_[_0x005b('0x2f')](_0x2435c8[_0x005b('0x2e')]);_0xdc6067['filters']=_[_0x005b('0x30')](_0xdc6067[_0x005b('0x31')],_0xdc6067[_0x005b('0x2e')]);_0x3f27c1[_0x005b('0x33')]=_['intersection'](_0xdc6067[_0x005b('0x31')],qs[_0x005b('0x32')](_0x2435c8['query'][_0x005b('0x32')]));_0x3f27c1[_0x005b('0x33')]=_0x3f27c1[_0x005b('0x33')][_0x005b('0x43')]?_0x3f27c1['attributes']:_0xdc6067[_0x005b('0x31')];_0x3f27c1[_0x005b('0x4e')]=qs['sort'](_0x2435c8[_0x005b('0x2e')][_0x005b('0x36')]);_0x3f27c1[_0x005b('0x39')]=qs[_0x005b('0x37')](_[_0x005b('0x38')](_0x2435c8[_0x005b('0x2e')],_0xdc6067[_0x005b('0x37')]));if(_0x2435c8['query'][_0x005b('0x3c')]){_0x3f27c1[_0x005b('0x39')]=_['merge'](_0x3f27c1[_0x005b('0x39')],{'$or':_[_0x005b('0x29')](_0x3f27c1[_0x005b('0x33')],function(_0xffd77b){var _0x18e4a1={};_0x18e4a1[_0xffd77b]={'$like':'%'+_0x2435c8[_0x005b('0x2e')]['filter']+'%'};return _0x18e4a1;})});}_0x3f27c1=_[_0x005b('0x3a')]({},_0x3f27c1,_0x2435c8[_0x005b('0x3d')]);return _0x4ddffc[_0x005b('0x4f')](_0x3f27c1);}})['then'](function(_0x2eda07){if(_0x2eda07){_0x35d51a=_0x2eda07[_0x005b('0x43')];if(!_0x2435c8[_0x005b('0x2e')][_0x005b('0x34')]('nolimit')){_0x3f27c1[_0x005b('0x1e')]=qs[_0x005b('0x1e')](_0x2435c8[_0x005b('0x2e')][_0x005b('0x1e')]);_0x3f27c1[_0x005b('0x1c')]=qs['offset'](_0x2435c8[_0x005b('0x2e')][_0x005b('0x1c')]);}return _0x4ddffc[_0x005b('0x4f')](_0x3f27c1);}})[_0x005b('0x23')](function(_0xc9218b){if(_0xc9218b){return _0xc9218b?{'count':_0x35d51a,'rows':_0xc9218b}:null;}})[_0x005b('0x23')](respondWithResult(_0x5628a7,null))[_0x005b('0x46')](handleError(_0x5628a7,null));};exports[_0x005b('0x50')]=function(_0x333dbe,_0x296af0,_0x482064){var _0x160301={};var _0x25d08b={};var _0x2beed7;var _0x54c17e;return db[_0x005b('0x2a')][_0x005b('0x4c')]({'where':{'id':_0x333dbe[_0x005b('0x4a')]['id']}})[_0x005b('0x23')](handleEntityNotFound(_0x296af0,null))['then'](function(_0xfa7425){if(_0xfa7425){_0x2beed7=_0xfa7425;_0x25d08b[_0x005b('0x31')]=_[_0x005b('0x2f')](db[_0x005b('0x4d')][_0x005b('0x42')]);_0x25d08b[_0x005b('0x2e')]=_[_0x005b('0x2f')](_0x333dbe[_0x005b('0x2e')]);_0x25d08b[_0x005b('0x37')]=_[_0x005b('0x30')](_0x25d08b[_0x005b('0x31')],_0x25d08b['query']);_0x160301[_0x005b('0x33')]=_[_0x005b('0x30')](_0x25d08b[_0x005b('0x31')],qs['fields'](_0x333dbe[_0x005b('0x2e')][_0x005b('0x32')]));_0x160301[_0x005b('0x33')]=_0x160301[_0x005b('0x33')][_0x005b('0x43')]?_0x160301['attributes']:_0x25d08b[_0x005b('0x31')];_0x160301['order']=qs[_0x005b('0x36')](_0x333dbe[_0x005b('0x2e')]['sort']);_0x160301[_0x005b('0x39')]=qs[_0x005b('0x37')](_[_0x005b('0x38')](_0x333dbe['query'],_0x25d08b[_0x005b('0x37')]));if(_0x333dbe['query'][_0x005b('0x3c')]){_0x160301[_0x005b('0x39')]=_['merge'](_0x160301[_0x005b('0x39')],{'$or':_['map'](_0x160301[_0x005b('0x33')],function(_0x514be4){var _0x4fd74c={};_0x4fd74c[_0x514be4]={'$like':'%'+_0x333dbe[_0x005b('0x2e')]['filter']+'%'};return _0x4fd74c;})});}_0x160301=_[_0x005b('0x3a')]({},_0x160301,_0x333dbe['options']);return _0x2beed7[_0x005b('0x50')](_0x160301);}})[_0x005b('0x23')](function(_0x4423cb){if(_0x4423cb){_0x54c17e=_0x4423cb['length'];if(!_0x333dbe[_0x005b('0x2e')]['hasOwnProperty']('nolimit')){_0x160301[_0x005b('0x1e')]=qs[_0x005b('0x1e')](_0x333dbe[_0x005b('0x2e')][_0x005b('0x1e')]);_0x160301[_0x005b('0x1c')]=qs[_0x005b('0x1c')](_0x333dbe[_0x005b('0x2e')]['offset']);}return _0x2beed7[_0x005b('0x50')](_0x160301);}})[_0x005b('0x23')](function(_0xdab109){if(_0xdab109){return _0xdab109?{'count':_0x54c17e,'rows':_0xdab109}:null;}})[_0x005b('0x23')](respondWithResult(_0x296af0,null))[_0x005b('0x46')](handleError(_0x296af0,null));}; \ No newline at end of file +var _0xb454=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ZohoConfiguration','fieldName','key','model','query','filters','intersection','attributes','fields','length','sort','where','pick','type','filter','merge','show','params','keys','includeAll','include','find','catch','create','body','update','getFields','findOne','ZohoField','rawAttributes','order','options','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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/logger','api','../../config/utils'];(function(_0x273e0d,_0x57ced8){var _0x251355=function(_0x201566){while(--_0x201566){_0x273e0d['push'](_0x273e0d['shift']());}};_0x251355(++_0x57ced8);}(_0xb454,0x8b));var _0x4b45=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xb454[_0x999b85];return _0x1d7124;};'use strict';var emlformat=require(_0x4b45('0x0'));var rimraf=require(_0x4b45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b45('0x2'));var rp=require(_0x4b45('0x3'));var moment=require(_0x4b45('0x4'));var BPromise=require(_0x4b45('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4b45('0x6'));var sox=require(_0x4b45('0x7'));var csv=require(_0x4b45('0x8'));var ejs=require(_0x4b45('0x9'));var fs=require('fs');var fs_extra=require(_0x4b45('0xa'));var _=require('lodash');var squel=require(_0x4b45('0xb'));var crypto=require(_0x4b45('0xc'));var jsforce=require(_0x4b45('0xd'));var deskjs=require(_0x4b45('0xe'));var toCsv=require(_0x4b45('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b45('0xf'));var authService=require(_0x4b45('0x10'));var qs=require(_0x4b45('0x11'));var as=require(_0x4b45('0x12'));var hardwareService=require(_0x4b45('0x13'));var logger=require(_0x4b45('0x14'))(_0x4b45('0x15'));var utils=require(_0x4b45('0x16'));var config=require(_0x4b45('0x17'));var licenseUtil=require(_0x4b45('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47503f,_0x38d5a7){_0x38d5a7=_0x38d5a7||0xcc;return function(_0x307411){if(_0x307411){return _0x47503f[_0x4b45('0x19')](_0x38d5a7);}return _0x47503f[_0x4b45('0x1a')](_0x38d5a7)[_0x4b45('0x1b')]();};}function respondWithResult(_0x5a3f44,_0x3530a8){_0x3530a8=_0x3530a8||0xc8;return function(_0x18cbce){if(_0x18cbce){return _0x5a3f44[_0x4b45('0x1a')](_0x3530a8)[_0x4b45('0x1c')](_0x18cbce);}};}function respondWithFilteredResult(_0x4c065a,_0x58af5b){return function(_0x38a2f0){if(_0x38a2f0){var _0x28853a=typeof _0x58af5b[_0x4b45('0x1d')]===_0x4b45('0x1e')&&typeof _0x58af5b[_0x4b45('0x1f')]===_0x4b45('0x1e');var _0x3d5cb9=_0x38a2f0[_0x4b45('0x20')];var _0x57b727=_0x28853a?0x0:_0x58af5b['offset'];var _0x10f550=_0x28853a?_0x38a2f0[_0x4b45('0x20')]:_0x58af5b[_0x4b45('0x1d')]+_0x58af5b[_0x4b45('0x1f')];var _0x160b24;if(_0x10f550>=_0x3d5cb9){_0x10f550=_0x3d5cb9;_0x160b24=0xc8;}else{_0x160b24=0xce;}_0x4c065a[_0x4b45('0x1a')](_0x160b24);return _0x4c065a[_0x4b45('0x21')](_0x4b45('0x22'),_0x57b727+'-'+_0x10f550+'/'+_0x3d5cb9)[_0x4b45('0x1c')](_0x38a2f0);}return null;};}function patchUpdates(_0x2f9a8d){return function(_0x553ca1){try{jsonpatch[_0x4b45('0x23')](_0x553ca1,_0x2f9a8d,!![]);}catch(_0x1e6e86){return BPromise[_0x4b45('0x24')](_0x1e6e86);}return _0x553ca1[_0x4b45('0x25')]();};}function saveUpdates(_0x2dd9ea,_0xa14dc0){return function(_0x1468da){if(_0x1468da){return _0x1468da['update'](_0x2dd9ea)[_0x4b45('0x26')](function(_0x277208){return _0x277208;});}return null;};}function removeEntity(_0x3470e4,_0x1bfcd1){return function(_0x4f81f6){if(_0x4f81f6){return _0x4f81f6[_0x4b45('0x27')]()[_0x4b45('0x26')](function(){_0x3470e4[_0x4b45('0x1a')](0xcc)[_0x4b45('0x1b')]();});}};}function handleEntityNotFound(_0x25acb2,_0x43940b){return function(_0x3ace2f){if(!_0x3ace2f){_0x25acb2[_0x4b45('0x19')](0x194);}return _0x3ace2f;};}function handleError(_0x59edda,_0x2cfda4){_0x2cfda4=_0x2cfda4||0x1f4;return function(_0x1fe8e9){logger[_0x4b45('0x28')](_0x1fe8e9['stack']);if(_0x1fe8e9[_0x4b45('0x29')]){delete _0x1fe8e9[_0x4b45('0x29')];}_0x59edda[_0x4b45('0x1a')](_0x2cfda4)[_0x4b45('0x2a')](_0x1fe8e9);};}exports[_0x4b45('0x2b')]=function(_0x24aed4,_0xc893ba){var _0x1e0fec={},_0x483d61={},_0x3969e6={'count':0x0,'rows':[]};var _0x19a759=_[_0x4b45('0x2c')](db[_0x4b45('0x2d')]['rawAttributes'],function(_0x4d26d4){return{'name':_0x4d26d4[_0x4b45('0x2e')],'type':_0x4d26d4['type'][_0x4b45('0x2f')]};});_0x483d61[_0x4b45('0x30')]=_[_0x4b45('0x2c')](_0x19a759,_0x4b45('0x29'));_0x483d61[_0x4b45('0x31')]=_['keys'](_0x24aed4[_0x4b45('0x31')]);_0x483d61[_0x4b45('0x32')]=_[_0x4b45('0x33')](_0x483d61[_0x4b45('0x30')],_0x483d61['query']);_0x1e0fec[_0x4b45('0x34')]=_[_0x4b45('0x33')](_0x483d61['model'],qs[_0x4b45('0x35')](_0x24aed4[_0x4b45('0x31')]['fields']));_0x1e0fec[_0x4b45('0x34')]=_0x1e0fec['attributes'][_0x4b45('0x36')]?_0x1e0fec['attributes']:_0x483d61['model'];if(!_0x24aed4['query']['hasOwnProperty']('nolimit')){_0x1e0fec['limit']=qs['limit'](_0x24aed4[_0x4b45('0x31')][_0x4b45('0x1f')]);_0x1e0fec[_0x4b45('0x1d')]=qs[_0x4b45('0x1d')](_0x24aed4['query'][_0x4b45('0x1d')]);}_0x1e0fec['order']=qs[_0x4b45('0x37')](_0x24aed4['query']['sort']);_0x1e0fec[_0x4b45('0x38')]=qs[_0x4b45('0x32')](_[_0x4b45('0x39')](_0x24aed4[_0x4b45('0x31')],_0x483d61[_0x4b45('0x32')]),_0x19a759);if(_0x24aed4['query']['filter']){_0x1e0fec[_0x4b45('0x38')]=_['merge'](_0x1e0fec[_0x4b45('0x38')],{'$or':_[_0x4b45('0x2c')](_0x19a759,function(_0x3fcd27){if(_0x3fcd27[_0x4b45('0x3a')]!=='VIRTUAL'){var _0x285506={};_0x285506[_0x3fcd27[_0x4b45('0x29')]]={'$like':'%'+_0x24aed4['query'][_0x4b45('0x3b')]+'%'};return _0x285506;}})});}_0x1e0fec=_[_0x4b45('0x3c')]({},_0x1e0fec,_0x24aed4['options']);var _0x20d340={'where':_0x1e0fec[_0x4b45('0x38')]};return db[_0x4b45('0x2d')]['count'](_0x20d340)['then'](function(_0x3bf803){_0x3969e6[_0x4b45('0x20')]=_0x3bf803;if(_0x24aed4[_0x4b45('0x31')]['includeAll']){_0x1e0fec['include']=[{'all':!![]}];}return db[_0x4b45('0x2d')]['findAll'](_0x1e0fec);})[_0x4b45('0x26')](function(_0x42f00c){_0x3969e6['rows']=_0x42f00c;return _0x3969e6;})[_0x4b45('0x26')](respondWithFilteredResult(_0xc893ba,_0x1e0fec))['catch'](handleError(_0xc893ba,null));};exports[_0x4b45('0x3d')]=function(_0x29a06d,_0x56a863){var _0x20c911={'raw':![],'where':{'id':_0x29a06d[_0x4b45('0x3e')]['id']}},_0x4d2dc7={};_0x4d2dc7['model']=_[_0x4b45('0x3f')](db[_0x4b45('0x2d')]['rawAttributes']);_0x4d2dc7['query']=_['keys'](_0x29a06d[_0x4b45('0x31')]);_0x4d2dc7[_0x4b45('0x32')]=_[_0x4b45('0x33')](_0x4d2dc7[_0x4b45('0x30')],_0x4d2dc7['query']);_0x20c911[_0x4b45('0x34')]=_[_0x4b45('0x33')](_0x4d2dc7['model'],qs[_0x4b45('0x35')](_0x29a06d[_0x4b45('0x31')][_0x4b45('0x35')]));_0x20c911[_0x4b45('0x34')]=_0x20c911[_0x4b45('0x34')]['length']?_0x20c911[_0x4b45('0x34')]:_0x4d2dc7[_0x4b45('0x30')];if(_0x29a06d[_0x4b45('0x31')][_0x4b45('0x40')]){_0x20c911[_0x4b45('0x41')]=[{'all':!![]}];}_0x20c911=_[_0x4b45('0x3c')]({},_0x20c911,_0x29a06d['options']);return db[_0x4b45('0x2d')][_0x4b45('0x42')](_0x20c911)['then'](handleEntityNotFound(_0x56a863,null))[_0x4b45('0x26')](respondWithResult(_0x56a863,null))[_0x4b45('0x43')](handleError(_0x56a863,null));};exports[_0x4b45('0x44')]=function(_0x105cd1,_0x3359f5){return db[_0x4b45('0x2d')][_0x4b45('0x44')](_0x105cd1[_0x4b45('0x45')],{})[_0x4b45('0x26')](respondWithResult(_0x3359f5,0xc9))[_0x4b45('0x43')](handleError(_0x3359f5,null));};exports[_0x4b45('0x46')]=function(_0x2624bd,_0x23dadf){if(_0x2624bd[_0x4b45('0x45')]['id']){delete _0x2624bd[_0x4b45('0x45')]['id'];}return db[_0x4b45('0x2d')][_0x4b45('0x42')]({'where':{'id':_0x2624bd[_0x4b45('0x3e')]['id']}})[_0x4b45('0x26')](handleEntityNotFound(_0x23dadf,null))[_0x4b45('0x26')](saveUpdates(_0x2624bd['body'],null))[_0x4b45('0x26')](respondWithResult(_0x23dadf,null))[_0x4b45('0x43')](handleError(_0x23dadf,null));};exports['destroy']=function(_0x569f5f,_0x2baef4){return db['ZohoConfiguration'][_0x4b45('0x42')]({'where':{'id':_0x569f5f[_0x4b45('0x3e')]['id']}})[_0x4b45('0x26')](handleEntityNotFound(_0x2baef4,null))['then'](removeEntity(_0x2baef4,null))[_0x4b45('0x43')](handleError(_0x2baef4,null));};exports[_0x4b45('0x47')]=function(_0x2bf973,_0x17e13f,_0x12739c){var _0x59492e={};var _0x420dda={};var _0x3299c8;var _0x58559e;return db[_0x4b45('0x2d')][_0x4b45('0x48')]({'where':{'id':_0x2bf973[_0x4b45('0x3e')]['id']}})['then'](handleEntityNotFound(_0x17e13f,null))[_0x4b45('0x26')](function(_0x1c5202){if(_0x1c5202){_0x3299c8=_0x1c5202;_0x420dda['model']=_['keys'](db[_0x4b45('0x49')][_0x4b45('0x4a')]);_0x420dda[_0x4b45('0x31')]=_[_0x4b45('0x3f')](_0x2bf973[_0x4b45('0x31')]);_0x420dda[_0x4b45('0x32')]=_[_0x4b45('0x33')](_0x420dda[_0x4b45('0x30')],_0x420dda[_0x4b45('0x31')]);_0x59492e[_0x4b45('0x34')]=_[_0x4b45('0x33')](_0x420dda['model'],qs[_0x4b45('0x35')](_0x2bf973['query']['fields']));_0x59492e[_0x4b45('0x34')]=_0x59492e['attributes'][_0x4b45('0x36')]?_0x59492e['attributes']:_0x420dda[_0x4b45('0x30')];_0x59492e[_0x4b45('0x4b')]=qs[_0x4b45('0x37')](_0x2bf973[_0x4b45('0x31')]['sort']);_0x59492e[_0x4b45('0x38')]=qs[_0x4b45('0x32')](_[_0x4b45('0x39')](_0x2bf973[_0x4b45('0x31')],_0x420dda[_0x4b45('0x32')]));if(_0x2bf973[_0x4b45('0x31')][_0x4b45('0x3b')]){_0x59492e['where']=_[_0x4b45('0x3c')](_0x59492e['where'],{'$or':_[_0x4b45('0x2c')](_0x59492e[_0x4b45('0x34')],function(_0x3c51f4){var _0x52eebd={};_0x52eebd[_0x3c51f4]={'$like':'%'+_0x2bf973[_0x4b45('0x31')][_0x4b45('0x3b')]+'%'};return _0x52eebd;})});}_0x59492e=_['merge']({},_0x59492e,_0x2bf973[_0x4b45('0x4c')]);return _0x3299c8[_0x4b45('0x47')](_0x59492e);}})[_0x4b45('0x26')](function(_0x44c3c2){if(_0x44c3c2){_0x58559e=_0x44c3c2[_0x4b45('0x36')];if(!_0x2bf973['query'][_0x4b45('0x4d')](_0x4b45('0x4e'))){_0x59492e[_0x4b45('0x1f')]=qs[_0x4b45('0x1f')](_0x2bf973[_0x4b45('0x31')][_0x4b45('0x1f')]);_0x59492e[_0x4b45('0x1d')]=qs['offset'](_0x2bf973['query']['offset']);}return _0x3299c8[_0x4b45('0x47')](_0x59492e);}})[_0x4b45('0x26')](function(_0x1a8d14){if(_0x1a8d14){return _0x1a8d14?{'count':_0x58559e,'rows':_0x1a8d14}:null;}})['then'](respondWithResult(_0x17e13f,null))[_0x4b45('0x43')](handleError(_0x17e13f,null));};exports['getSubjects']=function(_0xcd6969,_0x1d699a,_0x4adea0){var _0x20f719={};var _0x576624={};var _0x3ff9e1;var _0x36b1fe;return db[_0x4b45('0x2d')]['findOne']({'where':{'id':_0xcd6969[_0x4b45('0x3e')]['id']}})[_0x4b45('0x26')](handleEntityNotFound(_0x1d699a,null))['then'](function(_0x236e57){if(_0x236e57){_0x3ff9e1=_0x236e57;_0x576624[_0x4b45('0x30')]=_[_0x4b45('0x3f')](db['ZohoField'][_0x4b45('0x4a')]);_0x576624[_0x4b45('0x31')]=_[_0x4b45('0x3f')](_0xcd6969[_0x4b45('0x31')]);_0x576624[_0x4b45('0x32')]=_['intersection'](_0x576624[_0x4b45('0x30')],_0x576624[_0x4b45('0x31')]);_0x20f719[_0x4b45('0x34')]=_[_0x4b45('0x33')](_0x576624[_0x4b45('0x30')],qs[_0x4b45('0x35')](_0xcd6969[_0x4b45('0x31')][_0x4b45('0x35')]));_0x20f719[_0x4b45('0x34')]=_0x20f719[_0x4b45('0x34')][_0x4b45('0x36')]?_0x20f719[_0x4b45('0x34')]:_0x576624[_0x4b45('0x30')];_0x20f719[_0x4b45('0x4b')]=qs[_0x4b45('0x37')](_0xcd6969[_0x4b45('0x31')][_0x4b45('0x37')]);_0x20f719[_0x4b45('0x38')]=qs[_0x4b45('0x32')](_['pick'](_0xcd6969[_0x4b45('0x31')],_0x576624[_0x4b45('0x32')]));if(_0xcd6969[_0x4b45('0x31')][_0x4b45('0x3b')]){_0x20f719[_0x4b45('0x38')]=_[_0x4b45('0x3c')](_0x20f719[_0x4b45('0x38')],{'$or':_['map'](_0x20f719[_0x4b45('0x34')],function(_0xbc0ac3){var _0x1740f6={};_0x1740f6[_0xbc0ac3]={'$like':'%'+_0xcd6969[_0x4b45('0x31')][_0x4b45('0x3b')]+'%'};return _0x1740f6;})});}_0x20f719=_[_0x4b45('0x3c')]({},_0x20f719,_0xcd6969[_0x4b45('0x4c')]);return _0x3ff9e1[_0x4b45('0x4f')](_0x20f719);}})[_0x4b45('0x26')](function(_0x3a47eb){if(_0x3a47eb){_0x36b1fe=_0x3a47eb['length'];if(!_0xcd6969[_0x4b45('0x31')][_0x4b45('0x4d')]('nolimit')){_0x20f719[_0x4b45('0x1f')]=qs[_0x4b45('0x1f')](_0xcd6969[_0x4b45('0x31')]['limit']);_0x20f719[_0x4b45('0x1d')]=qs['offset'](_0xcd6969[_0x4b45('0x31')][_0x4b45('0x1d')]);}return _0x3ff9e1[_0x4b45('0x4f')](_0x20f719);}})[_0x4b45('0x26')](function(_0x2296d7){if(_0x2296d7){return _0x2296d7?{'count':_0x36b1fe,'rows':_0x2296d7}:null;}})[_0x4b45('0x26')](respondWithResult(_0x1d699a,null))[_0x4b45('0x43')](handleError(_0x1d699a,null));};exports['getDescriptions']=function(_0x20d0d1,_0x50deea,_0x58d4de){var _0x2eeec1={};var _0x35ff06={};var _0x236943;var _0x6ab83;return db[_0x4b45('0x2d')][_0x4b45('0x48')]({'where':{'id':_0x20d0d1[_0x4b45('0x3e')]['id']}})[_0x4b45('0x26')](handleEntityNotFound(_0x50deea,null))[_0x4b45('0x26')](function(_0x48b9b7){if(_0x48b9b7){_0x236943=_0x48b9b7;_0x35ff06[_0x4b45('0x30')]=_[_0x4b45('0x3f')](db['ZohoField']['rawAttributes']);_0x35ff06[_0x4b45('0x31')]=_[_0x4b45('0x3f')](_0x20d0d1[_0x4b45('0x31')]);_0x35ff06[_0x4b45('0x32')]=_[_0x4b45('0x33')](_0x35ff06[_0x4b45('0x30')],_0x35ff06[_0x4b45('0x31')]);_0x2eeec1[_0x4b45('0x34')]=_[_0x4b45('0x33')](_0x35ff06[_0x4b45('0x30')],qs[_0x4b45('0x35')](_0x20d0d1[_0x4b45('0x31')][_0x4b45('0x35')]));_0x2eeec1[_0x4b45('0x34')]=_0x2eeec1['attributes'][_0x4b45('0x36')]?_0x2eeec1[_0x4b45('0x34')]:_0x35ff06[_0x4b45('0x30')];_0x2eeec1[_0x4b45('0x4b')]=qs[_0x4b45('0x37')](_0x20d0d1[_0x4b45('0x31')][_0x4b45('0x37')]);_0x2eeec1['where']=qs[_0x4b45('0x32')](_[_0x4b45('0x39')](_0x20d0d1[_0x4b45('0x31')],_0x35ff06['filters']));if(_0x20d0d1[_0x4b45('0x31')][_0x4b45('0x3b')]){_0x2eeec1[_0x4b45('0x38')]=_[_0x4b45('0x3c')](_0x2eeec1[_0x4b45('0x38')],{'$or':_[_0x4b45('0x2c')](_0x2eeec1[_0x4b45('0x34')],function(_0x5bcbf6){var _0x4dc23d={};_0x4dc23d[_0x5bcbf6]={'$like':'%'+_0x20d0d1[_0x4b45('0x31')][_0x4b45('0x3b')]+'%'};return _0x4dc23d;})});}_0x2eeec1=_[_0x4b45('0x3c')]({},_0x2eeec1,_0x20d0d1['options']);return _0x236943['getDescriptions'](_0x2eeec1);}})[_0x4b45('0x26')](function(_0x1ef1be){if(_0x1ef1be){_0x6ab83=_0x1ef1be[_0x4b45('0x36')];if(!_0x20d0d1[_0x4b45('0x31')][_0x4b45('0x4d')](_0x4b45('0x4e'))){_0x2eeec1[_0x4b45('0x1f')]=qs[_0x4b45('0x1f')](_0x20d0d1[_0x4b45('0x31')][_0x4b45('0x1f')]);_0x2eeec1['offset']=qs['offset'](_0x20d0d1[_0x4b45('0x31')][_0x4b45('0x1d')]);}return _0x236943[_0x4b45('0x50')](_0x2eeec1);}})[_0x4b45('0x26')](function(_0x2183ac){if(_0x2183ac){return _0x2183ac?{'count':_0x6ab83,'rows':_0x2183ac}:null;}})['then'](respondWithResult(_0x50deea,null))[_0x4b45('0x43')](handleError(_0x50deea,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d7a4556..3e736c4 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 _0xfb81=['path','rimraf','exports','define','ZohoConfiguration','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf17dc6,_0x384f92){var _0x2c1a6c=function(_0x51b2a9){while(--_0x51b2a9){_0xf17dc6['push'](_0xf17dc6['shift']());}};_0x2c1a6c(++_0x384f92);}(_0xfb81,0x186));var _0x1fb8=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0xfb81[_0x230951];return _0xeb26b1;};'use strict';var _=require('lodash');var util=require(_0x1fb8('0x0'));var logger=require(_0x1fb8('0x1'))(_0x1fb8('0x2'));var moment=require(_0x1fb8('0x3'));var BPromise=require(_0x1fb8('0x4'));var rp=require(_0x1fb8('0x5'));var fs=require('fs');var path=require(_0x1fb8('0x6'));var rimraf=require(_0x1fb8('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x1fb8('0x8')]=function(_0x3e7531,_0x108778){return _0x3e7531[_0x1fb8('0x9')](_0x1fb8('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca6e=['./intZohoConfiguration.attributes','exports','ZohoConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xca6e,0x71));var _0xeca6=function(_0xb4fa77,_0x5e965a){_0xb4fa77=_0xb4fa77-0x0;var _0x38bff8=_0xca6e[_0xb4fa77];return _0x38bff8;};'use strict';var _=require(_0xeca6('0x0'));var util=require(_0xeca6('0x1'));var logger=require(_0xeca6('0x2'))(_0xeca6('0x3'));var moment=require(_0xeca6('0x4'));var BPromise=require('bluebird');var rp=require(_0xeca6('0x5'));var fs=require('fs');var path=require(_0xeca6('0x6'));var rimraf=require(_0xeca6('0x7'));var config=require('../../config/environment');var attributes=require(_0xeca6('0x8'));module[_0xeca6('0x9')]=function(_0x2c7b70,_0x338022){return _0x2c7b70['define'](_0xeca6('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 1c17db2..7c208ed 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 _0xcfad=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xcfad,0x14d));var _0xdcfa=function(_0x21930d,_0x4127f8){_0x21930d=_0x21930d-0x0;var _0x5667db=_0xcfad[_0x21930d];return _0x5667db;};'use strict';var _=require(_0xdcfa('0x0'));var util=require(_0xdcfa('0x1'));var moment=require(_0xdcfa('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcfa('0x3'));var fs=require('fs');var Redis=require(_0xdcfa('0x4'));var db=require(_0xdcfa('0x5'))['db'];var utils=require(_0xdcfa('0x6'));var logger=require('../../config/logger')(_0xdcfa('0x7'));var config=require(_0xdcfa('0x8'));var jayson=require(_0xdcfa('0x9'));var client=jayson[_0xdcfa('0xa')][_0xdcfa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c43aa,_0x1eeeb1,_0x43b074){return new BPromise(function(_0x5d6684,_0x14dfd9){return client[_0xdcfa('0xc')](_0x3c43aa,_0x43b074)[_0xdcfa('0xd')](function(_0x3b65e1){logger['info'](_0xdcfa('0xe'),_0x1eeeb1,_0xdcfa('0xf'));logger[_0xdcfa('0x10')](_0xdcfa('0x11'),_0x1eeeb1,_0xdcfa('0xf'),JSON[_0xdcfa('0x12')](_0x3b65e1));if(_0x3b65e1[_0xdcfa('0x13')]){if(_0x3b65e1[_0xdcfa('0x13')][_0xdcfa('0x14')]===0x1f4){logger[_0xdcfa('0x13')](_0xdcfa('0xe'),_0x1eeeb1,_0x3b65e1[_0xdcfa('0x13')][_0xdcfa('0x15')]);return _0x14dfd9(_0x3b65e1['error'][_0xdcfa('0x15')]);}logger[_0xdcfa('0x13')](_0xdcfa('0xe'),_0x1eeeb1,_0x3b65e1[_0xdcfa('0x13')][_0xdcfa('0x15')]);return _0x5d6684(_0x3b65e1[_0xdcfa('0x13')][_0xdcfa('0x15')]);}else{logger[_0xdcfa('0x16')]('ZohoConfiguration,\x20%s,\x20%s',_0x1eeeb1,_0xdcfa('0xf'));_0x5d6684(_0x3b65e1[_0xdcfa('0x17')][_0xdcfa('0x15')]);}})[_0xdcfa('0x18')](function(_0x41b7e6){logger[_0xdcfa('0x13')](_0xdcfa('0xe'),_0x1eeeb1,_0x41b7e6);_0x14dfd9(_0x41b7e6);});});} \ No newline at end of file +var _0x30c0=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0xa16ef8,_0x40cc48){var _0x40ab63=function(_0x2fb788){while(--_0x2fb788){_0xa16ef8['push'](_0xa16ef8['shift']());}};_0x40ab63(++_0x40cc48);}(_0x30c0,0x95));var _0x030c=function(_0x4e0a19,_0x3432de){_0x4e0a19=_0x4e0a19-0x0;var _0x2acf8c=_0x30c0[_0x4e0a19];return _0x2acf8c;};'use strict';var _=require(_0x030c('0x0'));var util=require(_0x030c('0x1'));var moment=require(_0x030c('0x2'));var BPromise=require('bluebird');var rs=require(_0x030c('0x3'));var fs=require('fs');var Redis=require(_0x030c('0x4'));var db=require(_0x030c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x030c('0x6'))('rpc');var config=require(_0x030c('0x7'));var jayson=require(_0x030c('0x8'));var client=jayson[_0x030c('0x9')][_0x030c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58712e,_0x50aa42,_0x1c0cd9){return new BPromise(function(_0x2898d5,_0x28ddb3){return client[_0x030c('0xb')](_0x58712e,_0x1c0cd9)[_0x030c('0xc')](function(_0x55635b){logger['info'](_0x030c('0xd'),_0x50aa42,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x50aa42,_0x030c('0xe'),JSON[_0x030c('0xf')](_0x55635b));if(_0x55635b[_0x030c('0x10')]){if(_0x55635b['error'][_0x030c('0x11')]===0x1f4){logger['error'](_0x030c('0xd'),_0x50aa42,_0x55635b[_0x030c('0x10')][_0x030c('0x12')]);return _0x28ddb3(_0x55635b['error'][_0x030c('0x12')]);}logger[_0x030c('0x10')](_0x030c('0xd'),_0x50aa42,_0x55635b[_0x030c('0x10')]['message']);return _0x2898d5(_0x55635b[_0x030c('0x10')]['message']);}else{logger[_0x030c('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x50aa42,'request\x20sent');_0x2898d5(_0x55635b[_0x030c('0x14')]['message']);}})[_0x030c('0x15')](function(_0x408bf6){logger[_0x030c('0x10')](_0x030c('0xd'),_0x50aa42,_0x408bf6);_0x28ddb3(_0x408bf6);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c22e3fa..2ae8463 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 _0x7c61=['isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZohoField.controller'];(function(_0x23154d,_0x4d195f){var _0x300430=function(_0x38300b){while(--_0x38300b){_0x23154d['push'](_0x23154d['shift']());}};_0x300430(++_0x4d195f);}(_0x7c61,0x14e));var _0x17c6=function(_0x1e752d,_0x4c6de7){_0x1e752d=_0x1e752d-0x0;var _0x1bb8ab=_0x7c61[_0x1e752d];return _0x1bb8ab;};'use strict';var multer=require(_0x17c6('0x0'));var util=require(_0x17c6('0x1'));var path=require(_0x17c6('0x2'));var timeout=require(_0x17c6('0x3'));var express=require(_0x17c6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x17c6('0x5'));var interaction=require(_0x17c6('0x6'));var config=require('../../config/environment');var controller=require(_0x17c6('0x7'));router['get']('/',auth[_0x17c6('0x8')](),controller[_0x17c6('0x9')]);router[_0x17c6('0xa')](_0x17c6('0xb'),auth[_0x17c6('0x8')](),controller[_0x17c6('0xc')]);router[_0x17c6('0xd')]('/',auth['isAuthenticated'](),controller[_0x17c6('0xe')]);router['put']('/:id',auth[_0x17c6('0x8')](),controller[_0x17c6('0xf')]);router[_0x17c6('0x10')](_0x17c6('0xb'),auth[_0x17c6('0x8')](),controller[_0x17c6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5a95=['/:id','isAuthenticated','show','create','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a95,0x68));var _0x55a9=function(_0x1a645a,_0x42cf9b){_0x1a645a=_0x1a645a-0x0;var _0x21ab46=_0x5a95[_0x1a645a];return _0x21ab46;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x55a9('0x0'));var timeout=require('connect-timeout');var express=require(_0x55a9('0x1'));var router=express['Router']();var fs_extra=require(_0x55a9('0x2'));var auth=require(_0x55a9('0x3'));var interaction=require(_0x55a9('0x4'));var config=require('../../config/environment');var controller=require(_0x55a9('0x5'));router[_0x55a9('0x6')]('/',auth['isAuthenticated'](),controller[_0x55a9('0x7')]);router[_0x55a9('0x6')](_0x55a9('0x8'),auth[_0x55a9('0x9')](),controller[_0x55a9('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x55a9('0xb')]);router['put'](_0x55a9('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x55a9('0x8'),auth[_0x55a9('0x9')](),controller[_0x55a9('0xc')]);module[_0x55a9('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2590d37..7fcdfce 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 _0xd859=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x473032,_0x14e909){var _0x3bc6c7=function(_0x3001b8){while(--_0x3001b8){_0x473032['push'](_0x473032['shift']());}};_0x3bc6c7(++_0x14e909);}(_0xd859,0x81));var _0x9d85=function(_0x4f0a1d,_0x2228c5){_0x4f0a1d=_0x4f0a1d-0x0;var _0x4a5f66=_0xd859[_0x4f0a1d];return _0x4a5f66;};'use strict';var Sequelize=require(_0x9d85('0x0'));module['exports']={'type':{'type':Sequelize[_0x9d85('0x1')](_0x9d85('0x2'),_0x9d85('0x3'),_0x9d85('0x4'),_0x9d85('0x5'),_0x9d85('0x6')),'defaultValue':_0x9d85('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9d85('0x7')]},'keyType':{'type':Sequelize[_0x9d85('0x1')](_0x9d85('0x2'),_0x9d85('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9d85('0x7')]},'customField':{'type':Sequelize[_0x9d85('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d85('0x7')]}}; \ No newline at end of file +var _0x2d5c=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x158638,_0x6b0e29){var _0x942f2a=function(_0x587d8c){while(--_0x587d8c){_0x158638['push'](_0x158638['shift']());}};_0x942f2a(++_0x6b0e29);}(_0x2d5c,0x159));var _0xc2d5=function(_0x2c154e,_0x3df194){_0x2c154e=_0x2c154e-0x0;var _0x2f683e=_0x2d5c[_0x2c154e];return _0x2f683e;};'use strict';var Sequelize=require(_0xc2d5('0x0'));module['exports']={'type':{'type':Sequelize[_0xc2d5('0x1')](_0xc2d5('0x2'),_0xc2d5('0x3'),_0xc2d5('0x4'),_0xc2d5('0x5'),_0xc2d5('0x6')),'defaultValue':_0xc2d5('0x2')},'content':{'type':Sequelize[_0xc2d5('0x7')]},'key':{'type':Sequelize[_0xc2d5('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc2d5('0x2'),_0xc2d5('0x3'),_0xc2d5('0x4'))},'keyContent':{'type':Sequelize[_0xc2d5('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc2d5('0x7')]},'customField':{'type':Sequelize[_0xc2d5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 608c924..6164cb3 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 _0x3ffd=['params','length','create','body','eml-format','zip-dir','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','update','then','error','stack','name','send','index','map','ZohoField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0x3ffd,0x84));var _0xd3ff=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x3ffd[_0x3fb9dd];return _0x20136a;};'use strict';var emlformat=require(_0xd3ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd3ff('0x2'));var path=require(_0xd3ff('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd3ff('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3ff('0x5'));var squel=require(_0xd3ff('0x6'));var crypto=require(_0xd3ff('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xd3ff('0x8'));var toCsv=require(_0xd3ff('0x9'));var querystring=require(_0xd3ff('0xa'));var Papa=require(_0xd3ff('0xb'));var Redis=require('ioredis');var authService=require(_0xd3ff('0xc'));var qs=require(_0xd3ff('0xd'));var as=require(_0xd3ff('0xe'));var hardwareService=require(_0xd3ff('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xd3ff('0x10'));var config=require(_0xd3ff('0x11'));var licenseUtil=require(_0xd3ff('0x12'));var db=require(_0xd3ff('0x13'))['db'];function respondWithStatusCode(_0x56e8b4,_0x10b5d9){_0x10b5d9=_0x10b5d9||0xcc;return function(_0x5da232){if(_0x5da232){return _0x56e8b4['sendStatus'](_0x10b5d9);}return _0x56e8b4[_0xd3ff('0x14')](_0x10b5d9)[_0xd3ff('0x15')]();};}function respondWithResult(_0x450596,_0x4c9104){_0x4c9104=_0x4c9104||0xc8;return function(_0x5a8c0f){if(_0x5a8c0f){return _0x450596[_0xd3ff('0x14')](_0x4c9104)[_0xd3ff('0x16')](_0x5a8c0f);}};}function respondWithFilteredResult(_0x3a55f4,_0x4cff73){return function(_0x246b98){if(_0x246b98){var _0x31f439=typeof _0x4cff73['offset']==='undefined'&&typeof _0x4cff73['limit']==='undefined';var _0x34ddd9=_0x246b98[_0xd3ff('0x17')];var _0x49b2e4=_0x31f439?0x0:_0x4cff73[_0xd3ff('0x18')];var _0x575446=_0x31f439?_0x246b98['count']:_0x4cff73[_0xd3ff('0x18')]+_0x4cff73['limit'];var _0x91025e;if(_0x575446>=_0x34ddd9){_0x575446=_0x34ddd9;_0x91025e=0xc8;}else{_0x91025e=0xce;}_0x3a55f4[_0xd3ff('0x14')](_0x91025e);return _0x3a55f4['set'](_0xd3ff('0x19'),_0x49b2e4+'-'+_0x575446+'/'+_0x34ddd9)['json'](_0x246b98);}return null;};}function patchUpdates(_0x4ca087){return function(_0x48e37d){try{jsonpatch[_0xd3ff('0x1a')](_0x48e37d,_0x4ca087,!![]);}catch(_0x1ceec9){return BPromise['reject'](_0x1ceec9);}return _0x48e37d['save']();};}function saveUpdates(_0x39ba4d,_0x5597e6){return function(_0x2f7acf){if(_0x2f7acf){return _0x2f7acf[_0xd3ff('0x1b')](_0x39ba4d)[_0xd3ff('0x1c')](function(_0x2bebc8){return _0x2bebc8;});}return null;};}function removeEntity(_0x84065d,_0x2c445e){return function(_0x28097f){if(_0x28097f){return _0x28097f['destroy']()[_0xd3ff('0x1c')](function(){_0x84065d[_0xd3ff('0x14')](0xcc)[_0xd3ff('0x15')]();});}};}function handleEntityNotFound(_0xd6fdfb,_0x17a53f){return function(_0x5d9b6e){if(!_0x5d9b6e){_0xd6fdfb['sendStatus'](0x194);}return _0x5d9b6e;};}function handleError(_0x5bb0b3,_0x4cd994){_0x4cd994=_0x4cd994||0x1f4;return function(_0x117c6a){logger[_0xd3ff('0x1d')](_0x117c6a[_0xd3ff('0x1e')]);if(_0x117c6a[_0xd3ff('0x1f')]){delete _0x117c6a[_0xd3ff('0x1f')];}_0x5bb0b3[_0xd3ff('0x14')](_0x4cd994)[_0xd3ff('0x20')](_0x117c6a);};}exports[_0xd3ff('0x21')]=function(_0x4decc6,_0x24c5f8){var _0x3fb4f0={},_0x3e2b70={},_0x1a4d92={'count':0x0,'rows':[]};var _0x78ea6e=_[_0xd3ff('0x22')](db[_0xd3ff('0x23')]['rawAttributes'],function(_0x22c6fa){return{'name':_0x22c6fa[_0xd3ff('0x24')],'type':_0x22c6fa[_0xd3ff('0x25')][_0xd3ff('0x26')]};});_0x3e2b70[_0xd3ff('0x27')]=_[_0xd3ff('0x22')](_0x78ea6e,_0xd3ff('0x1f'));_0x3e2b70[_0xd3ff('0x28')]=_[_0xd3ff('0x29')](_0x4decc6['query']);_0x3e2b70[_0xd3ff('0x2a')]=_[_0xd3ff('0x2b')](_0x3e2b70[_0xd3ff('0x27')],_0x3e2b70[_0xd3ff('0x28')]);_0x3fb4f0[_0xd3ff('0x2c')]=_[_0xd3ff('0x2b')](_0x3e2b70['model'],qs[_0xd3ff('0x2d')](_0x4decc6[_0xd3ff('0x28')][_0xd3ff('0x2d')]));_0x3fb4f0[_0xd3ff('0x2c')]=_0x3fb4f0[_0xd3ff('0x2c')]['length']?_0x3fb4f0[_0xd3ff('0x2c')]:_0x3e2b70['model'];if(!_0x4decc6[_0xd3ff('0x28')][_0xd3ff('0x2e')]('nolimit')){_0x3fb4f0[_0xd3ff('0x2f')]=qs[_0xd3ff('0x2f')](_0x4decc6[_0xd3ff('0x28')][_0xd3ff('0x2f')]);_0x3fb4f0[_0xd3ff('0x18')]=qs[_0xd3ff('0x18')](_0x4decc6['query'][_0xd3ff('0x18')]);}_0x3fb4f0[_0xd3ff('0x30')]=qs[_0xd3ff('0x31')](_0x4decc6['query']['sort']);_0x3fb4f0['where']=qs[_0xd3ff('0x2a')](_[_0xd3ff('0x32')](_0x4decc6[_0xd3ff('0x28')],_0x3e2b70[_0xd3ff('0x2a')]),_0x78ea6e);if(_0x4decc6[_0xd3ff('0x28')]['filter']){_0x3fb4f0[_0xd3ff('0x33')]=_['merge'](_0x3fb4f0['where'],{'$or':_['map'](_0x78ea6e,function(_0x229a85){if(_0x229a85['type']!==_0xd3ff('0x34')){var _0x2ae76b={};_0x2ae76b[_0x229a85[_0xd3ff('0x1f')]]={'$like':'%'+_0x4decc6['query'][_0xd3ff('0x35')]+'%'};return _0x2ae76b;}})});}_0x3fb4f0=_[_0xd3ff('0x36')]({},_0x3fb4f0,_0x4decc6[_0xd3ff('0x37')]);var _0x1a68f7={'where':_0x3fb4f0[_0xd3ff('0x33')]};return db[_0xd3ff('0x23')][_0xd3ff('0x17')](_0x1a68f7)[_0xd3ff('0x1c')](function(_0x2c6c5f){_0x1a4d92[_0xd3ff('0x17')]=_0x2c6c5f;if(_0x4decc6[_0xd3ff('0x28')][_0xd3ff('0x38')]){_0x3fb4f0[_0xd3ff('0x39')]=[{'all':!![]}];}return db[_0xd3ff('0x23')]['findAll'](_0x3fb4f0);})[_0xd3ff('0x1c')](function(_0xf6757d){_0x1a4d92['rows']=_0xf6757d;return _0x1a4d92;})[_0xd3ff('0x1c')](respondWithFilteredResult(_0x24c5f8,_0x3fb4f0))[_0xd3ff('0x3a')](handleError(_0x24c5f8,null));};exports[_0xd3ff('0x3b')]=function(_0xa9281f,_0x4c34b0){var _0x28e605={'raw':!![],'where':{'id':_0xa9281f[_0xd3ff('0x3c')]['id']}},_0x187fd2={};_0x187fd2[_0xd3ff('0x27')]=_['keys'](db[_0xd3ff('0x23')]['rawAttributes']);_0x187fd2['query']=_[_0xd3ff('0x29')](_0xa9281f[_0xd3ff('0x28')]);_0x187fd2[_0xd3ff('0x2a')]=_[_0xd3ff('0x2b')](_0x187fd2[_0xd3ff('0x27')],_0x187fd2[_0xd3ff('0x28')]);_0x28e605['attributes']=_[_0xd3ff('0x2b')](_0x187fd2['model'],qs[_0xd3ff('0x2d')](_0xa9281f[_0xd3ff('0x28')][_0xd3ff('0x2d')]));_0x28e605[_0xd3ff('0x2c')]=_0x28e605[_0xd3ff('0x2c')][_0xd3ff('0x3d')]?_0x28e605[_0xd3ff('0x2c')]:_0x187fd2[_0xd3ff('0x27')];if(_0xa9281f[_0xd3ff('0x28')][_0xd3ff('0x38')]){_0x28e605[_0xd3ff('0x39')]=[{'all':!![]}];}_0x28e605=_['merge']({},_0x28e605,_0xa9281f['options']);return db[_0xd3ff('0x23')]['find'](_0x28e605)[_0xd3ff('0x1c')](handleEntityNotFound(_0x4c34b0,null))[_0xd3ff('0x1c')](respondWithResult(_0x4c34b0,null))[_0xd3ff('0x3a')](handleError(_0x4c34b0,null));};exports[_0xd3ff('0x3e')]=function(_0xbe1225,_0x331f62){return db[_0xd3ff('0x23')]['create'](_0xbe1225[_0xd3ff('0x3f')],{})[_0xd3ff('0x1c')](respondWithResult(_0x331f62,0xc9))['catch'](handleError(_0x331f62,null));};exports[_0xd3ff('0x1b')]=function(_0x18a2d8,_0x45bd12){if(_0x18a2d8[_0xd3ff('0x3f')]['id']){delete _0x18a2d8[_0xd3ff('0x3f')]['id'];}return db[_0xd3ff('0x23')]['find']({'where':{'id':_0x18a2d8[_0xd3ff('0x3c')]['id']}})['then'](handleEntityNotFound(_0x45bd12,null))[_0xd3ff('0x1c')](saveUpdates(_0x18a2d8[_0xd3ff('0x3f')],null))[_0xd3ff('0x1c')](respondWithResult(_0x45bd12,null))[_0xd3ff('0x3a')](handleError(_0x45bd12,null));};exports['destroy']=function(_0x3abad8,_0x25e59a){return db[_0xd3ff('0x23')]['find']({'where':{'id':_0x3abad8[_0xd3ff('0x3c')]['id']}})['then'](handleEntityNotFound(_0x25e59a,null))[_0xd3ff('0x1c')](removeEntity(_0x25e59a,null))[_0xd3ff('0x3a')](handleError(_0x25e59a,null));}; \ No newline at end of file +var _0x68b7=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','ZohoField','findAll','catch','show','keys','rawAttributes','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x68b7,0x8c));var _0x768b=function(_0x4d0ccc,_0x27fdd2){_0x4d0ccc=_0x4d0ccc-0x0;var _0x2fca8a=_0x68b7[_0x4d0ccc];return _0x2fca8a;};'use strict';var emlformat=require(_0x768b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x768b('0x1'));var jsonpatch=require(_0x768b('0x2'));var rp=require(_0x768b('0x3'));var moment=require('moment');var BPromise=require(_0x768b('0x4'));var Mustache=require(_0x768b('0x5'));var util=require(_0x768b('0x6'));var path=require('path');var sox=require(_0x768b('0x7'));var csv=require(_0x768b('0x8'));var ejs=require(_0x768b('0x9'));var fs=require('fs');var fs_extra=require(_0x768b('0xa'));var _=require(_0x768b('0xb'));var squel=require(_0x768b('0xc'));var crypto=require(_0x768b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x768b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x768b('0xf'));var Papa=require(_0x768b('0x10'));var Redis=require(_0x768b('0x11'));var authService=require(_0x768b('0x12'));var qs=require(_0x768b('0x13'));var as=require(_0x768b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x768b('0x15'))(_0x768b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x768b('0x17'));var db=require(_0x768b('0x18'))['db'];function respondWithStatusCode(_0x35689d,_0x9c3671){_0x9c3671=_0x9c3671||0xcc;return function(_0x8fa3e6){if(_0x8fa3e6){return _0x35689d[_0x768b('0x19')](_0x9c3671);}return _0x35689d[_0x768b('0x1a')](_0x9c3671)[_0x768b('0x1b')]();};}function respondWithResult(_0x37a8b5,_0x4cff45){_0x4cff45=_0x4cff45||0xc8;return function(_0x467f33){if(_0x467f33){return _0x37a8b5[_0x768b('0x1a')](_0x4cff45)[_0x768b('0x1c')](_0x467f33);}};}function respondWithFilteredResult(_0x3a40b6,_0x1f655e){return function(_0x50306b){if(_0x50306b){var _0x17078f=typeof _0x1f655e[_0x768b('0x1d')]===_0x768b('0x1e')&&typeof _0x1f655e[_0x768b('0x1f')]===_0x768b('0x1e');var _0x7fc465=_0x50306b[_0x768b('0x20')];var _0x20312a=_0x17078f?0x0:_0x1f655e[_0x768b('0x1d')];var _0x421b6f=_0x17078f?_0x50306b[_0x768b('0x20')]:_0x1f655e[_0x768b('0x1d')]+_0x1f655e['limit'];var _0x507bdc;if(_0x421b6f>=_0x7fc465){_0x421b6f=_0x7fc465;_0x507bdc=0xc8;}else{_0x507bdc=0xce;}_0x3a40b6[_0x768b('0x1a')](_0x507bdc);return _0x3a40b6[_0x768b('0x21')]('Content-Range',_0x20312a+'-'+_0x421b6f+'/'+_0x7fc465)[_0x768b('0x1c')](_0x50306b);}return null;};}function patchUpdates(_0x931aa0){return function(_0x5c81ca){try{jsonpatch[_0x768b('0x22')](_0x5c81ca,_0x931aa0,!![]);}catch(_0x10c81c){return BPromise[_0x768b('0x23')](_0x10c81c);}return _0x5c81ca[_0x768b('0x24')]();};}function saveUpdates(_0xaa1538,_0x4d63a2){return function(_0x58cca0){if(_0x58cca0){return _0x58cca0[_0x768b('0x25')](_0xaa1538)[_0x768b('0x26')](function(_0xdc2648){return _0xdc2648;});}return null;};}function removeEntity(_0x207f99,_0x4694f6){return function(_0x1186ab){if(_0x1186ab){return _0x1186ab[_0x768b('0x27')]()[_0x768b('0x26')](function(){_0x207f99[_0x768b('0x1a')](0xcc)[_0x768b('0x1b')]();});}};}function handleEntityNotFound(_0x3ada89,_0x388e79){return function(_0x3a5307){if(!_0x3a5307){_0x3ada89[_0x768b('0x19')](0x194);}return _0x3a5307;};}function handleError(_0x4e31d5,_0x35614b){_0x35614b=_0x35614b||0x1f4;return function(_0x533665){logger['error'](_0x533665['stack']);if(_0x533665['name']){delete _0x533665[_0x768b('0x28')];}_0x4e31d5[_0x768b('0x1a')](_0x35614b)['send'](_0x533665);};}exports[_0x768b('0x29')]=function(_0x5194ee,_0x19c0ed){var _0x556b47={},_0x2681d4={},_0x1973b8={'count':0x0,'rows':[]};var _0x194812=_[_0x768b('0x2a')](db['ZohoField']['rawAttributes'],function(_0x501ec6){return{'name':_0x501ec6[_0x768b('0x2b')],'type':_0x501ec6[_0x768b('0x2c')][_0x768b('0x2d')]};});_0x2681d4[_0x768b('0x2e')]=_['map'](_0x194812,_0x768b('0x28'));_0x2681d4[_0x768b('0x2f')]=_['keys'](_0x5194ee['query']);_0x2681d4[_0x768b('0x30')]=_[_0x768b('0x31')](_0x2681d4['model'],_0x2681d4[_0x768b('0x2f')]);_0x556b47[_0x768b('0x32')]=_[_0x768b('0x31')](_0x2681d4[_0x768b('0x2e')],qs[_0x768b('0x33')](_0x5194ee[_0x768b('0x2f')]['fields']));_0x556b47[_0x768b('0x32')]=_0x556b47[_0x768b('0x32')][_0x768b('0x34')]?_0x556b47['attributes']:_0x2681d4[_0x768b('0x2e')];if(!_0x5194ee[_0x768b('0x2f')][_0x768b('0x35')]('nolimit')){_0x556b47['limit']=qs[_0x768b('0x1f')](_0x5194ee[_0x768b('0x2f')][_0x768b('0x1f')]);_0x556b47[_0x768b('0x1d')]=qs[_0x768b('0x1d')](_0x5194ee['query'][_0x768b('0x1d')]);}_0x556b47[_0x768b('0x36')]=qs[_0x768b('0x37')](_0x5194ee[_0x768b('0x2f')][_0x768b('0x37')]);_0x556b47[_0x768b('0x38')]=qs[_0x768b('0x30')](_[_0x768b('0x39')](_0x5194ee[_0x768b('0x2f')],_0x2681d4['filters']),_0x194812);if(_0x5194ee[_0x768b('0x2f')][_0x768b('0x3a')]){_0x556b47[_0x768b('0x38')]=_[_0x768b('0x3b')](_0x556b47[_0x768b('0x38')],{'$or':_['map'](_0x194812,function(_0x6f018a){if(_0x6f018a[_0x768b('0x2c')]!=='VIRTUAL'){var _0x58abd2={};_0x58abd2[_0x6f018a['name']]={'$like':'%'+_0x5194ee['query'][_0x768b('0x3a')]+'%'};return _0x58abd2;}})});}_0x556b47=_[_0x768b('0x3b')]({},_0x556b47,_0x5194ee[_0x768b('0x3c')]);var _0x3a3b99={'where':_0x556b47[_0x768b('0x38')]};return db['ZohoField'][_0x768b('0x20')](_0x3a3b99)['then'](function(_0x5c1e2b){_0x1973b8[_0x768b('0x20')]=_0x5c1e2b;if(_0x5194ee[_0x768b('0x2f')][_0x768b('0x3d')]){_0x556b47[_0x768b('0x3e')]=[{'all':!![]}];}return db[_0x768b('0x3f')][_0x768b('0x40')](_0x556b47);})[_0x768b('0x26')](function(_0x213919){_0x1973b8['rows']=_0x213919;return _0x1973b8;})[_0x768b('0x26')](respondWithFilteredResult(_0x19c0ed,_0x556b47))[_0x768b('0x41')](handleError(_0x19c0ed,null));};exports[_0x768b('0x42')]=function(_0x22cfe8,_0x925c02){var _0x4be074={'raw':!![],'where':{'id':_0x22cfe8['params']['id']}},_0x5c9f57={};_0x5c9f57[_0x768b('0x2e')]=_[_0x768b('0x43')](db[_0x768b('0x3f')][_0x768b('0x44')]);_0x5c9f57[_0x768b('0x2f')]=_[_0x768b('0x43')](_0x22cfe8[_0x768b('0x2f')]);_0x5c9f57['filters']=_['intersection'](_0x5c9f57[_0x768b('0x2e')],_0x5c9f57[_0x768b('0x2f')]);_0x4be074[_0x768b('0x32')]=_[_0x768b('0x31')](_0x5c9f57[_0x768b('0x2e')],qs[_0x768b('0x33')](_0x22cfe8[_0x768b('0x2f')]['fields']));_0x4be074[_0x768b('0x32')]=_0x4be074[_0x768b('0x32')][_0x768b('0x34')]?_0x4be074[_0x768b('0x32')]:_0x5c9f57[_0x768b('0x2e')];if(_0x22cfe8[_0x768b('0x2f')][_0x768b('0x3d')]){_0x4be074[_0x768b('0x3e')]=[{'all':!![]}];}_0x4be074=_[_0x768b('0x3b')]({},_0x4be074,_0x22cfe8[_0x768b('0x3c')]);return db[_0x768b('0x3f')][_0x768b('0x45')](_0x4be074)['then'](handleEntityNotFound(_0x925c02,null))[_0x768b('0x26')](respondWithResult(_0x925c02,null))[_0x768b('0x41')](handleError(_0x925c02,null));};exports[_0x768b('0x46')]=function(_0x16649c,_0x37915d){return db[_0x768b('0x3f')][_0x768b('0x46')](_0x16649c[_0x768b('0x47')],{})[_0x768b('0x26')](respondWithResult(_0x37915d,0xc9))[_0x768b('0x41')](handleError(_0x37915d,null));};exports[_0x768b('0x25')]=function(_0x17fb3c,_0x461cc5){if(_0x17fb3c[_0x768b('0x47')]['id']){delete _0x17fb3c[_0x768b('0x47')]['id'];}return db[_0x768b('0x3f')]['find']({'where':{'id':_0x17fb3c[_0x768b('0x48')]['id']}})[_0x768b('0x26')](handleEntityNotFound(_0x461cc5,null))[_0x768b('0x26')](saveUpdates(_0x17fb3c[_0x768b('0x47')],null))[_0x768b('0x26')](respondWithResult(_0x461cc5,null))[_0x768b('0x41')](handleError(_0x461cc5,null));};exports[_0x768b('0x27')]=function(_0x4ef9ce,_0x40d5cc){return db['ZohoField'][_0x768b('0x45')]({'where':{'id':_0x4ef9ce[_0x768b('0x48')]['id']}})['then'](handleEntityNotFound(_0x40d5cc,null))[_0x768b('0x26')](removeEntity(_0x40d5cc,null))[_0x768b('0x41')](handleError(_0x40d5cc,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d3681f7..694c4ed 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 _0xe2fe=['zoho_unique_index','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField'];(function(_0x18bfdb,_0x241d43){var _0x44334c=function(_0x55e999){while(--_0x55e999){_0x18bfdb['push'](_0x18bfdb['shift']());}};_0x44334c(++_0x241d43);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intZohoField.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['idField',_0xee2f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5204=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x5204,0xdf));var _0x4520=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x5204[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZohoField.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[{'name':_0x4520('0xc'),'fields':['idField',_0x4520('0xd')],'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 3f5bd1f..8764395 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 _0x44b3=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20e295,_0x308599){var _0x33ffbe=function(_0x2eeb46){while(--_0x2eeb46){_0x20e295['push'](_0x20e295['shift']());}};_0x33ffbe(++_0x308599);}(_0x44b3,0x1b8));var _0x344b=function(_0x2403fd,_0x4e4aec){_0x2403fd=_0x2403fd-0x0;var _0x4ca7fc=_0x44b3[_0x2403fd];return _0x4ca7fc;};'use strict';var _=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var moment=require('moment');var BPromise=require(_0x344b('0x2'));var rs=require(_0x344b('0x3'));var fs=require('fs');var Redis=require(_0x344b('0x4'));var db=require(_0x344b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x344b('0x6'))(_0x344b('0x7'));var config=require(_0x344b('0x8'));var jayson=require(_0x344b('0x9'));var client=jayson[_0x344b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8739,_0x134494,_0x3840a7){return new BPromise(function(_0x54db0b,_0x3dc87a){return client[_0x344b('0xb')](_0x3f8739,_0x3840a7)[_0x344b('0xc')](function(_0x187f37){logger[_0x344b('0xd')](_0x344b('0xe'),_0x134494,_0x344b('0xf'));logger[_0x344b('0x10')](_0x344b('0x11'),_0x134494,'request\x20sent',JSON[_0x344b('0x12')](_0x187f37));if(_0x187f37[_0x344b('0x13')]){if(_0x187f37[_0x344b('0x13')][_0x344b('0x14')]===0x1f4){logger[_0x344b('0x13')](_0x344b('0xe'),_0x134494,_0x187f37[_0x344b('0x13')][_0x344b('0x15')]);return _0x3dc87a(_0x187f37[_0x344b('0x13')][_0x344b('0x15')]);}logger[_0x344b('0x13')](_0x344b('0xe'),_0x134494,_0x187f37['error'][_0x344b('0x15')]);return _0x54db0b(_0x187f37[_0x344b('0x13')]['message']);}else{logger[_0x344b('0xd')](_0x344b('0xe'),_0x134494,'request\x20sent');_0x54db0b(_0x187f37['result'][_0x344b('0x15')]);}})['catch'](function(_0x1322f6){logger[_0x344b('0x13')](_0x344b('0xe'),_0x134494,_0x1322f6);_0x3dc87a(_0x1322f6);});});} \ No newline at end of file +var _0x88b5=['debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x45a9cb,_0x27acff){var _0x30e402=function(_0x444b54){while(--_0x444b54){_0x45a9cb['push'](_0x45a9cb['shift']());}};_0x30e402(++_0x27acff);}(_0x88b5,0xce));var _0x588b=function(_0x255ddc,_0x9e014d){_0x255ddc=_0x255ddc-0x0;var _0x4c7613=_0x88b5[_0x255ddc];return _0x4c7613;};'use strict';var _=require(_0x588b('0x0'));var util=require(_0x588b('0x1'));var moment=require(_0x588b('0x2'));var BPromise=require(_0x588b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x588b('0x4'));var db=require(_0x588b('0x5'))['db'];var utils=require(_0x588b('0x6'));var logger=require(_0x588b('0x7'))(_0x588b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x588b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a316f,_0x1142af,_0x1e7b55){return new BPromise(function(_0x3479c5,_0x2f9219){return client[_0x588b('0xa')](_0x3a316f,_0x1e7b55)[_0x588b('0xb')](function(_0x174653){logger['info'](_0x588b('0xc'),_0x1142af,_0x588b('0xd'));logger[_0x588b('0xe')](_0x588b('0xf'),_0x1142af,_0x588b('0xd'),JSON[_0x588b('0x10')](_0x174653));if(_0x174653[_0x588b('0x11')]){if(_0x174653['error'][_0x588b('0x12')]===0x1f4){logger[_0x588b('0x11')](_0x588b('0xc'),_0x1142af,_0x174653[_0x588b('0x11')][_0x588b('0x13')]);return _0x2f9219(_0x174653[_0x588b('0x11')][_0x588b('0x13')]);}logger['error'](_0x588b('0xc'),_0x1142af,_0x174653['error']['message']);return _0x3479c5(_0x174653['error']['message']);}else{logger[_0x588b('0x14')](_0x588b('0xc'),_0x1142af,'request\x20sent');_0x3479c5(_0x174653[_0x588b('0x15')]['message']);}})['catch'](function(_0x437765){logger[_0x588b('0x11')](_0x588b('0xc'),_0x1142af,_0x437765);_0x2f9219(_0x437765);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e722e0c..725b64f 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a69ab,_0x610049){var _0x27f2f7=function(_0x452a0c){while(--_0x452a0c){_0x5a69ab['push'](_0x5a69ab['shift']());}};_0x27f2f7(++_0x610049);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x44c15e,_0x96ed4c){var _0x13fc14=function(_0xe0c7ca){while(--_0xe0c7ca){_0x44c15e['push'](_0x44c15e['shift']());}};_0x13fc14(++_0x96ed4c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b95669d..4d1dbfc 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 _0xd200=['exports','STRING','unique_name_and_version','INTEGER','BOOLEAN','sequelize'];(function(_0x462032,_0x595bb4){var _0x5edee7=function(_0x50cf99){while(--_0x50cf99){_0x462032['push'](_0x462032['shift']());}};_0x5edee7(++_0x595bb4);}(_0xd200,0x7d));var _0x0d20=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xd200[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require(_0x0d20('0x0'));module[_0x0d20('0x1')]={'name':{'type':Sequelize[_0x0d20('0x2')],'allowNull':![],'unique':_0x0d20('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d20('0x3')},'main':{'type':Sequelize[_0x0d20('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x0d20('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0d20('0x2')]},'size':{'type':Sequelize[_0x0d20('0x4')]},'active':{'type':Sequelize[_0x0d20('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x0d20('0x2')]},'logo':{'type':Sequelize[_0x0d20('0x2')]},'state':{'type':Sequelize[_0x0d20('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x0d20('0x2')]},'title':{'type':Sequelize[_0x0d20('0x2')]},'remoteUri':{'type':Sequelize[_0x0d20('0x2')]},'link':{'type':Sequelize[_0x0d20('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x5f83=['BOOLEAN','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x14d249,_0x2a2332){var _0x4505c7=function(_0x144789){while(--_0x144789){_0x14d249['push'](_0x14d249['shift']());}};_0x4505c7(++_0x2a2332);}(_0x5f83,0x120));var _0x35f8=function(_0x3a7dda,_0x484f8f){_0x3a7dda=_0x3a7dda-0x0;var _0x9f9d0e=_0x5f83[_0x3a7dda];return _0x9f9d0e;};'use strict';var Sequelize=require(_0x35f8('0x0'));module[_0x35f8('0x1')]={'name':{'type':Sequelize[_0x35f8('0x2')],'allowNull':![],'unique':_0x35f8('0x3')},'version':{'type':Sequelize[_0x35f8('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x35f8('0x2')],'defaultValue':_0x35f8('0x4')},'filename':{'type':Sequelize[_0x35f8('0x2')]},'path':{'type':Sequelize[_0x35f8('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x35f8('0x5')]},'active':{'type':Sequelize[_0x35f8('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x35f8('0x2')]},'logo':{'type':Sequelize[_0x35f8('0x2')]},'state':{'type':Sequelize[_0x35f8('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x35f8('0x2')]},'title':{'type':Sequelize[_0x35f8('0x2')]},'remoteUri':{'type':Sequelize[_0x35f8('0x2')]},'link':{'type':Sequelize[_0x35f8('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index dc5c798..853100d 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 _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x564c5d,_0x27d56b){var _0x128b6e=function(_0x178f1f){while(--_0x178f1f){_0x564c5d['push'](_0x564c5d['shift']());}};_0x128b6e(++_0x27d56b);}(_0x2ef3,0xba));var _0x32ef=function(_0xb1dba7,_0x3efa4c){_0xb1dba7=_0xb1dba7-0x0;var _0x55fde1=_0x2ef3[_0xb1dba7];return _0x55fde1;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file +var _0xd943=['mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','Integration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x5ef03d,_0x113928){var _0xe7324d=function(_0x195108){while(--_0x195108){_0x5ef03d['push'](_0x5ef03d['shift']());}};_0xe7324d(++_0x113928);}(_0xd943,0x15d));var _0x3d94=function(_0x34e928,_0x4c6d77){_0x34e928=_0x34e928-0x0;var _0x3e0071=_0xd943[_0x34e928];return _0x3e0071;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2195d61..12a22ad 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 _0x7118=['Integration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define'];(function(_0x3869c8,_0x2ff137){var _0x4caf60=function(_0x224384){while(--_0x224384){_0x3869c8['push'](_0x3869c8['shift']());}};_0x4caf60(++_0x2ff137);}(_0x7118,0x1c9));var _0x8711=function(_0x1d2382,_0xe7e615){_0x1d2382=_0x1d2382-0x0;var _0x1a548f=_0x7118[_0x1d2382];return _0x1a548f;};'use strict';var _=require(_0x8711('0x0'));var util=require('util');var logger=require(_0x8711('0x1'))(_0x8711('0x2'));var moment=require(_0x8711('0x3'));var BPromise=require(_0x8711('0x4'));var rp=require(_0x8711('0x5'));var fs=require('fs');var path=require(_0x8711('0x6'));var rimraf=require('rimraf');var config=require(_0x8711('0x7'));var attributes=require(_0x8711('0x8'));module[_0x8711('0x9')]=function(_0x35066d,_0x203ddf){return _0x35066d[_0x8711('0xa')](_0x8711('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b47=['Integration','integrations','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x12c636,_0x1677a6){var _0x6eea1=function(_0x633e7a){while(--_0x633e7a){_0x12c636['push'](_0x12c636['shift']());}};_0x6eea1(++_0x1677a6);}(_0x0b47,0xbd));var _0x70b4=function(_0x567d9f,_0x44354c){_0x567d9f=_0x567d9f-0x0;var _0x28ab37=_0x0b47[_0x567d9f];return _0x28ab37;};'use strict';var _=require('lodash');var util=require(_0x70b4('0x0'));var logger=require(_0x70b4('0x1'))(_0x70b4('0x2'));var moment=require(_0x70b4('0x3'));var BPromise=require(_0x70b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70b4('0x5'));var rimraf=require(_0x70b4('0x6'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x70b4('0x7')]=function(_0x2ff020,_0x4dfcd5){return _0x2ff020[_0x70b4('0x8')](_0x70b4('0x9'),attributes,{'tableName':_0x70b4('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 17ab758..3b6e889 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 _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2cd752,_0x25d752){_0x2cd752=_0x2cd752-0x0;var _0x579c67=_0xd7d1[_0x2cd752];return _0x579c67;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file +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(_0x4dedd3,_0x175841){var _0x48f768=function(_0x17dff7){while(--_0x17dff7){_0x4dedd3['push'](_0x4dedd3['shift']());}};_0x48f768(++_0x175841);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1e15cc,_0x41c9ca){_0x1e15cc=_0x1e15cc-0x0;var _0x52e510=_0x9f0e[_0x1e15cc];return _0x52e510;};'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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 2cb8f42..73f4939 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 _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x5cb6d0,_0x169f81){var _0x408ccb=function(_0x12eec6){while(--_0x12eec6){_0x5cb6d0['push'](_0x5cb6d0['shift']());}};_0x408ccb(++_0x169f81);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6d38[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x131ed6,_0x145faf){var _0x70a01e=function(_0x234827){while(--_0x234827){_0x131ed6['push'](_0x131ed6['shift']());}};_0x70a01e(++_0x145faf);}(_0x4975,0x86));var _0x5497=function(_0x3eba3e,_0x180720){_0x3eba3e=_0x3eba3e-0x0;var _0xe506f7=_0x4975[_0x3eba3e];return _0xe506f7;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7781258..de78cd5 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 _0x1f94=['SENDING','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0x1f94,0x9c));var _0x41f9=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0x1f94[_0x34b6aa];return _0x3ead29;};'use strict';var Sequelize=require(_0x41f9('0x0'));module[_0x41f9('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x41f9('0x2')]},'exitStatus':{'type':Sequelize[_0x41f9('0x2')]},'ticketId':{'type':Sequelize[_0x41f9('0x2')]},'integrationId':{'type':Sequelize[_0x41f9('0x3')]},'contacts':{'type':Sequelize[_0x41f9('0x2')]},'uniqueid':{'type':Sequelize[_0x41f9('0x2')]},'calleridnum':{'type':Sequelize[_0x41f9('0x2')]},'calleridname':{'type':Sequelize[_0x41f9('0x2')]},'queue':{'type':Sequelize[_0x41f9('0x2')]},'interface':{'type':Sequelize[_0x41f9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x41f9('0x4')]},'agentconnectAt':{'type':Sequelize[_0x41f9('0x4')]},'holdtime':{'type':Sequelize[_0x41f9('0x3')]},'agentcomplete':{'type':Sequelize[_0x41f9('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x41f9('0x4')]},'talktime':{'type':Sequelize[_0x41f9('0x3')]},'agentacw':{'type':Sequelize[_0x41f9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x41f9('0x3')]},'reason':{'type':Sequelize[_0x41f9('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x41f9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x41f9('0x4')]},'lastevent':{'type':Sequelize[_0x41f9('0x2')]},'channel':{'type':Sequelize[_0x41f9('0x2')]},'channelstate':{'type':Sequelize[_0x41f9('0x3')]},'channelstatedesc':{'type':Sequelize[_0x41f9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x41f9('0x2')]},'connectedlinename':{'type':Sequelize[_0x41f9('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x41f9('0x2')]},'context':{'type':Sequelize[_0x41f9('0x2')]},'exten':{'type':Sequelize[_0x41f9('0x2')]},'priority':{'type':Sequelize[_0x41f9('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x41f9('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x41f9('0x2')]},'destcalleridnum':{'type':Sequelize[_0x41f9('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x41f9('0x2')]},'destlanguage':{'type':Sequelize[_0x41f9('0x2')]},'destaccountcode':{'type':Sequelize[_0x41f9('0x2')]},'destcontext':{'type':Sequelize[_0x41f9('0x2')]},'destexten':{'type':Sequelize[_0x41f9('0x2')]},'destpriority':{'type':Sequelize[_0x41f9('0x2')]},'destuniqueid':{'type':Sequelize[_0x41f9('0x2')]},'messageId':{'type':Sequelize[_0x41f9('0x2')]},'inReplyTo':{'type':Sequelize[_0x41f9('0x2')]},'subject':{'type':Sequelize[_0x41f9('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x41f9('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x41f9('0x6')]},'status':{'type':Sequelize[_0x41f9('0x7')](_0x41f9('0x8'),_0x41f9('0x9'),_0x41f9('0xa'),'FAILED')},'url':{'type':Sequelize[_0x41f9('0x2')]},'app':{'type':Sequelize[_0x41f9('0x2')]},'appdata':{'type':Sequelize[_0x41f9('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe2c3=['INTEGER','BOOLEAN','DATE','TEXT','ENUM','SENDING','RECEIVED','sequelize','exports','STRING'];(function(_0x1863fb,_0x3304d3){var _0x3c7735=function(_0x4fc0bb){while(--_0x4fc0bb){_0x1863fb['push'](_0x1863fb['shift']());}};_0x3c7735(++_0x3304d3);}(_0xe2c3,0x6b));var _0x3e2c=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0xe2c3[_0x3af6d3];return _0xf0c5a8;};'use strict';var Sequelize=require(_0x3e2c('0x0'));module[_0x3e2c('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x3e2c('0x2')]},'exitStatus':{'type':Sequelize[_0x3e2c('0x2')]},'ticketId':{'type':Sequelize[_0x3e2c('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x3e2c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3e2c('0x2')]},'calleridname':{'type':Sequelize[_0x3e2c('0x2')]},'queue':{'type':Sequelize[_0x3e2c('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x3e2c('0x3')]},'agentcomplete':{'type':Sequelize[_0x3e2c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3e2c('0x5')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x3e2c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3e2c('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3e2c('0x5')]},'agentdump':{'type':Sequelize[_0x3e2c('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3e2c('0x5')]},'lastevent':{'type':Sequelize[_0x3e2c('0x2')]},'channel':{'type':Sequelize[_0x3e2c('0x2')]},'channelstate':{'type':Sequelize[_0x3e2c('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3e2c('0x2')]},'connectedlinename':{'type':Sequelize[_0x3e2c('0x2')]},'language':{'type':Sequelize[_0x3e2c('0x2')]},'accountcode':{'type':Sequelize[_0x3e2c('0x2')]},'context':{'type':Sequelize[_0x3e2c('0x2')]},'exten':{'type':Sequelize[_0x3e2c('0x2')]},'priority':{'type':Sequelize[_0x3e2c('0x2')]},'destchannel':{'type':Sequelize[_0x3e2c('0x2')]},'destchannelstate':{'type':Sequelize[_0x3e2c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3e2c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3e2c('0x2')]},'destcalleridname':{'type':Sequelize[_0x3e2c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3e2c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3e2c('0x2')]},'destlanguage':{'type':Sequelize[_0x3e2c('0x2')]},'destaccountcode':{'type':Sequelize[_0x3e2c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3e2c('0x2')]},'destpriority':{'type':Sequelize[_0x3e2c('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x3e2c('0x2')]},'inReplyTo':{'type':Sequelize[_0x3e2c('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3e2c('0x2')]},'to':{'type':Sequelize[_0x3e2c('0x2')]},'cc':{'type':Sequelize[_0x3e2c('0x2')]},'attachment':{'type':Sequelize[_0x3e2c('0x6')]},'html':{'type':Sequelize[_0x3e2c('0x6')]},'text':{'type':Sequelize[_0x3e2c('0x6')]},'status':{'type':Sequelize[_0x3e2c('0x7')]('SENT',_0x3e2c('0x8'),_0x3e2c('0x9'),'FAILED')},'url':{'type':Sequelize[_0x3e2c('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x3e2c('0x2')]},'projectId':{'type':Sequelize[_0x3e2c('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c5c2310..b29e232 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 _0xfdc4=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','name','index','IntegrationReport','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfdc4,0x1f1));var _0x4fdc=function(_0x6e9961,_0x1d5310){_0x6e9961=_0x6e9961-0x0;var _0x1b7e2d=_0xfdc4[_0x6e9961];return _0x1b7e2d;};'use strict';var emlformat=require(_0x4fdc('0x0'));var rimraf=require(_0x4fdc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fdc('0x2'));var rp=require(_0x4fdc('0x3'));var moment=require('moment');var BPromise=require(_0x4fdc('0x4'));var Mustache=require(_0x4fdc('0x5'));var util=require('util');var path=require(_0x4fdc('0x6'));var sox=require(_0x4fdc('0x7'));var csv=require(_0x4fdc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fdc('0x9'));var squel=require('squel');var crypto=require(_0x4fdc('0xa'));var jsforce=require(_0x4fdc('0xb'));var deskjs=require(_0x4fdc('0xc'));var toCsv=require(_0x4fdc('0x8'));var querystring=require(_0x4fdc('0xd'));var Papa=require(_0x4fdc('0xe'));var Redis=require(_0x4fdc('0xf'));var authService=require(_0x4fdc('0x10'));var qs=require(_0x4fdc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fdc('0x12'))(_0x4fdc('0x13'));var utils=require(_0x4fdc('0x14'));var config=require(_0x4fdc('0x15'));var licenseUtil=require(_0x4fdc('0x16'));var db=require(_0x4fdc('0x17'))['db'];function respondWithStatusCode(_0x113311,_0x5c50cd){_0x5c50cd=_0x5c50cd||0xcc;return function(_0xdf78b){if(_0xdf78b){return _0x113311[_0x4fdc('0x18')](_0x5c50cd);}return _0x113311[_0x4fdc('0x19')](_0x5c50cd)[_0x4fdc('0x1a')]();};}function respondWithResult(_0x163eb6,_0x358741){_0x358741=_0x358741||0xc8;return function(_0x1526f3){if(_0x1526f3){return _0x163eb6[_0x4fdc('0x19')](_0x358741)[_0x4fdc('0x1b')](_0x1526f3);}};}function respondWithFilteredResult(_0x2268b0,_0x54baf9){return function(_0x2fe380){if(_0x2fe380){var _0x1e9c48=typeof _0x54baf9['offset']===_0x4fdc('0x1c')&&typeof _0x54baf9[_0x4fdc('0x1d')]===_0x4fdc('0x1c');var _0x5cda58=_0x2fe380[_0x4fdc('0x1e')];var _0x138155=_0x1e9c48?0x0:_0x54baf9['offset'];var _0x10d4da=_0x1e9c48?_0x2fe380['count']:_0x54baf9[_0x4fdc('0x1f')]+_0x54baf9[_0x4fdc('0x1d')];var _0x333b94;if(_0x10d4da>=_0x5cda58){_0x10d4da=_0x5cda58;_0x333b94=0xc8;}else{_0x333b94=0xce;}_0x2268b0[_0x4fdc('0x19')](_0x333b94);return _0x2268b0[_0x4fdc('0x20')]('Content-Range',_0x138155+'-'+_0x10d4da+'/'+_0x5cda58)['json'](_0x2fe380);}return null;};}function patchUpdates(_0x422c3d){return function(_0xc3b0e2){try{jsonpatch['apply'](_0xc3b0e2,_0x422c3d,!![]);}catch(_0x4e7120){return BPromise[_0x4fdc('0x21')](_0x4e7120);}return _0xc3b0e2[_0x4fdc('0x22')]();};}function saveUpdates(_0x4a0332,_0xd31f19){return function(_0x36ed59){if(_0x36ed59){return _0x36ed59[_0x4fdc('0x23')](_0x4a0332)[_0x4fdc('0x24')](function(_0x1e8ea9){return _0x1e8ea9;});}return null;};}function removeEntity(_0x21644e,_0x13129d){return function(_0x18c130){if(_0x18c130){return _0x18c130[_0x4fdc('0x25')]()[_0x4fdc('0x24')](function(){_0x21644e[_0x4fdc('0x19')](0xcc)[_0x4fdc('0x1a')]();});}};}function handleEntityNotFound(_0x1a46db,_0x1a76e2){return function(_0x5a4b35){if(!_0x5a4b35){_0x1a46db[_0x4fdc('0x18')](0x194);}return _0x5a4b35;};}function handleError(_0x308c20,_0xa55854){_0xa55854=_0xa55854||0x1f4;return function(_0x18d6ca){logger['error'](_0x18d6ca['stack']);if(_0x18d6ca['name']){delete _0x18d6ca[_0x4fdc('0x26')];}_0x308c20[_0x4fdc('0x19')](_0xa55854)['send'](_0x18d6ca);};}exports[_0x4fdc('0x27')]=function(_0x1975fb,_0x1dbdd2){var _0x5f41dd={},_0x369548={},_0x3984f8={'count':0x0,'rows':[]};var _0x3252b5=_['map'](db[_0x4fdc('0x28')][_0x4fdc('0x29')],function(_0x395b74){return{'name':_0x395b74['fieldName'],'type':_0x395b74['type'][_0x4fdc('0x2a')]};});_0x369548[_0x4fdc('0x2b')]=_[_0x4fdc('0x2c')](_0x3252b5,'name');_0x369548['query']=_[_0x4fdc('0x2d')](_0x1975fb[_0x4fdc('0x2e')]);_0x369548[_0x4fdc('0x2f')]=_[_0x4fdc('0x30')](_0x369548[_0x4fdc('0x2b')],_0x369548[_0x4fdc('0x2e')]);_0x5f41dd[_0x4fdc('0x31')]=_[_0x4fdc('0x30')](_0x369548[_0x4fdc('0x2b')],qs['fields'](_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x32')]));_0x5f41dd[_0x4fdc('0x31')]=_0x5f41dd[_0x4fdc('0x31')][_0x4fdc('0x33')]?_0x5f41dd[_0x4fdc('0x31')]:_0x369548[_0x4fdc('0x2b')];if(!_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x34')](_0x4fdc('0x35'))){_0x5f41dd['limit']=qs['limit'](_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x1d')]);_0x5f41dd[_0x4fdc('0x1f')]=qs[_0x4fdc('0x1f')](_0x1975fb['query']['offset']);}_0x5f41dd[_0x4fdc('0x36')]=qs[_0x4fdc('0x37')](_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x37')]);_0x5f41dd[_0x4fdc('0x38')]=qs[_0x4fdc('0x2f')](_[_0x4fdc('0x39')](_0x1975fb['query'],_0x369548[_0x4fdc('0x2f')]),_0x3252b5);if(_0x1975fb[_0x4fdc('0x2e')]['filter']){_0x5f41dd[_0x4fdc('0x38')]=_['merge'](_0x5f41dd[_0x4fdc('0x38')],{'$or':_[_0x4fdc('0x2c')](_0x3252b5,function(_0x214b0e){if(_0x214b0e[_0x4fdc('0x3a')]!==_0x4fdc('0x3b')){var _0x4b9d8e={};_0x4b9d8e[_0x214b0e[_0x4fdc('0x26')]]={'$like':'%'+_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x3c')]+'%'};return _0x4b9d8e;}})});}_0x5f41dd=_[_0x4fdc('0x3d')]({},_0x5f41dd,_0x1975fb[_0x4fdc('0x3e')]);var _0x2e0ef7={'where':_0x5f41dd[_0x4fdc('0x38')]};return db[_0x4fdc('0x28')][_0x4fdc('0x1e')](_0x2e0ef7)[_0x4fdc('0x24')](function(_0x5a3db5){_0x3984f8[_0x4fdc('0x1e')]=_0x5a3db5;if(_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x3f')]){_0x5f41dd[_0x4fdc('0x40')]=[{'all':!![]}];}return db[_0x4fdc('0x28')][_0x4fdc('0x41')](_0x5f41dd);})[_0x4fdc('0x24')](function(_0x748f27){_0x3984f8[_0x4fdc('0x42')]=_0x748f27;return _0x3984f8;})[_0x4fdc('0x24')](respondWithFilteredResult(_0x1dbdd2,_0x5f41dd))[_0x4fdc('0x43')](handleError(_0x1dbdd2,null));};exports[_0x4fdc('0x44')]=function(_0x5b895d,_0x3512c1){var _0x47e69e={'raw':![],'where':{'id':_0x5b895d[_0x4fdc('0x45')]['id']}},_0x2bb5a0={};_0x2bb5a0[_0x4fdc('0x2b')]=_[_0x4fdc('0x2d')](db['IntegrationReport'][_0x4fdc('0x29')]);_0x2bb5a0['query']=_[_0x4fdc('0x2d')](_0x5b895d[_0x4fdc('0x2e')]);_0x2bb5a0['filters']=_[_0x4fdc('0x30')](_0x2bb5a0[_0x4fdc('0x2b')],_0x2bb5a0[_0x4fdc('0x2e')]);_0x47e69e[_0x4fdc('0x31')]=_[_0x4fdc('0x30')](_0x2bb5a0[_0x4fdc('0x2b')],qs['fields'](_0x5b895d['query'][_0x4fdc('0x32')]));_0x47e69e['attributes']=_0x47e69e[_0x4fdc('0x31')][_0x4fdc('0x33')]?_0x47e69e[_0x4fdc('0x31')]:_0x2bb5a0['model'];if(_0x5b895d[_0x4fdc('0x2e')][_0x4fdc('0x3f')]){_0x47e69e['include']=[{'all':!![]}];}_0x47e69e=_[_0x4fdc('0x3d')]({},_0x47e69e,_0x5b895d[_0x4fdc('0x3e')]);return db['IntegrationReport']['find'](_0x47e69e)['then'](handleEntityNotFound(_0x3512c1,null))[_0x4fdc('0x24')](respondWithResult(_0x3512c1,null))[_0x4fdc('0x43')](handleError(_0x3512c1,null));};exports[_0x4fdc('0x46')]=function(_0x2a3f16,_0x37e783){return db[_0x4fdc('0x28')][_0x4fdc('0x46')](_0x2a3f16[_0x4fdc('0x47')],{})[_0x4fdc('0x24')](respondWithResult(_0x37e783,0xc9))[_0x4fdc('0x43')](handleError(_0x37e783,null));};exports['update']=function(_0x721c1b,_0x418b45){if(_0x721c1b[_0x4fdc('0x47')]['id']){delete _0x721c1b[_0x4fdc('0x47')]['id'];}return db[_0x4fdc('0x28')][_0x4fdc('0x48')]({'where':{'id':_0x721c1b[_0x4fdc('0x45')]['id']}})['then'](handleEntityNotFound(_0x418b45,null))[_0x4fdc('0x24')](saveUpdates(_0x721c1b[_0x4fdc('0x47')],null))[_0x4fdc('0x24')](respondWithResult(_0x418b45,null))[_0x4fdc('0x43')](handleError(_0x418b45,null));};exports[_0x4fdc('0x25')]=function(_0x1a50c2,_0x50bdf2){return db[_0x4fdc('0x28')][_0x4fdc('0x48')]({'where':{'id':_0x1a50c2['params']['id']}})['then'](handleEntityNotFound(_0x50bdf2,null))[_0x4fdc('0x24')](removeEntity(_0x50bdf2,null))[_0x4fdc('0x43')](handleError(_0x50bdf2,null));};exports[_0x4fdc('0x49')]=function(_0x5d2fff,_0xabd5d5){return db['IntegrationReport'][_0x4fdc('0x49')]()['then'](respondWithResult(_0xabd5d5,null))[_0x4fdc('0x43')](handleError(_0xabd5d5,null));}; \ No newline at end of file +var _0x9e31=['fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','json','reject','update','then','destroy','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','options','include','rows','catch','show','params','length','includeAll','find','create','body','describe'];(function(_0x5c1aad,_0x464acc){var _0x5d4f87=function(_0x54d49b){while(--_0x54d49b){_0x5c1aad['push'](_0x5c1aad['shift']());}};_0x5d4f87(++_0x464acc);}(_0x9e31,0x8c));var _0x19e3=function(_0x28845d,_0x5efdf5){_0x28845d=_0x28845d-0x0;var _0x2ad11b=_0x9e31[_0x28845d];return _0x2ad11b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x19e3('0x0'));var rp=require('request-promise');var moment=require(_0x19e3('0x1'));var BPromise=require(_0x19e3('0x2'));var Mustache=require(_0x19e3('0x3'));var util=require(_0x19e3('0x4'));var path=require('path');var sox=require(_0x19e3('0x5'));var csv=require('to-csv');var ejs=require(_0x19e3('0x6'));var fs=require('fs');var fs_extra=require(_0x19e3('0x7'));var _=require(_0x19e3('0x8'));var squel=require(_0x19e3('0x9'));var crypto=require(_0x19e3('0xa'));var jsforce=require(_0x19e3('0xb'));var deskjs=require(_0x19e3('0xc'));var toCsv=require(_0x19e3('0xd'));var querystring=require(_0x19e3('0xe'));var Papa=require(_0x19e3('0xf'));var Redis=require(_0x19e3('0x10'));var authService=require(_0x19e3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x19e3('0x12'));var hardwareService=require(_0x19e3('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x19e3('0x14'));var config=require(_0x19e3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x19e3('0x16'))['db'];function respondWithStatusCode(_0x222446,_0x2334dd){_0x2334dd=_0x2334dd||0xcc;return function(_0x296330){if(_0x296330){return _0x222446[_0x19e3('0x17')](_0x2334dd);}return _0x222446['status'](_0x2334dd)[_0x19e3('0x18')]();};}function respondWithResult(_0x373bae,_0x295708){_0x295708=_0x295708||0xc8;return function(_0x3af2c3){if(_0x3af2c3){return _0x373bae[_0x19e3('0x19')](_0x295708)['json'](_0x3af2c3);}};}function respondWithFilteredResult(_0xf0507c,_0x1e6318){return function(_0x3a5c67){if(_0x3a5c67){var _0x412dd9=typeof _0x1e6318['offset']===_0x19e3('0x1a')&&typeof _0x1e6318['limit']==='undefined';var _0x47e16e=_0x3a5c67[_0x19e3('0x1b')];var _0x596fca=_0x412dd9?0x0:_0x1e6318[_0x19e3('0x1c')];var _0x5e259f=_0x412dd9?_0x3a5c67[_0x19e3('0x1b')]:_0x1e6318[_0x19e3('0x1c')]+_0x1e6318[_0x19e3('0x1d')];var _0x46ce3f;if(_0x5e259f>=_0x47e16e){_0x5e259f=_0x47e16e;_0x46ce3f=0xc8;}else{_0x46ce3f=0xce;}_0xf0507c[_0x19e3('0x19')](_0x46ce3f);return _0xf0507c[_0x19e3('0x1e')]('Content-Range',_0x596fca+'-'+_0x5e259f+'/'+_0x47e16e)[_0x19e3('0x1f')](_0x3a5c67);}return null;};}function patchUpdates(_0x2cddb3){return function(_0x12af68){try{jsonpatch['apply'](_0x12af68,_0x2cddb3,!![]);}catch(_0x476b7f){return BPromise[_0x19e3('0x20')](_0x476b7f);}return _0x12af68['save']();};}function saveUpdates(_0x1c3944,_0x313d3f){return function(_0x1fc61a){if(_0x1fc61a){return _0x1fc61a[_0x19e3('0x21')](_0x1c3944)[_0x19e3('0x22')](function(_0x57b3ba){return _0x57b3ba;});}return null;};}function removeEntity(_0x238388,_0x4811bc){return function(_0x5e5f0d){if(_0x5e5f0d){return _0x5e5f0d[_0x19e3('0x23')]()['then'](function(){_0x238388[_0x19e3('0x19')](0xcc)[_0x19e3('0x18')]();});}};}function handleEntityNotFound(_0x505929,_0x320822){return function(_0x44a038){if(!_0x44a038){_0x505929['sendStatus'](0x194);}return _0x44a038;};}function handleError(_0x4380f8,_0x4adde9){_0x4adde9=_0x4adde9||0x1f4;return function(_0x1f6158){logger[_0x19e3('0x24')](_0x1f6158[_0x19e3('0x25')]);if(_0x1f6158['name']){delete _0x1f6158[_0x19e3('0x26')];}_0x4380f8[_0x19e3('0x19')](_0x4adde9)[_0x19e3('0x27')](_0x1f6158);};}exports['index']=function(_0x9195ad,_0x4cb47c){var _0x3e9588={},_0x534f50={},_0xf1f8c6={'count':0x0,'rows':[]};var _0x58612d=_['map'](db[_0x19e3('0x28')][_0x19e3('0x29')],function(_0x1773e8){return{'name':_0x1773e8[_0x19e3('0x2a')],'type':_0x1773e8['type']['key']};});_0x534f50[_0x19e3('0x2b')]=_[_0x19e3('0x2c')](_0x58612d,'name');_0x534f50[_0x19e3('0x2d')]=_[_0x19e3('0x2e')](_0x9195ad[_0x19e3('0x2d')]);_0x534f50['filters']=_[_0x19e3('0x2f')](_0x534f50['model'],_0x534f50[_0x19e3('0x2d')]);_0x3e9588[_0x19e3('0x30')]=_['intersection'](_0x534f50['model'],qs[_0x19e3('0x31')](_0x9195ad[_0x19e3('0x2d')]['fields']));_0x3e9588['attributes']=_0x3e9588[_0x19e3('0x30')]['length']?_0x3e9588[_0x19e3('0x30')]:_0x534f50['model'];if(!_0x9195ad[_0x19e3('0x2d')][_0x19e3('0x32')](_0x19e3('0x33'))){_0x3e9588[_0x19e3('0x1d')]=qs[_0x19e3('0x1d')](_0x9195ad[_0x19e3('0x2d')][_0x19e3('0x1d')]);_0x3e9588[_0x19e3('0x1c')]=qs[_0x19e3('0x1c')](_0x9195ad[_0x19e3('0x2d')][_0x19e3('0x1c')]);}_0x3e9588[_0x19e3('0x34')]=qs[_0x19e3('0x35')](_0x9195ad[_0x19e3('0x2d')][_0x19e3('0x35')]);_0x3e9588['where']=qs[_0x19e3('0x36')](_['pick'](_0x9195ad[_0x19e3('0x2d')],_0x534f50[_0x19e3('0x36')]),_0x58612d);if(_0x9195ad[_0x19e3('0x2d')][_0x19e3('0x37')]){_0x3e9588['where']=_[_0x19e3('0x38')](_0x3e9588[_0x19e3('0x39')],{'$or':_['map'](_0x58612d,function(_0x51b24a){if(_0x51b24a['type']!=='VIRTUAL'){var _0x581991={};_0x581991[_0x51b24a[_0x19e3('0x26')]]={'$like':'%'+_0x9195ad['query'][_0x19e3('0x37')]+'%'};return _0x581991;}})});}_0x3e9588=_[_0x19e3('0x38')]({},_0x3e9588,_0x9195ad[_0x19e3('0x3a')]);var _0x529dae={'where':_0x3e9588[_0x19e3('0x39')]};return db[_0x19e3('0x28')][_0x19e3('0x1b')](_0x529dae)[_0x19e3('0x22')](function(_0x36d906){_0xf1f8c6[_0x19e3('0x1b')]=_0x36d906;if(_0x9195ad[_0x19e3('0x2d')]['includeAll']){_0x3e9588[_0x19e3('0x3b')]=[{'all':!![]}];}return db[_0x19e3('0x28')]['findAll'](_0x3e9588);})['then'](function(_0x46ac96){_0xf1f8c6[_0x19e3('0x3c')]=_0x46ac96;return _0xf1f8c6;})[_0x19e3('0x22')](respondWithFilteredResult(_0x4cb47c,_0x3e9588))[_0x19e3('0x3d')](handleError(_0x4cb47c,null));};exports[_0x19e3('0x3e')]=function(_0x32bd5b,_0x4dd743){var _0x425ea2={'raw':![],'where':{'id':_0x32bd5b[_0x19e3('0x3f')]['id']}},_0x129b07={};_0x129b07[_0x19e3('0x2b')]=_[_0x19e3('0x2e')](db[_0x19e3('0x28')]['rawAttributes']);_0x129b07[_0x19e3('0x2d')]=_['keys'](_0x32bd5b['query']);_0x129b07[_0x19e3('0x36')]=_[_0x19e3('0x2f')](_0x129b07['model'],_0x129b07['query']);_0x425ea2[_0x19e3('0x30')]=_['intersection'](_0x129b07['model'],qs[_0x19e3('0x31')](_0x32bd5b[_0x19e3('0x2d')][_0x19e3('0x31')]));_0x425ea2[_0x19e3('0x30')]=_0x425ea2['attributes'][_0x19e3('0x40')]?_0x425ea2[_0x19e3('0x30')]:_0x129b07[_0x19e3('0x2b')];if(_0x32bd5b[_0x19e3('0x2d')][_0x19e3('0x41')]){_0x425ea2[_0x19e3('0x3b')]=[{'all':!![]}];}_0x425ea2=_['merge']({},_0x425ea2,_0x32bd5b[_0x19e3('0x3a')]);return db[_0x19e3('0x28')][_0x19e3('0x42')](_0x425ea2)[_0x19e3('0x22')](handleEntityNotFound(_0x4dd743,null))['then'](respondWithResult(_0x4dd743,null))[_0x19e3('0x3d')](handleError(_0x4dd743,null));};exports[_0x19e3('0x43')]=function(_0x4d93d8,_0x21fabb){return db[_0x19e3('0x28')][_0x19e3('0x43')](_0x4d93d8[_0x19e3('0x44')],{})[_0x19e3('0x22')](respondWithResult(_0x21fabb,0xc9))[_0x19e3('0x3d')](handleError(_0x21fabb,null));};exports[_0x19e3('0x21')]=function(_0x90d7ce,_0x41decd){if(_0x90d7ce[_0x19e3('0x44')]['id']){delete _0x90d7ce[_0x19e3('0x44')]['id'];}return db[_0x19e3('0x28')][_0x19e3('0x42')]({'where':{'id':_0x90d7ce['params']['id']}})[_0x19e3('0x22')](handleEntityNotFound(_0x41decd,null))['then'](saveUpdates(_0x90d7ce['body'],null))[_0x19e3('0x22')](respondWithResult(_0x41decd,null))[_0x19e3('0x3d')](handleError(_0x41decd,null));};exports[_0x19e3('0x23')]=function(_0x30cc24,_0x31b7c0){return db[_0x19e3('0x28')][_0x19e3('0x42')]({'where':{'id':_0x30cc24[_0x19e3('0x3f')]['id']}})[_0x19e3('0x22')](handleEntityNotFound(_0x31b7c0,null))[_0x19e3('0x22')](removeEntity(_0x31b7c0,null))[_0x19e3('0x3d')](handleError(_0x31b7c0,null));};exports[_0x19e3('0x45')]=function(_0x3a3076,_0x2850ca){return db[_0x19e3('0x28')][_0x19e3('0x45')]()[_0x19e3('0x22')](respondWithResult(_0x2850ca,null))[_0x19e3('0x3d')](handleError(_0x2850ca,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a6e8860..2314994 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 _0xb994=['../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb994,0x1f4));var _0x4b99=function(_0x484027,_0x5f2808){_0x484027=_0x484027-0x0;var _0x1b81e0=_0xb994[_0x484027];return _0x1b81e0;};'use strict';var _=require(_0x4b99('0x0'));var util=require(_0x4b99('0x1'));var logger=require(_0x4b99('0x2'))(_0x4b99('0x3'));var moment=require(_0x4b99('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b99('0x5'));var config=require(_0x4b99('0x6'));var attributes=require(_0x4b99('0x7'));module[_0x4b99('0x8')]=function(_0x1b1f9e,_0x266cb2){return _0x1b1f9e['define'](_0x4b99('0x9'),attributes,{'tableName':_0x4b99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7131=['api','moment','bluebird','path','rimraf','../../config/environment','exports','IntegrationReport','report_integration','lodash','../../config/logger'];(function(_0x409a21,_0x5097be){var _0x4fa46d=function(_0x25aab6){while(--_0x25aab6){_0x409a21['push'](_0x409a21['shift']());}};_0x4fa46d(++_0x5097be);}(_0x7131,0xda));var _0x1713=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x7131[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x1713('0x0'));var util=require('util');var logger=require(_0x1713('0x1'))(_0x1713('0x2'));var moment=require(_0x1713('0x3'));var BPromise=require(_0x1713('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1713('0x5'));var rimraf=require(_0x1713('0x6'));var config=require(_0x1713('0x7'));var attributes=require('./integrationReport.attributes');module[_0x1713('0x8')]=function(_0x41d15f,_0x37c984){return _0x41d15f['define'](_0x1713('0x9'),attributes,{'tableName':_0x1713('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 31c4fd6..919d9c4 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x1967,0x173));var _0x7196=function(_0x10ecfc,_0x53bf69){_0x10ecfc=_0x10ecfc-0x0;var _0xf08cf=_0x1967[_0x10ecfc];return _0xf08cf;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2631ea,_0x43e861){var _0x4e2bc6=function(_0x190798){while(--_0x190798){_0x2631ea['push'](_0x2631ea['shift']());}};_0x4e2bc6(++_0x43e861);}(_0x0295,0x1f0));var _0x5029=function(_0x23a673,_0x31e4bc){_0x23a673=_0x23a673-0x0;var _0x2213b7=_0x0295[_0x23a673];return _0x2213b7;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 3b09e12..c866b69 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 _0xe0cc=['addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x5d51ce,_0x536f30){var _0x425f59=function(_0x18e1ff){while(--_0x18e1ff){_0x5d51ce['push'](_0x5d51ce['shift']());}};_0x425f59(++_0x536f30);}(_0xe0cc,0x1cd));var _0xce0c=function(_0x306ba0,_0x1a06f3){_0x306ba0=_0x306ba0-0x0;var _0x322e60=_0xe0cc[_0x306ba0];return _0x322e60;};'use strict';var multer=require(_0xce0c('0x0'));var util=require(_0xce0c('0x1'));var path=require(_0xce0c('0x2'));var timeout=require('connect-timeout');var express=require(_0xce0c('0x3'));var router=express[_0xce0c('0x4')]();var fs_extra=require(_0xce0c('0x5'));var auth=require(_0xce0c('0x6'));var interaction=require(_0xce0c('0x7'));var config=require(_0xce0c('0x8'));var controller=require(_0xce0c('0x9'));router[_0xce0c('0xa')]('/',auth[_0xce0c('0xb')](),controller[_0xce0c('0xc')]);router[_0xce0c('0xa')](_0xce0c('0xd'),auth['isAuthenticated'](),controller[_0xce0c('0xe')]);router[_0xce0c('0xa')](_0xce0c('0xf'),auth[_0xce0c('0xb')](),controller[_0xce0c('0x10')]);router[_0xce0c('0x11')]('/',auth['isAuthenticated'](),controller[_0xce0c('0x12')]);router['post'](_0xce0c('0xf'),auth['isAuthenticated'](),controller[_0xce0c('0x13')]);router[_0xce0c('0x11')](_0xce0c('0x14'),auth['isAuthenticated'](),controller[_0xce0c('0x15')]);router['put'](_0xce0c('0xd'),auth[_0xce0c('0xb')](),controller[_0xce0c('0x16')]);router[_0xce0c('0x17')](_0xce0c('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x342a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x342a,0xa2));var _0xa342=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x342a[_0x164eca];return _0x2ce562;};'use strict';var multer=require(_0xa342('0x0'));var util=require(_0xa342('0x1'));var path=require(_0xa342('0x2'));var timeout=require(_0xa342('0x3'));var express=require('express');var router=express[_0xa342('0x4')]();var fs_extra=require(_0xa342('0x5'));var auth=require(_0xa342('0x6'));var interaction=require(_0xa342('0x7'));var config=require(_0xa342('0x8'));var controller=require(_0xa342('0x9'));router[_0xa342('0xa')]('/',auth[_0xa342('0xb')](),controller[_0xa342('0xc')]);router[_0xa342('0xa')](_0xa342('0xd'),auth[_0xa342('0xb')](),controller['show']);router[_0xa342('0xa')](_0xa342('0xe'),auth[_0xa342('0xb')](),controller[_0xa342('0xf')]);router[_0xa342('0x10')]('/',auth[_0xa342('0xb')](),controller[_0xa342('0x11')]);router[_0xa342('0x10')](_0xa342('0xe'),auth[_0xa342('0xb')](),controller[_0xa342('0x12')]);router[_0xa342('0x10')](_0xa342('0x13'),auth[_0xa342('0xb')](),controller['addIntervals']);router[_0xa342('0x14')](_0xa342('0xd'),auth[_0xa342('0xb')](),controller[_0xa342('0x15')]);router['delete'](_0xa342('0xd'),auth[_0xa342('0xb')](),controller[_0xa342('0x16')]);module[_0xa342('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d2744aa..9c3b2ce 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 _0x5481=['STRING','sequelize'];(function(_0x532ee1,_0x538b50){var _0xecf3b1=function(_0x2bba71){while(--_0x2bba71){_0x532ee1['push'](_0x532ee1['shift']());}};_0xecf3b1(++_0x538b50);}(_0x5481,0x101));var _0x1548=function(_0x2aca59,_0x24a235){_0x2aca59=_0x2aca59-0x0;var _0x5933ec=_0x5481[_0x2aca59];return _0x5933ec;};'use strict';var Sequelize=require(_0x1548('0x0'));module['exports']={'name':{'type':Sequelize[_0x1548('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x1c55=['STRING','sequelize','exports'];(function(_0x4d687e,_0xe71d46){var _0x527277=function(_0xeb9852){while(--_0xeb9852){_0x4d687e['push'](_0x4d687e['shift']());}};_0x527277(++_0xe71d46);}(_0x1c55,0xf1));var _0x51c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1c55[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x51c5('0x0'));module[_0x51c5('0x1')]={'name':{'type':Sequelize[_0x51c5('0x2')]},'description':{'type':Sequelize[_0x51c5('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 020cbdc..035ca5a 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 _0x6ce2=['sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','filter','addIntervals','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4ae1c8,_0x3f18c1){var _0x2eb247=function(_0x3574bc){while(--_0x3574bc){_0x4ae1c8['push'](_0x4ae1c8['shift']());}};_0x2eb247(++_0x3f18c1);}(_0x6ce2,0xfe));var _0x26ce=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6ce2[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x26ce('0x0'));var rimraf=require(_0x26ce('0x1'));var zipdir=require(_0x26ce('0x2'));var jsonpatch=require(_0x26ce('0x3'));var rp=require(_0x26ce('0x4'));var moment=require(_0x26ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x26ce('0x6'));var util=require('util');var path=require('path');var sox=require(_0x26ce('0x7'));var csv=require('to-csv');var ejs=require(_0x26ce('0x8'));var fs=require('fs');var fs_extra=require(_0x26ce('0x9'));var _=require(_0x26ce('0xa'));var squel=require(_0x26ce('0xb'));var crypto=require('crypto');var jsforce=require(_0x26ce('0xc'));var deskjs=require(_0x26ce('0xd'));var toCsv=require(_0x26ce('0xe'));var querystring=require(_0x26ce('0xf'));var Papa=require(_0x26ce('0x10'));var Redis=require(_0x26ce('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x26ce('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26ce('0x13'));var utils=require(_0x26ce('0x14'));var config=require(_0x26ce('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x26ce('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x58585b,_0x575db9){_0x575db9=_0x575db9||0xcc;return function(_0x4246b1){if(_0x4246b1){return _0x58585b[_0x26ce('0x17')](_0x575db9);}return _0x58585b[_0x26ce('0x18')](_0x575db9)[_0x26ce('0x19')]();};}function respondWithResult(_0x1bce46,_0x1d0eaf){_0x1d0eaf=_0x1d0eaf||0xc8;return function(_0x13f768){if(_0x13f768){return _0x1bce46[_0x26ce('0x18')](_0x1d0eaf)[_0x26ce('0x1a')](_0x13f768);}};}function respondWithFilteredResult(_0x159849,_0x43c83e){return function(_0x4d37d4){if(_0x4d37d4){var _0x5871ae=typeof _0x43c83e[_0x26ce('0x1b')]===_0x26ce('0x1c')&&typeof _0x43c83e[_0x26ce('0x1d')]==='undefined';var _0x5f228f=_0x4d37d4[_0x26ce('0x1e')];var _0x1d744b=_0x5871ae?0x0:_0x43c83e[_0x26ce('0x1b')];var _0x5ecfbf=_0x5871ae?_0x4d37d4[_0x26ce('0x1e')]:_0x43c83e[_0x26ce('0x1b')]+_0x43c83e[_0x26ce('0x1d')];var _0x4488a7;if(_0x5ecfbf>=_0x5f228f){_0x5ecfbf=_0x5f228f;_0x4488a7=0xc8;}else{_0x4488a7=0xce;}_0x159849[_0x26ce('0x18')](_0x4488a7);return _0x159849['set'](_0x26ce('0x1f'),_0x1d744b+'-'+_0x5ecfbf+'/'+_0x5f228f)[_0x26ce('0x1a')](_0x4d37d4);}return null;};}function patchUpdates(_0x316a9e){return function(_0x34ac0f){try{jsonpatch[_0x26ce('0x20')](_0x34ac0f,_0x316a9e,!![]);}catch(_0x3022a5){return BPromise[_0x26ce('0x21')](_0x3022a5);}return _0x34ac0f[_0x26ce('0x22')]();};}function saveUpdates(_0x166992,_0x2c5b80){return function(_0x36fcec){if(_0x36fcec){return _0x36fcec[_0x26ce('0x23')](_0x166992)[_0x26ce('0x24')](function(_0x38defa){return _0x38defa;});}return null;};}function removeEntity(_0x1acabc,_0x52a354){return function(_0x276f44){if(_0x276f44){return _0x276f44['destroy']()[_0x26ce('0x24')](function(){var _0x7f9c80=_0x276f44[_0x26ce('0x25')]({'plain':!![]});var _0x4be760=_0x26ce('0x26');return db[_0x26ce('0x27')][_0x26ce('0x28')]({'where':{'type':_0x4be760,'resourceId':_0x7f9c80['id']}})[_0x26ce('0x24')](function(){return _0x276f44;});})['then'](function(){_0x1acabc[_0x26ce('0x18')](0xcc)[_0x26ce('0x19')]();});}};}function handleEntityNotFound(_0x4a7d5d,_0x5eec53){return function(_0x282579){if(!_0x282579){_0x4a7d5d['sendStatus'](0x194);}return _0x282579;};}function handleError(_0x4089b8,_0x9a28d9){_0x9a28d9=_0x9a28d9||0x1f4;return function(_0x3d335f){logger[_0x26ce('0x29')](_0x3d335f[_0x26ce('0x2a')]);if(_0x3d335f[_0x26ce('0x2b')]){delete _0x3d335f[_0x26ce('0x2b')];}_0x4089b8[_0x26ce('0x18')](_0x9a28d9)[_0x26ce('0x2c')](_0x3d335f);};}exports[_0x26ce('0x2d')]=function(_0x43067c,_0x160236){var _0x3c0c72={},_0x3c075b={},_0x4d9a59={'count':0x0,'rows':[]};var _0x903cdc=_[_0x26ce('0x2e')](db[_0x26ce('0x2f')][_0x26ce('0x30')],function(_0x56deea){return{'name':_0x56deea['fieldName'],'type':_0x56deea['type'][_0x26ce('0x31')]};});_0x3c075b['model']=_[_0x26ce('0x2e')](_0x903cdc,_0x26ce('0x2b'));_0x3c075b[_0x26ce('0x32')]=_[_0x26ce('0x33')](_0x43067c[_0x26ce('0x32')]);_0x3c075b[_0x26ce('0x34')]=_[_0x26ce('0x35')](_0x3c075b['model'],_0x3c075b[_0x26ce('0x32')]);_0x3c0c72[_0x26ce('0x36')]=_[_0x26ce('0x35')](_0x3c075b[_0x26ce('0x37')],qs[_0x26ce('0x38')](_0x43067c['query']['fields']));_0x3c0c72['attributes']=_0x3c0c72[_0x26ce('0x36')][_0x26ce('0x39')]?_0x3c0c72[_0x26ce('0x36')]:_0x3c075b[_0x26ce('0x37')];if(!_0x43067c[_0x26ce('0x32')][_0x26ce('0x3a')](_0x26ce('0x3b'))){_0x3c0c72[_0x26ce('0x1d')]=qs[_0x26ce('0x1d')](_0x43067c[_0x26ce('0x32')][_0x26ce('0x1d')]);_0x3c0c72[_0x26ce('0x1b')]=qs[_0x26ce('0x1b')](_0x43067c['query']['offset']);}_0x3c0c72[_0x26ce('0x3c')]=qs[_0x26ce('0x3d')](_0x43067c[_0x26ce('0x32')]['sort']);_0x3c0c72['where']=qs[_0x26ce('0x34')](_[_0x26ce('0x3e')](_0x43067c[_0x26ce('0x32')],_0x3c075b[_0x26ce('0x34')]),_0x903cdc);if(_0x43067c['query']['filter']){_0x3c0c72[_0x26ce('0x3f')]=_['merge'](_0x3c0c72[_0x26ce('0x3f')],{'$or':_[_0x26ce('0x2e')](_0x903cdc,function(_0x14d800){if(_0x14d800[_0x26ce('0x40')]!=='VIRTUAL'){var _0x31f91b={};_0x31f91b[_0x14d800[_0x26ce('0x2b')]]={'$like':'%'+_0x43067c['query']['filter']+'%'};return _0x31f91b;}})});}_0x3c0c72=_[_0x26ce('0x41')]({},_0x3c0c72,_0x43067c[_0x26ce('0x42')]);var _0x57f08e={'where':_0x3c0c72[_0x26ce('0x3f')]};return db['Interval'][_0x26ce('0x1e')](_0x57f08e)['then'](function(_0x10cf5a){_0x4d9a59[_0x26ce('0x1e')]=_0x10cf5a;if(_0x43067c['query'][_0x26ce('0x43')]){_0x3c0c72[_0x26ce('0x44')]=[{'all':!![]}];}return db[_0x26ce('0x2f')][_0x26ce('0x45')](_0x3c0c72);})[_0x26ce('0x24')](function(_0x580df1){_0x4d9a59[_0x26ce('0x46')]=_0x580df1;return _0x4d9a59;})[_0x26ce('0x24')](respondWithFilteredResult(_0x160236,_0x3c0c72))[_0x26ce('0x47')](handleError(_0x160236,null));};exports['show']=function(_0x13372a,_0x28012c){var _0x3e0f38={'raw':!![],'where':{'id':_0x13372a[_0x26ce('0x48')]['id']}},_0x50fe8a={};_0x50fe8a[_0x26ce('0x37')]=_[_0x26ce('0x33')](db[_0x26ce('0x2f')][_0x26ce('0x30')]);_0x50fe8a[_0x26ce('0x32')]=_[_0x26ce('0x33')](_0x13372a['query']);_0x50fe8a[_0x26ce('0x34')]=_[_0x26ce('0x35')](_0x50fe8a[_0x26ce('0x37')],_0x50fe8a[_0x26ce('0x32')]);_0x3e0f38[_0x26ce('0x36')]=_[_0x26ce('0x35')](_0x50fe8a[_0x26ce('0x37')],qs[_0x26ce('0x38')](_0x13372a['query']['fields']));_0x3e0f38[_0x26ce('0x36')]=_0x3e0f38[_0x26ce('0x36')][_0x26ce('0x39')]?_0x3e0f38['attributes']:_0x50fe8a[_0x26ce('0x37')];if(_0x13372a[_0x26ce('0x32')][_0x26ce('0x43')]){_0x3e0f38['include']=[{'all':!![]}];}_0x3e0f38=_[_0x26ce('0x41')]({},_0x3e0f38,_0x13372a[_0x26ce('0x42')]);return db['Interval'][_0x26ce('0x49')](_0x3e0f38)['then'](handleEntityNotFound(_0x28012c,null))[_0x26ce('0x24')](respondWithResult(_0x28012c,null))[_0x26ce('0x47')](handleError(_0x28012c,null));};exports[_0x26ce('0x4a')]=function(_0x4e44db,_0x41122e){return db[_0x26ce('0x2f')][_0x26ce('0x4a')](_0x4e44db[_0x26ce('0x4b')],{})[_0x26ce('0x24')](function(_0x2fb217){var _0x2cf366=_0x4e44db[_0x26ce('0x4c')][_0x26ce('0x25')]({'plain':!![]});if(!_0x2cf366)throw new Error(_0x26ce('0x4d'));if(_0x2cf366[_0x26ce('0x4e')]==='user'){var _0x4f7072=_0x2fb217['get']({'plain':!![]});var _0x1bceaf=_0x26ce('0x26');return db[_0x26ce('0x4f')]['find']({'where':{'name':_0x1bceaf,'userProfileId':_0x2cf366['userProfileId']},'raw':!![]})['then'](function(_0x35185c){if(_0x35185c&&_0x35185c[_0x26ce('0x50')]===0x0){return db[_0x26ce('0x27')]['create']({'name':_0x4f7072['name'],'resourceId':_0x4f7072['id'],'type':_0x35185c['name'],'sectionId':_0x35185c['id']},{})[_0x26ce('0x24')](function(){return _0x2fb217;});}else{return _0x2fb217;}})[_0x26ce('0x47')](function(_0x1fcb78){logger['error'](_0x26ce('0x51'),_0x1fcb78);throw _0x1fcb78;});}return _0x2fb217;})[_0x26ce('0x24')](respondWithResult(_0x41122e,0xc9))[_0x26ce('0x47')](handleError(_0x41122e,null));};exports['update']=function(_0xe2f276,_0xf7143b){if(_0xe2f276[_0x26ce('0x4b')]['id']){delete _0xe2f276[_0x26ce('0x4b')]['id'];}return db[_0x26ce('0x2f')]['find']({'where':{'id':_0xe2f276[_0x26ce('0x48')]['id']}})['then'](handleEntityNotFound(_0xf7143b,null))[_0x26ce('0x24')](saveUpdates(_0xe2f276['body'],null))[_0x26ce('0x24')](respondWithResult(_0xf7143b,null))['catch'](handleError(_0xf7143b,null));};exports[_0x26ce('0x28')]=function(_0x1ac354,_0x30cae){return db[_0x26ce('0x2f')][_0x26ce('0x49')]({'where':{'id':_0x1ac354[_0x26ce('0x48')]['id']}})['then'](handleEntityNotFound(_0x30cae,null))[_0x26ce('0x24')](removeEntity(_0x30cae,null))[_0x26ce('0x47')](handleError(_0x30cae,null));};exports[_0x26ce('0x52')]=function(_0x5635ea,_0x53cc1f,_0x5e9091){if(_0x5635ea[_0x26ce('0x4b')]['id']){delete _0x5635ea[_0x26ce('0x4b')]['id'];}return db[_0x26ce('0x2f')][_0x26ce('0x49')]({'where':{'id':_0x5635ea[_0x26ce('0x48')]['id']}})[_0x26ce('0x24')](handleEntityNotFound(_0x53cc1f,null))['then'](function(_0x413e76){if(_0x413e76){_0x5635ea[_0x26ce('0x4b')]['IntervalId']=_0x413e76['id'];return db['Interval']['create'](_0x5635ea[_0x26ce('0x4b')]);}})['then'](respondWithResult(_0x53cc1f,null))[_0x26ce('0x47')](handleError(_0x53cc1f,null));};exports['getIntervals']=function(_0xac64e9,_0x4b31eb,_0x47e443){var _0x4504b7={};var _0x1e113c={};var _0x43bee6;var _0x282f5e;return db[_0x26ce('0x2f')][_0x26ce('0x53')]({'where':{'id':_0xac64e9['params']['id']}})['then'](handleEntityNotFound(_0x4b31eb,null))['then'](function(_0x4fcfc7){if(_0x4fcfc7){_0x43bee6=_0x4fcfc7;_0x1e113c[_0x26ce('0x37')]=_[_0x26ce('0x33')](db[_0x26ce('0x2f')][_0x26ce('0x30')]);_0x1e113c[_0x26ce('0x32')]=_['keys'](_0xac64e9[_0x26ce('0x32')]);_0x1e113c[_0x26ce('0x34')]=_[_0x26ce('0x35')](_0x1e113c['model'],_0x1e113c[_0x26ce('0x32')]);_0x4504b7['attributes']=_[_0x26ce('0x35')](_0x1e113c[_0x26ce('0x37')],qs[_0x26ce('0x38')](_0xac64e9[_0x26ce('0x32')]['fields']));_0x4504b7[_0x26ce('0x36')]=_0x4504b7['attributes'][_0x26ce('0x39')]?_0x4504b7[_0x26ce('0x36')]:_0x1e113c[_0x26ce('0x37')];_0x4504b7['order']=qs[_0x26ce('0x3d')](_0xac64e9['query']['sort']);_0x4504b7[_0x26ce('0x3f')]=qs[_0x26ce('0x34')](_['pick'](_0xac64e9['query'],_0x1e113c[_0x26ce('0x34')]));if(_0xac64e9[_0x26ce('0x32')]['filter']){_0x4504b7[_0x26ce('0x3f')]=_['merge'](_0x4504b7['where'],{'$or':_[_0x26ce('0x2e')](_0x4504b7[_0x26ce('0x36')],function(_0x1eab97){var _0x4adade={};_0x4adade[_0x1eab97]={'$like':'%'+_0xac64e9[_0x26ce('0x32')][_0x26ce('0x54')]+'%'};return _0x4adade;})});}_0x4504b7=_[_0x26ce('0x41')]({},_0x4504b7,_0xac64e9['options']);return _0x43bee6['getIntervals'](_0x4504b7);}})[_0x26ce('0x24')](function(_0x2d5177){if(_0x2d5177){_0x282f5e=_0x2d5177['length'];if(!_0xac64e9['query'][_0x26ce('0x3a')](_0x26ce('0x3b'))){_0x4504b7[_0x26ce('0x1d')]=qs['limit'](_0xac64e9[_0x26ce('0x32')][_0x26ce('0x1d')]);_0x4504b7[_0x26ce('0x1b')]=qs[_0x26ce('0x1b')](_0xac64e9[_0x26ce('0x32')][_0x26ce('0x1b')]);}return _0x43bee6['getIntervals'](_0x4504b7);}})[_0x26ce('0x24')](function(_0x57a261){if(_0x57a261){return _0x57a261?{'count':_0x282f5e,'rows':_0x57a261}:null;}})[_0x26ce('0x24')](respondWithResult(_0x4b31eb,null))[_0x26ce('0x47')](handleError(_0x4b31eb,null));};exports[_0x26ce('0x55')]=function(_0x4408c9,_0x22b479,_0x10572f){return db[_0x26ce('0x2f')]['findOne']({'where':{'id':_0x4408c9['params']['id']}})[_0x26ce('0x24')](handleEntityNotFound(_0x22b479,null))[_0x26ce('0x24')](function(_0x36ed4c){if(_0x36ed4c){return db['sequelize'][_0x26ce('0x56')](function(_0x49053d){return db[_0x26ce('0x2f')][_0x26ce('0x28')]({'where':{'IntervalId':_0x4408c9['params']['id']},'transaction':_0x49053d})[_0x26ce('0x24')](function(_0x35a463){var _0x5ec1de=_[_0x26ce('0x2e')](_0x4408c9[_0x26ce('0x4b')],function(_0x6615de){delete _0x6615de['id'];_0x6615de['IntervalId']=_0x4408c9[_0x26ce('0x48')]['id'];return _0x6615de;});return db[_0x26ce('0x2f')]['bulkCreate'](_0x5ec1de,{'transaction':_0x49053d});});})[_0x26ce('0x24')](function(){return db['Interval'][_0x26ce('0x45')]({'where':{'IntervalId':_0x4408c9[_0x26ce('0x48')]['id']}});});}})['then'](respondWithResult(_0x22b479,null))[_0x26ce('0x47')](handleError(_0x22b479,null));}; \ No newline at end of file +var _0xa105=['destroy','get','Intervals','UserProfileResource','error','name','send','Interval','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','nolimit','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then'];(function(_0x31603a,_0x4eacdc){var _0x27b78b=function(_0x209640){while(--_0x209640){_0x31603a['push'](_0x31603a['shift']());}};_0x27b78b(++_0x4eacdc);}(_0xa105,0x19e));var _0x5a10=function(_0x2791d7,_0x52cf56){_0x2791d7=_0x2791d7-0x0;var _0x53f8c1=_0xa105[_0x2791d7];return _0x53f8c1;};'use strict';var emlformat=require(_0x5a10('0x0'));var rimraf=require(_0x5a10('0x1'));var zipdir=require(_0x5a10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a10('0x3'));var moment=require(_0x5a10('0x4'));var BPromise=require(_0x5a10('0x5'));var Mustache=require(_0x5a10('0x6'));var util=require(_0x5a10('0x7'));var path=require(_0x5a10('0x8'));var sox=require('sox');var csv=require(_0x5a10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a10('0xa'));var _=require(_0x5a10('0xb'));var squel=require(_0x5a10('0xc'));var crypto=require(_0x5a10('0xd'));var jsforce=require(_0x5a10('0xe'));var deskjs=require(_0x5a10('0xf'));var toCsv=require(_0x5a10('0x9'));var querystring=require('querystring');var Papa=require(_0x5a10('0x10'));var Redis=require(_0x5a10('0x11'));var authService=require(_0x5a10('0x12'));var qs=require(_0x5a10('0x13'));var as=require(_0x5a10('0x14'));var hardwareService=require(_0x5a10('0x15'));var logger=require(_0x5a10('0x16'))(_0x5a10('0x17'));var utils=require(_0x5a10('0x18'));var config=require(_0x5a10('0x19'));var licenseUtil=require(_0x5a10('0x1a'));var db=require('../../mysqldb')['db'];var extensions=require(_0x5a10('0x1b'));function respondWithStatusCode(_0xfead5,_0x3c3612){_0x3c3612=_0x3c3612||0xcc;return function(_0x4ab5dc){if(_0x4ab5dc){return _0xfead5[_0x5a10('0x1c')](_0x3c3612);}return _0xfead5[_0x5a10('0x1d')](_0x3c3612)[_0x5a10('0x1e')]();};}function respondWithResult(_0x15ac43,_0x4a098a){_0x4a098a=_0x4a098a||0xc8;return function(_0xa7faad){if(_0xa7faad){return _0x15ac43[_0x5a10('0x1d')](_0x4a098a)[_0x5a10('0x1f')](_0xa7faad);}};}function respondWithFilteredResult(_0xbcda0b,_0x2d7281){return function(_0x796659){if(_0x796659){var _0x4bdf88=typeof _0x2d7281[_0x5a10('0x20')]==='undefined'&&typeof _0x2d7281[_0x5a10('0x21')]===_0x5a10('0x22');var _0x11fb90=_0x796659[_0x5a10('0x23')];var _0x54da25=_0x4bdf88?0x0:_0x2d7281[_0x5a10('0x20')];var _0x1f00b1=_0x4bdf88?_0x796659[_0x5a10('0x23')]:_0x2d7281[_0x5a10('0x20')]+_0x2d7281[_0x5a10('0x21')];var _0x3b8f98;if(_0x1f00b1>=_0x11fb90){_0x1f00b1=_0x11fb90;_0x3b8f98=0xc8;}else{_0x3b8f98=0xce;}_0xbcda0b[_0x5a10('0x1d')](_0x3b8f98);return _0xbcda0b[_0x5a10('0x24')]('Content-Range',_0x54da25+'-'+_0x1f00b1+'/'+_0x11fb90)[_0x5a10('0x1f')](_0x796659);}return null;};}function patchUpdates(_0x316cec){return function(_0x56beba){try{jsonpatch[_0x5a10('0x25')](_0x56beba,_0x316cec,!![]);}catch(_0x1cabbb){return BPromise[_0x5a10('0x26')](_0x1cabbb);}return _0x56beba['save']();};}function saveUpdates(_0x41227a,_0x29954f){return function(_0xa1b9bb){if(_0xa1b9bb){return _0xa1b9bb[_0x5a10('0x27')](_0x41227a)[_0x5a10('0x28')](function(_0x565c78){return _0x565c78;});}return null;};}function removeEntity(_0x1e5d51,_0x1ec121){return function(_0x19b8b8){if(_0x19b8b8){return _0x19b8b8[_0x5a10('0x29')]()['then'](function(){var _0xaa45e3=_0x19b8b8[_0x5a10('0x2a')]({'plain':!![]});var _0x22b4b7=_0x5a10('0x2b');return db[_0x5a10('0x2c')][_0x5a10('0x29')]({'where':{'type':_0x22b4b7,'resourceId':_0xaa45e3['id']}})[_0x5a10('0x28')](function(){return _0x19b8b8;});})[_0x5a10('0x28')](function(){_0x1e5d51[_0x5a10('0x1d')](0xcc)[_0x5a10('0x1e')]();});}};}function handleEntityNotFound(_0x55fc52,_0x378943){return function(_0x1fbef7){if(!_0x1fbef7){_0x55fc52['sendStatus'](0x194);}return _0x1fbef7;};}function handleError(_0x234406,_0xe2b841){_0xe2b841=_0xe2b841||0x1f4;return function(_0x16041d){logger[_0x5a10('0x2d')](_0x16041d['stack']);if(_0x16041d[_0x5a10('0x2e')]){delete _0x16041d[_0x5a10('0x2e')];}_0x234406[_0x5a10('0x1d')](_0xe2b841)[_0x5a10('0x2f')](_0x16041d);};}exports['index']=function(_0x443066,_0x5dae9b){var _0x5b1e74={},_0xf3940b={},_0x5949b0={'count':0x0,'rows':[]};var _0x4b0dd7=_['map'](db[_0x5a10('0x30')][_0x5a10('0x31')],function(_0x5404cf){return{'name':_0x5404cf['fieldName'],'type':_0x5404cf[_0x5a10('0x32')][_0x5a10('0x33')]};});_0xf3940b['model']=_[_0x5a10('0x34')](_0x4b0dd7,_0x5a10('0x2e'));_0xf3940b[_0x5a10('0x35')]=_['keys'](_0x443066['query']);_0xf3940b[_0x5a10('0x36')]=_[_0x5a10('0x37')](_0xf3940b[_0x5a10('0x38')],_0xf3940b[_0x5a10('0x35')]);_0x5b1e74[_0x5a10('0x39')]=_[_0x5a10('0x37')](_0xf3940b[_0x5a10('0x38')],qs[_0x5a10('0x3a')](_0x443066['query']['fields']));_0x5b1e74[_0x5a10('0x39')]=_0x5b1e74[_0x5a10('0x39')][_0x5a10('0x3b')]?_0x5b1e74[_0x5a10('0x39')]:_0xf3940b[_0x5a10('0x38')];if(!_0x443066['query']['hasOwnProperty']('nolimit')){_0x5b1e74[_0x5a10('0x21')]=qs[_0x5a10('0x21')](_0x443066[_0x5a10('0x35')]['limit']);_0x5b1e74[_0x5a10('0x20')]=qs[_0x5a10('0x20')](_0x443066[_0x5a10('0x35')][_0x5a10('0x20')]);}_0x5b1e74[_0x5a10('0x3c')]=qs[_0x5a10('0x3d')](_0x443066[_0x5a10('0x35')][_0x5a10('0x3d')]);_0x5b1e74[_0x5a10('0x3e')]=qs[_0x5a10('0x36')](_[_0x5a10('0x3f')](_0x443066[_0x5a10('0x35')],_0xf3940b['filters']),_0x4b0dd7);if(_0x443066['query'][_0x5a10('0x40')]){_0x5b1e74[_0x5a10('0x3e')]=_[_0x5a10('0x41')](_0x5b1e74[_0x5a10('0x3e')],{'$or':_['map'](_0x4b0dd7,function(_0x1dc2c){if(_0x1dc2c[_0x5a10('0x32')]!==_0x5a10('0x42')){var _0x257696={};_0x257696[_0x1dc2c[_0x5a10('0x2e')]]={'$like':'%'+_0x443066[_0x5a10('0x35')][_0x5a10('0x40')]+'%'};return _0x257696;}})});}_0x5b1e74=_[_0x5a10('0x41')]({},_0x5b1e74,_0x443066[_0x5a10('0x43')]);var _0x5b5023={'where':_0x5b1e74[_0x5a10('0x3e')]};return db[_0x5a10('0x30')][_0x5a10('0x23')](_0x5b5023)[_0x5a10('0x28')](function(_0x39293c){_0x5949b0['count']=_0x39293c;if(_0x443066[_0x5a10('0x35')][_0x5a10('0x44')]){_0x5b1e74['include']=[{'all':!![]}];}return db[_0x5a10('0x30')]['findAll'](_0x5b1e74);})['then'](function(_0x3d2fd8){_0x5949b0[_0x5a10('0x45')]=_0x3d2fd8;return _0x5949b0;})['then'](respondWithFilteredResult(_0x5dae9b,_0x5b1e74))[_0x5a10('0x46')](handleError(_0x5dae9b,null));};exports['show']=function(_0x3fb8ee,_0x4c96a3){var _0x49ad88={'raw':!![],'where':{'id':_0x3fb8ee[_0x5a10('0x47')]['id']}},_0x34d242={};_0x34d242['model']=_[_0x5a10('0x48')](db[_0x5a10('0x30')]['rawAttributes']);_0x34d242['query']=_[_0x5a10('0x48')](_0x3fb8ee['query']);_0x34d242[_0x5a10('0x36')]=_[_0x5a10('0x37')](_0x34d242['model'],_0x34d242[_0x5a10('0x35')]);_0x49ad88['attributes']=_[_0x5a10('0x37')](_0x34d242[_0x5a10('0x38')],qs[_0x5a10('0x3a')](_0x3fb8ee[_0x5a10('0x35')][_0x5a10('0x3a')]));_0x49ad88[_0x5a10('0x39')]=_0x49ad88[_0x5a10('0x39')]['length']?_0x49ad88[_0x5a10('0x39')]:_0x34d242[_0x5a10('0x38')];if(_0x3fb8ee[_0x5a10('0x35')][_0x5a10('0x44')]){_0x49ad88['include']=[{'all':!![]}];}_0x49ad88=_[_0x5a10('0x41')]({},_0x49ad88,_0x3fb8ee[_0x5a10('0x43')]);return db[_0x5a10('0x30')][_0x5a10('0x49')](_0x49ad88)[_0x5a10('0x28')](handleEntityNotFound(_0x4c96a3,null))['then'](respondWithResult(_0x4c96a3,null))[_0x5a10('0x46')](handleError(_0x4c96a3,null));};exports['create']=function(_0x46ba90,_0x185a08){return db[_0x5a10('0x30')][_0x5a10('0x4a')](_0x46ba90[_0x5a10('0x4b')],{})['then'](function(_0x4e53a0){var _0x1e68fe=_0x46ba90['user'][_0x5a10('0x2a')]({'plain':!![]});if(!_0x1e68fe)throw new Error(_0x5a10('0x4c'));if(_0x1e68fe[_0x5a10('0x4d')]===_0x5a10('0x4e')){var _0x450d08=_0x4e53a0['get']({'plain':!![]});var _0x299f1d=_0x5a10('0x2b');return db[_0x5a10('0x4f')][_0x5a10('0x49')]({'where':{'name':_0x299f1d,'userProfileId':_0x1e68fe[_0x5a10('0x50')]},'raw':!![]})[_0x5a10('0x28')](function(_0x4a933e){if(_0x4a933e&&_0x4a933e[_0x5a10('0x51')]===0x0){return db['UserProfileResource'][_0x5a10('0x4a')]({'name':_0x450d08[_0x5a10('0x2e')],'resourceId':_0x450d08['id'],'type':_0x4a933e[_0x5a10('0x2e')],'sectionId':_0x4a933e['id']},{})[_0x5a10('0x28')](function(){return _0x4e53a0;});}else{return _0x4e53a0;}})['catch'](function(_0x1c88cd){logger['error'](_0x5a10('0x52'),_0x1c88cd);throw _0x1c88cd;});}return _0x4e53a0;})['then'](respondWithResult(_0x185a08,0xc9))['catch'](handleError(_0x185a08,null));};exports['update']=function(_0x524edb,_0x4f3314){if(_0x524edb['body']['id']){delete _0x524edb[_0x5a10('0x4b')]['id'];}return db[_0x5a10('0x30')][_0x5a10('0x49')]({'where':{'id':_0x524edb[_0x5a10('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f3314,null))[_0x5a10('0x28')](saveUpdates(_0x524edb[_0x5a10('0x4b')],null))[_0x5a10('0x28')](respondWithResult(_0x4f3314,null))[_0x5a10('0x46')](handleError(_0x4f3314,null));};exports[_0x5a10('0x29')]=function(_0x4c7916,_0xffc83d){return db[_0x5a10('0x30')][_0x5a10('0x49')]({'where':{'id':_0x4c7916[_0x5a10('0x47')]['id']}})[_0x5a10('0x28')](handleEntityNotFound(_0xffc83d,null))['then'](removeEntity(_0xffc83d,null))[_0x5a10('0x46')](handleError(_0xffc83d,null));};exports[_0x5a10('0x53')]=function(_0xde4757,_0x1f9001,_0x15ab1e){if(_0xde4757[_0x5a10('0x4b')]['id']){delete _0xde4757[_0x5a10('0x4b')]['id'];}return db[_0x5a10('0x30')]['find']({'where':{'id':_0xde4757['params']['id']}})[_0x5a10('0x28')](handleEntityNotFound(_0x1f9001,null))['then'](function(_0x1e9fae){if(_0x1e9fae){_0xde4757['body'][_0x5a10('0x54')]=_0x1e9fae['id'];return db[_0x5a10('0x30')]['create'](_0xde4757[_0x5a10('0x4b')]);}})[_0x5a10('0x28')](respondWithResult(_0x1f9001,null))['catch'](handleError(_0x1f9001,null));};exports[_0x5a10('0x55')]=function(_0x1b6035,_0x1ac60d,_0x288c0c){var _0x46860f={};var _0xb3c874={};var _0x2fdb69;var _0x4059e5;return db[_0x5a10('0x30')][_0x5a10('0x56')]({'where':{'id':_0x1b6035[_0x5a10('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ac60d,null))[_0x5a10('0x28')](function(_0x43f145){if(_0x43f145){_0x2fdb69=_0x43f145;_0xb3c874[_0x5a10('0x38')]=_['keys'](db['Interval'][_0x5a10('0x31')]);_0xb3c874[_0x5a10('0x35')]=_[_0x5a10('0x48')](_0x1b6035[_0x5a10('0x35')]);_0xb3c874[_0x5a10('0x36')]=_['intersection'](_0xb3c874['model'],_0xb3c874[_0x5a10('0x35')]);_0x46860f[_0x5a10('0x39')]=_[_0x5a10('0x37')](_0xb3c874[_0x5a10('0x38')],qs[_0x5a10('0x3a')](_0x1b6035[_0x5a10('0x35')][_0x5a10('0x3a')]));_0x46860f['attributes']=_0x46860f[_0x5a10('0x39')][_0x5a10('0x3b')]?_0x46860f[_0x5a10('0x39')]:_0xb3c874[_0x5a10('0x38')];_0x46860f['order']=qs[_0x5a10('0x3d')](_0x1b6035[_0x5a10('0x35')][_0x5a10('0x3d')]);_0x46860f['where']=qs['filters'](_[_0x5a10('0x3f')](_0x1b6035[_0x5a10('0x35')],_0xb3c874[_0x5a10('0x36')]));if(_0x1b6035[_0x5a10('0x35')]['filter']){_0x46860f[_0x5a10('0x3e')]=_[_0x5a10('0x41')](_0x46860f[_0x5a10('0x3e')],{'$or':_[_0x5a10('0x34')](_0x46860f[_0x5a10('0x39')],function(_0x22c381){var _0x50e20b={};_0x50e20b[_0x22c381]={'$like':'%'+_0x1b6035[_0x5a10('0x35')][_0x5a10('0x40')]+'%'};return _0x50e20b;})});}_0x46860f=_['merge']({},_0x46860f,_0x1b6035[_0x5a10('0x43')]);return _0x2fdb69['getIntervals'](_0x46860f);}})['then'](function(_0x181702){if(_0x181702){_0x4059e5=_0x181702[_0x5a10('0x3b')];if(!_0x1b6035[_0x5a10('0x35')]['hasOwnProperty'](_0x5a10('0x57'))){_0x46860f[_0x5a10('0x21')]=qs[_0x5a10('0x21')](_0x1b6035[_0x5a10('0x35')]['limit']);_0x46860f[_0x5a10('0x20')]=qs[_0x5a10('0x20')](_0x1b6035[_0x5a10('0x35')][_0x5a10('0x20')]);}return _0x2fdb69[_0x5a10('0x55')](_0x46860f);}})['then'](function(_0x584699){if(_0x584699){return _0x584699?{'count':_0x4059e5,'rows':_0x584699}:null;}})[_0x5a10('0x28')](respondWithResult(_0x1ac60d,null))['catch'](handleError(_0x1ac60d,null));};exports['addIntervals']=function(_0x48a435,_0x371cbc,_0x20eb75){return db['Interval'][_0x5a10('0x56')]({'where':{'id':_0x48a435[_0x5a10('0x47')]['id']}})[_0x5a10('0x28')](handleEntityNotFound(_0x371cbc,null))['then'](function(_0x17fbeb){if(_0x17fbeb){return db[_0x5a10('0x58')][_0x5a10('0x59')](function(_0x5d20ca){return db[_0x5a10('0x30')]['destroy']({'where':{'IntervalId':_0x48a435[_0x5a10('0x47')]['id']},'transaction':_0x5d20ca})[_0x5a10('0x28')](function(_0xa58727){var _0x465a76=_[_0x5a10('0x34')](_0x48a435['body'],function(_0x3a71d5){delete _0x3a71d5['id'];_0x3a71d5[_0x5a10('0x54')]=_0x48a435[_0x5a10('0x47')]['id'];return _0x3a71d5;});return db[_0x5a10('0x30')]['bulkCreate'](_0x465a76,{'transaction':_0x5d20ca});});})['then'](function(){return db[_0x5a10('0x30')][_0x5a10('0x5a')]({'where':{'IntervalId':_0x48a435[_0x5a10('0x47')]['id']}});});}})[_0x5a10('0x28')](respondWithResult(_0x371cbc,null))['catch'](handleError(_0x371cbc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b681045..e73fcbf 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 _0x2e80=['all','map','reduce','./interval.attributes','../../utils/iftime','exports','define','Interval','rewrite','interval','string','then'];(function(_0x299028,_0x4d7e9f){var _0x12154e=function(_0x558d18){while(--_0x558d18){_0x299028['push'](_0x299028['shift']());}};_0x12154e(++_0x4d7e9f);}(_0x2e80,0x177));var _0x02e8=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x2e80[_0x54f7c0];return _0x245d03;};'use strict';var attributes=require(_0x02e8('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x02e8('0x1'))['iftime'];module[_0x02e8('0x2')]=function(_0x503ffa){return _0x503ffa[_0x02e8('0x3')](_0x02e8('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b4428){extensions['rewrite'](_0x503ffa,_0x3b4428);},'afterBulkCreate':function(_0x51f7f9,_0x47ca05,_0x218235){_0x218235();extensions['rewrite'](_0x503ffa,_0x51f7f9[0x0]);},'afterUpdate':function(_0x228104){extensions[_0x02e8('0x5')](_0x503ffa,_0x228104);},'afterDestroy':function(_0x50ab77){extensions[_0x02e8('0x5')](_0x503ffa,_0x50ab77);}},'instanceMethods':{'ifTime':function(_0x39817f=undefined,_0x3fb969=new Date()){if(typeof this[_0x02e8('0x6')]===_0x02e8('0x7')){return iftime(this[_0x02e8('0x6')],_0x39817f,_0x3fb969);}else{return this['getIntervals']()[_0x02e8('0x8')](function(_0x42a849){return Promise[_0x02e8('0x9')](_0x42a849[_0x02e8('0xa')](function(_0x5e4dd2){return _0x5e4dd2['ifTime'](_0x39817f,_0x3fb969);}));})[_0x02e8('0x8')](function(_0x3b3e4c){return _0x3b3e4c[_0x02e8('0xb')](function(_0x99e573,_0x48a8d3){return _0x99e573||_0x48a8d3;},![]);});}}}});}; \ No newline at end of file +var _0x5ff6=['getIntervals','all','map','ifTime','then','reduce','../../components/extensions/rewrite','iftime','define','Interval','rewrite','string','interval'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5ff6,0x1cd));var _0x65ff=function(_0x4ec4f5,_0x4c1bcb){_0x4ec4f5=_0x4ec4f5-0x0;var _0x1603f0=_0x5ff6[_0x4ec4f5];return _0x1603f0;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x65ff('0x0'));var iftime=require('../../utils/iftime')[_0x65ff('0x1')];module['exports']=function(_0x39040c){return _0x39040c[_0x65ff('0x2')](_0x65ff('0x3'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d62e7){extensions[_0x65ff('0x4')](_0x39040c,_0x5d62e7);},'afterBulkCreate':function(_0x4b29a1,_0x373e08,_0x1b8cc6){_0x1b8cc6();extensions[_0x65ff('0x4')](_0x39040c,_0x4b29a1[0x0]);},'afterUpdate':function(_0x10dd4d){extensions['rewrite'](_0x39040c,_0x10dd4d);},'afterDestroy':function(_0x62dd7f){extensions[_0x65ff('0x4')](_0x39040c,_0x62dd7f);}},'instanceMethods':{'ifTime':function(_0x337567=undefined,_0x20eafd=new Date()){if(typeof this['interval']===_0x65ff('0x5')){return iftime(this[_0x65ff('0x6')],_0x337567,_0x20eafd);}else{return this[_0x65ff('0x7')]()['then'](function(_0x468db9){return Promise[_0x65ff('0x8')](_0x468db9[_0x65ff('0x9')](function(_0x3dd0dc){return _0x3dd0dc[_0x65ff('0xa')](_0x337567,_0x20eafd);}));})[_0x65ff('0xb')](function(_0x1b7e60){return _0x1b7e60[_0x65ff('0xc')](function(_0x1d1925,_0x4b4185){return _0x1d1925||_0x4b4185;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index f42a27b..b7d470f 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 _0xa76d=['message','ShowInterval','find','where','all','join','name','ifTime','intervalIds','isArray','intervals','string','timezone','length','format','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','reduce','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error'];(function(_0x4f8e83,_0x318d19){var _0x7e049e=function(_0x2d8875){while(--_0x2d8875){_0x4f8e83['push'](_0x4f8e83['shift']());}};_0x7e049e(++_0x318d19);}(_0xa76d,0x142));var _0xda76=function(_0x192d60,_0x5f53c8){_0x192d60=_0x192d60-0x0;var _0x189f8f=_0xa76d[_0x192d60];return _0x189f8f;};'use strict';var _=require(_0xda76('0x0'));var util=require(_0xda76('0x1'));var db=require(_0xda76('0x2'))['db'];var iftime=require(_0xda76('0x3'))['iftime'];var logger=require(_0xda76('0x4'))(_0xda76('0x5'));exports[_0xda76('0x6')]=function(_0x13f2ab){var _0xca5951=this;return new Promise(function(_0x3b39a1,_0x5d7f7f){return db[_0xda76('0x7')][_0xda76('0x8')]({'raw':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')][_0xda76('0xa')]===undefined?!![]:![]:!![],'where':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')]['where']||null:null,'attributes':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')][_0xda76('0xb')]||null:null,'limit':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')][_0xda76('0xc')]||null:null,'include':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')][_0xda76('0xd')]?_[_0xda76('0xe')](_0x13f2ab[_0xda76('0x9')][_0xda76('0xd')],function(_0x4e1784){return{'model':db[_0x4e1784[_0xda76('0xf')]],'as':_0x4e1784['as'],'attributes':_0x4e1784[_0xda76('0xb')],'include':_0x4e1784[_0xda76('0xd')]?_[_0xda76('0xe')](_0x4e1784['include'],function(_0x5bda16){return{'model':db[_0x5bda16[_0xda76('0xf')]],'as':_0x5bda16['as'],'attributes':_0x5bda16[_0xda76('0xb')],'include':_0x5bda16[_0xda76('0xd')]?_[_0xda76('0xe')](_0x5bda16[_0xda76('0xd')],function(_0x176d83){return{'model':db[_0x176d83[_0xda76('0xf')]],'as':_0x176d83['as'],'attributes':_0x176d83['attributes']};}):[]};}):[]};}):[]:[]})[_0xda76('0x10')](function(_0x476bec){logger[_0xda76('0x11')]('GetInterval',_0x13f2ab);logger[_0xda76('0x12')](_0xda76('0x6'),_0x13f2ab,JSON[_0xda76('0x13')](_0x476bec));_0x3b39a1(_0x476bec);})[_0xda76('0x14')](function(_0x438dbd){logger[_0xda76('0x15')](_0xda76('0x6'),_0x438dbd['message'],_0x13f2ab);_0x5d7f7f(_0xca5951[_0xda76('0x15')](0x1f4,_0x438dbd[_0xda76('0x16')]));});});};exports[_0xda76('0x17')]=function(_0x5f4be0){var _0x516767=this;return new Promise(function(_0x1dfd01,_0x42cd28){return db[_0xda76('0x7')][_0xda76('0x18')]({'raw':_0x5f4be0[_0xda76('0x9')]?_0x5f4be0[_0xda76('0x9')][_0xda76('0xa')]===undefined?!![]:![]:!![],'where':_0x5f4be0[_0xda76('0x9')]?_0x5f4be0[_0xda76('0x9')][_0xda76('0x19')]||null:null,'attributes':_0x5f4be0[_0xda76('0x9')]?_0x5f4be0[_0xda76('0x9')][_0xda76('0xb')]||null:null,'include':_0x5f4be0[_0xda76('0x9')]?_0x5f4be0[_0xda76('0x9')][_0xda76('0xd')]?_['map'](_0x5f4be0['options'][_0xda76('0xd')],function(_0x2d2fc7){return{'model':db[_0x2d2fc7[_0xda76('0xf')]],'as':_0x2d2fc7['as'],'attributes':_0x2d2fc7[_0xda76('0xb')],'include':_0x2d2fc7['include']?_[_0xda76('0xe')](_0x2d2fc7['include'],function(_0x16c353){return{'model':db[_0x16c353[_0xda76('0xf')]],'as':_0x16c353['as'],'attributes':_0x16c353['attributes'],'include':_0x16c353['include']?_[_0xda76('0xe')](_0x16c353[_0xda76('0xd')],function(_0x1b7714){return{'model':db[_0x1b7714['model']],'as':_0x1b7714['as'],'attributes':_0x1b7714['attributes']};}):[]};}):[]};}):[]:[]})[_0xda76('0x10')](function(_0x3797e7){logger[_0xda76('0x11')](_0xda76('0x17'),_0x5f4be0);logger[_0xda76('0x12')](_0xda76('0x17'),_0x5f4be0,JSON[_0xda76('0x13')](_0x3797e7));_0x1dfd01(_0x3797e7);})[_0xda76('0x14')](function(_0x50db33){logger[_0xda76('0x15')]('ShowInterval',_0x50db33['message'],_0x5f4be0);_0x42cd28(_0x516767[_0xda76('0x15')](0x1f4,_0x50db33[_0xda76('0x16')]));});});};function checkArrayOfIntervals(_0x3b1ec4,_0x103d3e){var _0x131d07=[];return db[_0xda76('0x7')][_0xda76('0x8')]({'where':{'id':_0x3b1ec4}})[_0xda76('0x10')](function(_0xe3da59){_0x131d07=_0xe3da59;return Promise[_0xda76('0x1a')](_0x131d07[_0xda76('0xe')](function(_0x56807d){return _0x56807d['ifTime'](_0x103d3e);}));})[_0xda76('0x10')](function(_0x5afa60){var _0xb384c0=_0x5afa60['reduce'](function(_0x7a0f1c,_0x55a940){return _0x7a0f1c||_0x55a940;},![]);logger[_0xda76('0x11')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x131d07['map'](function(_0x4d6092){return _0x4d6092['name'];})['join'](',\x20'),_0x131d07[_0xda76('0xe')](function(_0x456397){return _0x456397['id'];})[_0xda76('0x1b')](',\x20')));return _0xb384c0;});}function checkSingleInterval(_0x1104f3,_0x2a5011){return db['Interval']['findById'](_0x1104f3)[_0xda76('0x10')](function(_0x6e4ba5){if(_0x6e4ba5){logger[_0xda76('0x11')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x6e4ba5[_0xda76('0x1c')],_0x6e4ba5['id']));return _0x6e4ba5[_0xda76('0x1d')](_0x2a5011);}});}exports['IntervalIftime']=function(_0xb53c9e){var _0x2ca914=_0xb53c9e[_0xda76('0x1e')];var _0x9556cd=Array[_0xda76('0x1f')](_0xb53c9e['intervals'])?_0xb53c9e[_0xda76('0x20')]:typeof _0xb53c9e[_0xda76('0x20')]===_0xda76('0x21')?[_0xb53c9e[_0xda76('0x20')]]:[];var _0x57f772=_0xb53c9e[_0xda76('0x22')]||undefined;var _0x34a1b0=![];if(_0x9556cd[_0xda76('0x23')]){logger[_0xda76('0x11')](util[_0xda76('0x24')](_0xda76('0x25'),_0x9556cd[_0xda76('0x1b')](';\x20')));}if(_0x57f772){logger['info'](util[_0xda76('0x24')](_0xda76('0x26'),_0x57f772));}logger[_0xda76('0x12')](_0xda76('0x27'),_0x34a1b0);logger[_0xda76('0x28')](_0xda76('0x29'),_0xb53c9e);return Promise['resolve']()['then'](function(){if(Array[_0xda76('0x1f')](_0x2ca914)){return checkArrayOfIntervals(_0x2ca914,_0x57f772);}else if(_0x2ca914){return checkSingleInterval(_0x2ca914,_0x57f772);}})[_0xda76('0x10')](function(_0x3757ea){var _0xc6eb43=_0x9556cd[_0xda76('0x2a')](function(_0x1d9a8f,_0x5ef6e5){return _0x1d9a8f||iftime(_0x5ef6e5,_0x57f772);},![]);_0x34a1b0=_0x3757ea||_0xc6eb43;return _0x34a1b0;})[_0xda76('0x14')](function(_0x577e69){logger[_0xda76('0x15')](_0xda76('0x29'),_0xb53c9e,_0x577e69);throw this['error'](0x1f4,_0x577e69[_0xda76('0x16')]);});}; \ No newline at end of file +var _0xad28=['util','../../mysqldb','../../utils/iftime','rpc','options','raw','where','include','model','map','attributes','info','debug','GetInterval','stringify','error','message','ShowInterval','Interval','find','catch','then','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','ifTime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','IntervalIftime','lodash'];(function(_0x462ed1,_0x18b3a7){var _0x3337e1=function(_0x3d13ad){while(--_0x3d13ad){_0x462ed1['push'](_0x462ed1['shift']());}};_0x3337e1(++_0x18b3a7);}(_0xad28,0xab));var _0x8ad2=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xad28[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x8ad2('0x0'));var util=require(_0x8ad2('0x1'));var db=require(_0x8ad2('0x2'))['db'];var iftime=require(_0x8ad2('0x3'))['iftime'];var logger=require('../../config/logger')(_0x8ad2('0x4'));exports['GetInterval']=function(_0x261878){var _0x1cc4b3=this;return new Promise(function(_0x3cc1b4,_0xc0e4c2){return db['Interval']['findAll']({'raw':_0x261878['options']?_0x261878[_0x8ad2('0x5')][_0x8ad2('0x6')]===undefined?!![]:![]:!![],'where':_0x261878[_0x8ad2('0x5')]?_0x261878['options'][_0x8ad2('0x7')]||null:null,'attributes':_0x261878[_0x8ad2('0x5')]?_0x261878['options']['attributes']||null:null,'limit':_0x261878[_0x8ad2('0x5')]?_0x261878[_0x8ad2('0x5')]['limit']||null:null,'include':_0x261878[_0x8ad2('0x5')]?_0x261878['options'][_0x8ad2('0x8')]?_['map'](_0x261878[_0x8ad2('0x5')]['include'],function(_0x3b2bbc){return{'model':db[_0x3b2bbc[_0x8ad2('0x9')]],'as':_0x3b2bbc['as'],'attributes':_0x3b2bbc['attributes'],'include':_0x3b2bbc[_0x8ad2('0x8')]?_[_0x8ad2('0xa')](_0x3b2bbc[_0x8ad2('0x8')],function(_0x2c7ea8){return{'model':db[_0x2c7ea8[_0x8ad2('0x9')]],'as':_0x2c7ea8['as'],'attributes':_0x2c7ea8[_0x8ad2('0xb')],'include':_0x2c7ea8['include']?_[_0x8ad2('0xa')](_0x2c7ea8['include'],function(_0x92d3b1){return{'model':db[_0x92d3b1['model']],'as':_0x92d3b1['as'],'attributes':_0x92d3b1[_0x8ad2('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4606ba){logger[_0x8ad2('0xc')]('GetInterval',_0x261878);logger[_0x8ad2('0xd')](_0x8ad2('0xe'),_0x261878,JSON[_0x8ad2('0xf')](_0x4606ba));_0x3cc1b4(_0x4606ba);})['catch'](function(_0x355b53){logger[_0x8ad2('0x10')](_0x8ad2('0xe'),_0x355b53[_0x8ad2('0x11')],_0x261878);_0xc0e4c2(_0x1cc4b3[_0x8ad2('0x10')](0x1f4,_0x355b53['message']));});});};exports[_0x8ad2('0x12')]=function(_0x359c06){var _0x83af62=this;return new Promise(function(_0x5e734e,_0x5b4dc9){return db[_0x8ad2('0x13')][_0x8ad2('0x14')]({'raw':_0x359c06['options']?_0x359c06[_0x8ad2('0x5')][_0x8ad2('0x6')]===undefined?!![]:![]:!![],'where':_0x359c06[_0x8ad2('0x5')]?_0x359c06[_0x8ad2('0x5')]['where']||null:null,'attributes':_0x359c06[_0x8ad2('0x5')]?_0x359c06['options'][_0x8ad2('0xb')]||null:null,'include':_0x359c06[_0x8ad2('0x5')]?_0x359c06['options'][_0x8ad2('0x8')]?_[_0x8ad2('0xa')](_0x359c06[_0x8ad2('0x5')][_0x8ad2('0x8')],function(_0x2059a7){return{'model':db[_0x2059a7[_0x8ad2('0x9')]],'as':_0x2059a7['as'],'attributes':_0x2059a7[_0x8ad2('0xb')],'include':_0x2059a7[_0x8ad2('0x8')]?_[_0x8ad2('0xa')](_0x2059a7[_0x8ad2('0x8')],function(_0x470ccb){return{'model':db[_0x470ccb[_0x8ad2('0x9')]],'as':_0x470ccb['as'],'attributes':_0x470ccb['attributes'],'include':_0x470ccb[_0x8ad2('0x8')]?_[_0x8ad2('0xa')](_0x470ccb[_0x8ad2('0x8')],function(_0x11bf53){return{'model':db[_0x11bf53[_0x8ad2('0x9')]],'as':_0x11bf53['as'],'attributes':_0x11bf53[_0x8ad2('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22f9b9){logger[_0x8ad2('0xc')](_0x8ad2('0x12'),_0x359c06);logger[_0x8ad2('0xd')](_0x8ad2('0x12'),_0x359c06,JSON[_0x8ad2('0xf')](_0x22f9b9));_0x5e734e(_0x22f9b9);})[_0x8ad2('0x15')](function(_0x3f1dff){logger[_0x8ad2('0x10')]('ShowInterval',_0x3f1dff[_0x8ad2('0x11')],_0x359c06);_0x5b4dc9(_0x83af62['error'](0x1f4,_0x3f1dff['message']));});});};function checkArrayOfIntervals(_0x32ee0f,_0x527880){var _0x16e0ee=[];return db[_0x8ad2('0x13')]['findAll']({'where':{'id':_0x32ee0f}})[_0x8ad2('0x16')](function(_0x287122){_0x16e0ee=_0x287122;return Promise[_0x8ad2('0x17')](_0x16e0ee['map'](function(_0x29a277){return _0x29a277['ifTime'](_0x527880);}));})[_0x8ad2('0x16')](function(_0x5a692f){var _0x3f03c9=_0x5a692f[_0x8ad2('0x18')](function(_0x461840,_0x283322){return _0x461840||_0x283322;},![]);logger[_0x8ad2('0xc')](util[_0x8ad2('0x19')](_0x8ad2('0x1a'),_0x16e0ee[_0x8ad2('0xa')](function(_0x3de8c9){return _0x3de8c9[_0x8ad2('0x1b')];})[_0x8ad2('0x1c')](',\x20'),_0x16e0ee[_0x8ad2('0xa')](function(_0x2e52b6){return _0x2e52b6['id'];})[_0x8ad2('0x1c')](',\x20')));return _0x3f03c9;});}function checkSingleInterval(_0x151b85,_0x515ca4){return db[_0x8ad2('0x13')][_0x8ad2('0x1d')](_0x151b85)[_0x8ad2('0x16')](function(_0x3a697c){if(_0x3a697c){logger[_0x8ad2('0xc')](util[_0x8ad2('0x19')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x3a697c[_0x8ad2('0x1b')],_0x3a697c['id']));return _0x3a697c[_0x8ad2('0x1e')](_0x515ca4);}});}exports['IntervalIftime']=function(_0x5d9203){var _0x11ff80=_0x5d9203[_0x8ad2('0x1f')];var _0xa7321f=Array[_0x8ad2('0x20')](_0x5d9203[_0x8ad2('0x21')])?_0x5d9203['intervals']:typeof _0x5d9203[_0x8ad2('0x21')]===_0x8ad2('0x22')?[_0x5d9203[_0x8ad2('0x21')]]:[];var _0x22899b=_0x5d9203[_0x8ad2('0x23')]||undefined;var _0x1bfb1c=![];if(_0xa7321f[_0x8ad2('0x24')]){logger[_0x8ad2('0xc')](util[_0x8ad2('0x19')](_0x8ad2('0x25'),_0xa7321f[_0x8ad2('0x1c')](';\x20')));}if(_0x22899b){logger[_0x8ad2('0xc')](util['format'](_0x8ad2('0x26'),_0x22899b));}logger[_0x8ad2('0xd')](_0x8ad2('0x27'),_0x1bfb1c);logger[_0x8ad2('0x28')]('IntervalIftime',_0x5d9203);return Promise[_0x8ad2('0x29')]()[_0x8ad2('0x16')](function(){if(Array[_0x8ad2('0x20')](_0x11ff80)){return checkArrayOfIntervals(_0x11ff80,_0x22899b);}else if(_0x11ff80){return checkSingleInterval(_0x11ff80,_0x22899b);}})['then'](function(_0x2cbbcc){var _0x14100c=_0xa7321f[_0x8ad2('0x18')](function(_0x3fbee9,_0x17e4e8){return _0x3fbee9||iftime(_0x17e4e8,_0x22899b);},![]);_0x1bfb1c=_0x2cbbcc||_0x14100c;return _0x1bfb1c;})[_0x8ad2('0x15')](function(_0x1b0742){logger['error'](_0x8ad2('0x2a'),_0x5d9203,_0x1b0742);throw this[_0x8ad2('0x10')](0x1f4,_0x1b0742['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d74ed38..ba60634 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x56ec36,_0x5bcdc9){var _0x2fef77=function(_0x353169){while(--_0x353169){_0x56ec36['push'](_0x56ec36['shift']());}};_0x2fef77(++_0x5bcdc9);}(_0xdb28,0x106));var _0x8db2=function(_0x29de81,_0x3669d2){_0x29de81=_0x29de81-0x0;var _0x6f91bf=_0xdb28[_0x29de81];return _0x6f91bf;};'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 bd8ca91..cc6cdb3 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 _0x1fed=['api.jira','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','reason','/rest/api/2/issue','Basic\x20','toString','base64','setEncoding','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request'];(function(_0x3bd904,_0x1c4ff6){var _0x318065=function(_0xc598fa){while(--_0xc598fa){_0x3bd904['push'](_0x3bd904['shift']());}};_0x318065(++_0x1c4ff6);}(_0x1fed,0xda));var _0xd1fe=function(_0x2f49df,_0x518919){_0x2f49df=_0x2f49df-0x0;var _0x1ec090=_0x1fed[_0x2f49df];return _0x1ec090;};'use strict';var BPromise=require(_0xd1fe('0x0'));var https=require(_0xd1fe('0x1'));var logger=require(_0xd1fe('0x2'))(_0xd1fe('0x3'));var USERNAME=_0xd1fe('0x4');var PASSWORD=_0xd1fe('0x5');function openIssue(_0x1fe16a,_0x4a5ed2){var _0x2394f9={'fields':{'project':{'key':_0x1fe16a[_0xd1fe('0x6')]||'MOTGUI'},'summary':(_0x1fe16a[_0xd1fe('0x7')]||_0xd1fe('0x8'))+_0xd1fe('0x9')+_0x1fe16a['ip'],'description':_0x1fe16a[_0xd1fe('0xa')]||JSON[_0xd1fe('0xb')](_0x1fe16a),'issuetype':{'name':_0x1fe16a[_0xd1fe('0xc')]||_0xd1fe('0xd')}}};_0x2394f9['fields'][_0xd1fe('0xe')]=_0x1fe16a[_0xd1fe('0xf')];_0x2394f9[_0xd1fe('0x10')][_0xd1fe('0x11')]=_0x1fe16a['oldToken'];_0x2394f9[_0xd1fe('0x10')][_0xd1fe('0x12')]=_0x1fe16a[_0xd1fe('0x13')];_0x2394f9[_0xd1fe('0x10')][_0xd1fe('0x14')]=_0x1fe16a[_0xd1fe('0x15')];_0x2394f9['fields']['customfield_11504']=_0x1fe16a[_0xd1fe('0x16')];_0x2394f9[_0xd1fe('0x10')]['customfield_10102']=_0x1fe16a['ip'];var _0x20fbc0={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xd1fe('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xd1fe('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xd1fe('0x19')](_0xd1fe('0x1a'))}};var _0x251e6c=JSON[_0xd1fe('0xb')](_0x2394f9);var _0x123016=https['request'](_0x20fbc0,function(_0x444ece){_0x444ece[_0xd1fe('0x1b')]('utf8');var _0x5b3f1c='';_0x444ece['on']('data',function(_0x1dadbe){_0x5b3f1c+=_0x1dadbe;});_0x444ece['on'](_0xd1fe('0x1c'),function(){if(_0x4a5ed2){return _0x4a5ed2[_0xd1fe('0x1d')](_0x444ece[_0xd1fe('0x1e')])[_0xd1fe('0x1f')](JSON[_0xd1fe('0x20')](_0x5b3f1c));}});});_0x123016['on']('error',function(_0x31ceda){if(_0x4a5ed2){return _0x4a5ed2[_0xd1fe('0x1d')](0x1f4)['json']({'errors':[{'message':_0xd1fe('0x21'),'type':_0xd1fe('0x22')}]});}});_0x123016[_0xd1fe('0x23')](_0x251e6c);_0x123016['end']();}exports[_0xd1fe('0x24')]=openIssue;exports['send']=function(_0x5444be,_0x49dbb6){_0x5444be[_0xd1fe('0x25')]['ip']=_0x5444be['headers'][_0xd1fe('0x26')]||_0x5444be[_0xd1fe('0x27')][_0xd1fe('0x28')]||_0x5444be[_0xd1fe('0x29')][_0xd1fe('0x28')]||_0x5444be[_0xd1fe('0x27')][_0xd1fe('0x29')][_0xd1fe('0x28')];return openIssue(_0x5444be[_0xd1fe('0x25')],_0x49dbb6);}; \ No newline at end of file +var _0x186a=['headers','remoteAddress','connection','socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','newToken','customfield_11503','reason','customfield_10102','/rest/api/2/issue','application/json','toString','request','data','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','body'];(function(_0xd6db21,_0x1d08f3){var _0x3b96a0=function(_0x157017){while(--_0x157017){_0xd6db21['push'](_0xd6db21['shift']());}};_0x3b96a0(++_0x1d08f3);}(_0x186a,0x151));var _0xa186=function(_0xa86679,_0x5524c7){_0xa86679=_0xa86679-0x0;var _0x5c2914=_0x186a[_0xa86679];return _0x5c2914;};'use strict';var BPromise=require(_0xa186('0x0'));var https=require('https');var logger=require(_0xa186('0x1'))(_0xa186('0x2'));var USERNAME=_0xa186('0x3');var PASSWORD=_0xa186('0x4');function openIssue(_0x5b02dc,_0x3c3c90){var _0xfb6801={'fields':{'project':{'key':_0x5b02dc['key']||'MOTGUI'},'summary':(_0x5b02dc['summary']||_0xa186('0x5'))+_0xa186('0x6')+_0x5b02dc['ip'],'description':_0x5b02dc[_0xa186('0x7')]||JSON[_0xa186('0x8')](_0x5b02dc),'issuetype':{'name':_0x5b02dc[_0xa186('0x9')]||_0xa186('0xa')}}};_0xfb6801['fields'][_0xa186('0xb')]=_0x5b02dc[_0xa186('0xc')];_0xfb6801[_0xa186('0xd')][_0xa186('0xe')]=_0x5b02dc['oldToken'];_0xfb6801[_0xa186('0xd')]['customfield_11502']=_0x5b02dc[_0xa186('0xf')];_0xfb6801[_0xa186('0xd')][_0xa186('0x10')]=_0x5b02dc['name'];_0xfb6801[_0xa186('0xd')]['customfield_11504']=_0x5b02dc[_0xa186('0x11')];_0xfb6801[_0xa186('0xd')][_0xa186('0x12')]=_0x5b02dc['ip'];var _0x29660d={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xa186('0x13'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xa186('0x14'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa186('0x15')]('base64')}};var _0x462596=JSON['stringify'](_0xfb6801);var _0x55c1e1=https[_0xa186('0x16')](_0x29660d,function(_0x628814){_0x628814['setEncoding']('utf8');var _0x583f5b='';_0x628814['on'](_0xa186('0x17'),function(_0x727641){_0x583f5b+=_0x727641;});_0x628814['on']('end',function(){if(_0x3c3c90){return _0x3c3c90['status'](_0x628814['statusCode'])[_0xa186('0x18')](JSON[_0xa186('0x19')](_0x583f5b));}});});_0x55c1e1['on'](_0xa186('0x1a'),function(_0x318641){if(_0x3c3c90){return _0x3c3c90[_0xa186('0x1b')](0x1f4)['json']({'errors':[{'message':_0xa186('0x1c'),'type':_0xa186('0x1d')}]});}});_0x55c1e1[_0xa186('0x1e')](_0x462596);_0x55c1e1[_0xa186('0x1f')]();}exports['openIssue']=openIssue;exports['send']=function(_0x5c0d03,_0x3b27d5){_0x5c0d03[_0xa186('0x20')]['ip']=_0x5c0d03[_0xa186('0x21')]['x-forwarded-for']||_0x5c0d03['connection'][_0xa186('0x22')]||_0x5c0d03['socket'][_0xa186('0x22')]||_0x5c0d03[_0xa186('0x23')][_0xa186('0x24')][_0xa186('0x22')];return openIssue(_0x5c0d03[_0xa186('0x20')],_0x3b27d5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ffda7c7..cec666f 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xac4a,0x13f));var _0xaac4=function(_0x1bce53,_0x252ee8){_0x1bce53=_0x1bce53-0x0;var _0x3b13b1=_0xac4a[_0x1bce53];return _0x3b13b1;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/describe',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaac4('0xd')](_0xaac4('0xe'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);module[_0xaac4('0x12')]=router; \ No newline at end of file +var _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x38539e,_0x13633a){var _0x2bb3fa=function(_0x49c841){while(--_0x49c841){_0x38539e['push'](_0x38539e['shift']());}};_0x2bb3fa(++_0x13633a);}(_0x0a9a,0x183));var _0xa0a9=function(_0x598ad9,_0x4bd041){_0x598ad9=_0x598ad9-0x0;var _0x1f996a=_0x0a9a[_0x598ad9];return _0x1f996a;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 60f1d2f..f7ecaa3 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x45c996,_0x393f1f){_0x45c996=_0x45c996-0x0;var _0x48ef4b=_0x7a54[_0x45c996];return _0x48ef4b;};'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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x16099a,_0x4e50ef){_0x16099a=_0x16099a-0x0;var _0x45925f=_0x7a54[_0x16099a];return _0x45925f;};'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 a6c96ae..58ffe90 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 _0x1354=['moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x29a3a8,_0x1c537f){var _0x2ed8cb=function(_0x46a9de){while(--_0x46a9de){_0x29a3a8['push'](_0x29a3a8['shift']());}};_0x2ed8cb(++_0x1c537f);}(_0x1354,0x95));var _0x4135=function(_0x20ea26,_0x5512f8){_0x20ea26=_0x20ea26-0x0;var _0xcbc4d7=_0x1354[_0x20ea26];return _0xcbc4d7;};'use strict';var emlformat=require(_0x4135('0x0'));var rimraf=require(_0x4135('0x1'));var zipdir=require(_0x4135('0x2'));var jsonpatch=require(_0x4135('0x3'));var rp=require(_0x4135('0x4'));var moment=require(_0x4135('0x5'));var BPromise=require(_0x4135('0x6'));var Mustache=require('mustache');var util=require(_0x4135('0x7'));var path=require(_0x4135('0x8'));var sox=require(_0x4135('0x9'));var csv=require('to-csv');var ejs=require(_0x4135('0xa'));var fs=require('fs');var fs_extra=require(_0x4135('0xb'));var _=require('lodash');var squel=require(_0x4135('0xc'));var crypto=require(_0x4135('0xd'));var jsforce=require(_0x4135('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4135('0xf'));var querystring=require('querystring');var Papa=require(_0x4135('0x10'));var Redis=require(_0x4135('0x11'));var authService=require(_0x4135('0x12'));var qs=require(_0x4135('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4135('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4135('0x15'));var config=require(_0x4135('0x16'));var licenseUtil=require(_0x4135('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x307e6f,_0x838d6f){_0x838d6f=_0x838d6f||0xcc;return function(_0xb825cb){if(_0xb825cb){return _0x307e6f[_0x4135('0x18')](_0x838d6f);}return _0x307e6f[_0x4135('0x19')](_0x838d6f)[_0x4135('0x1a')]();};}function respondWithResult(_0x54f954,_0x50dd01){_0x50dd01=_0x50dd01||0xc8;return function(_0x249c86){if(_0x249c86){return _0x54f954[_0x4135('0x19')](_0x50dd01)[_0x4135('0x1b')](_0x249c86);}};}function respondWithFilteredResult(_0x17179a,_0x4b7609){return function(_0x34fd82){if(_0x34fd82){var _0x2e8733=typeof _0x4b7609['offset']==='undefined'&&typeof _0x4b7609[_0x4135('0x1c')]==='undefined';var _0x2f2600=_0x34fd82['count'];var _0x53f54e=_0x2e8733?0x0:_0x4b7609['offset'];var _0x53f5a7=_0x2e8733?_0x34fd82[_0x4135('0x1d')]:_0x4b7609['offset']+_0x4b7609[_0x4135('0x1c')];var _0xf81757;if(_0x53f5a7>=_0x2f2600){_0x53f5a7=_0x2f2600;_0xf81757=0xc8;}else{_0xf81757=0xce;}_0x17179a[_0x4135('0x19')](_0xf81757);return _0x17179a['set'](_0x4135('0x1e'),_0x53f54e+'-'+_0x53f5a7+'/'+_0x2f2600)[_0x4135('0x1b')](_0x34fd82);}return null;};}function patchUpdates(_0x398294){return function(_0x485395){try{jsonpatch[_0x4135('0x1f')](_0x485395,_0x398294,!![]);}catch(_0x58bdb1){return BPromise[_0x4135('0x20')](_0x58bdb1);}return _0x485395[_0x4135('0x21')]();};}function saveUpdates(_0x314f11,_0x188707){return function(_0x5a3777){if(_0x5a3777){return _0x5a3777[_0x4135('0x22')](_0x314f11)[_0x4135('0x23')](function(_0x32dcf6){return _0x32dcf6;});}return null;};}function removeEntity(_0x3912e9,_0x83a794){return function(_0x2c604b){if(_0x2c604b){return _0x2c604b[_0x4135('0x24')]()[_0x4135('0x23')](function(){_0x3912e9[_0x4135('0x19')](0xcc)[_0x4135('0x1a')]();});}};}function handleEntityNotFound(_0x12a9fd,_0x192126){return function(_0x212228){if(!_0x212228){_0x12a9fd[_0x4135('0x18')](0x194);}return _0x212228;};}function handleError(_0x4b448f,_0x1a3d30){_0x1a3d30=_0x1a3d30||0x1f4;return function(_0x3e40bc){logger[_0x4135('0x25')](_0x3e40bc[_0x4135('0x26')]);if(_0x3e40bc[_0x4135('0x27')]){delete _0x3e40bc[_0x4135('0x27')];}_0x4b448f['status'](_0x1a3d30)[_0x4135('0x28')](_0x3e40bc);};}exports[_0x4135('0x29')]=function(_0x31b508,_0x2c06d0){var _0x284121={},_0x511fce={},_0x411ee0={'count':0x0,'rows':[]};var _0x381e86=_['map'](db[_0x4135('0x2a')]['rawAttributes'],function(_0x2438d2){return{'name':_0x2438d2[_0x4135('0x2b')],'type':_0x2438d2[_0x4135('0x2c')][_0x4135('0x2d')]};});_0x511fce['model']=_[_0x4135('0x2e')](_0x381e86,_0x4135('0x27'));_0x511fce[_0x4135('0x2f')]=_[_0x4135('0x30')](_0x31b508[_0x4135('0x2f')]);_0x511fce[_0x4135('0x31')]=_['intersection'](_0x511fce[_0x4135('0x32')],_0x511fce[_0x4135('0x2f')]);_0x284121['attributes']=_[_0x4135('0x33')](_0x511fce['model'],qs[_0x4135('0x34')](_0x31b508[_0x4135('0x2f')]['fields']));_0x284121['attributes']=_0x284121[_0x4135('0x35')][_0x4135('0x36')]?_0x284121[_0x4135('0x35')]:_0x511fce['model'];if(!_0x31b508[_0x4135('0x2f')][_0x4135('0x37')](_0x4135('0x38'))){_0x284121['limit']=qs[_0x4135('0x1c')](_0x31b508[_0x4135('0x2f')]['limit']);_0x284121[_0x4135('0x39')]=qs[_0x4135('0x39')](_0x31b508['query'][_0x4135('0x39')]);}_0x284121['order']=qs[_0x4135('0x3a')](_0x31b508[_0x4135('0x2f')][_0x4135('0x3a')]);_0x284121[_0x4135('0x3b')]=qs[_0x4135('0x31')](_[_0x4135('0x3c')](_0x31b508['query'],_0x511fce[_0x4135('0x31')]),_0x381e86);if(_0x31b508[_0x4135('0x2f')]['filter']){_0x284121[_0x4135('0x3b')]=_['merge'](_0x284121[_0x4135('0x3b')],{'$or':_[_0x4135('0x2e')](_0x381e86,function(_0x14f353){if(_0x14f353[_0x4135('0x2c')]!==_0x4135('0x3d')){var _0x41ce9e={};_0x41ce9e[_0x14f353[_0x4135('0x27')]]={'$like':'%'+_0x31b508[_0x4135('0x2f')][_0x4135('0x3e')]+'%'};return _0x41ce9e;}})});}_0x284121=_[_0x4135('0x3f')]({},_0x284121,_0x31b508[_0x4135('0x40')]);var _0x53689f={'where':_0x284121['where']};return db[_0x4135('0x2a')][_0x4135('0x1d')](_0x53689f)[_0x4135('0x23')](function(_0x2dfd11){_0x411ee0[_0x4135('0x1d')]=_0x2dfd11;if(_0x31b508['query'][_0x4135('0x41')]){_0x284121[_0x4135('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4135('0x43')](_0x284121);})[_0x4135('0x23')](function(_0x1ddad4){_0x411ee0[_0x4135('0x44')]=_0x1ddad4;return _0x411ee0;})['then'](respondWithFilteredResult(_0x2c06d0,_0x284121))['catch'](handleError(_0x2c06d0,null));};exports[_0x4135('0x45')]=function(_0x58c6e1,_0x166ecb){var _0x5894fb={'raw':!![],'where':{'id':_0x58c6e1['params']['id']}},_0x25d1c4={};_0x25d1c4[_0x4135('0x32')]=_['keys'](db[_0x4135('0x2a')][_0x4135('0x46')]);_0x25d1c4[_0x4135('0x2f')]=_['keys'](_0x58c6e1[_0x4135('0x2f')]);_0x25d1c4[_0x4135('0x31')]=_[_0x4135('0x33')](_0x25d1c4[_0x4135('0x32')],_0x25d1c4[_0x4135('0x2f')]);_0x5894fb[_0x4135('0x35')]=_[_0x4135('0x33')](_0x25d1c4[_0x4135('0x32')],qs[_0x4135('0x34')](_0x58c6e1[_0x4135('0x2f')]['fields']));_0x5894fb[_0x4135('0x35')]=_0x5894fb[_0x4135('0x35')][_0x4135('0x36')]?_0x5894fb[_0x4135('0x35')]:_0x25d1c4[_0x4135('0x32')];if(_0x58c6e1['query'][_0x4135('0x41')]){_0x5894fb['include']=[{'all':!![]}];}_0x5894fb=_['merge']({},_0x5894fb,_0x58c6e1[_0x4135('0x40')]);return db[_0x4135('0x2a')][_0x4135('0x47')](_0x5894fb)[_0x4135('0x23')](handleEntityNotFound(_0x166ecb,null))[_0x4135('0x23')](respondWithResult(_0x166ecb,null))[_0x4135('0x48')](handleError(_0x166ecb,null));};exports[_0x4135('0x49')]=function(_0x18aed5,_0x13f1f1){return db[_0x4135('0x2a')][_0x4135('0x49')](_0x18aed5[_0x4135('0x4a')],{})[_0x4135('0x23')](respondWithResult(_0x13f1f1,0xc9))[_0x4135('0x48')](handleError(_0x13f1f1,null));};exports[_0x4135('0x22')]=function(_0x74a924,_0x540029){if(_0x74a924[_0x4135('0x4a')]['id']){delete _0x74a924['body']['id'];}return db[_0x4135('0x2a')][_0x4135('0x47')]({'where':{'id':_0x74a924[_0x4135('0x4b')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x540029,null))[_0x4135('0x23')](saveUpdates(_0x74a924[_0x4135('0x4a')],null))[_0x4135('0x23')](respondWithResult(_0x540029,null))['catch'](handleError(_0x540029,null));};exports['destroy']=function(_0x1b98e8,_0x5b6255){return db[_0x4135('0x2a')][_0x4135('0x47')]({'where':{'id':_0x1b98e8[_0x4135('0x4b')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x5b6255,null))[_0x4135('0x23')](removeEntity(_0x5b6255,null))[_0x4135('0x48')](handleError(_0x5b6255,null));};exports['describe']=function(_0x1c4049,_0x31c532){return db[_0x4135('0x2a')][_0x4135('0x4c')]()[_0x4135('0x23')](respondWithResult(_0x31c532,null))[_0x4135('0x48')](handleError(_0x31c532,null));}; \ No newline at end of file +var _0x5496=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x5c0638,_0x2547fa){var _0x205589=function(_0x57d633){while(--_0x57d633){_0x5c0638['push'](_0x5c0638['shift']());}};_0x205589(++_0x2547fa);}(_0x5496,0x175));var _0x6549=function(_0x58871c,_0x1efbe3){_0x58871c=_0x58871c-0x0;var _0x2cf9ac=_0x5496[_0x58871c];return _0x2cf9ac;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['JscriptyAnswerReport'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));};exports['describe']=function(_0x28af00,_0x4bbc61){return db[_0x6549('0x2b')][_0x6549('0x4e')]()[_0x6549('0x26')](respondWithResult(_0x4bbc61,null))[_0x6549('0x43')](handleError(_0x4bbc61,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 8556046..840521c 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 _0x706e=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','../../config/logger','api','moment','bluebird'];(function(_0x1b944d,_0x14ac0f){var _0x1caddc=function(_0x3290b3){while(--_0x3290b3){_0x1b944d['push'](_0x1b944d['shift']());}};_0x1caddc(++_0x14ac0f);}(_0x706e,0x110));var _0xe706=function(_0x57b4f4,_0x1dc78b){_0x57b4f4=_0x57b4f4-0x0;var _0x3ba116=_0x706e[_0x57b4f4];return _0x3ba116;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe706('0x0'))(_0xe706('0x1'));var moment=require(_0xe706('0x2'));var BPromise=require(_0xe706('0x3'));var rp=require(_0xe706('0x4'));var fs=require('fs');var path=require(_0xe706('0x5'));var rimraf=require(_0xe706('0x6'));var config=require(_0xe706('0x7'));var attributes=require(_0xe706('0x8'));module[_0xe706('0x9')]=function(_0x496a01,_0x2e6268){return _0x496a01[_0xe706('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xe706('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef08=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1bbe41,_0x574de9){var _0x1f7289=function(_0x28ce81){while(--_0x28ce81){_0x1bbe41['push'](_0x1bbe41['shift']());}};_0x1f7289(++_0x574de9);}(_0xef08,0x86));var _0x8ef0=function(_0x227eb1,_0x13ebb0){_0x227eb1=_0x227eb1-0x0;var _0x1cd373=_0xef08[_0x227eb1];return _0x1cd373;};'use strict';var _=require(_0x8ef0('0x0'));var util=require('util');var logger=require(_0x8ef0('0x1'))(_0x8ef0('0x2'));var moment=require(_0x8ef0('0x3'));var BPromise=require(_0x8ef0('0x4'));var rp=require(_0x8ef0('0x5'));var fs=require('fs');var path=require(_0x8ef0('0x6'));var rimraf=require(_0x8ef0('0x7'));var config=require(_0x8ef0('0x8'));var attributes=require(_0x8ef0('0x9'));module[_0x8ef0('0xa')]=function(_0x31ab33,_0x55fd87){return _0x31ab33[_0x8ef0('0xb')](_0x8ef0('0xc'),attributes,{'tableName':_0x8ef0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index eff391a..94402f5 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 _0xf03a=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf03a,0xce));var _0xaf03=function(_0x533c62,_0x500760){_0x533c62=_0x533c62-0x0;var _0x17050e=_0xf03a[_0x533c62];return _0x17050e;};'use strict';var _=require(_0xaf03('0x0'));var util=require(_0xaf03('0x1'));var moment=require(_0xaf03('0x2'));var BPromise=require(_0xaf03('0x3'));var rs=require(_0xaf03('0x4'));var fs=require('fs');var Redis=require(_0xaf03('0x5'));var db=require(_0xaf03('0x6'))['db'];var utils=require(_0xaf03('0x7'));var logger=require(_0xaf03('0x8'))('rpc');var config=require(_0xaf03('0x9'));var jayson=require(_0xaf03('0xa'));var client=jayson[_0xaf03('0xb')][_0xaf03('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43ccd9,_0x3275a5,_0x45f6f7){return new BPromise(function(_0x4dd32b,_0x1a2bdb){return client['request'](_0x43ccd9,_0x45f6f7)['then'](function(_0x1b5dcc){logger[_0xaf03('0xd')](_0xaf03('0xe'),_0x3275a5,_0xaf03('0xf'));logger['debug'](_0xaf03('0x10'),_0x3275a5,'request\x20sent',JSON[_0xaf03('0x11')](_0x1b5dcc));if(_0x1b5dcc[_0xaf03('0x12')]){if(_0x1b5dcc[_0xaf03('0x12')]['code']===0x1f4){logger[_0xaf03('0x12')](_0xaf03('0xe'),_0x3275a5,_0x1b5dcc[_0xaf03('0x12')][_0xaf03('0x13')]);return _0x1a2bdb(_0x1b5dcc['error'][_0xaf03('0x13')]);}logger[_0xaf03('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3275a5,_0x1b5dcc['error'][_0xaf03('0x13')]);return _0x4dd32b(_0x1b5dcc['error'][_0xaf03('0x13')]);}else{logger[_0xaf03('0xd')](_0xaf03('0xe'),_0x3275a5,_0xaf03('0xf'));_0x4dd32b(_0x1b5dcc[_0xaf03('0x14')][_0xaf03('0x13')]);}})[_0xaf03('0x15')](function(_0x22ddec){logger[_0xaf03('0x12')](_0xaf03('0xe'),_0x3275a5,_0x22ddec);_0x1a2bdb(_0x22ddec);});});} \ No newline at end of file +var _0xe649=['error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x544f33,_0x9d9c80){var _0x20085e=function(_0x2e4043){while(--_0x2e4043){_0x544f33['push'](_0x544f33['shift']());}};_0x20085e(++_0x9d9c80);}(_0xe649,0x97));var _0x9e64=function(_0x47249e,_0xc7683b){_0x47249e=_0x47249e-0x0;var _0x154d33=_0xe649[_0x47249e];return _0x154d33;};'use strict';var _=require('lodash');var util=require(_0x9e64('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9e64('0x1'));var fs=require('fs');var Redis=require(_0x9e64('0x2'));var db=require(_0x9e64('0x3'))['db'];var utils=require(_0x9e64('0x4'));var logger=require(_0x9e64('0x5'))(_0x9e64('0x6'));var config=require('../../config/environment');var jayson=require(_0x9e64('0x7'));var client=jayson[_0x9e64('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300433,_0x2a588a,_0x1b68dc){return new BPromise(function(_0x19cf2e,_0x1d6a9d){return client[_0x9e64('0x9')](_0x300433,_0x1b68dc)[_0x9e64('0xa')](function(_0x2019a0){logger[_0x9e64('0xb')](_0x9e64('0xc'),_0x2a588a,_0x9e64('0xd'));logger[_0x9e64('0xe')](_0x9e64('0xf'),_0x2a588a,_0x9e64('0xd'),JSON[_0x9e64('0x10')](_0x2019a0));if(_0x2019a0[_0x9e64('0x11')]){if(_0x2019a0[_0x9e64('0x11')]['code']===0x1f4){logger[_0x9e64('0x11')](_0x9e64('0xc'),_0x2a588a,_0x2019a0[_0x9e64('0x11')][_0x9e64('0x12')]);return _0x1d6a9d(_0x2019a0[_0x9e64('0x11')][_0x9e64('0x12')]);}logger['error'](_0x9e64('0xc'),_0x2a588a,_0x2019a0[_0x9e64('0x11')][_0x9e64('0x12')]);return _0x19cf2e(_0x2019a0['error']['message']);}else{logger[_0x9e64('0xb')](_0x9e64('0xc'),_0x2a588a,'request\x20sent');_0x19cf2e(_0x2019a0[_0x9e64('0x13')]['message']);}})[_0x9e64('0x14')](function(_0x35c4e5){logger[_0x9e64('0x11')](_0x9e64('0xc'),_0x2a588a,_0x35c4e5);_0x1d6a9d(_0x35c4e5);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ce5b3c5..276b061 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 _0x76dd=['put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone'];(function(_0x1fa709,_0x585623){var _0x130ba1=function(_0x51cec3){while(--_0x51cec3){_0x1fa709['push'](_0x1fa709['shift']());}};_0x130ba1(++_0x585623);}(_0x76dd,0xdf));var _0xd76d=function(_0x5ba3d5,_0x3faf71){_0x5ba3d5=_0x5ba3d5-0x0;var _0xa952a9=_0x76dd[_0x5ba3d5];return _0xa952a9;};'use strict';var multer=require('multer');var util=require(_0xd76d('0x0'));var path=require('path');var timeout=require(_0xd76d('0x1'));var express=require('express');var router=express[_0xd76d('0x2')]();var fs_extra=require(_0xd76d('0x3'));var auth=require(_0xd76d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0xd76d('0x5')]('/',auth['isAuthenticated'](),controller[_0xd76d('0x6')]);router[_0xd76d('0x5')](_0xd76d('0x7'),auth[_0xd76d('0x8')](),controller[_0xd76d('0x9')]);router['get'](_0xd76d('0xa'),auth[_0xd76d('0x8')](),controller[_0xd76d('0xb')]);router['get']('/:id/answers',auth[_0xd76d('0x8')](),controller['getAnswers']);router[_0xd76d('0x5')](_0xd76d('0xc'),auth['isAuthenticated'](),timeout(_0xd76d('0xd')),controller[_0xd76d('0xe')]);router[_0xd76d('0xf')]('/',auth[_0xd76d('0x8')](),controller[_0xd76d('0x10')]);router[_0xd76d('0xf')](_0xd76d('0x11'),auth['isAuthenticated'](),controller[_0xd76d('0x12')]);router[_0xd76d('0x13')](_0xd76d('0x7'),auth[_0xd76d('0x8')](),controller['update']);router[_0xd76d('0x14')]('/:id',auth[_0xd76d('0x8')](),controller['destroy']);module[_0xd76d('0x15')]=router; \ No newline at end of file +var _0xd01e=['getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sessions'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xd01e,0x194));var _0xed01=function(_0x35a527,_0x17b3c1){_0x35a527=_0x35a527-0x0;var _0x4bb4ce=_0xd01e[_0x35a527];return _0x4bb4ce;};'use strict';var multer=require(_0xed01('0x0'));var util=require(_0xed01('0x1'));var path=require(_0xed01('0x2'));var timeout=require(_0xed01('0x3'));var express=require(_0xed01('0x4'));var router=express[_0xed01('0x5')]();var fs_extra=require(_0xed01('0x6'));var auth=require(_0xed01('0x7'));var interaction=require(_0xed01('0x8'));var config=require(_0xed01('0x9'));var controller=require('./jscriptyProject.controller');router[_0xed01('0xa')]('/',auth['isAuthenticated'](),controller[_0xed01('0xb')]);router[_0xed01('0xa')](_0xed01('0xc'),auth[_0xed01('0xd')](),controller[_0xed01('0xe')]);router[_0xed01('0xa')](_0xed01('0xf'),auth[_0xed01('0xd')](),controller[_0xed01('0x10')]);router[_0xed01('0xa')](_0xed01('0x11'),auth[_0xed01('0xd')](),controller['getAnswers']);router[_0xed01('0xa')](_0xed01('0x12'),auth[_0xed01('0xd')](),timeout(_0xed01('0x13')),controller[_0xed01('0x14')]);router[_0xed01('0x15')]('/',auth[_0xed01('0xd')](),controller[_0xed01('0x16')]);router[_0xed01('0x15')](_0xed01('0x17'),auth[_0xed01('0xd')](),controller['clone']);router[_0xed01('0x18')](_0xed01('0xc'),auth[_0xed01('0xd')](),controller[_0xed01('0x19')]);router['delete'](_0xed01('0xc'),auth[_0xed01('0xd')](),controller[_0xed01('0x1a')]);module[_0xed01('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index facb9ff..c08e384 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 _0xca2a=['name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','getDataValue','description','BOOLEAN','lodash','util','STRING'];(function(_0x4079e1,_0xeba708){var _0x14c475=function(_0x5ab4f2){while(--_0x5ab4f2){_0x4079e1['push'](_0x4079e1['shift']());}};_0x14c475(++_0xeba708);}(_0xca2a,0x1ce));var _0xaca2=function(_0x1ba263,_0x40c06b){_0x1ba263=_0x1ba263-0x0;var _0x3ac43a=_0xca2a[_0x1ba263];return _0x3ac43a;};'use strict';var Sequelize=require('sequelize');var _=require(_0xaca2('0x0'));var util=require(_0xaca2('0x1'));module['exports']={'name':{'type':Sequelize[_0xaca2('0x2')],'unique':_0xaca2('0x3')},'description':{'type':Sequelize[_0xaca2('0x2')]},'formData':{'type':Sequelize[_0xaca2('0x4')](_0xaca2('0x5')),'set':function(_0x21d88c){if(_[_0xaca2('0x6')](_0x21d88c)){this[_0xaca2('0x7')]('formData',JSON[_0xaca2('0x8')](_0x21d88c));}else if(_[_0xaca2('0x9')](_0x21d88c)){this[_0xaca2('0x7')](_0xaca2('0xa'),_0x21d88c);}else{this[_0xaca2('0x7')](_0xaca2('0xa'),util[_0xaca2('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xaca2('0xc')](_0xaca2('0x3'))||'',this['getDataValue'](_0xaca2('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xaca2('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xaca2('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xd9ac=['getDataValue','name','BOOLEAN','sequelize','lodash','exports','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x162ee0,_0x291661){var _0x48fc5e=function(_0x297a35){while(--_0x297a35){_0x162ee0['push'](_0x162ee0['shift']());}};_0x48fc5e(++_0x291661);}(_0xd9ac,0x65));var _0xcd9a=function(_0x430ae0,_0x4887ef){_0x430ae0=_0x430ae0-0x0;var _0x38c1e1=_0xd9ac[_0x430ae0];return _0x38c1e1;};'use strict';var Sequelize=require(_0xcd9a('0x0'));var _=require(_0xcd9a('0x1'));var util=require('util');module[_0xcd9a('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xcd9a('0x3')]('long'),'set':function(_0x128db9){if(_[_0xcd9a('0x4')](_0x128db9)){this['setDataValue'](_0xcd9a('0x5'),JSON[_0xcd9a('0x6')](_0x128db9));}else if(_[_0xcd9a('0x7')](_0x128db9)){this[_0xcd9a('0x8')](_0xcd9a('0x5'),_0x128db9);}else{this[_0xcd9a('0x8')](_0xcd9a('0x5'),util[_0xcd9a('0x9')](_0xcd9a('0xa'),this[_0xcd9a('0xb')](_0xcd9a('0xc'))||'',this[_0xcd9a('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xcd9a('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcd9a('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index ef9cccc..d3e7f5a 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 _0xc19a=['getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','userProfileId','getSessions','findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xc19a,0x7f));var _0xac19=function(_0x5e2bee,_0x103eee){_0x5e2bee=_0x5e2bee-0x0;var _0x31f19f=_0xc19a[_0x5e2bee];return _0x31f19f;};'use strict';var emlformat=require(_0xac19('0x0'));var rimraf=require(_0xac19('0x1'));var zipdir=require(_0xac19('0x2'));var jsonpatch=require(_0xac19('0x3'));var rp=require('request-promise');var moment=require(_0xac19('0x4'));var BPromise=require(_0xac19('0x5'));var Mustache=require(_0xac19('0x6'));var util=require('util');var path=require(_0xac19('0x7'));var sox=require(_0xac19('0x8'));var csv=require('to-csv');var ejs=require(_0xac19('0x9'));var fs=require('fs');var fs_extra=require(_0xac19('0xa'));var _=require('lodash');var squel=require(_0xac19('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac19('0xc'));var querystring=require(_0xac19('0xd'));var Papa=require(_0xac19('0xe'));var Redis=require(_0xac19('0xf'));var authService=require(_0xac19('0x10'));var qs=require(_0xac19('0x11'));var as=require(_0xac19('0x12'));var hardwareService=require(_0xac19('0x13'));var logger=require('../../config/logger')(_0xac19('0x14'));var utils=require(_0xac19('0x15'));var config=require(_0xac19('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x493836,_0x52f65e){_0x52f65e=_0x52f65e||0xcc;return function(_0xba0c2a){if(_0xba0c2a){return _0x493836[_0xac19('0x17')](_0x52f65e);}return _0x493836['status'](_0x52f65e)['end']();};}function respondWithResult(_0x1bfe4a,_0x5a0214){_0x5a0214=_0x5a0214||0xc8;return function(_0x127a6e){if(_0x127a6e){return _0x1bfe4a[_0xac19('0x18')](_0x5a0214)['json'](_0x127a6e);}};}function respondWithFilteredResult(_0x189eab,_0x5817e1){return function(_0x204220){if(_0x204220){var _0x1961fc=typeof _0x5817e1[_0xac19('0x19')]===_0xac19('0x1a')&&typeof _0x5817e1[_0xac19('0x1b')]==='undefined';var _0x5235ac=_0x204220[_0xac19('0x1c')];var _0x26c053=_0x1961fc?0x0:_0x5817e1[_0xac19('0x19')];var _0x42d094=_0x1961fc?_0x204220['count']:_0x5817e1['offset']+_0x5817e1[_0xac19('0x1b')];var _0x2b0e52;if(_0x42d094>=_0x5235ac){_0x42d094=_0x5235ac;_0x2b0e52=0xc8;}else{_0x2b0e52=0xce;}_0x189eab[_0xac19('0x18')](_0x2b0e52);return _0x189eab[_0xac19('0x1d')](_0xac19('0x1e'),_0x26c053+'-'+_0x42d094+'/'+_0x5235ac)[_0xac19('0x1f')](_0x204220);}return null;};}function patchUpdates(_0x3d63c0){return function(_0x1d150b){try{jsonpatch[_0xac19('0x20')](_0x1d150b,_0x3d63c0,!![]);}catch(_0x7239ca){return BPromise['reject'](_0x7239ca);}return _0x1d150b[_0xac19('0x21')]();};}function saveUpdates(_0x347f6e,_0x2c457f){return function(_0x31dbb7){if(_0x31dbb7){return _0x31dbb7['update'](_0x347f6e)[_0xac19('0x22')](function(_0x52b6d2){return _0x52b6d2;});}return null;};}function removeEntity(_0x605bb3,_0x5d65fb){return function(_0x404842){if(_0x404842){return _0x404842[_0xac19('0x23')]()['then'](function(){var _0x339fd1=_0x404842[_0xac19('0x24')]({'plain':!![]});var _0x4158c4='Projects';return db[_0xac19('0x25')][_0xac19('0x23')]({'where':{'type':_0x4158c4,'resourceId':_0x339fd1['id']}})[_0xac19('0x22')](function(){return _0x404842;});})[_0xac19('0x22')](function(){_0x605bb3[_0xac19('0x18')](0xcc)[_0xac19('0x26')]();});}};}function handleEntityNotFound(_0x5bde80,_0x3fcbbf){return function(_0x15ec90){if(!_0x15ec90){_0x5bde80[_0xac19('0x17')](0x194);}return _0x15ec90;};}function handleError(_0x153a6a,_0x4c3c8d){_0x4c3c8d=_0x4c3c8d||0x1f4;return function(_0x1301cd){logger[_0xac19('0x27')](_0x1301cd[_0xac19('0x28')]);if(_0x1301cd[_0xac19('0x29')]){delete _0x1301cd['name'];}_0x153a6a[_0xac19('0x18')](_0x4c3c8d)[_0xac19('0x2a')](_0x1301cd);};}exports[_0xac19('0x2b')]=function(_0x1e7013,_0x5cb694){var _0x222d3e={},_0x249546={},_0x187f25={'count':0x0,'rows':[]};var _0x17752e=_[_0xac19('0x2c')](db[_0xac19('0x2d')][_0xac19('0x2e')],function(_0x11aab6){return{'name':_0x11aab6[_0xac19('0x2f')],'type':_0x11aab6[_0xac19('0x30')]['key']};});_0x249546[_0xac19('0x31')]=_[_0xac19('0x2c')](_0x17752e,'name');_0x249546['query']=_[_0xac19('0x32')](_0x1e7013[_0xac19('0x33')]);_0x249546[_0xac19('0x34')]=_[_0xac19('0x35')](_0x249546[_0xac19('0x31')],_0x249546[_0xac19('0x33')]);_0x222d3e[_0xac19('0x36')]=_[_0xac19('0x35')](_0x249546['model'],qs['fields'](_0x1e7013[_0xac19('0x33')][_0xac19('0x37')]));_0x222d3e[_0xac19('0x36')]=_0x222d3e[_0xac19('0x36')][_0xac19('0x38')]?_0x222d3e['attributes']:_0x249546[_0xac19('0x31')];if(!_0x1e7013['query'][_0xac19('0x39')]('nolimit')){_0x222d3e[_0xac19('0x1b')]=qs[_0xac19('0x1b')](_0x1e7013[_0xac19('0x33')][_0xac19('0x1b')]);_0x222d3e[_0xac19('0x19')]=qs[_0xac19('0x19')](_0x1e7013[_0xac19('0x33')][_0xac19('0x19')]);}_0x222d3e[_0xac19('0x3a')]=qs[_0xac19('0x3b')](_0x1e7013[_0xac19('0x33')]['sort']);_0x222d3e[_0xac19('0x3c')]=qs['filters'](_[_0xac19('0x3d')](_0x1e7013['query'],_0x249546[_0xac19('0x34')]),_0x17752e);if(_0x1e7013[_0xac19('0x33')][_0xac19('0x3e')]){_0x222d3e[_0xac19('0x3c')]=_['merge'](_0x222d3e['where'],{'$or':_['map'](_0x17752e,function(_0x5b0b78){if(_0x5b0b78[_0xac19('0x30')]!==_0xac19('0x3f')){var _0x3eec1d={};_0x3eec1d[_0x5b0b78[_0xac19('0x29')]]={'$like':'%'+_0x1e7013[_0xac19('0x33')][_0xac19('0x3e')]+'%'};return _0x3eec1d;}})});}_0x222d3e=_['merge']({},_0x222d3e,_0x1e7013[_0xac19('0x40')]);var _0x21e984={'where':_0x222d3e[_0xac19('0x3c')]};return db['JscriptyProject'][_0xac19('0x1c')](_0x21e984)['then'](function(_0x305092){_0x187f25[_0xac19('0x1c')]=_0x305092;if(_0x1e7013[_0xac19('0x33')][_0xac19('0x41')]){_0x222d3e[_0xac19('0x42')]=[{'all':!![]}];}return db[_0xac19('0x2d')][_0xac19('0x43')](_0x222d3e);})[_0xac19('0x22')](function(_0x2b70ea){_0x187f25['rows']=_0x2b70ea;return _0x187f25;})[_0xac19('0x22')](respondWithFilteredResult(_0x5cb694,_0x222d3e))[_0xac19('0x44')](handleError(_0x5cb694,null));};exports['show']=function(_0x2e83d8,_0x13fe80){var _0x592b58={'raw':![],'where':{'id':_0x2e83d8[_0xac19('0x45')]['id']}},_0x4c6b30={};_0x4c6b30[_0xac19('0x31')]=_[_0xac19('0x32')](db[_0xac19('0x2d')][_0xac19('0x2e')]);_0x4c6b30[_0xac19('0x33')]=_[_0xac19('0x32')](_0x2e83d8[_0xac19('0x33')]);_0x4c6b30[_0xac19('0x34')]=_[_0xac19('0x35')](_0x4c6b30[_0xac19('0x31')],_0x4c6b30[_0xac19('0x33')]);_0x592b58['attributes']=_[_0xac19('0x35')](_0x4c6b30[_0xac19('0x31')],qs[_0xac19('0x37')](_0x2e83d8[_0xac19('0x33')]['fields']));_0x592b58[_0xac19('0x36')]=_0x592b58[_0xac19('0x36')][_0xac19('0x38')]?_0x592b58[_0xac19('0x36')]:_0x4c6b30[_0xac19('0x31')];if(_0x2e83d8[_0xac19('0x33')]['includeAll']){_0x592b58[_0xac19('0x42')]=[{'all':!![]}];}_0x592b58=_[_0xac19('0x46')]({},_0x592b58,_0x2e83d8[_0xac19('0x40')]);return db[_0xac19('0x2d')][_0xac19('0x47')](_0x592b58)[_0xac19('0x22')](handleEntityNotFound(_0x13fe80,null))[_0xac19('0x22')](respondWithResult(_0x13fe80,null))[_0xac19('0x44')](handleError(_0x13fe80,null));};exports[_0xac19('0x48')]=function(_0x3df206,_0x1d107b){return db['JscriptyProject'][_0xac19('0x48')](_0x3df206['body'],{})[_0xac19('0x22')](function(_0x4ecf1b){var _0x90dac4=_0x3df206[_0xac19('0x49')][_0xac19('0x24')]({'plain':!![]});if(!_0x90dac4)throw new Error(_0xac19('0x4a'));if(_0x90dac4[_0xac19('0x4b')]===_0xac19('0x49')){var _0x22ddf3=_0x4ecf1b[_0xac19('0x24')]({'plain':!![]});var _0x7906a1=_0xac19('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x7906a1,'userProfileId':_0x90dac4['userProfileId']},'raw':!![]})['then'](function(_0x106b5a){if(_0x106b5a&&_0x106b5a[_0xac19('0x4d')]===0x0){return db[_0xac19('0x25')][_0xac19('0x48')]({'name':_0x22ddf3[_0xac19('0x29')],'resourceId':_0x22ddf3['id'],'type':_0x106b5a[_0xac19('0x29')],'sectionId':_0x106b5a['id']},{})[_0xac19('0x22')](function(){return _0x4ecf1b;});}else{return _0x4ecf1b;}})[_0xac19('0x44')](function(_0x10e08c){logger[_0xac19('0x27')](_0xac19('0x4e'),_0x10e08c);throw _0x10e08c;});}return _0x4ecf1b;})[_0xac19('0x22')](respondWithResult(_0x1d107b,0xc9))['catch'](handleError(_0x1d107b,null));};exports[_0xac19('0x4f')]=function(_0x2381f2,_0x4409fb){var _0x283cb8={'where':{'id':_0x2381f2[_0xac19('0x45')]['id']}},_0x1c2d41={};_0x1c2d41[_0xac19('0x31')]=_[_0xac19('0x32')](db['JscriptyProject'][_0xac19('0x2e')]);_0x283cb8[_0xac19('0x36')]=_[_0xac19('0x35')](_0x1c2d41['model'],qs[_0xac19('0x37')](_0x2381f2[_0xac19('0x33')][_0xac19('0x37')]));_0x283cb8[_0xac19('0x36')]=_0x283cb8[_0xac19('0x36')][_0xac19('0x38')]?_0x283cb8[_0xac19('0x36')]:_0x1c2d41[_0xac19('0x31')];if(_0x2381f2[_0xac19('0x33')][_0xac19('0x41')]){_0x283cb8['include']=[{'all':!![]}];}_0x283cb8=_[_0xac19('0x46')]({},_0x283cb8,_0x2381f2[_0xac19('0x40')]);return db[_0xac19('0x2d')]['find'](_0x283cb8)[_0xac19('0x22')](handleEntityNotFound(_0x4409fb,null))[_0xac19('0x22')](function(_0x5c0e17){if(_0x5c0e17){var _0x534906=_0x5c0e17[_0xac19('0x24')]({'plain':!![]});_0x534906=qs[_0xac19('0x50')](_0x534906,['id','createdAt',_0xac19('0x51')]);_0x2381f2[_0xac19('0x52')]=_[_0xac19('0x50')](_0x2381f2[_0xac19('0x52')],['id','createdAt',_0xac19('0x51')]);return db[_0xac19('0x2d')][_0xac19('0x48')](_[_0xac19('0x46')](_0x534906,_0x2381f2[_0xac19('0x52')]),{'include':_0x2381f2[_0xac19('0x33')][_0xac19('0x41')]?[{'all':!![]}]:undefined})[_0xac19('0x22')](function(_0x3491e6){var _0x23156a=_0x2381f2[_0xac19('0x49')][_0xac19('0x24')]({'plain':!![]});if(!_0x23156a)throw new Error(_0xac19('0x4a'));if(_0x23156a[_0xac19('0x4b')]===_0xac19('0x49')){var _0xedee68=_0x3491e6['get']({'plain':!![]});var _0x5beee3=_0xac19('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x5beee3,'userProfileId':_0x23156a[_0xac19('0x53')]},'raw':!![]})[_0xac19('0x22')](function(_0x16a10d){if(_0x16a10d&&_0x16a10d[_0xac19('0x4d')]===0x0){return db[_0xac19('0x25')]['create']({'name':_0xedee68[_0xac19('0x29')],'resourceId':_0xedee68['id'],'type':_0x16a10d[_0xac19('0x29')],'sectionId':_0x16a10d['id']},{})[_0xac19('0x22')](function(){return _0x3491e6;});}else{return _0x3491e6;}})[_0xac19('0x44')](function(_0x28d206){logger[_0xac19('0x27')](_0xac19('0x4e'),_0x28d206);throw _0x28d206;});}return _0x3491e6;});}})[_0xac19('0x22')](respondWithResult(_0x4409fb,0xc9))[_0xac19('0x44')](handleError(_0x4409fb,null));};exports['update']=function(_0x47c422,_0x1c49cc){if(_0x47c422[_0xac19('0x52')]['id']){delete _0x47c422['body']['id'];}return db[_0xac19('0x2d')][_0xac19('0x47')]({'where':{'id':_0x47c422['params']['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x1c49cc,null))[_0xac19('0x22')](saveUpdates(_0x47c422[_0xac19('0x52')],null))['then'](respondWithResult(_0x1c49cc,null))[_0xac19('0x44')](handleError(_0x1c49cc,null));};exports[_0xac19('0x23')]=function(_0x1b1fa3,_0x45cdf4){return db[_0xac19('0x2d')]['find']({'where':{'id':_0x1b1fa3[_0xac19('0x45')]['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x45cdf4,null))[_0xac19('0x22')](removeEntity(_0x45cdf4,null))[_0xac19('0x44')](handleError(_0x45cdf4,null));};exports[_0xac19('0x54')]=function(_0x1470e1,_0x2afb93,_0x41affc){var _0xbb8088={'raw':!![],'where':{}};var _0x5a7f87={};var _0x36f3c3={'count':0x0,'rows':[]};return db[_0xac19('0x2d')][_0xac19('0x55')]({'where':{'id':_0x1470e1[_0xac19('0x45')]['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x2afb93,null))[_0xac19('0x22')](function(_0x49ba3f){if(_0x49ba3f){_0x5a7f87['model']=_['keys'](db[_0xac19('0x56')][_0xac19('0x2e')]);_0x5a7f87[_0xac19('0x33')]=_[_0xac19('0x32')](_0x1470e1[_0xac19('0x33')]);_0x5a7f87['filters']=_[_0xac19('0x35')](_0x5a7f87[_0xac19('0x31')],_0x5a7f87[_0xac19('0x33')]);_0xbb8088[_0xac19('0x36')]=_[_0xac19('0x35')](_0x5a7f87[_0xac19('0x31')],qs['fields'](_0x1470e1[_0xac19('0x33')]['fields']));_0xbb8088[_0xac19('0x36')]=_0xbb8088[_0xac19('0x36')]['length']?_0xbb8088[_0xac19('0x36')]:_0x5a7f87[_0xac19('0x31')];if(!_0x1470e1[_0xac19('0x33')]['hasOwnProperty']('nolimit')){_0xbb8088['limit']=qs[_0xac19('0x1b')](_0x1470e1[_0xac19('0x33')][_0xac19('0x1b')]);_0xbb8088['offset']=qs[_0xac19('0x19')](_0x1470e1[_0xac19('0x33')][_0xac19('0x19')]);}_0xbb8088[_0xac19('0x3a')]=qs[_0xac19('0x3b')](_0x1470e1[_0xac19('0x33')][_0xac19('0x3b')]);_0xbb8088[_0xac19('0x3c')]=qs[_0xac19('0x34')](_[_0xac19('0x3d')](_0x1470e1[_0xac19('0x33')],_0x5a7f87[_0xac19('0x34')]));_0xbb8088['where'][_0xac19('0x57')]=_0x49ba3f['id'];if(_0x1470e1[_0xac19('0x33')][_0xac19('0x3e')]){_0xbb8088[_0xac19('0x3c')]=_[_0xac19('0x46')](_0xbb8088['where'],{'$or':_[_0xac19('0x2c')](_0xbb8088['attributes'],function(_0x342109){var _0x16fcf0={};_0x16fcf0[_0x342109]={'$like':'%'+_0x1470e1[_0xac19('0x33')][_0xac19('0x3e')]+'%'};return _0x16fcf0;})});}_0xbb8088=_[_0xac19('0x46')]({},_0xbb8088,_0x1470e1['options']);return db[_0xac19('0x56')][_0xac19('0x1c')]({'where':_0xbb8088[_0xac19('0x3c')]})[_0xac19('0x22')](function(_0x350f81){_0x36f3c3['count']=_0x350f81;if(_0x1470e1[_0xac19('0x33')][_0xac19('0x41')]){_0xbb8088[_0xac19('0x42')]=[{'all':!![]}];}return db[_0xac19('0x56')]['findAll'](_0xbb8088);})[_0xac19('0x22')](function(_0x1ad2ef){_0x36f3c3[_0xac19('0x58')]=_0x1ad2ef;return _0x36f3c3;});}})[_0xac19('0x22')](respondWithFilteredResult(_0x2afb93,_0xbb8088))[_0xac19('0x44')](handleError(_0x2afb93,null));};exports[_0xac19('0x59')]=function(_0x1d3c73,_0x1b7a6e,_0x5e35fc){var _0x3ad8ad={'raw':!![],'where':{}};var _0x54ea46={};var _0xf90ae4={'count':0x0,'rows':[]};return db[_0xac19('0x2d')]['findOne']({'where':{'id':_0x1d3c73[_0xac19('0x45')]['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x1b7a6e,null))['then'](function(_0x1d447e){if(_0x1d447e){_0x54ea46[_0xac19('0x31')]=_[_0xac19('0x32')](db[_0xac19('0x5a')][_0xac19('0x2e')]);_0x54ea46[_0xac19('0x33')]=_['keys'](_0x1d3c73[_0xac19('0x33')]);_0x54ea46[_0xac19('0x34')]=_['intersection'](_0x54ea46[_0xac19('0x31')],_0x54ea46['query']);_0x3ad8ad[_0xac19('0x36')]=_[_0xac19('0x35')](_0x54ea46['model'],qs[_0xac19('0x37')](_0x1d3c73[_0xac19('0x33')]['fields']));_0x3ad8ad[_0xac19('0x36')]=_0x3ad8ad['attributes'][_0xac19('0x38')]?_0x3ad8ad[_0xac19('0x36')]:_0x54ea46['model'];if(!_0x1d3c73[_0xac19('0x33')][_0xac19('0x39')]('nolimit')){_0x3ad8ad['limit']=qs['limit'](_0x1d3c73[_0xac19('0x33')]['limit']);_0x3ad8ad[_0xac19('0x19')]=qs[_0xac19('0x19')](_0x1d3c73[_0xac19('0x33')][_0xac19('0x19')]);}_0x3ad8ad[_0xac19('0x3a')]=qs[_0xac19('0x3b')](_0x1d3c73['query'][_0xac19('0x3b')]);_0x3ad8ad[_0xac19('0x3c')]=qs[_0xac19('0x34')](_[_0xac19('0x3d')](_0x1d3c73[_0xac19('0x33')],_0x54ea46[_0xac19('0x34')]));_0x3ad8ad[_0xac19('0x3c')]['ProjectId']=_0x1d447e['id'];if(_0x1d3c73[_0xac19('0x33')][_0xac19('0x3e')]){_0x3ad8ad[_0xac19('0x3c')]=_[_0xac19('0x46')](_0x3ad8ad['where'],{'$or':_[_0xac19('0x2c')](_0x3ad8ad['attributes'],function(_0x593abc){var _0x54e324={};_0x54e324[_0x593abc]={'$like':'%'+_0x1d3c73[_0xac19('0x33')]['filter']+'%'};return _0x54e324;})});}_0x3ad8ad=_[_0xac19('0x46')]({},_0x3ad8ad,_0x1d3c73['options']);return db['JscriptyAnswerReport'][_0xac19('0x1c')]({'where':_0x3ad8ad[_0xac19('0x3c')]})[_0xac19('0x22')](function(_0x5f0b35){_0xf90ae4[_0xac19('0x1c')]=_0x5f0b35;if(_0x1d3c73[_0xac19('0x33')]['includeAll']){_0x3ad8ad[_0xac19('0x42')]=[{'all':!![]}];}return db[_0xac19('0x5a')][_0xac19('0x43')](_0x3ad8ad);})['then'](function(_0x26ec54){_0xf90ae4[_0xac19('0x58')]=_0x26ec54;return _0xf90ae4;});}})[_0xac19('0x22')](respondWithFilteredResult(_0x1b7a6e,_0x3ad8ad))[_0xac19('0x44')](handleError(_0x1b7a6e,null));};function char(_0x5c397b){return _0xac19('0x5b')===typeof _0x5c397b?String[_0xac19('0x5c')][_0xac19('0x20')](null,arguments):_0x5c397b;}function needsEncapsulation(_0xab241e){return!!_0xab241e&&(_0xab241e['toString']()[_0xac19('0x5d')](char(0xd))>=0x0||_0xab241e[_0xac19('0x5e')]()[_0xac19('0x5d')](char(0xa))>=0x0||_0xab241e[_0xac19('0x5e')]()[_0xac19('0x5d')](char(0x2c))>=0x0||_0xab241e[_0xac19('0x5e')]()[_0xac19('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x2b629c){var _0x45574f=char(0x22),_0x45f63a='\x5c'+char(0x22),_0x54a972=_0x2b629c[_0xac19('0x5e')]()['replace'](new RegExp(_0x45574f,'g'),_0x45f63a);return _0x45574f+_0x54a972+_0x45574f;}exports[_0xac19('0x5f')]=function(_0x292700,_0x420d39,_0x216012){var _0x4b7d18,_0x453ade;var _0x45475a={'where':{'ProjectId':_0x292700['params']['id']}};if(_0x292700[_0xac19('0x33')][_0xac19('0x60')]){_0x45475a[_0xac19('0x3c')]['starttime']=JSON[_0xac19('0x61')](_0x292700['query']['startTime']);}return db[_0xac19('0x56')][_0xac19('0x43')](_0x45475a)['then'](handleEntityNotFound(_0x420d39,null))['then'](function(_0xd3b5d){if(_0xd3b5d){_0x4b7d18=_0xd3b5d;return db['JscriptyQuestionReport'][_0xac19('0x43')]({'where':{'SessionId':{'$in':_[_0xac19('0x2c')](_0x4b7d18,'id')},'ProjectId':_0x292700[_0xac19('0x45')]['id']},'order':_0xac19('0x62')});}})['then'](handleEntityNotFound(_0x420d39,null))[_0xac19('0x22')](function(_0xf6a08e){if(_0xf6a08e){_0x453ade=_0xf6a08e;var _0x55a80e={};for(var _0x3ae05c=0x0,_0x196c7c=_0x453ade['length'];_0x3ae05c<_0x196c7c;_0x3ae05c++){if(!_0x55a80e['hasOwnProperty'](_0x453ade[_0x3ae05c][_0xac19('0x63')])){_0x55a80e[_0x453ade[_0x3ae05c][_0xac19('0x63')]]=needsEncapsulation(_0x453ade[_0x3ae05c][_0xac19('0x64')])?encapsulate(_0x453ade[_0x3ae05c][_0xac19('0x64')]):_0x453ade[_0x3ae05c][_0xac19('0x64')];}}var _0x4508df=[],_0x5b3d43={};for(var _0x20343b=0x0,_0x10ebf=_0x4b7d18['length'];_0x20343b<_0x10ebf;_0x20343b++){_0x5b3d43={'ProjectId':_0x292700[_0xac19('0x45')]['id'],'SessionId':_0x4b7d18[_0x20343b]['id'],'StartTime':moment(_0x4b7d18[_0x20343b][_0xac19('0x65')])[_0xac19('0x66')](_0xac19('0x67'))};for(var _0x31722b=0x0,_0x5c8654=_0x453ade[_0xac19('0x38')];_0x31722b<_0x5c8654;_0x31722b++){if(_0x453ade[_0x31722b][_0xac19('0x68')]==_0x4b7d18[_0x20343b]['id']&&_0x55a80e[_0xac19('0x39')](_0x453ade[_0x31722b]['questionId'])){_0x5b3d43[_0x55a80e[_0x453ade[_0x31722b][_0xac19('0x63')]]]=_0x453ade[_0x31722b][_0xac19('0x69')];}}for(var _0x3b1c66 in _0x55a80e){if(!_0x5b3d43['hasOwnProperty'](_0x55a80e[_0x3b1c66])){_0x5b3d43[_0x55a80e[_0x3b1c66]]=null;}}_0x4508df['push'](_0x5b3d43);}return _0x4508df;}})[_0xac19('0x22')](function(_0x286595){if(!_['isEmpty'](_0x286595)){var _0x4b7185=toCsv(_0x286595);var _0x3116b0=Date[_0xac19('0x6a')]();fs[_0xac19('0x6b')](util[_0xac19('0x66')](_0xac19('0x6c'),_0x292700[_0xac19('0x45')]['id'],_0x3116b0),_0x4b7185);_0x420d39[_0xac19('0x6d')](_0xac19('0x6e'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x292700['params']['id'],_0x3116b0));_0x420d39[_0xac19('0x6d')]('Content-type','text/csv');return _0x420d39['download'](util[_0xac19('0x66')](_0xac19('0x6c'),_0x292700[_0xac19('0x45')]['id'],_0x3116b0));}else{return _0x420d39[_0xac19('0x17')](0xcc);}})[_0xac19('0x44')](handleError(_0x420d39,null));}; \ No newline at end of file +var _0x2d6d=['jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','status','Content-Range','json','apply','reject','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','map','JscriptyProject','includeAll','include','rows','show','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','UserProfileSection','JscriptySessionReport','order','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2d6d,0x66));var _0xd2d6=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x2d6d[_0x109371];return _0x4fd858;};'use strict';var emlformat=require(_0xd2d6('0x0'));var rimraf=require(_0xd2d6('0x1'));var zipdir=require(_0xd2d6('0x2'));var jsonpatch=require(_0xd2d6('0x3'));var rp=require(_0xd2d6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd2d6('0x5'));var util=require(_0xd2d6('0x6'));var path=require(_0xd2d6('0x7'));var sox=require(_0xd2d6('0x8'));var csv=require(_0xd2d6('0x9'));var ejs=require(_0xd2d6('0xa'));var fs=require('fs');var fs_extra=require(_0xd2d6('0xb'));var _=require(_0xd2d6('0xc'));var squel=require(_0xd2d6('0xd'));var crypto=require('crypto');var jsforce=require(_0xd2d6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd2d6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd2d6('0xf'));var authService=require(_0xd2d6('0x10'));var qs=require(_0xd2d6('0x11'));var as=require(_0xd2d6('0x12'));var hardwareService=require(_0xd2d6('0x13'));var logger=require(_0xd2d6('0x14'))(_0xd2d6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd2d6('0x16'));var db=require(_0xd2d6('0x17'))['db'];function respondWithStatusCode(_0x43dbae,_0x199206){_0x199206=_0x199206||0xcc;return function(_0x38a8be){if(_0x38a8be){return _0x43dbae[_0xd2d6('0x18')](_0x199206);}return _0x43dbae['status'](_0x199206)[_0xd2d6('0x19')]();};}function respondWithResult(_0x1ed2e8,_0xb0a34){_0xb0a34=_0xb0a34||0xc8;return function(_0x439e3d){if(_0x439e3d){return _0x1ed2e8['status'](_0xb0a34)['json'](_0x439e3d);}};}function respondWithFilteredResult(_0x37a6bc,_0x352619){return function(_0x2a4b1a){if(_0x2a4b1a){var _0x8ba7fb=typeof _0x352619[_0xd2d6('0x1a')]===_0xd2d6('0x1b')&&typeof _0x352619['limit']===_0xd2d6('0x1b');var _0x57a7ea=_0x2a4b1a['count'];var _0x568aff=_0x8ba7fb?0x0:_0x352619[_0xd2d6('0x1a')];var _0x322a52=_0x8ba7fb?_0x2a4b1a[_0xd2d6('0x1c')]:_0x352619[_0xd2d6('0x1a')]+_0x352619['limit'];var _0x2d3bcb;if(_0x322a52>=_0x57a7ea){_0x322a52=_0x57a7ea;_0x2d3bcb=0xc8;}else{_0x2d3bcb=0xce;}_0x37a6bc[_0xd2d6('0x1d')](_0x2d3bcb);return _0x37a6bc['set'](_0xd2d6('0x1e'),_0x568aff+'-'+_0x322a52+'/'+_0x57a7ea)[_0xd2d6('0x1f')](_0x2a4b1a);}return null;};}function patchUpdates(_0x4313ae){return function(_0x5666e9){try{jsonpatch[_0xd2d6('0x20')](_0x5666e9,_0x4313ae,!![]);}catch(_0x213e96){return BPromise[_0xd2d6('0x21')](_0x213e96);}return _0x5666e9['save']();};}function saveUpdates(_0x39d3f0,_0x2422c0){return function(_0x5d4f17){if(_0x5d4f17){return _0x5d4f17[_0xd2d6('0x22')](_0x39d3f0)[_0xd2d6('0x23')](function(_0x485ea5){return _0x485ea5;});}return null;};}function removeEntity(_0x47f7a1,_0x1f296e){return function(_0x50544a){if(_0x50544a){return _0x50544a[_0xd2d6('0x24')]()[_0xd2d6('0x23')](function(){var _0x1eb5b7=_0x50544a[_0xd2d6('0x25')]({'plain':!![]});var _0x4f52bb=_0xd2d6('0x26');return db[_0xd2d6('0x27')][_0xd2d6('0x24')]({'where':{'type':_0x4f52bb,'resourceId':_0x1eb5b7['id']}})[_0xd2d6('0x23')](function(){return _0x50544a;});})['then'](function(){_0x47f7a1[_0xd2d6('0x1d')](0xcc)[_0xd2d6('0x19')]();});}};}function handleEntityNotFound(_0x1ffd00,_0xa7925f){return function(_0x5ee73e){if(!_0x5ee73e){_0x1ffd00[_0xd2d6('0x18')](0x194);}return _0x5ee73e;};}function handleError(_0x4999a5,_0x381afa){_0x381afa=_0x381afa||0x1f4;return function(_0x4c1828){logger[_0xd2d6('0x28')](_0x4c1828[_0xd2d6('0x29')]);if(_0x4c1828[_0xd2d6('0x2a')]){delete _0x4c1828[_0xd2d6('0x2a')];}_0x4999a5[_0xd2d6('0x1d')](_0x381afa)[_0xd2d6('0x2b')](_0x4c1828);};}exports['index']=function(_0x50b68a,_0x26c198){var _0x4adb9d={},_0x469e19={},_0x2fd3cf={'count':0x0,'rows':[]};var _0x2553a7=_['map'](db['JscriptyProject'][_0xd2d6('0x2c')],function(_0x45c134){return{'name':_0x45c134['fieldName'],'type':_0x45c134[_0xd2d6('0x2d')][_0xd2d6('0x2e')]};});_0x469e19[_0xd2d6('0x2f')]=_['map'](_0x2553a7,'name');_0x469e19['query']=_[_0xd2d6('0x30')](_0x50b68a[_0xd2d6('0x31')]);_0x469e19['filters']=_[_0xd2d6('0x32')](_0x469e19[_0xd2d6('0x2f')],_0x469e19[_0xd2d6('0x31')]);_0x4adb9d[_0xd2d6('0x33')]=_[_0xd2d6('0x32')](_0x469e19[_0xd2d6('0x2f')],qs[_0xd2d6('0x34')](_0x50b68a[_0xd2d6('0x31')][_0xd2d6('0x34')]));_0x4adb9d[_0xd2d6('0x33')]=_0x4adb9d[_0xd2d6('0x33')][_0xd2d6('0x35')]?_0x4adb9d[_0xd2d6('0x33')]:_0x469e19[_0xd2d6('0x2f')];if(!_0x50b68a[_0xd2d6('0x31')][_0xd2d6('0x36')](_0xd2d6('0x37'))){_0x4adb9d[_0xd2d6('0x38')]=qs[_0xd2d6('0x38')](_0x50b68a[_0xd2d6('0x31')][_0xd2d6('0x38')]);_0x4adb9d[_0xd2d6('0x1a')]=qs[_0xd2d6('0x1a')](_0x50b68a['query'][_0xd2d6('0x1a')]);}_0x4adb9d['order']=qs[_0xd2d6('0x39')](_0x50b68a[_0xd2d6('0x31')][_0xd2d6('0x39')]);_0x4adb9d['where']=qs[_0xd2d6('0x3a')](_[_0xd2d6('0x3b')](_0x50b68a[_0xd2d6('0x31')],_0x469e19[_0xd2d6('0x3a')]),_0x2553a7);if(_0x50b68a['query'][_0xd2d6('0x3c')]){_0x4adb9d[_0xd2d6('0x3d')]=_[_0xd2d6('0x3e')](_0x4adb9d[_0xd2d6('0x3d')],{'$or':_[_0xd2d6('0x3f')](_0x2553a7,function(_0x5c9cbf){if(_0x5c9cbf[_0xd2d6('0x2d')]!=='VIRTUAL'){var _0x43fdaa={};_0x43fdaa[_0x5c9cbf['name']]={'$like':'%'+_0x50b68a['query'][_0xd2d6('0x3c')]+'%'};return _0x43fdaa;}})});}_0x4adb9d=_[_0xd2d6('0x3e')]({},_0x4adb9d,_0x50b68a['options']);var _0x12c794={'where':_0x4adb9d[_0xd2d6('0x3d')]};return db[_0xd2d6('0x40')]['count'](_0x12c794)[_0xd2d6('0x23')](function(_0x5baf88){_0x2fd3cf[_0xd2d6('0x1c')]=_0x5baf88;if(_0x50b68a[_0xd2d6('0x31')][_0xd2d6('0x41')]){_0x4adb9d[_0xd2d6('0x42')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x4adb9d);})[_0xd2d6('0x23')](function(_0x18ed22){_0x2fd3cf[_0xd2d6('0x43')]=_0x18ed22;return _0x2fd3cf;})['then'](respondWithFilteredResult(_0x26c198,_0x4adb9d))['catch'](handleError(_0x26c198,null));};exports[_0xd2d6('0x44')]=function(_0x354474,_0x2ea506){var _0x4f37f0={'raw':![],'where':{'id':_0x354474['params']['id']}},_0x548015={};_0x548015[_0xd2d6('0x2f')]=_[_0xd2d6('0x30')](db['JscriptyProject']['rawAttributes']);_0x548015[_0xd2d6('0x31')]=_['keys'](_0x354474[_0xd2d6('0x31')]);_0x548015[_0xd2d6('0x3a')]=_[_0xd2d6('0x32')](_0x548015[_0xd2d6('0x2f')],_0x548015[_0xd2d6('0x31')]);_0x4f37f0[_0xd2d6('0x33')]=_['intersection'](_0x548015[_0xd2d6('0x2f')],qs[_0xd2d6('0x34')](_0x354474['query'][_0xd2d6('0x34')]));_0x4f37f0[_0xd2d6('0x33')]=_0x4f37f0[_0xd2d6('0x33')][_0xd2d6('0x35')]?_0x4f37f0[_0xd2d6('0x33')]:_0x548015[_0xd2d6('0x2f')];if(_0x354474[_0xd2d6('0x31')][_0xd2d6('0x41')]){_0x4f37f0[_0xd2d6('0x42')]=[{'all':!![]}];}_0x4f37f0=_['merge']({},_0x4f37f0,_0x354474[_0xd2d6('0x45')]);return db['JscriptyProject']['find'](_0x4f37f0)[_0xd2d6('0x23')](handleEntityNotFound(_0x2ea506,null))[_0xd2d6('0x23')](respondWithResult(_0x2ea506,null))[_0xd2d6('0x46')](handleError(_0x2ea506,null));};exports[_0xd2d6('0x47')]=function(_0x3c3db5,_0x1e30b2){return db[_0xd2d6('0x40')][_0xd2d6('0x47')](_0x3c3db5[_0xd2d6('0x48')],{})[_0xd2d6('0x23')](function(_0x1a41a9){var _0x2be7fc=_0x3c3db5[_0xd2d6('0x49')][_0xd2d6('0x25')]({'plain':!![]});if(!_0x2be7fc)throw new Error(_0xd2d6('0x4a'));if(_0x2be7fc[_0xd2d6('0x4b')]==='user'){var _0x1ae825=_0x1a41a9[_0xd2d6('0x25')]({'plain':!![]});var _0x28ca97=_0xd2d6('0x26');return db['UserProfileSection'][_0xd2d6('0x4c')]({'where':{'name':_0x28ca97,'userProfileId':_0x2be7fc[_0xd2d6('0x4d')]},'raw':!![]})[_0xd2d6('0x23')](function(_0x277fe9){if(_0x277fe9&&_0x277fe9['autoAssociation']===0x0){return db[_0xd2d6('0x27')][_0xd2d6('0x47')]({'name':_0x1ae825[_0xd2d6('0x2a')],'resourceId':_0x1ae825['id'],'type':_0x277fe9[_0xd2d6('0x2a')],'sectionId':_0x277fe9['id']},{})['then'](function(){return _0x1a41a9;});}else{return _0x1a41a9;}})[_0xd2d6('0x46')](function(_0x1de120){logger[_0xd2d6('0x28')](_0xd2d6('0x4e'),_0x1de120);throw _0x1de120;});}return _0x1a41a9;})['then'](respondWithResult(_0x1e30b2,0xc9))[_0xd2d6('0x46')](handleError(_0x1e30b2,null));};exports[_0xd2d6('0x4f')]=function(_0xf27361,_0x4ddb3a){var _0x4fbb28={'where':{'id':_0xf27361[_0xd2d6('0x50')]['id']}},_0x291731={};_0x291731['model']=_[_0xd2d6('0x30')](db[_0xd2d6('0x40')][_0xd2d6('0x2c')]);_0x4fbb28[_0xd2d6('0x33')]=_['intersection'](_0x291731[_0xd2d6('0x2f')],qs[_0xd2d6('0x34')](_0xf27361['query'][_0xd2d6('0x34')]));_0x4fbb28[_0xd2d6('0x33')]=_0x4fbb28[_0xd2d6('0x33')]['length']?_0x4fbb28[_0xd2d6('0x33')]:_0x291731[_0xd2d6('0x2f')];if(_0xf27361[_0xd2d6('0x31')]['includeAll']){_0x4fbb28['include']=[{'all':!![]}];}_0x4fbb28=_[_0xd2d6('0x3e')]({},_0x4fbb28,_0xf27361['options']);return db[_0xd2d6('0x40')][_0xd2d6('0x4c')](_0x4fbb28)[_0xd2d6('0x23')](handleEntityNotFound(_0x4ddb3a,null))[_0xd2d6('0x23')](function(_0x4652a9){if(_0x4652a9){var _0x2861e7=_0x4652a9[_0xd2d6('0x25')]({'plain':!![]});_0x2861e7=qs['omit'](_0x2861e7,['id',_0xd2d6('0x51'),'updatedAt']);_0xf27361[_0xd2d6('0x48')]=_['omit'](_0xf27361['body'],['id',_0xd2d6('0x51'),_0xd2d6('0x52')]);return db[_0xd2d6('0x40')][_0xd2d6('0x47')](_['merge'](_0x2861e7,_0xf27361[_0xd2d6('0x48')]),{'include':_0xf27361[_0xd2d6('0x31')][_0xd2d6('0x41')]?[{'all':!![]}]:undefined})[_0xd2d6('0x23')](function(_0xdda55c){var _0x37e5c0=_0xf27361['user'][_0xd2d6('0x25')]({'plain':!![]});if(!_0x37e5c0)throw new Error(_0xd2d6('0x4a'));if(_0x37e5c0[_0xd2d6('0x4b')]===_0xd2d6('0x49')){var _0x55f370=_0xdda55c['get']({'plain':!![]});var _0x43548e=_0xd2d6('0x26');return db[_0xd2d6('0x53')][_0xd2d6('0x4c')]({'where':{'name':_0x43548e,'userProfileId':_0x37e5c0[_0xd2d6('0x4d')]},'raw':!![]})[_0xd2d6('0x23')](function(_0x28ef08){if(_0x28ef08&&_0x28ef08['autoAssociation']===0x0){return db[_0xd2d6('0x27')]['create']({'name':_0x55f370['name'],'resourceId':_0x55f370['id'],'type':_0x28ef08[_0xd2d6('0x2a')],'sectionId':_0x28ef08['id']},{})[_0xd2d6('0x23')](function(){return _0xdda55c;});}else{return _0xdda55c;}})[_0xd2d6('0x46')](function(_0x31dc25){logger[_0xd2d6('0x28')](_0xd2d6('0x4e'),_0x31dc25);throw _0x31dc25;});}return _0xdda55c;});}})[_0xd2d6('0x23')](respondWithResult(_0x4ddb3a,0xc9))['catch'](handleError(_0x4ddb3a,null));};exports[_0xd2d6('0x22')]=function(_0x451d44,_0x26f9b3){if(_0x451d44[_0xd2d6('0x48')]['id']){delete _0x451d44['body']['id'];}return db[_0xd2d6('0x40')]['find']({'where':{'id':_0x451d44['params']['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x26f9b3,null))[_0xd2d6('0x23')](saveUpdates(_0x451d44[_0xd2d6('0x48')],null))[_0xd2d6('0x23')](respondWithResult(_0x26f9b3,null))[_0xd2d6('0x46')](handleError(_0x26f9b3,null));};exports[_0xd2d6('0x24')]=function(_0x5a745e,_0x2d1334){return db[_0xd2d6('0x40')][_0xd2d6('0x4c')]({'where':{'id':_0x5a745e[_0xd2d6('0x50')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x2d1334,null))[_0xd2d6('0x23')](removeEntity(_0x2d1334,null))[_0xd2d6('0x46')](handleError(_0x2d1334,null));};exports['getSessions']=function(_0x26688e,_0x8b8a8a,_0x5e74a7){var _0x4a8eb2={'raw':!![],'where':{}};var _0x405477={};var _0x463edb={'count':0x0,'rows':[]};return db[_0xd2d6('0x40')]['findOne']({'where':{'id':_0x26688e['params']['id']}})['then'](handleEntityNotFound(_0x8b8a8a,null))['then'](function(_0x3594a3){if(_0x3594a3){_0x405477[_0xd2d6('0x2f')]=_[_0xd2d6('0x30')](db[_0xd2d6('0x54')]['rawAttributes']);_0x405477['query']=_[_0xd2d6('0x30')](_0x26688e[_0xd2d6('0x31')]);_0x405477[_0xd2d6('0x3a')]=_[_0xd2d6('0x32')](_0x405477['model'],_0x405477['query']);_0x4a8eb2[_0xd2d6('0x33')]=_['intersection'](_0x405477[_0xd2d6('0x2f')],qs['fields'](_0x26688e['query'][_0xd2d6('0x34')]));_0x4a8eb2[_0xd2d6('0x33')]=_0x4a8eb2[_0xd2d6('0x33')][_0xd2d6('0x35')]?_0x4a8eb2[_0xd2d6('0x33')]:_0x405477[_0xd2d6('0x2f')];if(!_0x26688e['query'][_0xd2d6('0x36')](_0xd2d6('0x37'))){_0x4a8eb2[_0xd2d6('0x38')]=qs[_0xd2d6('0x38')](_0x26688e['query'][_0xd2d6('0x38')]);_0x4a8eb2['offset']=qs[_0xd2d6('0x1a')](_0x26688e[_0xd2d6('0x31')][_0xd2d6('0x1a')]);}_0x4a8eb2[_0xd2d6('0x55')]=qs[_0xd2d6('0x39')](_0x26688e[_0xd2d6('0x31')][_0xd2d6('0x39')]);_0x4a8eb2['where']=qs['filters'](_[_0xd2d6('0x3b')](_0x26688e[_0xd2d6('0x31')],_0x405477[_0xd2d6('0x3a')]));_0x4a8eb2['where'][_0xd2d6('0x56')]=_0x3594a3['id'];if(_0x26688e[_0xd2d6('0x31')][_0xd2d6('0x3c')]){_0x4a8eb2[_0xd2d6('0x3d')]=_[_0xd2d6('0x3e')](_0x4a8eb2[_0xd2d6('0x3d')],{'$or':_[_0xd2d6('0x3f')](_0x4a8eb2['attributes'],function(_0x639743){var _0x58465d={};_0x58465d[_0x639743]={'$like':'%'+_0x26688e[_0xd2d6('0x31')][_0xd2d6('0x3c')]+'%'};return _0x58465d;})});}_0x4a8eb2=_['merge']({},_0x4a8eb2,_0x26688e[_0xd2d6('0x45')]);return db[_0xd2d6('0x54')][_0xd2d6('0x1c')]({'where':_0x4a8eb2[_0xd2d6('0x3d')]})[_0xd2d6('0x23')](function(_0x16c54d){_0x463edb['count']=_0x16c54d;if(_0x26688e[_0xd2d6('0x31')][_0xd2d6('0x41')]){_0x4a8eb2[_0xd2d6('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd2d6('0x57')](_0x4a8eb2);})[_0xd2d6('0x23')](function(_0x1c229f){_0x463edb[_0xd2d6('0x43')]=_0x1c229f;return _0x463edb;});}})[_0xd2d6('0x23')](respondWithFilteredResult(_0x8b8a8a,_0x4a8eb2))['catch'](handleError(_0x8b8a8a,null));};exports[_0xd2d6('0x58')]=function(_0x1ccc10,_0x7975c8,_0x50a4ab){var _0x1a42b7={'raw':!![],'where':{}};var _0x469947={};var _0x55ea79={'count':0x0,'rows':[]};return db[_0xd2d6('0x40')][_0xd2d6('0x59')]({'where':{'id':_0x1ccc10[_0xd2d6('0x50')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x7975c8,null))[_0xd2d6('0x23')](function(_0x4ecd77){if(_0x4ecd77){_0x469947[_0xd2d6('0x2f')]=_[_0xd2d6('0x30')](db[_0xd2d6('0x5a')]['rawAttributes']);_0x469947[_0xd2d6('0x31')]=_['keys'](_0x1ccc10[_0xd2d6('0x31')]);_0x469947['filters']=_['intersection'](_0x469947[_0xd2d6('0x2f')],_0x469947[_0xd2d6('0x31')]);_0x1a42b7[_0xd2d6('0x33')]=_[_0xd2d6('0x32')](_0x469947[_0xd2d6('0x2f')],qs[_0xd2d6('0x34')](_0x1ccc10['query']['fields']));_0x1a42b7[_0xd2d6('0x33')]=_0x1a42b7[_0xd2d6('0x33')][_0xd2d6('0x35')]?_0x1a42b7['attributes']:_0x469947[_0xd2d6('0x2f')];if(!_0x1ccc10['query'][_0xd2d6('0x36')](_0xd2d6('0x37'))){_0x1a42b7['limit']=qs[_0xd2d6('0x38')](_0x1ccc10['query'][_0xd2d6('0x38')]);_0x1a42b7[_0xd2d6('0x1a')]=qs[_0xd2d6('0x1a')](_0x1ccc10['query'][_0xd2d6('0x1a')]);}_0x1a42b7['order']=qs[_0xd2d6('0x39')](_0x1ccc10[_0xd2d6('0x31')][_0xd2d6('0x39')]);_0x1a42b7[_0xd2d6('0x3d')]=qs[_0xd2d6('0x3a')](_[_0xd2d6('0x3b')](_0x1ccc10[_0xd2d6('0x31')],_0x469947[_0xd2d6('0x3a')]));_0x1a42b7['where']['ProjectId']=_0x4ecd77['id'];if(_0x1ccc10[_0xd2d6('0x31')][_0xd2d6('0x3c')]){_0x1a42b7[_0xd2d6('0x3d')]=_['merge'](_0x1a42b7[_0xd2d6('0x3d')],{'$or':_[_0xd2d6('0x3f')](_0x1a42b7[_0xd2d6('0x33')],function(_0x46bee6){var _0x4e79eb={};_0x4e79eb[_0x46bee6]={'$like':'%'+_0x1ccc10[_0xd2d6('0x31')][_0xd2d6('0x3c')]+'%'};return _0x4e79eb;})});}_0x1a42b7=_[_0xd2d6('0x3e')]({},_0x1a42b7,_0x1ccc10['options']);return db['JscriptyAnswerReport'][_0xd2d6('0x1c')]({'where':_0x1a42b7[_0xd2d6('0x3d')]})['then'](function(_0x586034){_0x55ea79['count']=_0x586034;if(_0x1ccc10[_0xd2d6('0x31')][_0xd2d6('0x41')]){_0x1a42b7[_0xd2d6('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd2d6('0x57')](_0x1a42b7);})[_0xd2d6('0x23')](function(_0x422dc5){_0x55ea79['rows']=_0x422dc5;return _0x55ea79;});}})['then'](respondWithFilteredResult(_0x7975c8,_0x1a42b7))[_0xd2d6('0x46')](handleError(_0x7975c8,null));};function char(_0x2c3e7b){return _0xd2d6('0x5b')===typeof _0x2c3e7b?String[_0xd2d6('0x5c')][_0xd2d6('0x20')](null,arguments):_0x2c3e7b;}function needsEncapsulation(_0x4f362e){return!!_0x4f362e&&(_0x4f362e[_0xd2d6('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x4f362e[_0xd2d6('0x5d')]()[_0xd2d6('0x5e')](char(0xa))>=0x0||_0x4f362e[_0xd2d6('0x5d')]()[_0xd2d6('0x5e')](char(0x2c))>=0x0||_0x4f362e[_0xd2d6('0x5d')]()[_0xd2d6('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x32ed95){var _0x343623=char(0x22),_0x9a4aca='\x5c'+char(0x22),_0x2ef7fe=_0x32ed95[_0xd2d6('0x5d')]()[_0xd2d6('0x5f')](new RegExp(_0x343623,'g'),_0x9a4aca);return _0x343623+_0x2ef7fe+_0x343623;}exports['getSummary']=function(_0x137e27,_0x49ca03,_0x44fed0){var _0x3192cc,_0x11831c;var _0x14ece9={'where':{'ProjectId':_0x137e27['params']['id']}};if(_0x137e27[_0xd2d6('0x31')][_0xd2d6('0x60')]){_0x14ece9[_0xd2d6('0x3d')][_0xd2d6('0x61')]=JSON[_0xd2d6('0x62')](_0x137e27[_0xd2d6('0x31')]['startTime']);}return db[_0xd2d6('0x54')][_0xd2d6('0x57')](_0x14ece9)['then'](handleEntityNotFound(_0x49ca03,null))[_0xd2d6('0x23')](function(_0x6ec79f){if(_0x6ec79f){_0x3192cc=_0x6ec79f;return db[_0xd2d6('0x63')][_0xd2d6('0x57')]({'where':{'SessionId':{'$in':_[_0xd2d6('0x3f')](_0x3192cc,'id')},'ProjectId':_0x137e27[_0xd2d6('0x50')]['id']},'order':'-createdAt'});}})[_0xd2d6('0x23')](handleEntityNotFound(_0x49ca03,null))[_0xd2d6('0x23')](function(_0x3059ac){if(_0x3059ac){_0x11831c=_0x3059ac;var _0x4d0e8c={};for(var _0x65556d=0x0,_0x152803=_0x11831c[_0xd2d6('0x35')];_0x65556d<_0x152803;_0x65556d++){if(!_0x4d0e8c[_0xd2d6('0x36')](_0x11831c[_0x65556d][_0xd2d6('0x64')])){_0x4d0e8c[_0x11831c[_0x65556d][_0xd2d6('0x64')]]=needsEncapsulation(_0x11831c[_0x65556d][_0xd2d6('0x65')])?encapsulate(_0x11831c[_0x65556d]['question']):_0x11831c[_0x65556d][_0xd2d6('0x65')];}}var _0xb08af8=[],_0x3b1ad5={};for(var _0x3f53c6=0x0,_0x50b1c3=_0x3192cc[_0xd2d6('0x35')];_0x3f53c6<_0x50b1c3;_0x3f53c6++){_0x3b1ad5={'ProjectId':_0x137e27[_0xd2d6('0x50')]['id'],'SessionId':_0x3192cc[_0x3f53c6]['id'],'StartTime':moment(_0x3192cc[_0x3f53c6][_0xd2d6('0x61')])[_0xd2d6('0x66')](_0xd2d6('0x67'))};for(var _0x4bb643=0x0,_0xf03e72=_0x11831c[_0xd2d6('0x35')];_0x4bb643<_0xf03e72;_0x4bb643++){if(_0x11831c[_0x4bb643][_0xd2d6('0x68')]==_0x3192cc[_0x3f53c6]['id']&&_0x4d0e8c['hasOwnProperty'](_0x11831c[_0x4bb643][_0xd2d6('0x64')])){_0x3b1ad5[_0x4d0e8c[_0x11831c[_0x4bb643]['questionId']]]=_0x11831c[_0x4bb643][_0xd2d6('0x69')];}}for(var _0x56d098 in _0x4d0e8c){if(!_0x3b1ad5[_0xd2d6('0x36')](_0x4d0e8c[_0x56d098])){_0x3b1ad5[_0x4d0e8c[_0x56d098]]=null;}}_0xb08af8[_0xd2d6('0x6a')](_0x3b1ad5);}return _0xb08af8;}})[_0xd2d6('0x23')](function(_0xf599e8){if(!_[_0xd2d6('0x6b')](_0xf599e8)){var _0x4eb454=toCsv(_0xf599e8);var _0x2e119c=Date[_0xd2d6('0x6c')]();fs['writeFileSync'](util[_0xd2d6('0x66')](_0xd2d6('0x6d'),_0x137e27[_0xd2d6('0x50')]['id'],_0x2e119c),_0x4eb454);_0x49ca03[_0xd2d6('0x6e')](_0xd2d6('0x6f'),_0xd2d6('0x70')+util[_0xd2d6('0x66')](_0xd2d6('0x71'),_0x137e27[_0xd2d6('0x50')]['id'],_0x2e119c));_0x49ca03['setHeader']('Content-type',_0xd2d6('0x72'));return _0x49ca03[_0xd2d6('0x73')](util[_0xd2d6('0x66')](_0xd2d6('0x6d'),_0x137e27[_0xd2d6('0x50')]['id'],_0x2e119c));}else{return _0x49ca03[_0xd2d6('0x18')](0xcc);}})[_0xd2d6('0x46')](handleError(_0x49ca03,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a85f0b2..afd4a46 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 _0x3379=['exports','JscriptyProject','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0xda7291,_0x13c698){var _0x3da1ea=function(_0x128124){while(--_0x128124){_0xda7291['push'](_0xda7291['shift']());}};_0x3da1ea(++_0x13c698);}(_0x3379,0x115));var _0x9337=function(_0x359332,_0x3eb2d1){_0x359332=_0x359332-0x0;var _0x1ea635=_0x3379[_0x359332];return _0x1ea635;};'use strict';var _=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var logger=require(_0x9337('0x2'))(_0x9337('0x3'));var moment=require('moment');var BPromise=require(_0x9337('0x4'));var rp=require(_0x9337('0x5'));var fs=require('fs');var path=require(_0x9337('0x6'));var rimraf=require(_0x9337('0x7'));var config=require('../../config/environment');var attributes=require(_0x9337('0x8'));module[_0x9337('0x9')]=function(_0x390772,_0x677c38){return _0x390772['define'](_0x9337('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8784=['api','moment','bluebird','request-promise','path','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util'];(function(_0xf57205,_0xc7270e){var _0x5c7487=function(_0x1574ff){while(--_0x1574ff){_0xf57205['push'](_0xf57205['shift']());}};_0x5c7487(++_0xc7270e);}(_0x8784,0x172));var _0x4878=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x8784[_0xcaf223];return _0x17e00d;};'use strict';var _=require(_0x4878('0x0'));var util=require(_0x4878('0x1'));var logger=require('../../config/logger')(_0x4878('0x2'));var moment=require(_0x4878('0x3'));var BPromise=require(_0x4878('0x4'));var rp=require(_0x4878('0x5'));var fs=require('fs');var path=require(_0x4878('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4878('0x7'));module[_0x4878('0x8')]=function(_0x158bc8,_0xdf70f){return _0x158bc8[_0x4878('0x9')](_0x4878('0xa'),attributes,{'tableName':_0x4878('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index a0b77d8..ba5d6b7 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d4b9b,_0x5601c9){var _0xd43524=function(_0x5271ae){while(--_0x5271ae){_0x2d4b9b['push'](_0x2d4b9b['shift']());}};_0xd43524(++_0x5601c9);}(_0x70e0,0x17b));var _0x070e=function(_0x5a93e0,_0x3ae561){_0x5a93e0=_0x5a93e0-0x0;var _0x5e625b=_0x70e0[_0x5a93e0];return _0x5e625b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +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(_0x1409a8,_0x1ab526){var _0x5c1682=function(_0xe30c04){while(--_0xe30c04){_0x1409a8['push'](_0x1409a8['shift']());}};_0x5c1682(++_0x1ab526);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 44cc6e5..2155577 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 _0x76de=['/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x76de,0x15b));var _0xe76d=function(_0x3ad59b,_0x13aca3){_0x3ad59b=_0x3ad59b-0x0;var _0x453202=_0x76de[_0x3ad59b];return _0x453202;};'use strict';var multer=require(_0xe76d('0x0'));var util=require(_0xe76d('0x1'));var path=require(_0xe76d('0x2'));var timeout=require(_0xe76d('0x3'));var express=require(_0xe76d('0x4'));var router=express['Router']();var fs_extra=require(_0xe76d('0x5'));var auth=require(_0xe76d('0x6'));var interaction=require(_0xe76d('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xe76d('0x8')]('/',auth[_0xe76d('0x9')](),controller[_0xe76d('0xa')]);router[_0xe76d('0x8')](_0xe76d('0xb'),auth[_0xe76d('0x9')](),controller[_0xe76d('0xc')]);router[_0xe76d('0x8')](_0xe76d('0xd'),auth[_0xe76d('0x9')](),controller[_0xe76d('0xe')]);router[_0xe76d('0xf')]('/',auth[_0xe76d('0x9')](),controller[_0xe76d('0x10')]);router['put'](_0xe76d('0xd'),auth[_0xe76d('0x9')](),controller[_0xe76d('0x11')]);router['delete']('/:id',auth[_0xe76d('0x9')](),controller[_0xe76d('0x12')]);module[_0xe76d('0x13')]=router; \ No newline at end of file +var _0xfc26=['describe','show','post','create','put','/:id','update','delete','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x14fdf0,_0x5abd4e){var _0x15f45e=function(_0x19c9a8){while(--_0x19c9a8){_0x14fdf0['push'](_0x14fdf0['shift']());}};_0x15f45e(++_0x5abd4e);}(_0xfc26,0x118));var _0x6fc2=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0xfc26[_0x48999d];return _0x1ad0d1;};'use strict';var multer=require(_0x6fc2('0x0'));var util=require(_0x6fc2('0x1'));var path=require('path');var timeout=require(_0x6fc2('0x2'));var express=require(_0x6fc2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6fc2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6fc2('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0x6fc2('0x6')]('/',auth[_0x6fc2('0x7')](),controller['index']);router['get'](_0x6fc2('0x8'),auth[_0x6fc2('0x7')](),controller[_0x6fc2('0x9')]);router[_0x6fc2('0x6')]('/:id',auth[_0x6fc2('0x7')](),controller[_0x6fc2('0xa')]);router[_0x6fc2('0xb')]('/',auth[_0x6fc2('0x7')](),controller[_0x6fc2('0xc')]);router[_0x6fc2('0xd')](_0x6fc2('0xe'),auth[_0x6fc2('0x7')](),controller[_0x6fc2('0xf')]);router[_0x6fc2('0x10')](_0x6fc2('0xe'),auth[_0x6fc2('0x7')](),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 0b2e288..550ad47 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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x40d46b,_0x24aae3){_0x40d46b=_0x40d46b-0x0;var _0x1ba171=_0x7a54[_0x40d46b];return _0x1ba171;};'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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x27b214,_0x286556){_0x27b214=_0x27b214-0x0;var _0x2cb29d=_0x7a54[_0x27b214];return _0x2cb29d;};'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 239166c..c356393 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 _0x1829=['offset','undefined','limit','set','apply','reject','save','then','destroy','stack','name','index','JscriptyQuestionReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','show','params','find','create','body','catch','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json'];(function(_0x3b3d2b,_0xb7dfd5){var _0x324420=function(_0x2ed634){while(--_0x2ed634){_0x3b3d2b['push'](_0x3b3d2b['shift']());}};_0x324420(++_0xb7dfd5);}(_0x1829,0x1d8));var _0x9182=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x1829[_0x29d915];return _0x160f86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9182('0x0'));var zipdir=require(_0x9182('0x1'));var jsonpatch=require(_0x9182('0x2'));var rp=require(_0x9182('0x3'));var moment=require(_0x9182('0x4'));var BPromise=require(_0x9182('0x5'));var Mustache=require(_0x9182('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9182('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9182('0x8'));var _=require('lodash');var squel=require(_0x9182('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9182('0xa'));var toCsv=require(_0x9182('0xb'));var querystring=require(_0x9182('0xc'));var Papa=require(_0x9182('0xd'));var Redis=require('ioredis');var authService=require(_0x9182('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9182('0xf'));var hardwareService=require(_0x9182('0x10'));var logger=require(_0x9182('0x11'))(_0x9182('0x12'));var utils=require(_0x9182('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9182('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247620,_0xd62cfc){_0xd62cfc=_0xd62cfc||0xcc;return function(_0x46051f){if(_0x46051f){return _0x247620[_0x9182('0x15')](_0xd62cfc);}return _0x247620[_0x9182('0x16')](_0xd62cfc)[_0x9182('0x17')]();};}function respondWithResult(_0x4c3faa,_0x2a0c8d){_0x2a0c8d=_0x2a0c8d||0xc8;return function(_0x151b25){if(_0x151b25){return _0x4c3faa[_0x9182('0x16')](_0x2a0c8d)[_0x9182('0x18')](_0x151b25);}};}function respondWithFilteredResult(_0x4d651f,_0x10d3f0){return function(_0x5cf1b2){if(_0x5cf1b2){var _0x280298=typeof _0x10d3f0[_0x9182('0x19')]===_0x9182('0x1a')&&typeof _0x10d3f0['limit']===_0x9182('0x1a');var _0x2c2aac=_0x5cf1b2['count'];var _0x5c0afa=_0x280298?0x0:_0x10d3f0[_0x9182('0x19')];var _0x3e0662=_0x280298?_0x5cf1b2['count']:_0x10d3f0[_0x9182('0x19')]+_0x10d3f0[_0x9182('0x1b')];var _0x422d4f;if(_0x3e0662>=_0x2c2aac){_0x3e0662=_0x2c2aac;_0x422d4f=0xc8;}else{_0x422d4f=0xce;}_0x4d651f[_0x9182('0x16')](_0x422d4f);return _0x4d651f[_0x9182('0x1c')]('Content-Range',_0x5c0afa+'-'+_0x3e0662+'/'+_0x2c2aac)[_0x9182('0x18')](_0x5cf1b2);}return null;};}function patchUpdates(_0x568562){return function(_0x4337d7){try{jsonpatch[_0x9182('0x1d')](_0x4337d7,_0x568562,!![]);}catch(_0x41dadc){return BPromise[_0x9182('0x1e')](_0x41dadc);}return _0x4337d7[_0x9182('0x1f')]();};}function saveUpdates(_0x7672fc,_0x46e394){return function(_0x23d8b7){if(_0x23d8b7){return _0x23d8b7['update'](_0x7672fc)[_0x9182('0x20')](function(_0x8a12a5){return _0x8a12a5;});}return null;};}function removeEntity(_0x26656e,_0x1c5535){return function(_0x3caa70){if(_0x3caa70){return _0x3caa70[_0x9182('0x21')]()[_0x9182('0x20')](function(){_0x26656e[_0x9182('0x16')](0xcc)[_0x9182('0x17')]();});}};}function handleEntityNotFound(_0x1915cc,_0x26e10f){return function(_0x1bfb9e){if(!_0x1bfb9e){_0x1915cc[_0x9182('0x15')](0x194);}return _0x1bfb9e;};}function handleError(_0xc76909,_0x4abc56){_0x4abc56=_0x4abc56||0x1f4;return function(_0x1f81a9){logger['error'](_0x1f81a9[_0x9182('0x22')]);if(_0x1f81a9[_0x9182('0x23')]){delete _0x1f81a9[_0x9182('0x23')];}_0xc76909[_0x9182('0x16')](_0x4abc56)['send'](_0x1f81a9);};}exports[_0x9182('0x24')]=function(_0x578e66,_0x37a1ab){var _0x51dea7={},_0x3dd804={},_0x55479a={'count':0x0,'rows':[]};var _0x4b7d14=_['map'](db[_0x9182('0x25')][_0x9182('0x26')],function(_0x3960d5){return{'name':_0x3960d5[_0x9182('0x27')],'type':_0x3960d5['type'][_0x9182('0x28')]};});_0x3dd804['model']=_[_0x9182('0x29')](_0x4b7d14,_0x9182('0x23'));_0x3dd804[_0x9182('0x2a')]=_[_0x9182('0x2b')](_0x578e66['query']);_0x3dd804[_0x9182('0x2c')]=_[_0x9182('0x2d')](_0x3dd804['model'],_0x3dd804[_0x9182('0x2a')]);_0x51dea7[_0x9182('0x2e')]=_[_0x9182('0x2d')](_0x3dd804[_0x9182('0x2f')],qs[_0x9182('0x30')](_0x578e66['query'][_0x9182('0x30')]));_0x51dea7[_0x9182('0x2e')]=_0x51dea7['attributes'][_0x9182('0x31')]?_0x51dea7['attributes']:_0x3dd804[_0x9182('0x2f')];if(!_0x578e66[_0x9182('0x2a')][_0x9182('0x32')](_0x9182('0x33'))){_0x51dea7[_0x9182('0x1b')]=qs[_0x9182('0x1b')](_0x578e66[_0x9182('0x2a')][_0x9182('0x1b')]);_0x51dea7[_0x9182('0x19')]=qs[_0x9182('0x19')](_0x578e66[_0x9182('0x2a')][_0x9182('0x19')]);}_0x51dea7[_0x9182('0x34')]=qs[_0x9182('0x35')](_0x578e66[_0x9182('0x2a')]['sort']);_0x51dea7['where']=qs[_0x9182('0x2c')](_[_0x9182('0x36')](_0x578e66[_0x9182('0x2a')],_0x3dd804['filters']),_0x4b7d14);if(_0x578e66['query'][_0x9182('0x37')]){_0x51dea7[_0x9182('0x38')]=_[_0x9182('0x39')](_0x51dea7[_0x9182('0x38')],{'$or':_[_0x9182('0x29')](_0x4b7d14,function(_0x1dbed2){if(_0x1dbed2['type']!=='VIRTUAL'){var _0x41caf9={};_0x41caf9[_0x1dbed2['name']]={'$like':'%'+_0x578e66[_0x9182('0x2a')][_0x9182('0x37')]+'%'};return _0x41caf9;}})});}_0x51dea7=_[_0x9182('0x39')]({},_0x51dea7,_0x578e66[_0x9182('0x3a')]);var _0x5e90bc={'where':_0x51dea7[_0x9182('0x38')]};return db[_0x9182('0x25')][_0x9182('0x3b')](_0x5e90bc)[_0x9182('0x20')](function(_0x2db4ef){_0x55479a[_0x9182('0x3b')]=_0x2db4ef;if(_0x578e66[_0x9182('0x2a')][_0x9182('0x3c')]){_0x51dea7[_0x9182('0x3d')]=[{'all':!![]}];}return db[_0x9182('0x25')][_0x9182('0x3e')](_0x51dea7);})[_0x9182('0x20')](function(_0x1c1dd4){_0x55479a['rows']=_0x1c1dd4;return _0x55479a;})[_0x9182('0x20')](respondWithFilteredResult(_0x37a1ab,_0x51dea7))['catch'](handleError(_0x37a1ab,null));};exports[_0x9182('0x3f')]=function(_0x14a0b8,_0x5d7494){var _0x58c0de={'raw':!![],'where':{'id':_0x14a0b8[_0x9182('0x40')]['id']}},_0x5217a3={};_0x5217a3[_0x9182('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0x9182('0x26')]);_0x5217a3[_0x9182('0x2a')]=_[_0x9182('0x2b')](_0x14a0b8['query']);_0x5217a3['filters']=_['intersection'](_0x5217a3[_0x9182('0x2f')],_0x5217a3[_0x9182('0x2a')]);_0x58c0de[_0x9182('0x2e')]=_[_0x9182('0x2d')](_0x5217a3[_0x9182('0x2f')],qs[_0x9182('0x30')](_0x14a0b8['query'][_0x9182('0x30')]));_0x58c0de[_0x9182('0x2e')]=_0x58c0de['attributes']['length']?_0x58c0de['attributes']:_0x5217a3[_0x9182('0x2f')];if(_0x14a0b8[_0x9182('0x2a')]['includeAll']){_0x58c0de[_0x9182('0x3d')]=[{'all':!![]}];}_0x58c0de=_[_0x9182('0x39')]({},_0x58c0de,_0x14a0b8[_0x9182('0x3a')]);return db[_0x9182('0x25')][_0x9182('0x41')](_0x58c0de)[_0x9182('0x20')](handleEntityNotFound(_0x5d7494,null))[_0x9182('0x20')](respondWithResult(_0x5d7494,null))['catch'](handleError(_0x5d7494,null));};exports[_0x9182('0x42')]=function(_0x1ba9cc,_0x31838d){return db[_0x9182('0x25')][_0x9182('0x42')](_0x1ba9cc[_0x9182('0x43')],{})[_0x9182('0x20')](respondWithResult(_0x31838d,0xc9))[_0x9182('0x44')](handleError(_0x31838d,null));};exports[_0x9182('0x45')]=function(_0x2c6347,_0x26dc74){if(_0x2c6347[_0x9182('0x43')]['id']){delete _0x2c6347[_0x9182('0x43')]['id'];}return db[_0x9182('0x25')][_0x9182('0x41')]({'where':{'id':_0x2c6347[_0x9182('0x40')]['id']}})[_0x9182('0x20')](handleEntityNotFound(_0x26dc74,null))[_0x9182('0x20')](saveUpdates(_0x2c6347[_0x9182('0x43')],null))[_0x9182('0x20')](respondWithResult(_0x26dc74,null))[_0x9182('0x44')](handleError(_0x26dc74,null));};exports[_0x9182('0x21')]=function(_0x43b28c,_0x2a6dbd){return db[_0x9182('0x25')]['find']({'where':{'id':_0x43b28c['params']['id']}})[_0x9182('0x20')](handleEntityNotFound(_0x2a6dbd,null))[_0x9182('0x20')](removeEntity(_0x2a6dbd,null))[_0x9182('0x44')](handleError(_0x2a6dbd,null));};exports[_0x9182('0x46')]=function(_0x2cea52,_0x4ba686){return db[_0x9182('0x25')]['describe']()['then'](respondWithResult(_0x4ba686,null))[_0x9182('0x44')](handleError(_0x4ba686,null));}; \ No newline at end of file +var _0x74d3=['offset','limit','undefined','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','params','length','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74d3,0x125));var _0x374d=function(_0x2b6136,_0x98b2bf){_0x2b6136=_0x2b6136-0x0;var _0x386b66=_0x74d3[_0x2b6136];return _0x386b66;};'use strict';var emlformat=require(_0x374d('0x0'));var rimraf=require(_0x374d('0x1'));var zipdir=require(_0x374d('0x2'));var jsonpatch=require(_0x374d('0x3'));var rp=require(_0x374d('0x4'));var moment=require(_0x374d('0x5'));var BPromise=require(_0x374d('0x6'));var Mustache=require(_0x374d('0x7'));var util=require(_0x374d('0x8'));var path=require(_0x374d('0x9'));var sox=require(_0x374d('0xa'));var csv=require(_0x374d('0xb'));var ejs=require(_0x374d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x374d('0xd'));var squel=require(_0x374d('0xe'));var crypto=require(_0x374d('0xf'));var jsforce=require(_0x374d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x374d('0xb'));var querystring=require(_0x374d('0x11'));var Papa=require('papaparse');var Redis=require(_0x374d('0x12'));var authService=require(_0x374d('0x13'));var qs=require(_0x374d('0x14'));var as=require(_0x374d('0x15'));var hardwareService=require(_0x374d('0x16'));var logger=require(_0x374d('0x17'))('api');var utils=require(_0x374d('0x18'));var config=require(_0x374d('0x19'));var licenseUtil=require(_0x374d('0x1a'));var db=require(_0x374d('0x1b'))['db'];function respondWithStatusCode(_0xf3b86a,_0x39129a){_0x39129a=_0x39129a||0xcc;return function(_0x298c05){if(_0x298c05){return _0xf3b86a['sendStatus'](_0x39129a);}return _0xf3b86a[_0x374d('0x1c')](_0x39129a)[_0x374d('0x1d')]();};}function respondWithResult(_0x135507,_0x479075){_0x479075=_0x479075||0xc8;return function(_0x3f3317){if(_0x3f3317){return _0x135507[_0x374d('0x1c')](_0x479075)[_0x374d('0x1e')](_0x3f3317);}};}function respondWithFilteredResult(_0x1d53e8,_0x4cf9a1){return function(_0x3078ac){if(_0x3078ac){var _0x4af250=typeof _0x4cf9a1[_0x374d('0x1f')]==='undefined'&&typeof _0x4cf9a1[_0x374d('0x20')]===_0x374d('0x21');var _0x2d4d90=_0x3078ac['count'];var _0x294807=_0x4af250?0x0:_0x4cf9a1[_0x374d('0x1f')];var _0x2d33de=_0x4af250?_0x3078ac['count']:_0x4cf9a1[_0x374d('0x1f')]+_0x4cf9a1['limit'];var _0x582696;if(_0x2d33de>=_0x2d4d90){_0x2d33de=_0x2d4d90;_0x582696=0xc8;}else{_0x582696=0xce;}_0x1d53e8[_0x374d('0x1c')](_0x582696);return _0x1d53e8['set'](_0x374d('0x22'),_0x294807+'-'+_0x2d33de+'/'+_0x2d4d90)[_0x374d('0x1e')](_0x3078ac);}return null;};}function patchUpdates(_0x311c6f){return function(_0x241e26){try{jsonpatch[_0x374d('0x23')](_0x241e26,_0x311c6f,!![]);}catch(_0x3e1c59){return BPromise[_0x374d('0x24')](_0x3e1c59);}return _0x241e26[_0x374d('0x25')]();};}function saveUpdates(_0xb498ac,_0x553aae){return function(_0x5fab75){if(_0x5fab75){return _0x5fab75[_0x374d('0x26')](_0xb498ac)['then'](function(_0x564b8b){return _0x564b8b;});}return null;};}function removeEntity(_0x5b2350,_0xaad74c){return function(_0x459de2){if(_0x459de2){return _0x459de2['destroy']()[_0x374d('0x27')](function(){_0x5b2350[_0x374d('0x1c')](0xcc)[_0x374d('0x1d')]();});}};}function handleEntityNotFound(_0x213e56,_0x136a6f){return function(_0x131f87){if(!_0x131f87){_0x213e56[_0x374d('0x28')](0x194);}return _0x131f87;};}function handleError(_0x31932f,_0x12af30){_0x12af30=_0x12af30||0x1f4;return function(_0x489696){logger[_0x374d('0x29')](_0x489696[_0x374d('0x2a')]);if(_0x489696[_0x374d('0x2b')]){delete _0x489696[_0x374d('0x2b')];}_0x31932f[_0x374d('0x1c')](_0x12af30)[_0x374d('0x2c')](_0x489696);};}exports[_0x374d('0x2d')]=function(_0x50f270,_0x19abbb){var _0x388d99={},_0x3c9d53={},_0x11fbc4={'count':0x0,'rows':[]};var _0xff873f=_[_0x374d('0x2e')](db[_0x374d('0x2f')][_0x374d('0x30')],function(_0x486143){return{'name':_0x486143[_0x374d('0x31')],'type':_0x486143[_0x374d('0x32')][_0x374d('0x33')]};});_0x3c9d53[_0x374d('0x34')]=_[_0x374d('0x2e')](_0xff873f,'name');_0x3c9d53[_0x374d('0x35')]=_[_0x374d('0x36')](_0x50f270[_0x374d('0x35')]);_0x3c9d53[_0x374d('0x37')]=_[_0x374d('0x38')](_0x3c9d53[_0x374d('0x34')],_0x3c9d53[_0x374d('0x35')]);_0x388d99[_0x374d('0x39')]=_[_0x374d('0x38')](_0x3c9d53[_0x374d('0x34')],qs[_0x374d('0x3a')](_0x50f270[_0x374d('0x35')][_0x374d('0x3a')]));_0x388d99['attributes']=_0x388d99[_0x374d('0x39')]['length']?_0x388d99['attributes']:_0x3c9d53[_0x374d('0x34')];if(!_0x50f270['query']['hasOwnProperty'](_0x374d('0x3b'))){_0x388d99[_0x374d('0x20')]=qs[_0x374d('0x20')](_0x50f270[_0x374d('0x35')][_0x374d('0x20')]);_0x388d99[_0x374d('0x1f')]=qs['offset'](_0x50f270['query'][_0x374d('0x1f')]);}_0x388d99[_0x374d('0x3c')]=qs['sort'](_0x50f270[_0x374d('0x35')][_0x374d('0x3d')]);_0x388d99[_0x374d('0x3e')]=qs[_0x374d('0x37')](_[_0x374d('0x3f')](_0x50f270[_0x374d('0x35')],_0x3c9d53[_0x374d('0x37')]),_0xff873f);if(_0x50f270[_0x374d('0x35')][_0x374d('0x40')]){_0x388d99[_0x374d('0x3e')]=_[_0x374d('0x41')](_0x388d99[_0x374d('0x3e')],{'$or':_['map'](_0xff873f,function(_0x339a66){if(_0x339a66[_0x374d('0x32')]!==_0x374d('0x42')){var _0x15a6a2={};_0x15a6a2[_0x339a66['name']]={'$like':'%'+_0x50f270[_0x374d('0x35')][_0x374d('0x40')]+'%'};return _0x15a6a2;}})});}_0x388d99=_[_0x374d('0x41')]({},_0x388d99,_0x50f270[_0x374d('0x43')]);var _0x5acb88={'where':_0x388d99[_0x374d('0x3e')]};return db[_0x374d('0x2f')][_0x374d('0x44')](_0x5acb88)[_0x374d('0x27')](function(_0xe3b2b2){_0x11fbc4['count']=_0xe3b2b2;if(_0x50f270['query']['includeAll']){_0x388d99[_0x374d('0x45')]=[{'all':!![]}];}return db[_0x374d('0x2f')][_0x374d('0x46')](_0x388d99);})[_0x374d('0x27')](function(_0x284595){_0x11fbc4['rows']=_0x284595;return _0x11fbc4;})[_0x374d('0x27')](respondWithFilteredResult(_0x19abbb,_0x388d99))[_0x374d('0x47')](handleError(_0x19abbb,null));};exports[_0x374d('0x48')]=function(_0x2c005d,_0x4d6cfa){var _0x17140c={'raw':!![],'where':{'id':_0x2c005d[_0x374d('0x49')]['id']}},_0x1e8ed5={};_0x1e8ed5[_0x374d('0x34')]=_[_0x374d('0x36')](db[_0x374d('0x2f')][_0x374d('0x30')]);_0x1e8ed5['query']=_['keys'](_0x2c005d['query']);_0x1e8ed5[_0x374d('0x37')]=_[_0x374d('0x38')](_0x1e8ed5[_0x374d('0x34')],_0x1e8ed5[_0x374d('0x35')]);_0x17140c[_0x374d('0x39')]=_[_0x374d('0x38')](_0x1e8ed5[_0x374d('0x34')],qs['fields'](_0x2c005d[_0x374d('0x35')]['fields']));_0x17140c[_0x374d('0x39')]=_0x17140c['attributes'][_0x374d('0x4a')]?_0x17140c[_0x374d('0x39')]:_0x1e8ed5[_0x374d('0x34')];if(_0x2c005d['query'][_0x374d('0x4b')]){_0x17140c[_0x374d('0x45')]=[{'all':!![]}];}_0x17140c=_[_0x374d('0x41')]({},_0x17140c,_0x2c005d[_0x374d('0x43')]);return db[_0x374d('0x2f')][_0x374d('0x4c')](_0x17140c)[_0x374d('0x27')](handleEntityNotFound(_0x4d6cfa,null))[_0x374d('0x27')](respondWithResult(_0x4d6cfa,null))[_0x374d('0x47')](handleError(_0x4d6cfa,null));};exports[_0x374d('0x4d')]=function(_0x3fe1d0,_0x113f30){return db[_0x374d('0x2f')][_0x374d('0x4d')](_0x3fe1d0[_0x374d('0x4e')],{})[_0x374d('0x27')](respondWithResult(_0x113f30,0xc9))[_0x374d('0x47')](handleError(_0x113f30,null));};exports[_0x374d('0x26')]=function(_0x30e360,_0xda3d7b){if(_0x30e360[_0x374d('0x4e')]['id']){delete _0x30e360[_0x374d('0x4e')]['id'];}return db[_0x374d('0x2f')]['find']({'where':{'id':_0x30e360[_0x374d('0x49')]['id']}})[_0x374d('0x27')](handleEntityNotFound(_0xda3d7b,null))[_0x374d('0x27')](saveUpdates(_0x30e360[_0x374d('0x4e')],null))[_0x374d('0x27')](respondWithResult(_0xda3d7b,null))[_0x374d('0x47')](handleError(_0xda3d7b,null));};exports[_0x374d('0x4f')]=function(_0x27c71e,_0x13072a){return db[_0x374d('0x2f')][_0x374d('0x4c')]({'where':{'id':_0x27c71e[_0x374d('0x49')]['id']}})[_0x374d('0x27')](handleEntityNotFound(_0x13072a,null))[_0x374d('0x27')](removeEntity(_0x13072a,null))['catch'](handleError(_0x13072a,null));};exports[_0x374d('0x50')]=function(_0x3a5d7f,_0x4ead88){return db[_0x374d('0x2f')][_0x374d('0x50')]()[_0x374d('0x27')](respondWithResult(_0x4ead88,null))['catch'](handleError(_0x4ead88,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c25239b..4754269 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 _0xc6cc=['request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0xc6cc,0xf6));var _0xcc6c=function(_0x42e611,_0x11a7d1){_0x42e611=_0x42e611-0x0;var _0x418c06=_0xc6cc[_0x42e611];return _0x418c06;};'use strict';var _=require(_0xcc6c('0x0'));var util=require(_0xcc6c('0x1'));var logger=require(_0xcc6c('0x2'))(_0xcc6c('0x3'));var moment=require(_0xcc6c('0x4'));var BPromise=require(_0xcc6c('0x5'));var rp=require(_0xcc6c('0x6'));var fs=require('fs');var path=require(_0xcc6c('0x7'));var rimraf=require(_0xcc6c('0x8'));var config=require('../../config/environment');var attributes=require(_0xcc6c('0x9'));module[_0xcc6c('0xa')]=function(_0x5535ad,_0x1f901c){return _0x5535ad[_0xcc6c('0xb')](_0xcc6c('0xc'),attributes,{'tableName':_0xcc6c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9542=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9542,0x118));var _0x2954=function(_0x2b1293,_0x4c8cf9){_0x2b1293=_0x2b1293-0x0;var _0x1ba045=_0x9542[_0x2b1293];return _0x1ba045;};'use strict';var _=require(_0x2954('0x0'));var util=require(_0x2954('0x1'));var logger=require(_0x2954('0x2'))('api');var moment=require(_0x2954('0x3'));var BPromise=require(_0x2954('0x4'));var rp=require(_0x2954('0x5'));var fs=require('fs');var path=require(_0x2954('0x6'));var rimraf=require(_0x2954('0x7'));var config=require(_0x2954('0x8'));var attributes=require(_0x2954('0x9'));module[_0x2954('0xa')]=function(_0x20a31d,_0x1da3e5){return _0x20a31d['define'](_0x2954('0xb'),attributes,{'tableName':_0x2954('0xc'),'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 5123c33..cc55451 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 _0x9757=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3bfd20,_0x25291b){var _0x5e9537=function(_0x2e0370){while(--_0x2e0370){_0x3bfd20['push'](_0x3bfd20['shift']());}};_0x5e9537(++_0x25291b);}(_0x9757,0xf6));var _0x7975=function(_0x8eb6a5,_0x359fea){_0x8eb6a5=_0x8eb6a5-0x0;var _0x5da622=_0x9757[_0x8eb6a5];return _0x5da622;};'use strict';var _=require('lodash');var util=require(_0x7975('0x0'));var moment=require(_0x7975('0x1'));var BPromise=require(_0x7975('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7975('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7975('0x4'));var logger=require(_0x7975('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3985,_0x2a9923,_0x19010){return new BPromise(function(_0x59d515,_0x553db6){return client[_0x7975('0x6')](_0x1b3985,_0x19010)[_0x7975('0x7')](function(_0x58c634){logger[_0x7975('0x8')](_0x7975('0x9'),_0x2a9923,'request\x20sent');logger[_0x7975('0xa')](_0x7975('0xb'),_0x2a9923,_0x7975('0xc'),JSON[_0x7975('0xd')](_0x58c634));if(_0x58c634['error']){if(_0x58c634['error'][_0x7975('0xe')]===0x1f4){logger[_0x7975('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2a9923,_0x58c634[_0x7975('0xf')][_0x7975('0x10')]);return _0x553db6(_0x58c634[_0x7975('0xf')][_0x7975('0x10')]);}logger[_0x7975('0xf')](_0x7975('0x9'),_0x2a9923,_0x58c634[_0x7975('0xf')][_0x7975('0x10')]);return _0x59d515(_0x58c634[_0x7975('0xf')][_0x7975('0x10')]);}else{logger[_0x7975('0x8')](_0x7975('0x9'),_0x2a9923,_0x7975('0xc'));_0x59d515(_0x58c634[_0x7975('0x11')][_0x7975('0x10')]);}})['catch'](function(_0x5d073e){logger[_0x7975('0xf')](_0x7975('0x9'),_0x2a9923,_0x5d073e);_0x553db6(_0x5d073e);});});} \ No newline at end of file +var _0xc9d8=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xc9d8,0x18a));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c9d('0x0'));var util=require(_0x8c9d('0x1'));var moment=require(_0x8c9d('0x2'));var BPromise=require(_0x8c9d('0x3'));var rs=require(_0x8c9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c9d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c9d('0x6'))(_0x8c9d('0x7'));var config=require(_0x8c9d('0x8'));var jayson=require(_0x8c9d('0x9'));var client=jayson['client'][_0x8c9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a671e,_0x2ce0ec,_0x4dc897){return new BPromise(function(_0xe08a4,_0x1e46c5){return client['request'](_0x8a671e,_0x4dc897)[_0x8c9d('0xb')](function(_0x945de4){logger[_0x8c9d('0xc')](_0x8c9d('0xd'),_0x2ce0ec,_0x8c9d('0xe'));logger[_0x8c9d('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2ce0ec,_0x8c9d('0xe'),JSON['stringify'](_0x945de4));if(_0x945de4[_0x8c9d('0x10')]){if(_0x945de4[_0x8c9d('0x10')][_0x8c9d('0x11')]===0x1f4){logger['error'](_0x8c9d('0xd'),_0x2ce0ec,_0x945de4[_0x8c9d('0x10')][_0x8c9d('0x12')]);return _0x1e46c5(_0x945de4[_0x8c9d('0x10')][_0x8c9d('0x12')]);}logger['error'](_0x8c9d('0xd'),_0x2ce0ec,_0x945de4[_0x8c9d('0x10')][_0x8c9d('0x12')]);return _0xe08a4(_0x945de4[_0x8c9d('0x10')][_0x8c9d('0x12')]);}else{logger[_0x8c9d('0xc')](_0x8c9d('0xd'),_0x2ce0ec,_0x8c9d('0xe'));_0xe08a4(_0x945de4[_0x8c9d('0x13')][_0x8c9d('0x12')]);}})['catch'](function(_0x4f5a99){logger[_0x8c9d('0x10')](_0x8c9d('0xd'),_0x2ce0ec,_0x4f5a99);_0x1e46c5(_0x4f5a99);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8ac189a..ebc2863 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 _0xceac=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions','post','create','put','update','delete','exports','multer','util'];(function(_0x47d69b,_0x2d8264){var _0x2b4802=function(_0x57146c){while(--_0x57146c){_0x47d69b['push'](_0x47d69b['shift']());}};_0x2b4802(++_0x2d8264);}(_0xceac,0xbb));var _0xccea=function(_0x2e58c6,_0x161a52){_0x2e58c6=_0x2e58c6-0x0;var _0x161ce4=_0xceac[_0x2e58c6];return _0x161ce4;};'use strict';var multer=require(_0xccea('0x0'));var util=require(_0xccea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xccea('0x2'));var router=express[_0xccea('0x3')]();var fs_extra=require(_0xccea('0x4'));var auth=require(_0xccea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xccea('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0xccea('0x7')]('/',auth[_0xccea('0x8')](),controller[_0xccea('0x9')]);router['get'](_0xccea('0xa'),auth[_0xccea('0x8')](),controller[_0xccea('0xb')]);router[_0xccea('0x7')](_0xccea('0xc'),auth[_0xccea('0x8')](),controller[_0xccea('0xd')]);router['get']('/:id/questions',auth[_0xccea('0x8')](),controller[_0xccea('0xe')]);router[_0xccea('0xf')]('/',auth[_0xccea('0x8')](),controller[_0xccea('0x10')]);router[_0xccea('0x11')]('/:id',auth[_0xccea('0x8')](),controller[_0xccea('0x12')]);router[_0xccea('0x13')](_0xccea('0xc'),auth[_0xccea('0x8')](),controller['destroy']);module[_0xccea('0x14')]=router; \ No newline at end of file +var _0x98af=['getQuestions','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','index','get','isAuthenticated','describe','/:id','show','/:id/questions'];(function(_0x44a9e5,_0xc4692d){var _0x2dab5e=function(_0x55b89c){while(--_0x55b89c){_0x44a9e5['push'](_0x44a9e5['shift']());}};_0x2dab5e(++_0xc4692d);}(_0x98af,0x14a));var _0xf98a=function(_0x3a6aa4,_0x593d66){_0x3a6aa4=_0x3a6aa4-0x0;var _0x514e75=_0x98af[_0x3a6aa4];return _0x514e75;};'use strict';var multer=require('multer');var util=require(_0xf98a('0x0'));var path=require('path');var timeout=require(_0xf98a('0x1'));var express=require('express');var router=express[_0xf98a('0x2')]();var fs_extra=require(_0xf98a('0x3'));var auth=require(_0xf98a('0x4'));var interaction=require(_0xf98a('0x5'));var config=require(_0xf98a('0x6'));var controller=require(_0xf98a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf98a('0x8')]);router[_0xf98a('0x9')]('/describe',auth[_0xf98a('0xa')](),controller[_0xf98a('0xb')]);router['get'](_0xf98a('0xc'),auth['isAuthenticated'](),controller[_0xf98a('0xd')]);router[_0xf98a('0x9')](_0xf98a('0xe'),auth[_0xf98a('0xa')](),controller[_0xf98a('0xf')]);router[_0xf98a('0x10')]('/',auth['isAuthenticated'](),controller[_0xf98a('0x11')]);router[_0xf98a('0x12')](_0xf98a('0xc'),auth['isAuthenticated'](),controller[_0xf98a('0x13')]);router[_0xf98a('0x14')](_0xf98a('0xc'),auth[_0xf98a('0xa')](),controller[_0xf98a('0x15')]);module[_0xf98a('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b77164c..ba8a602 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 _0x39bb=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE'];(function(_0x593da2,_0x3e52ad){var _0x1488db=function(_0x1002f9){while(--_0x1002f9){_0x593da2['push'](_0x593da2['shift']());}};_0x1488db(++_0x3e52ad);}(_0x39bb,0x1e3));var _0xb39b=function(_0x4247e5,_0x30b7bb){_0x4247e5=_0x4247e5-0x0;var _0x5ee3d5=_0x39bb[_0x4247e5];return _0x5ee3d5;};'use strict';var moment=require(_0xb39b('0x0'));var Sequelize=require('sequelize');module[_0xb39b('0x1')]={'starttime':{'type':Sequelize[_0xb39b('0x2')],'set':function(_0x5f19cf){this[_0xb39b('0x3')]('starttime',_0x5f19cf);this[_0xb39b('0x3')](_0xb39b('0x4'),moment()[_0xb39b('0x5')](_0xb39b('0x6')));}},'endtime':{'type':Sequelize[_0xb39b('0x2')]},'membername':{'type':Sequelize[_0xb39b('0x7')]},'projectname':{'type':Sequelize[_0xb39b('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb39b('0x7')]},'calleridname':{'type':Sequelize[_0xb39b('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xb39b('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x86da=['sequelize','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment'];(function(_0x186f0b,_0x4e37e6){var _0x29f14b=function(_0x25076c){while(--_0x25076c){_0x186f0b['push'](_0x186f0b['shift']());}};_0x29f14b(++_0x4e37e6);}(_0x86da,0xfb));var _0xa86d=function(_0x137d80,_0x4ca815){_0x137d80=_0x137d80-0x0;var _0x406c15=_0x86da[_0x137d80];return _0x406c15;};'use strict';var moment=require(_0xa86d('0x0'));var Sequelize=require(_0xa86d('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x43b687){this[_0xa86d('0x2')]('starttime',_0x43b687);this[_0xa86d('0x2')](_0xa86d('0x3'),moment()[_0xa86d('0x4')](_0xa86d('0x5')));}},'endtime':{'type':Sequelize[_0xa86d('0x6')]},'membername':{'type':Sequelize[_0xa86d('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa86d('0x7')]},'uniqueid':{'type':Sequelize[_0xa86d('0x7')]},'calleridname':{'type':Sequelize[_0xa86d('0x7')]},'calleridnum':{'type':Sequelize[_0xa86d('0x7')]},'completed':{'type':Sequelize[_0xa86d('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5787a51..ea92429 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 _0x85de=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','create','body','find','params','findOne','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x5a3e50,_0x5c9170){var _0x1a713c=function(_0x51b118){while(--_0x51b118){_0x5a3e50['push'](_0x5a3e50['shift']());}};_0x1a713c(++_0x5c9170);}(_0x85de,0xee));var _0xe85d=function(_0xcd88b0,_0x409ce7){_0xcd88b0=_0xcd88b0-0x0;var _0x22cce5=_0x85de[_0xcd88b0];return _0x22cce5;};'use strict';var emlformat=require(_0xe85d('0x0'));var rimraf=require(_0xe85d('0x1'));var zipdir=require(_0xe85d('0x2'));var jsonpatch=require(_0xe85d('0x3'));var rp=require(_0xe85d('0x4'));var moment=require('moment');var BPromise=require(_0xe85d('0x5'));var Mustache=require(_0xe85d('0x6'));var util=require(_0xe85d('0x7'));var path=require(_0xe85d('0x8'));var sox=require(_0xe85d('0x9'));var csv=require(_0xe85d('0xa'));var ejs=require(_0xe85d('0xb'));var fs=require('fs');var fs_extra=require(_0xe85d('0xc'));var _=require('lodash');var squel=require(_0xe85d('0xd'));var crypto=require(_0xe85d('0xe'));var jsforce=require(_0xe85d('0xf'));var deskjs=require(_0xe85d('0x10'));var toCsv=require(_0xe85d('0xa'));var querystring=require(_0xe85d('0x11'));var Papa=require(_0xe85d('0x12'));var Redis=require(_0xe85d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe85d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe85d('0x15'))(_0xe85d('0x16'));var utils=require(_0xe85d('0x17'));var config=require(_0xe85d('0x18'));var licenseUtil=require(_0xe85d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349f7a,_0xd10bf8){_0xd10bf8=_0xd10bf8||0xcc;return function(_0x53c2e9){if(_0x53c2e9){return _0x349f7a[_0xe85d('0x1a')](_0xd10bf8);}return _0x349f7a[_0xe85d('0x1b')](_0xd10bf8)[_0xe85d('0x1c')]();};}function respondWithResult(_0x3fca0e,_0x5432c0){_0x5432c0=_0x5432c0||0xc8;return function(_0x59c771){if(_0x59c771){return _0x3fca0e[_0xe85d('0x1b')](_0x5432c0)[_0xe85d('0x1d')](_0x59c771);}};}function respondWithFilteredResult(_0x4e1837,_0x3f87bc){return function(_0x21fda3){if(_0x21fda3){var _0x5a6947=typeof _0x3f87bc['offset']===_0xe85d('0x1e')&&typeof _0x3f87bc['limit']===_0xe85d('0x1e');var _0x80b5c4=_0x21fda3[_0xe85d('0x1f')];var _0x45f1cb=_0x5a6947?0x0:_0x3f87bc['offset'];var _0x4e7846=_0x5a6947?_0x21fda3[_0xe85d('0x1f')]:_0x3f87bc[_0xe85d('0x20')]+_0x3f87bc[_0xe85d('0x21')];var _0x27ac0c;if(_0x4e7846>=_0x80b5c4){_0x4e7846=_0x80b5c4;_0x27ac0c=0xc8;}else{_0x27ac0c=0xce;}_0x4e1837[_0xe85d('0x1b')](_0x27ac0c);return _0x4e1837[_0xe85d('0x22')](_0xe85d('0x23'),_0x45f1cb+'-'+_0x4e7846+'/'+_0x80b5c4)[_0xe85d('0x1d')](_0x21fda3);}return null;};}function patchUpdates(_0x7a6730){return function(_0x208410){try{jsonpatch[_0xe85d('0x24')](_0x208410,_0x7a6730,!![]);}catch(_0x31fee2){return BPromise[_0xe85d('0x25')](_0x31fee2);}return _0x208410['save']();};}function saveUpdates(_0x4cda2e,_0x242d7e){return function(_0x990c3){if(_0x990c3){return _0x990c3[_0xe85d('0x26')](_0x4cda2e)['then'](function(_0x6ad60c){return _0x6ad60c;});}return null;};}function removeEntity(_0x43d4f7,_0x560113){return function(_0x5b4ea1){if(_0x5b4ea1){return _0x5b4ea1[_0xe85d('0x27')]()[_0xe85d('0x28')](function(){_0x43d4f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d1b80,_0x2cba13){return function(_0x1405b5){if(!_0x1405b5){_0x3d1b80[_0xe85d('0x1a')](0x194);}return _0x1405b5;};}function handleError(_0x296ea9,_0x752fb6){_0x752fb6=_0x752fb6||0x1f4;return function(_0x48d312){logger[_0xe85d('0x29')](_0x48d312[_0xe85d('0x2a')]);if(_0x48d312[_0xe85d('0x2b')]){delete _0x48d312[_0xe85d('0x2b')];}_0x296ea9[_0xe85d('0x1b')](_0x752fb6)[_0xe85d('0x2c')](_0x48d312);};}exports[_0xe85d('0x2d')]=function(_0x54f7e0,_0xec9f9b){var _0x32da04={},_0x33cbae={},_0x28cca8={'count':0x0,'rows':[]};var _0x51edaa=_[_0xe85d('0x2e')](db['JscriptySessionReport'][_0xe85d('0x2f')],function(_0x21acd2){return{'name':_0x21acd2[_0xe85d('0x30')],'type':_0x21acd2[_0xe85d('0x31')][_0xe85d('0x32')]};});_0x33cbae[_0xe85d('0x33')]=_[_0xe85d('0x2e')](_0x51edaa,'name');_0x33cbae[_0xe85d('0x34')]=_[_0xe85d('0x35')](_0x54f7e0['query']);_0x33cbae['filters']=_[_0xe85d('0x36')](_0x33cbae[_0xe85d('0x33')],_0x33cbae[_0xe85d('0x34')]);_0x32da04[_0xe85d('0x37')]=_[_0xe85d('0x36')](_0x33cbae[_0xe85d('0x33')],qs[_0xe85d('0x38')](_0x54f7e0[_0xe85d('0x34')]['fields']));_0x32da04['attributes']=_0x32da04[_0xe85d('0x37')][_0xe85d('0x39')]?_0x32da04[_0xe85d('0x37')]:_0x33cbae[_0xe85d('0x33')];if(!_0x54f7e0[_0xe85d('0x34')]['hasOwnProperty'](_0xe85d('0x3a'))){_0x32da04[_0xe85d('0x21')]=qs[_0xe85d('0x21')](_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x21')]);_0x32da04[_0xe85d('0x20')]=qs[_0xe85d('0x20')](_0x54f7e0[_0xe85d('0x34')]['offset']);}_0x32da04[_0xe85d('0x3b')]=qs[_0xe85d('0x3c')](_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x3c')]);_0x32da04['where']=qs[_0xe85d('0x3d')](_[_0xe85d('0x3e')](_0x54f7e0[_0xe85d('0x34')],_0x33cbae[_0xe85d('0x3d')]),_0x51edaa);if(_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x3f')]){_0x32da04[_0xe85d('0x40')]=_[_0xe85d('0x41')](_0x32da04[_0xe85d('0x40')],{'$or':_[_0xe85d('0x2e')](_0x51edaa,function(_0x2ed2b5){if(_0x2ed2b5[_0xe85d('0x31')]!==_0xe85d('0x42')){var _0x172327={};_0x172327[_0x2ed2b5[_0xe85d('0x2b')]]={'$like':'%'+_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x3f')]+'%'};return _0x172327;}})});}_0x32da04=_[_0xe85d('0x41')]({},_0x32da04,_0x54f7e0[_0xe85d('0x43')]);var _0xb2e41e={'where':_0x32da04[_0xe85d('0x40')]};return db[_0xe85d('0x44')][_0xe85d('0x1f')](_0xb2e41e)['then'](function(_0x3bc878){_0x28cca8[_0xe85d('0x1f')]=_0x3bc878;if(_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x45')]){_0x32da04[_0xe85d('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xe85d('0x47')](_0x32da04);})[_0xe85d('0x28')](function(_0x5cf8a3){_0x28cca8[_0xe85d('0x48')]=_0x5cf8a3;return _0x28cca8;})[_0xe85d('0x28')](respondWithFilteredResult(_0xec9f9b,_0x32da04))[_0xe85d('0x49')](handleError(_0xec9f9b,null));};exports[_0xe85d('0x4a')]=function(_0x4f215a,_0x10f37a){var _0xd0f038={'raw':!![],'where':{'id':_0x4f215a['params']['id']}},_0x2f5eca={};_0x2f5eca[_0xe85d('0x33')]=_[_0xe85d('0x35')](db[_0xe85d('0x44')][_0xe85d('0x2f')]);_0x2f5eca['query']=_[_0xe85d('0x35')](_0x4f215a[_0xe85d('0x34')]);_0x2f5eca[_0xe85d('0x3d')]=_['intersection'](_0x2f5eca[_0xe85d('0x33')],_0x2f5eca['query']);_0xd0f038[_0xe85d('0x37')]=_[_0xe85d('0x36')](_0x2f5eca[_0xe85d('0x33')],qs[_0xe85d('0x38')](_0x4f215a[_0xe85d('0x34')][_0xe85d('0x38')]));_0xd0f038[_0xe85d('0x37')]=_0xd0f038[_0xe85d('0x37')]['length']?_0xd0f038[_0xe85d('0x37')]:_0x2f5eca[_0xe85d('0x33')];if(_0x4f215a[_0xe85d('0x34')]['includeAll']){_0xd0f038[_0xe85d('0x46')]=[{'all':!![]}];}_0xd0f038=_['merge']({},_0xd0f038,_0x4f215a[_0xe85d('0x43')]);return db[_0xe85d('0x44')]['find'](_0xd0f038)['then'](handleEntityNotFound(_0x10f37a,null))[_0xe85d('0x28')](respondWithResult(_0x10f37a,null))[_0xe85d('0x49')](handleError(_0x10f37a,null));};exports['create']=function(_0x4ea172,_0x38f857){return db[_0xe85d('0x44')][_0xe85d('0x4b')](_0x4ea172['body'],{})[_0xe85d('0x28')](respondWithResult(_0x38f857,0xc9))[_0xe85d('0x49')](handleError(_0x38f857,null));};exports[_0xe85d('0x26')]=function(_0x122a1e,_0xfd6b14){if(_0x122a1e['body']['id']){delete _0x122a1e[_0xe85d('0x4c')]['id'];}return db[_0xe85d('0x44')][_0xe85d('0x4d')]({'where':{'id':_0x122a1e[_0xe85d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xfd6b14,null))['then'](saveUpdates(_0x122a1e[_0xe85d('0x4c')],null))[_0xe85d('0x28')](respondWithResult(_0xfd6b14,null))[_0xe85d('0x49')](handleError(_0xfd6b14,null));};exports[_0xe85d('0x27')]=function(_0x426620,_0xf22da3){return db[_0xe85d('0x44')]['find']({'where':{'id':_0x426620[_0xe85d('0x4e')]['id']}})[_0xe85d('0x28')](handleEntityNotFound(_0xf22da3,null))['then'](removeEntity(_0xf22da3,null))[_0xe85d('0x49')](handleError(_0xf22da3,null));};exports['describe']=function(_0x1aa50f,_0x5f23e5){return db['JscriptySessionReport']['describe']()[_0xe85d('0x28')](respondWithResult(_0x5f23e5,null))[_0xe85d('0x49')](handleError(_0x5f23e5,null));};exports['getQuestions']=function(_0x12e684,_0x46d75b,_0x55e28c){var _0x1ad846={'raw':!![],'where':{}};var _0x2e56c4={};var _0x2d861a={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xe85d('0x4f')]({'where':{'id':_0x12e684[_0xe85d('0x4e')]['id']}})[_0xe85d('0x28')](handleEntityNotFound(_0x46d75b,null))['then'](function(_0x120afc){if(_0x120afc){_0x2e56c4['model']=_[_0xe85d('0x35')](db['JscriptyQuestionReport'][_0xe85d('0x2f')]);_0x2e56c4[_0xe85d('0x34')]=_['keys'](_0x12e684[_0xe85d('0x34')]);_0x2e56c4[_0xe85d('0x3d')]=_[_0xe85d('0x36')](_0x2e56c4[_0xe85d('0x33')],_0x2e56c4[_0xe85d('0x34')]);_0x1ad846['attributes']=_[_0xe85d('0x36')](_0x2e56c4[_0xe85d('0x33')],qs[_0xe85d('0x38')](_0x12e684[_0xe85d('0x34')][_0xe85d('0x38')]));_0x1ad846[_0xe85d('0x37')]=_0x1ad846['attributes'][_0xe85d('0x39')]?_0x1ad846[_0xe85d('0x37')]:_0x2e56c4[_0xe85d('0x33')];if(!_0x12e684[_0xe85d('0x34')]['hasOwnProperty'](_0xe85d('0x3a'))){_0x1ad846['limit']=qs[_0xe85d('0x21')](_0x12e684[_0xe85d('0x34')][_0xe85d('0x21')]);_0x1ad846[_0xe85d('0x20')]=qs[_0xe85d('0x20')](_0x12e684[_0xe85d('0x34')][_0xe85d('0x20')]);}_0x1ad846['order']=qs[_0xe85d('0x3c')](_0x12e684[_0xe85d('0x34')]['sort']);_0x1ad846['where']=qs[_0xe85d('0x3d')](_[_0xe85d('0x3e')](_0x12e684[_0xe85d('0x34')],_0x2e56c4[_0xe85d('0x3d')]));_0x1ad846[_0xe85d('0x40')][_0xe85d('0x50')]=_0x120afc['id'];if(_0x12e684[_0xe85d('0x34')][_0xe85d('0x3f')]){_0x1ad846['where']=_['merge'](_0x1ad846['where'],{'$or':_[_0xe85d('0x2e')](_0x1ad846['attributes'],function(_0x251e0d){var _0x109aba={};_0x109aba[_0x251e0d]={'$like':'%'+_0x12e684[_0xe85d('0x34')][_0xe85d('0x3f')]+'%'};return _0x109aba;})});}_0x1ad846=_[_0xe85d('0x41')]({},_0x1ad846,_0x12e684[_0xe85d('0x43')]);return db[_0xe85d('0x51')][_0xe85d('0x1f')]({'where':_0x1ad846[_0xe85d('0x40')]})[_0xe85d('0x28')](function(_0x46744a){_0x2d861a['count']=_0x46744a;if(_0x12e684['query'][_0xe85d('0x45')]){_0x1ad846[_0xe85d('0x46')]=[{'all':!![]}];}return db[_0xe85d('0x51')]['findAll'](_0x1ad846);})[_0xe85d('0x28')](function(_0x45276f){_0x2d861a[_0xe85d('0x48')]=_0x45276f;return _0x2d861a;});}})['then'](respondWithFilteredResult(_0x46d75b,_0x1ad846))['catch'](handleError(_0x46d75b,null));}; \ No newline at end of file +var _0x531b=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','findAll','rows','catch','params','keys','length','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x1151cf,_0xaa402a){var _0xc6504e=function(_0x20f481){while(--_0x20f481){_0x1151cf['push'](_0x1151cf['shift']());}};_0xc6504e(++_0xaa402a);}(_0x531b,0x13a));var _0xb531=function(_0x1fd6f4,_0x4b8481){_0x1fd6f4=_0x1fd6f4-0x0;var _0x32b7f1=_0x531b[_0x1fd6f4];return _0x32b7f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb531('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb531('0x1'));var moment=require(_0xb531('0x2'));var BPromise=require(_0xb531('0x3'));var Mustache=require(_0xb531('0x4'));var util=require(_0xb531('0x5'));var path=require(_0xb531('0x6'));var sox=require('sox');var csv=require(_0xb531('0x7'));var ejs=require(_0xb531('0x8'));var fs=require('fs');var fs_extra=require(_0xb531('0x9'));var _=require(_0xb531('0xa'));var squel=require(_0xb531('0xb'));var crypto=require(_0xb531('0xc'));var jsforce=require(_0xb531('0xd'));var deskjs=require(_0xb531('0xe'));var toCsv=require(_0xb531('0x7'));var querystring=require('querystring');var Papa=require(_0xb531('0xf'));var Redis=require(_0xb531('0x10'));var authService=require(_0xb531('0x11'));var qs=require(_0xb531('0x12'));var as=require(_0xb531('0x13'));var hardwareService=require(_0xb531('0x14'));var logger=require(_0xb531('0x15'))(_0xb531('0x16'));var utils=require(_0xb531('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb531('0x18'))['db'];function respondWithStatusCode(_0x1875a0,_0x347e3b){_0x347e3b=_0x347e3b||0xcc;return function(_0x11e431){if(_0x11e431){return _0x1875a0[_0xb531('0x19')](_0x347e3b);}return _0x1875a0[_0xb531('0x1a')](_0x347e3b)[_0xb531('0x1b')]();};}function respondWithResult(_0x301466,_0x4f9b81){_0x4f9b81=_0x4f9b81||0xc8;return function(_0x134686){if(_0x134686){return _0x301466[_0xb531('0x1a')](_0x4f9b81)[_0xb531('0x1c')](_0x134686);}};}function respondWithFilteredResult(_0x2fc8f2,_0xbb4aa9){return function(_0x7c4518){if(_0x7c4518){var _0x489bb1=typeof _0xbb4aa9[_0xb531('0x1d')]===_0xb531('0x1e')&&typeof _0xbb4aa9['limit']===_0xb531('0x1e');var _0x472a64=_0x7c4518[_0xb531('0x1f')];var _0x4f726d=_0x489bb1?0x0:_0xbb4aa9['offset'];var _0x33a88b=_0x489bb1?_0x7c4518[_0xb531('0x1f')]:_0xbb4aa9[_0xb531('0x1d')]+_0xbb4aa9[_0xb531('0x20')];var _0x3ef34e;if(_0x33a88b>=_0x472a64){_0x33a88b=_0x472a64;_0x3ef34e=0xc8;}else{_0x3ef34e=0xce;}_0x2fc8f2[_0xb531('0x1a')](_0x3ef34e);return _0x2fc8f2['set']('Content-Range',_0x4f726d+'-'+_0x33a88b+'/'+_0x472a64)[_0xb531('0x1c')](_0x7c4518);}return null;};}function patchUpdates(_0x47f805){return function(_0x16f54e){try{jsonpatch[_0xb531('0x21')](_0x16f54e,_0x47f805,!![]);}catch(_0x2259b6){return BPromise[_0xb531('0x22')](_0x2259b6);}return _0x16f54e[_0xb531('0x23')]();};}function saveUpdates(_0x47737a,_0x3081ff){return function(_0x3bf9fc){if(_0x3bf9fc){return _0x3bf9fc[_0xb531('0x24')](_0x47737a)[_0xb531('0x25')](function(_0x18decd){return _0x18decd;});}return null;};}function removeEntity(_0x323668,_0x209eb3){return function(_0x42e8ed){if(_0x42e8ed){return _0x42e8ed[_0xb531('0x26')]()[_0xb531('0x25')](function(){_0x323668[_0xb531('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516a6d,_0x541c48){return function(_0x3ffd40){if(!_0x3ffd40){_0x516a6d[_0xb531('0x19')](0x194);}return _0x3ffd40;};}function handleError(_0x31f401,_0x87d85){_0x87d85=_0x87d85||0x1f4;return function(_0x3b23a0){logger[_0xb531('0x27')](_0x3b23a0[_0xb531('0x28')]);if(_0x3b23a0[_0xb531('0x29')]){delete _0x3b23a0[_0xb531('0x29')];}_0x31f401[_0xb531('0x1a')](_0x87d85)[_0xb531('0x2a')](_0x3b23a0);};}exports[_0xb531('0x2b')]=function(_0x4215f4,_0x37b097){var _0x265be3={},_0x363fbf={},_0x4a52e4={'count':0x0,'rows':[]};var _0x31d066=_[_0xb531('0x2c')](db['JscriptySessionReport'][_0xb531('0x2d')],function(_0x1b8300){return{'name':_0x1b8300['fieldName'],'type':_0x1b8300[_0xb531('0x2e')]['key']};});_0x363fbf[_0xb531('0x2f')]=_[_0xb531('0x2c')](_0x31d066,_0xb531('0x29'));_0x363fbf[_0xb531('0x30')]=_['keys'](_0x4215f4['query']);_0x363fbf[_0xb531('0x31')]=_[_0xb531('0x32')](_0x363fbf[_0xb531('0x2f')],_0x363fbf[_0xb531('0x30')]);_0x265be3[_0xb531('0x33')]=_[_0xb531('0x32')](_0x363fbf[_0xb531('0x2f')],qs[_0xb531('0x34')](_0x4215f4['query'][_0xb531('0x34')]));_0x265be3[_0xb531('0x33')]=_0x265be3['attributes']['length']?_0x265be3[_0xb531('0x33')]:_0x363fbf[_0xb531('0x2f')];if(!_0x4215f4[_0xb531('0x30')][_0xb531('0x35')](_0xb531('0x36'))){_0x265be3[_0xb531('0x20')]=qs[_0xb531('0x20')](_0x4215f4['query'][_0xb531('0x20')]);_0x265be3[_0xb531('0x1d')]=qs[_0xb531('0x1d')](_0x4215f4[_0xb531('0x30')]['offset']);}_0x265be3[_0xb531('0x37')]=qs[_0xb531('0x38')](_0x4215f4[_0xb531('0x30')][_0xb531('0x38')]);_0x265be3[_0xb531('0x39')]=qs['filters'](_[_0xb531('0x3a')](_0x4215f4[_0xb531('0x30')],_0x363fbf[_0xb531('0x31')]),_0x31d066);if(_0x4215f4['query'][_0xb531('0x3b')]){_0x265be3[_0xb531('0x39')]=_[_0xb531('0x3c')](_0x265be3[_0xb531('0x39')],{'$or':_['map'](_0x31d066,function(_0x5bd69e){if(_0x5bd69e['type']!==_0xb531('0x3d')){var _0x114b90={};_0x114b90[_0x5bd69e[_0xb531('0x29')]]={'$like':'%'+_0x4215f4['query']['filter']+'%'};return _0x114b90;}})});}_0x265be3=_['merge']({},_0x265be3,_0x4215f4[_0xb531('0x3e')]);var _0x76e9c8={'where':_0x265be3[_0xb531('0x39')]};return db[_0xb531('0x3f')][_0xb531('0x1f')](_0x76e9c8)[_0xb531('0x25')](function(_0x45b247){_0x4a52e4['count']=_0x45b247;if(_0x4215f4[_0xb531('0x30')][_0xb531('0x40')]){_0x265be3['include']=[{'all':!![]}];}return db[_0xb531('0x3f')][_0xb531('0x41')](_0x265be3);})['then'](function(_0x5ab7af){_0x4a52e4[_0xb531('0x42')]=_0x5ab7af;return _0x4a52e4;})[_0xb531('0x25')](respondWithFilteredResult(_0x37b097,_0x265be3))[_0xb531('0x43')](handleError(_0x37b097,null));};exports['show']=function(_0x25f03d,_0x2b4f28){var _0x35beeb={'raw':!![],'where':{'id':_0x25f03d[_0xb531('0x44')]['id']}},_0x37e8db={};_0x37e8db[_0xb531('0x2f')]=_['keys'](db[_0xb531('0x3f')][_0xb531('0x2d')]);_0x37e8db['query']=_[_0xb531('0x45')](_0x25f03d[_0xb531('0x30')]);_0x37e8db[_0xb531('0x31')]=_['intersection'](_0x37e8db[_0xb531('0x2f')],_0x37e8db['query']);_0x35beeb['attributes']=_['intersection'](_0x37e8db[_0xb531('0x2f')],qs[_0xb531('0x34')](_0x25f03d[_0xb531('0x30')][_0xb531('0x34')]));_0x35beeb['attributes']=_0x35beeb[_0xb531('0x33')][_0xb531('0x46')]?_0x35beeb[_0xb531('0x33')]:_0x37e8db[_0xb531('0x2f')];if(_0x25f03d[_0xb531('0x30')][_0xb531('0x40')]){_0x35beeb[_0xb531('0x47')]=[{'all':!![]}];}_0x35beeb=_[_0xb531('0x3c')]({},_0x35beeb,_0x25f03d[_0xb531('0x3e')]);return db[_0xb531('0x3f')][_0xb531('0x48')](_0x35beeb)[_0xb531('0x25')](handleEntityNotFound(_0x2b4f28,null))[_0xb531('0x25')](respondWithResult(_0x2b4f28,null))[_0xb531('0x43')](handleError(_0x2b4f28,null));};exports['create']=function(_0x1db3c3,_0x18c70f){return db['JscriptySessionReport'][_0xb531('0x49')](_0x1db3c3[_0xb531('0x4a')],{})[_0xb531('0x25')](respondWithResult(_0x18c70f,0xc9))[_0xb531('0x43')](handleError(_0x18c70f,null));};exports['update']=function(_0x4c0c82,_0x3ba2f9){if(_0x4c0c82[_0xb531('0x4a')]['id']){delete _0x4c0c82['body']['id'];}return db[_0xb531('0x3f')]['find']({'where':{'id':_0x4c0c82['params']['id']}})[_0xb531('0x25')](handleEntityNotFound(_0x3ba2f9,null))[_0xb531('0x25')](saveUpdates(_0x4c0c82['body'],null))[_0xb531('0x25')](respondWithResult(_0x3ba2f9,null))[_0xb531('0x43')](handleError(_0x3ba2f9,null));};exports[_0xb531('0x26')]=function(_0x4a656b,_0x34e33e){return db[_0xb531('0x3f')][_0xb531('0x48')]({'where':{'id':_0x4a656b[_0xb531('0x44')]['id']}})[_0xb531('0x25')](handleEntityNotFound(_0x34e33e,null))[_0xb531('0x25')](removeEntity(_0x34e33e,null))[_0xb531('0x43')](handleError(_0x34e33e,null));};exports[_0xb531('0x4b')]=function(_0x43051f,_0x1777ba){return db[_0xb531('0x3f')]['describe']()[_0xb531('0x25')](respondWithResult(_0x1777ba,null))['catch'](handleError(_0x1777ba,null));};exports[_0xb531('0x4c')]=function(_0x2f3cfe,_0x56f929,_0x343805){var _0x409195={'raw':!![],'where':{}};var _0x55aef7={};var _0x3ea3c5={'count':0x0,'rows':[]};return db[_0xb531('0x3f')][_0xb531('0x4d')]({'where':{'id':_0x2f3cfe['params']['id']}})['then'](handleEntityNotFound(_0x56f929,null))[_0xb531('0x25')](function(_0xea662d){if(_0xea662d){_0x55aef7[_0xb531('0x2f')]=_[_0xb531('0x45')](db[_0xb531('0x4e')][_0xb531('0x2d')]);_0x55aef7['query']=_[_0xb531('0x45')](_0x2f3cfe[_0xb531('0x30')]);_0x55aef7[_0xb531('0x31')]=_['intersection'](_0x55aef7[_0xb531('0x2f')],_0x55aef7[_0xb531('0x30')]);_0x409195[_0xb531('0x33')]=_['intersection'](_0x55aef7[_0xb531('0x2f')],qs[_0xb531('0x34')](_0x2f3cfe[_0xb531('0x30')][_0xb531('0x34')]));_0x409195[_0xb531('0x33')]=_0x409195['attributes']['length']?_0x409195[_0xb531('0x33')]:_0x55aef7[_0xb531('0x2f')];if(!_0x2f3cfe[_0xb531('0x30')]['hasOwnProperty'](_0xb531('0x36'))){_0x409195[_0xb531('0x20')]=qs[_0xb531('0x20')](_0x2f3cfe['query'][_0xb531('0x20')]);_0x409195[_0xb531('0x1d')]=qs[_0xb531('0x1d')](_0x2f3cfe[_0xb531('0x30')][_0xb531('0x1d')]);}_0x409195[_0xb531('0x37')]=qs[_0xb531('0x38')](_0x2f3cfe[_0xb531('0x30')][_0xb531('0x38')]);_0x409195[_0xb531('0x39')]=qs['filters'](_['pick'](_0x2f3cfe[_0xb531('0x30')],_0x55aef7[_0xb531('0x31')]));_0x409195[_0xb531('0x39')][_0xb531('0x4f')]=_0xea662d['id'];if(_0x2f3cfe['query'][_0xb531('0x3b')]){_0x409195['where']=_[_0xb531('0x3c')](_0x409195['where'],{'$or':_[_0xb531('0x2c')](_0x409195['attributes'],function(_0x1b83d8){var _0x4fcb03={};_0x4fcb03[_0x1b83d8]={'$like':'%'+_0x2f3cfe[_0xb531('0x30')][_0xb531('0x3b')]+'%'};return _0x4fcb03;})});}_0x409195=_[_0xb531('0x3c')]({},_0x409195,_0x2f3cfe[_0xb531('0x3e')]);return db[_0xb531('0x4e')]['count']({'where':_0x409195[_0xb531('0x39')]})['then'](function(_0x13eefe){_0x3ea3c5['count']=_0x13eefe;if(_0x2f3cfe[_0xb531('0x30')]['includeAll']){_0x409195[_0xb531('0x47')]=[{'all':!![]}];}return db[_0xb531('0x4e')][_0xb531('0x41')](_0x409195);})[_0xb531('0x25')](function(_0x4d0679){_0x3ea3c5[_0xb531('0x42')]=_0x4d0679;return _0x3ea3c5;});}})[_0xb531('0x25')](respondWithFilteredResult(_0x56f929,_0x409195))[_0xb531('0x43')](handleError(_0x56f929,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ee26680..0b829f9 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 _0x27a0=['define','JscriptySessionReport','util','../../config/logger','api','moment','bluebird','./jscriptySessionReport.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x27a0,0xbf));var _0x027a=function(_0x518ac1,_0x2d4275){_0x518ac1=_0x518ac1-0x0;var _0x8801c1=_0x27a0[_0x518ac1];return _0x8801c1;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('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(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x4d9772,_0x9a5a45){var _0x5098ff=function(_0x5123b6){while(--_0x5123b6){_0x4d9772['push'](_0x4d9772['shift']());}};_0x5098ff(++_0x9a5a45);}(_0xb138,0x1dd));var _0x8b13=function(_0x3991f6,_0x3ccec9){_0x3991f6=_0x3991f6-0x0;var _0x93b764=_0xb138[_0x3991f6];return _0x93b764;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 7ba2ac6..f2ee041 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 _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(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x4991,0xf7));var _0x1499=function(_0x4e94a2,_0x2601f2){_0x4e94a2=_0x4e94a2-0x0;var _0x171fa1=_0x4991[_0x4e94a2];return _0x171fa1;};'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 +var _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch'];(function(_0x4e8839,_0x494b49){var _0x3ea160=function(_0x108fa0){while(--_0x108fa0){_0x4e8839['push'](_0x4e8839['shift']());}};_0x3ea160(++_0x494b49);}(_0xb44a,0x1c2));var _0xab44=function(_0x2ed88f,_0x5bc5ae){_0x2ed88f=_0x2ed88f-0x0;var _0x17ca96=_0xb44a[_0x2ed88f];return _0x17ca96;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b03d248..2d90b68 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 _0x89c0=['isAuthenticated','update','downloadLogFile','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x89c0,0x1b0));var _0x089c=function(_0xb3928c,_0x539c87){_0xb3928c=_0xb3928c-0x0;var _0x30d9b2=_0x89c0[_0xb3928c];return _0x30d9b2;};'use strict';var multer=require(_0x089c('0x0'));var util=require('util');var path=require(_0x089c('0x1'));var timeout=require(_0x089c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x089c('0x3'));var config=require(_0x089c('0x4'));var controller=require(_0x089c('0x5'));router[_0x089c('0x6')]('/',controller[_0x089c('0x7')]);router[_0x089c('0x8')](_0x089c('0x9'),auth[_0x089c('0xa')](),controller[_0x089c('0xb')]);router[_0x089c('0x6')]('/download_log_file',auth['isAuthenticated'](),controller[_0x089c('0xc')]);module['exports']=router; \ No newline at end of file +var _0x627e=['../../components/auth/service','../../config/environment','./license.controller','put','/:id','isAuthenticated','update','get','/download_log_file','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2bb66c,_0x36c6c6){var _0x1e0f98=function(_0x1e3412){while(--_0x1e3412){_0x2bb66c['push'](_0x2bb66c['shift']());}};_0x1e0f98(++_0x36c6c6);}(_0x627e,0x15a));var _0xe627=function(_0x5db8c5,_0x1f51c8){_0x5db8c5=_0x5db8c5-0x0;var _0x186da8=_0x627e[_0x5db8c5];return _0x186da8;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require('connect-timeout');var express=require(_0xe627('0x3'));var router=express[_0xe627('0x4')]();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe627('0x7'));var controller=require(_0xe627('0x8'));router['get']('/',controller['index']);router[_0xe627('0x9')](_0xe627('0xa'),auth[_0xe627('0xb')](),controller[_0xe627('0xc')]);router[_0xe627('0xd')](_0xe627('0xe'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0xe627('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c4ec524..c8e8e68 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 _0x2c5c=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x51f286,_0xde9293){var _0x4810b0=function(_0x3020c9){while(--_0x3020c9){_0x51f286['push'](_0x51f286['shift']());}};_0x4810b0(++_0xde9293);}(_0x2c5c,0x11f));var _0xc2c5=function(_0x5e58a0,_0x27877c){_0x5e58a0=_0x5e58a0-0x0;var _0x1c8f4e=_0x2c5c[_0x5e58a0];return _0x1c8f4e;};'use strict';var Sequelize=require(_0xc2c5('0x0'));module[_0xc2c5('0x1')]={'license':{'type':Sequelize[_0xc2c5('0x2')]},'data1':{'type':Sequelize[_0xc2c5('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xc2c5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x39c6=['INTEGER','TEXT','STRING'];(function(_0x1d9b54,_0x4e3d18){var _0x23627b=function(_0x4e1fe7){while(--_0x4e1fe7){_0x1d9b54['push'](_0x1d9b54['shift']());}};_0x23627b(++_0x4e3d18);}(_0x39c6,0x79));var _0x639c=function(_0x5067e0,_0x5b5e12){_0x5067e0=_0x5067e0-0x0;var _0x51ad99=_0x39c6[_0x5067e0];return _0x51ad99;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x639c('0x0')]},'data1':{'type':Sequelize[_0x639c('0x1')]},'data2':{'type':Sequelize[_0x639c('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x639c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 8008305..04f4221 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 _0xc45f=['json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','query','keys','intersection','attributes','fields','length','model','merge','options','catch','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set'];(function(_0x103cd3,_0x2d7033){var _0x2255b8=function(_0x1fc254){while(--_0x1fc254){_0x103cd3['push'](_0x103cd3['shift']());}};_0x2255b8(++_0x2d7033);}(_0xc45f,0x14f));var _0xfc45=function(_0x4972a7,_0x426796){_0x4972a7=_0x4972a7-0x0;var _0x2a83e9=_0xc45f[_0x4972a7];return _0x2a83e9;};'use strict';var emlformat=require(_0xfc45('0x0'));var rimraf=require(_0xfc45('0x1'));var zipdir=require(_0xfc45('0x2'));var jsonpatch=require(_0xfc45('0x3'));var rp=require(_0xfc45('0x4'));var moment=require(_0xfc45('0x5'));var BPromise=require(_0xfc45('0x6'));var Mustache=require('mustache');var util=require(_0xfc45('0x7'));var path=require(_0xfc45('0x8'));var sox=require(_0xfc45('0x9'));var csv=require(_0xfc45('0xa'));var ejs=require(_0xfc45('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfc45('0xc'));var crypto=require(_0xfc45('0xd'));var jsforce=require(_0xfc45('0xe'));var deskjs=require(_0xfc45('0xf'));var toCsv=require(_0xfc45('0xa'));var querystring=require(_0xfc45('0x10'));var Papa=require(_0xfc45('0x11'));var Redis=require(_0xfc45('0x12'));var authService=require(_0xfc45('0x13'));var qs=require(_0xfc45('0x14'));var as=require(_0xfc45('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc45('0x16'))('api');var utils=require(_0xfc45('0x17'));var config=require(_0xfc45('0x18'));var licenseUtil=require(_0xfc45('0x19'));var db=require(_0xfc45('0x1a'))['db'];function respondWithStatusCode(_0x2dab05,_0x5e7c07){_0x5e7c07=_0x5e7c07||0xcc;return function(_0x1acefc){if(_0x1acefc){return _0x2dab05[_0xfc45('0x1b')](_0x5e7c07);}return _0x2dab05[_0xfc45('0x1c')](_0x5e7c07)[_0xfc45('0x1d')]();};}function respondWithResult(_0xa6fe80,_0x2e8ca){_0x2e8ca=_0x2e8ca||0xc8;return function(_0x5807de){if(_0x5807de){return _0xa6fe80[_0xfc45('0x1c')](_0x2e8ca)['json'](_0x5807de);}};}function respondWithFilteredResult(_0x5a3446,_0x55bb0e){return function(_0x1b9701){if(_0x1b9701){var _0x47357a=typeof _0x55bb0e[_0xfc45('0x1e')]===_0xfc45('0x1f')&&typeof _0x55bb0e['limit']==='undefined';var _0x58cc4f=_0x1b9701['count'];var _0x1493a0=_0x47357a?0x0:_0x55bb0e[_0xfc45('0x1e')];var _0x112ba6=_0x47357a?_0x1b9701[_0xfc45('0x20')]:_0x55bb0e['offset']+_0x55bb0e[_0xfc45('0x21')];var _0x24b79c;if(_0x112ba6>=_0x58cc4f){_0x112ba6=_0x58cc4f;_0x24b79c=0xc8;}else{_0x24b79c=0xce;}_0x5a3446['status'](_0x24b79c);return _0x5a3446[_0xfc45('0x22')]('Content-Range',_0x1493a0+'-'+_0x112ba6+'/'+_0x58cc4f)[_0xfc45('0x23')](_0x1b9701);}return null;};}function patchUpdates(_0x7aa151){return function(_0x28e701){try{jsonpatch[_0xfc45('0x24')](_0x28e701,_0x7aa151,!![]);}catch(_0x4f68d0){return BPromise[_0xfc45('0x25')](_0x4f68d0);}return _0x28e701[_0xfc45('0x26')]();};}function saveUpdates(_0xcf4ac2,_0x425650){return function(_0x1a2ab0){if(_0x1a2ab0){return _0x1a2ab0[_0xfc45('0x27')](_0xcf4ac2)[_0xfc45('0x28')](function(_0xfc4b16){return _0xfc4b16;});}return null;};}function removeEntity(_0x591dc8,_0x9fcd1d){return function(_0x523738){if(_0x523738){return _0x523738[_0xfc45('0x29')]()['then'](function(){_0x591dc8[_0xfc45('0x1c')](0xcc)[_0xfc45('0x1d')]();});}};}function handleEntityNotFound(_0x4affd4,_0x2d38a5){return function(_0x3ce44b){if(!_0x3ce44b){_0x4affd4[_0xfc45('0x1b')](0x194);}return _0x3ce44b;};}function handleError(_0x588f41,_0xec1705){_0xec1705=_0xec1705||0x1f4;return function(_0x47a476){logger[_0xfc45('0x2a')](_0x47a476[_0xfc45('0x2b')]);if(_0x47a476['name']){delete _0x47a476[_0xfc45('0x2c')];}_0x588f41['status'](_0xec1705)[_0xfc45('0x2d')](_0x47a476);};}var utilLicense=require(_0xfc45('0x19'));exports[_0xfc45('0x2e')]=function(_0x4f1e26,_0x29ac8e){var _0x300765={'raw':!![],'where':{'id':0x1}},_0xd14c00={};_0xd14c00['model']=_['keys'](db['License'][_0xfc45('0x2f')]);_0xd14c00[_0xfc45('0x30')]=_[_0xfc45('0x31')](_0x4f1e26['query']);_0xd14c00['filters']=_[_0xfc45('0x32')](_0xd14c00['model'],_0xd14c00[_0xfc45('0x30')]);_0x300765[_0xfc45('0x33')]=_[_0xfc45('0x32')](_0xd14c00['model'],qs[_0xfc45('0x34')](_0x4f1e26[_0xfc45('0x30')]['fields']));_0x300765[_0xfc45('0x33')]=_0x300765[_0xfc45('0x33')][_0xfc45('0x35')]?_0x300765[_0xfc45('0x33')]:_0xd14c00[_0xfc45('0x36')];_0x300765=_[_0xfc45('0x37')]({},_0x300765,_0x4f1e26[_0xfc45('0x38')]);return utilLicense['getLicense'](_0x300765)[_0xfc45('0x28')](respondWithResult(_0x29ac8e,null))[_0xfc45('0x39')](handleError(_0x29ac8e,null));};exports[_0xfc45('0x27')]=function(_0x278e1e,_0x1cc5ed){if(_0x278e1e[_0xfc45('0x3a')]['id']){delete _0x278e1e[_0xfc45('0x3a')]['id'];}return db[_0xfc45('0x3b')][_0xfc45('0x3c')]({'where':{'id':_0x278e1e[_0xfc45('0x3d')]['id']}})[_0xfc45('0x28')](handleEntityNotFound(_0x1cc5ed,null))[_0xfc45('0x28')](function(_0xcbaf1f){var _0x595b4f=_0xcbaf1f[_0xfc45('0x3e')]({'plain':!![]});return utilLicense[_0xfc45('0x3f')](_0x595b4f,_0x278e1e[_0xfc45('0x3a')][_0xfc45('0x40')]);})['then'](function(_0x224ca6){if(!_0x224ca6[_0xfc45('0x41')]){return saveUpdates(_0x278e1e['body'],null);}return _0x224ca6;})[_0xfc45('0x28')](respondWithResult(_0x1cc5ed,null))[_0xfc45('0x39')](handleError(_0x1cc5ed,null));};exports[_0xfc45('0x42')]=function(_0x163a38,_0x3253c0){var _0x3d82d8='license-info.log';var _0x2a1599=path['join'](_0xfc45('0x43'),_0xfc45('0x44'),_0xfc45('0x45'),_0x3d82d8);_0x3253c0[_0xfc45('0x46')](_0xfc45('0x47'),'attachment;\x20filename='+_0x3d82d8);_0x3253c0['set'](_0xfc45('0x48'),_0xfc45('0x49'));_0x3253c0['download'](_0x2a1599);}; \ No newline at end of file +var _0xfd50=['options','getLicense','body','find','params','checkLicense','key','demo','catch','downloadLogFile','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','merge'];(function(_0x29c2f7,_0x1ffb8b){var _0x3582e6=function(_0x4e91dc){while(--_0x4e91dc){_0x29c2f7['push'](_0x29c2f7['shift']());}};_0x3582e6(++_0x1ffb8b);}(_0xfd50,0x190));var _0x0fd5=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xfd50[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require(_0x0fd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fd5('0x1'));var jsonpatch=require(_0x0fd5('0x2'));var rp=require(_0x0fd5('0x3'));var moment=require(_0x0fd5('0x4'));var BPromise=require(_0x0fd5('0x5'));var Mustache=require(_0x0fd5('0x6'));var util=require('util');var path=require(_0x0fd5('0x7'));var sox=require(_0x0fd5('0x8'));var csv=require(_0x0fd5('0x9'));var ejs=require(_0x0fd5('0xa'));var fs=require('fs');var fs_extra=require(_0x0fd5('0xb'));var _=require(_0x0fd5('0xc'));var squel=require(_0x0fd5('0xd'));var crypto=require(_0x0fd5('0xe'));var jsforce=require(_0x0fd5('0xf'));var deskjs=require(_0x0fd5('0x10'));var toCsv=require(_0x0fd5('0x9'));var querystring=require('querystring');var Papa=require(_0x0fd5('0x11'));var Redis=require(_0x0fd5('0x12'));var authService=require(_0x0fd5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0fd5('0x14'));var hardwareService=require(_0x0fd5('0x15'));var logger=require(_0x0fd5('0x16'))(_0x0fd5('0x17'));var utils=require(_0x0fd5('0x18'));var config=require(_0x0fd5('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49df7a,_0x57902a){_0x57902a=_0x57902a||0xcc;return function(_0x4c67fe){if(_0x4c67fe){return _0x49df7a[_0x0fd5('0x1a')](_0x57902a);}return _0x49df7a[_0x0fd5('0x1b')](_0x57902a)[_0x0fd5('0x1c')]();};}function respondWithResult(_0x58e353,_0x511ac9){_0x511ac9=_0x511ac9||0xc8;return function(_0x3df11c){if(_0x3df11c){return _0x58e353[_0x0fd5('0x1b')](_0x511ac9)['json'](_0x3df11c);}};}function respondWithFilteredResult(_0x1047e3,_0x57986c){return function(_0x1ab97c){if(_0x1ab97c){var _0xf78fa3=typeof _0x57986c[_0x0fd5('0x1d')]===_0x0fd5('0x1e')&&typeof _0x57986c[_0x0fd5('0x1f')]===_0x0fd5('0x1e');var _0x498acd=_0x1ab97c[_0x0fd5('0x20')];var _0x242111=_0xf78fa3?0x0:_0x57986c[_0x0fd5('0x1d')];var _0xd9a1ae=_0xf78fa3?_0x1ab97c[_0x0fd5('0x20')]:_0x57986c[_0x0fd5('0x1d')]+_0x57986c[_0x0fd5('0x1f')];var _0x1a89e7;if(_0xd9a1ae>=_0x498acd){_0xd9a1ae=_0x498acd;_0x1a89e7=0xc8;}else{_0x1a89e7=0xce;}_0x1047e3[_0x0fd5('0x1b')](_0x1a89e7);return _0x1047e3[_0x0fd5('0x21')](_0x0fd5('0x22'),_0x242111+'-'+_0xd9a1ae+'/'+_0x498acd)[_0x0fd5('0x23')](_0x1ab97c);}return null;};}function patchUpdates(_0x1a6229){return function(_0x284be3){try{jsonpatch[_0x0fd5('0x24')](_0x284be3,_0x1a6229,!![]);}catch(_0x214452){return BPromise[_0x0fd5('0x25')](_0x214452);}return _0x284be3['save']();};}function saveUpdates(_0x59f403,_0x3ff38a){return function(_0x520833){if(_0x520833){return _0x520833[_0x0fd5('0x26')](_0x59f403)[_0x0fd5('0x27')](function(_0x4fe772){return _0x4fe772;});}return null;};}function removeEntity(_0x574b07,_0x3de099){return function(_0x3b7658){if(_0x3b7658){return _0x3b7658[_0x0fd5('0x28')]()[_0x0fd5('0x27')](function(){_0x574b07[_0x0fd5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x571937,_0x364e7f){return function(_0x146398){if(!_0x146398){_0x571937[_0x0fd5('0x1a')](0x194);}return _0x146398;};}function handleError(_0x5d1abb,_0x31bee0){_0x31bee0=_0x31bee0||0x1f4;return function(_0x1f2f08){logger[_0x0fd5('0x29')](_0x1f2f08['stack']);if(_0x1f2f08[_0x0fd5('0x2a')]){delete _0x1f2f08['name'];}_0x5d1abb['status'](_0x31bee0)[_0x0fd5('0x2b')](_0x1f2f08);};}var utilLicense=require(_0x0fd5('0x2c'));exports[_0x0fd5('0x2d')]=function(_0x2c3052,_0x406bc0){var _0x49e320={'raw':!![],'where':{'id':0x1}},_0x1c9064={};_0x1c9064[_0x0fd5('0x2e')]=_[_0x0fd5('0x2f')](db[_0x0fd5('0x30')][_0x0fd5('0x31')]);_0x1c9064[_0x0fd5('0x32')]=_[_0x0fd5('0x2f')](_0x2c3052['query']);_0x1c9064['filters']=_[_0x0fd5('0x33')](_0x1c9064[_0x0fd5('0x2e')],_0x1c9064[_0x0fd5('0x32')]);_0x49e320[_0x0fd5('0x34')]=_[_0x0fd5('0x33')](_0x1c9064['model'],qs[_0x0fd5('0x35')](_0x2c3052[_0x0fd5('0x32')][_0x0fd5('0x35')]));_0x49e320[_0x0fd5('0x34')]=_0x49e320[_0x0fd5('0x34')][_0x0fd5('0x36')]?_0x49e320[_0x0fd5('0x34')]:_0x1c9064[_0x0fd5('0x2e')];_0x49e320=_[_0x0fd5('0x37')]({},_0x49e320,_0x2c3052[_0x0fd5('0x38')]);return utilLicense[_0x0fd5('0x39')](_0x49e320)[_0x0fd5('0x27')](respondWithResult(_0x406bc0,null))['catch'](handleError(_0x406bc0,null));};exports[_0x0fd5('0x26')]=function(_0x38720c,_0x528445){if(_0x38720c['body']['id']){delete _0x38720c[_0x0fd5('0x3a')]['id'];}return db[_0x0fd5('0x30')][_0x0fd5('0x3b')]({'where':{'id':_0x38720c[_0x0fd5('0x3c')]['id']}})[_0x0fd5('0x27')](handleEntityNotFound(_0x528445,null))[_0x0fd5('0x27')](function(_0x40436d){var _0x58e967=_0x40436d['get']({'plain':!![]});return utilLicense[_0x0fd5('0x3d')](_0x58e967,_0x38720c[_0x0fd5('0x3a')][_0x0fd5('0x3e')]);})[_0x0fd5('0x27')](function(_0x2ade06){if(!_0x2ade06[_0x0fd5('0x3f')]){return saveUpdates(_0x38720c[_0x0fd5('0x3a')],null);}return _0x2ade06;})[_0x0fd5('0x27')](respondWithResult(_0x528445,null))[_0x0fd5('0x40')](handleError(_0x528445,null));};exports[_0x0fd5('0x41')]=function(_0x436e94,_0x17243b){var _0x5c7781=_0x0fd5('0x42');var _0x26f569=path[_0x0fd5('0x43')]('/var',_0x0fd5('0x44'),_0x0fd5('0x45'),_0x5c7781);_0x17243b[_0x0fd5('0x46')](_0x0fd5('0x47'),_0x0fd5('0x48')+_0x5c7781);_0x17243b['set'](_0x0fd5('0x49'),_0x0fd5('0x4a'));_0x17243b[_0x0fd5('0x4b')](_0x26f569);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f0335cb..fe431ff 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 _0x3573=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','License','lodash'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x3573,0x15e));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3357('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3357('0x1'));var moment=require(_0x3357('0x2'));var BPromise=require(_0x3357('0x3'));var rp=require(_0x3357('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3357('0x5'));var config=require(_0x3357('0x6'));var attributes=require('./license.attributes');module[_0x3357('0x7')]=function(_0x1cd7eb,_0x3787ff){return _0x1cd7eb['define'](_0x3357('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9b3=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./license.attributes','define','License','license'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xc9b3,0xb0));var _0x3c9b=function(_0x29c074,_0x51c114){_0x29c074=_0x29c074-0x0;var _0x357699=_0xc9b3[_0x29c074];return _0x357699;};'use strict';var _=require(_0x3c9b('0x0'));var util=require(_0x3c9b('0x1'));var logger=require(_0x3c9b('0x2'))('api');var moment=require(_0x3c9b('0x3'));var BPromise=require(_0x3c9b('0x4'));var rp=require(_0x3c9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c9b('0x6'));var config=require('../../config/environment');var attributes=require(_0x3c9b('0x7'));module['exports']=function(_0x5390ca,_0x490c9b){return _0x5390ca[_0x3c9b('0x8')](_0x3c9b('0x9'),attributes,{'tableName':_0x3c9b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index bd8dbf1..1d7563a 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 _0xc5b6=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x6ffc3d,_0x3fd67d){var _0x4a83fc=function(_0x23b846){while(--_0x23b846){_0x6ffc3d['push'](_0x6ffc3d['shift']());}};_0x4a83fc(++_0x3fd67d);}(_0xc5b6,0xe2));var _0x6c5b=function(_0x36c72c,_0x144535){_0x36c72c=_0x36c72c-0x0;var _0x3f6f1b=_0xc5b6[_0x36c72c];return _0x3f6f1b;};'use strict';var _=require(_0x6c5b('0x0'));var util=require(_0x6c5b('0x1'));var moment=require(_0x6c5b('0x2'));var BPromise=require(_0x6c5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c5b('0x4'))['db'];var utils=require(_0x6c5b('0x5'));var logger=require(_0x6c5b('0x6'))(_0x6c5b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6c5b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6441a0,_0x4aeaee,_0x319378){return new BPromise(function(_0x1118a7,_0x46c19){return client[_0x6c5b('0x9')](_0x6441a0,_0x319378)[_0x6c5b('0xa')](function(_0x72c41){logger[_0x6c5b('0xb')](_0x6c5b('0xc'),_0x4aeaee,_0x6c5b('0xd'));logger['debug'](_0x6c5b('0xe'),_0x4aeaee,_0x6c5b('0xd'),JSON['stringify'](_0x72c41));if(_0x72c41[_0x6c5b('0xf')]){if(_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x10')]===0x1f4){logger[_0x6c5b('0xf')]('License,\x20%s,\x20%s',_0x4aeaee,_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x11')]);return _0x46c19(_0x72c41[_0x6c5b('0xf')]['message']);}logger[_0x6c5b('0xf')](_0x6c5b('0xc'),_0x4aeaee,_0x72c41['error'][_0x6c5b('0x11')]);return _0x1118a7(_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x11')]);}else{logger[_0x6c5b('0xb')](_0x6c5b('0xc'),_0x4aeaee,_0x6c5b('0xd'));_0x1118a7(_0x72c41['result'][_0x6c5b('0x11')]);}})[_0x6c5b('0x12')](function(_0x480e6a){logger[_0x6c5b('0xf')](_0x6c5b('0xc'),_0x4aeaee,_0x480e6a);_0x46c19(_0x480e6a);});});} \ No newline at end of file +var _0x4746=['http','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xa89b7a,_0x36ff4e){var _0x5bee15=function(_0xf07996){while(--_0xf07996){_0xa89b7a['push'](_0xa89b7a['shift']());}};_0x5bee15(++_0x36ff4e);}(_0x4746,0x9d));var _0x6474=function(_0xec0813,_0x5bb333){_0xec0813=_0xec0813-0x0;var _0x1149f3=_0x4746[_0xec0813];return _0x1149f3;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var moment=require(_0x6474('0x2'));var BPromise=require(_0x6474('0x3'));var rs=require(_0x6474('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6474('0x5'))['db'];var utils=require(_0x6474('0x6'));var logger=require('../../config/logger')(_0x6474('0x7'));var config=require(_0x6474('0x8'));var jayson=require(_0x6474('0x9'));var client=jayson[_0x6474('0xa')][_0x6474('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3899f5,_0x5a187f,_0x4cd0e6){return new BPromise(function(_0x278be7,_0x184d06){return client[_0x6474('0xc')](_0x3899f5,_0x4cd0e6)[_0x6474('0xd')](function(_0x2e008d){logger[_0x6474('0xe')](_0x6474('0xf'),_0x5a187f,'request\x20sent');logger['debug'](_0x6474('0x10'),_0x5a187f,'request\x20sent',JSON[_0x6474('0x11')](_0x2e008d));if(_0x2e008d[_0x6474('0x12')]){if(_0x2e008d[_0x6474('0x12')][_0x6474('0x13')]===0x1f4){logger[_0x6474('0x12')]('License,\x20%s,\x20%s',_0x5a187f,_0x2e008d[_0x6474('0x12')][_0x6474('0x14')]);return _0x184d06(_0x2e008d[_0x6474('0x12')][_0x6474('0x14')]);}logger[_0x6474('0x12')](_0x6474('0xf'),_0x5a187f,_0x2e008d['error'][_0x6474('0x14')]);return _0x278be7(_0x2e008d[_0x6474('0x12')][_0x6474('0x14')]);}else{logger[_0x6474('0xe')](_0x6474('0xf'),_0x5a187f,'request\x20sent');_0x278be7(_0x2e008d['result'][_0x6474('0x14')]);}})['catch'](function(_0x1e959c){logger[_0x6474('0x12')](_0x6474('0xf'),_0x5a187f,_0x1e959c);_0x184d06(_0x1e959c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4761755..b71e404 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 _0x0782=['getInteractions','/:id/messages','getMessages','/:id/verify','verifySmtp','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','/:id/users','addAgents','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeImap','destroy','removeAgents','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions'];(function(_0x16b3f9,_0x3e746f){var _0x421fe0=function(_0x86bc97){while(--_0x86bc97){_0x16b3f9['push'](_0x16b3f9['shift']());}};_0x421fe0(++_0x3e746f);}(_0x0782,0xe3));var _0x2078=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x0782[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require('multer');var util=require(_0x2078('0x0'));var path=require(_0x2078('0x1'));var timeout=require(_0x2078('0x2'));var express=require(_0x2078('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2078('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2078('0x5'));var controller=require(_0x2078('0x6'));router[_0x2078('0x7')]('/',auth[_0x2078('0x8')](),controller[_0x2078('0x9')]);router[_0x2078('0x7')](_0x2078('0xa'),auth[_0x2078('0x8')](),controller['describe']);router[_0x2078('0x7')](_0x2078('0xb'),auth[_0x2078('0x8')](),controller['show']);router['get'](_0x2078('0xc'),auth[_0x2078('0x8')](),controller[_0x2078('0xd')]);router[_0x2078('0x7')]('/:id/canned_answers',auth[_0x2078('0x8')](),controller['getAnswers']);router['get'](_0x2078('0xe'),auth[_0x2078('0x8')](),controller[_0x2078('0xf')]);router[_0x2078('0x7')](_0x2078('0x10'),auth[_0x2078('0x8')](),controller[_0x2078('0x11')]);router[_0x2078('0x7')](_0x2078('0x12'),auth['isAuthenticated'](),controller[_0x2078('0x13')]);router[_0x2078('0x7')]('/:id/applications',auth[_0x2078('0x8')](),controller['getApplications']);router[_0x2078('0x7')](_0x2078('0x14'),auth[_0x2078('0x8')](),controller[_0x2078('0x15')]);router[_0x2078('0x7')](_0x2078('0x16'),auth[_0x2078('0x8')](),controller[_0x2078('0x17')]);router[_0x2078('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x2078('0x18')](_0x2078('0xc'),auth[_0x2078('0x8')](),controller[_0x2078('0x19')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2078('0x1a')]);router[_0x2078('0x18')]('/',auth[_0x2078('0x8')](),controller[_0x2078('0x1b')]);router[_0x2078('0x18')](_0x2078('0xe'),auth[_0x2078('0x8')](),controller[_0x2078('0x1c')]);router[_0x2078('0x18')](_0x2078('0x10'),auth[_0x2078('0x8')](),controller[_0x2078('0x1d')]);router['post'](_0x2078('0x12'),auth[_0x2078('0x8')](),controller[_0x2078('0x1e')]);router[_0x2078('0x18')]('/:id/applications',auth[_0x2078('0x8')](),controller['addApplications']);router[_0x2078('0x18')](_0x2078('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x2078('0x18')](_0x2078('0x20'),auth[_0x2078('0x8')](),controller[_0x2078('0x21')]);router['put']('/:id',auth[_0x2078('0x8')](),controller['update']);router[_0x2078('0x22')](_0x2078('0xc'),auth[_0x2078('0x8')](),controller[_0x2078('0x23')]);router[_0x2078('0x22')](_0x2078('0x24'),auth[_0x2078('0x8')](),controller[_0x2078('0x25')]);router['delete'](_0x2078('0xe'),auth[_0x2078('0x8')](),controller[_0x2078('0x26')]);router[_0x2078('0x22')](_0x2078('0x10'),auth[_0x2078('0x8')](),controller['removeSmtp']);router[_0x2078('0x22')](_0x2078('0xb'),auth['isAuthenticated'](),controller[_0x2078('0x27')]);router[_0x2078('0x22')](_0x2078('0x20'),auth[_0x2078('0x8')](),controller[_0x2078('0x28')]);module['exports']=router; \ No newline at end of file +var _0x0e65=['addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','addAgents','put','update','delete','removeAnswers','removeImap','destroy','multer','util','connect-timeout','express','fs-extra','./mailAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','addDisposition','post','addAnswer'];(function(_0x57e2c2,_0xe50142){var _0x503834=function(_0x2f758c){while(--_0x2f758c){_0x57e2c2['push'](_0x57e2c2['shift']());}};_0x503834(++_0xe50142);}(_0x0e65,0x14c));var _0x50e6=function(_0x37dec8,_0x1a893c){_0x37dec8=_0x37dec8-0x0;var _0x4c5762=_0x0e65[_0x37dec8];return _0x4c5762;};'use strict';var multer=require(_0x50e6('0x0'));var util=require(_0x50e6('0x1'));var path=require('path');var timeout=require(_0x50e6('0x2'));var express=require(_0x50e6('0x3'));var router=express['Router']();var fs_extra=require(_0x50e6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x50e6('0x5'));router[_0x50e6('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50e6('0x6')]('/describe',auth[_0x50e6('0x7')](),controller[_0x50e6('0x8')]);router[_0x50e6('0x6')](_0x50e6('0x9'),auth['isAuthenticated'](),controller[_0x50e6('0xa')]);router[_0x50e6('0x6')](_0x50e6('0xb'),auth[_0x50e6('0x7')](),controller[_0x50e6('0xc')]);router[_0x50e6('0x6')](_0x50e6('0xd'),auth[_0x50e6('0x7')](),controller['getAnswers']);router[_0x50e6('0x6')](_0x50e6('0xe'),auth[_0x50e6('0x7')](),controller[_0x50e6('0xf')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x50e6('0x10')]);router[_0x50e6('0x6')](_0x50e6('0x11'),auth[_0x50e6('0x7')](),controller[_0x50e6('0x12')]);router['get'](_0x50e6('0x13'),auth['isAuthenticated'](),controller[_0x50e6('0x14')]);router['get']('/:id/messages',auth[_0x50e6('0x7')](),controller[_0x50e6('0x15')]);router[_0x50e6('0x6')](_0x50e6('0x16'),auth[_0x50e6('0x7')](),controller[_0x50e6('0x17')]);router[_0x50e6('0x6')](_0x50e6('0x18'),auth[_0x50e6('0x7')](),controller['getAgents']);router['post']('/:id/dispositions',auth[_0x50e6('0x7')](),controller[_0x50e6('0x19')]);router[_0x50e6('0x1a')](_0x50e6('0xd'),auth['isAuthenticated'](),controller[_0x50e6('0x1b')]);router[_0x50e6('0x1a')]('/',auth[_0x50e6('0x7')](),controller['create']);router[_0x50e6('0x1a')](_0x50e6('0xe'),auth[_0x50e6('0x7')](),controller[_0x50e6('0x1c')]);router[_0x50e6('0x1a')](_0x50e6('0x1d'),auth[_0x50e6('0x7')](),controller['addSmtp']);router[_0x50e6('0x1a')](_0x50e6('0x11'),auth[_0x50e6('0x7')](),controller[_0x50e6('0x1e')]);router[_0x50e6('0x1a')]('/:id/applications',auth[_0x50e6('0x7')](),controller[_0x50e6('0x1f')]);router[_0x50e6('0x1a')](_0x50e6('0x20'),auth[_0x50e6('0x7')](),controller['send']);router[_0x50e6('0x1a')](_0x50e6('0x18'),auth[_0x50e6('0x7')](),controller[_0x50e6('0x21')]);router[_0x50e6('0x22')](_0x50e6('0x9'),auth[_0x50e6('0x7')](),controller[_0x50e6('0x23')]);router[_0x50e6('0x24')](_0x50e6('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x50e6('0x24')](_0x50e6('0xd'),auth['isAuthenticated'](),controller[_0x50e6('0x25')]);router['delete'](_0x50e6('0xe'),auth[_0x50e6('0x7')](),controller[_0x50e6('0x26')]);router[_0x50e6('0x24')](_0x50e6('0x1d'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x50e6('0x24')](_0x50e6('0x9'),auth[_0x50e6('0x7')](),controller[_0x50e6('0x27')]);router[_0x50e6('0x24')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 9037d39..c6ee553 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 _0xb450=['hotmail','yahoo','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','gmail'];(function(_0xf53142,_0x97fe17){var _0x15293a=function(_0x46a40b){while(--_0x46a40b){_0xf53142['push'](_0xf53142['shift']());}};_0x15293a(++_0x97fe17);}(_0xb450,0xcb));var _0x0b45=function(_0x449198,_0x4c97a5){_0x449198=_0x449198-0x0;var _0x1070c6=_0xb450[_0x449198];return _0x1070c6;};'use strict';var Sequelize=require('sequelize');module[_0x0b45('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x0b45('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0b45('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x0b45('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x0b45('0x3')]},'markAsUnread':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0b45('0x1')],'allowNull':![],'defaultValue':_0x0b45('0x4')},'fontSize':{'type':Sequelize[_0x0b45('0x5')](0x2)[_0x0b45('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0b45('0x7');}},'notificationSound':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0b45('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0b45('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0b45('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x0b45('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':![],'comment':_0x0b45('0x9'),'set':function(_0x4c2444){if(!_0x4c2444)this[_0x0b45('0xa')](_0x0b45('0xb'),null);this[_0x0b45('0xa')]('mandatoryDisposition',_0x4c2444);}},'provider':{'type':Sequelize['ENUM'](_0x0b45('0xc'),_0x0b45('0xd'),_0x0b45('0xe'),'outlook365'),'defaultValue':null,'get':function(){var _0x159923=this[_0x0b45('0xf')](_0x0b45('0x10'));return _0x159923||_0x0b45('0x11');},'set':function(_0x2654ab){if(_0x2654ab===_0x0b45('0x11')){_0x2654ab=null;}return this[_0x0b45('0xa')](_0x0b45('0x10'),_0x2654ab);}}}; \ No newline at end of file +var _0x5db8=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','custom','setDataValue','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x21cf96,_0x5ac49c){var _0x35c694=function(_0x355dc7){while(--_0x355dc7){_0x21cf96['push'](_0x21cf96['shift']());}};_0x35c694(++_0x5ac49c);}(_0x5db8,0xf1));var _0x85db=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0x5db8[_0x294b6];return _0x38bb97;};'use strict';var Sequelize=require(_0x85db('0x0'));module[_0x85db('0x1')]={'description':{'type':Sequelize[_0x85db('0x2')]},'name':{'type':Sequelize[_0x85db('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x85db('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x85db('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x85db('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x85db('0x2')],'allowNull':![],'defaultValue':_0x85db('0x5')},'fontSize':{'type':Sequelize[_0x85db('0x6')](0x2)[_0x85db('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x85db('0x8');}},'notificationSound':{'type':Sequelize[_0x85db('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x85db('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x85db('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x85db('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x85db('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x85db('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x85db('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x85db('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2e7edb){if(!_0x2e7edb)this['setDataValue'](_0x85db('0xa'),null);this['setDataValue'](_0x85db('0xb'),_0x2e7edb);}},'provider':{'type':Sequelize[_0x85db('0xc')](_0x85db('0xd'),'hotmail',_0x85db('0xe'),_0x85db('0xf')),'defaultValue':null,'get':function(){var _0x2566b0=this['getDataValue']('provider');return _0x2566b0||'custom';},'set':function(_0x17de9e){if(_0x17de9e===_0x85db('0x10')){_0x17de9e=null;}return this[_0x85db('0x11')](_0x85db('0x12'),_0x17de9e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7629a81..3df24d5 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 _0x6ede=['../../mysqldb','redis','./mailAccount.socket','register','jayson/promise','client','info','request\x20sent','debug','error','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','MailAccounts','UserProfileResource','stack','name','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','MailServerIn','include','options','body','custom','find','describe','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','map','CannedAnswer','removeAnswers','provider','email','ListId','isNil','active','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','send','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','out','Interaction','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','api'];(function(_0xc6971f,_0x53138a){var _0x28ca53=function(_0xa0f0b4){while(--_0xa0f0b4){_0xc6971f['push'](_0xc6971f['shift']());}};_0x28ca53(++_0x53138a);}(_0x6ede,0xb6));var _0xe6ed=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x6ede[_0x587693];return _0x510a1a;};'use strict';var moment=require(_0xe6ed('0x0'));var BPromise=require(_0xe6ed('0x1'));var util=require(_0xe6ed('0x2'));var path=require(_0xe6ed('0x3'));var _=require(_0xe6ed('0x4'));var juice=require(_0xe6ed('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe6ed('0x6'));var config=require('../../config/environment');var db=require(_0xe6ed('0x7'))['db'];config['redis']=_['defaults'](config[_0xe6ed('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe6ed('0x9'))[_0xe6ed('0xa')](socket);var jayson=require(_0xe6ed('0xb'));var client=jayson[_0xe6ed('0xc')]['http']({'port':0x232b});function respondWithRpcPromise(_0x53d025,_0x58d687,_0x31f4e2,_0x41bf4c){return new BPromise(function(_0x1ba92c,_0x537930){var _0x4eba4e=_0x41bf4c||client;return _0x4eba4e['request'](_0x53d025,_0x31f4e2)['then'](function(_0x157930){logger[_0xe6ed('0xd')]('MailAccount,\x20%s,\x20%s',_0x58d687,_0xe6ed('0xe'));logger[_0xe6ed('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x58d687,'request\x20sent',JSON['stringify'](_0x157930));if(_0x157930['error']){if(_0x157930[_0xe6ed('0x10')]['code']===0x1f4){logger[_0xe6ed('0x10')]('MailAccount,\x20%s,\x20%s',_0x58d687,_0x157930[_0xe6ed('0x10')][_0xe6ed('0x11')]);return _0x537930(_0x157930['error']['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x58d687,_0x157930['error'][_0xe6ed('0x11')]);return _0x1ba92c(_0x157930[_0xe6ed('0x10')][_0xe6ed('0x11')]);}else{logger[_0xe6ed('0xd')](_0xe6ed('0x12'),_0x58d687,'request\x20sent');_0x1ba92c(_0x157930[_0xe6ed('0x13')][_0xe6ed('0x11')]);}})[_0xe6ed('0x14')](function(_0x520069){logger['error'](_0xe6ed('0x12'),_0x58d687,_0x520069);_0x537930(_0x520069);});});}function respondWithStatusCode(_0x4b3cc8,_0x5893db){_0x5893db=_0x5893db||0xcc;return function(_0x2cd004){if(_0x2cd004){return _0x4b3cc8[_0xe6ed('0x15')](_0x5893db);}return _0x4b3cc8[_0xe6ed('0x16')](_0x5893db)[_0xe6ed('0x17')]();};}function respondWithResult(_0xfc1330,_0x3e20eb){_0x3e20eb=_0x3e20eb||0xc8;return function(_0x121534){if(_0x121534){return _0xfc1330[_0xe6ed('0x16')](_0x3e20eb)[_0xe6ed('0x18')](_0x121534);}};}function respondWithFilteredResult(_0x4db1d4,_0x57b529){return function(_0x35fa46){if(_0x35fa46){var _0x394307=typeof _0x57b529['offset']===_0xe6ed('0x19')&&typeof _0x57b529[_0xe6ed('0x1a')]===_0xe6ed('0x19');var _0x362680=_0x35fa46[_0xe6ed('0x1b')];var _0x1e1884=_0x394307?0x0:_0x57b529[_0xe6ed('0x1c')];var _0x2fc69e=_0x394307?_0x35fa46['count']:_0x57b529[_0xe6ed('0x1c')]+_0x57b529[_0xe6ed('0x1a')];var _0x2ca89f;if(_0x2fc69e>=_0x362680){_0x2fc69e=_0x362680;_0x2ca89f=0xc8;}else{_0x2ca89f=0xce;}_0x4db1d4[_0xe6ed('0x16')](_0x2ca89f);return _0x4db1d4['set'](_0xe6ed('0x1d'),_0x1e1884+'-'+_0x2fc69e+'/'+_0x362680)[_0xe6ed('0x18')](_0x35fa46);}return null;};}function saveUpdates(_0x42ef26){return function(_0x15e3e2){if(_0x15e3e2){return _0x15e3e2[_0xe6ed('0x1e')](_0x42ef26)[_0xe6ed('0x1f')](function(_0x53ca50){return _0x53ca50;});}return null;};}function removeEntity(_0x281a5f){return function(_0x592f62){if(_0x592f62){return _0x592f62[_0xe6ed('0x20')]()[_0xe6ed('0x1f')](function(){var _0x1fc7cc=_0x592f62[_0xe6ed('0x21')]({'plain':!![]});var _0x36848e=_0xe6ed('0x22');return db[_0xe6ed('0x23')][_0xe6ed('0x20')]({'where':{'type':_0x36848e,'resourceId':_0x1fc7cc['id']}})[_0xe6ed('0x1f')](function(){return _0x592f62;});})[_0xe6ed('0x1f')](function(){_0x281a5f[_0xe6ed('0x16')](0xcc)[_0xe6ed('0x17')]();});}};}function handleEntityNotFound(_0x17abcc){return function(_0x37a4ac){if(!_0x37a4ac){_0x17abcc[_0xe6ed('0x15')](0x194);}return _0x37a4ac;};}function handleError(_0x57c9fc,_0x11a61a){_0x11a61a=_0x11a61a||0x1f4;return function(_0x5a69b1){logger[_0xe6ed('0x10')](_0x5a69b1[_0xe6ed('0x24')]);if(_0x5a69b1['name']){delete _0x5a69b1[_0xe6ed('0x25')];}_0x57c9fc[_0xe6ed('0x16')](_0x11a61a)['send'](_0x5a69b1);};}function getImapHost(_0x59f3b0){switch(_0x59f3b0){case'gmail':return'imap.gmail.com';case _0xe6ed('0x26'):return _0xe6ed('0x27');case _0xe6ed('0x28'):return _0xe6ed('0x29');case'outlook365':return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x59f3b0);}function getSmtpHost(_0x256776){switch(_0x256776){case _0xe6ed('0x2a'):return _0xe6ed('0x2b');case _0xe6ed('0x26'):return _0xe6ed('0x2c');case _0xe6ed('0x28'):return _0xe6ed('0x2d');case _0xe6ed('0x2e'):return'smtp.office365.com';}throw new Error(_0xe6ed('0x2f'),_0x256776);}function getAuthenticationOptions(_0x1252dd,_0x3ea47f){var _0x4ce8a0={};var _0x2811cb={};if(_0x1252dd){_0x4ce8a0[_0xe6ed('0x30')]=_0x2811cb[_0xe6ed('0x30')]=_0x3ea47f[_0xe6ed('0x31')];_0x4ce8a0[_0xe6ed('0x32')]=_0x2811cb[_0xe6ed('0x33')]=_0x3ea47f['password'];if(_0x3ea47f['modernAuthentication']){_0x4ce8a0[_0xe6ed('0x34')]=_0x2811cb[_0xe6ed('0x34')]=!![];_0x4ce8a0[_0xe6ed('0x35')]=_0x2811cb['CloudProviderId']=_0x3ea47f['CloudProviderId'];_0x4ce8a0[_0xe6ed('0x32')]=_0x2811cb[_0xe6ed('0x33')]=null;}else{_0x4ce8a0[_0xe6ed('0x35')]=_0x2811cb['CloudProviderId']=null;}_0x4ce8a0[_0xe6ed('0x36')]=getImapHost(_0x1252dd);_0x4ce8a0['port']=0x3e1;_0x2811cb[_0xe6ed('0x36')]=getSmtpHost(_0x1252dd);_0x2811cb[_0xe6ed('0x37')]=0x24b;_0x2811cb[_0xe6ed('0x38')]=![];_0x4ce8a0[_0xe6ed('0x39')]=_0x2811cb[_0xe6ed('0x39')]=null;}else{if(_0x3ea47f[_0xe6ed('0x3a')]){_0x4ce8a0[_0xe6ed('0x30')]=_0x2811cb['user']=_0x3ea47f[_0xe6ed('0x31')];_0x4ce8a0[_0xe6ed('0x32')]=_0x2811cb[_0xe6ed('0x33')]=_0x3ea47f[_0xe6ed('0x32')];}else{_0x4ce8a0[_0xe6ed('0x3a')]=_0x2811cb[_0xe6ed('0x3a')]=![];_0x4ce8a0[_0xe6ed('0x30')]=_0x2811cb[_0xe6ed('0x30')]=null;_0x4ce8a0[_0xe6ed('0x32')]=_0x2811cb[_0xe6ed('0x33')]=null;}_0x4ce8a0['host']=_0x3ea47f[_0xe6ed('0x3b')]['host'];_0x4ce8a0[_0xe6ed('0x37')]=_0x3ea47f[_0xe6ed('0x3b')][_0xe6ed('0x37')];_0x2811cb['host']=_0x3ea47f[_0xe6ed('0x3c')][_0xe6ed('0x36')];_0x2811cb[_0xe6ed('0x37')]=_0x3ea47f[_0xe6ed('0x3c')][_0xe6ed('0x37')];}return{'Imap':_0x4ce8a0,'Smtp':_0x2811cb};}exports[_0xe6ed('0x3d')]=function(_0x18e1b0,_0x595d78){var _0x44f148={'include':[{'model':db['MailServerIn'],'as':_0xe6ed('0x3b')},{'model':db[_0xe6ed('0x3e')],'as':_0xe6ed('0x3c')},{'model':db[_0xe6ed('0x3f')],'as':_0xe6ed('0x40')}]},_0x13173d={},_0x562fb6={'count':0x0,'rows':[]};var _0x4a5495=_['map'](db[_0xe6ed('0x41')][_0xe6ed('0x42')],function(_0x5047aa){return{'name':_0x5047aa[_0xe6ed('0x43')],'type':_0x5047aa[_0xe6ed('0x44')][_0xe6ed('0x45')]};});_0x13173d[_0xe6ed('0x46')]=_['map'](_0x4a5495,_0xe6ed('0x25'));_0x13173d[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x18e1b0[_0xe6ed('0x47')]);_0x13173d[_0xe6ed('0x49')]=_['intersection'](_0x13173d['model'],_0x13173d[_0xe6ed('0x47')]);_0x44f148[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x13173d['model'],qs[_0xe6ed('0x4c')](_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x4c')]));_0x44f148[_0xe6ed('0x4a')]=_0x44f148['attributes'][_0xe6ed('0x4d')]?_0x44f148[_0xe6ed('0x4a')]:_0x13173d[_0xe6ed('0x46')];if(!_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x4e')]('nolimit')){_0x44f148[_0xe6ed('0x1a')]=qs['limit'](_0x18e1b0['query']['limit']);_0x44f148[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x1c')]);}_0x44f148[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x18e1b0['query'][_0xe6ed('0x50')]);_0x44f148[_0xe6ed('0x51')]=qs[_0xe6ed('0x49')](_['pick'](_0x18e1b0['query'],_0x13173d[_0xe6ed('0x49')]),_0x4a5495);if(_0x18e1b0['query'][_0xe6ed('0x52')]){_0x44f148[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x44f148[_0xe6ed('0x51')],{'$or':_['map'](_0x4a5495,function(_0x45a435){if(_0x45a435[_0xe6ed('0x44')]!==_0xe6ed('0x54')){var _0x36d657={};_0x36d657[_0x45a435['name']]={'$like':'%'+_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x36d657;}})});}_0x44f148=_[_0xe6ed('0x53')]({},_0x44f148,_0x18e1b0['options']);var _0x464da6={'where':_0x44f148['where']};return db[_0xe6ed('0x41')][_0xe6ed('0x1b')](_0x464da6)['then'](function(_0x2e46d5){_0x562fb6[_0xe6ed('0x1b')]=_0x2e46d5;if(_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x44f148['include']=[{'all':!![]}];}return db[_0xe6ed('0x41')][_0xe6ed('0x56')](_0x44f148);})[_0xe6ed('0x1f')](function(_0x419779){_0x562fb6[_0xe6ed('0x57')]=_0x419779;return _0x562fb6;})['then'](respondWithFilteredResult(_0x595d78,_0x44f148))[_0xe6ed('0x14')](handleError(_0x595d78,null));};exports[_0xe6ed('0x58')]=function(_0x4dabc1,_0x44537a){var _0x3270e0={'raw':![],'where':{'id':_0x4dabc1[_0xe6ed('0x59')]['id']},'include':[{'model':db[_0xe6ed('0x5a')],'as':_0xe6ed('0x3b')},{'model':db[_0xe6ed('0x3e')],'as':_0xe6ed('0x3c')},{'model':db[_0xe6ed('0x3f')],'as':_0xe6ed('0x40')}]},_0x169e4b={};_0x169e4b[_0xe6ed('0x46')]=_[_0xe6ed('0x48')](db[_0xe6ed('0x41')]['rawAttributes']);_0x169e4b[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x4dabc1[_0xe6ed('0x47')]);_0x169e4b[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x169e4b[_0xe6ed('0x46')],_0x169e4b[_0xe6ed('0x47')]);_0x3270e0[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x169e4b[_0xe6ed('0x46')],qs[_0xe6ed('0x4c')](_0x4dabc1[_0xe6ed('0x47')][_0xe6ed('0x4c')]));_0x3270e0[_0xe6ed('0x4a')]=_0x3270e0[_0xe6ed('0x4a')][_0xe6ed('0x4d')]?_0x3270e0[_0xe6ed('0x4a')]:_0x169e4b[_0xe6ed('0x46')];if(_0x4dabc1[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x3270e0[_0xe6ed('0x5b')]=[{'all':!![]}];}_0x3270e0=_[_0xe6ed('0x53')]({},_0x3270e0,_0x4dabc1[_0xe6ed('0x5c')]);return db[_0xe6ed('0x41')]['find'](_0x3270e0)[_0xe6ed('0x1f')](handleEntityNotFound(_0x44537a,null))[_0xe6ed('0x1f')](respondWithResult(_0x44537a,null))[_0xe6ed('0x14')](handleError(_0x44537a,null));};exports[_0xe6ed('0x1e')]=function(_0x49d6b9,_0x45f1a9){if(_0x49d6b9[_0xe6ed('0x5d')]['id']){delete _0x49d6b9[_0xe6ed('0x5d')]['id'];}var _0x26545c=_0x49d6b9[_0xe6ed('0x5d')]['provider']===_0xe6ed('0x5e')?null:_0x49d6b9[_0xe6ed('0x5d')]['provider'];var _0x1e166d=_0x49d6b9['body']['Imap']||{};var _0x531743=_0x49d6b9[_0xe6ed('0x5d')]['Smtp']||{};if(_0x26545c){_0x1e166d[_0xe6ed('0x36')]=getImapHost(_0x26545c);_0x1e166d[_0xe6ed('0x37')]=0x3e1;_0x531743['host']=getSmtpHost(_0x26545c);_0x531743['port']=0x24b;_0x531743[_0xe6ed('0x38')]=![];}if(_0x531743[_0xe6ed('0x34')]){_0x531743[_0xe6ed('0x38')]=![];}else{_0x531743[_0xe6ed('0x35')]=null;}if(!_0x1e166d[_0xe6ed('0x34')])_0x1e166d[_0xe6ed('0x35')]=null;_0x49d6b9['body'][_0xe6ed('0x3b')]=_0x1e166d;_0x49d6b9[_0xe6ed('0x5d')][_0xe6ed('0x3c')]=_0x531743;return db['MailAccount'][_0xe6ed('0x5f')]({'where':{'id':_0x49d6b9[_0xe6ed('0x59')]['id']},'include':[{'model':db[_0xe6ed('0x5a')],'as':_0xe6ed('0x3b')},{'model':db[_0xe6ed('0x3e')],'as':_0xe6ed('0x3c')},{'model':db[_0xe6ed('0x3f')],'as':_0xe6ed('0x40')}]})[_0xe6ed('0x1f')](handleEntityNotFound(_0x45f1a9,null))[_0xe6ed('0x1f')](function(_0x446984){if(!_0x446984)throw new Error('Mail\x20Account\x20not\x20found');if(_0x446984[_0xe6ed('0x39')])delete _0x49d6b9[_0xe6ed('0x5d')][_0xe6ed('0x3b')];return _0x446984;})['then'](saveUpdates(_0x49d6b9[_0xe6ed('0x5d')],null))[_0xe6ed('0x1f')](function(_0x30006d){if(!_0x49d6b9[_0xe6ed('0x5d')][_0xe6ed('0x3b')])return _0x30006d;return db['MailServerIn']['update'](_0x49d6b9['body'][_0xe6ed('0x3b')],{'where':{'MailAccountId':_0x30006d['id']}})[_0xe6ed('0x1f')](function(){return _0x30006d;});})[_0xe6ed('0x1f')](function(_0x4a0bf4){if(!_0x49d6b9[_0xe6ed('0x5d')]['Smtp'])return _0x4a0bf4;return db[_0xe6ed('0x3e')][_0xe6ed('0x1e')](_0x49d6b9['body'][_0xe6ed('0x3c')],{'where':{'MailAccountId':_0x4a0bf4['id']}})['then'](function(){return _0x4a0bf4;});})[_0xe6ed('0x1f')](respondWithResult(_0x45f1a9,null))['catch'](handleError(_0x45f1a9,null));};exports[_0xe6ed('0x60')]=function(_0x375053,_0x2998ee){return db[_0xe6ed('0x41')][_0xe6ed('0x60')]()[_0xe6ed('0x1f')](respondWithResult(_0x2998ee,null))[_0xe6ed('0x14')](handleError(_0x2998ee,null));};exports['addDisposition']=function(_0x45a6bc,_0x473ca8){if(_0x45a6bc[_0xe6ed('0x5d')]['id']){delete _0x45a6bc[_0xe6ed('0x5d')]['id'];}return db['MailAccount'][_0xe6ed('0x5f')]({'where':{'id':_0x45a6bc['params']['id']}})['then'](handleEntityNotFound(_0x473ca8,null))[_0xe6ed('0x1f')](function(_0x5582a8){if(_0x5582a8){_0x45a6bc[_0xe6ed('0x5d')][_0xe6ed('0x61')]=_0x5582a8['id'];return db[_0xe6ed('0x62')][_0xe6ed('0x63')](_0x45a6bc['body']);}})['then'](respondWithResult(_0x473ca8,null))[_0xe6ed('0x14')](handleError(_0x473ca8,null));};exports[_0xe6ed('0x64')]=function(_0x403b83,_0x2c54d5){var _0x43419a={'raw':![],'where':{}};var _0x52b2fd={};var _0x1b535b={'count':0x0,'rows':[]};return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x403b83[_0xe6ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c54d5,null))[_0xe6ed('0x1f')](function(_0x27985f){if(_0x27985f){_0x52b2fd[_0xe6ed('0x46')]=_[_0xe6ed('0x48')](db[_0xe6ed('0x62')][_0xe6ed('0x42')]);_0x52b2fd[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x403b83[_0xe6ed('0x47')]);_0x52b2fd[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x52b2fd[_0xe6ed('0x46')],_0x52b2fd['query']);_0x43419a[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x52b2fd[_0xe6ed('0x46')],qs[_0xe6ed('0x4c')](_0x403b83['query'][_0xe6ed('0x4c')]));_0x43419a['attributes']=_0x43419a['attributes'][_0xe6ed('0x4d')]?_0x43419a[_0xe6ed('0x4a')]:_0x52b2fd[_0xe6ed('0x46')];if(!_0x403b83[_0xe6ed('0x47')][_0xe6ed('0x4e')](_0xe6ed('0x66'))){_0x43419a[_0xe6ed('0x1a')]=qs['limit'](_0x403b83[_0xe6ed('0x47')]['limit']);_0x43419a['offset']=qs[_0xe6ed('0x1c')](_0x403b83[_0xe6ed('0x47')][_0xe6ed('0x1c')]);}_0x43419a[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x403b83['query'][_0xe6ed('0x50')]);_0x43419a[_0xe6ed('0x51')]=qs['filters'](_[_0xe6ed('0x67')](_0x403b83['query'],_0x52b2fd[_0xe6ed('0x49')]));_0x43419a[_0xe6ed('0x51')]['MailAccountId']=_0x27985f['id'];if(_0x403b83['query'][_0xe6ed('0x52')]){_0x43419a['where']=_[_0xe6ed('0x53')](_0x43419a[_0xe6ed('0x51')],{'$or':_['map'](_0x43419a[_0xe6ed('0x4a')],function(_0x2bb791){var _0x134134={};_0x134134[_0x2bb791]={'$like':'%'+_0x403b83['query'][_0xe6ed('0x52')]+'%'};return _0x134134;})});}_0x43419a=_[_0xe6ed('0x53')]({},_0x43419a,_0x403b83[_0xe6ed('0x5c')]);return db[_0xe6ed('0x62')][_0xe6ed('0x1b')]({'where':_0x43419a[_0xe6ed('0x51')]})['then'](function(_0x109bd5){_0x1b535b[_0xe6ed('0x1b')]=_0x109bd5;if(_0x403b83[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x43419a['include']=[{'all':!![]}];}return db[_0xe6ed('0x62')]['findAll'](_0x43419a);})[_0xe6ed('0x1f')](function(_0x4a47b5){_0x1b535b[_0xe6ed('0x57')]=_0x4a47b5;return _0x1b535b;});}})[_0xe6ed('0x1f')](respondWithFilteredResult(_0x2c54d5,_0x43419a))['catch'](handleError(_0x2c54d5,null));};exports[_0xe6ed('0x68')]=function(_0x16b603,_0x3b2d21){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x16b603[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x3b2d21,null))[_0xe6ed('0x1f')](function(_0x160354){if(_0x160354){return _0x160354[_0xe6ed('0x68')](_0x16b603[_0xe6ed('0x47')][_0xe6ed('0x69')]);}})['then'](respondWithStatusCode(_0x3b2d21,null))[_0xe6ed('0x14')](handleError(_0x3b2d21,null));};exports[_0xe6ed('0x6a')]=function(_0x348398,_0x10ef69){if(_0x348398[_0xe6ed('0x5d')]['id']){delete _0x348398[_0xe6ed('0x5d')]['id'];}return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x348398[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x10ef69,null))[_0xe6ed('0x1f')](function(_0x37ad61){if(_0x37ad61){_0x348398['body'][_0xe6ed('0x61')]=_0x37ad61['id'];return db['CannedAnswer'][_0xe6ed('0x63')](_0x348398['body']);}})[_0xe6ed('0x1f')](respondWithResult(_0x10ef69,null))[_0xe6ed('0x14')](handleError(_0x10ef69,null));};exports['getAnswers']=function(_0x5285b2,_0x533090){var _0x4303fd={'raw':![],'where':{}};var _0x56b36a={};var _0x195a16={'count':0x0,'rows':[]};return db[_0xe6ed('0x41')]['findOne']({'where':{'id':_0x5285b2[_0xe6ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x533090,null))['then'](function(_0x5e6bda){if(_0x5e6bda){_0x56b36a['model']=_[_0xe6ed('0x48')](db['CannedAnswer'][_0xe6ed('0x42')]);_0x56b36a[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x5285b2[_0xe6ed('0x47')]);_0x56b36a[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x56b36a['model'],_0x56b36a[_0xe6ed('0x47')]);_0x4303fd[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x56b36a['model'],qs[_0xe6ed('0x4c')](_0x5285b2['query'][_0xe6ed('0x4c')]));_0x4303fd[_0xe6ed('0x4a')]=_0x4303fd[_0xe6ed('0x4a')][_0xe6ed('0x4d')]?_0x4303fd[_0xe6ed('0x4a')]:_0x56b36a[_0xe6ed('0x46')];if(!_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x4e')](_0xe6ed('0x66'))){_0x4303fd[_0xe6ed('0x1a')]=qs[_0xe6ed('0x1a')](_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x4303fd[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x5285b2[_0xe6ed('0x47')]['offset']);}_0x4303fd[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x50')]);_0x4303fd[_0xe6ed('0x51')]=qs[_0xe6ed('0x49')](_[_0xe6ed('0x67')](_0x5285b2[_0xe6ed('0x47')],_0x56b36a[_0xe6ed('0x49')]));_0x4303fd['where']['MailAccountId']=_0x5e6bda['id'];if(_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x4303fd[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x4303fd['where'],{'$or':_[_0xe6ed('0x6b')](_0x4303fd[_0xe6ed('0x4a')],function(_0x10db18){var _0x2d6614={};_0x2d6614[_0x10db18]={'$like':'%'+_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x2d6614;})});}_0x4303fd=_[_0xe6ed('0x53')]({},_0x4303fd,_0x5285b2['options']);return db[_0xe6ed('0x6c')][_0xe6ed('0x1b')]({'where':_0x4303fd[_0xe6ed('0x51')]})[_0xe6ed('0x1f')](function(_0x3e3b48){_0x195a16[_0xe6ed('0x1b')]=_0x3e3b48;if(_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x4303fd[_0xe6ed('0x5b')]=[{'all':!![]}];}return db[_0xe6ed('0x6c')][_0xe6ed('0x56')](_0x4303fd);})[_0xe6ed('0x1f')](function(_0x993809){_0x195a16[_0xe6ed('0x57')]=_0x993809;return _0x195a16;});}})['then'](respondWithFilteredResult(_0x533090,_0x4303fd))[_0xe6ed('0x14')](handleError(_0x533090,null));};exports[_0xe6ed('0x6d')]=function(_0x734dcc,_0x45bd7e){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x734dcc[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x45bd7e,null))[_0xe6ed('0x1f')](function(_0x3130cd){if(_0x3130cd){return _0x3130cd[_0xe6ed('0x6d')](_0x734dcc['query']['ids']);}})['then'](respondWithStatusCode(_0x45bd7e,null))[_0xe6ed('0x14')](handleError(_0x45bd7e,null));};exports['create']=function(_0x1ebb22,_0x1266db){var _0x13be06={'name':_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x25')],'key':_0x1ebb22['body'][_0xe6ed('0x45')],'provider':_0x1ebb22['body']['provider']===_0xe6ed('0x5e')?null:_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x6e')],'email':_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x6f')],'ListId':_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x70')],'active':!_[_0xe6ed('0x71')](_0x1ebb22['body'][_0xe6ed('0x72')])?_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x72')]:!![],'description':_0x1ebb22[_0xe6ed('0x5d')]['description']||null};var _0x591cab=getAuthenticationOptions(_0x13be06['provider'],_0x1ebb22['body']);_0x13be06['Imap']=_0x591cab[_0xe6ed('0x3b')];_0x13be06[_0xe6ed('0x3c')]=_0x591cab[_0xe6ed('0x3c')];return db['MailAccount'][_0xe6ed('0x63')](_0x13be06,{'include':[{'model':db[_0xe6ed('0x3e')],'as':'Smtp'},{'model':db[_0xe6ed('0x5a')],'as':_0xe6ed('0x3b')}]})[_0xe6ed('0x1f')](function(_0x2460b0){var _0x204be3=_0x1ebb22[_0xe6ed('0x30')][_0xe6ed('0x21')]({'plain':!![]});if(!_0x204be3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x204be3[_0xe6ed('0x73')]==='user'){var _0x181a3e=_0x2460b0[_0xe6ed('0x21')]({'plain':!![]});return db['UserProfileSection'][_0xe6ed('0x5f')]({'where':{'name':'MailAccounts','userProfileId':_0x204be3[_0xe6ed('0x74')]},'raw':!![]})[_0xe6ed('0x1f')](function(_0x1723c9){if(_0x1723c9&&_0x1723c9[_0xe6ed('0x75')]===0x0){return db[_0xe6ed('0x23')][_0xe6ed('0x63')]({'name':_0x181a3e['name'],'resourceId':_0x181a3e['id'],'type':_0x1723c9[_0xe6ed('0x25')],'sectionId':_0x1723c9['id']},{})[_0xe6ed('0x1f')](function(){return _0x2460b0;});}else{return _0x2460b0;}})[_0xe6ed('0x14')](function(_0x37cbb4){logger[_0xe6ed('0x10')](_0xe6ed('0x76'),_0x37cbb4);throw _0x37cbb4;});}return _0x2460b0;})['then'](respondWithResult(_0x1266db,0xc9))[_0xe6ed('0x14')](handleError(_0x1266db,null));};exports[_0xe6ed('0x77')]=function(_0x373f70,_0x1dbb1d){return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x373f70[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x1dbb1d,null))['then'](function(_0x239383){if(_0x239383){return _0x239383[_0xe6ed('0x77')]();}return null;})[_0xe6ed('0x1f')](respondWithResult(_0x1dbb1d,null))['catch'](handleError(_0x1dbb1d,null));};exports['addImap']=function(_0x51d188,_0xe8d4c){if(_0x51d188[_0xe6ed('0x5d')]['id']){delete _0x51d188[_0xe6ed('0x5d')]['id'];}return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x51d188['params']['id']}})['then'](handleEntityNotFound(_0xe8d4c,null))[_0xe6ed('0x1f')](function(_0x14c61e){if(_0x14c61e){_0x51d188[_0xe6ed('0x5d')][_0xe6ed('0x61')]=_0x14c61e['id'];return db[_0xe6ed('0x5a')][_0xe6ed('0x63')](_0x51d188[_0xe6ed('0x5d')]);}})[_0xe6ed('0x1f')](respondWithResult(_0xe8d4c,null))[_0xe6ed('0x14')](handleError(_0xe8d4c,null));};exports[_0xe6ed('0x78')]=function(_0x12c051,_0x507f70){return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x12c051[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x507f70,null))[_0xe6ed('0x1f')](function(_0x5a2047){if(_0x5a2047){return _0x5a2047['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x507f70,null))[_0xe6ed('0x14')](handleError(_0x507f70,null));};exports[_0xe6ed('0x79')]=function(_0x32085a,_0x40b884){return db[_0xe6ed('0x41')]['findOne']({'where':{'id':_0x32085a[_0xe6ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x40b884,null))[_0xe6ed('0x1f')](function(_0x420260){if(_0x420260){return _0x420260[_0xe6ed('0x79')]();}return null;})[_0xe6ed('0x1f')](respondWithResult(_0x40b884,null))[_0xe6ed('0x14')](handleError(_0x40b884,null));};exports[_0xe6ed('0x7a')]=function(_0x40de6c,_0x5fefdd){if(_0x40de6c[_0xe6ed('0x5d')]['id']){delete _0x40de6c['body']['id'];}return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x40de6c['params']['id']}})['then'](handleEntityNotFound(_0x5fefdd,null))[_0xe6ed('0x1f')](function(_0x1579ab){if(_0x1579ab){_0x40de6c['body'][_0xe6ed('0x61')]=_0x1579ab['id'];return db['MailServerOut']['create'](_0x40de6c[_0xe6ed('0x5d')]);}})[_0xe6ed('0x1f')](respondWithResult(_0x5fefdd,null))[_0xe6ed('0x14')](handleError(_0x5fefdd,null));};exports[_0xe6ed('0x7b')]=function(_0x5ddd7b,_0x5edd1d){return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x5ddd7b[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x5edd1d,null))[_0xe6ed('0x1f')](function(_0x4e91e9){if(_0x4e91e9){return _0x4e91e9[_0xe6ed('0x7c')](null);}return null;})[_0xe6ed('0x1f')](respondWithStatusCode(_0x5edd1d,null))['catch'](handleError(_0x5edd1d,null));};exports['addInteraction']=function(_0x11ef12,_0x2a4352){return db['MailInteraction'][_0xe6ed('0x5f')]({'where':{'id':_0x11ef12[_0xe6ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a4352,null))[_0xe6ed('0x1f')](function(_0x2f0955){if(_0x2f0955){return _0x2f0955[_0xe6ed('0x7d')](_0x11ef12['body']['ids'],_[_0xe6ed('0x7e')](_0x11ef12[_0xe6ed('0x5d')],[_0xe6ed('0x69'),'id'])||{});}})['then'](respondWithResult(_0x2a4352,null))[_0xe6ed('0x14')](handleError(_0x2a4352,null));};exports[_0xe6ed('0x7f')]=function(_0x3f23fe,_0x35cef5){var _0x39c04b={'raw':![],'where':{}};var _0x4b5979={};var _0x197bdc={'count':0x0,'rows':[]};return db['MailAccount'][_0xe6ed('0x65')]({'where':{'id':_0x3f23fe['params']['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x35cef5,null))[_0xe6ed('0x1f')](function(_0x326087){if(_0x326087){_0x4b5979[_0xe6ed('0x46')]=_['keys'](db[_0xe6ed('0x80')][_0xe6ed('0x42')]);_0x4b5979[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x3f23fe[_0xe6ed('0x47')]);_0x4b5979['filters']=_[_0xe6ed('0x4b')](_0x4b5979[_0xe6ed('0x46')],_0x4b5979['query']);_0x39c04b['attributes']=_['intersection'](_0x4b5979[_0xe6ed('0x46')],qs['fields'](_0x3f23fe[_0xe6ed('0x47')]['fields']));_0x39c04b[_0xe6ed('0x4a')]=_0x39c04b[_0xe6ed('0x4a')]['length']?_0x39c04b['attributes']:_0x4b5979[_0xe6ed('0x46')];if(!_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x4e')]('nolimit')){_0x39c04b[_0xe6ed('0x1a')]=qs[_0xe6ed('0x1a')](_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x39c04b[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x3f23fe[_0xe6ed('0x47')]['offset']);}_0x39c04b[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x3f23fe['query'][_0xe6ed('0x50')]);_0x39c04b['where']=qs[_0xe6ed('0x49')](_[_0xe6ed('0x67')](_0x3f23fe[_0xe6ed('0x47')],_0x4b5979['filters']));_0x39c04b[_0xe6ed('0x51')][_0xe6ed('0x61')]=_0x326087['id'];if(_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x39c04b['where']=_[_0xe6ed('0x53')](_0x39c04b['where'],{'$or':_['map'](_0x39c04b['attributes'],function(_0x2857a2){var _0x40af02={};_0x40af02[_0x2857a2]={'$like':'%'+_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x40af02;})});}_0x39c04b=_[_0xe6ed('0x53')]({},_0x39c04b,_0x3f23fe['options']);return db[_0xe6ed('0x80')]['count']({'where':_0x39c04b[_0xe6ed('0x51')]})[_0xe6ed('0x1f')](function(_0x579b54){_0x197bdc[_0xe6ed('0x1b')]=_0x579b54;if(_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x39c04b[_0xe6ed('0x5b')]=[{'model':db['CmContact'],'as':_0xe6ed('0x81'),'required':![]},{'model':db[_0xe6ed('0x82')],'as':_0xe6ed('0x83'),'attributes':[_0xe6ed('0x25'),_0xe6ed('0x84'),_0xe6ed('0x85')],'required':![]},{'model':db[_0xe6ed('0x86')],'as':_0xe6ed('0x87'),'attributes':['id',_0xe6ed('0x25'),_0xe6ed('0x88')],'where':_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x89')]?{'id':_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x89')]}:undefined,'required':_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x89')]?!![]:![]}];}return db[_0xe6ed('0x80')][_0xe6ed('0x56')](_0x39c04b);})[_0xe6ed('0x1f')](function(_0x415646){_0x197bdc['rows']=_0x415646;return _0x197bdc;});}})[_0xe6ed('0x1f')](respondWithFilteredResult(_0x35cef5,_0x39c04b))['catch'](handleError(_0x35cef5,null));};exports[_0xe6ed('0x8a')]=function addApplications(_0x3bcfd7,_0x4a7e0f){var _0x121a19=_0x3bcfd7['params']['id'];var _0x381299=_0x3bcfd7[_0xe6ed('0x5d')];var _0x3f4d02=0xc8;var _0x1ab4b4=null;return db[_0xe6ed('0x8b')][_0xe6ed('0x8c')]({'isolationLevel':db[_0xe6ed('0x8b')][_0xe6ed('0x8d')][_0xe6ed('0x8e')][_0xe6ed('0x8f')]},function(_0x35ffdd){return db[_0xe6ed('0x41')]['findOne']({'where':{'id':_0x121a19},'transaction':_0x35ffdd})[_0xe6ed('0x1f')](function(_0xa23e75){if(_0xa23e75){return db[_0xe6ed('0x90')][_0xe6ed('0x20')]({'where':{'MailAccountId':_0x121a19},'transaction':_0x35ffdd})['then'](function(){var _0x5a658f=_[_0xe6ed('0x6b')](_0x381299,function(_0x26c9c4){_0x26c9c4[_0xe6ed('0x61')]=_0x121a19;return _0x26c9c4;});return db[_0xe6ed('0x90')][_0xe6ed('0x91')](_0x5a658f,{'transaction':_0x35ffdd});});}else{_0x3f4d02=0x194;_0x1ab4b4=[];}});})[_0xe6ed('0x1f')](function(){if(_0x3f4d02!==0x194){return db[_0xe6ed('0x90')]['findAndCountAll']({'where':{'MailAccountId':_0x121a19},'order':_0xe6ed('0x92')})[_0xe6ed('0x1f')](function(_0x17fad2){_0x1ab4b4=_0x17fad2;});}})[_0xe6ed('0x14')](function(_0x1b6925){_0x3f4d02=0x1f4;logger[_0xe6ed('0x10')](_0x1b6925[_0xe6ed('0x24')]);if(_0x1b6925['name']){delete _0x1b6925['name'];}_0x1ab4b4=_0x1b6925;})[_0xe6ed('0x93')](function(){if(_0x1ab4b4===null){_0x4a7e0f[_0xe6ed('0x15')](_0x3f4d02);}else{if(_0x3f4d02===0x1f4){_0x4a7e0f['status'](_0x3f4d02)['send'](_0x1ab4b4);}else{_0x4a7e0f[_0xe6ed('0x16')](_0x3f4d02)['json'](_0x1ab4b4);}}});};exports[_0xe6ed('0x94')]=function(_0x280964,_0x505a5e){var _0x5e33bb={};var _0x1ab655={};var _0x281575;var _0x1e974c;return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x280964[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x505a5e,null))[_0xe6ed('0x1f')](function(_0x56f5a7){if(_0x56f5a7){_0x281575=_0x56f5a7;_0x1ab655[_0xe6ed('0x46')]=_[_0xe6ed('0x48')](db[_0xe6ed('0x90')][_0xe6ed('0x42')]);_0x1ab655[_0xe6ed('0x47')]=_['keys'](_0x280964[_0xe6ed('0x47')]);_0x1ab655[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x1ab655[_0xe6ed('0x46')],_0x1ab655['query']);_0x5e33bb[_0xe6ed('0x4a')]=_['intersection'](_0x1ab655['model'],qs['fields'](_0x280964[_0xe6ed('0x47')]['fields']));_0x5e33bb[_0xe6ed('0x4a')]=_0x5e33bb[_0xe6ed('0x4a')]['length']?_0x5e33bb[_0xe6ed('0x4a')]:_0x1ab655['model'];_0x5e33bb[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x280964[_0xe6ed('0x47')][_0xe6ed('0x50')]);_0x5e33bb[_0xe6ed('0x51')]=qs[_0xe6ed('0x49')](_[_0xe6ed('0x67')](_0x280964[_0xe6ed('0x47')],_0x1ab655[_0xe6ed('0x49')]));if(_0x280964[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x5e33bb[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x5e33bb[_0xe6ed('0x51')],{'$or':_[_0xe6ed('0x6b')](_0x5e33bb[_0xe6ed('0x4a')],function(_0x4bb4c0){var _0x150d8e={};_0x150d8e[_0x4bb4c0]={'$like':'%'+_0x280964['query']['filter']+'%'};return _0x150d8e;})});}_0x5e33bb=_['merge']({},_0x5e33bb,_0x280964[_0xe6ed('0x5c')]);return _0x281575[_0xe6ed('0x94')](_0x5e33bb);}})[_0xe6ed('0x1f')](function(_0x3356ac){if(_0x3356ac){_0x1e974c=_0x3356ac['length'];if(!_0x280964[_0xe6ed('0x47')][_0xe6ed('0x4e')](_0xe6ed('0x66'))){_0x5e33bb[_0xe6ed('0x1a')]=qs[_0xe6ed('0x1a')](_0x280964[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x5e33bb[_0xe6ed('0x1c')]=qs['offset'](_0x280964[_0xe6ed('0x47')][_0xe6ed('0x1c')]);}return _0x281575[_0xe6ed('0x94')](_0x5e33bb);}})[_0xe6ed('0x1f')](function(_0x14d7a8){if(_0x14d7a8){return _0x14d7a8?{'count':_0x1e974c,'rows':_0x14d7a8}:null;}})['then'](respondWithResult(_0x505a5e,null))[_0xe6ed('0x14')](handleError(_0x505a5e,null));};exports[_0xe6ed('0x95')]=function(_0x339f26,_0x172f84){var _0x133182={'raw':!![],'where':{}};var _0x22b898={};var _0x337cc2={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x339f26[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x172f84,null))['then'](function(_0x2723ef){if(_0x2723ef){_0x22b898['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x22b898[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x339f26[_0xe6ed('0x47')]);_0x22b898[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x22b898[_0xe6ed('0x46')],_0x22b898['query']);_0x133182[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x22b898[_0xe6ed('0x46')],qs['fields'](_0x339f26['query'][_0xe6ed('0x4c')]));_0x133182['attributes']=_0x133182[_0xe6ed('0x4a')][_0xe6ed('0x4d')]?_0x133182[_0xe6ed('0x4a')]:_0x22b898[_0xe6ed('0x46')];if(!_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x4e')](_0xe6ed('0x66'))){_0x133182['limit']=qs[_0xe6ed('0x1a')](_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x133182[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x339f26['query']['offset']);}_0x133182[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x50')]);_0x133182[_0xe6ed('0x51')]=qs['filters'](_[_0xe6ed('0x67')](_0x339f26['query'],_0x22b898['filters']));_0x133182[_0xe6ed('0x51')]['MailAccountId']=_0x2723ef['id'];if(_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x133182[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x133182[_0xe6ed('0x51')],{'$or':_[_0xe6ed('0x6b')](_0x133182[_0xe6ed('0x4a')],function(_0x449e72){var _0x2aedf9={};_0x2aedf9[_0x449e72]={'$like':'%'+_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x2aedf9;})});}if(_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x96')]){var _0x5c6a18=_0x339f26['query'][_0xe6ed('0x96')][_0xe6ed('0x97')](',');var _0xd12cf={};_0xd12cf[_0x5c6a18[0x0]]={'$gte':moment(_0x5c6a18[0x1])[_0xe6ed('0x98')](_0xe6ed('0x99'))};_0x133182[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x133182[_0xe6ed('0x51')],_0xd12cf);}_0x133182=_[_0xe6ed('0x53')]({},_0x133182,_0x339f26[_0xe6ed('0x5c')]);return db[_0xe6ed('0x9a')][_0xe6ed('0x1b')]({'where':_0x133182[_0xe6ed('0x51')]})[_0xe6ed('0x1f')](function(_0x5d86dc){_0x337cc2[_0xe6ed('0x1b')]=_0x5d86dc;if(_0x339f26['query'][_0xe6ed('0x55')]){_0x133182[_0xe6ed('0x5b')]=[{'all':!![]}];}return db[_0xe6ed('0x9a')][_0xe6ed('0x56')](_0x133182);})[_0xe6ed('0x1f')](function(_0x1f07c6){if(_0x339f26['query']['inlineCss']===_0xe6ed('0x9b')){for(var _0x112206=0x0;_0x112206<_0x1f07c6[_0xe6ed('0x4d')];_0x112206++){_0x1f07c6[_0x112206][_0xe6ed('0x5d')]=juice(_0x1f07c6[_0x112206][_0xe6ed('0x5d')]);}}_0x337cc2['rows']=_0x1f07c6;return _0x337cc2;});}})[_0xe6ed('0x1f')](respondWithFilteredResult(_0x172f84,_0x133182))[_0xe6ed('0x14')](handleError(_0x172f84,null));};exports[_0xe6ed('0x9c')]=function(_0x3e0d1a,_0x30ace4){var _0x2126d6,_0x4eca36={},_0xa2ec1e;if(_0x3e0d1a['body']['to']){_0xa2ec1e=_0x3e0d1a[_0xe6ed('0x5d')]['to'][_0xe6ed('0x97')](',')[0x0];}return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x3e0d1a[_0xe6ed('0x59')]['id']},'include':[{'model':db[_0xe6ed('0x9d')],'as':_0xe6ed('0x9e'),'include':[{'model':db[_0xe6ed('0x9f')],'as':_0xe6ed('0xa0'),'where':{'email':_0xa2ec1e},'limit':0x1,'order':[[_0xe6ed('0xa1'),_0xe6ed('0xa2')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe6ed('0xa3')],'as':_0xe6ed('0xa3'),'raw':!![]}]}]})[_0xe6ed('0x1f')](handleEntityNotFound(_0x30ace4,null))[_0xe6ed('0x1f')](function(_0x42f0f1){if(!_0x42f0f1)return;_0x2126d6=_0x42f0f1;if(!_0x42f0f1['Smtp'])throw new Error(_0xe6ed('0xa4'));if(_[_0xe6ed('0x71')](_0x3e0d1a[_0xe6ed('0x5d')][_0xe6ed('0xa5')])){_0x3e0d1a[_0xe6ed('0x5d')]['from']=util[_0xe6ed('0x98')]('%s\x20<%s>',_0x42f0f1[_0xe6ed('0x25')],_0x42f0f1[_0xe6ed('0x6f')]||_0x42f0f1[_0xe6ed('0x3c')][_0xe6ed('0x30')]);}if(_0x3e0d1a[_0xe6ed('0x5d')][_0xe6ed('0xa6')]&&_0x3e0d1a[_0xe6ed('0x5d')][_0xe6ed('0xa6')][_0xe6ed('0x4d')]){for(var _0x17ee2e=0x0;_0x17ee2e<_0x3e0d1a[_0xe6ed('0x5d')]['attachments'][_0xe6ed('0x4d')];_0x17ee2e+=0x1){_0x3e0d1a[_0xe6ed('0x5d')]['attachments'][_0x17ee2e]={'filename':_0x3e0d1a[_0xe6ed('0x5d')]['attachments'][_0x17ee2e][_0xe6ed('0x25')],'path':path['join'](config[_0xe6ed('0xa7')],'server/files/attachments',_0x3e0d1a[_0xe6ed('0x5d')]['attachments'][_0x17ee2e][_0xe6ed('0xa8')])};}}var _0x4759c4=_0x42f0f1[_0xe6ed('0xa9')]();return respondWithRpcPromise(_0xe6ed('0xaa'),_0xe6ed('0xab'),{'account':_0x4759c4,'message':_0x3e0d1a['body']});})[_0xe6ed('0x1f')](function(_0x401449){if(!_0x401449)return;_0x4eca36=_0x401449;if(!_0x2126d6[_0xe6ed('0x9e')])throw new Error(_0xe6ed('0xac'));if(_0x2126d6[_0xe6ed('0x9e')][_0xe6ed('0xa0')][_0xe6ed('0x4d')])return _0x2126d6[_0xe6ed('0x9e')][_0xe6ed('0xa0')][0x0];return db['CmContact'][_0xe6ed('0x63')](_['defaults'](_0x3e0d1a[_0xe6ed('0x5d')],{'firstName':_0x3e0d1a[_0xe6ed('0x5d')]['to'],'email':_0x3e0d1a['body']['to'],'phone':_0x3e0d1a[_0xe6ed('0x5d')]['to'],'ListId':_0x2126d6[_0xe6ed('0x70')]}));})[_0xe6ed('0x1f')](function(_0x41ee0f){if(!_0x41ee0f)return;var _0x4296b3={'UserId':_0x3e0d1a[_0xe6ed('0x30')]['id'],'ContactId':_0x41ee0f['id'],'MailAccountId':_0x2126d6['id'],'inReplyTo':_0x4eca36[_0xe6ed('0xad')],'to':_0x3e0d1a[_0xe6ed('0x5d')][_0xe6ed('0xa5')],'cc':_0x3e0d1a[_0xe6ed('0x5d')]['cc'],'subject':_0x3e0d1a[_0xe6ed('0x5d')]['subject'],'attach':_0x3e0d1a[_0xe6ed('0x5d')]['attach'],'firstMsgDirection':_0xe6ed('0xae'),'lastMsgAt':moment()[_0xe6ed('0x98')](_0xe6ed('0x99')),'lastMsgDirection':'out','Messages':[_[_0xe6ed('0x53')](_0x3e0d1a[_0xe6ed('0x5d')],{'messageId':_0x4eca36[_0xe6ed('0xad')],'sentAt':moment()['format'](_0xe6ed('0x99')),'read':!![],'MailAccountId':_0x2126d6['id'],'UserId':_0x3e0d1a[_0xe6ed('0x30')]['id'],'ContactId':_0x41ee0f['id']})]};if(_0x3e0d1a['body'][_0xe6ed('0xaf')]){_0x4296b3=_[_0xe6ed('0x53')](_0x4296b3,_0x3e0d1a['body'][_0xe6ed('0xaf')]);}return db['MailInteraction']['create'](_0x4296b3,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xe6ed('0x1f')](respondWithResult(_0x30ace4,null))[_0xe6ed('0x14')](handleError(_0x30ace4,null));};exports['verifySmtp']=function(_0x255c5a,_0x5e4c68){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x255c5a[_0xe6ed('0x59')]['id']},'include':[{'model':db[_0xe6ed('0x3e')],'as':_0xe6ed('0x3c'),'raw':!![],'include':[{'model':db[_0xe6ed('0xa3')],'as':_0xe6ed('0xa3'),'raw':!![]}]}]})[_0xe6ed('0x1f')](handleEntityNotFound(_0x5e4c68,null))[_0xe6ed('0x1f')](function(_0x4d3884){if(!_0x4d3884[_0xe6ed('0x3c')])return;var _0x40139f=_0x4d3884[_0xe6ed('0xa9')]();return respondWithRpcPromise(_0xe6ed('0xb0'),_0xe6ed('0xb1'),{'account':_0x40139f});})['then'](respondWithResult(_0x5e4c68,null))[_0xe6ed('0x14')](handleError(_0x5e4c68,null));};exports[_0xe6ed('0x20')]=function(_0x314f28,_0x48f620){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x314f28[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x48f620,null))[_0xe6ed('0x1f')](function(_0x5094c3){if(_0x5094c3&&_0x5094c3[_0xe6ed('0x39')]){throw new db[(_0xe6ed('0xb2'))][(_0xe6ed('0xb3'))](_0xe6ed('0xb4'));}return _0x5094c3;})[_0xe6ed('0x1f')](removeEntity(_0x48f620,null))[_0xe6ed('0x14')](handleError(_0x48f620,null));};exports[_0xe6ed('0xb5')]=function(_0xcffbd5,_0x171b86){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0xcffbd5[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x171b86,null))[_0xe6ed('0x1f')](function(_0x20d87c){if(_0x20d87c){return _0x20d87c[_0xe6ed('0xb5')](_0xcffbd5['body']['ids'],_[_0xe6ed('0x7e')](_0xcffbd5[_0xe6ed('0x5d')],[_0xe6ed('0x69'),'id'])||{})[_0xe6ed('0xb6')](function(_0x557478){for(var _0x89a7d0=0x0;_0x89a7d0<_0xcffbd5['body']['ids'][_0xe6ed('0x4d')];_0x89a7d0+=0x1){socket[_0xe6ed('0xb7')](_0xe6ed('0xb8'),{'UserId':Number(_0xcffbd5['body']['ids'][_0x89a7d0]),'MailAccountId':Number(_0xcffbd5[_0xe6ed('0x59')]['id'])});}return _0x557478;});}})[_0xe6ed('0x1f')](respondWithResult(_0x171b86,null))['catch'](handleError(_0x171b86,null));};exports[_0xe6ed('0xb9')]=function(_0x2c0a9d,_0x4caae3){return db['MailAccount'][_0xe6ed('0x5f')]({'where':{'id':_0x2c0a9d[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x4caae3,null))['then'](function(_0x5a076f){if(_0x5a076f){return _0x5a076f[_0xe6ed('0xb9')](_0x2c0a9d[_0xe6ed('0x47')]['ids'])[_0xe6ed('0x1f')](function(){if(_[_0xe6ed('0xba')](_0x2c0a9d['query'][_0xe6ed('0x69')])){for(var _0x13a40b=0x0;_0x13a40b<_0x2c0a9d[_0xe6ed('0x47')][_0xe6ed('0x69')][_0xe6ed('0x4d')];_0x13a40b+=0x1){socket[_0xe6ed('0xb7')](_0xe6ed('0xbb'),{'UserId':Number(_0x2c0a9d[_0xe6ed('0x47')]['ids'][_0x13a40b]),'MailAccountId':Number(_0x2c0a9d['params']['id'])});}}else{socket[_0xe6ed('0xb7')](_0xe6ed('0xbb'),{'UserId':Number(_0x2c0a9d['query'][_0xe6ed('0x69')]),'MailAccountId':Number(_0x2c0a9d[_0xe6ed('0x59')]['id'])});}});}})[_0xe6ed('0x1f')](respondWithStatusCode(_0x4caae3,null))['catch'](handleError(_0x4caae3,null));};exports[_0xe6ed('0xbc')]=function(_0x2ed9fe,_0x3a6d6c){var _0x3410dd={};var _0x2de0ee={};var _0xdd8c36;var _0x501dfc;return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x2ed9fe[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x3a6d6c,null))['then'](function(_0x232730){if(_0x232730){_0xdd8c36=_0x232730;_0x2de0ee[_0xe6ed('0x46')]=_['keys'](db['User'][_0xe6ed('0x42')]);_0x2de0ee[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x2ed9fe[_0xe6ed('0x47')]);_0x2de0ee[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x2de0ee[_0xe6ed('0x46')],_0x2de0ee[_0xe6ed('0x47')]);_0x3410dd[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x2de0ee['model'],qs[_0xe6ed('0x4c')](_0x2ed9fe['query'][_0xe6ed('0x4c')]));_0x3410dd[_0xe6ed('0x4a')]=_0x3410dd['attributes']['length']?_0x3410dd[_0xe6ed('0x4a')]:_0x2de0ee[_0xe6ed('0x46')];_0x3410dd[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x50')]);_0x3410dd['where']=qs['filters'](_[_0xe6ed('0x67')](_0x2ed9fe[_0xe6ed('0x47')],_0x2de0ee[_0xe6ed('0x49')]));if(_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x3410dd[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x3410dd[_0xe6ed('0x51')],{'$or':_[_0xe6ed('0x6b')](_0x3410dd[_0xe6ed('0x4a')],function(_0x549d25){var _0x5c0ea1={};_0x5c0ea1[_0x549d25]={'$like':'%'+_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x5c0ea1;})});}_0x3410dd=_[_0xe6ed('0x53')]({},_0x3410dd,_0x2ed9fe['options']);return _0xdd8c36[_0xe6ed('0xbc')](_0x3410dd);}})[_0xe6ed('0x1f')](function(_0x2d05e8){if(_0x2d05e8){_0x501dfc=_0x2d05e8[_0xe6ed('0x4d')];if(!_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x4e')]('nolimit')){_0x3410dd[_0xe6ed('0x1a')]=qs[_0xe6ed('0x1a')](_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x3410dd[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x1c')]);}return _0xdd8c36[_0xe6ed('0xbc')](_0x3410dd);}})[_0xe6ed('0x1f')](function(_0x21c48d){if(_0x21c48d){return _0x21c48d?{'count':_0x501dfc,'rows':_0x21c48d}:null;}})[_0xe6ed('0x1f')](respondWithResult(_0x3a6d6c,null))[_0xe6ed('0x14')](handleError(_0x3a6d6c,null));}; \ No newline at end of file +var _0xd6c8=['userMailAccount:remove','getAgents','moment','util','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','update','get','MailAccounts','UserProfileResource','end','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','rawAttributes','keys','include','find','body','provider','params','Mail\x20Account\x20not\x20found','MailServerIn','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','length','hasOwnProperty','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','json','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','basename','getSmtpOptions','SendMail','List','List\x20not\x20found','Contacts','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','destroy','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray'];(function(_0x14b24f,_0x23814c){var _0x5530fc=function(_0x1baa50){while(--_0x1baa50){_0x14b24f['push'](_0x14b24f['shift']());}};_0x5530fc(++_0x23814c);}(_0xd6c8,0x192));var _0x8d6c=function(_0x4d934b,_0x52f8e9){_0x4d934b=_0x4d934b-0x0;var _0xc0338b=_0xd6c8[_0x4d934b];return _0xc0338b;};'use strict';var moment=require(_0x8d6c('0x0'));var BPromise=require('bluebird');var util=require(_0x8d6c('0x1'));var path=require('path');var _=require(_0x8d6c('0x2'));var juice=require(_0x8d6c('0x3'));var Redis=require('ioredis');var qs=require(_0x8d6c('0x4'));var logger=require(_0x8d6c('0x5'))(_0x8d6c('0x6'));var config=require(_0x8d6c('0x7'));var db=require(_0x8d6c('0x8'))['db'];config[_0x8d6c('0x9')]=_[_0x8d6c('0xa')](config[_0x8d6c('0x9')],{'host':_0x8d6c('0xb'),'port':0x18eb});var socket=require(_0x8d6c('0xc'))(new Redis(config[_0x8d6c('0x9')]));require(_0x8d6c('0xd'))[_0x8d6c('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8d6c('0xf')][_0x8d6c('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x47a0a0,_0x2d3aae,_0x44c04a,_0x11ae81){return new BPromise(function(_0x4fdc9e,_0x340eba){var _0x588a90=_0x11ae81||client;return _0x588a90[_0x8d6c('0x11')](_0x47a0a0,_0x44c04a)[_0x8d6c('0x12')](function(_0x841fe2){logger['info'](_0x8d6c('0x13'),_0x2d3aae,_0x8d6c('0x14'));logger[_0x8d6c('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2d3aae,_0x8d6c('0x14'),JSON['stringify'](_0x841fe2));if(_0x841fe2[_0x8d6c('0x16')]){if(_0x841fe2[_0x8d6c('0x16')]['code']===0x1f4){logger['error'](_0x8d6c('0x13'),_0x2d3aae,_0x841fe2['error']['message']);return _0x340eba(_0x841fe2[_0x8d6c('0x16')][_0x8d6c('0x17')]);}logger[_0x8d6c('0x16')](_0x8d6c('0x13'),_0x2d3aae,_0x841fe2[_0x8d6c('0x16')]['message']);return _0x4fdc9e(_0x841fe2[_0x8d6c('0x16')][_0x8d6c('0x17')]);}else{logger[_0x8d6c('0x18')](_0x8d6c('0x13'),_0x2d3aae,_0x8d6c('0x14'));_0x4fdc9e(_0x841fe2[_0x8d6c('0x19')][_0x8d6c('0x17')]);}})[_0x8d6c('0x1a')](function(_0x430c94){logger[_0x8d6c('0x16')](_0x8d6c('0x13'),_0x2d3aae,_0x430c94);_0x340eba(_0x430c94);});});}function respondWithStatusCode(_0x49003b,_0x11c810){_0x11c810=_0x11c810||0xcc;return function(_0x511239){if(_0x511239){return _0x49003b[_0x8d6c('0x1b')](_0x11c810);}return _0x49003b[_0x8d6c('0x1c')](_0x11c810)['end']();};}function respondWithResult(_0x29c238,_0x46b5fe){_0x46b5fe=_0x46b5fe||0xc8;return function(_0x2f437d){if(_0x2f437d){return _0x29c238['status'](_0x46b5fe)['json'](_0x2f437d);}};}function respondWithFilteredResult(_0xc3038f,_0x5199eb){return function(_0x10e948){if(_0x10e948){var _0xf33860=typeof _0x5199eb[_0x8d6c('0x1d')]==='undefined'&&typeof _0x5199eb[_0x8d6c('0x1e')]===_0x8d6c('0x1f');var _0x3055de=_0x10e948[_0x8d6c('0x20')];var _0x287231=_0xf33860?0x0:_0x5199eb[_0x8d6c('0x1d')];var _0x5bfa4e=_0xf33860?_0x10e948[_0x8d6c('0x20')]:_0x5199eb[_0x8d6c('0x1d')]+_0x5199eb[_0x8d6c('0x1e')];var _0xd99c09;if(_0x5bfa4e>=_0x3055de){_0x5bfa4e=_0x3055de;_0xd99c09=0xc8;}else{_0xd99c09=0xce;}_0xc3038f[_0x8d6c('0x1c')](_0xd99c09);return _0xc3038f[_0x8d6c('0x21')](_0x8d6c('0x22'),_0x287231+'-'+_0x5bfa4e+'/'+_0x3055de)['json'](_0x10e948);}return null;};}function saveUpdates(_0x28c1c6){return function(_0x175098){if(_0x175098){return _0x175098[_0x8d6c('0x23')](_0x28c1c6)[_0x8d6c('0x12')](function(_0x5b5b90){return _0x5b5b90;});}return null;};}function removeEntity(_0x2a815b){return function(_0x2a243d){if(_0x2a243d){return _0x2a243d['destroy']()['then'](function(){var _0x33331f=_0x2a243d[_0x8d6c('0x24')]({'plain':!![]});var _0x58556a=_0x8d6c('0x25');return db[_0x8d6c('0x26')]['destroy']({'where':{'type':_0x58556a,'resourceId':_0x33331f['id']}})[_0x8d6c('0x12')](function(){return _0x2a243d;});})[_0x8d6c('0x12')](function(){_0x2a815b[_0x8d6c('0x1c')](0xcc)[_0x8d6c('0x27')]();});}};}function handleEntityNotFound(_0x3b2912){return function(_0x3f762b){if(!_0x3f762b){_0x3b2912[_0x8d6c('0x1b')](0x194);}return _0x3f762b;};}function handleError(_0x462635,_0x34177f){_0x34177f=_0x34177f||0x1f4;return function(_0x18eeb7){logger[_0x8d6c('0x16')](_0x18eeb7[_0x8d6c('0x28')]);if(_0x18eeb7[_0x8d6c('0x29')]){delete _0x18eeb7[_0x8d6c('0x29')];}_0x462635['status'](_0x34177f)[_0x8d6c('0x2a')](_0x18eeb7);};}function getImapHost(_0xf36378){switch(_0xf36378){case _0x8d6c('0x2b'):return _0x8d6c('0x2c');case _0x8d6c('0x2d'):return _0x8d6c('0x2e');case _0x8d6c('0x2f'):return _0x8d6c('0x30');case'outlook365':return'outlook.office365.com';}throw new Error(_0x8d6c('0x31'),_0xf36378);}function getSmtpHost(_0x5c3688){switch(_0x5c3688){case'gmail':return _0x8d6c('0x32');case'yahoo':return _0x8d6c('0x33');case _0x8d6c('0x2f'):return _0x8d6c('0x34');case'outlook365':return'smtp.office365.com';}throw new Error(_0x8d6c('0x31'),_0x5c3688);}function getAuthenticationOptions(_0x20739a,_0x20f112){var _0x2b9997={};var _0x265ca5={};if(_0x20739a){_0x2b9997[_0x8d6c('0x35')]=_0x265ca5[_0x8d6c('0x35')]=_0x20f112[_0x8d6c('0x36')];_0x2b9997[_0x8d6c('0x37')]=_0x265ca5['pass']=_0x20f112['password'];if(_0x20f112[_0x8d6c('0x38')]){_0x2b9997['modernAuthentication']=_0x265ca5['modernAuthentication']=!![];_0x2b9997[_0x8d6c('0x39')]=_0x265ca5[_0x8d6c('0x39')]=_0x20f112['CloudProviderId'];_0x2b9997[_0x8d6c('0x37')]=_0x265ca5[_0x8d6c('0x3a')]=null;}else{_0x2b9997[_0x8d6c('0x39')]=_0x265ca5[_0x8d6c('0x39')]=null;}_0x2b9997[_0x8d6c('0x3b')]=getImapHost(_0x20739a);_0x2b9997[_0x8d6c('0x3c')]=0x3e1;_0x265ca5[_0x8d6c('0x3b')]=getSmtpHost(_0x20739a);_0x265ca5['port']=0x24b;_0x265ca5[_0x8d6c('0x3d')]=![];_0x2b9997[_0x8d6c('0x3e')]=_0x265ca5[_0x8d6c('0x3e')]=null;}else{if(_0x20f112[_0x8d6c('0x3f')]){_0x2b9997['user']=_0x265ca5[_0x8d6c('0x35')]=_0x20f112[_0x8d6c('0x36')];_0x2b9997[_0x8d6c('0x37')]=_0x265ca5[_0x8d6c('0x3a')]=_0x20f112[_0x8d6c('0x37')];}else{_0x2b9997[_0x8d6c('0x3f')]=_0x265ca5[_0x8d6c('0x3f')]=![];_0x2b9997[_0x8d6c('0x35')]=_0x265ca5[_0x8d6c('0x35')]=null;_0x2b9997['password']=_0x265ca5['pass']=null;}_0x2b9997['host']=_0x20f112[_0x8d6c('0x40')][_0x8d6c('0x3b')];_0x2b9997[_0x8d6c('0x3c')]=_0x20f112[_0x8d6c('0x40')][_0x8d6c('0x3c')];_0x265ca5[_0x8d6c('0x3b')]=_0x20f112[_0x8d6c('0x41')]['host'];_0x265ca5['port']=_0x20f112[_0x8d6c('0x41')][_0x8d6c('0x3c')];}return{'Imap':_0x2b9997,'Smtp':_0x265ca5};}exports[_0x8d6c('0x42')]=function(_0x1abe81,_0x52a568){var _0x51e7a8={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x8d6c('0x43')],'as':_0x8d6c('0x41')},{'model':db[_0x8d6c('0x44')],'as':_0x8d6c('0x45')}]},_0x59223d={},_0x153115={'count':0x0,'rows':[]};var _0x249386=_[_0x8d6c('0x46')](db[_0x8d6c('0x47')]['rawAttributes'],function(_0x4503e9){return{'name':_0x4503e9['fieldName'],'type':_0x4503e9[_0x8d6c('0x48')][_0x8d6c('0x49')]};});_0x59223d[_0x8d6c('0x4a')]=_[_0x8d6c('0x46')](_0x249386,_0x8d6c('0x29'));_0x59223d[_0x8d6c('0x4b')]=_['keys'](_0x1abe81[_0x8d6c('0x4b')]);_0x59223d[_0x8d6c('0x4c')]=_[_0x8d6c('0x4d')](_0x59223d[_0x8d6c('0x4a')],_0x59223d[_0x8d6c('0x4b')]);_0x51e7a8[_0x8d6c('0x4e')]=_[_0x8d6c('0x4d')](_0x59223d['model'],qs[_0x8d6c('0x4f')](_0x1abe81[_0x8d6c('0x4b')][_0x8d6c('0x4f')]));_0x51e7a8['attributes']=_0x51e7a8['attributes']['length']?_0x51e7a8['attributes']:_0x59223d['model'];if(!_0x1abe81[_0x8d6c('0x4b')]['hasOwnProperty'](_0x8d6c('0x50'))){_0x51e7a8[_0x8d6c('0x1e')]=qs['limit'](_0x1abe81[_0x8d6c('0x4b')][_0x8d6c('0x1e')]);_0x51e7a8[_0x8d6c('0x1d')]=qs[_0x8d6c('0x1d')](_0x1abe81[_0x8d6c('0x4b')][_0x8d6c('0x1d')]);}_0x51e7a8['order']=qs[_0x8d6c('0x51')](_0x1abe81[_0x8d6c('0x4b')][_0x8d6c('0x51')]);_0x51e7a8[_0x8d6c('0x52')]=qs['filters'](_['pick'](_0x1abe81[_0x8d6c('0x4b')],_0x59223d[_0x8d6c('0x4c')]),_0x249386);if(_0x1abe81[_0x8d6c('0x4b')][_0x8d6c('0x53')]){_0x51e7a8[_0x8d6c('0x52')]=_['merge'](_0x51e7a8[_0x8d6c('0x52')],{'$or':_['map'](_0x249386,function(_0x419bce){if(_0x419bce[_0x8d6c('0x48')]!==_0x8d6c('0x54')){var _0x2ba688={};_0x2ba688[_0x419bce[_0x8d6c('0x29')]]={'$like':'%'+_0x1abe81[_0x8d6c('0x4b')][_0x8d6c('0x53')]+'%'};return _0x2ba688;}})});}_0x51e7a8=_[_0x8d6c('0x55')]({},_0x51e7a8,_0x1abe81[_0x8d6c('0x56')]);var _0x1df4fb={'where':_0x51e7a8[_0x8d6c('0x52')]};return db['MailAccount'][_0x8d6c('0x20')](_0x1df4fb)[_0x8d6c('0x12')](function(_0x2f8aab){_0x153115['count']=_0x2f8aab;if(_0x1abe81['query'][_0x8d6c('0x57')]){_0x51e7a8['include']=[{'all':!![]}];}return db['MailAccount'][_0x8d6c('0x58')](_0x51e7a8);})[_0x8d6c('0x12')](function(_0x2ce507){_0x153115[_0x8d6c('0x59')]=_0x2ce507;return _0x153115;})[_0x8d6c('0x12')](respondWithFilteredResult(_0x52a568,_0x51e7a8))[_0x8d6c('0x1a')](handleError(_0x52a568,null));};exports[_0x8d6c('0x5a')]=function(_0x34e59e,_0x43b237){var _0x5862ca={'raw':![],'where':{'id':_0x34e59e['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x8d6c('0x40')},{'model':db[_0x8d6c('0x43')],'as':_0x8d6c('0x41')},{'model':db[_0x8d6c('0x44')],'as':_0x8d6c('0x45')}]},_0xf02ec5={};_0xf02ec5['model']=_['keys'](db[_0x8d6c('0x47')][_0x8d6c('0x5b')]);_0xf02ec5['query']=_[_0x8d6c('0x5c')](_0x34e59e['query']);_0xf02ec5[_0x8d6c('0x4c')]=_[_0x8d6c('0x4d')](_0xf02ec5[_0x8d6c('0x4a')],_0xf02ec5[_0x8d6c('0x4b')]);_0x5862ca[_0x8d6c('0x4e')]=_['intersection'](_0xf02ec5[_0x8d6c('0x4a')],qs[_0x8d6c('0x4f')](_0x34e59e[_0x8d6c('0x4b')][_0x8d6c('0x4f')]));_0x5862ca[_0x8d6c('0x4e')]=_0x5862ca[_0x8d6c('0x4e')]['length']?_0x5862ca[_0x8d6c('0x4e')]:_0xf02ec5[_0x8d6c('0x4a')];if(_0x34e59e[_0x8d6c('0x4b')][_0x8d6c('0x57')]){_0x5862ca[_0x8d6c('0x5d')]=[{'all':!![]}];}_0x5862ca=_['merge']({},_0x5862ca,_0x34e59e[_0x8d6c('0x56')]);return db['MailAccount'][_0x8d6c('0x5e')](_0x5862ca)[_0x8d6c('0x12')](handleEntityNotFound(_0x43b237,null))[_0x8d6c('0x12')](respondWithResult(_0x43b237,null))[_0x8d6c('0x1a')](handleError(_0x43b237,null));};exports[_0x8d6c('0x23')]=function(_0x351bb1,_0x2122b6){if(_0x351bb1['body']['id']){delete _0x351bb1[_0x8d6c('0x5f')]['id'];}var _0x3a80d3=_0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x60')]==='custom'?null:_0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x60')];var _0xfaf6ea=_0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x40')]||{};var _0x3be46a=_0x351bb1[_0x8d6c('0x5f')]['Smtp']||{};if(_0x3a80d3){_0xfaf6ea[_0x8d6c('0x3b')]=getImapHost(_0x3a80d3);_0xfaf6ea[_0x8d6c('0x3c')]=0x3e1;_0x3be46a[_0x8d6c('0x3b')]=getSmtpHost(_0x3a80d3);_0x3be46a[_0x8d6c('0x3c')]=0x24b;_0x3be46a[_0x8d6c('0x3d')]=![];}if(_0x3be46a[_0x8d6c('0x38')]){_0x3be46a[_0x8d6c('0x3d')]=![];}else{_0x3be46a[_0x8d6c('0x39')]=null;}if(!_0xfaf6ea['modernAuthentication'])_0xfaf6ea[_0x8d6c('0x39')]=null;_0x351bb1[_0x8d6c('0x5f')]['Imap']=_0xfaf6ea;_0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x41')]=_0x3be46a;return db[_0x8d6c('0x47')][_0x8d6c('0x5e')]({'where':{'id':_0x351bb1[_0x8d6c('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x8d6c('0x40')},{'model':db[_0x8d6c('0x43')],'as':_0x8d6c('0x41')},{'model':db[_0x8d6c('0x44')],'as':_0x8d6c('0x45')}]})[_0x8d6c('0x12')](handleEntityNotFound(_0x2122b6,null))[_0x8d6c('0x12')](function(_0x244c4e){if(!_0x244c4e)throw new Error(_0x8d6c('0x62'));if(_0x244c4e[_0x8d6c('0x3e')])delete _0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x40')];return _0x244c4e;})['then'](saveUpdates(_0x351bb1['body'],null))['then'](function(_0x4d8f95){if(!_0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x40')])return _0x4d8f95;return db[_0x8d6c('0x63')][_0x8d6c('0x23')](_0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x40')],{'where':{'MailAccountId':_0x4d8f95['id']}})[_0x8d6c('0x12')](function(){return _0x4d8f95;});})['then'](function(_0x2ffb93){if(!_0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x41')])return _0x2ffb93;return db[_0x8d6c('0x43')][_0x8d6c('0x23')](_0x351bb1[_0x8d6c('0x5f')][_0x8d6c('0x41')],{'where':{'MailAccountId':_0x2ffb93['id']}})[_0x8d6c('0x12')](function(){return _0x2ffb93;});})['then'](respondWithResult(_0x2122b6,null))[_0x8d6c('0x1a')](handleError(_0x2122b6,null));};exports[_0x8d6c('0x64')]=function(_0x307625,_0x187e5d){return db[_0x8d6c('0x47')][_0x8d6c('0x64')]()[_0x8d6c('0x12')](respondWithResult(_0x187e5d,null))[_0x8d6c('0x1a')](handleError(_0x187e5d,null));};exports[_0x8d6c('0x65')]=function(_0x2e024f,_0x192332){if(_0x2e024f[_0x8d6c('0x5f')]['id']){delete _0x2e024f['body']['id'];}return db['MailAccount'][_0x8d6c('0x5e')]({'where':{'id':_0x2e024f[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x192332,null))['then'](function(_0xd0df05){if(_0xd0df05){_0x2e024f[_0x8d6c('0x5f')][_0x8d6c('0x66')]=_0xd0df05['id'];return db['Disposition'][_0x8d6c('0x67')](_0x2e024f[_0x8d6c('0x5f')]);}})[_0x8d6c('0x12')](respondWithResult(_0x192332,null))['catch'](handleError(_0x192332,null));};exports[_0x8d6c('0x68')]=function(_0x1e0049,_0x517ce8){var _0x82b17e={'raw':![],'where':{}};var _0x1a3a1f={};var _0x447cbc={'count':0x0,'rows':[]};return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x1e0049[_0x8d6c('0x61')]['id']}})['then'](handleEntityNotFound(_0x517ce8,null))[_0x8d6c('0x12')](function(_0x6ca3db){if(_0x6ca3db){_0x1a3a1f['model']=_[_0x8d6c('0x5c')](db[_0x8d6c('0x6a')][_0x8d6c('0x5b')]);_0x1a3a1f['query']=_[_0x8d6c('0x5c')](_0x1e0049[_0x8d6c('0x4b')]);_0x1a3a1f[_0x8d6c('0x4c')]=_['intersection'](_0x1a3a1f[_0x8d6c('0x4a')],_0x1a3a1f[_0x8d6c('0x4b')]);_0x82b17e[_0x8d6c('0x4e')]=_[_0x8d6c('0x4d')](_0x1a3a1f[_0x8d6c('0x4a')],qs[_0x8d6c('0x4f')](_0x1e0049[_0x8d6c('0x4b')]['fields']));_0x82b17e[_0x8d6c('0x4e')]=_0x82b17e['attributes'][_0x8d6c('0x6b')]?_0x82b17e[_0x8d6c('0x4e')]:_0x1a3a1f[_0x8d6c('0x4a')];if(!_0x1e0049[_0x8d6c('0x4b')][_0x8d6c('0x6c')](_0x8d6c('0x50'))){_0x82b17e[_0x8d6c('0x1e')]=qs[_0x8d6c('0x1e')](_0x1e0049[_0x8d6c('0x4b')][_0x8d6c('0x1e')]);_0x82b17e[_0x8d6c('0x1d')]=qs[_0x8d6c('0x1d')](_0x1e0049[_0x8d6c('0x4b')]['offset']);}_0x82b17e[_0x8d6c('0x6d')]=qs[_0x8d6c('0x51')](_0x1e0049[_0x8d6c('0x4b')]['sort']);_0x82b17e['where']=qs[_0x8d6c('0x4c')](_['pick'](_0x1e0049['query'],_0x1a3a1f[_0x8d6c('0x4c')]));_0x82b17e[_0x8d6c('0x52')][_0x8d6c('0x66')]=_0x6ca3db['id'];if(_0x1e0049['query'][_0x8d6c('0x53')]){_0x82b17e[_0x8d6c('0x52')]=_['merge'](_0x82b17e[_0x8d6c('0x52')],{'$or':_[_0x8d6c('0x46')](_0x82b17e[_0x8d6c('0x4e')],function(_0x500311){var _0x150c0b={};_0x150c0b[_0x500311]={'$like':'%'+_0x1e0049[_0x8d6c('0x4b')][_0x8d6c('0x53')]+'%'};return _0x150c0b;})});}_0x82b17e=_['merge']({},_0x82b17e,_0x1e0049[_0x8d6c('0x56')]);return db[_0x8d6c('0x6a')][_0x8d6c('0x20')]({'where':_0x82b17e[_0x8d6c('0x52')]})[_0x8d6c('0x12')](function(_0x16ea17){_0x447cbc[_0x8d6c('0x20')]=_0x16ea17;if(_0x1e0049[_0x8d6c('0x4b')][_0x8d6c('0x57')]){_0x82b17e['include']=[{'all':!![]}];}return db[_0x8d6c('0x6a')][_0x8d6c('0x58')](_0x82b17e);})[_0x8d6c('0x12')](function(_0x15e4b8){_0x447cbc[_0x8d6c('0x59')]=_0x15e4b8;return _0x447cbc;});}})[_0x8d6c('0x12')](respondWithFilteredResult(_0x517ce8,_0x82b17e))[_0x8d6c('0x1a')](handleError(_0x517ce8,null));};exports[_0x8d6c('0x6e')]=function(_0x3311a6,_0x4f6bcf){return db[_0x8d6c('0x47')]['find']({'where':{'id':_0x3311a6[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x4f6bcf,null))[_0x8d6c('0x12')](function(_0x55cb5e){if(_0x55cb5e){return _0x55cb5e[_0x8d6c('0x6e')](_0x3311a6[_0x8d6c('0x4b')]['ids']);}})[_0x8d6c('0x12')](respondWithStatusCode(_0x4f6bcf,null))[_0x8d6c('0x1a')](handleError(_0x4f6bcf,null));};exports[_0x8d6c('0x6f')]=function(_0x122ff2,_0x21b972){if(_0x122ff2[_0x8d6c('0x5f')]['id']){delete _0x122ff2[_0x8d6c('0x5f')]['id'];}return db[_0x8d6c('0x47')]['find']({'where':{'id':_0x122ff2[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x21b972,null))[_0x8d6c('0x12')](function(_0x159419){if(_0x159419){_0x122ff2[_0x8d6c('0x5f')][_0x8d6c('0x66')]=_0x159419['id'];return db[_0x8d6c('0x70')]['create'](_0x122ff2[_0x8d6c('0x5f')]);}})[_0x8d6c('0x12')](respondWithResult(_0x21b972,null))[_0x8d6c('0x1a')](handleError(_0x21b972,null));};exports[_0x8d6c('0x71')]=function(_0x63cf42,_0x5c6a4e){var _0x5b9573={'raw':![],'where':{}};var _0x137a34={};var _0x272c36={'count':0x0,'rows':[]};return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x63cf42[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x5c6a4e,null))[_0x8d6c('0x12')](function(_0x107d7a){if(_0x107d7a){_0x137a34[_0x8d6c('0x4a')]=_['keys'](db['CannedAnswer'][_0x8d6c('0x5b')]);_0x137a34[_0x8d6c('0x4b')]=_['keys'](_0x63cf42['query']);_0x137a34[_0x8d6c('0x4c')]=_[_0x8d6c('0x4d')](_0x137a34[_0x8d6c('0x4a')],_0x137a34[_0x8d6c('0x4b')]);_0x5b9573['attributes']=_[_0x8d6c('0x4d')](_0x137a34[_0x8d6c('0x4a')],qs['fields'](_0x63cf42[_0x8d6c('0x4b')]['fields']));_0x5b9573[_0x8d6c('0x4e')]=_0x5b9573[_0x8d6c('0x4e')]['length']?_0x5b9573[_0x8d6c('0x4e')]:_0x137a34[_0x8d6c('0x4a')];if(!_0x63cf42[_0x8d6c('0x4b')]['hasOwnProperty'](_0x8d6c('0x50'))){_0x5b9573['limit']=qs[_0x8d6c('0x1e')](_0x63cf42[_0x8d6c('0x4b')]['limit']);_0x5b9573[_0x8d6c('0x1d')]=qs[_0x8d6c('0x1d')](_0x63cf42['query'][_0x8d6c('0x1d')]);}_0x5b9573[_0x8d6c('0x6d')]=qs['sort'](_0x63cf42['query'][_0x8d6c('0x51')]);_0x5b9573[_0x8d6c('0x52')]=qs[_0x8d6c('0x4c')](_[_0x8d6c('0x72')](_0x63cf42[_0x8d6c('0x4b')],_0x137a34['filters']));_0x5b9573[_0x8d6c('0x52')][_0x8d6c('0x66')]=_0x107d7a['id'];if(_0x63cf42[_0x8d6c('0x4b')]['filter']){_0x5b9573['where']=_[_0x8d6c('0x55')](_0x5b9573['where'],{'$or':_['map'](_0x5b9573[_0x8d6c('0x4e')],function(_0x40e39c){var _0x1c85fb={};_0x1c85fb[_0x40e39c]={'$like':'%'+_0x63cf42[_0x8d6c('0x4b')][_0x8d6c('0x53')]+'%'};return _0x1c85fb;})});}_0x5b9573=_[_0x8d6c('0x55')]({},_0x5b9573,_0x63cf42[_0x8d6c('0x56')]);return db[_0x8d6c('0x70')][_0x8d6c('0x20')]({'where':_0x5b9573[_0x8d6c('0x52')]})[_0x8d6c('0x12')](function(_0x2ab35d){_0x272c36[_0x8d6c('0x20')]=_0x2ab35d;if(_0x63cf42[_0x8d6c('0x4b')][_0x8d6c('0x57')]){_0x5b9573[_0x8d6c('0x5d')]=[{'all':!![]}];}return db[_0x8d6c('0x70')][_0x8d6c('0x58')](_0x5b9573);})[_0x8d6c('0x12')](function(_0x4697ca){_0x272c36[_0x8d6c('0x59')]=_0x4697ca;return _0x272c36;});}})[_0x8d6c('0x12')](respondWithFilteredResult(_0x5c6a4e,_0x5b9573))[_0x8d6c('0x1a')](handleError(_0x5c6a4e,null));};exports[_0x8d6c('0x73')]=function(_0xa3f1a8,_0x57bdef){return db['MailAccount'][_0x8d6c('0x5e')]({'where':{'id':_0xa3f1a8[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x57bdef,null))[_0x8d6c('0x12')](function(_0x56ccd1){if(_0x56ccd1){return _0x56ccd1[_0x8d6c('0x73')](_0xa3f1a8[_0x8d6c('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x57bdef,null))[_0x8d6c('0x1a')](handleError(_0x57bdef,null));};exports['create']=function(_0x4a083b,_0x171a79){var _0x581e97={'name':_0x4a083b['body'][_0x8d6c('0x29')],'key':_0x4a083b['body'][_0x8d6c('0x49')],'provider':_0x4a083b[_0x8d6c('0x5f')][_0x8d6c('0x60')]===_0x8d6c('0x74')?null:_0x4a083b[_0x8d6c('0x5f')][_0x8d6c('0x60')],'email':_0x4a083b['body'][_0x8d6c('0x75')],'ListId':_0x4a083b[_0x8d6c('0x5f')][_0x8d6c('0x76')],'active':!_[_0x8d6c('0x77')](_0x4a083b['body'][_0x8d6c('0x78')])?_0x4a083b[_0x8d6c('0x5f')]['active']:!![],'description':_0x4a083b['body'][_0x8d6c('0x79')]||null};var _0x25a13c=getAuthenticationOptions(_0x581e97[_0x8d6c('0x60')],_0x4a083b[_0x8d6c('0x5f')]);_0x581e97[_0x8d6c('0x40')]=_0x25a13c[_0x8d6c('0x40')];_0x581e97[_0x8d6c('0x41')]=_0x25a13c[_0x8d6c('0x41')];return db[_0x8d6c('0x47')][_0x8d6c('0x67')](_0x581e97,{'include':[{'model':db[_0x8d6c('0x43')],'as':_0x8d6c('0x41')},{'model':db['MailServerIn'],'as':_0x8d6c('0x40')}]})['then'](function(_0x5bd755){var _0x1ffb83=_0x4a083b[_0x8d6c('0x35')]['get']({'plain':!![]});if(!_0x1ffb83)throw new Error(_0x8d6c('0x7a'));if(_0x1ffb83[_0x8d6c('0x7b')]===_0x8d6c('0x35')){var _0x2fbfcf=_0x5bd755[_0x8d6c('0x24')]({'plain':!![]});return db[_0x8d6c('0x7c')][_0x8d6c('0x5e')]({'where':{'name':'MailAccounts','userProfileId':_0x1ffb83[_0x8d6c('0x7d')]},'raw':!![]})['then'](function(_0x3b0c95){if(_0x3b0c95&&_0x3b0c95[_0x8d6c('0x7e')]===0x0){return db[_0x8d6c('0x26')][_0x8d6c('0x67')]({'name':_0x2fbfcf['name'],'resourceId':_0x2fbfcf['id'],'type':_0x3b0c95[_0x8d6c('0x29')],'sectionId':_0x3b0c95['id']},{})[_0x8d6c('0x12')](function(){return _0x5bd755;});}else{return _0x5bd755;}})['catch'](function(_0x6e377){logger[_0x8d6c('0x16')](_0x8d6c('0x7f'),_0x6e377);throw _0x6e377;});}return _0x5bd755;})['then'](respondWithResult(_0x171a79,0xc9))[_0x8d6c('0x1a')](handleError(_0x171a79,null));};exports[_0x8d6c('0x80')]=function(_0x2cd7d8,_0x499c3e){return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x2cd7d8[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x499c3e,null))[_0x8d6c('0x12')](function(_0x5174e7){if(_0x5174e7){return _0x5174e7['getImap']();}return null;})['then'](respondWithResult(_0x499c3e,null))['catch'](handleError(_0x499c3e,null));};exports['addImap']=function(_0x17c886,_0x2fbe31){if(_0x17c886[_0x8d6c('0x5f')]['id']){delete _0x17c886[_0x8d6c('0x5f')]['id'];}return db['MailAccount'][_0x8d6c('0x5e')]({'where':{'id':_0x17c886['params']['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x2fbe31,null))[_0x8d6c('0x12')](function(_0x1fa9b4){if(_0x1fa9b4){_0x17c886['body'][_0x8d6c('0x66')]=_0x1fa9b4['id'];return db[_0x8d6c('0x63')][_0x8d6c('0x67')](_0x17c886[_0x8d6c('0x5f')]);}})[_0x8d6c('0x12')](respondWithResult(_0x2fbe31,null))[_0x8d6c('0x1a')](handleError(_0x2fbe31,null));};exports[_0x8d6c('0x81')]=function(_0x42337e,_0x19919b){return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x42337e[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x19919b,null))[_0x8d6c('0x12')](function(_0x3b8443){if(_0x3b8443){return _0x3b8443[_0x8d6c('0x82')](null);}return null;})[_0x8d6c('0x12')](respondWithStatusCode(_0x19919b,null))['catch'](handleError(_0x19919b,null));};exports[_0x8d6c('0x83')]=function(_0x12c545,_0x27c2d0){return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x12c545[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x27c2d0,null))[_0x8d6c('0x12')](function(_0x571e2f){if(_0x571e2f){return _0x571e2f[_0x8d6c('0x83')]();}return null;})[_0x8d6c('0x12')](respondWithResult(_0x27c2d0,null))[_0x8d6c('0x1a')](handleError(_0x27c2d0,null));};exports[_0x8d6c('0x84')]=function(_0x399de3,_0x1b9e20){if(_0x399de3['body']['id']){delete _0x399de3['body']['id'];}return db[_0x8d6c('0x47')][_0x8d6c('0x5e')]({'where':{'id':_0x399de3[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x1b9e20,null))[_0x8d6c('0x12')](function(_0x164c7c){if(_0x164c7c){_0x399de3[_0x8d6c('0x5f')]['MailAccountId']=_0x164c7c['id'];return db[_0x8d6c('0x43')][_0x8d6c('0x67')](_0x399de3[_0x8d6c('0x5f')]);}})[_0x8d6c('0x12')](respondWithResult(_0x1b9e20,null))[_0x8d6c('0x1a')](handleError(_0x1b9e20,null));};exports[_0x8d6c('0x85')]=function(_0x4fbd09,_0x2114ae){return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x4fbd09['params']['id']}})['then'](handleEntityNotFound(_0x2114ae,null))[_0x8d6c('0x12')](function(_0x3ba4df){if(_0x3ba4df){return _0x3ba4df[_0x8d6c('0x86')](null);}return null;})[_0x8d6c('0x12')](respondWithStatusCode(_0x2114ae,null))['catch'](handleError(_0x2114ae,null));};exports[_0x8d6c('0x87')]=function(_0xa9b212,_0x3cf156){return db[_0x8d6c('0x88')]['find']({'where':{'id':_0xa9b212[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x3cf156,null))[_0x8d6c('0x12')](function(_0x45c5b1){if(_0x45c5b1){return _0x45c5b1['addInteraction'](_0xa9b212['body'][_0x8d6c('0x89')],_[_0x8d6c('0x8a')](_0xa9b212[_0x8d6c('0x5f')],[_0x8d6c('0x89'),'id'])||{});}})[_0x8d6c('0x12')](respondWithResult(_0x3cf156,null))[_0x8d6c('0x1a')](handleError(_0x3cf156,null));};exports[_0x8d6c('0x8b')]=function(_0x38681a,_0x2fe06b){var _0x11f2d9={'raw':![],'where':{}};var _0xb04ee2={};var _0x3c2667={'count':0x0,'rows':[]};return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x38681a['params']['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x2fe06b,null))[_0x8d6c('0x12')](function(_0x4ec544){if(_0x4ec544){_0xb04ee2[_0x8d6c('0x4a')]=_[_0x8d6c('0x5c')](db[_0x8d6c('0x88')]['rawAttributes']);_0xb04ee2[_0x8d6c('0x4b')]=_[_0x8d6c('0x5c')](_0x38681a[_0x8d6c('0x4b')]);_0xb04ee2[_0x8d6c('0x4c')]=_[_0x8d6c('0x4d')](_0xb04ee2[_0x8d6c('0x4a')],_0xb04ee2[_0x8d6c('0x4b')]);_0x11f2d9[_0x8d6c('0x4e')]=_[_0x8d6c('0x4d')](_0xb04ee2[_0x8d6c('0x4a')],qs[_0x8d6c('0x4f')](_0x38681a['query'][_0x8d6c('0x4f')]));_0x11f2d9[_0x8d6c('0x4e')]=_0x11f2d9['attributes'][_0x8d6c('0x6b')]?_0x11f2d9[_0x8d6c('0x4e')]:_0xb04ee2[_0x8d6c('0x4a')];if(!_0x38681a[_0x8d6c('0x4b')][_0x8d6c('0x6c')](_0x8d6c('0x50'))){_0x11f2d9[_0x8d6c('0x1e')]=qs[_0x8d6c('0x1e')](_0x38681a['query'][_0x8d6c('0x1e')]);_0x11f2d9[_0x8d6c('0x1d')]=qs['offset'](_0x38681a[_0x8d6c('0x4b')][_0x8d6c('0x1d')]);}_0x11f2d9['order']=qs[_0x8d6c('0x51')](_0x38681a['query'][_0x8d6c('0x51')]);_0x11f2d9['where']=qs[_0x8d6c('0x4c')](_[_0x8d6c('0x72')](_0x38681a[_0x8d6c('0x4b')],_0xb04ee2[_0x8d6c('0x4c')]));_0x11f2d9['where'][_0x8d6c('0x66')]=_0x4ec544['id'];if(_0x38681a[_0x8d6c('0x4b')][_0x8d6c('0x53')]){_0x11f2d9[_0x8d6c('0x52')]=_['merge'](_0x11f2d9[_0x8d6c('0x52')],{'$or':_[_0x8d6c('0x46')](_0x11f2d9['attributes'],function(_0x27a978){var _0x2b1877={};_0x2b1877[_0x27a978]={'$like':'%'+_0x38681a[_0x8d6c('0x4b')]['filter']+'%'};return _0x2b1877;})});}_0x11f2d9=_[_0x8d6c('0x55')]({},_0x11f2d9,_0x38681a[_0x8d6c('0x56')]);return db[_0x8d6c('0x88')][_0x8d6c('0x20')]({'where':_0x11f2d9[_0x8d6c('0x52')]})[_0x8d6c('0x12')](function(_0x492559){_0x3c2667['count']=_0x492559;if(_0x38681a['query'][_0x8d6c('0x57')]){_0x11f2d9[_0x8d6c('0x5d')]=[{'model':db[_0x8d6c('0x8c')],'as':'Contact','required':![]},{'model':db[_0x8d6c('0x8d')],'as':_0x8d6c('0x8e'),'attributes':[_0x8d6c('0x29'),_0x8d6c('0x8f'),_0x8d6c('0x90')],'required':![]},{'model':db[_0x8d6c('0x91')],'as':_0x8d6c('0x92'),'attributes':['id','name',_0x8d6c('0x93')],'where':_0x38681a[_0x8d6c('0x4b')][_0x8d6c('0x94')]?{'id':_0x38681a[_0x8d6c('0x4b')][_0x8d6c('0x94')]}:undefined,'required':_0x38681a[_0x8d6c('0x4b')][_0x8d6c('0x94')]?!![]:![]}];}return db[_0x8d6c('0x88')][_0x8d6c('0x58')](_0x11f2d9);})['then'](function(_0x1bf122){_0x3c2667[_0x8d6c('0x59')]=_0x1bf122;return _0x3c2667;});}})[_0x8d6c('0x12')](respondWithFilteredResult(_0x2fe06b,_0x11f2d9))[_0x8d6c('0x1a')](handleError(_0x2fe06b,null));};exports[_0x8d6c('0x95')]=function addApplications(_0x4cfe75,_0x24c406){var _0x79bb78=_0x4cfe75[_0x8d6c('0x61')]['id'];var _0x42d75a=_0x4cfe75[_0x8d6c('0x5f')];var _0xbbb41f=0xc8;var _0x265475=null;return db[_0x8d6c('0x96')][_0x8d6c('0x97')]({'isolationLevel':db[_0x8d6c('0x96')][_0x8d6c('0x98')][_0x8d6c('0x99')][_0x8d6c('0x9a')]},function(_0x1e0c17){return db['MailAccount'][_0x8d6c('0x69')]({'where':{'id':_0x79bb78},'transaction':_0x1e0c17})[_0x8d6c('0x12')](function(_0x46f52d){if(_0x46f52d){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x79bb78},'transaction':_0x1e0c17})[_0x8d6c('0x12')](function(){var _0x150379=_['map'](_0x42d75a,function(_0x203721){_0x203721['MailAccountId']=_0x79bb78;return _0x203721;});return db[_0x8d6c('0x9b')][_0x8d6c('0x9c')](_0x150379,{'transaction':_0x1e0c17});});}else{_0xbbb41f=0x194;_0x265475=[];}});})['then'](function(){if(_0xbbb41f!==0x194){return db['MailApplication'][_0x8d6c('0x9d')]({'where':{'MailAccountId':_0x79bb78},'order':'priority'})[_0x8d6c('0x12')](function(_0x3c584e){_0x265475=_0x3c584e;});}})['catch'](function(_0x56d950){_0xbbb41f=0x1f4;logger['error'](_0x56d950['stack']);if(_0x56d950[_0x8d6c('0x29')]){delete _0x56d950[_0x8d6c('0x29')];}_0x265475=_0x56d950;})[_0x8d6c('0x9e')](function(){if(_0x265475===null){_0x24c406[_0x8d6c('0x1b')](_0xbbb41f);}else{if(_0xbbb41f===0x1f4){_0x24c406['status'](_0xbbb41f)['send'](_0x265475);}else{_0x24c406[_0x8d6c('0x1c')](_0xbbb41f)[_0x8d6c('0x9f')](_0x265475);}}});};exports['getApplications']=function(_0x3d7afd,_0x1d330a){var _0x1dfb2a={};var _0x5bad42={};var _0x5d41f9;var _0x9f30ad;return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x3d7afd['params']['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x1d330a,null))[_0x8d6c('0x12')](function(_0xadc7e7){if(_0xadc7e7){_0x5d41f9=_0xadc7e7;_0x5bad42[_0x8d6c('0x4a')]=_[_0x8d6c('0x5c')](db[_0x8d6c('0x9b')][_0x8d6c('0x5b')]);_0x5bad42[_0x8d6c('0x4b')]=_[_0x8d6c('0x5c')](_0x3d7afd[_0x8d6c('0x4b')]);_0x5bad42[_0x8d6c('0x4c')]=_[_0x8d6c('0x4d')](_0x5bad42['model'],_0x5bad42[_0x8d6c('0x4b')]);_0x1dfb2a[_0x8d6c('0x4e')]=_['intersection'](_0x5bad42[_0x8d6c('0x4a')],qs[_0x8d6c('0x4f')](_0x3d7afd[_0x8d6c('0x4b')][_0x8d6c('0x4f')]));_0x1dfb2a['attributes']=_0x1dfb2a[_0x8d6c('0x4e')]['length']?_0x1dfb2a[_0x8d6c('0x4e')]:_0x5bad42[_0x8d6c('0x4a')];_0x1dfb2a[_0x8d6c('0x6d')]=qs[_0x8d6c('0x51')](_0x3d7afd[_0x8d6c('0x4b')][_0x8d6c('0x51')]);_0x1dfb2a[_0x8d6c('0x52')]=qs[_0x8d6c('0x4c')](_['pick'](_0x3d7afd['query'],_0x5bad42['filters']));if(_0x3d7afd[_0x8d6c('0x4b')][_0x8d6c('0x53')]){_0x1dfb2a[_0x8d6c('0x52')]=_[_0x8d6c('0x55')](_0x1dfb2a[_0x8d6c('0x52')],{'$or':_[_0x8d6c('0x46')](_0x1dfb2a[_0x8d6c('0x4e')],function(_0x492b72){var _0x2ea00b={};_0x2ea00b[_0x492b72]={'$like':'%'+_0x3d7afd[_0x8d6c('0x4b')][_0x8d6c('0x53')]+'%'};return _0x2ea00b;})});}_0x1dfb2a=_['merge']({},_0x1dfb2a,_0x3d7afd[_0x8d6c('0x56')]);return _0x5d41f9[_0x8d6c('0xa0')](_0x1dfb2a);}})[_0x8d6c('0x12')](function(_0x268d28){if(_0x268d28){_0x9f30ad=_0x268d28[_0x8d6c('0x6b')];if(!_0x3d7afd[_0x8d6c('0x4b')][_0x8d6c('0x6c')]('nolimit')){_0x1dfb2a[_0x8d6c('0x1e')]=qs[_0x8d6c('0x1e')](_0x3d7afd[_0x8d6c('0x4b')][_0x8d6c('0x1e')]);_0x1dfb2a[_0x8d6c('0x1d')]=qs['offset'](_0x3d7afd[_0x8d6c('0x4b')][_0x8d6c('0x1d')]);}return _0x5d41f9['getApplications'](_0x1dfb2a);}})[_0x8d6c('0x12')](function(_0x48c504){if(_0x48c504){return _0x48c504?{'count':_0x9f30ad,'rows':_0x48c504}:null;}})['then'](respondWithResult(_0x1d330a,null))['catch'](handleError(_0x1d330a,null));};exports[_0x8d6c('0xa1')]=function(_0x5de618,_0x346b93){var _0x3f59a8={'raw':!![],'where':{}};var _0x4397c0={};var _0x2d59fa={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5de618['params']['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x346b93,null))['then'](function(_0x295b9c){if(_0x295b9c){_0x4397c0[_0x8d6c('0x4a')]=_[_0x8d6c('0x5c')](db[_0x8d6c('0xa2')][_0x8d6c('0x5b')]);_0x4397c0[_0x8d6c('0x4b')]=_[_0x8d6c('0x5c')](_0x5de618[_0x8d6c('0x4b')]);_0x4397c0[_0x8d6c('0x4c')]=_[_0x8d6c('0x4d')](_0x4397c0[_0x8d6c('0x4a')],_0x4397c0[_0x8d6c('0x4b')]);_0x3f59a8['attributes']=_[_0x8d6c('0x4d')](_0x4397c0[_0x8d6c('0x4a')],qs['fields'](_0x5de618[_0x8d6c('0x4b')][_0x8d6c('0x4f')]));_0x3f59a8[_0x8d6c('0x4e')]=_0x3f59a8['attributes'][_0x8d6c('0x6b')]?_0x3f59a8[_0x8d6c('0x4e')]:_0x4397c0[_0x8d6c('0x4a')];if(!_0x5de618[_0x8d6c('0x4b')]['hasOwnProperty'](_0x8d6c('0x50'))){_0x3f59a8[_0x8d6c('0x1e')]=qs[_0x8d6c('0x1e')](_0x5de618[_0x8d6c('0x4b')]['limit']);_0x3f59a8['offset']=qs[_0x8d6c('0x1d')](_0x5de618[_0x8d6c('0x4b')][_0x8d6c('0x1d')]);}_0x3f59a8[_0x8d6c('0x6d')]=qs[_0x8d6c('0x51')](_0x5de618[_0x8d6c('0x4b')][_0x8d6c('0x51')]);_0x3f59a8[_0x8d6c('0x52')]=qs[_0x8d6c('0x4c')](_[_0x8d6c('0x72')](_0x5de618[_0x8d6c('0x4b')],_0x4397c0[_0x8d6c('0x4c')]));_0x3f59a8['where'][_0x8d6c('0x66')]=_0x295b9c['id'];if(_0x5de618[_0x8d6c('0x4b')][_0x8d6c('0x53')]){_0x3f59a8[_0x8d6c('0x52')]=_[_0x8d6c('0x55')](_0x3f59a8[_0x8d6c('0x52')],{'$or':_[_0x8d6c('0x46')](_0x3f59a8[_0x8d6c('0x4e')],function(_0x511279){var _0x446081={};_0x446081[_0x511279]={'$like':'%'+_0x5de618[_0x8d6c('0x4b')][_0x8d6c('0x53')]+'%'};return _0x446081;})});}if(_0x5de618[_0x8d6c('0x4b')]['$gte']){var _0x18bc0a=_0x5de618[_0x8d6c('0x4b')][_0x8d6c('0xa3')][_0x8d6c('0xa4')](',');var _0x42aa99={};_0x42aa99[_0x18bc0a[0x0]]={'$gte':moment(_0x18bc0a[0x1])[_0x8d6c('0xa5')](_0x8d6c('0xa6'))};_0x3f59a8[_0x8d6c('0x52')]=_[_0x8d6c('0x55')](_0x3f59a8[_0x8d6c('0x52')],_0x42aa99);}_0x3f59a8=_[_0x8d6c('0x55')]({},_0x3f59a8,_0x5de618[_0x8d6c('0x56')]);return db[_0x8d6c('0xa2')][_0x8d6c('0x20')]({'where':_0x3f59a8[_0x8d6c('0x52')]})[_0x8d6c('0x12')](function(_0x4e33f8){_0x2d59fa[_0x8d6c('0x20')]=_0x4e33f8;if(_0x5de618[_0x8d6c('0x4b')]['includeAll']){_0x3f59a8['include']=[{'all':!![]}];}return db[_0x8d6c('0xa2')][_0x8d6c('0x58')](_0x3f59a8);})[_0x8d6c('0x12')](function(_0x25e35b){if(_0x5de618[_0x8d6c('0x4b')][_0x8d6c('0xa7')]==='true'){for(var _0x3b1d5c=0x0;_0x3b1d5c<_0x25e35b[_0x8d6c('0x6b')];_0x3b1d5c++){_0x25e35b[_0x3b1d5c]['body']=juice(_0x25e35b[_0x3b1d5c][_0x8d6c('0x5f')]);}}_0x2d59fa[_0x8d6c('0x59')]=_0x25e35b;return _0x2d59fa;});}})[_0x8d6c('0x12')](respondWithFilteredResult(_0x346b93,_0x3f59a8))[_0x8d6c('0x1a')](handleError(_0x346b93,null));};exports['send']=function(_0x1ad39d,_0x167fba){var _0x29f328,_0x38ba6b={},_0xe8ce7d;if(_0x1ad39d['body']['to']){_0xe8ce7d=_0x1ad39d[_0x8d6c('0x5f')]['to'][_0x8d6c('0xa4')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x1ad39d[_0x8d6c('0x61')]['id']},'include':[{'model':db[_0x8d6c('0xa8')],'as':'List','include':[{'model':db[_0x8d6c('0x8c')],'as':'Contacts','where':{'email':_0xe8ce7d},'limit':0x1,'order':[['updatedAt',_0x8d6c('0xa9')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8d6c('0xaa')],'as':_0x8d6c('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x167fba,null))['then'](function(_0x1f61e3){if(!_0x1f61e3)return;_0x29f328=_0x1f61e3;if(!_0x1f61e3['Smtp'])throw new Error(_0x8d6c('0xab'));if(_[_0x8d6c('0x77')](_0x1ad39d[_0x8d6c('0x5f')][_0x8d6c('0xac')])){_0x1ad39d[_0x8d6c('0x5f')]['from']=util[_0x8d6c('0xa5')](_0x8d6c('0xad'),_0x1f61e3[_0x8d6c('0x29')],_0x1f61e3[_0x8d6c('0x75')]||_0x1f61e3[_0x8d6c('0x41')]['user']);}if(_0x1ad39d['body'][_0x8d6c('0xae')]&&_0x1ad39d['body'][_0x8d6c('0xae')][_0x8d6c('0x6b')]){for(var _0x1a3683=0x0;_0x1a3683<_0x1ad39d[_0x8d6c('0x5f')][_0x8d6c('0xae')]['length'];_0x1a3683+=0x1){_0x1ad39d[_0x8d6c('0x5f')][_0x8d6c('0xae')][_0x1a3683]={'filename':_0x1ad39d[_0x8d6c('0x5f')][_0x8d6c('0xae')][_0x1a3683][_0x8d6c('0x29')],'path':path['join'](config[_0x8d6c('0xaf')],'server/files/attachments',_0x1ad39d[_0x8d6c('0x5f')][_0x8d6c('0xae')][_0x1a3683][_0x8d6c('0xb0')])};}}var _0x16b84b=_0x1f61e3[_0x8d6c('0xb1')]();return respondWithRpcPromise(_0x8d6c('0xb2'),'sendMail',{'account':_0x16b84b,'message':_0x1ad39d[_0x8d6c('0x5f')]});})[_0x8d6c('0x12')](function(_0x2c3447){if(!_0x2c3447)return;_0x38ba6b=_0x2c3447;if(!_0x29f328[_0x8d6c('0xb3')])throw new Error(_0x8d6c('0xb4'));if(_0x29f328[_0x8d6c('0xb3')]['Contacts']['length'])return _0x29f328[_0x8d6c('0xb3')][_0x8d6c('0xb5')][0x0];return db[_0x8d6c('0x8c')][_0x8d6c('0x67')](_['defaults'](_0x1ad39d['body'],{'firstName':_0x1ad39d[_0x8d6c('0x5f')]['to'],'email':_0x1ad39d[_0x8d6c('0x5f')]['to'],'phone':_0x1ad39d[_0x8d6c('0x5f')]['to'],'ListId':_0x29f328[_0x8d6c('0x76')]}));})['then'](function(_0x840acc){if(!_0x840acc)return;var _0x1cff08={'UserId':_0x1ad39d['user']['id'],'ContactId':_0x840acc['id'],'MailAccountId':_0x29f328['id'],'inReplyTo':_0x38ba6b[_0x8d6c('0xb6')],'to':_0x1ad39d[_0x8d6c('0x5f')][_0x8d6c('0xac')],'cc':_0x1ad39d[_0x8d6c('0x5f')]['cc'],'subject':_0x1ad39d[_0x8d6c('0x5f')]['subject'],'attach':_0x1ad39d['body'][_0x8d6c('0xb7')],'firstMsgDirection':_0x8d6c('0xb8'),'lastMsgAt':moment()['format'](_0x8d6c('0xa6')),'lastMsgDirection':_0x8d6c('0xb8'),'Messages':[_[_0x8d6c('0x55')](_0x1ad39d['body'],{'messageId':_0x38ba6b['messageId'],'sentAt':moment()[_0x8d6c('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x29f328['id'],'UserId':_0x1ad39d[_0x8d6c('0x35')]['id'],'ContactId':_0x840acc['id']})]};if(_0x1ad39d[_0x8d6c('0x5f')][_0x8d6c('0xb9')]){_0x1cff08=_['merge'](_0x1cff08,_0x1ad39d[_0x8d6c('0x5f')][_0x8d6c('0xb9')]);}return db[_0x8d6c('0x88')]['create'](_0x1cff08,{'include':[{'model':db[_0x8d6c('0xa2')],'as':_0x8d6c('0xba')}]});})[_0x8d6c('0x12')](respondWithResult(_0x167fba,null))[_0x8d6c('0x1a')](handleError(_0x167fba,null));};exports[_0x8d6c('0xbb')]=function(_0x333b28,_0x5ae2c4){return db[_0x8d6c('0x47')][_0x8d6c('0x5e')]({'where':{'id':_0x333b28[_0x8d6c('0x61')]['id']},'include':[{'model':db[_0x8d6c('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8d6c('0xaa'),'raw':!![]}]}]})[_0x8d6c('0x12')](handleEntityNotFound(_0x5ae2c4,null))[_0x8d6c('0x12')](function(_0x40810b){if(!_0x40810b[_0x8d6c('0x41')])return;var _0x5c1323=_0x40810b[_0x8d6c('0xb1')]();return respondWithRpcPromise(_0x8d6c('0xbc'),_0x8d6c('0xbb'),{'account':_0x5c1323});})['then'](respondWithResult(_0x5ae2c4,null))['catch'](handleError(_0x5ae2c4,null));};exports[_0x8d6c('0xbd')]=function(_0x29ed36,_0x3ad506){return db[_0x8d6c('0x47')]['find']({'where':{'id':_0x29ed36[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x3ad506,null))[_0x8d6c('0x12')](function(_0x142ccc){if(_0x142ccc&&_0x142ccc[_0x8d6c('0x3e')]){throw new db['Sequelize'][(_0x8d6c('0xbe'))](_0x8d6c('0xbf'));}return _0x142ccc;})[_0x8d6c('0x12')](removeEntity(_0x3ad506,null))[_0x8d6c('0x1a')](handleError(_0x3ad506,null));};exports[_0x8d6c('0xc0')]=function(_0x280ce2,_0x2216e1){return db[_0x8d6c('0x47')][_0x8d6c('0x5e')]({'where':{'id':_0x280ce2['params']['id']}})['then'](handleEntityNotFound(_0x2216e1,null))['then'](function(_0x545da2){if(_0x545da2){return _0x545da2['addAgents'](_0x280ce2[_0x8d6c('0x5f')]['ids'],_[_0x8d6c('0x8a')](_0x280ce2[_0x8d6c('0x5f')],[_0x8d6c('0x89'),'id'])||{})[_0x8d6c('0xc1')](function(_0x3e1336){for(var _0x3a61e0=0x0;_0x3a61e0<_0x280ce2['body'][_0x8d6c('0x89')][_0x8d6c('0x6b')];_0x3a61e0+=0x1){socket[_0x8d6c('0xc2')](_0x8d6c('0xc3'),{'UserId':Number(_0x280ce2['body'][_0x8d6c('0x89')][_0x3a61e0]),'MailAccountId':Number(_0x280ce2[_0x8d6c('0x61')]['id'])});}return _0x3e1336;});}})[_0x8d6c('0x12')](respondWithResult(_0x2216e1,null))['catch'](handleError(_0x2216e1,null));};exports[_0x8d6c('0xc4')]=function(_0x25e4f7,_0x31d514){return db[_0x8d6c('0x47')][_0x8d6c('0x5e')]({'where':{'id':_0x25e4f7[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x31d514,null))[_0x8d6c('0x12')](function(_0xd3cc53){if(_0xd3cc53){return _0xd3cc53[_0x8d6c('0xc4')](_0x25e4f7[_0x8d6c('0x4b')][_0x8d6c('0x89')])[_0x8d6c('0x12')](function(){if(_[_0x8d6c('0xc5')](_0x25e4f7[_0x8d6c('0x4b')][_0x8d6c('0x89')])){for(var _0x2290b0=0x0;_0x2290b0<_0x25e4f7[_0x8d6c('0x4b')]['ids'][_0x8d6c('0x6b')];_0x2290b0+=0x1){socket[_0x8d6c('0xc2')](_0x8d6c('0xc6'),{'UserId':Number(_0x25e4f7[_0x8d6c('0x4b')][_0x8d6c('0x89')][_0x2290b0]),'MailAccountId':Number(_0x25e4f7[_0x8d6c('0x61')]['id'])});}}else{socket[_0x8d6c('0xc2')](_0x8d6c('0xc6'),{'UserId':Number(_0x25e4f7[_0x8d6c('0x4b')]['ids']),'MailAccountId':Number(_0x25e4f7['params']['id'])});}});}})[_0x8d6c('0x12')](respondWithStatusCode(_0x31d514,null))[_0x8d6c('0x1a')](handleError(_0x31d514,null));};exports[_0x8d6c('0xc7')]=function(_0x341fb5,_0x1160e4){var _0x5688f2={};var _0x428847={};var _0x3c3148;var _0x4b6564;return db[_0x8d6c('0x47')][_0x8d6c('0x69')]({'where':{'id':_0x341fb5[_0x8d6c('0x61')]['id']}})[_0x8d6c('0x12')](handleEntityNotFound(_0x1160e4,null))[_0x8d6c('0x12')](function(_0x5f246){if(_0x5f246){_0x3c3148=_0x5f246;_0x428847[_0x8d6c('0x4a')]=_[_0x8d6c('0x5c')](db[_0x8d6c('0x8d')][_0x8d6c('0x5b')]);_0x428847[_0x8d6c('0x4b')]=_[_0x8d6c('0x5c')](_0x341fb5[_0x8d6c('0x4b')]);_0x428847[_0x8d6c('0x4c')]=_[_0x8d6c('0x4d')](_0x428847['model'],_0x428847[_0x8d6c('0x4b')]);_0x5688f2[_0x8d6c('0x4e')]=_[_0x8d6c('0x4d')](_0x428847[_0x8d6c('0x4a')],qs[_0x8d6c('0x4f')](_0x341fb5[_0x8d6c('0x4b')][_0x8d6c('0x4f')]));_0x5688f2['attributes']=_0x5688f2['attributes'][_0x8d6c('0x6b')]?_0x5688f2['attributes']:_0x428847[_0x8d6c('0x4a')];_0x5688f2[_0x8d6c('0x6d')]=qs['sort'](_0x341fb5[_0x8d6c('0x4b')][_0x8d6c('0x51')]);_0x5688f2[_0x8d6c('0x52')]=qs[_0x8d6c('0x4c')](_['pick'](_0x341fb5[_0x8d6c('0x4b')],_0x428847[_0x8d6c('0x4c')]));if(_0x341fb5[_0x8d6c('0x4b')][_0x8d6c('0x53')]){_0x5688f2[_0x8d6c('0x52')]=_[_0x8d6c('0x55')](_0x5688f2[_0x8d6c('0x52')],{'$or':_['map'](_0x5688f2[_0x8d6c('0x4e')],function(_0x175f89){var _0x3c188e={};_0x3c188e[_0x175f89]={'$like':'%'+_0x341fb5[_0x8d6c('0x4b')]['filter']+'%'};return _0x3c188e;})});}_0x5688f2=_['merge']({},_0x5688f2,_0x341fb5[_0x8d6c('0x56')]);return _0x3c3148[_0x8d6c('0xc7')](_0x5688f2);}})[_0x8d6c('0x12')](function(_0x3ca620){if(_0x3ca620){_0x4b6564=_0x3ca620[_0x8d6c('0x6b')];if(!_0x341fb5[_0x8d6c('0x4b')][_0x8d6c('0x6c')]('nolimit')){_0x5688f2['limit']=qs['limit'](_0x341fb5[_0x8d6c('0x4b')][_0x8d6c('0x1e')]);_0x5688f2[_0x8d6c('0x1d')]=qs[_0x8d6c('0x1d')](_0x341fb5[_0x8d6c('0x4b')][_0x8d6c('0x1d')]);}return _0x3c3148[_0x8d6c('0xc7')](_0x5688f2);}})['then'](function(_0x2b1ee0){if(_0x2b1ee0){return _0x2b1ee0?{'count':_0x4b6564,'rows':_0x2b1ee0}:null;}})[_0x8d6c('0x12')](respondWithResult(_0x1160e4,null))[_0x8d6c('0x1a')](handleError(_0x1160e4,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index f897bdc..ed2ac6c 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 _0xac6a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','remove'];(function(_0x5a4526,_0x521684){var _0x4d5f94=function(_0x240bd6){while(--_0x240bd6){_0x5a4526['push'](_0x5a4526['shift']());}};_0x4d5f94(++_0x521684);}(_0xac6a,0xc2));var _0xaac6=function(_0x5f2241,_0x14a83f){_0x5f2241=_0x5f2241-0x0;var _0x4f01c2=_0xac6a[_0x5f2241];return _0x4f01c2;};'use strict';var EventEmitter=require(_0xaac6('0x0'));var MailAccount=require(_0xaac6('0x1'))['db'][_0xaac6('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xaac6('0x3')](0x0);var events={'afterCreate':_0xaac6('0x4'),'afterUpdate':'update','afterDestroy':_0xaac6('0x5')};function emitEvent(_0x4c0cf4){return function(_0x9dc043,_0x1a0d76,_0x44259b){MailAccountEvents[_0xaac6('0x6')](_0x4c0cf4+':'+_0x9dc043['id'],_0x9dc043);MailAccountEvents[_0xaac6('0x6')](_0x4c0cf4,_0x9dc043);_0x44259b(null);};}for(var e in events){if(events[_0xaac6('0x7')](e)){var event=events[e];MailAccount[_0xaac6('0x8')](e,emitEvent(event));}}module[_0xaac6('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x7804=['hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save','remove'];(function(_0x1279c,_0xd5f320){var _0x2dee82=function(_0x1c286b){while(--_0x1c286b){_0x1279c['push'](_0x1279c['shift']());}};_0x2dee82(++_0xd5f320);}(_0x7804,0xc3));var _0x4780=function(_0x44b2f0,_0x3d90c1){_0x44b2f0=_0x44b2f0-0x0;var _0x13d6d9=_0x7804[_0x44b2f0];return _0x13d6d9;};'use strict';var EventEmitter=require(_0x4780('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x4780('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4780('0x2')](0x0);var events={'afterCreate':_0x4780('0x3'),'afterUpdate':'update','afterDestroy':_0x4780('0x4')};function emitEvent(_0xf88f45){return function(_0x5bf1d7,_0x50f186,_0x20f86d){MailAccountEvents['emit'](_0xf88f45+':'+_0x5bf1d7['id'],_0x5bf1d7);MailAccountEvents['emit'](_0xf88f45,_0x5bf1d7);_0x20f86d(null);};}for(var e in events){if(events[_0x4780('0x5')](e)){var event=events[e];MailAccount[_0x4780('0x6')](e,emitEvent(event));}}module[_0x4780('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 972ab5e..2e97a5d 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 _0x67d7=['define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','auth','user','data5','pass','./mailAccount.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67d7,0x1c6));var _0x767d=function(_0x34dc5d,_0x351b12){_0x34dc5d=_0x34dc5d-0x0;var _0x3f5ab1=_0x67d7[_0x34dc5d];return _0x3f5ab1;};'use strict';var attributes=require(_0x767d('0x0'));module[_0x767d('0x1')]=function(_0x1b2c8b){return _0x1b2c8b[_0x767d('0x2')](_0x767d('0x3'),attributes,{'tableName':_0x767d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x127045=this;var _0x3538d0={'id':_0x127045['id'],'tls':{'rejectUnauthorized':![]}};if(_0x127045[_0x767d('0x5')]!==_0x767d('0x6')){_0x3538d0[_0x767d('0x7')]=_0x127045[_0x767d('0x5')];}else{_0x3538d0[_0x767d('0x8')]=_0x127045[_0x767d('0x9')]['host'];_0x3538d0[_0x767d('0xa')]=_0x127045[_0x767d('0x9')][_0x767d('0xa')];_0x3538d0[_0x767d('0xb')]=_0x127045['Smtp'][_0x767d('0xb')];}if(_0x127045['Smtp'][_0x767d('0xc')]){if(_0x127045[_0x767d('0x9')][_0x767d('0xd')]){if(!_0x127045[_0x767d('0x9')][_0x767d('0xe')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x3538d0[_0x767d('0xf')]={'type':'OAuth2','user':_0x127045[_0x767d('0x9')][_0x767d('0x10')],'accessToken':_0x127045['Smtp'][_0x767d('0xe')][_0x767d('0x11')]};}else{_0x3538d0[_0x767d('0xf')]={'user':_0x127045[_0x767d('0x9')][_0x767d('0x10')],'pass':_0x127045[_0x767d('0x9')][_0x767d('0x12')]};}}return _0x3538d0;}}});}; \ No newline at end of file +var _0x618b=['pass','./mailAccount.attributes','exports','define','provider','custom','service','Smtp','host','port','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','auth','user'];(function(_0x5b519e,_0x276cbf){var _0x4d38fc=function(_0x503bbe){while(--_0x503bbe){_0x5b519e['push'](_0x5b519e['shift']());}};_0x4d38fc(++_0x276cbf);}(_0x618b,0x1bb));var _0xb618=function(_0x599ad,_0x287761){_0x599ad=_0x599ad-0x0;var _0x56e9d5=_0x618b[_0x599ad];return _0x56e9d5;};'use strict';var attributes=require(_0xb618('0x0'));module[_0xb618('0x1')]=function(_0x4558bf){return _0x4558bf[_0xb618('0x2')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x8d454=this;var _0x4528e7={'id':_0x8d454['id'],'tls':{'rejectUnauthorized':![]}};if(_0x8d454[_0xb618('0x3')]!==_0xb618('0x4')){_0x4528e7[_0xb618('0x5')]=_0x8d454[_0xb618('0x3')];}else{_0x4528e7['host']=_0x8d454[_0xb618('0x6')][_0xb618('0x7')];_0x4528e7[_0xb618('0x8')]=_0x8d454[_0xb618('0x6')]['port'];_0x4528e7['secure']=_0x8d454[_0xb618('0x6')]['secure'];}if(_0x8d454['Smtp'][_0xb618('0x9')]){if(_0x8d454[_0xb618('0x6')][_0xb618('0xa')]){if(!_0x8d454[_0xb618('0x6')][_0xb618('0xb')])throw new Error(_0xb618('0xc'));_0x4528e7['auth']={'type':_0xb618('0xd'),'user':_0x8d454['Smtp']['user'],'accessToken':_0x8d454[_0xb618('0x6')][_0xb618('0xb')]['data5']};}else{_0x4528e7[_0xb618('0xe')]={'user':_0x8d454[_0xb618('0x6')][_0xb618('0xf')],'pass':_0x8d454['Smtp'][_0xb618('0x10')]};}}return _0x4528e7;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d3c9392..624b381 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 _0x4006=['MailInteraction','update','format','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','queue','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailAccount','findAll','options','raw','where','include','map','model','attributes','GetMailAccount','ShowMailAccount','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','Applications','MailServerOut','Smtp','CloudProvider','get','omit','smtpOptions','list','applications','orderBy','priority','autoclose','push','length','defaults','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo'];(function(_0x539665,_0x2e21eb){var _0xd709b5=function(_0x2f7583){while(--_0x2f7583){_0x539665['push'](_0x539665['shift']());}};_0xd709b5(++_0x2e21eb);}(_0x4006,0x1c7));var _0x6400=function(_0x544d17,_0x2672ea){_0x544d17=_0x544d17-0x0;var _0x5e5fcc=_0x4006[_0x544d17];return _0x5e5fcc;};'use strict';var _=require('lodash');var moment=require(_0x6400('0x0'));var BPromise=require(_0x6400('0x1'));var rs=require(_0x6400('0x2'));var Redis=require(_0x6400('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x6400('0x4'));var config=require('../../config/environment');var jayson=require(_0x6400('0x5'));var client=jayson['client']['http']({'port':0x232c});config[_0x6400('0x6')]=_['defaults'](config[_0x6400('0x6')],{'host':_0x6400('0x7'),'port':0x18eb});var socket=require(_0x6400('0x8'))(new Redis(config[_0x6400('0x6')]));require('./mailAccount.socket')[_0x6400('0x9')](socket);function respondWithRpcPromise(_0x46819e,_0x31a8d0,_0x356982){return new BPromise(function(_0x3b124f,_0x1c59d0){return client[_0x6400('0xa')](_0x46819e,_0x356982)[_0x6400('0xb')](function(_0x237e22){logger[_0x6400('0xc')](_0x6400('0xd'),_0x31a8d0,'request\x20sent');logger[_0x6400('0xe')](_0x6400('0xf'),_0x31a8d0,_0x6400('0x10'),JSON[_0x6400('0x11')](_0x237e22));if(_0x237e22['error']){if(_0x237e22[_0x6400('0x12')][_0x6400('0x13')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x31a8d0,_0x237e22['error'][_0x6400('0x14')]);return _0x1c59d0(_0x237e22[_0x6400('0x12')]['message']);}logger[_0x6400('0x12')]('MailAccount,\x20%s,\x20%s',_0x31a8d0,_0x237e22[_0x6400('0x12')]['message']);return _0x3b124f(_0x237e22[_0x6400('0x12')][_0x6400('0x14')]);}else{logger[_0x6400('0xc')](_0x6400('0xd'),_0x31a8d0,'request\x20sent');_0x3b124f(_0x237e22[_0x6400('0x15')][_0x6400('0x14')]);}})[_0x6400('0x16')](function(_0x50524f){logger[_0x6400('0x12')](_0x6400('0xd'),_0x31a8d0,_0x50524f);_0x1c59d0(_0x50524f);});});}exports['GetMailAccount']=function(_0x36a8f5){var _0x32a8d8=this;return new Promise(function(_0xb4d0ca,_0x5d8ddb){return db[_0x6400('0x17')][_0x6400('0x18')]({'raw':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5[_0x6400('0x19')][_0x6400('0x1a')]===undefined?!![]:![]:!![],'where':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5[_0x6400('0x19')][_0x6400('0x1b')]||null:null,'attributes':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5[_0x6400('0x19')]['attributes']||null:null,'limit':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5['options']['limit']||null:null,'include':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5[_0x6400('0x19')][_0x6400('0x1c')]?_[_0x6400('0x1d')](_0x36a8f5['options'][_0x6400('0x1c')],function(_0x56d9e6){return{'model':db[_0x56d9e6[_0x6400('0x1e')]],'as':_0x56d9e6['as'],'attributes':_0x56d9e6['attributes'],'include':_0x56d9e6[_0x6400('0x1c')]?_[_0x6400('0x1d')](_0x56d9e6['include'],function(_0x434550){return{'model':db[_0x434550[_0x6400('0x1e')]],'as':_0x434550['as'],'attributes':_0x434550[_0x6400('0x1f')],'include':_0x434550['include']?_[_0x6400('0x1d')](_0x434550['include'],function(_0x5f06ae){return{'model':db[_0x5f06ae[_0x6400('0x1e')]],'as':_0x5f06ae['as'],'attributes':_0x5f06ae['attributes']};}):[]};}):[]};}):[]:[]})[_0x6400('0xb')](function(_0x197b9d){logger['info'](_0x6400('0x20'),_0x36a8f5);logger['debug']('GetMailAccount',_0x36a8f5,JSON[_0x6400('0x11')](_0x197b9d));_0xb4d0ca(_0x197b9d);})[_0x6400('0x16')](function(_0x10005a){logger[_0x6400('0x12')](_0x6400('0x20'),_0x10005a['message'],_0x36a8f5);_0x5d8ddb(_0x32a8d8[_0x6400('0x12')](0x1f4,_0x10005a[_0x6400('0x14')]));});});};exports[_0x6400('0x21')]=function(_0x1f66c3){var _0x57c3fb=this;return new Promise(function(_0x437624,_0x356f4d){return db[_0x6400('0x17')]['find']({'raw':_0x1f66c3[_0x6400('0x19')]?_0x1f66c3[_0x6400('0x19')][_0x6400('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f66c3[_0x6400('0x19')]?_0x1f66c3['options'][_0x6400('0x1b')]||null:null,'attributes':_0x1f66c3[_0x6400('0x19')]?_0x1f66c3['options'][_0x6400('0x1f')]||null:null,'include':_0x1f66c3[_0x6400('0x19')]?_0x1f66c3['options']['include']?_[_0x6400('0x1d')](_0x1f66c3[_0x6400('0x19')][_0x6400('0x1c')],function(_0x5286a0){return{'model':db[_0x5286a0['model']],'as':_0x5286a0['as'],'attributes':_0x5286a0['attributes'],'include':_0x5286a0[_0x6400('0x1c')]?_[_0x6400('0x1d')](_0x5286a0[_0x6400('0x1c')],function(_0x1a9e17){return{'model':db[_0x1a9e17[_0x6400('0x1e')]],'as':_0x1a9e17['as'],'attributes':_0x1a9e17['attributes'],'include':_0x1a9e17[_0x6400('0x1c')]?_[_0x6400('0x1d')](_0x1a9e17['include'],function(_0x51425c){return{'model':db[_0x51425c[_0x6400('0x1e')]],'as':_0x51425c['as'],'attributes':_0x51425c[_0x6400('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6400('0xb')](function(_0x51a7c0){if(_0x1f66c3[_0x6400('0x19')][_0x6400('0x22')]===!![])_0x51a7c0[_0x6400('0x23')]('smtpOptions',_0x51a7c0[_0x6400('0x24')]());logger[_0x6400('0xc')](_0x6400('0x21'),_0x1f66c3);logger['debug']('ShowMailAccount',_0x1f66c3,JSON['stringify'](_0x51a7c0));_0x437624(_0x51a7c0);})[_0x6400('0x16')](function(_0x5c4845){logger['error'](_0x6400('0x21'),_0x5c4845[_0x6400('0x14')],_0x1f66c3);_0x356f4d(_0x57c3fb['error'](0x1f4,_0x5c4845[_0x6400('0x14')]));});});};exports[_0x6400('0x25')]=function(_0x43b7bb){var _0x51ee86=this;return new Promise(function(_0x9536e5,_0x443ff0){var _0x5f27cd={'body':_0x43b7bb[_0x6400('0x26')],'channel':'mail'};var _0x51a9e8=_[_0x6400('0x27')](_[_0x6400('0x28')](db[_0x6400('0x29')]['rawAttributes']),[_0x6400('0x2a'),_0x6400('0x2b'),_0x6400('0x2c'),_0x6400('0x2d')]);var _0x3069f0=![];if(_0x43b7bb['body']['id']){delete _0x43b7bb[_0x6400('0x26')]['id'];}if(_['isNil'](_0x43b7bb[_0x6400('0x26')][_0x6400('0x2e')])){return _0x443ff0(_0x51ee86[_0x6400('0x12')](0x1f4,_0x6400('0x2f')));}if(_['isNil'](_0x43b7bb[_0x6400('0x26')][_0x6400('0x26')])||_0x43b7bb[_0x6400('0x26')][_0x6400('0x26')]===''){return _0x443ff0(_0x51ee86['error'](0x1f4,_0x6400('0x30')));}if(_['isNil'](_0x43b7bb[_0x6400('0x26')]['mapKey'])){return _0x443ff0(_0x51ee86[_0x6400('0x12')](0x1f4,_0x6400('0x31')+_0x51a9e8));}if(!_[_0x6400('0x32')](_0x51a9e8,_0x43b7bb['body'][_0x6400('0x33')])){return _0x443ff0(_0x51ee86['error'](0x1f4,_0x6400('0x34')+_0x51a9e8));}var _0x146358={};_0x146358[_0x43b7bb[_0x6400('0x26')][_0x6400('0x33')]]=_0x43b7bb[_0x6400('0x26')][_0x6400('0x2e')];return db[_0x6400('0x17')][_0x6400('0x35')]({'where':{'id':_0x43b7bb[_0x6400('0x36')]['id']},'include':[{'model':db[_0x6400('0x37')],'as':_0x6400('0x38'),'include':[{'model':db['CmContact'],'as':_0x6400('0x39'),'where':_0x146358,'limit':0x1,'order':[[_0x6400('0x2b'),_0x6400('0x3a')]]}]},{'model':db['MailApplication'],'as':_0x6400('0x3b')},{'model':db[_0x6400('0x3c')],'as':_0x6400('0x3d'),'include':[{'model':db['CloudProvider'],'as':_0x6400('0x3e')}]}]})['then'](function(_0x518ee4){if(_0x518ee4&&_0x518ee4['List']){var _0x32c3d0=_0x518ee4[_0x6400('0x3f')]({'plain':!![]});_0x5f27cd['account']=_[_0x6400('0x40')](_0x32c3d0,[_0x6400('0x3b'),'List']);_0x5f27cd['account'][_0x6400('0x41')]=_0x518ee4[_0x6400('0x24')]();_0x5f27cd['applications']=_0x32c3d0[_0x6400('0x3b')];_0x5f27cd[_0x6400('0x42')]=_0x32c3d0[_0x6400('0x38')];_0x5f27cd[_0x6400('0x43')]=_[_0x6400('0x44')](_0x5f27cd[_0x6400('0x43')],[_0x6400('0x45')],['asc']);if(_0x5f27cd[_0x6400('0x36')]&&_0x5f27cd[_0x6400('0x36')][_0x6400('0x46')]){_0x5f27cd[_0x6400('0x43')][_0x6400('0x47')]({'id':0x0,'priority':_0x5f27cd[_0x6400('0x43')][_0x6400('0x48')]+0x1,'app':'close','appdata':_0x6400('0x46'),'interval':'*,*,*,*'});}if(_0x5f27cd['account'][_0x6400('0x3b')]){delete _0x5f27cd[_0x6400('0x36')][_0x6400('0x3b')];}if(_0x5f27cd['account'][_0x6400('0x38')]){delete _0x5f27cd[_0x6400('0x36')][_0x6400('0x38')];}if(_0x32c3d0[_0x6400('0x38')][_0x6400('0x39')]['length']){return _0x32c3d0[_0x6400('0x38')][_0x6400('0x39')][0x0];}var _0x55e49c=_[_0x6400('0x49')](_0x43b7bb[_0x6400('0x26')],{'firstName':_0x43b7bb[_0x6400('0x26')]['from'],'ListId':_0x32c3d0[_0x6400('0x2d')]});_0x55e49c[_0x43b7bb['body'][_0x6400('0x33')]]=_0x43b7bb[_0x6400('0x26')][_0x6400('0x2e')];return db[_0x6400('0x29')][_0x6400('0x4a')](_0x55e49c);}else{throw new Error(_0x6400('0x4b'));}})['then'](function(_0x1ce65e){_0x5f27cd[_0x6400('0x4c')]=_0x1ce65e;if(_0x1ce65e){if(!_0x43b7bb['body'][_0x6400('0x14')][_0x6400('0x4d')]){_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['messageId']=rs[_0x6400('0x4e')]()+'\x20'+_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x2e')];}var _0x38abb3={'ContactId':_0x1ce65e['id'],'MailAccountId':_0x43b7bb[_0x6400('0x36')]['id'],'inReplyTo':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x4d')],'to':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x2e')],'cc':_0x43b7bb['body'][_0x6400('0x14')]['cc'],'subject':_0x43b7bb[_0x6400('0x26')]['message'][_0x6400('0x4f')],'attach':_0x43b7bb['body'][_0x6400('0x14')][_0x6400('0x50')],'lastMsgAt':moment()['format'](_0x6400('0x51')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x6400('0x35')]({'where':{'closed':![],'MailAccountId':_0x43b7bb['account']['id']},'include':[{'model':db[_0x6400('0x52')],'as':_0x6400('0x53'),'attributes':[_0x6400('0x4d')],'where':{'messageId':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x54')]}}]})['then'](function(_0x53215e){if(_0x53215e){return[_0x53215e,![]];}return db[_0x6400('0x55')][_0x6400('0x4a')](_0x38abb3)['then'](function(_0x10d6a8){return[_0x10d6a8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4379cf,_0x391c23){if(_0x4379cf){_0x3069f0=_0x391c23;if(!_0x391c23){return _0x4379cf[_0x6400('0x56')]({'inReplyTo':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x4d')],'to':_0x43b7bb[_0x6400('0x26')]['message'][_0x6400('0x2e')],'cc':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['cc'],'subject':_0x43b7bb['body']['message'][_0x6400('0x4f')],'attach':_0x4379cf[_0x6400('0x50')]?_0x4379cf[_0x6400('0x50')]:_0x43b7bb['body'][_0x6400('0x14')]['attach'],'substatus':null,'substatusAt':moment()[_0x6400('0x57')](_0x6400('0x51')),'lastMsgAt':moment()['format'](_0x6400('0x51')),'lastMsgDirection':'in'});}else{return _0x4379cf;}}})[_0x6400('0xb')](function(_0x2c3e81){_0x5f27cd[_0x6400('0x58')]=_0x2c3e81[_0x6400('0x3f')]({'plain':!![]});_0x5f27cd[_0x6400('0x58')][_0x6400('0x59')]=_0x3069f0;return db['MailMessage'][_0x6400('0x4a')]({'body':_0x43b7bb[_0x6400('0x26')][_0x6400('0x26')],'MailAccountId':_0x43b7bb[_0x6400('0x36')]['id'],'MailInteractionId':_0x2c3e81['id'],'direction':'in','ContactId':_0x5f27cd[_0x6400('0x4c')]['id'],'messageId':_0x43b7bb[_0x6400('0x26')]['message'][_0x6400('0x4d')],'from':_0x43b7bb[_0x6400('0x26')]['message']['from'],'to':_0x43b7bb['body']['message']['to'],'cc':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['cc'],'subject':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['subject'],'attach':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x50')],'Attachments':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x5a')],'originTo':_0x43b7bb['body'][_0x6400('0x14')][_0x6400('0x5b')],'originCc':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x5c')],'bcc':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['bcc'],'ChatWebsiteId':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x5d')]||null,'originChannel':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x5e')]||_0x6400('0x5f'),'ChatOfflineMessageId':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x60')]||null},{'include':[{'model':db[_0x6400('0x61')],'as':'Attachments'}]});})['then'](function(_0x471b2b){_0x5f27cd['message']=_0x471b2b;if(!_0x5f27cd['interaction'][_0x6400('0x62')]){return;}return db[_0x6400('0x63')][_0x6400('0x35')]({'attributes':['id',_0x6400('0x64')],'where':{'id':_0x5f27cd['interaction'][_0x6400('0x62')]}});})['then'](function(_0x11d006){if(_0x11d006){_0x5f27cd[_0x6400('0x43')][_0x6400('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x11d006[_0x6400('0x64')]+','+(_0x5f27cd[_0x6400('0x36')][_0x6400('0x66')]||0xa),'interval':'*,*,*,*'});}if(!_0x5f27cd[_0x6400('0x58')][_0x6400('0x67')]){return;}return db['MailQueue'][_0x6400('0x35')]({'attributes':['id',_0x6400('0x64')],'where':{'id':_0x5f27cd[_0x6400('0x58')][_0x6400('0x67')]}});})['then'](function(_0x5cefda){if(_0x5cefda){_0x5f27cd['applications'][_0x6400('0x65')]({'id':0x0,'priority':0x1,'app':_0x6400('0x68'),'appdata':_0x5cefda[_0x6400('0x64')]+','+(_0x5f27cd[_0x6400('0x36')]['waitForTheAssignedQueue']||0x12c),'interval':_0x6400('0x69')});}return respondWithRpcPromise(_0x6400('0x6a'),_0x6400('0x6b'),_0x5f27cd);})[_0x6400('0xb')](function(_0x43c2c6){_0x9536e5(_0x43c2c6);})['catch'](function(_0x486026){_0x443ff0(_0x51ee86[_0x6400('0x12')](0x1f4,_0x486026['message']));});});}; \ No newline at end of file +var _0x2caf=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','smtpOptions','getSmtpOptions','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','MailApplication','Applications','MailServerOut','CloudProvider','get','applications','list','orderBy','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Contact\x20not\x20found','update','format','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','User','agent','name','waitForTheAssignedAgent','queueId','MailQueue','unshift','queue','Start','startRouting'];(function(_0x54ee03,_0x3119c7){var _0x799488=function(_0x8933d1){while(--_0x8933d1){_0x54ee03['push'](_0x54ee03['shift']());}};_0x799488(++_0x3119c7);}(_0x2caf,0x6a));var _0xf2ca=function(_0x539ea9,_0x612408){_0x539ea9=_0x539ea9-0x0;var _0x17dd9d=_0x2caf[_0x539ea9];return _0x17dd9d;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf2ca('0x0'));var Redis=require('ioredis');var db=require(_0xf2ca('0x1'))['db'];var logger=require(_0xf2ca('0x2'))(_0xf2ca('0x3'));var config=require(_0xf2ca('0x4'));var jayson=require(_0xf2ca('0x5'));var client=jayson[_0xf2ca('0x6')][_0xf2ca('0x7')]({'port':0x232c});config['redis']=_[_0xf2ca('0x8')](config[_0xf2ca('0x9')],{'host':_0xf2ca('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf2ca('0xb'))[_0xf2ca('0xc')](socket);function respondWithRpcPromise(_0x1177f0,_0x1cf4a0,_0x1c1afd){return new BPromise(function(_0x5be288,_0x1ecd50){return client[_0xf2ca('0xd')](_0x1177f0,_0x1c1afd)[_0xf2ca('0xe')](function(_0x4063e9){logger[_0xf2ca('0xf')](_0xf2ca('0x10'),_0x1cf4a0,'request\x20sent');logger[_0xf2ca('0x11')](_0xf2ca('0x12'),_0x1cf4a0,'request\x20sent',JSON[_0xf2ca('0x13')](_0x4063e9));if(_0x4063e9[_0xf2ca('0x14')]){if(_0x4063e9['error']['code']===0x1f4){logger[_0xf2ca('0x14')]('MailAccount,\x20%s,\x20%s',_0x1cf4a0,_0x4063e9[_0xf2ca('0x14')][_0xf2ca('0x15')]);return _0x1ecd50(_0x4063e9[_0xf2ca('0x14')][_0xf2ca('0x15')]);}logger[_0xf2ca('0x14')](_0xf2ca('0x10'),_0x1cf4a0,_0x4063e9[_0xf2ca('0x14')]['message']);return _0x5be288(_0x4063e9[_0xf2ca('0x14')]['message']);}else{logger[_0xf2ca('0xf')]('MailAccount,\x20%s,\x20%s',_0x1cf4a0,_0xf2ca('0x16'));_0x5be288(_0x4063e9[_0xf2ca('0x17')]['message']);}})[_0xf2ca('0x18')](function(_0x160230){logger[_0xf2ca('0x14')](_0xf2ca('0x10'),_0x1cf4a0,_0x160230);_0x1ecd50(_0x160230);});});}exports[_0xf2ca('0x19')]=function(_0x1ca233){var _0x17eafa=this;return new Promise(function(_0x1548a4,_0x1718e6){return db[_0xf2ca('0x1a')][_0xf2ca('0x1b')]({'raw':_0x1ca233['options']?_0x1ca233[_0xf2ca('0x1c')][_0xf2ca('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ca233[_0xf2ca('0x1c')]?_0x1ca233[_0xf2ca('0x1c')][_0xf2ca('0x1e')]||null:null,'attributes':_0x1ca233[_0xf2ca('0x1c')]?_0x1ca233[_0xf2ca('0x1c')][_0xf2ca('0x1f')]||null:null,'limit':_0x1ca233['options']?_0x1ca233[_0xf2ca('0x1c')][_0xf2ca('0x20')]||null:null,'include':_0x1ca233['options']?_0x1ca233[_0xf2ca('0x1c')][_0xf2ca('0x21')]?_[_0xf2ca('0x22')](_0x1ca233['options']['include'],function(_0xbfcb0b){return{'model':db[_0xbfcb0b[_0xf2ca('0x23')]],'as':_0xbfcb0b['as'],'attributes':_0xbfcb0b[_0xf2ca('0x1f')],'include':_0xbfcb0b[_0xf2ca('0x21')]?_[_0xf2ca('0x22')](_0xbfcb0b[_0xf2ca('0x21')],function(_0x339e10){return{'model':db[_0x339e10[_0xf2ca('0x23')]],'as':_0x339e10['as'],'attributes':_0x339e10['attributes'],'include':_0x339e10[_0xf2ca('0x21')]?_[_0xf2ca('0x22')](_0x339e10[_0xf2ca('0x21')],function(_0x1b36e0){return{'model':db[_0x1b36e0[_0xf2ca('0x23')]],'as':_0x1b36e0['as'],'attributes':_0x1b36e0[_0xf2ca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf2ca('0xe')](function(_0xb0ae21){logger[_0xf2ca('0xf')](_0xf2ca('0x19'),_0x1ca233);logger[_0xf2ca('0x11')](_0xf2ca('0x19'),_0x1ca233,JSON[_0xf2ca('0x13')](_0xb0ae21));_0x1548a4(_0xb0ae21);})[_0xf2ca('0x18')](function(_0x2b0649){logger[_0xf2ca('0x14')](_0xf2ca('0x19'),_0x2b0649[_0xf2ca('0x15')],_0x1ca233);_0x1718e6(_0x17eafa[_0xf2ca('0x14')](0x1f4,_0x2b0649['message']));});});};exports[_0xf2ca('0x24')]=function(_0x1e817f){var _0x1c5310=this;return new Promise(function(_0x25066b,_0xb75964){return db[_0xf2ca('0x1a')][_0xf2ca('0x25')]({'raw':_0x1e817f[_0xf2ca('0x1c')]?_0x1e817f[_0xf2ca('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1e817f[_0xf2ca('0x1c')]?_0x1e817f[_0xf2ca('0x1c')][_0xf2ca('0x1e')]||null:null,'attributes':_0x1e817f['options']?_0x1e817f[_0xf2ca('0x1c')]['attributes']||null:null,'include':_0x1e817f[_0xf2ca('0x1c')]?_0x1e817f[_0xf2ca('0x1c')][_0xf2ca('0x21')]?_[_0xf2ca('0x22')](_0x1e817f[_0xf2ca('0x1c')]['include'],function(_0x521b94){return{'model':db[_0x521b94[_0xf2ca('0x23')]],'as':_0x521b94['as'],'attributes':_0x521b94['attributes'],'include':_0x521b94[_0xf2ca('0x21')]?_[_0xf2ca('0x22')](_0x521b94[_0xf2ca('0x21')],function(_0x3152eb){return{'model':db[_0x3152eb[_0xf2ca('0x23')]],'as':_0x3152eb['as'],'attributes':_0x3152eb[_0xf2ca('0x1f')],'include':_0x3152eb[_0xf2ca('0x21')]?_[_0xf2ca('0x22')](_0x3152eb[_0xf2ca('0x21')],function(_0x1ad216){return{'model':db[_0x1ad216[_0xf2ca('0x23')]],'as':_0x1ad216['as'],'attributes':_0x1ad216[_0xf2ca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf2ca('0xe')](function(_0x3c8d63){if(_0x1e817f[_0xf2ca('0x1c')][_0xf2ca('0x26')]===!![])_0x3c8d63['setDataValue'](_0xf2ca('0x27'),_0x3c8d63[_0xf2ca('0x28')]());logger[_0xf2ca('0xf')](_0xf2ca('0x24'),_0x1e817f);logger['debug'](_0xf2ca('0x24'),_0x1e817f,JSON['stringify'](_0x3c8d63));_0x25066b(_0x3c8d63);})[_0xf2ca('0x18')](function(_0x33680b){logger[_0xf2ca('0x14')](_0xf2ca('0x24'),_0x33680b[_0xf2ca('0x15')],_0x1e817f);_0xb75964(_0x1c5310['error'](0x1f4,_0x33680b[_0xf2ca('0x15')]));});});};exports[_0xf2ca('0x29')]=function(_0x4f39de){var _0x36740d=this;return new Promise(function(_0x29ebce,_0x3f014f){var _0x5396ef={'body':_0x4f39de[_0xf2ca('0x2a')],'channel':'mail'};var _0x128419=_[_0xf2ca('0x2b')](_[_0xf2ca('0x2c')](db[_0xf2ca('0x2d')][_0xf2ca('0x2e')]),[_0xf2ca('0x2f'),_0xf2ca('0x30'),_0xf2ca('0x31'),_0xf2ca('0x32')]);var _0x128535=![];if(_0x4f39de[_0xf2ca('0x2a')]['id']){delete _0x4f39de[_0xf2ca('0x2a')]['id'];}if(_[_0xf2ca('0x33')](_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x34')])){return _0x3f014f(_0x36740d['error'](0x1f4,_0xf2ca('0x35')));}if(_[_0xf2ca('0x33')](_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x2a')])||_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x2a')]===''){return _0x3f014f(_0x36740d[_0xf2ca('0x14')](0x1f4,_0xf2ca('0x36')));}if(_[_0xf2ca('0x33')](_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x37')])){return _0x3f014f(_0x36740d[_0xf2ca('0x14')](0x1f4,_0xf2ca('0x38')+_0x128419));}if(!_['includes'](_0x128419,_0x4f39de['body'][_0xf2ca('0x37')])){return _0x3f014f(_0x36740d[_0xf2ca('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x128419));}var _0x102c3c={};_0x102c3c[_0x4f39de['body'][_0xf2ca('0x37')]]=_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x34')];return db['MailAccount'][_0xf2ca('0x25')]({'where':{'id':_0x4f39de[_0xf2ca('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xf2ca('0x3a'),'include':[{'model':db[_0xf2ca('0x2d')],'as':_0xf2ca('0x3b'),'where':_0x102c3c,'limit':0x1,'order':[[_0xf2ca('0x30'),'DESC']]}]},{'model':db[_0xf2ca('0x3c')],'as':_0xf2ca('0x3d')},{'model':db[_0xf2ca('0x3e')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xf2ca('0x3f')}]}]})[_0xf2ca('0xe')](function(_0x1a65c6){if(_0x1a65c6&&_0x1a65c6[_0xf2ca('0x3a')]){var _0x3f31de=_0x1a65c6[_0xf2ca('0x40')]({'plain':!![]});_0x5396ef['account']=_['omit'](_0x3f31de,[_0xf2ca('0x3d'),_0xf2ca('0x3a')]);_0x5396ef['account'][_0xf2ca('0x27')]=_0x1a65c6['getSmtpOptions']();_0x5396ef[_0xf2ca('0x41')]=_0x3f31de['Applications'];_0x5396ef[_0xf2ca('0x42')]=_0x3f31de['List'];_0x5396ef['applications']=_[_0xf2ca('0x43')](_0x5396ef[_0xf2ca('0x41')],['priority'],[_0xf2ca('0x44')]);if(_0x5396ef[_0xf2ca('0x39')]&&_0x5396ef[_0xf2ca('0x39')][_0xf2ca('0x45')]){_0x5396ef[_0xf2ca('0x41')][_0xf2ca('0x46')]({'id':0x0,'priority':_0x5396ef['applications'][_0xf2ca('0x47')]+0x1,'app':_0xf2ca('0x48'),'appdata':'autoclose','interval':_0xf2ca('0x49')});}if(_0x5396ef[_0xf2ca('0x39')][_0xf2ca('0x3d')]){delete _0x5396ef[_0xf2ca('0x39')][_0xf2ca('0x3d')];}if(_0x5396ef['account']['List']){delete _0x5396ef['account'][_0xf2ca('0x3a')];}if(_0x3f31de[_0xf2ca('0x3a')][_0xf2ca('0x3b')][_0xf2ca('0x47')]){return _0x3f31de['List'][_0xf2ca('0x3b')][0x0];}var _0x4683fe=_[_0xf2ca('0x8')](_0x4f39de[_0xf2ca('0x2a')],{'firstName':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x34')],'ListId':_0x3f31de[_0xf2ca('0x32')]});_0x4683fe[_0x4f39de['body'][_0xf2ca('0x37')]]=_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x34')];return db['CmContact'][_0xf2ca('0x4a')](_0x4683fe);}else{throw new Error(_0xf2ca('0x4b'));}})['then'](function(_0x3d71e2){_0x5396ef[_0xf2ca('0x4c')]=_0x3d71e2;if(_0x3d71e2){if(!_0x4f39de[_0xf2ca('0x2a')]['message'][_0xf2ca('0x4d')]){_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x4d')]=rs['generate']()+'\x20'+_0x4f39de['body'][_0xf2ca('0x15')][_0xf2ca('0x34')];}var _0x1fba4d={'ContactId':_0x3d71e2['id'],'MailAccountId':_0x4f39de[_0xf2ca('0x39')]['id'],'inReplyTo':_0x4f39de['body'][_0xf2ca('0x15')]['messageId'],'to':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x34')],'cc':_0x4f39de[_0xf2ca('0x2a')]['message']['cc'],'subject':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x4e')],'attach':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x4f')],'lastMsgAt':moment()['format'](_0xf2ca('0x50')),'lastMsgDirection':'in'};return db[_0xf2ca('0x51')][_0xf2ca('0x25')]({'where':{'closed':![],'MailAccountId':_0x4f39de[_0xf2ca('0x39')]['id']},'include':[{'model':db[_0xf2ca('0x52')],'as':'Messages','attributes':[_0xf2ca('0x4d')],'where':{'messageId':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')]['inReplyTo']}}]})[_0xf2ca('0xe')](function(_0x152f0c){if(_0x152f0c){return[_0x152f0c,![]];}return db[_0xf2ca('0x51')][_0xf2ca('0x4a')](_0x1fba4d)[_0xf2ca('0xe')](function(_0x219854){return[_0x219854,!![]];});});}else{throw new Error(_0xf2ca('0x53'));}})['spread'](function(_0x5b1554,_0x4baca3){if(_0x5b1554){_0x128535=_0x4baca3;if(!_0x4baca3){return _0x5b1554[_0xf2ca('0x54')]({'inReplyTo':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x4d')],'to':_0x4f39de[_0xf2ca('0x2a')]['message']['from'],'cc':_0x4f39de[_0xf2ca('0x2a')]['message']['cc'],'subject':_0x4f39de[_0xf2ca('0x2a')]['message']['subject'],'attach':_0x5b1554['attach']?_0x5b1554[_0xf2ca('0x4f')]:_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x4f')],'substatus':null,'substatusAt':moment()[_0xf2ca('0x55')](_0xf2ca('0x50')),'lastMsgAt':moment()[_0xf2ca('0x55')](_0xf2ca('0x50')),'lastMsgDirection':'in'});}else{return _0x5b1554;}}})['then'](function(_0x1be4cb){_0x5396ef[_0xf2ca('0x56')]=_0x1be4cb[_0xf2ca('0x40')]({'plain':!![]});_0x5396ef[_0xf2ca('0x56')]['created']=_0x128535;return db[_0xf2ca('0x52')][_0xf2ca('0x4a')]({'body':_0x4f39de['body'][_0xf2ca('0x2a')],'MailAccountId':_0x4f39de['account']['id'],'MailInteractionId':_0x1be4cb['id'],'direction':'in','ContactId':_0x5396ef[_0xf2ca('0x4c')]['id'],'messageId':_0x4f39de['body'][_0xf2ca('0x15')][_0xf2ca('0x4d')],'from':_0x4f39de[_0xf2ca('0x2a')]['message'][_0xf2ca('0x34')],'to':_0x4f39de['body']['message']['to'],'cc':_0x4f39de['body'][_0xf2ca('0x15')]['cc'],'subject':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x4e')],'attach':_0x4f39de['body'][_0xf2ca('0x15')][_0xf2ca('0x4f')],'Attachments':_0x4f39de['body'][_0xf2ca('0x15')][_0xf2ca('0x57')],'originTo':_0x4f39de['body'][_0xf2ca('0x15')][_0xf2ca('0x58')],'originCc':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x59')],'bcc':_0x4f39de[_0xf2ca('0x2a')]['message'][_0xf2ca('0x5a')],'ChatWebsiteId':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x5b')]||null,'originChannel':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x5c')]||'Email','ChatOfflineMessageId':_0x4f39de[_0xf2ca('0x2a')][_0xf2ca('0x15')][_0xf2ca('0x5d')]||null},{'include':[{'model':db[_0xf2ca('0x5e')],'as':'Attachments'}]});})['then'](function(_0x30d500){_0x5396ef['message']=_0x30d500;if(!_0x5396ef['interaction'][_0xf2ca('0x5f')]){return;}return db[_0xf2ca('0x60')][_0xf2ca('0x25')]({'attributes':['id','name'],'where':{'id':_0x5396ef[_0xf2ca('0x56')][_0xf2ca('0x5f')]}});})[_0xf2ca('0xe')](function(_0x294d6f){if(_0x294d6f){_0x5396ef[_0xf2ca('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf2ca('0x61'),'appdata':_0x294d6f[_0xf2ca('0x62')]+','+(_0x5396ef['account'][_0xf2ca('0x63')]||0xa),'interval':_0xf2ca('0x49')});}if(!_0x5396ef[_0xf2ca('0x56')][_0xf2ca('0x64')]){return;}return db[_0xf2ca('0x65')][_0xf2ca('0x25')]({'attributes':['id',_0xf2ca('0x62')],'where':{'id':_0x5396ef[_0xf2ca('0x56')][_0xf2ca('0x64')]}});})['then'](function(_0x4453ba){if(_0x4453ba){_0x5396ef[_0xf2ca('0x41')][_0xf2ca('0x66')]({'id':0x0,'priority':0x1,'app':_0xf2ca('0x67'),'appdata':_0x4453ba[_0xf2ca('0x62')]+','+(_0x5396ef[_0xf2ca('0x39')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf2ca('0x68'),_0xf2ca('0x69'),_0x5396ef);})[_0xf2ca('0xe')](function(_0xda8883){_0x29ebce(_0xda8883);})[_0xf2ca('0x18')](function(_0x6c8186){_0x3f014f(_0x36740d[_0xf2ca('0x14')](0x1f4,_0x6c8186[_0xf2ca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 983c538..9e9c4f4 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 _0xcfa3=['register','length','mailAccount:','save','update','emit','removeListener'];(function(_0x1c880c,_0x5b65f5){var _0x49150e=function(_0x228d3b){while(--_0x228d3b){_0x1c880c['push'](_0x1c880c['shift']());}};_0x49150e(++_0x5b65f5);}(_0xcfa3,0x88));var _0x3cfa=function(_0x545cc9,_0x8120c4){_0x545cc9=_0x545cc9-0x0;var _0x2673a0=_0xcfa3[_0x545cc9];return _0x2673a0;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x3cfa('0x0'),'remove',_0x3cfa('0x1')];function createListener(_0x241ff2,_0x59346b){return function(_0x37880c){_0x59346b[_0x3cfa('0x2')](_0x241ff2,_0x37880c);};}function removeListener(_0xb7434a,_0x156845){return function(){MailAccountEvents[_0x3cfa('0x3')](_0xb7434a,_0x156845);};}exports[_0x3cfa('0x4')]=function(_0x3adb1e){for(var _0x454773=0x0,_0x568844=events[_0x3cfa('0x5')];_0x454773<_0x568844;_0x454773++){var _0x3a7790=events[_0x454773];var _0x4e1eef=createListener(_0x3cfa('0x6')+_0x3a7790,_0x3adb1e);MailAccountEvents['on'](_0x3a7790,_0x4e1eef);}}; \ No newline at end of file +var _0x9d49=['emit','removeListener','register','length','./mailAccount.events','remove','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9d49,0xcf));var _0x99d4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d49[_0x321bb2];return _0x9c12ed;};'use strict';var MailAccountEvents=require(_0x99d4('0x0'));var events=['save',_0x99d4('0x1'),_0x99d4('0x2')];function createListener(_0x4168ee,_0xc5c60a){return function(_0x2e3250){_0xc5c60a[_0x99d4('0x3')](_0x4168ee,_0x2e3250);};}function removeListener(_0x44295a,_0x3ec3a8){return function(){MailAccountEvents[_0x99d4('0x4')](_0x44295a,_0x3ec3a8);};}exports[_0x99d4('0x5')]=function(_0x599b8f){for(var _0x586b08=0x0,_0xa34c60=events[_0x99d4('0x6')];_0x586b08<_0xa34c60;_0x586b08++){var _0x669198=events[_0x586b08];var _0x3d168d=createListener('mailAccount:'+_0x669198,_0x599b8f);MailAccountEvents['on'](_0x669198,_0x3d168d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8f34831..bbb5af7 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 _0xe49a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','/:id','delete','destroy','exports','path','connect-timeout'];(function(_0x47ba5f,_0x2c0e07){var _0x1b18d9=function(_0x16fe9b){while(--_0x16fe9b){_0x47ba5f['push'](_0x47ba5f['shift']());}};_0x1b18d9(++_0x2c0e07);}(_0xe49a,0xa3));var _0xae49=function(_0x4cd9b6,_0x26e28){_0x4cd9b6=_0x4cd9b6-0x0;var _0x1304b2=_0xe49a[_0x4cd9b6];return _0x1304b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae49('0x0'));var timeout=require(_0xae49('0x1'));var express=require('express');var router=express[_0xae49('0x2')]();var fs_extra=require(_0xae49('0x3'));var auth=require(_0xae49('0x4'));var interaction=require(_0xae49('0x5'));var config=require(_0xae49('0x6'));var controller=require(_0xae49('0x7'));router['get']('/:id',auth[_0xae49('0x8')](),controller[_0xae49('0x9')]);router[_0xae49('0xa')](_0xae49('0xb'),auth[_0xae49('0x8')](),controller['update']);router[_0xae49('0xc')](_0xae49('0xb'),auth[_0xae49('0x8')](),controller[_0xae49('0xd')]);module[_0xae49('0xe')]=router; \ No newline at end of file +var _0xbaff=['isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','show','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbaff,0x17d));var _0xfbaf=function(_0x50b300,_0x4a68b8){_0x50b300=_0x50b300-0x0;var _0x21c025=_0xbaff[_0x50b300];return _0x21c025;};'use strict';var multer=require(_0xfbaf('0x0'));var util=require(_0xfbaf('0x1'));var path=require(_0xfbaf('0x2'));var timeout=require(_0xfbaf('0x3'));var express=require(_0xfbaf('0x4'));var router=express['Router']();var fs_extra=require(_0xfbaf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfbaf('0x6'));var config=require(_0xfbaf('0x7'));var controller=require(_0xfbaf('0x8'));router[_0xfbaf('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xfbaf('0xa')]);router[_0xfbaf('0xb')](_0xfbaf('0xc'),auth['isAuthenticated'](),controller[_0xfbaf('0xd')]);router[_0xfbaf('0xe')]('/:id',auth[_0xfbaf('0xf')](),controller[_0xfbaf('0x10')]);module[_0xfbaf('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f98f49b..eb3e86d 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 _0x4147=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x83b7b9,_0x554605){var _0x5057a2=function(_0x2a2f61){while(--_0x2a2f61){_0x83b7b9['push'](_0x83b7b9['shift']());}};_0x5057a2(++_0x554605);}(_0x4147,0x1a7));var _0x7414=function(_0x5dbf38,_0x1ff06d){_0x5dbf38=_0x5dbf38-0x0;var _0x4ea452=_0x4147[_0x5dbf38];return _0x4ea452;};'use strict';var Sequelize=require(_0x7414('0x0'));module[_0x7414('0x1')]={'priority':{'type':Sequelize[_0x7414('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7414('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7414('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7414('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5136=['STRING','TEXT','*,*,*,*'];(function(_0x31cdac,_0x533ae0){var _0x46ec34=function(_0x57811f){while(--_0x57811f){_0x31cdac['push'](_0x31cdac['shift']());}};_0x46ec34(++_0x533ae0);}(_0x5136,0x105));var _0x6513=function(_0x1e4f7c,_0x3b5fbc){_0x1e4f7c=_0x1e4f7c-0x0;var _0x343606=_0x5136[_0x1e4f7c];return _0x343606;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6513('0x0')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6513('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6513('0x0')],'defaultValue':_0x6513('0x2')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c6a82ab..f35f044 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x358474,_0x2ae44d){var _0x5afe34=function(_0x240ecc){while(--_0x240ecc){_0x358474['push'](_0x358474['shift']());}};_0x5afe34(++_0x2ae44d);}(_0xda3f,0xec));var _0xfda3=function(_0x58aa3b,_0x3c9cae){_0x58aa3b=_0x58aa3b-0x0;var _0x1d9a9b=_0xda3f[_0x58aa3b];return _0x1d9a9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x5207a2,_0x316913){var _0x314716=function(_0x2ca663){while(--_0x2ca663){_0x5207a2['push'](_0x5207a2['shift']());}};_0x314716(++_0x316913);}(_0x70e0,0x17b));var _0x070e=function(_0x391ff7,_0x4d625b){_0x391ff7=_0x391ff7-0x0;var _0x211f5b=_0x70e0[_0x391ff7];return _0x211f5b;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index b5c6741..5196b53 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 _0xf0ae=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2d6d86,_0xf30668){var _0xfb9a4e=function(_0x305f5a){while(--_0x305f5a){_0x2d6d86['push'](_0x2d6d86['shift']());}};_0xfb9a4e(++_0xf30668);}(_0xf0ae,0xf8));var _0xef0a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xf0ae[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xef0a('0x0'));var util=require(_0xef0a('0x1'));var logger=require(_0xef0a('0x2'))(_0xef0a('0x3'));var moment=require(_0xef0a('0x4'));var BPromise=require('bluebird');var rp=require(_0xef0a('0x5'));var fs=require('fs');var path=require(_0xef0a('0x6'));var rimraf=require(_0xef0a('0x7'));var config=require(_0xef0a('0x8'));var attributes=require(_0xef0a('0x9'));module[_0xef0a('0xa')]=function(_0x145f5d,_0x5dddba){return _0x145f5d[_0xef0a('0xb')](_0xef0a('0xc'),attributes,{'tableName':_0xef0a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xef0a('0xe'),'collate':_0xef0a('0xf')});}; \ No newline at end of file +var _0x067d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4d5c98,_0x3a14dd){var _0x548799=function(_0x2b090c){while(--_0x2b090c){_0x4d5c98['push'](_0x4d5c98['shift']());}};_0x548799(++_0x3a14dd);}(_0x067d,0xce));var _0xd067=function(_0x48d12f,_0x5b66db){_0x48d12f=_0x48d12f-0x0;var _0x47fadc=_0x067d[_0x48d12f];return _0x47fadc;};'use strict';var _=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var logger=require(_0xd067('0x2'))(_0xd067('0x3'));var moment=require(_0xd067('0x4'));var BPromise=require(_0xd067('0x5'));var rp=require(_0xd067('0x6'));var fs=require('fs');var path=require(_0xd067('0x7'));var rimraf=require(_0xd067('0x8'));var config=require(_0xd067('0x9'));var attributes=require(_0xd067('0xa'));module['exports']=function(_0x164328,_0x3541f0){return _0x164328[_0xd067('0xb')](_0xd067('0xc'),attributes,{'tableName':_0xd067('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd067('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8e4048e..77de595 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 _0x3c45=['result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3c45,0x132));var _0x53c4=function(_0x46abcd,_0x941a15){_0x46abcd=_0x46abcd-0x0;var _0x2cd077=_0x3c45[_0x46abcd];return _0x2cd077;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x53c4('0x0'));var BPromise=require(_0x53c4('0x1'));var rs=require(_0x53c4('0x2'));var fs=require('fs');var Redis=require(_0x53c4('0x3'));var db=require(_0x53c4('0x4'))['db'];var utils=require(_0x53c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x53c4('0x6')][_0x53c4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x592ff1,_0x267336,_0x2c0f33){return new BPromise(function(_0x6a469a,_0x50130a){return client[_0x53c4('0x8')](_0x592ff1,_0x2c0f33)['then'](function(_0x3304b6){logger[_0x53c4('0x9')](_0x53c4('0xa'),_0x267336,_0x53c4('0xb'));logger[_0x53c4('0xc')](_0x53c4('0xd'),_0x267336,'request\x20sent',JSON[_0x53c4('0xe')](_0x3304b6));if(_0x3304b6[_0x53c4('0xf')]){if(_0x3304b6[_0x53c4('0xf')][_0x53c4('0x10')]===0x1f4){logger[_0x53c4('0xf')]('MailApplication,\x20%s,\x20%s',_0x267336,_0x3304b6['error'][_0x53c4('0x11')]);return _0x50130a(_0x3304b6[_0x53c4('0xf')][_0x53c4('0x11')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x267336,_0x3304b6['error'][_0x53c4('0x11')]);return _0x6a469a(_0x3304b6[_0x53c4('0xf')]['message']);}else{logger[_0x53c4('0x9')](_0x53c4('0xa'),_0x267336,_0x53c4('0xb'));_0x6a469a(_0x3304b6[_0x53c4('0x12')][_0x53c4('0x11')]);}})['catch'](function(_0x29f966){logger[_0x53c4('0xf')]('MailApplication,\x20%s,\x20%s',_0x267336,_0x29f966);_0x50130a(_0x29f966);});});}exports[_0x53c4('0x13')]=function(_0x2dac49){var _0xab7f9c=this;return new Promise(function(_0xc763d,_0x372cf9){return db[_0x53c4('0x14')]['update'](_0x2dac49[_0x53c4('0x15')],{'raw':_0x2dac49[_0x53c4('0x16')]?_0x2dac49[_0x53c4('0x16')][_0x53c4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dac49[_0x53c4('0x16')]?_0x2dac49[_0x53c4('0x16')][_0x53c4('0x18')]||null:null,'attributes':_0x2dac49[_0x53c4('0x16')]?_0x2dac49[_0x53c4('0x16')][_0x53c4('0x19')]||null:null,'limit':_0x2dac49[_0x53c4('0x16')]?_0x2dac49['options']['limit']||null:null})[_0x53c4('0x1a')](function(_0x1c05a7){logger[_0x53c4('0x9')](_0x53c4('0x13'),_0x2dac49);logger[_0x53c4('0xc')](_0x53c4('0x13'),_0x2dac49,JSON['stringify'](_0x1c05a7));_0xc763d(_0x1c05a7);})['catch'](function(_0x258cb0){logger[_0x53c4('0xf')](_0x53c4('0x13'),_0x258cb0[_0x53c4('0x11')],_0x2dac49);_0x372cf9(_0xab7f9c[_0x53c4('0xf')](0x1f4,_0x258cb0[_0x53c4('0x11')]));});});}; \ No newline at end of file +var _0x5b52=['../../config/logger','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','UpdateMailApplication','update','options','raw','where','attributes','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b52,0xad));var _0x25b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b52[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x25b5('0x0'));var util=require(_0x25b5('0x1'));var moment=require('moment');var BPromise=require(_0x25b5('0x2'));var rs=require(_0x25b5('0x3'));var fs=require('fs');var Redis=require(_0x25b5('0x4'));var db=require(_0x25b5('0x5'))['db'];var utils=require(_0x25b5('0x6'));var logger=require(_0x25b5('0x7'))(_0x25b5('0x8'));var config=require(_0x25b5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x25b5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x148916,_0x379ee8,_0x3b9c0e){return new BPromise(function(_0x2651ac,_0x126fde){return client[_0x25b5('0xb')](_0x148916,_0x3b9c0e)[_0x25b5('0xc')](function(_0x2cffa6){logger[_0x25b5('0xd')](_0x25b5('0xe'),_0x379ee8,_0x25b5('0xf'));logger[_0x25b5('0x10')](_0x25b5('0x11'),_0x379ee8,_0x25b5('0xf'),JSON['stringify'](_0x2cffa6));if(_0x2cffa6['error']){if(_0x2cffa6[_0x25b5('0x12')][_0x25b5('0x13')]===0x1f4){logger[_0x25b5('0x12')](_0x25b5('0xe'),_0x379ee8,_0x2cffa6[_0x25b5('0x12')][_0x25b5('0x14')]);return _0x126fde(_0x2cffa6[_0x25b5('0x12')][_0x25b5('0x14')]);}logger[_0x25b5('0x12')](_0x25b5('0xe'),_0x379ee8,_0x2cffa6[_0x25b5('0x12')][_0x25b5('0x14')]);return _0x2651ac(_0x2cffa6['error']['message']);}else{logger[_0x25b5('0xd')](_0x25b5('0xe'),_0x379ee8,_0x25b5('0xf'));_0x2651ac(_0x2cffa6[_0x25b5('0x15')][_0x25b5('0x14')]);}})['catch'](function(_0x2a5a6a){logger[_0x25b5('0x12')](_0x25b5('0xe'),_0x379ee8,_0x2a5a6a);_0x126fde(_0x2a5a6a);});});}exports[_0x25b5('0x16')]=function(_0x2d8205){var _0x52c452=this;return new Promise(function(_0x51395b,_0x3ee42b){return db['MailApplication'][_0x25b5('0x17')](_0x2d8205['body'],{'raw':_0x2d8205[_0x25b5('0x18')]?_0x2d8205[_0x25b5('0x18')][_0x25b5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d8205[_0x25b5('0x18')]?_0x2d8205[_0x25b5('0x18')][_0x25b5('0x1a')]||null:null,'attributes':_0x2d8205['options']?_0x2d8205[_0x25b5('0x18')][_0x25b5('0x1b')]||null:null,'limit':_0x2d8205[_0x25b5('0x18')]?_0x2d8205['options']['limit']||null:null})['then'](function(_0x17f578){logger['info']('UpdateMailApplication',_0x2d8205);logger[_0x25b5('0x10')](_0x25b5('0x16'),_0x2d8205,JSON[_0x25b5('0x1c')](_0x17f578));_0x51395b(_0x17f578);})[_0x25b5('0x1d')](function(_0x2db330){logger[_0x25b5('0x12')](_0x25b5('0x16'),_0x2db330[_0x25b5('0x14')],_0x2d8205);_0x3ee42b(_0x52c452[_0x25b5('0x12')](0x1f4,_0x2db330[_0x25b5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c9a98f2..c12c97c 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 _0xb45c=['mail','mailinteraction:update','update','delete','tracked','/:id/tags','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','/:id/download','download','post','addMessage','mailinteraction:addtags','addTags','put','/:id'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xb45c,0xfb));var _0xcb45=function(_0x261583,_0x7796bd){_0x261583=_0x261583-0x0;var _0x14db13=_0xb45c[_0x261583];return _0x14db13;};'use strict';var express=require('express');var router=express[_0xcb45('0x0')]();var auth=require(_0xcb45('0x1'));var interaction=require(_0xcb45('0x2'));var controller=require(_0xcb45('0x3'));router['get']('/',auth[_0xcb45('0x4')](),controller[_0xcb45('0x5')]);router[_0xcb45('0x6')](_0xcb45('0x7'),auth[_0xcb45('0x4')](),controller[_0xcb45('0x8')]);router[_0xcb45('0x6')]('/:id',auth[_0xcb45('0x4')](),controller[_0xcb45('0x9')]);router['get'](_0xcb45('0xa'),auth[_0xcb45('0x4')](),controller['getMessages']);router[_0xcb45('0x6')](_0xcb45('0xb'),auth['isAuthenticated'](),controller[_0xcb45('0xc')]);router[_0xcb45('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcb45('0xd')]('/:id/messages',auth[_0xcb45('0x4')](),controller[_0xcb45('0xe')]);router[_0xcb45('0xd')]('/:id/tags',auth[_0xcb45('0x4')](),interaction['tracked']('mail',_0xcb45('0xf')),controller[_0xcb45('0x10')]);router[_0xcb45('0x11')](_0xcb45('0x12'),auth[_0xcb45('0x4')](),interaction['tracked'](_0xcb45('0x13'),_0xcb45('0x14')),controller[_0xcb45('0x15')]);router[_0xcb45('0x16')](_0xcb45('0x12'),auth['isAuthenticated'](),interaction[_0xcb45('0x17')]('mail','mailinteraction:destroy'),controller['destroy']);router['delete'](_0xcb45('0x18'),auth[_0xcb45('0x4')](),controller[_0xcb45('0x19')]);module[_0xcb45('0x1a')]=router; \ No newline at end of file +var _0x5a96=['/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','mail','addTags','put','tracked','update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','get','isAuthenticated','index','describe'];(function(_0x4690f1,_0x10f22f){var _0x5c2b55=function(_0x311b95){while(--_0x311b95){_0x4690f1['push'](_0x4690f1['shift']());}};_0x5c2b55(++_0x10f22f);}(_0x5a96,0x13d));var _0x65a9=function(_0x45dcc7,_0x1469fb){_0x45dcc7=_0x45dcc7-0x0;var _0x42b467=_0x5a96[_0x45dcc7];return _0x42b467;};'use strict';var express=require('express');var router=express[_0x65a9('0x0')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0x65a9('0x1')]('/',auth[_0x65a9('0x2')](),controller[_0x65a9('0x3')]);router[_0x65a9('0x1')]('/describe',auth[_0x65a9('0x2')](),controller[_0x65a9('0x4')]);router[_0x65a9('0x1')](_0x65a9('0x5'),auth[_0x65a9('0x2')](),controller[_0x65a9('0x6')]);router[_0x65a9('0x1')](_0x65a9('0x7'),auth[_0x65a9('0x2')](),controller[_0x65a9('0x8')]);router[_0x65a9('0x1')](_0x65a9('0x9'),auth[_0x65a9('0x2')](),controller['download']);router[_0x65a9('0xa')]('/',auth['isAuthenticated'](),controller[_0x65a9('0xb')]);router[_0x65a9('0xa')]('/:id/messages',auth[_0x65a9('0x2')](),controller['addMessage']);router['post'](_0x65a9('0xc'),auth[_0x65a9('0x2')](),interaction['tracked'](_0x65a9('0xd'),'mailinteraction:addtags'),controller[_0x65a9('0xe')]);router[_0x65a9('0xf')](_0x65a9('0x5'),auth[_0x65a9('0x2')](),interaction[_0x65a9('0x10')](_0x65a9('0xd'),'mailinteraction:update'),controller[_0x65a9('0x11')]);router[_0x65a9('0x12')](_0x65a9('0x5'),auth[_0x65a9('0x2')](),interaction[_0x65a9('0x10')](_0x65a9('0xd'),_0x65a9('0x13')),controller[_0x65a9('0x14')]);router[_0x65a9('0x12')](_0x65a9('0xc'),auth[_0x65a9('0x2')](),controller[_0x65a9('0x15')]);module[_0x65a9('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 5e93c90..f6fa333 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 _0x8f6c=['TEXT','long','BOOLEAN','ENUM','out','sequelize','iconv','exports','DATE','STRING'];(function(_0x184f11,_0x163b8a){var _0x32cf55=function(_0x180119){while(--_0x180119){_0x184f11['push'](_0x184f11['shift']());}};_0x32cf55(++_0x163b8a);}(_0x8f6c,0x145));var _0xc8f6=function(_0x44867c,_0x5956cd){_0x44867c=_0x44867c-0x0;var _0x364ae1=_0x8f6c[_0x44867c];return _0x364ae1;};'use strict';var Sequelize=require(_0xc8f6('0x0'));var iconv=require(_0xc8f6('0x1'));module[_0xc8f6('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8f6('0x3')]},'disposition':{'type':Sequelize[_0xc8f6('0x4')]},'secondDisposition':{'type':Sequelize[_0xc8f6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc8f6('0x4')]},'note':{'type':Sequelize[_0xc8f6('0x4')]},'inReplyTo':{'type':Sequelize[_0xc8f6('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc8f6('0x4')]},'cc':{'type':Sequelize[_0xc8f6('0x5')](_0xc8f6('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xc8f6('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xc8f6('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc8f6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc8f6('0x8')]('in',_0xc8f6('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc8f6('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc8f6('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc8f6('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe008=['BOOLEAN','DATE','out','INTEGER','sequelize','iconv','exports','STRING','TEXT','long'];(function(_0x505919,_0x447921){var _0x23087d=function(_0x4d469a){while(--_0x4d469a){_0x505919['push'](_0x505919['shift']());}};_0x23087d(++_0x447921);}(_0xe008,0x11c));var _0x8e00=function(_0x54fc35,_0x45abe3){_0x54fc35=_0x54fc35-0x0;var _0xc41229=_0xe008[_0x54fc35];return _0xc41229;};'use strict';var Sequelize=require(_0x8e00('0x0'));var iconv=require(_0x8e00('0x1'));module[_0x8e00('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8e00('0x3')]},'secondDisposition':{'type':Sequelize[_0x8e00('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8e00('0x3')]},'note':{'type':Sequelize[_0x8e00('0x3')]},'inReplyTo':{'type':Sequelize[_0x8e00('0x3')](0x1fe)},'to':{'type':Sequelize[_0x8e00('0x3')]},'cc':{'type':Sequelize[_0x8e00('0x4')](_0x8e00('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x8e00('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8e00('0x7')]},'substatus':{'type':Sequelize[_0x8e00('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8e00('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8e00('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8e00('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8e00('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 6f57e30..d5a4154 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 _0xdfd3=['limit','status','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','key','getOptions','findAll','user','catch','show','params','model','keys','query','filters','attributes','intersection','fields','includeAll','merge','options','find','create','body','MailInteraction','describe','addMessage','MailMessage','ids','getMessages','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','type','readFileSync','build','writeFileSync','message%d.eml','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','html-entities','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','json','offset','undefined','count'];(function(_0x29eb44,_0x300719){var _0x4512ac=function(_0x183803){while(--_0x183803){_0x29eb44['push'](_0x29eb44['shift']());}};_0x4512ac(++_0x300719);}(_0xdfd3,0x1b8));var _0x3dfd=function(_0x36d04d,_0x469817){_0x36d04d=_0x36d04d-0x0;var _0x213b48=_0xdfd3[_0x36d04d];return _0x213b48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3dfd('0x0'));var zipdir=require(_0x3dfd('0x1'));var moment=require(_0x3dfd('0x2'));var BPromise=require(_0x3dfd('0x3'));var util=require(_0x3dfd('0x4'));var path=require(_0x3dfd('0x5'));var fs=require('fs');var _=require(_0x3dfd('0x6'));var juice=require(_0x3dfd('0x7'));var Redis=require(_0x3dfd('0x8'));var interaction=require(_0x3dfd('0x9'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3dfd('0xa'));var config=require(_0x3dfd('0xb'));var db=require(_0x3dfd('0xc'))['db'];var htmlEntities=require(_0x3dfd('0xd'));config['redis']=_['defaults'](config['redis'],{'host':_0x3dfd('0xe'),'port':0x18eb});var socket=require(_0x3dfd('0xf'))(new Redis(config['redis']));require(_0x3dfd('0x10'))[_0x3dfd('0x11')](socket);function respondWithStatusCode(_0x96fb09,_0x2691b7){_0x2691b7=_0x2691b7||0xcc;return function(_0x4d72cd){if(_0x4d72cd){return _0x96fb09[_0x3dfd('0x12')](_0x2691b7);}return _0x96fb09['status'](_0x2691b7)[_0x3dfd('0x13')]();};}function respondWithResult(_0x756b9c,_0xd86242){_0xd86242=_0xd86242||0xc8;return function(_0x1d4430){if(_0x1d4430){return _0x756b9c['status'](_0xd86242)[_0x3dfd('0x14')](_0x1d4430);}};}function respondWithFilteredResult(_0x324bb7,_0x2166b1){return function(_0x14cd07){if(_0x14cd07){var _0x112d44=typeof _0x2166b1[_0x3dfd('0x15')]===_0x3dfd('0x16')&&typeof _0x2166b1['limit']===_0x3dfd('0x16');var _0x178b37=_0x14cd07['count'];var _0x335a02=_0x112d44?0x0:_0x2166b1[_0x3dfd('0x15')];var _0x25c4cc=_0x112d44?_0x14cd07[_0x3dfd('0x17')]:_0x2166b1['offset']+_0x2166b1[_0x3dfd('0x18')];var _0x1cb669;if(_0x25c4cc>=_0x178b37){_0x25c4cc=_0x178b37;_0x1cb669=0xc8;}else{_0x1cb669=0xce;}_0x324bb7[_0x3dfd('0x19')](_0x1cb669);return _0x324bb7['set']('Content-Range',_0x335a02+'-'+_0x25c4cc+'/'+_0x178b37)[_0x3dfd('0x14')](_0x14cd07);}return null;};}function saveUpdates(_0x12096f){return function(_0x25c3a2){if(_0x25c3a2){return _0x25c3a2[_0x3dfd('0x1a')](_0x12096f)['then'](function(_0x4599ab){return _0x4599ab;});}return null;};}function removeEntity(_0x49172c){return function(_0xdd8a0b){if(_0xdd8a0b){return _0xdd8a0b[_0x3dfd('0x1b')]()[_0x3dfd('0x1c')](function(){_0x49172c[_0x3dfd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38ee1a){return function(_0x23eb03){if(!_0x23eb03){_0x38ee1a[_0x3dfd('0x12')](0x194);}return _0x23eb03;};}function handleError(_0x322df9,_0x137824){_0x137824=_0x137824||0x1f4;return function(_0x4d2397){logger[_0x3dfd('0x1d')](_0x4d2397[_0x3dfd('0x1e')]);if(_0x4d2397[_0x3dfd('0x1f')]){delete _0x4d2397['name'];}_0x322df9[_0x3dfd('0x19')](_0x137824)['send'](_0x4d2397);};}exports[_0x3dfd('0x20')]=function(_0x49b99c,_0x5c566e){var _0x2202d8={};var _0x1074e6=_[_0x3dfd('0x21')](db['MailInteraction'][_0x3dfd('0x22')],function(_0x32b751){return{'name':_0x32b751[_0x3dfd('0x23')],'type':_0x32b751['type'][_0x3dfd('0x24')]};});_0x2202d8=qs[_0x3dfd('0x25')](_0x1074e6,_0x49b99c);return interaction[_0x3dfd('0x26')]('mail',_0x49b99c['query'],_0x49b99c[_0x3dfd('0x27')],_0x2202d8,_0x1074e6)['then'](respondWithFilteredResult(_0x5c566e,_0x2202d8))[_0x3dfd('0x28')](handleError(_0x5c566e,null));};exports[_0x3dfd('0x29')]=function(_0x28c78f,_0x5207ea){var _0x374153={'raw':![],'where':{'id':_0x28c78f[_0x3dfd('0x2a')]['id']}},_0x2c0f40={};_0x2c0f40[_0x3dfd('0x2b')]=_[_0x3dfd('0x2c')](db['MailInteraction'][_0x3dfd('0x22')]);_0x2c0f40[_0x3dfd('0x2d')]=_[_0x3dfd('0x2c')](_0x28c78f[_0x3dfd('0x2d')]);_0x2c0f40[_0x3dfd('0x2e')]=_['intersection'](_0x2c0f40[_0x3dfd('0x2b')],_0x2c0f40[_0x3dfd('0x2d')]);_0x374153[_0x3dfd('0x2f')]=_[_0x3dfd('0x30')](_0x2c0f40['model'],qs[_0x3dfd('0x31')](_0x28c78f[_0x3dfd('0x2d')][_0x3dfd('0x31')]));_0x374153[_0x3dfd('0x2f')]=_0x374153[_0x3dfd('0x2f')]['length']?_0x374153[_0x3dfd('0x2f')]:_0x2c0f40[_0x3dfd('0x2b')];if(_0x28c78f['query'][_0x3dfd('0x32')]){_0x374153['include']=[{'all':!![]}];}_0x374153=_[_0x3dfd('0x33')]({},_0x374153,_0x28c78f[_0x3dfd('0x34')]);return db['MailInteraction'][_0x3dfd('0x35')](_0x374153)[_0x3dfd('0x1c')](handleEntityNotFound(_0x5207ea,null))['then'](respondWithResult(_0x5207ea,null))[_0x3dfd('0x28')](handleError(_0x5207ea,null));};exports[_0x3dfd('0x36')]=function(_0x23a29f,_0x3975c8){return db['MailInteraction']['create'](_0x23a29f[_0x3dfd('0x37')],{})[_0x3dfd('0x1c')](respondWithResult(_0x3975c8,0xc9))[_0x3dfd('0x28')](handleError(_0x3975c8,null));};exports[_0x3dfd('0x1a')]=function(_0x3b8a65,_0x168e6a){if(_0x3b8a65['body']['id']){delete _0x3b8a65['body']['id'];}return db[_0x3dfd('0x38')][_0x3dfd('0x35')]({'where':{'id':_0x3b8a65[_0x3dfd('0x2a')]['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x168e6a,null))[_0x3dfd('0x1c')](saveUpdates(_0x3b8a65[_0x3dfd('0x37')],null))[_0x3dfd('0x1c')](respondWithResult(_0x168e6a,null))[_0x3dfd('0x28')](handleError(_0x168e6a,null));};exports[_0x3dfd('0x1b')]=function(_0x428240,_0x39a1f1){return db[_0x3dfd('0x38')][_0x3dfd('0x35')]({'where':{'id':_0x428240[_0x3dfd('0x2a')]['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x39a1f1,null))['then'](removeEntity(_0x39a1f1,null))['catch'](handleError(_0x39a1f1,null));};exports[_0x3dfd('0x39')]=function(_0x43c7d2,_0x4a217f){return db[_0x3dfd('0x38')][_0x3dfd('0x39')]()[_0x3dfd('0x1c')](respondWithResult(_0x4a217f,null))[_0x3dfd('0x28')](handleError(_0x4a217f,null));};exports[_0x3dfd('0x3a')]=function(_0x5da65a,_0x53d1f2){return db[_0x3dfd('0x3b')][_0x3dfd('0x35')]({'where':{'id':_0x5da65a['params']['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x53d1f2,null))['then'](function(_0x2d2c4a){if(_0x2d2c4a){return _0x2d2c4a[_0x3dfd('0x3a')](_0x5da65a[_0x3dfd('0x37')][_0x3dfd('0x3c')],_['omit'](_0x5da65a['body'],[_0x3dfd('0x3c'),'id'])||{});}})[_0x3dfd('0x1c')](respondWithResult(_0x53d1f2,null))[_0x3dfd('0x28')](handleError(_0x53d1f2,null));};exports[_0x3dfd('0x3d')]=function(_0x541da8,_0x1df0a9){var _0x2fc579={'raw':![],'where':{}};var _0x31fb77={};var _0x49e8ef={'count':0x0,'rows':[]};return db[_0x3dfd('0x38')]['findOne']({'where':{'id':_0x541da8[_0x3dfd('0x2a')]['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x1df0a9,null))[_0x3dfd('0x1c')](function(_0x1826a8){if(_0x1826a8){_0x31fb77['model']=_[_0x3dfd('0x2c')](db['MailMessage'][_0x3dfd('0x22')]);_0x31fb77[_0x3dfd('0x2d')]=_['keys'](_0x541da8[_0x3dfd('0x2d')]);_0x31fb77[_0x3dfd('0x2e')]=_['intersection'](_0x31fb77[_0x3dfd('0x2b')],_0x31fb77[_0x3dfd('0x2d')]);_0x2fc579[_0x3dfd('0x2f')]=_[_0x3dfd('0x30')](_0x31fb77[_0x3dfd('0x2b')],qs['fields'](_0x541da8['query'][_0x3dfd('0x31')]));_0x2fc579[_0x3dfd('0x2f')]=_0x2fc579[_0x3dfd('0x2f')][_0x3dfd('0x3e')]?_0x2fc579[_0x3dfd('0x2f')]:_0x31fb77[_0x3dfd('0x2b')];if(!_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x3f')](_0x3dfd('0x40'))){_0x2fc579[_0x3dfd('0x18')]=qs[_0x3dfd('0x18')](_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x18')]);_0x2fc579[_0x3dfd('0x15')]=qs[_0x3dfd('0x15')](_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x15')]);}_0x2fc579[_0x3dfd('0x41')]=qs['sort'](_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x42')]);_0x2fc579[_0x3dfd('0x43')]=qs[_0x3dfd('0x2e')](_[_0x3dfd('0x44')](_0x541da8[_0x3dfd('0x2d')],_0x31fb77[_0x3dfd('0x2e')]));_0x2fc579[_0x3dfd('0x43')][_0x3dfd('0x45')]=_0x1826a8['id'];if(_0x541da8['query']['filter']){_0x2fc579['where']=_[_0x3dfd('0x33')](_0x2fc579[_0x3dfd('0x43')],{'$or':_['map'](_0x2fc579[_0x3dfd('0x2f')],function(_0x125434){var _0x542bc6={};_0x542bc6[_0x125434]={'$like':'%'+_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x46')]+'%'};return _0x542bc6;})});}if(_0x541da8['query'][_0x3dfd('0x47')]){var _0x535839=_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x47')][_0x3dfd('0x48')](',');var _0x1449c1={};_0x1449c1[_0x535839[0x0]]={'$gte':moment(_0x535839[0x1])[_0x3dfd('0x49')](_0x3dfd('0x4a'))};_0x2fc579[_0x3dfd('0x43')]=_['merge'](_0x2fc579['where'],_0x1449c1);}_0x2fc579=_[_0x3dfd('0x33')]({},_0x2fc579,_0x541da8[_0x3dfd('0x34')]);return db[_0x3dfd('0x3b')][_0x3dfd('0x17')]({'where':_0x2fc579[_0x3dfd('0x43')]})[_0x3dfd('0x1c')](function(_0x556c3b){_0x49e8ef[_0x3dfd('0x17')]=_0x556c3b;if(_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x32')]){_0x2fc579[_0x3dfd('0x4b')]=[{'all':!![]}];}return db['MailMessage'][_0x3dfd('0x26')](_0x2fc579);})[_0x3dfd('0x1c')](function(_0x52566a){if(_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x4c')]==='true'){for(var _0x1fb0fd=0x0;_0x1fb0fd<_0x52566a['length'];_0x1fb0fd++){_0x52566a[_0x1fb0fd][_0x3dfd('0x37')]=juice(_0x52566a[_0x1fb0fd][_0x3dfd('0x37')]);}}_0x49e8ef[_0x3dfd('0x4d')]=_0x52566a;return _0x49e8ef;});}})[_0x3dfd('0x1c')](respondWithFilteredResult(_0x1df0a9,_0x2fc579))[_0x3dfd('0x28')](handleError(_0x1df0a9,null));};exports[_0x3dfd('0x4e')]=function(_0x31c0d9,_0x113576){return db['MailInteraction'][_0x3dfd('0x35')]({'where':{'id':_0x31c0d9[_0x3dfd('0x2a')]['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x113576,null))[_0x3dfd('0x1c')](function(_0x1bb63d){if(_0x1bb63d){return _0x1bb63d[_0x3dfd('0x4f')](_0x31c0d9[_0x3dfd('0x37')]['ids'],_[_0x3dfd('0x50')](_0x31c0d9[_0x3dfd('0x37')],[_0x3dfd('0x3c'),'id'])||{})[_0x3dfd('0x51')](function(){return db[_0x3dfd('0x52')]['findAll']({'attributes':['id',_0x3dfd('0x1f'),_0x3dfd('0x53')],'where':{'id':_0x31c0d9[_0x3dfd('0x37')][_0x3dfd('0x3c')]}});})['then'](function(_0x360d32){socket[_0x3dfd('0x54')](_0x3dfd('0x55'),{'id':Number(_0x31c0d9[_0x3dfd('0x2a')]['id']),'tags':_0x360d32||[]});return{'id':Number(_0x31c0d9[_0x3dfd('0x2a')]['id']),'tags':_0x360d32||[]};});}})[_0x3dfd('0x1c')](respondWithResult(_0x113576,null))[_0x3dfd('0x28')](handleError(_0x113576,null));};exports['removeTags']=function(_0x40545b,_0x2ed0d2){return db[_0x3dfd('0x38')][_0x3dfd('0x35')]({'where':{'id':_0x40545b['params']['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x2ed0d2,null))['then'](function(_0x5d9921){if(_0x5d9921){return _0x5d9921['removeTags'](_0x40545b['query'][_0x3dfd('0x3c')]);}})[_0x3dfd('0x1c')](respondWithStatusCode(_0x2ed0d2,null))['catch'](handleError(_0x2ed0d2,null));};exports[_0x3dfd('0x56')]=function(_0x4aea65,_0x17523f){var _0x17040e=moment()[_0x3dfd('0x57')]()[_0x3dfd('0x58')]();var _0x81e8ee=path[_0x3dfd('0x59')](config[_0x3dfd('0x5a')],_0x3dfd('0x5b'),_0x3dfd('0x5c'),_0x3dfd('0x5d'));var _0x56c886=path[_0x3dfd('0x59')](config[_0x3dfd('0x5a')],'server',_0x3dfd('0x5c'),_0x3dfd('0x5e'));var _0x1ed436=path['join'](_0x81e8ee,_0x17040e);var _0x3d9b3b=util[_0x3dfd('0x49')](_0x3dfd('0x5f'),_0x4aea65['params']['id'],_0x17040e);var _0x53c8c8=path['join'](_0x81e8ee,_0x3d9b3b);var _0x2e782f=[];if(_0x4aea65[_0x3dfd('0x2d')][_0x3dfd('0x5e')]){_0x2e782f['push']({'model':db[_0x3dfd('0x60')],'as':'Attachments','raw':!![]});}var _0x2d0f61=[{'model':db['MailMessage'],'as':_0x3dfd('0x61'),'attributes':['id','body',_0x3dfd('0x62'),'to','cc',_0x3dfd('0x63'),_0x3dfd('0x64'),_0x3dfd('0x65')],'where':{'secret':![]},'order':qs[_0x3dfd('0x42')]('id'),'include':_0x2e782f}];return db[_0x3dfd('0x38')][_0x3dfd('0x35')]({'where':{'id':_0x4aea65[_0x3dfd('0x2a')]['id']},'include':_0x2d0f61})['then'](handleEntityNotFound(_0x17523f,null))['then'](function(_0x9357e4){if(_0x9357e4&&_0x9357e4['Messages']){var _0x4470be=_0x9357e4[_0x3dfd('0x66')]({'plain':!![]});fs[_0x3dfd('0x67')](_0x1ed436);return BPromise[_0x3dfd('0x68')](_0x4470be['Messages'],function(_0x493f91,_0x2bc78d){var _0x3700d8={'from':_0x493f91[_0x3dfd('0x62')],'to':_0x493f91['to']||'missing.recipient@your.company.com','subject':_0x493f91['subject'],'html':htmlEntities['decode'](_0x493f91[_0x3dfd('0x37')]),'headers':{'Date':moment(_0x493f91['createdAt'])[_0x3dfd('0x49')](_0x3dfd('0x69'))},'attachments':[]};if(_0x493f91['cc']){_0x3700d8[_0x3dfd('0x6a')]['Cc']=_0x493f91['cc'];}if(_0x493f91['bcc']){_0x3700d8[_0x3dfd('0x6a')][_0x3dfd('0x6b')]=_0x493f91[_0x3dfd('0x63')];}return new BPromise(function(_0x251e9a,_0x3f38a0){if(_0x493f91[_0x3dfd('0x6c')]){for(var _0x235213=0x0;_0x235213<_0x493f91[_0x3dfd('0x6c')][_0x3dfd('0x3e')];_0x235213++){var _0x4eeef5=_0x493f91[_0x3dfd('0x6c')][_0x235213];var _0x4bbc34=path[_0x3dfd('0x59')](_0x56c886,_0x4eeef5[_0x3dfd('0x6d')]);if(fs[_0x3dfd('0x6e')](_0x4bbc34)){_0x3700d8['attachments']['push']({'name':_0x4eeef5[_0x3dfd('0x1f')],'contentType':_0x4eeef5[_0x3dfd('0x6f')],'data':fs[_0x3dfd('0x70')](_0x4bbc34)});}}}emlformat[_0x3dfd('0x71')](_0x3700d8,function(_0xd07474,_0x2025a2){if(_0xd07474)return _0x3f38a0(_0xd07474);fs[_0x3dfd('0x72')](path['join'](_0x1ed436,util[_0x3dfd('0x49')](_0x3dfd('0x73'),_0x2bc78d)),_0x2025a2);return _0x251e9a(_0x2025a2);});});})['then'](function(){return new BPromise(function(_0x3dcffe,_0x174167){zipdir(_0x1ed436,{'saveTo':_0x53c8c8},function(_0x59de02,_0x4d29aa){if(_0x59de02)return _0x174167(_0x59de02);return _0x3dcffe(_0x4d29aa);});})[_0x3dfd('0x1c')](function(){return new BPromise(function(_0x5ef00c,_0x30b996){rimraf(_0x1ed436,function(_0x5b1b0b){if(_0x5b1b0b)_0x30b996(_0x5b1b0b);return _0x5ef00c();});});})[_0x3dfd('0x1c')](function(){return _0x17523f[_0x3dfd('0x56')](_0x53c8c8,_0x3d9b3b,function(_0x48108f){if(!_0x48108f)fs['unlinkSync'](_0x53c8c8);});});});}else{return _0x17523f[_0x3dfd('0x12')](0xc8);}})[_0x3dfd('0x28')](handleError(_0x17523f,null));}; \ No newline at end of file +var _0x3007=['map','MailInteraction','fieldName','type','key','getOptions','findAll','mail','query','user','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','MailMessage','ids','getMessages','rawAttributes','length','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','inlineCss','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','server','files','root','attachments','transcript-%d-%s.zip','Attachments','Messages','from','bcc','subject','createdAt','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','push','readFileSync','writeFileSync','message%d.eml','eml-format','zip-dir','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','end','json','offset','undefined','count','limit','status','Content-Range','then','destroy','sendStatus','error','stack','name','index'];(function(_0x49bba8,_0x3a9f40){var _0x5dca5d=function(_0x526539){while(--_0x526539){_0x49bba8['push'](_0x49bba8['shift']());}};_0x5dca5d(++_0x3a9f40);}(_0x3007,0xc0));var _0x7300=function(_0x4898f0,_0x49fb26){_0x4898f0=_0x4898f0-0x0;var _0x58b576=_0x3007[_0x4898f0];return _0x58b576;};'use strict';var emlformat=require(_0x7300('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7300('0x1'));var moment=require('moment');var BPromise=require(_0x7300('0x2'));var util=require(_0x7300('0x3'));var path=require(_0x7300('0x4'));var fs=require('fs');var _=require(_0x7300('0x5'));var juice=require(_0x7300('0x6'));var Redis=require(_0x7300('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x7300('0x8'));var logger=require(_0x7300('0x9'))(_0x7300('0xa'));var config=require(_0x7300('0xb'));var db=require(_0x7300('0xc'))['db'];var htmlEntities=require(_0x7300('0xd'));config[_0x7300('0xe')]=_[_0x7300('0xf')](config[_0x7300('0xe')],{'host':_0x7300('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7300('0xe')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x245430,_0x1092c9){_0x1092c9=_0x1092c9||0xcc;return function(_0x23bdc5){if(_0x23bdc5){return _0x245430['sendStatus'](_0x1092c9);}return _0x245430['status'](_0x1092c9)[_0x7300('0x11')]();};}function respondWithResult(_0x42afd3,_0x29d8c3){_0x29d8c3=_0x29d8c3||0xc8;return function(_0x51570f){if(_0x51570f){return _0x42afd3['status'](_0x29d8c3)[_0x7300('0x12')](_0x51570f);}};}function respondWithFilteredResult(_0x5e3bbe,_0x3c0c0b){return function(_0x146055){if(_0x146055){var _0x3457f8=typeof _0x3c0c0b[_0x7300('0x13')]===_0x7300('0x14')&&typeof _0x3c0c0b['limit']===_0x7300('0x14');var _0x4c7c4f=_0x146055[_0x7300('0x15')];var _0x2993d5=_0x3457f8?0x0:_0x3c0c0b['offset'];var _0x951503=_0x3457f8?_0x146055[_0x7300('0x15')]:_0x3c0c0b[_0x7300('0x13')]+_0x3c0c0b[_0x7300('0x16')];var _0x43c6b7;if(_0x951503>=_0x4c7c4f){_0x951503=_0x4c7c4f;_0x43c6b7=0xc8;}else{_0x43c6b7=0xce;}_0x5e3bbe[_0x7300('0x17')](_0x43c6b7);return _0x5e3bbe['set'](_0x7300('0x18'),_0x2993d5+'-'+_0x951503+'/'+_0x4c7c4f)[_0x7300('0x12')](_0x146055);}return null;};}function saveUpdates(_0x31719a){return function(_0xff3be0){if(_0xff3be0){return _0xff3be0['update'](_0x31719a)[_0x7300('0x19')](function(_0x47a767){return _0x47a767;});}return null;};}function removeEntity(_0x460283){return function(_0x2a8b41){if(_0x2a8b41){return _0x2a8b41[_0x7300('0x1a')]()['then'](function(){_0x460283[_0x7300('0x17')](0xcc)[_0x7300('0x11')]();});}};}function handleEntityNotFound(_0x5565f4){return function(_0x510d79){if(!_0x510d79){_0x5565f4[_0x7300('0x1b')](0x194);}return _0x510d79;};}function handleError(_0x3a0f8c,_0x3dbafd){_0x3dbafd=_0x3dbafd||0x1f4;return function(_0x165ecb){logger[_0x7300('0x1c')](_0x165ecb[_0x7300('0x1d')]);if(_0x165ecb[_0x7300('0x1e')]){delete _0x165ecb['name'];}_0x3a0f8c[_0x7300('0x17')](_0x3dbafd)['send'](_0x165ecb);};}exports[_0x7300('0x1f')]=function(_0x131842,_0x1716c2){var _0x202dde={};var _0x527369=_[_0x7300('0x20')](db[_0x7300('0x21')]['rawAttributes'],function(_0x356f2a){return{'name':_0x356f2a[_0x7300('0x22')],'type':_0x356f2a[_0x7300('0x23')][_0x7300('0x24')]};});_0x202dde=qs[_0x7300('0x25')](_0x527369,_0x131842);return interaction[_0x7300('0x26')](_0x7300('0x27'),_0x131842[_0x7300('0x28')],_0x131842[_0x7300('0x29')],_0x202dde,_0x527369)[_0x7300('0x19')](respondWithFilteredResult(_0x1716c2,_0x202dde))['catch'](handleError(_0x1716c2,null));};exports[_0x7300('0x2a')]=function(_0x2ae0c1,_0x379a00){var _0x50f520={'raw':![],'where':{'id':_0x2ae0c1[_0x7300('0x2b')]['id']}},_0x4eec17={};_0x4eec17[_0x7300('0x2c')]=_[_0x7300('0x2d')](db[_0x7300('0x21')]['rawAttributes']);_0x4eec17['query']=_[_0x7300('0x2d')](_0x2ae0c1[_0x7300('0x28')]);_0x4eec17[_0x7300('0x2e')]=_[_0x7300('0x2f')](_0x4eec17[_0x7300('0x2c')],_0x4eec17[_0x7300('0x28')]);_0x50f520[_0x7300('0x30')]=_[_0x7300('0x2f')](_0x4eec17[_0x7300('0x2c')],qs['fields'](_0x2ae0c1['query'][_0x7300('0x31')]));_0x50f520[_0x7300('0x30')]=_0x50f520['attributes']['length']?_0x50f520[_0x7300('0x30')]:_0x4eec17[_0x7300('0x2c')];if(_0x2ae0c1['query'][_0x7300('0x32')]){_0x50f520[_0x7300('0x33')]=[{'all':!![]}];}_0x50f520=_[_0x7300('0x34')]({},_0x50f520,_0x2ae0c1[_0x7300('0x35')]);return db[_0x7300('0x21')][_0x7300('0x36')](_0x50f520)[_0x7300('0x19')](handleEntityNotFound(_0x379a00,null))[_0x7300('0x19')](respondWithResult(_0x379a00,null))[_0x7300('0x37')](handleError(_0x379a00,null));};exports[_0x7300('0x38')]=function(_0xad3793,_0x4ead96){return db['MailInteraction'][_0x7300('0x38')](_0xad3793[_0x7300('0x39')],{})[_0x7300('0x19')](respondWithResult(_0x4ead96,0xc9))['catch'](handleError(_0x4ead96,null));};exports['update']=function(_0x378352,_0x287fef){if(_0x378352[_0x7300('0x39')]['id']){delete _0x378352[_0x7300('0x39')]['id'];}return db[_0x7300('0x21')][_0x7300('0x36')]({'where':{'id':_0x378352[_0x7300('0x2b')]['id']}})[_0x7300('0x19')](handleEntityNotFound(_0x287fef,null))[_0x7300('0x19')](saveUpdates(_0x378352[_0x7300('0x39')],null))[_0x7300('0x19')](respondWithResult(_0x287fef,null))[_0x7300('0x37')](handleError(_0x287fef,null));};exports[_0x7300('0x1a')]=function(_0x235606,_0x5814c7){return db['MailInteraction']['find']({'where':{'id':_0x235606[_0x7300('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5814c7,null))[_0x7300('0x19')](removeEntity(_0x5814c7,null))['catch'](handleError(_0x5814c7,null));};exports[_0x7300('0x3a')]=function(_0x239733,_0x41cab6){return db['MailInteraction'][_0x7300('0x3a')]()[_0x7300('0x19')](respondWithResult(_0x41cab6,null))[_0x7300('0x37')](handleError(_0x41cab6,null));};exports[_0x7300('0x3b')]=function(_0x40a978,_0x4dca77){return db[_0x7300('0x3c')]['find']({'where':{'id':_0x40a978['params']['id']}})[_0x7300('0x19')](handleEntityNotFound(_0x4dca77,null))[_0x7300('0x19')](function(_0x49d29c){if(_0x49d29c){return _0x49d29c['addMessage'](_0x40a978[_0x7300('0x39')][_0x7300('0x3d')],_['omit'](_0x40a978[_0x7300('0x39')],['ids','id'])||{});}})[_0x7300('0x19')](respondWithResult(_0x4dca77,null))[_0x7300('0x37')](handleError(_0x4dca77,null));};exports[_0x7300('0x3e')]=function(_0x13978a,_0x2cdce8){var _0x9c86ae={'raw':![],'where':{}};var _0x3caa05={};var _0x2ee94a={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x13978a[_0x7300('0x2b')]['id']}})[_0x7300('0x19')](handleEntityNotFound(_0x2cdce8,null))[_0x7300('0x19')](function(_0x1838ac){if(_0x1838ac){_0x3caa05[_0x7300('0x2c')]=_[_0x7300('0x2d')](db[_0x7300('0x3c')][_0x7300('0x3f')]);_0x3caa05[_0x7300('0x28')]=_[_0x7300('0x2d')](_0x13978a[_0x7300('0x28')]);_0x3caa05['filters']=_[_0x7300('0x2f')](_0x3caa05[_0x7300('0x2c')],_0x3caa05[_0x7300('0x28')]);_0x9c86ae['attributes']=_[_0x7300('0x2f')](_0x3caa05[_0x7300('0x2c')],qs[_0x7300('0x31')](_0x13978a[_0x7300('0x28')][_0x7300('0x31')]));_0x9c86ae[_0x7300('0x30')]=_0x9c86ae[_0x7300('0x30')][_0x7300('0x40')]?_0x9c86ae[_0x7300('0x30')]:_0x3caa05[_0x7300('0x2c')];if(!_0x13978a[_0x7300('0x28')]['hasOwnProperty'](_0x7300('0x41'))){_0x9c86ae[_0x7300('0x16')]=qs['limit'](_0x13978a[_0x7300('0x28')][_0x7300('0x16')]);_0x9c86ae[_0x7300('0x13')]=qs[_0x7300('0x13')](_0x13978a[_0x7300('0x28')][_0x7300('0x13')]);}_0x9c86ae[_0x7300('0x42')]=qs['sort'](_0x13978a[_0x7300('0x28')][_0x7300('0x43')]);_0x9c86ae[_0x7300('0x44')]=qs[_0x7300('0x2e')](_[_0x7300('0x45')](_0x13978a[_0x7300('0x28')],_0x3caa05[_0x7300('0x2e')]));_0x9c86ae[_0x7300('0x44')][_0x7300('0x46')]=_0x1838ac['id'];if(_0x13978a[_0x7300('0x28')][_0x7300('0x47')]){_0x9c86ae[_0x7300('0x44')]=_[_0x7300('0x34')](_0x9c86ae[_0x7300('0x44')],{'$or':_[_0x7300('0x20')](_0x9c86ae[_0x7300('0x30')],function(_0x53dad7){var _0x4ea656={};_0x4ea656[_0x53dad7]={'$like':'%'+_0x13978a['query'][_0x7300('0x47')]+'%'};return _0x4ea656;})});}if(_0x13978a[_0x7300('0x28')][_0x7300('0x48')]){var _0x3fdac6=_0x13978a[_0x7300('0x28')][_0x7300('0x48')][_0x7300('0x49')](',');var _0x2c1043={};_0x2c1043[_0x3fdac6[0x0]]={'$gte':moment(_0x3fdac6[0x1])[_0x7300('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x9c86ae['where']=_[_0x7300('0x34')](_0x9c86ae[_0x7300('0x44')],_0x2c1043);}_0x9c86ae=_['merge']({},_0x9c86ae,_0x13978a[_0x7300('0x35')]);return db[_0x7300('0x3c')][_0x7300('0x15')]({'where':_0x9c86ae[_0x7300('0x44')]})[_0x7300('0x19')](function(_0x49e8d2){_0x2ee94a[_0x7300('0x15')]=_0x49e8d2;if(_0x13978a[_0x7300('0x28')][_0x7300('0x32')]){_0x9c86ae[_0x7300('0x33')]=[{'all':!![]}];}return db[_0x7300('0x3c')][_0x7300('0x26')](_0x9c86ae);})[_0x7300('0x19')](function(_0x2314fc){if(_0x13978a['query'][_0x7300('0x4b')]==='true'){for(var _0x46234c=0x0;_0x46234c<_0x2314fc[_0x7300('0x40')];_0x46234c++){_0x2314fc[_0x46234c][_0x7300('0x39')]=juice(_0x2314fc[_0x46234c][_0x7300('0x39')]);}}_0x2ee94a[_0x7300('0x4c')]=_0x2314fc;return _0x2ee94a;});}})[_0x7300('0x19')](respondWithFilteredResult(_0x2cdce8,_0x9c86ae))[_0x7300('0x37')](handleError(_0x2cdce8,null));};exports[_0x7300('0x4d')]=function(_0x52a9f6,_0x32914a){return db[_0x7300('0x21')][_0x7300('0x36')]({'where':{'id':_0x52a9f6[_0x7300('0x2b')]['id']}})[_0x7300('0x19')](handleEntityNotFound(_0x32914a,null))[_0x7300('0x19')](function(_0x2faad5){if(_0x2faad5){return _0x2faad5[_0x7300('0x4e')](_0x52a9f6[_0x7300('0x39')]['ids'],_[_0x7300('0x4f')](_0x52a9f6[_0x7300('0x39')],[_0x7300('0x3d'),'id'])||{})[_0x7300('0x50')](function(){return db[_0x7300('0x51')]['findAll']({'attributes':['id',_0x7300('0x1e'),_0x7300('0x52')],'where':{'id':_0x52a9f6[_0x7300('0x39')][_0x7300('0x3d')]}});})[_0x7300('0x19')](function(_0x1f31e6){socket[_0x7300('0x53')](_0x7300('0x54'),{'id':Number(_0x52a9f6['params']['id']),'tags':_0x1f31e6||[]});return{'id':Number(_0x52a9f6[_0x7300('0x2b')]['id']),'tags':_0x1f31e6||[]};});}})[_0x7300('0x19')](respondWithResult(_0x32914a,null))[_0x7300('0x37')](handleError(_0x32914a,null));};exports[_0x7300('0x55')]=function(_0x28475a,_0x5729c9){return db[_0x7300('0x21')][_0x7300('0x36')]({'where':{'id':_0x28475a[_0x7300('0x2b')]['id']}})[_0x7300('0x19')](handleEntityNotFound(_0x5729c9,null))[_0x7300('0x19')](function(_0x18d6f1){if(_0x18d6f1){return _0x18d6f1['removeTags'](_0x28475a[_0x7300('0x28')][_0x7300('0x3d')]);}})[_0x7300('0x19')](respondWithStatusCode(_0x5729c9,null))[_0x7300('0x37')](handleError(_0x5729c9,null));};exports[_0x7300('0x56')]=function(_0x447422,_0xb4bb32){var _0x5609b8=moment()[_0x7300('0x57')]()[_0x7300('0x58')]();var _0x2a8be9=path[_0x7300('0x59')](config['root'],_0x7300('0x5a'),_0x7300('0x5b'),'tmp');var _0x204196=path[_0x7300('0x59')](config[_0x7300('0x5c')],_0x7300('0x5a'),_0x7300('0x5b'),_0x7300('0x5d'));var _0x4caac4=path[_0x7300('0x59')](_0x2a8be9,_0x5609b8);var _0x57f708=util[_0x7300('0x4a')](_0x7300('0x5e'),_0x447422['params']['id'],_0x5609b8);var _0x2c9689=path[_0x7300('0x59')](_0x2a8be9,_0x57f708);var _0x358aee=[];if(_0x447422[_0x7300('0x28')][_0x7300('0x5d')]){_0x358aee['push']({'model':db['Attachment'],'as':_0x7300('0x5f'),'raw':!![]});}var _0x2ab44d=[{'model':db['MailMessage'],'as':_0x7300('0x60'),'attributes':['id','body',_0x7300('0x61'),'to','cc',_0x7300('0x62'),_0x7300('0x63'),_0x7300('0x64')],'where':{'secret':![]},'order':qs[_0x7300('0x43')]('id'),'include':_0x358aee}];return db[_0x7300('0x21')]['find']({'where':{'id':_0x447422[_0x7300('0x2b')]['id']},'include':_0x2ab44d})[_0x7300('0x19')](handleEntityNotFound(_0xb4bb32,null))[_0x7300('0x19')](function(_0x3c9d37){if(_0x3c9d37&&_0x3c9d37['Messages']){var _0xf74aec=_0x3c9d37['get']({'plain':!![]});fs['mkdirSync'](_0x4caac4);return BPromise[_0x7300('0x65')](_0xf74aec[_0x7300('0x60')],function(_0x24e6b4,_0x572b93){var _0x586fe2={'from':_0x24e6b4['from'],'to':_0x24e6b4['to']||_0x7300('0x66'),'subject':_0x24e6b4[_0x7300('0x63')],'html':htmlEntities[_0x7300('0x67')](_0x24e6b4['body']),'headers':{'Date':moment(_0x24e6b4[_0x7300('0x64')])[_0x7300('0x4a')](_0x7300('0x68'))},'attachments':[]};if(_0x24e6b4['cc']){_0x586fe2[_0x7300('0x69')]['Cc']=_0x24e6b4['cc'];}if(_0x24e6b4[_0x7300('0x62')]){_0x586fe2[_0x7300('0x69')]['Bcc']=_0x24e6b4[_0x7300('0x62')];}return new BPromise(function(_0x9feedf,_0x1701e5){if(_0x24e6b4[_0x7300('0x5f')]){for(var _0x29e5c1=0x0;_0x29e5c1<_0x24e6b4['Attachments']['length'];_0x29e5c1++){var _0x3043fd=_0x24e6b4[_0x7300('0x5f')][_0x29e5c1];var _0x1dadce=path[_0x7300('0x59')](_0x204196,_0x3043fd[_0x7300('0x6a')]);if(fs[_0x7300('0x6b')](_0x1dadce)){_0x586fe2['attachments'][_0x7300('0x6c')]({'name':_0x3043fd[_0x7300('0x1e')],'contentType':_0x3043fd['type'],'data':fs[_0x7300('0x6d')](_0x1dadce)});}}}emlformat['build'](_0x586fe2,function(_0x18712b,_0x3384ad){if(_0x18712b)return _0x1701e5(_0x18712b);fs[_0x7300('0x6e')](path[_0x7300('0x59')](_0x4caac4,util[_0x7300('0x4a')](_0x7300('0x6f'),_0x572b93)),_0x3384ad);return _0x9feedf(_0x3384ad);});});})[_0x7300('0x19')](function(){return new BPromise(function(_0x4d4bef,_0x5a7037){zipdir(_0x4caac4,{'saveTo':_0x2c9689},function(_0x39e988,_0x2a9fcb){if(_0x39e988)return _0x5a7037(_0x39e988);return _0x4d4bef(_0x2a9fcb);});})['then'](function(){return new BPromise(function(_0x51d74c,_0x3c2f86){rimraf(_0x4caac4,function(_0x54d1de){if(_0x54d1de)_0x3c2f86(_0x54d1de);return _0x51d74c();});});})[_0x7300('0x19')](function(){return _0xb4bb32[_0x7300('0x56')](_0x2c9689,_0x57f708,function(_0x1edfbc){if(!_0x1edfbc)fs['unlinkSync'](_0x2c9689);});});});}else{return _0xb4bb32['sendStatus'](0xc8);}})['catch'](handleError(_0xb4bb32,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a6a1752..6c70aaa 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 _0xc1f5=['setMaxListeners','save','remove','getUsers','then','setDataValue','findAll','length','emit','hasOwnProperty','../../mysqldb'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc1f5,0x128));var _0x5c1f=function(_0x31e469,_0x3b683d){_0x31e469=_0x31e469-0x0;var _0x29b8b1=_0xc1f5[_0x31e469];return _0x29b8b1;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x5c1f('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5c1f('0x1')](0x0);var events={'afterCreate':_0x5c1f('0x2'),'afterUpdate':'update','afterDestroy':_0x5c1f('0x3')};function emitEvent(_0x375819){return function(_0x536529,_0x5df6d4,_0x115406){_0x536529[_0x5c1f('0x4')]({'attributes':['id'],'raw':!![]})[_0x5c1f('0x5')](function(_0x5bc1ef){_0x536529[_0x5c1f('0x6')]('Users',_0x5bc1ef['map'](function(_0x511b68){return{'id':_0x511b68['id']};}));return MailMessage[_0x5c1f('0x7')]({'where':{'MailInteractionId':_0x536529['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5c1f('0x5')](function(_0x1048f8){_0x536529[_0x5c1f('0x6')]('unreadMessages',_0x1048f8[_0x5c1f('0x8')]);MailInteractionEvents[_0x5c1f('0x9')](_0x375819+':'+_0x536529['id'],_0x536529);MailInteractionEvents['emit'](_0x375819,_0x536529);_0x115406(null);})['catch'](_0x115406(null));};}for(var e in events){if(events[_0x5c1f('0xa')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x10fb=['unreadMessages','length','emit','hook','events','MailInteraction','../../mysqldb','MailMessage','save','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x10fb,0xe5));var _0xb10f=function(_0x19c57a,_0x5c9c7c){_0x19c57a=_0x19c57a-0x0;var _0x576a08=_0x10fb[_0x19c57a];return _0x576a08;};'use strict';var EventEmitter=require(_0xb10f('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xb10f('0x1')];var MailMessage=require(_0xb10f('0x2'))['db'][_0xb10f('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb10f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2bc420){return function(_0xa7e63a,_0x384203,_0x19a096){_0xa7e63a[_0xb10f('0x5')]({'attributes':['id'],'raw':!![]})[_0xb10f('0x6')](function(_0x4c5bc7){_0xa7e63a[_0xb10f('0x7')](_0xb10f('0x8'),_0x4c5bc7[_0xb10f('0x9')](function(_0x3da9e3){return{'id':_0x3da9e3['id']};}));return MailMessage[_0xb10f('0xa')]({'where':{'MailInteractionId':_0xa7e63a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb10f('0x6')](function(_0x25ff17){_0xa7e63a[_0xb10f('0x7')](_0xb10f('0xb'),_0x25ff17[_0xb10f('0xc')]);MailInteractionEvents[_0xb10f('0xd')](_0x2bc420+':'+_0xa7e63a['id'],_0xa7e63a);MailInteractionEvents['emit'](_0x2bc420,_0xa7e63a);_0x19a096(null);})['catch'](_0x19a096(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xb10f('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 61c1d79..43e6334 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 _0x535c=['substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x535c,0xe4));var _0xc535=function(_0x5d1f9a,_0x3c75fd){_0x5d1f9a=_0x5d1f9a-0x0;var _0x864ff7=_0x535c[_0x5d1f9a];return _0x864ff7;};'use strict';var _=require(_0xc535('0x0'));var util=require(_0xc535('0x1'));var logger=require('../../config/logger')(_0xc535('0x2'));var moment=require('moment');var BPromise=require(_0xc535('0x3'));var rp=require(_0xc535('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc535('0x5'));module['exports']=function(_0x13ad20,_0x344068){return _0x13ad20['define'](_0xc535('0x6'),attributes,{'tableName':_0xc535('0x7'),'paranoid':![],'indexes':[{'name':_0xc535('0x8'),'fields':[_0xc535('0x9'),'to'],'type':_0xc535('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x192bb2,_0x91ac09,_0x4195f4){if(_0x192bb2[_0xc535('0xb')]){_0x192bb2[_0xc535('0xc')]=moment()[_0xc535('0xd')](_0xc535('0xe'));}if(_0x192bb2[_0xc535('0xf')]){_0x192bb2['closedAt']=moment()[_0xc535('0xd')](_0xc535('0xe'));}_0x4195f4(null,_0x91ac09);},'beforeUpdate':function(_0x42ddb2,_0x354b62,_0x238559){if(_0x42ddb2[_0xc535('0x10')](_0xc535('0xb'))){_0x42ddb2[_0xc535('0xc')]=_0x42ddb2[_0xc535('0xb')]?moment()[_0xc535('0xd')](_0xc535('0xe')):null;}if(_0x42ddb2['changed'](_0xc535('0xf'))){_0x42ddb2[_0xc535('0x11')]=moment()[_0xc535('0xd')](_0xc535('0xe'));_0x42ddb2[_0xc535('0xb')]=null;_0x42ddb2[_0xc535('0xc')]=null;}_0x238559(null,_0x42ddb2);},'afterUpdate':function(_0x28207b,_0x2e33d1,_0xad06da){var _0x4496b7=_0x13ad20[_0xc535('0x12')];var _0x3fe94e=_0x28207b['get']({'plain':!![]});if(_0x3fe94e[_0xc535('0xf')]){return _0x4496b7[_0xc535('0x13')][_0xc535('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x3fe94e['id']}})[_0xc535('0x15')](function(){_0xad06da();})['catch'](function(_0x536a7a){_0xad06da(_0x536a7a);});}else{_0xad06da();}}},'charset':_0xc535('0x16'),'collate':_0xc535('0x17')});}; \ No newline at end of file +var _0xf064=['MailMessage','catch','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get'];(function(_0x2ea188,_0x2d6e2d){var _0x3be1e9=function(_0x178463){while(--_0x178463){_0x2ea188['push'](_0x2ea188['shift']());}};_0x3be1e9(++_0x2d6e2d);}(_0xf064,0x1a7));var _0x4f06=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0xf064[_0x13c70c];return _0x50f0f2;};'use strict';var _=require('lodash');var util=require(_0x4f06('0x0'));var logger=require('../../config/logger')(_0x4f06('0x1'));var moment=require(_0x4f06('0x2'));var BPromise=require(_0x4f06('0x3'));var rp=require(_0x4f06('0x4'));var fs=require('fs');var path=require(_0x4f06('0x5'));var rimraf=require(_0x4f06('0x6'));var config=require(_0x4f06('0x7'));var attributes=require(_0x4f06('0x8'));module[_0x4f06('0x9')]=function(_0x1735b2,_0x3dbc38){return _0x1735b2[_0x4f06('0xa')](_0x4f06('0xb'),attributes,{'tableName':_0x4f06('0xc'),'paranoid':![],'indexes':[{'name':_0x4f06('0xd'),'fields':[_0x4f06('0xe'),'to'],'type':_0x4f06('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x38c0c5,_0x54c665,_0x358d68){if(_0x38c0c5[_0x4f06('0x10')]){_0x38c0c5[_0x4f06('0x11')]=moment()[_0x4f06('0x12')](_0x4f06('0x13'));}if(_0x38c0c5[_0x4f06('0x14')]){_0x38c0c5[_0x4f06('0x15')]=moment()['format'](_0x4f06('0x13'));}_0x358d68(null,_0x54c665);},'beforeUpdate':function(_0x41a537,_0x522820,_0x35e95c){if(_0x41a537[_0x4f06('0x16')](_0x4f06('0x10'))){_0x41a537[_0x4f06('0x11')]=_0x41a537[_0x4f06('0x10')]?moment()[_0x4f06('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x41a537['changed'](_0x4f06('0x14'))){_0x41a537[_0x4f06('0x15')]=moment()['format'](_0x4f06('0x13'));_0x41a537[_0x4f06('0x10')]=null;_0x41a537['substatusAt']=null;}_0x35e95c(null,_0x41a537);},'afterUpdate':function(_0x56d66d,_0x592bfb,_0xe39d7e){var _0x4b913d=_0x1735b2[_0x4f06('0x17')];var _0x43770f=_0x56d66d[_0x4f06('0x18')]({'plain':!![]});if(_0x43770f[_0x4f06('0x14')]){return _0x4b913d[_0x4f06('0x19')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x43770f['id']}})['then'](function(){_0xe39d7e();})[_0x4f06('0x1a')](function(_0x54689e){_0xe39d7e(_0x54689e);});}else{_0xe39d7e();}}},'charset':'utf8mb4','collate':_0x4f06('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9bd765f..2427d2c 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 _0x14b2=['localhost','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','MailInteraction','options','raw','where','attributes','limit','UpdateMailInteraction','debug','stringify','catch','AddTagsToMailInteraction','ids','omit','body','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults'];(function(_0x3dc86c,_0x9de6b0){var _0x30c8c0=function(_0x2be893){while(--_0x2be893){_0x3dc86c['push'](_0x3dc86c['shift']());}};_0x30c8c0(++_0x9de6b0);}(_0x14b2,0x1a1));var _0x214b=function(_0x2b44e3,_0x82a548){_0x2b44e3=_0x2b44e3-0x0;var _0x352473=_0x14b2[_0x2b44e3];return _0x352473;};'use strict';var _=require(_0x214b('0x0'));var util=require(_0x214b('0x1'));var moment=require('moment');var BPromise=require(_0x214b('0x2'));var rs=require(_0x214b('0x3'));var fs=require('fs');var Redis=require(_0x214b('0x4'));var db=require(_0x214b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x214b('0x6'))(_0x214b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x214b('0x8')][_0x214b('0x9')]({'port':0x232a});config[_0x214b('0xa')]=_[_0x214b('0xb')](config[_0x214b('0xa')],{'host':_0x214b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x214b('0xa')]));require('./mailInteraction.socket')[_0x214b('0xd')](socket);function respondWithRpcPromise(_0x53d959,_0x322c4c,_0x5256ad){return new BPromise(function(_0x5ccdfd,_0x4cae5e){return client[_0x214b('0xe')](_0x53d959,_0x5256ad)[_0x214b('0xf')](function(_0x49acef){logger[_0x214b('0x10')](_0x214b('0x11'),_0x322c4c,_0x214b('0x12'));logger['debug'](_0x214b('0x13'),_0x322c4c,'request\x20sent',JSON['stringify'](_0x49acef));if(_0x49acef[_0x214b('0x14')]){if(_0x49acef[_0x214b('0x14')][_0x214b('0x15')]===0x1f4){logger[_0x214b('0x14')](_0x214b('0x11'),_0x322c4c,_0x49acef[_0x214b('0x14')]['message']);return _0x4cae5e(_0x49acef[_0x214b('0x14')]['message']);}logger[_0x214b('0x14')](_0x214b('0x11'),_0x322c4c,_0x49acef[_0x214b('0x14')]['message']);return _0x5ccdfd(_0x49acef['error'][_0x214b('0x16')]);}else{logger['info'](_0x214b('0x11'),_0x322c4c,_0x214b('0x12'));_0x5ccdfd(_0x49acef['result'][_0x214b('0x16')]);}})['catch'](function(_0x44028f){logger[_0x214b('0x14')](_0x214b('0x11'),_0x322c4c,_0x44028f);_0x4cae5e(_0x44028f);});});}exports['UpdateMailInteraction']=function(_0x14c45c){var _0x1e80bc=this;return new Promise(function(_0x2dacc1,_0x3dc351){return db[_0x214b('0x17')]['update'](_0x14c45c['body'],{'raw':_0x14c45c[_0x214b('0x18')]?_0x14c45c[_0x214b('0x18')][_0x214b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14c45c[_0x214b('0x18')]?_0x14c45c['options'][_0x214b('0x1a')]||null:null,'attributes':_0x14c45c[_0x214b('0x18')]?_0x14c45c[_0x214b('0x18')][_0x214b('0x1b')]||null:null,'limit':_0x14c45c['options']?_0x14c45c[_0x214b('0x18')][_0x214b('0x1c')]||null:null})[_0x214b('0xf')](function(_0x220d38){logger[_0x214b('0x10')](_0x214b('0x1d'),_0x14c45c);logger[_0x214b('0x1e')](_0x214b('0x1d'),_0x14c45c,JSON[_0x214b('0x1f')](_0x220d38));_0x2dacc1(_0x220d38);})[_0x214b('0x20')](function(_0x2aaaf1){logger['error']('UpdateMailInteraction',_0x2aaaf1[_0x214b('0x16')],_0x14c45c);_0x3dc351(_0x1e80bc[_0x214b('0x14')](0x1f4,_0x2aaaf1[_0x214b('0x16')]));});});};exports[_0x214b('0x21')]=function(_0x49bed4){return new Promise(function(_0xf137ee,_0x787560){return db['MailInteraction']['find']({'where':_0x49bed4[_0x214b('0x18')]?_0x49bed4[_0x214b('0x18')][_0x214b('0x1a')]||null:null})['then'](function(_0x1b3a94){if(_0x1b3a94){return _0x1b3a94['addTags'](_0x49bed4['body'][_0x214b('0x22')],_[_0x214b('0x23')](_0x49bed4[_0x214b('0x24')],[_0x214b('0x22'),'id'])||{});}})[_0x214b('0x25')](function(_0x42a9d3){logger[_0x214b('0x10')](_0x214b('0x26'),_0x49bed4);logger['debug']('AddTags',_0x49bed4,JSON[_0x214b('0x1f')](_0x42a9d3));_0xf137ee(_0x42a9d3);})[_0x214b('0x20')](function(_0x131860){logger[_0x214b('0x14')]('AddTags',_0x131860['message'],_0x49bed4);_0x787560(_this[_0x214b('0x14')](0x1f4,_0x131860[_0x214b('0x16')]));});});}; \ No newline at end of file +var _0x5e38=['AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','omit','spread'];(function(_0xecb9d3,_0x4b76a9){var _0x11ed28=function(_0x2e5e62){while(--_0x2e5e62){_0xecb9d3['push'](_0xecb9d3['shift']());}};_0x11ed28(++_0x4b76a9);}(_0x5e38,0x12e));var _0x85e3=function(_0x557d6d,_0x39554b){_0x557d6d=_0x557d6d-0x0;var _0x5301ae=_0x5e38[_0x557d6d];return _0x5301ae;};'use strict';var _=require('lodash');var util=require(_0x85e3('0x0'));var moment=require('moment');var BPromise=require(_0x85e3('0x1'));var rs=require(_0x85e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85e3('0x3'))['db'];var utils=require(_0x85e3('0x4'));var logger=require(_0x85e3('0x5'))('rpc');var config=require(_0x85e3('0x6'));var jayson=require(_0x85e3('0x7'));var client=jayson[_0x85e3('0x8')][_0x85e3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x85e3('0xa')],{'host':_0x85e3('0xb'),'port':0x18eb});var socket=require(_0x85e3('0xc'))(new Redis(config['redis']));require(_0x85e3('0xd'))[_0x85e3('0xe')](socket);function respondWithRpcPromise(_0x11d480,_0x373fc3,_0x37e823){return new BPromise(function(_0x576d77,_0x1073cc){return client[_0x85e3('0xf')](_0x11d480,_0x37e823)[_0x85e3('0x10')](function(_0x3f179f){logger[_0x85e3('0x11')](_0x85e3('0x12'),_0x373fc3,_0x85e3('0x13'));logger[_0x85e3('0x14')](_0x85e3('0x15'),_0x373fc3,_0x85e3('0x13'),JSON[_0x85e3('0x16')](_0x3f179f));if(_0x3f179f[_0x85e3('0x17')]){if(_0x3f179f[_0x85e3('0x17')][_0x85e3('0x18')]===0x1f4){logger[_0x85e3('0x17')](_0x85e3('0x12'),_0x373fc3,_0x3f179f[_0x85e3('0x17')][_0x85e3('0x19')]);return _0x1073cc(_0x3f179f[_0x85e3('0x17')]['message']);}logger['error'](_0x85e3('0x12'),_0x373fc3,_0x3f179f['error']['message']);return _0x576d77(_0x3f179f[_0x85e3('0x17')]['message']);}else{logger[_0x85e3('0x11')](_0x85e3('0x12'),_0x373fc3,_0x85e3('0x13'));_0x576d77(_0x3f179f[_0x85e3('0x1a')][_0x85e3('0x19')]);}})[_0x85e3('0x1b')](function(_0x3a5df1){logger[_0x85e3('0x17')]('MailInteraction,\x20%s,\x20%s',_0x373fc3,_0x3a5df1);_0x1073cc(_0x3a5df1);});});}exports[_0x85e3('0x1c')]=function(_0x4db808){var _0x2e497f=this;return new Promise(function(_0xa80afd,_0x40d517){return db[_0x85e3('0x1d')]['update'](_0x4db808[_0x85e3('0x1e')],{'raw':_0x4db808[_0x85e3('0x1f')]?_0x4db808[_0x85e3('0x1f')][_0x85e3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4db808[_0x85e3('0x1f')]?_0x4db808[_0x85e3('0x1f')][_0x85e3('0x21')]||null:null,'attributes':_0x4db808[_0x85e3('0x1f')]?_0x4db808[_0x85e3('0x1f')][_0x85e3('0x22')]||null:null,'limit':_0x4db808[_0x85e3('0x1f')]?_0x4db808[_0x85e3('0x1f')][_0x85e3('0x23')]||null:null})['then'](function(_0x35eac2){logger['info']('UpdateMailInteraction',_0x4db808);logger[_0x85e3('0x14')](_0x85e3('0x1c'),_0x4db808,JSON[_0x85e3('0x16')](_0x35eac2));_0xa80afd(_0x35eac2);})['catch'](function(_0x5bd7e7){logger[_0x85e3('0x17')](_0x85e3('0x1c'),_0x5bd7e7[_0x85e3('0x19')],_0x4db808);_0x40d517(_0x2e497f[_0x85e3('0x17')](0x1f4,_0x5bd7e7[_0x85e3('0x19')]));});});};exports[_0x85e3('0x24')]=function(_0x153acc){return new Promise(function(_0x4d3f59,_0x144026){return db[_0x85e3('0x1d')][_0x85e3('0x25')]({'where':_0x153acc['options']?_0x153acc[_0x85e3('0x1f')][_0x85e3('0x21')]||null:null})[_0x85e3('0x10')](function(_0x4d8647){if(_0x4d8647){return _0x4d8647[_0x85e3('0x26')](_0x153acc[_0x85e3('0x1e')][_0x85e3('0x27')],_[_0x85e3('0x28')](_0x153acc[_0x85e3('0x1e')],[_0x85e3('0x27'),'id'])||{});}})[_0x85e3('0x29')](function(_0x59e236){logger['info'](_0x85e3('0x2a'),_0x153acc);logger[_0x85e3('0x14')](_0x85e3('0x2a'),_0x153acc,JSON[_0x85e3('0x16')](_0x59e236));_0x4d3f59(_0x59e236);})[_0x85e3('0x1b')](function(_0x253670){logger['error']('AddTags',_0x253670[_0x85e3('0x19')],_0x153acc);_0x144026(_this[_0x85e3('0x17')](0x1f4,_0x253670[_0x85e3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a5a88a4..1624e25 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 _0x42a5=['emit','removeListener','register','mailInteraction:','./mailInteraction.events','save','remove','update'];(function(_0x4a314a,_0x6c6a7c){var _0x5d1948=function(_0x58f22f){while(--_0x58f22f){_0x4a314a['push'](_0x4a314a['shift']());}};_0x5d1948(++_0x6c6a7c);}(_0x42a5,0x1b4));var _0x542a=function(_0x306f3b,_0x518ab3){_0x306f3b=_0x306f3b-0x0;var _0x3fc367=_0x42a5[_0x306f3b];return _0x3fc367;};'use strict';var MailInteractionEvents=require(_0x542a('0x0'));var events=[_0x542a('0x1'),_0x542a('0x2'),_0x542a('0x3')];function createListener(_0x31e361,_0x5e4c52){return function(_0x3eae2b){_0x5e4c52[_0x542a('0x4')](_0x31e361,_0x3eae2b);};}function removeListener(_0x1e044b,_0x483ff7){return function(){MailInteractionEvents[_0x542a('0x5')](_0x1e044b,_0x483ff7);};}exports[_0x542a('0x6')]=function(_0x432961){for(var _0x318356=0x0,_0x5acc67=events['length'];_0x318356<_0x5acc67;_0x318356++){var _0x1a3c52=events[_0x318356];var _0xacc7c2=createListener(_0x542a('0x7')+_0x1a3c52,_0x432961);MailInteractionEvents['on'](_0x1a3c52,_0xacc7c2);}}; \ No newline at end of file +var _0x4964=['register','length','./mailInteraction.events','remove','removeListener'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x4964,0x84));var _0x4496=function(_0x3837d4,_0x74dc51){_0x3837d4=_0x3837d4-0x0;var _0x2fc95b=_0x4964[_0x3837d4];return _0x2fc95b;};'use strict';var MailInteractionEvents=require(_0x4496('0x0'));var events=['save',_0x4496('0x1'),'update'];function createListener(_0x346d75,_0x4fa3f0){return function(_0x5ef116){_0x4fa3f0['emit'](_0x346d75,_0x5ef116);};}function removeListener(_0x3cd928,_0x4afc6b){return function(){MailInteractionEvents[_0x4496('0x2')](_0x3cd928,_0x4afc6b);};}exports[_0x4496('0x3')]=function(_0x1ac249){for(var _0x388e98=0x0,_0x57f7f7=events[_0x4496('0x4')];_0x388e98<_0x57f7f7;_0x388e98++){var _0x5cd891=events[_0x388e98];var _0x41f4ca=createListener('mailInteraction:'+_0x5cd891,_0x1ac249);MailInteractionEvents['on'](_0x5cd891,_0x41f4ca);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 5d06ec2..3ee9854 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 _0xed5f=['isAuthenticated','describe','exports','Router','../../components/auth/service','./mailInteractionHasTag.controller','/describe'];(function(_0x317f00,_0x2dfa1d){var _0x8c178b=function(_0x28cd88){while(--_0x28cd88){_0x317f00['push'](_0x317f00['shift']());}};_0x8c178b(++_0x2dfa1d);}(_0xed5f,0x1e6));var _0xfed5=function(_0x26c0d8,_0x2c7c2d){_0x26c0d8=_0x26c0d8-0x0;var _0x1fffff=_0xed5f[_0x26c0d8];return _0x1fffff;};'use strict';var express=require('express');var router=express[_0xfed5('0x0')]();var auth=require(_0xfed5('0x1'));var controller=require(_0xfed5('0x2'));router['get'](_0xfed5('0x3'),auth[_0xfed5('0x4')](),controller[_0xfed5('0x5')]);module[_0xfed5('0x6')]=router; \ No newline at end of file +var _0x5cd5=['exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get','isAuthenticated','describe'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5cd5,0x149));var _0x55cd=function(_0xe1fa35,_0x586557){_0xe1fa35=_0xe1fa35-0x0;var _0xe59f6f=_0x5cd5[_0xe1fa35];return _0xe59f6f;};'use strict';var express=require(_0x55cd('0x0'));var router=express[_0x55cd('0x1')]();var auth=require(_0x55cd('0x2'));var controller=require(_0x55cd('0x3'));router[_0x55cd('0x4')]('/describe',auth[_0x55cd('0x5')](),controller[_0x55cd('0x6')]);module[_0x55cd('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 5b5765f..5f6d9b9 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(_0x592702,_0x5a6dc6){var _0x3eea51=function(_0x1d2115){while(--_0x1d2115){_0x592702['push'](_0x592702['shift']());}};_0x3eea51(++_0x5a6dc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x5f2c59,_0x5341ad){var _0x4890fe=function(_0x1f3f07){while(--_0x1f3f07){_0x5f2c59['push'](_0x5f2c59['shift']());}};_0x4890fe(++_0x5341ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 6770d90..a6ad3f1 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 _0x87ad=['sequelize','exports','INTEGER'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x87ad,0x66));var _0xd87a=function(_0x571528,_0x2f3797){_0x571528=_0x571528-0x0;var _0x54464d=_0x87ad[_0x571528];return _0x54464d;};'use strict';var Sequelize=require(_0xd87a('0x0'));module[_0xd87a('0x1')]={'MailInteractionId':{'type':Sequelize[_0xd87a('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd87a('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x3b90=['sequelize','exports','INTEGER'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3b90,0xde));var _0x03b9=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x3b90[_0x2085f3];return _0x384e3c;};'use strict';var Sequelize=require(_0x03b9('0x0'));module[_0x03b9('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x03b9('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 c5d3a65..792bd4e 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 _0x610d=['exports','define'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x610d,0x192));var _0xd610=function(_0x1dd284,_0x4a920c){_0x1dd284=_0x1dd284-0x0;var _0x54374d=_0x610d[_0x1dd284];return _0x54374d;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xd610('0x0')]=function(_0x5060e5){return _0x5060e5[_0xd610('0x1')]('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd392=['exports','define','MailInteractionHasTag'];(function(_0x5a729f,_0x5a5a82){var _0x3f1879=function(_0x5a52fc){while(--_0x5a52fc){_0x5a729f['push'](_0x5a729f['shift']());}};_0x3f1879(++_0x5a5a82);}(_0xd392,0x1b0));var _0x2d39=function(_0x5813c8,_0x289226){_0x5813c8=_0x5813c8-0x0;var _0x127134=_0xd392[_0x5813c8];return _0x127134;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x2d39('0x0')]=function(_0x3172bd){return _0x3172bd[_0x2d39('0x1')](_0x2d39('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 fb8c148..a5d7437 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 _0x89c4=['post','tracked','mail','create','/:id','put','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id/download','download'];(function(_0x294239,_0x3f5997){var _0x38f97d=function(_0x5ac50c){while(--_0x5ac50c){_0x294239['push'](_0x294239['shift']());}};_0x38f97d(++_0x3f5997);}(_0x89c4,0x82));var _0x489c=function(_0x5a225b,_0x1de1a1){_0x5a225b=_0x5a225b-0x0;var _0x1d5aab=_0x89c4[_0x5a225b];return _0x1d5aab;};'use strict';var multer=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var path=require('path');var timeout=require(_0x489c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x489c('0x3'));var auth=require(_0x489c('0x4'));var interaction=require(_0x489c('0x5'));var config=require(_0x489c('0x6'));var controller=require(_0x489c('0x7'));router[_0x489c('0x8')]('/',auth[_0x489c('0x9')](),controller['index']);router[_0x489c('0x8')](_0x489c('0xa'),auth[_0x489c('0x9')](),controller[_0x489c('0xb')]);router['get']('/:id',auth[_0x489c('0x9')](),controller['show']);router[_0x489c('0x8')](_0x489c('0xc'),auth[_0x489c('0x9')](),controller[_0x489c('0xd')]);router[_0x489c('0xe')]('/',auth[_0x489c('0x9')](),interaction[_0x489c('0xf')](_0x489c('0x10'),'mailmessage:create'),controller[_0x489c('0x11')]);router['put'](_0x489c('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x489c('0x13')]('/:id/accept',auth[_0x489c('0x9')](),controller['accept']);router[_0x489c('0x13')](_0x489c('0x14'),auth['isAuthenticated'](),controller[_0x489c('0x15')]);router[_0x489c('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x489c('0x17')]);module['exports']=router; \ No newline at end of file +var _0xb95d=['tracked','mail','mailmessage:create','create','put','update','accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','describe','get','/:id','show','download'];(function(_0x917400,_0x18c502){var _0x466e82=function(_0x398d3e){while(--_0x398d3e){_0x917400['push'](_0x917400['shift']());}};_0x466e82(++_0x18c502);}(_0xb95d,0x1c5));var _0xdb95=function(_0x1bd865,_0x4b3d45){_0x1bd865=_0x1bd865-0x0;var _0x5da464=_0xb95d[_0x1bd865];return _0x5da464;};'use strict';var multer=require(_0xdb95('0x0'));var util=require('util');var path=require(_0xdb95('0x1'));var timeout=require(_0xdb95('0x2'));var express=require(_0xdb95('0x3'));var router=express[_0xdb95('0x4')]();var fs_extra=require(_0xdb95('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb95('0x6'));var config=require(_0xdb95('0x7'));var controller=require(_0xdb95('0x8'));router['get']('/',auth[_0xdb95('0x9')](),controller['index']);router['get']('/describe',auth[_0xdb95('0x9')](),controller[_0xdb95('0xa')]);router[_0xdb95('0xb')](_0xdb95('0xc'),auth['isAuthenticated'](),controller[_0xdb95('0xd')]);router[_0xdb95('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0xdb95('0xe')]);router['post']('/',auth[_0xdb95('0x9')](),interaction[_0xdb95('0xf')](_0xdb95('0x10'),_0xdb95('0x11')),controller[_0xdb95('0x12')]);router[_0xdb95('0x13')](_0xdb95('0xc'),auth[_0xdb95('0x9')](),controller[_0xdb95('0x14')]);router['put']('/:id/accept',auth[_0xdb95('0x9')](),controller[_0xdb95('0x15')]);router['put'](_0xdb95('0x16'),auth[_0xdb95('0x9')](),controller[_0xdb95('0x17')]);router['delete'](_0xdb95('0xc'),auth[_0xdb95('0x9')](),controller[_0xdb95('0x18')]);module[_0xdb95('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 4fc494c..4d74ed5 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 _0x0459=['DATE','ENUM','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING'];(function(_0x5a304e,_0x35ebc8){var _0x403034=function(_0x45f3b2){while(--_0x45f3b2){_0x5a304e['push'](_0x5a304e['shift']());}};_0x403034(++_0x35ebc8);}(_0x0459,0x12f));var _0x9045=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x0459[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0x9045('0x0'));var _=require(_0x9045('0x1'));module[_0x9045('0x2')]={'body':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x5'))},'read':{'type':Sequelize[_0x9045('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9045('0x7')),'defaultValue':_0x9045('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9045('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x4'))},'cc':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x4'))},'bcc':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x4'))},'subject':{'type':Sequelize[_0x9045('0x3')]},'sentAt':{'type':Sequelize[_0x9045('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9045('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x9045('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x9045('0x4'))},'originChannel':{'type':Sequelize[_0x9045('0xa')](_0x9045('0xb'),_0x9045('0xc')),'defaultValue':_0x9045('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x5a77=['Email','lodash','exports','long','ENUM','STRING','TEXT','INTEGER','BOOLEAN','DATE','Chat'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0x5a77,0x1da));var _0x75a7=function(_0x2bcef3,_0x1743f9){_0x2bcef3=_0x2bcef3-0x0;var _0x3fb3ce=_0x5a77[_0x2bcef3];return _0x3fb3ce;};'use strict';var Sequelize=require('sequelize');var _=require(_0x75a7('0x0'));module[_0x75a7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x75a7('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x75a7('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x75a7('0x4')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x75a7('0x5')](_0x75a7('0x2'))},'cc':{'type':Sequelize[_0x75a7('0x5')](_0x75a7('0x2'))},'bcc':{'type':Sequelize[_0x75a7('0x5')](_0x75a7('0x2'))},'subject':{'type':Sequelize[_0x75a7('0x5')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x75a7('0x6')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x75a7('0x7')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x75a7('0x8')]},'originTo':{'type':Sequelize[_0x75a7('0x5')](_0x75a7('0x2'))},'originCc':{'type':Sequelize[_0x75a7('0x5')](_0x75a7('0x2'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x75a7('0x9')),'defaultValue':_0x75a7('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index cdea3f9..b9b6cc7 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 _0x8038=['lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','undefined','count','offset','limit','set','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','update','describe','create','out','secret','body','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','acceptMessage','UserId','user','agent','get','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','interface','SIP/%s','channel','event','reject','fromString','EventManager','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','moment'];(function(_0x312f7a,_0x25dbca){var _0x496c0c=function(_0x509756){while(--_0x509756){_0x312f7a['push'](_0x312f7a['shift']());}};_0x496c0c(++_0x25dbca);}(_0x8038,0x1af));var _0x8803=function(_0x4d44f7,_0x27147b){_0x4d44f7=_0x4d44f7-0x0;var _0x1bcbc5=_0x8038[_0x4d44f7];return _0x1bcbc5;};'use strict';var emlformat=require('eml-format');var moment=require(_0x8803('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x8803('0x1'));var Redis=require(_0x8803('0x2'));var htmlToText=require(_0x8803('0x3'));var interactionService=require('../../components/interaction/service');var qs=require(_0x8803('0x4'));var logger=require(_0x8803('0x5'))(_0x8803('0x6'));var interaction_log=require(_0x8803('0x5'))(_0x8803('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8803('0x8')]=_[_0x8803('0x9')](config[_0x8803('0x8')],{'host':_0x8803('0xa'),'port':0x18eb});var socket=require(_0x8803('0xb'))(new Redis(config[_0x8803('0x8')]));var htmlEntities=require(_0x8803('0xc'));require(_0x8803('0xd'))['register'](socket);var jayson=require(_0x8803('0xe'));var client=jayson[_0x8803('0xf')][_0x8803('0x10')]({'port':0x232c});var client9003=jayson[_0x8803('0xf')][_0x8803('0x10')]({'port':0x232b});var client9002=jayson[_0x8803('0xf')][_0x8803('0x10')]({'port':0x232a});function respondWithRpcPromise(_0xaf79f0,_0x3b8ba5,_0x5db10d,_0x1e4c76){return new Promise(function(_0x20ef65,_0x31cd7b){var _0x2e1058=_0x1e4c76||client;return _0x2e1058[_0x8803('0x11')](_0xaf79f0,_0x5db10d)[_0x8803('0x12')](function(_0x55be86){logger[_0x8803('0x13')](_0x8803('0x14'),_0x3b8ba5,_0x8803('0x15'));logger[_0x8803('0x16')](_0x8803('0x17'),_0x3b8ba5,'request\x20sent',JSON[_0x8803('0x18')](_0x55be86));if(_0x55be86[_0x8803('0x19')]){if(_0x55be86['error'][_0x8803('0x1a')]===0x1f4){logger[_0x8803('0x19')]('MailMessage,\x20%s,\x20%s',_0x3b8ba5,_0x55be86['error'][_0x8803('0x1b')]);return _0x31cd7b(_0x55be86[_0x8803('0x19')][_0x8803('0x1b')]);}logger[_0x8803('0x19')](_0x8803('0x14'),_0x3b8ba5,_0x55be86[_0x8803('0x19')]['message']);return _0x20ef65(_0x55be86[_0x8803('0x19')][_0x8803('0x1b')]);}else{logger['info'](_0x8803('0x14'),_0x3b8ba5,_0x8803('0x15'));_0x20ef65(_0x55be86['result'][_0x8803('0x1b')]);}})[_0x8803('0x1c')](function(_0x3f4cf0){logger[_0x8803('0x19')](_0x8803('0x14'),_0x3b8ba5,_0x3f4cf0);_0x31cd7b(_0x3f4cf0);});});}function respondWithResult(_0x43d4f5,_0x38c88b){_0x38c88b=_0x38c88b||0xc8;return function(_0x3c9440){if(_0x3c9440){return _0x43d4f5[_0x8803('0x1d')](_0x38c88b)[_0x8803('0x1e')](_0x3c9440);}};}function respondWithFilteredResult(_0x213d23,_0x4c1058){return function(_0x84ae58){if(_0x84ae58){var _0x3b2204=typeof _0x4c1058['offset']==='undefined'&&typeof _0x4c1058['limit']===_0x8803('0x1f');var _0x1e5068=_0x84ae58[_0x8803('0x20')];var _0x549a4c=_0x3b2204?0x0:_0x4c1058['offset'];var _0x4cefb9=_0x3b2204?_0x84ae58[_0x8803('0x20')]:_0x4c1058[_0x8803('0x21')]+_0x4c1058[_0x8803('0x22')];var _0x1d6639;if(_0x4cefb9>=_0x1e5068){_0x4cefb9=_0x1e5068;_0x1d6639=0xc8;}else{_0x1d6639=0xce;}_0x213d23[_0x8803('0x1d')](_0x1d6639);return _0x213d23[_0x8803('0x23')]('Content-Range',_0x549a4c+'-'+_0x4cefb9+'/'+_0x1e5068)['json'](_0x84ae58);}return null;};}function saveUpdates(_0x4f3daf){return function(_0x20d420){if(_0x20d420){return _0x20d420['update'](_0x4f3daf)[_0x8803('0x12')](function(_0x342d5d){return _0x342d5d;});}return null;};}function removeEntity(_0x34b853){return function(_0x164667){if(_0x164667){return _0x164667[_0x8803('0x24')]()[_0x8803('0x12')](function(){_0x34b853[_0x8803('0x1d')](0xcc)[_0x8803('0x25')]();});}};}function handleEntityNotFound(_0x1749f2){return function(_0x2b33f0){if(!_0x2b33f0){_0x1749f2[_0x8803('0x26')](0x194);}return _0x2b33f0;};}function handleError(_0x267df0,_0x209865){_0x209865=_0x209865||0x1f4;return function(_0x3aedcc){logger[_0x8803('0x19')](_0x3aedcc['stack']);if(_0x3aedcc[_0x8803('0x27')]){delete _0x3aedcc['name'];}_0x267df0['status'](_0x209865)[_0x8803('0x28')](_0x3aedcc);};}exports[_0x8803('0x29')]=function(_0x1a5516,_0x15d0d3){var _0x1b352e={},_0x5c813b={},_0x4078e4={'count':0x0,'rows':[]};var _0x224b73=_[_0x8803('0x2a')](db[_0x8803('0x2b')][_0x8803('0x2c')],function(_0x48fb3c){return{'name':_0x48fb3c[_0x8803('0x2d')],'type':_0x48fb3c[_0x8803('0x2e')][_0x8803('0x2f')]};});_0x5c813b[_0x8803('0x30')]=_[_0x8803('0x2a')](_0x224b73,_0x8803('0x27'));_0x5c813b[_0x8803('0x31')]=_[_0x8803('0x32')](_0x1a5516[_0x8803('0x31')]);_0x5c813b[_0x8803('0x33')]=_[_0x8803('0x34')](_0x5c813b[_0x8803('0x30')],_0x5c813b[_0x8803('0x31')]);_0x1b352e[_0x8803('0x35')]=_[_0x8803('0x34')](_0x5c813b['model'],qs['fields'](_0x1a5516[_0x8803('0x31')][_0x8803('0x36')]));_0x1b352e[_0x8803('0x35')]=_0x1b352e[_0x8803('0x35')][_0x8803('0x37')]?_0x1b352e[_0x8803('0x35')]:_0x5c813b['model'];if(!_0x1a5516[_0x8803('0x31')][_0x8803('0x38')](_0x8803('0x39'))){_0x1b352e['limit']=qs['limit'](_0x1a5516['query'][_0x8803('0x22')]);_0x1b352e['offset']=qs[_0x8803('0x21')](_0x1a5516[_0x8803('0x31')][_0x8803('0x21')]);}_0x1b352e['order']=qs[_0x8803('0x3a')](_0x1a5516[_0x8803('0x31')][_0x8803('0x3a')]);_0x1b352e['where']=qs[_0x8803('0x33')](_[_0x8803('0x3b')](_0x1a5516[_0x8803('0x31')],_0x5c813b['filters']),_0x224b73);if(_0x1a5516[_0x8803('0x31')][_0x8803('0x3c')]){_0x1b352e[_0x8803('0x3d')]=_[_0x8803('0x3e')](_0x1b352e[_0x8803('0x3d')],{'$or':_[_0x8803('0x2a')](_0x224b73,function(_0xb8178b){if(_0xb8178b[_0x8803('0x2e')]!==_0x8803('0x3f')){var _0x503de4={};_0x503de4[_0xb8178b[_0x8803('0x27')]]={'$like':'%'+_0x1a5516[_0x8803('0x31')][_0x8803('0x3c')]+'%'};return _0x503de4;}})});}_0x1b352e=_[_0x8803('0x3e')]({},_0x1b352e,_0x1a5516['options']);var _0x5e3801={'where':_0x1b352e[_0x8803('0x3d')]};return db[_0x8803('0x2b')][_0x8803('0x20')](_0x5e3801)['then'](function(_0x5bc2c3){_0x4078e4[_0x8803('0x20')]=_0x5bc2c3;if(_0x1a5516[_0x8803('0x31')][_0x8803('0x40')]){_0x1b352e[_0x8803('0x41')]=[{'all':!![]}];}return db[_0x8803('0x2b')][_0x8803('0x42')](_0x1b352e);})['then'](function(_0x15d557){_0x4078e4[_0x8803('0x43')]=_0x15d557;return _0x4078e4;})['then'](respondWithFilteredResult(_0x15d0d3,_0x1b352e))[_0x8803('0x1c')](handleError(_0x15d0d3,null));};exports[_0x8803('0x44')]=function(_0x2c996f,_0x3f10df){var _0x189e53={'raw':!![],'where':{'id':_0x2c996f[_0x8803('0x45')]['id']}},_0x234be1={};_0x234be1[_0x8803('0x30')]=_[_0x8803('0x32')](db[_0x8803('0x2b')][_0x8803('0x2c')]);_0x234be1[_0x8803('0x31')]=_['keys'](_0x2c996f['query']);_0x234be1['filters']=_[_0x8803('0x34')](_0x234be1[_0x8803('0x30')],_0x234be1[_0x8803('0x31')]);_0x189e53[_0x8803('0x35')]=_['intersection'](_0x234be1['model'],qs['fields'](_0x2c996f[_0x8803('0x31')][_0x8803('0x36')]));_0x189e53[_0x8803('0x35')]=_0x189e53[_0x8803('0x35')][_0x8803('0x37')]?_0x189e53[_0x8803('0x35')]:_0x234be1['model'];if(_0x2c996f['query']['includeAll']){_0x189e53[_0x8803('0x41')]=[{'all':!![]}];}_0x189e53=_[_0x8803('0x3e')]({},_0x189e53,_0x2c996f[_0x8803('0x46')]);return db[_0x8803('0x2b')][_0x8803('0x47')](_0x189e53)['then'](handleEntityNotFound(_0x3f10df,null))[_0x8803('0x12')](respondWithResult(_0x3f10df,null))[_0x8803('0x1c')](handleError(_0x3f10df,null));};exports[_0x8803('0x48')]=function(_0x492428,_0x5ef0bc){if(_0x492428['body']['id']){delete _0x492428['body']['id'];}return db[_0x8803('0x2b')][_0x8803('0x47')]({'where':{'id':_0x492428['params']['id']}})[_0x8803('0x12')](handleEntityNotFound(_0x5ef0bc,null))['then'](saveUpdates(_0x492428['body'],null))['then'](respondWithResult(_0x5ef0bc,null))[_0x8803('0x1c')](handleError(_0x5ef0bc,null));};exports[_0x8803('0x24')]=function(_0x2472d3,_0x1f5f92){return db[_0x8803('0x2b')][_0x8803('0x47')]({'where':{'id':_0x2472d3['params']['id']}})['then'](handleEntityNotFound(_0x1f5f92,null))[_0x8803('0x12')](removeEntity(_0x1f5f92,null))[_0x8803('0x1c')](handleError(_0x1f5f92,null));};exports[_0x8803('0x49')]=function(_0x25e564,_0x3d34ba){return db[_0x8803('0x2b')][_0x8803('0x49')]()['then'](respondWithResult(_0x3d34ba,null))[_0x8803('0x1c')](handleError(_0x3d34ba,null));};exports[_0x8803('0x4a')]=function(_0x459f77,_0x46777a){return db[_0x8803('0x2b')]['create'](_0x459f77['body'])[_0x8803('0x12')](function(_0x4046e7){if(_0x4046e7){if(_0x4046e7['direction']===_0x8803('0x4b')&&!_0x4046e7[_0x8803('0x4c')]){var _0x278c29,_0x3aefb9,_0xdae871;if(_0x459f77['body']['to']){_0x3aefb9=_0x459f77[_0x8803('0x4d')]['to']['split'](',')[0x0];}return db[_0x8803('0x4e')]['findOne']({'where':{'id':_0x4046e7[_0x8803('0x4f')]},'include':[{'model':db[_0x8803('0x50')],'as':_0x8803('0x51'),'include':[{'model':db[_0x8803('0x52')],'as':'Contacts','where':{'email':_0x3aefb9},'limit':0x1,'order':[[_0x8803('0x53'),_0x8803('0x54')]]}]},{'model':db[_0x8803('0x55')],'as':_0x8803('0x56'),'raw':!![],'include':[{'model':db[_0x8803('0x57')],'as':_0x8803('0x57'),'raw':!![]}]}]})[_0x8803('0x12')](function(_0x10bfd7){_0x278c29=_0x10bfd7;if(!_0x278c29||!_0x278c29[_0x8803('0x56')])return;var _0x160e6d=_0x278c29[_0x8803('0x58')]();if(_0x459f77[_0x8803('0x4d')][_0x8803('0x59')]&&_0x459f77[_0x8803('0x4d')][_0x8803('0x59')][_0x8803('0x37')]){for(var _0x4e1bd4=0x0;_0x4e1bd4<_0x459f77['body']['attachments']['length'];_0x4e1bd4+=0x1){_0x459f77[_0x8803('0x4d')][_0x8803('0x59')][_0x4e1bd4]={'filename':_0x459f77[_0x8803('0x4d')][_0x8803('0x59')][_0x4e1bd4][_0x8803('0x27')],'path':path[_0x8803('0x5a')](config[_0x8803('0x5b')],'server/files/attachments',_0x459f77[_0x8803('0x4d')]['attachments'][_0x4e1bd4][_0x8803('0x5c')])};}}_0xdae871={'account':_0x160e6d,'message':_0x459f77['body']};return;})['then'](function(){if(_0x278c29[_0x8803('0x51')]){if(_0x278c29[_0x8803('0x51')]['Contacts'][_0x8803('0x37')]){return _0x278c29[_0x8803('0x51')]['Contacts'][0x0];}else{return db[_0x8803('0x52')]['create'](_[_0x8803('0x9')](_0x459f77[_0x8803('0x4d')],{'firstName':_0x459f77[_0x8803('0x4d')]['to'],'email':_0x459f77[_0x8803('0x4d')]['to'],'phone':_0x459f77[_0x8803('0x4d')]['to'],'ListId':_0x278c29['ListId']}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0xdae871){return respondWithRpcPromise(_0x8803('0x5d'),_0x8803('0x5e'),_0xdae871,client9003)[_0x8803('0x12')](function(_0x378087){return _0x4046e7[_0x8803('0x48')]({'read':!![],'messageId':_0x378087[_0x8803('0x5f')],'sentAt':moment()[_0x8803('0x60')](_0x8803('0x61'))});})['catch'](function(_0x3719bf){logger[_0x8803('0x19')]('%s',JSON['stringify'](_0x3719bf));return _0x4046e7;});}return _0x4046e7;});}return _0x4046e7;}})[_0x8803('0x12')](respondWithResult(_0x46777a,0xc9))[_0x8803('0x1c')](handleError(_0x46777a,null));};exports['accept']=function(_0x64b884,_0xd10210){var _0x375a9b=_0x8803('0x62');return interactionService[_0x8803('0x63')](_0x64b884,_0x375a9b)[_0x8803('0x12')](respondWithResult(_0xd10210,null))[_0x8803('0x1c')](handleError(_0xd10210,null));};exports['reject']=function(_0xaafcf2,_0x229689){var _0x38d838={'agent':{},'channel':_0x8803('0x62')};if(_0xaafcf2[_0x8803('0x4d')]['id']){delete _0xaafcf2[_0x8803('0x4d')]['id'];}_0xaafcf2['body'][_0x8803('0x64')]=_0xaafcf2['body'][_0x8803('0x64')]||_0xaafcf2[_0x8803('0x65')]['id'];_0x38d838[_0x8803('0x66')]['id']=_0xaafcf2[_0x8803('0x4d')][_0x8803('0x64')];return db['MailMessage'][_0x8803('0x47')]({'where':{'id':_0xaafcf2['params']['id'],'UserId':null}})[_0x8803('0x12')](handleEntityNotFound(_0x229689,null))['then'](function(_0x5ed022){if(_0x5ed022){_0x38d838[_0x8803('0x1b')]=_0x5ed022[_0x8803('0x67')]({'plain':!![]});return db['MailInteraction'][_0x8803('0x47')]({'where':{'id':_0x5ed022['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x229689,null))[_0x8803('0x12')](function(_0xf54a20){if(_0xf54a20){_0x38d838[_0x8803('0x68')]=_0xf54a20[_0x8803('0x67')]({'plain':!![]});interaction_log['info'](_0x8803('0x69'),_0xaafcf2[_0x8803('0x65')]['id'],_0xaafcf2['user'][_0x8803('0x27')],_0xaafcf2[_0x8803('0x65')][_0x8803('0x6a')],_0x38d838['interaction']['id'],_0xaafcf2[_0x8803('0x4d')]?JSON[_0x8803('0x18')](_0xaafcf2[_0x8803('0x4d')]):_0x8803('0x6b'));return respondWithRpcPromise(_0x8803('0x6c'),'rejectMessage',_0x38d838);}return null;})[_0x8803('0x12')](function(_0x26cf19){var _0x2d6f2b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x26cf19['message'][_0x8803('0x6d')];return db[_0x8803('0x6e')][_0x8803('0x31')](_0x2d6f2b,{'type':db[_0x8803('0x6f')][_0x8803('0x70')][_0x8803('0x71')],'raw':!![]})[_0x8803('0x12')](function(_0x5006ad){return _0x5006ad;});})[_0x8803('0x12')](function(_0x255c4a){if(_0x255c4a){_0x38d838[_0x8803('0x1b')]['contact']=_0x255c4a[0x0];if(!_0xaafcf2[_0x8803('0x4d')][_0x8803('0x64')])return;return db['User'][_0x8803('0x47')]({'where':{'id':_0xaafcf2[_0x8803('0x4d')][_0x8803('0x64')],'role':_0x8803('0x66')},'attributes':['id',_0x8803('0x27'),_0x8803('0x72'),_0x8803('0x73'),'internal'],'raw':!![]});}return null;})[_0x8803('0x12')](function(_0x11ab8d){if(!_0x11ab8d)return null;_0x38d838[_0x8803('0x1b')][_0x8803('0x66')]=_0x11ab8d;return _0x38d838;})[_0x8803('0x12')](function(_0x26118f){if(_0x26118f){_0x26118f[_0x8803('0x1b')][_0x8803('0x74')]=util['format'](_0x8803('0x75'),_0xaafcf2['user'][_0x8803('0x27')]);_0x26118f['message']['channel']=_0x38d838[_0x8803('0x76')];_0x26118f[_0x8803('0x1b')]['motionChannel']=_0x38d838['channel'];_0x26118f['message'][_0x8803('0x77')]=_0x8803('0x78');_0x26118f['message'][_0x8803('0x4d')]=htmlToText[_0x8803('0x79')](_0x38d838[_0x8803('0x1b')]['body']);respondWithRpcPromise(_0x8803('0x7a'),_0x8803('0x7a'),{'event':_0x8803('0x7b'),'message':_0x26118f[_0x8803('0x1b')]},client9002);return _0x38d838;}return null;})[_0x8803('0x12')](respondWithResult(_0x229689,null))[_0x8803('0x1c')](handleError(_0x229689,null));};exports[_0x8803('0x7c')]=function(_0x431677,_0x31eb91){var _0x663070=moment()[_0x8803('0x7d')]()[_0x8803('0x7e')]();var _0x5d3036=path[_0x8803('0x5a')](config[_0x8803('0x5b')],_0x8803('0x7f'),_0x8803('0x80'),_0x8803('0x81'));var _0x3e8331=path[_0x8803('0x5a')](config[_0x8803('0x5b')],_0x8803('0x7f'),_0x8803('0x80'),_0x8803('0x59'));var _0xa9a631=util[_0x8803('0x60')](_0x8803('0x82'),_0x663070);return db['MailMessage'][_0x8803('0x47')]({'where':{'id':_0x431677['params']['id']},'attributes':['id','body',_0x8803('0x83'),'to','cc','bcc','subject','createdAt'],'include':_0x431677['query']['attachments']?[{'model':db[_0x8803('0x84')],'as':_0x8803('0x85')}]:undefined})[_0x8803('0x12')](handleEntityNotFound(_0x31eb91,null))['then'](function(_0x2ec8c4){if(_0x2ec8c4){var _0x1389e1=_0x2ec8c4;var _0x2eae57={'from':_0x1389e1['from'],'to':_0x1389e1['to'],'subject':_0x1389e1[_0x8803('0x86')],'html':htmlEntities[_0x8803('0x87')](_0x1389e1[_0x8803('0x4d')]),'headers':{'Date':moment(_0x1389e1['createdAt'])[_0x8803('0x60')](_0x8803('0x88'))},'attachments':[]};if(_0x2ec8c4['cc']){_0x2eae57[_0x8803('0x89')]['Cc']=_0x2ec8c4['cc'];}if(_0x2ec8c4[_0x8803('0x8a')]){_0x2eae57['headers']['Bcc']=_0x2ec8c4[_0x8803('0x8a')];}return new Promise(function(_0x953a71,_0x150d79){if(_0x2ec8c4[_0x8803('0x85')]){for(var _0xe8fe6c=0x0;_0xe8fe6c<_0x2ec8c4['Attachments'][_0x8803('0x37')];_0xe8fe6c++){var _0x54769d=_0x2ec8c4['Attachments'][_0xe8fe6c];var _0x5eea55=path[_0x8803('0x5a')](_0x3e8331,_0x54769d[_0x8803('0x5c')]);if(fs[_0x8803('0x8b')](_0x5eea55)){_0x2eae57[_0x8803('0x59')]['push']({'name':_0x54769d['name'],'contentType':_0x54769d[_0x8803('0x2e')],'data':fs[_0x8803('0x8c')](_0x5eea55)});}}}emlformat[_0x8803('0x8d')](_0x2eae57,function(_0x1c8e0a,_0x32d8b5){if(_0x1c8e0a)return _0x150d79(_0x1c8e0a);fs[_0x8803('0x8e')](path[_0x8803('0x5a')](_0x5d3036,_0xa9a631),_0x32d8b5);return _0x953a71(_0x32d8b5);});});}})[_0x8803('0x12')](function(_0x40267e){if(_0x40267e){return _0x31eb91[_0x8803('0x7c')](path['join'](_0x5d3036,_0xa9a631),_0xa9a631,function(_0x489742){if(!_0x489742)fs[_0x8803('0x8f')](path[_0x8803('0x5a')](_0x5d3036,_0xa9a631));});}})[_0x8803('0x1c')](handleError(_0x31eb91,null));}; \ No newline at end of file +var _0x324e=['send','index','MailMessage','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','params','include','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','Contacts','defaults','ListId','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','acceptMessage','reject','UserId','user','agent','get','MailInteraction','MailInteractionId','role','null','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','motionChannel','event','EventManager','rejectmessage','download','unix','toString','server','files','tmp','format','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','status','offset','undefined','count','set','Content-Range','json','update','destroy','end','sendStatus','stack','name'];(function(_0x4a1253,_0x45de72){var _0x31e71b=function(_0x47bfcd){while(--_0x47bfcd){_0x4a1253['push'](_0x4a1253['shift']());}};_0x31e71b(++_0x45de72);}(_0x324e,0x1a5));var _0xe324=function(_0x208e7d,_0xae5335){_0x208e7d=_0x208e7d-0x0;var _0x55f761=_0x324e[_0x208e7d];return _0x55f761;};'use strict';var emlformat=require(_0xe324('0x0'));var moment=require(_0xe324('0x1'));var util=require(_0xe324('0x2'));var path=require(_0xe324('0x3'));var fs=require('fs');var _=require(_0xe324('0x4'));var Redis=require(_0xe324('0x5'));var htmlToText=require(_0xe324('0x6'));var interactionService=require(_0xe324('0x7'));var qs=require(_0xe324('0x8'));var logger=require(_0xe324('0x9'))(_0xe324('0xa'));var interaction_log=require(_0xe324('0x9'))(_0xe324('0xb'));var config=require(_0xe324('0xc'));var db=require(_0xe324('0xd'))['db'];config[_0xe324('0xe')]=_['defaults'](config['redis'],{'host':_0xe324('0xf'),'port':0x18eb});var socket=require(_0xe324('0x10'))(new Redis(config[_0xe324('0xe')]));var htmlEntities=require(_0xe324('0x11'));require(_0xe324('0x12'))['register'](socket);var jayson=require(_0xe324('0x13'));var client=jayson[_0xe324('0x14')][_0xe324('0x15')]({'port':0x232c});var client9003=jayson[_0xe324('0x14')]['http']({'port':0x232b});var client9002=jayson[_0xe324('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4319f5,_0xe10caf,_0x3177c7,_0x4c9921){return new Promise(function(_0x5ac3d8,_0x1cd252){var _0x59ea10=_0x4c9921||client;return _0x59ea10[_0xe324('0x16')](_0x4319f5,_0x3177c7)[_0xe324('0x17')](function(_0x4ca5b1){logger[_0xe324('0x18')](_0xe324('0x19'),_0xe10caf,_0xe324('0x1a'));logger[_0xe324('0x1b')](_0xe324('0x1c'),_0xe10caf,_0xe324('0x1a'),JSON['stringify'](_0x4ca5b1));if(_0x4ca5b1['error']){if(_0x4ca5b1['error'][_0xe324('0x1d')]===0x1f4){logger['error'](_0xe324('0x19'),_0xe10caf,_0x4ca5b1[_0xe324('0x1e')]['message']);return _0x1cd252(_0x4ca5b1[_0xe324('0x1e')][_0xe324('0x1f')]);}logger[_0xe324('0x1e')](_0xe324('0x19'),_0xe10caf,_0x4ca5b1[_0xe324('0x1e')][_0xe324('0x1f')]);return _0x5ac3d8(_0x4ca5b1[_0xe324('0x1e')][_0xe324('0x1f')]);}else{logger[_0xe324('0x18')](_0xe324('0x19'),_0xe10caf,'request\x20sent');_0x5ac3d8(_0x4ca5b1[_0xe324('0x20')][_0xe324('0x1f')]);}})[_0xe324('0x21')](function(_0x1d41e0){logger['error'](_0xe324('0x19'),_0xe10caf,_0x1d41e0);_0x1cd252(_0x1d41e0);});});}function respondWithResult(_0x5a5e84,_0x175039){_0x175039=_0x175039||0xc8;return function(_0x3be6d8){if(_0x3be6d8){return _0x5a5e84[_0xe324('0x22')](_0x175039)['json'](_0x3be6d8);}};}function respondWithFilteredResult(_0x2321e3,_0x50c808){return function(_0x45961e){if(_0x45961e){var _0x59eb2d=typeof _0x50c808[_0xe324('0x23')]===_0xe324('0x24')&&typeof _0x50c808['limit']==='undefined';var _0x324c83=_0x45961e[_0xe324('0x25')];var _0x327503=_0x59eb2d?0x0:_0x50c808[_0xe324('0x23')];var _0x576d10=_0x59eb2d?_0x45961e[_0xe324('0x25')]:_0x50c808['offset']+_0x50c808['limit'];var _0xbafe12;if(_0x576d10>=_0x324c83){_0x576d10=_0x324c83;_0xbafe12=0xc8;}else{_0xbafe12=0xce;}_0x2321e3[_0xe324('0x22')](_0xbafe12);return _0x2321e3[_0xe324('0x26')](_0xe324('0x27'),_0x327503+'-'+_0x576d10+'/'+_0x324c83)[_0xe324('0x28')](_0x45961e);}return null;};}function saveUpdates(_0x1fe7cf){return function(_0x1931c0){if(_0x1931c0){return _0x1931c0[_0xe324('0x29')](_0x1fe7cf)[_0xe324('0x17')](function(_0xce4ff1){return _0xce4ff1;});}return null;};}function removeEntity(_0x199a9f){return function(_0x4264ff){if(_0x4264ff){return _0x4264ff[_0xe324('0x2a')]()[_0xe324('0x17')](function(){_0x199a9f[_0xe324('0x22')](0xcc)[_0xe324('0x2b')]();});}};}function handleEntityNotFound(_0x1f55cb){return function(_0x4e3365){if(!_0x4e3365){_0x1f55cb[_0xe324('0x2c')](0x194);}return _0x4e3365;};}function handleError(_0xd2c36,_0x15be24){_0x15be24=_0x15be24||0x1f4;return function(_0x3f69b6){logger['error'](_0x3f69b6[_0xe324('0x2d')]);if(_0x3f69b6[_0xe324('0x2e')]){delete _0x3f69b6['name'];}_0xd2c36['status'](_0x15be24)[_0xe324('0x2f')](_0x3f69b6);};}exports[_0xe324('0x30')]=function(_0x5ab3ba,_0x26657b){var _0x222f89={},_0x121cfd={},_0x3c376f={'count':0x0,'rows':[]};var _0x2eefc5=_['map'](db[_0xe324('0x31')][_0xe324('0x32')],function(_0x200588){return{'name':_0x200588[_0xe324('0x33')],'type':_0x200588[_0xe324('0x34')][_0xe324('0x35')]};});_0x121cfd['model']=_[_0xe324('0x36')](_0x2eefc5,_0xe324('0x2e'));_0x121cfd[_0xe324('0x37')]=_[_0xe324('0x38')](_0x5ab3ba[_0xe324('0x37')]);_0x121cfd['filters']=_[_0xe324('0x39')](_0x121cfd['model'],_0x121cfd['query']);_0x222f89[_0xe324('0x3a')]=_[_0xe324('0x39')](_0x121cfd[_0xe324('0x3b')],qs[_0xe324('0x3c')](_0x5ab3ba[_0xe324('0x37')]['fields']));_0x222f89['attributes']=_0x222f89[_0xe324('0x3a')][_0xe324('0x3d')]?_0x222f89[_0xe324('0x3a')]:_0x121cfd[_0xe324('0x3b')];if(!_0x5ab3ba[_0xe324('0x37')][_0xe324('0x3e')](_0xe324('0x3f'))){_0x222f89[_0xe324('0x40')]=qs['limit'](_0x5ab3ba[_0xe324('0x37')][_0xe324('0x40')]);_0x222f89['offset']=qs[_0xe324('0x23')](_0x5ab3ba[_0xe324('0x37')][_0xe324('0x23')]);}_0x222f89[_0xe324('0x41')]=qs[_0xe324('0x42')](_0x5ab3ba[_0xe324('0x37')]['sort']);_0x222f89[_0xe324('0x43')]=qs[_0xe324('0x44')](_[_0xe324('0x45')](_0x5ab3ba[_0xe324('0x37')],_0x121cfd['filters']),_0x2eefc5);if(_0x5ab3ba[_0xe324('0x37')][_0xe324('0x46')]){_0x222f89['where']=_['merge'](_0x222f89[_0xe324('0x43')],{'$or':_[_0xe324('0x36')](_0x2eefc5,function(_0x106fcc){if(_0x106fcc[_0xe324('0x34')]!=='VIRTUAL'){var _0x400eea={};_0x400eea[_0x106fcc['name']]={'$like':'%'+_0x5ab3ba[_0xe324('0x37')][_0xe324('0x46')]+'%'};return _0x400eea;}})});}_0x222f89=_[_0xe324('0x47')]({},_0x222f89,_0x5ab3ba[_0xe324('0x48')]);var _0x50f347={'where':_0x222f89[_0xe324('0x43')]};return db[_0xe324('0x31')][_0xe324('0x25')](_0x50f347)[_0xe324('0x17')](function(_0x2bb5b1){_0x3c376f[_0xe324('0x25')]=_0x2bb5b1;if(_0x5ab3ba[_0xe324('0x37')][_0xe324('0x49')]){_0x222f89['include']=[{'all':!![]}];}return db[_0xe324('0x31')][_0xe324('0x4a')](_0x222f89);})[_0xe324('0x17')](function(_0x18b36d){_0x3c376f[_0xe324('0x4b')]=_0x18b36d;return _0x3c376f;})[_0xe324('0x17')](respondWithFilteredResult(_0x26657b,_0x222f89))[_0xe324('0x21')](handleError(_0x26657b,null));};exports['show']=function(_0x34fcac,_0x253c17){var _0x43e4c7={'raw':!![],'where':{'id':_0x34fcac[_0xe324('0x4c')]['id']}},_0x42be46={};_0x42be46[_0xe324('0x3b')]=_['keys'](db[_0xe324('0x31')][_0xe324('0x32')]);_0x42be46['query']=_[_0xe324('0x38')](_0x34fcac[_0xe324('0x37')]);_0x42be46[_0xe324('0x44')]=_[_0xe324('0x39')](_0x42be46[_0xe324('0x3b')],_0x42be46[_0xe324('0x37')]);_0x43e4c7['attributes']=_[_0xe324('0x39')](_0x42be46['model'],qs[_0xe324('0x3c')](_0x34fcac[_0xe324('0x37')][_0xe324('0x3c')]));_0x43e4c7['attributes']=_0x43e4c7[_0xe324('0x3a')][_0xe324('0x3d')]?_0x43e4c7[_0xe324('0x3a')]:_0x42be46[_0xe324('0x3b')];if(_0x34fcac['query'][_0xe324('0x49')]){_0x43e4c7[_0xe324('0x4d')]=[{'all':!![]}];}_0x43e4c7=_['merge']({},_0x43e4c7,_0x34fcac[_0xe324('0x48')]);return db['MailMessage'][_0xe324('0x4e')](_0x43e4c7)[_0xe324('0x17')](handleEntityNotFound(_0x253c17,null))[_0xe324('0x17')](respondWithResult(_0x253c17,null))[_0xe324('0x21')](handleError(_0x253c17,null));};exports['update']=function(_0x4a486d,_0xde6150){if(_0x4a486d[_0xe324('0x4f')]['id']){delete _0x4a486d['body']['id'];}return db[_0xe324('0x31')][_0xe324('0x4e')]({'where':{'id':_0x4a486d[_0xe324('0x4c')]['id']}})[_0xe324('0x17')](handleEntityNotFound(_0xde6150,null))['then'](saveUpdates(_0x4a486d[_0xe324('0x4f')],null))[_0xe324('0x17')](respondWithResult(_0xde6150,null))[_0xe324('0x21')](handleError(_0xde6150,null));};exports[_0xe324('0x2a')]=function(_0x2038c8,_0x137d61){return db[_0xe324('0x31')][_0xe324('0x4e')]({'where':{'id':_0x2038c8[_0xe324('0x4c')]['id']}})[_0xe324('0x17')](handleEntityNotFound(_0x137d61,null))[_0xe324('0x17')](removeEntity(_0x137d61,null))[_0xe324('0x21')](handleError(_0x137d61,null));};exports['describe']=function(_0x878a8f,_0x1e45c6){return db[_0xe324('0x31')][_0xe324('0x50')]()[_0xe324('0x17')](respondWithResult(_0x1e45c6,null))[_0xe324('0x21')](handleError(_0x1e45c6,null));};exports[_0xe324('0x51')]=function(_0x23052e,_0x1cb30c){return db['MailMessage'][_0xe324('0x51')](_0x23052e[_0xe324('0x4f')])[_0xe324('0x17')](function(_0x51bd63){if(_0x51bd63){if(_0x51bd63[_0xe324('0x52')]===_0xe324('0x53')&&!_0x51bd63[_0xe324('0x54')]){var _0x1d0f67,_0x496506,_0x3c4823;if(_0x23052e['body']['to']){_0x496506=_0x23052e[_0xe324('0x4f')]['to']['split'](',')[0x0];}return db[_0xe324('0x55')][_0xe324('0x56')]({'where':{'id':_0x51bd63[_0xe324('0x57')]},'include':[{'model':db[_0xe324('0x58')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x496506},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xe324('0x59')],'as':_0xe324('0x5a'),'raw':!![],'include':[{'model':db[_0xe324('0x5b')],'as':_0xe324('0x5b'),'raw':!![]}]}]})[_0xe324('0x17')](function(_0x3b1214){_0x1d0f67=_0x3b1214;if(!_0x1d0f67||!_0x1d0f67[_0xe324('0x5a')])return;var _0x4fe477=_0x1d0f67[_0xe324('0x5c')]();if(_0x23052e['body'][_0xe324('0x5d')]&&_0x23052e[_0xe324('0x4f')]['attachments'][_0xe324('0x3d')]){for(var _0x5e5dab=0x0;_0x5e5dab<_0x23052e[_0xe324('0x4f')][_0xe324('0x5d')]['length'];_0x5e5dab+=0x1){_0x23052e[_0xe324('0x4f')][_0xe324('0x5d')][_0x5e5dab]={'filename':_0x23052e['body'][_0xe324('0x5d')][_0x5e5dab][_0xe324('0x2e')],'path':path[_0xe324('0x5e')](config[_0xe324('0x5f')],_0xe324('0x60'),_0x23052e[_0xe324('0x4f')][_0xe324('0x5d')][_0x5e5dab][_0xe324('0x61')])};}}_0x3c4823={'account':_0x4fe477,'message':_0x23052e[_0xe324('0x4f')]};return;})[_0xe324('0x17')](function(){if(_0x1d0f67[_0xe324('0x62')]){if(_0x1d0f67[_0xe324('0x62')][_0xe324('0x63')][_0xe324('0x3d')]){return _0x1d0f67[_0xe324('0x62')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xe324('0x64')](_0x23052e[_0xe324('0x4f')],{'firstName':_0x23052e['body']['to'],'email':_0x23052e[_0xe324('0x4f')]['to'],'phone':_0x23052e[_0xe324('0x4f')]['to'],'ListId':_0x1d0f67[_0xe324('0x65')]}));}}else{throw new Error(_0xe324('0x66'));}})[_0xe324('0x17')](function(){if(_0x3c4823){return respondWithRpcPromise(_0xe324('0x67'),'sendMail',_0x3c4823,client9003)[_0xe324('0x17')](function(_0x5cee3c){return _0x51bd63['update']({'read':!![],'messageId':_0x5cee3c[_0xe324('0x68')],'sentAt':moment()['format'](_0xe324('0x69'))});})[_0xe324('0x21')](function(_0x296e38){logger[_0xe324('0x1e')]('%s',JSON[_0xe324('0x6a')](_0x296e38));return _0x51bd63;});}return _0x51bd63;});}return _0x51bd63;}})[_0xe324('0x17')](respondWithResult(_0x1cb30c,0xc9))['catch'](handleError(_0x1cb30c,null));};exports[_0xe324('0x6b')]=function(_0x10e32e,_0x35f202){var _0x28a67e=_0xe324('0x6c');return interactionService[_0xe324('0x6d')](_0x10e32e,_0x28a67e)[_0xe324('0x17')](respondWithResult(_0x35f202,null))['catch'](handleError(_0x35f202,null));};exports[_0xe324('0x6e')]=function(_0xa810d0,_0x2cfc91){var _0x53ac53={'agent':{},'channel':_0xe324('0x6c')};if(_0xa810d0[_0xe324('0x4f')]['id']){delete _0xa810d0[_0xe324('0x4f')]['id'];}_0xa810d0[_0xe324('0x4f')]['UserId']=_0xa810d0[_0xe324('0x4f')][_0xe324('0x6f')]||_0xa810d0[_0xe324('0x70')]['id'];_0x53ac53[_0xe324('0x71')]['id']=_0xa810d0[_0xe324('0x4f')][_0xe324('0x6f')];return db[_0xe324('0x31')][_0xe324('0x4e')]({'where':{'id':_0xa810d0[_0xe324('0x4c')]['id'],'UserId':null}})[_0xe324('0x17')](handleEntityNotFound(_0x2cfc91,null))[_0xe324('0x17')](function(_0xb6ee45){if(_0xb6ee45){_0x53ac53[_0xe324('0x1f')]=_0xb6ee45[_0xe324('0x72')]({'plain':!![]});return db[_0xe324('0x73')][_0xe324('0x4e')]({'where':{'id':_0xb6ee45[_0xe324('0x74')]}});}return null;})['then'](handleEntityNotFound(_0x2cfc91,null))['then'](function(_0x3fc186){if(_0x3fc186){_0x53ac53['interaction']=_0x3fc186[_0xe324('0x72')]({'plain':!![]});interaction_log[_0xe324('0x18')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa810d0['user']['id'],_0xa810d0[_0xe324('0x70')]['name'],_0xa810d0[_0xe324('0x70')][_0xe324('0x75')],_0x53ac53['interaction']['id'],_0xa810d0['body']?JSON[_0xe324('0x6a')](_0xa810d0['body']):_0xe324('0x76'));return respondWithRpcPromise('RejectMessage',_0xe324('0x77'),_0x53ac53);}return null;})[_0xe324('0x17')](function(_0x52477c){var _0x6eb37d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x52477c[_0xe324('0x1f')][_0xe324('0x78')];return db[_0xe324('0x79')][_0xe324('0x37')](_0x6eb37d,{'type':db[_0xe324('0x7a')][_0xe324('0x7b')][_0xe324('0x7c')],'raw':!![]})[_0xe324('0x17')](function(_0x2c9610){return _0x2c9610;});})[_0xe324('0x17')](function(_0x483128){if(_0x483128){_0x53ac53[_0xe324('0x1f')]['contact']=_0x483128[0x0];if(!_0xa810d0[_0xe324('0x4f')][_0xe324('0x6f')])return;return db[_0xe324('0x7d')][_0xe324('0x4e')]({'where':{'id':_0xa810d0[_0xe324('0x4f')][_0xe324('0x6f')],'role':_0xe324('0x71')},'attributes':['id',_0xe324('0x2e'),'fullname',_0xe324('0x7e'),_0xe324('0x7f')],'raw':!![]});}return null;})[_0xe324('0x17')](function(_0x1601c2){if(!_0x1601c2)return null;_0x53ac53[_0xe324('0x1f')][_0xe324('0x71')]=_0x1601c2;return _0x53ac53;})[_0xe324('0x17')](function(_0x5ab936){if(_0x5ab936){_0x5ab936[_0xe324('0x1f')][_0xe324('0x80')]=util['format'](_0xe324('0x81'),_0xa810d0['user'][_0xe324('0x2e')]);_0x5ab936['message']['channel']=_0x53ac53['channel'];_0x5ab936[_0xe324('0x1f')][_0xe324('0x82')]=_0x53ac53['channel'];_0x5ab936['message'][_0xe324('0x83')]=_0xe324('0x6e');_0x5ab936[_0xe324('0x1f')][_0xe324('0x4f')]=htmlToText['fromString'](_0x53ac53[_0xe324('0x1f')][_0xe324('0x4f')]);respondWithRpcPromise(_0xe324('0x84'),'EventManager',{'event':_0xe324('0x85'),'message':_0x5ab936[_0xe324('0x1f')]},client9002);return _0x53ac53;}return null;})['then'](respondWithResult(_0x2cfc91,null))[_0xe324('0x21')](handleError(_0x2cfc91,null));};exports[_0xe324('0x86')]=function(_0x38f769,_0x136e1d){var _0x4064a0=moment()[_0xe324('0x87')]()[_0xe324('0x88')]();var _0x112a52=path['join'](config['root'],_0xe324('0x89'),_0xe324('0x8a'),_0xe324('0x8b'));var _0xcac45f=path[_0xe324('0x5e')](config[_0xe324('0x5f')],_0xe324('0x89'),_0xe324('0x8a'),_0xe324('0x5d'));var _0x1b3870=util[_0xe324('0x8c')](_0xe324('0x8d'),_0x4064a0);return db['MailMessage'][_0xe324('0x4e')]({'where':{'id':_0x38f769['params']['id']},'attributes':['id',_0xe324('0x4f'),_0xe324('0x8e'),'to','cc',_0xe324('0x8f'),_0xe324('0x90'),_0xe324('0x91')],'include':_0x38f769['query'][_0xe324('0x5d')]?[{'model':db[_0xe324('0x92')],'as':_0xe324('0x93')}]:undefined})[_0xe324('0x17')](handleEntityNotFound(_0x136e1d,null))[_0xe324('0x17')](function(_0xdee460){if(_0xdee460){var _0x242b67=_0xdee460;var _0x34ee22={'from':_0x242b67[_0xe324('0x8e')],'to':_0x242b67['to'],'subject':_0x242b67[_0xe324('0x90')],'html':htmlEntities[_0xe324('0x94')](_0x242b67[_0xe324('0x4f')]),'headers':{'Date':moment(_0x242b67[_0xe324('0x91')])[_0xe324('0x8c')](_0xe324('0x95'))},'attachments':[]};if(_0xdee460['cc']){_0x34ee22[_0xe324('0x96')]['Cc']=_0xdee460['cc'];}if(_0xdee460['bcc']){_0x34ee22[_0xe324('0x96')][_0xe324('0x97')]=_0xdee460[_0xe324('0x8f')];}return new Promise(function(_0x179cd7,_0x388ac8){if(_0xdee460[_0xe324('0x93')]){for(var _0x10a439=0x0;_0x10a439<_0xdee460[_0xe324('0x93')][_0xe324('0x3d')];_0x10a439++){var _0x10c71d=_0xdee460['Attachments'][_0x10a439];var _0x46424d=path[_0xe324('0x5e')](_0xcac45f,_0x10c71d['basename']);if(fs['existsSync'](_0x46424d)){_0x34ee22[_0xe324('0x5d')][_0xe324('0x98')]({'name':_0x10c71d[_0xe324('0x2e')],'contentType':_0x10c71d[_0xe324('0x34')],'data':fs['readFileSync'](_0x46424d)});}}}emlformat[_0xe324('0x99')](_0x34ee22,function(_0x552824,_0x1804f4){if(_0x552824)return _0x388ac8(_0x552824);fs[_0xe324('0x9a')](path[_0xe324('0x5e')](_0x112a52,_0x1b3870),_0x1804f4);return _0x179cd7(_0x1804f4);});});}})[_0xe324('0x17')](function(_0x242c11){if(_0x242c11){return _0x136e1d[_0xe324('0x86')](path[_0xe324('0x5e')](_0x112a52,_0x1b3870),_0x1b3870,function(_0x775125){if(!_0x775125)fs[_0xe324('0x9b')](path[_0xe324('0x5e')](_0x112a52,_0x1b3870));});}})[_0xe324('0x21')](handleError(_0x136e1d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6ea7522..163e4c1 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 _0x5a5f=['save','update','remove','emit','hasOwnProperty','exports','MailMessage','setMaxListeners'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x5a5f,0x1ee));var _0xf5a5=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x5a5f[_0x1526e1];return _0x249a1e;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0xf5a5('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf5a5('0x1')](0x0);var events={'afterCreate':_0xf5a5('0x2'),'afterUpdate':_0xf5a5('0x3'),'afterDestroy':_0xf5a5('0x4')};function emitEvent(_0x46cfb4){return function(_0xd24d4d,_0x4faa11,_0x29ef9e){MailMessageEvents[_0xf5a5('0x5')](_0x46cfb4+':'+_0xd24d4d['id'],_0xd24d4d);MailMessageEvents[_0xf5a5('0x5')](_0x46cfb4,_0xd24d4d);_0x29ef9e(null);};}for(var e in events){if(events[_0xf5a5('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xf5a5('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xfbbb=['MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfbbb,0x87));var _0xbfbb=function(_0x136e5e,_0x2d5726){_0x136e5e=_0x136e5e-0x0;var _0x3427c1=_0xfbbb[_0x136e5e];return _0x3427c1;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xbfbb('0x0'))['db'][_0xbfbb('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbfbb('0x2')](0x0);var events={'afterCreate':_0xbfbb('0x3'),'afterUpdate':'update','afterDestroy':_0xbfbb('0x4')};function emitEvent(_0x1bb4dd){return function(_0x319196,_0x4d63d8,_0x415032){MailMessageEvents[_0xbfbb('0x5')](_0x1bb4dd+':'+_0x319196['id'],_0x319196);MailMessageEvents[_0xbfbb('0x5')](_0x1bb4dd,_0x319196);_0x415032(null);};}for(var e in events){if(events[_0xbfbb('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xbfbb('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b1de8f2..7ea3215 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 _0xf100=['toLowerCase','secret','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','plainBody','FULLTEXT','body','fromString','models','direction'];(function(_0x33539a,_0xab9aa5){var _0x1a99a7=function(_0x3e95db){while(--_0x3e95db){_0x33539a['push'](_0x33539a['shift']());}};_0x1a99a7(++_0xab9aa5);}(_0xf100,0x183));var _0x0f10=function(_0x3cd453,_0x239793){_0x3cd453=_0x3cd453-0x0;var _0x338dc1=_0xf100[_0x3cd453];return _0x338dc1;};'use strict';var _=require(_0x0f10('0x0'));var util=require(_0x0f10('0x1'));var logger=require(_0x0f10('0x2'))('api');var moment=require(_0x0f10('0x3'));var BPromise=require(_0x0f10('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x0f10('0x5'));var rimraf=require('rimraf');var config=require(_0x0f10('0x6'));var attributes=require(_0x0f10('0x7'));module[_0x0f10('0x8')]=function(_0x103d44,_0x409254){return _0x103d44[_0x0f10('0x9')]('MailMessage',attributes,{'tableName':_0x0f10('0xa'),'paranoid':![],'indexes':[{'name':_0x0f10('0xb'),'fields':[_0x0f10('0xb')]},{'name':'fti_mail_messages','fields':[_0x0f10('0xc'),'subject'],'type':_0x0f10('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x105846,_0x4bb708,_0x104b59){if(_0x105846[_0x0f10('0xe')]){_0x105846[_0x0f10('0xc')]=htmlToText[_0x0f10('0xf')](_0x105846[_0x0f10('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x104b59(null,_0x4bb708);},'afterCreate':function(_0x13b81a,_0xf6c78d,_0x1dc521){var _0x2d827a=_0x103d44[_0x0f10('0x10')];var _0x25fdbd=_0x13b81a['get']({'plain':!![]});if(_0x25fdbd[_0x0f10('0x11')]['toLowerCase']()==='in'||_0x25fdbd[_0x0f10('0x11')][_0x0f10('0x12')]()==='out'&&!_0x25fdbd[_0x0f10('0x13')]&&!_['isNil'](_0x25fdbd[_0x0f10('0x14')])){_0x2d827a[_0x0f10('0x15')][_0x0f10('0x16')]({'where':{'id':_0x25fdbd[_0x0f10('0x17')]}})[_0x0f10('0x18')](function(_0x188047){if(_0x188047){_0x188047['update']({'lastMsgAt':_0x25fdbd[_0x0f10('0x19')],'lastMsgDirection':_0x25fdbd[_0x0f10('0x11')]['toLowerCase']()});}})['catch'](function(_0x5216a4){console['error'](_0x5216a4);});}_0x1dc521();}},'charset':'utf8mb4','collate':_0x0f10('0x1a')});}; \ No newline at end of file +var _0x8bab=['createdAt','catch','error','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','models','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then'];(function(_0xdb2727,_0xce46aa){var _0x36d766=function(_0x62a5a7){while(--_0x62a5a7){_0xdb2727['push'](_0xdb2727['shift']());}};_0x36d766(++_0xce46aa);}(_0x8bab,0x139));var _0xb8ba=function(_0x1ee3ca,_0x942763){_0x1ee3ca=_0x1ee3ca-0x0;var _0x51d2ec=_0x8bab[_0x1ee3ca];return _0x51d2ec;};'use strict';var _=require(_0xb8ba('0x0'));var util=require(_0xb8ba('0x1'));var logger=require(_0xb8ba('0x2'))('api');var moment=require(_0xb8ba('0x3'));var BPromise=require(_0xb8ba('0x4'));var rp=require(_0xb8ba('0x5'));var htmlToText=require(_0xb8ba('0x6'));var fs=require('fs');var path=require(_0xb8ba('0x7'));var rimraf=require(_0xb8ba('0x8'));var config=require(_0xb8ba('0x9'));var attributes=require('./mailMessage.attributes');module[_0xb8ba('0xa')]=function(_0x28ae90,_0x544abf){return _0x28ae90['define']('MailMessage',attributes,{'tableName':_0xb8ba('0xb'),'paranoid':![],'indexes':[{'name':_0xb8ba('0xc'),'fields':[_0xb8ba('0xc')]},{'name':_0xb8ba('0xd'),'fields':['plainBody','subject'],'type':_0xb8ba('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f1f03,_0x223be2,_0x26652f){if(_0x3f1f03[_0xb8ba('0xf')]){_0x3f1f03[_0xb8ba('0x10')]=htmlToText[_0xb8ba('0x11')](_0x3f1f03[_0xb8ba('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x26652f(null,_0x223be2);},'afterCreate':function(_0x4c4923,_0x131d1f,_0x1e89c1){var _0x45874f=_0x28ae90[_0xb8ba('0x12')];var _0x20cac5=_0x4c4923['get']({'plain':!![]});if(_0x20cac5[_0xb8ba('0x13')][_0xb8ba('0x14')]()==='in'||_0x20cac5['direction'][_0xb8ba('0x14')]()===_0xb8ba('0x15')&&!_0x20cac5[_0xb8ba('0x16')]&&!_[_0xb8ba('0x17')](_0x20cac5['UserId'])){_0x45874f[_0xb8ba('0x18')][_0xb8ba('0x19')]({'where':{'id':_0x20cac5[_0xb8ba('0x1a')]}})[_0xb8ba('0x1b')](function(_0x219a63){if(_0x219a63){_0x219a63['update']({'lastMsgAt':_0x20cac5[_0xb8ba('0x1c')],'lastMsgDirection':_0x20cac5[_0xb8ba('0x13')][_0xb8ba('0x14')]()});}})[_0xb8ba('0x1d')](function(_0x236c51){console[_0xb8ba('0x1e')](_0x236c51);});}_0x1e89c1();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index fdae165..2fbbc62 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 _0x7334=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','create','body','options','raw','CreateMailMessage','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31ad98,_0xe532a2){var _0x1fb8c7=function(_0x110f7d){while(--_0x110f7d){_0x31ad98['push'](_0x31ad98['shift']());}};_0x1fb8c7(++_0xe532a2);}(_0x7334,0x184));var _0x4733=function(_0x3d3bb9,_0x148ba2){_0x3d3bb9=_0x3d3bb9-0x0;var _0x4ac12d=_0x7334[_0x3d3bb9];return _0x4ac12d;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});config[_0x4733('0xb')]=_[_0x4733('0xc')](config[_0x4733('0xb')],{'host':_0x4733('0xd'),'port':0x18eb});var socket=require(_0x4733('0xe'))(new Redis(config[_0x4733('0xb')]));require(_0x4733('0xf'))[_0x4733('0x10')](socket);function respondWithRpcPromise(_0x1bc511,_0x2bafad,_0x49032d){return new BPromise(function(_0x42b97f,_0x1e6fcf){return client['request'](_0x1bc511,_0x49032d)[_0x4733('0x11')](function(_0x5240a4){logger[_0x4733('0x12')](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));logger[_0x4733('0x15')](_0x4733('0x16'),_0x2bafad,_0x4733('0x14'),JSON[_0x4733('0x17')](_0x5240a4));if(_0x5240a4['error']){if(_0x5240a4[_0x4733('0x18')]['code']===0x1f4){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);return _0x1e6fcf(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')]['message']);return _0x42b97f(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}else{logger['info'](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));_0x42b97f(_0x5240a4[_0x4733('0x1a')][_0x4733('0x19')]);}})['catch'](function(_0x517fbc){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x517fbc);_0x1e6fcf(_0x517fbc);});});}exports['CreateMailMessage']=function(_0x32f166){var _0x1943bc=this;return new Promise(function(_0x15339c,_0x7a4e0){return db['MailMessage'][_0x4733('0x1b')](_0x32f166[_0x4733('0x1c')],{'raw':_0x32f166['options']?_0x32f166[_0x4733('0x1d')][_0x4733('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x15a291){logger[_0x4733('0x12')](_0x4733('0x1f'),_0x32f166);logger[_0x4733('0x15')](_0x4733('0x1f'),_0x32f166,JSON[_0x4733('0x17')](_0x15a291));_0x15339c(_0x15a291);})[_0x4733('0x20')](function(_0x2bb78f){logger['error'](_0x4733('0x1f'),_0x2bb78f[_0x4733('0x19')],_0x32f166);_0x7a4e0(_0x1943bc[_0x4733('0x18')](0x1f4,_0x2bb78f[_0x4733('0x19')]));});});}; \ No newline at end of file +var _0x0598=['CreateMailMessage','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','MailMessage','create','body','raw'];(function(_0x512891,_0x46005a){var _0x1c190c=function(_0x42b95b){while(--_0x42b95b){_0x512891['push'](_0x512891['shift']());}};_0x1c190c(++_0x46005a);}(_0x0598,0x92));var _0x8059=function(_0x1bbfce,_0x1af541){_0x1bbfce=_0x1bbfce-0x0;var _0x351612=_0x0598[_0x1bbfce];return _0x351612;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8059('0x7')](config[_0x8059('0x8')],{'host':_0x8059('0x9'),'port':0x18eb});var socket=require(_0x8059('0xa'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x8059('0xb')](socket);function respondWithRpcPromise(_0x1bf5fd,_0x336f85,_0x5097d6){return new BPromise(function(_0x283b63,_0x52a60d){return client['request'](_0x1bf5fd,_0x5097d6)[_0x8059('0xc')](function(_0x4109a9){logger['info']('MailMessage,\x20%s,\x20%s',_0x336f85,'request\x20sent');logger[_0x8059('0xd')](_0x8059('0xe'),_0x336f85,_0x8059('0xf'),JSON[_0x8059('0x10')](_0x4109a9));if(_0x4109a9[_0x8059('0x11')]){if(_0x4109a9['error'][_0x8059('0x12')]===0x1f4){logger['error'](_0x8059('0x13'),_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x52a60d(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x283b63(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}else{logger[_0x8059('0x15')](_0x8059('0x13'),_0x336f85,'request\x20sent');_0x283b63(_0x4109a9[_0x8059('0x16')][_0x8059('0x14')]);}})[_0x8059('0x17')](function(_0x1c4566){logger['error'](_0x8059('0x13'),_0x336f85,_0x1c4566);_0x52a60d(_0x1c4566);});});}exports['CreateMailMessage']=function(_0x113f42){var _0x493825=this;return new Promise(function(_0x1857c1,_0x56d794){return db[_0x8059('0x18')][_0x8059('0x19')](_0x113f42[_0x8059('0x1a')],{'raw':_0x113f42['options']?_0x113f42['options'][_0x8059('0x1b')]===undefined?!![]:![]:!![]})[_0x8059('0xc')](function(_0x32aeda){logger[_0x8059('0x15')]('CreateMailMessage',_0x113f42);logger[_0x8059('0xd')](_0x8059('0x1c'),_0x113f42,JSON[_0x8059('0x10')](_0x32aeda));_0x1857c1(_0x32aeda);})['catch'](function(_0xe9a72d){logger[_0x8059('0x11')](_0x8059('0x1c'),_0xe9a72d[_0x8059('0x14')],_0x113f42);_0x56d794(_0x493825['error'](0x1f4,_0xe9a72d[_0x8059('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d4ba879..18c6bb6 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 _0x78f9=['remove','update','register','length','./mailMessage.events','save'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x78f9,0x1d8));var _0x978f=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x78f9[_0x5783f4];return _0x28e380;};'use strict';var MailMessageEvents=require(_0x978f('0x0'));var events=[_0x978f('0x1'),_0x978f('0x2'),_0x978f('0x3')];function createListener(_0x23d060,_0x37eab7){return function(_0x2f627c){_0x37eab7['emit'](_0x23d060,_0x2f627c);};}function removeListener(_0x46a21b,_0x47f1d4){return function(){MailMessageEvents['removeListener'](_0x46a21b,_0x47f1d4);};}exports[_0x978f('0x4')]=function(_0x22a3d7){for(var _0x4244d0=0x0,_0x487398=events[_0x978f('0x5')];_0x4244d0<_0x487398;_0x4244d0++){var _0x1ece85=events[_0x4244d0];var _0x22a9bc=createListener('mailMessage:'+_0x1ece85,_0x22a3d7);MailMessageEvents['on'](_0x1ece85,_0x22a9bc);}}; \ No newline at end of file +var _0xa5fe=['register','length','mailMessage:','save','remove','update','emit','removeListener'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xa5fe,0xfb));var _0xea5f=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xa5fe[_0x273c39];return _0x46d6b5;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xea5f('0x0'),_0xea5f('0x1'),_0xea5f('0x2')];function createListener(_0x4d9df7,_0x1701d2){return function(_0x3876a4){_0x1701d2[_0xea5f('0x3')](_0x4d9df7,_0x3876a4);};}function removeListener(_0x3442b7,_0x24f95f){return function(){MailMessageEvents[_0xea5f('0x4')](_0x3442b7,_0x24f95f);};}exports[_0xea5f('0x5')]=function(_0x25be5f){for(var _0x3eb29d=0x0,_0x3a8a67=events[_0xea5f('0x6')];_0x3eb29d<_0x3a8a67;_0x3eb29d++){var _0x5ca31f=events[_0x3eb29d];var _0x28db88=createListener(_0xea5f('0x7')+_0x5ca31f,_0x25be5f);MailMessageEvents['on'](_0x5ca31f,_0x28db88);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d41a3b7..26dd663 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 _0x5a7f=['get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x5a7f,0x12c));var _0xf5a7=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5a7f[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xf5a7('0x0'));var util=require(_0xf5a7('0x1'));var path=require(_0xf5a7('0x2'));var timeout=require(_0xf5a7('0x3'));var express=require(_0xf5a7('0x4'));var router=express[_0xf5a7('0x5')]();var fs_extra=require(_0xf5a7('0x6'));var auth=require(_0xf5a7('0x7'));var interaction=require(_0xf5a7('0x8'));var config=require(_0xf5a7('0x9'));var controller=require('./mailQueue.controller');router[_0xf5a7('0xa')]('/',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0xc')]);router[_0xf5a7('0xa')](_0xf5a7('0xd'),auth[_0xf5a7('0xb')](),controller[_0xf5a7('0xe')]);router[_0xf5a7('0xa')](_0xf5a7('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xf5a7('0xa')]('/:id/members',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x10')]);router[_0xf5a7('0xa')](_0xf5a7('0x11'),auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x12')]);router[_0xf5a7('0xa')](_0xf5a7('0x13'),auth[_0xf5a7('0xb')](),controller['getAgents']);router[_0xf5a7('0x14')]('/',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x15')]);router[_0xf5a7('0x14')](_0xf5a7('0x11'),auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x16')]);router['post'](_0xf5a7('0x13'),auth['isAuthenticated'](),controller[_0xf5a7('0x17')]);router[_0xf5a7('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xf5a7('0x19')]);router[_0xf5a7('0x1a')]('/:id',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x1b')]);router[_0xf5a7('0x1a')](_0xf5a7('0x11'),auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x1c')]);router[_0xf5a7('0x1a')]('/:id/users',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x1d')]);module[_0xf5a7('0x1e')]=router; \ No newline at end of file +var _0x893a=['create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getAgents','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x893a,0xc7));var _0xa893=function(_0x57cd20,_0x40a6e9){_0x57cd20=_0x57cd20-0x0;var _0x4b0ac5=_0x893a[_0x57cd20];return _0x4b0ac5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa893('0x0'));var express=require('express');var router=express[_0xa893('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xa893('0x2'));var interaction=require(_0xa893('0x3'));var config=require(_0xa893('0x4'));var controller=require(_0xa893('0x5'));router[_0xa893('0x6')]('/',auth['isAuthenticated'](),controller[_0xa893('0x7')]);router[_0xa893('0x6')](_0xa893('0x8'),auth[_0xa893('0x9')](),controller[_0xa893('0xa')]);router[_0xa893('0x6')](_0xa893('0xb'),auth[_0xa893('0x9')](),controller[_0xa893('0xc')]);router[_0xa893('0x6')]('/:id/members',auth[_0xa893('0x9')](),controller[_0xa893('0xd')]);router[_0xa893('0x6')](_0xa893('0xe'),auth[_0xa893('0x9')](),controller['getTeams']);router[_0xa893('0x6')]('/:id/users',auth[_0xa893('0x9')](),controller[_0xa893('0xf')]);router[_0xa893('0x10')]('/',auth['isAuthenticated'](),controller[_0xa893('0x11')]);router[_0xa893('0x10')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xa893('0x10')](_0xa893('0x12'),auth[_0xa893('0x9')](),controller[_0xa893('0x13')]);router[_0xa893('0x14')]('/:id',auth[_0xa893('0x9')](),controller[_0xa893('0x15')]);router[_0xa893('0x16')](_0xa893('0xb'),auth[_0xa893('0x9')](),controller[_0xa893('0x17')]);router[_0xa893('0x16')](_0xa893('0xe'),auth[_0xa893('0x9')](),controller[_0xa893('0x18')]);router['delete'](_0xa893('0x12'),auth[_0xa893('0x9')](),controller[_0xa893('0x19')]);module[_0xa893('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index d5f7252..84a10d2 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 _0x224e=['beepall','roundrobin','sequelize','STRING','INTEGER','rrmemory'];(function(_0x221e15,_0x3ce785){var _0x347006=function(_0x45efaf){while(--_0x45efaf){_0x221e15['push'](_0x221e15['shift']());}};_0x347006(++_0x3ce785);}(_0x224e,0x1ac));var _0xe224=function(_0xd8c624,_0x12e8ef){_0xd8c624=_0xd8c624-0x0;var _0x51e058=_0x224e[_0xd8c624];return _0x51e058;};'use strict';var Sequelize=require(_0xe224('0x0'));module['exports']={'name':{'type':Sequelize[_0xe224('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe224('0x1')]},'timeout':{'type':Sequelize[_0xe224('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe224('0x3'),_0xe224('0x4'),_0xe224('0x5'))}}; \ No newline at end of file +var _0xe2df=['beepall','roundrobin','sequelize','STRING','INTEGER','ENUM'];(function(_0x2ef5ec,_0x4e486a){var _0x3b0f1e=function(_0x31d506){while(--_0x31d506){_0x2ef5ec['push'](_0x2ef5ec['shift']());}};_0x3b0f1e(++_0x4e486a);}(_0xe2df,0x1c4));var _0xfe2d=function(_0x2c9820,_0x2ed8ee){_0x2c9820=_0x2c9820-0x0;var _0x40945b=_0xe2df[_0x2c9820];return _0x40945b;};'use strict';var Sequelize=require(_0xfe2d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe2d('0x1')]},'timeout':{'type':Sequelize[_0xfe2d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfe2d('0x3')]('rrmemory',_0xfe2d('0x4'),_0xfe2d('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9ecf8a9..6cc0a4f 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 _0x0460=['name','send','index','map','MailQueue','fieldName','type','where','include','query','findAll','rows','catch','show','params','keys','rawAttributes','filters','model','attributes','intersection','fields','includeAll','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','describe','UserMailQueue','length','nolimit','order','sort','pick','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userMailQueue:save','field','tq.TeamId','team_has_mail_queues','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','includes','all','union','compact','value','removeTeams','ids','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','spread','isArray','getAgents','findOne','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','MailQueues','UserProfileResource'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0460,0xd2));var _0x0046=function(_0x218819,_0x4b151a){_0x218819=_0x218819-0x0;var _0x5d3a33=_0x0460[_0x218819];return _0x5d3a33;};'use strict';var BPromise=require(_0x0046('0x0'));var util=require(_0x0046('0x1'));var _=require(_0x0046('0x2'));var squel=require(_0x0046('0x3'));var Redis=require(_0x0046('0x4'));var qs=require(_0x0046('0x5'));var logger=require(_0x0046('0x6'))(_0x0046('0x7'));var config=require(_0x0046('0x8'));var db=require('../../mysqldb')['db'];config[_0x0046('0x9')]=_[_0x0046('0xa')](config[_0x0046('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0046('0x9')]));require(_0x0046('0xb'))[_0x0046('0xc')](socket);function respondWithStatusCode(_0x9024af,_0x3dbdef){_0x3dbdef=_0x3dbdef||0xcc;return function(_0x2b861f){if(_0x2b861f){return _0x9024af[_0x0046('0xd')](_0x3dbdef);}return _0x9024af[_0x0046('0xe')](_0x3dbdef)[_0x0046('0xf')]();};}function respondWithResult(_0x355afa,_0x1dae7f){_0x1dae7f=_0x1dae7f||0xc8;return function(_0x1c97bd){if(_0x1c97bd){return _0x355afa[_0x0046('0xe')](_0x1dae7f)['json'](_0x1c97bd);}};}function respondWithFilteredResult(_0x6d760b,_0xdac84){return function(_0x4b5678){if(_0x4b5678){var _0x31b69b=typeof _0xdac84[_0x0046('0x10')]===_0x0046('0x11')&&typeof _0xdac84[_0x0046('0x12')]===_0x0046('0x11');var _0x292401=_0x4b5678[_0x0046('0x13')];var _0x269c57=_0x31b69b?0x0:_0xdac84[_0x0046('0x10')];var _0x4170d4=_0x31b69b?_0x4b5678[_0x0046('0x13')]:_0xdac84[_0x0046('0x10')]+_0xdac84[_0x0046('0x12')];var _0x1f9619;if(_0x4170d4>=_0x292401){_0x4170d4=_0x292401;_0x1f9619=0xc8;}else{_0x1f9619=0xce;}_0x6d760b[_0x0046('0xe')](_0x1f9619);return _0x6d760b['set'](_0x0046('0x14'),_0x269c57+'-'+_0x4170d4+'/'+_0x292401)[_0x0046('0x15')](_0x4b5678);}return null;};}function saveUpdates(_0x43d9a9){return function(_0x1b48c4){if(_0x1b48c4){return _0x1b48c4[_0x0046('0x16')](_0x43d9a9)[_0x0046('0x17')](function(_0x837b3b){return _0x837b3b;});}return null;};}function removeEntity(_0x1d3714){return function(_0x173263){if(_0x173263){return _0x173263[_0x0046('0x18')]()[_0x0046('0x17')](function(){var _0x33c47d=_0x173263[_0x0046('0x19')]({'plain':!![]});var _0xb53582=_0x0046('0x1a');return db[_0x0046('0x1b')][_0x0046('0x18')]({'where':{'type':_0xb53582,'resourceId':_0x33c47d['id']}})[_0x0046('0x17')](function(){return _0x173263;});})[_0x0046('0x17')](function(){_0x1d3714[_0x0046('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ae3ad){return function(_0xfb3177){if(!_0xfb3177){_0x2ae3ad[_0x0046('0xd')](0x194);}return _0xfb3177;};}function handleError(_0x2eb0bd,_0xf88f82){_0xf88f82=_0xf88f82||0x1f4;return function(_0x146f84){logger['error'](_0x146f84['stack']);if(_0x146f84[_0x0046('0x1c')]){delete _0x146f84[_0x0046('0x1c')];}_0x2eb0bd[_0x0046('0xe')](_0xf88f82)[_0x0046('0x1d')](_0x146f84);};}exports[_0x0046('0x1e')]=function(_0x36a2ff,_0x9e9a96){var _0x851755={};var _0x81cd5f={'count':0x0,'rows':[]};var _0x43fcae=_[_0x0046('0x1f')](db[_0x0046('0x20')]['rawAttributes'],function(_0x2607e6){return{'name':_0x2607e6[_0x0046('0x21')],'type':_0x2607e6[_0x0046('0x22')]['key']};});_0x851755=qs['getOptions'](_0x43fcae,_0x36a2ff);var _0x428d43={'where':_0x851755[_0x0046('0x23')]};return db[_0x0046('0x20')][_0x0046('0x13')](_0x428d43)[_0x0046('0x17')](function(_0xd003fb){_0x81cd5f[_0x0046('0x13')]=_0xd003fb;_0x851755[_0x0046('0x24')]=qs[_0x0046('0x24')](_0x36a2ff[_0x0046('0x25')]);return db['MailQueue'][_0x0046('0x26')](_0x851755);})[_0x0046('0x17')](function(_0x1a3275){_0x81cd5f[_0x0046('0x27')]=_0x1a3275;return _0x81cd5f;})[_0x0046('0x17')](respondWithFilteredResult(_0x9e9a96,_0x851755))[_0x0046('0x28')](handleError(_0x9e9a96,null));};exports[_0x0046('0x29')]=function(_0x22197a,_0x1535d1){var _0x1d1dfe={'raw':!![],'where':{'id':_0x22197a[_0x0046('0x2a')]['id']}},_0x5184d0={};_0x5184d0['model']=_[_0x0046('0x2b')](db[_0x0046('0x20')][_0x0046('0x2c')]);_0x5184d0[_0x0046('0x25')]=_[_0x0046('0x2b')](_0x22197a[_0x0046('0x25')]);_0x5184d0[_0x0046('0x2d')]=_['intersection'](_0x5184d0[_0x0046('0x2e')],_0x5184d0['query']);_0x1d1dfe[_0x0046('0x2f')]=_[_0x0046('0x30')](_0x5184d0[_0x0046('0x2e')],qs[_0x0046('0x31')](_0x22197a[_0x0046('0x25')]['fields']));_0x1d1dfe[_0x0046('0x2f')]=_0x1d1dfe[_0x0046('0x2f')]['length']?_0x1d1dfe[_0x0046('0x2f')]:_0x5184d0['model'];if(_0x22197a[_0x0046('0x25')][_0x0046('0x32')]){_0x1d1dfe[_0x0046('0x24')]=[{'all':!![]}];}_0x1d1dfe=_[_0x0046('0x33')]({},_0x1d1dfe,_0x22197a[_0x0046('0x34')]);return db[_0x0046('0x20')][_0x0046('0x35')](_0x1d1dfe)['then'](handleEntityNotFound(_0x1535d1,null))[_0x0046('0x17')](respondWithResult(_0x1535d1,null))[_0x0046('0x28')](handleError(_0x1535d1,null));};exports[_0x0046('0x36')]=function(_0x3eaf76,_0x1c4e81){return db[_0x0046('0x20')]['create'](_0x3eaf76[_0x0046('0x37')],{})['then'](function(_0x7a9eb4){var _0xfec577=_0x3eaf76[_0x0046('0x38')][_0x0046('0x19')]({'plain':!![]});if(!_0xfec577)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfec577[_0x0046('0x39')]===_0x0046('0x38')){var _0x3c786f=_0x7a9eb4['get']({'plain':!![]});var _0x40dddd=_0x0046('0x1a');return db[_0x0046('0x3a')][_0x0046('0x35')]({'where':{'name':_0x40dddd,'userProfileId':_0xfec577[_0x0046('0x3b')]},'raw':!![]})[_0x0046('0x17')](function(_0x59cfc4){if(_0x59cfc4&&_0x59cfc4[_0x0046('0x3c')]===0x0){return db[_0x0046('0x1b')]['create']({'name':_0x3c786f['name'],'resourceId':_0x3c786f['id'],'type':_0x59cfc4[_0x0046('0x1c')],'sectionId':_0x59cfc4['id']},{})['then'](function(){return _0x7a9eb4;});}else{return _0x7a9eb4;}})[_0x0046('0x28')](function(_0x4f5d97){logger[_0x0046('0x3d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f5d97);throw _0x4f5d97;});}return _0x7a9eb4;})['then'](respondWithResult(_0x1c4e81,0xc9))[_0x0046('0x28')](handleError(_0x1c4e81,null));};exports[_0x0046('0x16')]=function(_0x1c20de,_0x119080){if(_0x1c20de[_0x0046('0x37')]['id']){delete _0x1c20de[_0x0046('0x37')]['id'];}return db['MailQueue'][_0x0046('0x35')]({'where':{'id':_0x1c20de[_0x0046('0x2a')]['id']}})['then'](handleEntityNotFound(_0x119080,null))[_0x0046('0x17')](saveUpdates(_0x1c20de[_0x0046('0x37')],null))[_0x0046('0x17')](respondWithResult(_0x119080,null))[_0x0046('0x28')](handleError(_0x119080,null));};exports[_0x0046('0x18')]=function(_0x4c1464,_0x5a0bff){return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x4c1464[_0x0046('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5a0bff,null))[_0x0046('0x17')](removeEntity(_0x5a0bff,null))[_0x0046('0x28')](handleError(_0x5a0bff,null));};exports[_0x0046('0x3e')]=function(_0xbf4fe1,_0x147b28){return db[_0x0046('0x20')][_0x0046('0x3e')]()[_0x0046('0x17')](respondWithResult(_0x147b28,null))[_0x0046('0x28')](handleError(_0x147b28,null));};exports['getMembers']=function(_0x470168,_0xd8ed82){var _0x45e6ba={'raw':!![],'where':{}},_0x31f759={},_0x2d17e7;return db[_0x0046('0x20')]['findOne']({'where':{'id':_0x470168['params']['id']}})[_0x0046('0x17')](handleEntityNotFound(_0xd8ed82,null))[_0x0046('0x17')](function(_0x32948b){if(_0x32948b){_0x2d17e7=_0x32948b[_0x0046('0x19')]({'plain':!![]});_0x31f759['model']=_[_0x0046('0x2b')](db[_0x0046('0x3f')][_0x0046('0x2c')]);_0x31f759['query']=_['keys'](_0x470168['query']);_0x31f759['filters']=_[_0x0046('0x30')](_0x31f759[_0x0046('0x2e')],_0x31f759['query']);_0x45e6ba[_0x0046('0x2f')]=_[_0x0046('0x30')](_0x31f759['model'],qs[_0x0046('0x31')](_0x470168[_0x0046('0x25')]['fields']));_0x45e6ba['attributes']=_0x45e6ba[_0x0046('0x2f')][_0x0046('0x40')]?_0x45e6ba[_0x0046('0x2f')]:_0x31f759[_0x0046('0x2e')];if(!_0x470168[_0x0046('0x25')]['hasOwnProperty'](_0x0046('0x41'))){_0x45e6ba['limit']=qs[_0x0046('0x12')](_0x470168[_0x0046('0x25')][_0x0046('0x12')]);_0x45e6ba[_0x0046('0x10')]=qs['offset'](_0x470168[_0x0046('0x25')]['offset']);}_0x45e6ba[_0x0046('0x42')]=qs['sort'](_0x470168['query'][_0x0046('0x43')]);_0x45e6ba[_0x0046('0x23')]=qs[_0x0046('0x2d')](_[_0x0046('0x44')](_0x470168[_0x0046('0x25')],_0x31f759[_0x0046('0x2d')]));_0x45e6ba[_0x0046('0x23')]['MailQueueId']=_0x32948b['id'];if(_0x470168[_0x0046('0x25')][_0x0046('0x45')]){_0x45e6ba[_0x0046('0x23')]=_[_0x0046('0x33')](_0x45e6ba['where'],{'$or':_[_0x0046('0x1f')](_0x45e6ba[_0x0046('0x2f')],function(_0x525f58){var _0x1ffcad={};_0x1ffcad[_0x525f58]={'$like':'%'+_0x470168[_0x0046('0x25')][_0x0046('0x45')]+'%'};return _0x1ffcad;})});}_0x45e6ba=_['merge']({},_0x45e6ba,_0x470168['options']);return db[_0x0046('0x3f')][_0x0046('0x26')](_0x45e6ba);}})[_0x0046('0x17')](function(_0x7f1283){if(_0x7f1283){return db[_0x0046('0x46')][_0x0046('0x47')]({'where':{'id':_[_0x0046('0x1f')](_0x7f1283,_0x0046('0x48')),'role':_0x0046('0x49')},'attributes':['id','name',_0x0046('0x4a'),_0x0046('0x4b'),_0x0046('0x4c')]});}})['then'](function(_0x3923fc){if(_0x3923fc){return{'count':_0x3923fc[_0x0046('0x13')],'rows':_[_0x0046('0x1f')](_0x3923fc['rows'],function(_0x482e00){return{'membername':_0x482e00[_0x0046('0x1c')],'UserId':_0x482e00['id'],'queue_name':_0x2d17e7[_0x0046('0x1c')],'MailQueueId':_0x2d17e7['id'],'interface':util[_0x0046('0x4d')](_0x0046('0x4e'),_0x0046('0x4f'),_0x482e00[_0x0046('0x1c')]),'penalty':0x0,'paused':_0x482e00[_0x0046('0x4a')],'createdAt':_0x482e00[_0x0046('0x4c')],'updatedAt':_0x482e00['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0046('0x17')](respondWithFilteredResult(_0xd8ed82,_0x45e6ba))[_0x0046('0x28')](handleError(_0xd8ed82,null));};exports[_0x0046('0x50')]=function(_0x20f672,_0xf7428b){var _0x3b7b53={};var _0x5c0a1d={};var _0x3b4fc1;var _0x2dc831;return db[_0x0046('0x20')]['findOne']({'where':{'id':_0x20f672[_0x0046('0x2a')]['id']}})['then'](handleEntityNotFound(_0xf7428b,null))[_0x0046('0x17')](function(_0x4cc9c2){if(_0x4cc9c2){_0x3b4fc1=_0x4cc9c2;_0x5c0a1d[_0x0046('0x2e')]=_[_0x0046('0x2b')](db[_0x0046('0x51')][_0x0046('0x2c')]);_0x5c0a1d['query']=_[_0x0046('0x2b')](_0x20f672[_0x0046('0x25')]);_0x5c0a1d[_0x0046('0x2d')]=_['intersection'](_0x5c0a1d[_0x0046('0x2e')],_0x5c0a1d['query']);_0x3b7b53['attributes']=_[_0x0046('0x30')](_0x5c0a1d[_0x0046('0x2e')],qs[_0x0046('0x31')](_0x20f672['query']['fields']));_0x3b7b53[_0x0046('0x2f')]=_0x3b7b53['attributes'][_0x0046('0x40')]?_0x3b7b53[_0x0046('0x2f')]:_0x5c0a1d['model'];_0x3b7b53[_0x0046('0x42')]=qs[_0x0046('0x43')](_0x20f672[_0x0046('0x25')][_0x0046('0x43')]);_0x3b7b53[_0x0046('0x23')]=qs[_0x0046('0x2d')](_[_0x0046('0x44')](_0x20f672['query'],_0x5c0a1d[_0x0046('0x2d')]));if(_0x20f672[_0x0046('0x25')][_0x0046('0x45')]){_0x3b7b53[_0x0046('0x23')]=_[_0x0046('0x33')](_0x3b7b53[_0x0046('0x23')],{'$or':_[_0x0046('0x1f')](_0x3b7b53[_0x0046('0x2f')],function(_0xdeaa30){var _0x19ff59={};_0x19ff59[_0xdeaa30]={'$like':'%'+_0x20f672[_0x0046('0x25')][_0x0046('0x45')]+'%'};return _0x19ff59;})});}_0x3b7b53=_['merge']({},_0x3b7b53,_0x20f672[_0x0046('0x34')]);return _0x3b4fc1[_0x0046('0x50')](_0x3b7b53);}})[_0x0046('0x17')](function(_0x5139c5){if(_0x5139c5){_0x2dc831=_0x5139c5[_0x0046('0x40')];if(!_0x20f672['query']['hasOwnProperty'](_0x0046('0x41'))){_0x3b7b53[_0x0046('0x12')]=qs[_0x0046('0x12')](_0x20f672[_0x0046('0x25')][_0x0046('0x12')]);_0x3b7b53[_0x0046('0x10')]=qs[_0x0046('0x10')](_0x20f672[_0x0046('0x25')]['offset']);}return _0x3b4fc1[_0x0046('0x50')](_0x3b7b53);}})[_0x0046('0x17')](function(_0x4d1f2b){if(_0x4d1f2b){return _0x4d1f2b?{'count':_0x2dc831,'rows':_0x4d1f2b}:null;}})[_0x0046('0x17')](respondWithResult(_0xf7428b,null))['catch'](handleError(_0xf7428b,null));};exports[_0x0046('0x52')]=function(_0x5502ac,_0x202c70){var _0x52766c=_0x5502ac[_0x0046('0x37')]['ids'];return db[_0x0046('0x51')][_0x0046('0x26')]({'where':{'id':_0x52766c},'attributes':['id'],'include':[{'model':db[_0x0046('0x46')],'as':_0x0046('0x53'),'attributes':['id','name',_0x0046('0x54'),_0x0046('0x55'),_0x0046('0x56')],'raw':!![]}]})['then'](function(_0x259a96){if(_0x259a96){var _0x278c93=_[_0x0046('0x57')](_0x259a96,function(_0x3e14f8){var _0x2f10dc=_0x3e14f8['get']({'plain':!![]});return _0x2f10dc[_0x0046('0x53')];});return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x5502ac['params']['id']}})[_0x0046('0x17')](function(_0xc4e699){return db[_0x0046('0x58')][_0x0046('0x59')](function(_0x2a42d4){return _0xc4e699[_0x0046('0x52')](_0x52766c,{'transaction':_0x2a42d4})['then'](function(){return BPromise[_0x0046('0x5a')](_0x278c93,function(_0x9255a6){return db[_0x0046('0x3f')]['findOrCreate']({'where':{'UserId':_0x9255a6['id'],'MailQueueId':_0x5502ac['params']['id']},'transaction':_0x2a42d4});});})[_0x0046('0x17')](function(){_0x278c93[_0x0046('0x5b')](function(_0x44a4a8){socket['emit'](_0x0046('0x5c'),{'UserId':_0x44a4a8['id'],'MailQueueId':_0xc4e699['id']});});});});});}})[_0x0046('0x17')](respondWithStatusCode(_0x202c70,null))['catch'](handleError(_0x202c70,null));};exports['removeTeams']=function(_0x304fcd,_0x5817f8){return db['Team'][_0x0046('0x26')]({'where':{'id':_0x304fcd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x0046('0x46')],'as':_0x0046('0x53'),'attributes':['id'],'raw':!![]}]})[_0x0046('0x17')](handleEntityNotFound(_0x5817f8,null))[_0x0046('0x17')](function(_0x3784a3){var _0x1f808d=_[_0x0046('0x1f')](_0x3784a3,'id');var _0xac0bc=[];var _0x3bff14=[];var _0x9eb055=squel['select']();_0x9eb055[_0x0046('0x5d')](_0x0046('0x5e'))['from'](_0x0046('0x5f'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0046('0x23')](_0x0046('0x60'),_0x304fcd['params']['id']);for(var _0x482846=0x0;_0x482846<_0x3784a3[_0x0046('0x40')];_0x482846+=0x1){let _0x3516ff=_0x3784a3[_0x482846];for(var _0x456f43=0x0;_0x456f43<_0x3516ff[_0x0046('0x53')]['length'];_0x456f43+=0x1){let _0x4da10d=_0x3516ff[_0x0046('0x53')][_0x456f43];var _0x19ea54=_0x9eb055[_0x0046('0x61')]();_0x19ea54[_0x0046('0x23')]('ut.UserId\x20=\x20?',_0x4da10d['id']);_0x3bff14[_0x0046('0x62')](db[_0x0046('0x58')][_0x0046('0x25')](_0x19ea54[_0x0046('0x63')](),{'type':db[_0x0046('0x58')][_0x0046('0x64')]['SELECT']})['then'](function(_0x709237){if(_0x709237[_0x0046('0x40')]===0x1){return _0x4da10d['id'];}else{var _0x2fed10=_[_0x0046('0x65')](_[_0x0046('0x1f')](_0x709237,'TeamId'),function(_0x304dbb){return _[_0x0046('0x66')](_0x1f808d,_0x304dbb);});if(_0x2fed10){return _0x4da10d['id'];}}}));}}return BPromise[_0x0046('0x67')](_0x3bff14)[_0x0046('0x17')](function(_0x15608d){_0xac0bc=_(_0xac0bc)[_0x0046('0x68')](_0x15608d)[_0x0046('0x69')]()[_0x0046('0x6a')]();return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x304fcd[_0x0046('0x2a')]['id']}})[_0x0046('0x17')](function(_0x1f84c7){return db['sequelize'][_0x0046('0x59')](function(_0x5ed78d){return _0x1f84c7[_0x0046('0x6b')](_0x304fcd[_0x0046('0x25')][_0x0046('0x6c')],{'transaction':_0x5ed78d})[_0x0046('0x17')](function(){if(!_[_0x0046('0x6d')](_0xac0bc)){return _0x1f84c7[_0x0046('0x6e')](_0xac0bc,{'transaction':_0x5ed78d});}})[_0x0046('0x17')](function(){_0xac0bc['forEach'](function(_0x95f35c){socket[_0x0046('0x6f')](_0x0046('0x70'),{'UserId':_0x95f35c,'MailQueueId':_0x1f84c7['id']});});});});});});})[_0x0046('0x17')](respondWithStatusCode(_0x5817f8,null))[_0x0046('0x28')](handleError(_0x5817f8,null));};exports[_0x0046('0x71')]=function(_0x1ef6d6,_0x165cb8){return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x1ef6d6[_0x0046('0x2a')]['id']}})[_0x0046('0x17')](handleEntityNotFound(_0x165cb8,null))[_0x0046('0x17')](function(_0x10295c){if(_0x10295c){return _0x10295c[_0x0046('0x71')](_0x1ef6d6[_0x0046('0x37')][_0x0046('0x6c')],_['omit'](_0x1ef6d6[_0x0046('0x37')],[_0x0046('0x6c'),'id'])||{})[_0x0046('0x72')](function(_0xdc396){for(var _0x105522=0x0;_0x105522<_0x1ef6d6['body'][_0x0046('0x6c')][_0x0046('0x40')];_0x105522+=0x1){socket[_0x0046('0x6f')](_0x0046('0x5c'),{'UserId':Number(_0x1ef6d6[_0x0046('0x37')]['ids'][_0x105522]),'MailQueueId':Number(_0x1ef6d6[_0x0046('0x2a')]['id'])});}return _0xdc396;});}})[_0x0046('0x17')](respondWithResult(_0x165cb8,null))['catch'](handleError(_0x165cb8,null));};exports[_0x0046('0x6e')]=function(_0x2ac4a6,_0x6335b1){return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x2ac4a6[_0x0046('0x2a')]['id']}})[_0x0046('0x17')](handleEntityNotFound(_0x6335b1,null))['then'](function(_0x2a3534){if(_0x2a3534){return _0x2a3534[_0x0046('0x6e')](_0x2ac4a6['query'][_0x0046('0x6c')])[_0x0046('0x17')](function(){if(_[_0x0046('0x73')](_0x2ac4a6[_0x0046('0x25')]['ids'])){for(var _0x8466c=0x0;_0x8466c<_0x2ac4a6[_0x0046('0x25')][_0x0046('0x6c')]['length'];_0x8466c+=0x1){socket['emit'](_0x0046('0x70'),{'UserId':Number(_0x2ac4a6['query']['ids'][_0x8466c]),'MailQueueId':Number(_0x2ac4a6['params']['id'])});}}else{socket[_0x0046('0x6f')](_0x0046('0x70'),{'UserId':Number(_0x2ac4a6[_0x0046('0x25')][_0x0046('0x6c')]),'MailQueueId':Number(_0x2ac4a6[_0x0046('0x2a')]['id'])});}});}})[_0x0046('0x17')](respondWithStatusCode(_0x6335b1,null))[_0x0046('0x28')](handleError(_0x6335b1,null));};exports[_0x0046('0x74')]=function(_0x56b1d6,_0x5708bc){var _0x44ed3a={};var _0x4e2a98={};var _0x43c175;var _0x48d973;return db[_0x0046('0x20')][_0x0046('0x75')]({'where':{'id':_0x56b1d6[_0x0046('0x2a')]['id']}})[_0x0046('0x17')](handleEntityNotFound(_0x5708bc,null))[_0x0046('0x17')](function(_0xea0b70){if(_0xea0b70){_0x43c175=_0xea0b70;_0x4e2a98['model']=_[_0x0046('0x2b')](db[_0x0046('0x46')][_0x0046('0x2c')]);_0x4e2a98[_0x0046('0x25')]=_['keys'](_0x56b1d6[_0x0046('0x25')]);_0x4e2a98['filters']=_[_0x0046('0x30')](_0x4e2a98[_0x0046('0x2e')],_0x4e2a98[_0x0046('0x25')]);_0x44ed3a[_0x0046('0x2f')]=_[_0x0046('0x30')](_0x4e2a98[_0x0046('0x2e')],qs['fields'](_0x56b1d6[_0x0046('0x25')][_0x0046('0x31')]));_0x44ed3a[_0x0046('0x2f')]=_0x44ed3a['attributes'][_0x0046('0x40')]?_0x44ed3a['attributes']:_0x4e2a98[_0x0046('0x2e')];_0x44ed3a['order']=qs['sort'](_0x56b1d6['query'][_0x0046('0x43')]);_0x44ed3a[_0x0046('0x23')]=qs[_0x0046('0x2d')](_[_0x0046('0x44')](_0x56b1d6[_0x0046('0x25')],_0x4e2a98[_0x0046('0x2d')]));if(_0x56b1d6[_0x0046('0x25')][_0x0046('0x45')]){_0x44ed3a[_0x0046('0x23')]=_[_0x0046('0x33')](_0x44ed3a[_0x0046('0x23')],{'$or':_['map'](_0x44ed3a['attributes'],function(_0x31fbe0){var _0x5e6ab4={};_0x5e6ab4[_0x31fbe0]={'$like':'%'+_0x56b1d6[_0x0046('0x25')]['filter']+'%'};return _0x5e6ab4;})});}_0x44ed3a=_['merge']({},_0x44ed3a,_0x56b1d6[_0x0046('0x34')]);return _0x43c175[_0x0046('0x74')](_0x44ed3a);}})['then'](function(_0x30e540){if(_0x30e540){_0x48d973=_0x30e540[_0x0046('0x40')];if(!_0x56b1d6[_0x0046('0x25')][_0x0046('0x76')](_0x0046('0x41'))){_0x44ed3a[_0x0046('0x12')]=qs['limit'](_0x56b1d6['query'][_0x0046('0x12')]);_0x44ed3a[_0x0046('0x10')]=qs[_0x0046('0x10')](_0x56b1d6['query'][_0x0046('0x10')]);}return _0x43c175[_0x0046('0x74')](_0x44ed3a);}})[_0x0046('0x17')](function(_0x2020ae){if(_0x2020ae){return _0x2020ae?{'count':_0x48d973,'rows':_0x2020ae}:null;}})['then'](respondWithResult(_0x5708bc,null))[_0x0046('0x28')](handleError(_0x5708bc,null));}; \ No newline at end of file +var _0xb64c=['length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','hasOwnProperty','nolimit','order','sort','where','pick','MailQueueId','filter','map','UserMailQueue','findAll','User','findAndCountAll','agent','mailPause','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','each','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','compact','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','then','destroy','get','UserProfileResource','error','name','send','MailQueue','rawAttributes','fieldName','key','count','include','query','catch','show','params','model','keys','filters','intersection','attributes','fields'];(function(_0x50e000,_0x329299){var _0x593387=function(_0x463cb8){while(--_0x463cb8){_0x50e000['push'](_0x50e000['shift']());}};_0x593387(++_0x329299);}(_0xb64c,0x19e));var _0xcb64=function(_0x21afde,_0x4454ce){_0x21afde=_0x21afde-0x0;var _0x33cde=_0xb64c[_0x21afde];return _0x33cde;};'use strict';var BPromise=require(_0xcb64('0x0'));var util=require(_0xcb64('0x1'));var _=require(_0xcb64('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xcb64('0x3'));var config=require(_0xcb64('0x4'));var db=require(_0xcb64('0x5'))['db'];config[_0xcb64('0x6')]=_[_0xcb64('0x7')](config[_0xcb64('0x6')],{'host':_0xcb64('0x8'),'port':0x18eb});var socket=require(_0xcb64('0x9'))(new Redis(config[_0xcb64('0x6')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x49ef27,_0x8840f4){_0x8840f4=_0x8840f4||0xcc;return function(_0xbff344){if(_0xbff344){return _0x49ef27[_0xcb64('0xa')](_0x8840f4);}return _0x49ef27[_0xcb64('0xb')](_0x8840f4)[_0xcb64('0xc')]();};}function respondWithResult(_0x543b31,_0x847329){_0x847329=_0x847329||0xc8;return function(_0x550339){if(_0x550339){return _0x543b31[_0xcb64('0xb')](_0x847329)[_0xcb64('0xd')](_0x550339);}};}function respondWithFilteredResult(_0x197f37,_0x237ef8){return function(_0x1cd2c2){if(_0x1cd2c2){var _0x5126c2=typeof _0x237ef8[_0xcb64('0xe')]===_0xcb64('0xf')&&typeof _0x237ef8[_0xcb64('0x10')]===_0xcb64('0xf');var _0x3e67ce=_0x1cd2c2['count'];var _0x5e9039=_0x5126c2?0x0:_0x237ef8['offset'];var _0x11bde5=_0x5126c2?_0x1cd2c2['count']:_0x237ef8[_0xcb64('0xe')]+_0x237ef8['limit'];var _0x20e657;if(_0x11bde5>=_0x3e67ce){_0x11bde5=_0x3e67ce;_0x20e657=0xc8;}else{_0x20e657=0xce;}_0x197f37[_0xcb64('0xb')](_0x20e657);return _0x197f37[_0xcb64('0x11')](_0xcb64('0x12'),_0x5e9039+'-'+_0x11bde5+'/'+_0x3e67ce)['json'](_0x1cd2c2);}return null;};}function saveUpdates(_0x42b19f){return function(_0x28af39){if(_0x28af39){return _0x28af39['update'](_0x42b19f)[_0xcb64('0x13')](function(_0x2c3290){return _0x2c3290;});}return null;};}function removeEntity(_0xb0653c){return function(_0x84d6cc){if(_0x84d6cc){return _0x84d6cc[_0xcb64('0x14')]()[_0xcb64('0x13')](function(){var _0x121288=_0x84d6cc[_0xcb64('0x15')]({'plain':!![]});var _0x1ed6bc='MailQueues';return db[_0xcb64('0x16')][_0xcb64('0x14')]({'where':{'type':_0x1ed6bc,'resourceId':_0x121288['id']}})[_0xcb64('0x13')](function(){return _0x84d6cc;});})[_0xcb64('0x13')](function(){_0xb0653c[_0xcb64('0xb')](0xcc)[_0xcb64('0xc')]();});}};}function handleEntityNotFound(_0x263630){return function(_0x43e53e){if(!_0x43e53e){_0x263630['sendStatus'](0x194);}return _0x43e53e;};}function handleError(_0x53f801,_0x133c0f){_0x133c0f=_0x133c0f||0x1f4;return function(_0x53a7b5){logger[_0xcb64('0x17')](_0x53a7b5['stack']);if(_0x53a7b5[_0xcb64('0x18')]){delete _0x53a7b5[_0xcb64('0x18')];}_0x53f801[_0xcb64('0xb')](_0x133c0f)[_0xcb64('0x19')](_0x53a7b5);};}exports['index']=function(_0x150fa1,_0x3cab4e){var _0x3fb10c={};var _0x571849={'count':0x0,'rows':[]};var _0x16bda3=_['map'](db[_0xcb64('0x1a')][_0xcb64('0x1b')],function(_0x20682c){return{'name':_0x20682c[_0xcb64('0x1c')],'type':_0x20682c['type'][_0xcb64('0x1d')]};});_0x3fb10c=qs['getOptions'](_0x16bda3,_0x150fa1);var _0x5efe4a={'where':_0x3fb10c['where']};return db['MailQueue'][_0xcb64('0x1e')](_0x5efe4a)['then'](function(_0x1220fd){_0x571849['count']=_0x1220fd;_0x3fb10c[_0xcb64('0x1f')]=qs[_0xcb64('0x1f')](_0x150fa1[_0xcb64('0x20')]);return db['MailQueue']['findAll'](_0x3fb10c);})['then'](function(_0x39f927){_0x571849['rows']=_0x39f927;return _0x571849;})[_0xcb64('0x13')](respondWithFilteredResult(_0x3cab4e,_0x3fb10c))[_0xcb64('0x21')](handleError(_0x3cab4e,null));};exports[_0xcb64('0x22')]=function(_0x31ec58,_0xde4610){var _0x1d6b9c={'raw':!![],'where':{'id':_0x31ec58[_0xcb64('0x23')]['id']}},_0xcf091e={};_0xcf091e[_0xcb64('0x24')]=_[_0xcb64('0x25')](db[_0xcb64('0x1a')][_0xcb64('0x1b')]);_0xcf091e[_0xcb64('0x20')]=_['keys'](_0x31ec58['query']);_0xcf091e[_0xcb64('0x26')]=_[_0xcb64('0x27')](_0xcf091e[_0xcb64('0x24')],_0xcf091e[_0xcb64('0x20')]);_0x1d6b9c[_0xcb64('0x28')]=_[_0xcb64('0x27')](_0xcf091e[_0xcb64('0x24')],qs['fields'](_0x31ec58[_0xcb64('0x20')][_0xcb64('0x29')]));_0x1d6b9c['attributes']=_0x1d6b9c[_0xcb64('0x28')][_0xcb64('0x2a')]?_0x1d6b9c['attributes']:_0xcf091e[_0xcb64('0x24')];if(_0x31ec58['query'][_0xcb64('0x2b')]){_0x1d6b9c[_0xcb64('0x1f')]=[{'all':!![]}];}_0x1d6b9c=_[_0xcb64('0x2c')]({},_0x1d6b9c,_0x31ec58[_0xcb64('0x2d')]);return db[_0xcb64('0x1a')][_0xcb64('0x2e')](_0x1d6b9c)[_0xcb64('0x13')](handleEntityNotFound(_0xde4610,null))['then'](respondWithResult(_0xde4610,null))[_0xcb64('0x21')](handleError(_0xde4610,null));};exports[_0xcb64('0x2f')]=function(_0x47fd5a,_0x2f58ac){return db['MailQueue'][_0xcb64('0x2f')](_0x47fd5a['body'],{})[_0xcb64('0x13')](function(_0xbda78b){var _0x44a781=_0x47fd5a[_0xcb64('0x30')][_0xcb64('0x15')]({'plain':!![]});if(!_0x44a781)throw new Error(_0xcb64('0x31'));if(_0x44a781[_0xcb64('0x32')]===_0xcb64('0x30')){var _0x2f77ab=_0xbda78b[_0xcb64('0x15')]({'plain':!![]});var _0xc4729d='MailQueues';return db['UserProfileSection'][_0xcb64('0x2e')]({'where':{'name':_0xc4729d,'userProfileId':_0x44a781[_0xcb64('0x33')]},'raw':!![]})['then'](function(_0x17f1d2){if(_0x17f1d2&&_0x17f1d2[_0xcb64('0x34')]===0x0){return db['UserProfileResource'][_0xcb64('0x2f')]({'name':_0x2f77ab[_0xcb64('0x18')],'resourceId':_0x2f77ab['id'],'type':_0x17f1d2[_0xcb64('0x18')],'sectionId':_0x17f1d2['id']},{})[_0xcb64('0x13')](function(){return _0xbda78b;});}else{return _0xbda78b;}})[_0xcb64('0x21')](function(_0xaaa45d){logger[_0xcb64('0x17')](_0xcb64('0x35'),_0xaaa45d);throw _0xaaa45d;});}return _0xbda78b;})[_0xcb64('0x13')](respondWithResult(_0x2f58ac,0xc9))[_0xcb64('0x21')](handleError(_0x2f58ac,null));};exports['update']=function(_0x43f9c4,_0x3abe28){if(_0x43f9c4[_0xcb64('0x36')]['id']){delete _0x43f9c4['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0x43f9c4[_0xcb64('0x23')]['id']}})[_0xcb64('0x13')](handleEntityNotFound(_0x3abe28,null))[_0xcb64('0x13')](saveUpdates(_0x43f9c4['body'],null))['then'](respondWithResult(_0x3abe28,null))[_0xcb64('0x21')](handleError(_0x3abe28,null));};exports[_0xcb64('0x14')]=function(_0x21d7f4,_0x6fbce){return db[_0xcb64('0x1a')][_0xcb64('0x2e')]({'where':{'id':_0x21d7f4['params']['id']}})[_0xcb64('0x13')](handleEntityNotFound(_0x6fbce,null))['then'](removeEntity(_0x6fbce,null))[_0xcb64('0x21')](handleError(_0x6fbce,null));};exports[_0xcb64('0x37')]=function(_0x36c243,_0x20cbe3){return db[_0xcb64('0x1a')]['describe']()[_0xcb64('0x13')](respondWithResult(_0x20cbe3,null))['catch'](handleError(_0x20cbe3,null));};exports['getMembers']=function(_0x42a0fd,_0x1621b8){var _0x2fd668={'raw':!![],'where':{}},_0x594fb2={},_0x22e114;return db[_0xcb64('0x1a')][_0xcb64('0x38')]({'where':{'id':_0x42a0fd[_0xcb64('0x23')]['id']}})['then'](handleEntityNotFound(_0x1621b8,null))['then'](function(_0x5e7894){if(_0x5e7894){_0x22e114=_0x5e7894[_0xcb64('0x15')]({'plain':!![]});_0x594fb2[_0xcb64('0x24')]=_['keys'](db['UserMailQueue'][_0xcb64('0x1b')]);_0x594fb2[_0xcb64('0x20')]=_[_0xcb64('0x25')](_0x42a0fd['query']);_0x594fb2['filters']=_[_0xcb64('0x27')](_0x594fb2['model'],_0x594fb2[_0xcb64('0x20')]);_0x2fd668['attributes']=_[_0xcb64('0x27')](_0x594fb2[_0xcb64('0x24')],qs['fields'](_0x42a0fd['query'][_0xcb64('0x29')]));_0x2fd668[_0xcb64('0x28')]=_0x2fd668[_0xcb64('0x28')][_0xcb64('0x2a')]?_0x2fd668[_0xcb64('0x28')]:_0x594fb2[_0xcb64('0x24')];if(!_0x42a0fd[_0xcb64('0x20')][_0xcb64('0x39')](_0xcb64('0x3a'))){_0x2fd668[_0xcb64('0x10')]=qs[_0xcb64('0x10')](_0x42a0fd[_0xcb64('0x20')][_0xcb64('0x10')]);_0x2fd668[_0xcb64('0xe')]=qs[_0xcb64('0xe')](_0x42a0fd[_0xcb64('0x20')]['offset']);}_0x2fd668[_0xcb64('0x3b')]=qs[_0xcb64('0x3c')](_0x42a0fd['query']['sort']);_0x2fd668[_0xcb64('0x3d')]=qs['filters'](_[_0xcb64('0x3e')](_0x42a0fd['query'],_0x594fb2['filters']));_0x2fd668['where'][_0xcb64('0x3f')]=_0x5e7894['id'];if(_0x42a0fd[_0xcb64('0x20')][_0xcb64('0x40')]){_0x2fd668[_0xcb64('0x3d')]=_[_0xcb64('0x2c')](_0x2fd668[_0xcb64('0x3d')],{'$or':_[_0xcb64('0x41')](_0x2fd668[_0xcb64('0x28')],function(_0x12b66a){var _0x3466b8={};_0x3466b8[_0x12b66a]={'$like':'%'+_0x42a0fd['query']['filter']+'%'};return _0x3466b8;})});}_0x2fd668=_[_0xcb64('0x2c')]({},_0x2fd668,_0x42a0fd[_0xcb64('0x2d')]);return db[_0xcb64('0x42')][_0xcb64('0x43')](_0x2fd668);}})['then'](function(_0x5d0ad1){if(_0x5d0ad1){return db[_0xcb64('0x44')][_0xcb64('0x45')]({'where':{'id':_[_0xcb64('0x41')](_0x5d0ad1,'UserId'),'role':_0xcb64('0x46')},'attributes':['id','name',_0xcb64('0x47'),'updatedAt',_0xcb64('0x48')]});}})[_0xcb64('0x13')](function(_0x51c614){if(_0x51c614){return{'count':_0x51c614['count'],'rows':_[_0xcb64('0x41')](_0x51c614[_0xcb64('0x49')],function(_0x32beb6){return{'membername':_0x32beb6[_0xcb64('0x18')],'UserId':_0x32beb6['id'],'queue_name':_0x22e114[_0xcb64('0x18')],'MailQueueId':_0x22e114['id'],'interface':util[_0xcb64('0x4a')](_0xcb64('0x4b'),_0xcb64('0x4c'),_0x32beb6[_0xcb64('0x18')]),'penalty':0x0,'paused':_0x32beb6['mailPause'],'createdAt':_0x32beb6['createdAt'],'updatedAt':_0x32beb6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcb64('0x13')](respondWithFilteredResult(_0x1621b8,_0x2fd668))[_0xcb64('0x21')](handleError(_0x1621b8,null));};exports[_0xcb64('0x4d')]=function(_0x5c6f8a,_0xd7fdc7){var _0x5820d6={};var _0x18f916={};var _0x4cec37;var _0x355454;return db[_0xcb64('0x1a')][_0xcb64('0x38')]({'where':{'id':_0x5c6f8a[_0xcb64('0x23')]['id']}})[_0xcb64('0x13')](handleEntityNotFound(_0xd7fdc7,null))[_0xcb64('0x13')](function(_0x52b75f){if(_0x52b75f){_0x4cec37=_0x52b75f;_0x18f916[_0xcb64('0x24')]=_[_0xcb64('0x25')](db['Team'][_0xcb64('0x1b')]);_0x18f916[_0xcb64('0x20')]=_[_0xcb64('0x25')](_0x5c6f8a[_0xcb64('0x20')]);_0x18f916[_0xcb64('0x26')]=_['intersection'](_0x18f916[_0xcb64('0x24')],_0x18f916[_0xcb64('0x20')]);_0x5820d6[_0xcb64('0x28')]=_[_0xcb64('0x27')](_0x18f916[_0xcb64('0x24')],qs[_0xcb64('0x29')](_0x5c6f8a[_0xcb64('0x20')][_0xcb64('0x29')]));_0x5820d6['attributes']=_0x5820d6[_0xcb64('0x28')][_0xcb64('0x2a')]?_0x5820d6[_0xcb64('0x28')]:_0x18f916[_0xcb64('0x24')];_0x5820d6['order']=qs[_0xcb64('0x3c')](_0x5c6f8a[_0xcb64('0x20')][_0xcb64('0x3c')]);_0x5820d6[_0xcb64('0x3d')]=qs[_0xcb64('0x26')](_['pick'](_0x5c6f8a[_0xcb64('0x20')],_0x18f916[_0xcb64('0x26')]));if(_0x5c6f8a['query'][_0xcb64('0x40')]){_0x5820d6['where']=_['merge'](_0x5820d6['where'],{'$or':_[_0xcb64('0x41')](_0x5820d6[_0xcb64('0x28')],function(_0x323c7c){var _0x374be9={};_0x374be9[_0x323c7c]={'$like':'%'+_0x5c6f8a[_0xcb64('0x20')][_0xcb64('0x40')]+'%'};return _0x374be9;})});}_0x5820d6=_['merge']({},_0x5820d6,_0x5c6f8a[_0xcb64('0x2d')]);return _0x4cec37[_0xcb64('0x4d')](_0x5820d6);}})[_0xcb64('0x13')](function(_0x54f157){if(_0x54f157){_0x355454=_0x54f157[_0xcb64('0x2a')];if(!_0x5c6f8a[_0xcb64('0x20')][_0xcb64('0x39')]('nolimit')){_0x5820d6['limit']=qs[_0xcb64('0x10')](_0x5c6f8a['query'][_0xcb64('0x10')]);_0x5820d6[_0xcb64('0xe')]=qs[_0xcb64('0xe')](_0x5c6f8a[_0xcb64('0x20')][_0xcb64('0xe')]);}return _0x4cec37[_0xcb64('0x4d')](_0x5820d6);}})[_0xcb64('0x13')](function(_0x5be6a0){if(_0x5be6a0){return _0x5be6a0?{'count':_0x355454,'rows':_0x5be6a0}:null;}})['then'](respondWithResult(_0xd7fdc7,null))[_0xcb64('0x21')](handleError(_0xd7fdc7,null));};exports[_0xcb64('0x4e')]=function(_0x5b18cc,_0x3daedf){var _0x1608a2=_0x5b18cc[_0xcb64('0x36')][_0xcb64('0x4f')];return db[_0xcb64('0x50')][_0xcb64('0x43')]({'where':{'id':_0x1608a2},'attributes':['id'],'include':[{'model':db[_0xcb64('0x44')],'as':_0xcb64('0x51'),'attributes':['id',_0xcb64('0x18'),'online',_0xcb64('0x52'),'interface'],'raw':!![]}]})['then'](function(_0x1df593){if(_0x1df593){var _0x56427c=_[_0xcb64('0x53')](_0x1df593,function(_0x59dc5c){var _0x40e978=_0x59dc5c[_0xcb64('0x15')]({'plain':!![]});return _0x40e978[_0xcb64('0x51')];});return db[_0xcb64('0x1a')][_0xcb64('0x2e')]({'where':{'id':_0x5b18cc['params']['id']}})[_0xcb64('0x13')](function(_0x230f97){return db[_0xcb64('0x54')][_0xcb64('0x55')](function(_0x12b221){return _0x230f97[_0xcb64('0x4e')](_0x1608a2,{'transaction':_0x12b221})[_0xcb64('0x13')](function(){return BPromise[_0xcb64('0x56')](_0x56427c,function(_0x14cc09){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x14cc09['id'],'MailQueueId':_0x5b18cc[_0xcb64('0x23')]['id']},'transaction':_0x12b221});});})[_0xcb64('0x13')](function(){_0x56427c['forEach'](function(_0x48e76d){socket[_0xcb64('0x57')](_0xcb64('0x58'),{'UserId':_0x48e76d['id'],'MailQueueId':_0x230f97['id']});});});});});}})[_0xcb64('0x13')](respondWithStatusCode(_0x3daedf,null))[_0xcb64('0x21')](handleError(_0x3daedf,null));};exports[_0xcb64('0x59')]=function(_0xf0bdb1,_0x38650b){return db[_0xcb64('0x50')]['findAll']({'where':{'id':_0xf0bdb1['query'][_0xcb64('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xcb64('0x44')],'as':_0xcb64('0x51'),'attributes':['id'],'raw':!![]}]})[_0xcb64('0x13')](handleEntityNotFound(_0x38650b,null))[_0xcb64('0x13')](function(_0x4365de){var _0x476f77=_[_0xcb64('0x41')](_0x4365de,'id');var _0x29a9c6=[];var _0x136d37=[];var _0x4bb64d=squel[_0xcb64('0x5a')]();_0x4bb64d[_0xcb64('0x5b')](_0xcb64('0x5c'))['from']('team_has_mail_queues','tq')[_0xcb64('0x5d')](_0xcb64('0x5e'),'ut',_0xcb64('0x5f'))[_0xcb64('0x3d')](_0xcb64('0x60'),_0xf0bdb1[_0xcb64('0x23')]['id']);for(var _0x205050=0x0;_0x205050<_0x4365de[_0xcb64('0x2a')];_0x205050+=0x1){let _0x323993=_0x4365de[_0x205050];for(var _0x142744=0x0;_0x142744<_0x323993[_0xcb64('0x51')][_0xcb64('0x2a')];_0x142744+=0x1){let _0x2b34fa=_0x323993['Agents'][_0x142744];var _0x2b4ac8=_0x4bb64d[_0xcb64('0x61')]();_0x2b4ac8[_0xcb64('0x3d')](_0xcb64('0x62'),_0x2b34fa['id']);_0x136d37[_0xcb64('0x63')](db[_0xcb64('0x54')]['query'](_0x2b4ac8[_0xcb64('0x64')](),{'type':db[_0xcb64('0x54')]['QueryTypes']['SELECT']})[_0xcb64('0x13')](function(_0xa9fdf8){if(_0xa9fdf8[_0xcb64('0x2a')]===0x1){return _0x2b34fa['id'];}else{var _0xfd6b2e=_[_0xcb64('0x65')](_['map'](_0xa9fdf8,'TeamId'),function(_0x158afc){return _[_0xcb64('0x66')](_0x476f77,_0x158afc);});if(_0xfd6b2e){return _0x2b34fa['id'];}}}));}}return BPromise[_0xcb64('0x67')](_0x136d37)['then'](function(_0x14bcf0){_0x29a9c6=_(_0x29a9c6)[_0xcb64('0x68')](_0x14bcf0)[_0xcb64('0x69')]()['value']();return db[_0xcb64('0x1a')]['find']({'where':{'id':_0xf0bdb1[_0xcb64('0x23')]['id']}})[_0xcb64('0x13')](function(_0x5ea84c){return db[_0xcb64('0x54')][_0xcb64('0x55')](function(_0x50f649){return _0x5ea84c[_0xcb64('0x59')](_0xf0bdb1['query'][_0xcb64('0x4f')],{'transaction':_0x50f649})['then'](function(){if(!_[_0xcb64('0x6a')](_0x29a9c6)){return _0x5ea84c[_0xcb64('0x6b')](_0x29a9c6,{'transaction':_0x50f649});}})[_0xcb64('0x13')](function(){_0x29a9c6[_0xcb64('0x6c')](function(_0x30593f){socket[_0xcb64('0x57')](_0xcb64('0x6d'),{'UserId':_0x30593f,'MailQueueId':_0x5ea84c['id']});});});});});});})['then'](respondWithStatusCode(_0x38650b,null))[_0xcb64('0x21')](handleError(_0x38650b,null));};exports[_0xcb64('0x6e')]=function(_0x17872c,_0x3cde23){return db[_0xcb64('0x1a')][_0xcb64('0x2e')]({'where':{'id':_0x17872c[_0xcb64('0x23')]['id']}})[_0xcb64('0x13')](handleEntityNotFound(_0x3cde23,null))[_0xcb64('0x13')](function(_0x30720b){if(_0x30720b){return _0x30720b[_0xcb64('0x6e')](_0x17872c[_0xcb64('0x36')][_0xcb64('0x4f')],_['omit'](_0x17872c[_0xcb64('0x36')],['ids','id'])||{})[_0xcb64('0x6f')](function(_0x3db609){for(var _0x45d05e=0x0;_0x45d05e<_0x17872c[_0xcb64('0x36')]['ids'][_0xcb64('0x2a')];_0x45d05e+=0x1){socket[_0xcb64('0x57')](_0xcb64('0x58'),{'UserId':Number(_0x17872c['body'][_0xcb64('0x4f')][_0x45d05e]),'MailQueueId':Number(_0x17872c['params']['id'])});}return _0x3db609;});}})[_0xcb64('0x13')](respondWithResult(_0x3cde23,null))['catch'](handleError(_0x3cde23,null));};exports[_0xcb64('0x6b')]=function(_0x51b878,_0x2298f7){return db[_0xcb64('0x1a')][_0xcb64('0x2e')]({'where':{'id':_0x51b878[_0xcb64('0x23')]['id']}})[_0xcb64('0x13')](handleEntityNotFound(_0x2298f7,null))[_0xcb64('0x13')](function(_0x2bdbb0){if(_0x2bdbb0){return _0x2bdbb0['removeAgents'](_0x51b878[_0xcb64('0x20')]['ids'])[_0xcb64('0x13')](function(){if(_[_0xcb64('0x70')](_0x51b878[_0xcb64('0x20')][_0xcb64('0x4f')])){for(var _0x17be55=0x0;_0x17be55<_0x51b878[_0xcb64('0x20')][_0xcb64('0x4f')]['length'];_0x17be55+=0x1){socket['emit'](_0xcb64('0x6d'),{'UserId':Number(_0x51b878[_0xcb64('0x20')][_0xcb64('0x4f')][_0x17be55]),'MailQueueId':Number(_0x51b878[_0xcb64('0x23')]['id'])});}}else{socket[_0xcb64('0x57')]('userMailQueue:remove',{'UserId':Number(_0x51b878['query'][_0xcb64('0x4f')]),'MailQueueId':Number(_0x51b878[_0xcb64('0x23')]['id'])});}});}})[_0xcb64('0x13')](respondWithStatusCode(_0x2298f7,null))[_0xcb64('0x21')](handleError(_0x2298f7,null));};exports[_0xcb64('0x71')]=function(_0x5dd2a8,_0x2b82e3){var _0x53f5b8={};var _0x392f15={};var _0x5b6a68;var _0x59c666;return db['MailQueue'][_0xcb64('0x38')]({'where':{'id':_0x5dd2a8[_0xcb64('0x23')]['id']}})[_0xcb64('0x13')](handleEntityNotFound(_0x2b82e3,null))['then'](function(_0x121717){if(_0x121717){_0x5b6a68=_0x121717;_0x392f15['model']=_['keys'](db['User']['rawAttributes']);_0x392f15[_0xcb64('0x20')]=_[_0xcb64('0x25')](_0x5dd2a8[_0xcb64('0x20')]);_0x392f15['filters']=_[_0xcb64('0x27')](_0x392f15[_0xcb64('0x24')],_0x392f15[_0xcb64('0x20')]);_0x53f5b8['attributes']=_[_0xcb64('0x27')](_0x392f15[_0xcb64('0x24')],qs[_0xcb64('0x29')](_0x5dd2a8[_0xcb64('0x20')][_0xcb64('0x29')]));_0x53f5b8[_0xcb64('0x28')]=_0x53f5b8['attributes'][_0xcb64('0x2a')]?_0x53f5b8['attributes']:_0x392f15[_0xcb64('0x24')];_0x53f5b8[_0xcb64('0x3b')]=qs[_0xcb64('0x3c')](_0x5dd2a8[_0xcb64('0x20')][_0xcb64('0x3c')]);_0x53f5b8[_0xcb64('0x3d')]=qs[_0xcb64('0x26')](_[_0xcb64('0x3e')](_0x5dd2a8[_0xcb64('0x20')],_0x392f15[_0xcb64('0x26')]));if(_0x5dd2a8[_0xcb64('0x20')][_0xcb64('0x40')]){_0x53f5b8[_0xcb64('0x3d')]=_[_0xcb64('0x2c')](_0x53f5b8[_0xcb64('0x3d')],{'$or':_[_0xcb64('0x41')](_0x53f5b8[_0xcb64('0x28')],function(_0x5b6c27){var _0x1faa58={};_0x1faa58[_0x5b6c27]={'$like':'%'+_0x5dd2a8[_0xcb64('0x20')][_0xcb64('0x40')]+'%'};return _0x1faa58;})});}_0x53f5b8=_[_0xcb64('0x2c')]({},_0x53f5b8,_0x5dd2a8[_0xcb64('0x2d')]);return _0x5b6a68[_0xcb64('0x71')](_0x53f5b8);}})[_0xcb64('0x13')](function(_0x5a6bd9){if(_0x5a6bd9){_0x59c666=_0x5a6bd9[_0xcb64('0x2a')];if(!_0x5dd2a8[_0xcb64('0x20')]['hasOwnProperty'](_0xcb64('0x3a'))){_0x53f5b8[_0xcb64('0x10')]=qs[_0xcb64('0x10')](_0x5dd2a8['query'][_0xcb64('0x10')]);_0x53f5b8[_0xcb64('0xe')]=qs[_0xcb64('0xe')](_0x5dd2a8[_0xcb64('0x20')][_0xcb64('0xe')]);}return _0x5b6a68['getAgents'](_0x53f5b8);}})[_0xcb64('0x13')](function(_0x129218){if(_0x129218){return _0x129218?{'count':_0x59c666,'rows':_0x129218}:null;}})[_0xcb64('0x13')](respondWithResult(_0x2b82e3,null))[_0xcb64('0x21')](handleError(_0x2b82e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 563dfcb..af68d82 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 _0xb3fa=['remove','emit','hook','../../mysqldb','MailQueue','update'];(function(_0x315aa8,_0x262f9c){var _0x20f758=function(_0x1765e7){while(--_0x1765e7){_0x315aa8['push'](_0x315aa8['shift']());}};_0x20f758(++_0x262f9c);}(_0xb3fa,0x159));var _0xab3f=function(_0x26bf83,_0x2a3592){_0x26bf83=_0x26bf83-0x0;var _0x39edae=_0xb3fa[_0x26bf83];return _0x39edae;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xab3f('0x0'))['db'][_0xab3f('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xab3f('0x2'),'afterDestroy':_0xab3f('0x3')};function emitEvent(_0x519f3b){return function(_0x68d615,_0x3ee341,_0x15fcdb){MailQueueEvents[_0xab3f('0x4')](_0x519f3b+':'+_0x68d615['id'],_0x68d615);MailQueueEvents[_0xab3f('0x4')](_0x519f3b,_0x68d615);_0x15fcdb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xab3f('0x5')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x55db=['update','remove','emit','exports','events','setMaxListeners','save'];(function(_0x568fd0,_0x3c09b7){var _0x4a6c7f=function(_0x4cd52d){while(--_0x4cd52d){_0x568fd0['push'](_0x568fd0['shift']());}};_0x4a6c7f(++_0x3c09b7);}(_0x55db,0x1a1));var _0xb55d=function(_0x1cb74c,_0x248486){_0x1cb74c=_0x1cb74c-0x0;var _0x511253=_0x55db[_0x1cb74c];return _0x511253;};'use strict';var EventEmitter=require(_0xb55d('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb55d('0x1')](0x0);var events={'afterCreate':_0xb55d('0x2'),'afterUpdate':_0xb55d('0x3'),'afterDestroy':_0xb55d('0x4')};function emitEvent(_0x163427){return function(_0x4c2c37,_0x102c9d,_0xe19d8){MailQueueEvents[_0xb55d('0x5')](_0x163427+':'+_0x4c2c37['id'],_0x4c2c37);MailQueueEvents[_0xb55d('0x5')](_0x163427,_0x4c2c37);_0xe19d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xb55d('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index df93ff3..f31afdf 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 _0x7e11=['api','moment','request-promise','rimraf','./mailQueue.attributes','exports','define','mail_queues','lodash','util'];(function(_0x5e4b32,_0x4d8f10){var _0xf573ff=function(_0x42b516){while(--_0x42b516){_0x5e4b32['push'](_0x5e4b32['shift']());}};_0xf573ff(++_0x4d8f10);}(_0x7e11,0x18e));var _0x17e1=function(_0x5895c2,_0x27fd4d){_0x5895c2=_0x5895c2-0x0;var _0x148edb=_0x7e11[_0x5895c2];return _0x148edb;};'use strict';var _=require(_0x17e1('0x0'));var util=require(_0x17e1('0x1'));var logger=require('../../config/logger')(_0x17e1('0x2'));var moment=require(_0x17e1('0x3'));var BPromise=require('bluebird');var rp=require(_0x17e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17e1('0x5'));var config=require('../../config/environment');var attributes=require(_0x17e1('0x6'));module[_0x17e1('0x7')]=function(_0x2c45ec,_0x552080){return _0x2c45ec[_0x17e1('0x8')]('MailQueue',attributes,{'tableName':_0x17e1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99a6=['rimraf','./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger','api','moment','path'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x99a6,0x1bd));var _0x699a=function(_0x26d51f,_0x1de895){_0x26d51f=_0x26d51f-0x0;var _0x48305d=_0x99a6[_0x26d51f];return _0x48305d;};'use strict';var _=require(_0x699a('0x0'));var util=require(_0x699a('0x1'));var logger=require(_0x699a('0x2'))(_0x699a('0x3'));var moment=require(_0x699a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x699a('0x5'));var rimraf=require(_0x699a('0x6'));var config=require('../../config/environment');var attributes=require(_0x699a('0x7'));module[_0x699a('0x8')]=function(_0x3e3d0e,_0x48a147){return _0x3e3d0e[_0x699a('0x9')]('MailQueue',attributes,{'tableName':_0x699a('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 7ba6b39..64596ef 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 _0xd4cb=['find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','defaults','localhost','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','findAll','options','raw','attributes','limit','include','model','map','then','ShowMailQueue','MailQueue'];(function(_0x4c1d4d,_0x13296f){var _0x3f3c5f=function(_0x41c1b9){while(--_0x41c1b9){_0x4c1d4d['push'](_0x4c1d4d['shift']());}};_0x3f3c5f(++_0x13296f);}(_0xd4cb,0x9e));var _0xbd4c=function(_0x2cc5e4,_0x57b886){_0x2cc5e4=_0x2cc5e4-0x0;var _0x35f687=_0xd4cb[_0x2cc5e4];return _0x35f687;};'use strict';var _=require(_0xbd4c('0x0'));var util=require(_0xbd4c('0x1'));var moment=require(_0xbd4c('0x2'));var BPromise=require(_0xbd4c('0x3'));var rs=require(_0xbd4c('0x4'));var fs=require('fs');var Redis=require(_0xbd4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbd4c('0x6'))(_0xbd4c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd4c('0x8')][_0xbd4c('0x9')]({'port':0x232a});config['redis']=_[_0xbd4c('0xa')](config['redis'],{'host':_0xbd4c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbd4c('0xc'))[_0xbd4c('0xd')](socket);function respondWithRpcPromise(_0x216d63,_0x4d14a3,_0x2c305d){return new BPromise(function(_0x2c2054,_0x569898){return client[_0xbd4c('0xe')](_0x216d63,_0x2c305d)['then'](function(_0x5dd742){logger[_0xbd4c('0xf')](_0xbd4c('0x10'),_0x4d14a3,_0xbd4c('0x11'));logger[_0xbd4c('0x12')](_0xbd4c('0x13'),_0x4d14a3,_0xbd4c('0x11'),JSON[_0xbd4c('0x14')](_0x5dd742));if(_0x5dd742[_0xbd4c('0x15')]){if(_0x5dd742[_0xbd4c('0x15')]['code']===0x1f4){logger[_0xbd4c('0x15')](_0xbd4c('0x10'),_0x4d14a3,_0x5dd742['error'][_0xbd4c('0x16')]);return _0x569898(_0x5dd742[_0xbd4c('0x15')][_0xbd4c('0x16')]);}logger[_0xbd4c('0x15')](_0xbd4c('0x10'),_0x4d14a3,_0x5dd742[_0xbd4c('0x15')][_0xbd4c('0x16')]);return _0x2c2054(_0x5dd742[_0xbd4c('0x15')][_0xbd4c('0x16')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x4d14a3,_0xbd4c('0x11'));_0x2c2054(_0x5dd742[_0xbd4c('0x17')][_0xbd4c('0x16')]);}})[_0xbd4c('0x18')](function(_0x4ef0f0){logger[_0xbd4c('0x15')](_0xbd4c('0x10'),_0x4d14a3,_0x4ef0f0);_0x569898(_0x4ef0f0);});});}exports[_0xbd4c('0x19')]=function(_0x1039cf){var _0x274cdb=this;return new Promise(function(_0x37d2e8,_0x52925f){return db['MailQueue'][_0xbd4c('0x1a')]({'raw':_0x1039cf['options']?_0x1039cf[_0xbd4c('0x1b')][_0xbd4c('0x1c')]===undefined?!![]:![]:!![],'where':_0x1039cf[_0xbd4c('0x1b')]?_0x1039cf['options']['where']||null:null,'attributes':_0x1039cf['options']?_0x1039cf['options'][_0xbd4c('0x1d')]||null:null,'limit':_0x1039cf[_0xbd4c('0x1b')]?_0x1039cf[_0xbd4c('0x1b')][_0xbd4c('0x1e')]||null:null,'include':_0x1039cf[_0xbd4c('0x1b')]?_0x1039cf[_0xbd4c('0x1b')][_0xbd4c('0x1f')]?_['map'](_0x1039cf[_0xbd4c('0x1b')]['include'],function(_0x9e5905){return{'model':db[_0x9e5905[_0xbd4c('0x20')]],'as':_0x9e5905['as'],'attributes':_0x9e5905['attributes'],'include':_0x9e5905[_0xbd4c('0x1f')]?_['map'](_0x9e5905['include'],function(_0x380dca){return{'model':db[_0x380dca[_0xbd4c('0x20')]],'as':_0x380dca['as'],'attributes':_0x380dca[_0xbd4c('0x1d')],'include':_0x380dca['include']?_[_0xbd4c('0x21')](_0x380dca['include'],function(_0x37c327){return{'model':db[_0x37c327[_0xbd4c('0x20')]],'as':_0x37c327['as'],'attributes':_0x37c327[_0xbd4c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd4c('0x22')](function(_0x2684c5){logger[_0xbd4c('0xf')]('GetMailQueue',_0x1039cf);logger[_0xbd4c('0x12')](_0xbd4c('0x19'),_0x1039cf,JSON['stringify'](_0x2684c5));_0x37d2e8(_0x2684c5);})[_0xbd4c('0x18')](function(_0x32b017){logger[_0xbd4c('0x15')](_0xbd4c('0x19'),_0x32b017[_0xbd4c('0x16')],_0x1039cf);_0x52925f(_0x274cdb['error'](0x1f4,_0x32b017[_0xbd4c('0x16')]));});});};exports[_0xbd4c('0x23')]=function(_0x3c32bd){var _0xac731a=this;return new Promise(function(_0x5f2f27,_0x5ade87){return db[_0xbd4c('0x24')][_0xbd4c('0x25')]({'raw':_0x3c32bd['options']?_0x3c32bd[_0xbd4c('0x1b')][_0xbd4c('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c32bd[_0xbd4c('0x1b')]?_0x3c32bd[_0xbd4c('0x1b')][_0xbd4c('0x26')]||null:null,'attributes':_0x3c32bd['options']?_0x3c32bd[_0xbd4c('0x1b')][_0xbd4c('0x1d')]||null:null,'include':_0x3c32bd[_0xbd4c('0x1b')]?_0x3c32bd[_0xbd4c('0x1b')][_0xbd4c('0x1f')]?_[_0xbd4c('0x21')](_0x3c32bd['options']['include'],function(_0x365b7d){return{'model':db[_0x365b7d[_0xbd4c('0x20')]],'as':_0x365b7d['as'],'attributes':_0x365b7d['attributes'],'include':_0x365b7d[_0xbd4c('0x1f')]?_[_0xbd4c('0x21')](_0x365b7d[_0xbd4c('0x1f')],function(_0x1fafba){return{'model':db[_0x1fafba['model']],'as':_0x1fafba['as'],'attributes':_0x1fafba['attributes'],'include':_0x1fafba[_0xbd4c('0x1f')]?_[_0xbd4c('0x21')](_0x1fafba[_0xbd4c('0x1f')],function(_0x1f861b){return{'model':db[_0x1f861b[_0xbd4c('0x20')]],'as':_0x1f861b['as'],'attributes':_0x1f861b[_0xbd4c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd4c('0x22')](function(_0x4673b3){logger['info'](_0xbd4c('0x23'),_0x3c32bd);logger[_0xbd4c('0x12')]('ShowMailQueue',_0x3c32bd,JSON[_0xbd4c('0x14')](_0x4673b3));_0x5f2f27(_0x4673b3);})['catch'](function(_0x5b38c8){logger['error'](_0xbd4c('0x23'),_0x5b38c8[_0xbd4c('0x16')],_0x3c32bd);_0x5ade87(_0xac731a[_0xbd4c('0x15')](0x1f4,_0x5b38c8[_0xbd4c('0x16')]));});});}; \ No newline at end of file +var _0x59e0=['where','attributes','limit','include','map','model','find','ShowMailQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw'];(function(_0x3882a4,_0x5355a4){var _0x2adfc3=function(_0x4a3229){while(--_0x4a3229){_0x3882a4['push'](_0x3882a4['shift']());}};_0x2adfc3(++_0x5355a4);}(_0x59e0,0x1f4));var _0x059e=function(_0xae6104,_0xcd654f){_0xae6104=_0xae6104-0x0;var _0x5ea234=_0x59e0[_0xae6104];return _0x5ea234;};'use strict';var _=require('lodash');var util=require(_0x059e('0x0'));var moment=require(_0x059e('0x1'));var BPromise=require(_0x059e('0x2'));var rs=require(_0x059e('0x3'));var fs=require('fs');var Redis=require(_0x059e('0x4'));var db=require(_0x059e('0x5'))['db'];var utils=require(_0x059e('0x6'));var logger=require(_0x059e('0x7'))(_0x059e('0x8'));var config=require(_0x059e('0x9'));var jayson=require(_0x059e('0xa'));var client=jayson[_0x059e('0xb')]['http']({'port':0x232a});config[_0x059e('0xc')]=_[_0x059e('0xd')](config[_0x059e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x059e('0xe'))(new Redis(config[_0x059e('0xc')]));require(_0x059e('0xf'))[_0x059e('0x10')](socket);function respondWithRpcPromise(_0x434864,_0x197a60,_0x1ad0d7){return new BPromise(function(_0x20be01,_0x25dbb8){return client[_0x059e('0x11')](_0x434864,_0x1ad0d7)[_0x059e('0x12')](function(_0x550ad2){logger[_0x059e('0x13')](_0x059e('0x14'),_0x197a60,_0x059e('0x15'));logger[_0x059e('0x16')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x197a60,'request\x20sent',JSON[_0x059e('0x17')](_0x550ad2));if(_0x550ad2['error']){if(_0x550ad2[_0x059e('0x18')]['code']===0x1f4){logger[_0x059e('0x18')](_0x059e('0x14'),_0x197a60,_0x550ad2[_0x059e('0x18')][_0x059e('0x19')]);return _0x25dbb8(_0x550ad2[_0x059e('0x18')][_0x059e('0x19')]);}logger[_0x059e('0x18')]('MailQueue,\x20%s,\x20%s',_0x197a60,_0x550ad2[_0x059e('0x18')][_0x059e('0x19')]);return _0x20be01(_0x550ad2[_0x059e('0x18')]['message']);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x197a60,'request\x20sent');_0x20be01(_0x550ad2[_0x059e('0x1a')][_0x059e('0x19')]);}})[_0x059e('0x1b')](function(_0x401694){logger['error'](_0x059e('0x14'),_0x197a60,_0x401694);_0x25dbb8(_0x401694);});});}exports[_0x059e('0x1c')]=function(_0x534c47){var _0x447fa8=this;return new Promise(function(_0x253f9c,_0x53b45f){return db[_0x059e('0x1d')][_0x059e('0x1e')]({'raw':_0x534c47[_0x059e('0x1f')]?_0x534c47[_0x059e('0x1f')][_0x059e('0x20')]===undefined?!![]:![]:!![],'where':_0x534c47[_0x059e('0x1f')]?_0x534c47[_0x059e('0x1f')][_0x059e('0x21')]||null:null,'attributes':_0x534c47[_0x059e('0x1f')]?_0x534c47[_0x059e('0x1f')][_0x059e('0x22')]||null:null,'limit':_0x534c47['options']?_0x534c47['options'][_0x059e('0x23')]||null:null,'include':_0x534c47[_0x059e('0x1f')]?_0x534c47['options'][_0x059e('0x24')]?_['map'](_0x534c47['options'][_0x059e('0x24')],function(_0x5da51e){return{'model':db[_0x5da51e['model']],'as':_0x5da51e['as'],'attributes':_0x5da51e[_0x059e('0x22')],'include':_0x5da51e[_0x059e('0x24')]?_[_0x059e('0x25')](_0x5da51e[_0x059e('0x24')],function(_0x14a133){return{'model':db[_0x14a133['model']],'as':_0x14a133['as'],'attributes':_0x14a133[_0x059e('0x22')],'include':_0x14a133[_0x059e('0x24')]?_['map'](_0x14a133['include'],function(_0x44aece){return{'model':db[_0x44aece[_0x059e('0x26')]],'as':_0x44aece['as'],'attributes':_0x44aece['attributes']};}):[]};}):[]};}):[]:[]})[_0x059e('0x12')](function(_0x1424f0){logger[_0x059e('0x13')](_0x059e('0x1c'),_0x534c47);logger[_0x059e('0x16')](_0x059e('0x1c'),_0x534c47,JSON[_0x059e('0x17')](_0x1424f0));_0x253f9c(_0x1424f0);})[_0x059e('0x1b')](function(_0x24f5e4){logger[_0x059e('0x18')](_0x059e('0x1c'),_0x24f5e4[_0x059e('0x19')],_0x534c47);_0x53b45f(_0x447fa8[_0x059e('0x18')](0x1f4,_0x24f5e4[_0x059e('0x19')]));});});};exports['ShowMailQueue']=function(_0x3896a3){var _0x2bc761=this;return new Promise(function(_0x365f4b,_0x4a49dd){return db[_0x059e('0x1d')][_0x059e('0x27')]({'raw':_0x3896a3[_0x059e('0x1f')]?_0x3896a3[_0x059e('0x1f')][_0x059e('0x20')]===undefined?!![]:![]:!![],'where':_0x3896a3[_0x059e('0x1f')]?_0x3896a3[_0x059e('0x1f')][_0x059e('0x21')]||null:null,'attributes':_0x3896a3['options']?_0x3896a3[_0x059e('0x1f')][_0x059e('0x22')]||null:null,'include':_0x3896a3[_0x059e('0x1f')]?_0x3896a3[_0x059e('0x1f')]['include']?_[_0x059e('0x25')](_0x3896a3[_0x059e('0x1f')]['include'],function(_0x488911){return{'model':db[_0x488911['model']],'as':_0x488911['as'],'attributes':_0x488911[_0x059e('0x22')],'include':_0x488911[_0x059e('0x24')]?_[_0x059e('0x25')](_0x488911[_0x059e('0x24')],function(_0x5bbd63){return{'model':db[_0x5bbd63[_0x059e('0x26')]],'as':_0x5bbd63['as'],'attributes':_0x5bbd63[_0x059e('0x22')],'include':_0x5bbd63[_0x059e('0x24')]?_['map'](_0x5bbd63['include'],function(_0x422784){return{'model':db[_0x422784[_0x059e('0x26')]],'as':_0x422784['as'],'attributes':_0x422784['attributes']};}):[]};}):[]};}):[]:[]})[_0x059e('0x12')](function(_0x316af6){logger[_0x059e('0x13')](_0x059e('0x28'),_0x3896a3);logger[_0x059e('0x16')]('ShowMailQueue',_0x3896a3,JSON['stringify'](_0x316af6));_0x365f4b(_0x316af6);})[_0x059e('0x1b')](function(_0xc6a559){logger[_0x059e('0x18')]('ShowMailQueue',_0xc6a559[_0x059e('0x19')],_0x3896a3);_0x4a49dd(_0x2bc761[_0x059e('0x18')](0x1f4,_0xc6a559[_0x059e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 68b4810..1b09028 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 _0x82b1=['mailQueue:','./mailQueue.events','save','remove','update','emit','length'];(function(_0x433d50,_0x1458d3){var _0x2dea86=function(_0x1e969d){while(--_0x1e969d){_0x433d50['push'](_0x433d50['shift']());}};_0x2dea86(++_0x1458d3);}(_0x82b1,0x197));var _0x182b=function(_0x1fbb7c,_0x330a19){_0x1fbb7c=_0x1fbb7c-0x0;var _0x2dcb7f=_0x82b1[_0x1fbb7c];return _0x2dcb7f;};'use strict';var MailQueueEvents=require(_0x182b('0x0'));var events=[_0x182b('0x1'),_0x182b('0x2'),_0x182b('0x3')];function createListener(_0x3f991f,_0x1893b7){return function(_0x52d240){_0x1893b7[_0x182b('0x4')](_0x3f991f,_0x52d240);};}function removeListener(_0x40c682,_0x1fdd20){return function(){MailQueueEvents['removeListener'](_0x40c682,_0x1fdd20);};}exports['register']=function(_0x445b46){for(var _0x5650a3=0x0,_0x3059a8=events[_0x182b('0x5')];_0x5650a3<_0x3059a8;_0x5650a3++){var _0x87ac04=events[_0x5650a3];var _0xf4ac7e=createListener(_0x182b('0x6')+_0x87ac04,_0x445b46);MailQueueEvents['on'](_0x87ac04,_0xf4ac7e);}}; \ No newline at end of file +var _0x0b41=['length','mailQueue:','./mailQueue.events','remove','update','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b41,0x6a));var _0x10b4=function(_0x20bbc4,_0x5a55b4){_0x20bbc4=_0x20bbc4-0x0;var _0x201138=_0x0b41[_0x20bbc4];return _0x201138;};'use strict';var MailQueueEvents=require(_0x10b4('0x0'));var events=['save',_0x10b4('0x1'),_0x10b4('0x2')];function createListener(_0x5f3552,_0x9abb2c){return function(_0x23f353){_0x9abb2c[_0x10b4('0x3')](_0x5f3552,_0x23f353);};}function removeListener(_0x47fe26,_0x27cf79){return function(){MailQueueEvents[_0x10b4('0x4')](_0x47fe26,_0x27cf79);};}exports[_0x10b4('0x5')]=function(_0x277f6c){for(var _0x22f6a1=0x0,_0xaa560=events[_0x10b4('0x6')];_0x22f6a1<_0xaa560;_0x22f6a1++){var _0x2e70b7=events[_0x22f6a1];var _0x43903c=createListener(_0x10b4('0x7')+_0x2e70b7,_0x277f6c);MailQueueEvents['on'](_0x2e70b7,_0x43903c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ee33616..d04430b 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 _0xa068=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailQueueReport.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x4e65e3,_0x5a3fe7){var _0x1c0690=function(_0x54aaeb){while(--_0x54aaeb){_0x4e65e3['push'](_0x4e65e3['shift']());}};_0x1c0690(++_0x5a3fe7);}(_0xa068,0x1d4));var _0x8a06=function(_0x5e1b22,_0x5a456a){_0x5e1b22=_0x5e1b22-0x0;var _0x329e7e=_0xa068[_0x5e1b22];return _0x329e7e;};'use strict';var multer=require(_0x8a06('0x0'));var util=require(_0x8a06('0x1'));var path=require(_0x8a06('0x2'));var timeout=require(_0x8a06('0x3'));var express=require(_0x8a06('0x4'));var router=express[_0x8a06('0x5')]();var fs_extra=require(_0x8a06('0x6'));var auth=require(_0x8a06('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8a06('0x8'));router['get']('/',auth[_0x8a06('0x9')](),controller[_0x8a06('0xa')]);router[_0x8a06('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8a06('0xb')](_0x8a06('0xc'),auth[_0x8a06('0x9')](),controller[_0x8a06('0xd')]);router[_0x8a06('0xe')]('/',auth[_0x8a06('0x9')](),controller[_0x8a06('0xf')]);router[_0x8a06('0x10')](_0x8a06('0xc'),auth[_0x8a06('0x9')](),controller[_0x8a06('0x11')]);router[_0x8a06('0x12')](_0x8a06('0xc'),auth[_0x8a06('0x9')](),controller[_0x8a06('0x13')]);module[_0x8a06('0x14')]=router; \ No newline at end of file +var _0x06e1=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x4b12a0,_0xfac488){var _0x230e72=function(_0x399d44){while(--_0x399d44){_0x4b12a0['push'](_0x4b12a0['shift']());}};_0x230e72(++_0xfac488);}(_0x06e1,0x10a));var _0x106e=function(_0x3aa6cf,_0x473352){_0x3aa6cf=_0x3aa6cf-0x0;var _0x32694e=_0x06e1[_0x3aa6cf];return _0x32694e;};'use strict';var multer=require(_0x106e('0x0'));var util=require(_0x106e('0x1'));var path=require('path');var timeout=require(_0x106e('0x2'));var express=require(_0x106e('0x3'));var router=express[_0x106e('0x4')]();var fs_extra=require(_0x106e('0x5'));var auth=require(_0x106e('0x6'));var interaction=require(_0x106e('0x7'));var config=require(_0x106e('0x8'));var controller=require(_0x106e('0x9'));router['get']('/',auth[_0x106e('0xa')](),controller[_0x106e('0xb')]);router['get'](_0x106e('0xc'),auth['isAuthenticated'](),controller[_0x106e('0xd')]);router['get'](_0x106e('0xe'),auth[_0x106e('0xa')](),controller['show']);router[_0x106e('0xf')]('/',auth['isAuthenticated'](),controller[_0x106e('0x10')]);router[_0x106e('0x11')](_0x106e('0xe'),auth[_0x106e('0xa')](),controller[_0x106e('0x12')]);router[_0x106e('0x13')](_0x106e('0xe'),auth[_0x106e('0xa')](),controller[_0x106e('0x14')]);module[_0x106e('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 a1dc6b0..8f2e997 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 _0x98a1=['sequelize','exports','STRING','DATE','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x98a1,0x10d));var _0x198a=function(_0x566789,_0x401300){_0x566789=_0x566789-0x0;var _0x5301d7=_0x98a1[_0x566789];return _0x5301d7;};'use strict';var moment=require(_0x198a('0x0'));var Sequelize=require(_0x198a('0x1'));module[_0x198a('0x2')]={'uniqueid':{'type':Sequelize[_0x198a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x198a('0x3')]},'joinAt':{'type':Sequelize[_0x198a('0x4')]},'leaveAt':{'type':Sequelize[_0x198a('0x4')]},'acceptAt':{'type':Sequelize[_0x198a('0x4')]},'exitAt':{'type':Sequelize[_0x198a('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe296=['STRING','DATE','moment','sequelize','exports'];(function(_0x53ba51,_0x2f2321){var _0x2e776e=function(_0x16b5cf){while(--_0x16b5cf){_0x53ba51['push'](_0x53ba51['shift']());}};_0x2e776e(++_0x2f2321);}(_0xe296,0xac));var _0x6e29=function(_0x1b0122,_0x790ba0){_0x1b0122=_0x1b0122-0x0;var _0x385cb3=_0xe296[_0x1b0122];return _0x385cb3;};'use strict';var moment=require(_0x6e29('0x0'));var Sequelize=require(_0x6e29('0x1'));module[_0x6e29('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6e29('0x3')]},'joinAt':{'type':Sequelize[_0x6e29('0x4')]},'leaveAt':{'type':Sequelize[_0x6e29('0x4')]},'acceptAt':{'type':Sequelize[_0x6e29('0x4')]},'exitAt':{'type':Sequelize[_0x6e29('0x4')]},'reason':{'type':Sequelize[_0x6e29('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 1b69200..09176fa 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 _0x0120=['name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x3c988a,_0x3e74c9){var _0x465b4b=function(_0x169193){while(--_0x169193){_0x3c988a['push'](_0x3c988a['shift']());}};_0x465b4b(++_0x3e74c9);}(_0x0120,0x6f));var _0x0012=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0120[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x0012('0x0'));var rimraf=require(_0x0012('0x1'));var zipdir=require(_0x0012('0x2'));var jsonpatch=require(_0x0012('0x3'));var rp=require(_0x0012('0x4'));var moment=require(_0x0012('0x5'));var BPromise=require(_0x0012('0x6'));var Mustache=require(_0x0012('0x7'));var util=require(_0x0012('0x8'));var path=require(_0x0012('0x9'));var sox=require(_0x0012('0xa'));var csv=require(_0x0012('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0xb'));var querystring=require('querystring');var Papa=require(_0x0012('0x10'));var Redis=require(_0x0012('0x11'));var authService=require(_0x0012('0x12'));var qs=require(_0x0012('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x14'));var logger=require('../../config/logger')(_0x0012('0x15'));var utils=require(_0x0012('0x16'));var config=require(_0x0012('0x17'));var licenseUtil=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];function respondWithStatusCode(_0x4d3e7a,_0x6d4a1a){_0x6d4a1a=_0x6d4a1a||0xcc;return function(_0x4f0ee1){if(_0x4f0ee1){return _0x4d3e7a['sendStatus'](_0x6d4a1a);}return _0x4d3e7a['status'](_0x6d4a1a)['end']();};}function respondWithResult(_0x3a7d50,_0x496a2b){_0x496a2b=_0x496a2b||0xc8;return function(_0x3995fd){if(_0x3995fd){return _0x3a7d50[_0x0012('0x1a')](_0x496a2b)['json'](_0x3995fd);}};}function respondWithFilteredResult(_0x24f4ed,_0x1a0c0d){return function(_0x348810){if(_0x348810){var _0x3b8dfc=typeof _0x1a0c0d['offset']==='undefined'&&typeof _0x1a0c0d[_0x0012('0x1b')]===_0x0012('0x1c');var _0x3948bf=_0x348810[_0x0012('0x1d')];var _0x1d0423=_0x3b8dfc?0x0:_0x1a0c0d[_0x0012('0x1e')];var _0x1e78ee=_0x3b8dfc?_0x348810[_0x0012('0x1d')]:_0x1a0c0d['offset']+_0x1a0c0d[_0x0012('0x1b')];var _0x56b0e1;if(_0x1e78ee>=_0x3948bf){_0x1e78ee=_0x3948bf;_0x56b0e1=0xc8;}else{_0x56b0e1=0xce;}_0x24f4ed['status'](_0x56b0e1);return _0x24f4ed[_0x0012('0x1f')](_0x0012('0x20'),_0x1d0423+'-'+_0x1e78ee+'/'+_0x3948bf)[_0x0012('0x21')](_0x348810);}return null;};}function patchUpdates(_0x2c837e){return function(_0x53ac2d){try{jsonpatch['apply'](_0x53ac2d,_0x2c837e,!![]);}catch(_0x460d82){return BPromise[_0x0012('0x22')](_0x460d82);}return _0x53ac2d[_0x0012('0x23')]();};}function saveUpdates(_0x7177bc,_0x190f07){return function(_0x2e6a2c){if(_0x2e6a2c){return _0x2e6a2c[_0x0012('0x24')](_0x7177bc)[_0x0012('0x25')](function(_0x57487e){return _0x57487e;});}return null;};}function removeEntity(_0x24674c,_0x24a280){return function(_0x4cf4bd){if(_0x4cf4bd){return _0x4cf4bd[_0x0012('0x26')]()[_0x0012('0x25')](function(){_0x24674c[_0x0012('0x1a')](0xcc)[_0x0012('0x27')]();});}};}function handleEntityNotFound(_0x42bcd7,_0x5e820b){return function(_0x351ffd){if(!_0x351ffd){_0x42bcd7[_0x0012('0x28')](0x194);}return _0x351ffd;};}function handleError(_0xbb5b55,_0x2a0302){_0x2a0302=_0x2a0302||0x1f4;return function(_0x173cb3){logger[_0x0012('0x29')](_0x173cb3[_0x0012('0x2a')]);if(_0x173cb3[_0x0012('0x2b')]){delete _0x173cb3[_0x0012('0x2b')];}_0xbb5b55[_0x0012('0x1a')](_0x2a0302)[_0x0012('0x2c')](_0x173cb3);};}exports[_0x0012('0x2d')]=function(_0x45c3ca,_0x3ce788){var _0x1282bb={},_0x276389={},_0x1b676d={'count':0x0,'rows':[]};var _0x1f4a0a=_[_0x0012('0x2e')](db[_0x0012('0x2f')][_0x0012('0x30')],function(_0x4d0998){return{'name':_0x4d0998[_0x0012('0x31')],'type':_0x4d0998[_0x0012('0x32')]['key']};});_0x276389[_0x0012('0x33')]=_[_0x0012('0x2e')](_0x1f4a0a,_0x0012('0x2b'));_0x276389[_0x0012('0x34')]=_[_0x0012('0x35')](_0x45c3ca['query']);_0x276389[_0x0012('0x36')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],_0x276389['query']);_0x1282bb[_0x0012('0x38')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],qs[_0x0012('0x39')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x39')]));_0x1282bb['attributes']=_0x1282bb[_0x0012('0x38')][_0x0012('0x3a')]?_0x1282bb[_0x0012('0x38')]:_0x276389[_0x0012('0x33')];if(!_0x45c3ca['query']['hasOwnProperty'](_0x0012('0x3b'))){_0x1282bb[_0x0012('0x1b')]=qs[_0x0012('0x1b')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x1b')]);_0x1282bb[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x45c3ca['query'][_0x0012('0x1e')]);}_0x1282bb[_0x0012('0x3c')]=qs['sort'](_0x45c3ca[_0x0012('0x34')][_0x0012('0x3d')]);_0x1282bb[_0x0012('0x3e')]=qs[_0x0012('0x36')](_[_0x0012('0x3f')](_0x45c3ca[_0x0012('0x34')],_0x276389[_0x0012('0x36')]),_0x1f4a0a);if(_0x45c3ca['query'][_0x0012('0x40')]){_0x1282bb['where']=_[_0x0012('0x41')](_0x1282bb['where'],{'$or':_['map'](_0x1f4a0a,function(_0x1c35aa){if(_0x1c35aa[_0x0012('0x32')]!==_0x0012('0x42')){var _0x4e4424={};_0x4e4424[_0x1c35aa[_0x0012('0x2b')]]={'$like':'%'+_0x45c3ca[_0x0012('0x34')][_0x0012('0x40')]+'%'};return _0x4e4424;}})});}_0x1282bb=_[_0x0012('0x41')]({},_0x1282bb,_0x45c3ca[_0x0012('0x43')]);var _0x379780={'where':_0x1282bb[_0x0012('0x3e')]};return db[_0x0012('0x2f')]['count'](_0x379780)[_0x0012('0x25')](function(_0x25aff1){_0x1b676d[_0x0012('0x1d')]=_0x25aff1;if(_0x45c3ca[_0x0012('0x34')][_0x0012('0x44')]){_0x1282bb[_0x0012('0x45')]=[{'all':!![]}];}return db[_0x0012('0x2f')]['findAll'](_0x1282bb);})['then'](function(_0x1c54de){_0x1b676d['rows']=_0x1c54de;return _0x1b676d;})[_0x0012('0x25')](respondWithFilteredResult(_0x3ce788,_0x1282bb))[_0x0012('0x46')](handleError(_0x3ce788,null));};exports[_0x0012('0x47')]=function(_0x40f80d,_0x32c1f9){var _0x5348a2={'raw':!![],'where':{'id':_0x40f80d[_0x0012('0x48')]['id']}},_0x1bd93a={};_0x1bd93a['model']=_[_0x0012('0x35')](db[_0x0012('0x2f')][_0x0012('0x30')]);_0x1bd93a[_0x0012('0x34')]=_['keys'](_0x40f80d['query']);_0x1bd93a[_0x0012('0x36')]=_['intersection'](_0x1bd93a[_0x0012('0x33')],_0x1bd93a['query']);_0x5348a2[_0x0012('0x38')]=_[_0x0012('0x37')](_0x1bd93a[_0x0012('0x33')],qs[_0x0012('0x39')](_0x40f80d['query'][_0x0012('0x39')]));_0x5348a2['attributes']=_0x5348a2[_0x0012('0x38')][_0x0012('0x3a')]?_0x5348a2[_0x0012('0x38')]:_0x1bd93a[_0x0012('0x33')];if(_0x40f80d[_0x0012('0x34')][_0x0012('0x44')]){_0x5348a2[_0x0012('0x45')]=[{'all':!![]}];}_0x5348a2=_['merge']({},_0x5348a2,_0x40f80d[_0x0012('0x43')]);return db[_0x0012('0x2f')][_0x0012('0x49')](_0x5348a2)[_0x0012('0x25')](handleEntityNotFound(_0x32c1f9,null))[_0x0012('0x25')](respondWithResult(_0x32c1f9,null))[_0x0012('0x46')](handleError(_0x32c1f9,null));};exports['create']=function(_0x5894ee,_0x48de64){return db['MailQueueReport'][_0x0012('0x4a')](_0x5894ee[_0x0012('0x4b')],{})[_0x0012('0x25')](respondWithResult(_0x48de64,0xc9))[_0x0012('0x46')](handleError(_0x48de64,null));};exports[_0x0012('0x24')]=function(_0x53d552,_0x44ffaf){if(_0x53d552[_0x0012('0x4b')]['id']){delete _0x53d552[_0x0012('0x4b')]['id'];}return db[_0x0012('0x2f')][_0x0012('0x49')]({'where':{'id':_0x53d552[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x44ffaf,null))[_0x0012('0x25')](saveUpdates(_0x53d552[_0x0012('0x4b')],null))[_0x0012('0x25')](respondWithResult(_0x44ffaf,null))[_0x0012('0x46')](handleError(_0x44ffaf,null));};exports['destroy']=function(_0x2389cd,_0x12cb8f){return db[_0x0012('0x2f')]['find']({'where':{'id':_0x2389cd[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x12cb8f,null))[_0x0012('0x25')](removeEntity(_0x12cb8f,null))[_0x0012('0x46')](handleError(_0x12cb8f,null));};exports[_0x0012('0x4c')]=function(_0x5f283f,_0xd11428){return db['MailQueueReport'][_0x0012('0x4c')]()[_0x0012('0x25')](respondWithResult(_0xd11428,null))['catch'](handleError(_0xd11428,null));}; \ No newline at end of file +var _0x5b12=['options','includeAll','include','findAll','then','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','apply','reject','update','destroy','error','name','index','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x274449,_0x9b9c6e){var _0x272161=function(_0x51f428){while(--_0x51f428){_0x274449['push'](_0x274449['shift']());}};_0x272161(++_0x9b9c6e);}(_0x5b12,0xa3));var _0x25b1=function(_0x1ef036,_0x3197c9){_0x1ef036=_0x1ef036-0x0;var _0x31fd8f=_0x5b12[_0x1ef036];return _0x31fd8f;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0xd22469,_0x282187){return function(_0x1f37ed){if(!_0x1f37ed){_0xd22469[_0x25b1('0x19')](0x194);}return _0x1f37ed;};}function handleError(_0x5d9ed7,_0x3c05c6){_0x3c05c6=_0x3c05c6||0x1f4;return function(_0x27dd68){logger[_0x25b1('0x24')](_0x27dd68['stack']);if(_0x27dd68[_0x25b1('0x25')]){delete _0x27dd68[_0x25b1('0x25')];}_0x5d9ed7[_0x25b1('0x1a')](_0x3c05c6)['send'](_0x27dd68);};}exports[_0x25b1('0x26')]=function(_0x54ce2d,_0x19ecd1){var _0x3febb8={},_0x3a4475={},_0x293413={'count':0x0,'rows':[]};var _0x362118=_[_0x25b1('0x27')](db[_0x25b1('0x28')]['rawAttributes'],function(_0x30d455){return{'name':_0x30d455[_0x25b1('0x29')],'type':_0x30d455[_0x25b1('0x2a')][_0x25b1('0x2b')]};});_0x3a4475[_0x25b1('0x2c')]=_['map'](_0x362118,_0x25b1('0x25'));_0x3a4475[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x54ce2d[_0x25b1('0x2d')]);_0x3a4475[_0x25b1('0x2f')]=_['intersection'](_0x3a4475['model'],_0x3a4475[_0x25b1('0x2d')]);_0x3febb8['attributes']=_[_0x25b1('0x30')](_0x3a4475[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x54ce2d['query']['fields']));_0x3febb8[_0x25b1('0x32')]=_0x3febb8[_0x25b1('0x32')][_0x25b1('0x33')]?_0x3febb8['attributes']:_0x3a4475[_0x25b1('0x2c')];if(!_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x34')](_0x25b1('0x35'))){_0x3febb8['limit']=qs[_0x25b1('0x36')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x36')]);_0x3febb8['offset']=qs['offset'](_0x54ce2d[_0x25b1('0x2d')]['offset']);}_0x3febb8[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x38')]);_0x3febb8[_0x25b1('0x39')]=qs[_0x25b1('0x2f')](_[_0x25b1('0x3a')](_0x54ce2d[_0x25b1('0x2d')],_0x3a4475[_0x25b1('0x2f')]),_0x362118);if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]){_0x3febb8[_0x25b1('0x39')]=_[_0x25b1('0x3c')](_0x3febb8[_0x25b1('0x39')],{'$or':_[_0x25b1('0x27')](_0x362118,function(_0x4837d5){if(_0x4837d5[_0x25b1('0x2a')]!==_0x25b1('0x3d')){var _0x53423d={};_0x53423d[_0x4837d5[_0x25b1('0x25')]]={'$like':'%'+_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]+'%'};return _0x53423d;}})});}_0x3febb8=_[_0x25b1('0x3c')]({},_0x3febb8,_0x54ce2d[_0x25b1('0x3e')]);var _0x5bdefd={'where':_0x3febb8[_0x25b1('0x39')]};return db['MailQueueReport'][_0x25b1('0x1d')](_0x5bdefd)['then'](function(_0x2e8747){_0x293413[_0x25b1('0x1d')]=_0x2e8747;if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x3febb8[_0x25b1('0x40')]=[{'all':!![]}];}return db[_0x25b1('0x28')][_0x25b1('0x41')](_0x3febb8);})[_0x25b1('0x42')](function(_0x3f9754){_0x293413['rows']=_0x3f9754;return _0x293413;})[_0x25b1('0x42')](respondWithFilteredResult(_0x19ecd1,_0x3febb8))['catch'](handleError(_0x19ecd1,null));};exports[_0x25b1('0x43')]=function(_0x2f56ac,_0x4d4e32){var _0x52d3f8={'raw':!![],'where':{'id':_0x2f56ac[_0x25b1('0x44')]['id']}},_0x39b4c7={};_0x39b4c7[_0x25b1('0x2c')]=_[_0x25b1('0x2e')](db[_0x25b1('0x28')][_0x25b1('0x45')]);_0x39b4c7[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x2f56ac[_0x25b1('0x2d')]);_0x39b4c7[_0x25b1('0x2f')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],_0x39b4c7[_0x25b1('0x2d')]);_0x52d3f8[_0x25b1('0x32')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x2f56ac['query']['fields']));_0x52d3f8['attributes']=_0x52d3f8[_0x25b1('0x32')]['length']?_0x52d3f8[_0x25b1('0x32')]:_0x39b4c7['model'];if(_0x2f56ac[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x52d3f8[_0x25b1('0x40')]=[{'all':!![]}];}_0x52d3f8=_[_0x25b1('0x3c')]({},_0x52d3f8,_0x2f56ac[_0x25b1('0x3e')]);return db[_0x25b1('0x28')]['find'](_0x52d3f8)[_0x25b1('0x42')](handleEntityNotFound(_0x4d4e32,null))[_0x25b1('0x42')](respondWithResult(_0x4d4e32,null))[_0x25b1('0x46')](handleError(_0x4d4e32,null));};exports[_0x25b1('0x47')]=function(_0x58ae67,_0x489f73){return db[_0x25b1('0x28')][_0x25b1('0x47')](_0x58ae67['body'],{})[_0x25b1('0x42')](respondWithResult(_0x489f73,0xc9))['catch'](handleError(_0x489f73,null));};exports[_0x25b1('0x22')]=function(_0x4b6181,_0x543f9b){if(_0x4b6181[_0x25b1('0x48')]['id']){delete _0x4b6181[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x4b6181['params']['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x543f9b,null))['then'](saveUpdates(_0x4b6181[_0x25b1('0x48')],null))['then'](respondWithResult(_0x543f9b,null))[_0x25b1('0x46')](handleError(_0x543f9b,null));};exports[_0x25b1('0x23')]=function(_0x1fcc79,_0x4fb92e){return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x1fcc79[_0x25b1('0x44')]['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x4fb92e,null))[_0x25b1('0x42')](removeEntity(_0x4fb92e,null))[_0x25b1('0x46')](handleError(_0x4fb92e,null));};exports['describe']=function(_0x134c64,_0x133f50){return db[_0x25b1('0x28')][_0x25b1('0x4a')]()[_0x25b1('0x42')](respondWithResult(_0x133f50,null))[_0x25b1('0x46')](handleError(_0x133f50,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 72916f4..167a6d0 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 _0x7b5f=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x30c9a6,_0x2d0d2c){var _0x12a646=function(_0xb83002){while(--_0xb83002){_0x30c9a6['push'](_0x30c9a6['shift']());}};_0x12a646(++_0x2d0d2c);}(_0x7b5f,0x1ac));var _0xf7b5=function(_0xdf6058,_0x4c3384){_0xdf6058=_0xdf6058-0x0;var _0x49b20f=_0x7b5f[_0xdf6058];return _0x49b20f;};'use strict';var _=require(_0xf7b5('0x0'));var util=require(_0xf7b5('0x1'));var logger=require(_0xf7b5('0x2'))(_0xf7b5('0x3'));var moment=require('moment');var BPromise=require(_0xf7b5('0x4'));var rp=require(_0xf7b5('0x5'));var fs=require('fs');var path=require(_0xf7b5('0x6'));var rimraf=require(_0xf7b5('0x7'));var config=require(_0xf7b5('0x8'));var attributes=require(_0xf7b5('0x9'));module['exports']=function(_0x48ee39,_0x49acce){return _0x48ee39[_0xf7b5('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xf7b5('0xb'),'fields':[_0xf7b5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd15=['request-promise','path','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5941fe,_0x5d5c38){var _0x364272=function(_0x19d4cf){while(--_0x19d4cf){_0x5941fe['push'](_0x5941fe['shift']());}};_0x364272(++_0x5d5c38);}(_0xcd15,0xf6));var _0x5cd1=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0xcd15[_0x299784];return _0x5ab008;};'use strict';var _=require(_0x5cd1('0x0'));var util=require(_0x5cd1('0x1'));var logger=require(_0x5cd1('0x2'))(_0x5cd1('0x3'));var moment=require(_0x5cd1('0x4'));var BPromise=require(_0x5cd1('0x5'));var rp=require(_0x5cd1('0x6'));var fs=require('fs');var path=require(_0x5cd1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5cd1('0x8'));module[_0x5cd1('0x9')]=function(_0x3aeb03,_0x3eb94f){return _0x3aeb03[_0x5cd1('0xa')](_0x5cd1('0xb'),attributes,{'tableName':_0x5cd1('0xc'),'paranoid':![],'indexes':[{'name':_0x5cd1('0xd'),'fields':[_0x5cd1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 49f29e4..8521d86 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(_0x1237b5,_0x4786ad){var _0x5a2b68=function(_0x369986){while(--_0x369986){_0x1237b5['push'](_0x1237b5['shift']());}};_0x5a2b68(++_0x4786ad);}(_0x2ef3,0xba));var _0x32ef=function(_0xe2f389,_0x15ad8f){_0xe2f389=_0xe2f389-0x0;var _0x46a97b=_0x2ef3[_0xe2f389];return _0x46a97b;};'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 _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(_0x218947,_0x22c2a0){var _0x25c3bd=function(_0x4b6652){while(--_0x4b6652){_0x218947['push'](_0x218947['shift']());}};_0x25c3bd(++_0x22c2a0);}(_0x2ef3,0xba));var _0x32ef=function(_0x79490f,_0x3b7025){_0x79490f=_0x79490f-0x0;var _0x53acdd=_0x2ef3[_0x79490f];return _0x53acdd;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 0ac35ce..60f658d 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47c9b1,_0x119667){var _0x314445=function(_0x547906){while(--_0x547906){_0x47c9b1['push'](_0x47c9b1['shift']());}};_0x314445(++_0x119667);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x45030e,_0x32b6b8){var _0x4df3be=function(_0x1fe781){while(--_0x1fe781){_0x45030e['push'](_0x45030e['shift']());}};_0x4df3be(++_0x32b6b8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3f024af..8ce97c9 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 _0x8616=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x84b0e6,_0x5d4182){var _0x302fa9=function(_0x5c3121){while(--_0x5c3121){_0x84b0e6['push'](_0x84b0e6['shift']());}};_0x302fa9(++_0x5d4182);}(_0x8616,0x16e));var _0x6861=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x8616[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require('sequelize');module[_0x6861('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6861('0x1')]},'authentication':{'type':Sequelize[_0x6861('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6861('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6861('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x6861('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x6861('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbb8a=['BOOLEAN','INBOX','INTEGER','sequelize','exports','STRING'];(function(_0x27d206,_0x45c230){var _0x3e2f24=function(_0x582696){while(--_0x582696){_0x27d206['push'](_0x27d206['shift']());}};_0x3e2f24(++_0x45c230);}(_0xbb8a,0x99));var _0xabb8=function(_0x324e1a,_0x4577ad){_0x324e1a=_0x324e1a-0x0;var _0x23d252=_0xbb8a[_0x324e1a];return _0x23d252;};'use strict';var Sequelize=require(_0xabb8('0x0'));module[_0xabb8('0x1')]={'description':{'type':Sequelize[_0xabb8('0x2')]},'host':{'type':Sequelize[_0xabb8('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xabb8('0x2')]},'password':{'type':Sequelize[_0xabb8('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xabb8('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xabb8('0x2')],'defaultValue':_0xabb8('0x4')},'connTimeout':{'type':Sequelize[_0xabb8('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xabb8('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xabb8('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 821251b..9a1ac93 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 _0xdd15=['../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','bluebird','rimraf'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xdd15,0x145));var _0x5dd1=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0xdd15[_0x4226d6];return _0x19655b;};'use strict';var _=require(_0x5dd1('0x0'));var util=require(_0x5dd1('0x1'));var logger=require(_0x5dd1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5dd1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dd1('0x4'));var config=require(_0x5dd1('0x5'));var attributes=require('./mailServerIn.attributes');module[_0x5dd1('0x6')]=function(_0x69f825,_0x2a7f73){return _0x69f825[_0x5dd1('0x7')](_0x5dd1('0x8'),attributes,{'tableName':_0x5dd1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dbf=['exports','define','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes'];(function(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0x8dbf,0x108));var _0xf8db=function(_0x4d9844,_0x306e83){_0x4d9844=_0x4d9844-0x0;var _0x5c4052=_0x8dbf[_0x4d9844];return _0x5c4052;};'use strict';var _=require('lodash');var util=require(_0xf8db('0x0'));var logger=require(_0xf8db('0x1'))(_0xf8db('0x2'));var moment=require(_0xf8db('0x3'));var BPromise=require(_0xf8db('0x4'));var rp=require(_0xf8db('0x5'));var fs=require('fs');var path=require(_0xf8db('0x6'));var rimraf=require('rimraf');var config=require(_0xf8db('0x7'));var attributes=require(_0xf8db('0x8'));module[_0xf8db('0x9')]=function(_0x3868fe,_0x4c1744){return _0x3868fe[_0xf8db('0xa')](_0xf8db('0xb'),attributes,{'tableName':_0xf8db('0xc'),'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 8d854f3..b993e40 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 _0xd57a=['result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0xd57a,0xdf));var _0xad57=function(_0x25690d,_0x5594ad){_0x25690d=_0x25690d-0x0;var _0x1af49f=_0xd57a[_0x25690d];return _0x1af49f;};'use strict';var _=require(_0xad57('0x0'));var util=require(_0xad57('0x1'));var moment=require(_0xad57('0x2'));var BPromise=require('bluebird');var rs=require(_0xad57('0x3'));var fs=require('fs');var Redis=require(_0xad57('0x4'));var db=require(_0xad57('0x5'))['db'];var utils=require(_0xad57('0x6'));var logger=require(_0xad57('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad57('0x8'));var client=jayson[_0xad57('0x9')][_0xad57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xed22cb,_0x41d0ff,_0x38354b){return new BPromise(function(_0x231c0d,_0x4f2f43){return client[_0xad57('0xb')](_0xed22cb,_0x38354b)[_0xad57('0xc')](function(_0x1a903b){logger[_0xad57('0xd')](_0xad57('0xe'),_0x41d0ff,_0xad57('0xf'));logger[_0xad57('0x10')](_0xad57('0x11'),_0x41d0ff,'request\x20sent',JSON[_0xad57('0x12')](_0x1a903b));if(_0x1a903b[_0xad57('0x13')]){if(_0x1a903b[_0xad57('0x13')][_0xad57('0x14')]===0x1f4){logger[_0xad57('0x13')](_0xad57('0xe'),_0x41d0ff,_0x1a903b[_0xad57('0x13')][_0xad57('0x15')]);return _0x4f2f43(_0x1a903b[_0xad57('0x13')][_0xad57('0x15')]);}logger[_0xad57('0x13')](_0xad57('0xe'),_0x41d0ff,_0x1a903b['error'][_0xad57('0x15')]);return _0x231c0d(_0x1a903b[_0xad57('0x13')][_0xad57('0x15')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x41d0ff,_0xad57('0xf'));_0x231c0d(_0x1a903b[_0xad57('0x16')][_0xad57('0x15')]);}})[_0xad57('0x17')](function(_0x586447){logger[_0xad57('0x13')](_0xad57('0xe'),_0x41d0ff,_0x586447);_0x4f2f43(_0x586447);});});}exports['GetMailServerIn']=function(_0x91512d){var _0x1828d2=this;return new Promise(function(_0x1e456b,_0x173aaa){return db[_0xad57('0x18')][_0xad57('0x19')]({'raw':_0x91512d[_0xad57('0x1a')]?_0x91512d[_0xad57('0x1a')][_0xad57('0x1b')]===undefined?!![]:![]:!![],'where':_0x91512d[_0xad57('0x1a')]?_0x91512d[_0xad57('0x1a')][_0xad57('0x1c')]||null:null,'attributes':_0x91512d[_0xad57('0x1a')]?_0x91512d[_0xad57('0x1a')][_0xad57('0x1d')]||null:null,'limit':_0x91512d[_0xad57('0x1a')]?_0x91512d['options'][_0xad57('0x1e')]||null:null,'include':_0x91512d[_0xad57('0x1a')]?_0x91512d[_0xad57('0x1a')][_0xad57('0x1f')]?_[_0xad57('0x20')](_0x91512d[_0xad57('0x1a')][_0xad57('0x1f')],function(_0xeeb037){return{'model':db[_0xeeb037[_0xad57('0x21')]],'as':_0xeeb037['as'],'attributes':_0xeeb037['attributes'],'include':_0xeeb037[_0xad57('0x1f')]?_[_0xad57('0x20')](_0xeeb037['include'],function(_0x466646){return{'model':db[_0x466646['model']],'as':_0x466646['as'],'attributes':_0x466646['attributes'],'include':_0x466646[_0xad57('0x1f')]?_[_0xad57('0x20')](_0x466646[_0xad57('0x1f')],function(_0x203db3){return{'model':db[_0x203db3[_0xad57('0x21')]],'as':_0x203db3['as'],'attributes':_0x203db3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d0a53){logger[_0xad57('0xd')](_0xad57('0x22'),_0x91512d);logger['debug'](_0xad57('0x22'),_0x91512d,JSON[_0xad57('0x12')](_0x3d0a53));_0x1e456b(_0x3d0a53);})['catch'](function(_0x2e0ec1){logger[_0xad57('0x13')](_0xad57('0x22'),_0x2e0ec1[_0xad57('0x15')],_0x91512d);_0x173aaa(_0x1828d2[_0xad57('0x13')](0x1f4,_0x2e0ec1[_0xad57('0x15')]));});});}; \ No newline at end of file +var _0xe80d=['code','error','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','include','model','map','GetMailServerIn','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x5a6edd,_0x83b034){var _0xa2515=function(_0x45588a){while(--_0x45588a){_0x5a6edd['push'](_0x5a6edd['shift']());}};_0xa2515(++_0x83b034);}(_0xe80d,0x183));var _0xde80=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0xe80d[_0x39479f];return _0x4a6d96;};'use strict';var _=require(_0xde80('0x0'));var util=require(_0xde80('0x1'));var moment=require(_0xde80('0x2'));var BPromise=require('bluebird');var rs=require(_0xde80('0x3'));var fs=require('fs');var Redis=require(_0xde80('0x4'));var db=require(_0xde80('0x5'))['db'];var utils=require(_0xde80('0x6'));var logger=require('../../config/logger')(_0xde80('0x7'));var config=require(_0xde80('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xde80('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5c46,_0x2a8dae,_0x464766){return new BPromise(function(_0x5f4f15,_0x311166){return client['request'](_0x5c5c46,_0x464766)[_0xde80('0xa')](function(_0x342c33){logger[_0xde80('0xb')](_0xde80('0xc'),_0x2a8dae,'request\x20sent');logger[_0xde80('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2a8dae,_0xde80('0xe'),JSON[_0xde80('0xf')](_0x342c33));if(_0x342c33['error']){if(_0x342c33['error'][_0xde80('0x10')]===0x1f4){logger[_0xde80('0x11')](_0xde80('0xc'),_0x2a8dae,_0x342c33[_0xde80('0x11')][_0xde80('0x12')]);return _0x311166(_0x342c33[_0xde80('0x11')][_0xde80('0x12')]);}logger[_0xde80('0x11')]('MailServerIn,\x20%s,\x20%s',_0x2a8dae,_0x342c33[_0xde80('0x11')][_0xde80('0x12')]);return _0x5f4f15(_0x342c33['error'][_0xde80('0x12')]);}else{logger[_0xde80('0xb')](_0xde80('0xc'),_0x2a8dae,_0xde80('0xe'));_0x5f4f15(_0x342c33[_0xde80('0x13')]['message']);}})[_0xde80('0x14')](function(_0x45ea0b){logger['error'](_0xde80('0xc'),_0x2a8dae,_0x45ea0b);_0x311166(_0x45ea0b);});});}exports['GetMailServerIn']=function(_0x2fe639){var _0x2ba22b=this;return new Promise(function(_0x3b80d5,_0x4db7ff){return db[_0xde80('0x15')][_0xde80('0x16')]({'raw':_0x2fe639[_0xde80('0x17')]?_0x2fe639[_0xde80('0x17')][_0xde80('0x18')]===undefined?!![]:![]:!![],'where':_0x2fe639[_0xde80('0x17')]?_0x2fe639[_0xde80('0x17')][_0xde80('0x19')]||null:null,'attributes':_0x2fe639[_0xde80('0x17')]?_0x2fe639[_0xde80('0x17')][_0xde80('0x1a')]||null:null,'limit':_0x2fe639['options']?_0x2fe639[_0xde80('0x17')]['limit']||null:null,'include':_0x2fe639[_0xde80('0x17')]?_0x2fe639[_0xde80('0x17')][_0xde80('0x1b')]?_['map'](_0x2fe639['options'][_0xde80('0x1b')],function(_0xb64309){return{'model':db[_0xb64309[_0xde80('0x1c')]],'as':_0xb64309['as'],'attributes':_0xb64309[_0xde80('0x1a')],'include':_0xb64309[_0xde80('0x1b')]?_[_0xde80('0x1d')](_0xb64309[_0xde80('0x1b')],function(_0x35d159){return{'model':db[_0x35d159[_0xde80('0x1c')]],'as':_0x35d159['as'],'attributes':_0x35d159['attributes'],'include':_0x35d159[_0xde80('0x1b')]?_[_0xde80('0x1d')](_0x35d159[_0xde80('0x1b')],function(_0x50d067){return{'model':db[_0x50d067[_0xde80('0x1c')]],'as':_0x50d067['as'],'attributes':_0x50d067[_0xde80('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5317d){logger[_0xde80('0xb')](_0xde80('0x1e'),_0x2fe639);logger[_0xde80('0xd')](_0xde80('0x1e'),_0x2fe639,JSON[_0xde80('0xf')](_0x5317d));_0x3b80d5(_0x5317d);})['catch'](function(_0x55ecd8){logger['error'](_0xde80('0x1e'),_0x55ecd8[_0xde80('0x12')],_0x2fe639);_0x4db7ff(_0x2ba22b[_0xde80('0x11')](0x1f4,_0x55ecd8[_0xde80('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b059d7a..ce062ff 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x345c13,_0x4715e1){_0x345c13=_0x345c13-0x0;var _0x4cca65=_0x7a54[_0x345c13];return _0x4cca65;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x1307ea,_0x58e8da){_0x1307ea=_0x1307ea-0x0;var _0x558ca2=_0x7a54[_0x1307ea];return _0x558ca2;};'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 ae7b2e8..04b673d 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 _0x065e=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x54a2ec,_0x32d7ec){var _0x44aa1f=function(_0x3860c9){while(--_0x3860c9){_0x54a2ec['push'](_0x54a2ec['shift']());}};_0x44aa1f(++_0x32d7ec);}(_0x065e,0x1a7));var _0xe065=function(_0x57a044,_0x5345a7){_0x57a044=_0x57a044-0x0;var _0x194711=_0x065e[_0x57a044];return _0x194711;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe065('0x1')]},'pass':{'type':Sequelize[_0xe065('0x1')]},'port':{'type':Sequelize[_0xe065('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x63a5=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x509d99,_0x480256){var _0x43e12d=function(_0x14256b){while(--_0x14256b){_0x509d99['push'](_0x509d99['shift']());}};_0x43e12d(++_0x480256);}(_0x63a5,0x18e));var _0x563a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x63a5[_0x5a776b];return _0xbbef59;};'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 2c59136..0c63a4a 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 _0x07fd=['count','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','MailServerOut','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','catch','params','rawAttributes','include','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x07fd,0x105));var _0xd07f=function(_0x61e8d9,_0x54fd02){_0x61e8d9=_0x61e8d9-0x0;var _0x1f1438=_0x07fd[_0x61e8d9];return _0x1f1438;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd07f('0x0'));var jsonpatch=require(_0xd07f('0x1'));var rp=require(_0xd07f('0x2'));var moment=require(_0xd07f('0x3'));var BPromise=require(_0xd07f('0x4'));var Mustache=require(_0xd07f('0x5'));var util=require('util');var path=require(_0xd07f('0x6'));var sox=require('sox');var csv=require(_0xd07f('0x7'));var ejs=require(_0xd07f('0x8'));var fs=require('fs');var fs_extra=require(_0xd07f('0x9'));var _=require(_0xd07f('0xa'));var squel=require(_0xd07f('0xb'));var crypto=require('crypto');var jsforce=require(_0xd07f('0xc'));var deskjs=require(_0xd07f('0xd'));var toCsv=require(_0xd07f('0x7'));var querystring=require(_0xd07f('0xe'));var Papa=require(_0xd07f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd07f('0x10'));var as=require(_0xd07f('0x11'));var hardwareService=require(_0xd07f('0x12'));var logger=require(_0xd07f('0x13'))(_0xd07f('0x14'));var utils=require(_0xd07f('0x15'));var config=require(_0xd07f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd07f('0x17'))['db'];function respondWithStatusCode(_0x4bcb61,_0x3983e3){_0x3983e3=_0x3983e3||0xcc;return function(_0x55b81e){if(_0x55b81e){return _0x4bcb61[_0xd07f('0x18')](_0x3983e3);}return _0x4bcb61[_0xd07f('0x19')](_0x3983e3)[_0xd07f('0x1a')]();};}function respondWithResult(_0x368288,_0x47b3ec){_0x47b3ec=_0x47b3ec||0xc8;return function(_0x474caf){if(_0x474caf){return _0x368288[_0xd07f('0x19')](_0x47b3ec)[_0xd07f('0x1b')](_0x474caf);}};}function respondWithFilteredResult(_0x12abf2,_0x1cac6e){return function(_0x250777){if(_0x250777){var _0x5d91bb=typeof _0x1cac6e[_0xd07f('0x1c')]===_0xd07f('0x1d')&&typeof _0x1cac6e[_0xd07f('0x1e')]===_0xd07f('0x1d');var _0x241861=_0x250777[_0xd07f('0x1f')];var _0x4b7167=_0x5d91bb?0x0:_0x1cac6e[_0xd07f('0x1c')];var _0x3588dc=_0x5d91bb?_0x250777[_0xd07f('0x1f')]:_0x1cac6e[_0xd07f('0x1c')]+_0x1cac6e['limit'];var _0x468600;if(_0x3588dc>=_0x241861){_0x3588dc=_0x241861;_0x468600=0xc8;}else{_0x468600=0xce;}_0x12abf2[_0xd07f('0x19')](_0x468600);return _0x12abf2['set'](_0xd07f('0x20'),_0x4b7167+'-'+_0x3588dc+'/'+_0x241861)['json'](_0x250777);}return null;};}function patchUpdates(_0x359383){return function(_0x645fbe){try{jsonpatch[_0xd07f('0x21')](_0x645fbe,_0x359383,!![]);}catch(_0x51a9b4){return BPromise[_0xd07f('0x22')](_0x51a9b4);}return _0x645fbe[_0xd07f('0x23')]();};}function saveUpdates(_0x498502,_0x580c0d){return function(_0x3d56dd){if(_0x3d56dd){return _0x3d56dd[_0xd07f('0x24')](_0x498502)['then'](function(_0x102508){return _0x102508;});}return null;};}function removeEntity(_0x519a32,_0x2cd394){return function(_0x448e6d){if(_0x448e6d){return _0x448e6d[_0xd07f('0x25')]()[_0xd07f('0x26')](function(){_0x519a32['status'](0xcc)[_0xd07f('0x1a')]();});}};}function handleEntityNotFound(_0x21fe7a,_0x5ad723){return function(_0x2046f2){if(!_0x2046f2){_0x21fe7a[_0xd07f('0x18')](0x194);}return _0x2046f2;};}function handleError(_0x5d3917,_0x91ce84){_0x91ce84=_0x91ce84||0x1f4;return function(_0x4b5247){logger[_0xd07f('0x27')](_0x4b5247['stack']);if(_0x4b5247[_0xd07f('0x28')]){delete _0x4b5247[_0xd07f('0x28')];}_0x5d3917[_0xd07f('0x19')](_0x91ce84)[_0xd07f('0x29')](_0x4b5247);};}exports[_0xd07f('0x2a')]=function(_0x2759a5,_0x3c544f){var _0x334e8c={},_0x8259ca={},_0x1cd219={'count':0x0,'rows':[]};var _0x3b66a6=_[_0xd07f('0x2b')](db[_0xd07f('0x2c')]['rawAttributes'],function(_0x1b7c6b){return{'name':_0x1b7c6b[_0xd07f('0x2d')],'type':_0x1b7c6b[_0xd07f('0x2e')][_0xd07f('0x2f')]};});_0x8259ca['model']=_[_0xd07f('0x2b')](_0x3b66a6,_0xd07f('0x28'));_0x8259ca[_0xd07f('0x30')]=_[_0xd07f('0x31')](_0x2759a5['query']);_0x8259ca[_0xd07f('0x32')]=_[_0xd07f('0x33')](_0x8259ca[_0xd07f('0x34')],_0x8259ca[_0xd07f('0x30')]);_0x334e8c[_0xd07f('0x35')]=_[_0xd07f('0x33')](_0x8259ca[_0xd07f('0x34')],qs[_0xd07f('0x36')](_0x2759a5[_0xd07f('0x30')][_0xd07f('0x36')]));_0x334e8c[_0xd07f('0x35')]=_0x334e8c['attributes'][_0xd07f('0x37')]?_0x334e8c[_0xd07f('0x35')]:_0x8259ca['model'];if(!_0x2759a5[_0xd07f('0x30')][_0xd07f('0x38')](_0xd07f('0x39'))){_0x334e8c[_0xd07f('0x1e')]=qs['limit'](_0x2759a5[_0xd07f('0x30')][_0xd07f('0x1e')]);_0x334e8c[_0xd07f('0x1c')]=qs[_0xd07f('0x1c')](_0x2759a5[_0xd07f('0x30')]['offset']);}_0x334e8c[_0xd07f('0x3a')]=qs['sort'](_0x2759a5['query'][_0xd07f('0x3b')]);_0x334e8c[_0xd07f('0x3c')]=qs[_0xd07f('0x32')](_[_0xd07f('0x3d')](_0x2759a5[_0xd07f('0x30')],_0x8259ca[_0xd07f('0x32')]),_0x3b66a6);if(_0x2759a5[_0xd07f('0x30')]['filter']){_0x334e8c[_0xd07f('0x3c')]=_[_0xd07f('0x3e')](_0x334e8c[_0xd07f('0x3c')],{'$or':_[_0xd07f('0x2b')](_0x3b66a6,function(_0x52e302){if(_0x52e302[_0xd07f('0x2e')]!=='VIRTUAL'){var _0x1f311d={};_0x1f311d[_0x52e302[_0xd07f('0x28')]]={'$like':'%'+_0x2759a5[_0xd07f('0x30')]['filter']+'%'};return _0x1f311d;}})});}_0x334e8c=_[_0xd07f('0x3e')]({},_0x334e8c,_0x2759a5[_0xd07f('0x3f')]);var _0x25beb3={'where':_0x334e8c['where']};return db[_0xd07f('0x2c')][_0xd07f('0x1f')](_0x25beb3)[_0xd07f('0x26')](function(_0x3eb4a){_0x1cd219[_0xd07f('0x1f')]=_0x3eb4a;if(_0x2759a5['query'][_0xd07f('0x40')]){_0x334e8c['include']=[{'all':!![]}];}return db[_0xd07f('0x2c')][_0xd07f('0x41')](_0x334e8c);})[_0xd07f('0x26')](function(_0x4c0c2a){_0x1cd219['rows']=_0x4c0c2a;return _0x1cd219;})[_0xd07f('0x26')](respondWithFilteredResult(_0x3c544f,_0x334e8c))[_0xd07f('0x42')](handleError(_0x3c544f,null));};exports['show']=function(_0x1bffdc,_0x2c2f71){var _0x42d6f8={'raw':!![],'where':{'id':_0x1bffdc[_0xd07f('0x43')]['id']}},_0x4f498c={};_0x4f498c[_0xd07f('0x34')]=_[_0xd07f('0x31')](db['MailServerOut'][_0xd07f('0x44')]);_0x4f498c[_0xd07f('0x30')]=_['keys'](_0x1bffdc['query']);_0x4f498c[_0xd07f('0x32')]=_[_0xd07f('0x33')](_0x4f498c[_0xd07f('0x34')],_0x4f498c['query']);_0x42d6f8[_0xd07f('0x35')]=_[_0xd07f('0x33')](_0x4f498c[_0xd07f('0x34')],qs[_0xd07f('0x36')](_0x1bffdc['query'][_0xd07f('0x36')]));_0x42d6f8[_0xd07f('0x35')]=_0x42d6f8[_0xd07f('0x35')][_0xd07f('0x37')]?_0x42d6f8[_0xd07f('0x35')]:_0x4f498c['model'];if(_0x1bffdc[_0xd07f('0x30')][_0xd07f('0x40')]){_0x42d6f8[_0xd07f('0x45')]=[{'all':!![]}];}_0x42d6f8=_[_0xd07f('0x3e')]({},_0x42d6f8,_0x1bffdc['options']);return db[_0xd07f('0x2c')][_0xd07f('0x46')](_0x42d6f8)[_0xd07f('0x26')](handleEntityNotFound(_0x2c2f71,null))['then'](respondWithResult(_0x2c2f71,null))[_0xd07f('0x42')](handleError(_0x2c2f71,null));};exports[_0xd07f('0x47')]=function(_0xa5ff5b,_0x1ca93d){return db[_0xd07f('0x2c')][_0xd07f('0x47')](_0xa5ff5b[_0xd07f('0x48')],{})[_0xd07f('0x26')](respondWithResult(_0x1ca93d,0xc9))[_0xd07f('0x42')](handleError(_0x1ca93d,null));};exports[_0xd07f('0x24')]=function(_0x2f59f2,_0xa49172){if(_0x2f59f2[_0xd07f('0x48')]['id']){delete _0x2f59f2[_0xd07f('0x48')]['id'];}return db[_0xd07f('0x2c')][_0xd07f('0x46')]({'where':{'id':_0x2f59f2[_0xd07f('0x43')]['id']}})[_0xd07f('0x26')](handleEntityNotFound(_0xa49172,null))['then'](saveUpdates(_0x2f59f2[_0xd07f('0x48')],null))[_0xd07f('0x26')](respondWithResult(_0xa49172,null))[_0xd07f('0x42')](handleError(_0xa49172,null));};exports[_0xd07f('0x25')]=function(_0x576851,_0x12c619){return db[_0xd07f('0x2c')][_0xd07f('0x46')]({'where':{'id':_0x576851['params']['id']}})[_0xd07f('0x26')](handleEntityNotFound(_0x12c619,null))[_0xd07f('0x26')](removeEntity(_0x12c619,null))['catch'](handleError(_0x12c619,null));}; \ No newline at end of file +var _0xd4da=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','MailServerOut','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','options','create','body','find','eml-format'];(function(_0x6f96e6,_0x23ea02){var _0xec6891=function(_0x1d7ccd){while(--_0x1d7ccd){_0x6f96e6['push'](_0x6f96e6['shift']());}};_0xec6891(++_0x23ea02);}(_0xd4da,0x9d));var _0xad4d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4da[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xad4d('0x0'));var rimraf=require(_0xad4d('0x1'));var zipdir=require(_0xad4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad4d('0x3'));var moment=require(_0xad4d('0x4'));var BPromise=require(_0xad4d('0x5'));var Mustache=require(_0xad4d('0x6'));var util=require('util');var path=require(_0xad4d('0x7'));var sox=require('sox');var csv=require(_0xad4d('0x8'));var ejs=require(_0xad4d('0x9'));var fs=require('fs');var fs_extra=require(_0xad4d('0xa'));var _=require(_0xad4d('0xb'));var squel=require(_0xad4d('0xc'));var crypto=require(_0xad4d('0xd'));var jsforce=require(_0xad4d('0xe'));var deskjs=require(_0xad4d('0xf'));var toCsv=require(_0xad4d('0x8'));var querystring=require(_0xad4d('0x10'));var Papa=require(_0xad4d('0x11'));var Redis=require(_0xad4d('0x12'));var authService=require(_0xad4d('0x13'));var qs=require(_0xad4d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad4d('0x15'));var logger=require(_0xad4d('0x16'))(_0xad4d('0x17'));var utils=require(_0xad4d('0x18'));var config=require(_0xad4d('0x19'));var licenseUtil=require(_0xad4d('0x1a'));var db=require(_0xad4d('0x1b'))['db'];function respondWithStatusCode(_0x52e9ff,_0x567ea5){_0x567ea5=_0x567ea5||0xcc;return function(_0x201b5d){if(_0x201b5d){return _0x52e9ff[_0xad4d('0x1c')](_0x567ea5);}return _0x52e9ff[_0xad4d('0x1d')](_0x567ea5)['end']();};}function respondWithResult(_0x4ef07e,_0x489d77){_0x489d77=_0x489d77||0xc8;return function(_0x57a47c){if(_0x57a47c){return _0x4ef07e[_0xad4d('0x1d')](_0x489d77)[_0xad4d('0x1e')](_0x57a47c);}};}function respondWithFilteredResult(_0x25c8ae,_0x3b64ce){return function(_0x4e3659){if(_0x4e3659){var _0x247eb2=typeof _0x3b64ce[_0xad4d('0x1f')]==='undefined'&&typeof _0x3b64ce[_0xad4d('0x20')]===_0xad4d('0x21');var _0x190277=_0x4e3659[_0xad4d('0x22')];var _0x47a751=_0x247eb2?0x0:_0x3b64ce[_0xad4d('0x1f')];var _0x5d4bc7=_0x247eb2?_0x4e3659['count']:_0x3b64ce['offset']+_0x3b64ce[_0xad4d('0x20')];var _0x5209be;if(_0x5d4bc7>=_0x190277){_0x5d4bc7=_0x190277;_0x5209be=0xc8;}else{_0x5209be=0xce;}_0x25c8ae[_0xad4d('0x1d')](_0x5209be);return _0x25c8ae[_0xad4d('0x23')](_0xad4d('0x24'),_0x47a751+'-'+_0x5d4bc7+'/'+_0x190277)[_0xad4d('0x1e')](_0x4e3659);}return null;};}function patchUpdates(_0x125c89){return function(_0x51863d){try{jsonpatch[_0xad4d('0x25')](_0x51863d,_0x125c89,!![]);}catch(_0x42ff58){return BPromise[_0xad4d('0x26')](_0x42ff58);}return _0x51863d[_0xad4d('0x27')]();};}function saveUpdates(_0x547569,_0x114037){return function(_0x18f64b){if(_0x18f64b){return _0x18f64b[_0xad4d('0x28')](_0x547569)[_0xad4d('0x29')](function(_0x47e4fd){return _0x47e4fd;});}return null;};}function removeEntity(_0x546c52,_0x331e4b){return function(_0x3601f8){if(_0x3601f8){return _0x3601f8[_0xad4d('0x2a')]()[_0xad4d('0x29')](function(){_0x546c52[_0xad4d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a20b,_0x267b7f){return function(_0x216b59){if(!_0x216b59){_0x47a20b[_0xad4d('0x1c')](0x194);}return _0x216b59;};}function handleError(_0x66dab2,_0xbde7a0){_0xbde7a0=_0xbde7a0||0x1f4;return function(_0xac0d87){logger['error'](_0xac0d87[_0xad4d('0x2b')]);if(_0xac0d87[_0xad4d('0x2c')]){delete _0xac0d87[_0xad4d('0x2c')];}_0x66dab2[_0xad4d('0x1d')](_0xbde7a0)['send'](_0xac0d87);};}exports[_0xad4d('0x2d')]=function(_0x55e4d2,_0x3ab255){var _0x425f8b={},_0x5b3366={},_0x9edf2a={'count':0x0,'rows':[]};var _0x3dded8=_[_0xad4d('0x2e')](db[_0xad4d('0x2f')]['rawAttributes'],function(_0x281a09){return{'name':_0x281a09[_0xad4d('0x30')],'type':_0x281a09['type'][_0xad4d('0x31')]};});_0x5b3366[_0xad4d('0x32')]=_[_0xad4d('0x2e')](_0x3dded8,_0xad4d('0x2c'));_0x5b3366[_0xad4d('0x33')]=_[_0xad4d('0x34')](_0x55e4d2[_0xad4d('0x33')]);_0x5b3366[_0xad4d('0x35')]=_[_0xad4d('0x36')](_0x5b3366[_0xad4d('0x32')],_0x5b3366[_0xad4d('0x33')]);_0x425f8b[_0xad4d('0x37')]=_[_0xad4d('0x36')](_0x5b3366[_0xad4d('0x32')],qs[_0xad4d('0x38')](_0x55e4d2['query'][_0xad4d('0x38')]));_0x425f8b['attributes']=_0x425f8b[_0xad4d('0x37')]['length']?_0x425f8b[_0xad4d('0x37')]:_0x5b3366[_0xad4d('0x32')];if(!_0x55e4d2['query'][_0xad4d('0x39')](_0xad4d('0x3a'))){_0x425f8b['limit']=qs[_0xad4d('0x20')](_0x55e4d2[_0xad4d('0x33')][_0xad4d('0x20')]);_0x425f8b['offset']=qs[_0xad4d('0x1f')](_0x55e4d2[_0xad4d('0x33')]['offset']);}_0x425f8b[_0xad4d('0x3b')]=qs[_0xad4d('0x3c')](_0x55e4d2[_0xad4d('0x33')][_0xad4d('0x3c')]);_0x425f8b[_0xad4d('0x3d')]=qs[_0xad4d('0x35')](_[_0xad4d('0x3e')](_0x55e4d2['query'],_0x5b3366['filters']),_0x3dded8);if(_0x55e4d2[_0xad4d('0x33')][_0xad4d('0x3f')]){_0x425f8b[_0xad4d('0x3d')]=_['merge'](_0x425f8b['where'],{'$or':_[_0xad4d('0x2e')](_0x3dded8,function(_0x55583f){if(_0x55583f['type']!==_0xad4d('0x40')){var _0x5b276b={};_0x5b276b[_0x55583f[_0xad4d('0x2c')]]={'$like':'%'+_0x55e4d2[_0xad4d('0x33')][_0xad4d('0x3f')]+'%'};return _0x5b276b;}})});}_0x425f8b=_[_0xad4d('0x41')]({},_0x425f8b,_0x55e4d2['options']);var _0x4a3968={'where':_0x425f8b[_0xad4d('0x3d')]};return db[_0xad4d('0x2f')][_0xad4d('0x22')](_0x4a3968)[_0xad4d('0x29')](function(_0x4e7fb4){_0x9edf2a[_0xad4d('0x22')]=_0x4e7fb4;if(_0x55e4d2['query'][_0xad4d('0x42')]){_0x425f8b['include']=[{'all':!![]}];}return db[_0xad4d('0x2f')][_0xad4d('0x43')](_0x425f8b);})[_0xad4d('0x29')](function(_0x33e4e0){_0x9edf2a[_0xad4d('0x44')]=_0x33e4e0;return _0x9edf2a;})[_0xad4d('0x29')](respondWithFilteredResult(_0x3ab255,_0x425f8b))[_0xad4d('0x45')](handleError(_0x3ab255,null));};exports[_0xad4d('0x46')]=function(_0xcc5d88,_0x1cf34b){var _0x50f949={'raw':!![],'where':{'id':_0xcc5d88[_0xad4d('0x47')]['id']}},_0x9d638e={};_0x9d638e['model']=_[_0xad4d('0x34')](db[_0xad4d('0x2f')][_0xad4d('0x48')]);_0x9d638e[_0xad4d('0x33')]=_[_0xad4d('0x34')](_0xcc5d88[_0xad4d('0x33')]);_0x9d638e['filters']=_['intersection'](_0x9d638e[_0xad4d('0x32')],_0x9d638e[_0xad4d('0x33')]);_0x50f949[_0xad4d('0x37')]=_[_0xad4d('0x36')](_0x9d638e[_0xad4d('0x32')],qs[_0xad4d('0x38')](_0xcc5d88[_0xad4d('0x33')][_0xad4d('0x38')]));_0x50f949['attributes']=_0x50f949[_0xad4d('0x37')][_0xad4d('0x49')]?_0x50f949[_0xad4d('0x37')]:_0x9d638e[_0xad4d('0x32')];if(_0xcc5d88[_0xad4d('0x33')]['includeAll']){_0x50f949[_0xad4d('0x4a')]=[{'all':!![]}];}_0x50f949=_['merge']({},_0x50f949,_0xcc5d88[_0xad4d('0x4b')]);return db[_0xad4d('0x2f')]['find'](_0x50f949)[_0xad4d('0x29')](handleEntityNotFound(_0x1cf34b,null))[_0xad4d('0x29')](respondWithResult(_0x1cf34b,null))[_0xad4d('0x45')](handleError(_0x1cf34b,null));};exports[_0xad4d('0x4c')]=function(_0x9cb118,_0x18d1f7){return db[_0xad4d('0x2f')][_0xad4d('0x4c')](_0x9cb118['body'],{})[_0xad4d('0x29')](respondWithResult(_0x18d1f7,0xc9))[_0xad4d('0x45')](handleError(_0x18d1f7,null));};exports[_0xad4d('0x28')]=function(_0x329085,_0x2567c3){if(_0x329085[_0xad4d('0x4d')]['id']){delete _0x329085[_0xad4d('0x4d')]['id'];}return db[_0xad4d('0x2f')][_0xad4d('0x4e')]({'where':{'id':_0x329085[_0xad4d('0x47')]['id']}})['then'](handleEntityNotFound(_0x2567c3,null))[_0xad4d('0x29')](saveUpdates(_0x329085['body'],null))[_0xad4d('0x29')](respondWithResult(_0x2567c3,null))[_0xad4d('0x45')](handleError(_0x2567c3,null));};exports[_0xad4d('0x2a')]=function(_0x2ec8be,_0x3ecd1d){return db[_0xad4d('0x2f')][_0xad4d('0x4e')]({'where':{'id':_0x2ec8be[_0xad4d('0x47')]['id']}})[_0xad4d('0x29')](handleEntityNotFound(_0x3ecd1d,null))[_0xad4d('0x29')](removeEntity(_0x3ecd1d,null))[_0xad4d('0x45')](handleError(_0x3ecd1d,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 6a5424f..84dcb88 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 _0x9b93=['request-promise','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','api','moment'];(function(_0x34dd3c,_0x12616c){var _0x19beab=function(_0x327c96){while(--_0x327c96){_0x34dd3c['push'](_0x34dd3c['shift']());}};_0x19beab(++_0x12616c);}(_0x9b93,0xe7));var _0x39b9=function(_0x58ee61,_0x41f78f){_0x58ee61=_0x58ee61-0x0;var _0x1b8825=_0x9b93[_0x58ee61];return _0x1b8825;};'use strict';var _=require(_0x39b9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x39b9('0x1'));var moment=require(_0x39b9('0x2'));var BPromise=require('bluebird');var rp=require(_0x39b9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x39b9('0x4'));var attributes=require(_0x39b9('0x5'));module[_0x39b9('0x6')]=function(_0x3c7cd1,_0x591551){return _0x3c7cd1[_0x39b9('0x7')](_0x39b9('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa331=['bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','../../config/logger','api','moment'];(function(_0x172c22,_0x15b51c){var _0x234d81=function(_0x2aaa15){while(--_0x2aaa15){_0x172c22['push'](_0x172c22['shift']());}};_0x234d81(++_0x15b51c);}(_0xa331,0x128));var _0x1a33=function(_0x16b594,_0x31bd9e){_0x16b594=_0x16b594-0x0;var _0x95e164=_0xa331[_0x16b594];return _0x95e164;};'use strict';var _=require(_0x1a33('0x0'));var util=require('util');var logger=require(_0x1a33('0x1'))(_0x1a33('0x2'));var moment=require(_0x1a33('0x3'));var BPromise=require(_0x1a33('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a33('0x5'));var rimraf=require(_0x1a33('0x6'));var config=require(_0x1a33('0x7'));var attributes=require(_0x1a33('0x8'));module[_0x1a33('0x9')]=function(_0x5c24ad,_0x4c81ff){return _0x5c24ad[_0x1a33('0xa')]('MailServerOut',attributes,{'tableName':_0x1a33('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 98c709f..bafc755 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0xadb5,0xad));var _0x5adb=function(_0x42aa46,_0x1d286){_0x42aa46=_0x42aa46-0x0;var _0x50beb6=_0xadb5[_0x42aa46];return _0x50beb6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0xadb5,0xad));var _0x5adb=function(_0x248311,_0x209b94){_0x248311=_0x248311-0x0;var _0x3b14b3=_0xadb5[_0x248311];return _0x3b14b3;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7284e7d..8abdb66 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 _0x9afd=['post','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9afd,0x11f));var _0xd9af=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x9afd[_0x2cef86];return _0x46dfd6;};'use strict';var multer=require(_0xd9af('0x0'));var util=require('util');var path=require(_0xd9af('0x1'));var timeout=require('connect-timeout');var express=require(_0xd9af('0x2'));var router=express['Router']();var fs_extra=require(_0xd9af('0x3'));var auth=require(_0xd9af('0x4'));var interaction=require(_0xd9af('0x5'));var config=require(_0xd9af('0x6'));var controller=require(_0xd9af('0x7'));router[_0xd9af('0x8')]('/',auth[_0xd9af('0x9')](),controller['index']);router['get'](_0xd9af('0xa'),auth['isAuthenticated'](),controller[_0xd9af('0xb')]);router[_0xd9af('0x8')]('/:id',auth[_0xd9af('0x9')](),controller[_0xd9af('0xc')]);router[_0xd9af('0xd')]('/',auth[_0xd9af('0x9')](),controller['create']);router[_0xd9af('0xe')](_0xd9af('0xf'),auth[_0xd9af('0x9')](),controller[_0xd9af('0x10')]);router[_0xd9af('0x11')]('/:id',auth[_0xd9af('0x9')](),controller[_0xd9af('0x12')]);module[_0xd9af('0x13')]=router; \ No newline at end of file +var _0x0214=['index','get','describe','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0x0214,0xd2));var _0x4021=function(_0x231068,_0x5bbe87){_0x231068=_0x231068-0x0;var _0x13aa8b=_0x0214[_0x231068];return _0x13aa8b;};'use strict';var multer=require(_0x4021('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4021('0x1'));var router=express[_0x4021('0x2')]();var fs_extra=require(_0x4021('0x3'));var auth=require(_0x4021('0x4'));var interaction=require(_0x4021('0x5'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4021('0x6')]);router[_0x4021('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4021('0x8')]);router[_0x4021('0x7')](_0x4021('0x9'),auth['isAuthenticated'](),controller[_0x4021('0xa')]);router[_0x4021('0xb')]('/',auth[_0x4021('0xc')](),controller[_0x4021('0xd')]);router['put'](_0x4021('0x9'),auth['isAuthenticated'](),controller[_0x4021('0xe')]);router[_0x4021('0xf')](_0x4021('0x9'),auth[_0x4021('0xc')](),controller[_0x4021('0x10')]);module[_0x4021('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4111fb6..e6c1946 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 _0x6f44=['name','STRING','sequelize','exports'];(function(_0x2b6a9d,_0x1da7e6){var _0x35203e=function(_0x3353dc){while(--_0x3353dc){_0x2b6a9d['push'](_0x2b6a9d['shift']());}};_0x35203e(++_0x1da7e6);}(_0x6f44,0x1ea));var _0x46f4=function(_0x4808be,_0xcd6ce9){_0x4808be=_0x4808be-0x0;var _0x3776bd=_0x6f44[_0x4808be];return _0x3776bd;};'use strict';var Sequelize=require(_0x46f4('0x0'));module[_0x46f4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x46f4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x46f4('0x3')]}}; \ No newline at end of file +var _0x1670=['name','sequelize','exports'];(function(_0xb8f65,_0x5b3d4f){var _0x537221=function(_0x157d70){while(--_0x157d70){_0xb8f65['push'](_0xb8f65['shift']());}};_0x537221(++_0x5b3d4f);}(_0x1670,0x9a));var _0x0167=function(_0x4286ad,_0x5a99ed){_0x4286ad=_0x4286ad-0x0;var _0x4382d3=_0x1670[_0x4286ad];return _0x4382d3;};'use strict';var Sequelize=require(_0x0167('0x0'));module[_0x0167('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0167('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index b436e92..ebfd550 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 _0x3661=['sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','MailSubstatus','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x35975e,_0x3ba999){var _0x2d3a5d=function(_0x59a63d){while(--_0x59a63d){_0x35975e['push'](_0x35975e['shift']());}};_0x2d3a5d(++_0x3ba999);}(_0x3661,0x138));var _0x1366=function(_0x216464,_0x5e94a6){_0x216464=_0x216464-0x0;var _0x106df6=_0x3661[_0x216464];return _0x106df6;};'use strict';var emlformat=require(_0x1366('0x0'));var rimraf=require(_0x1366('0x1'));var zipdir=require(_0x1366('0x2'));var jsonpatch=require(_0x1366('0x3'));var rp=require('request-promise');var moment=require(_0x1366('0x4'));var BPromise=require(_0x1366('0x5'));var Mustache=require(_0x1366('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1366('0x7'));var csv=require(_0x1366('0x8'));var ejs=require(_0x1366('0x9'));var fs=require('fs');var fs_extra=require(_0x1366('0xa'));var _=require(_0x1366('0xb'));var squel=require(_0x1366('0xc'));var crypto=require(_0x1366('0xd'));var jsforce=require(_0x1366('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1366('0x8'));var querystring=require(_0x1366('0xf'));var Papa=require(_0x1366('0x10'));var Redis=require('ioredis');var authService=require(_0x1366('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1366('0x12'));var hardwareService=require(_0x1366('0x13'));var logger=require(_0x1366('0x14'))(_0x1366('0x15'));var utils=require('../../config/utils');var config=require(_0x1366('0x16'));var licenseUtil=require(_0x1366('0x17'));var db=require(_0x1366('0x18'))['db'];function respondWithStatusCode(_0xac0082,_0x3c880a){_0x3c880a=_0x3c880a||0xcc;return function(_0xc5e401){if(_0xc5e401){return _0xac0082[_0x1366('0x19')](_0x3c880a);}return _0xac0082[_0x1366('0x1a')](_0x3c880a)[_0x1366('0x1b')]();};}function respondWithResult(_0x4cf00e,_0x16d5bf){_0x16d5bf=_0x16d5bf||0xc8;return function(_0x128de2){if(_0x128de2){return _0x4cf00e[_0x1366('0x1a')](_0x16d5bf)['json'](_0x128de2);}};}function respondWithFilteredResult(_0x2abad9,_0x19cf4a){return function(_0x4d0b8a){if(_0x4d0b8a){var _0x25f3d8=typeof _0x19cf4a[_0x1366('0x1c')]===_0x1366('0x1d')&&typeof _0x19cf4a[_0x1366('0x1e')]==='undefined';var _0x61aeac=_0x4d0b8a[_0x1366('0x1f')];var _0x3065bb=_0x25f3d8?0x0:_0x19cf4a[_0x1366('0x1c')];var _0x115d24=_0x25f3d8?_0x4d0b8a[_0x1366('0x1f')]:_0x19cf4a['offset']+_0x19cf4a[_0x1366('0x1e')];var _0x523b5e;if(_0x115d24>=_0x61aeac){_0x115d24=_0x61aeac;_0x523b5e=0xc8;}else{_0x523b5e=0xce;}_0x2abad9[_0x1366('0x1a')](_0x523b5e);return _0x2abad9[_0x1366('0x20')]('Content-Range',_0x3065bb+'-'+_0x115d24+'/'+_0x61aeac)['json'](_0x4d0b8a);}return null;};}function patchUpdates(_0x54fc92){return function(_0x4c4128){try{jsonpatch[_0x1366('0x21')](_0x4c4128,_0x54fc92,!![]);}catch(_0x247d14){return BPromise[_0x1366('0x22')](_0x247d14);}return _0x4c4128['save']();};}function saveUpdates(_0x53aa98,_0x3cb50){return function(_0x52c1af){if(_0x52c1af){return _0x52c1af[_0x1366('0x23')](_0x53aa98)[_0x1366('0x24')](function(_0x5ebe66){return _0x5ebe66;});}return null;};}function removeEntity(_0x24fb0a,_0xee1edb){return function(_0x3c3212){if(_0x3c3212){return _0x3c3212[_0x1366('0x25')]()['then'](function(){_0x24fb0a['status'](0xcc)[_0x1366('0x1b')]();});}};}function handleEntityNotFound(_0x276776,_0x21ccea){return function(_0x103a0c){if(!_0x103a0c){_0x276776[_0x1366('0x19')](0x194);}return _0x103a0c;};}function handleError(_0x1f5a06,_0x5d06d9){_0x5d06d9=_0x5d06d9||0x1f4;return function(_0x49a26e){logger[_0x1366('0x26')](_0x49a26e[_0x1366('0x27')]);if(_0x49a26e[_0x1366('0x28')]){delete _0x49a26e[_0x1366('0x28')];}_0x1f5a06[_0x1366('0x1a')](_0x5d06d9)['send'](_0x49a26e);};}exports[_0x1366('0x29')]=function(_0x23e18e,_0x451277){var _0x59891d={},_0x25ab09={},_0xb10bbf={'count':0x0,'rows':[]};var _0x18fa53=_[_0x1366('0x2a')](db[_0x1366('0x2b')]['rawAttributes'],function(_0x397412){return{'name':_0x397412['fieldName'],'type':_0x397412[_0x1366('0x2c')]['key']};});_0x25ab09[_0x1366('0x2d')]=_[_0x1366('0x2a')](_0x18fa53,_0x1366('0x28'));_0x25ab09[_0x1366('0x2e')]=_['keys'](_0x23e18e[_0x1366('0x2e')]);_0x25ab09[_0x1366('0x2f')]=_[_0x1366('0x30')](_0x25ab09[_0x1366('0x2d')],_0x25ab09[_0x1366('0x2e')]);_0x59891d['attributes']=_[_0x1366('0x30')](_0x25ab09['model'],qs[_0x1366('0x31')](_0x23e18e[_0x1366('0x2e')]['fields']));_0x59891d[_0x1366('0x32')]=_0x59891d[_0x1366('0x32')]['length']?_0x59891d[_0x1366('0x32')]:_0x25ab09[_0x1366('0x2d')];if(!_0x23e18e[_0x1366('0x2e')][_0x1366('0x33')](_0x1366('0x34'))){_0x59891d[_0x1366('0x1e')]=qs[_0x1366('0x1e')](_0x23e18e[_0x1366('0x2e')][_0x1366('0x1e')]);_0x59891d[_0x1366('0x1c')]=qs['offset'](_0x23e18e['query'][_0x1366('0x1c')]);}_0x59891d['order']=qs[_0x1366('0x35')](_0x23e18e[_0x1366('0x2e')][_0x1366('0x35')]);_0x59891d[_0x1366('0x36')]=qs[_0x1366('0x2f')](_[_0x1366('0x37')](_0x23e18e[_0x1366('0x2e')],_0x25ab09[_0x1366('0x2f')]),_0x18fa53);if(_0x23e18e[_0x1366('0x2e')][_0x1366('0x38')]){_0x59891d['where']=_[_0x1366('0x39')](_0x59891d[_0x1366('0x36')],{'$or':_[_0x1366('0x2a')](_0x18fa53,function(_0x4900af){if(_0x4900af[_0x1366('0x2c')]!==_0x1366('0x3a')){var _0xc5bd52={};_0xc5bd52[_0x4900af[_0x1366('0x28')]]={'$like':'%'+_0x23e18e[_0x1366('0x2e')][_0x1366('0x38')]+'%'};return _0xc5bd52;}})});}_0x59891d=_[_0x1366('0x39')]({},_0x59891d,_0x23e18e[_0x1366('0x3b')]);var _0x5f24fc={'where':_0x59891d['where']};return db[_0x1366('0x2b')][_0x1366('0x1f')](_0x5f24fc)[_0x1366('0x24')](function(_0x59c3c8){_0xb10bbf[_0x1366('0x1f')]=_0x59c3c8;if(_0x23e18e['query']['includeAll']){_0x59891d[_0x1366('0x3c')]=[{'all':!![]}];}return db[_0x1366('0x2b')][_0x1366('0x3d')](_0x59891d);})['then'](function(_0x138e59){_0xb10bbf[_0x1366('0x3e')]=_0x138e59;return _0xb10bbf;})[_0x1366('0x24')](respondWithFilteredResult(_0x451277,_0x59891d))[_0x1366('0x3f')](handleError(_0x451277,null));};exports['show']=function(_0x22fb74,_0x1eefd5){var _0x53c533={'raw':!![],'where':{'id':_0x22fb74[_0x1366('0x40')]['id']}},_0x447f5a={};_0x447f5a[_0x1366('0x2d')]=_[_0x1366('0x41')](db[_0x1366('0x2b')][_0x1366('0x42')]);_0x447f5a[_0x1366('0x2e')]=_[_0x1366('0x41')](_0x22fb74[_0x1366('0x2e')]);_0x447f5a['filters']=_[_0x1366('0x30')](_0x447f5a['model'],_0x447f5a['query']);_0x53c533[_0x1366('0x32')]=_['intersection'](_0x447f5a[_0x1366('0x2d')],qs[_0x1366('0x31')](_0x22fb74[_0x1366('0x2e')][_0x1366('0x31')]));_0x53c533[_0x1366('0x32')]=_0x53c533[_0x1366('0x32')][_0x1366('0x43')]?_0x53c533[_0x1366('0x32')]:_0x447f5a['model'];if(_0x22fb74[_0x1366('0x2e')][_0x1366('0x44')]){_0x53c533['include']=[{'all':!![]}];}_0x53c533=_[_0x1366('0x39')]({},_0x53c533,_0x22fb74[_0x1366('0x3b')]);return db[_0x1366('0x2b')][_0x1366('0x45')](_0x53c533)[_0x1366('0x24')](handleEntityNotFound(_0x1eefd5,null))[_0x1366('0x24')](respondWithResult(_0x1eefd5,null))[_0x1366('0x3f')](handleError(_0x1eefd5,null));};exports['create']=function(_0x353846,_0x55f649){return db[_0x1366('0x2b')][_0x1366('0x46')](_0x353846['body'],{})[_0x1366('0x24')](respondWithResult(_0x55f649,0xc9))['catch'](handleError(_0x55f649,null));};exports[_0x1366('0x23')]=function(_0x1aaa5d,_0x13a0d0){if(_0x1aaa5d[_0x1366('0x47')]['id']){delete _0x1aaa5d[_0x1366('0x47')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x1aaa5d[_0x1366('0x40')]['id']}})[_0x1366('0x24')](handleEntityNotFound(_0x13a0d0,null))[_0x1366('0x24')](saveUpdates(_0x1aaa5d[_0x1366('0x47')],null))['then'](respondWithResult(_0x13a0d0,null))[_0x1366('0x3f')](handleError(_0x13a0d0,null));};exports[_0x1366('0x25')]=function(_0x5cea79,_0x3cae6c){return db[_0x1366('0x2b')][_0x1366('0x45')]({'where':{'id':_0x5cea79['params']['id']}})[_0x1366('0x24')](handleEntityNotFound(_0x3cae6c,null))[_0x1366('0x24')](removeEntity(_0x3cae6c,null))[_0x1366('0x3f')](handleError(_0x3cae6c,null));};exports[_0x1366('0x48')]=function(_0x37c8d7,_0x5f234e){return db[_0x1366('0x2b')][_0x1366('0x48')]()[_0x1366('0x24')](respondWithResult(_0x5f234e,null))[_0x1366('0x3f')](handleError(_0x5f234e,null));}; \ No newline at end of file +var _0x1047=['type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName'];(function(_0x1c1e03,_0x2dfc3d){var _0x2976e4=function(_0x24fac7){while(--_0x24fac7){_0x1c1e03['push'](_0x1c1e03['shift']());}};_0x2976e4(++_0x2dfc3d);}(_0x1047,0x1de));var _0x7104=function(_0x48c6df,_0x32b1ac){_0x48c6df=_0x48c6df-0x0;var _0x219502=_0x1047[_0x48c6df];return _0x219502;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7104('0x0'));var zipdir=require(_0x7104('0x1'));var jsonpatch=require(_0x7104('0x2'));var rp=require(_0x7104('0x3'));var moment=require(_0x7104('0x4'));var BPromise=require(_0x7104('0x5'));var Mustache=require(_0x7104('0x6'));var util=require(_0x7104('0x7'));var path=require(_0x7104('0x8'));var sox=require(_0x7104('0x9'));var csv=require('to-csv');var ejs=require(_0x7104('0xa'));var fs=require('fs');var fs_extra=require(_0x7104('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7104('0xc'));var jsforce=require(_0x7104('0xd'));var deskjs=require(_0x7104('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7104('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7104('0x10'));var qs=require(_0x7104('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7104('0x12'));var logger=require('../../config/logger')(_0x7104('0x13'));var utils=require(_0x7104('0x14'));var config=require(_0x7104('0x15'));var licenseUtil=require(_0x7104('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122824,_0x76b933){_0x76b933=_0x76b933||0xcc;return function(_0x4aa6b5){if(_0x4aa6b5){return _0x122824[_0x7104('0x17')](_0x76b933);}return _0x122824[_0x7104('0x18')](_0x76b933)['end']();};}function respondWithResult(_0x465df8,_0x1c0246){_0x1c0246=_0x1c0246||0xc8;return function(_0x9dddc8){if(_0x9dddc8){return _0x465df8[_0x7104('0x18')](_0x1c0246)[_0x7104('0x19')](_0x9dddc8);}};}function respondWithFilteredResult(_0x548bad,_0x1da43c){return function(_0x426c9c){if(_0x426c9c){var _0x4fe891=typeof _0x1da43c[_0x7104('0x1a')]==='undefined'&&typeof _0x1da43c[_0x7104('0x1b')]===_0x7104('0x1c');var _0xe7f333=_0x426c9c[_0x7104('0x1d')];var _0x3f7756=_0x4fe891?0x0:_0x1da43c[_0x7104('0x1a')];var _0x44be5d=_0x4fe891?_0x426c9c[_0x7104('0x1d')]:_0x1da43c[_0x7104('0x1a')]+_0x1da43c[_0x7104('0x1b')];var _0x296285;if(_0x44be5d>=_0xe7f333){_0x44be5d=_0xe7f333;_0x296285=0xc8;}else{_0x296285=0xce;}_0x548bad[_0x7104('0x18')](_0x296285);return _0x548bad[_0x7104('0x1e')](_0x7104('0x1f'),_0x3f7756+'-'+_0x44be5d+'/'+_0xe7f333)['json'](_0x426c9c);}return null;};}function patchUpdates(_0x40f1d3){return function(_0x135eac){try{jsonpatch[_0x7104('0x20')](_0x135eac,_0x40f1d3,!![]);}catch(_0x5749c2){return BPromise[_0x7104('0x21')](_0x5749c2);}return _0x135eac[_0x7104('0x22')]();};}function saveUpdates(_0x413b45,_0x3e6504){return function(_0x188f7d){if(_0x188f7d){return _0x188f7d['update'](_0x413b45)[_0x7104('0x23')](function(_0x3effab){return _0x3effab;});}return null;};}function removeEntity(_0x5243e5,_0x5aea5c){return function(_0xff706){if(_0xff706){return _0xff706[_0x7104('0x24')]()[_0x7104('0x23')](function(){_0x5243e5[_0x7104('0x18')](0xcc)[_0x7104('0x25')]();});}};}function handleEntityNotFound(_0x5ca39f,_0x3af57f){return function(_0x3d8424){if(!_0x3d8424){_0x5ca39f[_0x7104('0x17')](0x194);}return _0x3d8424;};}function handleError(_0xc4bd28,_0x591fd5){_0x591fd5=_0x591fd5||0x1f4;return function(_0x5494f5){logger[_0x7104('0x26')](_0x5494f5[_0x7104('0x27')]);if(_0x5494f5['name']){delete _0x5494f5[_0x7104('0x28')];}_0xc4bd28['status'](_0x591fd5)[_0x7104('0x29')](_0x5494f5);};}exports[_0x7104('0x2a')]=function(_0x55c52b,_0x2d1c68){var _0x1b1758={},_0x3b81d0={},_0x385708={'count':0x0,'rows':[]};var _0x27e4de=_[_0x7104('0x2b')](db[_0x7104('0x2c')][_0x7104('0x2d')],function(_0xf4ee24){return{'name':_0xf4ee24[_0x7104('0x2e')],'type':_0xf4ee24[_0x7104('0x2f')][_0x7104('0x30')]};});_0x3b81d0[_0x7104('0x31')]=_[_0x7104('0x2b')](_0x27e4de,_0x7104('0x28'));_0x3b81d0[_0x7104('0x32')]=_[_0x7104('0x33')](_0x55c52b[_0x7104('0x32')]);_0x3b81d0[_0x7104('0x34')]=_[_0x7104('0x35')](_0x3b81d0[_0x7104('0x31')],_0x3b81d0[_0x7104('0x32')]);_0x1b1758['attributes']=_['intersection'](_0x3b81d0['model'],qs[_0x7104('0x36')](_0x55c52b['query'][_0x7104('0x36')]));_0x1b1758[_0x7104('0x37')]=_0x1b1758[_0x7104('0x37')][_0x7104('0x38')]?_0x1b1758[_0x7104('0x37')]:_0x3b81d0[_0x7104('0x31')];if(!_0x55c52b[_0x7104('0x32')]['hasOwnProperty'](_0x7104('0x39'))){_0x1b1758['limit']=qs[_0x7104('0x1b')](_0x55c52b[_0x7104('0x32')]['limit']);_0x1b1758[_0x7104('0x1a')]=qs[_0x7104('0x1a')](_0x55c52b[_0x7104('0x32')][_0x7104('0x1a')]);}_0x1b1758[_0x7104('0x3a')]=qs[_0x7104('0x3b')](_0x55c52b[_0x7104('0x32')]['sort']);_0x1b1758[_0x7104('0x3c')]=qs[_0x7104('0x34')](_[_0x7104('0x3d')](_0x55c52b[_0x7104('0x32')],_0x3b81d0[_0x7104('0x34')]),_0x27e4de);if(_0x55c52b[_0x7104('0x32')][_0x7104('0x3e')]){_0x1b1758[_0x7104('0x3c')]=_[_0x7104('0x3f')](_0x1b1758[_0x7104('0x3c')],{'$or':_[_0x7104('0x2b')](_0x27e4de,function(_0x17b726){if(_0x17b726['type']!==_0x7104('0x40')){var _0xaa8d15={};_0xaa8d15[_0x17b726[_0x7104('0x28')]]={'$like':'%'+_0x55c52b[_0x7104('0x32')][_0x7104('0x3e')]+'%'};return _0xaa8d15;}})});}_0x1b1758=_[_0x7104('0x3f')]({},_0x1b1758,_0x55c52b['options']);var _0x30103d={'where':_0x1b1758[_0x7104('0x3c')]};return db['MailSubstatus'][_0x7104('0x1d')](_0x30103d)[_0x7104('0x23')](function(_0x3b3d40){_0x385708[_0x7104('0x1d')]=_0x3b3d40;if(_0x55c52b[_0x7104('0x32')][_0x7104('0x41')]){_0x1b1758[_0x7104('0x42')]=[{'all':!![]}];}return db[_0x7104('0x2c')]['findAll'](_0x1b1758);})['then'](function(_0x2fdcf4){_0x385708[_0x7104('0x43')]=_0x2fdcf4;return _0x385708;})[_0x7104('0x23')](respondWithFilteredResult(_0x2d1c68,_0x1b1758))[_0x7104('0x44')](handleError(_0x2d1c68,null));};exports[_0x7104('0x45')]=function(_0xc756b6,_0x200284){var _0xbfff47={'raw':!![],'where':{'id':_0xc756b6[_0x7104('0x46')]['id']}},_0x40c474={};_0x40c474[_0x7104('0x31')]=_[_0x7104('0x33')](db['MailSubstatus']['rawAttributes']);_0x40c474[_0x7104('0x32')]=_[_0x7104('0x33')](_0xc756b6['query']);_0x40c474['filters']=_[_0x7104('0x35')](_0x40c474[_0x7104('0x31')],_0x40c474[_0x7104('0x32')]);_0xbfff47[_0x7104('0x37')]=_[_0x7104('0x35')](_0x40c474[_0x7104('0x31')],qs[_0x7104('0x36')](_0xc756b6[_0x7104('0x32')][_0x7104('0x36')]));_0xbfff47[_0x7104('0x37')]=_0xbfff47[_0x7104('0x37')]['length']?_0xbfff47[_0x7104('0x37')]:_0x40c474[_0x7104('0x31')];if(_0xc756b6[_0x7104('0x32')][_0x7104('0x41')]){_0xbfff47[_0x7104('0x42')]=[{'all':!![]}];}_0xbfff47=_['merge']({},_0xbfff47,_0xc756b6['options']);return db[_0x7104('0x2c')][_0x7104('0x47')](_0xbfff47)['then'](handleEntityNotFound(_0x200284,null))[_0x7104('0x23')](respondWithResult(_0x200284,null))[_0x7104('0x44')](handleError(_0x200284,null));};exports[_0x7104('0x48')]=function(_0x193e62,_0x10543b){return db[_0x7104('0x2c')]['create'](_0x193e62[_0x7104('0x49')],{})['then'](respondWithResult(_0x10543b,0xc9))[_0x7104('0x44')](handleError(_0x10543b,null));};exports['update']=function(_0x42d0e8,_0x32bf42){if(_0x42d0e8[_0x7104('0x49')]['id']){delete _0x42d0e8[_0x7104('0x49')]['id'];}return db[_0x7104('0x2c')][_0x7104('0x47')]({'where':{'id':_0x42d0e8['params']['id']}})[_0x7104('0x23')](handleEntityNotFound(_0x32bf42,null))[_0x7104('0x23')](saveUpdates(_0x42d0e8[_0x7104('0x49')],null))['then'](respondWithResult(_0x32bf42,null))[_0x7104('0x44')](handleError(_0x32bf42,null));};exports[_0x7104('0x24')]=function(_0x2343ea,_0x13436a){return db['MailSubstatus'][_0x7104('0x47')]({'where':{'id':_0x2343ea[_0x7104('0x46')]['id']}})[_0x7104('0x23')](handleEntityNotFound(_0x13436a,null))[_0x7104('0x23')](removeEntity(_0x13436a,null))['catch'](handleError(_0x13436a,null));};exports['describe']=function(_0x4ee5f1,_0x6adda){return db[_0x7104('0x2c')][_0x7104('0x4a')]()[_0x7104('0x23')](respondWithResult(_0x6adda,null))['catch'](handleError(_0x6adda,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 06a19b9..5655264 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 _0x5b4d=['hasOwnProperty','hook','events','../../mysqldb','update','emit'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5b4d,0x1d6));var _0xd5b4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5b4d[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xd5b4('0x0'));var MailSubstatus=require(_0xd5b4('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xd5b4('0x2')};function emitEvent(_0xbe0df1){return function(_0x546a8e,_0x1f1708,_0x5805fe){MailSubstatusEvents[_0xd5b4('0x3')](_0xbe0df1+':'+_0x546a8e['id'],_0x546a8e);MailSubstatusEvents[_0xd5b4('0x3')](_0xbe0df1,_0x546a8e);_0x5805fe(null);};}for(var e in events){if(events[_0xd5b4('0x4')](e)){var event=events[e];MailSubstatus[_0xd5b4('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x8301=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x157f80,_0x105ced){var _0x12c361=function(_0x51b171){while(--_0x51b171){_0x157f80['push'](_0x157f80['shift']());}};_0x12c361(++_0x105ced);}(_0x8301,0x73));var _0x1830=function(_0x65959d,_0x4dd888){_0x65959d=_0x65959d-0x0;var _0x2d71aa=_0x8301[_0x65959d];return _0x2d71aa;};'use strict';var EventEmitter=require(_0x1830('0x0'));var MailSubstatus=require(_0x1830('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x1830('0x2')](0x0);var events={'afterUpdate':_0x1830('0x3')};function emitEvent(_0x4bdc05){return function(_0x33d5ee,_0x37d7ab,_0x59adee){MailSubstatusEvents['emit'](_0x4bdc05+':'+_0x33d5ee['id'],_0x33d5ee);MailSubstatusEvents[_0x1830('0x4')](_0x4bdc05,_0x33d5ee);_0x59adee(null);};}for(var e in events){if(events[_0x1830('0x5')](e)){var event=events[e];MailSubstatus[_0x1830('0x6')](e,emitEvent(event));}}module[_0x1830('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 37c8d78..0b34eac 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 _0x13c4=['mailSubstatus','_previousDataValues','catch','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name'];(function(_0x3f3af1,_0x50fdfc){var _0x19cf03=function(_0x5978a2){while(--_0x5978a2){_0x3f3af1['push'](_0x3f3af1['shift']());}};_0x19cf03(++_0x50fdfc);}(_0x13c4,0x121));var _0x413c=function(_0x56dfdb,_0xbef4c0){_0x56dfdb=_0x56dfdb-0x0;var _0xf3f640=_0x13c4[_0x56dfdb];return _0xf3f640;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x413c('0x0')]=function(_0x3eda16){var _0x4ba799=_0x3eda16[_0x413c('0x1')];return _0x3eda16[_0x413c('0x2')](_0x413c('0x3'),attributes,{'tableName':_0x413c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5492e4,_0xd3c2f2,_0x124738){return _0x4ba799[_0x413c('0x5')][_0x413c('0x6')]({'value':_0x5492e4[_0x413c('0x7')]},{'where':{'field':_0x413c('0x8'),'value':_0x5492e4[_0x413c('0x9')][_0x413c('0x7')]}})['then'](function(){_0x124738();})[_0x413c('0xa')](function(_0xcb9cde){_0x124738(_0xcb9cde);});}}});}; \ No newline at end of file +var _0xc6d1=['define','MailSubstatus','mail_substatuses','Condition','update','name','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x3ccac1,_0x5cc7ea){var _0x10b20b=function(_0x4ed4f5){while(--_0x4ed4f5){_0x3ccac1['push'](_0x3ccac1['shift']());}};_0x10b20b(++_0x5cc7ea);}(_0xc6d1,0x97));var _0x1c6d=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xc6d1[_0x4154a6];return _0x3b2786;};'use strict';var attributes=require(_0x1c6d('0x0'));module[_0x1c6d('0x1')]=function(_0x53fe29){var _0x3673d1=_0x53fe29[_0x1c6d('0x2')];return _0x53fe29[_0x1c6d('0x3')](_0x1c6d('0x4'),attributes,{'tableName':_0x1c6d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x560f16,_0xb71b26,_0x194e94){return _0x3673d1[_0x1c6d('0x6')][_0x1c6d('0x7')]({'value':_0x560f16[_0x1c6d('0x8')]},{'where':{'field':'mailSubstatus','value':_0x560f16['_previousDataValues']['name']}})[_0x1c6d('0x9')](function(){_0x194e94();})[_0x1c6d('0xa')](function(_0x4770b2){_0x194e94(_0x4770b2);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 721c207..ff9c365 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 _0x7050=['http','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7050,0x74));var _0x0705=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x7050[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0x0705('0x0'));var util=require(_0x0705('0x1'));var moment=require(_0x0705('0x2'));var BPromise=require(_0x0705('0x3'));var rs=require(_0x0705('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0705('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0705('0x6'))('rpc');var config=require(_0x0705('0x7'));var jayson=require(_0x0705('0x8'));var client=jayson[_0x0705('0x9')][_0x0705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30b0a7,_0x55380f,_0x2ca812){return new BPromise(function(_0x33223c,_0x181fdd){return client['request'](_0x30b0a7,_0x2ca812)['then'](function(_0x1c0713){logger[_0x0705('0xb')](_0x0705('0xc'),_0x55380f,'request\x20sent');logger['debug'](_0x0705('0xd'),_0x55380f,_0x0705('0xe'),JSON['stringify'](_0x1c0713));if(_0x1c0713['error']){if(_0x1c0713[_0x0705('0xf')][_0x0705('0x10')]===0x1f4){logger[_0x0705('0xf')](_0x0705('0xc'),_0x55380f,_0x1c0713[_0x0705('0xf')][_0x0705('0x11')]);return _0x181fdd(_0x1c0713[_0x0705('0xf')]['message']);}logger[_0x0705('0xf')](_0x0705('0xc'),_0x55380f,_0x1c0713[_0x0705('0xf')][_0x0705('0x11')]);return _0x33223c(_0x1c0713['error'][_0x0705('0x11')]);}else{logger[_0x0705('0xb')](_0x0705('0xc'),_0x55380f,_0x0705('0xe'));_0x33223c(_0x1c0713['result'][_0x0705('0x11')]);}})['catch'](function(_0x14ee72){logger[_0x0705('0xf')](_0x0705('0xc'),_0x55380f,_0x14ee72);_0x181fdd(_0x14ee72);});});} \ No newline at end of file +var _0x158a=['stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x2293bb,_0x12da5f){var _0x1fdff6=function(_0x3a82e7){while(--_0x3a82e7){_0x2293bb['push'](_0x2293bb['shift']());}};_0x1fdff6(++_0x12da5f);}(_0x158a,0xd7));var _0xa158=function(_0x1ef7d9,_0x4b3c39){_0x1ef7d9=_0x1ef7d9-0x0;var _0x2c59d9=_0x158a[_0x1ef7d9];return _0x2c59d9;};'use strict';var _=require(_0xa158('0x0'));var util=require('util');var moment=require(_0xa158('0x1'));var BPromise=require(_0xa158('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa158('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa158('0x4'));var logger=require(_0xa158('0x5'))('rpc');var config=require(_0xa158('0x6'));var jayson=require(_0xa158('0x7'));var client=jayson[_0xa158('0x8')][_0xa158('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x469189,_0x81b218,_0x450c13){return new BPromise(function(_0x1a1feb,_0x5c3dfd){return client[_0xa158('0xa')](_0x469189,_0x450c13)[_0xa158('0xb')](function(_0x190535){logger[_0xa158('0xc')](_0xa158('0xd'),_0x81b218,'request\x20sent');logger[_0xa158('0xe')](_0xa158('0xf'),_0x81b218,'request\x20sent',JSON[_0xa158('0x10')](_0x190535));if(_0x190535[_0xa158('0x11')]){if(_0x190535[_0xa158('0x11')][_0xa158('0x12')]===0x1f4){logger[_0xa158('0x11')](_0xa158('0xd'),_0x81b218,_0x190535[_0xa158('0x11')][_0xa158('0x13')]);return _0x5c3dfd(_0x190535[_0xa158('0x11')]['message']);}logger[_0xa158('0x11')](_0xa158('0xd'),_0x81b218,_0x190535[_0xa158('0x11')]['message']);return _0x1a1feb(_0x190535[_0xa158('0x11')][_0xa158('0x13')]);}else{logger[_0xa158('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x81b218,'request\x20sent');_0x1a1feb(_0x190535[_0xa158('0x14')][_0xa158('0x13')]);}})['catch'](function(_0x2b0e06){logger[_0xa158('0x11')](_0xa158('0xd'),_0x81b218,_0x2b0e06);_0x5c3dfd(_0x2b0e06);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index debf84b..35f690e 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 _0x14ca=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','describe','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x14ca,0xb9));var _0xa14c=function(_0xb1ee6d,_0x427b4c){_0xb1ee6d=_0xb1ee6d-0x0;var _0x559dde=_0x14ca[_0xb1ee6d];return _0x559dde;};'use strict';var multer=require(_0xa14c('0x0'));var util=require(_0xa14c('0x1'));var path=require(_0xa14c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa14c('0x3'));var router=express[_0xa14c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa14c('0x5'));var config=require(_0xa14c('0x6'));var controller=require(_0xa14c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa14c('0x8')]);router[_0xa14c('0x9')](_0xa14c('0xa'),auth['isAuthenticated'](),controller[_0xa14c('0xb')]);router[_0xa14c('0x9')]('/:id',auth[_0xa14c('0xc')](),controller[_0xa14c('0xd')]);router[_0xa14c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa14c('0xf')]('/:id',auth[_0xa14c('0xc')](),controller['update']);router[_0xa14c('0x10')]('/:id',auth[_0xa14c('0xc')](),controller[_0xa14c('0x11')]);module[_0xa14c('0x12')]=router; \ No newline at end of file +var _0x21b6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','describe','/:id','show','put','destroy','exports','multer','util','path'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0x21b6,0xd5));var _0x621b=function(_0x41a2ac,_0x2024bc){_0x41a2ac=_0x41a2ac-0x0;var _0x1ac339=_0x21b6[_0x41a2ac];return _0x1ac339;};'use strict';var multer=require(_0x621b('0x0'));var util=require(_0x621b('0x1'));var path=require(_0x621b('0x2'));var timeout=require('connect-timeout');var express=require(_0x621b('0x3'));var router=express[_0x621b('0x4')]();var fs_extra=require(_0x621b('0x5'));var auth=require(_0x621b('0x6'));var interaction=require(_0x621b('0x7'));var config=require(_0x621b('0x8'));var controller=require(_0x621b('0x9'));router[_0x621b('0xa')]('/',auth['isAuthenticated'](),controller[_0x621b('0xb')]);router[_0x621b('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x621b('0xc')]);router[_0x621b('0xa')](_0x621b('0xd'),auth['isAuthenticated'](),controller[_0x621b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x621b('0xf')](_0x621b('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x621b('0x10')]);module[_0x621b('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 65e2e05..ed7cd3c 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3e8e15,_0x2377ec){var _0x1922de=function(_0x1af79d){while(--_0x1af79d){_0x3e8e15['push'](_0x3e8e15['shift']());}};_0x1922de(++_0x2377ec);}(_0x70e0,0x17b));var _0x070e=function(_0x7404a0,_0x34c77f){_0x7404a0=_0x7404a0-0x0;var _0x58680f=_0x70e0[_0x7404a0];return _0x58680f;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x224dc0,_0x8dbcc6){var _0x1a9a44=function(_0x41090f){while(--_0x41090f){_0x224dc0['push'](_0x224dc0['shift']());}};_0x1a9a44(++_0x8dbcc6);}(_0xaa88,0x137));var _0x8aa8=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xaa88[_0x1b2422];return _0x376573;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 4443453..f749cd7 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 _0xf8f5=['merge','VIRTUAL','options','include','MailTransferReport','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf8f5,0xe4));var _0x5f8f=function(_0x34e124,_0x42f2ec){_0x34e124=_0x34e124-0x0;var _0x1e2947=_0xf8f5[_0x34e124];return _0x1e2947;};'use strict';var emlformat=require(_0x5f8f('0x0'));var rimraf=require(_0x5f8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5f8f('0x2'));var BPromise=require(_0x5f8f('0x3'));var Mustache=require(_0x5f8f('0x4'));var util=require(_0x5f8f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5f8f('0x6'));var ejs=require(_0x5f8f('0x7'));var fs=require('fs');var fs_extra=require(_0x5f8f('0x8'));var _=require(_0x5f8f('0x9'));var squel=require(_0x5f8f('0xa'));var crypto=require(_0x5f8f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5f8f('0xc'));var toCsv=require(_0x5f8f('0x6'));var querystring=require(_0x5f8f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f8f('0xe'));var as=require(_0x5f8f('0xf'));var hardwareService=require(_0x5f8f('0x10'));var logger=require(_0x5f8f('0x11'))(_0x5f8f('0x12'));var utils=require(_0x5f8f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5f8f('0x14'));var db=require(_0x5f8f('0x15'))['db'];function respondWithStatusCode(_0x2150a8,_0x3ee2a1){_0x3ee2a1=_0x3ee2a1||0xcc;return function(_0x13c414){if(_0x13c414){return _0x2150a8[_0x5f8f('0x16')](_0x3ee2a1);}return _0x2150a8[_0x5f8f('0x17')](_0x3ee2a1)[_0x5f8f('0x18')]();};}function respondWithResult(_0x5866e2,_0x36316e){_0x36316e=_0x36316e||0xc8;return function(_0x4cbe99){if(_0x4cbe99){return _0x5866e2['status'](_0x36316e)['json'](_0x4cbe99);}};}function respondWithFilteredResult(_0x3580a6,_0x1c1622){return function(_0x5b1dcd){if(_0x5b1dcd){var _0x1071f2=typeof _0x1c1622[_0x5f8f('0x19')]===_0x5f8f('0x1a')&&typeof _0x1c1622[_0x5f8f('0x1b')]==='undefined';var _0x10a0a2=_0x5b1dcd['count'];var _0x596dd2=_0x1071f2?0x0:_0x1c1622[_0x5f8f('0x19')];var _0x848c41=_0x1071f2?_0x5b1dcd[_0x5f8f('0x1c')]:_0x1c1622[_0x5f8f('0x19')]+_0x1c1622[_0x5f8f('0x1b')];var _0x45a666;if(_0x848c41>=_0x10a0a2){_0x848c41=_0x10a0a2;_0x45a666=0xc8;}else{_0x45a666=0xce;}_0x3580a6[_0x5f8f('0x17')](_0x45a666);return _0x3580a6['set'](_0x5f8f('0x1d'),_0x596dd2+'-'+_0x848c41+'/'+_0x10a0a2)['json'](_0x5b1dcd);}return null;};}function patchUpdates(_0x21a555){return function(_0x141926){try{jsonpatch['apply'](_0x141926,_0x21a555,!![]);}catch(_0x803d38){return BPromise[_0x5f8f('0x1e')](_0x803d38);}return _0x141926[_0x5f8f('0x1f')]();};}function saveUpdates(_0x17b195,_0x22ba0e){return function(_0x71c65f){if(_0x71c65f){return _0x71c65f['update'](_0x17b195)[_0x5f8f('0x20')](function(_0x858078){return _0x858078;});}return null;};}function removeEntity(_0x386879,_0x484595){return function(_0x52f10f){if(_0x52f10f){return _0x52f10f['destroy']()[_0x5f8f('0x20')](function(){_0x386879[_0x5f8f('0x17')](0xcc)[_0x5f8f('0x18')]();});}};}function handleEntityNotFound(_0x1164f2,_0x437ff0){return function(_0xf065a){if(!_0xf065a){_0x1164f2[_0x5f8f('0x16')](0x194);}return _0xf065a;};}function handleError(_0x22a2b0,_0x250a75){_0x250a75=_0x250a75||0x1f4;return function(_0x39487a){logger[_0x5f8f('0x21')](_0x39487a[_0x5f8f('0x22')]);if(_0x39487a[_0x5f8f('0x23')]){delete _0x39487a[_0x5f8f('0x23')];}_0x22a2b0[_0x5f8f('0x17')](_0x250a75)[_0x5f8f('0x24')](_0x39487a);};}exports[_0x5f8f('0x25')]=function(_0x4a9ffa,_0x51076d){var _0x693d43={},_0xe6532e={},_0x29ab7c={'count':0x0,'rows':[]};var _0x5e28f7=_[_0x5f8f('0x26')](db['MailTransferReport']['rawAttributes'],function(_0x53ac43){return{'name':_0x53ac43[_0x5f8f('0x27')],'type':_0x53ac43[_0x5f8f('0x28')][_0x5f8f('0x29')]};});_0xe6532e[_0x5f8f('0x2a')]=_[_0x5f8f('0x26')](_0x5e28f7,_0x5f8f('0x23'));_0xe6532e['query']=_[_0x5f8f('0x2b')](_0x4a9ffa['query']);_0xe6532e[_0x5f8f('0x2c')]=_[_0x5f8f('0x2d')](_0xe6532e['model'],_0xe6532e['query']);_0x693d43[_0x5f8f('0x2e')]=_[_0x5f8f('0x2d')](_0xe6532e[_0x5f8f('0x2a')],qs['fields'](_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x30')]));_0x693d43[_0x5f8f('0x2e')]=_0x693d43[_0x5f8f('0x2e')][_0x5f8f('0x31')]?_0x693d43[_0x5f8f('0x2e')]:_0xe6532e['model'];if(!_0x4a9ffa[_0x5f8f('0x2f')]['hasOwnProperty'](_0x5f8f('0x32'))){_0x693d43[_0x5f8f('0x1b')]=qs[_0x5f8f('0x1b')](_0x4a9ffa[_0x5f8f('0x2f')]['limit']);_0x693d43[_0x5f8f('0x19')]=qs[_0x5f8f('0x19')](_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x19')]);}_0x693d43[_0x5f8f('0x33')]=qs[_0x5f8f('0x34')](_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x34')]);_0x693d43[_0x5f8f('0x35')]=qs[_0x5f8f('0x2c')](_[_0x5f8f('0x36')](_0x4a9ffa['query'],_0xe6532e[_0x5f8f('0x2c')]),_0x5e28f7);if(_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x37')]){_0x693d43[_0x5f8f('0x35')]=_[_0x5f8f('0x38')](_0x693d43['where'],{'$or':_[_0x5f8f('0x26')](_0x5e28f7,function(_0x35191e){if(_0x35191e['type']!==_0x5f8f('0x39')){var _0x8656f7={};_0x8656f7[_0x35191e[_0x5f8f('0x23')]]={'$like':'%'+_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x37')]+'%'};return _0x8656f7;}})});}_0x693d43=_[_0x5f8f('0x38')]({},_0x693d43,_0x4a9ffa[_0x5f8f('0x3a')]);var _0x40425f={'where':_0x693d43['where']};return db['MailTransferReport'][_0x5f8f('0x1c')](_0x40425f)[_0x5f8f('0x20')](function(_0x141367){_0x29ab7c[_0x5f8f('0x1c')]=_0x141367;if(_0x4a9ffa[_0x5f8f('0x2f')]['includeAll']){_0x693d43[_0x5f8f('0x3b')]=[{'all':!![]}];}return db[_0x5f8f('0x3c')]['findAll'](_0x693d43);})['then'](function(_0x314f77){_0x29ab7c['rows']=_0x314f77;return _0x29ab7c;})[_0x5f8f('0x20')](respondWithFilteredResult(_0x51076d,_0x693d43))[_0x5f8f('0x3d')](handleError(_0x51076d,null));};exports[_0x5f8f('0x3e')]=function(_0x377abe,_0x26bacc){var _0x219bea={'raw':!![],'where':{'id':_0x377abe[_0x5f8f('0x3f')]['id']}},_0x4d0f0d={};_0x4d0f0d['model']=_[_0x5f8f('0x2b')](db[_0x5f8f('0x3c')][_0x5f8f('0x40')]);_0x4d0f0d['query']=_[_0x5f8f('0x2b')](_0x377abe[_0x5f8f('0x2f')]);_0x4d0f0d[_0x5f8f('0x2c')]=_['intersection'](_0x4d0f0d[_0x5f8f('0x2a')],_0x4d0f0d[_0x5f8f('0x2f')]);_0x219bea[_0x5f8f('0x2e')]=_[_0x5f8f('0x2d')](_0x4d0f0d['model'],qs[_0x5f8f('0x30')](_0x377abe[_0x5f8f('0x2f')]['fields']));_0x219bea[_0x5f8f('0x2e')]=_0x219bea[_0x5f8f('0x2e')][_0x5f8f('0x31')]?_0x219bea[_0x5f8f('0x2e')]:_0x4d0f0d[_0x5f8f('0x2a')];if(_0x377abe[_0x5f8f('0x2f')]['includeAll']){_0x219bea['include']=[{'all':!![]}];}_0x219bea=_['merge']({},_0x219bea,_0x377abe[_0x5f8f('0x3a')]);return db[_0x5f8f('0x3c')][_0x5f8f('0x41')](_0x219bea)[_0x5f8f('0x20')](handleEntityNotFound(_0x26bacc,null))[_0x5f8f('0x20')](respondWithResult(_0x26bacc,null))[_0x5f8f('0x3d')](handleError(_0x26bacc,null));};exports[_0x5f8f('0x42')]=function(_0x5de397,_0x1bbbc){return db['MailTransferReport']['create'](_0x5de397[_0x5f8f('0x43')],{})[_0x5f8f('0x20')](respondWithResult(_0x1bbbc,0xc9))['catch'](handleError(_0x1bbbc,null));};exports[_0x5f8f('0x44')]=function(_0x5d2f17,_0x22495a){if(_0x5d2f17[_0x5f8f('0x43')]['id']){delete _0x5d2f17['body']['id'];}return db['MailTransferReport'][_0x5f8f('0x41')]({'where':{'id':_0x5d2f17[_0x5f8f('0x3f')]['id']}})[_0x5f8f('0x20')](handleEntityNotFound(_0x22495a,null))[_0x5f8f('0x20')](saveUpdates(_0x5d2f17[_0x5f8f('0x43')],null))[_0x5f8f('0x20')](respondWithResult(_0x22495a,null))[_0x5f8f('0x3d')](handleError(_0x22495a,null));};exports[_0x5f8f('0x45')]=function(_0x3986cd,_0x5f13ab){return db['MailTransferReport'][_0x5f8f('0x41')]({'where':{'id':_0x3986cd[_0x5f8f('0x3f')]['id']}})[_0x5f8f('0x20')](handleEntityNotFound(_0x5f13ab,null))['then'](removeEntity(_0x5f13ab,null))['catch'](handleError(_0x5f13ab,null));};exports[_0x5f8f('0x46')]=function(_0x123001,_0xc570f4){return db[_0x5f8f('0x3c')][_0x5f8f('0x46')]()[_0x5f8f('0x20')](respondWithResult(_0xc570f4,null))[_0x5f8f('0x3d')](handleError(_0xc570f4,null));}; \ No newline at end of file +var _0xbbf9=['body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','index','MailTransferReport','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create'];(function(_0x393d22,_0x44385a){var _0x11f436=function(_0x2b3d37){while(--_0x2b3d37){_0x393d22['push'](_0x393d22['shift']());}};_0x11f436(++_0x44385a);}(_0xbbf9,0x1b2));var _0x9bbf=function(_0x31922d,_0x35f27b){_0x31922d=_0x31922d-0x0;var _0x255700=_0xbbf9[_0x31922d];return _0x255700;};'use strict';var emlformat=require(_0x9bbf('0x0'));var rimraf=require(_0x9bbf('0x1'));var zipdir=require(_0x9bbf('0x2'));var jsonpatch=require(_0x9bbf('0x3'));var rp=require('request-promise');var moment=require(_0x9bbf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9bbf('0x5'));var util=require(_0x9bbf('0x6'));var path=require('path');var sox=require(_0x9bbf('0x7'));var csv=require(_0x9bbf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bbf('0x9'));var _=require(_0x9bbf('0xa'));var squel=require(_0x9bbf('0xb'));var crypto=require('crypto');var jsforce=require(_0x9bbf('0xc'));var deskjs=require(_0x9bbf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9bbf('0xe'));var Papa=require(_0x9bbf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9bbf('0x10'));var hardwareService=require(_0x9bbf('0x11'));var logger=require(_0x9bbf('0x12'))(_0x9bbf('0x13'));var utils=require(_0x9bbf('0x14'));var config=require(_0x9bbf('0x15'));var licenseUtil=require(_0x9bbf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35836b,_0x565345){_0x565345=_0x565345||0xcc;return function(_0x180dbd){if(_0x180dbd){return _0x35836b['sendStatus'](_0x565345);}return _0x35836b[_0x9bbf('0x17')](_0x565345)['end']();};}function respondWithResult(_0x4ace3b,_0xab4321){_0xab4321=_0xab4321||0xc8;return function(_0x2dfbf8){if(_0x2dfbf8){return _0x4ace3b[_0x9bbf('0x17')](_0xab4321)['json'](_0x2dfbf8);}};}function respondWithFilteredResult(_0x258308,_0x142eb5){return function(_0x5743b0){if(_0x5743b0){var _0x3cad83=typeof _0x142eb5[_0x9bbf('0x18')]===_0x9bbf('0x19')&&typeof _0x142eb5['limit']===_0x9bbf('0x19');var _0x40b9ed=_0x5743b0[_0x9bbf('0x1a')];var _0x5d443d=_0x3cad83?0x0:_0x142eb5[_0x9bbf('0x18')];var _0x137817=_0x3cad83?_0x5743b0['count']:_0x142eb5[_0x9bbf('0x18')]+_0x142eb5[_0x9bbf('0x1b')];var _0x1cc877;if(_0x137817>=_0x40b9ed){_0x137817=_0x40b9ed;_0x1cc877=0xc8;}else{_0x1cc877=0xce;}_0x258308['status'](_0x1cc877);return _0x258308[_0x9bbf('0x1c')]('Content-Range',_0x5d443d+'-'+_0x137817+'/'+_0x40b9ed)['json'](_0x5743b0);}return null;};}function patchUpdates(_0x323edf){return function(_0x47e6b9){try{jsonpatch[_0x9bbf('0x1d')](_0x47e6b9,_0x323edf,!![]);}catch(_0x468963){return BPromise[_0x9bbf('0x1e')](_0x468963);}return _0x47e6b9[_0x9bbf('0x1f')]();};}function saveUpdates(_0x4f886d,_0x44316e){return function(_0x4688e6){if(_0x4688e6){return _0x4688e6[_0x9bbf('0x20')](_0x4f886d)[_0x9bbf('0x21')](function(_0x1190a4){return _0x1190a4;});}return null;};}function removeEntity(_0x4c2e87,_0x3a8ce5){return function(_0x519a1f){if(_0x519a1f){return _0x519a1f[_0x9bbf('0x22')]()[_0x9bbf('0x21')](function(){_0x4c2e87[_0x9bbf('0x17')](0xcc)[_0x9bbf('0x23')]();});}};}function handleEntityNotFound(_0x42e711,_0xf7b0eb){return function(_0x43618b){if(!_0x43618b){_0x42e711['sendStatus'](0x194);}return _0x43618b;};}function handleError(_0x258622,_0x41c328){_0x41c328=_0x41c328||0x1f4;return function(_0x50f10a){logger[_0x9bbf('0x24')](_0x50f10a[_0x9bbf('0x25')]);if(_0x50f10a['name']){delete _0x50f10a['name'];}_0x258622[_0x9bbf('0x17')](_0x41c328)['send'](_0x50f10a);};}exports[_0x9bbf('0x26')]=function(_0x341a29,_0x738ccc){var _0x32d12e={},_0x5e19c5={},_0x50f187={'count':0x0,'rows':[]};var _0x11e045=_['map'](db[_0x9bbf('0x27')]['rawAttributes'],function(_0x1baa27){return{'name':_0x1baa27[_0x9bbf('0x28')],'type':_0x1baa27['type']['key']};});_0x5e19c5['model']=_[_0x9bbf('0x29')](_0x11e045,'name');_0x5e19c5[_0x9bbf('0x2a')]=_[_0x9bbf('0x2b')](_0x341a29[_0x9bbf('0x2a')]);_0x5e19c5[_0x9bbf('0x2c')]=_[_0x9bbf('0x2d')](_0x5e19c5[_0x9bbf('0x2e')],_0x5e19c5[_0x9bbf('0x2a')]);_0x32d12e[_0x9bbf('0x2f')]=_[_0x9bbf('0x2d')](_0x5e19c5[_0x9bbf('0x2e')],qs[_0x9bbf('0x30')](_0x341a29[_0x9bbf('0x2a')][_0x9bbf('0x30')]));_0x32d12e[_0x9bbf('0x2f')]=_0x32d12e[_0x9bbf('0x2f')][_0x9bbf('0x31')]?_0x32d12e[_0x9bbf('0x2f')]:_0x5e19c5[_0x9bbf('0x2e')];if(!_0x341a29[_0x9bbf('0x2a')][_0x9bbf('0x32')](_0x9bbf('0x33'))){_0x32d12e['limit']=qs[_0x9bbf('0x1b')](_0x341a29[_0x9bbf('0x2a')][_0x9bbf('0x1b')]);_0x32d12e['offset']=qs[_0x9bbf('0x18')](_0x341a29[_0x9bbf('0x2a')]['offset']);}_0x32d12e[_0x9bbf('0x34')]=qs[_0x9bbf('0x35')](_0x341a29[_0x9bbf('0x2a')]['sort']);_0x32d12e[_0x9bbf('0x36')]=qs[_0x9bbf('0x2c')](_[_0x9bbf('0x37')](_0x341a29[_0x9bbf('0x2a')],_0x5e19c5[_0x9bbf('0x2c')]),_0x11e045);if(_0x341a29[_0x9bbf('0x2a')]['filter']){_0x32d12e[_0x9bbf('0x36')]=_[_0x9bbf('0x38')](_0x32d12e[_0x9bbf('0x36')],{'$or':_['map'](_0x11e045,function(_0x4f19e1){if(_0x4f19e1['type']!==_0x9bbf('0x39')){var _0xd8ecc={};_0xd8ecc[_0x4f19e1['name']]={'$like':'%'+_0x341a29[_0x9bbf('0x2a')][_0x9bbf('0x3a')]+'%'};return _0xd8ecc;}})});}_0x32d12e=_[_0x9bbf('0x38')]({},_0x32d12e,_0x341a29['options']);var _0x2fdb9a={'where':_0x32d12e[_0x9bbf('0x36')]};return db[_0x9bbf('0x27')][_0x9bbf('0x1a')](_0x2fdb9a)[_0x9bbf('0x21')](function(_0x3b3ca5){_0x50f187['count']=_0x3b3ca5;if(_0x341a29['query']['includeAll']){_0x32d12e[_0x9bbf('0x3b')]=[{'all':!![]}];}return db[_0x9bbf('0x27')][_0x9bbf('0x3c')](_0x32d12e);})['then'](function(_0x4b9abf){_0x50f187[_0x9bbf('0x3d')]=_0x4b9abf;return _0x50f187;})[_0x9bbf('0x21')](respondWithFilteredResult(_0x738ccc,_0x32d12e))['catch'](handleError(_0x738ccc,null));};exports[_0x9bbf('0x3e')]=function(_0x3bb27e,_0x5bbdc4){var _0x3378c0={'raw':!![],'where':{'id':_0x3bb27e[_0x9bbf('0x3f')]['id']}},_0x1c92fa={};_0x1c92fa[_0x9bbf('0x2e')]=_['keys'](db[_0x9bbf('0x27')][_0x9bbf('0x40')]);_0x1c92fa['query']=_[_0x9bbf('0x2b')](_0x3bb27e[_0x9bbf('0x2a')]);_0x1c92fa['filters']=_[_0x9bbf('0x2d')](_0x1c92fa[_0x9bbf('0x2e')],_0x1c92fa[_0x9bbf('0x2a')]);_0x3378c0[_0x9bbf('0x2f')]=_[_0x9bbf('0x2d')](_0x1c92fa['model'],qs['fields'](_0x3bb27e[_0x9bbf('0x2a')][_0x9bbf('0x30')]));_0x3378c0[_0x9bbf('0x2f')]=_0x3378c0[_0x9bbf('0x2f')]['length']?_0x3378c0[_0x9bbf('0x2f')]:_0x1c92fa[_0x9bbf('0x2e')];if(_0x3bb27e[_0x9bbf('0x2a')][_0x9bbf('0x41')]){_0x3378c0['include']=[{'all':!![]}];}_0x3378c0=_[_0x9bbf('0x38')]({},_0x3378c0,_0x3bb27e[_0x9bbf('0x42')]);return db[_0x9bbf('0x27')][_0x9bbf('0x43')](_0x3378c0)[_0x9bbf('0x21')](handleEntityNotFound(_0x5bbdc4,null))[_0x9bbf('0x21')](respondWithResult(_0x5bbdc4,null))[_0x9bbf('0x44')](handleError(_0x5bbdc4,null));};exports[_0x9bbf('0x45')]=function(_0x4283da,_0x58c5b4){return db[_0x9bbf('0x27')][_0x9bbf('0x45')](_0x4283da[_0x9bbf('0x46')],{})['then'](respondWithResult(_0x58c5b4,0xc9))[_0x9bbf('0x44')](handleError(_0x58c5b4,null));};exports[_0x9bbf('0x20')]=function(_0x3b6822,_0x15062b){if(_0x3b6822[_0x9bbf('0x46')]['id']){delete _0x3b6822['body']['id'];}return db[_0x9bbf('0x27')][_0x9bbf('0x43')]({'where':{'id':_0x3b6822[_0x9bbf('0x3f')]['id']}})[_0x9bbf('0x21')](handleEntityNotFound(_0x15062b,null))[_0x9bbf('0x21')](saveUpdates(_0x3b6822[_0x9bbf('0x46')],null))['then'](respondWithResult(_0x15062b,null))[_0x9bbf('0x44')](handleError(_0x15062b,null));};exports[_0x9bbf('0x22')]=function(_0x1146e4,_0x104a09){return db[_0x9bbf('0x27')][_0x9bbf('0x43')]({'where':{'id':_0x1146e4[_0x9bbf('0x3f')]['id']}})[_0x9bbf('0x21')](handleEntityNotFound(_0x104a09,null))[_0x9bbf('0x21')](removeEntity(_0x104a09,null))[_0x9bbf('0x44')](handleError(_0x104a09,null));};exports[_0x9bbf('0x47')]=function(_0x44e3d8,_0x3ec4cc){return db[_0x9bbf('0x27')]['describe']()[_0x9bbf('0x21')](respondWithResult(_0x3ec4cc,null))['catch'](handleError(_0x3ec4cc,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d9dbb5b..5204d48 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 _0x4ce6=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x15f6ec,_0x54bcfc){var _0x2339d0=function(_0x5c1071){while(--_0x5c1071){_0x15f6ec['push'](_0x15f6ec['shift']());}};_0x2339d0(++_0x54bcfc);}(_0x4ce6,0x108));var _0x64ce=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x4ce6[_0x5f1617];return _0x3af5da;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var logger=require(_0x64ce('0x1'))(_0x64ce('0x2'));var moment=require(_0x64ce('0x3'));var BPromise=require(_0x64ce('0x4'));var rp=require(_0x64ce('0x5'));var fs=require('fs');var path=require(_0x64ce('0x6'));var rimraf=require('rimraf');var config=require(_0x64ce('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x31bc0f,_0x262751){return _0x31bc0f['define'](_0x64ce('0x8'),attributes,{'tableName':_0x64ce('0x9'),'paranoid':![],'indexes':[{'name':_0x64ce('0xa'),'fields':[_0x64ce('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8c4=['report_mail_transfer','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport'];(function(_0x5b645d,_0x58665f){var _0xce07d7=function(_0x398a5d){while(--_0x398a5d){_0x5b645d['push'](_0x5b645d['shift']());}};_0xce07d7(++_0x58665f);}(_0xa8c4,0x12d));var _0x4a8c=function(_0x5012b6,_0x510fe6){_0x5012b6=_0x5012b6-0x0;var _0x3514d2=_0xa8c4[_0x5012b6];return _0x3514d2;};'use strict';var _=require('lodash');var util=require(_0x4a8c('0x0'));var logger=require(_0x4a8c('0x1'))('api');var moment=require(_0x4a8c('0x2'));var BPromise=require(_0x4a8c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a8c('0x4'));var rimraf=require(_0x4a8c('0x5'));var config=require(_0x4a8c('0x6'));var attributes=require(_0x4a8c('0x7'));module[_0x4a8c('0x8')]=function(_0x392c01,_0x1e8a2d){return _0x392c01[_0x4a8c('0x9')](_0x4a8c('0xa'),attributes,{'tableName':_0x4a8c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4a8c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 2885911..e44b2ed 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 _0x6222=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x5c6545,_0x474b5e){var _0x30365a=function(_0xcaf07){while(--_0xcaf07){_0x5c6545['push'](_0x5c6545['shift']());}};_0x30365a(++_0x474b5e);}(_0x6222,0x7d));var _0x2622=function(_0x4b37f8,_0x52f0be){_0x4b37f8=_0x4b37f8-0x0;var _0x584319=_0x6222[_0x4b37f8];return _0x584319;};'use strict';var _=require(_0x2622('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2622('0x1'));var rs=require(_0x2622('0x2'));var fs=require('fs');var Redis=require(_0x2622('0x3'));var db=require(_0x2622('0x4'))['db'];var utils=require(_0x2622('0x5'));var logger=require(_0x2622('0x6'))(_0x2622('0x7'));var config=require(_0x2622('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2622('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38c07d,_0x5d293b,_0x3e1a50){return new BPromise(function(_0x2bf6f5,_0x5ef694){return client[_0x2622('0xa')](_0x38c07d,_0x3e1a50)[_0x2622('0xb')](function(_0x264e67){logger[_0x2622('0xc')](_0x2622('0xd'),_0x5d293b,'request\x20sent');logger['debug'](_0x2622('0xe'),_0x5d293b,_0x2622('0xf'),JSON[_0x2622('0x10')](_0x264e67));if(_0x264e67[_0x2622('0x11')]){if(_0x264e67[_0x2622('0x11')]['code']===0x1f4){logger[_0x2622('0x11')](_0x2622('0xd'),_0x5d293b,_0x264e67[_0x2622('0x11')][_0x2622('0x12')]);return _0x5ef694(_0x264e67['error'][_0x2622('0x12')]);}logger[_0x2622('0x11')](_0x2622('0xd'),_0x5d293b,_0x264e67['error'][_0x2622('0x12')]);return _0x2bf6f5(_0x264e67[_0x2622('0x11')][_0x2622('0x12')]);}else{logger[_0x2622('0xc')](_0x2622('0xd'),_0x5d293b,_0x2622('0xf'));_0x2bf6f5(_0x264e67[_0x2622('0x13')][_0x2622('0x12')]);}})[_0x2622('0x14')](function(_0x5896c7){logger[_0x2622('0x11')](_0x2622('0xd'),_0x5d293b,_0x5896c7);_0x5ef694(_0x5896c7);});});} \ No newline at end of file +var _0x469e=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1e32b0,_0x41debe){var _0x16edab=function(_0x3766a6){while(--_0x3766a6){_0x1e32b0['push'](_0x1e32b0['shift']());}};_0x16edab(++_0x41debe);}(_0x469e,0x19b));var _0xe469=function(_0x49bdc4,_0x1e2507){_0x49bdc4=_0x49bdc4-0x0;var _0x1f7437=_0x469e[_0x49bdc4];return _0x1f7437;};'use strict';var _=require(_0xe469('0x0'));var util=require(_0xe469('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe469('0x2'));var fs=require('fs');var Redis=require(_0xe469('0x3'));var db=require(_0xe469('0x4'))['db'];var utils=require(_0xe469('0x5'));var logger=require(_0xe469('0x6'))(_0xe469('0x7'));var config=require(_0xe469('0x8'));var jayson=require(_0xe469('0x9'));var client=jayson['client'][_0xe469('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x970f6c,_0x15f69f,_0x109c99){return new BPromise(function(_0x2511d2,_0x1d0911){return client['request'](_0x970f6c,_0x109c99)[_0xe469('0xb')](function(_0x50e3f6){logger[_0xe469('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x15f69f,_0xe469('0xd'));logger[_0xe469('0xe')](_0xe469('0xf'),_0x15f69f,_0xe469('0xd'),JSON[_0xe469('0x10')](_0x50e3f6));if(_0x50e3f6[_0xe469('0x11')]){if(_0x50e3f6[_0xe469('0x11')]['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x15f69f,_0x50e3f6[_0xe469('0x11')]['message']);return _0x1d0911(_0x50e3f6[_0xe469('0x11')]['message']);}logger[_0xe469('0x11')](_0xe469('0x12'),_0x15f69f,_0x50e3f6[_0xe469('0x11')][_0xe469('0x13')]);return _0x2511d2(_0x50e3f6[_0xe469('0x11')][_0xe469('0x13')]);}else{logger[_0xe469('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x15f69f,'request\x20sent');_0x2511d2(_0x50e3f6[_0xe469('0x14')][_0xe469('0x13')]);}})[_0xe469('0x15')](function(_0x491f12){logger[_0xe469('0x11')](_0xe469('0x12'),_0x15f69f,_0x491f12);_0x1d0911(_0x491f12);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 72af05a..daebb88 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 _0x1346=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1346,0x7f));var _0x6134=function(_0x3b510c,_0xc57621){_0x3b510c=_0x3b510c-0x0;var _0x4a3574=_0x1346[_0x3b510c];return _0x4a3574;};'use strict';var multer=require('multer');var util=require(_0x6134('0x0'));var path=require(_0x6134('0x1'));var timeout=require(_0x6134('0x2'));var express=require(_0x6134('0x3'));var router=express[_0x6134('0x4')]();var fs_extra=require(_0x6134('0x5'));var auth=require(_0x6134('0x6'));var interaction=require(_0x6134('0x7'));var config=require(_0x6134('0x8'));var controller=require('./memberReport.controller');router[_0x6134('0x9')]('/',auth[_0x6134('0xa')](),controller[_0x6134('0xb')]);router[_0x6134('0x9')](_0x6134('0xc'),auth[_0x6134('0xa')](),controller[_0x6134('0xd')]);router[_0x6134('0x9')](_0x6134('0xe'),auth[_0x6134('0xa')](),controller[_0x6134('0xf')]);router[_0x6134('0x10')]('/',auth[_0x6134('0xa')](),controller[_0x6134('0x11')]);router[_0x6134('0x12')](_0x6134('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6134('0xe'),auth[_0x6134('0xa')](),controller[_0x6134('0x13')]);module[_0x6134('0x14')]=router; \ No newline at end of file +var _0x62f2=['index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x5041bb,_0x114f80){var _0x159130=function(_0x1bc141){while(--_0x1bc141){_0x5041bb['push'](_0x5041bb['shift']());}};_0x159130(++_0x114f80);}(_0x62f2,0xd3));var _0x262f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x62f2[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x262f('0x0'));var path=require('path');var timeout=require(_0x262f('0x1'));var express=require(_0x262f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x262f('0x3'));var interaction=require(_0x262f('0x4'));var config=require(_0x262f('0x5'));var controller=require(_0x262f('0x6'));router[_0x262f('0x7')]('/',auth[_0x262f('0x8')](),controller[_0x262f('0x9')]);router[_0x262f('0x7')](_0x262f('0xa'),auth[_0x262f('0x8')](),controller[_0x262f('0xb')]);router[_0x262f('0x7')](_0x262f('0xc'),auth[_0x262f('0x8')](),controller[_0x262f('0xd')]);router[_0x262f('0xe')]('/',auth[_0x262f('0x8')](),controller[_0x262f('0xf')]);router[_0x262f('0x10')](_0x262f('0xc'),auth[_0x262f('0x8')](),controller['update']);router[_0x262f('0x11')](_0x262f('0xc'),auth[_0x262f('0x8')](),controller[_0x262f('0x12')]);module[_0x262f('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index e630fdb..0ba67b7 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 _0xb1c9=['enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xb1c9,0x1cc));var _0x9b1c=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb1c9[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0x9b1c('0x0'));var moment=require('moment');module[_0x9b1c('0x1')]={'channel':{'type':Sequelize[_0x9b1c('0x2')]},'membername':{'type':Sequelize[_0x9b1c('0x2')]},'interface':{'type':Sequelize[_0x9b1c('0x2')]},'type':{'type':Sequelize[_0x9b1c('0x2')],'defaultValue':_0x9b1c('0x3'),'comment':_0x9b1c('0x4')},'duration':{'type':Sequelize[_0x9b1c('0x5')]},'enterAt':{'type':Sequelize[_0x9b1c('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5e7a13){var _0x144ab2=moment(_0x5e7a13);var _0x275d5a=moment(this[_0x9b1c('0x7')](_0x9b1c('0x8')));var _0x254964=_0x144ab2[_0x9b1c('0x9')](_0x275d5a,_0x9b1c('0xa'));this[_0x9b1c('0xb')](_0x9b1c('0xc'),_0x5e7a13);this[_0x9b1c('0xb')](_0x9b1c('0xd'),_0x254964>=0x0?_0x254964:null);}},'data1':{'type':Sequelize[_0x9b1c('0x2')],'comment':_0x9b1c('0xe')},'data2':{'type':Sequelize[_0x9b1c('0x2')],'comment':_0x9b1c('0xf')},'data3':{'type':Sequelize[_0x9b1c('0x2')],'comment':_0x9b1c('0x10')},'data4':{'type':Sequelize[_0x9b1c('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x9b1c('0x2')],'comment':_0x9b1c('0x11')},'role':{'type':Sequelize[_0x9b1c('0x2')]},'internal':{'type':Sequelize[_0x9b1c('0x5')]},'uniqueid':{'type':Sequelize[_0x9b1c('0x2')]}}; \ No newline at end of file +var _0x7508=['talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','diff','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]'];(function(_0x103fc4,_0x231dbf){var _0x472b51=function(_0xc656f0){while(--_0xc656f0){_0x103fc4['push'](_0x103fc4['shift']());}};_0x472b51(++_0x231dbf);}(_0x7508,0x7a));var _0x8750=function(_0x28b232,_0x4cb7c0){_0x28b232=_0x28b232-0x0;var _0x593fd2=_0x7508[_0x28b232];return _0x593fd2;};'use strict';var Sequelize=require(_0x8750('0x0'));var moment=require(_0x8750('0x1'));module[_0x8750('0x2')]={'channel':{'type':Sequelize[_0x8750('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8750('0x3')]},'type':{'type':Sequelize[_0x8750('0x3')],'defaultValue':_0x8750('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x8750('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x499e17){var _0xb26597=moment(_0x499e17);var _0x1c488f=moment(this[_0x8750('0x6')](_0x8750('0x7')));var _0xb30124=_0xb26597[_0x8750('0x8')](_0x1c488f,'seconds');this[_0x8750('0x9')]('exitAt',_0x499e17);this[_0x8750('0x9')]('duration',_0xb30124>=0x0?_0xb30124:null);}},'data1':{'type':Sequelize[_0x8750('0x3')],'comment':_0x8750('0xa')},'data2':{'type':Sequelize[_0x8750('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x8750('0x3')],'comment':_0x8750('0xb')},'data4':{'type':Sequelize[_0x8750('0x3')],'comment':_0x8750('0xc')},'data5':{'type':Sequelize[_0x8750('0x3')],'comment':_0x8750('0xd')},'role':{'type':Sequelize[_0x8750('0x3')]},'internal':{'type':Sequelize[_0x8750('0xe')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 5eec43c..26a9fab 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(_0x29af75,_0x152b87){var _0x32b56b=function(_0x5460fe){while(--_0x5460fe){_0x29af75['push'](_0x29af75['shift']());}};_0x32b56b(++_0x152b87);}(_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(_0x510e1b,_0x303c6c){var _0x5fdad3=function(_0x2d01b8){while(--_0x2d01b8){_0x510e1b['push'](_0x510e1b['shift']());}};_0x5fdad3(++_0x303c6c);}(_0x7217,0x19e));var _0x7721=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7217[_0x47a7d0];return _0xb9bd08;};'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 84ee9ee..e4cf4ea 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 _0x84cd=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment'];(function(_0x4fdb79,_0x12c116){var _0x3ec15b=function(_0x50c82e){while(--_0x50c82e){_0x4fdb79['push'](_0x4fdb79['shift']());}};_0x3ec15b(++_0x12c116);}(_0x84cd,0x193));var _0xd84c=function(_0xac0174,_0x6bec5f){_0xac0174=_0xac0174-0x0;var _0x4b09f8=_0x84cd[_0xac0174];return _0x4b09f8;};'use strict';var _=require(_0xd84c('0x0'));var util=require(_0xd84c('0x1'));var logger=require(_0xd84c('0x2'))(_0xd84c('0x3'));var moment=require(_0xd84c('0x4'));var BPromise=require(_0xd84c('0x5'));var rp=require(_0xd84c('0x6'));var fs=require('fs');var path=require(_0xd84c('0x7'));var rimraf=require(_0xd84c('0x8'));var config=require(_0xd84c('0x9'));var attributes=require(_0xd84c('0xa'));module[_0xd84c('0xb')]=function(_0x3ff9c4,_0x3f05d2){return _0x3ff9c4[_0xd84c('0xc')](_0xd84c('0xd'),attributes,{'tableName':_0xd84c('0xe'),'paranoid':![],'indexes':[{'name':_0xd84c('0xf'),'fields':['membername',_0xd84c('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0a1=['path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x20c0e5,_0x3c1f34){_0x20c0e5=_0x20c0e5-0x0;var _0x395caf=_0xa0a1[_0x20c0e5];return _0x395caf;};'use strict';var _=require(_0x1a0a('0x0'));var util=require('util');var logger=require(_0x1a0a('0x1'))(_0x1a0a('0x2'));var moment=require(_0x1a0a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a0a('0x4'));var rimraf=require(_0x1a0a('0x5'));var config=require('../../config/environment');var attributes=require(_0x1a0a('0x6'));module[_0x1a0a('0x7')]=function(_0x4b5573,_0x2d4b04){return _0x4b5573[_0x1a0a('0x8')](_0x1a0a('0x9'),attributes,{'tableName':_0x1a0a('0xa'),'paranoid':![],'indexes':[{'name':_0x1a0a('0xb'),'fields':['membername',_0x1a0a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d108c30..4e74738 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 _0x8784=['message','result','catch','MemberReport','findAll','options','where','attributes','limit','include','map','model','GetMemberReport','create','body','raw','CreateMemberReport','update','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x387ddf,_0x3066bc){var _0x3f503e=function(_0x4b401b){while(--_0x4b401b){_0x387ddf['push'](_0x387ddf['shift']());}};_0x3f503e(++_0x3066bc);}(_0x8784,0x172));var _0x4878=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x8784[_0x5b8310];return _0xd3ebc1;};'use strict';var _=require(_0x4878('0x0'));var util=require(_0x4878('0x1'));var moment=require('moment');var BPromise=require(_0x4878('0x2'));var rs=require(_0x4878('0x3'));var fs=require('fs');var Redis=require(_0x4878('0x4'));var db=require(_0x4878('0x5'))['db'];var utils=require(_0x4878('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4878('0x7'));var jayson=require(_0x4878('0x8'));var client=jayson[_0x4878('0x9')][_0x4878('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe22936,_0x4148dd,_0x131e82){return new BPromise(function(_0x35cd6a,_0x29d02e){return client['request'](_0xe22936,_0x131e82)[_0x4878('0xb')](function(_0xfe196b){logger[_0x4878('0xc')](_0x4878('0xd'),_0x4148dd,_0x4878('0xe'));logger[_0x4878('0xf')](_0x4878('0x10'),_0x4148dd,_0x4878('0xe'),JSON[_0x4878('0x11')](_0xfe196b));if(_0xfe196b[_0x4878('0x12')]){if(_0xfe196b[_0x4878('0x12')][_0x4878('0x13')]===0x1f4){logger['error'](_0x4878('0xd'),_0x4148dd,_0xfe196b[_0x4878('0x12')][_0x4878('0x14')]);return _0x29d02e(_0xfe196b['error'][_0x4878('0x14')]);}logger[_0x4878('0x12')]('MemberReport,\x20%s,\x20%s',_0x4148dd,_0xfe196b[_0x4878('0x12')]['message']);return _0x35cd6a(_0xfe196b['error'][_0x4878('0x14')]);}else{logger[_0x4878('0xc')](_0x4878('0xd'),_0x4148dd,_0x4878('0xe'));_0x35cd6a(_0xfe196b[_0x4878('0x15')]['message']);}})[_0x4878('0x16')](function(_0x25282f){logger['error'](_0x4878('0xd'),_0x4148dd,_0x25282f);_0x29d02e(_0x25282f);});});}exports['GetMemberReport']=function(_0x2c2529){var _0x4baa5e=this;return new Promise(function(_0x5267ff,_0x2ab3f6){return db[_0x4878('0x17')][_0x4878('0x18')]({'raw':_0x2c2529[_0x4878('0x19')]?_0x2c2529[_0x4878('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2c2529[_0x4878('0x19')]?_0x2c2529[_0x4878('0x19')][_0x4878('0x1a')]||null:null,'attributes':_0x2c2529[_0x4878('0x19')]?_0x2c2529[_0x4878('0x19')][_0x4878('0x1b')]||null:null,'limit':_0x2c2529['options']?_0x2c2529[_0x4878('0x19')][_0x4878('0x1c')]||null:null,'include':_0x2c2529[_0x4878('0x19')]?_0x2c2529['options'][_0x4878('0x1d')]?_[_0x4878('0x1e')](_0x2c2529['options'][_0x4878('0x1d')],function(_0x10e25d){return{'model':db[_0x10e25d[_0x4878('0x1f')]],'as':_0x10e25d['as'],'attributes':_0x10e25d['attributes'],'include':_0x10e25d[_0x4878('0x1d')]?_[_0x4878('0x1e')](_0x10e25d[_0x4878('0x1d')],function(_0x476ec3){return{'model':db[_0x476ec3[_0x4878('0x1f')]],'as':_0x476ec3['as'],'attributes':_0x476ec3['attributes'],'include':_0x476ec3[_0x4878('0x1d')]?_[_0x4878('0x1e')](_0x476ec3['include'],function(_0x48f8f){return{'model':db[_0x48f8f[_0x4878('0x1f')]],'as':_0x48f8f['as'],'attributes':_0x48f8f[_0x4878('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4878('0xb')](function(_0x43b9a0){logger[_0x4878('0xc')](_0x4878('0x20'),_0x2c2529);logger[_0x4878('0xf')](_0x4878('0x20'),_0x2c2529,JSON[_0x4878('0x11')](_0x43b9a0));_0x5267ff(_0x43b9a0);})[_0x4878('0x16')](function(_0x38400b){logger[_0x4878('0x12')]('GetMemberReport',_0x38400b[_0x4878('0x14')],_0x2c2529);_0x2ab3f6(_0x4baa5e[_0x4878('0x12')](0x1f4,_0x38400b['message']));});});};exports['CreateMemberReport']=function(_0x41908f){var _0x2e06b6=this;return new Promise(function(_0x45432e,_0x46b27d){return db[_0x4878('0x17')][_0x4878('0x21')](_0x41908f[_0x4878('0x22')],{'raw':_0x41908f['options']?_0x41908f[_0x4878('0x19')][_0x4878('0x23')]===undefined?!![]:![]:!![]})[_0x4878('0xb')](function(_0xae0447){logger[_0x4878('0xc')]('CreateMemberReport',_0x41908f);logger['debug']('CreateMemberReport',_0x41908f,JSON[_0x4878('0x11')](_0xae0447));_0x45432e(_0xae0447);})[_0x4878('0x16')](function(_0x44e796){logger['error'](_0x4878('0x24'),_0x44e796[_0x4878('0x14')],_0x41908f);_0x46b27d(_0x2e06b6['error'](0x1f4,_0x44e796[_0x4878('0x14')]));});});};exports['UpdateMemberReport']=function(_0xcdb929){var _0x4c31b6=this;return new Promise(function(_0x4d2fa4,_0x179116){return db['MemberReport'][_0x4878('0x25')](_0xcdb929[_0x4878('0x22')],{'raw':_0xcdb929['options']?_0xcdb929[_0x4878('0x19')][_0x4878('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcdb929['options']?_0xcdb929[_0x4878('0x19')][_0x4878('0x1a')]||null:null,'attributes':_0xcdb929['options']?_0xcdb929[_0x4878('0x19')]['attributes']||null:null,'limit':_0xcdb929[_0x4878('0x19')]?_0xcdb929[_0x4878('0x19')][_0x4878('0x1c')]||null:null})[_0x4878('0xb')](function(_0x5c78da){logger[_0x4878('0xc')](_0x4878('0x26'),_0xcdb929);logger[_0x4878('0xf')](_0x4878('0x26'),_0xcdb929,JSON['stringify'](_0x5c78da));_0x4d2fa4(_0x5c78da);})[_0x4878('0x16')](function(_0x48b7f3){logger[_0x4878('0x12')](_0x4878('0x26'),_0x48b7f3['message'],_0xcdb929);_0x179116(_0x4c31b6[_0x4878('0x12')](0x1f4,_0x48b7f3[_0x4878('0x14')]));});});}; \ No newline at end of file +var _0x7f3f=['GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x5c8a83,_0x38cc3b){var _0x10dc15=function(_0x565faa){while(--_0x565faa){_0x5c8a83['push'](_0x5c8a83['shift']());}};_0x10dc15(++_0x38cc3b);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x7f3f[_0x448f8];return _0xa73126;};'use strict';var _=require(_0xf7f3('0x0'));var util=require(_0xf7f3('0x1'));var moment=require('moment');var BPromise=require(_0xf7f3('0x2'));var rs=require(_0xf7f3('0x3'));var fs=require('fs');var Redis=require(_0xf7f3('0x4'));var db=require(_0xf7f3('0x5'))['db'];var utils=require(_0xf7f3('0x6'));var logger=require('../../config/logger')(_0xf7f3('0x7'));var config=require(_0xf7f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf7f3('0x9')][_0xf7f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe75375,_0x32a035,_0x14b371){return new BPromise(function(_0x31beac,_0x464bf9){return client['request'](_0xe75375,_0x14b371)[_0xf7f3('0xb')](function(_0x468c0c){logger[_0xf7f3('0xc')](_0xf7f3('0xd'),_0x32a035,_0xf7f3('0xe'));logger[_0xf7f3('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x32a035,'request\x20sent',JSON[_0xf7f3('0x10')](_0x468c0c));if(_0x468c0c['error']){if(_0x468c0c['error']['code']===0x1f4){logger[_0xf7f3('0x11')](_0xf7f3('0xd'),_0x32a035,_0x468c0c[_0xf7f3('0x11')][_0xf7f3('0x12')]);return _0x464bf9(_0x468c0c[_0xf7f3('0x11')]['message']);}logger[_0xf7f3('0x11')](_0xf7f3('0xd'),_0x32a035,_0x468c0c['error']['message']);return _0x31beac(_0x468c0c['error']['message']);}else{logger['info'](_0xf7f3('0xd'),_0x32a035,_0xf7f3('0xe'));_0x31beac(_0x468c0c['result'][_0xf7f3('0x12')]);}})[_0xf7f3('0x13')](function(_0xd0d1b0){logger['error']('MemberReport,\x20%s,\x20%s',_0x32a035,_0xd0d1b0);_0x464bf9(_0xd0d1b0);});});}exports[_0xf7f3('0x14')]=function(_0x2a8756){var _0x21a20f=this;return new Promise(function(_0x440db8,_0x24ca33){return db[_0xf7f3('0x15')]['findAll']({'raw':_0x2a8756[_0xf7f3('0x16')]?_0x2a8756['options'][_0xf7f3('0x17')]===undefined?!![]:![]:!![],'where':_0x2a8756[_0xf7f3('0x16')]?_0x2a8756[_0xf7f3('0x16')][_0xf7f3('0x18')]||null:null,'attributes':_0x2a8756[_0xf7f3('0x16')]?_0x2a8756[_0xf7f3('0x16')][_0xf7f3('0x19')]||null:null,'limit':_0x2a8756[_0xf7f3('0x16')]?_0x2a8756['options'][_0xf7f3('0x1a')]||null:null,'include':_0x2a8756[_0xf7f3('0x16')]?_0x2a8756[_0xf7f3('0x16')][_0xf7f3('0x1b')]?_[_0xf7f3('0x1c')](_0x2a8756[_0xf7f3('0x16')][_0xf7f3('0x1b')],function(_0x27fb56){return{'model':db[_0x27fb56[_0xf7f3('0x1d')]],'as':_0x27fb56['as'],'attributes':_0x27fb56[_0xf7f3('0x19')],'include':_0x27fb56[_0xf7f3('0x1b')]?_[_0xf7f3('0x1c')](_0x27fb56[_0xf7f3('0x1b')],function(_0x4b1eec){return{'model':db[_0x4b1eec[_0xf7f3('0x1d')]],'as':_0x4b1eec['as'],'attributes':_0x4b1eec[_0xf7f3('0x19')],'include':_0x4b1eec[_0xf7f3('0x1b')]?_[_0xf7f3('0x1c')](_0x4b1eec[_0xf7f3('0x1b')],function(_0xf147c0){return{'model':db[_0xf147c0[_0xf7f3('0x1d')]],'as':_0xf147c0['as'],'attributes':_0xf147c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xf7f3('0xb')](function(_0x8c2161){logger['info']('GetMemberReport',_0x2a8756);logger[_0xf7f3('0xf')]('GetMemberReport',_0x2a8756,JSON[_0xf7f3('0x10')](_0x8c2161));_0x440db8(_0x8c2161);})[_0xf7f3('0x13')](function(_0x446885){logger[_0xf7f3('0x11')](_0xf7f3('0x14'),_0x446885[_0xf7f3('0x12')],_0x2a8756);_0x24ca33(_0x21a20f['error'](0x1f4,_0x446885[_0xf7f3('0x12')]));});});};exports[_0xf7f3('0x1e')]=function(_0x591f8b){var _0x5aca14=this;return new Promise(function(_0x52e72b,_0x4bd22b){return db[_0xf7f3('0x15')][_0xf7f3('0x1f')](_0x591f8b[_0xf7f3('0x20')],{'raw':_0x591f8b[_0xf7f3('0x16')]?_0x591f8b['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3e1c79){logger[_0xf7f3('0xc')]('CreateMemberReport',_0x591f8b);logger[_0xf7f3('0xf')]('CreateMemberReport',_0x591f8b,JSON['stringify'](_0x3e1c79));_0x52e72b(_0x3e1c79);})[_0xf7f3('0x13')](function(_0x12cb66){logger[_0xf7f3('0x11')](_0xf7f3('0x1e'),_0x12cb66[_0xf7f3('0x12')],_0x591f8b);_0x4bd22b(_0x5aca14[_0xf7f3('0x11')](0x1f4,_0x12cb66[_0xf7f3('0x12')]));});});};exports['UpdateMemberReport']=function(_0x197ccb){var _0x7bc164=this;return new Promise(function(_0x4a3ff8,_0x1664a1){return db['MemberReport']['update'](_0x197ccb[_0xf7f3('0x20')],{'raw':_0x197ccb['options']?_0x197ccb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x197ccb[_0xf7f3('0x16')]?_0x197ccb['options']['where']||null:null,'attributes':_0x197ccb[_0xf7f3('0x16')]?_0x197ccb[_0xf7f3('0x16')]['attributes']||null:null,'limit':_0x197ccb[_0xf7f3('0x16')]?_0x197ccb[_0xf7f3('0x16')][_0xf7f3('0x1a')]||null:null})[_0xf7f3('0xb')](function(_0x4502bb){logger[_0xf7f3('0xc')]('UpdateMemberReport',_0x197ccb);logger[_0xf7f3('0xf')]('UpdateMemberReport',_0x197ccb,JSON[_0xf7f3('0x10')](_0x4502bb));_0x4a3ff8(_0x4502bb);})['catch'](function(_0x344c23){logger[_0xf7f3('0x11')](_0xf7f3('0x21'),_0x344c23[_0xf7f3('0x12')],_0x197ccb);_0x1664a1(_0x7bc164['error'](0x1f4,_0x344c23[_0xf7f3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d9265b3..13360e1 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 _0xb3f7=['get','index','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0xb3f7,0x10a));var _0x7b3f=function(_0x554904,_0x18a27b){_0x554904=_0x554904-0x0;var _0x28f8c0=_0xb3f7[_0x554904];return _0x28f8c0;};'use strict';var multer=require(_0x7b3f('0x0'));var util=require(_0x7b3f('0x1'));var path=require(_0x7b3f('0x2'));var timeout=require(_0x7b3f('0x3'));var express=require('express');var router=express[_0x7b3f('0x4')]();var fs_extra=require(_0x7b3f('0x5'));var auth=require(_0x7b3f('0x6'));var interaction=require(_0x7b3f('0x7'));var config=require(_0x7b3f('0x8'));var controller=require(_0x7b3f('0x9'));router[_0x7b3f('0xa')]('/',controller[_0x7b3f('0xb')]);module['exports']=router; \ No newline at end of file +var _0x00a5=['multer','express','Router','fs-extra','../../components/interaction/service','./migration.controller','get','index','exports'];(function(_0x3b09f,_0x4b05aa){var _0x3cbdbb=function(_0x43a3a4){while(--_0x43a3a4){_0x3b09f['push'](_0x3b09f['shift']());}};_0x3cbdbb(++_0x4b05aa);}(_0x00a5,0x19e));var _0x500a=function(_0x56030b,_0x55923b){_0x56030b=_0x56030b-0x0;var _0x24aa03=_0x00a5[_0x56030b];return _0x24aa03;};'use strict';var multer=require(_0x500a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x500a('0x1'));var router=express[_0x500a('0x2')]();var fs_extra=require(_0x500a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x500a('0x4'));var config=require('../../config/environment');var controller=require(_0x500a('0x5'));router[_0x500a('0x6')]('/',controller[_0x500a('0x7')]);module[_0x500a('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7b6ec17..4599391 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 _0x30bf=['version','sequelize','exports','STRING'];(function(_0x28c7a7,_0x55a356){var _0x50610f=function(_0x3a4038){while(--_0x3a4038){_0x28c7a7['push'](_0x28c7a7['shift']());}};_0x50610f(++_0x55a356);}(_0x30bf,0x121));var _0xf30b=function(_0x2b8dcc,_0x30fd84){_0x2b8dcc=_0x2b8dcc-0x0;var _0x3992ac=_0x30bf[_0x2b8dcc];return _0x3992ac;};'use strict';var Sequelize=require(_0xf30b('0x0'));module[_0xf30b('0x1')]={'version':{'type':Sequelize[_0xf30b('0x2')],'unique':_0xf30b('0x3')}}; \ No newline at end of file +var _0xdde4=['version','sequelize','exports','STRING'];(function(_0x18c1ba,_0x39da3f){var _0x1f40d1=function(_0x3d4a2a){while(--_0x3d4a2a){_0x18c1ba['push'](_0x18c1ba['shift']());}};_0x1f40d1(++_0x39da3f);}(_0xdde4,0x155));var _0x4dde=function(_0x41de93,_0x492561){_0x41de93=_0x41de93-0x0;var _0x224636=_0xdde4[_0x41de93];return _0x224636;};'use strict';var Sequelize=require(_0x4dde('0x0'));module[_0x4dde('0x1')]={'version':{'type':Sequelize[_0x4dde('0x2')],'unique':_0x4dde('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 044b143..9a22cdd 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 _0x4591=['end','error','stack','name','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','include','Migration','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then'];(function(_0x55e513,_0x32bd07){var _0x225f26=function(_0x168eb4){while(--_0x168eb4){_0x55e513['push'](_0x55e513['shift']());}};_0x225f26(++_0x32bd07);}(_0x4591,0x168));var _0x1459=function(_0x483d2c,_0x34dc13){_0x483d2c=_0x483d2c-0x0;var _0x25239a=_0x4591[_0x483d2c];return _0x25239a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1459('0x0'));var zipdir=require(_0x1459('0x1'));var jsonpatch=require(_0x1459('0x2'));var rp=require(_0x1459('0x3'));var moment=require(_0x1459('0x4'));var BPromise=require(_0x1459('0x5'));var Mustache=require(_0x1459('0x6'));var util=require(_0x1459('0x7'));var path=require(_0x1459('0x8'));var sox=require('sox');var csv=require(_0x1459('0x9'));var ejs=require(_0x1459('0xa'));var fs=require('fs');var fs_extra=require(_0x1459('0xb'));var _=require(_0x1459('0xc'));var squel=require('squel');var crypto=require(_0x1459('0xd'));var jsforce=require(_0x1459('0xe'));var deskjs=require(_0x1459('0xf'));var toCsv=require(_0x1459('0x9'));var querystring=require(_0x1459('0x10'));var Papa=require('papaparse');var Redis=require(_0x1459('0x11'));var authService=require(_0x1459('0x12'));var qs=require(_0x1459('0x13'));var as=require(_0x1459('0x14'));var hardwareService=require(_0x1459('0x15'));var logger=require(_0x1459('0x16'))(_0x1459('0x17'));var utils=require('../../config/utils');var config=require(_0x1459('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dd5c4,_0x2f6a1f){_0x2f6a1f=_0x2f6a1f||0xcc;return function(_0x977afd){if(_0x977afd){return _0x3dd5c4['sendStatus'](_0x2f6a1f);}return _0x3dd5c4[_0x1459('0x19')](_0x2f6a1f)['end']();};}function respondWithResult(_0x217c3c,_0x369041){_0x369041=_0x369041||0xc8;return function(_0x46daeb){if(_0x46daeb){return _0x217c3c[_0x1459('0x19')](_0x369041)[_0x1459('0x1a')](_0x46daeb);}};}function respondWithFilteredResult(_0x4237b2,_0x3857a6){return function(_0x7b1647){if(_0x7b1647){var _0xa1474e=typeof _0x3857a6[_0x1459('0x1b')]===_0x1459('0x1c')&&typeof _0x3857a6[_0x1459('0x1d')]==='undefined';var _0x3385e6=_0x7b1647[_0x1459('0x1e')];var _0x3233ab=_0xa1474e?0x0:_0x3857a6['offset'];var _0x12f43a=_0xa1474e?_0x7b1647[_0x1459('0x1e')]:_0x3857a6[_0x1459('0x1b')]+_0x3857a6[_0x1459('0x1d')];var _0x2e5d9c;if(_0x12f43a>=_0x3385e6){_0x12f43a=_0x3385e6;_0x2e5d9c=0xc8;}else{_0x2e5d9c=0xce;}_0x4237b2[_0x1459('0x19')](_0x2e5d9c);return _0x4237b2['set'](_0x1459('0x1f'),_0x3233ab+'-'+_0x12f43a+'/'+_0x3385e6)[_0x1459('0x1a')](_0x7b1647);}return null;};}function patchUpdates(_0x4c4cd7){return function(_0x20187e){try{jsonpatch[_0x1459('0x20')](_0x20187e,_0x4c4cd7,!![]);}catch(_0x479019){return BPromise['reject'](_0x479019);}return _0x20187e[_0x1459('0x21')]();};}function saveUpdates(_0x2424e1,_0x14179b){return function(_0xbd6f2a){if(_0xbd6f2a){return _0xbd6f2a[_0x1459('0x22')](_0x2424e1)[_0x1459('0x23')](function(_0x5e196e){return _0x5e196e;});}return null;};}function removeEntity(_0x20c113,_0x62fd9c){return function(_0x4bb449){if(_0x4bb449){return _0x4bb449['destroy']()[_0x1459('0x23')](function(){_0x20c113[_0x1459('0x19')](0xcc)[_0x1459('0x24')]();});}};}function handleEntityNotFound(_0x289e5f,_0x444513){return function(_0x54f869){if(!_0x54f869){_0x289e5f['sendStatus'](0x194);}return _0x54f869;};}function handleError(_0x183c45,_0x14e6cb){_0x14e6cb=_0x14e6cb||0x1f4;return function(_0x3dc97f){logger[_0x1459('0x25')](_0x3dc97f[_0x1459('0x26')]);if(_0x3dc97f[_0x1459('0x27')]){delete _0x3dc97f['name'];}_0x183c45[_0x1459('0x19')](_0x14e6cb)['send'](_0x3dc97f);};}exports['index']=function(_0x719b5,_0x56e9c6){var _0x440b33={},_0x62973d={},_0xd05f89={'count':0x0,'rows':[]};var _0x4ccd51=_['map'](db['Migration'][_0x1459('0x28')],function(_0x418eed){return{'name':_0x418eed[_0x1459('0x29')],'type':_0x418eed[_0x1459('0x2a')][_0x1459('0x2b')]};});_0x62973d[_0x1459('0x2c')]=_[_0x1459('0x2d')](_0x4ccd51,_0x1459('0x27'));_0x62973d['query']=_[_0x1459('0x2e')](_0x719b5['query']);_0x62973d[_0x1459('0x2f')]=_[_0x1459('0x30')](_0x62973d[_0x1459('0x2c')],_0x62973d[_0x1459('0x31')]);_0x440b33['attributes']=_[_0x1459('0x30')](_0x62973d[_0x1459('0x2c')],qs['fields'](_0x719b5[_0x1459('0x31')][_0x1459('0x32')]));_0x440b33[_0x1459('0x33')]=_0x440b33[_0x1459('0x33')][_0x1459('0x34')]?_0x440b33['attributes']:_0x62973d[_0x1459('0x2c')];if(!_0x719b5['query'][_0x1459('0x35')](_0x1459('0x36'))){_0x440b33[_0x1459('0x1d')]=qs[_0x1459('0x1d')](_0x719b5[_0x1459('0x31')]['limit']);_0x440b33[_0x1459('0x1b')]=qs['offset'](_0x719b5[_0x1459('0x31')][_0x1459('0x1b')]);}_0x440b33[_0x1459('0x37')]=qs['sort'](_0x719b5[_0x1459('0x31')]['sort']);_0x440b33[_0x1459('0x38')]=qs[_0x1459('0x2f')](_[_0x1459('0x39')](_0x719b5[_0x1459('0x31')],_0x62973d[_0x1459('0x2f')]),_0x4ccd51);if(_0x719b5['query']['filter']){_0x440b33[_0x1459('0x38')]=_[_0x1459('0x3a')](_0x440b33[_0x1459('0x38')],{'$or':_[_0x1459('0x2d')](_0x4ccd51,function(_0x3cfd60){if(_0x3cfd60['type']!==_0x1459('0x3b')){var _0x288355={};_0x288355[_0x3cfd60[_0x1459('0x27')]]={'$like':'%'+_0x719b5[_0x1459('0x31')]['filter']+'%'};return _0x288355;}})});}_0x440b33=_[_0x1459('0x3a')]({},_0x440b33,_0x719b5[_0x1459('0x3c')]);var _0x14d5ff={'where':_0x440b33['where']};return db['Migration'][_0x1459('0x1e')](_0x14d5ff)[_0x1459('0x23')](function(_0x5bdbee){_0xd05f89['count']=_0x5bdbee;if(_0x719b5[_0x1459('0x31')]['includeAll']){_0x440b33[_0x1459('0x3d')]=[{'all':!![]}];}return db[_0x1459('0x3e')][_0x1459('0x3f')](_0x440b33);})['then'](function(_0x3da259){_0xd05f89[_0x1459('0x40')]=_0x3da259;return _0xd05f89;})[_0x1459('0x23')](respondWithFilteredResult(_0x56e9c6,_0x440b33))[_0x1459('0x41')](handleError(_0x56e9c6,null));}; \ No newline at end of file +var _0x1b47=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','map','Migration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis'];(function(_0x5353e4,_0x3fba02){var _0x5024b3=function(_0x43e002){while(--_0x43e002){_0x5353e4['push'](_0x5353e4['shift']());}};_0x5024b3(++_0x3fba02);}(_0x1b47,0xf5));var _0x71b4=function(_0x4756a1,_0x3f8d1){_0x4756a1=_0x4756a1-0x0;var _0x177c4f=_0x1b47[_0x4756a1];return _0x177c4f;};'use strict';var emlformat=require(_0x71b4('0x0'));var rimraf=require(_0x71b4('0x1'));var zipdir=require(_0x71b4('0x2'));var jsonpatch=require(_0x71b4('0x3'));var rp=require(_0x71b4('0x4'));var moment=require('moment');var BPromise=require(_0x71b4('0x5'));var Mustache=require(_0x71b4('0x6'));var util=require('util');var path=require(_0x71b4('0x7'));var sox=require('sox');var csv=require(_0x71b4('0x8'));var ejs=require(_0x71b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x71b4('0xa'));var crypto=require(_0x71b4('0xb'));var jsforce=require(_0x71b4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x71b4('0x8'));var querystring=require('querystring');var Papa=require(_0x71b4('0xd'));var Redis=require(_0x71b4('0xe'));var authService=require(_0x71b4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x71b4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71b4('0x11'))(_0x71b4('0x12'));var utils=require(_0x71b4('0x13'));var config=require(_0x71b4('0x14'));var licenseUtil=require(_0x71b4('0x15'));var db=require(_0x71b4('0x16'))['db'];function respondWithStatusCode(_0x242c32,_0x109627){_0x109627=_0x109627||0xcc;return function(_0x49164c){if(_0x49164c){return _0x242c32['sendStatus'](_0x109627);}return _0x242c32['status'](_0x109627)['end']();};}function respondWithResult(_0x5c3ae5,_0x4d6877){_0x4d6877=_0x4d6877||0xc8;return function(_0x428ec3){if(_0x428ec3){return _0x5c3ae5[_0x71b4('0x17')](_0x4d6877)[_0x71b4('0x18')](_0x428ec3);}};}function respondWithFilteredResult(_0x4d5d73,_0x297681){return function(_0x28061a){if(_0x28061a){var _0x26c73f=typeof _0x297681['offset']==='undefined'&&typeof _0x297681['limit']===_0x71b4('0x19');var _0x15c118=_0x28061a[_0x71b4('0x1a')];var _0x379795=_0x26c73f?0x0:_0x297681[_0x71b4('0x1b')];var _0x270bbd=_0x26c73f?_0x28061a[_0x71b4('0x1a')]:_0x297681[_0x71b4('0x1b')]+_0x297681[_0x71b4('0x1c')];var _0x162617;if(_0x270bbd>=_0x15c118){_0x270bbd=_0x15c118;_0x162617=0xc8;}else{_0x162617=0xce;}_0x4d5d73[_0x71b4('0x17')](_0x162617);return _0x4d5d73['set'](_0x71b4('0x1d'),_0x379795+'-'+_0x270bbd+'/'+_0x15c118)[_0x71b4('0x18')](_0x28061a);}return null;};}function patchUpdates(_0x9ba516){return function(_0x50256b){try{jsonpatch[_0x71b4('0x1e')](_0x50256b,_0x9ba516,!![]);}catch(_0x2fdaf2){return BPromise[_0x71b4('0x1f')](_0x2fdaf2);}return _0x50256b[_0x71b4('0x20')]();};}function saveUpdates(_0x4b8abd,_0x3c99fa){return function(_0xcbeb61){if(_0xcbeb61){return _0xcbeb61['update'](_0x4b8abd)[_0x71b4('0x21')](function(_0xbeff9e){return _0xbeff9e;});}return null;};}function removeEntity(_0x529591,_0x40369a){return function(_0x586e8f){if(_0x586e8f){return _0x586e8f[_0x71b4('0x22')]()['then'](function(){_0x529591[_0x71b4('0x17')](0xcc)[_0x71b4('0x23')]();});}};}function handleEntityNotFound(_0xc74b62,_0x3be5fd){return function(_0x1cda13){if(!_0x1cda13){_0xc74b62[_0x71b4('0x24')](0x194);}return _0x1cda13;};}function handleError(_0x16573c,_0x4384e5){_0x4384e5=_0x4384e5||0x1f4;return function(_0x5dd1fd){logger[_0x71b4('0x25')](_0x5dd1fd[_0x71b4('0x26')]);if(_0x5dd1fd[_0x71b4('0x27')]){delete _0x5dd1fd[_0x71b4('0x27')];}_0x16573c[_0x71b4('0x17')](_0x4384e5)['send'](_0x5dd1fd);};}exports[_0x71b4('0x28')]=function(_0x2a0cee,_0x71c8f8){var _0x4e2112={},_0x4b6036={},_0x459540={'count':0x0,'rows':[]};var _0x19fc74=_[_0x71b4('0x29')](db[_0x71b4('0x2a')][_0x71b4('0x2b')],function(_0x3c67d9){return{'name':_0x3c67d9[_0x71b4('0x2c')],'type':_0x3c67d9['type']['key']};});_0x4b6036[_0x71b4('0x2d')]=_[_0x71b4('0x29')](_0x19fc74,_0x71b4('0x27'));_0x4b6036[_0x71b4('0x2e')]=_[_0x71b4('0x2f')](_0x2a0cee[_0x71b4('0x2e')]);_0x4b6036[_0x71b4('0x30')]=_[_0x71b4('0x31')](_0x4b6036[_0x71b4('0x2d')],_0x4b6036[_0x71b4('0x2e')]);_0x4e2112[_0x71b4('0x32')]=_[_0x71b4('0x31')](_0x4b6036[_0x71b4('0x2d')],qs[_0x71b4('0x33')](_0x2a0cee['query'][_0x71b4('0x33')]));_0x4e2112['attributes']=_0x4e2112[_0x71b4('0x32')][_0x71b4('0x34')]?_0x4e2112[_0x71b4('0x32')]:_0x4b6036['model'];if(!_0x2a0cee[_0x71b4('0x2e')][_0x71b4('0x35')]('nolimit')){_0x4e2112[_0x71b4('0x1c')]=qs[_0x71b4('0x1c')](_0x2a0cee[_0x71b4('0x2e')][_0x71b4('0x1c')]);_0x4e2112[_0x71b4('0x1b')]=qs[_0x71b4('0x1b')](_0x2a0cee[_0x71b4('0x2e')][_0x71b4('0x1b')]);}_0x4e2112['order']=qs[_0x71b4('0x36')](_0x2a0cee[_0x71b4('0x2e')][_0x71b4('0x36')]);_0x4e2112['where']=qs[_0x71b4('0x30')](_[_0x71b4('0x37')](_0x2a0cee['query'],_0x4b6036['filters']),_0x19fc74);if(_0x2a0cee[_0x71b4('0x2e')][_0x71b4('0x38')]){_0x4e2112['where']=_[_0x71b4('0x39')](_0x4e2112[_0x71b4('0x3a')],{'$or':_['map'](_0x19fc74,function(_0x4b628e){if(_0x4b628e['type']!==_0x71b4('0x3b')){var _0x5d45a0={};_0x5d45a0[_0x4b628e[_0x71b4('0x27')]]={'$like':'%'+_0x2a0cee[_0x71b4('0x2e')][_0x71b4('0x38')]+'%'};return _0x5d45a0;}})});}_0x4e2112=_['merge']({},_0x4e2112,_0x2a0cee[_0x71b4('0x3c')]);var _0x5d49a7={'where':_0x4e2112[_0x71b4('0x3a')]};return db[_0x71b4('0x2a')][_0x71b4('0x1a')](_0x5d49a7)['then'](function(_0x555fda){_0x459540[_0x71b4('0x1a')]=_0x555fda;if(_0x2a0cee[_0x71b4('0x2e')][_0x71b4('0x3d')]){_0x4e2112['include']=[{'all':!![]}];}return db[_0x71b4('0x2a')][_0x71b4('0x3e')](_0x4e2112);})[_0x71b4('0x21')](function(_0xe94cf5){_0x459540[_0x71b4('0x3f')]=_0xe94cf5;return _0x459540;})['then'](respondWithFilteredResult(_0x71c8f8,_0x4e2112))[_0x71b4('0x40')](handleError(_0x71c8f8,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index faa8628..029bbf1 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 _0x9e40=['request-promise','path','./migration.attributes','define','lodash','util','api','moment','bluebird'];(function(_0x368787,_0x29d74f){var _0x545265=function(_0x35b1d1){while(--_0x35b1d1){_0x368787['push'](_0x368787['shift']());}};_0x545265(++_0x29d74f);}(_0x9e40,0x124));var _0x09e4=function(_0x357de2,_0x168f76){_0x357de2=_0x357de2-0x0;var _0x329326=_0x9e40[_0x357de2];return _0x329326;};'use strict';var _=require(_0x09e4('0x0'));var util=require(_0x09e4('0x1'));var logger=require('../../config/logger')(_0x09e4('0x2'));var moment=require(_0x09e4('0x3'));var BPromise=require(_0x09e4('0x4'));var rp=require(_0x09e4('0x5'));var fs=require('fs');var path=require(_0x09e4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x09e4('0x7'));module['exports']=function(_0x12ff6b,_0x3d18a7){return _0x12ff6b[_0x09e4('0x8')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32d2=['api','moment','bluebird','request-promise','path','rimraf','exports','define','Migration','lodash','util'];(function(_0x57acaf,_0x30dcf2){var _0x3b03a9=function(_0x3ffb55){while(--_0x3ffb55){_0x57acaf['push'](_0x57acaf['shift']());}};_0x3b03a9(++_0x30dcf2);}(_0x32d2,0x106));var _0x232d=function(_0xdb5faf,_0x41fa7d){_0xdb5faf=_0xdb5faf-0x0;var _0x4c6124=_0x32d2[_0xdb5faf];return _0x4c6124;};'use strict';var _=require(_0x232d('0x0'));var util=require(_0x232d('0x1'));var logger=require('../../config/logger')(_0x232d('0x2'));var moment=require(_0x232d('0x3'));var BPromise=require(_0x232d('0x4'));var rp=require(_0x232d('0x5'));var fs=require('fs');var path=require(_0x232d('0x6'));var rimraf=require(_0x232d('0x7'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x232d('0x8')]=function(_0x241edb,_0x2d421c){return _0x241edb[_0x232d('0x9')](_0x232d('0xa'),attributes,{'tableName':'migrations','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 3f31211..d47b958 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 _0xbd99=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd99,0x1df));var _0x9bd9=function(_0x3a0692,_0x1e59ff){_0x3a0692=_0x3a0692-0x0;var _0x5cb6e3=_0xbd99[_0x3a0692];return _0x5cb6e3;};'use strict';var _=require(_0x9bd9('0x0'));var util=require(_0x9bd9('0x1'));var moment=require('moment');var BPromise=require(_0x9bd9('0x2'));var rs=require(_0x9bd9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bd9('0x4'))['db'];var utils=require(_0x9bd9('0x5'));var logger=require(_0x9bd9('0x6'))(_0x9bd9('0x7'));var config=require(_0x9bd9('0x8'));var jayson=require(_0x9bd9('0x9'));var client=jayson[_0x9bd9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b41ea,_0x241303,_0x28b83f){return new BPromise(function(_0x7ddd62,_0x441225){return client[_0x9bd9('0xb')](_0x3b41ea,_0x28b83f)['then'](function(_0x865dc1){logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));logger[_0x9bd9('0xe')](_0x9bd9('0xf'),_0x241303,_0x9bd9('0xd'),JSON[_0x9bd9('0x10')](_0x865dc1));if(_0x865dc1[_0x9bd9('0x11')]){if(_0x865dc1['error'][_0x9bd9('0x12')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x441225(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}logger[_0x9bd9('0x11')]('Migration,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x7ddd62(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}else{logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));_0x7ddd62(_0x865dc1[_0x9bd9('0x14')][_0x9bd9('0x13')]);}})['catch'](function(_0x57ffcb){logger[_0x9bd9('0x11')](_0x9bd9('0xc'),_0x241303,_0x57ffcb);_0x441225(_0x57ffcb);});});} \ No newline at end of file +var _0x23a8=['info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5245a6,_0x3f8620){var _0x204cd3=function(_0x56e0c9){while(--_0x56e0c9){_0x5245a6['push'](_0x5245a6['shift']());}};_0x204cd3(++_0x3f8620);}(_0x23a8,0x172));var _0x823a=function(_0x29e4e7,_0x4ae003){_0x29e4e7=_0x29e4e7-0x0;var _0x3da9a4=_0x23a8[_0x29e4e7];return _0x3da9a4;};'use strict';var _=require('lodash');var util=require(_0x823a('0x0'));var moment=require('moment');var BPromise=require(_0x823a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x823a('0x2'));var db=require(_0x823a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x823a('0x4'))('rpc');var config=require(_0x823a('0x5'));var jayson=require(_0x823a('0x6'));var client=jayson[_0x823a('0x7')][_0x823a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dca10,_0x472eb5,_0x3f35db){return new BPromise(function(_0x59866f,_0x42c0f2){return client[_0x823a('0x9')](_0x5dca10,_0x3f35db)['then'](function(_0x43ab90){logger[_0x823a('0xa')](_0x823a('0xb'),_0x472eb5,_0x823a('0xc'));logger['debug'](_0x823a('0xd'),_0x472eb5,_0x823a('0xc'),JSON[_0x823a('0xe')](_0x43ab90));if(_0x43ab90[_0x823a('0xf')]){if(_0x43ab90[_0x823a('0xf')][_0x823a('0x10')]===0x1f4){logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x43ab90['error'][_0x823a('0x11')]);return _0x42c0f2(_0x43ab90['error'][_0x823a('0x11')]);}logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x43ab90['error']['message']);return _0x59866f(_0x43ab90[_0x823a('0xf')][_0x823a('0x11')]);}else{logger[_0x823a('0xa')]('Migration,\x20%s,\x20%s',_0x472eb5,'request\x20sent');_0x59866f(_0x43ab90['result'][_0x823a('0x11')]);}})[_0x823a('0x12')](function(_0x41f41d){logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x41f41d);_0x42c0f2(_0x41f41d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5bb2022..52105a2 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 _0x42ec=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42ec,0x1e8));var _0xc42e=function(_0x7f7bd2,_0x4de695){_0x7f7bd2=_0x7f7bd2-0x0;var _0x3247d5=_0x42ec[_0x7f7bd2];return _0x3247d5;};'use strict';var multer=require(_0xc42e('0x0'));var util=require(_0xc42e('0x1'));var path=require(_0xc42e('0x2'));var timeout=require(_0xc42e('0x3'));var express=require(_0xc42e('0x4'));var router=express['Router']();var fs_extra=require(_0xc42e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc42e('0x6'));var config=require(_0xc42e('0x7'));var controller=require(_0xc42e('0x8'));router[_0xc42e('0x9')]('/',auth['isAuthenticated'](),controller[_0xc42e('0xa')]);router['get'](_0xc42e('0xb'),auth[_0xc42e('0xc')](),controller['show']);router[_0xc42e('0xd')]('/',auth[_0xc42e('0xc')](),controller[_0xc42e('0xe')]);router[_0xc42e('0xf')]('/:id',auth[_0xc42e('0xc')](),controller[_0xc42e('0x10')]);router[_0xc42e('0x11')]('/:id',auth[_0xc42e('0xc')](),controller[_0xc42e('0x12')]);module[_0xc42e('0x13')]=router; \ No newline at end of file +var _0xed65=['util','path','connect-timeout','Router','../../components/auth/service','./network.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xed65,0xa1));var _0x5ed6=function(_0x466d24,_0x3a3d6c){_0x466d24=_0x466d24-0x0;var _0x535da6=_0xed65[_0x466d24];return _0x535da6;};'use strict';var multer=require(_0x5ed6('0x0'));var util=require(_0x5ed6('0x1'));var path=require(_0x5ed6('0x2'));var timeout=require(_0x5ed6('0x3'));var express=require('express');var router=express[_0x5ed6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ed6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5ed6('0x6'));router['get']('/',auth[_0x5ed6('0x7')](),controller[_0x5ed6('0x8')]);router[_0x5ed6('0x9')](_0x5ed6('0xa'),auth[_0x5ed6('0x7')](),controller[_0x5ed6('0xb')]);router[_0x5ed6('0xc')]('/',auth[_0x5ed6('0x7')](),controller['create']);router[_0x5ed6('0xd')](_0x5ed6('0xa'),auth[_0x5ed6('0x7')](),controller[_0x5ed6('0xe')]);router[_0x5ed6('0xf')](_0x5ed6('0xa'),auth[_0x5ed6('0x7')](),controller[_0x5ed6('0x10')]);module[_0x5ed6('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 025c6e4..3d4c377 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 _0xed2a=['STRING','sequelize','exports','ENUM','localnet','stun','turn'];(function(_0x843f73,_0x3549e1){var _0x368b65=function(_0x56adbd){while(--_0x56adbd){_0x843f73['push'](_0x843f73['shift']());}};_0x368b65(++_0x3549e1);}(_0xed2a,0xb0));var _0xaed2=function(_0x304d18,_0x52b0ad){_0x304d18=_0x304d18-0x0;var _0x28f662=_0xed2a[_0x304d18];return _0x28f662;};'use strict';var Sequelize=require(_0xaed2('0x0'));module[_0xaed2('0x1')]={'type':{'type':Sequelize[_0xaed2('0x2')](_0xaed2('0x3'),'externip',_0xaed2('0x4'),_0xaed2('0x5'))},'value':{'type':Sequelize[_0xaed2('0x6')]},'username':{'type':Sequelize[_0xaed2('0x6')]},'password':{'type':Sequelize[_0xaed2('0x6')]}}; \ No newline at end of file +var _0xabed=['turn','STRING','sequelize','ENUM','externip','stun'];(function(_0x6165ef,_0x673e94){var _0x201b24=function(_0x38a9d1){while(--_0x38a9d1){_0x6165ef['push'](_0x6165ef['shift']());}};_0x201b24(++_0x673e94);}(_0xabed,0x170));var _0xdabe=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xabed[_0x86b219];return _0x1f320c;};'use strict';var Sequelize=require(_0xdabe('0x0'));module['exports']={'type':{'type':Sequelize[_0xdabe('0x1')]('localnet',_0xdabe('0x2'),_0xdabe('0x3'),_0xdabe('0x4'))},'value':{'type':Sequelize[_0xdabe('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xdabe('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b3e7afb..d1070b9 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 _0x6eb7=['model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','Network','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','readFileSync','root','server/files/templates/turn_multiple.ejs','utf8','render','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','TURN','/etc/asterisk/turn_xcally.conf','util','path','ejs','lodash','../../config/logger','api','../../config/environment','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','destroy','end','send','index','map','rawAttributes','fieldName','key'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x6eb7,0x87));var _0x76eb=function(_0x116359,_0x346111){_0x116359=_0x116359-0x0;var _0x4b4367=_0x6eb7[_0x116359];return _0x4b4367;};'use strict';var util=require(_0x76eb('0x0'));var path=require(_0x76eb('0x1'));var ejs=require(_0x76eb('0x2'));var fs=require('fs');var _=require(_0x76eb('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x76eb('0x4'))(_0x76eb('0x5'));var config=require(_0x76eb('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76eb('0x7'));var client=jayson[_0x76eb('0x8')][_0x76eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fc3cf,_0x54eede,_0x2994ea,_0x1a450f){return new Promise(function(_0xb81a19,_0x1c1f6a){var _0x39e540=_0x1a450f||client;return _0x39e540['request'](_0x3fc3cf,_0x2994ea)[_0x76eb('0xa')](function(_0x4864d6){logger['info'](_0x76eb('0xb'),_0x54eede,_0x76eb('0xc'));logger[_0x76eb('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x54eede,_0x76eb('0xc'),JSON['stringify'](_0x4864d6));if(_0x4864d6[_0x76eb('0xe')]){if(_0x4864d6['error'][_0x76eb('0xf')]===0x1f4){logger['error'](_0x76eb('0xb'),_0x54eede,_0x4864d6[_0x76eb('0xe')][_0x76eb('0x10')]);return _0x1c1f6a(_0x4864d6['error'][_0x76eb('0x10')]);}logger[_0x76eb('0xe')]('Network,\x20%s,\x20%s',_0x54eede,_0x4864d6[_0x76eb('0xe')][_0x76eb('0x10')]);return _0xb81a19(_0x4864d6[_0x76eb('0xe')][_0x76eb('0x10')]);}else{logger[_0x76eb('0x11')](_0x76eb('0xb'),_0x54eede,'request\x20sent');_0xb81a19(_0x4864d6[_0x76eb('0x12')][_0x76eb('0x10')]);}})[_0x76eb('0x13')](function(_0x2e8f30){logger[_0x76eb('0xe')]('Network,\x20%s,\x20%s',_0x54eede,_0x2e8f30);_0x1c1f6a(_0x2e8f30);});});}function respondWithResult(_0x33107b,_0x28b764){_0x28b764=_0x28b764||0xc8;return function(_0x156600){if(_0x156600){return _0x33107b[_0x76eb('0x14')](_0x28b764)[_0x76eb('0x15')](_0x156600);}};}function respondWithFilteredResult(_0x139163,_0x3ed34d){return function(_0x503b52){if(_0x503b52){var _0x818a02=typeof _0x3ed34d[_0x76eb('0x16')]===_0x76eb('0x17')&&typeof _0x3ed34d[_0x76eb('0x18')]===_0x76eb('0x17');var _0xa447b5=_0x503b52[_0x76eb('0x19')];var _0x15c2de=_0x818a02?0x0:_0x3ed34d[_0x76eb('0x16')];var _0x4a463f=_0x818a02?_0x503b52['count']:_0x3ed34d['offset']+_0x3ed34d[_0x76eb('0x18')];var _0x3af428;if(_0x4a463f>=_0xa447b5){_0x4a463f=_0xa447b5;_0x3af428=0xc8;}else{_0x3af428=0xce;}_0x139163[_0x76eb('0x14')](_0x3af428);return _0x139163[_0x76eb('0x1a')]('Content-Range',_0x15c2de+'-'+_0x4a463f+'/'+_0xa447b5)[_0x76eb('0x15')](_0x503b52);}return null;};}function saveUpdates(_0x2af824){return function(_0x514156){if(_0x514156){return _0x514156['update'](_0x2af824)[_0x76eb('0xa')](function(_0x131d8d){return _0x131d8d;});}return null;};}function removeEntity(_0x263fbd){return function(_0x4ff3a0){if(_0x4ff3a0){return _0x4ff3a0[_0x76eb('0x1b')]()[_0x76eb('0xa')](function(){_0x263fbd[_0x76eb('0x14')](0xcc)[_0x76eb('0x1c')]();});}};}function handleEntityNotFound(_0x20bf48){return function(_0x237b2a){if(!_0x237b2a){_0x20bf48['sendStatus'](0x194);}return _0x237b2a;};}function handleError(_0x2788aa,_0x54f43c){_0x54f43c=_0x54f43c||0x1f4;return function(_0x427637){logger[_0x76eb('0xe')](_0x427637['stack']);if(_0x427637['name']){delete _0x427637['name'];}_0x2788aa[_0x76eb('0x14')](_0x54f43c)[_0x76eb('0x1d')](_0x427637);};}exports[_0x76eb('0x1e')]=function(_0x42c923,_0x48f9f6){var _0x58dda6={},_0x563642={},_0x4419fe={'count':0x0,'rows':[]};var _0x4365e4=_[_0x76eb('0x1f')](db['Network'][_0x76eb('0x20')],function(_0x443920){return{'name':_0x443920[_0x76eb('0x21')],'type':_0x443920['type'][_0x76eb('0x22')]};});_0x563642[_0x76eb('0x23')]=_[_0x76eb('0x1f')](_0x4365e4,_0x76eb('0x24'));_0x563642['query']=_['keys'](_0x42c923[_0x76eb('0x25')]);_0x563642[_0x76eb('0x26')]=_['intersection'](_0x563642[_0x76eb('0x23')],_0x563642[_0x76eb('0x25')]);_0x58dda6[_0x76eb('0x27')]=_['intersection'](_0x563642[_0x76eb('0x23')],qs['fields'](_0x42c923[_0x76eb('0x25')][_0x76eb('0x28')]));_0x58dda6[_0x76eb('0x27')]=_0x58dda6[_0x76eb('0x27')][_0x76eb('0x29')]?_0x58dda6[_0x76eb('0x27')]:_0x563642[_0x76eb('0x23')];if(!_0x42c923[_0x76eb('0x25')][_0x76eb('0x2a')](_0x76eb('0x2b'))){_0x58dda6['limit']=qs[_0x76eb('0x18')](_0x42c923[_0x76eb('0x25')]['limit']);_0x58dda6[_0x76eb('0x16')]=qs[_0x76eb('0x16')](_0x42c923[_0x76eb('0x25')][_0x76eb('0x16')]);}_0x58dda6[_0x76eb('0x2c')]=qs[_0x76eb('0x2d')](_0x42c923[_0x76eb('0x25')][_0x76eb('0x2d')]);_0x58dda6[_0x76eb('0x2e')]=qs[_0x76eb('0x26')](_[_0x76eb('0x2f')](_0x42c923[_0x76eb('0x25')],_0x563642[_0x76eb('0x26')]),_0x4365e4);if(_0x42c923[_0x76eb('0x25')]['filter']){_0x58dda6[_0x76eb('0x2e')]=_[_0x76eb('0x30')](_0x58dda6['where'],{'$or':_['map'](_0x4365e4,function(_0x246fd1){if(_0x246fd1[_0x76eb('0x31')]!==_0x76eb('0x32')){var _0xe39fa8={};_0xe39fa8[_0x246fd1['name']]={'$like':'%'+_0x42c923[_0x76eb('0x25')]['filter']+'%'};return _0xe39fa8;}})});}_0x58dda6=_[_0x76eb('0x30')]({},_0x58dda6,_0x42c923[_0x76eb('0x33')]);var _0x10789a={'where':_0x58dda6[_0x76eb('0x2e')]};return db[_0x76eb('0x34')][_0x76eb('0x19')](_0x10789a)[_0x76eb('0xa')](function(_0x5bd6ed){_0x4419fe['count']=_0x5bd6ed;if(_0x42c923[_0x76eb('0x25')][_0x76eb('0x35')]){_0x58dda6[_0x76eb('0x36')]=[{'all':!![]}];}return db[_0x76eb('0x34')][_0x76eb('0x37')](_0x58dda6);})[_0x76eb('0xa')](function(_0x4a1d0c){_0x4419fe[_0x76eb('0x38')]=_0x4a1d0c;return _0x4419fe;})[_0x76eb('0xa')](respondWithFilteredResult(_0x48f9f6,_0x58dda6))[_0x76eb('0x13')](handleError(_0x48f9f6,null));};exports[_0x76eb('0x39')]=function(_0x1a69e8,_0xae2298){var _0x577e11={'raw':!![],'where':{'id':_0x1a69e8[_0x76eb('0x3a')]['id']}},_0x366695={};_0x366695[_0x76eb('0x23')]=_['keys'](db[_0x76eb('0x34')]['rawAttributes']);_0x366695[_0x76eb('0x25')]=_[_0x76eb('0x3b')](_0x1a69e8[_0x76eb('0x25')]);_0x366695[_0x76eb('0x26')]=_[_0x76eb('0x3c')](_0x366695['model'],_0x366695[_0x76eb('0x25')]);_0x577e11[_0x76eb('0x27')]=_[_0x76eb('0x3c')](_0x366695[_0x76eb('0x23')],qs[_0x76eb('0x28')](_0x1a69e8['query'][_0x76eb('0x28')]));_0x577e11[_0x76eb('0x27')]=_0x577e11['attributes'][_0x76eb('0x29')]?_0x577e11[_0x76eb('0x27')]:_0x366695[_0x76eb('0x23')];if(_0x1a69e8[_0x76eb('0x25')][_0x76eb('0x35')]){_0x577e11['include']=[{'all':!![]}];}_0x577e11=_[_0x76eb('0x30')]({},_0x577e11,_0x1a69e8['options']);return db[_0x76eb('0x34')][_0x76eb('0x3d')](_0x577e11)[_0x76eb('0xa')](handleEntityNotFound(_0xae2298,null))[_0x76eb('0xa')](respondWithResult(_0xae2298,null))[_0x76eb('0x13')](handleError(_0xae2298,null));};exports[_0x76eb('0x3e')]=function(_0x3132cf,_0x4b1fb6){var _0x5e125d;return db[_0x76eb('0x34')][_0x76eb('0x3e')](_0x3132cf[_0x76eb('0x3f')],{'raw':!![]})['then'](function(_0x851c5a){_0x5e125d=_0x851c5a;return db[_0x76eb('0x34')][_0x76eb('0x37')]({'where':{'type':_0x3132cf[_0x76eb('0x3f')][_0x76eb('0x31')]},'raw':!![]});})['then'](function(_0x49148c){if(_0x5e125d[_0x76eb('0x31')][_0x76eb('0x40')]()==_0x76eb('0x41')){var _0x446514=fs['readFileSync'](path[_0x76eb('0x42')](config['root'],_0x76eb('0x43')),'utf8');var _0x56d230=ejs['render'](_0x446514,{'networks':_0x49148c||[]});fs[_0x76eb('0x44')](_0x76eb('0x45'),_0x56d230);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x3e'),{'module':_0x76eb('0x47')});}else if(_0x5e125d['type'][_0x76eb('0x40')]()=='TURN'){var _0x310789=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x4a')),_0x76eb('0x4b'));var _0x26ad8c=ejs[_0x76eb('0x4c')](_0x310789,{'networks':_0x49148c||[]});fs[_0x76eb('0x44')]('/etc/asterisk/turn_xcally.conf',_0x26ad8c);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x3e'),{'module':_0x76eb('0x47')});}else{var _0xff33da=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x4d')),_0x76eb('0x4b'));var _0x20ad2d=ejs[_0x76eb('0x4c')](_0xff33da,{'networks':_0x49148c||[]});fs[_0x76eb('0x44')](util[_0x76eb('0x4e')](_0x76eb('0x4f'),_0x3132cf[_0x76eb('0x3f')]['type'][_0x76eb('0x50')]()),_0x20ad2d);return respondWithRpcPromise('Reload','create',{'module':_0x76eb('0x51')});}})['then'](function(){return _0x5e125d;})['then'](respondWithResult(_0x4b1fb6,0xc9))[_0x76eb('0x13')](handleError(_0x4b1fb6,null));};exports[_0x76eb('0x52')]=function(_0x27496b,_0x3e899d){var _0x2721bb;return db[_0x76eb('0x34')]['find']({'where':{'id':_0x27496b[_0x76eb('0x3a')]['id']}})[_0x76eb('0xa')](handleEntityNotFound(_0x3e899d,null))[_0x76eb('0xa')](saveUpdates(_0x27496b[_0x76eb('0x3f')],null))[_0x76eb('0xa')](function(_0x51e37a){if(_0x51e37a){_0x2721bb=_0x51e37a;return db['Network'][_0x76eb('0x37')]({'where':{'type':_0x2721bb[_0x76eb('0x31')]},'raw':!![]});}return null;})[_0x76eb('0xa')](function(_0x4a5c03){if(_0x2721bb[_0x76eb('0x31')][_0x76eb('0x40')]()=='STUN'){var _0x453214=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],'server/files/templates/stun_multiple.ejs'),_0x76eb('0x4b'));var _0x1270b0=ejs['render'](_0x453214,{'networks':_0x4a5c03||[]});fs[_0x76eb('0x44')]('/etc/asterisk/stun_xcally.conf',_0x1270b0);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x52'),{'module':_0x76eb('0x47')});}else if(_0x2721bb['type']['toUpperCase']()==_0x76eb('0x53')){var _0xce2314=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x76eb('0x4b'));var _0x506783=ejs[_0x76eb('0x4c')](_0xce2314,{'networks':_0x4a5c03||[]});fs[_0x76eb('0x44')]('/etc/asterisk/turn_xcally.conf',_0x506783);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x52'),{'module':_0x76eb('0x47')});}else{var _0xf89e3f=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x4d')),_0x76eb('0x4b'));var _0x14f6e3=ejs[_0x76eb('0x4c')](_0xf89e3f,{'networks':_0x4a5c03||[]});fs[_0x76eb('0x44')](util[_0x76eb('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x27496b[_0x76eb('0x3f')][_0x76eb('0x31')][_0x76eb('0x50')]()),_0x14f6e3);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x52'),{'module':_0x76eb('0x51')});}})['then'](function(_0x5e3df8){if(_0x5e3df8){return _0x2721bb;}return null;})[_0x76eb('0xa')](respondWithResult(_0x3e899d,null))[_0x76eb('0x13')](handleError(_0x3e899d,null));};exports['destroy']=function(_0xb946ed,_0x437956){var _0x212fc1;return db['Network']['find']({'where':{'id':_0xb946ed[_0x76eb('0x3a')]['id']}})['then'](function(_0xbfc4b3){_0x212fc1=_0xbfc4b3;return _0xbfc4b3;})[_0x76eb('0xa')](handleEntityNotFound(_0x437956,null))['then'](removeEntity(_0x437956,null))[_0x76eb('0xa')](function(){if(_0x212fc1){return db[_0x76eb('0x34')][_0x76eb('0x37')]({'where':{'type':_0x212fc1[_0x76eb('0x31')]},'raw':!![]});}})[_0x76eb('0xa')](function(_0x5c8443){if(_0x212fc1[_0x76eb('0x31')][_0x76eb('0x40')]()==_0x76eb('0x41')){var _0x5afb55=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x43')),_0x76eb('0x4b'));var _0x145717=ejs[_0x76eb('0x4c')](_0x5afb55,{'networks':_0x5c8443||[]});fs['writeFileSync'](_0x76eb('0x45'),_0x145717);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x1b'),{'module':_0x76eb('0x47')});}else if(_0x212fc1[_0x76eb('0x31')][_0x76eb('0x40')]()=='TURN'){var _0x82cfdf=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x4a')),_0x76eb('0x4b'));var _0x4de1ee=ejs[_0x76eb('0x4c')](_0x82cfdf,{'networks':_0x5c8443||[]});fs[_0x76eb('0x44')](_0x76eb('0x54'),_0x4de1ee);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x1b'),{'module':_0x76eb('0x47')});}else{var _0x480309=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],'server/files/templates/network.ejs'),_0x76eb('0x4b'));var _0x1ced04=ejs['render'](_0x480309,{'networks':_0x5c8443||[]});fs[_0x76eb('0x44')](util[_0x76eb('0x4e')](_0x76eb('0x4f'),_0x212fc1[_0x76eb('0x31')]['toLowerCase']()),_0x1ced04);return respondWithRpcPromise(_0x76eb('0x46'),'destroy',{'module':'chan_sip.so'});}})[_0x76eb('0x13')](handleError(_0x437956,null));}; \ No newline at end of file +var _0xa535=['/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','params','chan_sip.so','destroy','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','error','message','Network,\x20%s,\x20%s','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','sort','pick','merge','where','VIRTUAL','filter','Network','include','findAll','rows','length','includeAll','options','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format'];(function(_0x55f2a1,_0x5b2be6){var _0x2b80bf=function(_0x1373ba){while(--_0x1373ba){_0x55f2a1['push'](_0x55f2a1['shift']());}};_0x2b80bf(++_0x5b2be6);}(_0xa535,0x105));var _0x5a53=function(_0x480951,_0x5e5767){_0x480951=_0x480951-0x0;var _0xa98054=_0xa535[_0x480951];return _0xa98054;};'use strict';var util=require(_0x5a53('0x0'));var path=require(_0x5a53('0x1'));var ejs=require(_0x5a53('0x2'));var fs=require('fs');var _=require(_0x5a53('0x3'));var qs=require(_0x5a53('0x4'));var logger=require('../../config/logger')(_0x5a53('0x5'));var config=require(_0x5a53('0x6'));var db=require(_0x5a53('0x7'))['db'];var jayson=require(_0x5a53('0x8'));var client=jayson[_0x5a53('0x9')][_0x5a53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x171e0e,_0x2bb84d,_0x3799f3,_0x389206){return new Promise(function(_0x6567d5,_0x56107b){var _0x1cc84e=_0x389206||client;return _0x1cc84e[_0x5a53('0xb')](_0x171e0e,_0x3799f3)['then'](function(_0x308e3f){logger[_0x5a53('0xc')]('Network,\x20%s,\x20%s',_0x2bb84d,_0x5a53('0xd'));logger[_0x5a53('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x2bb84d,'request\x20sent',JSON['stringify'](_0x308e3f));if(_0x308e3f[_0x5a53('0xf')]){if(_0x308e3f[_0x5a53('0xf')]['code']===0x1f4){logger[_0x5a53('0xf')]('Network,\x20%s,\x20%s',_0x2bb84d,_0x308e3f[_0x5a53('0xf')][_0x5a53('0x10')]);return _0x56107b(_0x308e3f[_0x5a53('0xf')]['message']);}logger[_0x5a53('0xf')]('Network,\x20%s,\x20%s',_0x2bb84d,_0x308e3f[_0x5a53('0xf')]['message']);return _0x6567d5(_0x308e3f[_0x5a53('0xf')][_0x5a53('0x10')]);}else{logger[_0x5a53('0xc')](_0x5a53('0x11'),_0x2bb84d,'request\x20sent');_0x6567d5(_0x308e3f[_0x5a53('0x12')][_0x5a53('0x10')]);}})[_0x5a53('0x13')](function(_0x41bb57){logger[_0x5a53('0xf')](_0x5a53('0x11'),_0x2bb84d,_0x41bb57);_0x56107b(_0x41bb57);});});}function respondWithResult(_0x4c69fa,_0x471248){_0x471248=_0x471248||0xc8;return function(_0x264139){if(_0x264139){return _0x4c69fa[_0x5a53('0x14')](_0x471248)[_0x5a53('0x15')](_0x264139);}};}function respondWithFilteredResult(_0x3f5ed6,_0x243182){return function(_0xc1d5c0){if(_0xc1d5c0){var _0x519371=typeof _0x243182[_0x5a53('0x16')]===_0x5a53('0x17')&&typeof _0x243182['limit']==='undefined';var _0x2e2037=_0xc1d5c0[_0x5a53('0x18')];var _0x870e62=_0x519371?0x0:_0x243182['offset'];var _0x141cf9=_0x519371?_0xc1d5c0['count']:_0x243182[_0x5a53('0x16')]+_0x243182[_0x5a53('0x19')];var _0x4e64c3;if(_0x141cf9>=_0x2e2037){_0x141cf9=_0x2e2037;_0x4e64c3=0xc8;}else{_0x4e64c3=0xce;}_0x3f5ed6[_0x5a53('0x14')](_0x4e64c3);return _0x3f5ed6[_0x5a53('0x1a')](_0x5a53('0x1b'),_0x870e62+'-'+_0x141cf9+'/'+_0x2e2037)[_0x5a53('0x15')](_0xc1d5c0);}return null;};}function saveUpdates(_0x15e03d){return function(_0x54f856){if(_0x54f856){return _0x54f856[_0x5a53('0x1c')](_0x15e03d)[_0x5a53('0x1d')](function(_0x248a2b){return _0x248a2b;});}return null;};}function removeEntity(_0x15a54a){return function(_0x5bb8a4){if(_0x5bb8a4){return _0x5bb8a4['destroy']()['then'](function(){_0x15a54a['status'](0xcc)[_0x5a53('0x1e')]();});}};}function handleEntityNotFound(_0x4563dd){return function(_0x158819){if(!_0x158819){_0x4563dd[_0x5a53('0x1f')](0x194);}return _0x158819;};}function handleError(_0x17e1df,_0x3b097a){_0x3b097a=_0x3b097a||0x1f4;return function(_0x11695a){logger[_0x5a53('0xf')](_0x11695a[_0x5a53('0x20')]);if(_0x11695a[_0x5a53('0x21')]){delete _0x11695a[_0x5a53('0x21')];}_0x17e1df[_0x5a53('0x14')](_0x3b097a)['send'](_0x11695a);};}exports[_0x5a53('0x22')]=function(_0x101cfd,_0x26a557){var _0x6221f0={},_0x36c171={},_0x343860={'count':0x0,'rows':[]};var _0x4291a0=_[_0x5a53('0x23')](db['Network'][_0x5a53('0x24')],function(_0x31427c){return{'name':_0x31427c[_0x5a53('0x25')],'type':_0x31427c[_0x5a53('0x26')][_0x5a53('0x27')]};});_0x36c171['model']=_[_0x5a53('0x23')](_0x4291a0,_0x5a53('0x21'));_0x36c171['query']=_[_0x5a53('0x28')](_0x101cfd['query']);_0x36c171[_0x5a53('0x29')]=_['intersection'](_0x36c171[_0x5a53('0x2a')],_0x36c171[_0x5a53('0x2b')]);_0x6221f0[_0x5a53('0x2c')]=_[_0x5a53('0x2d')](_0x36c171['model'],qs[_0x5a53('0x2e')](_0x101cfd[_0x5a53('0x2b')][_0x5a53('0x2e')]));_0x6221f0[_0x5a53('0x2c')]=_0x6221f0[_0x5a53('0x2c')]['length']?_0x6221f0[_0x5a53('0x2c')]:_0x36c171['model'];if(!_0x101cfd[_0x5a53('0x2b')]['hasOwnProperty']('nolimit')){_0x6221f0[_0x5a53('0x19')]=qs[_0x5a53('0x19')](_0x101cfd['query'][_0x5a53('0x19')]);_0x6221f0[_0x5a53('0x16')]=qs[_0x5a53('0x16')](_0x101cfd[_0x5a53('0x2b')]['offset']);}_0x6221f0['order']=qs[_0x5a53('0x2f')](_0x101cfd[_0x5a53('0x2b')]['sort']);_0x6221f0['where']=qs[_0x5a53('0x29')](_[_0x5a53('0x30')](_0x101cfd['query'],_0x36c171['filters']),_0x4291a0);if(_0x101cfd['query']['filter']){_0x6221f0['where']=_[_0x5a53('0x31')](_0x6221f0[_0x5a53('0x32')],{'$or':_['map'](_0x4291a0,function(_0x43f2d0){if(_0x43f2d0[_0x5a53('0x26')]!==_0x5a53('0x33')){var _0x12c0ae={};_0x12c0ae[_0x43f2d0[_0x5a53('0x21')]]={'$like':'%'+_0x101cfd['query'][_0x5a53('0x34')]+'%'};return _0x12c0ae;}})});}_0x6221f0=_['merge']({},_0x6221f0,_0x101cfd['options']);var _0x3cc556={'where':_0x6221f0[_0x5a53('0x32')]};return db[_0x5a53('0x35')]['count'](_0x3cc556)[_0x5a53('0x1d')](function(_0x4ea61f){_0x343860[_0x5a53('0x18')]=_0x4ea61f;if(_0x101cfd[_0x5a53('0x2b')]['includeAll']){_0x6221f0[_0x5a53('0x36')]=[{'all':!![]}];}return db[_0x5a53('0x35')][_0x5a53('0x37')](_0x6221f0);})['then'](function(_0x346875){_0x343860[_0x5a53('0x38')]=_0x346875;return _0x343860;})[_0x5a53('0x1d')](respondWithFilteredResult(_0x26a557,_0x6221f0))[_0x5a53('0x13')](handleError(_0x26a557,null));};exports['show']=function(_0x2ef696,_0x4f0b92){var _0x5b550d={'raw':!![],'where':{'id':_0x2ef696['params']['id']}},_0x836518={};_0x836518[_0x5a53('0x2a')]=_[_0x5a53('0x28')](db['Network'][_0x5a53('0x24')]);_0x836518[_0x5a53('0x2b')]=_[_0x5a53('0x28')](_0x2ef696['query']);_0x836518[_0x5a53('0x29')]=_[_0x5a53('0x2d')](_0x836518['model'],_0x836518[_0x5a53('0x2b')]);_0x5b550d['attributes']=_[_0x5a53('0x2d')](_0x836518[_0x5a53('0x2a')],qs[_0x5a53('0x2e')](_0x2ef696[_0x5a53('0x2b')]['fields']));_0x5b550d[_0x5a53('0x2c')]=_0x5b550d['attributes'][_0x5a53('0x39')]?_0x5b550d[_0x5a53('0x2c')]:_0x836518[_0x5a53('0x2a')];if(_0x2ef696['query'][_0x5a53('0x3a')]){_0x5b550d[_0x5a53('0x36')]=[{'all':!![]}];}_0x5b550d=_['merge']({},_0x5b550d,_0x2ef696[_0x5a53('0x3b')]);return db[_0x5a53('0x35')][_0x5a53('0x3c')](_0x5b550d)[_0x5a53('0x1d')](handleEntityNotFound(_0x4f0b92,null))[_0x5a53('0x1d')](respondWithResult(_0x4f0b92,null))[_0x5a53('0x13')](handleError(_0x4f0b92,null));};exports[_0x5a53('0x3d')]=function(_0x17b07e,_0x42b4e9){var _0x5b8d59;return db[_0x5a53('0x35')]['create'](_0x17b07e[_0x5a53('0x3e')],{'raw':!![]})['then'](function(_0x4b70d3){_0x5b8d59=_0x4b70d3;return db[_0x5a53('0x35')][_0x5a53('0x37')]({'where':{'type':_0x17b07e['body'][_0x5a53('0x26')]},'raw':!![]});})['then'](function(_0x1de50e){if(_0x5b8d59[_0x5a53('0x26')][_0x5a53('0x3f')]()==_0x5a53('0x40')){var _0x5ca275=fs[_0x5a53('0x41')](path[_0x5a53('0x42')](config[_0x5a53('0x43')],_0x5a53('0x44')),_0x5a53('0x45'));var _0x550dff=ejs[_0x5a53('0x46')](_0x5ca275,{'networks':_0x1de50e||[]});fs[_0x5a53('0x47')](_0x5a53('0x48'),_0x550dff);return respondWithRpcPromise('Reload',_0x5a53('0x3d'),{'module':_0x5a53('0x49')});}else if(_0x5b8d59[_0x5a53('0x26')][_0x5a53('0x3f')]()==_0x5a53('0x4a')){var _0x25b1c8=fs[_0x5a53('0x41')](path[_0x5a53('0x42')](config['root'],_0x5a53('0x4b')),_0x5a53('0x45'));var _0x522a78=ejs['render'](_0x25b1c8,{'networks':_0x1de50e||[]});fs[_0x5a53('0x47')](_0x5a53('0x4c'),_0x522a78);return respondWithRpcPromise('Reload','create',{'module':_0x5a53('0x49')});}else{var _0x2f97f3=fs[_0x5a53('0x41')](path[_0x5a53('0x42')](config[_0x5a53('0x43')],_0x5a53('0x4d')),_0x5a53('0x45'));var _0x153cc2=ejs['render'](_0x2f97f3,{'networks':_0x1de50e||[]});fs['writeFileSync'](util[_0x5a53('0x4e')](_0x5a53('0x4f'),_0x17b07e[_0x5a53('0x3e')][_0x5a53('0x26')][_0x5a53('0x50')]()),_0x153cc2);return respondWithRpcPromise(_0x5a53('0x51'),_0x5a53('0x3d'),{'module':'chan_sip.so'});}})[_0x5a53('0x1d')](function(){return _0x5b8d59;})[_0x5a53('0x1d')](respondWithResult(_0x42b4e9,0xc9))[_0x5a53('0x13')](handleError(_0x42b4e9,null));};exports[_0x5a53('0x1c')]=function(_0x27b453,_0x47b2d5){var _0xf8964d;return db[_0x5a53('0x35')]['find']({'where':{'id':_0x27b453[_0x5a53('0x52')]['id']}})[_0x5a53('0x1d')](handleEntityNotFound(_0x47b2d5,null))[_0x5a53('0x1d')](saveUpdates(_0x27b453[_0x5a53('0x3e')],null))[_0x5a53('0x1d')](function(_0x23cd77){if(_0x23cd77){_0xf8964d=_0x23cd77;return db[_0x5a53('0x35')]['findAll']({'where':{'type':_0xf8964d['type']},'raw':!![]});}return null;})[_0x5a53('0x1d')](function(_0x5a28f3){if(_0xf8964d[_0x5a53('0x26')][_0x5a53('0x3f')]()==_0x5a53('0x40')){var _0x1c5bbf=fs[_0x5a53('0x41')](path[_0x5a53('0x42')](config[_0x5a53('0x43')],'server/files/templates/stun_multiple.ejs'),_0x5a53('0x45'));var _0x43ab88=ejs[_0x5a53('0x46')](_0x1c5bbf,{'networks':_0x5a28f3||[]});fs['writeFileSync'](_0x5a53('0x48'),_0x43ab88);return respondWithRpcPromise('Reload',_0x5a53('0x1c'),{'module':_0x5a53('0x49')});}else if(_0xf8964d[_0x5a53('0x26')][_0x5a53('0x3f')]()==_0x5a53('0x4a')){var _0x552f60=fs[_0x5a53('0x41')](path[_0x5a53('0x42')](config[_0x5a53('0x43')],_0x5a53('0x4b')),_0x5a53('0x45'));var _0x40a84f=ejs[_0x5a53('0x46')](_0x552f60,{'networks':_0x5a28f3||[]});fs[_0x5a53('0x47')](_0x5a53('0x4c'),_0x40a84f);return respondWithRpcPromise('Reload','update',{'module':_0x5a53('0x49')});}else{var _0x530814=fs[_0x5a53('0x41')](path[_0x5a53('0x42')](config[_0x5a53('0x43')],'server/files/templates/network.ejs'),_0x5a53('0x45'));var _0x15c628=ejs[_0x5a53('0x46')](_0x530814,{'networks':_0x5a28f3||[]});fs['writeFileSync'](util[_0x5a53('0x4e')](_0x5a53('0x4f'),_0x27b453[_0x5a53('0x3e')][_0x5a53('0x26')][_0x5a53('0x50')]()),_0x15c628);return respondWithRpcPromise(_0x5a53('0x51'),'update',{'module':_0x5a53('0x53')});}})['then'](function(_0x5e8e85){if(_0x5e8e85){return _0xf8964d;}return null;})['then'](respondWithResult(_0x47b2d5,null))[_0x5a53('0x13')](handleError(_0x47b2d5,null));};exports[_0x5a53('0x54')]=function(_0x210d56,_0x528318){var _0x26034a;return db[_0x5a53('0x35')][_0x5a53('0x3c')]({'where':{'id':_0x210d56[_0x5a53('0x52')]['id']}})[_0x5a53('0x1d')](function(_0x1831cf){_0x26034a=_0x1831cf;return _0x1831cf;})['then'](handleEntityNotFound(_0x528318,null))[_0x5a53('0x1d')](removeEntity(_0x528318,null))[_0x5a53('0x1d')](function(){if(_0x26034a){return db[_0x5a53('0x35')][_0x5a53('0x37')]({'where':{'type':_0x26034a[_0x5a53('0x26')]},'raw':!![]});}})[_0x5a53('0x1d')](function(_0x4c6e3e){if(_0x26034a[_0x5a53('0x26')][_0x5a53('0x3f')]()==_0x5a53('0x40')){var _0xf8363f=fs[_0x5a53('0x41')](path[_0x5a53('0x42')](config[_0x5a53('0x43')],_0x5a53('0x44')),'utf8');var _0x328447=ejs['render'](_0xf8363f,{'networks':_0x4c6e3e||[]});fs[_0x5a53('0x47')](_0x5a53('0x48'),_0x328447);return respondWithRpcPromise(_0x5a53('0x51'),'destroy',{'module':_0x5a53('0x49')});}else if(_0x26034a[_0x5a53('0x26')][_0x5a53('0x3f')]()==_0x5a53('0x4a')){var _0x120404=fs[_0x5a53('0x41')](path['join'](config['root'],_0x5a53('0x4b')),_0x5a53('0x45'));var _0x311793=ejs['render'](_0x120404,{'networks':_0x4c6e3e||[]});fs[_0x5a53('0x47')]('/etc/asterisk/turn_xcally.conf',_0x311793);return respondWithRpcPromise(_0x5a53('0x51'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x4eeee4=fs['readFileSync'](path['join'](config[_0x5a53('0x43')],_0x5a53('0x4d')),'utf8');var _0x28657b=ejs[_0x5a53('0x46')](_0x4eeee4,{'networks':_0x4c6e3e||[]});fs[_0x5a53('0x47')](util[_0x5a53('0x4e')](_0x5a53('0x4f'),_0x26034a['type']['toLowerCase']()),_0x28657b);return respondWithRpcPromise(_0x5a53('0x51'),_0x5a53('0x54'),{'module':_0x5a53('0x53')});}})[_0x5a53('0x13')](handleError(_0x528318,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 28c27b0..7acf52e 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Network','network','lodash'];(function(_0x4bab98,_0xfd0b2d){var _0x4be4fb=function(_0x12cac){while(--_0x12cac){_0x4bab98['push'](_0x4bab98['shift']());}};_0x4be4fb(++_0xfd0b2d);}(_0xdace,0xc5));var _0xedac=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xdace[_0x45fc6a];return _0x14bcfd;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./network.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b32=['exports','define','Network','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes'];(function(_0x1df754,_0x6b20a9){var _0x34ece4=function(_0x10f67f){while(--_0x10f67f){_0x1df754['push'](_0x1df754['shift']());}};_0x34ece4(++_0x6b20a9);}(_0x1b32,0x85));var _0x21b3=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x1b32[_0x12f688];return _0x59c3de;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var logger=require(_0x21b3('0x1'))(_0x21b3('0x2'));var moment=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var rp=require(_0x21b3('0x5'));var fs=require('fs');var path=require(_0x21b3('0x6'));var rimraf=require(_0x21b3('0x7'));var config=require(_0x21b3('0x8'));var attributes=require(_0x21b3('0x9'));module[_0x21b3('0xa')]=function(_0x403803,_0x37859f){return _0x403803[_0x21b3('0xb')](_0x21b3('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ca88d42..43189ff 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1798c6,_0x3d2cfd){var _0x33c68c=function(_0x5db3e1){while(--_0x5db3e1){_0x1798c6['push'](_0x1798c6['shift']());}};_0x33c68c(++_0x3d2cfd);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x338246,_0x3d12ce){var _0x50b97c=function(_0x3dfcf5){while(--_0x3dfcf5){_0x338246['push'](_0x338246['shift']());}};_0x50b97c(++_0x3d12ce);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 0e09c30..c2b87c3 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 _0x6a95=['/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/notify','notify','addApplications','addAgents','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x6a95,0x1db));var _0x56a9=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6a95[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var path=require(_0x56a9('0x2'));var timeout=require(_0x56a9('0x3'));var express=require(_0x56a9('0x4'));var router=express[_0x56a9('0x5')]();var fs_extra=require(_0x56a9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x56a9('0x7'));var controller=require(_0x56a9('0x8'));router[_0x56a9('0x9')]('/',auth[_0x56a9('0xa')](),controller[_0x56a9('0xb')]);router[_0x56a9('0x9')](_0x56a9('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x56a9('0x9')](_0x56a9('0xd'),auth['isAuthenticated'](),controller[_0x56a9('0xe')]);router[_0x56a9('0x9')](_0x56a9('0xf'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x10')]);router[_0x56a9('0x9')](_0x56a9('0x11'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x12')]);router['get'](_0x56a9('0x13'),auth['isAuthenticated'](),controller[_0x56a9('0x14')]);router[_0x56a9('0x9')](_0x56a9('0x15'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x16')]);router[_0x56a9('0x9')](_0x56a9('0x17'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x18')]);router['post']('/',auth['isAuthenticated'](),controller[_0x56a9('0x19')]);router[_0x56a9('0x1a')](_0x56a9('0xf'),auth[_0x56a9('0xa')](),controller['addDisposition']);router[_0x56a9('0x1a')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x56a9('0x1a')](_0x56a9('0x1b'),controller[_0x56a9('0x1c')]);router[_0x56a9('0x1a')](_0x56a9('0x13'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x1d')]);router[_0x56a9('0x1a')](_0x56a9('0x17'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x1e')]);router[_0x56a9('0x1a')]('/:id/send',auth['isAuthenticated'](),controller[_0x56a9('0x1f')]);router[_0x56a9('0x20')](_0x56a9('0xd'),auth[_0x56a9('0xa')](),controller['update']);router[_0x56a9('0x21')](_0x56a9('0xd'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x22')]);router['delete'](_0x56a9('0xf'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x23')]);router[_0x56a9('0x21')](_0x56a9('0x11'),auth['isAuthenticated'](),controller[_0x56a9('0x24')]);router[_0x56a9('0x21')](_0x56a9('0x17'),auth['isAuthenticated'](),controller[_0x56a9('0x25')]);module['exports']=router; \ No newline at end of file +var _0x056b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getAnswers','/:id/applications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','put','delete','/:id','destroy','removeDispositions','/:id/canned_answers','removeAgents','exports','util','path','connect-timeout'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x056b,0xb6));var _0xb056=function(_0x2b1b8d,_0x24ed2f){_0x2b1b8d=_0x2b1b8d-0x0;var _0x51f032=_0x056b[_0x2b1b8d];return _0x51f032;};'use strict';var multer=require('multer');var util=require(_0xb056('0x0'));var path=require(_0xb056('0x1'));var timeout=require(_0xb056('0x2'));var express=require(_0xb056('0x3'));var router=express[_0xb056('0x4')]();var fs_extra=require(_0xb056('0x5'));var auth=require(_0xb056('0x6'));var interaction=require(_0xb056('0x7'));var config=require(_0xb056('0x8'));var controller=require(_0xb056('0x9'));router[_0xb056('0xa')]('/',auth['isAuthenticated'](),controller[_0xb056('0xb')]);router[_0xb056('0xa')](_0xb056('0xc'),auth[_0xb056('0xd')](),controller[_0xb056('0xe')]);router[_0xb056('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb056('0xf')]);router[_0xb056('0xa')](_0xb056('0x10'),auth[_0xb056('0xd')](),controller['getDispositions']);router[_0xb056('0xa')]('/:id/canned_answers',auth[_0xb056('0xd')](),controller[_0xb056('0x11')]);router[_0xb056('0xa')](_0xb056('0x12'),auth[_0xb056('0xd')](),controller['getApplications']);router['get'](_0xb056('0x13'),auth[_0xb056('0xd')](),controller['getInteractions']);router[_0xb056('0xa')](_0xb056('0x14'),auth[_0xb056('0xd')](),controller[_0xb056('0x15')]);router[_0xb056('0x16')]('/',auth[_0xb056('0xd')](),controller[_0xb056('0x17')]);router['post'](_0xb056('0x10'),auth[_0xb056('0xd')](),controller[_0xb056('0x18')]);router[_0xb056('0x16')]('/:id/canned_answers',auth[_0xb056('0xd')](),controller['addAnswer']);router[_0xb056('0x16')](_0xb056('0x19'),controller['notify']);router[_0xb056('0x16')]('/:id/applications',auth[_0xb056('0xd')](),controller[_0xb056('0x1a')]);router['post'](_0xb056('0x14'),auth['isAuthenticated'](),controller[_0xb056('0x1b')]);router[_0xb056('0x16')](_0xb056('0x1c'),auth[_0xb056('0xd')](),controller['send']);router[_0xb056('0x1d')]('/:id',auth[_0xb056('0xd')](),controller['update']);router[_0xb056('0x1e')](_0xb056('0x1f'),auth[_0xb056('0xd')](),controller[_0xb056('0x20')]);router[_0xb056('0x1e')](_0xb056('0x10'),auth['isAuthenticated'](),controller[_0xb056('0x21')]);router[_0xb056('0x1e')](_0xb056('0x22'),auth[_0xb056('0xd')](),controller['removeAnswers']);router[_0xb056('0x1e')](_0xb056('0x14'),auth['isAuthenticated'](),controller[_0xb056('0x23')]);module[_0xb056('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index b10f3ea..0a3379d 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 _0x763b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x5db649,_0x39e176){var _0x405470=function(_0x291729){while(--_0x291729){_0x5db649['push'](_0x5db649['shift']());}};_0x405470(++_0x39e176);}(_0x763b,0x13c));var _0xb763=function(_0x4b1236,_0x5993a5){_0x4b1236=_0x4b1236-0x0;var _0x45d450=_0x763b[_0x4b1236];return _0x45d450;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xb763('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb763('0x1')]},'token':{'type':Sequelize[_0xb763('0x1')],'defaultValue':function(){return rs[_0xb763('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb763('0x3')],'defaultValue':function(){return _0xb763('0x4');}},'notificationSound':{'type':Sequelize[_0xb763('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb763('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb763('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb763('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb763('0x1')]},'queueTransfer':{'type':Sequelize[_0xb763('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb763('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb763('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb763('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb763('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xb763('0x5')],'defaultValue':![],'comment':_0xb763('0x8'),'set':function(_0x2dafcd){if(!_0x2dafcd)this[_0xb763('0x9')](_0xb763('0xa'),null);this[_0xb763('0x9')](_0xb763('0xb'),_0x2dafcd);}}}; \ No newline at end of file +var _0xaa8e=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','TEXT'];(function(_0x3c32a7,_0x3a2204){var _0x5417a8=function(_0x1f29f4){while(--_0x1f29f4){_0x3c32a7['push'](_0x3c32a7['shift']());}};_0x5417a8(++_0x3a2204);}(_0xaa8e,0x17b));var _0xeaa8=function(_0x37e20f,_0x2b16ec){_0x37e20f=_0x37e20f-0x0;var _0x32a6dd=_0xaa8e[_0x37e20f];return _0x32a6dd;};'use strict';var Sequelize=require(_0xeaa8('0x0'));var rs=require('randomstring');module[_0xeaa8('0x1')]={'name':{'type':Sequelize[_0xeaa8('0x2')],'unique':_0xeaa8('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xeaa8('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xeaa8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xeaa8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xeaa8('0x4')],'defaultValue':function(){return _0xeaa8('0x5');}},'notificationSound':{'type':Sequelize[_0xeaa8('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeaa8('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xeaa8('0x2')]},'queueTransfer':{'type':Sequelize[_0xeaa8('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeaa8('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xeaa8('0x8'),'set':function(_0x211761){if(!_0x211761)this[_0xeaa8('0x9')](_0xeaa8('0xa'),null);this[_0xeaa8('0x9')](_0xeaa8('0xb'),_0x211761);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 979e083..3f099b7 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 _0x6934=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','sendStatus','stack','name','send','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','update','Pause','describe','addDisposition','Disposition','findOne','pick','OpenchannelAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','Applications','List','account','applications','orderBy','priority','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','created','interaction','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','queue','Start','startRouting','EventManager','addApplications','sequelize','Transaction','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','addAgents','ids','omit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','emit','getAgents','CmList','out','spread','dataValues','Messages','eml-format'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x6934,0x17f));var _0x4693=function(_0x4afb13,_0x4a6cee){_0x4afb13=_0x4afb13-0x0;var _0x2ca126=_0x6934[_0x4afb13];return _0x2ca126;};'use strict';var emlformat=require(_0x4693('0x0'));var rimraf=require(_0x4693('0x1'));var zipdir=require(_0x4693('0x2'));var jsonpatch=require(_0x4693('0x3'));var rp=require(_0x4693('0x4'));var moment=require('moment');var BPromise=require(_0x4693('0x5'));var Mustache=require(_0x4693('0x6'));var util=require(_0x4693('0x7'));var path=require(_0x4693('0x8'));var sox=require('sox');var csv=require(_0x4693('0x9'));var ejs=require(_0x4693('0xa'));var fs=require('fs');var fs_extra=require(_0x4693('0xb'));var _=require(_0x4693('0xc'));var squel=require(_0x4693('0xd'));var crypto=require(_0x4693('0xe'));var jsforce=require(_0x4693('0xf'));var deskjs=require(_0x4693('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4693('0x11'));var Redis=require(_0x4693('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4693('0x13'));var as=require(_0x4693('0x14'));var hardwareService=require(_0x4693('0x15'));var logger=require('../../config/logger')(_0x4693('0x16'));var utils=require(_0x4693('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4693('0x18'));var db=require(_0x4693('0x19'))['db'];config[_0x4693('0x1a')]=_[_0x4693('0x1b')](config[_0x4693('0x1a')],{'host':_0x4693('0x1c'),'port':0x18eb});var socket=require(_0x4693('0x1d'))(new Redis(config[_0x4693('0x1a')]));require(_0x4693('0x1e'))[_0x4693('0x1f')](socket);var jayson=require(_0x4693('0x20'));var client=jayson[_0x4693('0x21')][_0x4693('0x22')]({'port':0x232c});var client9002=jayson[_0x4693('0x21')][_0x4693('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3f7a6e,_0x502c77,_0xe7c815,_0x31ac01){return new BPromise(function(_0x16d180,_0x23d85c){var _0x19bddf=_0x31ac01||client;return _0x19bddf[_0x4693('0x23')](_0x3f7a6e,_0xe7c815)[_0x4693('0x24')](function(_0x5759ff){logger[_0x4693('0x25')](_0x4693('0x26'),_0x502c77,_0x4693('0x27'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x502c77,_0x4693('0x27'),JSON[_0x4693('0x28')](_0x5759ff));if(_0x5759ff[_0x4693('0x29')]){if(_0x5759ff[_0x4693('0x29')][_0x4693('0x2a')]===0x1f4){logger[_0x4693('0x29')](_0x4693('0x26'),_0x502c77,_0x5759ff[_0x4693('0x29')][_0x4693('0x2b')]);return _0x23d85c(_0x5759ff[_0x4693('0x29')][_0x4693('0x2b')]);}logger[_0x4693('0x29')](_0x4693('0x26'),_0x502c77,_0x5759ff[_0x4693('0x29')][_0x4693('0x2b')]);return _0x16d180(_0x5759ff[_0x4693('0x29')][_0x4693('0x2b')]);}else{logger[_0x4693('0x25')](_0x4693('0x26'),_0x502c77,_0x4693('0x27'));_0x16d180(_0x5759ff[_0x4693('0x2c')]['message']);}})['catch'](function(_0xfa3c6d){logger[_0x4693('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x502c77,_0xfa3c6d);_0x23d85c(_0xfa3c6d);});});}function respondWithStatusCode(_0x27d2d7,_0x38e859){_0x38e859=_0x38e859||0xcc;return function(_0x5199b9){if(_0x5199b9){return _0x27d2d7['sendStatus'](_0x38e859);}return _0x27d2d7[_0x4693('0x2d')](_0x38e859)[_0x4693('0x2e')]();};}function respondWithResult(_0x13fb51,_0x19613d){_0x19613d=_0x19613d||0xc8;return function(_0x3bf39d){if(_0x3bf39d){return _0x13fb51['status'](_0x19613d)[_0x4693('0x2f')](_0x3bf39d);}};}function respondWithFilteredResult(_0x41d988,_0x49ab47){return function(_0x538068){if(_0x538068){var _0x5b397c=typeof _0x49ab47[_0x4693('0x30')]===_0x4693('0x31')&&typeof _0x49ab47[_0x4693('0x32')]===_0x4693('0x31');var _0x5bfc91=_0x538068['count'];var _0x5d608f=_0x5b397c?0x0:_0x49ab47['offset'];var _0x3c8be9=_0x5b397c?_0x538068[_0x4693('0x33')]:_0x49ab47[_0x4693('0x30')]+_0x49ab47[_0x4693('0x32')];var _0x11936f;if(_0x3c8be9>=_0x5bfc91){_0x3c8be9=_0x5bfc91;_0x11936f=0xc8;}else{_0x11936f=0xce;}_0x41d988[_0x4693('0x2d')](_0x11936f);return _0x41d988['set'](_0x4693('0x34'),_0x5d608f+'-'+_0x3c8be9+'/'+_0x5bfc91)[_0x4693('0x2f')](_0x538068);}return null;};}function patchUpdates(_0x46ee76){return function(_0x372880){try{jsonpatch[_0x4693('0x35')](_0x372880,_0x46ee76,!![]);}catch(_0x6daa67){return BPromise[_0x4693('0x36')](_0x6daa67);}return _0x372880[_0x4693('0x37')]();};}function saveUpdates(_0x43cc0d,_0x2c82e5){return function(_0x25d762){if(_0x25d762){return _0x25d762['update'](_0x43cc0d)[_0x4693('0x24')](function(_0x5c9dd2){return _0x5c9dd2;});}return null;};}function removeEntity(_0x3c6dfb,_0x15cd30){return function(_0x5c08da){if(_0x5c08da){return _0x5c08da[_0x4693('0x38')]()[_0x4693('0x24')](function(){var _0x2715d0=_0x5c08da[_0x4693('0x39')]({'plain':!![]});var _0x5f51a8='OpenchannelAccounts';return db['UserProfileResource'][_0x4693('0x38')]({'where':{'type':_0x5f51a8,'resourceId':_0x2715d0['id']}})[_0x4693('0x24')](function(){return _0x5c08da;});})[_0x4693('0x24')](function(){_0x3c6dfb[_0x4693('0x2d')](0xcc)[_0x4693('0x2e')]();});}};}function handleEntityNotFound(_0x519f60,_0xd17e67){return function(_0x10b80f){if(!_0x10b80f){_0x519f60[_0x4693('0x3a')](0x194);}return _0x10b80f;};}function handleError(_0x1781aa,_0x3547ee){_0x3547ee=_0x3547ee||0x1f4;return function(_0x4862bf){logger[_0x4693('0x29')](_0x4862bf[_0x4693('0x3b')]);if(_0x4862bf[_0x4693('0x3c')]){delete _0x4862bf[_0x4693('0x3c')];}_0x1781aa[_0x4693('0x2d')](_0x3547ee)[_0x4693('0x3d')](_0x4862bf);};}exports['index']=function(_0x179486,_0x38bad7){var _0x5a6648={'include':[{'model':db['Pause'],'as':_0x4693('0x3e')}]},_0xb948={},_0x4d33f0={'count':0x0,'rows':[]};var _0x452364=_['map'](db[_0x4693('0x3f')][_0x4693('0x40')],function(_0x4b59aa){return{'name':_0x4b59aa[_0x4693('0x41')],'type':_0x4b59aa[_0x4693('0x42')]['key']};});_0xb948[_0x4693('0x43')]=_[_0x4693('0x44')](_0x452364,_0x4693('0x3c'));_0xb948['query']=_[_0x4693('0x45')](_0x179486[_0x4693('0x46')]);_0xb948['filters']=_[_0x4693('0x47')](_0xb948[_0x4693('0x43')],_0xb948[_0x4693('0x46')]);_0x5a6648['attributes']=_[_0x4693('0x47')](_0xb948[_0x4693('0x43')],qs['fields'](_0x179486['query'][_0x4693('0x48')]));_0x5a6648[_0x4693('0x49')]=_0x5a6648[_0x4693('0x49')][_0x4693('0x4a')]?_0x5a6648['attributes']:_0xb948['model'];if(!_0x179486[_0x4693('0x46')][_0x4693('0x4b')](_0x4693('0x4c'))){_0x5a6648[_0x4693('0x32')]=qs['limit'](_0x179486[_0x4693('0x46')]['limit']);_0x5a6648[_0x4693('0x30')]=qs[_0x4693('0x30')](_0x179486[_0x4693('0x46')][_0x4693('0x30')]);}_0x5a6648[_0x4693('0x4d')]=qs['sort'](_0x179486[_0x4693('0x46')][_0x4693('0x4e')]);_0x5a6648['where']=qs[_0x4693('0x4f')](_['pick'](_0x179486[_0x4693('0x46')],_0xb948[_0x4693('0x4f')]),_0x452364);if(_0x179486[_0x4693('0x46')][_0x4693('0x50')]){_0x5a6648[_0x4693('0x51')]=_[_0x4693('0x52')](_0x5a6648[_0x4693('0x51')],{'$or':_[_0x4693('0x44')](_0x452364,function(_0x517506){if(_0x517506['type']!==_0x4693('0x53')){var _0x59dcfe={};_0x59dcfe[_0x517506[_0x4693('0x3c')]]={'$like':'%'+_0x179486[_0x4693('0x46')][_0x4693('0x50')]+'%'};return _0x59dcfe;}})});}_0x5a6648=_[_0x4693('0x52')]({},_0x5a6648,_0x179486[_0x4693('0x54')]);var _0x571034={'where':_0x5a6648[_0x4693('0x51')]};return db[_0x4693('0x3f')][_0x4693('0x33')](_0x571034)[_0x4693('0x24')](function(_0x39583a){_0x4d33f0[_0x4693('0x33')]=_0x39583a;if(_0x179486[_0x4693('0x46')][_0x4693('0x55')]){_0x5a6648[_0x4693('0x56')]=[{'all':!![]}];}return db[_0x4693('0x3f')]['findAll'](_0x5a6648);})[_0x4693('0x24')](function(_0x3c2b88){_0x4d33f0['rows']=_0x3c2b88;return _0x4d33f0;})[_0x4693('0x24')](respondWithFilteredResult(_0x38bad7,_0x5a6648))[_0x4693('0x57')](handleError(_0x38bad7,null));};exports[_0x4693('0x58')]=function(_0x438521,_0x2d48f3){var _0x522842={'raw':![],'where':{'id':_0x438521[_0x4693('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x4693('0x3e')}]},_0x15bb5e={};_0x15bb5e['model']=_[_0x4693('0x45')](db[_0x4693('0x3f')]['rawAttributes']);_0x15bb5e[_0x4693('0x46')]=_['keys'](_0x438521[_0x4693('0x46')]);_0x15bb5e[_0x4693('0x4f')]=_[_0x4693('0x47')](_0x15bb5e['model'],_0x15bb5e['query']);_0x522842[_0x4693('0x49')]=_[_0x4693('0x47')](_0x15bb5e[_0x4693('0x43')],qs[_0x4693('0x48')](_0x438521[_0x4693('0x46')][_0x4693('0x48')]));_0x522842[_0x4693('0x49')]=_0x522842['attributes'][_0x4693('0x4a')]?_0x522842[_0x4693('0x49')]:_0x15bb5e[_0x4693('0x43')];if(_0x438521[_0x4693('0x46')][_0x4693('0x55')]){_0x522842[_0x4693('0x56')]=[{'all':!![]}];}_0x522842=_[_0x4693('0x52')]({},_0x522842,_0x438521[_0x4693('0x54')]);return db[_0x4693('0x3f')]['find'](_0x522842)[_0x4693('0x24')](handleEntityNotFound(_0x2d48f3,null))['then'](respondWithResult(_0x2d48f3,null))[_0x4693('0x57')](handleError(_0x2d48f3,null));};exports[_0x4693('0x5a')]=function(_0x198a42,_0x2c65a2){return db[_0x4693('0x3f')]['create'](_0x198a42[_0x4693('0x5b')],{})[_0x4693('0x24')](function(_0x1f82d9){var _0x106559=_0x198a42['user'][_0x4693('0x39')]({'plain':!![]});if(!_0x106559)throw new Error(_0x4693('0x5c'));if(_0x106559['role']===_0x4693('0x5d')){var _0x52ed34=_0x1f82d9[_0x4693('0x39')]({'plain':!![]});var _0x4a20c3='OpenchannelAccounts';return db['UserProfileSection'][_0x4693('0x5e')]({'where':{'name':_0x4a20c3,'userProfileId':_0x106559[_0x4693('0x5f')]},'raw':!![]})[_0x4693('0x24')](function(_0x278350){if(_0x278350&&_0x278350['autoAssociation']===0x0){return db['UserProfileResource'][_0x4693('0x5a')]({'name':_0x52ed34[_0x4693('0x3c')],'resourceId':_0x52ed34['id'],'type':_0x278350[_0x4693('0x3c')],'sectionId':_0x278350['id']},{})['then'](function(){return _0x1f82d9;});}else{return _0x1f82d9;}})[_0x4693('0x57')](function(_0x356764){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x356764);throw _0x356764;});}return _0x1f82d9;})[_0x4693('0x24')](respondWithResult(_0x2c65a2,0xc9))[_0x4693('0x57')](handleError(_0x2c65a2,null));};exports[_0x4693('0x60')]=function(_0x5a74b6,_0x21fc83){if(_0x5a74b6[_0x4693('0x5b')]['id']){delete _0x5a74b6['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x5a74b6['params']['id']},'include':[{'model':db[_0x4693('0x61')],'as':_0x4693('0x3e')}]})[_0x4693('0x24')](handleEntityNotFound(_0x21fc83,null))['then'](saveUpdates(_0x5a74b6[_0x4693('0x5b')],null))[_0x4693('0x24')](respondWithResult(_0x21fc83,null))['catch'](handleError(_0x21fc83,null));};exports[_0x4693('0x38')]=function(_0x2b8a98,_0x44091d){return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x2b8a98[_0x4693('0x59')]['id']}})['then'](handleEntityNotFound(_0x44091d,null))[_0x4693('0x24')](removeEntity(_0x44091d,null))[_0x4693('0x57')](handleError(_0x44091d,null));};exports[_0x4693('0x62')]=function(_0x4dd105,_0x4257f1){return db[_0x4693('0x3f')][_0x4693('0x62')]()['then'](respondWithResult(_0x4257f1,null))['catch'](handleError(_0x4257f1,null));};exports[_0x4693('0x63')]=function(_0x18ecf2,_0x418b26,_0x15f073){if(_0x18ecf2[_0x4693('0x5b')]['id']){delete _0x18ecf2[_0x4693('0x5b')]['id'];}return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x18ecf2[_0x4693('0x59')]['id']}})['then'](handleEntityNotFound(_0x418b26,null))[_0x4693('0x24')](function(_0x226864){if(_0x226864){_0x18ecf2[_0x4693('0x5b')]['OpenchannelAccountId']=_0x226864['id'];return db[_0x4693('0x64')]['create'](_0x18ecf2[_0x4693('0x5b')]);}})['then'](respondWithResult(_0x418b26,null))[_0x4693('0x57')](handleError(_0x418b26,null));};exports['getDispositions']=function(_0x170d8e,_0x92a009,_0x3ef030){var _0x1b9a0d={'raw':![],'where':{}};var _0x1c0a78={};var _0x368d0f={'count':0x0,'rows':[]};return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x170d8e[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x92a009,null))[_0x4693('0x24')](function(_0x4b2f83){if(_0x4b2f83){_0x1c0a78['model']=_['keys'](db[_0x4693('0x64')][_0x4693('0x40')]);_0x1c0a78['query']=_[_0x4693('0x45')](_0x170d8e[_0x4693('0x46')]);_0x1c0a78['filters']=_[_0x4693('0x47')](_0x1c0a78[_0x4693('0x43')],_0x1c0a78[_0x4693('0x46')]);_0x1b9a0d[_0x4693('0x49')]=_[_0x4693('0x47')](_0x1c0a78[_0x4693('0x43')],qs[_0x4693('0x48')](_0x170d8e[_0x4693('0x46')][_0x4693('0x48')]));_0x1b9a0d[_0x4693('0x49')]=_0x1b9a0d['attributes'][_0x4693('0x4a')]?_0x1b9a0d[_0x4693('0x49')]:_0x1c0a78[_0x4693('0x43')];if(!_0x170d8e[_0x4693('0x46')]['hasOwnProperty'](_0x4693('0x4c'))){_0x1b9a0d[_0x4693('0x32')]=qs[_0x4693('0x32')](_0x170d8e[_0x4693('0x46')][_0x4693('0x32')]);_0x1b9a0d[_0x4693('0x30')]=qs[_0x4693('0x30')](_0x170d8e[_0x4693('0x46')][_0x4693('0x30')]);}_0x1b9a0d[_0x4693('0x4d')]=qs['sort'](_0x170d8e[_0x4693('0x46')][_0x4693('0x4e')]);_0x1b9a0d[_0x4693('0x51')]=qs[_0x4693('0x4f')](_[_0x4693('0x66')](_0x170d8e[_0x4693('0x46')],_0x1c0a78[_0x4693('0x4f')]));_0x1b9a0d[_0x4693('0x51')][_0x4693('0x67')]=_0x4b2f83['id'];if(_0x170d8e[_0x4693('0x46')][_0x4693('0x50')]){_0x1b9a0d[_0x4693('0x51')]=_[_0x4693('0x52')](_0x1b9a0d[_0x4693('0x51')],{'$or':_['map'](_0x1b9a0d[_0x4693('0x49')],function(_0x2355b6){var _0x400e1e={};_0x400e1e[_0x2355b6]={'$like':'%'+_0x170d8e[_0x4693('0x46')][_0x4693('0x50')]+'%'};return _0x400e1e;})});}_0x1b9a0d=_['merge']({},_0x1b9a0d,_0x170d8e[_0x4693('0x54')]);return db[_0x4693('0x64')][_0x4693('0x33')]({'where':_0x1b9a0d[_0x4693('0x51')]})[_0x4693('0x24')](function(_0xaa4df9){_0x368d0f[_0x4693('0x33')]=_0xaa4df9;if(_0x170d8e[_0x4693('0x46')][_0x4693('0x55')]){_0x1b9a0d[_0x4693('0x56')]=[{'all':!![]}];}return db[_0x4693('0x64')][_0x4693('0x68')](_0x1b9a0d);})[_0x4693('0x24')](function(_0x2801b1){_0x368d0f['rows']=_0x2801b1;return _0x368d0f;});}})[_0x4693('0x24')](respondWithFilteredResult(_0x92a009,_0x1b9a0d))[_0x4693('0x57')](handleError(_0x92a009,null));};exports[_0x4693('0x69')]=function(_0x26e09d,_0x537436,_0x43dfbf){return db[_0x4693('0x3f')]['find']({'where':{'id':_0x26e09d[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x537436,null))[_0x4693('0x24')](function(_0x709cc1){if(_0x709cc1){return _0x709cc1[_0x4693('0x69')](_0x26e09d['query']['ids']);}})[_0x4693('0x24')](respondWithStatusCode(_0x537436,null))[_0x4693('0x57')](handleError(_0x537436,null));};exports[_0x4693('0x6a')]=function(_0x32766b,_0x247449,_0x5eca63){if(_0x32766b[_0x4693('0x5b')]['id']){delete _0x32766b[_0x4693('0x5b')]['id'];}return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x32766b[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x247449,null))[_0x4693('0x24')](function(_0x157fc8){if(_0x157fc8){_0x32766b[_0x4693('0x5b')][_0x4693('0x67')]=_0x157fc8['id'];return db[_0x4693('0x6b')][_0x4693('0x5a')](_0x32766b[_0x4693('0x5b')]);}})[_0x4693('0x24')](respondWithResult(_0x247449,null))[_0x4693('0x57')](handleError(_0x247449,null));};exports[_0x4693('0x6c')]=function(_0x369d98,_0x2e432d,_0x5238e3){var _0x4e820c={'raw':![],'where':{}};var _0x4760a5={};var _0x2b9b4f={'count':0x0,'rows':[]};return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x369d98['params']['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x2e432d,null))[_0x4693('0x24')](function(_0x496677){if(_0x496677){_0x4760a5[_0x4693('0x43')]=_[_0x4693('0x45')](db[_0x4693('0x6b')]['rawAttributes']);_0x4760a5['query']=_[_0x4693('0x45')](_0x369d98['query']);_0x4760a5[_0x4693('0x4f')]=_[_0x4693('0x47')](_0x4760a5[_0x4693('0x43')],_0x4760a5[_0x4693('0x46')]);_0x4e820c['attributes']=_['intersection'](_0x4760a5['model'],qs[_0x4693('0x48')](_0x369d98[_0x4693('0x46')][_0x4693('0x48')]));_0x4e820c[_0x4693('0x49')]=_0x4e820c[_0x4693('0x49')]['length']?_0x4e820c['attributes']:_0x4760a5['model'];if(!_0x369d98[_0x4693('0x46')][_0x4693('0x4b')](_0x4693('0x4c'))){_0x4e820c[_0x4693('0x32')]=qs[_0x4693('0x32')](_0x369d98[_0x4693('0x46')]['limit']);_0x4e820c['offset']=qs['offset'](_0x369d98[_0x4693('0x46')][_0x4693('0x30')]);}_0x4e820c[_0x4693('0x4d')]=qs[_0x4693('0x4e')](_0x369d98[_0x4693('0x46')][_0x4693('0x4e')]);_0x4e820c[_0x4693('0x51')]=qs['filters'](_[_0x4693('0x66')](_0x369d98['query'],_0x4760a5['filters']));_0x4e820c[_0x4693('0x51')][_0x4693('0x67')]=_0x496677['id'];if(_0x369d98[_0x4693('0x46')][_0x4693('0x50')]){_0x4e820c[_0x4693('0x51')]=_[_0x4693('0x52')](_0x4e820c[_0x4693('0x51')],{'$or':_[_0x4693('0x44')](_0x4e820c[_0x4693('0x49')],function(_0x3640cc){var _0x29f2f7={};_0x29f2f7[_0x3640cc]={'$like':'%'+_0x369d98[_0x4693('0x46')][_0x4693('0x50')]+'%'};return _0x29f2f7;})});}_0x4e820c=_['merge']({},_0x4e820c,_0x369d98[_0x4693('0x54')]);return db[_0x4693('0x6b')][_0x4693('0x33')]({'where':_0x4e820c['where']})[_0x4693('0x24')](function(_0xf3db61){_0x2b9b4f[_0x4693('0x33')]=_0xf3db61;if(_0x369d98[_0x4693('0x46')][_0x4693('0x55')]){_0x4e820c['include']=[{'all':!![]}];}return db[_0x4693('0x6b')]['findAll'](_0x4e820c);})[_0x4693('0x24')](function(_0x533ece){_0x2b9b4f[_0x4693('0x6d')]=_0x533ece;return _0x2b9b4f;});}})[_0x4693('0x24')](respondWithFilteredResult(_0x2e432d,_0x4e820c))[_0x4693('0x57')](handleError(_0x2e432d,null));};exports['removeAnswers']=function(_0x332ae9,_0x1e677f,_0x80e490){return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x332ae9[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x1e677f,null))[_0x4693('0x24')](function(_0x2cd678){if(_0x2cd678){return _0x2cd678[_0x4693('0x6e')](_0x332ae9[_0x4693('0x46')]['ids']);}})[_0x4693('0x24')](respondWithStatusCode(_0x1e677f,null))[_0x4693('0x57')](handleError(_0x1e677f,null));};exports[_0x4693('0x6f')]=function(_0x48857d,_0x58d8b6,_0x2642b5){var _0x2f206d={'body':_0x48857d[_0x4693('0x5b')],'channel':_0x4693('0x70')};var _0x3d0339=[];var _0x5f4c79=[];var _0x396e3f={};var _0x20b5fa=![];return db[_0x4693('0x71')][_0x4693('0x62')]()['then'](function(_0x12ada5){if(!_0x12ada5){throw new db[(_0x4693('0x72'))]['ValidationError'](_0x4693('0x73'));}_0x3d0339=_['difference'](_[_0x4693('0x45')](_0x12ada5),[_0x4693('0x74'),_0x4693('0x75')]);_0x5f4c79=_[_0x4693('0x76')](_[_0x4693('0x45')](_0x12ada5),[_0x4693('0x74'),_0x4693('0x75'),'CompanyId',_0x4693('0x77')]);if(_0x48857d[_0x4693('0x5b')]['id']){delete _0x48857d[_0x4693('0x5b')]['id'];}if(_[_0x4693('0x78')](_0x48857d[_0x4693('0x5b')][_0x4693('0x79')])){throw new db[(_0x4693('0x72'))][(_0x4693('0x7a'))](_0x4693('0x7b'));}if(_[_0x4693('0x78')](_0x48857d['body'][_0x4693('0x5b')])||_0x48857d[_0x4693('0x5b')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x4693('0x7c'));}if(_[_0x4693('0x78')](_0x48857d['body'][_0x4693('0x7d')])){throw new db['Sequelize'][(_0x4693('0x7a'))](_0x4693('0x7e')+_0x5f4c79);}if(!_[_0x4693('0x7f')](_0x5f4c79,_0x48857d[_0x4693('0x5b')][_0x4693('0x7d')])){throw new db[(_0x4693('0x72'))]['ValidationError'](_0x4693('0x80')+_0x5f4c79);}_0x396e3f[_0x48857d['body']['mapKey']]=_0x48857d[_0x4693('0x5b')][_0x4693('0x79')];})[_0x4693('0x24')](function(){return db[_0x4693('0x3f')]['find']({'where':{'id':_0x48857d[_0x4693('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4693('0x71')],'as':_0x4693('0x81'),'where':_0x396e3f,'limit':0x1,'order':[['updatedAt',_0x4693('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0x4693('0x83')}]});})[_0x4693('0x24')](handleEntityNotFound(_0x58d8b6,null))['then'](function(_0x2c7a0f){if(_0x2c7a0f&&_0x2c7a0f[_0x4693('0x84')]){_0x2f206d[_0x4693('0x85')]=_0x2c7a0f;_0x2f206d['applications']=_0x2c7a0f['Applications'];_0x2f206d['list']=_0x2c7a0f[_0x4693('0x84')];_0x2f206d[_0x4693('0x86')]=_[_0x4693('0x87')](_0x2f206d[_0x4693('0x86')],[_0x4693('0x88')],['asc']);if(_0x2f206d['account']['Applications']){delete _0x2f206d[_0x4693('0x85')][_0x4693('0x83')];}if(_0x2f206d[_0x4693('0x85')]['List']&&_0x2f206d[_0x4693('0x85')][_0x4693('0x84')][_0x4693('0x81')][_0x4693('0x4a')]){return _0x2f206d[_0x4693('0x85')][_0x4693('0x84')][_0x4693('0x81')][0x0];}var _0x304df7=_[_0x4693('0x1b')](_0x48857d[_0x4693('0x5b')],{'firstName':_0x48857d[_0x4693('0x5b')]['from'],'ListId':_0x2c7a0f[_0x4693('0x77')]});_0x304df7[_0x48857d['body'][_0x4693('0x7d')]]=_0x48857d[_0x4693('0x5b')][_0x4693('0x79')];return db['CmContact'][_0x4693('0x5a')](_0x304df7,{'fields':_0x3d0339,'raw':!![]});}})['then'](handleEntityNotFound(_0x58d8b6,null))[_0x4693('0x24')](function(_0x4bed7f){_0x2f206d[_0x4693('0x89')]=_0x4bed7f;if(_0x4bed7f){var _0x93c94={'ContactId':_0x4bed7f['id'],'OpenchannelAccountId':_0x48857d[_0x4693('0x59')]['id'],'from':(_0x4bed7f[_0x4693('0x8a')]||'')+'\x20'+(_0x4bed7f[_0x4693('0x8b')]||'')};var _0x37f7e6={'OpenchannelAccountId':_0x48857d[_0x4693('0x59')]['id'],'closed':![]};if(_0x48857d[_0x4693('0x5b')][_0x4693('0x8c')]){_0x37f7e6[_0x4693('0x8c')]=_0x48857d[_0x4693('0x5b')]['threadId'];return db[_0x4693('0x8d')][_0x4693('0x5e')]({'where':_0x37f7e6})['then'](function(_0x4e0340){if(_0x4e0340){return[_0x4e0340,![]];}_0x93c94[_0x4693('0x8c')]=_0x48857d['body'][_0x4693('0x8c')];_0x93c94[_0x4693('0x8e')]=_0x48857d[_0x4693('0x5b')][_0x4693('0x8e')];return db['OpenchannelInteraction'][_0x4693('0x5a')](_0x93c94)[_0x4693('0x24')](function(_0x2b4bb3){return[_0x2b4bb3,!![]];});});}else{_0x37f7e6[_0x4693('0x8c')]=null;}_0x37f7e6[_0x4693('0x8f')]=_0x4bed7f['id'];return db[_0x4693('0x8d')][_0x4693('0x5e')]({'where':_0x37f7e6})[_0x4693('0x24')](function(_0x3c8ed1){if(_0x3c8ed1){return[_0x3c8ed1,![]];}return db[_0x4693('0x8d')][_0x4693('0x5a')](_0x93c94)[_0x4693('0x24')](function(_0x216535){return[_0x216535,!![]];});});}})['spread'](function(_0x419683,_0x3f8936){if(_0x419683){_0x20b5fa=_0x3f8936;if(!_0x3f8936){var _0x291557={'from':(_0x2f206d[_0x4693('0x89')][_0x4693('0x8a')]||'')+'\x20'+(_0x2f206d[_0x4693('0x89')][_0x4693('0x8b')]||'')};if(_0x48857d[_0x4693('0x5b')]['threadId']&&_0x48857d[_0x4693('0x5b')][_0x4693('0x90')]&&_0x48857d['body'][_0x4693('0x8c')]!=_0x48857d[_0x4693('0x5b')]['messageId']){_0x291557[_0x4693('0x8c')]=_0x48857d[_0x4693('0x5b')][_0x4693('0x90')];}return _0x419683['update'](_0x291557);}else{return _0x419683;}}})['then'](function(_0x4dd234){_0x2f206d['interaction']=_0x4dd234['get']({'plain':!![]});_0x2f206d['interaction'][_0x4693('0x91')]=_0x20b5fa;if(_0x2f206d[_0x4693('0x92')][_0x4693('0x91')]){if(_0x2f206d[_0x4693('0x85')]['autoclose']){_0x2f206d['applications'][_0x4693('0x93')]({'id':0x0,'priority':_0x2f206d['applications'][_0x4693('0x4a')]+0x1,'app':_0x4693('0x94'),'appdata':'unmanaged','interval':_0x4693('0x95')});}}return db[_0x4693('0x96')][_0x4693('0x5a')]({'body':_0x48857d[_0x4693('0x5b')][_0x4693('0x5b')],'OpenchannelAccountId':_0x48857d[_0x4693('0x59')]['id'],'OpenchannelInteractionId':_0x4dd234['id'],'direction':'in','ContactId':_0x2f206d['contact']['id'],'AttachmentId':_0x48857d['body'][_0x4693('0x97')]});})['then'](function(_0x2ca14b){_0x2f206d[_0x4693('0x2b')]=_0x2ca14b;if(!_0x2f206d[_0x4693('0x92')][_0x4693('0x98')])return;return db[_0x4693('0x99')][_0x4693('0x5e')]({'attributes':['id',_0x4693('0x3c')],'where':{'id':_0x2f206d[_0x4693('0x92')][_0x4693('0x98')]}});})['then'](function(_0x185f21){if(_0x185f21){_0x2f206d[_0x4693('0x86')][_0x4693('0x9a')]({'id':0x0,'priority':0x0,'app':_0x4693('0x9b'),'appdata':_0x185f21[_0x4693('0x3c')]+','+(_0x2f206d['account'][_0x4693('0x9c')]||0xa),'interval':_0x4693('0x95')});}if(!_0x2f206d[_0x4693('0x92')]['queueId'])return;return db[_0x4693('0x9d')][_0x4693('0x5e')]({'attributes':['id',_0x4693('0x3c')],'where':{'id':_0x2f206d[_0x4693('0x92')][_0x4693('0x9e')]}});})[_0x4693('0x24')](function(_0x2e17c6){if(_0x2e17c6){_0x2f206d[_0x4693('0x86')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4693('0x9f'),'appdata':_0x2e17c6[_0x4693('0x3c')]+','+(_0x2f206d[_0x4693('0x85')]['waitForTheAssignedQueue']||0x12c),'interval':_0x4693('0x95')});}return respondWithRpcPromise(_0x4693('0xa0'),_0x4693('0xa1'),_0x2f206d);})['then'](function(_0x2d1b8){respondWithRpcPromise(_0x4693('0xa2'),_0x4693('0xa2'),{'event':_0x4693('0x6f'),'message':_0x2d1b8},client9002);return _0x2d1b8;})[_0x4693('0x24')](respondWithResult(_0x58d8b6,null))[_0x4693('0x57')](handleError(_0x58d8b6,null));};exports[_0x4693('0xa3')]=function(_0x56c7e1,_0x42b472){var _0x453889=_0x56c7e1[_0x4693('0x59')]['id'];var _0x5da694=_0x56c7e1[_0x4693('0x5b')];var _0x579c42=0xc8;var _0x97736a=null;return db[_0x4693('0xa4')]['transaction']({'isolationLevel':db[_0x4693('0xa4')][_0x4693('0xa5')]['ISOLATION_LEVELS'][_0x4693('0xa6')]},function(_0x5d526e){return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x453889},'transaction':_0x5d526e})[_0x4693('0x24')](function(_0x5e3976){if(_0x5e3976){return db[_0x4693('0xa7')][_0x4693('0x38')]({'where':{'OpenchannelAccountId':_0x453889},'transaction':_0x5d526e})[_0x4693('0x24')](function(){var _0x30ec1e=_[_0x4693('0x44')](_0x5da694,function(_0x47f2f1){_0x47f2f1['OpenchannelAccountId']=_0x453889;return _0x47f2f1;});return db[_0x4693('0xa7')][_0x4693('0xa8')](_0x30ec1e,{'transaction':_0x5d526e});});}else{_0x579c42=0x194;_0x97736a=[];}});})[_0x4693('0x24')](function(){if(_0x579c42!==0x194){return db['OpenchannelApplication'][_0x4693('0xa9')]({'where':{'OpenchannelAccountId':_0x453889},'order':_0x4693('0x88')})[_0x4693('0x24')](function(_0x5a33d9){_0x97736a=_0x5a33d9;});}})[_0x4693('0x57')](function(_0x51953f){_0x579c42=0x1f4;logger[_0x4693('0x29')](_0x51953f['stack']);if(_0x51953f['name']){delete _0x51953f[_0x4693('0x3c')];}_0x97736a=_0x51953f;})['finally'](function(){if(_0x97736a===null){_0x42b472[_0x4693('0x3a')](_0x579c42);}else{if(_0x579c42===0x1f4){_0x42b472[_0x4693('0x2d')](_0x579c42)[_0x4693('0x3d')](_0x97736a);}else{_0x42b472[_0x4693('0x2d')](_0x579c42)[_0x4693('0x2f')](_0x97736a);}}});};exports[_0x4693('0xaa')]=function(_0x5bdb53,_0x4a8822,_0x7a9669){var _0x74a024={};var _0x401520={};var _0xa153eb;var _0x5883a2;return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x5bdb53[_0x4693('0x59')]['id']}})['then'](handleEntityNotFound(_0x4a8822,null))[_0x4693('0x24')](function(_0x16f5b3){if(_0x16f5b3){_0xa153eb=_0x16f5b3;_0x401520[_0x4693('0x43')]=_[_0x4693('0x45')](db[_0x4693('0xa7')]['rawAttributes']);_0x401520[_0x4693('0x46')]=_[_0x4693('0x45')](_0x5bdb53['query']);_0x401520[_0x4693('0x4f')]=_[_0x4693('0x47')](_0x401520[_0x4693('0x43')],_0x401520['query']);_0x74a024[_0x4693('0x49')]=_[_0x4693('0x47')](_0x401520[_0x4693('0x43')],qs[_0x4693('0x48')](_0x5bdb53[_0x4693('0x46')][_0x4693('0x48')]));_0x74a024[_0x4693('0x49')]=_0x74a024[_0x4693('0x49')][_0x4693('0x4a')]?_0x74a024['attributes']:_0x401520['model'];_0x74a024[_0x4693('0x4d')]=qs[_0x4693('0x4e')](_0x5bdb53['query'][_0x4693('0x4e')]);_0x74a024[_0x4693('0x51')]=qs['filters'](_[_0x4693('0x66')](_0x5bdb53['query'],_0x401520[_0x4693('0x4f')]));if(_0x5bdb53[_0x4693('0x46')]['filter']){_0x74a024[_0x4693('0x51')]=_[_0x4693('0x52')](_0x74a024['where'],{'$or':_[_0x4693('0x44')](_0x74a024['attributes'],function(_0x277699){var _0x7c31ca={};_0x7c31ca[_0x277699]={'$like':'%'+_0x5bdb53['query']['filter']+'%'};return _0x7c31ca;})});}_0x74a024=_[_0x4693('0x52')]({},_0x74a024,_0x5bdb53[_0x4693('0x54')]);return _0xa153eb[_0x4693('0xaa')](_0x74a024);}})[_0x4693('0x24')](function(_0x390b41){if(_0x390b41){_0x5883a2=_0x390b41['length'];if(!_0x5bdb53['query'][_0x4693('0x4b')]('nolimit')){_0x74a024[_0x4693('0x32')]=qs[_0x4693('0x32')](_0x5bdb53[_0x4693('0x46')]['limit']);_0x74a024[_0x4693('0x30')]=qs[_0x4693('0x30')](_0x5bdb53[_0x4693('0x46')][_0x4693('0x30')]);}return _0xa153eb['getApplications'](_0x74a024);}})[_0x4693('0x24')](function(_0x7c94f1){if(_0x7c94f1){return _0x7c94f1?{'count':_0x5883a2,'rows':_0x7c94f1}:null;}})[_0x4693('0x24')](respondWithResult(_0x4a8822,null))[_0x4693('0x57')](handleError(_0x4a8822,null));};exports[_0x4693('0xab')]=function(_0x6fdf28,_0x18d864,_0x3de06d){var _0x1e43e9={'raw':![],'where':{}};var _0x53abf4={};var _0x2315f7={'count':0x0,'rows':[]};return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x6fdf28[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x18d864,null))[_0x4693('0x24')](function(_0x334b34){if(_0x334b34){_0x53abf4[_0x4693('0x43')]=_[_0x4693('0x45')](db[_0x4693('0x8d')]['rawAttributes']);_0x53abf4[_0x4693('0x46')]=_[_0x4693('0x45')](_0x6fdf28[_0x4693('0x46')]);_0x53abf4['filters']=_['intersection'](_0x53abf4[_0x4693('0x43')],_0x53abf4[_0x4693('0x46')]);_0x1e43e9['attributes']=_[_0x4693('0x47')](_0x53abf4[_0x4693('0x43')],qs[_0x4693('0x48')](_0x6fdf28[_0x4693('0x46')][_0x4693('0x48')]));_0x1e43e9['attributes']=_0x1e43e9[_0x4693('0x49')][_0x4693('0x4a')]?_0x1e43e9[_0x4693('0x49')]:_0x53abf4[_0x4693('0x43')];if(!_0x6fdf28['query'][_0x4693('0x4b')](_0x4693('0x4c'))){_0x1e43e9[_0x4693('0x32')]=qs[_0x4693('0x32')](_0x6fdf28['query'][_0x4693('0x32')]);_0x1e43e9[_0x4693('0x30')]=qs['offset'](_0x6fdf28[_0x4693('0x46')]['offset']);}_0x1e43e9[_0x4693('0x4d')]=qs[_0x4693('0x4e')](_0x6fdf28[_0x4693('0x46')][_0x4693('0x4e')]);_0x1e43e9[_0x4693('0x51')]=qs[_0x4693('0x4f')](_[_0x4693('0x66')](_0x6fdf28['query'],_0x53abf4['filters']));_0x1e43e9[_0x4693('0x51')][_0x4693('0x67')]=_0x334b34['id'];if(_0x6fdf28['query'][_0x4693('0x50')]){_0x1e43e9['where']=_[_0x4693('0x52')](_0x1e43e9['where'],{'$or':_[_0x4693('0x44')](_0x1e43e9[_0x4693('0x49')],function(_0x9d84de){var _0x2befdf={};_0x2befdf[_0x9d84de]={'$like':'%'+_0x6fdf28[_0x4693('0x46')][_0x4693('0x50')]+'%'};return _0x2befdf;})});}_0x1e43e9=_[_0x4693('0x52')]({},_0x1e43e9,_0x6fdf28['options']);return db[_0x4693('0x8d')][_0x4693('0x33')]({'where':_0x1e43e9[_0x4693('0x51')]})[_0x4693('0x24')](function(_0x3f8b65){_0x2315f7['count']=_0x3f8b65;if(_0x6fdf28[_0x4693('0x46')][_0x4693('0x55')]){_0x1e43e9[_0x4693('0x56')]=[{'model':db[_0x4693('0x71')],'as':_0x4693('0xac'),'required':![]},{'model':db[_0x4693('0x99')],'as':_0x4693('0xad'),'attributes':[_0x4693('0x3c'),_0x4693('0xae'),_0x4693('0xaf')],'required':![]},{'model':db[_0x4693('0xb0')],'as':_0x4693('0xb1'),'attributes':['id',_0x4693('0x3c'),_0x4693('0xb2')],'where':_0x6fdf28['query']['tag']?{'id':_0x6fdf28[_0x4693('0x46')]['tag']}:undefined,'required':_0x6fdf28[_0x4693('0x46')]['tag']?!![]:![]}];}return db[_0x4693('0x8d')][_0x4693('0x68')](_0x1e43e9);})[_0x4693('0x24')](function(_0x44f743){_0x2315f7[_0x4693('0x6d')]=_0x44f743;return _0x2315f7;});}})[_0x4693('0x24')](respondWithFilteredResult(_0x18d864,_0x1e43e9))[_0x4693('0x57')](handleError(_0x18d864,null));};exports[_0x4693('0xb3')]=function(_0x55b553,_0x130830,_0x1949cb){return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x55b553[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x130830,null))[_0x4693('0x24')](function(_0x1f58f8){if(_0x1f58f8){return _0x1f58f8[_0x4693('0xb3')](_0x55b553[_0x4693('0x5b')][_0x4693('0xb4')],_[_0x4693('0xb5')](_0x55b553[_0x4693('0x5b')],['ids','id'])||{})['spread'](function(_0x181fa2){for(var _0x14dc45=0x0;_0x14dc45<_0x55b553['body'][_0x4693('0xb4')][_0x4693('0x4a')];_0x14dc45+=0x1){socket['emit'](_0x4693('0xb6'),{'UserId':Number(_0x55b553[_0x4693('0x5b')][_0x4693('0xb4')][_0x14dc45]),'OpenchannelAccountId':Number(_0x55b553[_0x4693('0x59')]['id'])});}return _0x181fa2;});}})[_0x4693('0x24')](respondWithResult(_0x130830,null))[_0x4693('0x57')](handleError(_0x130830,null));};exports[_0x4693('0xb7')]=function(_0x1942e1,_0x34f617,_0x163e3a){return db['OpenchannelAccount']['find']({'where':{'id':_0x1942e1[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x34f617,null))['then'](function(_0xc27dac){if(_0xc27dac){return _0xc27dac['removeAgents'](_0x1942e1[_0x4693('0x46')][_0x4693('0xb4')])['then'](function(){if(_['isArray'](_0x1942e1[_0x4693('0x46')][_0x4693('0xb4')])){for(var _0x4c35b7=0x0;_0x4c35b7<_0x1942e1['query'][_0x4693('0xb4')]['length'];_0x4c35b7+=0x1){socket['emit'](_0x4693('0xb8'),{'UserId':Number(_0x1942e1[_0x4693('0x46')][_0x4693('0xb4')][_0x4c35b7]),'OpenchannelAccountId':Number(_0x1942e1['params']['id'])});}}else{socket[_0x4693('0xb9')](_0x4693('0xb8'),{'UserId':Number(_0x1942e1['query'][_0x4693('0xb4')]),'OpenchannelAccountId':Number(_0x1942e1[_0x4693('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x34f617,null))['catch'](handleError(_0x34f617,null));};exports[_0x4693('0xba')]=function(_0x2faa02,_0x51aadc,_0x47da67){var _0x16fb33={};var _0x53fc9e={};var _0x687a02;var _0x39317f;return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x2faa02[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x51aadc,null))['then'](function(_0x2ed55c){if(_0x2ed55c){_0x687a02=_0x2ed55c;_0x53fc9e[_0x4693('0x43')]=_[_0x4693('0x45')](db[_0x4693('0x99')]['rawAttributes']);_0x53fc9e[_0x4693('0x46')]=_[_0x4693('0x45')](_0x2faa02[_0x4693('0x46')]);_0x53fc9e[_0x4693('0x4f')]=_[_0x4693('0x47')](_0x53fc9e[_0x4693('0x43')],_0x53fc9e[_0x4693('0x46')]);_0x16fb33[_0x4693('0x49')]=_[_0x4693('0x47')](_0x53fc9e[_0x4693('0x43')],qs['fields'](_0x2faa02[_0x4693('0x46')][_0x4693('0x48')]));_0x16fb33[_0x4693('0x49')]=_0x16fb33['attributes'][_0x4693('0x4a')]?_0x16fb33[_0x4693('0x49')]:_0x53fc9e['model'];_0x16fb33[_0x4693('0x4d')]=qs[_0x4693('0x4e')](_0x2faa02['query']['sort']);_0x16fb33['where']=qs[_0x4693('0x4f')](_[_0x4693('0x66')](_0x2faa02[_0x4693('0x46')],_0x53fc9e[_0x4693('0x4f')]));if(_0x2faa02['query'][_0x4693('0x50')]){_0x16fb33['where']=_[_0x4693('0x52')](_0x16fb33[_0x4693('0x51')],{'$or':_['map'](_0x16fb33[_0x4693('0x49')],function(_0x2e590c){var _0x47619a={};_0x47619a[_0x2e590c]={'$like':'%'+_0x2faa02['query'][_0x4693('0x50')]+'%'};return _0x47619a;})});}_0x16fb33=_[_0x4693('0x52')]({},_0x16fb33,_0x2faa02['options']);return _0x687a02[_0x4693('0xba')](_0x16fb33);}})[_0x4693('0x24')](function(_0x4a7f07){if(_0x4a7f07){_0x39317f=_0x4a7f07['length'];if(!_0x2faa02[_0x4693('0x46')][_0x4693('0x4b')]('nolimit')){_0x16fb33['limit']=qs['limit'](_0x2faa02[_0x4693('0x46')][_0x4693('0x32')]);_0x16fb33[_0x4693('0x30')]=qs[_0x4693('0x30')](_0x2faa02[_0x4693('0x46')][_0x4693('0x30')]);}return _0x687a02['getAgents'](_0x16fb33);}})[_0x4693('0x24')](function(_0x579358){if(_0x579358){return _0x579358?{'count':_0x39317f,'rows':_0x579358}:null;}})[_0x4693('0x24')](respondWithResult(_0x51aadc,null))['catch'](handleError(_0x51aadc,null));};exports[_0x4693('0x3d')]=function(_0x549310,_0x1feff5,_0x4ee44e){var _0x473813,_0x5d406e,_0x5932da;if(_[_0x4693('0x78')](_0x549310['body'][_0x4693('0x5b')])||_0x549310[_0x4693('0x5b')]['body']===''){throw new db[(_0x4693('0x72'))][(_0x4693('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4693('0x78')](_0x549310[_0x4693('0x5b')]['to'])){}_0x473813=_0x549310[_0x4693('0x5b')]['to'];return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x549310[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x1feff5,null))[_0x4693('0x24')](function(_0x304c06){if(_0x304c06){return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x304c06['id']},'include':[{'model':db[_0x4693('0xbb')],'as':_0x4693('0x84'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x304c06[_0x4693('0x7d')]]:_0x473813},'limit':0x1,'order':[[_0x4693('0x75'),_0x4693('0x82')]]}]}]})[_0x4693('0x24')](handleEntityNotFound(_0x1feff5,null))[_0x4693('0x24')](function(_0xf46512){if(_0xf46512&&_0xf46512[_0x4693('0x84')]){_0x5d406e=_0xf46512[_0x4693('0x39')]({'plain':!![]});if(_0x5d406e['List']&&_0x5d406e[_0x4693('0x84')][_0x4693('0x81')][_0x4693('0x4a')]){return _0x5d406e[_0x4693('0x84')]['Contacts'][0x0];}return db['CmContact'][_0x4693('0x5a')](_[_0x4693('0x1b')](_0x549310[_0x4693('0x5b')],{'firstName':_0x473813,[_0xf46512[_0x4693('0x7d')]]:_0x473813,'phone':_0x473813,'ListId':_0x5d406e[_0x4693('0x77')]}));}})['then'](handleEntityNotFound(_0x1feff5,null))['then'](function(_0x5e878e){if(_0x5e878e){_0x5932da=_0x5e878e;return db[_0x4693('0x8d')][_0x4693('0x5e')]({'where':{'ContactId':_0x5932da['id'],'closed':![],'OpenchannelAccountId':_0x5d406e['id']}})[_0x4693('0x24')](function(_0x49fea6){if(_0x49fea6){return[_0x49fea6,![]];}return db[_0x4693('0x8d')][_0x4693('0x5a')]({'UserId':_0x549310[_0x4693('0x5d')]['id'],'ContactId':_0x5932da['id'],'OpenchannelAccountId':_0x5d406e['id'],'lastMsgDirection':'out','firstMsgDirection':_0x4693('0xbc'),'Messages':[_[_0x4693('0x52')](_0x549310[_0x4693('0x5b')],{'read':![],'body':_0x549310[_0x4693('0x5b')]['body'],'OpenchannelAccountId':_0x5d406e['id'],'UserId':_0x549310[_0x4693('0x5d')]['id'],'ContactId':_0x5932da['id']})]},{'include':[{'model':db[_0x4693('0x96')],'as':'Messages'}]})[_0x4693('0x24')](function(_0x5613ab){return[_0x5613ab,!![]];});});}})[_0x4693('0xbd')](function(_0x54820a,_0x2831ab){if(_0x2831ab){return _0x54820a;}return db[_0x4693('0x96')]['create'](_[_0x4693('0x52')](_0x549310[_0x4693('0x5b')],{'read':![],'body':_0x549310[_0x4693('0x5b')][_0x4693('0x5b')],'OpenchannelAccountId':_0x5d406e['id'],'OpenchannelInteractionId':_0x54820a['id'],'UserId':_0x549310['user']['id'],'ContactId':_0x5932da['id']}))['then'](function(_0x8dd131){_0x54820a[_0x4693('0xbe')][_0x4693('0xbf')]=[];_0x54820a['dataValues'][_0x4693('0xbf')][_0x4693('0x93')](_0x8dd131[_0x4693('0xbe')]);return _0x54820a;});});}})[_0x4693('0x24')](respondWithResult(_0x1feff5,null))[_0x4693('0x57')](handleError(_0x1feff5,null));}; \ No newline at end of file +var _0x727a=['json','undefined','limit','count','offset','set','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','nolimit','order','removeDispositions','ids','CannedAnswer','getAnswers','findAll','removeAnswers','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','from','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','updatedAt','OpenchannelApplication','Applications','applications','orderBy','account','Contacts','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','startRouting','notify','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status'];(function(_0x4d515d,_0x108c96){var _0x58fe07=function(_0x2e18bf){while(--_0x2e18bf){_0x4d515d['push'](_0x4d515d['shift']());}};_0x58fe07(++_0x108c96);}(_0x727a,0x95));var _0xa727=function(_0x3d593d,_0x1dec8d){_0x3d593d=_0x3d593d-0x0;var _0x501ec5=_0x727a[_0x3d593d];return _0x501ec5;};'use strict';var emlformat=require(_0xa727('0x0'));var rimraf=require(_0xa727('0x1'));var zipdir=require(_0xa727('0x2'));var jsonpatch=require(_0xa727('0x3'));var rp=require(_0xa727('0x4'));var moment=require(_0xa727('0x5'));var BPromise=require(_0xa727('0x6'));var Mustache=require('mustache');var util=require(_0xa727('0x7'));var path=require(_0xa727('0x8'));var sox=require(_0xa727('0x9'));var csv=require(_0xa727('0xa'));var ejs=require(_0xa727('0xb'));var fs=require('fs');var fs_extra=require(_0xa727('0xc'));var _=require(_0xa727('0xd'));var squel=require(_0xa727('0xe'));var crypto=require(_0xa727('0xf'));var jsforce=require(_0xa727('0x10'));var deskjs=require(_0xa727('0x11'));var toCsv=require(_0xa727('0xa'));var querystring=require(_0xa727('0x12'));var Papa=require(_0xa727('0x13'));var Redis=require(_0xa727('0x14'));var authService=require(_0xa727('0x15'));var qs=require(_0xa727('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa727('0x17'));var logger=require(_0xa727('0x18'))(_0xa727('0x19'));var utils=require(_0xa727('0x1a'));var config=require(_0xa727('0x1b'));var licenseUtil=require(_0xa727('0x1c'));var db=require(_0xa727('0x1d'))['db'];config[_0xa727('0x1e')]=_[_0xa727('0x1f')](config[_0xa727('0x1e')],{'host':_0xa727('0x20'),'port':0x18eb});var socket=require(_0xa727('0x21'))(new Redis(config[_0xa727('0x1e')]));require(_0xa727('0x22'))[_0xa727('0x23')](socket);var jayson=require(_0xa727('0x24'));var client=jayson[_0xa727('0x25')][_0xa727('0x26')]({'port':0x232c});var client9002=jayson[_0xa727('0x25')][_0xa727('0x26')]({'port':0x232a});function respondWithRpcPromise(_0x21d054,_0x3b5d48,_0x12a3a1,_0x2bc42e){return new BPromise(function(_0x690abb,_0x1dc547){var _0x4a242a=_0x2bc42e||client;return _0x4a242a[_0xa727('0x27')](_0x21d054,_0x12a3a1)[_0xa727('0x28')](function(_0x430b15){logger[_0xa727('0x29')](_0xa727('0x2a'),_0x3b5d48,_0xa727('0x2b'));logger[_0xa727('0x2c')](_0xa727('0x2d'),_0x3b5d48,'request\x20sent',JSON['stringify'](_0x430b15));if(_0x430b15[_0xa727('0x2e')]){if(_0x430b15['error']['code']===0x1f4){logger['error'](_0xa727('0x2a'),_0x3b5d48,_0x430b15['error'][_0xa727('0x2f')]);return _0x1dc547(_0x430b15['error']['message']);}logger[_0xa727('0x2e')](_0xa727('0x2a'),_0x3b5d48,_0x430b15[_0xa727('0x2e')]['message']);return _0x690abb(_0x430b15[_0xa727('0x2e')][_0xa727('0x2f')]);}else{logger['info'](_0xa727('0x2a'),_0x3b5d48,_0xa727('0x2b'));_0x690abb(_0x430b15[_0xa727('0x30')][_0xa727('0x2f')]);}})[_0xa727('0x31')](function(_0x2d2c27){logger[_0xa727('0x2e')](_0xa727('0x2a'),_0x3b5d48,_0x2d2c27);_0x1dc547(_0x2d2c27);});});}function respondWithStatusCode(_0xd210d9,_0x5a9af5){_0x5a9af5=_0x5a9af5||0xcc;return function(_0x120c4c){if(_0x120c4c){return _0xd210d9[_0xa727('0x32')](_0x5a9af5);}return _0xd210d9['status'](_0x5a9af5)['end']();};}function respondWithResult(_0x76e540,_0x15a898){_0x15a898=_0x15a898||0xc8;return function(_0x5044ab){if(_0x5044ab){return _0x76e540[_0xa727('0x33')](_0x15a898)[_0xa727('0x34')](_0x5044ab);}};}function respondWithFilteredResult(_0x25dce3,_0x1a245b){return function(_0x17a0e6){if(_0x17a0e6){var _0x39d0b1=typeof _0x1a245b['offset']===_0xa727('0x35')&&typeof _0x1a245b[_0xa727('0x36')]===_0xa727('0x35');var _0x466506=_0x17a0e6[_0xa727('0x37')];var _0x29b0cd=_0x39d0b1?0x0:_0x1a245b[_0xa727('0x38')];var _0x44a8a0=_0x39d0b1?_0x17a0e6[_0xa727('0x37')]:_0x1a245b['offset']+_0x1a245b[_0xa727('0x36')];var _0x268df9;if(_0x44a8a0>=_0x466506){_0x44a8a0=_0x466506;_0x268df9=0xc8;}else{_0x268df9=0xce;}_0x25dce3[_0xa727('0x33')](_0x268df9);return _0x25dce3[_0xa727('0x39')]('Content-Range',_0x29b0cd+'-'+_0x44a8a0+'/'+_0x466506)[_0xa727('0x34')](_0x17a0e6);}return null;};}function patchUpdates(_0x2a2e4d){return function(_0x4d0f59){try{jsonpatch[_0xa727('0x3a')](_0x4d0f59,_0x2a2e4d,!![]);}catch(_0x474f12){return BPromise['reject'](_0x474f12);}return _0x4d0f59[_0xa727('0x3b')]();};}function saveUpdates(_0x4d5934,_0x54640d){return function(_0xeb6036){if(_0xeb6036){return _0xeb6036[_0xa727('0x3c')](_0x4d5934)[_0xa727('0x28')](function(_0x58d816){return _0x58d816;});}return null;};}function removeEntity(_0x1f92f3,_0x1c04aa){return function(_0x1b3aa2){if(_0x1b3aa2){return _0x1b3aa2[_0xa727('0x3d')]()['then'](function(){var _0x194a9f=_0x1b3aa2[_0xa727('0x3e')]({'plain':!![]});var _0x24a8f6='OpenchannelAccounts';return db[_0xa727('0x3f')]['destroy']({'where':{'type':_0x24a8f6,'resourceId':_0x194a9f['id']}})[_0xa727('0x28')](function(){return _0x1b3aa2;});})[_0xa727('0x28')](function(){_0x1f92f3[_0xa727('0x33')](0xcc)[_0xa727('0x40')]();});}};}function handleEntityNotFound(_0x779251,_0x587865){return function(_0x5205c5){if(!_0x5205c5){_0x779251[_0xa727('0x32')](0x194);}return _0x5205c5;};}function handleError(_0x1d7a4b,_0x4b4457){_0x4b4457=_0x4b4457||0x1f4;return function(_0xc5be3){logger['error'](_0xc5be3[_0xa727('0x41')]);if(_0xc5be3[_0xa727('0x42')]){delete _0xc5be3[_0xa727('0x42')];}_0x1d7a4b[_0xa727('0x33')](_0x4b4457)[_0xa727('0x43')](_0xc5be3);};}exports[_0xa727('0x44')]=function(_0x5e6c18,_0x1da0ba){var _0xde3a0={'include':[{'model':db[_0xa727('0x45')],'as':_0xa727('0x46')}]},_0x1a1bc1={},_0x279ef9={'count':0x0,'rows':[]};var _0x4f9f57=_[_0xa727('0x47')](db[_0xa727('0x48')][_0xa727('0x49')],function(_0x7d7e37){return{'name':_0x7d7e37['fieldName'],'type':_0x7d7e37[_0xa727('0x4a')][_0xa727('0x4b')]};});_0x1a1bc1['model']=_['map'](_0x4f9f57,_0xa727('0x42'));_0x1a1bc1[_0xa727('0x4c')]=_['keys'](_0x5e6c18[_0xa727('0x4c')]);_0x1a1bc1[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x1a1bc1[_0xa727('0x4f')],_0x1a1bc1[_0xa727('0x4c')]);_0xde3a0['attributes']=_[_0xa727('0x4e')](_0x1a1bc1[_0xa727('0x4f')],qs[_0xa727('0x50')](_0x5e6c18['query'][_0xa727('0x50')]));_0xde3a0[_0xa727('0x51')]=_0xde3a0[_0xa727('0x51')][_0xa727('0x52')]?_0xde3a0['attributes']:_0x1a1bc1[_0xa727('0x4f')];if(!_0x5e6c18[_0xa727('0x4c')][_0xa727('0x53')]('nolimit')){_0xde3a0['limit']=qs['limit'](_0x5e6c18['query'][_0xa727('0x36')]);_0xde3a0[_0xa727('0x38')]=qs[_0xa727('0x38')](_0x5e6c18[_0xa727('0x4c')][_0xa727('0x38')]);}_0xde3a0['order']=qs[_0xa727('0x54')](_0x5e6c18[_0xa727('0x4c')][_0xa727('0x54')]);_0xde3a0[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0x5e6c18['query'],_0x1a1bc1[_0xa727('0x4d')]),_0x4f9f57);if(_0x5e6c18[_0xa727('0x4c')][_0xa727('0x57')]){_0xde3a0[_0xa727('0x55')]=_['merge'](_0xde3a0['where'],{'$or':_[_0xa727('0x47')](_0x4f9f57,function(_0x1d03d2){if(_0x1d03d2[_0xa727('0x4a')]!==_0xa727('0x58')){var _0x23bc14={};_0x23bc14[_0x1d03d2[_0xa727('0x42')]]={'$like':'%'+_0x5e6c18[_0xa727('0x4c')]['filter']+'%'};return _0x23bc14;}})});}_0xde3a0=_[_0xa727('0x59')]({},_0xde3a0,_0x5e6c18[_0xa727('0x5a')]);var _0x24ad4f={'where':_0xde3a0[_0xa727('0x55')]};return db['OpenchannelAccount'][_0xa727('0x37')](_0x24ad4f)[_0xa727('0x28')](function(_0x2545f0){_0x279ef9[_0xa727('0x37')]=_0x2545f0;if(_0x5e6c18[_0xa727('0x4c')][_0xa727('0x5b')]){_0xde3a0[_0xa727('0x5c')]=[{'all':!![]}];}return db[_0xa727('0x48')]['findAll'](_0xde3a0);})['then'](function(_0x1f3f50){_0x279ef9[_0xa727('0x5d')]=_0x1f3f50;return _0x279ef9;})[_0xa727('0x28')](respondWithFilteredResult(_0x1da0ba,_0xde3a0))[_0xa727('0x31')](handleError(_0x1da0ba,null));};exports[_0xa727('0x5e')]=function(_0x2181d3,_0x3c795a){var _0x2d2fba={'raw':![],'where':{'id':_0x2181d3[_0xa727('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0xa727('0x46')}]},_0x37f010={};_0x37f010['model']=_[_0xa727('0x60')](db[_0xa727('0x48')]['rawAttributes']);_0x37f010[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x2181d3[_0xa727('0x4c')]);_0x37f010['filters']=_[_0xa727('0x4e')](_0x37f010['model'],_0x37f010['query']);_0x2d2fba['attributes']=_[_0xa727('0x4e')](_0x37f010[_0xa727('0x4f')],qs['fields'](_0x2181d3[_0xa727('0x4c')][_0xa727('0x50')]));_0x2d2fba[_0xa727('0x51')]=_0x2d2fba[_0xa727('0x51')]['length']?_0x2d2fba[_0xa727('0x51')]:_0x37f010['model'];if(_0x2181d3[_0xa727('0x4c')]['includeAll']){_0x2d2fba['include']=[{'all':!![]}];}_0x2d2fba=_['merge']({},_0x2d2fba,_0x2181d3[_0xa727('0x5a')]);return db[_0xa727('0x48')][_0xa727('0x61')](_0x2d2fba)[_0xa727('0x28')](handleEntityNotFound(_0x3c795a,null))['then'](respondWithResult(_0x3c795a,null))[_0xa727('0x31')](handleError(_0x3c795a,null));};exports[_0xa727('0x62')]=function(_0x1c6491,_0x1a8d5c){return db[_0xa727('0x48')][_0xa727('0x62')](_0x1c6491[_0xa727('0x63')],{})[_0xa727('0x28')](function(_0x1daa92){var _0x572822=_0x1c6491[_0xa727('0x64')]['get']({'plain':!![]});if(!_0x572822)throw new Error(_0xa727('0x65'));if(_0x572822[_0xa727('0x66')]==='user'){var _0x374d03=_0x1daa92['get']({'plain':!![]});var _0x120106=_0xa727('0x67');return db[_0xa727('0x68')][_0xa727('0x61')]({'where':{'name':_0x120106,'userProfileId':_0x572822['userProfileId']},'raw':!![]})[_0xa727('0x28')](function(_0x42f58b){if(_0x42f58b&&_0x42f58b[_0xa727('0x69')]===0x0){return db['UserProfileResource'][_0xa727('0x62')]({'name':_0x374d03[_0xa727('0x42')],'resourceId':_0x374d03['id'],'type':_0x42f58b['name'],'sectionId':_0x42f58b['id']},{})['then'](function(){return _0x1daa92;});}else{return _0x1daa92;}})[_0xa727('0x31')](function(_0x341a27){logger[_0xa727('0x2e')](_0xa727('0x6a'),_0x341a27);throw _0x341a27;});}return _0x1daa92;})['then'](respondWithResult(_0x1a8d5c,0xc9))[_0xa727('0x31')](handleError(_0x1a8d5c,null));};exports[_0xa727('0x3c')]=function(_0x5697bb,_0x216706){if(_0x5697bb['body']['id']){delete _0x5697bb[_0xa727('0x63')]['id'];}return db['OpenchannelAccount'][_0xa727('0x61')]({'where':{'id':_0x5697bb[_0xa727('0x5f')]['id']},'include':[{'model':db[_0xa727('0x45')],'as':_0xa727('0x46')}]})[_0xa727('0x28')](handleEntityNotFound(_0x216706,null))[_0xa727('0x28')](saveUpdates(_0x5697bb[_0xa727('0x63')],null))[_0xa727('0x28')](respondWithResult(_0x216706,null))[_0xa727('0x31')](handleError(_0x216706,null));};exports[_0xa727('0x3d')]=function(_0x4cac10,_0x474fa0){return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x4cac10[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x474fa0,null))[_0xa727('0x28')](removeEntity(_0x474fa0,null))[_0xa727('0x31')](handleError(_0x474fa0,null));};exports[_0xa727('0x6b')]=function(_0x359c1e,_0x360c21){return db[_0xa727('0x48')]['describe']()[_0xa727('0x28')](respondWithResult(_0x360c21,null))[_0xa727('0x31')](handleError(_0x360c21,null));};exports[_0xa727('0x6c')]=function(_0x4ee7cb,_0x45383a,_0x31d40b){if(_0x4ee7cb[_0xa727('0x63')]['id']){delete _0x4ee7cb[_0xa727('0x63')]['id'];}return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x4ee7cb['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x45383a,null))[_0xa727('0x28')](function(_0x16446c){if(_0x16446c){_0x4ee7cb[_0xa727('0x63')][_0xa727('0x6d')]=_0x16446c['id'];return db[_0xa727('0x6e')]['create'](_0x4ee7cb['body']);}})[_0xa727('0x28')](respondWithResult(_0x45383a,null))[_0xa727('0x31')](handleError(_0x45383a,null));};exports['getDispositions']=function(_0x1fba5d,_0x1f1976,_0x58b4f8){var _0x5c851b={'raw':![],'where':{}};var _0x543bd6={};var _0x34e854={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa727('0x6f')]({'where':{'id':_0x1fba5d['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x1f1976,null))[_0xa727('0x28')](function(_0x401221){if(_0x401221){_0x543bd6[_0xa727('0x4f')]=_[_0xa727('0x60')](db[_0xa727('0x6e')][_0xa727('0x49')]);_0x543bd6[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x1fba5d['query']);_0x543bd6[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x543bd6[_0xa727('0x4f')],_0x543bd6['query']);_0x5c851b[_0xa727('0x51')]=_[_0xa727('0x4e')](_0x543bd6['model'],qs[_0xa727('0x50')](_0x1fba5d[_0xa727('0x4c')][_0xa727('0x50')]));_0x5c851b[_0xa727('0x51')]=_0x5c851b[_0xa727('0x51')][_0xa727('0x52')]?_0x5c851b[_0xa727('0x51')]:_0x543bd6[_0xa727('0x4f')];if(!_0x1fba5d[_0xa727('0x4c')][_0xa727('0x53')](_0xa727('0x70'))){_0x5c851b['limit']=qs['limit'](_0x1fba5d[_0xa727('0x4c')][_0xa727('0x36')]);_0x5c851b[_0xa727('0x38')]=qs['offset'](_0x1fba5d[_0xa727('0x4c')][_0xa727('0x38')]);}_0x5c851b[_0xa727('0x71')]=qs[_0xa727('0x54')](_0x1fba5d[_0xa727('0x4c')][_0xa727('0x54')]);_0x5c851b[_0xa727('0x55')]=qs[_0xa727('0x4d')](_['pick'](_0x1fba5d[_0xa727('0x4c')],_0x543bd6[_0xa727('0x4d')]));_0x5c851b[_0xa727('0x55')][_0xa727('0x6d')]=_0x401221['id'];if(_0x1fba5d[_0xa727('0x4c')][_0xa727('0x57')]){_0x5c851b[_0xa727('0x55')]=_[_0xa727('0x59')](_0x5c851b[_0xa727('0x55')],{'$or':_[_0xa727('0x47')](_0x5c851b['attributes'],function(_0x54a922){var _0x19b61a={};_0x19b61a[_0x54a922]={'$like':'%'+_0x1fba5d[_0xa727('0x4c')][_0xa727('0x57')]+'%'};return _0x19b61a;})});}_0x5c851b=_[_0xa727('0x59')]({},_0x5c851b,_0x1fba5d[_0xa727('0x5a')]);return db[_0xa727('0x6e')][_0xa727('0x37')]({'where':_0x5c851b[_0xa727('0x55')]})[_0xa727('0x28')](function(_0x153253){_0x34e854[_0xa727('0x37')]=_0x153253;if(_0x1fba5d[_0xa727('0x4c')]['includeAll']){_0x5c851b['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5c851b);})[_0xa727('0x28')](function(_0x2667d2){_0x34e854['rows']=_0x2667d2;return _0x34e854;});}})[_0xa727('0x28')](respondWithFilteredResult(_0x1f1976,_0x5c851b))[_0xa727('0x31')](handleError(_0x1f1976,null));};exports['removeDispositions']=function(_0x278c7e,_0x353f1c,_0x151846){return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x278c7e[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x353f1c,null))[_0xa727('0x28')](function(_0x81b9eb){if(_0x81b9eb){return _0x81b9eb[_0xa727('0x72')](_0x278c7e[_0xa727('0x4c')][_0xa727('0x73')]);}})[_0xa727('0x28')](respondWithStatusCode(_0x353f1c,null))[_0xa727('0x31')](handleError(_0x353f1c,null));};exports['addAnswer']=function(_0x45224e,_0x37398e,_0x18748b){if(_0x45224e[_0xa727('0x63')]['id']){delete _0x45224e['body']['id'];}return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x45224e[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x37398e,null))[_0xa727('0x28')](function(_0x35a8f7){if(_0x35a8f7){_0x45224e[_0xa727('0x63')][_0xa727('0x6d')]=_0x35a8f7['id'];return db[_0xa727('0x74')][_0xa727('0x62')](_0x45224e[_0xa727('0x63')]);}})[_0xa727('0x28')](respondWithResult(_0x37398e,null))['catch'](handleError(_0x37398e,null));};exports[_0xa727('0x75')]=function(_0xdde33a,_0x74d4f4,_0x1f99c4){var _0x583b17={'raw':![],'where':{}};var _0x5da245={};var _0x427e0d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa727('0x6f')]({'where':{'id':_0xdde33a['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x74d4f4,null))[_0xa727('0x28')](function(_0x579a72){if(_0x579a72){_0x5da245[_0xa727('0x4f')]=_['keys'](db[_0xa727('0x74')]['rawAttributes']);_0x5da245['query']=_[_0xa727('0x60')](_0xdde33a[_0xa727('0x4c')]);_0x5da245['filters']=_[_0xa727('0x4e')](_0x5da245[_0xa727('0x4f')],_0x5da245['query']);_0x583b17[_0xa727('0x51')]=_[_0xa727('0x4e')](_0x5da245['model'],qs[_0xa727('0x50')](_0xdde33a[_0xa727('0x4c')]['fields']));_0x583b17[_0xa727('0x51')]=_0x583b17[_0xa727('0x51')][_0xa727('0x52')]?_0x583b17[_0xa727('0x51')]:_0x5da245['model'];if(!_0xdde33a[_0xa727('0x4c')][_0xa727('0x53')](_0xa727('0x70'))){_0x583b17['limit']=qs[_0xa727('0x36')](_0xdde33a['query'][_0xa727('0x36')]);_0x583b17[_0xa727('0x38')]=qs[_0xa727('0x38')](_0xdde33a[_0xa727('0x4c')]['offset']);}_0x583b17['order']=qs[_0xa727('0x54')](_0xdde33a[_0xa727('0x4c')][_0xa727('0x54')]);_0x583b17[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0xdde33a['query'],_0x5da245[_0xa727('0x4d')]));_0x583b17[_0xa727('0x55')][_0xa727('0x6d')]=_0x579a72['id'];if(_0xdde33a[_0xa727('0x4c')][_0xa727('0x57')]){_0x583b17['where']=_[_0xa727('0x59')](_0x583b17[_0xa727('0x55')],{'$or':_[_0xa727('0x47')](_0x583b17[_0xa727('0x51')],function(_0x38320b){var _0x8b6d97={};_0x8b6d97[_0x38320b]={'$like':'%'+_0xdde33a[_0xa727('0x4c')][_0xa727('0x57')]+'%'};return _0x8b6d97;})});}_0x583b17=_[_0xa727('0x59')]({},_0x583b17,_0xdde33a[_0xa727('0x5a')]);return db[_0xa727('0x74')]['count']({'where':_0x583b17[_0xa727('0x55')]})[_0xa727('0x28')](function(_0x1b6b75){_0x427e0d[_0xa727('0x37')]=_0x1b6b75;if(_0xdde33a[_0xa727('0x4c')][_0xa727('0x5b')]){_0x583b17[_0xa727('0x5c')]=[{'all':!![]}];}return db[_0xa727('0x74')][_0xa727('0x76')](_0x583b17);})[_0xa727('0x28')](function(_0x47d482){_0x427e0d['rows']=_0x47d482;return _0x427e0d;});}})[_0xa727('0x28')](respondWithFilteredResult(_0x74d4f4,_0x583b17))[_0xa727('0x31')](handleError(_0x74d4f4,null));};exports[_0xa727('0x77')]=function(_0x50150f,_0x5146c8,_0x13b5a5){return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x50150f['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x5146c8,null))[_0xa727('0x28')](function(_0x59abc7){if(_0x59abc7){return _0x59abc7[_0xa727('0x77')](_0x50150f['query']['ids']);}})[_0xa727('0x28')](respondWithStatusCode(_0x5146c8,null))[_0xa727('0x31')](handleError(_0x5146c8,null));};exports['notify']=function(_0x463753,_0x3ff83a,_0x38571c){var _0x56384a={'body':_0x463753[_0xa727('0x63')],'channel':_0xa727('0x78')};var _0x2651db=[];var _0x27b430=[];var _0x36ed09={};var _0x2b7c35=![];return db[_0xa727('0x79')][_0xa727('0x6b')]()[_0xa727('0x28')](function(_0x372ed6){if(!_0x372ed6){throw new db[(_0xa727('0x7a'))]['ValidationError'](_0xa727('0x7b'));}_0x2651db=_[_0xa727('0x7c')](_['keys'](_0x372ed6),[_0xa727('0x7d'),'updatedAt']);_0x27b430=_[_0xa727('0x7c')](_[_0xa727('0x60')](_0x372ed6),['createdAt','updatedAt',_0xa727('0x7e'),'ListId']);if(_0x463753[_0xa727('0x63')]['id']){delete _0x463753[_0xa727('0x63')]['id'];}if(_['isNil'](_0x463753[_0xa727('0x63')][_0xa727('0x7f')])){throw new db[(_0xa727('0x7a'))][(_0xa727('0x80'))]('from\x20is\x20mandatory');}if(_[_0xa727('0x81')](_0x463753[_0xa727('0x63')][_0xa727('0x63')])||_0x463753[_0xa727('0x63')]['body']===''){throw new db[(_0xa727('0x7a'))]['ValidationError'](_0xa727('0x82'));}if(_[_0xa727('0x81')](_0x463753[_0xa727('0x63')][_0xa727('0x83')])){throw new db[(_0xa727('0x7a'))][(_0xa727('0x80'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x27b430);}if(!_[_0xa727('0x84')](_0x27b430,_0x463753[_0xa727('0x63')]['mapKey'])){throw new db[(_0xa727('0x7a'))][(_0xa727('0x80'))](_0xa727('0x85')+_0x27b430);}_0x36ed09[_0x463753['body'][_0xa727('0x83')]]=_0x463753[_0xa727('0x63')][_0xa727('0x7f')];})[_0xa727('0x28')](function(){return db[_0xa727('0x48')]['find']({'where':{'id':_0x463753['params']['id']},'include':[{'model':db[_0xa727('0x86')],'as':_0xa727('0x87'),'include':[{'model':db[_0xa727('0x79')],'as':'Contacts','where':_0x36ed09,'limit':0x1,'order':[[_0xa727('0x88'),'DESC']]}]},{'model':db[_0xa727('0x89')],'as':_0xa727('0x8a')}]});})['then'](handleEntityNotFound(_0x3ff83a,null))['then'](function(_0x66e5f1){if(_0x66e5f1&&_0x66e5f1[_0xa727('0x87')]){_0x56384a['account']=_0x66e5f1;_0x56384a[_0xa727('0x8b')]=_0x66e5f1['Applications'];_0x56384a['list']=_0x66e5f1[_0xa727('0x87')];_0x56384a[_0xa727('0x8b')]=_[_0xa727('0x8c')](_0x56384a[_0xa727('0x8b')],['priority'],['asc']);if(_0x56384a['account']['Applications']){delete _0x56384a[_0xa727('0x8d')]['Applications'];}if(_0x56384a[_0xa727('0x8d')]['List']&&_0x56384a[_0xa727('0x8d')]['List'][_0xa727('0x8e')][_0xa727('0x52')]){return _0x56384a[_0xa727('0x8d')][_0xa727('0x87')]['Contacts'][0x0];}var _0x3a3bad=_['defaults'](_0x463753[_0xa727('0x63')],{'firstName':_0x463753[_0xa727('0x63')][_0xa727('0x7f')],'ListId':_0x66e5f1[_0xa727('0x8f')]});_0x3a3bad[_0x463753['body'][_0xa727('0x83')]]=_0x463753['body'][_0xa727('0x7f')];return db[_0xa727('0x79')]['create'](_0x3a3bad,{'fields':_0x2651db,'raw':!![]});}})[_0xa727('0x28')](handleEntityNotFound(_0x3ff83a,null))[_0xa727('0x28')](function(_0xad2448){_0x56384a[_0xa727('0x90')]=_0xad2448;if(_0xad2448){var _0x115d4d={'ContactId':_0xad2448['id'],'OpenchannelAccountId':_0x463753[_0xa727('0x5f')]['id'],'from':(_0xad2448[_0xa727('0x91')]||'')+'\x20'+(_0xad2448[_0xa727('0x92')]||'')};var _0x5a367d={'OpenchannelAccountId':_0x463753[_0xa727('0x5f')]['id'],'closed':![]};if(_0x463753[_0xa727('0x63')][_0xa727('0x93')]){_0x5a367d['threadId']=_0x463753[_0xa727('0x63')][_0xa727('0x93')];return db[_0xa727('0x94')][_0xa727('0x61')]({'where':_0x5a367d})[_0xa727('0x28')](function(_0x12c88c){if(_0x12c88c){return[_0x12c88c,![]];}_0x115d4d[_0xa727('0x93')]=_0x463753['body'][_0xa727('0x93')];_0x115d4d[_0xa727('0x95')]=_0x463753['body'][_0xa727('0x95')];return db[_0xa727('0x94')][_0xa727('0x62')](_0x115d4d)[_0xa727('0x28')](function(_0x2e17d8){return[_0x2e17d8,!![]];});});}else{_0x5a367d[_0xa727('0x93')]=null;}_0x5a367d[_0xa727('0x96')]=_0xad2448['id'];return db[_0xa727('0x94')][_0xa727('0x61')]({'where':_0x5a367d})['then'](function(_0x46639d){if(_0x46639d){return[_0x46639d,![]];}return db[_0xa727('0x94')][_0xa727('0x62')](_0x115d4d)['then'](function(_0x53bf68){return[_0x53bf68,!![]];});});}})[_0xa727('0x97')](function(_0x30b98d,_0x1037ba){if(_0x30b98d){_0x2b7c35=_0x1037ba;if(!_0x1037ba){var _0x187820={'from':(_0x56384a[_0xa727('0x90')]['firstName']||'')+'\x20'+(_0x56384a[_0xa727('0x90')][_0xa727('0x92')]||'')};if(_0x463753['body'][_0xa727('0x93')]&&_0x463753[_0xa727('0x63')][_0xa727('0x98')]&&_0x463753[_0xa727('0x63')][_0xa727('0x93')]!=_0x463753[_0xa727('0x63')][_0xa727('0x98')]){_0x187820['threadId']=_0x463753[_0xa727('0x63')][_0xa727('0x98')];}return _0x30b98d[_0xa727('0x3c')](_0x187820);}else{return _0x30b98d;}}})[_0xa727('0x28')](function(_0x48e009){_0x56384a[_0xa727('0x99')]=_0x48e009[_0xa727('0x3e')]({'plain':!![]});_0x56384a[_0xa727('0x99')][_0xa727('0x9a')]=_0x2b7c35;if(_0x56384a[_0xa727('0x99')]['created']){if(_0x56384a[_0xa727('0x8d')][_0xa727('0x9b')]){_0x56384a['applications'][_0xa727('0x9c')]({'id':0x0,'priority':_0x56384a['applications'][_0xa727('0x52')]+0x1,'app':_0xa727('0x9d'),'appdata':_0xa727('0x9e'),'interval':'*,*,*,*'});}}return db[_0xa727('0x9f')][_0xa727('0x62')]({'body':_0x463753[_0xa727('0x63')]['body'],'OpenchannelAccountId':_0x463753[_0xa727('0x5f')]['id'],'OpenchannelInteractionId':_0x48e009['id'],'direction':'in','ContactId':_0x56384a[_0xa727('0x90')]['id'],'AttachmentId':_0x463753['body']['AttachmentId']});})[_0xa727('0x28')](function(_0x151175){_0x56384a[_0xa727('0x2f')]=_0x151175;if(!_0x56384a[_0xa727('0x99')]['UserId'])return;return db[_0xa727('0xa0')][_0xa727('0x61')]({'attributes':['id',_0xa727('0x42')],'where':{'id':_0x56384a['interaction'][_0xa727('0xa1')]}});})[_0xa727('0x28')](function(_0x124529){if(_0x124529){_0x56384a[_0xa727('0x8b')][_0xa727('0xa2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x124529[_0xa727('0x42')]+','+(_0x56384a[_0xa727('0x8d')][_0xa727('0xa3')]||0xa),'interval':_0xa727('0xa4')});}if(!_0x56384a['interaction'][_0xa727('0xa5')])return;return db[_0xa727('0xa6')]['find']({'attributes':['id','name'],'where':{'id':_0x56384a[_0xa727('0x99')][_0xa727('0xa5')]}});})[_0xa727('0x28')](function(_0x2dc64e){if(_0x2dc64e){_0x56384a[_0xa727('0x8b')][_0xa727('0xa2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2dc64e[_0xa727('0x42')]+','+(_0x56384a[_0xa727('0x8d')][_0xa727('0xa7')]||0x12c),'interval':_0xa727('0xa4')});}return respondWithRpcPromise(_0xa727('0xa8'),_0xa727('0xa9'),_0x56384a);})[_0xa727('0x28')](function(_0x187365){respondWithRpcPromise('EventManager','EventManager',{'event':_0xa727('0xaa'),'message':_0x187365},client9002);return _0x187365;})[_0xa727('0x28')](respondWithResult(_0x3ff83a,null))[_0xa727('0x31')](handleError(_0x3ff83a,null));};exports[_0xa727('0xab')]=function(_0x5df989,_0x4fc4dd){var _0x1cee51=_0x5df989[_0xa727('0x5f')]['id'];var _0x51eb9d=_0x5df989['body'];var _0x1c39c9=0xc8;var _0x294035=null;return db['sequelize'][_0xa727('0xac')]({'isolationLevel':db[_0xa727('0xad')][_0xa727('0xae')]['ISOLATION_LEVELS'][_0xa727('0xaf')]},function(_0x354eec){return db[_0xa727('0x48')][_0xa727('0x6f')]({'where':{'id':_0x1cee51},'transaction':_0x354eec})[_0xa727('0x28')](function(_0x48616c){if(_0x48616c){return db[_0xa727('0x89')][_0xa727('0x3d')]({'where':{'OpenchannelAccountId':_0x1cee51},'transaction':_0x354eec})[_0xa727('0x28')](function(){var _0x405d13=_['map'](_0x51eb9d,function(_0x40c829){_0x40c829[_0xa727('0x6d')]=_0x1cee51;return _0x40c829;});return db[_0xa727('0x89')][_0xa727('0xb0')](_0x405d13,{'transaction':_0x354eec});});}else{_0x1c39c9=0x194;_0x294035=[];}});})[_0xa727('0x28')](function(){if(_0x1c39c9!==0x194){return db['OpenchannelApplication'][_0xa727('0xb1')]({'where':{'OpenchannelAccountId':_0x1cee51},'order':_0xa727('0xb2')})[_0xa727('0x28')](function(_0x40d2f1){_0x294035=_0x40d2f1;});}})[_0xa727('0x31')](function(_0x56641c){_0x1c39c9=0x1f4;logger[_0xa727('0x2e')](_0x56641c['stack']);if(_0x56641c[_0xa727('0x42')]){delete _0x56641c['name'];}_0x294035=_0x56641c;})[_0xa727('0xb3')](function(){if(_0x294035===null){_0x4fc4dd[_0xa727('0x32')](_0x1c39c9);}else{if(_0x1c39c9===0x1f4){_0x4fc4dd[_0xa727('0x33')](_0x1c39c9)[_0xa727('0x43')](_0x294035);}else{_0x4fc4dd[_0xa727('0x33')](_0x1c39c9)[_0xa727('0x34')](_0x294035);}}});};exports['getApplications']=function(_0x1e33a8,_0x10f9bf,_0x32434d){var _0x4fa4db={};var _0x295af8={};var _0x3595c3;var _0x470540;return db[_0xa727('0x48')][_0xa727('0x6f')]({'where':{'id':_0x1e33a8[_0xa727('0x5f')]['id']}})['then'](handleEntityNotFound(_0x10f9bf,null))['then'](function(_0x1aeb26){if(_0x1aeb26){_0x3595c3=_0x1aeb26;_0x295af8['model']=_[_0xa727('0x60')](db[_0xa727('0x89')][_0xa727('0x49')]);_0x295af8[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x1e33a8[_0xa727('0x4c')]);_0x295af8[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x295af8[_0xa727('0x4f')],_0x295af8[_0xa727('0x4c')]);_0x4fa4db['attributes']=_[_0xa727('0x4e')](_0x295af8[_0xa727('0x4f')],qs[_0xa727('0x50')](_0x1e33a8[_0xa727('0x4c')][_0xa727('0x50')]));_0x4fa4db[_0xa727('0x51')]=_0x4fa4db['attributes']['length']?_0x4fa4db[_0xa727('0x51')]:_0x295af8[_0xa727('0x4f')];_0x4fa4db['order']=qs[_0xa727('0x54')](_0x1e33a8[_0xa727('0x4c')][_0xa727('0x54')]);_0x4fa4db[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0x1e33a8[_0xa727('0x4c')],_0x295af8[_0xa727('0x4d')]));if(_0x1e33a8[_0xa727('0x4c')]['filter']){_0x4fa4db[_0xa727('0x55')]=_['merge'](_0x4fa4db[_0xa727('0x55')],{'$or':_[_0xa727('0x47')](_0x4fa4db[_0xa727('0x51')],function(_0x3fa9dd){var _0x29d323={};_0x29d323[_0x3fa9dd]={'$like':'%'+_0x1e33a8['query'][_0xa727('0x57')]+'%'};return _0x29d323;})});}_0x4fa4db=_[_0xa727('0x59')]({},_0x4fa4db,_0x1e33a8[_0xa727('0x5a')]);return _0x3595c3[_0xa727('0xb4')](_0x4fa4db);}})[_0xa727('0x28')](function(_0x64c55a){if(_0x64c55a){_0x470540=_0x64c55a[_0xa727('0x52')];if(!_0x1e33a8[_0xa727('0x4c')][_0xa727('0x53')]('nolimit')){_0x4fa4db['limit']=qs[_0xa727('0x36')](_0x1e33a8[_0xa727('0x4c')]['limit']);_0x4fa4db[_0xa727('0x38')]=qs[_0xa727('0x38')](_0x1e33a8['query'][_0xa727('0x38')]);}return _0x3595c3['getApplications'](_0x4fa4db);}})[_0xa727('0x28')](function(_0x27b9d2){if(_0x27b9d2){return _0x27b9d2?{'count':_0x470540,'rows':_0x27b9d2}:null;}})[_0xa727('0x28')](respondWithResult(_0x10f9bf,null))[_0xa727('0x31')](handleError(_0x10f9bf,null));};exports[_0xa727('0xb5')]=function(_0x45e866,_0x457352,_0x1c3c61){var _0x1d15e4={'raw':![],'where':{}};var _0x4f7f3a={};var _0x349961={'count':0x0,'rows':[]};return db[_0xa727('0x48')][_0xa727('0x6f')]({'where':{'id':_0x45e866[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x457352,null))['then'](function(_0x36006c){if(_0x36006c){_0x4f7f3a[_0xa727('0x4f')]=_[_0xa727('0x60')](db['OpenchannelInteraction']['rawAttributes']);_0x4f7f3a[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x45e866['query']);_0x4f7f3a[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x4f7f3a['model'],_0x4f7f3a['query']);_0x1d15e4['attributes']=_[_0xa727('0x4e')](_0x4f7f3a[_0xa727('0x4f')],qs[_0xa727('0x50')](_0x45e866[_0xa727('0x4c')][_0xa727('0x50')]));_0x1d15e4[_0xa727('0x51')]=_0x1d15e4[_0xa727('0x51')][_0xa727('0x52')]?_0x1d15e4[_0xa727('0x51')]:_0x4f7f3a[_0xa727('0x4f')];if(!_0x45e866['query'][_0xa727('0x53')](_0xa727('0x70'))){_0x1d15e4[_0xa727('0x36')]=qs[_0xa727('0x36')](_0x45e866[_0xa727('0x4c')][_0xa727('0x36')]);_0x1d15e4['offset']=qs['offset'](_0x45e866[_0xa727('0x4c')]['offset']);}_0x1d15e4[_0xa727('0x71')]=qs[_0xa727('0x54')](_0x45e866[_0xa727('0x4c')]['sort']);_0x1d15e4[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0x45e866[_0xa727('0x4c')],_0x4f7f3a[_0xa727('0x4d')]));_0x1d15e4['where'][_0xa727('0x6d')]=_0x36006c['id'];if(_0x45e866[_0xa727('0x4c')]['filter']){_0x1d15e4[_0xa727('0x55')]=_['merge'](_0x1d15e4['where'],{'$or':_[_0xa727('0x47')](_0x1d15e4['attributes'],function(_0x4cbbd4){var _0x4e27c2={};_0x4e27c2[_0x4cbbd4]={'$like':'%'+_0x45e866[_0xa727('0x4c')][_0xa727('0x57')]+'%'};return _0x4e27c2;})});}_0x1d15e4=_[_0xa727('0x59')]({},_0x1d15e4,_0x45e866[_0xa727('0x5a')]);return db[_0xa727('0x94')][_0xa727('0x37')]({'where':_0x1d15e4[_0xa727('0x55')]})[_0xa727('0x28')](function(_0xf05493){_0x349961['count']=_0xf05493;if(_0x45e866['query'][_0xa727('0x5b')]){_0x1d15e4['include']=[{'model':db[_0xa727('0x79')],'as':_0xa727('0xb6'),'required':![]},{'model':db[_0xa727('0xa0')],'as':_0xa727('0xb7'),'attributes':[_0xa727('0x42'),_0xa727('0xb8'),_0xa727('0xb9')],'required':![]},{'model':db[_0xa727('0xba')],'as':'Tags','attributes':['id',_0xa727('0x42'),_0xa727('0xbb')],'where':_0x45e866['query'][_0xa727('0xbc')]?{'id':_0x45e866[_0xa727('0x4c')][_0xa727('0xbc')]}:undefined,'required':_0x45e866[_0xa727('0x4c')][_0xa727('0xbc')]?!![]:![]}];}return db[_0xa727('0x94')][_0xa727('0x76')](_0x1d15e4);})[_0xa727('0x28')](function(_0x4e8e94){_0x349961[_0xa727('0x5d')]=_0x4e8e94;return _0x349961;});}})[_0xa727('0x28')](respondWithFilteredResult(_0x457352,_0x1d15e4))[_0xa727('0x31')](handleError(_0x457352,null));};exports['addAgents']=function(_0x2c1e35,_0xced1d,_0x104b89){return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x2c1e35[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0xced1d,null))[_0xa727('0x28')](function(_0x5747eb){if(_0x5747eb){return _0x5747eb[_0xa727('0xbd')](_0x2c1e35[_0xa727('0x63')][_0xa727('0x73')],_[_0xa727('0xbe')](_0x2c1e35[_0xa727('0x63')],[_0xa727('0x73'),'id'])||{})['spread'](function(_0x49ee2e){for(var _0x519641=0x0;_0x519641<_0x2c1e35['body']['ids'][_0xa727('0x52')];_0x519641+=0x1){socket[_0xa727('0xbf')](_0xa727('0xc0'),{'UserId':Number(_0x2c1e35[_0xa727('0x63')][_0xa727('0x73')][_0x519641]),'OpenchannelAccountId':Number(_0x2c1e35[_0xa727('0x5f')]['id'])});}return _0x49ee2e;});}})[_0xa727('0x28')](respondWithResult(_0xced1d,null))['catch'](handleError(_0xced1d,null));};exports[_0xa727('0xc1')]=function(_0x53b9d0,_0x49f9b5,_0x41047f){return db['OpenchannelAccount'][_0xa727('0x61')]({'where':{'id':_0x53b9d0[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x49f9b5,null))[_0xa727('0x28')](function(_0x1f45fb){if(_0x1f45fb){return _0x1f45fb['removeAgents'](_0x53b9d0[_0xa727('0x4c')][_0xa727('0x73')])[_0xa727('0x28')](function(){if(_[_0xa727('0xc2')](_0x53b9d0['query'][_0xa727('0x73')])){for(var _0x47b58f=0x0;_0x47b58f<_0x53b9d0[_0xa727('0x4c')][_0xa727('0x73')]['length'];_0x47b58f+=0x1){socket[_0xa727('0xbf')](_0xa727('0xc3'),{'UserId':Number(_0x53b9d0[_0xa727('0x4c')][_0xa727('0x73')][_0x47b58f]),'OpenchannelAccountId':Number(_0x53b9d0[_0xa727('0x5f')]['id'])});}}else{socket[_0xa727('0xbf')](_0xa727('0xc3'),{'UserId':Number(_0x53b9d0[_0xa727('0x4c')][_0xa727('0x73')]),'OpenchannelAccountId':Number(_0x53b9d0[_0xa727('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x49f9b5,null))[_0xa727('0x31')](handleError(_0x49f9b5,null));};exports[_0xa727('0xc4')]=function(_0x2c1cdc,_0x207ec7,_0x18e1aa){var _0x6f3c07={};var _0x2c96c3={};var _0x5148de;var _0x5c2c3d;return db[_0xa727('0x48')]['findOne']({'where':{'id':_0x2c1cdc[_0xa727('0x5f')]['id']}})['then'](handleEntityNotFound(_0x207ec7,null))[_0xa727('0x28')](function(_0x46298e){if(_0x46298e){_0x5148de=_0x46298e;_0x2c96c3[_0xa727('0x4f')]=_[_0xa727('0x60')](db[_0xa727('0xa0')][_0xa727('0x49')]);_0x2c96c3[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x2c1cdc[_0xa727('0x4c')]);_0x2c96c3[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x2c96c3['model'],_0x2c96c3[_0xa727('0x4c')]);_0x6f3c07[_0xa727('0x51')]=_[_0xa727('0x4e')](_0x2c96c3[_0xa727('0x4f')],qs[_0xa727('0x50')](_0x2c1cdc['query'][_0xa727('0x50')]));_0x6f3c07[_0xa727('0x51')]=_0x6f3c07[_0xa727('0x51')][_0xa727('0x52')]?_0x6f3c07['attributes']:_0x2c96c3[_0xa727('0x4f')];_0x6f3c07[_0xa727('0x71')]=qs[_0xa727('0x54')](_0x2c1cdc[_0xa727('0x4c')]['sort']);_0x6f3c07[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0x2c1cdc['query'],_0x2c96c3[_0xa727('0x4d')]));if(_0x2c1cdc['query']['filter']){_0x6f3c07[_0xa727('0x55')]=_[_0xa727('0x59')](_0x6f3c07[_0xa727('0x55')],{'$or':_[_0xa727('0x47')](_0x6f3c07['attributes'],function(_0x5bb43c){var _0x5b5f06={};_0x5b5f06[_0x5bb43c]={'$like':'%'+_0x2c1cdc[_0xa727('0x4c')][_0xa727('0x57')]+'%'};return _0x5b5f06;})});}_0x6f3c07=_['merge']({},_0x6f3c07,_0x2c1cdc[_0xa727('0x5a')]);return _0x5148de[_0xa727('0xc4')](_0x6f3c07);}})['then'](function(_0x3c149a){if(_0x3c149a){_0x5c2c3d=_0x3c149a[_0xa727('0x52')];if(!_0x2c1cdc[_0xa727('0x4c')][_0xa727('0x53')](_0xa727('0x70'))){_0x6f3c07[_0xa727('0x36')]=qs[_0xa727('0x36')](_0x2c1cdc[_0xa727('0x4c')][_0xa727('0x36')]);_0x6f3c07[_0xa727('0x38')]=qs['offset'](_0x2c1cdc['query'][_0xa727('0x38')]);}return _0x5148de[_0xa727('0xc4')](_0x6f3c07);}})[_0xa727('0x28')](function(_0x202ff4){if(_0x202ff4){return _0x202ff4?{'count':_0x5c2c3d,'rows':_0x202ff4}:null;}})['then'](respondWithResult(_0x207ec7,null))[_0xa727('0x31')](handleError(_0x207ec7,null));};exports[_0xa727('0x43')]=function(_0x380913,_0x7b723,_0x550e93){var _0x48c222,_0x5b3965,_0x5ccb55;if(_[_0xa727('0x81')](_0x380913['body']['body'])||_0x380913[_0xa727('0x63')]['body']===''){throw new db['Sequelize'][(_0xa727('0x80'))](_0xa727('0x82'));}if(_[_0xa727('0x81')](_0x380913['body']['to'])){}_0x48c222=_0x380913[_0xa727('0x63')]['to'];return db[_0xa727('0x48')][_0xa727('0x6f')]({'where':{'id':_0x380913['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x7b723,null))[_0xa727('0x28')](function(_0x227de4){if(_0x227de4){return db[_0xa727('0x48')]['find']({'where':{'id':_0x227de4['id']},'include':[{'model':db[_0xa727('0x86')],'as':_0xa727('0x87'),'include':[{'model':db[_0xa727('0x79')],'as':_0xa727('0x8e'),'where':{[_0x227de4[_0xa727('0x83')]]:_0x48c222},'limit':0x1,'order':[[_0xa727('0x88'),_0xa727('0xc5')]]}]}]})[_0xa727('0x28')](handleEntityNotFound(_0x7b723,null))[_0xa727('0x28')](function(_0x3d1984){if(_0x3d1984&&_0x3d1984[_0xa727('0x87')]){_0x5b3965=_0x3d1984[_0xa727('0x3e')]({'plain':!![]});if(_0x5b3965['List']&&_0x5b3965[_0xa727('0x87')][_0xa727('0x8e')][_0xa727('0x52')]){return _0x5b3965[_0xa727('0x87')][_0xa727('0x8e')][0x0];}return db[_0xa727('0x79')][_0xa727('0x62')](_['defaults'](_0x380913[_0xa727('0x63')],{'firstName':_0x48c222,[_0x3d1984[_0xa727('0x83')]]:_0x48c222,'phone':_0x48c222,'ListId':_0x5b3965[_0xa727('0x8f')]}));}})[_0xa727('0x28')](handleEntityNotFound(_0x7b723,null))['then'](function(_0x1d172a){if(_0x1d172a){_0x5ccb55=_0x1d172a;return db[_0xa727('0x94')][_0xa727('0x61')]({'where':{'ContactId':_0x5ccb55['id'],'closed':![],'OpenchannelAccountId':_0x5b3965['id']}})[_0xa727('0x28')](function(_0x7c0056){if(_0x7c0056){return[_0x7c0056,![]];}return db[_0xa727('0x94')][_0xa727('0x62')]({'UserId':_0x380913[_0xa727('0x64')]['id'],'ContactId':_0x5ccb55['id'],'OpenchannelAccountId':_0x5b3965['id'],'lastMsgDirection':'out','firstMsgDirection':_0xa727('0xc6'),'Messages':[_[_0xa727('0x59')](_0x380913[_0xa727('0x63')],{'read':![],'body':_0x380913[_0xa727('0x63')][_0xa727('0x63')],'OpenchannelAccountId':_0x5b3965['id'],'UserId':_0x380913[_0xa727('0x64')]['id'],'ContactId':_0x5ccb55['id']})]},{'include':[{'model':db[_0xa727('0x9f')],'as':_0xa727('0xc7')}]})[_0xa727('0x28')](function(_0x415bab){return[_0x415bab,!![]];});});}})['spread'](function(_0x5ee8a6,_0x446c06){if(_0x446c06){return _0x5ee8a6;}return db['OpenchannelMessage'][_0xa727('0x62')](_['merge'](_0x380913[_0xa727('0x63')],{'read':![],'body':_0x380913[_0xa727('0x63')][_0xa727('0x63')],'OpenchannelAccountId':_0x5b3965['id'],'OpenchannelInteractionId':_0x5ee8a6['id'],'UserId':_0x380913[_0xa727('0x64')]['id'],'ContactId':_0x5ccb55['id']}))['then'](function(_0x3c2852){_0x5ee8a6[_0xa727('0xc8')][_0xa727('0xc7')]=[];_0x5ee8a6[_0xa727('0xc8')]['Messages']['push'](_0x3c2852[_0xa727('0xc8')]);return _0x5ee8a6;});});}})['then'](respondWithResult(_0x7b723,null))[_0xa727('0x31')](handleError(_0x7b723,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 70d564b..955a898 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 _0x6f7a=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3690a2,_0x2af11f){_0x3690a2=_0x3690a2-0x0;var _0x5c48de=_0x6f7a[_0x3690a2];return _0x5c48de;};'use strict';var EventEmitter=require(_0xa6f7('0x0'));var OpenchannelAccount=require(_0xa6f7('0x1'))['db'][_0xa6f7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa6f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6f7('0x4'),'afterDestroy':_0xa6f7('0x5')};function emitEvent(_0x12ecb8){return function(_0x1da6dc,_0x22e529,_0x1f5922){OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8+':'+_0x1da6dc['id'],_0x1da6dc);OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8,_0x1da6dc);_0x1f5922(null);};}for(var e in events){if(events[_0xa6f7('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa6f7('0x8')](e,emitEvent(event));}}module[_0xa6f7('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6c76=['update','emit','hook','events','../../mysqldb','OpenchannelAccount','save'];(function(_0x5c2cea,_0x397c29){var _0x26054e=function(_0x494dcf){while(--_0x494dcf){_0x5c2cea['push'](_0x5c2cea['shift']());}};_0x26054e(++_0x397c29);}(_0x6c76,0x184));var _0x66c7=function(_0x46a2f1,_0x321d0b){_0x46a2f1=_0x46a2f1-0x0;var _0x3c18f4=_0x6c76[_0x46a2f1];return _0x3c18f4;};'use strict';var EventEmitter=require(_0x66c7('0x0'));var OpenchannelAccount=require(_0x66c7('0x1'))['db'][_0x66c7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66c7('0x3'),'afterUpdate':_0x66c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x572a2b){return function(_0x2f6db7,_0x2b7cf3,_0x49d437){OpenchannelAccountEvents[_0x66c7('0x5')](_0x572a2b+':'+_0x2f6db7['id'],_0x2f6db7);OpenchannelAccountEvents[_0x66c7('0x5')](_0x572a2b,_0x2f6db7);_0x49d437(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x66c7('0x6')](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 a94d07e..227937e 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(_0x1205ab,_0x296de5){var _0x2be0ac=function(_0x34639f){while(--_0x34639f){_0x1205ab['push'](_0x1205ab['shift']());}};_0x2be0ac(++_0x296de5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x2dd17b,_0x59dad9){var _0x396cc2=function(_0x2e85d2){while(--_0x2e85d2){_0x2dd17b['push'](_0x2dd17b['shift']());}};_0x396cc2(++_0x59dad9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 0a34a00..763ddb3 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 _0x84a0=['redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x43918d,_0x3dcef8){var _0x20947e=function(_0x246332){while(--_0x246332){_0x43918d['push'](_0x43918d['shift']());}};_0x20947e(++_0x3dcef8);}(_0x84a0,0x66));var _0x084a=function(_0x4f9208,_0x6eadec){_0x4f9208=_0x4f9208-0x0;var _0x3f01f8=_0x84a0[_0x4f9208];return _0x3f01f8;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});config[_0x084a('0xa')]=_[_0x084a('0xb')](config[_0x084a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x084a('0xc'))(new Redis(config[_0x084a('0xa')]));require(_0x084a('0xd'))[_0x084a('0xe')](socket);function respondWithRpcPromise(_0x142127,_0x4c1e29,_0x4dd423){return new BPromise(function(_0x3d9dc6,_0x853df){return client[_0x084a('0xf')](_0x142127,_0x4dd423)[_0x084a('0x10')](function(_0x2d7c90){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));logger[_0x084a('0x12')](_0x084a('0x13'),_0x4c1e29,_0x084a('0x11'),JSON[_0x084a('0x14')](_0x2d7c90));if(_0x2d7c90[_0x084a('0x15')]){if(_0x2d7c90[_0x084a('0x15')][_0x084a('0x16')]===0x1f4){logger['error'](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x853df(_0x2d7c90[_0x084a('0x15')][_0x084a('0x18')]);}logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x3d9dc6(_0x2d7c90['error'][_0x084a('0x18')]);}else{logger[_0x084a('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));_0x3d9dc6(_0x2d7c90[_0x084a('0x1a')][_0x084a('0x18')]);}})[_0x084a('0x1b')](function(_0x33d3a6){logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x33d3a6);_0x853df(_0x33d3a6);});});} \ No newline at end of file +var _0x84a0=['redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0xc587ed,_0x11cbc2){var _0x41d137=function(_0x2d288f){while(--_0x2d288f){_0xc587ed['push'](_0xc587ed['shift']());}};_0x41d137(++_0x11cbc2);}(_0x84a0,0x66));var _0x084a=function(_0x4e71f7,_0x147594){_0x4e71f7=_0x4e71f7-0x0;var _0x29970b=_0x84a0[_0x4e71f7];return _0x29970b;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});config[_0x084a('0xa')]=_[_0x084a('0xb')](config[_0x084a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x084a('0xc'))(new Redis(config[_0x084a('0xa')]));require(_0x084a('0xd'))[_0x084a('0xe')](socket);function respondWithRpcPromise(_0x142127,_0x4c1e29,_0x4dd423){return new BPromise(function(_0x3d9dc6,_0x853df){return client[_0x084a('0xf')](_0x142127,_0x4dd423)[_0x084a('0x10')](function(_0x2d7c90){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));logger[_0x084a('0x12')](_0x084a('0x13'),_0x4c1e29,_0x084a('0x11'),JSON[_0x084a('0x14')](_0x2d7c90));if(_0x2d7c90[_0x084a('0x15')]){if(_0x2d7c90[_0x084a('0x15')][_0x084a('0x16')]===0x1f4){logger['error'](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x853df(_0x2d7c90[_0x084a('0x15')][_0x084a('0x18')]);}logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x3d9dc6(_0x2d7c90['error'][_0x084a('0x18')]);}else{logger[_0x084a('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));_0x3d9dc6(_0x2d7c90[_0x084a('0x1a')][_0x084a('0x18')]);}})[_0x084a('0x1b')](function(_0x33d3a6){logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x33d3a6);_0x853df(_0x33d3a6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index f32b1f0..5d5c6f8 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 _0x422f=['update','emit','removeListener','register','openchannelAccount:','save'];(function(_0x5721eb,_0x176164){var _0x5edfd2=function(_0xba44b4){while(--_0xba44b4){_0x5721eb['push'](_0x5721eb['shift']());}};_0x5edfd2(++_0x176164);}(_0x422f,0x1c7));var _0xf422=function(_0x35b08a,_0xd824d1){_0x35b08a=_0x35b08a-0x0;var _0x20bc1a=_0x422f[_0x35b08a];return _0x20bc1a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xf422('0x0'),'remove',_0xf422('0x1')];function createListener(_0x2148ba,_0x55031a){return function(_0x23acfa){_0x55031a[_0xf422('0x2')](_0x2148ba,_0x23acfa);};}function removeListener(_0x312bc8,_0x444ad5){return function(){OpenchannelAccountEvents[_0xf422('0x3')](_0x312bc8,_0x444ad5);};}exports[_0xf422('0x4')]=function(_0x3e3e5d){for(var _0x13ed91=0x0,_0x350b2d=events['length'];_0x13ed91<_0x350b2d;_0x13ed91++){var _0x3f4801=events[_0x13ed91];var _0x1037fa=createListener(_0xf422('0x5')+_0x3f4801,_0x3e3e5d);OpenchannelAccountEvents['on'](_0x3f4801,_0x1037fa);}}; \ No newline at end of file +var _0x26c2=['update','register','length','openchannelAccount:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x26c2,0x130));var _0x226c=function(_0x9471c0,_0x48b082){_0x9471c0=_0x9471c0-0x0;var _0x533362=_0x26c2[_0x9471c0];return _0x533362;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove',_0x226c('0x0')];function createListener(_0x23ec98,_0x674a14){return function(_0x3b56e8){_0x674a14['emit'](_0x23ec98,_0x3b56e8);};}function removeListener(_0x2f79d3,_0x117899){return function(){OpenchannelAccountEvents['removeListener'](_0x2f79d3,_0x117899);};}exports[_0x226c('0x1')]=function(_0xb40fbd){for(var _0x21ed3a=0x0,_0x3c4e5d=events[_0x226c('0x2')];_0x21ed3a<_0x3c4e5d;_0x21ed3a++){var _0x59804e=events[_0x21ed3a];var _0x34cbc3=createListener(_0x226c('0x3')+_0x59804e,_0xb40fbd);OpenchannelAccountEvents['on'](_0x59804e,_0x34cbc3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index aab3144..4ffe56d 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 _0xe064=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','create','put','update','destroy','exports','multer','path'];(function(_0x434db2,_0x113541){var _0x4e9284=function(_0x5d59b4){while(--_0x5d59b4){_0x434db2['push'](_0x434db2['shift']());}};_0x4e9284(++_0x113541);}(_0xe064,0x9e));var _0x4e06=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0xe064[_0x260e4b];return _0x18dfba;};'use strict';var multer=require(_0x4e06('0x0'));var util=require('util');var path=require(_0x4e06('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e06('0x2')]();var fs_extra=require(_0x4e06('0x3'));var auth=require(_0x4e06('0x4'));var interaction=require(_0x4e06('0x5'));var config=require(_0x4e06('0x6'));var controller=require(_0x4e06('0x7'));router[_0x4e06('0x8')]('/',auth[_0x4e06('0x9')](),controller['index']);router['get'](_0x4e06('0xa'),auth[_0x4e06('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4e06('0xb')]);router[_0x4e06('0xc')](_0x4e06('0xa'),auth[_0x4e06('0x9')](),controller[_0x4e06('0xd')]);router['delete']('/:id',auth[_0x4e06('0x9')](),controller[_0x4e06('0xe')]);module[_0x4e06('0xf')]=router; \ No newline at end of file +var _0xd412=['delete','destroy','util','path','fs-extra','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x5c1d92,_0x307ecb){var _0x2bb737=function(_0x2623db){while(--_0x2623db){_0x5c1d92['push'](_0x5c1d92['shift']());}};_0x2bb737(++_0x307ecb);}(_0xd412,0x172));var _0x2d41=function(_0x3ca6f6,_0x3e9153){_0x3ca6f6=_0x3ca6f6-0x0;var _0x5e24d6=_0xd412[_0x3ca6f6];return _0x5e24d6;};'use strict';var multer=require('multer');var util=require(_0x2d41('0x0'));var path=require(_0x2d41('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2d41('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2d41('0x3'));var controller=require(_0x2d41('0x4'));router[_0x2d41('0x5')]('/',auth[_0x2d41('0x6')](),controller[_0x2d41('0x7')]);router[_0x2d41('0x5')]('/:id',auth[_0x2d41('0x6')](),controller[_0x2d41('0x8')]);router[_0x2d41('0x9')]('/',auth['isAuthenticated'](),controller[_0x2d41('0xa')]);router[_0x2d41('0xb')](_0x2d41('0xc'),auth[_0x2d41('0x6')](),controller[_0x2d41('0xd')]);router[_0x2d41('0xe')](_0x2d41('0xc'),auth[_0x2d41('0x6')](),controller[_0x2d41('0xf')]);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 9a4ff7c..b9a5018 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 _0x5a92=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4e3a8a,_0xa6ad36){var _0x40de5e=function(_0xebbe7a){while(--_0xebbe7a){_0x4e3a8a['push'](_0x4e3a8a['shift']());}};_0x40de5e(++_0xa6ad36);}(_0x5a92,0xa6));var _0x25a9=function(_0x18f9b9,_0xe6c8ec){_0x18f9b9=_0x18f9b9-0x0;var _0x2f5790=_0x5a92[_0x18f9b9];return _0x2f5790;};'use strict';var Sequelize=require(_0x25a9('0x0'));module[_0x25a9('0x1')]={'priority':{'type':Sequelize[_0x25a9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x25a9('0x3')],'allowNull':![],'defaultValue':_0x25a9('0x4')},'appdata':{'type':Sequelize[_0x25a9('0x5')]()},'description':{'type':Sequelize[_0x25a9('0x3')]},'interval':{'type':Sequelize[_0x25a9('0x3')],'defaultValue':_0x25a9('0x6')}}; \ No newline at end of file +var _0xcfd4=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x17db36,_0x4aad51){var _0x4eb56=function(_0x45126e){while(--_0x45126e){_0x17db36['push'](_0x17db36['shift']());}};_0x4eb56(++_0x4aad51);}(_0xcfd4,0xe1));var _0x4cfd=function(_0x4d2135,_0x19a550){_0x4d2135=_0x4d2135-0x0;var _0x5ddba8=_0xcfd4[_0x4d2135];return _0x5ddba8;};'use strict';var Sequelize=require(_0x4cfd('0x0'));module[_0x4cfd('0x1')]={'priority':{'type':Sequelize[_0x4cfd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4cfd('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4cfd('0x3')]},'interval':{'type':Sequelize[_0x4cfd('0x3')],'defaultValue':_0x4cfd('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b07caf4..2c836af 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 _0xfdab=['VIRTUAL','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge'];(function(_0xb2c4e,_0x75b613){var _0x3f5cef=function(_0x4c275d){while(--_0x4c275d){_0xb2c4e['push'](_0xb2c4e['shift']());}};_0x3f5cef(++_0x75b613);}(_0xfdab,0x148));var _0xbfda=function(_0x268843,_0x40e471){_0x268843=_0x268843-0x0;var _0x5b15fa=_0xfdab[_0x268843];return _0x5b15fa;};'use strict';var emlformat=require(_0xbfda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfda('0x1'));var jsonpatch=require(_0xbfda('0x2'));var rp=require(_0xbfda('0x3'));var moment=require(_0xbfda('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbfda('0x5'));var util=require(_0xbfda('0x6'));var path=require(_0xbfda('0x7'));var sox=require(_0xbfda('0x8'));var csv=require(_0xbfda('0x9'));var ejs=require(_0xbfda('0xa'));var fs=require('fs');var fs_extra=require(_0xbfda('0xb'));var _=require(_0xbfda('0xc'));var squel=require(_0xbfda('0xd'));var crypto=require(_0xbfda('0xe'));var jsforce=require(_0xbfda('0xf'));var deskjs=require(_0xbfda('0x10'));var toCsv=require(_0xbfda('0x9'));var querystring=require(_0xbfda('0x11'));var Papa=require(_0xbfda('0x12'));var Redis=require(_0xbfda('0x13'));var authService=require(_0xbfda('0x14'));var qs=require(_0xbfda('0x15'));var as=require(_0xbfda('0x16'));var hardwareService=require(_0xbfda('0x17'));var logger=require(_0xbfda('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xbfda('0x19'));var licenseUtil=require(_0xbfda('0x1a'));var db=require(_0xbfda('0x1b'))['db'];function respondWithStatusCode(_0x1d84a1,_0x212a76){_0x212a76=_0x212a76||0xcc;return function(_0x200eee){if(_0x200eee){return _0x1d84a1[_0xbfda('0x1c')](_0x212a76);}return _0x1d84a1[_0xbfda('0x1d')](_0x212a76)[_0xbfda('0x1e')]();};}function respondWithResult(_0x29cadb,_0x12cc25){_0x12cc25=_0x12cc25||0xc8;return function(_0x4dea3a){if(_0x4dea3a){return _0x29cadb[_0xbfda('0x1d')](_0x12cc25)[_0xbfda('0x1f')](_0x4dea3a);}};}function respondWithFilteredResult(_0x10830f,_0x1db2c2){return function(_0x1c9977){if(_0x1c9977){var _0x1d9635=typeof _0x1db2c2[_0xbfda('0x20')]===_0xbfda('0x21')&&typeof _0x1db2c2[_0xbfda('0x22')]===_0xbfda('0x21');var _0x5c8003=_0x1c9977['count'];var _0x42d60a=_0x1d9635?0x0:_0x1db2c2['offset'];var _0x1d6cce=_0x1d9635?_0x1c9977['count']:_0x1db2c2['offset']+_0x1db2c2[_0xbfda('0x22')];var _0x3c34ff;if(_0x1d6cce>=_0x5c8003){_0x1d6cce=_0x5c8003;_0x3c34ff=0xc8;}else{_0x3c34ff=0xce;}_0x10830f['status'](_0x3c34ff);return _0x10830f[_0xbfda('0x23')](_0xbfda('0x24'),_0x42d60a+'-'+_0x1d6cce+'/'+_0x5c8003)[_0xbfda('0x1f')](_0x1c9977);}return null;};}function patchUpdates(_0x21705f){return function(_0x134ccf){try{jsonpatch[_0xbfda('0x25')](_0x134ccf,_0x21705f,!![]);}catch(_0x27daf8){return BPromise[_0xbfda('0x26')](_0x27daf8);}return _0x134ccf[_0xbfda('0x27')]();};}function saveUpdates(_0x33f8f9,_0x18162b){return function(_0x52413f){if(_0x52413f){return _0x52413f[_0xbfda('0x28')](_0x33f8f9)[_0xbfda('0x29')](function(_0x5538e0){return _0x5538e0;});}return null;};}function removeEntity(_0x22b52d,_0x562313){return function(_0x2aecf8){if(_0x2aecf8){return _0x2aecf8[_0xbfda('0x2a')]()['then'](function(){_0x22b52d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16758f,_0x47ab74){return function(_0x1d6552){if(!_0x1d6552){_0x16758f[_0xbfda('0x1c')](0x194);}return _0x1d6552;};}function handleError(_0x55ca03,_0x6f9518){_0x6f9518=_0x6f9518||0x1f4;return function(_0x2578b1){logger[_0xbfda('0x2b')](_0x2578b1['stack']);if(_0x2578b1[_0xbfda('0x2c')]){delete _0x2578b1[_0xbfda('0x2c')];}_0x55ca03['status'](_0x6f9518)[_0xbfda('0x2d')](_0x2578b1);};}exports[_0xbfda('0x2e')]=function(_0x5b6240,_0x188aac){var _0x453899={},_0x333dc6={},_0x18b672={'count':0x0,'rows':[]};var _0x5d659a=_['map'](db[_0xbfda('0x2f')][_0xbfda('0x30')],function(_0x378b2b){return{'name':_0x378b2b[_0xbfda('0x31')],'type':_0x378b2b[_0xbfda('0x32')]['key']};});_0x333dc6['model']=_[_0xbfda('0x33')](_0x5d659a,'name');_0x333dc6[_0xbfda('0x34')]=_[_0xbfda('0x35')](_0x5b6240[_0xbfda('0x34')]);_0x333dc6['filters']=_[_0xbfda('0x36')](_0x333dc6[_0xbfda('0x37')],_0x333dc6[_0xbfda('0x34')]);_0x453899[_0xbfda('0x38')]=_['intersection'](_0x333dc6[_0xbfda('0x37')],qs[_0xbfda('0x39')](_0x5b6240[_0xbfda('0x34')][_0xbfda('0x39')]));_0x453899[_0xbfda('0x38')]=_0x453899[_0xbfda('0x38')][_0xbfda('0x3a')]?_0x453899[_0xbfda('0x38')]:_0x333dc6[_0xbfda('0x37')];if(!_0x5b6240[_0xbfda('0x34')][_0xbfda('0x3b')](_0xbfda('0x3c'))){_0x453899[_0xbfda('0x22')]=qs[_0xbfda('0x22')](_0x5b6240['query'][_0xbfda('0x22')]);_0x453899['offset']=qs[_0xbfda('0x20')](_0x5b6240[_0xbfda('0x34')][_0xbfda('0x20')]);}_0x453899['order']=qs[_0xbfda('0x3d')](_0x5b6240['query'][_0xbfda('0x3d')]);_0x453899[_0xbfda('0x3e')]=qs['filters'](_[_0xbfda('0x3f')](_0x5b6240[_0xbfda('0x34')],_0x333dc6[_0xbfda('0x40')]),_0x5d659a);if(_0x5b6240[_0xbfda('0x34')][_0xbfda('0x41')]){_0x453899[_0xbfda('0x3e')]=_[_0xbfda('0x42')](_0x453899[_0xbfda('0x3e')],{'$or':_[_0xbfda('0x33')](_0x5d659a,function(_0x9298a1){if(_0x9298a1['type']!==_0xbfda('0x43')){var _0x4f6cd2={};_0x4f6cd2[_0x9298a1['name']]={'$like':'%'+_0x5b6240[_0xbfda('0x34')][_0xbfda('0x41')]+'%'};return _0x4f6cd2;}})});}_0x453899=_[_0xbfda('0x42')]({},_0x453899,_0x5b6240['options']);var _0x22dbbf={'where':_0x453899[_0xbfda('0x3e')]};return db[_0xbfda('0x2f')][_0xbfda('0x44')](_0x22dbbf)[_0xbfda('0x29')](function(_0x7e6917){_0x18b672[_0xbfda('0x44')]=_0x7e6917;if(_0x5b6240[_0xbfda('0x34')][_0xbfda('0x45')]){_0x453899[_0xbfda('0x46')]=[{'all':!![]}];}return db[_0xbfda('0x2f')][_0xbfda('0x47')](_0x453899);})['then'](function(_0x5a3dc2){_0x18b672[_0xbfda('0x48')]=_0x5a3dc2;return _0x18b672;})[_0xbfda('0x29')](respondWithFilteredResult(_0x188aac,_0x453899))['catch'](handleError(_0x188aac,null));};exports[_0xbfda('0x49')]=function(_0x4e70e2,_0x51da8f){var _0x488cd0={'raw':!![],'where':{'id':_0x4e70e2[_0xbfda('0x4a')]['id']}},_0x39e61e={};_0x39e61e['model']=_['keys'](db[_0xbfda('0x2f')][_0xbfda('0x30')]);_0x39e61e[_0xbfda('0x34')]=_[_0xbfda('0x35')](_0x4e70e2[_0xbfda('0x34')]);_0x39e61e[_0xbfda('0x40')]=_[_0xbfda('0x36')](_0x39e61e[_0xbfda('0x37')],_0x39e61e[_0xbfda('0x34')]);_0x488cd0[_0xbfda('0x38')]=_['intersection'](_0x39e61e[_0xbfda('0x37')],qs[_0xbfda('0x39')](_0x4e70e2[_0xbfda('0x34')][_0xbfda('0x39')]));_0x488cd0[_0xbfda('0x38')]=_0x488cd0[_0xbfda('0x38')]['length']?_0x488cd0[_0xbfda('0x38')]:_0x39e61e['model'];if(_0x4e70e2[_0xbfda('0x34')][_0xbfda('0x45')]){_0x488cd0['include']=[{'all':!![]}];}_0x488cd0=_['merge']({},_0x488cd0,_0x4e70e2['options']);return db[_0xbfda('0x2f')]['find'](_0x488cd0)['then'](handleEntityNotFound(_0x51da8f,null))[_0xbfda('0x29')](respondWithResult(_0x51da8f,null))[_0xbfda('0x4b')](handleError(_0x51da8f,null));};exports['create']=function(_0x252bc3,_0x17bebb){return db[_0xbfda('0x2f')][_0xbfda('0x4c')](_0x252bc3[_0xbfda('0x4d')],{})[_0xbfda('0x29')](respondWithResult(_0x17bebb,0xc9))['catch'](handleError(_0x17bebb,null));};exports[_0xbfda('0x28')]=function(_0x4f2755,_0x129afe){if(_0x4f2755['body']['id']){delete _0x4f2755[_0xbfda('0x4d')]['id'];}return db[_0xbfda('0x2f')][_0xbfda('0x4e')]({'where':{'id':_0x4f2755[_0xbfda('0x4a')]['id']}})['then'](handleEntityNotFound(_0x129afe,null))['then'](saveUpdates(_0x4f2755[_0xbfda('0x4d')],null))[_0xbfda('0x29')](respondWithResult(_0x129afe,null))['catch'](handleError(_0x129afe,null));};exports['destroy']=function(_0x1da47b,_0x57afeb){return db[_0xbfda('0x2f')][_0xbfda('0x4e')]({'where':{'id':_0x1da47b['params']['id']}})[_0xbfda('0x29')](handleEntityNotFound(_0x57afeb,null))[_0xbfda('0x29')](removeEntity(_0x57afeb,null))[_0xbfda('0x4b')](handleError(_0x57afeb,null));}; \ No newline at end of file +var _0x90c7=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','includeAll','include','catch','show','params','options'];(function(_0x45bee0,_0x42bf09){var _0x1fcfd5=function(_0x235b6a){while(--_0x235b6a){_0x45bee0['push'](_0x45bee0['shift']());}};_0x1fcfd5(++_0x42bf09);}(_0x90c7,0x17a));var _0x790c=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x90c7[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0x790c('0x0'));var rimraf=require(_0x790c('0x1'));var zipdir=require(_0x790c('0x2'));var jsonpatch=require(_0x790c('0x3'));var rp=require('request-promise');var moment=require(_0x790c('0x4'));var BPromise=require(_0x790c('0x5'));var Mustache=require(_0x790c('0x6'));var util=require(_0x790c('0x7'));var path=require(_0x790c('0x8'));var sox=require('sox');var csv=require(_0x790c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x790c('0xa'));var _=require('lodash');var squel=require(_0x790c('0xb'));var crypto=require(_0x790c('0xc'));var jsforce=require(_0x790c('0xd'));var deskjs=require(_0x790c('0xe'));var toCsv=require(_0x790c('0x9'));var querystring=require(_0x790c('0xf'));var Papa=require(_0x790c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x790c('0x11'));var hardwareService=require(_0x790c('0x12'));var logger=require('../../config/logger')(_0x790c('0x13'));var utils=require(_0x790c('0x14'));var config=require(_0x790c('0x15'));var licenseUtil=require(_0x790c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29ff56,_0x3e38bf){_0x3e38bf=_0x3e38bf||0xcc;return function(_0x239a49){if(_0x239a49){return _0x29ff56[_0x790c('0x17')](_0x3e38bf);}return _0x29ff56['status'](_0x3e38bf)[_0x790c('0x18')]();};}function respondWithResult(_0x390217,_0xc053be){_0xc053be=_0xc053be||0xc8;return function(_0x5d4883){if(_0x5d4883){return _0x390217[_0x790c('0x19')](_0xc053be)[_0x790c('0x1a')](_0x5d4883);}};}function respondWithFilteredResult(_0x273a93,_0x176b65){return function(_0x2f1d36){if(_0x2f1d36){var _0x3e1c12=typeof _0x176b65[_0x790c('0x1b')]===_0x790c('0x1c')&&typeof _0x176b65['limit']===_0x790c('0x1c');var _0x50b956=_0x2f1d36[_0x790c('0x1d')];var _0x33833e=_0x3e1c12?0x0:_0x176b65[_0x790c('0x1b')];var _0x330d94=_0x3e1c12?_0x2f1d36[_0x790c('0x1d')]:_0x176b65['offset']+_0x176b65[_0x790c('0x1e')];var _0x47341b;if(_0x330d94>=_0x50b956){_0x330d94=_0x50b956;_0x47341b=0xc8;}else{_0x47341b=0xce;}_0x273a93[_0x790c('0x19')](_0x47341b);return _0x273a93[_0x790c('0x1f')](_0x790c('0x20'),_0x33833e+'-'+_0x330d94+'/'+_0x50b956)[_0x790c('0x1a')](_0x2f1d36);}return null;};}function patchUpdates(_0x33d5a4){return function(_0xbe6b00){try{jsonpatch[_0x790c('0x21')](_0xbe6b00,_0x33d5a4,!![]);}catch(_0x4fb692){return BPromise[_0x790c('0x22')](_0x4fb692);}return _0xbe6b00[_0x790c('0x23')]();};}function saveUpdates(_0x178a41,_0x3e321e){return function(_0x1b42b2){if(_0x1b42b2){return _0x1b42b2[_0x790c('0x24')](_0x178a41)[_0x790c('0x25')](function(_0x4ec1e6){return _0x4ec1e6;});}return null;};}function removeEntity(_0x9950a1,_0x289714){return function(_0x15720c){if(_0x15720c){return _0x15720c[_0x790c('0x26')]()[_0x790c('0x25')](function(){_0x9950a1['status'](0xcc)[_0x790c('0x18')]();});}};}function handleEntityNotFound(_0x3e588e,_0x45c826){return function(_0x3c100a){if(!_0x3c100a){_0x3e588e[_0x790c('0x17')](0x194);}return _0x3c100a;};}function handleError(_0x1c9163,_0x31da18){_0x31da18=_0x31da18||0x1f4;return function(_0xf8832a){logger[_0x790c('0x27')](_0xf8832a[_0x790c('0x28')]);if(_0xf8832a[_0x790c('0x29')]){delete _0xf8832a[_0x790c('0x29')];}_0x1c9163[_0x790c('0x19')](_0x31da18)[_0x790c('0x2a')](_0xf8832a);};}exports[_0x790c('0x2b')]=function(_0x105542,_0x4510fd){var _0x5a7e22={},_0x2e6804={},_0x1473ba={'count':0x0,'rows':[]};var _0x5676ca=_[_0x790c('0x2c')](db[_0x790c('0x2d')][_0x790c('0x2e')],function(_0x422718){return{'name':_0x422718[_0x790c('0x2f')],'type':_0x422718['type'][_0x790c('0x30')]};});_0x2e6804[_0x790c('0x31')]=_[_0x790c('0x2c')](_0x5676ca,_0x790c('0x29'));_0x2e6804[_0x790c('0x32')]=_[_0x790c('0x33')](_0x105542[_0x790c('0x32')]);_0x2e6804[_0x790c('0x34')]=_['intersection'](_0x2e6804[_0x790c('0x31')],_0x2e6804[_0x790c('0x32')]);_0x5a7e22[_0x790c('0x35')]=_[_0x790c('0x36')](_0x2e6804[_0x790c('0x31')],qs[_0x790c('0x37')](_0x105542[_0x790c('0x32')]['fields']));_0x5a7e22[_0x790c('0x35')]=_0x5a7e22[_0x790c('0x35')][_0x790c('0x38')]?_0x5a7e22[_0x790c('0x35')]:_0x2e6804['model'];if(!_0x105542['query'][_0x790c('0x39')](_0x790c('0x3a'))){_0x5a7e22['limit']=qs[_0x790c('0x1e')](_0x105542['query']['limit']);_0x5a7e22[_0x790c('0x1b')]=qs[_0x790c('0x1b')](_0x105542[_0x790c('0x32')]['offset']);}_0x5a7e22[_0x790c('0x3b')]=qs[_0x790c('0x3c')](_0x105542[_0x790c('0x32')][_0x790c('0x3c')]);_0x5a7e22[_0x790c('0x3d')]=qs[_0x790c('0x34')](_[_0x790c('0x3e')](_0x105542[_0x790c('0x32')],_0x2e6804[_0x790c('0x34')]),_0x5676ca);if(_0x105542[_0x790c('0x32')][_0x790c('0x3f')]){_0x5a7e22[_0x790c('0x3d')]=_['merge'](_0x5a7e22['where'],{'$or':_['map'](_0x5676ca,function(_0x1bf0cc){if(_0x1bf0cc[_0x790c('0x40')]!=='VIRTUAL'){var _0x579cf9={};_0x579cf9[_0x1bf0cc[_0x790c('0x29')]]={'$like':'%'+_0x105542[_0x790c('0x32')][_0x790c('0x3f')]+'%'};return _0x579cf9;}})});}_0x5a7e22=_[_0x790c('0x41')]({},_0x5a7e22,_0x105542['options']);var _0x53f4b3={'where':_0x5a7e22['where']};return db[_0x790c('0x2d')][_0x790c('0x1d')](_0x53f4b3)[_0x790c('0x25')](function(_0x38f2db){_0x1473ba[_0x790c('0x1d')]=_0x38f2db;if(_0x105542[_0x790c('0x32')][_0x790c('0x42')]){_0x5a7e22[_0x790c('0x43')]=[{'all':!![]}];}return db[_0x790c('0x2d')]['findAll'](_0x5a7e22);})[_0x790c('0x25')](function(_0x3274b2){_0x1473ba['rows']=_0x3274b2;return _0x1473ba;})[_0x790c('0x25')](respondWithFilteredResult(_0x4510fd,_0x5a7e22))[_0x790c('0x44')](handleError(_0x4510fd,null));};exports[_0x790c('0x45')]=function(_0x48dfef,_0x17a4dc){var _0x181c4b={'raw':!![],'where':{'id':_0x48dfef[_0x790c('0x46')]['id']}},_0x5eef01={};_0x5eef01[_0x790c('0x31')]=_['keys'](db[_0x790c('0x2d')][_0x790c('0x2e')]);_0x5eef01[_0x790c('0x32')]=_['keys'](_0x48dfef[_0x790c('0x32')]);_0x5eef01[_0x790c('0x34')]=_[_0x790c('0x36')](_0x5eef01[_0x790c('0x31')],_0x5eef01[_0x790c('0x32')]);_0x181c4b[_0x790c('0x35')]=_[_0x790c('0x36')](_0x5eef01['model'],qs['fields'](_0x48dfef['query'][_0x790c('0x37')]));_0x181c4b[_0x790c('0x35')]=_0x181c4b['attributes']['length']?_0x181c4b[_0x790c('0x35')]:_0x5eef01[_0x790c('0x31')];if(_0x48dfef[_0x790c('0x32')][_0x790c('0x42')]){_0x181c4b['include']=[{'all':!![]}];}_0x181c4b=_['merge']({},_0x181c4b,_0x48dfef[_0x790c('0x47')]);return db[_0x790c('0x2d')][_0x790c('0x48')](_0x181c4b)[_0x790c('0x25')](handleEntityNotFound(_0x17a4dc,null))['then'](respondWithResult(_0x17a4dc,null))[_0x790c('0x44')](handleError(_0x17a4dc,null));};exports[_0x790c('0x49')]=function(_0x3fcc55,_0x506f55){return db[_0x790c('0x2d')][_0x790c('0x49')](_0x3fcc55['body'],{})[_0x790c('0x25')](respondWithResult(_0x506f55,0xc9))['catch'](handleError(_0x506f55,null));};exports[_0x790c('0x24')]=function(_0x3c831a,_0x1bff69){if(_0x3c831a[_0x790c('0x4a')]['id']){delete _0x3c831a[_0x790c('0x4a')]['id'];}return db[_0x790c('0x2d')][_0x790c('0x48')]({'where':{'id':_0x3c831a[_0x790c('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bff69,null))['then'](saveUpdates(_0x3c831a[_0x790c('0x4a')],null))[_0x790c('0x25')](respondWithResult(_0x1bff69,null))[_0x790c('0x44')](handleError(_0x1bff69,null));};exports[_0x790c('0x26')]=function(_0x2c3ccd,_0x4d3956){return db['OpenchannelApplication']['find']({'where':{'id':_0x2c3ccd['params']['id']}})[_0x790c('0x25')](handleEntityNotFound(_0x4d3956,null))[_0x790c('0x25')](removeEntity(_0x4d3956,null))[_0x790c('0x44')](handleError(_0x4d3956,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 6cf95f0..16c9936 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 _0x636c=['bluebird','request-promise','path','./openchannelApplication.attributes','exports','define','utf8mb4','lodash','util','moment'];(function(_0x5a503c,_0x40f51a){var _0x108f15=function(_0x4d0c47){while(--_0x4d0c47){_0x5a503c['push'](_0x5a503c['shift']());}};_0x108f15(++_0x40f51a);}(_0x636c,0x15b));var _0xc636=function(_0x14deb8,_0x2e7e5e){_0x14deb8=_0x14deb8-0x0;var _0x1f5d27=_0x636c[_0x14deb8];return _0x1f5d27;};'use strict';var _=require(_0xc636('0x0'));var util=require(_0xc636('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc636('0x2'));var BPromise=require(_0xc636('0x3'));var rp=require(_0xc636('0x4'));var fs=require('fs');var path=require(_0xc636('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc636('0x6'));module[_0xc636('0x7')]=function(_0x11e2dd,_0x19491e){return _0x11e2dd[_0xc636('0x8')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc636('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbe25=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x485381,_0x4713fd){var _0x1f2550=function(_0x941e64){while(--_0x941e64){_0x485381['push'](_0x485381['shift']());}};_0x1f2550(++_0x4713fd);}(_0xbe25,0xf2));var _0x5be2=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xbe25[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x5be2('0x0'));var util=require(_0x5be2('0x1'));var logger=require(_0x5be2('0x2'))(_0x5be2('0x3'));var moment=require(_0x5be2('0x4'));var BPromise=require(_0x5be2('0x5'));var rp=require(_0x5be2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5be2('0x7'));var attributes=require(_0x5be2('0x8'));module[_0x5be2('0x9')]=function(_0x12a200,_0x518bcb){return _0x12a200[_0x5be2('0xa')](_0x5be2('0xb'),attributes,{'tableName':_0x5be2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5be2('0xd'),'collate':_0x5be2('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f3f4474..d940e08 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 _0x54ac=['../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring'];(function(_0x560d6f,_0x5d91c4){var _0x46f76a=function(_0x45e8ff){while(--_0x45e8ff){_0x560d6f['push'](_0x560d6f['shift']());}};_0x46f76a(++_0x5d91c4);}(_0x54ac,0xeb));var _0xc54a=function(_0x55a802,_0x10ab3a){_0x55a802=_0x55a802-0x0;var _0x1a0461=_0x54ac[_0x55a802];return _0x1a0461;};'use strict';var _=require(_0xc54a('0x0'));var util=require(_0xc54a('0x1'));var moment=require(_0xc54a('0x2'));var BPromise=require(_0xc54a('0x3'));var rs=require(_0xc54a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc54a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc54a('0x6'));var jayson=require(_0xc54a('0x7'));var client=jayson[_0xc54a('0x8')][_0xc54a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fe878,_0x37d6e5,_0x7eb9e){return new BPromise(function(_0xdd68fc,_0x4a07cb){return client[_0xc54a('0xa')](_0x3fe878,_0x7eb9e)['then'](function(_0x2ebd54){logger[_0xc54a('0xb')](_0xc54a('0xc'),_0x37d6e5,_0xc54a('0xd'));logger[_0xc54a('0xe')](_0xc54a('0xf'),_0x37d6e5,_0xc54a('0xd'),JSON[_0xc54a('0x10')](_0x2ebd54));if(_0x2ebd54[_0xc54a('0x11')]){if(_0x2ebd54[_0xc54a('0x11')]['code']===0x1f4){logger[_0xc54a('0x11')](_0xc54a('0xc'),_0x37d6e5,_0x2ebd54[_0xc54a('0x11')][_0xc54a('0x12')]);return _0x4a07cb(_0x2ebd54[_0xc54a('0x11')][_0xc54a('0x12')]);}logger[_0xc54a('0x11')](_0xc54a('0xc'),_0x37d6e5,_0x2ebd54[_0xc54a('0x11')][_0xc54a('0x12')]);return _0xdd68fc(_0x2ebd54[_0xc54a('0x11')][_0xc54a('0x12')]);}else{logger[_0xc54a('0xb')](_0xc54a('0xc'),_0x37d6e5,_0xc54a('0xd'));_0xdd68fc(_0x2ebd54[_0xc54a('0x13')][_0xc54a('0x12')]);}})[_0xc54a('0x14')](function(_0x20f7f7){logger[_0xc54a('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x37d6e5,_0x20f7f7);_0x4a07cb(_0x20f7f7);});});}exports[_0xc54a('0x15')]=function(_0x54d0a2){var _0x3f2348=this;return new Promise(function(_0x43db9f,_0x1d1b48){return db[_0xc54a('0x16')][_0xc54a('0x17')](_0x54d0a2['body'],{'raw':_0x54d0a2[_0xc54a('0x18')]?_0x54d0a2['options'][_0xc54a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54d0a2[_0xc54a('0x18')]?_0x54d0a2['options'][_0xc54a('0x1a')]||null:null,'attributes':_0x54d0a2['options']?_0x54d0a2[_0xc54a('0x18')][_0xc54a('0x1b')]||null:null,'limit':_0x54d0a2[_0xc54a('0x18')]?_0x54d0a2[_0xc54a('0x18')][_0xc54a('0x1c')]||null:null})[_0xc54a('0x1d')](function(_0xae1ec3){logger[_0xc54a('0xb')](_0xc54a('0x15'),_0x54d0a2);logger['debug'](_0xc54a('0x15'),_0x54d0a2,JSON['stringify'](_0xae1ec3));_0x43db9f(_0xae1ec3);})['catch'](function(_0x7b43f7){logger[_0xc54a('0x11')]('UpdateOpenchannelApplication',_0x7b43f7[_0xc54a('0x12')],_0x54d0a2);_0x1d1b48(_0x3f2348['error'](0x1f4,_0x7b43f7['message']));});});}; \ No newline at end of file +var _0x9bcd=['limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes'];(function(_0x599c20,_0x1fc082){var _0x536094=function(_0x2755d1){while(--_0x2755d1){_0x599c20['push'](_0x599c20['shift']());}};_0x536094(++_0x1fc082);}(_0x9bcd,0x8a));var _0xd9bc=function(_0x26336e,_0xfe7d46){_0x26336e=_0x26336e-0x0;var _0x5f1b5e=_0x9bcd[_0x26336e];return _0x5f1b5e;};'use strict';var _=require(_0xd9bc('0x0'));var util=require(_0xd9bc('0x1'));var moment=require(_0xd9bc('0x2'));var BPromise=require(_0xd9bc('0x3'));var rs=require(_0xd9bc('0x4'));var fs=require('fs');var Redis=require(_0xd9bc('0x5'));var db=require(_0xd9bc('0x6'))['db'];var utils=require(_0xd9bc('0x7'));var logger=require(_0xd9bc('0x8'))(_0xd9bc('0x9'));var config=require(_0xd9bc('0xa'));var jayson=require(_0xd9bc('0xb'));var client=jayson[_0xd9bc('0xc')][_0xd9bc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x35b12f,_0x2d5afb,_0x126562){return new BPromise(function(_0x476cb7,_0x328e06){return client[_0xd9bc('0xe')](_0x35b12f,_0x126562)['then'](function(_0x413c94){logger['info'](_0xd9bc('0xf'),_0x2d5afb,'request\x20sent');logger['debug'](_0xd9bc('0x10'),_0x2d5afb,_0xd9bc('0x11'),JSON[_0xd9bc('0x12')](_0x413c94));if(_0x413c94[_0xd9bc('0x13')]){if(_0x413c94[_0xd9bc('0x13')][_0xd9bc('0x14')]===0x1f4){logger[_0xd9bc('0x13')](_0xd9bc('0xf'),_0x2d5afb,_0x413c94[_0xd9bc('0x13')][_0xd9bc('0x15')]);return _0x328e06(_0x413c94[_0xd9bc('0x13')][_0xd9bc('0x15')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x2d5afb,_0x413c94[_0xd9bc('0x13')]['message']);return _0x476cb7(_0x413c94[_0xd9bc('0x13')]['message']);}else{logger[_0xd9bc('0x16')](_0xd9bc('0xf'),_0x2d5afb,_0xd9bc('0x11'));_0x476cb7(_0x413c94[_0xd9bc('0x17')]['message']);}})[_0xd9bc('0x18')](function(_0x4e7cc5){logger[_0xd9bc('0x13')](_0xd9bc('0xf'),_0x2d5afb,_0x4e7cc5);_0x328e06(_0x4e7cc5);});});}exports[_0xd9bc('0x19')]=function(_0x341b52){var _0x3e0892=this;return new Promise(function(_0x1b80fe,_0x43e4cf){return db['OpenchannelApplication'][_0xd9bc('0x1a')](_0x341b52[_0xd9bc('0x1b')],{'raw':_0x341b52[_0xd9bc('0x1c')]?_0x341b52[_0xd9bc('0x1c')][_0xd9bc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x341b52[_0xd9bc('0x1c')]?_0x341b52[_0xd9bc('0x1c')][_0xd9bc('0x1e')]||null:null,'attributes':_0x341b52['options']?_0x341b52['options'][_0xd9bc('0x1f')]||null:null,'limit':_0x341b52[_0xd9bc('0x1c')]?_0x341b52[_0xd9bc('0x1c')][_0xd9bc('0x20')]||null:null})[_0xd9bc('0x21')](function(_0x9d4be5){logger[_0xd9bc('0x16')](_0xd9bc('0x19'),_0x341b52);logger['debug'](_0xd9bc('0x19'),_0x341b52,JSON['stringify'](_0x9d4be5));_0x1b80fe(_0x9d4be5);})[_0xd9bc('0x18')](function(_0x224ebb){logger[_0xd9bc('0x13')](_0xd9bc('0x19'),_0x224ebb[_0xd9bc('0x15')],_0x341b52);_0x43e4cf(_0x3e0892['error'](0x1f4,_0x224ebb[_0xd9bc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 6125d1f..9e070e0 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 _0x68e3=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update','update','tracked','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','show'];(function(_0x488f98,_0x1391e4){var _0x3aeb3e=function(_0x1a0484){while(--_0x1a0484){_0x488f98['push'](_0x488f98['shift']());}};_0x3aeb3e(++_0x1391e4);}(_0x68e3,0xcd));var _0x368e=function(_0x2cbbf1,_0x7c1604){_0x2cbbf1=_0x2cbbf1-0x0;var _0x2e812a=_0x68e3[_0x2cbbf1];return _0x2e812a;};'use strict';var multer=require(_0x368e('0x0'));var util=require(_0x368e('0x1'));var path=require(_0x368e('0x2'));var timeout=require('connect-timeout');var express=require(_0x368e('0x3'));var router=express['Router']();var fs_extra=require(_0x368e('0x4'));var auth=require(_0x368e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x368e('0x6'));var controller=require(_0x368e('0x7'));router[_0x368e('0x8')]('/',auth[_0x368e('0x9')](),controller[_0x368e('0xa')]);router[_0x368e('0x8')]('/describe',auth[_0x368e('0x9')](),controller['describe']);router[_0x368e('0x8')]('/:id',auth[_0x368e('0x9')](),controller[_0x368e('0xb')]);router[_0x368e('0x8')](_0x368e('0xc'),auth[_0x368e('0x9')](),controller[_0x368e('0xd')]);router['get'](_0x368e('0xe'),auth[_0x368e('0x9')](),controller[_0x368e('0xf')]);router[_0x368e('0x10')]('/',auth[_0x368e('0x9')](),controller[_0x368e('0x11')]);router[_0x368e('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0x368e('0x12')]);router['post']('/:id/tags',auth[_0x368e('0x9')](),interaction['tracked'](_0x368e('0x13'),_0x368e('0x14')),controller['addTags']);router[_0x368e('0x15')](_0x368e('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0x368e('0x13'),_0x368e('0x17')),controller[_0x368e('0x18')]);router['delete']('/:id',auth[_0x368e('0x9')](),interaction[_0x368e('0x19')](_0x368e('0x13'),_0x368e('0x1a')),controller[_0x368e('0x1b')]);router[_0x368e('0x1c')]('/:id/tags',auth[_0x368e('0x9')](),controller[_0x368e('0x1d')]);module[_0x368e('0x1e')]=router; \ No newline at end of file +var _0x5be3=['describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe'];(function(_0x36691e,_0x167ad3){var _0x1b9566=function(_0x2b482e){while(--_0x2b482e){_0x36691e['push'](_0x36691e['shift']());}};_0x1b9566(++_0x167ad3);}(_0x5be3,0x1a7));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x35be('0x0'));var util=require(_0x35be('0x1'));var path=require('path');var timeout=require(_0x35be('0x2'));var express=require(_0x35be('0x3'));var router=express['Router']();var fs_extra=require(_0x35be('0x4'));var auth=require(_0x35be('0x5'));var interaction=require(_0x35be('0x6'));var config=require(_0x35be('0x7'));var controller=require(_0x35be('0x8'));router[_0x35be('0x9')]('/',auth[_0x35be('0xa')](),controller['index']);router['get'](_0x35be('0xb'),auth[_0x35be('0xa')](),controller[_0x35be('0xc')]);router['get'](_0x35be('0xd'),auth[_0x35be('0xa')](),controller['show']);router[_0x35be('0x9')](_0x35be('0xe'),auth[_0x35be('0xa')](),controller[_0x35be('0xf')]);router[_0x35be('0x9')]('/:id/download',auth[_0x35be('0xa')](),controller['download']);router[_0x35be('0x10')]('/',auth[_0x35be('0xa')](),controller[_0x35be('0x11')]);router[_0x35be('0x10')](_0x35be('0xe'),auth[_0x35be('0xa')](),controller[_0x35be('0x12')]);router[_0x35be('0x10')](_0x35be('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x35be('0x14'),_0x35be('0x15')),controller[_0x35be('0x16')]);router[_0x35be('0x17')](_0x35be('0xd'),auth[_0x35be('0xa')](),interaction[_0x35be('0x18')](_0x35be('0x14'),_0x35be('0x19')),controller[_0x35be('0x1a')]);router[_0x35be('0x1b')](_0x35be('0xd'),auth[_0x35be('0xa')](),interaction['tracked'](_0x35be('0x14'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x35be('0x1b')](_0x35be('0x13'),auth['isAuthenticated'](),controller[_0x35be('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ab8f1d4..baa1826 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 _0x9be2=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x9be2,0x85));var _0x29be=function(_0x319dd2,_0x32c5b1){_0x319dd2=_0x319dd2-0x0;var _0x2c9d2b=_0x9be2[_0x319dd2];return _0x2c9d2b;};'use strict';var Sequelize=require(_0x29be('0x0'));module[_0x29be('0x1')]={'closed':{'type':Sequelize[_0x29be('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x29be('0x3')]},'secondDisposition':{'type':Sequelize[_0x29be('0x3')]},'thirdDisposition':{'type':Sequelize[_0x29be('0x3')]},'note':{'type':Sequelize[_0x29be('0x3')]},'read1stAt':{'type':Sequelize[_0x29be('0x4')]},'threadId':{'type':Sequelize[_0x29be('0x3')]},'externalUrl':{'type':Sequelize[_0x29be('0x3')]},'lastMsgAt':{'type':Sequelize[_0x29be('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x29be('0x5')]('in',_0x29be('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x29be('0x5')]('in',_0x29be('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x29be('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xed3c=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x26d179,_0x5a617b){var _0x57ed81=function(_0x32c3a5){while(--_0x32c3a5){_0x26d179['push'](_0x26d179['shift']());}};_0x57ed81(++_0x5a617b);}(_0xed3c,0x1a6));var _0xced3=function(_0x1fe809,_0x433222){_0x1fe809=_0x1fe809-0x0;var _0x59c58c=_0xed3c[_0x1fe809];return _0x59c58c;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'closed':{'type':Sequelize[_0xced3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xced3('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xced3('0x4')]},'thirdDisposition':{'type':Sequelize[_0xced3('0x4')]},'note':{'type':Sequelize[_0xced3('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xced3('0x4')]},'lastMsgAt':{'type':Sequelize[_0xced3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xced3('0x5')]('in',_0xced3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xced3('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index c92b496..a022f23 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 _0x296b=['undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','user','show','from','params','model','keys','OpenchannelInteraction','filters','intersection','fields','attributes','length','include','merge','catch','create','body','find','describe','addMessage','ids','findOne','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','addTags','setTags','omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','Openchannel','toString','closed','closedAt','disposition','threadId','Private','existsSync','createReadStream','createWriteStream','out','lastName','basename','secret','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit'];(function(_0x442214,_0x3a869f){var _0x2bddf9=function(_0x34b9c7){while(--_0x34b9c7){_0x442214['push'](_0x442214['shift']());}};_0x2bddf9(++_0x3a869f);}(_0x296b,0x6e));var _0xb296=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x296b[_0x3cb3ca];return _0x214366;};'use strict';var rimraf=require(_0xb296('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb296('0x1'));var util=require(_0xb296('0x2'));var path=require(_0xb296('0x3'));var ejs=require(_0xb296('0x4'));var fs=require('fs');var _=require(_0xb296('0x5'));var Redis=require(_0xb296('0x6'));var interaction=require(_0xb296('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xb296('0x8'));var logger=require(_0xb296('0x9'))(_0xb296('0xa'));var config=require(_0xb296('0xb'));var db=require('../../mysqldb')['db'];config[_0xb296('0xc')]=_[_0xb296('0xd')](config[_0xb296('0xc')],{'host':_0xb296('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb296('0xc')]));require(_0xb296('0xf'))[_0xb296('0x10')](socket);function respondWithStatusCode(_0x4d6fe1,_0x12de0c){_0x12de0c=_0x12de0c||0xcc;return function(_0x26e6da){if(_0x26e6da){return _0x4d6fe1[_0xb296('0x11')](_0x12de0c);}return _0x4d6fe1[_0xb296('0x12')](_0x12de0c)[_0xb296('0x13')]();};}function respondWithResult(_0x3e32f6,_0x21fa30){_0x21fa30=_0x21fa30||0xc8;return function(_0x369f8a){if(_0x369f8a){return _0x3e32f6[_0xb296('0x12')](_0x21fa30)[_0xb296('0x14')](_0x369f8a);}};}function respondWithFilteredResult(_0x2de36e,_0x3aed0b){return function(_0x683dff){if(_0x683dff){var _0x413fdb=typeof _0x3aed0b[_0xb296('0x15')]==='undefined'&&typeof _0x3aed0b[_0xb296('0x16')]===_0xb296('0x17');var _0x159cee=_0x683dff[_0xb296('0x18')];var _0x4db9ef=_0x413fdb?0x0:_0x3aed0b[_0xb296('0x15')];var _0x849f3f=_0x413fdb?_0x683dff[_0xb296('0x18')]:_0x3aed0b[_0xb296('0x15')]+_0x3aed0b[_0xb296('0x16')];var _0x50b43f;if(_0x849f3f>=_0x159cee){_0x849f3f=_0x159cee;_0x50b43f=0xc8;}else{_0x50b43f=0xce;}_0x2de36e[_0xb296('0x12')](_0x50b43f);return _0x2de36e[_0xb296('0x19')](_0xb296('0x1a'),_0x4db9ef+'-'+_0x849f3f+'/'+_0x159cee)[_0xb296('0x14')](_0x683dff);}return null;};}function saveUpdates(_0x3f3bf3){return function(_0x32b36d){if(_0x32b36d){return _0x32b36d[_0xb296('0x1b')](_0x3f3bf3)[_0xb296('0x1c')](function(_0x165175){return _0x165175;});}return null;};}function removeEntity(_0x4b5c37){return function(_0x53834a){if(_0x53834a){return _0x53834a[_0xb296('0x1d')]()['then'](function(){_0x4b5c37[_0xb296('0x12')](0xcc)[_0xb296('0x13')]();});}};}function handleEntityNotFound(_0xded9b0){return function(_0x24fd51){if(!_0x24fd51){_0xded9b0[_0xb296('0x11')](0x194);}return _0x24fd51;};}function handleError(_0x532dc9,_0x323063){_0x323063=_0x323063||0x1f4;return function(_0xa2f22c){logger[_0xb296('0x1e')](_0xa2f22c[_0xb296('0x1f')]);if(_0xa2f22c['name']){delete _0xa2f22c[_0xb296('0x20')];}_0x532dc9[_0xb296('0x12')](_0x323063)[_0xb296('0x21')](_0xa2f22c);};}exports[_0xb296('0x22')]=function(_0x31f234,_0x1f0710){var _0x595761={};var _0x3040c2=_[_0xb296('0x23')](db['OpenchannelInteraction'][_0xb296('0x24')],function(_0x9bb973){return{'name':_0x9bb973[_0xb296('0x25')],'type':_0x9bb973[_0xb296('0x26')]['key']};});_0x595761=qs[_0xb296('0x27')](_0x3040c2,_0x31f234);return interaction[_0xb296('0x28')](_0xb296('0x29'),_0x31f234[_0xb296('0x2a')],_0x31f234[_0xb296('0x2b')],_0x595761,_0x3040c2)[_0xb296('0x1c')](respondWithFilteredResult(_0x1f0710,_0x595761))['catch'](handleError(_0x1f0710,null));};exports[_0xb296('0x2c')]=function(_0x50e22f,_0x2f7cf5){var _0x2b8abe={};if(_0x50e22f[_0xb296('0x2a')][_0xb296('0x26')]&&_0x50e22f[_0xb296('0x2a')][_0xb296('0x26')]===_0xb296('0x2d')){_0x2b8abe[_0xb296('0x2d')]=_0x50e22f[_0xb296('0x2e')]['id'];}else{_0x2b8abe['id']=_0x50e22f['params']['id'];}var _0x532569={'raw':![],'where':_0x2b8abe},_0x1df4ba={};_0x1df4ba[_0xb296('0x2f')]=_[_0xb296('0x30')](db[_0xb296('0x31')][_0xb296('0x24')]);_0x1df4ba[_0xb296('0x2a')]=_['keys'](_0x50e22f[_0xb296('0x2a')]);_0x1df4ba[_0xb296('0x32')]=_['intersection'](_0x1df4ba['model'],_0x1df4ba[_0xb296('0x2a')]);_0x532569['attributes']=_[_0xb296('0x33')](_0x1df4ba[_0xb296('0x2f')],qs[_0xb296('0x34')](_0x50e22f[_0xb296('0x2a')][_0xb296('0x34')]));_0x532569['attributes']=_0x532569[_0xb296('0x35')][_0xb296('0x36')]?_0x532569[_0xb296('0x35')]:_0x1df4ba[_0xb296('0x2f')];if(_0x50e22f[_0xb296('0x2a')]['includeAll']){_0x532569[_0xb296('0x37')]=[{'all':!![]}];}_0x532569=_[_0xb296('0x38')]({},_0x532569,_0x50e22f['options']);return db[_0xb296('0x31')]['find'](_0x532569)[_0xb296('0x1c')](handleEntityNotFound(_0x2f7cf5,null))[_0xb296('0x1c')](respondWithResult(_0x2f7cf5,null))[_0xb296('0x39')](handleError(_0x2f7cf5,null));};exports[_0xb296('0x3a')]=function(_0x59dbe4,_0x1ed6dc){return db[_0xb296('0x31')][_0xb296('0x3a')](_0x59dbe4[_0xb296('0x3b')],{})[_0xb296('0x1c')](respondWithResult(_0x1ed6dc,0xc9))['catch'](handleError(_0x1ed6dc,null));};exports[_0xb296('0x1b')]=function(_0x4a93bf,_0x5d57db){if(_0x4a93bf[_0xb296('0x3b')]['id']){delete _0x4a93bf[_0xb296('0x3b')]['id'];}return db[_0xb296('0x31')]['find']({'where':{'id':_0x4a93bf[_0xb296('0x2e')]['id']}})[_0xb296('0x1c')](handleEntityNotFound(_0x5d57db,null))[_0xb296('0x1c')](saveUpdates(_0x4a93bf['body'],null))[_0xb296('0x1c')](respondWithResult(_0x5d57db,null))[_0xb296('0x39')](handleError(_0x5d57db,null));};exports[_0xb296('0x1d')]=function(_0x413f3c,_0xc54ac2){return db[_0xb296('0x31')][_0xb296('0x3c')]({'where':{'id':_0x413f3c[_0xb296('0x2e')]['id']}})['then'](handleEntityNotFound(_0xc54ac2,null))[_0xb296('0x1c')](removeEntity(_0xc54ac2,null))[_0xb296('0x39')](handleError(_0xc54ac2,null));};exports[_0xb296('0x3d')]=function(_0x4fc8bd,_0x5e934f){return db['OpenchannelInteraction'][_0xb296('0x3d')]()[_0xb296('0x1c')](respondWithResult(_0x5e934f,null))[_0xb296('0x39')](handleError(_0x5e934f,null));};exports[_0xb296('0x3e')]=function(_0x3390bb,_0x40e8af){return db['OpenchannelMessage']['find']({'where':{'id':_0x3390bb[_0xb296('0x2e')]['id']}})['then'](handleEntityNotFound(_0x40e8af,null))[_0xb296('0x1c')](function(_0x5c7779){if(_0x5c7779){return _0x5c7779[_0xb296('0x3e')](_0x3390bb['body'][_0xb296('0x3f')],_['omit'](_0x3390bb[_0xb296('0x3b')],[_0xb296('0x3f'),'id'])||{});}})[_0xb296('0x1c')](respondWithResult(_0x40e8af,null))['catch'](handleError(_0x40e8af,null));};exports['getMessages']=function(_0x37307c,_0x5555f3){var _0x25fcce={'raw':![],'where':{}};var _0x4af622={};var _0x388a89={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xb296('0x40')]({'where':{'id':_0x37307c[_0xb296('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5555f3,null))['then'](function(_0x4909d8){if(_0x4909d8){_0x4af622[_0xb296('0x2f')]=_[_0xb296('0x30')](db[_0xb296('0x41')][_0xb296('0x24')]);_0x4af622[_0xb296('0x2a')]=_[_0xb296('0x30')](_0x37307c['query']);_0x4af622['filters']=_[_0xb296('0x33')](_0x4af622[_0xb296('0x2f')],_0x4af622['query']);_0x25fcce[_0xb296('0x35')]=_[_0xb296('0x33')](_0x4af622[_0xb296('0x2f')],qs[_0xb296('0x34')](_0x37307c[_0xb296('0x2a')]['fields']));_0x25fcce[_0xb296('0x35')]=_0x25fcce['attributes']['length']?_0x25fcce[_0xb296('0x35')]:_0x4af622['model'];if(!_0x37307c['query'][_0xb296('0x42')](_0xb296('0x43'))){_0x25fcce['limit']=qs[_0xb296('0x16')](_0x37307c[_0xb296('0x2a')][_0xb296('0x16')]);_0x25fcce[_0xb296('0x15')]=qs[_0xb296('0x15')](_0x37307c['query']['offset']);}_0x25fcce[_0xb296('0x44')]=qs[_0xb296('0x45')](_0x37307c[_0xb296('0x2a')]['sort']);_0x25fcce[_0xb296('0x46')]=qs[_0xb296('0x32')](_[_0xb296('0x47')](_0x37307c[_0xb296('0x2a')],_0x4af622[_0xb296('0x32')]));_0x25fcce[_0xb296('0x46')][_0xb296('0x48')]=_0x4909d8['id'];if(_0x37307c[_0xb296('0x2a')][_0xb296('0x49')]){_0x25fcce[_0xb296('0x46')]=_[_0xb296('0x38')](_0x25fcce[_0xb296('0x46')],{'$or':_[_0xb296('0x23')](_0x25fcce[_0xb296('0x35')],function(_0x4015db){var _0x91f85={};_0x91f85[_0x4015db]={'$like':'%'+_0x37307c['query']['filter']+'%'};return _0x91f85;})});}if(_0x37307c[_0xb296('0x2a')][_0xb296('0x4a')]){var _0x164aba=_0x37307c[_0xb296('0x2a')][_0xb296('0x4a')]['split'](',');var _0x9e0c52={};_0x9e0c52[_0x164aba[0x0]]={'$gte':moment(_0x164aba[0x1])[_0xb296('0x4b')](_0xb296('0x4c'))};_0x25fcce[_0xb296('0x46')]=_['merge'](_0x25fcce[_0xb296('0x46')],_0x9e0c52);}_0x25fcce=_[_0xb296('0x38')]({},_0x25fcce,_0x37307c[_0xb296('0x4d')]);return db['OpenchannelMessage'][_0xb296('0x18')]({'where':_0x25fcce['where']})['then'](function(_0x5a8375){_0x388a89[_0xb296('0x18')]=_0x5a8375;if(_0x37307c[_0xb296('0x2a')][_0xb296('0x4e')]){_0x25fcce[_0xb296('0x37')]=[{'all':!![]}];}return db[_0xb296('0x41')]['findAll'](_0x25fcce);})['then'](function(_0xef6f44){_0x388a89['rows']=_0xef6f44;return _0x388a89;});}})[_0xb296('0x1c')](respondWithFilteredResult(_0x5555f3,_0x25fcce))[_0xb296('0x39')](handleError(_0x5555f3,null));};exports[_0xb296('0x4f')]=function(_0x315cc7,_0x19a0d7){return db[_0xb296('0x31')]['find']({'where':{'id':_0x315cc7[_0xb296('0x2e')]['id']}})[_0xb296('0x1c')](handleEntityNotFound(_0x19a0d7,null))['then'](function(_0xa512b9){if(_0xa512b9){return _0xa512b9[_0xb296('0x50')](_0x315cc7[_0xb296('0x3b')][_0xb296('0x3f')],_[_0xb296('0x51')](_0x315cc7[_0xb296('0x3b')],[_0xb296('0x3f'),'id'])||{})[_0xb296('0x52')](function(){return db[_0xb296('0x53')]['findAll']({'attributes':['id',_0xb296('0x20'),_0xb296('0x54')],'where':{'id':_0x315cc7['body']['ids']}});})[_0xb296('0x1c')](function(_0xda7e05){socket[_0xb296('0x55')](_0xb296('0x56'),{'id':Number(_0x315cc7[_0xb296('0x2e')]['id']),'tags':_0xda7e05||[]});return{'id':Number(_0x315cc7[_0xb296('0x2e')]['id']),'tags':_0xda7e05||[]};});}})[_0xb296('0x1c')](respondWithResult(_0x19a0d7,null))[_0xb296('0x39')](handleError(_0x19a0d7,null));};exports[_0xb296('0x57')]=function(_0x1f9d45,_0x3ff7b1){return db[_0xb296('0x31')]['find']({'where':{'id':_0x1f9d45[_0xb296('0x2e')]['id']}})[_0xb296('0x1c')](handleEntityNotFound(_0x3ff7b1,null))[_0xb296('0x1c')](function(_0x3b57b6){if(_0x3b57b6){return _0x3b57b6['removeTags'](_0x1f9d45[_0xb296('0x2a')][_0xb296('0x3f')]);}})[_0xb296('0x1c')](respondWithStatusCode(_0x3ff7b1,null))[_0xb296('0x39')](handleError(_0x3ff7b1,null));};exports[_0xb296('0x58')]=function(_0x5cd55a,_0x16a859){var _0x40a3ef=moment()[_0xb296('0x59')]()['toString']();var _0x41ff1f=path[_0xb296('0x5a')](config[_0xb296('0x5b')],_0xb296('0x5c'),_0xb296('0x5d'),_0xb296('0x5e'));var _0x14592d=path[_0xb296('0x5a')](config[_0xb296('0x5b')],'server',_0xb296('0x5d'),_0xb296('0x5f'));var _0xe9694e=path[_0xb296('0x5a')](_0x41ff1f,_0x40a3ef);var _0xc38040=util[_0xb296('0x4b')](_0xb296('0x60'),_0x5cd55a[_0xb296('0x2e')]['id'],_0x40a3ef);var _0x48d2d6=path[_0xb296('0x5a')](_0x41ff1f,_0xc38040);var _0x46c4fb=[];_0x46c4fb[_0xb296('0x61')]({'model':db[_0xb296('0x62')],'as':_0xb296('0x62'),'attributes':['id','fullname'],'raw':!![]});_0x46c4fb[_0xb296('0x61')]({'model':db[_0xb296('0x63')],'as':_0xb296('0x64'),'attributes':['id',_0xb296('0x65'),'lastName'],'raw':!![]});if(_0x5cd55a[_0xb296('0x2a')][_0xb296('0x5f')]){_0x46c4fb[_0xb296('0x61')]({'model':db[_0xb296('0x66')],'as':_0xb296('0x66'),'raw':!![]});}var _0x57ae6f=[{'model':db[_0xb296('0x41')],'as':_0xb296('0x67'),'attributes':['id',_0xb296('0x3b'),_0xb296('0x68'),_0xb296('0x69'),'secret',_0xb296('0x6a')],'include':_0x46c4fb}];_0x57ae6f[_0xb296('0x61')]({'model':db[_0xb296('0x6b')],'as':_0xb296('0x6c'),'attributes':['id',_0xb296('0x20')]});_0x57ae6f['push']({'model':db['User'],'as':_0xb296('0x6d'),'attributes':['id',_0xb296('0x6e')]});return db[_0xb296('0x31')][_0xb296('0x3c')]({'where':{'id':_0x5cd55a[_0xb296('0x2e')]['id']},'include':_0x57ae6f})[_0xb296('0x1c')](handleEntityNotFound(_0x16a859,null))['then'](function(_0x25f7fd){if(_0x25f7fd){var _0x20b3c5=_0x25f7fd[_0xb296('0x6f')]({'plain':!![]});fs[_0xb296('0x70')](_0xe9694e);var _0x41290c={'channel':_0xb296('0x71'),'account':_0x20b3c5['Account'][_0xb296('0x20')],'agent':_0x20b3c5[_0xb296('0x6d')]?_0x20b3c5[_0xb296('0x6d')][_0xb296('0x6e')]:'N.A.','createdAt':moment(_0x20b3c5[_0xb296('0x68')])[_0xb296('0x4b')](_0xb296('0x4c'))[_0xb296('0x72')](),'closedAt':_0x20b3c5[_0xb296('0x73')]?moment(_0x20b3c5[_0xb296('0x74')])['format'](_0xb296('0x4c'))[_0xb296('0x72')]():'','disposition':_0x20b3c5[_0xb296('0x75')],'visibility':_0x20b3c5[_0xb296('0x76')]?'Public':_0xb296('0x77'),'messages':_(_0x20b3c5[_0xb296('0x67')])[_0xb296('0x49')]({'secret':![]})[_0xb296('0x23')](function(_0x128ea1){if(_0x128ea1[_0xb296('0x66')]){var _0x1fce00=path['join'](_0x14592d,_0x128ea1[_0xb296('0x66')]['basename']);if(fs[_0xb296('0x78')](_0x1fce00)){fs[_0xb296('0x79')](_0x1fce00)['pipe'](fs[_0xb296('0x7a')](path[_0xb296('0x5a')](_0xe9694e,_0x128ea1['Attachment']['basename'])));}}return{'date':moment(_0x128ea1[_0xb296('0x68')])[_0xb296('0x4b')](_0xb296('0x4c'))[_0xb296('0x72')](),'sender':_0x128ea1[_0xb296('0x69')]===_0xb296('0x7b')?_0x128ea1[_0xb296('0x62')]?_0x128ea1[_0xb296('0x62')][_0xb296('0x6e')]:'System':_0x128ea1[_0xb296('0x64')]['firstName']+(_0x128ea1[_0xb296('0x64')][_0xb296('0x7c')]?'\x20'+_0x128ea1[_0xb296('0x64')]['lastName']:''),'body':_0x128ea1[_0xb296('0x66')]?_0x128ea1['Attachment'][_0xb296('0x7d')]:_0x128ea1['body'],'direction':_0x128ea1[_0xb296('0x69')]===_0xb296('0x7b')?'A':'C','secret':_0x128ea1[_0xb296('0x7e')],'read':_0x128ea1[_0xb296('0x6a')],'attachment':_0x128ea1[_0xb296('0x66')]};})['value']()};return ejs['renderFile'](path['join'](config[_0xb296('0x5b')],_0xb296('0x5c'),_0xb296('0x7f'),_0xb296('0x80')),{'interaction':_0x41290c})[_0xb296('0x1c')](function(_0x431480){var _0xdba2f1=path[_0xb296('0x5a')](_0xe9694e,_0xb296('0x81')+_0x20b3c5['id']+'-'+_0x40a3ef+_0xb296('0x82'));var _0x3bc0b3={'path':_0xdba2f1,'channel':_0xb296('0x71'),'interactionId':_0x20b3c5['id']};return pdf[_0xb296('0x83')](_0x431480,_0x3bc0b3);})[_0xb296('0x1c')](function(){return new Promise(function(_0x2751c3,_0x47a089){zipdir(_0xe9694e,{'saveTo':_0x48d2d6},function(_0x3c58d3,_0x10eaad){if(_0x3c58d3)return _0x47a089(_0x3c58d3);return _0x2751c3(_0x10eaad);});})[_0xb296('0x1c')](function(){return new Promise(function(_0x2283a5,_0x51490b){rimraf(_0xe9694e,function(_0x181155){if(_0x181155)_0x51490b(_0x181155);return _0x2283a5();});});})[_0xb296('0x1c')](function(){return _0x16a859[_0xb296('0x58')](_0x48d2d6,_0xc38040,function(_0x37f579){if(_0x37f579){logger[_0xb296('0x1e')](_0xb296('0x84'),_0x37f579);}else{fs['unlinkSync'](_0x48d2d6);}});});});}else{return _0x16a859['sendStatus'](0xc8);}})['catch'](handleError(_0x16a859,null));}; \ No newline at end of file +var _0x95e3=['Owner','toString','closed','closedAt','disposition','threadId','Public','basename','createReadStream','pipe','createWriteStream','out','System','lastName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','limit','undefined','count','offset','set','json','update','then','destroy','stack','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','user','show','from','params','model','keys','filters','intersection','fields','attributes','length','merge','options','find','catch','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','addTags','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','root','server','files','tmp','attachments','join','push','User','fullname','CmContact','Contact','firstName','Attachment','createdAt','direction','secret','read','Openchannel','Account'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95e3,0x10f));var _0x395e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x95e3[_0x46698a];return _0x356db0;};'use strict';var rimraf=require(_0x395e('0x0'));var zipdir=require('zip-dir');var moment=require(_0x395e('0x1'));var util=require('util');var path=require(_0x395e('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x395e('0x3'));var interaction=require(_0x395e('0x4'));var qs=require(_0x395e('0x5'));var pdf=require(_0x395e('0x6'));var logger=require('../../config/logger')(_0x395e('0x7'));var config=require('../../config/environment');var db=require(_0x395e('0x8'))['db'];config['redis']=_[_0x395e('0x9')](config[_0x395e('0xa')],{'host':_0x395e('0xb'),'port':0x18eb});var socket=require(_0x395e('0xc'))(new Redis(config['redis']));require(_0x395e('0xd'))['register'](socket);function respondWithStatusCode(_0xc4bc2d,_0x92878){_0x92878=_0x92878||0xcc;return function(_0x11e938){if(_0x11e938){return _0xc4bc2d[_0x395e('0xe')](_0x92878);}return _0xc4bc2d[_0x395e('0xf')](_0x92878)[_0x395e('0x10')]();};}function respondWithResult(_0x5805c4,_0x3d11bf){_0x3d11bf=_0x3d11bf||0xc8;return function(_0x33911b){if(_0x33911b){return _0x5805c4[_0x395e('0xf')](_0x3d11bf)['json'](_0x33911b);}};}function respondWithFilteredResult(_0x20710f,_0x271ccc){return function(_0x259606){if(_0x259606){var _0x3ebbcf=typeof _0x271ccc['offset']==='undefined'&&typeof _0x271ccc[_0x395e('0x11')]===_0x395e('0x12');var _0x3bc4c3=_0x259606[_0x395e('0x13')];var _0x4237ec=_0x3ebbcf?0x0:_0x271ccc[_0x395e('0x14')];var _0x3f3f7b=_0x3ebbcf?_0x259606['count']:_0x271ccc['offset']+_0x271ccc[_0x395e('0x11')];var _0x2bec0e;if(_0x3f3f7b>=_0x3bc4c3){_0x3f3f7b=_0x3bc4c3;_0x2bec0e=0xc8;}else{_0x2bec0e=0xce;}_0x20710f[_0x395e('0xf')](_0x2bec0e);return _0x20710f[_0x395e('0x15')]('Content-Range',_0x4237ec+'-'+_0x3f3f7b+'/'+_0x3bc4c3)[_0x395e('0x16')](_0x259606);}return null;};}function saveUpdates(_0x547d23){return function(_0x30b7c8){if(_0x30b7c8){return _0x30b7c8[_0x395e('0x17')](_0x547d23)[_0x395e('0x18')](function(_0x33b616){return _0x33b616;});}return null;};}function removeEntity(_0x193a45){return function(_0x416a69){if(_0x416a69){return _0x416a69[_0x395e('0x19')]()[_0x395e('0x18')](function(){_0x193a45['status'](0xcc)[_0x395e('0x10')]();});}};}function handleEntityNotFound(_0x144c6f){return function(_0x37d08e){if(!_0x37d08e){_0x144c6f[_0x395e('0xe')](0x194);}return _0x37d08e;};}function handleError(_0x5f3f30,_0x4ac527){_0x4ac527=_0x4ac527||0x1f4;return function(_0x25a37d){logger['error'](_0x25a37d[_0x395e('0x1a')]);if(_0x25a37d[_0x395e('0x1b')]){delete _0x25a37d['name'];}_0x5f3f30['status'](_0x4ac527)[_0x395e('0x1c')](_0x25a37d);};}exports['index']=function(_0x1e9f34,_0x5dcc6d){var _0x2fc1da={};var _0x1fc543=_[_0x395e('0x1d')](db[_0x395e('0x1e')][_0x395e('0x1f')],function(_0xa1adac){return{'name':_0xa1adac[_0x395e('0x20')],'type':_0xa1adac[_0x395e('0x21')]['key']};});_0x2fc1da=qs[_0x395e('0x22')](_0x1fc543,_0x1e9f34);return interaction[_0x395e('0x23')]('openchannel',_0x1e9f34[_0x395e('0x24')],_0x1e9f34[_0x395e('0x25')],_0x2fc1da,_0x1fc543)[_0x395e('0x18')](respondWithFilteredResult(_0x5dcc6d,_0x2fc1da))['catch'](handleError(_0x5dcc6d,null));};exports[_0x395e('0x26')]=function(_0x1ea6fa,_0x2a7135){var _0x1cb0cd={};if(_0x1ea6fa['query'][_0x395e('0x21')]&&_0x1ea6fa[_0x395e('0x24')][_0x395e('0x21')]===_0x395e('0x27')){_0x1cb0cd[_0x395e('0x27')]=_0x1ea6fa['params']['id'];}else{_0x1cb0cd['id']=_0x1ea6fa[_0x395e('0x28')]['id'];}var _0x3bf7c1={'raw':![],'where':_0x1cb0cd},_0x55ba4d={};_0x55ba4d[_0x395e('0x29')]=_[_0x395e('0x2a')](db[_0x395e('0x1e')][_0x395e('0x1f')]);_0x55ba4d[_0x395e('0x24')]=_[_0x395e('0x2a')](_0x1ea6fa[_0x395e('0x24')]);_0x55ba4d[_0x395e('0x2b')]=_[_0x395e('0x2c')](_0x55ba4d['model'],_0x55ba4d[_0x395e('0x24')]);_0x3bf7c1['attributes']=_[_0x395e('0x2c')](_0x55ba4d['model'],qs[_0x395e('0x2d')](_0x1ea6fa[_0x395e('0x24')]['fields']));_0x3bf7c1[_0x395e('0x2e')]=_0x3bf7c1[_0x395e('0x2e')][_0x395e('0x2f')]?_0x3bf7c1[_0x395e('0x2e')]:_0x55ba4d[_0x395e('0x29')];if(_0x1ea6fa['query']['includeAll']){_0x3bf7c1['include']=[{'all':!![]}];}_0x3bf7c1=_[_0x395e('0x30')]({},_0x3bf7c1,_0x1ea6fa[_0x395e('0x31')]);return db[_0x395e('0x1e')][_0x395e('0x32')](_0x3bf7c1)['then'](handleEntityNotFound(_0x2a7135,null))[_0x395e('0x18')](respondWithResult(_0x2a7135,null))[_0x395e('0x33')](handleError(_0x2a7135,null));};exports[_0x395e('0x34')]=function(_0x58aeae,_0x39b324){return db[_0x395e('0x1e')]['create'](_0x58aeae[_0x395e('0x35')],{})[_0x395e('0x18')](respondWithResult(_0x39b324,0xc9))[_0x395e('0x33')](handleError(_0x39b324,null));};exports[_0x395e('0x17')]=function(_0x484004,_0x532c95){if(_0x484004['body']['id']){delete _0x484004[_0x395e('0x35')]['id'];}return db[_0x395e('0x1e')][_0x395e('0x32')]({'where':{'id':_0x484004[_0x395e('0x28')]['id']}})['then'](handleEntityNotFound(_0x532c95,null))[_0x395e('0x18')](saveUpdates(_0x484004[_0x395e('0x35')],null))[_0x395e('0x18')](respondWithResult(_0x532c95,null))[_0x395e('0x33')](handleError(_0x532c95,null));};exports[_0x395e('0x19')]=function(_0x25b14a,_0x28c5e3){return db[_0x395e('0x1e')][_0x395e('0x32')]({'where':{'id':_0x25b14a[_0x395e('0x28')]['id']}})['then'](handleEntityNotFound(_0x28c5e3,null))[_0x395e('0x18')](removeEntity(_0x28c5e3,null))['catch'](handleError(_0x28c5e3,null));};exports[_0x395e('0x36')]=function(_0x1b7024,_0x122dff){return db[_0x395e('0x1e')]['describe']()['then'](respondWithResult(_0x122dff,null))['catch'](handleError(_0x122dff,null));};exports[_0x395e('0x37')]=function(_0x2077e0,_0x489529){return db[_0x395e('0x38')][_0x395e('0x32')]({'where':{'id':_0x2077e0[_0x395e('0x28')]['id']}})['then'](handleEntityNotFound(_0x489529,null))[_0x395e('0x18')](function(_0x1f5a05){if(_0x1f5a05){return _0x1f5a05[_0x395e('0x37')](_0x2077e0[_0x395e('0x35')][_0x395e('0x39')],_[_0x395e('0x3a')](_0x2077e0[_0x395e('0x35')],['ids','id'])||{});}})[_0x395e('0x18')](respondWithResult(_0x489529,null))[_0x395e('0x33')](handleError(_0x489529,null));};exports[_0x395e('0x3b')]=function(_0x54d901,_0xec2c6f){var _0x13599d={'raw':![],'where':{}};var _0x4d42c1={};var _0x5d885a={'count':0x0,'rows':[]};return db[_0x395e('0x1e')][_0x395e('0x3c')]({'where':{'id':_0x54d901[_0x395e('0x28')]['id']}})[_0x395e('0x18')](handleEntityNotFound(_0xec2c6f,null))[_0x395e('0x18')](function(_0x98fbed){if(_0x98fbed){_0x4d42c1['model']=_[_0x395e('0x2a')](db[_0x395e('0x38')]['rawAttributes']);_0x4d42c1[_0x395e('0x24')]=_['keys'](_0x54d901[_0x395e('0x24')]);_0x4d42c1[_0x395e('0x2b')]=_[_0x395e('0x2c')](_0x4d42c1[_0x395e('0x29')],_0x4d42c1[_0x395e('0x24')]);_0x13599d[_0x395e('0x2e')]=_[_0x395e('0x2c')](_0x4d42c1[_0x395e('0x29')],qs['fields'](_0x54d901['query']['fields']));_0x13599d[_0x395e('0x2e')]=_0x13599d['attributes'][_0x395e('0x2f')]?_0x13599d[_0x395e('0x2e')]:_0x4d42c1[_0x395e('0x29')];if(!_0x54d901[_0x395e('0x24')][_0x395e('0x3d')](_0x395e('0x3e'))){_0x13599d['limit']=qs[_0x395e('0x11')](_0x54d901[_0x395e('0x24')]['limit']);_0x13599d[_0x395e('0x14')]=qs['offset'](_0x54d901[_0x395e('0x24')][_0x395e('0x14')]);}_0x13599d[_0x395e('0x3f')]=qs['sort'](_0x54d901[_0x395e('0x24')][_0x395e('0x40')]);_0x13599d[_0x395e('0x41')]=qs['filters'](_[_0x395e('0x42')](_0x54d901[_0x395e('0x24')],_0x4d42c1['filters']));_0x13599d[_0x395e('0x41')][_0x395e('0x43')]=_0x98fbed['id'];if(_0x54d901[_0x395e('0x24')][_0x395e('0x44')]){_0x13599d[_0x395e('0x41')]=_[_0x395e('0x30')](_0x13599d[_0x395e('0x41')],{'$or':_[_0x395e('0x1d')](_0x13599d[_0x395e('0x2e')],function(_0x283c0){var _0x3567c4={};_0x3567c4[_0x283c0]={'$like':'%'+_0x54d901[_0x395e('0x24')]['filter']+'%'};return _0x3567c4;})});}if(_0x54d901['query']['$gte']){var _0x3c432f=_0x54d901[_0x395e('0x24')]['$gte'][_0x395e('0x45')](',');var _0x46731e={};_0x46731e[_0x3c432f[0x0]]={'$gte':moment(_0x3c432f[0x1])[_0x395e('0x46')](_0x395e('0x47'))};_0x13599d[_0x395e('0x41')]=_[_0x395e('0x30')](_0x13599d[_0x395e('0x41')],_0x46731e);}_0x13599d=_['merge']({},_0x13599d,_0x54d901[_0x395e('0x31')]);return db[_0x395e('0x38')][_0x395e('0x13')]({'where':_0x13599d['where']})[_0x395e('0x18')](function(_0x48bddb){_0x5d885a[_0x395e('0x13')]=_0x48bddb;if(_0x54d901[_0x395e('0x24')][_0x395e('0x48')]){_0x13599d[_0x395e('0x49')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x395e('0x23')](_0x13599d);})['then'](function(_0x3b60dc){_0x5d885a[_0x395e('0x4a')]=_0x3b60dc;return _0x5d885a;});}})['then'](respondWithFilteredResult(_0xec2c6f,_0x13599d))[_0x395e('0x33')](handleError(_0xec2c6f,null));};exports[_0x395e('0x4b')]=function(_0x21ca01,_0xbe526f){return db[_0x395e('0x1e')][_0x395e('0x32')]({'where':{'id':_0x21ca01[_0x395e('0x28')]['id']}})[_0x395e('0x18')](handleEntityNotFound(_0xbe526f,null))[_0x395e('0x18')](function(_0x31974b){if(_0x31974b){return _0x31974b[_0x395e('0x4c')](_0x21ca01[_0x395e('0x35')]['ids'],_[_0x395e('0x3a')](_0x21ca01[_0x395e('0x35')],[_0x395e('0x39'),'id'])||{})['spread'](function(){return db[_0x395e('0x4d')]['findAll']({'attributes':['id','name',_0x395e('0x4e')],'where':{'id':_0x21ca01[_0x395e('0x35')][_0x395e('0x39')]}});})[_0x395e('0x18')](function(_0x38c211){socket[_0x395e('0x4f')](_0x395e('0x50'),{'id':Number(_0x21ca01[_0x395e('0x28')]['id']),'tags':_0x38c211||[]});return{'id':Number(_0x21ca01[_0x395e('0x28')]['id']),'tags':_0x38c211||[]};});}})[_0x395e('0x18')](respondWithResult(_0xbe526f,null))[_0x395e('0x33')](handleError(_0xbe526f,null));};exports['removeTags']=function(_0x56623c,_0x3dedea){return db[_0x395e('0x1e')][_0x395e('0x32')]({'where':{'id':_0x56623c[_0x395e('0x28')]['id']}})['then'](handleEntityNotFound(_0x3dedea,null))[_0x395e('0x18')](function(_0x38b3b5){if(_0x38b3b5){return _0x38b3b5[_0x395e('0x51')](_0x56623c[_0x395e('0x24')]['ids']);}})[_0x395e('0x18')](respondWithStatusCode(_0x3dedea,null))['catch'](handleError(_0x3dedea,null));};exports['download']=function(_0x6c2a96,_0x1a0419){var _0x10dc57=moment()['unix']()['toString']();var _0x10c46e=path['join'](config[_0x395e('0x52')],_0x395e('0x53'),_0x395e('0x54'),_0x395e('0x55'));var _0x130a14=path['join'](config[_0x395e('0x52')],_0x395e('0x53'),'files',_0x395e('0x56'));var _0x58f669=path[_0x395e('0x57')](_0x10c46e,_0x10dc57);var _0x346dce=util['format']('transcript-%d-%s.zip',_0x6c2a96[_0x395e('0x28')]['id'],_0x10dc57);var _0x41baf1=path[_0x395e('0x57')](_0x10c46e,_0x346dce);var _0x18745d=[];_0x18745d[_0x395e('0x58')]({'model':db[_0x395e('0x59')],'as':_0x395e('0x59'),'attributes':['id',_0x395e('0x5a')],'raw':!![]});_0x18745d[_0x395e('0x58')]({'model':db[_0x395e('0x5b')],'as':_0x395e('0x5c'),'attributes':['id',_0x395e('0x5d'),'lastName'],'raw':!![]});if(_0x6c2a96[_0x395e('0x24')][_0x395e('0x56')]){_0x18745d[_0x395e('0x58')]({'model':db[_0x395e('0x5e')],'as':'Attachment','raw':!![]});}var _0x1b45f6=[{'model':db[_0x395e('0x38')],'as':'Messages','attributes':['id',_0x395e('0x35'),_0x395e('0x5f'),_0x395e('0x60'),_0x395e('0x61'),_0x395e('0x62')],'include':_0x18745d}];_0x1b45f6[_0x395e('0x58')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id','name']});_0x1b45f6['push']({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x395e('0x1e')]['find']({'where':{'id':_0x6c2a96[_0x395e('0x28')]['id']},'include':_0x1b45f6})[_0x395e('0x18')](handleEntityNotFound(_0x1a0419,null))[_0x395e('0x18')](function(_0x281a43){if(_0x281a43){var _0x59b4aa=_0x281a43['get']({'plain':!![]});fs['mkdirSync'](_0x58f669);var _0x24e684={'channel':_0x395e('0x63'),'account':_0x59b4aa[_0x395e('0x64')][_0x395e('0x1b')],'agent':_0x59b4aa[_0x395e('0x65')]?_0x59b4aa[_0x395e('0x65')][_0x395e('0x5a')]:'N.A.','createdAt':moment(_0x59b4aa[_0x395e('0x5f')])['format'](_0x395e('0x47'))[_0x395e('0x66')](),'closedAt':_0x59b4aa[_0x395e('0x67')]?moment(_0x59b4aa[_0x395e('0x68')])[_0x395e('0x46')](_0x395e('0x47'))[_0x395e('0x66')]():'','disposition':_0x59b4aa[_0x395e('0x69')],'visibility':_0x59b4aa[_0x395e('0x6a')]?_0x395e('0x6b'):'Private','messages':_(_0x59b4aa['Messages'])[_0x395e('0x44')]({'secret':![]})['map'](function(_0x43ff55){if(_0x43ff55[_0x395e('0x5e')]){var _0x177d90=path[_0x395e('0x57')](_0x130a14,_0x43ff55[_0x395e('0x5e')][_0x395e('0x6c')]);if(fs['existsSync'](_0x177d90)){fs[_0x395e('0x6d')](_0x177d90)[_0x395e('0x6e')](fs[_0x395e('0x6f')](path[_0x395e('0x57')](_0x58f669,_0x43ff55['Attachment'][_0x395e('0x6c')])));}}return{'date':moment(_0x43ff55[_0x395e('0x5f')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x395e('0x66')](),'sender':_0x43ff55['direction']===_0x395e('0x70')?_0x43ff55['User']?_0x43ff55[_0x395e('0x59')][_0x395e('0x5a')]:_0x395e('0x71'):_0x43ff55['Contact'][_0x395e('0x5d')]+(_0x43ff55['Contact'][_0x395e('0x72')]?'\x20'+_0x43ff55[_0x395e('0x5c')][_0x395e('0x72')]:''),'body':_0x43ff55[_0x395e('0x5e')]?_0x43ff55[_0x395e('0x5e')][_0x395e('0x6c')]:_0x43ff55[_0x395e('0x35')],'direction':_0x43ff55[_0x395e('0x60')]===_0x395e('0x70')?'A':'C','secret':_0x43ff55[_0x395e('0x61')],'read':_0x43ff55[_0x395e('0x62')],'attachment':_0x43ff55[_0x395e('0x5e')]};})[_0x395e('0x73')]()};return ejs[_0x395e('0x74')](path[_0x395e('0x57')](config[_0x395e('0x52')],_0x395e('0x53'),'views',_0x395e('0x75')),{'interaction':_0x24e684})[_0x395e('0x18')](function(_0x2b1dbb){var _0x15ccdb=path['join'](_0x58f669,_0x395e('0x76')+_0x59b4aa['id']+'-'+_0x10dc57+_0x395e('0x77'));var _0x1d149d={'path':_0x15ccdb,'channel':_0x395e('0x63'),'interactionId':_0x59b4aa['id']};return pdf[_0x395e('0x78')](_0x2b1dbb,_0x1d149d);})[_0x395e('0x18')](function(){return new Promise(function(_0x2070ca,_0x474481){zipdir(_0x58f669,{'saveTo':_0x41baf1},function(_0x33a9d6,_0x5ce597){if(_0x33a9d6)return _0x474481(_0x33a9d6);return _0x2070ca(_0x5ce597);});})[_0x395e('0x18')](function(){return new Promise(function(_0x581a27,_0x2eee97){rimraf(_0x58f669,function(_0x4401a5){if(_0x4401a5)_0x2eee97(_0x4401a5);return _0x581a27();});});})[_0x395e('0x18')](function(){return _0x1a0419[_0x395e('0x79')](_0x41baf1,_0x346dce,function(_0x193d30){if(_0x193d30){logger['error'](_0x395e('0x7a'),_0x193d30);}else{fs[_0x395e('0x7b')](_0x41baf1);}});});});}else{return _0x1a0419[_0x395e('0xe')](0xc8);}})[_0x395e('0x33')](handleError(_0x1a0419,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2a326d9..b7c0b12 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 _0x9253=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch'];(function(_0x28aac6,_0x8cc55a){var _0x57ebef=function(_0x26a73f){while(--_0x26a73f){_0x28aac6['push'](_0x28aac6['shift']());}};_0x57ebef(++_0x8cc55a);}(_0x9253,0x1cb));var _0x3925=function(_0x2879da,_0x2433cd){_0x2879da=_0x2879da-0x0;var _0x421d56=_0x9253[_0x2879da];return _0x421d56;};'use strict';var EventEmitter=require(_0x3925('0x0'));var OpenchannelInteraction=require(_0x3925('0x1'))['db'][_0x3925('0x2')];var OpenchannelMessage=require(_0x3925('0x1'))['db'][_0x3925('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3925('0x4')](0x0);var events={'afterCreate':_0x3925('0x5'),'afterUpdate':'update','afterDestroy':_0x3925('0x6')};function emitEvent(_0x327102){return function(_0x1d5417,_0x12e99d,_0x5e14f2){_0x1d5417[_0x3925('0x7')]({'attributes':['id'],'raw':!![]})[_0x3925('0x8')](function(_0x2405b7){_0x1d5417[_0x3925('0x9')](_0x3925('0xa'),_0x2405b7['map'](function(_0x593639){return{'id':_0x593639['id']};}));return OpenchannelMessage[_0x3925('0xb')]({'where':{'OpenchannelInteractionId':_0x1d5417['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3925('0x8')](function(_0x28e3b0){_0x1d5417[_0x3925('0x9')](_0x3925('0xc'),_0x28e3b0[_0x3925('0xd')]);OpenchannelInteractionEvents[_0x3925('0xe')](_0x327102+':'+_0x1d5417['id'],_0x1d5417);OpenchannelInteractionEvents[_0x3925('0xe')](_0x327102,_0x1d5417);_0x5e14f2(null);})[_0x3925('0xf')](_0x5e14f2(null));};}for(var e in events){if(events[_0x3925('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x3925('0x11')](e,emitEvent(event));}}module[_0x3925('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x9271=['map','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','getUsers','setDataValue'];(function(_0x569f0a,_0x1f416a){var _0x444b93=function(_0x48b6c3){while(--_0x48b6c3){_0x569f0a['push'](_0x569f0a['shift']());}};_0x444b93(++_0x1f416a);}(_0x9271,0x1e3));var _0x1927=function(_0x5a1a92,_0x5a9939){_0x5a1a92=_0x5a1a92-0x0;var _0x27bc53=_0x9271[_0x5a1a92];return _0x27bc53;};'use strict';var EventEmitter=require(_0x1927('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x1927('0x1'))['db'][_0x1927('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1927('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1927('0x4'),'afterDestroy':'remove'};function emitEvent(_0x154e2a){return function(_0x488b7f,_0x1b2b6e,_0x80dd1){_0x488b7f[_0x1927('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x56077a){_0x488b7f[_0x1927('0x6')]('Users',_0x56077a[_0x1927('0x7')](function(_0x5d7a6e){return{'id':_0x5d7a6e['id']};}));return OpenchannelMessage[_0x1927('0x8')]({'where':{'OpenchannelInteractionId':_0x488b7f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xa4fc48){_0x488b7f[_0x1927('0x6')](_0x1927('0x9'),_0xa4fc48[_0x1927('0xa')]);OpenchannelInteractionEvents['emit'](_0x154e2a+':'+_0x488b7f['id'],_0x488b7f);OpenchannelInteractionEvents[_0x1927('0xb')](_0x154e2a,_0x488b7f);_0x80dd1(null);})[_0x1927('0xc')](_0x80dd1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x1927('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6917eef..94e452b 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 _0x6113=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x5e88d8,_0x399d52){var _0xa1d699=function(_0xa50de4){while(--_0xa50de4){_0x5e88d8['push'](_0x5e88d8['shift']());}};_0xa1d699(++_0x399d52);}(_0x6113,0x1b2));var _0x3611=function(_0x4f0c5f,_0x3f5868){_0x4f0c5f=_0x4f0c5f-0x0;var _0x5d45c5=_0x6113[_0x4f0c5f];return _0x5d45c5;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))('api');var moment=require(_0x3611('0x3'));var BPromise=require(_0x3611('0x4'));var rp=require(_0x3611('0x5'));var fs=require('fs');var path=require(_0x3611('0x6'));var rimraf=require('rimraf');var config=require(_0x3611('0x7'));var attributes=require(_0x3611('0x8'));module[_0x3611('0x9')]=function(_0xd601b4,_0x5126cd){return _0xd601b4[_0x3611('0xa')](_0x3611('0xb'),attributes,{'tableName':_0x3611('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3611('0xd'),'collate':_0x3611('0xe'),'hooks':{'beforeUpdate':function(_0x450266,_0x4bffdc,_0x2957ab){if(_0x450266[_0x3611('0xf')]('closed')){_0x450266['closedAt']=moment()[_0x3611('0x10')](_0x3611('0x11'));}_0x2957ab(null,_0x450266);}}});}; \ No newline at end of file +var _0x0e26=['utf8mb4','utf8mb4_unicode_ci','closed','format','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x22b34c,_0x1910ca){var _0x6ec19=function(_0x3787cd){while(--_0x3787cd){_0x22b34c['push'](_0x22b34c['shift']());}};_0x6ec19(++_0x1910ca);}(_0x0e26,0x82));var _0x60e2=function(_0x2b9b3a,_0x4fcc47){_0x2b9b3a=_0x2b9b3a-0x0;var _0x5aec37=_0x0e26[_0x2b9b3a];return _0x5aec37;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60e2('0x0'))(_0x60e2('0x1'));var moment=require(_0x60e2('0x2'));var BPromise=require('bluebird');var rp=require(_0x60e2('0x3'));var fs=require('fs');var path=require(_0x60e2('0x4'));var rimraf=require('rimraf');var config=require(_0x60e2('0x5'));var attributes=require(_0x60e2('0x6'));module['exports']=function(_0x112bf3,_0x3f51ab){return _0x112bf3[_0x60e2('0x7')](_0x60e2('0x8'),attributes,{'tableName':_0x60e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60e2('0xa'),'collate':_0x60e2('0xb'),'hooks':{'beforeUpdate':function(_0xa94ac0,_0x4a1f15,_0xda452f){if(_0xa94ac0['changed'](_0x60e2('0xc'))){_0xa94ac0['closedAt']=moment()[_0x60e2('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0xda452f(null,_0xa94ac0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 574a4af..0963ae5 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 _0x6e44=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','body','options','raw','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x4437c7,_0x2bd96c){var _0x13893c=function(_0x3132b9){while(--_0x3132b9){_0x4437c7['push'](_0x4437c7['shift']());}};_0x13893c(++_0x2bd96c);}(_0x6e44,0xc5));var _0x46e4=function(_0x1a3634,_0x3a5fe7){_0x1a3634=_0x1a3634-0x0;var _0x2338c7=_0x6e44[_0x1a3634];return _0x2338c7;};'use strict';var _=require(_0x46e4('0x0'));var util=require(_0x46e4('0x1'));var moment=require(_0x46e4('0x2'));var BPromise=require(_0x46e4('0x3'));var rs=require(_0x46e4('0x4'));var fs=require('fs');var Redis=require(_0x46e4('0x5'));var db=require(_0x46e4('0x6'))['db'];var utils=require(_0x46e4('0x7'));var logger=require(_0x46e4('0x8'))(_0x46e4('0x9'));var config=require(_0x46e4('0xa'));var jayson=require(_0x46e4('0xb'));var client=jayson['client'][_0x46e4('0xc')]({'port':0x232a});config['redis']=_[_0x46e4('0xd')](config[_0x46e4('0xe')],{'host':_0x46e4('0xf'),'port':0x18eb});var socket=require(_0x46e4('0x10'))(new Redis(config['redis']));require(_0x46e4('0x11'))[_0x46e4('0x12')](socket);function respondWithRpcPromise(_0x2c556e,_0x4cb1a0,_0x3c9455){return new BPromise(function(_0x4cf2e6,_0x316189){return client[_0x46e4('0x13')](_0x2c556e,_0x3c9455)[_0x46e4('0x14')](function(_0xf700cb){logger[_0x46e4('0x15')](_0x46e4('0x16'),_0x4cb1a0,'request\x20sent');logger[_0x46e4('0x17')](_0x46e4('0x18'),_0x4cb1a0,_0x46e4('0x19'),JSON[_0x46e4('0x1a')](_0xf700cb));if(_0xf700cb[_0x46e4('0x1b')]){if(_0xf700cb['error'][_0x46e4('0x1c')]===0x1f4){logger[_0x46e4('0x1b')](_0x46e4('0x16'),_0x4cb1a0,_0xf700cb['error']['message']);return _0x316189(_0xf700cb[_0x46e4('0x1b')][_0x46e4('0x1d')]);}logger[_0x46e4('0x1b')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4cb1a0,_0xf700cb['error'][_0x46e4('0x1d')]);return _0x4cf2e6(_0xf700cb[_0x46e4('0x1b')][_0x46e4('0x1d')]);}else{logger[_0x46e4('0x15')](_0x46e4('0x16'),_0x4cb1a0,_0x46e4('0x19'));_0x4cf2e6(_0xf700cb[_0x46e4('0x1e')][_0x46e4('0x1d')]);}})[_0x46e4('0x1f')](function(_0x4584a0){logger['error'](_0x46e4('0x16'),_0x4cb1a0,_0x4584a0);_0x316189(_0x4584a0);});});}exports[_0x46e4('0x20')]=function(_0x2f9ab6){var _0x1ea59b=this;return new Promise(function(_0x3b4d1a,_0x211a5c){return db['OpenchannelInteraction']['update'](_0x2f9ab6[_0x46e4('0x21')],{'raw':_0x2f9ab6[_0x46e4('0x22')]?_0x2f9ab6['options'][_0x46e4('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f9ab6[_0x46e4('0x22')]?_0x2f9ab6[_0x46e4('0x22')]['where']||null:null,'attributes':_0x2f9ab6[_0x46e4('0x22')]?_0x2f9ab6['options']['attributes']||null:null,'limit':_0x2f9ab6[_0x46e4('0x22')]?_0x2f9ab6[_0x46e4('0x22')][_0x46e4('0x24')]||null:null})[_0x46e4('0x14')](function(_0xe37afe){logger[_0x46e4('0x15')](_0x46e4('0x20'),_0x2f9ab6);logger['debug'](_0x46e4('0x20'),_0x2f9ab6,JSON[_0x46e4('0x1a')](_0xe37afe));_0x3b4d1a(_0xe37afe);})['catch'](function(_0x3a9eae){logger['error'](_0x46e4('0x20'),_0x3a9eae[_0x46e4('0x1d')],_0x2f9ab6);_0x211a5c(_0x1ea59b[_0x46e4('0x1b')](0x1f4,_0x3a9eae['message']));});});};exports[_0x46e4('0x25')]=function(_0x1f9134){return new Promise(function(_0x107233,_0xa9c95d){return db[_0x46e4('0x26')][_0x46e4('0x27')]({'where':_0x1f9134[_0x46e4('0x22')]?_0x1f9134[_0x46e4('0x22')][_0x46e4('0x28')]||null:null})[_0x46e4('0x14')](function(_0x21b7fc){if(_0x21b7fc){return _0x21b7fc['addTags'](_0x1f9134[_0x46e4('0x21')][_0x46e4('0x29')],_['omit'](_0x1f9134[_0x46e4('0x21')],[_0x46e4('0x29'),'id'])||{});}})[_0x46e4('0x2a')](function(_0x5604c3){logger[_0x46e4('0x15')](_0x46e4('0x2b'),_0x1f9134);logger[_0x46e4('0x17')](_0x46e4('0x2b'),_0x1f9134,JSON[_0x46e4('0x1a')](_0x5604c3));_0x107233(_0x5604c3);})[_0x46e4('0x1f')](function(_0xe69d09){logger[_0x46e4('0x1b')](_0x46e4('0x2b'),_0xe69d09[_0x46e4('0x1d')],_0x1f9134);_0xa9c95d(_this[_0x46e4('0x1b')](0x1f4,_0xe69d09[_0x46e4('0x1d')]));});});}; \ No newline at end of file +var _0x6487=['request\x20sent','stringify','code','error','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','AddTagsToOpenchannelInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x74c1ee,_0x533e4f){var _0x43f6dc=function(_0x16a0b2){while(--_0x16a0b2){_0x74c1ee['push'](_0x74c1ee['shift']());}};_0x43f6dc(++_0x533e4f);}(_0x6487,0x1cc));var _0x7648=function(_0x3fc8f1,_0x5daafa){_0x3fc8f1=_0x3fc8f1-0x0;var _0x32779a=_0x6487[_0x3fc8f1];return _0x32779a;};'use strict';var _=require(_0x7648('0x0'));var util=require(_0x7648('0x1'));var moment=require(_0x7648('0x2'));var BPromise=require(_0x7648('0x3'));var rs=require(_0x7648('0x4'));var fs=require('fs');var Redis=require(_0x7648('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7648('0x6'))('rpc');var config=require(_0x7648('0x7'));var jayson=require(_0x7648('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x7648('0x9')]=_['defaults'](config['redis'],{'host':_0x7648('0xa'),'port':0x18eb});var socket=require(_0x7648('0xb'))(new Redis(config[_0x7648('0x9')]));require(_0x7648('0xc'))[_0x7648('0xd')](socket);function respondWithRpcPromise(_0x4293e6,_0x32988b,_0x1de1e3){return new BPromise(function(_0x37e253,_0x34fa29){return client[_0x7648('0xe')](_0x4293e6,_0x1de1e3)[_0x7648('0xf')](function(_0x3b1b66){logger[_0x7648('0x10')](_0x7648('0x11'),_0x32988b,'request\x20sent');logger[_0x7648('0x12')](_0x7648('0x13'),_0x32988b,_0x7648('0x14'),JSON[_0x7648('0x15')](_0x3b1b66));if(_0x3b1b66['error']){if(_0x3b1b66['error'][_0x7648('0x16')]===0x1f4){logger[_0x7648('0x17')](_0x7648('0x11'),_0x32988b,_0x3b1b66[_0x7648('0x17')][_0x7648('0x18')]);return _0x34fa29(_0x3b1b66[_0x7648('0x17')][_0x7648('0x18')]);}logger[_0x7648('0x17')](_0x7648('0x11'),_0x32988b,_0x3b1b66['error'][_0x7648('0x18')]);return _0x37e253(_0x3b1b66['error']['message']);}else{logger[_0x7648('0x10')](_0x7648('0x11'),_0x32988b,_0x7648('0x14'));_0x37e253(_0x3b1b66[_0x7648('0x19')][_0x7648('0x18')]);}})['catch'](function(_0x15bc72){logger[_0x7648('0x17')](_0x7648('0x11'),_0x32988b,_0x15bc72);_0x34fa29(_0x15bc72);});});}exports[_0x7648('0x1a')]=function(_0x20be79){var _0x30e402=this;return new Promise(function(_0x22b07e,_0x545284){return db[_0x7648('0x1b')][_0x7648('0x1c')](_0x20be79[_0x7648('0x1d')],{'raw':_0x20be79[_0x7648('0x1e')]?_0x20be79[_0x7648('0x1e')][_0x7648('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20be79['options']?_0x20be79[_0x7648('0x1e')]['where']||null:null,'attributes':_0x20be79[_0x7648('0x1e')]?_0x20be79[_0x7648('0x1e')]['attributes']||null:null,'limit':_0x20be79[_0x7648('0x1e')]?_0x20be79[_0x7648('0x1e')][_0x7648('0x20')]||null:null})[_0x7648('0xf')](function(_0x299d92){logger['info'](_0x7648('0x1a'),_0x20be79);logger['debug'](_0x7648('0x1a'),_0x20be79,JSON[_0x7648('0x15')](_0x299d92));_0x22b07e(_0x299d92);})['catch'](function(_0x3b9c59){logger[_0x7648('0x17')]('UpdateOpenchannelInteraction',_0x3b9c59[_0x7648('0x18')],_0x20be79);_0x545284(_0x30e402[_0x7648('0x17')](0x1f4,_0x3b9c59['message']));});});};exports[_0x7648('0x21')]=function(_0x8221d8){return new Promise(function(_0x3461e1,_0x1e107c){return db['OpenchannelInteraction'][_0x7648('0x22')]({'where':_0x8221d8[_0x7648('0x1e')]?_0x8221d8[_0x7648('0x1e')][_0x7648('0x23')]||null:null})[_0x7648('0xf')](function(_0x1d0b7e){if(_0x1d0b7e){return _0x1d0b7e[_0x7648('0x24')](_0x8221d8['body'][_0x7648('0x25')],_[_0x7648('0x26')](_0x8221d8[_0x7648('0x1d')],[_0x7648('0x25'),'id'])||{});}})['spread'](function(_0x23ae2d){logger[_0x7648('0x10')]('AddTags',_0x8221d8);logger[_0x7648('0x12')](_0x7648('0x27'),_0x8221d8,JSON[_0x7648('0x15')](_0x23ae2d));_0x3461e1(_0x23ae2d);})['catch'](function(_0x2e471d){logger[_0x7648('0x17')](_0x7648('0x27'),_0x2e471d[_0x7648('0x18')],_0x8221d8);_0x1e107c(_this['error'](0x1f4,_0x2e471d[_0x7648('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 61b5092..78f6983 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 _0x093c=['save','remove','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0x093c,0x16d));var _0xc093=function(_0x488838,_0xfc56d0){_0x488838=_0x488838-0x0;var _0x1c8741=_0x093c[_0x488838];return _0x1c8741;};'use strict';var OpenchannelInteractionEvents=require(_0xc093('0x0'));var events=[_0xc093('0x1'),_0xc093('0x2'),'update'];function createListener(_0x37a72a,_0x4988cf){return function(_0x3999f0){_0x4988cf['emit'](_0x37a72a,_0x3999f0);};}function removeListener(_0x4fbaac,_0x3f2bd3){return function(){OpenchannelInteractionEvents[_0xc093('0x3')](_0x4fbaac,_0x3f2bd3);};}exports['register']=function(_0x7dc807){for(var _0x2a3407=0x0,_0x49fcb7=events[_0xc093('0x4')];_0x2a3407<_0x49fcb7;_0x2a3407++){var _0x159c5a=events[_0x2a3407];var _0x273bf6=createListener(_0xc093('0x5')+_0x159c5a,_0x7dc807);OpenchannelInteractionEvents['on'](_0x159c5a,_0x273bf6);}}; \ No newline at end of file +var _0x2e2d=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x32f8a2,_0x49c502){var _0x258cca=function(_0x1040e4){while(--_0x1040e4){_0x32f8a2['push'](_0x32f8a2['shift']());}};_0x258cca(++_0x49c502);}(_0x2e2d,0x160));var _0xd2e2=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x2e2d[_0xc4001c];return _0x49f7bc;};'use strict';var OpenchannelInteractionEvents=require(_0xd2e2('0x0'));var events=[_0xd2e2('0x1'),_0xd2e2('0x2'),_0xd2e2('0x3')];function createListener(_0x4c3f10,_0x53cbba){return function(_0x2fc602){_0x53cbba[_0xd2e2('0x4')](_0x4c3f10,_0x2fc602);};}function removeListener(_0x200ccb,_0x4d2c5f){return function(){OpenchannelInteractionEvents[_0xd2e2('0x5')](_0x200ccb,_0x4d2c5f);};}exports[_0xd2e2('0x6')]=function(_0x561e2a){for(var _0x3da175=0x0,_0x59cfdf=events[_0xd2e2('0x7')];_0x3da175<_0x59cfdf;_0x3da175++){var _0xb4723f=events[_0x3da175];var _0x316b29=createListener('openchannelInteraction:'+_0xb4723f,_0x561e2a);OpenchannelInteractionEvents['on'](_0xb4723f,_0x316b29);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8eefef1..8026aec 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x52c259,_0x4bc883){var _0x71b342=function(_0x104336){while(--_0x104336){_0x52c259['push'](_0x52c259['shift']());}};_0x71b342(++_0x4bc883);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _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(_0x394b5f,_0x62c87){var _0x3f3c5d=function(_0x500298){while(--_0x500298){_0x394b5f['push'](_0x394b5f['shift']());}};_0x3f3c5d(++_0x62c87);}(_0xe706,0xa3));var _0x6e70=function(_0x4b869a,_0x1f993d){_0x4b869a=_0x4b869a-0x0;var _0x10d713=_0xe706[_0x4b869a];return _0x10d713;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 6e2bf8e..143e5bb 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 _0xb9e7=['ENUM','out','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xb9e7[_0x26f1b2];return _0x1624a4;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'body':{'type':Sequelize[_0x7b9e('0x1')](_0x7b9e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7b9e('0x4')]('in','out'),'defaultValue':_0x7b9e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7b9e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7b9e('0x1')]}}; \ No newline at end of file +var _0xeef7=['exports','medium','BOOLEAN','out','DATE','STRING','sequelize'];(function(_0xb37fc6,_0x3eae0f){var _0x2787a4=function(_0x3d83db){while(--_0x3d83db){_0xb37fc6['push'](_0xb37fc6['shift']());}};_0x2787a4(++_0x3eae0f);}(_0xeef7,0x7d));var _0x7eef=function(_0x18c5b9,_0x17f7a8){_0x18c5b9=_0x18c5b9-0x0;var _0xfb8f97=_0xeef7[_0x18c5b9];return _0xfb8f97;};'use strict';var Sequelize=require(_0x7eef('0x0'));module[_0x7eef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x7eef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7eef('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7eef('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7eef('0x5')]},'providerName':{'type':Sequelize[_0x7eef('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8461839..204a755 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 _0x481b=['util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','update','destroy','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','create','body','find','describe','accept','acceptMessage','reject','UserId','user','agent','get','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage'];(function(_0x536fda,_0x1a687b){var _0x32a87c=function(_0x4f73e6){while(--_0x4f73e6){_0x536fda['push'](_0x536fda['shift']());}};_0x32a87c(++_0x1a687b);}(_0x481b,0x12c));var _0xb481=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x481b[_0xa148b7];return _0x51efd3;};'use strict';var util=require(_0xb481('0x0'));var _=require('lodash');var Redis=require(_0xb481('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0xb481('0x2'));var logger=require(_0xb481('0x3'))(_0xb481('0x4'));var config=require(_0xb481('0x5'));var db=require('../../mysqldb')['db'];config[_0xb481('0x6')]=_[_0xb481('0x7')](config['redis'],{'host':_0xb481('0x8'),'port':0x18eb});var socket=require(_0xb481('0x9'))(new Redis(config[_0xb481('0x6')]));require(_0xb481('0xa'))['register'](socket);var jayson=require(_0xb481('0xb'));var client=jayson[_0xb481('0xc')]['http']({'port':0x232c});var client9002=jayson[_0xb481('0xc')]['http']({'port':0x232a});var interaction_log=require(_0xb481('0x3'))(_0xb481('0xd'));function respondWithRpcPromise(_0x1de826,_0x2b5b67,_0x5606c5,_0x1f437a){return new Promise(function(_0x296f02,_0x7155e1){var _0x17b223=_0x1f437a||client;return _0x17b223[_0xb481('0xe')](_0x1de826,_0x5606c5)[_0xb481('0xf')](function(_0x532cbe){logger[_0xb481('0x10')](_0xb481('0x11'),_0x2b5b67,'request\x20sent');logger[_0xb481('0x12')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2b5b67,_0xb481('0x13'),JSON[_0xb481('0x14')](_0x532cbe));if(_0x532cbe[_0xb481('0x15')]){if(_0x532cbe[_0xb481('0x15')][_0xb481('0x16')]===0x1f4){logger['error'](_0xb481('0x11'),_0x2b5b67,_0x532cbe[_0xb481('0x15')][_0xb481('0x17')]);return _0x7155e1(_0x532cbe['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2b5b67,_0x532cbe[_0xb481('0x15')][_0xb481('0x17')]);return _0x296f02(_0x532cbe['error']['message']);}else{logger[_0xb481('0x10')](_0xb481('0x11'),_0x2b5b67,_0xb481('0x13'));_0x296f02(_0x532cbe[_0xb481('0x18')][_0xb481('0x17')]);}})[_0xb481('0x19')](function(_0x3edd18){logger[_0xb481('0x15')](_0xb481('0x11'),_0x2b5b67,_0x3edd18);_0x7155e1(_0x3edd18);});});}function respondWithResult(_0x1d9934,_0x58a85b){_0x58a85b=_0x58a85b||0xc8;return function(_0x5ea5e3){if(_0x5ea5e3){return _0x1d9934[_0xb481('0x1a')](_0x58a85b)[_0xb481('0x1b')](_0x5ea5e3);}};}function respondWithFilteredResult(_0x516d3c,_0x204743){return function(_0x260c7c){if(_0x260c7c){var _0x95007b=typeof _0x204743['offset']===_0xb481('0x1c')&&typeof _0x204743[_0xb481('0x1d')]===_0xb481('0x1c');var _0x4145ab=_0x260c7c[_0xb481('0x1e')];var _0x5b7239=_0x95007b?0x0:_0x204743[_0xb481('0x1f')];var _0x15b36c=_0x95007b?_0x260c7c[_0xb481('0x1e')]:_0x204743['offset']+_0x204743['limit'];var _0x9c868a;if(_0x15b36c>=_0x4145ab){_0x15b36c=_0x4145ab;_0x9c868a=0xc8;}else{_0x9c868a=0xce;}_0x516d3c[_0xb481('0x1a')](_0x9c868a);return _0x516d3c['set']('Content-Range',_0x5b7239+'-'+_0x15b36c+'/'+_0x4145ab)['json'](_0x260c7c);}return null;};}function saveUpdates(_0x2d670b){return function(_0x17e848){if(_0x17e848){return _0x17e848[_0xb481('0x20')](_0x2d670b)[_0xb481('0xf')](function(_0x181d47){return _0x181d47;});}return null;};}function removeEntity(_0x1cb5b4){return function(_0x69147a){if(_0x69147a){return _0x69147a[_0xb481('0x21')]()['then'](function(){_0x1cb5b4[_0xb481('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41669b){return function(_0x40a615){if(!_0x40a615){_0x41669b[_0xb481('0x22')](0x194);}return _0x40a615;};}function handleError(_0x594dac,_0x569cb6){_0x569cb6=_0x569cb6||0x1f4;return function(_0x338601){logger['error'](_0x338601[_0xb481('0x23')]);if(_0x338601[_0xb481('0x24')]){delete _0x338601[_0xb481('0x24')];}_0x594dac[_0xb481('0x1a')](_0x569cb6)[_0xb481('0x25')](_0x338601);};}exports['index']=function(_0x1e9bdb,_0x444ce3){var _0x34ab14={},_0x7e2b56={},_0x407c4f={'count':0x0,'rows':[]};var _0x3cff2f=_[_0xb481('0x26')](db[_0xb481('0x27')][_0xb481('0x28')],function(_0x36bb9f){return{'name':_0x36bb9f[_0xb481('0x29')],'type':_0x36bb9f[_0xb481('0x2a')][_0xb481('0x2b')]};});_0x7e2b56['model']=_[_0xb481('0x26')](_0x3cff2f,_0xb481('0x24'));_0x7e2b56[_0xb481('0x2c')]=_[_0xb481('0x2d')](_0x1e9bdb[_0xb481('0x2c')]);_0x7e2b56[_0xb481('0x2e')]=_['intersection'](_0x7e2b56[_0xb481('0x2f')],_0x7e2b56[_0xb481('0x2c')]);_0x34ab14['attributes']=_['intersection'](_0x7e2b56['model'],qs[_0xb481('0x30')](_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x30')]));_0x34ab14['attributes']=_0x34ab14[_0xb481('0x31')][_0xb481('0x32')]?_0x34ab14[_0xb481('0x31')]:_0x7e2b56[_0xb481('0x2f')];if(!_0x1e9bdb['query'][_0xb481('0x33')](_0xb481('0x34'))){_0x34ab14[_0xb481('0x1d')]=qs['limit'](_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x1d')]);_0x34ab14[_0xb481('0x1f')]=qs['offset'](_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x1f')]);}_0x34ab14[_0xb481('0x35')]=qs[_0xb481('0x36')](_0x1e9bdb[_0xb481('0x2c')]['sort']);_0x34ab14[_0xb481('0x37')]=qs['filters'](_['pick'](_0x1e9bdb['query'],_0x7e2b56['filters']),_0x3cff2f);if(_0x1e9bdb['query'][_0xb481('0x38')]){_0x34ab14[_0xb481('0x37')]=_[_0xb481('0x39')](_0x34ab14['where'],{'$or':_[_0xb481('0x26')](_0x3cff2f,function(_0x1a187f){if(_0x1a187f[_0xb481('0x2a')]!==_0xb481('0x3a')){var _0x34d560={};_0x34d560[_0x1a187f[_0xb481('0x24')]]={'$like':'%'+_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x38')]+'%'};return _0x34d560;}})});}_0x34ab14=_[_0xb481('0x39')]({},_0x34ab14,_0x1e9bdb[_0xb481('0x3b')]);var _0x2a09a7={'where':_0x34ab14[_0xb481('0x37')]};return db[_0xb481('0x27')]['count'](_0x2a09a7)[_0xb481('0xf')](function(_0x4b1085){_0x407c4f[_0xb481('0x1e')]=_0x4b1085;if(_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x3c')]){_0x34ab14[_0xb481('0x3d')]=[{'all':!![]}];}return db[_0xb481('0x27')][_0xb481('0x3e')](_0x34ab14);})[_0xb481('0xf')](function(_0x4f46b6){_0x407c4f[_0xb481('0x3f')]=_0x4f46b6;return _0x407c4f;})['then'](respondWithFilteredResult(_0x444ce3,_0x34ab14))[_0xb481('0x19')](handleError(_0x444ce3,null));};exports[_0xb481('0x40')]=function(_0x5234d0,_0x4f81f0){var _0xfce789={'raw':!![],'where':{'id':_0x5234d0[_0xb481('0x41')]['id']}},_0x91cf={};_0x91cf[_0xb481('0x2f')]=_[_0xb481('0x2d')](db[_0xb481('0x27')]['rawAttributes']);_0x91cf[_0xb481('0x2c')]=_[_0xb481('0x2d')](_0x5234d0[_0xb481('0x2c')]);_0x91cf[_0xb481('0x2e')]=_[_0xb481('0x42')](_0x91cf[_0xb481('0x2f')],_0x91cf[_0xb481('0x2c')]);_0xfce789['attributes']=_[_0xb481('0x42')](_0x91cf[_0xb481('0x2f')],qs[_0xb481('0x30')](_0x5234d0['query']['fields']));_0xfce789['attributes']=_0xfce789['attributes'][_0xb481('0x32')]?_0xfce789[_0xb481('0x31')]:_0x91cf[_0xb481('0x2f')];if(_0x5234d0[_0xb481('0x2c')][_0xb481('0x3c')]){_0xfce789[_0xb481('0x3d')]=[{'all':!![]}];}_0xfce789=_[_0xb481('0x39')]({},_0xfce789,_0x5234d0['options']);return db[_0xb481('0x27')]['find'](_0xfce789)[_0xb481('0xf')](handleEntityNotFound(_0x4f81f0,null))[_0xb481('0xf')](respondWithResult(_0x4f81f0,null))[_0xb481('0x19')](handleError(_0x4f81f0,null));};exports[_0xb481('0x43')]=function(_0x1863f8,_0x362f47){return db['OpenchannelMessage'][_0xb481('0x43')](_0x1863f8['body'],{})['then'](respondWithResult(_0x362f47,0xc9))[_0xb481('0x19')](handleError(_0x362f47,null));};exports[_0xb481('0x20')]=function(_0x4fb600,_0xee535c){if(_0x4fb600[_0xb481('0x44')]['id']){delete _0x4fb600[_0xb481('0x44')]['id'];}return db[_0xb481('0x27')][_0xb481('0x45')]({'where':{'id':_0x4fb600[_0xb481('0x41')]['id']}})[_0xb481('0xf')](handleEntityNotFound(_0xee535c,null))[_0xb481('0xf')](saveUpdates(_0x4fb600[_0xb481('0x44')],null))['then'](respondWithResult(_0xee535c,null))[_0xb481('0x19')](handleError(_0xee535c,null));};exports[_0xb481('0x21')]=function(_0x4a0591,_0x371475){return db[_0xb481('0x27')][_0xb481('0x45')]({'where':{'id':_0x4a0591[_0xb481('0x41')]['id']}})[_0xb481('0xf')](handleEntityNotFound(_0x371475,null))[_0xb481('0xf')](removeEntity(_0x371475,null))['catch'](handleError(_0x371475,null));};exports[_0xb481('0x46')]=function(_0x2051e1,_0x217d73){return db[_0xb481('0x27')][_0xb481('0x46')]()[_0xb481('0xf')](respondWithResult(_0x217d73,null))[_0xb481('0x19')](handleError(_0x217d73,null));};exports[_0xb481('0x47')]=function(_0x32197c,_0x4451c4){var _0x5796e='openchannel';return interactionService[_0xb481('0x48')](_0x32197c,_0x5796e)[_0xb481('0xf')](respondWithResult(_0x4451c4,null))[_0xb481('0x19')](handleError(_0x4451c4,null));};exports[_0xb481('0x49')]=function(_0x1073c9,_0x23e9f8){var _0x163480={'agent':{},'channel':'openchannel'};if(_0x1073c9[_0xb481('0x44')]['id']){delete _0x1073c9[_0xb481('0x44')]['id'];}_0x1073c9[_0xb481('0x44')][_0xb481('0x4a')]=_0x1073c9['body']['UserId']||_0x1073c9[_0xb481('0x4b')]['id'];_0x163480[_0xb481('0x4c')]['id']=_0x1073c9['body']['UserId'];return db[_0xb481('0x27')][_0xb481('0x45')]({'where':{'id':_0x1073c9[_0xb481('0x41')]['id'],'UserId':null}})[_0xb481('0xf')](handleEntityNotFound(_0x23e9f8,null))[_0xb481('0xf')](function(_0x5548bf){if(_0x5548bf){_0x163480[_0xb481('0x17')]=_0x5548bf[_0xb481('0x4d')]({'plain':!![]});return db['OpenchannelInteraction'][_0xb481('0x45')]({'where':{'id':_0x5548bf['OpenchannelInteractionId']}});}return null;})[_0xb481('0xf')](handleEntityNotFound(_0x23e9f8,null))[_0xb481('0xf')](function(_0x58a835){if(_0x58a835){_0x163480[_0xb481('0x4e')]=_0x58a835[_0xb481('0x4d')]({'plain':!![]});interaction_log[_0xb481('0x10')](_0xb481('0x4f'),_0x1073c9['user']['id'],_0x1073c9[_0xb481('0x4b')][_0xb481('0x24')],_0x1073c9[_0xb481('0x4b')][_0xb481('0x50')],_0x163480[_0xb481('0x4e')]['id'],_0x1073c9['body']?JSON[_0xb481('0x14')](_0x1073c9[_0xb481('0x44')]):_0xb481('0x51'));return respondWithRpcPromise(_0xb481('0x52'),_0xb481('0x53'),_0x163480);}return null;})[_0xb481('0xf')](function(_0xbb4563){var _0x1a8d8b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xbb4563[_0xb481('0x17')][_0xb481('0x54')];return db[_0xb481('0x55')]['query'](_0x1a8d8b,{'type':db[_0xb481('0x56')][_0xb481('0x57')][_0xb481('0x58')],'raw':!![]})[_0xb481('0xf')](function(_0x4049c2){return _0x4049c2;});})[_0xb481('0xf')](function(_0x49f50e){if(_0x49f50e){_0x163480[_0xb481('0x17')][_0xb481('0x59')]=_0x49f50e[0x0];if(!_0x1073c9[_0xb481('0x44')][_0xb481('0x4a')])return;return db[_0xb481('0x5a')][_0xb481('0x45')]({'where':{'id':_0x1073c9[_0xb481('0x44')][_0xb481('0x4a')],'role':_0xb481('0x4c')},'attributes':['id',_0xb481('0x24'),_0xb481('0x5b'),'email',_0xb481('0x5c')],'raw':!![]});}return null;})['then'](function(_0x1384c2){if(!_0x1384c2)return null;_0x163480[_0xb481('0x17')]['agent']=_0x1384c2;return _0x163480;})[_0xb481('0xf')](function(_0x5bb384){if(_0x5bb384){_0x5bb384[_0xb481('0x17')][_0xb481('0x5d')]=util[_0xb481('0x5e')](_0xb481('0x5f'),_0x1073c9[_0xb481('0x4b')]['name']);_0x5bb384[_0xb481('0x17')][_0xb481('0x60')]=_0x163480[_0xb481('0x60')];_0x5bb384['message'][_0xb481('0x61')]=_0x163480[_0xb481('0x60')];_0x5bb384[_0xb481('0x17')]['event']='reject';respondWithRpcPromise(_0xb481('0x62'),'EventManager',{'event':_0xb481('0x63'),'message':_0x5bb384[_0xb481('0x17')]},client9002);return _0x163480;}return null;})[_0xb481('0xf')](respondWithResult(_0x23e9f8,null))[_0xb481('0x19')](handleError(_0x23e9f8,null));}; \ No newline at end of file +var _0xd01d=['then','destroy','end','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','length','include','find','create','body','params','describe','openchannel','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','interface','channel','motionChannel','event','reject','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','http','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','update'];(function(_0x86f1ff,_0x377276){var _0x3765b9=function(_0x493ba8){while(--_0x493ba8){_0x86f1ff['push'](_0x86f1ff['shift']());}};_0x3765b9(++_0x377276);}(_0xd01d,0xad));var _0xdd01=function(_0x2db0a1,_0x29f703){_0x2db0a1=_0x2db0a1-0x0;var _0x5e07d7=_0xd01d[_0x2db0a1];return _0x5e07d7;};'use strict';var util=require(_0xdd01('0x0'));var _=require(_0xdd01('0x1'));var Redis=require(_0xdd01('0x2'));var interactionService=require(_0xdd01('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xdd01('0x4'))(_0xdd01('0x5'));var config=require('../../config/environment');var db=require(_0xdd01('0x6'))['db'];config[_0xdd01('0x7')]=_[_0xdd01('0x8')](config['redis'],{'host':_0xdd01('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd01('0x7')]));require(_0xdd01('0xa'))[_0xdd01('0xb')](socket);var jayson=require(_0xdd01('0xc'));var client=jayson['client'][_0xdd01('0xd')]({'port':0x232c});var client9002=jayson[_0xdd01('0xe')][_0xdd01('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')('openchannel-interactions');function respondWithRpcPromise(_0x210dd3,_0x57cd1f,_0x540db8,_0x483f22){return new Promise(function(_0x593293,_0x19b073){var _0x551470=_0x483f22||client;return _0x551470[_0xdd01('0xf')](_0x210dd3,_0x540db8)['then'](function(_0x1ca711){logger[_0xdd01('0x10')](_0xdd01('0x11'),_0x57cd1f,_0xdd01('0x12'));logger[_0xdd01('0x13')](_0xdd01('0x14'),_0x57cd1f,_0xdd01('0x12'),JSON[_0xdd01('0x15')](_0x1ca711));if(_0x1ca711[_0xdd01('0x16')]){if(_0x1ca711['error'][_0xdd01('0x17')]===0x1f4){logger[_0xdd01('0x16')](_0xdd01('0x11'),_0x57cd1f,_0x1ca711[_0xdd01('0x16')][_0xdd01('0x18')]);return _0x19b073(_0x1ca711[_0xdd01('0x16')][_0xdd01('0x18')]);}logger[_0xdd01('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x57cd1f,_0x1ca711['error'][_0xdd01('0x18')]);return _0x593293(_0x1ca711[_0xdd01('0x16')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x57cd1f,_0xdd01('0x12'));_0x593293(_0x1ca711[_0xdd01('0x19')]['message']);}})[_0xdd01('0x1a')](function(_0x5cb024){logger[_0xdd01('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x57cd1f,_0x5cb024);_0x19b073(_0x5cb024);});});}function respondWithResult(_0x47512b,_0xc631df){_0xc631df=_0xc631df||0xc8;return function(_0x32da9e){if(_0x32da9e){return _0x47512b[_0xdd01('0x1b')](_0xc631df)[_0xdd01('0x1c')](_0x32da9e);}};}function respondWithFilteredResult(_0xfc4150,_0x243799){return function(_0x5603b4){if(_0x5603b4){var _0x38b626=typeof _0x243799[_0xdd01('0x1d')]===_0xdd01('0x1e')&&typeof _0x243799[_0xdd01('0x1f')]===_0xdd01('0x1e');var _0x1e53b0=_0x5603b4[_0xdd01('0x20')];var _0x10c49e=_0x38b626?0x0:_0x243799[_0xdd01('0x1d')];var _0x4d4fe7=_0x38b626?_0x5603b4[_0xdd01('0x20')]:_0x243799[_0xdd01('0x1d')]+_0x243799['limit'];var _0x591c93;if(_0x4d4fe7>=_0x1e53b0){_0x4d4fe7=_0x1e53b0;_0x591c93=0xc8;}else{_0x591c93=0xce;}_0xfc4150[_0xdd01('0x1b')](_0x591c93);return _0xfc4150[_0xdd01('0x21')]('Content-Range',_0x10c49e+'-'+_0x4d4fe7+'/'+_0x1e53b0)['json'](_0x5603b4);}return null;};}function saveUpdates(_0x33f43d){return function(_0x2cc795){if(_0x2cc795){return _0x2cc795[_0xdd01('0x22')](_0x33f43d)[_0xdd01('0x23')](function(_0x5b853e){return _0x5b853e;});}return null;};}function removeEntity(_0x17d71b){return function(_0x3598d8){if(_0x3598d8){return _0x3598d8[_0xdd01('0x24')]()[_0xdd01('0x23')](function(){_0x17d71b[_0xdd01('0x1b')](0xcc)[_0xdd01('0x25')]();});}};}function handleEntityNotFound(_0x472d75){return function(_0xce6d85){if(!_0xce6d85){_0x472d75[_0xdd01('0x26')](0x194);}return _0xce6d85;};}function handleError(_0x46f050,_0x4deddd){_0x4deddd=_0x4deddd||0x1f4;return function(_0x2c099f){logger['error'](_0x2c099f[_0xdd01('0x27')]);if(_0x2c099f[_0xdd01('0x28')]){delete _0x2c099f[_0xdd01('0x28')];}_0x46f050[_0xdd01('0x1b')](_0x4deddd)[_0xdd01('0x29')](_0x2c099f);};}exports[_0xdd01('0x2a')]=function(_0x155ab5,_0x38f0c8){var _0x593eb4={},_0x1132e5={},_0x5067d6={'count':0x0,'rows':[]};var _0x1abc14=_[_0xdd01('0x2b')](db[_0xdd01('0x2c')][_0xdd01('0x2d')],function(_0x31cd6a){return{'name':_0x31cd6a[_0xdd01('0x2e')],'type':_0x31cd6a[_0xdd01('0x2f')]['key']};});_0x1132e5[_0xdd01('0x30')]=_[_0xdd01('0x2b')](_0x1abc14,'name');_0x1132e5['query']=_['keys'](_0x155ab5[_0xdd01('0x31')]);_0x1132e5['filters']=_[_0xdd01('0x32')](_0x1132e5['model'],_0x1132e5[_0xdd01('0x31')]);_0x593eb4[_0xdd01('0x33')]=_[_0xdd01('0x32')](_0x1132e5[_0xdd01('0x30')],qs['fields'](_0x155ab5[_0xdd01('0x31')][_0xdd01('0x34')]));_0x593eb4[_0xdd01('0x33')]=_0x593eb4['attributes']['length']?_0x593eb4['attributes']:_0x1132e5[_0xdd01('0x30')];if(!_0x155ab5['query']['hasOwnProperty'](_0xdd01('0x35'))){_0x593eb4[_0xdd01('0x1f')]=qs['limit'](_0x155ab5[_0xdd01('0x31')][_0xdd01('0x1f')]);_0x593eb4[_0xdd01('0x1d')]=qs['offset'](_0x155ab5[_0xdd01('0x31')]['offset']);}_0x593eb4[_0xdd01('0x36')]=qs[_0xdd01('0x37')](_0x155ab5['query'][_0xdd01('0x37')]);_0x593eb4[_0xdd01('0x38')]=qs[_0xdd01('0x39')](_[_0xdd01('0x3a')](_0x155ab5[_0xdd01('0x31')],_0x1132e5[_0xdd01('0x39')]),_0x1abc14);if(_0x155ab5[_0xdd01('0x31')][_0xdd01('0x3b')]){_0x593eb4[_0xdd01('0x38')]=_[_0xdd01('0x3c')](_0x593eb4[_0xdd01('0x38')],{'$or':_[_0xdd01('0x2b')](_0x1abc14,function(_0x881e9f){if(_0x881e9f[_0xdd01('0x2f')]!==_0xdd01('0x3d')){var _0x205381={};_0x205381[_0x881e9f[_0xdd01('0x28')]]={'$like':'%'+_0x155ab5['query'][_0xdd01('0x3b')]+'%'};return _0x205381;}})});}_0x593eb4=_[_0xdd01('0x3c')]({},_0x593eb4,_0x155ab5[_0xdd01('0x3e')]);var _0x45f2e7={'where':_0x593eb4[_0xdd01('0x38')]};return db[_0xdd01('0x2c')]['count'](_0x45f2e7)[_0xdd01('0x23')](function(_0x16b5d7){_0x5067d6[_0xdd01('0x20')]=_0x16b5d7;if(_0x155ab5[_0xdd01('0x31')][_0xdd01('0x3f')]){_0x593eb4['include']=[{'all':!![]}];}return db[_0xdd01('0x2c')][_0xdd01('0x40')](_0x593eb4);})[_0xdd01('0x23')](function(_0x408672){_0x5067d6[_0xdd01('0x41')]=_0x408672;return _0x5067d6;})[_0xdd01('0x23')](respondWithFilteredResult(_0x38f0c8,_0x593eb4))[_0xdd01('0x1a')](handleError(_0x38f0c8,null));};exports[_0xdd01('0x42')]=function(_0xabe93d,_0x146152){var _0x3c630c={'raw':!![],'where':{'id':_0xabe93d['params']['id']}},_0x411eb1={};_0x411eb1[_0xdd01('0x30')]=_[_0xdd01('0x43')](db[_0xdd01('0x2c')][_0xdd01('0x2d')]);_0x411eb1[_0xdd01('0x31')]=_[_0xdd01('0x43')](_0xabe93d[_0xdd01('0x31')]);_0x411eb1[_0xdd01('0x39')]=_[_0xdd01('0x32')](_0x411eb1[_0xdd01('0x30')],_0x411eb1[_0xdd01('0x31')]);_0x3c630c[_0xdd01('0x33')]=_['intersection'](_0x411eb1[_0xdd01('0x30')],qs[_0xdd01('0x34')](_0xabe93d[_0xdd01('0x31')]['fields']));_0x3c630c[_0xdd01('0x33')]=_0x3c630c['attributes'][_0xdd01('0x44')]?_0x3c630c[_0xdd01('0x33')]:_0x411eb1[_0xdd01('0x30')];if(_0xabe93d[_0xdd01('0x31')][_0xdd01('0x3f')]){_0x3c630c[_0xdd01('0x45')]=[{'all':!![]}];}_0x3c630c=_['merge']({},_0x3c630c,_0xabe93d[_0xdd01('0x3e')]);return db['OpenchannelMessage'][_0xdd01('0x46')](_0x3c630c)['then'](handleEntityNotFound(_0x146152,null))[_0xdd01('0x23')](respondWithResult(_0x146152,null))[_0xdd01('0x1a')](handleError(_0x146152,null));};exports[_0xdd01('0x47')]=function(_0x31b731,_0x4a8b32){return db[_0xdd01('0x2c')][_0xdd01('0x47')](_0x31b731['body'],{})['then'](respondWithResult(_0x4a8b32,0xc9))[_0xdd01('0x1a')](handleError(_0x4a8b32,null));};exports['update']=function(_0x4fca49,_0x2b7b64){if(_0x4fca49['body']['id']){delete _0x4fca49[_0xdd01('0x48')]['id'];}return db[_0xdd01('0x2c')][_0xdd01('0x46')]({'where':{'id':_0x4fca49[_0xdd01('0x49')]['id']}})[_0xdd01('0x23')](handleEntityNotFound(_0x2b7b64,null))['then'](saveUpdates(_0x4fca49[_0xdd01('0x48')],null))[_0xdd01('0x23')](respondWithResult(_0x2b7b64,null))[_0xdd01('0x1a')](handleError(_0x2b7b64,null));};exports[_0xdd01('0x24')]=function(_0x547a22,_0x18e024){return db[_0xdd01('0x2c')][_0xdd01('0x46')]({'where':{'id':_0x547a22['params']['id']}})[_0xdd01('0x23')](handleEntityNotFound(_0x18e024,null))['then'](removeEntity(_0x18e024,null))['catch'](handleError(_0x18e024,null));};exports[_0xdd01('0x4a')]=function(_0xb26083,_0x8dfbd6){return db[_0xdd01('0x2c')][_0xdd01('0x4a')]()[_0xdd01('0x23')](respondWithResult(_0x8dfbd6,null))['catch'](handleError(_0x8dfbd6,null));};exports['accept']=function(_0x1f4ee6,_0xac2400){var _0x3439e3=_0xdd01('0x4b');return interactionService['acceptMessage'](_0x1f4ee6,_0x3439e3)[_0xdd01('0x23')](respondWithResult(_0xac2400,null))['catch'](handleError(_0xac2400,null));};exports['reject']=function(_0x3e0748,_0x54475a){var _0x11481={'agent':{},'channel':_0xdd01('0x4b')};if(_0x3e0748[_0xdd01('0x48')]['id']){delete _0x3e0748[_0xdd01('0x48')]['id'];}_0x3e0748[_0xdd01('0x48')][_0xdd01('0x4c')]=_0x3e0748[_0xdd01('0x48')][_0xdd01('0x4c')]||_0x3e0748[_0xdd01('0x4d')]['id'];_0x11481[_0xdd01('0x4e')]['id']=_0x3e0748[_0xdd01('0x48')][_0xdd01('0x4c')];return db['OpenchannelMessage'][_0xdd01('0x46')]({'where':{'id':_0x3e0748[_0xdd01('0x49')]['id'],'UserId':null}})[_0xdd01('0x23')](handleEntityNotFound(_0x54475a,null))[_0xdd01('0x23')](function(_0x499593){if(_0x499593){_0x11481[_0xdd01('0x18')]=_0x499593[_0xdd01('0x4f')]({'plain':!![]});return db[_0xdd01('0x50')][_0xdd01('0x46')]({'where':{'id':_0x499593[_0xdd01('0x51')]}});}return null;})[_0xdd01('0x23')](handleEntityNotFound(_0x54475a,null))['then'](function(_0x1b9e72){if(_0x1b9e72){_0x11481[_0xdd01('0x52')]=_0x1b9e72['get']({'plain':!![]});interaction_log[_0xdd01('0x10')](_0xdd01('0x53'),_0x3e0748[_0xdd01('0x4d')]['id'],_0x3e0748[_0xdd01('0x4d')][_0xdd01('0x28')],_0x3e0748['user'][_0xdd01('0x54')],_0x11481[_0xdd01('0x52')]['id'],_0x3e0748['body']?JSON[_0xdd01('0x15')](_0x3e0748['body']):_0xdd01('0x55'));return respondWithRpcPromise(_0xdd01('0x56'),_0xdd01('0x57'),_0x11481);}return null;})[_0xdd01('0x23')](function(_0x1e41e7){var _0x300548=_0xdd01('0x58')+_0x1e41e7[_0xdd01('0x18')][_0xdd01('0x59')];return db[_0xdd01('0x5a')][_0xdd01('0x31')](_0x300548,{'type':db[_0xdd01('0x5b')][_0xdd01('0x5c')][_0xdd01('0x5d')],'raw':!![]})['then'](function(_0x3d2932){return _0x3d2932;});})[_0xdd01('0x23')](function(_0x258484){if(_0x258484){_0x11481[_0xdd01('0x18')][_0xdd01('0x5e')]=_0x258484[0x0];if(!_0x3e0748[_0xdd01('0x48')]['UserId'])return;return db[_0xdd01('0x5f')][_0xdd01('0x46')]({'where':{'id':_0x3e0748[_0xdd01('0x48')]['UserId'],'role':_0xdd01('0x4e')},'attributes':['id','name','fullname',_0xdd01('0x60'),'internal'],'raw':!![]});}return null;})[_0xdd01('0x23')](function(_0x20c061){if(!_0x20c061)return null;_0x11481[_0xdd01('0x18')][_0xdd01('0x4e')]=_0x20c061;return _0x11481;})['then'](function(_0x6c9deb){if(_0x6c9deb){_0x6c9deb['message'][_0xdd01('0x61')]=util['format']('SIP/%s',_0x3e0748[_0xdd01('0x4d')]['name']);_0x6c9deb[_0xdd01('0x18')][_0xdd01('0x62')]=_0x11481[_0xdd01('0x62')];_0x6c9deb[_0xdd01('0x18')][_0xdd01('0x63')]=_0x11481['channel'];_0x6c9deb[_0xdd01('0x18')][_0xdd01('0x64')]=_0xdd01('0x65');respondWithRpcPromise('EventManager',_0xdd01('0x66'),{'event':_0xdd01('0x67'),'message':_0x6c9deb[_0xdd01('0x18')]},client9002);return _0x11481;}return null;})['then'](respondWithResult(_0x54475a,null))['catch'](handleError(_0x54475a,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 464068f..33cd9ec 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 _0xa3e7=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x8395d6,_0x4517e1){var _0x36c36a=function(_0x2ef1e4){while(--_0x2ef1e4){_0x8395d6['push'](_0x8395d6['shift']());}};_0x36c36a(++_0x4517e1);}(_0xa3e7,0x1e4));var _0x7a3e=function(_0x379f38,_0x32be37){_0x379f38=_0x379f38-0x0;var _0x2656c7=_0xa3e7[_0x379f38];return _0x2656c7;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x7a3e('0x0'))['db'][_0x7a3e('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a3e('0x2'),'afterUpdate':_0x7a3e('0x3'),'afterDestroy':_0x7a3e('0x4')};function emitEvent(_0x1daff8){return function(_0x42abc7,_0x2d7e02,_0x1f5ca9){OpenchannelMessageEvents[_0x7a3e('0x5')](_0x1daff8+':'+_0x42abc7['id'],_0x42abc7);OpenchannelMessageEvents['emit'](_0x1daff8,_0x42abc7);_0x1f5ca9(null);};}for(var e in events){if(events[_0x7a3e('0x6')](e)){var event=events[e];OpenchannelMessage[_0x7a3e('0x7')](e,emitEvent(event));}}module[_0x7a3e('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6555=['OpenchannelMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2fdaa5,_0xa64065){var _0x588d7a=function(_0x34985d){while(--_0x34985d){_0x2fdaa5['push'](_0x2fdaa5['shift']());}};_0x588d7a(++_0xa64065);}(_0x6555,0x1b7));var _0x5655=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6555[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x5655('0x0'));var OpenchannelMessage=require(_0x5655('0x1'))['db'][_0x5655('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5655('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5655('0x4')};function emitEvent(_0x59f013){return function(_0x1cda70,_0x311282,_0x56506a){OpenchannelMessageEvents['emit'](_0x59f013+':'+_0x1cda70['id'],_0x1cda70);OpenchannelMessageEvents[_0x5655('0x5')](_0x59f013,_0x1cda70);_0x56506a(null);};}for(var e in events){if(events[_0x5655('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5655('0x7')](e,emitEvent(event));}}module[_0x5655('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c253580..07d2c6b 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 _0x6054=['models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','threadId','inspect','finally','utf8mb4','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6054,0x90));var _0x4605=function(_0x31ae8c,_0x15dd90){_0x31ae8c=_0x31ae8c-0x0;var _0x30e30b=_0x6054[_0x31ae8c];return _0x30e30b;};'use strict';var _=require('lodash');var util=require(_0x4605('0x0'));var logger=require('../../config/logger')(_0x4605('0x1'));var moment=require(_0x4605('0x2'));var BPromise=require(_0x4605('0x3'));var rp=require(_0x4605('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4605('0x5'));var config=require(_0x4605('0x6'));var attributes=require(_0x4605('0x7'));module[_0x4605('0x8')]=function(_0x5a1eb2,_0x59d04a){return _0x5a1eb2[_0x4605('0x9')](_0x4605('0xa'),attributes,{'tableName':_0x4605('0xb'),'paranoid':![],'indexes':[{'name':_0x4605('0xc'),'fields':[_0x4605('0xd')],'type':_0x4605('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32d511,_0x3e1f0b,_0xf103c7){var _0x32b52f=_0x5a1eb2[_0x4605('0xf')];var _0x5abe1c=_0x32d511[_0x4605('0x10')]({'plain':!![]});if(_0x5abe1c[_0x4605('0x11')][_0x4605('0x12')]()==='in'||_0x5abe1c[_0x4605('0x11')][_0x4605('0x12')]()==='out'&&!_0x5abe1c[_0x4605('0x13')]&&!_[_0x4605('0x14')](_0x5abe1c[_0x4605('0x15')])){_0x32b52f[_0x4605('0x16')][_0x4605('0x17')]({'where':{'id':_0x5abe1c['OpenchannelInteractionId']}})[_0x4605('0x18')](function(_0x4009fb){if(_0x4009fb){_0x4009fb[_0x4605('0x19')]({'lastMsgAt':_0x5abe1c[_0x4605('0x1a')],'lastMsgDirection':_0x5abe1c[_0x4605('0x11')][_0x4605('0x12')]()});}})[_0x4605('0x1b')](function(_0xaf7b56){console[_0x4605('0x1c')](_0xaf7b56);});}if(_0x5abe1c[_0x4605('0x11')]==='out'&&!_0x5abe1c[_0x4605('0x13')]){var _0x569ecb;_0x32b52f['CmContact'][_0x4605('0x1d')]()[_0x4605('0x18')](function(_0x8a9bb8){return _0x32b52f[_0x4605('0x1e')][_0x4605('0x1f')]({'where':{'id':_0x5abe1c[_0x4605('0x20')]},'include':[{'model':_0x32b52f[_0x4605('0x16')],'as':_0x4605('0x21'),'where':{'id':_0x5abe1c[_0x4605('0x22')]},'limit':0x1,'include':[{'model':_0x32b52f[_0x4605('0x23')],'as':_0x4605('0x24'),'attributes':_[_0x4605('0x25')](_0x8a9bb8)}]}]});})[_0x4605('0x18')](function(_0x4eeeb9){_0x569ecb=_0x4eeeb9[_0x4605('0x10')]({'plain':!![]});if(_0x569ecb&&_0x569ecb[_0x4605('0x26')]){logger[_0x4605('0x27')](_0x4605('0x28'),_0x4605('0x29'),util['format'](_0x4605('0x2a'),_0x5abe1c['id'],_0x569ecb[_0x4605('0x26')]));if(_0x569ecb[_0x4605('0x21')]&&_0x569ecb[_0x4605('0x21')][_0x4605('0x2b')]){_0x5abe1c[_0x4605('0x2c')]=_[_0x4605('0x2d')](_0x569ecb[_0x4605('0x21')][0x0],_0x4605('0x24'));_0x5abe1c[_0x4605('0x24')]=_0x569ecb['Interactions'][0x0][_0x4605('0x24')];}var _0x3e1f0b={'method':_0x4605('0x2e'),'uri':encodeURI(_0x569ecb[_0x4605('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3e1f0b[_0x4605('0x2f')]){case _0x4605('0x30'):_0x3e1f0b['qs']=_0x5abe1c;break;case _0x4605('0x2e'):_0x3e1f0b[_0x4605('0xd')]=_0x5abe1c;break;}return rp(_0x3e1f0b)[_0x4605('0x18')](function(_0x417264){logger[_0x4605('0x27')](_0x4605('0x28'),_0x4605('0x29'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x5abe1c['id'],_0x569ecb[_0x4605('0x26')]));if(_0x417264[_0x4605('0xd')]['threadId']&&_0x417264[_0x4605('0xd')][_0x4605('0x31')]!=_0x5abe1c[_0x4605('0x2c')]['threadId']){return _0x32b52f[_0x4605('0x16')][_0x4605('0x19')]({'threadId':_0x417264[_0x4605('0xd')][_0x4605('0x31')]},{'where':{'id':_0x5abe1c[_0x4605('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x32d511[_0x4605('0x19')]({'read':!![]});})[_0x4605('0x1b')](function(_0x5c603a){logger[_0x4605('0x1c')](_0x4605('0x28'),_0x4605('0x29'),util[_0x4605('0x32')](_0x5c603a,{'showHidden':![],'depth':null}));_0xf103c7();});}else{_0xf103c7();}})[_0x4605('0x33')](function(){_0xf103c7();});}else{_0xf103c7();}}},'charset':_0x4605('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x41be=['openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','afterCreate','format','Interaction','omit','POST','GET','OpenchannelMessage,\x20%s,\x20%s','threadId','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage'];(function(_0x2e21e7,_0x5def61){var _0x3bb3d7=function(_0x31b346){while(--_0x31b346){_0x2e21e7['push'](_0x2e21e7['shift']());}};_0x3bb3d7(++_0x5def61);}(_0x41be,0xe3));var _0xe41b=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x41be[_0x999b85];return _0x1d7124;};'use strict';var _=require(_0xe41b('0x0'));var util=require(_0xe41b('0x1'));var logger=require(_0xe41b('0x2'))(_0xe41b('0x3'));var moment=require('moment');var BPromise=require(_0xe41b('0x4'));var rp=require(_0xe41b('0x5'));var fs=require('fs');var path=require(_0xe41b('0x6'));var rimraf=require(_0xe41b('0x7'));var config=require(_0xe41b('0x8'));var attributes=require(_0xe41b('0x9'));module[_0xe41b('0xa')]=function(_0x3174e5,_0x20b462){return _0x3174e5[_0xe41b('0xb')](_0xe41b('0xc'),attributes,{'tableName':_0xe41b('0xd'),'paranoid':![],'indexes':[{'name':_0xe41b('0xe'),'fields':[_0xe41b('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dd4a8,_0x4a91e6,_0x1ec9ff){var _0x18094d=_0x3174e5[_0xe41b('0x10')];var _0x503277=_0x2dd4a8[_0xe41b('0x11')]({'plain':!![]});if(_0x503277[_0xe41b('0x12')]['toLowerCase']()==='in'||_0x503277[_0xe41b('0x12')][_0xe41b('0x13')]()===_0xe41b('0x14')&&!_0x503277[_0xe41b('0x15')]&&!_[_0xe41b('0x16')](_0x503277['UserId'])){_0x18094d[_0xe41b('0x17')]['findOne']({'where':{'id':_0x503277[_0xe41b('0x18')]}})[_0xe41b('0x19')](function(_0x4b0c7c){if(_0x4b0c7c){_0x4b0c7c[_0xe41b('0x1a')]({'lastMsgAt':_0x503277[_0xe41b('0x1b')],'lastMsgDirection':_0x503277[_0xe41b('0x12')][_0xe41b('0x13')]()});}})[_0xe41b('0x1c')](function(_0x1bebf4){console[_0xe41b('0x1d')](_0x1bebf4);});}if(_0x503277[_0xe41b('0x12')]==='out'&&!_0x503277[_0xe41b('0x15')]){var _0x4d0c02;_0x18094d['CmContact'][_0xe41b('0x1e')]()[_0xe41b('0x19')](function(_0x2f5ea8){return _0x18094d[_0xe41b('0x1f')]['find']({'where':{'id':_0x503277[_0xe41b('0x20')]},'include':[{'model':_0x18094d[_0xe41b('0x17')],'as':_0xe41b('0x21'),'where':{'id':_0x503277[_0xe41b('0x18')]},'limit':0x1,'include':[{'model':_0x18094d['CmContact'],'as':_0xe41b('0x22'),'attributes':_[_0xe41b('0x23')](_0x2f5ea8)}]}]});})[_0xe41b('0x19')](function(_0x1e99f2){_0x4d0c02=_0x1e99f2[_0xe41b('0x11')]({'plain':!![]});if(_0x4d0c02&&_0x4d0c02[_0xe41b('0x24')]){logger[_0xe41b('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xe41b('0x26'),util[_0xe41b('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x503277['id'],_0x4d0c02['replyUri']));if(_0x4d0c02[_0xe41b('0x21')]&&_0x4d0c02[_0xe41b('0x21')]['length']){_0x503277[_0xe41b('0x28')]=_[_0xe41b('0x29')](_0x4d0c02['Interactions'][0x0],_0xe41b('0x22'));_0x503277['Contact']=_0x4d0c02[_0xe41b('0x21')][0x0]['Contact'];}var _0x4a91e6={'method':_0xe41b('0x2a'),'uri':encodeURI(_0x4d0c02['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4a91e6['method']){case _0xe41b('0x2b'):_0x4a91e6['qs']=_0x503277;break;case _0xe41b('0x2a'):_0x4a91e6[_0xe41b('0xf')]=_0x503277;break;}return rp(_0x4a91e6)[_0xe41b('0x19')](function(_0x28093e){logger[_0xe41b('0x25')](_0xe41b('0x2c'),_0xe41b('0x26'),util[_0xe41b('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x503277['id'],_0x4d0c02[_0xe41b('0x24')]));if(_0x28093e['body']['threadId']&&_0x28093e[_0xe41b('0xf')][_0xe41b('0x2d')]!=_0x503277[_0xe41b('0x28')]['threadId']){return _0x18094d[_0xe41b('0x17')][_0xe41b('0x1a')]({'threadId':_0x28093e[_0xe41b('0xf')][_0xe41b('0x2d')]},{'where':{'id':_0x503277[_0xe41b('0x28')]['id']}});}else{return;}})[_0xe41b('0x19')](function(){return _0x2dd4a8[_0xe41b('0x1a')]({'read':!![]});})[_0xe41b('0x1c')](function(_0x1476a4){logger[_0xe41b('0x1d')](_0xe41b('0x2c'),_0xe41b('0x26'),util['inspect'](_0x1476a4,{'showHidden':![],'depth':null}));_0x1ec9ff();});}else{_0x1ec9ff();}})[_0xe41b('0x2e')](function(){_0x1ec9ff();});}else{_0x1ec9ff();}}},'charset':_0xe41b('0x2f'),'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 39d4c4b..1fc2953 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(_0x2ec06f,_0x3bb56d){var _0x3a1c71=function(_0x5ca631){while(--_0x5ca631){_0x2ec06f['push'](_0x2ec06f['shift']());}};_0x3a1c71(++_0x3bb56d);}(_0xdb28,0x106));var _0x8db2=function(_0x3df8be,_0xda4695){_0x3df8be=_0x3df8be-0x0;var _0x408eb3=_0xdb28[_0x3df8be];return _0x408eb3;};'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(_0x836a5,_0x1a520f){var _0x6d25d4=function(_0x40359b){while(--_0x40359b){_0x836a5['push'](_0x836a5['shift']());}};_0x6d25d4(++_0x1a520f);}(_0x1261,0x144));var _0x1126=function(_0x332005,_0x24edf1){_0x332005=_0x332005-0x0;var _0x4393e1=_0x1261[_0x332005];return _0x4393e1;};'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 da0744e..d3f5d5e 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 _0x0ab2=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','removeListener','register'];(function(_0x723ad0,_0x6957a8){var _0x2c5784=function(_0x498283){while(--_0x498283){_0x723ad0['push'](_0x723ad0['shift']());}};_0x2c5784(++_0x6957a8);}(_0x0ab2,0x9a));var _0x20ab=function(_0xaf0090,_0x20c43f){_0xaf0090=_0xaf0090-0x0;var _0x572d06=_0x0ab2[_0xaf0090];return _0x572d06;};'use strict';var OpenchannelMessageEvents=require(_0x20ab('0x0'));var events=[_0x20ab('0x1'),_0x20ab('0x2'),_0x20ab('0x3')];function createListener(_0x217637,_0x1520c9){return function(_0x4cc8cc){_0x1520c9['emit'](_0x217637,_0x4cc8cc);};}function removeListener(_0x435fc9,_0x2c4d43){return function(){OpenchannelMessageEvents[_0x20ab('0x4')](_0x435fc9,_0x2c4d43);};}exports[_0x20ab('0x5')]=function(_0x35fdb5){for(var _0x362d27=0x0,_0x16d3fc=events[_0x20ab('0x6')];_0x362d27<_0x16d3fc;_0x362d27++){var _0x458cd9=events[_0x362d27];var _0x547349=createListener(_0x20ab('0x7')+_0x458cd9,_0x35fdb5);OpenchannelMessageEvents['on'](_0x458cd9,_0x547349);}}; \ No newline at end of file +var _0x9f83=['openchannelMessage:','./openchannelMessage.events','remove','update','emit','removeListener','length'];(function(_0x5085d5,_0x16401a){var _0x3be3df=function(_0x326323){while(--_0x326323){_0x5085d5['push'](_0x5085d5['shift']());}};_0x3be3df(++_0x16401a);}(_0x9f83,0x1ac));var _0x39f8=function(_0x1b4acb,_0xfa6e98){_0x1b4acb=_0x1b4acb-0x0;var _0x221c73=_0x9f83[_0x1b4acb];return _0x221c73;};'use strict';var OpenchannelMessageEvents=require(_0x39f8('0x0'));var events=['save',_0x39f8('0x1'),_0x39f8('0x2')];function createListener(_0x512085,_0x5cf0a1){return function(_0x606925){_0x5cf0a1[_0x39f8('0x3')](_0x512085,_0x606925);};}function removeListener(_0x380223,_0x2e80ca){return function(){OpenchannelMessageEvents[_0x39f8('0x4')](_0x380223,_0x2e80ca);};}exports['register']=function(_0x34072a){for(var _0x1202cf=0x0,_0x5832c1=events[_0x39f8('0x5')];_0x1202cf<_0x5832c1;_0x1202cf++){var _0x161f9f=events[_0x1202cf];var _0x2f2121=createListener(_0x39f8('0x6')+_0x161f9f,_0x34072a);OpenchannelMessageEvents['on'](_0x161f9f,_0x2f2121);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 1d1e5f2..4347165 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 _0x61ad=['express','Router','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x5bdc7,_0x52a30b){var _0x449a98=function(_0x34f4d0){while(--_0x34f4d0){_0x5bdc7['push'](_0x5bdc7['shift']());}};_0x449a98(++_0x52a30b);}(_0x61ad,0x184));var _0xd61a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61ad[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd61a('0x0'));var util=require(_0xd61a('0x1'));var path=require(_0xd61a('0x2'));var timeout=require(_0xd61a('0x3'));var express=require(_0xd61a('0x4'));var router=express[_0xd61a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd61a('0x6'));var controller=require(_0xd61a('0x7'));router[_0xd61a('0x8')]('/',auth[_0xd61a('0x9')](),controller['index']);router[_0xd61a('0x8')](_0xd61a('0xa'),auth[_0xd61a('0x9')](),controller[_0xd61a('0xb')]);router[_0xd61a('0x8')](_0xd61a('0xc'),auth[_0xd61a('0x9')](),controller[_0xd61a('0xd')]);router[_0xd61a('0x8')](_0xd61a('0xe'),auth[_0xd61a('0x9')](),controller[_0xd61a('0xf')]);router[_0xd61a('0x8')](_0xd61a('0x10'),auth[_0xd61a('0x9')](),controller[_0xd61a('0x11')]);router[_0xd61a('0x8')](_0xd61a('0x12'),auth[_0xd61a('0x9')](),controller['getAgents']);router[_0xd61a('0x13')]('/',auth[_0xd61a('0x9')](),controller[_0xd61a('0x14')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xd61a('0x15')]);router[_0xd61a('0x13')](_0xd61a('0x12'),auth['isAuthenticated'](),controller[_0xd61a('0x16')]);router[_0xd61a('0x17')](_0xd61a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd61a('0x18')]('/:id',auth[_0xd61a('0x9')](),controller[_0xd61a('0x19')]);router[_0xd61a('0x18')](_0xd61a('0x10'),auth[_0xd61a('0x9')](),controller['removeTeams']);router['delete'](_0xd61a('0x12'),auth[_0xd61a('0x9')](),controller[_0xd61a('0x1a')]);module[_0xd61a('0x1b')]=router; \ No newline at end of file +var _0x5a90=['/:id/users','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','put','update','delete','destroy'];(function(_0x2e7658,_0x45d478){var _0x1e58d4=function(_0x36ad97){while(--_0x36ad97){_0x2e7658['push'](_0x2e7658['shift']());}};_0x1e58d4(++_0x45d478);}(_0x5a90,0x110));var _0x05a9=function(_0x56ab5c,_0x26ed24){_0x56ab5c=_0x56ab5c-0x0;var _0x5ed603=_0x5a90[_0x56ab5c];return _0x5ed603;};'use strict';var multer=require(_0x05a9('0x0'));var util=require(_0x05a9('0x1'));var path=require(_0x05a9('0x2'));var timeout=require(_0x05a9('0x3'));var express=require(_0x05a9('0x4'));var router=express[_0x05a9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x05a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x05a9('0x7'));router['get']('/',auth[_0x05a9('0x8')](),controller[_0x05a9('0x9')]);router[_0x05a9('0xa')](_0x05a9('0xb'),auth[_0x05a9('0x8')](),controller['describe']);router[_0x05a9('0xa')](_0x05a9('0xc'),auth[_0x05a9('0x8')](),controller[_0x05a9('0xd')]);router[_0x05a9('0xa')](_0x05a9('0xe'),auth['isAuthenticated'](),controller[_0x05a9('0xf')]);router[_0x05a9('0xa')](_0x05a9('0x10'),auth['isAuthenticated'](),controller[_0x05a9('0x11')]);router[_0x05a9('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x05a9('0x12')]('/',auth[_0x05a9('0x8')](),controller[_0x05a9('0x13')]);router['post'](_0x05a9('0x10'),auth[_0x05a9('0x8')](),controller[_0x05a9('0x14')]);router['post']('/:id/users',auth[_0x05a9('0x8')](),controller['addAgents']);router[_0x05a9('0x15')](_0x05a9('0xc'),auth[_0x05a9('0x8')](),controller[_0x05a9('0x16')]);router[_0x05a9('0x17')](_0x05a9('0xc'),auth[_0x05a9('0x8')](),controller[_0x05a9('0x18')]);router[_0x05a9('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x05a9('0x17')](_0x05a9('0x19'),auth[_0x05a9('0x8')](),controller[_0x05a9('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 3c66f71..f7863e5 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 _0xf42d=['ENUM','beepall','sequelize','exports','STRING','name'];(function(_0x41fd45,_0x5baf60){var _0xb77779=function(_0x7842b2){while(--_0x7842b2){_0x41fd45['push'](_0x41fd45['shift']());}};_0xb77779(++_0x5baf60);}(_0xf42d,0x188));var _0xdf42=function(_0x2bb752,_0x39c066){_0x2bb752=_0x2bb752-0x0;var _0x3f0872=_0xf42d[_0x2bb752];return _0x3f0872;};'use strict';var Sequelize=require(_0xdf42('0x0'));module[_0xdf42('0x1')]={'name':{'type':Sequelize[_0xdf42('0x2')],'unique':_0xdf42('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdf42('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdf42('0x4')]('rrmemory',_0xdf42('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x2fc7=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x64c039,_0x450017){var _0x1cd9d9=function(_0x6a7d4){while(--_0x6a7d4){_0x64c039['push'](_0x64c039['shift']());}};_0x1cd9d9(++_0x450017);}(_0x2fc7,0x1ce));var _0x72fc=function(_0x47efc4,_0x50b14f){_0x47efc4=_0x47efc4-0x0;var _0x2797c7=_0x2fc7[_0x47efc4];return _0x2797c7;};'use strict';var Sequelize=require(_0x72fc('0x0'));module[_0x72fc('0x1')]={'name':{'type':Sequelize[_0x72fc('0x2')],'unique':_0x72fc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x72fc('0x2')]},'timeout':{'type':Sequelize[_0x72fc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x72fc('0x5')](_0x72fc('0x6'),'beepall',_0x72fc('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 949ffb6..ab7271a 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 _0x33fc=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','nolimit','order','sort','pick','OpenchannelQueueId','filter','options','findAndCountAll','UserId','openchannelPause','format','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','select','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','every','includes','all','compact','removeTeams','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','index','map','OpenchannelQueue','rawAttributes','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','UserProfileSection','autoAssociation'];(function(_0x940d80,_0x37300e){var _0xd72077=function(_0xbcd603){while(--_0xbcd603){_0x940d80['push'](_0x940d80['shift']());}};_0xd72077(++_0x37300e);}(_0x33fc,0xa2));var _0xc33f=function(_0x4da03b,_0x3d680d){_0x4da03b=_0x4da03b-0x0;var _0x25144d=_0x33fc[_0x4da03b];return _0x25144d;};'use strict';var BPromise=require(_0xc33f('0x0'));var util=require(_0xc33f('0x1'));var _=require(_0xc33f('0x2'));var squel=require(_0xc33f('0x3'));var Redis=require('ioredis');var qs=require(_0xc33f('0x4'));var logger=require('../../config/logger')(_0xc33f('0x5'));var config=require(_0xc33f('0x6'));var db=require(_0xc33f('0x7'))['db'];config['redis']=_['defaults'](config[_0xc33f('0x8')],{'host':_0xc33f('0x9'),'port':0x18eb});var socket=require(_0xc33f('0xa'))(new Redis(config['redis']));require(_0xc33f('0xb'))[_0xc33f('0xc')](socket);function respondWithStatusCode(_0x27ffae,_0x35f961){_0x35f961=_0x35f961||0xcc;return function(_0x17c27f){if(_0x17c27f){return _0x27ffae[_0xc33f('0xd')](_0x35f961);}return _0x27ffae[_0xc33f('0xe')](_0x35f961)[_0xc33f('0xf')]();};}function respondWithResult(_0x2eaff8,_0x308964){_0x308964=_0x308964||0xc8;return function(_0x236cec){if(_0x236cec){return _0x2eaff8[_0xc33f('0xe')](_0x308964)[_0xc33f('0x10')](_0x236cec);}};}function respondWithFilteredResult(_0x121034,_0x57a7dd){return function(_0x3fd954){if(_0x3fd954){var _0x16954a=typeof _0x57a7dd[_0xc33f('0x11')]===_0xc33f('0x12')&&typeof _0x57a7dd['limit']===_0xc33f('0x12');var _0x48e2f5=_0x3fd954[_0xc33f('0x13')];var _0x2f9a86=_0x16954a?0x0:_0x57a7dd['offset'];var _0x44e8f7=_0x16954a?_0x3fd954[_0xc33f('0x13')]:_0x57a7dd['offset']+_0x57a7dd[_0xc33f('0x14')];var _0x5255da;if(_0x44e8f7>=_0x48e2f5){_0x44e8f7=_0x48e2f5;_0x5255da=0xc8;}else{_0x5255da=0xce;}_0x121034['status'](_0x5255da);return _0x121034[_0xc33f('0x15')](_0xc33f('0x16'),_0x2f9a86+'-'+_0x44e8f7+'/'+_0x48e2f5)['json'](_0x3fd954);}return null;};}function saveUpdates(_0x1a5fa3){return function(_0x33bd61){if(_0x33bd61){return _0x33bd61[_0xc33f('0x17')](_0x1a5fa3)[_0xc33f('0x18')](function(_0x56bc9e){return _0x56bc9e;});}return null;};}function removeEntity(_0x3d2e9a){return function(_0x29ccac){if(_0x29ccac){return _0x29ccac[_0xc33f('0x19')]()['then'](function(){var _0x2f1620=_0x29ccac[_0xc33f('0x1a')]({'plain':!![]});var _0x5dec74=_0xc33f('0x1b');return db[_0xc33f('0x1c')][_0xc33f('0x19')]({'where':{'type':_0x5dec74,'resourceId':_0x2f1620['id']}})['then'](function(){return _0x29ccac;});})[_0xc33f('0x18')](function(){_0x3d2e9a[_0xc33f('0xe')](0xcc)[_0xc33f('0xf')]();});}};}function handleEntityNotFound(_0x47744c){return function(_0x536a92){if(!_0x536a92){_0x47744c['sendStatus'](0x194);}return _0x536a92;};}function handleError(_0x40ad7f,_0x52a05d){_0x52a05d=_0x52a05d||0x1f4;return function(_0x55ea38){logger[_0xc33f('0x1d')](_0x55ea38['stack']);if(_0x55ea38[_0xc33f('0x1e')]){delete _0x55ea38[_0xc33f('0x1e')];}_0x40ad7f[_0xc33f('0xe')](_0x52a05d)['send'](_0x55ea38);};}exports[_0xc33f('0x1f')]=function(_0x2279d8,_0x1c9d41){var _0x34ac9e={};var _0x1ae2f5={'count':0x0,'rows':[]};var _0x15579c=_[_0xc33f('0x20')](db[_0xc33f('0x21')][_0xc33f('0x22')],function(_0x45a9c0){return{'name':_0x45a9c0['fieldName'],'type':_0x45a9c0[_0xc33f('0x23')]['key']};});_0x34ac9e=qs[_0xc33f('0x24')](_0x15579c,_0x2279d8);var _0x142bf1={'where':_0x34ac9e[_0xc33f('0x25')]};return db['OpenchannelQueue'][_0xc33f('0x13')](_0x142bf1)[_0xc33f('0x18')](function(_0x5ca30d){_0x1ae2f5[_0xc33f('0x13')]=_0x5ca30d;_0x34ac9e[_0xc33f('0x26')]=qs[_0xc33f('0x26')](_0x2279d8[_0xc33f('0x27')]);return db[_0xc33f('0x21')][_0xc33f('0x28')](_0x34ac9e);})['then'](function(_0x451c46){_0x1ae2f5[_0xc33f('0x29')]=_0x451c46;return _0x1ae2f5;})[_0xc33f('0x18')](respondWithFilteredResult(_0x1c9d41,_0x34ac9e))[_0xc33f('0x2a')](handleError(_0x1c9d41,null));};exports[_0xc33f('0x2b')]=function(_0x114338,_0x21f6b3){var _0x299051={'raw':!![],'where':{'id':_0x114338[_0xc33f('0x2c')]['id']}},_0x3387c9={};_0x3387c9[_0xc33f('0x2d')]=_[_0xc33f('0x2e')](db['OpenchannelQueue'][_0xc33f('0x22')]);_0x3387c9[_0xc33f('0x27')]=_['keys'](_0x114338[_0xc33f('0x27')]);_0x3387c9[_0xc33f('0x2f')]=_[_0xc33f('0x30')](_0x3387c9[_0xc33f('0x2d')],_0x3387c9[_0xc33f('0x27')]);_0x299051[_0xc33f('0x31')]=_['intersection'](_0x3387c9[_0xc33f('0x2d')],qs[_0xc33f('0x32')](_0x114338[_0xc33f('0x27')]['fields']));_0x299051[_0xc33f('0x31')]=_0x299051[_0xc33f('0x31')][_0xc33f('0x33')]?_0x299051['attributes']:_0x3387c9[_0xc33f('0x2d')];if(_0x114338[_0xc33f('0x27')][_0xc33f('0x34')]){_0x299051['include']=[{'all':!![]}];}_0x299051=_[_0xc33f('0x35')]({},_0x299051,_0x114338['options']);return db[_0xc33f('0x21')][_0xc33f('0x36')](_0x299051)[_0xc33f('0x18')](handleEntityNotFound(_0x21f6b3,null))['then'](respondWithResult(_0x21f6b3,null))[_0xc33f('0x2a')](handleError(_0x21f6b3,null));};exports[_0xc33f('0x37')]=function(_0x27325c,_0x2938b2){return db[_0xc33f('0x21')][_0xc33f('0x37')](_0x27325c[_0xc33f('0x38')],{})[_0xc33f('0x18')](function(_0x2cfe7d){var _0x1a8a27=_0x27325c[_0xc33f('0x39')][_0xc33f('0x1a')]({'plain':!![]});if(!_0x1a8a27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a8a27['role']===_0xc33f('0x39')){var _0x1fc513=_0x2cfe7d[_0xc33f('0x1a')]({'plain':!![]});var _0x53e5a5=_0xc33f('0x1b');return db[_0xc33f('0x3a')][_0xc33f('0x36')]({'where':{'name':_0x53e5a5,'userProfileId':_0x1a8a27['userProfileId']},'raw':!![]})[_0xc33f('0x18')](function(_0x425db7){if(_0x425db7&&_0x425db7[_0xc33f('0x3b')]===0x0){return db[_0xc33f('0x1c')][_0xc33f('0x37')]({'name':_0x1fc513['name'],'resourceId':_0x1fc513['id'],'type':_0x425db7[_0xc33f('0x1e')],'sectionId':_0x425db7['id']},{})['then'](function(){return _0x2cfe7d;});}else{return _0x2cfe7d;}})['catch'](function(_0x376dda){logger['error'](_0xc33f('0x3c'),_0x376dda);throw _0x376dda;});}return _0x2cfe7d;})[_0xc33f('0x18')](respondWithResult(_0x2938b2,0xc9))[_0xc33f('0x2a')](handleError(_0x2938b2,null));};exports[_0xc33f('0x17')]=function(_0x340a5c,_0x368e1b){if(_0x340a5c[_0xc33f('0x38')]['id']){delete _0x340a5c[_0xc33f('0x38')]['id'];}return db['OpenchannelQueue'][_0xc33f('0x36')]({'where':{'id':_0x340a5c['params']['id']}})['then'](handleEntityNotFound(_0x368e1b,null))[_0xc33f('0x18')](saveUpdates(_0x340a5c[_0xc33f('0x38')],null))[_0xc33f('0x18')](respondWithResult(_0x368e1b,null))[_0xc33f('0x2a')](handleError(_0x368e1b,null));};exports[_0xc33f('0x19')]=function(_0xe29f80,_0x5eac48){return db[_0xc33f('0x21')][_0xc33f('0x36')]({'where':{'id':_0xe29f80['params']['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x5eac48,null))[_0xc33f('0x18')](removeEntity(_0x5eac48,null))[_0xc33f('0x2a')](handleError(_0x5eac48,null));};exports[_0xc33f('0x3d')]=function(_0x8edcde,_0x46ddf7){return db[_0xc33f('0x21')][_0xc33f('0x3d')]()[_0xc33f('0x18')](respondWithResult(_0x46ddf7,null))['catch'](handleError(_0x46ddf7,null));};exports['getMembers']=function(_0x58b5a1,_0x4d9b5d){var _0x2da153={'raw':!![],'where':{}},_0xab872e={},_0xc3f244;return db[_0xc33f('0x21')][_0xc33f('0x3e')]({'where':{'id':_0x58b5a1[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x4d9b5d,null))['then'](function(_0x2ac829){if(_0x2ac829){_0xc3f244=_0x2ac829['get']({'plain':!![]});_0xab872e[_0xc33f('0x2d')]=_[_0xc33f('0x2e')](db[_0xc33f('0x3f')]['rawAttributes']);_0xab872e[_0xc33f('0x27')]=_[_0xc33f('0x2e')](_0x58b5a1['query']);_0xab872e[_0xc33f('0x2f')]=_[_0xc33f('0x30')](_0xab872e['model'],_0xab872e[_0xc33f('0x27')]);_0x2da153[_0xc33f('0x31')]=_[_0xc33f('0x30')](_0xab872e[_0xc33f('0x2d')],qs['fields'](_0x58b5a1[_0xc33f('0x27')][_0xc33f('0x32')]));_0x2da153[_0xc33f('0x31')]=_0x2da153['attributes'][_0xc33f('0x33')]?_0x2da153[_0xc33f('0x31')]:_0xab872e[_0xc33f('0x2d')];if(!_0x58b5a1[_0xc33f('0x27')]['hasOwnProperty'](_0xc33f('0x40'))){_0x2da153[_0xc33f('0x14')]=qs[_0xc33f('0x14')](_0x58b5a1[_0xc33f('0x27')][_0xc33f('0x14')]);_0x2da153[_0xc33f('0x11')]=qs[_0xc33f('0x11')](_0x58b5a1[_0xc33f('0x27')]['offset']);}_0x2da153[_0xc33f('0x41')]=qs[_0xc33f('0x42')](_0x58b5a1[_0xc33f('0x27')]['sort']);_0x2da153['where']=qs[_0xc33f('0x2f')](_[_0xc33f('0x43')](_0x58b5a1[_0xc33f('0x27')],_0xab872e[_0xc33f('0x2f')]));_0x2da153[_0xc33f('0x25')][_0xc33f('0x44')]=_0x2ac829['id'];if(_0x58b5a1[_0xc33f('0x27')][_0xc33f('0x45')]){_0x2da153[_0xc33f('0x25')]=_[_0xc33f('0x35')](_0x2da153[_0xc33f('0x25')],{'$or':_[_0xc33f('0x20')](_0x2da153[_0xc33f('0x31')],function(_0x8a1d7a){var _0x3eb1a9={};_0x3eb1a9[_0x8a1d7a]={'$like':'%'+_0x58b5a1['query'][_0xc33f('0x45')]+'%'};return _0x3eb1a9;})});}_0x2da153=_[_0xc33f('0x35')]({},_0x2da153,_0x58b5a1[_0xc33f('0x46')]);return db['UserOpenchannelQueue']['findAll'](_0x2da153);}})[_0xc33f('0x18')](function(_0x24ab7b){if(_0x24ab7b){return db['User'][_0xc33f('0x47')]({'where':{'id':_[_0xc33f('0x20')](_0x24ab7b,_0xc33f('0x48')),'role':'agent'},'attributes':['id',_0xc33f('0x1e'),_0xc33f('0x49'),'updatedAt','createdAt']});}})[_0xc33f('0x18')](function(_0x12f64b){if(_0x12f64b){return{'count':_0x12f64b[_0xc33f('0x13')],'rows':_[_0xc33f('0x20')](_0x12f64b[_0xc33f('0x29')],function(_0x3ab007){return{'membername':_0x3ab007['name'],'UserId':_0x3ab007['id'],'queue_name':_0xc3f244[_0xc33f('0x1e')],'OpenchannelQueueId':_0xc3f244['id'],'interface':util[_0xc33f('0x4a')]('%s/%s',_0xc33f('0x4b'),_0x3ab007[_0xc33f('0x1e')]),'penalty':0x0,'paused':_0x3ab007[_0xc33f('0x49')],'createdAt':_0x3ab007[_0xc33f('0x4c')],'updatedAt':_0x3ab007['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d9b5d,_0x2da153))[_0xc33f('0x2a')](handleError(_0x4d9b5d,null));};exports[_0xc33f('0x4d')]=function(_0x591bfa,_0x95fbc8){var _0x2809c2={};var _0x2e53e0={};var _0x10f61d;var _0x48a57d;return db[_0xc33f('0x21')][_0xc33f('0x3e')]({'where':{'id':_0x591bfa[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x95fbc8,null))[_0xc33f('0x18')](function(_0x5c77cf){if(_0x5c77cf){_0x10f61d=_0x5c77cf;_0x2e53e0[_0xc33f('0x2d')]=_[_0xc33f('0x2e')](db[_0xc33f('0x4e')][_0xc33f('0x22')]);_0x2e53e0[_0xc33f('0x27')]=_[_0xc33f('0x2e')](_0x591bfa[_0xc33f('0x27')]);_0x2e53e0[_0xc33f('0x2f')]=_['intersection'](_0x2e53e0[_0xc33f('0x2d')],_0x2e53e0['query']);_0x2809c2[_0xc33f('0x31')]=_[_0xc33f('0x30')](_0x2e53e0['model'],qs[_0xc33f('0x32')](_0x591bfa['query']['fields']));_0x2809c2['attributes']=_0x2809c2['attributes'][_0xc33f('0x33')]?_0x2809c2[_0xc33f('0x31')]:_0x2e53e0[_0xc33f('0x2d')];_0x2809c2[_0xc33f('0x41')]=qs[_0xc33f('0x42')](_0x591bfa['query'][_0xc33f('0x42')]);_0x2809c2[_0xc33f('0x25')]=qs[_0xc33f('0x2f')](_[_0xc33f('0x43')](_0x591bfa[_0xc33f('0x27')],_0x2e53e0[_0xc33f('0x2f')]));if(_0x591bfa['query'][_0xc33f('0x45')]){_0x2809c2[_0xc33f('0x25')]=_[_0xc33f('0x35')](_0x2809c2[_0xc33f('0x25')],{'$or':_[_0xc33f('0x20')](_0x2809c2[_0xc33f('0x31')],function(_0x262ce6){var _0x44d273={};_0x44d273[_0x262ce6]={'$like':'%'+_0x591bfa[_0xc33f('0x27')][_0xc33f('0x45')]+'%'};return _0x44d273;})});}_0x2809c2=_[_0xc33f('0x35')]({},_0x2809c2,_0x591bfa[_0xc33f('0x46')]);return _0x10f61d[_0xc33f('0x4d')](_0x2809c2);}})['then'](function(_0x4fe0e4){if(_0x4fe0e4){_0x48a57d=_0x4fe0e4['length'];if(!_0x591bfa[_0xc33f('0x27')]['hasOwnProperty']('nolimit')){_0x2809c2[_0xc33f('0x14')]=qs[_0xc33f('0x14')](_0x591bfa[_0xc33f('0x27')][_0xc33f('0x14')]);_0x2809c2['offset']=qs['offset'](_0x591bfa[_0xc33f('0x27')][_0xc33f('0x11')]);}return _0x10f61d[_0xc33f('0x4d')](_0x2809c2);}})[_0xc33f('0x18')](function(_0x219ac9){if(_0x219ac9){return _0x219ac9?{'count':_0x48a57d,'rows':_0x219ac9}:null;}})['then'](respondWithResult(_0x95fbc8,null))[_0xc33f('0x2a')](handleError(_0x95fbc8,null));};exports[_0xc33f('0x4f')]=function(_0x328fec,_0x1ee9d2){var _0xdcda9c=_0x328fec[_0xc33f('0x38')][_0xc33f('0x50')];return db['Team']['findAll']({'where':{'id':_0xdcda9c},'attributes':['id'],'include':[{'model':db[_0xc33f('0x51')],'as':_0xc33f('0x52'),'attributes':['id',_0xc33f('0x1e'),_0xc33f('0x53'),_0xc33f('0x54'),'interface'],'raw':!![]}]})[_0xc33f('0x18')](function(_0x40f131){if(_0x40f131){var _0x505e43=_[_0xc33f('0x55')](_0x40f131,function(_0x1567c6){var _0x43bd27=_0x1567c6[_0xc33f('0x1a')]({'plain':!![]});return _0x43bd27['Agents'];});return db[_0xc33f('0x21')][_0xc33f('0x36')]({'where':{'id':_0x328fec[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](function(_0x557952){return db[_0xc33f('0x56')][_0xc33f('0x57')](function(_0x211355){return _0x557952['addTeams'](_0xdcda9c,{'transaction':_0x211355})[_0xc33f('0x18')](function(){return BPromise[_0xc33f('0x58')](_0x505e43,function(_0x2dbc17){return db[_0xc33f('0x3f')]['findOrCreate']({'where':{'UserId':_0x2dbc17['id'],'OpenchannelQueueId':_0x328fec['params']['id']},'transaction':_0x211355});});})[_0xc33f('0x18')](function(){_0x505e43[_0xc33f('0x59')](function(_0x3d3665){socket[_0xc33f('0x5a')]('userOpenchannelQueue:save',{'UserId':_0x3d3665['id'],'OpenchannelQueueId':_0x557952['id']});});});});});}})['then'](respondWithStatusCode(_0x1ee9d2,null))[_0xc33f('0x2a')](handleError(_0x1ee9d2,null));};exports['removeTeams']=function(_0x24d7e9,_0x4f27a4){return db[_0xc33f('0x4e')]['findAll']({'where':{'id':_0x24d7e9['query'][_0xc33f('0x50')]},'attributes':['id'],'include':[{'model':db[_0xc33f('0x51')],'as':_0xc33f('0x52'),'attributes':['id'],'raw':!![]}]})[_0xc33f('0x18')](handleEntityNotFound(_0x4f27a4,null))[_0xc33f('0x18')](function(_0x364a7f){var _0x6f1bf6=_[_0xc33f('0x20')](_0x364a7f,'id');var _0x369dcc=[];var _0x4f8e32=[];var _0x4297c2=squel[_0xc33f('0x5b')]();_0x4297c2['field']('tq.TeamId')['from'](_0xc33f('0x5c'),'tq')[_0xc33f('0x5d')]('user_has_teams','ut',_0xc33f('0x5e'))[_0xc33f('0x25')]('OpenchannelQueueId\x20=\x20?',_0x24d7e9[_0xc33f('0x2c')]['id']);for(var _0x3f8b48=0x0;_0x3f8b48<_0x364a7f[_0xc33f('0x33')];_0x3f8b48+=0x1){let _0x9ac47e=_0x364a7f[_0x3f8b48];for(var _0x111550=0x0;_0x111550<_0x9ac47e['Agents']['length'];_0x111550+=0x1){let _0x1e9b94=_0x9ac47e[_0xc33f('0x52')][_0x111550];var _0x5445b6=_0x4297c2[_0xc33f('0x5f')]();_0x5445b6[_0xc33f('0x25')]('ut.UserId\x20=\x20?',_0x1e9b94['id']);_0x4f8e32['push'](db[_0xc33f('0x56')][_0xc33f('0x27')](_0x5445b6['toString'](),{'type':db[_0xc33f('0x56')][_0xc33f('0x60')][_0xc33f('0x61')]})[_0xc33f('0x18')](function(_0x180bfd){if(_0x180bfd[_0xc33f('0x33')]===0x1){return _0x1e9b94['id'];}else{var _0x3870fa=_[_0xc33f('0x62')](_[_0xc33f('0x20')](_0x180bfd,'TeamId'),function(_0x83244){return _[_0xc33f('0x63')](_0x6f1bf6,_0x83244);});if(_0x3870fa){return _0x1e9b94['id'];}}}));}}return BPromise[_0xc33f('0x64')](_0x4f8e32)[_0xc33f('0x18')](function(_0x1f4b4d){_0x369dcc=_(_0x369dcc)['union'](_0x1f4b4d)[_0xc33f('0x65')]()['value']();return db['OpenchannelQueue'][_0xc33f('0x36')]({'where':{'id':_0x24d7e9[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](function(_0x5b3cb7){return db[_0xc33f('0x56')][_0xc33f('0x57')](function(_0x5e6d41){return _0x5b3cb7[_0xc33f('0x66')](_0x24d7e9[_0xc33f('0x27')][_0xc33f('0x50')],{'transaction':_0x5e6d41})[_0xc33f('0x18')](function(){if(!_['isEmpty'](_0x369dcc)){return _0x5b3cb7[_0xc33f('0x67')](_0x369dcc,{'transaction':_0x5e6d41});}})[_0xc33f('0x18')](function(){_0x369dcc[_0xc33f('0x59')](function(_0x3c1b24){socket[_0xc33f('0x5a')](_0xc33f('0x68'),{'UserId':_0x3c1b24,'OpenchannelQueueId':_0x5b3cb7['id']});});});});});});})[_0xc33f('0x18')](respondWithStatusCode(_0x4f27a4,null))['catch'](handleError(_0x4f27a4,null));};exports[_0xc33f('0x69')]=function(_0x29780c,_0x589cbe){return db[_0xc33f('0x21')][_0xc33f('0x36')]({'where':{'id':_0x29780c['params']['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x589cbe,null))[_0xc33f('0x18')](function(_0xc81ce2){if(_0xc81ce2){return _0xc81ce2['addAgents'](_0x29780c[_0xc33f('0x38')][_0xc33f('0x50')],_[_0xc33f('0x6a')](_0x29780c['body'],[_0xc33f('0x50'),'id'])||{})[_0xc33f('0x6b')](function(_0x5d360a){for(var _0x2127b4=0x0;_0x2127b4<_0x29780c['body'][_0xc33f('0x50')][_0xc33f('0x33')];_0x2127b4+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x29780c['body'][_0xc33f('0x50')][_0x2127b4]),'OpenchannelQueueId':Number(_0x29780c['params']['id'])});}return _0x5d360a;});}})[_0xc33f('0x18')](respondWithResult(_0x589cbe,null))[_0xc33f('0x2a')](handleError(_0x589cbe,null));};exports['removeAgents']=function(_0x4c2c69,_0x438b6b){return db[_0xc33f('0x21')][_0xc33f('0x36')]({'where':{'id':_0x4c2c69[_0xc33f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x438b6b,null))[_0xc33f('0x18')](function(_0x45c280){if(_0x45c280){return _0x45c280[_0xc33f('0x67')](_0x4c2c69['query'][_0xc33f('0x50')])[_0xc33f('0x18')](function(){if(_[_0xc33f('0x6c')](_0x4c2c69['query']['ids'])){for(var _0x44a766=0x0;_0x44a766<_0x4c2c69[_0xc33f('0x27')]['ids'][_0xc33f('0x33')];_0x44a766+=0x1){socket[_0xc33f('0x5a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4c2c69['query'][_0xc33f('0x50')][_0x44a766]),'OpenchannelQueueId':Number(_0x4c2c69[_0xc33f('0x2c')]['id'])});}}else{socket[_0xc33f('0x5a')](_0xc33f('0x68'),{'UserId':Number(_0x4c2c69[_0xc33f('0x27')][_0xc33f('0x50')]),'OpenchannelQueueId':Number(_0x4c2c69[_0xc33f('0x2c')]['id'])});}});}})[_0xc33f('0x18')](respondWithStatusCode(_0x438b6b,null))[_0xc33f('0x2a')](handleError(_0x438b6b,null));};exports[_0xc33f('0x6d')]=function(_0x48100d,_0x5e4189){var _0x53f96a={};var _0x58353d={};var _0x6b2361;var _0x31e40b;return db['OpenchannelQueue'][_0xc33f('0x3e')]({'where':{'id':_0x48100d[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x5e4189,null))['then'](function(_0x759968){if(_0x759968){_0x6b2361=_0x759968;_0x58353d[_0xc33f('0x2d')]=_['keys'](db[_0xc33f('0x51')]['rawAttributes']);_0x58353d[_0xc33f('0x27')]=_['keys'](_0x48100d[_0xc33f('0x27')]);_0x58353d[_0xc33f('0x2f')]=_[_0xc33f('0x30')](_0x58353d[_0xc33f('0x2d')],_0x58353d['query']);_0x53f96a['attributes']=_[_0xc33f('0x30')](_0x58353d[_0xc33f('0x2d')],qs[_0xc33f('0x32')](_0x48100d[_0xc33f('0x27')][_0xc33f('0x32')]));_0x53f96a[_0xc33f('0x31')]=_0x53f96a['attributes']['length']?_0x53f96a[_0xc33f('0x31')]:_0x58353d[_0xc33f('0x2d')];_0x53f96a[_0xc33f('0x41')]=qs[_0xc33f('0x42')](_0x48100d[_0xc33f('0x27')][_0xc33f('0x42')]);_0x53f96a[_0xc33f('0x25')]=qs[_0xc33f('0x2f')](_[_0xc33f('0x43')](_0x48100d[_0xc33f('0x27')],_0x58353d[_0xc33f('0x2f')]));if(_0x48100d[_0xc33f('0x27')][_0xc33f('0x45')]){_0x53f96a[_0xc33f('0x25')]=_[_0xc33f('0x35')](_0x53f96a[_0xc33f('0x25')],{'$or':_[_0xc33f('0x20')](_0x53f96a[_0xc33f('0x31')],function(_0x4a474f){var _0x1e8d01={};_0x1e8d01[_0x4a474f]={'$like':'%'+_0x48100d[_0xc33f('0x27')]['filter']+'%'};return _0x1e8d01;})});}_0x53f96a=_[_0xc33f('0x35')]({},_0x53f96a,_0x48100d['options']);return _0x6b2361[_0xc33f('0x6d')](_0x53f96a);}})[_0xc33f('0x18')](function(_0x1f7334){if(_0x1f7334){_0x31e40b=_0x1f7334[_0xc33f('0x33')];if(!_0x48100d[_0xc33f('0x27')][_0xc33f('0x6e')](_0xc33f('0x40'))){_0x53f96a[_0xc33f('0x14')]=qs[_0xc33f('0x14')](_0x48100d[_0xc33f('0x27')][_0xc33f('0x14')]);_0x53f96a[_0xc33f('0x11')]=qs[_0xc33f('0x11')](_0x48100d[_0xc33f('0x27')][_0xc33f('0x11')]);}return _0x6b2361[_0xc33f('0x6d')](_0x53f96a);}})[_0xc33f('0x18')](function(_0x39e357){if(_0x39e357){return _0x39e357?{'count':_0x31e40b,'rows':_0x39e357}:null;}})['then'](respondWithResult(_0x5e4189,null))[_0xc33f('0x2a')](handleError(_0x5e4189,null));}; \ No newline at end of file +var _0x1d09=['filter','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','offset','undefined','count','Content-Range','update','destroy','then','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','autoAssociation','describe','getMembers','findOne','UserOpenchannelQueue','filters','length','hasOwnProperty','nolimit','limit','order','sort','OpenchannelQueueId'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x1d09,0x128));var _0x91d0=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x1d09[_0x466bc5];return _0x138952;};'use strict';var BPromise=require(_0x91d0('0x0'));var util=require(_0x91d0('0x1'));var _=require(_0x91d0('0x2'));var squel=require('squel');var Redis=require(_0x91d0('0x3'));var qs=require(_0x91d0('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x91d0('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x91d0('0x6')](config[_0x91d0('0x7')],{'host':_0x91d0('0x8'),'port':0x18eb});var socket=require(_0x91d0('0x9'))(new Redis(config[_0x91d0('0x7')]));require(_0x91d0('0xa'))[_0x91d0('0xb')](socket);function respondWithStatusCode(_0x3a3bb0,_0x575378){_0x575378=_0x575378||0xcc;return function(_0x206bfc){if(_0x206bfc){return _0x3a3bb0['sendStatus'](_0x575378);}return _0x3a3bb0['status'](_0x575378)[_0x91d0('0xc')]();};}function respondWithResult(_0x549f1f,_0x563bf6){_0x563bf6=_0x563bf6||0xc8;return function(_0x27c12a){if(_0x27c12a){return _0x549f1f[_0x91d0('0xd')](_0x563bf6)[_0x91d0('0xe')](_0x27c12a);}};}function respondWithFilteredResult(_0x56d5e8,_0x122968){return function(_0x22ad1f){if(_0x22ad1f){var _0xa3ac8f=typeof _0x122968[_0x91d0('0xf')]==='undefined'&&typeof _0x122968['limit']===_0x91d0('0x10');var _0x5b107d=_0x22ad1f[_0x91d0('0x11')];var _0x270e51=_0xa3ac8f?0x0:_0x122968['offset'];var _0x53079e=_0xa3ac8f?_0x22ad1f[_0x91d0('0x11')]:_0x122968[_0x91d0('0xf')]+_0x122968['limit'];var _0x5ca7c2;if(_0x53079e>=_0x5b107d){_0x53079e=_0x5b107d;_0x5ca7c2=0xc8;}else{_0x5ca7c2=0xce;}_0x56d5e8[_0x91d0('0xd')](_0x5ca7c2);return _0x56d5e8['set'](_0x91d0('0x12'),_0x270e51+'-'+_0x53079e+'/'+_0x5b107d)[_0x91d0('0xe')](_0x22ad1f);}return null;};}function saveUpdates(_0x2fc94c){return function(_0x1d401d){if(_0x1d401d){return _0x1d401d[_0x91d0('0x13')](_0x2fc94c)['then'](function(_0x355ae0){return _0x355ae0;});}return null;};}function removeEntity(_0xc3891d){return function(_0x2ff097){if(_0x2ff097){return _0x2ff097[_0x91d0('0x14')]()[_0x91d0('0x15')](function(){var _0x4bd6aa=_0x2ff097['get']({'plain':!![]});var _0x328b3b=_0x91d0('0x16');return db[_0x91d0('0x17')][_0x91d0('0x14')]({'where':{'type':_0x328b3b,'resourceId':_0x4bd6aa['id']}})[_0x91d0('0x15')](function(){return _0x2ff097;});})[_0x91d0('0x15')](function(){_0xc3891d[_0x91d0('0xd')](0xcc)[_0x91d0('0xc')]();});}};}function handleEntityNotFound(_0x3a6abe){return function(_0x2c81ff){if(!_0x2c81ff){_0x3a6abe[_0x91d0('0x18')](0x194);}return _0x2c81ff;};}function handleError(_0x39d939,_0x4b64f5){_0x4b64f5=_0x4b64f5||0x1f4;return function(_0x1530a5){logger[_0x91d0('0x19')](_0x1530a5[_0x91d0('0x1a')]);if(_0x1530a5[_0x91d0('0x1b')]){delete _0x1530a5[_0x91d0('0x1b')];}_0x39d939['status'](_0x4b64f5)[_0x91d0('0x1c')](_0x1530a5);};}exports[_0x91d0('0x1d')]=function(_0x37954f,_0x26f09a){var _0x1a54e7={};var _0x5ab718={'count':0x0,'rows':[]};var _0x36132d=_[_0x91d0('0x1e')](db[_0x91d0('0x1f')]['rawAttributes'],function(_0x3e70ab){return{'name':_0x3e70ab['fieldName'],'type':_0x3e70ab['type'][_0x91d0('0x20')]};});_0x1a54e7=qs[_0x91d0('0x21')](_0x36132d,_0x37954f);var _0x3ea4cd={'where':_0x1a54e7[_0x91d0('0x22')]};return db[_0x91d0('0x1f')][_0x91d0('0x11')](_0x3ea4cd)[_0x91d0('0x15')](function(_0x29fca6){_0x5ab718[_0x91d0('0x11')]=_0x29fca6;_0x1a54e7['include']=qs[_0x91d0('0x23')](_0x37954f['query']);return db['OpenchannelQueue'][_0x91d0('0x24')](_0x1a54e7);})[_0x91d0('0x15')](function(_0x5ef0cc){_0x5ab718[_0x91d0('0x25')]=_0x5ef0cc;return _0x5ab718;})[_0x91d0('0x15')](respondWithFilteredResult(_0x26f09a,_0x1a54e7))[_0x91d0('0x26')](handleError(_0x26f09a,null));};exports[_0x91d0('0x27')]=function(_0x143db2,_0x59f622){var _0x1b3cda={'raw':!![],'where':{'id':_0x143db2[_0x91d0('0x28')]['id']}},_0x3fcaa7={};_0x3fcaa7[_0x91d0('0x29')]=_[_0x91d0('0x2a')](db['OpenchannelQueue'][_0x91d0('0x2b')]);_0x3fcaa7[_0x91d0('0x2c')]=_[_0x91d0('0x2a')](_0x143db2['query']);_0x3fcaa7['filters']=_[_0x91d0('0x2d')](_0x3fcaa7['model'],_0x3fcaa7['query']);_0x1b3cda[_0x91d0('0x2e')]=_[_0x91d0('0x2d')](_0x3fcaa7[_0x91d0('0x29')],qs[_0x91d0('0x2f')](_0x143db2[_0x91d0('0x2c')][_0x91d0('0x2f')]));_0x1b3cda[_0x91d0('0x2e')]=_0x1b3cda[_0x91d0('0x2e')]['length']?_0x1b3cda[_0x91d0('0x2e')]:_0x3fcaa7[_0x91d0('0x29')];if(_0x143db2[_0x91d0('0x2c')]['includeAll']){_0x1b3cda[_0x91d0('0x23')]=[{'all':!![]}];}_0x1b3cda=_[_0x91d0('0x30')]({},_0x1b3cda,_0x143db2[_0x91d0('0x31')]);return db[_0x91d0('0x1f')]['find'](_0x1b3cda)[_0x91d0('0x15')](handleEntityNotFound(_0x59f622,null))[_0x91d0('0x15')](respondWithResult(_0x59f622,null))[_0x91d0('0x26')](handleError(_0x59f622,null));};exports[_0x91d0('0x32')]=function(_0x53517e,_0x32a804){return db[_0x91d0('0x1f')][_0x91d0('0x32')](_0x53517e[_0x91d0('0x33')],{})['then'](function(_0x38ec8c){var _0x50a689=_0x53517e[_0x91d0('0x34')]['get']({'plain':!![]});if(!_0x50a689)throw new Error(_0x91d0('0x35'));if(_0x50a689['role']===_0x91d0('0x34')){var _0x9c095e=_0x38ec8c[_0x91d0('0x36')]({'plain':!![]});var _0x2d6257=_0x91d0('0x16');return db[_0x91d0('0x37')][_0x91d0('0x38')]({'where':{'name':_0x2d6257,'userProfileId':_0x50a689['userProfileId']},'raw':!![]})['then'](function(_0x336a99){if(_0x336a99&&_0x336a99[_0x91d0('0x39')]===0x0){return db[_0x91d0('0x17')]['create']({'name':_0x9c095e['name'],'resourceId':_0x9c095e['id'],'type':_0x336a99[_0x91d0('0x1b')],'sectionId':_0x336a99['id']},{})[_0x91d0('0x15')](function(){return _0x38ec8c;});}else{return _0x38ec8c;}})[_0x91d0('0x26')](function(_0x4fe16a){logger[_0x91d0('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fe16a);throw _0x4fe16a;});}return _0x38ec8c;})[_0x91d0('0x15')](respondWithResult(_0x32a804,0xc9))[_0x91d0('0x26')](handleError(_0x32a804,null));};exports[_0x91d0('0x13')]=function(_0x51540b,_0x38e7d1){if(_0x51540b['body']['id']){delete _0x51540b[_0x91d0('0x33')]['id'];}return db[_0x91d0('0x1f')][_0x91d0('0x38')]({'where':{'id':_0x51540b[_0x91d0('0x28')]['id']}})[_0x91d0('0x15')](handleEntityNotFound(_0x38e7d1,null))[_0x91d0('0x15')](saveUpdates(_0x51540b['body'],null))[_0x91d0('0x15')](respondWithResult(_0x38e7d1,null))['catch'](handleError(_0x38e7d1,null));};exports[_0x91d0('0x14')]=function(_0x1cfdaa,_0x4eee00){return db[_0x91d0('0x1f')][_0x91d0('0x38')]({'where':{'id':_0x1cfdaa['params']['id']}})['then'](handleEntityNotFound(_0x4eee00,null))[_0x91d0('0x15')](removeEntity(_0x4eee00,null))[_0x91d0('0x26')](handleError(_0x4eee00,null));};exports[_0x91d0('0x3a')]=function(_0x173c09,_0xf62148){return db[_0x91d0('0x1f')][_0x91d0('0x3a')]()[_0x91d0('0x15')](respondWithResult(_0xf62148,null))[_0x91d0('0x26')](handleError(_0xf62148,null));};exports[_0x91d0('0x3b')]=function(_0x49f896,_0x18fd00){var _0x4557ae={'raw':!![],'where':{}},_0x242de8={},_0x1ddbdc;return db[_0x91d0('0x1f')][_0x91d0('0x3c')]({'where':{'id':_0x49f896[_0x91d0('0x28')]['id']}})['then'](handleEntityNotFound(_0x18fd00,null))[_0x91d0('0x15')](function(_0xf0256b){if(_0xf0256b){_0x1ddbdc=_0xf0256b[_0x91d0('0x36')]({'plain':!![]});_0x242de8[_0x91d0('0x29')]=_['keys'](db[_0x91d0('0x3d')][_0x91d0('0x2b')]);_0x242de8[_0x91d0('0x2c')]=_[_0x91d0('0x2a')](_0x49f896[_0x91d0('0x2c')]);_0x242de8[_0x91d0('0x3e')]=_[_0x91d0('0x2d')](_0x242de8[_0x91d0('0x29')],_0x242de8[_0x91d0('0x2c')]);_0x4557ae[_0x91d0('0x2e')]=_[_0x91d0('0x2d')](_0x242de8['model'],qs['fields'](_0x49f896['query'][_0x91d0('0x2f')]));_0x4557ae[_0x91d0('0x2e')]=_0x4557ae['attributes'][_0x91d0('0x3f')]?_0x4557ae['attributes']:_0x242de8['model'];if(!_0x49f896['query'][_0x91d0('0x40')](_0x91d0('0x41'))){_0x4557ae[_0x91d0('0x42')]=qs['limit'](_0x49f896['query']['limit']);_0x4557ae[_0x91d0('0xf')]=qs[_0x91d0('0xf')](_0x49f896['query']['offset']);}_0x4557ae[_0x91d0('0x43')]=qs['sort'](_0x49f896[_0x91d0('0x2c')][_0x91d0('0x44')]);_0x4557ae[_0x91d0('0x22')]=qs[_0x91d0('0x3e')](_['pick'](_0x49f896[_0x91d0('0x2c')],_0x242de8[_0x91d0('0x3e')]));_0x4557ae[_0x91d0('0x22')][_0x91d0('0x45')]=_0xf0256b['id'];if(_0x49f896[_0x91d0('0x2c')][_0x91d0('0x46')]){_0x4557ae[_0x91d0('0x22')]=_[_0x91d0('0x30')](_0x4557ae[_0x91d0('0x22')],{'$or':_['map'](_0x4557ae['attributes'],function(_0x1b2298){var _0x5c1145={};_0x5c1145[_0x1b2298]={'$like':'%'+_0x49f896[_0x91d0('0x2c')][_0x91d0('0x46')]+'%'};return _0x5c1145;})});}_0x4557ae=_[_0x91d0('0x30')]({},_0x4557ae,_0x49f896[_0x91d0('0x31')]);return db[_0x91d0('0x3d')][_0x91d0('0x24')](_0x4557ae);}})[_0x91d0('0x15')](function(_0x5d1963){if(_0x5d1963){return db[_0x91d0('0x47')][_0x91d0('0x48')]({'where':{'id':_[_0x91d0('0x1e')](_0x5d1963,'UserId'),'role':_0x91d0('0x49')},'attributes':['id',_0x91d0('0x1b'),_0x91d0('0x4a'),_0x91d0('0x4b'),_0x91d0('0x4c')]});}})[_0x91d0('0x15')](function(_0x5dcde8){if(_0x5dcde8){return{'count':_0x5dcde8['count'],'rows':_[_0x91d0('0x1e')](_0x5dcde8['rows'],function(_0x239e22){return{'membername':_0x239e22[_0x91d0('0x1b')],'UserId':_0x239e22['id'],'queue_name':_0x1ddbdc[_0x91d0('0x1b')],'OpenchannelQueueId':_0x1ddbdc['id'],'interface':util['format'](_0x91d0('0x4d'),_0x91d0('0x4e'),_0x239e22[_0x91d0('0x1b')]),'penalty':0x0,'paused':_0x239e22[_0x91d0('0x4a')],'createdAt':_0x239e22[_0x91d0('0x4c')],'updatedAt':_0x239e22['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x91d0('0x15')](respondWithFilteredResult(_0x18fd00,_0x4557ae))[_0x91d0('0x26')](handleError(_0x18fd00,null));};exports[_0x91d0('0x4f')]=function(_0x3b2fbe,_0x4f72ec){var _0x556f29={};var _0x4a4ab1={};var _0x30dbc7;var _0x265fa3;return db['OpenchannelQueue'][_0x91d0('0x3c')]({'where':{'id':_0x3b2fbe[_0x91d0('0x28')]['id']}})[_0x91d0('0x15')](handleEntityNotFound(_0x4f72ec,null))[_0x91d0('0x15')](function(_0x13db93){if(_0x13db93){_0x30dbc7=_0x13db93;_0x4a4ab1[_0x91d0('0x29')]=_['keys'](db[_0x91d0('0x50')][_0x91d0('0x2b')]);_0x4a4ab1['query']=_[_0x91d0('0x2a')](_0x3b2fbe['query']);_0x4a4ab1[_0x91d0('0x3e')]=_[_0x91d0('0x2d')](_0x4a4ab1[_0x91d0('0x29')],_0x4a4ab1[_0x91d0('0x2c')]);_0x556f29['attributes']=_[_0x91d0('0x2d')](_0x4a4ab1[_0x91d0('0x29')],qs[_0x91d0('0x2f')](_0x3b2fbe['query'][_0x91d0('0x2f')]));_0x556f29[_0x91d0('0x2e')]=_0x556f29[_0x91d0('0x2e')][_0x91d0('0x3f')]?_0x556f29[_0x91d0('0x2e')]:_0x4a4ab1['model'];_0x556f29[_0x91d0('0x43')]=qs['sort'](_0x3b2fbe[_0x91d0('0x2c')][_0x91d0('0x44')]);_0x556f29[_0x91d0('0x22')]=qs['filters'](_[_0x91d0('0x51')](_0x3b2fbe[_0x91d0('0x2c')],_0x4a4ab1[_0x91d0('0x3e')]));if(_0x3b2fbe[_0x91d0('0x2c')][_0x91d0('0x46')]){_0x556f29[_0x91d0('0x22')]=_[_0x91d0('0x30')](_0x556f29[_0x91d0('0x22')],{'$or':_['map'](_0x556f29[_0x91d0('0x2e')],function(_0x32d6bd){var _0x1a28a9={};_0x1a28a9[_0x32d6bd]={'$like':'%'+_0x3b2fbe['query'][_0x91d0('0x46')]+'%'};return _0x1a28a9;})});}_0x556f29=_[_0x91d0('0x30')]({},_0x556f29,_0x3b2fbe[_0x91d0('0x31')]);return _0x30dbc7['getTeams'](_0x556f29);}})['then'](function(_0x117a1e){if(_0x117a1e){_0x265fa3=_0x117a1e[_0x91d0('0x3f')];if(!_0x3b2fbe[_0x91d0('0x2c')]['hasOwnProperty']('nolimit')){_0x556f29['limit']=qs[_0x91d0('0x42')](_0x3b2fbe[_0x91d0('0x2c')]['limit']);_0x556f29[_0x91d0('0xf')]=qs[_0x91d0('0xf')](_0x3b2fbe[_0x91d0('0x2c')][_0x91d0('0xf')]);}return _0x30dbc7[_0x91d0('0x4f')](_0x556f29);}})[_0x91d0('0x15')](function(_0x17fa9f){if(_0x17fa9f){return _0x17fa9f?{'count':_0x265fa3,'rows':_0x17fa9f}:null;}})['then'](respondWithResult(_0x4f72ec,null))[_0x91d0('0x26')](handleError(_0x4f72ec,null));};exports[_0x91d0('0x52')]=function(_0x5c7206,_0x5b76e3){var _0x27b3df=_0x5c7206[_0x91d0('0x33')][_0x91d0('0x53')];return db['Team']['findAll']({'where':{'id':_0x27b3df},'attributes':['id'],'include':[{'model':db[_0x91d0('0x47')],'as':'Agents','attributes':['id',_0x91d0('0x1b'),_0x91d0('0x54'),_0x91d0('0x55'),_0x91d0('0x56')],'raw':!![]}]})[_0x91d0('0x15')](function(_0x24ca60){if(_0x24ca60){var _0x2a85b0=_[_0x91d0('0x57')](_0x24ca60,function(_0x15d466){var _0x17ac1c=_0x15d466['get']({'plain':!![]});return _0x17ac1c[_0x91d0('0x58')];});return db['OpenchannelQueue'][_0x91d0('0x38')]({'where':{'id':_0x5c7206[_0x91d0('0x28')]['id']}})[_0x91d0('0x15')](function(_0x1615a0){return db[_0x91d0('0x59')][_0x91d0('0x5a')](function(_0x44b7bd){return _0x1615a0[_0x91d0('0x52')](_0x27b3df,{'transaction':_0x44b7bd})[_0x91d0('0x15')](function(){return BPromise[_0x91d0('0x5b')](_0x2a85b0,function(_0x178af8){return db['UserOpenchannelQueue'][_0x91d0('0x5c')]({'where':{'UserId':_0x178af8['id'],'OpenchannelQueueId':_0x5c7206[_0x91d0('0x28')]['id']},'transaction':_0x44b7bd});});})[_0x91d0('0x15')](function(){_0x2a85b0[_0x91d0('0x5d')](function(_0x4be08a){socket[_0x91d0('0x5e')](_0x91d0('0x5f'),{'UserId':_0x4be08a['id'],'OpenchannelQueueId':_0x1615a0['id']});});});});});}})[_0x91d0('0x15')](respondWithStatusCode(_0x5b76e3,null))['catch'](handleError(_0x5b76e3,null));};exports[_0x91d0('0x60')]=function(_0x58bd14,_0x3924b3){return db[_0x91d0('0x50')][_0x91d0('0x24')]({'where':{'id':_0x58bd14[_0x91d0('0x2c')][_0x91d0('0x53')]},'attributes':['id'],'include':[{'model':db[_0x91d0('0x47')],'as':_0x91d0('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3924b3,null))['then'](function(_0x31a749){var _0x41a692=_[_0x91d0('0x1e')](_0x31a749,'id');var _0x523cfe=[];var _0x55981f=[];var _0x3fac60=squel[_0x91d0('0x61')]();_0x3fac60[_0x91d0('0x62')](_0x91d0('0x63'))[_0x91d0('0x64')](_0x91d0('0x65'),'tq')[_0x91d0('0x66')](_0x91d0('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91d0('0x22')](_0x91d0('0x68'),_0x58bd14[_0x91d0('0x28')]['id']);for(var _0x5409da=0x0;_0x5409da<_0x31a749[_0x91d0('0x3f')];_0x5409da+=0x1){let _0x503edf=_0x31a749[_0x5409da];for(var _0x5ca19c=0x0;_0x5ca19c<_0x503edf[_0x91d0('0x58')][_0x91d0('0x3f')];_0x5ca19c+=0x1){let _0x5b0bbb=_0x503edf[_0x91d0('0x58')][_0x5ca19c];var _0x30e57a=_0x3fac60[_0x91d0('0x69')]();_0x30e57a[_0x91d0('0x22')](_0x91d0('0x6a'),_0x5b0bbb['id']);_0x55981f[_0x91d0('0x6b')](db[_0x91d0('0x59')]['query'](_0x30e57a[_0x91d0('0x6c')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x91d0('0x15')](function(_0x59f8e5){if(_0x59f8e5['length']===0x1){return _0x5b0bbb['id'];}else{var _0x523ded=_[_0x91d0('0x6d')](_['map'](_0x59f8e5,'TeamId'),function(_0x2379ac){return _['includes'](_0x41a692,_0x2379ac);});if(_0x523ded){return _0x5b0bbb['id'];}}}));}}return BPromise[_0x91d0('0x6e')](_0x55981f)[_0x91d0('0x15')](function(_0xf75a0d){_0x523cfe=_(_0x523cfe)[_0x91d0('0x6f')](_0xf75a0d)[_0x91d0('0x70')]()[_0x91d0('0x71')]();return db[_0x91d0('0x1f')]['find']({'where':{'id':_0x58bd14[_0x91d0('0x28')]['id']}})['then'](function(_0x1186c5){return db[_0x91d0('0x59')][_0x91d0('0x5a')](function(_0x35e429){return _0x1186c5[_0x91d0('0x60')](_0x58bd14[_0x91d0('0x2c')]['ids'],{'transaction':_0x35e429})['then'](function(){if(!_[_0x91d0('0x72')](_0x523cfe)){return _0x1186c5[_0x91d0('0x73')](_0x523cfe,{'transaction':_0x35e429});}})[_0x91d0('0x15')](function(){_0x523cfe[_0x91d0('0x5d')](function(_0x4e2fe5){socket[_0x91d0('0x5e')](_0x91d0('0x74'),{'UserId':_0x4e2fe5,'OpenchannelQueueId':_0x1186c5['id']});});});});});});})[_0x91d0('0x15')](respondWithStatusCode(_0x3924b3,null))[_0x91d0('0x26')](handleError(_0x3924b3,null));};exports[_0x91d0('0x75')]=function(_0x17ecae,_0x346c32){return db[_0x91d0('0x1f')][_0x91d0('0x38')]({'where':{'id':_0x17ecae[_0x91d0('0x28')]['id']}})[_0x91d0('0x15')](handleEntityNotFound(_0x346c32,null))[_0x91d0('0x15')](function(_0x2239f3){if(_0x2239f3){return _0x2239f3[_0x91d0('0x75')](_0x17ecae['body'][_0x91d0('0x53')],_[_0x91d0('0x76')](_0x17ecae[_0x91d0('0x33')],[_0x91d0('0x53'),'id'])||{})[_0x91d0('0x77')](function(_0x3377d7){for(var _0x59c507=0x0;_0x59c507<_0x17ecae['body'][_0x91d0('0x53')]['length'];_0x59c507+=0x1){socket[_0x91d0('0x5e')](_0x91d0('0x5f'),{'UserId':Number(_0x17ecae[_0x91d0('0x33')][_0x91d0('0x53')][_0x59c507]),'OpenchannelQueueId':Number(_0x17ecae[_0x91d0('0x28')]['id'])});}return _0x3377d7;});}})[_0x91d0('0x15')](respondWithResult(_0x346c32,null))[_0x91d0('0x26')](handleError(_0x346c32,null));};exports[_0x91d0('0x73')]=function(_0x4a13e0,_0x54773a){return db[_0x91d0('0x1f')][_0x91d0('0x38')]({'where':{'id':_0x4a13e0[_0x91d0('0x28')]['id']}})[_0x91d0('0x15')](handleEntityNotFound(_0x54773a,null))[_0x91d0('0x15')](function(_0x2c6742){if(_0x2c6742){return _0x2c6742[_0x91d0('0x73')](_0x4a13e0[_0x91d0('0x2c')]['ids'])[_0x91d0('0x15')](function(){if(_[_0x91d0('0x78')](_0x4a13e0[_0x91d0('0x2c')][_0x91d0('0x53')])){for(var _0x1c6559=0x0;_0x1c6559<_0x4a13e0[_0x91d0('0x2c')]['ids']['length'];_0x1c6559+=0x1){socket['emit'](_0x91d0('0x74'),{'UserId':Number(_0x4a13e0[_0x91d0('0x2c')]['ids'][_0x1c6559]),'OpenchannelQueueId':Number(_0x4a13e0[_0x91d0('0x28')]['id'])});}}else{socket[_0x91d0('0x5e')](_0x91d0('0x74'),{'UserId':Number(_0x4a13e0[_0x91d0('0x2c')][_0x91d0('0x53')]),'OpenchannelQueueId':Number(_0x4a13e0[_0x91d0('0x28')]['id'])});}});}})[_0x91d0('0x15')](respondWithStatusCode(_0x54773a,null))[_0x91d0('0x26')](handleError(_0x54773a,null));};exports[_0x91d0('0x79')]=function(_0x3adbaa,_0x1a0c64){var _0x296ebc={};var _0x4e184f={};var _0x28f0b7;var _0x13e010;return db['OpenchannelQueue'][_0x91d0('0x3c')]({'where':{'id':_0x3adbaa['params']['id']}})[_0x91d0('0x15')](handleEntityNotFound(_0x1a0c64,null))[_0x91d0('0x15')](function(_0x42edfb){if(_0x42edfb){_0x28f0b7=_0x42edfb;_0x4e184f[_0x91d0('0x29')]=_[_0x91d0('0x2a')](db['User'][_0x91d0('0x2b')]);_0x4e184f[_0x91d0('0x2c')]=_['keys'](_0x3adbaa[_0x91d0('0x2c')]);_0x4e184f[_0x91d0('0x3e')]=_[_0x91d0('0x2d')](_0x4e184f['model'],_0x4e184f[_0x91d0('0x2c')]);_0x296ebc[_0x91d0('0x2e')]=_[_0x91d0('0x2d')](_0x4e184f[_0x91d0('0x29')],qs['fields'](_0x3adbaa['query']['fields']));_0x296ebc['attributes']=_0x296ebc[_0x91d0('0x2e')][_0x91d0('0x3f')]?_0x296ebc[_0x91d0('0x2e')]:_0x4e184f[_0x91d0('0x29')];_0x296ebc[_0x91d0('0x43')]=qs[_0x91d0('0x44')](_0x3adbaa[_0x91d0('0x2c')]['sort']);_0x296ebc[_0x91d0('0x22')]=qs[_0x91d0('0x3e')](_[_0x91d0('0x51')](_0x3adbaa['query'],_0x4e184f[_0x91d0('0x3e')]));if(_0x3adbaa[_0x91d0('0x2c')]['filter']){_0x296ebc['where']=_[_0x91d0('0x30')](_0x296ebc['where'],{'$or':_[_0x91d0('0x1e')](_0x296ebc[_0x91d0('0x2e')],function(_0x216909){var _0x5f33c1={};_0x5f33c1[_0x216909]={'$like':'%'+_0x3adbaa[_0x91d0('0x2c')][_0x91d0('0x46')]+'%'};return _0x5f33c1;})});}_0x296ebc=_[_0x91d0('0x30')]({},_0x296ebc,_0x3adbaa[_0x91d0('0x31')]);return _0x28f0b7[_0x91d0('0x79')](_0x296ebc);}})[_0x91d0('0x15')](function(_0xe4c46b){if(_0xe4c46b){_0x13e010=_0xe4c46b[_0x91d0('0x3f')];if(!_0x3adbaa[_0x91d0('0x2c')][_0x91d0('0x40')](_0x91d0('0x41'))){_0x296ebc[_0x91d0('0x42')]=qs[_0x91d0('0x42')](_0x3adbaa[_0x91d0('0x2c')][_0x91d0('0x42')]);_0x296ebc[_0x91d0('0xf')]=qs[_0x91d0('0xf')](_0x3adbaa[_0x91d0('0x2c')][_0x91d0('0xf')]);}return _0x28f0b7[_0x91d0('0x79')](_0x296ebc);}})['then'](function(_0x1d8d30){if(_0x1d8d30){return _0x1d8d30?{'count':_0x13e010,'rows':_0x1d8d30}:null;}})[_0x91d0('0x15')](respondWithResult(_0x1a0c64,null))[_0x91d0('0x26')](handleError(_0x1a0c64,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d13ef04..12bbd86 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 _0x5b16=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','save'];(function(_0x2ee5db,_0x3cccdd){var _0x262b39=function(_0x32fb0d){while(--_0x32fb0d){_0x2ee5db['push'](_0x2ee5db['shift']());}};_0x262b39(++_0x3cccdd);}(_0x5b16,0xd7));var _0x65b1=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5b16[_0x58afd5];return _0x3e503b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x65b1('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x65b1('0x1'),'afterUpdate':_0x65b1('0x2'),'afterDestroy':_0x65b1('0x3')};function emitEvent(_0x19d229){return function(_0x4d9c06,_0x593a5e,_0x3566d9){OpenchannelQueueEvents[_0x65b1('0x4')](_0x19d229+':'+_0x4d9c06['id'],_0x4d9c06);OpenchannelQueueEvents[_0x65b1('0x4')](_0x19d229,_0x4d9c06);_0x3566d9(null);};}for(var e in events){if(events[_0x65b1('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x65b1('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xc514=['hook','exports','events','OpenchannelQueue','save','update','remove','emit'];(function(_0x3b71c2,_0x58f3bc){var _0x290839=function(_0x520870){while(--_0x520870){_0x3b71c2['push'](_0x3b71c2['shift']());}};_0x290839(++_0x58f3bc);}(_0xc514,0x16a));var _0x4c51=function(_0x2f10e3,_0x5018fe){_0x2f10e3=_0x2f10e3-0x0;var _0x37264=_0xc514[_0x2f10e3];return _0x37264;};'use strict';var EventEmitter=require(_0x4c51('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4c51('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4c51('0x2'),'afterUpdate':_0x4c51('0x3'),'afterDestroy':_0x4c51('0x4')};function emitEvent(_0x5c79d2){return function(_0x4903c6,_0x990e71,_0x4455f3){OpenchannelQueueEvents['emit'](_0x5c79d2+':'+_0x4903c6['id'],_0x4903c6);OpenchannelQueueEvents[_0x4c51('0x5')](_0x5c79d2,_0x4903c6);_0x4455f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4c51('0x6')](e,emitEvent(event));}}module[_0x4c51('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8a6bbbe..7a9befc 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 _0xfb95=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','lodash','util'];(function(_0x28ddff,_0x3b1162){var _0x32bea0=function(_0x59ee23){while(--_0x59ee23){_0x28ddff['push'](_0x28ddff['shift']());}};_0x32bea0(++_0x3b1162);}(_0xfb95,0xb9));var _0x5fb9=function(_0x163ed0,_0x19d4af){_0x163ed0=_0x163ed0-0x0;var _0x2475bf=_0xfb95[_0x163ed0];return _0x2475bf;};'use strict';var _=require(_0x5fb9('0x0'));var util=require(_0x5fb9('0x1'));var logger=require(_0x5fb9('0x2'))(_0x5fb9('0x3'));var moment=require('moment');var BPromise=require(_0x5fb9('0x4'));var rp=require(_0x5fb9('0x5'));var fs=require('fs');var path=require(_0x5fb9('0x6'));var rimraf=require(_0x5fb9('0x7'));var config=require(_0x5fb9('0x8'));var attributes=require(_0x5fb9('0x9'));module['exports']=function(_0x86933c,_0x13933f){return _0x86933c[_0x5fb9('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cf0=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x2538fd,_0x3f083d){var _0x3e494c=function(_0x52fba8){while(--_0x52fba8){_0x2538fd['push'](_0x2538fd['shift']());}};_0x3e494c(++_0x3f083d);}(_0x4cf0,0x96));var _0x04cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4cf0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x04cf('0x0'));var moment=require(_0x04cf('0x1'));var BPromise=require('bluebird');var rp=require(_0x04cf('0x2'));var fs=require('fs');var path=require(_0x04cf('0x3'));var rimraf=require(_0x04cf('0x4'));var config=require(_0x04cf('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0x04cf('0x6')]=function(_0x44e106,_0x42fffd){return _0x44e106[_0x04cf('0x7')](_0x04cf('0x8'),attributes,{'tableName':_0x04cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index d5764fe..34a7e8e 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 _0x9758=['stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','options','raw','attributes','limit','include','model','map','debug','ShowOpenchannelQueue','OpenchannelQueue','find','where','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','then','info','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2f3443,_0x1e9913){var _0x287be1=function(_0x12d59a){while(--_0x12d59a){_0x2f3443['push'](_0x2f3443['shift']());}};_0x287be1(++_0x1e9913);}(_0x9758,0xe6));var _0x8975=function(_0x411186,_0x1478ef){_0x411186=_0x411186-0x0;var _0x22cca5=_0x9758[_0x411186];return _0x22cca5;};'use strict';var _=require('lodash');var util=require(_0x8975('0x0'));var moment=require(_0x8975('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8975('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8975('0x3'));var logger=require(_0x8975('0x4'))(_0x8975('0x5'));var config=require(_0x8975('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8975('0x7')]['http']({'port':0x232a});config['redis']=_[_0x8975('0x8')](config[_0x8975('0x9')],{'host':_0x8975('0xa'),'port':0x18eb});var socket=require(_0x8975('0xb'))(new Redis(config[_0x8975('0x9')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2b0b29,_0x37fb12,_0x193457){return new BPromise(function(_0x59e262,_0x414983){return client['request'](_0x2b0b29,_0x193457)[_0x8975('0xc')](function(_0x1d5355){logger[_0x8975('0xd')]('OpenchannelQueue,\x20%s,\x20%s',_0x37fb12,'request\x20sent');logger['debug'](_0x8975('0xe'),_0x37fb12,'request\x20sent',JSON[_0x8975('0xf')](_0x1d5355));if(_0x1d5355[_0x8975('0x10')]){if(_0x1d5355[_0x8975('0x10')][_0x8975('0x11')]===0x1f4){logger[_0x8975('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x37fb12,_0x1d5355[_0x8975('0x10')]['message']);return _0x414983(_0x1d5355[_0x8975('0x10')][_0x8975('0x12')]);}logger[_0x8975('0x10')](_0x8975('0x13'),_0x37fb12,_0x1d5355[_0x8975('0x10')][_0x8975('0x12')]);return _0x59e262(_0x1d5355['error']['message']);}else{logger[_0x8975('0xd')](_0x8975('0x13'),_0x37fb12,'request\x20sent');_0x59e262(_0x1d5355[_0x8975('0x14')][_0x8975('0x12')]);}})[_0x8975('0x15')](function(_0x445983){logger[_0x8975('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x37fb12,_0x445983);_0x414983(_0x445983);});});}exports[_0x8975('0x16')]=function(_0x282e77){var _0x28eca0=this;return new Promise(function(_0x4410b6,_0x50008e){return db['OpenchannelQueue']['findAll']({'raw':_0x282e77[_0x8975('0x17')]?_0x282e77[_0x8975('0x17')][_0x8975('0x18')]===undefined?!![]:![]:!![],'where':_0x282e77[_0x8975('0x17')]?_0x282e77[_0x8975('0x17')]['where']||null:null,'attributes':_0x282e77[_0x8975('0x17')]?_0x282e77[_0x8975('0x17')][_0x8975('0x19')]||null:null,'limit':_0x282e77[_0x8975('0x17')]?_0x282e77['options'][_0x8975('0x1a')]||null:null,'include':_0x282e77[_0x8975('0x17')]?_0x282e77[_0x8975('0x17')][_0x8975('0x1b')]?_['map'](_0x282e77[_0x8975('0x17')][_0x8975('0x1b')],function(_0xfa113){return{'model':db[_0xfa113[_0x8975('0x1c')]],'as':_0xfa113['as'],'attributes':_0xfa113[_0x8975('0x19')],'include':_0xfa113[_0x8975('0x1b')]?_['map'](_0xfa113[_0x8975('0x1b')],function(_0x705613){return{'model':db[_0x705613[_0x8975('0x1c')]],'as':_0x705613['as'],'attributes':_0x705613[_0x8975('0x19')],'include':_0x705613[_0x8975('0x1b')]?_[_0x8975('0x1d')](_0x705613[_0x8975('0x1b')],function(_0x1352f6){return{'model':db[_0x1352f6['model']],'as':_0x1352f6['as'],'attributes':_0x1352f6[_0x8975('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x279d63){logger['info'](_0x8975('0x16'),_0x282e77);logger[_0x8975('0x1e')]('GetOpenchannelQueue',_0x282e77,JSON[_0x8975('0xf')](_0x279d63));_0x4410b6(_0x279d63);})[_0x8975('0x15')](function(_0x4001fb){logger[_0x8975('0x10')](_0x8975('0x16'),_0x4001fb[_0x8975('0x12')],_0x282e77);_0x50008e(_0x28eca0[_0x8975('0x10')](0x1f4,_0x4001fb[_0x8975('0x12')]));});});};exports[_0x8975('0x1f')]=function(_0x3176b5){var _0x269cc7=this;return new Promise(function(_0x103c43,_0x37ed51){return db[_0x8975('0x20')][_0x8975('0x21')]({'raw':_0x3176b5['options']?_0x3176b5['options'][_0x8975('0x18')]===undefined?!![]:![]:!![],'where':_0x3176b5[_0x8975('0x17')]?_0x3176b5[_0x8975('0x17')][_0x8975('0x22')]||null:null,'attributes':_0x3176b5[_0x8975('0x17')]?_0x3176b5['options'][_0x8975('0x19')]||null:null,'include':_0x3176b5[_0x8975('0x17')]?_0x3176b5['options'][_0x8975('0x1b')]?_[_0x8975('0x1d')](_0x3176b5['options'][_0x8975('0x1b')],function(_0x46bdc9){return{'model':db[_0x46bdc9[_0x8975('0x1c')]],'as':_0x46bdc9['as'],'attributes':_0x46bdc9[_0x8975('0x19')],'include':_0x46bdc9[_0x8975('0x1b')]?_[_0x8975('0x1d')](_0x46bdc9[_0x8975('0x1b')],function(_0x332822){return{'model':db[_0x332822[_0x8975('0x1c')]],'as':_0x332822['as'],'attributes':_0x332822[_0x8975('0x19')],'include':_0x332822['include']?_[_0x8975('0x1d')](_0x332822[_0x8975('0x1b')],function(_0x235b65){return{'model':db[_0x235b65[_0x8975('0x1c')]],'as':_0x235b65['as'],'attributes':_0x235b65[_0x8975('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8975('0xc')](function(_0xc61351){logger[_0x8975('0xd')](_0x8975('0x1f'),_0x3176b5);logger[_0x8975('0x1e')](_0x8975('0x1f'),_0x3176b5,JSON[_0x8975('0xf')](_0xc61351));_0x103c43(_0xc61351);})[_0x8975('0x15')](function(_0x3684e3){logger[_0x8975('0x10')](_0x8975('0x1f'),_0x3684e3[_0x8975('0x12')],_0x3176b5);_0x37ed51(_0x269cc7[_0x8975('0x10')](0x1f4,_0x3684e3['message']));});});}; \ No newline at end of file +var _0x718b=['limit','include','model','map','stringify','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes'];(function(_0x3ce6ec,_0x49b149){var _0x3b5f89=function(_0x18dc0c){while(--_0x18dc0c){_0x3ce6ec['push'](_0x3ce6ec['shift']());}};_0x3b5f89(++_0x49b149);}(_0x718b,0x8b));var _0xb718=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0x718b[_0x562ec5];return _0x279c8c;};'use strict';var _=require(_0xb718('0x0'));var util=require(_0xb718('0x1'));var moment=require(_0xb718('0x2'));var BPromise=require(_0xb718('0x3'));var rs=require(_0xb718('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb718('0x5'))['db'];var utils=require(_0xb718('0x6'));var logger=require('../../config/logger')(_0xb718('0x7'));var config=require(_0xb718('0x8'));var jayson=require(_0xb718('0x9'));var client=jayson[_0xb718('0xa')][_0xb718('0xb')]({'port':0x232a});config['redis']=_[_0xb718('0xc')](config['redis'],{'host':_0xb718('0xd'),'port':0x18eb});var socket=require(_0xb718('0xe'))(new Redis(config[_0xb718('0xf')]));require(_0xb718('0x10'))[_0xb718('0x11')](socket);function respondWithRpcPromise(_0x3464da,_0x4a2e07,_0x56859c){return new BPromise(function(_0x40754f,_0x5ca321){return client[_0xb718('0x12')](_0x3464da,_0x56859c)[_0xb718('0x13')](function(_0x1a865e){logger[_0xb718('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x4a2e07,_0xb718('0x15'));logger[_0xb718('0x16')](_0xb718('0x17'),_0x4a2e07,_0xb718('0x15'),JSON['stringify'](_0x1a865e));if(_0x1a865e[_0xb718('0x18')]){if(_0x1a865e[_0xb718('0x18')][_0xb718('0x19')]===0x1f4){logger[_0xb718('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x4a2e07,_0x1a865e['error'][_0xb718('0x1a')]);return _0x5ca321(_0x1a865e[_0xb718('0x18')][_0xb718('0x1a')]);}logger[_0xb718('0x18')](_0xb718('0x1b'),_0x4a2e07,_0x1a865e['error'][_0xb718('0x1a')]);return _0x40754f(_0x1a865e[_0xb718('0x18')][_0xb718('0x1a')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x4a2e07,_0xb718('0x15'));_0x40754f(_0x1a865e[_0xb718('0x1c')][_0xb718('0x1a')]);}})[_0xb718('0x1d')](function(_0x29e3b6){logger[_0xb718('0x18')](_0xb718('0x1b'),_0x4a2e07,_0x29e3b6);_0x5ca321(_0x29e3b6);});});}exports[_0xb718('0x1e')]=function(_0x41382f){var _0x5baade=this;return new Promise(function(_0x4d1f1e,_0x341eb7){return db[_0xb718('0x1f')][_0xb718('0x20')]({'raw':_0x41382f['options']?_0x41382f[_0xb718('0x21')][_0xb718('0x22')]===undefined?!![]:![]:!![],'where':_0x41382f[_0xb718('0x21')]?_0x41382f[_0xb718('0x21')][_0xb718('0x23')]||null:null,'attributes':_0x41382f['options']?_0x41382f[_0xb718('0x21')][_0xb718('0x24')]||null:null,'limit':_0x41382f['options']?_0x41382f[_0xb718('0x21')][_0xb718('0x25')]||null:null,'include':_0x41382f[_0xb718('0x21')]?_0x41382f['options']['include']?_['map'](_0x41382f['options'][_0xb718('0x26')],function(_0x4af556){return{'model':db[_0x4af556[_0xb718('0x27')]],'as':_0x4af556['as'],'attributes':_0x4af556['attributes'],'include':_0x4af556[_0xb718('0x26')]?_[_0xb718('0x28')](_0x4af556[_0xb718('0x26')],function(_0x244325){return{'model':db[_0x244325['model']],'as':_0x244325['as'],'attributes':_0x244325[_0xb718('0x24')],'include':_0x244325[_0xb718('0x26')]?_['map'](_0x244325[_0xb718('0x26')],function(_0x52094c){return{'model':db[_0x52094c[_0xb718('0x27')]],'as':_0x52094c['as'],'attributes':_0x52094c[_0xb718('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb718('0x13')](function(_0x9d3331){logger[_0xb718('0x14')](_0xb718('0x1e'),_0x41382f);logger[_0xb718('0x16')](_0xb718('0x1e'),_0x41382f,JSON[_0xb718('0x29')](_0x9d3331));_0x4d1f1e(_0x9d3331);})[_0xb718('0x1d')](function(_0x47ff3f){logger[_0xb718('0x18')]('GetOpenchannelQueue',_0x47ff3f[_0xb718('0x1a')],_0x41382f);_0x341eb7(_0x5baade[_0xb718('0x18')](0x1f4,_0x47ff3f['message']));});});};exports[_0xb718('0x2a')]=function(_0x538fbe){var _0x526fef=this;return new Promise(function(_0x3fae79,_0xf6a15e){return db[_0xb718('0x1f')][_0xb718('0x2b')]({'raw':_0x538fbe[_0xb718('0x21')]?_0x538fbe[_0xb718('0x21')][_0xb718('0x22')]===undefined?!![]:![]:!![],'where':_0x538fbe[_0xb718('0x21')]?_0x538fbe[_0xb718('0x21')][_0xb718('0x23')]||null:null,'attributes':_0x538fbe[_0xb718('0x21')]?_0x538fbe[_0xb718('0x21')]['attributes']||null:null,'include':_0x538fbe[_0xb718('0x21')]?_0x538fbe[_0xb718('0x21')][_0xb718('0x26')]?_['map'](_0x538fbe[_0xb718('0x21')][_0xb718('0x26')],function(_0x143ebc){return{'model':db[_0x143ebc['model']],'as':_0x143ebc['as'],'attributes':_0x143ebc['attributes'],'include':_0x143ebc[_0xb718('0x26')]?_['map'](_0x143ebc[_0xb718('0x26')],function(_0x3d99db){return{'model':db[_0x3d99db[_0xb718('0x27')]],'as':_0x3d99db['as'],'attributes':_0x3d99db[_0xb718('0x24')],'include':_0x3d99db[_0xb718('0x26')]?_[_0xb718('0x28')](_0x3d99db[_0xb718('0x26')],function(_0x4d8f54){return{'model':db[_0x4d8f54[_0xb718('0x27')]],'as':_0x4d8f54['as'],'attributes':_0x4d8f54['attributes']};}):[]};}):[]};}):[]:[]})[_0xb718('0x13')](function(_0x32e9e8){logger[_0xb718('0x14')](_0xb718('0x2a'),_0x538fbe);logger['debug']('ShowOpenchannelQueue',_0x538fbe,JSON[_0xb718('0x29')](_0x32e9e8));_0x3fae79(_0x32e9e8);})['catch'](function(_0x4de60a){logger[_0xb718('0x18')](_0xb718('0x2a'),_0x4de60a[_0xb718('0x1a')],_0x538fbe);_0xf6a15e(_0x526fef['error'](0x1f4,_0x4de60a[_0xb718('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 89af07c..22595b0 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 _0x4ab1=['./openchannelQueue.events','save','remove','update','removeListener','length','openchannelQueue:'];(function(_0x3330d1,_0x42a9b0){var _0x3b78ef=function(_0x118f89){while(--_0x118f89){_0x3330d1['push'](_0x3330d1['shift']());}};_0x3b78ef(++_0x42a9b0);}(_0x4ab1,0xe0));var _0x14ab=function(_0x326610,_0x5d079a){_0x326610=_0x326610-0x0;var _0x4347b3=_0x4ab1[_0x326610];return _0x4347b3;};'use strict';var OpenchannelQueueEvents=require(_0x14ab('0x0'));var events=[_0x14ab('0x1'),_0x14ab('0x2'),_0x14ab('0x3')];function createListener(_0x5ae96c,_0x2aed25){return function(_0x160f9a){_0x2aed25['emit'](_0x5ae96c,_0x160f9a);};}function removeListener(_0x2cc41b,_0x552646){return function(){OpenchannelQueueEvents[_0x14ab('0x4')](_0x2cc41b,_0x552646);};}exports['register']=function(_0x5e7347){for(var _0x529768=0x0,_0x429de2=events[_0x14ab('0x5')];_0x529768<_0x429de2;_0x529768++){var _0x1e8aef=events[_0x529768];var _0x3c2d85=createListener(_0x14ab('0x6')+_0x1e8aef,_0x5e7347);OpenchannelQueueEvents['on'](_0x1e8aef,_0x3c2d85);}}; \ No newline at end of file +var _0x86ce=['remove','update','removeListener','register','openchannelQueue:','save'];(function(_0x4cd065,_0x556981){var _0x3cd13f=function(_0x19a2ae){while(--_0x19a2ae){_0x4cd065['push'](_0x4cd065['shift']());}};_0x3cd13f(++_0x556981);}(_0x86ce,0x167));var _0xe86c=function(_0x290ef5,_0x32cfa7){_0x290ef5=_0x290ef5-0x0;var _0x450d92=_0x86ce[_0x290ef5];return _0x450d92;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xe86c('0x0'),_0xe86c('0x1'),_0xe86c('0x2')];function createListener(_0x5e5478,_0x28f9d7){return function(_0xe9d707){_0x28f9d7['emit'](_0x5e5478,_0xe9d707);};}function removeListener(_0x47e5a4,_0xcce360){return function(){OpenchannelQueueEvents[_0xe86c('0x3')](_0x47e5a4,_0xcce360);};}exports[_0xe86c('0x4')]=function(_0x18add3){for(var _0x5d1429=0x0,_0x48e19a=events['length'];_0x5d1429<_0x48e19a;_0x5d1429++){var _0x4b486f=events[_0x5d1429];var _0x2b38d5=createListener(_0xe86c('0x5')+_0x4b486f,_0x18add3);OpenchannelQueueEvents['on'](_0x4b486f,_0x2b38d5);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 4ddaaf0..6212fa1 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 _0xb493=['get','/describe','/:id','isAuthenticated','show','create','put','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x560c1b,_0x2a8f0a){var _0x898ec5=function(_0x4fa212){while(--_0x4fa212){_0x560c1b['push'](_0x560c1b['shift']());}};_0x898ec5(++_0x2a8f0a);}(_0xb493,0x109));var _0x3b49=function(_0x58153c,_0x40dff4){_0x58153c=_0x58153c-0x0;var _0x69e19d=_0xb493[_0x58153c];return _0x69e19d;};'use strict';var multer=require('multer');var util=require(_0x3b49('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3b49('0x1'));var router=express[_0x3b49('0x2')]();var fs_extra=require(_0x3b49('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3b49('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3b49('0x5')](_0x3b49('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x3b49('0x5')](_0x3b49('0x7'),auth[_0x3b49('0x8')](),controller[_0x3b49('0x9')]);router['post']('/',auth[_0x3b49('0x8')](),controller[_0x3b49('0xa')]);router[_0x3b49('0xb')](_0x3b49('0x7'),auth[_0x3b49('0x8')](),controller['update']);router[_0x3b49('0xc')]('/:id',auth[_0x3b49('0x8')](),controller[_0x3b49('0xd')]);module[_0x3b49('0xe')]=router; \ No newline at end of file +var _0x8824=['update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','describe','/:id','isAuthenticated','post','create','put'];(function(_0x120b93,_0x532248){var _0x49401b=function(_0x524588){while(--_0x524588){_0x120b93['push'](_0x120b93['shift']());}};_0x49401b(++_0x532248);}(_0x8824,0x1e8));var _0x4882=function(_0x11a53d,_0x18167f){_0x11a53d=_0x11a53d-0x0;var _0x534315=_0x8824[_0x11a53d];return _0x534315;};'use strict';var multer=require(_0x4882('0x0'));var util=require(_0x4882('0x1'));var path=require(_0x4882('0x2'));var timeout=require('connect-timeout');var express=require(_0x4882('0x3'));var router=express['Router']();var fs_extra=require(_0x4882('0x4'));var auth=require(_0x4882('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4882('0x6'));var controller=require(_0x4882('0x7'));router[_0x4882('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4882('0x8')](_0x4882('0x9'),auth['isAuthenticated'](),controller[_0x4882('0xa')]);router[_0x4882('0x8')](_0x4882('0xb'),auth[_0x4882('0xc')](),controller['show']);router[_0x4882('0xd')]('/',auth[_0x4882('0xc')](),controller[_0x4882('0xe')]);router[_0x4882('0xf')](_0x4882('0xb'),auth[_0x4882('0xc')](),controller[_0x4882('0x10')]);router['delete'](_0x4882('0xb'),auth[_0x4882('0xc')](),controller['destroy']);module[_0x4882('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 316f72d..34c6c78 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 _0x313c=['exports','STRING','DATE','moment'];(function(_0x5e3888,_0x5a8922){var _0x4b922a=function(_0x2e77ee){while(--_0x2e77ee){_0x5e3888['push'](_0x5e3888['shift']());}};_0x4b922a(++_0x5a8922);}(_0x313c,0x1f3));var _0xc313=function(_0x4b7dde,_0x421327){_0x4b7dde=_0x4b7dde-0x0;var _0x80141b=_0x313c[_0x4b7dde];return _0x80141b;};'use strict';var moment=require(_0xc313('0x0'));var Sequelize=require('sequelize');module[_0xc313('0x1')]={'uniqueid':{'type':Sequelize[_0xc313('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc313('0x2')]},'joinAt':{'type':Sequelize[_0xc313('0x3')]},'leaveAt':{'type':Sequelize[_0xc313('0x3')]},'acceptAt':{'type':Sequelize[_0xc313('0x3')]},'exitAt':{'type':Sequelize[_0xc313('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x44b6=['moment','exports','STRING','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x44b6,0x14c));var _0x644b=function(_0x1acc01,_0x5cb80c){_0x1acc01=_0x1acc01-0x0;var _0x5603f1=_0x44b6[_0x1acc01];return _0x5603f1;};'use strict';var moment=require(_0x644b('0x0'));var Sequelize=require('sequelize');module[_0x644b('0x1')]={'uniqueid':{'type':Sequelize[_0x644b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x644b('0x2')]},'joinAt':{'type':Sequelize[_0x644b('0x3')]},'leaveAt':{'type':Sequelize[_0x644b('0x3')]},'acceptAt':{'type':Sequelize[_0x644b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x644b('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 35df2bb..d8412d4 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 _0xc13f=['pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters'];(function(_0xd6961f,_0x271542){var _0x4c34d3=function(_0x659c58){while(--_0x659c58){_0xd6961f['push'](_0xd6961f['shift']());}};_0x4c34d3(++_0x271542);}(_0xc13f,0x138));var _0xfc13=function(_0x15fda2,_0x505a8a){_0x15fda2=_0x15fda2-0x0;var _0x40cfbf=_0xc13f[_0x15fda2];return _0x40cfbf;};'use strict';var emlformat=require(_0xfc13('0x0'));var rimraf=require(_0xfc13('0x1'));var zipdir=require(_0xfc13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc13('0x3'));var Mustache=require(_0xfc13('0x4'));var util=require(_0xfc13('0x5'));var path=require(_0xfc13('0x6'));var sox=require(_0xfc13('0x7'));var csv=require(_0xfc13('0x8'));var ejs=require(_0xfc13('0x9'));var fs=require('fs');var fs_extra=require(_0xfc13('0xa'));var _=require(_0xfc13('0xb'));var squel=require(_0xfc13('0xc'));var crypto=require(_0xfc13('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfc13('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfc13('0xf'));var Redis=require(_0xfc13('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc13('0x11'));var hardwareService=require(_0xfc13('0x12'));var logger=require(_0xfc13('0x13'))(_0xfc13('0x14'));var utils=require('../../config/utils');var config=require(_0xfc13('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc13('0x16'))['db'];function respondWithStatusCode(_0x48c92b,_0x56ea0e){_0x56ea0e=_0x56ea0e||0xcc;return function(_0x2d2bc4){if(_0x2d2bc4){return _0x48c92b[_0xfc13('0x17')](_0x56ea0e);}return _0x48c92b[_0xfc13('0x18')](_0x56ea0e)[_0xfc13('0x19')]();};}function respondWithResult(_0x2917db,_0x906b2a){_0x906b2a=_0x906b2a||0xc8;return function(_0x307c3a){if(_0x307c3a){return _0x2917db['status'](_0x906b2a)[_0xfc13('0x1a')](_0x307c3a);}};}function respondWithFilteredResult(_0x40fc27,_0x3bf1cf){return function(_0x378017){if(_0x378017){var _0x378aac=typeof _0x3bf1cf[_0xfc13('0x1b')]===_0xfc13('0x1c')&&typeof _0x3bf1cf[_0xfc13('0x1d')]===_0xfc13('0x1c');var _0x47146d=_0x378017['count'];var _0x1b79d8=_0x378aac?0x0:_0x3bf1cf['offset'];var _0x56bfd2=_0x378aac?_0x378017[_0xfc13('0x1e')]:_0x3bf1cf[_0xfc13('0x1b')]+_0x3bf1cf['limit'];var _0x411aac;if(_0x56bfd2>=_0x47146d){_0x56bfd2=_0x47146d;_0x411aac=0xc8;}else{_0x411aac=0xce;}_0x40fc27[_0xfc13('0x18')](_0x411aac);return _0x40fc27[_0xfc13('0x1f')](_0xfc13('0x20'),_0x1b79d8+'-'+_0x56bfd2+'/'+_0x47146d)['json'](_0x378017);}return null;};}function patchUpdates(_0x52aed7){return function(_0x1008bd){try{jsonpatch[_0xfc13('0x21')](_0x1008bd,_0x52aed7,!![]);}catch(_0x5d944d){return BPromise['reject'](_0x5d944d);}return _0x1008bd[_0xfc13('0x22')]();};}function saveUpdates(_0x44c9f1,_0x32c5f2){return function(_0x24273){if(_0x24273){return _0x24273[_0xfc13('0x23')](_0x44c9f1)['then'](function(_0x3baffe){return _0x3baffe;});}return null;};}function removeEntity(_0x59ba39,_0x47a337){return function(_0x5a3615){if(_0x5a3615){return _0x5a3615['destroy']()[_0xfc13('0x24')](function(){_0x59ba39[_0xfc13('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c528,_0x4fd963){return function(_0x718860){if(!_0x718860){_0x45c528[_0xfc13('0x17')](0x194);}return _0x718860;};}function handleError(_0x1f2586,_0x51c999){_0x51c999=_0x51c999||0x1f4;return function(_0x3af3ee){logger[_0xfc13('0x25')](_0x3af3ee[_0xfc13('0x26')]);if(_0x3af3ee[_0xfc13('0x27')]){delete _0x3af3ee['name'];}_0x1f2586[_0xfc13('0x18')](_0x51c999)[_0xfc13('0x28')](_0x3af3ee);};}exports[_0xfc13('0x29')]=function(_0x1b3ecb,_0x4cee9a){var _0x34b66f={},_0xbbb229={},_0x5ce5bc={'count':0x0,'rows':[]};var _0x9839cc=_[_0xfc13('0x2a')](db[_0xfc13('0x2b')][_0xfc13('0x2c')],function(_0x27e946){return{'name':_0x27e946[_0xfc13('0x2d')],'type':_0x27e946['type'][_0xfc13('0x2e')]};});_0xbbb229[_0xfc13('0x2f')]=_[_0xfc13('0x2a')](_0x9839cc,_0xfc13('0x27'));_0xbbb229['query']=_[_0xfc13('0x30')](_0x1b3ecb[_0xfc13('0x31')]);_0xbbb229['filters']=_[_0xfc13('0x32')](_0xbbb229[_0xfc13('0x2f')],_0xbbb229['query']);_0x34b66f[_0xfc13('0x33')]=_[_0xfc13('0x32')](_0xbbb229[_0xfc13('0x2f')],qs[_0xfc13('0x34')](_0x1b3ecb['query'][_0xfc13('0x34')]));_0x34b66f[_0xfc13('0x33')]=_0x34b66f[_0xfc13('0x33')]['length']?_0x34b66f[_0xfc13('0x33')]:_0xbbb229[_0xfc13('0x2f')];if(!_0x1b3ecb[_0xfc13('0x31')]['hasOwnProperty'](_0xfc13('0x35'))){_0x34b66f[_0xfc13('0x1d')]=qs[_0xfc13('0x1d')](_0x1b3ecb['query'][_0xfc13('0x1d')]);_0x34b66f[_0xfc13('0x1b')]=qs[_0xfc13('0x1b')](_0x1b3ecb[_0xfc13('0x31')][_0xfc13('0x1b')]);}_0x34b66f[_0xfc13('0x36')]=qs[_0xfc13('0x37')](_0x1b3ecb['query'][_0xfc13('0x37')]);_0x34b66f[_0xfc13('0x38')]=qs[_0xfc13('0x39')](_[_0xfc13('0x3a')](_0x1b3ecb[_0xfc13('0x31')],_0xbbb229[_0xfc13('0x39')]),_0x9839cc);if(_0x1b3ecb[_0xfc13('0x31')][_0xfc13('0x3b')]){_0x34b66f[_0xfc13('0x38')]=_[_0xfc13('0x3c')](_0x34b66f['where'],{'$or':_[_0xfc13('0x2a')](_0x9839cc,function(_0x33a044){if(_0x33a044['type']!==_0xfc13('0x3d')){var _0x1f8b6a={};_0x1f8b6a[_0x33a044[_0xfc13('0x27')]]={'$like':'%'+_0x1b3ecb[_0xfc13('0x31')]['filter']+'%'};return _0x1f8b6a;}})});}_0x34b66f=_['merge']({},_0x34b66f,_0x1b3ecb[_0xfc13('0x3e')]);var _0x3beafe={'where':_0x34b66f[_0xfc13('0x38')]};return db[_0xfc13('0x2b')][_0xfc13('0x1e')](_0x3beafe)[_0xfc13('0x24')](function(_0x2b8bdd){_0x5ce5bc[_0xfc13('0x1e')]=_0x2b8bdd;if(_0x1b3ecb[_0xfc13('0x31')][_0xfc13('0x3f')]){_0x34b66f[_0xfc13('0x40')]=[{'all':!![]}];}return db[_0xfc13('0x2b')]['findAll'](_0x34b66f);})[_0xfc13('0x24')](function(_0x979f2a){_0x5ce5bc['rows']=_0x979f2a;return _0x5ce5bc;})[_0xfc13('0x24')](respondWithFilteredResult(_0x4cee9a,_0x34b66f))[_0xfc13('0x41')](handleError(_0x4cee9a,null));};exports[_0xfc13('0x42')]=function(_0xdbb3b3,_0x5df4c9){var _0x5a1467={'raw':!![],'where':{'id':_0xdbb3b3[_0xfc13('0x43')]['id']}},_0x5c8e49={};_0x5c8e49['model']=_[_0xfc13('0x30')](db[_0xfc13('0x2b')][_0xfc13('0x2c')]);_0x5c8e49[_0xfc13('0x31')]=_[_0xfc13('0x30')](_0xdbb3b3[_0xfc13('0x31')]);_0x5c8e49[_0xfc13('0x39')]=_[_0xfc13('0x32')](_0x5c8e49[_0xfc13('0x2f')],_0x5c8e49[_0xfc13('0x31')]);_0x5a1467[_0xfc13('0x33')]=_['intersection'](_0x5c8e49[_0xfc13('0x2f')],qs[_0xfc13('0x34')](_0xdbb3b3[_0xfc13('0x31')]['fields']));_0x5a1467[_0xfc13('0x33')]=_0x5a1467[_0xfc13('0x33')][_0xfc13('0x44')]?_0x5a1467['attributes']:_0x5c8e49['model'];if(_0xdbb3b3[_0xfc13('0x31')][_0xfc13('0x3f')]){_0x5a1467[_0xfc13('0x40')]=[{'all':!![]}];}_0x5a1467=_['merge']({},_0x5a1467,_0xdbb3b3[_0xfc13('0x3e')]);return db[_0xfc13('0x2b')]['find'](_0x5a1467)[_0xfc13('0x24')](handleEntityNotFound(_0x5df4c9,null))[_0xfc13('0x24')](respondWithResult(_0x5df4c9,null))['catch'](handleError(_0x5df4c9,null));};exports[_0xfc13('0x45')]=function(_0x215aed,_0x560915){return db[_0xfc13('0x2b')][_0xfc13('0x45')](_0x215aed[_0xfc13('0x46')],{})[_0xfc13('0x24')](respondWithResult(_0x560915,0xc9))['catch'](handleError(_0x560915,null));};exports[_0xfc13('0x23')]=function(_0xcf9b0,_0x541429){if(_0xcf9b0[_0xfc13('0x46')]['id']){delete _0xcf9b0[_0xfc13('0x46')]['id'];}return db[_0xfc13('0x2b')][_0xfc13('0x47')]({'where':{'id':_0xcf9b0['params']['id']}})[_0xfc13('0x24')](handleEntityNotFound(_0x541429,null))['then'](saveUpdates(_0xcf9b0['body'],null))[_0xfc13('0x24')](respondWithResult(_0x541429,null))[_0xfc13('0x41')](handleError(_0x541429,null));};exports[_0xfc13('0x48')]=function(_0x4d886f,_0x2f510b){return db['OpenchannelQueueReport'][_0xfc13('0x47')]({'where':{'id':_0x4d886f[_0xfc13('0x43')]['id']}})[_0xfc13('0x24')](handleEntityNotFound(_0x2f510b,null))[_0xfc13('0x24')](removeEntity(_0x2f510b,null))['catch'](handleError(_0x2f510b,null));};exports[_0xfc13('0x49')]=function(_0x226e8a,_0x150942){return db[_0xfc13('0x2b')][_0xfc13('0x49')]()[_0xfc13('0x24')](respondWithResult(_0x150942,null))[_0xfc13('0x41')](handleError(_0x150942,null));}; \ No newline at end of file +var _0x39c4=['model','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key'];(function(_0x512099,_0x3d568c){var _0x157a38=function(_0x24f967){while(--_0x24f967){_0x512099['push'](_0x512099['shift']());}};_0x157a38(++_0x3d568c);}(_0x39c4,0xf2));var _0x439c=function(_0x59426e,_0x5ea686){_0x59426e=_0x59426e-0x0;var _0x4c8cff=_0x39c4[_0x59426e];return _0x4c8cff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x439c('0x0'));var zipdir=require(_0x439c('0x1'));var jsonpatch=require(_0x439c('0x2'));var rp=require(_0x439c('0x3'));var moment=require(_0x439c('0x4'));var BPromise=require(_0x439c('0x5'));var Mustache=require(_0x439c('0x6'));var util=require(_0x439c('0x7'));var path=require(_0x439c('0x8'));var sox=require(_0x439c('0x9'));var csv=require(_0x439c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x439c('0xb'));var _=require(_0x439c('0xc'));var squel=require('squel');var crypto=require(_0x439c('0xd'));var jsforce=require(_0x439c('0xe'));var deskjs=require(_0x439c('0xf'));var toCsv=require(_0x439c('0xa'));var querystring=require('querystring');var Papa=require(_0x439c('0x10'));var Redis=require('ioredis');var authService=require(_0x439c('0x11'));var qs=require(_0x439c('0x12'));var as=require(_0x439c('0x13'));var hardwareService=require(_0x439c('0x14'));var logger=require('../../config/logger')(_0x439c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x439c('0x16'));var db=require(_0x439c('0x17'))['db'];function respondWithStatusCode(_0x1e97df,_0x3ae2fb){_0x3ae2fb=_0x3ae2fb||0xcc;return function(_0x38e87a){if(_0x38e87a){return _0x1e97df[_0x439c('0x18')](_0x3ae2fb);}return _0x1e97df['status'](_0x3ae2fb)[_0x439c('0x19')]();};}function respondWithResult(_0x189edb,_0x458001){_0x458001=_0x458001||0xc8;return function(_0x43120f){if(_0x43120f){return _0x189edb[_0x439c('0x1a')](_0x458001)['json'](_0x43120f);}};}function respondWithFilteredResult(_0x1fcc20,_0x14740f){return function(_0x156e1e){if(_0x156e1e){var _0x5c3a62=typeof _0x14740f['offset']==='undefined'&&typeof _0x14740f[_0x439c('0x1b')]===_0x439c('0x1c');var _0x5edef1=_0x156e1e[_0x439c('0x1d')];var _0x752c29=_0x5c3a62?0x0:_0x14740f[_0x439c('0x1e')];var _0x3162a1=_0x5c3a62?_0x156e1e['count']:_0x14740f['offset']+_0x14740f[_0x439c('0x1b')];var _0x5526c8;if(_0x3162a1>=_0x5edef1){_0x3162a1=_0x5edef1;_0x5526c8=0xc8;}else{_0x5526c8=0xce;}_0x1fcc20[_0x439c('0x1a')](_0x5526c8);return _0x1fcc20[_0x439c('0x1f')](_0x439c('0x20'),_0x752c29+'-'+_0x3162a1+'/'+_0x5edef1)[_0x439c('0x21')](_0x156e1e);}return null;};}function patchUpdates(_0x1b10fa){return function(_0xd4678c){try{jsonpatch['apply'](_0xd4678c,_0x1b10fa,!![]);}catch(_0x20554a){return BPromise[_0x439c('0x22')](_0x20554a);}return _0xd4678c[_0x439c('0x23')]();};}function saveUpdates(_0x2a72f2,_0x4d7205){return function(_0x45df23){if(_0x45df23){return _0x45df23['update'](_0x2a72f2)[_0x439c('0x24')](function(_0x46f764){return _0x46f764;});}return null;};}function removeEntity(_0x5c52f7,_0x576f7c){return function(_0x222f0b){if(_0x222f0b){return _0x222f0b[_0x439c('0x25')]()[_0x439c('0x24')](function(){_0x5c52f7[_0x439c('0x1a')](0xcc)[_0x439c('0x19')]();});}};}function handleEntityNotFound(_0x3d9132,_0x1dafc4){return function(_0x313aae){if(!_0x313aae){_0x3d9132[_0x439c('0x18')](0x194);}return _0x313aae;};}function handleError(_0x281d08,_0x2e3f6d){_0x2e3f6d=_0x2e3f6d||0x1f4;return function(_0x1020ea){logger['error'](_0x1020ea['stack']);if(_0x1020ea[_0x439c('0x26')]){delete _0x1020ea['name'];}_0x281d08['status'](_0x2e3f6d)['send'](_0x1020ea);};}exports[_0x439c('0x27')]=function(_0x34af01,_0xdf31c1){var _0x2e6515={},_0x1d8a37={},_0x190e10={'count':0x0,'rows':[]};var _0x597200=_[_0x439c('0x28')](db[_0x439c('0x29')][_0x439c('0x2a')],function(_0x4763b0){return{'name':_0x4763b0[_0x439c('0x2b')],'type':_0x4763b0[_0x439c('0x2c')][_0x439c('0x2d')]};});_0x1d8a37[_0x439c('0x2e')]=_[_0x439c('0x28')](_0x597200,_0x439c('0x26'));_0x1d8a37[_0x439c('0x2f')]=_[_0x439c('0x30')](_0x34af01[_0x439c('0x2f')]);_0x1d8a37[_0x439c('0x31')]=_['intersection'](_0x1d8a37[_0x439c('0x2e')],_0x1d8a37[_0x439c('0x2f')]);_0x2e6515[_0x439c('0x32')]=_['intersection'](_0x1d8a37[_0x439c('0x2e')],qs[_0x439c('0x33')](_0x34af01[_0x439c('0x2f')][_0x439c('0x33')]));_0x2e6515[_0x439c('0x32')]=_0x2e6515[_0x439c('0x32')][_0x439c('0x34')]?_0x2e6515[_0x439c('0x32')]:_0x1d8a37['model'];if(!_0x34af01[_0x439c('0x2f')]['hasOwnProperty'](_0x439c('0x35'))){_0x2e6515[_0x439c('0x1b')]=qs[_0x439c('0x1b')](_0x34af01[_0x439c('0x2f')]['limit']);_0x2e6515['offset']=qs[_0x439c('0x1e')](_0x34af01[_0x439c('0x2f')][_0x439c('0x1e')]);}_0x2e6515['order']=qs[_0x439c('0x36')](_0x34af01[_0x439c('0x2f')]['sort']);_0x2e6515[_0x439c('0x37')]=qs[_0x439c('0x31')](_[_0x439c('0x38')](_0x34af01[_0x439c('0x2f')],_0x1d8a37[_0x439c('0x31')]),_0x597200);if(_0x34af01[_0x439c('0x2f')][_0x439c('0x39')]){_0x2e6515[_0x439c('0x37')]=_[_0x439c('0x3a')](_0x2e6515[_0x439c('0x37')],{'$or':_[_0x439c('0x28')](_0x597200,function(_0xfa9d0){if(_0xfa9d0[_0x439c('0x2c')]!=='VIRTUAL'){var _0x3d6840={};_0x3d6840[_0xfa9d0[_0x439c('0x26')]]={'$like':'%'+_0x34af01[_0x439c('0x2f')][_0x439c('0x39')]+'%'};return _0x3d6840;}})});}_0x2e6515=_[_0x439c('0x3a')]({},_0x2e6515,_0x34af01[_0x439c('0x3b')]);var _0x3699c6={'where':_0x2e6515[_0x439c('0x37')]};return db[_0x439c('0x29')][_0x439c('0x1d')](_0x3699c6)['then'](function(_0x11f185){_0x190e10[_0x439c('0x1d')]=_0x11f185;if(_0x34af01[_0x439c('0x2f')][_0x439c('0x3c')]){_0x2e6515[_0x439c('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x439c('0x3e')](_0x2e6515);})[_0x439c('0x24')](function(_0x121ada){_0x190e10[_0x439c('0x3f')]=_0x121ada;return _0x190e10;})['then'](respondWithFilteredResult(_0xdf31c1,_0x2e6515))[_0x439c('0x40')](handleError(_0xdf31c1,null));};exports['show']=function(_0x2a1b25,_0x43256b){var _0x5c6593={'raw':!![],'where':{'id':_0x2a1b25[_0x439c('0x41')]['id']}},_0x11e6e2={};_0x11e6e2[_0x439c('0x2e')]=_[_0x439c('0x30')](db[_0x439c('0x29')][_0x439c('0x2a')]);_0x11e6e2['query']=_[_0x439c('0x30')](_0x2a1b25[_0x439c('0x2f')]);_0x11e6e2['filters']=_[_0x439c('0x42')](_0x11e6e2[_0x439c('0x2e')],_0x11e6e2[_0x439c('0x2f')]);_0x5c6593['attributes']=_[_0x439c('0x42')](_0x11e6e2[_0x439c('0x2e')],qs['fields'](_0x2a1b25['query']['fields']));_0x5c6593[_0x439c('0x32')]=_0x5c6593['attributes'][_0x439c('0x34')]?_0x5c6593['attributes']:_0x11e6e2[_0x439c('0x2e')];if(_0x2a1b25[_0x439c('0x2f')][_0x439c('0x3c')]){_0x5c6593['include']=[{'all':!![]}];}_0x5c6593=_[_0x439c('0x3a')]({},_0x5c6593,_0x2a1b25[_0x439c('0x3b')]);return db['OpenchannelQueueReport'][_0x439c('0x43')](_0x5c6593)['then'](handleEntityNotFound(_0x43256b,null))[_0x439c('0x24')](respondWithResult(_0x43256b,null))['catch'](handleError(_0x43256b,null));};exports[_0x439c('0x44')]=function(_0x34504f,_0x38144b){return db[_0x439c('0x29')][_0x439c('0x44')](_0x34504f['body'],{})[_0x439c('0x24')](respondWithResult(_0x38144b,0xc9))[_0x439c('0x40')](handleError(_0x38144b,null));};exports[_0x439c('0x45')]=function(_0x388358,_0x2923a1){if(_0x388358['body']['id']){delete _0x388358['body']['id'];}return db['OpenchannelQueueReport'][_0x439c('0x43')]({'where':{'id':_0x388358[_0x439c('0x41')]['id']}})[_0x439c('0x24')](handleEntityNotFound(_0x2923a1,null))[_0x439c('0x24')](saveUpdates(_0x388358[_0x439c('0x46')],null))['then'](respondWithResult(_0x2923a1,null))[_0x439c('0x40')](handleError(_0x2923a1,null));};exports['destroy']=function(_0x250195,_0x1c394b){return db[_0x439c('0x29')]['find']({'where':{'id':_0x250195['params']['id']}})[_0x439c('0x24')](handleEntityNotFound(_0x1c394b,null))[_0x439c('0x24')](removeEntity(_0x1c394b,null))['catch'](handleError(_0x1c394b,null));};exports[_0x439c('0x47')]=function(_0x4dfd11,_0x1ebd9e){return db[_0x439c('0x29')][_0x439c('0x47')]()[_0x439c('0x24')](respondWithResult(_0x1ebd9e,null))[_0x439c('0x40')](handleError(_0x1ebd9e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4b95f3d..83acebb 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x422eb4,_0x543cec){var _0x9a6aea=function(_0x58ad59){while(--_0x58ad59){_0x422eb4['push'](_0x422eb4['shift']());}};_0x9a6aea(++_0x543cec);}(_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 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x222c0a,_0x14be91){var _0x583ec4=function(_0x5c9848){while(--_0x5c9848){_0x222c0a['push'](_0x222c0a['shift']());}};_0x583ec4(++_0x14be91);}(_0x5fc3,0xa8));var _0x35fc=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x5fc3[_0x21b36c];return _0x236627;};'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 420ff3e..3cff0d3 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','update','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x46b3a2,_0x1c6ffd){var _0x574167=function(_0x41c418){while(--_0x41c418){_0x46b3a2['push'](_0x46b3a2['shift']());}};_0x574167(++_0x1c6ffd);}(_0x5c3c,0x132));var _0xc5c3=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x5c3c[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![]})[_0xc5c3('0xd')](function(_0x3cc612){logger[_0xc5c3('0x15')](_0xc5c3('0x17'),_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x3cc612));_0x28bae6(_0x3cc612);})[_0xc5c3('0x1d')](function(_0x2de266){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x2de266[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2de266['message']));});});};exports[_0xc5c3('0x1e')]=function(_0x38dd9e){var _0x53ab72=this;return new Promise(function(_0x5c7329,_0x23e2fb){return db[_0xc5c3('0x18')][_0xc5c3('0x1f')](_0x38dd9e['body'],{'raw':_0x38dd9e['options']?_0x38dd9e[_0xc5c3('0x1b')][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38dd9e[_0xc5c3('0x1b')]?_0x38dd9e[_0xc5c3('0x1b')]['where']||null:null,'attributes':_0x38dd9e[_0xc5c3('0x1b')]?_0x38dd9e['options'][_0xc5c3('0x20')]||null:null,'limit':_0x38dd9e['options']?_0x38dd9e[_0xc5c3('0x1b')][_0xc5c3('0x21')]||null:null})[_0xc5c3('0xd')](function(_0x4773c5){logger[_0xc5c3('0x15')](_0xc5c3('0x1e'),_0x38dd9e);logger[_0xc5c3('0x22')]('UpdateOpenchannelQueueReport',_0x38dd9e,JSON[_0xc5c3('0x11')](_0x4773c5));_0x5c7329(_0x4773c5);})['catch'](function(_0xc4b134){logger[_0xc5c3('0x12')]('UpdateOpenchannelQueueReport',_0xc4b134['message'],_0x38dd9e);_0x23e2fb(_0x53ab72[_0xc5c3('0x12')](0x1f4,_0xc4b134[_0xc5c3('0x14')]));});});}; \ No newline at end of file +var _0xe2cf=['debug','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','info','UpdateOpenchannelQueueReport','update','where','attributes','limit'];(function(_0x2e426f,_0x28ed37){var _0x273af8=function(_0x30f0c0){while(--_0x30f0c0){_0x2e426f['push'](_0x2e426f['shift']());}};_0x273af8(++_0x28ed37);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x27f569,_0x11892a){_0x27f569=_0x27f569-0x0;var _0x3774c4=_0xe2cf[_0x27f569];return _0x3774c4;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0b97,_0x417bc4,_0x5e5b46){return new BPromise(function(_0x485a24,_0x30aafe){return client[_0xfe2c('0x8')](_0x4e0b97,_0x5e5b46)[_0xfe2c('0x9')](function(_0x562414){logger['info'](_0xfe2c('0xa'),_0x417bc4,_0xfe2c('0xb'));logger['debug'](_0xfe2c('0xc'),_0x417bc4,_0xfe2c('0xb'),JSON[_0xfe2c('0xd')](_0x562414));if(_0x562414[_0xfe2c('0xe')]){if(_0x562414[_0xfe2c('0xe')][_0xfe2c('0xf')]===0x1f4){logger[_0xfe2c('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x417bc4,_0x562414['error']['message']);return _0x30aafe(_0x562414['error'][_0xfe2c('0x10')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x417bc4,_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);return _0x485a24(_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x417bc4,_0xfe2c('0xb'));_0x485a24(_0x562414[_0xfe2c('0x11')][_0xfe2c('0x10')]);}})[_0xfe2c('0x12')](function(_0x565f40){logger[_0xfe2c('0xe')](_0xfe2c('0xa'),_0x417bc4,_0x565f40);_0x30aafe(_0x565f40);});});}exports[_0xfe2c('0x13')]=function(_0x23242b){var _0x36aeec=this;return new Promise(function(_0x13f233,_0x4afea3){return db[_0xfe2c('0x14')][_0xfe2c('0x15')](_0x23242b[_0xfe2c('0x16')],{'raw':_0x23242b[_0xfe2c('0x17')]?_0x23242b['options'][_0xfe2c('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e9137){logger[_0xfe2c('0x19')](_0xfe2c('0x13'),_0x23242b);logger['debug'](_0xfe2c('0x13'),_0x23242b,JSON[_0xfe2c('0xd')](_0x4e9137));_0x13f233(_0x4e9137);})['catch'](function(_0x1bd50e){logger['error'](_0xfe2c('0x13'),_0x1bd50e[_0xfe2c('0x10')],_0x23242b);_0x4afea3(_0x36aeec[_0xfe2c('0xe')](0x1f4,_0x1bd50e[_0xfe2c('0x10')]));});});};exports[_0xfe2c('0x1a')]=function(_0x2ee3b3){var _0x57cd6d=this;return new Promise(function(_0x41a545,_0x45a722){return db[_0xfe2c('0x14')][_0xfe2c('0x1b')](_0x2ee3b3[_0xfe2c('0x16')],{'raw':_0x2ee3b3[_0xfe2c('0x17')]?_0x2ee3b3['options'][_0xfe2c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee3b3['options']?_0x2ee3b3[_0xfe2c('0x17')][_0xfe2c('0x1c')]||null:null,'attributes':_0x2ee3b3[_0xfe2c('0x17')]?_0x2ee3b3['options'][_0xfe2c('0x1d')]||null:null,'limit':_0x2ee3b3[_0xfe2c('0x17')]?_0x2ee3b3['options'][_0xfe2c('0x1e')]||null:null})[_0xfe2c('0x9')](function(_0x3352e8){logger[_0xfe2c('0x19')](_0xfe2c('0x1a'),_0x2ee3b3);logger[_0xfe2c('0x1f')]('UpdateOpenchannelQueueReport',_0x2ee3b3,JSON['stringify'](_0x3352e8));_0x41a545(_0x3352e8);})[_0xfe2c('0x12')](function(_0x13e9a9){logger[_0xfe2c('0xe')](_0xfe2c('0x1a'),_0x13e9a9[_0xfe2c('0x10')],_0x2ee3b3);_0x45a722(_0x57cd6d['error'](0x1f4,_0x13e9a9[_0xfe2c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 38dba7e..2ae3fd3 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 _0x9e2f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete'];(function(_0xb2454d,_0x291753){var _0x5464fb=function(_0x386805){while(--_0x386805){_0xb2454d['push'](_0xb2454d['shift']());}};_0x5464fb(++_0x291753);}(_0x9e2f,0x1cf));var _0xf9e2=function(_0x222975,_0xf418d2){_0x222975=_0x222975-0x0;var _0x4de502=_0x9e2f[_0x222975];return _0x4de502;};'use strict';var multer=require(_0xf9e2('0x0'));var util=require(_0xf9e2('0x1'));var path=require(_0xf9e2('0x2'));var timeout=require(_0xf9e2('0x3'));var express=require(_0xf9e2('0x4'));var router=express[_0xf9e2('0x5')]();var fs_extra=require(_0xf9e2('0x6'));var auth=require(_0xf9e2('0x7'));var interaction=require(_0xf9e2('0x8'));var config=require(_0xf9e2('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0xf9e2('0xa')]('/',auth[_0xf9e2('0xb')](),controller[_0xf9e2('0xc')]);router[_0xf9e2('0xa')](_0xf9e2('0xd'),auth[_0xf9e2('0xb')](),controller[_0xf9e2('0xe')]);router[_0xf9e2('0xa')](_0xf9e2('0xf'),auth[_0xf9e2('0xb')](),controller[_0xf9e2('0x10')]);router[_0xf9e2('0x11')]('/',auth[_0xf9e2('0xb')](),controller['create']);router['put'](_0xf9e2('0xf'),auth[_0xf9e2('0xb')](),controller[_0xf9e2('0x12')]);router[_0xf9e2('0x13')](_0xf9e2('0xf'),auth[_0xf9e2('0xb')](),controller['destroy']);module[_0xf9e2('0x14')]=router; \ No newline at end of file +var _0x1915=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','exports','multer','connect-timeout','express'];(function(_0x2653fa,_0x22d472){var _0x548890=function(_0x2331b4){while(--_0x2331b4){_0x2653fa['push'](_0x2653fa['shift']());}};_0x548890(++_0x22d472);}(_0x1915,0x1c5));var _0x5191=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1915[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x5191('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5191('0x1'));var express=require(_0x5191('0x2'));var router=express['Router']();var fs_extra=require(_0x5191('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5191('0x4'));var config=require(_0x5191('0x5'));var controller=require(_0x5191('0x6'));router[_0x5191('0x7')]('/',auth[_0x5191('0x8')](),controller[_0x5191('0x9')]);router[_0x5191('0x7')]('/describe',auth[_0x5191('0x8')](),controller[_0x5191('0xa')]);router[_0x5191('0x7')]('/:id',auth[_0x5191('0x8')](),controller[_0x5191('0xb')]);router[_0x5191('0xc')]('/',auth['isAuthenticated'](),controller[_0x5191('0xd')]);router[_0x5191('0xe')](_0x5191('0xf'),auth[_0x5191('0x8')](),controller[_0x5191('0x10')]);router[_0x5191('0x11')](_0x5191('0xf'),auth[_0x5191('0x8')](),controller['destroy']);module[_0x5191('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index aef9286..a14b0b8 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x59d68b,_0x21eabc){var _0x411cf3=function(_0x903c7d){while(--_0x903c7d){_0x59d68b['push'](_0x59d68b['shift']());}};_0x411cf3(++_0x21eabc);}(_0xedd9,0xfc));var _0x9edd=function(_0x241596,_0x209dab){_0x241596=_0x241596-0x0;var _0x3e05f5=_0xedd9[_0x241596];return _0x3e05f5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xe180d4,_0x2a45d1){var _0x14ea41=function(_0x1bb39f){while(--_0x1bb39f){_0xe180d4['push'](_0xe180d4['shift']());}};_0x14ea41(++_0x2a45d1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0xcb91[_0x5d9867];return _0x7d2118;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 72fd1f2..e9378e3 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 _0xfc9a=['type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','show','params','includeAll','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','status','set','apply','reject','save','update','then','error','name','OpenchannelTransferReport','rawAttributes','fieldName'];(function(_0x5193fb,_0x3f3140){var _0x28bed0=function(_0x37bee1){while(--_0x37bee1){_0x5193fb['push'](_0x5193fb['shift']());}};_0x28bed0(++_0x3f3140);}(_0xfc9a,0x147));var _0xafc9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfc9a[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xafc9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafc9('0x1'));var jsonpatch=require(_0xafc9('0x2'));var rp=require(_0xafc9('0x3'));var moment=require('moment');var BPromise=require(_0xafc9('0x4'));var Mustache=require(_0xafc9('0x5'));var util=require(_0xafc9('0x6'));var path=require(_0xafc9('0x7'));var sox=require(_0xafc9('0x8'));var csv=require('to-csv');var ejs=require(_0xafc9('0x9'));var fs=require('fs');var fs_extra=require(_0xafc9('0xa'));var _=require(_0xafc9('0xb'));var squel=require(_0xafc9('0xc'));var crypto=require('crypto');var jsforce=require(_0xafc9('0xd'));var deskjs=require(_0xafc9('0xe'));var toCsv=require(_0xafc9('0xf'));var querystring=require('querystring');var Papa=require(_0xafc9('0x10'));var Redis=require(_0xafc9('0x11'));var authService=require(_0xafc9('0x12'));var qs=require(_0xafc9('0x13'));var as=require(_0xafc9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xafc9('0x15'));var utils=require(_0xafc9('0x16'));var config=require(_0xafc9('0x17'));var licenseUtil=require(_0xafc9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd1e35,_0x5b86ab){_0x5b86ab=_0x5b86ab||0xcc;return function(_0x23a48a){if(_0x23a48a){return _0xd1e35[_0xafc9('0x19')](_0x5b86ab);}return _0xd1e35['status'](_0x5b86ab)[_0xafc9('0x1a')]();};}function respondWithResult(_0x9bdc8a,_0x1d7f8a){_0x1d7f8a=_0x1d7f8a||0xc8;return function(_0x562a1f){if(_0x562a1f){return _0x9bdc8a['status'](_0x1d7f8a)[_0xafc9('0x1b')](_0x562a1f);}};}function respondWithFilteredResult(_0x37d209,_0x3e581e){return function(_0x44e0e5){if(_0x44e0e5){var _0x19eff4=typeof _0x3e581e['offset']===_0xafc9('0x1c')&&typeof _0x3e581e[_0xafc9('0x1d')]===_0xafc9('0x1c');var _0x1dac6e=_0x44e0e5[_0xafc9('0x1e')];var _0x58b3d7=_0x19eff4?0x0:_0x3e581e['offset'];var _0x45d01c=_0x19eff4?_0x44e0e5[_0xafc9('0x1e')]:_0x3e581e['offset']+_0x3e581e[_0xafc9('0x1d')];var _0x17ba5d;if(_0x45d01c>=_0x1dac6e){_0x45d01c=_0x1dac6e;_0x17ba5d=0xc8;}else{_0x17ba5d=0xce;}_0x37d209[_0xafc9('0x1f')](_0x17ba5d);return _0x37d209[_0xafc9('0x20')]('Content-Range',_0x58b3d7+'-'+_0x45d01c+'/'+_0x1dac6e)['json'](_0x44e0e5);}return null;};}function patchUpdates(_0xbde185){return function(_0xae0808){try{jsonpatch[_0xafc9('0x21')](_0xae0808,_0xbde185,!![]);}catch(_0x596a87){return BPromise[_0xafc9('0x22')](_0x596a87);}return _0xae0808[_0xafc9('0x23')]();};}function saveUpdates(_0x42a152,_0x2c6e01){return function(_0x31af3d){if(_0x31af3d){return _0x31af3d[_0xafc9('0x24')](_0x42a152)[_0xafc9('0x25')](function(_0x55a4ec){return _0x55a4ec;});}return null;};}function removeEntity(_0x39af68,_0x2adebc){return function(_0x33add3){if(_0x33add3){return _0x33add3['destroy']()[_0xafc9('0x25')](function(){_0x39af68[_0xafc9('0x1f')](0xcc)[_0xafc9('0x1a')]();});}};}function handleEntityNotFound(_0x152f5a,_0x231440){return function(_0x4ad61a){if(!_0x4ad61a){_0x152f5a[_0xafc9('0x19')](0x194);}return _0x4ad61a;};}function handleError(_0x4af5dd,_0x35d71d){_0x35d71d=_0x35d71d||0x1f4;return function(_0x1c28bc){logger[_0xafc9('0x26')](_0x1c28bc['stack']);if(_0x1c28bc[_0xafc9('0x27')]){delete _0x1c28bc[_0xafc9('0x27')];}_0x4af5dd[_0xafc9('0x1f')](_0x35d71d)['send'](_0x1c28bc);};}exports['index']=function(_0x3e1c1f,_0x1c1546){var _0x47b8df={},_0x5895dc={},_0x4db720={'count':0x0,'rows':[]};var _0x15a1a8=_['map'](db[_0xafc9('0x28')][_0xafc9('0x29')],function(_0x37e59d){return{'name':_0x37e59d[_0xafc9('0x2a')],'type':_0x37e59d[_0xafc9('0x2b')][_0xafc9('0x2c')]};});_0x5895dc[_0xafc9('0x2d')]=_[_0xafc9('0x2e')](_0x15a1a8,'name');_0x5895dc[_0xafc9('0x2f')]=_[_0xafc9('0x30')](_0x3e1c1f[_0xafc9('0x2f')]);_0x5895dc[_0xafc9('0x31')]=_['intersection'](_0x5895dc[_0xafc9('0x2d')],_0x5895dc[_0xafc9('0x2f')]);_0x47b8df['attributes']=_[_0xafc9('0x32')](_0x5895dc[_0xafc9('0x2d')],qs[_0xafc9('0x33')](_0x3e1c1f[_0xafc9('0x2f')]['fields']));_0x47b8df[_0xafc9('0x34')]=_0x47b8df[_0xafc9('0x34')][_0xafc9('0x35')]?_0x47b8df[_0xafc9('0x34')]:_0x5895dc[_0xafc9('0x2d')];if(!_0x3e1c1f[_0xafc9('0x2f')][_0xafc9('0x36')]('nolimit')){_0x47b8df[_0xafc9('0x1d')]=qs['limit'](_0x3e1c1f['query'][_0xafc9('0x1d')]);_0x47b8df[_0xafc9('0x37')]=qs[_0xafc9('0x37')](_0x3e1c1f[_0xafc9('0x2f')]['offset']);}_0x47b8df[_0xafc9('0x38')]=qs[_0xafc9('0x39')](_0x3e1c1f[_0xafc9('0x2f')][_0xafc9('0x39')]);_0x47b8df[_0xafc9('0x3a')]=qs[_0xafc9('0x31')](_[_0xafc9('0x3b')](_0x3e1c1f[_0xafc9('0x2f')],_0x5895dc[_0xafc9('0x31')]),_0x15a1a8);if(_0x3e1c1f[_0xafc9('0x2f')][_0xafc9('0x3c')]){_0x47b8df[_0xafc9('0x3a')]=_[_0xafc9('0x3d')](_0x47b8df[_0xafc9('0x3a')],{'$or':_[_0xafc9('0x2e')](_0x15a1a8,function(_0x2d83fa){if(_0x2d83fa['type']!==_0xafc9('0x3e')){var _0x4c491e={};_0x4c491e[_0x2d83fa[_0xafc9('0x27')]]={'$like':'%'+_0x3e1c1f[_0xafc9('0x2f')][_0xafc9('0x3c')]+'%'};return _0x4c491e;}})});}_0x47b8df=_[_0xafc9('0x3d')]({},_0x47b8df,_0x3e1c1f['options']);var _0x4371e4={'where':_0x47b8df[_0xafc9('0x3a')]};return db[_0xafc9('0x28')][_0xafc9('0x1e')](_0x4371e4)[_0xafc9('0x25')](function(_0x462353){_0x4db720[_0xafc9('0x1e')]=_0x462353;if(_0x3e1c1f[_0xafc9('0x2f')]['includeAll']){_0x47b8df['include']=[{'all':!![]}];}return db[_0xafc9('0x28')][_0xafc9('0x3f')](_0x47b8df);})[_0xafc9('0x25')](function(_0x2ca24d){_0x4db720['rows']=_0x2ca24d;return _0x4db720;})[_0xafc9('0x25')](respondWithFilteredResult(_0x1c1546,_0x47b8df))[_0xafc9('0x40')](handleError(_0x1c1546,null));};exports[_0xafc9('0x41')]=function(_0x21d0eb,_0x3b1f7b){var _0xb16834={'raw':!![],'where':{'id':_0x21d0eb[_0xafc9('0x42')]['id']}},_0xfd963a={};_0xfd963a[_0xafc9('0x2d')]=_[_0xafc9('0x30')](db['OpenchannelTransferReport'][_0xafc9('0x29')]);_0xfd963a[_0xafc9('0x2f')]=_[_0xafc9('0x30')](_0x21d0eb[_0xafc9('0x2f')]);_0xfd963a[_0xafc9('0x31')]=_[_0xafc9('0x32')](_0xfd963a[_0xafc9('0x2d')],_0xfd963a[_0xafc9('0x2f')]);_0xb16834[_0xafc9('0x34')]=_['intersection'](_0xfd963a['model'],qs[_0xafc9('0x33')](_0x21d0eb['query'][_0xafc9('0x33')]));_0xb16834['attributes']=_0xb16834[_0xafc9('0x34')]['length']?_0xb16834[_0xafc9('0x34')]:_0xfd963a[_0xafc9('0x2d')];if(_0x21d0eb[_0xafc9('0x2f')][_0xafc9('0x43')]){_0xb16834['include']=[{'all':!![]}];}_0xb16834=_[_0xafc9('0x3d')]({},_0xb16834,_0x21d0eb[_0xafc9('0x44')]);return db[_0xafc9('0x28')][_0xafc9('0x45')](_0xb16834)[_0xafc9('0x25')](handleEntityNotFound(_0x3b1f7b,null))['then'](respondWithResult(_0x3b1f7b,null))[_0xafc9('0x40')](handleError(_0x3b1f7b,null));};exports[_0xafc9('0x46')]=function(_0x2633ce,_0x5c3a3d){return db[_0xafc9('0x28')][_0xafc9('0x46')](_0x2633ce[_0xafc9('0x47')],{})[_0xafc9('0x25')](respondWithResult(_0x5c3a3d,0xc9))[_0xafc9('0x40')](handleError(_0x5c3a3d,null));};exports['update']=function(_0x253bc7,_0x21db88){if(_0x253bc7['body']['id']){delete _0x253bc7[_0xafc9('0x47')]['id'];}return db[_0xafc9('0x28')][_0xafc9('0x45')]({'where':{'id':_0x253bc7['params']['id']}})[_0xafc9('0x25')](handleEntityNotFound(_0x21db88,null))[_0xafc9('0x25')](saveUpdates(_0x253bc7[_0xafc9('0x47')],null))[_0xafc9('0x25')](respondWithResult(_0x21db88,null))['catch'](handleError(_0x21db88,null));};exports[_0xafc9('0x48')]=function(_0x51d967,_0x59ca66){return db[_0xafc9('0x28')][_0xafc9('0x45')]({'where':{'id':_0x51d967[_0xafc9('0x42')]['id']}})[_0xafc9('0x25')](handleEntityNotFound(_0x59ca66,null))['then'](removeEntity(_0x59ca66,null))[_0xafc9('0x40')](handleError(_0x59ca66,null));};exports[_0xafc9('0x49')]=function(_0x5605c0,_0x4460d3){return db['OpenchannelTransferReport']['describe']()[_0xafc9('0x25')](respondWithResult(_0x4460d3,null))['catch'](handleError(_0x4460d3,null));}; \ No newline at end of file +var _0x1c26=['squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','reject','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','model','query','keys','intersection','fields','attributes','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash'];(function(_0x12fd15,_0x59601a){var _0x43d2aa=function(_0x35492c){while(--_0x35492c){_0x12fd15['push'](_0x12fd15['shift']());}};_0x43d2aa(++_0x59601a);}(_0x1c26,0x158));var _0x61c2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c26[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x61c2('0x0'));var rimraf=require(_0x61c2('0x1'));var zipdir=require(_0x61c2('0x2'));var jsonpatch=require(_0x61c2('0x3'));var rp=require(_0x61c2('0x4'));var moment=require(_0x61c2('0x5'));var BPromise=require(_0x61c2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x61c2('0x7'));var sox=require(_0x61c2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61c2('0x9'));var _=require(_0x61c2('0xa'));var squel=require(_0x61c2('0xb'));var crypto=require(_0x61c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x61c2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61c2('0xe'));var Redis=require(_0x61c2('0xf'));var authService=require(_0x61c2('0x10'));var qs=require(_0x61c2('0x11'));var as=require(_0x61c2('0x12'));var hardwareService=require(_0x61c2('0x13'));var logger=require(_0x61c2('0x14'))('api');var utils=require(_0x61c2('0x15'));var config=require(_0x61c2('0x16'));var licenseUtil=require(_0x61c2('0x17'));var db=require(_0x61c2('0x18'))['db'];function respondWithStatusCode(_0x4256e7,_0x21fa0c){_0x21fa0c=_0x21fa0c||0xcc;return function(_0x5aef7c){if(_0x5aef7c){return _0x4256e7[_0x61c2('0x19')](_0x21fa0c);}return _0x4256e7[_0x61c2('0x1a')](_0x21fa0c)[_0x61c2('0x1b')]();};}function respondWithResult(_0x5ee151,_0x21da91){_0x21da91=_0x21da91||0xc8;return function(_0x3b48f7){if(_0x3b48f7){return _0x5ee151[_0x61c2('0x1a')](_0x21da91)['json'](_0x3b48f7);}};}function respondWithFilteredResult(_0xa3fe25,_0x2a88c8){return function(_0x258a89){if(_0x258a89){var _0x5d84fc=typeof _0x2a88c8['offset']===_0x61c2('0x1c')&&typeof _0x2a88c8['limit']===_0x61c2('0x1c');var _0x4bb117=_0x258a89['count'];var _0x5804ab=_0x5d84fc?0x0:_0x2a88c8[_0x61c2('0x1d')];var _0x2ad15e=_0x5d84fc?_0x258a89[_0x61c2('0x1e')]:_0x2a88c8[_0x61c2('0x1d')]+_0x2a88c8[_0x61c2('0x1f')];var _0x434459;if(_0x2ad15e>=_0x4bb117){_0x2ad15e=_0x4bb117;_0x434459=0xc8;}else{_0x434459=0xce;}_0xa3fe25[_0x61c2('0x1a')](_0x434459);return _0xa3fe25[_0x61c2('0x20')](_0x61c2('0x21'),_0x5804ab+'-'+_0x2ad15e+'/'+_0x4bb117)['json'](_0x258a89);}return null;};}function patchUpdates(_0x5c7424){return function(_0x42b09d){try{jsonpatch['apply'](_0x42b09d,_0x5c7424,!![]);}catch(_0xa90c4d){return BPromise[_0x61c2('0x22')](_0xa90c4d);}return _0x42b09d['save']();};}function saveUpdates(_0x547163,_0x40fc4f){return function(_0x2eaca3){if(_0x2eaca3){return _0x2eaca3['update'](_0x547163)[_0x61c2('0x23')](function(_0x38fd62){return _0x38fd62;});}return null;};}function removeEntity(_0x4edc27,_0x5dfc85){return function(_0x68742c){if(_0x68742c){return _0x68742c[_0x61c2('0x24')]()[_0x61c2('0x23')](function(){_0x4edc27[_0x61c2('0x1a')](0xcc)[_0x61c2('0x1b')]();});}};}function handleEntityNotFound(_0x5220b0,_0x19f5a0){return function(_0x38cc2f){if(!_0x38cc2f){_0x5220b0[_0x61c2('0x19')](0x194);}return _0x38cc2f;};}function handleError(_0x10de14,_0x371b05){_0x371b05=_0x371b05||0x1f4;return function(_0x2cd166){logger[_0x61c2('0x25')](_0x2cd166[_0x61c2('0x26')]);if(_0x2cd166[_0x61c2('0x27')]){delete _0x2cd166[_0x61c2('0x27')];}_0x10de14[_0x61c2('0x1a')](_0x371b05)[_0x61c2('0x28')](_0x2cd166);};}exports[_0x61c2('0x29')]=function(_0x56864b,_0x53dac8){var _0x474425={},_0x3ea7e8={},_0x582ca0={'count':0x0,'rows':[]};var _0x551e80=_[_0x61c2('0x2a')](db[_0x61c2('0x2b')][_0x61c2('0x2c')],function(_0x52ff41){return{'name':_0x52ff41['fieldName'],'type':_0x52ff41[_0x61c2('0x2d')]['key']};});_0x3ea7e8[_0x61c2('0x2e')]=_[_0x61c2('0x2a')](_0x551e80,_0x61c2('0x27'));_0x3ea7e8[_0x61c2('0x2f')]=_[_0x61c2('0x30')](_0x56864b['query']);_0x3ea7e8['filters']=_[_0x61c2('0x31')](_0x3ea7e8[_0x61c2('0x2e')],_0x3ea7e8[_0x61c2('0x2f')]);_0x474425['attributes']=_[_0x61c2('0x31')](_0x3ea7e8['model'],qs[_0x61c2('0x32')](_0x56864b[_0x61c2('0x2f')]['fields']));_0x474425[_0x61c2('0x33')]=_0x474425['attributes']['length']?_0x474425[_0x61c2('0x33')]:_0x3ea7e8[_0x61c2('0x2e')];if(!_0x56864b['query']['hasOwnProperty'](_0x61c2('0x34'))){_0x474425[_0x61c2('0x1f')]=qs['limit'](_0x56864b[_0x61c2('0x2f')]['limit']);_0x474425[_0x61c2('0x1d')]=qs[_0x61c2('0x1d')](_0x56864b[_0x61c2('0x2f')]['offset']);}_0x474425['order']=qs[_0x61c2('0x35')](_0x56864b['query'][_0x61c2('0x35')]);_0x474425[_0x61c2('0x36')]=qs[_0x61c2('0x37')](_[_0x61c2('0x38')](_0x56864b[_0x61c2('0x2f')],_0x3ea7e8[_0x61c2('0x37')]),_0x551e80);if(_0x56864b[_0x61c2('0x2f')][_0x61c2('0x39')]){_0x474425[_0x61c2('0x36')]=_[_0x61c2('0x3a')](_0x474425[_0x61c2('0x36')],{'$or':_[_0x61c2('0x2a')](_0x551e80,function(_0x52cc07){if(_0x52cc07['type']!==_0x61c2('0x3b')){var _0x49a7ce={};_0x49a7ce[_0x52cc07['name']]={'$like':'%'+_0x56864b[_0x61c2('0x2f')][_0x61c2('0x39')]+'%'};return _0x49a7ce;}})});}_0x474425=_[_0x61c2('0x3a')]({},_0x474425,_0x56864b[_0x61c2('0x3c')]);var _0x2fb0f7={'where':_0x474425[_0x61c2('0x36')]};return db[_0x61c2('0x2b')][_0x61c2('0x1e')](_0x2fb0f7)[_0x61c2('0x23')](function(_0x53e393){_0x582ca0[_0x61c2('0x1e')]=_0x53e393;if(_0x56864b[_0x61c2('0x2f')][_0x61c2('0x3d')]){_0x474425[_0x61c2('0x3e')]=[{'all':!![]}];}return db[_0x61c2('0x2b')][_0x61c2('0x3f')](_0x474425);})[_0x61c2('0x23')](function(_0x312d13){_0x582ca0[_0x61c2('0x40')]=_0x312d13;return _0x582ca0;})[_0x61c2('0x23')](respondWithFilteredResult(_0x53dac8,_0x474425))['catch'](handleError(_0x53dac8,null));};exports['show']=function(_0x52c0a9,_0x484d3a){var _0x13c5fe={'raw':!![],'where':{'id':_0x52c0a9[_0x61c2('0x41')]['id']}},_0x34c8bc={};_0x34c8bc['model']=_[_0x61c2('0x30')](db['OpenchannelTransferReport'][_0x61c2('0x2c')]);_0x34c8bc['query']=_[_0x61c2('0x30')](_0x52c0a9[_0x61c2('0x2f')]);_0x34c8bc['filters']=_[_0x61c2('0x31')](_0x34c8bc[_0x61c2('0x2e')],_0x34c8bc[_0x61c2('0x2f')]);_0x13c5fe['attributes']=_[_0x61c2('0x31')](_0x34c8bc[_0x61c2('0x2e')],qs['fields'](_0x52c0a9[_0x61c2('0x2f')][_0x61c2('0x32')]));_0x13c5fe[_0x61c2('0x33')]=_0x13c5fe[_0x61c2('0x33')][_0x61c2('0x42')]?_0x13c5fe[_0x61c2('0x33')]:_0x34c8bc[_0x61c2('0x2e')];if(_0x52c0a9['query'][_0x61c2('0x3d')]){_0x13c5fe[_0x61c2('0x3e')]=[{'all':!![]}];}_0x13c5fe=_[_0x61c2('0x3a')]({},_0x13c5fe,_0x52c0a9[_0x61c2('0x3c')]);return db['OpenchannelTransferReport'][_0x61c2('0x43')](_0x13c5fe)[_0x61c2('0x23')](handleEntityNotFound(_0x484d3a,null))['then'](respondWithResult(_0x484d3a,null))[_0x61c2('0x44')](handleError(_0x484d3a,null));};exports[_0x61c2('0x45')]=function(_0x303483,_0x305f03){return db['OpenchannelTransferReport'][_0x61c2('0x45')](_0x303483[_0x61c2('0x46')],{})[_0x61c2('0x23')](respondWithResult(_0x305f03,0xc9))['catch'](handleError(_0x305f03,null));};exports['update']=function(_0x2cc885,_0x3ce485){if(_0x2cc885[_0x61c2('0x46')]['id']){delete _0x2cc885[_0x61c2('0x46')]['id'];}return db[_0x61c2('0x2b')][_0x61c2('0x43')]({'where':{'id':_0x2cc885[_0x61c2('0x41')]['id']}})[_0x61c2('0x23')](handleEntityNotFound(_0x3ce485,null))[_0x61c2('0x23')](saveUpdates(_0x2cc885['body'],null))[_0x61c2('0x23')](respondWithResult(_0x3ce485,null))['catch'](handleError(_0x3ce485,null));};exports['destroy']=function(_0x588175,_0x49e62d){return db['OpenchannelTransferReport'][_0x61c2('0x43')]({'where':{'id':_0x588175[_0x61c2('0x41')]['id']}})[_0x61c2('0x23')](handleEntityNotFound(_0x49e62d,null))[_0x61c2('0x23')](removeEntity(_0x49e62d,null))[_0x61c2('0x44')](handleError(_0x49e62d,null));};exports['describe']=function(_0x230006,_0x54fc29){return db[_0x61c2('0x2b')]['describe']()['then'](respondWithResult(_0x54fc29,null))[_0x61c2('0x44')](handleError(_0x54fc29,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index fcc1fce..fa3f1a4 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 _0xb117=['moment','bluebird','request-promise','./openchannelTransferReport.attributes','exports','define','uniqueid','lodash','util','api'];(function(_0x42d788,_0x4e0f9d){var _0x4cfbc2=function(_0x55ce94){while(--_0x55ce94){_0x42d788['push'](_0x42d788['shift']());}};_0x4cfbc2(++_0x4e0f9d);}(_0xb117,0x18d));var _0x7b11=function(_0x3c8855,_0x132a95){_0x3c8855=_0x3c8855-0x0;var _0x4c7a36=_0xb117[_0x3c8855];return _0x4c7a36;};'use strict';var _=require(_0x7b11('0x0'));var util=require(_0x7b11('0x1'));var logger=require('../../config/logger')(_0x7b11('0x2'));var moment=require(_0x7b11('0x3'));var BPromise=require(_0x7b11('0x4'));var rp=require(_0x7b11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7b11('0x6'));module[_0x7b11('0x7')]=function(_0x1b6915,_0x517fbc){return _0x1b6915[_0x7b11('0x8')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x7b11('0x9'),'fields':[_0x7b11('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4db=['exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes'];(function(_0x27eff5,_0x287c5e){var _0xe9c7ce=function(_0x5a921c){while(--_0x5a921c){_0x27eff5['push'](_0x27eff5['shift']());}};_0xe9c7ce(++_0x287c5e);}(_0xc4db,0x130));var _0xbc4d=function(_0x64507b,_0x4845dc){_0x64507b=_0x64507b-0x0;var _0x2667f6=_0xc4db[_0x64507b];return _0x2667f6;};'use strict';var _=require(_0xbc4d('0x0'));var util=require(_0xbc4d('0x1'));var logger=require(_0xbc4d('0x2'))('api');var moment=require(_0xbc4d('0x3'));var BPromise=require(_0xbc4d('0x4'));var rp=require(_0xbc4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xbc4d('0x7'));module[_0xbc4d('0x8')]=function(_0x97f8a2,_0xbfa6){return _0x97f8a2['define'](_0xbc4d('0x9'),attributes,{'tableName':_0xbc4d('0xa'),'paranoid':![],'indexes':[{'name':_0xbc4d('0xb'),'fields':[_0xbc4d('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 16c5e7a..2dfe173 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 _0x3c94=['error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b6f11,_0x40cdc7){var _0x2b13de=function(_0x2e687c){while(--_0x2e687c){_0x5b6f11['push'](_0x5b6f11['shift']());}};_0x2b13de(++_0x40cdc7);}(_0x3c94,0xcd));var _0x43c9=function(_0x503d48,_0x42e5a9){_0x503d48=_0x503d48-0x0;var _0x59743e=_0x3c94[_0x503d48];return _0x59743e;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var moment=require(_0x43c9('0x2'));var BPromise=require(_0x43c9('0x3'));var rs=require(_0x43c9('0x4'));var fs=require('fs');var Redis=require(_0x43c9('0x5'));var db=require(_0x43c9('0x6'))['db'];var utils=require(_0x43c9('0x7'));var logger=require(_0x43c9('0x8'))(_0x43c9('0x9'));var config=require(_0x43c9('0xa'));var jayson=require(_0x43c9('0xb'));var client=jayson['client'][_0x43c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf03007,_0x695b4f,_0x37c029){return new BPromise(function(_0x383adb,_0x7a0f6b){return client[_0x43c9('0xd')](_0xf03007,_0x37c029)[_0x43c9('0xe')](function(_0x45f3a1){logger['info'](_0x43c9('0xf'),_0x695b4f,_0x43c9('0x10'));logger[_0x43c9('0x11')](_0x43c9('0x12'),_0x695b4f,_0x43c9('0x10'),JSON[_0x43c9('0x13')](_0x45f3a1));if(_0x45f3a1[_0x43c9('0x14')]){if(_0x45f3a1[_0x43c9('0x14')][_0x43c9('0x15')]===0x1f4){logger[_0x43c9('0x14')](_0x43c9('0xf'),_0x695b4f,_0x45f3a1[_0x43c9('0x14')][_0x43c9('0x16')]);return _0x7a0f6b(_0x45f3a1[_0x43c9('0x14')][_0x43c9('0x16')]);}logger[_0x43c9('0x14')](_0x43c9('0xf'),_0x695b4f,_0x45f3a1['error'][_0x43c9('0x16')]);return _0x383adb(_0x45f3a1[_0x43c9('0x14')][_0x43c9('0x16')]);}else{logger[_0x43c9('0x17')](_0x43c9('0xf'),_0x695b4f,'request\x20sent');_0x383adb(_0x45f3a1['result'][_0x43c9('0x16')]);}})[_0x43c9('0x18')](function(_0x15035a){logger[_0x43c9('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x695b4f,_0x15035a);_0x7a0f6b(_0x15035a);});});} \ No newline at end of file +var _0x45d1=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','lodash','util','bluebird'];(function(_0x27526e,_0x3f2c11){var _0x1db58f=function(_0x31f9c1){while(--_0x31f9c1){_0x27526e['push'](_0x27526e['shift']());}};_0x1db58f(++_0x3f2c11);}(_0x45d1,0x1cb));var _0x145d=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x45d1[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0x145d('0x0'));var util=require(_0x145d('0x1'));var moment=require('moment');var BPromise=require(_0x145d('0x2'));var rs=require(_0x145d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x145d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x145d('0x5'))(_0x145d('0x6'));var config=require(_0x145d('0x7'));var jayson=require(_0x145d('0x8'));var client=jayson[_0x145d('0x9')][_0x145d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc4161,_0x45ff66,_0x46a729){return new BPromise(function(_0x47eadc,_0x4ef552){return client['request'](_0xbc4161,_0x46a729)[_0x145d('0xb')](function(_0x183afe){logger[_0x145d('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x45ff66,_0x145d('0xd'));logger['debug'](_0x145d('0xe'),_0x45ff66,_0x145d('0xd'),JSON[_0x145d('0xf')](_0x183afe));if(_0x183afe[_0x145d('0x10')]){if(_0x183afe['error'][_0x145d('0x11')]===0x1f4){logger[_0x145d('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x45ff66,_0x183afe[_0x145d('0x10')][_0x145d('0x12')]);return _0x4ef552(_0x183afe[_0x145d('0x10')][_0x145d('0x12')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x45ff66,_0x183afe[_0x145d('0x10')][_0x145d('0x12')]);return _0x47eadc(_0x183afe[_0x145d('0x10')]['message']);}else{logger[_0x145d('0xc')](_0x145d('0x13'),_0x45ff66,_0x145d('0xd'));_0x47eadc(_0x183afe[_0x145d('0x14')][_0x145d('0x12')]);}})['catch'](function(_0x1c9ee2){logger[_0x145d('0x10')](_0x145d('0x13'),_0x45ff66,_0x1c9ee2);_0x4ef552(_0x1c9ee2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index e71810c..0f2be83 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 _0x48f9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','index','get','/:id','isAuthenticated','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x4cf531,_0x3e7912){var _0x419191=function(_0x3377da){while(--_0x3377da){_0x4cf531['push'](_0x4cf531['shift']());}};_0x419191(++_0x3e7912);}(_0x48f9,0x81));var _0x948f=function(_0x321c9d,_0x766391){_0x321c9d=_0x321c9d-0x0;var _0x52004e=_0x48f9[_0x321c9d];return _0x52004e;};'use strict';var multer=require(_0x948f('0x0'));var util=require(_0x948f('0x1'));var path=require(_0x948f('0x2'));var timeout=require(_0x948f('0x3'));var express=require(_0x948f('0x4'));var router=express['Router']();var fs_extra=require(_0x948f('0x5'));var auth=require(_0x948f('0x6'));var interaction=require(_0x948f('0x7'));var config=require(_0x948f('0x8'));var controller=require(_0x948f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x948f('0xa')]);router[_0x948f('0xb')](_0x948f('0xc'),auth[_0x948f('0xd')](),controller['show']);router[_0x948f('0xe')]('/',auth['isAuthenticated'](),controller[_0x948f('0xf')]);router[_0x948f('0x10')](_0x948f('0xc'),auth[_0x948f('0xd')](),controller[_0x948f('0x11')]);router['delete'](_0x948f('0xc'),auth[_0x948f('0xd')](),controller[_0x948f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3b2d=['isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','show','post','put'];(function(_0x5ab550,_0x1a7b38){var _0x19479a=function(_0x4c4fb8){while(--_0x4c4fb8){_0x5ab550['push'](_0x5ab550['shift']());}};_0x19479a(++_0x1a7b38);}(_0x3b2d,0x9c));var _0xd3b2=function(_0xf98ab6,_0x346616){_0xf98ab6=_0xf98ab6-0x0;var _0x184de2=_0x3b2d[_0xf98ab6];return _0x184de2;};'use strict';var multer=require(_0xd3b2('0x0'));var util=require(_0xd3b2('0x1'));var path=require(_0xd3b2('0x2'));var timeout=require(_0xd3b2('0x3'));var express=require(_0xd3b2('0x4'));var router=express['Router']();var fs_extra=require(_0xd3b2('0x5'));var auth=require(_0xd3b2('0x6'));var interaction=require(_0xd3b2('0x7'));var config=require(_0xd3b2('0x8'));var controller=require(_0xd3b2('0x9'));router[_0xd3b2('0xa')]('/',auth['isAuthenticated'](),controller[_0xd3b2('0xb')]);router[_0xd3b2('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd3b2('0xc')]);router[_0xd3b2('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd3b2('0xe')]('/:id',auth[_0xd3b2('0xf')](),controller[_0xd3b2('0x10')]);router['delete']('/:id',auth[_0xd3b2('0xf')](),controller[_0xd3b2('0x11')]);module[_0xd3b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 37b4866..631ff0e 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 _0xa5a3=['exports','STRING','name','sequelize'];(function(_0x193e59,_0x16408f){var _0x578fb9=function(_0x1cf081){while(--_0x1cf081){_0x193e59['push'](_0x193e59['shift']());}};_0x578fb9(++_0x16408f);}(_0xa5a3,0x14f));var _0x3a5a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa5a3[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x3a5a('0x0'));module[_0x3a5a('0x1')]={'name':{'type':Sequelize[_0x3a5a('0x2')],'unique':_0x3a5a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3a5a('0x2')]}}; \ No newline at end of file +var _0x4b1e=['exports','STRING','name'];(function(_0x4cff1b,_0x22125e){var _0x17d4cc=function(_0x4ce3ca){while(--_0x4ce3ca){_0x4cff1b['push'](_0x4cff1b['shift']());}};_0x17d4cc(++_0x22125e);}(_0x4b1e,0xea));var _0xe4b1=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x4b1e[_0x289e64];return _0x30246c;};'use strict';var Sequelize=require('sequelize');module[_0xe4b1('0x0')]={'name':{'type':Sequelize[_0xe4b1('0x1')],'unique':_0xe4b1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xe4b1('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e0bc017..c310289 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 _0x3d81=['pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','rimraf','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','apply','reject','update','then','destroy','get','end','error','name','send','index','map','Pause','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x41bdb7,_0x2d3c1c){var _0xa1e594=function(_0x4aa014){while(--_0x4aa014){_0x41bdb7['push'](_0x41bdb7['shift']());}};_0xa1e594(++_0x2d3c1c);}(_0x3d81,0x1dd));var _0x13d8=function(_0x40ae6d,_0x4d9242){_0x40ae6d=_0x40ae6d-0x0;var _0x58d456=_0x3d81[_0x40ae6d];return _0x58d456;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13d8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13d8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x13d8('0x2'));var util=require(_0x13d8('0x3'));var path=require('path');var sox=require(_0x13d8('0x4'));var csv=require(_0x13d8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13d8('0x6'));var _=require(_0x13d8('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x13d8('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x13d8('0x5'));var querystring=require(_0x13d8('0x9'));var Papa=require(_0x13d8('0xa'));var Redis=require('ioredis');var authService=require(_0x13d8('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x13d8('0xc'));var hardwareService=require(_0x13d8('0xd'));var logger=require(_0x13d8('0xe'))(_0x13d8('0xf'));var utils=require(_0x13d8('0x10'));var config=require(_0x13d8('0x11'));var licenseUtil=require(_0x13d8('0x12'));var db=require(_0x13d8('0x13'))['db'];function respondWithStatusCode(_0x1bff55,_0x5c46ec){_0x5c46ec=_0x5c46ec||0xcc;return function(_0x4a7bc9){if(_0x4a7bc9){return _0x1bff55['sendStatus'](_0x5c46ec);}return _0x1bff55['status'](_0x5c46ec)['end']();};}function respondWithResult(_0x27cb15,_0x380325){_0x380325=_0x380325||0xc8;return function(_0x11ae2c){if(_0x11ae2c){return _0x27cb15[_0x13d8('0x14')](_0x380325)[_0x13d8('0x15')](_0x11ae2c);}};}function respondWithFilteredResult(_0x30a69c,_0x12c58b){return function(_0x595507){if(_0x595507){var _0x161a14=typeof _0x12c58b[_0x13d8('0x16')]===_0x13d8('0x17')&&typeof _0x12c58b['limit']===_0x13d8('0x17');var _0x336e0e=_0x595507['count'];var _0x29173f=_0x161a14?0x0:_0x12c58b[_0x13d8('0x16')];var _0x1496f0=_0x161a14?_0x595507[_0x13d8('0x18')]:_0x12c58b[_0x13d8('0x16')]+_0x12c58b['limit'];var _0x1a6956;if(_0x1496f0>=_0x336e0e){_0x1496f0=_0x336e0e;_0x1a6956=0xc8;}else{_0x1a6956=0xce;}_0x30a69c[_0x13d8('0x14')](_0x1a6956);return _0x30a69c[_0x13d8('0x19')]('Content-Range',_0x29173f+'-'+_0x1496f0+'/'+_0x336e0e)[_0x13d8('0x15')](_0x595507);}return null;};}function patchUpdates(_0x25dcd0){return function(_0x3f307b){try{jsonpatch[_0x13d8('0x1a')](_0x3f307b,_0x25dcd0,!![]);}catch(_0x1f399d){return BPromise[_0x13d8('0x1b')](_0x1f399d);}return _0x3f307b['save']();};}function saveUpdates(_0x38f5eb,_0xd5773f){return function(_0x47871f){if(_0x47871f){return _0x47871f[_0x13d8('0x1c')](_0x38f5eb)[_0x13d8('0x1d')](function(_0x12a1de){return _0x12a1de;});}return null;};}function removeEntity(_0x3ec3f8,_0xfdae0a){return function(_0x1cbf96){if(_0x1cbf96){return _0x1cbf96[_0x13d8('0x1e')]()[_0x13d8('0x1d')](function(){var _0x37b28b=_0x1cbf96[_0x13d8('0x1f')]({'plain':!![]});var _0x2a35f3='Pauses';return db['UserProfileResource']['destroy']({'where':{'type':_0x2a35f3,'resourceId':_0x37b28b['id']}})[_0x13d8('0x1d')](function(){return _0x1cbf96;});})[_0x13d8('0x1d')](function(){_0x3ec3f8[_0x13d8('0x14')](0xcc)[_0x13d8('0x20')]();});}};}function handleEntityNotFound(_0x465dd6,_0x2c8564){return function(_0x221f89){if(!_0x221f89){_0x465dd6['sendStatus'](0x194);}return _0x221f89;};}function handleError(_0x5edcb5,_0x834092){_0x834092=_0x834092||0x1f4;return function(_0x47baa7){logger[_0x13d8('0x21')](_0x47baa7['stack']);if(_0x47baa7[_0x13d8('0x22')]){delete _0x47baa7['name'];}_0x5edcb5[_0x13d8('0x14')](_0x834092)[_0x13d8('0x23')](_0x47baa7);};}exports[_0x13d8('0x24')]=function(_0x5f3a01,_0x3ef271){var _0x290903={},_0x1ab8ab={},_0x3f6750={'count':0x0,'rows':[]};var _0x45c0dd=_[_0x13d8('0x25')](db[_0x13d8('0x26')]['rawAttributes'],function(_0x114a35){return{'name':_0x114a35[_0x13d8('0x27')],'type':_0x114a35[_0x13d8('0x28')][_0x13d8('0x29')]};});_0x1ab8ab['model']=_[_0x13d8('0x25')](_0x45c0dd,_0x13d8('0x22'));_0x1ab8ab[_0x13d8('0x2a')]=_['keys'](_0x5f3a01['query']);_0x1ab8ab[_0x13d8('0x2b')]=_[_0x13d8('0x2c')](_0x1ab8ab[_0x13d8('0x2d')],_0x1ab8ab['query']);_0x290903[_0x13d8('0x2e')]=_[_0x13d8('0x2c')](_0x1ab8ab[_0x13d8('0x2d')],qs[_0x13d8('0x2f')](_0x5f3a01['query'][_0x13d8('0x2f')]));_0x290903[_0x13d8('0x2e')]=_0x290903[_0x13d8('0x2e')][_0x13d8('0x30')]?_0x290903[_0x13d8('0x2e')]:_0x1ab8ab[_0x13d8('0x2d')];if(!_0x5f3a01[_0x13d8('0x2a')][_0x13d8('0x31')](_0x13d8('0x32'))){_0x290903[_0x13d8('0x33')]=qs[_0x13d8('0x33')](_0x5f3a01['query'][_0x13d8('0x33')]);_0x290903[_0x13d8('0x16')]=qs[_0x13d8('0x16')](_0x5f3a01[_0x13d8('0x2a')]['offset']);}_0x290903[_0x13d8('0x34')]=qs[_0x13d8('0x35')](_0x5f3a01['query']['sort']);_0x290903[_0x13d8('0x36')]=qs['filters'](_[_0x13d8('0x37')](_0x5f3a01[_0x13d8('0x2a')],_0x1ab8ab['filters']),_0x45c0dd);if(_0x5f3a01['query'][_0x13d8('0x38')]){_0x290903[_0x13d8('0x36')]=_[_0x13d8('0x39')](_0x290903[_0x13d8('0x36')],{'$or':_['map'](_0x45c0dd,function(_0x55fb11){if(_0x55fb11[_0x13d8('0x28')]!==_0x13d8('0x3a')){var _0x367503={};_0x367503[_0x55fb11[_0x13d8('0x22')]]={'$like':'%'+_0x5f3a01[_0x13d8('0x2a')][_0x13d8('0x38')]+'%'};return _0x367503;}})});}_0x290903=_[_0x13d8('0x39')]({},_0x290903,_0x5f3a01[_0x13d8('0x3b')]);var _0x23b4dd={'where':_0x290903[_0x13d8('0x36')]};return db[_0x13d8('0x26')][_0x13d8('0x18')](_0x23b4dd)[_0x13d8('0x1d')](function(_0x5cd62f){_0x3f6750[_0x13d8('0x18')]=_0x5cd62f;if(_0x5f3a01['query'][_0x13d8('0x3c')]){_0x290903['include']=[{'all':!![]}];}return db[_0x13d8('0x26')]['findAll'](_0x290903);})[_0x13d8('0x1d')](function(_0x14c6b1){_0x3f6750['rows']=_0x14c6b1;return _0x3f6750;})[_0x13d8('0x1d')](respondWithFilteredResult(_0x3ef271,_0x290903))[_0x13d8('0x3d')](handleError(_0x3ef271,null));};exports[_0x13d8('0x3e')]=function(_0x3cb5c5,_0x459e90){var _0x3eeec8={'raw':!![],'where':{'id':_0x3cb5c5[_0x13d8('0x3f')]['id']}},_0x3b7282={};_0x3b7282[_0x13d8('0x2d')]=_['keys'](db[_0x13d8('0x26')][_0x13d8('0x40')]);_0x3b7282[_0x13d8('0x2a')]=_[_0x13d8('0x41')](_0x3cb5c5[_0x13d8('0x2a')]);_0x3b7282[_0x13d8('0x2b')]=_[_0x13d8('0x2c')](_0x3b7282[_0x13d8('0x2d')],_0x3b7282[_0x13d8('0x2a')]);_0x3eeec8[_0x13d8('0x2e')]=_[_0x13d8('0x2c')](_0x3b7282[_0x13d8('0x2d')],qs[_0x13d8('0x2f')](_0x3cb5c5[_0x13d8('0x2a')][_0x13d8('0x2f')]));_0x3eeec8[_0x13d8('0x2e')]=_0x3eeec8[_0x13d8('0x2e')][_0x13d8('0x30')]?_0x3eeec8['attributes']:_0x3b7282['model'];if(_0x3cb5c5[_0x13d8('0x2a')][_0x13d8('0x3c')]){_0x3eeec8['include']=[{'all':!![]}];}_0x3eeec8=_[_0x13d8('0x39')]({},_0x3eeec8,_0x3cb5c5[_0x13d8('0x3b')]);return db[_0x13d8('0x26')]['find'](_0x3eeec8)[_0x13d8('0x1d')](handleEntityNotFound(_0x459e90,null))[_0x13d8('0x1d')](respondWithResult(_0x459e90,null))['catch'](handleError(_0x459e90,null));};exports[_0x13d8('0x42')]=function(_0xb4f4f4,_0x96d1e3){return db[_0x13d8('0x26')]['create'](_0xb4f4f4[_0x13d8('0x43')],{})[_0x13d8('0x1d')](function(_0x4439af){var _0x40082f=_0xb4f4f4['user'][_0x13d8('0x1f')]({'plain':!![]});if(!_0x40082f)throw new Error(_0x13d8('0x44'));if(_0x40082f[_0x13d8('0x45')]===_0x13d8('0x46')){var _0x169b54=_0x4439af[_0x13d8('0x1f')]({'plain':!![]});var _0x319853='Pauses';return db[_0x13d8('0x47')][_0x13d8('0x48')]({'where':{'name':_0x319853,'userProfileId':_0x40082f[_0x13d8('0x49')]},'raw':!![]})[_0x13d8('0x1d')](function(_0x45898f){if(_0x45898f&&_0x45898f[_0x13d8('0x4a')]===0x0){return db[_0x13d8('0x4b')][_0x13d8('0x42')]({'name':_0x169b54[_0x13d8('0x22')],'resourceId':_0x169b54['id'],'type':_0x45898f[_0x13d8('0x22')],'sectionId':_0x45898f['id']},{})[_0x13d8('0x1d')](function(){return _0x4439af;});}else{return _0x4439af;}})[_0x13d8('0x3d')](function(_0xbc1fd6){logger[_0x13d8('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbc1fd6);throw _0xbc1fd6;});}return _0x4439af;})[_0x13d8('0x1d')](respondWithResult(_0x96d1e3,0xc9))[_0x13d8('0x3d')](handleError(_0x96d1e3,null));};exports[_0x13d8('0x1c')]=function(_0x21f742,_0x1e97ef){if(_0x21f742[_0x13d8('0x43')]['id']){delete _0x21f742[_0x13d8('0x43')]['id'];}return db['Pause'][_0x13d8('0x48')]({'where':{'id':_0x21f742['params']['id']}})[_0x13d8('0x1d')](handleEntityNotFound(_0x1e97ef,null))[_0x13d8('0x1d')](saveUpdates(_0x21f742['body'],null))[_0x13d8('0x1d')](respondWithResult(_0x1e97ef,null))[_0x13d8('0x3d')](handleError(_0x1e97ef,null));};exports[_0x13d8('0x1e')]=function(_0x46570e,_0x38db1a){return db[_0x13d8('0x26')][_0x13d8('0x48')]({'where':{'id':_0x46570e[_0x13d8('0x3f')]['id']}})[_0x13d8('0x1d')](handleEntityNotFound(_0x38db1a,null))[_0x13d8('0x1d')](removeEntity(_0x38db1a,null))[_0x13d8('0x3d')](handleError(_0x38db1a,null));}; \ No newline at end of file +var _0x818d=['UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Pauses','UserProfileResource','error','name','send','index','map','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x818d,0x1ae));var _0xd818=function(_0x43d6b8,_0x15d2a7){_0x43d6b8=_0x43d6b8-0x0;var _0x45673c=_0x818d[_0x43d6b8];return _0x45673c;};'use strict';var emlformat=require(_0xd818('0x0'));var rimraf=require(_0xd818('0x1'));var zipdir=require(_0xd818('0x2'));var jsonpatch=require(_0xd818('0x3'));var rp=require(_0xd818('0x4'));var moment=require('moment');var BPromise=require(_0xd818('0x5'));var Mustache=require(_0xd818('0x6'));var util=require(_0xd818('0x7'));var path=require(_0xd818('0x8'));var sox=require(_0xd818('0x9'));var csv=require(_0xd818('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd818('0xb'));var _=require('lodash');var squel=require(_0xd818('0xc'));var crypto=require(_0xd818('0xd'));var jsforce=require(_0xd818('0xe'));var deskjs=require(_0xd818('0xf'));var toCsv=require(_0xd818('0xa'));var querystring=require(_0xd818('0x10'));var Papa=require('papaparse');var Redis=require(_0xd818('0x11'));var authService=require(_0xd818('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd818('0x13'));var hardwareService=require(_0xd818('0x14'));var logger=require(_0xd818('0x15'))(_0xd818('0x16'));var utils=require(_0xd818('0x17'));var config=require(_0xd818('0x18'));var licenseUtil=require(_0xd818('0x19'));var db=require(_0xd818('0x1a'))['db'];function respondWithStatusCode(_0x2c0970,_0x44dcf0){_0x44dcf0=_0x44dcf0||0xcc;return function(_0x2882fb){if(_0x2882fb){return _0x2c0970[_0xd818('0x1b')](_0x44dcf0);}return _0x2c0970[_0xd818('0x1c')](_0x44dcf0)[_0xd818('0x1d')]();};}function respondWithResult(_0x590035,_0x1eae0d){_0x1eae0d=_0x1eae0d||0xc8;return function(_0x11956b){if(_0x11956b){return _0x590035[_0xd818('0x1c')](_0x1eae0d)[_0xd818('0x1e')](_0x11956b);}};}function respondWithFilteredResult(_0x3ebb31,_0x520ca0){return function(_0x5f36aa){if(_0x5f36aa){var _0x452f8a=typeof _0x520ca0[_0xd818('0x1f')]===_0xd818('0x20')&&typeof _0x520ca0[_0xd818('0x21')]==='undefined';var _0x58b7c7=_0x5f36aa['count'];var _0x1e7dc0=_0x452f8a?0x0:_0x520ca0[_0xd818('0x1f')];var _0x377901=_0x452f8a?_0x5f36aa[_0xd818('0x22')]:_0x520ca0[_0xd818('0x1f')]+_0x520ca0[_0xd818('0x21')];var _0x4fa98a;if(_0x377901>=_0x58b7c7){_0x377901=_0x58b7c7;_0x4fa98a=0xc8;}else{_0x4fa98a=0xce;}_0x3ebb31[_0xd818('0x1c')](_0x4fa98a);return _0x3ebb31[_0xd818('0x23')]('Content-Range',_0x1e7dc0+'-'+_0x377901+'/'+_0x58b7c7)['json'](_0x5f36aa);}return null;};}function patchUpdates(_0x952a7f){return function(_0x39ccfe){try{jsonpatch[_0xd818('0x24')](_0x39ccfe,_0x952a7f,!![]);}catch(_0x49e7db){return BPromise[_0xd818('0x25')](_0x49e7db);}return _0x39ccfe[_0xd818('0x26')]();};}function saveUpdates(_0x389e3b,_0x4dce4d){return function(_0x49279c){if(_0x49279c){return _0x49279c[_0xd818('0x27')](_0x389e3b)[_0xd818('0x28')](function(_0x2415c1){return _0x2415c1;});}return null;};}function removeEntity(_0x7cea18,_0x31024f){return function(_0x4a1238){if(_0x4a1238){return _0x4a1238['destroy']()[_0xd818('0x28')](function(){var _0x4d432d=_0x4a1238[_0xd818('0x29')]({'plain':!![]});var _0x4d9f52=_0xd818('0x2a');return db[_0xd818('0x2b')]['destroy']({'where':{'type':_0x4d9f52,'resourceId':_0x4d432d['id']}})[_0xd818('0x28')](function(){return _0x4a1238;});})[_0xd818('0x28')](function(){_0x7cea18[_0xd818('0x1c')](0xcc)[_0xd818('0x1d')]();});}};}function handleEntityNotFound(_0x3ccffb,_0x4d46c7){return function(_0x57324a){if(!_0x57324a){_0x3ccffb[_0xd818('0x1b')](0x194);}return _0x57324a;};}function handleError(_0x3a8d78,_0x537b3e){_0x537b3e=_0x537b3e||0x1f4;return function(_0x2b108d){logger[_0xd818('0x2c')](_0x2b108d['stack']);if(_0x2b108d[_0xd818('0x2d')]){delete _0x2b108d[_0xd818('0x2d')];}_0x3a8d78[_0xd818('0x1c')](_0x537b3e)[_0xd818('0x2e')](_0x2b108d);};}exports[_0xd818('0x2f')]=function(_0x54b833,_0x316bc0){var _0x954f52={},_0x29328f={},_0x18a5a2={'count':0x0,'rows':[]};var _0x17a6a1=_[_0xd818('0x30')](db['Pause']['rawAttributes'],function(_0x1fd5b1){return{'name':_0x1fd5b1['fieldName'],'type':_0x1fd5b1[_0xd818('0x31')][_0xd818('0x32')]};});_0x29328f[_0xd818('0x33')]=_['map'](_0x17a6a1,_0xd818('0x2d'));_0x29328f[_0xd818('0x34')]=_['keys'](_0x54b833[_0xd818('0x34')]);_0x29328f['filters']=_[_0xd818('0x35')](_0x29328f[_0xd818('0x33')],_0x29328f[_0xd818('0x34')]);_0x954f52['attributes']=_[_0xd818('0x35')](_0x29328f[_0xd818('0x33')],qs[_0xd818('0x36')](_0x54b833[_0xd818('0x34')][_0xd818('0x36')]));_0x954f52[_0xd818('0x37')]=_0x954f52['attributes']['length']?_0x954f52[_0xd818('0x37')]:_0x29328f[_0xd818('0x33')];if(!_0x54b833[_0xd818('0x34')][_0xd818('0x38')](_0xd818('0x39'))){_0x954f52[_0xd818('0x21')]=qs[_0xd818('0x21')](_0x54b833[_0xd818('0x34')][_0xd818('0x21')]);_0x954f52['offset']=qs['offset'](_0x54b833[_0xd818('0x34')]['offset']);}_0x954f52['order']=qs[_0xd818('0x3a')](_0x54b833[_0xd818('0x34')][_0xd818('0x3a')]);_0x954f52[_0xd818('0x3b')]=qs[_0xd818('0x3c')](_[_0xd818('0x3d')](_0x54b833[_0xd818('0x34')],_0x29328f[_0xd818('0x3c')]),_0x17a6a1);if(_0x54b833[_0xd818('0x34')][_0xd818('0x3e')]){_0x954f52[_0xd818('0x3b')]=_[_0xd818('0x3f')](_0x954f52[_0xd818('0x3b')],{'$or':_[_0xd818('0x30')](_0x17a6a1,function(_0x325b1a){if(_0x325b1a['type']!==_0xd818('0x40')){var _0x363f09={};_0x363f09[_0x325b1a[_0xd818('0x2d')]]={'$like':'%'+_0x54b833[_0xd818('0x34')][_0xd818('0x3e')]+'%'};return _0x363f09;}})});}_0x954f52=_[_0xd818('0x3f')]({},_0x954f52,_0x54b833[_0xd818('0x41')]);var _0x308f6a={'where':_0x954f52[_0xd818('0x3b')]};return db[_0xd818('0x42')][_0xd818('0x22')](_0x308f6a)[_0xd818('0x28')](function(_0x3714d0){_0x18a5a2[_0xd818('0x22')]=_0x3714d0;if(_0x54b833[_0xd818('0x34')][_0xd818('0x43')]){_0x954f52[_0xd818('0x44')]=[{'all':!![]}];}return db[_0xd818('0x42')][_0xd818('0x45')](_0x954f52);})['then'](function(_0x27a85d){_0x18a5a2[_0xd818('0x46')]=_0x27a85d;return _0x18a5a2;})['then'](respondWithFilteredResult(_0x316bc0,_0x954f52))['catch'](handleError(_0x316bc0,null));};exports[_0xd818('0x47')]=function(_0x545170,_0x52cef8){var _0x54daef={'raw':!![],'where':{'id':_0x545170[_0xd818('0x48')]['id']}},_0x39897c={};_0x39897c[_0xd818('0x33')]=_[_0xd818('0x49')](db[_0xd818('0x42')]['rawAttributes']);_0x39897c[_0xd818('0x34')]=_['keys'](_0x545170[_0xd818('0x34')]);_0x39897c[_0xd818('0x3c')]=_[_0xd818('0x35')](_0x39897c['model'],_0x39897c[_0xd818('0x34')]);_0x54daef[_0xd818('0x37')]=_['intersection'](_0x39897c[_0xd818('0x33')],qs[_0xd818('0x36')](_0x545170['query'][_0xd818('0x36')]));_0x54daef[_0xd818('0x37')]=_0x54daef[_0xd818('0x37')]['length']?_0x54daef[_0xd818('0x37')]:_0x39897c['model'];if(_0x545170[_0xd818('0x34')][_0xd818('0x43')]){_0x54daef['include']=[{'all':!![]}];}_0x54daef=_[_0xd818('0x3f')]({},_0x54daef,_0x545170[_0xd818('0x41')]);return db[_0xd818('0x42')][_0xd818('0x4a')](_0x54daef)[_0xd818('0x28')](handleEntityNotFound(_0x52cef8,null))['then'](respondWithResult(_0x52cef8,null))['catch'](handleError(_0x52cef8,null));};exports['create']=function(_0x42dc64,_0x25316b){return db[_0xd818('0x42')][_0xd818('0x4b')](_0x42dc64[_0xd818('0x4c')],{})[_0xd818('0x28')](function(_0x13ea06){var _0x50e88f=_0x42dc64[_0xd818('0x4d')][_0xd818('0x29')]({'plain':!![]});if(!_0x50e88f)throw new Error(_0xd818('0x4e'));if(_0x50e88f[_0xd818('0x4f')]===_0xd818('0x4d')){var _0x36cbdb=_0x13ea06[_0xd818('0x29')]({'plain':!![]});var _0xa12799=_0xd818('0x2a');return db[_0xd818('0x50')]['find']({'where':{'name':_0xa12799,'userProfileId':_0x50e88f[_0xd818('0x51')]},'raw':!![]})['then'](function(_0x5644a6){if(_0x5644a6&&_0x5644a6[_0xd818('0x52')]===0x0){return db[_0xd818('0x2b')][_0xd818('0x4b')]({'name':_0x36cbdb[_0xd818('0x2d')],'resourceId':_0x36cbdb['id'],'type':_0x5644a6[_0xd818('0x2d')],'sectionId':_0x5644a6['id']},{})[_0xd818('0x28')](function(){return _0x13ea06;});}else{return _0x13ea06;}})[_0xd818('0x53')](function(_0x5470c2){logger[_0xd818('0x2c')](_0xd818('0x54'),_0x5470c2);throw _0x5470c2;});}return _0x13ea06;})['then'](respondWithResult(_0x25316b,0xc9))[_0xd818('0x53')](handleError(_0x25316b,null));};exports[_0xd818('0x27')]=function(_0x150468,_0x74af55){if(_0x150468['body']['id']){delete _0x150468[_0xd818('0x4c')]['id'];}return db[_0xd818('0x42')][_0xd818('0x4a')]({'where':{'id':_0x150468[_0xd818('0x48')]['id']}})[_0xd818('0x28')](handleEntityNotFound(_0x74af55,null))[_0xd818('0x28')](saveUpdates(_0x150468[_0xd818('0x4c')],null))['then'](respondWithResult(_0x74af55,null))['catch'](handleError(_0x74af55,null));};exports['destroy']=function(_0x4ed077,_0x39d65e){return db[_0xd818('0x42')]['find']({'where':{'id':_0x4ed077[_0xd818('0x48')]['id']}})[_0xd818('0x28')](handleEntityNotFound(_0x39d65e,null))[_0xd818('0x28')](removeEntity(_0x39d65e,null))[_0xd818('0x53')](handleError(_0x39d65e,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 23fb279..c454e09 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x7217,0x19e));var _0x7721=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7217[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x32ef5a,_0x38647a){_0x32ef5a=_0x32ef5a-0x0;var _0x31c603=_0x7fbe[_0x32ef5a];return _0x31c603;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index f6b3cd2..2db35c0 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5d304f,_0x37ff64){var _0x4bc799=function(_0x1359b5){while(--_0x1359b5){_0x5d304f['push'](_0x5d304f['shift']());}};_0x4bc799(++_0x37ff64);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0xb10b[_0x2c93e2];return _0x57264e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x539840,_0x12bd0a){var _0x24ed2d=function(_0x1e4177){while(--_0x1e4177){_0x539840['push'](_0x539840['shift']());}};_0x24ed2d(++_0x12bd0a);}(_0x7a54,0x106));var _0x47a5=function(_0x14e83c,_0x284f2b){_0x14e83c=_0x14e83c-0x0;var _0x4d5787=_0x7a54[_0x14e83c];return _0x4d5787;};'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 bb3422b..8893dc1 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 _0x3937=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','single','upload','post','webhookPost','update','delete','/:id','exports','multer'];(function(_0x2bcdd4,_0x3a4691){var _0x44ac15=function(_0x1a4fb8){while(--_0x1a4fb8){_0x2bcdd4['push'](_0x2bcdd4['shift']());}};_0x44ac15(++_0x3a4691);}(_0x3937,0xbf));var _0x7393=function(_0x8d0fcf,_0x227359){_0x8d0fcf=_0x8d0fcf-0x0;var _0xa30452=_0x3937[_0x8d0fcf];return _0xa30452;};'use strict';var multer=require(_0x7393('0x0'));var util=require('util');var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require('express');var router=express[_0x7393('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7393('0x5'));var controller=require(_0x7393('0x6'));router[_0x7393('0x7')]('/',auth[_0x7393('0x8')](),controller[_0x7393('0x9')]);router[_0x7393('0x7')](_0x7393('0xa'),controller[_0x7393('0xb')]);router[_0x7393('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7393('0xc')]);router[_0x7393('0x7')](_0x7393('0xd'),auth['isAuthenticated'](),controller[_0x7393('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56ed4c,_0x47c5c6,_0x497b6b){_0x497b6b(null,path[_0x7393('0xf')](config[_0x7393('0x10')],_0x7393('0x11')));},'filename':function(_0x4fb764,_0x79fc4e,_0x470f09){_0x79fc4e[_0x7393('0x12')]=_0x79fc4e[_0x7393('0x12')][_0x7393('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x470f09(null,util[_0x7393('0x14')](_0x7393('0x15'),path[_0x7393('0x16')](_0x79fc4e[_0x7393('0x12')],path['extname'](_0x79fc4e['originalname'])),Date[_0x7393('0x17')](),path['extname'](_0x79fc4e['originalname'])));}})});router['post']('/',upload[_0x7393('0x18')]('file'),controller[_0x7393('0x19')]);router[_0x7393('0x1a')]('/webhook',controller[_0x7393('0x1b')]);router['put']('/:id',auth[_0x7393('0x8')](),controller[_0x7393('0x1c')]);router[_0x7393('0x1d')](_0x7393('0x1e'),auth[_0x7393('0x8')](),controller[_0x7393('0x1d')]);module[_0x7393('0x1f')]=router; \ No newline at end of file +var _0xd2ea=['./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','download','diskStorage','root','server/files/plugins','originalname','replace','extname','now','post','single','file','upload','webhookPost','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc4e092,_0x5059f7){var _0xa4f542=function(_0x302769){while(--_0x302769){_0xc4e092['push'](_0xc4e092['shift']());}};_0xa4f542(++_0x5059f7);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3e6066,_0x58205a){_0x3e6066=_0x3e6066-0x0;var _0x5655c5=_0xd2ea[_0x3e6066];return _0x5655c5;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),controller[_0xad2e('0xd')]);router['get'](_0xad2e('0xe'),auth[_0xad2e('0xb')](),controller['show']);router[_0xad2e('0xa')]('/:id/download',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);var upload=multer({'storage':multer[_0xad2e('0x10')]({'destination':function(_0x24c5da,_0x489f25,_0x7df3c6){_0x7df3c6(null,path['join'](config[_0xad2e('0x11')],_0xad2e('0x12')));},'filename':function(_0x433696,_0x42e2f2,_0x59a342){_0x42e2f2[_0xad2e('0x13')]=_0x42e2f2['originalname'][_0xad2e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59a342(null,util['format']('%s-%s%s',path['basename'](_0x42e2f2['originalname'],path[_0xad2e('0x15')](_0x42e2f2[_0xad2e('0x13')])),Date[_0xad2e('0x16')](),path[_0xad2e('0x15')](_0x42e2f2[_0xad2e('0x13')])));}})});router[_0xad2e('0x17')]('/',upload[_0xad2e('0x18')](_0xad2e('0x19')),controller[_0xad2e('0x1a')]);router[_0xad2e('0x17')](_0xad2e('0xc'),controller[_0xad2e('0x1b')]);router[_0xad2e('0x1c')](_0xad2e('0xe'),auth[_0xad2e('0xb')](),controller['update']);router[_0xad2e('0x1d')](_0xad2e('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 7ea7d54..8912c37 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 _0x2914=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','html','TEXT','adminOnly','agentOnly'];(function(_0x4bcdc0,_0x30cc48){var _0x3340d5=function(_0x2e7e7e){while(--_0x2e7e7e){_0x4bcdc0['push'](_0x4bcdc0['shift']());}};_0x3340d5(++_0x30cc48);}(_0x2914,0xed));var _0x4291=function(_0x5851b5,_0x46b491){_0x5851b5=_0x5851b5-0x0;var _0x140f90=_0x2914[_0x5851b5];return _0x140f90;};'use strict';var Sequelize=require(_0x4291('0x0'));module[_0x4291('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x4291('0x2'),'script')},'description':{'type':Sequelize[_0x4291('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x4291('0x4'),_0x4291('0x5'),'always','never'),'defaultValue':_0x4291('0x6'),'comment':_0x4291('0x7')},'icon':{'type':Sequelize[_0x4291('0x8')]},'adminUrl':{'type':Sequelize[_0x4291('0x8')]},'agentUrl':{'type':Sequelize[_0x4291('0x8')]},'scriptName':{'type':Sequelize[_0x4291('0x8')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac9d=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0xffeeec,_0x1941bb){var _0xbd25f6=function(_0x1f9b3f){while(--_0x1f9b3f){_0xffeeec['push'](_0xffeeec['shift']());}};_0xbd25f6(++_0x1941bb);}(_0xac9d,0x1b0));var _0xdac9=function(_0x5ebe34,_0x421337){_0x5ebe34=_0x5ebe34-0x0;var _0x36a3ee=_0xac9d[_0x5ebe34];return _0x36a3ee;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')]},'type':{'type':Sequelize[_0xdac9('0x3')](_0xdac9('0x4'),'script')},'description':{'type':Sequelize[_0xdac9('0x5')]},'version':{'type':Sequelize[_0xdac9('0x5')]},'path':{'type':Sequelize[_0xdac9('0x2')],'comment':_0xdac9('0x6')},'active':{'type':Sequelize[_0xdac9('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xdac9('0x8'),_0xdac9('0x9'),'never'),'defaultValue':_0xdac9('0x9'),'comment':_0xdac9('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xdac9('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4fcfd8c..1de4567 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 _0x6322=['%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','download','root','server/files/plugins','format','%s.zip','path','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','join','basename','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','webhookGet','port','hostname','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:'];(function(_0x2270bc,_0x3b6274){var _0x5de1d5=function(_0x16a689){while(--_0x16a689){_0x2270bc['push'](_0x2270bc['shift']());}};_0x5de1d5(++_0x3b6274);}(_0x6322,0x15d));var _0x2632=function(_0x54b62b,_0x4a8b){_0x54b62b=_0x54b62b-0x0;var _0x4567ec=_0x6322[_0x54b62b];return _0x4567ec;};'use strict';var emlformat=require(_0x2632('0x0'));var rimraf=require(_0x2632('0x1'));var zipdir=require(_0x2632('0x2'));var jsonpatch=require(_0x2632('0x3'));var rp=require(_0x2632('0x4'));var moment=require(_0x2632('0x5'));var BPromise=require(_0x2632('0x6'));var Mustache=require(_0x2632('0x7'));var util=require(_0x2632('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2632('0x9'));var ejs=require(_0x2632('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2632('0xb'));var squel=require(_0x2632('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2632('0x9'));var querystring=require(_0x2632('0xd'));var Papa=require(_0x2632('0xe'));var extract=require(_0x2632('0xf'));var rimraf=require('rimraf');var archiver=require(_0x2632('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2632('0x11'));var as=require(_0x2632('0x12'));var hardwareService=require(_0x2632('0x13'));var logger=require(_0x2632('0x14'))(_0x2632('0x15'));var utils=require(_0x2632('0x16'));var config=require(_0x2632('0x17'));var licenseUtil=require(_0x2632('0x18'));var db=require(_0x2632('0x19'))['db'];config[_0x2632('0x1a')]=_['defaults'](config[_0x2632('0x1a')],{'host':_0x2632('0x1b'),'port':0x18eb});var socket=require(_0x2632('0x1c'))(new Redis(config[_0x2632('0x1a')]));require(_0x2632('0x1d'))[_0x2632('0x1e')](socket);function respondWithStatusCode(_0x4e96c5,_0xf2f210){_0xf2f210=_0xf2f210||0xcc;return function(_0x2cc03e){if(_0x2cc03e){return _0x4e96c5[_0x2632('0x1f')](_0xf2f210);}return _0x4e96c5[_0x2632('0x20')](_0xf2f210)[_0x2632('0x21')]();};}function respondWithResult(_0x5aef67,_0x4d8294){_0x4d8294=_0x4d8294||0xc8;return function(_0x621f37){if(_0x621f37){return _0x5aef67['status'](_0x4d8294)['json'](_0x621f37);}};}function respondWithFilteredResult(_0x3d6df6,_0xd2979a){return function(_0x4a416e){if(_0x4a416e){var _0x399e98=typeof _0xd2979a[_0x2632('0x22')]===_0x2632('0x23')&&typeof _0xd2979a['limit']===_0x2632('0x23');var _0x5eeac7=_0x4a416e['count'];var _0x28ec7c=_0x399e98?0x0:_0xd2979a[_0x2632('0x22')];var _0x153822=_0x399e98?_0x4a416e['count']:_0xd2979a[_0x2632('0x22')]+_0xd2979a[_0x2632('0x24')];var _0x5ab5b7;if(_0x153822>=_0x5eeac7){_0x153822=_0x5eeac7;_0x5ab5b7=0xc8;}else{_0x5ab5b7=0xce;}_0x3d6df6[_0x2632('0x20')](_0x5ab5b7);return _0x3d6df6[_0x2632('0x25')](_0x2632('0x26'),_0x28ec7c+'-'+_0x153822+'/'+_0x5eeac7)[_0x2632('0x27')](_0x4a416e);}return null;};}function patchUpdates(_0xbc79d9){return function(_0xa0d63b){try{jsonpatch[_0x2632('0x28')](_0xa0d63b,_0xbc79d9,!![]);}catch(_0x290c3c){return BPromise[_0x2632('0x29')](_0x290c3c);}return _0xa0d63b['save']();};}function saveUpdates(_0x3771d5,_0x1863f2){return function(_0x5c876b){if(_0x5c876b){return _0x5c876b['update'](_0x3771d5)[_0x2632('0x2a')](function(_0x55259d){return _0x55259d;});}return null;};}function removeEntity(_0x5950f9,_0x135c04){return function(_0x4bb17a){if(_0x4bb17a){return _0x4bb17a[_0x2632('0x2b')]()['then'](function(){var _0x5b949a=_0x4bb17a[_0x2632('0x2c')]({'plain':!![]});var _0x4fa1ae=_0x2632('0x2d');return db[_0x2632('0x2e')][_0x2632('0x2b')]({'where':{'type':_0x4fa1ae,'resourceId':_0x5b949a['id']}})[_0x2632('0x2a')](function(){return _0x4bb17a;});})[_0x2632('0x2a')](function(){_0x5950f9[_0x2632('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a5a11,_0x559165){return function(_0x5c3a9b){if(!_0x5c3a9b){_0x1a5a11[_0x2632('0x1f')](0x194);}return _0x5c3a9b;};}function handleError(_0x28cee8,_0x3fc133){_0x3fc133=_0x3fc133||0x1f4;return function(_0x22e1d7){logger[_0x2632('0x2f')](_0x22e1d7[_0x2632('0x30')]);if(_0x22e1d7[_0x2632('0x31')]){delete _0x22e1d7[_0x2632('0x31')];}_0x28cee8[_0x2632('0x20')](_0x3fc133)[_0x2632('0x32')](_0x22e1d7);};}exports[_0x2632('0x33')]=function(_0x250107,_0xfc6741){var _0x485094={},_0x58303c={},_0x2696eb={'count':0x0,'rows':[]};var _0x31d37d=_[_0x2632('0x34')](db[_0x2632('0x35')]['rawAttributes'],function(_0x32b98f){return{'name':_0x32b98f[_0x2632('0x36')],'type':_0x32b98f[_0x2632('0x37')]['key']};});_0x58303c[_0x2632('0x38')]=_[_0x2632('0x34')](_0x31d37d,'name');_0x58303c[_0x2632('0x39')]=_['keys'](_0x250107[_0x2632('0x39')]);_0x58303c['filters']=_[_0x2632('0x3a')](_0x58303c['model'],_0x58303c[_0x2632('0x39')]);_0x485094[_0x2632('0x3b')]=_[_0x2632('0x3a')](_0x58303c['model'],qs[_0x2632('0x3c')](_0x250107[_0x2632('0x39')]['fields']));_0x485094['attributes']=_0x485094[_0x2632('0x3b')][_0x2632('0x3d')]?_0x485094[_0x2632('0x3b')]:_0x58303c[_0x2632('0x38')];if(!_0x250107['query']['hasOwnProperty'](_0x2632('0x3e'))){_0x485094[_0x2632('0x24')]=qs[_0x2632('0x24')](_0x250107[_0x2632('0x39')][_0x2632('0x24')]);_0x485094[_0x2632('0x22')]=qs[_0x2632('0x22')](_0x250107[_0x2632('0x39')][_0x2632('0x22')]);}_0x485094[_0x2632('0x3f')]=qs[_0x2632('0x40')](_0x250107['query'][_0x2632('0x40')]);_0x485094[_0x2632('0x41')]=qs[_0x2632('0x42')](_[_0x2632('0x43')](_0x250107[_0x2632('0x39')],_0x58303c[_0x2632('0x42')]),_0x31d37d);if(_0x250107[_0x2632('0x39')][_0x2632('0x44')]){_0x485094['where']=_[_0x2632('0x45')](_0x485094['where'],{'$or':_[_0x2632('0x34')](_0x31d37d,function(_0x61efc8){if(_0x61efc8['type']!==_0x2632('0x46')){var _0x32174f={};_0x32174f[_0x61efc8[_0x2632('0x31')]]={'$like':'%'+_0x250107[_0x2632('0x39')]['filter']+'%'};return _0x32174f;}})});}_0x485094=_['merge']({},_0x485094,_0x250107[_0x2632('0x47')]);var _0x81047d={'where':_0x485094['where']};return db[_0x2632('0x35')][_0x2632('0x48')](_0x81047d)[_0x2632('0x2a')](function(_0x191fa2){_0x2696eb[_0x2632('0x48')]=_0x191fa2;if(_0x250107[_0x2632('0x39')][_0x2632('0x49')]){_0x485094[_0x2632('0x4a')]=[{'all':!![]}];}return db[_0x2632('0x35')][_0x2632('0x4b')](_0x485094);})[_0x2632('0x2a')](function(_0x132ad6){_0x2696eb['rows']=_0x132ad6;return _0x2696eb;})['then'](respondWithFilteredResult(_0xfc6741,_0x485094))[_0x2632('0x4c')](handleError(_0xfc6741,null));};exports[_0x2632('0x4d')]=function(_0x4842fc,_0x34dafc){var _0x2839cc={'raw':!![],'where':{'id':_0x4842fc[_0x2632('0x4e')]['id']}},_0x3a1434={};_0x3a1434[_0x2632('0x38')]=_[_0x2632('0x4f')](db[_0x2632('0x35')]['rawAttributes']);_0x3a1434[_0x2632('0x39')]=_[_0x2632('0x4f')](_0x4842fc[_0x2632('0x39')]);_0x3a1434['filters']=_[_0x2632('0x3a')](_0x3a1434[_0x2632('0x38')],_0x3a1434[_0x2632('0x39')]);_0x2839cc[_0x2632('0x3b')]=_[_0x2632('0x3a')](_0x3a1434[_0x2632('0x38')],qs[_0x2632('0x3c')](_0x4842fc[_0x2632('0x39')][_0x2632('0x3c')]));_0x2839cc[_0x2632('0x3b')]=_0x2839cc[_0x2632('0x3b')][_0x2632('0x3d')]?_0x2839cc[_0x2632('0x3b')]:_0x3a1434[_0x2632('0x38')];if(_0x4842fc['query'][_0x2632('0x49')]){_0x2839cc[_0x2632('0x4a')]=[{'all':!![]}];}_0x2839cc=_[_0x2632('0x45')]({},_0x2839cc,_0x4842fc['options']);return db[_0x2632('0x35')][_0x2632('0x50')](_0x2839cc)[_0x2632('0x2a')](handleEntityNotFound(_0x34dafc,null))[_0x2632('0x2a')](respondWithResult(_0x34dafc,null))[_0x2632('0x4c')](handleError(_0x34dafc,null));};exports[_0x2632('0x51')]=function(_0x424982,_0x27e7ae,_0x2878f7){return db[_0x2632('0x35')]['find']({'where':{'id':_0x424982[_0x2632('0x4e')]['id']},'attributes':[_0x2632('0x31'),'path'],'raw':!![]})[_0x2632('0x2a')](handleEntityNotFound(_0x27e7ae,null))[_0x2632('0x2a')](function(_0x5d6323){if(_0x5d6323){var _0x59b7be=path['join'](config[_0x2632('0x52')],_0x2632('0x53'),util[_0x2632('0x54')](_0x2632('0x55'),path['basename'](_0x5d6323[_0x2632('0x56')])));var _0x1d576d=fs[_0x2632('0x57')](_0x59b7be);var _0x50f93d=archiver(_0x2632('0x58'),{'zlib':{'level':0x9}});_0x50f93d['on'](_0x2632('0x59'),function(_0x779d2b){if(_0x779d2b[_0x2632('0x5a')]==='ENOENT'){logger[_0x2632('0x2f')](_0x779d2b);}else{throw new db[(_0x2632('0x5b'))][(_0x2632('0x5c'))](_0x2632('0x5d'));}});_0x50f93d['on']('error',function(_0x238fbc){throw new db[(_0x2632('0x5b'))][(_0x2632('0x5c'))](_0x2632('0x5d'));});_0x50f93d[_0x2632('0x5e')](_0x1d576d);_0x50f93d[_0x2632('0x5f')](_0x2632('0x60'),{'cwd':path['join'](config[_0x2632('0x52')],_0x2632('0x53'),path[_0x2632('0x61')](_0x5d6323[_0x2632('0x56')])),'ignore':[path[_0x2632('0x62')](path[_0x2632('0x63')](_0x5d6323[_0x2632('0x56')]),_0x2632('0x64')),path['join'](path[_0x2632('0x63')](_0x5d6323[_0x2632('0x56')]),'attachments/**/*')],'nodir':!![]})[_0x2632('0x65')]();_0x1d576d['on'](_0x2632('0x66'),function(){if(!fs[_0x2632('0x67')](_0x59b7be)){throw new db[(_0x2632('0x5b'))]['Error'](_0x2632('0x68'));}return _0x27e7ae[_0x2632('0x51')](_0x59b7be,util[_0x2632('0x54')](_0x2632('0x55'),path[_0x2632('0x63')](_0x5d6323[_0x2632('0x56')])),function(_0x199ce2){if(_0x199ce2){throw new db['Sequelize'][(_0x2632('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x59b7be);logger[_0x2632('0x69')](_0x2632('0x6a'));logger[_0x2632('0x69')](_0x2632('0x6b'));});});}return null;})[_0x2632('0x4c')](handleError(_0x27e7ae,null));};exports[_0x2632('0x6c')]=function(_0x53e8a7,_0x1c6d66,_0x2f6797){var _0xdaff7e=path[_0x2632('0x63')](_0x53e8a7['file'][_0x2632('0x6d')],path[_0x2632('0x6e')](_0x53e8a7['file'][_0x2632('0x6d')]));var _0x3fabd7=path[_0x2632('0x62')](config[_0x2632('0x52')],_0x2632('0x53'),_0x53e8a7[_0x2632('0x6f')]['filename']);var _0x40a6a3=path[_0x2632('0x62')](config[_0x2632('0x52')],_0x2632('0x53'),_0xdaff7e);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x3fabd7);logger[_0x2632('0x69')](_0x2632('0x70'),_0x40a6a3);try{fs[_0x2632('0x71')](_0x3fabd7,parseInt(_0x2632('0x72'),0x8));extract(_0x3fabd7,{'dir':_0x40a6a3},function(_0x2885f3){if(_0x2885f3){logger['error'](_0x2885f3);handleError(_0x2885f3,!![]);};var _0x1ff83f=fs[_0x2632('0x73')](_0x40a6a3);if(_0x1ff83f[_0x2632('0x3d')]>0x1){removeReferences(_0x3fabd7,_0x40a6a3);logger[_0x2632('0x2f')](_0x2632('0x74'));return _0x2f6797(new Error(_0x2632('0x74')));}var _0x10cf75=fs[_0x2632('0x75')](path[_0x2632('0x62')](_0x40a6a3,_0x1ff83f[0x0]));if(_0x10cf75[_0x2632('0x76')]()){removeReferences(_0x3fabd7,_0x40a6a3);logger[_0x2632('0x2f')]('Invalid\x20plugin\x20structure');return _0x2f6797(new Error('Invalid\x20plugin\x20structure'));}if(_0x10cf75[_0x2632('0x77')]()){var _0xb5851d=fs[_0x2632('0x73')](path[_0x2632('0x62')](_0x40a6a3,_0x1ff83f[0x0]));if(_0xb5851d[_0x2632('0x3d')]===0x0){removeReferences(_0x3fabd7,_0x40a6a3);logger[_0x2632('0x2f')](_0x2632('0x74'));return _0x2f6797(new Error(_0x2632('0x74')));}var _0x52c980=_0xb5851d[_0x2632('0x78')](function(_0x2899ac){return _0x2899ac===_0x2632('0x79');});if(!_0x52c980){return _0x2f6797(new Error('Plugin\x20manifest\x20missing'));}var _0x2f6283=fs['readFileSync'](path[_0x2632('0x62')](_0x40a6a3,_0x1ff83f[0x0],_0x2632('0x79')));var _0x5c9db3=JSON[_0x2632('0x7a')](_0x2f6283);if(_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x31')]){return _0x2f6797(new Error(_0x2632('0x7b')));}if('undefined'==typeof _0x5c9db3[_0x2632('0x37')]){return _0x2f6797(new Error(_0x2632('0x7c')));}if('undefined'==typeof _0x5c9db3[_0x2632('0x7d')]){return _0x2f6797(new Error(_0x2632('0x7e')));}if(_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x7f')]){return _0x2f6797(new Error(_0x2632('0x80')));}if(_0x5c9db3[_0x2632('0x37')]===_0x2632('0x81')){if('undefined'==typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')]){return _0x2f6797(new Error(_0x2632('0x83')));}if(_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')]['admin']&&_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x84')]){return _0x2f6797(new Error(_0x2632('0x85')));}}else if(_0x5c9db3[_0x2632('0x37')]===_0x2632('0x86')){if(_0x2632('0x23')==typeof _0x5c9db3['parameters'][_0x2632('0x87')]){return _0x2f6797(new Error(_0x2632('0x88')));}if(_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x89')]){return _0x2f6797(new Error(_0x2632('0x8a')));}}else{return _0x2f6797(new Error(_0x2632('0x8b')));}var _0xdaa68b=_0x5c9db3['name'];var _0x2230eb=_0x5c9db3[_0x2632('0x8c')];var _0x5f3698=_0x5c9db3['type'];var _0x56409a=_0x5c9db3[_0x2632('0x8d')]?_0x5c9db3[_0x2632('0x8d')]:_0x2632('0x8e');var _0x5713ba=_0x5c9db3[_0x2632('0x8f')]?_0x5c9db3[_0x2632('0x8f')]:_0x2632('0x90');var _0x58bae5='';var _0x1c0c6a='';var _0x5e9c66='';var _0x11d179='';var _0x1612ea=_0x5c9db3[_0x2632('0x7d')];if(_0x5f3698===_0x2632('0x81')){if(_0x2632('0x23')!=typeof _0x5c9db3['parameters'][_0x2632('0x82')][_0x2632('0x91')]){var _0xe795fe=_0x5c9db3[_0x2632('0x7f')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x2632('0x92')](_0xe795fe)){_0x58bae5=path[_0x2632('0x62')](_0x2632('0x93'),_0xdaff7e,_0x1ff83f[0x0],_0xe795fe);}else{_0x58bae5=_0xe795fe;}}else{logger[_0x2632('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x2632('0x23')!=typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x84')]){var _0x43ea8d=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x2632('0x92')](_0x43ea8d)){_0x1c0c6a=path[_0x2632('0x62')]('plugins',_0xdaff7e,_0x1ff83f[0x0],_0x43ea8d);}else{_0x1c0c6a=_0x43ea8d;}}else{logger[_0x2632('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5f3698===_0x2632('0x86')){_0x5e9c66=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x87')];_0x11d179=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x89')];if(_0x2632('0x23')!=typeof _0x5c9db3[_0x2632('0x7f')]['views']){if(_0x2632('0x23')!=typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x91')]){var _0xe795fe=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x91')];if(!/^(f|ht)tps?:\/\//i[_0x2632('0x92')](_0xe795fe)){_0x58bae5=path[_0x2632('0x62')](_0x2632('0x93'),_0xdaff7e,_0x1ff83f[0x0],_0xe795fe);}else{_0x58bae5=_0xe795fe;}}if(_0x2632('0x23')!=typeof _0x5c9db3[_0x2632('0x7f')]['views'][_0x2632('0x84')]){var _0x43ea8d=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x2632('0x92')](_0x43ea8d)){_0x1c0c6a=path['join'](_0x2632('0x93'),_0xdaff7e,_0x1ff83f[0x0],_0x43ea8d);}else{_0x1c0c6a=_0x43ea8d;}}}}var _0x5e0e29={'name':_0xdaa68b,'description':_0x2230eb,'path':path[_0x2632('0x62')](_0xdaff7e,_0x1ff83f[0x0]),'type':_0x5f3698,'sidebar':_0x56409a,'icon':_0x5713ba,'adminUrl':_0x58bae5,'agentUrl':_0x1c0c6a,'scriptName':_0x5e9c66,'scriptPath':_0x11d179,'version':_0x1612ea};removeReferences(_0x3fabd7,null);return db['Plugin']['create'](_0x5e0e29)[_0x2632('0x2a')](function(_0x969ac1){var _0x5650f7={'role':_0x53e8a7[_0x2632('0x94')]['role'],'userProfileId':_0x53e8a7['body'][_0x2632('0x95')]};if(!_0x5650f7)throw new Error(_0x2632('0x96'));if(_0x5650f7[_0x2632('0x97')]===_0x2632('0x98')){var _0x3a9753=_0x969ac1[_0x2632('0x2c')]({'plain':!![]});return db[_0x2632('0x99')][_0x2632('0x50')]({'where':{'name':_0x2632('0x2d'),'userProfileId':_0x5650f7['userProfileId']},'raw':!![]})[_0x2632('0x2a')](function(_0xf5522a){if(_0xf5522a&&_0xf5522a[_0x2632('0x9a')]===0x0){return db[_0x2632('0x2e')][_0x2632('0x9b')]({'name':_0x3a9753[_0x2632('0x31')],'resourceId':_0x3a9753['id'],'type':_0xf5522a[_0x2632('0x31')],'sectionId':_0xf5522a['id']},{})[_0x2632('0x2a')](function(){return _0x969ac1;});}else{return _0x969ac1;}})['catch'](function(_0xfc0d16){logger[_0x2632('0x2f')](_0x2632('0x9c'),_0xfc0d16);throw _0xfc0d16;});}return _0x969ac1;})[_0x2632('0x2a')](respondWithResult(_0x1c6d66,null))['catch'](handleError(_0x1c6d66,null));}});}catch(_0x128df7){_0x1c6d66['status'](0x1f4)[_0x2632('0x32')](_0x128df7);}};function removeReferences(_0x301b1c,_0x45985e){try{if(_0x301b1c){fs['unlinkSync'](_0x301b1c);logger['info'](_0x2632('0x9d'));}if(_0x45985e){rimraf(_0x45985e,function(){});logger[_0x2632('0x69')]('Extracted\x20folder\x20removed');}}catch(_0x2ce3c0){logger['error'](_0x2ce3c0);}}exports['update']=function(_0x414d1d,_0x464687,_0x5b76af){return db['Plugin'][_0x2632('0x50')]({'where':{'id':_0x414d1d[_0x2632('0x4e')]['id']}})['then'](handleEntityNotFound(_0x464687,null))[_0x2632('0x2a')](saveUpdates(_0x414d1d[_0x2632('0x94')],null))['then'](respondWithResult(_0x464687,null))[_0x2632('0x4c')](handleError(_0x464687,null));};exports['delete']=function(_0xc4bb65,_0x4b08cd,_0x249e25){return db[_0x2632('0x35')][_0x2632('0x50')]({'where':{'id':_0xc4bb65['params']['id']}})['then'](function(_0x46795e){if(_0x46795e){return _0x46795e[_0x2632('0x2b')]();}})[_0x2632('0x2a')](function(_0x44c67c){rimraf(path[_0x2632('0x62')](config[_0x2632('0x52')],'server/files/plugins',path[_0x2632('0x61')](_0x44c67c[_0x2632('0x56')])),function(){});return _0x44c67c;})[_0x2632('0x2a')](handleEntityNotFound(_0x4b08cd,null))[_0x2632('0x2a')](respondWithStatusCode(_0x4b08cd,null))[_0x2632('0x4c')](handleError(_0x4b08cd,null));};exports[_0x2632('0x9e')]=function(_0x2dea29,_0xf1fdbe,_0xa59398){return BPromise['resolve']()[_0x2632('0x2a')](function(){if(!_0x2dea29['query'][_0x2632('0x56')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2dea29[_0x2632('0x39')][_0x2632('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1a19ad=_0x2dea29[_0x2632('0x39')]['hostname']?_0x2dea29[_0x2632('0x39')][_0x2632('0xa0')]+':'+_0x2dea29[_0x2632('0x39')]['port']:'http://localhost:'+_0x2dea29['query'][_0x2632('0x9f')];var _0x52d979=_0x2dea29[_0x2632('0x39')][_0x2632('0x27')]?_0x2dea29[_0x2632('0x39')][_0x2632('0x27')]:!![];var _0x105927=_0x2dea29[_0x2632('0x39')][_0x2632('0xa1')]?_0x2dea29[_0x2632('0x39')]['encoding']:null;var _0x184ee0={'method':_0x2dea29[_0x2632('0xa2')],'uri':util[_0x2632('0x54')]('%s%s',_0x1a19ad,_0x2dea29[_0x2632('0x39')]['path']),'json':_0x52d979,'resolveWithFullResponse':!![],'encoding':_0x105927,'qs':_0x2dea29['query']};if(_0x2dea29[_0x2632('0xa3')]){_0x184ee0[_0x2632('0xa3')]=_0x2dea29[_0x2632('0xa3')];if(_0x184ee0[_0x2632('0xa3')][_0x2632('0xa4')]){delete _0x184ee0[_0x2632('0xa3')][_0x2632('0xa4')];}}if(_0x184ee0[_0x2632('0xa3')][_0x2632('0xa5')]){delete _0x184ee0[_0x2632('0xa3')][_0x2632('0xa5')];}return rp(_0x184ee0);})['then'](function(_0x1a74c0){if(_0x1a74c0){_0xf1fdbe[_0x2632('0x25')](_0x1a74c0[_0x2632('0xa3')]);logger[_0x2632('0x69')](_0x1a74c0[_0x2632('0x94')]);if(_[_0x2632('0xa6')](_0x2dea29[_0x2632('0x39')][_0x2632('0x56')],_0x2632('0x51'))&&_0x1a74c0[_0x2632('0xa7')]==0x1f4){return _0xf1fdbe[_0x2632('0x1f')](_0x1a74c0[_0x2632('0xa7')]);}else{return _0xf1fdbe['status'](_0x1a74c0['statusCode'])['send'](_0x1a74c0[_0x2632('0x94')]);}}else{return _0xf1fdbe[_0x2632('0x1f')](0xc8);}})['catch'](handleError(_0xf1fdbe,null));};exports[_0x2632('0xa8')]=function(_0x241901,_0x347b03,_0x3da9d0){return BPromise[_0x2632('0xa9')]()[_0x2632('0x2a')](function(){if(!_0x241901[_0x2632('0x39')]['path']){throw new Error(_0x2632('0xaa'));}if(!_0x241901[_0x2632('0x39')][_0x2632('0x9f')]){throw new Error(_0x2632('0xab'));}var _0x3155a1=_0x241901[_0x2632('0x39')]['hostname']?_0x241901[_0x2632('0x39')][_0x2632('0xa0')]+':'+_0x241901[_0x2632('0x39')][_0x2632('0x9f')]:_0x2632('0xac')+_0x241901['query'][_0x2632('0x9f')];var _0x24a530=_0x241901[_0x2632('0x39')][_0x2632('0x27')]?_0x241901[_0x2632('0x39')][_0x2632('0x27')]:!![];var _0x4cfabf=_0x241901[_0x2632('0x39')]['encoding']?_0x241901[_0x2632('0x39')][_0x2632('0xa1')]:null;var _0x21c7f7={'method':_0x241901[_0x2632('0xa2')],'uri':util['format'](_0x2632('0xad'),_0x3155a1,_0x241901[_0x2632('0x39')][_0x2632('0x56')]),'json':_0x24a530,'resolveWithFullResponse':!![],'encoding':_0x4cfabf,'body':_0x241901[_0x2632('0x94')]};if(_0x241901[_0x2632('0xa3')]){_0x21c7f7[_0x2632('0xa3')]=_0x241901[_0x2632('0xa3')];if(_0x21c7f7['headers']['content-length']){delete _0x21c7f7[_0x2632('0xa3')]['content-length'];}}if(_0x21c7f7[_0x2632('0xa3')][_0x2632('0xa5')]){delete _0x21c7f7['headers'][_0x2632('0xa5')];}return rp(_0x21c7f7);})[_0x2632('0x2a')](function(_0x3d67e6){if(_0x3d67e6){_0x347b03['set'](_0x3d67e6['headers']);logger['info'](_0x3d67e6[_0x2632('0x94')]);return _0x347b03['status'](_0x3d67e6[_0x2632('0xa7')])['send'](_0x3d67e6[_0x2632('0x94')]);}else{return _0x347b03[_0x2632('0x1f')](0xc8);}})[_0x2632('0x4c')](handleError(_0x347b03,null));}; \ No newline at end of file +var _0xaf19=['where','filter','merge','VIRTUAL','options','Plugin','includeAll','include','catch','params','find','join','root','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','test','agent','create','body','role','get','UserProfileSection','Plugins','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','download','statusCode','webhookPost','http://localhost:','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','../../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','register','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf19,0x69));var _0x9af1=function(_0x12d5e9,_0x3ddda9){_0x12d5e9=_0x12d5e9-0x0;var _0x52e96b=_0xaf19[_0x12d5e9];return _0x52e96b;};'use strict';var emlformat=require(_0x9af1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9af1('0x1'));var jsonpatch=require(_0x9af1('0x2'));var rp=require(_0x9af1('0x3'));var moment=require(_0x9af1('0x4'));var BPromise=require(_0x9af1('0x5'));var Mustache=require('mustache');var util=require(_0x9af1('0x6'));var path=require(_0x9af1('0x7'));var sox=require(_0x9af1('0x8'));var csv=require(_0x9af1('0x9'));var ejs=require(_0x9af1('0xa'));var fs=require('fs');var fs_extra=require(_0x9af1('0xb'));var _=require(_0x9af1('0xc'));var squel=require(_0x9af1('0xd'));var crypto=require('crypto');var jsforce=require(_0x9af1('0xe'));var deskjs=require(_0x9af1('0xf'));var toCsv=require(_0x9af1('0x9'));var querystring=require(_0x9af1('0x10'));var Papa=require(_0x9af1('0x11'));var extract=require(_0x9af1('0x12'));var rimraf=require(_0x9af1('0x13'));var archiver=require(_0x9af1('0x14'));var Redis=require('ioredis');var authService=require(_0x9af1('0x15'));var qs=require(_0x9af1('0x16'));var as=require(_0x9af1('0x17'));var hardwareService=require(_0x9af1('0x18'));var logger=require(_0x9af1('0x19'))('api');var utils=require(_0x9af1('0x1a'));var config=require(_0x9af1('0x1b'));var licenseUtil=require(_0x9af1('0x1c'));var db=require(_0x9af1('0x1d'))['db'];config[_0x9af1('0x1e')]=_[_0x9af1('0x1f')](config[_0x9af1('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x9af1('0x20'))(new Redis(config['redis']));require('./plugin.socket')[_0x9af1('0x21')](socket);function respondWithStatusCode(_0x5e80c8,_0x5acf48){_0x5acf48=_0x5acf48||0xcc;return function(_0x46e18b){if(_0x46e18b){return _0x5e80c8[_0x9af1('0x22')](_0x5acf48);}return _0x5e80c8['status'](_0x5acf48)[_0x9af1('0x23')]();};}function respondWithResult(_0x3d3a1c,_0x1bf951){_0x1bf951=_0x1bf951||0xc8;return function(_0x12113a){if(_0x12113a){return _0x3d3a1c[_0x9af1('0x24')](_0x1bf951)['json'](_0x12113a);}};}function respondWithFilteredResult(_0x1cfa53,_0x3dd600){return function(_0xca79c8){if(_0xca79c8){var _0x579455=typeof _0x3dd600[_0x9af1('0x25')]==='undefined'&&typeof _0x3dd600['limit']===_0x9af1('0x26');var _0x3947f3=_0xca79c8[_0x9af1('0x27')];var _0x35bbdb=_0x579455?0x0:_0x3dd600['offset'];var _0x3f67e9=_0x579455?_0xca79c8[_0x9af1('0x27')]:_0x3dd600[_0x9af1('0x25')]+_0x3dd600[_0x9af1('0x28')];var _0x113199;if(_0x3f67e9>=_0x3947f3){_0x3f67e9=_0x3947f3;_0x113199=0xc8;}else{_0x113199=0xce;}_0x1cfa53['status'](_0x113199);return _0x1cfa53['set'](_0x9af1('0x29'),_0x35bbdb+'-'+_0x3f67e9+'/'+_0x3947f3)[_0x9af1('0x2a')](_0xca79c8);}return null;};}function patchUpdates(_0x3d996f){return function(_0x22ff71){try{jsonpatch[_0x9af1('0x2b')](_0x22ff71,_0x3d996f,!![]);}catch(_0x2aec51){return BPromise[_0x9af1('0x2c')](_0x2aec51);}return _0x22ff71[_0x9af1('0x2d')]();};}function saveUpdates(_0x279241,_0x173bcb){return function(_0x4f6ded){if(_0x4f6ded){return _0x4f6ded[_0x9af1('0x2e')](_0x279241)[_0x9af1('0x2f')](function(_0x37b29c){return _0x37b29c;});}return null;};}function removeEntity(_0x340d0e,_0x4b1272){return function(_0x343f32){if(_0x343f32){return _0x343f32[_0x9af1('0x30')]()['then'](function(){var _0x44b12f=_0x343f32['get']({'plain':!![]});var _0x2cdfd0='Plugins';return db[_0x9af1('0x31')][_0x9af1('0x30')]({'where':{'type':_0x2cdfd0,'resourceId':_0x44b12f['id']}})[_0x9af1('0x2f')](function(){return _0x343f32;});})['then'](function(){_0x340d0e[_0x9af1('0x24')](0xcc)[_0x9af1('0x23')]();});}};}function handleEntityNotFound(_0x597c33,_0x4c8092){return function(_0x518699){if(!_0x518699){_0x597c33[_0x9af1('0x22')](0x194);}return _0x518699;};}function handleError(_0x46051e,_0x16a1b1){_0x16a1b1=_0x16a1b1||0x1f4;return function(_0x36da03){logger[_0x9af1('0x32')](_0x36da03[_0x9af1('0x33')]);if(_0x36da03[_0x9af1('0x34')]){delete _0x36da03['name'];}_0x46051e[_0x9af1('0x24')](_0x16a1b1)['send'](_0x36da03);};}exports[_0x9af1('0x35')]=function(_0xb9ab55,_0x5c339c){var _0x1a5032={},_0x278d9e={},_0x5acbb6={'count':0x0,'rows':[]};var _0x224b37=_[_0x9af1('0x36')](db['Plugin'][_0x9af1('0x37')],function(_0x1a691c){return{'name':_0x1a691c[_0x9af1('0x38')],'type':_0x1a691c[_0x9af1('0x39')][_0x9af1('0x3a')]};});_0x278d9e['model']=_['map'](_0x224b37,_0x9af1('0x34'));_0x278d9e[_0x9af1('0x3b')]=_[_0x9af1('0x3c')](_0xb9ab55[_0x9af1('0x3b')]);_0x278d9e[_0x9af1('0x3d')]=_[_0x9af1('0x3e')](_0x278d9e[_0x9af1('0x3f')],_0x278d9e[_0x9af1('0x3b')]);_0x1a5032[_0x9af1('0x40')]=_['intersection'](_0x278d9e[_0x9af1('0x3f')],qs[_0x9af1('0x41')](_0xb9ab55[_0x9af1('0x3b')][_0x9af1('0x41')]));_0x1a5032[_0x9af1('0x40')]=_0x1a5032[_0x9af1('0x40')]['length']?_0x1a5032[_0x9af1('0x40')]:_0x278d9e[_0x9af1('0x3f')];if(!_0xb9ab55['query']['hasOwnProperty'](_0x9af1('0x42'))){_0x1a5032[_0x9af1('0x28')]=qs[_0x9af1('0x28')](_0xb9ab55[_0x9af1('0x3b')][_0x9af1('0x28')]);_0x1a5032[_0x9af1('0x25')]=qs[_0x9af1('0x25')](_0xb9ab55[_0x9af1('0x3b')][_0x9af1('0x25')]);}_0x1a5032[_0x9af1('0x43')]=qs[_0x9af1('0x44')](_0xb9ab55[_0x9af1('0x3b')][_0x9af1('0x44')]);_0x1a5032[_0x9af1('0x45')]=qs['filters'](_['pick'](_0xb9ab55[_0x9af1('0x3b')],_0x278d9e[_0x9af1('0x3d')]),_0x224b37);if(_0xb9ab55[_0x9af1('0x3b')][_0x9af1('0x46')]){_0x1a5032[_0x9af1('0x45')]=_[_0x9af1('0x47')](_0x1a5032[_0x9af1('0x45')],{'$or':_[_0x9af1('0x36')](_0x224b37,function(_0x1d9281){if(_0x1d9281['type']!==_0x9af1('0x48')){var _0xc7d29c={};_0xc7d29c[_0x1d9281[_0x9af1('0x34')]]={'$like':'%'+_0xb9ab55['query'][_0x9af1('0x46')]+'%'};return _0xc7d29c;}})});}_0x1a5032=_['merge']({},_0x1a5032,_0xb9ab55[_0x9af1('0x49')]);var _0x1f8704={'where':_0x1a5032[_0x9af1('0x45')]};return db[_0x9af1('0x4a')]['count'](_0x1f8704)[_0x9af1('0x2f')](function(_0x29b629){_0x5acbb6[_0x9af1('0x27')]=_0x29b629;if(_0xb9ab55['query'][_0x9af1('0x4b')]){_0x1a5032[_0x9af1('0x4c')]=[{'all':!![]}];}return db[_0x9af1('0x4a')]['findAll'](_0x1a5032);})[_0x9af1('0x2f')](function(_0x1e4d4d){_0x5acbb6['rows']=_0x1e4d4d;return _0x5acbb6;})[_0x9af1('0x2f')](respondWithFilteredResult(_0x5c339c,_0x1a5032))[_0x9af1('0x4d')](handleError(_0x5c339c,null));};exports['show']=function(_0x3334f2,_0x5e152d){var _0x4b63ec={'raw':!![],'where':{'id':_0x3334f2[_0x9af1('0x4e')]['id']}},_0x38aa75={};_0x38aa75[_0x9af1('0x3f')]=_[_0x9af1('0x3c')](db[_0x9af1('0x4a')][_0x9af1('0x37')]);_0x38aa75[_0x9af1('0x3b')]=_['keys'](_0x3334f2['query']);_0x38aa75[_0x9af1('0x3d')]=_['intersection'](_0x38aa75[_0x9af1('0x3f')],_0x38aa75[_0x9af1('0x3b')]);_0x4b63ec['attributes']=_[_0x9af1('0x3e')](_0x38aa75[_0x9af1('0x3f')],qs[_0x9af1('0x41')](_0x3334f2[_0x9af1('0x3b')][_0x9af1('0x41')]));_0x4b63ec[_0x9af1('0x40')]=_0x4b63ec[_0x9af1('0x40')]['length']?_0x4b63ec[_0x9af1('0x40')]:_0x38aa75[_0x9af1('0x3f')];if(_0x3334f2[_0x9af1('0x3b')]['includeAll']){_0x4b63ec[_0x9af1('0x4c')]=[{'all':!![]}];}_0x4b63ec=_[_0x9af1('0x47')]({},_0x4b63ec,_0x3334f2[_0x9af1('0x49')]);return db['Plugin']['find'](_0x4b63ec)[_0x9af1('0x2f')](handleEntityNotFound(_0x5e152d,null))[_0x9af1('0x2f')](respondWithResult(_0x5e152d,null))[_0x9af1('0x4d')](handleError(_0x5e152d,null));};exports['download']=function(_0x4e56a8,_0x338d4a,_0x2e87f1){return db[_0x9af1('0x4a')][_0x9af1('0x4f')]({'where':{'id':_0x4e56a8['params']['id']},'attributes':['name','path'],'raw':!![]})[_0x9af1('0x2f')](handleEntityNotFound(_0x338d4a,null))[_0x9af1('0x2f')](function(_0x50a9d0){if(_0x50a9d0){var _0x3d8322=path[_0x9af1('0x50')](config[_0x9af1('0x51')],'server/files/plugins',util[_0x9af1('0x52')](_0x9af1('0x53'),path[_0x9af1('0x54')](_0x50a9d0['path'])));var _0x68eaf6=fs[_0x9af1('0x55')](_0x3d8322);var _0x41564c=archiver('zip',{'zlib':{'level':0x9}});_0x41564c['on'](_0x9af1('0x56'),function(_0x18b434){if(_0x18b434[_0x9af1('0x57')]===_0x9af1('0x58')){logger[_0x9af1('0x32')](_0x18b434);}else{throw new db[(_0x9af1('0x59'))][(_0x9af1('0x5a'))](_0x9af1('0x5b'));}});_0x41564c['on']('error',function(_0x2c2468){throw new db[(_0x9af1('0x59'))]['Error'](_0x9af1('0x5b'));});_0x41564c[_0x9af1('0x5c')](_0x68eaf6);_0x41564c[_0x9af1('0x5d')](_0x9af1('0x5e'),{'cwd':path[_0x9af1('0x50')](config['root'],_0x9af1('0x5f'),path[_0x9af1('0x60')](_0x50a9d0[_0x9af1('0x7')])),'ignore':[path[_0x9af1('0x50')](path['basename'](_0x50a9d0[_0x9af1('0x7')]),'node_modules/**/*'),path[_0x9af1('0x50')](path[_0x9af1('0x54')](_0x50a9d0[_0x9af1('0x7')]),_0x9af1('0x61'))],'nodir':!![]})[_0x9af1('0x62')]();_0x68eaf6['on'](_0x9af1('0x63'),function(){if(!fs[_0x9af1('0x64')](_0x3d8322)){throw new db[(_0x9af1('0x59'))][(_0x9af1('0x5a'))](_0x9af1('0x65'));}return _0x338d4a['download'](_0x3d8322,util['format'](_0x9af1('0x53'),path[_0x9af1('0x54')](_0x50a9d0[_0x9af1('0x7')])),function(_0xc3b92d){if(_0xc3b92d){throw new db['Sequelize'][(_0x9af1('0x5a'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x9af1('0x66')](_0x3d8322);logger[_0x9af1('0x67')](_0x9af1('0x68'));logger[_0x9af1('0x67')](_0x9af1('0x69'));});});}return null;})[_0x9af1('0x4d')](handleError(_0x338d4a,null));};exports['upload']=function(_0x2a02cc,_0x2da636,_0x16ae2c){var _0x2c18eb=path[_0x9af1('0x54')](_0x2a02cc[_0x9af1('0x6a')][_0x9af1('0x6b')],path[_0x9af1('0x6c')](_0x2a02cc[_0x9af1('0x6a')][_0x9af1('0x6b')]));var _0x5785c5=path[_0x9af1('0x50')](config['root'],_0x9af1('0x5f'),_0x2a02cc[_0x9af1('0x6a')][_0x9af1('0x6b')]);var _0x197b73=path[_0x9af1('0x50')](config[_0x9af1('0x51')],_0x9af1('0x5f'),_0x2c18eb);logger['info'](_0x9af1('0x6d'),_0x5785c5);logger[_0x9af1('0x67')](_0x9af1('0x6e'),_0x197b73);try{fs[_0x9af1('0x6f')](_0x5785c5,parseInt(_0x9af1('0x70'),0x8));extract(_0x5785c5,{'dir':_0x197b73},function(_0x41aa0c){if(_0x41aa0c){logger['error'](_0x41aa0c);handleError(_0x41aa0c,!![]);};var _0x53d3ee=fs[_0x9af1('0x71')](_0x197b73);if(_0x53d3ee[_0x9af1('0x72')]>0x1){removeReferences(_0x5785c5,_0x197b73);logger[_0x9af1('0x32')](_0x9af1('0x73'));return _0x16ae2c(new Error(_0x9af1('0x73')));}var _0x227980=fs['lstatSync'](path['join'](_0x197b73,_0x53d3ee[0x0]));if(_0x227980[_0x9af1('0x74')]()){removeReferences(_0x5785c5,_0x197b73);logger[_0x9af1('0x32')](_0x9af1('0x73'));return _0x16ae2c(new Error(_0x9af1('0x73')));}if(_0x227980[_0x9af1('0x75')]()){var _0x24a5fd=fs['readdirSync'](path[_0x9af1('0x50')](_0x197b73,_0x53d3ee[0x0]));if(_0x24a5fd[_0x9af1('0x72')]===0x0){removeReferences(_0x5785c5,_0x197b73);logger[_0x9af1('0x32')](_0x9af1('0x73'));return _0x16ae2c(new Error(_0x9af1('0x73')));}var _0x580780=_0x24a5fd[_0x9af1('0x76')](function(_0x2a236a){return _0x2a236a===_0x9af1('0x77');});if(!_0x580780){return _0x16ae2c(new Error('Plugin\x20manifest\x20missing'));}var _0x531acd=fs['readFileSync'](path['join'](_0x197b73,_0x53d3ee[0x0],_0x9af1('0x77')));var _0x17d872=JSON[_0x9af1('0x78')](_0x531acd);if(_0x9af1('0x26')==typeof _0x17d872[_0x9af1('0x34')]){return _0x16ae2c(new Error(_0x9af1('0x79')));}if(_0x9af1('0x26')==typeof _0x17d872[_0x9af1('0x39')]){return _0x16ae2c(new Error(_0x9af1('0x7a')));}if(_0x9af1('0x26')==typeof _0x17d872[_0x9af1('0x7b')]){return _0x16ae2c(new Error(_0x9af1('0x7c')));}if('undefined'==typeof _0x17d872[_0x9af1('0x7d')]){return _0x16ae2c(new Error(_0x9af1('0x7e')));}if(_0x17d872['type']===_0x9af1('0x7f')){if(_0x9af1('0x26')==typeof _0x17d872['parameters'][_0x9af1('0x80')]){return _0x16ae2c(new Error(_0x9af1('0x81')));}if(_0x9af1('0x26')==typeof _0x17d872[_0x9af1('0x7d')]['views'][_0x9af1('0x82')]&&_0x9af1('0x26')==typeof _0x17d872[_0x9af1('0x7d')][_0x9af1('0x80')]['agent']){return _0x16ae2c(new Error(_0x9af1('0x83')));}}else if(_0x17d872['type']===_0x9af1('0x84')){if(_0x9af1('0x26')==typeof _0x17d872[_0x9af1('0x7d')][_0x9af1('0x85')]){return _0x16ae2c(new Error(_0x9af1('0x86')));}if(_0x9af1('0x26')==typeof _0x17d872[_0x9af1('0x7d')][_0x9af1('0x87')]){return _0x16ae2c(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x16ae2c(new Error(_0x9af1('0x88')));}var _0x471606=_0x17d872[_0x9af1('0x34')];var _0x40bfe6=_0x17d872[_0x9af1('0x89')];var _0x13230c=_0x17d872[_0x9af1('0x39')];var _0x2759a6=_0x17d872[_0x9af1('0x8a')]?_0x17d872[_0x9af1('0x8a')]:_0x9af1('0x8b');var _0xd4a482=_0x17d872['icon']?_0x17d872[_0x9af1('0x8c')]:_0x9af1('0x8d');var _0xfb4f20='';var _0x49556e='';var _0x448a55='';var _0x465540='';var _0x415755=_0x17d872[_0x9af1('0x7b')];if(_0x13230c===_0x9af1('0x7f')){if(_0x9af1('0x26')!=typeof _0x17d872[_0x9af1('0x7d')]['views'][_0x9af1('0x82')]){var _0x1837b8=_0x17d872[_0x9af1('0x7d')][_0x9af1('0x80')][_0x9af1('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1837b8)){_0xfb4f20=path[_0x9af1('0x50')](_0x9af1('0x8e'),_0x2c18eb,_0x53d3ee[0x0],_0x1837b8);}else{_0xfb4f20=_0x1837b8;}}else{logger[_0x9af1('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x9af1('0x26')!=typeof _0x17d872[_0x9af1('0x7d')]['views']['agent']){var _0x509a31=_0x17d872[_0x9af1('0x7d')][_0x9af1('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9af1('0x8f')](_0x509a31)){_0x49556e=path[_0x9af1('0x50')](_0x9af1('0x8e'),_0x2c18eb,_0x53d3ee[0x0],_0x509a31);}else{_0x49556e=_0x509a31;}}else{logger[_0x9af1('0x67')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x13230c==='script'){_0x448a55=_0x17d872['parameters'][_0x9af1('0x85')];_0x465540=_0x17d872[_0x9af1('0x7d')][_0x9af1('0x87')];if('undefined'!=typeof _0x17d872[_0x9af1('0x7d')][_0x9af1('0x80')]){if(_0x9af1('0x26')!=typeof _0x17d872[_0x9af1('0x7d')]['views'][_0x9af1('0x82')]){var _0x1837b8=_0x17d872[_0x9af1('0x7d')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9af1('0x8f')](_0x1837b8)){_0xfb4f20=path[_0x9af1('0x50')](_0x9af1('0x8e'),_0x2c18eb,_0x53d3ee[0x0],_0x1837b8);}else{_0xfb4f20=_0x1837b8;}}if(_0x9af1('0x26')!=typeof _0x17d872[_0x9af1('0x7d')]['views']['agent']){var _0x509a31=_0x17d872[_0x9af1('0x7d')][_0x9af1('0x80')][_0x9af1('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x509a31)){_0x49556e=path[_0x9af1('0x50')](_0x9af1('0x8e'),_0x2c18eb,_0x53d3ee[0x0],_0x509a31);}else{_0x49556e=_0x509a31;}}}}var _0x385ca6={'name':_0x471606,'description':_0x40bfe6,'path':path['join'](_0x2c18eb,_0x53d3ee[0x0]),'type':_0x13230c,'sidebar':_0x2759a6,'icon':_0xd4a482,'adminUrl':_0xfb4f20,'agentUrl':_0x49556e,'scriptName':_0x448a55,'scriptPath':_0x465540,'version':_0x415755};removeReferences(_0x5785c5,null);return db['Plugin'][_0x9af1('0x91')](_0x385ca6)['then'](function(_0x219dba){var _0x198df5={'role':_0x2a02cc[_0x9af1('0x92')][_0x9af1('0x93')],'userProfileId':_0x2a02cc[_0x9af1('0x92')]['userProfileId']};if(!_0x198df5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x198df5[_0x9af1('0x93')]==='user'){var _0x13b938=_0x219dba[_0x9af1('0x94')]({'plain':!![]});return db[_0x9af1('0x95')][_0x9af1('0x4f')]({'where':{'name':_0x9af1('0x96'),'userProfileId':_0x198df5[_0x9af1('0x97')]},'raw':!![]})[_0x9af1('0x2f')](function(_0x3cf0b3){if(_0x3cf0b3&&_0x3cf0b3['autoAssociation']===0x0){return db['UserProfileResource'][_0x9af1('0x91')]({'name':_0x13b938[_0x9af1('0x34')],'resourceId':_0x13b938['id'],'type':_0x3cf0b3[_0x9af1('0x34')],'sectionId':_0x3cf0b3['id']},{})[_0x9af1('0x2f')](function(){return _0x219dba;});}else{return _0x219dba;}})[_0x9af1('0x4d')](function(_0x415a8c){logger[_0x9af1('0x32')](_0x9af1('0x98'),_0x415a8c);throw _0x415a8c;});}return _0x219dba;})['then'](respondWithResult(_0x2da636,null))[_0x9af1('0x4d')](handleError(_0x2da636,null));}});}catch(_0x2c5a54){_0x2da636[_0x9af1('0x24')](0x1f4)[_0x9af1('0x99')](_0x2c5a54);}};function removeReferences(_0x1d3d57,_0x41e992){try{if(_0x1d3d57){fs[_0x9af1('0x66')](_0x1d3d57);logger[_0x9af1('0x67')]('Zip\x20archive\x20removed');}if(_0x41e992){rimraf(_0x41e992,function(){});logger[_0x9af1('0x67')](_0x9af1('0x9a'));}}catch(_0x2c9318){logger['error'](_0x2c9318);}}exports['update']=function(_0x52c448,_0x1f5c8a,_0x1ea917){return db['Plugin'][_0x9af1('0x4f')]({'where':{'id':_0x52c448['params']['id']}})[_0x9af1('0x2f')](handleEntityNotFound(_0x1f5c8a,null))[_0x9af1('0x2f')](saveUpdates(_0x52c448[_0x9af1('0x92')],null))['then'](respondWithResult(_0x1f5c8a,null))[_0x9af1('0x4d')](handleError(_0x1f5c8a,null));};exports[_0x9af1('0x9b')]=function(_0x41cdf1,_0x4d7cc5,_0x47219c){return db[_0x9af1('0x4a')][_0x9af1('0x4f')]({'where':{'id':_0x41cdf1[_0x9af1('0x4e')]['id']}})[_0x9af1('0x2f')](function(_0x128658){if(_0x128658){return _0x128658[_0x9af1('0x30')]();}})[_0x9af1('0x2f')](function(_0x3a8c32){rimraf(path[_0x9af1('0x50')](config[_0x9af1('0x51')],_0x9af1('0x5f'),path[_0x9af1('0x60')](_0x3a8c32[_0x9af1('0x7')])),function(){});return _0x3a8c32;})[_0x9af1('0x2f')](handleEntityNotFound(_0x4d7cc5,null))['then'](respondWithStatusCode(_0x4d7cc5,null))[_0x9af1('0x4d')](handleError(_0x4d7cc5,null));};exports[_0x9af1('0x9c')]=function(_0xa2335b,_0x4bc320,_0x58eb1e){return BPromise[_0x9af1('0x9d')]()[_0x9af1('0x2f')](function(){if(!_0xa2335b[_0x9af1('0x3b')][_0x9af1('0x7')]){throw new Error(_0x9af1('0x9e'));}if(!_0xa2335b[_0x9af1('0x3b')][_0x9af1('0x9f')]){throw new Error(_0x9af1('0xa0'));}var _0x55b1d8=_0xa2335b[_0x9af1('0x3b')][_0x9af1('0xa1')]?_0xa2335b[_0x9af1('0x3b')]['hostname']+':'+_0xa2335b[_0x9af1('0x3b')][_0x9af1('0x9f')]:'http://localhost:'+_0xa2335b['query'][_0x9af1('0x9f')];var _0x5edc28=_0xa2335b[_0x9af1('0x3b')][_0x9af1('0x2a')]?_0xa2335b[_0x9af1('0x3b')][_0x9af1('0x2a')]:!![];var _0x37402a=_0xa2335b[_0x9af1('0x3b')]['encoding']?_0xa2335b['query'][_0x9af1('0xa2')]:null;var _0x200a6d={'method':_0xa2335b[_0x9af1('0xa3')],'uri':util[_0x9af1('0x52')](_0x9af1('0xa4'),_0x55b1d8,_0xa2335b['query'][_0x9af1('0x7')]),'json':_0x5edc28,'resolveWithFullResponse':!![],'encoding':_0x37402a,'qs':_0xa2335b['query']};if(_0xa2335b[_0x9af1('0xa5')]){_0x200a6d['headers']=_0xa2335b['headers'];if(_0x200a6d[_0x9af1('0xa5')][_0x9af1('0xa6')]){delete _0x200a6d[_0x9af1('0xa5')][_0x9af1('0xa6')];}}if(_0x200a6d['headers'][_0x9af1('0xa7')]){delete _0x200a6d[_0x9af1('0xa5')][_0x9af1('0xa7')];}return rp(_0x200a6d);})['then'](function(_0x4dcac7){if(_0x4dcac7){_0x4bc320[_0x9af1('0xa8')](_0x4dcac7[_0x9af1('0xa5')]);logger[_0x9af1('0x67')](_0x4dcac7[_0x9af1('0x92')]);if(_[_0x9af1('0xa9')](_0xa2335b[_0x9af1('0x3b')][_0x9af1('0x7')],_0x9af1('0xaa'))&&_0x4dcac7[_0x9af1('0xab')]==0x1f4){return _0x4bc320['sendStatus'](_0x4dcac7[_0x9af1('0xab')]);}else{return _0x4bc320['status'](_0x4dcac7['statusCode'])[_0x9af1('0x99')](_0x4dcac7[_0x9af1('0x92')]);}}else{return _0x4bc320[_0x9af1('0x22')](0xc8);}})[_0x9af1('0x4d')](handleError(_0x4bc320,null));};exports[_0x9af1('0xac')]=function(_0x9622d9,_0x28954d,_0xe79e41){return BPromise['resolve']()['then'](function(){if(!_0x9622d9['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x9622d9['query'][_0x9af1('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x959166=_0x9622d9[_0x9af1('0x3b')][_0x9af1('0xa1')]?_0x9622d9[_0x9af1('0x3b')][_0x9af1('0xa1')]+':'+_0x9622d9[_0x9af1('0x3b')]['port']:_0x9af1('0xad')+_0x9622d9[_0x9af1('0x3b')]['port'];var _0x9e460a=_0x9622d9[_0x9af1('0x3b')][_0x9af1('0x2a')]?_0x9622d9[_0x9af1('0x3b')][_0x9af1('0x2a')]:!![];var _0x2f331a=_0x9622d9[_0x9af1('0x3b')][_0x9af1('0xa2')]?_0x9622d9[_0x9af1('0x3b')][_0x9af1('0xa2')]:null;var _0x846092={'method':_0x9622d9['method'],'uri':util['format']('%s%s',_0x959166,_0x9622d9[_0x9af1('0x3b')][_0x9af1('0x7')]),'json':_0x9e460a,'resolveWithFullResponse':!![],'encoding':_0x2f331a,'body':_0x9622d9['body']};if(_0x9622d9['headers']){_0x846092[_0x9af1('0xa5')]=_0x9622d9[_0x9af1('0xa5')];if(_0x846092[_0x9af1('0xa5')][_0x9af1('0xa6')]){delete _0x846092[_0x9af1('0xa5')][_0x9af1('0xa6')];}}if(_0x846092[_0x9af1('0xa5')][_0x9af1('0xa7')]){delete _0x846092[_0x9af1('0xa5')]['content-type'];}return rp(_0x846092);})[_0x9af1('0x2f')](function(_0x3e0cf0){if(_0x3e0cf0){_0x28954d['set'](_0x3e0cf0[_0x9af1('0xa5')]);logger[_0x9af1('0x67')](_0x3e0cf0['body']);return _0x28954d[_0x9af1('0x24')](_0x3e0cf0[_0x9af1('0xab')])[_0x9af1('0x99')](_0x3e0cf0[_0x9af1('0x92')]);}else{return _0x28954d[_0x9af1('0x22')](0xc8);}})[_0x9af1('0x4d')](handleError(_0x28954d,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 191f102..e31e919 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 _0x5e0c=['Plugin','setMaxListeners','save','update','remove','emit','exports','../../mysqldb'];(function(_0x8f2981,_0xd648d6){var _0x2cde7b=function(_0x684c25){while(--_0x684c25){_0x8f2981['push'](_0x8f2981['shift']());}};_0x2cde7b(++_0xd648d6);}(_0x5e0c,0x19f));var _0xc5e0=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0x5e0c[_0xf1af27];return _0x46b274;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc5e0('0x0'))['db'][_0xc5e0('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc5e0('0x2')](0x0);var events={'afterCreate':_0xc5e0('0x3'),'afterUpdate':_0xc5e0('0x4'),'afterDestroy':_0xc5e0('0x5')};function emitEvent(_0x4adda8){return function(_0x60c6c3,_0x108ea2,_0x43f754){PluginEvents[_0xc5e0('0x6')](_0x4adda8+':'+_0x60c6c3['id'],_0x60c6c3);PluginEvents[_0xc5e0('0x6')](_0x4adda8,_0x60c6c3);_0x43f754(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xc5e0('0x7')]=PluginEvents; \ No newline at end of file +var _0xa751=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa751,0x175));var _0x1a75=function(_0x2edbca,_0xd54fda){_0x2edbca=_0x2edbca-0x0;var _0x5e1392=_0xa751[_0x2edbca];return _0x5e1392;};'use strict';var EventEmitter=require(_0x1a75('0x0'));var Plugin=require(_0x1a75('0x1'))['db'][_0x1a75('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1a75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a75('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31db55){return function(_0x95fa7,_0x2ea393,_0x4ebf37){PluginEvents[_0x1a75('0x5')](_0x31db55+':'+_0x95fa7['id'],_0x95fa7);PluginEvents[_0x1a75('0x5')](_0x31db55,_0x95fa7);_0x4ebf37(null);};}for(var e in events){if(events[_0x1a75('0x6')](e)){var event=events[e];Plugin[_0x1a75('0x7')](e,emitEvent(event));}}module[_0x1a75('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c3aa71c..d4e18c2 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 _0xebd1=['util','api','moment','bluebird','request-promise','rimraf','exports','define','plugins','lodash'];(function(_0x3282cf,_0x5107d0){var _0x2e6730=function(_0x22bc31){while(--_0x22bc31){_0x3282cf['push'](_0x3282cf['shift']());}};_0x2e6730(++_0x5107d0);}(_0xebd1,0x1df));var _0x1ebd=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0xebd1[_0x459423];return _0x42ed14;};'use strict';var _=require(_0x1ebd('0x0'));var util=require(_0x1ebd('0x1'));var logger=require('../../config/logger')(_0x1ebd('0x2'));var moment=require(_0x1ebd('0x3'));var BPromise=require(_0x1ebd('0x4'));var rp=require(_0x1ebd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ebd('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x1ebd('0x7')]=function(_0xb2cc22,_0x1afce7){return _0xb2cc22[_0x1ebd('0x8')]('Plugin',attributes,{'tableName':_0x1ebd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab60=['../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4b9f0e,_0x449c4d){var _0x5c54a8=function(_0x8c0a23){while(--_0x8c0a23){_0x4b9f0e['push'](_0x4b9f0e['shift']());}};_0x5c54a8(++_0x449c4d);}(_0xab60,0xea));var _0x0ab6=function(_0x14538d,_0x527062){_0x14538d=_0x14538d-0x0;var _0x32d601=_0xab60[_0x14538d];return _0x32d601;};'use strict';var _=require(_0x0ab6('0x0'));var util=require(_0x0ab6('0x1'));var logger=require(_0x0ab6('0x2'))(_0x0ab6('0x3'));var moment=require(_0x0ab6('0x4'));var BPromise=require('bluebird');var rp=require(_0x0ab6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0ab6('0x6'));var attributes=require(_0x0ab6('0x7'));module[_0x0ab6('0x8')]=function(_0x2914a0,_0x8122ee){return _0x2914a0[_0x0ab6('0x9')](_0x0ab6('0xa'),attributes,{'tableName':_0x0ab6('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 da8614e..7f9c3b1 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 _0x2439=['Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x32724a,_0x242334){var _0x39c409=function(_0x1461c2){while(--_0x1461c2){_0x32724a['push'](_0x32724a['shift']());}};_0x39c409(++_0x242334);}(_0x2439,0x155));var _0x9243=function(_0x35c1db,_0xd75c15){_0x35c1db=_0x35c1db-0x0;var _0x4173ff=_0x2439[_0x35c1db];return _0x4173ff;};'use strict';var _=require(_0x9243('0x0'));var util=require(_0x9243('0x1'));var moment=require(_0x9243('0x2'));var BPromise=require(_0x9243('0x3'));var rs=require(_0x9243('0x4'));var fs=require('fs');var Redis=require(_0x9243('0x5'));var db=require(_0x9243('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9243('0x7'))('rpc');var config=require(_0x9243('0x8'));var jayson=require(_0x9243('0x9'));var client=jayson[_0x9243('0xa')][_0x9243('0xb')]({'port':0x232a});config[_0x9243('0xc')]=_[_0x9243('0xd')](config[_0x9243('0xc')],{'host':_0x9243('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9243('0xc')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x5dddc8,_0x4f6790,_0x4345cf){return new BPromise(function(_0x1d5e7d,_0x319621){return client[_0x9243('0xf')](_0x5dddc8,_0x4345cf)['then'](function(_0x4614f4){logger[_0x9243('0x10')]('Plugin,\x20%s,\x20%s',_0x4f6790,_0x9243('0x11'));logger[_0x9243('0x12')](_0x9243('0x13'),_0x4f6790,'request\x20sent',JSON['stringify'](_0x4614f4));if(_0x4614f4['error']){if(_0x4614f4[_0x9243('0x14')][_0x9243('0x15')]===0x1f4){logger['error'](_0x9243('0x16'),_0x4f6790,_0x4614f4[_0x9243('0x14')][_0x9243('0x17')]);return _0x319621(_0x4614f4[_0x9243('0x14')][_0x9243('0x17')]);}logger[_0x9243('0x14')](_0x9243('0x16'),_0x4f6790,_0x4614f4[_0x9243('0x14')][_0x9243('0x17')]);return _0x1d5e7d(_0x4614f4[_0x9243('0x14')][_0x9243('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x4f6790,'request\x20sent');_0x1d5e7d(_0x4614f4[_0x9243('0x18')]['message']);}})[_0x9243('0x19')](function(_0x530f75){logger[_0x9243('0x14')](_0x9243('0x16'),_0x4f6790,_0x530f75);_0x319621(_0x530f75);});});}exports[_0x9243('0x1a')]=function(_0x29f5b3){var _0x59afdd=this;return new Promise(function(_0x2ad714,_0x343518){return db[_0x9243('0x1b')][_0x9243('0x1c')](_0x29f5b3['body'],{'raw':_0x29f5b3[_0x9243('0x1d')]?_0x29f5b3[_0x9243('0x1d')][_0x9243('0x1e')]===undefined?!![]:![]:!![]})[_0x9243('0x1f')](function(_0x3504c7){logger[_0x9243('0x10')](_0x9243('0x1a'),_0x29f5b3);logger[_0x9243('0x12')](_0x9243('0x1a'),_0x29f5b3,JSON[_0x9243('0x20')](_0x3504c7));_0x2ad714(_0x3504c7);})[_0x9243('0x19')](function(_0x2343fc){logger['error']('CreatePlugin',_0x2343fc[_0x9243('0x17')],_0x29f5b3);_0x343518(_0x59afdd[_0x9243('0x14')](0x1f4,_0x2343fc[_0x9243('0x17')]));});});}; \ No newline at end of file +var _0xc3af=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','info','CreatePlugin','create','body','options','raw','catch','lodash','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s'];(function(_0x400d28,_0x368388){var _0x44808a=function(_0x52b747){while(--_0x52b747){_0x400d28['push'](_0x400d28['shift']());}};_0x44808a(++_0x368388);}(_0xc3af,0x112));var _0xfc3a=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0xc3af[_0x134192];return _0x3cd080;};'use strict';var _=require(_0xfc3a('0x0'));var util=require(_0xfc3a('0x1'));var moment=require('moment');var BPromise=require(_0xfc3a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc3a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfc3a('0x4'))('rpc');var config=require(_0xfc3a('0x5'));var jayson=require(_0xfc3a('0x6'));var client=jayson[_0xfc3a('0x7')]['http']({'port':0x232a});config[_0xfc3a('0x8')]=_[_0xfc3a('0x9')](config[_0xfc3a('0x8')],{'host':_0xfc3a('0xa'),'port':0x18eb});var socket=require(_0xfc3a('0xb'))(new Redis(config[_0xfc3a('0x8')]));require(_0xfc3a('0xc'))['register'](socket);function respondWithRpcPromise(_0x13a666,_0x2744bd,_0x23ebb1){return new BPromise(function(_0x3c7721,_0x20a841){return client[_0xfc3a('0xd')](_0x13a666,_0x23ebb1)[_0xfc3a('0xe')](function(_0x29c816){logger['info'](_0xfc3a('0xf'),_0x2744bd,_0xfc3a('0x10'));logger[_0xfc3a('0x11')](_0xfc3a('0x12'),_0x2744bd,'request\x20sent',JSON['stringify'](_0x29c816));if(_0x29c816[_0xfc3a('0x13')]){if(_0x29c816[_0xfc3a('0x13')][_0xfc3a('0x14')]===0x1f4){logger[_0xfc3a('0x13')](_0xfc3a('0xf'),_0x2744bd,_0x29c816['error'][_0xfc3a('0x15')]);return _0x20a841(_0x29c816['error']['message']);}logger[_0xfc3a('0x13')](_0xfc3a('0xf'),_0x2744bd,_0x29c816['error'][_0xfc3a('0x15')]);return _0x3c7721(_0x29c816['error'][_0xfc3a('0x15')]);}else{logger[_0xfc3a('0x16')](_0xfc3a('0xf'),_0x2744bd,_0xfc3a('0x10'));_0x3c7721(_0x29c816['result'][_0xfc3a('0x15')]);}})['catch'](function(_0x430d31){logger[_0xfc3a('0x13')](_0xfc3a('0xf'),_0x2744bd,_0x430d31);_0x20a841(_0x430d31);});});}exports[_0xfc3a('0x17')]=function(_0x3d19f8){var _0x33e299=this;return new Promise(function(_0x1aca05,_0x360501){return db['Plugin'][_0xfc3a('0x18')](_0x3d19f8[_0xfc3a('0x19')],{'raw':_0x3d19f8[_0xfc3a('0x1a')]?_0x3d19f8[_0xfc3a('0x1a')][_0xfc3a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x446e5b){logger[_0xfc3a('0x16')](_0xfc3a('0x17'),_0x3d19f8);logger[_0xfc3a('0x11')](_0xfc3a('0x17'),_0x3d19f8,JSON['stringify'](_0x446e5b));_0x1aca05(_0x446e5b);})[_0xfc3a('0x1c')](function(_0x279651){logger['error'](_0xfc3a('0x17'),_0x279651[_0xfc3a('0x15')],_0x3d19f8);_0x360501(_0x33e299[_0xfc3a('0x13')](0x1f4,_0x279651[_0xfc3a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3d24766..c78db2a 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 _0x1cdb=['length','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1cdb,0x179));var _0xb1cd=function(_0x41a5a5,_0x6ff62c){_0x41a5a5=_0x41a5a5-0x0;var _0x1f8471=_0x1cdb[_0x41a5a5];return _0x1f8471;};'use strict';var PluginEvents=require(_0xb1cd('0x0'));var events=[_0xb1cd('0x1'),_0xb1cd('0x2'),_0xb1cd('0x3')];function createListener(_0x560679,_0x4d9ba2){return function(_0x1dc090){_0x4d9ba2[_0xb1cd('0x4')](_0x560679,_0x1dc090);};}function removeListener(_0x3dd3f9,_0x4f7d88){return function(){PluginEvents[_0xb1cd('0x5')](_0x3dd3f9,_0x4f7d88);};}exports[_0xb1cd('0x6')]=function(_0x6a8520){for(var _0x23c0a0=0x0,_0x468b20=events[_0xb1cd('0x7')];_0x23c0a0<_0x468b20;_0x23c0a0++){var _0x90b770=events[_0x23c0a0];var _0x4923ed=createListener('plugin:'+_0x90b770,_0x6a8520);PluginEvents['on'](_0x90b770,_0x4923ed);}}; \ No newline at end of file +var _0x4620=['remove','removeListener','length','plugin:','./plugin.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4620,0x11c));var _0x0462=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0x4620[_0x585d09];return _0x7d9a14;};'use strict';var PluginEvents=require(_0x0462('0x0'));var events=['save',_0x0462('0x1'),'update'];function createListener(_0x3f7482,_0x5b4c1a){return function(_0x3db166){_0x5b4c1a['emit'](_0x3f7482,_0x3db166);};}function removeListener(_0x5ac472,_0x5826fd){return function(){PluginEvents[_0x0462('0x2')](_0x5ac472,_0x5826fd);};}exports['register']=function(_0x54e143){for(var _0x1cdb26=0x0,_0x4019fa=events[_0x0462('0x3')];_0x1cdb26<_0x4019fa;_0x1cdb26++){var _0x53cb82=events[_0x1cdb26];var _0x58e15b=createListener(_0x0462('0x4')+_0x53cb82,_0x54e143);PluginEvents['on'](_0x53cb82,_0x58e15b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8dc85b8..7fa5aa6 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(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x3d06b2,_0x2b82c7){var _0x2a9f48=function(_0xa9da7a){while(--_0xa9da7a){_0x3d06b2['push'](_0x3d06b2['shift']());}};_0x2a9f48(++_0x2b82c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 b718785..739943c 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 _0xda55=['Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','length','show','describe','params','catch','create','body','script','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty'];(function(_0x3a4d49,_0x3f1836){var _0x1a98d7=function(_0x162852){while(--_0x162852){_0x3a4d49['push'](_0x3a4d49['shift']());}};_0x1a98d7(++_0x3f1836);}(_0xda55,0x6d));var _0x5da5=function(_0x410c09,_0xe6e6ac){_0x410c09=_0x410c09-0x0;var _0x4d232d=_0xda55[_0x410c09];return _0x4d232d;};'use strict';var _=require(_0x5da5('0x0'));var pm2=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x5da5('0x2'));var exec=require(_0x5da5('0x3'))[_0x5da5('0x4')];var BPromise=require(_0x5da5('0x5'));function handleEntityNotFound(_0x1c3afd,_0x5da254){return function(_0x3400e9){if(!_0x3400e9){_0x1c3afd['sendStatus'](0x194);;}return _0x3400e9;};}function respondWithResult(_0x356a37,_0x58e7b3){_0x58e7b3=_0x58e7b3||0xc8;return function(_0x2fd877){if(_0x2fd877){return _0x356a37[_0x5da5('0x6')](_0x58e7b3)[_0x5da5('0x7')](_0x2fd877);}return null;};}function handleError(_0x46290d,_0x3debdf){_0x3debdf=_0x3debdf||0x1f4;return function(_0x25c873){logger[_0x5da5('0x8')](_0x25c873[_0x5da5('0x9')]);if(_0x25c873['name']){delete _0x25c873[_0x5da5('0xa')];}_0x46290d[_0x5da5('0x6')](_0x3debdf)[_0x5da5('0xb')](_0x25c873);};}function execChildProcess(){return new BPromise(function(_0x26fbe3,_0x1a047e){exec(_0x5da5('0xc'),function(_0x33313e,_0x589c14,_0x2f4e4b){logger[_0x5da5('0xd')](_0x589c14);logger['info'](_0x2f4e4b);if(_0x33313e){logger[_0x5da5('0x8')](_0x33313e);return _0x1a047e(_0x33313e);}return _0x26fbe3(_0x589c14);});});}exports[_0x5da5('0xe')]=function(_0x3ced00,_0x43d526){return pm2[_0x5da5('0xf')]()[_0x5da5('0x10')](function(_0x481562){if(_0x481562){var _0x489b60=_['reject'](_0x481562,function(_0x4267cd){return _0x4267cd[_0x5da5('0xa')]===_0x5da5('0x11')||_0x4267cd[_0x5da5('0xa')]===_0x5da5('0x12');});return{'rows':_0x489b60,'count':_0x489b60[_0x5da5('0x13')]};}return null;})[_0x5da5('0x10')](respondWithResult(_0x43d526,null))['catch'](handleError(_0x43d526,null));};exports[_0x5da5('0x14')]=function(_0x290136,_0x1a4849){return pm2[_0x5da5('0x15')](_0x290136[_0x5da5('0x16')]['id'])[_0x5da5('0x10')](respondWithResult(_0x1a4849,null))['then'](handleEntityNotFound(_0x1a4849,null))[_0x5da5('0x17')](handleError(_0x1a4849,null));};exports[_0x5da5('0x18')]=function(_0x3d3d26,_0x30cde5){if(_0x3d3d26[_0x5da5('0x19')]['name']&&_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]){var _0x42a3cb=path['join'](__dirname,_0x5da5('0x1b'),_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]);var _0x2e68d5=process[_0x5da5('0x1c')]();process[_0x5da5('0x1d')](path['dirname'](_0x42a3cb));return execChildProcess()[_0x5da5('0x10')](function(_0x568ddf){process[_0x5da5('0x1d')](_0x2e68d5);return pm2[_0x5da5('0x1e')]({'name':_0x3d3d26[_0x5da5('0x19')]['name'],'script':_0x42a3cb});})[_0x5da5('0x10')](function(_0x236bf3){pm2[_0x5da5('0x1f')]();return _0x236bf3[0x0];})[_0x5da5('0x10')](respondWithResult(_0x30cde5,0xc9))['catch'](handleError(_0x30cde5,null));}else{return _0x30cde5['status'](0x1f4)['send']({'message':_0x5da5('0x20')});}};exports['update']=function(_0x4e8890,_0x1f75f3){if(_0x4e8890[_0x5da5('0x19')]['id']){delete _0x4e8890['body']['id'];}var _0x1798ae={'online':_0x5da5('0x21'),'stopped':'stop'};if(_0x1798ae[_0x5da5('0x22')](_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')])){return pm2[_0x1798ae[_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')]]](_0x4e8890['params']['id'])[_0x5da5('0x10')](respondWithResult(_0x1f75f3,0xc8))[_0x5da5('0x17')](handleError(_0x1f75f3,null));}else{return _0x1f75f3[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x4cb022,_0x245273){if(_0x4cb022[_0x5da5('0x19')]['id']){delete _0x4cb022[_0x5da5('0x19')]['id'];}if(_0x4cb022[_0x5da5('0x16')]['id']){return pm2['delete'](_0x4cb022['params']['id'])[_0x5da5('0x10')](function(_0x4afb58){pm2['dump']();return _0x4afb58[0x0];})[_0x5da5('0x10')](respondWithResult(_0x245273,null))['catch'](handleError(_0x245273,null));}else{return _0x245273[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':_0x5da5('0x23')});}}; \ No newline at end of file +var _0xd404=['stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','api','path','exec','bluebird','sendStatus','json','name','status','send','npm\x20install','info','error','index','list','then','express','motion2','length','catch','show','describe','params','body','join','script','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x4b9077,_0x5d663e){var _0x56a66b=function(_0x3ef590){while(--_0x3ef590){_0x4b9077['push'](_0x4b9077['shift']());}};_0x56a66b(++_0x5d663e);}(_0xd404,0x15b));var _0x4d40=function(_0x3debfb,_0x4912fd){_0x3debfb=_0x3debfb-0x0;var _0x60e082=_0xd404[_0x3debfb];return _0x60e082;};'use strict';var _=require(_0x4d40('0x0'));var pm2=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var path=require(_0x4d40('0x3'));var exec=require('child_process')[_0x4d40('0x4')];var BPromise=require(_0x4d40('0x5'));function handleEntityNotFound(_0xba821,_0x8bde12){return function(_0xbfb4c6){if(!_0xbfb4c6){_0xba821[_0x4d40('0x6')](0x194);;}return _0xbfb4c6;};}function respondWithResult(_0xc2a9db,_0x24a237){_0x24a237=_0x24a237||0xc8;return function(_0x2e4bd8){if(_0x2e4bd8){return _0xc2a9db['status'](_0x24a237)[_0x4d40('0x7')](_0x2e4bd8);}return null;};}function handleError(_0x116941,_0x5a23a2){_0x5a23a2=_0x5a23a2||0x1f4;return function(_0x3bf81a){logger['error'](_0x3bf81a['stack']);if(_0x3bf81a[_0x4d40('0x8')]){delete _0x3bf81a[_0x4d40('0x8')];}_0x116941[_0x4d40('0x9')](_0x5a23a2)[_0x4d40('0xa')](_0x3bf81a);};}function execChildProcess(){return new BPromise(function(_0x1d00cf,_0x357abf){exec(_0x4d40('0xb'),function(_0x2eab7a,_0x1e18bc,_0x3f5c29){logger[_0x4d40('0xc')](_0x1e18bc);logger[_0x4d40('0xc')](_0x3f5c29);if(_0x2eab7a){logger[_0x4d40('0xd')](_0x2eab7a);return _0x357abf(_0x2eab7a);}return _0x1d00cf(_0x1e18bc);});});}exports[_0x4d40('0xe')]=function(_0x5162f9,_0xa644d2){return pm2[_0x4d40('0xf')]()[_0x4d40('0x10')](function(_0x2083bd){if(_0x2083bd){var _0x477a91=_['reject'](_0x2083bd,function(_0x23de7b){return _0x23de7b[_0x4d40('0x8')]===_0x4d40('0x11')||_0x23de7b[_0x4d40('0x8')]===_0x4d40('0x12');});return{'rows':_0x477a91,'count':_0x477a91[_0x4d40('0x13')]};}return null;})[_0x4d40('0x10')](respondWithResult(_0xa644d2,null))[_0x4d40('0x14')](handleError(_0xa644d2,null));};exports[_0x4d40('0x15')]=function(_0x4b5d23,_0x535989){return pm2[_0x4d40('0x16')](_0x4b5d23[_0x4d40('0x17')]['id'])['then'](respondWithResult(_0x535989,null))[_0x4d40('0x10')](handleEntityNotFound(_0x535989,null))[_0x4d40('0x14')](handleError(_0x535989,null));};exports['create']=function(_0x36d031,_0x5a77e0){if(_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')]&&_0x36d031['body']['script']){var _0x375ce0=path[_0x4d40('0x19')](__dirname,'../../files/plugins',_0x36d031[_0x4d40('0x18')][_0x4d40('0x1a')]);var _0x30f058=process['cwd']();process[_0x4d40('0x1b')](path[_0x4d40('0x1c')](_0x375ce0));return execChildProcess()[_0x4d40('0x10')](function(_0x5ca0a0){process['chdir'](_0x30f058);return pm2[_0x4d40('0x1d')]({'name':_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')],'script':_0x375ce0});})[_0x4d40('0x10')](function(_0x4677c9){pm2['dump']();return _0x4677c9[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a77e0,0xc9))[_0x4d40('0x14')](handleError(_0x5a77e0,null));}else{return _0x5a77e0['status'](0x1f4)['send']({'message':_0x4d40('0x1e')});}};exports[_0x4d40('0x1f')]=function(_0x3fa83e,_0x3ad1d7){if(_0x3fa83e[_0x4d40('0x18')]['id']){delete _0x3fa83e[_0x4d40('0x18')]['id'];}var _0x105635={'online':_0x4d40('0x20'),'stopped':_0x4d40('0x21')};if(_0x105635[_0x4d40('0x22')](_0x3fa83e[_0x4d40('0x18')]['status'])){return pm2[_0x105635[_0x3fa83e['body']['status']]](_0x3fa83e[_0x4d40('0x17')]['id'])[_0x4d40('0x10')](respondWithResult(_0x3ad1d7,0xc8))[_0x4d40('0x14')](handleError(_0x3ad1d7,null));}else{return _0x3ad1d7[_0x4d40('0x9')](0x1f4)['send']({'message':_0x4d40('0x23')});}};exports[_0x4d40('0x24')]=function(_0x429da9,_0x5a6aff){if(_0x429da9[_0x4d40('0x18')]['id']){delete _0x429da9[_0x4d40('0x18')]['id'];}if(_0x429da9[_0x4d40('0x17')]['id']){return pm2[_0x4d40('0x25')](_0x429da9[_0x4d40('0x17')]['id'])['then'](function(_0x2f4b22){pm2['dump']();return _0x2f4b22[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a6aff,null))[_0x4d40('0x14')](handleError(_0x5a6aff,null));}else{return _0x5a6aff[_0x4d40('0x9')](0x1f4)[_0x4d40('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 616d6fd..35b8919 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 _0x27ab=['./realtime.controller','/agents','get','/queues','isAuthenticated','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x4b08a7,_0x4ae9c7){var _0x36ea7e=function(_0x389afa){while(--_0x389afa){_0x4b08a7['push'](_0x4b08a7['shift']());}};_0x36ea7e(++_0x4ae9c7);}(_0x27ab,0x151));var _0xb27a=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x27ab[_0x68ee8b];return _0x5148f7;};'use strict';var express=require(_0xb27a('0x0'));var router=express[_0xb27a('0x1')]();var auth=require(_0xb27a('0x2'));var controller=require(_0xb27a('0x3'));router['get'](_0xb27a('0x4'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb27a('0x5')](_0xb27a('0x6'),auth[_0xb27a('0x7')](),controller[_0xb27a('0x8')]);module[_0xb27a('0x9')]=router; \ No newline at end of file +var _0x7f97=['Router','get','isAuthenticated','getAgents','/queues','exports'];(function(_0x35576f,_0x47a4da){var _0x4c1f92=function(_0x1d9128){while(--_0x1d9128){_0x35576f['push'](_0x35576f['shift']());}};_0x4c1f92(++_0x47a4da);}(_0x7f97,0x84));var _0x77f9=function(_0x10d965,_0x4c9ee3){_0x10d965=_0x10d965-0x0;var _0x2280be=_0x7f97[_0x10d965];return _0x2280be;};'use strict';var express=require('express');var router=express[_0x77f9('0x0')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x77f9('0x1')]('/agents',auth[_0x77f9('0x2')](),controller[_0x77f9('0x3')]);router[_0x77f9('0x1')](_0x77f9('0x4'),auth['isAuthenticated'](),controller['getQueues']);module[_0x77f9('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index ab14948..0a86f35 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 _0x0254=['map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','sequelize','literal','FIELD(id,','forEach','Pause','push','where','user','userProfileId','Agents','online','extraQueryConditions','UserProfile','getResources','find','filterAgentAttributes','getAgentStatus','includes','voice','voiceStatus','talking','Status','sortAgentsByStatus','pick','getQueues','isValidChannel','outbound','dialActive','dialMethod','startCase','Queues','name','filter','assign','getRealtimeQueues','initializeQueues','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus'];(function(_0x3df312,_0x58719b){var _0x1ed2ac=function(_0x44c1df){while(--_0x44c1df){_0x3df312['push'](_0x3df312['shift']());}};_0x1ed2ac(++_0x58719b);}(_0x0254,0x13b));var _0x4025=function(_0x32658e,_0x3d37db){_0x32658e=_0x32658e-0x0;var _0x325274=_0x0254[_0x32658e];return _0x325274;};'use strict';var _=require(_0x4025('0x0'));var util=require(_0x4025('0x1'));var rta=require(_0x4025('0x2'));var rtq=require(_0x4025('0x3'));var qs=require(_0x4025('0x4'));var utils=require(_0x4025('0x5'));var db=require(_0x4025('0x6'))['db'];var APIBadRequestError=require(_0x4025('0x7'))[_0x4025('0x8')];var APIHandleError=require(_0x4025('0x7'))[_0x4025('0x9')];function respondWithFilteredResult(_0x20d4f1,_0x33bc3d){return function(_0x3e3579){if(_0x3e3579){var _0x1575fb=typeof _0x33bc3d[_0x4025('0xa')]===_0x4025('0xb')&&typeof _0x33bc3d['limit']===_0x4025('0xb');var _0x1cb98a=_0x3e3579['count'];var _0x595f53=_0x1575fb?0x0:_0x33bc3d['offset'];var _0x525299=_0x1575fb?_0x3e3579[_0x4025('0xc')]:_0x33bc3d['offset']+_0x33bc3d[_0x4025('0xd')];var _0x5125a5;if(_0x525299>=_0x1cb98a){_0x525299=_0x1cb98a;_0x5125a5=0xc8;}else{_0x5125a5=0xce;}_0x20d4f1[_0x4025('0xe')](_0x5125a5);return _0x20d4f1[_0x4025('0xf')](_0x4025('0x10'),_0x595f53+'-'+_0x525299+'/'+_0x1cb98a)[_0x4025('0x11')](_0x3e3579);}return null;};}exports[_0x4025('0x12')]=function(_0xa50f00,_0x1bf10f){var _0x5767cd={'count':0x0,'rows':[]};var _0x4c8d9f={};var _0xafb833;var _0x256114=utils[_0x4025('0x13')]();var _0x757928;var _0x37ee2f;var _0x25ba08=_0xa50f00[_0x4025('0x14')][_0x4025('0x15')];var _0x16ac69=_0xa50f00[_0x4025('0x14')]['globalStatusFilter'];var _0x42ff36=_0xa50f00[_0x4025('0x14')][_0x4025('0x16')];var _0xb5d599=_0x16ac69===_0x4025('0x17')||_0x16ac69===_0x4025('0x18')?!![]:![];var _0x419160=[];var _0x1c6171;var _0x537681;Promise[_0x4025('0x19')]()[_0x4025('0x1a')](function(){if(_0xa50f00[_0x4025('0x14')][_0x4025('0x1b')]){if(!utils['isValidChannel'](_0xa50f00[_0x4025('0x14')][_0x4025('0x1b')])){throw new APIBadRequestError(util[_0x4025('0x1c')](_0x4025('0x1d'),_0xa50f00[_0x4025('0x14')][_0x4025('0x1b')]));}_0xafb833=_0xa50f00[_0x4025('0x14')][_0x4025('0x1b')][_0x4025('0x1e')]();}if(!_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]||!_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]['includes'](_0x4025('0x20'))){_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]=rta[_0x4025('0x21')](_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]);return;}var _0xd6841d=rta[_0x4025('0x22')](_0xa50f00[_0x4025('0x14')]['sort']);_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]=_0xd6841d[_0x4025('0x23')][_0x4025('0x24')](',');_0x1c6171=_0xd6841d[_0x4025('0x25')];})[_0x4025('0x1a')](function(){if(!_0x25ba08){return[];}return rta[_0x4025('0x26')](_0x25ba08,_0xafb833);})[_0x4025('0x1a')](function(_0x4b10ba){_0x419160=_0x4b10ba;return rta['getRealtimeAgents']();})[_0x4025('0x1a')](function(_0x471d30){_0x37ee2f=_0x471d30[_0x4025('0x27')];if((!_0x16ac69||_0xb5d599)&&!_0x1c6171){return _0x419160;}if(_0x1c6171&&!_0x16ac69){return rta[_0x4025('0x28')](_0x37ee2f,_0x419160,_0x1c6171);}else{return rta['getAgentIdsByStatus'](_0x37ee2f,_0x419160,_0x16ac69);}})[_0x4025('0x1a')](function(_0x5f1d3c){_0x419160=_0x5f1d3c;var _0xafad1e=![];if(_0x419160['length']===0x0){if(_0x25ba08||_0x16ac69){_0xafad1e=!![];}if(_0xb5d599){_0xafad1e=![];}}if(_0xafad1e){return _0x5767cd;}var _0x3fc624=_[_0x4025('0x29')](db[_0x4025('0x2a')][_0x4025('0x2b')],function(_0x4fb8ef){return{'name':_0x4fb8ef[_0x4025('0x2c')],'type':_0x4fb8ef[_0x4025('0x2d')][_0x4025('0x2e')]};});_0xa50f00[_0x4025('0x14')][_0x4025('0x2f')]=_0x4025('0x30');_0x4c8d9f=qs[_0x4025('0x31')](_0x3fc624,_0xa50f00);_0x4c8d9f[_0x4025('0x32')]=!![];var _0x2c0c8e=[];if(_0x419160[_0x4025('0x33')]>0x0){_0x2c0c8e['push']({'id':{'$in':_0x419160}});if(_0x1c6171&&!_0x16ac69){_0x537681=[db[_0x4025('0x34')][_0x4025('0x35')](_0x4025('0x36')+_0x419160+')')];_0x4c8d9f['order']=_0x537681;}}if(_0xb5d599){_0x256114[_0x4025('0x37')](function(_0xd4ff){var _0x2ff8bd=!![];if(_0x16ac69===_0x4025('0x18')&&_0xafb833!==_0xd4ff){_0x2ff8bd=![];}_0x2c0c8e['push']({[_0xd4ff+_0x4025('0x38')]:_0x2ff8bd});});if(_0x42ff36){_0x2c0c8e[_0x4025('0x39')]({'pauseType':_0x42ff36});}}else if(_0x16ac69){_0x256114[_0x4025('0x37')](function(_0x4edbaf){_0x2c0c8e[_0x4025('0x39')]({[_0x4edbaf+'Pause']:![]});});}_0x4c8d9f[_0x4025('0x3a')]=_['merge'](_0x4c8d9f[_0x4025('0x3a')],{'$and':_0x2c0c8e});if(_0xa50f00['user'][_0x4025('0x2f')]==='user'){var _0x47e26e={'params':{'id':_0xa50f00[_0x4025('0x3b')][_0x4025('0x3c')]},'query':{'section':_0x4025('0x3d'),'role':'agent','raw':!![],'ids':_0x419160,'customSorting':_0x537681}};if(_0xa50f00[_0x4025('0x14')][_0x4025('0x3e')]){_0x47e26e[_0x4025('0x14')][_0x4025('0x3e')]=!![];}if(_0xb5d599){_0x47e26e[_0x4025('0x14')][_0x4025('0x3f')]=_0x2c0c8e;}_0x47e26e[_0x4025('0x14')]=Object['assign'](_0x47e26e['query'],_['omit'](_0xa50f00['query'],'id'));return db[_0x4025('0x40')][_0x4025('0x41')](_0x47e26e);}return db[_0x4025('0x2a')]['findAndCountAll'](_0x4c8d9f);})[_0x4025('0x1a')](function(_0x10fdc4){_0x5767cd[_0x4025('0xc')]=_0x10fdc4[_0x4025('0xc')];_0x757928=_0x10fdc4[_0x4025('0x27')];return _0x757928[_0x4025('0x29')](function(_0xc41200){var _0x39accc=_[_0x4025('0x42')](_0x37ee2f,['id',_0xc41200['id']]);if(_0x39accc){var _0x2e8c32=rta[_0x4025('0x43')](_0x39accc);_['merge'](_0xc41200,_0x2e8c32);}_0xc41200[_0x4025('0x20')]=rta[_0x4025('0x44')](_0xc41200);if(_0xc41200[_0x4025('0x20')][_0x4025('0x45')]('pause')){_0x256114['forEach'](function(_0x9aa369){if(_0xc41200[_0x9aa369+_0x4025('0x38')]){if(_0x9aa369===_0x4025('0x46')){if(_0xc41200[_0x4025('0x47')]!==_0x4025('0x48')){_0xc41200[_0x4025('0x47')]=_0x4025('0x17');}}else{_0xc41200[_0x9aa369+_0x4025('0x49')]='pause';}}});}return _0xc41200;});})['then'](function(_0x1f1656){if(!_0x1c6171||_0x537681){return _0x1f1656;}return rta[_0x4025('0x4a')](_0x1f1656,_0x1c6171);})['then'](function(_0x283d6b){var _0x3cb936=rta['getRealtimeAgentsQueryFields']();_0x5767cd['rows']=_0x283d6b[_0x4025('0x29')](function(_0x530802){return _[_0x4025('0x4b')](_0x530802,_0x3cb936);});return _0x5767cd;})[_0x4025('0x1a')](respondWithFilteredResult(_0x1bf10f,_0x4c8d9f))['catch'](APIHandleError(_0x1bf10f));};exports[_0x4025('0x4c')]=function(_0x3faa8b,_0xb3ae82){var _0xcb914b={'count':0x0,'rows':[]};var _0x405b43={};var _0x9a7314;var _0x2282dc;var _0xab62fe;Promise[_0x4025('0x19')]()['then'](function(){if(_0x3faa8b[_0x4025('0x14')][_0x4025('0x1b')]){if(!utils[_0x4025('0x4d')](_0x3faa8b[_0x4025('0x14')][_0x4025('0x1b')])){throw new APIBadRequestError(util['format'](_0x4025('0x1d'),_0x3faa8b[_0x4025('0x14')]['channel']));}_0x9a7314=_0x3faa8b[_0x4025('0x14')][_0x4025('0x1b')][_0x4025('0x1e')]();}var _0x311288=_['startCase'](_0x9a7314)+'Queue';var _0x3f0790=_[_0x4025('0x29')](db[_0x311288][_0x4025('0x2b')],function(_0x2c5e17){return{'name':_0x2c5e17[_0x4025('0x2c')],'type':_0x2c5e17[_0x4025('0x2d')][_0x4025('0x2e')]};});if(!_0x3faa8b[_0x4025('0x14')][_0x4025('0x23')]){var _0x595bff=['id','name'];if(_0x9a7314===_0x4025('0x46')){_0x595bff[_0x4025('0x39')]('type');if(_0x3faa8b[_0x4025('0x14')][_0x4025('0x2d')]===_0x4025('0x4e')){_0x595bff[_0x4025('0x39')]([_0x4025('0x4f'),_0x4025('0x50')]);}}_0x3faa8b[_0x4025('0x14')][_0x4025('0x23')]=_0x595bff['join'](',');}_0x405b43=qs['getOptions'](_0x3f0790,_0x3faa8b);if(_0x3faa8b[_0x4025('0x3b')][_0x4025('0x2f')]==='user'){var _0x230140={'params':{'id':_0x3faa8b[_0x4025('0x3b')][_0x4025('0x3c')]},'query':{'section':_0x9a7314===_0x4025('0x46')&&_0x3faa8b[_0x4025('0x14')][_0x4025('0x2d')]==='outbound'?'QueueCampaigns':_[_0x4025('0x51')](_0x9a7314)+_0x4025('0x52'),'type':_0x3faa8b[_0x4025('0x14')][_0x4025('0x2d')],'nolimit':!![],'sort':_0x4025('0x53'),'filter':_0x3faa8b['query'][_0x4025('0x54')]}};_0x230140[_0x4025('0x14')]=Object[_0x4025('0x55')](_0x230140['query'],_0x3faa8b[_0x4025('0x14')]);delete _0x230140[_0x4025('0x14')]['id'];return db[_0x4025('0x40')][_0x4025('0x41')](_0x230140);}return db[_0x311288]['findAndCountAll'](_0x405b43);})['then'](function(_0x267db1){_0xcb914b[_0x4025('0xc')]=_0x267db1[_0x4025('0xc')];_0x2282dc=_0x267db1[_0x4025('0x27')];return rtq[_0x4025('0x56')](_0x3faa8b,_0x9a7314);})[_0x4025('0x1a')](function(_0x20c199){_0xab62fe=_0x20c199[_0x4025('0x27')];return rtq[_0x4025('0x57')](_0x2282dc,_0xab62fe,_0x9a7314,_0x3faa8b[_0x4025('0x14')]['type']);})[_0x4025('0x1a')](function(_0x15f88b){_0xcb914b[_0x4025('0x27')]=_0x15f88b;return _0xcb914b;})[_0x4025('0x1a')](respondWithFilteredResult(_0xb3ae82,_0x405b43))[_0x4025('0x58')](APIHandleError(_0xb3ae82));}; \ No newline at end of file +var _0x565c=['name','outbound','dialActive','role','QueueCampaigns','filter','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','type','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','Pause','forEach','where','user','userProfileId','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','find','getAgentStatus','pause','voice','talking','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','startCase','fieldName','key'];(function(_0xbe5e95,_0x499866){var _0x1fe535=function(_0x55efa9){while(--_0x55efa9){_0xbe5e95['push'](_0xbe5e95['shift']());}};_0x1fe535(++_0x499866);}(_0x565c,0x1b6));var _0xc565=function(_0x1c5eb8,_0x1164f0){_0x1c5eb8=_0x1c5eb8-0x0;var _0x3a8a24=_0x565c[_0x1c5eb8];return _0x3a8a24;};'use strict';var _=require(_0xc565('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require(_0xc565('0x1'));var qs=require(_0xc565('0x2'));var utils=require(_0xc565('0x3'));var db=require(_0xc565('0x4'))['db'];var APIBadRequestError=require(_0xc565('0x5'))[_0xc565('0x6')];var APIHandleError=require(_0xc565('0x5'))['handleError'];function respondWithFilteredResult(_0x4f9bf1,_0x474df3){return function(_0x26bc1c){if(_0x26bc1c){var _0x3f4805=typeof _0x474df3[_0xc565('0x7')]===_0xc565('0x8')&&typeof _0x474df3[_0xc565('0x9')]===_0xc565('0x8');var _0x3ebe21=_0x26bc1c[_0xc565('0xa')];var _0x1fcde8=_0x3f4805?0x0:_0x474df3[_0xc565('0x7')];var _0x1ff3da=_0x3f4805?_0x26bc1c[_0xc565('0xa')]:_0x474df3[_0xc565('0x7')]+_0x474df3[_0xc565('0x9')];var _0x20b3f6;if(_0x1ff3da>=_0x3ebe21){_0x1ff3da=_0x3ebe21;_0x20b3f6=0xc8;}else{_0x20b3f6=0xce;}_0x4f9bf1[_0xc565('0xb')](_0x20b3f6);return _0x4f9bf1[_0xc565('0xc')](_0xc565('0xd'),_0x1fcde8+'-'+_0x1ff3da+'/'+_0x3ebe21)[_0xc565('0xe')](_0x26bc1c);}return null;};}exports[_0xc565('0xf')]=function(_0x490daf,_0x201b26){var _0x5347f0={'count':0x0,'rows':[]};var _0x14f087={};var _0x17e203;var _0x4d679b=utils[_0xc565('0x10')]();var _0xd11c7;var _0x163160;var _0x42007d=_0x490daf[_0xc565('0x11')][_0xc565('0x12')];var _0x162ab7=_0x490daf[_0xc565('0x11')][_0xc565('0x13')];var _0x201b06=_0x490daf[_0xc565('0x11')][_0xc565('0x14')];var _0x4ce912=_0x162ab7==='pause'||_0x162ab7===_0xc565('0x15')?!![]:![];var _0x4587c3=[];var _0x53eab8;var _0x335ed8;Promise[_0xc565('0x16')]()['then'](function(){if(_0x490daf['query'][_0xc565('0x17')]){if(!utils[_0xc565('0x18')](_0x490daf['query'][_0xc565('0x17')])){throw new APIBadRequestError(util[_0xc565('0x19')](_0xc565('0x1a'),_0x490daf['query'][_0xc565('0x17')]));}_0x17e203=_0x490daf[_0xc565('0x11')][_0xc565('0x17')][_0xc565('0x1b')]();}if(!_0x490daf[_0xc565('0x11')][_0xc565('0x1c')]||!_0x490daf['query']['sort'][_0xc565('0x1d')](_0xc565('0x1e'))){_0x490daf['query'][_0xc565('0x1c')]=rta[_0xc565('0x1f')](_0x490daf[_0xc565('0x11')][_0xc565('0x1c')]);return;}var _0x415604=rta[_0xc565('0x20')](_0x490daf['query']['sort']);_0x490daf['query']['sort']=_0x415604[_0xc565('0x21')][_0xc565('0x22')](',');_0x53eab8=_0x415604[_0xc565('0x23')];})[_0xc565('0x24')](function(){if(!_0x42007d){return[];}return rta[_0xc565('0x25')](_0x42007d,_0x17e203);})[_0xc565('0x24')](function(_0x59235d){_0x4587c3=_0x59235d;return rta['getRealtimeAgents']();})[_0xc565('0x24')](function(_0x2055eb){_0x163160=_0x2055eb[_0xc565('0x26')];if((!_0x162ab7||_0x4ce912)&&!_0x53eab8){return _0x4587c3;}if(_0x53eab8&&!_0x162ab7){return rta[_0xc565('0x27')](_0x163160,_0x4587c3,_0x53eab8);}else{return rta[_0xc565('0x28')](_0x163160,_0x4587c3,_0x162ab7);}})[_0xc565('0x24')](function(_0x5df6b1){_0x4587c3=_0x5df6b1;var _0x54ca12=![];if(_0x4587c3[_0xc565('0x29')]===0x0){if(_0x42007d||_0x162ab7){_0x54ca12=!![];}if(_0x4ce912){_0x54ca12=![];}}if(_0x54ca12){return _0x5347f0;}var _0x284772=_[_0xc565('0x2a')](db[_0xc565('0x2b')][_0xc565('0x2c')],function(_0xb588eb){return{'name':_0xb588eb['fieldName'],'type':_0xb588eb[_0xc565('0x2d')]['key']};});_0x490daf[_0xc565('0x11')]['role']=_0xc565('0x2e');_0x14f087=qs[_0xc565('0x2f')](_0x284772,_0x490daf);_0x14f087[_0xc565('0x30')]=!![];var _0x1f946b=[];if(_0x4587c3[_0xc565('0x29')]>0x0){_0x1f946b[_0xc565('0x31')]({'id':{'$in':_0x4587c3}});if(_0x53eab8&&!_0x162ab7){_0x335ed8=[db[_0xc565('0x32')][_0xc565('0x33')](_0xc565('0x34')+_0x4587c3+')')];_0x14f087[_0xc565('0x23')]=_0x335ed8;}}if(_0x4ce912){_0x4d679b['forEach'](function(_0x44ae2d){var _0x2d077a=!![];if(_0x162ab7===_0xc565('0x15')&&_0x17e203!==_0x44ae2d){_0x2d077a=![];}_0x1f946b[_0xc565('0x31')]({[_0x44ae2d+_0xc565('0x35')]:_0x2d077a});});if(_0x201b06){_0x1f946b[_0xc565('0x31')]({'pauseType':_0x201b06});}}else if(_0x162ab7){_0x4d679b[_0xc565('0x36')](function(_0x373a15){_0x1f946b[_0xc565('0x31')]({[_0x373a15+'Pause']:![]});});}_0x14f087[_0xc565('0x37')]=_['merge'](_0x14f087[_0xc565('0x37')],{'$and':_0x1f946b});if(_0x490daf[_0xc565('0x38')]['role']===_0xc565('0x38')){var _0x544510={'params':{'id':_0x490daf[_0xc565('0x38')][_0xc565('0x39')]},'query':{'section':'Agents','role':_0xc565('0x2e'),'raw':!![],'ids':_0x4587c3,'customSorting':_0x335ed8}};if(_0x490daf[_0xc565('0x11')]['online']){_0x544510[_0xc565('0x11')]['online']=!![];}if(_0x4ce912){_0x544510[_0xc565('0x11')][_0xc565('0x3a')]=_0x1f946b;}_0x544510[_0xc565('0x11')]=Object[_0xc565('0x3b')](_0x544510[_0xc565('0x11')],_[_0xc565('0x3c')](_0x490daf['query'],'id'));return db[_0xc565('0x3d')][_0xc565('0x3e')](_0x544510);}return db[_0xc565('0x2b')][_0xc565('0x3f')](_0x14f087);})[_0xc565('0x24')](function(_0x328d3e){_0x5347f0['count']=_0x328d3e[_0xc565('0xa')];_0xd11c7=_0x328d3e['rows'];return _0xd11c7[_0xc565('0x2a')](function(_0x415546){var _0x6221dc=_[_0xc565('0x40')](_0x163160,['id',_0x415546['id']]);if(_0x6221dc){var _0x22aa60=rta['filterAgentAttributes'](_0x6221dc);_['merge'](_0x415546,_0x22aa60);}_0x415546[_0xc565('0x1e')]=rta[_0xc565('0x41')](_0x415546);if(_0x415546['globalStatus']['includes'](_0xc565('0x42'))){_0x4d679b['forEach'](function(_0x6677e1){if(_0x415546[_0x6677e1+_0xc565('0x35')]){if(_0x6677e1===_0xc565('0x43')){if(_0x415546['voiceStatus']!==_0xc565('0x44')){_0x415546[_0xc565('0x45')]='pause';}}else{_0x415546[_0x6677e1+_0xc565('0x46')]=_0xc565('0x42');}}});}return _0x415546;});})[_0xc565('0x24')](function(_0x4b82c0){if(!_0x53eab8||_0x335ed8){return _0x4b82c0;}return rta[_0xc565('0x47')](_0x4b82c0,_0x53eab8);})[_0xc565('0x24')](function(_0x114961){var _0x4633b7=rta[_0xc565('0x48')]();_0x5347f0[_0xc565('0x26')]=_0x114961[_0xc565('0x2a')](function(_0x327986){return _[_0xc565('0x49')](_0x327986,_0x4633b7);});return _0x5347f0;})[_0xc565('0x24')](respondWithFilteredResult(_0x201b26,_0x14f087))['catch'](APIHandleError(_0x201b26));};exports[_0xc565('0x4a')]=function(_0x205f88,_0x4a4834){var _0x2d586c={'count':0x0,'rows':[]};var _0x3d22ec={};var _0x3766de;var _0x33d471;var _0x2a277c;Promise['resolve']()[_0xc565('0x24')](function(){if(_0x205f88[_0xc565('0x11')]['channel']){if(!utils[_0xc565('0x18')](_0x205f88[_0xc565('0x11')][_0xc565('0x17')])){throw new APIBadRequestError(util[_0xc565('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x205f88[_0xc565('0x11')][_0xc565('0x17')]));}_0x3766de=_0x205f88[_0xc565('0x11')]['channel'][_0xc565('0x1b')]();}var _0x26c6a0=_[_0xc565('0x4b')](_0x3766de)+'Queue';var _0x11af76=_[_0xc565('0x2a')](db[_0x26c6a0][_0xc565('0x2c')],function(_0xfa86a0){return{'name':_0xfa86a0[_0xc565('0x4c')],'type':_0xfa86a0[_0xc565('0x2d')][_0xc565('0x4d')]};});if(!_0x205f88['query'][_0xc565('0x21')]){var _0x5d0e69=['id',_0xc565('0x4e')];if(_0x3766de===_0xc565('0x43')){_0x5d0e69['push'](_0xc565('0x2d'));if(_0x205f88[_0xc565('0x11')][_0xc565('0x2d')]===_0xc565('0x4f')){_0x5d0e69[_0xc565('0x31')]([_0xc565('0x50'),'dialMethod']);}}_0x205f88['query'][_0xc565('0x21')]=_0x5d0e69[_0xc565('0x22')](',');}_0x3d22ec=qs[_0xc565('0x2f')](_0x11af76,_0x205f88);if(_0x205f88[_0xc565('0x38')][_0xc565('0x51')]==='user'){var _0x2a203a={'params':{'id':_0x205f88[_0xc565('0x38')]['userProfileId']},'query':{'section':_0x3766de===_0xc565('0x43')&&_0x205f88[_0xc565('0x11')][_0xc565('0x2d')]===_0xc565('0x4f')?_0xc565('0x52'):_[_0xc565('0x4b')](_0x3766de)+'Queues','type':_0x205f88[_0xc565('0x11')][_0xc565('0x2d')],'nolimit':!![],'sort':_0xc565('0x4e'),'filter':_0x205f88[_0xc565('0x11')][_0xc565('0x53')]}};_0x2a203a[_0xc565('0x11')]=Object['assign'](_0x2a203a[_0xc565('0x11')],_0x205f88[_0xc565('0x11')]);delete _0x2a203a[_0xc565('0x11')]['id'];return db[_0xc565('0x3d')][_0xc565('0x3e')](_0x2a203a);}return db[_0x26c6a0][_0xc565('0x3f')](_0x3d22ec);})[_0xc565('0x24')](function(_0x23cf68){_0x2d586c[_0xc565('0xa')]=_0x23cf68['count'];_0x33d471=_0x23cf68['rows'];return rtq[_0xc565('0x54')](_0x205f88,_0x3766de);})[_0xc565('0x24')](function(_0xadd20c){_0x2a277c=_0xadd20c[_0xc565('0x26')];return rtq[_0xc565('0x55')](_0x33d471,_0x2a277c,_0x3766de,_0x205f88[_0xc565('0x11')]['type']);})[_0xc565('0x24')](function(_0x21d8f8){_0x2d586c[_0xc565('0x26')]=_0x21d8f8;return _0x2d586c;})[_0xc565('0x24')](respondWithFilteredResult(_0x4a4834,_0x3d22ec))['catch'](APIHandleError(_0x4a4834));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index dfaefb1..3f35d41 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3f8137,_0x2e6a2b){var _0x10c8df=function(_0x5b80eb){while(--_0x5b80eb){_0x3f8137['push'](_0x3f8137['shift']());}};_0x10c8df(++_0x2e6a2b);}(_0xedd9,0xfc));var _0x9edd=function(_0xc926db,_0x47c94c){_0xc926db=_0xc926db-0x0;var _0x143da8=_0xedd9[_0xc926db];return _0x143da8;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cf2c7,_0x2967d6){var _0x2fb190=function(_0x66c3a0){while(--_0x66c3a0){_0x1cf2c7['push'](_0x1cf2c7['shift']());}};_0x2fb190(++_0x2967d6);}(_0xe706,0xa3));var _0x6e70=function(_0x52215e,_0x3644bd){_0x52215e=_0x52215e-0x0;var _0x5e787c=_0xe706[_0x52215e];return _0x5e787c;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 3eff9f4..f5cc650 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 _0xc051=['STRING','sequelize','exports','DATE'];(function(_0x21125f,_0x8079f8){var _0x2f421d=function(_0x231299){while(--_0x231299){_0x21125f['push'](_0x21125f['shift']());}};_0x2f421d(++_0x8079f8);}(_0xc051,0xb5));var _0x1c05=function(_0x5c366f,_0x1adea3){_0x5c366f=_0x5c366f-0x0;var _0x2e89af=_0xc051[_0x5c366f];return _0x2e89af;};'use strict';var Sequelize=require(_0x1c05('0x0'));module[_0x1c05('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1c05('0x2')]},'uniqueid':{'type':Sequelize[_0x1c05('0x3')]},'starttime':{'type':Sequelize[_0x1c05('0x2')]},'responsetime':{'type':Sequelize[_0x1c05('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1c05('0x3')]},'campaigntype':{'type':Sequelize[_0x1c05('0x3')]},'membername':{'type':Sequelize[_0x1c05('0x3')]}}; \ No newline at end of file +var _0x446c=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x239e79,_0x131d3a){var _0x2dd473=function(_0x88b910){while(--_0x88b910){_0x239e79['push'](_0x239e79['shift']());}};_0x2dd473(++_0x131d3a);}(_0x446c,0x156));var _0xc446=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x446c[_0x571a17];return _0x3ef337;};'use strict';var Sequelize=require(_0xc446('0x0'));module[_0xc446('0x1')]={'state':{'type':Sequelize[_0xc446('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc446('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xc446('0x3')]},'starttime':{'type':Sequelize[_0xc446('0x4')]},'responsetime':{'type':Sequelize[_0xc446('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc446('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c009756..c9b1021 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 _0x2c5b=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x376d6b,_0xcb98bf){var _0x4f7d19=function(_0x121cbf){while(--_0x121cbf){_0x376d6b['push'](_0x376d6b['shift']());}};_0x4f7d19(++_0xcb98bf);}(_0x2c5b,0x7e));var _0xb2c5=function(_0x4cf372,_0x2682f3){_0x4cf372=_0x4cf372-0x0;var _0x43c8b2=_0x2c5b[_0x4cf372];return _0x43c8b2;};'use strict';var _=require(_0xb2c5('0x0'));var util=require('util');var logger=require(_0xb2c5('0x1'))(_0xb2c5('0x2'));var moment=require(_0xb2c5('0x3'));var BPromise=require(_0xb2c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb2c5('0x5'));var config=require(_0xb2c5('0x6'));var attributes=require(_0xb2c5('0x7'));module[_0xb2c5('0x8')]=function(_0x2eb01b,_0x11e21f){return _0x2eb01b[_0xb2c5('0x9')](_0xb2c5('0xa'),attributes,{'tableName':_0xb2c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8d4=['exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./reportAgentPreview.attributes'];(function(_0x2111ee,_0x1c29f2){var _0xb36d86=function(_0x15157e){while(--_0x15157e){_0x2111ee['push'](_0x2111ee['shift']());}};_0xb36d86(++_0x1c29f2);}(_0xe8d4,0x183));var _0x4e8d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe8d4[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x4e8d('0x0'));var util=require(_0x4e8d('0x1'));var logger=require(_0x4e8d('0x2'))(_0x4e8d('0x3'));var moment=require(_0x4e8d('0x4'));var BPromise=require(_0x4e8d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e8d('0x6'));var rimraf=require(_0x4e8d('0x7'));var config=require('../../config/environment');var attributes=require(_0x4e8d('0x8'));module[_0x4e8d('0x9')]=function(_0x151f29,_0x23be5b){return _0x151f29[_0x4e8d('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x4e8d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index d778832..9009c4c 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 _0x3506=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x48c7c2,_0x57cfd5){var _0x2038b5=function(_0x5cdd9e){while(--_0x5cdd9e){_0x48c7c2['push'](_0x48c7c2['shift']());}};_0x2038b5(++_0x57cfd5);}(_0x3506,0x86));var _0x6350=function(_0x31fde6,_0x2428dc){_0x31fde6=_0x31fde6-0x0;var _0x168b3e=_0x3506[_0x31fde6];return _0x168b3e;};'use strict';var _=require(_0x6350('0x0'));var util=require('util');var moment=require(_0x6350('0x1'));var BPromise=require(_0x6350('0x2'));var rs=require(_0x6350('0x3'));var fs=require('fs');var Redis=require(_0x6350('0x4'));var db=require(_0x6350('0x5'))['db'];var utils=require(_0x6350('0x6'));var logger=require(_0x6350('0x7'))(_0x6350('0x8'));var config=require(_0x6350('0x9'));var jayson=require(_0x6350('0xa'));var client=jayson['client'][_0x6350('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d46bb,_0x4883d9,_0x2815f8){return new BPromise(function(_0x164bf2,_0x50cc9b){return client[_0x6350('0xc')](_0x1d46bb,_0x2815f8)[_0x6350('0xd')](function(_0x3a2766){logger[_0x6350('0xe')](_0x6350('0xf'),_0x4883d9,'request\x20sent');logger[_0x6350('0x10')](_0x6350('0x11'),_0x4883d9,_0x6350('0x12'),JSON[_0x6350('0x13')](_0x3a2766));if(_0x3a2766[_0x6350('0x14')]){if(_0x3a2766[_0x6350('0x14')][_0x6350('0x15')]===0x1f4){logger[_0x6350('0x14')](_0x6350('0xf'),_0x4883d9,_0x3a2766[_0x6350('0x14')]['message']);return _0x50cc9b(_0x3a2766['error']['message']);}logger[_0x6350('0x14')](_0x6350('0xf'),_0x4883d9,_0x3a2766[_0x6350('0x14')][_0x6350('0x16')]);return _0x164bf2(_0x3a2766[_0x6350('0x14')][_0x6350('0x16')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x4883d9,_0x6350('0x12'));_0x164bf2(_0x3a2766[_0x6350('0x17')][_0x6350('0x16')]);}})[_0x6350('0x18')](function(_0x50846e){logger[_0x6350('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x4883d9,_0x50846e);_0x50cc9b(_0x50846e);});});}exports['CreateReportAgentPreview']=function(_0x408a9d){var _0x1754b5=this;return new Promise(function(_0x4305e2,_0x27f2e6){return db[_0x6350('0x19')]['create'](_0x408a9d[_0x6350('0x1a')],{'raw':_0x408a9d[_0x6350('0x1b')]?_0x408a9d[_0x6350('0x1b')][_0x6350('0x1c')]===undefined?!![]:![]:!![]})[_0x6350('0xd')](function(_0x5bc44c){logger[_0x6350('0xe')](_0x6350('0x1d'),_0x408a9d);logger[_0x6350('0x10')](_0x6350('0x1d'),_0x408a9d,JSON[_0x6350('0x13')](_0x5bc44c));_0x4305e2(_0x5bc44c);})[_0x6350('0x18')](function(_0x119313){logger['error']('CreateReportAgentPreview',_0x119313[_0x6350('0x16')],_0x408a9d);_0x27f2e6(_0x1754b5[_0x6350('0x14')](0x1f4,_0x119313['message']));});});}; \ No newline at end of file +var _0x334f=['options','raw','CreateReportAgentPreview','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ReportAgentPreview','create','body'];(function(_0x573808,_0x44d1ca){var _0x295fd1=function(_0x47b9b4){while(--_0x47b9b4){_0x573808['push'](_0x573808['shift']());}};_0x295fd1(++_0x44d1ca);}(_0x334f,0x18a));var _0xf334=function(_0x1a4b2c,_0x3d2784){_0x1a4b2c=_0x1a4b2c-0x0;var _0xb457f=_0x334f[_0x1a4b2c];return _0xb457f;};'use strict';var _=require('lodash');var util=require(_0xf334('0x0'));var moment=require(_0xf334('0x1'));var BPromise=require(_0xf334('0x2'));var rs=require(_0xf334('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf334('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf334('0x5'))('rpc');var config=require(_0xf334('0x6'));var jayson=require(_0xf334('0x7'));var client=jayson['client'][_0xf334('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e6c9c,_0x2e3cf5,_0x3c4546){return new BPromise(function(_0x90ec29,_0x346f61){return client['request'](_0x5e6c9c,_0x3c4546)[_0xf334('0x9')](function(_0x294f66){logger[_0xf334('0xa')](_0xf334('0xb'),_0x2e3cf5,'request\x20sent');logger[_0xf334('0xc')](_0xf334('0xd'),_0x2e3cf5,_0xf334('0xe'),JSON['stringify'](_0x294f66));if(_0x294f66['error']){if(_0x294f66[_0xf334('0xf')][_0xf334('0x10')]===0x1f4){logger[_0xf334('0xf')](_0xf334('0xb'),_0x2e3cf5,_0x294f66['error'][_0xf334('0x11')]);return _0x346f61(_0x294f66[_0xf334('0xf')][_0xf334('0x11')]);}logger[_0xf334('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x2e3cf5,_0x294f66['error']['message']);return _0x90ec29(_0x294f66[_0xf334('0xf')][_0xf334('0x11')]);}else{logger[_0xf334('0xa')](_0xf334('0xb'),_0x2e3cf5,_0xf334('0xe'));_0x90ec29(_0x294f66['result'][_0xf334('0x11')]);}})[_0xf334('0x12')](function(_0x3805f6){logger[_0xf334('0xf')](_0xf334('0xb'),_0x2e3cf5,_0x3805f6);_0x346f61(_0x3805f6);});});}exports['CreateReportAgentPreview']=function(_0x36049c){var _0x5a766e=this;return new Promise(function(_0x253fb7,_0x9d159c){return db[_0xf334('0x13')][_0xf334('0x14')](_0x36049c[_0xf334('0x15')],{'raw':_0x36049c[_0xf334('0x16')]?_0x36049c[_0xf334('0x16')][_0xf334('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1f6ddc){logger[_0xf334('0xa')](_0xf334('0x18'),_0x36049c);logger['debug']('CreateReportAgentPreview',_0x36049c,JSON[_0xf334('0x19')](_0x1f6ddc));_0x253fb7(_0x1f6ddc);})[_0xf334('0x12')](function(_0x4c2f4c){logger[_0xf334('0xf')](_0xf334('0x18'),_0x4c2f4c[_0xf334('0x11')],_0x36049c);_0x9d159c(_0x5a766e[_0xf334('0xf')](0x1f4,_0x4c2f4c['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ab203bf..5128282 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 _0x8fe9=['/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents'];(function(_0x57a205,_0x288fee){var _0x149a79=function(_0xb4b7bb){while(--_0xb4b7bb){_0x57a205['push'](_0x57a205['shift']());}};_0x149a79(++_0x288fee);}(_0x8fe9,0x17b));var _0x98fe=function(_0x45c262,_0x2e3ce5){_0x45c262=_0x45c262-0x0;var _0x4f2ba6=_0x8fe9[_0x45c262];return _0x4f2ba6;};'use strict';var multer=require(_0x98fe('0x0'));var util=require(_0x98fe('0x1'));var path=require(_0x98fe('0x2'));var express=require(_0x98fe('0x3'));var router=express[_0x98fe('0x4')]();var auth=require(_0x98fe('0x5'));var controller=require(_0x98fe('0x6'));router[_0x98fe('0x7')](_0x98fe('0x8'),auth[_0x98fe('0x9')](),controller[_0x98fe('0xa')]);router[_0x98fe('0x7')](_0x98fe('0xb'),auth[_0x98fe('0x9')](),controller[_0x98fe('0xc')]);router[_0x98fe('0x7')](_0x98fe('0xd'),auth[_0x98fe('0x9')](),controller[_0x98fe('0xe')]);router[_0x98fe('0x7')](_0x98fe('0xf'),auth['isAuthenticated'](),controller[_0x98fe('0x10')]);router[_0x98fe('0x7')](_0x98fe('0x11'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x12')]);router[_0x98fe('0x7')](_0x98fe('0x13'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x14')]);router[_0x98fe('0x7')](_0x98fe('0x15'),auth['isAuthenticated'](),controller[_0x98fe('0x16')]);router[_0x98fe('0x7')](_0x98fe('0x17'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x18')]);router[_0x98fe('0x7')](_0x98fe('0x19'),auth[_0x98fe('0x9')](),controller['smsQueues']);router[_0x98fe('0x7')](_0x98fe('0x1a'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x98fe('0x7')](_0x98fe('0x1b'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x1c')]);router[_0x98fe('0x7')](_0x98fe('0x1d'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x1e')]);router[_0x98fe('0x7')]('/voice/queues/channels',auth[_0x98fe('0x9')](),controller[_0x98fe('0x1f')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x98fe('0x9')](),controller[_0x98fe('0x20')]);router['get'](_0x98fe('0x21'),auth['isAuthenticated'](),controller[_0x98fe('0x22')]);router[_0x98fe('0x7')](_0x98fe('0x23'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x24')]);router[_0x98fe('0x7')]('/voice/queues/:id',auth[_0x98fe('0x9')](),controller[_0x98fe('0x25')]);router[_0x98fe('0x26')]('/voice/queues/:id',auth[_0x98fe('0x9')](),controller[_0x98fe('0x27')]);router[_0x98fe('0x7')](_0x98fe('0x28'),auth['isAuthenticated'](),controller[_0x98fe('0x29')]);router[_0x98fe('0x7')](_0x98fe('0x2a'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x2b')]);router[_0x98fe('0x7')](_0x98fe('0x2c'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x2d')]);router[_0x98fe('0x26')](_0x98fe('0x2e'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x2f')]);router[_0x98fe('0x7')](_0x98fe('0x30'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x31')]);router['get'](_0x98fe('0x32'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x33')]);router[_0x98fe('0x7')]('/campaigns',auth[_0x98fe('0x9')](),controller[_0x98fe('0x34')]);router[_0x98fe('0x7')](_0x98fe('0x35'),auth[_0x98fe('0x9')](),controller['faxAccounts']);router[_0x98fe('0x7')](_0x98fe('0x36'),auth['isAuthenticated'](),controller[_0x98fe('0x37')]);router[_0x98fe('0x7')](_0x98fe('0x38'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x39')]);router[_0x98fe('0x7')](_0x98fe('0x3a'),auth[_0x98fe('0x9')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x98fe('0x3b'),auth[_0x98fe('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x98fe('0x7')]('/sms/queues/waitinginteractions',auth[_0x98fe('0x9')](),controller[_0x98fe('0x3c')]);router[_0x98fe('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x98fe('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0x98fe('0x7')](_0x98fe('0x3d'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x3e')]);router[_0x98fe('0x3f')](_0x98fe('0x40'),auth[_0x98fe('0x9')](),controller['queueNotify'](_0x98fe('0x41')));router[_0x98fe('0x7')](_0x98fe('0x42'),auth['isAuthenticated'](),controller[_0x98fe('0x43')]);router[_0x98fe('0x3f')](_0x98fe('0x44'),auth['isAuthenticated'](),controller[_0x98fe('0x45')]('chat'));router[_0x98fe('0x7')](_0x98fe('0x46'),auth['isAuthenticated'](),controller[_0x98fe('0x47')]);router[_0x98fe('0x3f')](_0x98fe('0x48'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x45')]('fax'));router[_0x98fe('0x7')]('/fax/queues/:id',auth[_0x98fe('0x9')](),controller[_0x98fe('0x49')]);router[_0x98fe('0x3f')](_0x98fe('0x4a'),auth['isAuthenticated'](),controller[_0x98fe('0x45')](_0x98fe('0x4b')));router['get']('/openchannel/queues/:id',auth[_0x98fe('0x9')](),controller['showOpenchannelQueues']);router[_0x98fe('0x3f')](_0x98fe('0x4c'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x45')]('sms'));router[_0x98fe('0x3f')](_0x98fe('0x4d'),auth['isAuthenticated'](),controller[_0x98fe('0x45')](_0x98fe('0x4e')));router['get'](_0x98fe('0x4f'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x50')]);router[_0x98fe('0x7')](_0x98fe('0x51'),auth[_0x98fe('0x9')](),controller['showWhatsappQueues']);router['post'](_0x98fe('0x52'),auth['isAuthenticated'](),controller[_0x98fe('0x53')]);module[_0x98fe('0x54')]=router; \ No newline at end of file +var _0x6d65=['voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents/:id/capacity','/telephones','/trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','./rpc.controller','get','voiceChannels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x6d65,0x1de));var _0x56d6=function(_0x1c1ab2,_0x412c90){_0x1c1ab2=_0x1c1ab2-0x0;var _0xaaca45=_0x6d65[_0x1c1ab2];return _0xaaca45;};'use strict';var multer=require(_0x56d6('0x0'));var util=require(_0x56d6('0x1'));var path=require(_0x56d6('0x2'));var express=require(_0x56d6('0x3'));var router=express[_0x56d6('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x56d6('0x5'));router[_0x56d6('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0x56d6('0x7')]);router[_0x56d6('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x56d6('0x8')](),controller[_0x56d6('0x9')]);router[_0x56d6('0x6')](_0x56d6('0xa'),auth[_0x56d6('0x8')](),controller[_0x56d6('0xb')]);router['get']('/voice/queues',auth[_0x56d6('0x8')](),controller[_0x56d6('0xc')]);router[_0x56d6('0x6')](_0x56d6('0xd'),auth['isAuthenticated'](),controller[_0x56d6('0xe')]);router[_0x56d6('0x6')](_0x56d6('0xf'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x10')]);router[_0x56d6('0x6')](_0x56d6('0x11'),auth[_0x56d6('0x8')](),controller['mailAccounts']);router['get'](_0x56d6('0x12'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x13')]);router['get']('/sms/queues',auth[_0x56d6('0x8')](),controller[_0x56d6('0x14')]);router[_0x56d6('0x6')](_0x56d6('0x15'),auth['isAuthenticated'](),controller[_0x56d6('0x16')]);router[_0x56d6('0x6')](_0x56d6('0x17'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x18')]);router[_0x56d6('0x6')](_0x56d6('0x19'),auth[_0x56d6('0x8')](),controller['voiceQueuesPreview']);router[_0x56d6('0x6')]('/voice/queues/channels',auth[_0x56d6('0x8')](),controller['voiceQueuesChannels']);router['get']('/voice/queues/channels/:uniqueid',auth[_0x56d6('0x8')](),controller['voiceQueuesChannel']);router[_0x56d6('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x56d6('0x8')](),controller[_0x56d6('0x1a')]);router['get'](_0x56d6('0x1b'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x1c')]);router[_0x56d6('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x56d6('0x1d')]);router[_0x56d6('0x1e')](_0x56d6('0x1f'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x20')]);router[_0x56d6('0x6')](_0x56d6('0x21'),auth['isAuthenticated'](),controller[_0x56d6('0x22')]);router[_0x56d6('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x56d6('0x23')]);router[_0x56d6('0x6')]('/agents',auth[_0x56d6('0x8')](),controller['agents']);router[_0x56d6('0x1e')](_0x56d6('0x24'),auth[_0x56d6('0x8')](),controller['agentCapacity']);router['get'](_0x56d6('0x25'),auth[_0x56d6('0x8')](),controller['telephones']);router['get'](_0x56d6('0x26'),auth[_0x56d6('0x8')](),controller['trunks']);router['get'](_0x56d6('0x27'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x28')]);router[_0x56d6('0x6')]('/fax/accounts',auth[_0x56d6('0x8')](),controller['faxAccounts']);router[_0x56d6('0x6')](_0x56d6('0x29'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x56d6('0x6')](_0x56d6('0x2a'),auth['isAuthenticated'](),controller[_0x56d6('0x2b')]);router['get'](_0x56d6('0x2c'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x2d')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x56d6('0x6')](_0x56d6('0x2e'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x2f')]);router[_0x56d6('0x6')](_0x56d6('0x30'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x31')]);router[_0x56d6('0x6')]('/fax/queues/waitinginteractions',auth[_0x56d6('0x8')](),controller[_0x56d6('0x32')]);router[_0x56d6('0x33')](_0x56d6('0x34'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x35')](_0x56d6('0x36')));router[_0x56d6('0x6')](_0x56d6('0x37'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x38')]);router[_0x56d6('0x33')]('/chat/queues/:id/notify',auth[_0x56d6('0x8')](),controller['queueNotify']('chat'));router[_0x56d6('0x6')](_0x56d6('0x39'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x3a')]);router[_0x56d6('0x33')](_0x56d6('0x3b'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x35')]('fax'));router['get'](_0x56d6('0x3c'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x3d')]);router[_0x56d6('0x33')](_0x56d6('0x3e'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x35')](_0x56d6('0x3f')));router[_0x56d6('0x6')](_0x56d6('0x40'),auth[_0x56d6('0x8')](),controller['showOpenchannelQueues']);router['post'](_0x56d6('0x41'),auth['isAuthenticated'](),controller[_0x56d6('0x35')]('sms'));router[_0x56d6('0x33')](_0x56d6('0x42'),auth[_0x56d6('0x8')](),controller[_0x56d6('0x35')]('whatsapp'));router[_0x56d6('0x6')](_0x56d6('0x43'),auth[_0x56d6('0x8')](),controller['showSmsQueues']);router[_0x56d6('0x6')](_0x56d6('0x44'),auth['isAuthenticated'](),controller[_0x56d6('0x45')]);router[_0x56d6('0x33')](_0x56d6('0x46'),auth[_0x56d6('0x8')](),controller['agentNotify']);module[_0x56d6('0x47')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 16487c1..e16223d 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x5ed257,_0x2d51b8){var _0x143b23=function(_0x30c9a2){while(--_0x30c9a2){_0x5ed257['push'](_0x5ed257['shift']());}};_0x143b23(++_0x2d51b8);}(_0xe706,0xa3));var _0x6e70=function(_0x4454c3,_0x24c130){_0x4454c3=_0x4454c3-0x0;var _0x195fa6=_0xe706[_0x4454c3];return _0x195fa6;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x11398a,_0x352864){var _0x2531dd=function(_0x549f47){while(--_0x549f47){_0x11398a['push'](_0x11398a['shift']());}};_0x2531dd(++_0x352864);}(_0xe706,0xa3));var _0x6e70=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0xe706[_0x1b91c7];return _0xbbe014;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 998d92a..db6bee0 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 _0x3fa5=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','/:id/run','run','create','put','delete','exports','multer','util','connect-timeout','Router'];(function(_0x4c5d3d,_0x4ce396){var _0x296bb7=function(_0xf40928){while(--_0xf40928){_0x4c5d3d['push'](_0x4c5d3d['shift']());}};_0x296bb7(++_0x4ce396);}(_0x3fa5,0x92));var _0x53fa=function(_0x3cc28c,_0x29bc75){_0x3cc28c=_0x3cc28c-0x0;var _0x92e4f3=_0x3fa5[_0x3cc28c];return _0x92e4f3;};'use strict';var multer=require(_0x53fa('0x0'));var util=require(_0x53fa('0x1'));var path=require('path');var timeout=require(_0x53fa('0x2'));var express=require('express');var router=express[_0x53fa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x53fa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53fa('0x5'));var controller=require('./schedule.controller');router[_0x53fa('0x6')]('/',auth[_0x53fa('0x7')](),controller['index']);router[_0x53fa('0x6')](_0x53fa('0x8'),auth[_0x53fa('0x7')](),controller['show']);router[_0x53fa('0x6')](_0x53fa('0x9'),auth['isAuthenticated'](),controller[_0x53fa('0xa')]);router['post']('/',auth[_0x53fa('0x7')](),controller[_0x53fa('0xb')]);router[_0x53fa('0xc')]('/:id',auth[_0x53fa('0x7')](),controller['update']);router[_0x53fa('0xd')](_0x53fa('0x8'),auth[_0x53fa('0x7')](),controller['destroy']);module[_0x53fa('0xe')]=router; \ No newline at end of file +var _0x80ea=['../../components/auth/service','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','post','create','update','delete','destroy','multer','util','path','express','Router'];(function(_0x5b8437,_0x5e8933){var _0x312795=function(_0xdc1706){while(--_0xdc1706){_0x5b8437['push'](_0x5b8437['shift']());}};_0x312795(++_0x5e8933);}(_0x80ea,0xd8));var _0xa80e=function(_0x35aaa2,_0x1109cb){_0x35aaa2=_0x35aaa2-0x0;var _0x1650ba=_0x80ea[_0x35aaa2];return _0x1650ba;};'use strict';var multer=require(_0xa80e('0x0'));var util=require(_0xa80e('0x1'));var path=require(_0xa80e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa80e('0x3'));var router=express[_0xa80e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa80e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa80e('0x6'));router[_0xa80e('0x7')]('/',auth[_0xa80e('0x8')](),controller[_0xa80e('0x9')]);router[_0xa80e('0x7')](_0xa80e('0xa'),auth[_0xa80e('0x8')](),controller['show']);router[_0xa80e('0x7')](_0xa80e('0xb'),auth[_0xa80e('0x8')](),controller['run']);router[_0xa80e('0xc')]('/',auth[_0xa80e('0x8')](),controller[_0xa80e('0xd')]);router['put'](_0xa80e('0xa'),auth[_0xa80e('0x8')](),controller[_0xa80e('0xe')]);router[_0xa80e('0xf')](_0xa80e('0xa'),auth[_0xa80e('0x8')](),controller[_0xa80e('0x10')]);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 8e1f856..3771706 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 _0xed70=['hours','days','csv','pdf','xlsx','default','custom','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','weeks'];(function(_0x328fe0,_0x3d3987){var _0x5e7aee=function(_0x3ced8c){while(--_0x3ced8c){_0x328fe0['push'](_0x328fe0['shift']());}};_0x5e7aee(++_0x3d3987);}(_0xed70,0x7f));var _0x0ed7=function(_0x617fbe,_0x40665b){_0x617fbe=_0x617fbe-0x0;var _0x6e76d=_0xed70[_0x617fbe];return _0x6e76d;};'use strict';var Sequelize=require(_0x0ed7('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ed7('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0ed7('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0ed7('0x1')],'allowNull':![],'defaultValue':_0x0ed7('0x3')},'startAt':{'type':Sequelize[_0x0ed7('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0ed7('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0ed7('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0ed7('0x6')]('years','quarters',_0x0ed7('0x7'),_0x0ed7('0x8'),'days',_0x0ed7('0x9'),'minutes'),'allowNull':![],'defaultValue':_0x0ed7('0xa')},'output':{'type':Sequelize[_0x0ed7('0x6')](_0x0ed7('0xb'),_0x0ed7('0xc'),_0x0ed7('0xd')),'allowNull':![],'defaultValue':_0x0ed7('0xb')},'type':{'type':Sequelize[_0x0ed7('0x6')]('custom',_0x0ed7('0xe')),'allowNull':![],'defaultValue':_0x0ed7('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0ed7('0x1')]},'cc':{'type':Sequelize[_0x0ed7('0x10')]},'bcc':{'type':Sequelize[_0x0ed7('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa04b=['months','weeks','days','hours','minutes','csv','xlsx','custom','TEXT','BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters'];(function(_0x59bbf3,_0x22bdff){var _0x11f4af=function(_0x4c6708){while(--_0x4c6708){_0x59bbf3['push'](_0x59bbf3['shift']());}};_0x11f4af(++_0x22bdff);}(_0xa04b,0x16f));var _0xba04=function(_0x4f06ec,_0x55c1ce){_0x4f06ec=_0x4f06ec-0x0;var _0x3a4d31=_0xa04b[_0x4f06ec];return _0x3a4d31;};'use strict';var Sequelize=require(_0xba04('0x0'));module[_0xba04('0x1')]={'name':{'type':Sequelize[_0xba04('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xba04('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba04('0x3')},'startAt':{'type':Sequelize[_0xba04('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xba04('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xba04('0x5')]('years',_0xba04('0x6'),_0xba04('0x7'),_0xba04('0x8'),_0xba04('0x9'),_0xba04('0xa'),_0xba04('0xb')),'allowNull':![],'defaultValue':_0xba04('0x9')},'output':{'type':Sequelize[_0xba04('0x5')](_0xba04('0xc'),'pdf',_0xba04('0xd')),'allowNull':![],'defaultValue':_0xba04('0xc')},'type':{'type':Sequelize[_0xba04('0x5')](_0xba04('0xe'),'default'),'allowNull':![],'defaultValue':_0xba04('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xba04('0x2')]},'cc':{'type':Sequelize[_0xba04('0xf')]},'bcc':{'type':Sequelize[_0xba04('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xba04('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c5018c3..b90366b 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 _0x914b=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','update','then','Scheduler','destroy','stack','name','map','Schedule','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','filter','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','user'];(function(_0x42686f,_0x35f36d){var _0x131c8d=function(_0x3f0953){while(--_0x3f0953){_0x42686f['push'](_0x42686f['shift']());}};_0x131c8d(++_0x35f36d);}(_0x914b,0x14e));var _0xb914=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0x914b[_0xf35bc1];return _0xa6b162;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb914('0x0'));var zipdir=require(_0xb914('0x1'));var jsonpatch=require(_0xb914('0x2'));var rp=require(_0xb914('0x3'));var moment=require(_0xb914('0x4'));var BPromise=require(_0xb914('0x5'));var Mustache=require(_0xb914('0x6'));var util=require(_0xb914('0x7'));var path=require(_0xb914('0x8'));var sox=require(_0xb914('0x9'));var csv=require(_0xb914('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb914('0xb'));var _=require(_0xb914('0xc'));var squel=require(_0xb914('0xd'));var crypto=require(_0xb914('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb914('0xa'));var querystring=require(_0xb914('0xf'));var Papa=require('papaparse');var Redis=require(_0xb914('0x10'));var authService=require(_0xb914('0x11'));var qs=require(_0xb914('0x12'));var as=require(_0xb914('0x13'));var hardwareService=require(_0xb914('0x14'));var logger=require(_0xb914('0x15'))(_0xb914('0x16'));var utils=require(_0xb914('0x17'));var config=require(_0xb914('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb914('0x19'))['db'];function respondWithStatusCode(_0x3ec736,_0x2c8fa6){_0x2c8fa6=_0x2c8fa6||0xcc;return function(_0x33a8aa){if(_0x33a8aa){return _0x3ec736[_0xb914('0x1a')](_0x2c8fa6);}return _0x3ec736['status'](_0x2c8fa6)[_0xb914('0x1b')]();};}function respondWithResult(_0x3243cd,_0xea9e07){_0xea9e07=_0xea9e07||0xc8;return function(_0x10bdd0){if(_0x10bdd0){return _0x3243cd[_0xb914('0x1c')](_0xea9e07)[_0xb914('0x1d')](_0x10bdd0);}};}function respondWithFilteredResult(_0x85092f,_0x3d1e3e){return function(_0x552cef){if(_0x552cef){var _0xa33b61=typeof _0x3d1e3e[_0xb914('0x1e')]===_0xb914('0x1f')&&typeof _0x3d1e3e[_0xb914('0x20')]===_0xb914('0x1f');var _0x5de136=_0x552cef['count'];var _0x380b18=_0xa33b61?0x0:_0x3d1e3e[_0xb914('0x1e')];var _0x10904e=_0xa33b61?_0x552cef[_0xb914('0x21')]:_0x3d1e3e[_0xb914('0x1e')]+_0x3d1e3e[_0xb914('0x20')];var _0x4daf80;if(_0x10904e>=_0x5de136){_0x10904e=_0x5de136;_0x4daf80=0xc8;}else{_0x4daf80=0xce;}_0x85092f[_0xb914('0x1c')](_0x4daf80);return _0x85092f['set']('Content-Range',_0x380b18+'-'+_0x10904e+'/'+_0x5de136)[_0xb914('0x1d')](_0x552cef);}return null;};}function patchUpdates(_0x2d2fd4){return function(_0xec538f){try{jsonpatch['apply'](_0xec538f,_0x2d2fd4,!![]);}catch(_0x4bc9d4){return BPromise[_0xb914('0x22')](_0x4bc9d4);}return _0xec538f['save']();};}function saveUpdates(_0x4e4372,_0x56b865){return function(_0x578fe4){if(_0x578fe4){return _0x578fe4[_0xb914('0x23')](_0x4e4372)[_0xb914('0x24')](function(_0x303a86){return _0x303a86;});}return null;};}function removeEntity(_0x5d676f,_0x447db3){return function(_0x25d275){if(_0x25d275){return _0x25d275['destroy']()['then'](function(){var _0x1f50ee=_0x25d275['get']({'plain':!![]});var _0x6b6c5a=_0xb914('0x25');return db['UserProfileResource'][_0xb914('0x26')]({'where':{'type':_0x6b6c5a,'resourceId':_0x1f50ee['id']}})[_0xb914('0x24')](function(){return _0x25d275;});})[_0xb914('0x24')](function(){_0x5d676f[_0xb914('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff7b3,_0x5dcf37){return function(_0x1df451){if(!_0x1df451){_0x1ff7b3[_0xb914('0x1a')](0x194);}return _0x1df451;};}function handleError(_0x1a6eda,_0x1dc655){_0x1dc655=_0x1dc655||0x1f4;return function(_0x1a8eeb){logger['error'](_0x1a8eeb[_0xb914('0x27')]);if(_0x1a8eeb['name']){delete _0x1a8eeb[_0xb914('0x28')];}_0x1a6eda[_0xb914('0x1c')](_0x1dc655)['send'](_0x1a8eeb);};}exports['index']=function(_0xa3b2e0,_0x1179b6){var _0x20921d={},_0x3ec517={},_0x47013f={'count':0x0,'rows':[]};var _0x26d189=_[_0xb914('0x29')](db[_0xb914('0x2a')][_0xb914('0x2b')],function(_0x462d1a){return{'name':_0x462d1a['fieldName'],'type':_0x462d1a['type']['key']};});_0x3ec517[_0xb914('0x2c')]=_[_0xb914('0x29')](_0x26d189,_0xb914('0x28'));_0x3ec517['query']=_['keys'](_0xa3b2e0[_0xb914('0x2d')]);_0x3ec517[_0xb914('0x2e')]=_[_0xb914('0x2f')](_0x3ec517['model'],_0x3ec517[_0xb914('0x2d')]);_0x20921d['attributes']=_[_0xb914('0x2f')](_0x3ec517['model'],qs[_0xb914('0x30')](_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x30')]));_0x20921d[_0xb914('0x31')]=_0x20921d[_0xb914('0x31')][_0xb914('0x32')]?_0x20921d[_0xb914('0x31')]:_0x3ec517[_0xb914('0x2c')];if(!_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x33')](_0xb914('0x34'))){_0x20921d[_0xb914('0x20')]=qs[_0xb914('0x20')](_0xa3b2e0['query'][_0xb914('0x20')]);_0x20921d[_0xb914('0x1e')]=qs[_0xb914('0x1e')](_0xa3b2e0['query'][_0xb914('0x1e')]);}_0x20921d[_0xb914('0x35')]=qs[_0xb914('0x36')](_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x36')]);_0x20921d[_0xb914('0x37')]=qs[_0xb914('0x2e')](_['pick'](_0xa3b2e0['query'],_0x3ec517[_0xb914('0x2e')]),_0x26d189);if(_0xa3b2e0[_0xb914('0x2d')]['filter']){_0x20921d[_0xb914('0x37')]=_['merge'](_0x20921d[_0xb914('0x37')],{'$or':_[_0xb914('0x29')](_0x26d189,function(_0x75d93f){if(_0x75d93f[_0xb914('0x38')]!=='VIRTUAL'){var _0x338e42={};_0x338e42[_0x75d93f[_0xb914('0x28')]]={'$like':'%'+_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x39')]+'%'};return _0x338e42;}})});}_0x20921d=_[_0xb914('0x3a')]({},_0x20921d,_0xa3b2e0[_0xb914('0x3b')]);var _0x3e20d6={'where':_0x20921d[_0xb914('0x37')]};return db[_0xb914('0x2a')]['count'](_0x3e20d6)[_0xb914('0x24')](function(_0x6e3315){_0x47013f[_0xb914('0x21')]=_0x6e3315;if(_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x3c')]){_0x20921d[_0xb914('0x3d')]=[{'all':!![]}];}return db[_0xb914('0x2a')][_0xb914('0x3e')](_0x20921d);})[_0xb914('0x24')](function(_0x3bea79){_0x47013f[_0xb914('0x3f')]=_0x3bea79;return _0x47013f;})[_0xb914('0x24')](respondWithFilteredResult(_0x1179b6,_0x20921d))['catch'](handleError(_0x1179b6,null));};exports['show']=function(_0x954acb,_0x1f8993){var _0x3ef7c5={'raw':![],'where':{'id':_0x954acb[_0xb914('0x40')]['id']}},_0xbfa7c1={};_0xbfa7c1[_0xb914('0x2c')]=_[_0xb914('0x41')](db[_0xb914('0x2a')][_0xb914('0x2b')]);_0xbfa7c1['query']=_[_0xb914('0x41')](_0x954acb[_0xb914('0x2d')]);_0xbfa7c1[_0xb914('0x2e')]=_[_0xb914('0x2f')](_0xbfa7c1['model'],_0xbfa7c1[_0xb914('0x2d')]);_0x3ef7c5['attributes']=_['intersection'](_0xbfa7c1['model'],qs[_0xb914('0x30')](_0x954acb['query'][_0xb914('0x30')]));_0x3ef7c5[_0xb914('0x31')]=_0x3ef7c5[_0xb914('0x31')][_0xb914('0x32')]?_0x3ef7c5[_0xb914('0x31')]:_0xbfa7c1[_0xb914('0x2c')];if(_0x954acb[_0xb914('0x2d')][_0xb914('0x3c')]){_0x3ef7c5[_0xb914('0x3d')]=[{'all':!![]}];}_0x3ef7c5=_[_0xb914('0x3a')]({},_0x3ef7c5,_0x954acb[_0xb914('0x3b')]);return db[_0xb914('0x2a')][_0xb914('0x42')](_0x3ef7c5)['then'](handleEntityNotFound(_0x1f8993,null))[_0xb914('0x24')](respondWithResult(_0x1f8993,null))[_0xb914('0x43')](handleError(_0x1f8993,null));};exports[_0xb914('0x44')]=function(_0x1c525b,_0x2e45e9){return db[_0xb914('0x2a')][_0xb914('0x44')](_0x1c525b[_0xb914('0x45')],{})[_0xb914('0x24')](function(_0x329d59){var _0x47a0fd=_0x1c525b[_0xb914('0x46')]['get']({'plain':!![]});if(!_0x47a0fd)throw new Error(_0xb914('0x47'));if(_0x47a0fd[_0xb914('0x48')]===_0xb914('0x46')){var _0x5439cc=_0x329d59['get']({'plain':!![]});var _0x420dd0=_0xb914('0x25');return db[_0xb914('0x49')][_0xb914('0x42')]({'where':{'name':_0x420dd0,'userProfileId':_0x47a0fd[_0xb914('0x4a')]},'raw':!![]})[_0xb914('0x24')](function(_0x1ca17f){if(_0x1ca17f&&_0x1ca17f[_0xb914('0x4b')]===0x0){return db[_0xb914('0x4c')][_0xb914('0x44')]({'name':_0x5439cc[_0xb914('0x28')],'resourceId':_0x5439cc['id'],'type':_0x1ca17f[_0xb914('0x28')],'sectionId':_0x1ca17f['id']},{})['then'](function(){return _0x329d59;});}else{return _0x329d59;}})[_0xb914('0x43')](function(_0x327e2e){logger[_0xb914('0x4d')](_0xb914('0x4e'),_0x327e2e);throw _0x327e2e;});}return _0x329d59;})['then'](respondWithResult(_0x2e45e9,0xc9))[_0xb914('0x43')](handleError(_0x2e45e9,null));};exports['update']=function(_0x265ec5,_0x1319d8){if(_0x265ec5[_0xb914('0x45')]['id']){delete _0x265ec5[_0xb914('0x45')]['id'];}return db[_0xb914('0x2a')]['find']({'where':{'id':_0x265ec5[_0xb914('0x40')]['id']}})[_0xb914('0x24')](handleEntityNotFound(_0x1319d8,null))[_0xb914('0x24')](saveUpdates(_0x265ec5[_0xb914('0x45')],null))['then'](respondWithResult(_0x1319d8,null))[_0xb914('0x43')](handleError(_0x1319d8,null));};exports['destroy']=function(_0x4a2723,_0x5f8eff){return db[_0xb914('0x2a')][_0xb914('0x42')]({'where':{'id':_0x4a2723[_0xb914('0x40')]['id']}})['then'](handleEntityNotFound(_0x5f8eff,null))[_0xb914('0x24')](removeEntity(_0x5f8eff,null))[_0xb914('0x43')](handleError(_0x5f8eff,null));};exports[_0xb914('0x4f')]=function(_0x231e6e,_0x4b52e3,_0x5a8014){var _0x2c901a=require(_0xb914('0x50'));return db[_0xb914('0x2a')][_0xb914('0x42')]({'where':{'id':_0x231e6e[_0xb914('0x40')]['id']},'raw':!![]})[_0xb914('0x24')](handleEntityNotFound(_0x4b52e3,null))[_0xb914('0x24')](function(){_0x2c901a[_0xb914('0x4f')](_0x231e6e[_0xb914('0x40')]['id']);})[_0xb914('0x24')](respondWithStatusCode(_0x4b52e3,null))[_0xb914('0x43')](handleError(_0x4b52e3,null));}; \ No newline at end of file +var _0xdce9=['UserProfileResource','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','stack','send','index','map','Schedule','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','UserProfileSection','userProfileId'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xdce9,0x1dd));var _0x9dce=function(_0x32535c,_0x4da469){_0x32535c=_0x32535c-0x0;var _0x24f2aa=_0xdce9[_0x32535c];return _0x24f2aa;};'use strict';var emlformat=require(_0x9dce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9dce('0x1'));var jsonpatch=require(_0x9dce('0x2'));var rp=require(_0x9dce('0x3'));var moment=require(_0x9dce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9dce('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9dce('0x6'));var csv=require(_0x9dce('0x7'));var ejs=require(_0x9dce('0x8'));var fs=require('fs');var fs_extra=require(_0x9dce('0x9'));var _=require(_0x9dce('0xa'));var squel=require('squel');var crypto=require(_0x9dce('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9dce('0x7'));var querystring=require(_0x9dce('0xc'));var Papa=require(_0x9dce('0xd'));var Redis=require(_0x9dce('0xe'));var authService=require(_0x9dce('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9dce('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dce('0x11'))(_0x9dce('0x12'));var utils=require(_0x9dce('0x13'));var config=require(_0x9dce('0x14'));var licenseUtil=require(_0x9dce('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x325579,_0x5b02e6){_0x5b02e6=_0x5b02e6||0xcc;return function(_0xef4be0){if(_0xef4be0){return _0x325579[_0x9dce('0x16')](_0x5b02e6);}return _0x325579[_0x9dce('0x17')](_0x5b02e6)[_0x9dce('0x18')]();};}function respondWithResult(_0x3fe2c7,_0xff0de5){_0xff0de5=_0xff0de5||0xc8;return function(_0x1d5f5c){if(_0x1d5f5c){return _0x3fe2c7['status'](_0xff0de5)[_0x9dce('0x19')](_0x1d5f5c);}};}function respondWithFilteredResult(_0x110179,_0x221130){return function(_0x1622c6){if(_0x1622c6){var _0x25e530=typeof _0x221130['offset']===_0x9dce('0x1a')&&typeof _0x221130['limit']===_0x9dce('0x1a');var _0x47e270=_0x1622c6[_0x9dce('0x1b')];var _0x271b81=_0x25e530?0x0:_0x221130[_0x9dce('0x1c')];var _0x154628=_0x25e530?_0x1622c6['count']:_0x221130['offset']+_0x221130[_0x9dce('0x1d')];var _0x30743e;if(_0x154628>=_0x47e270){_0x154628=_0x47e270;_0x30743e=0xc8;}else{_0x30743e=0xce;}_0x110179[_0x9dce('0x17')](_0x30743e);return _0x110179[_0x9dce('0x1e')](_0x9dce('0x1f'),_0x271b81+'-'+_0x154628+'/'+_0x47e270)['json'](_0x1622c6);}return null;};}function patchUpdates(_0x52f382){return function(_0x211cc9){try{jsonpatch[_0x9dce('0x20')](_0x211cc9,_0x52f382,!![]);}catch(_0x1f2a13){return BPromise['reject'](_0x1f2a13);}return _0x211cc9[_0x9dce('0x21')]();};}function saveUpdates(_0x5e1031,_0x1932ea){return function(_0x167793){if(_0x167793){return _0x167793[_0x9dce('0x22')](_0x5e1031)[_0x9dce('0x23')](function(_0x19d9b5){return _0x19d9b5;});}return null;};}function removeEntity(_0x25dcf3,_0x158f49){return function(_0x3ff99e){if(_0x3ff99e){return _0x3ff99e[_0x9dce('0x24')]()['then'](function(){var _0x24ea5f=_0x3ff99e[_0x9dce('0x25')]({'plain':!![]});var _0x987394=_0x9dce('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x987394,'resourceId':_0x24ea5f['id']}})[_0x9dce('0x23')](function(){return _0x3ff99e;});})[_0x9dce('0x23')](function(){_0x25dcf3['status'](0xcc)[_0x9dce('0x18')]();});}};}function handleEntityNotFound(_0x5a2362,_0x467f3a){return function(_0x52aee3){if(!_0x52aee3){_0x5a2362[_0x9dce('0x16')](0x194);}return _0x52aee3;};}function handleError(_0x53654d,_0x2172e0){_0x2172e0=_0x2172e0||0x1f4;return function(_0x1ae121){logger['error'](_0x1ae121[_0x9dce('0x27')]);if(_0x1ae121['name']){delete _0x1ae121['name'];}_0x53654d['status'](_0x2172e0)[_0x9dce('0x28')](_0x1ae121);};}exports[_0x9dce('0x29')]=function(_0x38ab1d,_0x4648f3){var _0x11d291={},_0x25b744={},_0x38f91d={'count':0x0,'rows':[]};var _0x3657dd=_[_0x9dce('0x2a')](db[_0x9dce('0x2b')]['rawAttributes'],function(_0x59ab27){return{'name':_0x59ab27['fieldName'],'type':_0x59ab27[_0x9dce('0x2c')][_0x9dce('0x2d')]};});_0x25b744[_0x9dce('0x2e')]=_[_0x9dce('0x2a')](_0x3657dd,_0x9dce('0x2f'));_0x25b744[_0x9dce('0x30')]=_[_0x9dce('0x31')](_0x38ab1d['query']);_0x25b744['filters']=_[_0x9dce('0x32')](_0x25b744[_0x9dce('0x2e')],_0x25b744[_0x9dce('0x30')]);_0x11d291[_0x9dce('0x33')]=_[_0x9dce('0x32')](_0x25b744['model'],qs[_0x9dce('0x34')](_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x34')]));_0x11d291[_0x9dce('0x33')]=_0x11d291[_0x9dce('0x33')][_0x9dce('0x35')]?_0x11d291[_0x9dce('0x33')]:_0x25b744[_0x9dce('0x2e')];if(!_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x36')](_0x9dce('0x37'))){_0x11d291[_0x9dce('0x1d')]=qs[_0x9dce('0x1d')](_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x1d')]);_0x11d291[_0x9dce('0x1c')]=qs['offset'](_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x1c')]);}_0x11d291['order']=qs[_0x9dce('0x38')](_0x38ab1d['query'][_0x9dce('0x38')]);_0x11d291['where']=qs['filters'](_[_0x9dce('0x39')](_0x38ab1d[_0x9dce('0x30')],_0x25b744['filters']),_0x3657dd);if(_0x38ab1d[_0x9dce('0x30')]['filter']){_0x11d291[_0x9dce('0x3a')]=_[_0x9dce('0x3b')](_0x11d291[_0x9dce('0x3a')],{'$or':_['map'](_0x3657dd,function(_0x2cb4a5){if(_0x2cb4a5[_0x9dce('0x2c')]!==_0x9dce('0x3c')){var _0xbe8e7a={};_0xbe8e7a[_0x2cb4a5[_0x9dce('0x2f')]]={'$like':'%'+_0x38ab1d['query'][_0x9dce('0x3d')]+'%'};return _0xbe8e7a;}})});}_0x11d291=_[_0x9dce('0x3b')]({},_0x11d291,_0x38ab1d['options']);var _0x5ce7f4={'where':_0x11d291['where']};return db[_0x9dce('0x2b')][_0x9dce('0x1b')](_0x5ce7f4)[_0x9dce('0x23')](function(_0x585d63){_0x38f91d['count']=_0x585d63;if(_0x38ab1d[_0x9dce('0x30')][_0x9dce('0x3e')]){_0x11d291['include']=[{'all':!![]}];}return db['Schedule'][_0x9dce('0x3f')](_0x11d291);})[_0x9dce('0x23')](function(_0xcd4885){_0x38f91d[_0x9dce('0x40')]=_0xcd4885;return _0x38f91d;})[_0x9dce('0x23')](respondWithFilteredResult(_0x4648f3,_0x11d291))[_0x9dce('0x41')](handleError(_0x4648f3,null));};exports[_0x9dce('0x42')]=function(_0x11d5f0,_0x4ec679){var _0xd1c6b2={'raw':![],'where':{'id':_0x11d5f0[_0x9dce('0x43')]['id']}},_0xf3b340={};_0xf3b340[_0x9dce('0x2e')]=_[_0x9dce('0x31')](db['Schedule'][_0x9dce('0x44')]);_0xf3b340[_0x9dce('0x30')]=_[_0x9dce('0x31')](_0x11d5f0[_0x9dce('0x30')]);_0xf3b340['filters']=_[_0x9dce('0x32')](_0xf3b340['model'],_0xf3b340[_0x9dce('0x30')]);_0xd1c6b2['attributes']=_[_0x9dce('0x32')](_0xf3b340[_0x9dce('0x2e')],qs[_0x9dce('0x34')](_0x11d5f0[_0x9dce('0x30')][_0x9dce('0x34')]));_0xd1c6b2[_0x9dce('0x33')]=_0xd1c6b2['attributes'][_0x9dce('0x35')]?_0xd1c6b2[_0x9dce('0x33')]:_0xf3b340[_0x9dce('0x2e')];if(_0x11d5f0[_0x9dce('0x30')]['includeAll']){_0xd1c6b2['include']=[{'all':!![]}];}_0xd1c6b2=_['merge']({},_0xd1c6b2,_0x11d5f0[_0x9dce('0x45')]);return db['Schedule'][_0x9dce('0x46')](_0xd1c6b2)[_0x9dce('0x23')](handleEntityNotFound(_0x4ec679,null))[_0x9dce('0x23')](respondWithResult(_0x4ec679,null))[_0x9dce('0x41')](handleError(_0x4ec679,null));};exports[_0x9dce('0x47')]=function(_0x36538c,_0x2fb423){return db[_0x9dce('0x2b')][_0x9dce('0x47')](_0x36538c[_0x9dce('0x48')],{})[_0x9dce('0x23')](function(_0x5c07ae){var _0x19cb58=_0x36538c[_0x9dce('0x49')][_0x9dce('0x25')]({'plain':!![]});if(!_0x19cb58)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19cb58['role']==='user'){var _0x41ada7=_0x5c07ae[_0x9dce('0x25')]({'plain':!![]});var _0x1d93e6=_0x9dce('0x26');return db[_0x9dce('0x4a')][_0x9dce('0x46')]({'where':{'name':_0x1d93e6,'userProfileId':_0x19cb58[_0x9dce('0x4b')]},'raw':!![]})['then'](function(_0x15e88a){if(_0x15e88a&&_0x15e88a['autoAssociation']===0x0){return db[_0x9dce('0x4c')][_0x9dce('0x47')]({'name':_0x41ada7[_0x9dce('0x2f')],'resourceId':_0x41ada7['id'],'type':_0x15e88a['name'],'sectionId':_0x15e88a['id']},{})['then'](function(){return _0x5c07ae;});}else{return _0x5c07ae;}})[_0x9dce('0x41')](function(_0x5bd6ff){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bd6ff);throw _0x5bd6ff;});}return _0x5c07ae;})[_0x9dce('0x23')](respondWithResult(_0x2fb423,0xc9))[_0x9dce('0x41')](handleError(_0x2fb423,null));};exports['update']=function(_0x4db0c3,_0x1b6daf){if(_0x4db0c3[_0x9dce('0x48')]['id']){delete _0x4db0c3[_0x9dce('0x48')]['id'];}return db[_0x9dce('0x2b')]['find']({'where':{'id':_0x4db0c3[_0x9dce('0x43')]['id']}})[_0x9dce('0x23')](handleEntityNotFound(_0x1b6daf,null))[_0x9dce('0x23')](saveUpdates(_0x4db0c3[_0x9dce('0x48')],null))[_0x9dce('0x23')](respondWithResult(_0x1b6daf,null))[_0x9dce('0x41')](handleError(_0x1b6daf,null));};exports['destroy']=function(_0x46632a,_0x9f7b48){return db['Schedule'][_0x9dce('0x46')]({'where':{'id':_0x46632a[_0x9dce('0x43')]['id']}})['then'](handleEntityNotFound(_0x9f7b48,null))[_0x9dce('0x23')](removeEntity(_0x9f7b48,null))[_0x9dce('0x41')](handleError(_0x9f7b48,null));};exports[_0x9dce('0x4d')]=function(_0x1fc1b5,_0x277819,_0x3b3b02){var _0x56de10=require(_0x9dce('0x4e'));return db[_0x9dce('0x2b')][_0x9dce('0x46')]({'where':{'id':_0x1fc1b5[_0x9dce('0x43')]['id']},'raw':!![]})[_0x9dce('0x23')](handleEntityNotFound(_0x277819,null))[_0x9dce('0x23')](function(){_0x56de10[_0x9dce('0x4d')](_0x1fc1b5['params']['id']);})[_0x9dce('0x23')](respondWithStatusCode(_0x277819,null))[_0x9dce('0x41')](handleError(_0x277819,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 72e9829..483c74f 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 _0x9d24=['bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','tools_schedules','util','../../config/logger','api'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x9d24,0x11b));var _0x49d2=function(_0x264b65,_0x509dd5){_0x264b65=_0x264b65-0x0;var _0xcd8a8e=_0x9d24[_0x264b65];return _0xcd8a8e;};'use strict';var _=require('lodash');var util=require(_0x49d2('0x0'));var logger=require(_0x49d2('0x1'))(_0x49d2('0x2'));var moment=require('moment');var BPromise=require(_0x49d2('0x3'));var rp=require(_0x49d2('0x4'));var fs=require('fs');var path=require(_0x49d2('0x5'));var rimraf=require(_0x49d2('0x6'));var config=require(_0x49d2('0x7'));var attributes=require(_0x49d2('0x8'));module['exports']=function(_0x3f6fa5,_0x46ef0a){return _0x3f6fa5[_0x49d2('0x9')]('Schedule',attributes,{'tableName':_0x49d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eeb=['rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2eeb,0xc9));var _0xb2ee=function(_0x249fc2,_0x52c16b){_0x249fc2=_0x249fc2-0x0;var _0x4c1320=_0x2eeb[_0x249fc2];return _0x4c1320;};'use strict';var _=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var logger=require(_0xb2ee('0x2'))('api');var moment=require(_0xb2ee('0x3'));var BPromise=require(_0xb2ee('0x4'));var rp=require(_0xb2ee('0x5'));var fs=require('fs');var path=require(_0xb2ee('0x6'));var rimraf=require(_0xb2ee('0x7'));var config=require(_0xb2ee('0x8'));var attributes=require(_0xb2ee('0x9'));module[_0xb2ee('0xa')]=function(_0x41eda1,_0x5ccb9a){return _0x41eda1['define'](_0xb2ee('0xb'),attributes,{'tableName':_0xb2ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 969c28a..7e4e944 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 _0xd742=['stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x279f94,_0x211ea4){var _0x129b6d=function(_0x48ba86){while(--_0x48ba86){_0x279f94['push'](_0x279f94['shift']());}};_0x129b6d(++_0x211ea4);}(_0xd742,0x6a));var _0x2d74=function(_0x2dc457,_0x37b6b9){_0x2dc457=_0x2dc457-0x0;var _0xd65e48=_0xd742[_0x2dc457];return _0xd65e48;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2d74('0x0'));var rs=require(_0x2d74('0x1'));var fs=require('fs');var Redis=require(_0x2d74('0x2'));var db=require(_0x2d74('0x3'))['db'];var utils=require(_0x2d74('0x4'));var logger=require(_0x2d74('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2d74('0x6'));var client=jayson[_0x2d74('0x7')][_0x2d74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24ee29,_0xdce9c4,_0x2ca46b){return new BPromise(function(_0x4d80e2,_0x4db6ba){return client[_0x2d74('0x9')](_0x24ee29,_0x2ca46b)[_0x2d74('0xa')](function(_0x3f3e90){logger[_0x2d74('0xb')](_0x2d74('0xc'),_0xdce9c4,_0x2d74('0xd'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0xdce9c4,_0x2d74('0xd'),JSON[_0x2d74('0xe')](_0x3f3e90));if(_0x3f3e90[_0x2d74('0xf')]){if(_0x3f3e90['error'][_0x2d74('0x10')]===0x1f4){logger[_0x2d74('0xf')](_0x2d74('0xc'),_0xdce9c4,_0x3f3e90[_0x2d74('0xf')][_0x2d74('0x11')]);return _0x4db6ba(_0x3f3e90[_0x2d74('0xf')]['message']);}logger[_0x2d74('0xf')]('Schedule,\x20%s,\x20%s',_0xdce9c4,_0x3f3e90['error'][_0x2d74('0x11')]);return _0x4d80e2(_0x3f3e90[_0x2d74('0xf')]['message']);}else{logger[_0x2d74('0xb')]('Schedule,\x20%s,\x20%s',_0xdce9c4,'request\x20sent');_0x4d80e2(_0x3f3e90[_0x2d74('0x12')]['message']);}})[_0x2d74('0x13')](function(_0x431bb3){logger['error'](_0x2d74('0xc'),_0xdce9c4,_0x431bb3);_0x4db6ba(_0x431bb3);});});} \ No newline at end of file +var _0x8eab=['error','code','message','Schedule,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x3f3fe2,_0x32f076){var _0x4e687a=function(_0x33db52){while(--_0x33db52){_0x3f3fe2['push'](_0x3f3fe2['shift']());}};_0x4e687a(++_0x32f076);}(_0x8eab,0xb6));var _0xb8ea=function(_0x581ae1,_0x56715f){_0x581ae1=_0x581ae1-0x0;var _0x1a770d=_0x8eab[_0x581ae1];return _0x1a770d;};'use strict';var _=require('lodash');var util=require(_0xb8ea('0x0'));var moment=require('moment');var BPromise=require(_0xb8ea('0x1'));var rs=require(_0xb8ea('0x2'));var fs=require('fs');var Redis=require(_0xb8ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8ea('0x4'));var logger=require(_0xb8ea('0x5'))(_0xb8ea('0x6'));var config=require(_0xb8ea('0x7'));var jayson=require(_0xb8ea('0x8'));var client=jayson[_0xb8ea('0x9')][_0xb8ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x327dbe,_0x1736f8,_0x30951){return new BPromise(function(_0x4b9edc,_0x165cf2){return client[_0xb8ea('0xb')](_0x327dbe,_0x30951)[_0xb8ea('0xc')](function(_0x14649b){logger[_0xb8ea('0xd')]('Schedule,\x20%s,\x20%s',_0x1736f8,_0xb8ea('0xe'));logger[_0xb8ea('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1736f8,_0xb8ea('0xe'),JSON['stringify'](_0x14649b));if(_0x14649b['error']){if(_0x14649b[_0xb8ea('0x10')][_0xb8ea('0x11')]===0x1f4){logger[_0xb8ea('0x10')]('Schedule,\x20%s,\x20%s',_0x1736f8,_0x14649b[_0xb8ea('0x10')][_0xb8ea('0x12')]);return _0x165cf2(_0x14649b['error'][_0xb8ea('0x12')]);}logger['error'](_0xb8ea('0x13'),_0x1736f8,_0x14649b[_0xb8ea('0x10')]['message']);return _0x4b9edc(_0x14649b[_0xb8ea('0x10')][_0xb8ea('0x12')]);}else{logger['info'](_0xb8ea('0x13'),_0x1736f8,_0xb8ea('0xe'));_0x4b9edc(_0x14649b[_0xb8ea('0x14')][_0xb8ea('0x12')]);}})[_0xb8ea('0x15')](function(_0x3a235f){logger[_0xb8ea('0x10')](_0xb8ea('0x13'),_0x1736f8,_0x3a235f);_0x165cf2(_0x3a235f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0f1e6d2..6955a24 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 _0x2ef9=['describe','show','/:id/download','download','post','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe'];(function(_0x223a00,_0x1f1e9f){var _0x152f91=function(_0x511bf6){while(--_0x511bf6){_0x223a00['push'](_0x223a00['shift']());}};_0x152f91(++_0x1f1e9f);}(_0x2ef9,0x154));var _0x92ef=function(_0x4d7753,_0x7fa2ac){_0x4d7753=_0x4d7753-0x0;var _0x40fd64=_0x2ef9[_0x4d7753];return _0x40fd64;};'use strict';var multer=require(_0x92ef('0x0'));var util=require(_0x92ef('0x1'));var path=require(_0x92ef('0x2'));var timeout=require(_0x92ef('0x3'));var express=require(_0x92ef('0x4'));var router=express['Router']();var fs_extra=require(_0x92ef('0x5'));var auth=require(_0x92ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92ef('0x7'));var controller=require(_0x92ef('0x8'));router[_0x92ef('0x9')]('/',auth[_0x92ef('0xa')](),controller['index']);router[_0x92ef('0x9')](_0x92ef('0xb'),auth['isAuthenticated'](),controller[_0x92ef('0xc')]);router[_0x92ef('0x9')]('/:id',auth[_0x92ef('0xa')](),controller[_0x92ef('0xd')]);router[_0x92ef('0x9')](_0x92ef('0xe'),auth[_0x92ef('0xa')](),controller[_0x92ef('0xf')]);router[_0x92ef('0x10')]('/',auth[_0x92ef('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x92ef('0x11')]);router[_0x92ef('0x12')](_0x92ef('0x13'),auth[_0x92ef('0xa')](),controller[_0x92ef('0x14')]);module[_0x92ef('0x15')]=router; \ No newline at end of file +var _0x2475=['/:id/download','download','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4e26ea,_0x4dae1e){var _0x452b66=function(_0x41d390){while(--_0x41d390){_0x4e26ea['push'](_0x4e26ea['shift']());}};_0x452b66(++_0x4dae1e);}(_0x2475,0x9b));var _0x5247=function(_0x161fba,_0x44578c){_0x161fba=_0x161fba-0x0;var _0x15b209=_0x2475[_0x161fba];return _0x15b209;};'use strict';var multer=require(_0x5247('0x0'));var util=require(_0x5247('0x1'));var path=require('path');var timeout=require(_0x5247('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5247('0x3'));var auth=require(_0x5247('0x4'));var interaction=require(_0x5247('0x5'));var config=require('../../config/environment');var controller=require(_0x5247('0x6'));router[_0x5247('0x7')]('/',auth[_0x5247('0x8')](),controller[_0x5247('0x9')]);router[_0x5247('0x7')](_0x5247('0xa'),auth[_0x5247('0x8')](),controller[_0x5247('0xb')]);router[_0x5247('0x7')](_0x5247('0xc'),auth[_0x5247('0x8')](),controller['show']);router['get'](_0x5247('0xd'),auth[_0x5247('0x8')](),controller[_0x5247('0xe')]);router[_0x5247('0xf')]('/',auth[_0x5247('0x8')](),controller['create']);router[_0x5247('0x10')](_0x5247('0xc'),auth[_0x5247('0x8')](),controller[_0x5247('0x11')]);router[_0x5247('0x12')](_0x5247('0xc'),auth['isAuthenticated'](),controller[_0x5247('0x13')]);module[_0x5247('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 24cbfc2..3afb78c 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 _0xb8cb=['../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','value','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x3c12c3,_0x370b5d){_0x3c12c3=_0x3c12c3-0x0;var _0x124bda=_0xb8cb[_0x3c12c3];return _0x124bda;};'use strict';var Sequelize=require(_0xbb8c('0x0'));var moment=require(_0xbb8c('0x1'));var path=require(_0xbb8c('0x2'));var config=require(_0xbb8c('0x3'));module[_0xbb8c('0x4')]={'format':{'type':Sequelize[_0xbb8c('0x5')],'get':function(){return this[_0xbb8c('0x6')]('value')?path[_0xbb8c('0x7')](this[_0xbb8c('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbb8c('0x8')]},'value':{'type':Sequelize[_0xbb8c('0x8')],'set':function(_0x3eb759){var _0x497956=_0x3eb759[_0xbb8c('0x9')](/\\/g,'/');this[_0xbb8c('0xa')](_0xbb8c('0xb'),_0x497956);}},'rating':{'type':Sequelize[_0xbb8c('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xbb8c('0xc')],'set':function(_0x2a9791){this[_0xbb8c('0xa')](_0xbb8c('0xd'),moment()[_0xbb8c('0xe')](_0x2a9791,'ms'));this[_0xbb8c('0xa')](_0xbb8c('0xf'),moment());this[_0xbb8c('0xa')]('duration',_0x2a9791);}},'startedAt':{'type':Sequelize[_0xbb8c('0x10')],'get':function(){return moment(this[_0xbb8c('0x6')](_0xbb8c('0xd')))[_0xbb8c('0x11')](_0xbb8c('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xbb8c('0x10')],'get':function(){return moment(this[_0xbb8c('0x6')](_0xbb8c('0xf')))[_0xbb8c('0x11')](_0xbb8c('0x12'))[_0xbb8c('0x13')]();}},'createdAt':{'type':Sequelize[_0xbb8c('0x10')],'get':function(){return moment(this['getDataValue'](_0xbb8c('0x14')))[_0xbb8c('0x11')](_0xbb8c('0x12'))[_0xbb8c('0x13')]();}},'updatedAt':{'type':Sequelize[_0xbb8c('0x10')],'get':function(){return moment(this[_0xbb8c('0x6')](_0xbb8c('0x15')))[_0xbb8c('0x11')](_0xbb8c('0x12'))[_0xbb8c('0x13')]();}}}; \ No newline at end of file +var _0x6a95=['VIRTUAL','getDataValue','value','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','updatedAt','sequelize','moment','path','../../config/environment','exports'];(function(_0x507b8f,_0x3972ba){var _0xffe67a=function(_0x596488){while(--_0x596488){_0x507b8f['push'](_0x507b8f['shift']());}};_0xffe67a(++_0x3972ba);}(_0x6a95,0x1db));var _0x56a9=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x6a95[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x56a9('0x0'));var moment=require(_0x56a9('0x1'));var path=require(_0x56a9('0x2'));var config=require(_0x56a9('0x3'));module[_0x56a9('0x4')]={'format':{'type':Sequelize[_0x56a9('0x5')],'get':function(){return this[_0x56a9('0x6')]('value')?path['extname'](this[_0x56a9('0x6')](_0x56a9('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x56a9('0x8')]},'channel':{'type':Sequelize[_0x56a9('0x8')]},'value':{'type':Sequelize[_0x56a9('0x8')],'set':function(_0x365093){var _0xd8aa7c=_0x365093['replace'](/\\/g,'/');this['setDataValue'](_0x56a9('0x7'),_0xd8aa7c);}},'rating':{'type':Sequelize[_0x56a9('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xe4b98c){this[_0x56a9('0xa')](_0x56a9('0xb'),moment()[_0x56a9('0xc')](_0xe4b98c,'ms'));this[_0x56a9('0xa')](_0x56a9('0xd'),moment());this[_0x56a9('0xa')](_0x56a9('0xe'),_0xe4b98c);}},'startedAt':{'type':Sequelize[_0x56a9('0xf')],'get':function(){return moment(this['getDataValue'](_0x56a9('0xb')))['format'](_0x56a9('0x10'))[_0x56a9('0x11')]();}},'closedAt':{'type':Sequelize[_0x56a9('0xf')],'get':function(){return moment(this[_0x56a9('0x6')](_0x56a9('0xd')))[_0x56a9('0x12')](_0x56a9('0x10'))[_0x56a9('0x11')]();}},'createdAt':{'type':Sequelize[_0x56a9('0xf')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x56a9('0x12')](_0x56a9('0x10'))[_0x56a9('0x11')]();}},'updatedAt':{'type':Sequelize[_0x56a9('0xf')],'get':function(){return moment(this['getDataValue'](_0x56a9('0x13')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index d66e736..4292bed 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 _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x58c14a,_0x52aa63){var _0x27d70a=function(_0x232622){while(--_0x232622){_0x58c14a['push'](_0x58c14a['shift']());}};_0x27d70a(++_0x52aa63);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x4c4e,0x152));var _0xe4c4=function(_0xc45e56,_0x30b9ec){_0xc45e56=_0xc45e56-0x0;var _0x10bb77=_0x4c4e[_0xc45e56];return _0x10bb77;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 748a385..935b537 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 _0xc45d=['bluebird','path','rimraf','../../config/environment','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xc45d,0x119));var _0xdc45=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0xc45d[_0x251d43];return _0x3d7759;};'use strict';var _=require(_0xdc45('0x0'));var util=require(_0xdc45('0x1'));var logger=require(_0xdc45('0x2'))(_0xdc45('0x3'));var moment=require(_0xdc45('0x4'));var BPromise=require(_0xdc45('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc45('0x6'));var rimraf=require(_0xdc45('0x7'));var config=require(_0xdc45('0x8'));var attributes=require('./screenRecording.attributes');module[_0xdc45('0x9')]=function(_0x25667b,_0x237842){return _0x25667b[_0xdc45('0xa')](_0xdc45('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xdc45('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30f9=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30f9,0xea));var _0x930f=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0x30f9[_0x1cfe2e];return _0x39233f;};'use strict';var _=require(_0x930f('0x0'));var util=require(_0x930f('0x1'));var logger=require(_0x930f('0x2'))(_0x930f('0x3'));var moment=require(_0x930f('0x4'));var BPromise=require(_0x930f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x930f('0x6'));var attributes=require(_0x930f('0x7'));module[_0x930f('0x8')]=function(_0x54a0de,_0x10ccb3){return _0x54a0de[_0x930f('0x9')](_0x930f('0xa'),attributes,{'tableName':_0x930f('0xb'),'paranoid':![],'indexes':[{'name':_0x930f('0xc'),'fields':[_0x930f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 720afa9..8260d2c 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 _0x3a58=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x32eb7f,_0x5cc11f){var _0x470a3e=function(_0x1e2009){while(--_0x1e2009){_0x32eb7f['push'](_0x32eb7f['shift']());}};_0x470a3e(++_0x5cc11f);}(_0x3a58,0x18b));var _0x83a5=function(_0x4eb822,_0x56d2ef){_0x4eb822=_0x4eb822-0x0;var _0x27d901=_0x3a58[_0x4eb822];return _0x27d901;};'use strict';var _=require(_0x83a5('0x0'));var util=require('util');var moment=require(_0x83a5('0x1'));var BPromise=require(_0x83a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83a5('0x3'));var db=require(_0x83a5('0x4'))['db'];var utils=require(_0x83a5('0x5'));var logger=require(_0x83a5('0x6'))(_0x83a5('0x7'));var config=require(_0x83a5('0x8'));var jayson=require(_0x83a5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2895e7,_0xfb8c68,_0x3e038d){return new BPromise(function(_0x2cc75a,_0x4a52cb){return client[_0x83a5('0xa')](_0x2895e7,_0x3e038d)['then'](function(_0x1f4c01){logger[_0x83a5('0xb')]('ScreenRecording,\x20%s,\x20%s',_0xfb8c68,_0x83a5('0xc'));logger[_0x83a5('0xd')](_0x83a5('0xe'),_0xfb8c68,_0x83a5('0xc'),JSON[_0x83a5('0xf')](_0x1f4c01));if(_0x1f4c01[_0x83a5('0x10')]){if(_0x1f4c01['error'][_0x83a5('0x11')]===0x1f4){logger[_0x83a5('0x10')](_0x83a5('0x12'),_0xfb8c68,_0x1f4c01['error'][_0x83a5('0x13')]);return _0x4a52cb(_0x1f4c01[_0x83a5('0x10')][_0x83a5('0x13')]);}logger[_0x83a5('0x10')](_0x83a5('0x12'),_0xfb8c68,_0x1f4c01[_0x83a5('0x10')]['message']);return _0x2cc75a(_0x1f4c01[_0x83a5('0x10')][_0x83a5('0x13')]);}else{logger[_0x83a5('0xb')](_0x83a5('0x12'),_0xfb8c68,'request\x20sent');_0x2cc75a(_0x1f4c01[_0x83a5('0x14')]['message']);}})[_0x83a5('0x15')](function(_0x1662e6){logger[_0x83a5('0x10')](_0x83a5('0x12'),_0xfb8c68,_0x1662e6);_0x4a52cb(_0x1662e6);});});} \ No newline at end of file +var _0xc3b0=['../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x4cd22f,_0x57c3ea){var _0x2342d3=function(_0x16684f){while(--_0x16684f){_0x4cd22f['push'](_0x4cd22f['shift']());}};_0x2342d3(++_0x57c3ea);}(_0xc3b0,0xb8));var _0x0c3b=function(_0x960bec,_0x32741d){_0x960bec=_0x960bec-0x0;var _0x22e3d5=_0xc3b0[_0x960bec];return _0x22e3d5;};'use strict';var _=require(_0x0c3b('0x0'));var util=require(_0x0c3b('0x1'));var moment=require(_0x0c3b('0x2'));var BPromise=require(_0x0c3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c3b('0x4'));var db=require(_0x0c3b('0x5'))['db'];var utils=require(_0x0c3b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0c3b('0x7'));var client=jayson[_0x0c3b('0x8')][_0x0c3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb326,_0x1b3dde,_0x1b38a2){return new BPromise(function(_0x22fc9c,_0x1bfa79){return client[_0x0c3b('0xa')](_0x5eb326,_0x1b38a2)[_0x0c3b('0xb')](function(_0x3eb482){logger[_0x0c3b('0xc')](_0x0c3b('0xd'),_0x1b3dde,_0x0c3b('0xe'));logger[_0x0c3b('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1b3dde,_0x0c3b('0xe'),JSON[_0x0c3b('0x10')](_0x3eb482));if(_0x3eb482[_0x0c3b('0x11')]){if(_0x3eb482['error']['code']===0x1f4){logger['error'](_0x0c3b('0xd'),_0x1b3dde,_0x3eb482[_0x0c3b('0x11')][_0x0c3b('0x12')]);return _0x1bfa79(_0x3eb482[_0x0c3b('0x11')][_0x0c3b('0x12')]);}logger[_0x0c3b('0x11')](_0x0c3b('0xd'),_0x1b3dde,_0x3eb482[_0x0c3b('0x11')][_0x0c3b('0x12')]);return _0x22fc9c(_0x3eb482[_0x0c3b('0x11')][_0x0c3b('0x12')]);}else{logger[_0x0c3b('0xc')](_0x0c3b('0xd'),_0x1b3dde,'request\x20sent');_0x22fc9c(_0x3eb482[_0x0c3b('0x13')][_0x0c3b('0x12')]);}})[_0x0c3b('0x14')](function(_0x312e18){logger[_0x0c3b('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x1b3dde,_0x312e18);_0x1bfa79(_0x312e18);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 3b756a6..fba1efc 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 _0xd3c5=['../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','format','logo','extname','originalname','/:id/logo','single','addLogo','diskStorage','server/files/images/logos/','%s%s','post','file','addLogoLogin','join','root','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x567758,_0x533bba){var _0x1d0e7f=function(_0x1d9d06){while(--_0x1d9d06){_0x567758['push'](_0x567758['shift']());}};_0x1d0e7f(++_0x533bba);}(_0xd3c5,0x128));var _0x5d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c5[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5d3c('0x0'));var util=require(_0x5d3c('0x1'));var path=require(_0x5d3c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d3c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5d3c('0x4'));var interaction=require(_0x5d3c('0x5'));var config=require(_0x5d3c('0x6'));var controller=require(_0x5d3c('0x7'));router[_0x5d3c('0x8')]('/',auth[_0x5d3c('0x9')](),controller[_0x5d3c('0xa')]);router[_0x5d3c('0x8')](_0x5d3c('0xb'),controller[_0x5d3c('0xc')]);router[_0x5d3c('0x8')](_0x5d3c('0xd'),controller['show']);router[_0x5d3c('0x8')]('/:id/logo',controller[_0x5d3c('0xe')]);router['get'](_0x5d3c('0xf'),controller['getLogoLogin']);router['get'](_0x5d3c('0x10'),controller['gdpr']);router[_0x5d3c('0x8')](_0x5d3c('0x11'),controller[_0x5d3c('0x12')]);router['get'](_0x5d3c('0x13'),controller[_0x5d3c('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48add5,_0x3cceee,_0x3c4ba7){_0x3c4ba7(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x46593f,_0x4436ad,_0x31d5ce){_0x31d5ce(null,util[_0x5d3c('0x15')]('%s%s',_0x5d3c('0x16'),path[_0x5d3c('0x17')](_0x4436ad[_0x5d3c('0x18')])));}})});router['post'](_0x5d3c('0x19'),upload[_0x5d3c('0x1a')]('file'),controller[_0x5d3c('0x1b')]);var upload=multer({'storage':multer[_0x5d3c('0x1c')]({'destination':function(_0x376735,_0x10a502,_0x25c956){_0x25c956(null,path['join'](config['root'],_0x5d3c('0x1d')));},'filename':function(_0x238141,_0x378fa7,_0x63b752){_0x63b752(null,util['format'](_0x5d3c('0x1e'),'logologin',path[_0x5d3c('0x17')](_0x378fa7[_0x5d3c('0x18')])));}})});router[_0x5d3c('0x1f')]('/:id/logo_login',upload['single'](_0x5d3c('0x20')),controller[_0x5d3c('0x21')]);var upload=multer({'storage':multer[_0x5d3c('0x1c')]({'destination':function(_0x28e141,_0x1909aa,_0x551ea4){_0x551ea4(null,path[_0x5d3c('0x22')](config[_0x5d3c('0x23')],_0x5d3c('0x1d')));},'filename':function(_0x4d6dfc,_0x4668bd,_0x5cfa94){_0x5cfa94(null,util[_0x5d3c('0x15')](_0x5d3c('0x1e'),_0x5d3c('0x24'),path['extname'](_0x4668bd['originalname'])));}})});router['post'](_0x5d3c('0x11'),upload[_0x5d3c('0x1a')](_0x5d3c('0x20')),controller[_0x5d3c('0x25')]);var upload=multer({'storage':multer[_0x5d3c('0x1c')]({'destination':function(_0x1316a3,_0x55bcc9,_0x3a12b4){_0x3a12b4(null,path['join'](config[_0x5d3c('0x23')],'server/files/images/logos/'));},'filename':function(_0x5e7d76,_0x177d7a,_0x5cb9e9){_0x5cb9e9(null,util['format'](_0x5d3c('0x1e'),_0x5d3c('0x26'),path['extname'](_0x177d7a[_0x5d3c('0x18')])));}})});router['post']('/:id/favicon',upload[_0x5d3c('0x1a')](_0x5d3c('0x20')),controller[_0x5d3c('0x27')]);router[_0x5d3c('0x28')](_0x5d3c('0xd'),auth[_0x5d3c('0x9')](),controller[_0x5d3c('0x29')]);module[_0x5d3c('0x2a')]=router; \ No newline at end of file +var _0x6ac5=['single','file','addLogo','logologin','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./setting.controller','get','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x6ac5,0x8d));var _0x56ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ac5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x56ac('0x0'));var util=require(_0x56ac('0x1'));var path=require('path');var timeout=require(_0x56ac('0x2'));var express=require(_0x56ac('0x3'));var router=express[_0x56ac('0x4')]();var fs_extra=require(_0x56ac('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x56ac('0x6'));var controller=require(_0x56ac('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x56ac('0x8')](_0x56ac('0x9'),controller[_0x56ac('0xa')]);router[_0x56ac('0x8')](_0x56ac('0xb'),controller[_0x56ac('0xc')]);router[_0x56ac('0x8')](_0x56ac('0xd'),controller[_0x56ac('0xe')]);router[_0x56ac('0x8')](_0x56ac('0xf'),controller['getLogoLogin']);router[_0x56ac('0x8')]('/:id/gdpr',controller[_0x56ac('0x10')]);router[_0x56ac('0x8')](_0x56ac('0x11'),controller[_0x56ac('0x12')]);router[_0x56ac('0x8')](_0x56ac('0x13'),controller[_0x56ac('0x14')]);var upload=multer({'storage':multer[_0x56ac('0x15')]({'destination':function(_0x1b3ccb,_0x54793c,_0x3211d3){_0x3211d3(null,path[_0x56ac('0x16')](config[_0x56ac('0x17')],_0x56ac('0x18')));},'filename':function(_0x39f3ca,_0x16bf2d,_0x231846){_0x231846(null,util[_0x56ac('0x19')](_0x56ac('0x1a'),_0x56ac('0x1b'),path[_0x56ac('0x1c')](_0x16bf2d[_0x56ac('0x1d')])));}})});router[_0x56ac('0x1e')](_0x56ac('0xd'),upload[_0x56ac('0x1f')](_0x56ac('0x20')),controller[_0x56ac('0x21')]);var upload=multer({'storage':multer[_0x56ac('0x15')]({'destination':function(_0x48e300,_0x21c54f,_0x16679d){_0x16679d(null,path['join'](config[_0x56ac('0x17')],_0x56ac('0x18')));},'filename':function(_0x433bd6,_0x42f065,_0x1fb29a){_0x1fb29a(null,util[_0x56ac('0x19')](_0x56ac('0x1a'),_0x56ac('0x22'),path[_0x56ac('0x1c')](_0x42f065[_0x56ac('0x1d')])));}})});router[_0x56ac('0x1e')](_0x56ac('0xf'),upload[_0x56ac('0x1f')](_0x56ac('0x20')),controller[_0x56ac('0x23')]);var upload=multer({'storage':multer[_0x56ac('0x15')]({'destination':function(_0x4e97d8,_0x31fe02,_0x10f065){_0x10f065(null,path[_0x56ac('0x16')](config[_0x56ac('0x17')],_0x56ac('0x18')));},'filename':function(_0xdc1044,_0x1fc588,_0x3d9f03){_0x3d9f03(null,util[_0x56ac('0x19')](_0x56ac('0x1a'),_0x56ac('0x24'),path[_0x56ac('0x1c')](_0x1fc588['originalname'])));}})});router[_0x56ac('0x1e')](_0x56ac('0x11'),upload['single'](_0x56ac('0x20')),controller[_0x56ac('0x25')]);var upload=multer({'storage':multer[_0x56ac('0x15')]({'destination':function(_0x5ae65c,_0x45efa5,_0x2888d9){_0x2888d9(null,path[_0x56ac('0x16')](config['root'],_0x56ac('0x18')));},'filename':function(_0x3c0b96,_0x3732d8,_0x25899c){_0x25899c(null,util[_0x56ac('0x19')](_0x56ac('0x1a'),_0x56ac('0x26'),path[_0x56ac('0x1c')](_0x3732d8[_0x56ac('0x1d')])));}})});router['post'](_0x56ac('0x13'),upload['single'](_0x56ac('0x20')),controller[_0x56ac('0x27')]);router[_0x56ac('0x28')](_0x56ac('0xb'),auth[_0x56ac('0x29')](),controller['update']);module[_0x56ac('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 88613b3..2a35861 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 _0x4d29=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xd85d9e,_0x22bef1){var _0x3f1e51=function(_0x366ee5){while(--_0x366ee5){_0xd85d9e['push'](_0xd85d9e['shift']());}};_0x3f1e51(++_0x22bef1);}(_0x4d29,0x1ab));var _0x94d2=function(_0x2e7e1e,_0x292649){_0x2e7e1e=_0x2e7e1e-0x0;var _0x59ed3a=_0x4d29[_0x2e7e1e];return _0x59ed3a;};'use strict';var Sequelize=require(_0x94d2('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x94d2('0x1')](0xb),'unique':_0x94d2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x94d2('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x94d2('0x3')],'defaultValue':_0x94d2('0x4')},'logo':{'type':Sequelize[_0x94d2('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x94d2('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x94d2('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x94d2('0x3')]},'turnaddr':{'type':Sequelize[_0x94d2('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x94d2('0x3')]},'pageTitle':{'type':Sequelize[_0x94d2('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x94d2('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x94d2('0x3')],'defaultValue':_0x94d2('0x6')},'enableEmailPreview':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x94d2('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x94d2('0x3')]},'defaultPreferred':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x94d2('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x94d2('0x3')]},'defaultFavicon':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x94d2('0x1')]},'transcribeRegion':{'type':Sequelize[_0x94d2('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x94d2('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x94d2('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x94d2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x94d2('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x94d2('0x1')](0x2)[_0x94d2('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x94d2('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0d49=['INTEGER','min_internal','STRING','BOOLEAN','UNSIGNED','exports'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x0d49,0xad));var _0x90d4=function(_0x40c251,_0x4f8884){_0x40c251=_0x40c251-0x0;var _0x54db7e=_0x0d49[_0x40c251];return _0x54db7e;};'use strict';var Sequelize=require('sequelize');module[_0x90d4('0x0')]={'min_internal':{'type':Sequelize[_0x90d4('0x1')](0xb),'unique':_0x90d4('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x90d4('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x90d4('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x90d4('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x90d4('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x90d4('0x3')]},'turnusername':{'type':Sequelize[_0x90d4('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x90d4('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x90d4('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x90d4('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x90d4('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x90d4('0x3')]},'defaultPreferred':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x90d4('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x90d4('0x3')]},'defaultFavicon':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x90d4('0x1')]},'transcribeRegion':{'type':Sequelize[_0x90d4('0x3')]},'sentiment':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x90d4('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x90d4('0x3')]},'bucket':{'type':Sequelize[_0x90d4('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x90d4('0x1')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x90d4('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x90d4('0x1')](0x2)[_0x90d4('0x5')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x90d4('0x1')](0x2)[_0x90d4('0x5')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x90d4('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x90d4('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index d6cc7f3..ccdb708 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 _0xee81=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','show','params','keys','length','include','find','body','addLogo','file','filename','logo','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultFavicon','join','toLower','root','default','custom','default_logo.svg','Sequelize','upperFirst','\x20not\x20found','download','defaultLogo','defaultPreferred','existsSync','default_loginLogo.svg','ValidationError','gdpr','securePassword','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x51d954,_0x31aae5){var _0x362f82=function(_0x215c3a){while(--_0x215c3a){_0x51d954['push'](_0x51d954['shift']());}};_0x362f82(++_0x31aae5);}(_0xee81,0x15e));var _0x1ee8=function(_0x152bfe,_0x197cdf){_0x152bfe=_0x152bfe-0x0;var _0x38401c=_0xee81[_0x152bfe];return _0x38401c;};'use strict';var emlformat=require(_0x1ee8('0x0'));var rimraf=require(_0x1ee8('0x1'));var zipdir=require(_0x1ee8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ee8('0x3'));var BPromise=require(_0x1ee8('0x4'));var Mustache=require('mustache');var util=require(_0x1ee8('0x5'));var path=require(_0x1ee8('0x6'));var sox=require('sox');var csv=require(_0x1ee8('0x7'));var ejs=require(_0x1ee8('0x8'));var fs=require('fs');var fs_extra=require(_0x1ee8('0x9'));var _=require(_0x1ee8('0xa'));var squel=require(_0x1ee8('0xb'));var crypto=require(_0x1ee8('0xc'));var jsforce=require(_0x1ee8('0xd'));var deskjs=require(_0x1ee8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ee8('0xf'));var Papa=require(_0x1ee8('0x10'));var Redis=require(_0x1ee8('0x11'));var authService=require(_0x1ee8('0x12'));var qs=require(_0x1ee8('0x13'));var as=require(_0x1ee8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ee8('0x15'))('api');var utils=require(_0x1ee8('0x16'));var config=require(_0x1ee8('0x17'));var licenseUtil=require(_0x1ee8('0x18'));var db=require(_0x1ee8('0x19'))['db'];var jayson=require(_0x1ee8('0x1a'));var client=jayson[_0x1ee8('0x1b')][_0x1ee8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x40110a,_0x1ca389,_0x43ea5a,_0x523a18){return new BPromise(function(_0x57427a,_0x26634e){var _0x36c5f7=_0x523a18||client;return _0x36c5f7[_0x1ee8('0x1d')](_0x40110a,_0x43ea5a)['then'](function(_0x5754d5){logger['info']('Setting,\x20%s,\x20%s',_0x1ca389,_0x1ee8('0x1e'));logger[_0x1ee8('0x1f')](_0x1ee8('0x20'),_0x1ca389,_0x1ee8('0x1e'),JSON[_0x1ee8('0x21')](_0x5754d5));if(_0x5754d5[_0x1ee8('0x22')]){if(_0x5754d5['error'][_0x1ee8('0x23')]===0x1f4){logger['error'](_0x1ee8('0x24'),_0x1ca389,_0x5754d5['error'][_0x1ee8('0x25')]);return _0x26634e(_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);}logger[_0x1ee8('0x22')](_0x1ee8('0x24'),_0x1ca389,_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);return _0x57427a(_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);}else{logger['info'](_0x1ee8('0x24'),_0x1ca389,_0x1ee8('0x1e'));_0x57427a(_0x5754d5[_0x1ee8('0x26')]['message']);}})[_0x1ee8('0x27')](function(_0x8371bb){logger[_0x1ee8('0x22')](_0x1ee8('0x24'),_0x1ca389,_0x8371bb);_0x26634e(_0x8371bb);});});}function respondWithStatusCode(_0x25dc72,_0x224d4a){_0x224d4a=_0x224d4a||0xcc;return function(_0x55b042){if(_0x55b042){return _0x25dc72[_0x1ee8('0x28')](_0x224d4a);}return _0x25dc72[_0x1ee8('0x29')](_0x224d4a)['end']();};}function respondWithResult(_0x26c5d4,_0x70e2e1){_0x70e2e1=_0x70e2e1||0xc8;return function(_0x11888c){if(_0x11888c){return _0x26c5d4['status'](_0x70e2e1)[_0x1ee8('0x2a')](_0x11888c);}};}function respondWithFilteredResult(_0x2d22eb,_0x38caff){return function(_0x38a2ee){if(_0x38a2ee){var _0x85b1d1=typeof _0x38caff[_0x1ee8('0x2b')]===_0x1ee8('0x2c')&&typeof _0x38caff[_0x1ee8('0x2d')]===_0x1ee8('0x2c');var _0x295e94=_0x38a2ee[_0x1ee8('0x2e')];var _0x60ca74=_0x85b1d1?0x0:_0x38caff[_0x1ee8('0x2b')];var _0x327485=_0x85b1d1?_0x38a2ee[_0x1ee8('0x2e')]:_0x38caff[_0x1ee8('0x2b')]+_0x38caff['limit'];var _0x4d0398;if(_0x327485>=_0x295e94){_0x327485=_0x295e94;_0x4d0398=0xc8;}else{_0x4d0398=0xce;}_0x2d22eb[_0x1ee8('0x29')](_0x4d0398);return _0x2d22eb['set'](_0x1ee8('0x2f'),_0x60ca74+'-'+_0x327485+'/'+_0x295e94)['json'](_0x38a2ee);}return null;};}function patchUpdates(_0x5f2aa1){return function(_0x71b1e8){try{jsonpatch[_0x1ee8('0x30')](_0x71b1e8,_0x5f2aa1,!![]);}catch(_0x2af208){return BPromise[_0x1ee8('0x31')](_0x2af208);}return _0x71b1e8[_0x1ee8('0x32')]();};}function saveUpdates(_0x4a7d3c,_0x35bf92){return function(_0x1e13f4){if(_0x1e13f4){return _0x1e13f4[_0x1ee8('0x33')](_0x4a7d3c)['then'](function(_0x4b23db){return _0x4b23db;});}return null;};}function removeEntity(_0x3c3f83,_0x41b1f7){return function(_0x61bf69){if(_0x61bf69){return _0x61bf69[_0x1ee8('0x34')]()['then'](function(){_0x3c3f83[_0x1ee8('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5431bb,_0x41a71a){return function(_0x375e72){if(!_0x375e72){_0x5431bb[_0x1ee8('0x28')](0x194);}return _0x375e72;};}function handleError(_0x5ba2d7,_0x1b7532){_0x1b7532=_0x1b7532||0x1f4;return function(_0x44d041){logger[_0x1ee8('0x22')](_0x44d041[_0x1ee8('0x35')]);if(_0x44d041['name']){delete _0x44d041[_0x1ee8('0x36')];}_0x5ba2d7[_0x1ee8('0x29')](_0x1b7532)[_0x1ee8('0x37')](_0x44d041);};}exports['index']=function(_0x51b935,_0x30047f){var _0x21a019={},_0x2667cd={},_0x28b6c9={'count':0x0,'rows':[]};var _0x41a1c4=_[_0x1ee8('0x38')](db[_0x1ee8('0x39')][_0x1ee8('0x3a')],function(_0x56095a){return{'name':_0x56095a[_0x1ee8('0x3b')],'type':_0x56095a[_0x1ee8('0x3c')][_0x1ee8('0x3d')]};});_0x2667cd[_0x1ee8('0x3e')]=_[_0x1ee8('0x38')](_0x41a1c4,_0x1ee8('0x36'));_0x2667cd['query']=_['keys'](_0x51b935[_0x1ee8('0x3f')]);_0x2667cd[_0x1ee8('0x40')]=_[_0x1ee8('0x41')](_0x2667cd[_0x1ee8('0x3e')],_0x2667cd[_0x1ee8('0x3f')]);_0x21a019[_0x1ee8('0x42')]=_[_0x1ee8('0x41')](_0x2667cd[_0x1ee8('0x3e')],qs[_0x1ee8('0x43')](_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x43')]));_0x21a019[_0x1ee8('0x42')]=_0x21a019['attributes']['length']?_0x21a019[_0x1ee8('0x42')]:_0x2667cd['model'];if(!_0x51b935['query']['hasOwnProperty'](_0x1ee8('0x44'))){_0x21a019['limit']=qs['limit'](_0x51b935[_0x1ee8('0x3f')]['limit']);_0x21a019[_0x1ee8('0x2b')]=qs[_0x1ee8('0x2b')](_0x51b935[_0x1ee8('0x3f')]['offset']);}_0x21a019[_0x1ee8('0x45')]=qs[_0x1ee8('0x46')](_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x46')]);_0x21a019[_0x1ee8('0x47')]=qs[_0x1ee8('0x40')](_[_0x1ee8('0x48')](_0x51b935[_0x1ee8('0x3f')],_0x2667cd['filters']),_0x41a1c4);if(_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x49')]){_0x21a019[_0x1ee8('0x47')]=_[_0x1ee8('0x4a')](_0x21a019[_0x1ee8('0x47')],{'$or':_[_0x1ee8('0x38')](_0x41a1c4,function(_0x927a7c){if(_0x927a7c[_0x1ee8('0x3c')]!==_0x1ee8('0x4b')){var _0x447663={};_0x447663[_0x927a7c['name']]={'$like':'%'+_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x49')]+'%'};return _0x447663;}})});}_0x21a019=_['merge']({},_0x21a019,_0x51b935[_0x1ee8('0x4c')]);var _0x56d49a={'where':_0x21a019[_0x1ee8('0x47')]};return db[_0x1ee8('0x39')][_0x1ee8('0x2e')](_0x56d49a)[_0x1ee8('0x4d')](function(_0x4d6ac7){_0x28b6c9['count']=_0x4d6ac7;if(_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x4e')]){_0x21a019['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x21a019);})['then'](function(_0x141d44){_0x28b6c9[_0x1ee8('0x4f')]=_0x141d44;return _0x28b6c9;})[_0x1ee8('0x4d')](respondWithFilteredResult(_0x30047f,_0x21a019))[_0x1ee8('0x27')](handleError(_0x30047f,null));};exports[_0x1ee8('0x50')]=function(_0x4bdcfc,_0x2085d9){var _0x4487ff={'raw':![],'where':{'id':_0x4bdcfc[_0x1ee8('0x51')]['id']}},_0x1ce1c4={};_0x1ce1c4[_0x1ee8('0x3e')]=_[_0x1ee8('0x52')](db[_0x1ee8('0x39')][_0x1ee8('0x3a')]);_0x1ce1c4['query']=_[_0x1ee8('0x52')](_0x4bdcfc[_0x1ee8('0x3f')]);_0x1ce1c4[_0x1ee8('0x40')]=_[_0x1ee8('0x41')](_0x1ce1c4[_0x1ee8('0x3e')],_0x1ce1c4[_0x1ee8('0x3f')]);_0x4487ff[_0x1ee8('0x42')]=_[_0x1ee8('0x41')](_0x1ce1c4[_0x1ee8('0x3e')],qs[_0x1ee8('0x43')](_0x4bdcfc['query'][_0x1ee8('0x43')]));_0x4487ff[_0x1ee8('0x42')]=_0x4487ff[_0x1ee8('0x42')][_0x1ee8('0x53')]?_0x4487ff[_0x1ee8('0x42')]:_0x1ce1c4[_0x1ee8('0x3e')];if(_0x4bdcfc[_0x1ee8('0x3f')][_0x1ee8('0x4e')]){_0x4487ff[_0x1ee8('0x54')]=[{'all':!![]}];}_0x4487ff=_['merge']({},_0x4487ff,_0x4bdcfc[_0x1ee8('0x4c')]);return db['Setting'][_0x1ee8('0x55')](_0x4487ff)['then'](handleEntityNotFound(_0x2085d9,null))[_0x1ee8('0x4d')](respondWithResult(_0x2085d9,null))[_0x1ee8('0x27')](handleError(_0x2085d9,null));};exports[_0x1ee8('0x33')]=function(_0x1094d6,_0x2e7466){if(_0x1094d6[_0x1ee8('0x56')]['id']){delete _0x1094d6[_0x1ee8('0x56')]['id'];}return db[_0x1ee8('0x39')]['find']({'where':{'id':_0x1094d6[_0x1ee8('0x51')]['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x2e7466,null))['then'](saveUpdates(_0x1094d6[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x2e7466,null))[_0x1ee8('0x27')](handleError(_0x2e7466,null));};exports[_0x1ee8('0x57')]=function(_0x6c5e3d,_0x12c755,_0x3514ca){if(_0x6c5e3d[_0x1ee8('0x58')]&&_0x6c5e3d[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0x6c5e3d[_0x1ee8('0x56')][_0x1ee8('0x5a')]=_0x6c5e3d['file'][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x6c5e3d['params']['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x12c755,null))[_0x1ee8('0x4d')](saveUpdates(_0x6c5e3d['body'],null))[_0x1ee8('0x4d')](respondWithResult(_0x12c755,null))[_0x1ee8('0x27')](handleError(_0x12c755,null));};exports['addLogoLogin']=function(_0x1e56bf,_0x3e7a26,_0x2e7612){if(_0x1e56bf[_0x1ee8('0x58')]&&_0x1e56bf[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0x1e56bf[_0x1ee8('0x56')][_0x1ee8('0x5b')]=_0x1e56bf[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x1e56bf['params']['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x3e7a26,null))[_0x1ee8('0x4d')](saveUpdates(_0x1e56bf[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x3e7a26,null))[_0x1ee8('0x27')](handleError(_0x3e7a26,null));};var utilLicense=require(_0x1ee8('0x18'));exports['getLogo']=function(_0x46202a,_0x405a7e,_0x21bee3){var _0xa3fab2=_0x1ee8('0x5c');var _0xb5a62d={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x13de81){if(_0x13de81){_0xb5a62d=_0x13de81;}return db['Setting'][_0x1ee8('0x55')]({'where':{'id':_0x46202a['params']['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x405a7e,null))[_0x1ee8('0x4d')](function(_0x1633c0){if(_0x1633c0){var _0x21b898=_0x1633c0[_0x1ee8('0x5a')]&&fs['existsSync'](path[_0x1ee8('0x61')](config['root'],_0xa3fab2,_[_0x1ee8('0x62')](_0x1633c0[_0x1ee8('0x5a')])))?path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_[_0x1ee8('0x62')](_0x1633c0[_0x1ee8('0x5a')])):path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_[_0x1ee8('0x62')]('default_logo.svg'));var _0x2b5cca=_0x1ee8('0x64')+_['upperFirst'](_0x1ee8('0x5a'));if(_0x1633c0[_0x2b5cca]||!_0xb5a62d[_0x1ee8('0x65')]){_0x21b898=path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_['toLower'](_0x1ee8('0x66')));}if(!fs['existsSync'](_0x21b898)){throw new db[(_0x1ee8('0x67'))]['ValidationError'](_[_0x1ee8('0x68')](_0x1ee8('0x5a'))+_0x1ee8('0x69'));}return _0x405a7e[_0x1ee8('0x6a')](_0x21b898);}})[_0x1ee8('0x27')](handleError(_0x405a7e,null));};var utilLicense=require(_0x1ee8('0x18'));exports['getLogoLogin']=function(_0x5c0d8e,_0x246f3b,_0x541136){var _0x1efe6f=_0x1ee8('0x5c');var _0x5d2633={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()['then'](function(_0x48de77){if(_0x48de77){_0x5d2633=_0x48de77;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x5c0d8e[_0x1ee8('0x51')]['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),_0x1ee8('0x6b'),'defaultLoginLogo',_0x1ee8('0x6c'),_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x246f3b,null))[_0x1ee8('0x4d')](function(_0x2b7d68){if(_0x2b7d68){var _0x500757=_0x2b7d68[_0x1ee8('0x5b')]&&fs[_0x1ee8('0x6d')](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x1efe6f,_[_0x1ee8('0x62')](_0x2b7d68[_0x1ee8('0x5b')])))?path[_0x1ee8('0x61')](config['root'],_0x1efe6f,_[_0x1ee8('0x62')](_0x2b7d68['loginLogo'])):path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x1efe6f,_[_0x1ee8('0x62')]('default_loginLogo.svg'));var _0x1e3a62=_0x1ee8('0x64')+_[_0x1ee8('0x68')](_0x1ee8('0x5b'));if(_0x2b7d68[_0x1e3a62]||!_0x5d2633[_0x1ee8('0x65')]){_0x500757=path['join'](config[_0x1ee8('0x63')],_0x1efe6f,_['toLower'](_0x1ee8('0x6e')));}if(!fs[_0x1ee8('0x6d')](_0x500757)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5b'))+_0x1ee8('0x69'));}return _0x246f3b[_0x1ee8('0x6a')](_0x500757);}})['catch'](handleError(_0x246f3b,null));};exports[_0x1ee8('0x70')]=function(_0x4953c2,_0x26fa9b){return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x4953c2['params']['id']},'attributes':[_0x1ee8('0x71')]})['then'](respondWithResult(_0x26fa9b,null))[_0x1ee8('0x27')](handleError(_0x26fa9b,null));};exports['addPreferred']=function(_0xf71d8f,_0x2bf3c4,_0x293338){if(_0xf71d8f['file']&&_0xf71d8f[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0xf71d8f[_0x1ee8('0x56')][_0x1ee8('0x5e')]=_0xf71d8f[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0xf71d8f[_0x1ee8('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bf3c4,null))['then'](saveUpdates(_0xf71d8f['body'],null))[_0x1ee8('0x4d')](respondWithResult(_0x2bf3c4,null))['catch'](handleError(_0x2bf3c4,null));};var utilLicense=require(_0x1ee8('0x18'));exports[_0x1ee8('0x72')]=function(_0x3408ea,_0x555eec,_0x4d0d1b){var _0x5112d1='server/files/images/logos';var _0x10079b={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x1056f3){if(_0x1056f3){_0x10079b=_0x1056f3;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x3408ea[_0x1ee8('0x51')]['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),'defaultLogo',_0x1ee8('0x73'),_0x1ee8('0x6c'),'defaultFavicon'],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x555eec,null))[_0x1ee8('0x4d')](function(_0x4bb765){if(_0x4bb765){var _0x1ee247=_0x4bb765['preferred']&&fs[_0x1ee8('0x6d')](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x5112d1,_[_0x1ee8('0x62')](_0x4bb765[_0x1ee8('0x5e')])))?path['join'](config['root'],_0x5112d1,_[_0x1ee8('0x62')](_0x4bb765['preferred'])):path[_0x1ee8('0x61')](config['root'],_0x5112d1,_['toLower'](_0x1ee8('0x74')));var _0x5b3645=_0x1ee8('0x64')+_['upperFirst'](_0x1ee8('0x5e'));if(_0x4bb765[_0x5b3645]||!_0x10079b[_0x1ee8('0x65')]||!_0x10079b[_0x1ee8('0x5e')]){_0x1ee247=path['join'](config[_0x1ee8('0x63')],_0x5112d1,_[_0x1ee8('0x62')]('default_preferred.png'));}if(!fs[_0x1ee8('0x6d')](_0x1ee247)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5e'))+_0x1ee8('0x69'));}return _0x555eec[_0x1ee8('0x6a')](_0x1ee247);}})[_0x1ee8('0x27')](handleError(_0x555eec,null));};exports[_0x1ee8('0x75')]=function(_0x4e0067,_0x4d3f43,_0x5bac10){if(_0x4e0067['file']&&_0x4e0067['file'][_0x1ee8('0x59')]){_0x4e0067['body']['favicon']=_0x4e0067[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db['Setting'][_0x1ee8('0x55')]({'where':{'id':_0x4e0067[_0x1ee8('0x51')]['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x4d3f43,null))[_0x1ee8('0x4d')](saveUpdates(_0x4e0067[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x4d3f43,null))['catch'](handleError(_0x4d3f43,null));};var utilLicense=require('../../config/license/util');exports[_0x1ee8('0x76')]=function(_0x279c90,_0x51a5dd,_0x144257){var _0x2750ca=_0x1ee8('0x5c');var _0x5d8c5e={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x24ba36){if(_0x24ba36){_0x5d8c5e=_0x24ba36;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x279c90[_0x1ee8('0x51')]['id']},'attributes':['logo','loginLogo','preferred',_0x1ee8('0x5f'),_0x1ee8('0x6b'),_0x1ee8('0x73'),_0x1ee8('0x6c'),_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x51a5dd,null))[_0x1ee8('0x4d')](function(_0x3ac2c2){if(_0x3ac2c2){var _0x33f7c2=_0x3ac2c2[_0x1ee8('0x5f')]&&fs['existsSync'](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x2750ca,_[_0x1ee8('0x62')](_0x3ac2c2[_0x1ee8('0x5f')])))?path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x2750ca,_[_0x1ee8('0x62')](_0x3ac2c2[_0x1ee8('0x5f')])):path[_0x1ee8('0x61')](config['root'],_0x2750ca,_[_0x1ee8('0x62')](_0x1ee8('0x77')));var _0x10d5eb=_0x1ee8('0x64')+_[_0x1ee8('0x68')](_0x1ee8('0x5f'));if(_0x3ac2c2[_0x10d5eb]||!_0x5d8c5e[_0x1ee8('0x65')]){_0x33f7c2=path['join'](config['root'],_0x2750ca,_[_0x1ee8('0x62')](_0x1ee8('0x77')));}if(!fs[_0x1ee8('0x6d')](_0x33f7c2)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5f'))+_0x1ee8('0x69'));}return _0x51a5dd['download'](_0x33f7c2);}})[_0x1ee8('0x27')](handleError(_0x51a5dd,null));};exports[_0x1ee8('0x78')]=function(_0x45d0e6,_0x481945){var _0x389c96={'offset':moment()[_0x1ee8('0x79')]()};_0x389c96['now']=moment()[_0x1ee8('0x79')](_0x389c96[_0x1ee8('0x2b')])['format'](_0x1ee8('0x7a'));return _0x481945[_0x1ee8('0x29')](0xc8)['send'](_0x389c96);}; \ No newline at end of file +var _0x9ac8=['filename','logo','../../config/license/util','server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default','upperFirst','custom','default_logo.svg','Sequelize','download','getLogoLogin','getLicense','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','rows','params','length','find','body','addLogo','file'];(function(_0x6a739f,_0x15b3ee){var _0x18016e=function(_0xb2b058){while(--_0xb2b058){_0x6a739f['push'](_0x6a739f['shift']());}};_0x18016e(++_0x15b3ee);}(_0x9ac8,0x184));var _0x89ac=function(_0x4f1323,_0x2e6874){_0x4f1323=_0x4f1323-0x0;var _0x1f32e8=_0x9ac8[_0x4f1323];return _0x1f32e8;};'use strict';var emlformat=require(_0x89ac('0x0'));var rimraf=require(_0x89ac('0x1'));var zipdir=require(_0x89ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89ac('0x3'));var moment=require(_0x89ac('0x4'));var BPromise=require(_0x89ac('0x5'));var Mustache=require(_0x89ac('0x6'));var util=require(_0x89ac('0x7'));var path=require(_0x89ac('0x8'));var sox=require('sox');var csv=require(_0x89ac('0x9'));var ejs=require(_0x89ac('0xa'));var fs=require('fs');var fs_extra=require(_0x89ac('0xb'));var _=require(_0x89ac('0xc'));var squel=require(_0x89ac('0xd'));var crypto=require(_0x89ac('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x89ac('0xf'));var toCsv=require(_0x89ac('0x9'));var querystring=require('querystring');var Papa=require(_0x89ac('0x10'));var Redis=require('ioredis');var authService=require(_0x89ac('0x11'));var qs=require(_0x89ac('0x12'));var as=require(_0x89ac('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89ac('0x14'))(_0x89ac('0x15'));var utils=require('../../config/utils');var config=require(_0x89ac('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x89ac('0x17'))['db'];var jayson=require(_0x89ac('0x18'));var client=jayson[_0x89ac('0x19')][_0x89ac('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x343e52,_0x197385,_0x550581,_0x1ef479){return new BPromise(function(_0x1ccc37,_0x11c870){var _0x2e91e5=_0x1ef479||client;return _0x2e91e5[_0x89ac('0x1b')](_0x343e52,_0x550581)[_0x89ac('0x1c')](function(_0x320b0a){logger[_0x89ac('0x1d')]('Setting,\x20%s,\x20%s',_0x197385,'request\x20sent');logger[_0x89ac('0x1e')](_0x89ac('0x1f'),_0x197385,_0x89ac('0x20'),JSON[_0x89ac('0x21')](_0x320b0a));if(_0x320b0a[_0x89ac('0x22')]){if(_0x320b0a['error'][_0x89ac('0x23')]===0x1f4){logger[_0x89ac('0x22')](_0x89ac('0x24'),_0x197385,_0x320b0a[_0x89ac('0x22')][_0x89ac('0x25')]);return _0x11c870(_0x320b0a[_0x89ac('0x22')][_0x89ac('0x25')]);}logger[_0x89ac('0x22')](_0x89ac('0x24'),_0x197385,_0x320b0a[_0x89ac('0x22')][_0x89ac('0x25')]);return _0x1ccc37(_0x320b0a[_0x89ac('0x22')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x197385,_0x89ac('0x20'));_0x1ccc37(_0x320b0a['result'][_0x89ac('0x25')]);}})[_0x89ac('0x26')](function(_0x22e1dd){logger[_0x89ac('0x22')](_0x89ac('0x24'),_0x197385,_0x22e1dd);_0x11c870(_0x22e1dd);});});}function respondWithStatusCode(_0x2944d2,_0x5e35d8){_0x5e35d8=_0x5e35d8||0xcc;return function(_0x1849a2){if(_0x1849a2){return _0x2944d2[_0x89ac('0x27')](_0x5e35d8);}return _0x2944d2['status'](_0x5e35d8)[_0x89ac('0x28')]();};}function respondWithResult(_0x6a62ef,_0x1874d2){_0x1874d2=_0x1874d2||0xc8;return function(_0x2cf32f){if(_0x2cf32f){return _0x6a62ef[_0x89ac('0x29')](_0x1874d2)[_0x89ac('0x2a')](_0x2cf32f);}};}function respondWithFilteredResult(_0x225a2a,_0x3ba636){return function(_0x4c6681){if(_0x4c6681){var _0x19955f=typeof _0x3ba636[_0x89ac('0x2b')]===_0x89ac('0x2c')&&typeof _0x3ba636[_0x89ac('0x2d')]==='undefined';var _0x57c844=_0x4c6681[_0x89ac('0x2e')];var _0x5cfac8=_0x19955f?0x0:_0x3ba636['offset'];var _0x2f71ca=_0x19955f?_0x4c6681[_0x89ac('0x2e')]:_0x3ba636['offset']+_0x3ba636[_0x89ac('0x2d')];var _0xc0f03;if(_0x2f71ca>=_0x57c844){_0x2f71ca=_0x57c844;_0xc0f03=0xc8;}else{_0xc0f03=0xce;}_0x225a2a[_0x89ac('0x29')](_0xc0f03);return _0x225a2a[_0x89ac('0x2f')](_0x89ac('0x30'),_0x5cfac8+'-'+_0x2f71ca+'/'+_0x57c844)[_0x89ac('0x2a')](_0x4c6681);}return null;};}function patchUpdates(_0x112d7c){return function(_0x3b251f){try{jsonpatch[_0x89ac('0x31')](_0x3b251f,_0x112d7c,!![]);}catch(_0x227314){return BPromise[_0x89ac('0x32')](_0x227314);}return _0x3b251f[_0x89ac('0x33')]();};}function saveUpdates(_0x5374cb,_0x2d58e2){return function(_0x3afe15){if(_0x3afe15){return _0x3afe15[_0x89ac('0x34')](_0x5374cb)[_0x89ac('0x1c')](function(_0x44fe2c){return _0x44fe2c;});}return null;};}function removeEntity(_0x4e99b5,_0x3c7df5){return function(_0x3a2924){if(_0x3a2924){return _0x3a2924[_0x89ac('0x35')]()['then'](function(){_0x4e99b5[_0x89ac('0x29')](0xcc)[_0x89ac('0x28')]();});}};}function handleEntityNotFound(_0x521278,_0x12e1ff){return function(_0xd30ad0){if(!_0xd30ad0){_0x521278[_0x89ac('0x27')](0x194);}return _0xd30ad0;};}function handleError(_0x25ad14,_0x21ba79){_0x21ba79=_0x21ba79||0x1f4;return function(_0x25a7c4){logger['error'](_0x25a7c4[_0x89ac('0x36')]);if(_0x25a7c4[_0x89ac('0x37')]){delete _0x25a7c4[_0x89ac('0x37')];}_0x25ad14[_0x89ac('0x29')](_0x21ba79)[_0x89ac('0x38')](_0x25a7c4);};}exports[_0x89ac('0x39')]=function(_0x3f5fbe,_0x30c03d){var _0x3d240b={},_0x332744={},_0x51de01={'count':0x0,'rows':[]};var _0x2bcb59=_[_0x89ac('0x3a')](db[_0x89ac('0x3b')][_0x89ac('0x3c')],function(_0x4e1f30){return{'name':_0x4e1f30['fieldName'],'type':_0x4e1f30[_0x89ac('0x3d')]['key']};});_0x332744[_0x89ac('0x3e')]=_[_0x89ac('0x3a')](_0x2bcb59,_0x89ac('0x37'));_0x332744[_0x89ac('0x3f')]=_[_0x89ac('0x40')](_0x3f5fbe[_0x89ac('0x3f')]);_0x332744[_0x89ac('0x41')]=_[_0x89ac('0x42')](_0x332744[_0x89ac('0x3e')],_0x332744[_0x89ac('0x3f')]);_0x3d240b[_0x89ac('0x43')]=_[_0x89ac('0x42')](_0x332744['model'],qs[_0x89ac('0x44')](_0x3f5fbe[_0x89ac('0x3f')]['fields']));_0x3d240b['attributes']=_0x3d240b[_0x89ac('0x43')]['length']?_0x3d240b[_0x89ac('0x43')]:_0x332744[_0x89ac('0x3e')];if(!_0x3f5fbe['query'][_0x89ac('0x45')](_0x89ac('0x46'))){_0x3d240b[_0x89ac('0x2d')]=qs[_0x89ac('0x2d')](_0x3f5fbe[_0x89ac('0x3f')][_0x89ac('0x2d')]);_0x3d240b['offset']=qs[_0x89ac('0x2b')](_0x3f5fbe[_0x89ac('0x3f')]['offset']);}_0x3d240b[_0x89ac('0x47')]=qs['sort'](_0x3f5fbe[_0x89ac('0x3f')][_0x89ac('0x48')]);_0x3d240b['where']=qs[_0x89ac('0x41')](_['pick'](_0x3f5fbe[_0x89ac('0x3f')],_0x332744[_0x89ac('0x41')]),_0x2bcb59);if(_0x3f5fbe[_0x89ac('0x3f')][_0x89ac('0x49')]){_0x3d240b['where']=_[_0x89ac('0x4a')](_0x3d240b[_0x89ac('0x4b')],{'$or':_[_0x89ac('0x3a')](_0x2bcb59,function(_0x24b351){if(_0x24b351[_0x89ac('0x3d')]!=='VIRTUAL'){var _0x42a9b0={};_0x42a9b0[_0x24b351[_0x89ac('0x37')]]={'$like':'%'+_0x3f5fbe['query'][_0x89ac('0x49')]+'%'};return _0x42a9b0;}})});}_0x3d240b=_[_0x89ac('0x4a')]({},_0x3d240b,_0x3f5fbe[_0x89ac('0x4c')]);var _0x21f060={'where':_0x3d240b[_0x89ac('0x4b')]};return db[_0x89ac('0x3b')][_0x89ac('0x2e')](_0x21f060)[_0x89ac('0x1c')](function(_0x4136fd){_0x51de01[_0x89ac('0x2e')]=_0x4136fd;if(_0x3f5fbe[_0x89ac('0x3f')]['includeAll']){_0x3d240b['include']=[{'all':!![]}];}return db[_0x89ac('0x3b')]['findAll'](_0x3d240b);})[_0x89ac('0x1c')](function(_0x1c4d6c){_0x51de01[_0x89ac('0x4d')]=_0x1c4d6c;return _0x51de01;})[_0x89ac('0x1c')](respondWithFilteredResult(_0x30c03d,_0x3d240b))[_0x89ac('0x26')](handleError(_0x30c03d,null));};exports['show']=function(_0x373a2a,_0x152ad9){var _0x2669d5={'raw':![],'where':{'id':_0x373a2a[_0x89ac('0x4e')]['id']}},_0xcf1d4d={};_0xcf1d4d[_0x89ac('0x3e')]=_[_0x89ac('0x40')](db[_0x89ac('0x3b')][_0x89ac('0x3c')]);_0xcf1d4d['query']=_['keys'](_0x373a2a['query']);_0xcf1d4d[_0x89ac('0x41')]=_['intersection'](_0xcf1d4d[_0x89ac('0x3e')],_0xcf1d4d[_0x89ac('0x3f')]);_0x2669d5[_0x89ac('0x43')]=_['intersection'](_0xcf1d4d['model'],qs[_0x89ac('0x44')](_0x373a2a[_0x89ac('0x3f')][_0x89ac('0x44')]));_0x2669d5['attributes']=_0x2669d5[_0x89ac('0x43')][_0x89ac('0x4f')]?_0x2669d5[_0x89ac('0x43')]:_0xcf1d4d['model'];if(_0x373a2a[_0x89ac('0x3f')]['includeAll']){_0x2669d5['include']=[{'all':!![]}];}_0x2669d5=_['merge']({},_0x2669d5,_0x373a2a['options']);return db[_0x89ac('0x3b')][_0x89ac('0x50')](_0x2669d5)[_0x89ac('0x1c')](handleEntityNotFound(_0x152ad9,null))[_0x89ac('0x1c')](respondWithResult(_0x152ad9,null))[_0x89ac('0x26')](handleError(_0x152ad9,null));};exports[_0x89ac('0x34')]=function(_0x3e07a8,_0x208024){if(_0x3e07a8[_0x89ac('0x51')]['id']){delete _0x3e07a8[_0x89ac('0x51')]['id'];}return db[_0x89ac('0x3b')]['find']({'where':{'id':_0x3e07a8[_0x89ac('0x4e')]['id']}})[_0x89ac('0x1c')](handleEntityNotFound(_0x208024,null))['then'](saveUpdates(_0x3e07a8['body'],null))['then'](respondWithResult(_0x208024,null))[_0x89ac('0x26')](handleError(_0x208024,null));};exports[_0x89ac('0x52')]=function(_0x2478e0,_0x6ab147,_0x33cefa){if(_0x2478e0[_0x89ac('0x53')]&&_0x2478e0['file'][_0x89ac('0x54')]){_0x2478e0['body'][_0x89ac('0x55')]=_0x2478e0['file'][_0x89ac('0x54')];}return db['Setting'][_0x89ac('0x50')]({'where':{'id':_0x2478e0[_0x89ac('0x4e')]['id']}})[_0x89ac('0x1c')](handleEntityNotFound(_0x6ab147,null))['then'](saveUpdates(_0x2478e0[_0x89ac('0x51')],null))['then'](respondWithResult(_0x6ab147,null))[_0x89ac('0x26')](handleError(_0x6ab147,null));};exports['addLogoLogin']=function(_0x51a17b,_0x32cc3f,_0x90acdc){if(_0x51a17b[_0x89ac('0x53')]&&_0x51a17b['file'][_0x89ac('0x54')]){_0x51a17b[_0x89ac('0x51')]['loginLogo']=_0x51a17b['file'][_0x89ac('0x54')];}return db['Setting'][_0x89ac('0x50')]({'where':{'id':_0x51a17b[_0x89ac('0x4e')]['id']}})[_0x89ac('0x1c')](handleEntityNotFound(_0x32cc3f,null))[_0x89ac('0x1c')](saveUpdates(_0x51a17b['body'],null))['then'](respondWithResult(_0x32cc3f,null))[_0x89ac('0x26')](handleError(_0x32cc3f,null));};var utilLicense=require(_0x89ac('0x56'));exports['getLogo']=function(_0x14523b,_0x55d6da,_0x11634f){var _0x20fe02=_0x89ac('0x57');var _0x255c58={'custom':![]};return utilLicense['getLicense']()[_0x89ac('0x1c')](function(_0x5f2f0d){if(_0x5f2f0d){_0x255c58=_0x5f2f0d;}return db[_0x89ac('0x3b')]['find']({'where':{'id':_0x14523b[_0x89ac('0x4e')]['id']},'attributes':[_0x89ac('0x55'),_0x89ac('0x58'),_0x89ac('0x59'),_0x89ac('0x5a'),_0x89ac('0x5b'),_0x89ac('0x5c'),_0x89ac('0x5d'),_0x89ac('0x5e')],'raw':!![]});})[_0x89ac('0x1c')](handleEntityNotFound(_0x55d6da,null))[_0x89ac('0x1c')](function(_0x4fd15f){if(_0x4fd15f){var _0x5c94d5=_0x4fd15f[_0x89ac('0x55')]&&fs[_0x89ac('0x5f')](path['join'](config[_0x89ac('0x60')],_0x20fe02,_[_0x89ac('0x61')](_0x4fd15f['logo'])))?path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x20fe02,_[_0x89ac('0x61')](_0x4fd15f['logo'])):path['join'](config[_0x89ac('0x60')],_0x20fe02,_[_0x89ac('0x61')]('default_logo.svg'));var _0x5e9504=_0x89ac('0x63')+_[_0x89ac('0x64')](_0x89ac('0x55'));if(_0x4fd15f[_0x5e9504]||!_0x255c58[_0x89ac('0x65')]){_0x5c94d5=path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x20fe02,_[_0x89ac('0x61')](_0x89ac('0x66')));}if(!fs[_0x89ac('0x5f')](_0x5c94d5)){throw new db[(_0x89ac('0x67'))]['ValidationError'](_[_0x89ac('0x64')](_0x89ac('0x55'))+'\x20not\x20found');}return _0x55d6da[_0x89ac('0x68')](_0x5c94d5);}})[_0x89ac('0x26')](handleError(_0x55d6da,null));};var utilLicense=require(_0x89ac('0x56'));exports[_0x89ac('0x69')]=function(_0x28f1b1,_0x57b9e9,_0x215341){var _0x50831f=_0x89ac('0x57');var _0x5f3f80={'custom':![]};return utilLicense[_0x89ac('0x6a')]()[_0x89ac('0x1c')](function(_0xb5818a){if(_0xb5818a){_0x5f3f80=_0xb5818a;}return db[_0x89ac('0x3b')][_0x89ac('0x50')]({'where':{'id':_0x28f1b1[_0x89ac('0x4e')]['id']},'attributes':[_0x89ac('0x55'),'loginLogo','preferred',_0x89ac('0x5a'),_0x89ac('0x5b'),'defaultLoginLogo',_0x89ac('0x5d'),_0x89ac('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x57b9e9,null))[_0x89ac('0x1c')](function(_0x23d4aa){if(_0x23d4aa){var _0x2a50b5=_0x23d4aa['loginLogo']&&fs['existsSync'](path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x50831f,_[_0x89ac('0x61')](_0x23d4aa[_0x89ac('0x58')])))?path[_0x89ac('0x62')](config['root'],_0x50831f,_[_0x89ac('0x61')](_0x23d4aa[_0x89ac('0x58')])):path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x50831f,_['toLower']('default_loginLogo.svg'));var _0xeefc50=_0x89ac('0x63')+_['upperFirst']('loginLogo');if(_0x23d4aa[_0xeefc50]||!_0x5f3f80['custom']){_0x2a50b5=path['join'](config[_0x89ac('0x60')],_0x50831f,_[_0x89ac('0x61')](_0x89ac('0x6b')));}if(!fs['existsSync'](_0x2a50b5)){throw new db[(_0x89ac('0x67'))]['ValidationError'](_['upperFirst'](_0x89ac('0x58'))+_0x89ac('0x6c'));}return _0x57b9e9[_0x89ac('0x68')](_0x2a50b5);}})['catch'](handleError(_0x57b9e9,null));};exports[_0x89ac('0x6d')]=function(_0x4485e9,_0x1bddb4){return db[_0x89ac('0x3b')][_0x89ac('0x50')]({'where':{'id':_0x4485e9['params']['id']},'attributes':[_0x89ac('0x6e')]})['then'](respondWithResult(_0x1bddb4,null))[_0x89ac('0x26')](handleError(_0x1bddb4,null));};exports[_0x89ac('0x6f')]=function(_0x20e5a7,_0x311880,_0x4ffc11){if(_0x20e5a7[_0x89ac('0x53')]&&_0x20e5a7[_0x89ac('0x53')]['filename']){_0x20e5a7[_0x89ac('0x51')][_0x89ac('0x59')]=_0x20e5a7[_0x89ac('0x53')]['filename'];}return db['Setting']['find']({'where':{'id':_0x20e5a7[_0x89ac('0x4e')]['id']}})[_0x89ac('0x1c')](handleEntityNotFound(_0x311880,null))[_0x89ac('0x1c')](saveUpdates(_0x20e5a7[_0x89ac('0x51')],null))[_0x89ac('0x1c')](respondWithResult(_0x311880,null))[_0x89ac('0x26')](handleError(_0x311880,null));};var utilLicense=require(_0x89ac('0x56'));exports['getPreferred']=function(_0x5b1f67,_0x53f6a0,_0x1096fb){var _0x299c5e='server/files/images/logos';var _0x541c97={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4b4a47){if(_0x4b4a47){_0x541c97=_0x4b4a47;}return db['Setting'][_0x89ac('0x50')]({'where':{'id':_0x5b1f67[_0x89ac('0x4e')]['id']},'attributes':[_0x89ac('0x55'),_0x89ac('0x58'),_0x89ac('0x59'),_0x89ac('0x5a'),_0x89ac('0x5b'),'defaultLoginLogo',_0x89ac('0x5d'),_0x89ac('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x53f6a0,null))['then'](function(_0x212e29){if(_0x212e29){var _0x52f565=_0x212e29[_0x89ac('0x59')]&&fs[_0x89ac('0x5f')](path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x299c5e,_[_0x89ac('0x61')](_0x212e29['preferred'])))?path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x299c5e,_[_0x89ac('0x61')](_0x212e29[_0x89ac('0x59')])):path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x299c5e,_[_0x89ac('0x61')]('default_preferred.png'));var _0x137e20=_0x89ac('0x63')+_[_0x89ac('0x64')]('preferred');if(_0x212e29[_0x137e20]||!_0x541c97['custom']||!_0x541c97[_0x89ac('0x59')]){_0x52f565=path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x299c5e,_[_0x89ac('0x61')](_0x89ac('0x70')));}if(!fs[_0x89ac('0x5f')](_0x52f565)){throw new db[(_0x89ac('0x67'))]['ValidationError'](_['upperFirst'](_0x89ac('0x59'))+'\x20not\x20found');}return _0x53f6a0['download'](_0x52f565);}})[_0x89ac('0x26')](handleError(_0x53f6a0,null));};exports[_0x89ac('0x71')]=function(_0x5a9070,_0x58b230,_0x482b4a){if(_0x5a9070[_0x89ac('0x53')]&&_0x5a9070[_0x89ac('0x53')][_0x89ac('0x54')]){_0x5a9070[_0x89ac('0x51')][_0x89ac('0x5a')]=_0x5a9070[_0x89ac('0x53')]['filename'];}return db[_0x89ac('0x3b')][_0x89ac('0x50')]({'where':{'id':_0x5a9070[_0x89ac('0x4e')]['id']}})[_0x89ac('0x1c')](handleEntityNotFound(_0x58b230,null))[_0x89ac('0x1c')](saveUpdates(_0x5a9070['body'],null))[_0x89ac('0x1c')](respondWithResult(_0x58b230,null))[_0x89ac('0x26')](handleError(_0x58b230,null));};var utilLicense=require(_0x89ac('0x56'));exports[_0x89ac('0x72')]=function(_0x1c4da4,_0x3993e3,_0xf96517){var _0x327326=_0x89ac('0x57');var _0x1086b9={'custom':![]};return utilLicense[_0x89ac('0x6a')]()['then'](function(_0x12c269){if(_0x12c269){_0x1086b9=_0x12c269;}return db[_0x89ac('0x3b')][_0x89ac('0x50')]({'where':{'id':_0x1c4da4['params']['id']},'attributes':[_0x89ac('0x55'),_0x89ac('0x58'),_0x89ac('0x59'),_0x89ac('0x5a'),'defaultLogo',_0x89ac('0x5c'),_0x89ac('0x5d'),_0x89ac('0x5e')],'raw':!![]});})[_0x89ac('0x1c')](handleEntityNotFound(_0x3993e3,null))[_0x89ac('0x1c')](function(_0x3b6f4f){if(_0x3b6f4f){var _0x2eb5b2=_0x3b6f4f[_0x89ac('0x5a')]&&fs[_0x89ac('0x5f')](path['join'](config[_0x89ac('0x60')],_0x327326,_['toLower'](_0x3b6f4f[_0x89ac('0x5a')])))?path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x327326,_[_0x89ac('0x61')](_0x3b6f4f[_0x89ac('0x5a')])):path['join'](config['root'],_0x327326,_[_0x89ac('0x61')](_0x89ac('0x73')));var _0x3c631f='default'+_[_0x89ac('0x64')]('favicon');if(_0x3b6f4f[_0x3c631f]||!_0x1086b9['custom']){_0x2eb5b2=path[_0x89ac('0x62')](config[_0x89ac('0x60')],_0x327326,_[_0x89ac('0x61')](_0x89ac('0x73')));}if(!fs[_0x89ac('0x5f')](_0x2eb5b2)){throw new db[(_0x89ac('0x67'))]['ValidationError'](_['upperFirst'](_0x89ac('0x5a'))+_0x89ac('0x6c'));}return _0x3993e3[_0x89ac('0x68')](_0x2eb5b2);}})['catch'](handleError(_0x3993e3,null));};exports['getDate']=function(_0x409ff7,_0x287df3){var _0x351812={'offset':moment()[_0x89ac('0x74')]()};_0x351812['now']=moment()[_0x89ac('0x74')](_0x351812[_0x89ac('0x2b')])['format'](_0x89ac('0x75'));return _0x287df3[_0x89ac('0x29')](0xc8)[_0x89ac('0x38')](_0x351812);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 07c484d..e5316ff 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x25e4a3,_0x1d69a7){var _0x85e43f=function(_0x49e695){while(--_0x49e695){_0x25e4a3['push'](_0x25e4a3['shift']());}};_0x85e43f(++_0x1d69a7);}(_0xedd9,0xfc));var _0x9edd=function(_0x5f09cb,_0x3118f1){_0x5f09cb=_0x5f09cb-0x0;var _0x3cbe10=_0xedd9[_0x5f09cb];return _0x3cbe10;};'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 +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x578694,_0x11899f){var _0x202647=function(_0x642424){while(--_0x642424){_0x578694['push'](_0x578694['shift']());}};_0x202647(++_0x11899f);}(_0xe14b,0x93));var _0xbe14=function(_0x1f50a4,_0x411340){_0x1f50a4=_0x1f50a4-0x0;var _0x45738c=_0xe14b[_0x1f50a4];return _0x45738c;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index cecb22e..0bf9bbe 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 _0xbcf3=['error','code','message','result','catch','ShowSetting','Setting','find','options','where','include','map','model','attributes','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f1a27,_0x18eceb){var _0x3d454e=function(_0x57d889){while(--_0x57d889){_0x1f1a27['push'](_0x1f1a27['shift']());}};_0x3d454e(++_0x18eceb);}(_0xbcf3,0x1ee));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3bcf('0x0'));var moment=require(_0x3bcf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bcf('0x2'))['db'];var utils=require(_0x3bcf('0x3'));var logger=require(_0x3bcf('0x4'))(_0x3bcf('0x5'));var config=require(_0x3bcf('0x6'));var jayson=require(_0x3bcf('0x7'));var client=jayson[_0x3bcf('0x8')][_0x3bcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17676b,_0x2200d2,_0x1885af){return new BPromise(function(_0x2247a,_0x4c6c1d){return client[_0x3bcf('0xa')](_0x17676b,_0x1885af)[_0x3bcf('0xb')](function(_0x5f1f8b){logger[_0x3bcf('0xc')](_0x3bcf('0xd'),_0x2200d2,_0x3bcf('0xe'));logger[_0x3bcf('0xf')](_0x3bcf('0x10'),_0x2200d2,_0x3bcf('0xe'),JSON[_0x3bcf('0x11')](_0x5f1f8b));if(_0x5f1f8b[_0x3bcf('0x12')]){if(_0x5f1f8b['error'][_0x3bcf('0x13')]===0x1f4){logger[_0x3bcf('0x12')](_0x3bcf('0xd'),_0x2200d2,_0x5f1f8b[_0x3bcf('0x12')]['message']);return _0x4c6c1d(_0x5f1f8b[_0x3bcf('0x12')][_0x3bcf('0x14')]);}logger[_0x3bcf('0x12')](_0x3bcf('0xd'),_0x2200d2,_0x5f1f8b[_0x3bcf('0x12')][_0x3bcf('0x14')]);return _0x2247a(_0x5f1f8b['error'][_0x3bcf('0x14')]);}else{logger['info'](_0x3bcf('0xd'),_0x2200d2,'request\x20sent');_0x2247a(_0x5f1f8b[_0x3bcf('0x15')][_0x3bcf('0x14')]);}})[_0x3bcf('0x16')](function(_0x2a89b6){logger[_0x3bcf('0x12')](_0x3bcf('0xd'),_0x2200d2,_0x2a89b6);_0x4c6c1d(_0x2a89b6);});});}exports[_0x3bcf('0x17')]=function(_0x286d5e){var _0x53aee1=this;return new Promise(function(_0x15b70b,_0x158420){return db[_0x3bcf('0x18')][_0x3bcf('0x19')]({'raw':_0x286d5e[_0x3bcf('0x1a')]?_0x286d5e['options']['raw']===undefined?!![]:![]:!![],'where':_0x286d5e[_0x3bcf('0x1a')]?_0x286d5e[_0x3bcf('0x1a')][_0x3bcf('0x1b')]||null:null,'attributes':_0x286d5e[_0x3bcf('0x1a')]?_0x286d5e[_0x3bcf('0x1a')]['attributes']||null:null,'include':_0x286d5e[_0x3bcf('0x1a')]?_0x286d5e['options'][_0x3bcf('0x1c')]?_[_0x3bcf('0x1d')](_0x286d5e[_0x3bcf('0x1a')][_0x3bcf('0x1c')],function(_0x53bc2f){return{'model':db[_0x53bc2f[_0x3bcf('0x1e')]],'as':_0x53bc2f['as'],'attributes':_0x53bc2f[_0x3bcf('0x1f')],'include':_0x53bc2f[_0x3bcf('0x1c')]?_[_0x3bcf('0x1d')](_0x53bc2f[_0x3bcf('0x1c')],function(_0x11aa4f){return{'model':db[_0x11aa4f[_0x3bcf('0x1e')]],'as':_0x11aa4f['as'],'attributes':_0x11aa4f['attributes'],'include':_0x11aa4f['include']?_['map'](_0x11aa4f[_0x3bcf('0x1c')],function(_0x2129cc){return{'model':db[_0x2129cc[_0x3bcf('0x1e')]],'as':_0x2129cc['as'],'attributes':_0x2129cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x3bcf('0xb')](function(_0x36daf7){logger[_0x3bcf('0xc')]('ShowSetting',_0x286d5e);logger['debug']('ShowSetting',_0x286d5e,JSON[_0x3bcf('0x11')](_0x36daf7));_0x15b70b(_0x36daf7);})[_0x3bcf('0x16')](function(_0xeb952a){logger[_0x3bcf('0x12')](_0x3bcf('0x17'),_0xeb952a[_0x3bcf('0x14')],_0x286d5e);_0x158420(_0x53aee1[_0x3bcf('0x12')](0x1f4,_0xeb952a[_0x3bcf('0x14')]));});});}; \ No newline at end of file +var _0xc798=['map','then','lodash','util','moment','../../config/logger','rpc','jayson/promise','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include'];(function(_0x492b0b,_0x3e5d7a){var _0x4fb79c=function(_0xd2776f){while(--_0xd2776f){_0x492b0b['push'](_0x492b0b['shift']());}};_0x4fb79c(++_0x3e5d7a);}(_0xc798,0xaa));var _0x8c79=function(_0x43cb7e,_0x13b717){_0x43cb7e=_0x43cb7e-0x0;var _0x31b9a7=_0xc798[_0x43cb7e];return _0x31b9a7;};'use strict';var _=require(_0x8c79('0x0'));var util=require(_0x8c79('0x1'));var moment=require(_0x8c79('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c79('0x3'))(_0x8c79('0x4'));var config=require('../../config/environment');var jayson=require(_0x8c79('0x5'));var client=jayson['client'][_0x8c79('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4aad86,_0x4c123a,_0x11e795){return new BPromise(function(_0x18ccd1,_0x5d7f63){return client['request'](_0x4aad86,_0x11e795)['then'](function(_0x2f14ff){logger[_0x8c79('0x7')](_0x8c79('0x8'),_0x4c123a,_0x8c79('0x9'));logger[_0x8c79('0xa')](_0x8c79('0xb'),_0x4c123a,_0x8c79('0x9'),JSON[_0x8c79('0xc')](_0x2f14ff));if(_0x2f14ff[_0x8c79('0xd')]){if(_0x2f14ff[_0x8c79('0xd')][_0x8c79('0xe')]===0x1f4){logger[_0x8c79('0xd')]('Setting,\x20%s,\x20%s',_0x4c123a,_0x2f14ff[_0x8c79('0xd')][_0x8c79('0xf')]);return _0x5d7f63(_0x2f14ff[_0x8c79('0xd')][_0x8c79('0xf')]);}logger['error'](_0x8c79('0x8'),_0x4c123a,_0x2f14ff[_0x8c79('0xd')][_0x8c79('0xf')]);return _0x18ccd1(_0x2f14ff[_0x8c79('0xd')][_0x8c79('0xf')]);}else{logger[_0x8c79('0x7')](_0x8c79('0x8'),_0x4c123a,_0x8c79('0x9'));_0x18ccd1(_0x2f14ff[_0x8c79('0x10')][_0x8c79('0xf')]);}})[_0x8c79('0x11')](function(_0x429474){logger[_0x8c79('0xd')](_0x8c79('0x8'),_0x4c123a,_0x429474);_0x5d7f63(_0x429474);});});}exports[_0x8c79('0x12')]=function(_0x5af162){var _0x44a0cd=this;return new Promise(function(_0x89d662,_0x4fe577){return db[_0x8c79('0x13')][_0x8c79('0x14')]({'raw':_0x5af162[_0x8c79('0x15')]?_0x5af162[_0x8c79('0x15')][_0x8c79('0x16')]===undefined?!![]:![]:!![],'where':_0x5af162[_0x8c79('0x15')]?_0x5af162[_0x8c79('0x15')][_0x8c79('0x17')]||null:null,'attributes':_0x5af162['options']?_0x5af162[_0x8c79('0x15')][_0x8c79('0x18')]||null:null,'include':_0x5af162[_0x8c79('0x15')]?_0x5af162[_0x8c79('0x15')][_0x8c79('0x19')]?_[_0x8c79('0x1a')](_0x5af162[_0x8c79('0x15')][_0x8c79('0x19')],function(_0x33ef90){return{'model':db[_0x33ef90['model']],'as':_0x33ef90['as'],'attributes':_0x33ef90['attributes'],'include':_0x33ef90[_0x8c79('0x19')]?_['map'](_0x33ef90[_0x8c79('0x19')],function(_0x568a44){return{'model':db[_0x568a44['model']],'as':_0x568a44['as'],'attributes':_0x568a44[_0x8c79('0x18')],'include':_0x568a44[_0x8c79('0x19')]?_['map'](_0x568a44[_0x8c79('0x19')],function(_0x4a3884){return{'model':db[_0x4a3884['model']],'as':_0x4a3884['as'],'attributes':_0x4a3884[_0x8c79('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8c79('0x1b')](function(_0x49a7e6){logger[_0x8c79('0x7')](_0x8c79('0x12'),_0x5af162);logger['debug'](_0x8c79('0x12'),_0x5af162,JSON['stringify'](_0x49a7e6));_0x89d662(_0x49a7e6);})[_0x8c79('0x11')](function(_0x47a1e2){logger['error'](_0x8c79('0x12'),_0x47a1e2[_0x8c79('0xf')],_0x5af162);_0x4fe577(_0x44a0cd[_0x8c79('0xd')](0x1f4,_0x47a1e2['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d85de02..baf8bf2 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(_0xa5e57f,_0x26de48){var _0x4ca614=function(_0x368b34){while(--_0x368b34){_0xa5e57f['push'](_0xa5e57f['shift']());}};_0x4ca614(++_0x26de48);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _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(_0x3109e6,_0x3e0450){var _0x12aed5=function(_0x492ec2){while(--_0x492ec2){_0x3109e6['push'](_0x3109e6['shift']());}};_0x12aed5(++_0x3e0450);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index de23199..5300b01 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 _0x7f82=['csc','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','connectel','plivo'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x7f82,0xc7));var _0x27f8=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7f82[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x27f8('0x0'));var rs=require(_0x27f8('0x1'));module[_0x27f8('0x2')]={'name':{'type':Sequelize[_0x27f8('0x3')],'unique':_0x27f8('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x27f8('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x27f8('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x27f8('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x27f8('0x3')]},'type':{'type':Sequelize[_0x27f8('0x5')](_0x27f8('0x6'),_0x27f8('0x7'),_0x27f8('0x8'),'clicksend',_0x27f8('0x9'),'clickatell','bandwidth',_0x27f8('0xa'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x27f8('0x3')]},'authId':{'type':Sequelize[_0x27f8('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x27f8('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x27f8('0x3')]},'password':{'type':Sequelize[_0x27f8('0x3')]},'apiKey':{'type':Sequelize[_0x27f8('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x27f8('0x3')]},'senderString':{'type':Sequelize[_0x27f8('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x27f8('0x3')]},'notificationTemplate':{'type':Sequelize[_0x27f8('0xb')],'defaultValue':function(){return _0x27f8('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x27f8('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x27f8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x27f8('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x27f8('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x27f8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x27f8('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x27f8('0x10'),'set':function(_0x4aaf86){if(!_0x4aaf86)this[_0x27f8('0x11')](_0x27f8('0x12'),null);this[_0x27f8('0x11')]('mandatoryDisposition',_0x4aaf86);}}}; \ No newline at end of file +var _0x7afa=['intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','infobip'];(function(_0x382894,_0x2b15ad){var _0x3aa3fa=function(_0x12365a){while(--_0x12365a){_0x382894['push'](_0x382894['shift']());}};_0x3aa3fa(++_0x2b15ad);}(_0x7afa,0x119));var _0xa7af=function(_0x1c63d0,_0x516018){_0x1c63d0=_0x1c63d0-0x0;var _0x2c8a35=_0x7afa[_0x1c63d0];return _0x2c8a35;};'use strict';var Sequelize=require(_0xa7af('0x0'));var rs=require('randomstring');module[_0xa7af('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa7af('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xa7af('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa7af('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa7af('0x3')],'defaultValue':function(){return rs[_0xa7af('0x4')]();}},'phone':{'type':Sequelize[_0xa7af('0x3')]},'type':{'type':Sequelize[_0xa7af('0x5')](_0xa7af('0x6'),_0xa7af('0x7'),'connectel',_0xa7af('0x8'),_0xa7af('0x9'),_0xa7af('0xa'),_0xa7af('0xb'),'csc',_0xa7af('0xc'),_0xa7af('0xd'))},'accountSid':{'type':Sequelize[_0xa7af('0x3')]},'authId':{'type':Sequelize[_0xa7af('0x3')]},'authToken':{'type':Sequelize[_0xa7af('0x3')]},'smsMethod':{'type':Sequelize[_0xa7af('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa7af('0x3')]},'password':{'type':Sequelize[_0xa7af('0x3')]},'apiKey':{'type':Sequelize[_0xa7af('0x3')]},'applicationId':{'type':Sequelize[_0xa7af('0x3')]},'accountId':{'type':Sequelize[_0xa7af('0x3')]},'senderString':{'type':Sequelize[_0xa7af('0x3')]},'deliveryReport':{'type':Sequelize[_0xa7af('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xa7af('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa7af('0xf')],'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['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa7af('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa7af('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa7af('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa7af('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa7af('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa7af('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa7af('0x10')],'comment':_0xa7af('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xa7af('0xe')],'defaultValue':![],'comment':_0xa7af('0x12'),'set':function(_0x363d30){if(!_0x363d30)this[_0xa7af('0x13')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xa7af('0x14'),_0x363d30);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e1f72b0..28d4aca 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 _0xc2c5=['ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','From','Body','messageId','MessageSid','skebby','sender','text','message_id','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','push','close','unmanaged','*,*,*,*','created','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','groupName','intelepeer','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','bandwidth','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','destroy','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','SmsAccountId','findAll','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','Sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc2c5,0x15b));var _0x5c2c=function(_0x4b3413,_0x58c416){_0x4b3413=_0x4b3413-0x0;var _0x3b01ba=_0xc2c5[_0x4b3413];return _0x3b01ba;};'use strict';var emlformat=require(_0x5c2c('0x0'));var rimraf=require(_0x5c2c('0x1'));var zipdir=require(_0x5c2c('0x2'));var jsonpatch=require(_0x5c2c('0x3'));var rp=require('request-promise');var moment=require(_0x5c2c('0x4'));var BPromise=require(_0x5c2c('0x5'));var Mustache=require('mustache');var util=require(_0x5c2c('0x6'));var path=require(_0x5c2c('0x7'));var sox=require(_0x5c2c('0x8'));var csv=require(_0x5c2c('0x9'));var ejs=require(_0x5c2c('0xa'));var fs=require('fs');var fs_extra=require(_0x5c2c('0xb'));var _=require(_0x5c2c('0xc'));var squel=require(_0x5c2c('0xd'));var crypto=require(_0x5c2c('0xe'));var jsforce=require(_0x5c2c('0xf'));var deskjs=require(_0x5c2c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5c2c('0x11'));var Papa=require(_0x5c2c('0x12'));var Redis=require(_0x5c2c('0x13'));var authService=require(_0x5c2c('0x14'));var qs=require(_0x5c2c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c2c('0x16'))(_0x5c2c('0x17'));var utils=require(_0x5c2c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c2c('0x19'))['db'];config[_0x5c2c('0x1a')]=_[_0x5c2c('0x1b')](config['redis'],{'host':_0x5c2c('0x1c'),'port':0x18eb});var socket=require(_0x5c2c('0x1d'))(new Redis(config[_0x5c2c('0x1a')]));require(_0x5c2c('0x1e'))[_0x5c2c('0x1f')](socket);var jayson=require(_0x5c2c('0x20'));var client=jayson['client'][_0x5c2c('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x46287f,_0x4044fb,_0x3df916,_0x4e4a5e){return new BPromise(function(_0x29981e,_0x2a5eae){var _0x1ca76b=_0x4e4a5e||client;return _0x1ca76b[_0x5c2c('0x22')](_0x46287f,_0x3df916)['then'](function(_0x4b743f){logger[_0x5c2c('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4044fb,_0x5c2c('0x24'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4044fb,_0x5c2c('0x24'),JSON[_0x5c2c('0x25')](_0x4b743f));if(_0x4b743f[_0x5c2c('0x26')]){if(_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x27')]===0x1f4){logger['error'](_0x5c2c('0x28'),_0x4044fb,_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x29')]);return _0x2a5eae(_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x29')]);}logger[_0x5c2c('0x26')](_0x5c2c('0x28'),_0x4044fb,_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x29')]);return _0x29981e(_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x29')]);}else{logger[_0x5c2c('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4044fb,_0x5c2c('0x24'));_0x29981e(_0x4b743f[_0x5c2c('0x2a')][_0x5c2c('0x29')]);}})[_0x5c2c('0x2b')](function(_0x45ec85){logger['error'](_0x5c2c('0x28'),_0x4044fb,_0x45ec85);_0x2a5eae(_0x45ec85);});});}function respondWithStatusCode(_0x3877d1,_0x1bd87a){_0x1bd87a=_0x1bd87a||0xcc;return function(_0x48ac65){if(_0x48ac65){return _0x3877d1[_0x5c2c('0x2c')](_0x1bd87a);}return _0x3877d1[_0x5c2c('0x2d')](_0x1bd87a)[_0x5c2c('0x2e')]();};}function respondWithResult(_0x15ed72,_0x22f09d){_0x22f09d=_0x22f09d||0xc8;return function(_0x68997f){if(_0x68997f){return _0x15ed72[_0x5c2c('0x2d')](_0x22f09d)['json'](_0x68997f);}};}function respondWithFilteredResult(_0x2f45af,_0x2fe18f){return function(_0x53aaea){if(_0x53aaea){var _0x50cfac=typeof _0x2fe18f[_0x5c2c('0x2f')]==='undefined'&&typeof _0x2fe18f[_0x5c2c('0x30')]===_0x5c2c('0x31');var _0x27b853=_0x53aaea[_0x5c2c('0x32')];var _0x2a5bd8=_0x50cfac?0x0:_0x2fe18f['offset'];var _0x4d7705=_0x50cfac?_0x53aaea[_0x5c2c('0x32')]:_0x2fe18f[_0x5c2c('0x2f')]+_0x2fe18f[_0x5c2c('0x30')];var _0x3f92d9;if(_0x4d7705>=_0x27b853){_0x4d7705=_0x27b853;_0x3f92d9=0xc8;}else{_0x3f92d9=0xce;}_0x2f45af[_0x5c2c('0x2d')](_0x3f92d9);return _0x2f45af[_0x5c2c('0x33')](_0x5c2c('0x34'),_0x2a5bd8+'-'+_0x4d7705+'/'+_0x27b853)[_0x5c2c('0x35')](_0x53aaea);}return null;};}function patchUpdates(_0x4918c2){return function(_0x340989){try{jsonpatch['apply'](_0x340989,_0x4918c2,!![]);}catch(_0x533152){return BPromise[_0x5c2c('0x36')](_0x533152);}return _0x340989['save']();};}function saveUpdates(_0x3e134a,_0x46b956){return function(_0x219f53){if(_0x219f53){return _0x219f53[_0x5c2c('0x37')](_0x3e134a)[_0x5c2c('0x38')](function(_0x5f5289){return _0x5f5289;});}return null;};}function removeEntity(_0x3d3f6e,_0x35e51c){return function(_0x26ce59){if(_0x26ce59){return _0x26ce59[_0x5c2c('0x39')]()[_0x5c2c('0x38')](function(){var _0x1c4470=_0x26ce59['get']({'plain':!![]});var _0x51762c=_0x5c2c('0x3a');return db[_0x5c2c('0x3b')][_0x5c2c('0x39')]({'where':{'type':_0x51762c,'resourceId':_0x1c4470['id']}})[_0x5c2c('0x38')](function(){return _0x26ce59;});})[_0x5c2c('0x38')](function(){_0x3d3f6e[_0x5c2c('0x2d')](0xcc)[_0x5c2c('0x2e')]();});}};}function handleEntityNotFound(_0x5f33f9,_0x21c0cc){return function(_0x42dccf){if(!_0x42dccf){_0x5f33f9[_0x5c2c('0x2c')](0x194);}return _0x42dccf;};}function handleError(_0x250f86,_0x5334bc){_0x5334bc=_0x5334bc||0x1f4;return function(_0x1bc7e4){logger[_0x5c2c('0x26')](_0x1bc7e4[_0x5c2c('0x3c')]);if(_0x1bc7e4[_0x5c2c('0x3d')]){delete _0x1bc7e4['name'];}_0x250f86['status'](_0x5334bc)['send'](_0x1bc7e4);};}exports[_0x5c2c('0x3e')]=function(_0x33a03b,_0x29d79e){var _0xfe2961={'include':[{'model':db['Pause'],'as':_0x5c2c('0x3f')}]},_0x45d771={},_0x4aa671={'count':0x0,'rows':[]};var _0x5f057b=_[_0x5c2c('0x40')](db[_0x5c2c('0x41')][_0x5c2c('0x42')],function(_0x45c134){return{'name':_0x45c134['fieldName'],'type':_0x45c134[_0x5c2c('0x43')][_0x5c2c('0x44')]};});_0x45d771[_0x5c2c('0x45')]=_[_0x5c2c('0x40')](_0x5f057b,_0x5c2c('0x3d'));_0x45d771[_0x5c2c('0x46')]=_[_0x5c2c('0x47')](_0x33a03b[_0x5c2c('0x46')]);_0x45d771[_0x5c2c('0x48')]=_[_0x5c2c('0x49')](_0x45d771[_0x5c2c('0x45')],_0x45d771['query']);_0xfe2961[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x45d771[_0x5c2c('0x45')],qs['fields'](_0x33a03b[_0x5c2c('0x46')]['fields']));_0xfe2961[_0x5c2c('0x4a')]=_0xfe2961['attributes'][_0x5c2c('0x4b')]?_0xfe2961[_0x5c2c('0x4a')]:_0x45d771['model'];if(!_0x33a03b[_0x5c2c('0x46')]['hasOwnProperty'](_0x5c2c('0x4c'))){_0xfe2961['limit']=qs[_0x5c2c('0x30')](_0x33a03b[_0x5c2c('0x46')][_0x5c2c('0x30')]);_0xfe2961[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0x33a03b[_0x5c2c('0x46')]['offset']);}_0xfe2961[_0x5c2c('0x4d')]=qs[_0x5c2c('0x4e')](_0x33a03b[_0x5c2c('0x46')][_0x5c2c('0x4e')]);_0xfe2961[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x33a03b[_0x5c2c('0x46')],_0x45d771['filters']),_0x5f057b);if(_0x33a03b[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0xfe2961[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0xfe2961[_0x5c2c('0x4f')],{'$or':_[_0x5c2c('0x40')](_0x5f057b,function(_0x44d9a8){if(_0x44d9a8[_0x5c2c('0x43')]!=='VIRTUAL'){var _0x12a1eb={};_0x12a1eb[_0x44d9a8[_0x5c2c('0x3d')]]={'$like':'%'+_0x33a03b[_0x5c2c('0x46')][_0x5c2c('0x51')]+'%'};return _0x12a1eb;}})});}_0xfe2961=_[_0x5c2c('0x52')]({},_0xfe2961,_0x33a03b[_0x5c2c('0x53')]);var _0x3a09cd={'where':_0xfe2961[_0x5c2c('0x4f')]};return db[_0x5c2c('0x41')]['count'](_0x3a09cd)[_0x5c2c('0x38')](function(_0x7c234f){_0x4aa671[_0x5c2c('0x32')]=_0x7c234f;if(_0x33a03b['query'][_0x5c2c('0x54')]){_0xfe2961[_0x5c2c('0x55')]=[{'all':!![]}];}return db[_0x5c2c('0x41')]['findAll'](_0xfe2961);})[_0x5c2c('0x38')](function(_0x25f8dd){_0x4aa671[_0x5c2c('0x56')]=_0x25f8dd;return _0x4aa671;})[_0x5c2c('0x38')](respondWithFilteredResult(_0x29d79e,_0xfe2961))[_0x5c2c('0x2b')](handleError(_0x29d79e,null));};exports[_0x5c2c('0x57')]=function(_0x4684cd,_0x6b374d){var _0x4a9508={'raw':![],'where':{'id':_0x4684cd['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x15a5e6={};_0x15a5e6[_0x5c2c('0x45')]=_['keys'](db[_0x5c2c('0x41')][_0x5c2c('0x42')]);_0x15a5e6['query']=_[_0x5c2c('0x47')](_0x4684cd[_0x5c2c('0x46')]);_0x15a5e6[_0x5c2c('0x48')]=_[_0x5c2c('0x49')](_0x15a5e6['model'],_0x15a5e6[_0x5c2c('0x46')]);_0x4a9508[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x15a5e6[_0x5c2c('0x45')],qs['fields'](_0x4684cd[_0x5c2c('0x46')][_0x5c2c('0x58')]));_0x4a9508[_0x5c2c('0x4a')]=_0x4a9508[_0x5c2c('0x4a')][_0x5c2c('0x4b')]?_0x4a9508[_0x5c2c('0x4a')]:_0x15a5e6[_0x5c2c('0x45')];if(_0x4684cd['query'][_0x5c2c('0x54')]){_0x4a9508[_0x5c2c('0x55')]=[{'all':!![]}];}_0x4a9508=_[_0x5c2c('0x52')]({},_0x4a9508,_0x4684cd['options']);return db[_0x5c2c('0x41')][_0x5c2c('0x59')](_0x4a9508)['then'](handleEntityNotFound(_0x6b374d,null))[_0x5c2c('0x38')](respondWithResult(_0x6b374d,null))['catch'](handleError(_0x6b374d,null));};exports[_0x5c2c('0x5a')]=function(_0x4ae5c0,_0x1886e6){return db[_0x5c2c('0x41')][_0x5c2c('0x5a')](_0x4ae5c0[_0x5c2c('0x5b')],{})[_0x5c2c('0x38')](function(_0x17c2dc){var _0x552a0a=_0x4ae5c0[_0x5c2c('0x5c')][_0x5c2c('0x5d')]({'plain':!![]});if(!_0x552a0a)throw new Error(_0x5c2c('0x5e'));if(_0x552a0a['role']===_0x5c2c('0x5c')){var _0x306938=_0x17c2dc['get']({'plain':!![]});var _0x1f8639=_0x5c2c('0x3a');return db[_0x5c2c('0x5f')]['find']({'where':{'name':_0x1f8639,'userProfileId':_0x552a0a[_0x5c2c('0x60')]},'raw':!![]})[_0x5c2c('0x38')](function(_0x54b284){if(_0x54b284&&_0x54b284[_0x5c2c('0x61')]===0x0){return db[_0x5c2c('0x3b')][_0x5c2c('0x5a')]({'name':_0x306938[_0x5c2c('0x3d')],'resourceId':_0x306938['id'],'type':_0x54b284[_0x5c2c('0x3d')],'sectionId':_0x54b284['id']},{})['then'](function(){return _0x17c2dc;});}else{return _0x17c2dc;}})[_0x5c2c('0x2b')](function(_0x3e12d1){logger[_0x5c2c('0x26')](_0x5c2c('0x62'),_0x3e12d1);throw _0x3e12d1;});}return _0x17c2dc;})[_0x5c2c('0x38')](respondWithResult(_0x1886e6,0xc9))[_0x5c2c('0x2b')](handleError(_0x1886e6,null));};exports['update']=function(_0x2dc868,_0x5ad34c){if(_0x2dc868[_0x5c2c('0x5b')]['id']){delete _0x2dc868[_0x5c2c('0x5b')]['id'];}return db[_0x5c2c('0x41')]['find']({'where':{'id':_0x2dc868[_0x5c2c('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0x5c2c('0x3f')}]})[_0x5c2c('0x38')](handleEntityNotFound(_0x5ad34c,null))[_0x5c2c('0x38')](saveUpdates(_0x2dc868['body'],null))[_0x5c2c('0x38')](respondWithResult(_0x5ad34c,null))[_0x5c2c('0x2b')](handleError(_0x5ad34c,null));};exports[_0x5c2c('0x39')]=function(_0x504e3,_0x2c84fc){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x504e3[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x2c84fc,null))['then'](removeEntity(_0x2c84fc,null))[_0x5c2c('0x2b')](handleError(_0x2c84fc,null));};exports[_0x5c2c('0x64')]=function(_0xaaa530,_0x37c46e){return db['SmsAccount'][_0x5c2c('0x64')]()['then'](respondWithResult(_0x37c46e,null))[_0x5c2c('0x2b')](handleError(_0x37c46e,null));};exports['addDisposition']=function(_0x54c807,_0x3fcd20,_0x1e8eb9){if(_0x54c807['body']['id']){delete _0x54c807[_0x5c2c('0x5b')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x54c807[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x3fcd20,null))['then'](function(_0x290534){if(_0x290534){_0x54c807[_0x5c2c('0x5b')]['SmsAccountId']=_0x290534['id'];return db[_0x5c2c('0x65')]['create'](_0x54c807[_0x5c2c('0x5b')]);}})[_0x5c2c('0x38')](respondWithResult(_0x3fcd20,null))[_0x5c2c('0x2b')](handleError(_0x3fcd20,null));};exports[_0x5c2c('0x66')]=function(_0x2e2bd6,_0x2207f9,_0xad1c11){var _0x12d03c={'raw':![],'where':{}};var _0x4a3ea9={};var _0x5746d9={'count':0x0,'rows':[]};return db[_0x5c2c('0x41')][_0x5c2c('0x67')]({'where':{'id':_0x2e2bd6[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x2207f9,null))[_0x5c2c('0x38')](function(_0x585a1d){if(_0x585a1d){_0x4a3ea9[_0x5c2c('0x45')]=_[_0x5c2c('0x47')](db['Disposition']['rawAttributes']);_0x4a3ea9[_0x5c2c('0x46')]=_['keys'](_0x2e2bd6['query']);_0x4a3ea9[_0x5c2c('0x48')]=_['intersection'](_0x4a3ea9[_0x5c2c('0x45')],_0x4a3ea9['query']);_0x12d03c[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x4a3ea9['model'],qs['fields'](_0x2e2bd6['query'][_0x5c2c('0x58')]));_0x12d03c['attributes']=_0x12d03c[_0x5c2c('0x4a')][_0x5c2c('0x4b')]?_0x12d03c[_0x5c2c('0x4a')]:_0x4a3ea9[_0x5c2c('0x45')];if(!_0x2e2bd6[_0x5c2c('0x46')]['hasOwnProperty']('nolimit')){_0x12d03c[_0x5c2c('0x30')]=qs[_0x5c2c('0x30')](_0x2e2bd6['query'][_0x5c2c('0x30')]);_0x12d03c[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0x2e2bd6[_0x5c2c('0x46')][_0x5c2c('0x2f')]);}_0x12d03c[_0x5c2c('0x4d')]=qs['sort'](_0x2e2bd6['query'][_0x5c2c('0x4e')]);_0x12d03c[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x2e2bd6[_0x5c2c('0x46')],_0x4a3ea9[_0x5c2c('0x48')]));_0x12d03c[_0x5c2c('0x4f')][_0x5c2c('0x68')]=_0x585a1d['id'];if(_0x2e2bd6[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0x12d03c[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0x12d03c[_0x5c2c('0x4f')],{'$or':_['map'](_0x12d03c[_0x5c2c('0x4a')],function(_0x1ec8a7){var _0x4a480b={};_0x4a480b[_0x1ec8a7]={'$like':'%'+_0x2e2bd6['query'][_0x5c2c('0x51')]+'%'};return _0x4a480b;})});}_0x12d03c=_['merge']({},_0x12d03c,_0x2e2bd6[_0x5c2c('0x53')]);return db[_0x5c2c('0x65')][_0x5c2c('0x32')]({'where':_0x12d03c[_0x5c2c('0x4f')]})[_0x5c2c('0x38')](function(_0x2105e4){_0x5746d9[_0x5c2c('0x32')]=_0x2105e4;if(_0x2e2bd6['query'][_0x5c2c('0x54')]){_0x12d03c[_0x5c2c('0x55')]=[{'all':!![]}];}return db[_0x5c2c('0x65')][_0x5c2c('0x69')](_0x12d03c);})['then'](function(_0x5cac5a){_0x5746d9[_0x5c2c('0x56')]=_0x5cac5a;return _0x5746d9;});}})[_0x5c2c('0x38')](respondWithFilteredResult(_0x2207f9,_0x12d03c))[_0x5c2c('0x2b')](handleError(_0x2207f9,null));};exports[_0x5c2c('0x6a')]=function(_0x49bd29,_0x821aa7,_0x4eec0b){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x49bd29[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x821aa7,null))[_0x5c2c('0x38')](function(_0x4bf65c){if(_0x4bf65c){return _0x4bf65c['removeDispositions'](_0x49bd29['query'][_0x5c2c('0x6b')]);}})[_0x5c2c('0x38')](respondWithStatusCode(_0x821aa7,null))[_0x5c2c('0x2b')](handleError(_0x821aa7,null));};exports['addAnswer']=function(_0x51683e,_0x1f88a0,_0x56cb1f){if(_0x51683e['body']['id']){delete _0x51683e[_0x5c2c('0x5b')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x51683e[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x1f88a0,null))[_0x5c2c('0x38')](function(_0x2edbf4){if(_0x2edbf4){_0x51683e[_0x5c2c('0x5b')][_0x5c2c('0x68')]=_0x2edbf4['id'];return db[_0x5c2c('0x6c')][_0x5c2c('0x5a')](_0x51683e[_0x5c2c('0x5b')]);}})['then'](respondWithResult(_0x1f88a0,null))[_0x5c2c('0x2b')](handleError(_0x1f88a0,null));};exports[_0x5c2c('0x6d')]=function(_0x2bdf6d,_0x1182a7,_0x4f4fad){var _0x3a659e={'raw':![],'where':{}};var _0x58073d={};var _0x4582fd={'count':0x0,'rows':[]};return db[_0x5c2c('0x41')][_0x5c2c('0x67')]({'where':{'id':_0x2bdf6d[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x1182a7,null))[_0x5c2c('0x38')](function(_0x4001cc){if(_0x4001cc){_0x58073d[_0x5c2c('0x45')]=_[_0x5c2c('0x47')](db['CannedAnswer'][_0x5c2c('0x42')]);_0x58073d['query']=_[_0x5c2c('0x47')](_0x2bdf6d['query']);_0x58073d[_0x5c2c('0x48')]=_['intersection'](_0x58073d['model'],_0x58073d[_0x5c2c('0x46')]);_0x3a659e['attributes']=_['intersection'](_0x58073d[_0x5c2c('0x45')],qs[_0x5c2c('0x58')](_0x2bdf6d[_0x5c2c('0x46')]['fields']));_0x3a659e[_0x5c2c('0x4a')]=_0x3a659e[_0x5c2c('0x4a')]['length']?_0x3a659e[_0x5c2c('0x4a')]:_0x58073d[_0x5c2c('0x45')];if(!_0x2bdf6d['query'][_0x5c2c('0x6e')](_0x5c2c('0x4c'))){_0x3a659e[_0x5c2c('0x30')]=qs['limit'](_0x2bdf6d[_0x5c2c('0x46')][_0x5c2c('0x30')]);_0x3a659e[_0x5c2c('0x2f')]=qs['offset'](_0x2bdf6d[_0x5c2c('0x46')]['offset']);}_0x3a659e[_0x5c2c('0x4d')]=qs['sort'](_0x2bdf6d[_0x5c2c('0x46')][_0x5c2c('0x4e')]);_0x3a659e[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x2bdf6d['query'],_0x58073d[_0x5c2c('0x48')]));_0x3a659e[_0x5c2c('0x4f')][_0x5c2c('0x68')]=_0x4001cc['id'];if(_0x2bdf6d[_0x5c2c('0x46')]['filter']){_0x3a659e[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0x3a659e[_0x5c2c('0x4f')],{'$or':_[_0x5c2c('0x40')](_0x3a659e[_0x5c2c('0x4a')],function(_0x58df23){var _0x25d193={};_0x25d193[_0x58df23]={'$like':'%'+_0x2bdf6d[_0x5c2c('0x46')]['filter']+'%'};return _0x25d193;})});}_0x3a659e=_['merge']({},_0x3a659e,_0x2bdf6d[_0x5c2c('0x53')]);return db[_0x5c2c('0x6c')]['count']({'where':_0x3a659e[_0x5c2c('0x4f')]})[_0x5c2c('0x38')](function(_0x180a0d){_0x4582fd[_0x5c2c('0x32')]=_0x180a0d;if(_0x2bdf6d[_0x5c2c('0x46')][_0x5c2c('0x54')]){_0x3a659e[_0x5c2c('0x55')]=[{'all':!![]}];}return db[_0x5c2c('0x6c')]['findAll'](_0x3a659e);})[_0x5c2c('0x38')](function(_0xcb3495){_0x4582fd[_0x5c2c('0x56')]=_0xcb3495;return _0x4582fd;});}})[_0x5c2c('0x38')](respondWithFilteredResult(_0x1182a7,_0x3a659e))[_0x5c2c('0x2b')](handleError(_0x1182a7,null));};exports[_0x5c2c('0x6f')]=function(_0x2550a7,_0xbc1e9c,_0x2a6aca){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x2550a7[_0x5c2c('0x63')]['id']}})['then'](handleEntityNotFound(_0xbc1e9c,null))['then'](function(_0x28556b){if(_0x28556b){return _0x28556b['removeAnswers'](_0x2550a7[_0x5c2c('0x46')]['ids']);}})[_0x5c2c('0x38')](respondWithStatusCode(_0xbc1e9c,null))[_0x5c2c('0x2b')](handleError(_0xbc1e9c,null));};exports[_0x5c2c('0x70')]=function(_0x377a9b,_0x293946,_0x4bdeaf){var _0x3fdb5d={'channel':'sms'};var _0x15bb5e=[];var _0x447ef8=[];var _0x4bfff2={};return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x377a9b[_0x5c2c('0x63')]['id']},'include':[{'model':db[_0x5c2c('0x71')],'as':_0x5c2c('0x72')}]})[_0x5c2c('0x38')](handleEntityNotFound(_0x293946,null))[_0x5c2c('0x38')](function(_0x41925e){_0x3fdb5d[_0x5c2c('0x73')]=_0x41925e;_0x3fdb5d[_0x5c2c('0x74')]=_[_0x5c2c('0x75')](_0x41925e[_0x5c2c('0x72')],['priority'],['asc']);if(_0x3fdb5d[_0x5c2c('0x73')][_0x5c2c('0x72')]){delete _0x3fdb5d[_0x5c2c('0x73')][_0x5c2c('0x72')];}return db['CmContact'][_0x5c2c('0x64')]();})[_0x5c2c('0x38')](function(_0xba9476){if(!_0xba9476){throw new db[(_0x5c2c('0x76'))][(_0x5c2c('0x77'))](_0x5c2c('0x78'));}_0x15bb5e=_[_0x5c2c('0x79')](_[_0x5c2c('0x47')](_0xba9476),[_0x5c2c('0x7a'),'updatedAt']);_0x447ef8=_[_0x5c2c('0x79')](_[_0x5c2c('0x47')](_0xba9476),['createdAt',_0x5c2c('0x7b'),_0x5c2c('0x7c'),_0x5c2c('0x7d')]);_0x3fdb5d[_0x5c2c('0x5b')]={'mapKey':'mobile'};if(_0x3fdb5d[_0x5c2c('0x73')]['type']){switch(_0x3fdb5d[_0x5c2c('0x73')]['type']){case'twilio':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x7f')];_0x3fdb5d['body']['body']=_0x377a9b['body'][_0x5c2c('0x80')];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x81')]=_0x377a9b['body'][_0x5c2c('0x82')];break;case _0x5c2c('0x83'):_0x3fdb5d['body']['from']='+'+_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x84')];_0x3fdb5d[_0x5c2c('0x5b')]['body']=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x85')];break;case'connectel':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x7e')];_0x3fdb5d['body'][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')]['message'];break;case'clicksend':_0x3fdb5d['body'][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x7e')];_0x3fdb5d['body'][_0x5c2c('0x5b')]=_0x377a9b['body'][_0x5c2c('0x5b')];_0x3fdb5d[_0x5c2c('0x5b')]['messageId']=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x86')];break;case'plivo':_0x3fdb5d[_0x5c2c('0x5b')]['from']=_0x377a9b['body'][_0x5c2c('0x7f')];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')]['Text'];_0x3fdb5d[_0x5c2c('0x5b')]['messageId']=_0x377a9b['body'][_0x5c2c('0x87')];break;case _0x5c2c('0x88'):_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')]='+'+_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x89')][0x0][_0x5c2c('0x7e')];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')]['results'][0x0][_0x5c2c('0x85')];_0x3fdb5d['body'][_0x5c2c('0x81')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x89')][0x0]['messageId'];break;case _0x5c2c('0x8a'):_0x3fdb5d[_0x5c2c('0x5b')]['from']=_0x377a9b[_0x5c2c('0x5b')]['originatingAddress'];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x8b')][_0x5c2c('0x29')];break;case _0x5c2c('0x8c'):_0x3fdb5d['body']['from']=_0x377a9b[_0x5c2c('0x5b')]['fromNumber'];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]=_0x377a9b['body']['text'];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x81')]=_0x377a9b[_0x5c2c('0x5b')]['replyMessageId'];break;case'bandwidth':_0x3fdb5d['body'][_0x5c2c('0x81')]=_0x377a9b[_0x5c2c('0x5b')][0x0]['message']['id'];_0x3fdb5d['body'][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][0x0][_0x5c2c('0x29')][_0x5c2c('0x7e')];_0x3fdb5d['body'][_0x5c2c('0x5b')]=_0x377a9b['body'][0x0][_0x5c2c('0x29')][_0x5c2c('0x85')];break;case'intelepeer':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x7e')];_0x3fdb5d['body'][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x29')];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x81')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x8d')];break;}}if(_0x3fdb5d['body']['id']){delete _0x3fdb5d[_0x5c2c('0x5b')]['id'];}if(_[_0x5c2c('0x8e')](_0x3fdb5d[_0x5c2c('0x5b')]['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x5c2c('0x8e')](_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')])||_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]===''){throw new db[(_0x5c2c('0x76'))]['ValidationError'](_0x5c2c('0x8f'));}if(_[_0x5c2c('0x8e')](_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x90')])){throw new db[(_0x5c2c('0x76'))][(_0x5c2c('0x77'))](_0x5c2c('0x91')+_0x447ef8);}if(!_[_0x5c2c('0x92')](_0x447ef8,_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x90')])){throw new db[(_0x5c2c('0x76'))][(_0x5c2c('0x77'))](_0x5c2c('0x93')+_0x447ef8);}_0x4bfff2[_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x90')]]=_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')];return db[_0x5c2c('0x94')][_0x5c2c('0x59')]({'where':{'id':_0x3fdb5d['account']['ListId']},'include':[{'model':db[_0x5c2c('0x95')],'as':'Contacts','where':_0x4bfff2,'limit':0x1,'order':[[_0x5c2c('0x7b'),_0x5c2c('0x96')]]}]});})[_0x5c2c('0x38')](handleEntityNotFound(_0x293946,null))[_0x5c2c('0x38')](function(_0x15f4c7){if(_0x15f4c7){_0x3fdb5d[_0x5c2c('0x97')]=_[_0x5c2c('0x98')](_0x15f4c7,['Contacts']);if(_0x15f4c7['Contacts'][_0x5c2c('0x4b')]){return _0x15f4c7[_0x5c2c('0x99')][0x0];}var _0x39e941=_[_0x5c2c('0x1b')](_0x3fdb5d[_0x5c2c('0x5b')],{'firstName':_0x3fdb5d['body'][_0x5c2c('0x7e')],'ListId':_0x15f4c7['id']});_0x39e941[_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x90')]]=_0x3fdb5d['body'][_0x5c2c('0x7e')];return db[_0x5c2c('0x95')][_0x5c2c('0x5a')](_0x39e941,{'fields':_0x15bb5e,'raw':!![]});}})['then'](handleEntityNotFound(_0x293946,null))[_0x5c2c('0x38')](function(_0x4d384b){if(_0x4d384b){_0x3fdb5d[_0x5c2c('0x9a')]=_0x4d384b;var _0x1b25f9={'ContactId':_0x4d384b['id'],'phone':_0x3fdb5d['body']['from'],'SmsAccountId':_0x377a9b[_0x5c2c('0x63')]['id']};var _0x5a8358={'ContactId':_0x4d384b['id'],'SmsAccountId':_0x377a9b[_0x5c2c('0x63')]['id'],'closed':![]};return db[_0x5c2c('0x9b')][_0x5c2c('0x59')]({'where':_0x5a8358})[_0x5c2c('0x38')](function(_0x2a1c6d){if(_0x2a1c6d){return[_0x2a1c6d,![]];}return db[_0x5c2c('0x9b')][_0x5c2c('0x5a')](_0x1b25f9)[_0x5c2c('0x38')](function(_0x1f6f4c){return[_0x1f6f4c,!![]];});});}})[_0x5c2c('0x9c')](function(_0x5706e2,_0x2e51ea){_0x3fdb5d['interaction']=_0x5706e2[_0x5c2c('0x5d')]({'plain':!![]});_0x3fdb5d[_0x5c2c('0x9d')]['created']=![];if(_0x2e51ea){if(_0x3fdb5d['account']['autoclose']){_0x3fdb5d[_0x5c2c('0x74')][_0x5c2c('0x9e')]({'id':0x0,'priority':_0x3fdb5d[_0x5c2c('0x74')][_0x5c2c('0x4b')]+0x1,'app':_0x5c2c('0x9f'),'appdata':_0x5c2c('0xa0'),'interval':_0x5c2c('0xa1')});}_0x3fdb5d[_0x5c2c('0x9d')][_0x5c2c('0xa2')]=!![];}return db['SmsMessage']['create']({'phone':_0x3fdb5d[_0x5c2c('0x5b')]['from'],'messageId':_0x3fdb5d[_0x5c2c('0x5b')]['messageId'],'body':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')],'SmsAccountId':_0x377a9b[_0x5c2c('0x63')]['id'],'SmsInteractionId':_0x5706e2['id'],'direction':'in','ContactId':_0x5706e2['ContactId'],'AttachmentId':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0xa3')]});})[_0x5c2c('0x38')](function(_0x4f948f){_0x3fdb5d[_0x5c2c('0x29')]=_0x4f948f;if(!_0x3fdb5d[_0x5c2c('0x9d')][_0x5c2c('0xa4')])return;return db[_0x5c2c('0xa5')][_0x5c2c('0x59')]({'attributes':['id',_0x5c2c('0x3d')],'where':{'id':_0x3fdb5d['interaction'][_0x5c2c('0xa4')]}});})[_0x5c2c('0x38')](function(_0x47f6d4){if(_0x47f6d4){_0x3fdb5d['applications'][_0x5c2c('0xa6')]({'id':0x0,'priority':0x0,'app':_0x5c2c('0xa7'),'appdata':_0x47f6d4[_0x5c2c('0x3d')]+','+(_0x3fdb5d['account'][_0x5c2c('0xa8')]||0xa),'interval':_0x5c2c('0xa1')});}if(!_0x3fdb5d[_0x5c2c('0x9d')]['queueId'])return;return db[_0x5c2c('0xa9')][_0x5c2c('0x59')]({'attributes':['id',_0x5c2c('0x3d')],'where':{'id':_0x3fdb5d['interaction']['queueId']}});})[_0x5c2c('0x38')](function(_0x4c02ae){if(_0x4c02ae){_0x3fdb5d[_0x5c2c('0x74')][_0x5c2c('0xa6')]({'id':0x0,'priority':0x1,'app':_0x5c2c('0xaa'),'appdata':_0x4c02ae[_0x5c2c('0x3d')]+','+(_0x3fdb5d[_0x5c2c('0x73')][_0x5c2c('0xab')]||0x12c),'interval':_0x5c2c('0xa1')});}return respondWithRpcPromise(_0x5c2c('0xac'),_0x5c2c('0xad'),_0x3fdb5d);})[_0x5c2c('0x38')](function(_0x3bcb22){if(_0x3bcb22){var _0x1f4de0=0xc8;var _0x502e5f='receiveMessage';logger['info'](_0x5c2c('0xae'),_0x502e5f,_0x1f4de0,_0x5c2c('0xaf'));logger[_0x5c2c('0xb0')](_0x5c2c('0xb1'),_0x502e5f,_0x1f4de0,'entity\x20found',JSON[_0x5c2c('0x25')](_0x3bcb22));if(_0x3fdb5d[_0x5c2c('0x73')][_0x5c2c('0x43')]==='twilio'){return _0x293946['status'](_0x1f4de0)[_0x5c2c('0x33')](_0x5c2c('0xb2'),_0x5c2c('0xb3'))[_0x5c2c('0xb4')](_0x5c2c('0xb5'));}else{return _0x293946[_0x5c2c('0x2d')](_0x1f4de0)[_0x5c2c('0x35')](_0x3bcb22);}}})[_0x5c2c('0x2b')](handleError(_0x293946,null));};exports[_0x5c2c('0xb6')]=function(_0x5487c2,_0x57eac0){var _0x429a94=_0x5487c2[_0x5c2c('0x63')]['id'];var _0x2da779=_0x5487c2[_0x5c2c('0x5b')];var _0x32f10d=0xc8;var _0x8ff7c5=null;return db[_0x5c2c('0xb7')][_0x5c2c('0xb8')]({'isolationLevel':db[_0x5c2c('0xb7')][_0x5c2c('0xb9')][_0x5c2c('0xba')][_0x5c2c('0xbb')]},function(_0x3282db){return db[_0x5c2c('0x41')]['findOne']({'where':{'id':_0x429a94},'transaction':_0x3282db})[_0x5c2c('0x38')](function(_0x4bd20f){if(_0x4bd20f){return db[_0x5c2c('0x71')][_0x5c2c('0x39')]({'where':{'SmsAccountId':_0x429a94},'transaction':_0x3282db})[_0x5c2c('0x38')](function(){var _0x2ba93a=_[_0x5c2c('0x40')](_0x2da779,function(_0x17ab0e){_0x17ab0e[_0x5c2c('0x68')]=_0x429a94;return _0x17ab0e;});return db['SmsApplication']['bulkCreate'](_0x2ba93a,{'transaction':_0x3282db});});}else{_0x32f10d=0x194;_0x8ff7c5=[];}});})[_0x5c2c('0x38')](function(){if(_0x32f10d!==0x194){return db['SmsApplication'][_0x5c2c('0xbc')]({'where':{'SmsAccountId':_0x429a94},'order':_0x5c2c('0xbd')})[_0x5c2c('0x38')](function(_0x1c4993){_0x8ff7c5=_0x1c4993;});}})[_0x5c2c('0x2b')](function(_0x1cf040){_0x32f10d=0x1f4;logger[_0x5c2c('0x26')](_0x1cf040[_0x5c2c('0x3c')]);if(_0x1cf040[_0x5c2c('0x3d')]){delete _0x1cf040['name'];}_0x8ff7c5=_0x1cf040;})[_0x5c2c('0xbe')](function(){if(_0x8ff7c5===null){_0x57eac0[_0x5c2c('0x2c')](_0x32f10d);}else{if(_0x32f10d===0x1f4){_0x57eac0[_0x5c2c('0x2d')](_0x32f10d)[_0x5c2c('0xb4')](_0x8ff7c5);}else{_0x57eac0['status'](_0x32f10d)[_0x5c2c('0x35')](_0x8ff7c5);}}});};exports[_0x5c2c('0xbf')]=function(_0x265d0c,_0x307f,_0x3b5466){var _0x1bc1ff={};var _0x3276b6={};var _0x2eadc0;var _0x262d17;return db[_0x5c2c('0x41')][_0x5c2c('0x67')]({'where':{'id':_0x265d0c[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x307f,null))['then'](function(_0x5f42d5){if(_0x5f42d5){_0x2eadc0=_0x5f42d5;_0x3276b6['model']=_[_0x5c2c('0x47')](db[_0x5c2c('0x71')][_0x5c2c('0x42')]);_0x3276b6[_0x5c2c('0x46')]=_['keys'](_0x265d0c[_0x5c2c('0x46')]);_0x3276b6[_0x5c2c('0x48')]=_[_0x5c2c('0x49')](_0x3276b6[_0x5c2c('0x45')],_0x3276b6[_0x5c2c('0x46')]);_0x1bc1ff[_0x5c2c('0x4a')]=_['intersection'](_0x3276b6[_0x5c2c('0x45')],qs[_0x5c2c('0x58')](_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x58')]));_0x1bc1ff[_0x5c2c('0x4a')]=_0x1bc1ff[_0x5c2c('0x4a')]['length']?_0x1bc1ff['attributes']:_0x3276b6['model'];_0x1bc1ff[_0x5c2c('0x4d')]=qs['sort'](_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x4e')]);_0x1bc1ff[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x265d0c[_0x5c2c('0x46')],_0x3276b6['filters']));if(_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0x1bc1ff[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0x1bc1ff[_0x5c2c('0x4f')],{'$or':_['map'](_0x1bc1ff[_0x5c2c('0x4a')],function(_0x256b2f){var _0x1cb86e={};_0x1cb86e[_0x256b2f]={'$like':'%'+_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x51')]+'%'};return _0x1cb86e;})});}_0x1bc1ff=_[_0x5c2c('0x52')]({},_0x1bc1ff,_0x265d0c[_0x5c2c('0x53')]);return _0x2eadc0[_0x5c2c('0xbf')](_0x1bc1ff);}})[_0x5c2c('0x38')](function(_0x1dbbcc){if(_0x1dbbcc){_0x262d17=_0x1dbbcc[_0x5c2c('0x4b')];if(!_0x265d0c['query'][_0x5c2c('0x6e')](_0x5c2c('0x4c'))){_0x1bc1ff['limit']=qs[_0x5c2c('0x30')](_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x30')]);_0x1bc1ff[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0x265d0c[_0x5c2c('0x46')]['offset']);}return _0x2eadc0[_0x5c2c('0xbf')](_0x1bc1ff);}})[_0x5c2c('0x38')](function(_0x2fb83f){if(_0x2fb83f){return _0x2fb83f?{'count':_0x262d17,'rows':_0x2fb83f}:null;}})['then'](respondWithResult(_0x307f,null))[_0x5c2c('0x2b')](handleError(_0x307f,null));};exports[_0x5c2c('0xc0')]=function(_0xe4c73d,_0x2b7ffb,_0x13ef72){var _0x18677c={'raw':![],'where':{}};var _0x5775f4={};var _0x1a19f9={'count':0x0,'rows':[]};return db[_0x5c2c('0x41')][_0x5c2c('0x67')]({'where':{'id':_0xe4c73d['params']['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x2b7ffb,null))[_0x5c2c('0x38')](function(_0x5f064c){if(_0x5f064c){_0x5775f4['model']=_[_0x5c2c('0x47')](db['SmsInteraction'][_0x5c2c('0x42')]);_0x5775f4[_0x5c2c('0x46')]=_[_0x5c2c('0x47')](_0xe4c73d['query']);_0x5775f4['filters']=_['intersection'](_0x5775f4['model'],_0x5775f4[_0x5c2c('0x46')]);_0x18677c[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x5775f4[_0x5c2c('0x45')],qs[_0x5c2c('0x58')](_0xe4c73d[_0x5c2c('0x46')]['fields']));_0x18677c[_0x5c2c('0x4a')]=_0x18677c[_0x5c2c('0x4a')][_0x5c2c('0x4b')]?_0x18677c[_0x5c2c('0x4a')]:_0x5775f4[_0x5c2c('0x45')];if(!_0xe4c73d[_0x5c2c('0x46')]['hasOwnProperty']('nolimit')){_0x18677c[_0x5c2c('0x30')]=qs['limit'](_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x30')]);_0x18677c[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x2f')]);}_0x18677c[_0x5c2c('0x4d')]=qs[_0x5c2c('0x4e')](_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x4e')]);_0x18677c[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0xe4c73d[_0x5c2c('0x46')],_0x5775f4[_0x5c2c('0x48')]));_0x18677c['where'][_0x5c2c('0x68')]=_0x5f064c['id'];if(_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0x18677c['where']=_[_0x5c2c('0x52')](_0x18677c['where'],{'$or':_['map'](_0x18677c[_0x5c2c('0x4a')],function(_0x3fe3de){var _0x2c0804={};_0x2c0804[_0x3fe3de]={'$like':'%'+_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x51')]+'%'};return _0x2c0804;})});}_0x18677c=_[_0x5c2c('0x52')]({},_0x18677c,_0xe4c73d[_0x5c2c('0x53')]);return db[_0x5c2c('0x9b')][_0x5c2c('0x32')]({'where':_0x18677c[_0x5c2c('0x4f')]})[_0x5c2c('0x38')](function(_0x49ae1a){_0x1a19f9[_0x5c2c('0x32')]=_0x49ae1a;if(_0xe4c73d[_0x5c2c('0x46')]['includeAll']){_0x18677c[_0x5c2c('0x55')]=[{'model':db[_0x5c2c('0x95')],'as':'Contact','required':![]},{'model':db[_0x5c2c('0xa5')],'as':_0x5c2c('0xc1'),'attributes':[_0x5c2c('0x3d'),_0x5c2c('0xc2'),_0x5c2c('0xc3')],'required':![]},{'model':db[_0x5c2c('0xc4')],'as':_0x5c2c('0xc5'),'attributes':['id',_0x5c2c('0x3d'),_0x5c2c('0xc6')],'where':_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0xc7')]?{'id':_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0xc7')]}:undefined,'required':_0xe4c73d['query'][_0x5c2c('0xc7')]?!![]:![]}];}return db['SmsInteraction'][_0x5c2c('0x69')](_0x18677c);})[_0x5c2c('0x38')](function(_0x1e25ba){_0x1a19f9['rows']=_0x1e25ba;return _0x1a19f9;});}})[_0x5c2c('0x38')](respondWithFilteredResult(_0x2b7ffb,_0x18677c))[_0x5c2c('0x2b')](handleError(_0x2b7ffb,null));};exports[_0x5c2c('0xb4')]=function(_0x61f7c9,_0x50389a,_0x398169){var _0x7160d2,_0x296372,_0x20f4fb;if(_[_0x5c2c('0x8e')](_0x61f7c9[_0x5c2c('0x5b')][_0x5c2c('0x5b')])||_0x61f7c9[_0x5c2c('0x5b')][_0x5c2c('0x5b')]===''){throw new db['Sequelize'][(_0x5c2c('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5c2c('0x8e')](_0x61f7c9[_0x5c2c('0x5b')]['to'])){throw new db['Sequelize'][(_0x5c2c('0x77'))](_0x5c2c('0xc8'));}_0x7160d2=_0x61f7c9[_0x5c2c('0x5b')]['to'];return db['SmsAccount'][_0x5c2c('0x59')]({'where':{'id':_0x61f7c9[_0x5c2c('0x63')]['id']},'include':[{'model':db[_0x5c2c('0x94')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x7160d2},'limit':0x1,'order':[[_0x5c2c('0x7b'),_0x5c2c('0x96')]]}]}]})[_0x5c2c('0x38')](handleEntityNotFound(_0x50389a,null))[_0x5c2c('0x38')](function(_0x15be2a){if(_0x15be2a&&_0x15be2a[_0x5c2c('0xc9')]){_0x296372=_0x15be2a[_0x5c2c('0x5d')]({'plain':!![]});if(_0x296372[_0x5c2c('0xc9')]&&_0x296372['List'][_0x5c2c('0x99')][_0x5c2c('0x4b')]){return _0x296372[_0x5c2c('0xc9')]['Contacts'][0x0];}return db[_0x5c2c('0x95')][_0x5c2c('0x5a')](_[_0x5c2c('0x1b')](_0x61f7c9[_0x5c2c('0x5b')],{'firstName':_0x7160d2,'mobile':_0x7160d2,'phone':_0x7160d2,'ListId':_0x296372[_0x5c2c('0x7d')]}));}})[_0x5c2c('0x38')](handleEntityNotFound(_0x50389a,null))['then'](function(_0x42c358){if(_0x42c358){_0x20f4fb=_0x42c358;return db[_0x5c2c('0x9b')][_0x5c2c('0x59')]({'where':{'ContactId':_0x20f4fb['id'],'closed':![],'SmsAccountId':_0x296372['id']}})['then'](function(_0x56f847){if(_0x56f847){return[_0x56f847,![]];}return db['SmsInteraction'][_0x5c2c('0x5a')]({'UserId':_0x61f7c9[_0x5c2c('0x5c')]['id'],'ContactId':_0x20f4fb['id'],'SmsAccountId':_0x296372['id'],'phone':_0x7160d2,'firstMsgDirection':'out','Messages':[_[_0x5c2c('0x52')](_0x61f7c9[_0x5c2c('0x5b')],{'read':![],'body':_0x61f7c9[_0x5c2c('0x5b')][_0x5c2c('0x5b')],'phone':_0x7160d2,'SmsAccountId':_0x296372['id'],'UserId':_0x61f7c9[_0x5c2c('0x5c')]['id'],'ContactId':_0x20f4fb['id']})]},{'include':[{'model':db[_0x5c2c('0xca')],'as':_0x5c2c('0xcb')}]})[_0x5c2c('0x38')](function(_0x2d13c2){return[_0x2d13c2,!![]];});});}})[_0x5c2c('0x9c')](function(_0x4a67a5,_0x494c0d){if(_0x494c0d){return _0x4a67a5;}return db[_0x5c2c('0xca')]['create'](_[_0x5c2c('0x52')](_0x61f7c9[_0x5c2c('0x5b')],{'read':![],'body':_0x61f7c9['body'][_0x5c2c('0x5b')],'phone':_0x7160d2,'SmsAccountId':_0x296372['id'],'SmsInteractionId':_0x4a67a5['id'],'UserId':_0x61f7c9[_0x5c2c('0x5c')]['id'],'ContactId':_0x20f4fb['id']}))[_0x5c2c('0x38')](function(_0x1a9c61){_0x4a67a5[_0x5c2c('0xcc')][_0x5c2c('0xcb')]=[];_0x4a67a5[_0x5c2c('0xcc')][_0x5c2c('0xcb')][_0x5c2c('0x9e')](_0x1a9c61['dataValues']);return _0x4a67a5;});})[_0x5c2c('0x38')](respondWithResult(_0x50389a,null))['catch'](handleError(_0x50389a,null));};exports['status']=function(_0x5af382,_0x1237b6,_0x2a200f){if(_0x5af382[_0x5c2c('0x5b')]['id']){delete _0x5af382[_0x5c2c('0x5b')]['id'];}var _0x3ee107,_0x43511c,_0x373e14;return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x5af382[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x1237b6,null))['then'](function(_0x3e02e6){if(_0x3e02e6){_0x373e14=_0x3e02e6;logger[_0x5c2c('0xb0')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xcd'),_0x3e02e6['type'],util[_0x5c2c('0xce')](_0x5af382[_0x5c2c('0x5b')],{'showHidden':![],'depth':null}));switch(_0x3e02e6[_0x5c2c('0x43')]){case _0x5c2c('0x83'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xcf')]&&_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')]){_0x43511c=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')];return db[_0x5c2c('0xca')]['find']({'where':{'messageId':_0x5af382['body'][_0x5c2c('0xcf')]}});}break;case _0x5c2c('0xd0'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd1')]&&_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd2')]){_0x43511c=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd2')];return db[_0x5c2c('0xca')][_0x5c2c('0x59')]({'where':{'messageId':_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd1')]}});}break;case _0x5c2c('0xd3'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x86')]&&_0x5af382['body']['status_code']){_0x43511c=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd4')];return db[_0x5c2c('0xca')]['find']({'where':{'messageId':_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x86')]}});}break;case _0x5c2c('0x88'):var _0x2e47ff=_0x5af382['body'][_0x5c2c('0x89')][0x0];if(_0x2e47ff[_0x5c2c('0x81')]&&_0x2e47ff[_0x5c2c('0x2d')][_0x5c2c('0xd5')]==='DELIVERED'){_0x43511c=_0x2e47ff[_0x5c2c('0x2d')]['groupName'];return db[_0x5c2c('0xca')][_0x5c2c('0x59')]({'where':{'messageId':_0x2e47ff[_0x5c2c('0x81')]}});}break;case _0x5c2c('0x8c'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x81')]&&_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')]){_0x43511c=_0x5af382['body']['status'];return db[_0x5c2c('0xca')][_0x5c2c('0x59')]({'where':{'messageId':_0x5af382['body'][_0x5c2c('0x81')]}});}break;case'bandwidth':if(_0x5af382[_0x5c2c('0x5b')][0x0][_0x5c2c('0x29')]['id']){_0x43511c=_0x5af382['body'][0x0][_0x5c2c('0x43')];return db[_0x5c2c('0xca')][_0x5c2c('0x59')]({'where':{'messageId':_0x5af382[_0x5c2c('0x5b')][0x0][_0x5c2c('0x29')]['id']}});}break;case _0x5c2c('0xd6'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd7')]&&_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')]){_0x43511c=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')];return db[_0x5c2c('0xca')]['find']({'where':{'messageId':_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd7')]}});}break;}}})[_0x5c2c('0x38')](handleEntityNotFound(_0x1237b6,null))[_0x5c2c('0x38')](function(_0x488081){if(_0x488081){_0x3ee107=_0x488081;switch(_0x373e14['type']){case _0x5c2c('0x83'):if(_0x43511c===_0x5c2c('0xd8')){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger['error'](_0x5c2c('0xae'),_0x5c2c('0x2d'),'skebby',util[_0x5c2c('0xce')](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case _0x5c2c('0xd0'):if(_0x43511c==='1'){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0x83'),util['inspect'](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case _0x5c2c('0xd3'):if(!_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd9')]&&_0x43511c>=0xc8&&_0x43511c<=0xce){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger['error'](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xd3'),util[_0x5c2c('0xce')](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case _0x5c2c('0x88'):var _0x128eaf=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x89')][0x0];if(_0x128eaf[_0x5c2c('0x2d')][_0x5c2c('0xd5')]==='DELIVERED'){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5c2c('0x2d'),'infobip',util[_0x5c2c('0xce')](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case _0x5c2c('0x8c'):if(_0x43511c==_0x5c2c('0xda')||_0x43511c==_0x5c2c('0xdb')){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0x8c'),util[_0x5c2c('0xce')](_0x5af382[_0x5c2c('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x43511c==_0x5c2c('0xdc')){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xdd'),util['inspect'](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x43511c===_0x5c2c('0xde')||_0x43511c===_0x5c2c('0xdf')){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xd6'),util[_0x5c2c('0xce')](_0x5af382[_0x5c2c('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3ee107;}})['then'](respondWithResult(_0x1237b6,null))[_0x5c2c('0x2b')](handleError(_0x1237b6,null));};exports[_0x5c2c('0xe0')]=function(_0x2f0b6b,_0x39fd18,_0x5a111b){var _0xc8505f,_0x130ecc,_0x18c292;return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x2f0b6b['params']['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x39fd18,null))[_0x5c2c('0x38')](function(_0x47fb8f){if(_0x47fb8f){_0x18c292=_0x47fb8f;logger[_0x5c2c('0xb0')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xcd'),_0x47fb8f[_0x5c2c('0x43')],util[_0x5c2c('0xce')](_0x2f0b6b['query'],{'showHidden':![],'depth':null}));switch(_0x47fb8f[_0x5c2c('0x43')]){case _0x5c2c('0x8a'):if(_0x2f0b6b[_0x5c2c('0x46')][_0x5c2c('0xe1')]&&_0x2f0b6b[_0x5c2c('0x46')]['state']){_0x130ecc=_0x2f0b6b[_0x5c2c('0x46')][_0x5c2c('0xe2')];return db['SmsMessage'][_0x5c2c('0x59')]({'where':{'messageId':_0x2f0b6b['query'][_0x5c2c('0xe1')]}});}break;}}})['then'](handleEntityNotFound(_0x39fd18,null))[_0x5c2c('0x38')](function(_0x187d38){if(_0x187d38){_0xc8505f=_0x187d38;switch(_0x18c292['type']){case'csc':if(_0x130ecc==='2'||_0x130ecc==='6'){return _0xc8505f[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0x8a'),util['inspect'](_0x2f0b6b[_0x5c2c('0x46')],{'showHidden':![],'depth':null}));};break;}return _0xc8505f;}})[_0x5c2c('0x38')](respondWithResult(_0x39fd18,null))['catch'](handleError(_0x39fd18,null));};exports[_0x5c2c('0xe3')]=function(_0x598246,_0x19bb48,_0x525bd8){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x598246[_0x5c2c('0x63')]['id']}})['then'](handleEntityNotFound(_0x19bb48,null))[_0x5c2c('0x38')](function(_0x76ff32){if(_0x76ff32){return _0x76ff32['addAgents'](_0x598246['body'][_0x5c2c('0x6b')],_['omit'](_0x598246[_0x5c2c('0x5b')],[_0x5c2c('0x6b'),'id'])||{})['spread'](function(_0x54b162){for(var _0x58e208=0x0;_0x58e208<_0x598246[_0x5c2c('0x5b')]['ids'][_0x5c2c('0x4b')];_0x58e208+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x598246[_0x5c2c('0x5b')][_0x5c2c('0x6b')][_0x58e208]),'SmsAccountId':Number(_0x598246[_0x5c2c('0x63')]['id'])});}return _0x54b162;});}})[_0x5c2c('0x38')](respondWithResult(_0x19bb48,null))[_0x5c2c('0x2b')](handleError(_0x19bb48,null));};exports[_0x5c2c('0xe4')]=function(_0x18dd86,_0x11451a,_0x5ca8d1){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x18dd86['params']['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x11451a,null))['then'](function(_0x324641){if(_0x324641){return _0x324641[_0x5c2c('0xe4')](_0x18dd86[_0x5c2c('0x46')][_0x5c2c('0x6b')])[_0x5c2c('0x38')](function(){if(_[_0x5c2c('0xe5')](_0x18dd86[_0x5c2c('0x46')][_0x5c2c('0x6b')])){for(var _0x44ed93=0x0;_0x44ed93<_0x18dd86[_0x5c2c('0x46')][_0x5c2c('0x6b')][_0x5c2c('0x4b')];_0x44ed93+=0x1){socket[_0x5c2c('0xe6')](_0x5c2c('0xe7'),{'UserId':Number(_0x18dd86[_0x5c2c('0x46')][_0x5c2c('0x6b')][_0x44ed93]),'SmsAccountId':Number(_0x18dd86[_0x5c2c('0x63')]['id'])});}}else{socket['emit'](_0x5c2c('0xe7'),{'UserId':Number(_0x18dd86['query'][_0x5c2c('0x6b')]),'SmsAccountId':Number(_0x18dd86[_0x5c2c('0x63')]['id'])});}});}})[_0x5c2c('0x38')](respondWithStatusCode(_0x11451a,null))[_0x5c2c('0x2b')](handleError(_0x11451a,null));};exports[_0x5c2c('0xe8')]=function(_0x119aa1,_0x52a787,_0x4e6a15){var _0x1ce119={};var _0x5ad5b7={};var _0x4e39a1;var _0x41e9d4;return db[_0x5c2c('0x41')]['findOne']({'where':{'id':_0x119aa1[_0x5c2c('0x63')]['id']}})['then'](handleEntityNotFound(_0x52a787,null))['then'](function(_0x3b4eb1){if(_0x3b4eb1){_0x4e39a1=_0x3b4eb1;_0x5ad5b7[_0x5c2c('0x45')]=_[_0x5c2c('0x47')](db['User']['rawAttributes']);_0x5ad5b7['query']=_[_0x5c2c('0x47')](_0x119aa1[_0x5c2c('0x46')]);_0x5ad5b7[_0x5c2c('0x48')]=_[_0x5c2c('0x49')](_0x5ad5b7[_0x5c2c('0x45')],_0x5ad5b7[_0x5c2c('0x46')]);_0x1ce119[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x5ad5b7[_0x5c2c('0x45')],qs[_0x5c2c('0x58')](_0x119aa1['query'][_0x5c2c('0x58')]));_0x1ce119[_0x5c2c('0x4a')]=_0x1ce119[_0x5c2c('0x4a')]['length']?_0x1ce119['attributes']:_0x5ad5b7[_0x5c2c('0x45')];_0x1ce119['order']=qs[_0x5c2c('0x4e')](_0x119aa1['query']['sort']);_0x1ce119[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x119aa1[_0x5c2c('0x46')],_0x5ad5b7['filters']));if(_0x119aa1[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0x1ce119[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0x1ce119['where'],{'$or':_[_0x5c2c('0x40')](_0x1ce119[_0x5c2c('0x4a')],function(_0x345a4a){var _0x5ef37d={};_0x5ef37d[_0x345a4a]={'$like':'%'+_0x119aa1[_0x5c2c('0x46')]['filter']+'%'};return _0x5ef37d;})});}_0x1ce119=_[_0x5c2c('0x52')]({},_0x1ce119,_0x119aa1[_0x5c2c('0x53')]);return _0x4e39a1[_0x5c2c('0xe8')](_0x1ce119);}})['then'](function(_0x157477){if(_0x157477){_0x41e9d4=_0x157477['length'];if(!_0x119aa1['query'][_0x5c2c('0x6e')](_0x5c2c('0x4c'))){_0x1ce119[_0x5c2c('0x30')]=qs[_0x5c2c('0x30')](_0x119aa1[_0x5c2c('0x46')]['limit']);_0x1ce119[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0x119aa1['query']['offset']);}return _0x4e39a1[_0x5c2c('0xe8')](_0x1ce119);}})[_0x5c2c('0x38')](function(_0x2194b5){if(_0x2194b5){return _0x2194b5?{'count':_0x41e9d4,'rows':_0x2194b5}:null;}})[_0x5c2c('0x38')](respondWithResult(_0x52a787,null))[_0x5c2c('0x2b')](handleError(_0x52a787,null));}; \ No newline at end of file +var _0xe2b7=['include','findAll','rows','show','SmsAccount','rawAttributes','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','Disposition','nolimit','order','SmsAccountId','removeDispositions','addAnswer','getAnswers','CannedAnswer','ids','notify','sms','SmsApplication','Applications','applications','priority','asc','account','difference','createdAt','updatedAt','CompanyId','mobile','from','From','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','autoclose','created','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','List','out','SmsMessage','Messages','dataValues','push','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','clickatell','redif','DELIVERED','inspect','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','csc','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','SmsAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','fieldName','type','model','map','keys','filters','attributes','intersection','fields','length','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x371bef,_0x1295e){var _0x39ec13=function(_0x23c5c4){while(--_0x23c5c4){_0x371bef['push'](_0x371bef['shift']());}};_0x39ec13(++_0x1295e);}(_0xe2b7,0x98));var _0x7e2b=function(_0x221af0,_0x1b39c9){_0x221af0=_0x221af0-0x0;var _0x46c805=_0xe2b7[_0x221af0];return _0x46c805;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e2b('0x0'));var zipdir=require(_0x7e2b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e2b('0x2'));var moment=require(_0x7e2b('0x3'));var BPromise=require(_0x7e2b('0x4'));var Mustache=require(_0x7e2b('0x5'));var util=require('util');var path=require(_0x7e2b('0x6'));var sox=require('sox');var csv=require(_0x7e2b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e2b('0x8'));var _=require(_0x7e2b('0x9'));var squel=require(_0x7e2b('0xa'));var crypto=require(_0x7e2b('0xb'));var jsforce=require(_0x7e2b('0xc'));var deskjs=require(_0x7e2b('0xd'));var toCsv=require(_0x7e2b('0x7'));var querystring=require(_0x7e2b('0xe'));var Papa=require('papaparse');var Redis=require(_0x7e2b('0xf'));var authService=require(_0x7e2b('0x10'));var qs=require(_0x7e2b('0x11'));var as=require(_0x7e2b('0x12'));var hardwareService=require(_0x7e2b('0x13'));var logger=require(_0x7e2b('0x14'))(_0x7e2b('0x15'));var utils=require('../../config/utils');var config=require(_0x7e2b('0x16'));var licenseUtil=require(_0x7e2b('0x17'));var db=require('../../mysqldb')['db'];config[_0x7e2b('0x18')]=_['defaults'](config[_0x7e2b('0x18')],{'host':_0x7e2b('0x19'),'port':0x18eb});var socket=require(_0x7e2b('0x1a'))(new Redis(config[_0x7e2b('0x18')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7e2b('0x1b'));var client=jayson[_0x7e2b('0x1c')][_0x7e2b('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x2c7a95,_0xffcb6,_0x1c203f,_0x25d575){return new BPromise(function(_0xdce1b4,_0x43646d){var _0x546d3c=_0x25d575||client;return _0x546d3c[_0x7e2b('0x1e')](_0x2c7a95,_0x1c203f)[_0x7e2b('0x1f')](function(_0x4328b0){logger[_0x7e2b('0x20')]('SmsAccount,\x20%s,\x20%s',_0xffcb6,_0x7e2b('0x21'));logger[_0x7e2b('0x22')](_0x7e2b('0x23'),_0xffcb6,_0x7e2b('0x21'),JSON[_0x7e2b('0x24')](_0x4328b0));if(_0x4328b0[_0x7e2b('0x25')]){if(_0x4328b0[_0x7e2b('0x25')][_0x7e2b('0x26')]===0x1f4){logger[_0x7e2b('0x25')](_0x7e2b('0x27'),_0xffcb6,_0x4328b0[_0x7e2b('0x25')][_0x7e2b('0x28')]);return _0x43646d(_0x4328b0['error'][_0x7e2b('0x28')]);}logger[_0x7e2b('0x25')](_0x7e2b('0x27'),_0xffcb6,_0x4328b0[_0x7e2b('0x25')][_0x7e2b('0x28')]);return _0xdce1b4(_0x4328b0[_0x7e2b('0x25')][_0x7e2b('0x28')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0xffcb6,_0x7e2b('0x21'));_0xdce1b4(_0x4328b0[_0x7e2b('0x29')][_0x7e2b('0x28')]);}})[_0x7e2b('0x2a')](function(_0x67bda3){logger[_0x7e2b('0x25')](_0x7e2b('0x27'),_0xffcb6,_0x67bda3);_0x43646d(_0x67bda3);});});}function respondWithStatusCode(_0x321856,_0x16b516){_0x16b516=_0x16b516||0xcc;return function(_0x19aa94){if(_0x19aa94){return _0x321856['sendStatus'](_0x16b516);}return _0x321856[_0x7e2b('0x2b')](_0x16b516)['end']();};}function respondWithResult(_0x197cbf,_0x47174c){_0x47174c=_0x47174c||0xc8;return function(_0x452beb){if(_0x452beb){return _0x197cbf[_0x7e2b('0x2b')](_0x47174c)[_0x7e2b('0x2c')](_0x452beb);}};}function respondWithFilteredResult(_0x505b98,_0x3888a3){return function(_0x5e7897){if(_0x5e7897){var _0x147bbe=typeof _0x3888a3[_0x7e2b('0x2d')]===_0x7e2b('0x2e')&&typeof _0x3888a3[_0x7e2b('0x2f')]===_0x7e2b('0x2e');var _0x2a16a6=_0x5e7897['count'];var _0x3a3445=_0x147bbe?0x0:_0x3888a3['offset'];var _0x4482ea=_0x147bbe?_0x5e7897[_0x7e2b('0x30')]:_0x3888a3[_0x7e2b('0x2d')]+_0x3888a3[_0x7e2b('0x2f')];var _0x466029;if(_0x4482ea>=_0x2a16a6){_0x4482ea=_0x2a16a6;_0x466029=0xc8;}else{_0x466029=0xce;}_0x505b98['status'](_0x466029);return _0x505b98[_0x7e2b('0x31')](_0x7e2b('0x32'),_0x3a3445+'-'+_0x4482ea+'/'+_0x2a16a6)[_0x7e2b('0x2c')](_0x5e7897);}return null;};}function patchUpdates(_0x2dd717){return function(_0x4579d7){try{jsonpatch[_0x7e2b('0x33')](_0x4579d7,_0x2dd717,!![]);}catch(_0x325686){return BPromise[_0x7e2b('0x34')](_0x325686);}return _0x4579d7['save']();};}function saveUpdates(_0x425540,_0x1883a1){return function(_0x464fa7){if(_0x464fa7){return _0x464fa7[_0x7e2b('0x35')](_0x425540)['then'](function(_0x48da22){return _0x48da22;});}return null;};}function removeEntity(_0x36c6c4,_0x4b9c22){return function(_0x59336c){if(_0x59336c){return _0x59336c['destroy']()[_0x7e2b('0x1f')](function(){var _0x1dc8e5=_0x59336c['get']({'plain':!![]});var _0x123165=_0x7e2b('0x36');return db[_0x7e2b('0x37')][_0x7e2b('0x38')]({'where':{'type':_0x123165,'resourceId':_0x1dc8e5['id']}})['then'](function(){return _0x59336c;});})[_0x7e2b('0x1f')](function(){_0x36c6c4[_0x7e2b('0x2b')](0xcc)[_0x7e2b('0x39')]();});}};}function handleEntityNotFound(_0x1da26c,_0x4ff03c){return function(_0x23914d){if(!_0x23914d){_0x1da26c[_0x7e2b('0x3a')](0x194);}return _0x23914d;};}function handleError(_0x2913dd,_0x3a1d77){_0x3a1d77=_0x3a1d77||0x1f4;return function(_0x2083ba){logger['error'](_0x2083ba[_0x7e2b('0x3b')]);if(_0x2083ba[_0x7e2b('0x3c')]){delete _0x2083ba[_0x7e2b('0x3c')];}_0x2913dd[_0x7e2b('0x2b')](_0x3a1d77)['send'](_0x2083ba);};}exports[_0x7e2b('0x3d')]=function(_0x2194ff,_0x1295a8){var _0x57f790={'include':[{'model':db[_0x7e2b('0x3e')],'as':_0x7e2b('0x3f')}]},_0xfc108a={},_0x31e4c3={'count':0x0,'rows':[]};var _0x33f417=_['map'](db['SmsAccount']['rawAttributes'],function(_0x516080){return{'name':_0x516080[_0x7e2b('0x40')],'type':_0x516080[_0x7e2b('0x41')]['key']};});_0xfc108a[_0x7e2b('0x42')]=_[_0x7e2b('0x43')](_0x33f417,_0x7e2b('0x3c'));_0xfc108a['query']=_[_0x7e2b('0x44')](_0x2194ff['query']);_0xfc108a[_0x7e2b('0x45')]=_['intersection'](_0xfc108a['model'],_0xfc108a['query']);_0x57f790[_0x7e2b('0x46')]=_[_0x7e2b('0x47')](_0xfc108a['model'],qs['fields'](_0x2194ff['query'][_0x7e2b('0x48')]));_0x57f790[_0x7e2b('0x46')]=_0x57f790[_0x7e2b('0x46')][_0x7e2b('0x49')]?_0x57f790[_0x7e2b('0x46')]:_0xfc108a[_0x7e2b('0x42')];if(!_0x2194ff[_0x7e2b('0x4a')][_0x7e2b('0x4b')]('nolimit')){_0x57f790['limit']=qs[_0x7e2b('0x2f')](_0x2194ff[_0x7e2b('0x4a')][_0x7e2b('0x2f')]);_0x57f790[_0x7e2b('0x2d')]=qs[_0x7e2b('0x2d')](_0x2194ff[_0x7e2b('0x4a')][_0x7e2b('0x2d')]);}_0x57f790['order']=qs[_0x7e2b('0x4c')](_0x2194ff[_0x7e2b('0x4a')][_0x7e2b('0x4c')]);_0x57f790[_0x7e2b('0x4d')]=qs[_0x7e2b('0x45')](_[_0x7e2b('0x4e')](_0x2194ff['query'],_0xfc108a[_0x7e2b('0x45')]),_0x33f417);if(_0x2194ff[_0x7e2b('0x4a')][_0x7e2b('0x4f')]){_0x57f790['where']=_[_0x7e2b('0x50')](_0x57f790['where'],{'$or':_[_0x7e2b('0x43')](_0x33f417,function(_0x4f73bc){if(_0x4f73bc['type']!==_0x7e2b('0x51')){var _0x215e4a={};_0x215e4a[_0x4f73bc[_0x7e2b('0x3c')]]={'$like':'%'+_0x2194ff['query'][_0x7e2b('0x4f')]+'%'};return _0x215e4a;}})});}_0x57f790=_[_0x7e2b('0x50')]({},_0x57f790,_0x2194ff['options']);var _0x1b9700={'where':_0x57f790[_0x7e2b('0x4d')]};return db['SmsAccount'][_0x7e2b('0x30')](_0x1b9700)['then'](function(_0x7a048b){_0x31e4c3['count']=_0x7a048b;if(_0x2194ff[_0x7e2b('0x4a')][_0x7e2b('0x52')]){_0x57f790[_0x7e2b('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0x7e2b('0x54')](_0x57f790);})[_0x7e2b('0x1f')](function(_0x324cfc){_0x31e4c3[_0x7e2b('0x55')]=_0x324cfc;return _0x31e4c3;})['then'](respondWithFilteredResult(_0x1295a8,_0x57f790))['catch'](handleError(_0x1295a8,null));};exports[_0x7e2b('0x56')]=function(_0x25364c,_0xdb9fc8){var _0x55fc66={'raw':![],'where':{'id':_0x25364c['params']['id']},'include':[{'model':db[_0x7e2b('0x3e')],'as':_0x7e2b('0x3f')}]},_0x1a586d={};_0x1a586d[_0x7e2b('0x42')]=_[_0x7e2b('0x44')](db[_0x7e2b('0x57')][_0x7e2b('0x58')]);_0x1a586d[_0x7e2b('0x4a')]=_[_0x7e2b('0x44')](_0x25364c[_0x7e2b('0x4a')]);_0x1a586d[_0x7e2b('0x45')]=_['intersection'](_0x1a586d['model'],_0x1a586d[_0x7e2b('0x4a')]);_0x55fc66[_0x7e2b('0x46')]=_[_0x7e2b('0x47')](_0x1a586d['model'],qs[_0x7e2b('0x48')](_0x25364c[_0x7e2b('0x4a')][_0x7e2b('0x48')]));_0x55fc66[_0x7e2b('0x46')]=_0x55fc66[_0x7e2b('0x46')][_0x7e2b('0x49')]?_0x55fc66[_0x7e2b('0x46')]:_0x1a586d[_0x7e2b('0x42')];if(_0x25364c['query'][_0x7e2b('0x52')]){_0x55fc66[_0x7e2b('0x53')]=[{'all':!![]}];}_0x55fc66=_[_0x7e2b('0x50')]({},_0x55fc66,_0x25364c[_0x7e2b('0x59')]);return db['SmsAccount'][_0x7e2b('0x5a')](_0x55fc66)['then'](handleEntityNotFound(_0xdb9fc8,null))[_0x7e2b('0x1f')](respondWithResult(_0xdb9fc8,null))['catch'](handleError(_0xdb9fc8,null));};exports[_0x7e2b('0x5b')]=function(_0x118a33,_0x5ea5ba){return db[_0x7e2b('0x57')]['create'](_0x118a33[_0x7e2b('0x5c')],{})['then'](function(_0x43b4a1){var _0xe9b127=_0x118a33['user'][_0x7e2b('0x5d')]({'plain':!![]});if(!_0xe9b127)throw new Error(_0x7e2b('0x5e'));if(_0xe9b127[_0x7e2b('0x5f')]===_0x7e2b('0x60')){var _0xc91c0=_0x43b4a1[_0x7e2b('0x5d')]({'plain':!![]});var _0x8ecd0a=_0x7e2b('0x36');return db[_0x7e2b('0x61')]['find']({'where':{'name':_0x8ecd0a,'userProfileId':_0xe9b127[_0x7e2b('0x62')]},'raw':!![]})[_0x7e2b('0x1f')](function(_0x1ef6be){if(_0x1ef6be&&_0x1ef6be[_0x7e2b('0x63')]===0x0){return db[_0x7e2b('0x37')][_0x7e2b('0x5b')]({'name':_0xc91c0['name'],'resourceId':_0xc91c0['id'],'type':_0x1ef6be[_0x7e2b('0x3c')],'sectionId':_0x1ef6be['id']},{})['then'](function(){return _0x43b4a1;});}else{return _0x43b4a1;}})[_0x7e2b('0x2a')](function(_0x2a345d){logger[_0x7e2b('0x25')](_0x7e2b('0x64'),_0x2a345d);throw _0x2a345d;});}return _0x43b4a1;})[_0x7e2b('0x1f')](respondWithResult(_0x5ea5ba,0xc9))[_0x7e2b('0x2a')](handleError(_0x5ea5ba,null));};exports[_0x7e2b('0x35')]=function(_0x45646b,_0x5ce7b9){if(_0x45646b[_0x7e2b('0x5c')]['id']){delete _0x45646b['body']['id'];}return db[_0x7e2b('0x57')][_0x7e2b('0x5a')]({'where':{'id':_0x45646b[_0x7e2b('0x65')]['id']},'include':[{'model':db[_0x7e2b('0x3e')],'as':_0x7e2b('0x3f')}]})[_0x7e2b('0x1f')](handleEntityNotFound(_0x5ce7b9,null))['then'](saveUpdates(_0x45646b['body'],null))[_0x7e2b('0x1f')](respondWithResult(_0x5ce7b9,null))[_0x7e2b('0x2a')](handleError(_0x5ce7b9,null));};exports['destroy']=function(_0x889e99,_0x402d99){return db[_0x7e2b('0x57')][_0x7e2b('0x5a')]({'where':{'id':_0x889e99[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x402d99,null))[_0x7e2b('0x1f')](removeEntity(_0x402d99,null))[_0x7e2b('0x2a')](handleError(_0x402d99,null));};exports[_0x7e2b('0x66')]=function(_0x3ba047,_0x26ff52){return db['SmsAccount'][_0x7e2b('0x66')]()[_0x7e2b('0x1f')](respondWithResult(_0x26ff52,null))[_0x7e2b('0x2a')](handleError(_0x26ff52,null));};exports['addDisposition']=function(_0x58d0fd,_0x3573c5,_0x2b3543){if(_0x58d0fd[_0x7e2b('0x5c')]['id']){delete _0x58d0fd['body']['id'];}return db['SmsAccount'][_0x7e2b('0x5a')]({'where':{'id':_0x58d0fd[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x3573c5,null))['then'](function(_0x50e185){if(_0x50e185){_0x58d0fd[_0x7e2b('0x5c')]['SmsAccountId']=_0x50e185['id'];return db['Disposition'][_0x7e2b('0x5b')](_0x58d0fd[_0x7e2b('0x5c')]);}})[_0x7e2b('0x1f')](respondWithResult(_0x3573c5,null))[_0x7e2b('0x2a')](handleError(_0x3573c5,null));};exports['getDispositions']=function(_0x12c6a5,_0x33b08f,_0x11119a){var _0x2f73a4={'raw':![],'where':{}};var _0x4c231b={};var _0x96a62c={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7e2b('0x67')]({'where':{'id':_0x12c6a5[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x33b08f,null))['then'](function(_0x210b1d){if(_0x210b1d){_0x4c231b[_0x7e2b('0x42')]=_[_0x7e2b('0x44')](db[_0x7e2b('0x68')]['rawAttributes']);_0x4c231b['query']=_['keys'](_0x12c6a5['query']);_0x4c231b[_0x7e2b('0x45')]=_[_0x7e2b('0x47')](_0x4c231b[_0x7e2b('0x42')],_0x4c231b['query']);_0x2f73a4[_0x7e2b('0x46')]=_[_0x7e2b('0x47')](_0x4c231b[_0x7e2b('0x42')],qs[_0x7e2b('0x48')](_0x12c6a5[_0x7e2b('0x4a')][_0x7e2b('0x48')]));_0x2f73a4['attributes']=_0x2f73a4[_0x7e2b('0x46')][_0x7e2b('0x49')]?_0x2f73a4[_0x7e2b('0x46')]:_0x4c231b['model'];if(!_0x12c6a5[_0x7e2b('0x4a')]['hasOwnProperty'](_0x7e2b('0x69'))){_0x2f73a4[_0x7e2b('0x2f')]=qs[_0x7e2b('0x2f')](_0x12c6a5[_0x7e2b('0x4a')][_0x7e2b('0x2f')]);_0x2f73a4[_0x7e2b('0x2d')]=qs['offset'](_0x12c6a5[_0x7e2b('0x4a')]['offset']);}_0x2f73a4[_0x7e2b('0x6a')]=qs[_0x7e2b('0x4c')](_0x12c6a5[_0x7e2b('0x4a')][_0x7e2b('0x4c')]);_0x2f73a4[_0x7e2b('0x4d')]=qs[_0x7e2b('0x45')](_['pick'](_0x12c6a5['query'],_0x4c231b['filters']));_0x2f73a4[_0x7e2b('0x4d')][_0x7e2b('0x6b')]=_0x210b1d['id'];if(_0x12c6a5[_0x7e2b('0x4a')][_0x7e2b('0x4f')]){_0x2f73a4['where']=_[_0x7e2b('0x50')](_0x2f73a4[_0x7e2b('0x4d')],{'$or':_[_0x7e2b('0x43')](_0x2f73a4[_0x7e2b('0x46')],function(_0x1bd70a){var _0x1b74b7={};_0x1b74b7[_0x1bd70a]={'$like':'%'+_0x12c6a5[_0x7e2b('0x4a')][_0x7e2b('0x4f')]+'%'};return _0x1b74b7;})});}_0x2f73a4=_[_0x7e2b('0x50')]({},_0x2f73a4,_0x12c6a5[_0x7e2b('0x59')]);return db[_0x7e2b('0x68')][_0x7e2b('0x30')]({'where':_0x2f73a4[_0x7e2b('0x4d')]})[_0x7e2b('0x1f')](function(_0x11d8a1){_0x96a62c[_0x7e2b('0x30')]=_0x11d8a1;if(_0x12c6a5[_0x7e2b('0x4a')][_0x7e2b('0x52')]){_0x2f73a4['include']=[{'all':!![]}];}return db[_0x7e2b('0x68')][_0x7e2b('0x54')](_0x2f73a4);})['then'](function(_0x56ba63){_0x96a62c['rows']=_0x56ba63;return _0x96a62c;});}})[_0x7e2b('0x1f')](respondWithFilteredResult(_0x33b08f,_0x2f73a4))['catch'](handleError(_0x33b08f,null));};exports[_0x7e2b('0x6c')]=function(_0xecfd24,_0x132949,_0x42820d){return db[_0x7e2b('0x57')][_0x7e2b('0x5a')]({'where':{'id':_0xecfd24[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x132949,null))[_0x7e2b('0x1f')](function(_0x536d58){if(_0x536d58){return _0x536d58['removeDispositions'](_0xecfd24['query']['ids']);}})['then'](respondWithStatusCode(_0x132949,null))['catch'](handleError(_0x132949,null));};exports[_0x7e2b('0x6d')]=function(_0x1efd57,_0x2e79e6,_0x178215){if(_0x1efd57[_0x7e2b('0x5c')]['id']){delete _0x1efd57[_0x7e2b('0x5c')]['id'];}return db[_0x7e2b('0x57')][_0x7e2b('0x5a')]({'where':{'id':_0x1efd57[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x2e79e6,null))[_0x7e2b('0x1f')](function(_0x1661cd){if(_0x1661cd){_0x1efd57[_0x7e2b('0x5c')][_0x7e2b('0x6b')]=_0x1661cd['id'];return db['CannedAnswer']['create'](_0x1efd57[_0x7e2b('0x5c')]);}})[_0x7e2b('0x1f')](respondWithResult(_0x2e79e6,null))[_0x7e2b('0x2a')](handleError(_0x2e79e6,null));};exports[_0x7e2b('0x6e')]=function(_0x2dab88,_0x4e57f6,_0x584f98){var _0x46ca90={'raw':![],'where':{}};var _0x574a16={};var _0x1cb706={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7e2b('0x67')]({'where':{'id':_0x2dab88[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x4e57f6,null))[_0x7e2b('0x1f')](function(_0x95b495){if(_0x95b495){_0x574a16[_0x7e2b('0x42')]=_[_0x7e2b('0x44')](db[_0x7e2b('0x6f')][_0x7e2b('0x58')]);_0x574a16[_0x7e2b('0x4a')]=_[_0x7e2b('0x44')](_0x2dab88['query']);_0x574a16[_0x7e2b('0x45')]=_['intersection'](_0x574a16['model'],_0x574a16[_0x7e2b('0x4a')]);_0x46ca90[_0x7e2b('0x46')]=_['intersection'](_0x574a16[_0x7e2b('0x42')],qs[_0x7e2b('0x48')](_0x2dab88[_0x7e2b('0x4a')][_0x7e2b('0x48')]));_0x46ca90[_0x7e2b('0x46')]=_0x46ca90[_0x7e2b('0x46')][_0x7e2b('0x49')]?_0x46ca90[_0x7e2b('0x46')]:_0x574a16[_0x7e2b('0x42')];if(!_0x2dab88[_0x7e2b('0x4a')][_0x7e2b('0x4b')](_0x7e2b('0x69'))){_0x46ca90['limit']=qs[_0x7e2b('0x2f')](_0x2dab88[_0x7e2b('0x4a')][_0x7e2b('0x2f')]);_0x46ca90[_0x7e2b('0x2d')]=qs[_0x7e2b('0x2d')](_0x2dab88[_0x7e2b('0x4a')]['offset']);}_0x46ca90[_0x7e2b('0x6a')]=qs['sort'](_0x2dab88[_0x7e2b('0x4a')]['sort']);_0x46ca90[_0x7e2b('0x4d')]=qs[_0x7e2b('0x45')](_[_0x7e2b('0x4e')](_0x2dab88[_0x7e2b('0x4a')],_0x574a16['filters']));_0x46ca90['where'][_0x7e2b('0x6b')]=_0x95b495['id'];if(_0x2dab88[_0x7e2b('0x4a')][_0x7e2b('0x4f')]){_0x46ca90['where']=_[_0x7e2b('0x50')](_0x46ca90[_0x7e2b('0x4d')],{'$or':_['map'](_0x46ca90[_0x7e2b('0x46')],function(_0x4015a8){var _0x447571={};_0x447571[_0x4015a8]={'$like':'%'+_0x2dab88[_0x7e2b('0x4a')]['filter']+'%'};return _0x447571;})});}_0x46ca90=_['merge']({},_0x46ca90,_0x2dab88[_0x7e2b('0x59')]);return db['CannedAnswer'][_0x7e2b('0x30')]({'where':_0x46ca90['where']})[_0x7e2b('0x1f')](function(_0x38cdde){_0x1cb706[_0x7e2b('0x30')]=_0x38cdde;if(_0x2dab88[_0x7e2b('0x4a')][_0x7e2b('0x52')]){_0x46ca90['include']=[{'all':!![]}];}return db[_0x7e2b('0x6f')][_0x7e2b('0x54')](_0x46ca90);})[_0x7e2b('0x1f')](function(_0x4b9e4b){_0x1cb706['rows']=_0x4b9e4b;return _0x1cb706;});}})['then'](respondWithFilteredResult(_0x4e57f6,_0x46ca90))[_0x7e2b('0x2a')](handleError(_0x4e57f6,null));};exports['removeAnswers']=function(_0x32f0fb,_0x2fbc5e,_0x5683ba){return db[_0x7e2b('0x57')][_0x7e2b('0x5a')]({'where':{'id':_0x32f0fb['params']['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x2fbc5e,null))[_0x7e2b('0x1f')](function(_0x209714){if(_0x209714){return _0x209714['removeAnswers'](_0x32f0fb['query'][_0x7e2b('0x70')]);}})[_0x7e2b('0x1f')](respondWithStatusCode(_0x2fbc5e,null))[_0x7e2b('0x2a')](handleError(_0x2fbc5e,null));};exports[_0x7e2b('0x71')]=function(_0xf8f821,_0x163bca,_0x46180d){var _0x279537={'channel':_0x7e2b('0x72')};var _0x879628=[];var _0x409501=[];var _0x2c4295={};return db[_0x7e2b('0x57')][_0x7e2b('0x5a')]({'where':{'id':_0xf8f821[_0x7e2b('0x65')]['id']},'include':[{'model':db[_0x7e2b('0x73')],'as':_0x7e2b('0x74')}]})[_0x7e2b('0x1f')](handleEntityNotFound(_0x163bca,null))[_0x7e2b('0x1f')](function(_0x278302){_0x279537['account']=_0x278302;_0x279537[_0x7e2b('0x75')]=_['orderBy'](_0x278302[_0x7e2b('0x74')],[_0x7e2b('0x76')],[_0x7e2b('0x77')]);if(_0x279537[_0x7e2b('0x78')][_0x7e2b('0x74')]){delete _0x279537['account'][_0x7e2b('0x74')];}return db['CmContact'][_0x7e2b('0x66')]();})[_0x7e2b('0x1f')](function(_0x5b85dd){if(!_0x5b85dd){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x879628=_[_0x7e2b('0x79')](_[_0x7e2b('0x44')](_0x5b85dd),[_0x7e2b('0x7a'),_0x7e2b('0x7b')]);_0x409501=_[_0x7e2b('0x79')](_[_0x7e2b('0x44')](_0x5b85dd),['createdAt',_0x7e2b('0x7b'),_0x7e2b('0x7c'),'ListId']);_0x279537[_0x7e2b('0x5c')]={'mapKey':_0x7e2b('0x7d')};if(_0x279537['account']['type']){switch(_0x279537[_0x7e2b('0x78')]['type']){case'twilio':_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x7f')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')]=_0xf8f821['body']['Body'];_0x279537['body'][_0x7e2b('0x80')]=_0xf8f821['body'][_0x7e2b('0x81')];break;case _0x7e2b('0x82'):_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')]='+'+_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x83')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x84')];break;case _0x7e2b('0x85'):_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x7e')];_0x279537[_0x7e2b('0x5c')]['body']=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x28')];break;case _0x7e2b('0x86'):_0x279537['body'][_0x7e2b('0x7e')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x7e')];_0x279537['body'][_0x7e2b('0x5c')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x5c')];_0x279537['body']['messageId']=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x87')];break;case _0x7e2b('0x88'):_0x279537['body'][_0x7e2b('0x7e')]=_0xf8f821['body'][_0x7e2b('0x7f')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x89')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x80')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x8a')];break;case _0x7e2b('0x8b'):_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')]='+'+_0xf8f821[_0x7e2b('0x5c')]['results'][0x0][_0x7e2b('0x7e')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')]=_0xf8f821['body']['results'][0x0][_0x7e2b('0x84')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x80')]=_0xf8f821['body'][_0x7e2b('0x8c')][0x0][_0x7e2b('0x80')];break;case'csc':_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x8d')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x8e')][_0x7e2b('0x28')];break;case'clickatell':_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')]=_0xf8f821[_0x7e2b('0x5c')]['fromNumber'];_0x279537[_0x7e2b('0x5c')]['body']=_0xf8f821['body'][_0x7e2b('0x84')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x80')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x8f')];break;case _0x7e2b('0x90'):_0x279537['body'][_0x7e2b('0x80')]=_0xf8f821[_0x7e2b('0x5c')][0x0][_0x7e2b('0x28')]['id'];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')]=_0xf8f821[_0x7e2b('0x5c')][0x0]['message'][_0x7e2b('0x7e')];_0x279537['body'][_0x7e2b('0x5c')]=_0xf8f821[_0x7e2b('0x5c')][0x0][_0x7e2b('0x28')][_0x7e2b('0x84')];break;case _0x7e2b('0x91'):_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x7e')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')]=_0xf8f821['body'][_0x7e2b('0x28')];_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x80')]=_0xf8f821[_0x7e2b('0x5c')][_0x7e2b('0x92')];break;}}if(_0x279537['body']['id']){delete _0x279537[_0x7e2b('0x5c')]['id'];}if(_[_0x7e2b('0x93')](_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')])){throw new db[(_0x7e2b('0x94'))]['ValidationError'](_0x7e2b('0x95'));}if(_[_0x7e2b('0x93')](_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')])||_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')]===''){throw new db[(_0x7e2b('0x94'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7e2b('0x93')](_0x279537['body'][_0x7e2b('0x96')])){throw new db[(_0x7e2b('0x94'))][(_0x7e2b('0x97'))](_0x7e2b('0x98')+_0x409501);}if(!_[_0x7e2b('0x99')](_0x409501,_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x96')])){throw new db['Sequelize'][(_0x7e2b('0x97'))](_0x7e2b('0x9a')+_0x409501);}_0x2c4295[_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x96')]]=_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')];return db[_0x7e2b('0x9b')]['find']({'where':{'id':_0x279537[_0x7e2b('0x78')]['ListId']},'include':[{'model':db[_0x7e2b('0x9c')],'as':'Contacts','where':_0x2c4295,'limit':0x1,'order':[[_0x7e2b('0x7b'),_0x7e2b('0x9d')]]}]});})[_0x7e2b('0x1f')](handleEntityNotFound(_0x163bca,null))[_0x7e2b('0x1f')](function(_0x5b612c){if(_0x5b612c){_0x279537[_0x7e2b('0x9e')]=_[_0x7e2b('0x9f')](_0x5b612c,[_0x7e2b('0xa0')]);if(_0x5b612c[_0x7e2b('0xa0')]['length']){return _0x5b612c[_0x7e2b('0xa0')][0x0];}var _0x4ca4de=_[_0x7e2b('0xa1')](_0x279537[_0x7e2b('0x5c')],{'firstName':_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')],'ListId':_0x5b612c['id']});_0x4ca4de[_0x279537[_0x7e2b('0x5c')]['mapKey']]=_0x279537[_0x7e2b('0x5c')]['from'];return db[_0x7e2b('0x9c')][_0x7e2b('0x5b')](_0x4ca4de,{'fields':_0x879628,'raw':!![]});}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x163bca,null))[_0x7e2b('0x1f')](function(_0x405d81){if(_0x405d81){_0x279537[_0x7e2b('0xa2')]=_0x405d81;var _0x595b28={'ContactId':_0x405d81['id'],'phone':_0x279537['body']['from'],'SmsAccountId':_0xf8f821[_0x7e2b('0x65')]['id']};var _0x4e602c={'ContactId':_0x405d81['id'],'SmsAccountId':_0xf8f821['params']['id'],'closed':![]};return db[_0x7e2b('0xa3')]['find']({'where':_0x4e602c})[_0x7e2b('0x1f')](function(_0x11dd97){if(_0x11dd97){return[_0x11dd97,![]];}return db[_0x7e2b('0xa3')][_0x7e2b('0x5b')](_0x595b28)['then'](function(_0xa37eb8){return[_0xa37eb8,!![]];});});}})[_0x7e2b('0xa4')](function(_0x4dcb5e,_0x4c1422){_0x279537[_0x7e2b('0xa5')]=_0x4dcb5e[_0x7e2b('0x5d')]({'plain':!![]});_0x279537['interaction']['created']=![];if(_0x4c1422){if(_0x279537[_0x7e2b('0x78')][_0x7e2b('0xa6')]){_0x279537['applications']['push']({'id':0x0,'priority':_0x279537['applications'][_0x7e2b('0x49')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x279537['interaction'][_0x7e2b('0xa7')]=!![];}return db['SmsMessage'][_0x7e2b('0x5b')]({'phone':_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x7e')],'messageId':_0x279537['body']['messageId'],'body':_0x279537[_0x7e2b('0x5c')][_0x7e2b('0x5c')],'SmsAccountId':_0xf8f821[_0x7e2b('0x65')]['id'],'SmsInteractionId':_0x4dcb5e['id'],'direction':'in','ContactId':_0x4dcb5e[_0x7e2b('0xa8')],'AttachmentId':_0x279537['body'][_0x7e2b('0xa9')]});})['then'](function(_0x432844){_0x279537[_0x7e2b('0x28')]=_0x432844;if(!_0x279537[_0x7e2b('0xa5')][_0x7e2b('0xaa')])return;return db['User'][_0x7e2b('0x5a')]({'attributes':['id','name'],'where':{'id':_0x279537['interaction'][_0x7e2b('0xaa')]}});})[_0x7e2b('0x1f')](function(_0x1b32fc){if(_0x1b32fc){_0x279537['applications'][_0x7e2b('0xab')]({'id':0x0,'priority':0x0,'app':_0x7e2b('0xac'),'appdata':_0x1b32fc['name']+','+(_0x279537[_0x7e2b('0x78')][_0x7e2b('0xad')]||0xa),'interval':_0x7e2b('0xae')});}if(!_0x279537[_0x7e2b('0xa5')][_0x7e2b('0xaf')])return;return db[_0x7e2b('0xb0')][_0x7e2b('0x5a')]({'attributes':['id','name'],'where':{'id':_0x279537[_0x7e2b('0xa5')][_0x7e2b('0xaf')]}});})[_0x7e2b('0x1f')](function(_0x280e17){if(_0x280e17){_0x279537[_0x7e2b('0x75')][_0x7e2b('0xab')]({'id':0x0,'priority':0x1,'app':_0x7e2b('0xb1'),'appdata':_0x280e17[_0x7e2b('0x3c')]+','+(_0x279537[_0x7e2b('0x78')][_0x7e2b('0xb2')]||0x12c),'interval':_0x7e2b('0xae')});}return respondWithRpcPromise(_0x7e2b('0xb3'),_0x7e2b('0xb4'),_0x279537);})[_0x7e2b('0x1f')](function(_0x11be25){if(_0x11be25){var _0x162ba9=0xc8;var _0x32c30f=_0x7e2b('0xb5');logger[_0x7e2b('0x20')](_0x7e2b('0x23'),_0x32c30f,_0x162ba9,_0x7e2b('0xb6'));logger[_0x7e2b('0x22')](_0x7e2b('0xb7'),_0x32c30f,_0x162ba9,_0x7e2b('0xb6'),JSON['stringify'](_0x11be25));if(_0x279537['account'][_0x7e2b('0x41')]==='twilio'){return _0x163bca['status'](_0x162ba9)[_0x7e2b('0x31')](_0x7e2b('0xb8'),_0x7e2b('0xb9'))[_0x7e2b('0xba')](_0x7e2b('0xbb'));}else{return _0x163bca[_0x7e2b('0x2b')](_0x162ba9)[_0x7e2b('0x2c')](_0x11be25);}}})[_0x7e2b('0x2a')](handleError(_0x163bca,null));};exports[_0x7e2b('0xbc')]=function(_0x209687,_0x51c338){var _0x5cda4f=_0x209687[_0x7e2b('0x65')]['id'];var _0x1ea13b=_0x209687[_0x7e2b('0x5c')];var _0x474647=0xc8;var _0x3de6b7=null;return db[_0x7e2b('0xbd')][_0x7e2b('0xbe')]({'isolationLevel':db[_0x7e2b('0xbd')][_0x7e2b('0xbf')][_0x7e2b('0xc0')][_0x7e2b('0xc1')]},function(_0x1c50fa){return db[_0x7e2b('0x57')]['findOne']({'where':{'id':_0x5cda4f},'transaction':_0x1c50fa})['then'](function(_0x462638){if(_0x462638){return db[_0x7e2b('0x73')]['destroy']({'where':{'SmsAccountId':_0x5cda4f},'transaction':_0x1c50fa})[_0x7e2b('0x1f')](function(){var _0x2c21b3=_['map'](_0x1ea13b,function(_0x4021fa){_0x4021fa['SmsAccountId']=_0x5cda4f;return _0x4021fa;});return db['SmsApplication']['bulkCreate'](_0x2c21b3,{'transaction':_0x1c50fa});});}else{_0x474647=0x194;_0x3de6b7=[];}});})['then'](function(){if(_0x474647!==0x194){return db[_0x7e2b('0x73')][_0x7e2b('0xc2')]({'where':{'SmsAccountId':_0x5cda4f},'order':_0x7e2b('0x76')})[_0x7e2b('0x1f')](function(_0x285099){_0x3de6b7=_0x285099;});}})[_0x7e2b('0x2a')](function(_0x243fd8){_0x474647=0x1f4;logger[_0x7e2b('0x25')](_0x243fd8[_0x7e2b('0x3b')]);if(_0x243fd8['name']){delete _0x243fd8['name'];}_0x3de6b7=_0x243fd8;})[_0x7e2b('0xc3')](function(){if(_0x3de6b7===null){_0x51c338[_0x7e2b('0x3a')](_0x474647);}else{if(_0x474647===0x1f4){_0x51c338[_0x7e2b('0x2b')](_0x474647)['send'](_0x3de6b7);}else{_0x51c338['status'](_0x474647)['json'](_0x3de6b7);}}});};exports[_0x7e2b('0xc4')]=function(_0x5dd125,_0x2bce49,_0x22a08d){var _0x21b4d0={};var _0x19eb3e={};var _0x49a728;var _0x34e033;return db[_0x7e2b('0x57')][_0x7e2b('0x67')]({'where':{'id':_0x5dd125[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x2bce49,null))[_0x7e2b('0x1f')](function(_0x225708){if(_0x225708){_0x49a728=_0x225708;_0x19eb3e[_0x7e2b('0x42')]=_['keys'](db[_0x7e2b('0x73')]['rawAttributes']);_0x19eb3e['query']=_[_0x7e2b('0x44')](_0x5dd125[_0x7e2b('0x4a')]);_0x19eb3e[_0x7e2b('0x45')]=_[_0x7e2b('0x47')](_0x19eb3e[_0x7e2b('0x42')],_0x19eb3e[_0x7e2b('0x4a')]);_0x21b4d0[_0x7e2b('0x46')]=_[_0x7e2b('0x47')](_0x19eb3e['model'],qs['fields'](_0x5dd125[_0x7e2b('0x4a')][_0x7e2b('0x48')]));_0x21b4d0[_0x7e2b('0x46')]=_0x21b4d0[_0x7e2b('0x46')][_0x7e2b('0x49')]?_0x21b4d0[_0x7e2b('0x46')]:_0x19eb3e['model'];_0x21b4d0[_0x7e2b('0x6a')]=qs[_0x7e2b('0x4c')](_0x5dd125['query'][_0x7e2b('0x4c')]);_0x21b4d0['where']=qs[_0x7e2b('0x45')](_[_0x7e2b('0x4e')](_0x5dd125[_0x7e2b('0x4a')],_0x19eb3e['filters']));if(_0x5dd125[_0x7e2b('0x4a')]['filter']){_0x21b4d0[_0x7e2b('0x4d')]=_[_0x7e2b('0x50')](_0x21b4d0[_0x7e2b('0x4d')],{'$or':_[_0x7e2b('0x43')](_0x21b4d0[_0x7e2b('0x46')],function(_0x3104c0){var _0x4e4215={};_0x4e4215[_0x3104c0]={'$like':'%'+_0x5dd125[_0x7e2b('0x4a')][_0x7e2b('0x4f')]+'%'};return _0x4e4215;})});}_0x21b4d0=_[_0x7e2b('0x50')]({},_0x21b4d0,_0x5dd125[_0x7e2b('0x59')]);return _0x49a728[_0x7e2b('0xc4')](_0x21b4d0);}})[_0x7e2b('0x1f')](function(_0x4324d1){if(_0x4324d1){_0x34e033=_0x4324d1[_0x7e2b('0x49')];if(!_0x5dd125[_0x7e2b('0x4a')][_0x7e2b('0x4b')](_0x7e2b('0x69'))){_0x21b4d0[_0x7e2b('0x2f')]=qs['limit'](_0x5dd125['query']['limit']);_0x21b4d0[_0x7e2b('0x2d')]=qs[_0x7e2b('0x2d')](_0x5dd125[_0x7e2b('0x4a')]['offset']);}return _0x49a728[_0x7e2b('0xc4')](_0x21b4d0);}})['then'](function(_0x54f065){if(_0x54f065){return _0x54f065?{'count':_0x34e033,'rows':_0x54f065}:null;}})[_0x7e2b('0x1f')](respondWithResult(_0x2bce49,null))[_0x7e2b('0x2a')](handleError(_0x2bce49,null));};exports[_0x7e2b('0xc5')]=function(_0x36d693,_0x6d2b17,_0x33063b){var _0x5814f7={'raw':![],'where':{}};var _0x19c88d={};var _0x251843={'count':0x0,'rows':[]};return db[_0x7e2b('0x57')][_0x7e2b('0x67')]({'where':{'id':_0x36d693[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x6d2b17,null))['then'](function(_0x449159){if(_0x449159){_0x19c88d[_0x7e2b('0x42')]=_[_0x7e2b('0x44')](db[_0x7e2b('0xa3')][_0x7e2b('0x58')]);_0x19c88d[_0x7e2b('0x4a')]=_[_0x7e2b('0x44')](_0x36d693[_0x7e2b('0x4a')]);_0x19c88d[_0x7e2b('0x45')]=_[_0x7e2b('0x47')](_0x19c88d[_0x7e2b('0x42')],_0x19c88d['query']);_0x5814f7[_0x7e2b('0x46')]=_[_0x7e2b('0x47')](_0x19c88d['model'],qs['fields'](_0x36d693[_0x7e2b('0x4a')]['fields']));_0x5814f7[_0x7e2b('0x46')]=_0x5814f7[_0x7e2b('0x46')][_0x7e2b('0x49')]?_0x5814f7['attributes']:_0x19c88d['model'];if(!_0x36d693['query'][_0x7e2b('0x4b')]('nolimit')){_0x5814f7[_0x7e2b('0x2f')]=qs[_0x7e2b('0x2f')](_0x36d693[_0x7e2b('0x4a')][_0x7e2b('0x2f')]);_0x5814f7[_0x7e2b('0x2d')]=qs['offset'](_0x36d693[_0x7e2b('0x4a')][_0x7e2b('0x2d')]);}_0x5814f7[_0x7e2b('0x6a')]=qs[_0x7e2b('0x4c')](_0x36d693[_0x7e2b('0x4a')][_0x7e2b('0x4c')]);_0x5814f7[_0x7e2b('0x4d')]=qs[_0x7e2b('0x45')](_['pick'](_0x36d693[_0x7e2b('0x4a')],_0x19c88d['filters']));_0x5814f7[_0x7e2b('0x4d')][_0x7e2b('0x6b')]=_0x449159['id'];if(_0x36d693['query']['filter']){_0x5814f7[_0x7e2b('0x4d')]=_[_0x7e2b('0x50')](_0x5814f7[_0x7e2b('0x4d')],{'$or':_[_0x7e2b('0x43')](_0x5814f7[_0x7e2b('0x46')],function(_0x28c557){var _0x3476db={};_0x3476db[_0x28c557]={'$like':'%'+_0x36d693['query'][_0x7e2b('0x4f')]+'%'};return _0x3476db;})});}_0x5814f7=_[_0x7e2b('0x50')]({},_0x5814f7,_0x36d693[_0x7e2b('0x59')]);return db[_0x7e2b('0xa3')][_0x7e2b('0x30')]({'where':_0x5814f7['where']})[_0x7e2b('0x1f')](function(_0x2e19a5){_0x251843[_0x7e2b('0x30')]=_0x2e19a5;if(_0x36d693[_0x7e2b('0x4a')][_0x7e2b('0x52')]){_0x5814f7['include']=[{'model':db[_0x7e2b('0x9c')],'as':_0x7e2b('0xc6'),'required':![]},{'model':db[_0x7e2b('0xc7')],'as':_0x7e2b('0xc8'),'attributes':[_0x7e2b('0x3c'),_0x7e2b('0xc9'),'internal'],'required':![]},{'model':db[_0x7e2b('0xca')],'as':_0x7e2b('0xcb'),'attributes':['id','name',_0x7e2b('0xcc')],'where':_0x36d693['query'][_0x7e2b('0xcd')]?{'id':_0x36d693[_0x7e2b('0x4a')][_0x7e2b('0xcd')]}:undefined,'required':_0x36d693[_0x7e2b('0x4a')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x5814f7);})['then'](function(_0xc0b6c4){_0x251843['rows']=_0xc0b6c4;return _0x251843;});}})[_0x7e2b('0x1f')](respondWithFilteredResult(_0x6d2b17,_0x5814f7))[_0x7e2b('0x2a')](handleError(_0x6d2b17,null));};exports['send']=function(_0x1c9813,_0x36d2d9,_0x26e59b){var _0x3895e8,_0x5abfe3,_0x156e2e;if(_[_0x7e2b('0x93')](_0x1c9813[_0x7e2b('0x5c')][_0x7e2b('0x5c')])||_0x1c9813['body'][_0x7e2b('0x5c')]===''){throw new db[(_0x7e2b('0x94'))][(_0x7e2b('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1c9813[_0x7e2b('0x5c')]['to'])){throw new db[(_0x7e2b('0x94'))][(_0x7e2b('0x97'))]('to\x20is\x20mandatory');}_0x3895e8=_0x1c9813[_0x7e2b('0x5c')]['to'];return db[_0x7e2b('0x57')]['find']({'where':{'id':_0x1c9813['params']['id']},'include':[{'model':db[_0x7e2b('0x9b')],'as':_0x7e2b('0xce'),'include':[{'model':db['CmContact'],'as':_0x7e2b('0xa0'),'where':{'mobile':_0x3895e8},'limit':0x1,'order':[[_0x7e2b('0x7b'),_0x7e2b('0x9d')]]}]}]})[_0x7e2b('0x1f')](handleEntityNotFound(_0x36d2d9,null))['then'](function(_0x5e1f9d){if(_0x5e1f9d&&_0x5e1f9d[_0x7e2b('0xce')]){_0x5abfe3=_0x5e1f9d[_0x7e2b('0x5d')]({'plain':!![]});if(_0x5abfe3[_0x7e2b('0xce')]&&_0x5abfe3[_0x7e2b('0xce')][_0x7e2b('0xa0')]['length']){return _0x5abfe3[_0x7e2b('0xce')][_0x7e2b('0xa0')][0x0];}return db[_0x7e2b('0x9c')][_0x7e2b('0x5b')](_['defaults'](_0x1c9813[_0x7e2b('0x5c')],{'firstName':_0x3895e8,'mobile':_0x3895e8,'phone':_0x3895e8,'ListId':_0x5abfe3['ListId']}));}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x36d2d9,null))[_0x7e2b('0x1f')](function(_0xe1014d){if(_0xe1014d){_0x156e2e=_0xe1014d;return db[_0x7e2b('0xa3')]['find']({'where':{'ContactId':_0x156e2e['id'],'closed':![],'SmsAccountId':_0x5abfe3['id']}})['then'](function(_0x4ce9a3){if(_0x4ce9a3){return[_0x4ce9a3,![]];}return db['SmsInteraction'][_0x7e2b('0x5b')]({'UserId':_0x1c9813[_0x7e2b('0x60')]['id'],'ContactId':_0x156e2e['id'],'SmsAccountId':_0x5abfe3['id'],'phone':_0x3895e8,'firstMsgDirection':_0x7e2b('0xcf'),'Messages':[_['merge'](_0x1c9813[_0x7e2b('0x5c')],{'read':![],'body':_0x1c9813[_0x7e2b('0x5c')][_0x7e2b('0x5c')],'phone':_0x3895e8,'SmsAccountId':_0x5abfe3['id'],'UserId':_0x1c9813[_0x7e2b('0x60')]['id'],'ContactId':_0x156e2e['id']})]},{'include':[{'model':db[_0x7e2b('0xd0')],'as':_0x7e2b('0xd1')}]})['then'](function(_0x4af7c5){return[_0x4af7c5,!![]];});});}})[_0x7e2b('0xa4')](function(_0x11f0df,_0x2e6c71){if(_0x2e6c71){return _0x11f0df;}return db['SmsMessage'][_0x7e2b('0x5b')](_[_0x7e2b('0x50')](_0x1c9813[_0x7e2b('0x5c')],{'read':![],'body':_0x1c9813['body'][_0x7e2b('0x5c')],'phone':_0x3895e8,'SmsAccountId':_0x5abfe3['id'],'SmsInteractionId':_0x11f0df['id'],'UserId':_0x1c9813[_0x7e2b('0x60')]['id'],'ContactId':_0x156e2e['id']}))[_0x7e2b('0x1f')](function(_0x76ee4e){_0x11f0df[_0x7e2b('0xd2')][_0x7e2b('0xd1')]=[];_0x11f0df['dataValues'][_0x7e2b('0xd1')][_0x7e2b('0xd3')](_0x76ee4e[_0x7e2b('0xd2')]);return _0x11f0df;});})[_0x7e2b('0x1f')](respondWithResult(_0x36d2d9,null))[_0x7e2b('0x2a')](handleError(_0x36d2d9,null));};exports[_0x7e2b('0x2b')]=function(_0x6ca32a,_0x149425,_0x334690){if(_0x6ca32a[_0x7e2b('0x5c')]['id']){delete _0x6ca32a[_0x7e2b('0x5c')]['id'];}var _0x1a4ba6,_0x159d41,_0x3efe1d;return db[_0x7e2b('0x57')][_0x7e2b('0x5a')]({'where':{'id':_0x6ca32a[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x149425,null))[_0x7e2b('0x1f')](function(_0x18016e){if(_0x18016e){_0x3efe1d=_0x18016e;logger[_0x7e2b('0x22')](_0x7e2b('0x23'),'status',_0x7e2b('0xd4'),_0x18016e[_0x7e2b('0x41')],util['inspect'](_0x6ca32a[_0x7e2b('0x5c')],{'showHidden':![],'depth':null}));switch(_0x18016e['type']){case _0x7e2b('0x82'):if(_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0xd5')]&&_0x6ca32a[_0x7e2b('0x5c')]['status']){_0x159d41=_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0x2b')];return db[_0x7e2b('0xd0')][_0x7e2b('0x5a')]({'where':{'messageId':_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0xd5')]}});}break;case _0x7e2b('0x85'):if(_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0xd6')]&&_0x6ca32a['body']['statusInt']){_0x159d41=_0x6ca32a['body'][_0x7e2b('0xd7')];return db['SmsMessage'][_0x7e2b('0x5a')]({'where':{'messageId':_0x6ca32a['body'][_0x7e2b('0xd6')]}});}break;case _0x7e2b('0x86'):if(_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0x87')]&&_0x6ca32a['body'][_0x7e2b('0xd8')]){_0x159d41=_0x6ca32a['body'][_0x7e2b('0xd8')];return db[_0x7e2b('0xd0')][_0x7e2b('0x5a')]({'where':{'messageId':_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0x87')]}});}break;case _0x7e2b('0x8b'):var _0x43daab=_0x6ca32a['body'][_0x7e2b('0x8c')][0x0];if(_0x43daab[_0x7e2b('0x80')]&&_0x43daab[_0x7e2b('0x2b')][_0x7e2b('0xd9')]==='DELIVERED'){_0x159d41=_0x43daab[_0x7e2b('0x2b')][_0x7e2b('0xd9')];return db[_0x7e2b('0xd0')][_0x7e2b('0x5a')]({'where':{'messageId':_0x43daab[_0x7e2b('0x80')]}});}break;case _0x7e2b('0xda'):if(_0x6ca32a[_0x7e2b('0x5c')]['messageId']&&_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0x2b')]){_0x159d41=_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0x80')]}});}break;case _0x7e2b('0x90'):if(_0x6ca32a[_0x7e2b('0x5c')][0x0][_0x7e2b('0x28')]['id']){_0x159d41=_0x6ca32a[_0x7e2b('0x5c')][0x0]['type'];return db[_0x7e2b('0xd0')][_0x7e2b('0x5a')]({'where':{'messageId':_0x6ca32a[_0x7e2b('0x5c')][0x0]['message']['id']}});}break;case _0x7e2b('0x91'):if(_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0xdb')]&&_0x6ca32a[_0x7e2b('0x5c')]['status']){_0x159d41=_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0x2b')];return db[_0x7e2b('0xd0')][_0x7e2b('0x5a')]({'where':{'messageId':_0x6ca32a['body'][_0x7e2b('0xdb')]}});}break;}}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x149425,null))['then'](function(_0x233145){if(_0x233145){_0x1a4ba6=_0x233145;switch(_0x3efe1d[_0x7e2b('0x41')]){case _0x7e2b('0x82'):if(_0x159d41===_0x7e2b('0xdc')){return _0x1a4ba6[_0x7e2b('0x35')]({'read':!![]});}else{logger['error'](_0x7e2b('0x23'),_0x7e2b('0x2b'),'skebby',util[_0x7e2b('0xdd')](_0x6ca32a[_0x7e2b('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x159d41==='1'){return _0x1a4ba6[_0x7e2b('0x35')]({'read':!![]});}else{logger[_0x7e2b('0x25')](_0x7e2b('0x23'),_0x7e2b('0x2b'),_0x7e2b('0x82'),util[_0x7e2b('0xdd')](_0x6ca32a[_0x7e2b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x7e2b('0x86'):if(!_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0xde')]&&_0x159d41>=0xc8&&_0x159d41<=0xce){return _0x1a4ba6['update']({'read':!![]});}else{logger['error'](_0x7e2b('0x23'),'status',_0x7e2b('0x86'),util[_0x7e2b('0xdd')](_0x6ca32a[_0x7e2b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x7e2b('0x8b'):var _0x4ed3f9=_0x6ca32a[_0x7e2b('0x5c')][_0x7e2b('0x8c')][0x0];if(_0x4ed3f9[_0x7e2b('0x2b')]['groupName']==='DELIVERED'){return _0x1a4ba6[_0x7e2b('0x35')]({'read':!![]});}else{logger[_0x7e2b('0x25')](_0x7e2b('0x23'),_0x7e2b('0x2b'),_0x7e2b('0x8b'),util['inspect'](_0x6ca32a[_0x7e2b('0x5c')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x159d41=='DELIVERED_TO_GATEWAY'||_0x159d41==_0x7e2b('0xdf')){return _0x1a4ba6[_0x7e2b('0x35')]({'read':!![]});}else{logger[_0x7e2b('0x25')](_0x7e2b('0x23'),_0x7e2b('0x2b'),'clickatell',util[_0x7e2b('0xdd')](_0x6ca32a['body'],{'showHidden':![],'depth':null}));}break;case _0x7e2b('0x90'):if(_0x159d41==_0x7e2b('0xe0')){return _0x1a4ba6['update']({'read':!![]});}else{logger[_0x7e2b('0x25')](_0x7e2b('0x23'),_0x7e2b('0x2b'),_0x7e2b('0x90'),util[_0x7e2b('0xdd')](_0x6ca32a[_0x7e2b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x7e2b('0x91'):if(_0x159d41===_0x7e2b('0xe1')||_0x159d41==='ACCEPTD'){return _0x1a4ba6[_0x7e2b('0x35')]({'read':!![]});}else{logger['error'](_0x7e2b('0x23'),_0x7e2b('0x2b'),_0x7e2b('0x91'),util[_0x7e2b('0xdd')](_0x6ca32a[_0x7e2b('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x1a4ba6;}})['then'](respondWithResult(_0x149425,null))[_0x7e2b('0x2a')](handleError(_0x149425,null));};exports[_0x7e2b('0xe2')]=function(_0x428e66,_0x4f82ad,_0xbf3443){var _0x28b3f7,_0x3a75aa,_0x542af4;return db['SmsAccount']['find']({'where':{'id':_0x428e66['params']['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x4f82ad,null))[_0x7e2b('0x1f')](function(_0x41b978){if(_0x41b978){_0x542af4=_0x41b978;logger[_0x7e2b('0x22')](_0x7e2b('0x23'),_0x7e2b('0x2b'),_0x7e2b('0xd4'),_0x41b978[_0x7e2b('0x41')],util[_0x7e2b('0xdd')](_0x428e66[_0x7e2b('0x4a')],{'showHidden':![],'depth':null}));switch(_0x41b978[_0x7e2b('0x41')]){case _0x7e2b('0xe3'):if(_0x428e66[_0x7e2b('0x4a')][_0x7e2b('0xe4')]&&_0x428e66['query']['state']){_0x3a75aa=_0x428e66['query']['state'];return db['SmsMessage'][_0x7e2b('0x5a')]({'where':{'messageId':_0x428e66[_0x7e2b('0x4a')][_0x7e2b('0xe4')]}});}break;}}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x4f82ad,null))[_0x7e2b('0x1f')](function(_0x54a011){if(_0x54a011){_0x28b3f7=_0x54a011;switch(_0x542af4['type']){case _0x7e2b('0xe3'):if(_0x3a75aa==='2'||_0x3a75aa==='6'){return _0x28b3f7[_0x7e2b('0x35')]({'read':!![]});}else{logger[_0x7e2b('0x25')](_0x7e2b('0x23'),_0x7e2b('0x2b'),_0x7e2b('0xe3'),util[_0x7e2b('0xdd')](_0x428e66[_0x7e2b('0x4a')],{'showHidden':![],'depth':null}));};break;}return _0x28b3f7;}})['then'](respondWithResult(_0x4f82ad,null))[_0x7e2b('0x2a')](handleError(_0x4f82ad,null));};exports['addAgents']=function(_0x80621d,_0x4a04ae,_0x3e3eea){return db['SmsAccount'][_0x7e2b('0x5a')]({'where':{'id':_0x80621d[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x4a04ae,null))[_0x7e2b('0x1f')](function(_0xb12c0e){if(_0xb12c0e){return _0xb12c0e[_0x7e2b('0xe5')](_0x80621d['body']['ids'],_['omit'](_0x80621d[_0x7e2b('0x5c')],['ids','id'])||{})[_0x7e2b('0xa4')](function(_0x487477){for(var _0x47511b=0x0;_0x47511b<_0x80621d[_0x7e2b('0x5c')]['ids']['length'];_0x47511b+=0x1){socket[_0x7e2b('0xe6')](_0x7e2b('0xe7'),{'UserId':Number(_0x80621d[_0x7e2b('0x5c')][_0x7e2b('0x70')][_0x47511b]),'SmsAccountId':Number(_0x80621d[_0x7e2b('0x65')]['id'])});}return _0x487477;});}})[_0x7e2b('0x1f')](respondWithResult(_0x4a04ae,null))[_0x7e2b('0x2a')](handleError(_0x4a04ae,null));};exports[_0x7e2b('0xe8')]=function(_0x14683f,_0x8769e3,_0x3f3421){return db[_0x7e2b('0x57')][_0x7e2b('0x5a')]({'where':{'id':_0x14683f[_0x7e2b('0x65')]['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x8769e3,null))[_0x7e2b('0x1f')](function(_0x21ad0e){if(_0x21ad0e){return _0x21ad0e['removeAgents'](_0x14683f[_0x7e2b('0x4a')][_0x7e2b('0x70')])[_0x7e2b('0x1f')](function(){if(_['isArray'](_0x14683f[_0x7e2b('0x4a')][_0x7e2b('0x70')])){for(var _0x10f73a=0x0;_0x10f73a<_0x14683f['query'][_0x7e2b('0x70')]['length'];_0x10f73a+=0x1){socket[_0x7e2b('0xe6')](_0x7e2b('0xe9'),{'UserId':Number(_0x14683f[_0x7e2b('0x4a')][_0x7e2b('0x70')][_0x10f73a]),'SmsAccountId':Number(_0x14683f[_0x7e2b('0x65')]['id'])});}}else{socket[_0x7e2b('0xe6')](_0x7e2b('0xe9'),{'UserId':Number(_0x14683f[_0x7e2b('0x4a')]['ids']),'SmsAccountId':Number(_0x14683f['params']['id'])});}});}})[_0x7e2b('0x1f')](respondWithStatusCode(_0x8769e3,null))[_0x7e2b('0x2a')](handleError(_0x8769e3,null));};exports[_0x7e2b('0xea')]=function(_0x1e228a,_0x26c30b,_0x4dae71){var _0x58b7d0={};var _0x137496={};var _0x396f28;var _0x437568;return db[_0x7e2b('0x57')]['findOne']({'where':{'id':_0x1e228a['params']['id']}})[_0x7e2b('0x1f')](handleEntityNotFound(_0x26c30b,null))[_0x7e2b('0x1f')](function(_0x50d583){if(_0x50d583){_0x396f28=_0x50d583;_0x137496[_0x7e2b('0x42')]=_[_0x7e2b('0x44')](db[_0x7e2b('0xc7')][_0x7e2b('0x58')]);_0x137496[_0x7e2b('0x4a')]=_[_0x7e2b('0x44')](_0x1e228a[_0x7e2b('0x4a')]);_0x137496['filters']=_[_0x7e2b('0x47')](_0x137496['model'],_0x137496[_0x7e2b('0x4a')]);_0x58b7d0[_0x7e2b('0x46')]=_[_0x7e2b('0x47')](_0x137496['model'],qs['fields'](_0x1e228a[_0x7e2b('0x4a')]['fields']));_0x58b7d0['attributes']=_0x58b7d0[_0x7e2b('0x46')][_0x7e2b('0x49')]?_0x58b7d0[_0x7e2b('0x46')]:_0x137496['model'];_0x58b7d0[_0x7e2b('0x6a')]=qs[_0x7e2b('0x4c')](_0x1e228a[_0x7e2b('0x4a')][_0x7e2b('0x4c')]);_0x58b7d0['where']=qs[_0x7e2b('0x45')](_['pick'](_0x1e228a[_0x7e2b('0x4a')],_0x137496['filters']));if(_0x1e228a[_0x7e2b('0x4a')][_0x7e2b('0x4f')]){_0x58b7d0[_0x7e2b('0x4d')]=_[_0x7e2b('0x50')](_0x58b7d0[_0x7e2b('0x4d')],{'$or':_[_0x7e2b('0x43')](_0x58b7d0[_0x7e2b('0x46')],function(_0x5d9502){var _0x5b6597={};_0x5b6597[_0x5d9502]={'$like':'%'+_0x1e228a[_0x7e2b('0x4a')][_0x7e2b('0x4f')]+'%'};return _0x5b6597;})});}_0x58b7d0=_[_0x7e2b('0x50')]({},_0x58b7d0,_0x1e228a[_0x7e2b('0x59')]);return _0x396f28[_0x7e2b('0xea')](_0x58b7d0);}})['then'](function(_0x2932b9){if(_0x2932b9){_0x437568=_0x2932b9['length'];if(!_0x1e228a['query'][_0x7e2b('0x4b')]('nolimit')){_0x58b7d0[_0x7e2b('0x2f')]=qs['limit'](_0x1e228a[_0x7e2b('0x4a')][_0x7e2b('0x2f')]);_0x58b7d0['offset']=qs[_0x7e2b('0x2d')](_0x1e228a[_0x7e2b('0x4a')][_0x7e2b('0x2d')]);}return _0x396f28[_0x7e2b('0xea')](_0x58b7d0);}})[_0x7e2b('0x1f')](function(_0x17fbe8){if(_0x17fbe8){return _0x17fbe8?{'count':_0x437568,'rows':_0x17fbe8}:null;}})[_0x7e2b('0x1f')](respondWithResult(_0x26c30b,null))[_0x7e2b('0x2a')](handleError(_0x26c30b,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ff4a7c9..64586b2 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 _0xd6b5=['remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x497474,_0x367eec){var _0xf03340=function(_0x4cac62){while(--_0x4cac62){_0x497474['push'](_0x497474['shift']());}};_0xf03340(++_0x367eec);}(_0xd6b5,0xad));var _0x5d6b=function(_0x5e9d51,_0x6d2256){_0x5e9d51=_0x5e9d51-0x0;var _0x10ec8f=_0xd6b5[_0x5e9d51];return _0x10ec8f;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5d6b('0x0')](0x0);var events={'afterCreate':_0x5d6b('0x1'),'afterUpdate':'update','afterDestroy':_0x5d6b('0x2')};function emitEvent(_0x35b60b){return function(_0x11468b,_0x843412,_0x55ba90){SmsAccountEvents[_0x5d6b('0x3')](_0x35b60b+':'+_0x11468b['id'],_0x11468b);SmsAccountEvents[_0x5d6b('0x3')](_0x35b60b,_0x11468b);_0x55ba90(null);};}for(var e in events){if(events[_0x5d6b('0x4')](e)){var event=events[e];SmsAccount[_0x5d6b('0x5')](e,emitEvent(event));}}module[_0x5d6b('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xae4e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save','update','remove'];(function(_0x244d37,_0x12c4e2){var _0x2ec7f1=function(_0x2844a5){while(--_0x2844a5){_0x244d37['push'](_0x244d37['shift']());}};_0x2ec7f1(++_0x12c4e2);}(_0xae4e,0x72));var _0xeae4=function(_0x4581e9,_0x18f0af){_0x4581e9=_0x4581e9-0x0;var _0x496a98=_0xae4e[_0x4581e9];return _0x496a98;};'use strict';var EventEmitter=require(_0xeae4('0x0'));var SmsAccount=require(_0xeae4('0x1'))['db'][_0xeae4('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeae4('0x3'),'afterUpdate':_0xeae4('0x4'),'afterDestroy':_0xeae4('0x5')};function emitEvent(_0x24d329){return function(_0x55faf4,_0x4bc76d,_0x23808e){SmsAccountEvents['emit'](_0x24d329+':'+_0x55faf4['id'],_0x55faf4);SmsAccountEvents[_0xeae4('0x6')](_0x24d329,_0x55faf4);_0x23808e(null);};}for(var e in events){if(events[_0xeae4('0x7')](e)){var event=events[e];SmsAccount[_0xeae4('0x8')](e,emitEvent(event));}}module[_0xeae4('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d7e3da2..5fba842 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 _0x4402=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','util','../../config/logger','api','request-promise'];(function(_0x5763f7,_0x55469b){var _0x45905a=function(_0x1eae5c){while(--_0x1eae5c){_0x5763f7['push'](_0x5763f7['shift']());}};_0x45905a(++_0x55469b);}(_0x4402,0x1b4));var _0x2440=function(_0x20d93a,_0x422a10){_0x20d93a=_0x20d93a-0x0;var _0x4e5cec=_0x4402[_0x20d93a];return _0x4e5cec;};'use strict';var _=require('lodash');var util=require(_0x2440('0x0'));var logger=require(_0x2440('0x1'))(_0x2440('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2440('0x3'));var fs=require('fs');var path=require(_0x2440('0x4'));var rimraf=require(_0x2440('0x5'));var config=require(_0x2440('0x6'));var attributes=require(_0x2440('0x7'));module[_0x2440('0x8')]=function(_0x5717fa,_0x5bc164){return _0x5717fa[_0x2440('0x9')]('SmsAccount',attributes,{'tableName':_0x2440('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97e5=['bluebird','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x26aef6,_0x11f3e7){var _0x6a185d=function(_0x252178){while(--_0x252178){_0x26aef6['push'](_0x26aef6['shift']());}};_0x6a185d(++_0x11f3e7);}(_0x97e5,0x73));var _0x597e=function(_0x15858e,_0x237df4){_0x15858e=_0x15858e-0x0;var _0x441b72=_0x97e5[_0x15858e];return _0x441b72;};'use strict';var _=require(_0x597e('0x0'));var util=require(_0x597e('0x1'));var logger=require(_0x597e('0x2'))(_0x597e('0x3'));var moment=require(_0x597e('0x4'));var BPromise=require(_0x597e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x597e('0x6'));var config=require(_0x597e('0x7'));var attributes=require(_0x597e('0x8'));module[_0x597e('0x9')]=function(_0x4daee6,_0x1e3ffa){return _0x4daee6['define'](_0x597e('0xa'),attributes,{'tableName':_0x597e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 0e023fe..3971b89 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 _0x8445=['stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','debug'];(function(_0x525d24,_0x503fcc){var _0x5d96ba=function(_0x42e3dd){while(--_0x42e3dd){_0x525d24['push'](_0x525d24['shift']());}};_0x5d96ba(++_0x503fcc);}(_0x8445,0x154));var _0x5844=function(_0x49225d,_0x312d6c){_0x49225d=_0x49225d-0x0;var _0x2c228f=_0x8445[_0x49225d];return _0x2c228f;};'use strict';var _=require(_0x5844('0x0'));var util=require(_0x5844('0x1'));var moment=require(_0x5844('0x2'));var BPromise=require(_0x5844('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5844('0x4'));var db=require(_0x5844('0x5'))['db'];var utils=require(_0x5844('0x6'));var logger=require('../../config/logger')(_0x5844('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5844('0x8')][_0x5844('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5844('0xa')],{'host':_0x5844('0xb'),'port':0x18eb});var socket=require(_0x5844('0xc'))(new Redis(config[_0x5844('0xa')]));require(_0x5844('0xd'))[_0x5844('0xe')](socket);function respondWithRpcPromise(_0x11eece,_0x283d99,_0x3b100b){return new BPromise(function(_0x4c98c3,_0x256df9){return client[_0x5844('0xf')](_0x11eece,_0x3b100b)[_0x5844('0x10')](function(_0x3be62b){logger[_0x5844('0x11')]('SmsAccount,\x20%s,\x20%s',_0x283d99,_0x5844('0x12'));logger[_0x5844('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x283d99,_0x5844('0x12'),JSON[_0x5844('0x14')](_0x3be62b));if(_0x3be62b['error']){if(_0x3be62b[_0x5844('0x15')][_0x5844('0x16')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x283d99,_0x3be62b[_0x5844('0x15')][_0x5844('0x17')]);return _0x256df9(_0x3be62b[_0x5844('0x15')][_0x5844('0x17')]);}logger[_0x5844('0x15')](_0x5844('0x18'),_0x283d99,_0x3be62b[_0x5844('0x15')][_0x5844('0x17')]);return _0x4c98c3(_0x3be62b['error'][_0x5844('0x17')]);}else{logger[_0x5844('0x11')](_0x5844('0x18'),_0x283d99,_0x5844('0x12'));_0x4c98c3(_0x3be62b[_0x5844('0x19')][_0x5844('0x17')]);}})[_0x5844('0x1a')](function(_0xab9f3){logger[_0x5844('0x15')]('SmsAccount,\x20%s,\x20%s',_0x283d99,_0xab9f3);_0x256df9(_0xab9f3);});});}exports[_0x5844('0x1b')]=function(_0x798263){var _0x499033=this;return new Promise(function(_0x277712,_0x470dbf){return db[_0x5844('0x1c')][_0x5844('0x1d')]({'raw':_0x798263[_0x5844('0x1e')]?_0x798263['options'][_0x5844('0x1f')]===undefined?!![]:![]:!![],'where':_0x798263[_0x5844('0x1e')]?_0x798263[_0x5844('0x1e')][_0x5844('0x20')]||null:null,'attributes':_0x798263[_0x5844('0x1e')]?_0x798263['options'][_0x5844('0x21')]||null:null,'include':_0x798263['options']?_0x798263[_0x5844('0x1e')][_0x5844('0x22')]?_['map'](_0x798263[_0x5844('0x1e')][_0x5844('0x22')],function(_0x1c0034){return{'model':db[_0x1c0034[_0x5844('0x23')]],'as':_0x1c0034['as'],'attributes':_0x1c0034[_0x5844('0x21')],'include':_0x1c0034['include']?_['map'](_0x1c0034['include'],function(_0x17bd93){return{'model':db[_0x17bd93['model']],'as':_0x17bd93['as'],'attributes':_0x17bd93[_0x5844('0x21')],'include':_0x17bd93[_0x5844('0x22')]?_['map'](_0x17bd93['include'],function(_0x147722){return{'model':db[_0x147722[_0x5844('0x23')]],'as':_0x147722['as'],'attributes':_0x147722[_0x5844('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5844('0x10')](function(_0xf3c148){logger[_0x5844('0x11')]('ShowSmsAccount',_0x798263);logger['debug'](_0x5844('0x1b'),_0x798263,JSON[_0x5844('0x14')](_0xf3c148));_0x277712(_0xf3c148);})[_0x5844('0x1a')](function(_0x5ea2ba){logger['error'](_0x5844('0x1b'),_0x5ea2ba[_0x5844('0x17')],_0x798263);_0x470dbf(_0x499033[_0x5844('0x15')](0x1f4,_0x5ea2ba['message']));});});}; \ No newline at end of file +var _0xb002=['model','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSmsAccount','SmsAccount','options','raw','where','include','map'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb002,0x8f));var _0x2b00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb002[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2b00('0x0'));var util=require(_0x2b00('0x1'));var moment=require('moment');var BPromise=require(_0x2b00('0x2'));var rs=require(_0x2b00('0x3'));var fs=require('fs');var Redis=require(_0x2b00('0x4'));var db=require(_0x2b00('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b00('0x6'))('rpc');var config=require(_0x2b00('0x7'));var jayson=require(_0x2b00('0x8'));var client=jayson['client'][_0x2b00('0x9')]({'port':0x232a});config[_0x2b00('0xa')]=_[_0x2b00('0xb')](config[_0x2b00('0xa')],{'host':_0x2b00('0xc'),'port':0x18eb});var socket=require(_0x2b00('0xd'))(new Redis(config[_0x2b00('0xa')]));require(_0x2b00('0xe'))['register'](socket);function respondWithRpcPromise(_0x2906ce,_0x3b1e4e,_0x2c7d90){return new BPromise(function(_0x48236c,_0x8bd222){return client['request'](_0x2906ce,_0x2c7d90)['then'](function(_0x18b0c9){logger['info'](_0x2b00('0xf'),_0x3b1e4e,_0x2b00('0x10'));logger[_0x2b00('0x11')](_0x2b00('0x12'),_0x3b1e4e,_0x2b00('0x10'),JSON[_0x2b00('0x13')](_0x18b0c9));if(_0x18b0c9[_0x2b00('0x14')]){if(_0x18b0c9['error'][_0x2b00('0x15')]===0x1f4){logger[_0x2b00('0x14')](_0x2b00('0xf'),_0x3b1e4e,_0x18b0c9[_0x2b00('0x14')]['message']);return _0x8bd222(_0x18b0c9[_0x2b00('0x14')][_0x2b00('0x16')]);}logger[_0x2b00('0x14')](_0x2b00('0xf'),_0x3b1e4e,_0x18b0c9[_0x2b00('0x14')]['message']);return _0x48236c(_0x18b0c9[_0x2b00('0x14')][_0x2b00('0x16')]);}else{logger[_0x2b00('0x17')](_0x2b00('0xf'),_0x3b1e4e,_0x2b00('0x10'));_0x48236c(_0x18b0c9['result']['message']);}})[_0x2b00('0x18')](function(_0x4a0553){logger['error'](_0x2b00('0xf'),_0x3b1e4e,_0x4a0553);_0x8bd222(_0x4a0553);});});}exports[_0x2b00('0x19')]=function(_0x5b2d18){var _0xbdb405=this;return new Promise(function(_0x351fe6,_0x5702e7){return db[_0x2b00('0x1a')]['find']({'raw':_0x5b2d18['options']?_0x5b2d18[_0x2b00('0x1b')][_0x2b00('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b2d18[_0x2b00('0x1b')]?_0x5b2d18['options'][_0x2b00('0x1d')]||null:null,'attributes':_0x5b2d18[_0x2b00('0x1b')]?_0x5b2d18[_0x2b00('0x1b')]['attributes']||null:null,'include':_0x5b2d18[_0x2b00('0x1b')]?_0x5b2d18[_0x2b00('0x1b')][_0x2b00('0x1e')]?_[_0x2b00('0x1f')](_0x5b2d18['options'][_0x2b00('0x1e')],function(_0x32d00c){return{'model':db[_0x32d00c[_0x2b00('0x20')]],'as':_0x32d00c['as'],'attributes':_0x32d00c[_0x2b00('0x21')],'include':_0x32d00c[_0x2b00('0x1e')]?_[_0x2b00('0x1f')](_0x32d00c[_0x2b00('0x1e')],function(_0x3e43c6){return{'model':db[_0x3e43c6['model']],'as':_0x3e43c6['as'],'attributes':_0x3e43c6['attributes'],'include':_0x3e43c6[_0x2b00('0x1e')]?_['map'](_0x3e43c6['include'],function(_0x46f742){return{'model':db[_0x46f742[_0x2b00('0x20')]],'as':_0x46f742['as'],'attributes':_0x46f742[_0x2b00('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2b00('0x22')](function(_0x5ef310){logger[_0x2b00('0x17')](_0x2b00('0x19'),_0x5b2d18);logger[_0x2b00('0x11')](_0x2b00('0x19'),_0x5b2d18,JSON[_0x2b00('0x13')](_0x5ef310));_0x351fe6(_0x5ef310);})[_0x2b00('0x18')](function(_0x34b363){logger[_0x2b00('0x14')](_0x2b00('0x19'),_0x34b363[_0x2b00('0x16')],_0x5b2d18);_0x5702e7(_0xbdb405[_0x2b00('0x14')](0x1f4,_0x34b363['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 661ac0e..9ba4e47 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 86a7e03..1a44f06 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x55b913,_0x413bb5){var _0x3df6ba=function(_0x82691){while(--_0x82691){_0x55b913['push'](_0x55b913['shift']());}};_0x3df6ba(++_0x413bb5);}(_0x7217,0x19e));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 3a2d43a..e17fe3d 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 _0x676f=['sequelize','exports','STRING','noop','*,*,*,*'];(function(_0x390fa6,_0x5c9856){var _0x2c814a=function(_0x204a36){while(--_0x204a36){_0x390fa6['push'](_0x390fa6['shift']());}};_0x2c814a(++_0x5c9856);}(_0x676f,0x159));var _0xf676=function(_0x46c013,_0x323ba6){_0x46c013=_0x46c013-0x0;var _0x297dce=_0x676f[_0x46c013];return _0x297dce;};'use strict';var Sequelize=require(_0xf676('0x0'));module[_0xf676('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf676('0x2')],'allowNull':![],'defaultValue':_0xf676('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf676('0x2')]},'interval':{'type':Sequelize[_0xf676('0x2')],'defaultValue':_0xf676('0x4')}}; \ No newline at end of file +var _0x8b58=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0x1a188e,_0x1087e6){var _0x46f4e=function(_0x321081){while(--_0x321081){_0x1a188e['push'](_0x1a188e['shift']());}};_0x46f4e(++_0x1087e6);}(_0x8b58,0x140));var _0x88b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b58[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x88b5('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x88b5('0x1')],'allowNull':![],'defaultValue':_0x88b5('0x2')},'appdata':{'type':Sequelize[_0x88b5('0x3')]()},'description':{'type':Sequelize[_0x88b5('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x88b5('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b93ac27..c55d619 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 _0x42d9=['reject','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsApplication','then','includeAll','include','rows','catch','show','intersection','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x42d9,0x72));var _0x942d=function(_0x1dbbce,_0x48410a){_0x1dbbce=_0x1dbbce-0x0;var _0x30b20d=_0x42d9[_0x1dbbce];return _0x30b20d;};'use strict';var emlformat=require(_0x942d('0x0'));var rimraf=require(_0x942d('0x1'));var zipdir=require(_0x942d('0x2'));var jsonpatch=require(_0x942d('0x3'));var rp=require('request-promise');var moment=require(_0x942d('0x4'));var BPromise=require(_0x942d('0x5'));var Mustache=require(_0x942d('0x6'));var util=require(_0x942d('0x7'));var path=require(_0x942d('0x8'));var sox=require('sox');var csv=require(_0x942d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x942d('0xa'));var _=require(_0x942d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x942d('0xc'));var deskjs=require(_0x942d('0xd'));var toCsv=require(_0x942d('0x9'));var querystring=require(_0x942d('0xe'));var Papa=require('papaparse');var Redis=require(_0x942d('0xf'));var authService=require(_0x942d('0x10'));var qs=require(_0x942d('0x11'));var as=require(_0x942d('0x12'));var hardwareService=require(_0x942d('0x13'));var logger=require(_0x942d('0x14'))(_0x942d('0x15'));var utils=require(_0x942d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x942d('0x17'));var db=require(_0x942d('0x18'))['db'];function respondWithStatusCode(_0xaa3040,_0x4509ac){_0x4509ac=_0x4509ac||0xcc;return function(_0x241296){if(_0x241296){return _0xaa3040[_0x942d('0x19')](_0x4509ac);}return _0xaa3040['status'](_0x4509ac)[_0x942d('0x1a')]();};}function respondWithResult(_0x2b10cd,_0x11f1f1){_0x11f1f1=_0x11f1f1||0xc8;return function(_0x5536c4){if(_0x5536c4){return _0x2b10cd[_0x942d('0x1b')](_0x11f1f1)[_0x942d('0x1c')](_0x5536c4);}};}function respondWithFilteredResult(_0x46a80f,_0x1b1295){return function(_0x317617){if(_0x317617){var _0x326d6b=typeof _0x1b1295['offset']===_0x942d('0x1d')&&typeof _0x1b1295[_0x942d('0x1e')]===_0x942d('0x1d');var _0xa3c872=_0x317617[_0x942d('0x1f')];var _0x5815f9=_0x326d6b?0x0:_0x1b1295['offset'];var _0x37261f=_0x326d6b?_0x317617['count']:_0x1b1295[_0x942d('0x20')]+_0x1b1295['limit'];var _0x12c228;if(_0x37261f>=_0xa3c872){_0x37261f=_0xa3c872;_0x12c228=0xc8;}else{_0x12c228=0xce;}_0x46a80f[_0x942d('0x1b')](_0x12c228);return _0x46a80f[_0x942d('0x21')](_0x942d('0x22'),_0x5815f9+'-'+_0x37261f+'/'+_0xa3c872)[_0x942d('0x1c')](_0x317617);}return null;};}function patchUpdates(_0x58eb23){return function(_0x113317){try{jsonpatch[_0x942d('0x23')](_0x113317,_0x58eb23,!![]);}catch(_0x5ddef9){return BPromise[_0x942d('0x24')](_0x5ddef9);}return _0x113317['save']();};}function saveUpdates(_0x5c96f8,_0x2cee41){return function(_0x23414c){if(_0x23414c){return _0x23414c[_0x942d('0x25')](_0x5c96f8)['then'](function(_0x3eb042){return _0x3eb042;});}return null;};}function removeEntity(_0x4a59f5,_0x1cdc17){return function(_0x44e7f7){if(_0x44e7f7){return _0x44e7f7[_0x942d('0x26')]()['then'](function(){_0x4a59f5[_0x942d('0x1b')](0xcc)[_0x942d('0x1a')]();});}};}function handleEntityNotFound(_0x4c031b,_0x33b324){return function(_0x2c1eee){if(!_0x2c1eee){_0x4c031b[_0x942d('0x19')](0x194);}return _0x2c1eee;};}function handleError(_0x434ea7,_0x3cfd96){_0x3cfd96=_0x3cfd96||0x1f4;return function(_0x3d7102){logger['error'](_0x3d7102[_0x942d('0x27')]);if(_0x3d7102[_0x942d('0x28')]){delete _0x3d7102[_0x942d('0x28')];}_0x434ea7[_0x942d('0x1b')](_0x3cfd96)[_0x942d('0x29')](_0x3d7102);};}exports['index']=function(_0x592f66,_0x318458){var _0x38d0bb={},_0x2c2999={},_0x1a7566={'count':0x0,'rows':[]};var _0x1e0f3c=_[_0x942d('0x2a')](db['SmsApplication'][_0x942d('0x2b')],function(_0x2dc846){return{'name':_0x2dc846[_0x942d('0x2c')],'type':_0x2dc846[_0x942d('0x2d')][_0x942d('0x2e')]};});_0x2c2999['model']=_[_0x942d('0x2a')](_0x1e0f3c,_0x942d('0x28'));_0x2c2999[_0x942d('0x2f')]=_[_0x942d('0x30')](_0x592f66[_0x942d('0x2f')]);_0x2c2999['filters']=_['intersection'](_0x2c2999[_0x942d('0x31')],_0x2c2999[_0x942d('0x2f')]);_0x38d0bb[_0x942d('0x32')]=_['intersection'](_0x2c2999[_0x942d('0x31')],qs[_0x942d('0x33')](_0x592f66['query'][_0x942d('0x33')]));_0x38d0bb[_0x942d('0x32')]=_0x38d0bb['attributes'][_0x942d('0x34')]?_0x38d0bb[_0x942d('0x32')]:_0x2c2999['model'];if(!_0x592f66['query'][_0x942d('0x35')](_0x942d('0x36'))){_0x38d0bb['limit']=qs[_0x942d('0x1e')](_0x592f66['query'][_0x942d('0x1e')]);_0x38d0bb[_0x942d('0x20')]=qs[_0x942d('0x20')](_0x592f66[_0x942d('0x2f')][_0x942d('0x20')]);}_0x38d0bb['order']=qs[_0x942d('0x37')](_0x592f66['query'][_0x942d('0x37')]);_0x38d0bb[_0x942d('0x38')]=qs[_0x942d('0x39')](_[_0x942d('0x3a')](_0x592f66[_0x942d('0x2f')],_0x2c2999[_0x942d('0x39')]),_0x1e0f3c);if(_0x592f66[_0x942d('0x2f')][_0x942d('0x3b')]){_0x38d0bb[_0x942d('0x38')]=_[_0x942d('0x3c')](_0x38d0bb['where'],{'$or':_[_0x942d('0x2a')](_0x1e0f3c,function(_0xae72f7){if(_0xae72f7[_0x942d('0x2d')]!==_0x942d('0x3d')){var _0x392477={};_0x392477[_0xae72f7[_0x942d('0x28')]]={'$like':'%'+_0x592f66['query']['filter']+'%'};return _0x392477;}})});}_0x38d0bb=_[_0x942d('0x3c')]({},_0x38d0bb,_0x592f66[_0x942d('0x3e')]);var _0x4533ea={'where':_0x38d0bb['where']};return db[_0x942d('0x3f')][_0x942d('0x1f')](_0x4533ea)[_0x942d('0x40')](function(_0x1ab818){_0x1a7566[_0x942d('0x1f')]=_0x1ab818;if(_0x592f66[_0x942d('0x2f')][_0x942d('0x41')]){_0x38d0bb[_0x942d('0x42')]=[{'all':!![]}];}return db[_0x942d('0x3f')]['findAll'](_0x38d0bb);})['then'](function(_0x292c95){_0x1a7566[_0x942d('0x43')]=_0x292c95;return _0x1a7566;})[_0x942d('0x40')](respondWithFilteredResult(_0x318458,_0x38d0bb))[_0x942d('0x44')](handleError(_0x318458,null));};exports[_0x942d('0x45')]=function(_0x57dafc,_0x4b6fb4){var _0x331b2c={'raw':!![],'where':{'id':_0x57dafc['params']['id']}},_0x528ffb={};_0x528ffb[_0x942d('0x31')]=_[_0x942d('0x30')](db['SmsApplication'][_0x942d('0x2b')]);_0x528ffb[_0x942d('0x2f')]=_['keys'](_0x57dafc[_0x942d('0x2f')]);_0x528ffb['filters']=_[_0x942d('0x46')](_0x528ffb[_0x942d('0x31')],_0x528ffb[_0x942d('0x2f')]);_0x331b2c['attributes']=_[_0x942d('0x46')](_0x528ffb[_0x942d('0x31')],qs[_0x942d('0x33')](_0x57dafc[_0x942d('0x2f')]['fields']));_0x331b2c['attributes']=_0x331b2c['attributes'][_0x942d('0x34')]?_0x331b2c[_0x942d('0x32')]:_0x528ffb[_0x942d('0x31')];if(_0x57dafc[_0x942d('0x2f')]['includeAll']){_0x331b2c[_0x942d('0x42')]=[{'all':!![]}];}_0x331b2c=_[_0x942d('0x3c')]({},_0x331b2c,_0x57dafc[_0x942d('0x3e')]);return db[_0x942d('0x3f')][_0x942d('0x47')](_0x331b2c)[_0x942d('0x40')](handleEntityNotFound(_0x4b6fb4,null))[_0x942d('0x40')](respondWithResult(_0x4b6fb4,null))[_0x942d('0x44')](handleError(_0x4b6fb4,null));};exports[_0x942d('0x48')]=function(_0x459133,_0x2b2245){return db[_0x942d('0x3f')][_0x942d('0x48')](_0x459133[_0x942d('0x49')],{})[_0x942d('0x40')](respondWithResult(_0x2b2245,0xc9))[_0x942d('0x44')](handleError(_0x2b2245,null));};exports[_0x942d('0x25')]=function(_0x2d1d2a,_0x1bd5fe){if(_0x2d1d2a[_0x942d('0x49')]['id']){delete _0x2d1d2a['body']['id'];}return db[_0x942d('0x3f')][_0x942d('0x47')]({'where':{'id':_0x2d1d2a[_0x942d('0x4a')]['id']}})[_0x942d('0x40')](handleEntityNotFound(_0x1bd5fe,null))[_0x942d('0x40')](saveUpdates(_0x2d1d2a[_0x942d('0x49')],null))[_0x942d('0x40')](respondWithResult(_0x1bd5fe,null))[_0x942d('0x44')](handleError(_0x1bd5fe,null));};exports[_0x942d('0x26')]=function(_0x35ecfa,_0x387112){return db['SmsApplication'][_0x942d('0x47')]({'where':{'id':_0x35ecfa[_0x942d('0x4a')]['id']}})[_0x942d('0x40')](handleEntityNotFound(_0x387112,null))['then'](removeEntity(_0x387112,null))[_0x942d('0x44')](handleError(_0x387112,null));}; \ No newline at end of file +var _0xaaf2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','sendStatus','error','stack','name','index','map','SmsApplication','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2d284c,_0x59aa64){var _0x4f5756=function(_0x2f110e){while(--_0x2f110e){_0x2d284c['push'](_0x2d284c['shift']());}};_0x4f5756(++_0x59aa64);}(_0xaaf2,0x16e));var _0x2aaf=function(_0x250d30,_0x47671e){_0x250d30=_0x250d30-0x0;var _0x55326a=_0xaaf2[_0x250d30];return _0x55326a;};'use strict';var emlformat=require(_0x2aaf('0x0'));var rimraf=require(_0x2aaf('0x1'));var zipdir=require(_0x2aaf('0x2'));var jsonpatch=require(_0x2aaf('0x3'));var rp=require(_0x2aaf('0x4'));var moment=require(_0x2aaf('0x5'));var BPromise=require(_0x2aaf('0x6'));var Mustache=require(_0x2aaf('0x7'));var util=require('util');var path=require(_0x2aaf('0x8'));var sox=require(_0x2aaf('0x9'));var csv=require(_0x2aaf('0xa'));var ejs=require(_0x2aaf('0xb'));var fs=require('fs');var fs_extra=require(_0x2aaf('0xc'));var _=require(_0x2aaf('0xd'));var squel=require('squel');var crypto=require(_0x2aaf('0xe'));var jsforce=require(_0x2aaf('0xf'));var deskjs=require(_0x2aaf('0x10'));var toCsv=require(_0x2aaf('0xa'));var querystring=require(_0x2aaf('0x11'));var Papa=require(_0x2aaf('0x12'));var Redis=require(_0x2aaf('0x13'));var authService=require(_0x2aaf('0x14'));var qs=require(_0x2aaf('0x15'));var as=require(_0x2aaf('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2aaf('0x17'));var utils=require(_0x2aaf('0x18'));var config=require(_0x2aaf('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2aaf('0x1a'))['db'];function respondWithStatusCode(_0x4e7b41,_0x59a806){_0x59a806=_0x59a806||0xcc;return function(_0x2f0d7d){if(_0x2f0d7d){return _0x4e7b41['sendStatus'](_0x59a806);}return _0x4e7b41[_0x2aaf('0x1b')](_0x59a806)[_0x2aaf('0x1c')]();};}function respondWithResult(_0x322776,_0x43e9c2){_0x43e9c2=_0x43e9c2||0xc8;return function(_0x102db4){if(_0x102db4){return _0x322776[_0x2aaf('0x1b')](_0x43e9c2)['json'](_0x102db4);}};}function respondWithFilteredResult(_0x55e3ad,_0x305259){return function(_0x43be78){if(_0x43be78){var _0x8bedc6=typeof _0x305259[_0x2aaf('0x1d')]===_0x2aaf('0x1e')&&typeof _0x305259[_0x2aaf('0x1f')]==='undefined';var _0x15454a=_0x43be78[_0x2aaf('0x20')];var _0x25a497=_0x8bedc6?0x0:_0x305259['offset'];var _0x14a346=_0x8bedc6?_0x43be78[_0x2aaf('0x20')]:_0x305259[_0x2aaf('0x1d')]+_0x305259[_0x2aaf('0x1f')];var _0x2d0b20;if(_0x14a346>=_0x15454a){_0x14a346=_0x15454a;_0x2d0b20=0xc8;}else{_0x2d0b20=0xce;}_0x55e3ad[_0x2aaf('0x1b')](_0x2d0b20);return _0x55e3ad[_0x2aaf('0x21')](_0x2aaf('0x22'),_0x25a497+'-'+_0x14a346+'/'+_0x15454a)[_0x2aaf('0x23')](_0x43be78);}return null;};}function patchUpdates(_0x3a84dd){return function(_0x31a369){try{jsonpatch[_0x2aaf('0x24')](_0x31a369,_0x3a84dd,!![]);}catch(_0x53b0ec){return BPromise['reject'](_0x53b0ec);}return _0x31a369[_0x2aaf('0x25')]();};}function saveUpdates(_0x512dd3,_0x5b3434){return function(_0x29d7f1){if(_0x29d7f1){return _0x29d7f1['update'](_0x512dd3)['then'](function(_0x50d503){return _0x50d503;});}return null;};}function removeEntity(_0x17350f,_0x1768d3){return function(_0x58137d){if(_0x58137d){return _0x58137d[_0x2aaf('0x26')]()[_0x2aaf('0x27')](function(){_0x17350f[_0x2aaf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba3d4,_0x4b4bd1){return function(_0x267d4e){if(!_0x267d4e){_0x3ba3d4[_0x2aaf('0x28')](0x194);}return _0x267d4e;};}function handleError(_0x29a292,_0x19ccac){_0x19ccac=_0x19ccac||0x1f4;return function(_0x565d63){logger[_0x2aaf('0x29')](_0x565d63[_0x2aaf('0x2a')]);if(_0x565d63['name']){delete _0x565d63[_0x2aaf('0x2b')];}_0x29a292[_0x2aaf('0x1b')](_0x19ccac)['send'](_0x565d63);};}exports[_0x2aaf('0x2c')]=function(_0x430f59,_0x36d723){var _0xe75cbb={},_0x5cf52d={},_0xa050fe={'count':0x0,'rows':[]};var _0x92f4e5=_[_0x2aaf('0x2d')](db[_0x2aaf('0x2e')][_0x2aaf('0x2f')],function(_0x5b37b5){return{'name':_0x5b37b5['fieldName'],'type':_0x5b37b5['type'][_0x2aaf('0x30')]};});_0x5cf52d[_0x2aaf('0x31')]=_[_0x2aaf('0x2d')](_0x92f4e5,_0x2aaf('0x2b'));_0x5cf52d['query']=_['keys'](_0x430f59[_0x2aaf('0x32')]);_0x5cf52d['filters']=_[_0x2aaf('0x33')](_0x5cf52d[_0x2aaf('0x31')],_0x5cf52d[_0x2aaf('0x32')]);_0xe75cbb[_0x2aaf('0x34')]=_[_0x2aaf('0x33')](_0x5cf52d[_0x2aaf('0x31')],qs[_0x2aaf('0x35')](_0x430f59[_0x2aaf('0x32')][_0x2aaf('0x35')]));_0xe75cbb[_0x2aaf('0x34')]=_0xe75cbb[_0x2aaf('0x34')][_0x2aaf('0x36')]?_0xe75cbb[_0x2aaf('0x34')]:_0x5cf52d[_0x2aaf('0x31')];if(!_0x430f59[_0x2aaf('0x32')][_0x2aaf('0x37')](_0x2aaf('0x38'))){_0xe75cbb[_0x2aaf('0x1f')]=qs[_0x2aaf('0x1f')](_0x430f59[_0x2aaf('0x32')]['limit']);_0xe75cbb[_0x2aaf('0x1d')]=qs[_0x2aaf('0x1d')](_0x430f59[_0x2aaf('0x32')][_0x2aaf('0x1d')]);}_0xe75cbb[_0x2aaf('0x39')]=qs[_0x2aaf('0x3a')](_0x430f59[_0x2aaf('0x32')][_0x2aaf('0x3a')]);_0xe75cbb[_0x2aaf('0x3b')]=qs[_0x2aaf('0x3c')](_['pick'](_0x430f59[_0x2aaf('0x32')],_0x5cf52d[_0x2aaf('0x3c')]),_0x92f4e5);if(_0x430f59[_0x2aaf('0x32')][_0x2aaf('0x3d')]){_0xe75cbb[_0x2aaf('0x3b')]=_[_0x2aaf('0x3e')](_0xe75cbb['where'],{'$or':_['map'](_0x92f4e5,function(_0x2f02){if(_0x2f02[_0x2aaf('0x3f')]!==_0x2aaf('0x40')){var _0x43dc91={};_0x43dc91[_0x2f02[_0x2aaf('0x2b')]]={'$like':'%'+_0x430f59[_0x2aaf('0x32')][_0x2aaf('0x3d')]+'%'};return _0x43dc91;}})});}_0xe75cbb=_[_0x2aaf('0x3e')]({},_0xe75cbb,_0x430f59[_0x2aaf('0x41')]);var _0x59c461={'where':_0xe75cbb[_0x2aaf('0x3b')]};return db[_0x2aaf('0x2e')][_0x2aaf('0x20')](_0x59c461)[_0x2aaf('0x27')](function(_0x3d3aa3){_0xa050fe['count']=_0x3d3aa3;if(_0x430f59[_0x2aaf('0x32')][_0x2aaf('0x42')]){_0xe75cbb['include']=[{'all':!![]}];}return db['SmsApplication'][_0x2aaf('0x43')](_0xe75cbb);})[_0x2aaf('0x27')](function(_0x350998){_0xa050fe[_0x2aaf('0x44')]=_0x350998;return _0xa050fe;})[_0x2aaf('0x27')](respondWithFilteredResult(_0x36d723,_0xe75cbb))['catch'](handleError(_0x36d723,null));};exports['show']=function(_0x4f54db,_0x1aed67){var _0x4bfb66={'raw':!![],'where':{'id':_0x4f54db[_0x2aaf('0x45')]['id']}},_0x51e27a={};_0x51e27a[_0x2aaf('0x31')]=_[_0x2aaf('0x46')](db[_0x2aaf('0x2e')][_0x2aaf('0x2f')]);_0x51e27a['query']=_[_0x2aaf('0x46')](_0x4f54db['query']);_0x51e27a['filters']=_[_0x2aaf('0x33')](_0x51e27a['model'],_0x51e27a[_0x2aaf('0x32')]);_0x4bfb66['attributes']=_[_0x2aaf('0x33')](_0x51e27a[_0x2aaf('0x31')],qs[_0x2aaf('0x35')](_0x4f54db['query'][_0x2aaf('0x35')]));_0x4bfb66[_0x2aaf('0x34')]=_0x4bfb66[_0x2aaf('0x34')][_0x2aaf('0x36')]?_0x4bfb66['attributes']:_0x51e27a[_0x2aaf('0x31')];if(_0x4f54db[_0x2aaf('0x32')][_0x2aaf('0x42')]){_0x4bfb66[_0x2aaf('0x47')]=[{'all':!![]}];}_0x4bfb66=_[_0x2aaf('0x3e')]({},_0x4bfb66,_0x4f54db[_0x2aaf('0x41')]);return db[_0x2aaf('0x2e')]['find'](_0x4bfb66)['then'](handleEntityNotFound(_0x1aed67,null))[_0x2aaf('0x27')](respondWithResult(_0x1aed67,null))[_0x2aaf('0x48')](handleError(_0x1aed67,null));};exports[_0x2aaf('0x49')]=function(_0x3549a3,_0x3efabd){return db[_0x2aaf('0x2e')]['create'](_0x3549a3[_0x2aaf('0x4a')],{})['then'](respondWithResult(_0x3efabd,0xc9))[_0x2aaf('0x48')](handleError(_0x3efabd,null));};exports[_0x2aaf('0x4b')]=function(_0x3237d2,_0x34e447){if(_0x3237d2[_0x2aaf('0x4a')]['id']){delete _0x3237d2['body']['id'];}return db[_0x2aaf('0x2e')][_0x2aaf('0x4c')]({'where':{'id':_0x3237d2[_0x2aaf('0x45')]['id']}})[_0x2aaf('0x27')](handleEntityNotFound(_0x34e447,null))[_0x2aaf('0x27')](saveUpdates(_0x3237d2['body'],null))[_0x2aaf('0x27')](respondWithResult(_0x34e447,null))[_0x2aaf('0x48')](handleError(_0x34e447,null));};exports[_0x2aaf('0x26')]=function(_0x31e9cd,_0x474510){return db[_0x2aaf('0x2e')][_0x2aaf('0x4c')]({'where':{'id':_0x31e9cd[_0x2aaf('0x45')]['id']}})[_0x2aaf('0x27')](handleEntityNotFound(_0x474510,null))[_0x2aaf('0x27')](removeEntity(_0x474510,null))['catch'](handleError(_0x474510,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 16f0f4b..98b885f 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 _0x7080=['exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x20533c,_0x462c3f){var _0x3ca723=function(_0x2292ff){while(--_0x2292ff){_0x20533c['push'](_0x20533c['shift']());}};_0x3ca723(++_0x462c3f);}(_0x7080,0xa0));var _0x0708=function(_0x54daf5,_0x528643){_0x54daf5=_0x54daf5-0x0;var _0xf70158=_0x7080[_0x54daf5];return _0xf70158;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0708('0x0'))(_0x0708('0x1'));var moment=require(_0x0708('0x2'));var BPromise=require(_0x0708('0x3'));var rp=require(_0x0708('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0708('0x5'));var config=require(_0x0708('0x6'));var attributes=require(_0x0708('0x7'));module[_0x0708('0x8')]=function(_0x485d5a,_0x278cab){return _0x485d5a[_0x0708('0x9')](_0x0708('0xa'),attributes,{'tableName':_0x0708('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0708('0xc'),'collate':_0x0708('0xd')});}; \ No newline at end of file +var _0xa68e=['../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0xaef4c1,_0x1bd6da){var _0x48e06a=function(_0x488580){while(--_0x488580){_0xaef4c1['push'](_0xaef4c1['shift']());}};_0x48e06a(++_0x1bd6da);}(_0xa68e,0xf1));var _0xea68=function(_0x486b88,_0x10faca){_0x486b88=_0x486b88-0x0;var _0x20dee9=_0xa68e[_0x486b88];return _0x20dee9;};'use strict';var _=require(_0xea68('0x0'));var util=require(_0xea68('0x1'));var logger=require(_0xea68('0x2'))('api');var moment=require('moment');var BPromise=require(_0xea68('0x3'));var rp=require(_0xea68('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea68('0x5'));var config=require(_0xea68('0x6'));var attributes=require(_0xea68('0x7'));module[_0xea68('0x8')]=function(_0x3572df,_0x1f2f04){return _0x3572df['define'](_0xea68('0x9'),attributes,{'tableName':_0xea68('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea68('0xb'),'collate':_0xea68('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index d0a309f..1fab78c 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 _0x87bc=['http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','client'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x87bc,0x189));var _0xc87b=function(_0x28a37a,_0x5a41f1){_0x28a37a=_0x28a37a-0x0;var _0xdc47a5=_0x87bc[_0x28a37a];return _0xdc47a5;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require('moment');var BPromise=require(_0xc87b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc87b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc87b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc87b('0x5')][_0xc87b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402aac,_0x5d1813,_0x50b19b){return new BPromise(function(_0x4ed0c5,_0x1999f8){return client[_0xc87b('0x7')](_0x402aac,_0x50b19b)[_0xc87b('0x8')](function(_0x19b571){logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));logger[_0xc87b('0xc')](_0xc87b('0xd'),_0x5d1813,'request\x20sent',JSON['stringify'](_0x19b571));if(_0x19b571[_0xc87b('0xe')]){if(_0x19b571['error'][_0xc87b('0xf')]===0x1f4){logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571[_0xc87b('0xe')]['message']);return _0x1999f8(_0x19b571[_0xc87b('0xe')]['message']);}logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571['error'][_0xc87b('0x10')]);return _0x4ed0c5(_0x19b571[_0xc87b('0xe')]['message']);}else{logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));_0x4ed0c5(_0x19b571[_0xc87b('0x11')][_0xc87b('0x10')]);}})[_0xc87b('0x12')](function(_0x4009ef){logger[_0xc87b('0xe')]('SmsApplication,\x20%s,\x20%s',_0x5d1813,_0x4009ef);_0x1999f8(_0x4009ef);});});} \ No newline at end of file +var _0x6d38=['request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2630ad,_0x382c1d){var _0x3612e7=function(_0x2588ab){while(--_0x2588ab){_0x2630ad['push'](_0x2630ad['shift']());}};_0x3612e7(++_0x382c1d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 457c908..23c920c 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 _0x0abf=['create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','download','post'];(function(_0x526367,_0x2d0939){var _0x1f35fe=function(_0x35389f){while(--_0x35389f){_0x526367['push'](_0x526367['shift']());}};_0x1f35fe(++_0x2d0939);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0abf[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/describe',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xf0ab('0x7')]('/:id/download',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0xf')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0xf')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0x11')]);router[_0xf0ab('0xf')](_0xf0ab('0x12'),auth[_0xf0ab('0x8')](),interaction[_0xf0ab('0x13')](_0xf0ab('0x14'),_0xf0ab('0x15')),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0xb'),auth[_0xf0ab('0x8')](),interaction[_0xf0ab('0x13')](_0xf0ab('0x14'),_0xf0ab('0x18')),controller[_0xf0ab('0x19')]);router['delete'](_0xf0ab('0xb'),auth[_0xf0ab('0x8')](),interaction[_0xf0ab('0x13')](_0xf0ab('0x14'),_0xf0ab('0x1a')),controller[_0xf0ab('0x1b')]);router[_0xf0ab('0x1c')](_0xf0ab('0x12'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x1d')]);module[_0xf0ab('0x1e')]=router; \ No newline at end of file +var _0xda3f=['/:id/tags','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','sms','smsinteraction:addtags','tracked','smsinteraction:update','update','delete','destroy'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xda3f,0xec));var _0xfda3=function(_0xee7039,_0x27eb62){_0xee7039=_0xee7039-0x0;var _0x5a13e0=_0xda3f[_0xee7039];return _0x5a13e0;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./smsInteraction.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/download',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0xe')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['post'](_0xfda3('0xb'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfda3('0x11'),_0xfda3('0x12')),controller['addTags']);router['put']('/:id',auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),_0xfda3('0x14')),controller[_0xfda3('0x15')]);router[_0xfda3('0x16')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),'smsinteraction:destroy'),controller[_0xfda3('0x17')]);router[_0xfda3('0x16')](_0xfda3('0x18'),auth[_0xfda3('0x6')](),controller['removeTags']);module[_0xfda3('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 80e1c82..0fd6e8c 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 _0x8286=['exports','BOOLEAN','DATE','STRING','out','INTEGER','sequelize','moment'];(function(_0x454bd3,_0x3e4d94){var _0x4eb066=function(_0x4478fa){while(--_0x4478fa){_0x454bd3['push'](_0x454bd3['shift']());}};_0x4eb066(++_0x3e4d94);}(_0x8286,0x66));var _0x6828=function(_0xf82f74,_0x5c229a){_0xf82f74=_0xf82f74-0x0;var _0x37bc7a=_0x8286[_0xf82f74];return _0x37bc7a;};'use strict';var Sequelize=require(_0x6828('0x0'));var moment=require(_0x6828('0x1'));module[_0x6828('0x2')]={'closed':{'type':Sequelize[_0x6828('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6828('0x4')]},'disposition':{'type':Sequelize[_0x6828('0x5')]},'secondDisposition':{'type':Sequelize[_0x6828('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6828('0x5')]},'note':{'type':Sequelize[_0x6828('0x5')]},'phone':{'type':Sequelize[_0x6828('0x5')]},'read1stAt':{'type':Sequelize[_0x6828('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6828('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6828('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6828('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6828('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6828('0x7')]}}; \ No newline at end of file +var _0xf55c=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x2dcc48,_0x59027c){var _0x292bc8=function(_0x303fbc){while(--_0x303fbc){_0x2dcc48['push'](_0x2dcc48['shift']());}};_0x292bc8(++_0x59027c);}(_0xf55c,0x1e7));var _0xcf55=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xf55c[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0xcf55('0x0'));var moment=require('moment');module[_0xcf55('0x1')]={'closed':{'type':Sequelize[_0xcf55('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcf55('0x3')]},'disposition':{'type':Sequelize[_0xcf55('0x4')]},'secondDisposition':{'type':Sequelize[_0xcf55('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcf55('0x4')]},'note':{'type':Sequelize[_0xcf55('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xcf55('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcf55('0x5')]('in',_0xcf55('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcf55('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcf55('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcf55('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xcf55('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 52bf640..552a30d 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 _0x9a05=['key','getOptions','findAll','user','show','params','model','keys','query','intersection','fields','attributes','includeAll','include','merge','options','find','catch','create','body','destroy','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','$gte','split','format','count','rows','addTags','spread','Tag','smsInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','value','renderFile','views','transcript-','.pdf','Sms','log','err','unlinkSync','rimraf','moment','util','path','lodash','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','limit','set','Content-Range','then','name','send','index','map','SmsInteraction','rawAttributes','fieldName'];(function(_0x127ddd,_0x1d6210){var _0x355b24=function(_0x2c4304){while(--_0x2c4304){_0x127ddd['push'](_0x127ddd['shift']());}};_0x355b24(++_0x1d6210);}(_0x9a05,0xc9));var _0x59a0=function(_0x2ff560,_0x20d5f2){_0x2ff560=_0x2ff560-0x0;var _0x40df3a=_0x9a05[_0x2ff560];return _0x40df3a;};'use strict';var rimraf=require(_0x59a0('0x0'));var zipdir=require('zip-dir');var moment=require(_0x59a0('0x1'));var BPromise=require('bluebird');var util=require(_0x59a0('0x2'));var path=require(_0x59a0('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x59a0('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x59a0('0x5'));var pdf=require(_0x59a0('0x6'));var logger=require('../../config/logger')(_0x59a0('0x7'));var config=require(_0x59a0('0x8'));var db=require(_0x59a0('0x9'))['db'];config[_0x59a0('0xa')]=_[_0x59a0('0xb')](config[_0x59a0('0xa')],{'host':_0x59a0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59a0('0xa')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1b796f,_0x31b82d){_0x31b82d=_0x31b82d||0xcc;return function(_0x1cbb65){if(_0x1cbb65){return _0x1b796f[_0x59a0('0xd')](_0x31b82d);}return _0x1b796f[_0x59a0('0xe')](_0x31b82d)[_0x59a0('0xf')]();};}function respondWithResult(_0x1cd2d9,_0x39cfca){_0x39cfca=_0x39cfca||0xc8;return function(_0x55d118){if(_0x55d118){return _0x1cd2d9[_0x59a0('0xe')](_0x39cfca)[_0x59a0('0x10')](_0x55d118);}};}function respondWithFilteredResult(_0x44b036,_0x130faf){return function(_0x4e3601){if(_0x4e3601){var _0x40da74=typeof _0x130faf[_0x59a0('0x11')]==='undefined'&&typeof _0x130faf[_0x59a0('0x12')]==='undefined';var _0x53fdf7=_0x4e3601['count'];var _0x4e3cbc=_0x40da74?0x0:_0x130faf[_0x59a0('0x11')];var _0x50f77a=_0x40da74?_0x4e3601['count']:_0x130faf['offset']+_0x130faf[_0x59a0('0x12')];var _0x117478;if(_0x50f77a>=_0x53fdf7){_0x50f77a=_0x53fdf7;_0x117478=0xc8;}else{_0x117478=0xce;}_0x44b036[_0x59a0('0xe')](_0x117478);return _0x44b036[_0x59a0('0x13')](_0x59a0('0x14'),_0x4e3cbc+'-'+_0x50f77a+'/'+_0x53fdf7)[_0x59a0('0x10')](_0x4e3601);}return null;};}function saveUpdates(_0x1ddeda){return function(_0x3da057){if(_0x3da057){return _0x3da057['update'](_0x1ddeda)[_0x59a0('0x15')](function(_0x519b63){return _0x519b63;});}return null;};}function removeEntity(_0x36ac4a){return function(_0x2f5555){if(_0x2f5555){return _0x2f5555['destroy']()[_0x59a0('0x15')](function(){_0x36ac4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x598eac){return function(_0x350d71){if(!_0x350d71){_0x598eac[_0x59a0('0xd')](0x194);}return _0x350d71;};}function handleError(_0x118014,_0x128ed8){_0x128ed8=_0x128ed8||0x1f4;return function(_0x143147){logger['error'](_0x143147['stack']);if(_0x143147[_0x59a0('0x16')]){delete _0x143147['name'];}_0x118014['status'](_0x128ed8)[_0x59a0('0x17')](_0x143147);};}exports[_0x59a0('0x18')]=function(_0x4654e6,_0x325b33){var _0x4805cb={};var _0x1b1337=_[_0x59a0('0x19')](db[_0x59a0('0x1a')][_0x59a0('0x1b')],function(_0x1d1385){return{'name':_0x1d1385[_0x59a0('0x1c')],'type':_0x1d1385['type'][_0x59a0('0x1d')]};});_0x4805cb=qs[_0x59a0('0x1e')](_0x1b1337,_0x4654e6);return interaction[_0x59a0('0x1f')]('sms',_0x4654e6['query'],_0x4654e6[_0x59a0('0x20')],_0x4805cb,_0x1b1337)[_0x59a0('0x15')](respondWithFilteredResult(_0x325b33,_0x4805cb))['catch'](handleError(_0x325b33,null));};exports[_0x59a0('0x21')]=function(_0x38eb47,_0x26341d){var _0x3fd59c={'raw':![],'where':{'id':_0x38eb47[_0x59a0('0x22')]['id']}},_0x46f61b={};_0x46f61b[_0x59a0('0x23')]=_[_0x59a0('0x24')](db[_0x59a0('0x1a')][_0x59a0('0x1b')]);_0x46f61b[_0x59a0('0x25')]=_[_0x59a0('0x24')](_0x38eb47[_0x59a0('0x25')]);_0x46f61b['filters']=_[_0x59a0('0x26')](_0x46f61b[_0x59a0('0x23')],_0x46f61b[_0x59a0('0x25')]);_0x3fd59c['attributes']=_[_0x59a0('0x26')](_0x46f61b[_0x59a0('0x23')],qs[_0x59a0('0x27')](_0x38eb47['query'][_0x59a0('0x27')]));_0x3fd59c[_0x59a0('0x28')]=_0x3fd59c[_0x59a0('0x28')]['length']?_0x3fd59c['attributes']:_0x46f61b[_0x59a0('0x23')];if(_0x38eb47[_0x59a0('0x25')][_0x59a0('0x29')]){_0x3fd59c[_0x59a0('0x2a')]=[{'all':!![]}];}_0x3fd59c=_[_0x59a0('0x2b')]({},_0x3fd59c,_0x38eb47[_0x59a0('0x2c')]);return db[_0x59a0('0x1a')][_0x59a0('0x2d')](_0x3fd59c)[_0x59a0('0x15')](handleEntityNotFound(_0x26341d,null))[_0x59a0('0x15')](respondWithResult(_0x26341d,null))[_0x59a0('0x2e')](handleError(_0x26341d,null));};exports[_0x59a0('0x2f')]=function(_0x4837ab,_0x2d51db){return db[_0x59a0('0x1a')][_0x59a0('0x2f')](_0x4837ab[_0x59a0('0x30')],{})[_0x59a0('0x15')](respondWithResult(_0x2d51db,0xc9))[_0x59a0('0x2e')](handleError(_0x2d51db,null));};exports['update']=function(_0x3cd677,_0x20367c){if(_0x3cd677['body']['id']){delete _0x3cd677[_0x59a0('0x30')]['id'];}return db[_0x59a0('0x1a')][_0x59a0('0x2d')]({'where':{'id':_0x3cd677[_0x59a0('0x22')]['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x20367c,null))['then'](saveUpdates(_0x3cd677[_0x59a0('0x30')],null))[_0x59a0('0x15')](respondWithResult(_0x20367c,null))[_0x59a0('0x2e')](handleError(_0x20367c,null));};exports[_0x59a0('0x31')]=function(_0x110418,_0x8d25b){return db[_0x59a0('0x1a')][_0x59a0('0x2d')]({'where':{'id':_0x110418[_0x59a0('0x22')]['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x8d25b,null))[_0x59a0('0x15')](removeEntity(_0x8d25b,null))[_0x59a0('0x2e')](handleError(_0x8d25b,null));};exports[_0x59a0('0x32')]=function(_0x49a1c9,_0x543c6e){return db['SmsInteraction'][_0x59a0('0x32')]()[_0x59a0('0x15')](respondWithResult(_0x543c6e,null))[_0x59a0('0x2e')](handleError(_0x543c6e,null));};exports['addMessage']=function(_0x153f12,_0x4acbfe){return db[_0x59a0('0x33')][_0x59a0('0x2d')]({'where':{'id':_0x153f12[_0x59a0('0x22')]['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x4acbfe,null))['then'](function(_0x305125){if(_0x305125){return _0x305125[_0x59a0('0x34')](_0x153f12[_0x59a0('0x30')][_0x59a0('0x35')],_[_0x59a0('0x36')](_0x153f12[_0x59a0('0x30')],[_0x59a0('0x35'),'id'])||{});}})[_0x59a0('0x15')](respondWithResult(_0x4acbfe,null))[_0x59a0('0x2e')](handleError(_0x4acbfe,null));};exports[_0x59a0('0x37')]=function(_0x3aee22,_0x25deb2){var _0x27c1e7={'raw':![],'where':{}};var _0xfa0e63={};var _0x4a240b={'count':0x0,'rows':[]};return db[_0x59a0('0x1a')][_0x59a0('0x38')]({'where':{'id':_0x3aee22[_0x59a0('0x22')]['id']}})['then'](handleEntityNotFound(_0x25deb2,null))[_0x59a0('0x15')](function(_0x407abd){if(_0x407abd){_0xfa0e63[_0x59a0('0x23')]=_['keys'](db[_0x59a0('0x33')][_0x59a0('0x1b')]);_0xfa0e63['query']=_[_0x59a0('0x24')](_0x3aee22[_0x59a0('0x25')]);_0xfa0e63['filters']=_['intersection'](_0xfa0e63[_0x59a0('0x23')],_0xfa0e63[_0x59a0('0x25')]);_0x27c1e7[_0x59a0('0x28')]=_['intersection'](_0xfa0e63[_0x59a0('0x23')],qs[_0x59a0('0x27')](_0x3aee22[_0x59a0('0x25')]['fields']));_0x27c1e7['attributes']=_0x27c1e7['attributes'][_0x59a0('0x39')]?_0x27c1e7['attributes']:_0xfa0e63[_0x59a0('0x23')];if(!_0x3aee22[_0x59a0('0x25')][_0x59a0('0x3a')](_0x59a0('0x3b'))){_0x27c1e7['limit']=qs[_0x59a0('0x12')](_0x3aee22[_0x59a0('0x25')][_0x59a0('0x12')]);_0x27c1e7[_0x59a0('0x11')]=qs[_0x59a0('0x11')](_0x3aee22['query'][_0x59a0('0x11')]);}_0x27c1e7[_0x59a0('0x3c')]=qs['sort'](_0x3aee22[_0x59a0('0x25')]['sort']);_0x27c1e7['where']=qs[_0x59a0('0x3d')](_[_0x59a0('0x3e')](_0x3aee22['query'],_0xfa0e63[_0x59a0('0x3d')]));_0x27c1e7['where']['SmsInteractionId']=_0x407abd['id'];if(_0x3aee22[_0x59a0('0x25')][_0x59a0('0x3f')]){_0x27c1e7[_0x59a0('0x40')]=_[_0x59a0('0x2b')](_0x27c1e7[_0x59a0('0x40')],{'$or':_['map'](_0x27c1e7['attributes'],function(_0x33bd23){var _0x25dde7={};_0x25dde7[_0x33bd23]={'$like':'%'+_0x3aee22[_0x59a0('0x25')][_0x59a0('0x3f')]+'%'};return _0x25dde7;})});}if(_0x3aee22[_0x59a0('0x25')][_0x59a0('0x41')]){var _0xe344fd=_0x3aee22[_0x59a0('0x25')]['$gte'][_0x59a0('0x42')](',');var _0x492c77={};_0x492c77[_0xe344fd[0x0]]={'$gte':moment(_0xe344fd[0x1])[_0x59a0('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x27c1e7[_0x59a0('0x40')]=_['merge'](_0x27c1e7[_0x59a0('0x40')],_0x492c77);}_0x27c1e7=_[_0x59a0('0x2b')]({},_0x27c1e7,_0x3aee22[_0x59a0('0x2c')]);return db[_0x59a0('0x33')][_0x59a0('0x44')]({'where':_0x27c1e7[_0x59a0('0x40')]})['then'](function(_0x7cc99d){_0x4a240b[_0x59a0('0x44')]=_0x7cc99d;if(_0x3aee22[_0x59a0('0x25')]['includeAll']){_0x27c1e7[_0x59a0('0x2a')]=[{'all':!![]}];}return db[_0x59a0('0x33')]['findAll'](_0x27c1e7);})[_0x59a0('0x15')](function(_0x4f6d3b){_0x4a240b[_0x59a0('0x45')]=_0x4f6d3b;return _0x4a240b;});}})[_0x59a0('0x15')](respondWithFilteredResult(_0x25deb2,_0x27c1e7))[_0x59a0('0x2e')](handleError(_0x25deb2,null));};exports[_0x59a0('0x46')]=function(_0x33ef41,_0x55e24a){return db[_0x59a0('0x1a')]['find']({'where':{'id':_0x33ef41['params']['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x55e24a,null))[_0x59a0('0x15')](function(_0x9c1f0f){if(_0x9c1f0f){return _0x9c1f0f['setTags'](_0x33ef41[_0x59a0('0x30')][_0x59a0('0x35')],_['omit'](_0x33ef41[_0x59a0('0x30')],['ids','id'])||{})[_0x59a0('0x47')](function(){return db[_0x59a0('0x48')][_0x59a0('0x1f')]({'attributes':['id','name','color'],'where':{'id':_0x33ef41[_0x59a0('0x30')][_0x59a0('0x35')]}});})['then'](function(_0xbdd94d){socket['emit'](_0x59a0('0x49'),{'id':Number(_0x33ef41[_0x59a0('0x22')]['id']),'tags':_0xbdd94d||[]});return{'id':Number(_0x33ef41['params']['id']),'tags':_0xbdd94d||[]};});}})[_0x59a0('0x15')](respondWithResult(_0x55e24a,null))[_0x59a0('0x2e')](handleError(_0x55e24a,null));};exports[_0x59a0('0x4a')]=function(_0x27545c,_0x343608){return db[_0x59a0('0x1a')][_0x59a0('0x2d')]({'where':{'id':_0x27545c['params']['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x343608,null))['then'](function(_0x511b26){if(_0x511b26){return _0x511b26[_0x59a0('0x4a')](_0x27545c[_0x59a0('0x25')][_0x59a0('0x35')]);}})[_0x59a0('0x15')](respondWithStatusCode(_0x343608,null))[_0x59a0('0x2e')](handleError(_0x343608,null));};exports[_0x59a0('0x4b')]=function(_0x4f68df,_0x3c827f){var _0xc08ebc=moment()[_0x59a0('0x4c')]()[_0x59a0('0x4d')]();var _0x4dec4f=path['join'](config['root'],_0x59a0('0x4e'),_0x59a0('0x4f'),_0x59a0('0x50'));var _0x180914=path[_0x59a0('0x51')](_0x4dec4f,_0xc08ebc);var _0x3b4c92=util[_0x59a0('0x43')](_0x59a0('0x52'),_0x4f68df['params']['id'],_0xc08ebc);var _0x1e031c=path[_0x59a0('0x51')](_0x4dec4f,_0x3b4c92);var _0x570004=[];_0x570004[_0x59a0('0x53')]({'model':db[_0x59a0('0x54')],'as':_0x59a0('0x54'),'attributes':['id',_0x59a0('0x55')],'raw':!![]});_0x570004[_0x59a0('0x53')]({'model':db[_0x59a0('0x56')],'as':_0x59a0('0x57'),'attributes':['id',_0x59a0('0x58'),_0x59a0('0x59')],'raw':!![]});var _0x1362b1=[{'model':db[_0x59a0('0x33')],'as':_0x59a0('0x5a'),'attributes':['id','body',_0x59a0('0x5b'),_0x59a0('0x5c'),_0x59a0('0x5d'),_0x59a0('0x5e')],'include':_0x570004}];_0x1362b1[_0x59a0('0x53')]({'model':db[_0x59a0('0x5f')],'as':_0x59a0('0x60'),'attributes':['id','name']});_0x1362b1['push']({'model':db[_0x59a0('0x54')],'as':_0x59a0('0x61'),'attributes':['id',_0x59a0('0x55')]});return db[_0x59a0('0x1a')]['find']({'where':{'id':_0x4f68df[_0x59a0('0x22')]['id']},'include':_0x1362b1})[_0x59a0('0x15')](handleEntityNotFound(_0x3c827f,null))[_0x59a0('0x15')](function(_0x316ed5){if(_0x316ed5){var _0x161689=_0x316ed5['get']({'plain':!![]});fs[_0x59a0('0x62')](_0x180914);var _0xe91bd5={'channel':'Sms','account':_0x161689['Account'][_0x59a0('0x16')],'agent':_0x161689[_0x59a0('0x61')]?_0x161689[_0x59a0('0x61')][_0x59a0('0x55')]:_0x59a0('0x63'),'createdAt':moment(_0x161689[_0x59a0('0x5b')])[_0x59a0('0x43')](_0x59a0('0x64'))[_0x59a0('0x4d')](),'closedAt':_0x161689[_0x59a0('0x65')]?moment(_0x161689[_0x59a0('0x66')])[_0x59a0('0x43')](_0x59a0('0x64'))['toString']():'','disposition':_0x161689[_0x59a0('0x67')],'messages':_(_0x161689[_0x59a0('0x5a')])[_0x59a0('0x3f')]({'secret':![]})[_0x59a0('0x19')](function(_0x237500){return{'date':moment(_0x237500[_0x59a0('0x5b')])[_0x59a0('0x43')](_0x59a0('0x64'))[_0x59a0('0x4d')](),'sender':_0x237500[_0x59a0('0x5c')]===_0x59a0('0x68')?_0x237500['User']?_0x237500[_0x59a0('0x54')][_0x59a0('0x55')]:_0x59a0('0x69'):_0x237500[_0x59a0('0x57')]['firstName']+(_0x237500[_0x59a0('0x57')][_0x59a0('0x59')]?'\x20'+_0x237500['Contact']['lastName']:''),'body':_0x237500[_0x59a0('0x30')],'direction':_0x237500[_0x59a0('0x5c')]==='out'?'A':'C','secret':_0x237500[_0x59a0('0x5d')],'read':_0x237500['read']};})[_0x59a0('0x6a')]()};return ejs[_0x59a0('0x6b')](path['join'](config['root'],_0x59a0('0x4e'),_0x59a0('0x6c'),'downloadInteraction.ejs'),{'interaction':_0xe91bd5})[_0x59a0('0x15')](function(_0x11a7e0){var _0x3160a9=path['join'](_0x180914,_0x59a0('0x6d')+_0x161689['id']+'-'+_0xc08ebc+_0x59a0('0x6e'));var _0x30babc={'path':_0x3160a9,'channel':_0x59a0('0x6f'),'interactionId':_0x161689['id']};return pdf['createPdfFromHTML'](_0x11a7e0,_0x30babc);})['then'](function(){return new BPromise(function(_0xb0dd38,_0x105647){zipdir(_0x180914,{'saveTo':_0x1e031c},function(_0x288fa0,_0x4de9ee){if(_0x288fa0)return _0x105647(_0x288fa0);return _0xb0dd38(_0x4de9ee);});})[_0x59a0('0x15')](function(){return new BPromise(function(_0x18773b,_0xfe0b6d){rimraf(_0x180914,function(_0x4e3165){if(_0x4e3165)_0xfe0b6d(_0x4e3165);return _0x18773b();});});})[_0x59a0('0x15')](function(){return _0x3c827f[_0x59a0('0x4b')](_0x1e031c,_0x3b4c92,function(_0x4c4186){if(_0x4c4186){console[_0x59a0('0x70')](_0x59a0('0x71'),_0x4c4186);}else{fs[_0x59a0('0x72')](_0x1e031c);}});});});}else{return _0x3c827f[_0x59a0('0xd')](0xc8);}})['catch'](handleError(_0x3c827f,null));}; \ No newline at end of file +var _0x2d79=['util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','show','params','model','keys','filters','attributes','intersection','fields','length','include','merge','options','SmsInteraction','catch','create','body','update','find','describe','SmsMessage','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','firstName','lastName','createdAt','direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','Messages','out','System','Contact','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','zip-dir','moment'];(function(_0x293a10,_0x3e8970){var _0x4cda0f=function(_0x1cfbba){while(--_0x1cfbba){_0x293a10['push'](_0x293a10['shift']());}};_0x4cda0f(++_0x3e8970);}(_0x2d79,0x7a));var _0x92d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2d79[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x92d7('0x0'));var moment=require(_0x92d7('0x1'));var BPromise=require('bluebird');var util=require(_0x92d7('0x2'));var path=require(_0x92d7('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x92d7('0x4'));var Redis=require(_0x92d7('0x5'));var interaction=require(_0x92d7('0x6'));var qs=require(_0x92d7('0x7'));var pdf=require(_0x92d7('0x8'));var logger=require(_0x92d7('0x9'))(_0x92d7('0xa'));var config=require(_0x92d7('0xb'));var db=require(_0x92d7('0xc'))['db'];config[_0x92d7('0xd')]=_[_0x92d7('0xe')](config[_0x92d7('0xd')],{'host':_0x92d7('0xf'),'port':0x18eb});var socket=require(_0x92d7('0x10'))(new Redis(config[_0x92d7('0xd')]));require(_0x92d7('0x11'))[_0x92d7('0x12')](socket);function respondWithStatusCode(_0x315597,_0x356174){_0x356174=_0x356174||0xcc;return function(_0x26bf21){if(_0x26bf21){return _0x315597[_0x92d7('0x13')](_0x356174);}return _0x315597[_0x92d7('0x14')](_0x356174)[_0x92d7('0x15')]();};}function respondWithResult(_0x7a7828,_0x55bc3d){_0x55bc3d=_0x55bc3d||0xc8;return function(_0x2b686d){if(_0x2b686d){return _0x7a7828[_0x92d7('0x14')](_0x55bc3d)[_0x92d7('0x16')](_0x2b686d);}};}function respondWithFilteredResult(_0xfccaaa,_0x12df29){return function(_0x3cfe43){if(_0x3cfe43){var _0x54158c=typeof _0x12df29[_0x92d7('0x17')]===_0x92d7('0x18')&&typeof _0x12df29[_0x92d7('0x19')]==='undefined';var _0x1c0223=_0x3cfe43[_0x92d7('0x1a')];var _0x15f360=_0x54158c?0x0:_0x12df29['offset'];var _0x11aee5=_0x54158c?_0x3cfe43[_0x92d7('0x1a')]:_0x12df29[_0x92d7('0x17')]+_0x12df29[_0x92d7('0x19')];var _0x371fe3;if(_0x11aee5>=_0x1c0223){_0x11aee5=_0x1c0223;_0x371fe3=0xc8;}else{_0x371fe3=0xce;}_0xfccaaa[_0x92d7('0x14')](_0x371fe3);return _0xfccaaa[_0x92d7('0x1b')](_0x92d7('0x1c'),_0x15f360+'-'+_0x11aee5+'/'+_0x1c0223)[_0x92d7('0x16')](_0x3cfe43);}return null;};}function saveUpdates(_0x53d222){return function(_0x4afe82){if(_0x4afe82){return _0x4afe82['update'](_0x53d222)[_0x92d7('0x1d')](function(_0x1f010a){return _0x1f010a;});}return null;};}function removeEntity(_0x4a6844){return function(_0x3af257){if(_0x3af257){return _0x3af257[_0x92d7('0x1e')]()[_0x92d7('0x1d')](function(){_0x4a6844['status'](0xcc)[_0x92d7('0x15')]();});}};}function handleEntityNotFound(_0x226d34){return function(_0x2d696a){if(!_0x2d696a){_0x226d34[_0x92d7('0x13')](0x194);}return _0x2d696a;};}function handleError(_0x32d58b,_0x205cba){_0x205cba=_0x205cba||0x1f4;return function(_0xc1aca){logger['error'](_0xc1aca[_0x92d7('0x1f')]);if(_0xc1aca[_0x92d7('0x20')]){delete _0xc1aca[_0x92d7('0x20')];}_0x32d58b[_0x92d7('0x14')](_0x205cba)[_0x92d7('0x21')](_0xc1aca);};}exports['index']=function(_0x5339f3,_0xa31023){var _0x458a54={};var _0x369035=_[_0x92d7('0x22')](db['SmsInteraction'][_0x92d7('0x23')],function(_0x53481c){return{'name':_0x53481c[_0x92d7('0x24')],'type':_0x53481c[_0x92d7('0x25')][_0x92d7('0x26')]};});_0x458a54=qs[_0x92d7('0x27')](_0x369035,_0x5339f3);return interaction[_0x92d7('0x28')](_0x92d7('0x29'),_0x5339f3[_0x92d7('0x2a')],_0x5339f3[_0x92d7('0x2b')],_0x458a54,_0x369035)['then'](respondWithFilteredResult(_0xa31023,_0x458a54))['catch'](handleError(_0xa31023,null));};exports[_0x92d7('0x2c')]=function(_0x26227a,_0x2f5314){var _0x54c803={'raw':![],'where':{'id':_0x26227a[_0x92d7('0x2d')]['id']}},_0x1d8544={};_0x1d8544[_0x92d7('0x2e')]=_[_0x92d7('0x2f')](db['SmsInteraction']['rawAttributes']);_0x1d8544['query']=_[_0x92d7('0x2f')](_0x26227a[_0x92d7('0x2a')]);_0x1d8544[_0x92d7('0x30')]=_['intersection'](_0x1d8544[_0x92d7('0x2e')],_0x1d8544[_0x92d7('0x2a')]);_0x54c803[_0x92d7('0x31')]=_[_0x92d7('0x32')](_0x1d8544[_0x92d7('0x2e')],qs[_0x92d7('0x33')](_0x26227a[_0x92d7('0x2a')][_0x92d7('0x33')]));_0x54c803[_0x92d7('0x31')]=_0x54c803['attributes'][_0x92d7('0x34')]?_0x54c803[_0x92d7('0x31')]:_0x1d8544[_0x92d7('0x2e')];if(_0x26227a[_0x92d7('0x2a')]['includeAll']){_0x54c803[_0x92d7('0x35')]=[{'all':!![]}];}_0x54c803=_[_0x92d7('0x36')]({},_0x54c803,_0x26227a[_0x92d7('0x37')]);return db[_0x92d7('0x38')]['find'](_0x54c803)[_0x92d7('0x1d')](handleEntityNotFound(_0x2f5314,null))[_0x92d7('0x1d')](respondWithResult(_0x2f5314,null))[_0x92d7('0x39')](handleError(_0x2f5314,null));};exports[_0x92d7('0x3a')]=function(_0x1298bd,_0x3851a0){return db[_0x92d7('0x38')]['create'](_0x1298bd[_0x92d7('0x3b')],{})[_0x92d7('0x1d')](respondWithResult(_0x3851a0,0xc9))['catch'](handleError(_0x3851a0,null));};exports[_0x92d7('0x3c')]=function(_0x4d215d,_0x74a4e5){if(_0x4d215d[_0x92d7('0x3b')]['id']){delete _0x4d215d['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x4d215d[_0x92d7('0x2d')]['id']}})[_0x92d7('0x1d')](handleEntityNotFound(_0x74a4e5,null))['then'](saveUpdates(_0x4d215d[_0x92d7('0x3b')],null))[_0x92d7('0x1d')](respondWithResult(_0x74a4e5,null))[_0x92d7('0x39')](handleError(_0x74a4e5,null));};exports[_0x92d7('0x1e')]=function(_0xbafac9,_0x382929){return db['SmsInteraction'][_0x92d7('0x3d')]({'where':{'id':_0xbafac9['params']['id']}})[_0x92d7('0x1d')](handleEntityNotFound(_0x382929,null))[_0x92d7('0x1d')](removeEntity(_0x382929,null))['catch'](handleError(_0x382929,null));};exports[_0x92d7('0x3e')]=function(_0x3bd4f2,_0x1a7c07){return db[_0x92d7('0x38')][_0x92d7('0x3e')]()['then'](respondWithResult(_0x1a7c07,null))[_0x92d7('0x39')](handleError(_0x1a7c07,null));};exports['addMessage']=function(_0x550071,_0x267a22){return db[_0x92d7('0x3f')][_0x92d7('0x3d')]({'where':{'id':_0x550071[_0x92d7('0x2d')]['id']}})[_0x92d7('0x1d')](handleEntityNotFound(_0x267a22,null))[_0x92d7('0x1d')](function(_0x44a118){if(_0x44a118){return _0x44a118[_0x92d7('0x40')](_0x550071[_0x92d7('0x3b')][_0x92d7('0x41')],_[_0x92d7('0x42')](_0x550071['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x267a22,null))[_0x92d7('0x39')](handleError(_0x267a22,null));};exports[_0x92d7('0x43')]=function(_0x389390,_0x419f3f){var _0x57e10d={'raw':![],'where':{}};var _0x4aab6d={};var _0x2a7138={'count':0x0,'rows':[]};return db[_0x92d7('0x38')]['findOne']({'where':{'id':_0x389390[_0x92d7('0x2d')]['id']}})[_0x92d7('0x1d')](handleEntityNotFound(_0x419f3f,null))[_0x92d7('0x1d')](function(_0x27a789){if(_0x27a789){_0x4aab6d['model']=_['keys'](db['SmsMessage'][_0x92d7('0x23')]);_0x4aab6d[_0x92d7('0x2a')]=_[_0x92d7('0x2f')](_0x389390['query']);_0x4aab6d[_0x92d7('0x30')]=_[_0x92d7('0x32')](_0x4aab6d[_0x92d7('0x2e')],_0x4aab6d[_0x92d7('0x2a')]);_0x57e10d['attributes']=_[_0x92d7('0x32')](_0x4aab6d[_0x92d7('0x2e')],qs[_0x92d7('0x33')](_0x389390[_0x92d7('0x2a')][_0x92d7('0x33')]));_0x57e10d[_0x92d7('0x31')]=_0x57e10d[_0x92d7('0x31')][_0x92d7('0x34')]?_0x57e10d['attributes']:_0x4aab6d['model'];if(!_0x389390['query'][_0x92d7('0x44')](_0x92d7('0x45'))){_0x57e10d[_0x92d7('0x19')]=qs['limit'](_0x389390[_0x92d7('0x2a')][_0x92d7('0x19')]);_0x57e10d[_0x92d7('0x17')]=qs['offset'](_0x389390[_0x92d7('0x2a')][_0x92d7('0x17')]);}_0x57e10d['order']=qs[_0x92d7('0x46')](_0x389390['query'][_0x92d7('0x46')]);_0x57e10d[_0x92d7('0x47')]=qs[_0x92d7('0x30')](_['pick'](_0x389390[_0x92d7('0x2a')],_0x4aab6d[_0x92d7('0x30')]));_0x57e10d[_0x92d7('0x47')][_0x92d7('0x48')]=_0x27a789['id'];if(_0x389390[_0x92d7('0x2a')][_0x92d7('0x49')]){_0x57e10d[_0x92d7('0x47')]=_['merge'](_0x57e10d['where'],{'$or':_[_0x92d7('0x22')](_0x57e10d[_0x92d7('0x31')],function(_0x12f816){var _0x32a610={};_0x32a610[_0x12f816]={'$like':'%'+_0x389390[_0x92d7('0x2a')][_0x92d7('0x49')]+'%'};return _0x32a610;})});}if(_0x389390[_0x92d7('0x2a')]['$gte']){var _0x1c8314=_0x389390[_0x92d7('0x2a')][_0x92d7('0x4a')][_0x92d7('0x4b')](',');var _0x1e40e9={};_0x1e40e9[_0x1c8314[0x0]]={'$gte':moment(_0x1c8314[0x1])[_0x92d7('0x4c')](_0x92d7('0x4d'))};_0x57e10d[_0x92d7('0x47')]=_[_0x92d7('0x36')](_0x57e10d[_0x92d7('0x47')],_0x1e40e9);}_0x57e10d=_[_0x92d7('0x36')]({},_0x57e10d,_0x389390[_0x92d7('0x37')]);return db['SmsMessage'][_0x92d7('0x1a')]({'where':_0x57e10d[_0x92d7('0x47')]})[_0x92d7('0x1d')](function(_0x21d78f){_0x2a7138[_0x92d7('0x1a')]=_0x21d78f;if(_0x389390['query']['includeAll']){_0x57e10d[_0x92d7('0x35')]=[{'all':!![]}];}return db[_0x92d7('0x3f')][_0x92d7('0x28')](_0x57e10d);})[_0x92d7('0x1d')](function(_0x781828){_0x2a7138[_0x92d7('0x4e')]=_0x781828;return _0x2a7138;});}})['then'](respondWithFilteredResult(_0x419f3f,_0x57e10d))[_0x92d7('0x39')](handleError(_0x419f3f,null));};exports[_0x92d7('0x4f')]=function(_0x28090c,_0x37d1c1){return db[_0x92d7('0x38')]['find']({'where':{'id':_0x28090c[_0x92d7('0x2d')]['id']}})[_0x92d7('0x1d')](handleEntityNotFound(_0x37d1c1,null))[_0x92d7('0x1d')](function(_0x27c419){if(_0x27c419){return _0x27c419['setTags'](_0x28090c[_0x92d7('0x3b')][_0x92d7('0x41')],_[_0x92d7('0x42')](_0x28090c[_0x92d7('0x3b')],['ids','id'])||{})[_0x92d7('0x50')](function(){return db[_0x92d7('0x51')]['findAll']({'attributes':['id',_0x92d7('0x20'),_0x92d7('0x52')],'where':{'id':_0x28090c[_0x92d7('0x3b')][_0x92d7('0x41')]}});})[_0x92d7('0x1d')](function(_0xaa7bae){socket[_0x92d7('0x53')](_0x92d7('0x54'),{'id':Number(_0x28090c[_0x92d7('0x2d')]['id']),'tags':_0xaa7bae||[]});return{'id':Number(_0x28090c['params']['id']),'tags':_0xaa7bae||[]};});}})[_0x92d7('0x1d')](respondWithResult(_0x37d1c1,null))[_0x92d7('0x39')](handleError(_0x37d1c1,null));};exports['removeTags']=function(_0x10201e,_0xc6a86b){return db[_0x92d7('0x38')][_0x92d7('0x3d')]({'where':{'id':_0x10201e[_0x92d7('0x2d')]['id']}})[_0x92d7('0x1d')](handleEntityNotFound(_0xc6a86b,null))[_0x92d7('0x1d')](function(_0x185c2b){if(_0x185c2b){return _0x185c2b[_0x92d7('0x55')](_0x10201e['query'][_0x92d7('0x41')]);}})[_0x92d7('0x1d')](respondWithStatusCode(_0xc6a86b,null))[_0x92d7('0x39')](handleError(_0xc6a86b,null));};exports[_0x92d7('0x56')]=function(_0x3fba9f,_0x3045bb){var _0x12f8a9=moment()[_0x92d7('0x57')]()[_0x92d7('0x58')]();var _0x5eee5e=path['join'](config['root'],_0x92d7('0x59'),_0x92d7('0x5a'),_0x92d7('0x5b'));var _0x5b63b2=path[_0x92d7('0x5c')](_0x5eee5e,_0x12f8a9);var _0x5e23d0=util[_0x92d7('0x4c')](_0x92d7('0x5d'),_0x3fba9f[_0x92d7('0x2d')]['id'],_0x12f8a9);var _0x2f0b40=path[_0x92d7('0x5c')](_0x5eee5e,_0x5e23d0);var _0x2bbdd8=[];_0x2bbdd8[_0x92d7('0x5e')]({'model':db[_0x92d7('0x5f')],'as':_0x92d7('0x5f'),'attributes':['id',_0x92d7('0x60')],'raw':!![]});_0x2bbdd8[_0x92d7('0x5e')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x92d7('0x61'),_0x92d7('0x62')],'raw':!![]});var _0x2576f2=[{'model':db[_0x92d7('0x3f')],'as':'Messages','attributes':['id',_0x92d7('0x3b'),_0x92d7('0x63'),_0x92d7('0x64'),'secret',_0x92d7('0x65')],'include':_0x2bbdd8}];_0x2576f2[_0x92d7('0x5e')]({'model':db[_0x92d7('0x66')],'as':_0x92d7('0x67'),'attributes':['id',_0x92d7('0x20')]});_0x2576f2[_0x92d7('0x5e')]({'model':db[_0x92d7('0x5f')],'as':_0x92d7('0x68'),'attributes':['id',_0x92d7('0x60')]});return db[_0x92d7('0x38')][_0x92d7('0x3d')]({'where':{'id':_0x3fba9f[_0x92d7('0x2d')]['id']},'include':_0x2576f2})[_0x92d7('0x1d')](handleEntityNotFound(_0x3045bb,null))['then'](function(_0x805fa0){if(_0x805fa0){var _0x31fe45=_0x805fa0[_0x92d7('0x69')]({'plain':!![]});fs[_0x92d7('0x6a')](_0x5b63b2);var _0x33f33c={'channel':_0x92d7('0x6b'),'account':_0x31fe45['Account'][_0x92d7('0x20')],'agent':_0x31fe45['Owner']?_0x31fe45[_0x92d7('0x68')][_0x92d7('0x60')]:_0x92d7('0x6c'),'createdAt':moment(_0x31fe45['createdAt'])['format'](_0x92d7('0x4d'))['toString'](),'closedAt':_0x31fe45[_0x92d7('0x6d')]?moment(_0x31fe45[_0x92d7('0x6e')])['format'](_0x92d7('0x4d'))[_0x92d7('0x58')]():'','disposition':_0x31fe45['disposition'],'messages':_(_0x31fe45[_0x92d7('0x6f')])[_0x92d7('0x49')]({'secret':![]})[_0x92d7('0x22')](function(_0x468966){return{'date':moment(_0x468966['createdAt'])['format'](_0x92d7('0x4d'))['toString'](),'sender':_0x468966['direction']===_0x92d7('0x70')?_0x468966[_0x92d7('0x5f')]?_0x468966['User'][_0x92d7('0x60')]:_0x92d7('0x71'):_0x468966[_0x92d7('0x72')][_0x92d7('0x61')]+(_0x468966[_0x92d7('0x72')][_0x92d7('0x62')]?'\x20'+_0x468966['Contact'][_0x92d7('0x62')]:''),'body':_0x468966['body'],'direction':_0x468966[_0x92d7('0x64')]===_0x92d7('0x70')?'A':'C','secret':_0x468966['secret'],'read':_0x468966[_0x92d7('0x65')]};})[_0x92d7('0x73')]()};return ejs[_0x92d7('0x74')](path[_0x92d7('0x5c')](config[_0x92d7('0x75')],'server',_0x92d7('0x76'),_0x92d7('0x77')),{'interaction':_0x33f33c})[_0x92d7('0x1d')](function(_0x35f97e){var _0x23b7a2=path[_0x92d7('0x5c')](_0x5b63b2,_0x92d7('0x78')+_0x31fe45['id']+'-'+_0x12f8a9+_0x92d7('0x79'));var _0x348526={'path':_0x23b7a2,'channel':_0x92d7('0x6b'),'interactionId':_0x31fe45['id']};return pdf['createPdfFromHTML'](_0x35f97e,_0x348526);})[_0x92d7('0x1d')](function(){return new BPromise(function(_0x49f65b,_0x425bb2){zipdir(_0x5b63b2,{'saveTo':_0x2f0b40},function(_0x187dde,_0x1a088c){if(_0x187dde)return _0x425bb2(_0x187dde);return _0x49f65b(_0x1a088c);});})[_0x92d7('0x1d')](function(){return new BPromise(function(_0x4058e8,_0x174ff6){rimraf(_0x5b63b2,function(_0x8e4be1){if(_0x8e4be1)_0x174ff6(_0x8e4be1);return _0x4058e8();});});})[_0x92d7('0x1d')](function(){return _0x3045bb[_0x92d7('0x56')](_0x2f0b40,_0x5e23d0,function(_0x135787){if(_0x135787){console['log'](_0x92d7('0x7a'),_0x135787);}else{fs[_0x92d7('0x7b')](_0x2f0b40);}});});});}else{return _0x3045bb[_0x92d7('0x13')](0xc8);}})['catch'](handleError(_0x3045bb,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 561d70f..e8d7019 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 _0x627e=['remove','getUsers','then','setDataValue','Users','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update'];(function(_0x166f68,_0x2cc701){var _0x5580e3=function(_0x39ed65){while(--_0x39ed65){_0x166f68['push'](_0x166f68['shift']());}};_0x5580e3(++_0x2cc701);}(_0x627e,0x14a));var _0xe627=function(_0x2d4126,_0x4a9038){_0x2d4126=_0x2d4126-0x0;var _0x36d19f=_0x627e[_0x2d4126];return _0x36d19f;};'use strict';var EventEmitter=require(_0xe627('0x0'));var SmsInteraction=require(_0xe627('0x1'))['db'][_0xe627('0x2')];var SmsMessage=require(_0xe627('0x1'))['db'][_0xe627('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe627('0x4'),'afterUpdate':_0xe627('0x5'),'afterDestroy':_0xe627('0x6')};function emitEvent(_0x59a2c8){return function(_0x52923f,_0x4efcad,_0x1a1a3d){_0x52923f[_0xe627('0x7')]({'attributes':['id'],'raw':!![]})[_0xe627('0x8')](function(_0x2d4f63){_0x52923f[_0xe627('0x9')](_0xe627('0xa'),_0x2d4f63['map'](function(_0x3f2948){return{'id':_0x3f2948['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x52923f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4411c0){_0x52923f[_0xe627('0x9')]('unreadMessages',_0x4411c0['length']);SmsInteractionEvents[_0xe627('0xb')](_0x59a2c8+':'+_0x52923f['id'],_0x52923f);SmsInteractionEvents[_0xe627('0xb')](_0x59a2c8,_0x52923f);_0x1a1a3d(null);})[_0xe627('0xc')](_0x1a1a3d(null));};}for(var e in events){if(events[_0xe627('0xd')](e)){var event=events[e];SmsInteraction[_0xe627('0xe')](e,emitEvent(event));}}module[_0xe627('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x3de3=['length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x3de3,0x1ce));var _0x33de=function(_0x2e3c2b,_0x6c77d9){_0x2e3c2b=_0x2e3c2b-0x0;var _0x2ce2a7=_0x3de3[_0x2e3c2b];return _0x2ce2a7;};'use strict';var EventEmitter=require(_0x33de('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x33de('0x1')];var SmsMessage=require(_0x33de('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x33de('0x3')](0x0);var events={'afterCreate':_0x33de('0x4'),'afterUpdate':_0x33de('0x5'),'afterDestroy':_0x33de('0x6')};function emitEvent(_0x56b413){return function(_0x11c87e,_0x9382cb,_0x558f98){_0x11c87e[_0x33de('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x13afea){_0x11c87e[_0x33de('0x8')](_0x33de('0x9'),_0x13afea['map'](function(_0x2074fe){return{'id':_0x2074fe['id']};}));return SmsMessage[_0x33de('0xa')]({'where':{'SmsInteractionId':_0x11c87e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x33de('0xb')](function(_0x5e1be7){_0x11c87e[_0x33de('0x8')](_0x33de('0xc'),_0x5e1be7[_0x33de('0xd')]);SmsInteractionEvents[_0x33de('0xe')](_0x56b413+':'+_0x11c87e['id'],_0x11c87e);SmsInteractionEvents[_0x33de('0xe')](_0x56b413,_0x11c87e);_0x558f98(null);})[_0x33de('0xf')](_0x558f98(null));};}for(var e in events){if(events[_0x33de('0x10')](e)){var event=events[e];SmsInteraction[_0x33de('0x11')](e,emitEvent(event));}}module[_0x33de('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 4dfdc42..e89f07a 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 _0xadce=['exports','define','SmsInteraction','sms_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xadce,0xf1));var _0xeadc=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xadce[_0x20589d];return _0x422de9;};'use strict';var _=require(_0xeadc('0x0'));var util=require(_0xeadc('0x1'));var logger=require(_0xeadc('0x2'))(_0xeadc('0x3'));var moment=require(_0xeadc('0x4'));var BPromise=require(_0xeadc('0x5'));var rp=require(_0xeadc('0x6'));var fs=require('fs');var path=require(_0xeadc('0x7'));var rimraf=require(_0xeadc('0x8'));var config=require(_0xeadc('0x9'));var attributes=require(_0xeadc('0xa'));module[_0xeadc('0xb')]=function(_0x2d7f43,_0x115ae0){return _0x2d7f43[_0xeadc('0xc')](_0xeadc('0xd'),attributes,{'tableName':_0xeadc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x152b20,_0x5d3bf,_0x2fdaf7){if(_0x152b20['changed']('closed')){_0x152b20[_0xeadc('0xf')]=moment()[_0xeadc('0x10')](_0xeadc('0x11'));}_0x2fdaf7(null,_0x152b20);}}});}; \ No newline at end of file +var _0xb990=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xb990,0x7b));var _0x0b99=function(_0x57d160,_0x381043){_0x57d160=_0x57d160-0x0;var _0x30c242=_0xb990[_0x57d160];return _0x30c242;};'use strict';var _=require(_0x0b99('0x0'));var util=require(_0x0b99('0x1'));var logger=require(_0x0b99('0x2'))(_0x0b99('0x3'));var moment=require(_0x0b99('0x4'));var BPromise=require(_0x0b99('0x5'));var rp=require(_0x0b99('0x6'));var fs=require('fs');var path=require(_0x0b99('0x7'));var rimraf=require(_0x0b99('0x8'));var config=require(_0x0b99('0x9'));var attributes=require('./smsInteraction.attributes');module[_0x0b99('0xa')]=function(_0x55bb73,_0x309419){return _0x55bb73[_0x0b99('0xb')](_0x0b99('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6b2e79,_0x495727,_0x52bba2){if(_0x6b2e79[_0x0b99('0xd')](_0x0b99('0xe'))){_0x6b2e79[_0x0b99('0xf')]=moment()[_0x0b99('0x10')](_0x0b99('0x11'));}_0x52bba2(null,_0x6b2e79);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 2f7b34e..4ee7b45 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 _0x95c8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x95c8,0xa3));var _0x895c=function(_0x5634e2,_0xcbc3d6){_0x5634e2=_0x5634e2-0x0;var _0x50b5f2=_0x95c8[_0x5634e2];return _0x50b5f2;};'use strict';var _=require(_0x895c('0x0'));var util=require(_0x895c('0x1'));var moment=require(_0x895c('0x2'));var BPromise=require(_0x895c('0x3'));var rs=require(_0x895c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x895c('0x5'))['db'];var utils=require(_0x895c('0x6'));var logger=require(_0x895c('0x7'))(_0x895c('0x8'));var config=require(_0x895c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x895c('0xa')][_0x895c('0xb')]({'port':0x232a});config['redis']=_[_0x895c('0xc')](config['redis'],{'host':_0x895c('0xd'),'port':0x18eb});var socket=require(_0x895c('0xe'))(new Redis(config['redis']));require(_0x895c('0xf'))[_0x895c('0x10')](socket);function respondWithRpcPromise(_0x1d61d7,_0xe7dd8b,_0x30d7d8){return new BPromise(function(_0x532535,_0x1900a2){return client[_0x895c('0x11')](_0x1d61d7,_0x30d7d8)[_0x895c('0x12')](function(_0x1cf6b3){logger[_0x895c('0x13')](_0x895c('0x14'),_0xe7dd8b,_0x895c('0x15'));logger[_0x895c('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xe7dd8b,_0x895c('0x15'),JSON[_0x895c('0x17')](_0x1cf6b3));if(_0x1cf6b3['error']){if(_0x1cf6b3[_0x895c('0x18')]['code']===0x1f4){logger[_0x895c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xe7dd8b,_0x1cf6b3[_0x895c('0x18')]['message']);return _0x1900a2(_0x1cf6b3[_0x895c('0x18')][_0x895c('0x19')]);}logger[_0x895c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xe7dd8b,_0x1cf6b3['error'][_0x895c('0x19')]);return _0x532535(_0x1cf6b3[_0x895c('0x18')][_0x895c('0x19')]);}else{logger[_0x895c('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xe7dd8b,_0x895c('0x15'));_0x532535(_0x1cf6b3[_0x895c('0x1a')]['message']);}})[_0x895c('0x1b')](function(_0x206a8a){logger[_0x895c('0x18')](_0x895c('0x14'),_0xe7dd8b,_0x206a8a);_0x1900a2(_0x206a8a);});});}exports[_0x895c('0x1c')]=function(_0x1ff4b2){var _0x14281e=this;return new Promise(function(_0x13892d,_0xc016ad){return db[_0x895c('0x1d')][_0x895c('0x1e')](_0x1ff4b2[_0x895c('0x1f')],{'raw':_0x1ff4b2[_0x895c('0x20')]?_0x1ff4b2[_0x895c('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff4b2[_0x895c('0x20')]?_0x1ff4b2[_0x895c('0x20')][_0x895c('0x21')]||null:null,'attributes':_0x1ff4b2[_0x895c('0x20')]?_0x1ff4b2[_0x895c('0x20')][_0x895c('0x22')]||null:null,'limit':_0x1ff4b2['options']?_0x1ff4b2['options'][_0x895c('0x23')]||null:null})[_0x895c('0x12')](function(_0x969ed6){logger[_0x895c('0x13')](_0x895c('0x1c'),_0x1ff4b2);logger[_0x895c('0x16')](_0x895c('0x1c'),_0x1ff4b2,JSON[_0x895c('0x17')](_0x969ed6));_0x13892d(_0x969ed6);})[_0x895c('0x1b')](function(_0x1d21f3){logger[_0x895c('0x18')](_0x895c('0x1c'),_0x1d21f3[_0x895c('0x19')],_0x1ff4b2);_0xc016ad(_0x14281e['error'](0x1f4,_0x1d21f3[_0x895c('0x19')]));});});};exports[_0x895c('0x24')]=function(_0x3ffb31){return new Promise(function(_0x3260c1,_0x2a7907){return db[_0x895c('0x1d')][_0x895c('0x25')]({'where':_0x3ffb31['options']?_0x3ffb31[_0x895c('0x20')][_0x895c('0x21')]||null:null})[_0x895c('0x12')](function(_0x446094){if(_0x446094){return _0x446094[_0x895c('0x26')](_0x3ffb31[_0x895c('0x1f')][_0x895c('0x27')],_[_0x895c('0x28')](_0x3ffb31[_0x895c('0x1f')],[_0x895c('0x27'),'id'])||{});}})['spread'](function(_0xc8de5b){logger[_0x895c('0x13')]('AddTags',_0x3ffb31);logger[_0x895c('0x16')](_0x895c('0x29'),_0x3ffb31,JSON[_0x895c('0x17')](_0xc8de5b));_0x3260c1(_0xc8de5b);})[_0x895c('0x1b')](function(_0x13aa15){logger['error'](_0x895c('0x29'),_0x13aa15[_0x895c('0x19')],_0x3ffb31);_0x2a7907(_this[_0x895c('0x18')](0x1f4,_0x13aa15[_0x895c('0x19')]));});});}; \ No newline at end of file +var _0xc97a=['SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','update','raw','options','where','attributes','catch','AddTagsToSmsInteraction','SmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info'];(function(_0x38de9a,_0x135855){var _0x210c33=function(_0x5d3aa4){while(--_0x5d3aa4){_0x38de9a['push'](_0x38de9a['shift']());}};_0x210c33(++_0x135855);}(_0xc97a,0xcd));var _0xac97=function(_0x507ea9,_0x5894e9){_0x507ea9=_0x507ea9-0x0;var _0x8abb72=_0xc97a[_0x507ea9];return _0x8abb72;};'use strict';var _=require(_0xac97('0x0'));var util=require(_0xac97('0x1'));var moment=require(_0xac97('0x2'));var BPromise=require(_0xac97('0x3'));var rs=require(_0xac97('0x4'));var fs=require('fs');var Redis=require(_0xac97('0x5'));var db=require(_0xac97('0x6'))['db'];var utils=require(_0xac97('0x7'));var logger=require(_0xac97('0x8'))(_0xac97('0x9'));var config=require(_0xac97('0xa'));var jayson=require(_0xac97('0xb'));var client=jayson[_0xac97('0xc')][_0xac97('0xd')]({'port':0x232a});config[_0xac97('0xe')]=_['defaults'](config[_0xac97('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xac97('0xf'))(new Redis(config[_0xac97('0xe')]));require('./smsInteraction.socket')[_0xac97('0x10')](socket);function respondWithRpcPromise(_0x2abe95,_0x73c1b9,_0x3c2638){return new BPromise(function(_0x457eef,_0x29d688){return client[_0xac97('0x11')](_0x2abe95,_0x3c2638)[_0xac97('0x12')](function(_0x54d68d){logger[_0xac97('0x13')](_0xac97('0x14'),_0x73c1b9,_0xac97('0x15'));logger[_0xac97('0x16')](_0xac97('0x17'),_0x73c1b9,'request\x20sent',JSON[_0xac97('0x18')](_0x54d68d));if(_0x54d68d['error']){if(_0x54d68d[_0xac97('0x19')][_0xac97('0x1a')]===0x1f4){logger[_0xac97('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x73c1b9,_0x54d68d[_0xac97('0x19')][_0xac97('0x1b')]);return _0x29d688(_0x54d68d[_0xac97('0x19')][_0xac97('0x1b')]);}logger['error'](_0xac97('0x14'),_0x73c1b9,_0x54d68d['error'][_0xac97('0x1b')]);return _0x457eef(_0x54d68d['error'][_0xac97('0x1b')]);}else{logger[_0xac97('0x13')](_0xac97('0x14'),_0x73c1b9,_0xac97('0x15'));_0x457eef(_0x54d68d[_0xac97('0x1c')][_0xac97('0x1b')]);}})['catch'](function(_0x4b99bc){logger[_0xac97('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x73c1b9,_0x4b99bc);_0x29d688(_0x4b99bc);});});}exports[_0xac97('0x1d')]=function(_0xd55787){var _0xe86bda=this;return new Promise(function(_0x2a9987,_0x1b4fbd){return db['SmsInteraction'][_0xac97('0x1e')](_0xd55787['body'],{'raw':_0xd55787['options']?_0xd55787['options'][_0xac97('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd55787['options']?_0xd55787[_0xac97('0x20')][_0xac97('0x21')]||null:null,'attributes':_0xd55787[_0xac97('0x20')]?_0xd55787['options'][_0xac97('0x22')]||null:null,'limit':_0xd55787['options']?_0xd55787[_0xac97('0x20')]['limit']||null:null})[_0xac97('0x12')](function(_0x12b21d){logger[_0xac97('0x13')](_0xac97('0x1d'),_0xd55787);logger[_0xac97('0x16')](_0xac97('0x1d'),_0xd55787,JSON[_0xac97('0x18')](_0x12b21d));_0x2a9987(_0x12b21d);})[_0xac97('0x23')](function(_0x48c9d4){logger[_0xac97('0x19')]('UpdateSmsInteraction',_0x48c9d4['message'],_0xd55787);_0x1b4fbd(_0xe86bda[_0xac97('0x19')](0x1f4,_0x48c9d4[_0xac97('0x1b')]));});});};exports[_0xac97('0x24')]=function(_0x17efa6){return new Promise(function(_0x31b145,_0x5f439f){return db[_0xac97('0x25')][_0xac97('0x26')]({'where':_0x17efa6[_0xac97('0x20')]?_0x17efa6[_0xac97('0x20')][_0xac97('0x21')]||null:null})[_0xac97('0x12')](function(_0xb9a71e){if(_0xb9a71e){return _0xb9a71e[_0xac97('0x27')](_0x17efa6[_0xac97('0x28')][_0xac97('0x29')],_[_0xac97('0x2a')](_0x17efa6[_0xac97('0x28')],[_0xac97('0x29'),'id'])||{});}})[_0xac97('0x2b')](function(_0x3c94fb){logger[_0xac97('0x13')](_0xac97('0x2c'),_0x17efa6);logger[_0xac97('0x16')]('AddTags',_0x17efa6,JSON[_0xac97('0x18')](_0x3c94fb));_0x31b145(_0x3c94fb);})[_0xac97('0x23')](function(_0x1eefe4){logger['error'](_0xac97('0x2c'),_0x1eefe4[_0xac97('0x1b')],_0x17efa6);_0x5f439f(_this[_0xac97('0x19')](0x1f4,_0x1eefe4[_0xac97('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 9003c9a..ee5688a 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 _0x1b53=['register','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x3ea647,_0x2a346d){var _0x4a7c98=function(_0x4c905c){while(--_0x4c905c){_0x3ea647['push'](_0x3ea647['shift']());}};_0x4a7c98(++_0x2a346d);}(_0x1b53,0x14b));var _0x31b5=function(_0xa3c044,_0x19d123){_0xa3c044=_0xa3c044-0x0;var _0x1d376f=_0x1b53[_0xa3c044];return _0x1d376f;};'use strict';var SmsInteractionEvents=require(_0x31b5('0x0'));var events=[_0x31b5('0x1'),_0x31b5('0x2'),_0x31b5('0x3')];function createListener(_0x21937a,_0xc4ea5a){return function(_0x1f7be9){_0xc4ea5a[_0x31b5('0x4')](_0x21937a,_0x1f7be9);};}function removeListener(_0x1d28b8,_0x48a1ad){return function(){SmsInteractionEvents['removeListener'](_0x1d28b8,_0x48a1ad);};}exports[_0x31b5('0x5')]=function(_0x169290){for(var _0x2cd154=0x0,_0x3699b6=events[_0x31b5('0x6')];_0x2cd154<_0x3699b6;_0x2cd154++){var _0x1bd045=events[_0x2cd154];var _0x16b660=createListener(_0x31b5('0x7')+_0x1bd045,_0x169290);SmsInteractionEvents['on'](_0x1bd045,_0x16b660);}}; \ No newline at end of file +var _0x8184=['update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x4a5b00,_0x20c4b2){var _0xe33c8f=function(_0x586c31){while(--_0x586c31){_0x4a5b00['push'](_0x4a5b00['shift']());}};_0xe33c8f(++_0x20c4b2);}(_0x8184,0x196));var _0x4818=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x8184[_0x4c0622];return _0x1799d8;};'use strict';var SmsInteractionEvents=require(_0x4818('0x0'));var events=[_0x4818('0x1'),'remove',_0x4818('0x2')];function createListener(_0x40139c,_0x3ec389){return function(_0x4d5875){_0x3ec389[_0x4818('0x3')](_0x40139c,_0x4d5875);};}function removeListener(_0x2a9dde,_0x3ed18e){return function(){SmsInteractionEvents[_0x4818('0x4')](_0x2a9dde,_0x3ed18e);};}exports[_0x4818('0x5')]=function(_0x4687bd){for(var _0x2459dc=0x0,_0x41c406=events[_0x4818('0x6')];_0x2459dc<_0x41c406;_0x2459dc++){var _0x32f45e=events[_0x2459dc];var _0x19a49f=createListener(_0x4818('0x7')+_0x32f45e,_0x4687bd);SmsInteractionEvents['on'](_0x32f45e,_0x19a49f);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 20554db..494ac54 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 _0xf12f=['isAuthenticated','index','/describe','describe','/:id','show','tracked','sms','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x40a9c8,_0x593b7f){var _0x4b341d=function(_0x426cc2){while(--_0x426cc2){_0x40a9c8['push'](_0x40a9c8['shift']());}};_0x4b341d(++_0x593b7f);}(_0xf12f,0x104));var _0xff12=function(_0x30d4b8,_0x176f45){_0x30d4b8=_0x30d4b8-0x0;var _0x54c9a4=_0xf12f[_0x30d4b8];return _0x54c9a4;};'use strict';var multer=require(_0xff12('0x0'));var util=require(_0xff12('0x1'));var path=require(_0xff12('0x2'));var timeout=require(_0xff12('0x3'));var express=require('express');var router=express[_0xff12('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff12('0x5'));var interaction=require(_0xff12('0x6'));var config=require(_0xff12('0x7'));var controller=require(_0xff12('0x8'));router[_0xff12('0x9')]('/',auth[_0xff12('0xa')](),controller[_0xff12('0xb')]);router['get'](_0xff12('0xc'),auth['isAuthenticated'](),controller[_0xff12('0xd')]);router[_0xff12('0x9')](_0xff12('0xe'),auth[_0xff12('0xa')](),controller[_0xff12('0xf')]);router['post']('/',auth[_0xff12('0xa')](),interaction[_0xff12('0x10')](_0xff12('0x11'),'smsmessage:create'),controller[_0xff12('0x12')]);router['post'](_0xff12('0x13'),controller[_0xff12('0x14')]);router['put']('/:id',auth[_0xff12('0xa')](),controller[_0xff12('0x15')]);router[_0xff12('0x16')](_0xff12('0x17'),auth[_0xff12('0xa')](),controller[_0xff12('0x18')]);router[_0xff12('0x16')](_0xff12('0x19'),auth['isAuthenticated'](),controller[_0xff12('0x1a')]);router[_0xff12('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xff12('0x1c')]);module[_0xff12('0x1d')]=router; \ No newline at end of file +var _0xdeb2=['show','post','tracked','smsmessage:create','/:id/status','status','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x28d75c,_0x117442){var _0x1ec6a7=function(_0x58ad87){while(--_0x58ad87){_0x28d75c['push'](_0x28d75c['shift']());}};_0x1ec6a7(++_0x117442);}(_0xdeb2,0x64));var _0x2deb=function(_0x32a34b,_0x214a6f){_0x32a34b=_0x32a34b-0x0;var _0x4fef41=_0xdeb2[_0x32a34b];return _0x4fef41;};'use strict';var multer=require(_0x2deb('0x0'));var util=require(_0x2deb('0x1'));var path=require(_0x2deb('0x2'));var timeout=require(_0x2deb('0x3'));var express=require(_0x2deb('0x4'));var router=express['Router']();var fs_extra=require(_0x2deb('0x5'));var auth=require(_0x2deb('0x6'));var interaction=require(_0x2deb('0x7'));var config=require(_0x2deb('0x8'));var controller=require(_0x2deb('0x9'));router[_0x2deb('0xa')]('/',auth['isAuthenticated'](),controller[_0x2deb('0xb')]);router[_0x2deb('0xa')](_0x2deb('0xc'),auth[_0x2deb('0xd')](),controller[_0x2deb('0xe')]);router[_0x2deb('0xa')](_0x2deb('0xf'),auth['isAuthenticated'](),controller[_0x2deb('0x10')]);router[_0x2deb('0x11')]('/',auth[_0x2deb('0xd')](),interaction[_0x2deb('0x12')]('sms',_0x2deb('0x13')),controller['create']);router[_0x2deb('0x11')](_0x2deb('0x14'),controller[_0x2deb('0x15')]);router[_0x2deb('0x16')](_0x2deb('0xf'),auth['isAuthenticated'](),controller['update']);router['put'](_0x2deb('0x17'),auth[_0x2deb('0xd')](),controller[_0x2deb('0x18')]);router[_0x2deb('0x16')]('/:id/reject',auth[_0x2deb('0xd')](),controller[_0x2deb('0x19')]);router[_0x2deb('0x1a')](_0x2deb('0xf'),auth['isAuthenticated'](),controller[_0x2deb('0x1b')]);module[_0x2deb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 8136c7b..f90c546 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 _0x5c44=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0xebb59a,_0x3e69c1){var _0x818667=function(_0x1992ce){while(--_0x1992ce){_0xebb59a['push'](_0xebb59a['shift']());}};_0x818667(++_0x3e69c1);}(_0x5c44,0x10b));var _0x45c4=function(_0x5da344,_0x5ded49){_0x5da344=_0x5da344-0x0;var _0x360cce=_0x5c44[_0x5da344];return _0x360cce;};'use strict';var Sequelize=require('sequelize');module[_0x45c4('0x0')]={'body':{'type':Sequelize[_0x45c4('0x1')](_0x45c4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x45c4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x45c4('0x4')]('in',_0x45c4('0x5')),'defaultValue':_0x45c4('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x45c4('0x6')]},'secret':{'type':Sequelize[_0x45c4('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x45c4('0x7')]},'providerResponse':{'type':Sequelize[_0x45c4('0x1')]}}; \ No newline at end of file +var _0xbc38=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0xbc38,0x157));var _0x8bc3=function(_0x1b81da,_0xa6fb4c){_0x1b81da=_0x1b81da-0x0;var _0x5ea679=_0xbc38[_0x1b81da];return _0x5ea679;};'use strict';var Sequelize=require('sequelize');module[_0x8bc3('0x0')]={'body':{'type':Sequelize[_0x8bc3('0x1')](_0x8bc3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8bc3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8bc3('0x4')]('in',_0x8bc3('0x5')),'defaultValue':_0x8bc3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8bc3('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8bc3('0x6')]},'readAt':{'type':Sequelize[_0x8bc3('0x7')]},'secret':{'type':Sequelize[_0x8bc3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8bc3('0x6')]},'providerResponse':{'type':Sequelize[_0x8bc3('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index fd0aec1..0f2023b 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 _0x2564=['sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','interface','format','channel','motionChannel','event','EventManager','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','sent','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','groupName','DELIVERED','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','catch','create','body','destroy','describe','acceptMessage','reject','sms','UserId','user','agent','get','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','rejectMessage','ContactId'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2564,0x17b));var _0x4256=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2564[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0x4256('0x0'));var Redis=require(_0x4256('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0x4256('0x2'));var logger=require(_0x4256('0x3'))(_0x4256('0x4'));var config=require(_0x4256('0x5'));var db=require('../../mysqldb')['db'];config[_0x4256('0x6')]=_[_0x4256('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4256('0x8'))(new Redis(config[_0x4256('0x6')]));require(_0x4256('0x9'))[_0x4256('0xa')](socket);var jayson=require(_0x4256('0xb'));var client=jayson['client'][_0x4256('0xc')]({'port':0x232c});var client9002=jayson[_0x4256('0xd')]['http']({'port':0x232a});var interaction_log=require(_0x4256('0x3'))(_0x4256('0xe'));function respondWithRpcPromise(_0x374d82,_0x1bf286,_0x1a1301,_0xf182be){return new Promise(function(_0x36ed79,_0x2b435c){var _0x4a926c=_0xf182be||client;return _0x4a926c[_0x4256('0xf')](_0x374d82,_0x1a1301)[_0x4256('0x10')](function(_0x1e09b1){logger[_0x4256('0x11')](_0x4256('0x12'),_0x1bf286,_0x4256('0x13'));logger['debug'](_0x4256('0x14'),_0x1bf286,'request\x20sent',JSON[_0x4256('0x15')](_0x1e09b1));if(_0x1e09b1[_0x4256('0x16')]){if(_0x1e09b1[_0x4256('0x16')][_0x4256('0x17')]===0x1f4){logger[_0x4256('0x16')](_0x4256('0x12'),_0x1bf286,_0x1e09b1[_0x4256('0x16')]['message']);return _0x2b435c(_0x1e09b1[_0x4256('0x16')][_0x4256('0x18')]);}logger[_0x4256('0x16')](_0x4256('0x12'),_0x1bf286,_0x1e09b1[_0x4256('0x16')][_0x4256('0x18')]);return _0x36ed79(_0x1e09b1[_0x4256('0x16')][_0x4256('0x18')]);}else{logger[_0x4256('0x11')](_0x4256('0x12'),_0x1bf286,'request\x20sent');_0x36ed79(_0x1e09b1[_0x4256('0x19')]['message']);}})['catch'](function(_0x3698eb){logger[_0x4256('0x16')](_0x4256('0x12'),_0x1bf286,_0x3698eb);_0x2b435c(_0x3698eb);});});}function respondWithResult(_0x5812b4,_0x2f903e){_0x2f903e=_0x2f903e||0xc8;return function(_0x2b5930){if(_0x2b5930){return _0x5812b4[_0x4256('0x1a')](_0x2f903e)[_0x4256('0x1b')](_0x2b5930);}};}function respondWithFilteredResult(_0x25985c,_0x2760fb){return function(_0x3bcc33){if(_0x3bcc33){var _0x5166e7=typeof _0x2760fb[_0x4256('0x1c')]===_0x4256('0x1d')&&typeof _0x2760fb[_0x4256('0x1e')]===_0x4256('0x1d');var _0x3c28a2=_0x3bcc33[_0x4256('0x1f')];var _0x1c59cf=_0x5166e7?0x0:_0x2760fb[_0x4256('0x1c')];var _0x5d41e7=_0x5166e7?_0x3bcc33[_0x4256('0x1f')]:_0x2760fb[_0x4256('0x1c')]+_0x2760fb['limit'];var _0x46e864;if(_0x5d41e7>=_0x3c28a2){_0x5d41e7=_0x3c28a2;_0x46e864=0xc8;}else{_0x46e864=0xce;}_0x25985c[_0x4256('0x1a')](_0x46e864);return _0x25985c[_0x4256('0x20')](_0x4256('0x21'),_0x1c59cf+'-'+_0x5d41e7+'/'+_0x3c28a2)[_0x4256('0x1b')](_0x3bcc33);}return null;};}function saveUpdates(_0x24296e){return function(_0x1fdd7b){if(_0x1fdd7b){return _0x1fdd7b[_0x4256('0x22')](_0x24296e)[_0x4256('0x10')](function(_0x2d2530){return _0x2d2530;});}return null;};}function removeEntity(_0x47d378){return function(_0x335c40){if(_0x335c40){return _0x335c40['destroy']()[_0x4256('0x10')](function(){_0x47d378[_0x4256('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2fc9){return function(_0x3b064b){if(!_0x3b064b){_0x3d2fc9[_0x4256('0x23')](0x194);}return _0x3b064b;};}function handleError(_0x28f9e3,_0xc54189){_0xc54189=_0xc54189||0x1f4;return function(_0x5d6ea0){logger[_0x4256('0x16')](_0x5d6ea0[_0x4256('0x24')]);if(_0x5d6ea0[_0x4256('0x25')]){delete _0x5d6ea0['name'];}_0x28f9e3[_0x4256('0x1a')](_0xc54189)[_0x4256('0x26')](_0x5d6ea0);};}exports[_0x4256('0x27')]=function(_0x5351c0,_0x63f192){var _0x38952c={},_0x267630={},_0x16647f={'count':0x0,'rows':[]};var _0x3881f2=_[_0x4256('0x28')](db[_0x4256('0x29')][_0x4256('0x2a')],function(_0x100c3a){return{'name':_0x100c3a[_0x4256('0x2b')],'type':_0x100c3a[_0x4256('0x2c')][_0x4256('0x2d')]};});_0x267630[_0x4256('0x2e')]=_[_0x4256('0x28')](_0x3881f2,'name');_0x267630[_0x4256('0x2f')]=_[_0x4256('0x30')](_0x5351c0[_0x4256('0x2f')]);_0x267630['filters']=_['intersection'](_0x267630[_0x4256('0x2e')],_0x267630[_0x4256('0x2f')]);_0x38952c[_0x4256('0x31')]=_[_0x4256('0x32')](_0x267630[_0x4256('0x2e')],qs[_0x4256('0x33')](_0x5351c0[_0x4256('0x2f')][_0x4256('0x33')]));_0x38952c[_0x4256('0x31')]=_0x38952c['attributes'][_0x4256('0x34')]?_0x38952c[_0x4256('0x31')]:_0x267630[_0x4256('0x2e')];if(!_0x5351c0['query'][_0x4256('0x35')](_0x4256('0x36'))){_0x38952c[_0x4256('0x1e')]=qs[_0x4256('0x1e')](_0x5351c0[_0x4256('0x2f')][_0x4256('0x1e')]);_0x38952c[_0x4256('0x1c')]=qs[_0x4256('0x1c')](_0x5351c0[_0x4256('0x2f')][_0x4256('0x1c')]);}_0x38952c[_0x4256('0x37')]=qs['sort'](_0x5351c0['query']['sort']);_0x38952c['where']=qs[_0x4256('0x38')](_[_0x4256('0x39')](_0x5351c0[_0x4256('0x2f')],_0x267630[_0x4256('0x38')]),_0x3881f2);if(_0x5351c0[_0x4256('0x2f')][_0x4256('0x3a')]){_0x38952c[_0x4256('0x3b')]=_[_0x4256('0x3c')](_0x38952c[_0x4256('0x3b')],{'$or':_[_0x4256('0x28')](_0x3881f2,function(_0xa39f89){if(_0xa39f89[_0x4256('0x2c')]!==_0x4256('0x3d')){var _0x10e217={};_0x10e217[_0xa39f89[_0x4256('0x25')]]={'$like':'%'+_0x5351c0[_0x4256('0x2f')]['filter']+'%'};return _0x10e217;}})});}_0x38952c=_[_0x4256('0x3c')]({},_0x38952c,_0x5351c0[_0x4256('0x3e')]);var _0x459107={'where':_0x38952c[_0x4256('0x3b')]};return db[_0x4256('0x29')][_0x4256('0x1f')](_0x459107)[_0x4256('0x10')](function(_0x47f779){_0x16647f['count']=_0x47f779;if(_0x5351c0['query']['includeAll']){_0x38952c[_0x4256('0x3f')]=[{'all':!![]}];}return db[_0x4256('0x29')][_0x4256('0x40')](_0x38952c);})[_0x4256('0x10')](function(_0x4c9cc0){_0x16647f['rows']=_0x4c9cc0;return _0x16647f;})[_0x4256('0x10')](respondWithFilteredResult(_0x63f192,_0x38952c))['catch'](handleError(_0x63f192,null));};exports[_0x4256('0x41')]=function(_0xd1c308,_0x31415d){var _0x594e5d={'raw':!![],'where':{'id':_0xd1c308[_0x4256('0x42')]['id']}},_0x1f81da={};_0x1f81da[_0x4256('0x2e')]=_[_0x4256('0x30')](db[_0x4256('0x29')][_0x4256('0x2a')]);_0x1f81da['query']=_[_0x4256('0x30')](_0xd1c308[_0x4256('0x2f')]);_0x1f81da[_0x4256('0x38')]=_['intersection'](_0x1f81da['model'],_0x1f81da[_0x4256('0x2f')]);_0x594e5d[_0x4256('0x31')]=_[_0x4256('0x32')](_0x1f81da[_0x4256('0x2e')],qs[_0x4256('0x33')](_0xd1c308[_0x4256('0x2f')][_0x4256('0x33')]));_0x594e5d[_0x4256('0x31')]=_0x594e5d['attributes'][_0x4256('0x34')]?_0x594e5d[_0x4256('0x31')]:_0x1f81da[_0x4256('0x2e')];if(_0xd1c308[_0x4256('0x2f')][_0x4256('0x43')]){_0x594e5d[_0x4256('0x3f')]=[{'all':!![]}];}_0x594e5d=_['merge']({},_0x594e5d,_0xd1c308[_0x4256('0x3e')]);return db[_0x4256('0x29')][_0x4256('0x44')](_0x594e5d)[_0x4256('0x10')](handleEntityNotFound(_0x31415d,null))[_0x4256('0x10')](respondWithResult(_0x31415d,null))[_0x4256('0x45')](handleError(_0x31415d,null));};exports[_0x4256('0x46')]=function(_0x26bf7a,_0x285c64){return db['SmsMessage']['create'](_0x26bf7a[_0x4256('0x47')],{})['then'](respondWithResult(_0x285c64,0xc9))['catch'](handleError(_0x285c64,null));};exports['update']=function(_0x58ca09,_0x3429a9){if(_0x58ca09[_0x4256('0x47')]['id']){delete _0x58ca09[_0x4256('0x47')]['id'];}return db[_0x4256('0x29')][_0x4256('0x44')]({'where':{'id':_0x58ca09[_0x4256('0x42')]['id']}})['then'](handleEntityNotFound(_0x3429a9,null))[_0x4256('0x10')](saveUpdates(_0x58ca09[_0x4256('0x47')],null))['then'](respondWithResult(_0x3429a9,null))[_0x4256('0x45')](handleError(_0x3429a9,null));};exports[_0x4256('0x48')]=function(_0x5946e6,_0x49545d){return db[_0x4256('0x29')]['find']({'where':{'id':_0x5946e6[_0x4256('0x42')]['id']}})[_0x4256('0x10')](handleEntityNotFound(_0x49545d,null))[_0x4256('0x10')](removeEntity(_0x49545d,null))[_0x4256('0x45')](handleError(_0x49545d,null));};exports[_0x4256('0x49')]=function(_0x594f5f,_0x3760db){return db['SmsMessage']['describe']()['then'](respondWithResult(_0x3760db,null))[_0x4256('0x45')](handleError(_0x3760db,null));};exports['accept']=function(_0xb6aa34,_0x131a1d){var _0x40170c='sms';return interactionService[_0x4256('0x4a')](_0xb6aa34,_0x40170c)[_0x4256('0x10')](respondWithResult(_0x131a1d,null))[_0x4256('0x45')](handleError(_0x131a1d,null));};exports[_0x4256('0x4b')]=function(_0x3166d2,_0x4ada2b){var _0x22826e={'agent':{},'channel':_0x4256('0x4c')};if(_0x3166d2[_0x4256('0x47')]['id']){delete _0x3166d2[_0x4256('0x47')]['id'];}_0x3166d2[_0x4256('0x47')]['UserId']=_0x3166d2[_0x4256('0x47')][_0x4256('0x4d')]||_0x3166d2[_0x4256('0x4e')]['id'];_0x22826e[_0x4256('0x4f')]['id']=_0x3166d2['body'][_0x4256('0x4d')];return db[_0x4256('0x29')]['find']({'where':{'id':_0x3166d2[_0x4256('0x42')]['id'],'UserId':null}})[_0x4256('0x10')](handleEntityNotFound(_0x4ada2b,null))[_0x4256('0x10')](function(_0x375d7a){if(_0x375d7a){_0x22826e[_0x4256('0x18')]=_0x375d7a[_0x4256('0x50')]({'plain':!![]});return db[_0x4256('0x51')]['find']({'where':{'id':_0x375d7a[_0x4256('0x52')]}});}return null;})[_0x4256('0x10')](handleEntityNotFound(_0x4ada2b,null))[_0x4256('0x10')](function(_0x3c0b16){if(_0x3c0b16){_0x22826e['interaction']=_0x3c0b16[_0x4256('0x50')]({'plain':!![]});interaction_log['info'](_0x4256('0x53'),_0x3166d2['user']['id'],_0x3166d2['user'][_0x4256('0x25')],_0x3166d2[_0x4256('0x4e')][_0x4256('0x54')],_0x22826e[_0x4256('0x55')]['id'],_0x3166d2[_0x4256('0x47')]?JSON[_0x4256('0x15')](_0x3166d2['body']):_0x4256('0x56'));return respondWithRpcPromise('RejectMessage',_0x4256('0x57'),_0x22826e);}return null;})[_0x4256('0x10')](function(_0x2b15df){var _0x233939='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b15df[_0x4256('0x18')][_0x4256('0x58')];return db[_0x4256('0x59')][_0x4256('0x2f')](_0x233939,{'type':db[_0x4256('0x5a')][_0x4256('0x5b')][_0x4256('0x5c')],'raw':!![]})['then'](function(_0x2ba224){return _0x2ba224;});})[_0x4256('0x10')](function(_0x9c5ab4){if(_0x9c5ab4){_0x22826e['message']['contact']=_0x9c5ab4[0x0];if(!_0x3166d2[_0x4256('0x47')]['UserId'])return;return db[_0x4256('0x5d')]['find']({'where':{'id':_0x3166d2[_0x4256('0x47')]['UserId'],'role':'agent'},'attributes':['id',_0x4256('0x25'),_0x4256('0x5e'),_0x4256('0x5f'),'internal'],'raw':!![]});}return null;})[_0x4256('0x10')](function(_0x5584d9){if(!_0x5584d9)return null;_0x22826e[_0x4256('0x18')][_0x4256('0x4f')]=_0x5584d9;return _0x22826e;})[_0x4256('0x10')](function(_0x2ea2d0){if(_0x2ea2d0){_0x2ea2d0[_0x4256('0x18')][_0x4256('0x60')]=util[_0x4256('0x61')]('SIP/%s',_0x3166d2[_0x4256('0x4e')][_0x4256('0x25')]);_0x2ea2d0[_0x4256('0x18')][_0x4256('0x62')]=_0x22826e[_0x4256('0x62')];_0x2ea2d0[_0x4256('0x18')][_0x4256('0x63')]=_0x22826e['channel'];_0x2ea2d0[_0x4256('0x18')][_0x4256('0x64')]=_0x4256('0x4b');respondWithRpcPromise('EventManager',_0x4256('0x65'),{'event':'rejectmessage','message':_0x2ea2d0['message']},client9002);return _0x22826e;}return null;})[_0x4256('0x10')](respondWithResult(_0x4ada2b,null))[_0x4256('0x45')](handleError(_0x4ada2b,null));};exports[_0x4256('0x1a')]=function(_0x1006dd,_0xb7b42d){if(_0x1006dd[_0x4256('0x47')]['id']){delete _0x1006dd['body']['id'];}var _0x565dec;return db[_0x4256('0x29')][_0x4256('0x44')]({'where':{'id':_0x1006dd[_0x4256('0x42')]['id']}})['then'](handleEntityNotFound(_0xb7b42d,null))[_0x4256('0x10')](function(_0x5a47e1){if(_0x5a47e1){_0x565dec=_0x5a47e1;return db[_0x4256('0x66')]['find']({'where':{'id':_0x5a47e1[_0x4256('0x67')]}});}})[_0x4256('0x10')](handleEntityNotFound(_0xb7b42d,null))[_0x4256('0x10')](function(_0x4351a8){if(_0x4351a8){logger['debug'](_0x4256('0x14'),_0x4256('0x1a'),_0x4256('0x68'),_0x4351a8[_0x4256('0x2c')],util[_0x4256('0x69')](_0x1006dd[_0x4256('0x47')],{'showHidden':![],'depth':null}));switch(_0x4351a8[_0x4256('0x2c')]){case _0x4256('0x6a'):if(_0x1006dd[_0x4256('0x47')][_0x4256('0x6b')]&&_0x1006dd[_0x4256('0x47')][_0x4256('0x6b')]===_0x565dec[_0x4256('0x6c')]){return _0x565dec['update']({'read':!![]});}else{logger[_0x4256('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4256('0x6a'),util[_0x4256('0x69')](_0x1006dd[_0x4256('0x47')],{'showHidden':![],'depth':null}));}break;case _0x4256('0x6d'):if(_0x1006dd[_0x4256('0x47')]['MessageUUID']&&_0x1006dd[_0x4256('0x47')][_0x4256('0x6e')]===_0x565dec[_0x4256('0x6c')]&&_['indexOf']([_0x4256('0x6f'),'delivered'],_0x1006dd['body']['Status'])>=0x0){return _0x565dec[_0x4256('0x22')]({'read':!![]});}else{logger['error'](_0x4256('0x70'),_0x4256('0x1a'),'plivio',util['inspect'](_0x1006dd[_0x4256('0x47')],{'showHidden':![],'depth':null}));}break;case _0x4256('0x71'):var _0x2b3933=_0x1006dd['body'][_0x4256('0x72')][0x0];if(_0x2b3933[_0x4256('0x1a')][_0x4256('0x73')]===_0x4256('0x74')){return _0x565dec[_0x4256('0x22')]({'read':!![]});}else{logger[_0x4256('0x16')](_0x4256('0x70'),'status',_0x4256('0x71'),util['inspect'](_0x1006dd[_0x4256('0x47')],{'showHidden':![],'depth':null}));}break;}return _0x565dec;}})['then'](respondWithResult(_0xb7b42d,null))[_0x4256('0x45')](handleError(_0xb7b42d,null));}; \ No newline at end of file +var _0x0502=['sms','acceptMessage','reject','UserId','agent','get','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','rejectMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','SmsMessage','findAll','rows','show','params','keys','find','create','body','describe'];(function(_0x4deff,_0x42c328){var _0x440123=function(_0x2d7dde){while(--_0x2d7dde){_0x4deff['push'](_0x4deff['shift']());}};_0x440123(++_0x42c328);}(_0x0502,0xa5));var _0x2050=function(_0x2531d6,_0x750539){_0x2531d6=_0x2531d6-0x0;var _0x5a1bfe=_0x0502[_0x2531d6];return _0x5a1bfe;};'use strict';var util=require(_0x2050('0x0'));var _=require(_0x2050('0x1'));var Redis=require(_0x2050('0x2'));var interactionService=require(_0x2050('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x2050('0x4'))(_0x2050('0x5'));var config=require(_0x2050('0x6'));var db=require(_0x2050('0x7'))['db'];config['redis']=_[_0x2050('0x8')](config[_0x2050('0x9')],{'host':_0x2050('0xa'),'port':0x18eb});var socket=require(_0x2050('0xb'))(new Redis(config[_0x2050('0x9')]));require(_0x2050('0xc'))[_0x2050('0xd')](socket);var jayson=require(_0x2050('0xe'));var client=jayson[_0x2050('0xf')][_0x2050('0x10')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0x2050('0x4'))('sms-interactions');function respondWithRpcPromise(_0x97c28c,_0x44b849,_0x5e28a0,_0xc56952){return new Promise(function(_0x5899ab,_0x33d265){var _0x15f083=_0xc56952||client;return _0x15f083[_0x2050('0x11')](_0x97c28c,_0x5e28a0)['then'](function(_0x28d961){logger[_0x2050('0x12')](_0x2050('0x13'),_0x44b849,_0x2050('0x14'));logger['debug'](_0x2050('0x15'),_0x44b849,_0x2050('0x14'),JSON[_0x2050('0x16')](_0x28d961));if(_0x28d961[_0x2050('0x17')]){if(_0x28d961[_0x2050('0x17')][_0x2050('0x18')]===0x1f4){logger[_0x2050('0x17')]('SmsMessage,\x20%s,\x20%s',_0x44b849,_0x28d961[_0x2050('0x17')][_0x2050('0x19')]);return _0x33d265(_0x28d961[_0x2050('0x17')][_0x2050('0x19')]);}logger['error'](_0x2050('0x13'),_0x44b849,_0x28d961[_0x2050('0x17')][_0x2050('0x19')]);return _0x5899ab(_0x28d961[_0x2050('0x17')][_0x2050('0x19')]);}else{logger[_0x2050('0x12')](_0x2050('0x13'),_0x44b849,'request\x20sent');_0x5899ab(_0x28d961[_0x2050('0x1a')][_0x2050('0x19')]);}})[_0x2050('0x1b')](function(_0x438ae9){logger['error'](_0x2050('0x13'),_0x44b849,_0x438ae9);_0x33d265(_0x438ae9);});});}function respondWithResult(_0x127bb0,_0xf76f15){_0xf76f15=_0xf76f15||0xc8;return function(_0x5810ff){if(_0x5810ff){return _0x127bb0[_0x2050('0x1c')](_0xf76f15)[_0x2050('0x1d')](_0x5810ff);}};}function respondWithFilteredResult(_0x4d8349,_0x13b274){return function(_0x5abdde){if(_0x5abdde){var _0x2add5b=typeof _0x13b274[_0x2050('0x1e')]===_0x2050('0x1f')&&typeof _0x13b274[_0x2050('0x20')]===_0x2050('0x1f');var _0x5a9211=_0x5abdde[_0x2050('0x21')];var _0x4c8821=_0x2add5b?0x0:_0x13b274[_0x2050('0x1e')];var _0x45a4f4=_0x2add5b?_0x5abdde['count']:_0x13b274['offset']+_0x13b274[_0x2050('0x20')];var _0x2cafc7;if(_0x45a4f4>=_0x5a9211){_0x45a4f4=_0x5a9211;_0x2cafc7=0xc8;}else{_0x2cafc7=0xce;}_0x4d8349[_0x2050('0x1c')](_0x2cafc7);return _0x4d8349[_0x2050('0x22')](_0x2050('0x23'),_0x4c8821+'-'+_0x45a4f4+'/'+_0x5a9211)[_0x2050('0x1d')](_0x5abdde);}return null;};}function saveUpdates(_0x96b512){return function(_0x14ae39){if(_0x14ae39){return _0x14ae39[_0x2050('0x24')](_0x96b512)['then'](function(_0x3e0ec9){return _0x3e0ec9;});}return null;};}function removeEntity(_0x29f1f4){return function(_0x4aaa91){if(_0x4aaa91){return _0x4aaa91[_0x2050('0x25')]()[_0x2050('0x26')](function(){_0x29f1f4[_0x2050('0x1c')](0xcc)[_0x2050('0x27')]();});}};}function handleEntityNotFound(_0x55cda2){return function(_0x32504d){if(!_0x32504d){_0x55cda2[_0x2050('0x28')](0x194);}return _0x32504d;};}function handleError(_0x4157a5,_0x58b57f){_0x58b57f=_0x58b57f||0x1f4;return function(_0x2e12b7){logger[_0x2050('0x17')](_0x2e12b7[_0x2050('0x29')]);if(_0x2e12b7[_0x2050('0x2a')]){delete _0x2e12b7[_0x2050('0x2a')];}_0x4157a5['status'](_0x58b57f)[_0x2050('0x2b')](_0x2e12b7);};}exports[_0x2050('0x2c')]=function(_0x184ae9,_0x2e1b9b){var _0x20c783={},_0x2c2c69={},_0x3fde67={'count':0x0,'rows':[]};var _0x13db06=_['map'](db['SmsMessage'][_0x2050('0x2d')],function(_0x4f15de){return{'name':_0x4f15de[_0x2050('0x2e')],'type':_0x4f15de[_0x2050('0x2f')]['key']};});_0x2c2c69[_0x2050('0x30')]=_[_0x2050('0x31')](_0x13db06,'name');_0x2c2c69[_0x2050('0x32')]=_['keys'](_0x184ae9[_0x2050('0x32')]);_0x2c2c69[_0x2050('0x33')]=_[_0x2050('0x34')](_0x2c2c69[_0x2050('0x30')],_0x2c2c69['query']);_0x20c783['attributes']=_[_0x2050('0x34')](_0x2c2c69['model'],qs[_0x2050('0x35')](_0x184ae9[_0x2050('0x32')][_0x2050('0x35')]));_0x20c783[_0x2050('0x36')]=_0x20c783[_0x2050('0x36')][_0x2050('0x37')]?_0x20c783[_0x2050('0x36')]:_0x2c2c69[_0x2050('0x30')];if(!_0x184ae9[_0x2050('0x32')]['hasOwnProperty'](_0x2050('0x38'))){_0x20c783[_0x2050('0x20')]=qs[_0x2050('0x20')](_0x184ae9['query']['limit']);_0x20c783['offset']=qs[_0x2050('0x1e')](_0x184ae9[_0x2050('0x32')]['offset']);}_0x20c783[_0x2050('0x39')]=qs[_0x2050('0x3a')](_0x184ae9[_0x2050('0x32')][_0x2050('0x3a')]);_0x20c783[_0x2050('0x3b')]=qs[_0x2050('0x33')](_['pick'](_0x184ae9[_0x2050('0x32')],_0x2c2c69[_0x2050('0x33')]),_0x13db06);if(_0x184ae9['query'][_0x2050('0x3c')]){_0x20c783['where']=_[_0x2050('0x3d')](_0x20c783[_0x2050('0x3b')],{'$or':_[_0x2050('0x31')](_0x13db06,function(_0x2cec33){if(_0x2cec33[_0x2050('0x2f')]!==_0x2050('0x3e')){var _0x1d837c={};_0x1d837c[_0x2cec33['name']]={'$like':'%'+_0x184ae9[_0x2050('0x32')][_0x2050('0x3c')]+'%'};return _0x1d837c;}})});}_0x20c783=_[_0x2050('0x3d')]({},_0x20c783,_0x184ae9['options']);var _0x2545da={'where':_0x20c783['where']};return db['SmsMessage'][_0x2050('0x21')](_0x2545da)[_0x2050('0x26')](function(_0x21729d){_0x3fde67[_0x2050('0x21')]=_0x21729d;if(_0x184ae9[_0x2050('0x32')][_0x2050('0x3f')]){_0x20c783[_0x2050('0x40')]=[{'all':!![]}];}return db[_0x2050('0x41')][_0x2050('0x42')](_0x20c783);})[_0x2050('0x26')](function(_0x21b7fd){_0x3fde67[_0x2050('0x43')]=_0x21b7fd;return _0x3fde67;})['then'](respondWithFilteredResult(_0x2e1b9b,_0x20c783))[_0x2050('0x1b')](handleError(_0x2e1b9b,null));};exports[_0x2050('0x44')]=function(_0x10563d,_0x3f0e78){var _0xd9ac4={'raw':!![],'where':{'id':_0x10563d[_0x2050('0x45')]['id']}},_0x468a5c={};_0x468a5c['model']=_[_0x2050('0x46')](db['SmsMessage'][_0x2050('0x2d')]);_0x468a5c[_0x2050('0x32')]=_[_0x2050('0x46')](_0x10563d[_0x2050('0x32')]);_0x468a5c[_0x2050('0x33')]=_[_0x2050('0x34')](_0x468a5c['model'],_0x468a5c[_0x2050('0x32')]);_0xd9ac4[_0x2050('0x36')]=_[_0x2050('0x34')](_0x468a5c[_0x2050('0x30')],qs['fields'](_0x10563d[_0x2050('0x32')][_0x2050('0x35')]));_0xd9ac4[_0x2050('0x36')]=_0xd9ac4[_0x2050('0x36')][_0x2050('0x37')]?_0xd9ac4[_0x2050('0x36')]:_0x468a5c['model'];if(_0x10563d['query']['includeAll']){_0xd9ac4[_0x2050('0x40')]=[{'all':!![]}];}_0xd9ac4=_[_0x2050('0x3d')]({},_0xd9ac4,_0x10563d['options']);return db['SmsMessage'][_0x2050('0x47')](_0xd9ac4)['then'](handleEntityNotFound(_0x3f0e78,null))['then'](respondWithResult(_0x3f0e78,null))[_0x2050('0x1b')](handleError(_0x3f0e78,null));};exports['create']=function(_0x3d49cf,_0x15413e){return db[_0x2050('0x41')][_0x2050('0x48')](_0x3d49cf[_0x2050('0x49')],{})[_0x2050('0x26')](respondWithResult(_0x15413e,0xc9))[_0x2050('0x1b')](handleError(_0x15413e,null));};exports[_0x2050('0x24')]=function(_0x20d0a2,_0x116cf8){if(_0x20d0a2[_0x2050('0x49')]['id']){delete _0x20d0a2[_0x2050('0x49')]['id'];}return db[_0x2050('0x41')][_0x2050('0x47')]({'where':{'id':_0x20d0a2[_0x2050('0x45')]['id']}})['then'](handleEntityNotFound(_0x116cf8,null))['then'](saveUpdates(_0x20d0a2[_0x2050('0x49')],null))[_0x2050('0x26')](respondWithResult(_0x116cf8,null))[_0x2050('0x1b')](handleError(_0x116cf8,null));};exports[_0x2050('0x25')]=function(_0x685a95,_0x2b1df3){return db[_0x2050('0x41')]['find']({'where':{'id':_0x685a95[_0x2050('0x45')]['id']}})[_0x2050('0x26')](handleEntityNotFound(_0x2b1df3,null))[_0x2050('0x26')](removeEntity(_0x2b1df3,null))[_0x2050('0x1b')](handleError(_0x2b1df3,null));};exports[_0x2050('0x4a')]=function(_0x3e7609,_0x55f783){return db[_0x2050('0x41')]['describe']()[_0x2050('0x26')](respondWithResult(_0x55f783,null))[_0x2050('0x1b')](handleError(_0x55f783,null));};exports['accept']=function(_0x4a39f5,_0x5077d9){var _0x2d7532=_0x2050('0x4b');return interactionService[_0x2050('0x4c')](_0x4a39f5,_0x2d7532)['then'](respondWithResult(_0x5077d9,null))['catch'](handleError(_0x5077d9,null));};exports[_0x2050('0x4d')]=function(_0x4115d2,_0x3a49e0){var _0x4e9e45={'agent':{},'channel':_0x2050('0x4b')};if(_0x4115d2[_0x2050('0x49')]['id']){delete _0x4115d2[_0x2050('0x49')]['id'];}_0x4115d2['body'][_0x2050('0x4e')]=_0x4115d2[_0x2050('0x49')]['UserId']||_0x4115d2['user']['id'];_0x4e9e45[_0x2050('0x4f')]['id']=_0x4115d2['body']['UserId'];return db[_0x2050('0x41')][_0x2050('0x47')]({'where':{'id':_0x4115d2[_0x2050('0x45')]['id'],'UserId':null}})[_0x2050('0x26')](handleEntityNotFound(_0x3a49e0,null))['then'](function(_0x1b8699){if(_0x1b8699){_0x4e9e45['message']=_0x1b8699[_0x2050('0x50')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x1b8699[_0x2050('0x51')]}});}return null;})[_0x2050('0x26')](handleEntityNotFound(_0x3a49e0,null))[_0x2050('0x26')](function(_0x5a2a09){if(_0x5a2a09){_0x4e9e45[_0x2050('0x52')]=_0x5a2a09[_0x2050('0x50')]({'plain':!![]});interaction_log[_0x2050('0x12')](_0x2050('0x53'),_0x4115d2[_0x2050('0x54')]['id'],_0x4115d2[_0x2050('0x54')][_0x2050('0x2a')],_0x4115d2[_0x2050('0x54')][_0x2050('0x55')],_0x4e9e45[_0x2050('0x52')]['id'],_0x4115d2['body']?JSON['stringify'](_0x4115d2[_0x2050('0x49')]):_0x2050('0x56'));return respondWithRpcPromise('RejectMessage',_0x2050('0x57'),_0x4e9e45);}return null;})['then'](function(_0x159d24){var _0x7401ad='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x159d24[_0x2050('0x19')][_0x2050('0x58')];return db['sequelize']['query'](_0x7401ad,{'type':db[_0x2050('0x59')][_0x2050('0x5a')][_0x2050('0x5b')],'raw':!![]})['then'](function(_0x2d47aa){return _0x2d47aa;});})[_0x2050('0x26')](function(_0x23ae72){if(_0x23ae72){_0x4e9e45[_0x2050('0x19')][_0x2050('0x5c')]=_0x23ae72[0x0];if(!_0x4115d2[_0x2050('0x49')][_0x2050('0x4e')])return;return db[_0x2050('0x5d')][_0x2050('0x47')]({'where':{'id':_0x4115d2[_0x2050('0x49')][_0x2050('0x4e')],'role':_0x2050('0x4f')},'attributes':['id',_0x2050('0x2a'),'fullname',_0x2050('0x5e'),_0x2050('0x5f')],'raw':!![]});}return null;})[_0x2050('0x26')](function(_0x1db75c){if(!_0x1db75c)return null;_0x4e9e45[_0x2050('0x19')]['agent']=_0x1db75c;return _0x4e9e45;})[_0x2050('0x26')](function(_0x30e05d){if(_0x30e05d){_0x30e05d[_0x2050('0x19')][_0x2050('0x60')]=util['format'](_0x2050('0x61'),_0x4115d2[_0x2050('0x54')][_0x2050('0x2a')]);_0x30e05d['message']['channel']=_0x4e9e45[_0x2050('0x62')];_0x30e05d[_0x2050('0x19')][_0x2050('0x63')]=_0x4e9e45['channel'];_0x30e05d['message'][_0x2050('0x64')]=_0x2050('0x4d');respondWithRpcPromise(_0x2050('0x65'),_0x2050('0x65'),{'event':_0x2050('0x66'),'message':_0x30e05d[_0x2050('0x19')]},client9002);return _0x4e9e45;}return null;})['then'](respondWithResult(_0x3a49e0,null))[_0x2050('0x1b')](handleError(_0x3a49e0,null));};exports[_0x2050('0x1c')]=function(_0x539ee9,_0x5cdfe2){if(_0x539ee9[_0x2050('0x49')]['id']){delete _0x539ee9[_0x2050('0x49')]['id'];}var _0x20d437;return db[_0x2050('0x41')][_0x2050('0x47')]({'where':{'id':_0x539ee9[_0x2050('0x45')]['id']}})['then'](handleEntityNotFound(_0x5cdfe2,null))[_0x2050('0x26')](function(_0x9a579){if(_0x9a579){_0x20d437=_0x9a579;return db[_0x2050('0x67')][_0x2050('0x47')]({'where':{'id':_0x9a579[_0x2050('0x68')]}});}})[_0x2050('0x26')](handleEntityNotFound(_0x5cdfe2,null))[_0x2050('0x26')](function(_0x50a360){if(_0x50a360){logger[_0x2050('0x69')](_0x2050('0x15'),_0x2050('0x1c'),'received\x20delivery\x20report\x20from',_0x50a360[_0x2050('0x2f')],util[_0x2050('0x6a')](_0x539ee9[_0x2050('0x49')],{'showHidden':![],'depth':null}));switch(_0x50a360[_0x2050('0x2f')]){case _0x2050('0x6b'):if(_0x539ee9[_0x2050('0x49')][_0x2050('0x6c')]&&_0x539ee9[_0x2050('0x49')][_0x2050('0x6c')]===_0x20d437[_0x2050('0x6d')]){return _0x20d437[_0x2050('0x24')]({'read':!![]});}else{logger[_0x2050('0x17')](_0x2050('0x6e'),'status',_0x2050('0x6b'),util[_0x2050('0x6a')](_0x539ee9[_0x2050('0x49')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x539ee9[_0x2050('0x49')][_0x2050('0x6f')]&&_0x539ee9[_0x2050('0x49')][_0x2050('0x6f')]===_0x20d437[_0x2050('0x6d')]&&_['indexOf']([_0x2050('0x70'),_0x2050('0x71')],_0x539ee9['body'][_0x2050('0x72')])>=0x0){return _0x20d437[_0x2050('0x24')]({'read':!![]});}else{logger[_0x2050('0x17')](_0x2050('0x6e'),_0x2050('0x1c'),_0x2050('0x73'),util[_0x2050('0x6a')](_0x539ee9['body'],{'showHidden':![],'depth':null}));}break;case _0x2050('0x74'):var _0x37a699=_0x539ee9[_0x2050('0x49')][_0x2050('0x75')][0x0];if(_0x37a699[_0x2050('0x1c')][_0x2050('0x76')]===_0x2050('0x77')){return _0x20d437[_0x2050('0x24')]({'read':!![]});}else{logger['error'](_0x2050('0x6e'),_0x2050('0x1c'),'infobip',util[_0x2050('0x6a')](_0x539ee9[_0x2050('0x49')],{'showHidden':![],'depth':null}));}break;}return _0x20d437;}})[_0x2050('0x26')](respondWithResult(_0x5cdfe2,null))[_0x2050('0x1b')](handleError(_0x5cdfe2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ad28b07..95e1c94 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 _0xc6ef=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xc6ef,0x186));var _0xfc6e=function(_0x53774b,_0x452684){_0x53774b=_0x53774b-0x0;var _0xb06fbc=_0xc6ef[_0x53774b];return _0xb06fbc;};'use strict';var EventEmitter=require(_0xfc6e('0x0'));var SmsMessage=require(_0xfc6e('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfc6e('0x2')](0x0);var events={'afterCreate':_0xfc6e('0x3'),'afterUpdate':_0xfc6e('0x4'),'afterDestroy':_0xfc6e('0x5')};function emitEvent(_0x451c46){return function(_0x459dd4,_0x2ca8cc,_0x15b1a6){SmsMessageEvents['emit'](_0x451c46+':'+_0x459dd4['id'],_0x459dd4);SmsMessageEvents[_0xfc6e('0x6')](_0x451c46,_0x459dd4);_0x15b1a6(null);};}for(var e in events){if(events[_0xfc6e('0x7')](e)){var event=events[e];SmsMessage[_0xfc6e('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xaaca=['SmsMessage','setMaxListeners','emit','hook'];(function(_0x337591,_0x1960d4){var _0x1ebb70=function(_0x443577){while(--_0x443577){_0x337591['push'](_0x337591['shift']());}};_0x1ebb70(++_0x1960d4);}(_0xaaca,0x6c));var _0xaaac=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xaaca[_0x456fb1];return _0x4083d6;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0xaaac('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xaaac('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4c4840){return function(_0x264702,_0x41b9cb,_0x2ed931){SmsMessageEvents['emit'](_0x4c4840+':'+_0x264702['id'],_0x264702);SmsMessageEvents[_0xaaac('0x2')](_0x4c4840,_0x264702);_0x2ed931(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xaaac('0x3')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c7feaa8..0185783 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 _0x0d9f=['csc','crypto','apiKey','login','keys','sort','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','then','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','update','inspect','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','&password=','password','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20'];(function(_0x317c1f,_0x3047b8){var _0x402d73=function(_0x167e00){while(--_0x167e00){_0x317c1f['push'](_0x317c1f['shift']());}};_0x402d73(++_0x3047b8);}(_0x0d9f,0x96));var _0xf0d9=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x0d9f[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require('lodash');var util=require(_0xf0d9('0x0'));var logger=require(_0xf0d9('0x1'))(_0xf0d9('0x2'));var moment=require(_0xf0d9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d9('0x4'));var rimraf=require('rimraf');var config=require(_0xf0d9('0x5'));var attributes=require(_0xf0d9('0x6'));module[_0xf0d9('0x7')]=function(_0x3d4e03,_0x2f9f91){return _0x3d4e03[_0xf0d9('0x8')](_0xf0d9('0x9'),attributes,{'tableName':_0xf0d9('0xa'),'paranoid':![],'indexes':[{'name':_0xf0d9('0xb'),'fields':['messageId']},{'name':_0xf0d9('0xc'),'fields':[_0xf0d9('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a8b1d,_0xc7c91c,_0x79588e){var _0x41cd62=_0x3d4e03['models'];var _0x34ec08=_0x1a8b1d[_0xf0d9('0xe')]({'plain':!![]});if(_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()==='in'||_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()===_0xf0d9('0x11')&&!_0x34ec08[_0xf0d9('0x12')]&&!_[_0xf0d9('0x13')](_0x34ec08[_0xf0d9('0x14')])&&!_[_0xf0d9('0x13')](_0x34ec08[_0xf0d9('0x15')])){_0x41cd62['SmsInteraction']['findOne']({'where':{'id':_0x34ec08['SmsInteractionId']}})[_0xf0d9('0x16')](function(_0x380252){if(_0x380252){_0x380252['update']({'lastMsgAt':_0x34ec08[_0xf0d9('0x17')],'lastMsgDirection':_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()});}})[_0xf0d9('0x18')](function(_0x50ab7f){console['error'](_0x50ab7f);});}if(_0x34ec08[_0xf0d9('0xf')]==='out'&&!_0x34ec08[_0xf0d9('0x12')]){var _0x4456da;_0x41cd62[_0xf0d9('0x19')][_0xf0d9('0x1a')]({'where':{'id':_0x34ec08[_0xf0d9('0x1b')]},'raw':!![]})[_0xf0d9('0x16')](function(_0x369524){_0x4456da=_0x369524;if(_0x4456da&&_0x4456da['type']){switch(_0x4456da[_0xf0d9('0x1c')]){case _0xf0d9('0x1d'):var _0x27ef2d=require('twilio');if(_0x4456da[_0xf0d9('0x1e')]&&_0x4456da[_0xf0d9('0x1f')]&&_0x4456da[_0xf0d9('0x20')]){var _0x1a7d75=new _0x27ef2d(_0x4456da[_0xf0d9('0x1e')],_0x4456da['authToken']);_0x1a7d75[_0xf0d9('0x21')][_0xf0d9('0x22')]({'body':_0x34ec08[_0xf0d9('0xd')],'to':_0x34ec08[_0xf0d9('0x20')],'from':_0x4456da[_0xf0d9('0x20')],'statusCallback':_0x4456da[_0xf0d9('0x23')]+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da['token']})[_0xf0d9('0x16')](function(_0x47fc84){if(_0x47fc84[_0xf0d9('0x26')]){return _0x1a8b1d[_0xf0d9('0x27')]({'messageId':_0x47fc84[_0xf0d9('0x26')]});}})[_0xf0d9('0x18')](function(_0x215746){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x1d'),util[_0xf0d9('0x28')](_0x215746,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x166800=_0xf0d9('0x2c');if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da['password']){var _0x5b664c={'recipient':[_0x34ec08[_0xf0d9('0x20')]],'message':_0x34ec08[_0xf0d9('0xd')],'message_type':_0x4456da['smsMethod']};if(_0x4456da['smsMethod']&&_0x4456da[_0xf0d9('0x2e')]!=='SI'){_0x5b664c['sender']=_0x4456da[_0xf0d9('0x20')];}var _0x583b36={'url':_0x166800+_0xf0d9('0x2f')+_0x4456da[_0xf0d9('0x2d')]+_0xf0d9('0x30')+_0x4456da[_0xf0d9('0x31')],'method':_0xf0d9('0x32')};rp(_0x583b36)[_0xf0d9('0x16')](function(_0x40ba3a){var _0x2b6bab=_0x40ba3a[_0xf0d9('0x33')](';');var _0x2e6773={'user_key':_0x2b6bab[0x0],'session_key':_0x2b6bab[0x1]};_0x583b36={'url':_0x166800+'sms','method':_0xf0d9('0x34'),'headers':{'user_key':_0x2e6773[_0xf0d9('0x35')],'Session_key':_0x2e6773['session_key']},'json':!![],'body':_0x5b664c};return rp(_0x583b36);})[_0xf0d9('0x16')](function(_0x2de65d){if(_0x2de65d[_0xf0d9('0x36')]>=0x1){var _0x266841={'messageId':_0x2de65d[_0xf0d9('0x37')]};if(_0x4456da[_0xf0d9('0x2e')]!=='GP'||!_0x4456da[_0xf0d9('0x38')]){_0x266841[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x266841);}else{return logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),util['inspect'](_0x2de65d,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x47808b){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),util[_0xf0d9('0x28')](_0x47808b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x3c'):if(_0x4456da['authToken']){var _0x41920b={'recipient':_0x34ec08[_0xf0d9('0x20')],'message':_0x34ec08['body'],'sender':_0x4456da['senderString']||_0x4456da[_0xf0d9('0x20')],'authorization':_0x4456da[_0xf0d9('0x1f')]};var _0xc7c91c={'method':'POST','uri':_0xf0d9('0x3d'),'body':_0x41920b,'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x1cf360){var _0x37320a={'messageId':_0x1cf360[_0xf0d9('0x3e')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x37320a['read']=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x37320a);})[_0xf0d9('0x18')](function(_0x1ca5c1){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3c'),util[_0xf0d9('0x28')](_0x1ca5c1,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','connectel',_0xf0d9('0x3f'));}break;case'clicksend':if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){var _0x41920b={'messages':[{'source':'xCALLY\x20Motion','to':_0x34ec08[_0xf0d9('0x20')],'body':_0x34ec08['body'],'from':_0x4456da[_0xf0d9('0x40')]||_0x4456da[_0xf0d9('0x20')]}]};var _0x56cb50=util['format'](_0xf0d9('0x41'),_0x4456da[_0xf0d9('0x2d')],_0x4456da[_0xf0d9('0x31')]);var _0xc7c91c={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x42'),'body':_0x41920b,'headers':{'Authorization':util[_0xf0d9('0x43')](_0xf0d9('0x44'),new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x22afc0){if(_0x22afc0['http_code']>=0xc8&&_0x22afc0[_0xf0d9('0x47')]<=0xce){if(_0x22afc0[_0xf0d9('0x48')]&&_0x22afc0['data']['queued_count']>0x0){var _0x5117a9=_[_0xf0d9('0x49')](_0x22afc0[_0xf0d9('0x48')]['messages']);var _0x1ea496={'messageId':_0x5117a9[_0xf0d9('0x4a')]};if(!_0x4456da['deliveryReport']){_0x1ea496[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x1ea496);}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x4b'),util[_0xf0d9('0x28')](_0x22afc0,{'showHidden':![],'depth':null}));}}else{logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4b'),util[_0xf0d9('0x28')](_0x22afc0,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x351958){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','clickSend',util[_0xf0d9('0x28')](_0x351958,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x4b'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x4c'):if(_0x4456da[_0xf0d9('0x4d')]&&_0x4456da[_0xf0d9('0x1f')]){var _0x41920b={'dst':_0x34ec08[_0xf0d9('0x20')],'text':_0x34ec08[_0xf0d9('0xd')],'src':_0x4456da[_0xf0d9('0x40')]||_0x4456da[_0xf0d9('0x20')],'url':_0x4456da['remote']+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da[_0xf0d9('0x4e')]};var _0x56cb50=util[_0xf0d9('0x43')]('%s:%s',_0x4456da['authId'],_0x4456da[_0xf0d9('0x1f')]);var _0xc7c91c={'method':'POST','uri':util[_0xf0d9('0x43')](_0xf0d9('0x4f'),_0x4456da['authId']),'body':_0x41920b,'headers':{'Authorization':util[_0xf0d9('0x43')](_0xf0d9('0x44'),new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x2e8728){var _0x111959={'messageId':_0x2e8728[_0xf0d9('0x50')][0x0]};return _0x1a8b1d[_0xf0d9('0x27')](_0x111959);})[_0xf0d9('0x18')](function(_0x1c6743){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4c'),util[_0xf0d9('0x28')](_0x1c6743,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4c'),_0xf0d9('0x51'));}break;case _0xf0d9('0x52'):if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){if(_0x4456da[_0xf0d9('0x53')]){var _0x47ccdd={'method':_0xf0d9('0x34'),'uri':_0x4456da['baseUrl']+_0xf0d9('0x54'),'body':{'username':_0x4456da['username'],'password':_0x4456da[_0xf0d9('0x31')]},'json':!![]};return rp(_0x47ccdd)['then'](function(_0x56eafd){var _0x1f8c76={'method':'POST','uri':_0x4456da[_0xf0d9('0x53')]+_0xf0d9('0x55'),'body':{'messages':[{'from':_0x4456da['phone'],'destinations':[{'to':_0x34ec08['phone']}],'text':_0x34ec08[_0xf0d9('0xd')],'notifyUrl':_0x4456da[_0xf0d9('0x23')]+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da['token'],'notifyContentType':_0xf0d9('0x56'),'callbackData':_0x4456da[_0xf0d9('0x20')]+';'+_0x34ec08[_0xf0d9('0xd')]}]},'headers':{'Authorization':_0xf0d9('0x57')+_0x56eafd[_0xf0d9('0x4e')]},'json':!![]};return rp(_0x1f8c76)[_0xf0d9('0x16')](function(_0x1b7d2c){if(_0x1b7d2c['messages']){var _0x4214ea={'messageId':_0x1b7d2c['messages'][0x0][_0xf0d9('0xb')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x4214ea[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x4214ea);}else{return logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x52'),util[_0xf0d9('0x28')](_0x1b7d2c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x509c26){return logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x52'),util[_0xf0d9('0x28')](_0x509c26,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),'infobip',_0xf0d9('0x3b'));}break;case _0xf0d9('0x58'):var _0x3955f9=require(_0xf0d9('0x59'));if(_0x4456da[_0xf0d9('0x5a')]){var _0x20d421={};_0x20d421[_0xf0d9('0x5b')]=_0x4456da[_0xf0d9('0x2d')];_0x20d421[_0xf0d9('0x20')]=_0x34ec08[_0xf0d9('0x20')];_0x20d421['sender']=_0x4456da[_0xf0d9('0x20')];_0x20d421['text']=_0x34ec08[_0xf0d9('0xd')];_0x20d421['timestamp']=+new Date();var _0x290f81='';var _0x4455d3='';var _0x34e181=Object[_0xf0d9('0x5c')](_0x20d421);_0x34e181[_0xf0d9('0x5d')]();for(var _0x305b6e=0x0;_0x305b6e<_0x34e181['length'];_0x305b6e++){if(_0x290f81!=''){_0x290f81+='&';}_0x290f81+=_0x34e181[_0x305b6e]+'='+encodeURIComponent(_0x20d421[_0x34e181[_0x305b6e]]);_0x4455d3+=_0x20d421[_0x34e181[_0x305b6e]];}_0x4455d3+=_0x4456da[_0xf0d9('0x5a')];_0x4455d3=_0x3955f9[_0xf0d9('0x5e')](_0xf0d9('0x5f'))[_0xf0d9('0x27')](_0x4455d3)[_0xf0d9('0x60')](_0xf0d9('0x61'));if(_0x290f81!==''){_0x290f81+='&';}_0x290f81+='signature='+_0x4455d3;var _0x583b36={'method':_0xf0d9('0x32'),'uri':_0x4456da[_0xf0d9('0x53')]+_0xf0d9('0x62')+_0x290f81,'json':!![]};return rp(_0x583b36)[_0xf0d9('0x16')](function(_0xd11523){var _0xa4e394=Object[_0xf0d9('0x5c')](_0xd11523);if(_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x29')]&&parseInt(_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x29')])===0x0){var _0x34703d={'messageId':_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x63')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x34703d[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x34703d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x58'),util['inspect'](_0xd11523[_0xf0d9('0x29')],{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x4d0175){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x58'),util[_0xf0d9('0x28')](_0x4d0175,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x58'),_0xf0d9('0x64'));}break;case _0xf0d9('0x65'):if(_0x4456da[_0xf0d9('0x5a')]){var _0x31bd1c={'method':_0xf0d9('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x4456da['apiKey']},'body':{'content':_0x34ec08[_0xf0d9('0xd')],'to':[_0x34ec08[_0xf0d9('0x20')]],'from':_0x4456da[_0xf0d9('0x20')],'binary':![],'clientMessageId':_0xf0d9('0x66'),'charset':_0xf0d9('0x67')},'json':!![]};rp(_0x31bd1c)[_0xf0d9('0x16')](function(_0x2a6439){if(!_0x2a6439[_0xf0d9('0x29')]){var _0x16b31b={'messageId':_0x2a6439[_0xf0d9('0x21')][0x0][_0xf0d9('0x68')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x16b31b[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x16b31b);}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x65'),util[_0xf0d9('0x28')](_0x2a6439[_0xf0d9('0x29')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x312c6b){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','clickatell',util[_0xf0d9('0x28')](_0x312c6b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x65'),_0xf0d9('0x64'));}break;case _0xf0d9('0x69'):if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){var _0x56cb50=util['format']('%s:%s',_0x4456da[_0xf0d9('0x2d')],_0x4456da[_0xf0d9('0x31')]);var _0xc7c91c={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x6a')+_0x4456da[_0xf0d9('0x6b')]+_0xf0d9('0x6c'),'body':{'to':[_0x34ec08[_0xf0d9('0x20')]],'text':_0x34ec08['body'],'from':_0x4456da[_0xf0d9('0x20')],'applicationId':_0x4456da[_0xf0d9('0x6d')]},'headers':{'Authorization':util[_0xf0d9('0x43')]('Basic\x20%s',new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x1a2bb6){if(_0x1a2bb6['id']){var _0x13a053={'messageId':_0x1a2bb6['id']};return _0x1a8b1d[_0xf0d9('0x27')](_0x13a053);}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'bandwidth',util[_0xf0d9('0x28')](_0x1a2bb6,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x2c3218){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'bandwidth',util[_0xf0d9('0x28')](_0x2c3218,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate',_0xf0d9('0x69'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x6e'):if(_0x4456da[_0xf0d9('0x5a')]){var _0x26d5e7={};var _0x583b36={'method':'POST','uri':_0xf0d9('0x6f'),'headers':{'Authorization':_0xf0d9('0x70')+_0x4456da[_0xf0d9('0x5a')],'Content-Type':_0xf0d9('0x56')},'body':{'from':_0x4456da[_0xf0d9('0x20')],'to':_0x34ec08[_0xf0d9('0x20')],'text':_0x34ec08[_0xf0d9('0xd')]},'json':!![]};return rp(_0x583b36)[_0xf0d9('0x16')](function(_0x12a9fd){if(_0x12a9fd['code']==0xca){_0x26d5e7[_0xf0d9('0x71')]=_0x12a9fd;var _0x34d242={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x72'),'headers':{'Authorization':_0xf0d9('0x70')+_0x4456da[_0xf0d9('0x5a')],'Content-Type':_0xf0d9('0x56')},'body':{'refid':_0x26d5e7['message'][_0xf0d9('0x73')]},'json':!![]};return rp(_0x34d242)[_0xf0d9('0x16')](function(_0x220cb4){_0x26d5e7[_0xf0d9('0x74')]=_0x220cb4;var _0x352bd2={'messageId':_0x26d5e7['message']['refid'],'read':!![]};return _0x1a8b1d[_0xf0d9('0x27')](_0x352bd2);});}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x6e'),util[_0xf0d9('0x28')](_0x12a9fd,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x338518){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x6e'),util[_0xf0d9('0x28')](_0x338518,{'showHidden':![],'depth':null}));});}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate',_0xf0d9('0x6e'),'Token\x20not\x20received');}break;}}})[_0xf0d9('0x75')](function(){_0x79588e();});}else{_0x79588e();}}},'charset':'utf8mb4','collate':_0xf0d9('0x76')});}; \ No newline at end of file +var _0xa586=['clicksend','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','head','data','message_id','clickSend','plivo','authId','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','bandwidth','accountId','/messages','applicationId','Missing\x20parameters:\x20username,\x20password','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','body','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','smsMethod','deliveryReport','read','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0xa586,0xb6));var _0x6a58=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xa586[_0xae01dd];return _0x8c26df;};'use strict';var _=require(_0x6a58('0x0'));var util=require(_0x6a58('0x1'));var logger=require(_0x6a58('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a58('0x3'));var rimraf=require(_0x6a58('0x4'));var config=require(_0x6a58('0x5'));var attributes=require(_0x6a58('0x6'));module[_0x6a58('0x7')]=function(_0xa9e288,_0x3a9a9e){return _0xa9e288[_0x6a58('0x8')](_0x6a58('0x9'),attributes,{'tableName':_0x6a58('0xa'),'paranoid':![],'indexes':[{'name':_0x6a58('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':_0x6a58('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1117ef,_0x3a29ff,_0x27caae){var _0xb164a4=_0xa9e288[_0x6a58('0xd')];var _0x437942=_0x1117ef[_0x6a58('0xe')]({'plain':!![]});if(_0x437942['direction'][_0x6a58('0xf')]()==='in'||_0x437942[_0x6a58('0x10')][_0x6a58('0xf')]()===_0x6a58('0x11')&&!_0x437942[_0x6a58('0x12')]&&!_[_0x6a58('0x13')](_0x437942[_0x6a58('0x14')])&&!_[_0x6a58('0x13')](_0x437942[_0x6a58('0x15')])){_0xb164a4[_0x6a58('0x16')][_0x6a58('0x17')]({'where':{'id':_0x437942[_0x6a58('0x15')]}})[_0x6a58('0x18')](function(_0xc70c0e){if(_0xc70c0e){_0xc70c0e[_0x6a58('0x19')]({'lastMsgAt':_0x437942[_0x6a58('0x1a')],'lastMsgDirection':_0x437942['direction'][_0x6a58('0xf')]()});}})[_0x6a58('0x1b')](function(_0x3d11c4){console[_0x6a58('0x1c')](_0x3d11c4);});}if(_0x437942[_0x6a58('0x10')]===_0x6a58('0x11')&&!_0x437942[_0x6a58('0x12')]){var _0x34de22;_0xb164a4['SmsAccount'][_0x6a58('0x1d')]({'where':{'id':_0x437942[_0x6a58('0x1e')]},'raw':!![]})[_0x6a58('0x18')](function(_0x4176a8){_0x34de22=_0x4176a8;if(_0x34de22&&_0x34de22['type']){switch(_0x34de22[_0x6a58('0x1f')]){case _0x6a58('0x20'):var _0x21a5f6=require(_0x6a58('0x20'));if(_0x34de22[_0x6a58('0x21')]&&_0x34de22[_0x6a58('0x22')]&&_0x34de22[_0x6a58('0x23')]){var _0x575ab4=new _0x21a5f6(_0x34de22[_0x6a58('0x21')],_0x34de22[_0x6a58('0x22')]);_0x575ab4[_0x6a58('0x24')][_0x6a58('0x25')]({'body':_0x437942['body'],'to':_0x437942[_0x6a58('0x23')],'from':_0x34de22[_0x6a58('0x23')],'statusCallback':_0x34de22[_0x6a58('0x26')]+'/api/sms/messages/'+_0x437942['id']+_0x6a58('0x27')+_0x34de22[_0x6a58('0x28')]})[_0x6a58('0x18')](function(_0x5f184a){if(_0x5f184a['sid']){return _0x1117ef[_0x6a58('0x19')]({'messageId':_0x5f184a['sid']});}})['catch'](function(_0x5c53e2){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a58('0x29'),_0x6a58('0x20'),util[_0x6a58('0x2a')](_0x5c53e2,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate','twilio',_0x6a58('0x2c'));}break;case'skebby':var _0x261c38=_0x6a58('0x2d');if(_0x34de22[_0x6a58('0x2e')]&&_0x34de22[_0x6a58('0x2f')]){var _0x31f592={'recipient':[_0x437942['phone']],'message':_0x437942[_0x6a58('0x30')],'message_type':_0x34de22['smsMethod']};if(_0x34de22['smsMethod']&&_0x34de22['smsMethod']!=='SI'){_0x31f592[_0x6a58('0x31')]=_0x34de22[_0x6a58('0x23')];}var _0x2e70ba={'url':_0x261c38+_0x6a58('0x32')+_0x34de22[_0x6a58('0x2e')]+_0x6a58('0x33')+_0x34de22[_0x6a58('0x2f')],'method':_0x6a58('0x34')};rp(_0x2e70ba)[_0x6a58('0x18')](function(_0xbbc061){var _0x5ce3e6=_0xbbc061[_0x6a58('0x35')](';');var _0x5e6521={'user_key':_0x5ce3e6[0x0],'session_key':_0x5ce3e6[0x1]};_0x2e70ba={'url':_0x261c38+_0x6a58('0x36'),'method':_0x6a58('0x37'),'headers':{'user_key':_0x5e6521[_0x6a58('0x38')],'Session_key':_0x5e6521[_0x6a58('0x39')]},'json':!![],'body':_0x31f592};return rp(_0x2e70ba);})[_0x6a58('0x18')](function(_0x1e4161){if(_0x1e4161['total_sent']>=0x1){var _0x488cd2={'messageId':_0x1e4161[_0x6a58('0x3a')]};if(_0x34de22[_0x6a58('0x3b')]!=='GP'||!_0x34de22[_0x6a58('0x3c')]){_0x488cd2[_0x6a58('0x3d')]=!![];}return _0x1117ef[_0x6a58('0x19')](_0x488cd2);}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x3e'),util[_0x6a58('0x2a')](_0x1e4161,{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x51ddc2){return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x3e'),util[_0x6a58('0x2a')](_0x51ddc2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a58('0x2b'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x6a58('0x3f'):if(_0x34de22[_0x6a58('0x22')]){var _0x11831d={'recipient':_0x437942[_0x6a58('0x23')],'message':_0x437942[_0x6a58('0x30')],'sender':_0x34de22[_0x6a58('0x40')]||_0x34de22['phone'],'authorization':_0x34de22[_0x6a58('0x22')]};var _0x3a29ff={'method':_0x6a58('0x37'),'uri':_0x6a58('0x41'),'body':_0x11831d,'json':!![]};rp(_0x3a29ff)[_0x6a58('0x18')](function(_0x3d0b28){var _0x555fa8={'messageId':_0x3d0b28[_0x6a58('0x42')]};if(!_0x34de22[_0x6a58('0x3c')]){_0x555fa8[_0x6a58('0x3d')]=!![];}return _0x1117ef[_0x6a58('0x19')](_0x555fa8);})[_0x6a58('0x1b')](function(_0x3814b1){logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x3f'),util[_0x6a58('0x2a')](_0x3814b1,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate','connectel',_0x6a58('0x43'));}break;case _0x6a58('0x44'):if(_0x34de22['username']&&_0x34de22['password']){var _0x11831d={'messages':[{'source':'xCALLY\x20Motion','to':_0x437942[_0x6a58('0x23')],'body':_0x437942[_0x6a58('0x30')],'from':_0x34de22[_0x6a58('0x40')]||_0x34de22[_0x6a58('0x23')]}]};var _0x515517=util['format']('%s:%s',_0x34de22[_0x6a58('0x2e')],_0x34de22[_0x6a58('0x2f')]);var _0x3a29ff={'method':_0x6a58('0x37'),'uri':_0x6a58('0x45'),'body':_0x11831d,'headers':{'Authorization':util[_0x6a58('0x46')]('Basic\x20%s',new Buffer(_0x515517)[_0x6a58('0x47')](_0x6a58('0x48')))},'json':!![]};rp(_0x3a29ff)[_0x6a58('0x18')](function(_0x34f667){if(_0x34f667[_0x6a58('0x49')]>=0xc8&&_0x34f667[_0x6a58('0x49')]<=0xce){if(_0x34f667['data']&&_0x34f667['data']['queued_count']>0x0){var _0x279ab7=_[_0x6a58('0x4a')](_0x34f667[_0x6a58('0x4b')][_0x6a58('0x24')]);var _0x4a4ba9={'messageId':_0x279ab7[_0x6a58('0x4c')]};if(!_0x34de22['deliveryReport']){_0x4a4ba9[_0x6a58('0x3d')]=!![];}return _0x1117ef['update'](_0x4a4ba9);}else{logger[_0x6a58('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a58('0x29'),_0x6a58('0x4d'),util['inspect'](_0x34f667,{'showHidden':![],'depth':null}));}}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x4d'),util['inspect'](_0x34f667,{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x9a539d){logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x4d'),util['inspect'](_0x9a539d,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6a58('0x4e'):if(_0x34de22[_0x6a58('0x4f')]&&_0x34de22[_0x6a58('0x22')]){var _0x11831d={'dst':_0x437942[_0x6a58('0x23')],'text':_0x437942[_0x6a58('0x30')],'src':_0x34de22[_0x6a58('0x40')]||_0x34de22[_0x6a58('0x23')],'url':_0x34de22[_0x6a58('0x26')]+_0x6a58('0x50')+_0x437942['id']+_0x6a58('0x27')+_0x34de22['token']};var _0x515517=util['format'](_0x6a58('0x51'),_0x34de22['authId'],_0x34de22[_0x6a58('0x22')]);var _0x3a29ff={'method':'POST','uri':util[_0x6a58('0x46')](_0x6a58('0x52'),_0x34de22[_0x6a58('0x4f')]),'body':_0x11831d,'headers':{'Authorization':util['format'](_0x6a58('0x53'),new Buffer(_0x515517)[_0x6a58('0x47')](_0x6a58('0x48')))},'json':!![]};rp(_0x3a29ff)['then'](function(_0x4beaa7){var _0x425f71={'messageId':_0x4beaa7['message_uuid'][0x0]};return _0x1117ef[_0x6a58('0x19')](_0x425f71);})[_0x6a58('0x1b')](function(_0x3cb7fc){logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x4e'),util[_0x6a58('0x2a')](_0x3cb7fc,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),'plivo',_0x6a58('0x54'));}break;case _0x6a58('0x55'):if(_0x34de22[_0x6a58('0x2e')]&&_0x34de22[_0x6a58('0x2f')]){if(_0x34de22[_0x6a58('0x56')]){var _0x47e81a={'method':'POST','uri':_0x34de22[_0x6a58('0x56')]+_0x6a58('0x57'),'body':{'username':_0x34de22['username'],'password':_0x34de22['password']},'json':!![]};return rp(_0x47e81a)[_0x6a58('0x18')](function(_0x5b3356){var _0x4bb257={'method':'POST','uri':_0x34de22[_0x6a58('0x56')]+_0x6a58('0x58'),'body':{'messages':[{'from':_0x34de22[_0x6a58('0x23')],'destinations':[{'to':_0x437942['phone']}],'text':_0x437942['body'],'notifyUrl':_0x34de22[_0x6a58('0x26')]+_0x6a58('0x50')+_0x437942['id']+_0x6a58('0x27')+_0x34de22[_0x6a58('0x28')],'notifyContentType':_0x6a58('0x59'),'callbackData':_0x34de22[_0x6a58('0x23')]+';'+_0x437942[_0x6a58('0x30')]}]},'headers':{'Authorization':_0x6a58('0x5a')+_0x5b3356[_0x6a58('0x28')]},'json':!![]};return rp(_0x4bb257)['then'](function(_0x4828a2){if(_0x4828a2[_0x6a58('0x24')]){var _0x2d8cc6={'messageId':_0x4828a2['messages'][0x0][_0x6a58('0xb')]};if(!_0x34de22[_0x6a58('0x3c')]){_0x2d8cc6['read']=!![];}return _0x1117ef[_0x6a58('0x19')](_0x2d8cc6);}else{return logger[_0x6a58('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a58('0x29'),'infobip',util[_0x6a58('0x2a')](_0x4828a2,{'showHidden':![],'depth':null}));}});})[_0x6a58('0x1b')](function(_0x39b19a){return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x55'),util[_0x6a58('0x2a')](_0x39b19a,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x55'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6a58('0x5b'):var _0x42308c=require(_0x6a58('0x5c'));if(_0x34de22[_0x6a58('0x5d')]){var _0x4208b9={};_0x4208b9[_0x6a58('0x5e')]=_0x34de22[_0x6a58('0x2e')];_0x4208b9[_0x6a58('0x23')]=_0x437942[_0x6a58('0x23')];_0x4208b9[_0x6a58('0x31')]=_0x34de22[_0x6a58('0x23')];_0x4208b9['text']=_0x437942[_0x6a58('0x30')];_0x4208b9[_0x6a58('0x5f')]=+new Date();var _0x15c075='';var _0x5ae410='';var _0x5ce8bb=Object[_0x6a58('0x60')](_0x4208b9);_0x5ce8bb[_0x6a58('0x61')]();for(var _0x66caa=0x0;_0x66caa<_0x5ce8bb[_0x6a58('0x62')];_0x66caa++){if(_0x15c075!=''){_0x15c075+='&';}_0x15c075+=_0x5ce8bb[_0x66caa]+'='+encodeURIComponent(_0x4208b9[_0x5ce8bb[_0x66caa]]);_0x5ae410+=_0x4208b9[_0x5ce8bb[_0x66caa]];}_0x5ae410+=_0x34de22[_0x6a58('0x5d')];_0x5ae410=_0x42308c[_0x6a58('0x63')](_0x6a58('0x64'))[_0x6a58('0x19')](_0x5ae410)[_0x6a58('0x65')](_0x6a58('0x66'));if(_0x15c075!==''){_0x15c075+='&';}_0x15c075+=_0x6a58('0x67')+_0x5ae410;var _0x2e70ba={'method':_0x6a58('0x34'),'uri':_0x34de22[_0x6a58('0x56')]+_0x6a58('0x68')+_0x15c075,'json':!![]};return rp(_0x2e70ba)[_0x6a58('0x18')](function(_0x42e8f0){var _0x3bb719=Object[_0x6a58('0x60')](_0x42e8f0);if(_0x42e8f0[_0x3bb719[0x0]][_0x6a58('0x1c')]&&parseInt(_0x42e8f0[_0x3bb719[0x0]][_0x6a58('0x1c')])===0x0){var _0x1fff5a={'messageId':_0x42e8f0[_0x3bb719[0x0]][_0x6a58('0x69')]};if(!_0x34de22[_0x6a58('0x3c')]){_0x1fff5a[_0x6a58('0x3d')]=!![];}return _0x1117ef[_0x6a58('0x19')](_0x1fff5a);}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x5b'),util[_0x6a58('0x2a')](_0x42e8f0[_0x6a58('0x1c')],{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x16f730){return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x5b'),util['inspect'](_0x16f730,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0x6a58('0x6a'):if(_0x34de22[_0x6a58('0x5d')]){var _0x158cd4={'method':_0x6a58('0x37'),'uri':_0x6a58('0x6b'),'headers':{'Authorization':_0x34de22[_0x6a58('0x5d')]},'body':{'content':_0x437942['body'],'to':[_0x437942[_0x6a58('0x23')]],'from':_0x34de22[_0x6a58('0x23')],'binary':![],'clientMessageId':_0x6a58('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0x158cd4)[_0x6a58('0x18')](function(_0x4c76d4){if(!_0x4c76d4[_0x6a58('0x1c')]){var _0x50682e={'messageId':_0x4c76d4[_0x6a58('0x24')][0x0]['apiMessageId']};if(!_0x34de22[_0x6a58('0x3c')]){_0x50682e[_0x6a58('0x3d')]=!![];}return _0x1117ef[_0x6a58('0x19')](_0x50682e);}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate','clickatell',util[_0x6a58('0x2a')](_0x4c76d4['error'],{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x460878){return logger[_0x6a58('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a58('0x29'),_0x6a58('0x6a'),util[_0x6a58('0x2a')](_0x460878,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x6a58('0x6d'):if(_0x34de22[_0x6a58('0x2e')]&&_0x34de22[_0x6a58('0x2f')]){var _0x515517=util[_0x6a58('0x46')](_0x6a58('0x51'),_0x34de22[_0x6a58('0x2e')],_0x34de22[_0x6a58('0x2f')]);var _0x3a29ff={'method':_0x6a58('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x34de22[_0x6a58('0x6e')]+_0x6a58('0x6f'),'body':{'to':[_0x437942['phone']],'text':_0x437942[_0x6a58('0x30')],'from':_0x34de22[_0x6a58('0x23')],'applicationId':_0x34de22[_0x6a58('0x70')]},'headers':{'Authorization':util[_0x6a58('0x46')](_0x6a58('0x53'),new Buffer(_0x515517)[_0x6a58('0x47')](_0x6a58('0x48')))},'json':!![]};rp(_0x3a29ff)[_0x6a58('0x18')](function(_0x162ddd){if(_0x162ddd['id']){var _0xc62ca9={'messageId':_0x162ddd['id']};return _0x1117ef[_0x6a58('0x19')](_0xc62ca9);}else{logger[_0x6a58('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a58('0x6d'),util[_0x6a58('0x2a')](_0x162ddd,{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x519724){logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x6d'),util['inspect'](_0x519724,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x6d'),_0x6a58('0x71'));}break;case _0x6a58('0x72'):if(_0x34de22[_0x6a58('0x5d')]){var _0x2ad499={};var _0x2e70ba={'method':_0x6a58('0x37'),'uri':_0x6a58('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x34de22[_0x6a58('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x34de22[_0x6a58('0x23')],'to':_0x437942[_0x6a58('0x23')],'text':_0x437942['body']},'json':!![]};return rp(_0x2e70ba)['then'](function(_0x44ee2e){if(_0x44ee2e[_0x6a58('0x74')]==0xca){_0x2ad499[_0x6a58('0x75')]=_0x44ee2e;var _0x315246={'method':_0x6a58('0x37'),'uri':_0x6a58('0x76'),'headers':{'Authorization':_0x6a58('0x77')+_0x34de22[_0x6a58('0x5d')],'Content-Type':_0x6a58('0x59')},'body':{'refid':_0x2ad499[_0x6a58('0x75')][_0x6a58('0x78')]},'json':!![]};return rp(_0x315246)['then'](function(_0x58bab3){_0x2ad499[_0x6a58('0x79')]=_0x58bab3;var _0x2d8bf8={'messageId':_0x2ad499[_0x6a58('0x75')]['refid'],'read':!![]};return _0x1117ef['update'](_0x2d8bf8);});}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),'intelepeer',util[_0x6a58('0x2a')](_0x44ee2e,{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x7641b4){return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x72'),util[_0x6a58('0x2a')](_0x7641b4,{'showHidden':![],'depth':null}));});}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x72'),'Token\x20not\x20received');}break;}}})[_0x6a58('0x7a')](function(){_0x27caae();});}else{_0x27caae();}}},'charset':_0x6a58('0x7b'),'collate':_0x6a58('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 529a755..bca7492 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 _0xed9b=['body','options','raw','CreateSmsMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','create'];(function(_0x58d9a8,_0x32acd9){var _0x426ffd=function(_0xb0d946){while(--_0xb0d946){_0x58d9a8['push'](_0x58d9a8['shift']());}};_0x426ffd(++_0x32acd9);}(_0xed9b,0x16f));var _0xbed9=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xed9b[_0x163040];return _0x364667;};'use strict';var _=require(_0xbed9('0x0'));var util=require('util');var moment=require(_0xbed9('0x1'));var BPromise=require(_0xbed9('0x2'));var rs=require(_0xbed9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbed9('0x4'))['db'];var utils=require(_0xbed9('0x5'));var logger=require(_0xbed9('0x6'))('rpc');var config=require(_0xbed9('0x7'));var jayson=require(_0xbed9('0x8'));var client=jayson[_0xbed9('0x9')][_0xbed9('0xa')]({'port':0x232a});config[_0xbed9('0xb')]=_['defaults'](config[_0xbed9('0xb')],{'host':_0xbed9('0xc'),'port':0x18eb});var socket=require(_0xbed9('0xd'))(new Redis(config[_0xbed9('0xb')]));require('./smsMessage.socket')[_0xbed9('0xe')](socket);function respondWithRpcPromise(_0x4fa9e1,_0x4bb6dd,_0x736a2e){return new BPromise(function(_0x57448b,_0x56abd1){return client[_0xbed9('0xf')](_0x4fa9e1,_0x736a2e)[_0xbed9('0x10')](function(_0x7d67eb){logger['info'](_0xbed9('0x11'),_0x4bb6dd,_0xbed9('0x12'));logger[_0xbed9('0x13')](_0xbed9('0x14'),_0x4bb6dd,_0xbed9('0x12'),JSON[_0xbed9('0x15')](_0x7d67eb));if(_0x7d67eb['error']){if(_0x7d67eb['error'][_0xbed9('0x16')]===0x1f4){logger[_0xbed9('0x17')]('SmsMessage,\x20%s,\x20%s',_0x4bb6dd,_0x7d67eb[_0xbed9('0x17')][_0xbed9('0x18')]);return _0x56abd1(_0x7d67eb[_0xbed9('0x17')][_0xbed9('0x18')]);}logger[_0xbed9('0x17')](_0xbed9('0x11'),_0x4bb6dd,_0x7d67eb['error'][_0xbed9('0x18')]);return _0x57448b(_0x7d67eb['error']['message']);}else{logger[_0xbed9('0x19')]('SmsMessage,\x20%s,\x20%s',_0x4bb6dd,'request\x20sent');_0x57448b(_0x7d67eb[_0xbed9('0x1a')][_0xbed9('0x18')]);}})[_0xbed9('0x1b')](function(_0x5a0da7){logger[_0xbed9('0x17')](_0xbed9('0x11'),_0x4bb6dd,_0x5a0da7);_0x56abd1(_0x5a0da7);});});}exports['CreateSmsMessage']=function(_0x36d8b7){var _0x3f8638=this;return new Promise(function(_0x337d82,_0x4af369){return db['SmsMessage'][_0xbed9('0x1c')](_0x36d8b7[_0xbed9('0x1d')],{'raw':_0x36d8b7[_0xbed9('0x1e')]?_0x36d8b7[_0xbed9('0x1e')][_0xbed9('0x1f')]===undefined?!![]:![]:!![]})[_0xbed9('0x10')](function(_0x39fb3f){logger[_0xbed9('0x19')](_0xbed9('0x20'),_0x36d8b7);logger[_0xbed9('0x13')]('CreateSmsMessage',_0x36d8b7,JSON[_0xbed9('0x15')](_0x39fb3f));_0x337d82(_0x39fb3f);})[_0xbed9('0x1b')](function(_0x512ce3){logger[_0xbed9('0x17')]('CreateSmsMessage',_0x512ce3[_0xbed9('0x18')],_0x36d8b7);_0x4af369(_0x3f8638[_0xbed9('0x17')](0x1f4,_0x512ce3[_0xbed9('0x18')]));});});}; \ No newline at end of file +var _0xe3d6=['then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','create','body','options','raw','CreateSmsMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request'];(function(_0xbf14e9,_0x4557ac){var _0x59ec1b=function(_0x126109){while(--_0x126109){_0xbf14e9['push'](_0xbf14e9['shift']());}};_0x59ec1b(++_0x4557ac);}(_0xe3d6,0x190));var _0x6e3d=function(_0x5410c9,_0x4061b2){_0x5410c9=_0x5410c9-0x0;var _0x4ca422=_0xe3d6[_0x5410c9];return _0x4ca422;};'use strict';var _=require(_0x6e3d('0x0'));var util=require(_0x6e3d('0x1'));var moment=require(_0x6e3d('0x2'));var BPromise=require(_0x6e3d('0x3'));var rs=require(_0x6e3d('0x4'));var fs=require('fs');var Redis=require(_0x6e3d('0x5'));var db=require(_0x6e3d('0x6'))['db'];var utils=require(_0x6e3d('0x7'));var logger=require(_0x6e3d('0x8'))(_0x6e3d('0x9'));var config=require(_0x6e3d('0xa'));var jayson=require(_0x6e3d('0xb'));var client=jayson[_0x6e3d('0xc')]['http']({'port':0x232a});config[_0x6e3d('0xd')]=_[_0x6e3d('0xe')](config[_0x6e3d('0xd')],{'host':_0x6e3d('0xf'),'port':0x18eb});var socket=require(_0x6e3d('0x10'))(new Redis(config['redis']));require(_0x6e3d('0x11'))[_0x6e3d('0x12')](socket);function respondWithRpcPromise(_0x31b154,_0x1ef2b7,_0x5ce525){return new BPromise(function(_0x3a7908,_0x3d7740){return client[_0x6e3d('0x13')](_0x31b154,_0x5ce525)[_0x6e3d('0x14')](function(_0x411b39){logger[_0x6e3d('0x15')](_0x6e3d('0x16'),_0x1ef2b7,'request\x20sent');logger[_0x6e3d('0x17')](_0x6e3d('0x18'),_0x1ef2b7,_0x6e3d('0x19'),JSON[_0x6e3d('0x1a')](_0x411b39));if(_0x411b39['error']){if(_0x411b39[_0x6e3d('0x1b')]['code']===0x1f4){logger['error'](_0x6e3d('0x16'),_0x1ef2b7,_0x411b39['error'][_0x6e3d('0x1c')]);return _0x3d7740(_0x411b39['error'][_0x6e3d('0x1c')]);}logger[_0x6e3d('0x1b')](_0x6e3d('0x16'),_0x1ef2b7,_0x411b39[_0x6e3d('0x1b')][_0x6e3d('0x1c')]);return _0x3a7908(_0x411b39[_0x6e3d('0x1b')][_0x6e3d('0x1c')]);}else{logger[_0x6e3d('0x15')](_0x6e3d('0x16'),_0x1ef2b7,_0x6e3d('0x19'));_0x3a7908(_0x411b39['result'][_0x6e3d('0x1c')]);}})['catch'](function(_0x3b96e8){logger[_0x6e3d('0x1b')](_0x6e3d('0x16'),_0x1ef2b7,_0x3b96e8);_0x3d7740(_0x3b96e8);});});}exports['CreateSmsMessage']=function(_0x5e872f){var _0xc924f1=this;return new Promise(function(_0x3f73fa,_0x2d9591){return db['SmsMessage'][_0x6e3d('0x1d')](_0x5e872f[_0x6e3d('0x1e')],{'raw':_0x5e872f[_0x6e3d('0x1f')]?_0x5e872f[_0x6e3d('0x1f')][_0x6e3d('0x20')]===undefined?!![]:![]:!![]})[_0x6e3d('0x14')](function(_0x4f5485){logger['info'](_0x6e3d('0x21'),_0x5e872f);logger[_0x6e3d('0x17')]('CreateSmsMessage',_0x5e872f,JSON['stringify'](_0x4f5485));_0x3f73fa(_0x4f5485);})[_0x6e3d('0x22')](function(_0x4fb17a){logger[_0x6e3d('0x1b')](_0x6e3d('0x21'),_0x4fb17a[_0x6e3d('0x1c')],_0x5e872f);_0x2d9591(_0xc924f1[_0x6e3d('0x1b')](0x1f4,_0x4fb17a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 72fc04e..ae4442a 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 _0xc50b=['./smsMessage.events','save','update','emit','removeListener','length','smsMessage:'];(function(_0x448bd3,_0x5009fd){var _0x26bb4e=function(_0xc98cdf){while(--_0xc98cdf){_0x448bd3['push'](_0x448bd3['shift']());}};_0x26bb4e(++_0x5009fd);}(_0xc50b,0x69));var _0xbc50=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xc50b[_0xaaf2e2];return _0x28bc36;};'use strict';var SmsMessageEvents=require(_0xbc50('0x0'));var events=[_0xbc50('0x1'),'remove',_0xbc50('0x2')];function createListener(_0x20a1b3,_0x3b4d10){return function(_0x408ee4){_0x3b4d10[_0xbc50('0x3')](_0x20a1b3,_0x408ee4);};}function removeListener(_0x51af4d,_0x3a841f){return function(){SmsMessageEvents[_0xbc50('0x4')](_0x51af4d,_0x3a841f);};}exports['register']=function(_0x33f070){for(var _0x53cd2f=0x0,_0x2de2a8=events[_0xbc50('0x5')];_0x53cd2f<_0x2de2a8;_0x53cd2f++){var _0x115d80=events[_0x53cd2f];var _0x32999a=createListener(_0xbc50('0x6')+_0x115d80,_0x33f070);SmsMessageEvents['on'](_0x115d80,_0x32999a);}}; \ No newline at end of file +var _0x546b=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x34bb59,_0x5bc641){var _0x5bafa3=function(_0x2a3f5a){while(--_0x2a3f5a){_0x34bb59['push'](_0x34bb59['shift']());}};_0x5bafa3(++_0x5bc641);}(_0x546b,0xbc));var _0xb546=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x546b[_0xd816e2];return _0x1f5924;};'use strict';var SmsMessageEvents=require(_0xb546('0x0'));var events=['save','remove',_0xb546('0x1')];function createListener(_0x40f404,_0x1c1d59){return function(_0x1b11e4){_0x1c1d59[_0xb546('0x2')](_0x40f404,_0x1b11e4);};}function removeListener(_0x566144,_0x1e457f){return function(){SmsMessageEvents[_0xb546('0x3')](_0x566144,_0x1e457f);};}exports[_0xb546('0x4')]=function(_0x47cd76){for(var _0x41c3a0=0x0,_0x1d3f79=events[_0xb546('0x5')];_0x41c3a0<_0x1d3f79;_0x41c3a0++){var _0x2dfb7d=events[_0x41c3a0];var _0x554b5f=createListener(_0xb546('0x6')+_0x2dfb7d,_0x47cd76);SmsMessageEvents['on'](_0x2dfb7d,_0x554b5f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 617bb96..3702b9c 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 _0x0add=['isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x0add,0x122));var _0xd0ad=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x0add[_0x4d8666];return _0x37175b;};'use strict';var multer=require(_0xd0ad('0x0'));var util=require(_0xd0ad('0x1'));var path=require(_0xd0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0ad('0x3'));var router=express[_0xd0ad('0x4')]();var fs_extra=require(_0xd0ad('0x5'));var auth=require(_0xd0ad('0x6'));var interaction=require(_0xd0ad('0x7'));var config=require(_0xd0ad('0x8'));var controller=require('./smsQueue.controller');router[_0xd0ad('0x9')]('/',auth[_0xd0ad('0xa')](),controller[_0xd0ad('0xb')]);router[_0xd0ad('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xd0ad('0xc')]);router[_0xd0ad('0x9')](_0xd0ad('0xd'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0xe')]);router['get'](_0xd0ad('0xf'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x10')]);router[_0xd0ad('0x9')]('/:id/teams',auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x11')]);router[_0xd0ad('0x9')](_0xd0ad('0x12'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x13')]);router['post']('/',auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x14')]);router[_0xd0ad('0x15')]('/:id/teams',auth[_0xd0ad('0xa')](),controller['addTeams']);router['post'](_0xd0ad('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0xd0ad('0x16')]('/:id',auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x17')]);router[_0xd0ad('0x18')](_0xd0ad('0xd'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x19')]);router[_0xd0ad('0x18')](_0xd0ad('0x1a'),auth['isAuthenticated'](),controller[_0xd0ad('0x1b')]);router[_0xd0ad('0x18')](_0xd0ad('0x12'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x1c')]);module[_0xd0ad('0x1d')]=router; \ No newline at end of file +var _0x8c57=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','getMembers','/:id/teams','getAgents','post','create','addTeams','addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x8c57,0x172));var _0x78c5=function(_0x727d78,_0x2f7912){_0x727d78=_0x727d78-0x0;var _0x104ce8=_0x8c57[_0x727d78];return _0x104ce8;};'use strict';var multer=require(_0x78c5('0x0'));var util=require(_0x78c5('0x1'));var path=require(_0x78c5('0x2'));var timeout=require(_0x78c5('0x3'));var express=require(_0x78c5('0x4'));var router=express[_0x78c5('0x5')]();var fs_extra=require(_0x78c5('0x6'));var auth=require(_0x78c5('0x7'));var interaction=require(_0x78c5('0x8'));var config=require(_0x78c5('0x9'));var controller=require('./smsQueue.controller');router[_0x78c5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x78c5('0xa')]('/describe',auth[_0x78c5('0xb')](),controller[_0x78c5('0xc')]);router[_0x78c5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x78c5('0xd')]);router[_0x78c5('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x78c5('0xe')]);router[_0x78c5('0xa')](_0x78c5('0xf'),auth[_0x78c5('0xb')](),controller['getTeams']);router[_0x78c5('0xa')]('/:id/users',auth[_0x78c5('0xb')](),controller[_0x78c5('0x10')]);router[_0x78c5('0x11')]('/',auth[_0x78c5('0xb')](),controller[_0x78c5('0x12')]);router['post'](_0x78c5('0xf'),auth[_0x78c5('0xb')](),controller[_0x78c5('0x13')]);router[_0x78c5('0x11')]('/:id/users',auth[_0x78c5('0xb')](),controller[_0x78c5('0x14')]);router[_0x78c5('0x15')](_0x78c5('0x16'),auth[_0x78c5('0xb')](),controller[_0x78c5('0x17')]);router['delete'](_0x78c5('0x16'),auth[_0x78c5('0xb')](),controller[_0x78c5('0x18')]);router[_0x78c5('0x19')](_0x78c5('0xf'),auth[_0x78c5('0xb')](),controller[_0x78c5('0x1a')]);router['delete']('/:id/users',auth[_0x78c5('0xb')](),controller[_0x78c5('0x1b')]);module[_0x78c5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b2dd770..e0c85e5 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 _0x281d=['rrmemory','beepall','exports','STRING','name','INTEGER','ENUM'];(function(_0x1a8bf6,_0x2fb58d){var _0x2e5e1f=function(_0x2c5f9f){while(--_0x2c5f9f){_0x1a8bf6['push'](_0x1a8bf6['shift']());}};_0x2e5e1f(++_0x2fb58d);}(_0x281d,0xbf));var _0xd281=function(_0x4c3f64,_0x2a320d){_0x4c3f64=_0x4c3f64-0x0;var _0x1fca7a=_0x281d[_0x4c3f64];return _0x1fca7a;};'use strict';var Sequelize=require('sequelize');module[_0xd281('0x0')]={'name':{'type':Sequelize[_0xd281('0x1')],'unique':_0xd281('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd281('0x1')]},'timeout':{'type':Sequelize[_0xd281('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd281('0x4')](_0xd281('0x5'),_0xd281('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x27a6=['exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x3d500c,_0x468c9b){var _0x2006b7=function(_0x23f627){while(--_0x23f627){_0x3d500c['push'](_0x3d500c['shift']());}};_0x2006b7(++_0x468c9b);}(_0x27a6,0xc6));var _0x627a=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x27a6[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require('sequelize');module[_0x627a('0x0')]={'name':{'type':Sequelize[_0x627a('0x1')],'unique':_0x627a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x627a('0x1')]},'timeout':{'type':Sequelize[_0x627a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x627a('0x4'),'beepall',_0x627a('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 01f47ba..0e29c20 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x51eabb,_0x11770e){var _0x467ea6=function(_0x4dc0a3){while(--_0x4dc0a3){_0x51eabb['push'](_0x51eabb['shift']());}};_0x467ea6(++_0x11770e);}(_0x2ef3,0xba));var _0x32ef=function(_0x49b167,_0xe566c){_0x49b167=_0x49b167-0x0;var _0x30eddb=_0x2ef3[_0x49b167];return _0x30eddb;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _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(_0x37ca2d,_0xe86f6d){var _0x42571f=function(_0x9bb301){while(--_0x9bb301){_0x37ca2d['push'](_0x37ca2d['shift']());}};_0x42571f(++_0xe86f6d);}(_0xdb28,0x106));var _0x8db2=function(_0x421458,_0x532ede){_0x421458=_0x421458-0x0;var _0x2dd006=_0xdb28[_0x421458];return _0x2dd006;};'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 fe92956..bdafa14 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 _0x904a=['events','../../mysqldb','save','update','remove','hasOwnProperty','exports'];(function(_0x359340,_0xf9f36a){var _0x473264=function(_0x276c26){while(--_0x276c26){_0x359340['push'](_0x359340['shift']());}};_0x473264(++_0xf9f36a);}(_0x904a,0x111));var _0xa904=function(_0x32389c,_0x5cfd45){_0x32389c=_0x32389c-0x0;var _0x3ba2d7=_0x904a[_0x32389c];return _0x3ba2d7;};'use strict';var EventEmitter=require(_0xa904('0x0'));var SmsQueue=require(_0xa904('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa904('0x2'),'afterUpdate':_0xa904('0x3'),'afterDestroy':_0xa904('0x4')};function emitEvent(_0x5cfd42){return function(_0x225299,_0x2b0602,_0x31e146){SmsQueueEvents['emit'](_0x5cfd42+':'+_0x225299['id'],_0x225299);SmsQueueEvents['emit'](_0x5cfd42,_0x225299);_0x31e146(null);};}for(var e in events){if(events[_0xa904('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xa904('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x7346=['../../mysqldb','SmsQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7346,0x1ee));var _0x6734=function(_0x3224e0,_0x3cc8fa){_0x3224e0=_0x3224e0-0x0;var _0x371335=_0x7346[_0x3224e0];return _0x371335;};'use strict';var EventEmitter=require(_0x6734('0x0'));var SmsQueue=require(_0x6734('0x1'))['db'][_0x6734('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6734('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6734('0x4'),'afterDestroy':'remove'};function emitEvent(_0x26281e){return function(_0x590e24,_0x25bdb5,_0x353947){SmsQueueEvents[_0x6734('0x5')](_0x26281e+':'+_0x590e24['id'],_0x590e24);SmsQueueEvents['emit'](_0x26281e,_0x590e24);_0x353947(null);};}for(var e in events){if(events[_0x6734('0x6')](e)){var event=events[e];SmsQueue[_0x6734('0x7')](e,emitEvent(event));}}module[_0x6734('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0ed8d5f..b8db2f7 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 _0xeba4=['exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xeba4,0xad));var _0x4eba=function(_0x5e4503,_0x5b9cf3){_0x5e4503=_0x5e4503-0x0;var _0x1cc872=_0xeba4[_0x5e4503];return _0x1cc872;};'use strict';var _=require(_0x4eba('0x0'));var util=require(_0x4eba('0x1'));var logger=require(_0x4eba('0x2'))(_0x4eba('0x3'));var moment=require(_0x4eba('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4eba('0x5'));var rimraf=require(_0x4eba('0x6'));var config=require(_0x4eba('0x7'));var attributes=require(_0x4eba('0x8'));module[_0x4eba('0x9')]=function(_0xbad439,_0x410a35){return _0xbad439[_0x4eba('0xa')](_0x4eba('0xb'),attributes,{'tableName':_0x4eba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20fe=['exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0xaf16d,_0x3f8c83){var _0xbe1748=function(_0x5d840a){while(--_0x5d840a){_0xaf16d['push'](_0xaf16d['shift']());}};_0xbe1748(++_0x3f8c83);}(_0x20fe,0x100));var _0xe20f=function(_0x34f2b4,_0xf8a399){_0x34f2b4=_0x34f2b4-0x0;var _0x145c5c=_0x20fe[_0x34f2b4];return _0x145c5c;};'use strict';var _=require(_0xe20f('0x0'));var util=require(_0xe20f('0x1'));var logger=require(_0xe20f('0x2'))('api');var moment=require(_0xe20f('0x3'));var BPromise=require(_0xe20f('0x4'));var rp=require(_0xe20f('0x5'));var fs=require('fs');var path=require(_0xe20f('0x6'));var rimraf=require(_0xe20f('0x7'));var config=require(_0xe20f('0x8'));var attributes=require(_0xe20f('0x9'));module[_0xe20f('0xa')]=function(_0x1db667,_0xe10ae4){return _0x1db667[_0xe20f('0xb')](_0xe20f('0xc'),attributes,{'tableName':_0xe20f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index c6f904f..136306b 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 _0x49bb=['result','catch','SmsQueue','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x50e71d,_0xe02506){var _0x308f34=function(_0x456801){while(--_0x456801){_0x50e71d['push'](_0x50e71d['shift']());}};_0x308f34(++_0xe02506);}(_0x49bb,0x11f));var _0xb49b=function(_0x2f181f,_0x3c2211){_0x2f181f=_0x2f181f-0x0;var _0x49085e=_0x49bb[_0x2f181f];return _0x49085e;};'use strict';var _=require(_0xb49b('0x0'));var util=require(_0xb49b('0x1'));var moment=require('moment');var BPromise=require(_0xb49b('0x2'));var rs=require(_0xb49b('0x3'));var fs=require('fs');var Redis=require(_0xb49b('0x4'));var db=require(_0xb49b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb49b('0x6'))('rpc');var config=require(_0xb49b('0x7'));var jayson=require(_0xb49b('0x8'));var client=jayson['client'][_0xb49b('0x9')]({'port':0x232a});config[_0xb49b('0xa')]=_[_0xb49b('0xb')](config['redis'],{'host':_0xb49b('0xc'),'port':0x18eb});var socket=require(_0xb49b('0xd'))(new Redis(config[_0xb49b('0xa')]));require(_0xb49b('0xe'))['register'](socket);function respondWithRpcPromise(_0x29b9a4,_0x4a210c,_0x46c579){return new BPromise(function(_0x35409e,_0x31b995){return client[_0xb49b('0xf')](_0x29b9a4,_0x46c579)[_0xb49b('0x10')](function(_0x39caee){logger[_0xb49b('0x11')](_0xb49b('0x12'),_0x4a210c,'request\x20sent');logger[_0xb49b('0x13')](_0xb49b('0x14'),_0x4a210c,_0xb49b('0x15'),JSON['stringify'](_0x39caee));if(_0x39caee[_0xb49b('0x16')]){if(_0x39caee['error'][_0xb49b('0x17')]===0x1f4){logger[_0xb49b('0x16')](_0xb49b('0x12'),_0x4a210c,_0x39caee[_0xb49b('0x16')][_0xb49b('0x18')]);return _0x31b995(_0x39caee['error'][_0xb49b('0x18')]);}logger[_0xb49b('0x16')](_0xb49b('0x12'),_0x4a210c,_0x39caee[_0xb49b('0x16')]['message']);return _0x35409e(_0x39caee[_0xb49b('0x16')][_0xb49b('0x18')]);}else{logger[_0xb49b('0x11')](_0xb49b('0x12'),_0x4a210c,_0xb49b('0x15'));_0x35409e(_0x39caee[_0xb49b('0x19')]['message']);}})[_0xb49b('0x1a')](function(_0x900575){logger['error'](_0xb49b('0x12'),_0x4a210c,_0x900575);_0x31b995(_0x900575);});});}exports['GetSmsQueue']=function(_0x52f4cc){var _0x33f2be=this;return new Promise(function(_0x5d27ae,_0x40d5a3){return db[_0xb49b('0x1b')]['findAll']({'raw':_0x52f4cc[_0xb49b('0x1c')]?_0x52f4cc['options'][_0xb49b('0x1d')]===undefined?!![]:![]:!![],'where':_0x52f4cc['options']?_0x52f4cc['options'][_0xb49b('0x1e')]||null:null,'attributes':_0x52f4cc['options']?_0x52f4cc['options'][_0xb49b('0x1f')]||null:null,'limit':_0x52f4cc[_0xb49b('0x1c')]?_0x52f4cc['options'][_0xb49b('0x20')]||null:null,'include':_0x52f4cc[_0xb49b('0x1c')]?_0x52f4cc[_0xb49b('0x1c')][_0xb49b('0x21')]?_[_0xb49b('0x22')](_0x52f4cc[_0xb49b('0x1c')][_0xb49b('0x21')],function(_0x3bb089){return{'model':db[_0x3bb089['model']],'as':_0x3bb089['as'],'attributes':_0x3bb089[_0xb49b('0x1f')],'include':_0x3bb089['include']?_[_0xb49b('0x22')](_0x3bb089[_0xb49b('0x21')],function(_0x53c6be){return{'model':db[_0x53c6be[_0xb49b('0x23')]],'as':_0x53c6be['as'],'attributes':_0x53c6be[_0xb49b('0x1f')],'include':_0x53c6be['include']?_[_0xb49b('0x22')](_0x53c6be[_0xb49b('0x21')],function(_0x404031){return{'model':db[_0x404031[_0xb49b('0x23')]],'as':_0x404031['as'],'attributes':_0x404031[_0xb49b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3747ae){logger['info'](_0xb49b('0x24'),_0x52f4cc);logger[_0xb49b('0x13')](_0xb49b('0x24'),_0x52f4cc,JSON['stringify'](_0x3747ae));_0x5d27ae(_0x3747ae);})[_0xb49b('0x1a')](function(_0x57a8a7){logger[_0xb49b('0x16')](_0xb49b('0x24'),_0x57a8a7[_0xb49b('0x18')],_0x52f4cc);_0x40d5a3(_0x33f2be[_0xb49b('0x16')](0x1f4,_0x57a8a7[_0xb49b('0x18')]));});});};exports[_0xb49b('0x25')]=function(_0x4d12e6){var _0x45443a=this;return new Promise(function(_0x4604b8,_0x437305){return db[_0xb49b('0x1b')]['find']({'raw':_0x4d12e6[_0xb49b('0x1c')]?_0x4d12e6[_0xb49b('0x1c')][_0xb49b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d12e6[_0xb49b('0x1c')]?_0x4d12e6[_0xb49b('0x1c')]['where']||null:null,'attributes':_0x4d12e6['options']?_0x4d12e6['options']['attributes']||null:null,'include':_0x4d12e6[_0xb49b('0x1c')]?_0x4d12e6[_0xb49b('0x1c')][_0xb49b('0x21')]?_[_0xb49b('0x22')](_0x4d12e6['options'][_0xb49b('0x21')],function(_0x3c0772){return{'model':db[_0x3c0772[_0xb49b('0x23')]],'as':_0x3c0772['as'],'attributes':_0x3c0772[_0xb49b('0x1f')],'include':_0x3c0772[_0xb49b('0x21')]?_['map'](_0x3c0772['include'],function(_0x9e5706){return{'model':db[_0x9e5706[_0xb49b('0x23')]],'as':_0x9e5706['as'],'attributes':_0x9e5706[_0xb49b('0x1f')],'include':_0x9e5706[_0xb49b('0x21')]?_['map'](_0x9e5706[_0xb49b('0x21')],function(_0x12de0){return{'model':db[_0x12de0[_0xb49b('0x23')]],'as':_0x12de0['as'],'attributes':_0x12de0['attributes']};}):[]};}):[]};}):[]:[]})[_0xb49b('0x10')](function(_0x37620c){logger[_0xb49b('0x11')](_0xb49b('0x25'),_0x4d12e6);logger['debug'](_0xb49b('0x25'),_0x4d12e6,JSON[_0xb49b('0x26')](_0x37620c));_0x4604b8(_0x37620c);})[_0xb49b('0x1a')](function(_0x5c1588){logger['error'](_0xb49b('0x25'),_0x5c1588[_0xb49b('0x18')],_0x4d12e6);_0x437305(_0x45443a[_0xb49b('0x16')](0x1f4,_0x5c1588[_0xb49b('0x18')]));});});}; \ No newline at end of file +var _0x06f9=['GetSmsQueue','find','ShowSmsQueue','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','localhost','redis','./smsQueue.socket','register','request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x338f9b,_0x13f4b5){var _0x4c874e=function(_0x5b09ee){while(--_0x5b09ee){_0x338f9b['push'](_0x338f9b['shift']());}};_0x4c874e(++_0x13f4b5);}(_0x06f9,0x16c));var _0x906f=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x06f9[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x906f('0x0'));var util=require(_0x906f('0x1'));var moment=require('moment');var BPromise=require(_0x906f('0x2'));var rs=require(_0x906f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x906f('0x4'))['db'];var utils=require(_0x906f('0x5'));var logger=require('../../config/logger')(_0x906f('0x6'));var config=require(_0x906f('0x7'));var jayson=require(_0x906f('0x8'));var client=jayson[_0x906f('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x906f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x906f('0xb')]));require(_0x906f('0xc'))[_0x906f('0xd')](socket);function respondWithRpcPromise(_0x14c142,_0x4f07fc,_0x35b34d){return new BPromise(function(_0x5d27b2,_0x225b19){return client[_0x906f('0xe')](_0x14c142,_0x35b34d)['then'](function(_0x318854){logger[_0x906f('0xf')]('SmsQueue,\x20%s,\x20%s',_0x4f07fc,_0x906f('0x10'));logger[_0x906f('0x11')](_0x906f('0x12'),_0x4f07fc,'request\x20sent',JSON[_0x906f('0x13')](_0x318854));if(_0x318854['error']){if(_0x318854[_0x906f('0x14')][_0x906f('0x15')]===0x1f4){logger[_0x906f('0x14')]('SmsQueue,\x20%s,\x20%s',_0x4f07fc,_0x318854[_0x906f('0x14')]['message']);return _0x225b19(_0x318854[_0x906f('0x14')]['message']);}logger[_0x906f('0x14')](_0x906f('0x16'),_0x4f07fc,_0x318854[_0x906f('0x14')][_0x906f('0x17')]);return _0x5d27b2(_0x318854['error'][_0x906f('0x17')]);}else{logger[_0x906f('0xf')](_0x906f('0x16'),_0x4f07fc,_0x906f('0x10'));_0x5d27b2(_0x318854[_0x906f('0x18')][_0x906f('0x17')]);}})['catch'](function(_0x107e2f){logger[_0x906f('0x14')](_0x906f('0x16'),_0x4f07fc,_0x107e2f);_0x225b19(_0x107e2f);});});}exports['GetSmsQueue']=function(_0x5231f1){var _0x2ac72e=this;return new Promise(function(_0x27868f,_0x4d4f96){return db[_0x906f('0x19')][_0x906f('0x1a')]({'raw':_0x5231f1[_0x906f('0x1b')]?_0x5231f1[_0x906f('0x1b')][_0x906f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5231f1[_0x906f('0x1b')]?_0x5231f1[_0x906f('0x1b')][_0x906f('0x1d')]||null:null,'attributes':_0x5231f1['options']?_0x5231f1['options'][_0x906f('0x1e')]||null:null,'limit':_0x5231f1[_0x906f('0x1b')]?_0x5231f1[_0x906f('0x1b')][_0x906f('0x1f')]||null:null,'include':_0x5231f1[_0x906f('0x1b')]?_0x5231f1[_0x906f('0x1b')][_0x906f('0x20')]?_[_0x906f('0x21')](_0x5231f1[_0x906f('0x1b')][_0x906f('0x20')],function(_0x1422f9){return{'model':db[_0x1422f9[_0x906f('0x22')]],'as':_0x1422f9['as'],'attributes':_0x1422f9[_0x906f('0x1e')],'include':_0x1422f9[_0x906f('0x20')]?_[_0x906f('0x21')](_0x1422f9['include'],function(_0x2cac67){return{'model':db[_0x2cac67[_0x906f('0x22')]],'as':_0x2cac67['as'],'attributes':_0x2cac67[_0x906f('0x1e')],'include':_0x2cac67[_0x906f('0x20')]?_[_0x906f('0x21')](_0x2cac67[_0x906f('0x20')],function(_0xf9262){return{'model':db[_0xf9262[_0x906f('0x22')]],'as':_0xf9262['as'],'attributes':_0xf9262['attributes']};}):[]};}):[]};}):[]:[]})[_0x906f('0x23')](function(_0x4cbd0f){logger[_0x906f('0xf')](_0x906f('0x24'),_0x5231f1);logger[_0x906f('0x11')](_0x906f('0x24'),_0x5231f1,JSON['stringify'](_0x4cbd0f));_0x27868f(_0x4cbd0f);})['catch'](function(_0x227162){logger[_0x906f('0x14')](_0x906f('0x24'),_0x227162['message'],_0x5231f1);_0x4d4f96(_0x2ac72e['error'](0x1f4,_0x227162[_0x906f('0x17')]));});});};exports['ShowSmsQueue']=function(_0x49817b){var _0x59e53f=this;return new Promise(function(_0x592c5d,_0x43631b){return db[_0x906f('0x19')][_0x906f('0x25')]({'raw':_0x49817b[_0x906f('0x1b')]?_0x49817b['options']['raw']===undefined?!![]:![]:!![],'where':_0x49817b[_0x906f('0x1b')]?_0x49817b[_0x906f('0x1b')]['where']||null:null,'attributes':_0x49817b['options']?_0x49817b[_0x906f('0x1b')][_0x906f('0x1e')]||null:null,'include':_0x49817b[_0x906f('0x1b')]?_0x49817b[_0x906f('0x1b')][_0x906f('0x20')]?_[_0x906f('0x21')](_0x49817b['options']['include'],function(_0x4c78ac){return{'model':db[_0x4c78ac[_0x906f('0x22')]],'as':_0x4c78ac['as'],'attributes':_0x4c78ac[_0x906f('0x1e')],'include':_0x4c78ac[_0x906f('0x20')]?_[_0x906f('0x21')](_0x4c78ac['include'],function(_0x5f43c5){return{'model':db[_0x5f43c5['model']],'as':_0x5f43c5['as'],'attributes':_0x5f43c5[_0x906f('0x1e')],'include':_0x5f43c5['include']?_[_0x906f('0x21')](_0x5f43c5[_0x906f('0x20')],function(_0x2af63b){return{'model':db[_0x2af63b[_0x906f('0x22')]],'as':_0x2af63b['as'],'attributes':_0x2af63b[_0x906f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x906f('0x23')](function(_0x3efeb7){logger['info'](_0x906f('0x26'),_0x49817b);logger['debug'](_0x906f('0x26'),_0x49817b,JSON[_0x906f('0x13')](_0x3efeb7));_0x592c5d(_0x3efeb7);})[_0x906f('0x27')](function(_0x4b43ab){logger[_0x906f('0x14')](_0x906f('0x26'),_0x4b43ab[_0x906f('0x17')],_0x49817b);_0x43631b(_0x59e53f[_0x906f('0x14')](0x1f4,_0x4b43ab[_0x906f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2a8a8e1..d577ff9 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 _0xd598=['register','length','smsQueue:','emit'];(function(_0x571dbc,_0x400df9){var _0x55043c=function(_0x47df3b){while(--_0x47df3b){_0x571dbc['push'](_0x571dbc['shift']());}};_0x55043c(++_0x400df9);}(_0xd598,0x1bf));var _0x8d59=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd598[_0xa464c9];return _0x3d73c4;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0xc1de4c,_0x1343a6){return function(_0x3c1f1e){_0x1343a6[_0x8d59('0x0')](_0xc1de4c,_0x3c1f1e);};}function removeListener(_0x1f9cc4,_0x902a8a){return function(){SmsQueueEvents['removeListener'](_0x1f9cc4,_0x902a8a);};}exports[_0x8d59('0x1')]=function(_0x1253da){for(var _0x5196b0=0x0,_0xd39afa=events[_0x8d59('0x2')];_0x5196b0<_0xd39afa;_0x5196b0++){var _0x259661=events[_0x5196b0];var _0x33133c=createListener(_0x8d59('0x3')+_0x259661,_0x1253da);SmsQueueEvents['on'](_0x259661,_0x33133c);}}; \ No newline at end of file +var _0x2a5a=['update','emit','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x2a5a,0x8d));var _0xa2a5=function(_0x57f929,_0x2e280b){_0x57f929=_0x57f929-0x0;var _0x484fbe=_0x2a5a[_0x57f929];return _0x484fbe;};'use strict';var SmsQueueEvents=require(_0xa2a5('0x0'));var events=[_0xa2a5('0x1'),_0xa2a5('0x2'),_0xa2a5('0x3')];function createListener(_0x3a3fe5,_0x445293){return function(_0x322d8a){_0x445293[_0xa2a5('0x4')](_0x3a3fe5,_0x322d8a);};}function removeListener(_0x842cd,_0x535b21){return function(){SmsQueueEvents['removeListener'](_0x842cd,_0x535b21);};}exports[_0xa2a5('0x5')]=function(_0x2fe215){for(var _0x16709e=0x0,_0x325265=events[_0xa2a5('0x6')];_0x16709e<_0x325265;_0x16709e++){var _0x3784ec=events[_0x16709e];var _0x1e7bae=createListener(_0xa2a5('0x7')+_0x3784ec,_0x2fe215);SmsQueueEvents['on'](_0x3784ec,_0x1e7bae);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 843d302..d779231 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 _0x99d6=['update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x31aaed,_0xae499c){var _0x424075=function(_0x4963e){while(--_0x4963e){_0x31aaed['push'](_0x31aaed['shift']());}};_0x424075(++_0xae499c);}(_0x99d6,0x193));var _0x699d=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x99d6[_0x5d0609];return _0xaa3fd1;};'use strict';var multer=require(_0x699d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x699d('0x1'));var router=express[_0x699d('0x2')]();var fs_extra=require(_0x699d('0x3'));var auth=require(_0x699d('0x4'));var interaction=require(_0x699d('0x5'));var config=require(_0x699d('0x6'));var controller=require(_0x699d('0x7'));router[_0x699d('0x8')]('/',auth[_0x699d('0x9')](),controller[_0x699d('0xa')]);router[_0x699d('0x8')](_0x699d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x699d('0x8')](_0x699d('0xc'),auth['isAuthenticated'](),controller[_0x699d('0xd')]);router[_0x699d('0xe')]('/',auth['isAuthenticated'](),controller[_0x699d('0xf')]);router[_0x699d('0x10')](_0x699d('0xc'),auth[_0x699d('0x9')](),controller[_0x699d('0x11')]);router[_0x699d('0x12')](_0x699d('0xc'),auth['isAuthenticated'](),controller[_0x699d('0x13')]);module[_0x699d('0x14')]=router; \ No newline at end of file +var _0x39b5=['/:id','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0x39b5,0x1ba));var _0x539b=function(_0x137705,_0x601f3a){_0x137705=_0x137705-0x0;var _0x3413fb=_0x39b5[_0x137705];return _0x3413fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x539b('0x0'));var timeout=require('connect-timeout');var express=require(_0x539b('0x1'));var router=express[_0x539b('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x539b('0x3'));var config=require('../../config/environment');var controller=require(_0x539b('0x4'));router['get']('/',auth[_0x539b('0x5')](),controller[_0x539b('0x6')]);router[_0x539b('0x7')](_0x539b('0x8'),auth[_0x539b('0x5')](),controller[_0x539b('0x9')]);router[_0x539b('0x7')]('/:id',auth[_0x539b('0x5')](),controller[_0x539b('0xa')]);router[_0x539b('0xb')]('/',auth[_0x539b('0x5')](),controller[_0x539b('0xc')]);router[_0x539b('0xd')](_0x539b('0xe'),auth[_0x539b('0x5')](),controller[_0x539b('0xf')]);router[_0x539b('0x10')](_0x539b('0xe'),auth[_0x539b('0x5')](),controller[_0x539b('0x11')]);module[_0x539b('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 773fccd..4a2009f 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 _0xc409=['exports','STRING','DATE','moment','sequelize'];(function(_0x5d04ee,_0x2a38ca){var _0x4a666a=function(_0x1883e4){while(--_0x1883e4){_0x5d04ee['push'](_0x5d04ee['shift']());}};_0x4a666a(++_0x2a38ca);}(_0xc409,0xc6));var _0x9c40=function(_0x40519b,_0x3033ae){_0x40519b=_0x40519b-0x0;var _0x57b890=_0xc409[_0x40519b];return _0x57b890;};'use strict';var moment=require(_0x9c40('0x0'));var Sequelize=require(_0x9c40('0x1'));module[_0x9c40('0x2')]={'uniqueid':{'type':Sequelize[_0x9c40('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9c40('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9c40('0x4')]},'exitAt':{'type':Sequelize[_0x9c40('0x4')]},'reason':{'type':Sequelize[_0x9c40('0x3')]}}; \ No newline at end of file +var _0x7816=['exports','STRING','DATE','moment','sequelize'];(function(_0x4501bf,_0x39029c){var _0x1f0cde=function(_0x267788){while(--_0x267788){_0x4501bf['push'](_0x4501bf['shift']());}};_0x1f0cde(++_0x39029c);}(_0x7816,0x166));var _0x6781=function(_0x3f415c,_0x310f72){_0x3f415c=_0x3f415c-0x0;var _0x8f2df8=_0x7816[_0x3f415c];return _0x8f2df8;};'use strict';var moment=require(_0x6781('0x0'));var Sequelize=require(_0x6781('0x1'));module[_0x6781('0x2')]={'uniqueid':{'type':Sequelize[_0x6781('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6781('0x4')]},'leaveAt':{'type':Sequelize[_0x6781('0x4')]},'acceptAt':{'type':Sequelize[_0x6781('0x4')]},'exitAt':{'type':Sequelize[_0x6781('0x4')]},'reason':{'type':Sequelize[_0x6781('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2234bac..080d284 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 _0x82be=['catch','show','fields','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','stack','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','options','include','findAll'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0x82be,0x18f));var _0xe82b=function(_0xaa1316,_0x282b13){_0xaa1316=_0xaa1316-0x0;var _0x28866c=_0x82be[_0xaa1316];return _0x28866c;};'use strict';var emlformat=require(_0xe82b('0x0'));var rimraf=require(_0xe82b('0x1'));var zipdir=require(_0xe82b('0x2'));var jsonpatch=require(_0xe82b('0x3'));var rp=require(_0xe82b('0x4'));var moment=require(_0xe82b('0x5'));var BPromise=require(_0xe82b('0x6'));var Mustache=require(_0xe82b('0x7'));var util=require(_0xe82b('0x8'));var path=require('path');var sox=require(_0xe82b('0x9'));var csv=require('to-csv');var ejs=require(_0xe82b('0xa'));var fs=require('fs');var fs_extra=require(_0xe82b('0xb'));var _=require(_0xe82b('0xc'));var squel=require(_0xe82b('0xd'));var crypto=require(_0xe82b('0xe'));var jsforce=require(_0xe82b('0xf'));var deskjs=require(_0xe82b('0x10'));var toCsv=require(_0xe82b('0x11'));var querystring=require(_0xe82b('0x12'));var Papa=require(_0xe82b('0x13'));var Redis=require(_0xe82b('0x14'));var authService=require(_0xe82b('0x15'));var qs=require(_0xe82b('0x16'));var as=require(_0xe82b('0x17'));var hardwareService=require(_0xe82b('0x18'));var logger=require(_0xe82b('0x19'))(_0xe82b('0x1a'));var utils=require('../../config/utils');var config=require(_0xe82b('0x1b'));var licenseUtil=require(_0xe82b('0x1c'));var db=require(_0xe82b('0x1d'))['db'];function respondWithStatusCode(_0x4dbe45,_0x370765){_0x370765=_0x370765||0xcc;return function(_0x2207b3){if(_0x2207b3){return _0x4dbe45[_0xe82b('0x1e')](_0x370765);}return _0x4dbe45[_0xe82b('0x1f')](_0x370765)[_0xe82b('0x20')]();};}function respondWithResult(_0x2eb676,_0x4c5cc8){_0x4c5cc8=_0x4c5cc8||0xc8;return function(_0x113497){if(_0x113497){return _0x2eb676[_0xe82b('0x1f')](_0x4c5cc8)[_0xe82b('0x21')](_0x113497);}};}function respondWithFilteredResult(_0x4f23eb,_0x7346c8){return function(_0x31b814){if(_0x31b814){var _0x2e5dea=typeof _0x7346c8[_0xe82b('0x22')]===_0xe82b('0x23')&&typeof _0x7346c8['limit']==='undefined';var _0x4ced22=_0x31b814[_0xe82b('0x24')];var _0x37577d=_0x2e5dea?0x0:_0x7346c8[_0xe82b('0x22')];var _0xd8562=_0x2e5dea?_0x31b814['count']:_0x7346c8[_0xe82b('0x22')]+_0x7346c8['limit'];var _0x3fe5fa;if(_0xd8562>=_0x4ced22){_0xd8562=_0x4ced22;_0x3fe5fa=0xc8;}else{_0x3fe5fa=0xce;}_0x4f23eb[_0xe82b('0x1f')](_0x3fe5fa);return _0x4f23eb['set']('Content-Range',_0x37577d+'-'+_0xd8562+'/'+_0x4ced22)[_0xe82b('0x21')](_0x31b814);}return null;};}function patchUpdates(_0x1402cc){return function(_0x2f1abe){try{jsonpatch[_0xe82b('0x25')](_0x2f1abe,_0x1402cc,!![]);}catch(_0x557dbc){return BPromise[_0xe82b('0x26')](_0x557dbc);}return _0x2f1abe[_0xe82b('0x27')]();};}function saveUpdates(_0x48758b,_0x3fdfc5){return function(_0x55df50){if(_0x55df50){return _0x55df50[_0xe82b('0x28')](_0x48758b)[_0xe82b('0x29')](function(_0x45853e){return _0x45853e;});}return null;};}function removeEntity(_0x3e49d4,_0x2acb63){return function(_0x1c04f4){if(_0x1c04f4){return _0x1c04f4[_0xe82b('0x2a')]()[_0xe82b('0x29')](function(){_0x3e49d4[_0xe82b('0x1f')](0xcc)[_0xe82b('0x20')]();});}};}function handleEntityNotFound(_0x5dbada,_0x202903){return function(_0x39e8bf){if(!_0x39e8bf){_0x5dbada[_0xe82b('0x1e')](0x194);}return _0x39e8bf;};}function handleError(_0x27ddda,_0x122d80){_0x122d80=_0x122d80||0x1f4;return function(_0x513cbe){logger['error'](_0x513cbe[_0xe82b('0x2b')]);if(_0x513cbe['name']){delete _0x513cbe['name'];}_0x27ddda[_0xe82b('0x1f')](_0x122d80)[_0xe82b('0x2c')](_0x513cbe);};}exports['index']=function(_0x3a579c,_0x4124f4){var _0x2c5a4a={},_0x1cdf40={},_0x72137a={'count':0x0,'rows':[]};var _0x417f3c=_[_0xe82b('0x2d')](db[_0xe82b('0x2e')][_0xe82b('0x2f')],function(_0x288d8d){return{'name':_0x288d8d[_0xe82b('0x30')],'type':_0x288d8d[_0xe82b('0x31')][_0xe82b('0x32')]};});_0x1cdf40[_0xe82b('0x33')]=_[_0xe82b('0x2d')](_0x417f3c,_0xe82b('0x34'));_0x1cdf40[_0xe82b('0x35')]=_[_0xe82b('0x36')](_0x3a579c['query']);_0x1cdf40[_0xe82b('0x37')]=_[_0xe82b('0x38')](_0x1cdf40[_0xe82b('0x33')],_0x1cdf40['query']);_0x2c5a4a[_0xe82b('0x39')]=_[_0xe82b('0x38')](_0x1cdf40[_0xe82b('0x33')],qs['fields'](_0x3a579c[_0xe82b('0x35')]['fields']));_0x2c5a4a[_0xe82b('0x39')]=_0x2c5a4a[_0xe82b('0x39')][_0xe82b('0x3a')]?_0x2c5a4a['attributes']:_0x1cdf40[_0xe82b('0x33')];if(!_0x3a579c[_0xe82b('0x35')][_0xe82b('0x3b')]('nolimit')){_0x2c5a4a[_0xe82b('0x3c')]=qs[_0xe82b('0x3c')](_0x3a579c[_0xe82b('0x35')][_0xe82b('0x3c')]);_0x2c5a4a[_0xe82b('0x22')]=qs[_0xe82b('0x22')](_0x3a579c[_0xe82b('0x35')][_0xe82b('0x22')]);}_0x2c5a4a['order']=qs[_0xe82b('0x3d')](_0x3a579c[_0xe82b('0x35')]['sort']);_0x2c5a4a[_0xe82b('0x3e')]=qs['filters'](_['pick'](_0x3a579c[_0xe82b('0x35')],_0x1cdf40[_0xe82b('0x37')]),_0x417f3c);if(_0x3a579c[_0xe82b('0x35')][_0xe82b('0x3f')]){_0x2c5a4a[_0xe82b('0x3e')]=_[_0xe82b('0x40')](_0x2c5a4a[_0xe82b('0x3e')],{'$or':_[_0xe82b('0x2d')](_0x417f3c,function(_0x4d8a92){if(_0x4d8a92['type']!==_0xe82b('0x41')){var _0x5b9545={};_0x5b9545[_0x4d8a92[_0xe82b('0x34')]]={'$like':'%'+_0x3a579c[_0xe82b('0x35')][_0xe82b('0x3f')]+'%'};return _0x5b9545;}})});}_0x2c5a4a=_[_0xe82b('0x40')]({},_0x2c5a4a,_0x3a579c[_0xe82b('0x42')]);var _0x3a3c0a={'where':_0x2c5a4a['where']};return db[_0xe82b('0x2e')][_0xe82b('0x24')](_0x3a3c0a)['then'](function(_0x1434cc){_0x72137a[_0xe82b('0x24')]=_0x1434cc;if(_0x3a579c[_0xe82b('0x35')]['includeAll']){_0x2c5a4a[_0xe82b('0x43')]=[{'all':!![]}];}return db[_0xe82b('0x2e')][_0xe82b('0x44')](_0x2c5a4a);})['then'](function(_0xc852f4){_0x72137a['rows']=_0xc852f4;return _0x72137a;})[_0xe82b('0x29')](respondWithFilteredResult(_0x4124f4,_0x2c5a4a))[_0xe82b('0x45')](handleError(_0x4124f4,null));};exports[_0xe82b('0x46')]=function(_0xf8fc10,_0x8b0ea6){var _0x1dddbd={'raw':!![],'where':{'id':_0xf8fc10['params']['id']}},_0x112b12={};_0x112b12[_0xe82b('0x33')]=_[_0xe82b('0x36')](db[_0xe82b('0x2e')][_0xe82b('0x2f')]);_0x112b12[_0xe82b('0x35')]=_[_0xe82b('0x36')](_0xf8fc10['query']);_0x112b12['filters']=_[_0xe82b('0x38')](_0x112b12['model'],_0x112b12[_0xe82b('0x35')]);_0x1dddbd['attributes']=_[_0xe82b('0x38')](_0x112b12[_0xe82b('0x33')],qs[_0xe82b('0x47')](_0xf8fc10[_0xe82b('0x35')][_0xe82b('0x47')]));_0x1dddbd[_0xe82b('0x39')]=_0x1dddbd['attributes'][_0xe82b('0x3a')]?_0x1dddbd[_0xe82b('0x39')]:_0x112b12['model'];if(_0xf8fc10[_0xe82b('0x35')][_0xe82b('0x48')]){_0x1dddbd[_0xe82b('0x43')]=[{'all':!![]}];}_0x1dddbd=_[_0xe82b('0x40')]({},_0x1dddbd,_0xf8fc10['options']);return db[_0xe82b('0x2e')][_0xe82b('0x49')](_0x1dddbd)[_0xe82b('0x29')](handleEntityNotFound(_0x8b0ea6,null))[_0xe82b('0x29')](respondWithResult(_0x8b0ea6,null))[_0xe82b('0x45')](handleError(_0x8b0ea6,null));};exports[_0xe82b('0x4a')]=function(_0xc60a66,_0x19c2c8){return db[_0xe82b('0x2e')]['create'](_0xc60a66[_0xe82b('0x4b')],{})[_0xe82b('0x29')](respondWithResult(_0x19c2c8,0xc9))[_0xe82b('0x45')](handleError(_0x19c2c8,null));};exports[_0xe82b('0x28')]=function(_0xc13415,_0x1b2066){if(_0xc13415['body']['id']){delete _0xc13415[_0xe82b('0x4b')]['id'];}return db[_0xe82b('0x2e')][_0xe82b('0x49')]({'where':{'id':_0xc13415[_0xe82b('0x4c')]['id']}})[_0xe82b('0x29')](handleEntityNotFound(_0x1b2066,null))[_0xe82b('0x29')](saveUpdates(_0xc13415[_0xe82b('0x4b')],null))[_0xe82b('0x29')](respondWithResult(_0x1b2066,null))[_0xe82b('0x45')](handleError(_0x1b2066,null));};exports[_0xe82b('0x2a')]=function(_0x487cd2,_0xcdafef){return db[_0xe82b('0x2e')][_0xe82b('0x49')]({'where':{'id':_0x487cd2['params']['id']}})[_0xe82b('0x29')](handleEntityNotFound(_0xcdafef,null))[_0xe82b('0x29')](removeEntity(_0xcdafef,null))['catch'](handleError(_0xcdafef,null));};exports[_0xe82b('0x4d')]=function(_0x227f6d,_0x26b02e){return db[_0xe82b('0x2e')]['describe']()[_0xe82b('0x29')](respondWithResult(_0x26b02e,null))[_0xe82b('0x45')](handleError(_0x26b02e,null));}; \ No newline at end of file +var _0xcb5f=['destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','rows','catch','show','params','includeAll','merge','create','body','find'];(function(_0x370dfe,_0x492b81){var _0x4a1f30=function(_0x442d81){while(--_0x442d81){_0x370dfe['push'](_0x370dfe['shift']());}};_0x4a1f30(++_0x492b81);}(_0xcb5f,0x174));var _0xfcb5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcb5f[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xfcb5('0x0'));var rimraf=require(_0xfcb5('0x1'));var zipdir=require(_0xfcb5('0x2'));var jsonpatch=require(_0xfcb5('0x3'));var rp=require(_0xfcb5('0x4'));var moment=require(_0xfcb5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfcb5('0x6'));var util=require(_0xfcb5('0x7'));var path=require('path');var sox=require(_0xfcb5('0x8'));var csv=require(_0xfcb5('0x9'));var ejs=require(_0xfcb5('0xa'));var fs=require('fs');var fs_extra=require(_0xfcb5('0xb'));var _=require(_0xfcb5('0xc'));var squel=require(_0xfcb5('0xd'));var crypto=require(_0xfcb5('0xe'));var jsforce=require(_0xfcb5('0xf'));var deskjs=require(_0xfcb5('0x10'));var toCsv=require(_0xfcb5('0x9'));var querystring=require('querystring');var Papa=require(_0xfcb5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfcb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcb5('0x13'));var logger=require(_0xfcb5('0x14'))('api');var utils=require(_0xfcb5('0x15'));var config=require(_0xfcb5('0x16'));var licenseUtil=require(_0xfcb5('0x17'));var db=require(_0xfcb5('0x18'))['db'];function respondWithStatusCode(_0x3d928d,_0x5b9712){_0x5b9712=_0x5b9712||0xcc;return function(_0x50eff9){if(_0x50eff9){return _0x3d928d[_0xfcb5('0x19')](_0x5b9712);}return _0x3d928d['status'](_0x5b9712)[_0xfcb5('0x1a')]();};}function respondWithResult(_0x2a3f54,_0xfcf00e){_0xfcf00e=_0xfcf00e||0xc8;return function(_0x2f9bd5){if(_0x2f9bd5){return _0x2a3f54[_0xfcb5('0x1b')](_0xfcf00e)[_0xfcb5('0x1c')](_0x2f9bd5);}};}function respondWithFilteredResult(_0x65687c,_0x326313){return function(_0x1a0c53){if(_0x1a0c53){var _0x554e2=typeof _0x326313[_0xfcb5('0x1d')]===_0xfcb5('0x1e')&&typeof _0x326313[_0xfcb5('0x1f')]===_0xfcb5('0x1e');var _0x56ebe4=_0x1a0c53['count'];var _0x358b94=_0x554e2?0x0:_0x326313[_0xfcb5('0x1d')];var _0x4cc7c8=_0x554e2?_0x1a0c53[_0xfcb5('0x20')]:_0x326313[_0xfcb5('0x1d')]+_0x326313[_0xfcb5('0x1f')];var _0x368e6c;if(_0x4cc7c8>=_0x56ebe4){_0x4cc7c8=_0x56ebe4;_0x368e6c=0xc8;}else{_0x368e6c=0xce;}_0x65687c['status'](_0x368e6c);return _0x65687c['set'](_0xfcb5('0x21'),_0x358b94+'-'+_0x4cc7c8+'/'+_0x56ebe4)[_0xfcb5('0x1c')](_0x1a0c53);}return null;};}function patchUpdates(_0x4267a8){return function(_0x323368){try{jsonpatch[_0xfcb5('0x22')](_0x323368,_0x4267a8,!![]);}catch(_0x5a021c){return BPromise['reject'](_0x5a021c);}return _0x323368[_0xfcb5('0x23')]();};}function saveUpdates(_0x5139bc,_0x4881e0){return function(_0x115df1){if(_0x115df1){return _0x115df1[_0xfcb5('0x24')](_0x5139bc)[_0xfcb5('0x25')](function(_0x21d05e){return _0x21d05e;});}return null;};}function removeEntity(_0x347e4c,_0x3734e0){return function(_0x23d5b0){if(_0x23d5b0){return _0x23d5b0['destroy']()[_0xfcb5('0x25')](function(){_0x347e4c['status'](0xcc)[_0xfcb5('0x1a')]();});}};}function handleEntityNotFound(_0x192903,_0x40246f){return function(_0x28371b){if(!_0x28371b){_0x192903[_0xfcb5('0x19')](0x194);}return _0x28371b;};}function handleError(_0x3cbbb8,_0x515d1d){_0x515d1d=_0x515d1d||0x1f4;return function(_0x5b23e7){logger[_0xfcb5('0x26')](_0x5b23e7['stack']);if(_0x5b23e7[_0xfcb5('0x27')]){delete _0x5b23e7[_0xfcb5('0x27')];}_0x3cbbb8[_0xfcb5('0x1b')](_0x515d1d)[_0xfcb5('0x28')](_0x5b23e7);};}exports[_0xfcb5('0x29')]=function(_0xd91a1b,_0xe0aad0){var _0x27ec9e={},_0x642450={},_0x1c6cfd={'count':0x0,'rows':[]};var _0x5f55e0=_['map'](db[_0xfcb5('0x2a')][_0xfcb5('0x2b')],function(_0x46060f){return{'name':_0x46060f[_0xfcb5('0x2c')],'type':_0x46060f[_0xfcb5('0x2d')][_0xfcb5('0x2e')]};});_0x642450['model']=_[_0xfcb5('0x2f')](_0x5f55e0,_0xfcb5('0x27'));_0x642450[_0xfcb5('0x30')]=_[_0xfcb5('0x31')](_0xd91a1b['query']);_0x642450[_0xfcb5('0x32')]=_['intersection'](_0x642450[_0xfcb5('0x33')],_0x642450[_0xfcb5('0x30')]);_0x27ec9e[_0xfcb5('0x34')]=_['intersection'](_0x642450[_0xfcb5('0x33')],qs[_0xfcb5('0x35')](_0xd91a1b[_0xfcb5('0x30')][_0xfcb5('0x35')]));_0x27ec9e[_0xfcb5('0x34')]=_0x27ec9e['attributes'][_0xfcb5('0x36')]?_0x27ec9e['attributes']:_0x642450[_0xfcb5('0x33')];if(!_0xd91a1b[_0xfcb5('0x30')]['hasOwnProperty'](_0xfcb5('0x37'))){_0x27ec9e[_0xfcb5('0x1f')]=qs['limit'](_0xd91a1b[_0xfcb5('0x30')][_0xfcb5('0x1f')]);_0x27ec9e[_0xfcb5('0x1d')]=qs[_0xfcb5('0x1d')](_0xd91a1b[_0xfcb5('0x30')][_0xfcb5('0x1d')]);}_0x27ec9e[_0xfcb5('0x38')]=qs[_0xfcb5('0x39')](_0xd91a1b[_0xfcb5('0x30')][_0xfcb5('0x39')]);_0x27ec9e[_0xfcb5('0x3a')]=qs[_0xfcb5('0x32')](_[_0xfcb5('0x3b')](_0xd91a1b['query'],_0x642450['filters']),_0x5f55e0);if(_0xd91a1b['query'][_0xfcb5('0x3c')]){_0x27ec9e[_0xfcb5('0x3a')]=_['merge'](_0x27ec9e[_0xfcb5('0x3a')],{'$or':_[_0xfcb5('0x2f')](_0x5f55e0,function(_0x18118f){if(_0x18118f[_0xfcb5('0x2d')]!==_0xfcb5('0x3d')){var _0x1b41d3={};_0x1b41d3[_0x18118f[_0xfcb5('0x27')]]={'$like':'%'+_0xd91a1b[_0xfcb5('0x30')][_0xfcb5('0x3c')]+'%'};return _0x1b41d3;}})});}_0x27ec9e=_['merge']({},_0x27ec9e,_0xd91a1b[_0xfcb5('0x3e')]);var _0x4dbb48={'where':_0x27ec9e['where']};return db['SmsQueueReport']['count'](_0x4dbb48)['then'](function(_0x4cfb39){_0x1c6cfd[_0xfcb5('0x20')]=_0x4cfb39;if(_0xd91a1b[_0xfcb5('0x30')]['includeAll']){_0x27ec9e['include']=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x27ec9e);})[_0xfcb5('0x25')](function(_0x57624c){_0x1c6cfd[_0xfcb5('0x3f')]=_0x57624c;return _0x1c6cfd;})['then'](respondWithFilteredResult(_0xe0aad0,_0x27ec9e))[_0xfcb5('0x40')](handleError(_0xe0aad0,null));};exports[_0xfcb5('0x41')]=function(_0x335f94,_0x2df98d){var _0x58cd88={'raw':!![],'where':{'id':_0x335f94[_0xfcb5('0x42')]['id']}},_0x3eff9a={};_0x3eff9a[_0xfcb5('0x33')]=_[_0xfcb5('0x31')](db['SmsQueueReport'][_0xfcb5('0x2b')]);_0x3eff9a[_0xfcb5('0x30')]=_[_0xfcb5('0x31')](_0x335f94[_0xfcb5('0x30')]);_0x3eff9a['filters']=_['intersection'](_0x3eff9a[_0xfcb5('0x33')],_0x3eff9a[_0xfcb5('0x30')]);_0x58cd88[_0xfcb5('0x34')]=_['intersection'](_0x3eff9a[_0xfcb5('0x33')],qs[_0xfcb5('0x35')](_0x335f94['query'][_0xfcb5('0x35')]));_0x58cd88[_0xfcb5('0x34')]=_0x58cd88[_0xfcb5('0x34')][_0xfcb5('0x36')]?_0x58cd88['attributes']:_0x3eff9a[_0xfcb5('0x33')];if(_0x335f94[_0xfcb5('0x30')][_0xfcb5('0x43')]){_0x58cd88['include']=[{'all':!![]}];}_0x58cd88=_[_0xfcb5('0x44')]({},_0x58cd88,_0x335f94[_0xfcb5('0x3e')]);return db[_0xfcb5('0x2a')]['find'](_0x58cd88)[_0xfcb5('0x25')](handleEntityNotFound(_0x2df98d,null))[_0xfcb5('0x25')](respondWithResult(_0x2df98d,null))[_0xfcb5('0x40')](handleError(_0x2df98d,null));};exports[_0xfcb5('0x45')]=function(_0x5002d9,_0x30d86c){return db['SmsQueueReport'][_0xfcb5('0x45')](_0x5002d9[_0xfcb5('0x46')],{})['then'](respondWithResult(_0x30d86c,0xc9))[_0xfcb5('0x40')](handleError(_0x30d86c,null));};exports[_0xfcb5('0x24')]=function(_0x9428f1,_0x537510){if(_0x9428f1[_0xfcb5('0x46')]['id']){delete _0x9428f1[_0xfcb5('0x46')]['id'];}return db[_0xfcb5('0x2a')][_0xfcb5('0x47')]({'where':{'id':_0x9428f1[_0xfcb5('0x42')]['id']}})[_0xfcb5('0x25')](handleEntityNotFound(_0x537510,null))['then'](saveUpdates(_0x9428f1[_0xfcb5('0x46')],null))[_0xfcb5('0x25')](respondWithResult(_0x537510,null))[_0xfcb5('0x40')](handleError(_0x537510,null));};exports[_0xfcb5('0x48')]=function(_0x402f09,_0x2b3f2e){return db[_0xfcb5('0x2a')][_0xfcb5('0x47')]({'where':{'id':_0x402f09[_0xfcb5('0x42')]['id']}})[_0xfcb5('0x25')](handleEntityNotFound(_0x2b3f2e,null))[_0xfcb5('0x25')](removeEntity(_0x2b3f2e,null))['catch'](handleError(_0x2b3f2e,null));};exports[_0xfcb5('0x49')]=function(_0x28afea,_0x3f6d6a){return db['SmsQueueReport'][_0xfcb5('0x49')]()[_0xfcb5('0x25')](respondWithResult(_0x3f6d6a,null))[_0xfcb5('0x40')](handleError(_0x3f6d6a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9e62a11..30ad60b 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(_0x19ba3b,_0x46dfd6){var _0xe5f3f6=function(_0x261b6e){while(--_0x261b6e){_0x19ba3b['push'](_0x19ba3b['shift']());}};_0xe5f3f6(++_0x46dfd6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x2c5b29,_0x43a9f1){var _0x27e64f=function(_0x377ff1){while(--_0x377ff1){_0x2c5b29['push'](_0x2c5b29['shift']());}};_0x27e64f(++_0x43a9f1);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 9f3bfd2..15ff30b 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 _0x734f=['raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','SmsQueueReport','options','then','CreateSmsQueueReport','UpdateSmsQueueReport','body'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x734f,0x1df));var _0xf734=function(_0x54833a,_0x2b5714){_0x54833a=_0x54833a-0x0;var _0x4f3dc6=_0x734f[_0x54833a];return _0x4f3dc6;};'use strict';var _=require(_0xf734('0x0'));var util=require(_0xf734('0x1'));var moment=require(_0xf734('0x2'));var BPromise=require(_0xf734('0x3'));var rs=require(_0xf734('0x4'));var fs=require('fs');var Redis=require(_0xf734('0x5'));var db=require(_0xf734('0x6'))['db'];var utils=require(_0xf734('0x7'));var logger=require(_0xf734('0x8'))(_0xf734('0x9'));var config=require('../../config/environment');var jayson=require(_0xf734('0xa'));var client=jayson[_0xf734('0xb')][_0xf734('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bf7bd,_0x752efa,_0x5f92bc){return new BPromise(function(_0xcc1e6a,_0x2c70d4){return client[_0xf734('0xd')](_0x5bf7bd,_0x5f92bc)['then'](function(_0x27f78c){logger['info'](_0xf734('0xe'),_0x752efa,'request\x20sent');logger[_0xf734('0xf')](_0xf734('0x10'),_0x752efa,_0xf734('0x11'),JSON[_0xf734('0x12')](_0x27f78c));if(_0x27f78c[_0xf734('0x13')]){if(_0x27f78c['error'][_0xf734('0x14')]===0x1f4){logger[_0xf734('0x13')](_0xf734('0xe'),_0x752efa,_0x27f78c[_0xf734('0x13')][_0xf734('0x15')]);return _0x2c70d4(_0x27f78c[_0xf734('0x13')][_0xf734('0x15')]);}logger[_0xf734('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x752efa,_0x27f78c[_0xf734('0x13')][_0xf734('0x15')]);return _0xcc1e6a(_0x27f78c[_0xf734('0x13')][_0xf734('0x15')]);}else{logger[_0xf734('0x16')](_0xf734('0xe'),_0x752efa,_0xf734('0x11'));_0xcc1e6a(_0x27f78c[_0xf734('0x17')]['message']);}})[_0xf734('0x18')](function(_0x1e2ec3){logger['error'](_0xf734('0xe'),_0x752efa,_0x1e2ec3);_0x2c70d4(_0x1e2ec3);});});}exports['CreateSmsQueueReport']=function(_0x2fd838){var _0x5db2c3=this;return new Promise(function(_0x2e62ec,_0xca0c13){return db[_0xf734('0x19')]['create'](_0x2fd838['body'],{'raw':_0x2fd838[_0xf734('0x1a')]?_0x2fd838[_0xf734('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xf734('0x1b')](function(_0x34d1fe){logger[_0xf734('0x16')](_0xf734('0x1c'),_0x2fd838);logger[_0xf734('0xf')](_0xf734('0x1c'),_0x2fd838,JSON['stringify'](_0x34d1fe));_0x2e62ec(_0x34d1fe);})[_0xf734('0x18')](function(_0x15f7b6){logger['error'](_0xf734('0x1c'),_0x15f7b6[_0xf734('0x15')],_0x2fd838);_0xca0c13(_0x5db2c3[_0xf734('0x13')](0x1f4,_0x15f7b6['message']));});});};exports[_0xf734('0x1d')]=function(_0x4fc350){var _0x3aecca=this;return new Promise(function(_0x3e32a0,_0x4ecf02){return db['SmsQueueReport']['update'](_0x4fc350[_0xf734('0x1e')],{'raw':_0x4fc350[_0xf734('0x1a')]?_0x4fc350[_0xf734('0x1a')][_0xf734('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc350[_0xf734('0x1a')]?_0x4fc350['options']['where']||null:null,'attributes':_0x4fc350[_0xf734('0x1a')]?_0x4fc350[_0xf734('0x1a')][_0xf734('0x20')]||null:null,'limit':_0x4fc350[_0xf734('0x1a')]?_0x4fc350[_0xf734('0x1a')][_0xf734('0x21')]||null:null})['then'](function(_0x28b706){logger['info'](_0xf734('0x1d'),_0x4fc350);logger[_0xf734('0xf')]('UpdateSmsQueueReport',_0x4fc350,JSON[_0xf734('0x12')](_0x28b706));_0x3e32a0(_0x28b706);})['catch'](function(_0x575b8c){logger[_0xf734('0x13')]('UpdateSmsQueueReport',_0x575b8c[_0xf734('0x15')],_0x4fc350);_0x4ecf02(_0x3aecca[_0xf734('0x13')](0x1f4,_0x575b8c['message']));});});}; \ No newline at end of file +var _0x9f5e=['SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x9f5e,0xd3));var _0xe9f5=function(_0x12e4ac,_0x377684){_0x12e4ac=_0x12e4ac-0x0;var _0x527d42=_0x9f5e[_0x12e4ac];return _0x527d42;};'use strict';var _=require(_0xe9f5('0x0'));var util=require(_0xe9f5('0x1'));var moment=require(_0xe9f5('0x2'));var BPromise=require(_0xe9f5('0x3'));var rs=require(_0xe9f5('0x4'));var fs=require('fs');var Redis=require(_0xe9f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9f5('0x6'));var logger=require(_0xe9f5('0x7'))('rpc');var config=require(_0xe9f5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe9f5('0x9')][_0xe9f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b0a7f,_0x35a197,_0x25120e){return new BPromise(function(_0x43fe7c,_0x50f438){return client['request'](_0x4b0a7f,_0x25120e)[_0xe9f5('0xb')](function(_0x3abda4){logger[_0xe9f5('0xc')](_0xe9f5('0xd'),_0x35a197,'request\x20sent');logger[_0xe9f5('0xe')](_0xe9f5('0xf'),_0x35a197,_0xe9f5('0x10'),JSON[_0xe9f5('0x11')](_0x3abda4));if(_0x3abda4['error']){if(_0x3abda4[_0xe9f5('0x12')][_0xe9f5('0x13')]===0x1f4){logger[_0xe9f5('0x12')](_0xe9f5('0xd'),_0x35a197,_0x3abda4[_0xe9f5('0x12')][_0xe9f5('0x14')]);return _0x50f438(_0x3abda4[_0xe9f5('0x12')][_0xe9f5('0x14')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x35a197,_0x3abda4['error'][_0xe9f5('0x14')]);return _0x43fe7c(_0x3abda4['error'][_0xe9f5('0x14')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x35a197,_0xe9f5('0x10'));_0x43fe7c(_0x3abda4['result'][_0xe9f5('0x14')]);}})[_0xe9f5('0x15')](function(_0x3e324e){logger[_0xe9f5('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x35a197,_0x3e324e);_0x50f438(_0x3e324e);});});}exports[_0xe9f5('0x16')]=function(_0x480977){var _0x27b8a4=this;return new Promise(function(_0x1d8b07,_0x1d51c6){return db[_0xe9f5('0x17')][_0xe9f5('0x18')](_0x480977[_0xe9f5('0x19')],{'raw':_0x480977[_0xe9f5('0x1a')]?_0x480977[_0xe9f5('0x1a')][_0xe9f5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5f4858){logger[_0xe9f5('0xc')](_0xe9f5('0x16'),_0x480977);logger['debug']('CreateSmsQueueReport',_0x480977,JSON[_0xe9f5('0x11')](_0x5f4858));_0x1d8b07(_0x5f4858);})[_0xe9f5('0x15')](function(_0x49049d){logger[_0xe9f5('0x12')]('CreateSmsQueueReport',_0x49049d[_0xe9f5('0x14')],_0x480977);_0x1d51c6(_0x27b8a4[_0xe9f5('0x12')](0x1f4,_0x49049d[_0xe9f5('0x14')]));});});};exports[_0xe9f5('0x1c')]=function(_0x46aa44){var _0x3c6c02=this;return new Promise(function(_0x123331,_0xe393cf){return db[_0xe9f5('0x17')][_0xe9f5('0x1d')](_0x46aa44[_0xe9f5('0x19')],{'raw':_0x46aa44[_0xe9f5('0x1a')]?_0x46aa44[_0xe9f5('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46aa44['options']?_0x46aa44[_0xe9f5('0x1a')][_0xe9f5('0x1e')]||null:null,'attributes':_0x46aa44[_0xe9f5('0x1a')]?_0x46aa44['options']['attributes']||null:null,'limit':_0x46aa44[_0xe9f5('0x1a')]?_0x46aa44[_0xe9f5('0x1a')][_0xe9f5('0x1f')]||null:null})[_0xe9f5('0xb')](function(_0x423d74){logger['info']('UpdateSmsQueueReport',_0x46aa44);logger[_0xe9f5('0xe')]('UpdateSmsQueueReport',_0x46aa44,JSON['stringify'](_0x423d74));_0x123331(_0x423d74);})[_0xe9f5('0x15')](function(_0x364b52){logger[_0xe9f5('0x12')](_0xe9f5('0x1c'),_0x364b52[_0xe9f5('0x14')],_0x46aa44);_0xe393cf(_0x3c6c02[_0xe9f5('0x12')](0x1f4,_0x364b52['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a304cb9..62cbb40 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 _0x0fda=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x4effde,_0x46ba28){var _0x5a01d5=function(_0x1a2962){while(--_0x1a2962){_0x4effde['push'](_0x4effde['shift']());}};_0x5a01d5(++_0x46ba28);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x392a5c,_0x209502){_0x392a5c=_0x392a5c-0x0;var _0xc5ea8d=_0x0fda[_0x392a5c];return _0xc5ea8d;};'use strict';var multer=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var timeout=require(_0xa0fd('0x2'));var express=require(_0xa0fd('0x3'));var router=express[_0xa0fd('0x4')]();var fs_extra=require(_0xa0fd('0x5'));var auth=require(_0xa0fd('0x6'));var interaction=require(_0xa0fd('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0xa0fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0fd('0x8')](_0xa0fd('0x9'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xb')]);router['get'](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xd')]);router[_0xa0fd('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0fd('0xf')]);router[_0xa0fd('0x10')](_0xa0fd('0xc'),auth['isAuthenticated'](),controller[_0xa0fd('0x11')]);router[_0xa0fd('0x12')](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa3e6=['express','Router','fs-extra','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','describe','put','update','delete','/:id','destroy','multer','path'];(function(_0x145aa0,_0x2f4370){var _0x266dee=function(_0x3daecf){while(--_0x3daecf){_0x145aa0['push'](_0x145aa0['shift']());}};_0x266dee(++_0x2f4370);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x340313,_0x5a95ae){_0x340313=_0x340313-0x0;var _0xfb23f8=_0xa3e6[_0x340313];return _0xfb23f8;};'use strict';var multer=require(_0x6a3e('0x0'));var util=require('util');var path=require(_0x6a3e('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a3e('0x2'));var router=express[_0x6a3e('0x3')]();var fs_extra=require(_0x6a3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a3e('0x5'));var config=require('../../config/environment');var controller=require(_0x6a3e('0x6'));router[_0x6a3e('0x7')]('/',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0x9')]);router[_0x6a3e('0x7')]('/describe',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xa')]);router['get']('/:id',auth[_0x6a3e('0x8')](),controller['show']);router['post']('/',auth[_0x6a3e('0x8')](),controller['create']);router[_0x6a3e('0xb')]('/:id',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xc')]);router[_0x6a3e('0xd')](_0x6a3e('0xe'),auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 47cff4d..d02269c 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4402b6,_0x2c8543){var _0x1c9a9b=function(_0x3f2f80){while(--_0x3f2f80){_0x4402b6['push'](_0x4402b6['shift']());}};_0x1c9a9b(++_0x2c8543);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1c78ea,_0x58b868){var _0x3acc84=function(_0xd5d542){while(--_0xd5d542){_0x1c78ea['push'](_0x1c78ea['shift']());}};_0x3acc84(++_0x58b868);}(_0xf4eb,0xec));var _0xbf4e=function(_0x571c8c,_0x4b819){_0x571c8c=_0x571c8c-0x0;var _0x263e40=_0xf4eb[_0x571c8c];return _0x263e40;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index cd5fc8e..7f6215d 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 _0x14de=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','create','update','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x3b9ec6,_0x49c207){var _0x5cac43=function(_0x6d23e){while(--_0x6d23e){_0x3b9ec6['push'](_0x3b9ec6['shift']());}};_0x5cac43(++_0x49c207);}(_0x14de,0x1d4));var _0xe14d=function(_0x513f2e,_0x476378){_0x513f2e=_0x513f2e-0x0;var _0x348c26=_0x14de[_0x513f2e];return _0x348c26;};'use strict';var emlformat=require(_0xe14d('0x0'));var rimraf=require(_0xe14d('0x1'));var zipdir=require(_0xe14d('0x2'));var jsonpatch=require(_0xe14d('0x3'));var rp=require(_0xe14d('0x4'));var moment=require(_0xe14d('0x5'));var BPromise=require(_0xe14d('0x6'));var Mustache=require('mustache');var util=require(_0xe14d('0x7'));var path=require(_0xe14d('0x8'));var sox=require(_0xe14d('0x9'));var csv=require(_0xe14d('0xa'));var ejs=require(_0xe14d('0xb'));var fs=require('fs');var fs_extra=require(_0xe14d('0xc'));var _=require(_0xe14d('0xd'));var squel=require(_0xe14d('0xe'));var crypto=require(_0xe14d('0xf'));var jsforce=require(_0xe14d('0x10'));var deskjs=require(_0xe14d('0x11'));var toCsv=require(_0xe14d('0xa'));var querystring=require(_0xe14d('0x12'));var Papa=require(_0xe14d('0x13'));var Redis=require(_0xe14d('0x14'));var authService=require(_0xe14d('0x15'));var qs=require(_0xe14d('0x16'));var as=require(_0xe14d('0x17'));var hardwareService=require(_0xe14d('0x18'));var logger=require(_0xe14d('0x19'))(_0xe14d('0x1a'));var utils=require('../../config/utils');var config=require(_0xe14d('0x1b'));var licenseUtil=require(_0xe14d('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d90b7,_0x5d2373){_0x5d2373=_0x5d2373||0xcc;return function(_0x2d1d08){if(_0x2d1d08){return _0x4d90b7[_0xe14d('0x1d')](_0x5d2373);}return _0x4d90b7['status'](_0x5d2373)[_0xe14d('0x1e')]();};}function respondWithResult(_0x4d11a2,_0x57b7f1){_0x57b7f1=_0x57b7f1||0xc8;return function(_0x184629){if(_0x184629){return _0x4d11a2[_0xe14d('0x1f')](_0x57b7f1)['json'](_0x184629);}};}function respondWithFilteredResult(_0x3557f5,_0x19123e){return function(_0x40c713){if(_0x40c713){var _0x2252f5=typeof _0x19123e['offset']===_0xe14d('0x20')&&typeof _0x19123e[_0xe14d('0x21')]===_0xe14d('0x20');var _0x24f66c=_0x40c713[_0xe14d('0x22')];var _0x4a0359=_0x2252f5?0x0:_0x19123e[_0xe14d('0x23')];var _0x3613b2=_0x2252f5?_0x40c713[_0xe14d('0x22')]:_0x19123e['offset']+_0x19123e[_0xe14d('0x21')];var _0x3b4dcd;if(_0x3613b2>=_0x24f66c){_0x3613b2=_0x24f66c;_0x3b4dcd=0xc8;}else{_0x3b4dcd=0xce;}_0x3557f5['status'](_0x3b4dcd);return _0x3557f5[_0xe14d('0x24')](_0xe14d('0x25'),_0x4a0359+'-'+_0x3613b2+'/'+_0x24f66c)['json'](_0x40c713);}return null;};}function patchUpdates(_0xb8b894){return function(_0x2e5885){try{jsonpatch['apply'](_0x2e5885,_0xb8b894,!![]);}catch(_0x138bb5){return BPromise[_0xe14d('0x26')](_0x138bb5);}return _0x2e5885[_0xe14d('0x27')]();};}function saveUpdates(_0x58eafb,_0xa10c95){return function(_0x197371){if(_0x197371){return _0x197371['update'](_0x58eafb)[_0xe14d('0x28')](function(_0x4a57af){return _0x4a57af;});}return null;};}function removeEntity(_0x283804,_0x2995e7){return function(_0x26bd0d){if(_0x26bd0d){return _0x26bd0d[_0xe14d('0x29')]()[_0xe14d('0x28')](function(){_0x283804['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4366d3,_0x42e33a){return function(_0x5257db){if(!_0x5257db){_0x4366d3[_0xe14d('0x1d')](0x194);}return _0x5257db;};}function handleError(_0x74e525,_0x4345cd){_0x4345cd=_0x4345cd||0x1f4;return function(_0x4aa93b){logger[_0xe14d('0x2a')](_0x4aa93b[_0xe14d('0x2b')]);if(_0x4aa93b['name']){delete _0x4aa93b[_0xe14d('0x2c')];}_0x74e525['status'](_0x4345cd)['send'](_0x4aa93b);};}exports[_0xe14d('0x2d')]=function(_0x389456,_0xb922cd){var _0x47bbaf={},_0x33e6e3={},_0x4fc624={'count':0x0,'rows':[]};var _0x44bce8=_[_0xe14d('0x2e')](db['SmsTransferReport'][_0xe14d('0x2f')],function(_0x52c9b2){return{'name':_0x52c9b2['fieldName'],'type':_0x52c9b2[_0xe14d('0x30')]['key']};});_0x33e6e3[_0xe14d('0x31')]=_['map'](_0x44bce8,_0xe14d('0x2c'));_0x33e6e3[_0xe14d('0x32')]=_[_0xe14d('0x33')](_0x389456[_0xe14d('0x32')]);_0x33e6e3[_0xe14d('0x34')]=_[_0xe14d('0x35')](_0x33e6e3['model'],_0x33e6e3[_0xe14d('0x32')]);_0x47bbaf[_0xe14d('0x36')]=_['intersection'](_0x33e6e3['model'],qs['fields'](_0x389456['query'][_0xe14d('0x37')]));_0x47bbaf[_0xe14d('0x36')]=_0x47bbaf[_0xe14d('0x36')][_0xe14d('0x38')]?_0x47bbaf[_0xe14d('0x36')]:_0x33e6e3[_0xe14d('0x31')];if(!_0x389456[_0xe14d('0x32')][_0xe14d('0x39')](_0xe14d('0x3a'))){_0x47bbaf[_0xe14d('0x21')]=qs[_0xe14d('0x21')](_0x389456[_0xe14d('0x32')][_0xe14d('0x21')]);_0x47bbaf[_0xe14d('0x23')]=qs[_0xe14d('0x23')](_0x389456[_0xe14d('0x32')]['offset']);}_0x47bbaf[_0xe14d('0x3b')]=qs[_0xe14d('0x3c')](_0x389456[_0xe14d('0x32')][_0xe14d('0x3c')]);_0x47bbaf[_0xe14d('0x3d')]=qs[_0xe14d('0x34')](_[_0xe14d('0x3e')](_0x389456['query'],_0x33e6e3[_0xe14d('0x34')]),_0x44bce8);if(_0x389456[_0xe14d('0x32')]['filter']){_0x47bbaf[_0xe14d('0x3d')]=_[_0xe14d('0x3f')](_0x47bbaf[_0xe14d('0x3d')],{'$or':_[_0xe14d('0x2e')](_0x44bce8,function(_0x4eba7f){if(_0x4eba7f[_0xe14d('0x30')]!==_0xe14d('0x40')){var _0x5d0976={};_0x5d0976[_0x4eba7f[_0xe14d('0x2c')]]={'$like':'%'+_0x389456['query'][_0xe14d('0x41')]+'%'};return _0x5d0976;}})});}_0x47bbaf=_[_0xe14d('0x3f')]({},_0x47bbaf,_0x389456[_0xe14d('0x42')]);var _0x431f46={'where':_0x47bbaf['where']};return db[_0xe14d('0x43')]['count'](_0x431f46)[_0xe14d('0x28')](function(_0x2370ca){_0x4fc624[_0xe14d('0x22')]=_0x2370ca;if(_0x389456['query']['includeAll']){_0x47bbaf[_0xe14d('0x44')]=[{'all':!![]}];}return db[_0xe14d('0x43')][_0xe14d('0x45')](_0x47bbaf);})[_0xe14d('0x28')](function(_0x42cf77){_0x4fc624[_0xe14d('0x46')]=_0x42cf77;return _0x4fc624;})[_0xe14d('0x28')](respondWithFilteredResult(_0xb922cd,_0x47bbaf))[_0xe14d('0x47')](handleError(_0xb922cd,null));};exports[_0xe14d('0x48')]=function(_0x5429f3,_0x111a45){var _0x27dc4c={'raw':!![],'where':{'id':_0x5429f3['params']['id']}},_0x3fae64={};_0x3fae64['model']=_[_0xe14d('0x33')](db[_0xe14d('0x43')][_0xe14d('0x2f')]);_0x3fae64[_0xe14d('0x32')]=_[_0xe14d('0x33')](_0x5429f3[_0xe14d('0x32')]);_0x3fae64[_0xe14d('0x34')]=_[_0xe14d('0x35')](_0x3fae64['model'],_0x3fae64['query']);_0x27dc4c[_0xe14d('0x36')]=_[_0xe14d('0x35')](_0x3fae64[_0xe14d('0x31')],qs['fields'](_0x5429f3['query'][_0xe14d('0x37')]));_0x27dc4c[_0xe14d('0x36')]=_0x27dc4c['attributes']['length']?_0x27dc4c[_0xe14d('0x36')]:_0x3fae64[_0xe14d('0x31')];if(_0x5429f3[_0xe14d('0x32')][_0xe14d('0x49')]){_0x27dc4c[_0xe14d('0x44')]=[{'all':!![]}];}_0x27dc4c=_[_0xe14d('0x3f')]({},_0x27dc4c,_0x5429f3[_0xe14d('0x42')]);return db[_0xe14d('0x43')]['find'](_0x27dc4c)[_0xe14d('0x28')](handleEntityNotFound(_0x111a45,null))[_0xe14d('0x28')](respondWithResult(_0x111a45,null))[_0xe14d('0x47')](handleError(_0x111a45,null));};exports[_0xe14d('0x4a')]=function(_0x236b6b,_0x9da3c0){return db[_0xe14d('0x43')]['create'](_0x236b6b['body'],{})[_0xe14d('0x28')](respondWithResult(_0x9da3c0,0xc9))[_0xe14d('0x47')](handleError(_0x9da3c0,null));};exports[_0xe14d('0x4b')]=function(_0x37a852,_0x37468f){if(_0x37a852[_0xe14d('0x4c')]['id']){delete _0x37a852[_0xe14d('0x4c')]['id'];}return db[_0xe14d('0x43')][_0xe14d('0x4d')]({'where':{'id':_0x37a852[_0xe14d('0x4e')]['id']}})[_0xe14d('0x28')](handleEntityNotFound(_0x37468f,null))[_0xe14d('0x28')](saveUpdates(_0x37a852['body'],null))[_0xe14d('0x28')](respondWithResult(_0x37468f,null))[_0xe14d('0x47')](handleError(_0x37468f,null));};exports[_0xe14d('0x29')]=function(_0xd7a682,_0x463ccc){return db[_0xe14d('0x43')][_0xe14d('0x4d')]({'where':{'id':_0xd7a682['params']['id']}})[_0xe14d('0x28')](handleEntityNotFound(_0x463ccc,null))[_0xe14d('0x28')](removeEntity(_0x463ccc,null))['catch'](handleError(_0x463ccc,null));};exports[_0xe14d('0x4f')]=function(_0x1798fb,_0x275eb8){return db['SmsTransferReport']['describe']()[_0xe14d('0x28')](respondWithResult(_0x275eb8,null))[_0xe14d('0x47')](handleError(_0x275eb8,null));}; \ No newline at end of file +var _0xbdfd=['SmsTransferReport','rows','catch','show','params','length','find','create','update','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xbdfd,0x187));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdbdf('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbdf('0x1'));var moment=require(_0xdbdf('0x2'));var BPromise=require(_0xdbdf('0x3'));var Mustache=require(_0xdbdf('0x4'));var util=require(_0xdbdf('0x5'));var path=require(_0xdbdf('0x6'));var sox=require(_0xdbdf('0x7'));var csv=require('to-csv');var ejs=require(_0xdbdf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbdf('0x9'));var squel=require(_0xdbdf('0xa'));var crypto=require('crypto');var jsforce=require(_0xdbdf('0xb'));var deskjs=require(_0xdbdf('0xc'));var toCsv=require(_0xdbdf('0xd'));var querystring=require(_0xdbdf('0xe'));var Papa=require('papaparse');var Redis=require(_0xdbdf('0xf'));var authService=require(_0xdbdf('0x10'));var qs=require(_0xdbdf('0x11'));var as=require(_0xdbdf('0x12'));var hardwareService=require(_0xdbdf('0x13'));var logger=require('../../config/logger')(_0xdbdf('0x14'));var utils=require(_0xdbdf('0x15'));var config=require(_0xdbdf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbdf('0x17'))['db'];function respondWithStatusCode(_0x14e8f3,_0x561f28){_0x561f28=_0x561f28||0xcc;return function(_0x1d7cfa){if(_0x1d7cfa){return _0x14e8f3[_0xdbdf('0x18')](_0x561f28);}return _0x14e8f3['status'](_0x561f28)['end']();};}function respondWithResult(_0x348d1a,_0x281142){_0x281142=_0x281142||0xc8;return function(_0x4516cc){if(_0x4516cc){return _0x348d1a[_0xdbdf('0x19')](_0x281142)[_0xdbdf('0x1a')](_0x4516cc);}};}function respondWithFilteredResult(_0x4619a2,_0x17627a){return function(_0x3bc7aa){if(_0x3bc7aa){var _0x3cd2f8=typeof _0x17627a[_0xdbdf('0x1b')]==='undefined'&&typeof _0x17627a[_0xdbdf('0x1c')]===_0xdbdf('0x1d');var _0x42822b=_0x3bc7aa[_0xdbdf('0x1e')];var _0x6e2796=_0x3cd2f8?0x0:_0x17627a[_0xdbdf('0x1b')];var _0x31f4b5=_0x3cd2f8?_0x3bc7aa[_0xdbdf('0x1e')]:_0x17627a[_0xdbdf('0x1b')]+_0x17627a[_0xdbdf('0x1c')];var _0xdf7e98;if(_0x31f4b5>=_0x42822b){_0x31f4b5=_0x42822b;_0xdf7e98=0xc8;}else{_0xdf7e98=0xce;}_0x4619a2[_0xdbdf('0x19')](_0xdf7e98);return _0x4619a2[_0xdbdf('0x1f')](_0xdbdf('0x20'),_0x6e2796+'-'+_0x31f4b5+'/'+_0x42822b)[_0xdbdf('0x1a')](_0x3bc7aa);}return null;};}function patchUpdates(_0x5c029f){return function(_0x2a90a1){try{jsonpatch['apply'](_0x2a90a1,_0x5c029f,!![]);}catch(_0x5bd8b6){return BPromise[_0xdbdf('0x21')](_0x5bd8b6);}return _0x2a90a1[_0xdbdf('0x22')]();};}function saveUpdates(_0x691b80,_0x22a6a5){return function(_0x38bb4b){if(_0x38bb4b){return _0x38bb4b['update'](_0x691b80)['then'](function(_0x1b1902){return _0x1b1902;});}return null;};}function removeEntity(_0x5c8f64,_0x33453a){return function(_0x2d3d66){if(_0x2d3d66){return _0x2d3d66[_0xdbdf('0x23')]()[_0xdbdf('0x24')](function(){_0x5c8f64[_0xdbdf('0x19')](0xcc)[_0xdbdf('0x25')]();});}};}function handleEntityNotFound(_0x2944d7,_0xc5428){return function(_0x21b376){if(!_0x21b376){_0x2944d7['sendStatus'](0x194);}return _0x21b376;};}function handleError(_0x13ac26,_0x444008){_0x444008=_0x444008||0x1f4;return function(_0x22c091){logger[_0xdbdf('0x26')](_0x22c091['stack']);if(_0x22c091[_0xdbdf('0x27')]){delete _0x22c091[_0xdbdf('0x27')];}_0x13ac26[_0xdbdf('0x19')](_0x444008)[_0xdbdf('0x28')](_0x22c091);};}exports[_0xdbdf('0x29')]=function(_0x4a6b44,_0x11e696){var _0x265e2c={},_0x478ca0={},_0x4583cb={'count':0x0,'rows':[]};var _0x40e70f=_[_0xdbdf('0x2a')](db['SmsTransferReport'][_0xdbdf('0x2b')],function(_0x4261c5){return{'name':_0x4261c5[_0xdbdf('0x2c')],'type':_0x4261c5[_0xdbdf('0x2d')][_0xdbdf('0x2e')]};});_0x478ca0[_0xdbdf('0x2f')]=_[_0xdbdf('0x2a')](_0x40e70f,_0xdbdf('0x27'));_0x478ca0[_0xdbdf('0x30')]=_[_0xdbdf('0x31')](_0x4a6b44[_0xdbdf('0x30')]);_0x478ca0[_0xdbdf('0x32')]=_['intersection'](_0x478ca0[_0xdbdf('0x2f')],_0x478ca0['query']);_0x265e2c[_0xdbdf('0x33')]=_[_0xdbdf('0x34')](_0x478ca0[_0xdbdf('0x2f')],qs[_0xdbdf('0x35')](_0x4a6b44[_0xdbdf('0x30')][_0xdbdf('0x35')]));_0x265e2c[_0xdbdf('0x33')]=_0x265e2c[_0xdbdf('0x33')]['length']?_0x265e2c[_0xdbdf('0x33')]:_0x478ca0[_0xdbdf('0x2f')];if(!_0x4a6b44[_0xdbdf('0x30')][_0xdbdf('0x36')](_0xdbdf('0x37'))){_0x265e2c[_0xdbdf('0x1c')]=qs[_0xdbdf('0x1c')](_0x4a6b44[_0xdbdf('0x30')][_0xdbdf('0x1c')]);_0x265e2c['offset']=qs[_0xdbdf('0x1b')](_0x4a6b44[_0xdbdf('0x30')]['offset']);}_0x265e2c['order']=qs[_0xdbdf('0x38')](_0x4a6b44[_0xdbdf('0x30')]['sort']);_0x265e2c['where']=qs[_0xdbdf('0x32')](_[_0xdbdf('0x39')](_0x4a6b44[_0xdbdf('0x30')],_0x478ca0['filters']),_0x40e70f);if(_0x4a6b44['query'][_0xdbdf('0x3a')]){_0x265e2c['where']=_[_0xdbdf('0x3b')](_0x265e2c[_0xdbdf('0x3c')],{'$or':_[_0xdbdf('0x2a')](_0x40e70f,function(_0x207efe){if(_0x207efe[_0xdbdf('0x2d')]!==_0xdbdf('0x3d')){var _0x573cc6={};_0x573cc6[_0x207efe[_0xdbdf('0x27')]]={'$like':'%'+_0x4a6b44[_0xdbdf('0x30')][_0xdbdf('0x3a')]+'%'};return _0x573cc6;}})});}_0x265e2c=_[_0xdbdf('0x3b')]({},_0x265e2c,_0x4a6b44[_0xdbdf('0x3e')]);var _0x2faa7b={'where':_0x265e2c['where']};return db['SmsTransferReport'][_0xdbdf('0x1e')](_0x2faa7b)[_0xdbdf('0x24')](function(_0x402e1a){_0x4583cb['count']=_0x402e1a;if(_0x4a6b44['query'][_0xdbdf('0x3f')]){_0x265e2c[_0xdbdf('0x40')]=[{'all':!![]}];}return db[_0xdbdf('0x41')]['findAll'](_0x265e2c);})[_0xdbdf('0x24')](function(_0x352d15){_0x4583cb[_0xdbdf('0x42')]=_0x352d15;return _0x4583cb;})[_0xdbdf('0x24')](respondWithFilteredResult(_0x11e696,_0x265e2c))[_0xdbdf('0x43')](handleError(_0x11e696,null));};exports[_0xdbdf('0x44')]=function(_0x2cc894,_0x57f5e4){var _0xe68787={'raw':!![],'where':{'id':_0x2cc894[_0xdbdf('0x45')]['id']}},_0x6617fd={};_0x6617fd[_0xdbdf('0x2f')]=_[_0xdbdf('0x31')](db[_0xdbdf('0x41')]['rawAttributes']);_0x6617fd[_0xdbdf('0x30')]=_[_0xdbdf('0x31')](_0x2cc894[_0xdbdf('0x30')]);_0x6617fd['filters']=_[_0xdbdf('0x34')](_0x6617fd['model'],_0x6617fd[_0xdbdf('0x30')]);_0xe68787['attributes']=_[_0xdbdf('0x34')](_0x6617fd[_0xdbdf('0x2f')],qs[_0xdbdf('0x35')](_0x2cc894[_0xdbdf('0x30')][_0xdbdf('0x35')]));_0xe68787[_0xdbdf('0x33')]=_0xe68787[_0xdbdf('0x33')][_0xdbdf('0x46')]?_0xe68787[_0xdbdf('0x33')]:_0x6617fd[_0xdbdf('0x2f')];if(_0x2cc894[_0xdbdf('0x30')]['includeAll']){_0xe68787[_0xdbdf('0x40')]=[{'all':!![]}];}_0xe68787=_[_0xdbdf('0x3b')]({},_0xe68787,_0x2cc894['options']);return db[_0xdbdf('0x41')][_0xdbdf('0x47')](_0xe68787)['then'](handleEntityNotFound(_0x57f5e4,null))[_0xdbdf('0x24')](respondWithResult(_0x57f5e4,null))['catch'](handleError(_0x57f5e4,null));};exports[_0xdbdf('0x48')]=function(_0x1e1e77,_0x530bbb){return db[_0xdbdf('0x41')][_0xdbdf('0x48')](_0x1e1e77['body'],{})['then'](respondWithResult(_0x530bbb,0xc9))[_0xdbdf('0x43')](handleError(_0x530bbb,null));};exports[_0xdbdf('0x49')]=function(_0x255b27,_0x3b62a6){if(_0x255b27[_0xdbdf('0x4a')]['id']){delete _0x255b27[_0xdbdf('0x4a')]['id'];}return db[_0xdbdf('0x41')][_0xdbdf('0x47')]({'where':{'id':_0x255b27[_0xdbdf('0x45')]['id']}})[_0xdbdf('0x24')](handleEntityNotFound(_0x3b62a6,null))[_0xdbdf('0x24')](saveUpdates(_0x255b27['body'],null))[_0xdbdf('0x24')](respondWithResult(_0x3b62a6,null))[_0xdbdf('0x43')](handleError(_0x3b62a6,null));};exports[_0xdbdf('0x23')]=function(_0x188dd8,_0x5ed79c){return db['SmsTransferReport'][_0xdbdf('0x47')]({'where':{'id':_0x188dd8['params']['id']}})[_0xdbdf('0x24')](handleEntityNotFound(_0x5ed79c,null))['then'](removeEntity(_0x5ed79c,null))['catch'](handleError(_0x5ed79c,null));};exports[_0xdbdf('0x4b')]=function(_0x119c5e,_0x16c21c){return db[_0xdbdf('0x41')][_0xdbdf('0x4b')]()[_0xdbdf('0x24')](respondWithResult(_0x16c21c,null))[_0xdbdf('0x43')](handleError(_0x16c21c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 535ffc0..ef99d56 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 _0x9364=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','SmsTransferReport'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x9364,0x141));var _0x4936=function(_0x2874bb,_0x4b1c29){_0x2874bb=_0x2874bb-0x0;var _0x3d6bfd=_0x9364[_0x2874bb];return _0x3d6bfd;};'use strict';var _=require(_0x4936('0x0'));var util=require(_0x4936('0x1'));var logger=require(_0x4936('0x2'))(_0x4936('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4936('0x4'));var rimraf=require(_0x4936('0x5'));var config=require(_0x4936('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x4936('0x7')]=function(_0x22d4c0,_0x16642c){return _0x22d4c0['define'](_0x4936('0x8'),attributes,{'tableName':_0x4936('0x9'),'paranoid':![],'indexes':[{'name':_0x4936('0xa'),'fields':[_0x4936('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbab0=['request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xbab0,0x183));var _0x0bab=function(_0xb3ea84,_0xc98643){_0xb3ea84=_0xb3ea84-0x0;var _0x4f0b9c=_0xbab0[_0xb3ea84];return _0x4f0b9c;};'use strict';var _=require(_0x0bab('0x0'));var util=require(_0x0bab('0x1'));var logger=require(_0x0bab('0x2'))(_0x0bab('0x3'));var moment=require('moment');var BPromise=require(_0x0bab('0x4'));var rp=require(_0x0bab('0x5'));var fs=require('fs');var path=require(_0x0bab('0x6'));var rimraf=require(_0x0bab('0x7'));var config=require(_0x0bab('0x8'));var attributes=require(_0x0bab('0x9'));module[_0x0bab('0xa')]=function(_0x1b513a,_0x22cb01){return _0x1b513a[_0x0bab('0xb')]('SmsTransferReport',attributes,{'tableName':_0x0bab('0xc'),'paranoid':![],'indexes':[{'name':_0x0bab('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 848720c..9bdced7 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x513b39,_0x1202e0){var _0x4e5f74=function(_0x10eeb8){while(--_0x10eeb8){_0x513b39['push'](_0x513b39['shift']());}};_0x4e5f74(++_0x1202e0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x95f4=['../../config/environment','jayson/promise','http','request','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','rpc'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0x95f4,0xf1));var _0x495f=function(_0x27e020,_0x2efbba){_0x27e020=_0x27e020-0x0;var _0x451e60=_0x95f4[_0x27e020];return _0x451e60;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var moment=require(_0x495f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x495f('0x3'));var db=require(_0x495f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x495f('0x5'));var config=require(_0x495f('0x6'));var jayson=require(_0x495f('0x7'));var client=jayson['client'][_0x495f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x435e2a,_0x304274,_0x4c17af){return new BPromise(function(_0x2103a4,_0x4610a7){return client[_0x495f('0x9')](_0x435e2a,_0x4c17af)['then'](function(_0x55dc23){logger[_0x495f('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x304274,_0x495f('0xb'));logger['debug'](_0x495f('0xc'),_0x304274,_0x495f('0xb'),JSON[_0x495f('0xd')](_0x55dc23));if(_0x55dc23[_0x495f('0xe')]){if(_0x55dc23['error'][_0x495f('0xf')]===0x1f4){logger[_0x495f('0xe')](_0x495f('0x10'),_0x304274,_0x55dc23[_0x495f('0xe')][_0x495f('0x11')]);return _0x4610a7(_0x55dc23['error'][_0x495f('0x11')]);}logger[_0x495f('0xe')](_0x495f('0x10'),_0x304274,_0x55dc23[_0x495f('0xe')][_0x495f('0x11')]);return _0x2103a4(_0x55dc23[_0x495f('0xe')][_0x495f('0x11')]);}else{logger['info'](_0x495f('0x10'),_0x304274,_0x495f('0xb'));_0x2103a4(_0x55dc23[_0x495f('0x12')][_0x495f('0x11')]);}})['catch'](function(_0x20f97c){logger[_0x495f('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x304274,_0x20f97c);_0x4610a7(_0x20f97c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 81eea40..2d00391 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 _0xe4c8=['/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','post','file','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','index','get','/:id','isAuthenticated','show'];(function(_0x3224fb,_0x29b100){var _0x2f9a63=function(_0x112aff){while(--_0x112aff){_0x3224fb['push'](_0x3224fb['shift']());}};_0x2f9a63(++_0x29b100);}(_0xe4c8,0x1c3));var _0x8e4c=function(_0x19ab0c,_0x5798c5){_0x19ab0c=_0x19ab0c-0x0;var _0x62d7b2=_0xe4c8[_0x19ab0c];return _0x62d7b2;};'use strict';var multer=require(_0x8e4c('0x0'));var util=require(_0x8e4c('0x1'));var path=require(_0x8e4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e4c('0x3'));var router=express[_0x8e4c('0x4')]();var fs_extra=require(_0x8e4c('0x5'));var auth=require(_0x8e4c('0x6'));var interaction=require(_0x8e4c('0x7'));var config=require('../../config/environment');var controller=require(_0x8e4c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8e4c('0x9')]);router[_0x8e4c('0xa')](_0x8e4c('0xb'),auth[_0x8e4c('0xc')](),controller[_0x8e4c('0xd')]);router[_0x8e4c('0xa')](_0x8e4c('0xe'),auth[_0x8e4c('0xc')](),controller[_0x8e4c('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2dea86,_0x5ee665,_0x209fca){_0x209fca(null,path[_0x8e4c('0x10')](config[_0x8e4c('0x11')],_0x8e4c('0x12')));},'filename':function(_0x3920ac,_0x270c72,_0x297359){_0x270c72[_0x8e4c('0x13')]=_0x270c72[_0x8e4c('0x13')][_0x8e4c('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x297359(null,util[_0x8e4c('0x15')](_0x8e4c('0x16'),path[_0x8e4c('0x17')](_0x270c72['originalname'],path['extname'](_0x270c72['originalname'])),Date[_0x8e4c('0x18')](),path['extname'](_0x270c72[_0x8e4c('0x13')])));}})});router[_0x8e4c('0x19')]('/',upload['single'](_0x8e4c('0x1a')),controller['create']);router[_0x8e4c('0x1b')](_0x8e4c('0xb'),auth['isAuthenticated'](),controller[_0x8e4c('0x1c')]);router[_0x8e4c('0x1d')]('/:id',auth[_0x8e4c('0xc')](),controller[_0x8e4c('0x1d')]);module[_0x8e4c('0x1e')]=router; \ No newline at end of file +var _0x40d0=['put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','create'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x40d0,0x14c));var _0x040d=function(_0x1f0a78,_0x54ae1f){_0x1f0a78=_0x1f0a78-0x0;var _0x2a706d=_0x40d0[_0x1f0a78];return _0x2a706d;};'use strict';var multer=require(_0x040d('0x0'));var util=require(_0x040d('0x1'));var path=require(_0x040d('0x2'));var timeout=require(_0x040d('0x3'));var express=require(_0x040d('0x4'));var router=express[_0x040d('0x5')]();var fs_extra=require(_0x040d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x040d('0x7'));var config=require('../../config/environment');var controller=require(_0x040d('0x8'));router[_0x040d('0x9')]('/',auth['isAuthenticated'](),controller[_0x040d('0xa')]);router[_0x040d('0x9')](_0x040d('0xb'),auth[_0x040d('0xc')](),controller['show']);router[_0x040d('0x9')](_0x040d('0xd'),auth[_0x040d('0xc')](),controller[_0x040d('0xe')]);var upload=multer({'storage':multer[_0x040d('0xf')]({'destination':function(_0x88f75d,_0x49df2c,_0x1d6735){_0x1d6735(null,path[_0x040d('0x10')](config[_0x040d('0x11')],_0x040d('0x12')));},'filename':function(_0x1c08e2,_0xdae78e,_0x1ac740){_0xdae78e['originalname']=_0xdae78e[_0x040d('0x13')][_0x040d('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ac740(null,util[_0x040d('0x15')]('%s-%s%s',path[_0x040d('0x16')](_0xdae78e[_0x040d('0x13')],path['extname'](_0xdae78e[_0x040d('0x13')])),Date['now'](),path[_0x040d('0x17')](_0xdae78e[_0x040d('0x13')])));}})});router[_0x040d('0x18')]('/',upload[_0x040d('0x19')](_0x040d('0x1a')),controller[_0x040d('0x1b')]);router[_0x040d('0x1c')](_0x040d('0xb'),auth[_0x040d('0xc')](),controller['update']);router['delete']('/:id',auth[_0x040d('0xc')](),controller[_0x040d('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index dbc5a45..cc0cd9f 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 _0xb51c=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x3a4c07,_0x18440c){var _0x5a4943=function(_0x4afb24){while(--_0x4afb24){_0x3a4c07['push'](_0x3a4c07['shift']());}};_0x5a4943(++_0x18440c);}(_0xb51c,0x1c5));var _0xcb51=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xb51c[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0xcb51('0x0'));module[_0xcb51('0x1')]={'name':{'type':Sequelize[_0xcb51('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xcb51('0x2')]},'display_name':{'type':Sequelize[_0xcb51('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xcb51('0x3')]},'original_sampleCount':{'type':Sequelize[_0xcb51('0x4')]},'original_channelCount':{'type':Sequelize[_0xcb51('0x5')]},'original_bitRate':{'type':Sequelize[_0xcb51('0x4')]},'original_sampleRate':{'type':Sequelize[_0xcb51('0x5')]},'converted_format':{'type':Sequelize[_0xcb51('0x2')]},'converted_duration':{'type':Sequelize[_0xcb51('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xcb51('0x4')]},'converted_channelCount':{'type':Sequelize[_0xcb51('0x5')]},'converted_bitRate':{'type':Sequelize[_0xcb51('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xcb51('0x5')]}}; \ No newline at end of file +var _0x7ddc=['FLOAT','BIGINT','INTEGER','sequelize','STRING','name'];(function(_0x292d18,_0x22b2da){var _0x5827df=function(_0x5eaa0b){while(--_0x5eaa0b){_0x292d18['push'](_0x292d18['shift']());}};_0x5827df(++_0x22b2da);}(_0x7ddc,0x81));var _0xc7dd=function(_0x1f5385,_0x31f05d){_0x1f5385=_0x1f5385-0x0;var _0x142607=_0x7ddc[_0x1f5385];return _0x142607;};'use strict';var Sequelize=require(_0xc7dd('0x0'));module['exports']={'name':{'type':Sequelize[_0xc7dd('0x1')],'unique':_0xc7dd('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc7dd('0x1')]},'display_name':{'type':Sequelize[_0xc7dd('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xc7dd('0x1')]},'original_duration':{'type':Sequelize[_0xc7dd('0x3')]},'original_sampleCount':{'type':Sequelize[_0xc7dd('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xc7dd('0x5')]},'converted_format':{'type':Sequelize[_0xc7dd('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xc7dd('0x4')]},'converted_channelCount':{'type':Sequelize[_0xc7dd('0x5')]},'converted_bitRate':{'type':Sequelize[_0xc7dd('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xc7dd('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6eb8d4b..b757593 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 _0x75e1=['download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','then','destroy','get','Sounds','UserProfileResource','error','stack','send','index','Sound','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find'];(function(_0x151762,_0x17691f){var _0x27f596=function(_0x4ca750){while(--_0x4ca750){_0x151762['push'](_0x151762['shift']());}};_0x27f596(++_0x17691f);}(_0x75e1,0x1b7));var _0x175e=function(_0x4ee881,_0x10ddc8){_0x4ee881=_0x4ee881-0x0;var _0x305f48=_0x75e1[_0x4ee881];return _0x305f48;};'use strict';var emlformat=require(_0x175e('0x0'));var rimraf=require(_0x175e('0x1'));var zipdir=require(_0x175e('0x2'));var jsonpatch=require(_0x175e('0x3'));var rp=require(_0x175e('0x4'));var moment=require(_0x175e('0x5'));var BPromise=require(_0x175e('0x6'));var Mustache=require(_0x175e('0x7'));var util=require(_0x175e('0x8'));var path=require(_0x175e('0x9'));var sox=require(_0x175e('0xa'));var csv=require(_0x175e('0xb'));var ejs=require(_0x175e('0xc'));var fs=require('fs');var fs_extra=require(_0x175e('0xd'));var _=require(_0x175e('0xe'));var squel=require(_0x175e('0xf'));var crypto=require(_0x175e('0x10'));var jsforce=require(_0x175e('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x175e('0xb'));var querystring=require(_0x175e('0x12'));var Papa=require(_0x175e('0x13'));var Redis=require('ioredis');var authService=require(_0x175e('0x14'));var qs=require(_0x175e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x175e('0x16'));var utils=require(_0x175e('0x17'));var config=require(_0x175e('0x18'));var licenseUtil=require(_0x175e('0x19'));var db=require(_0x175e('0x1a'))['db'];function respondWithStatusCode(_0x2a4b86,_0x58a4b7){_0x58a4b7=_0x58a4b7||0xcc;return function(_0x3fca83){if(_0x3fca83){return _0x2a4b86[_0x175e('0x1b')](_0x58a4b7);}return _0x2a4b86[_0x175e('0x1c')](_0x58a4b7)[_0x175e('0x1d')]();};}function respondWithResult(_0x578c35,_0x1fcbcf){_0x1fcbcf=_0x1fcbcf||0xc8;return function(_0x207fbd){if(_0x207fbd){return _0x578c35[_0x175e('0x1c')](_0x1fcbcf)[_0x175e('0x1e')](_0x207fbd);}};}function respondWithFilteredResult(_0x56579e,_0x23b212){return function(_0x3069f5){if(_0x3069f5){var _0x3dfb4c=typeof _0x23b212['offset']==='undefined'&&typeof _0x23b212['limit']===_0x175e('0x1f');var _0x32be50=_0x3069f5[_0x175e('0x20')];var _0x5467d8=_0x3dfb4c?0x0:_0x23b212[_0x175e('0x21')];var _0x434df1=_0x3dfb4c?_0x3069f5['count']:_0x23b212[_0x175e('0x21')]+_0x23b212[_0x175e('0x22')];var _0x3b3f57;if(_0x434df1>=_0x32be50){_0x434df1=_0x32be50;_0x3b3f57=0xc8;}else{_0x3b3f57=0xce;}_0x56579e[_0x175e('0x1c')](_0x3b3f57);return _0x56579e['set'](_0x175e('0x23'),_0x5467d8+'-'+_0x434df1+'/'+_0x32be50)[_0x175e('0x1e')](_0x3069f5);}return null;};}function patchUpdates(_0x4b3616){return function(_0x57169f){try{jsonpatch[_0x175e('0x24')](_0x57169f,_0x4b3616,!![]);}catch(_0x45d638){return BPromise[_0x175e('0x25')](_0x45d638);}return _0x57169f['save']();};}function saveUpdates(_0x2b35d5,_0x1692a3){return function(_0x12a0f9){if(_0x12a0f9){return _0x12a0f9['update'](_0x2b35d5)[_0x175e('0x26')](function(_0x2710f8){return _0x2710f8;});}return null;};}function removeEntity(_0x33287b,_0xf8c3d6){return function(_0x3ecd8f){if(_0x3ecd8f){return _0x3ecd8f[_0x175e('0x27')]()[_0x175e('0x26')](function(){var _0x3df812=_0x3ecd8f[_0x175e('0x28')]({'plain':!![]});var _0x1f781e=_0x175e('0x29');return db[_0x175e('0x2a')]['destroy']({'where':{'type':_0x1f781e,'resourceId':_0x3df812['id']}})[_0x175e('0x26')](function(){return _0x3ecd8f;});})['then'](function(){_0x33287b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16f80d,_0x37d080){return function(_0x475814){if(!_0x475814){_0x16f80d['sendStatus'](0x194);}return _0x475814;};}function handleError(_0x1cc38c,_0x5384d4){_0x5384d4=_0x5384d4||0x1f4;return function(_0x5c7441){logger[_0x175e('0x2b')](_0x5c7441[_0x175e('0x2c')]);if(_0x5c7441['name']){delete _0x5c7441['name'];}_0x1cc38c[_0x175e('0x1c')](_0x5384d4)[_0x175e('0x2d')](_0x5c7441);};}exports[_0x175e('0x2e')]=function(_0x3af968,_0x420dcc){var _0x3db183={},_0x432206={},_0x14390b={'count':0x0,'rows':[]};var _0x421ee3=_['map'](db[_0x175e('0x2f')]['rawAttributes'],function(_0x4c9259){return{'name':_0x4c9259['fieldName'],'type':_0x4c9259[_0x175e('0x30')]['key']};});_0x432206[_0x175e('0x31')]=_['map'](_0x421ee3,_0x175e('0x32'));_0x432206[_0x175e('0x33')]=_[_0x175e('0x34')](_0x3af968[_0x175e('0x33')]);_0x432206[_0x175e('0x35')]=_[_0x175e('0x36')](_0x432206[_0x175e('0x31')],_0x432206['query']);_0x3db183['attributes']=_[_0x175e('0x36')](_0x432206[_0x175e('0x31')],qs[_0x175e('0x37')](_0x3af968[_0x175e('0x33')][_0x175e('0x37')]));_0x3db183[_0x175e('0x38')]=_0x3db183[_0x175e('0x38')][_0x175e('0x39')]?_0x3db183[_0x175e('0x38')]:_0x432206[_0x175e('0x31')];if(!_0x3af968[_0x175e('0x33')][_0x175e('0x3a')](_0x175e('0x3b'))){_0x3db183[_0x175e('0x22')]=qs[_0x175e('0x22')](_0x3af968[_0x175e('0x33')][_0x175e('0x22')]);_0x3db183['offset']=qs[_0x175e('0x21')](_0x3af968[_0x175e('0x33')][_0x175e('0x21')]);}_0x3db183[_0x175e('0x3c')]=qs[_0x175e('0x3d')](_0x3af968['query'][_0x175e('0x3d')]);_0x3db183['where']=qs[_0x175e('0x35')](_[_0x175e('0x3e')](_0x3af968[_0x175e('0x33')],_0x432206['filters']),_0x421ee3);if(_0x3af968[_0x175e('0x33')][_0x175e('0x3f')]){_0x3db183[_0x175e('0x40')]=_[_0x175e('0x41')](_0x3db183[_0x175e('0x40')],{'$or':_[_0x175e('0x42')](_0x421ee3,function(_0x28fdd2){if(_0x28fdd2[_0x175e('0x30')]!==_0x175e('0x43')){var _0x1b0f73={};_0x1b0f73[_0x28fdd2[_0x175e('0x32')]]={'$like':'%'+_0x3af968['query'][_0x175e('0x3f')]+'%'};return _0x1b0f73;}})});}_0x3db183=_[_0x175e('0x41')]({},_0x3db183,_0x3af968[_0x175e('0x44')]);var _0x5bc0d1={'where':_0x3db183[_0x175e('0x40')]};return db[_0x175e('0x2f')]['count'](_0x5bc0d1)[_0x175e('0x26')](function(_0x1ac3bc){_0x14390b[_0x175e('0x20')]=_0x1ac3bc;if(_0x3af968[_0x175e('0x33')][_0x175e('0x45')]){_0x3db183['include']=[{'all':!![]}];}return db['Sound'][_0x175e('0x46')](_0x3db183);})[_0x175e('0x26')](function(_0xd36ad1){_0x14390b[_0x175e('0x47')]=_0xd36ad1;return _0x14390b;})[_0x175e('0x26')](respondWithFilteredResult(_0x420dcc,_0x3db183))[_0x175e('0x48')](handleError(_0x420dcc,null));};exports['show']=function(_0x3b1271,_0x58e4d1){var _0x3097bf={'raw':!![],'where':{'id':_0x3b1271[_0x175e('0x49')]['id']}},_0x2bd1ee={};_0x2bd1ee[_0x175e('0x31')]=_[_0x175e('0x34')](db[_0x175e('0x2f')][_0x175e('0x4a')]);_0x2bd1ee[_0x175e('0x33')]=_[_0x175e('0x34')](_0x3b1271[_0x175e('0x33')]);_0x2bd1ee[_0x175e('0x35')]=_[_0x175e('0x36')](_0x2bd1ee[_0x175e('0x31')],_0x2bd1ee[_0x175e('0x33')]);_0x3097bf[_0x175e('0x38')]=_[_0x175e('0x36')](_0x2bd1ee[_0x175e('0x31')],qs[_0x175e('0x37')](_0x3b1271[_0x175e('0x33')][_0x175e('0x37')]));_0x3097bf[_0x175e('0x38')]=_0x3097bf[_0x175e('0x38')][_0x175e('0x39')]?_0x3097bf[_0x175e('0x38')]:_0x2bd1ee['model'];if(_0x3b1271[_0x175e('0x33')]['includeAll']){_0x3097bf[_0x175e('0x4b')]=[{'all':!![]}];}_0x3097bf=_[_0x175e('0x41')]({},_0x3097bf,_0x3b1271[_0x175e('0x44')]);return db['Sound'][_0x175e('0x4c')](_0x3097bf)[_0x175e('0x26')](handleEntityNotFound(_0x58e4d1,null))[_0x175e('0x26')](respondWithResult(_0x58e4d1,null))[_0x175e('0x48')](handleError(_0x58e4d1,null));};exports[_0x175e('0x4d')]=function(_0x3af412,_0x1dabc5,_0xe2c1b2){return db[_0x175e('0x2f')]['find']({'where':{'id':_0x3af412['params']['id']},'attributes':[_0x175e('0x32'),'save_name',_0x175e('0x4e')],'raw':!![]})[_0x175e('0x26')](handleEntityNotFound(_0x1dabc5,null))[_0x175e('0x26')](function(_0x1ad704){if(_0x1ad704){if(!fs[_0x175e('0x4f')](path[_0x175e('0x50')](config[_0x175e('0x51')],_0x175e('0x52'),_0x1ad704[_0x175e('0x53')]+'.'+_0x1ad704[_0x175e('0x4e')]))){throw new db[(_0x175e('0x54'))][(_0x175e('0x55'))](_0x175e('0x56'));}return _0x1dabc5[_0x175e('0x4d')](path[_0x175e('0x50')](config['root'],_0x175e('0x52'),util[_0x175e('0x57')](_0x175e('0x58'),_0x1ad704[_0x175e('0x53')],_0x1ad704['converted_format'])),util['format'](_0x175e('0x58'),_0x1ad704[_0x175e('0x32')],_0x1ad704['converted_format']));}return null;})['catch'](handleError(_0x1dabc5,null));};exports['create']=function(_0x209ef3,_0x4f064f,_0x4bfe65){var _0x1a83d1={'name':path[_0x175e('0x59')](_0x209ef3[_0x175e('0x5a')][_0x175e('0x5b')],path[_0x175e('0x5c')](_0x209ef3[_0x175e('0x5a')]['originalname'])),'save_name':path[_0x175e('0x59')](_0x209ef3[_0x175e('0x5a')][_0x175e('0x5d')],path['extname'](_0x209ef3[_0x175e('0x5a')][_0x175e('0x5d')])),'original_format':path[_0x175e('0x5c')](_0x209ef3[_0x175e('0x5a')][_0x175e('0x5b')])[_0x175e('0x5e')](0x1),'converted_format':_0x175e('0x5f')};var _0x3c39d7=path[_0x175e('0x50')](config['root'],_0x175e('0x60'),_0x209ef3[_0x175e('0x5a')][_0x175e('0x5d')]);var _0x42c780=path[_0x175e('0x50')](config[_0x175e('0x51')],'server/files/sounds/converted',util[_0x175e('0x57')](_0x175e('0x58'),path[_0x175e('0x59')](_0x209ef3['file'][_0x175e('0x5d')],path[_0x175e('0x5c')](_0x209ef3['file'][_0x175e('0x5d')])),_0x1a83d1[_0x175e('0x4e')]));logger['info'](_0x175e('0x61'),_0x3c39d7);logger[_0x175e('0x62')](_0x175e('0x63'),_0x42c780);try{fs[_0x175e('0x64')](_0x3c39d7,parseInt('0777',0x8));var _0x6d3e26=sox['transcode'](_0x3c39d7,_0x42c780,{'sampleRate':0x1f40,'format':_0x175e('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6d3e26['on'](_0x175e('0x2b'),function(_0xaf89f3){fs[_0x175e('0x65')](_0x3c39d7);_0x4f064f['status'](0x1f4)[_0x175e('0x2d')](_0xaf89f3);});_0x6d3e26['on'](_0x175e('0x66'),function(_0x10be55){_0x1a83d1[_0x175e('0x67')]=isNaN(_0x10be55[_0x175e('0x68')])?null:_0x10be55[_0x175e('0x68')]*0x3e8;_0x1a83d1[_0x175e('0x69')]=isNaN(_0x10be55[_0x175e('0x6a')])?null:_0x10be55[_0x175e('0x6a')];_0x1a83d1[_0x175e('0x6b')]=isNaN(_0x10be55['channelCount'])?null:_0x10be55[_0x175e('0x6c')];_0x1a83d1[_0x175e('0x6d')]=isNaN(_0x10be55[_0x175e('0x6e')])?null:_0x10be55['bitRate'];_0x1a83d1['original_sampleRate']=isNaN(_0x10be55['sampleRate'])?null:_0x10be55[_0x175e('0x6f')];});_0x6d3e26['on'](_0x175e('0x70'),function(_0x186d63){_0x1a83d1[_0x175e('0x71')]=isNaN(_0x186d63[_0x175e('0x68')])?null:_0x186d63[_0x175e('0x68')]*0x3e8;_0x1a83d1[_0x175e('0x72')]=isNaN(_0x186d63['sampleCount'])?null:_0x186d63[_0x175e('0x6a')];_0x1a83d1[_0x175e('0x73')]=isNaN(_0x186d63[_0x175e('0x6c')])?null:_0x186d63[_0x175e('0x6c')];_0x1a83d1[_0x175e('0x74')]=isNaN(_0x186d63[_0x175e('0x6e')])?null:_0x186d63[_0x175e('0x6e')];_0x1a83d1[_0x175e('0x75')]=isNaN(_0x186d63[_0x175e('0x6f')])?null:_0x186d63[_0x175e('0x6f')];});_0x6d3e26['on']('end',function(){fs[_0x175e('0x64')](_0x42c780,parseInt('0777',0x8));return db[_0x175e('0x2f')][_0x175e('0x76')](_0x1a83d1)[_0x175e('0x26')](function(_0x48799f){var _0xe4597a={'role':_0x209ef3['body'][_0x175e('0x77')],'userProfileId':_0x209ef3[_0x175e('0x78')][_0x175e('0x79')]};if(!_0xe4597a)throw new Error(_0x175e('0x7a'));if(_0xe4597a[_0x175e('0x77')]===_0x175e('0x7b')){var _0x5e607d=_0x48799f[_0x175e('0x28')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Sounds','userProfileId':_0xe4597a['userProfileId']},'raw':!![]})['then'](function(_0x416df9){if(_0x416df9&&_0x416df9[_0x175e('0x7c')]===0x0){return db[_0x175e('0x2a')][_0x175e('0x76')]({'name':_0x5e607d['name'],'resourceId':_0x5e607d['id'],'type':_0x416df9[_0x175e('0x32')],'sectionId':_0x416df9['id']},{})[_0x175e('0x26')](function(){return _0x48799f;});}else{return _0x48799f;}})[_0x175e('0x48')](function(_0x43443a){logger[_0x175e('0x2b')](_0x175e('0x7d'),_0x43443a);throw _0x43443a;});}return _0x48799f;})[_0x175e('0x26')](respondWithResult(_0x4f064f,null))[_0x175e('0x48')](handleError(_0x4f064f,null));});_0x6d3e26[_0x175e('0x7e')]();}catch(_0x434632){_0x4f064f['status'](0x1f4)[_0x175e('0x2d')](_0x434632);}};exports['update']=function(_0x366e87,_0x2ed4a4,_0x1a6282){return db[_0x175e('0x2f')]['find']({'where':{'id':_0x366e87[_0x175e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ed4a4,null))[_0x175e('0x26')](saveUpdates(_['pick'](_0x366e87[_0x175e('0x78')],[_0x175e('0x32'),_0x175e('0x7f')]),null))[_0x175e('0x26')](respondWithResult(_0x2ed4a4,null))[_0x175e('0x48')](handleError(_0x2ed4a4,null));};exports['delete']=function(_0x4ecad1,_0x448ae4,_0x5c5b04){return db[_0x175e('0x2f')][_0x175e('0x4c')]({'where':{'id':_0x4ecad1[_0x175e('0x49')]['id']}})[_0x175e('0x26')](function(_0x5dbfcb){if(_0x5dbfcb){return _0x5dbfcb['destroy']();}})[_0x175e('0x26')](function(_0xcbf2d6){var _0x208835=path[_0x175e('0x50')](config['root'],'server/files/sounds/original',util[_0x175e('0x57')]('%s.%s',_0xcbf2d6['save_name'],_0xcbf2d6[_0x175e('0x80')]));var _0x8f22a6=path[_0x175e('0x50')](config[_0x175e('0x51')],_0x175e('0x52'),util[_0x175e('0x57')](_0x175e('0x58'),_0xcbf2d6[_0x175e('0x53')],_0xcbf2d6[_0x175e('0x4e')]));fs[_0x175e('0x65')](_0x208835);fs[_0x175e('0x65')](_0x8f22a6);return _0xcbf2d6;})['then'](function(_0x3ccaf9){if(_0x3ccaf9){return _0x448ae4[_0x175e('0x1c')](0xcc)[_0x175e('0x1d')]();}})[_0x175e('0x26')](handleEntityNotFound(_0x448ae4,null))[_0x175e('0x48')](handleError(_0x448ae4,null));}; \ No newline at end of file +var _0xed8a=['undefined','count','set','apply','reject','save','destroy','then','get','UserProfileResource','error','name','send','index','map','Sound','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','join','%s.%s','format','create','basename','originalname','extname','file','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','eml-format','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit'];(function(_0x4a3f08,_0x4d5c89){var _0x45c48f=function(_0x47bebd){while(--_0x47bebd){_0x4a3f08['push'](_0x4a3f08['shift']());}};_0x45c48f(++_0x4d5c89);}(_0xed8a,0xdd));var _0xaed8=function(_0x480900,_0x556527){_0x480900=_0x480900-0x0;var _0x14900f=_0xed8a[_0x480900];return _0x14900f;};'use strict';var emlformat=require(_0xaed8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaed8('0x1'));var rp=require(_0xaed8('0x2'));var moment=require(_0xaed8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaed8('0x4'));var util=require('util');var path=require('path');var sox=require(_0xaed8('0x5'));var csv=require(_0xaed8('0x6'));var ejs=require(_0xaed8('0x7'));var fs=require('fs');var fs_extra=require(_0xaed8('0x8'));var _=require(_0xaed8('0x9'));var squel=require(_0xaed8('0xa'));var crypto=require(_0xaed8('0xb'));var jsforce=require(_0xaed8('0xc'));var deskjs=require(_0xaed8('0xd'));var toCsv=require(_0xaed8('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaed8('0xe'));var authService=require(_0xaed8('0xf'));var qs=require(_0xaed8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaed8('0x11'));var logger=require(_0xaed8('0x12'))('api');var utils=require(_0xaed8('0x13'));var config=require(_0xaed8('0x14'));var licenseUtil=require(_0xaed8('0x15'));var db=require(_0xaed8('0x16'))['db'];function respondWithStatusCode(_0x223966,_0x9f45d1){_0x9f45d1=_0x9f45d1||0xcc;return function(_0x593eab){if(_0x593eab){return _0x223966[_0xaed8('0x17')](_0x9f45d1);}return _0x223966['status'](_0x9f45d1)[_0xaed8('0x18')]();};}function respondWithResult(_0x5aaa12,_0x159fd1){_0x159fd1=_0x159fd1||0xc8;return function(_0x47c5e6){if(_0x47c5e6){return _0x5aaa12[_0xaed8('0x19')](_0x159fd1)[_0xaed8('0x1a')](_0x47c5e6);}};}function respondWithFilteredResult(_0x36f0e6,_0x19fce8){return function(_0x235cfd){if(_0x235cfd){var _0x1fbc83=typeof _0x19fce8[_0xaed8('0x1b')]==='undefined'&&typeof _0x19fce8[_0xaed8('0x1c')]===_0xaed8('0x1d');var _0x1f850a=_0x235cfd[_0xaed8('0x1e')];var _0x2ed8df=_0x1fbc83?0x0:_0x19fce8['offset'];var _0x46d826=_0x1fbc83?_0x235cfd[_0xaed8('0x1e')]:_0x19fce8[_0xaed8('0x1b')]+_0x19fce8[_0xaed8('0x1c')];var _0x3e0cb7;if(_0x46d826>=_0x1f850a){_0x46d826=_0x1f850a;_0x3e0cb7=0xc8;}else{_0x3e0cb7=0xce;}_0x36f0e6[_0xaed8('0x19')](_0x3e0cb7);return _0x36f0e6[_0xaed8('0x1f')]('Content-Range',_0x2ed8df+'-'+_0x46d826+'/'+_0x1f850a)['json'](_0x235cfd);}return null;};}function patchUpdates(_0x3bc078){return function(_0x4d86b6){try{jsonpatch[_0xaed8('0x20')](_0x4d86b6,_0x3bc078,!![]);}catch(_0x4379f5){return BPromise[_0xaed8('0x21')](_0x4379f5);}return _0x4d86b6[_0xaed8('0x22')]();};}function saveUpdates(_0x1f0bfd,_0x4364fa){return function(_0x1e2c40){if(_0x1e2c40){return _0x1e2c40['update'](_0x1f0bfd)['then'](function(_0x33d23c){return _0x33d23c;});}return null;};}function removeEntity(_0x18fdc6,_0x43afdf){return function(_0x1c581f){if(_0x1c581f){return _0x1c581f[_0xaed8('0x23')]()[_0xaed8('0x24')](function(){var _0x41db53=_0x1c581f[_0xaed8('0x25')]({'plain':!![]});var _0x42a466='Sounds';return db[_0xaed8('0x26')]['destroy']({'where':{'type':_0x42a466,'resourceId':_0x41db53['id']}})[_0xaed8('0x24')](function(){return _0x1c581f;});})[_0xaed8('0x24')](function(){_0x18fdc6[_0xaed8('0x19')](0xcc)[_0xaed8('0x18')]();});}};}function handleEntityNotFound(_0x34794d,_0x3bbae3){return function(_0x2d6fb4){if(!_0x2d6fb4){_0x34794d[_0xaed8('0x17')](0x194);}return _0x2d6fb4;};}function handleError(_0x382f70,_0x214e69){_0x214e69=_0x214e69||0x1f4;return function(_0x311f5b){logger[_0xaed8('0x27')](_0x311f5b['stack']);if(_0x311f5b[_0xaed8('0x28')]){delete _0x311f5b['name'];}_0x382f70[_0xaed8('0x19')](_0x214e69)[_0xaed8('0x29')](_0x311f5b);};}exports[_0xaed8('0x2a')]=function(_0x3d71a9,_0x3912d9){var _0x51f300={},_0x361f3c={},_0x7f5afc={'count':0x0,'rows':[]};var _0x397278=_[_0xaed8('0x2b')](db[_0xaed8('0x2c')][_0xaed8('0x2d')],function(_0x1a9da3){return{'name':_0x1a9da3[_0xaed8('0x2e')],'type':_0x1a9da3[_0xaed8('0x2f')]['key']};});_0x361f3c['model']=_['map'](_0x397278,_0xaed8('0x28'));_0x361f3c['query']=_['keys'](_0x3d71a9[_0xaed8('0x30')]);_0x361f3c[_0xaed8('0x31')]=_['intersection'](_0x361f3c[_0xaed8('0x32')],_0x361f3c[_0xaed8('0x30')]);_0x51f300[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x361f3c[_0xaed8('0x32')],qs[_0xaed8('0x35')](_0x3d71a9[_0xaed8('0x30')][_0xaed8('0x35')]));_0x51f300[_0xaed8('0x33')]=_0x51f300['attributes'][_0xaed8('0x36')]?_0x51f300[_0xaed8('0x33')]:_0x361f3c[_0xaed8('0x32')];if(!_0x3d71a9[_0xaed8('0x30')][_0xaed8('0x37')](_0xaed8('0x38'))){_0x51f300[_0xaed8('0x1c')]=qs[_0xaed8('0x1c')](_0x3d71a9[_0xaed8('0x30')][_0xaed8('0x1c')]);_0x51f300[_0xaed8('0x1b')]=qs[_0xaed8('0x1b')](_0x3d71a9[_0xaed8('0x30')]['offset']);}_0x51f300['order']=qs[_0xaed8('0x39')](_0x3d71a9[_0xaed8('0x30')][_0xaed8('0x39')]);_0x51f300[_0xaed8('0x3a')]=qs['filters'](_[_0xaed8('0x3b')](_0x3d71a9['query'],_0x361f3c['filters']),_0x397278);if(_0x3d71a9['query']['filter']){_0x51f300[_0xaed8('0x3a')]=_[_0xaed8('0x3c')](_0x51f300[_0xaed8('0x3a')],{'$or':_[_0xaed8('0x2b')](_0x397278,function(_0x14d651){if(_0x14d651[_0xaed8('0x2f')]!==_0xaed8('0x3d')){var _0x5812e9={};_0x5812e9[_0x14d651[_0xaed8('0x28')]]={'$like':'%'+_0x3d71a9[_0xaed8('0x30')][_0xaed8('0x3e')]+'%'};return _0x5812e9;}})});}_0x51f300=_[_0xaed8('0x3c')]({},_0x51f300,_0x3d71a9[_0xaed8('0x3f')]);var _0x1c4ec6={'where':_0x51f300[_0xaed8('0x3a')]};return db[_0xaed8('0x2c')][_0xaed8('0x1e')](_0x1c4ec6)[_0xaed8('0x24')](function(_0x595398){_0x7f5afc[_0xaed8('0x1e')]=_0x595398;if(_0x3d71a9['query'][_0xaed8('0x40')]){_0x51f300['include']=[{'all':!![]}];}return db[_0xaed8('0x2c')][_0xaed8('0x41')](_0x51f300);})['then'](function(_0xb8be95){_0x7f5afc[_0xaed8('0x42')]=_0xb8be95;return _0x7f5afc;})[_0xaed8('0x24')](respondWithFilteredResult(_0x3912d9,_0x51f300))['catch'](handleError(_0x3912d9,null));};exports[_0xaed8('0x43')]=function(_0x293fdb,_0x1cd462){var _0x11af12={'raw':!![],'where':{'id':_0x293fdb[_0xaed8('0x44')]['id']}},_0x1d9457={};_0x1d9457[_0xaed8('0x32')]=_[_0xaed8('0x45')](db[_0xaed8('0x2c')]['rawAttributes']);_0x1d9457[_0xaed8('0x30')]=_['keys'](_0x293fdb[_0xaed8('0x30')]);_0x1d9457[_0xaed8('0x31')]=_[_0xaed8('0x34')](_0x1d9457[_0xaed8('0x32')],_0x1d9457[_0xaed8('0x30')]);_0x11af12['attributes']=_[_0xaed8('0x34')](_0x1d9457[_0xaed8('0x32')],qs[_0xaed8('0x35')](_0x293fdb['query']['fields']));_0x11af12[_0xaed8('0x33')]=_0x11af12[_0xaed8('0x33')][_0xaed8('0x36')]?_0x11af12[_0xaed8('0x33')]:_0x1d9457[_0xaed8('0x32')];if(_0x293fdb[_0xaed8('0x30')]['includeAll']){_0x11af12[_0xaed8('0x46')]=[{'all':!![]}];}_0x11af12=_[_0xaed8('0x3c')]({},_0x11af12,_0x293fdb[_0xaed8('0x3f')]);return db['Sound'][_0xaed8('0x47')](_0x11af12)[_0xaed8('0x24')](handleEntityNotFound(_0x1cd462,null))['then'](respondWithResult(_0x1cd462,null))[_0xaed8('0x48')](handleError(_0x1cd462,null));};exports[_0xaed8('0x49')]=function(_0x13dc90,_0x14f171,_0x524e2f){return db[_0xaed8('0x2c')][_0xaed8('0x47')]({'where':{'id':_0x13dc90[_0xaed8('0x44')]['id']},'attributes':['name',_0xaed8('0x4a'),_0xaed8('0x4b')],'raw':!![]})[_0xaed8('0x24')](handleEntityNotFound(_0x14f171,null))['then'](function(_0x5dc3f7){if(_0x5dc3f7){if(!fs[_0xaed8('0x4c')](path['join'](config[_0xaed8('0x4d')],_0xaed8('0x4e'),_0x5dc3f7[_0xaed8('0x4a')]+'.'+_0x5dc3f7['converted_format']))){throw new db['Sequelize'][(_0xaed8('0x4f'))](_0xaed8('0x50'));}return _0x14f171[_0xaed8('0x49')](path[_0xaed8('0x51')](config[_0xaed8('0x4d')],_0xaed8('0x4e'),util['format'](_0xaed8('0x52'),_0x5dc3f7[_0xaed8('0x4a')],_0x5dc3f7[_0xaed8('0x4b')])),util[_0xaed8('0x53')]('%s.%s',_0x5dc3f7[_0xaed8('0x28')],_0x5dc3f7['converted_format']));}return null;})[_0xaed8('0x48')](handleError(_0x14f171,null));};exports[_0xaed8('0x54')]=function(_0x35c5eb,_0x284f38,_0x46b688){var _0x5386e3={'name':path[_0xaed8('0x55')](_0x35c5eb['file'][_0xaed8('0x56')],path[_0xaed8('0x57')](_0x35c5eb[_0xaed8('0x58')][_0xaed8('0x56')])),'save_name':path[_0xaed8('0x55')](_0x35c5eb[_0xaed8('0x58')][_0xaed8('0x59')],path['extname'](_0x35c5eb[_0xaed8('0x58')][_0xaed8('0x59')])),'original_format':path[_0xaed8('0x57')](_0x35c5eb[_0xaed8('0x58')][_0xaed8('0x56')])[_0xaed8('0x5a')](0x1),'converted_format':'wav'};var _0x5592ab=path[_0xaed8('0x51')](config[_0xaed8('0x4d')],_0xaed8('0x5b'),_0x35c5eb[_0xaed8('0x58')][_0xaed8('0x59')]);var _0x582852=path['join'](config[_0xaed8('0x4d')],_0xaed8('0x4e'),util[_0xaed8('0x53')]('%s.%s',path['basename'](_0x35c5eb['file'][_0xaed8('0x59')],path[_0xaed8('0x57')](_0x35c5eb[_0xaed8('0x58')][_0xaed8('0x59')])),_0x5386e3['converted_format']));logger[_0xaed8('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x5592ab);logger[_0xaed8('0x5c')](_0xaed8('0x5d'),_0x582852);try{fs[_0xaed8('0x5e')](_0x5592ab,parseInt(_0xaed8('0x5f'),0x8));var _0xe317f0=sox[_0xaed8('0x60')](_0x5592ab,_0x582852,{'sampleRate':0x1f40,'format':_0xaed8('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xe317f0['on'](_0xaed8('0x27'),function(_0x1d62e6){fs[_0xaed8('0x62')](_0x5592ab);_0x284f38[_0xaed8('0x19')](0x1f4)[_0xaed8('0x29')](_0x1d62e6);});_0xe317f0['on'](_0xaed8('0x63'),function(_0x4229c9){_0x5386e3[_0xaed8('0x64')]=isNaN(_0x4229c9[_0xaed8('0x65')])?null:_0x4229c9[_0xaed8('0x65')]*0x3e8;_0x5386e3[_0xaed8('0x66')]=isNaN(_0x4229c9[_0xaed8('0x67')])?null:_0x4229c9[_0xaed8('0x67')];_0x5386e3[_0xaed8('0x68')]=isNaN(_0x4229c9[_0xaed8('0x69')])?null:_0x4229c9['channelCount'];_0x5386e3[_0xaed8('0x6a')]=isNaN(_0x4229c9['bitRate'])?null:_0x4229c9[_0xaed8('0x6b')];_0x5386e3[_0xaed8('0x6c')]=isNaN(_0x4229c9[_0xaed8('0x6d')])?null:_0x4229c9[_0xaed8('0x6d')];});_0xe317f0['on'](_0xaed8('0x6e'),function(_0x392907){_0x5386e3[_0xaed8('0x6f')]=isNaN(_0x392907['duration'])?null:_0x392907[_0xaed8('0x65')]*0x3e8;_0x5386e3['converted_sampleCount']=isNaN(_0x392907[_0xaed8('0x67')])?null:_0x392907[_0xaed8('0x67')];_0x5386e3[_0xaed8('0x70')]=isNaN(_0x392907[_0xaed8('0x69')])?null:_0x392907[_0xaed8('0x69')];_0x5386e3[_0xaed8('0x71')]=isNaN(_0x392907[_0xaed8('0x6b')])?null:_0x392907[_0xaed8('0x6b')];_0x5386e3[_0xaed8('0x72')]=isNaN(_0x392907[_0xaed8('0x6d')])?null:_0x392907[_0xaed8('0x6d')];});_0xe317f0['on'](_0xaed8('0x18'),function(){fs[_0xaed8('0x5e')](_0x582852,parseInt('0777',0x8));return db['Sound'][_0xaed8('0x54')](_0x5386e3)[_0xaed8('0x24')](function(_0x4d9a57){var _0x356d4d={'role':_0x35c5eb[_0xaed8('0x73')][_0xaed8('0x74')],'userProfileId':_0x35c5eb[_0xaed8('0x73')][_0xaed8('0x75')]};if(!_0x356d4d)throw new Error(_0xaed8('0x76'));if(_0x356d4d[_0xaed8('0x74')]==='user'){var _0x841fe6=_0x4d9a57[_0xaed8('0x25')]({'plain':!![]});return db[_0xaed8('0x77')][_0xaed8('0x47')]({'where':{'name':_0xaed8('0x78'),'userProfileId':_0x356d4d[_0xaed8('0x75')]},'raw':!![]})['then'](function(_0x281587){if(_0x281587&&_0x281587[_0xaed8('0x79')]===0x0){return db[_0xaed8('0x26')][_0xaed8('0x54')]({'name':_0x841fe6['name'],'resourceId':_0x841fe6['id'],'type':_0x281587[_0xaed8('0x28')],'sectionId':_0x281587['id']},{})['then'](function(){return _0x4d9a57;});}else{return _0x4d9a57;}})[_0xaed8('0x48')](function(_0x4507a9){logger[_0xaed8('0x27')](_0xaed8('0x7a'),_0x4507a9);throw _0x4507a9;});}return _0x4d9a57;})['then'](respondWithResult(_0x284f38,null))[_0xaed8('0x48')](handleError(_0x284f38,null));});_0xe317f0['start']();}catch(_0x9ff51b){_0x284f38['status'](0x1f4)['send'](_0x9ff51b);}};exports[_0xaed8('0x7b')]=function(_0x5b7af0,_0x546f0a,_0x400d08){return db['Sound']['find']({'where':{'id':_0x5b7af0['params']['id']}})[_0xaed8('0x24')](handleEntityNotFound(_0x546f0a,null))[_0xaed8('0x24')](saveUpdates(_[_0xaed8('0x3b')](_0x5b7af0[_0xaed8('0x73')],['name',_0xaed8('0x7c')]),null))[_0xaed8('0x24')](respondWithResult(_0x546f0a,null))[_0xaed8('0x48')](handleError(_0x546f0a,null));};exports['delete']=function(_0x4401af,_0x538405,_0x175cbe){return db[_0xaed8('0x2c')][_0xaed8('0x47')]({'where':{'id':_0x4401af['params']['id']}})[_0xaed8('0x24')](function(_0x20bac7){if(_0x20bac7){return _0x20bac7[_0xaed8('0x23')]();}})['then'](function(_0xd3188f){var _0x3b08f8=path[_0xaed8('0x51')](config[_0xaed8('0x4d')],_0xaed8('0x5b'),util[_0xaed8('0x53')](_0xaed8('0x52'),_0xd3188f[_0xaed8('0x4a')],_0xd3188f['original_format']));var _0x9b2d0b=path[_0xaed8('0x51')](config[_0xaed8('0x4d')],_0xaed8('0x4e'),util[_0xaed8('0x53')](_0xaed8('0x52'),_0xd3188f[_0xaed8('0x4a')],_0xd3188f[_0xaed8('0x4b')]));fs[_0xaed8('0x62')](_0x3b08f8);fs[_0xaed8('0x62')](_0x9b2d0b);return _0xd3188f;})[_0xaed8('0x24')](function(_0x41d6eb){if(_0x41d6eb){return _0x538405['status'](0xcc)['end']();}})[_0xaed8('0x24')](handleEntityNotFound(_0x538405,null))[_0xaed8('0x48')](handleError(_0x538405,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index bfdc28f..c32de5f 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 _0x8f9f=['rimraf','../../config/environment','define','Sound','tools_sounds','lodash','util','moment','bluebird','request-promise','path'];(function(_0x14900c,_0x401f5d){var _0x5783fa=function(_0xf98a5c){while(--_0xf98a5c){_0x14900c['push'](_0x14900c['shift']());}};_0x5783fa(++_0x401f5d);}(_0x8f9f,0x139));var _0xf8f9=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x8f9f[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0xf8f9('0x0'));var util=require(_0xf8f9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf8f9('0x2'));var BPromise=require(_0xf8f9('0x3'));var rp=require(_0xf8f9('0x4'));var fs=require('fs');var path=require(_0xf8f9('0x5'));var rimraf=require(_0xf8f9('0x6'));var config=require(_0xf8f9('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x3684bd,_0x4a3e08){return _0x3684bd[_0xf8f9('0x8')](_0xf8f9('0x9'),attributes,{'tableName':_0xf8f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe903=['request-promise','rimraf','exports','define','Sound','util','../../config/logger','api','moment'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe903,0x1c7));var _0x3e90=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xe903[_0x28d18d];return _0x470640;};'use strict';var _=require('lodash');var util=require(_0x3e90('0x0'));var logger=require(_0x3e90('0x1'))(_0x3e90('0x2'));var moment=require(_0x3e90('0x3'));var BPromise=require('bluebird');var rp=require(_0x3e90('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e90('0x5'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x3e90('0x6')]=function(_0x2e3209,_0x2924f4){return _0x2e3209[_0x3e90('0x7')](_0x3e90('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 3ad944f..7aff314 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 _0x909d=['moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','Sound','find','options','raw','where','attributes','map','include','model','ShowSound','catch','lodash','util'];(function(_0x2b10b5,_0x5c1f2e){var _0x545669=function(_0x4208be){while(--_0x4208be){_0x2b10b5['push'](_0x2b10b5['shift']());}};_0x545669(++_0x5c1f2e);}(_0x909d,0x15e));var _0xd909=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x909d[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xd909('0x0'));var util=require(_0xd909('0x1'));var moment=require(_0xd909('0x2'));var BPromise=require('bluebird');var rs=require(_0xd909('0x3'));var fs=require('fs');var Redis=require(_0xd909('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd909('0x5'));var logger=require('../../config/logger')(_0xd909('0x6'));var config=require(_0xd909('0x7'));var jayson=require(_0xd909('0x8'));var client=jayson[_0xd909('0x9')][_0xd909('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a3135,_0x32ad12,_0x4a0336){return new BPromise(function(_0x282428,_0x2a82c6){return client[_0xd909('0xb')](_0x2a3135,_0x4a0336)[_0xd909('0xc')](function(_0x3359ff){logger['info'](_0xd909('0xd'),_0x32ad12,'request\x20sent');logger[_0xd909('0xe')](_0xd909('0xf'),_0x32ad12,_0xd909('0x10'),JSON[_0xd909('0x11')](_0x3359ff));if(_0x3359ff[_0xd909('0x12')]){if(_0x3359ff[_0xd909('0x12')]['code']===0x1f4){logger[_0xd909('0x12')](_0xd909('0xd'),_0x32ad12,_0x3359ff[_0xd909('0x12')][_0xd909('0x13')]);return _0x2a82c6(_0x3359ff['error'][_0xd909('0x13')]);}logger[_0xd909('0x12')](_0xd909('0xd'),_0x32ad12,_0x3359ff['error'][_0xd909('0x13')]);return _0x282428(_0x3359ff[_0xd909('0x12')][_0xd909('0x13')]);}else{logger[_0xd909('0x14')](_0xd909('0xd'),_0x32ad12,'request\x20sent');_0x282428(_0x3359ff['result'][_0xd909('0x13')]);}})['catch'](function(_0x29b37e){logger['error']('Sound,\x20%s,\x20%s',_0x32ad12,_0x29b37e);_0x2a82c6(_0x29b37e);});});}exports['ShowSound']=function(_0x45a7c9){var _0x1a9ead=this;return new Promise(function(_0x52712f,_0x317c2b){return db[_0xd909('0x15')][_0xd909('0x16')]({'raw':_0x45a7c9['options']?_0x45a7c9[_0xd909('0x17')][_0xd909('0x18')]===undefined?!![]:![]:!![],'where':_0x45a7c9['options']?_0x45a7c9[_0xd909('0x17')][_0xd909('0x19')]||null:null,'attributes':_0x45a7c9[_0xd909('0x17')]?_0x45a7c9['options'][_0xd909('0x1a')]||null:null,'include':_0x45a7c9[_0xd909('0x17')]?_0x45a7c9[_0xd909('0x17')]['include']?_[_0xd909('0x1b')](_0x45a7c9[_0xd909('0x17')][_0xd909('0x1c')],function(_0x2ab17e){return{'model':db[_0x2ab17e[_0xd909('0x1d')]],'as':_0x2ab17e['as'],'attributes':_0x2ab17e[_0xd909('0x1a')],'include':_0x2ab17e[_0xd909('0x1c')]?_[_0xd909('0x1b')](_0x2ab17e[_0xd909('0x1c')],function(_0x2903de){return{'model':db[_0x2903de['model']],'as':_0x2903de['as'],'attributes':_0x2903de[_0xd909('0x1a')],'include':_0x2903de[_0xd909('0x1c')]?_['map'](_0x2903de[_0xd909('0x1c')],function(_0x26cc8f){return{'model':db[_0x26cc8f[_0xd909('0x1d')]],'as':_0x26cc8f['as'],'attributes':_0x26cc8f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1780a6){logger[_0xd909('0x14')](_0xd909('0x1e'),_0x45a7c9);logger[_0xd909('0xe')]('ShowSound',_0x45a7c9,JSON[_0xd909('0x11')](_0x1780a6));_0x52712f(_0x1780a6);})[_0xd909('0x1f')](function(_0x1ca577){logger[_0xd909('0x12')]('ShowSound',_0x1ca577['message'],_0x45a7c9);_0x317c2b(_0x1a9ead['error'](0x1f4,_0x1ca577[_0xd909('0x13')]));});});}; \ No newline at end of file +var _0x1a8f=['then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x455e78,_0x4eb1d4){var _0x2e6003=function(_0x252bfe){while(--_0x252bfe){_0x455e78['push'](_0x455e78['shift']());}};_0x2e6003(++_0x4eb1d4);}(_0x1a8f,0x135));var _0xf1a8=function(_0x4745d9,_0x411b00){_0x4745d9=_0x4745d9-0x0;var _0x38f2ac=_0x1a8f[_0x4745d9];return _0x38f2ac;};'use strict';var _=require('lodash');var util=require(_0xf1a8('0x0'));var moment=require('moment');var BPromise=require(_0xf1a8('0x1'));var rs=require(_0xf1a8('0x2'));var fs=require('fs');var Redis=require(_0xf1a8('0x3'));var db=require(_0xf1a8('0x4'))['db'];var utils=require(_0xf1a8('0x5'));var logger=require(_0xf1a8('0x6'))(_0xf1a8('0x7'));var config=require(_0xf1a8('0x8'));var jayson=require(_0xf1a8('0x9'));var client=jayson['client'][_0xf1a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aab6a,_0x185e19,_0x156e90){return new BPromise(function(_0x3972c0,_0x370363){return client['request'](_0x5aab6a,_0x156e90)[_0xf1a8('0xb')](function(_0x311846){logger[_0xf1a8('0xc')](_0xf1a8('0xd'),_0x185e19,_0xf1a8('0xe'));logger[_0xf1a8('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x185e19,_0xf1a8('0xe'),JSON[_0xf1a8('0x10')](_0x311846));if(_0x311846[_0xf1a8('0x11')]){if(_0x311846[_0xf1a8('0x11')][_0xf1a8('0x12')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x185e19,_0x311846[_0xf1a8('0x11')][_0xf1a8('0x13')]);return _0x370363(_0x311846[_0xf1a8('0x11')][_0xf1a8('0x13')]);}logger[_0xf1a8('0x11')](_0xf1a8('0xd'),_0x185e19,_0x311846['error'][_0xf1a8('0x13')]);return _0x3972c0(_0x311846[_0xf1a8('0x11')][_0xf1a8('0x13')]);}else{logger[_0xf1a8('0xc')](_0xf1a8('0xd'),_0x185e19,_0xf1a8('0xe'));_0x3972c0(_0x311846[_0xf1a8('0x14')][_0xf1a8('0x13')]);}})[_0xf1a8('0x15')](function(_0x272a63){logger['error']('Sound,\x20%s,\x20%s',_0x185e19,_0x272a63);_0x370363(_0x272a63);});});}exports[_0xf1a8('0x16')]=function(_0x3e1ee9){var _0x88df06=this;return new Promise(function(_0x2010d8,_0x1c6437){return db[_0xf1a8('0x17')][_0xf1a8('0x18')]({'raw':_0x3e1ee9[_0xf1a8('0x19')]?_0x3e1ee9['options'][_0xf1a8('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e1ee9['options']?_0x3e1ee9['options'][_0xf1a8('0x1b')]||null:null,'attributes':_0x3e1ee9[_0xf1a8('0x19')]?_0x3e1ee9[_0xf1a8('0x19')][_0xf1a8('0x1c')]||null:null,'include':_0x3e1ee9['options']?_0x3e1ee9[_0xf1a8('0x19')][_0xf1a8('0x1d')]?_[_0xf1a8('0x1e')](_0x3e1ee9[_0xf1a8('0x19')][_0xf1a8('0x1d')],function(_0x375df3){return{'model':db[_0x375df3['model']],'as':_0x375df3['as'],'attributes':_0x375df3[_0xf1a8('0x1c')],'include':_0x375df3['include']?_[_0xf1a8('0x1e')](_0x375df3['include'],function(_0x224ce2){return{'model':db[_0x224ce2[_0xf1a8('0x1f')]],'as':_0x224ce2['as'],'attributes':_0x224ce2[_0xf1a8('0x1c')],'include':_0x224ce2[_0xf1a8('0x1d')]?_[_0xf1a8('0x1e')](_0x224ce2[_0xf1a8('0x1d')],function(_0x26ee96){return{'model':db[_0x26ee96[_0xf1a8('0x1f')]],'as':_0x26ee96['as'],'attributes':_0x26ee96[_0xf1a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf1a8('0xb')](function(_0x2aaad3){logger[_0xf1a8('0xc')](_0xf1a8('0x16'),_0x3e1ee9);logger[_0xf1a8('0xf')](_0xf1a8('0x16'),_0x3e1ee9,JSON['stringify'](_0x2aaad3));_0x2010d8(_0x2aaad3);})[_0xf1a8('0x15')](function(_0x54f741){logger['error'](_0xf1a8('0x16'),_0x54f741['message'],_0x3e1ee9);_0x1c6437(_0x88df06[_0xf1a8('0x11')](0x1f4,_0x54f741[_0xf1a8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 43a25a9..92eae41 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x3d83ac,_0x1d0135){var _0x299760=function(_0x40c1a3){while(--_0x40c1a3){_0x3d83ac['push'](_0x3d83ac['shift']());}};_0x299760(++_0x1d0135);}(_0xda2d,0x102));var _0xdda2=function(_0x30a273,_0x1d8d6e){_0x30a273=_0x30a273-0x0;var _0xb0812e=_0xda2d[_0x30a273];return _0xb0812e;};'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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a4bdd,_0x5149f6){var _0x5b2551=function(_0x395b89){while(--_0x395b89){_0x5a4bdd['push'](_0x5a4bdd['shift']());}};_0x5b2551(++_0x5149f6);}(_0xb10b,0x12a));var _0xbb10=function(_0x53ba30,_0x210d1e){_0x53ba30=_0x53ba30-0x0;var _0x46e47a=_0xb10b[_0x53ba30];return _0x46e47a;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 682b569..5e9baee 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 _0xc36d=['exports','TEXT','medium','ENUM','out','sequelize'];(function(_0x590c1b,_0x4961c3){var _0xd53864=function(_0x43a8cd){while(--_0x43a8cd){_0x590c1b['push'](_0x590c1b['shift']());}};_0xd53864(++_0x4961c3);}(_0xc36d,0x125));var _0xdc36=function(_0x5e0bfe,_0x747312){_0x5e0bfe=_0x5e0bfe-0x0;var _0x6468b8=_0xc36d[_0x5e0bfe];return _0x6468b8;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xdc36('0x2')](_0xdc36('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xdc36('0x4')]('in',_0xdc36('0x5')),'defaultValue':_0xdc36('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2147=['medium','sequelize','exports','STRING','TEXT'];(function(_0x1fd37a,_0x272d39){var _0x244db0=function(_0x4a7d2c){while(--_0x4a7d2c){_0x1fd37a['push'](_0x1fd37a['shift']());}};_0x244db0(++_0x272d39);}(_0x2147,0x105));var _0x7214=function(_0xce758b,_0xca832c){_0xce758b=_0xce758b-0x0;var _0x50d426=_0x2147[_0xce758b];return _0x50d426;};'use strict';var Sequelize=require(_0x7214('0x0'));module[_0x7214('0x1')]={'uniqueid':{'type':Sequelize[_0x7214('0x2')]},'body':{'type':Sequelize[_0x7214('0x3')](_0x7214('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7214('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 64078a4..bf07053 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 _0x3eaf=['key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','send','index','SquareMessage','rawAttributes','fieldName','type'];(function(_0x4d6fc9,_0x32fb02){var _0x412379=function(_0x5c1260){while(--_0x5c1260){_0x4d6fc9['push'](_0x4d6fc9['shift']());}};_0x412379(++_0x32fb02);}(_0x3eaf,0x190));var _0xf3ea=function(_0x54c049,_0x21d825){_0x54c049=_0x54c049-0x0;var _0x937b0b=_0x3eaf[_0x54c049];return _0x937b0b;};'use strict';var emlformat=require(_0xf3ea('0x0'));var rimraf=require(_0xf3ea('0x1'));var zipdir=require(_0xf3ea('0x2'));var jsonpatch=require(_0xf3ea('0x3'));var rp=require(_0xf3ea('0x4'));var moment=require(_0xf3ea('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf3ea('0x6'));var util=require(_0xf3ea('0x7'));var path=require(_0xf3ea('0x8'));var sox=require('sox');var csv=require(_0xf3ea('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3ea('0xa'));var _=require(_0xf3ea('0xb'));var squel=require(_0xf3ea('0xc'));var crypto=require('crypto');var jsforce=require(_0xf3ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf3ea('0x9'));var querystring=require(_0xf3ea('0xe'));var Papa=require('papaparse');var Redis=require(_0xf3ea('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf3ea('0x10'));var as=require(_0xf3ea('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf3ea('0x12'));var utils=require(_0xf3ea('0x13'));var config=require(_0xf3ea('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3ea('0x15'))['db'];function respondWithStatusCode(_0x174c19,_0x146c8a){_0x146c8a=_0x146c8a||0xcc;return function(_0x4c3801){if(_0x4c3801){return _0x174c19[_0xf3ea('0x16')](_0x146c8a);}return _0x174c19[_0xf3ea('0x17')](_0x146c8a)[_0xf3ea('0x18')]();};}function respondWithResult(_0x462567,_0x25e16a){_0x25e16a=_0x25e16a||0xc8;return function(_0x212521){if(_0x212521){return _0x462567[_0xf3ea('0x17')](_0x25e16a)[_0xf3ea('0x19')](_0x212521);}};}function respondWithFilteredResult(_0x56fa75,_0x46f3c4){return function(_0x5a560b){if(_0x5a560b){var _0x56d00f=typeof _0x46f3c4[_0xf3ea('0x1a')]==='undefined'&&typeof _0x46f3c4[_0xf3ea('0x1b')]===_0xf3ea('0x1c');var _0x24f0ac=_0x5a560b[_0xf3ea('0x1d')];var _0x4806fb=_0x56d00f?0x0:_0x46f3c4[_0xf3ea('0x1a')];var _0x1806ec=_0x56d00f?_0x5a560b[_0xf3ea('0x1d')]:_0x46f3c4[_0xf3ea('0x1a')]+_0x46f3c4[_0xf3ea('0x1b')];var _0x4fb6c0;if(_0x1806ec>=_0x24f0ac){_0x1806ec=_0x24f0ac;_0x4fb6c0=0xc8;}else{_0x4fb6c0=0xce;}_0x56fa75['status'](_0x4fb6c0);return _0x56fa75[_0xf3ea('0x1e')](_0xf3ea('0x1f'),_0x4806fb+'-'+_0x1806ec+'/'+_0x24f0ac)['json'](_0x5a560b);}return null;};}function patchUpdates(_0x2c7419){return function(_0x42f13c){try{jsonpatch[_0xf3ea('0x20')](_0x42f13c,_0x2c7419,!![]);}catch(_0xc85489){return BPromise[_0xf3ea('0x21')](_0xc85489);}return _0x42f13c[_0xf3ea('0x22')]();};}function saveUpdates(_0x134b7d,_0x27d607){return function(_0x34ec8f){if(_0x34ec8f){return _0x34ec8f[_0xf3ea('0x23')](_0x134b7d)[_0xf3ea('0x24')](function(_0x591fca){return _0x591fca;});}return null;};}function removeEntity(_0x2aee66,_0x23ed4a){return function(_0x5931e1){if(_0x5931e1){return _0x5931e1['destroy']()['then'](function(){_0x2aee66[_0xf3ea('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e089a,_0x38a1c8){return function(_0x4ea971){if(!_0x4ea971){_0x2e089a[_0xf3ea('0x16')](0x194);}return _0x4ea971;};}function handleError(_0x2877a2,_0x3e156d){_0x3e156d=_0x3e156d||0x1f4;return function(_0x4c29cc){logger[_0xf3ea('0x25')](_0x4c29cc['stack']);if(_0x4c29cc['name']){delete _0x4c29cc['name'];}_0x2877a2['status'](_0x3e156d)[_0xf3ea('0x26')](_0x4c29cc);};}exports[_0xf3ea('0x27')]=function(_0x120232,_0x10ef5f){var _0x15eed5={},_0x3ee79e={},_0x3c2cdb={'count':0x0,'rows':[]};var _0x65cdff=_['map'](db[_0xf3ea('0x28')][_0xf3ea('0x29')],function(_0x246103){return{'name':_0x246103[_0xf3ea('0x2a')],'type':_0x246103[_0xf3ea('0x2b')][_0xf3ea('0x2c')]};});_0x3ee79e[_0xf3ea('0x2d')]=_[_0xf3ea('0x2e')](_0x65cdff,_0xf3ea('0x2f'));_0x3ee79e[_0xf3ea('0x30')]=_['keys'](_0x120232['query']);_0x3ee79e[_0xf3ea('0x31')]=_[_0xf3ea('0x32')](_0x3ee79e[_0xf3ea('0x2d')],_0x3ee79e[_0xf3ea('0x30')]);_0x15eed5[_0xf3ea('0x33')]=_[_0xf3ea('0x32')](_0x3ee79e[_0xf3ea('0x2d')],qs[_0xf3ea('0x34')](_0x120232[_0xf3ea('0x30')]['fields']));_0x15eed5[_0xf3ea('0x33')]=_0x15eed5[_0xf3ea('0x33')][_0xf3ea('0x35')]?_0x15eed5[_0xf3ea('0x33')]:_0x3ee79e[_0xf3ea('0x2d')];if(!_0x120232[_0xf3ea('0x30')][_0xf3ea('0x36')](_0xf3ea('0x37'))){_0x15eed5[_0xf3ea('0x1b')]=qs[_0xf3ea('0x1b')](_0x120232[_0xf3ea('0x30')][_0xf3ea('0x1b')]);_0x15eed5[_0xf3ea('0x1a')]=qs[_0xf3ea('0x1a')](_0x120232[_0xf3ea('0x30')]['offset']);}_0x15eed5['order']=qs[_0xf3ea('0x38')](_0x120232[_0xf3ea('0x30')][_0xf3ea('0x38')]);_0x15eed5['where']=qs[_0xf3ea('0x31')](_['pick'](_0x120232[_0xf3ea('0x30')],_0x3ee79e['filters']),_0x65cdff);if(_0x120232[_0xf3ea('0x30')]['filter']){_0x15eed5[_0xf3ea('0x39')]=_[_0xf3ea('0x3a')](_0x15eed5[_0xf3ea('0x39')],{'$or':_[_0xf3ea('0x2e')](_0x65cdff,function(_0x26217b){if(_0x26217b[_0xf3ea('0x2b')]!==_0xf3ea('0x3b')){var _0x20505f={};_0x20505f[_0x26217b[_0xf3ea('0x2f')]]={'$like':'%'+_0x120232[_0xf3ea('0x30')][_0xf3ea('0x3c')]+'%'};return _0x20505f;}})});}_0x15eed5=_['merge']({},_0x15eed5,_0x120232[_0xf3ea('0x3d')]);var _0x49b938={'where':_0x15eed5['where']};return db[_0xf3ea('0x28')][_0xf3ea('0x1d')](_0x49b938)[_0xf3ea('0x24')](function(_0x55d496){_0x3c2cdb[_0xf3ea('0x1d')]=_0x55d496;if(_0x120232[_0xf3ea('0x30')]['includeAll']){_0x15eed5[_0xf3ea('0x3e')]=[{'all':!![]}];}return db[_0xf3ea('0x28')][_0xf3ea('0x3f')](_0x15eed5);})[_0xf3ea('0x24')](function(_0x4adffc){_0x3c2cdb[_0xf3ea('0x40')]=_0x4adffc;return _0x3c2cdb;})[_0xf3ea('0x24')](respondWithFilteredResult(_0x10ef5f,_0x15eed5))[_0xf3ea('0x41')](handleError(_0x10ef5f,null));};exports[_0xf3ea('0x42')]=function(_0x2badff,_0x4d688e){var _0x2ed142={'raw':!![],'where':{'id':_0x2badff[_0xf3ea('0x43')]['id']}},_0xe09c97={};_0xe09c97[_0xf3ea('0x2d')]=_[_0xf3ea('0x44')](db[_0xf3ea('0x28')][_0xf3ea('0x29')]);_0xe09c97[_0xf3ea('0x30')]=_[_0xf3ea('0x44')](_0x2badff[_0xf3ea('0x30')]);_0xe09c97['filters']=_[_0xf3ea('0x32')](_0xe09c97[_0xf3ea('0x2d')],_0xe09c97['query']);_0x2ed142[_0xf3ea('0x33')]=_['intersection'](_0xe09c97[_0xf3ea('0x2d')],qs['fields'](_0x2badff['query'][_0xf3ea('0x34')]));_0x2ed142[_0xf3ea('0x33')]=_0x2ed142[_0xf3ea('0x33')][_0xf3ea('0x35')]?_0x2ed142[_0xf3ea('0x33')]:_0xe09c97[_0xf3ea('0x2d')];if(_0x2badff['query'][_0xf3ea('0x45')]){_0x2ed142[_0xf3ea('0x3e')]=[{'all':!![]}];}_0x2ed142=_[_0xf3ea('0x3a')]({},_0x2ed142,_0x2badff[_0xf3ea('0x3d')]);return db['SquareMessage'][_0xf3ea('0x46')](_0x2ed142)['then'](handleEntityNotFound(_0x4d688e,null))[_0xf3ea('0x24')](respondWithResult(_0x4d688e,null))['catch'](handleError(_0x4d688e,null));};exports[_0xf3ea('0x47')]=function(_0x139666,_0x5d5a82){return db[_0xf3ea('0x28')][_0xf3ea('0x47')](_0x139666[_0xf3ea('0x48')],{})['then'](respondWithResult(_0x5d5a82,0xc9))['catch'](handleError(_0x5d5a82,null));};exports[_0xf3ea('0x23')]=function(_0xea830e,_0x34dcdc){if(_0xea830e[_0xf3ea('0x48')]['id']){delete _0xea830e['body']['id'];}return db['SquareMessage'][_0xf3ea('0x46')]({'where':{'id':_0xea830e[_0xf3ea('0x43')]['id']}})[_0xf3ea('0x24')](handleEntityNotFound(_0x34dcdc,null))['then'](saveUpdates(_0xea830e[_0xf3ea('0x48')],null))['then'](respondWithResult(_0x34dcdc,null))[_0xf3ea('0x41')](handleError(_0x34dcdc,null));};exports[_0xf3ea('0x49')]=function(_0x366202,_0x3be311){return db['SquareMessage'][_0xf3ea('0x46')]({'where':{'id':_0x366202['params']['id']}})[_0xf3ea('0x24')](handleEntityNotFound(_0x3be311,null))['then'](removeEntity(_0x3be311,null))[_0xf3ea('0x41')](handleError(_0x3be311,null));}; \ No newline at end of file +var _0x414f=['intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','merge','map','type','VIRTUAL','filter','options','SquareMessage','includeAll','include','findAll','catch','params','length','find','create','body','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','model','query','keys'];(function(_0x3f6368,_0x9ba37f){var _0x75cea4=function(_0x113196){while(--_0x113196){_0x3f6368['push'](_0x3f6368['shift']());}};_0x75cea4(++_0x9ba37f);}(_0x414f,0x13f));var _0xf414=function(_0x26f03d,_0x4866c2){_0x26f03d=_0x26f03d-0x0;var _0x42dc9f=_0x414f[_0x26f03d];return _0x42dc9f;};'use strict';var emlformat=require(_0xf414('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf414('0x1'));var jsonpatch=require(_0xf414('0x2'));var rp=require('request-promise');var moment=require(_0xf414('0x3'));var BPromise=require(_0xf414('0x4'));var Mustache=require(_0xf414('0x5'));var util=require(_0xf414('0x6'));var path=require(_0xf414('0x7'));var sox=require(_0xf414('0x8'));var csv=require(_0xf414('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf414('0xa'));var _=require('lodash');var squel=require(_0xf414('0xb'));var crypto=require(_0xf414('0xc'));var jsforce=require(_0xf414('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf414('0xe'));var Papa=require(_0xf414('0xf'));var Redis=require(_0xf414('0x10'));var authService=require(_0xf414('0x11'));var qs=require(_0xf414('0x12'));var as=require(_0xf414('0x13'));var hardwareService=require(_0xf414('0x14'));var logger=require(_0xf414('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf414('0x16'));var licenseUtil=require(_0xf414('0x17'));var db=require(_0xf414('0x18'))['db'];function respondWithStatusCode(_0x396c30,_0x9be4f8){_0x9be4f8=_0x9be4f8||0xcc;return function(_0x488d03){if(_0x488d03){return _0x396c30[_0xf414('0x19')](_0x9be4f8);}return _0x396c30[_0xf414('0x1a')](_0x9be4f8)[_0xf414('0x1b')]();};}function respondWithResult(_0x46d679,_0x99bbd1){_0x99bbd1=_0x99bbd1||0xc8;return function(_0x5da0b7){if(_0x5da0b7){return _0x46d679[_0xf414('0x1a')](_0x99bbd1)[_0xf414('0x1c')](_0x5da0b7);}};}function respondWithFilteredResult(_0x46fb28,_0x706d2e){return function(_0x4d3021){if(_0x4d3021){var _0x17125d=typeof _0x706d2e[_0xf414('0x1d')]===_0xf414('0x1e')&&typeof _0x706d2e['limit']===_0xf414('0x1e');var _0x452904=_0x4d3021[_0xf414('0x1f')];var _0x32e970=_0x17125d?0x0:_0x706d2e[_0xf414('0x1d')];var _0x4f9658=_0x17125d?_0x4d3021[_0xf414('0x1f')]:_0x706d2e['offset']+_0x706d2e['limit'];var _0x24b65e;if(_0x4f9658>=_0x452904){_0x4f9658=_0x452904;_0x24b65e=0xc8;}else{_0x24b65e=0xce;}_0x46fb28[_0xf414('0x1a')](_0x24b65e);return _0x46fb28['set']('Content-Range',_0x32e970+'-'+_0x4f9658+'/'+_0x452904)['json'](_0x4d3021);}return null;};}function patchUpdates(_0x3145ed){return function(_0x1ccfce){try{jsonpatch[_0xf414('0x20')](_0x1ccfce,_0x3145ed,!![]);}catch(_0x417af1){return BPromise[_0xf414('0x21')](_0x417af1);}return _0x1ccfce[_0xf414('0x22')]();};}function saveUpdates(_0x3bbbe8,_0x1e116c){return function(_0x1dbfa9){if(_0x1dbfa9){return _0x1dbfa9['update'](_0x3bbbe8)[_0xf414('0x23')](function(_0x3ae2a0){return _0x3ae2a0;});}return null;};}function removeEntity(_0x236504,_0x4999e4){return function(_0x8bd1d0){if(_0x8bd1d0){return _0x8bd1d0[_0xf414('0x24')]()[_0xf414('0x23')](function(){_0x236504[_0xf414('0x1a')](0xcc)[_0xf414('0x1b')]();});}};}function handleEntityNotFound(_0x398631,_0x1340d8){return function(_0x3f7a7d){if(!_0x3f7a7d){_0x398631['sendStatus'](0x194);}return _0x3f7a7d;};}function handleError(_0x2f9cb3,_0x564c66){_0x564c66=_0x564c66||0x1f4;return function(_0x47e0a1){logger[_0xf414('0x25')](_0x47e0a1[_0xf414('0x26')]);if(_0x47e0a1[_0xf414('0x27')]){delete _0x47e0a1[_0xf414('0x27')];}_0x2f9cb3[_0xf414('0x1a')](_0x564c66)[_0xf414('0x28')](_0x47e0a1);};}exports['index']=function(_0x53efd2,_0x306a1c){var _0x25b40f={},_0x209790={},_0x5e925b={'count':0x0,'rows':[]};var _0x433425=_['map'](db['SquareMessage'][_0xf414('0x29')],function(_0x8cf16c){return{'name':_0x8cf16c[_0xf414('0x2a')],'type':_0x8cf16c['type']['key']};});_0x209790[_0xf414('0x2b')]=_['map'](_0x433425,_0xf414('0x27'));_0x209790[_0xf414('0x2c')]=_[_0xf414('0x2d')](_0x53efd2[_0xf414('0x2c')]);_0x209790['filters']=_[_0xf414('0x2e')](_0x209790['model'],_0x209790['query']);_0x25b40f[_0xf414('0x2f')]=_[_0xf414('0x2e')](_0x209790[_0xf414('0x2b')],qs[_0xf414('0x30')](_0x53efd2[_0xf414('0x2c')][_0xf414('0x30')]));_0x25b40f[_0xf414('0x2f')]=_0x25b40f[_0xf414('0x2f')]['length']?_0x25b40f['attributes']:_0x209790[_0xf414('0x2b')];if(!_0x53efd2[_0xf414('0x2c')][_0xf414('0x31')]('nolimit')){_0x25b40f['limit']=qs[_0xf414('0x32')](_0x53efd2['query'][_0xf414('0x32')]);_0x25b40f['offset']=qs[_0xf414('0x1d')](_0x53efd2[_0xf414('0x2c')]['offset']);}_0x25b40f[_0xf414('0x33')]=qs[_0xf414('0x34')](_0x53efd2[_0xf414('0x2c')]['sort']);_0x25b40f[_0xf414('0x35')]=qs[_0xf414('0x36')](_[_0xf414('0x37')](_0x53efd2[_0xf414('0x2c')],_0x209790[_0xf414('0x36')]),_0x433425);if(_0x53efd2[_0xf414('0x2c')]['filter']){_0x25b40f[_0xf414('0x35')]=_[_0xf414('0x38')](_0x25b40f[_0xf414('0x35')],{'$or':_[_0xf414('0x39')](_0x433425,function(_0x21142c){if(_0x21142c[_0xf414('0x3a')]!==_0xf414('0x3b')){var _0xa0638a={};_0xa0638a[_0x21142c[_0xf414('0x27')]]={'$like':'%'+_0x53efd2['query'][_0xf414('0x3c')]+'%'};return _0xa0638a;}})});}_0x25b40f=_[_0xf414('0x38')]({},_0x25b40f,_0x53efd2[_0xf414('0x3d')]);var _0x16dd5e={'where':_0x25b40f[_0xf414('0x35')]};return db[_0xf414('0x3e')][_0xf414('0x1f')](_0x16dd5e)[_0xf414('0x23')](function(_0x248f7f){_0x5e925b[_0xf414('0x1f')]=_0x248f7f;if(_0x53efd2[_0xf414('0x2c')][_0xf414('0x3f')]){_0x25b40f[_0xf414('0x40')]=[{'all':!![]}];}return db[_0xf414('0x3e')][_0xf414('0x41')](_0x25b40f);})[_0xf414('0x23')](function(_0x43d141){_0x5e925b['rows']=_0x43d141;return _0x5e925b;})[_0xf414('0x23')](respondWithFilteredResult(_0x306a1c,_0x25b40f))[_0xf414('0x42')](handleError(_0x306a1c,null));};exports['show']=function(_0x29c5ef,_0x3c95e6){var _0x56c830={'raw':!![],'where':{'id':_0x29c5ef[_0xf414('0x43')]['id']}},_0x41706d={};_0x41706d[_0xf414('0x2b')]=_[_0xf414('0x2d')](db[_0xf414('0x3e')][_0xf414('0x29')]);_0x41706d[_0xf414('0x2c')]=_['keys'](_0x29c5ef[_0xf414('0x2c')]);_0x41706d[_0xf414('0x36')]=_[_0xf414('0x2e')](_0x41706d[_0xf414('0x2b')],_0x41706d[_0xf414('0x2c')]);_0x56c830[_0xf414('0x2f')]=_[_0xf414('0x2e')](_0x41706d[_0xf414('0x2b')],qs[_0xf414('0x30')](_0x29c5ef['query'][_0xf414('0x30')]));_0x56c830[_0xf414('0x2f')]=_0x56c830[_0xf414('0x2f')][_0xf414('0x44')]?_0x56c830['attributes']:_0x41706d['model'];if(_0x29c5ef[_0xf414('0x2c')][_0xf414('0x3f')]){_0x56c830['include']=[{'all':!![]}];}_0x56c830=_['merge']({},_0x56c830,_0x29c5ef[_0xf414('0x3d')]);return db[_0xf414('0x3e')][_0xf414('0x45')](_0x56c830)[_0xf414('0x23')](handleEntityNotFound(_0x3c95e6,null))[_0xf414('0x23')](respondWithResult(_0x3c95e6,null))[_0xf414('0x42')](handleError(_0x3c95e6,null));};exports[_0xf414('0x46')]=function(_0x269beb,_0x49ad21){return db[_0xf414('0x3e')][_0xf414('0x46')](_0x269beb[_0xf414('0x47')],{})[_0xf414('0x23')](respondWithResult(_0x49ad21,0xc9))[_0xf414('0x42')](handleError(_0x49ad21,null));};exports[_0xf414('0x48')]=function(_0x2670f5,_0x5c7ec1){if(_0x2670f5[_0xf414('0x47')]['id']){delete _0x2670f5[_0xf414('0x47')]['id'];}return db['SquareMessage'][_0xf414('0x45')]({'where':{'id':_0x2670f5[_0xf414('0x43')]['id']}})[_0xf414('0x23')](handleEntityNotFound(_0x5c7ec1,null))[_0xf414('0x23')](saveUpdates(_0x2670f5[_0xf414('0x47')],null))[_0xf414('0x23')](respondWithResult(_0x5c7ec1,null))['catch'](handleError(_0x5c7ec1,null));};exports[_0xf414('0x24')]=function(_0x5b5b69,_0x528379){return db[_0xf414('0x3e')][_0xf414('0x45')]({'where':{'id':_0x5b5b69[_0xf414('0x43')]['id']}})['then'](handleEntityNotFound(_0x528379,null))[_0xf414('0x23')](removeEntity(_0x528379,null))[_0xf414('0x42')](handleError(_0x528379,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fc725ed..f70692b 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 _0xdc34=['SquareMessage','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x4aa299,_0x3aba13){var _0x49018e=function(_0x200d2d){while(--_0x200d2d){_0x4aa299['push'](_0x4aa299['shift']());}};_0x49018e(++_0x3aba13);}(_0xdc34,0xa3));var _0x4dc3=function(_0x39d9af,_0x2d7a7b){_0x39d9af=_0x39d9af-0x0;var _0x55b9e2=_0xdc34[_0x39d9af];return _0x55b9e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4dc3('0x0'))(_0x4dc3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4dc3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dc3('0x3'));var config=require(_0x4dc3('0x4'));var attributes=require(_0x4dc3('0x5'));module[_0x4dc3('0x6')]=function(_0x59a3af,_0x21b9e9){return _0x59a3af[_0x4dc3('0x7')](_0x4dc3('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x468a=['bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','util','../../config/logger','api','moment'];(function(_0x10d1a8,_0x21696c){var _0x416c65=function(_0x142e33){while(--_0x142e33){_0x10d1a8['push'](_0x10d1a8['shift']());}};_0x416c65(++_0x21696c);}(_0x468a,0xd8));var _0xa468=function(_0x19d65d,_0x54f503){_0x19d65d=_0x19d65d-0x0;var _0x28e2b0=_0x468a[_0x19d65d];return _0x28e2b0;};'use strict';var _=require('lodash');var util=require(_0xa468('0x0'));var logger=require(_0xa468('0x1'))(_0xa468('0x2'));var moment=require(_0xa468('0x3'));var BPromise=require(_0xa468('0x4'));var rp=require(_0xa468('0x5'));var fs=require('fs');var path=require(_0xa468('0x6'));var rimraf=require(_0xa468('0x7'));var config=require(_0xa468('0x8'));var attributes=require(_0xa468('0x9'));module[_0xa468('0xa')]=function(_0x1adc75,_0x62ba31){return _0x1adc75['define']('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index b8c5dc5..2f571a8 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 _0x19e0=['raw','then','CreateSquareMessage','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareMessage','create','body','options'];(function(_0x166fc3,_0xdded0f){var _0x49064a=function(_0x59ca76){while(--_0x59ca76){_0x166fc3['push'](_0x166fc3['shift']());}};_0x49064a(++_0xdded0f);}(_0x19e0,0x9f));var _0x019e=function(_0x5b1ec7,_0x4904ba){_0x5b1ec7=_0x5b1ec7-0x0;var _0x11d210=_0x19e0[_0x5b1ec7];return _0x11d210;};'use strict';var _=require(_0x019e('0x0'));var util=require(_0x019e('0x1'));var moment=require(_0x019e('0x2'));var BPromise=require(_0x019e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x019e('0x4'));var db=require(_0x019e('0x5'))['db'];var utils=require(_0x019e('0x6'));var logger=require(_0x019e('0x7'))(_0x019e('0x8'));var config=require(_0x019e('0x9'));var jayson=require(_0x019e('0xa'));var client=jayson[_0x019e('0xb')][_0x019e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35680e,_0x4a49c3,_0x47533d){return new BPromise(function(_0x17c16a,_0x2785c8){return client['request'](_0x35680e,_0x47533d)['then'](function(_0x4079b7){logger[_0x019e('0xd')](_0x019e('0xe'),_0x4a49c3,_0x019e('0xf'));logger[_0x019e('0x10')](_0x019e('0x11'),_0x4a49c3,_0x019e('0xf'),JSON[_0x019e('0x12')](_0x4079b7));if(_0x4079b7[_0x019e('0x13')]){if(_0x4079b7['error'][_0x019e('0x14')]===0x1f4){logger['error'](_0x019e('0xe'),_0x4a49c3,_0x4079b7[_0x019e('0x13')][_0x019e('0x15')]);return _0x2785c8(_0x4079b7[_0x019e('0x13')][_0x019e('0x15')]);}logger[_0x019e('0x13')]('SquareMessage,\x20%s,\x20%s',_0x4a49c3,_0x4079b7[_0x019e('0x13')]['message']);return _0x17c16a(_0x4079b7['error']['message']);}else{logger[_0x019e('0xd')]('SquareMessage,\x20%s,\x20%s',_0x4a49c3,'request\x20sent');_0x17c16a(_0x4079b7[_0x019e('0x16')][_0x019e('0x15')]);}})['catch'](function(_0x453ca1){logger[_0x019e('0x13')]('SquareMessage,\x20%s,\x20%s',_0x4a49c3,_0x453ca1);_0x2785c8(_0x453ca1);});});}exports['CreateSquareMessage']=function(_0x34d1d7){var _0x3e65a9=this;return new Promise(function(_0x27acd4,_0x5b0ef9){return db[_0x019e('0x17')][_0x019e('0x18')](_0x34d1d7[_0x019e('0x19')],{'raw':_0x34d1d7[_0x019e('0x1a')]?_0x34d1d7['options'][_0x019e('0x1b')]===undefined?!![]:![]:!![]})[_0x019e('0x1c')](function(_0x2bc034){logger['info'](_0x019e('0x1d'),_0x34d1d7);logger['debug']('CreateSquareMessage',_0x34d1d7,JSON['stringify'](_0x2bc034));_0x27acd4(_0x2bc034);})[_0x019e('0x1e')](function(_0x3f7232){logger['error'](_0x019e('0x1d'),_0x3f7232['message'],_0x34d1d7);_0x5b0ef9(_0x3e65a9['error'](0x1f4,_0x3f7232[_0x019e('0x15')]));});});}; \ No newline at end of file +var _0x77fe=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareMessage','create','options','raw','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3bb6c0,_0x2a2aaf){var _0x49ade5=function(_0x174001){while(--_0x174001){_0x3bb6c0['push'](_0x3bb6c0['shift']());}};_0x49ade5(++_0x2a2aaf);}(_0x77fe,0x1be));var _0xe77f=function(_0x4d1cf8,_0x4aa563){_0x4d1cf8=_0x4d1cf8-0x0;var _0x1b60dd=_0x77fe[_0x4d1cf8];return _0x1b60dd;};'use strict';var _=require(_0xe77f('0x0'));var util=require(_0xe77f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe77f('0x2'));var fs=require('fs');var Redis=require(_0xe77f('0x3'));var db=require(_0xe77f('0x4'))['db'];var utils=require(_0xe77f('0x5'));var logger=require(_0xe77f('0x6'))(_0xe77f('0x7'));var config=require(_0xe77f('0x8'));var jayson=require(_0xe77f('0x9'));var client=jayson[_0xe77f('0xa')][_0xe77f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x517555,_0x1e69c8,_0x5237d3){return new BPromise(function(_0x33ee34,_0x509a1a){return client[_0xe77f('0xc')](_0x517555,_0x5237d3)['then'](function(_0xd3d8db){logger[_0xe77f('0xd')](_0xe77f('0xe'),_0x1e69c8,_0xe77f('0xf'));logger[_0xe77f('0x10')](_0xe77f('0x11'),_0x1e69c8,_0xe77f('0xf'),JSON['stringify'](_0xd3d8db));if(_0xd3d8db[_0xe77f('0x12')]){if(_0xd3d8db[_0xe77f('0x12')]['code']===0x1f4){logger[_0xe77f('0x12')](_0xe77f('0xe'),_0x1e69c8,_0xd3d8db[_0xe77f('0x12')]['message']);return _0x509a1a(_0xd3d8db[_0xe77f('0x12')][_0xe77f('0x13')]);}logger[_0xe77f('0x12')](_0xe77f('0xe'),_0x1e69c8,_0xd3d8db[_0xe77f('0x12')][_0xe77f('0x13')]);return _0x33ee34(_0xd3d8db[_0xe77f('0x12')][_0xe77f('0x13')]);}else{logger[_0xe77f('0xd')](_0xe77f('0xe'),_0x1e69c8,_0xe77f('0xf'));_0x33ee34(_0xd3d8db[_0xe77f('0x14')][_0xe77f('0x13')]);}})[_0xe77f('0x15')](function(_0x404a04){logger['error']('SquareMessage,\x20%s,\x20%s',_0x1e69c8,_0x404a04);_0x509a1a(_0x404a04);});});}exports[_0xe77f('0x16')]=function(_0x44cc9e){var _0x29117a=this;return new Promise(function(_0x3612d7,_0xde40d0){return db['SquareMessage'][_0xe77f('0x17')](_0x44cc9e['body'],{'raw':_0x44cc9e[_0xe77f('0x18')]?_0x44cc9e[_0xe77f('0x18')][_0xe77f('0x19')]===undefined?!![]:![]:!![]})[_0xe77f('0x1a')](function(_0x34b3b6){logger[_0xe77f('0xd')]('CreateSquareMessage',_0x44cc9e);logger[_0xe77f('0x10')](_0xe77f('0x16'),_0x44cc9e,JSON['stringify'](_0x34b3b6));_0x3612d7(_0x34b3b6);})[_0xe77f('0x15')](function(_0x2997ce){logger['error'](_0xe77f('0x16'),_0x2997ce['message'],_0x44cc9e);_0xde40d0(_0x29117a['error'](0x1f4,_0x2997ce[_0xe77f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e913183..2d3a834 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 _0x3cbb=['Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','/:id/test','15s','test','put','update','exports','multer','path','connect-timeout','express'];(function(_0x3ac7e6,_0x392fe5){var _0x592a9b=function(_0x515656){while(--_0x515656){_0x3ac7e6['push'](_0x3ac7e6['shift']());}};_0x592a9b(++_0x392fe5);}(_0x3cbb,0x1a5));var _0xb3cb=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x3cbb[_0x4b174a];return _0x3cd7bf;};'use strict';var multer=require(_0xb3cb('0x0'));var util=require('util');var path=require(_0xb3cb('0x1'));var timeout=require(_0xb3cb('0x2'));var express=require(_0xb3cb('0x3'));var router=express[_0xb3cb('0x4')]();var fs_extra=require(_0xb3cb('0x5'));var auth=require(_0xb3cb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb3cb('0x7'));var controller=require('./squareOdbc.controller');router[_0xb3cb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb3cb('0x9'),auth[_0xb3cb('0xa')](),controller['show']);router[_0xb3cb('0x8')](_0xb3cb('0xb'),auth[_0xb3cb('0xa')](),timeout(_0xb3cb('0xc')),controller[_0xb3cb('0xd')]);router['post']('/',auth[_0xb3cb('0xa')](),controller['create']);router[_0xb3cb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb3cb('0xf')]);router['delete'](_0xb3cb('0x9'),auth[_0xb3cb('0xa')](),controller['destroy']);module[_0xb3cb('0x10')]=router; \ No newline at end of file +var _0xb8ba=['../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/test','15s','test','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4469a2,_0x57958f){var _0x1c266b=function(_0x23574b){while(--_0x23574b){_0x4469a2['push'](_0x4469a2['shift']());}};_0x1c266b(++_0x57958f);}(_0xb8ba,0x12d));var _0xab8b=function(_0x3ab3e4,_0x5e59c8){_0x3ab3e4=_0x3ab3e4-0x0;var _0x54da86=_0xb8ba[_0x3ab3e4];return _0x54da86;};'use strict';var multer=require(_0xab8b('0x0'));var util=require(_0xab8b('0x1'));var path=require(_0xab8b('0x2'));var timeout=require(_0xab8b('0x3'));var express=require(_0xab8b('0x4'));var router=express[_0xab8b('0x5')]();var fs_extra=require(_0xab8b('0x6'));var auth=require(_0xab8b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xab8b('0x8'));var controller=require('./squareOdbc.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xab8b('0x9')]);router[_0xab8b('0xa')](_0xab8b('0xb'),auth[_0xab8b('0xc')](),controller[_0xab8b('0xd')]);router['get'](_0xab8b('0xe'),auth[_0xab8b('0xc')](),timeout(_0xab8b('0xf')),controller[_0xab8b('0x10')]);router[_0xab8b('0x11')]('/',auth['isAuthenticated'](),controller[_0xab8b('0x12')]);router['put'](_0xab8b('0xb'),auth[_0xab8b('0xc')](),controller[_0xab8b('0x13')]);router['delete'](_0xab8b('0xb'),auth['isAuthenticated'](),controller[_0xab8b('0x14')]);module[_0xab8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2ba65ab..b90d8cc 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 _0x25c7=['sequelize','exports','STRING','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x25c7,0x128));var _0x725c=function(_0x1fcee5,_0x122e35){_0x1fcee5=_0x1fcee5-0x0;var _0x7bb651=_0x25c7[_0x1fcee5];return _0x7bb651;};'use strict';var Sequelize=require(_0x725c('0x0'));module[_0x725c('0x1')]={'name':{'type':Sequelize[_0x725c('0x2')],'unique':_0x725c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x725c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb6d9=['STRING','name','sequelize','exports'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xb6d9,0x9e));var _0x9b6d=function(_0x11d08e,_0x1cd670){_0x11d08e=_0x11d08e-0x0;var _0x19c8cb=_0xb6d9[_0x11d08e];return _0x19c8cb;};'use strict';var Sequelize=require(_0x9b6d('0x0'));module[_0x9b6d('0x1')]={'name':{'type':Sequelize[_0x9b6d('0x2')],'unique':_0x9b6d('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x9b6d('0x2')]},'description':{'type':Sequelize[_0x9b6d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 60b2c29..8e3ac6c 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 _0xb263=['json','offset','limit','undefined','count','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','body','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0xb263,0x123));var _0x3b26=function(_0x53bcfb,_0x2ca4b2){_0x53bcfb=_0x53bcfb-0x0;var _0x1e6f99=_0xb263[_0x53bcfb];return _0x1e6f99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b26('0x0'));var zipdir=require(_0x3b26('0x1'));var jsonpatch=require(_0x3b26('0x2'));var rp=require('request-promise');var moment=require(_0x3b26('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3b26('0x4'));var path=require(_0x3b26('0x5'));var sox=require(_0x3b26('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b26('0x7'));var crypto=require(_0x3b26('0x8'));var jsforce=require(_0x3b26('0x9'));var deskjs=require(_0x3b26('0xa'));var toCsv=require(_0x3b26('0xb'));var querystring=require(_0x3b26('0xc'));var Papa=require(_0x3b26('0xd'));var Redis=require('ioredis');var authService=require(_0x3b26('0xe'));var qs=require(_0x3b26('0xf'));var as=require(_0x3b26('0x10'));var hardwareService=require(_0x3b26('0x11'));var logger=require(_0x3b26('0x12'))(_0x3b26('0x13'));var utils=require(_0x3b26('0x14'));var config=require(_0x3b26('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fa96e,_0x2c7a12){_0x2c7a12=_0x2c7a12||0xcc;return function(_0x33b04f){if(_0x33b04f){return _0x1fa96e[_0x3b26('0x16')](_0x2c7a12);}return _0x1fa96e[_0x3b26('0x17')](_0x2c7a12)[_0x3b26('0x18')]();};}function respondWithResult(_0x239a45,_0x4fb1c1){_0x4fb1c1=_0x4fb1c1||0xc8;return function(_0x1cf93a){if(_0x1cf93a){return _0x239a45[_0x3b26('0x17')](_0x4fb1c1)[_0x3b26('0x19')](_0x1cf93a);}};}function respondWithFilteredResult(_0x4674a8,_0x16b0f6){return function(_0xb8ecc2){if(_0xb8ecc2){var _0x9d6c06=typeof _0x16b0f6[_0x3b26('0x1a')]==='undefined'&&typeof _0x16b0f6[_0x3b26('0x1b')]===_0x3b26('0x1c');var _0x2b3d58=_0xb8ecc2[_0x3b26('0x1d')];var _0x20e90d=_0x9d6c06?0x0:_0x16b0f6[_0x3b26('0x1a')];var _0x4a904a=_0x9d6c06?_0xb8ecc2[_0x3b26('0x1d')]:_0x16b0f6['offset']+_0x16b0f6[_0x3b26('0x1b')];var _0x3b2d25;if(_0x4a904a>=_0x2b3d58){_0x4a904a=_0x2b3d58;_0x3b2d25=0xc8;}else{_0x3b2d25=0xce;}_0x4674a8[_0x3b26('0x17')](_0x3b2d25);return _0x4674a8['set']('Content-Range',_0x20e90d+'-'+_0x4a904a+'/'+_0x2b3d58)[_0x3b26('0x19')](_0xb8ecc2);}return null;};}function patchUpdates(_0x44bbb8){return function(_0x56597e){try{jsonpatch[_0x3b26('0x1e')](_0x56597e,_0x44bbb8,!![]);}catch(_0x1be363){return BPromise['reject'](_0x1be363);}return _0x56597e[_0x3b26('0x1f')]();};}function saveUpdates(_0x197a61,_0x5c1180){return function(_0x623c27){if(_0x623c27){return _0x623c27[_0x3b26('0x20')](_0x197a61)[_0x3b26('0x21')](function(_0x29b22f){return _0x29b22f;});}return null;};}function removeEntity(_0x8cbd65,_0x1597fd){return function(_0x45548f){if(_0x45548f){return _0x45548f[_0x3b26('0x22')]()[_0x3b26('0x21')](function(){var _0x5ceec6=_0x45548f[_0x3b26('0x23')]({'plain':!![]});var _0x42423e=_0x3b26('0x24');return db[_0x3b26('0x25')][_0x3b26('0x22')]({'where':{'type':_0x42423e,'resourceId':_0x5ceec6['id']}})['then'](function(){return _0x45548f;});})[_0x3b26('0x21')](function(){_0x8cbd65[_0x3b26('0x17')](0xcc)[_0x3b26('0x18')]();});}};}function handleEntityNotFound(_0x4b433f,_0x3db184){return function(_0x1b1b93){if(!_0x1b1b93){_0x4b433f[_0x3b26('0x16')](0x194);}return _0x1b1b93;};}function handleError(_0x17938f,_0x2b4801){_0x2b4801=_0x2b4801||0x1f4;return function(_0x282f21){logger[_0x3b26('0x26')](_0x282f21['stack']);if(_0x282f21[_0x3b26('0x27')]){delete _0x282f21[_0x3b26('0x27')];}_0x17938f[_0x3b26('0x17')](_0x2b4801)[_0x3b26('0x28')](_0x282f21);};}exports[_0x3b26('0x29')]=function(_0x4cf06a,_0x40c999){var _0x3f3bb5={},_0x9fed47={},_0x427d5d={'count':0x0,'rows':[]};var _0x47c79f=_[_0x3b26('0x2a')](db[_0x3b26('0x2b')]['rawAttributes'],function(_0x38722e){return{'name':_0x38722e[_0x3b26('0x2c')],'type':_0x38722e[_0x3b26('0x2d')][_0x3b26('0x2e')]};});_0x9fed47[_0x3b26('0x2f')]=_[_0x3b26('0x2a')](_0x47c79f,_0x3b26('0x27'));_0x9fed47[_0x3b26('0x30')]=_['keys'](_0x4cf06a[_0x3b26('0x30')]);_0x9fed47[_0x3b26('0x31')]=_[_0x3b26('0x32')](_0x9fed47[_0x3b26('0x2f')],_0x9fed47[_0x3b26('0x30')]);_0x3f3bb5[_0x3b26('0x33')]=_['intersection'](_0x9fed47[_0x3b26('0x2f')],qs[_0x3b26('0x34')](_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x34')]));_0x3f3bb5['attributes']=_0x3f3bb5[_0x3b26('0x33')]['length']?_0x3f3bb5['attributes']:_0x9fed47[_0x3b26('0x2f')];if(!_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x35')](_0x3b26('0x36'))){_0x3f3bb5[_0x3b26('0x1b')]=qs[_0x3b26('0x1b')](_0x4cf06a['query']['limit']);_0x3f3bb5[_0x3b26('0x1a')]=qs[_0x3b26('0x1a')](_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x1a')]);}_0x3f3bb5[_0x3b26('0x37')]=qs['sort'](_0x4cf06a['query']['sort']);_0x3f3bb5['where']=qs[_0x3b26('0x31')](_[_0x3b26('0x38')](_0x4cf06a['query'],_0x9fed47[_0x3b26('0x31')]),_0x47c79f);if(_0x4cf06a['query'][_0x3b26('0x39')]){_0x3f3bb5[_0x3b26('0x3a')]=_[_0x3b26('0x3b')](_0x3f3bb5[_0x3b26('0x3a')],{'$or':_[_0x3b26('0x2a')](_0x47c79f,function(_0x1726a2){if(_0x1726a2[_0x3b26('0x2d')]!==_0x3b26('0x3c')){var _0x35984a={};_0x35984a[_0x1726a2[_0x3b26('0x27')]]={'$like':'%'+_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x39')]+'%'};return _0x35984a;}})});}_0x3f3bb5=_[_0x3b26('0x3b')]({},_0x3f3bb5,_0x4cf06a[_0x3b26('0x3d')]);var _0xdabd7b={'where':_0x3f3bb5['where']};return db['SquareOdbc'][_0x3b26('0x1d')](_0xdabd7b)[_0x3b26('0x21')](function(_0x40340c){_0x427d5d[_0x3b26('0x1d')]=_0x40340c;if(_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x3e')]){_0x3f3bb5['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x3b26('0x3f')](_0x3f3bb5);})[_0x3b26('0x21')](function(_0x1e1e67){_0x427d5d[_0x3b26('0x40')]=_0x1e1e67;return _0x427d5d;})[_0x3b26('0x21')](respondWithFilteredResult(_0x40c999,_0x3f3bb5))[_0x3b26('0x41')](handleError(_0x40c999,null));};exports['show']=function(_0x371a3c,_0x40320e){var _0x3fcb92={'raw':!![],'where':{'id':_0x371a3c[_0x3b26('0x42')]['id']}},_0x8dc605={};_0x8dc605[_0x3b26('0x2f')]=_['keys'](db[_0x3b26('0x2b')]['rawAttributes']);_0x8dc605[_0x3b26('0x30')]=_['keys'](_0x371a3c['query']);_0x8dc605['filters']=_[_0x3b26('0x32')](_0x8dc605[_0x3b26('0x2f')],_0x8dc605[_0x3b26('0x30')]);_0x3fcb92[_0x3b26('0x33')]=_[_0x3b26('0x32')](_0x8dc605[_0x3b26('0x2f')],qs[_0x3b26('0x34')](_0x371a3c['query'][_0x3b26('0x34')]));_0x3fcb92[_0x3b26('0x33')]=_0x3fcb92['attributes'][_0x3b26('0x43')]?_0x3fcb92[_0x3b26('0x33')]:_0x8dc605[_0x3b26('0x2f')];if(_0x371a3c[_0x3b26('0x30')][_0x3b26('0x3e')]){_0x3fcb92[_0x3b26('0x44')]=[{'all':!![]}];}_0x3fcb92=_['merge']({},_0x3fcb92,_0x371a3c['options']);return db[_0x3b26('0x2b')][_0x3b26('0x45')](_0x3fcb92)['then'](handleEntityNotFound(_0x40320e,null))[_0x3b26('0x21')](respondWithResult(_0x40320e,null))[_0x3b26('0x41')](handleError(_0x40320e,null));};exports[_0x3b26('0x46')]=function(_0x1d8d48,_0x4dca78){return db[_0x3b26('0x2b')]['create'](_0x1d8d48['body'],{})[_0x3b26('0x21')](function(_0x16ea82){var _0x15888e=_0x1d8d48['user'][_0x3b26('0x23')]({'plain':!![]});if(!_0x15888e)throw new Error(_0x3b26('0x47'));if(_0x15888e['role']===_0x3b26('0x48')){var _0x57494c=_0x16ea82[_0x3b26('0x23')]({'plain':!![]});var _0x515add=_0x3b26('0x24');return db[_0x3b26('0x49')]['find']({'where':{'name':_0x515add,'userProfileId':_0x15888e['userProfileId']},'raw':!![]})[_0x3b26('0x21')](function(_0x22b009){if(_0x22b009&&_0x22b009[_0x3b26('0x4a')]===0x0){return db[_0x3b26('0x25')][_0x3b26('0x46')]({'name':_0x57494c[_0x3b26('0x27')],'resourceId':_0x57494c['id'],'type':_0x22b009[_0x3b26('0x27')],'sectionId':_0x22b009['id']},{})[_0x3b26('0x21')](function(){return _0x16ea82;});}else{return _0x16ea82;}})['catch'](function(_0x6209f4){logger[_0x3b26('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6209f4);throw _0x6209f4;});}return _0x16ea82;})['then'](respondWithResult(_0x4dca78,0xc9))[_0x3b26('0x41')](handleError(_0x4dca78,null));};exports['update']=function(_0x141bb1,_0x1d09e2){if(_0x141bb1[_0x3b26('0x4b')]['id']){delete _0x141bb1[_0x3b26('0x4b')]['id'];}return db[_0x3b26('0x2b')][_0x3b26('0x45')]({'where':{'id':_0x141bb1[_0x3b26('0x42')]['id']}})[_0x3b26('0x21')](handleEntityNotFound(_0x1d09e2,null))[_0x3b26('0x21')](saveUpdates(_0x141bb1['body'],null))[_0x3b26('0x21')](respondWithResult(_0x1d09e2,null))[_0x3b26('0x41')](handleError(_0x1d09e2,null));};exports['destroy']=function(_0x430d89,_0xd2aad8){return db['SquareOdbc'][_0x3b26('0x45')]({'where':{'id':_0x430d89[_0x3b26('0x42')]['id']}})['then'](handleEntityNotFound(_0xd2aad8,null))[_0x3b26('0x21')](removeEntity(_0xd2aad8,null))[_0x3b26('0x41')](handleError(_0xd2aad8,null));};exports['test']=function(_0x9a6ed8,_0x94a94b,_0x1ae84e){var _0x1774b4;return db['SquareOdbc'][_0x3b26('0x45')]({'where':{'id':_0x9a6ed8[_0x3b26('0x42')]['id']},'attributes':['id',_0x3b26('0x4c')]})[_0x3b26('0x21')](handleEntityNotFound(_0x94a94b,null))[_0x3b26('0x21')](function(_0x436ec7){if(_0x436ec7){var _0x206ff8=require('odbc')();_0x206ff8[_0x3b26('0x4d')](_0x436ec7[_0x3b26('0x4c')]);_0x206ff8[_0x3b26('0x4e')]();return _0x436ec7;}})[_0x3b26('0x21')](respondWithResult(_0x94a94b,null))[_0x3b26('0x41')](handleError(_0x94a94b,null));}; \ No newline at end of file +var _0x1a58=['then','destroy','get','UserProfileResource','end','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC','userProfileId','autoAssociation','test','dsn','odbc','openSync','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update'];(function(_0x32edbf,_0x4fda99){var _0xb6bdf5=function(_0x3b4fd2){while(--_0x3b4fd2){_0x32edbf['push'](_0x32edbf['shift']());}};_0xb6bdf5(++_0x4fda99);}(_0x1a58,0x1e1));var _0x81a5=function(_0xb53ca5,_0x435d3f){_0xb53ca5=_0xb53ca5-0x0;var _0x11f18e=_0x1a58[_0xb53ca5];return _0x11f18e;};'use strict';var emlformat=require(_0x81a5('0x0'));var rimraf=require(_0x81a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x81a5('0x2'));var Mustache=require(_0x81a5('0x3'));var util=require(_0x81a5('0x4'));var path=require(_0x81a5('0x5'));var sox=require(_0x81a5('0x6'));var csv=require(_0x81a5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81a5('0x8'));var _=require(_0x81a5('0x9'));var squel=require(_0x81a5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x81a5('0xb'));var toCsv=require(_0x81a5('0x7'));var querystring=require(_0x81a5('0xc'));var Papa=require(_0x81a5('0xd'));var Redis=require(_0x81a5('0xe'));var authService=require(_0x81a5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81a5('0x10'));var logger=require(_0x81a5('0x11'))(_0x81a5('0x12'));var utils=require(_0x81a5('0x13'));var config=require(_0x81a5('0x14'));var licenseUtil=require(_0x81a5('0x15'));var db=require(_0x81a5('0x16'))['db'];function respondWithStatusCode(_0x1769f0,_0x9b28da){_0x9b28da=_0x9b28da||0xcc;return function(_0x32c499){if(_0x32c499){return _0x1769f0[_0x81a5('0x17')](_0x9b28da);}return _0x1769f0[_0x81a5('0x18')](_0x9b28da)['end']();};}function respondWithResult(_0x1b5816,_0x22eac2){_0x22eac2=_0x22eac2||0xc8;return function(_0x228bc1){if(_0x228bc1){return _0x1b5816[_0x81a5('0x18')](_0x22eac2)['json'](_0x228bc1);}};}function respondWithFilteredResult(_0x33ff2b,_0x100c10){return function(_0x254fcd){if(_0x254fcd){var _0x34302e=typeof _0x100c10[_0x81a5('0x19')]===_0x81a5('0x1a')&&typeof _0x100c10[_0x81a5('0x1b')]===_0x81a5('0x1a');var _0x49cd49=_0x254fcd['count'];var _0x2148a1=_0x34302e?0x0:_0x100c10[_0x81a5('0x19')];var _0x11766b=_0x34302e?_0x254fcd[_0x81a5('0x1c')]:_0x100c10[_0x81a5('0x19')]+_0x100c10['limit'];var _0x12fe3b;if(_0x11766b>=_0x49cd49){_0x11766b=_0x49cd49;_0x12fe3b=0xc8;}else{_0x12fe3b=0xce;}_0x33ff2b['status'](_0x12fe3b);return _0x33ff2b[_0x81a5('0x1d')](_0x81a5('0x1e'),_0x2148a1+'-'+_0x11766b+'/'+_0x49cd49)[_0x81a5('0x1f')](_0x254fcd);}return null;};}function patchUpdates(_0x7a0f71){return function(_0x3faa73){try{jsonpatch['apply'](_0x3faa73,_0x7a0f71,!![]);}catch(_0x5bc073){return BPromise[_0x81a5('0x20')](_0x5bc073);}return _0x3faa73[_0x81a5('0x21')]();};}function saveUpdates(_0x27ef50,_0x1804d1){return function(_0x3109e7){if(_0x3109e7){return _0x3109e7[_0x81a5('0x22')](_0x27ef50)[_0x81a5('0x23')](function(_0x4ece17){return _0x4ece17;});}return null;};}function removeEntity(_0x4461cd,_0x4ac377){return function(_0x45c781){if(_0x45c781){return _0x45c781[_0x81a5('0x24')]()['then'](function(){var _0x3fd5cd=_0x45c781[_0x81a5('0x25')]({'plain':!![]});var _0x56169d='ODBC';return db[_0x81a5('0x26')]['destroy']({'where':{'type':_0x56169d,'resourceId':_0x3fd5cd['id']}})['then'](function(){return _0x45c781;});})[_0x81a5('0x23')](function(){_0x4461cd[_0x81a5('0x18')](0xcc)[_0x81a5('0x27')]();});}};}function handleEntityNotFound(_0x419d27,_0x466046){return function(_0x39a959){if(!_0x39a959){_0x419d27[_0x81a5('0x17')](0x194);}return _0x39a959;};}function handleError(_0x32e1d8,_0x3217eb){_0x3217eb=_0x3217eb||0x1f4;return function(_0x432ffc){logger[_0x81a5('0x28')](_0x432ffc['stack']);if(_0x432ffc['name']){delete _0x432ffc[_0x81a5('0x29')];}_0x32e1d8[_0x81a5('0x18')](_0x3217eb)[_0x81a5('0x2a')](_0x432ffc);};}exports[_0x81a5('0x2b')]=function(_0x5d0c20,_0x15e887){var _0x8bc634={},_0x2a6c47={},_0x26aa11={'count':0x0,'rows':[]};var _0x30e8f5=_[_0x81a5('0x2c')](db[_0x81a5('0x2d')][_0x81a5('0x2e')],function(_0x32ffc7){return{'name':_0x32ffc7[_0x81a5('0x2f')],'type':_0x32ffc7['type'][_0x81a5('0x30')]};});_0x2a6c47['model']=_['map'](_0x30e8f5,_0x81a5('0x29'));_0x2a6c47['query']=_['keys'](_0x5d0c20[_0x81a5('0x31')]);_0x2a6c47['filters']=_[_0x81a5('0x32')](_0x2a6c47[_0x81a5('0x33')],_0x2a6c47[_0x81a5('0x31')]);_0x8bc634[_0x81a5('0x34')]=_[_0x81a5('0x32')](_0x2a6c47[_0x81a5('0x33')],qs[_0x81a5('0x35')](_0x5d0c20[_0x81a5('0x31')][_0x81a5('0x35')]));_0x8bc634['attributes']=_0x8bc634[_0x81a5('0x34')][_0x81a5('0x36')]?_0x8bc634[_0x81a5('0x34')]:_0x2a6c47['model'];if(!_0x5d0c20['query'][_0x81a5('0x37')](_0x81a5('0x38'))){_0x8bc634[_0x81a5('0x1b')]=qs['limit'](_0x5d0c20[_0x81a5('0x31')][_0x81a5('0x1b')]);_0x8bc634[_0x81a5('0x19')]=qs[_0x81a5('0x19')](_0x5d0c20['query'][_0x81a5('0x19')]);}_0x8bc634[_0x81a5('0x39')]=qs[_0x81a5('0x3a')](_0x5d0c20['query'][_0x81a5('0x3a')]);_0x8bc634[_0x81a5('0x3b')]=qs['filters'](_['pick'](_0x5d0c20['query'],_0x2a6c47[_0x81a5('0x3c')]),_0x30e8f5);if(_0x5d0c20[_0x81a5('0x31')][_0x81a5('0x3d')]){_0x8bc634[_0x81a5('0x3b')]=_['merge'](_0x8bc634[_0x81a5('0x3b')],{'$or':_['map'](_0x30e8f5,function(_0x150af6){if(_0x150af6[_0x81a5('0x3e')]!==_0x81a5('0x3f')){var _0x2f0e14={};_0x2f0e14[_0x150af6[_0x81a5('0x29')]]={'$like':'%'+_0x5d0c20[_0x81a5('0x31')][_0x81a5('0x3d')]+'%'};return _0x2f0e14;}})});}_0x8bc634=_[_0x81a5('0x40')]({},_0x8bc634,_0x5d0c20[_0x81a5('0x41')]);var _0x444d93={'where':_0x8bc634[_0x81a5('0x3b')]};return db[_0x81a5('0x2d')][_0x81a5('0x1c')](_0x444d93)[_0x81a5('0x23')](function(_0x590556){_0x26aa11[_0x81a5('0x1c')]=_0x590556;if(_0x5d0c20[_0x81a5('0x31')][_0x81a5('0x42')]){_0x8bc634[_0x81a5('0x43')]=[{'all':!![]}];}return db[_0x81a5('0x2d')][_0x81a5('0x44')](_0x8bc634);})[_0x81a5('0x23')](function(_0x391523){_0x26aa11[_0x81a5('0x45')]=_0x391523;return _0x26aa11;})[_0x81a5('0x23')](respondWithFilteredResult(_0x15e887,_0x8bc634))[_0x81a5('0x46')](handleError(_0x15e887,null));};exports[_0x81a5('0x47')]=function(_0x58e492,_0x2b16f1){var _0x2f8b0d={'raw':!![],'where':{'id':_0x58e492[_0x81a5('0x48')]['id']}},_0x2c2e64={};_0x2c2e64[_0x81a5('0x33')]=_[_0x81a5('0x49')](db[_0x81a5('0x2d')]['rawAttributes']);_0x2c2e64['query']=_[_0x81a5('0x49')](_0x58e492['query']);_0x2c2e64[_0x81a5('0x3c')]=_[_0x81a5('0x32')](_0x2c2e64[_0x81a5('0x33')],_0x2c2e64[_0x81a5('0x31')]);_0x2f8b0d[_0x81a5('0x34')]=_['intersection'](_0x2c2e64[_0x81a5('0x33')],qs['fields'](_0x58e492['query'][_0x81a5('0x35')]));_0x2f8b0d['attributes']=_0x2f8b0d[_0x81a5('0x34')][_0x81a5('0x36')]?_0x2f8b0d[_0x81a5('0x34')]:_0x2c2e64['model'];if(_0x58e492['query'][_0x81a5('0x42')]){_0x2f8b0d[_0x81a5('0x43')]=[{'all':!![]}];}_0x2f8b0d=_[_0x81a5('0x40')]({},_0x2f8b0d,_0x58e492[_0x81a5('0x41')]);return db[_0x81a5('0x2d')][_0x81a5('0x4a')](_0x2f8b0d)[_0x81a5('0x23')](handleEntityNotFound(_0x2b16f1,null))[_0x81a5('0x23')](respondWithResult(_0x2b16f1,null))[_0x81a5('0x46')](handleError(_0x2b16f1,null));};exports[_0x81a5('0x4b')]=function(_0x27233e,_0x29c661){return db[_0x81a5('0x2d')][_0x81a5('0x4b')](_0x27233e[_0x81a5('0x4c')],{})[_0x81a5('0x23')](function(_0x15cbc4){var _0x43cb33=_0x27233e[_0x81a5('0x4d')]['get']({'plain':!![]});if(!_0x43cb33)throw new Error(_0x81a5('0x4e'));if(_0x43cb33['role']===_0x81a5('0x4d')){var _0x21abcd=_0x15cbc4[_0x81a5('0x25')]({'plain':!![]});var _0xfba403=_0x81a5('0x4f');return db['UserProfileSection'][_0x81a5('0x4a')]({'where':{'name':_0xfba403,'userProfileId':_0x43cb33[_0x81a5('0x50')]},'raw':!![]})[_0x81a5('0x23')](function(_0x201c10){if(_0x201c10&&_0x201c10[_0x81a5('0x51')]===0x0){return db[_0x81a5('0x26')][_0x81a5('0x4b')]({'name':_0x21abcd[_0x81a5('0x29')],'resourceId':_0x21abcd['id'],'type':_0x201c10[_0x81a5('0x29')],'sectionId':_0x201c10['id']},{})[_0x81a5('0x23')](function(){return _0x15cbc4;});}else{return _0x15cbc4;}})[_0x81a5('0x46')](function(_0x34b3e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34b3e1);throw _0x34b3e1;});}return _0x15cbc4;})['then'](respondWithResult(_0x29c661,0xc9))[_0x81a5('0x46')](handleError(_0x29c661,null));};exports[_0x81a5('0x22')]=function(_0x20bc06,_0x2e4379){if(_0x20bc06[_0x81a5('0x4c')]['id']){delete _0x20bc06[_0x81a5('0x4c')]['id'];}return db[_0x81a5('0x2d')][_0x81a5('0x4a')]({'where':{'id':_0x20bc06[_0x81a5('0x48')]['id']}})[_0x81a5('0x23')](handleEntityNotFound(_0x2e4379,null))['then'](saveUpdates(_0x20bc06[_0x81a5('0x4c')],null))[_0x81a5('0x23')](respondWithResult(_0x2e4379,null))['catch'](handleError(_0x2e4379,null));};exports[_0x81a5('0x24')]=function(_0x3fe4ef,_0x1f8254){return db['SquareOdbc'][_0x81a5('0x4a')]({'where':{'id':_0x3fe4ef['params']['id']}})['then'](handleEntityNotFound(_0x1f8254,null))[_0x81a5('0x23')](removeEntity(_0x1f8254,null))[_0x81a5('0x46')](handleError(_0x1f8254,null));};exports[_0x81a5('0x52')]=function(_0x282505,_0x4d77ad,_0xb944bb){var _0x3ff0b4;return db[_0x81a5('0x2d')]['find']({'where':{'id':_0x282505['params']['id']},'attributes':['id',_0x81a5('0x53')]})[_0x81a5('0x23')](handleEntityNotFound(_0x4d77ad,null))[_0x81a5('0x23')](function(_0xc6dc3){if(_0xc6dc3){var _0x344ed3=require(_0x81a5('0x54'))();_0x344ed3[_0x81a5('0x55')](_0xc6dc3['dsn']);_0x344ed3['closeSync']();return _0xc6dc3;}})[_0x81a5('0x23')](respondWithResult(_0x4d77ad,null))['catch'](handleError(_0x4d77ad,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0ba65ab..abc314d 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 _0x25dd=['../../config/environment','./squareOdbc.attributes','exports','define','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x20e229,_0x2f599e){var _0x30cc44=function(_0x1d6004){while(--_0x1d6004){_0x20e229['push'](_0x20e229['shift']());}};_0x30cc44(++_0x2f599e);}(_0x25dd,0x9e));var _0xd25d=function(_0x9e9b7b,_0x11465e){_0x9e9b7b=_0x9e9b7b-0x0;var _0x3c73ea=_0x25dd[_0x9e9b7b];return _0x3c73ea;};'use strict';var _=require('lodash');var util=require(_0xd25d('0x0'));var logger=require(_0xd25d('0x1'))(_0xd25d('0x2'));var moment=require(_0xd25d('0x3'));var BPromise=require('bluebird');var rp=require(_0xd25d('0x4'));var fs=require('fs');var path=require(_0xd25d('0x5'));var rimraf=require(_0xd25d('0x6'));var config=require(_0xd25d('0x7'));var attributes=require(_0xd25d('0x8'));module[_0xd25d('0x9')]=function(_0x4623bf,_0xaacbce){return _0x4623bf[_0xd25d('0xa')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdefa=['util','../../config/logger','api','moment','path','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash'];(function(_0x323921,_0x25ecdd){var _0x54ae0d=function(_0x4da983){while(--_0x4da983){_0x323921['push'](_0x323921['shift']());}};_0x54ae0d(++_0x25ecdd);}(_0xdefa,0xdb));var _0xadef=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdefa[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xadef('0x0'));var util=require(_0xadef('0x1'));var logger=require(_0xadef('0x2'))(_0xadef('0x3'));var moment=require(_0xadef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xadef('0x5'));var rimraf=require('rimraf');var config=require(_0xadef('0x6'));var attributes=require(_0xadef('0x7'));module[_0xadef('0x8')]=function(_0x234e0a,_0x30b522){return _0x234e0a['define'](_0xadef('0x9'),attributes,{'tableName':_0xadef('0xa'),'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 fbc506d..787ec20 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 _0xea74=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','SquareOdbc','find','options','raw','where','attributes','map','include','model','ShowSquareOdbc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea74,0x1f1));var _0x4ea7=function(_0x5c6b0c,_0x5d7414){_0x5c6b0c=_0x5c6b0c-0x0;var _0x1e7e5c=_0xea74[_0x5c6b0c];return _0x1e7e5c;};'use strict';var _=require(_0x4ea7('0x0'));var util=require('util');var moment=require(_0x4ea7('0x1'));var BPromise=require(_0x4ea7('0x2'));var rs=require(_0x4ea7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ea7('0x5'))('rpc');var config=require(_0x4ea7('0x6'));var jayson=require(_0x4ea7('0x7'));var client=jayson[_0x4ea7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18fce2,_0x512bd6,_0x49628c){return new BPromise(function(_0x4bfa34,_0x1ec639){return client[_0x4ea7('0x9')](_0x18fce2,_0x49628c)[_0x4ea7('0xa')](function(_0x45fe4a){logger['info'](_0x4ea7('0xb'),_0x512bd6,'request\x20sent');logger['debug'](_0x4ea7('0xc'),_0x512bd6,_0x4ea7('0xd'),JSON['stringify'](_0x45fe4a));if(_0x45fe4a[_0x4ea7('0xe')]){if(_0x45fe4a[_0x4ea7('0xe')][_0x4ea7('0xf')]===0x1f4){logger['error'](_0x4ea7('0xb'),_0x512bd6,_0x45fe4a['error'][_0x4ea7('0x10')]);return _0x1ec639(_0x45fe4a[_0x4ea7('0xe')][_0x4ea7('0x10')]);}logger[_0x4ea7('0xe')](_0x4ea7('0xb'),_0x512bd6,_0x45fe4a[_0x4ea7('0xe')][_0x4ea7('0x10')]);return _0x4bfa34(_0x45fe4a['error'][_0x4ea7('0x10')]);}else{logger[_0x4ea7('0x11')](_0x4ea7('0xb'),_0x512bd6,_0x4ea7('0xd'));_0x4bfa34(_0x45fe4a[_0x4ea7('0x12')]['message']);}})[_0x4ea7('0x13')](function(_0x493695){logger[_0x4ea7('0xe')](_0x4ea7('0xb'),_0x512bd6,_0x493695);_0x1ec639(_0x493695);});});}exports['ShowSquareOdbc']=function(_0x327ea6){var _0x5afafb=this;return new Promise(function(_0x4772ff,_0x330d5f){return db[_0x4ea7('0x14')][_0x4ea7('0x15')]({'raw':_0x327ea6[_0x4ea7('0x16')]?_0x327ea6[_0x4ea7('0x16')][_0x4ea7('0x17')]===undefined?!![]:![]:!![],'where':_0x327ea6[_0x4ea7('0x16')]?_0x327ea6[_0x4ea7('0x16')][_0x4ea7('0x18')]||null:null,'attributes':_0x327ea6[_0x4ea7('0x16')]?_0x327ea6[_0x4ea7('0x16')][_0x4ea7('0x19')]||null:null,'include':_0x327ea6[_0x4ea7('0x16')]?_0x327ea6[_0x4ea7('0x16')]['include']?_[_0x4ea7('0x1a')](_0x327ea6[_0x4ea7('0x16')][_0x4ea7('0x1b')],function(_0x2aa5eb){return{'model':db[_0x2aa5eb[_0x4ea7('0x1c')]],'as':_0x2aa5eb['as'],'attributes':_0x2aa5eb['attributes'],'include':_0x2aa5eb[_0x4ea7('0x1b')]?_[_0x4ea7('0x1a')](_0x2aa5eb[_0x4ea7('0x1b')],function(_0x17e25d){return{'model':db[_0x17e25d[_0x4ea7('0x1c')]],'as':_0x17e25d['as'],'attributes':_0x17e25d[_0x4ea7('0x19')],'include':_0x17e25d['include']?_[_0x4ea7('0x1a')](_0x17e25d[_0x4ea7('0x1b')],function(_0x55f4f1){return{'model':db[_0x55f4f1[_0x4ea7('0x1c')]],'as':_0x55f4f1['as'],'attributes':_0x55f4f1[_0x4ea7('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c60bf){logger[_0x4ea7('0x11')](_0x4ea7('0x1d'),_0x327ea6);logger[_0x4ea7('0x1e')](_0x4ea7('0x1d'),_0x327ea6,JSON['stringify'](_0x3c60bf));_0x4772ff(_0x3c60bf);})['catch'](function(_0x36dbf7){logger[_0x4ea7('0xe')]('ShowSquareOdbc',_0x36dbf7['message'],_0x327ea6);_0x330d5f(_0x5afafb[_0x4ea7('0xe')](0x1f4,_0x36dbf7[_0x4ea7('0x10')]));});});}; \ No newline at end of file +var _0xa1d1=['ShowSquareOdbc','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareOdbc','find','options','where','attributes','include','map','model','then'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0xa1d1,0xe8));var _0x1a1d=function(_0x299991,_0x58b19b){_0x299991=_0x299991-0x0;var _0x36192a=_0xa1d1[_0x299991];return _0x36192a;};'use strict';var _=require(_0x1a1d('0x0'));var util=require(_0x1a1d('0x1'));var moment=require(_0x1a1d('0x2'));var BPromise=require(_0x1a1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a1d('0x4'));var db=require(_0x1a1d('0x5'))['db'];var utils=require(_0x1a1d('0x6'));var logger=require(_0x1a1d('0x7'))(_0x1a1d('0x8'));var config=require(_0x1a1d('0x9'));var jayson=require(_0x1a1d('0xa'));var client=jayson[_0x1a1d('0xb')][_0x1a1d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x105678,_0x2aed34,_0x19e0fd){return new BPromise(function(_0x4df4a1,_0x4ebb41){return client['request'](_0x105678,_0x19e0fd)['then'](function(_0x20ea68){logger[_0x1a1d('0xd')](_0x1a1d('0xe'),_0x2aed34,_0x1a1d('0xf'));logger[_0x1a1d('0x10')](_0x1a1d('0x11'),_0x2aed34,_0x1a1d('0xf'),JSON[_0x1a1d('0x12')](_0x20ea68));if(_0x20ea68[_0x1a1d('0x13')]){if(_0x20ea68[_0x1a1d('0x13')][_0x1a1d('0x14')]===0x1f4){logger['error'](_0x1a1d('0xe'),_0x2aed34,_0x20ea68[_0x1a1d('0x13')][_0x1a1d('0x15')]);return _0x4ebb41(_0x20ea68[_0x1a1d('0x13')]['message']);}logger['error'](_0x1a1d('0xe'),_0x2aed34,_0x20ea68[_0x1a1d('0x13')]['message']);return _0x4df4a1(_0x20ea68['error'][_0x1a1d('0x15')]);}else{logger[_0x1a1d('0xd')](_0x1a1d('0xe'),_0x2aed34,_0x1a1d('0xf'));_0x4df4a1(_0x20ea68['result'][_0x1a1d('0x15')]);}})[_0x1a1d('0x16')](function(_0x49fa67){logger[_0x1a1d('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x2aed34,_0x49fa67);_0x4ebb41(_0x49fa67);});});}exports['ShowSquareOdbc']=function(_0x2c113f){var _0x2a847f=this;return new Promise(function(_0x48974e,_0x1e7fe8){return db[_0x1a1d('0x17')][_0x1a1d('0x18')]({'raw':_0x2c113f[_0x1a1d('0x19')]?_0x2c113f[_0x1a1d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2c113f[_0x1a1d('0x19')]?_0x2c113f['options'][_0x1a1d('0x1a')]||null:null,'attributes':_0x2c113f['options']?_0x2c113f[_0x1a1d('0x19')][_0x1a1d('0x1b')]||null:null,'include':_0x2c113f[_0x1a1d('0x19')]?_0x2c113f['options'][_0x1a1d('0x1c')]?_[_0x1a1d('0x1d')](_0x2c113f[_0x1a1d('0x19')][_0x1a1d('0x1c')],function(_0x130afa){return{'model':db[_0x130afa[_0x1a1d('0x1e')]],'as':_0x130afa['as'],'attributes':_0x130afa['attributes'],'include':_0x130afa[_0x1a1d('0x1c')]?_[_0x1a1d('0x1d')](_0x130afa[_0x1a1d('0x1c')],function(_0x1962ee){return{'model':db[_0x1962ee[_0x1a1d('0x1e')]],'as':_0x1962ee['as'],'attributes':_0x1962ee[_0x1a1d('0x1b')],'include':_0x1962ee[_0x1a1d('0x1c')]?_[_0x1a1d('0x1d')](_0x1962ee[_0x1a1d('0x1c')],function(_0x13c0be){return{'model':db[_0x13c0be['model']],'as':_0x13c0be['as'],'attributes':_0x13c0be['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a1d('0x1f')](function(_0xad3c36){logger[_0x1a1d('0xd')](_0x1a1d('0x20'),_0x2c113f);logger[_0x1a1d('0x10')]('ShowSquareOdbc',_0x2c113f,JSON[_0x1a1d('0x12')](_0xad3c36));_0x48974e(_0xad3c36);})['catch'](function(_0x29f21f){logger[_0x1a1d('0x13')]('ShowSquareOdbc',_0x29f21f[_0x1a1d('0x15')],_0x2c113f);_0x1e7fe8(_0x2a847f['error'](0x1f4,_0x29f21f[_0x1a1d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4451e07..d449f77 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 _0x77d6=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','post','put','delete','exports','util'];(function(_0x1811a7,_0x796845){var _0x309947=function(_0x42fc70){while(--_0x42fc70){_0x1811a7['push'](_0x1811a7['shift']());}};_0x309947(++_0x796845);}(_0x77d6,0x120));var _0x677d=function(_0x25356d,_0x3c07d9){_0x25356d=_0x25356d-0x0;var _0x272a46=_0x77d6[_0x25356d];return _0x272a46;};'use strict';var multer=require('multer');var util=require(_0x677d('0x0'));var path=require(_0x677d('0x1'));var timeout=require(_0x677d('0x2'));var express=require(_0x677d('0x3'));var router=express[_0x677d('0x4')]();var fs_extra=require(_0x677d('0x5'));var auth=require(_0x677d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x677d('0x7'));var controller=require(_0x677d('0x8'));router[_0x677d('0x9')]('/',auth['isAuthenticated'](),controller[_0x677d('0xa')]);router[_0x677d('0x9')](_0x677d('0xb'),auth[_0x677d('0xc')](),controller['show']);router[_0x677d('0xd')]('/',auth[_0x677d('0xc')](),controller['create']);router[_0x677d('0xe')](_0x677d('0xb'),auth[_0x677d('0xc')](),controller['update']);router[_0x677d('0xf')](_0x677d('0xb'),auth[_0x677d('0xc')](),controller['destroy']);module[_0x677d('0x10')]=router; \ No newline at end of file +var _0x97a5=['show','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','get','/:id','isAuthenticated'];(function(_0xe194ee,_0x2b0579){var _0x5af33c=function(_0x184169){while(--_0x184169){_0xe194ee['push'](_0xe194ee['shift']());}};_0x5af33c(++_0x2b0579);}(_0x97a5,0x195));var _0x597a=function(_0xa79afb,_0x4fc78f){_0xa79afb=_0xa79afb-0x0;var _0x33ccb8=_0x97a5[_0xa79afb];return _0x33ccb8;};'use strict';var multer=require(_0x597a('0x0'));var util=require(_0x597a('0x1'));var path=require(_0x597a('0x2'));var timeout=require(_0x597a('0x3'));var express=require(_0x597a('0x4'));var router=express[_0x597a('0x5')]();var fs_extra=require(_0x597a('0x6'));var auth=require(_0x597a('0x7'));var interaction=require(_0x597a('0x8'));var config=require(_0x597a('0x9'));var controller=require(_0x597a('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x597a('0xb')]);router[_0x597a('0xc')](_0x597a('0xd'),auth[_0x597a('0xe')](),controller[_0x597a('0xf')]);router['post']('/',auth[_0x597a('0xe')](),controller[_0x597a('0x10')]);router[_0x597a('0x11')](_0x597a('0xd'),auth[_0x597a('0xe')](),controller[_0x597a('0x12')]);router['delete'](_0x597a('0xd'),auth[_0x597a('0xe')](),controller['destroy']);module[_0x597a('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9cf73e3..e24df61 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 _0x74a7=['production','DATE','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x1d2cd,_0x5b4e3f){var _0x214827=function(_0x2645b9){while(--_0x2645b9){_0x1d2cd['push'](_0x1d2cd['shift']());}};_0x214827(++_0x5b4e3f);}(_0x74a7,0x91));var _0x774a=function(_0x1ab6b1,_0x430845){_0x1ab6b1=_0x1ab6b1-0x0;var _0x18a719=_0x74a7[_0x1ab6b1];return _0x18a719;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x774a('0x0')],'unique':_0x774a('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x774a('0x2')]},'preproduction':{'type':Sequelize[_0x774a('0x3')](_0x774a('0x4')),'get':function(){if(this[_0x774a('0x5')]('preproduction')){return this[_0x774a('0x5')](_0x774a('0x6'))[_0x774a('0x7')](_0x774a('0x8'));}}},'production':{'type':Sequelize[_0x774a('0x3')](_0x774a('0x4')),'get':function(){if(this['getDataValue'](_0x774a('0x9'))){return this[_0x774a('0x5')](_0x774a('0x9'))[_0x774a('0x7')](_0x774a('0x8'));}}},'savedAt':{'type':Sequelize[_0x774a('0xa')]},'publishedAt':{'type':Sequelize[_0x774a('0xa')]}}; \ No newline at end of file +var _0xa3db=['name','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','sequelize','exports','STRING'];(function(_0x53fbb0,_0x455217){var _0x482d7d=function(_0x5ab559){while(--_0x5ab559){_0x53fbb0['push'](_0x53fbb0['shift']());}};_0x482d7d(++_0x455217);}(_0xa3db,0x183));var _0xba3d=function(_0x483591,_0x57104e){_0x483591=_0x483591-0x0;var _0x3536c0=_0xa3db[_0x483591];return _0x3536c0;};'use strict';var Sequelize=require(_0xba3d('0x0'));module[_0xba3d('0x1')]={'name':{'type':Sequelize[_0xba3d('0x2')],'unique':_0xba3d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xba3d('0x2')]},'notes':{'type':Sequelize[_0xba3d('0x4')]},'preproduction':{'type':Sequelize[_0xba3d('0x5')]('long'),'get':function(){if(this[_0xba3d('0x6')](_0xba3d('0x7'))){return this[_0xba3d('0x6')]('preproduction')[_0xba3d('0x8')](_0xba3d('0x9'));}}},'production':{'type':Sequelize[_0xba3d('0x5')](_0xba3d('0xa')),'get':function(){if(this['getDataValue'](_0xba3d('0xb'))){return this[_0xba3d('0x6')](_0xba3d('0xb'))[_0xba3d('0x8')](_0xba3d('0x9'));}}},'savedAt':{'type':Sequelize[_0xba3d('0xc')]},'publishedAt':{'type':Sequelize[_0xba3d('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 19040ed..968ccee 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 _0x12d7=['update','then','destroy','get','SquareProjects','publish','agi','stringify','sendStatus','name','send','index','map','SquareProject','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./squareProject.socket','status','json','offset','limit','undefined','count','set'];(function(_0x713978,_0x1a9ddf){var _0x2730ee=function(_0x35d6df){while(--_0x35d6df){_0x713978['push'](_0x713978['shift']());}};_0x2730ee(++_0x1a9ddf);}(_0x12d7,0x139));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var Redis=require(_0x712d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x712d('0x2'))(_0x712d('0x3'));var config=require(_0x712d('0x4'));var db=require(_0x712d('0x5'))['db'];config['redis']=_[_0x712d('0x6')](config['redis'],{'host':_0x712d('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x712d('0x8')]));require(_0x712d('0x9'))['register'](socket);function respondWithResult(_0x1c7a59,_0x2e642b){_0x2e642b=_0x2e642b||0xc8;return function(_0x1038e9){if(_0x1038e9){return _0x1c7a59[_0x712d('0xa')](_0x2e642b)[_0x712d('0xb')](_0x1038e9);}};}function respondWithFilteredResult(_0x5e5491,_0xd2ba46){return function(_0x3e9056){if(_0x3e9056){var _0x17436a=typeof _0xd2ba46[_0x712d('0xc')]==='undefined'&&typeof _0xd2ba46[_0x712d('0xd')]===_0x712d('0xe');var _0x3825cb=_0x3e9056['count'];var _0x88f9c8=_0x17436a?0x0:_0xd2ba46[_0x712d('0xc')];var _0x5027dc=_0x17436a?_0x3e9056[_0x712d('0xf')]:_0xd2ba46['offset']+_0xd2ba46['limit'];var _0x100166;if(_0x5027dc>=_0x3825cb){_0x5027dc=_0x3825cb;_0x100166=0xc8;}else{_0x100166=0xce;}_0x5e5491[_0x712d('0xa')](_0x100166);return _0x5e5491[_0x712d('0x10')]('Content-Range',_0x88f9c8+'-'+_0x5027dc+'/'+_0x3825cb)[_0x712d('0xb')](_0x3e9056);}return null;};}function saveUpdates(_0xfcba3b){return function(_0x20d0c1){if(_0x20d0c1){return _0x20d0c1[_0x712d('0x11')](_0xfcba3b)[_0x712d('0x12')](function(_0x4c7cd3){return _0x4c7cd3;});}return null;};}function removeEntity(_0xb9e8a){return function(_0x48c388){if(_0x48c388){return _0x48c388[_0x712d('0x13')]()[_0x712d('0x12')](function(){var _0x576216=_0x48c388[_0x712d('0x14')]({'plain':!![]});var _0x50adcb=_0x712d('0x15');return db['UserProfileResource'][_0x712d('0x13')]({'where':{'type':_0x50adcb,'resourceId':_0x576216['id']}})['then'](function(){return _0x48c388;});})[_0x712d('0x12')](function(){var _0x3557f5=new Redis(config['redis']);_0x3557f5[_0x712d('0x16')](_0x712d('0x17'),JSON[_0x712d('0x18')]({'id':_0x48c388['id'],'deleted':!![]}));})[_0x712d('0x12')](function(){_0xb9e8a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5d8a){return function(_0x5980e8){if(!_0x5980e8){_0x1c5d8a[_0x712d('0x19')](0x194);}return _0x5980e8;};}function handleError(_0x338cbc,_0x4c0a45){_0x4c0a45=_0x4c0a45||0x1f4;return function(_0x2720e9){logger['error'](_0x2720e9['stack']);if(_0x2720e9[_0x712d('0x1a')]){delete _0x2720e9[_0x712d('0x1a')];}_0x338cbc[_0x712d('0xa')](_0x4c0a45)[_0x712d('0x1b')](_0x2720e9);};}exports[_0x712d('0x1c')]=function(_0x32b467,_0x4f7ee1){var _0x294b38={},_0x5a8069={},_0x4d3ab8={'count':0x0,'rows':[]};var _0x657952=_[_0x712d('0x1d')](db[_0x712d('0x1e')]['rawAttributes'],function(_0x4f0600){return{'name':_0x4f0600[_0x712d('0x1f')],'type':_0x4f0600[_0x712d('0x20')][_0x712d('0x21')]};});_0x5a8069['model']=_['map'](_0x657952,_0x712d('0x1a'));_0x5a8069[_0x712d('0x22')]=_[_0x712d('0x23')](_0x32b467[_0x712d('0x22')]);_0x5a8069[_0x712d('0x24')]=_['intersection'](_0x5a8069[_0x712d('0x25')],_0x5a8069['query']);_0x294b38['attributes']=_[_0x712d('0x26')](_0x5a8069['model'],qs[_0x712d('0x27')](_0x32b467[_0x712d('0x22')]['fields']));_0x294b38[_0x712d('0x28')]=_0x294b38[_0x712d('0x28')][_0x712d('0x29')]?_0x294b38['attributes']:_0x5a8069[_0x712d('0x25')];if(!_0x32b467[_0x712d('0x22')][_0x712d('0x2a')]('nolimit')){_0x294b38[_0x712d('0xd')]=qs['limit'](_0x32b467['query'][_0x712d('0xd')]);_0x294b38[_0x712d('0xc')]=qs['offset'](_0x32b467['query']['offset']);}_0x294b38[_0x712d('0x2b')]=qs[_0x712d('0x2c')](_0x32b467[_0x712d('0x22')][_0x712d('0x2c')]);_0x294b38['where']=qs[_0x712d('0x24')](_[_0x712d('0x2d')](_0x32b467[_0x712d('0x22')],_0x5a8069[_0x712d('0x24')]),_0x657952);if(_0x32b467['query'][_0x712d('0x2e')]){_0x294b38['where']=_[_0x712d('0x2f')](_0x294b38['where'],{'$or':_[_0x712d('0x1d')](_0x657952,function(_0xf1566d){if(_0xf1566d[_0x712d('0x20')]!==_0x712d('0x30')){var _0x2831fa={};_0x2831fa[_0xf1566d['name']]={'$like':'%'+_0x32b467['query'][_0x712d('0x2e')]+'%'};return _0x2831fa;}})});}_0x294b38=_['merge']({},_0x294b38,_0x32b467['options']);var _0x4d6986={'where':_0x294b38[_0x712d('0x31')]};return db['SquareProject'][_0x712d('0xf')](_0x4d6986)[_0x712d('0x12')](function(_0x1e9aa1){_0x4d3ab8[_0x712d('0xf')]=_0x1e9aa1;if(_0x32b467['query'][_0x712d('0x32')]){_0x294b38[_0x712d('0x33')]=[{'all':!![]}];}return db[_0x712d('0x1e')][_0x712d('0x34')](_0x294b38);})[_0x712d('0x12')](function(_0x5b7b51){_0x4d3ab8[_0x712d('0x35')]=_0x5b7b51;return _0x4d3ab8;})['then'](respondWithFilteredResult(_0x4f7ee1,_0x294b38))[_0x712d('0x36')](handleError(_0x4f7ee1,null));};exports['show']=function(_0x54d497,_0x1dbce7){var _0x5f29de={'raw':![],'where':{'id':_0x54d497[_0x712d('0x37')]['id']}},_0x4dfe1b={};_0x4dfe1b[_0x712d('0x25')]=_[_0x712d('0x23')](db[_0x712d('0x1e')][_0x712d('0x38')]);_0x4dfe1b['query']=_['keys'](_0x54d497[_0x712d('0x22')]);_0x4dfe1b[_0x712d('0x24')]=_[_0x712d('0x26')](_0x4dfe1b[_0x712d('0x25')],_0x4dfe1b['query']);_0x5f29de[_0x712d('0x28')]=_['intersection'](_0x4dfe1b[_0x712d('0x25')],qs[_0x712d('0x27')](_0x54d497['query'][_0x712d('0x27')]));_0x5f29de['attributes']=_0x5f29de[_0x712d('0x28')][_0x712d('0x29')]?_0x5f29de['attributes']:_0x4dfe1b[_0x712d('0x25')];if(_0x54d497['query']['includeAll']){_0x5f29de[_0x712d('0x33')]=[{'all':!![]}];}_0x5f29de=_[_0x712d('0x2f')]({},_0x5f29de,_0x54d497[_0x712d('0x39')]);return db[_0x712d('0x1e')][_0x712d('0x3a')](_0x5f29de)['then'](handleEntityNotFound(_0x1dbce7,null))[_0x712d('0x12')](respondWithResult(_0x1dbce7,null))[_0x712d('0x36')](handleError(_0x1dbce7,null));};exports[_0x712d('0x3b')]=function(_0x298efe,_0x1fca83){return db[_0x712d('0x1e')][_0x712d('0x3b')](_0x298efe['body'],{})[_0x712d('0x12')](function(_0x17bfb2){var _0x415ea2=_0x298efe[_0x712d('0x3c')]['get']({'plain':!![]});if(!_0x415ea2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x415ea2['role']===_0x712d('0x3c')){var _0x44dcf8=_0x17bfb2[_0x712d('0x14')]({'plain':!![]});var _0x1645f7=_0x712d('0x15');return db['UserProfileSection'][_0x712d('0x3a')]({'where':{'name':_0x1645f7,'userProfileId':_0x415ea2['userProfileId']},'raw':!![]})[_0x712d('0x12')](function(_0x122e1c){if(_0x122e1c&&_0x122e1c[_0x712d('0x3d')]===0x0){return db['UserProfileResource'][_0x712d('0x3b')]({'name':_0x44dcf8[_0x712d('0x1a')],'resourceId':_0x44dcf8['id'],'type':_0x122e1c[_0x712d('0x1a')],'sectionId':_0x122e1c['id']},{})[_0x712d('0x12')](function(){return _0x17bfb2;});}else{return _0x17bfb2;}})[_0x712d('0x36')](function(_0x599574){logger[_0x712d('0x3e')](_0x712d('0x3f'),_0x599574);throw _0x599574;});}return _0x17bfb2;})[_0x712d('0x12')](respondWithResult(_0x1fca83,0xc9))[_0x712d('0x36')](handleError(_0x1fca83,null));};exports[_0x712d('0x11')]=function(_0x581ee2,_0x545240){if(_0x581ee2['body']['id']){delete _0x581ee2[_0x712d('0x40')]['id'];}return db[_0x712d('0x1e')]['find']({'where':{'id':_0x581ee2[_0x712d('0x37')]['id']}})[_0x712d('0x12')](handleEntityNotFound(_0x545240,null))['then'](saveUpdates(_0x581ee2['body'],null))[_0x712d('0x12')](function(_0x346770){if(!_0x346770)return;var _0x14f8d9=_0x346770[_0x712d('0x14')]({'plain':!![]});return _0x14f8d9;})[_0x712d('0x12')](function(_0xf41218){var _0x1e9887=new Redis(config[_0x712d('0x8')]);_0x1e9887[_0x712d('0x16')](_0x712d('0x17'),JSON[_0x712d('0x18')](_[_0x712d('0x2d')](_0xf41218,['id','name',_0x712d('0x41')])));return _0xf41218;})[_0x712d('0x12')](respondWithResult(_0x545240,null))['catch'](handleError(_0x545240,null));};exports[_0x712d('0x13')]=function(_0xa87279,_0x57cbc8){return db[_0x712d('0x1e')][_0x712d('0x3a')]({'where':{'id':_0xa87279[_0x712d('0x37')]['id']}})[_0x712d('0x12')](handleEntityNotFound(_0x57cbc8,null))[_0x712d('0x12')](removeEntity(_0x57cbc8,null))[_0x712d('0x36')](handleError(_0x57cbc8,null));}; \ No newline at end of file +var _0xa069=['redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','offset','undefined','limit','count','set','Content-Range','json','update','then','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','error','stack','name','send','index','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','includeAll','include','SquareProject','findAll','rows','show','params','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','lodash','ioredis','../../config/logger','api'];(function(_0x2f0159,_0x39a639){var _0x37560d=function(_0x5ddef1){while(--_0x5ddef1){_0x2f0159['push'](_0x2f0159['shift']());}};_0x37560d(++_0x39a639);}(_0xa069,0x18e));var _0x9a06=function(_0x39859b,_0x2fd601){_0x39859b=_0x39859b-0x0;var _0x2c3170=_0xa069[_0x39859b];return _0x2c3170;};'use strict';var _=require(_0x9a06('0x0'));var Redis=require(_0x9a06('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x9a06('0x2'))(_0x9a06('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x9a06('0x4')]=_[_0x9a06('0x5')](config[_0x9a06('0x4')],{'host':_0x9a06('0x6'),'port':0x18eb});var socket=require(_0x9a06('0x7'))(new Redis(config[_0x9a06('0x4')]));require(_0x9a06('0x8'))['register'](socket);function respondWithResult(_0x40859a,_0x238760){_0x238760=_0x238760||0xc8;return function(_0x17e8e4){if(_0x17e8e4){return _0x40859a[_0x9a06('0x9')](_0x238760)['json'](_0x17e8e4);}};}function respondWithFilteredResult(_0x407d57,_0xaf1cc0){return function(_0x280732){if(_0x280732){var _0x45f49f=typeof _0xaf1cc0[_0x9a06('0xa')]===_0x9a06('0xb')&&typeof _0xaf1cc0[_0x9a06('0xc')]===_0x9a06('0xb');var _0x181ea2=_0x280732[_0x9a06('0xd')];var _0xa887b1=_0x45f49f?0x0:_0xaf1cc0[_0x9a06('0xa')];var _0x50ca55=_0x45f49f?_0x280732[_0x9a06('0xd')]:_0xaf1cc0[_0x9a06('0xa')]+_0xaf1cc0[_0x9a06('0xc')];var _0x74cfba;if(_0x50ca55>=_0x181ea2){_0x50ca55=_0x181ea2;_0x74cfba=0xc8;}else{_0x74cfba=0xce;}_0x407d57[_0x9a06('0x9')](_0x74cfba);return _0x407d57[_0x9a06('0xe')](_0x9a06('0xf'),_0xa887b1+'-'+_0x50ca55+'/'+_0x181ea2)[_0x9a06('0x10')](_0x280732);}return null;};}function saveUpdates(_0x2186cf){return function(_0x4fc362){if(_0x4fc362){return _0x4fc362[_0x9a06('0x11')](_0x2186cf)[_0x9a06('0x12')](function(_0x565fae){return _0x565fae;});}return null;};}function removeEntity(_0x2ad47b){return function(_0x22b18e){if(_0x22b18e){return _0x22b18e['destroy']()['then'](function(){var _0x3f8499=_0x22b18e[_0x9a06('0x13')]({'plain':!![]});var _0x587be0=_0x9a06('0x14');return db[_0x9a06('0x15')]['destroy']({'where':{'type':_0x587be0,'resourceId':_0x3f8499['id']}})[_0x9a06('0x12')](function(){return _0x22b18e;});})[_0x9a06('0x12')](function(){var _0x4b9692=new Redis(config[_0x9a06('0x4')]);_0x4b9692[_0x9a06('0x16')](_0x9a06('0x17'),JSON[_0x9a06('0x18')]({'id':_0x22b18e['id'],'deleted':!![]}));})['then'](function(){_0x2ad47b[_0x9a06('0x9')](0xcc)[_0x9a06('0x19')]();});}};}function handleEntityNotFound(_0x1ea416){return function(_0x40672e){if(!_0x40672e){_0x1ea416['sendStatus'](0x194);}return _0x40672e;};}function handleError(_0xd4f70d,_0x1eedcc){_0x1eedcc=_0x1eedcc||0x1f4;return function(_0xbf8d23){logger[_0x9a06('0x1a')](_0xbf8d23[_0x9a06('0x1b')]);if(_0xbf8d23[_0x9a06('0x1c')]){delete _0xbf8d23[_0x9a06('0x1c')];}_0xd4f70d[_0x9a06('0x9')](_0x1eedcc)[_0x9a06('0x1d')](_0xbf8d23);};}exports[_0x9a06('0x1e')]=function(_0x547ca5,_0x341088){var _0x3b1a5b={},_0x5495f2={},_0x39ffb1={'count':0x0,'rows':[]};var _0x237527=_['map'](db['SquareProject'][_0x9a06('0x1f')],function(_0x275dc1){return{'name':_0x275dc1[_0x9a06('0x20')],'type':_0x275dc1['type'][_0x9a06('0x21')]};});_0x5495f2['model']=_[_0x9a06('0x22')](_0x237527,'name');_0x5495f2['query']=_[_0x9a06('0x23')](_0x547ca5[_0x9a06('0x24')]);_0x5495f2[_0x9a06('0x25')]=_[_0x9a06('0x26')](_0x5495f2[_0x9a06('0x27')],_0x5495f2['query']);_0x3b1a5b['attributes']=_[_0x9a06('0x26')](_0x5495f2['model'],qs['fields'](_0x547ca5[_0x9a06('0x24')][_0x9a06('0x28')]));_0x3b1a5b[_0x9a06('0x29')]=_0x3b1a5b[_0x9a06('0x29')][_0x9a06('0x2a')]?_0x3b1a5b[_0x9a06('0x29')]:_0x5495f2['model'];if(!_0x547ca5[_0x9a06('0x24')][_0x9a06('0x2b')](_0x9a06('0x2c'))){_0x3b1a5b[_0x9a06('0xc')]=qs[_0x9a06('0xc')](_0x547ca5[_0x9a06('0x24')]['limit']);_0x3b1a5b[_0x9a06('0xa')]=qs[_0x9a06('0xa')](_0x547ca5[_0x9a06('0x24')][_0x9a06('0xa')]);}_0x3b1a5b[_0x9a06('0x2d')]=qs[_0x9a06('0x2e')](_0x547ca5['query'][_0x9a06('0x2e')]);_0x3b1a5b[_0x9a06('0x2f')]=qs['filters'](_[_0x9a06('0x30')](_0x547ca5[_0x9a06('0x24')],_0x5495f2[_0x9a06('0x25')]),_0x237527);if(_0x547ca5['query']['filter']){_0x3b1a5b['where']=_[_0x9a06('0x31')](_0x3b1a5b['where'],{'$or':_['map'](_0x237527,function(_0x20d286){if(_0x20d286[_0x9a06('0x32')]!==_0x9a06('0x33')){var _0x490b27={};_0x490b27[_0x20d286[_0x9a06('0x1c')]]={'$like':'%'+_0x547ca5[_0x9a06('0x24')]['filter']+'%'};return _0x490b27;}})});}_0x3b1a5b=_[_0x9a06('0x31')]({},_0x3b1a5b,_0x547ca5['options']);var _0x592712={'where':_0x3b1a5b['where']};return db['SquareProject']['count'](_0x592712)['then'](function(_0x7be8f7){_0x39ffb1[_0x9a06('0xd')]=_0x7be8f7;if(_0x547ca5[_0x9a06('0x24')][_0x9a06('0x34')]){_0x3b1a5b[_0x9a06('0x35')]=[{'all':!![]}];}return db[_0x9a06('0x36')][_0x9a06('0x37')](_0x3b1a5b);})[_0x9a06('0x12')](function(_0x5d2a66){_0x39ffb1[_0x9a06('0x38')]=_0x5d2a66;return _0x39ffb1;})[_0x9a06('0x12')](respondWithFilteredResult(_0x341088,_0x3b1a5b))['catch'](handleError(_0x341088,null));};exports[_0x9a06('0x39')]=function(_0x10748f,_0x4b38a5){var _0xd4921b={'raw':![],'where':{'id':_0x10748f[_0x9a06('0x3a')]['id']}},_0x16a896={};_0x16a896['model']=_[_0x9a06('0x23')](db['SquareProject'][_0x9a06('0x1f')]);_0x16a896[_0x9a06('0x24')]=_[_0x9a06('0x23')](_0x10748f[_0x9a06('0x24')]);_0x16a896[_0x9a06('0x25')]=_[_0x9a06('0x26')](_0x16a896[_0x9a06('0x27')],_0x16a896['query']);_0xd4921b[_0x9a06('0x29')]=_[_0x9a06('0x26')](_0x16a896[_0x9a06('0x27')],qs[_0x9a06('0x28')](_0x10748f[_0x9a06('0x24')][_0x9a06('0x28')]));_0xd4921b[_0x9a06('0x29')]=_0xd4921b['attributes'][_0x9a06('0x2a')]?_0xd4921b[_0x9a06('0x29')]:_0x16a896['model'];if(_0x10748f[_0x9a06('0x24')][_0x9a06('0x34')]){_0xd4921b[_0x9a06('0x35')]=[{'all':!![]}];}_0xd4921b=_['merge']({},_0xd4921b,_0x10748f[_0x9a06('0x3b')]);return db[_0x9a06('0x36')]['find'](_0xd4921b)['then'](handleEntityNotFound(_0x4b38a5,null))['then'](respondWithResult(_0x4b38a5,null))[_0x9a06('0x3c')](handleError(_0x4b38a5,null));};exports[_0x9a06('0x3d')]=function(_0x56045c,_0xf63c22){return db[_0x9a06('0x36')][_0x9a06('0x3d')](_0x56045c[_0x9a06('0x3e')],{})[_0x9a06('0x12')](function(_0x29c089){var _0x29c541=_0x56045c['user'][_0x9a06('0x13')]({'plain':!![]});if(!_0x29c541)throw new Error(_0x9a06('0x3f'));if(_0x29c541['role']==='user'){var _0x15aa85=_0x29c089['get']({'plain':!![]});var _0x234a88=_0x9a06('0x14');return db['UserProfileSection'][_0x9a06('0x40')]({'where':{'name':_0x234a88,'userProfileId':_0x29c541[_0x9a06('0x41')]},'raw':!![]})[_0x9a06('0x12')](function(_0x1be5f3){if(_0x1be5f3&&_0x1be5f3[_0x9a06('0x42')]===0x0){return db[_0x9a06('0x15')][_0x9a06('0x3d')]({'name':_0x15aa85['name'],'resourceId':_0x15aa85['id'],'type':_0x1be5f3['name'],'sectionId':_0x1be5f3['id']},{})[_0x9a06('0x12')](function(){return _0x29c089;});}else{return _0x29c089;}})['catch'](function(_0x6df7d6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6df7d6);throw _0x6df7d6;});}return _0x29c089;})[_0x9a06('0x12')](respondWithResult(_0xf63c22,0xc9))[_0x9a06('0x3c')](handleError(_0xf63c22,null));};exports[_0x9a06('0x11')]=function(_0x270c31,_0x5c0a56){if(_0x270c31[_0x9a06('0x3e')]['id']){delete _0x270c31['body']['id'];}return db['SquareProject'][_0x9a06('0x40')]({'where':{'id':_0x270c31['params']['id']}})[_0x9a06('0x12')](handleEntityNotFound(_0x5c0a56,null))[_0x9a06('0x12')](saveUpdates(_0x270c31[_0x9a06('0x3e')],null))['then'](function(_0x3802e9){if(!_0x3802e9)return;var _0x4f3f43=_0x3802e9[_0x9a06('0x13')]({'plain':!![]});return _0x4f3f43;})[_0x9a06('0x12')](function(_0x541891){var _0x15a109=new Redis(config['redis']);_0x15a109[_0x9a06('0x16')](_0x9a06('0x17'),JSON[_0x9a06('0x18')](_[_0x9a06('0x30')](_0x541891,['id',_0x9a06('0x1c'),'production'])));return _0x541891;})[_0x9a06('0x12')](respondWithResult(_0x5c0a56,null))[_0x9a06('0x3c')](handleError(_0x5c0a56,null));};exports['destroy']=function(_0x3aebb4,_0x498aca){return db[_0x9a06('0x36')][_0x9a06('0x40')]({'where':{'id':_0x3aebb4['params']['id']}})['then'](handleEntityNotFound(_0x498aca,null))['then'](removeEntity(_0x498aca,null))[_0x9a06('0x3c')](handleError(_0x498aca,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 7341971..a4e65bb 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 _0xe4f4=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe4f4,0xb5));var _0x4e4f=function(_0x50a864,_0x3303e2){_0x50a864=_0x50a864-0x0;var _0x2fb82f=_0xe4f4[_0x50a864];return _0x2fb82f;};'use strict';var EventEmitter=require(_0x4e4f('0x0'));var SquareProject=require(_0x4e4f('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4e4f('0x2')](0x0);var events={'afterCreate':_0x4e4f('0x3'),'afterUpdate':_0x4e4f('0x4'),'afterDestroy':_0x4e4f('0x5')};function emitEvent(_0x4cfaa8){return function(_0x5df9e7,_0x3bbba1,_0x349d1f){SquareProjectEvents[_0x4e4f('0x6')](_0x4cfaa8+':'+_0x5df9e7['id'],_0x5df9e7);SquareProjectEvents[_0x4e4f('0x6')](_0x4cfaa8,_0x5df9e7);_0x349d1f(null);};}for(var e in events){if(events[_0x4e4f('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x4e4f('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xec17=['../../mysqldb','SquareProject','emit','hasOwnProperty','hook','exports','events'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0xec17,0x180));var _0x7ec1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xec17[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0x7ec1('0x0'));var SquareProject=require(_0x7ec1('0x1'))['db'][_0x7ec1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45a27a){return function(_0x4e0d86,_0x43a4d9,_0x559ef){SquareProjectEvents['emit'](_0x45a27a+':'+_0x4e0d86['id'],_0x4e0d86);SquareProjectEvents[_0x7ec1('0x3')](_0x45a27a,_0x4e0d86);_0x559ef(null);};}for(var e in events){if(events[_0x7ec1('0x4')](e)){var event=events[e];SquareProject[_0x7ec1('0x5')](e,emitEvent(event));}}module[_0x7ec1('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 630b6eb..85f459d 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 _0xfc5c=['YYYY-MM-DD\x20HH:mm:ss','publishedAt','../../config/logger','api','moment','path','rimraf','../../config/environment','define','SquareProject','square_projects','changed','preproduction','savedAt','format'];(function(_0x1bb161,_0x25b93c){var _0x2d4246=function(_0x1bac38){while(--_0x1bac38){_0x1bb161['push'](_0x1bb161['shift']());}};_0x2d4246(++_0x25b93c);}(_0xfc5c,0x16a));var _0xcfc5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfc5c[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcfc5('0x0'))(_0xcfc5('0x1'));var moment=require(_0xcfc5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfc5('0x3'));var rimraf=require(_0xcfc5('0x4'));var config=require(_0xcfc5('0x5'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x5abb6a,_0x2a2181){return _0x5abb6a[_0xcfc5('0x6')](_0xcfc5('0x7'),attributes,{'tableName':_0xcfc5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e6215,_0x1aa947,_0x4fe46e){if(_0x5e6215[_0xcfc5('0x9')](_0xcfc5('0xa'))){_0x5e6215[_0xcfc5('0xb')]=moment()[_0xcfc5('0xc')](_0xcfc5('0xd'));}if(_0x5e6215[_0xcfc5('0x9')]('production')){_0x5e6215[_0xcfc5('0xe')]=moment()[_0xcfc5('0xc')](_0xcfc5('0xd'));}_0x4fe46e(null,_0x5e6215);}}});}; \ No newline at end of file +var _0x2196=['YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','format'];(function(_0x1ca8f1,_0x2eb0b2){var _0x3a036f=function(_0x5a5dac){while(--_0x5a5dac){_0x1ca8f1['push'](_0x1ca8f1['shift']());}};_0x3a036f(++_0x2eb0b2);}(_0x2196,0xb7));var _0x6219=function(_0x3261ed,_0x1f06ad){_0x3261ed=_0x3261ed-0x0;var _0xbea3c3=_0x2196[_0x3261ed];return _0xbea3c3;};'use strict';var _=require(_0x6219('0x0'));var util=require(_0x6219('0x1'));var logger=require(_0x6219('0x2'))(_0x6219('0x3'));var moment=require(_0x6219('0x4'));var BPromise=require(_0x6219('0x5'));var rp=require(_0x6219('0x6'));var fs=require('fs');var path=require(_0x6219('0x7'));var rimraf=require(_0x6219('0x8'));var config=require(_0x6219('0x9'));var attributes=require(_0x6219('0xa'));module[_0x6219('0xb')]=function(_0x28291e,_0x5ca123){return _0x28291e['define'](_0x6219('0xc'),attributes,{'tableName':_0x6219('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b12eb,_0x50cb06,_0x5d9ca9){if(_0x2b12eb[_0x6219('0xe')](_0x6219('0xf'))){_0x2b12eb['savedAt']=moment()[_0x6219('0x10')](_0x6219('0x11'));}if(_0x2b12eb[_0x6219('0xe')](_0x6219('0x12'))){_0x2b12eb[_0x6219('0x13')]=moment()[_0x6219('0x10')](_0x6219('0x11'));}_0x5d9ca9(null,_0x2b12eb);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b973630..25d7079 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 _0x105d=['where','attributes','limit','include','map','model','then','info','debug','stringify','message','error','find','raw','ShowSquareProject','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options'];(function(_0x5344c0,_0x4ff180){var _0x25f1e4=function(_0x50e709){while(--_0x50e709){_0x5344c0['push'](_0x5344c0['shift']());}};_0x25f1e4(++_0x4ff180);}(_0x105d,0x1e0));var _0xd105=function(_0x51a004,_0x504f1b){_0x51a004=_0x51a004-0x0;var _0x4403a1=_0x105d[_0x51a004];return _0x4403a1;};'use strict';var _=require(_0xd105('0x0'));var Redis=require(_0xd105('0x1'));var db=require(_0xd105('0x2'))['db'];var logger=require(_0xd105('0x3'))(_0xd105('0x4'));var config=require(_0xd105('0x5'));config[_0xd105('0x6')]=_['defaults'](config[_0xd105('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd105('0x6')]));require(_0xd105('0x7'))[_0xd105('0x8')](socket);exports[_0xd105('0x9')]=function(_0x3758cc){var _0x151b67=this;return new Promise(function(_0x754dab,_0xf569f0){return db[_0xd105('0xa')][_0xd105('0xb')]({'raw':_0x3758cc['options']?_0x3758cc['options']['raw']===undefined?!![]:![]:!![],'where':_0x3758cc[_0xd105('0xc')]?_0x3758cc[_0xd105('0xc')][_0xd105('0xd')]||null:null,'attributes':_0x3758cc[_0xd105('0xc')]?_0x3758cc[_0xd105('0xc')][_0xd105('0xe')]||null:null,'limit':_0x3758cc['options']?_0x3758cc[_0xd105('0xc')][_0xd105('0xf')]||null:null,'include':_0x3758cc[_0xd105('0xc')]?_0x3758cc[_0xd105('0xc')][_0xd105('0x10')]?_[_0xd105('0x11')](_0x3758cc['options'][_0xd105('0x10')],function(_0x25758d){return{'model':db[_0x25758d[_0xd105('0x12')]],'as':_0x25758d['as'],'attributes':_0x25758d[_0xd105('0xe')],'include':_0x25758d['include']?_[_0xd105('0x11')](_0x25758d['include'],function(_0x4bbe18){return{'model':db[_0x4bbe18[_0xd105('0x12')]],'as':_0x4bbe18['as'],'attributes':_0x4bbe18[_0xd105('0xe')],'include':_0x4bbe18[_0xd105('0x10')]?_[_0xd105('0x11')](_0x4bbe18[_0xd105('0x10')],function(_0x40ff20){return{'model':db[_0x40ff20['model']],'as':_0x40ff20['as'],'attributes':_0x40ff20['attributes']};}):[]};}):[]};}):[]:[]})[_0xd105('0x13')](function(_0x286c3a){logger[_0xd105('0x14')](_0xd105('0x9'),_0x3758cc);logger[_0xd105('0x15')](_0xd105('0x9'),_0x3758cc,JSON[_0xd105('0x16')](_0x286c3a));_0x754dab(_0x286c3a);})['catch'](function(_0x25c4ae){logger['error'](_0xd105('0x9'),_0x25c4ae[_0xd105('0x17')],_0x3758cc);_0xf569f0(_0x151b67[_0xd105('0x18')](0x1f4,_0x25c4ae[_0xd105('0x17')]));});});};exports['ShowSquareProject']=function(_0x56d4e5){var _0x2aa80c=this;return new Promise(function(_0x432dd8,_0x27cbe0){return db[_0xd105('0xa')][_0xd105('0x19')]({'raw':_0x56d4e5['options']?_0x56d4e5[_0xd105('0xc')][_0xd105('0x1a')]===undefined?!![]:![]:!![],'where':_0x56d4e5[_0xd105('0xc')]?_0x56d4e5[_0xd105('0xc')][_0xd105('0xd')]||null:null,'attributes':_0x56d4e5[_0xd105('0xc')]?_0x56d4e5['options'][_0xd105('0xe')]||null:null,'include':_0x56d4e5[_0xd105('0xc')]?_0x56d4e5[_0xd105('0xc')][_0xd105('0x10')]?_['map'](_0x56d4e5[_0xd105('0xc')][_0xd105('0x10')],function(_0x1dc05e){return{'model':db[_0x1dc05e['model']],'as':_0x1dc05e['as'],'attributes':_0x1dc05e[_0xd105('0xe')],'include':_0x1dc05e['include']?_[_0xd105('0x11')](_0x1dc05e[_0xd105('0x10')],function(_0x2157e3){return{'model':db[_0x2157e3[_0xd105('0x12')]],'as':_0x2157e3['as'],'attributes':_0x2157e3[_0xd105('0xe')],'include':_0x2157e3[_0xd105('0x10')]?_[_0xd105('0x11')](_0x2157e3['include'],function(_0x2e0bba){return{'model':db[_0x2e0bba['model']],'as':_0x2e0bba['as'],'attributes':_0x2e0bba['attributes']};}):[]};}):[]};}):[]:[]})[_0xd105('0x13')](function(_0xf37ad6){logger[_0xd105('0x14')]('ShowSquareProject',_0x56d4e5);logger[_0xd105('0x15')](_0xd105('0x1b'),_0x56d4e5,JSON[_0xd105('0x16')](_0xf37ad6));_0x432dd8(_0xf37ad6);})[_0xd105('0x1c')](function(_0x504aee){logger[_0xd105('0x18')](_0xd105('0x1b'),_0x504aee['message'],_0x56d4e5);_0x27cbe0(_0x2aa80c['error'](0x1f4,_0x504aee[_0xd105('0x17')]));});});}; \ No newline at end of file +var _0x8b24=['defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','where','lodash','ioredis','../../mysqldb','rpc','redis'];(function(_0xac4d58,_0x43fcc6){var _0x1db8ec=function(_0x3c339c){while(--_0x3c339c){_0xac4d58['push'](_0xac4d58['shift']());}};_0x1db8ec(++_0x43fcc6);}(_0x8b24,0x1c6));var _0x48b2=function(_0x168200,_0x448981){_0x168200=_0x168200-0x0;var _0x43440f=_0x8b24[_0x168200];return _0x43440f;};'use strict';var _=require(_0x48b2('0x0'));var Redis=require(_0x48b2('0x1'));var db=require(_0x48b2('0x2'))['db'];var logger=require('../../config/logger')(_0x48b2('0x3'));var config=require('../../config/environment');config[_0x48b2('0x4')]=_[_0x48b2('0x5')](config[_0x48b2('0x4')],{'host':_0x48b2('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48b2('0x4')]));require(_0x48b2('0x7'))[_0x48b2('0x8')](socket);exports[_0x48b2('0x9')]=function(_0x1ef44f){var _0x843621=this;return new Promise(function(_0x2f1688,_0x46d2ed){return db[_0x48b2('0xa')]['findAll']({'raw':_0x1ef44f[_0x48b2('0xb')]?_0x1ef44f[_0x48b2('0xb')][_0x48b2('0xc')]===undefined?!![]:![]:!![],'where':_0x1ef44f[_0x48b2('0xb')]?_0x1ef44f[_0x48b2('0xb')]['where']||null:null,'attributes':_0x1ef44f['options']?_0x1ef44f[_0x48b2('0xb')][_0x48b2('0xd')]||null:null,'limit':_0x1ef44f['options']?_0x1ef44f[_0x48b2('0xb')][_0x48b2('0xe')]||null:null,'include':_0x1ef44f['options']?_0x1ef44f[_0x48b2('0xb')][_0x48b2('0xf')]?_[_0x48b2('0x10')](_0x1ef44f['options']['include'],function(_0x3172a9){return{'model':db[_0x3172a9[_0x48b2('0x11')]],'as':_0x3172a9['as'],'attributes':_0x3172a9[_0x48b2('0xd')],'include':_0x3172a9['include']?_['map'](_0x3172a9[_0x48b2('0xf')],function(_0x1e92e8){return{'model':db[_0x1e92e8[_0x48b2('0x11')]],'as':_0x1e92e8['as'],'attributes':_0x1e92e8[_0x48b2('0xd')],'include':_0x1e92e8[_0x48b2('0xf')]?_[_0x48b2('0x10')](_0x1e92e8[_0x48b2('0xf')],function(_0x319bcc){return{'model':db[_0x319bcc['model']],'as':_0x319bcc['as'],'attributes':_0x319bcc[_0x48b2('0xd')]};}):[]};}):[]};}):[]:[]})[_0x48b2('0x12')](function(_0x1ebf7b){logger[_0x48b2('0x13')]('GetSquareProjects',_0x1ef44f);logger[_0x48b2('0x14')](_0x48b2('0x9'),_0x1ef44f,JSON[_0x48b2('0x15')](_0x1ebf7b));_0x2f1688(_0x1ebf7b);})[_0x48b2('0x16')](function(_0xa23915){logger['error'](_0x48b2('0x9'),_0xa23915['message'],_0x1ef44f);_0x46d2ed(_0x843621[_0x48b2('0x17')](0x1f4,_0xa23915[_0x48b2('0x18')]));});});};exports[_0x48b2('0x19')]=function(_0x43e30b){var _0x191497=this;return new Promise(function(_0x5f2263,_0x274c59){return db[_0x48b2('0xa')]['find']({'raw':_0x43e30b['options']?_0x43e30b[_0x48b2('0xb')][_0x48b2('0xc')]===undefined?!![]:![]:!![],'where':_0x43e30b[_0x48b2('0xb')]?_0x43e30b[_0x48b2('0xb')][_0x48b2('0x1a')]||null:null,'attributes':_0x43e30b['options']?_0x43e30b[_0x48b2('0xb')][_0x48b2('0xd')]||null:null,'include':_0x43e30b[_0x48b2('0xb')]?_0x43e30b[_0x48b2('0xb')][_0x48b2('0xf')]?_[_0x48b2('0x10')](_0x43e30b['options'][_0x48b2('0xf')],function(_0xd9c915){return{'model':db[_0xd9c915[_0x48b2('0x11')]],'as':_0xd9c915['as'],'attributes':_0xd9c915[_0x48b2('0xd')],'include':_0xd9c915['include']?_[_0x48b2('0x10')](_0xd9c915[_0x48b2('0xf')],function(_0x5be966){return{'model':db[_0x5be966['model']],'as':_0x5be966['as'],'attributes':_0x5be966[_0x48b2('0xd')],'include':_0x5be966[_0x48b2('0xf')]?_[_0x48b2('0x10')](_0x5be966['include'],function(_0x4587c2){return{'model':db[_0x4587c2['model']],'as':_0x4587c2['as'],'attributes':_0x4587c2[_0x48b2('0xd')]};}):[]};}):[]};}):[]:[]})[_0x48b2('0x12')](function(_0x36ea5e){logger[_0x48b2('0x13')](_0x48b2('0x19'),_0x43e30b);logger[_0x48b2('0x14')]('ShowSquareProject',_0x43e30b,JSON['stringify'](_0x36ea5e));_0x5f2263(_0x36ea5e);})[_0x48b2('0x16')](function(_0xa35851){logger['error']('ShowSquareProject',_0xa35851[_0x48b2('0x18')],_0x43e30b);_0x274c59(_0x191497[_0x48b2('0x17')](0x1f4,_0xa35851['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d5e5068..a6eaead 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 _0x862d=['length','squareProject:','./squareProject.events','update','emit','removeListener','register'];(function(_0x33ac17,_0x536bda){var _0x3a84aa=function(_0x319170){while(--_0x319170){_0x33ac17['push'](_0x33ac17['shift']());}};_0x3a84aa(++_0x536bda);}(_0x862d,0x113));var _0xd862=function(_0x26057a,_0x8e9804){_0x26057a=_0x26057a-0x0;var _0x44ca29=_0x862d[_0x26057a];return _0x44ca29;};'use strict';var SquareProjectEvents=require(_0xd862('0x0'));var events=['save','remove',_0xd862('0x1')];function createListener(_0x3debf8,_0x1afe1a){return function(_0x544c1a){_0x1afe1a[_0xd862('0x2')](_0x3debf8,_0x544c1a);};}function removeListener(_0x8ddfc7,_0x2d3e4c){return function(){SquareProjectEvents[_0xd862('0x3')](_0x8ddfc7,_0x2d3e4c);};}exports[_0xd862('0x4')]=function(_0x5aa7a0){for(var _0x2d9b87=0x0,_0x3cbc63=events[_0xd862('0x5')];_0x2d9b87<_0x3cbc63;_0x2d9b87++){var _0xf63591=events[_0x2d9b87];var _0x32b157=createListener(_0xd862('0x6')+_0xf63591,_0x5aa7a0);SquareProjectEvents['on'](_0xf63591,_0x32b157);}}; \ No newline at end of file +var _0x211b=['remove','update','emit','removeListener','length','squareProject:','./squareProject.events','save'];(function(_0x42b69e,_0x410787){var _0x589677=function(_0x31f264){while(--_0x31f264){_0x42b69e['push'](_0x42b69e['shift']());}};_0x589677(++_0x410787);}(_0x211b,0x66));var _0xb211=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x211b[_0x75f869];return _0x10af8b;};'use strict';var SquareProjectEvents=require(_0xb211('0x0'));var events=[_0xb211('0x1'),_0xb211('0x2'),_0xb211('0x3')];function createListener(_0x6126a8,_0x131ff9){return function(_0x339132){_0x131ff9[_0xb211('0x4')](_0x6126a8,_0x339132);};}function removeListener(_0x1f79c8,_0x5a706c){return function(){SquareProjectEvents[_0xb211('0x5')](_0x1f79c8,_0x5a706c);};}exports['register']=function(_0x54359c){for(var _0x3c29fb=0x0,_0x13bab7=events[_0xb211('0x6')];_0x3c29fb<_0x13bab7;_0x3c29fb++){var _0xf64ce2=events[_0x3c29fb];var _0x177d9b=createListener(_0xb211('0x7')+_0xf64ce2,_0x54359c);SquareProjectEvents['on'](_0xf64ce2,_0x177d9b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 82a2000..9a05c4d 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0x326f,0xd1));var _0xf326=function(_0x5e811d,_0x433798){_0x5e811d=_0x5e811d-0x0;var _0x3b5715=_0x326f[_0x5e811d];return _0x3b5715;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x893618,_0x464a64){var _0xbd471a=function(_0xddb7e3){while(--_0xddb7e3){_0x893618['push'](_0x893618['shift']());}};_0xbd471a(++_0x464a64);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ffc3dc5..131edd4 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 _0x3eea=['getDataValue','substring','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5f1306,_0x5947ff){_0x5f1306=_0x5f1306-0x0;var _0x540282=_0x3eea[_0x5f1306];return _0x540282;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa3ee('0x1')]},'callerid':{'type':Sequelize[_0xa3ee('0x1')]},'calleridname':{'type':Sequelize[_0xa3ee('0x1')]},'context':{'type':Sequelize[_0xa3ee('0x1')]},'extension':{'type':Sequelize[_0xa3ee('0x1')]},'priority':{'type':Sequelize[_0xa3ee('0x1')]},'accountcode':{'type':Sequelize[_0xa3ee('0x1')]},'dnid':{'type':Sequelize[_0xa3ee('0x1')]},'projectName':{'type':Sequelize[_0xa3ee('0x1')]},'saveName':{'type':Sequelize[_0xa3ee('0x1')]},'filename':{'type':Sequelize[_0xa3ee('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x4183ee='';var _0x4e4588=this[_0xa3ee('0x2')]('savePath');if(_0x4e4588){_0x4183ee=_0x4e4588[_0xa3ee('0x3')](_0x4e4588['lastIndexOf']('.'));}return _0x4183ee;}}}; \ No newline at end of file +var _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x1b64af,_0x1bd0f9){var _0x3da462=function(_0xb12d05){while(--_0xb12d05){_0x1b64af['push'](_0x1b64af['shift']());}};_0x3da462(++_0x1bd0f9);}(_0x5fd1,0x155));var _0x15fd=function(_0x3d5e2c,_0x32f045){_0x3d5e2c=_0x3d5e2c-0x0;var _0x40e407=_0x5fd1[_0x3d5e2c];return _0x40e407;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 27549a2..884e912 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 _0xdbf0=['SquareRecording\x20not\x20found','download','unlink','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','map','query','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','rows','catch','show','params','keys','fields','include','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError'];(function(_0x3e1a0e,_0x5d847b){var _0x423f71=function(_0x43c058){while(--_0x43c058){_0x3e1a0e['push'](_0x3e1a0e['shift']());}};_0x423f71(++_0x5d847b);}(_0xdbf0,0x190));var _0x0dbf=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xdbf0[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x0dbf('0x0'));var rimraf=require(_0x0dbf('0x1'));var zipdir=require(_0x0dbf('0x2'));var jsonpatch=require(_0x0dbf('0x3'));var rp=require(_0x0dbf('0x4'));var moment=require(_0x0dbf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0dbf('0x6'));var util=require(_0x0dbf('0x7'));var path=require(_0x0dbf('0x8'));var sox=require(_0x0dbf('0x9'));var csv=require(_0x0dbf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0dbf('0xb'));var _=require('lodash');var squel=require(_0x0dbf('0xc'));var crypto=require(_0x0dbf('0xd'));var jsforce=require(_0x0dbf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0dbf('0xa'));var querystring=require(_0x0dbf('0xf'));var Papa=require('papaparse');var Redis=require(_0x0dbf('0x10'));var authService=require(_0x0dbf('0x11'));var qs=require(_0x0dbf('0x12'));var as=require(_0x0dbf('0x13'));var hardwareService=require(_0x0dbf('0x14'));var logger=require(_0x0dbf('0x15'))('api');var utils=require(_0x0dbf('0x16'));var config=require(_0x0dbf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dbf('0x18'))['db'];function respondWithStatusCode(_0x2a7b70,_0x31ce01){_0x31ce01=_0x31ce01||0xcc;return function(_0x4a44ac){if(_0x4a44ac){return _0x2a7b70[_0x0dbf('0x19')](_0x31ce01);}return _0x2a7b70[_0x0dbf('0x1a')](_0x31ce01)[_0x0dbf('0x1b')]();};}function respondWithResult(_0x1a38ef,_0x21c5a4){_0x21c5a4=_0x21c5a4||0xc8;return function(_0x482fdd){if(_0x482fdd){return _0x1a38ef[_0x0dbf('0x1a')](_0x21c5a4)[_0x0dbf('0x1c')](_0x482fdd);}};}function respondWithFilteredResult(_0x4dc6e0,_0x27231a){return function(_0x9b0f28){if(_0x9b0f28){var _0xbad276=typeof _0x27231a[_0x0dbf('0x1d')]==='undefined'&&typeof _0x27231a[_0x0dbf('0x1e')]===_0x0dbf('0x1f');var _0x3f4b0f=_0x9b0f28[_0x0dbf('0x20')];var _0x34c81d=_0xbad276?0x0:_0x27231a['offset'];var _0x184cf1=_0xbad276?_0x9b0f28[_0x0dbf('0x20')]:_0x27231a[_0x0dbf('0x1d')]+_0x27231a[_0x0dbf('0x1e')];var _0x42c29f;if(_0x184cf1>=_0x3f4b0f){_0x184cf1=_0x3f4b0f;_0x42c29f=0xc8;}else{_0x42c29f=0xce;}_0x4dc6e0[_0x0dbf('0x1a')](_0x42c29f);return _0x4dc6e0['set'](_0x0dbf('0x21'),_0x34c81d+'-'+_0x184cf1+'/'+_0x3f4b0f)[_0x0dbf('0x1c')](_0x9b0f28);}return null;};}function patchUpdates(_0x159edc){return function(_0x2f4781){try{jsonpatch['apply'](_0x2f4781,_0x159edc,!![]);}catch(_0x44839d){return BPromise['reject'](_0x44839d);}return _0x2f4781[_0x0dbf('0x22')]();};}function saveUpdates(_0x48959e,_0x240715){return function(_0x440262){if(_0x440262){return _0x440262[_0x0dbf('0x23')](_0x48959e)[_0x0dbf('0x24')](function(_0x20dd6e){return _0x20dd6e;});}return null;};}function removeEntity(_0x2a955a,_0x3986d6){return function(_0x4152dd){if(_0x4152dd){return _0x4152dd[_0x0dbf('0x25')]()['then'](function(){_0x2a955a[_0x0dbf('0x1a')](0xcc)[_0x0dbf('0x1b')]();});}};}function handleEntityNotFound(_0x5440c3,_0x28ef1c){return function(_0x274b96){if(!_0x274b96){_0x5440c3[_0x0dbf('0x19')](0x194);}return _0x274b96;};}function handleError(_0x11279e,_0x1f779b){_0x1f779b=_0x1f779b||0x1f4;return function(_0x4ae966){logger[_0x0dbf('0x26')](_0x4ae966['stack']);if(_0x4ae966[_0x0dbf('0x27')]){delete _0x4ae966['name'];}_0x11279e[_0x0dbf('0x1a')](_0x1f779b)[_0x0dbf('0x28')](_0x4ae966);};}exports[_0x0dbf('0x29')]=function(_0x38e5f9,_0x106167){var _0x26da52={},_0x3b2635={},_0x5c1034={'count':0x0,'rows':[]};var _0x236243=_['map'](db['SquareRecording'][_0x0dbf('0x2a')],function(_0x547aa2){return{'name':_0x547aa2['fieldName'],'type':_0x547aa2[_0x0dbf('0x2b')][_0x0dbf('0x2c')]};});_0x3b2635['model']=_[_0x0dbf('0x2d')](_0x236243,_0x0dbf('0x27'));_0x3b2635[_0x0dbf('0x2e')]=_['keys'](_0x38e5f9[_0x0dbf('0x2e')]);_0x3b2635[_0x0dbf('0x2f')]=_['intersection'](_0x3b2635[_0x0dbf('0x30')],_0x3b2635[_0x0dbf('0x2e')]);_0x26da52['attributes']=_[_0x0dbf('0x31')](_0x3b2635[_0x0dbf('0x30')],qs['fields'](_0x38e5f9[_0x0dbf('0x2e')]['fields']));_0x26da52[_0x0dbf('0x32')]=_0x26da52[_0x0dbf('0x32')][_0x0dbf('0x33')]?_0x26da52[_0x0dbf('0x32')]:_0x3b2635[_0x0dbf('0x30')];if(!_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x34')](_0x0dbf('0x35'))){_0x26da52[_0x0dbf('0x1e')]=qs['limit'](_0x38e5f9['query']['limit']);_0x26da52[_0x0dbf('0x1d')]=qs[_0x0dbf('0x1d')](_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x1d')]);}_0x26da52['order']=qs[_0x0dbf('0x36')](_0x38e5f9['query'][_0x0dbf('0x36')]);_0x26da52[_0x0dbf('0x37')]=qs['filters'](_[_0x0dbf('0x38')](_0x38e5f9[_0x0dbf('0x2e')],_0x3b2635[_0x0dbf('0x2f')]),_0x236243);if(_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x39')]){_0x26da52[_0x0dbf('0x37')]=_[_0x0dbf('0x3a')](_0x26da52['where'],{'$or':_['map'](_0x236243,function(_0x314cba){if(_0x314cba[_0x0dbf('0x2b')]!==_0x0dbf('0x3b')){var _0x4dd63f={};_0x4dd63f[_0x314cba[_0x0dbf('0x27')]]={'$like':'%'+_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x39')]+'%'};return _0x4dd63f;}})});}_0x26da52=_[_0x0dbf('0x3a')]({},_0x26da52,_0x38e5f9[_0x0dbf('0x3c')]);var _0x37c326={'where':_0x26da52[_0x0dbf('0x37')]};return db[_0x0dbf('0x3d')]['count'](_0x37c326)[_0x0dbf('0x24')](function(_0x4b9eb0){_0x5c1034[_0x0dbf('0x20')]=_0x4b9eb0;if(_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x3e')]){_0x26da52['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x26da52);})['then'](function(_0x59efb6){_0x5c1034[_0x0dbf('0x3f')]=_0x59efb6;return _0x5c1034;})[_0x0dbf('0x24')](respondWithFilteredResult(_0x106167,_0x26da52))[_0x0dbf('0x40')](handleError(_0x106167,null));};exports[_0x0dbf('0x41')]=function(_0x5df3ad,_0x1e1900){var _0x4eba4c={'raw':!![],'where':{'id':_0x5df3ad[_0x0dbf('0x42')]['id']}},_0x42980f={};_0x42980f['model']=_[_0x0dbf('0x43')](db[_0x0dbf('0x3d')][_0x0dbf('0x2a')]);_0x42980f[_0x0dbf('0x2e')]=_[_0x0dbf('0x43')](_0x5df3ad['query']);_0x42980f[_0x0dbf('0x2f')]=_[_0x0dbf('0x31')](_0x42980f[_0x0dbf('0x30')],_0x42980f[_0x0dbf('0x2e')]);_0x4eba4c[_0x0dbf('0x32')]=_['intersection'](_0x42980f[_0x0dbf('0x30')],qs[_0x0dbf('0x44')](_0x5df3ad[_0x0dbf('0x2e')][_0x0dbf('0x44')]));_0x4eba4c['attributes']=_0x4eba4c[_0x0dbf('0x32')][_0x0dbf('0x33')]?_0x4eba4c['attributes']:_0x42980f[_0x0dbf('0x30')];if(_0x5df3ad[_0x0dbf('0x2e')][_0x0dbf('0x3e')]){_0x4eba4c[_0x0dbf('0x45')]=[{'all':!![]}];}_0x4eba4c=_[_0x0dbf('0x3a')]({},_0x4eba4c,_0x5df3ad[_0x0dbf('0x3c')]);return db[_0x0dbf('0x3d')][_0x0dbf('0x46')](_0x4eba4c)['then'](handleEntityNotFound(_0x1e1900,null))[_0x0dbf('0x24')](respondWithResult(_0x1e1900,null))[_0x0dbf('0x40')](handleError(_0x1e1900,null));};exports[_0x0dbf('0x47')]=function(_0x18e252,_0x47c113){return db['SquareRecording']['create'](_0x18e252[_0x0dbf('0x48')],{})[_0x0dbf('0x24')](respondWithResult(_0x47c113,0xc9))[_0x0dbf('0x40')](handleError(_0x47c113,null));};exports[_0x0dbf('0x23')]=function(_0x36e2fa,_0x347915){if(_0x36e2fa[_0x0dbf('0x48')]['id']){delete _0x36e2fa[_0x0dbf('0x48')]['id'];}return db[_0x0dbf('0x3d')][_0x0dbf('0x46')]({'where':{'id':_0x36e2fa[_0x0dbf('0x42')]['id']}})[_0x0dbf('0x24')](handleEntityNotFound(_0x347915,null))[_0x0dbf('0x24')](saveUpdates(_0x36e2fa[_0x0dbf('0x48')],null))[_0x0dbf('0x24')](respondWithResult(_0x347915,null))['catch'](handleError(_0x347915,null));};exports['download']=function(_0x4aa7e4,_0x391f16,_0x7683f4){var _0x2e35bc=require(_0x0dbf('0x49'));var _0x5b9f9e=![];var _0x4b6bfd={};if(_0x4aa7e4[_0x0dbf('0x2e')][_0x0dbf('0x2b')]&&_0x4aa7e4['query'][_0x0dbf('0x2b')]==='uniqueid'){_0x4b6bfd[_0x0dbf('0x4a')]=_0x4aa7e4['params']['id'];}else{_0x4b6bfd['id']=_0x4aa7e4[_0x0dbf('0x42')]['id'];}return db[_0x0dbf('0x3d')][_0x0dbf('0x46')]({'where':_0x4b6bfd,'attributes':['id',_0x0dbf('0x4b'),_0x0dbf('0x4c')],'raw':!![]})[_0x0dbf('0x24')](handleEntityNotFound(_0x391f16,null))[_0x0dbf('0x24')](function(_0x5a4c2d){if(_0x5a4c2d){var _0x22dd19=_0x5a4c2d['savePath'];var _0x574907=util[_0x0dbf('0x4d')](_0x0dbf('0x4e'),_0x22dd19);if(fs[_0x0dbf('0x4f')](_0x574907)){_0x5b9f9e=!![];return _0x2e35bc[_0x0dbf('0x50')](_0x574907,_0x22dd19,config[_0x0dbf('0x51')][_0x0dbf('0x52')])['then'](function(){return _0x5a4c2d;});}return _0x5a4c2d;}})[_0x0dbf('0x24')](function(_0x365344){if(_0x365344){var _0x3717a8=_0x365344['savePath'];if(!fs[_0x0dbf('0x4f')](_0x3717a8)){throw new db[(_0x0dbf('0x53'))][(_0x0dbf('0x54'))](_0x0dbf('0x55'));}if(_0x365344[_0x0dbf('0x4c')]){return _0x391f16[_0x0dbf('0x56')](_0x3717a8,_0x365344[_0x0dbf('0x4c')]+path['extname'](_0x3717a8),function(){if(_0x5b9f9e){fs[_0x0dbf('0x57')](_0x3717a8);}});}else{return _0x391f16[_0x0dbf('0x56')](_0x3717a8,function(_0x3c4691){if(_0x5b9f9e){fs[_0x0dbf('0x57')](_0x3717a8);}});}}})['catch'](function(_0x3556a5){if(_0x3556a5[_0x0dbf('0x58')]===_0x0dbf('0x55')){_0x391f16[_0x0dbf('0x1a')](0x194)[_0x0dbf('0x28')](_0x0dbf('0x59'));}else{return handleError(_0x391f16,null);}});};exports[_0x0dbf('0x25')]=function(_0x864b24,_0x2d1420){return db[_0x0dbf('0x3d')]['find']({'where':{'id':_0x864b24['params']['id']}})[_0x0dbf('0x24')](function(_0x50942d){if(_[_0x0dbf('0x5a')](_0x50942d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x50942d;})[_0x0dbf('0x24')](function(_0x205e80){var _0x126b93=_0x205e80[_0x0dbf('0x4b')];logger['info'](_0x0dbf('0x5b'),_0x126b93);if(!_[_0x0dbf('0x5a')](_0x205e80[_0x0dbf('0x4b')])&&fs['existsSync'](_0x126b93)){logger[_0x0dbf('0x5c')](_0x0dbf('0x5d')+_0x126b93+_0x0dbf('0x5e'));fs[_0x0dbf('0x5f')](_0x126b93);}_0x126b93=_0x126b93+_0x0dbf('0x60');if(!_[_0x0dbf('0x5a')](_0x205e80[_0x0dbf('0x4b')])&&fs[_0x0dbf('0x4f')](_0x126b93)){logger['info'](_0x0dbf('0x5d')+_0x126b93+_0x0dbf('0x5e'));fs[_0x0dbf('0x5f')](_0x126b93);}return _0x205e80;})[_0x0dbf('0x24')](function(_0x5637dd){if(!_0x5637dd)throw new InternalError();return _0x5637dd[_0x0dbf('0x25')]();})[_0x0dbf('0x24')](function(){_0x2d1420['status'](0xcc)[_0x0dbf('0x1b')]();})['catch'](handleError(_0x2d1420,null));}; \ No newline at end of file +var _0x2e2f=['type','VIRTUAL','filter','options','SquareRecording','includeAll','include','findAll','show','rawAttributes','intersection','catch','create','update','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','destroy','find','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','moment','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','error','stack','name','send','index','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge'];(function(_0x5a7bdb,_0x910d08){var _0x3e8738=function(_0x3bcf0c){while(--_0x3bcf0c){_0x5a7bdb['push'](_0x5a7bdb['shift']());}};_0x3e8738(++_0x910d08);}(_0x2e2f,0x190));var _0xf2e2=function(_0xd10b43,_0x440ec1){_0xd10b43=_0xd10b43-0x0;var _0x369090=_0x2e2f[_0xd10b43];return _0x369090;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2e2('0x0'));var zipdir=require(_0xf2e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2e2('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf2e2('0x3'));var path=require(_0xf2e2('0x4'));var sox=require('sox');var csv=require(_0xf2e2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2e2('0x6'));var squel=require(_0xf2e2('0x7'));var crypto=require('crypto');var jsforce=require(_0xf2e2('0x8'));var deskjs=require(_0xf2e2('0x9'));var toCsv=require(_0xf2e2('0x5'));var querystring=require(_0xf2e2('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf2e2('0xb'));var hardwareService=require(_0xf2e2('0xc'));var logger=require(_0xf2e2('0xd'))(_0xf2e2('0xe'));var utils=require(_0xf2e2('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xf2e2('0x10'));var db=require(_0xf2e2('0x11'))['db'];function respondWithStatusCode(_0x4a4291,_0x33f264){_0x33f264=_0x33f264||0xcc;return function(_0x294cb9){if(_0x294cb9){return _0x4a4291[_0xf2e2('0x12')](_0x33f264);}return _0x4a4291[_0xf2e2('0x13')](_0x33f264)[_0xf2e2('0x14')]();};}function respondWithResult(_0x24d597,_0x399b2f){_0x399b2f=_0x399b2f||0xc8;return function(_0x44bc68){if(_0x44bc68){return _0x24d597[_0xf2e2('0x13')](_0x399b2f)[_0xf2e2('0x15')](_0x44bc68);}};}function respondWithFilteredResult(_0x51fc19,_0x82e3ab){return function(_0x33b832){if(_0x33b832){var _0x33ec5d=typeof _0x82e3ab['offset']==='undefined'&&typeof _0x82e3ab[_0xf2e2('0x16')]===_0xf2e2('0x17');var _0x5b6cb6=_0x33b832[_0xf2e2('0x18')];var _0x5a1bce=_0x33ec5d?0x0:_0x82e3ab[_0xf2e2('0x19')];var _0x4ae11d=_0x33ec5d?_0x33b832[_0xf2e2('0x18')]:_0x82e3ab['offset']+_0x82e3ab['limit'];var _0x2fc31f;if(_0x4ae11d>=_0x5b6cb6){_0x4ae11d=_0x5b6cb6;_0x2fc31f=0xc8;}else{_0x2fc31f=0xce;}_0x51fc19[_0xf2e2('0x13')](_0x2fc31f);return _0x51fc19[_0xf2e2('0x1a')](_0xf2e2('0x1b'),_0x5a1bce+'-'+_0x4ae11d+'/'+_0x5b6cb6)['json'](_0x33b832);}return null;};}function patchUpdates(_0x30d068){return function(_0x10bc19){try{jsonpatch[_0xf2e2('0x1c')](_0x10bc19,_0x30d068,!![]);}catch(_0x260c5d){return BPromise[_0xf2e2('0x1d')](_0x260c5d);}return _0x10bc19['save']();};}function saveUpdates(_0x5cf318,_0x3007b8){return function(_0x2d1fc1){if(_0x2d1fc1){return _0x2d1fc1['update'](_0x5cf318)[_0xf2e2('0x1e')](function(_0x3965ab){return _0x3965ab;});}return null;};}function removeEntity(_0x2cbf45,_0x48d36a){return function(_0xb9e752){if(_0xb9e752){return _0xb9e752['destroy']()[_0xf2e2('0x1e')](function(){_0x2cbf45[_0xf2e2('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33e8b5,_0x3e99d0){return function(_0x16f4df){if(!_0x16f4df){_0x33e8b5[_0xf2e2('0x12')](0x194);}return _0x16f4df;};}function handleError(_0x255f8c,_0x1630d3){_0x1630d3=_0x1630d3||0x1f4;return function(_0x11ce59){logger[_0xf2e2('0x1f')](_0x11ce59[_0xf2e2('0x20')]);if(_0x11ce59[_0xf2e2('0x21')]){delete _0x11ce59[_0xf2e2('0x21')];}_0x255f8c[_0xf2e2('0x13')](_0x1630d3)[_0xf2e2('0x22')](_0x11ce59);};}exports[_0xf2e2('0x23')]=function(_0x487560,_0x4f5356){var _0x1dfe49={},_0x4c31ac={},_0x158e8c={'count':0x0,'rows':[]};var _0xd26d8e=_['map'](db['SquareRecording']['rawAttributes'],function(_0x56913e){return{'name':_0x56913e['fieldName'],'type':_0x56913e['type'][_0xf2e2('0x24')]};});_0x4c31ac[_0xf2e2('0x25')]=_[_0xf2e2('0x26')](_0xd26d8e,_0xf2e2('0x21'));_0x4c31ac[_0xf2e2('0x27')]=_[_0xf2e2('0x28')](_0x487560['query']);_0x4c31ac['filters']=_['intersection'](_0x4c31ac[_0xf2e2('0x25')],_0x4c31ac[_0xf2e2('0x27')]);_0x1dfe49['attributes']=_['intersection'](_0x4c31ac[_0xf2e2('0x25')],qs['fields'](_0x487560[_0xf2e2('0x27')][_0xf2e2('0x29')]));_0x1dfe49['attributes']=_0x1dfe49[_0xf2e2('0x2a')][_0xf2e2('0x2b')]?_0x1dfe49[_0xf2e2('0x2a')]:_0x4c31ac['model'];if(!_0x487560[_0xf2e2('0x27')][_0xf2e2('0x2c')]('nolimit')){_0x1dfe49[_0xf2e2('0x16')]=qs[_0xf2e2('0x16')](_0x487560[_0xf2e2('0x27')][_0xf2e2('0x16')]);_0x1dfe49[_0xf2e2('0x19')]=qs[_0xf2e2('0x19')](_0x487560[_0xf2e2('0x27')][_0xf2e2('0x19')]);}_0x1dfe49[_0xf2e2('0x2d')]=qs['sort'](_0x487560[_0xf2e2('0x27')][_0xf2e2('0x2e')]);_0x1dfe49[_0xf2e2('0x2f')]=qs[_0xf2e2('0x30')](_['pick'](_0x487560[_0xf2e2('0x27')],_0x4c31ac[_0xf2e2('0x30')]),_0xd26d8e);if(_0x487560[_0xf2e2('0x27')]['filter']){_0x1dfe49[_0xf2e2('0x2f')]=_[_0xf2e2('0x31')](_0x1dfe49[_0xf2e2('0x2f')],{'$or':_[_0xf2e2('0x26')](_0xd26d8e,function(_0x4b52f6){if(_0x4b52f6[_0xf2e2('0x32')]!==_0xf2e2('0x33')){var _0xe30997={};_0xe30997[_0x4b52f6[_0xf2e2('0x21')]]={'$like':'%'+_0x487560[_0xf2e2('0x27')][_0xf2e2('0x34')]+'%'};return _0xe30997;}})});}_0x1dfe49=_['merge']({},_0x1dfe49,_0x487560[_0xf2e2('0x35')]);var _0x2b87d3={'where':_0x1dfe49['where']};return db[_0xf2e2('0x36')]['count'](_0x2b87d3)[_0xf2e2('0x1e')](function(_0x5021f0){_0x158e8c['count']=_0x5021f0;if(_0x487560[_0xf2e2('0x27')][_0xf2e2('0x37')]){_0x1dfe49[_0xf2e2('0x38')]=[{'all':!![]}];}return db[_0xf2e2('0x36')][_0xf2e2('0x39')](_0x1dfe49);})[_0xf2e2('0x1e')](function(_0x142e94){_0x158e8c['rows']=_0x142e94;return _0x158e8c;})[_0xf2e2('0x1e')](respondWithFilteredResult(_0x4f5356,_0x1dfe49))['catch'](handleError(_0x4f5356,null));};exports[_0xf2e2('0x3a')]=function(_0x7d6ed2,_0x36e782){var _0x2921d4={'raw':!![],'where':{'id':_0x7d6ed2['params']['id']}},_0x353c9e={};_0x353c9e[_0xf2e2('0x25')]=_['keys'](db[_0xf2e2('0x36')][_0xf2e2('0x3b')]);_0x353c9e[_0xf2e2('0x27')]=_['keys'](_0x7d6ed2[_0xf2e2('0x27')]);_0x353c9e[_0xf2e2('0x30')]=_[_0xf2e2('0x3c')](_0x353c9e[_0xf2e2('0x25')],_0x353c9e[_0xf2e2('0x27')]);_0x2921d4[_0xf2e2('0x2a')]=_[_0xf2e2('0x3c')](_0x353c9e[_0xf2e2('0x25')],qs[_0xf2e2('0x29')](_0x7d6ed2[_0xf2e2('0x27')][_0xf2e2('0x29')]));_0x2921d4[_0xf2e2('0x2a')]=_0x2921d4[_0xf2e2('0x2a')][_0xf2e2('0x2b')]?_0x2921d4[_0xf2e2('0x2a')]:_0x353c9e['model'];if(_0x7d6ed2[_0xf2e2('0x27')][_0xf2e2('0x37')]){_0x2921d4[_0xf2e2('0x38')]=[{'all':!![]}];}_0x2921d4=_[_0xf2e2('0x31')]({},_0x2921d4,_0x7d6ed2['options']);return db[_0xf2e2('0x36')]['find'](_0x2921d4)[_0xf2e2('0x1e')](handleEntityNotFound(_0x36e782,null))[_0xf2e2('0x1e')](respondWithResult(_0x36e782,null))[_0xf2e2('0x3d')](handleError(_0x36e782,null));};exports['create']=function(_0xa954cb,_0x2fbad4){return db[_0xf2e2('0x36')][_0xf2e2('0x3e')](_0xa954cb['body'],{})[_0xf2e2('0x1e')](respondWithResult(_0x2fbad4,0xc9))[_0xf2e2('0x3d')](handleError(_0x2fbad4,null));};exports[_0xf2e2('0x3f')]=function(_0x26d759,_0x360672){if(_0x26d759['body']['id']){delete _0x26d759[_0xf2e2('0x40')]['id'];}return db[_0xf2e2('0x36')]['find']({'where':{'id':_0x26d759[_0xf2e2('0x41')]['id']}})[_0xf2e2('0x1e')](handleEntityNotFound(_0x360672,null))['then'](saveUpdates(_0x26d759[_0xf2e2('0x40')],null))[_0xf2e2('0x1e')](respondWithResult(_0x360672,null))[_0xf2e2('0x3d')](handleError(_0x360672,null));};exports[_0xf2e2('0x42')]=function(_0x119a22,_0x2dca68,_0x3b2e37){var _0x3c0dc1=require(_0xf2e2('0x43'));var _0x1e6a9c=![];var _0x46054e={};if(_0x119a22['query'][_0xf2e2('0x32')]&&_0x119a22['query'][_0xf2e2('0x32')]===_0xf2e2('0x44')){_0x46054e['uniqueid']=_0x119a22['params']['id'];}else{_0x46054e['id']=_0x119a22['params']['id'];}return db[_0xf2e2('0x36')]['find']({'where':_0x46054e,'attributes':['id',_0xf2e2('0x45'),_0xf2e2('0x46')],'raw':!![]})[_0xf2e2('0x1e')](handleEntityNotFound(_0x2dca68,null))[_0xf2e2('0x1e')](function(_0x238023){if(_0x238023){var _0x19980f=_0x238023[_0xf2e2('0x45')];var _0x4bc569=util[_0xf2e2('0x47')](_0xf2e2('0x48'),_0x19980f);if(fs[_0xf2e2('0x49')](_0x4bc569)){_0x1e6a9c=!![];return _0x3c0dc1[_0xf2e2('0x4a')](_0x4bc569,_0x19980f,config[_0xf2e2('0x4b')][_0xf2e2('0x4c')])[_0xf2e2('0x1e')](function(){return _0x238023;});}return _0x238023;}})[_0xf2e2('0x1e')](function(_0xfb9c49){if(_0xfb9c49){var _0x241769=_0xfb9c49[_0xf2e2('0x45')];if(!fs[_0xf2e2('0x49')](_0x241769)){throw new db[(_0xf2e2('0x4d'))][(_0xf2e2('0x4e'))](_0xf2e2('0x4f'));}if(_0xfb9c49[_0xf2e2('0x46')]){return _0x2dca68[_0xf2e2('0x42')](_0x241769,_0xfb9c49[_0xf2e2('0x46')]+path[_0xf2e2('0x50')](_0x241769),function(){if(_0x1e6a9c){fs['unlink'](_0x241769);}});}else{return _0x2dca68[_0xf2e2('0x42')](_0x241769,function(_0x3039fe){if(_0x1e6a9c){fs[_0xf2e2('0x51')](_0x241769);}});}}})[_0xf2e2('0x3d')](function(_0x5aaa8f){if(_0x5aaa8f['message']===_0xf2e2('0x4f')){_0x2dca68[_0xf2e2('0x13')](0x194)['send'](_0xf2e2('0x52'));}else{return handleError(_0x2dca68,null);}});};exports[_0xf2e2('0x53')]=function(_0x249133,_0x71b149){return db[_0xf2e2('0x36')][_0xf2e2('0x54')]({'where':{'id':_0x249133[_0xf2e2('0x41')]['id']}})[_0xf2e2('0x1e')](function(_0x210703){if(_[_0xf2e2('0x55')](_0x210703)){throw new ReferenceError(_0xf2e2('0x56'));}return _0x210703;})[_0xf2e2('0x1e')](function(_0x1d7ca0){var _0x470385=_0x1d7ca0[_0xf2e2('0x45')];logger[_0xf2e2('0x57')]('cancellazione\x20fisica\x20documento\x20%s',_0x470385);if(!_['isNil'](_0x1d7ca0[_0xf2e2('0x45')])&&fs[_0xf2e2('0x49')](_0x470385)){logger[_0xf2e2('0x57')](_0xf2e2('0x58')+_0x470385+_0xf2e2('0x59'));fs['unlinkSync'](_0x470385);}_0x470385=_0x470385+'.cypher';if(!_['isNil'](_0x1d7ca0[_0xf2e2('0x45')])&&fs[_0xf2e2('0x49')](_0x470385)){logger['info']('File:\x20\x22'+_0x470385+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x470385);}return _0x1d7ca0;})[_0xf2e2('0x1e')](function(_0x442f92){if(!_0x442f92)throw new InternalError();return _0x442f92[_0xf2e2('0x53')]();})['then'](function(){_0x71b149['status'](0xcc)[_0xf2e2('0x14')]();})[_0xf2e2('0x3d')](handleError(_0x71b149,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f23a55e..4d30eba 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 _0x0755=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xfca0bf,_0x8ac9f9){var _0xc72568=function(_0x4b4a90){while(--_0x4b4a90){_0xfca0bf['push'](_0xfca0bf['shift']());}};_0xc72568(++_0x8ac9f9);}(_0x0755,0x7c));var _0x5075=function(_0x453271,_0x52ee0f){_0x453271=_0x453271-0x0;var _0x54530b=_0x0755[_0x453271];return _0x54530b;};'use strict';var _=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var logger=require(_0x5075('0x2'))(_0x5075('0x3'));var moment=require(_0x5075('0x4'));var BPromise=require(_0x5075('0x5'));var rp=require(_0x5075('0x6'));var fs=require('fs');var path=require(_0x5075('0x7'));var rimraf=require(_0x5075('0x8'));var config=require(_0x5075('0x9'));var attributes=require('./squareRecording.attributes');module[_0x5075('0xa')]=function(_0x2a7be,_0x3f4fea){return _0x2a7be[_0x5075('0xb')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d0b=['rimraf','./squareRecording.attributes','define','SquareRecording','square_recordings','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3a6a27,_0x2d372f){var _0x3f81df=function(_0x411e12){while(--_0x411e12){_0x3a6a27['push'](_0x3a6a27['shift']());}};_0x3f81df(++_0x2d372f);}(_0x2d0b,0x102));var _0xb2d0=function(_0x3eb916,_0x4a7814){_0x3eb916=_0x3eb916-0x0;var _0xf810bd=_0x2d0b[_0x3eb916];return _0xf810bd;};'use strict';var _=require('lodash');var util=require(_0xb2d0('0x0'));var logger=require(_0xb2d0('0x1'))(_0xb2d0('0x2'));var moment=require('moment');var BPromise=require(_0xb2d0('0x3'));var rp=require(_0xb2d0('0x4'));var fs=require('fs');var path=require(_0xb2d0('0x5'));var rimraf=require(_0xb2d0('0x6'));var config=require('../../config/environment');var attributes=require(_0xb2d0('0x7'));module['exports']=function(_0x395e69,_0x41521f){return _0x395e69[_0xb2d0('0x8')](_0xb2d0('0x9'),attributes,{'tableName':_0xb2d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 2d40fe0..c106b99 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 _0x5c41=['SquareRecording','body','options','raw','catch','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareRecording,\x20%s,\x20%s','CreateSquareRecording'];(function(_0x7cc1d1,_0x29c3bc){var _0x3fef7a=function(_0x2e2419){while(--_0x2e2419){_0x7cc1d1['push'](_0x7cc1d1['shift']());}};_0x3fef7a(++_0x29c3bc);}(_0x5c41,0xb4));var _0x15c4=function(_0x5a9dbc,_0x33bf95){_0x5a9dbc=_0x5a9dbc-0x0;var _0x5e9022=_0x5c41[_0x5a9dbc];return _0x5e9022;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15c4('0x0'));var fs=require('fs');var Redis=require(_0x15c4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x15c4('0x2'));var logger=require(_0x15c4('0x3'))(_0x15c4('0x4'));var config=require('../../config/environment');var jayson=require(_0x15c4('0x5'));var client=jayson[_0x15c4('0x6')][_0x15c4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4df3cb,_0x332fe2,_0xdbfca9){return new BPromise(function(_0x58ec59,_0x3ca593){return client[_0x15c4('0x8')](_0x4df3cb,_0xdbfca9)[_0x15c4('0x9')](function(_0x4c6a7d){logger[_0x15c4('0xa')]('SquareRecording,\x20%s,\x20%s',_0x332fe2,_0x15c4('0xb'));logger['debug'](_0x15c4('0xc'),_0x332fe2,_0x15c4('0xb'),JSON[_0x15c4('0xd')](_0x4c6a7d));if(_0x4c6a7d[_0x15c4('0xe')]){if(_0x4c6a7d['error'][_0x15c4('0xf')]===0x1f4){logger[_0x15c4('0xe')]('SquareRecording,\x20%s,\x20%s',_0x332fe2,_0x4c6a7d[_0x15c4('0xe')][_0x15c4('0x10')]);return _0x3ca593(_0x4c6a7d['error']['message']);}logger[_0x15c4('0xe')]('SquareRecording,\x20%s,\x20%s',_0x332fe2,_0x4c6a7d[_0x15c4('0xe')][_0x15c4('0x10')]);return _0x58ec59(_0x4c6a7d[_0x15c4('0xe')]['message']);}else{logger[_0x15c4('0xa')]('SquareRecording,\x20%s,\x20%s',_0x332fe2,_0x15c4('0xb'));_0x58ec59(_0x4c6a7d[_0x15c4('0x11')][_0x15c4('0x10')]);}})['catch'](function(_0x25146b){logger[_0x15c4('0xe')](_0x15c4('0x12'),_0x332fe2,_0x25146b);_0x3ca593(_0x25146b);});});}exports[_0x15c4('0x13')]=function(_0x5969b2){var _0x757e6e=this;return new Promise(function(_0x2247e7,_0x6ecf48){return db[_0x15c4('0x14')]['create'](_0x5969b2[_0x15c4('0x15')],{'raw':_0x5969b2[_0x15c4('0x16')]?_0x5969b2['options'][_0x15c4('0x17')]===undefined?!![]:![]:!![]})[_0x15c4('0x9')](function(_0x509d17){logger[_0x15c4('0xa')](_0x15c4('0x13'),_0x5969b2);logger['debug'](_0x15c4('0x13'),_0x5969b2,JSON[_0x15c4('0xd')](_0x509d17));_0x2247e7(_0x509d17);})[_0x15c4('0x18')](function(_0x5484fe){logger[_0x15c4('0xe')](_0x15c4('0x13'),_0x5484fe[_0x15c4('0x10')],_0x5969b2);_0x6ecf48(_0x757e6e['error'](0x1f4,_0x5484fe['message']));});});}; \ No newline at end of file +var _0x7a35=['CreateSquareRecording','SquareRecording','body','options','raw','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a35,0x18e));var _0x57a3=function(_0x3600a9,_0x4a3cbb){_0x3600a9=_0x3600a9-0x0;var _0x4532fd=_0x7a35[_0x3600a9];return _0x4532fd;};'use strict';var _=require(_0x57a3('0x0'));var util=require('util');var moment=require(_0x57a3('0x1'));var BPromise=require(_0x57a3('0x2'));var rs=require(_0x57a3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57a3('0x4'))['db'];var utils=require(_0x57a3('0x5'));var logger=require(_0x57a3('0x6'))('rpc');var config=require(_0x57a3('0x7'));var jayson=require(_0x57a3('0x8'));var client=jayson[_0x57a3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x172647,_0x5dcf8c,_0x3342eb){return new BPromise(function(_0x25f780,_0x7151eb){return client[_0x57a3('0xa')](_0x172647,_0x3342eb)[_0x57a3('0xb')](function(_0x2d9a9d){logger[_0x57a3('0xc')](_0x57a3('0xd'),_0x5dcf8c,_0x57a3('0xe'));logger[_0x57a3('0xf')](_0x57a3('0x10'),_0x5dcf8c,_0x57a3('0xe'),JSON['stringify'](_0x2d9a9d));if(_0x2d9a9d['error']){if(_0x2d9a9d[_0x57a3('0x11')][_0x57a3('0x12')]===0x1f4){logger[_0x57a3('0x11')]('SquareRecording,\x20%s,\x20%s',_0x5dcf8c,_0x2d9a9d[_0x57a3('0x11')][_0x57a3('0x13')]);return _0x7151eb(_0x2d9a9d['error'][_0x57a3('0x13')]);}logger['error'](_0x57a3('0xd'),_0x5dcf8c,_0x2d9a9d[_0x57a3('0x11')][_0x57a3('0x13')]);return _0x25f780(_0x2d9a9d[_0x57a3('0x11')][_0x57a3('0x13')]);}else{logger[_0x57a3('0xc')](_0x57a3('0xd'),_0x5dcf8c,_0x57a3('0xe'));_0x25f780(_0x2d9a9d[_0x57a3('0x14')]['message']);}})[_0x57a3('0x15')](function(_0x452594){logger[_0x57a3('0x11')](_0x57a3('0xd'),_0x5dcf8c,_0x452594);_0x7151eb(_0x452594);});});}exports[_0x57a3('0x16')]=function(_0x411c6d){var _0x540353=this;return new Promise(function(_0x385541,_0x271ed6){return db[_0x57a3('0x17')]['create'](_0x411c6d[_0x57a3('0x18')],{'raw':_0x411c6d[_0x57a3('0x19')]?_0x411c6d['options'][_0x57a3('0x1a')]===undefined?!![]:![]:!![]})[_0x57a3('0xb')](function(_0x4c4cdb){logger[_0x57a3('0xc')]('CreateSquareRecording',_0x411c6d);logger[_0x57a3('0xf')](_0x57a3('0x16'),_0x411c6d,JSON[_0x57a3('0x1b')](_0x4c4cdb));_0x385541(_0x4c4cdb);})['catch'](function(_0x24c1b7){logger['error'](_0x57a3('0x16'),_0x24c1b7['message'],_0x411c6d);_0x271ed6(_0x540353['error'](0x1f4,_0x24c1b7[_0x57a3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 715e902..f5215b0 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x547a56,_0x3f7ef1){var _0x29f48e=function(_0x231395){while(--_0x231395){_0x547a56['push'](_0x547a56['shift']());}};_0x29f48e(++_0x3f7ef1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x4761f8,_0x2cbbe0){var _0x2835cd=function(_0x13da7c){while(--_0x13da7c){_0x4761f8['push'](_0x4761f8['shift']());}};_0x2835cd(++_0x2cbbe0);}(_0xe706,0xa3));var _0x6e70=function(_0x25f0d5,_0xc2dbf1){_0x25f0d5=_0x25f0d5-0x0;var _0x3dac6b=_0xe706[_0x25f0d5];return _0x3dac6b;};'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 b904b4c..a3f549b 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 _0xd422=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x207aea,_0x2a9163){var _0x27ce5a=function(_0x2a58d6){while(--_0x2a58d6){_0x207aea['push'](_0x207aea['shift']());}};_0x27ce5a(++_0x2a9163);}(_0xd422,0x1de));var _0x2d42=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd422[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x2d42('0x0'));module['exports']={'network':{'type':Sequelize[_0x2d42('0x1')]},'network_script':{'type':Sequelize[_0x2d42('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2d42('0x1')]},'language':{'type':Sequelize[_0x2d42('0x1')]},'type':{'type':Sequelize[_0x2d42('0x1')]},'uniqueid':{'type':Sequelize[_0x2d42('0x1')]},'version':{'type':Sequelize[_0x2d42('0x1')]},'callerid':{'type':Sequelize[_0x2d42('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x2d42('0x1')]},'callingani2':{'type':Sequelize[_0x2d42('0x1')]},'callington':{'type':Sequelize[_0x2d42('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x2d42('0x1')]},'context':{'type':Sequelize[_0x2d42('0x1')]},'extension':{'type':Sequelize[_0x2d42('0x1')]},'priority':{'type':Sequelize[_0x2d42('0x1')]},'enhanced':{'type':Sequelize[_0x2d42('0x1')]},'accountcode':{'type':Sequelize[_0x2d42('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2d42('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x2d42('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x652f=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x3c762f,_0x35e420){var _0xd691f0=function(_0x4b9280){while(--_0x4b9280){_0x3c762f['push'](_0x3c762f['shift']());}};_0xd691f0(++_0x35e420);}(_0x652f,0xfa));var _0xf652=function(_0xc52562,_0x5d9c7a){_0xc52562=_0xc52562-0x0;var _0x14f72b=_0x652f[_0xc52562];return _0x14f72b;};'use strict';var Sequelize=require(_0xf652('0x0'));module[_0xf652('0x1')]={'network':{'type':Sequelize[_0xf652('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf652('0x2')]},'uniqueid':{'type':Sequelize[_0xf652('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf652('0x2')]},'callingpres':{'type':Sequelize[_0xf652('0x2')]},'callingani2':{'type':Sequelize[_0xf652('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xf652('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf652('0x2')]},'extension':{'type':Sequelize[_0xf652('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xf652('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xf652('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf652('0x3')]},'leaveAt':{'type':Sequelize[_0xf652('0x3')]},'bot':{'type':Sequelize[_0xf652('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 5328d69..152db11 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 _0xd9f2=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','send','index','map','SquareReport','rawAttributes','type','name','query','keys','filters','intersection','attributes','fields','length','sort','pick','merge','where','filter','options','includeAll','rows','show','params','model','include','find','create','body','catch','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa990b7,_0x26c527){var _0x52c99c=function(_0xf94328){while(--_0xf94328){_0xa990b7['push'](_0xa990b7['shift']());}};_0x52c99c(++_0x26c527);}(_0xd9f2,0x14c));var _0x2d9f=function(_0x38d8b5,_0x383873){_0x38d8b5=_0x38d8b5-0x0;var _0x21f68e=_0xd9f2[_0x38d8b5];return _0x21f68e;};'use strict';var emlformat=require(_0x2d9f('0x0'));var rimraf=require(_0x2d9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2d9f('0x2'));var moment=require(_0x2d9f('0x3'));var BPromise=require(_0x2d9f('0x4'));var Mustache=require(_0x2d9f('0x5'));var util=require(_0x2d9f('0x6'));var path=require(_0x2d9f('0x7'));var sox=require(_0x2d9f('0x8'));var csv=require(_0x2d9f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d9f('0xa'));var _=require('lodash');var squel=require(_0x2d9f('0xb'));var crypto=require(_0x2d9f('0xc'));var jsforce=require(_0x2d9f('0xd'));var deskjs=require(_0x2d9f('0xe'));var toCsv=require(_0x2d9f('0x9'));var querystring=require(_0x2d9f('0xf'));var Papa=require('papaparse');var Redis=require(_0x2d9f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d9f('0x11'));var hardwareService=require(_0x2d9f('0x12'));var logger=require(_0x2d9f('0x13'))('api');var utils=require(_0x2d9f('0x14'));var config=require(_0x2d9f('0x15'));var licenseUtil=require(_0x2d9f('0x16'));var db=require(_0x2d9f('0x17'))['db'];function respondWithStatusCode(_0x2ccc67,_0x1e1e14){_0x1e1e14=_0x1e1e14||0xcc;return function(_0x2d5875){if(_0x2d5875){return _0x2ccc67[_0x2d9f('0x18')](_0x1e1e14);}return _0x2ccc67[_0x2d9f('0x19')](_0x1e1e14)[_0x2d9f('0x1a')]();};}function respondWithResult(_0x84f24f,_0x2ee16d){_0x2ee16d=_0x2ee16d||0xc8;return function(_0x31377a){if(_0x31377a){return _0x84f24f[_0x2d9f('0x19')](_0x2ee16d)[_0x2d9f('0x1b')](_0x31377a);}};}function respondWithFilteredResult(_0x12390a,_0x1f0c3f){return function(_0x5b43d0){if(_0x5b43d0){var _0x157a4c=typeof _0x1f0c3f[_0x2d9f('0x1c')]===_0x2d9f('0x1d')&&typeof _0x1f0c3f[_0x2d9f('0x1e')]===_0x2d9f('0x1d');var _0x1116f3=_0x5b43d0[_0x2d9f('0x1f')];var _0x24ba66=_0x157a4c?0x0:_0x1f0c3f[_0x2d9f('0x1c')];var _0x5079bb=_0x157a4c?_0x5b43d0[_0x2d9f('0x1f')]:_0x1f0c3f[_0x2d9f('0x1c')]+_0x1f0c3f[_0x2d9f('0x1e')];var _0xcc4c14;if(_0x5079bb>=_0x1116f3){_0x5079bb=_0x1116f3;_0xcc4c14=0xc8;}else{_0xcc4c14=0xce;}_0x12390a[_0x2d9f('0x19')](_0xcc4c14);return _0x12390a[_0x2d9f('0x20')](_0x2d9f('0x21'),_0x24ba66+'-'+_0x5079bb+'/'+_0x1116f3)[_0x2d9f('0x1b')](_0x5b43d0);}return null;};}function patchUpdates(_0x47e05f){return function(_0x4b3b4b){try{jsonpatch[_0x2d9f('0x22')](_0x4b3b4b,_0x47e05f,!![]);}catch(_0x25c94a){return BPromise[_0x2d9f('0x23')](_0x25c94a);}return _0x4b3b4b[_0x2d9f('0x24')]();};}function saveUpdates(_0x15b5f1,_0x4deba8){return function(_0x2b8157){if(_0x2b8157){return _0x2b8157['update'](_0x15b5f1)[_0x2d9f('0x25')](function(_0x58e4ac){return _0x58e4ac;});}return null;};}function removeEntity(_0x124169,_0x3683b7){return function(_0x185938){if(_0x185938){return _0x185938[_0x2d9f('0x26')]()['then'](function(){_0x124169['status'](0xcc)[_0x2d9f('0x1a')]();});}};}function handleEntityNotFound(_0x4a3cc2,_0x4716b7){return function(_0x1ea639){if(!_0x1ea639){_0x4a3cc2[_0x2d9f('0x18')](0x194);}return _0x1ea639;};}function handleError(_0x38f8e0,_0x1d62b8){_0x1d62b8=_0x1d62b8||0x1f4;return function(_0x59c211){logger['error'](_0x59c211['stack']);if(_0x59c211['name']){delete _0x59c211['name'];}_0x38f8e0[_0x2d9f('0x19')](_0x1d62b8)[_0x2d9f('0x27')](_0x59c211);};}exports[_0x2d9f('0x28')]=function(_0x3bca58,_0x1ee8b8){var _0x54e1e1={},_0x15e698={},_0x50ac4b={'count':0x0,'rows':[]};var _0x2ae065=_[_0x2d9f('0x29')](db[_0x2d9f('0x2a')][_0x2d9f('0x2b')],function(_0x3cedba){return{'name':_0x3cedba['fieldName'],'type':_0x3cedba[_0x2d9f('0x2c')]['key']};});_0x15e698['model']=_[_0x2d9f('0x29')](_0x2ae065,_0x2d9f('0x2d'));_0x15e698[_0x2d9f('0x2e')]=_[_0x2d9f('0x2f')](_0x3bca58[_0x2d9f('0x2e')]);_0x15e698[_0x2d9f('0x30')]=_[_0x2d9f('0x31')](_0x15e698['model'],_0x15e698[_0x2d9f('0x2e')]);_0x54e1e1[_0x2d9f('0x32')]=_[_0x2d9f('0x31')](_0x15e698['model'],qs[_0x2d9f('0x33')](_0x3bca58[_0x2d9f('0x2e')][_0x2d9f('0x33')]));_0x54e1e1[_0x2d9f('0x32')]=_0x54e1e1[_0x2d9f('0x32')][_0x2d9f('0x34')]?_0x54e1e1[_0x2d9f('0x32')]:_0x15e698['model'];if(!_0x3bca58[_0x2d9f('0x2e')]['hasOwnProperty']('nolimit')){_0x54e1e1['limit']=qs[_0x2d9f('0x1e')](_0x3bca58['query'][_0x2d9f('0x1e')]);_0x54e1e1[_0x2d9f('0x1c')]=qs[_0x2d9f('0x1c')](_0x3bca58['query'][_0x2d9f('0x1c')]);}_0x54e1e1['order']=qs['sort'](_0x3bca58[_0x2d9f('0x2e')][_0x2d9f('0x35')]);_0x54e1e1['where']=qs['filters'](_[_0x2d9f('0x36')](_0x3bca58[_0x2d9f('0x2e')],_0x15e698[_0x2d9f('0x30')]),_0x2ae065);if(_0x3bca58['query']['filter']){_0x54e1e1['where']=_[_0x2d9f('0x37')](_0x54e1e1[_0x2d9f('0x38')],{'$or':_[_0x2d9f('0x29')](_0x2ae065,function(_0x53df43){if(_0x53df43['type']!=='VIRTUAL'){var _0x3afc93={};_0x3afc93[_0x53df43[_0x2d9f('0x2d')]]={'$like':'%'+_0x3bca58[_0x2d9f('0x2e')][_0x2d9f('0x39')]+'%'};return _0x3afc93;}})});}_0x54e1e1=_['merge']({},_0x54e1e1,_0x3bca58[_0x2d9f('0x3a')]);var _0x56da38={'where':_0x54e1e1[_0x2d9f('0x38')]};return db[_0x2d9f('0x2a')][_0x2d9f('0x1f')](_0x56da38)[_0x2d9f('0x25')](function(_0xb0271d){_0x50ac4b['count']=_0xb0271d;if(_0x3bca58[_0x2d9f('0x2e')][_0x2d9f('0x3b')]){_0x54e1e1['include']=[{'all':!![]}];}return db[_0x2d9f('0x2a')]['findAll'](_0x54e1e1);})[_0x2d9f('0x25')](function(_0x1915c6){_0x50ac4b[_0x2d9f('0x3c')]=_0x1915c6;return _0x50ac4b;})[_0x2d9f('0x25')](respondWithFilteredResult(_0x1ee8b8,_0x54e1e1))['catch'](handleError(_0x1ee8b8,null));};exports[_0x2d9f('0x3d')]=function(_0x9fe589,_0x4d1a60){var _0x9dffa3={'raw':!![],'where':{'id':_0x9fe589[_0x2d9f('0x3e')]['id']}},_0x460757={};_0x460757[_0x2d9f('0x3f')]=_[_0x2d9f('0x2f')](db[_0x2d9f('0x2a')][_0x2d9f('0x2b')]);_0x460757[_0x2d9f('0x2e')]=_[_0x2d9f('0x2f')](_0x9fe589[_0x2d9f('0x2e')]);_0x460757['filters']=_[_0x2d9f('0x31')](_0x460757['model'],_0x460757['query']);_0x9dffa3[_0x2d9f('0x32')]=_[_0x2d9f('0x31')](_0x460757[_0x2d9f('0x3f')],qs['fields'](_0x9fe589[_0x2d9f('0x2e')]['fields']));_0x9dffa3[_0x2d9f('0x32')]=_0x9dffa3['attributes']['length']?_0x9dffa3[_0x2d9f('0x32')]:_0x460757[_0x2d9f('0x3f')];if(_0x9fe589['query']['includeAll']){_0x9dffa3[_0x2d9f('0x40')]=[{'all':!![]}];}_0x9dffa3=_[_0x2d9f('0x37')]({},_0x9dffa3,_0x9fe589[_0x2d9f('0x3a')]);return db[_0x2d9f('0x2a')][_0x2d9f('0x41')](_0x9dffa3)[_0x2d9f('0x25')](handleEntityNotFound(_0x4d1a60,null))[_0x2d9f('0x25')](respondWithResult(_0x4d1a60,null))['catch'](handleError(_0x4d1a60,null));};exports[_0x2d9f('0x42')]=function(_0x358281,_0x5b871c){return db[_0x2d9f('0x2a')][_0x2d9f('0x42')](_0x358281[_0x2d9f('0x43')],{})['then'](respondWithResult(_0x5b871c,0xc9))[_0x2d9f('0x44')](handleError(_0x5b871c,null));};exports[_0x2d9f('0x45')]=function(_0x421f15,_0x5ef7bb){if(_0x421f15[_0x2d9f('0x43')]['id']){delete _0x421f15[_0x2d9f('0x43')]['id'];}return db['SquareReport'][_0x2d9f('0x41')]({'where':{'id':_0x421f15[_0x2d9f('0x3e')]['id']}})[_0x2d9f('0x25')](handleEntityNotFound(_0x5ef7bb,null))[_0x2d9f('0x25')](saveUpdates(_0x421f15[_0x2d9f('0x43')],null))[_0x2d9f('0x25')](respondWithResult(_0x5ef7bb,null))[_0x2d9f('0x44')](handleError(_0x5ef7bb,null));};exports[_0x2d9f('0x26')]=function(_0x34543f,_0x591468){return db['SquareReport'][_0x2d9f('0x41')]({'where':{'id':_0x34543f[_0x2d9f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x591468,null))[_0x2d9f('0x25')](removeEntity(_0x591468,null))[_0x2d9f('0x44')](handleError(_0x591468,null));};exports['describe']=function(_0x1dd0b1,_0x2a2b27){return db['SquareReport'][_0x2d9f('0x46')]()[_0x2d9f('0x25')](respondWithResult(_0x2a2b27,null))[_0x2d9f('0x44')](handleError(_0x2a2b27,null));}; \ No newline at end of file +var _0x1bcc=['body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','SquareReport','count','includeAll','include','findAll','rows','catch','show','params','options','find','create'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1bcc,0x9a));var _0xc1bc=function(_0x3b5226,_0x496a84){_0x3b5226=_0x3b5226-0x0;var _0x3a13d1=_0x1bcc[_0x3b5226];return _0x3a13d1;};'use strict';var emlformat=require(_0xc1bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1bc('0x1'));var jsonpatch=require(_0xc1bc('0x2'));var rp=require(_0xc1bc('0x3'));var moment=require(_0xc1bc('0x4'));var BPromise=require(_0xc1bc('0x5'));var Mustache=require(_0xc1bc('0x6'));var util=require(_0xc1bc('0x7'));var path=require('path');var sox=require(_0xc1bc('0x8'));var csv=require('to-csv');var ejs=require(_0xc1bc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1bc('0xa'));var squel=require('squel');var crypto=require(_0xc1bc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc1bc('0xc'));var toCsv=require(_0xc1bc('0xd'));var querystring=require(_0xc1bc('0xe'));var Papa=require(_0xc1bc('0xf'));var Redis=require(_0xc1bc('0x10'));var authService=require(_0xc1bc('0x11'));var qs=require(_0xc1bc('0x12'));var as=require(_0xc1bc('0x13'));var hardwareService=require(_0xc1bc('0x14'));var logger=require(_0xc1bc('0x15'))(_0xc1bc('0x16'));var utils=require(_0xc1bc('0x17'));var config=require(_0xc1bc('0x18'));var licenseUtil=require(_0xc1bc('0x19'));var db=require(_0xc1bc('0x1a'))['db'];function respondWithStatusCode(_0x8e0c7e,_0x57455e){_0x57455e=_0x57455e||0xcc;return function(_0x11a701){if(_0x11a701){return _0x8e0c7e[_0xc1bc('0x1b')](_0x57455e);}return _0x8e0c7e[_0xc1bc('0x1c')](_0x57455e)[_0xc1bc('0x1d')]();};}function respondWithResult(_0x199028,_0x169ca7){_0x169ca7=_0x169ca7||0xc8;return function(_0x58749d){if(_0x58749d){return _0x199028[_0xc1bc('0x1c')](_0x169ca7)['json'](_0x58749d);}};}function respondWithFilteredResult(_0xdac3fa,_0x3e8abe){return function(_0x5b3f9){if(_0x5b3f9){var _0xe95fdf=typeof _0x3e8abe[_0xc1bc('0x1e')]===_0xc1bc('0x1f')&&typeof _0x3e8abe[_0xc1bc('0x20')]===_0xc1bc('0x1f');var _0x1dcadd=_0x5b3f9['count'];var _0x465f6f=_0xe95fdf?0x0:_0x3e8abe[_0xc1bc('0x1e')];var _0x22d3e4=_0xe95fdf?_0x5b3f9['count']:_0x3e8abe[_0xc1bc('0x1e')]+_0x3e8abe[_0xc1bc('0x20')];var _0x2afb4c;if(_0x22d3e4>=_0x1dcadd){_0x22d3e4=_0x1dcadd;_0x2afb4c=0xc8;}else{_0x2afb4c=0xce;}_0xdac3fa[_0xc1bc('0x1c')](_0x2afb4c);return _0xdac3fa['set'](_0xc1bc('0x21'),_0x465f6f+'-'+_0x22d3e4+'/'+_0x1dcadd)['json'](_0x5b3f9);}return null;};}function patchUpdates(_0x203439){return function(_0x1988a9){try{jsonpatch[_0xc1bc('0x22')](_0x1988a9,_0x203439,!![]);}catch(_0x255ad8){return BPromise[_0xc1bc('0x23')](_0x255ad8);}return _0x1988a9[_0xc1bc('0x24')]();};}function saveUpdates(_0x508038,_0x33f181){return function(_0x1928b1){if(_0x1928b1){return _0x1928b1[_0xc1bc('0x25')](_0x508038)['then'](function(_0x525430){return _0x525430;});}return null;};}function removeEntity(_0x40b266,_0x976a9a){return function(_0x1f13fc){if(_0x1f13fc){return _0x1f13fc[_0xc1bc('0x26')]()[_0xc1bc('0x27')](function(){_0x40b266[_0xc1bc('0x1c')](0xcc)[_0xc1bc('0x1d')]();});}};}function handleEntityNotFound(_0x418a6d,_0x22887a){return function(_0x317268){if(!_0x317268){_0x418a6d[_0xc1bc('0x1b')](0x194);}return _0x317268;};}function handleError(_0x4df4d9,_0x3a21d4){_0x3a21d4=_0x3a21d4||0x1f4;return function(_0x119bc2){logger[_0xc1bc('0x28')](_0x119bc2['stack']);if(_0x119bc2[_0xc1bc('0x29')]){delete _0x119bc2[_0xc1bc('0x29')];}_0x4df4d9['status'](_0x3a21d4)['send'](_0x119bc2);};}exports[_0xc1bc('0x2a')]=function(_0x299b42,_0x562885){var _0x3adc90={},_0x1e6124={},_0x48d99b={'count':0x0,'rows':[]};var _0x3df581=_[_0xc1bc('0x2b')](db['SquareReport'][_0xc1bc('0x2c')],function(_0x4f473c){return{'name':_0x4f473c['fieldName'],'type':_0x4f473c['type'][_0xc1bc('0x2d')]};});_0x1e6124[_0xc1bc('0x2e')]=_[_0xc1bc('0x2b')](_0x3df581,'name');_0x1e6124[_0xc1bc('0x2f')]=_[_0xc1bc('0x30')](_0x299b42[_0xc1bc('0x2f')]);_0x1e6124[_0xc1bc('0x31')]=_[_0xc1bc('0x32')](_0x1e6124[_0xc1bc('0x2e')],_0x1e6124[_0xc1bc('0x2f')]);_0x3adc90[_0xc1bc('0x33')]=_[_0xc1bc('0x32')](_0x1e6124['model'],qs[_0xc1bc('0x34')](_0x299b42['query'][_0xc1bc('0x34')]));_0x3adc90[_0xc1bc('0x33')]=_0x3adc90[_0xc1bc('0x33')][_0xc1bc('0x35')]?_0x3adc90[_0xc1bc('0x33')]:_0x1e6124[_0xc1bc('0x2e')];if(!_0x299b42[_0xc1bc('0x2f')][_0xc1bc('0x36')]('nolimit')){_0x3adc90[_0xc1bc('0x20')]=qs['limit'](_0x299b42[_0xc1bc('0x2f')][_0xc1bc('0x20')]);_0x3adc90[_0xc1bc('0x1e')]=qs[_0xc1bc('0x1e')](_0x299b42[_0xc1bc('0x2f')]['offset']);}_0x3adc90[_0xc1bc('0x37')]=qs[_0xc1bc('0x38')](_0x299b42[_0xc1bc('0x2f')][_0xc1bc('0x38')]);_0x3adc90[_0xc1bc('0x39')]=qs[_0xc1bc('0x31')](_[_0xc1bc('0x3a')](_0x299b42[_0xc1bc('0x2f')],_0x1e6124[_0xc1bc('0x31')]),_0x3df581);if(_0x299b42['query'][_0xc1bc('0x3b')]){_0x3adc90[_0xc1bc('0x39')]=_[_0xc1bc('0x3c')](_0x3adc90[_0xc1bc('0x39')],{'$or':_['map'](_0x3df581,function(_0x5df058){if(_0x5df058[_0xc1bc('0x3d')]!=='VIRTUAL'){var _0x15575a={};_0x15575a[_0x5df058[_0xc1bc('0x29')]]={'$like':'%'+_0x299b42['query'][_0xc1bc('0x3b')]+'%'};return _0x15575a;}})});}_0x3adc90=_['merge']({},_0x3adc90,_0x299b42['options']);var _0x49fcbd={'where':_0x3adc90[_0xc1bc('0x39')]};return db[_0xc1bc('0x3e')][_0xc1bc('0x3f')](_0x49fcbd)[_0xc1bc('0x27')](function(_0x363b1f){_0x48d99b[_0xc1bc('0x3f')]=_0x363b1f;if(_0x299b42[_0xc1bc('0x2f')][_0xc1bc('0x40')]){_0x3adc90[_0xc1bc('0x41')]=[{'all':!![]}];}return db[_0xc1bc('0x3e')][_0xc1bc('0x42')](_0x3adc90);})[_0xc1bc('0x27')](function(_0x4b46ae){_0x48d99b[_0xc1bc('0x43')]=_0x4b46ae;return _0x48d99b;})[_0xc1bc('0x27')](respondWithFilteredResult(_0x562885,_0x3adc90))[_0xc1bc('0x44')](handleError(_0x562885,null));};exports[_0xc1bc('0x45')]=function(_0x351a8f,_0x3b31e4){var _0x3b9fb9={'raw':!![],'where':{'id':_0x351a8f[_0xc1bc('0x46')]['id']}},_0x4a462a={};_0x4a462a[_0xc1bc('0x2e')]=_[_0xc1bc('0x30')](db['SquareReport']['rawAttributes']);_0x4a462a['query']=_[_0xc1bc('0x30')](_0x351a8f[_0xc1bc('0x2f')]);_0x4a462a[_0xc1bc('0x31')]=_['intersection'](_0x4a462a[_0xc1bc('0x2e')],_0x4a462a[_0xc1bc('0x2f')]);_0x3b9fb9[_0xc1bc('0x33')]=_[_0xc1bc('0x32')](_0x4a462a['model'],qs[_0xc1bc('0x34')](_0x351a8f['query'][_0xc1bc('0x34')]));_0x3b9fb9[_0xc1bc('0x33')]=_0x3b9fb9['attributes'][_0xc1bc('0x35')]?_0x3b9fb9['attributes']:_0x4a462a[_0xc1bc('0x2e')];if(_0x351a8f[_0xc1bc('0x2f')][_0xc1bc('0x40')]){_0x3b9fb9[_0xc1bc('0x41')]=[{'all':!![]}];}_0x3b9fb9=_[_0xc1bc('0x3c')]({},_0x3b9fb9,_0x351a8f[_0xc1bc('0x47')]);return db['SquareReport'][_0xc1bc('0x48')](_0x3b9fb9)['then'](handleEntityNotFound(_0x3b31e4,null))[_0xc1bc('0x27')](respondWithResult(_0x3b31e4,null))[_0xc1bc('0x44')](handleError(_0x3b31e4,null));};exports[_0xc1bc('0x49')]=function(_0x5d8669,_0x32e80c){return db['SquareReport'][_0xc1bc('0x49')](_0x5d8669[_0xc1bc('0x4a')],{})[_0xc1bc('0x27')](respondWithResult(_0x32e80c,0xc9))[_0xc1bc('0x44')](handleError(_0x32e80c,null));};exports[_0xc1bc('0x25')]=function(_0x34cb0e,_0x4eed0d){if(_0x34cb0e[_0xc1bc('0x4a')]['id']){delete _0x34cb0e[_0xc1bc('0x4a')]['id'];}return db[_0xc1bc('0x3e')][_0xc1bc('0x48')]({'where':{'id':_0x34cb0e['params']['id']}})[_0xc1bc('0x27')](handleEntityNotFound(_0x4eed0d,null))[_0xc1bc('0x27')](saveUpdates(_0x34cb0e[_0xc1bc('0x4a')],null))['then'](respondWithResult(_0x4eed0d,null))[_0xc1bc('0x44')](handleError(_0x4eed0d,null));};exports[_0xc1bc('0x26')]=function(_0x3d74c6,_0x4b6269){return db[_0xc1bc('0x3e')][_0xc1bc('0x48')]({'where':{'id':_0x3d74c6[_0xc1bc('0x46')]['id']}})[_0xc1bc('0x27')](handleEntityNotFound(_0x4b6269,null))['then'](removeEntity(_0x4b6269,null))[_0xc1bc('0x44')](handleError(_0x4b6269,null));};exports[_0xc1bc('0x4b')]=function(_0xb337ee,_0x325122){return db[_0xc1bc('0x3e')]['describe']()[_0xc1bc('0x27')](respondWithResult(_0x325122,null))[_0xc1bc('0x44')](handleError(_0x325122,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 8b71c6f..e23e8f0 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 _0x45ab=['report_square','uniqueid','leaveAt','lodash','api','moment','request-promise','../../config/environment','./squareReport.attributes','exports','define','SquareReport'];(function(_0x5e6c41,_0x11e182){var _0x254e22=function(_0x387977){while(--_0x387977){_0x5e6c41['push'](_0x5e6c41['shift']());}};_0x254e22(++_0x11e182);}(_0x45ab,0x87));var _0xb45a=function(_0x22eb5d,_0x2e519d){_0x22eb5d=_0x22eb5d-0x0;var _0x4a39ad=_0x45ab[_0x22eb5d];return _0x4a39ad;};'use strict';var _=require(_0xb45a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb45a('0x1'));var moment=require(_0xb45a('0x2'));var BPromise=require('bluebird');var rp=require(_0xb45a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb45a('0x4'));var attributes=require(_0xb45a('0x5'));module[_0xb45a('0x6')]=function(_0x30b7df,_0x5dbee8){return _0x30b7df[_0xb45a('0x7')](_0xb45a('0x8'),attributes,{'tableName':_0xb45a('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xb45a('0xa'),'project_name']},{'name':_0xb45a('0xb'),'fields':[_0xb45a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8480=['bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','project_name','leaveAt','util','../../config/logger','api','moment'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x8480,0x1a0));var _0x0848=function(_0x4a950b,_0x3c4229){_0x4a950b=_0x4a950b-0x0;var _0x2fbf33=_0x8480[_0x4a950b];return _0x2fbf33;};'use strict';var _=require('lodash');var util=require(_0x0848('0x0'));var logger=require(_0x0848('0x1'))(_0x0848('0x2'));var moment=require(_0x0848('0x3'));var BPromise=require(_0x0848('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0848('0x5'));var rimraf=require(_0x0848('0x6'));var config=require(_0x0848('0x7'));var attributes=require(_0x0848('0x8'));module[_0x0848('0x9')]=function(_0x1899fd,_0x2c2695){return _0x1899fd['define'](_0x0848('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x0848('0xb'),'fields':['uniqueid',_0x0848('0xc')]},{'name':_0x0848('0xd'),'fields':[_0x0848('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 65ac8d8..4e67676 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 _0x6d4b=['code','message','info','result','catch','create','body','options','raw','then','CreateSquareReport','UpdateSquareReport','update','where','limit','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6d4b,0xc3));var _0xb6d4=function(_0x943def,_0x285043){_0x943def=_0x943def-0x0;var _0x83e7de=_0x6d4b[_0x943def];return _0x83e7de;};'use strict';var _=require('lodash');var util=require(_0xb6d4('0x0'));var moment=require('moment');var BPromise=require(_0xb6d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6d4('0x2'));var db=require(_0xb6d4('0x3'))['db'];var utils=require(_0xb6d4('0x4'));var logger=require(_0xb6d4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb6d4('0x6'));var client=jayson['client'][_0xb6d4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x188089,_0x5a13db,_0x41bfa7){return new BPromise(function(_0x5c4e77,_0x130e34){return client[_0xb6d4('0x8')](_0x188089,_0x41bfa7)['then'](function(_0xc9de8){logger['info'](_0xb6d4('0x9'),_0x5a13db,_0xb6d4('0xa'));logger[_0xb6d4('0xb')](_0xb6d4('0xc'),_0x5a13db,'request\x20sent',JSON[_0xb6d4('0xd')](_0xc9de8));if(_0xc9de8[_0xb6d4('0xe')]){if(_0xc9de8[_0xb6d4('0xe')][_0xb6d4('0xf')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x5a13db,_0xc9de8['error'][_0xb6d4('0x10')]);return _0x130e34(_0xc9de8[_0xb6d4('0xe')][_0xb6d4('0x10')]);}logger['error'](_0xb6d4('0x9'),_0x5a13db,_0xc9de8[_0xb6d4('0xe')][_0xb6d4('0x10')]);return _0x5c4e77(_0xc9de8[_0xb6d4('0xe')][_0xb6d4('0x10')]);}else{logger[_0xb6d4('0x11')](_0xb6d4('0x9'),_0x5a13db,_0xb6d4('0xa'));_0x5c4e77(_0xc9de8[_0xb6d4('0x12')]['message']);}})[_0xb6d4('0x13')](function(_0x43a705){logger[_0xb6d4('0xe')](_0xb6d4('0x9'),_0x5a13db,_0x43a705);_0x130e34(_0x43a705);});});}exports['CreateSquareReport']=function(_0x4db8c2){var _0x14ec0f=this;return new Promise(function(_0x53b188,_0x4f33fe){return db['SquareReport'][_0xb6d4('0x14')](_0x4db8c2[_0xb6d4('0x15')],{'raw':_0x4db8c2[_0xb6d4('0x16')]?_0x4db8c2[_0xb6d4('0x16')][_0xb6d4('0x17')]===undefined?!![]:![]:!![]})[_0xb6d4('0x18')](function(_0x4b8155){logger[_0xb6d4('0x11')]('CreateSquareReport',_0x4db8c2);logger['debug'](_0xb6d4('0x19'),_0x4db8c2,JSON[_0xb6d4('0xd')](_0x4b8155));_0x53b188(_0x4b8155);})['catch'](function(_0xa00e95){logger[_0xb6d4('0xe')](_0xb6d4('0x19'),_0xa00e95[_0xb6d4('0x10')],_0x4db8c2);_0x4f33fe(_0x14ec0f[_0xb6d4('0xe')](0x1f4,_0xa00e95[_0xb6d4('0x10')]));});});};exports[_0xb6d4('0x1a')]=function(_0x881d02){var _0x48a025=this;return new Promise(function(_0x56d802,_0x2d035d){return db['SquareReport'][_0xb6d4('0x1b')](_0x881d02['body'],{'raw':_0x881d02[_0xb6d4('0x16')]?_0x881d02[_0xb6d4('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x881d02['options']?_0x881d02[_0xb6d4('0x16')][_0xb6d4('0x1c')]||null:null,'attributes':_0x881d02[_0xb6d4('0x16')]?_0x881d02['options']['attributes']||null:null,'limit':_0x881d02[_0xb6d4('0x16')]?_0x881d02['options'][_0xb6d4('0x1d')]||null:null})[_0xb6d4('0x18')](function(_0x3d80fd){logger['info'](_0xb6d4('0x1a'),_0x881d02);logger['debug'](_0xb6d4('0x1a'),_0x881d02,JSON[_0xb6d4('0xd')](_0x3d80fd));_0x56d802(_0x3d80fd);})[_0xb6d4('0x13')](function(_0x2beccc){logger[_0xb6d4('0xe')](_0xb6d4('0x1a'),_0x2beccc['message'],_0x881d02);_0x2d035d(_0x48a025[_0xb6d4('0xe')](0x1f4,_0x2beccc[_0xb6d4('0x10')]));});});}; \ No newline at end of file +var _0x5465=['raw','debug','UpdateSquareReport','update','body','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','SquareReport','options'];(function(_0x1ad279,_0x42d157){var _0x272861=function(_0x3cb41f){while(--_0x3cb41f){_0x1ad279['push'](_0x1ad279['shift']());}};_0x272861(++_0x42d157);}(_0x5465,0xc6));var _0x5546=function(_0x4b21ee,_0x1778d5){_0x4b21ee=_0x4b21ee-0x0;var _0x7009dc=_0x5465[_0x4b21ee];return _0x7009dc;};'use strict';var _=require(_0x5546('0x0'));var util=require(_0x5546('0x1'));var moment=require(_0x5546('0x2'));var BPromise=require(_0x5546('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5546('0x4'));var db=require(_0x5546('0x5'))['db'];var utils=require(_0x5546('0x6'));var logger=require(_0x5546('0x7'))(_0x5546('0x8'));var config=require(_0x5546('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5546('0xa')][_0x5546('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f99b8,_0x221a3d,_0x3eb8bc){return new BPromise(function(_0x3dac15,_0x83f1a0){return client[_0x5546('0xc')](_0x2f99b8,_0x3eb8bc)[_0x5546('0xd')](function(_0x14c98b){logger[_0x5546('0xe')](_0x5546('0xf'),_0x221a3d,_0x5546('0x10'));logger['debug'](_0x5546('0x11'),_0x221a3d,_0x5546('0x10'),JSON[_0x5546('0x12')](_0x14c98b));if(_0x14c98b[_0x5546('0x13')]){if(_0x14c98b[_0x5546('0x13')]['code']===0x1f4){logger['error'](_0x5546('0xf'),_0x221a3d,_0x14c98b[_0x5546('0x13')][_0x5546('0x14')]);return _0x83f1a0(_0x14c98b[_0x5546('0x13')][_0x5546('0x14')]);}logger[_0x5546('0x13')](_0x5546('0xf'),_0x221a3d,_0x14c98b[_0x5546('0x13')][_0x5546('0x14')]);return _0x3dac15(_0x14c98b['error']['message']);}else{logger[_0x5546('0xe')]('SquareReport,\x20%s,\x20%s',_0x221a3d,'request\x20sent');_0x3dac15(_0x14c98b[_0x5546('0x15')][_0x5546('0x14')]);}})[_0x5546('0x16')](function(_0x31c9ca){logger[_0x5546('0x13')](_0x5546('0xf'),_0x221a3d,_0x31c9ca);_0x83f1a0(_0x31c9ca);});});}exports[_0x5546('0x17')]=function(_0x288b15){var _0xb23f88=this;return new Promise(function(_0x54e04c,_0xca4961){return db[_0x5546('0x18')]['create'](_0x288b15['body'],{'raw':_0x288b15[_0x5546('0x19')]?_0x288b15[_0x5546('0x19')][_0x5546('0x1a')]===undefined?!![]:![]:!![]})[_0x5546('0xd')](function(_0x18c799){logger[_0x5546('0xe')](_0x5546('0x17'),_0x288b15);logger[_0x5546('0x1b')](_0x5546('0x17'),_0x288b15,JSON[_0x5546('0x12')](_0x18c799));_0x54e04c(_0x18c799);})['catch'](function(_0x283c02){logger[_0x5546('0x13')](_0x5546('0x17'),_0x283c02['message'],_0x288b15);_0xca4961(_0xb23f88[_0x5546('0x13')](0x1f4,_0x283c02[_0x5546('0x14')]));});});};exports[_0x5546('0x1c')]=function(_0x150a03){var _0xc41708=this;return new Promise(function(_0x4cad13,_0x8c7003){return db[_0x5546('0x18')][_0x5546('0x1d')](_0x150a03[_0x5546('0x1e')],{'raw':_0x150a03[_0x5546('0x19')]?_0x150a03[_0x5546('0x19')][_0x5546('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x150a03['options']?_0x150a03[_0x5546('0x19')]['where']||null:null,'attributes':_0x150a03[_0x5546('0x19')]?_0x150a03[_0x5546('0x19')][_0x5546('0x1f')]||null:null,'limit':_0x150a03[_0x5546('0x19')]?_0x150a03[_0x5546('0x19')]['limit']||null:null})[_0x5546('0xd')](function(_0x5681c8){logger[_0x5546('0xe')]('UpdateSquareReport',_0x150a03);logger[_0x5546('0x1b')]('UpdateSquareReport',_0x150a03,JSON[_0x5546('0x12')](_0x5681c8));_0x4cad13(_0x5681c8);})['catch'](function(_0xfeb5cd){logger[_0x5546('0x13')](_0x5546('0x1c'),_0xfeb5cd[_0x5546('0x14')],_0x150a03);_0x8c7003(_0xc41708[_0x5546('0x13')](0x1f4,_0xfeb5cd[_0x5546('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c40527a..09e8c48 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 _0x200e=['/describe','describe','create','put','update','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index'];(function(_0x4199a9,_0xf0a5c8){var _0x4aef66=function(_0x49ed67){while(--_0x49ed67){_0x4199a9['push'](_0x4199a9['shift']());}};_0x4aef66(++_0xf0a5c8);}(_0x200e,0x15e));var _0xe200=function(_0x3303d7,_0x32b4f5){_0x3303d7=_0x3303d7-0x0;var _0x52bf89=_0x200e[_0x3303d7];return _0x52bf89;};'use strict';var multer=require('multer');var util=require(_0xe200('0x0'));var path=require('path');var timeout=require(_0xe200('0x1'));var express=require(_0xe200('0x2'));var router=express[_0xe200('0x3')]();var fs_extra=require(_0xe200('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe200('0x5'));var config=require('../../config/environment');var controller=require(_0xe200('0x6'));router[_0xe200('0x7')]('/',auth[_0xe200('0x8')](),controller[_0xe200('0x9')]);router[_0xe200('0x7')](_0xe200('0xa'),auth[_0xe200('0x8')](),controller[_0xe200('0xb')]);router[_0xe200('0x7')]('/:id',auth[_0xe200('0x8')](),controller['show']);router['post']('/',auth[_0xe200('0x8')](),controller[_0xe200('0xc')]);router[_0xe200('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe200('0xe')]);router['delete'](_0xe200('0xf'),auth['isAuthenticated'](),controller[_0xe200('0x10')]);module[_0xe200('0x11')]=router; \ No newline at end of file +var _0x6f98=['post','create','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','./squareReportDetail.controller','get','/describe','isAuthenticated'];(function(_0x461119,_0x28ce98){var _0x4b5ed3=function(_0x4fdafc){while(--_0x4fdafc){_0x461119['push'](_0x461119['shift']());}};_0x4b5ed3(++_0x28ce98);}(_0x6f98,0x97));var _0x86f9=function(_0x42c6ea,_0x21e7d5){_0x42c6ea=_0x42c6ea-0x0;var _0x2c3f69=_0x6f98[_0x42c6ea];return _0x2c3f69;};'use strict';var multer=require(_0x86f9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x86f9('0x1'));var express=require(_0x86f9('0x2'));var router=express[_0x86f9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x86f9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x86f9('0x5'));router[_0x86f9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x86f9('0x6')](_0x86f9('0x7'),auth[_0x86f9('0x8')](),controller['describe']);router[_0x86f9('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x86f9('0x9')]('/',auth[_0x86f9('0x8')](),controller[_0x86f9('0xa')]);router[_0x86f9('0xb')](_0x86f9('0xc'),auth[_0x86f9('0x8')](),controller['update']);router[_0x86f9('0xd')]('/:id',auth[_0x86f9('0x8')](),controller[_0x86f9('0xe')]);module[_0x86f9('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 9ffadbd..dc2140d 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 _0xdcc5=['STRING','TEXT','exports'];(function(_0x4a8600,_0x1e723e){var _0x4458b6=function(_0x4b4b37){while(--_0x4b4b37){_0x4a8600['push'](_0x4a8600['shift']());}};_0x4458b6(++_0x1e723e);}(_0xdcc5,0x146));var _0x5dcc=function(_0x2f0731,_0x5f4ebb){_0x2f0731=_0x2f0731-0x0;var _0x449d79=_0xdcc5[_0x2f0731];return _0x449d79;};'use strict';var Sequelize=require('sequelize');module[_0x5dcc('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x5dcc('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5dcc('0x2')]},'project_name':{'type':Sequelize[_0x5dcc('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ffa=['sequelize','exports','STRING','TEXT'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x0ffa,0x1c8));var _0xa0ff=function(_0x5067db,_0xf8d2f2){_0x5067db=_0x5067db-0x0;var _0x2771e4=_0x0ffa[_0x5067db];return _0x2771e4;};'use strict';var Sequelize=require(_0xa0ff('0x0'));module[_0xa0ff('0x1')]={'uniqueid':{'type':Sequelize[_0xa0ff('0x2')]},'node':{'type':Sequelize[_0xa0ff('0x2')]},'application':{'type':Sequelize[_0xa0ff('0x2')]},'data':{'type':Sequelize[_0xa0ff('0x3')]},'project_name':{'type':Sequelize[_0xa0ff('0x2')]},'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 8dd1906..8065346 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 _0x00b8=['filter','options','SquareDetailsReport','includeAll','include','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL'];(function(_0x90b342,_0x13a7d3){var _0x37845e=function(_0x4552d6){while(--_0x4552d6){_0x90b342['push'](_0x90b342['shift']());}};_0x37845e(++_0x13a7d3);}(_0x00b8,0x1e0));var _0x800b=function(_0x27a7eb,_0x340bae){_0x27a7eb=_0x27a7eb-0x0;var _0x158a4a=_0x00b8[_0x27a7eb];return _0x158a4a;};'use strict';var emlformat=require(_0x800b('0x0'));var rimraf=require(_0x800b('0x1'));var zipdir=require(_0x800b('0x2'));var jsonpatch=require(_0x800b('0x3'));var rp=require(_0x800b('0x4'));var moment=require(_0x800b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x800b('0x6'));var util=require('util');var path=require(_0x800b('0x7'));var sox=require(_0x800b('0x8'));var csv=require(_0x800b('0x9'));var ejs=require(_0x800b('0xa'));var fs=require('fs');var fs_extra=require(_0x800b('0xb'));var _=require(_0x800b('0xc'));var squel=require(_0x800b('0xd'));var crypto=require(_0x800b('0xe'));var jsforce=require(_0x800b('0xf'));var deskjs=require(_0x800b('0x10'));var toCsv=require(_0x800b('0x9'));var querystring=require(_0x800b('0x11'));var Papa=require(_0x800b('0x12'));var Redis=require('ioredis');var authService=require(_0x800b('0x13'));var qs=require(_0x800b('0x14'));var as=require(_0x800b('0x15'));var hardwareService=require(_0x800b('0x16'));var logger=require('../../config/logger')(_0x800b('0x17'));var utils=require(_0x800b('0x18'));var config=require(_0x800b('0x19'));var licenseUtil=require(_0x800b('0x1a'));var db=require(_0x800b('0x1b'))['db'];function respondWithStatusCode(_0x471316,_0x363ec0){_0x363ec0=_0x363ec0||0xcc;return function(_0x1512e8){if(_0x1512e8){return _0x471316[_0x800b('0x1c')](_0x363ec0);}return _0x471316[_0x800b('0x1d')](_0x363ec0)[_0x800b('0x1e')]();};}function respondWithResult(_0x2cb5cb,_0x3aed4c){_0x3aed4c=_0x3aed4c||0xc8;return function(_0x1c4546){if(_0x1c4546){return _0x2cb5cb[_0x800b('0x1d')](_0x3aed4c)['json'](_0x1c4546);}};}function respondWithFilteredResult(_0xf6fd83,_0x19b7e9){return function(_0x564d27){if(_0x564d27){var _0x43249b=typeof _0x19b7e9[_0x800b('0x1f')]===_0x800b('0x20')&&typeof _0x19b7e9[_0x800b('0x21')]===_0x800b('0x20');var _0x311784=_0x564d27[_0x800b('0x22')];var _0x50e857=_0x43249b?0x0:_0x19b7e9[_0x800b('0x1f')];var _0x117680=_0x43249b?_0x564d27['count']:_0x19b7e9[_0x800b('0x1f')]+_0x19b7e9[_0x800b('0x21')];var _0x2637f3;if(_0x117680>=_0x311784){_0x117680=_0x311784;_0x2637f3=0xc8;}else{_0x2637f3=0xce;}_0xf6fd83[_0x800b('0x1d')](_0x2637f3);return _0xf6fd83['set'](_0x800b('0x23'),_0x50e857+'-'+_0x117680+'/'+_0x311784)[_0x800b('0x24')](_0x564d27);}return null;};}function patchUpdates(_0x4e8d92){return function(_0xc96ff6){try{jsonpatch['apply'](_0xc96ff6,_0x4e8d92,!![]);}catch(_0x5e476e){return BPromise['reject'](_0x5e476e);}return _0xc96ff6[_0x800b('0x25')]();};}function saveUpdates(_0x24a2a8,_0x2d645b){return function(_0x4611e5){if(_0x4611e5){return _0x4611e5[_0x800b('0x26')](_0x24a2a8)[_0x800b('0x27')](function(_0x174de7){return _0x174de7;});}return null;};}function removeEntity(_0x2ae20a,_0x338d64){return function(_0xcde909){if(_0xcde909){return _0xcde909[_0x800b('0x28')]()[_0x800b('0x27')](function(){_0x2ae20a['status'](0xcc)[_0x800b('0x1e')]();});}};}function handleEntityNotFound(_0x52d4cd,_0x1aa519){return function(_0x59ea97){if(!_0x59ea97){_0x52d4cd[_0x800b('0x1c')](0x194);}return _0x59ea97;};}function handleError(_0x3f5411,_0x1d118b){_0x1d118b=_0x1d118b||0x1f4;return function(_0x5ad03a){logger[_0x800b('0x29')](_0x5ad03a[_0x800b('0x2a')]);if(_0x5ad03a[_0x800b('0x2b')]){delete _0x5ad03a[_0x800b('0x2b')];}_0x3f5411[_0x800b('0x1d')](_0x1d118b)[_0x800b('0x2c')](_0x5ad03a);};}exports[_0x800b('0x2d')]=function(_0x57b7f2,_0x4ad806){var _0x5dcd20={},_0x535131={},_0x65bef9={'count':0x0,'rows':[]};var _0x23c5f3=_['map'](db['SquareDetailsReport'][_0x800b('0x2e')],function(_0x17f791){return{'name':_0x17f791[_0x800b('0x2f')],'type':_0x17f791[_0x800b('0x30')][_0x800b('0x31')]};});_0x535131[_0x800b('0x32')]=_[_0x800b('0x33')](_0x23c5f3,'name');_0x535131[_0x800b('0x34')]=_[_0x800b('0x35')](_0x57b7f2['query']);_0x535131[_0x800b('0x36')]=_['intersection'](_0x535131['model'],_0x535131[_0x800b('0x34')]);_0x5dcd20[_0x800b('0x37')]=_[_0x800b('0x38')](_0x535131[_0x800b('0x32')],qs[_0x800b('0x39')](_0x57b7f2['query'][_0x800b('0x39')]));_0x5dcd20[_0x800b('0x37')]=_0x5dcd20[_0x800b('0x37')][_0x800b('0x3a')]?_0x5dcd20[_0x800b('0x37')]:_0x535131[_0x800b('0x32')];if(!_0x57b7f2[_0x800b('0x34')][_0x800b('0x3b')](_0x800b('0x3c'))){_0x5dcd20[_0x800b('0x21')]=qs['limit'](_0x57b7f2['query']['limit']);_0x5dcd20[_0x800b('0x1f')]=qs[_0x800b('0x1f')](_0x57b7f2[_0x800b('0x34')][_0x800b('0x1f')]);}_0x5dcd20['order']=qs[_0x800b('0x3d')](_0x57b7f2['query'][_0x800b('0x3d')]);_0x5dcd20[_0x800b('0x3e')]=qs[_0x800b('0x36')](_[_0x800b('0x3f')](_0x57b7f2['query'],_0x535131[_0x800b('0x36')]),_0x23c5f3);if(_0x57b7f2[_0x800b('0x34')]['filter']){_0x5dcd20[_0x800b('0x3e')]=_[_0x800b('0x40')](_0x5dcd20['where'],{'$or':_[_0x800b('0x33')](_0x23c5f3,function(_0x1195e4){if(_0x1195e4[_0x800b('0x30')]!==_0x800b('0x41')){var _0x24054c={};_0x24054c[_0x1195e4['name']]={'$like':'%'+_0x57b7f2[_0x800b('0x34')][_0x800b('0x42')]+'%'};return _0x24054c;}})});}_0x5dcd20=_[_0x800b('0x40')]({},_0x5dcd20,_0x57b7f2[_0x800b('0x43')]);var _0x4b8134={'where':_0x5dcd20[_0x800b('0x3e')]};return db[_0x800b('0x44')][_0x800b('0x22')](_0x4b8134)['then'](function(_0x35cf61){_0x65bef9[_0x800b('0x22')]=_0x35cf61;if(_0x57b7f2[_0x800b('0x34')][_0x800b('0x45')]){_0x5dcd20[_0x800b('0x46')]=[{'all':!![]}];}return db[_0x800b('0x44')]['findAll'](_0x5dcd20);})[_0x800b('0x27')](function(_0x4fc847){_0x65bef9['rows']=_0x4fc847;return _0x65bef9;})[_0x800b('0x27')](respondWithFilteredResult(_0x4ad806,_0x5dcd20))[_0x800b('0x47')](handleError(_0x4ad806,null));};exports[_0x800b('0x48')]=function(_0x44653b,_0x1fb288){var _0x174712={'raw':!![],'where':{'id':_0x44653b['params']['id']}},_0x38a2a8={};_0x38a2a8[_0x800b('0x32')]=_[_0x800b('0x35')](db[_0x800b('0x44')][_0x800b('0x2e')]);_0x38a2a8[_0x800b('0x34')]=_[_0x800b('0x35')](_0x44653b[_0x800b('0x34')]);_0x38a2a8[_0x800b('0x36')]=_[_0x800b('0x38')](_0x38a2a8[_0x800b('0x32')],_0x38a2a8[_0x800b('0x34')]);_0x174712[_0x800b('0x37')]=_['intersection'](_0x38a2a8[_0x800b('0x32')],qs[_0x800b('0x39')](_0x44653b[_0x800b('0x34')]['fields']));_0x174712['attributes']=_0x174712[_0x800b('0x37')][_0x800b('0x3a')]?_0x174712['attributes']:_0x38a2a8[_0x800b('0x32')];if(_0x44653b[_0x800b('0x34')]['includeAll']){_0x174712[_0x800b('0x46')]=[{'all':!![]}];}_0x174712=_[_0x800b('0x40')]({},_0x174712,_0x44653b['options']);return db['SquareDetailsReport'][_0x800b('0x49')](_0x174712)['then'](handleEntityNotFound(_0x1fb288,null))['then'](respondWithResult(_0x1fb288,null))[_0x800b('0x47')](handleError(_0x1fb288,null));};exports[_0x800b('0x4a')]=function(_0xa017c6,_0x13767c){return db['SquareDetailsReport']['create'](_0xa017c6[_0x800b('0x4b')],{})[_0x800b('0x27')](respondWithResult(_0x13767c,0xc9))[_0x800b('0x47')](handleError(_0x13767c,null));};exports[_0x800b('0x26')]=function(_0xc853de,_0x8b0d78){if(_0xc853de[_0x800b('0x4b')]['id']){delete _0xc853de[_0x800b('0x4b')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0xc853de['params']['id']}})['then'](handleEntityNotFound(_0x8b0d78,null))['then'](saveUpdates(_0xc853de[_0x800b('0x4b')],null))[_0x800b('0x27')](respondWithResult(_0x8b0d78,null))[_0x800b('0x47')](handleError(_0x8b0d78,null));};exports[_0x800b('0x28')]=function(_0x3c83ec,_0x10fcf4){return db[_0x800b('0x44')][_0x800b('0x49')]({'where':{'id':_0x3c83ec[_0x800b('0x4c')]['id']}})[_0x800b('0x27')](handleEntityNotFound(_0x10fcf4,null))['then'](removeEntity(_0x10fcf4,null))[_0x800b('0x47')](handleError(_0x10fcf4,null));};exports[_0x800b('0x4d')]=function(_0x11e67d,_0x492810){return db[_0x800b('0x44')][_0x800b('0x4d')]()[_0x800b('0x27')](respondWithResult(_0x492810,null))[_0x800b('0x47')](handleError(_0x492810,null));}; \ No newline at end of file +var _0x7eb9=['describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','intersection','length','create','body','find','destroy'];(function(_0x244b1b,_0x5b311f){var _0x3d8056=function(_0x5b670b){while(--_0x5b670b){_0x244b1b['push'](_0x244b1b['shift']());}};_0x3d8056(++_0x5b311f);}(_0x7eb9,0xd9));var _0x97eb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7eb9[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x97eb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97eb('0x1'));var rp=require('request-promise');var moment=require(_0x97eb('0x2'));var BPromise=require(_0x97eb('0x3'));var Mustache=require(_0x97eb('0x4'));var util=require(_0x97eb('0x5'));var path=require('path');var sox=require(_0x97eb('0x6'));var csv=require('to-csv');var ejs=require(_0x97eb('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97eb('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97eb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x97eb('0xa'));var querystring=require(_0x97eb('0xb'));var Papa=require(_0x97eb('0xc'));var Redis=require(_0x97eb('0xd'));var authService=require(_0x97eb('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97eb('0xf'));var logger=require(_0x97eb('0x10'))(_0x97eb('0x11'));var utils=require(_0x97eb('0x12'));var config=require(_0x97eb('0x13'));var licenseUtil=require(_0x97eb('0x14'));var db=require(_0x97eb('0x15'))['db'];function respondWithStatusCode(_0x3ec39d,_0x1205d4){_0x1205d4=_0x1205d4||0xcc;return function(_0x37e165){if(_0x37e165){return _0x3ec39d[_0x97eb('0x16')](_0x1205d4);}return _0x3ec39d[_0x97eb('0x17')](_0x1205d4)[_0x97eb('0x18')]();};}function respondWithResult(_0x469bed,_0x55c44a){_0x55c44a=_0x55c44a||0xc8;return function(_0x226a95){if(_0x226a95){return _0x469bed[_0x97eb('0x17')](_0x55c44a)[_0x97eb('0x19')](_0x226a95);}};}function respondWithFilteredResult(_0x53bb82,_0x17801c){return function(_0x19477a){if(_0x19477a){var _0x823d10=typeof _0x17801c['offset']==='undefined'&&typeof _0x17801c[_0x97eb('0x1a')]===_0x97eb('0x1b');var _0x4764c1=_0x19477a[_0x97eb('0x1c')];var _0x1f89bd=_0x823d10?0x0:_0x17801c[_0x97eb('0x1d')];var _0x5cdbe8=_0x823d10?_0x19477a[_0x97eb('0x1c')]:_0x17801c['offset']+_0x17801c[_0x97eb('0x1a')];var _0x5349d3;if(_0x5cdbe8>=_0x4764c1){_0x5cdbe8=_0x4764c1;_0x5349d3=0xc8;}else{_0x5349d3=0xce;}_0x53bb82[_0x97eb('0x17')](_0x5349d3);return _0x53bb82[_0x97eb('0x1e')](_0x97eb('0x1f'),_0x1f89bd+'-'+_0x5cdbe8+'/'+_0x4764c1)[_0x97eb('0x19')](_0x19477a);}return null;};}function patchUpdates(_0x4b25d2){return function(_0xc3c93e){try{jsonpatch[_0x97eb('0x20')](_0xc3c93e,_0x4b25d2,!![]);}catch(_0x16384d){return BPromise[_0x97eb('0x21')](_0x16384d);}return _0xc3c93e['save']();};}function saveUpdates(_0x3c238d,_0x4d5fe5){return function(_0x6c6277){if(_0x6c6277){return _0x6c6277['update'](_0x3c238d)[_0x97eb('0x22')](function(_0x47bae8){return _0x47bae8;});}return null;};}function removeEntity(_0x4ed564,_0x4d59b9){return function(_0x978b54){if(_0x978b54){return _0x978b54['destroy']()[_0x97eb('0x22')](function(){_0x4ed564[_0x97eb('0x17')](0xcc)[_0x97eb('0x18')]();});}};}function handleEntityNotFound(_0x19822a,_0x3f35b4){return function(_0x174992){if(!_0x174992){_0x19822a[_0x97eb('0x16')](0x194);}return _0x174992;};}function handleError(_0x2d8d0d,_0x23108b){_0x23108b=_0x23108b||0x1f4;return function(_0x58f4ff){logger[_0x97eb('0x23')](_0x58f4ff['stack']);if(_0x58f4ff['name']){delete _0x58f4ff[_0x97eb('0x24')];}_0x2d8d0d[_0x97eb('0x17')](_0x23108b)[_0x97eb('0x25')](_0x58f4ff);};}exports[_0x97eb('0x26')]=function(_0x5764b1,_0x29798d){var _0x18f23e={},_0x480e3a={},_0x4d8d61={'count':0x0,'rows':[]};var _0xfc14ad=_['map'](db[_0x97eb('0x27')][_0x97eb('0x28')],function(_0x1e9bb9){return{'name':_0x1e9bb9[_0x97eb('0x29')],'type':_0x1e9bb9[_0x97eb('0x2a')]['key']};});_0x480e3a[_0x97eb('0x2b')]=_[_0x97eb('0x2c')](_0xfc14ad,_0x97eb('0x24'));_0x480e3a[_0x97eb('0x2d')]=_[_0x97eb('0x2e')](_0x5764b1[_0x97eb('0x2d')]);_0x480e3a['filters']=_['intersection'](_0x480e3a['model'],_0x480e3a[_0x97eb('0x2d')]);_0x18f23e[_0x97eb('0x2f')]=_['intersection'](_0x480e3a[_0x97eb('0x2b')],qs['fields'](_0x5764b1['query'][_0x97eb('0x30')]));_0x18f23e[_0x97eb('0x2f')]=_0x18f23e[_0x97eb('0x2f')]['length']?_0x18f23e[_0x97eb('0x2f')]:_0x480e3a[_0x97eb('0x2b')];if(!_0x5764b1[_0x97eb('0x2d')][_0x97eb('0x31')]('nolimit')){_0x18f23e[_0x97eb('0x1a')]=qs[_0x97eb('0x1a')](_0x5764b1[_0x97eb('0x2d')][_0x97eb('0x1a')]);_0x18f23e[_0x97eb('0x1d')]=qs['offset'](_0x5764b1[_0x97eb('0x2d')][_0x97eb('0x1d')]);}_0x18f23e[_0x97eb('0x32')]=qs[_0x97eb('0x33')](_0x5764b1[_0x97eb('0x2d')]['sort']);_0x18f23e[_0x97eb('0x34')]=qs[_0x97eb('0x35')](_[_0x97eb('0x36')](_0x5764b1[_0x97eb('0x2d')],_0x480e3a['filters']),_0xfc14ad);if(_0x5764b1['query'][_0x97eb('0x37')]){_0x18f23e[_0x97eb('0x34')]=_['merge'](_0x18f23e[_0x97eb('0x34')],{'$or':_[_0x97eb('0x2c')](_0xfc14ad,function(_0x283cb5){if(_0x283cb5[_0x97eb('0x2a')]!==_0x97eb('0x38')){var _0x40257e={};_0x40257e[_0x283cb5[_0x97eb('0x24')]]={'$like':'%'+_0x5764b1[_0x97eb('0x2d')][_0x97eb('0x37')]+'%'};return _0x40257e;}})});}_0x18f23e=_[_0x97eb('0x39')]({},_0x18f23e,_0x5764b1['options']);var _0x5d8cbd={'where':_0x18f23e[_0x97eb('0x34')]};return db[_0x97eb('0x27')][_0x97eb('0x1c')](_0x5d8cbd)['then'](function(_0x2230ca){_0x4d8d61[_0x97eb('0x1c')]=_0x2230ca;if(_0x5764b1['query'][_0x97eb('0x3a')]){_0x18f23e[_0x97eb('0x3b')]=[{'all':!![]}];}return db[_0x97eb('0x27')][_0x97eb('0x3c')](_0x18f23e);})[_0x97eb('0x22')](function(_0x40c59b){_0x4d8d61[_0x97eb('0x3d')]=_0x40c59b;return _0x4d8d61;})[_0x97eb('0x22')](respondWithFilteredResult(_0x29798d,_0x18f23e))[_0x97eb('0x3e')](handleError(_0x29798d,null));};exports[_0x97eb('0x3f')]=function(_0x4a2be8,_0x1b43d5){var _0x26c94b={'raw':!![],'where':{'id':_0x4a2be8[_0x97eb('0x40')]['id']}},_0x157273={};_0x157273['model']=_['keys'](db[_0x97eb('0x27')][_0x97eb('0x28')]);_0x157273[_0x97eb('0x2d')]=_[_0x97eb('0x2e')](_0x4a2be8[_0x97eb('0x2d')]);_0x157273['filters']=_[_0x97eb('0x41')](_0x157273['model'],_0x157273['query']);_0x26c94b[_0x97eb('0x2f')]=_[_0x97eb('0x41')](_0x157273[_0x97eb('0x2b')],qs[_0x97eb('0x30')](_0x4a2be8[_0x97eb('0x2d')][_0x97eb('0x30')]));_0x26c94b[_0x97eb('0x2f')]=_0x26c94b[_0x97eb('0x2f')][_0x97eb('0x42')]?_0x26c94b[_0x97eb('0x2f')]:_0x157273['model'];if(_0x4a2be8[_0x97eb('0x2d')][_0x97eb('0x3a')]){_0x26c94b[_0x97eb('0x3b')]=[{'all':!![]}];}_0x26c94b=_[_0x97eb('0x39')]({},_0x26c94b,_0x4a2be8['options']);return db[_0x97eb('0x27')]['find'](_0x26c94b)[_0x97eb('0x22')](handleEntityNotFound(_0x1b43d5,null))['then'](respondWithResult(_0x1b43d5,null))[_0x97eb('0x3e')](handleError(_0x1b43d5,null));};exports['create']=function(_0x11e74d,_0x4c2b7f){return db[_0x97eb('0x27')][_0x97eb('0x43')](_0x11e74d[_0x97eb('0x44')],{})[_0x97eb('0x22')](respondWithResult(_0x4c2b7f,0xc9))[_0x97eb('0x3e')](handleError(_0x4c2b7f,null));};exports['update']=function(_0x5c25e7,_0x269aec){if(_0x5c25e7['body']['id']){delete _0x5c25e7[_0x97eb('0x44')]['id'];}return db[_0x97eb('0x27')][_0x97eb('0x45')]({'where':{'id':_0x5c25e7[_0x97eb('0x40')]['id']}})['then'](handleEntityNotFound(_0x269aec,null))['then'](saveUpdates(_0x5c25e7[_0x97eb('0x44')],null))[_0x97eb('0x22')](respondWithResult(_0x269aec,null))['catch'](handleError(_0x269aec,null));};exports[_0x97eb('0x46')]=function(_0x29f136,_0x479e2a){return db[_0x97eb('0x27')][_0x97eb('0x45')]({'where':{'id':_0x29f136[_0x97eb('0x40')]['id']}})[_0x97eb('0x22')](handleEntityNotFound(_0x479e2a,null))[_0x97eb('0x22')](removeEntity(_0x479e2a,null))['catch'](handleError(_0x479e2a,null));};exports[_0x97eb('0x47')]=function(_0x23afac,_0x227534){return db[_0x97eb('0x27')]['describe']()[_0x97eb('0x22')](respondWithResult(_0x227534,null))[_0x97eb('0x3e')](handleError(_0x227534,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index add72ad..3b54df7 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 _0x0634=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0634,0x70));var _0x4063=function(_0x477f94,_0x42fdfa){_0x477f94=_0x477f94-0x0;var _0x1fdf10=_0x0634[_0x477f94];return _0x1fdf10;};'use strict';var _=require(_0x4063('0x0'));var util=require(_0x4063('0x1'));var logger=require(_0x4063('0x2'))(_0x4063('0x3'));var moment=require(_0x4063('0x4'));var BPromise=require(_0x4063('0x5'));var rp=require(_0x4063('0x6'));var fs=require('fs');var path=require(_0x4063('0x7'));var rimraf=require('rimraf');var config=require(_0x4063('0x8'));var attributes=require(_0x4063('0x9'));module[_0x4063('0xa')]=function(_0x2f2dcd,_0x46f4e4){return _0x2f2dcd[_0x4063('0xb')](_0x4063('0xc'),attributes,{'tableName':_0x4063('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x134c=['bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','moment'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x134c,0x1a0));var _0xc134=function(_0x3b53b0,_0x23dc58){_0x3b53b0=_0x3b53b0-0x0;var _0x4eddc6=_0x134c[_0x3b53b0];return _0x4eddc6;};'use strict';var _=require(_0xc134('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc134('0x1'));var BPromise=require(_0xc134('0x2'));var rp=require(_0xc134('0x3'));var fs=require('fs');var path=require(_0xc134('0x4'));var rimraf=require(_0xc134('0x5'));var config=require('../../config/environment');var attributes=require(_0xc134('0x6'));module[_0xc134('0x7')]=function(_0x13a13a,_0x573d8a){return _0x13a13a[_0xc134('0x8')](_0xc134('0x9'),attributes,{'tableName':_0xc134('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index bb8e284..bd878e1 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 _0x8a5c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareDetailsReport','create','options','lodash','util'];(function(_0x51f94e,_0x2f0b65){var _0x5d8d15=function(_0x11cac7){while(--_0x11cac7){_0x51f94e['push'](_0x51f94e['shift']());}};_0x5d8d15(++_0x2f0b65);}(_0x8a5c,0x136));var _0xc8a5=function(_0x438465,_0x24a17a){_0x438465=_0x438465-0x0;var _0x1455b0=_0x8a5c[_0x438465];return _0x1455b0;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var moment=require(_0xc8a5('0x2'));var BPromise=require(_0xc8a5('0x3'));var rs=require(_0xc8a5('0x4'));var fs=require('fs');var Redis=require(_0xc8a5('0x5'));var db=require(_0xc8a5('0x6'))['db'];var utils=require(_0xc8a5('0x7'));var logger=require(_0xc8a5('0x8'))('rpc');var config=require(_0xc8a5('0x9'));var jayson=require(_0xc8a5('0xa'));var client=jayson['client'][_0xc8a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcee97e,_0xd6de78,_0xa9f42c){return new BPromise(function(_0x4d25e4,_0x3ecf08){return client[_0xc8a5('0xc')](_0xcee97e,_0xa9f42c)[_0xc8a5('0xd')](function(_0x2c1fe9){logger[_0xc8a5('0xe')](_0xc8a5('0xf'),_0xd6de78,_0xc8a5('0x10'));logger[_0xc8a5('0x11')](_0xc8a5('0x12'),_0xd6de78,'request\x20sent',JSON['stringify'](_0x2c1fe9));if(_0x2c1fe9[_0xc8a5('0x13')]){if(_0x2c1fe9['error'][_0xc8a5('0x14')]===0x1f4){logger[_0xc8a5('0x13')](_0xc8a5('0xf'),_0xd6de78,_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);return _0x3ecf08(_0x2c1fe9['error'][_0xc8a5('0x15')]);}logger[_0xc8a5('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0xd6de78,_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);return _0x4d25e4(_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);}else{logger[_0xc8a5('0xe')](_0xc8a5('0xf'),_0xd6de78,'request\x20sent');_0x4d25e4(_0x2c1fe9[_0xc8a5('0x16')][_0xc8a5('0x15')]);}})['catch'](function(_0x36a78b){logger[_0xc8a5('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0xd6de78,_0x36a78b);_0x3ecf08(_0x36a78b);});});}exports[_0xc8a5('0x17')]=function(_0x3ef8d3){var _0x12a441=this;return new Promise(function(_0x1326e2,_0x1ea105){return db['SquareDetailsReport'][_0xc8a5('0x18')](_0x3ef8d3['body'],{'raw':_0x3ef8d3[_0xc8a5('0x19')]?_0x3ef8d3[_0xc8a5('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x866737){logger[_0xc8a5('0xe')](_0xc8a5('0x17'),_0x3ef8d3);logger[_0xc8a5('0x11')](_0xc8a5('0x17'),_0x3ef8d3,JSON['stringify'](_0x866737));_0x1326e2(_0x866737);})['catch'](function(_0x3e2058){logger[_0xc8a5('0x13')](_0xc8a5('0x17'),_0x3e2058[_0xc8a5('0x15')],_0x3ef8d3);_0x1ea105(_0x12a441[_0xc8a5('0x13')](0x1f4,_0x3e2058[_0xc8a5('0x15')]));});});}; \ No newline at end of file +var _0xdb94=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then'];(function(_0x565b5a,_0x2e44cd){var _0x6e9deb=function(_0x5afeeb){while(--_0x5afeeb){_0x565b5a['push'](_0x565b5a['shift']());}};_0x6e9deb(++_0x2e44cd);}(_0xdb94,0xab));var _0x4db9=function(_0x5df171,_0x17a629){_0x5df171=_0x5df171-0x0;var _0xab3805=_0xdb94[_0x5df171];return _0xab3805;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rs=require(_0x4db9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4db9('0x5'))['db'];var utils=require(_0x4db9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4db9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4db9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1f45,_0x196ede,_0x50c27a){return new BPromise(function(_0x14deb9,_0x26248b){return client[_0x4db9('0x9')](_0x5d1f45,_0x50c27a)[_0x4db9('0xa')](function(_0x2cacca){logger[_0x4db9('0xb')](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));logger[_0x4db9('0xe')](_0x4db9('0xf'),_0x196ede,_0x4db9('0xd'),JSON['stringify'](_0x2cacca));if(_0x2cacca[_0x4db9('0x10')]){if(_0x2cacca[_0x4db9('0x10')]['code']===0x1f4){logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca['error']['message']);return _0x26248b(_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);}logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);return _0x14deb9(_0x2cacca[_0x4db9('0x10')]['message']);}else{logger['info'](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));_0x14deb9(_0x2cacca['result'][_0x4db9('0x11')]);}})[_0x4db9('0x12')](function(_0x5d6471){logger['error'](_0x4db9('0xc'),_0x196ede,_0x5d6471);_0x26248b(_0x5d6471);});});}exports[_0x4db9('0x13')]=function(_0x462af3){var _0xa693c4=this;return new Promise(function(_0x1d3c33,_0x55494a){return db[_0x4db9('0x14')][_0x4db9('0x15')](_0x462af3[_0x4db9('0x16')],{'raw':_0x462af3['options']?_0x462af3[_0x4db9('0x17')][_0x4db9('0x18')]===undefined?!![]:![]:!![]})[_0x4db9('0xa')](function(_0x4c92e8){logger[_0x4db9('0xb')](_0x4db9('0x13'),_0x462af3);logger[_0x4db9('0xe')](_0x4db9('0x13'),_0x462af3,JSON[_0x4db9('0x19')](_0x4c92e8));_0x1d3c33(_0x4c92e8);})[_0x4db9('0x12')](function(_0x3585d5){logger['error'](_0x4db9('0x13'),_0x3585d5[_0x4db9('0x11')],_0x462af3);_0x55494a(_0xa693c4[_0x4db9('0x10')](0x1f4,_0x3585d5[_0x4db9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b009974..16429ed 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 _0x1336=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','killProcess','exports','express'];(function(_0x4e48d0,_0xcee4c2){var _0xe52a88=function(_0x4b9380){while(--_0x4b9380){_0x4e48d0['push'](_0x4e48d0['shift']());}};_0xe52a88(++_0xcee4c2);}(_0x1336,0x16f));var _0x6133=function(_0x5a2391,_0x21cda3){_0x5a2391=_0x5a2391-0x0;var _0x50989c=_0x1336[_0x5a2391];return _0x50989c;};'use strict';var express=require(_0x6133('0x0'));var router=express[_0x6133('0x1')]();var auth=require(_0x6133('0x2'));var controller=require(_0x6133('0x3'));router[_0x6133('0x4')]('/',auth[_0x6133('0x5')](),controller['index']);router[_0x6133('0x4')]('/process/:pid/kill',auth[_0x6133('0x5')](),controller[_0x6133('0x6')]);module[_0x6133('0x7')]=router; \ No newline at end of file +var _0x152f=['get','index','isAuthenticated','killProcess','exports','Router','../../components/auth/service','./system.controller'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0x152f,0xed));var _0xf152=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x152f[_0x40bffc];return _0x3007e9;};'use strict';var express=require('express');var router=express[_0xf152('0x0')]();var auth=require(_0xf152('0x1'));var controller=require(_0xf152('0x2'));router[_0xf152('0x3')]('/',auth['isAuthenticated'](),controller[_0xf152('0x4')]);router['get']('/process/:pid/kill',auth[_0xf152('0x5')](),controller[_0xf152('0x6')]);module[_0xf152('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index b4e394b..636da45 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 _0xb236=['then','json','catch','killProcess','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb236,0x142));var _0x6b23=function(_0x20bd71,_0x6f6de9){_0x20bd71=_0x20bd71-0x0;var _0x4ae2fe=_0xb236[_0x20bd71];return _0x4ae2fe;};'use strict';var info=require('systeminformation');var exec=require(_0x6b23('0x0'))[_0x6b23('0x1')];var logger=require(_0x6b23('0x2'))(_0x6b23('0x3'));var util=require(_0x6b23('0x4'));var BPromise=require(_0x6b23('0x5'));var _=require(_0x6b23('0x6'));function handleError(_0x20b025,_0x5dfca6,_0x15c886){_0x5dfca6=_0x5dfca6||0x1f4;return function(_0x7d22bc){logger[_0x6b23('0x7')](_0x6b23('0x8'),_0x15c886,_0x5dfca6,util[_0x6b23('0x9')](_0x7d22bc,{'showHidden':![],'depth':null}));delete _0x7d22bc[_0x6b23('0xa')];_0x20b025[_0x6b23('0xb')](_0x5dfca6)[_0x6b23('0xc')](_0x7d22bc);};}exports['index']=function(_0x544c11,_0x5a359a){return info[_0x6b23('0xd')]()[_0x6b23('0xe')](function(_0x55773c){return _0x5a359a['status'](0xc8)[_0x6b23('0xf')](_0x55773c);})[_0x6b23('0x10')](function(_0x35bca6){return _0x5a359a['status'](0x1f4)[_0x6b23('0xf')](_0x35bca6);});};exports[_0x6b23('0x11')]=function(_0x5db77c,_0x5194ff){var _0x45a61e=['components/import/cm'];return new BPromise(function(_0x58d5fe,_0x2409a9){return exec(util[_0x6b23('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5db77c[_0x6b23('0x13')][_0x6b23('0x14')]),function(_0x5c798b,_0x567761,_0x257970){if(_0x5c798b){return _0x2409a9(_0x5c798b);}return _0x58d5fe(_0x567761);});})[_0x6b23('0xe')](function(_0x25a100){var _0x45b1f8=![];var _0x58cbbf=_0x25a100[_0x6b23('0x15')](/\n/);for(var _0x1bf374=0x0,_0x5763c8=_0x45a61e[_0x6b23('0x16')];_0x1bf374<_0x5763c8,_0x45b1f8===![];_0x1bf374+=0x1){if(_0x25a100[_0x6b23('0x17')](_0x45a61e[_0x1bf374])>=0x0){_0x45b1f8=!![];}}if(!_0x45b1f8){throw new Error(util['format'](_0x6b23('0x18'),_0x5db77c[_0x6b23('0x13')]['pid']));}process[_0x6b23('0x19')](_0x5db77c[_0x6b23('0x13')]['pid'],_0x6b23('0x1a'));return _0x5194ff[_0x6b23('0xb')](0xc8)[_0x6b23('0xf')]({'message':util[_0x6b23('0x12')](_0x6b23('0x1b'),_0x5db77c['params']['pid'])});})[_0x6b23('0x10')](handleError(_0x5194ff,null,_0x6b23('0x11')));}; \ No newline at end of file +var _0x8861=['send','index','getAllData','then','json','catch','components/import/cm','format','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','killProcess','systeminformation','child_process','exec','../../config/logger','util','bluebird','inspect','name','status'];(function(_0x2744e4,_0x2dbb98){var _0x1c5cb3=function(_0x54a3b2){while(--_0x54a3b2){_0x2744e4['push'](_0x2744e4['shift']());}};_0x1c5cb3(++_0x2dbb98);}(_0x8861,0x1eb));var _0x1886=function(_0x2041fc,_0x4a3794){_0x2041fc=_0x2041fc-0x0;var _0x3e6e46=_0x8861[_0x2041fc];return _0x3e6e46;};'use strict';var info=require(_0x1886('0x0'));var exec=require(_0x1886('0x1'))[_0x1886('0x2')];var logger=require(_0x1886('0x3'))('api');var util=require(_0x1886('0x4'));var BPromise=require(_0x1886('0x5'));var _=require('lodash');function handleError(_0x31f44e,_0xface6a,_0x504eef){_0xface6a=_0xface6a||0x1f4;return function(_0x146095){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x504eef,_0xface6a,util[_0x1886('0x6')](_0x146095,{'showHidden':![],'depth':null}));delete _0x146095[_0x1886('0x7')];_0x31f44e[_0x1886('0x8')](_0xface6a)[_0x1886('0x9')](_0x146095);};}exports[_0x1886('0xa')]=function(_0x5c58b6,_0x3bf164){return info[_0x1886('0xb')]()[_0x1886('0xc')](function(_0x5960af){return _0x3bf164[_0x1886('0x8')](0xc8)[_0x1886('0xd')](_0x5960af);})[_0x1886('0xe')](function(_0x120676){return _0x3bf164[_0x1886('0x8')](0x1f4)[_0x1886('0xd')](_0x120676);});};exports['killProcess']=function(_0x253de2,_0x5e0f51){var _0x4d21df=[_0x1886('0xf')];return new BPromise(function(_0x387a6d,_0x49d730){return exec(util[_0x1886('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x253de2[_0x1886('0x11')][_0x1886('0x12')]),function(_0x290294,_0x3d85ad,_0x30e676){if(_0x290294){return _0x49d730(_0x290294);}return _0x387a6d(_0x3d85ad);});})[_0x1886('0xc')](function(_0x52c034){var _0x3c22f0=![];var _0x305f8c=_0x52c034[_0x1886('0x13')](/\n/);for(var _0x18b23a=0x0,_0x44faf7=_0x4d21df[_0x1886('0x14')];_0x18b23a<_0x44faf7,_0x3c22f0===![];_0x18b23a+=0x1){if(_0x52c034['indexOf'](_0x4d21df[_0x18b23a])>=0x0){_0x3c22f0=!![];}}if(!_0x3c22f0){throw new Error(util['format'](_0x1886('0x15'),_0x253de2[_0x1886('0x11')]['pid']));}process[_0x1886('0x16')](_0x253de2[_0x1886('0x11')][_0x1886('0x12')],_0x1886('0x17'));return _0x5e0f51[_0x1886('0x8')](0xc8)[_0x1886('0xd')]({'message':util[_0x1886('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x253de2[_0x1886('0x11')][_0x1886('0x12')])});})[_0x1886('0xe')](handleError(_0x5e0f51,null,_0x1886('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 2215333..8e0dd3f 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 _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','describe','/:id'];(function(_0x48fc3f,_0x2852be){var _0x363818=function(_0x5419e5){while(--_0x5419e5){_0x48fc3f['push'](_0x48fc3f['shift']());}};_0x363818(++_0x2852be);}(_0x41bb,0xc5));var _0xb41b=function(_0x817567,_0xa61db7){_0x817567=_0x817567-0x0;var _0x2c9833=_0x41bb[_0x817567];return _0x2c9833;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file +var _0x008c=['../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x008c,0x188));var _0xc008=function(_0x1cc4e1,_0x1629d4){_0x1cc4e1=_0x1cc4e1-0x0;var _0x192d47=_0x008c[_0x1cc4e1];return _0x192d47;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['update']);router[_0xc008('0x10')](_0xc008('0xf'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);module[_0xc008('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index bebd6f3..8cfc5bf 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 _0xc584=['exports','STRING','#0091EA'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc584,0xa8));var _0x4c58=function(_0x5e462b,_0x187b06){_0x5e462b=_0x5e462b-0x0;var _0xb01a65=_0xc584[_0x5e462b];return _0xb01a65;};'use strict';var Sequelize=require('sequelize');module[_0x4c58('0x0')]={'name':{'type':Sequelize[_0x4c58('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x4c58('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0b70=['exports','name','STRING'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0x0b70,0x159));var _0x00b7=function(_0x4db685,_0x32dbb8){_0x4db685=_0x4db685-0x0;var _0x2144a4=_0x0b70[_0x4db685];return _0x2144a4;};'use strict';var Sequelize=require('sequelize');module[_0x00b7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x00b7('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x00b7('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x00b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ceb8294..395af5d 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 _0x0541=['send','index','map','Tag','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','offset','order','where','pick','filter','VIRTUAL','merge','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name'];(function(_0x28ee48,_0x428701){var _0x33741f=function(_0x15ce6c){while(--_0x15ce6c){_0x28ee48['push'](_0x28ee48['shift']());}};_0x33741f(++_0x428701);}(_0x0541,0x1c5));var _0x1054=function(_0x35ec01,_0x5c44ac){_0x35ec01=_0x35ec01-0x0;var _0x4f75d5=_0x0541[_0x35ec01];return _0x4f75d5;};'use strict';var emlformat=require(_0x1054('0x0'));var rimraf=require(_0x1054('0x1'));var zipdir=require(_0x1054('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1054('0x3'));var moment=require(_0x1054('0x4'));var BPromise=require(_0x1054('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1054('0x6'));var sox=require(_0x1054('0x7'));var csv=require(_0x1054('0x8'));var ejs=require(_0x1054('0x9'));var fs=require('fs');var fs_extra=require(_0x1054('0xa'));var _=require(_0x1054('0xb'));var squel=require(_0x1054('0xc'));var crypto=require(_0x1054('0xd'));var jsforce=require(_0x1054('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1054('0x8'));var querystring=require(_0x1054('0xf'));var Papa=require(_0x1054('0x10'));var Redis=require(_0x1054('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1054('0x12'));var as=require(_0x1054('0x13'));var hardwareService=require(_0x1054('0x14'));var logger=require('../../config/logger')(_0x1054('0x15'));var utils=require(_0x1054('0x16'));var config=require(_0x1054('0x17'));var licenseUtil=require(_0x1054('0x18'));var db=require(_0x1054('0x19'))['db'];function respondWithStatusCode(_0x338e91,_0x280922){_0x280922=_0x280922||0xcc;return function(_0x2d9592){if(_0x2d9592){return _0x338e91['sendStatus'](_0x280922);}return _0x338e91[_0x1054('0x1a')](_0x280922)['end']();};}function respondWithResult(_0x408ee8,_0x1fef37){_0x1fef37=_0x1fef37||0xc8;return function(_0x31890a){if(_0x31890a){return _0x408ee8[_0x1054('0x1a')](_0x1fef37)['json'](_0x31890a);}};}function respondWithFilteredResult(_0x3c809a,_0x309502){return function(_0x1febae){if(_0x1febae){var _0x307b80=typeof _0x309502['offset']==='undefined'&&typeof _0x309502[_0x1054('0x1b')]===_0x1054('0x1c');var _0x32c1c3=_0x1febae[_0x1054('0x1d')];var _0x337800=_0x307b80?0x0:_0x309502['offset'];var _0x3f1ebe=_0x307b80?_0x1febae[_0x1054('0x1d')]:_0x309502['offset']+_0x309502[_0x1054('0x1b')];var _0x40a1b7;if(_0x3f1ebe>=_0x32c1c3){_0x3f1ebe=_0x32c1c3;_0x40a1b7=0xc8;}else{_0x40a1b7=0xce;}_0x3c809a[_0x1054('0x1a')](_0x40a1b7);return _0x3c809a[_0x1054('0x1e')](_0x1054('0x1f'),_0x337800+'-'+_0x3f1ebe+'/'+_0x32c1c3)[_0x1054('0x20')](_0x1febae);}return null;};}function patchUpdates(_0x2720bb){return function(_0x48bd8f){try{jsonpatch[_0x1054('0x21')](_0x48bd8f,_0x2720bb,!![]);}catch(_0x1eef9e){return BPromise[_0x1054('0x22')](_0x1eef9e);}return _0x48bd8f[_0x1054('0x23')]();};}function saveUpdates(_0x1e3544,_0x206073){return function(_0x524125){if(_0x524125){return _0x524125[_0x1054('0x24')](_0x1e3544)[_0x1054('0x25')](function(_0x230a02){return _0x230a02;});}return null;};}function removeEntity(_0x34863,_0x215d7c){return function(_0x34d33d){if(_0x34d33d){return _0x34d33d[_0x1054('0x26')]()[_0x1054('0x25')](function(){var _0x623328=_0x34d33d[_0x1054('0x27')]({'plain':!![]});var _0x1dd499=_0x1054('0x28');return db[_0x1054('0x29')][_0x1054('0x26')]({'where':{'type':_0x1dd499,'resourceId':_0x623328['id']}})[_0x1054('0x25')](function(){return _0x34d33d;});})[_0x1054('0x25')](function(){_0x34863['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf469d4,_0x19f0f9){return function(_0x1ef3e9){if(!_0x1ef3e9){_0xf469d4['sendStatus'](0x194);}return _0x1ef3e9;};}function handleError(_0x180273,_0x234426){_0x234426=_0x234426||0x1f4;return function(_0x17eb36){logger[_0x1054('0x2a')](_0x17eb36[_0x1054('0x2b')]);if(_0x17eb36[_0x1054('0x2c')]){delete _0x17eb36['name'];}_0x180273[_0x1054('0x1a')](_0x234426)[_0x1054('0x2d')](_0x17eb36);};}exports[_0x1054('0x2e')]=function(_0x58b76d,_0x463d16){var _0x3d3e22={},_0x49b358={},_0x5941ea={'count':0x0,'rows':[]};var _0x28348c=_[_0x1054('0x2f')](db[_0x1054('0x30')]['rawAttributes'],function(_0x4771b1){return{'name':_0x4771b1['fieldName'],'type':_0x4771b1[_0x1054('0x31')]['key']};});_0x49b358[_0x1054('0x32')]=_[_0x1054('0x2f')](_0x28348c,'name');_0x49b358[_0x1054('0x33')]=_['keys'](_0x58b76d['query']);_0x49b358[_0x1054('0x34')]=_['intersection'](_0x49b358[_0x1054('0x32')],_0x49b358[_0x1054('0x33')]);_0x3d3e22[_0x1054('0x35')]=_[_0x1054('0x36')](_0x49b358[_0x1054('0x32')],qs[_0x1054('0x37')](_0x58b76d[_0x1054('0x33')]['fields']));_0x3d3e22[_0x1054('0x35')]=_0x3d3e22[_0x1054('0x35')]['length']?_0x3d3e22[_0x1054('0x35')]:_0x49b358['model'];if(!_0x58b76d[_0x1054('0x33')][_0x1054('0x38')]('nolimit')){_0x3d3e22['limit']=qs[_0x1054('0x1b')](_0x58b76d[_0x1054('0x33')][_0x1054('0x1b')]);_0x3d3e22[_0x1054('0x39')]=qs[_0x1054('0x39')](_0x58b76d[_0x1054('0x33')]['offset']);}_0x3d3e22[_0x1054('0x3a')]=qs['sort'](_0x58b76d[_0x1054('0x33')]['sort']);_0x3d3e22[_0x1054('0x3b')]=qs[_0x1054('0x34')](_[_0x1054('0x3c')](_0x58b76d['query'],_0x49b358['filters']),_0x28348c);if(_0x58b76d['query'][_0x1054('0x3d')]){_0x3d3e22[_0x1054('0x3b')]=_['merge'](_0x3d3e22[_0x1054('0x3b')],{'$or':_[_0x1054('0x2f')](_0x28348c,function(_0x3cd9f){if(_0x3cd9f[_0x1054('0x31')]!==_0x1054('0x3e')){var _0x3fd3cc={};_0x3fd3cc[_0x3cd9f['name']]={'$like':'%'+_0x58b76d[_0x1054('0x33')][_0x1054('0x3d')]+'%'};return _0x3fd3cc;}})});}_0x3d3e22=_[_0x1054('0x3f')]({},_0x3d3e22,_0x58b76d['options']);var _0x497cf6={'where':_0x3d3e22[_0x1054('0x3b')]};return db['Tag'][_0x1054('0x1d')](_0x497cf6)[_0x1054('0x25')](function(_0x58b517){_0x5941ea[_0x1054('0x1d')]=_0x58b517;if(_0x58b76d[_0x1054('0x33')]['includeAll']){_0x3d3e22['include']=[{'all':!![]}];}return db[_0x1054('0x30')][_0x1054('0x40')](_0x3d3e22);})[_0x1054('0x25')](function(_0x487820){_0x5941ea[_0x1054('0x41')]=_0x487820;return _0x5941ea;})['then'](respondWithFilteredResult(_0x463d16,_0x3d3e22))[_0x1054('0x42')](handleError(_0x463d16,null));};exports[_0x1054('0x43')]=function(_0x450358,_0x322310){var _0x20eaab={'raw':!![],'where':{'id':_0x450358[_0x1054('0x44')]['id']}},_0x378abe={};_0x378abe['model']=_[_0x1054('0x45')](db[_0x1054('0x30')][_0x1054('0x46')]);_0x378abe[_0x1054('0x33')]=_[_0x1054('0x45')](_0x450358[_0x1054('0x33')]);_0x378abe[_0x1054('0x34')]=_[_0x1054('0x36')](_0x378abe[_0x1054('0x32')],_0x378abe[_0x1054('0x33')]);_0x20eaab[_0x1054('0x35')]=_[_0x1054('0x36')](_0x378abe[_0x1054('0x32')],qs[_0x1054('0x37')](_0x450358[_0x1054('0x33')][_0x1054('0x37')]));_0x20eaab[_0x1054('0x35')]=_0x20eaab['attributes']['length']?_0x20eaab[_0x1054('0x35')]:_0x378abe[_0x1054('0x32')];if(_0x450358['query'][_0x1054('0x47')]){_0x20eaab['include']=[{'all':!![]}];}_0x20eaab=_[_0x1054('0x3f')]({},_0x20eaab,_0x450358[_0x1054('0x48')]);return db[_0x1054('0x30')][_0x1054('0x49')](_0x20eaab)[_0x1054('0x25')](handleEntityNotFound(_0x322310,null))['then'](respondWithResult(_0x322310,null))[_0x1054('0x42')](handleError(_0x322310,null));};exports[_0x1054('0x4a')]=function(_0x149312,_0x11e015){return db[_0x1054('0x30')][_0x1054('0x4a')](_0x149312[_0x1054('0x4b')],{})[_0x1054('0x25')](function(_0x1575db){var _0x1bb950=_0x149312[_0x1054('0x4c')]['get']({'plain':!![]});if(!_0x1bb950)throw new Error(_0x1054('0x4d'));if(_0x1bb950[_0x1054('0x4e')]===_0x1054('0x4c')){var _0x479f60=_0x1575db[_0x1054('0x27')]({'plain':!![]});var _0x4b20f7=_0x1054('0x28');return db['UserProfileSection'][_0x1054('0x49')]({'where':{'name':_0x4b20f7,'userProfileId':_0x1bb950[_0x1054('0x4f')]},'raw':!![]})[_0x1054('0x25')](function(_0x231fd9){if(_0x231fd9&&_0x231fd9[_0x1054('0x50')]===0x0){return db[_0x1054('0x29')][_0x1054('0x4a')]({'name':_0x479f60[_0x1054('0x2c')],'resourceId':_0x479f60['id'],'type':_0x231fd9[_0x1054('0x2c')],'sectionId':_0x231fd9['id']},{})[_0x1054('0x25')](function(){return _0x1575db;});}else{return _0x1575db;}})['catch'](function(_0x58fa0b){logger[_0x1054('0x2a')](_0x1054('0x51'),_0x58fa0b);throw _0x58fa0b;});}return _0x1575db;})[_0x1054('0x25')](respondWithResult(_0x11e015,0xc9))['catch'](handleError(_0x11e015,null));};exports[_0x1054('0x24')]=function(_0x7a7349,_0x4cf9fe){if(_0x7a7349[_0x1054('0x4b')]['id']){delete _0x7a7349[_0x1054('0x4b')]['id'];}return db['Tag'][_0x1054('0x49')]({'where':{'id':_0x7a7349[_0x1054('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cf9fe,null))[_0x1054('0x25')](saveUpdates(_0x7a7349['body'],null))[_0x1054('0x25')](respondWithResult(_0x4cf9fe,null))[_0x1054('0x42')](handleError(_0x4cf9fe,null));};exports[_0x1054('0x26')]=function(_0x16dafe,_0x46d954){return db[_0x1054('0x30')]['find']({'where':{'id':_0x16dafe[_0x1054('0x44')]['id']}})[_0x1054('0x25')](handleEntityNotFound(_0x46d954,null))[_0x1054('0x25')](removeEntity(_0x46d954,null))['catch'](handleError(_0x46d954,null));};exports[_0x1054('0x52')]=function(_0x4476bd,_0xd3c6ad){return db['Tag'][_0x1054('0x52')]()[_0x1054('0x25')](respondWithResult(_0xd3c6ad,null))[_0x1054('0x42')](handleError(_0xd3c6ad,null));}; \ No newline at end of file +var _0xd64a=['map','Tag','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','sendStatus','stack','name','index'];(function(_0x454709,_0xa28117){var _0x3fb5dc=function(_0x49dbb2){while(--_0x49dbb2){_0x454709['push'](_0x454709['shift']());}};_0x3fb5dc(++_0xa28117);}(_0xd64a,0x1d8));var _0xad64=function(_0x58ecb4,_0x30ea2f){_0x58ecb4=_0x58ecb4-0x0;var _0x10eea8=_0xd64a[_0x58ecb4];return _0x10eea8;};'use strict';var emlformat=require(_0xad64('0x0'));var rimraf=require(_0xad64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad64('0x2'));var rp=require(_0xad64('0x3'));var moment=require('moment');var BPromise=require(_0xad64('0x4'));var Mustache=require(_0xad64('0x5'));var util=require(_0xad64('0x6'));var path=require(_0xad64('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad64('0x8'));var _=require('lodash');var squel=require(_0xad64('0x9'));var crypto=require('crypto');var jsforce=require(_0xad64('0xa'));var deskjs=require(_0xad64('0xb'));var toCsv=require(_0xad64('0xc'));var querystring=require(_0xad64('0xd'));var Papa=require(_0xad64('0xe'));var Redis=require(_0xad64('0xf'));var authService=require(_0xad64('0x10'));var qs=require(_0xad64('0x11'));var as=require(_0xad64('0x12'));var hardwareService=require(_0xad64('0x13'));var logger=require(_0xad64('0x14'))('api');var utils=require(_0xad64('0x15'));var config=require(_0xad64('0x16'));var licenseUtil=require(_0xad64('0x17'));var db=require(_0xad64('0x18'))['db'];function respondWithStatusCode(_0x22c78d,_0xd8ee32){_0xd8ee32=_0xd8ee32||0xcc;return function(_0x1a7846){if(_0x1a7846){return _0x22c78d['sendStatus'](_0xd8ee32);}return _0x22c78d[_0xad64('0x19')](_0xd8ee32)[_0xad64('0x1a')]();};}function respondWithResult(_0x8a5a7e,_0x27bbe0){_0x27bbe0=_0x27bbe0||0xc8;return function(_0x20a3c7){if(_0x20a3c7){return _0x8a5a7e[_0xad64('0x19')](_0x27bbe0)[_0xad64('0x1b')](_0x20a3c7);}};}function respondWithFilteredResult(_0x586349,_0x53f764){return function(_0x3db172){if(_0x3db172){var _0x2449e0=typeof _0x53f764[_0xad64('0x1c')]===_0xad64('0x1d')&&typeof _0x53f764['limit']==='undefined';var _0x4d0082=_0x3db172[_0xad64('0x1e')];var _0x5db51c=_0x2449e0?0x0:_0x53f764[_0xad64('0x1c')];var _0x3ece23=_0x2449e0?_0x3db172[_0xad64('0x1e')]:_0x53f764[_0xad64('0x1c')]+_0x53f764[_0xad64('0x1f')];var _0x908d1;if(_0x3ece23>=_0x4d0082){_0x3ece23=_0x4d0082;_0x908d1=0xc8;}else{_0x908d1=0xce;}_0x586349[_0xad64('0x19')](_0x908d1);return _0x586349[_0xad64('0x20')](_0xad64('0x21'),_0x5db51c+'-'+_0x3ece23+'/'+_0x4d0082)['json'](_0x3db172);}return null;};}function patchUpdates(_0x6fd69c){return function(_0x56fc56){try{jsonpatch[_0xad64('0x22')](_0x56fc56,_0x6fd69c,!![]);}catch(_0x34c655){return BPromise[_0xad64('0x23')](_0x34c655);}return _0x56fc56[_0xad64('0x24')]();};}function saveUpdates(_0x435703,_0x4a5135){return function(_0x5bd4d8){if(_0x5bd4d8){return _0x5bd4d8['update'](_0x435703)[_0xad64('0x25')](function(_0x589e61){return _0x589e61;});}return null;};}function removeEntity(_0x48aa97,_0x2e417c){return function(_0x50453e){if(_0x50453e){return _0x50453e[_0xad64('0x26')]()[_0xad64('0x25')](function(){var _0x14ebb1=_0x50453e[_0xad64('0x27')]({'plain':!![]});var _0x57e1d3='Tags';return db['UserProfileResource'][_0xad64('0x26')]({'where':{'type':_0x57e1d3,'resourceId':_0x14ebb1['id']}})[_0xad64('0x25')](function(){return _0x50453e;});})[_0xad64('0x25')](function(){_0x48aa97[_0xad64('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4941be,_0x3260d6){return function(_0x19d230){if(!_0x19d230){_0x4941be[_0xad64('0x28')](0x194);}return _0x19d230;};}function handleError(_0x439d4c,_0x4398aa){_0x4398aa=_0x4398aa||0x1f4;return function(_0x402cf3){logger['error'](_0x402cf3[_0xad64('0x29')]);if(_0x402cf3[_0xad64('0x2a')]){delete _0x402cf3[_0xad64('0x2a')];}_0x439d4c[_0xad64('0x19')](_0x4398aa)['send'](_0x402cf3);};}exports[_0xad64('0x2b')]=function(_0x2236a7,_0x48e2d5){var _0xbb5b4={},_0x5b8932={},_0x5497ae={'count':0x0,'rows':[]};var _0x8ec98d=_[_0xad64('0x2c')](db[_0xad64('0x2d')][_0xad64('0x2e')],function(_0x487cd5){return{'name':_0x487cd5[_0xad64('0x2f')],'type':_0x487cd5[_0xad64('0x30')][_0xad64('0x31')]};});_0x5b8932[_0xad64('0x32')]=_[_0xad64('0x2c')](_0x8ec98d,_0xad64('0x2a'));_0x5b8932[_0xad64('0x33')]=_['keys'](_0x2236a7[_0xad64('0x33')]);_0x5b8932[_0xad64('0x34')]=_['intersection'](_0x5b8932[_0xad64('0x32')],_0x5b8932['query']);_0xbb5b4[_0xad64('0x35')]=_[_0xad64('0x36')](_0x5b8932['model'],qs['fields'](_0x2236a7[_0xad64('0x33')][_0xad64('0x37')]));_0xbb5b4[_0xad64('0x35')]=_0xbb5b4[_0xad64('0x35')][_0xad64('0x38')]?_0xbb5b4['attributes']:_0x5b8932[_0xad64('0x32')];if(!_0x2236a7['query'][_0xad64('0x39')](_0xad64('0x3a'))){_0xbb5b4['limit']=qs['limit'](_0x2236a7[_0xad64('0x33')][_0xad64('0x1f')]);_0xbb5b4['offset']=qs['offset'](_0x2236a7[_0xad64('0x33')][_0xad64('0x1c')]);}_0xbb5b4[_0xad64('0x3b')]=qs[_0xad64('0x3c')](_0x2236a7[_0xad64('0x33')]['sort']);_0xbb5b4['where']=qs['filters'](_[_0xad64('0x3d')](_0x2236a7[_0xad64('0x33')],_0x5b8932[_0xad64('0x34')]),_0x8ec98d);if(_0x2236a7[_0xad64('0x33')][_0xad64('0x3e')]){_0xbb5b4[_0xad64('0x3f')]=_[_0xad64('0x40')](_0xbb5b4[_0xad64('0x3f')],{'$or':_[_0xad64('0x2c')](_0x8ec98d,function(_0x2aa813){if(_0x2aa813[_0xad64('0x30')]!==_0xad64('0x41')){var _0x2e71c7={};_0x2e71c7[_0x2aa813[_0xad64('0x2a')]]={'$like':'%'+_0x2236a7['query']['filter']+'%'};return _0x2e71c7;}})});}_0xbb5b4=_[_0xad64('0x40')]({},_0xbb5b4,_0x2236a7[_0xad64('0x42')]);var _0x4d60c4={'where':_0xbb5b4['where']};return db[_0xad64('0x2d')][_0xad64('0x1e')](_0x4d60c4)[_0xad64('0x25')](function(_0x3d7071){_0x5497ae['count']=_0x3d7071;if(_0x2236a7[_0xad64('0x33')]['includeAll']){_0xbb5b4[_0xad64('0x43')]=[{'all':!![]}];}return db['Tag'][_0xad64('0x44')](_0xbb5b4);})[_0xad64('0x25')](function(_0x4748e5){_0x5497ae[_0xad64('0x45')]=_0x4748e5;return _0x5497ae;})[_0xad64('0x25')](respondWithFilteredResult(_0x48e2d5,_0xbb5b4))[_0xad64('0x46')](handleError(_0x48e2d5,null));};exports[_0xad64('0x47')]=function(_0x3c0be4,_0x40fbce){var _0x5cfa44={'raw':!![],'where':{'id':_0x3c0be4[_0xad64('0x48')]['id']}},_0x5efc0a={};_0x5efc0a['model']=_['keys'](db['Tag']['rawAttributes']);_0x5efc0a[_0xad64('0x33')]=_[_0xad64('0x49')](_0x3c0be4[_0xad64('0x33')]);_0x5efc0a[_0xad64('0x34')]=_[_0xad64('0x36')](_0x5efc0a[_0xad64('0x32')],_0x5efc0a[_0xad64('0x33')]);_0x5cfa44[_0xad64('0x35')]=_[_0xad64('0x36')](_0x5efc0a['model'],qs['fields'](_0x3c0be4['query'][_0xad64('0x37')]));_0x5cfa44[_0xad64('0x35')]=_0x5cfa44['attributes'][_0xad64('0x38')]?_0x5cfa44[_0xad64('0x35')]:_0x5efc0a['model'];if(_0x3c0be4[_0xad64('0x33')]['includeAll']){_0x5cfa44[_0xad64('0x43')]=[{'all':!![]}];}_0x5cfa44=_['merge']({},_0x5cfa44,_0x3c0be4[_0xad64('0x42')]);return db[_0xad64('0x2d')][_0xad64('0x4a')](_0x5cfa44)[_0xad64('0x25')](handleEntityNotFound(_0x40fbce,null))['then'](respondWithResult(_0x40fbce,null))[_0xad64('0x46')](handleError(_0x40fbce,null));};exports[_0xad64('0x4b')]=function(_0x16e97b,_0x3b6ec6){return db['Tag'][_0xad64('0x4b')](_0x16e97b[_0xad64('0x4c')],{})[_0xad64('0x25')](function(_0x2a6218){var _0x109a4c=_0x16e97b[_0xad64('0x4d')]['get']({'plain':!![]});if(!_0x109a4c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x109a4c['role']===_0xad64('0x4d')){var _0x1f22a2=_0x2a6218[_0xad64('0x27')]({'plain':!![]});var _0x5e0602='Tags';return db[_0xad64('0x4e')][_0xad64('0x4a')]({'where':{'name':_0x5e0602,'userProfileId':_0x109a4c[_0xad64('0x4f')]},'raw':!![]})[_0xad64('0x25')](function(_0x9eba48){if(_0x9eba48&&_0x9eba48[_0xad64('0x50')]===0x0){return db[_0xad64('0x51')][_0xad64('0x4b')]({'name':_0x1f22a2['name'],'resourceId':_0x1f22a2['id'],'type':_0x9eba48[_0xad64('0x2a')],'sectionId':_0x9eba48['id']},{})[_0xad64('0x25')](function(){return _0x2a6218;});}else{return _0x2a6218;}})[_0xad64('0x46')](function(_0x4df118){logger[_0xad64('0x52')](_0xad64('0x53'),_0x4df118);throw _0x4df118;});}return _0x2a6218;})['then'](respondWithResult(_0x3b6ec6,0xc9))[_0xad64('0x46')](handleError(_0x3b6ec6,null));};exports[_0xad64('0x54')]=function(_0x25f479,_0x17dabb){if(_0x25f479[_0xad64('0x4c')]['id']){delete _0x25f479['body']['id'];}return db[_0xad64('0x2d')][_0xad64('0x4a')]({'where':{'id':_0x25f479[_0xad64('0x48')]['id']}})[_0xad64('0x25')](handleEntityNotFound(_0x17dabb,null))[_0xad64('0x25')](saveUpdates(_0x25f479[_0xad64('0x4c')],null))[_0xad64('0x25')](respondWithResult(_0x17dabb,null))['catch'](handleError(_0x17dabb,null));};exports['destroy']=function(_0x4e86c8,_0x4c7105){return db[_0xad64('0x2d')][_0xad64('0x4a')]({'where':{'id':_0x4e86c8[_0xad64('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c7105,null))[_0xad64('0x25')](removeEntity(_0x4c7105,null))[_0xad64('0x46')](handleError(_0x4c7105,null));};exports[_0xad64('0x55')]=function(_0x454e20,_0x231b11){return db[_0xad64('0x2d')]['describe']()[_0xad64('0x25')](respondWithResult(_0x231b11,null))[_0xad64('0x46')](handleError(_0x231b11,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f70fc43..73b7c10 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 _0x51e5=['bluebird','rimraf','./tag.attributes','exports','tools_tags','lodash','util','../../config/logger','api'];(function(_0x5110f4,_0x384b97){var _0xed6b9e=function(_0x55fca9){while(--_0x55fca9){_0x5110f4['push'](_0x5110f4['shift']());}};_0xed6b9e(++_0x384b97);}(_0x51e5,0x12e));var _0x551e=function(_0x2c7461,_0x1e9d3a){_0x2c7461=_0x2c7461-0x0;var _0x2941ec=_0x51e5[_0x2c7461];return _0x2941ec;};'use strict';var _=require(_0x551e('0x0'));var util=require(_0x551e('0x1'));var logger=require(_0x551e('0x2'))(_0x551e('0x3'));var moment=require('moment');var BPromise=require(_0x551e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x551e('0x5'));var config=require('../../config/environment');var attributes=require(_0x551e('0x6'));module[_0x551e('0x7')]=function(_0xa031bd,_0xc8211e){return _0xa031bd['define']('Tag',attributes,{'tableName':_0x551e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78c7=['./tag.attributes','exports','define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x1cdefb,_0x1984e6){var _0x57a99f=function(_0xda6a3a){while(--_0xda6a3a){_0x1cdefb['push'](_0x1cdefb['shift']());}};_0x57a99f(++_0x1984e6);}(_0x78c7,0x1c1));var _0x778c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78c7[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x778c('0x0'));var logger=require(_0x778c('0x1'))(_0x778c('0x2'));var moment=require(_0x778c('0x3'));var BPromise=require(_0x778c('0x4'));var rp=require(_0x778c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x778c('0x6'));var attributes=require(_0x778c('0x7'));module[_0x778c('0x8')]=function(_0x4f4f2e,_0x2fdd0b){return _0x4f4f2e[_0x778c('0x9')](_0x778c('0xa'),attributes,{'tableName':_0x778c('0xb'),'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 b560ec3..f4e6a6e 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 _0x1af3=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3cb934,_0x319b50){var _0x269e98=function(_0x5b5a27){while(--_0x5b5a27){_0x3cb934['push'](_0x3cb934['shift']());}};_0x269e98(++_0x319b50);}(_0x1af3,0x1ca));var _0x31af=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x1af3[_0x3c81b5];return _0x5888c4;};'use strict';var _=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var moment=require(_0x31af('0x2'));var BPromise=require(_0x31af('0x3'));var rs=require(_0x31af('0x4'));var fs=require('fs');var Redis=require(_0x31af('0x5'));var db=require(_0x31af('0x6'))['db'];var utils=require(_0x31af('0x7'));var logger=require(_0x31af('0x8'))(_0x31af('0x9'));var config=require('../../config/environment');var jayson=require(_0x31af('0xa'));var client=jayson[_0x31af('0xb')][_0x31af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21ddc5,_0x485717,_0x6be8e9){return new BPromise(function(_0x1833de,_0x406dd8){return client['request'](_0x21ddc5,_0x6be8e9)[_0x31af('0xd')](function(_0x2f1973){logger[_0x31af('0xe')](_0x31af('0xf'),_0x485717,_0x31af('0x10'));logger[_0x31af('0x11')](_0x31af('0x12'),_0x485717,_0x31af('0x10'),JSON['stringify'](_0x2f1973));if(_0x2f1973[_0x31af('0x13')]){if(_0x2f1973[_0x31af('0x13')][_0x31af('0x14')]===0x1f4){logger[_0x31af('0x13')](_0x31af('0xf'),_0x485717,_0x2f1973['error'][_0x31af('0x15')]);return _0x406dd8(_0x2f1973[_0x31af('0x13')]['message']);}logger['error'](_0x31af('0xf'),_0x485717,_0x2f1973[_0x31af('0x13')][_0x31af('0x15')]);return _0x1833de(_0x2f1973[_0x31af('0x13')][_0x31af('0x15')]);}else{logger[_0x31af('0xe')](_0x31af('0xf'),_0x485717,_0x31af('0x10'));_0x1833de(_0x2f1973[_0x31af('0x16')][_0x31af('0x15')]);}})[_0x31af('0x17')](function(_0x51bae2){logger[_0x31af('0x13')](_0x31af('0xf'),_0x485717,_0x51bae2);_0x406dd8(_0x51bae2);});});} \ No newline at end of file +var _0xac95=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','Tag,\x20%s,\x20%s','message','result','catch'];(function(_0x657139,_0x4bc871){var _0x5ccba9=function(_0x160988){while(--_0x160988){_0x657139['push'](_0x657139['shift']());}};_0x5ccba9(++_0x4bc871);}(_0xac95,0xa8));var _0x5ac9=function(_0x54a79c,_0x39b923){_0x54a79c=_0x54a79c-0x0;var _0x45417f=_0xac95[_0x54a79c];return _0x45417f;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var moment=require(_0x5ac9('0x2'));var BPromise=require(_0x5ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ac9('0x4'))['db'];var utils=require(_0x5ac9('0x5'));var logger=require('../../config/logger')(_0x5ac9('0x6'));var config=require(_0x5ac9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ac9('0x8')][_0x5ac9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8675ec,_0x4bddcf,_0x4dffb8){return new BPromise(function(_0x32afbc,_0x2ab11c){return client[_0x5ac9('0xa')](_0x8675ec,_0x4dffb8)[_0x5ac9('0xb')](function(_0x397bb8){logger[_0x5ac9('0xc')]('Tag,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'));logger[_0x5ac9('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'),JSON['stringify'](_0x397bb8));if(_0x397bb8[_0x5ac9('0xf')]){if(_0x397bb8['error'][_0x5ac9('0x10')]===0x1f4){logger[_0x5ac9('0xf')](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x2ab11c(_0x397bb8['error'][_0x5ac9('0x12')]);}logger['error'](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x32afbc(_0x397bb8[_0x5ac9('0xf')][_0x5ac9('0x12')]);}else{logger[_0x5ac9('0xc')](_0x5ac9('0x11'),_0x4bddcf,_0x5ac9('0xd'));_0x32afbc(_0x397bb8[_0x5ac9('0x13')][_0x5ac9('0x12')]);}})[_0x5ac9('0x14')](function(_0x460fd7){logger['error']('Tag,\x20%s,\x20%s',_0x4bddcf,_0x460fd7);_0x2ab11c(_0x460fd7);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index e4e13df..824c49b 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 d50a022..becb4e6 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe706,0xa3));var _0x6e70=function(_0x185063,_0x3f0bb7){_0x185063=_0x185063-0x0;var _0x16d9d3=_0xe706[_0x185063];return _0x16d9d3;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x5f512e,_0x3dc3fa){var _0x207d30=function(_0x3d20ce){while(--_0x3d20ce){_0x5f512e['push'](_0x5f512e['shift']());}};_0x207d30(++_0x3dc3fa);}(_0x757a,0xde));var _0xa757=function(_0xd55b6e,_0x482b9f){_0xd55b6e=_0xd55b6e-0x0;var _0x31d4ef=_0x757a[_0xd55b6e];return _0x31d4ef;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 89f9c14..c4d2e50 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 _0xe6f2=['OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','getQueues','params','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','findOrCreate','Queue:save','QueueId','User','findAll','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','VoicePrefixId','spread','removeAgents','emit','Queue:remove','getAgents','nolimit','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','error','send','index','map','Team','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','then','includeAll','rows','catch','show','keys','include','find','create','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x5d4c75,_0x13deae){var _0x8410b1=function(_0x3a76f3){while(--_0x3a76f3){_0x5d4c75['push'](_0x5d4c75['shift']());}};_0x8410b1(++_0x13deae);}(_0xe6f2,0xd1));var _0x2e6f=function(_0x425008,_0x21c494){_0x425008=_0x425008-0x0;var _0x5f1001=_0xe6f2[_0x425008];return _0x5f1001;};'use strict';var emlformat=require(_0x2e6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e6f('0x2'));var moment=require('moment');var BPromise=require(_0x2e6f('0x3'));var Mustache=require(_0x2e6f('0x4'));var util=require(_0x2e6f('0x5'));var path=require(_0x2e6f('0x6'));var sox=require('sox');var csv=require(_0x2e6f('0x7'));var ejs=require(_0x2e6f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e6f('0x9'));var squel=require(_0x2e6f('0xa'));var crypto=require(_0x2e6f('0xb'));var jsforce=require(_0x2e6f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2e6f('0xd'));var Papa=require(_0x2e6f('0xe'));var Redis=require(_0x2e6f('0xf'));var authService=require(_0x2e6f('0x10'));var qs=require(_0x2e6f('0x11'));var as=require(_0x2e6f('0x12'));var hardwareService=require(_0x2e6f('0x13'));var logger=require(_0x2e6f('0x14'))(_0x2e6f('0x15'));var utils=require(_0x2e6f('0x16'));var config=require(_0x2e6f('0x17'));var licenseUtil=require(_0x2e6f('0x18'));var db=require(_0x2e6f('0x19'))['db'];config[_0x2e6f('0x1a')]=_[_0x2e6f('0x1b')](config[_0x2e6f('0x1a')],{'host':_0x2e6f('0x1c'),'port':0x18eb});var socket=require(_0x2e6f('0x1d'))(new Redis(config[_0x2e6f('0x1a')]));require('./team.socket')[_0x2e6f('0x1e')](socket);function respondWithStatusCode(_0x3400b9,_0x2bb0c3){_0x2bb0c3=_0x2bb0c3||0xcc;return function(_0x2fd653){if(_0x2fd653){return _0x3400b9[_0x2e6f('0x1f')](_0x2bb0c3);}return _0x3400b9['status'](_0x2bb0c3)['end']();};}function respondWithResult(_0x25eafa,_0x51e74e){_0x51e74e=_0x51e74e||0xc8;return function(_0x24b925){if(_0x24b925){return _0x25eafa[_0x2e6f('0x20')](_0x51e74e)[_0x2e6f('0x21')](_0x24b925);}};}function respondWithFilteredResult(_0x3d04d5,_0x3973d0){return function(_0x514283){if(_0x514283){var _0x10d424=typeof _0x3973d0[_0x2e6f('0x22')]===_0x2e6f('0x23')&&typeof _0x3973d0[_0x2e6f('0x24')]===_0x2e6f('0x23');var _0x4ba1ed=_0x514283['count'];var _0xe0d2c7=_0x10d424?0x0:_0x3973d0[_0x2e6f('0x22')];var _0x1b0115=_0x10d424?_0x514283[_0x2e6f('0x25')]:_0x3973d0[_0x2e6f('0x22')]+_0x3973d0[_0x2e6f('0x24')];var _0x5f25dc;if(_0x1b0115>=_0x4ba1ed){_0x1b0115=_0x4ba1ed;_0x5f25dc=0xc8;}else{_0x5f25dc=0xce;}_0x3d04d5[_0x2e6f('0x20')](_0x5f25dc);return _0x3d04d5['set']('Content-Range',_0xe0d2c7+'-'+_0x1b0115+'/'+_0x4ba1ed)['json'](_0x514283);}return null;};}function patchUpdates(_0x2c09b2){return function(_0x3ad924){try{jsonpatch['apply'](_0x3ad924,_0x2c09b2,!![]);}catch(_0xbba393){return BPromise[_0x2e6f('0x26')](_0xbba393);}return _0x3ad924[_0x2e6f('0x27')]();};}function saveUpdates(_0xf91ba2,_0x122801){return function(_0x22ac15){if(_0x22ac15){return _0x22ac15[_0x2e6f('0x28')](_0xf91ba2)['then'](function(_0x44c26c){return _0x44c26c;});}return null;};}function handleEntityNotFound(_0x2bc517,_0x48385e){return function(_0x2ddd71){if(!_0x2ddd71){_0x2bc517['sendStatus'](0x194);}return _0x2ddd71;};}function handleError(_0xf66b89,_0x5e637f){_0x5e637f=_0x5e637f||0x1f4;return function(_0x596c04){logger[_0x2e6f('0x29')](_0x596c04['stack']);if(_0x596c04['name']){delete _0x596c04['name'];}_0xf66b89[_0x2e6f('0x20')](_0x5e637f)[_0x2e6f('0x2a')](_0x596c04);};}exports[_0x2e6f('0x2b')]=function(_0x47c2de,_0x21bd3e){var _0x45f12a={},_0x4a9cce={},_0x175e97={'count':0x0,'rows':[]};var _0x320b30=_[_0x2e6f('0x2c')](db[_0x2e6f('0x2d')][_0x2e6f('0x2e')],function(_0x26e42b){return{'name':_0x26e42b['fieldName'],'type':_0x26e42b[_0x2e6f('0x2f')][_0x2e6f('0x30')]};});_0x4a9cce[_0x2e6f('0x31')]=_[_0x2e6f('0x2c')](_0x320b30,'name');_0x4a9cce[_0x2e6f('0x32')]=_['keys'](_0x47c2de[_0x2e6f('0x32')]);_0x4a9cce[_0x2e6f('0x33')]=_[_0x2e6f('0x34')](_0x4a9cce[_0x2e6f('0x31')],_0x4a9cce['query']);_0x45f12a['attributes']=_[_0x2e6f('0x34')](_0x4a9cce[_0x2e6f('0x31')],qs[_0x2e6f('0x35')](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x35')]));_0x45f12a['attributes']=_0x45f12a[_0x2e6f('0x36')][_0x2e6f('0x37')]?_0x45f12a['attributes']:_0x4a9cce['model'];if(!_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x38')]('nolimit')){_0x45f12a[_0x2e6f('0x24')]=qs['limit'](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x24')]);_0x45f12a[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x22')]);}_0x45f12a[_0x2e6f('0x39')]=qs[_0x2e6f('0x3a')](_0x47c2de[_0x2e6f('0x32')]['sort']);_0x45f12a[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0x47c2de[_0x2e6f('0x32')],_0x4a9cce[_0x2e6f('0x33')]),_0x320b30);if(_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x3d')]){_0x45f12a[_0x2e6f('0x3b')]=_[_0x2e6f('0x3e')](_0x45f12a[_0x2e6f('0x3b')],{'$or':_['map'](_0x320b30,function(_0x550604){if(_0x550604[_0x2e6f('0x2f')]!==_0x2e6f('0x3f')){var _0x5dc99c={};_0x5dc99c[_0x550604[_0x2e6f('0x40')]]={'$like':'%'+_0x47c2de['query'][_0x2e6f('0x3d')]+'%'};return _0x5dc99c;}})});}_0x45f12a=_[_0x2e6f('0x3e')]({},_0x45f12a,_0x47c2de[_0x2e6f('0x41')]);var _0x6a911b={'where':_0x45f12a[_0x2e6f('0x3b')]};return db[_0x2e6f('0x2d')]['count'](_0x6a911b)[_0x2e6f('0x42')](function(_0x505268){_0x175e97[_0x2e6f('0x25')]=_0x505268;if(_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x43')]){_0x45f12a['include']=[{'all':!![]}];}return db[_0x2e6f('0x2d')]['findAll'](_0x45f12a);})['then'](function(_0x1334e6){_0x175e97[_0x2e6f('0x44')]=_0x1334e6;return _0x175e97;})[_0x2e6f('0x42')](respondWithFilteredResult(_0x21bd3e,_0x45f12a))[_0x2e6f('0x45')](handleError(_0x21bd3e,null));};exports[_0x2e6f('0x46')]=function(_0x437716,_0x22c396){var _0x5837b3={'raw':![],'where':{'id':_0x437716['params']['id']}},_0x1bc063={};_0x1bc063[_0x2e6f('0x31')]=_[_0x2e6f('0x47')](db[_0x2e6f('0x2d')][_0x2e6f('0x2e')]);_0x1bc063['query']=_[_0x2e6f('0x47')](_0x437716['query']);_0x1bc063['filters']=_[_0x2e6f('0x34')](_0x1bc063['model'],_0x1bc063[_0x2e6f('0x32')]);_0x5837b3[_0x2e6f('0x36')]=_[_0x2e6f('0x34')](_0x1bc063[_0x2e6f('0x31')],qs[_0x2e6f('0x35')](_0x437716[_0x2e6f('0x32')][_0x2e6f('0x35')]));_0x5837b3[_0x2e6f('0x36')]=_0x5837b3[_0x2e6f('0x36')]['length']?_0x5837b3[_0x2e6f('0x36')]:_0x1bc063[_0x2e6f('0x31')];if(_0x437716[_0x2e6f('0x32')][_0x2e6f('0x43')]){_0x5837b3[_0x2e6f('0x48')]=[{'all':!![]}];}_0x5837b3=_[_0x2e6f('0x3e')]({},_0x5837b3,_0x437716[_0x2e6f('0x41')]);return db[_0x2e6f('0x2d')][_0x2e6f('0x49')](_0x5837b3)['then'](handleEntityNotFound(_0x22c396,null))[_0x2e6f('0x42')](respondWithResult(_0x22c396,null))[_0x2e6f('0x45')](handleError(_0x22c396,null));};exports[_0x2e6f('0x4a')]=function(_0x478a6c,_0xad246){return db['Team'][_0x2e6f('0x4a')](_0x478a6c['body'],{})[_0x2e6f('0x42')](function(_0x391e58){var _0x3d9741=_0x478a6c['user'][_0x2e6f('0x4b')]({'plain':!![]});if(!_0x3d9741)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d9741[_0x2e6f('0x4c')]===_0x2e6f('0x4d')){var _0x15c585=_0x391e58[_0x2e6f('0x4b')]({'plain':!![]});var _0x528271=_0x2e6f('0x4e');return db[_0x2e6f('0x4f')][_0x2e6f('0x49')]({'where':{'name':_0x528271,'userProfileId':_0x3d9741[_0x2e6f('0x50')]},'raw':!![]})[_0x2e6f('0x42')](function(_0x212e40){if(_0x212e40&&_0x212e40[_0x2e6f('0x51')]===0x0){return db[_0x2e6f('0x52')]['create']({'name':_0x15c585[_0x2e6f('0x40')],'resourceId':_0x15c585['id'],'type':_0x212e40[_0x2e6f('0x40')],'sectionId':_0x212e40['id']},{})[_0x2e6f('0x42')](function(){return _0x391e58;});}else{return _0x391e58;}})[_0x2e6f('0x45')](function(_0x23f9de){logger[_0x2e6f('0x29')](_0x2e6f('0x53'),_0x23f9de);throw _0x23f9de;});}return _0x391e58;})[_0x2e6f('0x42')](respondWithResult(_0xad246,0xc9))[_0x2e6f('0x45')](handleError(_0xad246,null));};exports[_0x2e6f('0x28')]=function(_0x16722c,_0x5c4172){if(_0x16722c['body']['id']){delete _0x16722c['body']['id'];}return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0x16722c['params']['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x5c4172,null))[_0x2e6f('0x42')](saveUpdates(_0x16722c[_0x2e6f('0x54')],null))[_0x2e6f('0x42')](respondWithResult(_0x5c4172,null))[_0x2e6f('0x45')](handleError(_0x5c4172,null));};exports['destroy']=function(_0x111239,_0x48d883){var _0x20af16=_0x111239['params']['id'];var _0x50f657=[];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x4ef695){var _0x4e1703='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x4e1703,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695})[_0x2e6f('0x42')](function(_0x55479a){_0x50f657=_['map'](_0x55479a,function(_0x9f2d20){return Number(_0x9f2d20[_0x2e6f('0x5a')]);});})[_0x2e6f('0x42')](function(){var _0x21c807=_0x2e6f('0x5b')+_0x20af16;return db[_0x2e6f('0x55')]['query'](_0x21c807,{'type':db['Sequelize'][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x2f70ef){var _0x9bfcb=_[_0x2e6f('0x2c')](_0x2f70ef,function(_0x2ee20a){return Number(_0x2ee20a[_0x2e6f('0x5c')]);});return db[_0x2e6f('0x5d')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'VoiceQueueId':{'$in':_0x9bfcb}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x4f13a8='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x4f13a8,{'type':db[_0x2e6f('0x57')]['QueryTypes'][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x51da1d){var _0x55938e=_[_0x2e6f('0x2c')](_0x51da1d,function(_0x420981){return Number(_0x420981[_0x2e6f('0x5f')]);});return db[_0x2e6f('0x60')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'MailQueueId':{'$in':_0x55938e}},'transaction':_0x4ef695});})['then'](function(){var _0x362a26=_0x2e6f('0x61')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x362a26,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')]['SELECT'],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x16a420){var _0x127ebe=_[_0x2e6f('0x2c')](_0x16a420,function(_0x2d0845){return Number(_0x2d0845[_0x2e6f('0x62')]);});return db[_0x2e6f('0x63')]['destroy']({'where':{'UserId':{'$in':_0x50f657},'SmsQueueId':{'$in':_0x127ebe}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x35ada3=_0x2e6f('0x64')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x35ada3,{'type':db[_0x2e6f('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x1d41e7){var _0x4c7798=_['map'](_0x1d41e7,function(_0x5ce265){return Number(_0x5ce265[_0x2e6f('0x65')]);});return db[_0x2e6f('0x66')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'ChatQueueId':{'$in':_0x4c7798}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x2b88b2=_0x2e6f('0x67')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x2b88b2,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x510221){var _0x13b788=_['map'](_0x510221,function(_0x2660b8){return Number(_0x2660b8['FaxQueueId']);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x50f657},'FaxQueueId':{'$in':_0x13b788}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x523846=_0x2e6f('0x68')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x523846,{'type':db['Sequelize'][_0x2e6f('0x58')]['SELECT'],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x27ac86){var _0x4ebce4=_['map'](_0x27ac86,function(_0x3f719b){return Number(_0x3f719b[_0x2e6f('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x50f657},'OpenchannelQueueId':{'$in':_0x4ebce4}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x1ce2c1=_0x2e6f('0x6a')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x1ce2c1,{'type':db['Sequelize'][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x33f6f4){var _0x2de16c=_[_0x2e6f('0x2c')](_0x33f6f4,function(_0xf75eee){return Number(_0xf75eee[_0x2e6f('0x6b')]);});return db[_0x2e6f('0x6c')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'WhatsappQueueId':{'$in':_0x2de16c}},'transaction':_0x4ef695});})['then'](function(){return db['TeamVoicePrefix'][_0x2e6f('0x49')]({'where':{'TeamId':_0x20af16}});})[_0x2e6f('0x42')](function(_0x37906a){if(_0x37906a===null){return;}return db[_0x2e6f('0x6d')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'VoicePrefixId':_0x37906a['VoicePrefixId']},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){return db['Team'][_0x2e6f('0x5e')]({'where':{'id':_0x20af16},'cascade':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x313e1a){if(_0x313e1a===0x0){_0x48d883[_0x2e6f('0x1f')](0x194);}else{return db[_0x2e6f('0x52')][_0x2e6f('0x5e')]({'where':{'type':_0x2e6f('0x4e'),'resourceId':_0x20af16},'cascade':!![],'transaction':_0x4ef695})[_0x2e6f('0x42')](function(){_0x48d883[_0x2e6f('0x20')](0xcc)['end']();});}})[_0x2e6f('0x45')](function(_0x5dd798){_0x48d883[_0x2e6f('0x20')](0x1f4)[_0x2e6f('0x2a')](_0x5dd798);});});};exports[_0x2e6f('0x6e')]=function(_0xaec12b,_0x1be033,_0x1e0a02){return db[_0x2e6f('0x2d')]['findOne']({'where':{'id':_0xaec12b[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x1be033,null))[_0x2e6f('0x42')](function(_0xa44446){if(!_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x70')]||!utils[_0x2e6f('0x71')](_0xaec12b['query']['channel'])){throw new db[(_0x2e6f('0x57'))][(_0x2e6f('0x72'))](_0x2e6f('0x73'));}var _0x2364b1={};var _0x34c8b1={};_0x34c8b1[_0x2e6f('0x31')]=_['keys'](db[_[_0x2e6f('0x74')](_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x70')][_0x2e6f('0x75')]())+_0x2e6f('0x76')][_0x2e6f('0x2e')]);_0x34c8b1['query']=_['keys'](_0xaec12b[_0x2e6f('0x32')]);_0x34c8b1[_0x2e6f('0x33')]=_[_0x2e6f('0x34')](_0x34c8b1[_0x2e6f('0x31')],_0x34c8b1[_0x2e6f('0x32')]);_0x2364b1['attributes']=_[_0x2e6f('0x34')](_0x34c8b1[_0x2e6f('0x31')],qs['fields'](_0xaec12b['query'][_0x2e6f('0x35')]));_0x2364b1[_0x2e6f('0x36')]=_0x2364b1['attributes'][_0x2e6f('0x37')]?_0x2364b1[_0x2e6f('0x36')]:_0x34c8b1['model'];_0x2364b1[_0x2e6f('0x24')]=qs[_0x2e6f('0x24')](_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x24')]);_0x2364b1[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0xaec12b[_0x2e6f('0x32')]['offset']);_0x2364b1['order']=qs[_0x2e6f('0x3a')](_0xaec12b['query'][_0x2e6f('0x3a')]);_0x2364b1[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0xaec12b[_0x2e6f('0x32')],_0x34c8b1[_0x2e6f('0x33')]));_0x2364b1=_[_0x2e6f('0x3e')]({},_0x2364b1,_0xaec12b['options']);return _0xa44446[_0x2e6f('0x4b')+_[_0x2e6f('0x74')](_0xaec12b['query'][_0x2e6f('0x70')][_0x2e6f('0x75')]())+_0x2e6f('0x77')](_0x2364b1);})[_0x2e6f('0x42')](respondWithResult(_0x1be033,null))[_0x2e6f('0x45')](handleError(_0x1be033,null));};exports[_0x2e6f('0x78')]=function(_0x4d44ff,_0x28bcab,_0x1d87a6){return db[_0x2e6f('0x2d')][_0x2e6f('0x79')]({'where':{'id':_0x4d44ff[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](function(_0x2b92ea){if(_0x2b92ea){if(!_0x4d44ff['body']['channel']||!utils[_0x2e6f('0x71')](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x70')])){throw new db[(_0x2e6f('0x57'))]['ValidationError'](_0x2e6f('0x73'));}return _0x2b92ea[_0x2e6f('0x7a')+_[_0x2e6f('0x74')](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x70')]['toLowerCase']())+'Queues'](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x7b')]);}return null;})[_0x2e6f('0x42')](handleEntityNotFound(_0x28bcab,null))[_0x2e6f('0x42')](respondWithStatusCode(_0x28bcab,null))['catch'](handleError(_0x28bcab,null));};exports[_0x2e6f('0x7c')]=function(_0x38b3bb,_0xff83,_0x55eff2){return db['Team'][_0x2e6f('0x79')]({'where':{'id':_0x38b3bb['params']['id']}})['then'](function(_0xbdd00c){if(_0xbdd00c){if(!_0x38b3bb[_0x2e6f('0x32')]['channel']||!utils[_0x2e6f('0x71')](_0x38b3bb[_0x2e6f('0x32')][_0x2e6f('0x70')])){throw new db[(_0x2e6f('0x57'))][(_0x2e6f('0x72'))](_0x2e6f('0x73'));}return _0xbdd00c['remove'+_['capitalize'](_0x38b3bb[_0x2e6f('0x32')]['channel'][_0x2e6f('0x75')]())+_0x2e6f('0x77')](_0x38b3bb['query']['ids']);}return null;})[_0x2e6f('0x42')](handleEntityNotFound(_0xff83,null))[_0x2e6f('0x42')](respondWithStatusCode(_0xff83,null))[_0x2e6f('0x45')](handleError(_0xff83,null));};exports[_0x2e6f('0x7d')]=function(_0xd9b351,_0x2b92f2){var _0x586bd0=_[_0x2e6f('0x7e')](_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')])?_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')]:[_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')]];var _0x8d2f7d=_0xd9b351['params']['id'];return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0x8d2f7d}})[_0x2e6f('0x42')](handleEntityNotFound(_0x2b92f2,null))[_0x2e6f('0x42')](function(_0x527033){if(_0x527033){var _0x5a35cf=[_0x2e6f('0x7f'),_0x2e6f('0x80'),_0x2e6f('0x81'),_0x2e6f('0x82'),_0x2e6f('0x83'),_0x2e6f('0x84'),'Whatsapp'];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x17e639){var _0x451945=_[_0x2e6f('0x2c')](_0x5a35cf,function(_0x1f7bbc){var _0x28b867={'attributes':['id',_0x2e6f('0x40')]};if(_0x1f7bbc==='Voice'){_0x28b867[_0x2e6f('0x85')]={'attributes':[_0x2e6f('0x86')]};}return _0x527033[_0x2e6f('0x4b')+_0x1f7bbc+_0x2e6f('0x77')](_0x28b867)['then'](function(_0x521ee1){var _0x1cc5c8=_['map'](_0x521ee1,function(_0x5384d8){var _0x3613c6=_[_0x2e6f('0x2c')](_0x586bd0,function(_0x59777f){var _0x40be94={'where':{'UserId':_0x59777f,[_0x1f7bbc+'QueueId']:_0x5384d8['id']},'transaction':_0x17e639};if(_0x1f7bbc===_0x2e6f('0x7f')){_0x40be94[_0x2e6f('0x1b')]={'penalty':_0x5384d8['TeamVoiceQueue']['penalty']};}return db['User'+_0x1f7bbc+_0x2e6f('0x76')][_0x2e6f('0x87')](_0x40be94)['then'](function(){socket['emit'](_0x2e6f('0x4d')+_0x1f7bbc+_0x2e6f('0x88'),{'UserId':_0x59777f,[_0x1f7bbc+_0x2e6f('0x89')]:_0x5384d8['id']});if(_0x1f7bbc!==_0x2e6f('0x7f')){return;}return db[_0x2e6f('0x8a')][_0x2e6f('0x8b')]({'where':{'id':_0x586bd0,'online':0x1},'attributes':['id',_0x2e6f('0x40'),_0x2e6f('0x8c'),_0x2e6f('0x8d'),_0x2e6f('0x8e')],'raw':!![]})[_0x2e6f('0x42')](function(_0x934108){var _0x359891=_[_0x2e6f('0x2c')](_0x934108,function(_0xddc7fe){return db['UserVoiceQueueRt'][_0x2e6f('0x8f')]({'membername':_0xddc7fe[_0x2e6f('0x40')],'UserId':_0xddc7fe['id'],'queue_name':_0x5384d8['name'],'VoiceQueueId':_0x5384d8['id'],'interface':_[_0x2e6f('0x90')](_0xddc7fe[_0x2e6f('0x8e')])?util[_0x2e6f('0x91')](_0x2e6f('0x92'),_0xddc7fe['name']):_0xddc7fe[_0x2e6f('0x8e')],'paused':_0xddc7fe[_0x2e6f('0x8d')]||![],'penalty':_0x5384d8[_0x2e6f('0x93')]['penalty']},{'transaction':_0x17e639});});return Promise[_0x2e6f('0x94')](_0x359891);});});});return Promise[_0x2e6f('0x94')](_0x3613c6);});return Promise[_0x2e6f('0x94')](_0x1cc5c8);})[_0x2e6f('0x42')](function(){return db[_0x2e6f('0x95')][_0x2e6f('0x79')]({'where':{'teamId':_0x8d2f7d}})[_0x2e6f('0x42')](function(_0x5e1def){if(_0x5e1def){var _0x3906d6=_[_0x2e6f('0x2c')](_0x586bd0,function(_0x588039){db['UserVoicePrefix'][_0x2e6f('0x8f')]({'UserId':_0x588039,'VoicePrefixId':_0x5e1def[_0x2e6f('0x96')]});});return Promise[_0x2e6f('0x94')](_0x3906d6);}});});});return Promise[_0x2e6f('0x94')](_0x451945)[_0x2e6f('0x42')](function(){return _0x527033[_0x2e6f('0x7d')](_0x586bd0,{'transaction':_0x17e639})[_0x2e6f('0x97')](function(_0x475538){return _0x475538;});});});}})[_0x2e6f('0x42')](respondWithResult(_0x2b92f2,null))[_0x2e6f('0x45')](handleError(_0x2b92f2,null));};exports[_0x2e6f('0x98')]=function(_0x436911,_0x1c5978){var _0x3ca774=_[_0x2e6f('0x7e')](_0x436911[_0x2e6f('0x32')]['ids'])?_0x436911[_0x2e6f('0x32')][_0x2e6f('0x7b')]:[_0x436911[_0x2e6f('0x32')][_0x2e6f('0x7b')]];var _0xbb7d32=_0x436911[_0x2e6f('0x6f')]['id'];return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0xbb7d32}})[_0x2e6f('0x42')](handleEntityNotFound(_0x1c5978,null))[_0x2e6f('0x42')](function(_0x30bb2b){if(_0x30bb2b){var _0x26c06d=[_0x2e6f('0x7f'),_0x2e6f('0x80'),_0x2e6f('0x81'),_0x2e6f('0x82'),_0x2e6f('0x83'),_0x2e6f('0x84'),'Whatsapp'];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x5dde5c){var _0x2191f3=_['map'](_0x26c06d,function(_0x42496d){var _0x24d158={'attributes':['id',_0x2e6f('0x40')]};return _0x30bb2b[_0x2e6f('0x4b')+_0x42496d+'Queues'](_0x24d158)['then'](function(_0x334575){var _0x54645d=_[_0x2e6f('0x2c')](_0x334575,function(_0x445d16){return _0x445d16[_0x2e6f('0x98')](_0x3ca774,{'transaction':_0x5dde5c})['then'](function(){var _0x902beb=_[_0x2e6f('0x2c')](_0x3ca774,function(_0x1670ab){socket[_0x2e6f('0x99')](_0x2e6f('0x4d')+_0x42496d+_0x2e6f('0x9a'),{'UserId':Number(_0x1670ab),[_0x42496d+_0x2e6f('0x89')]:_0x445d16['id']});if(_0x42496d!==_0x2e6f('0x7f')){return;}return db['UserVoiceQueueRt'][_0x2e6f('0x5e')]({'where':{'VoiceQueueId':_0x445d16['id'],'UserId':_0x1670ab},'transaction':_0x5dde5c});});return Promise[_0x2e6f('0x94')](_0x902beb);});});return Promise[_0x2e6f('0x94')](_0x54645d);});});return Promise[_0x2e6f('0x94')](_0x2191f3)['then'](function(){return _0x30bb2b[_0x2e6f('0x98')](_0x3ca774,{'transaction':_0x5dde5c});})[_0x2e6f('0x42')](function(){return db[_0x2e6f('0x95')][_0x2e6f('0x79')]({'where':{'teamId':_0xbb7d32}})['then'](function(_0x24b7a3){if(_0x24b7a3){var _0x104c1b=_[_0x2e6f('0x2c')](_0x3ca774,function(_0x432a35){db[_0x2e6f('0x6d')][_0x2e6f('0x5e')]({'where':{'UserId':_0x432a35,'VoicePrefixId':_0x24b7a3['VoicePrefixId']}});});return Promise[_0x2e6f('0x94')](_0x104c1b);}});});});}})['then'](respondWithStatusCode(_0x1c5978,null))[_0x2e6f('0x45')](handleError(_0x1c5978,null));};exports[_0x2e6f('0x9b')]=function(_0x3ad053,_0x5ece8f,_0x1b8ca7){var _0x50b9af={};var _0x3dccca={};var _0x319014;var _0xef33de;return db[_0x2e6f('0x2d')]['findOne']({'where':{'id':_0x3ad053[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x5ece8f,null))[_0x2e6f('0x42')](function(_0x317523){if(_0x317523){_0x319014=_0x317523;_0x3dccca[_0x2e6f('0x31')]=_['keys'](db[_0x2e6f('0x8a')][_0x2e6f('0x2e')]);_0x3dccca[_0x2e6f('0x32')]=_[_0x2e6f('0x47')](_0x3ad053[_0x2e6f('0x32')]);_0x3dccca['filters']=_[_0x2e6f('0x34')](_0x3dccca['model'],_0x3dccca[_0x2e6f('0x32')]);_0x50b9af[_0x2e6f('0x36')]=_[_0x2e6f('0x34')](_0x3dccca['model'],qs[_0x2e6f('0x35')](_0x3ad053['query'][_0x2e6f('0x35')]));_0x50b9af['attributes']=_0x50b9af[_0x2e6f('0x36')][_0x2e6f('0x37')]?_0x50b9af[_0x2e6f('0x36')]:_0x3dccca[_0x2e6f('0x31')];_0x50b9af['order']=qs[_0x2e6f('0x3a')](_0x3ad053['query'][_0x2e6f('0x3a')]);_0x50b9af[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0x3ad053['query'],_0x3dccca[_0x2e6f('0x33')]));if(_0x3ad053[_0x2e6f('0x32')][_0x2e6f('0x3d')]){_0x50b9af[_0x2e6f('0x3b')]=_[_0x2e6f('0x3e')](_0x50b9af[_0x2e6f('0x3b')],{'$or':_['map'](_0x50b9af['attributes'],function(_0x325a4c){var _0x93fdf6={};_0x93fdf6[_0x325a4c]={'$like':'%'+_0x3ad053[_0x2e6f('0x32')]['filter']+'%'};return _0x93fdf6;})});}_0x50b9af=_['merge']({},_0x50b9af,_0x3ad053['options']);return _0x319014[_0x2e6f('0x9b')](_0x50b9af);}})[_0x2e6f('0x42')](function(_0x2c1284){if(_0x2c1284){_0xef33de=_0x2c1284[_0x2e6f('0x37')];if(!_0x3ad053['query'][_0x2e6f('0x38')](_0x2e6f('0x9c'))){_0x50b9af[_0x2e6f('0x24')]=qs[_0x2e6f('0x24')](_0x3ad053['query'][_0x2e6f('0x24')]);_0x50b9af[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0x3ad053[_0x2e6f('0x32')]['offset']);}return _0x319014['getAgents'](_0x50b9af);}})[_0x2e6f('0x42')](function(_0x1f8273){if(_0x1f8273){return _0x1f8273?{'count':_0xef33de,'rows':_0x1f8273}:null;}})[_0x2e6f('0x42')](respondWithResult(_0x5ece8f,null))[_0x2e6f('0x45')](handleError(_0x5ece8f,null));}; \ No newline at end of file +var _0xdf32=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','update','then','error','stack','send','index','map','Team','rawAttributes','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','user','get','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','isValidChannel','capitalize','channel','toLowerCase','Queue','keys','pick','Queues','addQueues','Unknown\x20channel','ids','removeQueues','findOne','ValidationError','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','online','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','all','spread','removeAgents','Queue:remove','getAgents','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3024d0,_0x481ffb){var _0x5b6652=function(_0x219bae){while(--_0x219bae){_0x3024d0['push'](_0x3024d0['shift']());}};_0x5b6652(++_0x481ffb);}(_0xdf32,0x1b6));var _0x2df3=function(_0x2d7301,_0xddda57){_0x2d7301=_0x2d7301-0x0;var _0x50996f=_0xdf32[_0x2d7301];return _0x50996f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2df3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2df3('0x1'));var rp=require('request-promise');var moment=require(_0x2df3('0x2'));var BPromise=require(_0x2df3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2df3('0x4'));var sox=require(_0x2df3('0x5'));var csv=require(_0x2df3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2df3('0x7'));var _=require(_0x2df3('0x8'));var squel=require(_0x2df3('0x9'));var crypto=require(_0x2df3('0xa'));var jsforce=require(_0x2df3('0xb'));var deskjs=require(_0x2df3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2df3('0xd'));var Papa=require('papaparse');var Redis=require(_0x2df3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2df3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2df3('0x10'));var logger=require(_0x2df3('0x11'))(_0x2df3('0x12'));var utils=require(_0x2df3('0x13'));var config=require(_0x2df3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2df3('0x15'))['db'];config[_0x2df3('0x16')]=_[_0x2df3('0x17')](config[_0x2df3('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x2df3('0x18'))(new Redis(config[_0x2df3('0x16')]));require(_0x2df3('0x19'))[_0x2df3('0x1a')](socket);function respondWithStatusCode(_0x4fe1b6,_0x2ad711){_0x2ad711=_0x2ad711||0xcc;return function(_0x314939){if(_0x314939){return _0x4fe1b6[_0x2df3('0x1b')](_0x2ad711);}return _0x4fe1b6[_0x2df3('0x1c')](_0x2ad711)[_0x2df3('0x1d')]();};}function respondWithResult(_0x1c2514,_0x341099){_0x341099=_0x341099||0xc8;return function(_0x2ff23b){if(_0x2ff23b){return _0x1c2514['status'](_0x341099)['json'](_0x2ff23b);}};}function respondWithFilteredResult(_0x29f8cc,_0x36598d){return function(_0x388a84){if(_0x388a84){var _0x2b01eb=typeof _0x36598d[_0x2df3('0x1e')]===_0x2df3('0x1f')&&typeof _0x36598d[_0x2df3('0x20')]===_0x2df3('0x1f');var _0x4311e0=_0x388a84[_0x2df3('0x21')];var _0x1604b0=_0x2b01eb?0x0:_0x36598d['offset'];var _0x228c93=_0x2b01eb?_0x388a84[_0x2df3('0x21')]:_0x36598d['offset']+_0x36598d[_0x2df3('0x20')];var _0x4a8ecc;if(_0x228c93>=_0x4311e0){_0x228c93=_0x4311e0;_0x4a8ecc=0xc8;}else{_0x4a8ecc=0xce;}_0x29f8cc[_0x2df3('0x1c')](_0x4a8ecc);return _0x29f8cc[_0x2df3('0x22')]('Content-Range',_0x1604b0+'-'+_0x228c93+'/'+_0x4311e0)['json'](_0x388a84);}return null;};}function patchUpdates(_0x53a9da){return function(_0x3b0a6f){try{jsonpatch[_0x2df3('0x23')](_0x3b0a6f,_0x53a9da,!![]);}catch(_0x4322ce){return BPromise['reject'](_0x4322ce);}return _0x3b0a6f[_0x2df3('0x24')]();};}function saveUpdates(_0x3f6696,_0x4567f4){return function(_0x294782){if(_0x294782){return _0x294782[_0x2df3('0x25')](_0x3f6696)[_0x2df3('0x26')](function(_0x1836db){return _0x1836db;});}return null;};}function handleEntityNotFound(_0x2a1142,_0x220866){return function(_0x3705fa){if(!_0x3705fa){_0x2a1142['sendStatus'](0x194);}return _0x3705fa;};}function handleError(_0x31e4c3,_0x26ee59){_0x26ee59=_0x26ee59||0x1f4;return function(_0x21e076){logger[_0x2df3('0x27')](_0x21e076[_0x2df3('0x28')]);if(_0x21e076['name']){delete _0x21e076['name'];}_0x31e4c3[_0x2df3('0x1c')](_0x26ee59)[_0x2df3('0x29')](_0x21e076);};}exports[_0x2df3('0x2a')]=function(_0x20e0a0,_0x101345){var _0x4e6753={},_0x2a639a={},_0x27532a={'count':0x0,'rows':[]};var _0x5a424d=_[_0x2df3('0x2b')](db[_0x2df3('0x2c')][_0x2df3('0x2d')],function(_0x330f75){return{'name':_0x330f75[_0x2df3('0x2e')],'type':_0x330f75[_0x2df3('0x2f')]['key']};});_0x2a639a['model']=_[_0x2df3('0x2b')](_0x5a424d,_0x2df3('0x30'));_0x2a639a['query']=_['keys'](_0x20e0a0[_0x2df3('0x31')]);_0x2a639a[_0x2df3('0x32')]=_[_0x2df3('0x33')](_0x2a639a[_0x2df3('0x34')],_0x2a639a['query']);_0x4e6753[_0x2df3('0x35')]=_[_0x2df3('0x33')](_0x2a639a['model'],qs['fields'](_0x20e0a0[_0x2df3('0x31')][_0x2df3('0x36')]));_0x4e6753[_0x2df3('0x35')]=_0x4e6753[_0x2df3('0x35')][_0x2df3('0x37')]?_0x4e6753[_0x2df3('0x35')]:_0x2a639a[_0x2df3('0x34')];if(!_0x20e0a0[_0x2df3('0x31')][_0x2df3('0x38')](_0x2df3('0x39'))){_0x4e6753[_0x2df3('0x20')]=qs[_0x2df3('0x20')](_0x20e0a0[_0x2df3('0x31')]['limit']);_0x4e6753[_0x2df3('0x1e')]=qs[_0x2df3('0x1e')](_0x20e0a0[_0x2df3('0x31')][_0x2df3('0x1e')]);}_0x4e6753[_0x2df3('0x3a')]=qs[_0x2df3('0x3b')](_0x20e0a0[_0x2df3('0x31')][_0x2df3('0x3b')]);_0x4e6753[_0x2df3('0x3c')]=qs[_0x2df3('0x32')](_['pick'](_0x20e0a0[_0x2df3('0x31')],_0x2a639a[_0x2df3('0x32')]),_0x5a424d);if(_0x20e0a0['query']['filter']){_0x4e6753['where']=_['merge'](_0x4e6753['where'],{'$or':_[_0x2df3('0x2b')](_0x5a424d,function(_0x240a19){if(_0x240a19[_0x2df3('0x2f')]!==_0x2df3('0x3d')){var _0x415e4f={};_0x415e4f[_0x240a19[_0x2df3('0x30')]]={'$like':'%'+_0x20e0a0[_0x2df3('0x31')][_0x2df3('0x3e')]+'%'};return _0x415e4f;}})});}_0x4e6753=_['merge']({},_0x4e6753,_0x20e0a0[_0x2df3('0x3f')]);var _0x29d616={'where':_0x4e6753[_0x2df3('0x3c')]};return db['Team'][_0x2df3('0x21')](_0x29d616)[_0x2df3('0x26')](function(_0x24e914){_0x27532a[_0x2df3('0x21')]=_0x24e914;if(_0x20e0a0[_0x2df3('0x31')][_0x2df3('0x40')]){_0x4e6753['include']=[{'all':!![]}];}return db[_0x2df3('0x2c')][_0x2df3('0x41')](_0x4e6753);})['then'](function(_0x1e6d7b){_0x27532a[_0x2df3('0x42')]=_0x1e6d7b;return _0x27532a;})[_0x2df3('0x26')](respondWithFilteredResult(_0x101345,_0x4e6753))[_0x2df3('0x43')](handleError(_0x101345,null));};exports[_0x2df3('0x44')]=function(_0x1047e6,_0x4c66b1){var _0x57614e={'raw':![],'where':{'id':_0x1047e6[_0x2df3('0x45')]['id']}},_0x3e500e={};_0x3e500e[_0x2df3('0x34')]=_['keys'](db[_0x2df3('0x2c')][_0x2df3('0x2d')]);_0x3e500e[_0x2df3('0x31')]=_['keys'](_0x1047e6[_0x2df3('0x31')]);_0x3e500e['filters']=_[_0x2df3('0x33')](_0x3e500e['model'],_0x3e500e[_0x2df3('0x31')]);_0x57614e[_0x2df3('0x35')]=_['intersection'](_0x3e500e[_0x2df3('0x34')],qs[_0x2df3('0x36')](_0x1047e6[_0x2df3('0x31')][_0x2df3('0x36')]));_0x57614e[_0x2df3('0x35')]=_0x57614e[_0x2df3('0x35')][_0x2df3('0x37')]?_0x57614e[_0x2df3('0x35')]:_0x3e500e[_0x2df3('0x34')];if(_0x1047e6['query'][_0x2df3('0x40')]){_0x57614e[_0x2df3('0x46')]=[{'all':!![]}];}_0x57614e=_[_0x2df3('0x47')]({},_0x57614e,_0x1047e6[_0x2df3('0x3f')]);return db[_0x2df3('0x2c')][_0x2df3('0x48')](_0x57614e)[_0x2df3('0x26')](handleEntityNotFound(_0x4c66b1,null))['then'](respondWithResult(_0x4c66b1,null))['catch'](handleError(_0x4c66b1,null));};exports['create']=function(_0x194a83,_0x3f3230){return db['Team'][_0x2df3('0x49')](_0x194a83['body'],{})[_0x2df3('0x26')](function(_0x18f178){var _0x495b24=_0x194a83[_0x2df3('0x4a')][_0x2df3('0x4b')]({'plain':!![]});if(!_0x495b24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x495b24[_0x2df3('0x4c')]==='user'){var _0x27730e=_0x18f178[_0x2df3('0x4b')]({'plain':!![]});var _0x59fdbf=_0x2df3('0x4d');return db[_0x2df3('0x4e')][_0x2df3('0x48')]({'where':{'name':_0x59fdbf,'userProfileId':_0x495b24['userProfileId']},'raw':!![]})[_0x2df3('0x26')](function(_0x417654){if(_0x417654&&_0x417654[_0x2df3('0x4f')]===0x0){return db[_0x2df3('0x50')][_0x2df3('0x49')]({'name':_0x27730e['name'],'resourceId':_0x27730e['id'],'type':_0x417654[_0x2df3('0x30')],'sectionId':_0x417654['id']},{})['then'](function(){return _0x18f178;});}else{return _0x18f178;}})[_0x2df3('0x43')](function(_0x21e119){logger[_0x2df3('0x27')](_0x2df3('0x51'),_0x21e119);throw _0x21e119;});}return _0x18f178;})[_0x2df3('0x26')](respondWithResult(_0x3f3230,0xc9))[_0x2df3('0x43')](handleError(_0x3f3230,null));};exports[_0x2df3('0x25')]=function(_0x5d13f9,_0x32e9d1){if(_0x5d13f9[_0x2df3('0x52')]['id']){delete _0x5d13f9[_0x2df3('0x52')]['id'];}return db[_0x2df3('0x2c')]['find']({'where':{'id':_0x5d13f9[_0x2df3('0x45')]['id']}})[_0x2df3('0x26')](handleEntityNotFound(_0x32e9d1,null))[_0x2df3('0x26')](saveUpdates(_0x5d13f9[_0x2df3('0x52')],null))[_0x2df3('0x26')](respondWithResult(_0x32e9d1,null))['catch'](handleError(_0x32e9d1,null));};exports[_0x2df3('0x53')]=function(_0x2f8c5d,_0x2715a6){var _0x5c62f4=_0x2f8c5d['params']['id'];var _0x1a0335=[];return db[_0x2df3('0x54')][_0x2df3('0x55')](function(_0x100402){var _0x5f4d92=_0x2df3('0x56')+_0x5c62f4;return db[_0x2df3('0x54')]['query'](_0x5f4d92,{'type':db[_0x2df3('0x57')]['QueryTypes'][_0x2df3('0x58')],'raw':!![],'transaction':_0x100402})[_0x2df3('0x26')](function(_0x60619){_0x1a0335=_['map'](_0x60619,function(_0x1e813c){return Number(_0x1e813c['UserId']);});})[_0x2df3('0x26')](function(){var _0x501c56=_0x2df3('0x59')+_0x5c62f4;return db[_0x2df3('0x54')][_0x2df3('0x31')](_0x501c56,{'type':db[_0x2df3('0x57')][_0x2df3('0x5a')][_0x2df3('0x58')],'raw':!![],'transaction':_0x100402});})[_0x2df3('0x26')](function(_0x5bc9b8){var _0x4bfd13=_[_0x2df3('0x2b')](_0x5bc9b8,function(_0xf14c05){return Number(_0xf14c05[_0x2df3('0x5b')]);});return db['UserVoiceQueue'][_0x2df3('0x53')]({'where':{'UserId':{'$in':_0x1a0335},'VoiceQueueId':{'$in':_0x4bfd13}},'transaction':_0x100402});})['then'](function(){var _0x55391a=_0x2df3('0x5c')+_0x5c62f4;return db[_0x2df3('0x54')]['query'](_0x55391a,{'type':db[_0x2df3('0x57')][_0x2df3('0x5a')][_0x2df3('0x58')],'raw':!![],'transaction':_0x100402});})[_0x2df3('0x26')](function(_0x2492e0){var _0x26d807=_[_0x2df3('0x2b')](_0x2492e0,function(_0x2ed483){return Number(_0x2ed483[_0x2df3('0x5d')]);});return db['UserMailQueue'][_0x2df3('0x53')]({'where':{'UserId':{'$in':_0x1a0335},'MailQueueId':{'$in':_0x26d807}},'transaction':_0x100402});})[_0x2df3('0x26')](function(){var _0x334b51=_0x2df3('0x5e')+_0x5c62f4;return db[_0x2df3('0x54')][_0x2df3('0x31')](_0x334b51,{'type':db['Sequelize']['QueryTypes'][_0x2df3('0x58')],'raw':!![],'transaction':_0x100402});})[_0x2df3('0x26')](function(_0x2340f7){var _0x334369=_[_0x2df3('0x2b')](_0x2340f7,function(_0x14f62a){return Number(_0x14f62a[_0x2df3('0x5f')]);});return db[_0x2df3('0x60')]['destroy']({'where':{'UserId':{'$in':_0x1a0335},'SmsQueueId':{'$in':_0x334369}},'transaction':_0x100402});})[_0x2df3('0x26')](function(){var _0x135610='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5c62f4;return db[_0x2df3('0x54')][_0x2df3('0x31')](_0x135610,{'type':db[_0x2df3('0x57')][_0x2df3('0x5a')][_0x2df3('0x58')],'raw':!![],'transaction':_0x100402});})[_0x2df3('0x26')](function(_0x1b1e18){var _0x3210c8=_['map'](_0x1b1e18,function(_0x1b01e8){return Number(_0x1b01e8['ChatQueueId']);});return db[_0x2df3('0x61')][_0x2df3('0x53')]({'where':{'UserId':{'$in':_0x1a0335},'ChatQueueId':{'$in':_0x3210c8}},'transaction':_0x100402});})[_0x2df3('0x26')](function(){var _0x48f363=_0x2df3('0x62')+_0x5c62f4;return db[_0x2df3('0x54')][_0x2df3('0x31')](_0x48f363,{'type':db[_0x2df3('0x57')][_0x2df3('0x5a')]['SELECT'],'raw':!![],'transaction':_0x100402});})['then'](function(_0x4e8119){var _0x17580e=_['map'](_0x4e8119,function(_0x3c5fdc){return Number(_0x3c5fdc[_0x2df3('0x63')]);});return db[_0x2df3('0x64')][_0x2df3('0x53')]({'where':{'UserId':{'$in':_0x1a0335},'FaxQueueId':{'$in':_0x17580e}},'transaction':_0x100402});})[_0x2df3('0x26')](function(){var _0x1b780f=_0x2df3('0x65')+_0x5c62f4;return db[_0x2df3('0x54')]['query'](_0x1b780f,{'type':db['Sequelize'][_0x2df3('0x5a')][_0x2df3('0x58')],'raw':!![],'transaction':_0x100402});})['then'](function(_0x2d09bb){var _0x28cb52=_[_0x2df3('0x2b')](_0x2d09bb,function(_0x56aa33){return Number(_0x56aa33['OpenchannelQueueId']);});return db[_0x2df3('0x66')][_0x2df3('0x53')]({'where':{'UserId':{'$in':_0x1a0335},'OpenchannelQueueId':{'$in':_0x28cb52}},'transaction':_0x100402});})['then'](function(){var _0x5ef7f8=_0x2df3('0x67')+_0x5c62f4;return db[_0x2df3('0x54')][_0x2df3('0x31')](_0x5ef7f8,{'type':db[_0x2df3('0x57')][_0x2df3('0x5a')]['SELECT'],'raw':!![],'transaction':_0x100402});})['then'](function(_0x266be3){var _0x4c721e=_[_0x2df3('0x2b')](_0x266be3,function(_0x16cd0c){return Number(_0x16cd0c[_0x2df3('0x68')]);});return db[_0x2df3('0x69')][_0x2df3('0x53')]({'where':{'UserId':{'$in':_0x1a0335},'WhatsappQueueId':{'$in':_0x4c721e}},'transaction':_0x100402});})[_0x2df3('0x26')](function(){return db[_0x2df3('0x6a')][_0x2df3('0x48')]({'where':{'TeamId':_0x5c62f4}});})[_0x2df3('0x26')](function(_0x29a6a0){if(_0x29a6a0===null){return;}return db[_0x2df3('0x6b')][_0x2df3('0x53')]({'where':{'UserId':{'$in':_0x1a0335},'VoicePrefixId':_0x29a6a0[_0x2df3('0x6c')]},'transaction':_0x100402});})[_0x2df3('0x26')](function(){return db[_0x2df3('0x2c')][_0x2df3('0x53')]({'where':{'id':_0x5c62f4},'cascade':!![],'transaction':_0x100402});})['then'](function(_0x13340d){if(_0x13340d===0x0){_0x2715a6[_0x2df3('0x1b')](0x194);}else{return db[_0x2df3('0x50')][_0x2df3('0x53')]({'where':{'type':'Teams','resourceId':_0x5c62f4},'cascade':!![],'transaction':_0x100402})[_0x2df3('0x26')](function(){_0x2715a6['status'](0xcc)['end']();});}})[_0x2df3('0x43')](function(_0x1929b8){_0x2715a6[_0x2df3('0x1c')](0x1f4)[_0x2df3('0x29')](_0x1929b8);});});};exports[_0x2df3('0x6d')]=function(_0x2cb5a5,_0x5d02f6,_0x1a0b04){return db[_0x2df3('0x2c')]['findOne']({'where':{'id':_0x2cb5a5['params']['id']}})[_0x2df3('0x26')](handleEntityNotFound(_0x5d02f6,null))['then'](function(_0x3a3ffe){if(!_0x2cb5a5['query']['channel']||!utils[_0x2df3('0x6e')](_0x2cb5a5[_0x2df3('0x31')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x36c1ad={};var _0x4d4ca7={};_0x4d4ca7[_0x2df3('0x34')]=_['keys'](db[_[_0x2df3('0x6f')](_0x2cb5a5[_0x2df3('0x31')][_0x2df3('0x70')][_0x2df3('0x71')]())+_0x2df3('0x72')]['rawAttributes']);_0x4d4ca7['query']=_[_0x2df3('0x73')](_0x2cb5a5['query']);_0x4d4ca7[_0x2df3('0x32')]=_['intersection'](_0x4d4ca7[_0x2df3('0x34')],_0x4d4ca7[_0x2df3('0x31')]);_0x36c1ad['attributes']=_[_0x2df3('0x33')](_0x4d4ca7[_0x2df3('0x34')],qs[_0x2df3('0x36')](_0x2cb5a5[_0x2df3('0x31')][_0x2df3('0x36')]));_0x36c1ad[_0x2df3('0x35')]=_0x36c1ad[_0x2df3('0x35')][_0x2df3('0x37')]?_0x36c1ad[_0x2df3('0x35')]:_0x4d4ca7[_0x2df3('0x34')];_0x36c1ad['limit']=qs[_0x2df3('0x20')](_0x2cb5a5[_0x2df3('0x31')][_0x2df3('0x20')]);_0x36c1ad[_0x2df3('0x1e')]=qs['offset'](_0x2cb5a5[_0x2df3('0x31')][_0x2df3('0x1e')]);_0x36c1ad[_0x2df3('0x3a')]=qs[_0x2df3('0x3b')](_0x2cb5a5['query'][_0x2df3('0x3b')]);_0x36c1ad[_0x2df3('0x3c')]=qs[_0x2df3('0x32')](_[_0x2df3('0x74')](_0x2cb5a5[_0x2df3('0x31')],_0x4d4ca7[_0x2df3('0x32')]));_0x36c1ad=_[_0x2df3('0x47')]({},_0x36c1ad,_0x2cb5a5[_0x2df3('0x3f')]);return _0x3a3ffe[_0x2df3('0x4b')+_[_0x2df3('0x6f')](_0x2cb5a5[_0x2df3('0x31')][_0x2df3('0x70')][_0x2df3('0x71')]())+_0x2df3('0x75')](_0x36c1ad);})['then'](respondWithResult(_0x5d02f6,null))[_0x2df3('0x43')](handleError(_0x5d02f6,null));};exports[_0x2df3('0x76')]=function(_0x2a888f,_0x2c8b5a,_0x11d0e4){return db[_0x2df3('0x2c')]['findOne']({'where':{'id':_0x2a888f[_0x2df3('0x45')]['id']}})[_0x2df3('0x26')](function(_0x402538){if(_0x402538){if(!_0x2a888f[_0x2df3('0x52')][_0x2df3('0x70')]||!utils[_0x2df3('0x6e')](_0x2a888f['body'][_0x2df3('0x70')])){throw new db[(_0x2df3('0x57'))]['ValidationError'](_0x2df3('0x77'));}return _0x402538['add'+_['capitalize'](_0x2a888f['body'][_0x2df3('0x70')][_0x2df3('0x71')]())+'Queues'](_0x2a888f[_0x2df3('0x52')][_0x2df3('0x78')]);}return null;})[_0x2df3('0x26')](handleEntityNotFound(_0x2c8b5a,null))[_0x2df3('0x26')](respondWithStatusCode(_0x2c8b5a,null))['catch'](handleError(_0x2c8b5a,null));};exports[_0x2df3('0x79')]=function(_0x28a8d6,_0xc0311d,_0x1f5db3){return db['Team'][_0x2df3('0x7a')]({'where':{'id':_0x28a8d6['params']['id']}})[_0x2df3('0x26')](function(_0x326536){if(_0x326536){if(!_0x28a8d6[_0x2df3('0x31')][_0x2df3('0x70')]||!utils[_0x2df3('0x6e')](_0x28a8d6['query']['channel'])){throw new db[(_0x2df3('0x57'))][(_0x2df3('0x7b'))](_0x2df3('0x77'));}return _0x326536[_0x2df3('0x7c')+_[_0x2df3('0x6f')](_0x28a8d6[_0x2df3('0x31')]['channel'][_0x2df3('0x71')]())+_0x2df3('0x75')](_0x28a8d6[_0x2df3('0x31')][_0x2df3('0x78')]);}return null;})[_0x2df3('0x26')](handleEntityNotFound(_0xc0311d,null))['then'](respondWithStatusCode(_0xc0311d,null))[_0x2df3('0x43')](handleError(_0xc0311d,null));};exports[_0x2df3('0x7d')]=function(_0x4d02f1,_0x2bc3cf){var _0x310b71=_[_0x2df3('0x7e')](_0x4d02f1[_0x2df3('0x52')][_0x2df3('0x78')])?_0x4d02f1[_0x2df3('0x52')][_0x2df3('0x78')]:[_0x4d02f1[_0x2df3('0x52')][_0x2df3('0x78')]];var _0x33b563=_0x4d02f1['params']['id'];return db[_0x2df3('0x2c')][_0x2df3('0x48')]({'where':{'id':_0x33b563}})['then'](handleEntityNotFound(_0x2bc3cf,null))[_0x2df3('0x26')](function(_0x1f3b21){if(_0x1f3b21){var _0x21dc5e=[_0x2df3('0x7f'),_0x2df3('0x80'),_0x2df3('0x81'),_0x2df3('0x82'),_0x2df3('0x83'),_0x2df3('0x84'),_0x2df3('0x85')];return db[_0x2df3('0x54')][_0x2df3('0x55')](function(_0x36f2bb){var _0x520ff2=_[_0x2df3('0x2b')](_0x21dc5e,function(_0x264790){var _0x1aa447={'attributes':['id',_0x2df3('0x30')]};if(_0x264790===_0x2df3('0x7f')){_0x1aa447['through']={'attributes':[_0x2df3('0x86')]};}return _0x1f3b21[_0x2df3('0x4b')+_0x264790+_0x2df3('0x75')](_0x1aa447)[_0x2df3('0x26')](function(_0x3d41fd){var _0x498465=_[_0x2df3('0x2b')](_0x3d41fd,function(_0x8034ed){var _0x180fcd=_[_0x2df3('0x2b')](_0x310b71,function(_0x3f1299){var _0x14fd9d={'where':{'UserId':_0x3f1299,[_0x264790+_0x2df3('0x87')]:_0x8034ed['id']},'transaction':_0x36f2bb};if(_0x264790===_0x2df3('0x7f')){_0x14fd9d[_0x2df3('0x17')]={'penalty':_0x8034ed[_0x2df3('0x88')][_0x2df3('0x86')]};}return db['User'+_0x264790+_0x2df3('0x72')][_0x2df3('0x89')](_0x14fd9d)['then'](function(){socket[_0x2df3('0x8a')](_0x2df3('0x4a')+_0x264790+_0x2df3('0x8b'),{'UserId':_0x3f1299,[_0x264790+_0x2df3('0x87')]:_0x8034ed['id']});if(_0x264790!=='Voice'){return;}return db[_0x2df3('0x8c')][_0x2df3('0x41')]({'where':{'id':_0x310b71,'online':0x1},'attributes':['id',_0x2df3('0x30'),_0x2df3('0x8d'),_0x2df3('0x8e'),_0x2df3('0x8f')],'raw':!![]})[_0x2df3('0x26')](function(_0x22949b){var _0x4bba9a=_[_0x2df3('0x2b')](_0x22949b,function(_0x1ffc92){return db[_0x2df3('0x90')]['upsert']({'membername':_0x1ffc92[_0x2df3('0x30')],'UserId':_0x1ffc92['id'],'queue_name':_0x8034ed[_0x2df3('0x30')],'VoiceQueueId':_0x8034ed['id'],'interface':_['isNil'](_0x1ffc92[_0x2df3('0x8f')])?util[_0x2df3('0x91')](_0x2df3('0x92'),_0x1ffc92[_0x2df3('0x30')]):_0x1ffc92['interface'],'paused':_0x1ffc92['voicePause']||![],'penalty':_0x8034ed[_0x2df3('0x88')][_0x2df3('0x86')]},{'transaction':_0x36f2bb});});return Promise[_0x2df3('0x93')](_0x4bba9a);});});});return Promise[_0x2df3('0x93')](_0x180fcd);});return Promise[_0x2df3('0x93')](_0x498465);})[_0x2df3('0x26')](function(){return db[_0x2df3('0x6a')]['findOne']({'where':{'teamId':_0x33b563}})[_0x2df3('0x26')](function(_0x2c3b29){if(_0x2c3b29){var _0x54ac10=_[_0x2df3('0x2b')](_0x310b71,function(_0xcd5b41){db[_0x2df3('0x6b')]['upsert']({'UserId':_0xcd5b41,'VoicePrefixId':_0x2c3b29['VoicePrefixId']});});return Promise['all'](_0x54ac10);}});});});return Promise[_0x2df3('0x93')](_0x520ff2)['then'](function(){return _0x1f3b21['addAgents'](_0x310b71,{'transaction':_0x36f2bb})[_0x2df3('0x94')](function(_0x6ac648){return _0x6ac648;});});});}})[_0x2df3('0x26')](respondWithResult(_0x2bc3cf,null))[_0x2df3('0x43')](handleError(_0x2bc3cf,null));};exports['removeAgents']=function(_0x13dcf5,_0x5a6671){var _0x1504ad=_[_0x2df3('0x7e')](_0x13dcf5[_0x2df3('0x31')][_0x2df3('0x78')])?_0x13dcf5[_0x2df3('0x31')]['ids']:[_0x13dcf5[_0x2df3('0x31')]['ids']];var _0x30c29=_0x13dcf5[_0x2df3('0x45')]['id'];return db[_0x2df3('0x2c')][_0x2df3('0x48')]({'where':{'id':_0x30c29}})[_0x2df3('0x26')](handleEntityNotFound(_0x5a6671,null))[_0x2df3('0x26')](function(_0x346e21){if(_0x346e21){var _0x2065e7=[_0x2df3('0x7f'),_0x2df3('0x80'),_0x2df3('0x81'),_0x2df3('0x82'),_0x2df3('0x83'),_0x2df3('0x84'),'Whatsapp'];return db[_0x2df3('0x54')][_0x2df3('0x55')](function(_0x5569c9){var _0x420b0e=_[_0x2df3('0x2b')](_0x2065e7,function(_0x2ae43c){var _0x3d360c={'attributes':['id',_0x2df3('0x30')]};return _0x346e21[_0x2df3('0x4b')+_0x2ae43c+_0x2df3('0x75')](_0x3d360c)[_0x2df3('0x26')](function(_0x5effea){var _0x5efd7f=_[_0x2df3('0x2b')](_0x5effea,function(_0x58a401){return _0x58a401[_0x2df3('0x95')](_0x1504ad,{'transaction':_0x5569c9})['then'](function(){var _0x670739=_[_0x2df3('0x2b')](_0x1504ad,function(_0x2e2d04){socket[_0x2df3('0x8a')](_0x2df3('0x4a')+_0x2ae43c+_0x2df3('0x96'),{'UserId':Number(_0x2e2d04),[_0x2ae43c+_0x2df3('0x87')]:_0x58a401['id']});if(_0x2ae43c!=='Voice'){return;}return db[_0x2df3('0x90')][_0x2df3('0x53')]({'where':{'VoiceQueueId':_0x58a401['id'],'UserId':_0x2e2d04},'transaction':_0x5569c9});});return Promise[_0x2df3('0x93')](_0x670739);});});return Promise['all'](_0x5efd7f);});});return Promise[_0x2df3('0x93')](_0x420b0e)[_0x2df3('0x26')](function(){return _0x346e21[_0x2df3('0x95')](_0x1504ad,{'transaction':_0x5569c9});})[_0x2df3('0x26')](function(){return db[_0x2df3('0x6a')][_0x2df3('0x7a')]({'where':{'teamId':_0x30c29}})[_0x2df3('0x26')](function(_0x11edfd){if(_0x11edfd){var _0x512029=_[_0x2df3('0x2b')](_0x1504ad,function(_0x2836b7){db['UserVoicePrefix'][_0x2df3('0x53')]({'where':{'UserId':_0x2836b7,'VoicePrefixId':_0x11edfd[_0x2df3('0x6c')]}});});return Promise[_0x2df3('0x93')](_0x512029);}});});});}})['then'](respondWithStatusCode(_0x5a6671,null))[_0x2df3('0x43')](handleError(_0x5a6671,null));};exports[_0x2df3('0x97')]=function(_0x1e36be,_0x5a4136,_0x5f55fe){var _0x5dd7a3={};var _0x5131c3={};var _0x294051;var _0xca72c;return db['Team']['findOne']({'where':{'id':_0x1e36be[_0x2df3('0x45')]['id']}})[_0x2df3('0x26')](handleEntityNotFound(_0x5a4136,null))[_0x2df3('0x26')](function(_0x50e26d){if(_0x50e26d){_0x294051=_0x50e26d;_0x5131c3[_0x2df3('0x34')]=_[_0x2df3('0x73')](db['User'][_0x2df3('0x2d')]);_0x5131c3[_0x2df3('0x31')]=_[_0x2df3('0x73')](_0x1e36be[_0x2df3('0x31')]);_0x5131c3[_0x2df3('0x32')]=_[_0x2df3('0x33')](_0x5131c3[_0x2df3('0x34')],_0x5131c3[_0x2df3('0x31')]);_0x5dd7a3['attributes']=_['intersection'](_0x5131c3['model'],qs['fields'](_0x1e36be[_0x2df3('0x31')][_0x2df3('0x36')]));_0x5dd7a3[_0x2df3('0x35')]=_0x5dd7a3['attributes'][_0x2df3('0x37')]?_0x5dd7a3[_0x2df3('0x35')]:_0x5131c3[_0x2df3('0x34')];_0x5dd7a3[_0x2df3('0x3a')]=qs[_0x2df3('0x3b')](_0x1e36be[_0x2df3('0x31')][_0x2df3('0x3b')]);_0x5dd7a3[_0x2df3('0x3c')]=qs[_0x2df3('0x32')](_[_0x2df3('0x74')](_0x1e36be[_0x2df3('0x31')],_0x5131c3['filters']));if(_0x1e36be[_0x2df3('0x31')][_0x2df3('0x3e')]){_0x5dd7a3[_0x2df3('0x3c')]=_[_0x2df3('0x47')](_0x5dd7a3[_0x2df3('0x3c')],{'$or':_[_0x2df3('0x2b')](_0x5dd7a3['attributes'],function(_0x4b6b79){var _0x5bcd57={};_0x5bcd57[_0x4b6b79]={'$like':'%'+_0x1e36be['query'][_0x2df3('0x3e')]+'%'};return _0x5bcd57;})});}_0x5dd7a3=_[_0x2df3('0x47')]({},_0x5dd7a3,_0x1e36be[_0x2df3('0x3f')]);return _0x294051[_0x2df3('0x97')](_0x5dd7a3);}})[_0x2df3('0x26')](function(_0x315679){if(_0x315679){_0xca72c=_0x315679['length'];if(!_0x1e36be[_0x2df3('0x31')][_0x2df3('0x38')](_0x2df3('0x39'))){_0x5dd7a3['limit']=qs[_0x2df3('0x20')](_0x1e36be[_0x2df3('0x31')][_0x2df3('0x20')]);_0x5dd7a3[_0x2df3('0x1e')]=qs[_0x2df3('0x1e')](_0x1e36be[_0x2df3('0x31')][_0x2df3('0x1e')]);}return _0x294051[_0x2df3('0x97')](_0x5dd7a3);}})[_0x2df3('0x26')](function(_0x4c658e){if(_0x4c658e){return _0x4c658e?{'count':_0xca72c,'rows':_0x4c658e}:null;}})[_0x2df3('0x26')](respondWithResult(_0x5a4136,null))[_0x2df3('0x43')](handleError(_0x5a4136,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9c03846..3f78768 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 _0xaff0=['exports','events','../../mysqldb','Team','update','emit','hasOwnProperty'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0xaff0,0xc5));var _0x0aff=function(_0x96994b,_0x163958){_0x96994b=_0x96994b-0x0;var _0x1560f1=_0xaff0[_0x96994b];return _0x1560f1;};'use strict';var EventEmitter=require(_0x0aff('0x0'));var Team=require(_0x0aff('0x1'))['db'][_0x0aff('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0aff('0x3'),'afterDestroy':'remove'};function emitEvent(_0x13e6d6){return function(_0x35b010,_0x3fed46,_0x4f2fde){TeamEvents['emit'](_0x13e6d6+':'+_0x35b010['id'],_0x35b010);TeamEvents[_0x0aff('0x4')](_0x13e6d6,_0x35b010);_0x4f2fde(null);};}for(var e in events){if(events[_0x0aff('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x0aff('0x6')]=TeamEvents; \ No newline at end of file +var _0x384b=['../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2e4cef,_0x4c08f5){var _0x40dc3a=function(_0x3e4041){while(--_0x3e4041){_0x2e4cef['push'](_0x2e4cef['shift']());}};_0x40dc3a(++_0x4c08f5);}(_0x384b,0x77));var _0xb384=function(_0xa664f,_0x5468ab){_0xa664f=_0xa664f-0x0;var _0x5b17c7=_0x384b[_0xa664f];return _0x5b17c7;};'use strict';var EventEmitter=require(_0xb384('0x0'));var Team=require(_0xb384('0x1'))['db'][_0xb384('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb384('0x3')](0x0);var events={'afterCreate':_0xb384('0x4'),'afterUpdate':'update','afterDestroy':_0xb384('0x5')};function emitEvent(_0x1da416){return function(_0x5e2503,_0x4cd091,_0x36fdfe){TeamEvents[_0xb384('0x6')](_0x1da416+':'+_0x5e2503['id'],_0x5e2503);TeamEvents[_0xb384('0x6')](_0x1da416,_0x5e2503);_0x36fdfe(null);};}for(var e in events){if(events[_0xb384('0x7')](e)){var event=events[e];Team[_0xb384('0x8')](e,emitEvent(event));}}module[_0xb384('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 0b7362a..0273d2b 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 _0x6b7f=['Whatsapp','resolve','catch','lodash','./team.attributes','get','Queues','then','map','setDataValue','exports','define','teams','Chat','Fax','Openchannel','Sms','Voice'];(function(_0x504fa8,_0x448235){var _0x2abdf3=function(_0x2a3906){while(--_0x2a3906){_0x504fa8['push'](_0x504fa8['shift']());}};_0x2abdf3(++_0x448235);}(_0x6b7f,0x6f));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6b7('0x0'));var attributes=require(_0xf6b7('0x1'));function getQueuesByChannel(_0x2692cf,_0x3379b0){var _0x52707e=_0xf6b7('0x2')+_0x3379b0+_0xf6b7('0x3');return _0x2692cf[_0x52707e]()[_0xf6b7('0x4')](function(_0x3516c2){return _[_0xf6b7('0x5')](_0x3516c2,function(_0x2ae708){_0x2ae708[_0xf6b7('0x6')]('channel',_0x3379b0);return _0x2ae708;});})['catch'](function(_0x56890c){throw _0x56890c;});}module[_0xf6b7('0x7')]=function(_0x4a0c70){return _0x4a0c70[_0xf6b7('0x8')]('Team',attributes,{'tableName':_0xf6b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x514402=this;var _0x2db7fb=[_0xf6b7('0xa'),_0xf6b7('0xb'),'Mail',_0xf6b7('0xc'),_0xf6b7('0xd'),_0xf6b7('0xe'),_0xf6b7('0xf')];return Promise[_0xf6b7('0x10')]()[_0xf6b7('0x4')](function(){var _0x390cca=_[_0xf6b7('0x5')](_0x2db7fb,function(_0x56acea){return getQueuesByChannel(_0x514402,_0x56acea);});return Promise['all'](_0x390cca);})[_0xf6b7('0x11')](function(_0x3e6744){throw _0x3e6744;});}}});}; \ No newline at end of file +var _0x6c46=['map','setDataValue','channel','exports','Team','teams','Chat','Fax','Mail','Sms','Voice','Whatsapp','all','get','then'];(function(_0x35f978,_0x1b898a){var _0x36988a=function(_0x2e37ca){while(--_0x2e37ca){_0x35f978['push'](_0x35f978['shift']());}};_0x36988a(++_0x1b898a);}(_0x6c46,0x94));var _0x66c4=function(_0x2e292c,_0x5db982){_0x2e292c=_0x2e292c-0x0;var _0x2f7e3e=_0x6c46[_0x2e292c];return _0x2f7e3e;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x5b0303,_0x3844ab){var _0x4723d8=_0x66c4('0x0')+_0x3844ab+'Queues';return _0x5b0303[_0x4723d8]()[_0x66c4('0x1')](function(_0x495fa0){return _[_0x66c4('0x2')](_0x495fa0,function(_0x4f1227){_0x4f1227[_0x66c4('0x3')](_0x66c4('0x4'),_0x3844ab);return _0x4f1227;});})['catch'](function(_0x22996a){throw _0x22996a;});}module[_0x66c4('0x5')]=function(_0x22a3ab){return _0x22a3ab['define'](_0x66c4('0x6'),attributes,{'tableName':_0x66c4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x404270=this;var _0x2c6736=[_0x66c4('0x8'),_0x66c4('0x9'),_0x66c4('0xa'),'Openchannel',_0x66c4('0xb'),_0x66c4('0xc'),_0x66c4('0xd')];return Promise['resolve']()[_0x66c4('0x1')](function(){var _0x2a0f09=_['map'](_0x2c6736,function(_0x15b29a){return getQueuesByChannel(_0x404270,_0x15b29a);});return Promise[_0x66c4('0xe')](_0x2a0f09);})['catch'](function(_0x29f987){throw _0x29f987;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 0f86578..f220f0c 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 _0x61a8=['Team,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xebb85e,_0x7810eb){var _0x118ceb=function(_0x1150a5){while(--_0x1150a5){_0xebb85e['push'](_0xebb85e['shift']());}};_0x118ceb(++_0x7810eb);}(_0x61a8,0x1be));var _0x861a=function(_0x5ed5e4,_0x15d7fc){_0x5ed5e4=_0x5ed5e4-0x0;var _0xcc956a=_0x61a8[_0x5ed5e4];return _0xcc956a;};'use strict';var _=require('lodash');var util=require(_0x861a('0x0'));var moment=require(_0x861a('0x1'));var BPromise=require('bluebird');var rs=require(_0x861a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x861a('0x3'))['db'];var utils=require(_0x861a('0x4'));var logger=require(_0x861a('0x5'))('rpc');var config=require(_0x861a('0x6'));var jayson=require(_0x861a('0x7'));var client=jayson[_0x861a('0x8')][_0x861a('0x9')]({'port':0x232a});config[_0x861a('0xa')]=_['defaults'](config['redis'],{'host':_0x861a('0xb'),'port':0x18eb});var socket=require(_0x861a('0xc'))(new Redis(config[_0x861a('0xa')]));require('./team.socket')[_0x861a('0xd')](socket);function respondWithRpcPromise(_0x15b0d9,_0x1c35cd,_0x3d6b79){return new BPromise(function(_0x3b65c7,_0x34e3ce){return client['request'](_0x15b0d9,_0x3d6b79)[_0x861a('0xe')](function(_0x4908cc){logger[_0x861a('0xf')]('Team,\x20%s,\x20%s',_0x1c35cd,_0x861a('0x10'));logger[_0x861a('0x11')](_0x861a('0x12'),_0x1c35cd,'request\x20sent',JSON[_0x861a('0x13')](_0x4908cc));if(_0x4908cc[_0x861a('0x14')]){if(_0x4908cc[_0x861a('0x14')][_0x861a('0x15')]===0x1f4){logger['error'](_0x861a('0x16'),_0x1c35cd,_0x4908cc[_0x861a('0x14')][_0x861a('0x17')]);return _0x34e3ce(_0x4908cc['error'][_0x861a('0x17')]);}logger[_0x861a('0x14')](_0x861a('0x16'),_0x1c35cd,_0x4908cc[_0x861a('0x14')][_0x861a('0x17')]);return _0x3b65c7(_0x4908cc[_0x861a('0x14')]['message']);}else{logger[_0x861a('0xf')](_0x861a('0x16'),_0x1c35cd,_0x861a('0x10'));_0x3b65c7(_0x4908cc[_0x861a('0x18')][_0x861a('0x17')]);}})[_0x861a('0x19')](function(_0xdcb2dd){logger['error'](_0x861a('0x16'),_0x1c35cd,_0xdcb2dd);_0x34e3ce(_0xdcb2dd);});});} \ No newline at end of file +var _0xf95d=['./team.socket','register','request','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x34f9a6,_0x4bf60b){var _0x5a94a2=function(_0x12e12a){while(--_0x12e12a){_0x34f9a6['push'](_0x34f9a6['shift']());}};_0x5a94a2(++_0x4bf60b);}(_0xf95d,0x81));var _0xdf95=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xf95d[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xdf95('0x0'));var util=require('util');var moment=require(_0xdf95('0x1'));var BPromise=require(_0xdf95('0x2'));var rs=require(_0xdf95('0x3'));var fs=require('fs');var Redis=require(_0xdf95('0x4'));var db=require(_0xdf95('0x5'))['db'];var utils=require(_0xdf95('0x6'));var logger=require(_0xdf95('0x7'))(_0xdf95('0x8'));var config=require(_0xdf95('0x9'));var jayson=require(_0xdf95('0xa'));var client=jayson[_0xdf95('0xb')]['http']({'port':0x232a});config[_0xdf95('0xc')]=_[_0xdf95('0xd')](config['redis'],{'host':_0xdf95('0xe'),'port':0x18eb});var socket=require(_0xdf95('0xf'))(new Redis(config['redis']));require(_0xdf95('0x10'))[_0xdf95('0x11')](socket);function respondWithRpcPromise(_0x18e64b,_0x5145d6,_0x3412b1){return new BPromise(function(_0x1655ee,_0x345c76){return client[_0xdf95('0x12')](_0x18e64b,_0x3412b1)['then'](function(_0x2171cc){logger[_0xdf95('0x13')](_0xdf95('0x14'),_0x5145d6,'request\x20sent');logger[_0xdf95('0x15')](_0xdf95('0x16'),_0x5145d6,_0xdf95('0x17'),JSON[_0xdf95('0x18')](_0x2171cc));if(_0x2171cc[_0xdf95('0x19')]){if(_0x2171cc[_0xdf95('0x19')]['code']===0x1f4){logger[_0xdf95('0x19')]('Team,\x20%s,\x20%s',_0x5145d6,_0x2171cc[_0xdf95('0x19')][_0xdf95('0x1a')]);return _0x345c76(_0x2171cc[_0xdf95('0x19')][_0xdf95('0x1a')]);}logger[_0xdf95('0x19')](_0xdf95('0x14'),_0x5145d6,_0x2171cc['error'][_0xdf95('0x1a')]);return _0x1655ee(_0x2171cc[_0xdf95('0x19')][_0xdf95('0x1a')]);}else{logger[_0xdf95('0x13')]('Team,\x20%s,\x20%s',_0x5145d6,_0xdf95('0x17'));_0x1655ee(_0x2171cc[_0xdf95('0x1b')][_0xdf95('0x1a')]);}})[_0xdf95('0x1c')](function(_0x522ade){logger[_0xdf95('0x19')](_0xdf95('0x14'),_0x5145d6,_0x522ade);_0x345c76(_0x522ade);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 79098ad..88616a0 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 _0x7759=['update','emit','team:','./team.events','remove'];(function(_0x1f0ab2,_0x368d5c){var _0x59f8db=function(_0x7ef738){while(--_0x7ef738){_0x1f0ab2['push'](_0x1f0ab2['shift']());}};_0x59f8db(++_0x368d5c);}(_0x7759,0x143));var _0x9775=function(_0x4e37bc,_0x8df15){_0x4e37bc=_0x4e37bc-0x0;var _0xab5db5=_0x7759[_0x4e37bc];return _0xab5db5;};'use strict';var TeamEvents=require(_0x9775('0x0'));var events=['save',_0x9775('0x1'),_0x9775('0x2')];function createListener(_0xc378ca,_0x132956){return function(_0x21c74e){_0x132956[_0x9775('0x3')](_0xc378ca,_0x21c74e);};}function removeListener(_0x421ea7,_0x3e358a){return function(){TeamEvents['removeListener'](_0x421ea7,_0x3e358a);};}exports['register']=function(_0x2543f1){for(var _0x540bb3=0x0,_0x249a09=events['length'];_0x540bb3<_0x249a09;_0x540bb3++){var _0x49c873=events[_0x540bb3];var _0x32786c=createListener(_0x9775('0x4')+_0x49c873,_0x2543f1);TeamEvents['on'](_0x49c873,_0x32786c);}}; \ No newline at end of file +var _0xbd99=['save','update','emit','removeListener','register','length','team:','./team.events'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xbd99,0x1df));var _0x9bd9=function(_0xa6271,_0x3e9ce1){_0xa6271=_0xa6271-0x0;var _0x4fbc16=_0xbd99[_0xa6271];return _0x4fbc16;};'use strict';var TeamEvents=require(_0x9bd9('0x0'));var events=[_0x9bd9('0x1'),'remove',_0x9bd9('0x2')];function createListener(_0x2fbc9d,_0x5d50d9){return function(_0x8b7dff){_0x5d50d9[_0x9bd9('0x3')](_0x2fbc9d,_0x8b7dff);};}function removeListener(_0x1369ea,_0x25acc7){return function(){TeamEvents[_0x9bd9('0x4')](_0x1369ea,_0x25acc7);};}exports[_0x9bd9('0x5')]=function(_0x111a1c){for(var _0x4be10e=0x0,_0x3b41ea=events[_0x9bd9('0x6')];_0x4be10e<_0x3b41ea;_0x4be10e++){var _0x28b83f=events[_0x4be10e];var _0x7ddd62=createListener(_0x9bd9('0x7')+_0x28b83f,_0x111a1c);TeamEvents['on'](_0x28b83f,_0x7ddd62);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index a4d0912..2f297de 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 _0x6599=['exports','INTEGER'];(function(_0x268b2f,_0x563089){var _0x4e308f=function(_0x4fefd2){while(--_0x4fefd2){_0x268b2f['push'](_0x268b2f['shift']());}};_0x4e308f(++_0x563089);}(_0x6599,0xb0));var _0x9659=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x6599[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require('sequelize');module[_0x9659('0x0')]={'TeamId':{'type':Sequelize[_0x9659('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x9659('0x1')]}}; \ No newline at end of file +var _0xdeb3=['INTEGER','sequelize','exports'];(function(_0x5d2bc4,_0x50e2f2){var _0x3ebbc1=function(_0x389495){while(--_0x389495){_0x5d2bc4['push'](_0x5d2bc4['shift']());}};_0x3ebbc1(++_0x50e2f2);}(_0xdeb3,0xeb));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x3deb('0x0'));module[_0x3deb('0x1')]={'TeamId':{'type':Sequelize[_0x3deb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3deb('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 8233bf7..b068937 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 _0x88a6=['TeamVoicePrefix','util','../../config/logger','moment','bluebird','request-promise','path','./teamVoicePrefix.attributes','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x88a6,0x121));var _0x688a=function(_0x3e4e06,_0x577430){_0x3e4e06=_0x3e4e06-0x0;var _0x58e857=_0x88a6[_0x3e4e06];return _0x58e857;};'use strict';var _=require('lodash');var util=require(_0x688a('0x0'));var logger=require(_0x688a('0x1'))('api');var moment=require(_0x688a('0x2'));var BPromise=require(_0x688a('0x3'));var rp=require(_0x688a('0x4'));var fs=require('fs');var path=require(_0x688a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x688a('0x6'));module['exports']=function(_0x1743a3,_0x357896){return _0x1743a3[_0x688a('0x7')](_0x688a('0x8'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98d8=['moment','bluebird','request-promise','../../config/environment','define','team_has_voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x76bd2d,_0x1404b3){var _0x26b0b4=function(_0x3a5ec5){while(--_0x3a5ec5){_0x76bd2d['push'](_0x76bd2d['shift']());}};_0x26b0b4(++_0x1404b3);}(_0x98d8,0xce));var _0x898d=function(_0x1c6664,_0x45566e){_0x1c6664=_0x1c6664-0x0;var _0x33124b=_0x98d8[_0x1c6664];return _0x33124b;};'use strict';var _=require(_0x898d('0x0'));var util=require(_0x898d('0x1'));var logger=require(_0x898d('0x2'))(_0x898d('0x3'));var moment=require(_0x898d('0x4'));var BPromise=require(_0x898d('0x5'));var rp=require(_0x898d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x898d('0x7'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x4047bd,_0x5215bf){return _0x4047bd[_0x898d('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x898d('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 7b700a2..ae130f2 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x291d47,_0x20086b){var _0x2cb6ae=function(_0x5bb555){while(--_0x5bb555){_0x291d47['push'](_0x291d47['shift']());}};_0x2cb6ae(++_0x20086b);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2fb2cc,_0x257bb2){var _0x184bef=function(_0x11093c){while(--_0x11093c){_0x2fb2cc['push'](_0x2fb2cc['shift']());}};_0x184bef(++_0x257bb2);}(_0xedd9,0xfc));var _0x9edd=function(_0x13549a,_0x372ca0){_0x13549a=_0x13549a-0x0;var _0x168e50=_0xedd9[_0x13549a];return _0x168e50;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index e4754c1..3384cdf 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 _0x634a=['exports','INTEGER','sequelize'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0x634a,0x17f));var _0xa634=function(_0x208ce7,_0x2c8d79){_0x208ce7=_0x208ce7-0x0;var _0x68a2c4=_0x634a[_0x208ce7];return _0x68a2c4;};'use strict';var Sequelize=require(_0xa634('0x0'));module[_0xa634('0x1')]={'penalty':{'type':Sequelize[_0xa634('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20e2=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20e2,0x8b));var _0x220e=function(_0x5560fe,_0x5454f8){_0x5560fe=_0x5560fe-0x0;var _0x41ad9f=_0x20e2[_0x5560fe];return _0x41ad9f;};'use strict';var Sequelize=require(_0x220e('0x0'));module[_0x220e('0x1')]={'penalty':{'type':Sequelize[_0x220e('0x2')],'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 3fbf4ca..c1019c6 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 _0xb38e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','team_has_voice_queues','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb38e,0xa7));var _0xeb38=function(_0x17002e,_0x5d36d6){_0x17002e=_0x17002e-0x0;var _0x17b3c0=_0xb38e[_0x17002e];return _0x17b3c0;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var logger=require(_0xeb38('0x2'))(_0xeb38('0x3'));var moment=require(_0xeb38('0x4'));var BPromise=require(_0xeb38('0x5'));var rp=require(_0xeb38('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb38('0x7'));var config=require(_0xeb38('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0xeb38('0x9')]=function(_0xd3e5dc,_0x28e501){return _0xd3e5dc[_0xeb38('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0xeb38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3613=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues'];(function(_0x2bb441,_0x1957ae){var _0x26f916=function(_0x3946a3){while(--_0x3946a3){_0x2bb441['push'](_0x2bb441['shift']());}};_0x26f916(++_0x1957ae);}(_0x3613,0x198));var _0x3361=function(_0x382541,_0x3f07ed){_0x382541=_0x382541-0x0;var _0x10f6f0=_0x3613[_0x382541];return _0x10f6f0;};'use strict';var _=require(_0x3361('0x0'));var util=require(_0x3361('0x1'));var logger=require(_0x3361('0x2'))(_0x3361('0x3'));var moment=require(_0x3361('0x4'));var BPromise=require(_0x3361('0x5'));var rp=require(_0x3361('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3361('0x7'));var config=require('../../config/environment');var attributes=require(_0x3361('0x8'));module[_0x3361('0x9')]=function(_0xa1bc1b,_0x2e2d6c){return _0xa1bc1b[_0x3361('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x3361('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 10708be..c9e988a 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 _0x8ccb=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','TeamVoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','randomstring'];(function(_0x4d993a,_0x150d3c){var _0x5a004e=function(_0x2e3abc){while(--_0x2e3abc){_0x4d993a['push'](_0x4d993a['shift']());}};_0x5a004e(++_0x150d3c);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x8ccb[_0x4ea6af];return _0x4cb1e6;};'use strict';var _=require(_0xb8cc('0x0'));var util=require(_0xb8cc('0x1'));var moment=require('moment');var BPromise=require(_0xb8cc('0x2'));var rs=require(_0xb8cc('0x3'));var fs=require('fs');var Redis=require(_0xb8cc('0x4'));var db=require(_0xb8cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8cc('0x6'));var config=require(_0xb8cc('0x7'));var jayson=require(_0xb8cc('0x8'));var client=jayson['client'][_0xb8cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349552,_0x139945,_0x56951f){return new BPromise(function(_0x35c86d,_0x2c338f){return client[_0xb8cc('0xa')](_0x349552,_0x56951f)['then'](function(_0x175473){logger[_0xb8cc('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,'request\x20sent');logger[_0xb8cc('0xc')](_0xb8cc('0xd'),_0x139945,'request\x20sent',JSON['stringify'](_0x175473));if(_0x175473[_0xb8cc('0xe')]){if(_0x175473[_0xb8cc('0xe')]['code']===0x1f4){logger[_0xb8cc('0xe')](_0xb8cc('0xf'),_0x139945,_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);return _0x2c338f(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}logger[_0xb8cc('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,_0x175473[_0xb8cc('0xe')]['message']);return _0x35c86d(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}else{logger[_0xb8cc('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,_0xb8cc('0x11'));_0x35c86d(_0x175473[_0xb8cc('0x12')][_0xb8cc('0x10')]);}})['catch'](function(_0x2ba498){logger['error'](_0xb8cc('0xf'),_0x139945,_0x2ba498);_0x2c338f(_0x2ba498);});});} \ No newline at end of file +var _0x9ff7=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','catch'];(function(_0x2ee790,_0x5a8661){var _0x5a54a5=function(_0x2713a4){while(--_0x2713a4){_0x2ee790['push'](_0x2ee790['shift']());}};_0x5a54a5(++_0x5a8661);}(_0x9ff7,0x8c));var _0x79ff=function(_0x34b827,_0x3a91e0){_0x34b827=_0x34b827-0x0;var _0x27b2a5=_0x9ff7[_0x34b827];return _0x27b2a5;};'use strict';var _=require(_0x79ff('0x0'));var util=require(_0x79ff('0x1'));var moment=require('moment');var BPromise=require(_0x79ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79ff('0x3'));var db=require(_0x79ff('0x4'))['db'];var utils=require(_0x79ff('0x5'));var logger=require(_0x79ff('0x6'))(_0x79ff('0x7'));var config=require(_0x79ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x79ff('0x9')][_0x79ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f8f8c,_0x5583e1,_0x16a050){return new BPromise(function(_0x5e6846,_0x25a9db){return client[_0x79ff('0xb')](_0x4f8f8c,_0x16a050)['then'](function(_0x47956e){logger[_0x79ff('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5583e1,_0x79ff('0xd'));logger[_0x79ff('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5583e1,_0x79ff('0xd'),JSON['stringify'](_0x47956e));if(_0x47956e[_0x79ff('0xf')]){if(_0x47956e[_0x79ff('0xf')][_0x79ff('0x10')]===0x1f4){logger[_0x79ff('0xf')](_0x79ff('0x11'),_0x5583e1,_0x47956e[_0x79ff('0xf')][_0x79ff('0x12')]);return _0x25a9db(_0x47956e[_0x79ff('0xf')][_0x79ff('0x12')]);}logger['error'](_0x79ff('0x11'),_0x5583e1,_0x47956e[_0x79ff('0xf')][_0x79ff('0x12')]);return _0x5e6846(_0x47956e[_0x79ff('0xf')][_0x79ff('0x12')]);}else{logger[_0x79ff('0xc')](_0x79ff('0x11'),_0x5583e1,_0x79ff('0xd'));_0x5e6846(_0x47956e['result'][_0x79ff('0x12')]);}})[_0x79ff('0x13')](function(_0x5851fd){logger[_0x79ff('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5583e1,_0x5851fd);_0x25a9db(_0x5851fd);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f6914df..fcacdc4 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 _0xc5c8=['../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','post','update','destroy','multer','util','path','express','../../components/auth/service'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc5c8,0x118));var _0x8c5c=function(_0x27af3b,_0x137570){_0x27af3b=_0x27af3b-0x0;var _0x1e4b81=_0xc5c8[_0x27af3b];return _0x1e4b81;};'use strict';var multer=require(_0x8c5c('0x0'));var util=require(_0x8c5c('0x1'));var path=require(_0x8c5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c5c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8c5c('0x4'));var interaction=require(_0x8c5c('0x5'));var config=require('../../config/environment');var controller=require(_0x8c5c('0x6'));router[_0x8c5c('0x7')]('/',auth[_0x8c5c('0x8')](),controller[_0x8c5c('0x9')]);router[_0x8c5c('0x7')](_0x8c5c('0xa'),auth[_0x8c5c('0x8')](),controller[_0x8c5c('0xb')]);router[_0x8c5c('0xc')]('/',auth[_0x8c5c('0x8')](),controller['create']);router['put']('/:id',auth[_0x8c5c('0x8')](),controller[_0x8c5c('0xd')]);router['delete']('/:id',auth[_0x8c5c('0x8')](),controller[_0x8c5c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5eef=['update','delete','destroy','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','show','post','isAuthenticated','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5eef,0x9c));var _0xf5ee=function(_0x13981c,_0xb249e1){_0x13981c=_0x13981c-0x0;var _0x59d65d=_0x5eef[_0x13981c];return _0x59d65d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5ee('0x0'));var timeout=require('connect-timeout');var express=require(_0xf5ee('0x1'));var router=express['Router']();var fs_extra=require(_0xf5ee('0x2'));var auth=require(_0xf5ee('0x3'));var interaction=require(_0xf5ee('0x4'));var config=require(_0xf5ee('0x5'));var controller=require(_0xf5ee('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf5ee('0x7')](_0xf5ee('0x8'),auth['isAuthenticated'](),controller[_0xf5ee('0x9')]);router[_0xf5ee('0xa')]('/',auth[_0xf5ee('0xb')](),controller[_0xf5ee('0xc')]);router[_0xf5ee('0xd')](_0xf5ee('0x8'),auth[_0xf5ee('0xb')](),controller[_0xf5ee('0xe')]);router[_0xf5ee('0xf')](_0xf5ee('0x8'),auth['isAuthenticated'](),controller[_0xf5ee('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ff34d43..c276e0a 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 _0x2b7d=['TEXT','sequelize','STRING'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x2b7d,0x163));var _0xd2b7=function(_0x5843d2,_0x121877){_0x5843d2=_0x5843d2-0x0;var _0x6dd37=_0x2b7d[_0x5843d2];return _0x6dd37;};'use strict';var Sequelize=require(_0xd2b7('0x0'));module['exports']={'name':{'type':Sequelize[_0xd2b7('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xd2b7('0x2')]}}; \ No newline at end of file +var _0x0699=['sequelize','STRING','TEXT'];(function(_0x1c8c39,_0x2f415d){var _0x202bfe=function(_0x1c0d78){while(--_0x1c0d78){_0x1c8c39['push'](_0x1c8c39['shift']());}};_0x202bfe(++_0x2f415d);}(_0x0699,0x14d));var _0x9069=function(_0x42fb11,_0x5a2fc5){_0x42fb11=_0x42fb11-0x0;var _0x398b22=_0x0699[_0x42fb11];return _0x398b22;};'use strict';var Sequelize=require(_0x9069('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9069('0x1')]},'html':{'type':Sequelize[_0x9069('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 20cbc78..77a8b06 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 _0x5932=['eml-format','rimraf','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/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','Templates','end','sendStatus','stack','name','send','index','map','Template','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4323be,_0x4127a9){var _0x51e495=function(_0x12208c){while(--_0x12208c){_0x4323be['push'](_0x4323be['shift']());}};_0x51e495(++_0x4127a9);}(_0x5932,0xb0));var _0x2593=function(_0x783771,_0xc3eb12){_0x783771=_0x783771-0x0;var _0x205546=_0x5932[_0x783771];return _0x205546;};'use strict';var emlformat=require(_0x2593('0x0'));var rimraf=require(_0x2593('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2593('0x2'));var rp=require(_0x2593('0x3'));var moment=require(_0x2593('0x4'));var BPromise=require(_0x2593('0x5'));var Mustache=require('mustache');var util=require(_0x2593('0x6'));var path=require(_0x2593('0x7'));var sox=require(_0x2593('0x8'));var csv=require('to-csv');var ejs=require(_0x2593('0x9'));var fs=require('fs');var fs_extra=require(_0x2593('0xa'));var _=require(_0x2593('0xb'));var squel=require(_0x2593('0xc'));var crypto=require('crypto');var jsforce=require(_0x2593('0xd'));var deskjs=require(_0x2593('0xe'));var toCsv=require(_0x2593('0xf'));var querystring=require(_0x2593('0x10'));var Papa=require(_0x2593('0x11'));var Redis=require(_0x2593('0x12'));var authService=require(_0x2593('0x13'));var qs=require(_0x2593('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2593('0x15'));var logger=require(_0x2593('0x16'))(_0x2593('0x17'));var utils=require(_0x2593('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2593('0x19'));var db=require(_0x2593('0x1a'))['db'];function respondWithStatusCode(_0xd46267,_0x1752b0){_0x1752b0=_0x1752b0||0xcc;return function(_0x4882f6){if(_0x4882f6){return _0xd46267['sendStatus'](_0x1752b0);}return _0xd46267[_0x2593('0x1b')](_0x1752b0)['end']();};}function respondWithResult(_0x323d9f,_0x39b848){_0x39b848=_0x39b848||0xc8;return function(_0xaf3033){if(_0xaf3033){return _0x323d9f[_0x2593('0x1b')](_0x39b848)[_0x2593('0x1c')](_0xaf3033);}};}function respondWithFilteredResult(_0x4ea280,_0x3201b7){return function(_0x53f2b5){if(_0x53f2b5){var _0x582781=typeof _0x3201b7['offset']===_0x2593('0x1d')&&typeof _0x3201b7[_0x2593('0x1e')]===_0x2593('0x1d');var _0x284b0b=_0x53f2b5[_0x2593('0x1f')];var _0x288f47=_0x582781?0x0:_0x3201b7[_0x2593('0x20')];var _0x40401d=_0x582781?_0x53f2b5['count']:_0x3201b7[_0x2593('0x20')]+_0x3201b7[_0x2593('0x1e')];var _0x1c9c66;if(_0x40401d>=_0x284b0b){_0x40401d=_0x284b0b;_0x1c9c66=0xc8;}else{_0x1c9c66=0xce;}_0x4ea280[_0x2593('0x1b')](_0x1c9c66);return _0x4ea280[_0x2593('0x21')]('Content-Range',_0x288f47+'-'+_0x40401d+'/'+_0x284b0b)['json'](_0x53f2b5);}return null;};}function patchUpdates(_0x3ad946){return function(_0x2d486c){try{jsonpatch[_0x2593('0x22')](_0x2d486c,_0x3ad946,!![]);}catch(_0x3127d0){return BPromise[_0x2593('0x23')](_0x3127d0);}return _0x2d486c[_0x2593('0x24')]();};}function saveUpdates(_0xb49954,_0x3dff65){return function(_0x3883f9){if(_0x3883f9){return _0x3883f9[_0x2593('0x25')](_0xb49954)[_0x2593('0x26')](function(_0x2675e6){return _0x2675e6;});}return null;};}function removeEntity(_0x20c2b4,_0x3d6c36){return function(_0xa9a8f5){if(_0xa9a8f5){return _0xa9a8f5[_0x2593('0x27')]()[_0x2593('0x26')](function(){var _0x47b28f=_0xa9a8f5['get']({'plain':!![]});var _0x20f392=_0x2593('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x20f392,'resourceId':_0x47b28f['id']}})[_0x2593('0x26')](function(){return _0xa9a8f5;});})[_0x2593('0x26')](function(){_0x20c2b4[_0x2593('0x1b')](0xcc)[_0x2593('0x29')]();});}};}function handleEntityNotFound(_0x498447,_0x3a6a74){return function(_0x406512){if(!_0x406512){_0x498447[_0x2593('0x2a')](0x194);}return _0x406512;};}function handleError(_0x24632a,_0x8271e4){_0x8271e4=_0x8271e4||0x1f4;return function(_0x16ce38){logger['error'](_0x16ce38[_0x2593('0x2b')]);if(_0x16ce38[_0x2593('0x2c')]){delete _0x16ce38[_0x2593('0x2c')];}_0x24632a[_0x2593('0x1b')](_0x8271e4)[_0x2593('0x2d')](_0x16ce38);};}exports[_0x2593('0x2e')]=function(_0x1fe73b,_0x2cf76a){var _0x2a31a5={},_0x581fae={},_0xc4466f={'count':0x0,'rows':[]};var _0x1949c2=_[_0x2593('0x2f')](db[_0x2593('0x30')]['rawAttributes'],function(_0xe2441e){return{'name':_0xe2441e[_0x2593('0x31')],'type':_0xe2441e[_0x2593('0x32')]['key']};});_0x581fae[_0x2593('0x33')]=_['map'](_0x1949c2,_0x2593('0x2c'));_0x581fae[_0x2593('0x34')]=_['keys'](_0x1fe73b[_0x2593('0x34')]);_0x581fae[_0x2593('0x35')]=_[_0x2593('0x36')](_0x581fae['model'],_0x581fae[_0x2593('0x34')]);_0x2a31a5[_0x2593('0x37')]=_[_0x2593('0x36')](_0x581fae[_0x2593('0x33')],qs[_0x2593('0x38')](_0x1fe73b['query']['fields']));_0x2a31a5[_0x2593('0x37')]=_0x2a31a5[_0x2593('0x37')][_0x2593('0x39')]?_0x2a31a5[_0x2593('0x37')]:_0x581fae['model'];if(!_0x1fe73b[_0x2593('0x34')][_0x2593('0x3a')](_0x2593('0x3b'))){_0x2a31a5[_0x2593('0x1e')]=qs[_0x2593('0x1e')](_0x1fe73b[_0x2593('0x34')][_0x2593('0x1e')]);_0x2a31a5[_0x2593('0x20')]=qs[_0x2593('0x20')](_0x1fe73b[_0x2593('0x34')][_0x2593('0x20')]);}_0x2a31a5[_0x2593('0x3c')]=qs['sort'](_0x1fe73b[_0x2593('0x34')][_0x2593('0x3d')]);_0x2a31a5[_0x2593('0x3e')]=qs[_0x2593('0x35')](_[_0x2593('0x3f')](_0x1fe73b['query'],_0x581fae['filters']),_0x1949c2);if(_0x1fe73b[_0x2593('0x34')][_0x2593('0x40')]){_0x2a31a5['where']=_['merge'](_0x2a31a5[_0x2593('0x3e')],{'$or':_[_0x2593('0x2f')](_0x1949c2,function(_0x152bfb){if(_0x152bfb[_0x2593('0x32')]!==_0x2593('0x41')){var _0x4f1c05={};_0x4f1c05[_0x152bfb[_0x2593('0x2c')]]={'$like':'%'+_0x1fe73b[_0x2593('0x34')]['filter']+'%'};return _0x4f1c05;}})});}_0x2a31a5=_[_0x2593('0x42')]({},_0x2a31a5,_0x1fe73b['options']);var _0x1e9eb4={'where':_0x2a31a5[_0x2593('0x3e')]};return db[_0x2593('0x30')]['count'](_0x1e9eb4)[_0x2593('0x26')](function(_0x5a0f2f){_0xc4466f[_0x2593('0x1f')]=_0x5a0f2f;if(_0x1fe73b['query'][_0x2593('0x43')]){_0x2a31a5[_0x2593('0x44')]=[{'all':!![]}];}return db[_0x2593('0x30')][_0x2593('0x45')](_0x2a31a5);})['then'](function(_0x23baf8){_0xc4466f[_0x2593('0x46')]=_0x23baf8;return _0xc4466f;})['then'](respondWithFilteredResult(_0x2cf76a,_0x2a31a5))[_0x2593('0x47')](handleError(_0x2cf76a,null));};exports[_0x2593('0x48')]=function(_0x5bbcd8,_0x4a05bf){var _0x24a791={'raw':!![],'where':{'id':_0x5bbcd8[_0x2593('0x49')]['id']}},_0x25f251={};_0x25f251[_0x2593('0x33')]=_[_0x2593('0x4a')](db[_0x2593('0x30')][_0x2593('0x4b')]);_0x25f251[_0x2593('0x34')]=_[_0x2593('0x4a')](_0x5bbcd8['query']);_0x25f251[_0x2593('0x35')]=_[_0x2593('0x36')](_0x25f251['model'],_0x25f251['query']);_0x24a791[_0x2593('0x37')]=_[_0x2593('0x36')](_0x25f251[_0x2593('0x33')],qs[_0x2593('0x38')](_0x5bbcd8[_0x2593('0x34')]['fields']));_0x24a791['attributes']=_0x24a791[_0x2593('0x37')][_0x2593('0x39')]?_0x24a791[_0x2593('0x37')]:_0x25f251[_0x2593('0x33')];if(_0x5bbcd8[_0x2593('0x34')]['includeAll']){_0x24a791[_0x2593('0x44')]=[{'all':!![]}];}_0x24a791=_[_0x2593('0x42')]({},_0x24a791,_0x5bbcd8[_0x2593('0x4c')]);return db[_0x2593('0x30')][_0x2593('0x4d')](_0x24a791)[_0x2593('0x26')](handleEntityNotFound(_0x4a05bf,null))[_0x2593('0x26')](respondWithResult(_0x4a05bf,null))[_0x2593('0x47')](handleError(_0x4a05bf,null));};exports['create']=function(_0x22fcb3,_0x2b29f1){return db['Template'][_0x2593('0x4e')](_0x22fcb3[_0x2593('0x4f')],{})[_0x2593('0x26')](function(_0x22165b){var _0x462088=_0x22fcb3['user'][_0x2593('0x50')]({'plain':!![]});if(!_0x462088)throw new Error(_0x2593('0x51'));if(_0x462088['role']===_0x2593('0x52')){var _0x202d47=_0x22165b[_0x2593('0x50')]({'plain':!![]});var _0x3208ee='Templates';return db[_0x2593('0x53')]['find']({'where':{'name':_0x3208ee,'userProfileId':_0x462088[_0x2593('0x54')]},'raw':!![]})[_0x2593('0x26')](function(_0x5d675f){if(_0x5d675f&&_0x5d675f[_0x2593('0x55')]===0x0){return db['UserProfileResource'][_0x2593('0x4e')]({'name':_0x202d47[_0x2593('0x2c')],'resourceId':_0x202d47['id'],'type':_0x5d675f[_0x2593('0x2c')],'sectionId':_0x5d675f['id']},{})['then'](function(){return _0x22165b;});}else{return _0x22165b;}})['catch'](function(_0x33b3c5){logger[_0x2593('0x56')](_0x2593('0x57'),_0x33b3c5);throw _0x33b3c5;});}return _0x22165b;})[_0x2593('0x26')](respondWithResult(_0x2b29f1,0xc9))['catch'](handleError(_0x2b29f1,null));};exports[_0x2593('0x25')]=function(_0x2e40f4,_0x5d3739){if(_0x2e40f4['body']['id']){delete _0x2e40f4[_0x2593('0x4f')]['id'];}return db[_0x2593('0x30')][_0x2593('0x4d')]({'where':{'id':_0x2e40f4[_0x2593('0x49')]['id']}})[_0x2593('0x26')](handleEntityNotFound(_0x5d3739,null))[_0x2593('0x26')](saveUpdates(_0x2e40f4[_0x2593('0x4f')],null))[_0x2593('0x26')](respondWithResult(_0x5d3739,null))[_0x2593('0x47')](handleError(_0x5d3739,null));};exports[_0x2593('0x27')]=function(_0x172a9d,_0x10fce3){return db['Template'][_0x2593('0x4d')]({'where':{'id':_0x172a9d['params']['id']}})['then'](handleEntityNotFound(_0x10fce3,null))['then'](removeEntity(_0x10fce3,null))[_0x2593('0x47')](handleError(_0x10fce3,null));}; \ No newline at end of file +var _0x9f38=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name','send','index','map','Template','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','rawAttributes','create'];(function(_0x5b9030,_0x178a3e){var _0x3708ff=function(_0x232e5f){while(--_0x232e5f){_0x5b9030['push'](_0x5b9030['shift']());}};_0x3708ff(++_0x178a3e);}(_0x9f38,0x153));var _0x89f3=function(_0x1f87c4,_0x4bc99f){_0x1f87c4=_0x1f87c4-0x0;var _0x4cd2e4=_0x9f38[_0x1f87c4];return _0x4cd2e4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x89f3('0x0'));var jsonpatch=require(_0x89f3('0x1'));var rp=require(_0x89f3('0x2'));var moment=require('moment');var BPromise=require(_0x89f3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x89f3('0x4'));var sox=require(_0x89f3('0x5'));var csv=require(_0x89f3('0x6'));var ejs=require(_0x89f3('0x7'));var fs=require('fs');var fs_extra=require(_0x89f3('0x8'));var _=require(_0x89f3('0x9'));var squel=require(_0x89f3('0xa'));var crypto=require('crypto');var jsforce=require(_0x89f3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x89f3('0xc'));var Papa=require(_0x89f3('0xd'));var Redis=require(_0x89f3('0xe'));var authService=require(_0x89f3('0xf'));var qs=require(_0x89f3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89f3('0x11'));var logger=require(_0x89f3('0x12'))(_0x89f3('0x13'));var utils=require(_0x89f3('0x14'));var config=require(_0x89f3('0x15'));var licenseUtil=require(_0x89f3('0x16'));var db=require(_0x89f3('0x17'))['db'];function respondWithStatusCode(_0xfde927,_0x100e1e){_0x100e1e=_0x100e1e||0xcc;return function(_0x17956c){if(_0x17956c){return _0xfde927['sendStatus'](_0x100e1e);}return _0xfde927[_0x89f3('0x18')](_0x100e1e)[_0x89f3('0x19')]();};}function respondWithResult(_0x2133ab,_0x1a4e71){_0x1a4e71=_0x1a4e71||0xc8;return function(_0x3a99e0){if(_0x3a99e0){return _0x2133ab['status'](_0x1a4e71)['json'](_0x3a99e0);}};}function respondWithFilteredResult(_0x3c9b7a,_0x3aa22e){return function(_0x15059b){if(_0x15059b){var _0x525051=typeof _0x3aa22e[_0x89f3('0x1a')]===_0x89f3('0x1b')&&typeof _0x3aa22e[_0x89f3('0x1c')]===_0x89f3('0x1b');var _0x58de06=_0x15059b['count'];var _0x409244=_0x525051?0x0:_0x3aa22e['offset'];var _0x51a0e8=_0x525051?_0x15059b[_0x89f3('0x1d')]:_0x3aa22e['offset']+_0x3aa22e[_0x89f3('0x1c')];var _0xe7fffc;if(_0x51a0e8>=_0x58de06){_0x51a0e8=_0x58de06;_0xe7fffc=0xc8;}else{_0xe7fffc=0xce;}_0x3c9b7a[_0x89f3('0x18')](_0xe7fffc);return _0x3c9b7a[_0x89f3('0x1e')](_0x89f3('0x1f'),_0x409244+'-'+_0x51a0e8+'/'+_0x58de06)[_0x89f3('0x20')](_0x15059b);}return null;};}function patchUpdates(_0xc95590){return function(_0x28a014){try{jsonpatch[_0x89f3('0x21')](_0x28a014,_0xc95590,!![]);}catch(_0x3b7a34){return BPromise[_0x89f3('0x22')](_0x3b7a34);}return _0x28a014['save']();};}function saveUpdates(_0x4cc56a,_0x18f057){return function(_0x1dc895){if(_0x1dc895){return _0x1dc895[_0x89f3('0x23')](_0x4cc56a)[_0x89f3('0x24')](function(_0x368e54){return _0x368e54;});}return null;};}function removeEntity(_0x9f6db2,_0x4e685b){return function(_0xad400f){if(_0xad400f){return _0xad400f[_0x89f3('0x25')]()[_0x89f3('0x24')](function(){var _0x439bea=_0xad400f[_0x89f3('0x26')]({'plain':!![]});var _0x7f494d=_0x89f3('0x27');return db[_0x89f3('0x28')]['destroy']({'where':{'type':_0x7f494d,'resourceId':_0x439bea['id']}})[_0x89f3('0x24')](function(){return _0xad400f;});})[_0x89f3('0x24')](function(){_0x9f6db2[_0x89f3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dbda9,_0x309014){return function(_0x32dec7){if(!_0x32dec7){_0x5dbda9[_0x89f3('0x29')](0x194);}return _0x32dec7;};}function handleError(_0x4b016e,_0x18a106){_0x18a106=_0x18a106||0x1f4;return function(_0x44cf17){logger[_0x89f3('0x2a')](_0x44cf17[_0x89f3('0x2b')]);if(_0x44cf17[_0x89f3('0x2c')]){delete _0x44cf17[_0x89f3('0x2c')];}_0x4b016e[_0x89f3('0x18')](_0x18a106)[_0x89f3('0x2d')](_0x44cf17);};}exports[_0x89f3('0x2e')]=function(_0x3506ce,_0x18dcfa){var _0x36929b={},_0x3b4e52={},_0x284400={'count':0x0,'rows':[]};var _0x3fb632=_[_0x89f3('0x2f')](db[_0x89f3('0x30')]['rawAttributes'],function(_0x3d335c){return{'name':_0x3d335c[_0x89f3('0x31')],'type':_0x3d335c[_0x89f3('0x32')][_0x89f3('0x33')]};});_0x3b4e52[_0x89f3('0x34')]=_[_0x89f3('0x2f')](_0x3fb632,_0x89f3('0x2c'));_0x3b4e52[_0x89f3('0x35')]=_[_0x89f3('0x36')](_0x3506ce[_0x89f3('0x35')]);_0x3b4e52[_0x89f3('0x37')]=_[_0x89f3('0x38')](_0x3b4e52[_0x89f3('0x34')],_0x3b4e52[_0x89f3('0x35')]);_0x36929b[_0x89f3('0x39')]=_[_0x89f3('0x38')](_0x3b4e52[_0x89f3('0x34')],qs[_0x89f3('0x3a')](_0x3506ce[_0x89f3('0x35')][_0x89f3('0x3a')]));_0x36929b[_0x89f3('0x39')]=_0x36929b[_0x89f3('0x39')][_0x89f3('0x3b')]?_0x36929b[_0x89f3('0x39')]:_0x3b4e52[_0x89f3('0x34')];if(!_0x3506ce[_0x89f3('0x35')]['hasOwnProperty'](_0x89f3('0x3c'))){_0x36929b['limit']=qs[_0x89f3('0x1c')](_0x3506ce['query'][_0x89f3('0x1c')]);_0x36929b[_0x89f3('0x1a')]=qs[_0x89f3('0x1a')](_0x3506ce[_0x89f3('0x35')]['offset']);}_0x36929b[_0x89f3('0x3d')]=qs[_0x89f3('0x3e')](_0x3506ce[_0x89f3('0x35')]['sort']);_0x36929b[_0x89f3('0x3f')]=qs[_0x89f3('0x37')](_[_0x89f3('0x40')](_0x3506ce['query'],_0x3b4e52[_0x89f3('0x37')]),_0x3fb632);if(_0x3506ce[_0x89f3('0x35')]['filter']){_0x36929b[_0x89f3('0x3f')]=_['merge'](_0x36929b['where'],{'$or':_[_0x89f3('0x2f')](_0x3fb632,function(_0x2f6c90){if(_0x2f6c90[_0x89f3('0x32')]!==_0x89f3('0x41')){var _0x2ea4ca={};_0x2ea4ca[_0x2f6c90['name']]={'$like':'%'+_0x3506ce[_0x89f3('0x35')][_0x89f3('0x42')]+'%'};return _0x2ea4ca;}})});}_0x36929b=_[_0x89f3('0x43')]({},_0x36929b,_0x3506ce[_0x89f3('0x44')]);var _0x9edf9e={'where':_0x36929b[_0x89f3('0x3f')]};return db[_0x89f3('0x30')][_0x89f3('0x1d')](_0x9edf9e)[_0x89f3('0x24')](function(_0x2fbf1e){_0x284400[_0x89f3('0x1d')]=_0x2fbf1e;if(_0x3506ce[_0x89f3('0x35')]['includeAll']){_0x36929b[_0x89f3('0x45')]=[{'all':!![]}];}return db[_0x89f3('0x30')][_0x89f3('0x46')](_0x36929b);})[_0x89f3('0x24')](function(_0x45111a){_0x284400['rows']=_0x45111a;return _0x284400;})[_0x89f3('0x24')](respondWithFilteredResult(_0x18dcfa,_0x36929b))[_0x89f3('0x47')](handleError(_0x18dcfa,null));};exports[_0x89f3('0x48')]=function(_0x616fe9,_0x285d30){var _0x4d960b={'raw':!![],'where':{'id':_0x616fe9[_0x89f3('0x49')]['id']}},_0x421fce={};_0x421fce[_0x89f3('0x34')]=_[_0x89f3('0x36')](db[_0x89f3('0x30')][_0x89f3('0x4a')]);_0x421fce[_0x89f3('0x35')]=_[_0x89f3('0x36')](_0x616fe9[_0x89f3('0x35')]);_0x421fce['filters']=_[_0x89f3('0x38')](_0x421fce[_0x89f3('0x34')],_0x421fce[_0x89f3('0x35')]);_0x4d960b[_0x89f3('0x39')]=_[_0x89f3('0x38')](_0x421fce[_0x89f3('0x34')],qs[_0x89f3('0x3a')](_0x616fe9[_0x89f3('0x35')][_0x89f3('0x3a')]));_0x4d960b[_0x89f3('0x39')]=_0x4d960b['attributes'][_0x89f3('0x3b')]?_0x4d960b['attributes']:_0x421fce[_0x89f3('0x34')];if(_0x616fe9[_0x89f3('0x35')]['includeAll']){_0x4d960b[_0x89f3('0x45')]=[{'all':!![]}];}_0x4d960b=_[_0x89f3('0x43')]({},_0x4d960b,_0x616fe9[_0x89f3('0x44')]);return db[_0x89f3('0x30')]['find'](_0x4d960b)[_0x89f3('0x24')](handleEntityNotFound(_0x285d30,null))['then'](respondWithResult(_0x285d30,null))[_0x89f3('0x47')](handleError(_0x285d30,null));};exports[_0x89f3('0x4b')]=function(_0x3ebebc,_0x410868){return db[_0x89f3('0x30')][_0x89f3('0x4b')](_0x3ebebc['body'],{})[_0x89f3('0x24')](function(_0xa8e8ae){var _0x3892cc=_0x3ebebc[_0x89f3('0x4c')][_0x89f3('0x26')]({'plain':!![]});if(!_0x3892cc)throw new Error(_0x89f3('0x4d'));if(_0x3892cc[_0x89f3('0x4e')]===_0x89f3('0x4c')){var _0x44b55e=_0xa8e8ae[_0x89f3('0x26')]({'plain':!![]});var _0x1e9791=_0x89f3('0x27');return db['UserProfileSection'][_0x89f3('0x4f')]({'where':{'name':_0x1e9791,'userProfileId':_0x3892cc[_0x89f3('0x50')]},'raw':!![]})[_0x89f3('0x24')](function(_0xe19e51){if(_0xe19e51&&_0xe19e51['autoAssociation']===0x0){return db[_0x89f3('0x28')][_0x89f3('0x4b')]({'name':_0x44b55e['name'],'resourceId':_0x44b55e['id'],'type':_0xe19e51[_0x89f3('0x2c')],'sectionId':_0xe19e51['id']},{})[_0x89f3('0x24')](function(){return _0xa8e8ae;});}else{return _0xa8e8ae;}})['catch'](function(_0xdde4db){logger['error'](_0x89f3('0x51'),_0xdde4db);throw _0xdde4db;});}return _0xa8e8ae;})[_0x89f3('0x24')](respondWithResult(_0x410868,0xc9))['catch'](handleError(_0x410868,null));};exports[_0x89f3('0x23')]=function(_0x427cae,_0x3b9e67){if(_0x427cae[_0x89f3('0x52')]['id']){delete _0x427cae['body']['id'];}return db[_0x89f3('0x30')][_0x89f3('0x4f')]({'where':{'id':_0x427cae[_0x89f3('0x49')]['id']}})[_0x89f3('0x24')](handleEntityNotFound(_0x3b9e67,null))['then'](saveUpdates(_0x427cae[_0x89f3('0x52')],null))[_0x89f3('0x24')](respondWithResult(_0x3b9e67,null))[_0x89f3('0x47')](handleError(_0x3b9e67,null));};exports['destroy']=function(_0xe4b9cc,_0x1be60a){return db[_0x89f3('0x30')][_0x89f3('0x4f')]({'where':{'id':_0xe4b9cc[_0x89f3('0x49')]['id']}})[_0x89f3('0x24')](handleEntityNotFound(_0x1be60a,null))[_0x89f3('0x24')](removeEntity(_0x1be60a,null))[_0x89f3('0x47')](handleError(_0x1be60a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 1151efa..7fbd628 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 _0x41aa=['util','moment','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','tools_templates','lodash'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0x41aa,0x135));var _0xa41a=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x41aa[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require(_0xa41a('0x0'));var util=require(_0xa41a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa41a('0x2'));var BPromise=require(_0xa41a('0x3'));var rp=require(_0xa41a('0x4'));var fs=require('fs');var path=require(_0xa41a('0x5'));var rimraf=require('rimraf');var config=require(_0xa41a('0x6'));var attributes=require(_0xa41a('0x7'));module[_0xa41a('0x8')]=function(_0x113831,_0xd499f0){return _0x113831['define']('Template',attributes,{'tableName':_0xa41a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4922=['../../config/logger','moment','bluebird','request-promise','path','./template.attributes','Template','lodash','util'];(function(_0x5303bf,_0x301df8){var _0x5e1e62=function(_0x5db7af){while(--_0x5db7af){_0x5303bf['push'](_0x5303bf['shift']());}};_0x5e1e62(++_0x301df8);}(_0x4922,0x11e));var _0x2492=function(_0x1ac41c,_0x1dacbf){_0x1ac41c=_0x1ac41c-0x0;var _0x561d64=_0x4922[_0x1ac41c];return _0x561d64;};'use strict';var _=require(_0x2492('0x0'));var util=require(_0x2492('0x1'));var logger=require(_0x2492('0x2'))('api');var moment=require(_0x2492('0x3'));var BPromise=require(_0x2492('0x4'));var rp=require(_0x2492('0x5'));var fs=require('fs');var path=require(_0x2492('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2492('0x7'));module['exports']=function(_0xc830ae,_0x58fd5b){return _0xc830ae['define'](_0x2492('0x8'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 9a94777..8ab966e 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 _0x552c=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Template','findAll','options','where','attributes','limit','include','map','model','GetTemplate','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s'];(function(_0x6e9b19,_0x3f9a2f){var _0x2ae93c=function(_0x1cc9c1){while(--_0x1cc9c1){_0x6e9b19['push'](_0x6e9b19['shift']());}};_0x2ae93c(++_0x3f9a2f);}(_0x552c,0xd2));var _0xc552=function(_0x46437e,_0x20c7d8){_0x46437e=_0x46437e-0x0;var _0x1189bd=_0x552c[_0x46437e];return _0x1189bd;};'use strict';var _=require(_0xc552('0x0'));var util=require(_0xc552('0x1'));var moment=require(_0xc552('0x2'));var BPromise=require(_0xc552('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc552('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc552('0x5'))(_0xc552('0x6'));var config=require(_0xc552('0x7'));var jayson=require(_0xc552('0x8'));var client=jayson[_0xc552('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1196c5,_0x3c96ac,_0xccf6ba){return new BPromise(function(_0x3e2a13,_0x2d92a8){return client[_0xc552('0xa')](_0x1196c5,_0xccf6ba)[_0xc552('0xb')](function(_0x419fd0){logger[_0xc552('0xc')](_0xc552('0xd'),_0x3c96ac,_0xc552('0xe'));logger[_0xc552('0xf')](_0xc552('0x10'),_0x3c96ac,_0xc552('0xe'),JSON[_0xc552('0x11')](_0x419fd0));if(_0x419fd0[_0xc552('0x12')]){if(_0x419fd0[_0xc552('0x12')]['code']===0x1f4){logger[_0xc552('0x12')](_0xc552('0xd'),_0x3c96ac,_0x419fd0['error']['message']);return _0x2d92a8(_0x419fd0[_0xc552('0x12')][_0xc552('0x13')]);}logger[_0xc552('0x12')](_0xc552('0xd'),_0x3c96ac,_0x419fd0[_0xc552('0x12')][_0xc552('0x13')]);return _0x3e2a13(_0x419fd0[_0xc552('0x12')][_0xc552('0x13')]);}else{logger[_0xc552('0xc')](_0xc552('0xd'),_0x3c96ac,_0xc552('0xe'));_0x3e2a13(_0x419fd0[_0xc552('0x14')][_0xc552('0x13')]);}})[_0xc552('0x15')](function(_0x4eaa9a){logger[_0xc552('0x12')]('Template,\x20%s,\x20%s',_0x3c96ac,_0x4eaa9a);_0x2d92a8(_0x4eaa9a);});});}exports['GetTemplate']=function(_0x306786){var _0x196421=this;return new Promise(function(_0x3360d6,_0x454a84){return db[_0xc552('0x16')][_0xc552('0x17')]({'raw':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')][_0xc552('0x19')]||null:null,'attributes':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')][_0xc552('0x1a')]||null:null,'limit':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')][_0xc552('0x1b')]||null:null,'include':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')][_0xc552('0x1c')]?_[_0xc552('0x1d')](_0x306786[_0xc552('0x18')][_0xc552('0x1c')],function(_0x1bf060){return{'model':db[_0x1bf060[_0xc552('0x1e')]],'as':_0x1bf060['as'],'attributes':_0x1bf060[_0xc552('0x1a')],'include':_0x1bf060['include']?_[_0xc552('0x1d')](_0x1bf060[_0xc552('0x1c')],function(_0x4e0ae7){return{'model':db[_0x4e0ae7[_0xc552('0x1e')]],'as':_0x4e0ae7['as'],'attributes':_0x4e0ae7[_0xc552('0x1a')],'include':_0x4e0ae7[_0xc552('0x1c')]?_[_0xc552('0x1d')](_0x4e0ae7[_0xc552('0x1c')],function(_0x46ff1c){return{'model':db[_0x46ff1c[_0xc552('0x1e')]],'as':_0x46ff1c['as'],'attributes':_0x46ff1c[_0xc552('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc552('0xb')](function(_0x12cfab){logger[_0xc552('0xc')](_0xc552('0x1f'),_0x306786);logger[_0xc552('0xf')](_0xc552('0x1f'),_0x306786,JSON[_0xc552('0x11')](_0x12cfab));_0x3360d6(_0x12cfab);})[_0xc552('0x15')](function(_0x19a088){logger[_0xc552('0x12')](_0xc552('0x1f'),_0x19a088[_0xc552('0x13')],_0x306786);_0x454a84(_0x196421['error'](0x1f4,_0x19a088[_0xc552('0x13')]));});});}; \ No newline at end of file +var _0x87ef=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','GetTemplate','findAll','options','attributes','include','map','model','then','lodash'];(function(_0x49280a,_0x1ca154){var _0x5d5d43=function(_0x315e5a){while(--_0x315e5a){_0x49280a['push'](_0x49280a['shift']());}};_0x5d5d43(++_0x1ca154);}(_0x87ef,0x13f));var _0xf87e=function(_0x5a18c3,_0x5c6928){_0x5a18c3=_0x5a18c3-0x0;var _0x3e22e7=_0x87ef[_0x5a18c3];return _0x3e22e7;};'use strict';var _=require(_0xf87e('0x0'));var util=require('util');var moment=require(_0xf87e('0x1'));var BPromise=require(_0xf87e('0x2'));var rs=require(_0xf87e('0x3'));var fs=require('fs');var Redis=require(_0xf87e('0x4'));var db=require(_0xf87e('0x5'))['db'];var utils=require(_0xf87e('0x6'));var logger=require(_0xf87e('0x7'))(_0xf87e('0x8'));var config=require(_0xf87e('0x9'));var jayson=require(_0xf87e('0xa'));var client=jayson['client'][_0xf87e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f5c60,_0x169fea,_0x3187ba){return new BPromise(function(_0x10f39b,_0x33457f){return client[_0xf87e('0xc')](_0x1f5c60,_0x3187ba)['then'](function(_0x6e1408){logger['info'](_0xf87e('0xd'),_0x169fea,'request\x20sent');logger[_0xf87e('0xe')](_0xf87e('0xf'),_0x169fea,'request\x20sent',JSON[_0xf87e('0x10')](_0x6e1408));if(_0x6e1408['error']){if(_0x6e1408[_0xf87e('0x11')][_0xf87e('0x12')]===0x1f4){logger[_0xf87e('0x11')](_0xf87e('0xd'),_0x169fea,_0x6e1408[_0xf87e('0x11')]['message']);return _0x33457f(_0x6e1408['error'][_0xf87e('0x13')]);}logger[_0xf87e('0x11')](_0xf87e('0xd'),_0x169fea,_0x6e1408[_0xf87e('0x11')]['message']);return _0x10f39b(_0x6e1408['error'][_0xf87e('0x13')]);}else{logger[_0xf87e('0x14')]('Template,\x20%s,\x20%s',_0x169fea,_0xf87e('0x15'));_0x10f39b(_0x6e1408[_0xf87e('0x16')][_0xf87e('0x13')]);}})[_0xf87e('0x17')](function(_0x53c5f0){logger[_0xf87e('0x11')](_0xf87e('0xd'),_0x169fea,_0x53c5f0);_0x33457f(_0x53c5f0);});});}exports[_0xf87e('0x18')]=function(_0x10fe70){var _0x26ff71=this;return new Promise(function(_0x17f22c,_0xef95bc){return db['Template'][_0xf87e('0x19')]({'raw':_0x10fe70[_0xf87e('0x1a')]?_0x10fe70[_0xf87e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x10fe70[_0xf87e('0x1a')]?_0x10fe70[_0xf87e('0x1a')]['where']||null:null,'attributes':_0x10fe70[_0xf87e('0x1a')]?_0x10fe70[_0xf87e('0x1a')][_0xf87e('0x1b')]||null:null,'limit':_0x10fe70[_0xf87e('0x1a')]?_0x10fe70[_0xf87e('0x1a')]['limit']||null:null,'include':_0x10fe70[_0xf87e('0x1a')]?_0x10fe70['options'][_0xf87e('0x1c')]?_[_0xf87e('0x1d')](_0x10fe70[_0xf87e('0x1a')][_0xf87e('0x1c')],function(_0x419096){return{'model':db[_0x419096[_0xf87e('0x1e')]],'as':_0x419096['as'],'attributes':_0x419096[_0xf87e('0x1b')],'include':_0x419096[_0xf87e('0x1c')]?_[_0xf87e('0x1d')](_0x419096[_0xf87e('0x1c')],function(_0x29f54a){return{'model':db[_0x29f54a[_0xf87e('0x1e')]],'as':_0x29f54a['as'],'attributes':_0x29f54a[_0xf87e('0x1b')],'include':_0x29f54a[_0xf87e('0x1c')]?_['map'](_0x29f54a[_0xf87e('0x1c')],function(_0x4040d1){return{'model':db[_0x4040d1[_0xf87e('0x1e')]],'as':_0x4040d1['as'],'attributes':_0x4040d1[_0xf87e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf87e('0x1f')](function(_0x30a63a){logger[_0xf87e('0x14')](_0xf87e('0x18'),_0x10fe70);logger[_0xf87e('0xe')](_0xf87e('0x18'),_0x10fe70,JSON[_0xf87e('0x10')](_0x30a63a));_0x17f22c(_0x30a63a);})['catch'](function(_0x1b60ac){logger[_0xf87e('0x11')](_0xf87e('0x18'),_0x1b60ac['message'],_0x10fe70);_0xef95bc(_0x26ff71[_0xf87e('0x11')](0x1f4,_0x1b60ac[_0xf87e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8cae5d5..4cbe088 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 _0xc3ed=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','put','update','destroy','exports','multer','util'];(function(_0x166f43,_0x3bc8cb){var _0x43ae50=function(_0x5c562){while(--_0x5c562){_0x166f43['push'](_0x166f43['shift']());}};_0x43ae50(++_0x3bc8cb);}(_0xc3ed,0x111));var _0xdc3e=function(_0x29c708,_0x86df4f){_0x29c708=_0x29c708-0x0;var _0x18e405=_0xc3ed[_0x29c708];return _0x18e405;};'use strict';var multer=require(_0xdc3e('0x0'));var util=require(_0xdc3e('0x1'));var path=require('path');var timeout=require(_0xdc3e('0x2'));var express=require(_0xdc3e('0x3'));var router=express[_0xdc3e('0x4')]();var fs_extra=require(_0xdc3e('0x5'));var auth=require(_0xdc3e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc3e('0x7'));var controller=require('./trigger.controller');router[_0xdc3e('0x8')]('/',auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xa')]);router[_0xdc3e('0x8')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xc')]);router[_0xdc3e('0x8')](_0xdc3e('0xd'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xe')]);router[_0xdc3e('0x8')](_0xdc3e('0xf'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x10')]);router[_0xdc3e('0x8')](_0xdc3e('0x11'),auth['isAuthenticated'](),controller[_0xdc3e('0x12')]);router[_0xdc3e('0x13')]('/',auth[_0xdc3e('0x9')](),controller['create']);router[_0xdc3e('0x13')]('/:id/all_conditions',auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x14')]);router['post']('/:id/any_conditions',auth[_0xdc3e('0x9')](),controller['addAnyCondition']);router[_0xdc3e('0x13')](_0xdc3e('0x11'),auth[_0xdc3e('0x9')](),controller['addAction']);router[_0xdc3e('0x15')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x16')]);router['delete'](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x17')]);module[_0xdc3e('0x18')]=router; \ No newline at end of file +var _0x9831=['delete','/:id','destroy','exports','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','show','/:id/all_conditions','getAllConditions','getAnyConditions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','update'];(function(_0x38abf7,_0x418f33){var _0x59c046=function(_0x5730fd){while(--_0x5730fd){_0x38abf7['push'](_0x38abf7['shift']());}};_0x59c046(++_0x418f33);}(_0x9831,0x15d));var _0x1983=function(_0x1114be,_0x3deec2){_0x1114be=_0x1114be-0x0;var _0x128807=_0x9831[_0x1114be];return _0x128807;};'use strict';var multer=require('multer');var util=require(_0x1983('0x0'));var path=require('path');var timeout=require(_0x1983('0x1'));var express=require('express');var router=express[_0x1983('0x2')]();var fs_extra=require(_0x1983('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1983('0x4'));var controller=require('./trigger.controller');router['get']('/',auth[_0x1983('0x5')](),controller[_0x1983('0x6')]);router[_0x1983('0x7')]('/:id',auth[_0x1983('0x5')](),controller[_0x1983('0x8')]);router[_0x1983('0x7')](_0x1983('0x9'),auth[_0x1983('0x5')](),controller[_0x1983('0xa')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x1983('0xb')]);router[_0x1983('0x7')]('/:id/actions',auth[_0x1983('0x5')](),controller['getActions']);router[_0x1983('0xc')]('/',auth[_0x1983('0x5')](),controller[_0x1983('0xd')]);router['post'](_0x1983('0x9'),auth[_0x1983('0x5')](),controller[_0x1983('0xe')]);router[_0x1983('0xc')](_0x1983('0xf'),auth['isAuthenticated'](),controller[_0x1983('0x10')]);router[_0x1983('0xc')](_0x1983('0x11'),auth[_0x1983('0x5')](),controller['addAction']);router['put']('/:id',auth[_0x1983('0x5')](),controller[_0x1983('0x12')]);router[_0x1983('0x13')](_0x1983('0x14'),auth[_0x1983('0x5')](),controller[_0x1983('0x15')]);module[_0x1983('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 0a9dc16..3aeab99 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 _0x3482=['STRING','BOOLEAN','sequelize'];(function(_0x244339,_0x43f890){var _0x3210bd=function(_0x50410a){while(--_0x50410a){_0x244339['push'](_0x244339['shift']());}};_0x3210bd(++_0x43f890);}(_0x3482,0x9e));var _0x2348=function(_0x35d9d6,_0x2a4184){_0x35d9d6=_0x35d9d6-0x0;var _0x5d8371=_0x3482[_0x35d9d6];return _0x5d8371;};'use strict';var Sequelize=require(_0x2348('0x0'));module['exports']={'name':{'type':Sequelize[_0x2348('0x1')]},'channel':{'type':Sequelize[_0x2348('0x1')]},'description':{'type':Sequelize[_0x2348('0x1')]},'status':{'type':Sequelize[_0x2348('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0e6=['BOOLEAN','exports','STRING'];(function(_0x2bdfff,_0x3d576f){var _0x58f512=function(_0x840ed5){while(--_0x840ed5){_0x2bdfff['push'](_0x2bdfff['shift']());}};_0x58f512(++_0x3d576f);}(_0xe0e6,0x1bd));var _0x6e0e=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0xe0e6[_0x338f73];return _0x163fdf;};'use strict';var Sequelize=require('sequelize');module[_0x6e0e('0x0')]={'name':{'type':Sequelize[_0x6e0e('0x1')]},'channel':{'type':Sequelize[_0x6e0e('0x1')]},'description':{'type':Sequelize[_0x6e0e('0x1')]},'status':{'type':Sequelize[_0x6e0e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index de86c35..4baf235 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 _0xb04e=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','Trigger','rawAttributes','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user'];(function(_0x9f6556,_0x28414f){var _0x5ee21e=function(_0x337b35){while(--_0x337b35){_0x9f6556['push'](_0x9f6556['shift']());}};_0x5ee21e(++_0x28414f);}(_0xb04e,0x185));var _0xeb04=function(_0x18329c,_0x5804b7){_0x18329c=_0x18329c-0x0;var _0x19cbc5=_0xb04e[_0x18329c];return _0x19cbc5;};'use strict';var emlformat=require(_0xeb04('0x0'));var rimraf=require(_0xeb04('0x1'));var zipdir=require(_0xeb04('0x2'));var jsonpatch=require(_0xeb04('0x3'));var rp=require(_0xeb04('0x4'));var moment=require(_0xeb04('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb04('0x6'));var util=require(_0xeb04('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeb04('0x8'));var ejs=require(_0xeb04('0x9'));var fs=require('fs');var fs_extra=require(_0xeb04('0xa'));var _=require(_0xeb04('0xb'));var squel=require(_0xeb04('0xc'));var crypto=require(_0xeb04('0xd'));var jsforce=require(_0xeb04('0xe'));var deskjs=require(_0xeb04('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb04('0x10'));var Papa=require(_0xeb04('0x11'));var Redis=require(_0xeb04('0x12'));var authService=require(_0xeb04('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb04('0x14'));var hardwareService=require(_0xeb04('0x15'));var logger=require(_0xeb04('0x16'))(_0xeb04('0x17'));var utils=require(_0xeb04('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xeb04('0x19'));var db=require(_0xeb04('0x1a'))['db'];function respondWithStatusCode(_0x413d39,_0x45512a){_0x45512a=_0x45512a||0xcc;return function(_0x1affae){if(_0x1affae){return _0x413d39['sendStatus'](_0x45512a);}return _0x413d39[_0xeb04('0x1b')](_0x45512a)[_0xeb04('0x1c')]();};}function respondWithResult(_0x8aaa97,_0xfcf7ed){_0xfcf7ed=_0xfcf7ed||0xc8;return function(_0x43c44d){if(_0x43c44d){return _0x8aaa97[_0xeb04('0x1b')](_0xfcf7ed)[_0xeb04('0x1d')](_0x43c44d);}};}function respondWithFilteredResult(_0xa5ab17,_0x1ce32f){return function(_0x3c6960){if(_0x3c6960){var _0xb1e9cf=typeof _0x1ce32f[_0xeb04('0x1e')]===_0xeb04('0x1f')&&typeof _0x1ce32f[_0xeb04('0x20')]===_0xeb04('0x1f');var _0x472da9=_0x3c6960[_0xeb04('0x21')];var _0x442555=_0xb1e9cf?0x0:_0x1ce32f[_0xeb04('0x1e')];var _0x2f80a1=_0xb1e9cf?_0x3c6960['count']:_0x1ce32f[_0xeb04('0x1e')]+_0x1ce32f[_0xeb04('0x20')];var _0x25bec9;if(_0x2f80a1>=_0x472da9){_0x2f80a1=_0x472da9;_0x25bec9=0xc8;}else{_0x25bec9=0xce;}_0xa5ab17[_0xeb04('0x1b')](_0x25bec9);return _0xa5ab17['set'](_0xeb04('0x22'),_0x442555+'-'+_0x2f80a1+'/'+_0x472da9)[_0xeb04('0x1d')](_0x3c6960);}return null;};}function patchUpdates(_0x2925b9){return function(_0x30ba1b){try{jsonpatch[_0xeb04('0x23')](_0x30ba1b,_0x2925b9,!![]);}catch(_0xae52bc){return BPromise[_0xeb04('0x24')](_0xae52bc);}return _0x30ba1b['save']();};}function saveUpdates(_0x4b1cf8,_0x1d3376){return function(_0x21aec0){if(_0x21aec0){return _0x21aec0[_0xeb04('0x25')](_0x4b1cf8)[_0xeb04('0x26')](function(_0x413032){return _0x413032;});}return null;};}function removeEntity(_0x3567e4,_0x4dc02b){return function(_0x38e92e){if(_0x38e92e){return _0x38e92e[_0xeb04('0x27')]()[_0xeb04('0x26')](function(){var _0x4cea31=_0x38e92e['get']({'plain':!![]});var _0x231488='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x231488,'resourceId':_0x4cea31['id']}})['then'](function(){return _0x38e92e;});})[_0xeb04('0x26')](function(){_0x3567e4[_0xeb04('0x1b')](0xcc)[_0xeb04('0x1c')]();});}};}function handleEntityNotFound(_0x5370a4,_0x395052){return function(_0x2d9061){if(!_0x2d9061){_0x5370a4['sendStatus'](0x194);}return _0x2d9061;};}function handleError(_0x1a6418,_0x358578){_0x358578=_0x358578||0x1f4;return function(_0x5c0756){logger[_0xeb04('0x28')](_0x5c0756[_0xeb04('0x29')]);if(_0x5c0756[_0xeb04('0x2a')]){delete _0x5c0756[_0xeb04('0x2a')];}_0x1a6418[_0xeb04('0x1b')](_0x358578)[_0xeb04('0x2b')](_0x5c0756);};}exports['index']=function(_0x15d7e5,_0x5859c2){var _0x1fe452={},_0x2dae2c={},_0x405199={'count':0x0,'rows':[]};var _0x324585=_[_0xeb04('0x2c')](db[_0xeb04('0x2d')][_0xeb04('0x2e')],function(_0x253cbb){return{'name':_0x253cbb['fieldName'],'type':_0x253cbb['type'][_0xeb04('0x2f')]};});_0x2dae2c[_0xeb04('0x30')]=_[_0xeb04('0x2c')](_0x324585,_0xeb04('0x2a'));_0x2dae2c[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x15d7e5[_0xeb04('0x31')]);_0x2dae2c['filters']=_['intersection'](_0x2dae2c['model'],_0x2dae2c[_0xeb04('0x31')]);_0x1fe452[_0xeb04('0x33')]=_['intersection'](_0x2dae2c[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x15d7e5[_0xeb04('0x31')]['fields']));_0x1fe452[_0xeb04('0x33')]=_0x1fe452['attributes'][_0xeb04('0x35')]?_0x1fe452['attributes']:_0x2dae2c['model'];if(!_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x1fe452[_0xeb04('0x20')]=qs[_0xeb04('0x20')](_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x20')]);_0x1fe452[_0xeb04('0x1e')]=qs['offset'](_0x15d7e5[_0xeb04('0x31')]['offset']);}_0x1fe452[_0xeb04('0x38')]=qs[_0xeb04('0x39')](_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x39')]);_0x1fe452[_0xeb04('0x3a')]=qs['filters'](_[_0xeb04('0x3b')](_0x15d7e5[_0xeb04('0x31')],_0x2dae2c[_0xeb04('0x3c')]),_0x324585);if(_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x1fe452['where']=_[_0xeb04('0x3e')](_0x1fe452['where'],{'$or':_[_0xeb04('0x2c')](_0x324585,function(_0x41c362){if(_0x41c362['type']!==_0xeb04('0x3f')){var _0x36a0a5={};_0x36a0a5[_0x41c362['name']]={'$like':'%'+_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x3d')]+'%'};return _0x36a0a5;}})});}_0x1fe452=_[_0xeb04('0x3e')]({},_0x1fe452,_0x15d7e5[_0xeb04('0x40')]);var _0x532a22={'where':_0x1fe452[_0xeb04('0x3a')]};return db[_0xeb04('0x2d')][_0xeb04('0x21')](_0x532a22)[_0xeb04('0x26')](function(_0x5009d6){_0x405199[_0xeb04('0x21')]=_0x5009d6;if(_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x41')]){_0x1fe452[_0xeb04('0x42')]=[{'all':!![]}];}return db[_0xeb04('0x2d')][_0xeb04('0x43')](_0x1fe452);})['then'](function(_0x163f4b){_0x405199[_0xeb04('0x44')]=_0x163f4b;return _0x405199;})[_0xeb04('0x26')](respondWithFilteredResult(_0x5859c2,_0x1fe452))[_0xeb04('0x45')](handleError(_0x5859c2,null));};exports[_0xeb04('0x46')]=function(_0x46a67e,_0x1e5870){var _0x4210f4={'raw':![],'where':{'id':_0x46a67e[_0xeb04('0x47')]['id']}},_0x1fe994={};_0x1fe994[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x2d')]['rawAttributes']);_0x1fe994['query']=_[_0xeb04('0x32')](_0x46a67e[_0xeb04('0x31')]);_0x1fe994[_0xeb04('0x3c')]=_[_0xeb04('0x48')](_0x1fe994[_0xeb04('0x30')],_0x1fe994['query']);_0x4210f4[_0xeb04('0x33')]=_['intersection'](_0x1fe994[_0xeb04('0x30')],qs['fields'](_0x46a67e[_0xeb04('0x31')][_0xeb04('0x34')]));_0x4210f4['attributes']=_0x4210f4[_0xeb04('0x33')]['length']?_0x4210f4[_0xeb04('0x33')]:_0x1fe994[_0xeb04('0x30')];if(_0x46a67e['query'][_0xeb04('0x41')]){_0x4210f4[_0xeb04('0x42')]=[{'all':!![]}];}_0x4210f4=_[_0xeb04('0x3e')]({},_0x4210f4,_0x46a67e['options']);return db['Trigger'][_0xeb04('0x49')](_0x4210f4)[_0xeb04('0x26')](handleEntityNotFound(_0x1e5870,null))[_0xeb04('0x26')](respondWithResult(_0x1e5870,null))['catch'](handleError(_0x1e5870,null));};exports['create']=function(_0x1e7a9b,_0x46ec82){return db['Trigger'][_0xeb04('0x4a')](_0x1e7a9b['body'],{})[_0xeb04('0x26')](function(_0x421edc){var _0x2aa7ca=_0x1e7a9b[_0xeb04('0x4b')][_0xeb04('0x4c')]({'plain':!![]});if(!_0x2aa7ca)throw new Error(_0xeb04('0x4d'));if(_0x2aa7ca[_0xeb04('0x4e')]===_0xeb04('0x4b')){var _0x590464=_0x421edc[_0xeb04('0x4c')]({'plain':!![]});var _0x260692='Triggers';return db[_0xeb04('0x4f')]['find']({'where':{'name':_0x260692,'userProfileId':_0x2aa7ca['userProfileId']},'raw':!![]})[_0xeb04('0x26')](function(_0x51ddea){if(_0x51ddea&&_0x51ddea['autoAssociation']===0x0){return db[_0xeb04('0x50')]['create']({'name':_0x590464[_0xeb04('0x2a')],'resourceId':_0x590464['id'],'type':_0x51ddea[_0xeb04('0x2a')],'sectionId':_0x51ddea['id']},{})[_0xeb04('0x26')](function(){return _0x421edc;});}else{return _0x421edc;}})[_0xeb04('0x45')](function(_0x51e1d6){logger[_0xeb04('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51e1d6);throw _0x51e1d6;});}return _0x421edc;})[_0xeb04('0x26')](respondWithResult(_0x46ec82,0xc9))[_0xeb04('0x45')](handleError(_0x46ec82,null));};exports[_0xeb04('0x25')]=function(_0x37bcf2,_0x49a0aa){if(_0x37bcf2['body']['id']){delete _0x37bcf2[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')]['find']({'where':{'id':_0x37bcf2['params']['id']}})['then'](handleEntityNotFound(_0x49a0aa,null))[_0xeb04('0x26')](saveUpdates(_0x37bcf2['body'],null))['then'](respondWithResult(_0x49a0aa,null))[_0xeb04('0x45')](handleError(_0x49a0aa,null));};exports[_0xeb04('0x27')]=function(_0x15fe25,_0x271339){return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x15fe25[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x271339,null))[_0xeb04('0x26')](removeEntity(_0x271339,null))[_0xeb04('0x45')](handleError(_0x271339,null));};exports['addAllCondition']=function(_0x4b9171,_0x4a075a,_0x34e070){if(_0x4b9171[_0xeb04('0x51')]['id']){delete _0x4b9171[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x4b9171['params']['id']}})['then'](handleEntityNotFound(_0x4a075a,null))['then'](function(_0x323ef8){if(_0x323ef8){_0x4b9171[_0xeb04('0x51')][_0xeb04('0x52')]=_0x323ef8['id'];return db[_0xeb04('0x53')]['create'](_0x4b9171[_0xeb04('0x51')]);}})['then'](respondWithResult(_0x4a075a,null))['catch'](handleError(_0x4a075a,null));};exports[_0xeb04('0x54')]=function(_0x169062,_0x323c93,_0x117cfc){if(_0x169062['body']['id']){delete _0x169062[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x169062[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x323c93,null))[_0xeb04('0x26')](function(_0x152b3f){if(_0x152b3f){_0x169062[_0xeb04('0x51')][_0xeb04('0x55')]=_0x152b3f['id'];return db[_0xeb04('0x53')][_0xeb04('0x4a')](_0x169062[_0xeb04('0x51')]);}})[_0xeb04('0x26')](respondWithResult(_0x323c93,null))[_0xeb04('0x45')](handleError(_0x323c93,null));};exports[_0xeb04('0x56')]=function(_0x146a10,_0x2dadf6,_0x2b1b2b){var _0x49c3f3={};var _0x57ca1f={};var _0x2b558e;var _0x2eb9fa;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x146a10[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x2dadf6,null))[_0xeb04('0x26')](function(_0x3039b1){if(_0x3039b1){_0x2b558e=_0x3039b1;_0x57ca1f[_0xeb04('0x30')]=_['keys'](db['Condition'][_0xeb04('0x2e')]);_0x57ca1f[_0xeb04('0x31')]=_['keys'](_0x146a10['query']);_0x57ca1f['filters']=_[_0xeb04('0x48')](_0x57ca1f['model'],_0x57ca1f[_0xeb04('0x31')]);_0x49c3f3['attributes']=_['intersection'](_0x57ca1f[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x34')]));_0x49c3f3['attributes']=_0x49c3f3['attributes'][_0xeb04('0x35')]?_0x49c3f3[_0xeb04('0x33')]:_0x57ca1f[_0xeb04('0x30')];_0x49c3f3['order']=qs[_0xeb04('0x39')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x39')]);_0x49c3f3[_0xeb04('0x3a')]=qs[_0xeb04('0x3c')](_['pick'](_0x146a10[_0xeb04('0x31')],_0x57ca1f[_0xeb04('0x3c')]));if(_0x146a10[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x49c3f3[_0xeb04('0x3a')]=_[_0xeb04('0x3e')](_0x49c3f3[_0xeb04('0x3a')],{'$or':_['map'](_0x49c3f3[_0xeb04('0x33')],function(_0x5b79ad){var _0x21c60b={};_0x21c60b[_0x5b79ad]={'$like':'%'+_0x146a10[_0xeb04('0x31')]['filter']+'%'};return _0x21c60b;})});}_0x49c3f3=_['merge']({},_0x49c3f3,_0x146a10[_0xeb04('0x40')]);return _0x2b558e[_0xeb04('0x56')](_0x49c3f3);}})[_0xeb04('0x26')](function(_0x7925b){if(_0x7925b){_0x2eb9fa=_0x7925b[_0xeb04('0x35')];if(!_0x146a10[_0xeb04('0x31')]['hasOwnProperty'](_0xeb04('0x37'))){_0x49c3f3[_0xeb04('0x20')]=qs[_0xeb04('0x20')](_0x146a10['query']['limit']);_0x49c3f3[_0xeb04('0x1e')]=qs[_0xeb04('0x1e')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x1e')]);}return _0x2b558e[_0xeb04('0x56')](_0x49c3f3);}})[_0xeb04('0x26')](function(_0x126965){if(_0x126965){return _0x126965?{'count':_0x2eb9fa,'rows':_0x126965}:null;}})[_0xeb04('0x26')](respondWithResult(_0x2dadf6,null))[_0xeb04('0x45')](handleError(_0x2dadf6,null));};exports[_0xeb04('0x58')]=function(_0x5c7875,_0x1623ea,_0x3eb531){var _0x1754ae={};var _0x3cd737={};var _0x12ba9b;var _0x49d34b;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x5c7875[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x1623ea,null))[_0xeb04('0x26')](function(_0x1f3065){if(_0x1f3065){_0x12ba9b=_0x1f3065;_0x3cd737[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x53')][_0xeb04('0x2e')]);_0x3cd737[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x5c7875[_0xeb04('0x31')]);_0x3cd737['filters']=_['intersection'](_0x3cd737[_0xeb04('0x30')],_0x3cd737[_0xeb04('0x31')]);_0x1754ae[_0xeb04('0x33')]=_[_0xeb04('0x48')](_0x3cd737[_0xeb04('0x30')],qs['fields'](_0x5c7875['query'][_0xeb04('0x34')]));_0x1754ae['attributes']=_0x1754ae[_0xeb04('0x33')][_0xeb04('0x35')]?_0x1754ae[_0xeb04('0x33')]:_0x3cd737['model'];_0x1754ae[_0xeb04('0x38')]=qs[_0xeb04('0x39')](_0x5c7875[_0xeb04('0x31')]['sort']);_0x1754ae['where']=qs['filters'](_[_0xeb04('0x3b')](_0x5c7875['query'],_0x3cd737[_0xeb04('0x3c')]));if(_0x5c7875[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x1754ae[_0xeb04('0x3a')]=_[_0xeb04('0x3e')](_0x1754ae[_0xeb04('0x3a')],{'$or':_[_0xeb04('0x2c')](_0x1754ae[_0xeb04('0x33')],function(_0x144b43){var _0x25d7e4={};_0x25d7e4[_0x144b43]={'$like':'%'+_0x5c7875['query'][_0xeb04('0x3d')]+'%'};return _0x25d7e4;})});}_0x1754ae=_[_0xeb04('0x3e')]({},_0x1754ae,_0x5c7875[_0xeb04('0x40')]);return _0x12ba9b[_0xeb04('0x58')](_0x1754ae);}})[_0xeb04('0x26')](function(_0x459b86){if(_0x459b86){_0x49d34b=_0x459b86[_0xeb04('0x35')];if(!_0x5c7875[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x1754ae[_0xeb04('0x20')]=qs['limit'](_0x5c7875['query'][_0xeb04('0x20')]);_0x1754ae[_0xeb04('0x1e')]=qs[_0xeb04('0x1e')](_0x5c7875[_0xeb04('0x31')][_0xeb04('0x1e')]);}return _0x12ba9b[_0xeb04('0x58')](_0x1754ae);}})[_0xeb04('0x26')](function(_0x1387de){if(_0x1387de){return _0x1387de?{'count':_0x49d34b,'rows':_0x1387de}:null;}})[_0xeb04('0x26')](respondWithResult(_0x1623ea,null))['catch'](handleError(_0x1623ea,null));};exports[_0xeb04('0x59')]=function(_0x3d6ffb,_0x1f4587,_0x27caa3){if(_0x3d6ffb['body']['id']){delete _0x3d6ffb[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x3d6ffb[_0xeb04('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f4587,null))['then'](function(_0x5e4d4b){if(_0x5e4d4b){_0x3d6ffb['body'][_0xeb04('0x5a')]=_0x5e4d4b['id'];return db[_0xeb04('0x5b')][_0xeb04('0x4a')](_0x3d6ffb[_0xeb04('0x51')]);}})[_0xeb04('0x26')](respondWithResult(_0x1f4587,null))[_0xeb04('0x45')](handleError(_0x1f4587,null));};exports['getActions']=function(_0x894ba9,_0xa27e79,_0xb12294){var _0x27b44f={};var _0x1aa65b={};var _0x3601b3;var _0x43d482;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x894ba9[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0xa27e79,null))['then'](function(_0x3f2c14){if(_0x3f2c14){_0x3601b3=_0x3f2c14;_0x1aa65b[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x5b')][_0xeb04('0x2e')]);_0x1aa65b[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x894ba9[_0xeb04('0x31')]);_0x1aa65b['filters']=_[_0xeb04('0x48')](_0x1aa65b['model'],_0x1aa65b[_0xeb04('0x31')]);_0x27b44f[_0xeb04('0x33')]=_['intersection'](_0x1aa65b[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x894ba9[_0xeb04('0x31')][_0xeb04('0x34')]));_0x27b44f[_0xeb04('0x33')]=_0x27b44f[_0xeb04('0x33')][_0xeb04('0x35')]?_0x27b44f[_0xeb04('0x33')]:_0x1aa65b[_0xeb04('0x30')];_0x27b44f['order']=qs[_0xeb04('0x39')](_0x894ba9['query']['sort']);_0x27b44f['where']=qs['filters'](_[_0xeb04('0x3b')](_0x894ba9[_0xeb04('0x31')],_0x1aa65b[_0xeb04('0x3c')]));if(_0x894ba9['query'][_0xeb04('0x3d')]){_0x27b44f['where']=_[_0xeb04('0x3e')](_0x27b44f[_0xeb04('0x3a')],{'$or':_[_0xeb04('0x2c')](_0x27b44f[_0xeb04('0x33')],function(_0x49ce0e){var _0x402e49={};_0x402e49[_0x49ce0e]={'$like':'%'+_0x894ba9['query'][_0xeb04('0x3d')]+'%'};return _0x402e49;})});}_0x27b44f=_[_0xeb04('0x3e')]({},_0x27b44f,_0x894ba9[_0xeb04('0x40')]);return _0x3601b3[_0xeb04('0x5c')](_0x27b44f);}})['then'](function(_0x38f8f2){if(_0x38f8f2){_0x43d482=_0x38f8f2[_0xeb04('0x35')];if(!_0x894ba9[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x27b44f[_0xeb04('0x20')]=qs['limit'](_0x894ba9[_0xeb04('0x31')][_0xeb04('0x20')]);_0x27b44f[_0xeb04('0x1e')]=qs['offset'](_0x894ba9['query']['offset']);}return _0x3601b3[_0xeb04('0x5c')](_0x27b44f);}})[_0xeb04('0x26')](function(_0x407b0b){if(_0x407b0b){return _0x407b0b?{'count':_0x43d482,'rows':_0x407b0b}:null;}})[_0xeb04('0x26')](respondWithResult(_0xa27e79,null))['catch'](handleError(_0xa27e79,null));}; \ No newline at end of file +var _0x1744=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','save','update','then','destroy','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','type','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x2491c7,_0x3c7573){var _0x4517a3=function(_0x4a1127){while(--_0x4a1127){_0x2491c7['push'](_0x2491c7['shift']());}};_0x4517a3(++_0x3c7573);}(_0x1744,0x177));var _0x4174=function(_0x1a8197,_0x1e39f1){_0x1a8197=_0x1a8197-0x0;var _0x5deaa5=_0x1744[_0x1a8197];return _0x5deaa5;};'use strict';var emlformat=require(_0x4174('0x0'));var rimraf=require(_0x4174('0x1'));var zipdir=require(_0x4174('0x2'));var jsonpatch=require(_0x4174('0x3'));var rp=require(_0x4174('0x4'));var moment=require(_0x4174('0x5'));var BPromise=require(_0x4174('0x6'));var Mustache=require(_0x4174('0x7'));var util=require(_0x4174('0x8'));var path=require(_0x4174('0x9'));var sox=require(_0x4174('0xa'));var csv=require(_0x4174('0xb'));var ejs=require(_0x4174('0xc'));var fs=require('fs');var fs_extra=require(_0x4174('0xd'));var _=require('lodash');var squel=require(_0x4174('0xe'));var crypto=require(_0x4174('0xf'));var jsforce=require(_0x4174('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4174('0x11'));var Redis=require('ioredis');var authService=require(_0x4174('0x12'));var qs=require(_0x4174('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4174('0x14'));var logger=require(_0x4174('0x15'))('api');var utils=require(_0x4174('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4174('0x17'));var db=require(_0x4174('0x18'))['db'];function respondWithStatusCode(_0x5d5b98,_0x48e71f){_0x48e71f=_0x48e71f||0xcc;return function(_0x4be00d){if(_0x4be00d){return _0x5d5b98[_0x4174('0x19')](_0x48e71f);}return _0x5d5b98[_0x4174('0x1a')](_0x48e71f)[_0x4174('0x1b')]();};}function respondWithResult(_0x3af90a,_0x3069bc){_0x3069bc=_0x3069bc||0xc8;return function(_0x4f8faf){if(_0x4f8faf){return _0x3af90a[_0x4174('0x1a')](_0x3069bc)['json'](_0x4f8faf);}};}function respondWithFilteredResult(_0x240a1c,_0x3be5f9){return function(_0x495956){if(_0x495956){var _0x3696ca=typeof _0x3be5f9[_0x4174('0x1c')]==='undefined'&&typeof _0x3be5f9[_0x4174('0x1d')]===_0x4174('0x1e');var _0x58da47=_0x495956[_0x4174('0x1f')];var _0x1423da=_0x3696ca?0x0:_0x3be5f9[_0x4174('0x1c')];var _0x322116=_0x3696ca?_0x495956[_0x4174('0x1f')]:_0x3be5f9[_0x4174('0x1c')]+_0x3be5f9['limit'];var _0x2df8e7;if(_0x322116>=_0x58da47){_0x322116=_0x58da47;_0x2df8e7=0xc8;}else{_0x2df8e7=0xce;}_0x240a1c[_0x4174('0x1a')](_0x2df8e7);return _0x240a1c[_0x4174('0x20')](_0x4174('0x21'),_0x1423da+'-'+_0x322116+'/'+_0x58da47)[_0x4174('0x22')](_0x495956);}return null;};}function patchUpdates(_0x45a9a9){return function(_0x3ec707){try{jsonpatch['apply'](_0x3ec707,_0x45a9a9,!![]);}catch(_0x324eec){return BPromise['reject'](_0x324eec);}return _0x3ec707[_0x4174('0x23')]();};}function saveUpdates(_0x474323,_0x16656c){return function(_0x51cb50){if(_0x51cb50){return _0x51cb50[_0x4174('0x24')](_0x474323)[_0x4174('0x25')](function(_0x41881a){return _0x41881a;});}return null;};}function removeEntity(_0x545295,_0x17a135){return function(_0x3a6417){if(_0x3a6417){return _0x3a6417[_0x4174('0x26')]()['then'](function(){var _0x36be20=_0x3a6417['get']({'plain':!![]});var _0x8f8dd7=_0x4174('0x27');return db[_0x4174('0x28')]['destroy']({'where':{'type':_0x8f8dd7,'resourceId':_0x36be20['id']}})['then'](function(){return _0x3a6417;});})['then'](function(){_0x545295[_0x4174('0x1a')](0xcc)[_0x4174('0x1b')]();});}};}function handleEntityNotFound(_0x4557b9,_0x6c162f){return function(_0x52ac33){if(!_0x52ac33){_0x4557b9[_0x4174('0x19')](0x194);}return _0x52ac33;};}function handleError(_0x34e6e1,_0x3fc152){_0x3fc152=_0x3fc152||0x1f4;return function(_0x556927){logger[_0x4174('0x29')](_0x556927[_0x4174('0x2a')]);if(_0x556927['name']){delete _0x556927[_0x4174('0x2b')];}_0x34e6e1[_0x4174('0x1a')](_0x3fc152)[_0x4174('0x2c')](_0x556927);};}exports[_0x4174('0x2d')]=function(_0x863fd0,_0x3aefed){var _0x1e3fac={},_0xe37eb2={},_0x1ac7f0={'count':0x0,'rows':[]};var _0x4ca971=_[_0x4174('0x2e')](db[_0x4174('0x2f')]['rawAttributes'],function(_0x1d0a73){return{'name':_0x1d0a73[_0x4174('0x30')],'type':_0x1d0a73['type'][_0x4174('0x31')]};});_0xe37eb2[_0x4174('0x32')]=_[_0x4174('0x2e')](_0x4ca971,_0x4174('0x2b'));_0xe37eb2[_0x4174('0x33')]=_[_0x4174('0x34')](_0x863fd0[_0x4174('0x33')]);_0xe37eb2['filters']=_['intersection'](_0xe37eb2[_0x4174('0x32')],_0xe37eb2[_0x4174('0x33')]);_0x1e3fac[_0x4174('0x35')]=_['intersection'](_0xe37eb2[_0x4174('0x32')],qs[_0x4174('0x36')](_0x863fd0[_0x4174('0x33')][_0x4174('0x36')]));_0x1e3fac[_0x4174('0x35')]=_0x1e3fac['attributes'][_0x4174('0x37')]?_0x1e3fac['attributes']:_0xe37eb2[_0x4174('0x32')];if(!_0x863fd0[_0x4174('0x33')][_0x4174('0x38')](_0x4174('0x39'))){_0x1e3fac[_0x4174('0x1d')]=qs['limit'](_0x863fd0[_0x4174('0x33')][_0x4174('0x1d')]);_0x1e3fac[_0x4174('0x1c')]=qs[_0x4174('0x1c')](_0x863fd0['query'][_0x4174('0x1c')]);}_0x1e3fac[_0x4174('0x3a')]=qs[_0x4174('0x3b')](_0x863fd0['query']['sort']);_0x1e3fac['where']=qs['filters'](_[_0x4174('0x3c')](_0x863fd0[_0x4174('0x33')],_0xe37eb2[_0x4174('0x3d')]),_0x4ca971);if(_0x863fd0['query'][_0x4174('0x3e')]){_0x1e3fac['where']=_[_0x4174('0x3f')](_0x1e3fac[_0x4174('0x40')],{'$or':_[_0x4174('0x2e')](_0x4ca971,function(_0x3b2843){if(_0x3b2843[_0x4174('0x41')]!==_0x4174('0x42')){var _0x2ae82f={};_0x2ae82f[_0x3b2843['name']]={'$like':'%'+_0x863fd0[_0x4174('0x33')][_0x4174('0x3e')]+'%'};return _0x2ae82f;}})});}_0x1e3fac=_[_0x4174('0x3f')]({},_0x1e3fac,_0x863fd0['options']);var _0x210570={'where':_0x1e3fac[_0x4174('0x40')]};return db[_0x4174('0x2f')]['count'](_0x210570)['then'](function(_0x4ce0e5){_0x1ac7f0[_0x4174('0x1f')]=_0x4ce0e5;if(_0x863fd0[_0x4174('0x33')]['includeAll']){_0x1e3fac[_0x4174('0x43')]=[{'all':!![]}];}return db[_0x4174('0x2f')][_0x4174('0x44')](_0x1e3fac);})['then'](function(_0x3c3e19){_0x1ac7f0[_0x4174('0x45')]=_0x3c3e19;return _0x1ac7f0;})['then'](respondWithFilteredResult(_0x3aefed,_0x1e3fac))[_0x4174('0x46')](handleError(_0x3aefed,null));};exports[_0x4174('0x47')]=function(_0x671bc5,_0x1f0e0e){var _0x1ea651={'raw':![],'where':{'id':_0x671bc5[_0x4174('0x48')]['id']}},_0x1d81ad={};_0x1d81ad['model']=_[_0x4174('0x34')](db[_0x4174('0x2f')][_0x4174('0x49')]);_0x1d81ad[_0x4174('0x33')]=_[_0x4174('0x34')](_0x671bc5[_0x4174('0x33')]);_0x1d81ad['filters']=_[_0x4174('0x4a')](_0x1d81ad[_0x4174('0x32')],_0x1d81ad[_0x4174('0x33')]);_0x1ea651[_0x4174('0x35')]=_[_0x4174('0x4a')](_0x1d81ad[_0x4174('0x32')],qs[_0x4174('0x36')](_0x671bc5['query'][_0x4174('0x36')]));_0x1ea651[_0x4174('0x35')]=_0x1ea651[_0x4174('0x35')][_0x4174('0x37')]?_0x1ea651[_0x4174('0x35')]:_0x1d81ad[_0x4174('0x32')];if(_0x671bc5[_0x4174('0x33')][_0x4174('0x4b')]){_0x1ea651[_0x4174('0x43')]=[{'all':!![]}];}_0x1ea651=_['merge']({},_0x1ea651,_0x671bc5[_0x4174('0x4c')]);return db[_0x4174('0x2f')][_0x4174('0x4d')](_0x1ea651)[_0x4174('0x25')](handleEntityNotFound(_0x1f0e0e,null))['then'](respondWithResult(_0x1f0e0e,null))[_0x4174('0x46')](handleError(_0x1f0e0e,null));};exports[_0x4174('0x4e')]=function(_0x77bf73,_0x291c29){return db[_0x4174('0x2f')][_0x4174('0x4e')](_0x77bf73['body'],{})['then'](function(_0x3d3beb){var _0x4ba7b1=_0x77bf73[_0x4174('0x4f')][_0x4174('0x50')]({'plain':!![]});if(!_0x4ba7b1)throw new Error(_0x4174('0x51'));if(_0x4ba7b1[_0x4174('0x52')]===_0x4174('0x4f')){var _0x3d15d1=_0x3d3beb[_0x4174('0x50')]({'plain':!![]});var _0x163231='Triggers';return db['UserProfileSection'][_0x4174('0x4d')]({'where':{'name':_0x163231,'userProfileId':_0x4ba7b1[_0x4174('0x53')]},'raw':!![]})[_0x4174('0x25')](function(_0x2ad2b4){if(_0x2ad2b4&&_0x2ad2b4[_0x4174('0x54')]===0x0){return db[_0x4174('0x28')][_0x4174('0x4e')]({'name':_0x3d15d1[_0x4174('0x2b')],'resourceId':_0x3d15d1['id'],'type':_0x2ad2b4[_0x4174('0x2b')],'sectionId':_0x2ad2b4['id']},{})[_0x4174('0x25')](function(){return _0x3d3beb;});}else{return _0x3d3beb;}})[_0x4174('0x46')](function(_0x4ba9b6){logger[_0x4174('0x29')](_0x4174('0x55'),_0x4ba9b6);throw _0x4ba9b6;});}return _0x3d3beb;})[_0x4174('0x25')](respondWithResult(_0x291c29,0xc9))['catch'](handleError(_0x291c29,null));};exports['update']=function(_0x237099,_0x309b54){if(_0x237099[_0x4174('0x56')]['id']){delete _0x237099[_0x4174('0x56')]['id'];}return db[_0x4174('0x2f')][_0x4174('0x4d')]({'where':{'id':_0x237099[_0x4174('0x48')]['id']}})[_0x4174('0x25')](handleEntityNotFound(_0x309b54,null))[_0x4174('0x25')](saveUpdates(_0x237099['body'],null))['then'](respondWithResult(_0x309b54,null))[_0x4174('0x46')](handleError(_0x309b54,null));};exports[_0x4174('0x26')]=function(_0x8293fc,_0x300c38){return db['Trigger']['find']({'where':{'id':_0x8293fc[_0x4174('0x48')]['id']}})['then'](handleEntityNotFound(_0x300c38,null))[_0x4174('0x25')](removeEntity(_0x300c38,null))['catch'](handleError(_0x300c38,null));};exports[_0x4174('0x57')]=function(_0x18625c,_0x4d0f0e,_0x2460de){if(_0x18625c[_0x4174('0x56')]['id']){delete _0x18625c[_0x4174('0x56')]['id'];}return db[_0x4174('0x2f')][_0x4174('0x4d')]({'where':{'id':_0x18625c['params']['id']}})['then'](handleEntityNotFound(_0x4d0f0e,null))[_0x4174('0x25')](function(_0x13ebbd){if(_0x13ebbd){_0x18625c[_0x4174('0x56')][_0x4174('0x58')]=_0x13ebbd['id'];return db[_0x4174('0x59')][_0x4174('0x4e')](_0x18625c[_0x4174('0x56')]);}})[_0x4174('0x25')](respondWithResult(_0x4d0f0e,null))[_0x4174('0x46')](handleError(_0x4d0f0e,null));};exports[_0x4174('0x5a')]=function(_0x3c5528,_0x469454,_0x4446b1){if(_0x3c5528[_0x4174('0x56')]['id']){delete _0x3c5528['body']['id'];}return db[_0x4174('0x2f')][_0x4174('0x4d')]({'where':{'id':_0x3c5528[_0x4174('0x48')]['id']}})[_0x4174('0x25')](handleEntityNotFound(_0x469454,null))['then'](function(_0x5b2f64){if(_0x5b2f64){_0x3c5528[_0x4174('0x56')]['TriggerAnyId']=_0x5b2f64['id'];return db[_0x4174('0x59')][_0x4174('0x4e')](_0x3c5528[_0x4174('0x56')]);}})[_0x4174('0x25')](respondWithResult(_0x469454,null))[_0x4174('0x46')](handleError(_0x469454,null));};exports[_0x4174('0x5b')]=function(_0x2cb35e,_0x14fc1d,_0x1d0b04){var _0x12ae8c={};var _0x36a90e={};var _0x114fc5;var _0x14963e;return db[_0x4174('0x2f')][_0x4174('0x5c')]({'where':{'id':_0x2cb35e[_0x4174('0x48')]['id']}})[_0x4174('0x25')](handleEntityNotFound(_0x14fc1d,null))['then'](function(_0x31fc41){if(_0x31fc41){_0x114fc5=_0x31fc41;_0x36a90e[_0x4174('0x32')]=_[_0x4174('0x34')](db[_0x4174('0x59')][_0x4174('0x49')]);_0x36a90e['query']=_[_0x4174('0x34')](_0x2cb35e[_0x4174('0x33')]);_0x36a90e[_0x4174('0x3d')]=_[_0x4174('0x4a')](_0x36a90e[_0x4174('0x32')],_0x36a90e['query']);_0x12ae8c[_0x4174('0x35')]=_[_0x4174('0x4a')](_0x36a90e[_0x4174('0x32')],qs[_0x4174('0x36')](_0x2cb35e[_0x4174('0x33')][_0x4174('0x36')]));_0x12ae8c['attributes']=_0x12ae8c[_0x4174('0x35')][_0x4174('0x37')]?_0x12ae8c[_0x4174('0x35')]:_0x36a90e['model'];_0x12ae8c['order']=qs[_0x4174('0x3b')](_0x2cb35e[_0x4174('0x33')][_0x4174('0x3b')]);_0x12ae8c[_0x4174('0x40')]=qs['filters'](_['pick'](_0x2cb35e[_0x4174('0x33')],_0x36a90e['filters']));if(_0x2cb35e['query']['filter']){_0x12ae8c[_0x4174('0x40')]=_[_0x4174('0x3f')](_0x12ae8c['where'],{'$or':_[_0x4174('0x2e')](_0x12ae8c['attributes'],function(_0x195705){var _0x236de0={};_0x236de0[_0x195705]={'$like':'%'+_0x2cb35e[_0x4174('0x33')][_0x4174('0x3e')]+'%'};return _0x236de0;})});}_0x12ae8c=_[_0x4174('0x3f')]({},_0x12ae8c,_0x2cb35e[_0x4174('0x4c')]);return _0x114fc5[_0x4174('0x5b')](_0x12ae8c);}})[_0x4174('0x25')](function(_0x563e2c){if(_0x563e2c){_0x14963e=_0x563e2c[_0x4174('0x37')];if(!_0x2cb35e[_0x4174('0x33')][_0x4174('0x38')](_0x4174('0x39'))){_0x12ae8c['limit']=qs[_0x4174('0x1d')](_0x2cb35e[_0x4174('0x33')][_0x4174('0x1d')]);_0x12ae8c[_0x4174('0x1c')]=qs[_0x4174('0x1c')](_0x2cb35e['query']['offset']);}return _0x114fc5[_0x4174('0x5b')](_0x12ae8c);}})[_0x4174('0x25')](function(_0x3ff49a){if(_0x3ff49a){return _0x3ff49a?{'count':_0x14963e,'rows':_0x3ff49a}:null;}})[_0x4174('0x25')](respondWithResult(_0x14fc1d,null))[_0x4174('0x46')](handleError(_0x14fc1d,null));};exports[_0x4174('0x5d')]=function(_0x906267,_0x24d7a3,_0x37151b){var _0x461062={};var _0x4493fb={};var _0x59e607;var _0x1832a2;return db[_0x4174('0x2f')][_0x4174('0x5c')]({'where':{'id':_0x906267[_0x4174('0x48')]['id']}})['then'](handleEntityNotFound(_0x24d7a3,null))[_0x4174('0x25')](function(_0x42819e){if(_0x42819e){_0x59e607=_0x42819e;_0x4493fb[_0x4174('0x32')]=_['keys'](db['Condition'][_0x4174('0x49')]);_0x4493fb[_0x4174('0x33')]=_[_0x4174('0x34')](_0x906267[_0x4174('0x33')]);_0x4493fb[_0x4174('0x3d')]=_[_0x4174('0x4a')](_0x4493fb[_0x4174('0x32')],_0x4493fb[_0x4174('0x33')]);_0x461062['attributes']=_['intersection'](_0x4493fb[_0x4174('0x32')],qs[_0x4174('0x36')](_0x906267[_0x4174('0x33')][_0x4174('0x36')]));_0x461062[_0x4174('0x35')]=_0x461062['attributes']['length']?_0x461062['attributes']:_0x4493fb[_0x4174('0x32')];_0x461062['order']=qs[_0x4174('0x3b')](_0x906267['query'][_0x4174('0x3b')]);_0x461062['where']=qs[_0x4174('0x3d')](_[_0x4174('0x3c')](_0x906267['query'],_0x4493fb[_0x4174('0x3d')]));if(_0x906267[_0x4174('0x33')]['filter']){_0x461062[_0x4174('0x40')]=_[_0x4174('0x3f')](_0x461062[_0x4174('0x40')],{'$or':_[_0x4174('0x2e')](_0x461062[_0x4174('0x35')],function(_0x37cf8a){var _0x4e86fe={};_0x4e86fe[_0x37cf8a]={'$like':'%'+_0x906267[_0x4174('0x33')][_0x4174('0x3e')]+'%'};return _0x4e86fe;})});}_0x461062=_[_0x4174('0x3f')]({},_0x461062,_0x906267[_0x4174('0x4c')]);return _0x59e607[_0x4174('0x5d')](_0x461062);}})[_0x4174('0x25')](function(_0x3b52ae){if(_0x3b52ae){_0x1832a2=_0x3b52ae[_0x4174('0x37')];if(!_0x906267[_0x4174('0x33')][_0x4174('0x38')](_0x4174('0x39'))){_0x461062[_0x4174('0x1d')]=qs[_0x4174('0x1d')](_0x906267[_0x4174('0x33')][_0x4174('0x1d')]);_0x461062[_0x4174('0x1c')]=qs[_0x4174('0x1c')](_0x906267[_0x4174('0x33')][_0x4174('0x1c')]);}return _0x59e607[_0x4174('0x5d')](_0x461062);}})[_0x4174('0x25')](function(_0x6f4ff2){if(_0x6f4ff2){return _0x6f4ff2?{'count':_0x1832a2,'rows':_0x6f4ff2}:null;}})[_0x4174('0x25')](respondWithResult(_0x24d7a3,null))[_0x4174('0x46')](handleError(_0x24d7a3,null));};exports[_0x4174('0x5e')]=function(_0x1bd6c5,_0x1493e7,_0x5f7e26){if(_0x1bd6c5[_0x4174('0x56')]['id']){delete _0x1bd6c5[_0x4174('0x56')]['id'];}return db[_0x4174('0x2f')][_0x4174('0x4d')]({'where':{'id':_0x1bd6c5[_0x4174('0x48')]['id']}})['then'](handleEntityNotFound(_0x1493e7,null))[_0x4174('0x25')](function(_0x2c3444){if(_0x2c3444){_0x1bd6c5['body'][_0x4174('0x5f')]=_0x2c3444['id'];return db[_0x4174('0x60')]['create'](_0x1bd6c5[_0x4174('0x56')]);}})[_0x4174('0x25')](respondWithResult(_0x1493e7,null))['catch'](handleError(_0x1493e7,null));};exports[_0x4174('0x61')]=function(_0x35beb3,_0x1f4154,_0x47e98e){var _0x364f8f={};var _0x10abff={};var _0x478797;var _0x111909;return db[_0x4174('0x2f')][_0x4174('0x5c')]({'where':{'id':_0x35beb3[_0x4174('0x48')]['id']}})[_0x4174('0x25')](handleEntityNotFound(_0x1f4154,null))[_0x4174('0x25')](function(_0x1e4821){if(_0x1e4821){_0x478797=_0x1e4821;_0x10abff[_0x4174('0x32')]=_[_0x4174('0x34')](db['Action'][_0x4174('0x49')]);_0x10abff[_0x4174('0x33')]=_[_0x4174('0x34')](_0x35beb3[_0x4174('0x33')]);_0x10abff[_0x4174('0x3d')]=_[_0x4174('0x4a')](_0x10abff[_0x4174('0x32')],_0x10abff[_0x4174('0x33')]);_0x364f8f[_0x4174('0x35')]=_[_0x4174('0x4a')](_0x10abff[_0x4174('0x32')],qs['fields'](_0x35beb3[_0x4174('0x33')][_0x4174('0x36')]));_0x364f8f['attributes']=_0x364f8f[_0x4174('0x35')][_0x4174('0x37')]?_0x364f8f['attributes']:_0x10abff[_0x4174('0x32')];_0x364f8f['order']=qs[_0x4174('0x3b')](_0x35beb3[_0x4174('0x33')][_0x4174('0x3b')]);_0x364f8f[_0x4174('0x40')]=qs['filters'](_[_0x4174('0x3c')](_0x35beb3['query'],_0x10abff[_0x4174('0x3d')]));if(_0x35beb3[_0x4174('0x33')][_0x4174('0x3e')]){_0x364f8f[_0x4174('0x40')]=_[_0x4174('0x3f')](_0x364f8f['where'],{'$or':_[_0x4174('0x2e')](_0x364f8f[_0x4174('0x35')],function(_0x26560d){var _0x38b606={};_0x38b606[_0x26560d]={'$like':'%'+_0x35beb3['query'][_0x4174('0x3e')]+'%'};return _0x38b606;})});}_0x364f8f=_[_0x4174('0x3f')]({},_0x364f8f,_0x35beb3[_0x4174('0x4c')]);return _0x478797[_0x4174('0x61')](_0x364f8f);}})[_0x4174('0x25')](function(_0x301aab){if(_0x301aab){_0x111909=_0x301aab[_0x4174('0x37')];if(!_0x35beb3[_0x4174('0x33')]['hasOwnProperty'](_0x4174('0x39'))){_0x364f8f[_0x4174('0x1d')]=qs[_0x4174('0x1d')](_0x35beb3[_0x4174('0x33')][_0x4174('0x1d')]);_0x364f8f['offset']=qs[_0x4174('0x1c')](_0x35beb3[_0x4174('0x33')][_0x4174('0x1c')]);}return _0x478797['getActions'](_0x364f8f);}})[_0x4174('0x25')](function(_0x447fd5){if(_0x447fd5){return _0x447fd5?{'count':_0x111909,'rows':_0x447fd5}:null;}})[_0x4174('0x25')](respondWithResult(_0x1f4154,null))[_0x4174('0x46')](handleError(_0x1f4154,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8156b5d..1487761 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 _0x078c=['path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x33e0f1,_0xc31088){var _0x500b8e=function(_0x3ac721){while(--_0x3ac721){_0x33e0f1['push'](_0x33e0f1['shift']());}};_0x500b8e(++_0xc31088);}(_0x078c,0x19f));var _0xc078=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x078c[_0x11e30d];return _0x2d4e29;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var logger=require(_0xc078('0x1'))(_0xc078('0x2'));var moment=require('moment');var BPromise=require(_0xc078('0x3'));var rp=require(_0xc078('0x4'));var fs=require('fs');var path=require(_0xc078('0x5'));var rimraf=require(_0xc078('0x6'));var config=require('../../config/environment');var attributes=require(_0xc078('0x7'));module[_0xc078('0x8')]=function(_0x394068,_0x24b241){return _0x394068[_0xc078('0x9')](_0xc078('0xa'),attributes,{'tableName':_0xc078('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32ff=['exports','define','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x26ba23,_0x17f028){var _0x5e2cd2=function(_0x414249){while(--_0x414249){_0x26ba23['push'](_0x26ba23['shift']());}};_0x5e2cd2(++_0x17f028);}(_0x32ff,0xc7));var _0xf32f=function(_0x18f008,_0x2809a7){_0x18f008=_0x18f008-0x0;var _0x43b6a4=_0x32ff[_0x18f008];return _0x43b6a4;};'use strict';var _=require(_0xf32f('0x0'));var util=require(_0xf32f('0x1'));var logger=require(_0xf32f('0x2'))(_0xf32f('0x3'));var moment=require(_0xf32f('0x4'));var BPromise=require(_0xf32f('0x5'));var rp=require(_0xf32f('0x6'));var fs=require('fs');var path=require(_0xf32f('0x7'));var rimraf=require(_0xf32f('0x8'));var config=require(_0xf32f('0x9'));var attributes=require(_0xf32f('0xa'));module[_0xf32f('0xb')]=function(_0x2a209f,_0x5e5080){return _0x2a209f[_0xf32f('0xc')]('Trigger',attributes,{'tableName':_0xf32f('0xd'),'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 5f7dd55..30c7a76 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 _0x0ca7=['Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrigger','findAll','options','raw','where','attributes','limit','map','include','model','ShowTrigger','Trigger','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x1ad159,_0x12c5d7){var _0x27eb2c=function(_0x2e6433){while(--_0x2e6433){_0x1ad159['push'](_0x1ad159['shift']());}};_0x27eb2c(++_0x12c5d7);}(_0x0ca7,0xcb));var _0x70ca=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x0ca7[_0x3d27a];return _0x314fd7;};'use strict';var _=require(_0x70ca('0x0'));var util=require(_0x70ca('0x1'));var moment=require(_0x70ca('0x2'));var BPromise=require(_0x70ca('0x3'));var rs=require(_0x70ca('0x4'));var fs=require('fs');var Redis=require(_0x70ca('0x5'));var db=require(_0x70ca('0x6'))['db'];var utils=require(_0x70ca('0x7'));var logger=require(_0x70ca('0x8'))('rpc');var config=require(_0x70ca('0x9'));var jayson=require(_0x70ca('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dc768,_0x1eb10d,_0x20ea07){return new BPromise(function(_0x36151c,_0x39a30b){return client[_0x70ca('0xb')](_0x1dc768,_0x20ea07)[_0x70ca('0xc')](function(_0x5b1e42){logger['info'](_0x70ca('0xd'),_0x1eb10d,_0x70ca('0xe'));logger[_0x70ca('0xf')](_0x70ca('0x10'),_0x1eb10d,'request\x20sent',JSON[_0x70ca('0x11')](_0x5b1e42));if(_0x5b1e42['error']){if(_0x5b1e42[_0x70ca('0x12')]['code']===0x1f4){logger['error'](_0x70ca('0xd'),_0x1eb10d,_0x5b1e42[_0x70ca('0x12')][_0x70ca('0x13')]);return _0x39a30b(_0x5b1e42[_0x70ca('0x12')]['message']);}logger[_0x70ca('0x12')](_0x70ca('0xd'),_0x1eb10d,_0x5b1e42[_0x70ca('0x12')]['message']);return _0x36151c(_0x5b1e42[_0x70ca('0x12')]['message']);}else{logger[_0x70ca('0x14')](_0x70ca('0xd'),_0x1eb10d,_0x70ca('0xe'));_0x36151c(_0x5b1e42[_0x70ca('0x15')][_0x70ca('0x13')]);}})['catch'](function(_0x365b4a){logger[_0x70ca('0x12')](_0x70ca('0xd'),_0x1eb10d,_0x365b4a);_0x39a30b(_0x365b4a);});});}exports[_0x70ca('0x16')]=function(_0x5007e8){var _0x5dcb96=this;return new Promise(function(_0x584d40,_0x4a35b3){return db['Trigger'][_0x70ca('0x17')]({'raw':_0x5007e8[_0x70ca('0x18')]?_0x5007e8[_0x70ca('0x18')][_0x70ca('0x19')]===undefined?!![]:![]:!![],'where':_0x5007e8[_0x70ca('0x18')]?_0x5007e8[_0x70ca('0x18')][_0x70ca('0x1a')]||null:null,'attributes':_0x5007e8[_0x70ca('0x18')]?_0x5007e8['options'][_0x70ca('0x1b')]||null:null,'limit':_0x5007e8['options']?_0x5007e8['options'][_0x70ca('0x1c')]||null:null,'include':_0x5007e8[_0x70ca('0x18')]?_0x5007e8['options']['include']?_[_0x70ca('0x1d')](_0x5007e8[_0x70ca('0x18')]['include'],function(_0x2add01){return{'model':db[_0x2add01['model']],'as':_0x2add01['as'],'attributes':_0x2add01['attributes'],'include':_0x2add01[_0x70ca('0x1e')]?_[_0x70ca('0x1d')](_0x2add01[_0x70ca('0x1e')],function(_0xf9b00d){return{'model':db[_0xf9b00d['model']],'as':_0xf9b00d['as'],'attributes':_0xf9b00d[_0x70ca('0x1b')],'include':_0xf9b00d[_0x70ca('0x1e')]?_[_0x70ca('0x1d')](_0xf9b00d[_0x70ca('0x1e')],function(_0x26a7f7){return{'model':db[_0x26a7f7[_0x70ca('0x1f')]],'as':_0x26a7f7['as'],'attributes':_0x26a7f7[_0x70ca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x70ca('0xc')](function(_0x5d0464){logger['info'](_0x70ca('0x16'),_0x5007e8);logger[_0x70ca('0xf')](_0x70ca('0x16'),_0x5007e8,JSON['stringify'](_0x5d0464));_0x584d40(_0x5d0464);})['catch'](function(_0x2566f5){logger[_0x70ca('0x12')](_0x70ca('0x16'),_0x2566f5[_0x70ca('0x13')],_0x5007e8);_0x4a35b3(_0x5dcb96[_0x70ca('0x12')](0x1f4,_0x2566f5[_0x70ca('0x13')]));});});};exports[_0x70ca('0x20')]=function(_0x19cc34){var _0x2aefef=this;return new Promise(function(_0x208c1c,_0x3db94d){return db[_0x70ca('0x21')][_0x70ca('0x22')]({'raw':_0x19cc34[_0x70ca('0x18')]?_0x19cc34[_0x70ca('0x18')][_0x70ca('0x19')]===undefined?!![]:![]:!![],'where':_0x19cc34[_0x70ca('0x18')]?_0x19cc34['options'][_0x70ca('0x1a')]||null:null,'attributes':_0x19cc34['options']?_0x19cc34[_0x70ca('0x18')][_0x70ca('0x1b')]||null:null,'include':_0x19cc34['options']?_0x19cc34[_0x70ca('0x18')][_0x70ca('0x1e')]?_[_0x70ca('0x1d')](_0x19cc34[_0x70ca('0x18')][_0x70ca('0x1e')],function(_0x3f1818){return{'model':db[_0x3f1818[_0x70ca('0x1f')]],'as':_0x3f1818['as'],'attributes':_0x3f1818[_0x70ca('0x1b')],'include':_0x3f1818['include']?_[_0x70ca('0x1d')](_0x3f1818[_0x70ca('0x1e')],function(_0x3e6a00){return{'model':db[_0x3e6a00[_0x70ca('0x1f')]],'as':_0x3e6a00['as'],'attributes':_0x3e6a00[_0x70ca('0x1b')],'include':_0x3e6a00['include']?_[_0x70ca('0x1d')](_0x3e6a00[_0x70ca('0x1e')],function(_0x143546){return{'model':db[_0x143546['model']],'as':_0x143546['as'],'attributes':_0x143546[_0x70ca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x70ca('0xc')](function(_0x15ae67){logger['info'](_0x70ca('0x20'),_0x19cc34);logger[_0x70ca('0xf')](_0x70ca('0x20'),_0x19cc34,JSON[_0x70ca('0x11')](_0x15ae67));_0x208c1c(_0x15ae67);})[_0x70ca('0x23')](function(_0x3ea677){logger[_0x70ca('0x12')](_0x70ca('0x20'),_0x3ea677[_0x70ca('0x13')],_0x19cc34);_0x3db94d(_0x2aefef[_0x70ca('0x12')](0x1f4,_0x3ea677['message']));});});}; \ No newline at end of file +var _0x2c99=['result','catch','GetTrigger','options','raw','where','attributes','map','include','model','ShowTrigger','Trigger','find','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x2c99,0x179));var _0x92c9=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x2c99[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x92c9('0x0'));var util=require('util');var moment=require(_0x92c9('0x1'));var BPromise=require(_0x92c9('0x2'));var rs=require(_0x92c9('0x3'));var fs=require('fs');var Redis=require(_0x92c9('0x4'));var db=require(_0x92c9('0x5'))['db'];var utils=require(_0x92c9('0x6'));var logger=require('../../config/logger')(_0x92c9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x92c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30c2dd,_0x27ab20,_0x234786){return new BPromise(function(_0x198914,_0x4f11c2){return client[_0x92c9('0x9')](_0x30c2dd,_0x234786)[_0x92c9('0xa')](function(_0x58fec1){logger[_0x92c9('0xb')](_0x92c9('0xc'),_0x27ab20,_0x92c9('0xd'));logger['debug'](_0x92c9('0xe'),_0x27ab20,_0x92c9('0xd'),JSON[_0x92c9('0xf')](_0x58fec1));if(_0x58fec1[_0x92c9('0x10')]){if(_0x58fec1['error'][_0x92c9('0x11')]===0x1f4){logger[_0x92c9('0x10')]('Trigger,\x20%s,\x20%s',_0x27ab20,_0x58fec1[_0x92c9('0x10')][_0x92c9('0x12')]);return _0x4f11c2(_0x58fec1[_0x92c9('0x10')][_0x92c9('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x27ab20,_0x58fec1[_0x92c9('0x10')][_0x92c9('0x12')]);return _0x198914(_0x58fec1[_0x92c9('0x10')][_0x92c9('0x12')]);}else{logger[_0x92c9('0xb')](_0x92c9('0xc'),_0x27ab20,_0x92c9('0xd'));_0x198914(_0x58fec1[_0x92c9('0x13')][_0x92c9('0x12')]);}})[_0x92c9('0x14')](function(_0x1cc080){logger[_0x92c9('0x10')](_0x92c9('0xc'),_0x27ab20,_0x1cc080);_0x4f11c2(_0x1cc080);});});}exports[_0x92c9('0x15')]=function(_0x52db12){var _0x565f5a=this;return new Promise(function(_0x2dca42,_0x1e2fd1){return db['Trigger']['findAll']({'raw':_0x52db12['options']?_0x52db12[_0x92c9('0x16')][_0x92c9('0x17')]===undefined?!![]:![]:!![],'where':_0x52db12[_0x92c9('0x16')]?_0x52db12[_0x92c9('0x16')][_0x92c9('0x18')]||null:null,'attributes':_0x52db12['options']?_0x52db12['options'][_0x92c9('0x19')]||null:null,'limit':_0x52db12[_0x92c9('0x16')]?_0x52db12[_0x92c9('0x16')]['limit']||null:null,'include':_0x52db12['options']?_0x52db12['options']['include']?_[_0x92c9('0x1a')](_0x52db12['options'][_0x92c9('0x1b')],function(_0x3351d0){return{'model':db[_0x3351d0[_0x92c9('0x1c')]],'as':_0x3351d0['as'],'attributes':_0x3351d0[_0x92c9('0x19')],'include':_0x3351d0['include']?_[_0x92c9('0x1a')](_0x3351d0[_0x92c9('0x1b')],function(_0x48fb48){return{'model':db[_0x48fb48['model']],'as':_0x48fb48['as'],'attributes':_0x48fb48['attributes'],'include':_0x48fb48[_0x92c9('0x1b')]?_[_0x92c9('0x1a')](_0x48fb48[_0x92c9('0x1b')],function(_0x39ce38){return{'model':db[_0x39ce38['model']],'as':_0x39ce38['as'],'attributes':_0x39ce38[_0x92c9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1de5e3){logger[_0x92c9('0xb')](_0x92c9('0x15'),_0x52db12);logger['debug'](_0x92c9('0x15'),_0x52db12,JSON[_0x92c9('0xf')](_0x1de5e3));_0x2dca42(_0x1de5e3);})[_0x92c9('0x14')](function(_0x144cb9){logger[_0x92c9('0x10')](_0x92c9('0x15'),_0x144cb9[_0x92c9('0x12')],_0x52db12);_0x1e2fd1(_0x565f5a[_0x92c9('0x10')](0x1f4,_0x144cb9[_0x92c9('0x12')]));});});};exports[_0x92c9('0x1d')]=function(_0x3ffc5a){var _0xa7ed7a=this;return new Promise(function(_0x3b3004,_0x251cd0){return db[_0x92c9('0x1e')][_0x92c9('0x1f')]({'raw':_0x3ffc5a[_0x92c9('0x16')]?_0x3ffc5a[_0x92c9('0x16')][_0x92c9('0x17')]===undefined?!![]:![]:!![],'where':_0x3ffc5a['options']?_0x3ffc5a[_0x92c9('0x16')]['where']||null:null,'attributes':_0x3ffc5a[_0x92c9('0x16')]?_0x3ffc5a['options'][_0x92c9('0x19')]||null:null,'include':_0x3ffc5a['options']?_0x3ffc5a[_0x92c9('0x16')]['include']?_[_0x92c9('0x1a')](_0x3ffc5a[_0x92c9('0x16')][_0x92c9('0x1b')],function(_0x3aa537){return{'model':db[_0x3aa537[_0x92c9('0x1c')]],'as':_0x3aa537['as'],'attributes':_0x3aa537[_0x92c9('0x19')],'include':_0x3aa537[_0x92c9('0x1b')]?_[_0x92c9('0x1a')](_0x3aa537[_0x92c9('0x1b')],function(_0x5aa127){return{'model':db[_0x5aa127[_0x92c9('0x1c')]],'as':_0x5aa127['as'],'attributes':_0x5aa127['attributes'],'include':_0x5aa127[_0x92c9('0x1b')]?_['map'](_0x5aa127[_0x92c9('0x1b')],function(_0x33a3e1){return{'model':db[_0x33a3e1[_0x92c9('0x1c')]],'as':_0x33a3e1['as'],'attributes':_0x33a3e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x92c9('0xa')](function(_0x47c01e){logger[_0x92c9('0xb')](_0x92c9('0x1d'),_0x3ffc5a);logger[_0x92c9('0x20')](_0x92c9('0x1d'),_0x3ffc5a,JSON['stringify'](_0x47c01e));_0x3b3004(_0x47c01e);})['catch'](function(_0xe37511){logger[_0x92c9('0x10')]('ShowTrigger',_0xe37511[_0x92c9('0x12')],_0x3ffc5a);_0x251cd0(_0xa7ed7a['error'](0x1f4,_0xe37511[_0x92c9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index be52f0a..6660f6c 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 _0x0f6d=['/:id/clone','clone','create','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','index','get','/:id','isAuthenticated','show','post'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x0f6d,0x6b));var _0xd0f6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0f6d[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require(_0xd0f6('0x0'));var path=require('path');var timeout=require(_0xd0f6('0x1'));var express=require(_0xd0f6('0x2'));var router=express['Router']();var fs_extra=require(_0xd0f6('0x3'));var auth=require(_0xd0f6('0x4'));var interaction=require(_0xd0f6('0x5'));var config=require('../../config/environment');var controller=require(_0xd0f6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd0f6('0x7')]);router[_0xd0f6('0x8')](_0xd0f6('0x9'),auth[_0xd0f6('0xa')](),controller[_0xd0f6('0xb')]);router[_0xd0f6('0xc')](_0xd0f6('0xd'),auth[_0xd0f6('0xa')](),controller[_0xd0f6('0xe')]);router[_0xd0f6('0xc')]('/',auth[_0xd0f6('0xa')](),controller[_0xd0f6('0xf')]);router[_0xd0f6('0x10')](_0xd0f6('0x9'),auth['isAuthenticated'](),controller[_0xd0f6('0x11')]);router[_0xd0f6('0x12')](_0xd0f6('0x9'),auth[_0xd0f6('0xa')](),controller['destroy']);module[_0xd0f6('0x13')]=router; \ No newline at end of file +var _0x52a1=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','clone','put','/:id','update'];(function(_0x1f9931,_0x2f3973){var _0x4a7ce1=function(_0x19b2b2){while(--_0x19b2b2){_0x1f9931['push'](_0x1f9931['shift']());}};_0x4a7ce1(++_0x2f3973);}(_0x52a1,0x1a5));var _0x152a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x52a1[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x152a('0x0'));var util=require(_0x152a('0x1'));var path=require(_0x152a('0x2'));var timeout=require('connect-timeout');var express=require(_0x152a('0x3'));var router=express[_0x152a('0x4')]();var fs_extra=require(_0x152a('0x5'));var auth=require(_0x152a('0x6'));var interaction=require(_0x152a('0x7'));var config=require(_0x152a('0x8'));var controller=require(_0x152a('0x9'));router[_0x152a('0xa')]('/',auth[_0x152a('0xb')](),controller['index']);router[_0x152a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x152a('0xc')]);router[_0x152a('0xd')](_0x152a('0xe'),auth[_0x152a('0xb')](),controller[_0x152a('0xf')]);router[_0x152a('0xd')]('/',auth[_0x152a('0xb')](),controller['create']);router[_0x152a('0x10')](_0x152a('0x11'),auth[_0x152a('0xb')](),controller[_0x152a('0x12')]);router[_0x152a('0x13')](_0x152a('0x11'),auth[_0x152a('0xb')](),controller[_0x152a('0x14')]);module[_0x152a('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index f8d6d8f..98bf819 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 _0x51e2=['udp','setDataValue','join','getDataValue','transport','rfc2833','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','peer','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x3b7382,_0x2d9f6b){var _0x7e734=function(_0xda39a9){while(--_0xda39a9){_0x3b7382['push'](_0x3b7382['shift']());}};_0x7e734(++_0x2d9f6b);}(_0x51e2,0x1ac));var _0x251e=function(_0x7ff2b4,_0x414d66){_0x7ff2b4=_0x7ff2b4-0x0;var _0xc864d8=_0x51e2[_0x7ff2b4];return _0xc864d8;};'use strict';var Sequelize=require(_0x251e('0x0'));module[_0x251e('0x1')]={'name':{'type':Sequelize[_0x251e('0x2')],'allowNull':![],'unique':_0x251e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x251e('0x4'),'user',_0x251e('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x251e('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x251e('0x6')]('ALLOWED_NOT_SCREENED',_0x251e('0x7'),_0x251e('0x8'),_0x251e('0x9'),_0x251e('0xa'),_0x251e('0xb'),_0x251e('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x251e('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x251e('0x2')]},'transport':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0xd'),'set':function(_0x4e9545){this[_0x251e('0xe')]('transport',_0x4e9545?_0x4e9545[_0x251e('0xf')](','):null);},'get':function(){return this[_0x251e('0x10')](_0x251e('0x11'))?this['getDataValue'](_0x251e('0x11'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x12'),'info','shortinfo','inband',_0x251e('0x13')),'defaultValue':_0x251e('0x12')},'directmedia':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x15'),_0x251e('0x16'),_0x251e('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x251e('0x2')]},'directmediadeny':{'type':Sequelize[_0x251e('0x2')]},'nat':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0x18'),'set':function(_0x4f4bea){this[_0x251e('0xe')]('nat',_0x4f4bea?_0x4f4bea[_0x251e('0xf')](','):null);},'get':function(){return this[_0x251e('0x10')](_0x251e('0x19'))?this[_0x251e('0x10')]('nat')[_0x251e('0x1a')](','):null;},'comment':_0x251e('0x1b')},'callgroup':{'type':Sequelize[_0x251e('0x2')]},'namedcallgroup':{'type':Sequelize[_0x251e('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x251e('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x251e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0x1c')},'allow':{'type':Sequelize[_0x251e('0x2')],'allowNull':![],'defaultValue':_0x251e('0x1d'),'set':function(_0x3ce20c){this[_0x251e('0xe')](_0x251e('0x1e'),_0x3ce20c?_0x3ce20c['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x251e('0x10')](_0x251e('0x1e'))?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x251e('0x1f')},'autoframing':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'insecure':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0x20'),'set':function(_0x6e8a5d){this[_0x251e('0xe')]('insecure',_0x6e8a5d?_0x6e8a5d[_0x251e('0xf')](','):null);},'get':function(){return this[_0x251e('0x10')](_0x251e('0x21'))?this[_0x251e('0x10')]('insecure')['split'](','):null;},'comment':_0x251e('0x22')},'trustrpid':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x23'))},'promiscredir':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x251e('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0x251e('0x24')](0xb)},'setvar':{'type':Sequelize[_0x251e('0x2')]},'callerid':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0x25')},'amaflags':{'type':Sequelize[_0x251e('0x2')]},'callcounter':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':_0x251e('0x14')},'busylevel':{'type':Sequelize[_0x251e('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x251e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x251e('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no')},'mailbox':{'type':Sequelize[_0x251e('0x2')]},'session_timers':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x27'),_0x251e('0x28'),_0x251e('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x251e('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x251e('0x6')]('uac',_0x251e('0x2a')),'defaultValue':_0x251e('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x251e('0x2')]},'fromdomain':{'type':Sequelize[_0x251e('0x2')]},'fromuser':{'type':Sequelize[_0x251e('0x2')]},'port':{'type':Sequelize[_0x251e('0x24')](0x5)},'qualify':{'type':Sequelize[_0x251e('0x6')]('yes','no'),'defaultValue':_0x251e('0x14')},'keepalive':{'type':Sequelize[_0x251e('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x251e('0x2')]},'defaultuser':{'type':Sequelize[_0x251e('0x2')]},'rtptimeout':{'type':Sequelize[_0x251e('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x251e('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x251e('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x251e('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x251e('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x251e('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x251e('0x2')]},'contactdeny':{'type':Sequelize[_0x251e('0x2')]},'contactacl':{'type':Sequelize[_0x251e('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x251e('0x2')]},'use_q850_reason':{'type':Sequelize[_0x251e('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no')},'icesupport':{'type':Sequelize[_0x251e('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x2b'),_0x251e('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x251e('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x251e('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x251e('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x251e('0x2')]},'dtlssetup':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x2d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x251e('0x2')]},'recordofffeature':{'type':Sequelize[_0x251e('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x251e('0x6')]('yes','no')},'vmexten':{'type':Sequelize[_0x251e('0x2')]},'mohinterpret':{'type':Sequelize[_0x251e('0x2')]},'mohsuggest':{'type':Sequelize[_0x251e('0x2')]},'parkinglot':{'type':Sequelize[_0x251e('0x2')]},'description':{'type':Sequelize[_0x251e('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x251e('0x2e')},'canreinvite':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x15'),'update',_0x251e('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x251e('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x251e('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x251e('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xf7ab=['ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','join','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','pai','fingerprint','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7ab,0x17d));var _0xbf7a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf7ab[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0xbf7a('0x0'));module[_0xbf7a('0x1')]={'name':{'type':Sequelize[_0xbf7a('0x2')],'allowNull':![],'unique':_0xbf7a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x5'),_0xbf7a('0x6'),_0xbf7a('0x7')),'allowNull':![],'defaultValue':_0xbf7a('0x5')},'context':{'type':Sequelize[_0xbf7a('0x2')],'allowNull':![],'defaultValue':_0xbf7a('0x8')},'callingpres':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x9'),_0xbf7a('0xa'),_0xbf7a('0xb'),_0xbf7a('0xc'),_0xbf7a('0xd'),_0xbf7a('0xe'),_0xbf7a('0xf'),_0xbf7a('0x10'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xbf7a('0x2')]},'secret':{'type':Sequelize[_0xbf7a('0x2')]},'md5secret':{'type':Sequelize[_0xbf7a('0x2')]},'remotesecret':{'type':Sequelize[_0xbf7a('0x2')]},'transport':{'type':Sequelize[_0xbf7a('0x2')],'defaultValue':_0xbf7a('0x11'),'set':function(_0x14b523){this[_0xbf7a('0x12')](_0xbf7a('0x13'),_0x14b523?_0x14b523['join'](','):null);},'get':function(){return this[_0xbf7a('0x14')](_0xbf7a('0x13'))?this[_0xbf7a('0x14')](_0xbf7a('0x13'))[_0xbf7a('0x15')](','):null;},'comment':_0xbf7a('0x16')},'dtmfmode':{'type':Sequelize[_0xbf7a('0x4')]('rfc2833',_0xbf7a('0x17'),_0xbf7a('0x18'),_0xbf7a('0x19'),_0xbf7a('0x1a')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xbf7a('0x1b'),_0xbf7a('0x1c'),_0xbf7a('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xbf7a('0x1e'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbf7a('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xbf7a('0x2')],'defaultValue':_0xbf7a('0x1f'),'set':function(_0x240c21){this[_0xbf7a('0x12')]('nat',_0x240c21?_0x240c21['join'](','):null);},'get':function(){return this[_0xbf7a('0x14')](_0xbf7a('0x20'))?this[_0xbf7a('0x14')]('nat')[_0xbf7a('0x15')](','):null;},'comment':_0xbf7a('0x21')},'callgroup':{'type':Sequelize[_0xbf7a('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xbf7a('0x2')]},'language':{'type':Sequelize[_0xbf7a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbf7a('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xbf7a('0x2')],'defaultValue':_0xbf7a('0x22')},'allow':{'type':Sequelize[_0xbf7a('0x2')],'allowNull':![],'defaultValue':_0xbf7a('0x23'),'set':function(_0xb05051){this[_0xbf7a('0x12')]('allow',_0xb05051?_0xb05051['join'](';'):_0xbf7a('0x23'));},'get':function(){return this[_0xbf7a('0x14')](_0xbf7a('0x24'))?this[_0xbf7a('0x14')](_0xbf7a('0x24'))[_0xbf7a('0x15')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no')},'insecure':{'type':Sequelize[_0xbf7a('0x2')],'defaultValue':_0xbf7a('0x25'),'set':function(_0x102aa9){this[_0xbf7a('0x12')](_0xbf7a('0x26'),_0x102aa9?_0x102aa9[_0xbf7a('0x27')](','):null);},'get':function(){return this[_0xbf7a('0x14')](_0xbf7a('0x26'))?this[_0xbf7a('0x14')](_0xbf7a('0x26'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbf7a('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no',_0xbf7a('0x28'))},'promiscredir':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'setvar':{'type':Sequelize[_0xbf7a('0x2')]},'callerid':{'type':Sequelize[_0xbf7a('0x2')],'defaultValue':_0xbf7a('0x2a')},'amaflags':{'type':Sequelize[_0xbf7a('0x2')]},'callcounter':{'type':Sequelize[_0xbf7a('0x4')]('yes','no'),'defaultValue':_0xbf7a('0x1e')},'busylevel':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xbf7a('0x1e'),'no')},'allowsubscribe':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no')},'allowtransfer':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no')},'ignoresdpversion':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xbf7a('0x2')]},'videosupport':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no',_0xbf7a('0x2b')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xbf7a('0x1e'),'no')},'mailbox':{'type':Sequelize[_0xbf7a('0x2')]},'session_timers':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x2c'),_0xbf7a('0x2d'),_0xbf7a('0x2e'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0xbf7a('0x4')]('uac','uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xbf7a('0x2')]},'regexten':{'type':Sequelize[_0xbf7a('0x2')]},'fromdomain':{'type':Sequelize[_0xbf7a('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xbf7a('0x29')](0x5)},'qualify':{'type':Sequelize[_0xbf7a('0x4')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no',_0xbf7a('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbf7a('0x2')]},'callbackextension':{'type':Sequelize[_0xbf7a('0x2')]},'timert1':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'timerb':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xbf7a('0x2')]},'contactdeny':{'type':Sequelize[_0xbf7a('0x2')]},'contactacl':{'type':Sequelize[_0xbf7a('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xbf7a('0x2')]},'use_q850_reason':{'type':Sequelize[_0xbf7a('0x2')]},'maxforwards':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'encryption':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no')},'force_avp':{'type':Sequelize[_0xbf7a('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no')},'dtlsenable':{'type':Sequelize[_0xbf7a('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no',_0xbf7a('0x30'),_0xbf7a('0x31'))},'dtlsrekey':{'type':Sequelize[_0xbf7a('0x29')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xbf7a('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xbf7a('0x32'),_0xbf7a('0x33'),_0xbf7a('0x34')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbf7a('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xbf7a('0x1e'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xbf7a('0x2')]},'call_limit':{'type':Sequelize[_0xbf7a('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbf7a('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xbf7a('0x4')](_0xbf7a('0x1e'),'no')},'vmexten':{'type':Sequelize[_0xbf7a('0x2')]},'mohinterpret':{'type':Sequelize[_0xbf7a('0x2')]},'mohsuggest':{'type':Sequelize[_0xbf7a('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xbf7a('0x4')]('yes','no',_0xbf7a('0x1b'),'update',_0xbf7a('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xbf7a('0x2')]},'otherFields':{'type':Sequelize[_0xbf7a('0x2')]},'active':{'type':Sequelize[_0xbf7a('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 94bcbeb..acad489 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 _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x171c6e,_0x3a544c){var _0x50148e=function(_0x5dff6d){while(--_0x5dff6d){_0x171c6e['push'](_0x171c6e['shift']());}};_0x50148e(++_0x3a544c);}(_0xe14d,0x1ee));var _0xde14=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe14d[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file +var _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1762d3,_0x2c66a0){var _0x502c91=function(_0x330cc3){while(--_0x330cc3){_0x1762d3['push'](_0x1762d3['shift']());}};_0x502c91(++_0x2c66a0);}(_0x55ca,0x126));var _0xa55c=function(_0x3cdf50,_0x3e8eb2){_0x3cdf50=_0x3cdf50-0x0;var _0x22d47a=_0x55ca[_0x3cdf50];return _0x22d47a;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index f9f65b0..aae266d 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 _0xbccf=['bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbccf,0xed));var _0xfbcc=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xbccf[_0x207811];return _0x170d56;};'use strict';var _=require(_0xfbcc('0x0'));var util=require('util');var logger=require(_0xfbcc('0x1'))('api');var moment=require(_0xfbcc('0x2'));var BPromise=require(_0xfbcc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbcc('0x4'));var rimraf=require(_0xfbcc('0x5'));var config=require(_0xfbcc('0x6'));var attributes=require(_0xfbcc('0x7'));module[_0xfbcc('0x8')]=function(_0x5eb8df,_0x411a41){return _0x5eb8df[_0xfbcc('0x9')](_0xfbcc('0xa'),attributes,{'tableName':_0xfbcc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5917=['../../config/logger','api','bluebird','request-promise','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x4e2fd4,_0x1ffc3f){var _0x5b5c60=function(_0x13a960){while(--_0x13a960){_0x4e2fd4['push'](_0x4e2fd4['shift']());}};_0x5b5c60(++_0x1ffc3f);}(_0x5917,0x82));var _0x7591=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5917[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x7591('0x0'));var util=require(_0x7591('0x1'));var logger=require(_0x7591('0x2'))(_0x7591('0x3'));var moment=require('moment');var BPromise=require(_0x7591('0x4'));var rp=require(_0x7591('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7591('0x6'));var config=require('../../config/environment');var attributes=require(_0x7591('0x7'));module[_0x7591('0x8')]=function(_0x39d8d6,_0x45fe62){return _0x39d8d6[_0x7591('0x9')](_0x7591('0xa'),attributes,{'tableName':_0x7591('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index b8b41ca..ec08a46 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 _0xf6d4=['raw','where','attributes','limit','map','model','include','GetTrunk','stringify','ShowTrunk','find','debug','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Trunk','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6d4,0x75));var _0x4f6d=function(_0x44438d,_0x44044b){_0x44438d=_0x44438d-0x0;var _0xf65d59=_0xf6d4[_0x44438d];return _0xf65d59;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f6d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f6d('0x1'));var db=require(_0x4f6d('0x2'))['db'];var utils=require(_0x4f6d('0x3'));var logger=require(_0x4f6d('0x4'))(_0x4f6d('0x5'));var config=require('../../config/environment');var jayson=require(_0x4f6d('0x6'));var client=jayson[_0x4f6d('0x7')][_0x4f6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a264a,_0x419b8f,_0x2fe1cf){return new BPromise(function(_0x49fe7b,_0x566333){return client[_0x4f6d('0x9')](_0x4a264a,_0x2fe1cf)[_0x4f6d('0xa')](function(_0x2e0775){logger[_0x4f6d('0xb')](_0x4f6d('0xc'),_0x419b8f,_0x4f6d('0xd'));logger['debug'](_0x4f6d('0xe'),_0x419b8f,_0x4f6d('0xd'),JSON['stringify'](_0x2e0775));if(_0x2e0775['error']){if(_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x10')]===0x1f4){logger[_0x4f6d('0xf')](_0x4f6d('0xc'),_0x419b8f,_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x11')]);return _0x566333(_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x11')]);}logger['error'](_0x4f6d('0xc'),_0x419b8f,_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x11')]);return _0x49fe7b(_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x11')]);}else{logger[_0x4f6d('0xb')](_0x4f6d('0xc'),_0x419b8f,_0x4f6d('0xd'));_0x49fe7b(_0x2e0775[_0x4f6d('0x12')][_0x4f6d('0x11')]);}})[_0x4f6d('0x13')](function(_0x475a47){logger[_0x4f6d('0xf')]('Trunk,\x20%s,\x20%s',_0x419b8f,_0x475a47);_0x566333(_0x475a47);});});}exports['GetTrunk']=function(_0x5237cd){var _0x38cf1d=this;return new Promise(function(_0x4a64ca,_0x4b4721){return db[_0x4f6d('0x14')][_0x4f6d('0x15')]({'raw':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')][_0x4f6d('0x17')]===undefined?!![]:![]:!![],'where':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')][_0x4f6d('0x18')]||null:null,'attributes':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')][_0x4f6d('0x19')]||null:null,'limit':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')][_0x4f6d('0x1a')]||null:null,'include':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')]['include']?_[_0x4f6d('0x1b')](_0x5237cd['options']['include'],function(_0x4ad8e3){return{'model':db[_0x4ad8e3[_0x4f6d('0x1c')]],'as':_0x4ad8e3['as'],'attributes':_0x4ad8e3['attributes'],'include':_0x4ad8e3[_0x4f6d('0x1d')]?_[_0x4f6d('0x1b')](_0x4ad8e3[_0x4f6d('0x1d')],function(_0x2005f0){return{'model':db[_0x2005f0[_0x4f6d('0x1c')]],'as':_0x2005f0['as'],'attributes':_0x2005f0['attributes'],'include':_0x2005f0['include']?_['map'](_0x2005f0[_0x4f6d('0x1d')],function(_0x5448bf){return{'model':db[_0x5448bf[_0x4f6d('0x1c')]],'as':_0x5448bf['as'],'attributes':_0x5448bf[_0x4f6d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4f6d('0xa')](function(_0x1ed6e3){logger[_0x4f6d('0xb')](_0x4f6d('0x1e'),_0x5237cd);logger['debug']('GetTrunk',_0x5237cd,JSON[_0x4f6d('0x1f')](_0x1ed6e3));_0x4a64ca(_0x1ed6e3);})[_0x4f6d('0x13')](function(_0x2fcf91){logger['error'](_0x4f6d('0x1e'),_0x2fcf91[_0x4f6d('0x11')],_0x5237cd);_0x4b4721(_0x38cf1d[_0x4f6d('0xf')](0x1f4,_0x2fcf91[_0x4f6d('0x11')]));});});};exports[_0x4f6d('0x20')]=function(_0x3fd30d){var _0x230d81=this;return new Promise(function(_0x1d827b,_0x478136){return db[_0x4f6d('0x14')][_0x4f6d('0x21')]({'raw':_0x3fd30d[_0x4f6d('0x16')]?_0x3fd30d[_0x4f6d('0x16')][_0x4f6d('0x17')]===undefined?!![]:![]:!![],'where':_0x3fd30d[_0x4f6d('0x16')]?_0x3fd30d[_0x4f6d('0x16')][_0x4f6d('0x18')]||null:null,'attributes':_0x3fd30d[_0x4f6d('0x16')]?_0x3fd30d['options'][_0x4f6d('0x19')]||null:null,'include':_0x3fd30d[_0x4f6d('0x16')]?_0x3fd30d[_0x4f6d('0x16')][_0x4f6d('0x1d')]?_['map'](_0x3fd30d['options'][_0x4f6d('0x1d')],function(_0x480ca4){return{'model':db[_0x480ca4[_0x4f6d('0x1c')]],'as':_0x480ca4['as'],'attributes':_0x480ca4[_0x4f6d('0x19')],'include':_0x480ca4['include']?_[_0x4f6d('0x1b')](_0x480ca4[_0x4f6d('0x1d')],function(_0x23d99e){return{'model':db[_0x23d99e[_0x4f6d('0x1c')]],'as':_0x23d99e['as'],'attributes':_0x23d99e[_0x4f6d('0x19')],'include':_0x23d99e['include']?_[_0x4f6d('0x1b')](_0x23d99e[_0x4f6d('0x1d')],function(_0x2b4c5d){return{'model':db[_0x2b4c5d[_0x4f6d('0x1c')]],'as':_0x2b4c5d['as'],'attributes':_0x2b4c5d[_0x4f6d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4f6d('0xa')](function(_0x211113){logger[_0x4f6d('0xb')](_0x4f6d('0x20'),_0x3fd30d);logger[_0x4f6d('0x22')]('ShowTrunk',_0x3fd30d,JSON[_0x4f6d('0x1f')](_0x211113));_0x1d827b(_0x211113);})[_0x4f6d('0x13')](function(_0x2de03c){logger[_0x4f6d('0xf')](_0x4f6d('0x20'),_0x2de03c['message'],_0x3fd30d);_0x478136(_0x230d81['error'](0x1f4,_0x2de03c[_0x4f6d('0x11')]));});});}; \ No newline at end of file +var _0x025d=['http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','result','GetTrunk','findAll','options','raw','where','attributes','include','map','model','stringify','catch','ShowTrunk','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2851b7,_0xa5ed82){var _0xf5df3d=function(_0x173d5d){while(--_0x173d5d){_0x2851b7['push'](_0x2851b7['shift']());}};_0xf5df3d(++_0xa5ed82);}(_0x025d,0x141));var _0xd025=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x025d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xd025('0x0'));var util=require('util');var moment=require(_0xd025('0x1'));var BPromise=require(_0xd025('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd025('0x3'));var db=require(_0xd025('0x4'))['db'];var utils=require(_0xd025('0x5'));var logger=require(_0xd025('0x6'))(_0xd025('0x7'));var config=require(_0xd025('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd025('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33dcca,_0x439d56,_0x2b7715){return new BPromise(function(_0x4e44fc,_0x258e02){return client[_0xd025('0xa')](_0x33dcca,_0x2b7715)[_0xd025('0xb')](function(_0xf5a237){logger[_0xd025('0xc')](_0xd025('0xd'),_0x439d56,_0xd025('0xe'));logger[_0xd025('0xf')](_0xd025('0x10'),_0x439d56,'request\x20sent',JSON['stringify'](_0xf5a237));if(_0xf5a237[_0xd025('0x11')]){if(_0xf5a237['error']['code']===0x1f4){logger[_0xd025('0x11')](_0xd025('0xd'),_0x439d56,_0xf5a237[_0xd025('0x11')][_0xd025('0x12')]);return _0x258e02(_0xf5a237['error']['message']);}logger[_0xd025('0x11')]('Trunk,\x20%s,\x20%s',_0x439d56,_0xf5a237[_0xd025('0x11')]['message']);return _0x4e44fc(_0xf5a237['error']['message']);}else{logger['info'](_0xd025('0xd'),_0x439d56,'request\x20sent');_0x4e44fc(_0xf5a237[_0xd025('0x13')][_0xd025('0x12')]);}})['catch'](function(_0x22c88c){logger[_0xd025('0x11')](_0xd025('0xd'),_0x439d56,_0x22c88c);_0x258e02(_0x22c88c);});});}exports[_0xd025('0x14')]=function(_0x264e2e){var _0x25a2fb=this;return new Promise(function(_0x4d77a2,_0x1ed1d8){return db['Trunk'][_0xd025('0x15')]({'raw':_0x264e2e['options']?_0x264e2e[_0xd025('0x16')][_0xd025('0x17')]===undefined?!![]:![]:!![],'where':_0x264e2e[_0xd025('0x16')]?_0x264e2e[_0xd025('0x16')][_0xd025('0x18')]||null:null,'attributes':_0x264e2e[_0xd025('0x16')]?_0x264e2e[_0xd025('0x16')][_0xd025('0x19')]||null:null,'limit':_0x264e2e[_0xd025('0x16')]?_0x264e2e[_0xd025('0x16')]['limit']||null:null,'include':_0x264e2e[_0xd025('0x16')]?_0x264e2e[_0xd025('0x16')][_0xd025('0x1a')]?_[_0xd025('0x1b')](_0x264e2e['options'][_0xd025('0x1a')],function(_0x58db45){return{'model':db[_0x58db45[_0xd025('0x1c')]],'as':_0x58db45['as'],'attributes':_0x58db45[_0xd025('0x19')],'include':_0x58db45[_0xd025('0x1a')]?_['map'](_0x58db45[_0xd025('0x1a')],function(_0x4471c7){return{'model':db[_0x4471c7[_0xd025('0x1c')]],'as':_0x4471c7['as'],'attributes':_0x4471c7[_0xd025('0x19')],'include':_0x4471c7[_0xd025('0x1a')]?_[_0xd025('0x1b')](_0x4471c7['include'],function(_0x5a902c){return{'model':db[_0x5a902c[_0xd025('0x1c')]],'as':_0x5a902c['as'],'attributes':_0x5a902c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd025('0xb')](function(_0x954787){logger['info'](_0xd025('0x14'),_0x264e2e);logger['debug'](_0xd025('0x14'),_0x264e2e,JSON[_0xd025('0x1d')](_0x954787));_0x4d77a2(_0x954787);})[_0xd025('0x1e')](function(_0x4d2ef4){logger[_0xd025('0x11')](_0xd025('0x14'),_0x4d2ef4[_0xd025('0x12')],_0x264e2e);_0x1ed1d8(_0x25a2fb[_0xd025('0x11')](0x1f4,_0x4d2ef4['message']));});});};exports[_0xd025('0x1f')]=function(_0xa768e0){var _0x18cf74=this;return new Promise(function(_0x4dffa9,_0x41580e){return db['Trunk'][_0xd025('0x20')]({'raw':_0xa768e0[_0xd025('0x16')]?_0xa768e0[_0xd025('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xa768e0[_0xd025('0x16')]?_0xa768e0[_0xd025('0x16')][_0xd025('0x18')]||null:null,'attributes':_0xa768e0[_0xd025('0x16')]?_0xa768e0[_0xd025('0x16')][_0xd025('0x19')]||null:null,'include':_0xa768e0[_0xd025('0x16')]?_0xa768e0[_0xd025('0x16')][_0xd025('0x1a')]?_['map'](_0xa768e0['options'][_0xd025('0x1a')],function(_0x5ca177){return{'model':db[_0x5ca177[_0xd025('0x1c')]],'as':_0x5ca177['as'],'attributes':_0x5ca177[_0xd025('0x19')],'include':_0x5ca177[_0xd025('0x1a')]?_['map'](_0x5ca177[_0xd025('0x1a')],function(_0x5161db){return{'model':db[_0x5161db[_0xd025('0x1c')]],'as':_0x5161db['as'],'attributes':_0x5161db[_0xd025('0x19')],'include':_0x5161db[_0xd025('0x1a')]?_[_0xd025('0x1b')](_0x5161db[_0xd025('0x1a')],function(_0x4b0c61){return{'model':db[_0x4b0c61[_0xd025('0x1c')]],'as':_0x4b0c61['as'],'attributes':_0x4b0c61[_0xd025('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd025('0xb')](function(_0x2723dd){logger[_0xd025('0xc')](_0xd025('0x1f'),_0xa768e0);logger[_0xd025('0xf')]('ShowTrunk',_0xa768e0,JSON[_0xd025('0x1d')](_0x2723dd));_0x4dffa9(_0x2723dd);})[_0xd025('0x1e')](function(_0x49d21e){logger[_0xd025('0x11')]('ShowTrunk',_0x49d21e[_0xd025('0x12')],_0xa768e0);_0x41580e(_0x18cf74[_0xd025('0x11')](0x1f4,_0x49d21e[_0xd025('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b3ac688..eeaba6a 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 _0x3c8b=['isAuthenticated','update','express','Router','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x2923bf,_0x5bd8d5){var _0x1f60f6=function(_0x1e7d88){while(--_0x1e7d88){_0x2923bf['push'](_0x2923bf['shift']());}};_0x1f60f6(++_0x5bd8d5);}(_0x3c8b,0x152));var _0xb3c8=function(_0x44bac9,_0x3ad5b8){_0x44bac9=_0x44bac9-0x0;var _0x2948b5=_0x3c8b[_0x44bac9];return _0x2948b5;};'use strict';var express=require(_0xb3c8('0x0'));var router=express[_0xb3c8('0x1')]();var auth=require(_0xb3c8('0x2'));var controller=require(_0xb3c8('0x3'));router[_0xb3c8('0x4')](_0xb3c8('0x5'),auth[_0xb3c8('0x6')](),controller[_0xb3c8('0x7')]);module['exports']=router; \ No newline at end of file +var _0xca5c=['/:id','express','Router','../../components/auth/service'];(function(_0x1f5038,_0x4631a8){var _0x54c22d=function(_0x23b9ab){while(--_0x23b9ab){_0x1f5038['push'](_0x1f5038['shift']());}};_0x54c22d(++_0x4631a8);}(_0xca5c,0x119));var _0xcca5=function(_0x590da5,_0x298084){_0x590da5=_0x590da5-0x0;var _0x54d4c4=_0xca5c[_0x590da5];return _0x54d4c4;};'use strict';var express=require(_0xcca5('0x0'));var router=express[_0xcca5('0x1')]();var auth=require(_0xcca5('0x2'));var controller=require('./user-setting.controller');router['put'](_0xcca5('0x3'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 66fe774..fe1f198 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 _0xd003=['exports','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning','info','debug'];(function(_0x408cc5,_0x21df00){var _0x187697=function(_0x1a306e){while(--_0x1a306e){_0x408cc5['push'](_0x408cc5['shift']());}};_0x187697(++_0x21df00);}(_0xd003,0x113));var _0x3d00=function(_0x55a523,_0x8ed653){_0x55a523=_0x55a523-0x0;var _0x75c98d=_0xd003[_0x55a523];return _0x75c98d;};'use strict';var Sequelize=require(_0x3d00('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3d00('0x1'),_0x3d00('0x2'),_0x3d00('0x3'),_0x3d00('0x4')];module[_0x3d00('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3d00('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3d00('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3d00('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3d00('0x8')],'unique':_0x3d00('0x9')}}; \ No newline at end of file +var _0x80f1=['exports','ENUM','error','TEXT','DATE','INTEGER','sequelize','warning','info'];(function(_0x5f3371,_0x1512de){var _0x1fda76=function(_0x56672b){while(--_0x56672b){_0x5f3371['push'](_0x5f3371['shift']());}};_0x1fda76(++_0x1512de);}(_0x80f1,0x1ad));var _0x180f=function(_0x1bbea1,_0xf40f7f){_0x1bbea1=_0x1bbea1-0x0;var _0x3d23bd=_0x80f1[_0x1bbea1];return _0x3d23bd;};'use strict';var Sequelize=require(_0x180f('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x180f('0x1'),_0x180f('0x2'),'debug'];module[_0x180f('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x180f('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x180f('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x180f('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x180f('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x180f('0x8')],'unique':'UserId'}}; \ 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 f64f19c..d31617d 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 _0xf120=['../../config/logger','api','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','json','update','then','sendStatus','error','stack','name','status','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','ioredis'];(function(_0x4ea17a,_0x4b9c83){var _0x58e65f=function(_0x46ad6d){while(--_0x46ad6d){_0x4ea17a['push'](_0x4ea17a['shift']());}};_0x58e65f(++_0x4b9c83);}(_0xf120,0x179));var _0x0f12=function(_0x49e9c4,_0x707ed4){_0x49e9c4=_0x49e9c4-0x0;var _0x354219=_0xf120[_0x49e9c4];return _0x354219;};'use strict';var _=require('lodash');var Redis=require(_0x0f12('0x0'));var logger=require(_0x0f12('0x1'))(_0x0f12('0x2'));var config=require('../../config/environment');var db=require(_0x0f12('0x3'))['db'];var socket=require(_0x0f12('0x4'))(new Redis(config[_0x0f12('0x5')]));require('./user-setting.socket')[_0x0f12('0x6')](socket);config[_0x0f12('0x5')]=_[_0x0f12('0x7')](config[_0x0f12('0x5')],{'host':_0x0f12('0x8'),'port':0x18eb});function respondWithResult(_0x341516,_0x1f32b7){_0x1f32b7=_0x1f32b7||0xc8;return function(_0x457122){if(_0x457122){return _0x341516['status'](_0x1f32b7)[_0x0f12('0x9')](_0x457122);}};}function saveUpdates(_0x4bbb62){return function(_0x3b909b){if(_0x3b909b){return _0x3b909b[_0x0f12('0xa')](_0x4bbb62)[_0x0f12('0xb')](function(_0x48ebce){return _0x48ebce;});}return null;};}function handleEntityNotFound(_0x5f158a){return function(_0x23f708){if(!_0x23f708){_0x5f158a[_0x0f12('0xc')](0x194);}return _0x23f708;};}function handleError(_0x728460,_0xd85187){_0xd85187=_0xd85187||0x1f4;return function(_0x42eec3){logger[_0x0f12('0xd')](_0x42eec3[_0x0f12('0xe')]);if(_0x42eec3['name']){delete _0x42eec3[_0x0f12('0xf')];}_0x728460[_0x0f12('0x10')](_0xd85187)[_0x0f12('0x11')](_0x42eec3);};}exports[_0x0f12('0xa')]=function(_0x22f390,_0xc019be){if(_0x22f390[_0x0f12('0x12')][_0x0f12('0x13')]!==_0x0f12('0x14'))throw new Error(_0x0f12('0x15'));if(isNaN(Number(_0x22f390[_0x0f12('0x16')]['id'])))throw new Error(_0x0f12('0x17'));return db[_0x0f12('0x18')][_0x0f12('0x19')]({'where':{'id':_0x22f390[_0x0f12('0x16')]['id']}})['then'](handleEntityNotFound(_0xc019be,null))[_0x0f12('0xb')](saveUpdates(_0x22f390['body'],null))[_0x0f12('0xb')](respondWithResult(_0xc019be,null))[_0x0f12('0x1a')](handleError(_0xc019be,null));}; \ No newline at end of file +var _0xfc73=['../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','sendStatus','stack','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','catch','lodash','ioredis','api','../../config/environment'];(function(_0x107d17,_0xe87874){var _0xb2c06a=function(_0x250d7b){while(--_0x250d7b){_0x107d17['push'](_0x107d17['shift']());}};_0xb2c06a(++_0xe87874);}(_0xfc73,0x8d));var _0x3fc7=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xfc73[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x3fc7('0x0'));var Redis=require(_0x3fc7('0x1'));var logger=require('../../config/logger')(_0x3fc7('0x2'));var config=require(_0x3fc7('0x3'));var db=require(_0x3fc7('0x4'))['db'];var socket=require(_0x3fc7('0x5'))(new Redis(config[_0x3fc7('0x6')]));require(_0x3fc7('0x7'))[_0x3fc7('0x8')](socket);config[_0x3fc7('0x6')]=_[_0x3fc7('0x9')](config[_0x3fc7('0x6')],{'host':_0x3fc7('0xa'),'port':0x18eb});function respondWithResult(_0x1375dc,_0x5e41d3){_0x5e41d3=_0x5e41d3||0xc8;return function(_0x36ec87){if(_0x36ec87){return _0x1375dc[_0x3fc7('0xb')](_0x5e41d3)[_0x3fc7('0xc')](_0x36ec87);}};}function saveUpdates(_0x3e2653){return function(_0x32559c){if(_0x32559c){return _0x32559c['update'](_0x3e2653)['then'](function(_0x434c84){return _0x434c84;});}return null;};}function handleEntityNotFound(_0x1dc32b){return function(_0x1f9da3){if(!_0x1f9da3){_0x1dc32b[_0x3fc7('0xd')](0x194);}return _0x1f9da3;};}function handleError(_0x1af753,_0x18d684){_0x18d684=_0x18d684||0x1f4;return function(_0x5f1c10){logger['error'](_0x5f1c10[_0x3fc7('0xe')]);if(_0x5f1c10['name']){delete _0x5f1c10[_0x3fc7('0xf')];}_0x1af753[_0x3fc7('0xb')](_0x18d684)[_0x3fc7('0x10')](_0x5f1c10);};}exports[_0x3fc7('0x11')]=function(_0x4ba4f6,_0x41669b){if(_0x4ba4f6[_0x3fc7('0x12')][_0x3fc7('0x13')]!==_0x3fc7('0x14'))throw new Error(_0x3fc7('0x15'));if(isNaN(Number(_0x4ba4f6[_0x3fc7('0x16')]['id'])))throw new Error(_0x3fc7('0x17'));return db[_0x3fc7('0x18')][_0x3fc7('0x19')]({'where':{'id':_0x4ba4f6[_0x3fc7('0x16')]['id']}})[_0x3fc7('0x1a')](handleEntityNotFound(_0x41669b,null))[_0x3fc7('0x1a')](saveUpdates(_0x4ba4f6[_0x3fc7('0x1b')],null))[_0x3fc7('0x1a')](respondWithResult(_0x41669b,null))[_0x3fc7('0x1c')](handleError(_0x41669b,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 3fb1d0c..e934e39 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 _0xc03b=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc03b,0xd5));var _0xbc03=function(_0x43db86,_0x34184b){_0x43db86=_0x43db86-0x0;var _0x27bda2=_0xc03b[_0x43db86];return _0x27bda2;};'use strict';var EventEmitter=require(_0xbc03('0x0'));var UserSetting=require(_0xbc03('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xbc03('0x2')](0x0);var events={'afterCreate':_0xbc03('0x3'),'afterUpdate':'update','afterDestroy':_0xbc03('0x4')};function emitEvent(_0x518963){return function(_0x58d776,_0x16a7c4,_0x44c0a8){UserSettingEvents['emit'](_0x518963+':'+_0x58d776['id'],_0x58d776);UserSettingEvents[_0xbc03('0x5')](_0x518963,_0x58d776);_0x44c0a8(null);};}for(var e in events){if(events[_0xbc03('0x6')](e)){var event=events[e];UserSetting[_0xbc03('0x7')](e,emitEvent(event));}}module[_0xbc03('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x2327=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x6ee843,_0x11c6fc){var _0x17eeba=function(_0x7d34e8){while(--_0x7d34e8){_0x6ee843['push'](_0x6ee843['shift']());}};_0x17eeba(++_0x11c6fc);}(_0x2327,0x1d8));var _0x7232=function(_0x2801b2,_0x1dbe10){_0x2801b2=_0x2801b2-0x0;var _0x1eb39a=_0x2327[_0x2801b2];return _0x1eb39a;};'use strict';var EventEmitter=require(_0x7232('0x0'));var UserSetting=require(_0x7232('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7232('0x2')](0x0);var events={'afterCreate':_0x7232('0x3'),'afterUpdate':_0x7232('0x4'),'afterDestroy':_0x7232('0x5')};function emitEvent(_0x2f63cc){return function(_0x2ee6be,_0xb91f7e,_0x382cfe){UserSettingEvents[_0x7232('0x6')](_0x2f63cc+':'+_0x2ee6be['id'],_0x2ee6be);UserSettingEvents[_0x7232('0x6')](_0x2f63cc,_0x2ee6be);_0x382cfe(null);};}for(var e in events){if(events[_0x7232('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x7232('0x8')]=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 b029a44..5764ae5 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 _0xe605=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x227c55,_0x49db56){var _0x49e02b=function(_0x5bdd70){while(--_0x5bdd70){_0x227c55['push'](_0x227c55['shift']());}};_0x49e02b(++_0x49db56);}(_0xe605,0x92));var _0x5e60=function(_0x2ebdfd,_0x3e86bf){_0x2ebdfd=_0x2ebdfd-0x0;var _0x4a6531=_0xe605[_0x2ebdfd];return _0x4a6531;};'use strict';var attributes=require(_0x5e60('0x0'));module[_0x5e60('0x1')]=function(_0x5deab2){return _0x5deab2[_0x5e60('0x2')](_0x5e60('0x3'),attributes,{'tableName':_0x5e60('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1133f0){if(!_0x1133f0[_0x5e60('0x5')])_0x1133f0[_0x5e60('0x6')]=null;else if(_0x1133f0[_0x5e60('0x6')]===null)_0x1133f0[_0x5e60('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x39c4=['exports','UserSetting','user_settings','clientSideLoggingEnabledSince'];(function(_0x49e5e2,_0x45d15c){var _0xa66367=function(_0x23c81b){while(--_0x23c81b){_0x49e5e2['push'](_0x49e5e2['shift']());}};_0xa66367(++_0x45d15c);}(_0x39c4,0x174));var _0x439c=function(_0x5e3919,_0x3be492){_0x5e3919=_0x5e3919-0x0;var _0x3ce582=_0x39c4[_0x5e3919];return _0x3ce582;};'use strict';var attributes=require('./user-setting.attributes');module[_0x439c('0x0')]=function(_0x5b1ddb){return _0x5b1ddb['define'](_0x439c('0x1'),attributes,{'tableName':_0x439c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59b938){if(!_0x59b938['clientSideLoggingEnabled'])_0x59b938[_0x439c('0x3')]=null;else if(_0x59b938[_0x439c('0x3')]===null)_0x59b938[_0x439c('0x3')]=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 2b9f54e..a4601a4 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 _0xb79e=['user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','emit','user-setting:update'];(function(_0x462dfc,_0x5ca8e1){var _0x14d933=function(_0x2d55e8){while(--_0x2d55e8){_0x462dfc['push'](_0x462dfc['shift']());}};_0x14d933(++_0x5ca8e1);}(_0xb79e,0x7c));var _0xeb79=function(_0x2c9553,_0x90df0b){_0x2c9553=_0x2c9553-0x0;var _0x42b3d6=_0xb79e[_0x2c9553];return _0x42b3d6;};'use strict';var UserSettingEvents=require(_0xeb79('0x0'));var events=[_0xeb79('0x1'),'remove','update'];function createListener(_0x548e4b,_0x47152a){return function(_0x47ae70){_0x47152a[_0xeb79('0x2')](_0x548e4b,_0x47ae70);if(_0x548e4b===_0xeb79('0x3')){_0x47152a[_0xeb79('0x2')](_0xeb79('0x4')+_0x47ae70['UserId'],_0x47ae70);}};}exports[_0xeb79('0x5')]=function(_0x3b7c15){for(var _0x38c124=0x0,_0x2445e8=events[_0xeb79('0x6')];_0x38c124<_0x2445e8;_0x38c124++){var _0x4df4b8=events[_0x38c124];var _0xba7e80=createListener(_0xeb79('0x7')+_0x4df4b8,_0x3b7c15);UserSettingEvents['on'](_0x4df4b8,_0xba7e80);}}; \ No newline at end of file +var _0xd05b=['user-setting:update:user-','UserId','register','length','./user-setting.events','save','remove','update','emit'];(function(_0x1a595d,_0x1d4843){var _0x4bca23=function(_0x38eaf0){while(--_0x38eaf0){_0x1a595d['push'](_0x1a595d['shift']());}};_0x4bca23(++_0x1d4843);}(_0xd05b,0xf7));var _0xbd05=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xd05b[_0x3ab9ee];return _0x82ee88;};'use strict';var UserSettingEvents=require(_0xbd05('0x0'));var events=[_0xbd05('0x1'),_0xbd05('0x2'),_0xbd05('0x3')];function createListener(_0x580893,_0x5274c9){return function(_0x494a0d){_0x5274c9[_0xbd05('0x4')](_0x580893,_0x494a0d);if(_0x580893==='user-setting:update'){_0x5274c9[_0xbd05('0x4')](_0xbd05('0x5')+_0x494a0d[_0xbd05('0x6')],_0x494a0d);}};}exports[_0xbd05('0x7')]=function(_0x340acd){for(var _0x10adef=0x0,_0x24a212=events[_0xbd05('0x8')];_0x10adef<_0x24a212;_0x10adef++){var _0x5b1ad2=events[_0x10adef];var _0x2fb05a=createListener('user-setting:'+_0x5b1ad2,_0x340acd);UserSettingEvents['on'](_0x5b1ad2,_0x2fb05a);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5fb12aa..f172eb1 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 _0x2902=['removeWhatsappAccounts','messengerSoundNotification','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','index','describe','/whoami','whoami','/presence','isAuthenticated','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','login','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','removeQueues','delete','/:id/teams','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x5aea5a,_0x346fe0){var _0x557a58=function(_0x4faa12){while(--_0x4faa12){_0x5aea5a['push'](_0x5aea5a['shift']());}};_0x557a58(++_0x346fe0);}(_0x2902,0x77));var _0x2290=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2902[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x2290('0x0'));var util=require(_0x2290('0x1'));var path=require(_0x2290('0x2'));var timeout=require(_0x2290('0x3'));var express=require('express');var router=express[_0x2290('0x4')]();var fs_extra=require(_0x2290('0x5'));var auth=require(_0x2290('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2290('0x7'));var controller=require(_0x2290('0x8'));router[_0x2290('0x9')]('/',auth['isAuthenticated'](),controller[_0x2290('0xa')]);router[_0x2290('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x2290('0xb')]);router[_0x2290('0x9')](_0x2290('0xc'),auth['isAuthenticated'](),controller[_0x2290('0xd')]);router['get'](_0x2290('0xe'),auth[_0x2290('0xf')](),controller[_0x2290('0x10')]);router[_0x2290('0x9')]('/:id',auth[_0x2290('0xf')](),controller[_0x2290('0x11')]);router[_0x2290('0x9')](_0x2290('0x12'),controller[_0x2290('0x13')]);router[_0x2290('0x9')](_0x2290('0x14'),auth[_0x2290('0xf')](),controller['getOpenTabs']);router[_0x2290('0x9')]('/:id/contacts',auth[_0x2290('0xf')](),controller[_0x2290('0x15')]);router[_0x2290('0x9')](_0x2290('0x16'),auth['isAuthenticated'](),controller['getQueues']);router[_0x2290('0x9')](_0x2290('0x17'),auth[_0x2290('0xf')](),controller[_0x2290('0x18')]);router[_0x2290('0x9')](_0x2290('0x19'),auth[_0x2290('0xf')](),controller[_0x2290('0x1a')]);router[_0x2290('0x9')]('/:id/recordings',auth[_0x2290('0xf')](),controller[_0x2290('0x1b')]);router[_0x2290('0x9')](_0x2290('0x1c'),auth['isAuthenticated'](),controller[_0x2290('0x1d')]);router[_0x2290('0x9')](_0x2290('0x1e'),auth[_0x2290('0xf')](),controller[_0x2290('0x1f')]);router[_0x2290('0x9')](_0x2290('0x20'),auth[_0x2290('0xf')](),controller[_0x2290('0x21')]);router[_0x2290('0x9')]('/:id/mail/interactions',auth[_0x2290('0xf')](),controller[_0x2290('0x22')]);router[_0x2290('0x9')](_0x2290('0x23'),auth['isAuthenticated'](),controller[_0x2290('0x24')]);router[_0x2290('0x9')](_0x2290('0x25'),auth[_0x2290('0xf')](),controller['getFaxInteractions']);router[_0x2290('0x9')](_0x2290('0x26'),auth['isAuthenticated'](),controller[_0x2290('0x27')]);router[_0x2290('0x9')]('/:id/teams',auth[_0x2290('0xf')](),controller[_0x2290('0x28')]);router[_0x2290('0x9')](_0x2290('0x29'),auth[_0x2290('0xf')](),controller[_0x2290('0x2a')]);router[_0x2290('0x9')](_0x2290('0x2b'),auth[_0x2290('0xf')](),controller[_0x2290('0x2c')]);router['get'](_0x2290('0x2d'),auth[_0x2290('0xf')](),controller[_0x2290('0x2e')]);router[_0x2290('0x9')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x2290('0x2f')]);router[_0x2290('0x9')](_0x2290('0x30'),auth[_0x2290('0xf')](),controller['getMailAccounts']);router[_0x2290('0x9')](_0x2290('0x31'),auth['isAuthenticated'](),controller[_0x2290('0x32')]);router[_0x2290('0x9')](_0x2290('0x33'),auth[_0x2290('0xf')](),controller['getSmsAccounts']);router[_0x2290('0x9')](_0x2290('0x34'),auth[_0x2290('0xf')](),controller[_0x2290('0x35')]);router['get']('/:id/whatsapp_accounts',auth[_0x2290('0xf')](),controller[_0x2290('0x36')]);router['get'](_0x2290('0x37'),auth[_0x2290('0xf')](),controller[_0x2290('0x38')]);router[_0x2290('0x9')](_0x2290('0x39'),auth[_0x2290('0xf')](),controller['getApiKey']);router[_0x2290('0x3a')](_0x2290('0x3b'),auth[_0x2290('0xf')](),controller[_0x2290('0x3c')]);router['post']('/',auth[_0x2290('0xf')](),controller[_0x2290('0x3d')]);router[_0x2290('0x3a')]('/create_many',auth['isAuthenticated'](),controller[_0x2290('0x3e')]);router[_0x2290('0x3a')]('/:id/queues',auth[_0x2290('0xf')](),controller[_0x2290('0x3f')]);var upload=multer({'storage':multer[_0x2290('0x40')]({'destination':function(_0x2e1989,_0x40e4cb,_0x383138){_0x383138(null,path[_0x2290('0x41')](config[_0x2290('0x42')],_0x2290('0x43')));},'filename':function(_0x570c86,_0x1d83a1,_0x27e45e){_0x27e45e(null,util[_0x2290('0x44')](_0x2290('0x45'),Date[_0x2290('0x46')](),_0x1d83a1['originalname']));}})});router[_0x2290('0x3a')](_0x2290('0x12'),upload[_0x2290('0x47')](_0x2290('0x48')),controller[_0x2290('0x49')]);router[_0x2290('0x3a')]('/:id/login',auth[_0x2290('0xf')](),controller[_0x2290('0x4a')]);router[_0x2290('0x3a')]('/:id/logout',auth[_0x2290('0xf')](),controller['logout']);router[_0x2290('0x3a')](_0x2290('0x4b'),auth['isAuthenticated'](),controller[_0x2290('0x4c')]);router[_0x2290('0x3a')](_0x2290('0x4d'),auth[_0x2290('0xf')](),controller[_0x2290('0x4e')]);router[_0x2290('0x3a')]('/:id/teams',auth[_0x2290('0xf')](),controller[_0x2290('0x4f')]);router['post'](_0x2290('0x50'),auth[_0x2290('0xf')](),controller[_0x2290('0x51')]);router[_0x2290('0x3a')](_0x2290('0x52'),auth['isAuthenticated'](),controller[_0x2290('0x53')]);router[_0x2290('0x3a')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x2290('0x54')]);router[_0x2290('0x3a')](_0x2290('0x55'),auth[_0x2290('0xf')](),controller[_0x2290('0x56')]);router['post']('/:id/openchannel_interactions',auth[_0x2290('0xf')](),controller['addOpenchannelInteractions']);router[_0x2290('0x3a')]('/:id/whatsapp_interactions',auth[_0x2290('0xf')](),controller['addWhatsappInteractions']);router[_0x2290('0x3a')](_0x2290('0x57'),auth['isAuthenticated'](),controller[_0x2290('0x58')]);router[_0x2290('0x3a')](_0x2290('0x30'),auth[_0x2290('0xf')](),controller['addMailAccounts']);router[_0x2290('0x3a')](_0x2290('0x31'),auth[_0x2290('0xf')](),controller[_0x2290('0x59')]);router[_0x2290('0x3a')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x2290('0x5a')]);router['post'](_0x2290('0x34'),auth[_0x2290('0xf')](),controller[_0x2290('0x5b')]);router[_0x2290('0x3a')](_0x2290('0x5c'),auth['isAuthenticated'](),controller[_0x2290('0x5d')]);router[_0x2290('0x3a')](_0x2290('0x39'),auth['isAuthenticated'](),controller[_0x2290('0x5e')]);router['put']('/:id',auth[_0x2290('0xf')](),controller['update']);router[_0x2290('0x5f')](_0x2290('0x60'),auth[_0x2290('0xf')](),controller[_0x2290('0x61')]);router['delete'](_0x2290('0x16'),auth[_0x2290('0xf')](),controller[_0x2290('0x62')]);router[_0x2290('0x63')](_0x2290('0x64'),auth['isAuthenticated'](),controller[_0x2290('0x65')]);router['delete'](_0x2290('0x66'),auth['isAuthenticated'](),controller[_0x2290('0x67')]);router[_0x2290('0x63')](_0x2290('0x50'),auth[_0x2290('0xf')](),controller[_0x2290('0x68')]);router['delete'](_0x2290('0x52'),auth[_0x2290('0xf')](),controller[_0x2290('0x69')]);router['delete']('/:id/fax_interactions',auth[_0x2290('0xf')](),controller[_0x2290('0x6a')]);router['delete'](_0x2290('0x55'),auth[_0x2290('0xf')](),controller[_0x2290('0x6b')]);router['delete']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x2290('0x6c')]);router[_0x2290('0x63')](_0x2290('0x6d'),auth[_0x2290('0xf')](),controller[_0x2290('0x6e')]);router[_0x2290('0x63')](_0x2290('0x57'),auth[_0x2290('0xf')](),controller['removeFaxAccounts']);router[_0x2290('0x63')](_0x2290('0x30'),auth['isAuthenticated'](),controller[_0x2290('0x6f')]);router[_0x2290('0x63')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x2290('0x70')]);router[_0x2290('0x63')](_0x2290('0x33'),auth[_0x2290('0xf')](),controller[_0x2290('0x71')]);router[_0x2290('0x63')]('/:id/chat_websites',auth[_0x2290('0xf')](),controller[_0x2290('0x72')]);router[_0x2290('0x63')](_0x2290('0x5c'),auth[_0x2290('0xf')](),controller[_0x2290('0x73')]);router[_0x2290('0x63')](_0x2290('0x39'),auth[_0x2290('0xf')](),controller['removeApiKey']);router[_0x2290('0x3a')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x2290('0x74')]);module['exports']=router; \ No newline at end of file +var _0xbb87=['/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/api_key','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/create_many','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause'];(function(_0x1faefd,_0x39b0a0){var _0x18d108=function(_0x3abe7f){while(--_0x3abe7f){_0x1faefd['push'](_0x1faefd['shift']());}};_0x18d108(++_0x39b0a0);}(_0xbb87,0xa1));var _0x7bb8=function(_0x312acf,_0x2ed44f){_0x312acf=_0x312acf-0x0;var _0x54df22=_0xbb87[_0x312acf];return _0x54df22;};'use strict';var multer=require(_0x7bb8('0x0'));var util=require(_0x7bb8('0x1'));var path=require(_0x7bb8('0x2'));var timeout=require(_0x7bb8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7bb8('0x4'));var interaction=require(_0x7bb8('0x5'));var config=require('../../config/environment');var controller=require(_0x7bb8('0x6'));router[_0x7bb8('0x7')]('/',auth[_0x7bb8('0x8')](),controller['index']);router[_0x7bb8('0x7')](_0x7bb8('0x9'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0xa')]);router['get'](_0x7bb8('0xb'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0xc')]);router[_0x7bb8('0x7')]('/presence',auth['isAuthenticated'](),controller[_0x7bb8('0xd')]);router[_0x7bb8('0x7')](_0x7bb8('0xe'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0xf')]);router[_0x7bb8('0x7')](_0x7bb8('0x10'),controller[_0x7bb8('0x11')]);router[_0x7bb8('0x7')](_0x7bb8('0x12'),auth['isAuthenticated'](),controller[_0x7bb8('0x13')]);router[_0x7bb8('0x7')](_0x7bb8('0x14'),auth[_0x7bb8('0x8')](),controller['getContacts']);router[_0x7bb8('0x7')](_0x7bb8('0x15'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x16')]);router[_0x7bb8('0x7')](_0x7bb8('0x17'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x18')]);router[_0x7bb8('0x7')](_0x7bb8('0x19'),auth['isAuthenticated'](),controller[_0x7bb8('0x1a')]);router[_0x7bb8('0x7')](_0x7bb8('0x1b'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x1c')]);router['get'](_0x7bb8('0x1d'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x1e')]);router[_0x7bb8('0x7')](_0x7bb8('0x1f'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x20')]);router[_0x7bb8('0x7')](_0x7bb8('0x21'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x22')]);router[_0x7bb8('0x7')](_0x7bb8('0x23'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x24')]);router[_0x7bb8('0x7')](_0x7bb8('0x25'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x26')]);router[_0x7bb8('0x7')](_0x7bb8('0x27'),auth['isAuthenticated'](),controller[_0x7bb8('0x28')]);router['get']('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x7bb8('0x7')](_0x7bb8('0x29'),auth[_0x7bb8('0x8')](),controller['getTeams']);router[_0x7bb8('0x7')](_0x7bb8('0x2a'),auth['isAuthenticated'](),controller[_0x7bb8('0x2b')]);router[_0x7bb8('0x7')]('/:id/agents',auth['isAuthenticated'](),controller[_0x7bb8('0x2c')]);router['get'](_0x7bb8('0x2d'),auth['isAuthenticated'](),controller[_0x7bb8('0x2e')]);router['get'](_0x7bb8('0x2f'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x30')]);router[_0x7bb8('0x7')]('/:id/mail_accounts',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x31')]);router[_0x7bb8('0x7')](_0x7bb8('0x32'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x33')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x7bb8('0x34')]);router['get']('/:id/chat_websites',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x35')]);router['get'](_0x7bb8('0x36'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x37')]);router[_0x7bb8('0x7')](_0x7bb8('0x38'),auth['isAuthenticated'](),controller[_0x7bb8('0x39')]);router[_0x7bb8('0x7')]('/:id/api_key',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x3a')]);router[_0x7bb8('0x3b')](_0x7bb8('0x14'),auth['isAuthenticated'](),controller['addContacts']);router[_0x7bb8('0x3b')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7bb8('0x3c'),auth[_0x7bb8('0x8')](),controller['bulkCreate']);router[_0x7bb8('0x3b')](_0x7bb8('0x15'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x7bb8('0x3d')]({'destination':function(_0x33ee29,_0x32b880,_0x6b7b94){_0x6b7b94(null,path[_0x7bb8('0x3e')](config['root'],_0x7bb8('0x3f')));},'filename':function(_0x39954f,_0x12197b,_0x59b865){_0x59b865(null,util[_0x7bb8('0x40')](_0x7bb8('0x41'),Date[_0x7bb8('0x42')](),_0x12197b[_0x7bb8('0x43')]));}})});router[_0x7bb8('0x3b')]('/:id/avatar',upload[_0x7bb8('0x44')](_0x7bb8('0x45')),controller[_0x7bb8('0x46')]);router['post'](_0x7bb8('0x47'),auth[_0x7bb8('0x8')](),controller['login']);router[_0x7bb8('0x3b')](_0x7bb8('0x48'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x49')]);router[_0x7bb8('0x3b')](_0x7bb8('0x4a'),auth[_0x7bb8('0x8')](),controller['pause']);router[_0x7bb8('0x3b')](_0x7bb8('0x4b'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x4c')]);router[_0x7bb8('0x3b')]('/:id/teams',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x4d')]);router['post'](_0x7bb8('0x4e'),auth[_0x7bb8('0x8')](),controller['addChatInteractions']);router[_0x7bb8('0x3b')](_0x7bb8('0x4f'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x7bb8('0x3b')]('/:id/fax_interactions',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x50')]);router[_0x7bb8('0x3b')](_0x7bb8('0x51'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x52')]);router['post'](_0x7bb8('0x53'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x54')]);router[_0x7bb8('0x3b')]('/:id/whatsapp_interactions',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x55')]);router[_0x7bb8('0x3b')](_0x7bb8('0x2f'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x56')]);router[_0x7bb8('0x3b')](_0x7bb8('0x57'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x58')]);router[_0x7bb8('0x3b')]('/:id/openchannel_accounts',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x59')]);router[_0x7bb8('0x3b')](_0x7bb8('0x5a'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x7bb8('0x3b')](_0x7bb8('0x5b'),auth['isAuthenticated'](),controller[_0x7bb8('0x5c')]);router[_0x7bb8('0x3b')](_0x7bb8('0x36'),auth['isAuthenticated'](),controller[_0x7bb8('0x5d')]);router['post'](_0x7bb8('0x5e'),auth['isAuthenticated'](),controller['createApiKey']);router['put'](_0x7bb8('0xe'),auth['isAuthenticated'](),controller[_0x7bb8('0x5f')]);router[_0x7bb8('0x60')](_0x7bb8('0x61'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x62')]);router[_0x7bb8('0x63')](_0x7bb8('0x15'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x64')]);router[_0x7bb8('0x63')](_0x7bb8('0x29'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x65')]);router[_0x7bb8('0x63')]('/:id',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x66')]);router['delete'](_0x7bb8('0x4e'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x67')]);router[_0x7bb8('0x63')](_0x7bb8('0x4f'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x68')]);router[_0x7bb8('0x63')]('/:id/fax_interactions',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x69')]);router[_0x7bb8('0x63')](_0x7bb8('0x51'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x6a')]);router['delete'](_0x7bb8('0x53'),auth[_0x7bb8('0x8')](),controller['removeOpenchannelInteractions']);router['delete'](_0x7bb8('0x6b'),auth['isAuthenticated'](),controller[_0x7bb8('0x6c')]);router[_0x7bb8('0x63')](_0x7bb8('0x2f'),auth['isAuthenticated'](),controller[_0x7bb8('0x6d')]);router[_0x7bb8('0x63')](_0x7bb8('0x57'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x6e')]);router[_0x7bb8('0x63')]('/:id/openchannel_accounts',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x6f')]);router['delete'](_0x7bb8('0x5a'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x70')]);router[_0x7bb8('0x63')](_0x7bb8('0x5b'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x71')]);router[_0x7bb8('0x63')](_0x7bb8('0x36'),auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x72')]);router['delete']('/:id/api_key',auth[_0x7bb8('0x8')](),controller[_0x7bb8('0x73')]);router['post']('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x7bb8('0x74')]);module[_0x7bb8('0x75')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 81f5615..42353f3 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 _0xa2a6=['PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','active','actpass','update,nonat','TEXT','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','force_avp','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','admin','user','telephone','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0xa2a6,0x94));var _0x6a2a=function(_0x5b689c,_0x197203){_0x5b689c=_0x5b689c-0x0;var _0x14b057=_0xa2a6[_0x5b689c];return _0x14b057;};'use strict';var Sequelize=require(_0x6a2a('0x0'));var moment=require(_0x6a2a('0x1'));var util=require('util');var _=require(_0x6a2a('0x2'));module[_0x6a2a('0x3')]={'name':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'unique':_0x6a2a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3b780f){this[_0x6a2a('0x6')](_0x6a2a('0x5'),_0x3b780f);this[_0x6a2a('0x6')]('defaultuser',_0x3b780f);},'comment':_0x6a2a('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x940c12){this[_0x6a2a('0x6')](_0x6a2a('0x8'),_0x940c12);this['setDataValue'](_0x6a2a('0x9'),util[_0x6a2a('0xa')](_0x6a2a('0xb'),_0x940c12,this[_0x6a2a('0xc')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'unique':_0x6a2a('0xd'),'validate':{'isEmail':!![]},'set':function(_0x23dbcf){if(_0x23dbcf){this[_0x6a2a('0x6')](_0x6a2a('0xd'),_0x23dbcf['toLowerCase']());}}},'role':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0xf'),_0x6a2a('0x10'),'agent',_0x6a2a('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6a2a('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x6a2a('0x12'),'set':function(_0x2c12b3){this[_0x6a2a('0x6')](_0x6a2a('0x12'),_0x2c12b3);this[_0x6a2a('0x6')](_0x6a2a('0x13'),_0x2c12b3);this[_0x6a2a('0x6')](_0x6a2a('0x9'),util['format'](_0x6a2a('0xb'),this[_0x6a2a('0xc')]('fullname'),_0x2c12b3));}},'salt':{'type':Sequelize[_0x6a2a('0x4')]},'phone':{'type':Sequelize[_0x6a2a('0x4')]},'mobile':{'type':Sequelize[_0x6a2a('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6a2a('0x4')]},'userpic':{'type':Sequelize[_0x6a2a('0x4')]},'city':{'type':Sequelize[_0x6a2a('0x4')]},'country':{'type':Sequelize[_0x6a2a('0x4')]},'online':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6a2a('0x15')]},'voicePause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6a2a('0x4')],'defaultValue':_0x6a2a('0x16')},'lastPauseAt':{'type':Sequelize[_0x6a2a('0x15')]},'chatCapacity':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6a2a('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x6a2a('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x6a2a('0x18'),_0x6a2a('0x10'),_0x6a2a('0x19')),'allowNull':!![],'defaultValue':_0x6a2a('0x18')},'context':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x1a'),_0x6a2a('0x1b'),'ALLOWED_FAILED_SCREEN',_0x6a2a('0x1c'),_0x6a2a('0x1d'),'PROHIB_PASSED_SCREEN',_0x6a2a('0x1e'),_0x6a2a('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6a2a('0x20'),'set':function(_0x2ce023){this[_0x6a2a('0x6')](_0x6a2a('0x21'),_0x2ce023?_0x2ce023[_0x6a2a('0x22')](','):null);},'get':function(){return this[_0x6a2a('0xc')]('transport')?this[_0x6a2a('0xc')]('transport')[_0x6a2a('0x23')](','):null;},'comment':_0x6a2a('0x24')},'dtmfmode':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x25'),_0x6a2a('0x26'),'shortinfo',_0x6a2a('0x27'),'auto'),'allowNull':!![],'defaultValue':_0x6a2a('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no',_0x6a2a('0x29'),_0x6a2a('0x2a'),_0x6a2a('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![],'defaultValue':_0x6a2a('0x2c'),'set':function(_0x358ecd){this['setDataValue'](_0x6a2a('0x2d'),_0x358ecd?_0x358ecd['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x6a2a('0xc')](_0x6a2a('0x2d'))[_0x6a2a('0x23')](','):null;},'comment':_0x6a2a('0x2e')},'callgroup':{'type':Sequelize[_0x6a2a('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6a2a('0x4')]},'pickupgroup':{'type':Sequelize[_0x6a2a('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x6a2a('0x4')]},'language':{'type':Sequelize[_0x6a2a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6a2a('0x4')]},'disallow':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'defaultValue':_0x6a2a('0x2f'),'set':function(_0x3f7744){this[_0x6a2a('0x6')](_0x6a2a('0x30'),_0x3f7744?_0x3f7744[_0x6a2a('0x22')](';'):_0x6a2a('0x2f'));},'get':function(){return this[_0x6a2a('0xc')](_0x6a2a('0x30'))?this[_0x6a2a('0xc')](_0x6a2a('0x30'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![],'set':function(_0x2bd376){this[_0x6a2a('0x6')](_0x6a2a('0x31'),_0x2bd376?_0x2bd376[_0x6a2a('0x22')](','):null);},'get':function(){return this[_0x6a2a('0xc')](_0x6a2a('0x31'))?this[_0x6a2a('0xc')](_0x6a2a('0x31'))[_0x6a2a('0x23')](','):null;},'comment':_0x6a2a('0x32')},'trustrpid':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no',_0x6a2a('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6a2a('0x34')},'amaflags':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':_0x6a2a('0x28')},'busylevel':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no',_0x6a2a('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x36'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x37'),_0x6a2a('0x38')),'allowNull':!![],'defaultValue':_0x6a2a('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':_0x6a2a('0x28')},'keepalive':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6a2a('0xe')]('yes','no',_0x6a2a('0x39'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x3a'),'passive',_0x6a2a('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no',_0x6a2a('0x29'),'update',_0x6a2a('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6a2a('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x6a2a('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x6a2a('0x3d')]},'showWebBar':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0,'set':function(_0xf13ad2){this[_0x6a2a('0x6')](_0x6a2a('0x3e'),_0xf13ad2);var _0x37cc31=this[_0x6a2a('0x3f')]({'plain':!![]});switch(_0xf13ad2){case 0x0:case 0x1:var _0x3d0b79=_0x37cc31['transport']?_[_0x6a2a('0x40')](_0x37cc31[_0x6a2a('0x21')])?_0x37cc31[_0x6a2a('0x21')][_0x6a2a('0x22')]():_0x37cc31[_0x6a2a('0x21')]:_0x6a2a('0x20');if(_0x3d0b79==='wss'){_0x3d0b79=_0x6a2a('0x20');}this['setDataValue'](_0x6a2a('0x21'),_0x3d0b79);this['setDataValue'](_0x6a2a('0x41'),'no');this[_0x6a2a('0x6')](_0x6a2a('0x42'),null);this[_0x6a2a('0x6')]('force_avp',null);this[_0x6a2a('0x6')](_0x6a2a('0x43'),null);this['setDataValue'](_0x6a2a('0x44'),null);this[_0x6a2a('0x6')](_0x6a2a('0x45'),null);this[_0x6a2a('0x6')](_0x6a2a('0x46'),null);this['setDataValue'](_0x6a2a('0x47'),null);this['setDataValue'](_0x6a2a('0x48'),null);this['setDataValue'](_0x6a2a('0x49'),'no');break;case 0x2:this[_0x6a2a('0x6')](_0x6a2a('0x21'),_0x6a2a('0x4a'));this[_0x6a2a('0x6')]('encryption',_0x6a2a('0x28'));this[_0x6a2a('0x6')](_0x6a2a('0x42'),_0x6a2a('0x28'));this['setDataValue'](_0x6a2a('0x4b'),_0x6a2a('0x28'));this['setDataValue'](_0x6a2a('0x43'),_0x6a2a('0x28'));this[_0x6a2a('0x6')]('dtlsenable','yes');this[_0x6a2a('0x6')]('dtlsverify','no');this[_0x6a2a('0x6')]('dtlssetup',_0x6a2a('0x3b'));this[_0x6a2a('0x6')](_0x6a2a('0x47'),_0x37cc31['dtlscertfile']||_0x6a2a('0x4c'));this['setDataValue'](_0x6a2a('0x48'),_0x37cc31['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x6a2a('0x6')](_0x6a2a('0x49'),_0x6a2a('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x6a2a('0x3d')],'set':function(_0x1e8c70){this[_0x6a2a('0x6')](_0x6a2a('0x4d'),_0x1e8c70?_0x1e8c70[_0x6a2a('0x22')](','):[]);},'get':function(){return this[_0x6a2a('0xc')]('permissions')?_[_0x6a2a('0x4e')](this[_0x6a2a('0xc')](_0x6a2a('0x4d'))[_0x6a2a('0x23')](','),function(_0x164703){return parseInt(_0x164703,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6a2a('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6a2a('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6a2a('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6a2a('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6a2a('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6a2a('0x4f')],'get':function(){return this['getDataValue'](_0x6a2a('0x50'))?this['getDataValue'](_0x6a2a('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![],'set':function(_0x5e94c9){if(typeof _0x5e94c9===_0x6a2a('0x51')){var _0x4686a2=_0x5e94c9==='1'?!![]:_0x5e94c9==='0'?![]:_0x5e94c9===_0x6a2a('0x52')?!![]:_0x5e94c9===_0x6a2a('0x53')?![]:![];this[_0x6a2a('0x6')](_0x6a2a('0x54'),_0x4686a2);}else{this[_0x6a2a('0x6')](_0x6a2a('0x54'),_0x5e94c9);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x934c1d){this[_0x6a2a('0x6')](_0x6a2a('0x55'),_0x934c1d);if(_0x934c1d===!![]){this[_0x6a2a('0x6')](_0x6a2a('0x56'),moment());this['setDataValue'](_0x6a2a('0x57'),0x0);}else{this[_0x6a2a('0x6')](_0x6a2a('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6a2a('0x17')](0x5)[_0x6a2a('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0x0e08=['blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','STRING','name','setDataValue','fullname','callerid','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','internal','accountcode','format','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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','refuse','uac','uas','fingerprint','active','passive','actpass','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','avpf','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording'];(function(_0x9e698b,_0x37f251){var _0x41d538=function(_0x288e41){while(--_0x288e41){_0x9e698b['push'](_0x9e698b['shift']());}};_0x41d538(++_0x37f251);}(_0x0e08,0x112));var _0x80e0=function(_0x1cd592,_0x4536bc){_0x1cd592=_0x1cd592-0x0;var _0x25c17f=_0x0e08[_0x1cd592];return _0x25c17f;};'use strict';var Sequelize=require(_0x80e0('0x0'));var moment=require(_0x80e0('0x1'));var util=require(_0x80e0('0x2'));var _=require(_0x80e0('0x3'));module['exports']={'name':{'type':Sequelize[_0x80e0('0x4')],'allowNull':![],'unique':_0x80e0('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x563c3f){this[_0x80e0('0x6')](_0x80e0('0x5'),_0x563c3f);this[_0x80e0('0x6')]('defaultuser',_0x563c3f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x80e0('0x4')],'allowNull':![],'set':function(_0x12e064){this[_0x80e0('0x6')](_0x80e0('0x7'),_0x12e064);this['setDataValue'](_0x80e0('0x8'),util['format']('\x22%s\x22\x20<%s>',_0x12e064,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0x80e0('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x80e0('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2019a7){if(_0x2019a7){this[_0x80e0('0x6')](_0x80e0('0x9'),_0x2019a7[_0x80e0('0xa')]());}}},'role':{'type':Sequelize['ENUM'](_0x80e0('0xb'),_0x80e0('0xc'),_0x80e0('0xd'),_0x80e0('0xe')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x80e0('0x4')],'defaultValue':_0x80e0('0xf')},'internal':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':![],'unique':_0x80e0('0x11'),'set':function(_0x563a8a){this[_0x80e0('0x6')](_0x80e0('0x11'),_0x563a8a);this[_0x80e0('0x6')](_0x80e0('0x12'),_0x563a8a);this['setDataValue'](_0x80e0('0x8'),util[_0x80e0('0x13')]('\x22%s\x22\x20<%s>',this[_0x80e0('0x14')](_0x80e0('0x7')),_0x563a8a));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x80e0('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x80e0('0x4')]},'zipcode':{'type':Sequelize[_0x80e0('0x4')]},'userpic':{'type':Sequelize[_0x80e0('0x4')]},'city':{'type':Sequelize[_0x80e0('0x4')]},'country':{'type':Sequelize[_0x80e0('0x4')]},'online':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x80e0('0x16')]},'voicePause':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x80e0('0x4')],'defaultValue':_0x80e0('0x17')},'lastPauseAt':{'type':Sequelize[_0x80e0('0x16')]},'chatCapacity':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x80e0('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x80e0('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![],'defaultValue':_0x80e0('0x18')},'ipaddr':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x80e0('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x1a'),_0x80e0('0xc'),_0x80e0('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x80e0('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x80e0('0x1d'),'ALLOWED_PASSED_SCREEN',_0x80e0('0x1e'),'ALLOWED','PROHIB_NOT_SCREENED',_0x80e0('0x1f'),_0x80e0('0x20'),_0x80e0('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![],'defaultValue':_0x80e0('0x22'),'set':function(_0x2ccf50){this['setDataValue'](_0x80e0('0x23'),_0x2ccf50?_0x2ccf50[_0x80e0('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x80e0('0x23'))?this[_0x80e0('0x14')](_0x80e0('0x23'))[_0x80e0('0x25')](','):null;},'comment':_0x80e0('0x26')},'dtmfmode':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x27'),_0x80e0('0x28'),'shortinfo','inband',_0x80e0('0x29')),'allowNull':!![],'defaultValue':_0x80e0('0x27')},'directmedia':{'type':Sequelize['ENUM'](_0x80e0('0x2a'),'no',_0x80e0('0x2b'),_0x80e0('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x80e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![],'defaultValue':_0x80e0('0x2d'),'set':function(_0x2e0ea9){this[_0x80e0('0x6')](_0x80e0('0x2e'),_0x2e0ea9?_0x2e0ea9[_0x80e0('0x24')](','):null);},'get':function(){return this[_0x80e0('0x14')](_0x80e0('0x2e'))?this[_0x80e0('0x14')]('nat')[_0x80e0('0x25')](','):null;},'comment':_0x80e0('0x2f')},'callgroup':{'type':Sequelize[_0x80e0('0x4')]},'namedcallgroup':{'type':Sequelize[_0x80e0('0x4')]},'pickupgroup':{'type':Sequelize[_0x80e0('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x80e0('0x4')]},'language':{'type':Sequelize[_0x80e0('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x80e0('0x4')]},'disallow':{'type':Sequelize[_0x80e0('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x80e0('0x4')],'allowNull':![],'defaultValue':_0x80e0('0x30'),'set':function(_0x4f3733){this[_0x80e0('0x6')](_0x80e0('0x31'),_0x4f3733?_0x4f3733[_0x80e0('0x24')](';'):_0x80e0('0x30'));},'get':function(){return this[_0x80e0('0x14')](_0x80e0('0x31'))?this['getDataValue'](_0x80e0('0x31'))[_0x80e0('0x25')](';'):null;},'comment':_0x80e0('0x32')},'autoframing':{'type':Sequelize[_0x80e0('0x19')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x17983a){this[_0x80e0('0x6')](_0x80e0('0x33'),_0x17983a?_0x17983a['join'](','):null);},'get':function(){return this['getDataValue'](_0x80e0('0x33'))?this[_0x80e0('0x14')]('insecure')['split'](','):null;},'comment':_0x80e0('0x34')},'trustrpid':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no',_0x80e0('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x80e0('0x19')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x80e0('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x80e0('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x80e0('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x80e0('0x19')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no',_0x80e0('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x80e0('0x37'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x38'),'uas'),'allowNull':!![],'defaultValue':_0x80e0('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x80e0('0x2a')},'keepalive':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x80e0('0x19')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no',_0x80e0('0x3a'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x80e0('0x3b'),_0x80e0('0x3c'),_0x80e0('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x80e0('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x80e0('0x19')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x80e0('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no',_0x80e0('0x2b'),_0x80e0('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x80e0('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x80e0('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x80e0('0x3e')]},'showWebBar':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0,'set':function(_0x3754af){this[_0x80e0('0x6')](_0x80e0('0x3f'),_0x3754af);var _0x32b934=this[_0x80e0('0x40')]({'plain':!![]});switch(_0x3754af){case 0x0:case 0x1:var _0x322f6a=_0x32b934[_0x80e0('0x23')]?_[_0x80e0('0x41')](_0x32b934[_0x80e0('0x23')])?_0x32b934[_0x80e0('0x23')]['join']():_0x32b934[_0x80e0('0x23')]:_0x80e0('0x22');if(_0x322f6a===_0x80e0('0x42')){_0x322f6a='udp';}this['setDataValue']('transport',_0x322f6a);this[_0x80e0('0x6')](_0x80e0('0x43'),'no');this[_0x80e0('0x6')]('avpf',null);this['setDataValue'](_0x80e0('0x44'),null);this[_0x80e0('0x6')](_0x80e0('0x45'),null);this[_0x80e0('0x6')](_0x80e0('0x46'),null);this[_0x80e0('0x6')](_0x80e0('0x47'),null);this[_0x80e0('0x6')](_0x80e0('0x48'),null);this[_0x80e0('0x6')]('dtlscertfile',null);this[_0x80e0('0x6')](_0x80e0('0x49'),null);this['setDataValue'](_0x80e0('0x4a'),'no');break;case 0x2:this[_0x80e0('0x6')](_0x80e0('0x23'),'wss');this['setDataValue'](_0x80e0('0x43'),'yes');this[_0x80e0('0x6')](_0x80e0('0x4b'),'yes');this[_0x80e0('0x6')]('force_avp',_0x80e0('0x2a'));this[_0x80e0('0x6')](_0x80e0('0x45'),_0x80e0('0x2a'));this['setDataValue'](_0x80e0('0x46'),_0x80e0('0x2a'));this[_0x80e0('0x6')](_0x80e0('0x47'),'no');this[_0x80e0('0x6')]('dtlssetup',_0x80e0('0x3d'));this[_0x80e0('0x6')](_0x80e0('0x4c'),_0x32b934[_0x80e0('0x4c')]||_0x80e0('0x4d'));this[_0x80e0('0x6')](_0x80e0('0x49'),_0x32b934[_0x80e0('0x49')]||'/etc/pki/tls/private/motion.key');this[_0x80e0('0x6')](_0x80e0('0x4a'),_0x80e0('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x80e0('0x3e')],'set':function(_0x5f5383){this[_0x80e0('0x6')]('permissions',_0x5f5383?_0x5f5383[_0x80e0('0x24')](','):[]);},'get':function(){return this[_0x80e0('0x14')](_0x80e0('0x4e'))?_[_0x80e0('0x4f')](this[_0x80e0('0x14')](_0x80e0('0x4e'))['split'](','),function(_0x27b32c){return parseInt(_0x27b32c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x80e0('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x80e0('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x80e0('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x80e0('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x80e0('0x19')](_0x80e0('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x80e0('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x80e0('0x50')],'get':function(){return this['getDataValue'](_0x80e0('0x51'))?this[_0x80e0('0x14')](_0x80e0('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x80e0('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![],'set':function(_0x1ac6f7){if(typeof _0x1ac6f7===_0x80e0('0x52')){var _0x281c26=_0x1ac6f7==='1'?!![]:_0x1ac6f7==='0'?![]:_0x1ac6f7===_0x80e0('0x53')?!![]:_0x1ac6f7===_0x80e0('0x54')?![]:![];this[_0x80e0('0x6')](_0x80e0('0x55'),_0x281c26);}else{this[_0x80e0('0x6')](_0x80e0('0x55'),_0x1ac6f7);}}},'blocked':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![],'set':function(_0x180c3e){this[_0x80e0('0x6')](_0x80e0('0x56'),_0x180c3e);if(_0x180c3e===!![]){this['setDataValue'](_0x80e0('0x57'),moment());this[_0x80e0('0x6')](_0x80e0('0x58'),0x0);}else{this['setDataValue'](_0x80e0('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x80e0('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x80e0('0x10')](0x5)[_0x80e0('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x80e0('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x80e0('0x10')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x80e0('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 e855e54..35b42a1 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 _0xd99d=['../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','status','json','undefined','count','offset','limit','set','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','message','result','catch','update','role','agent','emit','userNotification:recalc:','Users','user','Agents','Telephones','telephone','filter','map','value','includes','name','UserProfileResource','destroy','end','stack','User','rawAttributes','password','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','query','includeAll','userSetting','true','include','UserSetting','push','findAll','rows','openTabs','dataValues','sms','fax','mail','whatsapp','params','merge','options','attributes','find','chat','openchannel','all','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','113','110','105','107','108','100','111','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','oldPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','previousPasswords','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','capitalize','QueueId','Queue:save','voice','VoiceQueue','get','format','SIP/%s','UserVoiceQueueRt','removeQueues','remove','Queue:remove','addAvatar','userpic','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','MailOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','intersection','fields','sort','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','filters','order','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','transaction','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','concat','isMiddleware','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','resolve','flattenDeep','addAgent','getDataValue','Voice','upsert','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','spread','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$overlap','$contains','$contained','$any','firstName','lastName','phone','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','getUserSetting','idle','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','substring','uniqBy','orderBy','offline','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','select','ui.','field','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','enabled','util','path','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/license/util','../../errors/api','APIForbiddenrror','handleError'];(function(_0x32b860,_0x141662){var _0x1c4e76=function(_0x57444b){while(--_0x57444b){_0x32b860['push'](_0x32b860['shift']());}};_0x1c4e76(++_0x141662);}(_0xd99d,0x181));var _0xdd99=function(_0x21f324,_0x376c91){_0x21f324=_0x21f324-0x0;var _0x595d48=_0xd99d[_0x21f324];return _0x595d48;};'use strict';var moment=require('moment');var util=require(_0xdd99('0x0'));var path=require(_0xdd99('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdd99('0x2'));var Redis=require(_0xdd99('0x3'));var jayson=require(_0xdd99('0x4'));var authService=require(_0xdd99('0x5'));var contacts=require(_0xdd99('0x6'));var qs=require(_0xdd99('0x7'));var rta=require(_0xdd99('0x8'));var logger=require(_0xdd99('0x9'))(_0xdd99('0xa'));var utils=require(_0xdd99('0xb'));var config=require('../../config/environment');var licenseUtil=require(_0xdd99('0xc'));var APIBadRequestError=require(_0xdd99('0xd'))['APIBadRequestError'];var APINotFoundError=require(_0xdd99('0xd'))['APINotFoundError'];var APIForbiddenError=require(_0xdd99('0xd'))[_0xdd99('0xe')];var APIHandleError=require('../../errors/api')[_0xdd99('0xf')];var db=require(_0xdd99('0x10'))['db'];var socket=require(_0xdd99('0x11'))(new Redis(config[_0xdd99('0x12')]));require('./user.socket')[_0xdd99('0x13')](socket);config[_0xdd99('0x12')]=_[_0xdd99('0x14')](config['redis'],{'host':_0xdd99('0x15'),'port':0x18eb});var amiClient=jayson[_0xdd99('0x16')]['http']({'port':0x232a});var values;function respondWithStatusCode(_0x347dec,_0x10d890){_0x10d890=_0x10d890||0xcc;return function(_0x1f5f8c){if(_0x1f5f8c){return _0x347dec['sendStatus'](_0x10d890);}return _0x347dec[_0xdd99('0x17')](_0x10d890)['end']();};}function respondWithResult(_0x422d29,_0x22d6f6){_0x22d6f6=_0x22d6f6||0xc8;return function(_0x3d59cc){if(_0x3d59cc){return _0x422d29[_0xdd99('0x17')](_0x22d6f6)[_0xdd99('0x18')](_0x3d59cc);}};}function respondWithFilteredResult(_0x5e6b28,_0x507d2f){return function(_0x4bf66b){if(_0x4bf66b){var _0x7f383c=typeof _0x507d2f['offset']===_0xdd99('0x19')&&typeof _0x507d2f['limit']===_0xdd99('0x19');var _0x103f85=_0x4bf66b[_0xdd99('0x1a')];var _0x3b8be1=_0x7f383c?0x0:_0x507d2f[_0xdd99('0x1b')];var _0x49e292=_0x7f383c?_0x4bf66b['count']:_0x507d2f[_0xdd99('0x1b')]+_0x507d2f[_0xdd99('0x1c')];var _0x414d6f;if(_0x49e292>=_0x103f85){_0x49e292=_0x103f85;_0x414d6f=0xc8;}else{_0x414d6f=0xce;}_0x5e6b28[_0xdd99('0x17')](_0x414d6f);return _0x5e6b28[_0xdd99('0x1d')](_0xdd99('0x1e'),_0x3b8be1+'-'+_0x49e292+'/'+_0x103f85)[_0xdd99('0x18')](_0x4bf66b);}return null;};}function respondWithRpcPromise(_0x34ee31,_0x352ab8,_0x1e8802,_0x1d3d41){return new Promise(function(_0x4fcfa4,_0x2692c0){var _0x521866=_0x1d3d41||amiClient;return _0x521866[_0xdd99('0x1f')](_0x34ee31,_0x1e8802)[_0xdd99('0x20')](function(_0x12588f){logger[_0xdd99('0x21')](_0xdd99('0x22'),_0x352ab8,_0xdd99('0x23'));logger['debug'](_0xdd99('0x24'),_0x352ab8,_0xdd99('0x23'),JSON['stringify'](_0x12588f));if(_0x12588f['error']){if(_0x12588f[_0xdd99('0x25')]['code']===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x352ab8,_0x12588f[_0xdd99('0x25')]['message']);return _0x2692c0(_0x12588f[_0xdd99('0x25')][_0xdd99('0x26')]);}logger[_0xdd99('0x25')](_0xdd99('0x22'),_0x352ab8,_0x12588f['error'][_0xdd99('0x26')]);return _0x4fcfa4(_0x12588f[_0xdd99('0x25')][_0xdd99('0x26')]);}else{logger[_0xdd99('0x21')](_0xdd99('0x22'),_0x352ab8,_0xdd99('0x23'));_0x4fcfa4(_0x12588f[_0xdd99('0x27')][_0xdd99('0x26')]);}})[_0xdd99('0x28')](function(_0x230c04){logger[_0xdd99('0x25')]('User,\x20%s,\x20%s',_0x352ab8,_0x230c04);_0x2692c0(_0x230c04);});});}function saveUpdates(_0xed1aa6){return function(_0x41e488){if(_0x41e488){return _0x41e488[_0xdd99('0x29')](_0xed1aa6)[_0xdd99('0x20')](function(_0x759897){if(_0x759897[_0xdd99('0x2a')]===_0xdd99('0x2b')){socket[_0xdd99('0x2c')](_0xdd99('0x2d')+_0x759897['id'],_0x759897);}return _0x759897;});}return null;};}function removeEntity(_0x530891,_0x50b5ee){return function(_0x397596){if(_0x397596){return _0x397596['destroy']({'transaction':_0x50b5ee})[_0xdd99('0x20')](function(){var _0xe33348=_0x397596['get']({'plain':!![]});if(_0xe33348[_0xdd99('0x2a')]==='admin')return;var _0x12cb17=[{'name':_0xdd99('0x2e'),'value':_0xdd99('0x2f'),'ignore':!![]},{'name':_0xdd99('0x30'),'value':_0xdd99('0x2b'),'ignore':![]},{'name':_0xdd99('0x31'),'value':_0xdd99('0x32'),'ignore':![]}];var _0x314d46=_(_0x12cb17)[_0xdd99('0x33')]('ignore')[_0xdd99('0x34')]('value')[_0xdd99('0x35')]();if(_[_0xdd99('0x36')](_0x314d46,_0xe33348[_0xdd99('0x2a')])){return;}var _0x29222f=_['find'](_0x12cb17,[_0xdd99('0x35'),_0xe33348[_0xdd99('0x2a')]])[_0xdd99('0x37')];return db[_0xdd99('0x38')][_0xdd99('0x39')]({'where':{'type':_0x29222f,'resourceId':_0xe33348['id']},'transaction':_0x50b5ee})[_0xdd99('0x20')](function(){return _0x397596;});})[_0xdd99('0x20')](function(){_0x530891[_0xdd99('0x17')](0xcc)[_0xdd99('0x3a')]();});}};}function handleEntityNotFound(_0x4a0499){return function(_0x14bf11){if(!_0x14bf11){_0x4a0499['sendStatus'](0x194);}return _0x14bf11;};}function handleError(_0x31229f,_0x216e43){_0x216e43=_0x216e43||0x1f4;return function(_0x20acfc){logger[_0xdd99('0x25')](_0x20acfc[_0xdd99('0x3b')]);if(_0x20acfc['name']){delete _0x20acfc[_0xdd99('0x37')];}_0x31229f[_0xdd99('0x17')](_0x216e43)['send'](_0x20acfc);};}function getUserAttributes(){return _(db[_0xdd99('0x3c')][_0xdd99('0x3d')])[_0xdd99('0x34')](function(_0x2c46ad){return{'name':_0x2c46ad['fieldName'],'type':_0x2c46ad['type']['key']};})[_0xdd99('0x33')](function(_0x4d42a3){return![_0xdd99('0x3e'),'salt','previousPasswords',_0xdd99('0x3f'),_0xdd99('0x40'),_0xdd99('0x41')]['includes'](_0x4d42a3[_0xdd99('0x37')]);})['value']();}exports[_0xdd99('0x42')]=function(_0x5242ec,_0x1fda14){var _0x280193={},_0x58f366={'count':0x0,'rows':[]};var _0x156c1a=getUserAttributes();_0x280193=qs[_0xdd99('0x43')](_0x156c1a,_0x5242ec);var _0x4f0464={'where':_0x280193[_0xdd99('0x44')]};return db['User'][_0xdd99('0x1a')](_0x4f0464)[_0xdd99('0x20')](function(_0x14474e){_0x58f366[_0xdd99('0x1a')]=_0x14474e;if(_0x5242ec[_0xdd99('0x45')][_0xdd99('0x46')]){_0x280193['include']=[{'all':!![]}];}if(_0x5242ec[_0xdd99('0x45')][_0xdd99('0x47')]===_0xdd99('0x48')){_0x280193[_0xdd99('0x49')]=[{'model':db[_0xdd99('0x4a')],'as':_0xdd99('0x47')}];}if(!_[_0xdd99('0x36')](_0x280193['attributes'],'id')){_0x280193['attributes'][_0xdd99('0x4b')]('id');}return db['User'][_0xdd99('0x4c')](_0x280193);})[_0xdd99('0x20')](function(_0x683e1c){_0x58f366[_0xdd99('0x4d')]=_0x683e1c;if(_0x5242ec[_0xdd99('0x45')][_0xdd99('0x4e')]===_0xdd99('0x48')){var _0x3335cc=[];for(var _0x24ac10=0x0;_0x24ac10<_0x58f366[_0xdd99('0x4d')]['length'];_0x24ac10++){_0x3335cc['push'](get_open_tabs('chat',_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x50'),_0x58f366['rows'][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x51'),_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x52'),_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc[_0xdd99('0x4b')](get_open_tabs('openchannel',_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc['push'](get_open_tabs(_0xdd99('0x53'),_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));}return Promise['all'](_0x3335cc)['then'](function(){return _0x58f366;});}else{return _0x58f366;}})[_0xdd99('0x20')](respondWithFilteredResult(_0x1fda14,_0x280193))[_0xdd99('0x28')](handleError(_0x1fda14,null));};exports['show']=function(_0x1ede07,_0x2c582f){var _0x37b0f4=getUserAttributes();_0x1ede07[_0xdd99('0x45')]['id']=_0x1ede07[_0xdd99('0x54')]['id'];var _0x301972=qs['getOptions'](_0x37b0f4,_0x1ede07);if(_0x1ede07['query'][_0xdd99('0x46')]){_0x301972[_0xdd99('0x49')]=[{'all':!![]}];}if(_0x1ede07[_0xdd99('0x45')][_0xdd99('0x47')]===_0xdd99('0x48')){_0x301972[_0xdd99('0x49')]=[{'model':db['UserSetting'],'as':_0xdd99('0x47')}];}_0x301972=_[_0xdd99('0x55')]({},_0x301972,_0x1ede07[_0xdd99('0x56')]);if(!_['includes'](_0x301972[_0xdd99('0x57')],'id')){_0x301972[_0xdd99('0x57')][_0xdd99('0x4b')]('id');}return db[_0xdd99('0x3c')][_0xdd99('0x58')](_0x301972)[_0xdd99('0x20')](handleEntityNotFound(_0x2c582f,null))[_0xdd99('0x20')](function(_0x3c4eb9){var _0xd2835a=[];values=_0x3c4eb9;if(_0x1ede07[_0xdd99('0x45')][_0xdd99('0x4e')]===_0xdd99('0x48')){_0xd2835a[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x59'),_0x3c4eb9['dataValues']));_0xd2835a[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x50'),_0x3c4eb9['dataValues']));_0xd2835a['push'](get_open_tabs(_0xdd99('0x5a'),_0x3c4eb9['dataValues']));_0xd2835a[_0xdd99('0x4b')](get_open_tabs('whatsapp',_0x3c4eb9[_0xdd99('0x4f')]));_0xd2835a['push'](get_open_tabs('fax',_0x3c4eb9[_0xdd99('0x4f')]));_0xd2835a[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x52'),_0x3c4eb9['dataValues']));return Promise[_0xdd99('0x5b')](_0xd2835a);}else{return values;}})[_0xdd99('0x20')](function(){return values;})[_0xdd99('0x20')](respondWithResult(_0x2c582f,null))[_0xdd99('0x28')](handleError(_0x2c582f,null));};exports['update']=function(_0x4a074d,_0x5559f5){if(_0x4a074d['body']['id']){delete _0x4a074d[_0xdd99('0x5c')]['id'];}delete _0x4a074d['body'][_0xdd99('0x2a')];return db[_0xdd99('0x3c')][_0xdd99('0x58')]({'where':{'id':_0x4a074d[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x5559f5,null))['then'](saveUpdates(_0x4a074d[_0xdd99('0x5c')],null))[_0xdd99('0x20')](respondWithResult(_0x5559f5,null))['catch'](handleError(_0x5559f5,null));};exports[_0xdd99('0x5d')]=function(_0x59adc5,_0x186ba3){return db['User'][_0xdd99('0x5d')]()[_0xdd99('0x20')](respondWithResult(_0x186ba3,null))[_0xdd99('0x28')](handleError(_0x186ba3,null));};exports[_0xdd99('0x5e')]=function(_0x5e5261,_0x354782){return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x5e5261[_0xdd99('0x54')]['id']}})['then'](handleEntityNotFound(_0x354782,null))[_0xdd99('0x20')](function(_0x5d6538){if(_0x5d6538){return _0x5d6538[_0xdd99('0x5e')](_0x5e5261[_0xdd99('0x5c')][_0xdd99('0x5f')],_[_0xdd99('0x60')](_0x5e5261[_0xdd99('0x5c')],[_0xdd99('0x5f'),'id'])||{});}})[_0xdd99('0x20')](respondWithResult(_0x354782,null))[_0xdd99('0x28')](handleError(_0x354782,null));};function validateUser(_0x45c890){return new Promise(function(_0x171352,_0x208e27){if(_0x45c890[_0xdd99('0x61')])return _0x171352(_0x45c890);return db[_0xdd99('0x62')][_0xdd99('0x63')](0x1)[_0xdd99('0x20')](function(_0x25385a){if(_0x25385a[_0xdd99('0x64')])authService[_0xdd99('0x65')](_0x45c890['password']);db['User'][_0xdd99('0x66')](_0xdd99('0x61'))[_0xdd99('0x20')](function(_0xa8c218){if(_['isNil'](_0xa8c218)){_0x45c890[_0xdd99('0x61')]=_0x25385a['min_internal']||0x1;return;}if(_[_0xdd99('0x67')](_0x25385a[_0xdd99('0x68')])||_0x25385a['min_internal']===_0xa8c218){_0x45c890[_0xdd99('0x61')]=_0xa8c218+0x1;return;}if(_0x25385a[_0xdd99('0x68')]>_0xa8c218){_0x45c890[_0xdd99('0x61')]=_0x25385a[_0xdd99('0x68')];return;}return db[_0xdd99('0x69')][_0xdd99('0x45')](_0xdd99('0x6a'),{'type':db[_0xdd99('0x69')][_0xdd99('0x6b')][_0xdd99('0x6c')]})[_0xdd99('0x20')](function(_0x16e323){if(_0x16e323&&_0x16e323[_0xdd99('0x6d')]){for(var _0x2cd418=0x0,_0x4527ea=_0x16e323[_0xdd99('0x6d')];_0x2cd418<_0x4527ea&&_[_0xdd99('0x67')](_0x45c890['internal']);_0x2cd418++){if(_0x25385a[_0xdd99('0x68')]<=_0x16e323[_0x2cd418][_0xdd99('0x6e')]){_0x45c890['internal']=_0x16e323[_0x2cd418][_0xdd99('0x6e')];}else if(_0x25385a[_0xdd99('0x68')]>_0x16e323[_0x2cd418]['from']&&_0x25385a['min_internal']<=_0x16e323[_0x2cd418]['to']){_0x45c890[_0xdd99('0x61')]=_0x25385a[_0xdd99('0x68')];}}}if(_['isNil'](_0x45c890[_0xdd99('0x61')])){_0x45c890[_0xdd99('0x61')]=_0xa8c218+0x1;}return _0x171352(_0x45c890);});});})['catch'](function(_0x329cbe){_0x208e27(_0x329cbe);});});}function updateUser(_0x3c060b){return new Promise(function(_0x5e21a2,_0x23b168){try{if(_0x3c060b[_0xdd99('0x6f')]){_0x3c060b[_0xdd99('0x70')]=_0x3c060b[_0xdd99('0x61')];_0x3c060b[_0xdd99('0x71')]={'mailbox':_0x3c060b[_0xdd99('0x61')],'password':_0x3c060b['password'],'fullname':_0x3c060b[_0xdd99('0x72')],'email':_0x3c060b[_0xdd99('0x73')]};}if(_0x3c060b[_0xdd99('0x2a')]===_0xdd99('0x2b')){if(!_0x3c060b[_0xdd99('0x74')])_0x3c060b[_0xdd99('0x74')]=['101',_0xdd99('0x75'),'103',_0xdd99('0x76'),_0xdd99('0x77'),'104',_0xdd99('0x78'),'106',_0xdd99('0x79'),_0xdd99('0x7a'),'109',_0xdd99('0x7b'),_0xdd99('0x7c'),_0xdd99('0x7d'),_0xdd99('0x7e')];}_0x5e21a2(_0x3c060b);}catch(_0x324618){_0x23b168(_0x324618);}});}exports[_0xdd99('0x7f')]=function(_0x4fe729,_0x3f8615){if(_0x4fe729[_0xdd99('0x2f')]['role']===_0xdd99('0x2b'))throw new Error(_0xdd99('0x80'));if(_0x4fe729[_0xdd99('0x5c')][_0xdd99('0x2a')]===_0xdd99('0x2f')&&_0x4fe729['user'][_0xdd99('0x2a')]!==_0xdd99('0x81')){throw new Error(_0xdd99('0x82'));}if(_0x4fe729[_0xdd99('0x5c')][_0xdd99('0x2a')]==='admin'&&_0x4fe729['user'][_0xdd99('0x2a')]!==_0xdd99('0x81')){throw new Error(_0xdd99('0x83'));}return licenseUtil[_0xdd99('0x84')]([_0x4fe729['body']])[_0xdd99('0x20')](function(){return validateUser(_0x4fe729[_0xdd99('0x5c')]);})[_0xdd99('0x20')](function(_0x2e5f16){return updateUser(_0x2e5f16)[_0xdd99('0x20')](function(_0xa25ae9){if(_0xa25ae9['role']===_0xdd99('0x81')){_0xa25ae9['settingsEnabled']=_0x4fe729[_0xdd99('0x2f')][_0xdd99('0x85')];delete _0xa25ae9[_0xdd99('0x86')];}return _0xa25ae9;});})[_0xdd99('0x20')](function(_0xafd9c3){return db[_0xdd99('0x3c')][_0xdd99('0x7f')](_0xafd9c3,{'include':[{'model':db['VoiceMail'],'as':_0xdd99('0x71')}]});})[_0xdd99('0x20')](function(_0x3aa055){if(_0x4fe729[_0xdd99('0x5c')][_0xdd99('0x2a')]===_0xdd99('0x2f'))return _0x3aa055;if(_0x4fe729[_0xdd99('0x2f')]['role']!==_0xdd99('0x2f'))return _0x3aa055;return db[_0xdd99('0x87')][_0xdd99('0x58')]({'where':{'name':_0x3aa055[_0xdd99('0x2a')]===_0xdd99('0x2b')?_0xdd99('0x30'):_0xdd99('0x31'),'userProfileId':_0x4fe729[_0xdd99('0x2f')][_0xdd99('0x86')]},'raw':!![]})[_0xdd99('0x20')](function(_0x1998f4){if(!_0x1998f4||_0x1998f4[_0xdd99('0x88')]!=0x0)return _0x3aa055;return db['UserProfileResource'][_0xdd99('0x7f')]({'name':_0x3aa055[_0xdd99('0x37')],'resourceId':_0x3aa055['id'],'type':_0x1998f4['name'],'sectionId':_0x1998f4['id']},{})[_0xdd99('0x20')](function(){return _0x3aa055;});})['catch'](function(_0x849ba6){logger[_0xdd99('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x849ba6);throw _0x849ba6;});})[_0xdd99('0x20')](respondWithResult(_0x3f8615,0xc9))[_0xdd99('0x28')](handleError(_0x3f8615,null));};exports[_0xdd99('0x89')]=function(_0x553cbb,_0x4757f9){var _0x14153d=_0x553cbb[_0xdd99('0x5c')];var _0x2180aa=[];if(_0x553cbb[_0xdd99('0x2f')][_0xdd99('0x2a')]===_0xdd99('0x2b'))throw new Error(_0xdd99('0x80'));if(_[_0xdd99('0x8a')](_0x14153d,['role',_0xdd99('0x2f')])&&_0x553cbb[_0xdd99('0x2f')][_0xdd99('0x2a')]!==_0xdd99('0x81')){throw new Error(_0xdd99('0x82'));}if(_['some'](_0x14153d,[_0xdd99('0x2a'),_0xdd99('0x81')])&&_0x553cbb['user'][_0xdd99('0x2a')]!=='admin'){throw new Error(_0xdd99('0x8b'));}return licenseUtil[_0xdd99('0x84')](_0x14153d)[_0xdd99('0x20')](function(){return validateUser(_0x14153d[0x0]);})[_0xdd99('0x20')](function(){for(var _0x49f32f=0x1;_0x49f32f<_0x14153d[_0xdd99('0x6d')];_0x49f32f++){var _0x1713fb=_0x14153d[_0x49f32f-0x1]['internal'];if(!_0x14153d[_0x49f32f][_0xdd99('0x61')])_0x14153d[_0x49f32f][_0xdd99('0x61')]=_0x1713fb+0x1;_0x2180aa[_0xdd99('0x4b')](validateUser(_0x14153d[_0x49f32f]));}return Promise[_0xdd99('0x5b')](_0x2180aa);})[_0xdd99('0x20')](function(){_0x2180aa=[];for(var _0x2280a0=0x0;_0x2280a0<_0x14153d['length'];_0x2280a0++){_0x2180aa['push'](updateUser(_0x14153d[_0x2280a0]));}return Promise[_0xdd99('0x5b')](_0x2180aa);})[_0xdd99('0x20')](function(){_0x2180aa=_0x14153d[_0xdd99('0x34')](function(_0x113f67){return db[_0xdd99('0x3c')]['create'](_0x113f67,{'include':[{'model':db[_0xdd99('0x71')],'as':_0xdd99('0x71')}]})[_0xdd99('0x20')](function(_0x37936b){_0x113f67['id']=_0x37936b['id'];return _0x113f67;});});return Promise['all'](_0x2180aa);})['then'](function(_0x4bb461){if(_0x553cbb['body'][_0xdd99('0x2a')]==='user')return _0x4bb461;if(_0x553cbb[_0xdd99('0x2f')][_0xdd99('0x2a')]!==_0xdd99('0x2f'))return _0x4bb461;var _0x3ea52c=_[_0xdd99('0x8a')](_0x4bb461,function(_0x2b64da){return _0x2b64da['role']===_0xdd99('0x2b')||_0x2b64da[_0xdd99('0x2a')]===_0xdd99('0x32');});if(!_0x3ea52c)return _0x4bb461;return db[_0xdd99('0x87')]['findAll']({'where':{'name':{'$or':[_0xdd99('0x30'),_0xdd99('0x31')]},'userProfileId':_0x553cbb[_0xdd99('0x2f')][_0xdd99('0x86')]},'raw':!![]})[_0xdd99('0x20')](function(_0x5a377b){if(_[_0xdd99('0x8c')](_0x5a377b)||!_['some'](_0x5a377b,[_0xdd99('0x88'),0x0]))return _0x4bb461;_0x2180aa=[];var _0x530989=_(_0x5a377b)[_0xdd99('0x34')](function(_0x42e9fe){if(_0x42e9fe[_0xdd99('0x88')]===0x1)return;return _0x42e9fe[_0xdd99('0x37')]===_0xdd99('0x30')?_0xdd99('0x2b'):_0xdd99('0x32');})['compact']()['value']();for(var _0x12c5c0=0x0;_0x12c5c0<_0x4bb461[_0xdd99('0x6d')];_0x12c5c0++){if(!_[_0xdd99('0x36')](_0x530989,_0x4bb461[_0x12c5c0][_0xdd99('0x2a')]))return;var _0x3e8622=_0x4bb461[_0x12c5c0]['role']===_0xdd99('0x2b')?_0xdd99('0x30'):_0xdd99('0x31');_0x2180aa[_0xdd99('0x4b')](db[_0xdd99('0x38')][_0xdd99('0x7f')]({'name':_0x4bb461[_0x12c5c0][_0xdd99('0x37')],'resourceId':_0x4bb461[_0x12c5c0]['id'],'type':_0x3e8622,'sectionId':_[_0xdd99('0x58')](_0x5a377b,[_0xdd99('0x37'),_0x3e8622])['id']},{}));}return Promise[_0xdd99('0x5b')](_0x2180aa);});})[_0xdd99('0x20')](respondWithResult(_0x4757f9,0xc9))[_0xdd99('0x28')](handleError(_0x4757f9,null));};exports['changePassword']=function(_0x5b8cfb,_0x492588){if(_0x5b8cfb['body']['id']){delete _0x5b8cfb[_0xdd99('0x5c')]['id'];}return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x5b8cfb['params']['id']}})[_0xdd99('0x20')](function(_0x13df3c){if(!_0x13df3c)return null;if(_0x13df3c['id']===_0x5b8cfb['user']['id']){if(!_0x5b8cfb[_0xdd99('0x5c')]['oldPassword']||!_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')]){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x90'));}if(!_0x13df3c[_0xdd99('0x91')](_0x5b8cfb[_0xdd99('0x5c')]['oldPassword'])){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x92'));}if(_0x5b8cfb['body'][_0xdd99('0x93')]===_0x5b8cfb['body'][_0xdd99('0x8d')]){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5b8cfb[_0xdd99('0x2f')][_0xdd99('0x2a')]===_0xdd99('0x81')){if(!_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')]){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x94'));}}else if(_0x5b8cfb['user']['role']==='user'){if(!_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')]){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x94'));}if(_0x13df3c[_0xdd99('0x2a')]!=='agent'){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x80'));}}else{throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x80'));}return _0x13df3c;})[_0xdd99('0x20')](handleEntityNotFound(_0x492588,null))[_0xdd99('0x20')](function(_0xdcc380){return db[_0xdd99('0x62')][_0xdd99('0x95')]({'attributes':['id',_0xdd99('0x64'),'enforcePasswordHistory',_0xdd99('0x96')]})[_0xdd99('0x20')](function(_0x24def6){if(_0x24def6['securePassword'])authService[_0xdd99('0x65')](_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')]);if(!_0x24def6['enforcePasswordHistory']||!_0xdcc380['previousPasswords'])return _0xdcc380;authService[_0xdd99('0x97')](_0x5b8cfb[_0xdd99('0x5c')]['newPassword'],_0xdcc380['previousPasswords'],_0x24def6[_0xdd99('0x96')]);return _0xdcc380;})[_0xdd99('0x20')](saveUpdates({'password':_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')],'passwordResetAt':_0x5b8cfb['user']['id']==_0x5b8cfb['params']['id']?moment():null,'previousPasswords':authService[_0xdd99('0x98')](_0x5b8cfb[_0xdd99('0x5c')]['newPassword'],_0xdcc380[_0xdd99('0x99')])},null));})[_0xdd99('0x20')](respondWithResult(_0x492588,null))[_0xdd99('0x28')](handleError(_0x492588,null));};exports[_0xdd99('0x9a')]=function(_0x3d5579,_0x2764f0){var _0x543938=_0x3d5579['body'][_0xdd99('0x9b')];return db[_0xdd99('0x3c')][_0xdd99('0x58')]({'where':{'id':_0x3d5579[_0xdd99('0x54')]['id']},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a'),_0xdd99('0x9c'),_0xdd99('0x9d'),_0xdd99('0x9e'),_0xdd99('0x9f')]})[_0xdd99('0x20')](handleEntityNotFound(_0x2764f0,null))['then'](function(_0x55d723){if(_0x55d723){if(!utils[_0xdd99('0xa0')](_0x543938)){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0xa1'));}return _0x55d723[_0xdd99('0xa2')+_['capitalize'](_0x543938[_0xdd99('0xa3')]())+_0xdd99('0xa4')](_0x3d5579[_0xdd99('0x5c')]['ids'],{'penalty':_0x3d5579[_0xdd99('0x5c')][_0xdd99('0xa5')]||0x0})['spread'](function(_0x3a2f33){for(var _0xac256f=0x0;_0xac256f<_0x3d5579[_0xdd99('0x5c')]['ids']['length'];_0xac256f+=0x1){var _0x431b17={'UserId':Number(_0x3d5579[_0xdd99('0x54')]['id'])};_0x431b17[_[_0xdd99('0xa6')](_0x543938[_0xdd99('0xa3')]())+_0xdd99('0xa7')]=Number(_0x3d5579[_0xdd99('0x5c')]['ids'][_0xac256f]);socket['emit']('user'+_[_0xdd99('0xa6')](_0x543938[_0xdd99('0xa3')]())+_0xdd99('0xa8'),_0x431b17);}return _0x3a2f33;})['then'](function(){if(_0x543938===_0xdd99('0xa9')){return db[_0xdd99('0xaa')][_0xdd99('0x4c')]({'where':{'id':_0x3d5579['body'][_0xdd99('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xdd99('0x20')](function(_0x36962a){var _0x1d16d4=_0x55d723[_0xdd99('0xab')]({'plain':!![]});var _0x5499d6=[];if(_0x543938==='voice'&&_0x1d16d4['role']===_0xdd99('0x2b')&&_0x1d16d4[_0xdd99('0x9c')]){for(let _0xaaeeef=0x0;_0xaaeeef<_0x36962a[_0xdd99('0x6d')];_0xaaeeef+=0x1){_0x5499d6[_0xdd99('0x4b')]({'membername':_0x1d16d4[_0xdd99('0x37')],'UserId':_0x1d16d4['id'],'queue_name':_0x36962a[_0xaaeeef]['name'],'VoiceQueueId':_0x36962a[_0xaaeeef]['id'],'interface':_['isNil'](_0x1d16d4[_0xdd99('0x9f')])?util[_0xdd99('0xac')](_0xdd99('0xad'),_0x1d16d4['name']):_0x1d16d4['interface'],'paused':_0x1d16d4[_0xdd99('0x9e')]||![],'penalty':_0x3d5579['body'][_0xdd99('0xa5')]||0x0});}return Promise[_0xdd99('0x5b')](_0x5499d6[_0xdd99('0x34')](function(_0xa96bd){return db[_0xdd99('0xae')]['upsert'](_0xa96bd);}));}return _0x55d723;});}})[_0xdd99('0x20')](respondWithStatusCode(_0x2764f0,null))[_0xdd99('0x28')](handleError(_0x2764f0,null));};exports[_0xdd99('0xaf')]=function(_0x3fe28e,_0x1015a9){var _0x59711a,_0x72e329;return db['User'][_0xdd99('0x58')]({'where':{'id':_0x3fe28e[_0xdd99('0x54')]['id']},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a')]})[_0xdd99('0x20')](handleEntityNotFound(_0x1015a9,null))['then'](function(_0x1a036a){if(_0x1a036a){_0x59711a=_0x1a036a;if(!_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x9b')]||!utils[_0xdd99('0xa0')](_0x3fe28e[_0xdd99('0x45')]['channel'])){throw new db[(_0xdd99('0x8e'))]['ValidationError']('Unknown\x20channel');}return _0x1a036a[_0xdd99('0xb0')+_[_0xdd99('0xa6')](_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x9b')][_0xdd99('0xa3')]())+_0xdd99('0xa4')](_0x3fe28e['query'][_0xdd99('0x5f')]);}})[_0xdd99('0x20')](function(_0x10804a){if(_['isArray'](_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x5f')])){for(var _0x233e34=0x0;_0x233e34<_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x5f')][_0xdd99('0x6d')];_0x233e34+=0x1){_0x72e329={'UserId':Number(_0x3fe28e[_0xdd99('0x54')]['id'])};_0x72e329[_[_0xdd99('0xa6')](_0x3fe28e['query']['channel']['toLowerCase']())+_0xdd99('0xa7')]=Number(_0x3fe28e[_0xdd99('0x45')]['ids'][_0x233e34]);socket[_0xdd99('0x2c')]('user'+_[_0xdd99('0xa6')](_0x3fe28e['query'][_0xdd99('0x9b')]['toLowerCase']())+_0xdd99('0xb1'),_0x72e329);}}else{_0x72e329={'UserId':Number(_0x3fe28e[_0xdd99('0x54')]['id'])};_0x72e329[_[_0xdd99('0xa6')](_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x9b')][_0xdd99('0xa3')]())+_0xdd99('0xa7')]=Number(_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x5f')]);socket[_0xdd99('0x2c')]('user'+_[_0xdd99('0xa6')](_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x9b')][_0xdd99('0xa3')]())+_0xdd99('0xb1'),_0x72e329);}return _0x10804a;})[_0xdd99('0x20')](function(){if(_0x3fe28e['query'][_0xdd99('0x9b')]===_0xdd99('0xa9')){return db['UserVoiceQueueRt'][_0xdd99('0x39')]({'where':{'UserId':_0x3fe28e[_0xdd99('0x54')]['id'],'VoiceQueueId':_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x5f')]},'individualHooks':!![]})[_0xdd99('0x20')](function(){return _0x59711a;});}return _0x59711a;})[_0xdd99('0x20')](respondWithStatusCode(_0x1015a9,null))['catch'](handleError(_0x1015a9,null));};exports[_0xdd99('0xb2')]=function(_0x21b43a,_0x4f2a11){_0x21b43a[_0xdd99('0x5c')][_0xdd99('0xb3')]=_0x21b43a['file'][_0xdd99('0xb4')];return db[_0xdd99('0x3c')][_0xdd99('0x58')]({'where':{'id':_0x21b43a[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x4f2a11,null))[_0xdd99('0x20')](saveUpdates(_0x21b43a[_0xdd99('0x5c')],null))[_0xdd99('0x20')](respondWithResult(_0x4f2a11,null))[_0xdd99('0x28')](handleError(_0x4f2a11,null));};exports[_0xdd99('0xb5')]=function(_0x2c4f92,_0x49c61b){var _0x54bed8=path['join'](config[_0xdd99('0xb6')],_0xdd99('0xb7'));return db['User'][_0xdd99('0x58')]({'where':{'id':_0x2c4f92[_0xdd99('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x49c61b,null))[_0xdd99('0x20')](function(_0x40e29b){if(_0x40e29b){if(_[_0xdd99('0x67')](_0x40e29b['userpic'])){return _0x49c61b[_0xdd99('0xb8')](_0x54bed8);}else{if(!fs[_0xdd99('0xb9')](path[_0xdd99('0xba')](config[_0xdd99('0xb6')],_0xdd99('0xbb'),_0x40e29b[_0xdd99('0xb3')]))){return _0x49c61b['download'](_0x54bed8);}return _0x49c61b[_0xdd99('0xb8')](path[_0xdd99('0xba')](config[_0xdd99('0xb6')],_0xdd99('0xbb'),_0x40e29b[_0xdd99('0xb3')]));}}})['catch'](handleError(_0x49c61b,null));};exports[_0xdd99('0xbc')]=function(_0x412896,_0x43b062){return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x412896[_0xdd99('0x54')]['id']},'attributes':['id']})[_0xdd99('0x20')](handleEntityNotFound(_0x43b062,null))['then'](function(_0x32de15){var _0xef7dcf=[];values=_0x32de15[_0xdd99('0x4f')];_0xef7dcf['push'](get_open_tabs(_0xdd99('0x59'),_0x32de15[_0xdd99('0x4f')]));_0xef7dcf[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x50'),_0x32de15[_0xdd99('0x4f')]));_0xef7dcf['push'](get_open_tabs('openchannel',_0x32de15[_0xdd99('0x4f')]));_0xef7dcf[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x53'),_0x32de15['dataValues']));_0xef7dcf[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x51'),_0x32de15[_0xdd99('0x4f')]));_0xef7dcf[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x52'),_0x32de15[_0xdd99('0x4f')]));return Promise[_0xdd99('0x5b')](_0xef7dcf);})[_0xdd99('0x20')](function(_0x1a909f){if(_0x1a909f){var _0x9e92bf=_['map'](values[_0xdd99('0xbd')],function(_0x35989d){return{'channel':_0xdd99('0xbe'),'id':_0x35989d['id'],'createdAt':_0x35989d[_0xdd99('0xbf')]};});var _0x3d59dd=_['map'](values[_0xdd99('0xc0')],function(_0x2b4efd){return{'channel':'FAX','id':_0x2b4efd['id'],'createdAt':_0x2b4efd[_0xdd99('0xbf')]};});var _0x403695=_['map'](values[_0xdd99('0xc1')],function(_0x30921d){return{'channel':'OPENCHANNEL','id':_0x30921d['id'],'createdAt':_0x30921d[_0xdd99('0xbf')]};});var _0x498d57=_[_0xdd99('0x34')](values[_0xdd99('0xc2')],function(_0x2e83f3){return{'channel':'MAIL','id':_0x2e83f3['id'],'createdAt':_0x2e83f3['createdAt']};});var _0x9e5214=_[_0xdd99('0x34')](values['SmsOpenTabs'],function(_0x1e9486){return{'channel':_0xdd99('0xc3'),'id':_0x1e9486['id'],'createdAt':_0x1e9486['createdAt']};});var _0x27a15a=_[_0xdd99('0x34')](values[_0xdd99('0xc4')],function(_0x5a9412){return{'channel':_0xdd99('0xc5'),'id':_0x5a9412['id'],'createdAt':_0x5a9412['createdAt']};});var _0x14fe3f=_['concat'](_0x9e92bf,_0x3d59dd,_0x403695,_0x498d57,_0x9e5214,_0x27a15a);var _0x3eca4d={'count':_0x14fe3f['length'],'rows':_0x14fe3f};return _0x3eca4d;}else return null;})[_0xdd99('0x20')](respondWithResult(_0x43b062,null))[_0xdd99('0x28')](handleError(_0x43b062,null));};exports['getContacts']=function(_0x580f41,_0x5a02f8){var _0x232779={};return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x580f41[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](function(_0x2db4ad){if(!_0x2db4ad){throw new APINotFoundError(util[_0xdd99('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x580f41[_0xdd99('0x54')]['id']));}return contacts[_0xdd99('0x5d')]();})[_0xdd99('0x20')](function(_0x35d610){_0x580f41[_0xdd99('0x45')]['User']=_0x580f41[_0xdd99('0x54')]['id'];_0x232779=qs['getOptions'](_0x35d610,_0x580f41);if(_0x580f41[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0x46'))){_0x232779[_0xdd99('0x49')]=[{'model':db[_0xdd99('0xc7')],'as':_0xdd99('0xc8'),'required':![]},{'model':db[_0xdd99('0xc9')],'as':_0xdd99('0xca'),'attributes':['id','name',_0xdd99('0xcb')],'where':_0x580f41[_0xdd99('0x45')][_0xdd99('0xcc')]?{'id':_0x580f41[_0xdd99('0x45')][_0xdd99('0xcc')]}:undefined,'required':_0x580f41[_0xdd99('0x45')]['tag']?!![]:![]}];}return contacts[_0xdd99('0x4c')](_0x580f41[_0xdd99('0x45')],_0x580f41[_0xdd99('0x2f')],_0x232779,_0x35d610);})[_0xdd99('0x20')](respondWithFilteredResult(_0x5a02f8,_0x232779))[_0xdd99('0x28')](APIHandleError(_0x5a02f8));};exports[_0xdd99('0xcd')]=function(_0x51663b,_0x4f3fde){var _0x1d0648;var _0x366986={};var _0x16fb94;return db[_0xdd99('0x3c')]['findOne']({'where':{'id':_0x51663b[_0xdd99('0x54')]['id']},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a')]})[_0xdd99('0x20')](handleEntityNotFound(_0x4f3fde,null))[_0xdd99('0x20')](function(_0x2eb0a7){if(!utils[_0xdd99('0xa0')](_0x51663b[_0xdd99('0x45')][_0xdd99('0x9b')])){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0xa1'));}_0x1d0648=_0x2eb0a7;var _0x421c7f={};_0x421c7f[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db[_['capitalize'](_0x51663b['query'][_0xdd99('0x9b')])+_0xdd99('0xd0')][_0xdd99('0x3d')]);_0x421c7f[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x51663b[_0xdd99('0x45')]);_0x421c7f['filters']=_[_0xdd99('0xd1')](_0x421c7f[_0xdd99('0xce')],_0x421c7f[_0xdd99('0x45')]);_0x366986[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x421c7f[_0xdd99('0xce')],qs['fields'](_0x51663b[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x366986['attributes']=_0x366986[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x366986[_0xdd99('0x57')]:_0x421c7f[_0xdd99('0xce')];_0x366986['order']=qs[_0xdd99('0xd3')](_0x51663b[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x366986[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x51663b[_0xdd99('0x45')],_0x421c7f['filters']));if(_0x51663b[_0xdd99('0x45')][_0xdd99('0x33')]){_0x366986[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0x366986['where'],{'$or':_[_0xdd99('0x34')](_0x366986[_0xdd99('0x57')],function(_0x289cf0){var _0x22d24d={};_0x22d24d[_0x289cf0]={'$like':'%'+_0x51663b[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x22d24d;})});}_0x366986=_[_0xdd99('0x55')]({},_0x366986,_0x51663b[_0xdd99('0x56')]);switch(_0x1d0648['role']){case _0xdd99('0x81'):return db[_[_0xdd99('0xa6')](_0x51663b['query']['channel'])+_0xdd99('0xd0')]['findAll'](_0x366986);case _0xdd99('0x2f'):case'agent':return _0x1d0648[_0xdd99('0xab')+_[_0xdd99('0xa6')](_0x51663b['query']['channel'])+_0xdd99('0xa4')](_0x366986);default:throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0xd5'));}})[_0xdd99('0x20')](function(_0x5d52a9){_0x16fb94=_0x5d52a9['length'];if(!_0x51663b[_0xdd99('0x45')]['hasOwnProperty'](_0xdd99('0xd6'))){_0x366986[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x51663b['query']['limit']);_0x366986[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x51663b[_0xdd99('0x45')][_0xdd99('0x1b')]);}switch(_0x1d0648[_0xdd99('0x2a')]){case _0xdd99('0x81'):return db[_[_0xdd99('0xa6')](_0x51663b[_0xdd99('0x45')][_0xdd99('0x9b')])+'Queue']['findAll'](_0x366986);case _0xdd99('0x2f'):case _0xdd99('0x2b'):return _0x1d0648['get'+_[_0xdd99('0xa6')](_0x51663b[_0xdd99('0x45')]['channel'])+_0xdd99('0xa4')](_0x366986);}})[_0xdd99('0x20')](function(_0x41fc04){return{'count':_0x16fb94,'rows':_0x41fc04};})[_0xdd99('0x20')](respondWithResult(_0x4f3fde,null))[_0xdd99('0x28')](handleError(_0x4f3fde,null));};exports[_0xdd99('0xd7')]=function(_0x3d7314,_0x19b232){var _0x553114={};var _0x24f86d={};var _0x545828;var _0x412955;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x3d7314[_0xdd99('0x54')]['id']}})['then'](handleEntityNotFound(_0x19b232,null))[_0xdd99('0x20')](function(_0x1274ae){if(_0x1274ae){_0x545828=_0x1274ae;_0x24f86d[_0xdd99('0xce')]=_['keys'](db['UserVoiceQueueRt'][_0xdd99('0x3d')]);_0x24f86d['query']=_[_0xdd99('0xcf')](_0x3d7314[_0xdd99('0x45')]);_0x24f86d[_0xdd99('0xd8')]=_['intersection'](_0x24f86d[_0xdd99('0xce')],_0x24f86d[_0xdd99('0x45')]);_0x553114[_0xdd99('0x57')]=_['intersection'](_0x24f86d[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x3d7314['query'][_0xdd99('0xd2')]));_0x553114[_0xdd99('0x57')]=_0x553114[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x553114[_0xdd99('0x57')]:_0x24f86d[_0xdd99('0xce')];_0x553114[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x3d7314[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x553114[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x3d7314[_0xdd99('0x45')],_0x24f86d[_0xdd99('0xd8')]));if(_0x3d7314[_0xdd99('0x45')][_0xdd99('0x33')]){_0x553114['where']=_['merge'](_0x553114[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x553114[_0xdd99('0x57')],function(_0xcb9610){var _0x17c571={};_0x17c571[_0xcb9610]={'$like':'%'+_0x3d7314['query'][_0xdd99('0x33')]+'%'};return _0x17c571;})});}_0x553114=_['merge']({},_0x553114,_0x3d7314[_0xdd99('0x56')]);return _0x545828[_0xdd99('0xd7')](_0x553114);}})['then'](function(_0x457090){if(_0x457090){_0x412955=_0x457090[_0xdd99('0x6d')];if(!_0x3d7314[_0xdd99('0x45')][_0xdd99('0xc6')]('nolimit')){_0x553114[_0xdd99('0x1c')]=qs['limit'](_0x3d7314['query'][_0xdd99('0x1c')]);_0x553114[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x3d7314['query'][_0xdd99('0x1b')]);}return _0x545828[_0xdd99('0xd7')](_0x553114);}})['then'](function(_0x4185bf){if(_0x4185bf){return _0x4185bf?{'count':_0x412955,'rows':_0x4185bf}:null;}})[_0xdd99('0x20')](respondWithResult(_0x19b232,null))[_0xdd99('0x28')](handleError(_0x19b232,null));};exports['getGroups']=function(_0x137930,_0x42e35e){var _0x46c2fc={};var _0x453805={};var _0x325112;var _0x11ed21;return db[_0xdd99('0x3c')]['findOne']({'where':{'id':_0x137930[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x42e35e,null))[_0xdd99('0x20')](function(_0x19c6e4){if(_0x19c6e4){_0x325112=_0x19c6e4;_0x453805[_0xdd99('0xce')]=_['keys'](db[_0xdd99('0xda')][_0xdd99('0x3d')]);_0x453805[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x137930['query']);_0x453805[_0xdd99('0xd8')]=_['intersection'](_0x453805['model'],_0x453805[_0xdd99('0x45')]);_0x46c2fc[_0xdd99('0x57')]=_['intersection'](_0x453805[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x137930[_0xdd99('0x45')]['fields']));_0x46c2fc[_0xdd99('0x57')]=_0x46c2fc['attributes'][_0xdd99('0x6d')]?_0x46c2fc[_0xdd99('0x57')]:_0x453805['model'];_0x46c2fc[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x137930['query'][_0xdd99('0xd3')]);_0x46c2fc[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x137930['query'],_0x453805[_0xdd99('0xd8')]));if(_0x137930[_0xdd99('0x45')][_0xdd99('0x33')]){_0x46c2fc[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0x46c2fc['where'],{'$or':_[_0xdd99('0x34')](_0x46c2fc[_0xdd99('0x57')],function(_0x5adbb9){var _0x13b90c={};_0x13b90c[_0x5adbb9]={'$like':'%'+_0x137930[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x13b90c;})});}_0x46c2fc=_[_0xdd99('0x55')]({},_0x46c2fc,_0x137930[_0xdd99('0x56')]);return _0x325112[_0xdd99('0xdb')](_0x46c2fc);}})[_0xdd99('0x20')](function(_0x11d5a7){if(_0x11d5a7){_0x11ed21=_0x11d5a7[_0xdd99('0x6d')];if(!_0x137930[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0x46c2fc[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x137930[_0xdd99('0x45')][_0xdd99('0x1c')]);_0x46c2fc[_0xdd99('0x1b')]=qs['offset'](_0x137930['query'][_0xdd99('0x1b')]);}return _0x325112[_0xdd99('0xdb')](_0x46c2fc);}})[_0xdd99('0x20')](function(_0x109fff){if(_0x109fff){return _0x109fff?{'count':_0x11ed21,'rows':_0x109fff}:null;}})['then'](respondWithResult(_0x42e35e,null))['catch'](handleError(_0x42e35e,null));};exports[_0xdd99('0xdc')]=function(_0x1670fc,_0x36f3c2){var _0x7cb3e2={'raw':!![],'where':{}};var _0x57e2c2={};var _0x73d7fe={'count':0x0,'rows':[]};return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x1670fc[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x36f3c2,null))['then'](function(_0x11a5a1){if(_0x11a5a1){_0x57e2c2[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db['VoiceRecording'][_0xdd99('0x3d')]);_0x57e2c2[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x1670fc[_0xdd99('0x45')]);_0x57e2c2['filters']=_[_0xdd99('0xd1')](_0x57e2c2[_0xdd99('0xce')],_0x57e2c2[_0xdd99('0x45')]);_0x7cb3e2[_0xdd99('0x57')]=_['intersection'](_0x57e2c2[_0xdd99('0xce')],qs['fields'](_0x1670fc[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x7cb3e2['attributes']=_0x7cb3e2[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x7cb3e2[_0xdd99('0x57')]:_0x57e2c2[_0xdd99('0xce')];if(!_0x1670fc[_0xdd99('0x45')][_0xdd99('0xc6')]('nolimit')){_0x7cb3e2[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x1670fc['query'][_0xdd99('0x1c')]);_0x7cb3e2['offset']=qs[_0xdd99('0x1b')](_0x1670fc[_0xdd99('0x45')][_0xdd99('0x1b')]);}_0x7cb3e2[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x1670fc[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x7cb3e2['where']=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x1670fc['query'],_0x57e2c2[_0xdd99('0xd8')]));_0x7cb3e2['where'][_0xdd99('0xdd')]=_0x11a5a1['id'];if(_0x1670fc[_0xdd99('0x45')][_0xdd99('0x33')]){_0x7cb3e2[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0x7cb3e2[_0xdd99('0x44')],{'$or':_['map'](_0x7cb3e2[_0xdd99('0x57')],function(_0x102be6){var _0x248d74={};_0x248d74[_0x102be6]={'$like':'%'+_0x1670fc[_0xdd99('0x45')]['filter']+'%'};return _0x248d74;})});}_0x7cb3e2=_[_0xdd99('0x55')]({},_0x7cb3e2,_0x1670fc[_0xdd99('0x56')]);return db['VoiceRecording'][_0xdd99('0x1a')]({'where':_0x7cb3e2[_0xdd99('0x44')]})[_0xdd99('0x20')](function(_0x155e4a){_0x73d7fe[_0xdd99('0x1a')]=_0x155e4a;if(_0x1670fc['query']['includeAll']){_0x7cb3e2[_0xdd99('0x49')]=[{'all':!![]}];}return db[_0xdd99('0xde')]['findAll'](_0x7cb3e2);})[_0xdd99('0x20')](function(_0x2b76c9){_0x73d7fe[_0xdd99('0x4d')]=_0x2b76c9;return _0x73d7fe;});}})['then'](respondWithFilteredResult(_0x36f3c2,_0x7cb3e2))[_0xdd99('0x28')](handleError(_0x36f3c2,null));};exports[_0xdd99('0xdf')]=function(_0x2acee9,_0x4196d2){var _0x4e3dcd={'raw':!![],'where':{}};var _0x162102={};var _0x31ac55={'count':0x0,'rows':[]};return db[_0xdd99('0x3c')]['findOne']({'where':{'id':_0x2acee9[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x4196d2,null))[_0xdd99('0x20')](function(_0x13d7e4){if(_0x13d7e4){_0x162102[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db['ScreenRecording'][_0xdd99('0x3d')]);_0x162102[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x2acee9['query']);_0x162102[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x162102[_0xdd99('0xce')],_0x162102[_0xdd99('0x45')]);_0x4e3dcd[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x162102['model'],qs['fields'](_0x2acee9[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x4e3dcd[_0xdd99('0x57')]=_0x4e3dcd[_0xdd99('0x57')]['length']?_0x4e3dcd[_0xdd99('0x57')]:_0x162102['model'];if(!_0x2acee9[_0xdd99('0x45')][_0xdd99('0xc6')]('nolimit')){_0x4e3dcd[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x2acee9['query'][_0xdd99('0x1c')]);_0x4e3dcd['offset']=qs[_0xdd99('0x1b')](_0x2acee9[_0xdd99('0x45')][_0xdd99('0x1b')]);}_0x4e3dcd[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x2acee9['query'][_0xdd99('0xd3')]);_0x4e3dcd[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x2acee9[_0xdd99('0x45')],_0x162102['filters']));_0x4e3dcd['where']['UserId']=_0x13d7e4['id'];if(_0x2acee9[_0xdd99('0x45')][_0xdd99('0x33')]){_0x4e3dcd[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0x4e3dcd[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x4e3dcd['attributes'],function(_0x348cf8){var _0x4f7081={};_0x4f7081[_0x348cf8]={'$like':'%'+_0x2acee9[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x4f7081;})});}_0x4e3dcd=_[_0xdd99('0x55')]({},_0x4e3dcd,_0x2acee9[_0xdd99('0x56')]);return db[_0xdd99('0xe0')][_0xdd99('0x1a')]({'where':_0x4e3dcd[_0xdd99('0x44')]})[_0xdd99('0x20')](function(_0x4317ec){_0x31ac55[_0xdd99('0x1a')]=_0x4317ec;if(_0x2acee9[_0xdd99('0x45')]['includeAll']){_0x4e3dcd[_0xdd99('0x49')]=[{'all':!![]}];}return db[_0xdd99('0xe0')][_0xdd99('0x4c')](_0x4e3dcd);})['then'](function(_0x344980){_0x31ac55['rows']=_0x344980;return _0x31ac55;});}})[_0xdd99('0x20')](respondWithFilteredResult(_0x4196d2,_0x4e3dcd))[_0xdd99('0x28')](handleError(_0x4196d2,null));};exports[_0xdd99('0xe1')]=function(_0x4110e3,_0x31c4de){var _0x5f6515={};var _0x3dec6c={};var _0x425fdf;var _0x26bcb9;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x4110e3['params']['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x31c4de,null))[_0xdd99('0x20')](function(_0x335996){if(_0x335996){_0x425fdf=_0x335996;_0x3dec6c['model']=_[_0xdd99('0xcf')](db[_0xdd99('0xe2')][_0xdd99('0x3d')]);_0x3dec6c[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x4110e3['query']);_0x3dec6c[_0xdd99('0xd8')]=_['intersection'](_0x3dec6c[_0xdd99('0xce')],_0x3dec6c[_0xdd99('0x45')]);_0x5f6515['attributes']=_[_0xdd99('0xd1')](_0x3dec6c['model'],qs['fields'](_0x4110e3[_0xdd99('0x45')]['fields']));_0x5f6515[_0xdd99('0x57')]=_0x5f6515[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x5f6515[_0xdd99('0x57')]:_0x3dec6c[_0xdd99('0xce')];_0x5f6515[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x4110e3[_0xdd99('0x45')]['sort']);_0x5f6515[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x4110e3[_0xdd99('0x45')],_0x3dec6c[_0xdd99('0xd8')]));if(_0x4110e3[_0xdd99('0x45')][_0xdd99('0x33')]){_0x5f6515[_0xdd99('0x44')]=_['merge'](_0x5f6515[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x5f6515['attributes'],function(_0x468074){var _0x647d2e={};_0x647d2e[_0x468074]={'$like':'%'+_0x4110e3[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x647d2e;})});}_0x5f6515=_[_0xdd99('0x55')]({},_0x5f6515,_0x4110e3[_0xdd99('0x56')]);return _0x425fdf['getChatInteractions'](_0x5f6515);}})[_0xdd99('0x20')](function(_0xd17d60){if(_0xd17d60){_0x26bcb9=_0xd17d60['length'];if(!_0x4110e3['query'][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0x5f6515[_0xdd99('0x1c')]=qs['limit'](_0x4110e3[_0xdd99('0x45')][_0xdd99('0x1c')]);_0x5f6515['offset']=qs['offset'](_0x4110e3[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0x425fdf['getChatInteractions'](_0x5f6515);}})[_0xdd99('0x20')](function(_0x50a166){if(_0x50a166){return _0x50a166?{'count':_0x26bcb9,'rows':_0x50a166}:null;}})[_0xdd99('0x20')](respondWithResult(_0x31c4de,null))['catch'](handleError(_0x31c4de,null));};exports[_0xdd99('0xe3')]=function(_0x439573,_0x5103c3){var _0xca6c27={};var _0x45068f={};var _0x33a879;var _0x32b81e;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x439573[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x5103c3,null))[_0xdd99('0x20')](function(_0x11c7dd){if(_0x11c7dd){_0x33a879=_0x11c7dd;_0x45068f[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db[_0xdd99('0xe4')]['rawAttributes']);_0x45068f[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x439573[_0xdd99('0x45')]);_0x45068f[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x45068f[_0xdd99('0xce')],_0x45068f[_0xdd99('0x45')]);_0xca6c27[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x45068f[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x439573[_0xdd99('0x45')]['fields']));_0xca6c27['attributes']=_0xca6c27[_0xdd99('0x57')][_0xdd99('0x6d')]?_0xca6c27['attributes']:_0x45068f['model'];_0xca6c27['order']=qs[_0xdd99('0xd3')](_0x439573[_0xdd99('0x45')][_0xdd99('0xd3')]);_0xca6c27[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x439573[_0xdd99('0x45')],_0x45068f[_0xdd99('0xd8')]));if(_0x439573[_0xdd99('0x45')][_0xdd99('0x33')]){_0xca6c27[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0xca6c27[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0xca6c27[_0xdd99('0x57')],function(_0x35966a){var _0x18d7f0={};_0x18d7f0[_0x35966a]={'$like':'%'+_0x439573[_0xdd99('0x45')]['filter']+'%'};return _0x18d7f0;})});}_0xca6c27=_[_0xdd99('0x55')]({},_0xca6c27,_0x439573[_0xdd99('0x56')]);return _0x33a879[_0xdd99('0xe3')](_0xca6c27);}})[_0xdd99('0x20')](function(_0x2e8c66){if(_0x2e8c66){_0x32b81e=_0x2e8c66[_0xdd99('0x6d')];if(!_0x439573[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0xca6c27[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x439573[_0xdd99('0x45')][_0xdd99('0x1c')]);_0xca6c27[_0xdd99('0x1b')]=qs['offset'](_0x439573[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0x33a879[_0xdd99('0xe3')](_0xca6c27);}})[_0xdd99('0x20')](function(_0x30caf1){if(_0x30caf1){return _0x30caf1?{'count':_0x32b81e,'rows':_0x30caf1}:null;}})[_0xdd99('0x20')](respondWithResult(_0x5103c3,null))[_0xdd99('0x28')](handleError(_0x5103c3,null));};exports['getMailInteractions']=function(_0x22283f,_0xfb2b08){var _0x372270={'raw':!![],'where':{}};var _0x1ffa7a={};var _0x59a57a={'count':0x0,'rows':[]};return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x22283f[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0xfb2b08,null))[_0xdd99('0x20')](function(_0x55cbd3){if(_0x55cbd3){_0x1ffa7a['model']=_[_0xdd99('0xcf')](db['MailInteraction'][_0xdd99('0x3d')]);_0x1ffa7a[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x22283f[_0xdd99('0x45')]);_0x1ffa7a[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x1ffa7a['model'],_0x1ffa7a[_0xdd99('0x45')]);_0x372270[_0xdd99('0x57')]=_['intersection'](_0x1ffa7a[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x22283f['query'][_0xdd99('0xd2')]));_0x372270[_0xdd99('0x57')]=_0x372270['attributes'][_0xdd99('0x6d')]?_0x372270[_0xdd99('0x57')]:_0x1ffa7a[_0xdd99('0xce')];if(!_0x22283f[_0xdd99('0x45')]['hasOwnProperty'](_0xdd99('0xd6'))){_0x372270['limit']=qs[_0xdd99('0x1c')](_0x22283f[_0xdd99('0x45')]['limit']);_0x372270[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x22283f[_0xdd99('0x45')][_0xdd99('0x1b')]);}_0x372270[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x22283f[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x372270[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x22283f[_0xdd99('0x45')],_0x1ffa7a[_0xdd99('0xd8')]));_0x372270['where'][_0xdd99('0xdd')]=_0x55cbd3['id'];if(_0x22283f['query'][_0xdd99('0x33')]){_0x372270['where']=_[_0xdd99('0x55')](_0x372270[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x372270[_0xdd99('0x57')],function(_0x3ca864){var _0x5ee187={};_0x5ee187[_0x3ca864]={'$like':'%'+_0x22283f[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x5ee187;})});}_0x372270=_['merge']({},_0x372270,_0x22283f[_0xdd99('0x56')]);return db[_0xdd99('0xe5')][_0xdd99('0x1a')]({'where':_0x372270[_0xdd99('0x44')]})[_0xdd99('0x20')](function(_0xf8db98){_0x59a57a['count']=_0xf8db98;if(_0x22283f[_0xdd99('0x45')][_0xdd99('0x46')]){_0x372270[_0xdd99('0x49')]=[{'all':!![]}];}return db[_0xdd99('0xe5')][_0xdd99('0x4c')](_0x372270);})[_0xdd99('0x20')](function(_0x26dde5){_0x59a57a['rows']=_0x26dde5;return _0x59a57a;});}})[_0xdd99('0x20')](respondWithFilteredResult(_0xfb2b08,_0x372270))['catch'](handleError(_0xfb2b08,null));};exports[_0xdd99('0xe6')]=function(_0x26a81e,_0x4ddeb4){var _0xaea53f={};var _0x36dca6={};var _0x2ddfb8;var _0x1dc7ee;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x26a81e['params']['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x4ddeb4,null))['then'](function(_0xba6527){if(_0xba6527){_0x2ddfb8=_0xba6527;_0x36dca6['model']=_['keys'](db[_0xdd99('0xe7')]['rawAttributes']);_0x36dca6[_0xdd99('0x45')]=_['keys'](_0x26a81e[_0xdd99('0x45')]);_0x36dca6['filters']=_['intersection'](_0x36dca6['model'],_0x36dca6[_0xdd99('0x45')]);_0xaea53f['attributes']=_[_0xdd99('0xd1')](_0x36dca6[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x26a81e[_0xdd99('0x45')]['fields']));_0xaea53f[_0xdd99('0x57')]=_0xaea53f['attributes'][_0xdd99('0x6d')]?_0xaea53f[_0xdd99('0x57')]:_0x36dca6[_0xdd99('0xce')];_0xaea53f[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x26a81e[_0xdd99('0x45')]['sort']);_0xaea53f[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x26a81e['query'],_0x36dca6['filters']));if(_0x26a81e[_0xdd99('0x45')][_0xdd99('0x33')]){_0xaea53f[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0xaea53f[_0xdd99('0x44')],{'$or':_['map'](_0xaea53f['attributes'],function(_0x3a084c){var _0x5489d0={};_0x5489d0[_0x3a084c]={'$like':'%'+_0x26a81e[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x5489d0;})});}_0xaea53f=_['merge']({},_0xaea53f,_0x26a81e[_0xdd99('0x56')]);return _0x2ddfb8[_0xdd99('0xe6')](_0xaea53f);}})['then'](function(_0xb76cd6){if(_0xb76cd6){_0x1dc7ee=_0xb76cd6['length'];if(!_0x26a81e[_0xdd99('0x45')]['hasOwnProperty'](_0xdd99('0xd6'))){_0xaea53f['limit']=qs[_0xdd99('0x1c')](_0x26a81e['query'][_0xdd99('0x1c')]);_0xaea53f['offset']=qs[_0xdd99('0x1b')](_0x26a81e['query'][_0xdd99('0x1b')]);}return _0x2ddfb8['getSmsInteractions'](_0xaea53f);}})['then'](function(_0x451e3){if(_0x451e3){return _0x451e3?{'count':_0x1dc7ee,'rows':_0x451e3}:null;}})['then'](respondWithResult(_0x4ddeb4,null))[_0xdd99('0x28')](handleError(_0x4ddeb4,null));};exports[_0xdd99('0xe8')]=function(_0xdf4222,_0x356cbc){var _0xd271c1={};var _0x3d263f={};var _0x41bd2a;var _0x53642e;return db['User'][_0xdd99('0x95')]({'where':{'id':_0xdf4222[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x356cbc,null))['then'](function(_0x494ebf){if(_0x494ebf){_0x41bd2a=_0x494ebf;_0x3d263f['model']=_[_0xdd99('0xcf')](db['FaxInteraction'][_0xdd99('0x3d')]);_0x3d263f[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0xdf4222['query']);_0x3d263f[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x3d263f[_0xdd99('0xce')],_0x3d263f['query']);_0xd271c1[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x3d263f['model'],qs[_0xdd99('0xd2')](_0xdf4222[_0xdd99('0x45')][_0xdd99('0xd2')]));_0xd271c1[_0xdd99('0x57')]=_0xd271c1[_0xdd99('0x57')][_0xdd99('0x6d')]?_0xd271c1[_0xdd99('0x57')]:_0x3d263f[_0xdd99('0xce')];_0xd271c1[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0xdf4222[_0xdd99('0x45')][_0xdd99('0xd3')]);_0xd271c1[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0xdf4222[_0xdd99('0x45')],_0x3d263f[_0xdd99('0xd8')]));if(_0xdf4222[_0xdd99('0x45')]['filter']){_0xd271c1['where']=_[_0xdd99('0x55')](_0xd271c1[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0xd271c1[_0xdd99('0x57')],function(_0x406d1a){var _0x57b7b1={};_0x57b7b1[_0x406d1a]={'$like':'%'+_0xdf4222[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x57b7b1;})});}_0xd271c1=_[_0xdd99('0x55')]({},_0xd271c1,_0xdf4222[_0xdd99('0x56')]);return _0x41bd2a['getFaxInteractions'](_0xd271c1);}})[_0xdd99('0x20')](function(_0x9b53f5){if(_0x9b53f5){_0x53642e=_0x9b53f5[_0xdd99('0x6d')];if(!_0xdf4222['query'][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0xd271c1[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0xdf4222[_0xdd99('0x45')][_0xdd99('0x1c')]);_0xd271c1[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0xdf4222[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0x41bd2a['getFaxInteractions'](_0xd271c1);}})[_0xdd99('0x20')](function(_0x2b5ead){if(_0x2b5ead){return _0x2b5ead?{'count':_0x53642e,'rows':_0x2b5ead}:null;}})[_0xdd99('0x20')](respondWithResult(_0x356cbc,null))['catch'](handleError(_0x356cbc,null));};exports[_0xdd99('0xe9')]=function(_0x4f0a96,_0x30c4ed){var _0x2fe2a6={};var _0x28179c={};var _0x2e63f8;var _0x424725;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x4f0a96[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x30c4ed,null))[_0xdd99('0x20')](function(_0x20291f){if(_0x20291f){_0x2e63f8=_0x20291f;_0x28179c['model']=_['keys'](db[_0xdd99('0xea')][_0xdd99('0x3d')]);_0x28179c[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x4f0a96[_0xdd99('0x45')]);_0x28179c[_0xdd99('0xd8')]=_['intersection'](_0x28179c[_0xdd99('0xce')],_0x28179c[_0xdd99('0x45')]);_0x2fe2a6['attributes']=_[_0xdd99('0xd1')](_0x28179c[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x4f0a96[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x2fe2a6['attributes']=_0x2fe2a6[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x2fe2a6[_0xdd99('0x57')]:_0x28179c[_0xdd99('0xce')];_0x2fe2a6[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x4f0a96[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x2fe2a6['where']=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x4f0a96[_0xdd99('0x45')],_0x28179c[_0xdd99('0xd8')]));if(_0x4f0a96[_0xdd99('0x45')]['filter']){_0x2fe2a6['where']=_[_0xdd99('0x55')](_0x2fe2a6[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x2fe2a6['attributes'],function(_0x4330c5){var _0x2ff2c6={};_0x2ff2c6[_0x4330c5]={'$like':'%'+_0x4f0a96[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x2ff2c6;})});}_0x2fe2a6=_[_0xdd99('0x55')]({},_0x2fe2a6,_0x4f0a96['options']);return _0x2e63f8['getWhatsappInteractions'](_0x2fe2a6);}})['then'](function(_0x409125){if(_0x409125){_0x424725=_0x409125['length'];if(!_0x4f0a96[_0xdd99('0x45')]['hasOwnProperty'](_0xdd99('0xd6'))){_0x2fe2a6['limit']=qs[_0xdd99('0x1c')](_0x4f0a96[_0xdd99('0x45')][_0xdd99('0x1c')]);_0x2fe2a6['offset']=qs['offset'](_0x4f0a96[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0x2e63f8[_0xdd99('0xe9')](_0x2fe2a6);}})[_0xdd99('0x20')](function(_0x28e3fe){if(_0x28e3fe){return _0x28e3fe?{'count':_0x424725,'rows':_0x28e3fe}:null;}})[_0xdd99('0x20')](respondWithResult(_0x30c4ed,null))['catch'](handleError(_0x30c4ed,null));};exports[_0xdd99('0xeb')]=function(_0x2f8ccd,_0x100b2f,_0x42ed10){var _0x1d3d4d;var _0x556885;var _0x4d80e3;var _0x5f4f73=!_[_0xdd99('0x67')](_0x2f8ccd[_0xdd99('0x54')]['id'])?_0x2f8ccd[_0xdd99('0x54')]['id']:!_['isNil'](_0x2f8ccd[_0xdd99('0x2f')]['id'])?_0x2f8ccd[_0xdd99('0x2f')]['id']:null;return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x5f4f73,'role':{'$or':[_0xdd99('0x81'),_0xdd99('0x2f'),'agent']}},'attributes':['id',_0xdd99('0x37'),'phone','mobile','role','internal',_0xdd99('0x9d')]})[_0xdd99('0x20')](function(_0x4538d3){if(_0x4538d3){if(_0x4538d3[_0xdd99('0x2a')]===_0xdd99('0x2b')){_0x1d3d4d=_0x4538d3;if(_0x2f8ccd[_0xdd99('0x5c')]['interface']){_0x4d80e3=util['format'](_0xdd99('0xec'),_0x1d3d4d[_0x2f8ccd['body'][_0xdd99('0x9f')]]);}else if(_0x2f8ccd['body'][_0xdd99('0xed')]){_0x4d80e3=util[_0xdd99('0xac')](_0xdd99('0xad'),_0x2f8ccd['body'][_0xdd99('0xed')]);}else{_0x4d80e3=util[_0xdd99('0xac')](_0xdd99('0xad'),_0x1d3d4d[_0xdd99('0x37')]);}socket['to'](util['format']('user:%s',_0x1d3d4d[_0xdd99('0x37')]))[_0xdd99('0x2c')](_0xdd99('0xee'),{'user':{'id':_0x1d3d4d['id'],'name':_0x1d3d4d['name']},'ip':_0x2f8ccd[_0xdd99('0xef')][_0xdd99('0xf0')]||_0x2f8ccd[_0xdd99('0xf1')][_0xdd99('0xf2')]||_0x2f8ccd[_0xdd99('0xf3')][_0xdd99('0xf2')]||_0x2f8ccd[_0xdd99('0xf1')][_0xdd99('0xf3')][_0xdd99('0xf2')]});return new Promise(function(_0x438ea8,_0x518942){db[_0xdd99('0x69')][_0xdd99('0xf4')]()[_0xdd99('0x20')](_0x4be7a1=>{db[_0xdd99('0xae')][_0xdd99('0x39')]({'where':{'membername':_0x1d3d4d[_0xdd99('0x37')]},'individualHooks':!![]},{'transaction':_0x4be7a1})[_0xdd99('0x20')](function(){return _0x4be7a1['commit']();})[_0xdd99('0x20')](_0x438ea8)['catch'](_0x518942);});});}}else{throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0xf5'));}})['then'](function(){if(_0x1d3d4d){return _0x1d3d4d[_0xdd99('0xf6')]({'raw':!![]});}})[_0xdd99('0x20')](function(_0x55c69d){if(_0x1d3d4d){if(_0x55c69d){_0x556885=_0x55c69d;if(_0x556885[_0xdd99('0x6d')]){var _0x5f0588=_0x556885[_0xdd99('0x34')](function(_0x33a394){return{'membername':_0x1d3d4d[_0xdd99('0x37')],'UserId':_0x1d3d4d['id'],'queue_name':_0x33a394[_0xdd99('0x37')],'VoiceQueueId':_0x33a394['id'],'interface':_0x4d80e3,'paused':_0x1d3d4d[_0xdd99('0x9d')]||![],'penalty':_0x33a394[_0xdd99('0xf7')]||0x0};});return db[_0xdd99('0xae')]['bulkCreate'](_0x5f0588);}}}})[_0xdd99('0x20')](function(){if(_0x1d3d4d){return db[_0xdd99('0xf8')][_0xdd99('0x4c')]({'where':{'membername':_0x1d3d4d['name'],'exitAt':null}});}})['then'](function(_0x44e611){if(_0x1d3d4d){var _0x1d3812=[];_0x44e611[_0xdd99('0xf9')](function(_0x572512){_0x1d3812[_0xdd99('0x4b')](_0x572512[_0xdd99('0x29')]({'exitAt':moment()[_0xdd99('0xac')](_0xdd99('0xfa'))}));});return Promise['all'](_0x1d3812);}})[_0xdd99('0x20')](function(){if(_0x1d3d4d){var _0x4101f6=[];var _0x3c59ac=[];var _0x4e4961=utils[_0xdd99('0xfb')]();var _0x45073a={'membername':_0x1d3d4d[_0xdd99('0x37')],'interface':_0x4d80e3,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1d3d4d[_0xdd99('0x2a')],'internal':_0x1d3d4d[_0xdd99('0x61')]};_0x4e4961['forEach'](function(_0x143ed5){_0x4101f6['push'](_[_0xdd99('0x55')]({'channel':_0x143ed5,'type':_0xdd99('0xfc'),'data1':_0x2f8ccd[_0xdd99('0x5c')]['device'],'data2':_0x4d80e3},_0x45073a));if(_0x1d3d4d['loginInPause']){_0x3c59ac[_0xdd99('0x4b')](_[_0xdd99('0x55')]({'channel':_0x143ed5,'type':_0xdd99('0xfd'),'data1':_0xdd99('0xfe')},_0x45073a));}});return db['MemberReport'][_0xdd99('0x89')](_0x4101f6[_0xdd99('0xff')](_0x3c59ac),{'individualHooks':!![]});}})[_0xdd99('0x20')](function(){if(_0x1d3d4d){return _0x1d3d4d['update']({'online':!![],'lastLoginAt':moment()[_0xdd99('0xac')](_0xdd99('0xfa')),'voicePause':_0x1d3d4d[_0xdd99('0x9d')]||![],'mailPause':_0x1d3d4d[_0xdd99('0x9d')]||![],'chatPause':_0x1d3d4d[_0xdd99('0x9d')]||![],'faxPause':_0x1d3d4d['loginInPause']||![],'smsPause':_0x1d3d4d['loginInPause']||![],'openchannelPause':_0x1d3d4d[_0xdd99('0x9d')]||![],'whatsappPause':_0x1d3d4d['loginInPause']||![],'pauseType':_0x1d3d4d[_0xdd99('0x9d')]?_0xdd99('0xfe'):null,'interface':_0x4d80e3,'lastPauseAt':moment()[_0xdd99('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x33f2bf){if(_0x2f8ccd[_0xdd99('0x100')]){return _0x42ed10();}else{return Promise['resolve'](_0x33f2bf)[_0xdd99('0x20')](respondWithResult(_0x100b2f,null));}})['catch'](handleError(_0x100b2f,null));};exports['logout']=function(_0x5ed27b,_0x135512){var _0x4435b5;return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x5ed27b[_0xdd99('0x54')]['id'],'role':_0xdd99('0x2b')},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a')]})[_0xdd99('0x20')](handleEntityNotFound(_0x135512,null))['then'](function(_0x4cbcc5){if(_0x4cbcc5){_0x4435b5=_0x4cbcc5;return db[_0xdd99('0xae')][_0xdd99('0x39')]({'where':{'membername':_0x4435b5[_0xdd99('0x37')]},'individualHooks':!![]});}})[_0xdd99('0x20')](function(){return db[_0xdd99('0xf8')]['findAll']({'where':{'membername':_0x4435b5['name'],'exitAt':null}});})[_0xdd99('0x20')](function(_0x53aa47){var _0x446a25=[];_0x53aa47['forEach'](function(_0x10a409){_0x446a25[_0xdd99('0x4b')](_0x10a409[_0xdd99('0x29')]({'exitAt':moment()['format'](_0xdd99('0xfa'))}));});return Promise[_0xdd99('0x5b')](_0x446a25);})[_0xdd99('0x20')](function(){return _0x4435b5[_0xdd99('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xdd99('0x20')](respondWithResult(_0x135512,null))['catch'](handleError(_0x135512,null));};exports[_0xdd99('0x101')]=function(_0x618da6,_0x472b94){var _0x246879;return db[_0xdd99('0xae')]['update']({'paused':0x1},{'where':{'UserId':_0x618da6[_0xdd99('0x54')]['id']},'individualHooks':!![]})[_0xdd99('0x20')](function(){return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x618da6['params']['id'],'role':'agent'},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a'),_0xdd99('0x61'),_0xdd99('0x9f'),_0xdd99('0x9c')]});})[_0xdd99('0x20')](handleEntityNotFound(_0x472b94,null))['then'](function(_0x250eff){if(_0x250eff){_0x246879=_0x250eff;return respondWithRpcPromise(_0xdd99('0x102'),'pause',{'id':_0x246879['id'],'name':_0x246879[_0xdd99('0x37')],'pause':!![]});}})['then'](function(){if(_0x246879){return db[_0xdd99('0xf8')][_0xdd99('0x4c')]({'where':{'membername':_0x246879[_0xdd99('0x37')],'type':'PAUSE','exitAt':null}});}})[_0xdd99('0x20')](function(_0xc200cd){if(_0xc200cd[_0xdd99('0x6d')]){var _0xc40720=moment()['format'](_0xdd99('0xfa'));for(var _0x4c09ce=0x0,_0x19eea0=_0xc200cd[_0xdd99('0x6d')];_0x4c09ce<_0x19eea0;_0x4c09ce++){_0xc200cd[_0x4c09ce][_0xdd99('0x103')]({'exitAt':_0xc40720});}}})[_0xdd99('0x20')](function(){var _0x3dc6a3=[];var _0x46220c=utils[_0xdd99('0xfb')]();_0x46220c['forEach'](function(_0xf6580e){_0x3dc6a3['push']({'channel':_0xf6580e,'membername':_0x246879[_0xdd99('0x37')],'interface':_[_0xdd99('0x67')](_0x246879[_0xdd99('0x9f')])?util['format']('SIP/%s',_0x246879[_0xdd99('0x37')]):_0x246879[_0xdd99('0x9f')],'type':_0xdd99('0xfd'),'enterAt':moment()['format'](_0xdd99('0xfa')),'data1':_0x618da6[_0xdd99('0x5c')][_0xdd99('0x104')]||'DEFAULT\x20PAUSE','role':_0x246879['role'],'internal':_0x246879[_0xdd99('0x61')]});});return db['MemberReport']['bulkCreate'](_0x3dc6a3,{'individualHooks':!![]});})[_0xdd99('0x20')](function(){return _0x246879[_0xdd99('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x618da6['body']['type']||_0xdd99('0x105'),'lastPauseAt':moment()[_0xdd99('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x472b94,null))['catch'](handleError(_0x472b94,null));};exports[_0xdd99('0x106')]=function(_0x4da794,_0x34e5fb){if(_0x4da794[_0xdd99('0x5c')][_0xdd99('0x9b')]&&!utils[_0xdd99('0xa0')](_0x4da794[_0xdd99('0x5c')][_0xdd99('0x9b')])){throw new APIBadRequestError(util[_0xdd99('0xac')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4da794[_0xdd99('0x5c')]['channel']));}return db[_0xdd99('0x3c')][_0xdd99('0x58')]({'where':{'id':_0x4da794['params']['id']},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a'),_0xdd99('0x61'),'interface',_0xdd99('0x9c'),_0xdd99('0x9e'),_0xdd99('0x107'),_0xdd99('0x108'),'faxPause',_0xdd99('0x109'),_0xdd99('0x10a'),_0xdd99('0x10b'),_0xdd99('0x10c'),_0xdd99('0x10d')]})['then'](function(_0x1aab34){if(!_0x1aab34){throw new APINotFoundError(util['format'](_0xdd99('0x10e'),_0x4da794[_0xdd99('0x54')]['id']));}return _0x1aab34[_0xdd99('0x106')](_0x4da794['body'][_0xdd99('0x9b')]);})[_0xdd99('0x20')](respondWithResult(_0x34e5fb,null))[_0xdd99('0x28')](APIHandleError(_0x34e5fb));};exports[_0xdd99('0x10f')]=function(_0x1bf0d6,_0x4e1cbe){var _0xa2648a={};var _0x3a14c8={};var _0x41edff;var _0x26f538;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x1bf0d6[_0xdd99('0x54')]['id']}})['then'](handleEntityNotFound(_0x4e1cbe,null))[_0xdd99('0x20')](function(_0x1ee11f){if(_0x1ee11f){_0x41edff=_0x1ee11f;_0x3a14c8['model']=_['keys'](db[_0xdd99('0x110')][_0xdd99('0x3d')]);_0x3a14c8['query']=_['keys'](_0x1bf0d6[_0xdd99('0x45')]);_0x3a14c8[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x3a14c8[_0xdd99('0xce')],_0x3a14c8[_0xdd99('0x45')]);_0xa2648a[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x3a14c8[_0xdd99('0xce')],qs['fields'](_0x1bf0d6[_0xdd99('0x45')]['fields']));_0xa2648a[_0xdd99('0x57')]=_0xa2648a[_0xdd99('0x57')][_0xdd99('0x6d')]?_0xa2648a[_0xdd99('0x57')]:_0x3a14c8[_0xdd99('0xce')];_0xa2648a[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x1bf0d6[_0xdd99('0x45')]['sort']);_0xa2648a[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_['pick'](_0x1bf0d6[_0xdd99('0x45')],_0x3a14c8['filters']));if(_0x1bf0d6['query'][_0xdd99('0x33')]){_0xa2648a[_0xdd99('0x44')]=_['merge'](_0xa2648a[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0xa2648a['attributes'],function(_0x4d7a61){var _0x4c41e3={};_0x4c41e3[_0x4d7a61]={'$like':'%'+_0x1bf0d6[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x4c41e3;})});}_0xa2648a=_[_0xdd99('0x55')]({},_0xa2648a,_0x1bf0d6[_0xdd99('0x56')]);return _0x41edff[_0xdd99('0x10f')](_0xa2648a);}})[_0xdd99('0x20')](function(_0xce52bf){if(_0xce52bf){_0x26f538=_0xce52bf[_0xdd99('0x6d')];if(!_0x1bf0d6[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0xa2648a[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x1bf0d6[_0xdd99('0x45')][_0xdd99('0x1c')]);_0xa2648a[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x1bf0d6[_0xdd99('0x45')]['offset']);}return _0x41edff[_0xdd99('0x10f')](_0xa2648a);}})['then'](function(_0x493cc2){if(_0x493cc2){return _0x493cc2?{'count':_0x26f538,'rows':_0x493cc2}:null;}})['then'](respondWithResult(_0x4e1cbe,null))[_0xdd99('0x28')](handleError(_0x4e1cbe,null));};exports[_0xdd99('0x111')]=function(_0x8a145f,_0x3b014f){var _0x2b1b20=_0x8a145f['params']['id'];var _0x28de4f=_0x8a145f[_0xdd99('0x5c')]?_0x8a145f['body'][_0xdd99('0x5f')]:null;var _0x2bbceb=[];return Promise[_0xdd99('0x112')]()[_0xdd99('0x20')](function(){if(!_0x28de4f)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xdd99('0x20')](function(){return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x2b1b20}});})[_0xdd99('0x20')](function(_0x13e1b0){if(!_0x13e1b0)throw new APINotFoundError(util[_0xdd99('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x8a145f[_0xdd99('0x54')]['id']));return db[_0xdd99('0x69')]['transaction'](function(_0x5cff04){return _0x13e1b0['addTeams'](_0x28de4f,{'transaction':_0x5cff04})[_0xdd99('0x20')](function(){return db[_0xdd99('0x110')]['findAll']({'where':{'id':{'$in':_0x28de4f}}});})[_0xdd99('0x20')](function(_0x569214){var _0x4220d2=_[_0xdd99('0x34')](_0x569214,function(_0x342686){return _0x342686['getAssociatedQueues']();});return Promise['all'](_0x4220d2);})['then'](function(_0x10b6c1){_0x2bbceb=_[_0xdd99('0x113')](_0x10b6c1);var _0x1c6ced=_[_0xdd99('0x34')](_0x2bbceb,function(_0x455df2){return _0x455df2[_0xdd99('0x114')](_0x13e1b0['id'],{'transaction':_0x5cff04});});return Promise[_0xdd99('0x5b')](_0x1c6ced);})[_0xdd99('0x20')](function(){if(!_0x13e1b0[_0xdd99('0x9c')])return;var _0xf7839a=_[_0xdd99('0x33')](_0x2bbceb,function(_0x3a8515){return _0x3a8515[_0xdd99('0x115')](_0xdd99('0x9b'))===_0xdd99('0x116');});var _0x24ef18=_[_0xdd99('0x34')](_0xf7839a,function(_0x4c2041){return db[_0xdd99('0xae')][_0xdd99('0x117')]({'membername':_0x13e1b0[_0xdd99('0x37')],'UserId':_0x13e1b0['id'],'queue_name':_0x4c2041[_0xdd99('0x37')],'VoiceQueueId':_0x4c2041['id'],'interface':_[_0xdd99('0x67')](_0x13e1b0[_0xdd99('0x9f')])?util[_0xdd99('0xac')](_0xdd99('0xad'),_0x13e1b0[_0xdd99('0x37')]):_0x13e1b0[_0xdd99('0x9f')],'paused':_0x13e1b0[_0xdd99('0x9e')]||![],'penalty':_0x13e1b0[_0xdd99('0xa5')]},{'transaction':_0x5cff04});});return Promise['all'](_0x24ef18);})['then'](function(){return db[_0xdd99('0x118')][_0xdd99('0x4c')]({'where':{'teamId':{'$in':_0x28de4f}}});})[_0xdd99('0x20')](function(_0x45ac39){var _0x6c2ac2=_[_0xdd99('0x34')](_0x45ac39,function(_0xbfb7fd){return db[_0xdd99('0x119')][_0xdd99('0x7f')]({'UserId':_0x13e1b0['id'],'VoicePrefixId':_0xbfb7fd[_0xdd99('0x11a')]},{'transaction':_0x5cff04});});return Promise[_0xdd99('0x5b')](_0x6c2ac2);});});})[_0xdd99('0x20')](function(){for(var _0x385782=0x0;_0x385782<_0x2bbceb[_0xdd99('0x6d')];_0x385782++){var _0x96a1f9=_0x2bbceb[_0x385782][_0xdd99('0x115')]('channel');var _0x4c2099=_0x96a1f9+'QueueId';socket[_0xdd99('0x2c')]('user'+_0x96a1f9+_0xdd99('0xa8'),{'UserId':_0x2b1b20,['queueField']:_0x2bbceb[_0x385782]['id']});}})['then'](respondWithStatusCode(_0x3b014f,null))[_0xdd99('0x28')](APIHandleError(_0x3b014f));};exports['removeTeams']=function(_0x5214c5,_0x12fcd0){var _0x46159a=_0x5214c5[_0xdd99('0x54')]['id'];var _0x54b859=null;if(_0x5214c5[_0xdd99('0x45')][_0xdd99('0x5f')]){_0x54b859=_[_0xdd99('0x11b')](_0x5214c5['query'][_0xdd99('0x5f')])?_0x5214c5[_0xdd99('0x45')][_0xdd99('0x5f')]:[_0x5214c5[_0xdd99('0x45')][_0xdd99('0x5f')]];}var _0x1d8688=[];return Promise[_0xdd99('0x112')]()['then'](function(){if(!_0x54b859)throw new APIBadRequestError(_0xdd99('0x11c'));})['then'](function(){return db['User'][_0xdd99('0x95')]({'where':{'id':_0x46159a}});})[_0xdd99('0x20')](function(_0x5cd373){if(!_0x5cd373)throw new APINotFoundError(util[_0xdd99('0xac')](_0xdd99('0x10e'),_0x5214c5[_0xdd99('0x54')]['id']));return db[_0xdd99('0x69')][_0xdd99('0xf4')](function(_0x1a2c95){return _0x5cd373['removeTeams'](_0x54b859,{'transaction':_0x1a2c95})['then'](function(){return db[_0xdd99('0x110')]['findAll']({'where':{'id':{'$in':_0x54b859}}});})[_0xdd99('0x20')](function(_0x394476){var _0x28ab06=_[_0xdd99('0x34')](_0x394476,function(_0x30f177){return _0x30f177[_0xdd99('0x11d')]();});return Promise[_0xdd99('0x5b')](_0x28ab06);})[_0xdd99('0x20')](function(_0x1368f7){_0x1d8688=_[_0xdd99('0x113')](_0x1368f7);var _0x39cfbd=_[_0xdd99('0x34')](_0x1d8688,function(_0x19ef93){return _0x19ef93[_0xdd99('0x11e')](_0x5cd373['id'],{'transaction':_0x1a2c95});});return Promise['all'](_0x39cfbd);})[_0xdd99('0x20')](function(){if(!_0x5cd373['online'])return;var _0x5f1c58=_[_0xdd99('0x33')](_0x1d8688,function(_0x40e1ad){return _0x40e1ad[_0xdd99('0x115')](_0xdd99('0x9b'))===_0xdd99('0x116');});var _0x235912=_['map'](_0x5f1c58,function(_0x32f804){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x32f804['id'],'UserId':_0x5cd373['id']},'transaction':_0x1a2c95});});return Promise[_0xdd99('0x5b')](_0x235912);})[_0xdd99('0x20')](function(){return db[_0xdd99('0x118')][_0xdd99('0x4c')]({'where':{'teamId':{'$in':_0x54b859}}});})[_0xdd99('0x20')](function(_0x5f0298){var _0x2a0a03=_[_0xdd99('0x34')](_0x5f0298,function(_0xa4fe68){return db[_0xdd99('0x119')][_0xdd99('0x39')]({'where':{'UserId':_0x5cd373['id'],'VoicePrefixId':_0xa4fe68['VoicePrefixId']}},{'transaction':_0x1a2c95});});return Promise[_0xdd99('0x5b')](_0x2a0a03);});});})[_0xdd99('0x20')](function(){for(var _0x438ab5=0x0;_0x438ab5<_0x1d8688['length'];_0x438ab5++){var _0x64f5a=_0x1d8688[_0x438ab5]['getDataValue'](_0xdd99('0x9b'));var _0x5224c3=_0x64f5a+'QueueId';socket['emit'](_0xdd99('0x2f')+_0x64f5a+_0xdd99('0xb1'),{'UserId':_0x46159a,['queueField']:_0x1d8688[_0x438ab5]['id']});}})[_0xdd99('0x20')](respondWithStatusCode(_0x12fcd0,null))['catch'](APIHandleError(_0x12fcd0));};exports[_0xdd99('0x11f')]=function(_0x47d6f2,_0x5388ca){var _0x2dbd6d={};var _0x566a01={};var _0xdb9b4e;var _0x28d447;return db[_0xdd99('0x3c')]['findOne']({'where':{'id':_0x47d6f2[_0xdd99('0x54')]['id']}})['then'](handleEntityNotFound(_0x5388ca,null))[_0xdd99('0x20')](function(_0x3679c1){if(_0x3679c1){_0xdb9b4e=_0x3679c1;_0x566a01[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db[_0xdd99('0xc7')][_0xdd99('0x3d')]);_0x566a01[_0xdd99('0x45')]=_['keys'](_0x47d6f2[_0xdd99('0x45')]);_0x566a01[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x566a01['model'],_0x566a01[_0xdd99('0x45')]);_0x2dbd6d[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x566a01[_0xdd99('0xce')],qs['fields'](_0x47d6f2[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x2dbd6d[_0xdd99('0x57')]=_0x2dbd6d[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x2dbd6d[_0xdd99('0x57')]:_0x566a01[_0xdd99('0xce')];_0x2dbd6d[_0xdd99('0xd9')]=qs['sort'](_0x47d6f2[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x2dbd6d[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x47d6f2[_0xdd99('0x45')],_0x566a01[_0xdd99('0xd8')]));if(_0x47d6f2['query']['filter']){_0x2dbd6d[_0xdd99('0x44')]=_['merge'](_0x2dbd6d[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x2dbd6d[_0xdd99('0x57')],function(_0x1edd02){var _0x75e94a={};_0x75e94a[_0x1edd02]={'$like':'%'+_0x47d6f2[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x75e94a;})});}_0x2dbd6d=_[_0xdd99('0x55')]({},_0x2dbd6d,_0x47d6f2[_0xdd99('0x56')]);return _0xdb9b4e[_0xdd99('0x11f')](_0x2dbd6d);}})[_0xdd99('0x20')](function(_0x5664ce){if(_0x5664ce){_0x28d447=_0x5664ce[_0xdd99('0x6d')];if(!_0x47d6f2[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0x2dbd6d[_0xdd99('0x1c')]=qs['limit'](_0x47d6f2[_0xdd99('0x45')][_0xdd99('0x1c')]);_0x2dbd6d[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x47d6f2[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0xdb9b4e[_0xdd99('0x11f')](_0x2dbd6d);}})[_0xdd99('0x20')](function(_0x482240){if(_0x482240){return _0x482240?{'count':_0x28d447,'rows':_0x482240}:null;}})[_0xdd99('0x20')](respondWithResult(_0x5388ca,null))['catch'](handleError(_0x5388ca,null));};exports[_0xdd99('0x120')]=function(_0x16600a,_0x1b4d20){var _0x2331fc={};var _0x1b92c6={};var _0x5819d2;return db['User']['findOne']({'where':{'id':_0x16600a[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x1b4d20,null))['then'](function(_0x13a69a){if(_0x13a69a){_0x5819d2=_0x13a69a;_0x1b92c6[_0xdd99('0xce')]=_['keys'](db[_0xdd99('0x3c')][_0xdd99('0x3d')]);_0x1b92c6[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x16600a[_0xdd99('0x45')]);_0x1b92c6['filters']=_[_0xdd99('0xd1')](_0x1b92c6[_0xdd99('0xce')],_0x1b92c6[_0xdd99('0x45')]);_0x2331fc[_0xdd99('0x57')]=_['intersection'](_0x1b92c6[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x16600a['query']['fields']));_0x2331fc[_0xdd99('0x57')]=_0x2331fc['attributes']['length']?_0x2331fc[_0xdd99('0x57')]:_0x1b92c6[_0xdd99('0xce')];_0x2331fc[_0xdd99('0xd9')]=qs['sort'](_0x16600a[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x2331fc[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x16600a[_0xdd99('0x45')],_0x1b92c6['filters']));if(_0x16600a['query'][_0xdd99('0x33')]){_0x2331fc[_0xdd99('0x44')]=_['merge'](_0x2331fc[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x2331fc[_0xdd99('0x57')],function(_0x167d01){var _0x502e72={};_0x502e72[_0x167d01]={'$like':'%'+_0x16600a['query'][_0xdd99('0x33')]+'%'};return _0x502e72;})});}_0x2331fc[_0xdd99('0xce')]=db['User'];_0x2331fc['as']=_0xdd99('0x30');_0x2331fc=_[_0xdd99('0x55')]({},_0x2331fc,_0x16600a[_0xdd99('0x56')]);return _0x5819d2[_0xdd99('0xf6')]({'include':[_0x2331fc]});}})[_0xdd99('0x20')](function(_0x353a37){if(_0x353a37){var _0x5412e8={},_0x282f04=[];for(var _0x32d1f0=0x0;_0x32d1f0<_0x353a37[_0xdd99('0x6d')];_0x32d1f0+=0x1){for(var _0x3789cf=0x0,_0xd45e72;_0x3789cf<_0x353a37[_0x32d1f0][_0xdd99('0x30')][_0xdd99('0x6d')];_0x3789cf+=0x1){_0xd45e72=_0x353a37[_0x32d1f0][_0xdd99('0x30')][_0x3789cf][_0xdd99('0xab')]({'plain':!![]});_0x5412e8[_0xd45e72['id']]=_0xd45e72;}}_0x5412e8=_['values'](_0x5412e8);for(var _0x58574f=qs[_0xdd99('0x1b')](_0x16600a['query'][_0xdd99('0x1b')]);_0x58574f<_0x5412e8[_0xdd99('0x6d')]&&_0x282f04['length']=_0x2ab7c8){_0x40ec73=_0x2ab7c8;_0x2bf688=0xc8;}else{_0x2bf688=0xce;}_0x2541d7['status'](_0x2bf688);return _0x2541d7['set'](_0x3426('0x1f'),_0x5955bd+'-'+_0x40ec73+'/'+_0x2ab7c8)[_0x3426('0x1a')](_0x53e922);}return null;};}function respondWithRpcPromise(_0xecfb38,_0x1e7f17,_0x29b3a5,_0x5d6119){return new Promise(function(_0x27441d,_0x5c45db){var _0x349f4f=_0x5d6119||amiClient;return _0x349f4f['request'](_0xecfb38,_0x29b3a5)['then'](function(_0xc8cb66){logger['info']('User,\x20%s,\x20%s',_0x1e7f17,_0x3426('0x20'));logger['debug'](_0x3426('0x21'),_0x1e7f17,_0x3426('0x20'),JSON[_0x3426('0x22')](_0xc8cb66));if(_0xc8cb66[_0x3426('0x23')]){if(_0xc8cb66[_0x3426('0x23')][_0x3426('0x24')]===0x1f4){logger['error'](_0x3426('0x25'),_0x1e7f17,_0xc8cb66[_0x3426('0x23')][_0x3426('0x26')]);return _0x5c45db(_0xc8cb66['error']['message']);}logger[_0x3426('0x23')]('User,\x20%s,\x20%s',_0x1e7f17,_0xc8cb66[_0x3426('0x23')][_0x3426('0x26')]);return _0x27441d(_0xc8cb66[_0x3426('0x23')][_0x3426('0x26')]);}else{logger['info']('User,\x20%s,\x20%s',_0x1e7f17,_0x3426('0x20'));_0x27441d(_0xc8cb66[_0x3426('0x27')]['message']);}})['catch'](function(_0x58bd3e){logger[_0x3426('0x23')](_0x3426('0x25'),_0x1e7f17,_0x58bd3e);_0x5c45db(_0x58bd3e);});});}function saveUpdates(_0x63507f){return function(_0x2bacba){if(_0x2bacba){return _0x2bacba[_0x3426('0x28')](_0x63507f)[_0x3426('0x29')](function(_0x5cfb33){if(_0x5cfb33[_0x3426('0x2a')]==='agent'){socket[_0x3426('0x2b')](_0x3426('0x2c')+_0x5cfb33['id'],_0x5cfb33);}return _0x5cfb33;});}return null;};}function removeEntity(_0x2458b6,_0x4bf5f3){return function(_0x194b48){if(_0x194b48){return _0x194b48['destroy']({'transaction':_0x4bf5f3})[_0x3426('0x29')](function(){var _0x44c127=_0x194b48[_0x3426('0x2d')]({'plain':!![]});if(_0x44c127[_0x3426('0x2a')]===_0x3426('0x2e'))return;var _0x32321a=[{'name':_0x3426('0x2f'),'value':_0x3426('0x30'),'ignore':!![]},{'name':'Agents','value':_0x3426('0x31'),'ignore':![]},{'name':_0x3426('0x32'),'value':_0x3426('0x33'),'ignore':![]}];var _0x262c6f=_(_0x32321a)[_0x3426('0x34')](_0x3426('0x35'))[_0x3426('0x36')]('value')[_0x3426('0x37')]();if(_['includes'](_0x262c6f,_0x44c127[_0x3426('0x2a')])){return;}var _0x4fa780=_[_0x3426('0x38')](_0x32321a,[_0x3426('0x37'),_0x44c127['role']])[_0x3426('0x39')];return db[_0x3426('0x3a')][_0x3426('0x3b')]({'where':{'type':_0x4fa780,'resourceId':_0x44c127['id']},'transaction':_0x4bf5f3})[_0x3426('0x29')](function(){return _0x194b48;});})[_0x3426('0x29')](function(){_0x2458b6[_0x3426('0x19')](0xcc)[_0x3426('0x3c')]();});}};}function handleEntityNotFound(_0x552ac9){return function(_0x582878){if(!_0x582878){_0x552ac9[_0x3426('0x3d')](0x194);}return _0x582878;};}function handleError(_0x481608,_0xeb538){_0xeb538=_0xeb538||0x1f4;return function(_0x497c55){logger[_0x3426('0x23')](_0x497c55['stack']);if(_0x497c55[_0x3426('0x39')]){delete _0x497c55[_0x3426('0x39')];}_0x481608[_0x3426('0x19')](_0xeb538)['send'](_0x497c55);};}function getUserAttributes(){return _(db[_0x3426('0x3e')][_0x3426('0x3f')])[_0x3426('0x36')](function(_0x268671){return{'name':_0x268671['fieldName'],'type':_0x268671[_0x3426('0x40')][_0x3426('0x41')]};})[_0x3426('0x34')](function(_0x30e719){return!['password',_0x3426('0x42'),_0x3426('0x43'),_0x3426('0x44'),'resetPasswordExpires',_0x3426('0x45')][_0x3426('0x46')](_0x30e719[_0x3426('0x39')]);})[_0x3426('0x37')]();}exports[_0x3426('0x47')]=function(_0x58136b,_0x1c3fd0){var _0x2368db={},_0x5b3cea={'count':0x0,'rows':[]};var _0x27a0a2=getUserAttributes();_0x2368db=qs[_0x3426('0x48')](_0x27a0a2,_0x58136b);var _0x17dabd={'where':_0x2368db[_0x3426('0x49')]};return db['User']['count'](_0x17dabd)[_0x3426('0x29')](function(_0x3df084){_0x5b3cea[_0x3426('0x1e')]=_0x3df084;if(_0x58136b[_0x3426('0x4a')][_0x3426('0x4b')]){_0x2368db[_0x3426('0x4c')]=[{'all':!![]}];}if(_0x58136b['query']['userSetting']==='true'){_0x2368db[_0x3426('0x4c')]=[{'model':db[_0x3426('0x4d')],'as':_0x3426('0x4e')}];}if(!_[_0x3426('0x46')](_0x2368db['attributes'],'id')){_0x2368db[_0x3426('0x4f')][_0x3426('0x50')]('id');}return db[_0x3426('0x3e')]['findAll'](_0x2368db);})[_0x3426('0x29')](function(_0x551c45){_0x5b3cea[_0x3426('0x51')]=_0x551c45;if(_0x58136b['query'][_0x3426('0x52')]===_0x3426('0x53')){var _0x9875fa=[];for(var _0x52df24=0x0;_0x52df24<_0x5b3cea[_0x3426('0x51')]['length'];_0x52df24++){_0x9875fa['push'](get_open_tabs(_0x3426('0x54'),_0x5b3cea[_0x3426('0x51')][_0x52df24][_0x3426('0x55')]));_0x9875fa['push'](get_open_tabs(_0x3426('0x56'),_0x5b3cea[_0x3426('0x51')][_0x52df24][_0x3426('0x55')]));_0x9875fa[_0x3426('0x50')](get_open_tabs(_0x3426('0x57'),_0x5b3cea[_0x3426('0x51')][_0x52df24][_0x3426('0x55')]));_0x9875fa[_0x3426('0x50')](get_open_tabs(_0x3426('0x58'),_0x5b3cea[_0x3426('0x51')][_0x52df24][_0x3426('0x55')]));_0x9875fa[_0x3426('0x50')](get_open_tabs(_0x3426('0x59'),_0x5b3cea['rows'][_0x52df24]['dataValues']));_0x9875fa[_0x3426('0x50')](get_open_tabs(_0x3426('0x5a'),_0x5b3cea[_0x3426('0x51')][_0x52df24][_0x3426('0x55')]));}return Promise[_0x3426('0x5b')](_0x9875fa)[_0x3426('0x29')](function(){return _0x5b3cea;});}else{return _0x5b3cea;}})[_0x3426('0x29')](respondWithFilteredResult(_0x1c3fd0,_0x2368db))[_0x3426('0x5c')](handleError(_0x1c3fd0,null));};exports['show']=function(_0x48b3ee,_0x16ebaf){var _0x587cee=getUserAttributes();_0x48b3ee[_0x3426('0x4a')]['id']=_0x48b3ee['params']['id'];var _0x22b8d1=qs['getOptions'](_0x587cee,_0x48b3ee);if(_0x48b3ee[_0x3426('0x4a')][_0x3426('0x4b')]){_0x22b8d1['include']=[{'all':!![]}];}if(_0x48b3ee[_0x3426('0x4a')]['userSetting']===_0x3426('0x53')){_0x22b8d1[_0x3426('0x4c')]=[{'model':db['UserSetting'],'as':_0x3426('0x4e')}];}_0x22b8d1=_[_0x3426('0x5d')]({},_0x22b8d1,_0x48b3ee[_0x3426('0x5e')]);if(!_[_0x3426('0x46')](_0x22b8d1[_0x3426('0x4f')],'id')){_0x22b8d1[_0x3426('0x4f')][_0x3426('0x50')]('id');}return db['User'][_0x3426('0x38')](_0x22b8d1)[_0x3426('0x29')](handleEntityNotFound(_0x16ebaf,null))['then'](function(_0x464f5d){var _0x241ec3=[];values=_0x464f5d;if(_0x48b3ee[_0x3426('0x4a')][_0x3426('0x52')]===_0x3426('0x53')){_0x241ec3['push'](get_open_tabs(_0x3426('0x54'),_0x464f5d[_0x3426('0x55')]));_0x241ec3[_0x3426('0x50')](get_open_tabs(_0x3426('0x56'),_0x464f5d[_0x3426('0x55')]));_0x241ec3[_0x3426('0x50')](get_open_tabs('openchannel',_0x464f5d[_0x3426('0x55')]));_0x241ec3[_0x3426('0x50')](get_open_tabs(_0x3426('0x5a'),_0x464f5d['dataValues']));_0x241ec3[_0x3426('0x50')](get_open_tabs(_0x3426('0x57'),_0x464f5d[_0x3426('0x55')]));_0x241ec3[_0x3426('0x50')](get_open_tabs(_0x3426('0x58'),_0x464f5d['dataValues']));return Promise['all'](_0x241ec3);}else{return values;}})[_0x3426('0x29')](function(){return values;})[_0x3426('0x29')](respondWithResult(_0x16ebaf,null))[_0x3426('0x5c')](handleError(_0x16ebaf,null));};exports[_0x3426('0x28')]=function(_0x199684,_0xbcab37){if(_0x199684[_0x3426('0x5f')]['id']){delete _0x199684[_0x3426('0x5f')]['id'];}delete _0x199684[_0x3426('0x5f')]['role'];return db['User'][_0x3426('0x38')]({'where':{'id':_0x199684['params']['id']}})[_0x3426('0x29')](handleEntityNotFound(_0xbcab37,null))[_0x3426('0x29')](saveUpdates(_0x199684[_0x3426('0x5f')],null))['then'](respondWithResult(_0xbcab37,null))[_0x3426('0x5c')](handleError(_0xbcab37,null));};exports[_0x3426('0x60')]=function(_0xc680ca,_0x105bf4){return db['User'][_0x3426('0x60')]()[_0x3426('0x29')](respondWithResult(_0x105bf4,null))[_0x3426('0x5c')](handleError(_0x105bf4,null));};exports[_0x3426('0x61')]=function(_0x16b589,_0x472396){return db[_0x3426('0x3e')][_0x3426('0x38')]({'where':{'id':_0x16b589[_0x3426('0x62')]['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x472396,null))[_0x3426('0x29')](function(_0x5b02d6){if(_0x5b02d6){return _0x5b02d6[_0x3426('0x61')](_0x16b589[_0x3426('0x5f')][_0x3426('0x63')],_[_0x3426('0x64')](_0x16b589[_0x3426('0x5f')],[_0x3426('0x63'),'id'])||{});}})[_0x3426('0x29')](respondWithResult(_0x472396,null))[_0x3426('0x5c')](handleError(_0x472396,null));};function validateUser(_0x37e2d9){return new Promise(function(_0x1051dc,_0x568c3c){if(_0x37e2d9['internal'])return _0x1051dc(_0x37e2d9);return db['Setting'][_0x3426('0x65')](0x1)['then'](function(_0x5b4050){if(_0x5b4050[_0x3426('0x66')])authService[_0x3426('0x67')](_0x37e2d9[_0x3426('0x68')]);db['User']['max']('internal')[_0x3426('0x29')](function(_0x571a76){if(_['isNil'](_0x571a76)){_0x37e2d9[_0x3426('0x69')]=_0x5b4050[_0x3426('0x6a')]||0x1;return;}if(_[_0x3426('0x6b')](_0x5b4050[_0x3426('0x6a')])||_0x5b4050[_0x3426('0x6a')]===_0x571a76){_0x37e2d9[_0x3426('0x69')]=_0x571a76+0x1;return;}if(_0x5b4050[_0x3426('0x6a')]>_0x571a76){_0x37e2d9[_0x3426('0x69')]=_0x5b4050[_0x3426('0x6a')];return;}return db[_0x3426('0x6c')][_0x3426('0x4a')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0x3426('0x6d')][_0x3426('0x6e')]})[_0x3426('0x29')](function(_0x272928){if(_0x272928&&_0x272928[_0x3426('0x6f')]){for(var _0x22bf50=0x0,_0x1bbdf9=_0x272928[_0x3426('0x6f')];_0x22bf50<_0x1bbdf9&&_['isNil'](_0x37e2d9[_0x3426('0x69')]);_0x22bf50++){if(_0x5b4050[_0x3426('0x6a')]<=_0x272928[_0x22bf50][_0x3426('0x70')]){_0x37e2d9[_0x3426('0x69')]=_0x272928[_0x22bf50]['from'];}else if(_0x5b4050[_0x3426('0x6a')]>_0x272928[_0x22bf50][_0x3426('0x70')]&&_0x5b4050[_0x3426('0x6a')]<=_0x272928[_0x22bf50]['to']){_0x37e2d9[_0x3426('0x69')]=_0x5b4050[_0x3426('0x6a')];}}}if(_[_0x3426('0x6b')](_0x37e2d9[_0x3426('0x69')])){_0x37e2d9[_0x3426('0x69')]=_0x571a76+0x1;}return _0x1051dc(_0x37e2d9);});});})['catch'](function(_0x67417e){_0x568c3c(_0x67417e);});});}function updateUser(_0x49d49e){return new Promise(function(_0x5cba29,_0x2800f6){try{if(_0x49d49e[_0x3426('0x71')]){_0x49d49e['mailbox']=_0x49d49e[_0x3426('0x69')];_0x49d49e[_0x3426('0x72')]={'mailbox':_0x49d49e['internal'],'password':_0x49d49e[_0x3426('0x68')],'fullname':_0x49d49e[_0x3426('0x73')],'email':_0x49d49e[_0x3426('0x74')]};}if(_0x49d49e[_0x3426('0x2a')]==='agent'){if(!_0x49d49e['permissions'])_0x49d49e[_0x3426('0x75')]=[_0x3426('0x76'),_0x3426('0x77'),'103',_0x3426('0x78'),_0x3426('0x79'),_0x3426('0x7a'),_0x3426('0x7b'),_0x3426('0x7c'),'107',_0x3426('0x7d'),'109',_0x3426('0x7e'),_0x3426('0x7f'),_0x3426('0x80'),_0x3426('0x81')];}_0x5cba29(_0x49d49e);}catch(_0x428a56){_0x2800f6(_0x428a56);}});}exports[_0x3426('0x82')]=function(_0x2c2737,_0x45eb0a){if(_0x2c2737[_0x3426('0x30')][_0x3426('0x2a')]===_0x3426('0x31'))throw new Error(_0x3426('0x83'));if(_0x2c2737[_0x3426('0x5f')][_0x3426('0x2a')]===_0x3426('0x30')&&_0x2c2737[_0x3426('0x30')][_0x3426('0x2a')]!=='admin'){throw new Error(_0x3426('0x84'));}if(_0x2c2737['body'][_0x3426('0x2a')]==='admin'&&_0x2c2737['user']['role']!==_0x3426('0x2e')){throw new Error(_0x3426('0x85'));}return licenseUtil[_0x3426('0x86')]([_0x2c2737[_0x3426('0x5f')]])[_0x3426('0x29')](function(){return validateUser(_0x2c2737[_0x3426('0x5f')]);})[_0x3426('0x29')](function(_0xf32bae){return updateUser(_0xf32bae)[_0x3426('0x29')](function(_0xf69dce){if(_0xf69dce[_0x3426('0x2a')]===_0x3426('0x2e')){_0xf69dce[_0x3426('0x87')]=_0x2c2737[_0x3426('0x30')]['settingsEnabled'];delete _0xf69dce[_0x3426('0x88')];}return _0xf69dce;});})[_0x3426('0x29')](function(_0x101fc4){return db[_0x3426('0x3e')]['create'](_0x101fc4,{'include':[{'model':db[_0x3426('0x72')],'as':_0x3426('0x72')}]});})[_0x3426('0x29')](function(_0x290449){if(_0x2c2737[_0x3426('0x5f')][_0x3426('0x2a')]===_0x3426('0x30'))return _0x290449;if(_0x2c2737[_0x3426('0x30')]['role']!==_0x3426('0x30'))return _0x290449;return db['UserProfileSection'][_0x3426('0x38')]({'where':{'name':_0x290449[_0x3426('0x2a')]===_0x3426('0x31')?_0x3426('0x89'):_0x3426('0x32'),'userProfileId':_0x2c2737[_0x3426('0x30')][_0x3426('0x88')]},'raw':!![]})[_0x3426('0x29')](function(_0x27c0fb){if(!_0x27c0fb||_0x27c0fb[_0x3426('0x8a')]!=0x0)return _0x290449;return db[_0x3426('0x3a')][_0x3426('0x82')]({'name':_0x290449['name'],'resourceId':_0x290449['id'],'type':_0x27c0fb[_0x3426('0x39')],'sectionId':_0x27c0fb['id']},{})[_0x3426('0x29')](function(){return _0x290449;});})[_0x3426('0x5c')](function(_0x3ee98b){logger[_0x3426('0x23')](_0x3426('0x8b'),_0x3ee98b);throw _0x3ee98b;});})[_0x3426('0x29')](respondWithResult(_0x45eb0a,0xc9))[_0x3426('0x5c')](handleError(_0x45eb0a,null));};exports[_0x3426('0x8c')]=function(_0x294bb6,_0xd731f4){var _0x42326c=_0x294bb6[_0x3426('0x5f')];var _0x1be697=[];if(_0x294bb6[_0x3426('0x30')]['role']===_0x3426('0x31'))throw new Error(_0x3426('0x83'));if(_[_0x3426('0x8d')](_0x42326c,[_0x3426('0x2a'),'user'])&&_0x294bb6[_0x3426('0x30')][_0x3426('0x2a')]!==_0x3426('0x2e')){throw new Error(_0x3426('0x84'));}if(_[_0x3426('0x8d')](_0x42326c,[_0x3426('0x2a'),'admin'])&&_0x294bb6[_0x3426('0x30')][_0x3426('0x2a')]!==_0x3426('0x2e')){throw new Error(_0x3426('0x8e'));}return licenseUtil[_0x3426('0x86')](_0x42326c)[_0x3426('0x29')](function(){return validateUser(_0x42326c[0x0]);})[_0x3426('0x29')](function(){for(var _0x1801c1=0x1;_0x1801c1<_0x42326c[_0x3426('0x6f')];_0x1801c1++){var _0xcee6dd=_0x42326c[_0x1801c1-0x1][_0x3426('0x69')];if(!_0x42326c[_0x1801c1][_0x3426('0x69')])_0x42326c[_0x1801c1]['internal']=_0xcee6dd+0x1;_0x1be697[_0x3426('0x50')](validateUser(_0x42326c[_0x1801c1]));}return Promise[_0x3426('0x5b')](_0x1be697);})[_0x3426('0x29')](function(){_0x1be697=[];for(var _0x210c47=0x0;_0x210c47<_0x42326c[_0x3426('0x6f')];_0x210c47++){_0x1be697['push'](updateUser(_0x42326c[_0x210c47]));}return Promise['all'](_0x1be697);})[_0x3426('0x29')](function(){_0x1be697=_0x42326c['map'](function(_0x1c2d2a){return db[_0x3426('0x3e')][_0x3426('0x82')](_0x1c2d2a,{'include':[{'model':db[_0x3426('0x72')],'as':_0x3426('0x72')}]})[_0x3426('0x29')](function(_0x49c6bd){_0x1c2d2a['id']=_0x49c6bd['id'];return _0x1c2d2a;});});return Promise[_0x3426('0x5b')](_0x1be697);})[_0x3426('0x29')](function(_0x19b761){if(_0x294bb6['body'][_0x3426('0x2a')]===_0x3426('0x30'))return _0x19b761;if(_0x294bb6['user']['role']!==_0x3426('0x30'))return _0x19b761;var _0x2a0dd8=_[_0x3426('0x8d')](_0x19b761,function(_0x56ce5f){return _0x56ce5f[_0x3426('0x2a')]==='agent'||_0x56ce5f['role']===_0x3426('0x33');});if(!_0x2a0dd8)return _0x19b761;return db[_0x3426('0x8f')]['findAll']({'where':{'name':{'$or':[_0x3426('0x89'),_0x3426('0x32')]},'userProfileId':_0x294bb6[_0x3426('0x30')]['userProfileId']},'raw':!![]})[_0x3426('0x29')](function(_0x2dd040){if(_[_0x3426('0x90')](_0x2dd040)||!_[_0x3426('0x8d')](_0x2dd040,['autoAssociation',0x0]))return _0x19b761;_0x1be697=[];var _0x5ef993=_(_0x2dd040)[_0x3426('0x36')](function(_0x378555){if(_0x378555[_0x3426('0x8a')]===0x1)return;return _0x378555[_0x3426('0x39')]==='Agents'?'agent':_0x3426('0x33');})[_0x3426('0x91')]()['value']();for(var _0x1bd522=0x0;_0x1bd522<_0x19b761[_0x3426('0x6f')];_0x1bd522++){if(!_[_0x3426('0x46')](_0x5ef993,_0x19b761[_0x1bd522][_0x3426('0x2a')]))return;var _0x187272=_0x19b761[_0x1bd522][_0x3426('0x2a')]===_0x3426('0x31')?_0x3426('0x89'):'Telephones';_0x1be697[_0x3426('0x50')](db[_0x3426('0x3a')][_0x3426('0x82')]({'name':_0x19b761[_0x1bd522]['name'],'resourceId':_0x19b761[_0x1bd522]['id'],'type':_0x187272,'sectionId':_[_0x3426('0x38')](_0x2dd040,[_0x3426('0x39'),_0x187272])['id']},{}));}return Promise[_0x3426('0x5b')](_0x1be697);});})[_0x3426('0x29')](respondWithResult(_0xd731f4,0xc9))[_0x3426('0x5c')](handleError(_0xd731f4,null));};exports['changePassword']=function(_0x44acf2,_0x504219){if(_0x44acf2[_0x3426('0x5f')]['id']){delete _0x44acf2[_0x3426('0x5f')]['id'];}return db[_0x3426('0x3e')][_0x3426('0x38')]({'where':{'id':_0x44acf2[_0x3426('0x62')]['id']}})[_0x3426('0x29')](function(_0x4a761e){if(!_0x4a761e)return null;if(_0x4a761e['id']===_0x44acf2[_0x3426('0x30')]['id']){if(!_0x44acf2['body'][_0x3426('0x92')]||!_0x44acf2[_0x3426('0x5f')][_0x3426('0x93')]){throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0x96'));}if(!_0x4a761e[_0x3426('0x97')](_0x44acf2[_0x3426('0x5f')][_0x3426('0x92')])){throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0x98'));}if(_0x44acf2[_0x3426('0x5f')][_0x3426('0x92')]===_0x44acf2[_0x3426('0x5f')][_0x3426('0x93')]){throw new db[(_0x3426('0x94'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x44acf2[_0x3426('0x30')][_0x3426('0x2a')]===_0x3426('0x2e')){if(!_0x44acf2[_0x3426('0x5f')][_0x3426('0x93')]){throw new db['Sequelize'][(_0x3426('0x95'))](_0x3426('0x99'));}}else if(_0x44acf2['user'][_0x3426('0x2a')]===_0x3426('0x30')){if(!_0x44acf2['body'][_0x3426('0x93')]){throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0x99'));}if(_0x4a761e['role']!==_0x3426('0x31')){throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0x83'));}}else{throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0x83'));}return _0x4a761e;})['then'](handleEntityNotFound(_0x504219,null))[_0x3426('0x29')](function(_0x573de2){return db[_0x3426('0x9a')][_0x3426('0x9b')]({'attributes':['id',_0x3426('0x66'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x3426('0x29')](function(_0x516913){if(_0x516913[_0x3426('0x66')])authService['validatePasswordPattern'](_0x44acf2['body'][_0x3426('0x93')]);if(!_0x516913[_0x3426('0x9c')]||!_0x573de2['previousPasswords'])return _0x573de2;authService[_0x3426('0x9d')](_0x44acf2[_0x3426('0x5f')]['newPassword'],_0x573de2['previousPasswords'],_0x516913[_0x3426('0x9e')]);return _0x573de2;})[_0x3426('0x29')](saveUpdates({'password':_0x44acf2[_0x3426('0x5f')][_0x3426('0x93')],'passwordResetAt':_0x44acf2[_0x3426('0x30')]['id']==_0x44acf2[_0x3426('0x62')]['id']?moment():null,'previousPasswords':authService[_0x3426('0x9f')](_0x44acf2[_0x3426('0x5f')][_0x3426('0x93')],_0x573de2['previousPasswords'])},null));})[_0x3426('0x29')](respondWithResult(_0x504219,null))[_0x3426('0x5c')](handleError(_0x504219,null));};exports['addQueues']=function(_0x5ba338,_0x425220){var _0x57101a=_0x5ba338[_0x3426('0x5f')][_0x3426('0xa0')];return db[_0x3426('0x3e')][_0x3426('0x38')]({'where':{'id':_0x5ba338['params']['id']},'attributes':['id',_0x3426('0x39'),_0x3426('0x2a'),_0x3426('0xa1'),_0x3426('0xa2'),_0x3426('0xa3'),'interface']})[_0x3426('0x29')](handleEntityNotFound(_0x425220,null))[_0x3426('0x29')](function(_0x1d8e20){if(_0x1d8e20){if(!utils[_0x3426('0xa4')](_0x57101a)){throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0xa5'));}return _0x1d8e20[_0x3426('0xa6')+_[_0x3426('0xa7')](_0x57101a['toLowerCase']())+'Queues'](_0x5ba338[_0x3426('0x5f')]['ids'],{'penalty':_0x5ba338[_0x3426('0x5f')]['penalty']||0x0})['spread'](function(_0x6106e9){for(var _0x1d8a60=0x0;_0x1d8a60<_0x5ba338[_0x3426('0x5f')][_0x3426('0x63')]['length'];_0x1d8a60+=0x1){var _0x5777b7={'UserId':Number(_0x5ba338[_0x3426('0x62')]['id'])};_0x5777b7[_[_0x3426('0xa7')](_0x57101a[_0x3426('0xa8')]())+_0x3426('0xa9')]=Number(_0x5ba338[_0x3426('0x5f')]['ids'][_0x1d8a60]);socket[_0x3426('0x2b')](_0x3426('0x30')+_['capitalize'](_0x57101a[_0x3426('0xa8')]())+'Queue:save',_0x5777b7);}return _0x6106e9;})[_0x3426('0x29')](function(){if(_0x57101a===_0x3426('0xaa')){return db[_0x3426('0xab')][_0x3426('0xac')]({'where':{'id':_0x5ba338[_0x3426('0x5f')]['ids']||[]},'raw':!![],'attributes':['id',_0x3426('0x39')]});}})[_0x3426('0x29')](function(_0x5ac6f5){var _0x4a2603=_0x1d8e20['get']({'plain':!![]});var _0x29c9e9=[];if(_0x57101a===_0x3426('0xaa')&&_0x4a2603[_0x3426('0x2a')]===_0x3426('0x31')&&_0x4a2603[_0x3426('0xa1')]){for(let _0x1c1b44=0x0;_0x1c1b44<_0x5ac6f5[_0x3426('0x6f')];_0x1c1b44+=0x1){_0x29c9e9[_0x3426('0x50')]({'membername':_0x4a2603['name'],'UserId':_0x4a2603['id'],'queue_name':_0x5ac6f5[_0x1c1b44][_0x3426('0x39')],'VoiceQueueId':_0x5ac6f5[_0x1c1b44]['id'],'interface':_[_0x3426('0x6b')](_0x4a2603['interface'])?util['format'](_0x3426('0xad'),_0x4a2603['name']):_0x4a2603[_0x3426('0xae')],'paused':_0x4a2603[_0x3426('0xa3')]||![],'penalty':_0x5ba338[_0x3426('0x5f')][_0x3426('0xaf')]||0x0});}return Promise[_0x3426('0x5b')](_0x29c9e9[_0x3426('0x36')](function(_0x27572f){return db[_0x3426('0xb0')][_0x3426('0xb1')](_0x27572f);}));}return _0x1d8e20;});}})['then'](respondWithStatusCode(_0x425220,null))[_0x3426('0x5c')](handleError(_0x425220,null));};exports['removeQueues']=function(_0x3732e4,_0x28a7ed){var _0x28a8e6,_0x293604;return db[_0x3426('0x3e')][_0x3426('0x38')]({'where':{'id':_0x3732e4['params']['id']},'attributes':['id',_0x3426('0x39'),_0x3426('0x2a')]})[_0x3426('0x29')](handleEntityNotFound(_0x28a7ed,null))[_0x3426('0x29')](function(_0x5b83b5){if(_0x5b83b5){_0x28a8e6=_0x5b83b5;if(!_0x3732e4[_0x3426('0x4a')][_0x3426('0xa0')]||!utils[_0x3426('0xa4')](_0x3732e4['query'][_0x3426('0xa0')])){throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0xa5'));}return _0x5b83b5['remove'+_[_0x3426('0xa7')](_0x3732e4['query'][_0x3426('0xa0')]['toLowerCase']())+_0x3426('0xb2')](_0x3732e4['query']['ids']);}})[_0x3426('0x29')](function(_0xb0bbea){if(_['isArray'](_0x3732e4[_0x3426('0x4a')][_0x3426('0x63')])){for(var _0x4a2efa=0x0;_0x4a2efa<_0x3732e4[_0x3426('0x4a')][_0x3426('0x63')][_0x3426('0x6f')];_0x4a2efa+=0x1){_0x293604={'UserId':Number(_0x3732e4['params']['id'])};_0x293604[_['capitalize'](_0x3732e4['query']['channel']['toLowerCase']())+_0x3426('0xa9')]=Number(_0x3732e4[_0x3426('0x4a')][_0x3426('0x63')][_0x4a2efa]);socket[_0x3426('0x2b')](_0x3426('0x30')+_[_0x3426('0xa7')](_0x3732e4[_0x3426('0x4a')]['channel'][_0x3426('0xa8')]())+_0x3426('0xb3'),_0x293604);}}else{_0x293604={'UserId':Number(_0x3732e4['params']['id'])};_0x293604[_['capitalize'](_0x3732e4[_0x3426('0x4a')][_0x3426('0xa0')][_0x3426('0xa8')]())+_0x3426('0xa9')]=Number(_0x3732e4[_0x3426('0x4a')][_0x3426('0x63')]);socket['emit']('user'+_['capitalize'](_0x3732e4[_0x3426('0x4a')][_0x3426('0xa0')][_0x3426('0xa8')]())+_0x3426('0xb3'),_0x293604);}return _0xb0bbea;})[_0x3426('0x29')](function(){if(_0x3732e4[_0x3426('0x4a')][_0x3426('0xa0')]===_0x3426('0xaa')){return db[_0x3426('0xb0')][_0x3426('0x3b')]({'where':{'UserId':_0x3732e4[_0x3426('0x62')]['id'],'VoiceQueueId':_0x3732e4['query'][_0x3426('0x63')]},'individualHooks':!![]})['then'](function(){return _0x28a8e6;});}return _0x28a8e6;})['then'](respondWithStatusCode(_0x28a7ed,null))['catch'](handleError(_0x28a7ed,null));};exports['addAvatar']=function(_0x37924e,_0xe2758d){_0x37924e[_0x3426('0x5f')][_0x3426('0xb4')]=_0x37924e[_0x3426('0xb5')][_0x3426('0xb6')];return db[_0x3426('0x3e')]['find']({'where':{'id':_0x37924e[_0x3426('0x62')]['id']}})[_0x3426('0x29')](handleEntityNotFound(_0xe2758d,null))['then'](saveUpdates(_0x37924e[_0x3426('0x5f')],null))[_0x3426('0x29')](respondWithResult(_0xe2758d,null))[_0x3426('0x5c')](handleError(_0xe2758d,null));};exports['getAvatar']=function(_0x4490ff,_0x3053b5){var _0x3128b3=path[_0x3426('0xb7')](config[_0x3426('0xb8')],'server/files/images/logos/default_profile.png');return db['User'][_0x3426('0x38')]({'where':{'id':_0x4490ff[_0x3426('0x62')]['id']},'attributes':['id',_0x3426('0xb4')],'raw':!![]})[_0x3426('0x29')](handleEntityNotFound(_0x3053b5,null))[_0x3426('0x29')](function(_0x110d44){if(_0x110d44){if(_['isNil'](_0x110d44[_0x3426('0xb4')])){return _0x3053b5['download'](_0x3128b3);}else{if(!fs[_0x3426('0xb9')](path['join'](config[_0x3426('0xb8')],_0x3426('0xba'),_0x110d44[_0x3426('0xb4')]))){return _0x3053b5[_0x3426('0xbb')](_0x3128b3);}return _0x3053b5[_0x3426('0xbb')](path[_0x3426('0xb7')](config[_0x3426('0xb8')],_0x3426('0xba'),_0x110d44['userpic']));}}})[_0x3426('0x5c')](handleError(_0x3053b5,null));};exports[_0x3426('0xbc')]=function(_0x3e2aa1,_0x3bfc50){return db[_0x3426('0x3e')]['find']({'where':{'id':_0x3e2aa1[_0x3426('0x62')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3bfc50,null))[_0x3426('0x29')](function(_0x5152f8){var _0x1f733e=[];values=_0x5152f8[_0x3426('0x55')];_0x1f733e[_0x3426('0x50')](get_open_tabs(_0x3426('0x54'),_0x5152f8[_0x3426('0x55')]));_0x1f733e['push'](get_open_tabs(_0x3426('0x56'),_0x5152f8['dataValues']));_0x1f733e[_0x3426('0x50')](get_open_tabs(_0x3426('0x59'),_0x5152f8[_0x3426('0x55')]));_0x1f733e[_0x3426('0x50')](get_open_tabs(_0x3426('0x5a'),_0x5152f8[_0x3426('0x55')]));_0x1f733e[_0x3426('0x50')](get_open_tabs(_0x3426('0x57'),_0x5152f8[_0x3426('0x55')]));_0x1f733e[_0x3426('0x50')](get_open_tabs(_0x3426('0x58'),_0x5152f8[_0x3426('0x55')]));return Promise[_0x3426('0x5b')](_0x1f733e);})[_0x3426('0x29')](function(_0x17fb60){if(_0x17fb60){var _0x50ccff=_[_0x3426('0x36')](values[_0x3426('0xbd')],function(_0x14113d){return{'channel':_0x3426('0xbe'),'id':_0x14113d['id'],'createdAt':_0x14113d['createdAt']};});var _0x27eda3=_[_0x3426('0x36')](values[_0x3426('0xbf')],function(_0x1489e2){return{'channel':_0x3426('0xc0'),'id':_0x1489e2['id'],'createdAt':_0x1489e2[_0x3426('0xc1')]};});var _0x426932=_[_0x3426('0x36')](values['OpenchannelOpenTabs'],function(_0x1d40c2){return{'channel':_0x3426('0xc2'),'id':_0x1d40c2['id'],'createdAt':_0x1d40c2[_0x3426('0xc1')]};});var _0x3eac75=_[_0x3426('0x36')](values[_0x3426('0xc3')],function(_0x31838c){return{'channel':_0x3426('0xc4'),'id':_0x31838c['id'],'createdAt':_0x31838c[_0x3426('0xc1')]};});var _0x51c69a=_['map'](values[_0x3426('0xc5')],function(_0x84455f){return{'channel':_0x3426('0xc6'),'id':_0x84455f['id'],'createdAt':_0x84455f[_0x3426('0xc1')]};});var _0x180b3e=_[_0x3426('0x36')](values[_0x3426('0xc7')],function(_0x52a91b){return{'channel':_0x3426('0xc8'),'id':_0x52a91b['id'],'createdAt':_0x52a91b[_0x3426('0xc1')]};});var _0x1ae263=_['concat'](_0x50ccff,_0x27eda3,_0x426932,_0x3eac75,_0x51c69a,_0x180b3e);var _0xfcb8e1={'count':_0x1ae263[_0x3426('0x6f')],'rows':_0x1ae263};return _0xfcb8e1;}else return null;})['then'](respondWithResult(_0x3bfc50,null))['catch'](handleError(_0x3bfc50,null));};exports[_0x3426('0xc9')]=function(_0x287d4e,_0x241300){var _0xa0e1b7={};return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0x287d4e[_0x3426('0x62')]['id']}})[_0x3426('0x29')](function(_0x36fe45){if(!_0x36fe45){throw new APINotFoundError(util[_0x3426('0xca')]('User\x20with\x20id\x20%s\x20not\x20found',_0x287d4e[_0x3426('0x62')]['id']));}return contacts[_0x3426('0x60')]();})['then'](function(_0x2c361a){_0x287d4e[_0x3426('0x4a')]['User']=_0x287d4e['params']['id'];_0xa0e1b7=qs[_0x3426('0x48')](_0x2c361a,_0x287d4e);if(_0x287d4e['query'][_0x3426('0xcb')](_0x3426('0x4b'))){_0xa0e1b7['include']=[{'model':db[_0x3426('0xcc')],'as':_0x3426('0xcd'),'required':![]},{'model':db['Tag'],'as':_0x3426('0xce'),'attributes':['id',_0x3426('0x39'),_0x3426('0xcf')],'where':_0x287d4e['query']['tag']?{'id':_0x287d4e['query']['tag']}:undefined,'required':_0x287d4e[_0x3426('0x4a')]['tag']?!![]:![]}];}return contacts[_0x3426('0xac')](_0x287d4e['query'],_0x287d4e[_0x3426('0x30')],_0xa0e1b7,_0x2c361a);})['then'](respondWithFilteredResult(_0x241300,_0xa0e1b7))[_0x3426('0x5c')](APIHandleError(_0x241300));};exports[_0x3426('0xd0')]=function(_0x2dfbdc,_0x4fd6a0){var _0x46a689;var _0x17ab72={};var _0x55ef5c;return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0x2dfbdc[_0x3426('0x62')]['id']},'attributes':['id','name',_0x3426('0x2a')]})[_0x3426('0x29')](handleEntityNotFound(_0x4fd6a0,null))['then'](function(_0x2e60b8){if(!utils[_0x3426('0xa4')](_0x2dfbdc[_0x3426('0x4a')][_0x3426('0xa0')])){throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))]('Unknown\x20channel');}_0x46a689=_0x2e60b8;var _0x23cd15={};_0x23cd15['model']=_['keys'](db[_['capitalize'](_0x2dfbdc[_0x3426('0x4a')][_0x3426('0xa0')])+_0x3426('0xd1')][_0x3426('0x3f')]);_0x23cd15[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0x2dfbdc[_0x3426('0x4a')]);_0x23cd15[_0x3426('0xd3')]=_[_0x3426('0xd4')](_0x23cd15[_0x3426('0xd5')],_0x23cd15[_0x3426('0x4a')]);_0x17ab72[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x23cd15[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x2dfbdc['query'][_0x3426('0xd6')]));_0x17ab72[_0x3426('0x4f')]=_0x17ab72[_0x3426('0x4f')][_0x3426('0x6f')]?_0x17ab72[_0x3426('0x4f')]:_0x23cd15[_0x3426('0xd5')];_0x17ab72[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0x2dfbdc[_0x3426('0x4a')][_0x3426('0xd8')]);_0x17ab72[_0x3426('0x49')]=qs[_0x3426('0xd3')](_[_0x3426('0xd9')](_0x2dfbdc[_0x3426('0x4a')],_0x23cd15[_0x3426('0xd3')]));if(_0x2dfbdc[_0x3426('0x4a')]['filter']){_0x17ab72[_0x3426('0x49')]=_['merge'](_0x17ab72[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x17ab72['attributes'],function(_0x4706c3){var _0x5b1eae={};_0x5b1eae[_0x4706c3]={'$like':'%'+_0x2dfbdc[_0x3426('0x4a')][_0x3426('0x34')]+'%'};return _0x5b1eae;})});}_0x17ab72=_[_0x3426('0x5d')]({},_0x17ab72,_0x2dfbdc[_0x3426('0x5e')]);switch(_0x46a689[_0x3426('0x2a')]){case _0x3426('0x2e'):return db[_[_0x3426('0xa7')](_0x2dfbdc['query'][_0x3426('0xa0')])+_0x3426('0xd1')]['findAll'](_0x17ab72);case'user':case _0x3426('0x31'):return _0x46a689[_0x3426('0x2d')+_['capitalize'](_0x2dfbdc[_0x3426('0x4a')][_0x3426('0xa0')])+_0x3426('0xb2')](_0x17ab72);default:throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0xda'));}})['then'](function(_0xd8a0c){_0x55ef5c=_0xd8a0c[_0x3426('0x6f')];if(!_0x2dfbdc['query'][_0x3426('0xcb')]('nolimit')){_0x17ab72['limit']=qs['limit'](_0x2dfbdc['query'][_0x3426('0x1d')]);_0x17ab72[_0x3426('0x1b')]=qs[_0x3426('0x1b')](_0x2dfbdc[_0x3426('0x4a')]['offset']);}switch(_0x46a689[_0x3426('0x2a')]){case _0x3426('0x2e'):return db[_[_0x3426('0xa7')](_0x2dfbdc[_0x3426('0x4a')][_0x3426('0xa0')])+'Queue']['findAll'](_0x17ab72);case _0x3426('0x30'):case'agent':return _0x46a689[_0x3426('0x2d')+_[_0x3426('0xa7')](_0x2dfbdc['query'][_0x3426('0xa0')])+'Queues'](_0x17ab72);}})[_0x3426('0x29')](function(_0x2d28d5){return{'count':_0x55ef5c,'rows':_0x2d28d5};})[_0x3426('0x29')](respondWithResult(_0x4fd6a0,null))['catch'](handleError(_0x4fd6a0,null));};exports[_0x3426('0xdb')]=function(_0x4977ef,_0x231808){var _0x5953d={};var _0x2c5b99={};var _0x21f972;var _0xfbc882;return db[_0x3426('0x3e')]['findOne']({'where':{'id':_0x4977ef[_0x3426('0x62')]['id']}})['then'](handleEntityNotFound(_0x231808,null))[_0x3426('0x29')](function(_0x2d8795){if(_0x2d8795){_0x21f972=_0x2d8795;_0x2c5b99[_0x3426('0xd5')]=_['keys'](db[_0x3426('0xb0')][_0x3426('0x3f')]);_0x2c5b99[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0x4977ef['query']);_0x2c5b99['filters']=_[_0x3426('0xd4')](_0x2c5b99['model'],_0x2c5b99['query']);_0x5953d[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x2c5b99[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x4977ef[_0x3426('0x4a')]['fields']));_0x5953d['attributes']=_0x5953d[_0x3426('0x4f')][_0x3426('0x6f')]?_0x5953d[_0x3426('0x4f')]:_0x2c5b99[_0x3426('0xd5')];_0x5953d[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0x4977ef['query'][_0x3426('0xd8')]);_0x5953d[_0x3426('0x49')]=qs['filters'](_[_0x3426('0xd9')](_0x4977ef[_0x3426('0x4a')],_0x2c5b99[_0x3426('0xd3')]));if(_0x4977ef['query'][_0x3426('0x34')]){_0x5953d[_0x3426('0x49')]=_[_0x3426('0x5d')](_0x5953d[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x5953d[_0x3426('0x4f')],function(_0xd164f){var _0x22928d={};_0x22928d[_0xd164f]={'$like':'%'+_0x4977ef[_0x3426('0x4a')]['filter']+'%'};return _0x22928d;})});}_0x5953d=_['merge']({},_0x5953d,_0x4977ef['options']);return _0x21f972['getVoiceQueuesRt'](_0x5953d);}})[_0x3426('0x29')](function(_0x4a4cae){if(_0x4a4cae){_0xfbc882=_0x4a4cae[_0x3426('0x6f')];if(!_0x4977ef[_0x3426('0x4a')][_0x3426('0xcb')](_0x3426('0xdc'))){_0x5953d[_0x3426('0x1d')]=qs[_0x3426('0x1d')](_0x4977ef[_0x3426('0x4a')][_0x3426('0x1d')]);_0x5953d[_0x3426('0x1b')]=qs[_0x3426('0x1b')](_0x4977ef['query'][_0x3426('0x1b')]);}return _0x21f972[_0x3426('0xdb')](_0x5953d);}})['then'](function(_0x5de862){if(_0x5de862){return _0x5de862?{'count':_0xfbc882,'rows':_0x5de862}:null;}})[_0x3426('0x29')](respondWithResult(_0x231808,null))[_0x3426('0x5c')](handleError(_0x231808,null));};exports[_0x3426('0xdd')]=function(_0x1865f4,_0x21fed3){var _0x32aed8={};var _0x1cec20={};var _0x2a5bb9;var _0x40af6a;return db['User'][_0x3426('0x9b')]({'where':{'id':_0x1865f4[_0x3426('0x62')]['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x21fed3,null))['then'](function(_0x5ca031){if(_0x5ca031){_0x2a5bb9=_0x5ca031;_0x1cec20[_0x3426('0xd5')]=_[_0x3426('0xd2')](db['ChatGroup'][_0x3426('0x3f')]);_0x1cec20['query']=_[_0x3426('0xd2')](_0x1865f4[_0x3426('0x4a')]);_0x1cec20[_0x3426('0xd3')]=_[_0x3426('0xd4')](_0x1cec20[_0x3426('0xd5')],_0x1cec20[_0x3426('0x4a')]);_0x32aed8[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x1cec20[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x1865f4[_0x3426('0x4a')]['fields']));_0x32aed8[_0x3426('0x4f')]=_0x32aed8[_0x3426('0x4f')]['length']?_0x32aed8['attributes']:_0x1cec20[_0x3426('0xd5')];_0x32aed8['order']=qs['sort'](_0x1865f4[_0x3426('0x4a')]['sort']);_0x32aed8[_0x3426('0x49')]=qs[_0x3426('0xd3')](_[_0x3426('0xd9')](_0x1865f4['query'],_0x1cec20[_0x3426('0xd3')]));if(_0x1865f4[_0x3426('0x4a')]['filter']){_0x32aed8['where']=_[_0x3426('0x5d')](_0x32aed8[_0x3426('0x49')],{'$or':_['map'](_0x32aed8[_0x3426('0x4f')],function(_0x104fd1){var _0x3adf4f={};_0x3adf4f[_0x104fd1]={'$like':'%'+_0x1865f4['query'][_0x3426('0x34')]+'%'};return _0x3adf4f;})});}_0x32aed8=_[_0x3426('0x5d')]({},_0x32aed8,_0x1865f4[_0x3426('0x5e')]);return _0x2a5bb9['getGroups'](_0x32aed8);}})[_0x3426('0x29')](function(_0x601acb){if(_0x601acb){_0x40af6a=_0x601acb[_0x3426('0x6f')];if(!_0x1865f4[_0x3426('0x4a')][_0x3426('0xcb')](_0x3426('0xdc'))){_0x32aed8['limit']=qs[_0x3426('0x1d')](_0x1865f4[_0x3426('0x4a')][_0x3426('0x1d')]);_0x32aed8[_0x3426('0x1b')]=qs[_0x3426('0x1b')](_0x1865f4[_0x3426('0x4a')]['offset']);}return _0x2a5bb9[_0x3426('0xdd')](_0x32aed8);}})[_0x3426('0x29')](function(_0x4c982f){if(_0x4c982f){return _0x4c982f?{'count':_0x40af6a,'rows':_0x4c982f}:null;}})[_0x3426('0x29')](respondWithResult(_0x21fed3,null))[_0x3426('0x5c')](handleError(_0x21fed3,null));};exports[_0x3426('0xde')]=function(_0x4c21af,_0xda4dcf){var _0x21e55b={'raw':!![],'where':{}};var _0x2b9c96={};var _0xe3260d={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x4c21af[_0x3426('0x62')]['id']}})[_0x3426('0x29')](handleEntityNotFound(_0xda4dcf,null))['then'](function(_0xdda0f8){if(_0xdda0f8){_0x2b9c96[_0x3426('0xd5')]=_[_0x3426('0xd2')](db[_0x3426('0xdf')][_0x3426('0x3f')]);_0x2b9c96[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0x4c21af[_0x3426('0x4a')]);_0x2b9c96[_0x3426('0xd3')]=_['intersection'](_0x2b9c96[_0x3426('0xd5')],_0x2b9c96[_0x3426('0x4a')]);_0x21e55b[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x2b9c96[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x4c21af[_0x3426('0x4a')][_0x3426('0xd6')]));_0x21e55b['attributes']=_0x21e55b['attributes'][_0x3426('0x6f')]?_0x21e55b[_0x3426('0x4f')]:_0x2b9c96[_0x3426('0xd5')];if(!_0x4c21af[_0x3426('0x4a')]['hasOwnProperty'](_0x3426('0xdc'))){_0x21e55b[_0x3426('0x1d')]=qs['limit'](_0x4c21af[_0x3426('0x4a')]['limit']);_0x21e55b[_0x3426('0x1b')]=qs[_0x3426('0x1b')](_0x4c21af['query'][_0x3426('0x1b')]);}_0x21e55b[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0x4c21af['query']['sort']);_0x21e55b[_0x3426('0x49')]=qs[_0x3426('0xd3')](_[_0x3426('0xd9')](_0x4c21af['query'],_0x2b9c96[_0x3426('0xd3')]));_0x21e55b[_0x3426('0x49')]['UserId']=_0xdda0f8['id'];if(_0x4c21af['query'][_0x3426('0x34')]){_0x21e55b[_0x3426('0x49')]=_[_0x3426('0x5d')](_0x21e55b['where'],{'$or':_[_0x3426('0x36')](_0x21e55b[_0x3426('0x4f')],function(_0x1fea38){var _0x46327e={};_0x46327e[_0x1fea38]={'$like':'%'+_0x4c21af['query'][_0x3426('0x34')]+'%'};return _0x46327e;})});}_0x21e55b=_['merge']({},_0x21e55b,_0x4c21af['options']);return db['VoiceRecording'][_0x3426('0x1e')]({'where':_0x21e55b[_0x3426('0x49')]})[_0x3426('0x29')](function(_0x1e4289){_0xe3260d['count']=_0x1e4289;if(_0x4c21af[_0x3426('0x4a')][_0x3426('0x4b')]){_0x21e55b[_0x3426('0x4c')]=[{'all':!![]}];}return db['VoiceRecording'][_0x3426('0xac')](_0x21e55b);})['then'](function(_0x29d70b){_0xe3260d[_0x3426('0x51')]=_0x29d70b;return _0xe3260d;});}})[_0x3426('0x29')](respondWithFilteredResult(_0xda4dcf,_0x21e55b))[_0x3426('0x5c')](handleError(_0xda4dcf,null));};exports[_0x3426('0xe0')]=function(_0x34f67c,_0x192af1){var _0x19bbc0={'raw':!![],'where':{}};var _0x360ee2={};var _0x49714d={'count':0x0,'rows':[]};return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0x34f67c[_0x3426('0x62')]['id']}})['then'](handleEntityNotFound(_0x192af1,null))['then'](function(_0x106847){if(_0x106847){_0x360ee2[_0x3426('0xd5')]=_['keys'](db['ScreenRecording'][_0x3426('0x3f')]);_0x360ee2['query']=_[_0x3426('0xd2')](_0x34f67c[_0x3426('0x4a')]);_0x360ee2['filters']=_[_0x3426('0xd4')](_0x360ee2[_0x3426('0xd5')],_0x360ee2[_0x3426('0x4a')]);_0x19bbc0[_0x3426('0x4f')]=_['intersection'](_0x360ee2[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x34f67c[_0x3426('0x4a')][_0x3426('0xd6')]));_0x19bbc0[_0x3426('0x4f')]=_0x19bbc0[_0x3426('0x4f')][_0x3426('0x6f')]?_0x19bbc0[_0x3426('0x4f')]:_0x360ee2['model'];if(!_0x34f67c[_0x3426('0x4a')]['hasOwnProperty']('nolimit')){_0x19bbc0[_0x3426('0x1d')]=qs[_0x3426('0x1d')](_0x34f67c['query']['limit']);_0x19bbc0[_0x3426('0x1b')]=qs[_0x3426('0x1b')](_0x34f67c[_0x3426('0x4a')][_0x3426('0x1b')]);}_0x19bbc0[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0x34f67c[_0x3426('0x4a')][_0x3426('0xd8')]);_0x19bbc0[_0x3426('0x49')]=qs[_0x3426('0xd3')](_[_0x3426('0xd9')](_0x34f67c[_0x3426('0x4a')],_0x360ee2['filters']));_0x19bbc0[_0x3426('0x49')][_0x3426('0xe1')]=_0x106847['id'];if(_0x34f67c[_0x3426('0x4a')][_0x3426('0x34')]){_0x19bbc0['where']=_[_0x3426('0x5d')](_0x19bbc0[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x19bbc0['attributes'],function(_0x431626){var _0x41a507={};_0x41a507[_0x431626]={'$like':'%'+_0x34f67c[_0x3426('0x4a')][_0x3426('0x34')]+'%'};return _0x41a507;})});}_0x19bbc0=_['merge']({},_0x19bbc0,_0x34f67c[_0x3426('0x5e')]);return db[_0x3426('0xe2')][_0x3426('0x1e')]({'where':_0x19bbc0[_0x3426('0x49')]})['then'](function(_0x446aac){_0x49714d[_0x3426('0x1e')]=_0x446aac;if(_0x34f67c['query'][_0x3426('0x4b')]){_0x19bbc0[_0x3426('0x4c')]=[{'all':!![]}];}return db[_0x3426('0xe2')][_0x3426('0xac')](_0x19bbc0);})[_0x3426('0x29')](function(_0x22dbb1){_0x49714d[_0x3426('0x51')]=_0x22dbb1;return _0x49714d;});}})[_0x3426('0x29')](respondWithFilteredResult(_0x192af1,_0x19bbc0))['catch'](handleError(_0x192af1,null));};exports[_0x3426('0xe3')]=function(_0x26ad24,_0x406ab3){var _0x24ad37={};var _0x2c4e39={};var _0x44e720;var _0x57fa79;return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0x26ad24[_0x3426('0x62')]['id']}})['then'](handleEntityNotFound(_0x406ab3,null))['then'](function(_0x421ea1){if(_0x421ea1){_0x44e720=_0x421ea1;_0x2c4e39[_0x3426('0xd5')]=_[_0x3426('0xd2')](db[_0x3426('0xe4')][_0x3426('0x3f')]);_0x2c4e39['query']=_['keys'](_0x26ad24[_0x3426('0x4a')]);_0x2c4e39[_0x3426('0xd3')]=_[_0x3426('0xd4')](_0x2c4e39[_0x3426('0xd5')],_0x2c4e39[_0x3426('0x4a')]);_0x24ad37[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x2c4e39[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x26ad24[_0x3426('0x4a')][_0x3426('0xd6')]));_0x24ad37[_0x3426('0x4f')]=_0x24ad37[_0x3426('0x4f')][_0x3426('0x6f')]?_0x24ad37[_0x3426('0x4f')]:_0x2c4e39[_0x3426('0xd5')];_0x24ad37['order']=qs[_0x3426('0xd8')](_0x26ad24['query'][_0x3426('0xd8')]);_0x24ad37[_0x3426('0x49')]=qs['filters'](_[_0x3426('0xd9')](_0x26ad24[_0x3426('0x4a')],_0x2c4e39[_0x3426('0xd3')]));if(_0x26ad24['query']['filter']){_0x24ad37['where']=_['merge'](_0x24ad37[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x24ad37[_0x3426('0x4f')],function(_0x526af3){var _0x9e6695={};_0x9e6695[_0x526af3]={'$like':'%'+_0x26ad24['query'][_0x3426('0x34')]+'%'};return _0x9e6695;})});}_0x24ad37=_[_0x3426('0x5d')]({},_0x24ad37,_0x26ad24['options']);return _0x44e720[_0x3426('0xe3')](_0x24ad37);}})[_0x3426('0x29')](function(_0x1591f1){if(_0x1591f1){_0x57fa79=_0x1591f1[_0x3426('0x6f')];if(!_0x26ad24[_0x3426('0x4a')]['hasOwnProperty'](_0x3426('0xdc'))){_0x24ad37[_0x3426('0x1d')]=qs[_0x3426('0x1d')](_0x26ad24[_0x3426('0x4a')][_0x3426('0x1d')]);_0x24ad37[_0x3426('0x1b')]=qs[_0x3426('0x1b')](_0x26ad24['query'][_0x3426('0x1b')]);}return _0x44e720['getChatInteractions'](_0x24ad37);}})[_0x3426('0x29')](function(_0x17e439){if(_0x17e439){return _0x17e439?{'count':_0x57fa79,'rows':_0x17e439}:null;}})[_0x3426('0x29')](respondWithResult(_0x406ab3,null))['catch'](handleError(_0x406ab3,null));};exports['getOpenchannelInteractions']=function(_0x30b906,_0x451743){var _0x3dbd84={};var _0x59f805={};var _0x499247;var _0x320d53;return db[_0x3426('0x3e')]['findOne']({'where':{'id':_0x30b906[_0x3426('0x62')]['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x451743,null))[_0x3426('0x29')](function(_0x408380){if(_0x408380){_0x499247=_0x408380;_0x59f805[_0x3426('0xd5')]=_[_0x3426('0xd2')](db[_0x3426('0xe5')][_0x3426('0x3f')]);_0x59f805[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0x30b906[_0x3426('0x4a')]);_0x59f805['filters']=_[_0x3426('0xd4')](_0x59f805[_0x3426('0xd5')],_0x59f805[_0x3426('0x4a')]);_0x3dbd84[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x59f805[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x30b906[_0x3426('0x4a')][_0x3426('0xd6')]));_0x3dbd84[_0x3426('0x4f')]=_0x3dbd84[_0x3426('0x4f')][_0x3426('0x6f')]?_0x3dbd84[_0x3426('0x4f')]:_0x59f805[_0x3426('0xd5')];_0x3dbd84[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0x30b906[_0x3426('0x4a')][_0x3426('0xd8')]);_0x3dbd84['where']=qs['filters'](_[_0x3426('0xd9')](_0x30b906['query'],_0x59f805['filters']));if(_0x30b906['query']['filter']){_0x3dbd84[_0x3426('0x49')]=_[_0x3426('0x5d')](_0x3dbd84['where'],{'$or':_['map'](_0x3dbd84[_0x3426('0x4f')],function(_0xa126e6){var _0x1b0ffa={};_0x1b0ffa[_0xa126e6]={'$like':'%'+_0x30b906[_0x3426('0x4a')][_0x3426('0x34')]+'%'};return _0x1b0ffa;})});}_0x3dbd84=_['merge']({},_0x3dbd84,_0x30b906['options']);return _0x499247['getOpenchannelInteractions'](_0x3dbd84);}})[_0x3426('0x29')](function(_0xe54246){if(_0xe54246){_0x320d53=_0xe54246[_0x3426('0x6f')];if(!_0x30b906[_0x3426('0x4a')][_0x3426('0xcb')]('nolimit')){_0x3dbd84['limit']=qs[_0x3426('0x1d')](_0x30b906[_0x3426('0x4a')][_0x3426('0x1d')]);_0x3dbd84['offset']=qs[_0x3426('0x1b')](_0x30b906[_0x3426('0x4a')]['offset']);}return _0x499247[_0x3426('0xe6')](_0x3dbd84);}})[_0x3426('0x29')](function(_0x2c52ee){if(_0x2c52ee){return _0x2c52ee?{'count':_0x320d53,'rows':_0x2c52ee}:null;}})['then'](respondWithResult(_0x451743,null))[_0x3426('0x5c')](handleError(_0x451743,null));};exports[_0x3426('0xe7')]=function(_0x831eee,_0x4032c9){var _0x2bc526={'raw':!![],'where':{}};var _0xe88ab6={};var _0xfced88={'count':0x0,'rows':[]};return db['User'][_0x3426('0x9b')]({'where':{'id':_0x831eee['params']['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x4032c9,null))[_0x3426('0x29')](function(_0x51606b){if(_0x51606b){_0xe88ab6[_0x3426('0xd5')]=_[_0x3426('0xd2')](db['MailInteraction']['rawAttributes']);_0xe88ab6[_0x3426('0x4a')]=_['keys'](_0x831eee[_0x3426('0x4a')]);_0xe88ab6['filters']=_['intersection'](_0xe88ab6[_0x3426('0xd5')],_0xe88ab6[_0x3426('0x4a')]);_0x2bc526[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0xe88ab6[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x831eee[_0x3426('0x4a')][_0x3426('0xd6')]));_0x2bc526['attributes']=_0x2bc526[_0x3426('0x4f')][_0x3426('0x6f')]?_0x2bc526[_0x3426('0x4f')]:_0xe88ab6['model'];if(!_0x831eee[_0x3426('0x4a')][_0x3426('0xcb')](_0x3426('0xdc'))){_0x2bc526['limit']=qs[_0x3426('0x1d')](_0x831eee[_0x3426('0x4a')][_0x3426('0x1d')]);_0x2bc526[_0x3426('0x1b')]=qs['offset'](_0x831eee[_0x3426('0x4a')]['offset']);}_0x2bc526[_0x3426('0xd7')]=qs['sort'](_0x831eee[_0x3426('0x4a')][_0x3426('0xd8')]);_0x2bc526[_0x3426('0x49')]=qs['filters'](_[_0x3426('0xd9')](_0x831eee[_0x3426('0x4a')],_0xe88ab6[_0x3426('0xd3')]));_0x2bc526['where']['UserId']=_0x51606b['id'];if(_0x831eee[_0x3426('0x4a')][_0x3426('0x34')]){_0x2bc526[_0x3426('0x49')]=_['merge'](_0x2bc526['where'],{'$or':_[_0x3426('0x36')](_0x2bc526[_0x3426('0x4f')],function(_0x5246c6){var _0x34d394={};_0x34d394[_0x5246c6]={'$like':'%'+_0x831eee['query'][_0x3426('0x34')]+'%'};return _0x34d394;})});}_0x2bc526=_[_0x3426('0x5d')]({},_0x2bc526,_0x831eee[_0x3426('0x5e')]);return db[_0x3426('0xe8')][_0x3426('0x1e')]({'where':_0x2bc526[_0x3426('0x49')]})[_0x3426('0x29')](function(_0x3947d3){_0xfced88[_0x3426('0x1e')]=_0x3947d3;if(_0x831eee['query']['includeAll']){_0x2bc526[_0x3426('0x4c')]=[{'all':!![]}];}return db[_0x3426('0xe8')]['findAll'](_0x2bc526);})[_0x3426('0x29')](function(_0x149e63){_0xfced88['rows']=_0x149e63;return _0xfced88;});}})['then'](respondWithFilteredResult(_0x4032c9,_0x2bc526))[_0x3426('0x5c')](handleError(_0x4032c9,null));};exports['getSmsInteractions']=function(_0x42ebfb,_0x200437){var _0x3163f7={};var _0x4b54c2={};var _0x40569f;var _0x4b5a99;return db['User'][_0x3426('0x9b')]({'where':{'id':_0x42ebfb[_0x3426('0x62')]['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x200437,null))['then'](function(_0x2b8295){if(_0x2b8295){_0x40569f=_0x2b8295;_0x4b54c2[_0x3426('0xd5')]=_[_0x3426('0xd2')](db[_0x3426('0xe9')][_0x3426('0x3f')]);_0x4b54c2['query']=_[_0x3426('0xd2')](_0x42ebfb[_0x3426('0x4a')]);_0x4b54c2[_0x3426('0xd3')]=_[_0x3426('0xd4')](_0x4b54c2[_0x3426('0xd5')],_0x4b54c2[_0x3426('0x4a')]);_0x3163f7[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x4b54c2['model'],qs[_0x3426('0xd6')](_0x42ebfb[_0x3426('0x4a')][_0x3426('0xd6')]));_0x3163f7['attributes']=_0x3163f7[_0x3426('0x4f')][_0x3426('0x6f')]?_0x3163f7[_0x3426('0x4f')]:_0x4b54c2['model'];_0x3163f7[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0x42ebfb[_0x3426('0x4a')]['sort']);_0x3163f7[_0x3426('0x49')]=qs[_0x3426('0xd3')](_[_0x3426('0xd9')](_0x42ebfb[_0x3426('0x4a')],_0x4b54c2[_0x3426('0xd3')]));if(_0x42ebfb[_0x3426('0x4a')][_0x3426('0x34')]){_0x3163f7[_0x3426('0x49')]=_[_0x3426('0x5d')](_0x3163f7[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x3163f7[_0x3426('0x4f')],function(_0xf3635f){var _0x1b5444={};_0x1b5444[_0xf3635f]={'$like':'%'+_0x42ebfb[_0x3426('0x4a')]['filter']+'%'};return _0x1b5444;})});}_0x3163f7=_[_0x3426('0x5d')]({},_0x3163f7,_0x42ebfb[_0x3426('0x5e')]);return _0x40569f['getSmsInteractions'](_0x3163f7);}})['then'](function(_0x1244f0){if(_0x1244f0){_0x4b5a99=_0x1244f0[_0x3426('0x6f')];if(!_0x42ebfb['query'][_0x3426('0xcb')]('nolimit')){_0x3163f7[_0x3426('0x1d')]=qs[_0x3426('0x1d')](_0x42ebfb[_0x3426('0x4a')][_0x3426('0x1d')]);_0x3163f7['offset']=qs[_0x3426('0x1b')](_0x42ebfb['query']['offset']);}return _0x40569f[_0x3426('0xea')](_0x3163f7);}})['then'](function(_0x45df60){if(_0x45df60){return _0x45df60?{'count':_0x4b5a99,'rows':_0x45df60}:null;}})['then'](respondWithResult(_0x200437,null))[_0x3426('0x5c')](handleError(_0x200437,null));};exports[_0x3426('0xeb')]=function(_0x295fdc,_0x19b88a){var _0x19dd3b={};var _0x1536e5={};var _0xeca7f1;var _0x352de7;return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0x295fdc[_0x3426('0x62')]['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x19b88a,null))[_0x3426('0x29')](function(_0x2e6e35){if(_0x2e6e35){_0xeca7f1=_0x2e6e35;_0x1536e5[_0x3426('0xd5')]=_[_0x3426('0xd2')](db['FaxInteraction']['rawAttributes']);_0x1536e5[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0x295fdc['query']);_0x1536e5[_0x3426('0xd3')]=_[_0x3426('0xd4')](_0x1536e5['model'],_0x1536e5[_0x3426('0x4a')]);_0x19dd3b['attributes']=_['intersection'](_0x1536e5[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x295fdc['query'][_0x3426('0xd6')]));_0x19dd3b[_0x3426('0x4f')]=_0x19dd3b[_0x3426('0x4f')]['length']?_0x19dd3b[_0x3426('0x4f')]:_0x1536e5[_0x3426('0xd5')];_0x19dd3b[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0x295fdc[_0x3426('0x4a')][_0x3426('0xd8')]);_0x19dd3b[_0x3426('0x49')]=qs[_0x3426('0xd3')](_[_0x3426('0xd9')](_0x295fdc[_0x3426('0x4a')],_0x1536e5[_0x3426('0xd3')]));if(_0x295fdc[_0x3426('0x4a')][_0x3426('0x34')]){_0x19dd3b[_0x3426('0x49')]=_[_0x3426('0x5d')](_0x19dd3b[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x19dd3b[_0x3426('0x4f')],function(_0x13bfd7){var _0x495687={};_0x495687[_0x13bfd7]={'$like':'%'+_0x295fdc[_0x3426('0x4a')][_0x3426('0x34')]+'%'};return _0x495687;})});}_0x19dd3b=_['merge']({},_0x19dd3b,_0x295fdc[_0x3426('0x5e')]);return _0xeca7f1[_0x3426('0xeb')](_0x19dd3b);}})[_0x3426('0x29')](function(_0x5f2200){if(_0x5f2200){_0x352de7=_0x5f2200['length'];if(!_0x295fdc[_0x3426('0x4a')]['hasOwnProperty'](_0x3426('0xdc'))){_0x19dd3b[_0x3426('0x1d')]=qs[_0x3426('0x1d')](_0x295fdc['query'][_0x3426('0x1d')]);_0x19dd3b[_0x3426('0x1b')]=qs[_0x3426('0x1b')](_0x295fdc[_0x3426('0x4a')]['offset']);}return _0xeca7f1[_0x3426('0xeb')](_0x19dd3b);}})[_0x3426('0x29')](function(_0x3cb1e0){if(_0x3cb1e0){return _0x3cb1e0?{'count':_0x352de7,'rows':_0x3cb1e0}:null;}})[_0x3426('0x29')](respondWithResult(_0x19b88a,null))[_0x3426('0x5c')](handleError(_0x19b88a,null));};exports[_0x3426('0xec')]=function(_0x2571c4,_0x560e15){var _0x4b095a={};var _0x27b98b={};var _0x19e164;var _0x2b4dce;return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0x2571c4[_0x3426('0x62')]['id']}})['then'](handleEntityNotFound(_0x560e15,null))[_0x3426('0x29')](function(_0x3e3593){if(_0x3e3593){_0x19e164=_0x3e3593;_0x27b98b[_0x3426('0xd5')]=_[_0x3426('0xd2')](db[_0x3426('0xed')]['rawAttributes']);_0x27b98b[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0x2571c4['query']);_0x27b98b[_0x3426('0xd3')]=_[_0x3426('0xd4')](_0x27b98b[_0x3426('0xd5')],_0x27b98b[_0x3426('0x4a')]);_0x4b095a[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x27b98b[_0x3426('0xd5')],qs['fields'](_0x2571c4['query'][_0x3426('0xd6')]));_0x4b095a[_0x3426('0x4f')]=_0x4b095a[_0x3426('0x4f')][_0x3426('0x6f')]?_0x4b095a[_0x3426('0x4f')]:_0x27b98b[_0x3426('0xd5')];_0x4b095a['order']=qs[_0x3426('0xd8')](_0x2571c4[_0x3426('0x4a')][_0x3426('0xd8')]);_0x4b095a[_0x3426('0x49')]=qs['filters'](_[_0x3426('0xd9')](_0x2571c4[_0x3426('0x4a')],_0x27b98b[_0x3426('0xd3')]));if(_0x2571c4[_0x3426('0x4a')][_0x3426('0x34')]){_0x4b095a['where']=_[_0x3426('0x5d')](_0x4b095a[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x4b095a[_0x3426('0x4f')],function(_0x56c6fc){var _0x23d2af={};_0x23d2af[_0x56c6fc]={'$like':'%'+_0x2571c4[_0x3426('0x4a')][_0x3426('0x34')]+'%'};return _0x23d2af;})});}_0x4b095a=_[_0x3426('0x5d')]({},_0x4b095a,_0x2571c4[_0x3426('0x5e')]);return _0x19e164[_0x3426('0xec')](_0x4b095a);}})[_0x3426('0x29')](function(_0x1c10d3){if(_0x1c10d3){_0x2b4dce=_0x1c10d3['length'];if(!_0x2571c4[_0x3426('0x4a')][_0x3426('0xcb')]('nolimit')){_0x4b095a[_0x3426('0x1d')]=qs[_0x3426('0x1d')](_0x2571c4[_0x3426('0x4a')][_0x3426('0x1d')]);_0x4b095a[_0x3426('0x1b')]=qs['offset'](_0x2571c4['query'][_0x3426('0x1b')]);}return _0x19e164['getWhatsappInteractions'](_0x4b095a);}})[_0x3426('0x29')](function(_0x2da252){if(_0x2da252){return _0x2da252?{'count':_0x2b4dce,'rows':_0x2da252}:null;}})[_0x3426('0x29')](respondWithResult(_0x560e15,null))[_0x3426('0x5c')](handleError(_0x560e15,null));};exports[_0x3426('0xee')]=function(_0x32af1c,_0x407c9c,_0x2ac2fd){var _0x22343b;var _0x13a4b9;var _0x58665f;var _0x300685=!_['isNil'](_0x32af1c[_0x3426('0x62')]['id'])?_0x32af1c[_0x3426('0x62')]['id']:!_[_0x3426('0x6b')](_0x32af1c[_0x3426('0x30')]['id'])?_0x32af1c['user']['id']:null;return db['User'][_0x3426('0x38')]({'where':{'id':_0x300685,'role':{'$or':[_0x3426('0x2e'),_0x3426('0x30'),'agent']}},'attributes':['id','name',_0x3426('0xef'),_0x3426('0xf0'),_0x3426('0x2a'),_0x3426('0x69'),_0x3426('0xa2')]})[_0x3426('0x29')](function(_0x243e17){if(_0x243e17){if(_0x243e17['role']===_0x3426('0x31')){_0x22343b=_0x243e17;if(_0x32af1c['body'][_0x3426('0xae')]){_0x58665f=util[_0x3426('0xca')](_0x3426('0xf1'),_0x22343b[_0x32af1c['body'][_0x3426('0xae')]]);}else if(_0x32af1c['body']['intrf']){_0x58665f=util['format'](_0x3426('0xad'),_0x32af1c[_0x3426('0x5f')]['intrf']);}else{_0x58665f=util[_0x3426('0xca')]('SIP/%s',_0x22343b[_0x3426('0x39')]);}socket['to'](util[_0x3426('0xca')](_0x3426('0xf2'),_0x22343b[_0x3426('0x39')]))[_0x3426('0x2b')](_0x3426('0xf3'),{'user':{'id':_0x22343b['id'],'name':_0x22343b[_0x3426('0x39')]},'ip':_0x32af1c['headers']['x-forwarded-for']||_0x32af1c[_0x3426('0xf4')][_0x3426('0xf5')]||_0x32af1c[_0x3426('0xf6')][_0x3426('0xf5')]||_0x32af1c[_0x3426('0xf4')][_0x3426('0xf6')]['remoteAddress']});return new Promise(function(_0x446e4f,_0x628ba0){db[_0x3426('0x6c')][_0x3426('0xf7')]()[_0x3426('0x29')](_0x582fe9=>{db[_0x3426('0xb0')][_0x3426('0x3b')]({'where':{'membername':_0x22343b[_0x3426('0x39')]},'individualHooks':!![]},{'transaction':_0x582fe9})[_0x3426('0x29')](function(){return _0x582fe9[_0x3426('0xf8')]();})[_0x3426('0x29')](_0x446e4f)[_0x3426('0x5c')](_0x628ba0);});});}}else{throw new db[(_0x3426('0x94'))][(_0x3426('0x95'))](_0x3426('0xf9'));}})['then'](function(){if(_0x22343b){return _0x22343b['getVoiceQueues']({'raw':!![]});}})[_0x3426('0x29')](function(_0x4edf8b){if(_0x22343b){if(_0x4edf8b){_0x13a4b9=_0x4edf8b;if(_0x13a4b9[_0x3426('0x6f')]){var _0x59ff6a=_0x13a4b9[_0x3426('0x36')](function(_0x2d3088){return{'membername':_0x22343b[_0x3426('0x39')],'UserId':_0x22343b['id'],'queue_name':_0x2d3088[_0x3426('0x39')],'VoiceQueueId':_0x2d3088['id'],'interface':_0x58665f,'paused':_0x22343b['loginInPause']||![],'penalty':_0x2d3088['UserVoiceQueue.penalty']||0x0};});return db['UserVoiceQueueRt']['bulkCreate'](_0x59ff6a);}}}})[_0x3426('0x29')](function(){if(_0x22343b){return db['MemberReport'][_0x3426('0xac')]({'where':{'membername':_0x22343b['name'],'exitAt':null}});}})['then'](function(_0x44fbca){if(_0x22343b){var _0x4f3fe2=[];_0x44fbca[_0x3426('0xfa')](function(_0xd26b0e){_0x4f3fe2['push'](_0xd26b0e['update']({'exitAt':moment()[_0x3426('0xca')](_0x3426('0xfb'))}));});return Promise['all'](_0x4f3fe2);}})[_0x3426('0x29')](function(){if(_0x22343b){var _0x826607=[];var _0xa4c7d9=[];var _0x3ce65b=utils['getChannels']();var _0x10801a={'membername':_0x22343b[_0x3426('0x39')],'interface':_0x58665f,'enterAt':moment()[_0x3426('0xca')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x22343b[_0x3426('0x2a')],'internal':_0x22343b[_0x3426('0x69')]};_0x3ce65b['forEach'](function(_0x1b8aae){_0x826607['push'](_[_0x3426('0x5d')]({'channel':_0x1b8aae,'type':_0x3426('0xfc'),'data1':_0x32af1c['body'][_0x3426('0xfd')],'data2':_0x58665f},_0x10801a));if(_0x22343b['loginInPause']){_0xa4c7d9[_0x3426('0x50')](_[_0x3426('0x5d')]({'channel':_0x1b8aae,'type':_0x3426('0xfe'),'data1':'LOGININPAUSE'},_0x10801a));}});return db[_0x3426('0xff')][_0x3426('0x8c')](_0x826607[_0x3426('0x100')](_0xa4c7d9),{'individualHooks':!![]});}})[_0x3426('0x29')](function(){if(_0x22343b){return _0x22343b[_0x3426('0x28')]({'online':!![],'lastLoginAt':moment()[_0x3426('0xca')](_0x3426('0xfb')),'voicePause':_0x22343b[_0x3426('0xa2')]||![],'mailPause':_0x22343b[_0x3426('0xa2')]||![],'chatPause':_0x22343b['loginInPause']||![],'faxPause':_0x22343b[_0x3426('0xa2')]||![],'smsPause':_0x22343b[_0x3426('0xa2')]||![],'openchannelPause':_0x22343b[_0x3426('0xa2')]||![],'whatsappPause':_0x22343b[_0x3426('0xa2')]||![],'pauseType':_0x22343b[_0x3426('0xa2')]?_0x3426('0x101'):null,'interface':_0x58665f,'lastPauseAt':moment()[_0x3426('0xca')](_0x3426('0xfb'))});}})['then'](function(_0x455c67){if(_0x32af1c[_0x3426('0x102')]){return _0x2ac2fd();}else{return Promise[_0x3426('0x103')](_0x455c67)[_0x3426('0x29')](respondWithResult(_0x407c9c,null));}})[_0x3426('0x5c')](handleError(_0x407c9c,null));};exports['logout']=function(_0x47be9c,_0x4d1cd6){var _0x2cfaf7;return db['User'][_0x3426('0x38')]({'where':{'id':_0x47be9c[_0x3426('0x62')]['id'],'role':_0x3426('0x31')},'attributes':['id',_0x3426('0x39'),'role']})['then'](handleEntityNotFound(_0x4d1cd6,null))[_0x3426('0x29')](function(_0x20997c){if(_0x20997c){_0x2cfaf7=_0x20997c;return db[_0x3426('0xb0')][_0x3426('0x3b')]({'where':{'membername':_0x2cfaf7['name']},'individualHooks':!![]});}})[_0x3426('0x29')](function(){return db[_0x3426('0xff')][_0x3426('0xac')]({'where':{'membername':_0x2cfaf7[_0x3426('0x39')],'exitAt':null}});})[_0x3426('0x29')](function(_0x34d6c3){var _0x146f75=[];_0x34d6c3[_0x3426('0xfa')](function(_0x1701c7){_0x146f75[_0x3426('0x50')](_0x1701c7['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x3426('0x5b')](_0x146f75);})[_0x3426('0x29')](function(){return _0x2cfaf7[_0x3426('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3426('0x29')](respondWithResult(_0x4d1cd6,null))[_0x3426('0x5c')](handleError(_0x4d1cd6,null));};exports[_0x3426('0x104')]=function(_0x3688d8,_0x8300c2){var _0x486b73;return db[_0x3426('0xb0')][_0x3426('0x28')]({'paused':0x1},{'where':{'UserId':_0x3688d8[_0x3426('0x62')]['id']},'individualHooks':!![]})[_0x3426('0x29')](function(){return db[_0x3426('0x3e')]['find']({'where':{'id':_0x3688d8[_0x3426('0x62')]['id'],'role':_0x3426('0x31')},'attributes':['id',_0x3426('0x39'),'role',_0x3426('0x69'),_0x3426('0xae'),_0x3426('0xa1')]});})[_0x3426('0x29')](handleEntityNotFound(_0x8300c2,null))[_0x3426('0x29')](function(_0x525f23){if(_0x525f23){_0x486b73=_0x525f23;return respondWithRpcPromise(_0x3426('0x105'),_0x3426('0x104'),{'id':_0x486b73['id'],'name':_0x486b73[_0x3426('0x39')],'pause':!![]});}})[_0x3426('0x29')](function(){if(_0x486b73){return db[_0x3426('0xff')]['findAll']({'where':{'membername':_0x486b73[_0x3426('0x39')],'type':_0x3426('0xfe'),'exitAt':null}});}})[_0x3426('0x29')](function(_0x562fd6){if(_0x562fd6[_0x3426('0x6f')]){var _0x3f26c2=moment()[_0x3426('0xca')](_0x3426('0xfb'));for(var _0x2dd4b7=0x0,_0x394a93=_0x562fd6[_0x3426('0x6f')];_0x2dd4b7<_0x394a93;_0x2dd4b7++){_0x562fd6[_0x2dd4b7][_0x3426('0x106')]({'exitAt':_0x3f26c2});}}})['then'](function(){var _0x502d67=[];var _0x82f91a=utils[_0x3426('0x107')]();_0x82f91a[_0x3426('0xfa')](function(_0x413e4c){_0x502d67[_0x3426('0x50')]({'channel':_0x413e4c,'membername':_0x486b73[_0x3426('0x39')],'interface':_[_0x3426('0x6b')](_0x486b73[_0x3426('0xae')])?util[_0x3426('0xca')](_0x3426('0xad'),_0x486b73[_0x3426('0x39')]):_0x486b73[_0x3426('0xae')],'type':_0x3426('0xfe'),'enterAt':moment()[_0x3426('0xca')](_0x3426('0xfb')),'data1':_0x3688d8[_0x3426('0x5f')]['type']||'DEFAULT\x20PAUSE','role':_0x486b73[_0x3426('0x2a')],'internal':_0x486b73['internal']});});return db[_0x3426('0xff')][_0x3426('0x8c')](_0x502d67,{'individualHooks':!![]});})[_0x3426('0x29')](function(){return _0x486b73[_0x3426('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3688d8['body']['type']||_0x3426('0x108'),'lastPauseAt':moment()[_0x3426('0xca')](_0x3426('0xfb'))});})['then'](respondWithResult(_0x8300c2,null))['catch'](handleError(_0x8300c2,null));};exports[_0x3426('0x109')]=function(_0xe1f749,_0x228f3d){if(_0xe1f749[_0x3426('0x5f')][_0x3426('0xa0')]&&!utils[_0x3426('0xa4')](_0xe1f749['body'][_0x3426('0xa0')])){throw new APIBadRequestError(util['format'](_0x3426('0x10a'),_0xe1f749[_0x3426('0x5f')]['channel']));}return db['User'][_0x3426('0x38')]({'where':{'id':_0xe1f749[_0x3426('0x62')]['id']},'attributes':['id',_0x3426('0x39'),_0x3426('0x2a'),'internal','interface',_0x3426('0xa1'),_0x3426('0xa3'),_0x3426('0x10b'),_0x3426('0x10c'),_0x3426('0x10d'),_0x3426('0x10e'),'smsPause',_0x3426('0x10f'),'pauseType',_0x3426('0x110')]})['then'](function(_0xe8b5ac){if(!_0xe8b5ac){throw new APINotFoundError(util[_0x3426('0xca')]('User\x20with\x20id\x20%s\x20not\x20found',_0xe1f749['params']['id']));}return _0xe8b5ac['unpause'](_0xe1f749['body'][_0x3426('0xa0')]);})[_0x3426('0x29')](respondWithResult(_0x228f3d,null))[_0x3426('0x5c')](APIHandleError(_0x228f3d));};exports['getTeams']=function(_0xcd94bb,_0x4075d4){var _0x4e4c5b={};var _0x447cfc={};var _0x6f366f;var _0x68cf13;return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0xcd94bb['params']['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x4075d4,null))[_0x3426('0x29')](function(_0x41410f){if(_0x41410f){_0x6f366f=_0x41410f;_0x447cfc[_0x3426('0xd5')]=_[_0x3426('0xd2')](db[_0x3426('0x111')][_0x3426('0x3f')]);_0x447cfc[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0xcd94bb[_0x3426('0x4a')]);_0x447cfc['filters']=_[_0x3426('0xd4')](_0x447cfc[_0x3426('0xd5')],_0x447cfc['query']);_0x4e4c5b[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x447cfc[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0xcd94bb['query']['fields']));_0x4e4c5b[_0x3426('0x4f')]=_0x4e4c5b[_0x3426('0x4f')][_0x3426('0x6f')]?_0x4e4c5b[_0x3426('0x4f')]:_0x447cfc[_0x3426('0xd5')];_0x4e4c5b[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0xcd94bb[_0x3426('0x4a')]['sort']);_0x4e4c5b[_0x3426('0x49')]=qs[_0x3426('0xd3')](_[_0x3426('0xd9')](_0xcd94bb['query'],_0x447cfc[_0x3426('0xd3')]));if(_0xcd94bb[_0x3426('0x4a')][_0x3426('0x34')]){_0x4e4c5b[_0x3426('0x49')]=_[_0x3426('0x5d')](_0x4e4c5b['where'],{'$or':_[_0x3426('0x36')](_0x4e4c5b['attributes'],function(_0x5a9689){var _0x4f2c2b={};_0x4f2c2b[_0x5a9689]={'$like':'%'+_0xcd94bb[_0x3426('0x4a')]['filter']+'%'};return _0x4f2c2b;})});}_0x4e4c5b=_[_0x3426('0x5d')]({},_0x4e4c5b,_0xcd94bb['options']);return _0x6f366f['getTeams'](_0x4e4c5b);}})[_0x3426('0x29')](function(_0x599a83){if(_0x599a83){_0x68cf13=_0x599a83[_0x3426('0x6f')];if(!_0xcd94bb[_0x3426('0x4a')]['hasOwnProperty']('nolimit')){_0x4e4c5b[_0x3426('0x1d')]=qs[_0x3426('0x1d')](_0xcd94bb[_0x3426('0x4a')]['limit']);_0x4e4c5b[_0x3426('0x1b')]=qs['offset'](_0xcd94bb['query'][_0x3426('0x1b')]);}return _0x6f366f['getTeams'](_0x4e4c5b);}})['then'](function(_0x16e04f){if(_0x16e04f){return _0x16e04f?{'count':_0x68cf13,'rows':_0x16e04f}:null;}})[_0x3426('0x29')](respondWithResult(_0x4075d4,null))[_0x3426('0x5c')](handleError(_0x4075d4,null));};exports['addTeams']=function(_0xc4a32,_0x18f698){var _0x94d575=_0xc4a32[_0x3426('0x62')]['id'];var _0x1f85ba=_0xc4a32['body']?_0xc4a32['body']['ids']:null;var _0x2c59b7=[];return Promise[_0x3426('0x103')]()['then'](function(){if(!_0x1f85ba)throw new APIBadRequestError(_0x3426('0x112'));})[_0x3426('0x29')](function(){return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0x94d575}});})[_0x3426('0x29')](function(_0x15b355){if(!_0x15b355)throw new APINotFoundError(util[_0x3426('0xca')](_0x3426('0x113'),_0xc4a32[_0x3426('0x62')]['id']));return db['sequelize'][_0x3426('0xf7')](function(_0x204498){return _0x15b355['addTeams'](_0x1f85ba,{'transaction':_0x204498})['then'](function(){return db[_0x3426('0x111')][_0x3426('0xac')]({'where':{'id':{'$in':_0x1f85ba}}});})[_0x3426('0x29')](function(_0x408bff){var _0x4ba116=_[_0x3426('0x36')](_0x408bff,function(_0x18353d){return _0x18353d[_0x3426('0x114')]();});return Promise['all'](_0x4ba116);})['then'](function(_0x717fd){_0x2c59b7=_[_0x3426('0x115')](_0x717fd);var _0x330651=_[_0x3426('0x36')](_0x2c59b7,function(_0x2eb32b){return _0x2eb32b[_0x3426('0x116')](_0x15b355['id'],{'transaction':_0x204498});});return Promise[_0x3426('0x5b')](_0x330651);})['then'](function(){if(!_0x15b355[_0x3426('0xa1')])return;var _0x55459d=_[_0x3426('0x34')](_0x2c59b7,function(_0x20fb02){return _0x20fb02[_0x3426('0x117')](_0x3426('0xa0'))===_0x3426('0x118');});var _0x20a05b=_[_0x3426('0x36')](_0x55459d,function(_0x3517ea){return db[_0x3426('0xb0')][_0x3426('0xb1')]({'membername':_0x15b355['name'],'UserId':_0x15b355['id'],'queue_name':_0x3517ea[_0x3426('0x39')],'VoiceQueueId':_0x3517ea['id'],'interface':_[_0x3426('0x6b')](_0x15b355[_0x3426('0xae')])?util[_0x3426('0xca')]('SIP/%s',_0x15b355['name']):_0x15b355[_0x3426('0xae')],'paused':_0x15b355['voicePause']||![],'penalty':_0x15b355[_0x3426('0xaf')]},{'transaction':_0x204498});});return Promise[_0x3426('0x5b')](_0x20a05b);})[_0x3426('0x29')](function(){return db[_0x3426('0x119')][_0x3426('0xac')]({'where':{'teamId':{'$in':_0x1f85ba}}});})[_0x3426('0x29')](function(_0x236192){var _0x494e4f=_[_0x3426('0x36')](_0x236192,function(_0x10ba72){return db['UserVoicePrefix']['create']({'UserId':_0x15b355['id'],'VoicePrefixId':_0x10ba72['VoicePrefixId']},{'transaction':_0x204498});});return Promise[_0x3426('0x5b')](_0x494e4f);});});})['then'](function(){for(var _0x496f78=0x0;_0x496f78<_0x2c59b7['length'];_0x496f78++){var _0x2cb332=_0x2c59b7[_0x496f78][_0x3426('0x117')]('channel');var _0x415886=_0x2cb332+_0x3426('0xa9');socket['emit']('user'+_0x2cb332+_0x3426('0x11a'),{'UserId':_0x94d575,['queueField']:_0x2c59b7[_0x496f78]['id']});}})[_0x3426('0x29')](respondWithStatusCode(_0x18f698,null))[_0x3426('0x5c')](APIHandleError(_0x18f698));};exports[_0x3426('0x11b')]=function(_0x53243e,_0x33535a){var _0x3415df=_0x53243e[_0x3426('0x62')]['id'];var _0x41bcb7=null;if(_0x53243e[_0x3426('0x4a')]['ids']){_0x41bcb7=_[_0x3426('0x11c')](_0x53243e[_0x3426('0x4a')][_0x3426('0x63')])?_0x53243e[_0x3426('0x4a')][_0x3426('0x63')]:[_0x53243e[_0x3426('0x4a')][_0x3426('0x63')]];}var _0x42cc4e=[];return Promise[_0x3426('0x103')]()[_0x3426('0x29')](function(){if(!_0x41bcb7)throw new APIBadRequestError(_0x3426('0x11d'));})['then'](function(){return db[_0x3426('0x3e')][_0x3426('0x9b')]({'where':{'id':_0x3415df}});})[_0x3426('0x29')](function(_0x5573a4){if(!_0x5573a4)throw new APINotFoundError(util[_0x3426('0xca')](_0x3426('0x113'),_0x53243e[_0x3426('0x62')]['id']));return db[_0x3426('0x6c')][_0x3426('0xf7')](function(_0x5c9223){return _0x5573a4['removeTeams'](_0x41bcb7,{'transaction':_0x5c9223})[_0x3426('0x29')](function(){return db[_0x3426('0x111')]['findAll']({'where':{'id':{'$in':_0x41bcb7}}});})['then'](function(_0x638737){var _0x46ff79=_[_0x3426('0x36')](_0x638737,function(_0x30f041){return _0x30f041[_0x3426('0x114')]();});return Promise[_0x3426('0x5b')](_0x46ff79);})[_0x3426('0x29')](function(_0x33e8ed){_0x42cc4e=_[_0x3426('0x115')](_0x33e8ed);var _0xd68165=_[_0x3426('0x36')](_0x42cc4e,function(_0x129a16){return _0x129a16[_0x3426('0x11e')](_0x5573a4['id'],{'transaction':_0x5c9223});});return Promise['all'](_0xd68165);})[_0x3426('0x29')](function(){if(!_0x5573a4['online'])return;var _0x1d38d3=_['filter'](_0x42cc4e,function(_0x59ae9d){return _0x59ae9d[_0x3426('0x117')]('channel')==='Voice';});var _0x4efb12=_['map'](_0x1d38d3,function(_0x51a38e){return db[_0x3426('0xb0')][_0x3426('0x3b')]({'where':{'VoiceQueueId':_0x51a38e['id'],'UserId':_0x5573a4['id']},'transaction':_0x5c9223});});return Promise[_0x3426('0x5b')](_0x4efb12);})[_0x3426('0x29')](function(){return db[_0x3426('0x119')][_0x3426('0xac')]({'where':{'teamId':{'$in':_0x41bcb7}}});})['then'](function(_0x2b6b28){var _0x3a21cc=_['map'](_0x2b6b28,function(_0x3bf5cb){return db[_0x3426('0x11f')][_0x3426('0x3b')]({'where':{'UserId':_0x5573a4['id'],'VoicePrefixId':_0x3bf5cb['VoicePrefixId']}},{'transaction':_0x5c9223});});return Promise[_0x3426('0x5b')](_0x3a21cc);});});})['then'](function(){for(var _0x265713=0x0;_0x265713<_0x42cc4e[_0x3426('0x6f')];_0x265713++){var _0x3c7aed=_0x42cc4e[_0x265713][_0x3426('0x117')](_0x3426('0xa0'));var _0x4e70fe=_0x3c7aed+'QueueId';socket['emit'](_0x3426('0x30')+_0x3c7aed+_0x3426('0xb3'),{'UserId':_0x3415df,['queueField']:_0x42cc4e[_0x265713]['id']});}})[_0x3426('0x29')](respondWithStatusCode(_0x33535a,null))[_0x3426('0x5c')](APIHandleError(_0x33535a));};exports[_0x3426('0x120')]=function(_0x3be80a,_0x3eae49){var _0x207ac7={};var _0x5ee553={};var _0x221e10;var _0x2d45d2;return db[_0x3426('0x3e')]['findOne']({'where':{'id':_0x3be80a['params']['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x3eae49,null))[_0x3426('0x29')](function(_0x5f40c0){if(_0x5f40c0){_0x221e10=_0x5f40c0;_0x5ee553[_0x3426('0xd5')]=_['keys'](db[_0x3426('0xcc')][_0x3426('0x3f')]);_0x5ee553[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0x3be80a[_0x3426('0x4a')]);_0x5ee553[_0x3426('0xd3')]=_['intersection'](_0x5ee553[_0x3426('0xd5')],_0x5ee553['query']);_0x207ac7[_0x3426('0x4f')]=_[_0x3426('0xd4')](_0x5ee553[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x3be80a[_0x3426('0x4a')][_0x3426('0xd6')]));_0x207ac7[_0x3426('0x4f')]=_0x207ac7[_0x3426('0x4f')][_0x3426('0x6f')]?_0x207ac7[_0x3426('0x4f')]:_0x5ee553[_0x3426('0xd5')];_0x207ac7['order']=qs[_0x3426('0xd8')](_0x3be80a[_0x3426('0x4a')][_0x3426('0xd8')]);_0x207ac7[_0x3426('0x49')]=qs['filters'](_[_0x3426('0xd9')](_0x3be80a[_0x3426('0x4a')],_0x5ee553[_0x3426('0xd3')]));if(_0x3be80a['query'][_0x3426('0x34')]){_0x207ac7['where']=_[_0x3426('0x5d')](_0x207ac7[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x207ac7[_0x3426('0x4f')],function(_0x58a118){var _0x3b1fb1={};_0x3b1fb1[_0x58a118]={'$like':'%'+_0x3be80a['query'][_0x3426('0x34')]+'%'};return _0x3b1fb1;})});}_0x207ac7=_[_0x3426('0x5d')]({},_0x207ac7,_0x3be80a[_0x3426('0x5e')]);return _0x221e10[_0x3426('0x120')](_0x207ac7);}})['then'](function(_0x3cac25){if(_0x3cac25){_0x2d45d2=_0x3cac25[_0x3426('0x6f')];if(!_0x3be80a['query'][_0x3426('0xcb')](_0x3426('0xdc'))){_0x207ac7[_0x3426('0x1d')]=qs[_0x3426('0x1d')](_0x3be80a['query'][_0x3426('0x1d')]);_0x207ac7[_0x3426('0x1b')]=qs[_0x3426('0x1b')](_0x3be80a[_0x3426('0x4a')]['offset']);}return _0x221e10['getLists'](_0x207ac7);}})[_0x3426('0x29')](function(_0x445969){if(_0x445969){return _0x445969?{'count':_0x2d45d2,'rows':_0x445969}:null;}})[_0x3426('0x29')](respondWithResult(_0x3eae49,null))[_0x3426('0x5c')](handleError(_0x3eae49,null));};exports[_0x3426('0x121')]=function(_0x4aa496,_0x1252ad){var _0x44a5af={};var _0x2c010f={};var _0x1f681e;return db['User'][_0x3426('0x9b')]({'where':{'id':_0x4aa496[_0x3426('0x62')]['id']}})[_0x3426('0x29')](handleEntityNotFound(_0x1252ad,null))[_0x3426('0x29')](function(_0x53f572){if(_0x53f572){_0x1f681e=_0x53f572;_0x2c010f[_0x3426('0xd5')]=_[_0x3426('0xd2')](db[_0x3426('0x3e')]['rawAttributes']);_0x2c010f[_0x3426('0x4a')]=_[_0x3426('0xd2')](_0x4aa496['query']);_0x2c010f[_0x3426('0xd3')]=_[_0x3426('0xd4')](_0x2c010f[_0x3426('0xd5')],_0x2c010f[_0x3426('0x4a')]);_0x44a5af[_0x3426('0x4f')]=_['intersection'](_0x2c010f[_0x3426('0xd5')],qs[_0x3426('0xd6')](_0x4aa496[_0x3426('0x4a')]['fields']));_0x44a5af[_0x3426('0x4f')]=_0x44a5af[_0x3426('0x4f')][_0x3426('0x6f')]?_0x44a5af[_0x3426('0x4f')]:_0x2c010f[_0x3426('0xd5')];_0x44a5af[_0x3426('0xd7')]=qs[_0x3426('0xd8')](_0x4aa496[_0x3426('0x4a')]['sort']);_0x44a5af[_0x3426('0x49')]=qs[_0x3426('0xd3')](_[_0x3426('0xd9')](_0x4aa496['query'],_0x2c010f[_0x3426('0xd3')]));if(_0x4aa496[_0x3426('0x4a')][_0x3426('0x34')]){_0x44a5af['where']=_['merge'](_0x44a5af[_0x3426('0x49')],{'$or':_[_0x3426('0x36')](_0x44a5af['attributes'],function(_0x5cf4e7){var _0x32dfdc={};_0x32dfdc[_0x5cf4e7]={'$like':'%'+_0x4aa496[_0x3426('0x4a')][_0x3426('0x34')]+'%'};return _0x32dfdc;})});}_0x44a5af[_0x3426('0xd5')]=db['User'];_0x44a5af['as']=_0x3426('0x89');_0x44a5af=_[_0x3426('0x5d')]({},_0x44a5af,_0x4aa496[_0x3426('0x5e')]);return _0x1f681e[_0x3426('0x122')]({'include':[_0x44a5af]});}})[_0x3426('0x29')](function(_0x3913c6){if(_0x3913c6){var _0x858a3b={},_0x252ec8=[];for(var _0x22ba83=0x0;_0x22ba83<_0x3913c6[_0x3426('0x6f')];_0x22ba83+=0x1){for(var _0x32c741=0x0,_0x2be152;_0x32c741<_0x3913c6[_0x22ba83]['Agents'][_0x3426('0x6f')];_0x32c741+=0x1){_0x2be152=_0x3913c6[_0x22ba83][_0x3426('0x89')][_0x32c741][_0x3426('0x2d')]({'plain':!![]});_0x858a3b[_0x2be152['id']]=_0x2be152;}}_0x858a3b=_[_0x3426('0x123')](_0x858a3b);for(var _0x3c8bc9=qs['offset'](_0x4aa496[_0x3426('0x4a')][_0x3426('0x1b')]);_0x3c8bc9<_0x858a3b[_0x3426('0x6f')]&&_0x252ec8[_0x3426('0x6f')]=_0x674bd8[_0x7dcd('0x4d')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x4b43fd){return db[_0x7dcd('0x26')][_0x7dcd('0x41')]({'where':{'membername':_0x4b43fd[_0x7dcd('0x20')]},'individualHooks':!![]});}})['then'](function(){if(_0x4b43fd){return _0x4b43fd[_0x7dcd('0x4e')]({'raw':!![]});}})[_0x7dcd('0x17')](function(_0x298049){if(_0x4b43fd){if(_0x298049){var _0x4d039d=[];_0x4abdc2=_0x298049;if(_0x4abdc2[_0x7dcd('0x2a')]){for(var _0x4fc6a0=0x0;_0x4fc6a0<_0x4abdc2['length'];_0x4fc6a0++){_0x4d039d[_0x7dcd('0x44')](db[_0x7dcd('0x26')][_0x7dcd('0x4f')]({'membername':_0x4b43fd[_0x7dcd('0x20')],'UserId':_0x4b43fd['id'],'queue_name':_0x4abdc2[_0x4fc6a0]['name'],'VoiceQueueId':_0x4abdc2[_0x4fc6a0]['id'],'interface':_0x1fd5d3,'paused':_0x4b43fd[_0x7dcd('0x4a')]||![],'penalty':_0x4abdc2[_0x4fc6a0][_0x7dcd('0x50')]||0x0}));}return BPromise['all'](_0x4d039d);}}}})[_0x7dcd('0x17')](function(){if(_0x4b43fd){return db[_0x7dcd('0x27')][_0x7dcd('0x42')]({'where':{'membername':_0x4b43fd[_0x7dcd('0x20')],'exitAt':null}});}})['then'](function(_0x49aecb){if(_0x4b43fd){if(_0x49aecb&&_0x49aecb[_0x7dcd('0x2a')]){var _0x3c630d=[];_0x49aecb['forEach'](function(_0x2d6984){_0x3c630d[_0x7dcd('0x44')](_0x2d6984['update']({'exitAt':moment()[_0x7dcd('0x23')](_0x7dcd('0x29'))}));});return BPromise['all'](_0x3c630d);}}})['then'](function(){if(_0x4b43fd){var _0x4f3774=[];var _0xa8023a=[];var _0x367755=utils[_0x7dcd('0x51')]();var _0x376d2e={'membername':_0x4b43fd[_0x7dcd('0x20')],'interface':_0x1fd5d3,'enterAt':moment()[_0x7dcd('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4b43fd[_0x7dcd('0x21')],'internal':_0x4b43fd[_0x7dcd('0x22')]};_0x367755[_0x7dcd('0x43')](function(_0x54b536){_0x4f3774['push'](_[_0x7dcd('0x52')]({'channel':_0x54b536,'type':_0x7dcd('0x53'),'data1':_0x7dcd('0x54'),'data2':_0x1fd5d3},_0x376d2e));if(_0x4b43fd['loginInPause']){_0xa8023a[_0x7dcd('0x44')](_[_0x7dcd('0x52')]({'channel':_0x54b536,'type':_0x7dcd('0x28'),'data1':'LOGININPAUSE'},_0x376d2e));}});return db['MemberReport'][_0x7dcd('0x32')](_0x4f3774[_0x7dcd('0x55')](_0xa8023a),{'individualHooks':!![]});}})[_0x7dcd('0x17')](function(){if(_0x4b43fd){return _0x4b43fd[_0x7dcd('0x45')]({'online':!![],'lastLoginAt':moment()[_0x7dcd('0x23')](_0x7dcd('0x29')),'voicePause':_0x4b43fd[_0x7dcd('0x4a')]||![],'mailPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'chatPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'faxPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'smsPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'openchannelPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'pauseType':_0x4b43fd[_0x7dcd('0x4a')]?_0x7dcd('0x56'):null,'lastPauseAt':moment()['format'](_0x7dcd('0x29')),'interface':_0x1fd5d3});}})['then'](function(_0x1a225c){_0x2590b0(_0x1a225c);})[_0x7dcd('0x1a')](function(_0x24c359){_0x591eaa(_0x3fb02a[_0x7dcd('0x1b')](0x1f4,_0x24c359[_0x7dcd('0x1c')]));});});}; \ No newline at end of file +var _0x33eb=['defaults','redis','localhost','./user.socket','register','User','findAll','options','where','limit','include','map','attributes','model','then','GetUser','debug','catch','error','message','find','raw','info','stringify','ShowUser','PauseUser','name','role','interface','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','UnpauseUser','resolve','isValidChannel','channel','online','voicePause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','system','findOne','forEach','all','LoginUser','mobile','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e7479,_0x5428c7){var _0x734446=function(_0x1ffaf5){while(--_0x1ffaf5){_0x1e7479['push'](_0x1e7479['shift']());}};_0x734446(++_0x5428c7);}(_0x33eb,0x15f));var _0xb33e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x33eb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb33e('0x0'));var util=require('util');var moment=require(_0xb33e('0x1'));var BPromise=require(_0xb33e('0x2'));var Redis=require(_0xb33e('0x3'));var db=require(_0xb33e('0x4'))['db'];var utils=require(_0xb33e('0x5'));var logger=require(_0xb33e('0x6'))(_0xb33e('0x7'));var config=require(_0xb33e('0x8'));config['redis']=_[_0xb33e('0x9')](config[_0xb33e('0xa')],{'host':_0xb33e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb33e('0xc'))[_0xb33e('0xd')](socket);exports['GetUser']=function(_0x366909){var _0x2b3b39=this;return new Promise(function(_0x503689,_0x3be1fd){return db[_0xb33e('0xe')][_0xb33e('0xf')]({'raw':_0x366909[_0xb33e('0x10')]?_0x366909[_0xb33e('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x366909[_0xb33e('0x10')]?_0x366909['options'][_0xb33e('0x11')]||null:null,'attributes':_0x366909['options']?_0x366909['options']['attributes']||null:null,'limit':_0x366909[_0xb33e('0x10')]?_0x366909[_0xb33e('0x10')][_0xb33e('0x12')]||null:null,'include':_0x366909[_0xb33e('0x10')]?_0x366909[_0xb33e('0x10')][_0xb33e('0x13')]?_[_0xb33e('0x14')](_0x366909[_0xb33e('0x10')][_0xb33e('0x13')],function(_0x5719f5){return{'model':db[_0x5719f5['model']],'as':_0x5719f5['as'],'attributes':_0x5719f5[_0xb33e('0x15')],'include':_0x5719f5[_0xb33e('0x13')]?_[_0xb33e('0x14')](_0x5719f5[_0xb33e('0x13')],function(_0x4f0ecd){return{'model':db[_0x4f0ecd[_0xb33e('0x16')]],'as':_0x4f0ecd['as'],'attributes':_0x4f0ecd[_0xb33e('0x15')],'include':_0x4f0ecd[_0xb33e('0x13')]?_[_0xb33e('0x14')](_0x4f0ecd['include'],function(_0x939320){return{'model':db[_0x939320[_0xb33e('0x16')]],'as':_0x939320['as'],'attributes':_0x939320[_0xb33e('0x15')]};}):[]};}):[]};}):[]:[]})[_0xb33e('0x17')](function(_0x2c2287){logger['info'](_0xb33e('0x18'),_0x366909);logger[_0xb33e('0x19')](_0xb33e('0x18'),_0x366909,JSON['stringify'](_0x2c2287));_0x503689(_0x2c2287);})[_0xb33e('0x1a')](function(_0x25443d){logger[_0xb33e('0x1b')]('GetUser',_0x25443d[_0xb33e('0x1c')],_0x366909);_0x3be1fd(_0x2b3b39[_0xb33e('0x1b')](0x1f4,_0x25443d[_0xb33e('0x1c')]));});});};exports['ShowUser']=function(_0x23d28a){var _0x306817=this;return new Promise(function(_0x4ea72c,_0x197cc5){return db[_0xb33e('0xe')][_0xb33e('0x1d')]({'raw':_0x23d28a['options']?_0x23d28a['options'][_0xb33e('0x1e')]===undefined?!![]:![]:!![],'where':_0x23d28a[_0xb33e('0x10')]?_0x23d28a[_0xb33e('0x10')][_0xb33e('0x11')]||null:null,'attributes':_0x23d28a['options']?_0x23d28a[_0xb33e('0x10')][_0xb33e('0x15')]||null:null,'include':_0x23d28a[_0xb33e('0x10')]?_0x23d28a['options'][_0xb33e('0x13')]?_[_0xb33e('0x14')](_0x23d28a['options'][_0xb33e('0x13')],function(_0x59ad14){return{'model':db[_0x59ad14[_0xb33e('0x16')]],'as':_0x59ad14['as'],'attributes':_0x59ad14[_0xb33e('0x15')],'include':_0x59ad14[_0xb33e('0x13')]?_['map'](_0x59ad14[_0xb33e('0x13')],function(_0x2f757d){return{'model':db[_0x2f757d['model']],'as':_0x2f757d['as'],'attributes':_0x2f757d['attributes'],'include':_0x2f757d['include']?_[_0xb33e('0x14')](_0x2f757d[_0xb33e('0x13')],function(_0x47fec6){return{'model':db[_0x47fec6[_0xb33e('0x16')]],'as':_0x47fec6['as'],'attributes':_0x47fec6[_0xb33e('0x15')]};}):[]};}):[]};}):[]:[]})[_0xb33e('0x17')](function(_0x2be5fe){logger[_0xb33e('0x1f')]('ShowUser',_0x23d28a);logger[_0xb33e('0x19')]('ShowUser',_0x23d28a,JSON[_0xb33e('0x20')](_0x2be5fe));_0x4ea72c(_0x2be5fe);})[_0xb33e('0x1a')](function(_0x53fc4f){logger[_0xb33e('0x1b')](_0xb33e('0x21'),_0x53fc4f[_0xb33e('0x1c')],_0x23d28a);_0x197cc5(_0x306817['error'](0x1f4,_0x53fc4f['message']));});});};exports[_0xb33e('0x22')]=function(_0x39ab1a){var _0x9dda0e;return db['User']['find']({'where':_0x39ab1a[_0xb33e('0x10')][_0xb33e('0x11')]||{},'attributes':['id',_0xb33e('0x23'),_0xb33e('0x24'),'internal',_0xb33e('0x25')]})['then'](function(_0x5b7e73){if(!_0x5b7e73){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x39ab1a[_0xb33e('0x26')]['id']));}_0x9dda0e=_0x5b7e73;return db[_0xb33e('0x27')][_0xb33e('0x28')]({'paused':0x1},{'where':{'UserId':_0x9dda0e['id']},'individualHooks':!![]});})['then'](function(){return db[_0xb33e('0x29')][_0xb33e('0xf')]({'where':{'membername':_0x9dda0e['name'],'type':_0xb33e('0x2a'),'exitAt':null}});})['then'](function(_0x1fa426){if(_0x1fa426&&_0x1fa426[_0xb33e('0x2b')]){var _0x411cff=moment()[_0xb33e('0x2c')](_0xb33e('0x2d'));for(var _0x38a05d=0x0,_0x286e67=_0x1fa426['length'];_0x38a05d<_0x286e67;_0x38a05d++){_0x1fa426[_0x38a05d]['updateAttributes']({'exitAt':_0x411cff});}}})[_0xb33e('0x17')](function(){var _0x1e6e2b=[];var _0xf52281=utils[_0xb33e('0x2e')]();_0xf52281['forEach'](function(_0x30ef0f){_0x1e6e2b[_0xb33e('0x2f')]({'channel':_0x30ef0f,'membername':_0x9dda0e[_0xb33e('0x23')],'interface':_[_0xb33e('0x30')](_0x9dda0e[_0xb33e('0x25')])?util[_0xb33e('0x2c')](_0xb33e('0x31'),_0x9dda0e['name']):_0x9dda0e['interface'],'type':'PAUSE','enterAt':moment()[_0xb33e('0x2c')](_0xb33e('0x2d')),'data1':_0x39ab1a[_0xb33e('0x32')][_0xb33e('0x33')]||_0xb33e('0x34'),'role':_0x9dda0e[_0xb33e('0x24')],'internal':_0x9dda0e[_0xb33e('0x35')],'uniqueid':_0x39ab1a[_0xb33e('0x32')][_0xb33e('0x36')]||null});});return db['MemberReport'][_0xb33e('0x37')](_0x1e6e2b,{'individualHooks':!![]});})[_0xb33e('0x17')](function(){return _0x9dda0e['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x39ab1a[_0xb33e('0x32')][_0xb33e('0x33')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xb33e('0x2c')](_0xb33e('0x2d'))});})[_0xb33e('0x1a')](function(_0x48683e){throw _0x48683e;});};exports[_0xb33e('0x38')]=function(_0x5c9c7c){return Promise[_0xb33e('0x39')]()['then'](function(){if(_0x5c9c7c[_0xb33e('0x32')]['channel']&&!utils[_0xb33e('0x3a')](_0x5c9c7c[_0xb33e('0x32')][_0xb33e('0x3b')])){throw new Error(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x5c9c7c['body']['channel']));}return db[_0xb33e('0xe')]['findOne']({'where':_0x5c9c7c[_0xb33e('0x10')]['where']||{},'attributes':['id',_0xb33e('0x23'),_0xb33e('0x24'),_0xb33e('0x35'),_0xb33e('0x25'),_0xb33e('0x3c'),_0xb33e('0x3d'),_0xb33e('0x3e'),'chatPause',_0xb33e('0x3f'),_0xb33e('0x40'),_0xb33e('0x41'),_0xb33e('0x42'),_0xb33e('0x43'),_0xb33e('0x44')]});})[_0xb33e('0x17')](function(_0x397af2){if(!_0x397af2){throw new Error(util[_0xb33e('0x2c')](_0xb33e('0x45'),_0x5c9c7c[_0xb33e('0x26')]['id']));}return _0x397af2['unpause'](_0x5c9c7c[_0xb33e('0x32')][_0xb33e('0x3b')],_0xb33e('0x46'));})[_0xb33e('0x1a')](function(_0x4ab1ef){throw _0x4ab1ef;});};exports['LogoutUser']=function(_0x3a6fc7){var _0x7f4568=this;return new Promise(function(_0x4a25ac,_0x5f2ae0){var _0x5a3f9a;return db[_0xb33e('0xe')][_0xb33e('0x47')]({'where':_0x3a6fc7[_0xb33e('0x10')]['where']||{},'attributes':['id',_0xb33e('0x23')]})[_0xb33e('0x17')](function(_0x18b764){if(_0x18b764){_0x5a3f9a=_0x18b764;return db[_0xb33e('0x27')]['destroy']({'where':{'membername':_0x5a3f9a[_0xb33e('0x23')]},'individualHooks':!![]});}})[_0xb33e('0x17')](function(){if(_0x5a3f9a){return db[_0xb33e('0x29')]['findAll']({'where':{'membername':_0x5a3f9a[_0xb33e('0x23')],'exitAt':null}});}})[_0xb33e('0x17')](function(_0x2f9dde){if(_0x5a3f9a){if(_0x2f9dde&&_0x2f9dde[_0xb33e('0x2b')]){var _0x29ae0f=[];_0x2f9dde[_0xb33e('0x48')](function(_0x1858c3){_0x29ae0f['push'](_0x1858c3['update']({'exitAt':moment()[_0xb33e('0x2c')](_0xb33e('0x2d'))}));});return BPromise[_0xb33e('0x49')](_0x29ae0f);}}})[_0xb33e('0x17')](function(){if(_0x5a3f9a){return _0x5a3f9a[_0xb33e('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xb33e('0x17')](function(_0x551b5b){_0x4a25ac(_0x551b5b);})[_0xb33e('0x1a')](function(_0x5f4a13){_0x5f2ae0(_0x7f4568['error'](0x1f4,_0x5f4a13[_0xb33e('0x1c')]));});});};exports[_0xb33e('0x4a')]=function(_0x15c85f){var _0x21892f=this;return new Promise(function(_0x471437,_0x14b5ec){var _0x5144e4;var _0x3fffeb;var _0x34f4a4;var _0x37f8ee;return db[_0xb33e('0xe')][_0xb33e('0x47')]({'where':_0x15c85f[_0xb33e('0x10')][_0xb33e('0x11')]||{},'attributes':['id',_0xb33e('0x23'),'role',_0xb33e('0x4b'),'phone',_0xb33e('0x35'),_0xb33e('0x4c'),_0xb33e('0x25')]})[_0xb33e('0x17')](function(_0x3f2da6){if(_0x3f2da6){_0x5144e4=_0x3f2da6;_0x37f8ee=_0x15c85f[_0xb33e('0x32')][_0xb33e('0x25')]?_0x15c85f[_0xb33e('0x32')][_0xb33e('0x25')]:util['format'](_0xb33e('0x31'),_0x5144e4[_0xb33e('0x23')]);return db['User']['count']({'where':{'role':_0xb33e('0x4d'),'online':!![],'id':{'$ne':_0x5144e4['id']}}});}})[_0xb33e('0x17')](function(_0x49902c){if(_0x49902c){_0x34f4a4=_0x49902c;return require(_0xb33e('0x4e'))[_0xb33e('0x4f')]();}})[_0xb33e('0x17')](function(_0x445a41){if(_0x445a41&&_0x445a41[_0xb33e('0x50')]&&_0x34f4a4>=_0x445a41['agents']){throw new Error(_0xb33e('0x51'));}})[_0xb33e('0x17')](function(){if(_0x5144e4){return db['UserVoiceQueueRt'][_0xb33e('0x52')]({'where':{'membername':_0x5144e4[_0xb33e('0x23')]},'individualHooks':!![]});}})['then'](function(){if(_0x5144e4){return _0x5144e4[_0xb33e('0x53')]({'raw':!![]});}})[_0xb33e('0x17')](function(_0x32333b){if(_0x5144e4){if(_0x32333b){var _0x4b18b1=[];_0x3fffeb=_0x32333b;if(_0x3fffeb[_0xb33e('0x2b')]){for(var _0x1e7808=0x0;_0x1e7808<_0x3fffeb[_0xb33e('0x2b')];_0x1e7808++){_0x4b18b1['push'](db[_0xb33e('0x27')][_0xb33e('0x54')]({'membername':_0x5144e4[_0xb33e('0x23')],'UserId':_0x5144e4['id'],'queue_name':_0x3fffeb[_0x1e7808][_0xb33e('0x23')],'VoiceQueueId':_0x3fffeb[_0x1e7808]['id'],'interface':_0x37f8ee,'paused':_0x5144e4['loginInPause']||![],'penalty':_0x3fffeb[_0x1e7808][_0xb33e('0x55')]||0x0}));}return BPromise['all'](_0x4b18b1);}}}})[_0xb33e('0x17')](function(){if(_0x5144e4){return db[_0xb33e('0x29')]['findAll']({'where':{'membername':_0x5144e4['name'],'exitAt':null}});}})[_0xb33e('0x17')](function(_0x1d3b8a){if(_0x5144e4){if(_0x1d3b8a&&_0x1d3b8a[_0xb33e('0x2b')]){var _0x44b058=[];_0x1d3b8a[_0xb33e('0x48')](function(_0x2eb315){_0x44b058[_0xb33e('0x2f')](_0x2eb315[_0xb33e('0x28')]({'exitAt':moment()[_0xb33e('0x2c')](_0xb33e('0x2d'))}));});return BPromise[_0xb33e('0x49')](_0x44b058);}}})[_0xb33e('0x17')](function(){if(_0x5144e4){var _0x1e6ca5=[];var _0x17cc75=[];var _0x29a565=utils['getChannels']();var _0x534738={'membername':_0x5144e4['name'],'interface':_0x37f8ee,'enterAt':moment()[_0xb33e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5144e4[_0xb33e('0x24')],'internal':_0x5144e4[_0xb33e('0x35')]};_0x29a565[_0xb33e('0x48')](function(_0x2c25cb){_0x1e6ca5['push'](_['merge']({'channel':_0x2c25cb,'type':_0xb33e('0x56'),'data1':_0xb33e('0x57'),'data2':_0x37f8ee},_0x534738));if(_0x5144e4[_0xb33e('0x4c')]){_0x17cc75['push'](_[_0xb33e('0x58')]({'channel':_0x2c25cb,'type':'PAUSE','data1':_0xb33e('0x59')},_0x534738));}});return db[_0xb33e('0x29')]['bulkCreate'](_0x1e6ca5['concat'](_0x17cc75),{'individualHooks':!![]});}})[_0xb33e('0x17')](function(){if(_0x5144e4){return _0x5144e4['update']({'online':!![],'lastLoginAt':moment()[_0xb33e('0x2c')](_0xb33e('0x2d')),'voicePause':_0x5144e4['loginInPause']||![],'mailPause':_0x5144e4['loginInPause']||![],'chatPause':_0x5144e4[_0xb33e('0x4c')]||![],'faxPause':_0x5144e4[_0xb33e('0x4c')]||![],'smsPause':_0x5144e4[_0xb33e('0x4c')]||![],'openchannelPause':_0x5144e4[_0xb33e('0x4c')]||![],'pauseType':_0x5144e4[_0xb33e('0x4c')]?_0xb33e('0x59'):null,'lastPauseAt':moment()[_0xb33e('0x2c')](_0xb33e('0x2d')),'interface':_0x37f8ee});}})[_0xb33e('0x17')](function(_0xce067f){_0x471437(_0xce067f);})[_0xb33e('0x1a')](function(_0x91d0b9){_0x14b5ec(_0x21892f[_0xb33e('0x1b')](0x1f4,_0x91d0b9[_0xb33e('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 6d73404..008d757 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 _0x3aea=['update','emit','removeListener','length','user:','./user.events','remove'];(function(_0x1f5020,_0x4f9a74){var _0x220169=function(_0x93e63e){while(--_0x93e63e){_0x1f5020['push'](_0x1f5020['shift']());}};_0x220169(++_0x4f9a74);}(_0x3aea,0x67));var _0xa3ae=function(_0x58e9ce,_0x3ca3da){_0x58e9ce=_0x58e9ce-0x0;var _0x1c6105=_0x3aea[_0x58e9ce];return _0x1c6105;};'use strict';var UserEvents=require(_0xa3ae('0x0'));var events=['save',_0xa3ae('0x1'),_0xa3ae('0x2')];function createListener(_0x219d4d,_0x4d3a50){return function(_0x3c6285){_0x4d3a50[_0xa3ae('0x3')](_0x219d4d,_0x3c6285);};}function removeListener(_0x258de0,_0x200841){return function(){UserEvents[_0xa3ae('0x4')](_0x258de0,_0x200841);};}exports['register']=function(_0x7bccce){for(var _0x4a818d=0x0,_0x2cbc55=events[_0xa3ae('0x5')];_0x4a818d<_0x2cbc55;_0x4a818d++){var _0x236716=events[_0x4a818d];var _0x375eab=createListener(_0xa3ae('0x6')+_0x236716,_0x7bccce);UserEvents['on'](_0x236716,_0x375eab);}}; \ No newline at end of file +var _0x0133=['register','./user.events','save','update','emit'];(function(_0x2b2664,_0x20d071){var _0x3e1b4b=function(_0x4a6b73){while(--_0x4a6b73){_0x2b2664['push'](_0x2b2664['shift']());}};_0x3e1b4b(++_0x20d071);}(_0x0133,0x196));var _0x3013=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0133[_0xefd519];return _0x4bb882;};'use strict';var UserEvents=require(_0x3013('0x0'));var events=[_0x3013('0x1'),'remove',_0x3013('0x2')];function createListener(_0x51cd2f,_0x381051){return function(_0x2648b5){_0x381051[_0x3013('0x3')](_0x51cd2f,_0x2648b5);};}function removeListener(_0x3e5000,_0x349064){return function(){UserEvents['removeListener'](_0x3e5000,_0x349064);};}exports[_0x3013('0x4')]=function(_0x45f123){for(var _0x3a60aa=0x0,_0x5a0747=events['length'];_0x3a60aa<_0x5a0747;_0x3a60aa++){var _0x4a7f09=events[_0x3a60aa];var _0x132199=createListener('user:'+_0x4a7f09,_0x45f123);UserEvents['on'](_0x4a7f09,_0x132199);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 4b1fbb7..56d6193 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(_0x39c152,_0x11d9e7){var _0x333916=function(_0x3bb012){while(--_0x3bb012){_0x39c152['push'](_0x39c152['shift']());}};_0x333916(++_0x11d9e7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x421963,_0x471881){var _0x366044=function(_0x1a508){while(--_0x1a508){_0x421963['push'](_0x421963['shift']());}};_0x366044(++_0x471881);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ce89e59..ea780f9 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 _0x1b6a=['exports','INTEGER','sequelize'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x1b6a,0xe3));var _0xa1b6=function(_0x4bab52,_0x299f01){_0x4bab52=_0x4bab52-0x0;var _0x4b6fff=_0x1b6a[_0x4bab52];return _0x4b6fff;};'use strict';var Sequelize=require(_0xa1b6('0x0'));module[_0xa1b6('0x1')]={'penalty':{'type':Sequelize[_0xa1b6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d9d=['exports','INTEGER','sequelize'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x5d9d,0x101));var _0xd5d9=function(_0x3b7f6b,_0x336c23){_0x3b7f6b=_0x3b7f6b-0x0;var _0xba458d=_0x5d9d[_0x3b7f6b];return _0xba458d;};'use strict';var Sequelize=require(_0xd5d9('0x0'));module[_0xd5d9('0x1')]={'penalty':{'type':Sequelize[_0xd5d9('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 a948652..5782223 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 _0xf857=['moment','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','lodash','util'];(function(_0x59a240,_0x4680d3){var _0x4eaec6=function(_0x409784){while(--_0x409784){_0x59a240['push'](_0x59a240['shift']());}};_0x4eaec6(++_0x4680d3);}(_0xf857,0x13e));var _0x7f85=function(_0x57afc1,_0x5051e6){_0x57afc1=_0x57afc1-0x0;var _0x7f1f47=_0xf857[_0x57afc1];return _0x7f1f47;};'use strict';var _=require(_0x7f85('0x0'));var util=require(_0x7f85('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f85('0x2'));var BPromise=require('bluebird');var rp=require(_0x7f85('0x3'));var fs=require('fs');var path=require(_0x7f85('0x4'));var rimraf=require(_0x7f85('0x5'));var config=require(_0x7f85('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x7f85('0x7')]=function(_0x2bde0f,_0x13c9a7){return _0x2bde0f[_0x7f85('0x8')](_0x7f85('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x726c=['UserChatQueue','user_has_chat_queues','lodash','../../config/logger','moment','bluebird','request-promise','./userChatQueue.attributes','exports','define'];(function(_0x2466a0,_0x3e9558){var _0xf8746=function(_0x34be8e){while(--_0x34be8e){_0x2466a0['push'](_0x2466a0['shift']());}};_0xf8746(++_0x3e9558);}(_0x726c,0x84));var _0xc726=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x726c[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xc726('0x0'));var util=require('util');var logger=require(_0xc726('0x1'))('api');var moment=require(_0xc726('0x2'));var BPromise=require(_0xc726('0x3'));var rp=require(_0xc726('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc726('0x5'));module[_0xc726('0x6')]=function(_0x4b5c62,_0x1f48b0){return _0x4b5c62[_0xc726('0x7')](_0xc726('0x8'),attributes,{'tableName':_0xc726('0x9'),'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 f57bacc..ee30caa 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 _0xad84=['http','request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xad84,0xf3));var _0x4ad8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xad84[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x4ad8('0x0'));var moment=require('moment');var BPromise=require(_0x4ad8('0x1'));var rs=require(_0x4ad8('0x2'));var fs=require('fs');var Redis=require(_0x4ad8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ad8('0x4'))(_0x4ad8('0x5'));var config=require(_0x4ad8('0x6'));var jayson=require(_0x4ad8('0x7'));var client=jayson[_0x4ad8('0x8')][_0x4ad8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11f817,_0x26a978,_0x5bb591){return new BPromise(function(_0x2e8abc,_0x2898e){return client[_0x4ad8('0xa')](_0x11f817,_0x5bb591)['then'](function(_0x42a1e1){logger[_0x4ad8('0xb')](_0x4ad8('0xc'),_0x26a978,'request\x20sent');logger[_0x4ad8('0xd')](_0x4ad8('0xe'),_0x26a978,_0x4ad8('0xf'),JSON['stringify'](_0x42a1e1));if(_0x42a1e1['error']){if(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x11')]===0x1f4){logger['error'](_0x4ad8('0xc'),_0x26a978,_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);return _0x2898e(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);}logger['error'](_0x4ad8('0xc'),_0x26a978,_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);return _0x2e8abc(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x26a978,_0x4ad8('0xf'));_0x2e8abc(_0x42a1e1[_0x4ad8('0x13')][_0x4ad8('0x12')]);}})[_0x4ad8('0x14')](function(_0x4fc99c){logger[_0x4ad8('0x10')](_0x4ad8('0xc'),_0x26a978,_0x4fc99c);_0x2898e(_0x4fc99c);});});} \ No newline at end of file +var _0x395c=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x395c,0x1b8));var _0xc395=function(_0x4d7997,_0x2ac638){_0x4d7997=_0x4d7997-0x0;var _0x3cfdeb=_0x395c[_0x4d7997];return _0x3cfdeb;};'use strict';var _=require(_0xc395('0x0'));var util=require('util');var moment=require(_0xc395('0x1'));var BPromise=require(_0xc395('0x2'));var rs=require(_0xc395('0x3'));var fs=require('fs');var Redis=require(_0xc395('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc395('0x5'))(_0xc395('0x6'));var config=require(_0xc395('0x7'));var jayson=require(_0xc395('0x8'));var client=jayson[_0xc395('0x9')][_0xc395('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x514d7e,_0xbc8b9,_0x3a6782){return new BPromise(function(_0x5a2d5b,_0x3fa30f){return client[_0xc395('0xb')](_0x514d7e,_0x3a6782)['then'](function(_0x2d8135){logger['info'](_0xc395('0xc'),_0xbc8b9,_0xc395('0xd'));logger[_0xc395('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xbc8b9,_0xc395('0xd'),JSON['stringify'](_0x2d8135));if(_0x2d8135[_0xc395('0xf')]){if(_0x2d8135[_0xc395('0xf')]['code']===0x1f4){logger[_0xc395('0xf')](_0xc395('0xc'),_0xbc8b9,_0x2d8135['error'][_0xc395('0x10')]);return _0x3fa30f(_0x2d8135[_0xc395('0xf')][_0xc395('0x10')]);}logger[_0xc395('0xf')](_0xc395('0xc'),_0xbc8b9,_0x2d8135['error'][_0xc395('0x10')]);return _0x5a2d5b(_0x2d8135[_0xc395('0xf')][_0xc395('0x10')]);}else{logger['info'](_0xc395('0xc'),_0xbc8b9,_0xc395('0xd'));_0x5a2d5b(_0x2d8135[_0xc395('0x11')]['message']);}})[_0xc395('0x12')](function(_0x3b6280){logger[_0xc395('0xf')](_0xc395('0xc'),_0xbc8b9,_0x3b6280);_0x3fa30f(_0x3b6280);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2229cc0..c024fad 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3cb4c7,_0x515bc8){var _0x268a4d=function(_0x25d06d){while(--_0x25d06d){_0x3cb4c7['push'](_0x3cb4c7['shift']());}};_0x268a4d(++_0x515bc8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3af7b7,_0x208014){var _0x8408b5=function(_0x22161d){while(--_0x22161d){_0x3af7b7['push'](_0x3af7b7['shift']());}};_0x8408b5(++_0x208014);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 0095ab0..6dfef2b 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 _0x6bac=['sequelize','exports','INTEGER','STRING'];(function(_0x2c3c79,_0x3f6a21){var _0xfdf9d=function(_0x5aa731){while(--_0x5aa731){_0x2c3c79['push'](_0x2c3c79['shift']());}};_0xfdf9d(++_0x3f6a21);}(_0x6bac,0xf4));var _0xc6ba=function(_0x4e787c,_0x1dd27f){_0x4e787c=_0x4e787c-0x0;var _0x5b864b=_0x6bac[_0x4e787c];return _0x5b864b;};'use strict';var Sequelize=require(_0xc6ba('0x0'));module[_0xc6ba('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc6ba('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc6ba('0x3')]}}; \ No newline at end of file +var _0x6e2e=['INTEGER','STRING','sequelize'];(function(_0x549d8f,_0x4ed8ba){var _0x271218=function(_0x288582){while(--_0x288582){_0x549d8f['push'](_0x549d8f['shift']());}};_0x271218(++_0x4ed8ba);}(_0x6e2e,0x161));var _0xe6e2=function(_0x47b0d9,_0x41b561){_0x47b0d9=_0x47b0d9-0x0;var _0x599df3=_0x6e2e[_0x47b0d9];return _0x599df3;};'use strict';var Sequelize=require(_0xe6e2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe6e2('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe6e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index aff37ea..44d4115 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 _0x29c0=['./userFaxQueue.attributes','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x139816,_0x19878e){var _0x5868ab=function(_0x2265b1){while(--_0x2265b1){_0x139816['push'](_0x139816['shift']());}};_0x5868ab(++_0x19878e);}(_0x29c0,0x1f1));var _0x029c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x29c0[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x029c('0x0'));var logger=require(_0x029c('0x1'))(_0x029c('0x2'));var moment=require(_0x029c('0x3'));var BPromise=require(_0x029c('0x4'));var rp=require(_0x029c('0x5'));var fs=require('fs');var path=require(_0x029c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x029c('0x7'));module[_0x029c('0x8')]=function(_0x37d707,_0x2bc4fa){return _0x37d707['define']('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb07c=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','../../config/environment'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0xb07c,0xaa));var _0xcb07=function(_0x5ed8f1,_0x5b3bd2){_0x5ed8f1=_0x5ed8f1-0x0;var _0x2a1509=_0xb07c[_0x5ed8f1];return _0x2a1509;};'use strict';var _=require(_0xcb07('0x0'));var util=require(_0xcb07('0x1'));var logger=require(_0xcb07('0x2'))(_0xcb07('0x3'));var moment=require(_0xcb07('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcb07('0x5'));var attributes=require(_0xcb07('0x6'));module[_0xcb07('0x7')]=function(_0x281873,_0x1b6f6b){return _0x281873[_0xcb07('0x8')](_0xcb07('0x9'),attributes,{'tableName':_0xcb07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index fec9053..e07f0ed 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 _0x81c7=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4ff3a1,_0x56b335){var _0x455216=function(_0x16ac05){while(--_0x16ac05){_0x4ff3a1['push'](_0x4ff3a1['shift']());}};_0x455216(++_0x56b335);}(_0x81c7,0x145));var _0x781c=function(_0x10a6ab,_0x4a1b22){_0x10a6ab=_0x10a6ab-0x0;var _0x2cf1c2=_0x81c7[_0x10a6ab];return _0x2cf1c2;};'use strict';var _=require('lodash');var util=require(_0x781c('0x0'));var moment=require(_0x781c('0x1'));var BPromise=require(_0x781c('0x2'));var rs=require(_0x781c('0x3'));var fs=require('fs');var Redis=require(_0x781c('0x4'));var db=require(_0x781c('0x5'))['db'];var utils=require(_0x781c('0x6'));var logger=require('../../config/logger')(_0x781c('0x7'));var config=require(_0x781c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x781c('0x9')][_0x781c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4553f1,_0x28d723,_0x2afbab){return new BPromise(function(_0x5e10ee,_0x2ec9f5){return client[_0x781c('0xb')](_0x4553f1,_0x2afbab)[_0x781c('0xc')](function(_0x5ce746){logger[_0x781c('0xd')](_0x781c('0xe'),_0x28d723,_0x781c('0xf'));logger[_0x781c('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x28d723,_0x781c('0xf'),JSON[_0x781c('0x11')](_0x5ce746));if(_0x5ce746[_0x781c('0x12')]){if(_0x5ce746[_0x781c('0x12')]['code']===0x1f4){logger[_0x781c('0x12')](_0x781c('0xe'),_0x28d723,_0x5ce746['error'][_0x781c('0x13')]);return _0x2ec9f5(_0x5ce746[_0x781c('0x12')][_0x781c('0x13')]);}logger[_0x781c('0x12')](_0x781c('0xe'),_0x28d723,_0x5ce746['error'][_0x781c('0x13')]);return _0x5e10ee(_0x5ce746[_0x781c('0x12')][_0x781c('0x13')]);}else{logger[_0x781c('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x28d723,_0x781c('0xf'));_0x5e10ee(_0x5ce746[_0x781c('0x14')][_0x781c('0x13')]);}})[_0x781c('0x15')](function(_0x319dc3){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x28d723,_0x319dc3);_0x2ec9f5(_0x319dc3);});});} \ No newline at end of file +var _0x6ffe=['then','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','../../config/utils','jayson/promise','client'];(function(_0x24fb91,_0x56b152){var _0x28a1f7=function(_0x5ccfaf){while(--_0x5ccfaf){_0x24fb91['push'](_0x24fb91['shift']());}};_0x28a1f7(++_0x56b152);}(_0x6ffe,0x71));var _0xe6ff=function(_0x24e747,_0x2d5368){_0x24e747=_0x24e747-0x0;var _0x2e2f66=_0x6ffe[_0x24e747];return _0x2e2f66;};'use strict';var _=require(_0xe6ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe6ff('0x1'));var rs=require(_0xe6ff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe6ff('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe6ff('0x4'));var client=jayson[_0xe6ff('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38afa9,_0xe53251,_0x46bc2f){return new BPromise(function(_0x1ae797,_0x382391){return client['request'](_0x38afa9,_0x46bc2f)[_0xe6ff('0x6')](function(_0x5a6b5e){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0xe53251,'request\x20sent');logger[_0xe6ff('0x7')](_0xe6ff('0x8'),_0xe53251,_0xe6ff('0x9'),JSON['stringify'](_0x5a6b5e));if(_0x5a6b5e[_0xe6ff('0xa')]){if(_0x5a6b5e[_0xe6ff('0xa')][_0xe6ff('0xb')]===0x1f4){logger['error'](_0xe6ff('0xc'),_0xe53251,_0x5a6b5e[_0xe6ff('0xa')][_0xe6ff('0xd')]);return _0x382391(_0x5a6b5e[_0xe6ff('0xa')][_0xe6ff('0xd')]);}logger[_0xe6ff('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0xe53251,_0x5a6b5e[_0xe6ff('0xa')][_0xe6ff('0xd')]);return _0x1ae797(_0x5a6b5e[_0xe6ff('0xa')][_0xe6ff('0xd')]);}else{logger[_0xe6ff('0xe')](_0xe6ff('0xc'),_0xe53251,_0xe6ff('0x9'));_0x1ae797(_0x5a6b5e[_0xe6ff('0xf')][_0xe6ff('0xd')]);}})[_0xe6ff('0x10')](function(_0x5cec12){logger[_0xe6ff('0xa')](_0xe6ff('0xc'),_0xe53251,_0x5cec12);_0x382391(_0x5cec12);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 368d4ea..ac6bd8d 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x470dad,_0x29f79d){var _0x1f9978=function(_0x2d8448){while(--_0x2d8448){_0x470dad['push'](_0x470dad['shift']());}};_0x1f9978(++_0x29f79d);}(_0xe706,0xa3));var _0x6e70=function(_0x2f8bc5,_0x12e3d1){_0x2f8bc5=_0x2f8bc5-0x0;var _0x2e4207=_0xe706[_0x2f8bc5];return _0x2e4207;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1d8652,_0x53fe18){var _0x6c8de=function(_0x461af5){while(--_0x461af5){_0x1d8652['push'](_0x1d8652['shift']());}};_0x6c8de(++_0x53fe18);}(_0x70e0,0x17b));var _0x070e=function(_0x505d2b,_0x4681e9){_0x505d2b=_0x505d2b-0x0;var _0x396531=_0x70e0[_0x505d2b];return _0x396531;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ce4dd3c..029d541 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 _0xa6a9=['exports','INTEGER','sequelize'];(function(_0x49372d,_0x21e0bf){var _0x4cccf9=function(_0x2084c0){while(--_0x2084c0){_0x49372d['push'](_0x49372d['shift']());}};_0x4cccf9(++_0x21e0bf);}(_0xa6a9,0x6e));var _0x9a6a=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0xa6a9[_0x1f4b18];return _0xde3957;};'use strict';var Sequelize=require(_0x9a6a('0x0'));module[_0x9a6a('0x1')]={'penalty':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd51a=['exports','INTEGER','sequelize'];(function(_0x584c9d,_0x54ea11){var _0x585946=function(_0x165ff6){while(--_0x165ff6){_0x584c9d['push'](_0x584c9d['shift']());}};_0x585946(++_0x54ea11);}(_0xd51a,0x1c1));var _0xad51=function(_0x31144c,_0x56fffd){_0x31144c=_0x31144c-0x0;var _0x3c22cb=_0xd51a[_0x31144c];return _0x3c22cb;};'use strict';var Sequelize=require(_0xad51('0x0'));module[_0xad51('0x1')]={'penalty':{'type':Sequelize[_0xad51('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 fd6926c..8bcc34a 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 _0x1cc6=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','lodash'];(function(_0x171a8a,_0x2c6407){var _0x178cbc=function(_0x17cec0){while(--_0x17cec0){_0x171a8a['push'](_0x171a8a['shift']());}};_0x178cbc(++_0x2c6407);}(_0x1cc6,0x16a));var _0x61cc=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x1cc6[_0x26fc81];return _0x9feece;};'use strict';var _=require(_0x61cc('0x0'));var util=require(_0x61cc('0x1'));var logger=require(_0x61cc('0x2'))('api');var moment=require(_0x61cc('0x3'));var BPromise=require('bluebird');var rp=require(_0x61cc('0x4'));var fs=require('fs');var path=require(_0x61cc('0x5'));var rimraf=require(_0x61cc('0x6'));var config=require(_0x61cc('0x7'));var attributes=require(_0x61cc('0x8'));module[_0x61cc('0x9')]=function(_0x3263eb,_0x4d0009){return _0x3263eb[_0x61cc('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a56=['define','UserMailQueue','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1a56,0x86));var _0x61a5=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x1a56[_0x507ac5];return _0x12c1bc;};'use strict';var _=require(_0x61a5('0x0'));var util=require(_0x61a5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x61a5('0x2'));var rp=require(_0x61a5('0x3'));var fs=require('fs');var path=require(_0x61a5('0x4'));var rimraf=require(_0x61a5('0x5'));var config=require(_0x61a5('0x6'));var attributes=require(_0x61a5('0x7'));module[_0x61a5('0x8')]=function(_0x3e42c3,_0x58ce86){return _0x3e42c3[_0x61a5('0x9')](_0x61a5('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index ab757c4..bd28956 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x7217,0x19e));var _0x7721=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7217[_0x49ca18];return _0x145d54;};'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')]('UserMailQueue,\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']('UserMailQueue,\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);});});} \ 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(_0x4b8a39,_0x8ad231){var _0x2e9884=function(_0x35f3a7){while(--_0x35f3a7){_0x4b8a39['push'](_0x4b8a39['shift']());}};_0x2e9884(++_0x8ad231);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x4b84[_0x1f44e4];return _0x591989;};'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 ea2b282..01f377a 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 _0xeb68=['sendUserNotification','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','isAuthenticated'];(function(_0x13480a,_0x223f00){var _0x547cc1=function(_0x304881){while(--_0x304881){_0x13480a['push'](_0x13480a['shift']());}};_0x547cc1(++_0x223f00);}(_0xeb68,0x12e));var _0x8eb6=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xeb68[_0x81f000];return _0x337aa2;};'use strict';var multer=require('multer');var util=require(_0x8eb6('0x0'));var path=require('path');var timeout=require(_0x8eb6('0x1'));var express=require(_0x8eb6('0x2'));var router=express[_0x8eb6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8eb6('0x4'));var interaction=require(_0x8eb6('0x5'));var config=require('../../config/environment');var controller=require(_0x8eb6('0x6'));router['post']('/',auth[_0x8eb6('0x7')](),controller[_0x8eb6('0x8')]);module[_0x8eb6('0x9')]=router; \ No newline at end of file +var _0x255c=['post','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x2cd932,_0x202ca2){var _0x25737a=function(_0x3b95c1){while(--_0x3b95c1){_0x2cd932['push'](_0x2cd932['shift']());}};_0x25737a(++_0x202ca2);}(_0x255c,0x129));var _0xc255=function(_0x57e98d,_0x5bb3ad){_0x57e98d=_0x57e98d-0x0;var _0x3086eb=_0x255c[_0x57e98d];return _0x3086eb;};'use strict';var multer=require(_0xc255('0x0'));var util=require(_0xc255('0x1'));var path=require(_0xc255('0x2'));var timeout=require(_0xc255('0x3'));var express=require(_0xc255('0x4'));var router=express[_0xc255('0x5')]();var fs_extra=require(_0xc255('0x6'));var auth=require(_0xc255('0x7'));var interaction=require(_0xc255('0x8'));var config=require(_0xc255('0x9'));var controller=require(_0xc255('0xa'));router[_0xc255('0xb')]('/',auth[_0xc255('0xc')](),controller['sendUserNotification']);module[_0xc255('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 98f85b5..a630050 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 _0x8c4b=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x428567,_0x4bb243){var _0x3841a2=function(_0x4e86d5){while(--_0x4e86d5){_0x428567['push'](_0x428567['shift']());}};_0x3841a2(++_0x4bb243);}(_0x8c4b,0xc8));var _0xb8c4=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x8c4b[_0x305486];return _0xa04940;};'use strict';var Sequelize=require(_0xb8c4('0x0'));module[_0xb8c4('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xb8c4('0x2')]},'recipientsId':{'type':Sequelize[_0xb8c4('0x3')]},'recipientsDescription':{'type':Sequelize[_0xb8c4('0x2')]},'beep':{'type':Sequelize[_0xb8c4('0x4')]}}; \ No newline at end of file +var _0xa38c=['sequelize','exports','STRING','TEXT'];(function(_0x304d06,_0x1c17ce){var _0x2084b1=function(_0x59bfd3){while(--_0x59bfd3){_0x304d06['push'](_0x304d06['shift']());}};_0x2084b1(++_0x1c17ce);}(_0xa38c,0xa8));var _0xca38=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xa38c[_0x176329];return _0x31997c;};'use strict';var Sequelize=require(_0xca38('0x0'));module[_0xca38('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xca38('0x2')]},'recipientsId':{'type':Sequelize[_0xca38('0x3')]},'recipientsDescription':{'type':Sequelize[_0xca38('0x2')]},'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 da41872..65563c8 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 _0x6b50=['error','stack','status','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','senderName','user','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','model','User','union','ids','includes','queue','replace','Queue','all','flatten','map','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x6b50,0x195));var _0x06b5=function(_0x423aeb,_0x4a57a6){_0x423aeb=_0x423aeb-0x0;var _0xf4da60=_0x6b50[_0x423aeb];return _0xf4da60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b5('0x1'));var rp=require(_0x06b5('0x2'));var moment=require('moment');var BPromise=require(_0x06b5('0x3'));var Mustache=require(_0x06b5('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x06b5('0x5'));var ejs=require(_0x06b5('0x6'));var fs=require('fs');var fs_extra=require(_0x06b5('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x06b5('0x8'));var jsforce=require(_0x06b5('0x9'));var deskjs=require(_0x06b5('0xa'));var toCsv=require(_0x06b5('0x5'));var querystring=require(_0x06b5('0xb'));var Papa=require('papaparse');var Redis=require(_0x06b5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x06b5('0xd'));var as=require(_0x06b5('0xe'));var hardwareService=require(_0x06b5('0xf'));var logger=require(_0x06b5('0x10'))(_0x06b5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x06b5('0x12'));var db=require('../../mysqldb')['db'];config[_0x06b5('0x13')]=_['defaults'](config[_0x06b5('0x13')],{'host':_0x06b5('0x14'),'port':0x18eb});var socket=require(_0x06b5('0x15'))(new Redis(config['redis']));require(_0x06b5('0x16'))[_0x06b5('0x17')](socket);function respondWithStatusCode(_0x17ef10,_0x280d83){_0x280d83=_0x280d83||0xcc;return function(_0xf7235a){if(_0xf7235a){return _0x17ef10[_0x06b5('0x18')](_0x280d83);}return _0x17ef10['status'](_0x280d83)['end']();};}function respondWithResult(_0x3ef208,_0x51c33d){_0x51c33d=_0x51c33d||0xc8;return function(_0x295c84){if(_0x295c84){return _0x3ef208['status'](_0x51c33d)['json'](_0x295c84);}};}function respondWithFilteredResult(_0x1e7868,_0x206f69){return function(_0x2786e0){if(_0x2786e0){var _0x55f8ea=typeof _0x206f69['offset']===_0x06b5('0x19')&&typeof _0x206f69[_0x06b5('0x1a')]==='undefined';var _0x4422fa=_0x2786e0[_0x06b5('0x1b')];var _0x180b04=_0x55f8ea?0x0:_0x206f69[_0x06b5('0x1c')];var _0x2c698a=_0x55f8ea?_0x2786e0['count']:_0x206f69['offset']+_0x206f69[_0x06b5('0x1a')];var _0x1ebb8a;if(_0x2c698a>=_0x4422fa){_0x2c698a=_0x4422fa;_0x1ebb8a=0xc8;}else{_0x1ebb8a=0xce;}_0x1e7868['status'](_0x1ebb8a);return _0x1e7868['set'](_0x06b5('0x1d'),_0x180b04+'-'+_0x2c698a+'/'+_0x4422fa)[_0x06b5('0x1e')](_0x2786e0);}return null;};}function patchUpdates(_0x158f3b){return function(_0xde09da){try{jsonpatch[_0x06b5('0x1f')](_0xde09da,_0x158f3b,!![]);}catch(_0x3a4cfa){return BPromise[_0x06b5('0x20')](_0x3a4cfa);}return _0xde09da['save']();};}function saveUpdates(_0x8e8d77,_0x5dcdcf){return function(_0xe33370){if(_0xe33370){return _0xe33370[_0x06b5('0x21')](_0x8e8d77)[_0x06b5('0x22')](function(_0x52d50a){return _0x52d50a;});}return null;};}function removeEntity(_0x7d12d3,_0x58f4b4){return function(_0x3f0f47){if(_0x3f0f47){return _0x3f0f47['destroy']()[_0x06b5('0x22')](function(){_0x7d12d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d247,_0x56e9d9){return function(_0x38f3be){if(!_0x38f3be){_0x48d247['sendStatus'](0x194);}return _0x38f3be;};}function handleError(_0x1c72de,_0x4fa26d){_0x4fa26d=_0x4fa26d||0x1f4;return function(_0x297363){logger[_0x06b5('0x23')](_0x297363[_0x06b5('0x24')]);if(_0x297363['name']){delete _0x297363['name'];}_0x1c72de[_0x06b5('0x25')](_0x4fa26d)[_0x06b5('0x26')](_0x297363);};}exports[_0x06b5('0x27')]=function(_0x4fbe91,_0x4ac379,_0x13c267){if(!_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x29')](_0x06b5('0x2a'))&&!_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x29')](_0x06b5('0x2b'))){throw new db[(_0x06b5('0x2c'))][(_0x06b5('0x2d'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x29')](_0x06b5('0x2b'))&&!_0x4fbe91[_0x06b5('0x28')]['hasOwnProperty'](_0x06b5('0x2e'))){throw new db['Sequelize'][(_0x06b5('0x2d'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x29')](_0x06b5('0x2f'))){throw new db[(_0x06b5('0x2c'))]['ValidationError'](_0x06b5('0x30'));}else{try{var _0xec3ed3=JSON[_0x06b5('0x31')](_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x2f')]);}catch(_0x16ba0f){logger[_0x06b5('0x23')](_0x16ba0f);throw new db['Sequelize'][(_0x06b5('0x2d'))](_0x06b5('0x32'));}var _0x41e224=[_0x06b5('0x33'),_0x06b5('0x34'),_0x06b5('0x35'),'openchannelqueue',_0x06b5('0x36'),_0x06b5('0x37'),_0x06b5('0x38'),_0x06b5('0x39'),'user'];if(_['some'](_0xec3ed3,function(_0x2fcd44){return!_['includes'](_0x41e224,_0x2fcd44['model']['toLowerCase']());})){throw new db['Sequelize']['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x41483c={};_0x41483c[_0x06b5('0x3a')]=_0x4fbe91[_0x06b5('0x28')]['hasOwnProperty'](_0x06b5('0x3a'))?_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x3a')]:_0x4fbe91[_0x06b5('0x3b')]['fullname'];_0x41483c['recipientsDescription']=_['isEmpty'](_0x4fbe91['body'][_0x06b5('0x3c')])?null:_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x3c')];_0x41483c[_0x06b5('0x3d')]=_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x3d')]||![];_0x41483c[_0x06b5('0x3e')]=_0x4fbe91[_0x06b5('0x3b')]['id'];return getContent(_0x4fbe91[_0x06b5('0x28')])['then'](function(_0x3f5570){_0x41483c[_0x06b5('0x28')]=_0x3f5570;return getRecipients(_0xec3ed3);})[_0x06b5('0x22')](function(_0x43bb6e){_0x41483c['recipientsId']=_[_0x06b5('0x3f')](_0x43bb6e)[_0x06b5('0x40')](',');return db[_0x06b5('0x41')][_0x06b5('0x42')](function(_0x3bf954){return db[_0x06b5('0x43')][_0x06b5('0x44')](_0x41483c,{'raw':!![],'transaction':_0x3bf954})['then'](function(_0x509d86){var _0x5755e7={'sender':_0x41483c[_0x06b5('0x3a')],'description':_0x41483c[_0x06b5('0x3c')],'content':_0x41483c[_0x06b5('0x28')],'beep':_0x41483c[_0x06b5('0x3d')]};_0x43bb6e[_0x06b5('0x45')](function(_0x2b6e49){_0x5755e7[_0x06b5('0x46')]=_0x2b6e49;socket['emit']('userNotification:send',_0x5755e7);});return _0x509d86;});});})[_0x06b5('0x22')](respondWithResult(_0x4ac379,0xc9))[_0x06b5('0x47')](handleError(_0x4ac379,null));};function getContent(_0x51cee9){return new BPromise(function(_0x11e98a,_0x32ef2d){if(_0x51cee9[_0x06b5('0x2a')]){_0x11e98a(_0x51cee9[_0x06b5('0x2a')]);return;}return db[_0x06b5('0x48')][_0x06b5('0x49')]({'attributes':[_0x06b5('0x4a')],'where':{'id':_0x51cee9[_0x06b5('0x2b')]},'raw':!![]})[_0x06b5('0x22')](function(_0x24b97c){if(!_0x24b97c)throw new db[(_0x06b5('0x2c'))][(_0x06b5('0x2d'))](_0x06b5('0x4b'));var _0x527c41=Mustache['render'](_0x24b97c[_0x06b5('0x4a')],_0x51cee9[_0x06b5('0x2e')]);_0x11e98a(_0x527c41);})['catch'](function(_0x248957){_0x32ef2d(_0x248957);});});}function getRecipients(_0x102b9e){return new BPromise(function(_0x2f8652,_0x1c1c31){var _0x36d652=[];var _0xecbbc8=[];_0x102b9e[_0x06b5('0x45')](function(_0x19dae3){var _0x4f09e7=_[_0x06b5('0x4c')](_0x19dae3[_0x06b5('0x4d')]['toLowerCase']());if(_0x4f09e7===_0x06b5('0x4e')){_0x36d652=_[_0x06b5('0x4f')](_0x36d652,_0x19dae3[_0x06b5('0x50')]);}else{if(_[_0x06b5('0x51')](_0x4f09e7,_0x06b5('0x52')))_0x4f09e7=_0x4f09e7[_0x06b5('0x53')](_0x06b5('0x52'),_0x06b5('0x54'));_0x19dae3[_0x06b5('0x50')][_0x06b5('0x45')](function(_0x5a06c1){_0xecbbc8['push'](getAgents(_0x4f09e7,_0x5a06c1));});}});return BPromise[_0x06b5('0x55')](_0xecbbc8)[_0x06b5('0x22')](function(_0x39d318){_0x36d652=_[_0x06b5('0x4f')](_0x36d652,_[_0x06b5('0x56')](_0x39d318));_0x2f8652(_0x36d652);})[_0x06b5('0x47')](function(_0x5da4bc){_0x1c1c31(_0x5da4bc);});});}function getAgents(_0x2694c8,_0x3a9387){return new BPromise(function(_0x59bc39,_0x2f5beb){return db[_0x2694c8][_0x06b5('0x49')]({'where':{'id':_0x3a9387}})[_0x06b5('0x22')](function(_0x20acc3){return _0x20acc3['getAgents']({'attributes':['id'],'raw':!![]})[_0x06b5('0x22')](function(_0x42e180){var _0x5eb85a=_[_0x06b5('0x57')](_0x42e180,'id');_0x59bc39(_0x5eb85a);});})[_0x06b5('0x47')](function(_0x8b2407){_0x2f5beb(_0x8b2407);});});} \ No newline at end of file +var _0x2a56=['count','set','apply','reject','save','update','then','destroy','error','stack','name','sendUserNotification','body','text','hasOwnProperty','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','smsqueue','voicequeue','some','includes','model','senderName','fullname','recipientsDescription','isEmpty','beep','user','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','catch','forEach','startCase','User','union','replace','queue','Queue','push','all','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit'];(function(_0x2fb874,_0x475cb1){var _0x4399f7=function(_0x341683){while(--_0x341683){_0x2fb874['push'](_0x2fb874['shift']());}};_0x4399f7(++_0x475cb1);}(_0x2a56,0x167));var _0x62a5=function(_0x5537cf,_0x4dccc6){_0x5537cf=_0x5537cf-0x0;var _0x8d238d=_0x2a56[_0x5537cf];return _0x8d238d;};'use strict';var emlformat=require(_0x62a5('0x0'));var rimraf=require(_0x62a5('0x1'));var zipdir=require(_0x62a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62a5('0x3'));var moment=require(_0x62a5('0x4'));var BPromise=require(_0x62a5('0x5'));var Mustache=require(_0x62a5('0x6'));var util=require(_0x62a5('0x7'));var path=require(_0x62a5('0x8'));var sox=require(_0x62a5('0x9'));var csv=require(_0x62a5('0xa'));var ejs=require(_0x62a5('0xb'));var fs=require('fs');var fs_extra=require(_0x62a5('0xc'));var _=require(_0x62a5('0xd'));var squel=require(_0x62a5('0xe'));var crypto=require(_0x62a5('0xf'));var jsforce=require(_0x62a5('0x10'));var deskjs=require(_0x62a5('0x11'));var toCsv=require('to-csv');var querystring=require(_0x62a5('0x12'));var Papa=require('papaparse');var Redis=require(_0x62a5('0x13'));var authService=require(_0x62a5('0x14'));var qs=require(_0x62a5('0x15'));var as=require(_0x62a5('0x16'));var hardwareService=require(_0x62a5('0x17'));var logger=require('../../config/logger')(_0x62a5('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62a5('0x19'));var db=require(_0x62a5('0x1a'))['db'];config[_0x62a5('0x1b')]=_[_0x62a5('0x1c')](config['redis'],{'host':_0x62a5('0x1d'),'port':0x18eb});var socket=require(_0x62a5('0x1e'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x49e14f,_0x34e853){_0x34e853=_0x34e853||0xcc;return function(_0x333abc){if(_0x333abc){return _0x49e14f[_0x62a5('0x1f')](_0x34e853);}return _0x49e14f[_0x62a5('0x20')](_0x34e853)[_0x62a5('0x21')]();};}function respondWithResult(_0x3da629,_0x2d9965){_0x2d9965=_0x2d9965||0xc8;return function(_0x339718){if(_0x339718){return _0x3da629[_0x62a5('0x20')](_0x2d9965)['json'](_0x339718);}};}function respondWithFilteredResult(_0x5900ca,_0x2c2ea4){return function(_0x9cc6b7){if(_0x9cc6b7){var _0x39217b=typeof _0x2c2ea4[_0x62a5('0x22')]===_0x62a5('0x23')&&typeof _0x2c2ea4[_0x62a5('0x24')]===_0x62a5('0x23');var _0x17c480=_0x9cc6b7[_0x62a5('0x25')];var _0xcebaaa=_0x39217b?0x0:_0x2c2ea4[_0x62a5('0x22')];var _0x3c2826=_0x39217b?_0x9cc6b7['count']:_0x2c2ea4[_0x62a5('0x22')]+_0x2c2ea4[_0x62a5('0x24')];var _0xc0d6b4;if(_0x3c2826>=_0x17c480){_0x3c2826=_0x17c480;_0xc0d6b4=0xc8;}else{_0xc0d6b4=0xce;}_0x5900ca[_0x62a5('0x20')](_0xc0d6b4);return _0x5900ca[_0x62a5('0x26')]('Content-Range',_0xcebaaa+'-'+_0x3c2826+'/'+_0x17c480)['json'](_0x9cc6b7);}return null;};}function patchUpdates(_0x5da216){return function(_0x72d463){try{jsonpatch[_0x62a5('0x27')](_0x72d463,_0x5da216,!![]);}catch(_0x2bce53){return BPromise[_0x62a5('0x28')](_0x2bce53);}return _0x72d463[_0x62a5('0x29')]();};}function saveUpdates(_0x1dab1c,_0x23f253){return function(_0x4860a7){if(_0x4860a7){return _0x4860a7[_0x62a5('0x2a')](_0x1dab1c)[_0x62a5('0x2b')](function(_0x25ef25){return _0x25ef25;});}return null;};}function removeEntity(_0x430246,_0x299e61){return function(_0x518c5e){if(_0x518c5e){return _0x518c5e[_0x62a5('0x2c')]()[_0x62a5('0x2b')](function(){_0x430246['status'](0xcc)[_0x62a5('0x21')]();});}};}function handleEntityNotFound(_0x21491d,_0x4b2339){return function(_0x1ba3e1){if(!_0x1ba3e1){_0x21491d['sendStatus'](0x194);}return _0x1ba3e1;};}function handleError(_0x574921,_0x318ed2){_0x318ed2=_0x318ed2||0x1f4;return function(_0x45fcb5){logger[_0x62a5('0x2d')](_0x45fcb5[_0x62a5('0x2e')]);if(_0x45fcb5['name']){delete _0x45fcb5[_0x62a5('0x2f')];}_0x574921[_0x62a5('0x20')](_0x318ed2)['send'](_0x45fcb5);};}exports[_0x62a5('0x30')]=function(_0x4d2e87,_0x5a098f,_0xf1ea69){if(!_0x4d2e87[_0x62a5('0x31')]['hasOwnProperty'](_0x62a5('0x32'))&&!_0x4d2e87[_0x62a5('0x31')][_0x62a5('0x33')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x62a5('0x34'));}else{if(_0x4d2e87[_0x62a5('0x31')][_0x62a5('0x33')](_0x62a5('0x35'))&&!_0x4d2e87[_0x62a5('0x31')][_0x62a5('0x33')](_0x62a5('0x36'))){throw new db[(_0x62a5('0x37'))][(_0x62a5('0x38'))](_0x62a5('0x39'));}if(!_0x4d2e87[_0x62a5('0x31')][_0x62a5('0x33')](_0x62a5('0x3a'))){throw new db[(_0x62a5('0x37'))][(_0x62a5('0x38'))](_0x62a5('0x3b'));}else{try{var _0x1db4ea=JSON[_0x62a5('0x3c')](_0x4d2e87[_0x62a5('0x31')][_0x62a5('0x3a')]);}catch(_0x58b4dd){logger[_0x62a5('0x2d')](_0x58b4dd);throw new db[(_0x62a5('0x37'))][(_0x62a5('0x38'))](_0x62a5('0x3d'));}var _0x3692e0=['chatqueue',_0x62a5('0x3e'),'mailqueue',_0x62a5('0x3f'),_0x62a5('0x40'),_0x62a5('0x41'),'whatsappqueue','team','user'];if(_[_0x62a5('0x42')](_0x1db4ea,function(_0x22d5a3){return!_[_0x62a5('0x43')](_0x3692e0,_0x22d5a3[_0x62a5('0x44')]['toLowerCase']());})){throw new db[(_0x62a5('0x37'))][(_0x62a5('0x38'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4ba3c2={};_0x4ba3c2[_0x62a5('0x45')]=_0x4d2e87['body'][_0x62a5('0x33')](_0x62a5('0x45'))?_0x4d2e87['body']['senderName']:_0x4d2e87['user'][_0x62a5('0x46')];_0x4ba3c2[_0x62a5('0x47')]=_[_0x62a5('0x48')](_0x4d2e87[_0x62a5('0x31')][_0x62a5('0x47')])?null:_0x4d2e87[_0x62a5('0x31')]['recipientsDescription'];_0x4ba3c2[_0x62a5('0x49')]=_0x4d2e87[_0x62a5('0x31')]['beep']||![];_0x4ba3c2['SenderId']=_0x4d2e87[_0x62a5('0x4a')]['id'];return getContent(_0x4d2e87[_0x62a5('0x31')])[_0x62a5('0x2b')](function(_0x571f0e){_0x4ba3c2['body']=_0x571f0e;return getRecipients(_0x1db4ea);})[_0x62a5('0x2b')](function(_0x19cd78){_0x4ba3c2[_0x62a5('0x4b')]=_[_0x62a5('0x4c')](_0x19cd78)[_0x62a5('0x4d')](',');return db[_0x62a5('0x4e')][_0x62a5('0x4f')](function(_0x2d4ee4){return db[_0x62a5('0x50')][_0x62a5('0x51')](_0x4ba3c2,{'raw':!![],'transaction':_0x2d4ee4})[_0x62a5('0x2b')](function(_0x5a9a8e){var _0x137a43={'sender':_0x4ba3c2[_0x62a5('0x45')],'description':_0x4ba3c2[_0x62a5('0x47')],'content':_0x4ba3c2['body'],'beep':_0x4ba3c2['beep']};_0x19cd78['forEach'](function(_0x17073f){_0x137a43[_0x62a5('0x52')]=_0x17073f;socket[_0x62a5('0x53')](_0x62a5('0x54'),_0x137a43);});return _0x5a9a8e;});});})[_0x62a5('0x2b')](respondWithResult(_0x5a098f,0xc9))['catch'](handleError(_0x5a098f,null));};function getContent(_0x1dfd90){return new BPromise(function(_0x2daf37,_0x155008){if(_0x1dfd90[_0x62a5('0x32')]){_0x2daf37(_0x1dfd90[_0x62a5('0x32')]);return;}return db['Template'][_0x62a5('0x55')]({'attributes':['html'],'where':{'id':_0x1dfd90['TemplateId']},'raw':!![]})[_0x62a5('0x2b')](function(_0x345c9a){if(!_0x345c9a)throw new db[(_0x62a5('0x37'))][(_0x62a5('0x38'))](_0x62a5('0x56'));var _0x121024=Mustache['render'](_0x345c9a[_0x62a5('0x57')],_0x1dfd90[_0x62a5('0x36')]);_0x2daf37(_0x121024);})[_0x62a5('0x58')](function(_0x74d09e){_0x155008(_0x74d09e);});});}function getRecipients(_0xdd4b8a){return new BPromise(function(_0x1cb534,_0x1a0965){var _0x535faa=[];var _0x3ebde9=[];_0xdd4b8a[_0x62a5('0x59')](function(_0x4bf155){var _0x44656d=_[_0x62a5('0x5a')](_0x4bf155[_0x62a5('0x44')]['toLowerCase']());if(_0x44656d===_0x62a5('0x5b')){_0x535faa=_[_0x62a5('0x5c')](_0x535faa,_0x4bf155['ids']);}else{if(_[_0x62a5('0x43')](_0x44656d,'queue'))_0x44656d=_0x44656d[_0x62a5('0x5d')](_0x62a5('0x5e'),_0x62a5('0x5f'));_0x4bf155['ids'][_0x62a5('0x59')](function(_0x46a50b){_0x3ebde9[_0x62a5('0x60')](getAgents(_0x44656d,_0x46a50b));});}});return BPromise[_0x62a5('0x61')](_0x3ebde9)[_0x62a5('0x2b')](function(_0x349abf){_0x535faa=_['union'](_0x535faa,_['flatten'](_0x349abf));_0x1cb534(_0x535faa);})[_0x62a5('0x58')](function(_0x5ed57c){_0x1a0965(_0x5ed57c);});});}function getAgents(_0x1b056c,_0x53b1d3){return new BPromise(function(_0x204bc2,_0x1eb8b6){return db[_0x1b056c]['findOne']({'where':{'id':_0x53b1d3}})[_0x62a5('0x2b')](function(_0x3112e1){return _0x3112e1[_0x62a5('0x62')]({'attributes':['id'],'raw':!![]})[_0x62a5('0x2b')](function(_0x58c944){var _0x693be9=_['map'](_0x58c944,'id');_0x204bc2(_0x693be9);});})[_0x62a5('0x58')](function(_0x302cad){_0x1eb8b6(_0x302cad);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 2a0910e..4bd68b9 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 _0xbf11=['emit','hook','exports','events','save','update','remove'];(function(_0x35dd3e,_0x100fd0){var _0x13e059=function(_0x159cb5){while(--_0x159cb5){_0x35dd3e['push'](_0x35dd3e['shift']());}};_0x13e059(++_0x100fd0);}(_0xbf11,0x1bc));var _0x1bf1=function(_0x559b69,_0x5b98bd){_0x559b69=_0x559b69-0x0;var _0x2ff0eb=_0xbf11[_0x559b69];return _0x2ff0eb;};'use strict';var EventEmitter=require(_0x1bf1('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1bf1('0x1'),'afterUpdate':_0x1bf1('0x2'),'afterDestroy':_0x1bf1('0x3')};function emitEvent(_0x2a1d3f){return function(_0x30624e,_0x5d0bdc,_0x5e8c5d){UserNotificationEvents[_0x1bf1('0x4')](_0x2a1d3f+':'+_0x30624e['id'],_0x30624e);UserNotificationEvents[_0x1bf1('0x4')](_0x2a1d3f,_0x30624e);_0x5e8c5d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x1bf1('0x5')](e,emitEvent(event));}}module[_0x1bf1('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xd719=['hasOwnProperty','hook','exports','events','setMaxListeners','remove'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xd719,0xab));var _0x9d71=function(_0x4ec32e,_0x280cb0){_0x4ec32e=_0x4ec32e-0x0;var _0x59a3f5=_0xd719[_0x4ec32e];return _0x59a3f5;};'use strict';var EventEmitter=require(_0x9d71('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9d71('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9d71('0x2')};function emitEvent(_0x1d29c5){return function(_0x40f89a,_0x53804d,_0x43801c){UserNotificationEvents['emit'](_0x1d29c5+':'+_0x40f89a['id'],_0x40f89a);UserNotificationEvents['emit'](_0x1d29c5,_0x40f89a);_0x43801c(null);};}for(var e in events){if(events[_0x9d71('0x3')](e)){var event=events[e];UserNotification[_0x9d71('0x4')](e,emitEvent(event));}}module[_0x9d71('0x5')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 7433146..35630ee 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 _0x419d=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications'];(function(_0xb9dda3,_0x4f52ca){var _0x1e61c9=function(_0x3d8e4b){while(--_0x3d8e4b){_0xb9dda3['push'](_0xb9dda3['shift']());}};_0x1e61c9(++_0x4f52ca);}(_0x419d,0x11f));var _0xd419=function(_0x3d961e,_0x291cc8){_0x3d961e=_0x3d961e-0x0;var _0x5da581=_0x419d[_0x3d961e];return _0x5da581;};'use strict';var _=require(_0xd419('0x0'));var util=require(_0xd419('0x1'));var logger=require(_0xd419('0x2'))(_0xd419('0x3'));var moment=require('moment');var BPromise=require(_0xd419('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd419('0x5'));var rimraf=require(_0xd419('0x6'));var config=require(_0xd419('0x7'));var attributes=require(_0xd419('0x8'));module['exports']=function(_0xd6071a,_0x271063){return _0xd6071a[_0xd419('0x9')](_0xd419('0xa'),attributes,{'tableName':_0xd419('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd419('0xc')});}; \ No newline at end of file +var _0x9931=['define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./userNotification.attributes'];(function(_0x6cbed8,_0x4168df){var _0x1a07c3=function(_0xaa8ffc){while(--_0xaa8ffc){_0x6cbed8['push'](_0x6cbed8['shift']());}};_0x1a07c3(++_0x4168df);}(_0x9931,0x116));var _0x1993=function(_0x7b0525,_0x2d543c){_0x7b0525=_0x7b0525-0x0;var _0x4aec09=_0x9931[_0x7b0525];return _0x4aec09;};'use strict';var _=require('lodash');var util=require(_0x1993('0x0'));var logger=require(_0x1993('0x1'))(_0x1993('0x2'));var moment=require(_0x1993('0x3'));var BPromise=require(_0x1993('0x4'));var rp=require(_0x1993('0x5'));var fs=require('fs');var path=require(_0x1993('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1993('0x7'));module['exports']=function(_0x5940ce,_0x432da3){return _0x5940ce[_0x1993('0x8')](_0x1993('0x9'),attributes,{'tableName':_0x1993('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1993('0xb'),'collate':_0x1993('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8dcf165..bceccc4 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 _0x0545=['info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5b5873,_0x8d227b){var _0x5b8b68=function(_0x5d2776){while(--_0x5d2776){_0x5b5873['push'](_0x5b5873['shift']());}};_0x5b8b68(++_0x8d227b);}(_0x0545,0x1ac));var _0x5054=function(_0x593add,_0x47069b){_0x593add=_0x593add-0x0;var _0x350ddd=_0x0545[_0x593add];return _0x350ddd;};'use strict';var _=require('lodash');var util=require(_0x5054('0x0'));var moment=require(_0x5054('0x1'));var BPromise=require(_0x5054('0x2'));var rs=require(_0x5054('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5054('0x4'))['db'];var utils=require(_0x5054('0x5'));var logger=require(_0x5054('0x6'))('rpc');var config=require(_0x5054('0x7'));var jayson=require(_0x5054('0x8'));var client=jayson['client'][_0x5054('0x9')]({'port':0x232a});config[_0x5054('0xa')]=_[_0x5054('0xb')](config[_0x5054('0xa')],{'host':_0x5054('0xc'),'port':0x18eb});var socket=require(_0x5054('0xd'))(new Redis(config['redis']));require(_0x5054('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b9c35,_0x8acb36,_0x3d221c){return new BPromise(function(_0x30fe37,_0x578f1c){return client[_0x5054('0xf')](_0x5b9c35,_0x3d221c)['then'](function(_0x5cb5f8){logger['info'](_0x5054('0x10'),_0x8acb36,_0x5054('0x11'));logger[_0x5054('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x8acb36,_0x5054('0x11'),JSON['stringify'](_0x5cb5f8));if(_0x5cb5f8[_0x5054('0x13')]){if(_0x5cb5f8[_0x5054('0x13')][_0x5054('0x14')]===0x1f4){logger['error'](_0x5054('0x10'),_0x8acb36,_0x5cb5f8[_0x5054('0x13')][_0x5054('0x15')]);return _0x578f1c(_0x5cb5f8[_0x5054('0x13')]['message']);}logger[_0x5054('0x13')](_0x5054('0x10'),_0x8acb36,_0x5cb5f8[_0x5054('0x13')][_0x5054('0x15')]);return _0x30fe37(_0x5cb5f8['error']['message']);}else{logger[_0x5054('0x16')](_0x5054('0x10'),_0x8acb36,_0x5054('0x11'));_0x30fe37(_0x5cb5f8[_0x5054('0x17')][_0x5054('0x15')]);}})[_0x5054('0x18')](function(_0x359864){logger[_0x5054('0x13')](_0x5054('0x10'),_0x8acb36,_0x359864);_0x578f1c(_0x359864);});});} \ No newline at end of file +var _0xd07e=['http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x3981da,_0x13d339){var _0x1b5abf=function(_0x394ed1){while(--_0x394ed1){_0x3981da['push'](_0x3981da['shift']());}};_0x1b5abf(++_0x13d339);}(_0xd07e,0xff));var _0xed07=function(_0xfc2877,_0x2eb326){_0xfc2877=_0xfc2877-0x0;var _0x30ac89=_0xd07e[_0xfc2877];return _0x30ac89;};'use strict';var _=require(_0xed07('0x0'));var util=require(_0xed07('0x1'));var moment=require(_0xed07('0x2'));var BPromise=require(_0xed07('0x3'));var rs=require(_0xed07('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed07('0x5'))['db'];var utils=require(_0xed07('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xed07('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed07('0x8')][_0xed07('0x9')]({'port':0x232a});config[_0xed07('0xa')]=_[_0xed07('0xb')](config['redis'],{'host':_0xed07('0xc'),'port':0x18eb});var socket=require(_0xed07('0xd'))(new Redis(config['redis']));require(_0xed07('0xe'))['register'](socket);function respondWithRpcPromise(_0x4222cf,_0xf3a4f4,_0x5b54bb){return new BPromise(function(_0x43cf7a,_0x51fdee){return client[_0xed07('0xf')](_0x4222cf,_0x5b54bb)['then'](function(_0x378774){logger[_0xed07('0x10')](_0xed07('0x11'),_0xf3a4f4,_0xed07('0x12'));logger['debug'](_0xed07('0x13'),_0xf3a4f4,'request\x20sent',JSON['stringify'](_0x378774));if(_0x378774[_0xed07('0x14')]){if(_0x378774['error']['code']===0x1f4){logger[_0xed07('0x14')]('UserNotification,\x20%s,\x20%s',_0xf3a4f4,_0x378774[_0xed07('0x14')][_0xed07('0x15')]);return _0x51fdee(_0x378774[_0xed07('0x14')][_0xed07('0x15')]);}logger[_0xed07('0x14')](_0xed07('0x11'),_0xf3a4f4,_0x378774[_0xed07('0x14')][_0xed07('0x15')]);return _0x43cf7a(_0x378774[_0xed07('0x14')][_0xed07('0x15')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0xf3a4f4,_0xed07('0x12'));_0x43cf7a(_0x378774[_0xed07('0x16')][_0xed07('0x15')]);}})[_0xed07('0x17')](function(_0x4b12ce){logger[_0xed07('0x14')](_0xed07('0x11'),_0xf3a4f4,_0x4b12ce);_0x51fdee(_0x4b12ce);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 8dc9645..88c8245 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 _0xce0d=['userNotification:','save','remove','emit','removeListener','register'];(function(_0x2aec18,_0x2d5d36){var _0x1df35e=function(_0x5969ca){while(--_0x5969ca){_0x2aec18['push'](_0x2aec18['shift']());}};_0x1df35e(++_0x2d5d36);}(_0xce0d,0x9d));var _0xdce0=function(_0x2e2292,_0x1891b8){_0x2e2292=_0x2e2292-0x0;var _0x4f77ab=_0xce0d[_0x2e2292];return _0x4f77ab;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xdce0('0x0'),_0xdce0('0x1'),'update'];function createListener(_0x3bebdf,_0x1f55e0){return function(_0x49d913){_0x1f55e0[_0xdce0('0x2')](_0x3bebdf,_0x49d913);};}function removeListener(_0x2a3188,_0x18ca5d){return function(){UserNotificationEvents[_0xdce0('0x3')](_0x2a3188,_0x18ca5d);};}exports[_0xdce0('0x4')]=function(_0xe82fcb){for(var _0x5ba04a=0x0,_0x7ca86c=events['length'];_0x5ba04a<_0x7ca86c;_0x5ba04a++){var _0x580e9e=events[_0x5ba04a];var _0x1b5ce4=createListener(_0xdce0('0x5')+_0x580e9e,_0xe82fcb);UserNotificationEvents['on'](_0x580e9e,_0x1b5ce4);}}; \ No newline at end of file +var _0x1738=['save','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x9e9e9a,_0x4d3b09){var _0x4cc7a4=function(_0x3b7e94){while(--_0x3b7e94){_0x9e9e9a['push'](_0x9e9e9a['shift']());}};_0x4cc7a4(++_0x4d3b09);}(_0x1738,0x68));var _0x8173=function(_0xbf07b8,_0x4fc2c6){_0xbf07b8=_0xbf07b8-0x0;var _0x17aef8=_0x1738[_0xbf07b8];return _0x17aef8;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x8173('0x0'),_0x8173('0x1'),_0x8173('0x2')];function createListener(_0x303c92,_0x7cef1d){return function(_0x382ace){_0x7cef1d[_0x8173('0x3')](_0x303c92,_0x382ace);};}function removeListener(_0x501200,_0x3c81ca){return function(){UserNotificationEvents[_0x8173('0x4')](_0x501200,_0x3c81ca);};}exports[_0x8173('0x5')]=function(_0x5b8916){for(var _0xd31f1b=0x0,_0x3b8ffd=events[_0x8173('0x6')];_0xd31f1b<_0x3b8ffd;_0xd31f1b++){var _0x1f81d6=events[_0xd31f1b];var _0x45bbfc=createListener(_0x8173('0x7')+_0x1f81d6,_0x5b8916);UserNotificationEvents['on'](_0x1f81d6,_0x45bbfc);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 81e8848..ac79bab 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3c4828,_0x546d02){var _0x5149c2=function(_0x2a827a){while(--_0x2a827a){_0x3c4828['push'](_0x3c4828['shift']());}};_0x5149c2(++_0x546d02);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'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(_0x350838,_0x31a19d){var _0x2ac006=function(_0x42189e){while(--_0x42189e){_0x350838['push'](_0x350838['shift']());}};_0x2ac006(++_0x31a19d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0xcb91[_0x10c51f];return _0x56a0cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index fe66d68..8ff5a4b 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 _0x4202=['sequelize','exports'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0x4202,0x8c));var _0x2420=function(_0x1ad0b4,_0x3638f4){_0x1ad0b4=_0x1ad0b4-0x0;var _0x42f563=_0x4202[_0x1ad0b4];return _0x42f563;};'use strict';var Sequelize=require(_0x2420('0x0'));module[_0x2420('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0c85=['exports','INTEGER','sequelize'];(function(_0x42276c,_0x141d47){var _0x1b5009=function(_0x23713f){while(--_0x23713f){_0x42276c['push'](_0x42276c['shift']());}};_0x1b5009(++_0x141d47);}(_0x0c85,0x14f));var _0x50c8=function(_0x3fdbd9,_0x3b55b3){_0x3fdbd9=_0x3fdbd9-0x0;var _0x41eab3=_0x0c85[_0x3fdbd9];return _0x41eab3;};'use strict';var Sequelize=require(_0x50c8('0x0'));module[_0x50c8('0x1')]={'penalty':{'type':Sequelize[_0x50c8('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 500826a..136d632 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 _0xb568=['UserOpenchannelQueue','util','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x511bfc,_0x5e9d4e){var _0x302fb0=function(_0x3fe4d2){while(--_0x3fe4d2){_0x511bfc['push'](_0x511bfc['shift']());}};_0x302fb0(++_0x5e9d4e);}(_0xb568,0x159));var _0x8b56=function(_0x5f0869,_0x2b643c){_0x5f0869=_0x5f0869-0x0;var _0x5c5ef2=_0xb568[_0x5f0869];return _0x5c5ef2;};'use strict';var _=require('lodash');var util=require(_0x8b56('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8b56('0x1'));var BPromise=require('bluebird');var rp=require(_0x8b56('0x2'));var fs=require('fs');var path=require(_0x8b56('0x3'));var rimraf=require(_0x8b56('0x4'));var config=require('../../config/environment');var attributes=require(_0x8b56('0x5'));module[_0x8b56('0x6')]=function(_0x16e289,_0x88494b){return _0x16e289['define'](_0x8b56('0x7'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6082=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6082,0x1a6));var _0x2608=function(_0x50afb6,_0x376f61){_0x50afb6=_0x50afb6-0x0;var _0x3d5bde=_0x6082[_0x50afb6];return _0x3d5bde;};'use strict';var _=require(_0x2608('0x0'));var util=require(_0x2608('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2608('0x2'));var BPromise=require(_0x2608('0x3'));var rp=require(_0x2608('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2608('0x5'));var config=require(_0x2608('0x6'));var attributes=require(_0x2608('0x7'));module[_0x2608('0x8')]=function(_0x12a13c,_0x25d5d5){return _0x12a13c['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 6a0712c..77739cb 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 _0xac5e=['request','UserOpenchannelQueue,\x20%s,\x20%s','debug','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac5e,0xed));var _0xeac5=function(_0x48c789,_0x4f0a4a){_0x48c789=_0x48c789-0x0;var _0x377a9c=_0xac5e[_0x48c789];return _0x377a9c;};'use strict';var _=require(_0xeac5('0x0'));var util=require(_0xeac5('0x1'));var moment=require('moment');var BPromise=require(_0xeac5('0x2'));var rs=require(_0xeac5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeac5('0x4'))['db'];var utils=require(_0xeac5('0x5'));var logger=require('../../config/logger')(_0xeac5('0x6'));var config=require(_0xeac5('0x7'));var jayson=require(_0xeac5('0x8'));var client=jayson[_0xeac5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37899c,_0xa7346d,_0x5be97a){return new BPromise(function(_0x140e71,_0x4fb3c5){return client[_0xeac5('0xa')](_0x37899c,_0x5be97a)['then'](function(_0x482382){logger['info'](_0xeac5('0xb'),_0xa7346d,'request\x20sent');logger[_0xeac5('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xa7346d,'request\x20sent',JSON['stringify'](_0x482382));if(_0x482382['error']){if(_0x482382['error'][_0xeac5('0xd')]===0x1f4){logger[_0xeac5('0xe')](_0xeac5('0xb'),_0xa7346d,_0x482382['error'][_0xeac5('0xf')]);return _0x4fb3c5(_0x482382[_0xeac5('0xe')][_0xeac5('0xf')]);}logger[_0xeac5('0xe')](_0xeac5('0xb'),_0xa7346d,_0x482382[_0xeac5('0xe')]['message']);return _0x140e71(_0x482382[_0xeac5('0xe')][_0xeac5('0xf')]);}else{logger[_0xeac5('0x10')](_0xeac5('0xb'),_0xa7346d,'request\x20sent');_0x140e71(_0x482382[_0xeac5('0x11')][_0xeac5('0xf')]);}})[_0xeac5('0x12')](function(_0x158a8a){logger['error'](_0xeac5('0xb'),_0xa7346d,_0x158a8a);_0x4fb3c5(_0x158a8a);});});} \ No newline at end of file +var _0x8476=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x3c39b4,_0x487800){var _0x19a0af=function(_0x22025f){while(--_0x22025f){_0x3c39b4['push'](_0x3c39b4['shift']());}};_0x19a0af(++_0x487800);}(_0x8476,0x178));var _0x6847=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x8476[_0x224f65];return _0x3f921c;};'use strict';var _=require(_0x6847('0x0'));var util=require(_0x6847('0x1'));var moment=require(_0x6847('0x2'));var BPromise=require(_0x6847('0x3'));var rs=require(_0x6847('0x4'));var fs=require('fs');var Redis=require(_0x6847('0x5'));var db=require(_0x6847('0x6'))['db'];var utils=require(_0x6847('0x7'));var logger=require(_0x6847('0x8'))(_0x6847('0x9'));var config=require(_0x6847('0xa'));var jayson=require(_0x6847('0xb'));var client=jayson[_0x6847('0xc')][_0x6847('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2eff92,_0x42274c,_0xe3a731){return new BPromise(function(_0x24957a,_0x3b83e4){return client['request'](_0x2eff92,_0xe3a731)[_0x6847('0xe')](function(_0x1cc40f){logger['info'](_0x6847('0xf'),_0x42274c,'request\x20sent');logger[_0x6847('0x10')](_0x6847('0x11'),_0x42274c,_0x6847('0x12'),JSON[_0x6847('0x13')](_0x1cc40f));if(_0x1cc40f['error']){if(_0x1cc40f[_0x6847('0x14')]['code']===0x1f4){logger[_0x6847('0x14')](_0x6847('0xf'),_0x42274c,_0x1cc40f[_0x6847('0x14')][_0x6847('0x15')]);return _0x3b83e4(_0x1cc40f[_0x6847('0x14')]['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x42274c,_0x1cc40f['error'][_0x6847('0x15')]);return _0x24957a(_0x1cc40f['error'][_0x6847('0x15')]);}else{logger[_0x6847('0x16')](_0x6847('0xf'),_0x42274c,_0x6847('0x12'));_0x24957a(_0x1cc40f[_0x6847('0x17')][_0x6847('0x15')]);}})[_0x6847('0x18')](function(_0x3f48e7){logger[_0x6847('0x14')](_0x6847('0xf'),_0x42274c,_0x3f48e7);_0x3b83e4(_0x3f48e7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b9f8d38..4bc51e5 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 _0xed8c=['describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe'];(function(_0x2b28a5,_0x2f3803){var _0x11a639=function(_0x456a57){while(--_0x456a57){_0x2b28a5['push'](_0x2b28a5['shift']());}};_0x11a639(++_0x2f3803);}(_0xed8c,0x64));var _0xced8=function(_0x3184c6,_0x397182){_0x3184c6=_0x3184c6-0x0;var _0x470f5b=_0xed8c[_0x3184c6];return _0x470f5b;};'use strict';var multer=require('multer');var util=require(_0xced8('0x0'));var path=require(_0xced8('0x1'));var timeout=require('connect-timeout');var express=require(_0xced8('0x2'));var router=express[_0xced8('0x3')]();var fs_extra=require(_0xced8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xced8('0x5'));var config=require(_0xced8('0x6'));var controller=require(_0xced8('0x7'));router[_0xced8('0x8')]('/',auth[_0xced8('0x9')](),controller[_0xced8('0xa')]);router[_0xced8('0x8')](_0xced8('0xb'),auth[_0xced8('0x9')](),controller[_0xced8('0xc')]);router[_0xced8('0x8')](_0xced8('0xd'),auth['isAuthenticated'](),controller[_0xced8('0xe')]);router[_0xced8('0x8')](_0xced8('0xf'),auth['isAuthenticated'](),controller[_0xced8('0x10')]);router['get'](_0xced8('0x11'),auth[_0xced8('0x9')](),controller[_0xced8('0x12')]);router[_0xced8('0x13')]('/',auth['isAuthenticated'](),controller[_0xced8('0x14')]);router[_0xced8('0x13')](_0xced8('0x15'),auth[_0xced8('0x9')](),controller['clone']);router['post'](_0xced8('0xf'),auth[_0xced8('0x9')](),controller[_0xced8('0x16')]);router['post']('/:id/resources',auth[_0xced8('0x9')](),controller[_0xced8('0x17')]);router[_0xced8('0x18')](_0xced8('0xd'),auth['isAuthenticated'](),controller[_0xced8('0x19')]);router[_0xced8('0x1a')](_0xced8('0xd'),auth[_0xced8('0x9')](),controller[_0xced8('0x1b')]);router['delete']('/:id/sections',auth[_0xced8('0x9')](),controller['removeSections']);router[_0xced8('0x1a')](_0xced8('0x11'),auth[_0xced8('0x9')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0x769b=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x769b,0x123));var _0xb769=function(_0x27c2f8,_0x5948c1){_0x27c2f8=_0x27c2f8-0x0;var _0x5cc05f=_0x769b[_0x27c2f8];return _0x5cc05f;};'use strict';var multer=require(_0xb769('0x0'));var util=require(_0xb769('0x1'));var path=require(_0xb769('0x2'));var timeout=require(_0xb769('0x3'));var express=require('express');var router=express[_0xb769('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb769('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb769('0x6'));var controller=require('./userProfile.controller');router[_0xb769('0x7')]('/',auth[_0xb769('0x8')](),controller[_0xb769('0x9')]);router[_0xb769('0x7')](_0xb769('0xa'),auth[_0xb769('0x8')](),controller[_0xb769('0xb')]);router['get']('/:id',auth[_0xb769('0x8')](),controller[_0xb769('0xc')]);router['get'](_0xb769('0xd'),auth[_0xb769('0x8')](),controller[_0xb769('0xe')]);router[_0xb769('0x7')](_0xb769('0xf'),auth[_0xb769('0x8')](),controller[_0xb769('0x10')]);router[_0xb769('0x11')]('/',auth[_0xb769('0x8')](),controller[_0xb769('0x12')]);router['post'](_0xb769('0x13'),auth[_0xb769('0x8')](),controller[_0xb769('0x14')]);router[_0xb769('0x11')](_0xb769('0xd'),auth[_0xb769('0x8')](),controller[_0xb769('0x15')]);router[_0xb769('0x11')]('/:id/resources',auth[_0xb769('0x8')](),controller['addResources']);router[_0xb769('0x16')](_0xb769('0x17'),auth[_0xb769('0x8')](),controller[_0xb769('0x18')]);router[_0xb769('0x19')](_0xb769('0x17'),auth[_0xb769('0x8')](),controller['destroy']);router['delete'](_0xb769('0xd'),auth[_0xb769('0x8')](),controller['removeSections']);router[_0xb769('0x19')](_0xb769('0xf'),auth[_0xb769('0x8')](),controller['removeResources']);module[_0xb769('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6982043..b657007 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 _0x453a=['crudPermissions','getDataValue','STRING','BOOLEAN','name'];(function(_0x1b471a,_0x38826e){var _0x4fe776=function(_0x39b70d){while(--_0x39b70d){_0x1b471a['push'](_0x1b471a['shift']());}};_0x4fe776(++_0x38826e);}(_0x453a,0x126));var _0xa453=function(_0x45f42e,_0x417bb){_0x45f42e=_0x45f42e-0x0;var _0x5704b6=_0x453a[_0x45f42e];return _0x5704b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa453('0x0')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1affa9){this['setDataValue'](_0xa453('0x1'),_0x1affa9?_0x1affa9['join'](''):[]);},'get':function(){return this[_0xa453('0x2')](_0xa453('0x1'))?this[_0xa453('0x2')](_0xa453('0x1'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa453('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa453('0x4')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa453('0x4')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa453('0x4')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa453('0x4')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa453('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0d74=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x0d74,0x110));var _0x40d7=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x0d74[_0x1cfa0d];return _0xe33279;};'use strict';var Sequelize=require(_0x40d7('0x0'));module[_0x40d7('0x1')]={'name':{'type':Sequelize[_0x40d7('0x2')],'allowNull':![],'unique':_0x40d7('0x3')},'crudPermissions':{'type':Sequelize[_0x40d7('0x2')],'set':function(_0x5ef2bb){this[_0x40d7('0x4')](_0x40d7('0x5'),_0x5ef2bb?_0x5ef2bb[_0x40d7('0x6')](''):[]);},'get':function(){return this[_0x40d7('0x7')](_0x40d7('0x5'))?this[_0x40d7('0x7')](_0x40d7('0x5'))[_0x40d7('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x40d7('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x40d7('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x40d7('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x40d7('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x40d7('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x40d7('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x40d7('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x40d7('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 55f8ca1..8804af4 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 _0xa466=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','UserProfile','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','clone','omit','createdAt','updatedAt','crudPermissions','body','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','sequelize','push','ids','getSections','enabled','includes','subsections','concat','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa466,0x140));var _0x6a46=function(_0x20c9a8,_0x8adf2f){_0x20c9a8=_0x20c9a8-0x0;var _0x56a8cf=_0xa466[_0x20c9a8];return _0x56a8cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a46('0x0'));var zipdir=require(_0x6a46('0x1'));var jsonpatch=require(_0x6a46('0x2'));var rp=require('request-promise');var moment=require(_0x6a46('0x3'));var BPromise=require(_0x6a46('0x4'));var Mustache=require(_0x6a46('0x5'));var util=require(_0x6a46('0x6'));var path=require(_0x6a46('0x7'));var sox=require(_0x6a46('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a46('0x9'));var _=require('lodash');var squel=require(_0x6a46('0xa'));var crypto=require(_0x6a46('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a46('0xc'));var toCsv=require(_0x6a46('0xd'));var querystring=require(_0x6a46('0xe'));var Papa=require(_0x6a46('0xf'));var Redis=require(_0x6a46('0x10'));var authService=require(_0x6a46('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6a46('0x12'));var hardwareService=require(_0x6a46('0x13'));var logger=require(_0x6a46('0x14'))(_0x6a46('0x15'));var utils=require(_0x6a46('0x16'));var config=require(_0x6a46('0x17'));var licenseUtil=require(_0x6a46('0x18'));var db=require(_0x6a46('0x19'))['db'];config[_0x6a46('0x1a')]=_['defaults'](config[_0x6a46('0x1a')],{'host':_0x6a46('0x1b'),'port':0x18eb});var socket=require(_0x6a46('0x1c'))(new Redis(config[_0x6a46('0x1a')]));require(_0x6a46('0x1d'))['register'](socket);function respondWithStatusCode(_0x3bb091,_0x5717d6){_0x5717d6=_0x5717d6||0xcc;return function(_0x49f16f){if(_0x49f16f){return _0x3bb091[_0x6a46('0x1e')](_0x5717d6);}return _0x3bb091[_0x6a46('0x1f')](_0x5717d6)[_0x6a46('0x20')]();};}function respondWithResult(_0x3969bb,_0x3ffa20){_0x3ffa20=_0x3ffa20||0xc8;return function(_0x87f1e6){if(_0x87f1e6){return _0x3969bb[_0x6a46('0x1f')](_0x3ffa20)[_0x6a46('0x21')](_0x87f1e6);}};}function respondWithFilteredResult(_0x2d0cde,_0x52ce87){return function(_0x10c241){if(_0x10c241){var _0x1f75b8=typeof _0x52ce87[_0x6a46('0x22')]===_0x6a46('0x23')&&typeof _0x52ce87[_0x6a46('0x24')]===_0x6a46('0x23');var _0x2665c5=_0x10c241[_0x6a46('0x25')];var _0x41cd11=_0x1f75b8?0x0:_0x52ce87['offset'];var _0x5b9c77=_0x1f75b8?_0x10c241['count']:_0x52ce87[_0x6a46('0x22')]+_0x52ce87[_0x6a46('0x24')];var _0x3b7992;if(_0x5b9c77>=_0x2665c5){_0x5b9c77=_0x2665c5;_0x3b7992=0xc8;}else{_0x3b7992=0xce;}_0x2d0cde['status'](_0x3b7992);return _0x2d0cde[_0x6a46('0x26')](_0x6a46('0x27'),_0x41cd11+'-'+_0x5b9c77+'/'+_0x2665c5)[_0x6a46('0x21')](_0x10c241);}return null;};}function patchUpdates(_0xdd3476){return function(_0x111256){try{jsonpatch[_0x6a46('0x28')](_0x111256,_0xdd3476,!![]);}catch(_0x5c0265){return BPromise[_0x6a46('0x29')](_0x5c0265);}return _0x111256[_0x6a46('0x2a')]();};}function saveUpdates(_0x155b3d,_0x24cbf6){return function(_0x793fdb){if(_0x793fdb){return _0x793fdb['update'](_0x155b3d)[_0x6a46('0x2b')](function(_0x3c60a4){return _0x3c60a4;});}return null;};}function removeEntity(_0x2a2afb,_0x2e1d7b){return function(_0x54988b){if(_0x54988b){return _0x54988b[_0x6a46('0x2c')]()[_0x6a46('0x2b')](function(){_0x2a2afb[_0x6a46('0x1f')](0xcc)[_0x6a46('0x20')]();});}};}function handleEntityNotFound(_0x4dfab2,_0x1239aa){return function(_0x3005e2){if(!_0x3005e2){_0x4dfab2[_0x6a46('0x1e')](0x194);}return _0x3005e2;};}function handleError(_0x33d369,_0x167f72){_0x167f72=_0x167f72||0x1f4;return function(_0x1c2627){logger['error'](_0x1c2627[_0x6a46('0x2d')]);if(_0x1c2627['name']){delete _0x1c2627[_0x6a46('0x2e')];}_0x33d369[_0x6a46('0x1f')](_0x167f72)[_0x6a46('0x2f')](_0x1c2627);};}exports[_0x6a46('0x30')]=function(_0x15e56e,_0x3dbd7a){var _0x371899={},_0x20534c={},_0x202a8e={'count':0x0,'rows':[]};var _0x580850=_[_0x6a46('0x31')](db[_0x6a46('0x32')]['rawAttributes'],function(_0x3a2687){return{'name':_0x3a2687[_0x6a46('0x33')],'type':_0x3a2687[_0x6a46('0x34')]['key']};});_0x20534c[_0x6a46('0x35')]=_[_0x6a46('0x31')](_0x580850,_0x6a46('0x2e'));_0x20534c[_0x6a46('0x36')]=_[_0x6a46('0x37')](_0x15e56e[_0x6a46('0x36')]);_0x20534c[_0x6a46('0x38')]=_[_0x6a46('0x39')](_0x20534c[_0x6a46('0x35')],_0x20534c[_0x6a46('0x36')]);_0x371899[_0x6a46('0x3a')]=_[_0x6a46('0x39')](_0x20534c[_0x6a46('0x35')],qs[_0x6a46('0x3b')](_0x15e56e[_0x6a46('0x36')][_0x6a46('0x3b')]));_0x371899[_0x6a46('0x3a')]=_0x371899[_0x6a46('0x3a')][_0x6a46('0x3c')]?_0x371899[_0x6a46('0x3a')]:_0x20534c[_0x6a46('0x35')];if(!_0x15e56e[_0x6a46('0x36')][_0x6a46('0x3d')]('nolimit')){_0x371899['limit']=qs[_0x6a46('0x24')](_0x15e56e[_0x6a46('0x36')]['limit']);_0x371899[_0x6a46('0x22')]=qs[_0x6a46('0x22')](_0x15e56e[_0x6a46('0x36')][_0x6a46('0x22')]);}_0x371899[_0x6a46('0x3e')]=qs[_0x6a46('0x3f')](_0x15e56e['query'][_0x6a46('0x3f')]);_0x371899[_0x6a46('0x40')]=qs['filters'](_['pick'](_0x15e56e[_0x6a46('0x36')],_0x20534c[_0x6a46('0x38')]),_0x580850);if(_0x15e56e[_0x6a46('0x36')][_0x6a46('0x41')]){_0x371899[_0x6a46('0x40')]=_[_0x6a46('0x42')](_0x371899[_0x6a46('0x40')],{'$or':_['map'](_0x580850,function(_0x2fc497){if(_0x2fc497['type']!==_0x6a46('0x43')){var _0x11b63a={};_0x11b63a[_0x2fc497['name']]={'$like':'%'+_0x15e56e['query'][_0x6a46('0x41')]+'%'};return _0x11b63a;}})});}_0x371899=_[_0x6a46('0x42')]({},_0x371899,_0x15e56e[_0x6a46('0x44')]);var _0x342150={'where':_0x371899[_0x6a46('0x40')]};return db['UserProfile'][_0x6a46('0x25')](_0x342150)[_0x6a46('0x2b')](function(_0xf104f8){_0x202a8e[_0x6a46('0x25')]=_0xf104f8;if(_0x15e56e[_0x6a46('0x36')][_0x6a46('0x45')]){_0x371899['include']=[{'all':!![]}];}return db[_0x6a46('0x32')][_0x6a46('0x46')](_0x371899);})[_0x6a46('0x2b')](function(_0x139f3c){_0x202a8e[_0x6a46('0x47')]=_0x139f3c;return _0x202a8e;})[_0x6a46('0x2b')](respondWithFilteredResult(_0x3dbd7a,_0x371899))[_0x6a46('0x48')](handleError(_0x3dbd7a,null));};exports[_0x6a46('0x49')]=function(_0x1c8eea,_0x1ccec2){var _0x4772ff={'raw':![],'where':{'id':_0x1c8eea[_0x6a46('0x4a')]['id']}},_0x55b18b={};_0x55b18b[_0x6a46('0x35')]=_[_0x6a46('0x37')](db[_0x6a46('0x32')][_0x6a46('0x4b')]);_0x55b18b[_0x6a46('0x36')]=_[_0x6a46('0x37')](_0x1c8eea[_0x6a46('0x36')]);_0x55b18b[_0x6a46('0x38')]=_[_0x6a46('0x39')](_0x55b18b[_0x6a46('0x35')],_0x55b18b[_0x6a46('0x36')]);_0x4772ff[_0x6a46('0x3a')]=_['intersection'](_0x55b18b['model'],qs[_0x6a46('0x3b')](_0x1c8eea[_0x6a46('0x36')][_0x6a46('0x3b')]));_0x4772ff[_0x6a46('0x3a')]=_0x4772ff[_0x6a46('0x3a')][_0x6a46('0x3c')]?_0x4772ff[_0x6a46('0x3a')]:_0x55b18b['model'];if(_0x1c8eea[_0x6a46('0x36')][_0x6a46('0x45')]){_0x4772ff[_0x6a46('0x4c')]=[{'all':!![]}];}_0x4772ff=_[_0x6a46('0x42')]({},_0x4772ff,_0x1c8eea[_0x6a46('0x44')]);return db['UserProfile'][_0x6a46('0x4d')](_0x4772ff)[_0x6a46('0x2b')](handleEntityNotFound(_0x1ccec2,null))[_0x6a46('0x2b')](respondWithResult(_0x1ccec2,null))[_0x6a46('0x48')](handleError(_0x1ccec2,null));};exports[_0x6a46('0x4e')]=function(_0x2c8a11,_0x14c334){return db[_0x6a46('0x32')][_0x6a46('0x4e')](_0x2c8a11['body'],{})[_0x6a46('0x2b')](respondWithResult(_0x14c334,0xc9))[_0x6a46('0x48')](handleError(_0x14c334,null));};exports[_0x6a46('0x4f')]=function(_0x237fa8,_0x386aa3){var _0x4c0719={'where':{'id':_0x237fa8[_0x6a46('0x4a')]['id']}},_0x145b1f={};_0x145b1f[_0x6a46('0x35')]=_[_0x6a46('0x37')](db[_0x6a46('0x32')]['rawAttributes']);_0x4c0719[_0x6a46('0x3a')]=_[_0x6a46('0x39')](_0x145b1f[_0x6a46('0x35')],qs[_0x6a46('0x3b')](_0x237fa8[_0x6a46('0x36')]['fields']));_0x4c0719[_0x6a46('0x3a')]=_0x4c0719['attributes']['length']?_0x4c0719[_0x6a46('0x3a')]:_0x145b1f[_0x6a46('0x35')];if(_0x237fa8['query'][_0x6a46('0x45')]){_0x4c0719[_0x6a46('0x4c')]=[{'all':!![]}];}_0x4c0719=_[_0x6a46('0x42')]({},_0x4c0719,_0x237fa8[_0x6a46('0x44')]);return db[_0x6a46('0x32')][_0x6a46('0x4d')](_0x4c0719)['then'](handleEntityNotFound(_0x386aa3,null))['then'](function(_0x1a822c){if(_0x1a822c){var _0x4a925b=_0x1a822c['get']({'plain':!![]});_0x4a925b=qs[_0x6a46('0x50')](_0x4a925b,['id',_0x6a46('0x51'),_0x6a46('0x52'),_0x6a46('0x53')]);_0x237fa8[_0x6a46('0x54')]=_[_0x6a46('0x50')](_0x237fa8[_0x6a46('0x54')],['id','createdAt','updatedAt']);return db['sequelize'][_0x6a46('0x55')](function(_0xfd70b3){return db[_0x6a46('0x32')]['create'](_[_0x6a46('0x42')](_0x4a925b,_0x237fa8[_0x6a46('0x54')]),{'include':_0x237fa8[_0x6a46('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0xfd70b3})[_0x6a46('0x2b')](function(_0x42ab8b){var _0x3abd97=_0x42ab8b[_0x6a46('0x56')]({'plain':!![]});return db[_0x6a46('0x57')][_0x6a46('0x46')]({'where':{'userProfileId':_0x237fa8[_0x6a46('0x4a')]['id']},'raw':!![]})[_0x6a46('0x2b')](function(_0x3e331c){if(_0x3e331c){return BPromise[_0x6a46('0x58')](_0x3e331c,function(_0x20c35f){return new BPromise(function(_0x232169,_0xb78472){if(_0x20c35f[_0x6a46('0x59')]===null||_0x20c35f[_0x6a46('0x59')]===0x1)_0x232169(null);return db[_0x6a46('0x5a')][_0x6a46('0x46')]({'where':{'sectionId':_0x20c35f['id']},'raw':!![]})[_0x6a46('0x2b')](function(_0x205bbd){var _0x2682d2=_[_0x6a46('0x31')](_0x205bbd,function(_0x5aed2d){return qs[_0x6a46('0x50')](_0x5aed2d,['id',_0x6a46('0x51'),_0x6a46('0x52'),_0x6a46('0x5b')]);});_0x232169(_0x2682d2);})[_0x6a46('0x48')](function(_0xa93c39){_0xb78472(_0xa93c39);});})['then'](function(_0x453583){var _0x110ac3=qs[_0x6a46('0x50')](_0x20c35f,['id',_0x6a46('0x51'),_0x6a46('0x52')]);_0x110ac3[_0x6a46('0x5c')]=_0x3abd97['id'];if(_0x453583)_0x110ac3[_0x6a46('0x5d')]=_0x453583;return _0x110ac3;})[_0x6a46('0x2b')](function(_0x7f3819){return db['UserProfileSection']['create'](_0x7f3819,{'include':[{'model':db[_0x6a46('0x5a')],'as':_0x6a46('0x5d')}],'raw':!![],'transaction':_0xfd70b3});});})['then'](function(){return _0x3abd97;});}});});});}})[_0x6a46('0x2b')](respondWithResult(_0x386aa3,0xc9))[_0x6a46('0x48')](handleError(_0x386aa3,null));};exports['update']=function(_0x4be8a9,_0x494e35){if(_0x4be8a9['body']['id']){delete _0x4be8a9[_0x6a46('0x54')]['id'];}return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0x4be8a9[_0x6a46('0x4a')]['id']}})[_0x6a46('0x2b')](handleEntityNotFound(_0x494e35,null))['then'](saveUpdates(_0x4be8a9[_0x6a46('0x54')],null))[_0x6a46('0x2b')](respondWithResult(_0x494e35,null))['catch'](handleError(_0x494e35,null));};exports['destroy']=function(_0x139f62,_0x29c6c3){return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0x139f62['params']['id']}})[_0x6a46('0x2b')](handleEntityNotFound(_0x29c6c3,null))[_0x6a46('0x2b')](removeEntity(_0x29c6c3,null))[_0x6a46('0x48')](handleError(_0x29c6c3,null));};exports[_0x6a46('0x5e')]=function(_0x5b5b7f,_0x5590d8){return db[_0x6a46('0x32')]['describe']()[_0x6a46('0x2b')](respondWithResult(_0x5590d8,null))['catch'](handleError(_0x5590d8,null));};exports[_0x6a46('0x5f')]=function(_0xed66a7,_0xfb2235){var _0x567e28=_0xed66a7['body'];return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0xed66a7[_0x6a46('0x4a')]['id']}})['then'](handleEntityNotFound(_0xfb2235,null))[_0x6a46('0x2b')](function(_0x265742){if(_0x265742){return db[_0x6a46('0x60')]['transaction'](function(_0x528198){return db[_0x6a46('0x57')]['destroy']({'where':{'userProfileId':_0xed66a7[_0x6a46('0x4a')]['id'],'sectionId':_[_0x6a46('0x31')](_0x567e28,function(_0x51c9d0){return _0x51c9d0[_0x6a46('0x5b')];})},'transaction':_0x528198})[_0x6a46('0x2b')](function(){var _0x182254=_['map'](_0x567e28,function(_0xa80a81){_0xa80a81[_0x6a46('0x5c')]=_0xed66a7[_0x6a46('0x4a')]['id'];return _0xa80a81;});var _0x1d182e=[];return BPromise[_0x6a46('0x58')](_0x182254,function(_0x5a26ab){return db['UserProfileSection'][_0x6a46('0x4e')](_0x5a26ab,{'include':[{'model':db[_0x6a46('0x5a')],'as':_0x6a46('0x5d')}],'raw':!![],'transaction':_0x528198})[_0x6a46('0x2b')](function(_0x37d24e){_0x1d182e[_0x6a46('0x61')](_0x37d24e['get']({'plain':!![]}));});})['then'](function(){return _0x1d182e;});});});}})['then'](function(_0x408fc6){return _0x408fc6;})['then'](respondWithResult(_0xfb2235,null))['catch'](handleError(_0xfb2235,null));};exports['removeSections']=function(_0x414a10,_0x33ed0b){var _0xfbbe79;return db['UserProfile']['find']({'where':{'id':_0x414a10['params']['id']},'attributes':['id',_0x6a46('0x2e')]})['then'](handleEntityNotFound(_0x33ed0b,null))[_0x6a46('0x2b')](function(_0x1de1e8){if(_0x1de1e8){_0xfbbe79=_0x1de1e8;return db[_0x6a46('0x57')][_0x6a46('0x2c')]({'where':{'userProfileId':_0x414a10['params']['id'],'sectionId':_0x414a10[_0x6a46('0x36')][_0x6a46('0x62')]}});}})[_0x6a46('0x2b')](function(){return _0xfbbe79;})['then'](respondWithStatusCode(_0x33ed0b,null))['catch'](handleError(_0x33ed0b,null));};exports[_0x6a46('0x63')]=function(_0x44dd4e,_0x3acc9d){var _0x238b44=[];var _0x271543=[];return db[_0x6a46('0x57')][_0x6a46('0x46')]({'where':{'userProfileId':_0x44dd4e[_0x6a46('0x4a')]['id']},'raw':!![]})['then'](function(_0x4c38f4){_0x238b44=_[_0x6a46('0x41')](_0x4c38f4,function(_0x555ad9){return _0x555ad9[_0x6a46('0x64')]===0x1||_[_0x6a46('0x65')]([0x3eb,0x709],_0x555ad9[_0x6a46('0x5b')]);});if(!_['isEmpty'](_0x238b44)){return _['map'](_0x238b44,function(_0x261688){return _0x261688['sectionId'];});}else{return;}})[_0x6a46('0x2b')](function(_0x3b2dd9){if(_0x3b2dd9)_0x271543=_0x3b2dd9;if(_[_0x6a46('0x65')](_0x271543,0x64)){var _0x5764ec=_[_0x6a46('0x4d')](_0x238b44,{'sectionId':0x64});return hasDefaultDashboard(_0x5764ec)[_0x6a46('0x2b')](function(_0xbe4047){return _[_0x6a46('0x31')](_0x238b44,function(_0x2d8a34){if(_0x2d8a34[_0x6a46('0x5b')]===0x64){_0x2d8a34['subsections']=_0xbe4047;}return _0x2d8a34;});});}else{return;}})[_0x6a46('0x2b')](function(_0x48057c){if(_0x48057c)_0x238b44=_0x48057c;if(_[_0x6a46('0x65')](_0x271543,0x3eb)){var _0x3cf407=_['find'](_0x238b44,{'sectionId':0x3eb});return getCustomDashboards(_0x3cf407)[_0x6a46('0x2b')](function(_0x25040e){return _[_0x6a46('0x31')](_0x238b44,function(_0x5c34e9){if(_0x3cf407[_0x6a46('0x64')]){if(_0x5c34e9[_0x6a46('0x5b')]===0x3eb){_0x5c34e9['subsections']=_0x25040e;}}else{if(_0x5c34e9[_0x6a46('0x5b')]===0x64){if(!_0x5c34e9[_0x6a46('0x66')]){_0x5c34e9[_0x6a46('0x66')]=[];}_0x5c34e9[_0x6a46('0x66')]=_0x5c34e9[_0x6a46('0x66')][_0x6a46('0x67')](_0x25040e);}}return _0x5c34e9;});});}else{return;}})[_0x6a46('0x2b')](function(_0x379b1f){if(_0x379b1f)_0x238b44=_0x379b1f;if(_['includes'](_0x271543,0x709)){var _0x2dda26=_['find'](_0x238b44,{'sectionId':0x709});return getPlugins(_0x2dda26)[_0x6a46('0x2b')](function(_0x47326c){if(_0x2dda26[_0x6a46('0x64')]){return _[_0x6a46('0x31')](_0x238b44,function(_0x5a529a){if(_0x5a529a[_0x6a46('0x5b')]===0x709){_0x5a529a['subsections']=_0x47326c;}return _0x5a529a;});}else{var _0x13f3a2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x47326c};var _0x5beadf=_['map'](_0x238b44);_0x5beadf[_0x6a46('0x61')](_0x13f3a2);return _0x5beadf;}});}else{return;}})[_0x6a46('0x2b')](function(_0x387366){if(_0x387366)_0x238b44=_0x387366;return _[_0x6a46('0x41')](_0x238b44,[_0x6a46('0x64'),0x1]);})[_0x6a46('0x2b')](respondWithResult(_0x3acc9d,null))['catch'](handleError(_0x3acc9d,null));};function hasDefaultDashboard(_0x56ff8c){var _0xa812eb=[0x65];return new BPromise(function(_0x231b0f,_0x18295c){try{if(_0x56ff8c[_0x6a46('0x59')]){_0x231b0f(_0xa812eb);}else{return db[_0x6a46('0x5a')]['findOne']({'where':{'sectionId':_0x56ff8c['id']},'raw':!![]})[_0x6a46('0x2b')](function(_0x29e592){_0x29e592?_0x231b0f(_0xa812eb):_0x231b0f();});}}catch(_0x3b68cf){_0x18295c(_0x3b68cf);}});}function getCustomDashboards(_0x18a902){var _0x370b93=[];return new BPromise(function(_0x2cbdb8,_0x586a53){try{if(_0x18a902[_0x6a46('0x59')]){return db[_0x6a46('0x68')][_0x6a46('0x46')]({'raw':!![]})['then'](function(_0xaa7098){_0xaa7098[_0x6a46('0x69')](function(_0x5b6818){_0x370b93['push'](_0x5b6818['id']+0x1869f);});_0x2cbdb8(_0x370b93);});}else{return db[_0x6a46('0x5a')][_0x6a46('0x46')]({'where':{'sectionId':_0x18a902['id']},'raw':!![]})['then'](function(_0x152a8e){_0x152a8e[_0x6a46('0x69')](function(_0x2ae288){_0x370b93[_0x6a46('0x61')](_0x2ae288[_0x6a46('0x6a')]+0x1869f);});_0x2cbdb8(_0x370b93);});}}catch(_0x23e8d4){_0x586a53(_0x23e8d4);}});}function getPlugins(_0x49ba9d){var _0xede563=[];return new BPromise(function(_0x2f2304,_0x5e356c){try{if(_0x49ba9d[_0x6a46('0x59')]){return db[_0x6a46('0x6b')]['findAll']({'raw':!![]})[_0x6a46('0x2b')](function(_0x20dad4){_0x20dad4['forEach'](function(_0xfd5b38){_0xede563[_0x6a46('0x61')](_0xfd5b38['id']+0x15b38);});_0x2f2304(_0xede563);});}else{return db['UserProfileResource'][_0x6a46('0x46')]({'where':{'sectionId':_0x49ba9d['id']},'raw':!![]})[_0x6a46('0x2b')](function(_0x37c020){_0x37c020['forEach'](function(_0x3fe398){_0xede563[_0x6a46('0x61')](_0x3fe398['resourceId']+0x15b38);});_0x2f2304(_0xede563);});}}catch(_0x3db646){_0x5e356c(_0x3db646);}});}exports['addResources']=function(_0x53f6be,_0x14851a){return db['UserProfile'][_0x6a46('0x4d')]({'where':{'id':_0x53f6be[_0x6a46('0x4a')]['id']}})[_0x6a46('0x2b')](handleEntityNotFound(_0x14851a,null))[_0x6a46('0x2b')](function(_0x1836d3){if(_0x1836d3){return db[_0x6a46('0x60')][_0x6a46('0x55')](function(_0x29646a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x53f6be[_0x6a46('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x6a46('0x2b')](function(_0x36b310){if(_0x36b310){return db[_0x6a46('0x57')][_0x6a46('0x2c')]({'where':{'userProfileId':_0x53f6be[_0x6a46('0x4a')]['id'],'id':_[_0x6a46('0x31')](_0x36b310,function(_0x11176a){return _0x11176a['id'];})},'transaction':_0x29646a});}})[_0x6a46('0x2b')](function(_0x1932b4){var _0x44485d=_[_0x6a46('0x31')](_0x53f6be['body'],function(_0x316a4d){_0x316a4d[_0x6a46('0x5c')]=_0x53f6be[_0x6a46('0x4a')]['id'];return _0x316a4d;});return db[_0x6a46('0x57')][_0x6a46('0x6c')](_0x44485d,{'raw':!![],'transaction':_0x29646a});})[_0x6a46('0x2b')](function(_0x5c0dc5){var _0x1ff6fa=_[_0x6a46('0x41')](_[_0x6a46('0x31')](_0x5c0dc5,function(_0x8049f4){return _0x8049f4[_0x6a46('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x1ff6fa){return db[_0x6a46('0x57')][_0x6a46('0x46')]({'where':{'userProfileId':_0x53f6be[_0x6a46('0x4a')]['id'],'sectionId':_[_0x6a46('0x31')](_0x1ff6fa,function(_0x38636e){return _0x38636e['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0xef90b3){var _0x142a2b=_[_0x6a46('0x31')](_0x53f6be[_0x6a46('0x54')],function(_0x55c299){_0x55c299[_0x6a46('0x5c')]=_0x53f6be['params']['id'];return _0x55c299;});return db[_0x6a46('0x5a')][_0x6a46('0x6c')](_0x142a2b,{'raw':!![],'transaction':_0x29646a});});}})[_0x6a46('0x48')](handleError(_0x14851a,null));});}})[_0x6a46('0x2b')](function(_0x30e8e3){var _0x37ff63=_[_0x6a46('0x31')](_0x30e8e3,function(_0x5a6794){return _0x5a6794[_0x6a46('0x56')]({'plain':!![]});});})[_0x6a46('0x2b')](respondWithResult(_0x14851a,null))[_0x6a46('0x48')](handleError(_0x14851a,null));};exports[_0x6a46('0x6d')]=function(_0xbe4163,_0x38e716,_0x1b5fbc){return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0xbe4163['params']['id']}})[_0x6a46('0x2b')](handleEntityNotFound(_0x38e716,null))['then'](function(_0x590498){if(_0x590498){return _0x590498[_0x6a46('0x6d')](_0xbe4163['query'][_0x6a46('0x62')]);}})[_0x6a46('0x2b')](respondWithStatusCode(_0x38e716,null))['catch'](handleError(_0x38e716,null));};exports['getResources']=function(_0x1a2066,_0x5cd91f){var _0x3fe764={};if(!_0x1a2066[_0x6a46('0x36')][_0x6a46('0x6e')])throw new Error(_0x6a46('0x6f'));if(!_0x1a2066['query'][_0x6a46('0x3d')](_0x6a46('0x70'))){_0x3fe764['limit']=qs[_0x6a46('0x24')](_0x1a2066[_0x6a46('0x36')][_0x6a46('0x24')]);_0x3fe764[_0x6a46('0x22')]=qs[_0x6a46('0x22')](_0x1a2066['query']['offset']);}return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0x1a2066['params']['id']}})['then'](function(_0x4b06a6){if(!_0x4b06a6)throw new Error(_0x6a46('0x71')+_0x1a2066[_0x6a46('0x4a')]['id']);return db[_0x6a46('0x32')]['getResources'](_0x1a2066);})[_0x6a46('0x2b')](respondWithFilteredResult(_0x5cd91f,_0x3fe764))[_0x6a46('0x48')](handleError(_0x5cd91f,null));}; \ No newline at end of file +var _0x1170=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','catch','show','model','includeAll','include','find','create','body','clone','params','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','each','push','removeSections','getSections','includes','subsections','enabled','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1170,0xf0));var _0x0117=function(_0x28e71f,_0x577052){_0x28e71f=_0x28e71f-0x0;var _0x47772c=_0x1170[_0x28e71f];return _0x47772c;};'use strict';var emlformat=require(_0x0117('0x0'));var rimraf=require(_0x0117('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0117('0x2'));var rp=require(_0x0117('0x3'));var moment=require(_0x0117('0x4'));var BPromise=require(_0x0117('0x5'));var Mustache=require(_0x0117('0x6'));var util=require(_0x0117('0x7'));var path=require(_0x0117('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0117('0x9'));var fs=require('fs');var fs_extra=require(_0x0117('0xa'));var _=require(_0x0117('0xb'));var squel=require(_0x0117('0xc'));var crypto=require(_0x0117('0xd'));var jsforce=require(_0x0117('0xe'));var deskjs=require(_0x0117('0xf'));var toCsv=require(_0x0117('0x10'));var querystring=require(_0x0117('0x11'));var Papa=require(_0x0117('0x12'));var Redis=require('ioredis');var authService=require(_0x0117('0x13'));var qs=require(_0x0117('0x14'));var as=require(_0x0117('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0117('0x16'))(_0x0117('0x17'));var utils=require(_0x0117('0x18'));var config=require(_0x0117('0x19'));var licenseUtil=require(_0x0117('0x1a'));var db=require(_0x0117('0x1b'))['db'];config[_0x0117('0x1c')]=_[_0x0117('0x1d')](config[_0x0117('0x1c')],{'host':_0x0117('0x1e'),'port':0x18eb});var socket=require(_0x0117('0x1f'))(new Redis(config[_0x0117('0x1c')]));require(_0x0117('0x20'))[_0x0117('0x21')](socket);function respondWithStatusCode(_0x40c4ec,_0x49a86f){_0x49a86f=_0x49a86f||0xcc;return function(_0x1077e1){if(_0x1077e1){return _0x40c4ec[_0x0117('0x22')](_0x49a86f);}return _0x40c4ec['status'](_0x49a86f)[_0x0117('0x23')]();};}function respondWithResult(_0x2f5564,_0x13a709){_0x13a709=_0x13a709||0xc8;return function(_0x50008d){if(_0x50008d){return _0x2f5564[_0x0117('0x24')](_0x13a709)[_0x0117('0x25')](_0x50008d);}};}function respondWithFilteredResult(_0x263231,_0x1798c7){return function(_0x110d3f){if(_0x110d3f){var _0x4cf015=typeof _0x1798c7['offset']===_0x0117('0x26')&&typeof _0x1798c7[_0x0117('0x27')]===_0x0117('0x26');var _0x283c57=_0x110d3f[_0x0117('0x28')];var _0x586528=_0x4cf015?0x0:_0x1798c7[_0x0117('0x29')];var _0xc29189=_0x4cf015?_0x110d3f[_0x0117('0x28')]:_0x1798c7[_0x0117('0x29')]+_0x1798c7['limit'];var _0x297f75;if(_0xc29189>=_0x283c57){_0xc29189=_0x283c57;_0x297f75=0xc8;}else{_0x297f75=0xce;}_0x263231[_0x0117('0x24')](_0x297f75);return _0x263231[_0x0117('0x2a')](_0x0117('0x2b'),_0x586528+'-'+_0xc29189+'/'+_0x283c57)[_0x0117('0x25')](_0x110d3f);}return null;};}function patchUpdates(_0x150a91){return function(_0x5a1ef1){try{jsonpatch[_0x0117('0x2c')](_0x5a1ef1,_0x150a91,!![]);}catch(_0x4a229a){return BPromise[_0x0117('0x2d')](_0x4a229a);}return _0x5a1ef1['save']();};}function saveUpdates(_0x5468ad,_0x450e57){return function(_0xc0855e){if(_0xc0855e){return _0xc0855e[_0x0117('0x2e')](_0x5468ad)[_0x0117('0x2f')](function(_0x579a62){return _0x579a62;});}return null;};}function removeEntity(_0x22ef59,_0x47f6e5){return function(_0x1a8cd3){if(_0x1a8cd3){return _0x1a8cd3[_0x0117('0x30')]()[_0x0117('0x2f')](function(){_0x22ef59[_0x0117('0x24')](0xcc)[_0x0117('0x23')]();});}};}function handleEntityNotFound(_0x1571a1,_0x578ce2){return function(_0x5b61fd){if(!_0x5b61fd){_0x1571a1[_0x0117('0x22')](0x194);}return _0x5b61fd;};}function handleError(_0x2a117d,_0x57a552){_0x57a552=_0x57a552||0x1f4;return function(_0x4f3bbb){logger[_0x0117('0x31')](_0x4f3bbb[_0x0117('0x32')]);if(_0x4f3bbb[_0x0117('0x33')]){delete _0x4f3bbb[_0x0117('0x33')];}_0x2a117d[_0x0117('0x24')](_0x57a552)['send'](_0x4f3bbb);};}exports[_0x0117('0x34')]=function(_0x122c62,_0x3d9e11){var _0x1c3912={},_0x536b13={},_0x22416a={'count':0x0,'rows':[]};var _0xcf34a3=_[_0x0117('0x35')](db[_0x0117('0x36')][_0x0117('0x37')],function(_0x42922b){return{'name':_0x42922b[_0x0117('0x38')],'type':_0x42922b['type'][_0x0117('0x39')]};});_0x536b13['model']=_[_0x0117('0x35')](_0xcf34a3,_0x0117('0x33'));_0x536b13[_0x0117('0x3a')]=_[_0x0117('0x3b')](_0x122c62['query']);_0x536b13[_0x0117('0x3c')]=_['intersection'](_0x536b13['model'],_0x536b13[_0x0117('0x3a')]);_0x1c3912[_0x0117('0x3d')]=_[_0x0117('0x3e')](_0x536b13['model'],qs[_0x0117('0x3f')](_0x122c62['query']['fields']));_0x1c3912[_0x0117('0x3d')]=_0x1c3912[_0x0117('0x3d')][_0x0117('0x40')]?_0x1c3912[_0x0117('0x3d')]:_0x536b13['model'];if(!_0x122c62[_0x0117('0x3a')][_0x0117('0x41')](_0x0117('0x42'))){_0x1c3912[_0x0117('0x27')]=qs['limit'](_0x122c62[_0x0117('0x3a')][_0x0117('0x27')]);_0x1c3912[_0x0117('0x29')]=qs[_0x0117('0x29')](_0x122c62[_0x0117('0x3a')][_0x0117('0x29')]);}_0x1c3912[_0x0117('0x43')]=qs['sort'](_0x122c62[_0x0117('0x3a')][_0x0117('0x44')]);_0x1c3912[_0x0117('0x45')]=qs[_0x0117('0x3c')](_['pick'](_0x122c62[_0x0117('0x3a')],_0x536b13[_0x0117('0x3c')]),_0xcf34a3);if(_0x122c62[_0x0117('0x3a')][_0x0117('0x46')]){_0x1c3912[_0x0117('0x45')]=_[_0x0117('0x47')](_0x1c3912[_0x0117('0x45')],{'$or':_[_0x0117('0x35')](_0xcf34a3,function(_0x123907){if(_0x123907[_0x0117('0x48')]!==_0x0117('0x49')){var _0x54d666={};_0x54d666[_0x123907[_0x0117('0x33')]]={'$like':'%'+_0x122c62[_0x0117('0x3a')][_0x0117('0x46')]+'%'};return _0x54d666;}})});}_0x1c3912=_[_0x0117('0x47')]({},_0x1c3912,_0x122c62[_0x0117('0x4a')]);var _0x257d8d={'where':_0x1c3912['where']};return db[_0x0117('0x36')][_0x0117('0x28')](_0x257d8d)[_0x0117('0x2f')](function(_0x15014b){_0x22416a[_0x0117('0x28')]=_0x15014b;if(_0x122c62[_0x0117('0x3a')]['includeAll']){_0x1c3912['include']=[{'all':!![]}];}return db[_0x0117('0x36')][_0x0117('0x4b')](_0x1c3912);})[_0x0117('0x2f')](function(_0x305f7a){_0x22416a['rows']=_0x305f7a;return _0x22416a;})[_0x0117('0x2f')](respondWithFilteredResult(_0x3d9e11,_0x1c3912))[_0x0117('0x4c')](handleError(_0x3d9e11,null));};exports[_0x0117('0x4d')]=function(_0x4935c0,_0x1ef8f9){var _0x2536f7={'raw':![],'where':{'id':_0x4935c0['params']['id']}},_0x313774={};_0x313774[_0x0117('0x4e')]=_[_0x0117('0x3b')](db[_0x0117('0x36')]['rawAttributes']);_0x313774['query']=_[_0x0117('0x3b')](_0x4935c0[_0x0117('0x3a')]);_0x313774[_0x0117('0x3c')]=_[_0x0117('0x3e')](_0x313774[_0x0117('0x4e')],_0x313774[_0x0117('0x3a')]);_0x2536f7[_0x0117('0x3d')]=_[_0x0117('0x3e')](_0x313774[_0x0117('0x4e')],qs[_0x0117('0x3f')](_0x4935c0[_0x0117('0x3a')][_0x0117('0x3f')]));_0x2536f7[_0x0117('0x3d')]=_0x2536f7[_0x0117('0x3d')][_0x0117('0x40')]?_0x2536f7[_0x0117('0x3d')]:_0x313774[_0x0117('0x4e')];if(_0x4935c0[_0x0117('0x3a')][_0x0117('0x4f')]){_0x2536f7[_0x0117('0x50')]=[{'all':!![]}];}_0x2536f7=_[_0x0117('0x47')]({},_0x2536f7,_0x4935c0[_0x0117('0x4a')]);return db['UserProfile'][_0x0117('0x51')](_0x2536f7)['then'](handleEntityNotFound(_0x1ef8f9,null))[_0x0117('0x2f')](respondWithResult(_0x1ef8f9,null))[_0x0117('0x4c')](handleError(_0x1ef8f9,null));};exports[_0x0117('0x52')]=function(_0x41f606,_0x42ce32){return db[_0x0117('0x36')][_0x0117('0x52')](_0x41f606[_0x0117('0x53')],{})[_0x0117('0x2f')](respondWithResult(_0x42ce32,0xc9))[_0x0117('0x4c')](handleError(_0x42ce32,null));};exports[_0x0117('0x54')]=function(_0x3c02ea,_0x20a12c){var _0x2cb566={'where':{'id':_0x3c02ea[_0x0117('0x55')]['id']}},_0x1129c0={};_0x1129c0[_0x0117('0x4e')]=_[_0x0117('0x3b')](db[_0x0117('0x36')][_0x0117('0x37')]);_0x2cb566['attributes']=_[_0x0117('0x3e')](_0x1129c0[_0x0117('0x4e')],qs[_0x0117('0x3f')](_0x3c02ea['query'][_0x0117('0x3f')]));_0x2cb566[_0x0117('0x3d')]=_0x2cb566[_0x0117('0x3d')][_0x0117('0x40')]?_0x2cb566['attributes']:_0x1129c0[_0x0117('0x4e')];if(_0x3c02ea['query'][_0x0117('0x4f')]){_0x2cb566[_0x0117('0x50')]=[{'all':!![]}];}_0x2cb566=_[_0x0117('0x47')]({},_0x2cb566,_0x3c02ea[_0x0117('0x4a')]);return db[_0x0117('0x36')][_0x0117('0x51')](_0x2cb566)[_0x0117('0x2f')](handleEntityNotFound(_0x20a12c,null))[_0x0117('0x2f')](function(_0x1c58b6){if(_0x1c58b6){var _0x597cf5=_0x1c58b6['get']({'plain':!![]});_0x597cf5=qs[_0x0117('0x56')](_0x597cf5,['id',_0x0117('0x57'),'updatedAt',_0x0117('0x58')]);_0x3c02ea['body']=_[_0x0117('0x56')](_0x3c02ea[_0x0117('0x53')],['id',_0x0117('0x57'),_0x0117('0x59')]);return db[_0x0117('0x5a')][_0x0117('0x5b')](function(_0x5e6b65){return db[_0x0117('0x36')][_0x0117('0x52')](_[_0x0117('0x47')](_0x597cf5,_0x3c02ea['body']),{'include':_0x3c02ea['query'][_0x0117('0x4f')]?[{'all':!![]}]:undefined,'transaction':_0x5e6b65})['then'](function(_0x231fc0){var _0x579ff0=_0x231fc0[_0x0117('0x5c')]({'plain':!![]});return db[_0x0117('0x5d')]['findAll']({'where':{'userProfileId':_0x3c02ea[_0x0117('0x55')]['id']},'raw':!![]})['then'](function(_0x34f452){if(_0x34f452){return BPromise['each'](_0x34f452,function(_0x3d6a0a){return new BPromise(function(_0x1ac66d,_0x57f725){if(_0x3d6a0a[_0x0117('0x5e')]===null||_0x3d6a0a['autoAssociation']===0x1)_0x1ac66d(null);return db[_0x0117('0x5f')][_0x0117('0x4b')]({'where':{'sectionId':_0x3d6a0a['id']},'raw':!![]})[_0x0117('0x2f')](function(_0x6303bc){var _0x157f91=_['map'](_0x6303bc,function(_0x3bf933){return qs[_0x0117('0x56')](_0x3bf933,['id',_0x0117('0x57'),_0x0117('0x59'),_0x0117('0x60')]);});_0x1ac66d(_0x157f91);})[_0x0117('0x4c')](function(_0x238b5c){_0x57f725(_0x238b5c);});})['then'](function(_0x1a530b){var _0x16749c=qs[_0x0117('0x56')](_0x3d6a0a,['id',_0x0117('0x57'),'updatedAt']);_0x16749c[_0x0117('0x61')]=_0x579ff0['id'];if(_0x1a530b)_0x16749c[_0x0117('0x62')]=_0x1a530b;return _0x16749c;})[_0x0117('0x2f')](function(_0x37c47e){return db['UserProfileSection'][_0x0117('0x52')](_0x37c47e,{'include':[{'model':db[_0x0117('0x5f')],'as':'Resources'}],'raw':!![],'transaction':_0x5e6b65});});})['then'](function(){return _0x579ff0;});}});});});}})[_0x0117('0x2f')](respondWithResult(_0x20a12c,0xc9))['catch'](handleError(_0x20a12c,null));};exports[_0x0117('0x2e')]=function(_0x542187,_0x506c6d){if(_0x542187['body']['id']){delete _0x542187[_0x0117('0x53')]['id'];}return db[_0x0117('0x36')]['find']({'where':{'id':_0x542187[_0x0117('0x55')]['id']}})['then'](handleEntityNotFound(_0x506c6d,null))[_0x0117('0x2f')](saveUpdates(_0x542187[_0x0117('0x53')],null))[_0x0117('0x2f')](respondWithResult(_0x506c6d,null))[_0x0117('0x4c')](handleError(_0x506c6d,null));};exports[_0x0117('0x30')]=function(_0xaa4c62,_0x18b7bf){return db[_0x0117('0x36')][_0x0117('0x51')]({'where':{'id':_0xaa4c62[_0x0117('0x55')]['id']}})[_0x0117('0x2f')](handleEntityNotFound(_0x18b7bf,null))['then'](removeEntity(_0x18b7bf,null))[_0x0117('0x4c')](handleError(_0x18b7bf,null));};exports[_0x0117('0x63')]=function(_0x92dc11,_0x431b4e){return db['UserProfile'][_0x0117('0x63')]()[_0x0117('0x2f')](respondWithResult(_0x431b4e,null))[_0x0117('0x4c')](handleError(_0x431b4e,null));};exports['addSections']=function(_0x157793,_0x34fa68){var _0x3cd03b=_0x157793[_0x0117('0x53')];return db[_0x0117('0x36')][_0x0117('0x51')]({'where':{'id':_0x157793[_0x0117('0x55')]['id']}})[_0x0117('0x2f')](handleEntityNotFound(_0x34fa68,null))['then'](function(_0x5a7711){if(_0x5a7711){return db['sequelize']['transaction'](function(_0x245bc9){return db[_0x0117('0x5d')][_0x0117('0x30')]({'where':{'userProfileId':_0x157793[_0x0117('0x55')]['id'],'sectionId':_[_0x0117('0x35')](_0x3cd03b,function(_0x2325ee){return _0x2325ee[_0x0117('0x60')];})},'transaction':_0x245bc9})[_0x0117('0x2f')](function(){var _0x3ee6ca=_['map'](_0x3cd03b,function(_0x4a3329){_0x4a3329['userProfileId']=_0x157793[_0x0117('0x55')]['id'];return _0x4a3329;});var _0x25ba6a=[];return BPromise[_0x0117('0x64')](_0x3ee6ca,function(_0x2cd746){return db['UserProfileSection'][_0x0117('0x52')](_0x2cd746,{'include':[{'model':db[_0x0117('0x5f')],'as':_0x0117('0x62')}],'raw':!![],'transaction':_0x245bc9})[_0x0117('0x2f')](function(_0x3dd91f){_0x25ba6a[_0x0117('0x65')](_0x3dd91f['get']({'plain':!![]}));});})[_0x0117('0x2f')](function(){return _0x25ba6a;});});});}})['then'](function(_0x27555d){return _0x27555d;})['then'](respondWithResult(_0x34fa68,null))[_0x0117('0x4c')](handleError(_0x34fa68,null));};exports[_0x0117('0x66')]=function(_0x2462e3,_0x117081){var _0x5cfb78;return db[_0x0117('0x36')]['find']({'where':{'id':_0x2462e3['params']['id']},'attributes':['id',_0x0117('0x33')]})[_0x0117('0x2f')](handleEntityNotFound(_0x117081,null))[_0x0117('0x2f')](function(_0x165ce7){if(_0x165ce7){_0x5cfb78=_0x165ce7;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2462e3[_0x0117('0x55')]['id'],'sectionId':_0x2462e3[_0x0117('0x3a')]['ids']}});}})['then'](function(){return _0x5cfb78;})[_0x0117('0x2f')](respondWithStatusCode(_0x117081,null))[_0x0117('0x4c')](handleError(_0x117081,null));};exports[_0x0117('0x67')]=function(_0x408ab6,_0x478725){var _0x4d4247=[];var _0x3ed941=[];return db[_0x0117('0x5d')][_0x0117('0x4b')]({'where':{'userProfileId':_0x408ab6['params']['id']},'raw':!![]})['then'](function(_0xe10b2){_0x4d4247=_[_0x0117('0x46')](_0xe10b2,function(_0x1acae){return _0x1acae['enabled']===0x1||_[_0x0117('0x68')]([0x3eb,0x709],_0x1acae['sectionId']);});if(!_['isEmpty'](_0x4d4247)){return _[_0x0117('0x35')](_0x4d4247,function(_0x2a687c){return _0x2a687c['sectionId'];});}else{return;}})[_0x0117('0x2f')](function(_0x526e3f){if(_0x526e3f)_0x3ed941=_0x526e3f;if(_[_0x0117('0x68')](_0x3ed941,0x64)){var _0x6bec79=_[_0x0117('0x51')](_0x4d4247,{'sectionId':0x64});return hasDefaultDashboard(_0x6bec79)[_0x0117('0x2f')](function(_0x13a5d9){return _[_0x0117('0x35')](_0x4d4247,function(_0x376cec){if(_0x376cec[_0x0117('0x60')]===0x64){_0x376cec[_0x0117('0x69')]=_0x13a5d9;}return _0x376cec;});});}else{return;}})['then'](function(_0x4af859){if(_0x4af859)_0x4d4247=_0x4af859;if(_['includes'](_0x3ed941,0x3eb)){var _0x29a8ea=_['find'](_0x4d4247,{'sectionId':0x3eb});return getCustomDashboards(_0x29a8ea)[_0x0117('0x2f')](function(_0x40d8ee){return _[_0x0117('0x35')](_0x4d4247,function(_0x470667){if(_0x29a8ea[_0x0117('0x6a')]){if(_0x470667[_0x0117('0x60')]===0x3eb){_0x470667[_0x0117('0x69')]=_0x40d8ee;}}else{if(_0x470667['sectionId']===0x64){if(!_0x470667[_0x0117('0x69')]){_0x470667[_0x0117('0x69')]=[];}_0x470667[_0x0117('0x69')]=_0x470667['subsections'][_0x0117('0x6b')](_0x40d8ee);}}return _0x470667;});});}else{return;}})['then'](function(_0x4742b4){if(_0x4742b4)_0x4d4247=_0x4742b4;if(_[_0x0117('0x68')](_0x3ed941,0x709)){var _0x4e1fb8=_[_0x0117('0x51')](_0x4d4247,{'sectionId':0x709});return getPlugins(_0x4e1fb8)['then'](function(_0x3f9bd4){if(_0x4e1fb8[_0x0117('0x6a')]){return _[_0x0117('0x35')](_0x4d4247,function(_0x4790a7){if(_0x4790a7[_0x0117('0x60')]===0x709){_0x4790a7[_0x0117('0x69')]=_0x3f9bd4;}return _0x4790a7;});}else{var _0x3453c1={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3f9bd4};var _0x1e0840=_[_0x0117('0x35')](_0x4d4247);_0x1e0840[_0x0117('0x65')](_0x3453c1);return _0x1e0840;}});}else{return;}})[_0x0117('0x2f')](function(_0x4c6421){if(_0x4c6421)_0x4d4247=_0x4c6421;return _[_0x0117('0x46')](_0x4d4247,[_0x0117('0x6a'),0x1]);})[_0x0117('0x2f')](respondWithResult(_0x478725,null))[_0x0117('0x4c')](handleError(_0x478725,null));};function hasDefaultDashboard(_0x2587cc){var _0x5cfac8=[0x65];return new BPromise(function(_0x540c96,_0x5bbf61){try{if(_0x2587cc['autoAssociation']){_0x540c96(_0x5cfac8);}else{return db[_0x0117('0x5f')][_0x0117('0x6c')]({'where':{'sectionId':_0x2587cc['id']},'raw':!![]})[_0x0117('0x2f')](function(_0x346ef2){_0x346ef2?_0x540c96(_0x5cfac8):_0x540c96();});}}catch(_0x10010c){_0x5bbf61(_0x10010c);}});}function getCustomDashboards(_0x2ad24a){var _0x2d8948=[];return new BPromise(function(_0x803185,_0x8993df){try{if(_0x2ad24a[_0x0117('0x5e')]){return db[_0x0117('0x6d')][_0x0117('0x4b')]({'raw':!![]})[_0x0117('0x2f')](function(_0x2daa55){_0x2daa55['forEach'](function(_0x549125){_0x2d8948[_0x0117('0x65')](_0x549125['id']+0x1869f);});_0x803185(_0x2d8948);});}else{return db[_0x0117('0x5f')][_0x0117('0x4b')]({'where':{'sectionId':_0x2ad24a['id']},'raw':!![]})[_0x0117('0x2f')](function(_0x12032d){_0x12032d[_0x0117('0x6e')](function(_0x3b3951){_0x2d8948[_0x0117('0x65')](_0x3b3951[_0x0117('0x6f')]+0x1869f);});_0x803185(_0x2d8948);});}}catch(_0x35418d){_0x8993df(_0x35418d);}});}function getPlugins(_0x50738a){var _0x40bdc8=[];return new BPromise(function(_0x221fb0,_0x418789){try{if(_0x50738a[_0x0117('0x5e')]){return db[_0x0117('0x70')][_0x0117('0x4b')]({'raw':!![]})[_0x0117('0x2f')](function(_0x2c70d0){_0x2c70d0['forEach'](function(_0x55b68b){_0x40bdc8[_0x0117('0x65')](_0x55b68b['id']+0x15b38);});_0x221fb0(_0x40bdc8);});}else{return db[_0x0117('0x5f')][_0x0117('0x4b')]({'where':{'sectionId':_0x50738a['id']},'raw':!![]})['then'](function(_0x1bee9e){_0x1bee9e[_0x0117('0x6e')](function(_0x45108f){_0x40bdc8['push'](_0x45108f[_0x0117('0x6f')]+0x15b38);});_0x221fb0(_0x40bdc8);});}}catch(_0x4db4d6){_0x418789(_0x4db4d6);}});}exports[_0x0117('0x71')]=function(_0x3ab0d1,_0x17f4e9){return db[_0x0117('0x36')][_0x0117('0x51')]({'where':{'id':_0x3ab0d1[_0x0117('0x55')]['id']}})['then'](handleEntityNotFound(_0x17f4e9,null))[_0x0117('0x2f')](function(_0x48adb8){if(_0x48adb8){return db[_0x0117('0x5a')][_0x0117('0x5b')](function(_0x2ed134){return db[_0x0117('0x5d')]['findAll']({'where':{'userProfileId':_0x3ab0d1[_0x0117('0x55')]['id']},'attributes':['id'],'raw':!![]})[_0x0117('0x2f')](function(_0x165e06){if(_0x165e06){return db[_0x0117('0x5d')]['destroy']({'where':{'userProfileId':_0x3ab0d1[_0x0117('0x55')]['id'],'id':_[_0x0117('0x35')](_0x165e06,function(_0x58ebe6){return _0x58ebe6['id'];})},'transaction':_0x2ed134});}})[_0x0117('0x2f')](function(_0x3cf07d){var _0x5a0b83=_[_0x0117('0x35')](_0x3ab0d1['body'],function(_0x1d2f6f){_0x1d2f6f[_0x0117('0x61')]=_0x3ab0d1['params']['id'];return _0x1d2f6f;});return db[_0x0117('0x5d')][_0x0117('0x72')](_0x5a0b83,{'raw':!![],'transaction':_0x2ed134});})['then'](function(_0x39e4de){var _0x3ab531=_[_0x0117('0x46')](_['map'](_0x39e4de,function(_0x286ff3){return _0x286ff3[_0x0117('0x5c')]({'plain':!![]});}),{'includeAll':![]});if(_0x3ab531){return db['UserProfileSection'][_0x0117('0x4b')]({'where':{'userProfileId':_0x3ab0d1[_0x0117('0x55')]['id'],'sectionId':_[_0x0117('0x35')](_0x3ab531,function(_0xec1987){return _0xec1987['sectionId'];})},'attributes':['id',_0x0117('0x60')],'raw':!![]})[_0x0117('0x2f')](function(_0xa36cb5){var _0xcca3df=_['map'](_0x3ab0d1[_0x0117('0x53')],function(_0x16ac48){_0x16ac48[_0x0117('0x61')]=_0x3ab0d1[_0x0117('0x55')]['id'];return _0x16ac48;});return db['UserProfileResource'][_0x0117('0x72')](_0xcca3df,{'raw':!![],'transaction':_0x2ed134});});}})[_0x0117('0x4c')](handleError(_0x17f4e9,null));});}})['then'](function(_0x351645){var _0x2d00d1=_[_0x0117('0x35')](_0x351645,function(_0x21a6b9){return _0x21a6b9[_0x0117('0x5c')]({'plain':!![]});});})[_0x0117('0x2f')](respondWithResult(_0x17f4e9,null))[_0x0117('0x4c')](handleError(_0x17f4e9,null));};exports[_0x0117('0x73')]=function(_0x318cb5,_0x4cb2d3,_0x4e967){return db['UserProfile'][_0x0117('0x51')]({'where':{'id':_0x318cb5[_0x0117('0x55')]['id']}})[_0x0117('0x2f')](handleEntityNotFound(_0x4cb2d3,null))[_0x0117('0x2f')](function(_0x874f2a){if(_0x874f2a){return _0x874f2a[_0x0117('0x73')](_0x318cb5[_0x0117('0x3a')][_0x0117('0x74')]);}})['then'](respondWithStatusCode(_0x4cb2d3,null))[_0x0117('0x4c')](handleError(_0x4cb2d3,null));};exports['getResources']=function(_0x522dbb,_0x3d0d8f){var _0x11235a={};if(!_0x522dbb[_0x0117('0x3a')][_0x0117('0x75')])throw new Error(_0x0117('0x76'));if(!_0x522dbb[_0x0117('0x3a')][_0x0117('0x41')]('nolimit')){_0x11235a['limit']=qs[_0x0117('0x27')](_0x522dbb['query'][_0x0117('0x27')]);_0x11235a[_0x0117('0x29')]=qs[_0x0117('0x29')](_0x522dbb[_0x0117('0x3a')][_0x0117('0x29')]);}return db[_0x0117('0x36')][_0x0117('0x51')]({'where':{'id':_0x522dbb[_0x0117('0x55')]['id']}})['then'](function(_0x3a9052){if(!_0x3a9052)throw new Error(_0x0117('0x77')+_0x522dbb[_0x0117('0x55')]['id']);return db['UserProfile'][_0x0117('0x78')](_0x522dbb);})[_0x0117('0x2f')](respondWithFilteredResult(_0x3d0d8f,_0x11235a))['catch'](handleError(_0x3d0d8f,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 662295c..ad00ff2 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 _0x4bd3=['events','UserProfile','setMaxListeners','emit','hook','exports'];(function(_0x2d7605,_0x5ad4ca){var _0x2410f2=function(_0x1a6e8f){while(--_0x1a6e8f){_0x2d7605['push'](_0x2d7605['shift']());}};_0x2410f2(++_0x5ad4ca);}(_0x4bd3,0x174));var _0x34bd=function(_0x1b8e34,_0x427436){_0x1b8e34=_0x1b8e34-0x0;var _0xb2ded4=_0x4bd3[_0x1b8e34];return _0xb2ded4;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x34bd('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){UserProfileEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);UserProfileEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=UserProfileEvents; \ No newline at end of file +var _0x41ec=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x176e02,_0x4c5805){var _0x330796=function(_0x48f781){while(--_0x48f781){_0x176e02['push'](_0x176e02['shift']());}};_0x330796(++_0x4c5805);}(_0x41ec,0x143));var _0xc41e=function(_0x20242f,_0x12d3a4){_0x20242f=_0x20242f-0x0;var _0x3294b4=_0x41ec[_0x20242f];return _0x3294b4;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xc41e('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc41e('0x1')](0x0);var events={'afterCreate':_0xc41e('0x2'),'afterUpdate':'update','afterDestroy':_0xc41e('0x3')};function emitEvent(_0x19ed31){return function(_0xd3f764,_0xf79325,_0xaa14e8){UserProfileEvents[_0xc41e('0x4')](_0x19ed31+':'+_0xd3f764['id'],_0xd3f764);UserProfileEvents[_0xc41e('0x4')](_0x19ed31,_0xd3f764);_0xaa14e8(null);};}for(var e in events){if(events[_0xc41e('0x5')](e)){var event=events[e];UserProfile[_0xc41e('0x6')](e,emitEvent(event));}}module[_0xc41e('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index fd863e1..f6f5934 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 _0xc3af=['CmList','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','mailaccounts','MailAccount','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','VoiceQueues','QueueCampaigns','users','agents','Users','user','Agents','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','variables','Variable','plugins','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','model','keys','filters','attributes','intersection','fields','nolimit','limit','offset','order','sort','pick','where','key','VIRTUAL','foreignKey','merge','options','includeAll','include','forEach','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','field','value','findAll','map','catch','then','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','childModel','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','lists'];(function(_0x1f60c4,_0x1c58e5){var _0x4d3340=function(_0x335584){while(--_0x335584){_0x1f60c4['push'](_0x1f60c4['shift']());}};_0x4d3340(++_0x1c58e5);}(_0xc3af,0x15b));var _0xfc3a=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0xc3af[_0x21353c];return _0xa99120;};'use strict';var _=require(_0xfc3a('0x0'));var attributes=require(_0xfc3a('0x1'));var squel=require('squel');module['exports']=function(_0x12709e){var _0x309a4f=_0x12709e[_0xfc3a('0x2')];function _0x5265e0(_0x1804fb,_0x1b72d0){return new Promise(function(_0x225140,_0x249e0c){if(!_0x1b72d0)return _0x225140(null);var _0x4224b4=_0x1b72d0[_0xfc3a('0x3')]?{[_0x1b72d0[_0xfc3a('0x3')][_0xfc3a('0x4')]]:_0x1b72d0[_0xfc3a('0x3')][_0xfc3a('0x5')]}:undefined;return _0x309a4f[_0x1804fb][_0xfc3a('0x6')]({'where':_0x4224b4,'raw':!![]})['then'](function(_0x134586){_0x1b72d0['associatedResources']=_[_0xfc3a('0x7')](_0x134586,'id');_0x225140(_0x1b72d0);})[_0xfc3a('0x8')](function(_0x22e15b){_0x249e0c(_0x22e15b);});});}function _0x3f2c41(_0x2035e9,_0x34375b){return new Promise(function(_0x23ffb7,_0x584a6c){var _0x1c7d88=_0x2035e9[_0xfc3a('0x3')]?{[_0x2035e9[_0xfc3a('0x3')][_0xfc3a('0x4')]]:_0x2035e9[_0xfc3a('0x3')][_0xfc3a('0x5')]}:undefined;return _0x309a4f[_0x2035e9['model']][_0xfc3a('0x6')]({'where':_0x1c7d88,'raw':!![]})[_0xfc3a('0x9')](function(_0x16f23d){_0x34375b[_0xfc3a('0xa')]=_['map'](_0x16f23d,function(_0x506e03){return _0x506e03[_0xfc3a('0xb')];});_0x23ffb7(_0x34375b);})[_0xfc3a('0x8')](function(_0x125fb8){_0x584a6c(_0x125fb8);});});}function _0x559987(_0x10a3a0,_0x432299,_0x30b5e6){if(!_0x432299)return Promise[_0xfc3a('0xc')](null);return new Promise(function(_0x520105,_0x515a03){return _0x309a4f[_0xfc3a('0xd')][_0xfc3a('0x6')]({'where':{'sectionId':_0x432299['id']},'raw':!![]})[_0xfc3a('0x9')](function(_0x528c57){if(_0x10a3a0[_0xfc3a('0x4')]&&_0x10a3a0[_0xfc3a('0x4')]!=='id'){_0x432299[_0xfc3a('0xa')]=_['map'](_0x528c57,function(_0x3bd023){return _0x3bd023[_0x10a3a0[_0xfc3a('0x4')]];});}else{if(_0x30b5e6===_0xfc3a('0xe')){_0x432299['associatedResources']=_[_0xfc3a('0x7')](_0x528c57,function(_0x20aa17){return{'id':_0x20aa17[_0xfc3a('0xf')],'type':_0x20aa17[_0xfc3a('0x10')]};});}else{_0x432299[_0xfc3a('0xa')]=_[_0xfc3a('0x7')](_0x528c57,function(_0x486434){return _0x486434[_0xfc3a('0xf')];});}}_0x520105(_0x432299);})[_0xfc3a('0x8')](function(_0x43cf4a){_0x515a03(_0x43cf4a);});});}function _0x4dea7d(_0x44b270,_0xf898d5){var _0x54ee6a={'parentSections':[]};switch(_0x44b270[_0xfc3a('0x11')]()){case _0xfc3a('0x12'):_0x54ee6a['childModel']=_0xfc3a('0x13');break;case _0xfc3a('0x14'):_0x54ee6a['childModel']=_0xfc3a('0x15');break;case _0xfc3a('0x16'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x18');_0x54ee6a[_0xfc3a('0x19')]=[{'name':_0xfc3a('0x1a'),'field':_0xfc3a('0xb'),'foreignKey':'projectName'}];break;case _0xfc3a('0x1b'):_0x54ee6a['childModel']=_0xfc3a('0x1c');break;case _0xfc3a('0x1d'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x1e');_0x54ee6a[_0xfc3a('0x19')]=[{'name':_0xfc3a('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0xfc3a('0x20'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x21');break;case'companies':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x22');break;case _0xfc3a('0x23'):_0x54ee6a['childModel']='CmCustomField';break;case _0xfc3a('0x24'):_0x54ee6a[_0xfc3a('0x17')]='ChatQueue';break;case _0xfc3a('0x25'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x26');break;case'faxqueues':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x27');break;case _0xfc3a('0x28'):_0x54ee6a[_0xfc3a('0x17')]='FaxAccount';break;case _0xfc3a('0x29'):case _0xfc3a('0x2a'):case _0xfc3a('0x2b'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x2c');break;case _0xfc3a('0x2d'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x2e');break;case _0xfc3a('0x2f'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x30');break;case _0xfc3a('0x31'):_0x54ee6a['childModel']=_0xfc3a('0x32');_0x54ee6a[_0xfc3a('0x19')]=[{'name':'Agents','field':_0xfc3a('0xb'),'foreignKey':_0xfc3a('0x33'),'model':_0xfc3a('0x34'),'filter':{'field':_0xfc3a('0x35'),'value':[_0xfc3a('0x36')]}},{'name':_0xfc3a('0x37'),'field':_0xfc3a('0xb'),'foreignKey':_0xfc3a('0x33'),'model':_0xfc3a('0x34'),'filter':{'field':_0xfc3a('0x35'),'value':[_0xfc3a('0x38')]}},{'name':'VoiceQueues','field':_0xfc3a('0xb'),'foreignKey':_0xfc3a('0x39'),'model':_0xfc3a('0x3a'),'filter':{'field':_0xfc3a('0x10'),'value':[_0xfc3a('0x3b')]}},{'name':'QueueCampaigns','field':_0xfc3a('0xb'),'foreignKey':_0xfc3a('0x39'),'model':_0xfc3a('0x3a'),'filter':{'field':_0xfc3a('0x10'),'value':[_0xfc3a('0x3c')]}}];break;case'musiconholds':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x3d');break;case _0xfc3a('0x3e'):_0x54ee6a['childModel']=_0xfc3a('0x3f');break;case _0xfc3a('0x40'):_0x54ee6a[_0xfc3a('0x17')]='VoicePrefix';break;case'ivrcampaigns':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x41');break;case _0xfc3a('0x42'):_0x54ee6a[_0xfc3a('0x17')]='MailQueue';break;case _0xfc3a('0x43'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x44');break;case'mailsubstatuses':_0x54ee6a[_0xfc3a('0x17')]='MailSubstatus';break;case'openchannelqueues':_0x54ee6a['childModel']=_0xfc3a('0x45');break;case'openchannelaccounts':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x46');break;case _0xfc3a('0x47'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x48');break;case _0xfc3a('0x49'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x4a');break;case _0xfc3a('0x4b'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x4c');break;case _0xfc3a('0x4d'):_0x54ee6a[_0xfc3a('0x17')]='WhatsappAccount';break;case _0xfc3a('0x4e'):_0x54ee6a[_0xfc3a('0x17')]='Team';break;case'voicequeues':case'queuecampaigns':_0x54ee6a[_0xfc3a('0x17')]='VoiceQueue';if(_0xf898d5){_0x54ee6a['parentSections']=[{'name':_0xfc3a('0x4f')},{'name':_0xfc3a('0x50')}];}break;case _0xfc3a('0x51'):case _0xfc3a('0x52'):case'telephones':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x34');if(_0xf898d5){_0x54ee6a['parentSections']=[{'name':_0xfc3a('0x53'),'filter':{'field':_0xfc3a('0x35'),'value':['admin',_0xfc3a('0x54')]},'ignore':!![]},{'name':_0xfc3a('0x55')},{'name':_0xfc3a('0x37')}];}break;case _0xfc3a('0x56'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x57');break;case'salesforceaccounts':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x58');break;case _0xfc3a('0x59'):_0x54ee6a['childModel']=_0xfc3a('0x5a');break;case _0xfc3a('0x5b'):_0x54ee6a[_0xfc3a('0x17')]='SugarcrmAccount';break;case _0xfc3a('0x5c'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x5d');break;case _0xfc3a('0x5e'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x5f');break;case _0xfc3a('0x60'):_0x54ee6a['childModel']=_0xfc3a('0x34');break;case _0xfc3a('0x61'):_0x54ee6a[_0xfc3a('0x17')]='CannedAnswer';break;case _0xfc3a('0x62'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x63');break;case _0xfc3a('0x64'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x65');break;case _0xfc3a('0x66'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x67');break;case _0xfc3a('0x68'):_0x54ee6a[_0xfc3a('0x17')]='Pause';break;case _0xfc3a('0x69'):_0x54ee6a['childModel']=_0xfc3a('0x6a');break;case _0xfc3a('0x6b'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x6c');break;case _0xfc3a('0x6d'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x6e');break;case _0xfc3a('0x6f'):_0x54ee6a['childModel']=_0xfc3a('0x70');break;case _0xfc3a('0x71'):_0x54ee6a['childModel']='Trigger';break;case _0xfc3a('0x72'):_0x54ee6a[_0xfc3a('0x17')]='Trunk';break;case _0xfc3a('0x73'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x74');break;case _0xfc3a('0x75'):_0x54ee6a[_0xfc3a('0x17')]='Plugin';break;case _0xfc3a('0x76'):_0x54ee6a['childModel']='AnalyticExtractedReport';_0x54ee6a['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xfc3a('0x77')}];break;case _0xfc3a('0x78'):_0x54ee6a['childModel']=_0xfc3a('0x79');break;}return _0x54ee6a;}function _0x31457d(_0x5d0f4d,_0x5324d9){var _0xaa0879=_0x5d0f4d[_0xfc3a('0x7a')](0x0)[_0xfc3a('0x7b')]()+_0x5d0f4d[_0xfc3a('0x7c')](0x1);var _0x5a556c={'type':_0x309a4f['Sequelize'][_0xfc3a('0x7d')][_0xfc3a('0x7e')],'raw':!![]};return new Promise(function(_0x4a7dc7,_0x2a20e9){var _0x7a62f7=squel[_0xfc3a('0x7f')]()['field'](_0xfc3a('0x80')+_0xaa0879+_0xfc3a('0x81'),'id')[_0xfc3a('0x4')](_0xfc3a('0x82'))[_0xfc3a('0x83')]('user_has_'+_0x5d0f4d+'_interactions','ui')['where'](_0xfc3a('0x84'),_0x5324d9['id']);return _0x309a4f['sequelize'][_0xfc3a('0x85')](_0x7a62f7[_0xfc3a('0x86')](),_0x5a556c)[_0xfc3a('0x9')](function(_0x2feff8){_0x5324d9[_0xaa0879+_0xfc3a('0x87')]=_0x2feff8;_0x4a7dc7(_0x2feff8);})[_0xfc3a('0x8')](function(_0x2f6c1b){_0x2a20e9(_0x2f6c1b);});});}return _0x12709e[_0xfc3a('0x88')]('UserProfile',attributes,{'tableName':_0xfc3a('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x25bc63){var _0x195c36=require(_0xfc3a('0x8a'));var _0x3dad92={'raw':_0x25bc63['query']['raw'],'where':{}};var _0x567752={};var _0xd455a3={'count':0x0,'rows':[]};var _0x17d39f=_0x25bc63['query'][_0xfc3a('0x8b')];var _0x5c7e09=_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0x8c')]||![];var _0x359976=_0x4dea7d(_0x17d39f,_0x5c7e09);if(!_0x359976[_0xfc3a('0x17')])throw new Error(_0xfc3a('0x8d')+_0x17d39f+'\x27');var _0x6f9721=[{'name':_0x17d39f}];if(!_[_0xfc3a('0x8e')](_0x359976[_0xfc3a('0x19')]))_0x6f9721=_0x359976[_0xfc3a('0x19')];var _0x54c9fd=[];for(var _0xe0d09c=0x0;_0xe0d09c<_0x6f9721[_0xfc3a('0x8f')];_0xe0d09c++){_0x54c9fd[_0xfc3a('0x90')](_0x309a4f[_0xfc3a('0x91')][_0xfc3a('0x92')]({'where':{'userProfileId':_0x25bc63[_0xfc3a('0x93')]['id'],'name':_0x6f9721[_0xe0d09c]['name']},'raw':!![]}));}return Promise[_0xfc3a('0x94')](_0x54c9fd)['then'](function(_0x567e48){var _0x105949=_['filter'](_0x567e48,function(_0x365533){return _0x365533?_0x365533:undefined;});var _0x50382e=_[_0xfc3a('0x3')](_0x6f9721,[_0xfc3a('0x95'),!![]]);var _0x3b8010=_['isEmpty'](_0x105949)&&_[_0xfc3a('0x8e')](_0x50382e)?null:_[_0xfc3a('0x96')](_0x50382e,_0x105949);if(!_0x3b8010)return null;var _0x4cb9a9=[];for(var _0x1fdb09=0x0;_0x1fdb09<_0x3b8010[_0xfc3a('0x8f')];_0x1fdb09++){var _0x2d0220=_[_0xfc3a('0x92')](_0x6f9721,function(_0xb55d77){return _0x3b8010[_0x1fdb09]?_0xb55d77[_0xfc3a('0xb')]===_0x3b8010[_0x1fdb09]['name']:null;});if(_0x2d0220){if(_0x3b8010[_0x1fdb09][_0xfc3a('0x95')]){_0x4cb9a9[_0xfc3a('0x90')](_0x5265e0(_0x359976[_0xfc3a('0x17')],_0x3b8010[_0x1fdb09]));}else{if(!_0x3b8010[_0x1fdb09][_0xfc3a('0x97')]){_0x4cb9a9[_0xfc3a('0x90')](_0x559987(_0x2d0220,_0x3b8010[_0x1fdb09],_0x359976[_0xfc3a('0x17')]));}else{if(_0x2d0220[_0xfc3a('0x98')]){_0x4cb9a9[_0xfc3a('0x90')](_0x3f2c41(_0x2d0220,_0x3b8010[_0x1fdb09]));}}}}}return Promise['all'](_0x4cb9a9);})[_0xfc3a('0x9')](function(_0x3bb1a0){var _0x55400b=_0x3bb1a0;var _0x542c46=null;if(_0x55400b){_0x542c46=_0x55400b['length']===0x1?_0x55400b[0x0]:null;}if(!_0x542c46&&!_0x55400b)return _0xd455a3;var _0xdc36b3=_0x309a4f[_0x359976['childModel']]['rawAttributes'];_0x567752[_0xfc3a('0x98')]=_['keys'](_0xdc36b3);_0x567752['query']=_[_0xfc3a('0x99')](_0x25bc63[_0xfc3a('0x85')]);_0x567752[_0xfc3a('0x9a')]=_['intersection'](_0x567752[_0xfc3a('0x98')],_0x567752[_0xfc3a('0x85')]);_0x3dad92[_0xfc3a('0x9b')]=_[_0xfc3a('0x9c')](_0x567752[_0xfc3a('0x98')],_0x195c36[_0xfc3a('0x9d')](_0x25bc63['query'][_0xfc3a('0x9d')]));_0x3dad92['attributes']=_0x3dad92['attributes']['length']?_0x3dad92['attributes']:_0x567752['model'];if(!_0x25bc63[_0xfc3a('0x85')]['hasOwnProperty'](_0xfc3a('0x9e'))){_0x3dad92['limit']=_0x195c36[_0xfc3a('0x9f')](_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0x9f')]);_0x3dad92[_0xfc3a('0xa0')]=_0x195c36['offset'](_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xa0')]);}_0x3dad92[_0xfc3a('0xa1')]=_0x195c36[_0xfc3a('0xa2')](_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xa2')]);_0x3dad92['where']=_0x195c36[_0xfc3a('0x9a')](_[_0xfc3a('0xa3')](_0x25bc63[_0xfc3a('0x85')],_0x567752[_0xfc3a('0x9a')]));if(_0x25bc63[_0xfc3a('0x85')]['filter']){_0x3dad92[_0xfc3a('0xa4')]=_['merge'](_0x3dad92['where'],{'$or':_[_0xfc3a('0x7')](_0xdc36b3,function(_0x344c36){if(_0x344c36[_0xfc3a('0x10')][_0xfc3a('0xa5')]!==_0xfc3a('0xa6')){var _0x468514={};_0x468514[_0x344c36['field']]={'$like':'%'+_0x25bc63[_0xfc3a('0x85')]['filter']+'%'};return _0x468514;}})});}var _0x34d5ce=[];var _0x11ced7=null;var _0x1a1109={};if(_0x542c46){_0x11ced7=_[_0xfc3a('0x92')](_0x6f9721,[_0xfc3a('0xb'),_0x542c46[_0xfc3a('0xb')]]);if(_0x11ced7['field']){_0x1a1109={};if(_0x359976['childModel']===_0xfc3a('0xe')){_0x1a1109[_0x11ced7[_0xfc3a('0xa7')]]=_[_0xfc3a('0x7')](_0x542c46[_0xfc3a('0xa')],'id');}else{_0x1a1109[_0x11ced7['foreignKey']]=_0x542c46[_0xfc3a('0xa')];}_0x34d5ce['push'](_0x1a1109);}else{_0x3dad92[_0xfc3a('0xa4')]['id']=_0x542c46[_0xfc3a('0xa')];}}else{for(var _0x21e2d4=0x0;_0x21e2d4<_0x55400b['length'];_0x21e2d4++){_0x11ced7=_['find'](_0x6f9721,[_0xfc3a('0xb'),_0x55400b[_0x21e2d4][_0xfc3a('0xb')]]);if(_0x11ced7[_0xfc3a('0x4')]){_0x1a1109={};_0x1a1109[_0x11ced7[_0xfc3a('0xa7')]]=_0x55400b[_0x21e2d4][_0xfc3a('0xa')];_0x34d5ce[_0xfc3a('0x90')](_0x1a1109);}else{if(!_0x3dad92[_0xfc3a('0xa4')]['id'])_0x3dad92['where']['id']=[];_0x55400b[_0x21e2d4][_0xfc3a('0xa')]['forEach'](function(_0x8d4c2d){_0x3dad92[_0xfc3a('0xa4')]['id']['push'](_0x8d4c2d);});}}}if(!_[_0xfc3a('0x8e')](_0x34d5ce)){_0x3dad92[_0xfc3a('0xa4')]=_['merge'](_0x3dad92['where'],{'$and':{'$or':_0x34d5ce}});}_0x3dad92=_[_0xfc3a('0xa8')]({},_0x3dad92,_0x25bc63[_0xfc3a('0xa9')]);if(_0x542c46&&!_0x542c46[_0xfc3a('0x97')]&&_0x359976['childModel']===_0xfc3a('0xe')){if(_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xaa')]){_0x3dad92[_0xfc3a('0xab')]=[{'all':!![]}];}return _0x309a4f[_0x359976[_0xfc3a('0x17')]][_0xfc3a('0x6')](_0x3dad92)['then'](function(_0x3f3adf){var _0x3ccad5=[];_0x3f3adf[_0xfc3a('0xac')](function(_0x396a96){var _0x503048;switch(_0x396a96['reportType']){case'default':_0x503048=_[_0xfc3a('0x92')](_0x542c46[_0xfc3a('0xa')],function(_0x14eb99){return _0x14eb99['id']===_0x396a96[_0xfc3a('0x77')]&&_0x14eb99[_0xfc3a('0x10')]==='DefaultReports';});break;case'custom':_0x503048=_[_0xfc3a('0x92')](_0x542c46[_0xfc3a('0xa')],function(_0x53ce33){return _0x53ce33['id']===_0x396a96[_0xfc3a('0x77')]&&_0x53ce33[_0xfc3a('0x10')]===_0xfc3a('0xad');});break;}if(_0x503048)_0x3ccad5[_0xfc3a('0x90')](_0x396a96);});_0xd455a3[_0xfc3a('0xae')]=_0x3ccad5[_0xfc3a('0x8f')];_0xd455a3[_0xfc3a('0xaf')]=_0x3ccad5;return _0xd455a3;});}else{if(!_[_0xfc3a('0x8e')](_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xb0')])){_0x3dad92[_0xfc3a('0xa4')]['id']=_0x3dad92[_0xfc3a('0xa4')]['id']?_[_0xfc3a('0x9c')](_0x3dad92[_0xfc3a('0xa4')]['id'],_0x25bc63['query'][_0xfc3a('0xb0')]):_0x25bc63[_0xfc3a('0x85')]['ids'];if(_0x25bc63['query'][_0xfc3a('0xb1')]){_0x3dad92[_0xfc3a('0xa1')]=_0x25bc63['query'][_0xfc3a('0xb1')];}}if(_0x25bc63[_0xfc3a('0x85')]['extraQueryConditions']){_0x3dad92[_0xfc3a('0xa4')]=_[_0xfc3a('0xa8')](_0x3dad92[_0xfc3a('0xa4')],{'$and':_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xb2')]});}return _0x309a4f[_0x359976[_0xfc3a('0x17')]][_0xfc3a('0xae')]({'where':_0x3dad92[_0xfc3a('0xa4')]})[_0xfc3a('0x9')](function(_0x46ef93){_0xd455a3[_0xfc3a('0xae')]=_0x46ef93;if(_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xaa')]){if(_0x359976[_0xfc3a('0x17')]===_0xfc3a('0x1e')){_0x3dad92[_0xfc3a('0xab')]=[{'model':_0x309a4f[_0xfc3a('0x6e')],'as':_0xfc3a('0xb3'),'attributes':['id',_0xfc3a('0xb'),_0xfc3a('0xb4')],'required':_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xb5')]?!![]:![]},{'model':_0x309a4f[_0xfc3a('0x6e')],'as':'ThroughTags','attributes':['id',_0xfc3a('0xb'),_0xfc3a('0xb4')],'through':_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xb5')]?{'attributes':[],'where':{'TagId':_0x25bc63[_0xfc3a('0x85')]['tag']||undefined}}:{},'required':_0x25bc63[_0xfc3a('0x85')]['tag']?!![]:![]}];}else{_0x3dad92[_0xfc3a('0xab')]=[{'all':!![]}];}}return _0x309a4f[_0x359976[_0xfc3a('0x17')]][_0xfc3a('0x6')](_0x3dad92);})[_0xfc3a('0x9')](function(_0x4821ba){_0xd455a3[_0xfc3a('0xaf')]=_0x4821ba;if(_0x17d39f===_0xfc3a('0x55')&&_0x25bc63[_0xfc3a('0x85')]['openTabs']===_0xfc3a('0xb6')){var _0xdb7de2=[];for(var _0x194900=0x0;_0x194900<_0xd455a3['rows']['length'];_0x194900++){_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xb7'),_0xd455a3['rows'][_0x194900]['dataValues']));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xb8'),_0xd455a3[_0xfc3a('0xaf')][_0x194900][_0xfc3a('0xb9')]));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xba'),_0xd455a3[_0xfc3a('0xaf')][_0x194900][_0xfc3a('0xb9')]));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xbb'),_0xd455a3[_0xfc3a('0xaf')][_0x194900][_0xfc3a('0xb9')]));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xbc'),_0xd455a3['rows'][_0x194900][_0xfc3a('0xb9')]));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xbd'),_0xd455a3[_0xfc3a('0xaf')][_0x194900][_0xfc3a('0xb9')]));}return Promise[_0xfc3a('0x94')](_0xdb7de2)[_0xfc3a('0x9')](function(){return _0xd455a3;});}return _0xd455a3;});}});}}});}; \ No newline at end of file +var _0x0923=['length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports','CustomReports','rows','ids','customSorting','order','extraQueryConditions','count','Tags','tag','ThroughTags','color','openTabs','true','chat','dataValues','fax','mail','lodash','./userProfile.attributes','squel','exports','models','filter','findAll','map','field','value','model','then','UserProfileResource','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','JscriptyProject','contacts','CmContact','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','role','telephone','queue','outbound','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','VoiceQueue','QueueCampaigns','agents','Users','admin','user','Telephones','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','UserProfile','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty'];(function(_0x3a9203,_0x12bf8e){var _0x4498f4=function(_0x415cab){while(--_0x415cab){_0x3a9203['push'](_0x3a9203['shift']());}};_0x4498f4(++_0x12bf8e);}(_0x0923,0x1ab));var _0x3092=function(_0x45a8da,_0x4f2bf7){_0x45a8da=_0x45a8da-0x0;var _0x7c91a7=_0x0923[_0x45a8da];return _0x7c91a7;};'use strict';var _=require(_0x3092('0x0'));var attributes=require(_0x3092('0x1'));var squel=require(_0x3092('0x2'));module[_0x3092('0x3')]=function(_0x5b7779){var _0x44a165=_0x5b7779[_0x3092('0x4')];function _0x3ebddc(_0x538a04,_0x1bfa71){return new Promise(function(_0x330ef4,_0x595d5d){if(!_0x1bfa71)return _0x330ef4(null);var _0x3ef334=_0x1bfa71[_0x3092('0x5')]?{[_0x1bfa71[_0x3092('0x5')]['field']]:_0x1bfa71[_0x3092('0x5')]['value']}:undefined;return _0x44a165[_0x538a04][_0x3092('0x6')]({'where':_0x3ef334,'raw':!![]})['then'](function(_0x123b17){_0x1bfa71['associatedResources']=_[_0x3092('0x7')](_0x123b17,'id');_0x330ef4(_0x1bfa71);})['catch'](function(_0x426be6){_0x595d5d(_0x426be6);});});}function _0x5d4565(_0x1eeec9,_0x5b20ea){return new Promise(function(_0xba11fa,_0x467188){var _0x207fd7=_0x1eeec9[_0x3092('0x5')]?{[_0x1eeec9[_0x3092('0x5')][_0x3092('0x8')]]:_0x1eeec9['filter'][_0x3092('0x9')]}:undefined;return _0x44a165[_0x1eeec9[_0x3092('0xa')]][_0x3092('0x6')]({'where':_0x207fd7,'raw':!![]})[_0x3092('0xb')](function(_0x1378b5){_0x5b20ea['associatedResources']=_['map'](_0x1378b5,function(_0x465259){return _0x465259['name'];});_0xba11fa(_0x5b20ea);})['catch'](function(_0x3052f6){_0x467188(_0x3052f6);});});}function _0x24a511(_0xc5d16e,_0x30a6e3,_0x48e529){if(!_0x30a6e3)return Promise['resolve'](null);return new Promise(function(_0x3c0697,_0x2fdf9a){return _0x44a165[_0x3092('0xc')][_0x3092('0x6')]({'where':{'sectionId':_0x30a6e3['id']},'raw':!![]})[_0x3092('0xb')](function(_0x132f09){if(_0xc5d16e[_0x3092('0x8')]&&_0xc5d16e[_0x3092('0x8')]!=='id'){_0x30a6e3[_0x3092('0xd')]=_[_0x3092('0x7')](_0x132f09,function(_0x4bad76){return _0x4bad76[_0xc5d16e[_0x3092('0x8')]];});}else{if(_0x48e529===_0x3092('0xe')){_0x30a6e3['associatedResources']=_[_0x3092('0x7')](_0x132f09,function(_0x2bfe7d){return{'id':_0x2bfe7d[_0x3092('0xf')],'type':_0x2bfe7d[_0x3092('0x10')]};});}else{_0x30a6e3[_0x3092('0xd')]=_['map'](_0x132f09,function(_0x106c67){return _0x106c67[_0x3092('0xf')];});}}_0x3c0697(_0x30a6e3);})['catch'](function(_0x3a1eab){_0x2fdf9a(_0x3a1eab);});});}function _0x1bf399(_0x3b0039,_0x1c1116){var _0xa5f581={'parentSections':[]};switch(_0x3b0039[_0x3092('0x11')]()){case _0x3092('0x12'):_0xa5f581['childModel']='SquareProject';break;case _0x3092('0x13'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x15');break;case _0x3092('0x16'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x17');_0xa5f581[_0x3092('0x18')]=[{'name':_0x3092('0x19'),'field':_0x3092('0x1a'),'foreignKey':_0x3092('0x1b')}];break;case'projects':_0xa5f581[_0x3092('0x14')]=_0x3092('0x1c');break;case _0x3092('0x1d'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x1e');_0xa5f581[_0x3092('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0x3092('0x1f')}];break;case _0x3092('0x20'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x21');break;case _0x3092('0x22'):_0xa5f581[_0x3092('0x14')]='CmCompany';break;case _0x3092('0x23'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x24');break;case'chatqueues':_0xa5f581[_0x3092('0x14')]='ChatQueue';break;case'chatwebsites':_0xa5f581[_0x3092('0x14')]='ChatWebsite';break;case _0x3092('0x25'):_0xa5f581['childModel']=_0x3092('0x26');break;case _0x3092('0x27'):_0xa5f581['childModel']='FaxAccount';break;case _0x3092('0x28'):case _0x3092('0x29'):case _0x3092('0x2a'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x2b');break;case _0x3092('0x2c'):_0xa5f581['childModel']='VoiceContext';break;case _0x3092('0x2d'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x2e');break;case _0x3092('0x2f'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x30');_0xa5f581[_0x3092('0x18')]=[{'name':_0x3092('0x31'),'field':'name','foreignKey':'membername','model':_0x3092('0x32'),'filter':{'field':'role','value':[_0x3092('0x33')]}},{'name':'Telephones','field':_0x3092('0x1a'),'foreignKey':'membername','model':'User','filter':{'field':_0x3092('0x34'),'value':[_0x3092('0x35')]}},{'name':'VoiceQueues','field':_0x3092('0x1a'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':'QueueCampaigns','field':_0x3092('0x1a'),'foreignKey':_0x3092('0x36'),'model':'VoiceQueue','filter':{'field':_0x3092('0x10'),'value':[_0x3092('0x37')]}}];break;case _0x3092('0x38'):_0xa5f581[_0x3092('0x14')]='VoiceMusicOnHold';break;case'chanspies':_0xa5f581[_0x3092('0x14')]=_0x3092('0x39');break;case _0x3092('0x3a'):_0xa5f581['childModel']=_0x3092('0x3b');break;case _0x3092('0x3c'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x3d');break;case'mailqueues':_0xa5f581[_0x3092('0x14')]=_0x3092('0x3e');break;case _0x3092('0x3f'):_0xa5f581[_0x3092('0x14')]='MailAccount';break;case'mailsubstatuses':_0xa5f581['childModel']=_0x3092('0x40');break;case _0x3092('0x41'):_0xa5f581[_0x3092('0x14')]='OpenchannelQueue';break;case _0x3092('0x42'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x43');break;case'smsqueues':_0xa5f581[_0x3092('0x14')]='SmsQueue';break;case _0x3092('0x44'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x45');break;case _0x3092('0x46'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x47');break;case _0x3092('0x48'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x49');break;case'teams':_0xa5f581[_0x3092('0x14')]=_0x3092('0x4a');break;case _0x3092('0x4b'):case'queuecampaigns':_0xa5f581[_0x3092('0x14')]=_0x3092('0x4c');if(_0x1c1116){_0xa5f581[_0x3092('0x18')]=[{'name':'VoiceQueues'},{'name':_0x3092('0x4d')}];}break;case'users':case _0x3092('0x4e'):case'telephones':_0xa5f581[_0x3092('0x14')]='User';if(_0x1c1116){_0xa5f581[_0x3092('0x18')]=[{'name':_0x3092('0x4f'),'filter':{'field':_0x3092('0x34'),'value':[_0x3092('0x50'),_0x3092('0x51')]},'ignore':!![]},{'name':'Agents'},{'name':_0x3092('0x52')}];}break;case'zendeskaccounts':_0xa5f581[_0x3092('0x14')]='ZendeskAccount';break;case _0x3092('0x53'):_0xa5f581[_0x3092('0x14')]='SalesforceAccount';break;case _0x3092('0x54'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x55');break;case _0x3092('0x56'):_0xa5f581['childModel']=_0x3092('0x57');break;case _0x3092('0x58'):_0xa5f581['childModel']=_0x3092('0x59');break;case'zohoaccounts':_0xa5f581[_0x3092('0x14')]=_0x3092('0x5a');break;case _0x3092('0x5b'):_0xa5f581[_0x3092('0x14')]='User';break;case _0x3092('0x5c'):_0xa5f581['childModel']=_0x3092('0x5d');break;case _0x3092('0x5e'):_0xa5f581['childModel']=_0x3092('0x5f');break;case _0x3092('0x60'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x61');break;case'intervals':_0xa5f581[_0x3092('0x14')]=_0x3092('0x62');break;case _0x3092('0x63'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x64');break;case _0x3092('0x65'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x66');break;case'sounds':_0xa5f581[_0x3092('0x14')]=_0x3092('0x67');break;case _0x3092('0x68'):_0xa5f581['childModel']=_0x3092('0x69');break;case'templates':_0xa5f581[_0x3092('0x14')]=_0x3092('0x6a');break;case _0x3092('0x6b'):_0xa5f581['childModel']=_0x3092('0x6c');break;case _0x3092('0x6d'):_0xa5f581['childModel']=_0x3092('0x6e');break;case _0x3092('0x6f'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x70');break;case _0x3092('0x71'):_0xa5f581[_0x3092('0x14')]='Plugin';break;case _0x3092('0x72'):_0xa5f581[_0x3092('0x14')]=_0x3092('0xe');_0xa5f581[_0x3092('0x18')]=[{'name':_0x3092('0x73'),'field':'id','foreignKey':_0x3092('0x74')}];break;case _0x3092('0x75'):_0xa5f581[_0x3092('0x14')]=_0x3092('0x76');break;}return _0xa5f581;}function _0xf30aab(_0x5da164,_0x40f488){var _0x2b28fb=_0x5da164['charAt'](0x0)['toUpperCase']()+_0x5da164['slice'](0x1);var _0x3051f3={'type':_0x44a165[_0x3092('0x77')][_0x3092('0x78')][_0x3092('0x79')],'raw':!![]};return new Promise(function(_0x1436d3,_0x2dad7c){var _0x2b2624=squel[_0x3092('0x7a')]()[_0x3092('0x8')](_0x3092('0x7b')+_0x2b28fb+_0x3092('0x7c'),'id')[_0x3092('0x8')](_0x3092('0x7d'))[_0x3092('0x7e')](_0x3092('0x7f')+_0x5da164+_0x3092('0x80'),'ui')['where'](_0x3092('0x81'),_0x40f488['id']);return _0x44a165[_0x3092('0x82')]['query'](_0x2b2624['toString'](),_0x3051f3)['then'](function(_0x2519d2){_0x40f488[_0x2b28fb+'OpenTabs']=_0x2519d2;_0x1436d3(_0x2519d2);})['catch'](function(_0x10c25b){_0x2dad7c(_0x10c25b);});});}return _0x5b7779['define'](_0x3092('0x83'),attributes,{'tableName':_0x3092('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x429e62){var _0x591ab7=require(_0x3092('0x85'));var _0x598456={'raw':_0x429e62[_0x3092('0x86')][_0x3092('0x87')],'where':{}};var _0x50c7cf={};var _0x4422d6={'count':0x0,'rows':[]};var _0x2e7b72=_0x429e62[_0x3092('0x86')][_0x3092('0x88')];var _0x1a79c6=_0x429e62['query'][_0x3092('0x89')]||![];var _0x38a07b=_0x1bf399(_0x2e7b72,_0x1a79c6);if(!_0x38a07b[_0x3092('0x14')])throw new Error(_0x3092('0x8a')+_0x2e7b72+'\x27');var _0x4a395f=[{'name':_0x2e7b72}];if(!_[_0x3092('0x8b')](_0x38a07b[_0x3092('0x18')]))_0x4a395f=_0x38a07b[_0x3092('0x18')];var _0x157af5=[];for(var _0x3a540b=0x0;_0x3a540b<_0x4a395f[_0x3092('0x8c')];_0x3a540b++){_0x157af5[_0x3092('0x8d')](_0x44a165[_0x3092('0x8e')][_0x3092('0x8f')]({'where':{'userProfileId':_0x429e62[_0x3092('0x90')]['id'],'name':_0x4a395f[_0x3a540b]['name']},'raw':!![]}));}return Promise[_0x3092('0x91')](_0x157af5)['then'](function(_0x200fe1){var _0x4d4490=_['filter'](_0x200fe1,function(_0x3ffd09){return _0x3ffd09?_0x3ffd09:undefined;});var _0x53d9b4=_[_0x3092('0x5')](_0x4a395f,[_0x3092('0x92'),!![]]);var _0x59973c=_['isEmpty'](_0x4d4490)&&_['isEmpty'](_0x53d9b4)?null:_[_0x3092('0x93')](_0x53d9b4,_0x4d4490);if(!_0x59973c)return null;var _0x2e1993=[];for(var _0x10b71b=0x0;_0x10b71b<_0x59973c['length'];_0x10b71b++){var _0x1a7949=_[_0x3092('0x8f')](_0x4a395f,function(_0x8a6e30){return _0x59973c[_0x10b71b]?_0x8a6e30[_0x3092('0x1a')]===_0x59973c[_0x10b71b][_0x3092('0x1a')]:null;});if(_0x1a7949){if(_0x59973c[_0x10b71b][_0x3092('0x92')]){_0x2e1993[_0x3092('0x8d')](_0x3ebddc(_0x38a07b[_0x3092('0x14')],_0x59973c[_0x10b71b]));}else{if(!_0x59973c[_0x10b71b][_0x3092('0x94')]){_0x2e1993[_0x3092('0x8d')](_0x24a511(_0x1a7949,_0x59973c[_0x10b71b],_0x38a07b['childModel']));}else{if(_0x1a7949[_0x3092('0xa')]){_0x2e1993[_0x3092('0x8d')](_0x5d4565(_0x1a7949,_0x59973c[_0x10b71b]));}}}}}return Promise[_0x3092('0x91')](_0x2e1993);})[_0x3092('0xb')](function(_0x3dc04e){var _0x537a6e=_0x3dc04e;var _0x54c16d=null;if(_0x537a6e){_0x54c16d=_0x537a6e[_0x3092('0x8c')]===0x1?_0x537a6e[0x0]:null;}if(!_0x54c16d&&!_0x537a6e)return _0x4422d6;var _0x52e823=_0x44a165[_0x38a07b[_0x3092('0x14')]][_0x3092('0x95')];_0x50c7cf[_0x3092('0xa')]=_['keys'](_0x52e823);_0x50c7cf['query']=_[_0x3092('0x96')](_0x429e62[_0x3092('0x86')]);_0x50c7cf[_0x3092('0x97')]=_[_0x3092('0x98')](_0x50c7cf[_0x3092('0xa')],_0x50c7cf[_0x3092('0x86')]);_0x598456[_0x3092('0x99')]=_[_0x3092('0x98')](_0x50c7cf['model'],_0x591ab7['fields'](_0x429e62[_0x3092('0x86')][_0x3092('0x9a')]));_0x598456[_0x3092('0x99')]=_0x598456['attributes']['length']?_0x598456[_0x3092('0x99')]:_0x50c7cf[_0x3092('0xa')];if(!_0x429e62['query'][_0x3092('0x9b')](_0x3092('0x9c'))){_0x598456['limit']=_0x591ab7[_0x3092('0x9d')](_0x429e62['query']['limit']);_0x598456['offset']=_0x591ab7[_0x3092('0x9e')](_0x429e62[_0x3092('0x86')][_0x3092('0x9e')]);}_0x598456['order']=_0x591ab7[_0x3092('0x9f')](_0x429e62[_0x3092('0x86')][_0x3092('0x9f')]);_0x598456[_0x3092('0xa0')]=_0x591ab7[_0x3092('0x97')](_[_0x3092('0xa1')](_0x429e62[_0x3092('0x86')],_0x50c7cf[_0x3092('0x97')]));if(_0x429e62[_0x3092('0x86')][_0x3092('0x5')]){_0x598456[_0x3092('0xa0')]=_[_0x3092('0xa2')](_0x598456['where'],{'$or':_[_0x3092('0x7')](_0x52e823,function(_0x19fe80){if(_0x19fe80[_0x3092('0x10')][_0x3092('0xa3')]!==_0x3092('0xa4')){var _0x373a7e={};_0x373a7e[_0x19fe80[_0x3092('0x8')]]={'$like':'%'+_0x429e62[_0x3092('0x86')]['filter']+'%'};return _0x373a7e;}})});}var _0xa0b492=[];var _0x23ccf8=null;var _0x2b5a06={};if(_0x54c16d){_0x23ccf8=_[_0x3092('0x8f')](_0x4a395f,[_0x3092('0x1a'),_0x54c16d['name']]);if(_0x23ccf8['field']){_0x2b5a06={};if(_0x38a07b[_0x3092('0x14')]===_0x3092('0xe')){_0x2b5a06[_0x23ccf8[_0x3092('0xa5')]]=_[_0x3092('0x7')](_0x54c16d['associatedResources'],'id');}else{_0x2b5a06[_0x23ccf8[_0x3092('0xa5')]]=_0x54c16d['associatedResources'];}_0xa0b492[_0x3092('0x8d')](_0x2b5a06);}else{_0x598456[_0x3092('0xa0')]['id']=_0x54c16d[_0x3092('0xd')];}}else{for(var _0x239f61=0x0;_0x239f61<_0x537a6e[_0x3092('0x8c')];_0x239f61++){_0x23ccf8=_[_0x3092('0x8f')](_0x4a395f,[_0x3092('0x1a'),_0x537a6e[_0x239f61][_0x3092('0x1a')]]);if(_0x23ccf8[_0x3092('0x8')]){_0x2b5a06={};_0x2b5a06[_0x23ccf8['foreignKey']]=_0x537a6e[_0x239f61][_0x3092('0xd')];_0xa0b492['push'](_0x2b5a06);}else{if(!_0x598456['where']['id'])_0x598456[_0x3092('0xa0')]['id']=[];_0x537a6e[_0x239f61][_0x3092('0xd')][_0x3092('0xa6')](function(_0x306a8d){_0x598456[_0x3092('0xa0')]['id'][_0x3092('0x8d')](_0x306a8d);});}}}if(!_[_0x3092('0x8b')](_0xa0b492)){_0x598456[_0x3092('0xa0')]=_[_0x3092('0xa2')](_0x598456['where'],{'$and':{'$or':_0xa0b492}});}_0x598456=_[_0x3092('0xa2')]({},_0x598456,_0x429e62[_0x3092('0xa7')]);if(_0x54c16d&&!_0x54c16d[_0x3092('0x94')]&&_0x38a07b[_0x3092('0x14')]===_0x3092('0xe')){if(_0x429e62['query'][_0x3092('0xa8')]){_0x598456[_0x3092('0xa9')]=[{'all':!![]}];}return _0x44a165[_0x38a07b[_0x3092('0x14')]]['findAll'](_0x598456)[_0x3092('0xb')](function(_0x56d408){var _0x4ae4c2=[];_0x56d408[_0x3092('0xa6')](function(_0x1c3abb){var _0x41518d;switch(_0x1c3abb[_0x3092('0xaa')]){case'default':_0x41518d=_['find'](_0x54c16d[_0x3092('0xd')],function(_0x33e418){return _0x33e418['id']===_0x1c3abb[_0x3092('0x74')]&&_0x33e418[_0x3092('0x10')]===_0x3092('0xab');});break;case'custom':_0x41518d=_[_0x3092('0x8f')](_0x54c16d['associatedResources'],function(_0x5c559c){return _0x5c559c['id']===_0x1c3abb[_0x3092('0x74')]&&_0x5c559c[_0x3092('0x10')]===_0x3092('0xac');});break;}if(_0x41518d)_0x4ae4c2[_0x3092('0x8d')](_0x1c3abb);});_0x4422d6['count']=_0x4ae4c2['length'];_0x4422d6[_0x3092('0xad')]=_0x4ae4c2;return _0x4422d6;});}else{if(!_['isEmpty'](_0x429e62[_0x3092('0x86')][_0x3092('0xae')])){_0x598456[_0x3092('0xa0')]['id']=_0x598456[_0x3092('0xa0')]['id']?_['intersection'](_0x598456['where']['id'],_0x429e62[_0x3092('0x86')][_0x3092('0xae')]):_0x429e62['query'][_0x3092('0xae')];if(_0x429e62[_0x3092('0x86')][_0x3092('0xaf')]){_0x598456[_0x3092('0xb0')]=_0x429e62[_0x3092('0x86')]['customSorting'];}}if(_0x429e62[_0x3092('0x86')][_0x3092('0xb1')]){_0x598456['where']=_[_0x3092('0xa2')](_0x598456[_0x3092('0xa0')],{'$and':_0x429e62[_0x3092('0x86')][_0x3092('0xb1')]});}return _0x44a165[_0x38a07b[_0x3092('0x14')]][_0x3092('0xb2')]({'where':_0x598456[_0x3092('0xa0')]})[_0x3092('0xb')](function(_0xab745c){_0x4422d6[_0x3092('0xb2')]=_0xab745c;if(_0x429e62['query']['includeAll']){if(_0x38a07b[_0x3092('0x14')]===_0x3092('0x1e')){_0x598456['include']=[{'model':_0x44a165[_0x3092('0x69')],'as':_0x3092('0xb3'),'attributes':['id','name','color'],'required':_0x429e62[_0x3092('0x86')][_0x3092('0xb4')]?!![]:![]},{'model':_0x44a165[_0x3092('0x69')],'as':_0x3092('0xb5'),'attributes':['id','name',_0x3092('0xb6')],'through':_0x429e62[_0x3092('0x86')][_0x3092('0xb4')]?{'attributes':[],'where':{'TagId':_0x429e62[_0x3092('0x86')][_0x3092('0xb4')]||undefined}}:{},'required':_0x429e62['query'][_0x3092('0xb4')]?!![]:![]}];}else{_0x598456[_0x3092('0xa9')]=[{'all':!![]}];}}return _0x44a165[_0x38a07b['childModel']][_0x3092('0x6')](_0x598456);})[_0x3092('0xb')](function(_0x3ada31){_0x4422d6[_0x3092('0xad')]=_0x3ada31;if(_0x2e7b72===_0x3092('0x31')&&_0x429e62[_0x3092('0x86')][_0x3092('0xb7')]===_0x3092('0xb8')){var _0x192edc=[];for(var _0x58af55=0x0;_0x58af55<_0x4422d6[_0x3092('0xad')][_0x3092('0x8c')];_0x58af55++){_0x192edc[_0x3092('0x8d')](_0xf30aab(_0x3092('0xb9'),_0x4422d6[_0x3092('0xad')][_0x58af55][_0x3092('0xba')]));_0x192edc[_0x3092('0x8d')](_0xf30aab('sms',_0x4422d6[_0x3092('0xad')][_0x58af55][_0x3092('0xba')]));_0x192edc[_0x3092('0x8d')](_0xf30aab(_0x3092('0xbb'),_0x4422d6['rows'][_0x58af55][_0x3092('0xba')]));_0x192edc['push'](_0xf30aab(_0x3092('0xbc'),_0x4422d6['rows'][_0x58af55][_0x3092('0xba')]));_0x192edc[_0x3092('0x8d')](_0xf30aab('openchannel',_0x4422d6[_0x3092('0xad')][_0x58af55]['dataValues']));_0x192edc[_0x3092('0x8d')](_0xf30aab('whatsapp',_0x4422d6['rows'][_0x58af55][_0x3092('0xba')]));}return Promise['all'](_0x192edc)[_0x3092('0xb')](function(){return _0x4422d6;});}return _0x4422d6;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7996934..82a365c 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 _0x8c8b=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8c8b,0x106));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb8c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8c8('0x1'));var rs=require(_0xb8c8('0x2'));var fs=require('fs');var Redis=require(_0xb8c8('0x3'));var db=require(_0xb8c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8c8('0x5'));var config=require(_0xb8c8('0x6'));var jayson=require(_0xb8c8('0x7'));var client=jayson[_0xb8c8('0x8')][_0xb8c8('0x9')]({'port':0x232a});config[_0xb8c8('0xa')]=_[_0xb8c8('0xb')](config[_0xb8c8('0xa')],{'host':_0xb8c8('0xc'),'port':0x18eb});var socket=require(_0xb8c8('0xd'))(new Redis(config[_0xb8c8('0xa')]));require('./userProfile.socket')[_0xb8c8('0xe')](socket);function respondWithRpcPromise(_0x3e6f56,_0x406e1e,_0x1db0e7){return new BPromise(function(_0x3c74d5,_0x3414ec){return client[_0xb8c8('0xf')](_0x3e6f56,_0x1db0e7)[_0xb8c8('0x10')](function(_0x8814ad){logger[_0xb8c8('0x11')](_0xb8c8('0x12'),_0x406e1e,_0xb8c8('0x13'));logger['debug'](_0xb8c8('0x14'),_0x406e1e,'request\x20sent',JSON[_0xb8c8('0x15')](_0x8814ad));if(_0x8814ad[_0xb8c8('0x16')]){if(_0x8814ad['error'][_0xb8c8('0x17')]===0x1f4){logger[_0xb8c8('0x16')](_0xb8c8('0x12'),_0x406e1e,_0x8814ad['error'][_0xb8c8('0x18')]);return _0x3414ec(_0x8814ad[_0xb8c8('0x16')][_0xb8c8('0x18')]);}logger[_0xb8c8('0x16')]('UserProfile,\x20%s,\x20%s',_0x406e1e,_0x8814ad[_0xb8c8('0x16')][_0xb8c8('0x18')]);return _0x3c74d5(_0x8814ad[_0xb8c8('0x16')][_0xb8c8('0x18')]);}else{logger['info'](_0xb8c8('0x12'),_0x406e1e,_0xb8c8('0x13'));_0x3c74d5(_0x8814ad[_0xb8c8('0x19')][_0xb8c8('0x18')]);}})[_0xb8c8('0x1a')](function(_0x1cbded){logger[_0xb8c8('0x16')](_0xb8c8('0x12'),_0x406e1e,_0x1cbded);_0x3414ec(_0x1cbded);});});} \ No newline at end of file +var _0x8a21=['error','code','message','request\x20sent','lodash','bluebird','randomstring','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','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5da219,_0x37e921){var _0x467863=function(_0x5e4a1b){while(--_0x5e4a1b){_0x5da219['push'](_0x5da219['shift']());}};_0x467863(++_0x37e921);}(_0x8a21,0x1d8));var _0x18a2=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x8a21[_0x3c04ef];return _0x6a3a69;};'use strict';var _=require(_0x18a2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x18a2('0x1'));var rs=require(_0x18a2('0x2'));var fs=require('fs');var Redis=require(_0x18a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x18a2('0x4'))(_0x18a2('0x5'));var config=require(_0x18a2('0x6'));var jayson=require(_0x18a2('0x7'));var client=jayson[_0x18a2('0x8')][_0x18a2('0x9')]({'port':0x232a});config[_0x18a2('0xa')]=_[_0x18a2('0xb')](config['redis'],{'host':_0x18a2('0xc'),'port':0x18eb});var socket=require(_0x18a2('0xd'))(new Redis(config[_0x18a2('0xa')]));require('./userProfile.socket')[_0x18a2('0xe')](socket);function respondWithRpcPromise(_0x3e9df9,_0x143d14,_0x3fda68){return new BPromise(function(_0x1f04e4,_0x54ce08){return client[_0x18a2('0xf')](_0x3e9df9,_0x3fda68)[_0x18a2('0x10')](function(_0x53007f){logger[_0x18a2('0x11')](_0x18a2('0x12'),_0x143d14,'request\x20sent');logger[_0x18a2('0x13')](_0x18a2('0x14'),_0x143d14,'request\x20sent',JSON[_0x18a2('0x15')](_0x53007f));if(_0x53007f[_0x18a2('0x16')]){if(_0x53007f[_0x18a2('0x16')][_0x18a2('0x17')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x143d14,_0x53007f[_0x18a2('0x16')]['message']);return _0x54ce08(_0x53007f[_0x18a2('0x16')]['message']);}logger[_0x18a2('0x16')](_0x18a2('0x12'),_0x143d14,_0x53007f[_0x18a2('0x16')]['message']);return _0x1f04e4(_0x53007f[_0x18a2('0x16')][_0x18a2('0x18')]);}else{logger[_0x18a2('0x11')](_0x18a2('0x12'),_0x143d14,_0x18a2('0x19'));_0x1f04e4(_0x53007f['result'][_0x18a2('0x18')]);}})['catch'](function(_0x922c0e){logger['error'](_0x18a2('0x12'),_0x143d14,_0x922c0e);_0x54ce08(_0x922c0e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 70eec62..c92e3a0 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 _0xb722=['length','./userProfile.events','remove','emit','register'];(function(_0x41af18,_0x3cfad4){var _0x2978fe=function(_0x48e2a3){while(--_0x48e2a3){_0x41af18['push'](_0x41af18['shift']());}};_0x2978fe(++_0x3cfad4);}(_0xb722,0x191));var _0x2b72=function(_0x52d43c,_0x30ef0b){_0x52d43c=_0x52d43c-0x0;var _0x4c7cbf=_0xb722[_0x52d43c];return _0x4c7cbf;};'use strict';var UserProfileEvents=require(_0x2b72('0x0'));var events=['save',_0x2b72('0x1'),'update'];function createListener(_0x38d37d,_0x28e9c3){return function(_0x3f3752){_0x28e9c3[_0x2b72('0x2')](_0x38d37d,_0x3f3752);};}function removeListener(_0x3c7b8a,_0x50a15c){return function(){UserProfileEvents['removeListener'](_0x3c7b8a,_0x50a15c);};}exports[_0x2b72('0x3')]=function(_0x367176){for(var _0x493c99=0x0,_0x2ff9e5=events[_0x2b72('0x4')];_0x493c99<_0x2ff9e5;_0x493c99++){var _0x1af313=events[_0x493c99];var _0x15b805=createListener('userProfile:'+_0x1af313,_0x367176);UserProfileEvents['on'](_0x1af313,_0x15b805);}}; \ No newline at end of file +var _0x10cf=['./userProfile.events','save','remove','update','emit','register','length'];(function(_0x6c570d,_0x3ac9b1){var _0x2b5ecc=function(_0x425227){while(--_0x425227){_0x6c570d['push'](_0x6c570d['shift']());}};_0x2b5ecc(++_0x3ac9b1);}(_0x10cf,0x111));var _0xf10c=function(_0x30a85a,_0x15a94a){_0x30a85a=_0x30a85a-0x0;var _0x20b4ab=_0x10cf[_0x30a85a];return _0x20b4ab;};'use strict';var UserProfileEvents=require(_0xf10c('0x0'));var events=[_0xf10c('0x1'),_0xf10c('0x2'),_0xf10c('0x3')];function createListener(_0x39bc32,_0x2b44ba){return function(_0xcb1e92){_0x2b44ba[_0xf10c('0x4')](_0x39bc32,_0xcb1e92);};}function removeListener(_0x312fcd,_0x5cec7f){return function(){UserProfileEvents['removeListener'](_0x312fcd,_0x5cec7f);};}exports[_0xf10c('0x5')]=function(_0x1f5cff){for(var _0x383f38=0x0,_0x5b71cf=events[_0xf10c('0x6')];_0x383f38<_0x5b71cf;_0x383f38++){var _0x505832=events[_0x383f38];var _0xdd1111=createListener('userProfile:'+_0x505832,_0x1f5cff);UserProfileEvents['on'](_0x505832,_0xdd1111);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4f53970..22df1d6 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 _0xf781=['path','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','post','put','delete','/:id','destroy','multer','util'];(function(_0x25122f,_0x43d7d){var _0xba3d5c=function(_0x127f01){while(--_0x127f01){_0x25122f['push'](_0x25122f['shift']());}};_0xba3d5c(++_0x43d7d);}(_0xf781,0xc4));var _0x1f78=function(_0x5bef1d,_0x523f1c){_0x5bef1d=_0x5bef1d-0x0;var _0x2a9d3f=_0xf781[_0x5bef1d];return _0x2a9d3f;};'use strict';var multer=require(_0x1f78('0x0'));var util=require(_0x1f78('0x1'));var path=require(_0x1f78('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f78('0x3'));var router=express[_0x1f78('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1f78('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1f78('0x6'));var controller=require(_0x1f78('0x7'));router[_0x1f78('0x8')]('/',auth[_0x1f78('0x9')](),controller[_0x1f78('0xa')]);router['get'](_0x1f78('0xb'),auth['isAuthenticated'](),controller[_0x1f78('0xc')]);router[_0x1f78('0x8')]('/:id',auth[_0x1f78('0x9')](),controller['show']);router[_0x1f78('0xd')]('/',auth[_0x1f78('0x9')](),controller['create']);router[_0x1f78('0xe')]('/:id',auth[_0x1f78('0x9')](),controller['update']);router[_0x1f78('0xf')](_0x1f78('0x10'),auth[_0x1f78('0x9')](),controller[_0x1f78('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdcdc=['show','post','create','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdcdc,0x1e1));var _0xcdcd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdcdc[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xcdcd('0x0'));var util=require(_0xcdcd('0x1'));var path=require(_0xcdcd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcdcd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcdcd('0x4'));var interaction=require(_0xcdcd('0x5'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xcdcd('0x6')]('/',auth[_0xcdcd('0x7')](),controller[_0xcdcd('0x8')]);router[_0xcdcd('0x6')](_0xcdcd('0x9'),auth[_0xcdcd('0x7')](),controller[_0xcdcd('0xa')]);router[_0xcdcd('0x6')](_0xcdcd('0xb'),auth[_0xcdcd('0x7')](),controller[_0xcdcd('0xc')]);router[_0xcdcd('0xd')]('/',auth['isAuthenticated'](),controller[_0xcdcd('0xe')]);router['put'](_0xcdcd('0xb'),auth[_0xcdcd('0x7')](),controller['update']);router[_0xcdcd('0xf')]('/:id',auth[_0xcdcd('0x7')](),controller['destroy']);module[_0xcdcd('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index bbe00d6..33ca9c8 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 _0xbf36=['INTEGER','sequelize','exports','STRING'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xbf36,0x159));var _0x6bf3=function(_0x278868,_0x406e08){_0x278868=_0x278868-0x0;var _0x54fb83=_0xbf36[_0x278868];return _0x54fb83;};'use strict';var Sequelize=require(_0x6bf3('0x0'));module[_0x6bf3('0x1')]={'name':{'type':Sequelize[_0x6bf3('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6bf3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6bf3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8af5=['STRING','sequelize'];(function(_0xe593fe,_0x587956){var _0x49fe42=function(_0x5eb9fe){while(--_0x5eb9fe){_0xe593fe['push'](_0xe593fe['shift']());}};_0x49fe42(++_0x587956);}(_0x8af5,0x1a7));var _0x58af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8af5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x58af('0x0'));module['exports']={'name':{'type':Sequelize[_0x58af('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x58af('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 122648b..549814e 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 _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(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x6343,0x168));var _0x3634=function(_0x4874c4,_0x4e6c7f){_0x4874c4=_0x4874c4-0x0;var _0x5bc632=_0x6343[_0x4874c4];return _0x5bc632;};'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 +var _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileResource','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x19715b,_0x3dbc5a){var _0x42a515=function(_0x2f8d95){while(--_0x2f8d95){_0x19715b['push'](_0x19715b['shift']());}};_0x42a515(++_0x3dbc5a);}(_0x524e,0x15e));var _0xe524=function(_0x5b6745,_0x1eb587){_0x5b6745=_0x5b6745-0x0;var _0x3fb5c9=_0x524e[_0x5b6745];return _0x3fb5c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['UserProfileResource'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['UserProfileResource'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['UserProfileResource'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index cddc9ed..07bc02d 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 _0x4c7a=['define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x4c7a,0x11d));var _0xa4c7=function(_0x3c255f,_0x33c7e4){_0x3c255f=_0x3c255f-0x0;var _0x1467d0=_0x4c7a[_0x3c255f];return _0x1467d0;};'use strict';var _=require('lodash');var util=require(_0xa4c7('0x0'));var logger=require(_0xa4c7('0x1'))(_0xa4c7('0x2'));var moment=require(_0xa4c7('0x3'));var BPromise=require(_0xa4c7('0x4'));var rp=require(_0xa4c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa4c7('0x6'));var attributes=require(_0xa4c7('0x7'));module[_0xa4c7('0x8')]=function(_0x234d6f,_0x473fd2){return _0x234d6f[_0xa4c7('0x9')](_0xa4c7('0xa'),attributes,{'tableName':_0xa4c7('0xb'),'paranoid':![],'indexes':[{'name':_0xa4c7('0xc'),'fields':['resourceId',_0xa4c7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7636=['define','UserProfileResource','compositeIndex','lodash','../../config/logger','api','moment','bluebird','request-promise','./userProfileResource.attributes','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7636,0x92));var _0x6763=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x7636[_0x430459];return _0x3a2439;};'use strict';var _=require(_0x6763('0x0'));var util=require('util');var logger=require(_0x6763('0x1'))(_0x6763('0x2'));var moment=require(_0x6763('0x3'));var BPromise=require(_0x6763('0x4'));var rp=require(_0x6763('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6763('0x6'));module[_0x6763('0x7')]=function(_0x3e5b77,_0x5e973b){return _0x3e5b77[_0x6763('0x8')](_0x6763('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x6763('0xa'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 08ab7d3..befee47 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 _0xbd97=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd97,0x1de));var _0x7bd9=function(_0x2d77fb,_0xd173e6){_0x2d77fb=_0x2d77fb-0x0;var _0xbde89c=_0xbd97[_0x2d77fb];return _0xbde89c;};'use strict';var _=require('lodash');var util=require(_0x7bd9('0x0'));var moment=require(_0x7bd9('0x1'));var BPromise=require(_0x7bd9('0x2'));var rs=require(_0x7bd9('0x3'));var fs=require('fs');var Redis=require(_0x7bd9('0x4'));var db=require(_0x7bd9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7bd9('0x6'));var config=require(_0x7bd9('0x7'));var jayson=require(_0x7bd9('0x8'));var client=jayson[_0x7bd9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e68b7,_0x4e3d31,_0x2df63b){return new BPromise(function(_0x3a9fd9,_0x34bb1d){return client[_0x7bd9('0xa')](_0x2e68b7,_0x2df63b)[_0x7bd9('0xb')](function(_0x399d95){logger[_0x7bd9('0xc')](_0x7bd9('0xd'),_0x4e3d31,'request\x20sent');logger['debug'](_0x7bd9('0xe'),_0x4e3d31,_0x7bd9('0xf'),JSON[_0x7bd9('0x10')](_0x399d95));if(_0x399d95[_0x7bd9('0x11')]){if(_0x399d95[_0x7bd9('0x11')][_0x7bd9('0x12')]===0x1f4){logger[_0x7bd9('0x11')](_0x7bd9('0xd'),_0x4e3d31,_0x399d95['error']['message']);return _0x34bb1d(_0x399d95[_0x7bd9('0x11')]['message']);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4e3d31,_0x399d95[_0x7bd9('0x11')][_0x7bd9('0x13')]);return _0x3a9fd9(_0x399d95['error'][_0x7bd9('0x13')]);}else{logger[_0x7bd9('0xc')](_0x7bd9('0xd'),_0x4e3d31,_0x7bd9('0xf'));_0x3a9fd9(_0x399d95['result'][_0x7bd9('0x13')]);}})[_0x7bd9('0x14')](function(_0x4ba454){logger['error'](_0x7bd9('0xd'),_0x4e3d31,_0x4ba454);_0x34bb1d(_0x4ba454);});});} \ No newline at end of file +var _0x1c1a=['error','UserProfileResource,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','request\x20sent'];(function(_0x5287fb,_0x2d9f60){var _0x5a7f46=function(_0x324ecd){while(--_0x324ecd){_0x5287fb['push'](_0x5287fb['shift']());}};_0x5a7f46(++_0x2d9f60);}(_0x1c1a,0x84));var _0xa1c1=function(_0x2ac2b1,_0x73c90c){_0x2ac2b1=_0x2ac2b1-0x0;var _0x455350=_0x1c1a[_0x2ac2b1];return _0x455350;};'use strict';var _=require(_0xa1c1('0x0'));var util=require(_0xa1c1('0x1'));var moment=require(_0xa1c1('0x2'));var BPromise=require(_0xa1c1('0x3'));var rs=require(_0xa1c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1c1('0x5'))['db'];var utils=require(_0xa1c1('0x6'));var logger=require(_0xa1c1('0x7'))('rpc');var config=require(_0xa1c1('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d1605,_0x2d8f09,_0x387a45){return new BPromise(function(_0x426841,_0xe759da){return client[_0xa1c1('0x9')](_0x1d1605,_0x387a45)[_0xa1c1('0xa')](function(_0x596da1){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x2d8f09,_0xa1c1('0xb'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2d8f09,_0xa1c1('0xb'),JSON['stringify'](_0x596da1));if(_0x596da1[_0xa1c1('0xc')]){if(_0x596da1[_0xa1c1('0xc')]['code']===0x1f4){logger[_0xa1c1('0xc')](_0xa1c1('0xd'),_0x2d8f09,_0x596da1[_0xa1c1('0xc')][_0xa1c1('0xe')]);return _0xe759da(_0x596da1[_0xa1c1('0xc')][_0xa1c1('0xe')]);}logger[_0xa1c1('0xc')](_0xa1c1('0xd'),_0x2d8f09,_0x596da1[_0xa1c1('0xc')][_0xa1c1('0xe')]);return _0x426841(_0x596da1[_0xa1c1('0xc')][_0xa1c1('0xe')]);}else{logger[_0xa1c1('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x2d8f09,'request\x20sent');_0x426841(_0x596da1['result'][_0xa1c1('0xe')]);}})['catch'](function(_0x273570){logger['error'](_0xa1c1('0xd'),_0x2d8f09,_0x273570);_0xe759da(_0x273570);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 5f446f5..ebe2e64 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 _0x743e=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','put'];(function(_0x524cfc,_0x965821){var _0x4950a7=function(_0x251c6b){while(--_0x251c6b){_0x524cfc['push'](_0x524cfc['shift']());}};_0x4950a7(++_0x965821);}(_0x743e,0x11d));var _0xe743=function(_0x147a09,_0x23c22a){_0x147a09=_0x147a09-0x0;var _0x3558a0=_0x743e[_0x147a09];return _0x3558a0;};'use strict';var multer=require(_0xe743('0x0'));var util=require(_0xe743('0x1'));var path=require('path');var timeout=require(_0xe743('0x2'));var express=require(_0xe743('0x3'));var router=express[_0xe743('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe743('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe743('0x6'));var controller=require('./userProfileSection.controller');router[_0xe743('0x7')]('/',auth[_0xe743('0x8')](),controller[_0xe743('0x9')]);router[_0xe743('0x7')](_0xe743('0xa'),auth[_0xe743('0x8')](),controller[_0xe743('0xb')]);router[_0xe743('0x7')]('/:id',auth[_0xe743('0x8')](),controller[_0xe743('0xc')]);router['post']('/',auth[_0xe743('0x8')](),controller[_0xe743('0xd')]);router[_0xe743('0xe')](_0xe743('0xf'),auth[_0xe743('0x8')](),controller[_0xe743('0x10')]);router[_0xe743('0x11')](_0xe743('0xf'),auth[_0xe743('0x8')](),controller[_0xe743('0x12')]);module[_0xe743('0x13')]=router; \ No newline at end of file +var _0xda06=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x1fe453,_0x3daa75){var _0x4b59c8=function(_0x391f8e){while(--_0x391f8e){_0x1fe453['push'](_0x1fe453['shift']());}};_0x4b59c8(++_0x3daa75);}(_0xda06,0x14e));var _0x6da0=function(_0x4b526b,_0x2f1317){_0x4b526b=_0x4b526b-0x0;var _0x57f25d=_0xda06[_0x4b526b];return _0x57f25d;};'use strict';var multer=require(_0x6da0('0x0'));var util=require('util');var path=require(_0x6da0('0x1'));var timeout=require(_0x6da0('0x2'));var express=require(_0x6da0('0x3'));var router=express[_0x6da0('0x4')]();var fs_extra=require(_0x6da0('0x5'));var auth=require(_0x6da0('0x6'));var interaction=require(_0x6da0('0x7'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x6da0('0x8')]('/',auth[_0x6da0('0x9')](),controller[_0x6da0('0xa')]);router['get'](_0x6da0('0xb'),auth[_0x6da0('0x9')](),controller[_0x6da0('0xc')]);router[_0x6da0('0x8')](_0x6da0('0xd'),auth[_0x6da0('0x9')](),controller['show']);router[_0x6da0('0xe')]('/',auth['isAuthenticated'](),controller[_0x6da0('0xf')]);router[_0x6da0('0x10')](_0x6da0('0xd'),auth[_0x6da0('0x9')](),controller[_0x6da0('0x11')]);router[_0x6da0('0x12')](_0x6da0('0xd'),auth[_0x6da0('0x9')](),controller[_0x6da0('0x13')]);module[_0x6da0('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 4522686..345223f 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 _0xe605=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0xe65dc5,_0x293bb4){var _0x5a5416=function(_0x4fbd38){while(--_0x4fbd38){_0xe65dc5['push'](_0xe65dc5['shift']());}};_0x5a5416(++_0x293bb4);}(_0xe605,0x92));var _0x5e60=function(_0x10b917,_0x1511bd){_0x10b917=_0x10b917-0x0;var _0x77003f=_0xe605[_0x10b917];return _0x77003f;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x5e60('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e60('0x2')],'set':function(_0xfe1f64){this[_0x5e60('0x5')](_0x5e60('0x6'),_0xfe1f64?_0xfe1f64[_0x5e60('0x7')](''):[]);},'get':function(){return this[_0x5e60('0x8')](_0x5e60('0x6'))?this[_0x5e60('0x8')]('crudPermissions')[_0x5e60('0x9')](''):[];}}}; \ No newline at end of file +var _0xb62e=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'name':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb62('0x2')],'set':function(_0x929329){this[_0xeb62('0x4')](_0xeb62('0x5'),_0x929329?_0x929329['join'](''):[]);},'get':function(){return this[_0xeb62('0x6')](_0xeb62('0x5'))?this[_0xeb62('0x6')]('crudPermissions')[_0xeb62('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 812a835..48f1093 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 _0x3370=['create','body','describe','eml-format','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find'];(function(_0x554be5,_0x177df1){var _0x2ec936=function(_0x5a2071){while(--_0x5a2071){_0x554be5['push'](_0x554be5['shift']());}};_0x2ec936(++_0x177df1);}(_0x3370,0x1f4));var _0x0337=function(_0x842cd8,_0x25c060){_0x842cd8=_0x842cd8-0x0;var _0x48515e=_0x3370[_0x842cd8];return _0x48515e;};'use strict';var emlformat=require(_0x0337('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0337('0x1'));var rp=require(_0x0337('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0337('0x3'));var util=require('util');var path=require(_0x0337('0x4'));var sox=require(_0x0337('0x5'));var csv=require(_0x0337('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0337('0x7'));var _=require('lodash');var squel=require(_0x0337('0x8'));var crypto=require(_0x0337('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0337('0xa'));var toCsv=require(_0x0337('0x6'));var querystring=require('querystring');var Papa=require(_0x0337('0xb'));var Redis=require('ioredis');var authService=require(_0x0337('0xc'));var qs=require(_0x0337('0xd'));var as=require(_0x0337('0xe'));var hardwareService=require(_0x0337('0xf'));var logger=require(_0x0337('0x10'))(_0x0337('0x11'));var utils=require(_0x0337('0x12'));var config=require(_0x0337('0x13'));var licenseUtil=require(_0x0337('0x14'));var db=require(_0x0337('0x15'))['db'];function respondWithStatusCode(_0x2788a7,_0x7b112d){_0x7b112d=_0x7b112d||0xcc;return function(_0x717f13){if(_0x717f13){return _0x2788a7[_0x0337('0x16')](_0x7b112d);}return _0x2788a7[_0x0337('0x17')](_0x7b112d)[_0x0337('0x18')]();};}function respondWithResult(_0x4ed95b,_0x28c308){_0x28c308=_0x28c308||0xc8;return function(_0x1f85bf){if(_0x1f85bf){return _0x4ed95b[_0x0337('0x17')](_0x28c308)['json'](_0x1f85bf);}};}function respondWithFilteredResult(_0x594543,_0x56d1a4){return function(_0x4e5353){if(_0x4e5353){var _0x2ba1e9=typeof _0x56d1a4['offset']===_0x0337('0x19')&&typeof _0x56d1a4[_0x0337('0x1a')]==='undefined';var _0x255270=_0x4e5353['count'];var _0x591a3a=_0x2ba1e9?0x0:_0x56d1a4[_0x0337('0x1b')];var _0x54e147=_0x2ba1e9?_0x4e5353[_0x0337('0x1c')]:_0x56d1a4[_0x0337('0x1b')]+_0x56d1a4[_0x0337('0x1a')];var _0x1280f1;if(_0x54e147>=_0x255270){_0x54e147=_0x255270;_0x1280f1=0xc8;}else{_0x1280f1=0xce;}_0x594543[_0x0337('0x17')](_0x1280f1);return _0x594543[_0x0337('0x1d')](_0x0337('0x1e'),_0x591a3a+'-'+_0x54e147+'/'+_0x255270)['json'](_0x4e5353);}return null;};}function patchUpdates(_0x578364){return function(_0x2672cf){try{jsonpatch[_0x0337('0x1f')](_0x2672cf,_0x578364,!![]);}catch(_0x2ce72d){return BPromise['reject'](_0x2ce72d);}return _0x2672cf[_0x0337('0x20')]();};}function saveUpdates(_0x429f2a,_0x38edcc){return function(_0x587465){if(_0x587465){return _0x587465[_0x0337('0x21')](_0x429f2a)[_0x0337('0x22')](function(_0x16c991){return _0x16c991;});}return null;};}function removeEntity(_0x1d5ef6,_0x6a1a31){return function(_0x558afc){if(_0x558afc){return _0x558afc[_0x0337('0x23')]()[_0x0337('0x22')](function(){_0x1d5ef6[_0x0337('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e0eb,_0x4b1c73){return function(_0x5c5930){if(!_0x5c5930){_0x15e0eb['sendStatus'](0x194);}return _0x5c5930;};}function handleError(_0x56ea60,_0xe8e271){_0xe8e271=_0xe8e271||0x1f4;return function(_0x105e80){logger[_0x0337('0x24')](_0x105e80['stack']);if(_0x105e80['name']){delete _0x105e80[_0x0337('0x25')];}_0x56ea60[_0x0337('0x17')](_0xe8e271)['send'](_0x105e80);};}exports[_0x0337('0x26')]=function(_0x255c82,_0x326dc2){var _0xaf3ccf={},_0x2449cd={},_0x2c57f7={'count':0x0,'rows':[]};var _0x3f5a20=_[_0x0337('0x27')](db[_0x0337('0x28')][_0x0337('0x29')],function(_0xc47682){return{'name':_0xc47682[_0x0337('0x2a')],'type':_0xc47682[_0x0337('0x2b')][_0x0337('0x2c')]};});_0x2449cd[_0x0337('0x2d')]=_[_0x0337('0x27')](_0x3f5a20,_0x0337('0x25'));_0x2449cd[_0x0337('0x2e')]=_[_0x0337('0x2f')](_0x255c82[_0x0337('0x2e')]);_0x2449cd[_0x0337('0x30')]=_[_0x0337('0x31')](_0x2449cd['model'],_0x2449cd[_0x0337('0x2e')]);_0xaf3ccf[_0x0337('0x32')]=_[_0x0337('0x31')](_0x2449cd['model'],qs['fields'](_0x255c82[_0x0337('0x2e')][_0x0337('0x33')]));_0xaf3ccf[_0x0337('0x32')]=_0xaf3ccf[_0x0337('0x32')][_0x0337('0x34')]?_0xaf3ccf[_0x0337('0x32')]:_0x2449cd[_0x0337('0x2d')];if(!_0x255c82[_0x0337('0x2e')]['hasOwnProperty'](_0x0337('0x35'))){_0xaf3ccf['limit']=qs['limit'](_0x255c82[_0x0337('0x2e')][_0x0337('0x1a')]);_0xaf3ccf[_0x0337('0x1b')]=qs[_0x0337('0x1b')](_0x255c82[_0x0337('0x2e')]['offset']);}_0xaf3ccf[_0x0337('0x36')]=qs[_0x0337('0x37')](_0x255c82[_0x0337('0x2e')][_0x0337('0x37')]);_0xaf3ccf[_0x0337('0x38')]=qs[_0x0337('0x30')](_[_0x0337('0x39')](_0x255c82[_0x0337('0x2e')],_0x2449cd[_0x0337('0x30')]),_0x3f5a20);if(_0x255c82[_0x0337('0x2e')][_0x0337('0x3a')]){_0xaf3ccf[_0x0337('0x38')]=_['merge'](_0xaf3ccf[_0x0337('0x38')],{'$or':_[_0x0337('0x27')](_0x3f5a20,function(_0x24a637){if(_0x24a637['type']!==_0x0337('0x3b')){var _0x2f89df={};_0x2f89df[_0x24a637[_0x0337('0x25')]]={'$like':'%'+_0x255c82[_0x0337('0x2e')][_0x0337('0x3a')]+'%'};return _0x2f89df;}})});}_0xaf3ccf=_[_0x0337('0x3c')]({},_0xaf3ccf,_0x255c82[_0x0337('0x3d')]);var _0x13fc9a={'where':_0xaf3ccf[_0x0337('0x38')]};return db[_0x0337('0x28')]['count'](_0x13fc9a)[_0x0337('0x22')](function(_0x5565e4){_0x2c57f7[_0x0337('0x1c')]=_0x5565e4;if(_0x255c82['query'][_0x0337('0x3e')]){_0xaf3ccf['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0xaf3ccf);})[_0x0337('0x22')](function(_0x3d3fd6){_0x2c57f7[_0x0337('0x3f')]=_0x3d3fd6;return _0x2c57f7;})[_0x0337('0x22')](respondWithFilteredResult(_0x326dc2,_0xaf3ccf))[_0x0337('0x40')](handleError(_0x326dc2,null));};exports['show']=function(_0x2ecd3c,_0x16ac7e){var _0x3f6c0c={'raw':![],'where':{'id':_0x2ecd3c[_0x0337('0x41')]['id']}},_0x277748={};_0x277748[_0x0337('0x2d')]=_['keys'](db[_0x0337('0x28')]['rawAttributes']);_0x277748[_0x0337('0x2e')]=_[_0x0337('0x2f')](_0x2ecd3c[_0x0337('0x2e')]);_0x277748['filters']=_[_0x0337('0x31')](_0x277748[_0x0337('0x2d')],_0x277748[_0x0337('0x2e')]);_0x3f6c0c[_0x0337('0x32')]=_[_0x0337('0x31')](_0x277748[_0x0337('0x2d')],qs['fields'](_0x2ecd3c['query'][_0x0337('0x33')]));_0x3f6c0c[_0x0337('0x32')]=_0x3f6c0c['attributes']['length']?_0x3f6c0c[_0x0337('0x32')]:_0x277748[_0x0337('0x2d')];if(_0x2ecd3c[_0x0337('0x2e')]['includeAll']){_0x3f6c0c[_0x0337('0x42')]=[{'all':!![]}];}_0x3f6c0c=_[_0x0337('0x3c')]({},_0x3f6c0c,_0x2ecd3c[_0x0337('0x3d')]);return db['UserProfileSection'][_0x0337('0x43')](_0x3f6c0c)[_0x0337('0x22')](handleEntityNotFound(_0x16ac7e,null))[_0x0337('0x22')](respondWithResult(_0x16ac7e,null))[_0x0337('0x40')](handleError(_0x16ac7e,null));};exports['create']=function(_0x2df0cd,_0x12ba92){return db[_0x0337('0x28')][_0x0337('0x44')](_0x2df0cd[_0x0337('0x45')],{})[_0x0337('0x22')](respondWithResult(_0x12ba92,0xc9))[_0x0337('0x40')](handleError(_0x12ba92,null));};exports[_0x0337('0x21')]=function(_0x2b676a,_0x5a86b1){if(_0x2b676a['body']['id']){delete _0x2b676a[_0x0337('0x45')]['id'];}return db[_0x0337('0x28')][_0x0337('0x43')]({'where':{'id':_0x2b676a['params']['id']}})[_0x0337('0x22')](handleEntityNotFound(_0x5a86b1,null))[_0x0337('0x22')](saveUpdates(_0x2b676a['body'],null))['then'](respondWithResult(_0x5a86b1,null))[_0x0337('0x40')](handleError(_0x5a86b1,null));};exports[_0x0337('0x23')]=function(_0x1f63e4,_0x1c5df6){return db['UserProfileSection'][_0x0337('0x43')]({'where':{'id':_0x1f63e4['params']['id']}})[_0x0337('0x22')](handleEntityNotFound(_0x1c5df6,null))[_0x0337('0x22')](removeEntity(_0x1c5df6,null))[_0x0337('0x40')](handleError(_0x1c5df6,null));};exports[_0x0337('0x46')]=function(_0x3b5b9b,_0x338fea){return db[_0x0337('0x28')]['describe']()[_0x0337('0x22')](respondWithResult(_0x338fea,null))[_0x0337('0x40')](handleError(_0x338fea,null));}; \ No newline at end of file +var _0x11d3=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','UserProfileSection','type','key','model','query','keys'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x11d3,0x1ee));var _0x311d=function(_0x4159bc,_0x13aa41){_0x4159bc=_0x4159bc-0x0;var _0x536069=_0x11d3[_0x4159bc];return _0x536069;};'use strict';var emlformat=require(_0x311d('0x0'));var rimraf=require(_0x311d('0x1'));var zipdir=require(_0x311d('0x2'));var jsonpatch=require(_0x311d('0x3'));var rp=require('request-promise');var moment=require(_0x311d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x311d('0x5'));var util=require(_0x311d('0x6'));var path=require(_0x311d('0x7'));var sox=require(_0x311d('0x8'));var csv=require(_0x311d('0x9'));var ejs=require(_0x311d('0xa'));var fs=require('fs');var fs_extra=require(_0x311d('0xb'));var _=require('lodash');var squel=require(_0x311d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x311d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x311d('0xe'));var Papa=require('papaparse');var Redis=require(_0x311d('0xf'));var authService=require(_0x311d('0x10'));var qs=require(_0x311d('0x11'));var as=require(_0x311d('0x12'));var hardwareService=require(_0x311d('0x13'));var logger=require(_0x311d('0x14'))('api');var utils=require(_0x311d('0x15'));var config=require(_0x311d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x311d('0x17'))['db'];function respondWithStatusCode(_0x3330bb,_0x1f2760){_0x1f2760=_0x1f2760||0xcc;return function(_0x24bdc0){if(_0x24bdc0){return _0x3330bb['sendStatus'](_0x1f2760);}return _0x3330bb['status'](_0x1f2760)['end']();};}function respondWithResult(_0xbaff7d,_0x110dfe){_0x110dfe=_0x110dfe||0xc8;return function(_0x35ce04){if(_0x35ce04){return _0xbaff7d[_0x311d('0x18')](_0x110dfe)[_0x311d('0x19')](_0x35ce04);}};}function respondWithFilteredResult(_0x13f1c1,_0x342068){return function(_0x138a89){if(_0x138a89){var _0x3910a1=typeof _0x342068['offset']===_0x311d('0x1a')&&typeof _0x342068[_0x311d('0x1b')]===_0x311d('0x1a');var _0x352b32=_0x138a89[_0x311d('0x1c')];var _0x3cb266=_0x3910a1?0x0:_0x342068['offset'];var _0xd7b2b9=_0x3910a1?_0x138a89[_0x311d('0x1c')]:_0x342068[_0x311d('0x1d')]+_0x342068[_0x311d('0x1b')];var _0x5c6e8b;if(_0xd7b2b9>=_0x352b32){_0xd7b2b9=_0x352b32;_0x5c6e8b=0xc8;}else{_0x5c6e8b=0xce;}_0x13f1c1['status'](_0x5c6e8b);return _0x13f1c1[_0x311d('0x1e')](_0x311d('0x1f'),_0x3cb266+'-'+_0xd7b2b9+'/'+_0x352b32)[_0x311d('0x19')](_0x138a89);}return null;};}function patchUpdates(_0x2fee45){return function(_0x40eab1){try{jsonpatch[_0x311d('0x20')](_0x40eab1,_0x2fee45,!![]);}catch(_0x2c90d1){return BPromise[_0x311d('0x21')](_0x2c90d1);}return _0x40eab1[_0x311d('0x22')]();};}function saveUpdates(_0x410653,_0x111bde){return function(_0x18674b){if(_0x18674b){return _0x18674b[_0x311d('0x23')](_0x410653)[_0x311d('0x24')](function(_0x1e5ac1){return _0x1e5ac1;});}return null;};}function removeEntity(_0xf54c83,_0x1ea599){return function(_0x3a8383){if(_0x3a8383){return _0x3a8383[_0x311d('0x25')]()[_0x311d('0x24')](function(){_0xf54c83['status'](0xcc)[_0x311d('0x26')]();});}};}function handleEntityNotFound(_0x42a0f8,_0x1c7576){return function(_0x3cf905){if(!_0x3cf905){_0x42a0f8[_0x311d('0x27')](0x194);}return _0x3cf905;};}function handleError(_0x6b21dd,_0x18f555){_0x18f555=_0x18f555||0x1f4;return function(_0x1f7240){logger[_0x311d('0x28')](_0x1f7240[_0x311d('0x29')]);if(_0x1f7240[_0x311d('0x2a')]){delete _0x1f7240[_0x311d('0x2a')];}_0x6b21dd[_0x311d('0x18')](_0x18f555)[_0x311d('0x2b')](_0x1f7240);};}exports[_0x311d('0x2c')]=function(_0x5c3068,_0x52c5fb){var _0xe934fb={},_0x36001e={},_0x5a4bd3={'count':0x0,'rows':[]};var _0x25a902=_[_0x311d('0x2d')](db[_0x311d('0x2e')]['rawAttributes'],function(_0x2a0b61){return{'name':_0x2a0b61['fieldName'],'type':_0x2a0b61[_0x311d('0x2f')][_0x311d('0x30')]};});_0x36001e[_0x311d('0x31')]=_[_0x311d('0x2d')](_0x25a902,_0x311d('0x2a'));_0x36001e[_0x311d('0x32')]=_[_0x311d('0x33')](_0x5c3068[_0x311d('0x32')]);_0x36001e[_0x311d('0x34')]=_['intersection'](_0x36001e[_0x311d('0x31')],_0x36001e['query']);_0xe934fb[_0x311d('0x35')]=_[_0x311d('0x36')](_0x36001e[_0x311d('0x31')],qs[_0x311d('0x37')](_0x5c3068[_0x311d('0x32')]['fields']));_0xe934fb[_0x311d('0x35')]=_0xe934fb['attributes'][_0x311d('0x38')]?_0xe934fb[_0x311d('0x35')]:_0x36001e[_0x311d('0x31')];if(!_0x5c3068[_0x311d('0x32')][_0x311d('0x39')](_0x311d('0x3a'))){_0xe934fb[_0x311d('0x1b')]=qs[_0x311d('0x1b')](_0x5c3068['query']['limit']);_0xe934fb[_0x311d('0x1d')]=qs[_0x311d('0x1d')](_0x5c3068[_0x311d('0x32')][_0x311d('0x1d')]);}_0xe934fb['order']=qs[_0x311d('0x3b')](_0x5c3068[_0x311d('0x32')][_0x311d('0x3b')]);_0xe934fb[_0x311d('0x3c')]=qs[_0x311d('0x34')](_[_0x311d('0x3d')](_0x5c3068[_0x311d('0x32')],_0x36001e['filters']),_0x25a902);if(_0x5c3068[_0x311d('0x32')][_0x311d('0x3e')]){_0xe934fb['where']=_[_0x311d('0x3f')](_0xe934fb[_0x311d('0x3c')],{'$or':_[_0x311d('0x2d')](_0x25a902,function(_0x1f423d){if(_0x1f423d[_0x311d('0x2f')]!==_0x311d('0x40')){var _0x2f7148={};_0x2f7148[_0x1f423d['name']]={'$like':'%'+_0x5c3068[_0x311d('0x32')][_0x311d('0x3e')]+'%'};return _0x2f7148;}})});}_0xe934fb=_[_0x311d('0x3f')]({},_0xe934fb,_0x5c3068[_0x311d('0x41')]);var _0x163349={'where':_0xe934fb[_0x311d('0x3c')]};return db[_0x311d('0x2e')][_0x311d('0x1c')](_0x163349)[_0x311d('0x24')](function(_0x3bb945){_0x5a4bd3[_0x311d('0x1c')]=_0x3bb945;if(_0x5c3068[_0x311d('0x32')][_0x311d('0x42')]){_0xe934fb[_0x311d('0x43')]=[{'all':!![]}];}return db['UserProfileSection'][_0x311d('0x44')](_0xe934fb);})[_0x311d('0x24')](function(_0x5c5412){_0x5a4bd3[_0x311d('0x45')]=_0x5c5412;return _0x5a4bd3;})[_0x311d('0x24')](respondWithFilteredResult(_0x52c5fb,_0xe934fb))['catch'](handleError(_0x52c5fb,null));};exports[_0x311d('0x46')]=function(_0x48672c,_0x43f47b){var _0x377771={'raw':![],'where':{'id':_0x48672c[_0x311d('0x47')]['id']}},_0x3ef367={};_0x3ef367[_0x311d('0x31')]=_[_0x311d('0x33')](db['UserProfileSection'][_0x311d('0x48')]);_0x3ef367['query']=_[_0x311d('0x33')](_0x48672c[_0x311d('0x32')]);_0x3ef367[_0x311d('0x34')]=_[_0x311d('0x36')](_0x3ef367[_0x311d('0x31')],_0x3ef367[_0x311d('0x32')]);_0x377771[_0x311d('0x35')]=_[_0x311d('0x36')](_0x3ef367[_0x311d('0x31')],qs[_0x311d('0x37')](_0x48672c[_0x311d('0x32')][_0x311d('0x37')]));_0x377771[_0x311d('0x35')]=_0x377771[_0x311d('0x35')][_0x311d('0x38')]?_0x377771['attributes']:_0x3ef367[_0x311d('0x31')];if(_0x48672c[_0x311d('0x32')]['includeAll']){_0x377771['include']=[{'all':!![]}];}_0x377771=_[_0x311d('0x3f')]({},_0x377771,_0x48672c[_0x311d('0x41')]);return db[_0x311d('0x2e')]['find'](_0x377771)[_0x311d('0x24')](handleEntityNotFound(_0x43f47b,null))[_0x311d('0x24')](respondWithResult(_0x43f47b,null))[_0x311d('0x49')](handleError(_0x43f47b,null));};exports['create']=function(_0x201e48,_0x564bc6){return db[_0x311d('0x2e')][_0x311d('0x4a')](_0x201e48[_0x311d('0x4b')],{})[_0x311d('0x24')](respondWithResult(_0x564bc6,0xc9))[_0x311d('0x49')](handleError(_0x564bc6,null));};exports['update']=function(_0x13fea4,_0x5e179d){if(_0x13fea4['body']['id']){delete _0x13fea4[_0x311d('0x4b')]['id'];}return db[_0x311d('0x2e')][_0x311d('0x4c')]({'where':{'id':_0x13fea4[_0x311d('0x47')]['id']}})[_0x311d('0x24')](handleEntityNotFound(_0x5e179d,null))[_0x311d('0x24')](saveUpdates(_0x13fea4[_0x311d('0x4b')],null))[_0x311d('0x24')](respondWithResult(_0x5e179d,null))['catch'](handleError(_0x5e179d,null));};exports[_0x311d('0x25')]=function(_0x587608,_0x58b110){return db[_0x311d('0x2e')][_0x311d('0x4c')]({'where':{'id':_0x587608[_0x311d('0x47')]['id']}})['then'](handleEntityNotFound(_0x58b110,null))[_0x311d('0x24')](removeEntity(_0x58b110,null))['catch'](handleError(_0x58b110,null));};exports[_0x311d('0x4d')]=function(_0x333e0d,_0x30a9c3){return db[_0x311d('0x2e')]['describe']()[_0x311d('0x24')](respondWithResult(_0x30a9c3,null))[_0x311d('0x49')](handleError(_0x30a9c3,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 987a6f8..e17827c 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 _0x7911=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','lodash','util','../../config/logger','api'];(function(_0x729b6f,_0x369f24){var _0x218527=function(_0x18293c){while(--_0x18293c){_0x729b6f['push'](_0x729b6f['shift']());}};_0x218527(++_0x369f24);}(_0x7911,0x1dd));var _0x1791=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x7911[_0x20cb20];return _0x2fcf4b;};'use strict';var _=require(_0x1791('0x0'));var util=require(_0x1791('0x1'));var logger=require(_0x1791('0x2'))(_0x1791('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1791('0x4'));var rimraf=require(_0x1791('0x5'));var config=require(_0x1791('0x6'));var attributes=require(_0x1791('0x7'));module[_0x1791('0x8')]=function(_0x2e4775,_0x7d2d07){return _0x2e4775[_0x1791('0x9')](_0x1791('0xa'),attributes,{'tableName':_0x1791('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1791('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed35=['lodash','util','api','moment','path','rimraf','./userProfileSection.attributes','UserProfileSection','compositeIndex','userProfileId'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xed35,0xaa));var _0x5ed3=function(_0x221968,_0xa87f20){_0x221968=_0x221968-0x0;var _0x501cac=_0xed35[_0x221968];return _0x501cac;};'use strict';var _=require(_0x5ed3('0x0'));var util=require(_0x5ed3('0x1'));var logger=require('../../config/logger')(_0x5ed3('0x2'));var moment=require(_0x5ed3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ed3('0x4'));var rimraf=require(_0x5ed3('0x5'));var config=require('../../config/environment');var attributes=require(_0x5ed3('0x6'));module['exports']=function(_0x596a34,_0x1f4d1f){return _0x596a34['define'](_0x5ed3('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x5ed3('0x8'),'fields':['sectionId',_0x5ed3('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 5e4d011..dc8b445 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 _0x119d=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','../../config/utils','rpc','../../config/environment','client'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x119d,0x181));var _0xd119=function(_0x26550f,_0x4109c7){_0x26550f=_0x26550f-0x0;var _0x79e1d=_0x119d[_0x26550f];return _0x79e1d;};'use strict';var _=require('lodash');var util=require(_0xd119('0x0'));var moment=require(_0xd119('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd119('0x2'));var logger=require('../../config/logger')(_0xd119('0x3'));var config=require(_0xd119('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd119('0x5')][_0xd119('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x72c210,_0x2fa420,_0x97ba2d){return new BPromise(function(_0x16e1d0,_0x3ea317){return client[_0xd119('0x7')](_0x72c210,_0x97ba2d)[_0xd119('0x8')](function(_0x2ec892){logger[_0xd119('0x9')](_0xd119('0xa'),_0x2fa420,_0xd119('0xb'));logger[_0xd119('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2fa420,_0xd119('0xb'),JSON[_0xd119('0xd')](_0x2ec892));if(_0x2ec892[_0xd119('0xe')]){if(_0x2ec892[_0xd119('0xe')]['code']===0x1f4){logger[_0xd119('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2fa420,_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);return _0x3ea317(_0x2ec892['error'][_0xd119('0xf')]);}logger[_0xd119('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2fa420,_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);return _0x16e1d0(_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);}else{logger[_0xd119('0x9')](_0xd119('0xa'),_0x2fa420,_0xd119('0xb'));_0x16e1d0(_0x2ec892['result'][_0xd119('0xf')]);}})[_0xd119('0x10')](function(_0x10028e){logger['error'](_0xd119('0xa'),_0x2fa420,_0x10028e);_0x3ea317(_0x10028e);});});} \ No newline at end of file +var _0x77c6=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x49803f,_0x5c0423){var _0x5ae4d2=function(_0x390b14){while(--_0x390b14){_0x49803f['push'](_0x49803f['shift']());}};_0x5ae4d2(++_0x5c0423);}(_0x77c6,0x1b7));var _0x677c=function(_0x13044f,_0x3eefe1){_0x13044f=_0x13044f-0x0;var _0x526d36=_0x77c6[_0x13044f];return _0x526d36;};'use strict';var _=require(_0x677c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x677c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x677c('0x2'));var db=require(_0x677c('0x3'))['db'];var utils=require(_0x677c('0x4'));var logger=require(_0x677c('0x5'))(_0x677c('0x6'));var config=require('../../config/environment');var jayson=require(_0x677c('0x7'));var client=jayson['client'][_0x677c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e8efa,_0x1c2df1,_0x22580f){return new BPromise(function(_0x35d7e5,_0x4061f0){return client['request'](_0x2e8efa,_0x22580f)['then'](function(_0x48d8dc){logger[_0x677c('0x9')](_0x677c('0xa'),_0x1c2df1,'request\x20sent');logger[_0x677c('0xb')](_0x677c('0xc'),_0x1c2df1,_0x677c('0xd'),JSON['stringify'](_0x48d8dc));if(_0x48d8dc['error']){if(_0x48d8dc[_0x677c('0xe')]['code']===0x1f4){logger[_0x677c('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x1c2df1,_0x48d8dc[_0x677c('0xe')][_0x677c('0xf')]);return _0x4061f0(_0x48d8dc[_0x677c('0xe')][_0x677c('0xf')]);}logger['error'](_0x677c('0xa'),_0x1c2df1,_0x48d8dc[_0x677c('0xe')]['message']);return _0x35d7e5(_0x48d8dc['error'][_0x677c('0xf')]);}else{logger[_0x677c('0x9')](_0x677c('0xa'),_0x1c2df1,_0x677c('0xd'));_0x35d7e5(_0x48d8dc[_0x677c('0x10')]['message']);}})[_0x677c('0x11')](function(_0x122c70){logger[_0x677c('0xe')](_0x677c('0xa'),_0x1c2df1,_0x122c70);_0x4061f0(_0x122c70);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 7fed0da..ea019e4 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x23cbd5,_0x5be6f3){var _0x3a6a6e=function(_0x5bceeb){while(--_0x5bceeb){_0x23cbd5['push'](_0x23cbd5['shift']());}};_0x3a6a6e(++_0x5be6f3);}(_0x70e0,0x17b));var _0x070e=function(_0x165dac,_0x3d15c7){_0x165dac=_0x165dac-0x0;var _0x1b7011=_0x70e0[_0x165dac];return _0x1b7011;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2bde9f,_0x3ccd1b){var _0x3e8886=function(_0x3984bf){while(--_0x3984bf){_0x2bde9f['push'](_0x2bde9f['shift']());}};_0x3e8886(++_0x3ccd1b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 82b3e37..7efcc6b 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 _0x6a6b=['sequelize','exports','INTEGER'];(function(_0x562071,_0x57a342){var _0x45db81=function(_0x3be628){while(--_0x3be628){_0x562071['push'](_0x562071['shift']());}};_0x45db81(++_0x57a342);}(_0x6a6b,0x165));var _0xb6a6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6a6b[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xb6a6('0x0'));module[_0xb6a6('0x1')]={'penalty':{'type':Sequelize[_0xb6a6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf430=['INTEGER'];(function(_0x49f50a,_0x5b84bc){var _0x1e1c6d=function(_0x4e180a){while(--_0x4e180a){_0x49f50a['push'](_0x49f50a['shift']());}};_0x1e1c6d(++_0x5b84bc);}(_0xf430,0x102));var _0x0f43=function(_0x3d5df9,_0x5b3623){_0x3d5df9=_0x3d5df9-0x0;var _0x50ba39=_0xf430[_0x3d5df9];return _0x50ba39;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x0f43('0x0')],'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 3febb1a..9cf0c1a 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x4b895c,_0x118019){var _0x425934=function(_0x5af51f){while(--_0x5af51f){_0x4b895c['push'](_0x4b895c['shift']());}};_0x425934(++_0x118019);}(_0xdb28,0x106));var _0x8db2=function(_0x55a01a,_0xa68175){_0x55a01a=_0x55a01a-0x0;var _0x2fe3fc=_0xdb28[_0x55a01a];return _0x2fe3fc;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2c7=['rimraf','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3791a2,_0x31e813){var _0x23948d=function(_0x325a06){while(--_0x325a06){_0x3791a2['push'](_0x3791a2['shift']());}};_0x23948d(++_0x31e813);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3c92eb,_0x17ca91){_0x3c92eb=_0x3c92eb-0x0;var _0x2c4e89=_0xc2c7[_0x3c92eb];return _0x2c4e89;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x7c2c('0x8')]=function(_0x42ecc9,_0x23c038){return _0x42ecc9['define']('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','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 6c6ba1a..0443fb8 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 _0xab4a=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x12273a,_0x20b902){var _0x57f970=function(_0x4420a5){while(--_0x4420a5){_0x12273a['push'](_0x12273a['shift']());}};_0x57f970(++_0x20b902);}(_0xab4a,0x1a1));var _0xaab4=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xab4a[_0x556634];return _0x4429fd;};'use strict';var _=require(_0xaab4('0x0'));var util=require(_0xaab4('0x1'));var moment=require('moment');var BPromise=require(_0xaab4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaab4('0x3'));var db=require(_0xaab4('0x4'))['db'];var utils=require(_0xaab4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xaab4('0x6'));var jayson=require(_0xaab4('0x7'));var client=jayson['client'][_0xaab4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14abde,_0x4e7fd2,_0x1bcb09){return new BPromise(function(_0x5b6206,_0x3076e6){return client[_0xaab4('0x9')](_0x14abde,_0x1bcb09)[_0xaab4('0xa')](function(_0xdc40b7){logger[_0xaab4('0xb')](_0xaab4('0xc'),_0x4e7fd2,_0xaab4('0xd'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4e7fd2,_0xaab4('0xd'),JSON[_0xaab4('0xe')](_0xdc40b7));if(_0xdc40b7[_0xaab4('0xf')]){if(_0xdc40b7[_0xaab4('0xf')][_0xaab4('0x10')]===0x1f4){logger[_0xaab4('0xf')](_0xaab4('0xc'),_0x4e7fd2,_0xdc40b7[_0xaab4('0xf')][_0xaab4('0x11')]);return _0x3076e6(_0xdc40b7[_0xaab4('0xf')][_0xaab4('0x11')]);}logger[_0xaab4('0xf')](_0xaab4('0xc'),_0x4e7fd2,_0xdc40b7[_0xaab4('0xf')][_0xaab4('0x11')]);return _0x5b6206(_0xdc40b7['error'][_0xaab4('0x11')]);}else{logger[_0xaab4('0xb')](_0xaab4('0xc'),_0x4e7fd2,_0xaab4('0xd'));_0x5b6206(_0xdc40b7[_0xaab4('0x12')]['message']);}})[_0xaab4('0x13')](function(_0x1ca019){logger[_0xaab4('0xf')](_0xaab4('0xc'),_0x4e7fd2,_0x1ca019);_0x3076e6(_0x1ca019);});});} \ No newline at end of file +var _0xabc8=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring'];(function(_0xfd4894,_0x30e841){var _0x5c08d3=function(_0x33897a){while(--_0x33897a){_0xfd4894['push'](_0xfd4894['shift']());}};_0x5c08d3(++_0x30e841);}(_0xabc8,0xa4));var _0x8abc=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0xabc8[_0x188703];return _0x1a0c81;};'use strict';var _=require(_0x8abc('0x0'));var util=require('util');var moment=require(_0x8abc('0x1'));var BPromise=require(_0x8abc('0x2'));var rs=require(_0x8abc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8abc('0x4'))['db'];var utils=require(_0x8abc('0x5'));var logger=require(_0x8abc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8abc('0x7'));var client=jayson[_0x8abc('0x8')][_0x8abc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542696,_0x220947,_0x12a6c6){return new BPromise(function(_0x5557e8,_0x1f5100){return client[_0x8abc('0xa')](_0x542696,_0x12a6c6)[_0x8abc('0xb')](function(_0x483ffc){logger[_0x8abc('0xc')](_0x8abc('0xd'),_0x220947,_0x8abc('0xe'));logger[_0x8abc('0xf')](_0x8abc('0x10'),_0x220947,_0x8abc('0xe'),JSON[_0x8abc('0x11')](_0x483ffc));if(_0x483ffc['error']){if(_0x483ffc[_0x8abc('0x12')]['code']===0x1f4){logger['error'](_0x8abc('0xd'),_0x220947,_0x483ffc['error']['message']);return _0x1f5100(_0x483ffc[_0x8abc('0x12')][_0x8abc('0x13')]);}logger[_0x8abc('0x12')](_0x8abc('0xd'),_0x220947,_0x483ffc[_0x8abc('0x12')][_0x8abc('0x13')]);return _0x5557e8(_0x483ffc[_0x8abc('0x12')][_0x8abc('0x13')]);}else{logger[_0x8abc('0xc')](_0x8abc('0xd'),_0x220947,_0x8abc('0xe'));_0x5557e8(_0x483ffc[_0x8abc('0x14')]['message']);}})['catch'](function(_0x42a9f5){logger[_0x8abc('0x12')](_0x8abc('0xd'),_0x220947,_0x42a9f5);_0x1f5100(_0x42a9f5);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e181aff..47b193b 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 _0x7b33=['sequelize','INTEGER'];(function(_0x1b8370,_0x1ec064){var _0x185053=function(_0x3e2a87){while(--_0x3e2a87){_0x1b8370['push'](_0x1b8370['shift']());}};_0x185053(++_0x1ec064);}(_0x7b33,0x1e2));var _0x37b3=function(_0x2dfff7,_0x4e54ee){_0x2dfff7=_0x2dfff7-0x0;var _0x434244=_0x7b33[_0x2dfff7];return _0x434244;};'use strict';var Sequelize=require(_0x37b3('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x37b3('0x1')]}}; \ No newline at end of file +var _0xc115=['INTEGER','exports'];(function(_0x46066f,_0x23105c){var _0x411977=function(_0x5743ff){while(--_0x5743ff){_0x46066f['push'](_0x46066f['shift']());}};_0x411977(++_0x23105c);}(_0xc115,0x199));var _0x5c11=function(_0x18b540,_0xc760a2){_0x18b540=_0x18b540-0x0;var _0x5eb863=_0xc115[_0x18b540];return _0x5eb863;};'use strict';var Sequelize=require('sequelize');module[_0x5c11('0x0')]={'UserId':{'type':Sequelize[_0x5c11('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index a494eb9..0317a66 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(_0x2e4400,_0x5e46ac){var _0x2afa6c=function(_0x55de8c){while(--_0x55de8c){_0x2e4400['push'](_0x2e4400['shift']());}};_0x2afa6c(++_0x5e46ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x49162c,_0x1365ed){var _0x5dd185=function(_0x2efa05){while(--_0x2efa05){_0x49162c['push'](_0x49162c['shift']());}};_0x5dd185(++_0x1365ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 34aef38..17a308f 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x11f857,_0x4c8e73){var _0x297db8=function(_0x4f8d31){while(--_0x4f8d31){_0x11f857['push'](_0x11f857['shift']());}};_0x297db8(++_0x4c8e73);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0xcb91[_0x404957];return _0x4e0365;};'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(_0x4429c7,_0x5d8046){var _0x247af7=function(_0x41c928){while(--_0x41c928){_0x4429c7['push'](_0x4429c7['shift']());}};_0x247af7(++_0x5d8046);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9006424..bc0060e 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x08d2=['sequelize','exports','INTEGER'];(function(_0x595654,_0x276079){var _0x236724=function(_0x595989){while(--_0x595989){_0x595654['push'](_0x595654['shift']());}};_0x236724(++_0x276079);}(_0x08d2,0xd2));var _0x208d=function(_0x3f37f0,_0x241d24){_0x3f37f0=_0x3f37f0-0x0;var _0x3d7cd0=_0x08d2[_0x3f37f0];return _0x3d7cd0;};'use strict';var Sequelize=require(_0x208d('0x0'));module[_0x208d('0x1')]={'penalty':{'type':Sequelize[_0x208d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index e0d2d70..64cfe3b 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 _0x8373=['api','moment','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','../../config/logger'];(function(_0x2215d2,_0x563782){var _0x2bb13a=function(_0x1bb042){while(--_0x1bb042){_0x2215d2['push'](_0x2215d2['shift']());}};_0x2bb13a(++_0x563782);}(_0x8373,0x1e2));var _0x3837=function(_0x403490,_0x41d621){_0x403490=_0x403490-0x0;var _0x3ab7c9=_0x8373[_0x403490];return _0x3ab7c9;};'use strict';var _=require(_0x3837('0x0'));var util=require('util');var logger=require(_0x3837('0x1'))(_0x3837('0x2'));var moment=require(_0x3837('0x3'));var BPromise=require('bluebird');var rp=require(_0x3837('0x4'));var fs=require('fs');var path=require(_0x3837('0x5'));var rimraf=require('rimraf');var config=require(_0x3837('0x6'));var attributes=require(_0x3837('0x7'));module[_0x3837('0x8')]=function(_0x22b18a,_0x5846d6){return _0x22b18a[_0x3837('0x9')]('UserVoiceQueue',attributes,{'tableName':_0x3837('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e18=['api','moment','request-promise','path','./userVoiceQueue.attributes','define','user_has_voice_queues','lodash','util'];(function(_0x21c3ef,_0xac0636){var _0xa2c7b5=function(_0x50b953){while(--_0x50b953){_0x21c3ef['push'](_0x21c3ef['shift']());}};_0xa2c7b5(++_0xac0636);}(_0x3e18,0x19c));var _0x83e1=function(_0x414e6c,_0x9e94d4){_0x414e6c=_0x414e6c-0x0;var _0x3cd105=_0x3e18[_0x414e6c];return _0x3cd105;};'use strict';var _=require(_0x83e1('0x0'));var util=require(_0x83e1('0x1'));var logger=require('../../config/logger')(_0x83e1('0x2'));var moment=require(_0x83e1('0x3'));var BPromise=require('bluebird');var rp=require(_0x83e1('0x4'));var fs=require('fs');var path=require(_0x83e1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x83e1('0x6'));module['exports']=function(_0x342e2c,_0x4cc631){return _0x342e2c[_0x83e1('0x7')]('UserVoiceQueue',attributes,{'tableName':_0x83e1('0x8'),'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 a9d9bf5..1f77f4c 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 _0x4539=['error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x4539,0x1d1));var _0x9453=function(_0x2206f0,_0x489836){_0x2206f0=_0x2206f0-0x0;var _0xab8693=_0x4539[_0x2206f0];return _0xab8693;};'use strict';var _=require('lodash');var util=require(_0x9453('0x0'));var moment=require('moment');var BPromise=require(_0x9453('0x1'));var rs=require(_0x9453('0x2'));var fs=require('fs');var Redis=require(_0x9453('0x3'));var db=require(_0x9453('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9453('0x5'))(_0x9453('0x6'));var config=require(_0x9453('0x7'));var jayson=require(_0x9453('0x8'));var client=jayson[_0x9453('0x9')][_0x9453('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x164979,_0x4e2bca,_0xe7c6c1){return new BPromise(function(_0x1d68a3,_0x26d62d){return client[_0x9453('0xb')](_0x164979,_0xe7c6c1)[_0x9453('0xc')](function(_0x223246){logger[_0x9453('0xd')](_0x9453('0xe'),_0x4e2bca,_0x9453('0xf'));logger[_0x9453('0x10')](_0x9453('0x11'),_0x4e2bca,'request\x20sent',JSON[_0x9453('0x12')](_0x223246));if(_0x223246[_0x9453('0x13')]){if(_0x223246[_0x9453('0x13')]['code']===0x1f4){logger['error'](_0x9453('0xe'),_0x4e2bca,_0x223246['error'][_0x9453('0x14')]);return _0x26d62d(_0x223246[_0x9453('0x13')][_0x9453('0x14')]);}logger['error'](_0x9453('0xe'),_0x4e2bca,_0x223246[_0x9453('0x13')]['message']);return _0x1d68a3(_0x223246[_0x9453('0x13')][_0x9453('0x14')]);}else{logger[_0x9453('0xd')](_0x9453('0xe'),_0x4e2bca,'request\x20sent');_0x1d68a3(_0x223246['result'][_0x9453('0x14')]);}})[_0x9453('0x15')](function(_0x1b7d74){logger['error'](_0x9453('0xe'),_0x4e2bca,_0x1b7d74);_0x26d62d(_0x1b7d74);});});} \ No newline at end of file +var _0x0a0c=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x10bd94,_0x46b509){var _0x364677=function(_0x417683){while(--_0x417683){_0x10bd94['push'](_0x10bd94['shift']());}};_0x364677(++_0x46b509);}(_0x0a0c,0x7a));var _0xc0a0=function(_0x16495f,_0x5f2cac){_0x16495f=_0x16495f-0x0;var _0x957e3e=_0x0a0c[_0x16495f];return _0x957e3e;};'use strict';var _=require(_0xc0a0('0x0'));var util=require(_0xc0a0('0x1'));var moment=require('moment');var BPromise=require(_0xc0a0('0x2'));var rs=require(_0xc0a0('0x3'));var fs=require('fs');var Redis=require(_0xc0a0('0x4'));var db=require(_0xc0a0('0x5'))['db'];var utils=require(_0xc0a0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc0a0('0x7'));var jayson=require(_0xc0a0('0x8'));var client=jayson[_0xc0a0('0x9')][_0xc0a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0fef,_0x4b21c3,_0x5c5f12){return new BPromise(function(_0x28347e,_0x244ea0){return client[_0xc0a0('0xb')](_0x2b0fef,_0x5c5f12)[_0xc0a0('0xc')](function(_0x3b6bf4){logger['info'](_0xc0a0('0xd'),_0x4b21c3,_0xc0a0('0xe'));logger[_0xc0a0('0xf')](_0xc0a0('0x10'),_0x4b21c3,_0xc0a0('0xe'),JSON[_0xc0a0('0x11')](_0x3b6bf4));if(_0x3b6bf4['error']){if(_0x3b6bf4[_0xc0a0('0x12')][_0xc0a0('0x13')]===0x1f4){logger['error'](_0xc0a0('0xd'),_0x4b21c3,_0x3b6bf4[_0xc0a0('0x12')][_0xc0a0('0x14')]);return _0x244ea0(_0x3b6bf4[_0xc0a0('0x12')][_0xc0a0('0x14')]);}logger[_0xc0a0('0x12')](_0xc0a0('0xd'),_0x4b21c3,_0x3b6bf4[_0xc0a0('0x12')]['message']);return _0x28347e(_0x3b6bf4[_0xc0a0('0x12')][_0xc0a0('0x14')]);}else{logger['info'](_0xc0a0('0xd'),_0x4b21c3,_0xc0a0('0xe'));_0x28347e(_0x3b6bf4[_0xc0a0('0x15')]['message']);}})[_0xc0a0('0x16')](function(_0x4871a1){logger[_0xc0a0('0x12')](_0xc0a0('0xd'),_0x4b21c3,_0x4871a1);_0x244ea0(_0x4871a1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8083ca3..4fbd9c0 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x56f935,_0xbb3e13){var _0x25ff2f=function(_0x3d0fad){while(--_0x3d0fad){_0x56f935['push'](_0x56f935['shift']());}};_0x25ff2f(++_0xbb3e13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3843c2,_0x2c7e72){var _0x2c8506=function(_0x475e90){while(--_0x475e90){_0x3843c2['push'](_0x3843c2['shift']());}};_0x2c8506(++_0x2c7e72);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xcb91[_0x213518];return _0x1baf75;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b6fb941..e22c0c1 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 _0x7003=['queue_interface','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x28226e,_0x1d53e4){var _0x472253=function(_0x49af92){while(--_0x49af92){_0x28226e['push'](_0x28226e['shift']());}};_0x472253(++_0x1d53e4);}(_0x7003,0x1ad));var _0x3700=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0x7003[_0x3f7598];return _0x51fb16;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3700('0x0')},'membername':{'type':Sequelize[_0x3700('0x1')],'allowNull':![],'comment':_0x3700('0x0')},'UserId':{'type':Sequelize[_0x3700('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3700('0x1')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x3700('0x1')],'allowNull':![],'unique':_0x3700('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x3700('0x2')](0xb),'defaultValue':0x0,'comment':_0x3700('0x0')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3700('0x0')}}; \ No newline at end of file +var _0x9af2=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9af2,0x12c));var _0x29af=function(_0xbe0a98,_0x55f72e){_0xbe0a98=_0xbe0a98-0x0;var _0x4572ac=_0x9af2[_0xbe0a98];return _0x4572ac;};'use strict';var Sequelize=require(_0x29af('0x0'));module[_0x29af('0x1')]={'uniqueid':{'type':Sequelize[_0x29af('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x29af('0x3')},'membername':{'type':Sequelize[_0x29af('0x4')],'allowNull':![],'comment':_0x29af('0x3')},'UserId':{'type':Sequelize[_0x29af('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x29af('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x29af('0x3')},'VoiceQueueId':{'type':Sequelize[_0x29af('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x29af('0x5'),'comment':_0x29af('0x3')},'penalty':{'type':Sequelize[_0x29af('0x2')](0xb),'defaultValue':0x0,'comment':_0x29af('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x29af('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e1c36cb..c4adada 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 _0xadb5=['emit','hook','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xadb5,0x1d2));var _0x5adb=function(_0xdd31ef,_0x31f1fd){_0xdd31ef=_0xdd31ef-0x0;var _0x5295d3=_0xadb5[_0xdd31ef];return _0x5295d3;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':_0x5adb('0x3'),'afterUpdate':_0x5adb('0x4'),'afterDestroy':_0x5adb('0x5')};function emitEvent(_0x5c31d6){return function(_0x5d791f,_0x42c464,_0x425251){UserVoiceQueueRtEvents['emit'](_0x5c31d6+':'+_0x5d791f['id'],_0x5d791f);UserVoiceQueueRtEvents[_0x5adb('0x6')](_0x5c31d6,_0x5d791f);_0x425251(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5adb('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa1ff=['hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa1ff,0x1cf));var _0xfa1f=function(_0x345cea,_0x409aea){_0x345cea=_0x345cea-0x0;var _0x14b70e=_0xa1ff[_0x345cea];return _0x14b70e;};'use strict';var EventEmitter=require(_0xfa1f('0x0'));var UserVoiceQueueRt=require(_0xfa1f('0x1'))['db'][_0xfa1f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfa1f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa1f('0x4'),'afterDestroy':_0xfa1f('0x5')};function emitEvent(_0x4116d9){return function(_0x51a3b6,_0x30edac,_0x27a3d5){UserVoiceQueueRtEvents[_0xfa1f('0x6')](_0x4116d9+':'+_0x51a3b6['id'],_0x51a3b6);UserVoiceQueueRtEvents[_0xfa1f('0x6')](_0x4116d9,_0x51a3b6);_0x27a3d5(null);};}for(var e in events){if(events[_0xfa1f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xfa1f('0x8')](e,emitEvent(event));}}module[_0xfa1f('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 8e1ad02..f12fef2 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 _0xb0ed=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1cf41d,_0x5f05b8){var _0x46cea5=function(_0x4da8d5){while(--_0x4da8d5){_0x1cf41d['push'](_0x1cf41d['shift']());}};_0x46cea5(++_0x5f05b8);}(_0xb0ed,0x1a4));var _0xdb0e=function(_0x38bd26,_0x58347e){_0x38bd26=_0x38bd26-0x0;var _0x411bcc=_0xb0ed[_0x38bd26];return _0x411bcc;};'use strict';var _=require(_0xdb0e('0x0'));var util=require(_0xdb0e('0x1'));var logger=require(_0xdb0e('0x2'))(_0xdb0e('0x3'));var moment=require('moment');var BPromise=require(_0xdb0e('0x4'));var rp=require(_0xdb0e('0x5'));var fs=require('fs');var path=require(_0xdb0e('0x6'));var rimraf=require(_0xdb0e('0x7'));var config=require(_0xdb0e('0x8'));var attributes=require(_0xdb0e('0x9'));module[_0xdb0e('0xa')]=function(_0xe9793c,_0x36ac29){return _0xe9793c[_0xdb0e('0xb')](_0xdb0e('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61a2=['../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61a2,0x1a7));var _0x261a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x61a2[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x261a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x261a('0x1'));var moment=require(_0x261a('0x2'));var BPromise=require(_0x261a('0x3'));var rp=require(_0x261a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x261a('0x5'));var config=require(_0x261a('0x6'));var attributes=require(_0x261a('0x7'));module['exports']=function(_0xfb4375,_0x3e5826){return _0xfb4375[_0x261a('0x8')](_0x261a('0x9'),attributes,{'tableName':_0x261a('0xa'),'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 e8ab094..a61f321 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 _0x4448=['raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','options'];(function(_0x2b2cc3,_0x264057){var _0x5920a4=function(_0x423107){while(--_0x423107){_0x2b2cc3['push'](_0x2b2cc3['shift']());}};_0x5920a4(++_0x264057);}(_0x4448,0x1b7));var _0x8444=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4448[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x8444('0x0'));var moment=require(_0x8444('0x1'));var BPromise=require('bluebird');var rs=require(_0x8444('0x2'));var fs=require('fs');var Redis=require(_0x8444('0x3'));var db=require(_0x8444('0x4'))['db'];var utils=require(_0x8444('0x5'));var logger=require(_0x8444('0x6'))(_0x8444('0x7'));var config=require(_0x8444('0x8'));var jayson=require(_0x8444('0x9'));var client=jayson[_0x8444('0xa')]['http']({'port':0x232a});config[_0x8444('0xb')]=_['defaults'](config[_0x8444('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8444('0xc'))(new Redis(config[_0x8444('0xb')]));require(_0x8444('0xd'))[_0x8444('0xe')](socket);function respondWithRpcPromise(_0xeb9e5c,_0x3e34e2,_0x4273db){return new BPromise(function(_0x200283,_0x2f89f7){return client['request'](_0xeb9e5c,_0x4273db)[_0x8444('0xf')](function(_0x142d1f){logger['info'](_0x8444('0x10'),_0x3e34e2,_0x8444('0x11'));logger[_0x8444('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3e34e2,'request\x20sent',JSON[_0x8444('0x13')](_0x142d1f));if(_0x142d1f[_0x8444('0x14')]){if(_0x142d1f['error'][_0x8444('0x15')]===0x1f4){logger['error'](_0x8444('0x10'),_0x3e34e2,_0x142d1f[_0x8444('0x14')][_0x8444('0x16')]);return _0x2f89f7(_0x142d1f[_0x8444('0x14')][_0x8444('0x16')]);}logger[_0x8444('0x14')](_0x8444('0x10'),_0x3e34e2,_0x142d1f[_0x8444('0x14')][_0x8444('0x16')]);return _0x200283(_0x142d1f[_0x8444('0x14')][_0x8444('0x16')]);}else{logger[_0x8444('0x17')](_0x8444('0x10'),_0x3e34e2,_0x8444('0x11'));_0x200283(_0x142d1f[_0x8444('0x18')][_0x8444('0x16')]);}})[_0x8444('0x19')](function(_0x1da9dd){logger[_0x8444('0x14')](_0x8444('0x10'),_0x3e34e2,_0x1da9dd);_0x2f89f7(_0x1da9dd);});});}exports['GetVoiceQueueRtPauses']=function(_0xd4fbb){var _0x19b3c5=this;return new Promise(function(_0x13bfa2,_0x65f080){return db[_0x8444('0x1a')][_0x8444('0x1b')]({'raw':_0xd4fbb[_0x8444('0x1c')]?_0xd4fbb[_0x8444('0x1c')][_0x8444('0x1d')]===undefined?!![]:![]:!![],'where':_0xd4fbb[_0x8444('0x1c')]?_0xd4fbb['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x8444('0x1e'),db[_0x8444('0x1f')]['fn']('IF',db[_0x8444('0x1f')][_0x8444('0x20')](_0x8444('0x21')))),_0x8444('0x22')]]})[_0x8444('0xf')](function(_0x363f8f){logger['info']('GetVoiceQueueRtPauses',_0xd4fbb);logger[_0x8444('0x12')](_0x8444('0x23'),_0xd4fbb,JSON[_0x8444('0x13')](_0x363f8f));_0x13bfa2(_0x363f8f);})[_0x8444('0x19')](function(_0x1822be){logger[_0x8444('0x14')](_0x8444('0x23'),_0x1822be[_0x8444('0x16')],_0xd4fbb);_0x65f080(_0x19b3c5[_0x8444('0x14')](0x1f4,_0x1822be[_0x8444('0x16')]));});});}; \ No newline at end of file +var _0x2981=['code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','raw','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','http','redis','defaults','localhost','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x555d12,_0x4894be){var _0x47c35c=function(_0x3b8106){while(--_0x3b8106){_0x555d12['push'](_0x555d12['shift']());}};_0x47c35c(++_0x4894be);}(_0x2981,0x11d));var _0x1298=function(_0x36a96a,_0x1eb790){_0x36a96a=_0x36a96a-0x0;var _0x50de5b=_0x2981[_0x36a96a];return _0x50de5b;};'use strict';var _=require('lodash');var util=require(_0x1298('0x0'));var moment=require(_0x1298('0x1'));var BPromise=require(_0x1298('0x2'));var rs=require(_0x1298('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1298('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1298('0x5'));var config=require('../../config/environment');var jayson=require(_0x1298('0x6'));var client=jayson['client'][_0x1298('0x7')]({'port':0x232a});config[_0x1298('0x8')]=_[_0x1298('0x9')](config[_0x1298('0x8')],{'host':_0x1298('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1298('0xb'))['register'](socket);function respondWithRpcPromise(_0x3609f6,_0x14b21e,_0x48391a){return new BPromise(function(_0x2dbe5d,_0x27a1a8){return client[_0x1298('0xc')](_0x3609f6,_0x48391a)[_0x1298('0xd')](function(_0x34b0b3){logger[_0x1298('0xe')](_0x1298('0xf'),_0x14b21e,_0x1298('0x10'));logger[_0x1298('0x11')](_0x1298('0x12'),_0x14b21e,_0x1298('0x10'),JSON[_0x1298('0x13')](_0x34b0b3));if(_0x34b0b3['error']){if(_0x34b0b3[_0x1298('0x14')][_0x1298('0x15')]===0x1f4){logger[_0x1298('0x14')](_0x1298('0xf'),_0x14b21e,_0x34b0b3[_0x1298('0x14')][_0x1298('0x16')]);return _0x27a1a8(_0x34b0b3[_0x1298('0x14')][_0x1298('0x16')]);}logger[_0x1298('0x14')](_0x1298('0xf'),_0x14b21e,_0x34b0b3[_0x1298('0x14')][_0x1298('0x16')]);return _0x2dbe5d(_0x34b0b3[_0x1298('0x14')]['message']);}else{logger[_0x1298('0xe')](_0x1298('0xf'),_0x14b21e,_0x1298('0x10'));_0x2dbe5d(_0x34b0b3[_0x1298('0x17')][_0x1298('0x16')]);}})[_0x1298('0x18')](function(_0xec11c){logger[_0x1298('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x14b21e,_0xec11c);_0x27a1a8(_0xec11c);});});}exports[_0x1298('0x19')]=function(_0x16f6c3){var _0xfa1a3f=this;return new Promise(function(_0x9f4126,_0x15669f){return db[_0x1298('0x1a')]['findAll']({'raw':_0x16f6c3['options']?_0x16f6c3['options'][_0x1298('0x1b')]===undefined?!![]:![]:!![],'where':_0x16f6c3[_0x1298('0x1c')]?_0x16f6c3[_0x1298('0x1c')][_0x1298('0x1d')]||null:null,'attributes':[[db[_0x1298('0x1e')]['fn']('COUNT',db[_0x1298('0x1e')]['fn']('IF',db[_0x1298('0x1e')][_0x1298('0x1f')](_0x1298('0x20')))),_0x1298('0x21')]]})[_0x1298('0xd')](function(_0x31800e){logger['info'](_0x1298('0x19'),_0x16f6c3);logger[_0x1298('0x11')]('GetVoiceQueueRtPauses',_0x16f6c3,JSON[_0x1298('0x13')](_0x31800e));_0x9f4126(_0x31800e);})[_0x1298('0x18')](function(_0x31f501){logger['error'](_0x1298('0x19'),_0x31f501[_0x1298('0x16')],_0x16f6c3);_0x15669f(_0xfa1a3f[_0x1298('0x14')](0x1f4,_0x31f501[_0x1298('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 48cecec..9413d69 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 _0xd991=['update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0xbe1d92,_0x418279){var _0x470ca3=function(_0x154d06){while(--_0x154d06){_0xbe1d92['push'](_0xbe1d92['shift']());}};_0x470ca3(++_0x418279);}(_0xd991,0x115));var _0x1d99=function(_0x6b19b6,_0x11b664){_0x6b19b6=_0x6b19b6-0x0;var _0x503f75=_0xd991[_0x6b19b6];return _0x503f75;};'use strict';var UserVoiceQueueRtEvents=require(_0x1d99('0x0'));var events=[_0x1d99('0x1'),_0x1d99('0x2'),_0x1d99('0x3')];function createListener(_0x163bfb,_0x5e7e82){return function(_0x3676c1){_0x5e7e82[_0x1d99('0x4')](_0x163bfb,_0x3676c1);};}function removeListener(_0xf03459,_0x1f6da3){return function(){UserVoiceQueueRtEvents[_0x1d99('0x5')](_0xf03459,_0x1f6da3);};}exports[_0x1d99('0x6')]=function(_0x5f3a37){for(var _0x1adbca=0x0,_0x440bb4=events['length'];_0x1adbca<_0x440bb4;_0x1adbca++){var _0x21d746=events[_0x1adbca];var _0x2f4502=createListener(_0x1d99('0x7')+_0x21d746,_0x5f3a37);UserVoiceQueueRtEvents['on'](_0x21d746,_0x2f4502);}}; \ No newline at end of file +var _0x744c=['save','remove','update','emit','register','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x1d9128,_0x5ab937){var _0x1ad7ae=function(_0x5c9516){while(--_0x5c9516){_0x1d9128['push'](_0x1d9128['shift']());}};_0x1ad7ae(++_0x5ab937);}(_0x744c,0xa0));var _0xc744=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x744c[_0x435044];return _0x33d4c6;};'use strict';var UserVoiceQueueRtEvents=require(_0xc744('0x0'));var events=[_0xc744('0x1'),_0xc744('0x2'),_0xc744('0x3')];function createListener(_0x4b6a83,_0x1f52c6){return function(_0x423eac){_0x1f52c6[_0xc744('0x4')](_0x4b6a83,_0x423eac);};}function removeListener(_0xde4228,_0x4f1c94){return function(){UserVoiceQueueRtEvents['removeListener'](_0xde4228,_0x4f1c94);};}exports[_0xc744('0x5')]=function(_0x1cc521){for(var _0x471094=0x0,_0x5d5009=events['length'];_0x471094<_0x5d5009;_0x471094++){var _0x5a85d6=events[_0x471094];var _0x2bb565=createListener(_0xc744('0x6')+_0x5a85d6,_0x1cc521);UserVoiceQueueRtEvents['on'](_0x5a85d6,_0x2bb565);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 8bf39ff..9dbd737 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2766b5,_0x4dd625){var _0x4b32d9=function(_0x588d05){while(--_0x588d05){_0x2766b5['push'](_0x2766b5['shift']());}};_0x4b32d9(++_0x4dd625);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4cbe98,_0x576f7b){var _0x49c755=function(_0x1e0487){while(--_0x1e0487){_0x4cbe98['push'](_0x4cbe98['shift']());}};_0x49c755(++_0x576f7b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9444cc4..3adbfc5 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 _0x7d3e=['INTEGER','sequelize','exports'];(function(_0x4b9d37,_0x356052){var _0x30cf4e=function(_0x24f502){while(--_0x24f502){_0x4b9d37['push'](_0x4b9d37['shift']());}};_0x30cf4e(++_0x356052);}(_0x7d3e,0x178));var _0xe7d3=function(_0x9e55f6,_0x5df434){_0x9e55f6=_0x9e55f6-0x0;var _0x220e55=_0x7d3e[_0x9e55f6];return _0x220e55;};'use strict';var Sequelize=require(_0xe7d3('0x0'));module[_0xe7d3('0x1')]={'penalty':{'type':Sequelize[_0xe7d3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeed4=['sequelize','exports','INTEGER'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0xeed4,0x162));var _0x4eed=function(_0x54bb04,_0x3aaec2){_0x54bb04=_0x54bb04-0x0;var _0xf7a4f4=_0xeed4[_0x54bb04];return _0xf7a4f4;};'use strict';var Sequelize=require(_0x4eed('0x0'));module[_0x4eed('0x1')]={'penalty':{'type':Sequelize[_0x4eed('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 ae7f047..9bbbfce 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 _0x035d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x37283b,_0x2e3c63){var _0x2ad2ec=function(_0x1530e9){while(--_0x1530e9){_0x37283b['push'](_0x37283b['shift']());}};_0x2ad2ec(++_0x2e3c63);}(_0x035d,0x14a));var _0xd035=function(_0x2b72eb,_0x2c8f01){_0x2b72eb=_0x2b72eb-0x0;var _0x1a3a9b=_0x035d[_0x2b72eb];return _0x1a3a9b;};'use strict';var _=require('lodash');var util=require(_0xd035('0x0'));var logger=require(_0xd035('0x1'))(_0xd035('0x2'));var moment=require(_0xd035('0x3'));var BPromise=require(_0xd035('0x4'));var rp=require(_0xd035('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd035('0x6'));var config=require('../../config/environment');var attributes=require(_0xd035('0x7'));module[_0xd035('0x8')]=function(_0x52a523,_0x57958b){return _0x52a523[_0xd035('0x9')](_0xd035('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04ab=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x04ab,0x1be));var _0xb04a=function(_0x567251,_0x417143){_0x567251=_0x567251-0x0;var _0x1f8f8c=_0x04ab[_0x567251];return _0x1f8f8c;};'use strict';var _=require(_0xb04a('0x0'));var util=require(_0xb04a('0x1'));var logger=require(_0xb04a('0x2'))(_0xb04a('0x3'));var moment=require('moment');var BPromise=require(_0xb04a('0x4'));var rp=require(_0xb04a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb04a('0x6'));var config=require(_0xb04a('0x7'));var attributes=require(_0xb04a('0x8'));module[_0xb04a('0x9')]=function(_0x2abd15,_0x5d6e20){return _0x2abd15['define'](_0xb04a('0xa'),attributes,{'tableName':_0xb04a('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 9f46e37..52392d4 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 _0x266b=['http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','info','result','catch','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','client'];(function(_0x22d696,_0x359d98){var _0x4f583b=function(_0x2764b7){while(--_0x2764b7){_0x22d696['push'](_0x22d696['shift']());}};_0x4f583b(++_0x359d98);}(_0x266b,0x1c1));var _0xb266=function(_0x5442ab,_0x3e4b10){_0x5442ab=_0x5442ab-0x0;var _0x1be600=_0x266b[_0x5442ab];return _0x1be600;};'use strict';var _=require('lodash');var util=require(_0xb266('0x0'));var moment=require(_0xb266('0x1'));var BPromise=require('bluebird');var rs=require(_0xb266('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb266('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb266('0x4'));var config=require(_0xb266('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb266('0x6')][_0xb266('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x288615,_0x50922f,_0x128dd7){return new BPromise(function(_0x2e44ca,_0x21d6a7){return client[_0xb266('0x8')](_0x288615,_0x128dd7)[_0xb266('0x9')](function(_0x366195){logger['info'](_0xb266('0xa'),_0x50922f,_0xb266('0xb'));logger[_0xb266('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x50922f,_0xb266('0xb'),JSON[_0xb266('0xd')](_0x366195));if(_0x366195['error']){if(_0x366195['error']['code']===0x1f4){logger['error'](_0xb266('0xa'),_0x50922f,_0x366195['error'][_0xb266('0xe')]);return _0x21d6a7(_0x366195['error'][_0xb266('0xe')]);}logger['error'](_0xb266('0xa'),_0x50922f,_0x366195[_0xb266('0xf')][_0xb266('0xe')]);return _0x2e44ca(_0x366195['error']['message']);}else{logger[_0xb266('0x10')](_0xb266('0xa'),_0x50922f,_0xb266('0xb'));_0x2e44ca(_0x366195[_0xb266('0x11')][_0xb266('0xe')]);}})[_0xb266('0x12')](function(_0x516712){logger[_0xb266('0xf')](_0xb266('0xa'),_0x50922f,_0x516712);_0x21d6a7(_0x516712);});});} \ No newline at end of file +var _0xb732=['../../config/logger','rpc','../../config/environment','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring'];(function(_0x5d583e,_0x59c8d8){var _0x3ec7ab=function(_0x853226){while(--_0x853226){_0x5d583e['push'](_0x5d583e['shift']());}};_0x3ec7ab(++_0x59c8d8);}(_0xb732,0xdb));var _0x2b73=function(_0x1730b1,_0x2dc4ac){_0x1730b1=_0x1730b1-0x0;var _0x9a5eab=_0xb732[_0x1730b1];return _0x9a5eab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2b73('0x0'));var BPromise=require('bluebird');var rs=require(_0x2b73('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b73('0x2'))(_0x2b73('0x3'));var config=require(_0x2b73('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57c47e,_0x3726a1,_0x158692){return new BPromise(function(_0x545431,_0x53f31f){return client[_0x2b73('0x5')](_0x57c47e,_0x158692)[_0x2b73('0x6')](function(_0x80172d){logger[_0x2b73('0x7')](_0x2b73('0x8'),_0x3726a1,_0x2b73('0x9'));logger[_0x2b73('0xa')](_0x2b73('0xb'),_0x3726a1,_0x2b73('0x9'),JSON[_0x2b73('0xc')](_0x80172d));if(_0x80172d['error']){if(_0x80172d[_0x2b73('0xd')][_0x2b73('0xe')]===0x1f4){logger[_0x2b73('0xd')](_0x2b73('0x8'),_0x3726a1,_0x80172d[_0x2b73('0xd')][_0x2b73('0xf')]);return _0x53f31f(_0x80172d[_0x2b73('0xd')][_0x2b73('0xf')]);}logger[_0x2b73('0xd')](_0x2b73('0x8'),_0x3726a1,_0x80172d[_0x2b73('0xd')][_0x2b73('0xf')]);return _0x545431(_0x80172d[_0x2b73('0xd')][_0x2b73('0xf')]);}else{logger[_0x2b73('0x7')](_0x2b73('0x8'),_0x3726a1,'request\x20sent');_0x545431(_0x80172d['result'][_0x2b73('0xf')]);}})[_0x2b73('0x10')](function(_0x99e754){logger[_0x2b73('0xd')](_0x2b73('0x8'),_0x3726a1,_0x99e754);_0x53f31f(_0x99e754);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 7420c7b..81db7a9 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 _0x2060=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','/:id','post','create'];(function(_0x9c937b,_0x4eb080){var _0x4af964=function(_0x183955){while(--_0x183955){_0x9c937b['push'](_0x9c937b['shift']());}};_0x4af964(++_0x4eb080);}(_0x2060,0x1be));var _0x0206=function(_0x359609,_0x16dff3){_0x359609=_0x359609-0x0;var _0x2b4fbc=_0x2060[_0x359609];return _0x2b4fbc;};'use strict';var multer=require(_0x0206('0x0'));var util=require('util');var path=require(_0x0206('0x1'));var timeout=require(_0x0206('0x2'));var express=require(_0x0206('0x3'));var router=express[_0x0206('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0206('0x5'));var interaction=require(_0x0206('0x6'));var config=require('../../config/environment');var controller=require(_0x0206('0x7'));router['get']('/',auth[_0x0206('0x8')](),controller[_0x0206('0x9')]);router['get'](_0x0206('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0206('0xb')]('/',auth[_0x0206('0x8')](),controller[_0x0206('0xc')]);router[_0x0206('0xd')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0xe')]);router[_0x0206('0xf')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0x10')]);module['exports']=router; \ No newline at end of file +var _0x89fe=['get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x2a9ec5,_0xed23b){var _0x52c7c0=function(_0x54b22d){while(--_0x54b22d){_0x2a9ec5['push'](_0x2a9ec5['shift']());}};_0x52c7c0(++_0xed23b);}(_0x89fe,0x83));var _0xe89f=function(_0x4273e2,_0x4e7c61){_0x4273e2=_0x4273e2-0x0;var _0x374a34=_0x89fe[_0x4273e2];return _0x374a34;};'use strict';var multer=require(_0xe89f('0x0'));var util=require(_0xe89f('0x1'));var path=require(_0xe89f('0x2'));var timeout=require(_0xe89f('0x3'));var express=require('express');var router=express[_0xe89f('0x4')]();var fs_extra=require(_0xe89f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe89f('0x6'));var config=require(_0xe89f('0x7'));var controller=require(_0xe89f('0x8'));router[_0xe89f('0x9')]('/',auth[_0xe89f('0xa')](),controller[_0xe89f('0xb')]);router[_0xe89f('0x9')]('/:id',auth[_0xe89f('0xa')](),controller[_0xe89f('0xc')]);router[_0xe89f('0xd')]('/',auth[_0xe89f('0xa')](),controller[_0xe89f('0xe')]);router['put'](_0xe89f('0xf'),auth[_0xe89f('0xa')](),controller[_0xe89f('0x10')]);router[_0xe89f('0x11')](_0xe89f('0xf'),auth[_0xe89f('0xa')](),controller[_0xe89f('0x12')]);module[_0xe89f('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c7326d6..1daef60 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 _0xc631=['name','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc631,0x82));var _0x1c63=function(_0x482354,_0x3dc153){_0x482354=_0x482354-0x0;var _0xdbd261=_0xc631[_0x482354];return _0xdbd261;};'use strict';var Sequelize=require('sequelize');module[_0x1c63('0x0')]={'name':{'type':Sequelize[_0x1c63('0x1')],'unique':_0x1c63('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1c63('0x1')]}}; \ No newline at end of file +var _0xabcb=['exports','STRING','name'];(function(_0x3fc0df,_0x5685ff){var _0x3f3db7=function(_0x2ac160){while(--_0x2ac160){_0x3fc0df['push'](_0x3fc0df['shift']());}};_0x3f3db7(++_0x5685ff);}(_0xabcb,0xf9));var _0xbabc=function(_0x20ddc4,_0x21def7){_0x20ddc4=_0x20ddc4-0x0;var _0x45e5ed=_0xabcb[_0x20ddc4];return _0x45e5ed;};'use strict';var Sequelize=require('sequelize');module[_0xbabc('0x0')]={'name':{'type':Sequelize[_0xbabc('0x1')],'unique':_0xbabc('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbabc('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3c3213b..86c715f 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 _0x3d95=['then','error','name','send','index','map','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Variable','includeAll','catch','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','get','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d95,0x126));var _0x53d9=function(_0x426f39,_0x2054cd){_0x426f39=_0x426f39-0x0;var _0x221adb=_0x3d95[_0x426f39];return _0x221adb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53d9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53d9('0x1'));var rp=require(_0x53d9('0x2'));var moment=require(_0x53d9('0x3'));var BPromise=require(_0x53d9('0x4'));var Mustache=require(_0x53d9('0x5'));var util=require('util');var path=require(_0x53d9('0x6'));var sox=require(_0x53d9('0x7'));var csv=require(_0x53d9('0x8'));var ejs=require(_0x53d9('0x9'));var fs=require('fs');var fs_extra=require(_0x53d9('0xa'));var _=require(_0x53d9('0xb'));var squel=require(_0x53d9('0xc'));var crypto=require(_0x53d9('0xd'));var jsforce=require(_0x53d9('0xe'));var deskjs=require(_0x53d9('0xf'));var toCsv=require(_0x53d9('0x8'));var querystring=require(_0x53d9('0x10'));var Papa=require(_0x53d9('0x11'));var Redis=require(_0x53d9('0x12'));var authService=require(_0x53d9('0x13'));var qs=require(_0x53d9('0x14'));var as=require(_0x53d9('0x15'));var hardwareService=require(_0x53d9('0x16'));var logger=require(_0x53d9('0x17'))('api');var utils=require(_0x53d9('0x18'));var config=require(_0x53d9('0x19'));var licenseUtil=require(_0x53d9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42dc15,_0x3f1243){_0x3f1243=_0x3f1243||0xcc;return function(_0x461b2d){if(_0x461b2d){return _0x42dc15[_0x53d9('0x1b')](_0x3f1243);}return _0x42dc15[_0x53d9('0x1c')](_0x3f1243)[_0x53d9('0x1d')]();};}function respondWithResult(_0x29ea15,_0x46442f){_0x46442f=_0x46442f||0xc8;return function(_0x14304f){if(_0x14304f){return _0x29ea15[_0x53d9('0x1c')](_0x46442f)[_0x53d9('0x1e')](_0x14304f);}};}function respondWithFilteredResult(_0x5b0c8b,_0x23f77c){return function(_0x1a2712){if(_0x1a2712){var _0x3a1421=typeof _0x23f77c[_0x53d9('0x1f')]===_0x53d9('0x20')&&typeof _0x23f77c['limit']===_0x53d9('0x20');var _0x2cd45c=_0x1a2712['count'];var _0x2a03f2=_0x3a1421?0x0:_0x23f77c['offset'];var _0x5804da=_0x3a1421?_0x1a2712[_0x53d9('0x21')]:_0x23f77c[_0x53d9('0x1f')]+_0x23f77c[_0x53d9('0x22')];var _0x72d6fe;if(_0x5804da>=_0x2cd45c){_0x5804da=_0x2cd45c;_0x72d6fe=0xc8;}else{_0x72d6fe=0xce;}_0x5b0c8b[_0x53d9('0x1c')](_0x72d6fe);return _0x5b0c8b['set'](_0x53d9('0x23'),_0x2a03f2+'-'+_0x5804da+'/'+_0x2cd45c)[_0x53d9('0x1e')](_0x1a2712);}return null;};}function patchUpdates(_0x52ae97){return function(_0x27b732){try{jsonpatch['apply'](_0x27b732,_0x52ae97,!![]);}catch(_0x42aff9){return BPromise[_0x53d9('0x24')](_0x42aff9);}return _0x27b732[_0x53d9('0x25')]();};}function saveUpdates(_0x919781,_0x411f98){return function(_0x286472){if(_0x286472){return _0x286472[_0x53d9('0x26')](_0x919781)['then'](function(_0x45bf96){return _0x45bf96;});}return null;};}function removeEntity(_0x161858,_0x391fdf){return function(_0x4480c5){if(_0x4480c5){return _0x4480c5[_0x53d9('0x27')]()['then'](function(){var _0x4b2136=_0x4480c5[_0x53d9('0x28')]({'plain':!![]});var _0x4d6132='Variables';return db[_0x53d9('0x29')][_0x53d9('0x27')]({'where':{'type':_0x4d6132,'resourceId':_0x4b2136['id']}})[_0x53d9('0x2a')](function(){return _0x4480c5;});})[_0x53d9('0x2a')](function(){_0x161858[_0x53d9('0x1c')](0xcc)[_0x53d9('0x1d')]();});}};}function handleEntityNotFound(_0xf064f9,_0x1036db){return function(_0x15d4bb){if(!_0x15d4bb){_0xf064f9[_0x53d9('0x1b')](0x194);}return _0x15d4bb;};}function handleError(_0x5b6925,_0x1411f8){_0x1411f8=_0x1411f8||0x1f4;return function(_0x261803){logger[_0x53d9('0x2b')](_0x261803['stack']);if(_0x261803[_0x53d9('0x2c')]){delete _0x261803['name'];}_0x5b6925[_0x53d9('0x1c')](_0x1411f8)[_0x53d9('0x2d')](_0x261803);};}exports[_0x53d9('0x2e')]=function(_0x2a85f1,_0x2efa7c){var _0x2dea72={},_0x4eb24d={},_0x1a8129={'count':0x0,'rows':[]};var _0x3ca15e=_[_0x53d9('0x2f')](db['Variable']['rawAttributes'],function(_0x3646e7){return{'name':_0x3646e7['fieldName'],'type':_0x3646e7[_0x53d9('0x30')][_0x53d9('0x31')]};});_0x4eb24d[_0x53d9('0x32')]=_[_0x53d9('0x2f')](_0x3ca15e,_0x53d9('0x2c'));_0x4eb24d['query']=_[_0x53d9('0x33')](_0x2a85f1[_0x53d9('0x34')]);_0x4eb24d['filters']=_['intersection'](_0x4eb24d[_0x53d9('0x32')],_0x4eb24d[_0x53d9('0x34')]);_0x2dea72[_0x53d9('0x35')]=_[_0x53d9('0x36')](_0x4eb24d['model'],qs[_0x53d9('0x37')](_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x37')]));_0x2dea72[_0x53d9('0x35')]=_0x2dea72['attributes'][_0x53d9('0x38')]?_0x2dea72['attributes']:_0x4eb24d[_0x53d9('0x32')];if(!_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x39')](_0x53d9('0x3a'))){_0x2dea72[_0x53d9('0x22')]=qs['limit'](_0x2a85f1['query'][_0x53d9('0x22')]);_0x2dea72[_0x53d9('0x1f')]=qs['offset'](_0x2a85f1['query']['offset']);}_0x2dea72[_0x53d9('0x3b')]=qs[_0x53d9('0x3c')](_0x2a85f1['query'][_0x53d9('0x3c')]);_0x2dea72[_0x53d9('0x3d')]=qs[_0x53d9('0x3e')](_[_0x53d9('0x3f')](_0x2a85f1['query'],_0x4eb24d[_0x53d9('0x3e')]),_0x3ca15e);if(_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x40')]){_0x2dea72[_0x53d9('0x3d')]=_[_0x53d9('0x41')](_0x2dea72[_0x53d9('0x3d')],{'$or':_[_0x53d9('0x2f')](_0x3ca15e,function(_0x58853f){if(_0x58853f[_0x53d9('0x30')]!==_0x53d9('0x42')){var _0x5b6729={};_0x5b6729[_0x58853f[_0x53d9('0x2c')]]={'$like':'%'+_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x40')]+'%'};return _0x5b6729;}})});}_0x2dea72=_[_0x53d9('0x41')]({},_0x2dea72,_0x2a85f1[_0x53d9('0x43')]);var _0x11519c={'where':_0x2dea72[_0x53d9('0x3d')]};return db[_0x53d9('0x44')][_0x53d9('0x21')](_0x11519c)[_0x53d9('0x2a')](function(_0x1552b5){_0x1a8129[_0x53d9('0x21')]=_0x1552b5;if(_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x45')]){_0x2dea72['include']=[{'all':!![]}];}return db[_0x53d9('0x44')]['findAll'](_0x2dea72);})[_0x53d9('0x2a')](function(_0x640142){_0x1a8129['rows']=_0x640142;return _0x1a8129;})[_0x53d9('0x2a')](respondWithFilteredResult(_0x2efa7c,_0x2dea72))[_0x53d9('0x46')](handleError(_0x2efa7c,null));};exports['show']=function(_0x14e475,_0x2e8fcc){var _0x5d6b02={'raw':!![],'where':{'id':_0x14e475[_0x53d9('0x47')]['id']}},_0x3b0a50={};_0x3b0a50[_0x53d9('0x32')]=_[_0x53d9('0x33')](db['Variable'][_0x53d9('0x48')]);_0x3b0a50[_0x53d9('0x34')]=_[_0x53d9('0x33')](_0x14e475[_0x53d9('0x34')]);_0x3b0a50[_0x53d9('0x3e')]=_[_0x53d9('0x36')](_0x3b0a50[_0x53d9('0x32')],_0x3b0a50[_0x53d9('0x34')]);_0x5d6b02[_0x53d9('0x35')]=_['intersection'](_0x3b0a50[_0x53d9('0x32')],qs[_0x53d9('0x37')](_0x14e475[_0x53d9('0x34')][_0x53d9('0x37')]));_0x5d6b02[_0x53d9('0x35')]=_0x5d6b02[_0x53d9('0x35')][_0x53d9('0x38')]?_0x5d6b02[_0x53d9('0x35')]:_0x3b0a50[_0x53d9('0x32')];if(_0x14e475[_0x53d9('0x34')][_0x53d9('0x45')]){_0x5d6b02[_0x53d9('0x49')]=[{'all':!![]}];}_0x5d6b02=_['merge']({},_0x5d6b02,_0x14e475[_0x53d9('0x43')]);return db[_0x53d9('0x44')][_0x53d9('0x4a')](_0x5d6b02)['then'](handleEntityNotFound(_0x2e8fcc,null))['then'](respondWithResult(_0x2e8fcc,null))[_0x53d9('0x46')](handleError(_0x2e8fcc,null));};exports[_0x53d9('0x4b')]=function(_0x418598,_0x3bbd2c){return db[_0x53d9('0x44')]['create'](_0x418598[_0x53d9('0x4c')],{})[_0x53d9('0x2a')](function(_0x534151){var _0x306f6b=_0x418598[_0x53d9('0x4d')]['get']({'plain':!![]});if(!_0x306f6b)throw new Error(_0x53d9('0x4e'));if(_0x306f6b[_0x53d9('0x4f')]==='user'){var _0x1e3298=_0x534151[_0x53d9('0x28')]({'plain':!![]});var _0x13730f=_0x53d9('0x50');return db[_0x53d9('0x51')][_0x53d9('0x4a')]({'where':{'name':_0x13730f,'userProfileId':_0x306f6b['userProfileId']},'raw':!![]})[_0x53d9('0x2a')](function(_0x48e69f){if(_0x48e69f&&_0x48e69f[_0x53d9('0x52')]===0x0){return db[_0x53d9('0x29')][_0x53d9('0x4b')]({'name':_0x1e3298[_0x53d9('0x2c')],'resourceId':_0x1e3298['id'],'type':_0x48e69f[_0x53d9('0x2c')],'sectionId':_0x48e69f['id']},{})['then'](function(){return _0x534151;});}else{return _0x534151;}})[_0x53d9('0x46')](function(_0x12b4ad){logger['error'](_0x53d9('0x53'),_0x12b4ad);throw _0x12b4ad;});}return _0x534151;})[_0x53d9('0x2a')](respondWithResult(_0x3bbd2c,0xc9))[_0x53d9('0x46')](handleError(_0x3bbd2c,null));};exports['update']=function(_0x2a829c,_0x508d52){if(_0x2a829c[_0x53d9('0x4c')]['id']){delete _0x2a829c[_0x53d9('0x4c')]['id'];}return db[_0x53d9('0x44')][_0x53d9('0x4a')]({'where':{'id':_0x2a829c[_0x53d9('0x47')]['id']}})[_0x53d9('0x2a')](handleEntityNotFound(_0x508d52,null))[_0x53d9('0x2a')](saveUpdates(_0x2a829c[_0x53d9('0x4c')],null))[_0x53d9('0x2a')](respondWithResult(_0x508d52,null))[_0x53d9('0x46')](handleError(_0x508d52,null));};exports['destroy']=function(_0x1c08b2,_0x180ee5){return db[_0x53d9('0x44')]['find']({'where':{'id':_0x1c08b2[_0x53d9('0x47')]['id']}})[_0x53d9('0x2a')](handleEntityNotFound(_0x180ee5,null))[_0x53d9('0x2a')](removeEntity(_0x180ee5,null))[_0x53d9('0x46')](handleError(_0x180ee5,null));}; \ No newline at end of file +var _0xef29=['rows','params','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','apply','reject','save','update','then','Variables','UserProfileResource','destroy','end','error','stack','name','send','Variable','rawAttributes','fieldName','keys','filters','model','query','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','merge','where','type','includeAll','include','findAll'];(function(_0x228547,_0x5e52a2){var _0x32eeab=function(_0x33b3aa){while(--_0x33b3aa){_0x228547['push'](_0x228547['shift']());}};_0x32eeab(++_0x5e52a2);}(_0xef29,0x199));var _0x9ef2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xef29[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x9ef2('0x0'));var rimraf=require(_0x9ef2('0x1'));var zipdir=require(_0x9ef2('0x2'));var jsonpatch=require(_0x9ef2('0x3'));var rp=require('request-promise');var moment=require(_0x9ef2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9ef2('0x5'));var path=require('path');var sox=require(_0x9ef2('0x6'));var csv=require(_0x9ef2('0x7'));var ejs=require(_0x9ef2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ef2('0x9'));var squel=require(_0x9ef2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ef2('0xb'));var toCsv=require(_0x9ef2('0x7'));var querystring=require(_0x9ef2('0xc'));var Papa=require(_0x9ef2('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9ef2('0xe'));var as=require(_0x9ef2('0xf'));var hardwareService=require(_0x9ef2('0x10'));var logger=require(_0x9ef2('0x11'))(_0x9ef2('0x12'));var utils=require('../../config/utils');var config=require(_0x9ef2('0x13'));var licenseUtil=require(_0x9ef2('0x14'));var db=require(_0x9ef2('0x15'))['db'];function respondWithStatusCode(_0x2e2b0d,_0x3c157e){_0x3c157e=_0x3c157e||0xcc;return function(_0x174c1b){if(_0x174c1b){return _0x2e2b0d[_0x9ef2('0x16')](_0x3c157e);}return _0x2e2b0d['status'](_0x3c157e)['end']();};}function respondWithResult(_0x576acf,_0x6ca838){_0x6ca838=_0x6ca838||0xc8;return function(_0x14cf5c){if(_0x14cf5c){return _0x576acf['status'](_0x6ca838)[_0x9ef2('0x17')](_0x14cf5c);}};}function respondWithFilteredResult(_0x5e42e8,_0x4182bc){return function(_0x1d3b62){if(_0x1d3b62){var _0x1479f2=typeof _0x4182bc['offset']===_0x9ef2('0x18')&&typeof _0x4182bc[_0x9ef2('0x19')]===_0x9ef2('0x18');var _0x29e839=_0x1d3b62[_0x9ef2('0x1a')];var _0x4a9387=_0x1479f2?0x0:_0x4182bc[_0x9ef2('0x1b')];var _0x347e04=_0x1479f2?_0x1d3b62[_0x9ef2('0x1a')]:_0x4182bc[_0x9ef2('0x1b')]+_0x4182bc['limit'];var _0x5e3114;if(_0x347e04>=_0x29e839){_0x347e04=_0x29e839;_0x5e3114=0xc8;}else{_0x5e3114=0xce;}_0x5e42e8[_0x9ef2('0x1c')](_0x5e3114);return _0x5e42e8[_0x9ef2('0x1d')]('Content-Range',_0x4a9387+'-'+_0x347e04+'/'+_0x29e839)[_0x9ef2('0x17')](_0x1d3b62);}return null;};}function patchUpdates(_0x5c8f84){return function(_0x80c20b){try{jsonpatch[_0x9ef2('0x1e')](_0x80c20b,_0x5c8f84,!![]);}catch(_0xb58d88){return BPromise[_0x9ef2('0x1f')](_0xb58d88);}return _0x80c20b[_0x9ef2('0x20')]();};}function saveUpdates(_0x459d44,_0x2c6fff){return function(_0x5a6d2a){if(_0x5a6d2a){return _0x5a6d2a[_0x9ef2('0x21')](_0x459d44)[_0x9ef2('0x22')](function(_0x14e9f0){return _0x14e9f0;});}return null;};}function removeEntity(_0x12487d,_0x2a987d){return function(_0x1d4657){if(_0x1d4657){return _0x1d4657['destroy']()[_0x9ef2('0x22')](function(){var _0x551400=_0x1d4657['get']({'plain':!![]});var _0x1bcb6f=_0x9ef2('0x23');return db[_0x9ef2('0x24')][_0x9ef2('0x25')]({'where':{'type':_0x1bcb6f,'resourceId':_0x551400['id']}})[_0x9ef2('0x22')](function(){return _0x1d4657;});})[_0x9ef2('0x22')](function(){_0x12487d[_0x9ef2('0x1c')](0xcc)[_0x9ef2('0x26')]();});}};}function handleEntityNotFound(_0x2d410c,_0x353f50){return function(_0x443291){if(!_0x443291){_0x2d410c[_0x9ef2('0x16')](0x194);}return _0x443291;};}function handleError(_0x558fc0,_0x219433){_0x219433=_0x219433||0x1f4;return function(_0x1179ea){logger[_0x9ef2('0x27')](_0x1179ea[_0x9ef2('0x28')]);if(_0x1179ea[_0x9ef2('0x29')]){delete _0x1179ea[_0x9ef2('0x29')];}_0x558fc0['status'](_0x219433)[_0x9ef2('0x2a')](_0x1179ea);};}exports['index']=function(_0x2d50dd,_0xa8b94c){var _0x17151a={},_0x1e4df7={},_0x51d5ed={'count':0x0,'rows':[]};var _0x326eb6=_['map'](db[_0x9ef2('0x2b')][_0x9ef2('0x2c')],function(_0x5b805a){return{'name':_0x5b805a[_0x9ef2('0x2d')],'type':_0x5b805a['type']['key']};});_0x1e4df7['model']=_['map'](_0x326eb6,_0x9ef2('0x29'));_0x1e4df7['query']=_[_0x9ef2('0x2e')](_0x2d50dd['query']);_0x1e4df7[_0x9ef2('0x2f')]=_['intersection'](_0x1e4df7[_0x9ef2('0x30')],_0x1e4df7[_0x9ef2('0x31')]);_0x17151a[_0x9ef2('0x32')]=_[_0x9ef2('0x33')](_0x1e4df7[_0x9ef2('0x30')],qs[_0x9ef2('0x34')](_0x2d50dd['query']['fields']));_0x17151a['attributes']=_0x17151a[_0x9ef2('0x32')][_0x9ef2('0x35')]?_0x17151a[_0x9ef2('0x32')]:_0x1e4df7['model'];if(!_0x2d50dd[_0x9ef2('0x31')]['hasOwnProperty'](_0x9ef2('0x36'))){_0x17151a[_0x9ef2('0x19')]=qs[_0x9ef2('0x19')](_0x2d50dd['query'][_0x9ef2('0x19')]);_0x17151a[_0x9ef2('0x1b')]=qs[_0x9ef2('0x1b')](_0x2d50dd[_0x9ef2('0x31')][_0x9ef2('0x1b')]);}_0x17151a[_0x9ef2('0x37')]=qs[_0x9ef2('0x38')](_0x2d50dd[_0x9ef2('0x31')][_0x9ef2('0x38')]);_0x17151a['where']=qs['filters'](_[_0x9ef2('0x39')](_0x2d50dd['query'],_0x1e4df7['filters']),_0x326eb6);if(_0x2d50dd[_0x9ef2('0x31')][_0x9ef2('0x3a')]){_0x17151a['where']=_[_0x9ef2('0x3b')](_0x17151a[_0x9ef2('0x3c')],{'$or':_['map'](_0x326eb6,function(_0xf940cc){if(_0xf940cc[_0x9ef2('0x3d')]!=='VIRTUAL'){var _0x56a66b={};_0x56a66b[_0xf940cc[_0x9ef2('0x29')]]={'$like':'%'+_0x2d50dd[_0x9ef2('0x31')][_0x9ef2('0x3a')]+'%'};return _0x56a66b;}})});}_0x17151a=_[_0x9ef2('0x3b')]({},_0x17151a,_0x2d50dd['options']);var _0x3853a0={'where':_0x17151a['where']};return db['Variable'][_0x9ef2('0x1a')](_0x3853a0)[_0x9ef2('0x22')](function(_0x548e60){_0x51d5ed['count']=_0x548e60;if(_0x2d50dd[_0x9ef2('0x31')][_0x9ef2('0x3e')]){_0x17151a[_0x9ef2('0x3f')]=[{'all':!![]}];}return db[_0x9ef2('0x2b')][_0x9ef2('0x40')](_0x17151a);})[_0x9ef2('0x22')](function(_0x82abe7){_0x51d5ed[_0x9ef2('0x41')]=_0x82abe7;return _0x51d5ed;})[_0x9ef2('0x22')](respondWithFilteredResult(_0xa8b94c,_0x17151a))['catch'](handleError(_0xa8b94c,null));};exports['show']=function(_0x5174e3,_0x346ab6){var _0x2810bd={'raw':!![],'where':{'id':_0x5174e3[_0x9ef2('0x42')]['id']}},_0x1d81d5={};_0x1d81d5[_0x9ef2('0x30')]=_['keys'](db[_0x9ef2('0x2b')][_0x9ef2('0x2c')]);_0x1d81d5[_0x9ef2('0x31')]=_['keys'](_0x5174e3[_0x9ef2('0x31')]);_0x1d81d5[_0x9ef2('0x2f')]=_[_0x9ef2('0x33')](_0x1d81d5[_0x9ef2('0x30')],_0x1d81d5[_0x9ef2('0x31')]);_0x2810bd[_0x9ef2('0x32')]=_['intersection'](_0x1d81d5[_0x9ef2('0x30')],qs[_0x9ef2('0x34')](_0x5174e3[_0x9ef2('0x31')][_0x9ef2('0x34')]));_0x2810bd[_0x9ef2('0x32')]=_0x2810bd['attributes'][_0x9ef2('0x35')]?_0x2810bd[_0x9ef2('0x32')]:_0x1d81d5[_0x9ef2('0x30')];if(_0x5174e3[_0x9ef2('0x31')][_0x9ef2('0x3e')]){_0x2810bd['include']=[{'all':!![]}];}_0x2810bd=_[_0x9ef2('0x3b')]({},_0x2810bd,_0x5174e3[_0x9ef2('0x43')]);return db[_0x9ef2('0x2b')][_0x9ef2('0x44')](_0x2810bd)[_0x9ef2('0x22')](handleEntityNotFound(_0x346ab6,null))['then'](respondWithResult(_0x346ab6,null))[_0x9ef2('0x45')](handleError(_0x346ab6,null));};exports[_0x9ef2('0x46')]=function(_0x22567e,_0x5c0c07){return db[_0x9ef2('0x2b')][_0x9ef2('0x46')](_0x22567e[_0x9ef2('0x47')],{})[_0x9ef2('0x22')](function(_0x52e7ca){var _0x4118bb=_0x22567e[_0x9ef2('0x48')][_0x9ef2('0x49')]({'plain':!![]});if(!_0x4118bb)throw new Error(_0x9ef2('0x4a'));if(_0x4118bb[_0x9ef2('0x4b')]===_0x9ef2('0x48')){var _0x518ec1=_0x52e7ca[_0x9ef2('0x49')]({'plain':!![]});var _0xe65583=_0x9ef2('0x23');return db[_0x9ef2('0x4c')][_0x9ef2('0x44')]({'where':{'name':_0xe65583,'userProfileId':_0x4118bb[_0x9ef2('0x4d')]},'raw':!![]})[_0x9ef2('0x22')](function(_0x124d52){if(_0x124d52&&_0x124d52[_0x9ef2('0x4e')]===0x0){return db[_0x9ef2('0x24')][_0x9ef2('0x46')]({'name':_0x518ec1[_0x9ef2('0x29')],'resourceId':_0x518ec1['id'],'type':_0x124d52[_0x9ef2('0x29')],'sectionId':_0x124d52['id']},{})[_0x9ef2('0x22')](function(){return _0x52e7ca;});}else{return _0x52e7ca;}})['catch'](function(_0xab37f4){logger[_0x9ef2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xab37f4);throw _0xab37f4;});}return _0x52e7ca;})['then'](respondWithResult(_0x5c0c07,0xc9))[_0x9ef2('0x45')](handleError(_0x5c0c07,null));};exports[_0x9ef2('0x21')]=function(_0xb44984,_0x436e65){if(_0xb44984[_0x9ef2('0x47')]['id']){delete _0xb44984[_0x9ef2('0x47')]['id'];}return db[_0x9ef2('0x2b')][_0x9ef2('0x44')]({'where':{'id':_0xb44984[_0x9ef2('0x42')]['id']}})['then'](handleEntityNotFound(_0x436e65,null))[_0x9ef2('0x22')](saveUpdates(_0xb44984['body'],null))['then'](respondWithResult(_0x436e65,null))[_0x9ef2('0x45')](handleError(_0x436e65,null));};exports[_0x9ef2('0x25')]=function(_0x2a7a59,_0x166f42){return db[_0x9ef2('0x2b')][_0x9ef2('0x44')]({'where':{'id':_0x2a7a59[_0x9ef2('0x42')]['id']}})['then'](handleEntityNotFound(_0x166f42,null))['then'](removeEntity(_0x166f42,null))['catch'](handleError(_0x166f42,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 475d6cc..9a163a7 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 _0xad30=['lodash','util','../../config/logger','api','request-promise','path','rimraf','exports','define'];(function(_0x21c926,_0x563c30){var _0x2a46ed=function(_0x24aff8){while(--_0x24aff8){_0x21c926['push'](_0x21c926['shift']());}};_0x2a46ed(++_0x563c30);}(_0xad30,0xea));var _0x0ad3=function(_0x84fcd,_0x4b673b){_0x84fcd=_0x84fcd-0x0;var _0x398985=_0xad30[_0x84fcd];return _0x398985;};'use strict';var _=require(_0x0ad3('0x0'));var util=require(_0x0ad3('0x1'));var logger=require(_0x0ad3('0x2'))(_0x0ad3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ad3('0x4'));var fs=require('fs');var path=require(_0x0ad3('0x5'));var rimraf=require(_0x0ad3('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x0ad3('0x7')]=function(_0x22d02c,_0x1fa927){return _0x22d02c[_0x0ad3('0x8')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1949=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0x1949,0x16c));var _0x9194=function(_0x3e116c,_0x1cb87a){_0x3e116c=_0x3e116c-0x0;var _0x276a52=_0x1949[_0x3e116c];return _0x276a52;};'use strict';var _=require(_0x9194('0x0'));var util=require(_0x9194('0x1'));var logger=require(_0x9194('0x2'))(_0x9194('0x3'));var moment=require(_0x9194('0x4'));var BPromise=require(_0x9194('0x5'));var rp=require(_0x9194('0x6'));var fs=require('fs');var path=require(_0x9194('0x7'));var rimraf=require(_0x9194('0x8'));var config=require(_0x9194('0x9'));var attributes=require('./variable.attributes');module[_0x9194('0xa')]=function(_0x30fd62,_0x24f9ac){return _0x30fd62[_0x9194('0xb')](_0x9194('0xc'),attributes,{'tableName':_0x9194('0xd'),'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 c4761be..2a72732 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 _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa41a,0x6b));var _0xaa41=function(_0x505a3d,_0x118cc1){_0x505a3d=_0x505a3d-0x0;var _0x35b135=_0xa41a[_0x505a3d];return _0x35b135;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x1c4e83,_0x4b64a8){var _0x5a1899=function(_0x38dbd1){while(--_0x38dbd1){_0x1c4e83['push'](_0x1c4e83['shift']());}};_0x5a1899(++_0x4b64a8);}(_0xabce,0x103));var _0xeabc=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xabce[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e6f1686..ecfc522 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 _0x0b4f=['fetch','reset','pull','/restart','restart','migrations','exports','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate'];(function(_0xbf8d9e,_0x7b75df){var _0x37b563=function(_0x29b774){while(--_0x29b774){_0xbf8d9e['push'](_0xbf8d9e['shift']());}};_0x37b563(++_0x7b75df);}(_0x0b4f,0xd9));var _0xf0b4=function(_0x4aedbb,_0x4952e6){_0x4aedbb=_0x4aedbb-0x0;var _0x33c1d8=_0x0b4f[_0x4aedbb];return _0x33c1d8;};'use strict';var express=require(_0xf0b4('0x0'));var router=express['Router']();var auth=require(_0xf0b4('0x1'));var controller=require(_0xf0b4('0x2'));router[_0xf0b4('0x3')]('/',controller[_0xf0b4('0x4')]);router['get'](_0xf0b4('0x5'),auth[_0xf0b4('0x6')](),auth[_0xf0b4('0x7')](),controller[_0xf0b4('0x8')]);router[_0xf0b4('0x3')]('/reset',auth[_0xf0b4('0x6')](),auth[_0xf0b4('0x7')](),controller[_0xf0b4('0x9')]);router['get']('/pull',auth[_0xf0b4('0x6')](),auth[_0xf0b4('0x7')](),controller[_0xf0b4('0xa')]);router['get'](_0xf0b4('0xb'),auth[_0xf0b4('0x6')](),controller[_0xf0b4('0xc')]);router['get']('/migrations',controller[_0xf0b4('0xd')]);module[_0xf0b4('0xe')]=router; \ No newline at end of file +var _0xd82e=['index','/fetch','fetch','/reset','isAuthenticated','canUpdate','/restart','restart','express','../../components/auth/service','./version.controller','get'];(function(_0x531d41,_0x10c594){var _0x5b062e=function(_0x471971){while(--_0x471971){_0x531d41['push'](_0x531d41['shift']());}};_0x5b062e(++_0x10c594);}(_0xd82e,0x11c));var _0xed82=function(_0x5967da,_0x533fd1){_0x5967da=_0x5967da-0x0;var _0x3edc84=_0xd82e[_0x5967da];return _0x3edc84;};'use strict';var express=require(_0xed82('0x0'));var router=express['Router']();var auth=require(_0xed82('0x1'));var controller=require(_0xed82('0x2'));router[_0xed82('0x3')]('/',controller[_0xed82('0x4')]);router[_0xed82('0x3')](_0xed82('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xed82('0x6')]);router[_0xed82('0x3')](_0xed82('0x7'),auth[_0xed82('0x8')](),auth[_0xed82('0x9')](),controller['reset']);router[_0xed82('0x3')]('/pull',auth[_0xed82('0x8')](),auth['canUpdate'](),controller['pull']);router['get'](_0xed82('0xa'),auth[_0xed82('0x8')](),controller[_0xed82('0xb')]);router['get']('/migrations',controller['migrations']);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index eb7bd7a..1837bd6 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 _0xce88=['getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','origin','master','error','git\x20fetch','json','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','push','Migration','sequelize'];(function(_0x54fdf9,_0x2dd76c){var _0x408938=function(_0x2990d3){while(--_0x2990d3){_0x54fdf9['push'](_0x54fdf9['shift']());}};_0x408938(++_0x2dd76c);}(_0xce88,0x181));var _0x8ce8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xce88[_0x13e741];return _0x3f8bb3;};'use strict';var Umzug=require(_0x8ce8('0x0'));var path=require(_0x8ce8('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x8ce8('0x2'))(module,_0x8ce8('0x3'));var compareVersions=require(_0x8ce8('0x4'));var exec=require(_0x8ce8('0x5'))[_0x8ce8('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x8ce8('0x7'));var pm2=require(_0x8ce8('0x8'));var logger=require('../../config/logger')(_0x8ce8('0x9'));var git=require(_0x8ce8('0xa'))(config[_0x8ce8('0xb')]);exports[_0x8ce8('0xc')]=function(_0x474ffe,_0x38d83d){var _0x196a85={'current':module[_0x8ce8('0xd')][_0x8ce8('0x3')],'phonebar':0x2};if(_0x474ffe[_0x8ce8('0xe')]&&_0x474ffe[_0x8ce8('0xe')]['latest']){return git[_0x8ce8('0xf')]()[_0x8ce8('0x10')](function(_0x111ced,_0x54366b){_0x196a85[_0x8ce8('0x11')]=(_0x111ced?module['exports'][_0x8ce8('0x3')]:_0x54366b[_0x8ce8('0x11')])||_0x8ce8('0x12');return _0x38d83d[_0x8ce8('0x13')](0xc8)['json'](_0x196a85);});}else{return _0x38d83d['status'](0xc8)['json'](_0x196a85);}};exports['fetch']=function(_0x9f9735,_0x446478){return git[_0x8ce8('0xf')]([_0x8ce8('0x14'),_0x8ce8('0x15')],function(_0x5834ee){if(_0x5834ee){logger[_0x8ce8('0x16')](_0x5834ee);return _0x446478[_0x8ce8('0x13')](0x1f4)['json'](_0x5834ee);}logger['info'](_0x8ce8('0x17'));return _0x446478[_0x8ce8('0x13')](0xc8)[_0x8ce8('0x18')]({'output':_0x8ce8('0x19')});});};exports[_0x8ce8('0x1a')]=function(_0x2cfd4e,_0x497495){return git[_0x8ce8('0x1a')](['--hard',_0x8ce8('0x1b')],function(_0x2f1c26){if(_0x2f1c26){logger['error'](_0x2f1c26);return _0x497495[_0x8ce8('0x13')](0x1f4)[_0x8ce8('0x18')](_0x2f1c26);}logger[_0x8ce8('0x1c')](_0x8ce8('0x1d'));return _0x497495['status'](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x8ce8('0x1e')]=function(_0x2af22a,_0x2b3b39){exec('npm\x20install\x20--production',function(_0x147d3d,_0x186cf4,_0x1eaf41){logger['info'](_0x186cf4);logger['info'](_0x1eaf41);if(_0x147d3d){logger[_0x8ce8('0x16')](_0x147d3d);return _0x2b3b39[_0x8ce8('0x13')](0x1f4)['json'](_0x147d3d);}return _0x2b3b39[_0x8ce8('0x13')](0xc8)[_0x8ce8('0x18')]({'output':_0x186cf4});});};exports[_0x8ce8('0x1f')]=function(_0x522824,_0x5a3aae){return pm2[_0x8ce8('0x1f')](_0x8ce8('0x20'))[_0x8ce8('0x21')](function(_0x5e9076){logger['info'](_0x8ce8('0x22'),_0x5e9076);return _0x5a3aae[_0x8ce8('0x13')](0xc8)['json']({'output':_0x8ce8('0x23')});})[_0x8ce8('0x24')](function(_0x1e4960){logger[_0x8ce8('0x16')](_0x1e4960);return _0x5a3aae[_0x8ce8('0x13')](0x1f4)['json'](_0x1e4960);});};exports['migrations']=function(_0x2e1005,_0x536035){var _0x5137d9=fs[_0x8ce8('0x25')](path[_0x8ce8('0x26')](config['root'],_0x8ce8('0x27'),_0x8ce8('0x28')));var _0x2c3bbd=[];for(var _0x1a6aa7=0x0;_0x1a6aa7<_0x5137d9[_0x8ce8('0x29')];_0x1a6aa7++){var _0x205028=_0x5137d9[_0x1a6aa7][_0x8ce8('0x2a')](_0x8ce8('0x2b'),'');if(compareVersions(module['exports'][_0x8ce8('0x3')],_0x205028)===-0x1){_0x2c3bbd[_0x8ce8('0x2c')](_0x205028);}}if(_0x2c3bbd[_0x8ce8('0x29')]){var _0x472177=_0x2c3bbd['sort'](compareVersions);var _0x170842=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x8ce8('0x2d'),'columnName':_0x8ce8('0x3')},'migrations':{'params':[db[_0x8ce8('0x2e')][_0x8ce8('0x2f')](),db[_0x8ce8('0x2e')][_0x8ce8('0x30')],function(){throw new Error(_0x8ce8('0x31'));}],'path':path[_0x8ce8('0x26')](config['root'],_0x8ce8('0x27'),_0x8ce8('0x28')),'pattern':/\.js$/}});_0x170842['up']({'migrations':_[_0x8ce8('0x32')](_0x472177,function(_0x4b166a){return _0x4b166a+_0x8ce8('0x2b');})})[_0x8ce8('0x21')](function(){return _0x536035[_0x8ce8('0x13')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x8ce8('0x3')]+_0x8ce8('0x33')+_['last'](_0x472177),'migrations':_[_0x8ce8('0x26')](_0x472177)});})['catch'](function(_0x1443ad){if(_0x1443ad instanceof db['sequelize'][_0x8ce8('0x34')]){return _0x536035[_0x8ce8('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x536035['status'](0x1f4)[_0x8ce8('0x18')](_0x1443ad);}});}else{return _0x536035[_0x8ce8('0x13')](0xc8)[_0x8ce8('0x18')]({'output':_0x8ce8('0x35')});}}; \ No newline at end of file +var _0x198d=['pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','catch','migrations','readdirSync','server','replace','.js','push','length','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','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path'];(function(_0x455556,_0x2e71de){var _0x52c6b8=function(_0x4ee1bc){while(--_0x4ee1bc){_0x455556['push'](_0x455556['shift']());}};_0x52c6b8(++_0x2e71de);}(_0x198d,0x1c6));var _0xd198=function(_0x279cdd,_0x5443a0){_0x279cdd=_0x279cdd-0x0;var _0x404164=_0x198d[_0x279cdd];return _0x404164;};'use strict';var Umzug=require(_0xd198('0x0'));var path=require(_0xd198('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xd198('0x2'))(module,_0xd198('0x3'));var compareVersions=require(_0xd198('0x4'));var exec=require(_0xd198('0x5'))[_0xd198('0x6')];var db=require(_0xd198('0x7'))['db'];var config=require(_0xd198('0x8'));var pm2=require(_0xd198('0x9'));var logger=require(_0xd198('0xa'))(_0xd198('0xb'));var git=require(_0xd198('0xc'))(config[_0xd198('0xd')]);exports[_0xd198('0xe')]=function(_0x2106ba,_0x975c81){var _0x182100={'current':module[_0xd198('0xf')]['version'],'phonebar':0x2};if(_0x2106ba['query']&&_0x2106ba[_0xd198('0x10')][_0xd198('0x11')]){return git[_0xd198('0x12')]()['tags'](function(_0x3d15c0,_0x36a67d){_0x182100['latest']=(_0x3d15c0?module[_0xd198('0xf')][_0xd198('0x3')]:_0x36a67d['latest'])||_0xd198('0x13');return _0x975c81[_0xd198('0x14')](0xc8)['json'](_0x182100);});}else{return _0x975c81[_0xd198('0x14')](0xc8)[_0xd198('0x15')](_0x182100);}};exports[_0xd198('0x12')]=function(_0x516f95,_0x5525d0){return git['fetch']([_0xd198('0x16'),_0xd198('0x17')],function(_0x39b849){if(_0x39b849){logger[_0xd198('0x18')](_0x39b849);return _0x5525d0['status'](0x1f4)[_0xd198('0x15')](_0x39b849);}logger[_0xd198('0x19')](_0xd198('0x1a'));return _0x5525d0[_0xd198('0x14')](0xc8)[_0xd198('0x15')]({'output':_0xd198('0x1b')});});};exports[_0xd198('0x1c')]=function(_0x39c4f0,_0x2b507c){return git['reset']([_0xd198('0x1d'),'FETCH_HEAD'],function(_0x33503a){if(_0x33503a){logger['error'](_0x33503a);return _0x2b507c['status'](0x1f4)[_0xd198('0x15')](_0x33503a);}logger[_0xd198('0x19')](_0xd198('0x1e'));return _0x2b507c[_0xd198('0x14')](0xc8)['json']({'output':_0xd198('0x1f')});});};exports[_0xd198('0x20')]=function(_0x48c778,_0x1cbf80){exec(_0xd198('0x21'),function(_0x53ea5b,_0x3c0b2a,_0x10ffbb){logger[_0xd198('0x19')](_0x3c0b2a);logger[_0xd198('0x19')](_0x10ffbb);if(_0x53ea5b){logger['error'](_0x53ea5b);return _0x1cbf80['status'](0x1f4)['json'](_0x53ea5b);}return _0x1cbf80[_0xd198('0x14')](0xc8)[_0xd198('0x15')]({'output':_0x3c0b2a});});};exports[_0xd198('0x22')]=function(_0x26e299,_0x5dbefd){return pm2['restart'](_0xd198('0x23'))[_0xd198('0x24')](function(_0x462041){logger[_0xd198('0x19')]('pm2\x20restart\x20motion\x20%s',_0x462041);return _0x5dbefd['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xd198('0x25')](function(_0x18e95c){logger[_0xd198('0x18')](_0x18e95c);return _0x5dbefd[_0xd198('0x14')](0x1f4)[_0xd198('0x15')](_0x18e95c);});};exports[_0xd198('0x26')]=function(_0x5a7385,_0x3039d1){var _0x1f30f9=fs[_0xd198('0x27')](path['join'](config[_0xd198('0xd')],_0xd198('0x28'),'migrations'));var _0x3bd6d3=[];for(var _0x2e131e=0x0;_0x2e131e<_0x1f30f9['length'];_0x2e131e++){var _0x39dec1=_0x1f30f9[_0x2e131e][_0xd198('0x29')](_0xd198('0x2a'),'');if(compareVersions(module[_0xd198('0xf')][_0xd198('0x3')],_0x39dec1)===-0x1){_0x3bd6d3[_0xd198('0x2b')](_0x39dec1);}}if(_0x3bd6d3[_0xd198('0x2c')]){var _0x230c91=_0x3bd6d3[_0xd198('0x2d')](compareVersions);var _0x9a1763=new Umzug({'storage':_0xd198('0x2e'),'storageOptions':{'model':db[_0xd198('0x2f')],'modelName':_0xd198('0x2f'),'columnName':_0xd198('0x3')},'migrations':{'params':[db['sequelize'][_0xd198('0x30')](),db[_0xd198('0x2e')][_0xd198('0x31')],function(){throw new Error(_0xd198('0x32'));}],'path':path[_0xd198('0x33')](config[_0xd198('0xd')],'server','migrations'),'pattern':/\.js$/}});_0x9a1763['up']({'migrations':_[_0xd198('0x34')](_0x230c91,function(_0x2a8016){return _0x2a8016+'.js';})})[_0xd198('0x24')](function(){return _0x3039d1[_0xd198('0x14')](0xc8)['json']({'output':_0xd198('0x35')+module['exports'][_0xd198('0x3')]+'\x20to\x20'+_[_0xd198('0x36')](_0x230c91),'migrations':_[_0xd198('0x33')](_0x230c91)});})['catch'](function(_0x5a242b){if(_0x5a242b instanceof db['sequelize'][_0xd198('0x37')]){return _0x3039d1[_0xd198('0x14')](0xc8)['json']({'output':_0xd198('0x38')});}else{return _0x3039d1[_0xd198('0x14')](0x1f4)[_0xd198('0x15')](_0x5a242b);}});}else{return _0x3039d1[_0xd198('0x14')](0xc8)[_0xd198('0x15')]({'output':_0xd198('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ca669f5..f73170b 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 _0x0330=['get','isAuthenticated','/describe','/:id','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0330,0x13a));var _0x0033=function(_0x45cf01,_0x321148){_0x45cf01=_0x45cf01-0x0;var _0x29242b=_0x0330[_0x45cf01];return _0x29242b;};'use strict';var multer=require(_0x0033('0x0'));var util=require(_0x0033('0x1'));var path=require(_0x0033('0x2'));var timeout=require(_0x0033('0x3'));var express=require(_0x0033('0x4'));var router=express[_0x0033('0x5')]();var fs_extra=require(_0x0033('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0033('0x7'));var config=require(_0x0033('0x8'));var controller=require('./voiceAgentReport.controller');router[_0x0033('0x9')]('/',auth[_0x0033('0xa')](),controller['index']);router['get'](_0x0033('0xb'),auth[_0x0033('0xa')](),controller['describe']);router[_0x0033('0x9')](_0x0033('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0033('0xd')]('/',auth[_0x0033('0xa')](),controller['create']);router[_0x0033('0xe')]('/:id',auth[_0x0033('0xa')](),controller[_0x0033('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0033('0x10')]);module['exports']=router; \ No newline at end of file +var _0x56bf=['update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x56bf,0x192));var _0xf56b=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x56bf[_0xb6e2ea];return _0x2a57bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf56b('0x0'));var timeout=require(_0xf56b('0x1'));var express=require('express');var router=express[_0xf56b('0x2')]();var fs_extra=require(_0xf56b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf56b('0x4'));var config=require(_0xf56b('0x5'));var controller=require(_0xf56b('0x6'));router[_0xf56b('0x7')]('/',auth[_0xf56b('0x8')](),controller[_0xf56b('0x9')]);router[_0xf56b('0x7')](_0xf56b('0xa'),auth[_0xf56b('0x8')](),controller[_0xf56b('0xb')]);router[_0xf56b('0x7')](_0xf56b('0xc'),auth[_0xf56b('0x8')](),controller[_0xf56b('0xd')]);router[_0xf56b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf56b('0xf')](_0xf56b('0xc'),auth[_0xf56b('0x8')](),controller[_0xf56b('0x10')]);router[_0xf56b('0x11')]('/:id',auth[_0xf56b('0x8')](),controller[_0xf56b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 37160f0..abcac43 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 _0x37e9=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x39fc7e,_0x2b99d7){var _0x4dc7c3=function(_0x4a115c){while(--_0x4a115c){_0x39fc7e['push'](_0x39fc7e['shift']());}};_0x4dc7c3(++_0x2b99d7);}(_0x37e9,0x1e7));var _0x937e=function(_0x150b7e,_0x45a9d6){_0x150b7e=_0x150b7e-0x0;var _0x4262db=_0x37e9[_0x150b7e];return _0x4262db;};'use strict';var Sequelize=require(_0x937e('0x0'));module[_0x937e('0x1')]={'type':{'type':Sequelize[_0x937e('0x2')]},'uniqueid':{'type':Sequelize[_0x937e('0x2')]},'calleridnum':{'type':Sequelize[_0x937e('0x2')]},'calleridname':{'type':Sequelize[_0x937e('0x2')]},'queue':{'type':Sequelize[_0x937e('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x937e('0x2')]},'agentcalledAt':{'type':Sequelize[_0x937e('0x3')]},'agentconnectAt':{'type':Sequelize[_0x937e('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x937e('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x937e('0x3')]},'agentdumpAt':{'type':Sequelize[_0x937e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x937e('0x5')]},'agentacw':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x937e('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x937e('0x2')]},'channelstate':{'type':Sequelize[_0x937e('0x5')]},'channelstatedesc':{'type':Sequelize[_0x937e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x937e('0x2')]},'connectedlinename':{'type':Sequelize[_0x937e('0x2')]},'language':{'type':Sequelize[_0x937e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x937e('0x2')]},'destchannel':{'type':Sequelize[_0x937e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x937e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x937e('0x2')]},'destcalleridname':{'type':Sequelize[_0x937e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x937e('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x937e('0x2')]},'destaccountcode':{'type':Sequelize[_0x937e('0x2')]},'destcontext':{'type':Sequelize[_0x937e('0x2')]},'destexten':{'type':Sequelize[_0x937e('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x937e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x937e('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x937e('0x2')]},'transfer':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x937e('0x2')],'comment':_0x937e('0x6')},'transferexten':{'type':Sequelize[_0x937e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x937e('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2964=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x189434,_0x11c969){var _0x4e3730=function(_0x149af5){while(--_0x149af5){_0x189434['push'](_0x189434['shift']());}};_0x4e3730(++_0x11c969);}(_0x2964,0x108));var _0x4296=function(_0x31f84d,_0x1f6a3a){_0x31f84d=_0x31f84d-0x0;var _0x1a06c3=_0x2964[_0x31f84d];return _0x1a06c3;};'use strict';var Sequelize=require(_0x4296('0x0'));module[_0x4296('0x1')]={'type':{'type':Sequelize[_0x4296('0x2')]},'uniqueid':{'type':Sequelize[_0x4296('0x2')]},'calleridnum':{'type':Sequelize[_0x4296('0x2')]},'calleridname':{'type':Sequelize[_0x4296('0x2')]},'queue':{'type':Sequelize[_0x4296('0x2')]},'interface':{'type':Sequelize[_0x4296('0x2')]},'membername':{'type':Sequelize[_0x4296('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4296('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4296('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4296('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4296('0x3')]},'holdtime':{'type':Sequelize[_0x4296('0x4')]},'agentcomplete':{'type':Sequelize[_0x4296('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4296('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4296('0x4')]},'agentacw':{'type':Sequelize[_0x4296('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4296('0x4')]},'reason':{'type':Sequelize[_0x4296('0x2')]},'lastevent':{'type':Sequelize[_0x4296('0x2')]},'channel':{'type':Sequelize[_0x4296('0x2')]},'channelstate':{'type':Sequelize[_0x4296('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4296('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4296('0x2')]},'connectedlinename':{'type':Sequelize[_0x4296('0x2')]},'language':{'type':Sequelize[_0x4296('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4296('0x2')]},'exten':{'type':Sequelize[_0x4296('0x2')]},'priority':{'type':Sequelize[_0x4296('0x2')]},'destchannel':{'type':Sequelize[_0x4296('0x2')]},'destchannelstate':{'type':Sequelize[_0x4296('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4296('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4296('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4296('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4296('0x2')]},'destlanguage':{'type':Sequelize[_0x4296('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4296('0x2')]},'destexten':{'type':Sequelize[_0x4296('0x2')]},'destpriority':{'type':Sequelize[_0x4296('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4296('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4296('0x2')]},'transfer':{'type':Sequelize[_0x4296('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x4296('0x6')},'transferexten':{'type':Sequelize[_0x4296('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4296('0x2')]},'agententerreason':{'type':Sequelize[_0x4296('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 3dfc996..24b464c 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 33c7e3a..6775aa2 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 _0xc03e=['bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','api'];(function(_0x46aaff,_0x45d5da){var _0x3a9587=function(_0x4e1e48){while(--_0x4e1e48){_0x46aaff['push'](_0x46aaff['shift']());}};_0x3a9587(++_0x45d5da);}(_0xc03e,0x15a));var _0xec03=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xc03e[_0x48ec91];return _0x22766c;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xec03('0xa'),_0xec03('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca8d=['report_agent','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x36e626,_0x1d8fe7){var _0x40a885=function(_0x1fb8de){while(--_0x1fb8de){_0x36e626['push'](_0x36e626['shift']());}};_0x40a885(++_0x1d8fe7);}(_0xca8d,0x172));var _0xdca8=function(_0x31bfee,_0x5e7b65){_0x31bfee=_0x31bfee-0x0;var _0x4fe58e=_0xca8d[_0x31bfee];return _0x4fe58e;};'use strict';var _=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var logger=require(_0xdca8('0x2'))(_0xdca8('0x3'));var moment=require(_0xdca8('0x4'));var BPromise=require(_0xdca8('0x5'));var rp=require(_0xdca8('0x6'));var fs=require('fs');var path=require(_0xdca8('0x7'));var rimraf=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var attributes=require(_0xdca8('0xa'));module[_0xdca8('0xb')]=function(_0x4d6383,_0x3366d5){return _0x4d6383[_0xdca8('0xc')](_0xdca8('0xd'),attributes,{'tableName':_0xdca8('0xe'),'paranoid':![],'indexes':[{'fields':[_0xdca8('0xf'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index a7596d4..f987e78 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 _0x8d3a=['error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','catch','update','body','attributes','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x56fbf6,_0x14fa32){var _0x33722b=function(_0x3b34c3){while(--_0x3b34c3){_0x56fbf6['push'](_0x56fbf6['shift']());}};_0x33722b(++_0x14fa32);}(_0x8d3a,0x1df));var _0xa8d3=function(_0x368c75,_0x386385){_0x368c75=_0x368c75-0x0;var _0x2d7a2b=_0x8d3a[_0x368c75];return _0x2d7a2b;};'use strict';var _=require(_0xa8d3('0x0'));var util=require(_0xa8d3('0x1'));var moment=require('moment');var BPromise=require(_0xa8d3('0x2'));var rs=require(_0xa8d3('0x3'));var fs=require('fs');var Redis=require(_0xa8d3('0x4'));var db=require(_0xa8d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8d3('0x6'))('rpc');var config=require(_0xa8d3('0x7'));var jayson=require(_0xa8d3('0x8'));var client=jayson[_0xa8d3('0x9')][_0xa8d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49904a,_0x4e2fa8,_0x54e948){return new BPromise(function(_0xbb0371,_0x2eeed7){return client['request'](_0x49904a,_0x54e948)[_0xa8d3('0xb')](function(_0x16d924){logger[_0xa8d3('0xc')](_0xa8d3('0xd'),_0x4e2fa8,_0xa8d3('0xe'));logger[_0xa8d3('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4e2fa8,_0xa8d3('0xe'),JSON[_0xa8d3('0x10')](_0x16d924));if(_0x16d924['error']){if(_0x16d924[_0xa8d3('0x11')][_0xa8d3('0x12')]===0x1f4){logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0x16d924['error'][_0xa8d3('0x13')]);return _0x2eeed7(_0x16d924[_0xa8d3('0x11')][_0xa8d3('0x13')]);}logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0x16d924[_0xa8d3('0x11')]['message']);return _0xbb0371(_0x16d924[_0xa8d3('0x11')]['message']);}else{logger['info'](_0xa8d3('0xd'),_0x4e2fa8,_0xa8d3('0xe'));_0xbb0371(_0x16d924[_0xa8d3('0x14')][_0xa8d3('0x13')]);}})['catch'](function(_0xa7b9a5){logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0xa7b9a5);_0x2eeed7(_0xa7b9a5);});});}exports[_0xa8d3('0x15')]=function(_0x20b500){var _0x1c4cae=this;return new Promise(function(_0x626b4c,_0xe951cf){return db[_0xa8d3('0x16')][_0xa8d3('0x17')](_0x20b500['body'],{'raw':_0x20b500[_0xa8d3('0x18')]?_0x20b500['options'][_0xa8d3('0x19')]===undefined?!![]:![]:!![]})[_0xa8d3('0xb')](function(_0x5c452c){logger[_0xa8d3('0xc')]('CreateVoiceAgentReport',_0x20b500);logger[_0xa8d3('0xf')](_0xa8d3('0x15'),_0x20b500,JSON[_0xa8d3('0x10')](_0x5c452c));_0x626b4c(_0x5c452c);})[_0xa8d3('0x1a')](function(_0x2a0bb5){logger[_0xa8d3('0x11')]('CreateVoiceAgentReport',_0x2a0bb5['message'],_0x20b500);_0xe951cf(_0x1c4cae[_0xa8d3('0x11')](0x1f4,_0x2a0bb5['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x353ff9){var _0x37a9a1=this;return new Promise(function(_0x2fc25c,_0x2c1b7f){return db[_0xa8d3('0x16')][_0xa8d3('0x1b')](_0x353ff9[_0xa8d3('0x1c')],{'raw':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')][_0xa8d3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9['options']['where']||null:null,'attributes':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')][_0xa8d3('0x1d')]||null:null,'limit':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')]['limit']||null:null})[_0xa8d3('0xb')](function(_0x2e09a1){logger[_0xa8d3('0xc')](_0xa8d3('0x1e'),_0x353ff9);logger[_0xa8d3('0xf')](_0xa8d3('0x1e'),_0x353ff9,JSON[_0xa8d3('0x10')](_0x2e09a1));_0x2fc25c(_0x2e09a1);})[_0xa8d3('0x1a')](function(_0x2725e1){logger['error'](_0xa8d3('0x1e'),_0x2725e1[_0xa8d3('0x13')],_0x353ff9);_0x2c1b7f(_0x37a9a1['error'](0x1f4,_0x2725e1[_0xa8d3('0x13')]));});});}; \ No newline at end of file +var _0x4c69=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c69,0xd2));var _0x94c6=function(_0x3b26f9,_0x1b8421){_0x3b26f9=_0x3b26f9-0x0;var _0x1e6efc=_0x4c69[_0x3b26f9];return _0x1e6efc;};'use strict';var _=require(_0x94c6('0x0'));var util=require(_0x94c6('0x1'));var moment=require(_0x94c6('0x2'));var BPromise=require(_0x94c6('0x3'));var rs=require(_0x94c6('0x4'));var fs=require('fs');var Redis=require(_0x94c6('0x5'));var db=require(_0x94c6('0x6'))['db'];var utils=require(_0x94c6('0x7'));var logger=require(_0x94c6('0x8'))(_0x94c6('0x9'));var config=require(_0x94c6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x94c6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x316273,_0x4618f3,_0x52ac87){return new BPromise(function(_0xe98376,_0x4d3ea4){return client[_0x94c6('0xc')](_0x316273,_0x52ac87)[_0x94c6('0xd')](function(_0x63364a){logger['info'](_0x94c6('0xe'),_0x4618f3,_0x94c6('0xf'));logger[_0x94c6('0x10')](_0x94c6('0x11'),_0x4618f3,_0x94c6('0xf'),JSON[_0x94c6('0x12')](_0x63364a));if(_0x63364a['error']){if(_0x63364a[_0x94c6('0x13')][_0x94c6('0x14')]===0x1f4){logger['error'](_0x94c6('0xe'),_0x4618f3,_0x63364a[_0x94c6('0x13')][_0x94c6('0x15')]);return _0x4d3ea4(_0x63364a[_0x94c6('0x13')][_0x94c6('0x15')]);}logger[_0x94c6('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4618f3,_0x63364a[_0x94c6('0x13')]['message']);return _0xe98376(_0x63364a[_0x94c6('0x13')][_0x94c6('0x15')]);}else{logger[_0x94c6('0x16')](_0x94c6('0xe'),_0x4618f3,_0x94c6('0xf'));_0xe98376(_0x63364a['result'][_0x94c6('0x15')]);}})[_0x94c6('0x17')](function(_0x32b4bf){logger[_0x94c6('0x13')](_0x94c6('0xe'),_0x4618f3,_0x32b4bf);_0x4d3ea4(_0x32b4bf);});});}exports[_0x94c6('0x18')]=function(_0x348c18){var _0x547c07=this;return new Promise(function(_0x549545,_0x72f3ab){return db['VoiceAgentReport'][_0x94c6('0x19')](_0x348c18[_0x94c6('0x1a')],{'raw':_0x348c18[_0x94c6('0x1b')]?_0x348c18[_0x94c6('0x1b')][_0x94c6('0x1c')]===undefined?!![]:![]:!![]})[_0x94c6('0xd')](function(_0x48e944){logger[_0x94c6('0x16')](_0x94c6('0x18'),_0x348c18);logger[_0x94c6('0x10')]('CreateVoiceAgentReport',_0x348c18,JSON[_0x94c6('0x12')](_0x48e944));_0x549545(_0x48e944);})[_0x94c6('0x17')](function(_0x5998d1){logger[_0x94c6('0x13')](_0x94c6('0x18'),_0x5998d1['message'],_0x348c18);_0x72f3ab(_0x547c07[_0x94c6('0x13')](0x1f4,_0x5998d1[_0x94c6('0x15')]));});});};exports[_0x94c6('0x1d')]=function(_0x39ba2a){var _0xec6409=this;return new Promise(function(_0x415ad8,_0x3d1dea){return db[_0x94c6('0x1e')][_0x94c6('0x1f')](_0x39ba2a[_0x94c6('0x1a')],{'raw':_0x39ba2a[_0x94c6('0x1b')]?_0x39ba2a[_0x94c6('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39ba2a[_0x94c6('0x1b')]?_0x39ba2a['options'][_0x94c6('0x20')]||null:null,'attributes':_0x39ba2a[_0x94c6('0x1b')]?_0x39ba2a[_0x94c6('0x1b')][_0x94c6('0x21')]||null:null,'limit':_0x39ba2a[_0x94c6('0x1b')]?_0x39ba2a[_0x94c6('0x1b')][_0x94c6('0x22')]||null:null})[_0x94c6('0xd')](function(_0x2c9046){logger[_0x94c6('0x16')](_0x94c6('0x1d'),_0x39ba2a);logger['debug'](_0x94c6('0x1d'),_0x39ba2a,JSON['stringify'](_0x2c9046));_0x415ad8(_0x2c9046);})[_0x94c6('0x17')](function(_0x1b4665){logger['error'](_0x94c6('0x1d'),_0x1b4665['message'],_0x39ba2a);_0x3d1dea(_0xec6409[_0x94c6('0x13')](0x1f4,_0x1b4665[_0x94c6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 48b3343..1e0b22d 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 _0xec6c=['post','create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x593c1b,_0x35c524){var _0x4e0c07=function(_0x8c0aab){while(--_0x8c0aab){_0x593c1b['push'](_0x593c1b['shift']());}};_0x4e0c07(++_0x35c524);}(_0xec6c,0x7b));var _0xcec6=function(_0x456c90,_0xf47acc){_0x456c90=_0x456c90-0x0;var _0x38b2fc=_0xec6c[_0x456c90];return _0x38b2fc;};'use strict';var express=require(_0xcec6('0x0'));var router=express[_0xcec6('0x1')]();var auth=require(_0xcec6('0x2'));var controller=require(_0xcec6('0x3'));router[_0xcec6('0x4')]('/',auth[_0xcec6('0x5')](),controller[_0xcec6('0x6')]);router['get'](_0xcec6('0x7'),auth[_0xcec6('0x5')](),controller['describe']);router[_0xcec6('0x4')](_0xcec6('0x8'),auth[_0xcec6('0x5')](),controller[_0xcec6('0x9')]);router[_0xcec6('0xa')]('/',auth[_0xcec6('0x5')](),controller[_0xcec6('0xb')]);router[_0xcec6('0xc')](_0xcec6('0x8'),auth[_0xcec6('0x5')](),controller[_0xcec6('0xd')]);router[_0xcec6('0xc')](_0xcec6('0xe'),auth[_0xcec6('0x5')](),controller[_0xcec6('0xf')]);router[_0xcec6('0x10')](_0xcec6('0x8'),auth[_0xcec6('0x5')](),controller[_0xcec6('0x11')]);module[_0xcec6('0x12')]=router; \ No newline at end of file +var _0xaa79=['express','Router','./voiceCallReport.controller','isAuthenticated','get','/describe','describe','show','post','/:id','update','/with-retry/:id','delete','exports'];(function(_0x258f4d,_0x24df3b){var _0x497b92=function(_0x455de7){while(--_0x455de7){_0x258f4d['push'](_0x258f4d['shift']());}};_0x497b92(++_0x24df3b);}(_0xaa79,0xfc));var _0x9aa7=function(_0x213229,_0x3166fe){_0x213229=_0x213229-0x0;var _0x4a51ee=_0xaa79[_0x213229];return _0x4a51ee;};'use strict';var express=require(_0x9aa7('0x0'));var router=express[_0x9aa7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9aa7('0x2'));router['get']('/',auth[_0x9aa7('0x3')](),controller['index']);router[_0x9aa7('0x4')](_0x9aa7('0x5'),auth[_0x9aa7('0x3')](),controller[_0x9aa7('0x6')]);router[_0x9aa7('0x4')]('/:id',auth[_0x9aa7('0x3')](),controller[_0x9aa7('0x7')]);router[_0x9aa7('0x8')]('/',auth[_0x9aa7('0x3')](),controller['create']);router['put'](_0x9aa7('0x9'),auth['isAuthenticated'](),controller[_0x9aa7('0xa')]);router['put'](_0x9aa7('0xb'),auth[_0x9aa7('0x3')](),controller['updateWithRetry']);router[_0x9aa7('0xc')](_0x9aa7('0x9'),auth[_0x9aa7('0x3')](),controller['destroy']);module[_0x9aa7('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index e552d18..389b469 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 _0x4f31=['exports','ENUM','internal','outbound','inbound-fax','outbound-fax','STRING','DATE','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f31,0x13f));var _0x14f3=function(_0x32d860,_0x4ab403){_0x32d860=_0x32d860-0x0;var _0x535099=_0x4f31[_0x32d860];return _0x535099;};'use strict';var Sequelize=require(_0x14f3('0x0'));module[_0x14f3('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x14f3('0x2')]('inbound',_0x14f3('0x3'),_0x14f3('0x4'),_0x14f3('0x5'),_0x14f3('0x6'),'dialer')},'tag':{'type':Sequelize[_0x14f3('0x7')]},'accountcode':{'type':Sequelize[_0x14f3('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x14f3('0x7')]},'callerid':{'type':Sequelize[_0x14f3('0x7')]},'channel':{'type':Sequelize[_0x14f3('0x7')]},'destinationchannel':{'type':Sequelize[_0x14f3('0x7')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x14f3('0x8')]},'answertime':{'type':Sequelize[_0x14f3('0x8')]},'endtime':{'type':Sequelize[_0x14f3('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x14f3('0x9')]},'mohtime':{'type':Sequelize[_0x14f3('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x14f3('0x7')]},'amaflags':{'type':Sequelize[_0x14f3('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x14f3('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x14f3('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x14f3('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x14f3('0x7')]}}; \ No newline at end of file +var _0xa8fd=['outbound','outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal'];(function(_0x30b465,_0x276f04){var _0x4bdc8e=function(_0x50fcca){while(--_0x50fcca){_0x30b465['push'](_0x30b465['shift']());}};_0x4bdc8e(++_0x276f04);}(_0xa8fd,0x69));var _0xda8f=function(_0x6576cc,_0x261556){_0x6576cc=_0x6576cc-0x0;var _0x1a5069=_0xa8fd[_0x6576cc];return _0x1a5069;};'use strict';var Sequelize=require('sequelize');module[_0xda8f('0x0')]={'uniqueid':{'type':Sequelize[_0xda8f('0x1')]},'type':{'type':Sequelize[_0xda8f('0x2')](_0xda8f('0x3'),_0xda8f('0x4'),_0xda8f('0x5'),'inbound-fax',_0xda8f('0x6'),_0xda8f('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xda8f('0x1')]},'source':{'type':Sequelize[_0xda8f('0x1')]},'destination':{'type':Sequelize[_0xda8f('0x1')]},'destinationcontext':{'type':Sequelize[_0xda8f('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xda8f('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xda8f('0x8')]},'starttime':{'type':Sequelize[_0xda8f('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xda8f('0x9')]},'endtime':{'type':Sequelize[_0xda8f('0x9')]},'duration':{'type':Sequelize[_0xda8f('0xa')]},'billableseconds':{'type':Sequelize[_0xda8f('0xa')]},'mohtime':{'type':Sequelize[_0xda8f('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xda8f('0x1')]},'userfield':{'type':Sequelize[_0xda8f('0x1')]},'userDisposition':{'type':Sequelize[_0xda8f('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xda8f('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xda8f('0x1')]},'note':{'type':Sequelize[_0xda8f('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xda8f('0xa')]},'sipcallid':{'type':Sequelize[_0xda8f('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5563582..afa30af 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 _0x3914=['params','rawAttributes','keys','includeAll','find','create','body','describe','user','uniqueid','No\x20such\x20report','lodash','../../components/parsers/qs','api','../../mysqldb','json','offset','limit','undefined','status','Content-Range','update','then','destroy','end','error','stack','name','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','VoiceCallReport','count','include','fullname','alias','User','findAll','rows','catch','show'];(function(_0x12ac5b,_0x23aed9){var _0x47ec60=function(_0x5224a9){while(--_0x5224a9){_0x12ac5b['push'](_0x12ac5b['shift']());}};_0x47ec60(++_0x23aed9);}(_0x3914,0xeb));var _0x4391=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x3914[_0x2074db];return _0x27324c;};'use strict';var _=require(_0x4391('0x0'));var qs=require(_0x4391('0x1'));var logger=require('../../config/logger')(_0x4391('0x2'));var db=require(_0x4391('0x3'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x1e8010,_0x343fb7){_0x343fb7=_0x343fb7||0xc8;return function(_0x175dbc){if(_0x175dbc){return _0x1e8010['status'](_0x343fb7)[_0x4391('0x4')](_0x175dbc);}};}function respondWithFilteredResult(_0x2b9b2b,_0x540b62){return function(_0x3717d5){if(_0x3717d5){var _0x49819d=typeof _0x540b62[_0x4391('0x5')]==='undefined'&&typeof _0x540b62[_0x4391('0x6')]===_0x4391('0x7');var _0x57c763=_0x3717d5['count'];var _0x3d6693=_0x49819d?0x0:_0x540b62[_0x4391('0x5')];var _0x3539e3=_0x49819d?_0x3717d5['count']:_0x540b62[_0x4391('0x5')]+_0x540b62[_0x4391('0x6')];var _0x3d485d;if(_0x3539e3>=_0x57c763){_0x3539e3=_0x57c763;_0x3d485d=0xc8;}else{_0x3d485d=0xce;}_0x2b9b2b[_0x4391('0x8')](_0x3d485d);return _0x2b9b2b['set'](_0x4391('0x9'),_0x3d6693+'-'+_0x3539e3+'/'+_0x57c763)[_0x4391('0x4')](_0x3717d5);}return null;};}function saveUpdates(_0x1577bc){return function(_0x137902){if(_0x137902){return _0x137902[_0x4391('0xa')](_0x1577bc)[_0x4391('0xb')](function(_0xca9ef5){return _0xca9ef5;});}return null;};}function removeEntity(_0x30a975){return function(_0x5bdd9e){if(_0x5bdd9e){return _0x5bdd9e[_0x4391('0xc')]()[_0x4391('0xb')](function(){_0x30a975[_0x4391('0x8')](0xcc)[_0x4391('0xd')]();});}};}function handleEntityNotFound(_0x536e5d){return function(_0x62c763){if(!_0x62c763){_0x536e5d['sendStatus'](0x194);}return _0x62c763;};}function handleError(_0x343203,_0x3a1b80){_0x3a1b80=_0x3a1b80||0x1f4;return function(_0x3e4585){logger[_0x4391('0xe')](_0x3e4585[_0x4391('0xf')]);if(_0x3e4585[_0x4391('0x10')]){delete _0x3e4585[_0x4391('0x10')];}_0x343203[_0x4391('0x8')](_0x3a1b80)['send'](_0x3e4585);};}exports['index']=function(_0x2ecb23,_0x4da0b0){var _0x42454e={},_0x13d63f={},_0xa9c97f={'count':0x0,'rows':[]};var _0x10271e=_[_0x4391('0x11')](db['VoiceCallReport']['rawAttributes'],function(_0x36c34c){return{'name':_0x36c34c[_0x4391('0x12')],'type':_0x36c34c[_0x4391('0x13')]['key']};});_0x13d63f[_0x4391('0x14')]=_[_0x4391('0x11')](_0x10271e,_0x4391('0x10'));_0x13d63f[_0x4391('0x15')]=_['keys'](_0x2ecb23[_0x4391('0x15')]);_0x13d63f[_0x4391('0x16')]=_[_0x4391('0x17')](_0x13d63f[_0x4391('0x14')],_0x13d63f[_0x4391('0x15')]);_0x42454e[_0x4391('0x18')]=_['intersection'](_0x13d63f[_0x4391('0x14')],qs[_0x4391('0x19')](_0x2ecb23[_0x4391('0x15')][_0x4391('0x19')]));_0x42454e['attributes']=_0x42454e['attributes'][_0x4391('0x1a')]?_0x42454e[_0x4391('0x18')]:_0x13d63f[_0x4391('0x14')];if(!_0x2ecb23[_0x4391('0x15')][_0x4391('0x1b')]('nolimit')){_0x42454e['limit']=qs['limit'](_0x2ecb23['query'][_0x4391('0x6')]);_0x42454e[_0x4391('0x5')]=qs[_0x4391('0x5')](_0x2ecb23[_0x4391('0x15')]['offset']);}_0x42454e[_0x4391('0x1c')]=qs[_0x4391('0x1d')](_0x2ecb23[_0x4391('0x15')][_0x4391('0x1d')]);_0x42454e[_0x4391('0x1e')]=qs['filters'](_[_0x4391('0x1f')](_0x2ecb23[_0x4391('0x15')],_0x13d63f[_0x4391('0x16')]),_0x10271e);if(_0x2ecb23[_0x4391('0x15')][_0x4391('0x20')]){_0x42454e[_0x4391('0x1e')]=_[_0x4391('0x21')](_0x42454e[_0x4391('0x1e')],{'$or':_[_0x4391('0x11')](_0x10271e,function(_0x8851cb){if(_0x8851cb[_0x4391('0x13')]!=='VIRTUAL'){var _0x46db4c={};_0x46db4c[_0x8851cb['name']]={'$like':'%'+_0x2ecb23[_0x4391('0x15')]['filter']+'%'};return _0x46db4c;}})});}_0x42454e=_['merge']({},_0x42454e,_0x2ecb23[_0x4391('0x22')]);var _0xf8313b={'where':_0x42454e[_0x4391('0x1e')]};return db[_0x4391('0x23')][_0x4391('0x24')](_0xf8313b)[_0x4391('0xb')](function(_0x205b8e){_0xa9c97f['count']=_0x205b8e;if(_0x2ecb23[_0x4391('0x15')]['includeAll']){_0x42454e[_0x4391('0x25')]=[{'attributes':['id','name',_0x4391('0x26'),_0x4391('0x27')],'model':db[_0x4391('0x28')],'as':_0x4391('0x28')}];}return db[_0x4391('0x23')][_0x4391('0x29')](_0x42454e);})[_0x4391('0xb')](function(_0x4235b3){_0xa9c97f[_0x4391('0x2a')]=_0x4235b3;return _0xa9c97f;})[_0x4391('0xb')](respondWithFilteredResult(_0x4da0b0,_0x42454e))[_0x4391('0x2b')](handleError(_0x4da0b0,null));};exports[_0x4391('0x2c')]=function(_0x477544,_0x110484){var _0x301865={'raw':!![],'where':{'id':_0x477544[_0x4391('0x2d')]['id']}},_0x459415={};_0x459415[_0x4391('0x14')]=_['keys'](db['VoiceCallReport'][_0x4391('0x2e')]);_0x459415[_0x4391('0x15')]=_[_0x4391('0x2f')](_0x477544[_0x4391('0x15')]);_0x459415[_0x4391('0x16')]=_[_0x4391('0x17')](_0x459415[_0x4391('0x14')],_0x459415[_0x4391('0x15')]);_0x301865['attributes']=_[_0x4391('0x17')](_0x459415['model'],qs['fields'](_0x477544['query']['fields']));_0x301865[_0x4391('0x18')]=_0x301865[_0x4391('0x18')][_0x4391('0x1a')]?_0x301865[_0x4391('0x18')]:_0x459415['model'];if(_0x477544['query'][_0x4391('0x30')]){_0x301865['include']=[{'all':!![]}];}_0x301865=_[_0x4391('0x21')]({},_0x301865,_0x477544[_0x4391('0x22')]);return db[_0x4391('0x23')][_0x4391('0x31')](_0x301865)[_0x4391('0xb')](handleEntityNotFound(_0x110484,null))[_0x4391('0xb')](respondWithResult(_0x110484,null))['catch'](handleError(_0x110484,null));};exports[_0x4391('0x32')]=function(_0x3da701,_0x361f44){return db[_0x4391('0x23')][_0x4391('0x32')](_0x3da701[_0x4391('0x33')],{})[_0x4391('0xb')](respondWithResult(_0x361f44,0xc9))['catch'](handleError(_0x361f44,null));};exports[_0x4391('0xc')]=function(_0x1ba3e3,_0x2991ac){return db[_0x4391('0x23')][_0x4391('0x31')]({'where':{'id':_0x1ba3e3[_0x4391('0x2d')]['id']}})[_0x4391('0xb')](handleEntityNotFound(_0x2991ac,null))['then'](removeEntity(_0x2991ac,null))[_0x4391('0x2b')](handleError(_0x2991ac,null));};exports['describe']=function(_0x308a49,_0x46a3c4){return db[_0x4391('0x23')][_0x4391('0x34')]()[_0x4391('0xb')](respondWithResult(_0x46a3c4,null))[_0x4391('0x2b')](handleError(_0x46a3c4,null));};function findForUpdate(_0x34272b){return db[_0x4391('0x23')][_0x4391('0x31')]({'where':{'uniqueid':_0x34272b[_0x4391('0x2d')]['id'],'UserId':{'$or':[null,_0x34272b[_0x4391('0x35')]['id']]}}});}exports[_0x4391('0xa')]=function(_0x125bd7,_0x566cf8){if(_0x125bd7['body'][_0x4391('0x36')]){delete _0x125bd7[_0x4391('0x33')][_0x4391('0x36')];}return findForUpdate(_0x125bd7)[_0x4391('0xb')](handleEntityNotFound(_0x566cf8,null))[_0x4391('0xb')](saveUpdates(_0x125bd7[_0x4391('0x33')],null))['then'](respondWithResult(_0x566cf8,null))[_0x4391('0x2b')](handleError(_0x566cf8,null));};exports['updateWithRetry']=function(_0x2c225e,_0x51afa5,_0x200a3b){if(_0x2c225e[_0x4391('0x33')][_0x4391('0x36')]){delete _0x2c225e[_0x4391('0x33')][_0x4391('0x36')];}promiseRetry(function(_0x3bdeb4){return findForUpdate(_0x2c225e)['then'](function(_0x64417b){if(_0x64417b!==null){return _0x64417b;}else{_0x3bdeb4(new Error(_0x4391('0x37')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x4391('0xb')](function(_0xf2c6e0){if(!_0xf2c6e0){return new Promise(function(_0x29470e){_0x29470e(handleEntityNotFound(_0x51afa5)());});}else{return _0xf2c6e0[_0x4391('0xa')](_0x2c225e[_0x4391('0x33')])[_0x4391('0xb')](function(_0x1ca698){return respondWithResult(_0x51afa5)(_0x1ca698);});}},function(){handleEntityNotFound(_0x51afa5)();});}; \ No newline at end of file +var _0xd819=['catch','show','keys','length','includeAll','find','create','body','params','describe','user','uniqueid','updateWithRetry','../../components/parsers/qs','../../config/logger','api','../../mysqldb','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','fullname','alias','User','findAll','rows'];(function(_0x2d48bc,_0x4dcd5f){var _0x5e4725=function(_0x33ad73){while(--_0x33ad73){_0x2d48bc['push'](_0x2d48bc['shift']());}};_0x5e4725(++_0x4dcd5f);}(_0xd819,0x181));var _0x9d81=function(_0x491d35,_0x43f6e5){_0x491d35=_0x491d35-0x0;var _0x5a2de7=_0xd819[_0x491d35];return _0x5a2de7;};'use strict';var _=require('lodash');var qs=require(_0x9d81('0x0'));var logger=require(_0x9d81('0x1'))(_0x9d81('0x2'));var db=require(_0x9d81('0x3'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0xdeec89,_0x5591a5){_0x5591a5=_0x5591a5||0xc8;return function(_0x301265){if(_0x301265){return _0xdeec89['status'](_0x5591a5)[_0x9d81('0x4')](_0x301265);}};}function respondWithFilteredResult(_0x239432,_0x3a4899){return function(_0x565411){if(_0x565411){var _0xfc583e=typeof _0x3a4899[_0x9d81('0x5')]===_0x9d81('0x6')&&typeof _0x3a4899[_0x9d81('0x7')]===_0x9d81('0x6');var _0x43244d=_0x565411[_0x9d81('0x8')];var _0x21e4f7=_0xfc583e?0x0:_0x3a4899[_0x9d81('0x5')];var _0x3932e7=_0xfc583e?_0x565411[_0x9d81('0x8')]:_0x3a4899[_0x9d81('0x5')]+_0x3a4899[_0x9d81('0x7')];var _0x32ff90;if(_0x3932e7>=_0x43244d){_0x3932e7=_0x43244d;_0x32ff90=0xc8;}else{_0x32ff90=0xce;}_0x239432['status'](_0x32ff90);return _0x239432[_0x9d81('0x9')](_0x9d81('0xa'),_0x21e4f7+'-'+_0x3932e7+'/'+_0x43244d)['json'](_0x565411);}return null;};}function saveUpdates(_0x2113a5){return function(_0x3fb6b5){if(_0x3fb6b5){return _0x3fb6b5[_0x9d81('0xb')](_0x2113a5)[_0x9d81('0xc')](function(_0x595315){return _0x595315;});}return null;};}function removeEntity(_0x2a7e4d){return function(_0x4be590){if(_0x4be590){return _0x4be590[_0x9d81('0xd')]()['then'](function(){_0x2a7e4d[_0x9d81('0xe')](0xcc)[_0x9d81('0xf')]();});}};}function handleEntityNotFound(_0x5d0f0f){return function(_0x3caeb8){if(!_0x3caeb8){_0x5d0f0f[_0x9d81('0x10')](0x194);}return _0x3caeb8;};}function handleError(_0x2ba83e,_0x20ee18){_0x20ee18=_0x20ee18||0x1f4;return function(_0x2d3648){logger[_0x9d81('0x11')](_0x2d3648[_0x9d81('0x12')]);if(_0x2d3648[_0x9d81('0x13')]){delete _0x2d3648['name'];}_0x2ba83e[_0x9d81('0xe')](_0x20ee18)[_0x9d81('0x14')](_0x2d3648);};}exports[_0x9d81('0x15')]=function(_0x406588,_0x3fd093){var _0x49e4c9={},_0x5ef227={},_0x2879ad={'count':0x0,'rows':[]};var _0x3844c8=_[_0x9d81('0x16')](db[_0x9d81('0x17')][_0x9d81('0x18')],function(_0x175d4f){return{'name':_0x175d4f[_0x9d81('0x19')],'type':_0x175d4f[_0x9d81('0x1a')][_0x9d81('0x1b')]};});_0x5ef227[_0x9d81('0x1c')]=_[_0x9d81('0x16')](_0x3844c8,_0x9d81('0x13'));_0x5ef227[_0x9d81('0x1d')]=_['keys'](_0x406588[_0x9d81('0x1d')]);_0x5ef227[_0x9d81('0x1e')]=_[_0x9d81('0x1f')](_0x5ef227[_0x9d81('0x1c')],_0x5ef227[_0x9d81('0x1d')]);_0x49e4c9[_0x9d81('0x20')]=_[_0x9d81('0x1f')](_0x5ef227[_0x9d81('0x1c')],qs['fields'](_0x406588[_0x9d81('0x1d')][_0x9d81('0x21')]));_0x49e4c9[_0x9d81('0x20')]=_0x49e4c9[_0x9d81('0x20')]['length']?_0x49e4c9[_0x9d81('0x20')]:_0x5ef227['model'];if(!_0x406588[_0x9d81('0x1d')]['hasOwnProperty'](_0x9d81('0x22'))){_0x49e4c9['limit']=qs[_0x9d81('0x7')](_0x406588[_0x9d81('0x1d')][_0x9d81('0x7')]);_0x49e4c9[_0x9d81('0x5')]=qs[_0x9d81('0x5')](_0x406588[_0x9d81('0x1d')][_0x9d81('0x5')]);}_0x49e4c9[_0x9d81('0x23')]=qs[_0x9d81('0x24')](_0x406588[_0x9d81('0x1d')][_0x9d81('0x24')]);_0x49e4c9[_0x9d81('0x25')]=qs[_0x9d81('0x1e')](_[_0x9d81('0x26')](_0x406588[_0x9d81('0x1d')],_0x5ef227[_0x9d81('0x1e')]),_0x3844c8);if(_0x406588['query']['filter']){_0x49e4c9[_0x9d81('0x25')]=_[_0x9d81('0x27')](_0x49e4c9[_0x9d81('0x25')],{'$or':_['map'](_0x3844c8,function(_0xb9c18b){if(_0xb9c18b[_0x9d81('0x1a')]!==_0x9d81('0x28')){var _0x494696={};_0x494696[_0xb9c18b[_0x9d81('0x13')]]={'$like':'%'+_0x406588[_0x9d81('0x1d')][_0x9d81('0x29')]+'%'};return _0x494696;}})});}_0x49e4c9=_[_0x9d81('0x27')]({},_0x49e4c9,_0x406588[_0x9d81('0x2a')]);var _0x34ad39={'where':_0x49e4c9[_0x9d81('0x25')]};return db[_0x9d81('0x17')][_0x9d81('0x8')](_0x34ad39)[_0x9d81('0xc')](function(_0x20130a){_0x2879ad[_0x9d81('0x8')]=_0x20130a;if(_0x406588[_0x9d81('0x1d')]['includeAll']){_0x49e4c9[_0x9d81('0x2b')]=[{'attributes':['id',_0x9d81('0x13'),_0x9d81('0x2c'),_0x9d81('0x2d')],'model':db[_0x9d81('0x2e')],'as':'User'}];}return db[_0x9d81('0x17')][_0x9d81('0x2f')](_0x49e4c9);})[_0x9d81('0xc')](function(_0x16871f){_0x2879ad[_0x9d81('0x30')]=_0x16871f;return _0x2879ad;})[_0x9d81('0xc')](respondWithFilteredResult(_0x3fd093,_0x49e4c9))[_0x9d81('0x31')](handleError(_0x3fd093,null));};exports[_0x9d81('0x32')]=function(_0x5e8f70,_0x2305f0){var _0x25e0c0={'raw':!![],'where':{'id':_0x5e8f70['params']['id']}},_0x2ccaa6={};_0x2ccaa6[_0x9d81('0x1c')]=_['keys'](db[_0x9d81('0x17')]['rawAttributes']);_0x2ccaa6[_0x9d81('0x1d')]=_[_0x9d81('0x33')](_0x5e8f70[_0x9d81('0x1d')]);_0x2ccaa6['filters']=_[_0x9d81('0x1f')](_0x2ccaa6[_0x9d81('0x1c')],_0x2ccaa6[_0x9d81('0x1d')]);_0x25e0c0[_0x9d81('0x20')]=_[_0x9d81('0x1f')](_0x2ccaa6[_0x9d81('0x1c')],qs[_0x9d81('0x21')](_0x5e8f70[_0x9d81('0x1d')]['fields']));_0x25e0c0['attributes']=_0x25e0c0['attributes'][_0x9d81('0x34')]?_0x25e0c0[_0x9d81('0x20')]:_0x2ccaa6['model'];if(_0x5e8f70[_0x9d81('0x1d')][_0x9d81('0x35')]){_0x25e0c0[_0x9d81('0x2b')]=[{'all':!![]}];}_0x25e0c0=_['merge']({},_0x25e0c0,_0x5e8f70[_0x9d81('0x2a')]);return db[_0x9d81('0x17')][_0x9d81('0x36')](_0x25e0c0)[_0x9d81('0xc')](handleEntityNotFound(_0x2305f0,null))[_0x9d81('0xc')](respondWithResult(_0x2305f0,null))[_0x9d81('0x31')](handleError(_0x2305f0,null));};exports[_0x9d81('0x37')]=function(_0x462a78,_0x561d61){return db[_0x9d81('0x17')]['create'](_0x462a78[_0x9d81('0x38')],{})[_0x9d81('0xc')](respondWithResult(_0x561d61,0xc9))[_0x9d81('0x31')](handleError(_0x561d61,null));};exports['destroy']=function(_0x5975c7,_0x307391){return db[_0x9d81('0x17')]['find']({'where':{'id':_0x5975c7[_0x9d81('0x39')]['id']}})[_0x9d81('0xc')](handleEntityNotFound(_0x307391,null))[_0x9d81('0xc')](removeEntity(_0x307391,null))[_0x9d81('0x31')](handleError(_0x307391,null));};exports[_0x9d81('0x3a')]=function(_0x457eaf,_0x28a5c3){return db['VoiceCallReport'][_0x9d81('0x3a')]()[_0x9d81('0xc')](respondWithResult(_0x28a5c3,null))[_0x9d81('0x31')](handleError(_0x28a5c3,null));};function findForUpdate(_0x190a2f){return db['VoiceCallReport'][_0x9d81('0x36')]({'where':{'uniqueid':_0x190a2f['params']['id'],'UserId':{'$or':[null,_0x190a2f[_0x9d81('0x3b')]['id']]}}});}exports[_0x9d81('0xb')]=function(_0x230f8a,_0xad651c){if(_0x230f8a[_0x9d81('0x38')][_0x9d81('0x3c')]){delete _0x230f8a[_0x9d81('0x38')]['uniqueid'];}return findForUpdate(_0x230f8a)['then'](handleEntityNotFound(_0xad651c,null))[_0x9d81('0xc')](saveUpdates(_0x230f8a['body'],null))[_0x9d81('0xc')](respondWithResult(_0xad651c,null))[_0x9d81('0x31')](handleError(_0xad651c,null));};exports[_0x9d81('0x3d')]=function(_0x3ff121,_0x12abb5,_0xd93447){if(_0x3ff121[_0x9d81('0x38')]['uniqueid']){delete _0x3ff121[_0x9d81('0x38')][_0x9d81('0x3c')];}promiseRetry(function(_0x4f0fe9){return findForUpdate(_0x3ff121)[_0x9d81('0xc')](function(_0x4d46b8){if(_0x4d46b8!==null){return _0x4d46b8;}else{_0x4f0fe9(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x9d81('0xc')](function(_0x28ce32){if(!_0x28ce32){return new Promise(function(_0x220490){_0x220490(handleEntityNotFound(_0x12abb5)());});}else{return _0x28ce32['update'](_0x3ff121[_0x9d81('0x38')])['then'](function(_0x424f06){return respondWithResult(_0x12abb5)(_0x424f06);});}},function(){handleEntityNotFound(_0x12abb5)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b83d22f..1e12c27 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 _0x96c3=['rimraf','../../config/environment','exports','VoiceCallReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x6a3450,_0x5edf9e){var _0x579dc4=function(_0x5a8172){while(--_0x5a8172){_0x6a3450['push'](_0x6a3450['shift']());}};_0x579dc4(++_0x5edf9e);}(_0x96c3,0xff));var _0x396c=function(_0x47271a,_0x2089d2){_0x47271a=_0x47271a-0x0;var _0x2bf54b=_0x96c3[_0x47271a];return _0x2bf54b;};'use strict';var _=require(_0x396c('0x0'));var util=require('util');var logger=require(_0x396c('0x1'))('api');var moment=require(_0x396c('0x2'));var BPromise=require(_0x396c('0x3'));var rp=require(_0x396c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x396c('0x5'));var config=require(_0x396c('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x396c('0x7')]=function(_0x37b8e1,_0x56a86e){return _0x37b8e1['define'](_0x396c('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x396c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55ec=['report_call','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x55ec,0x105));var _0xc55e=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x55ec[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xc55e('0x0'));var util=require(_0xc55e('0x1'));var logger=require(_0xc55e('0x2'))(_0xc55e('0x3'));var moment=require(_0xc55e('0x4'));var BPromise=require('bluebird');var rp=require(_0xc55e('0x5'));var fs=require('fs');var path=require(_0xc55e('0x6'));var rimraf=require(_0xc55e('0x7'));var config=require(_0xc55e('0x8'));var attributes=require(_0xc55e('0x9'));module['exports']=function(_0x1af8c7,_0x1b404f){return _0x1af8c7[_0xc55e('0xa')](_0xc55e('0xb'),attributes,{'tableName':_0xc55e('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 41d3350..9ae0bcb 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 _0xf354=['stringify','error','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','model','map','catch','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','limit','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf354,0x17c));var _0x4f35=function(_0x500c5b,_0xb87b75){_0x500c5b=_0x500c5b-0x0;var _0x91e220=_0xf354[_0x500c5b];return _0x91e220;};'use strict';var _=require(_0x4f35('0x0'));var util=require(_0x4f35('0x1'));var moment=require('moment');var BPromise=require(_0x4f35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f35('0x3'));var db=require(_0x4f35('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f35('0x5'));var config=require(_0x4f35('0x6'));var jayson=require(_0x4f35('0x7'));var client=jayson[_0x4f35('0x8')][_0x4f35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3644d2,_0x37a5da,_0x1ea44b){return new BPromise(function(_0x3ac6f6,_0x4c8b77){return client[_0x4f35('0xa')](_0x3644d2,_0x1ea44b)[_0x4f35('0xb')](function(_0x2be5d0){logger[_0x4f35('0xc')](_0x4f35('0xd'),_0x37a5da,_0x4f35('0xe'));logger[_0x4f35('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x37a5da,_0x4f35('0xe'),JSON[_0x4f35('0x10')](_0x2be5d0));if(_0x2be5d0[_0x4f35('0x11')]){if(_0x2be5d0['error']['code']===0x1f4){logger[_0x4f35('0x11')](_0x4f35('0xd'),_0x37a5da,_0x2be5d0[_0x4f35('0x11')]['message']);return _0x4c8b77(_0x2be5d0[_0x4f35('0x11')]['message']);}logger[_0x4f35('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x37a5da,_0x2be5d0[_0x4f35('0x11')][_0x4f35('0x12')]);return _0x3ac6f6(_0x2be5d0[_0x4f35('0x11')][_0x4f35('0x12')]);}else{logger[_0x4f35('0xc')](_0x4f35('0xd'),_0x37a5da,_0x4f35('0xe'));_0x3ac6f6(_0x2be5d0[_0x4f35('0x13')]['message']);}})['catch'](function(_0x24ce4b){logger[_0x4f35('0x11')](_0x4f35('0xd'),_0x37a5da,_0x24ce4b);_0x4c8b77(_0x24ce4b);});});}exports[_0x4f35('0x14')]=function(_0x52c293){var _0x4c6572=this;return new Promise(function(_0x5eff30,_0x227f84){return db[_0x4f35('0x15')][_0x4f35('0x16')]({'raw':_0x52c293[_0x4f35('0x17')]?_0x52c293['options'][_0x4f35('0x18')]===undefined?!![]:![]:!![],'where':_0x52c293[_0x4f35('0x17')]?_0x52c293['options'][_0x4f35('0x19')]||null:null,'attributes':_0x52c293['options']?_0x52c293['options'][_0x4f35('0x1a')]||null:null,'limit':_0x52c293[_0x4f35('0x17')]?_0x52c293[_0x4f35('0x17')]['limit']||null:null,'include':_0x52c293['options']?_0x52c293[_0x4f35('0x17')][_0x4f35('0x1b')]?_['map'](_0x52c293[_0x4f35('0x17')]['include'],function(_0x407e18){return{'model':db[_0x407e18[_0x4f35('0x1c')]],'as':_0x407e18['as'],'attributes':_0x407e18[_0x4f35('0x1a')],'include':_0x407e18[_0x4f35('0x1b')]?_[_0x4f35('0x1d')](_0x407e18[_0x4f35('0x1b')],function(_0x54e8d9){return{'model':db[_0x54e8d9[_0x4f35('0x1c')]],'as':_0x54e8d9['as'],'attributes':_0x54e8d9['attributes'],'include':_0x54e8d9[_0x4f35('0x1b')]?_['map'](_0x54e8d9['include'],function(_0x3edff2){return{'model':db[_0x3edff2[_0x4f35('0x1c')]],'as':_0x3edff2['as'],'attributes':_0x3edff2[_0x4f35('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf01660){logger[_0x4f35('0xc')]('GetVoiceCallReport',_0x52c293);logger[_0x4f35('0xf')](_0x4f35('0x14'),_0x52c293,JSON['stringify'](_0xf01660));_0x5eff30(_0xf01660);})[_0x4f35('0x1e')](function(_0x559e7b){logger['error'](_0x4f35('0x14'),_0x559e7b[_0x4f35('0x12')],_0x52c293);_0x227f84(_0x4c6572[_0x4f35('0x11')](0x1f4,_0x559e7b[_0x4f35('0x12')]));});});};exports[_0x4f35('0x1f')]=function(_0x47e5c5){var _0x51202a=this;return new Promise(function(_0xda6e22,_0xe72df7){return db[_0x4f35('0x15')]['create'](_0x47e5c5[_0x4f35('0x20')],{'raw':_0x47e5c5['options']?_0x47e5c5[_0x4f35('0x17')][_0x4f35('0x18')]===undefined?!![]:![]:!![]})[_0x4f35('0xb')](function(_0x4b50f8){logger[_0x4f35('0xc')]('CreateVoiceCallReport',_0x47e5c5);logger[_0x4f35('0xf')]('CreateVoiceCallReport',_0x47e5c5,JSON[_0x4f35('0x10')](_0x4b50f8));_0xda6e22(_0x4b50f8);})[_0x4f35('0x1e')](function(_0x53a957){logger[_0x4f35('0x11')](_0x4f35('0x1f'),_0x53a957[_0x4f35('0x12')],_0x47e5c5);_0xe72df7(_0x51202a[_0x4f35('0x11')](0x1f4,_0x53a957['message']));});});};exports[_0x4f35('0x21')]=function(_0x3321f2){var _0x5aa01b=this;return new Promise(function(_0x58a76f,_0x223922){return db['VoiceCallReport'][_0x4f35('0x22')](_0x3321f2[_0x4f35('0x20')],{'raw':_0x3321f2['options']?_0x3321f2[_0x4f35('0x17')][_0x4f35('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3321f2[_0x4f35('0x17')]?_0x3321f2[_0x4f35('0x17')]['where']||null:null,'attributes':_0x3321f2[_0x4f35('0x17')]?_0x3321f2[_0x4f35('0x17')][_0x4f35('0x1a')]||null:null,'limit':_0x3321f2['options']?_0x3321f2[_0x4f35('0x17')][_0x4f35('0x23')]||null:null})[_0x4f35('0xb')](function(_0x1757f2){logger[_0x4f35('0xc')](_0x4f35('0x21'),_0x3321f2);logger['debug']('UpdateVoiceCallReport',_0x3321f2,JSON['stringify'](_0x1757f2));_0x58a76f(_0x1757f2);})[_0x4f35('0x1e')](function(_0x42729b){logger[_0x4f35('0x11')]('UpdateVoiceCallReport',_0x42729b[_0x4f35('0x12')],_0x3321f2);_0x223922(_0x5aa01b[_0x4f35('0x11')](0x1f4,_0x42729b[_0x4f35('0x12')]));});});}; \ No newline at end of file +var _0x6617=['create','body','update','where','UpdateVoiceCallReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','options','raw','limit','include','map','model','attributes','CreateVoiceCallReport','VoiceCallReport'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x6617,0x74));var _0x7661=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x6617[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0x7661('0x0'));var util=require(_0x7661('0x1'));var moment=require('moment');var BPromise=require(_0x7661('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7661('0x3'));var db=require(_0x7661('0x4'))['db'];var utils=require(_0x7661('0x5'));var logger=require(_0x7661('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7661('0x7'));var client=jayson['client'][_0x7661('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18ea8f,_0x578198,_0x1be88e){return new BPromise(function(_0x51119c,_0x55c5df){return client[_0x7661('0x9')](_0x18ea8f,_0x1be88e)[_0x7661('0xa')](function(_0xaa0295){logger[_0x7661('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x578198,'request\x20sent');logger[_0x7661('0xc')](_0x7661('0xd'),_0x578198,_0x7661('0xe'),JSON[_0x7661('0xf')](_0xaa0295));if(_0xaa0295[_0x7661('0x10')]){if(_0xaa0295['error'][_0x7661('0x11')]===0x1f4){logger['error'](_0x7661('0x12'),_0x578198,_0xaa0295[_0x7661('0x10')][_0x7661('0x13')]);return _0x55c5df(_0xaa0295[_0x7661('0x10')]['message']);}logger[_0x7661('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x578198,_0xaa0295[_0x7661('0x10')][_0x7661('0x13')]);return _0x51119c(_0xaa0295[_0x7661('0x10')][_0x7661('0x13')]);}else{logger[_0x7661('0xb')](_0x7661('0x12'),_0x578198,_0x7661('0xe'));_0x51119c(_0xaa0295[_0x7661('0x14')][_0x7661('0x13')]);}})[_0x7661('0x15')](function(_0x1f7b55){logger['error'](_0x7661('0x12'),_0x578198,_0x1f7b55);_0x55c5df(_0x1f7b55);});});}exports[_0x7661('0x16')]=function(_0x453268){var _0x49a424=this;return new Promise(function(_0x1e5753,_0x278d07){return db['VoiceCallReport']['findAll']({'raw':_0x453268[_0x7661('0x17')]?_0x453268['options'][_0x7661('0x18')]===undefined?!![]:![]:!![],'where':_0x453268[_0x7661('0x17')]?_0x453268[_0x7661('0x17')]['where']||null:null,'attributes':_0x453268[_0x7661('0x17')]?_0x453268[_0x7661('0x17')]['attributes']||null:null,'limit':_0x453268[_0x7661('0x17')]?_0x453268[_0x7661('0x17')][_0x7661('0x19')]||null:null,'include':_0x453268[_0x7661('0x17')]?_0x453268['options'][_0x7661('0x1a')]?_[_0x7661('0x1b')](_0x453268[_0x7661('0x17')][_0x7661('0x1a')],function(_0x407a2b){return{'model':db[_0x407a2b[_0x7661('0x1c')]],'as':_0x407a2b['as'],'attributes':_0x407a2b[_0x7661('0x1d')],'include':_0x407a2b[_0x7661('0x1a')]?_['map'](_0x407a2b[_0x7661('0x1a')],function(_0x16b26c){return{'model':db[_0x16b26c['model']],'as':_0x16b26c['as'],'attributes':_0x16b26c[_0x7661('0x1d')],'include':_0x16b26c[_0x7661('0x1a')]?_[_0x7661('0x1b')](_0x16b26c[_0x7661('0x1a')],function(_0x291eed){return{'model':db[_0x291eed[_0x7661('0x1c')]],'as':_0x291eed['as'],'attributes':_0x291eed[_0x7661('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3379b5){logger[_0x7661('0xb')]('GetVoiceCallReport',_0x453268);logger[_0x7661('0xc')](_0x7661('0x16'),_0x453268,JSON[_0x7661('0xf')](_0x3379b5));_0x1e5753(_0x3379b5);})[_0x7661('0x15')](function(_0x59e901){logger[_0x7661('0x10')](_0x7661('0x16'),_0x59e901[_0x7661('0x13')],_0x453268);_0x278d07(_0x49a424[_0x7661('0x10')](0x1f4,_0x59e901[_0x7661('0x13')]));});});};exports[_0x7661('0x1e')]=function(_0x305152){var _0x488b27=this;return new Promise(function(_0x225ba7,_0x306e01){return db[_0x7661('0x1f')][_0x7661('0x20')](_0x305152[_0x7661('0x21')],{'raw':_0x305152['options']?_0x305152[_0x7661('0x17')][_0x7661('0x18')]===undefined?!![]:![]:!![]})[_0x7661('0xa')](function(_0x12ccaa){logger[_0x7661('0xb')](_0x7661('0x1e'),_0x305152);logger['debug'](_0x7661('0x1e'),_0x305152,JSON[_0x7661('0xf')](_0x12ccaa));_0x225ba7(_0x12ccaa);})[_0x7661('0x15')](function(_0x188f21){logger['error'](_0x7661('0x1e'),_0x188f21['message'],_0x305152);_0x306e01(_0x488b27['error'](0x1f4,_0x188f21[_0x7661('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x41efa7){var _0x58f5a3=this;return new Promise(function(_0x17c072,_0x3c5212){return db['VoiceCallReport'][_0x7661('0x22')](_0x41efa7[_0x7661('0x21')],{'raw':_0x41efa7[_0x7661('0x17')]?_0x41efa7[_0x7661('0x17')][_0x7661('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41efa7[_0x7661('0x17')]?_0x41efa7[_0x7661('0x17')][_0x7661('0x23')]||null:null,'attributes':_0x41efa7[_0x7661('0x17')]?_0x41efa7[_0x7661('0x17')][_0x7661('0x1d')]||null:null,'limit':_0x41efa7[_0x7661('0x17')]?_0x41efa7[_0x7661('0x17')]['limit']||null:null})[_0x7661('0xa')](function(_0x533b6b){logger['info'](_0x7661('0x24'),_0x41efa7);logger['debug'](_0x7661('0x24'),_0x41efa7,JSON[_0x7661('0xf')](_0x533b6b));_0x17c072(_0x533b6b);})[_0x7661('0x15')](function(_0x1f26dc){logger['error'](_0x7661('0x24'),_0x1f26dc[_0x7661('0x13')],_0x41efa7);_0x3c5212(_0x58f5a3['error'](0x1f4,_0x1f26dc[_0x7661('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 02183db..ecb960b 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 _0x77bc=['/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','put'];(function(_0x467637,_0x3b0f30){var _0x1c77db=function(_0x4f114e){while(--_0x4f114e){_0x467637['push'](_0x467637['shift']());}};_0x1c77db(++_0x3b0f30);}(_0x77bc,0x108));var _0xc77b=function(_0x4a2324,_0x2c1e3c){_0x4a2324=_0x4a2324-0x0;var _0x159c1d=_0x77bc[_0x4a2324];return _0x159c1d;};'use strict';var multer=require(_0xc77b('0x0'));var util=require(_0xc77b('0x1'));var path=require(_0xc77b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc77b('0x3'));var router=express[_0xc77b('0x4')]();var fs_extra=require(_0xc77b('0x5'));var auth=require(_0xc77b('0x6'));var interaction=require(_0xc77b('0x7'));var config=require(_0xc77b('0x8'));var controller=require(_0xc77b('0x9'));router[_0xc77b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc77b('0xa')]('/:id',auth[_0xc77b('0xb')](),controller[_0xc77b('0xc')]);router[_0xc77b('0xd')]('/',auth[_0xc77b('0xb')](),controller[_0xc77b('0xe')]);router[_0xc77b('0xf')](_0xc77b('0x10'),auth[_0xc77b('0xb')](),controller['update']);router[_0xc77b('0x11')](_0xc77b('0x10'),auth[_0xc77b('0xb')](),controller[_0xc77b('0x12')]);module[_0xc77b('0x13')]=router; \ No newline at end of file +var _0xdf48=['create','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4281eb,_0x34b319){var _0x927e98=function(_0xda54ee){while(--_0xda54ee){_0x4281eb['push'](_0x4281eb['shift']());}};_0x927e98(++_0x34b319);}(_0xdf48,0x75));var _0x8df4=function(_0x43f9f3,_0x22e710){_0x43f9f3=_0x43f9f3-0x0;var _0x211a8c=_0xdf48[_0x43f9f3];return _0x211a8c;};'use strict';var multer=require(_0x8df4('0x0'));var util=require(_0x8df4('0x1'));var path=require(_0x8df4('0x2'));var timeout=require(_0x8df4('0x3'));var express=require('express');var router=express[_0x8df4('0x4')]();var fs_extra=require(_0x8df4('0x5'));var auth=require(_0x8df4('0x6'));var interaction=require(_0x8df4('0x7'));var config=require(_0x8df4('0x8'));var controller=require(_0x8df4('0x9'));router[_0x8df4('0xa')]('/',auth[_0x8df4('0xb')](),controller[_0x8df4('0xc')]);router[_0x8df4('0xa')](_0x8df4('0xd'),auth[_0x8df4('0xb')](),controller[_0x8df4('0xe')]);router[_0x8df4('0xf')]('/',auth['isAuthenticated'](),controller[_0x8df4('0x10')]);router['put'](_0x8df4('0xd'),auth[_0x8df4('0xb')](),controller['update']);router[_0x8df4('0x11')](_0x8df4('0xd'),auth[_0x8df4('0xb')](),controller['destroy']);module[_0x8df4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a5ec6d7..c0359b8 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 _0x3fb9=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x3fb9,0x183));var _0x93fb=function(_0x361472,_0x3beccc){_0x361472=_0x361472-0x0;var _0x3ce045=_0x3fb9[_0x361472];return _0x3ce045;};'use strict';var Sequelize=require(_0x93fb('0x0'));module[_0x93fb('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x93fb('0x2')],'unique':_0x93fb('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x93fb('0x2')],'set':function(_0xdf97da){this[_0x93fb('0x4')](_0x93fb('0x5'),_0xdf97da?_0xdf97da[_0x93fb('0x6')](''):[]);},'get':function(){return this[_0x93fb('0x7')](_0x93fb('0x5'))?this[_0x93fb('0x7')](_0x93fb('0x5'))[_0x93fb('0x8')](''):[];}},'auth':{'type':Sequelize[_0x93fb('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x93fb('0x2')]},'record':{'type':Sequelize[_0x93fb('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x93fb('0x2')]},'description':{'type':Sequelize[_0x93fb('0x2')]}}; \ No newline at end of file +var _0xa71a=['getDataValue','split','BOOLEAN','STRING','name','options','join'];(function(_0x2dcbc8,_0x11b282){var _0x1ecb10=function(_0x37e8e5){while(--_0x37e8e5){_0x2dcbc8['push'](_0x2dcbc8['shift']());}};_0x1ecb10(++_0x11b282);}(_0xa71a,0x17d));var _0xaa71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa71a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaa71('0x0')]},'prefix':{'type':Sequelize[_0xaa71('0x0')],'unique':_0xaa71('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xaa71('0x0')],'set':function(_0x549a2c){this['setDataValue'](_0xaa71('0x2'),_0x549a2c?_0x549a2c[_0xaa71('0x3')](''):[]);},'get':function(){return this[_0xaa71('0x4')](_0xaa71('0x2'))?this[_0xaa71('0x4')](_0xaa71('0x2'))[_0xaa71('0x5')](''):[];}},'auth':{'type':Sequelize[_0xaa71('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xaa71('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xaa71('0x0')]},'description':{'type':Sequelize[_0xaa71('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 32d050a..937f5c1 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 _0xb821=['create','body','user','get','role','ChanSpies','find','catch','update','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','include','findAll','show','params','keys','includeAll','options'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb821,0xa7));var _0x1b82=function(_0x5353e4,_0x3fba02){_0x5353e4=_0x5353e4-0x0;var _0x5024b3=_0xb821[_0x5353e4];return _0x5024b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];function respondWithStatusCode(_0x241d11,_0x2391f5){_0x2391f5=_0x2391f5||0xcc;return function(_0x61b6eb){if(_0x61b6eb){return _0x241d11['sendStatus'](_0x2391f5);}return _0x241d11[_0x1b82('0x18')](_0x2391f5)['end']();};}function respondWithResult(_0x54915f,_0x1e553a){_0x1e553a=_0x1e553a||0xc8;return function(_0x4bf75b){if(_0x4bf75b){return _0x54915f[_0x1b82('0x18')](_0x1e553a)[_0x1b82('0x19')](_0x4bf75b);}};}function respondWithFilteredResult(_0x5d4cf1,_0x46c2cf){return function(_0x5dab7d){if(_0x5dab7d){var _0x563261=typeof _0x46c2cf[_0x1b82('0x1a')]==='undefined'&&typeof _0x46c2cf[_0x1b82('0x1b')]===_0x1b82('0x1c');var _0xf42818=_0x5dab7d['count'];var _0x514082=_0x563261?0x0:_0x46c2cf[_0x1b82('0x1a')];var _0x5d66c3=_0x563261?_0x5dab7d[_0x1b82('0x1d')]:_0x46c2cf[_0x1b82('0x1a')]+_0x46c2cf[_0x1b82('0x1b')];var _0x594a63;if(_0x5d66c3>=_0xf42818){_0x5d66c3=_0xf42818;_0x594a63=0xc8;}else{_0x594a63=0xce;}_0x5d4cf1[_0x1b82('0x18')](_0x594a63);return _0x5d4cf1[_0x1b82('0x1e')](_0x1b82('0x1f'),_0x514082+'-'+_0x5d66c3+'/'+_0xf42818)[_0x1b82('0x19')](_0x5dab7d);}return null;};}function patchUpdates(_0x10d45c){return function(_0x47e99b){try{jsonpatch[_0x1b82('0x20')](_0x47e99b,_0x10d45c,!![]);}catch(_0x1892b0){return BPromise[_0x1b82('0x21')](_0x1892b0);}return _0x47e99b[_0x1b82('0x22')]();};}function saveUpdates(_0x26e481,_0x31fd64){return function(_0x2d07f4){if(_0x2d07f4){return _0x2d07f4['update'](_0x26e481)[_0x1b82('0x23')](function(_0x233740){return _0x233740;});}return null;};}function removeEntity(_0x5b8d09,_0x561d78){return function(_0x225b81){if(_0x225b81){return _0x225b81[_0x1b82('0x24')]()['then'](function(){var _0x3a1226=_0x225b81['get']({'plain':!![]});var _0x5cd458='ChanSpies';return db[_0x1b82('0x25')][_0x1b82('0x24')]({'where':{'type':_0x5cd458,'resourceId':_0x3a1226['id']}})[_0x1b82('0x23')](function(){return _0x225b81;});})[_0x1b82('0x23')](function(){_0x5b8d09['status'](0xcc)[_0x1b82('0x26')]();});}};}function handleEntityNotFound(_0x165b45,_0x1b5260){return function(_0x7455e8){if(!_0x7455e8){_0x165b45[_0x1b82('0x27')](0x194);}return _0x7455e8;};}function handleError(_0x1b8b6f,_0x223b6a){_0x223b6a=_0x223b6a||0x1f4;return function(_0x21ea34){logger[_0x1b82('0x28')](_0x21ea34[_0x1b82('0x29')]);if(_0x21ea34[_0x1b82('0x2a')]){delete _0x21ea34[_0x1b82('0x2a')];}_0x1b8b6f[_0x1b82('0x18')](_0x223b6a)['send'](_0x21ea34);};}exports[_0x1b82('0x2b')]=function(_0x2931d0,_0x155a34){var _0x457dbb={},_0x18e4ff={},_0x115ce7={'count':0x0,'rows':[]};var _0xd3c4a=_[_0x1b82('0x2c')](db[_0x1b82('0x2d')][_0x1b82('0x2e')],function(_0x501ab0){return{'name':_0x501ab0[_0x1b82('0x2f')],'type':_0x501ab0[_0x1b82('0x30')][_0x1b82('0x31')]};});_0x18e4ff[_0x1b82('0x32')]=_['map'](_0xd3c4a,_0x1b82('0x2a'));_0x18e4ff[_0x1b82('0x33')]=_['keys'](_0x2931d0[_0x1b82('0x33')]);_0x18e4ff[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x18e4ff['model'],_0x18e4ff['query']);_0x457dbb[_0x1b82('0x36')]=_['intersection'](_0x18e4ff['model'],qs[_0x1b82('0x37')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x37')]));_0x457dbb['attributes']=_0x457dbb[_0x1b82('0x36')][_0x1b82('0x38')]?_0x457dbb[_0x1b82('0x36')]:_0x18e4ff[_0x1b82('0x32')];if(!_0x2931d0['query'][_0x1b82('0x39')](_0x1b82('0x3a'))){_0x457dbb[_0x1b82('0x1b')]=qs['limit'](_0x2931d0['query'][_0x1b82('0x1b')]);_0x457dbb['offset']=qs[_0x1b82('0x1a')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x1a')]);}_0x457dbb[_0x1b82('0x3b')]=qs[_0x1b82('0x3c')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x3c')]);_0x457dbb[_0x1b82('0x3d')]=qs['filters'](_['pick'](_0x2931d0[_0x1b82('0x33')],_0x18e4ff['filters']),_0xd3c4a);if(_0x2931d0[_0x1b82('0x33')]['filter']){_0x457dbb[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x457dbb[_0x1b82('0x3d')],{'$or':_[_0x1b82('0x2c')](_0xd3c4a,function(_0x2af0bd){if(_0x2af0bd[_0x1b82('0x30')]!=='VIRTUAL'){var _0x17d214={};_0x17d214[_0x2af0bd['name']]={'$like':'%'+_0x2931d0[_0x1b82('0x33')]['filter']+'%'};return _0x17d214;}})});}_0x457dbb=_[_0x1b82('0x3e')]({},_0x457dbb,_0x2931d0['options']);var _0x5aeac1={'where':_0x457dbb[_0x1b82('0x3d')]};return db[_0x1b82('0x2d')][_0x1b82('0x1d')](_0x5aeac1)[_0x1b82('0x23')](function(_0x3eb429){_0x115ce7['count']=_0x3eb429;if(_0x2931d0[_0x1b82('0x33')]['includeAll']){_0x457dbb[_0x1b82('0x3f')]=[{'all':!![]}];}return db[_0x1b82('0x2d')][_0x1b82('0x40')](_0x457dbb);})[_0x1b82('0x23')](function(_0x365ab4){_0x115ce7['rows']=_0x365ab4;return _0x115ce7;})[_0x1b82('0x23')](respondWithFilteredResult(_0x155a34,_0x457dbb))['catch'](handleError(_0x155a34,null));};exports[_0x1b82('0x41')]=function(_0x14b3ab,_0x5a50ba){var _0xa88eb2={'raw':![],'where':{'id':_0x14b3ab[_0x1b82('0x42')]['id']}},_0x225f6b={};_0x225f6b[_0x1b82('0x32')]=_[_0x1b82('0x43')](db[_0x1b82('0x2d')][_0x1b82('0x2e')]);_0x225f6b['query']=_[_0x1b82('0x43')](_0x14b3ab['query']);_0x225f6b[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],_0x225f6b[_0x1b82('0x33')]);_0xa88eb2[_0x1b82('0x36')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],qs[_0x1b82('0x37')](_0x14b3ab[_0x1b82('0x33')][_0x1b82('0x37')]));_0xa88eb2[_0x1b82('0x36')]=_0xa88eb2[_0x1b82('0x36')][_0x1b82('0x38')]?_0xa88eb2[_0x1b82('0x36')]:_0x225f6b['model'];if(_0x14b3ab['query'][_0x1b82('0x44')]){_0xa88eb2['include']=[{'all':!![]}];}_0xa88eb2=_[_0x1b82('0x3e')]({},_0xa88eb2,_0x14b3ab[_0x1b82('0x45')]);return db[_0x1b82('0x2d')]['find'](_0xa88eb2)[_0x1b82('0x23')](handleEntityNotFound(_0x5a50ba,null))['then'](respondWithResult(_0x5a50ba,null))['catch'](handleError(_0x5a50ba,null));};exports[_0x1b82('0x46')]=function(_0x2aadf7,_0x242324){return db['VoiceChanSpy'][_0x1b82('0x46')](_0x2aadf7[_0x1b82('0x47')],{})['then'](function(_0x5ca898){var _0x106282=_0x2aadf7[_0x1b82('0x48')][_0x1b82('0x49')]({'plain':!![]});if(!_0x106282)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106282[_0x1b82('0x4a')]===_0x1b82('0x48')){var _0x31fb5d=_0x5ca898[_0x1b82('0x49')]({'plain':!![]});var _0xbba448=_0x1b82('0x4b');return db['UserProfileSection'][_0x1b82('0x4c')]({'where':{'name':_0xbba448,'userProfileId':_0x106282['userProfileId']},'raw':!![]})[_0x1b82('0x23')](function(_0x247cb7){if(_0x247cb7&&_0x247cb7['autoAssociation']===0x0){return db[_0x1b82('0x25')]['create']({'name':_0x31fb5d[_0x1b82('0x2a')],'resourceId':_0x31fb5d['id'],'type':_0x247cb7[_0x1b82('0x2a')],'sectionId':_0x247cb7['id']},{})[_0x1b82('0x23')](function(){return _0x5ca898;});}else{return _0x5ca898;}})[_0x1b82('0x4d')](function(_0xd46842){logger[_0x1b82('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd46842);throw _0xd46842;});}return _0x5ca898;})['then'](respondWithResult(_0x242324,0xc9))[_0x1b82('0x4d')](handleError(_0x242324,null));};exports[_0x1b82('0x4e')]=function(_0x1b9e81,_0x26c1ec){if(_0x1b9e81[_0x1b82('0x47')]['id']){delete _0x1b9e81[_0x1b82('0x47')]['id'];}return db[_0x1b82('0x2d')][_0x1b82('0x4c')]({'where':{'id':_0x1b9e81['params']['id']}})['then'](handleEntityNotFound(_0x26c1ec,null))['then'](saveUpdates(_0x1b9e81[_0x1b82('0x47')],null))[_0x1b82('0x23')](respondWithResult(_0x26c1ec,null))[_0x1b82('0x4d')](handleError(_0x26c1ec,null));};exports[_0x1b82('0x24')]=function(_0x1eb4a4,_0x15b0d3){return db[_0x1b82('0x2d')]['find']({'where':{'id':_0x1eb4a4[_0x1b82('0x42')]['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x15b0d3,null))[_0x1b82('0x23')](removeEntity(_0x15b0d3,null))[_0x1b82('0x4d')](handleError(_0x15b0d3,null));}; \ No newline at end of file +var _0x8b2b=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','sendStatus','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x491775,_0x405e35){var _0x595a96=function(_0x1803bb){while(--_0x1803bb){_0x491775['push'](_0x491775['shift']());}};_0x595a96(++_0x405e35);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x45b93d,_0x5e401f){_0x45b93d=_0x45b93d-0x0;var _0x2fa15b=_0x8b2b[_0x45b93d];return _0x2fa15b;};'use strict';var emlformat=require(_0xb8b2('0x0'));var rimraf=require(_0xb8b2('0x1'));var zipdir=require(_0xb8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b2('0x3'));var moment=require(_0xb8b2('0x4'));var BPromise=require(_0xb8b2('0x5'));var Mustache=require(_0xb8b2('0x6'));var util=require(_0xb8b2('0x7'));var path=require(_0xb8b2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb8b2('0x9'));var fs=require('fs');var fs_extra=require(_0xb8b2('0xa'));var _=require(_0xb8b2('0xb'));var squel=require(_0xb8b2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8b2('0xd'));var toCsv=require(_0xb8b2('0xe'));var querystring=require(_0xb8b2('0xf'));var Papa=require(_0xb8b2('0x10'));var Redis=require(_0xb8b2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb8b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b2('0x13'))(_0xb8b2('0x14'));var utils=require(_0xb8b2('0x15'));var config=require(_0xb8b2('0x16'));var licenseUtil=require(_0xb8b2('0x17'));var db=require(_0xb8b2('0x18'))['db'];function respondWithStatusCode(_0x584d41,_0x3440bf){_0x3440bf=_0x3440bf||0xcc;return function(_0x5bd724){if(_0x5bd724){return _0x584d41['sendStatus'](_0x3440bf);}return _0x584d41['status'](_0x3440bf)[_0xb8b2('0x19')]();};}function respondWithResult(_0xdc1d1d,_0x48b9df){_0x48b9df=_0x48b9df||0xc8;return function(_0x175885){if(_0x175885){return _0xdc1d1d[_0xb8b2('0x1a')](_0x48b9df)[_0xb8b2('0x1b')](_0x175885);}};}function respondWithFilteredResult(_0x142fb0,_0x46a592){return function(_0x5b614d){if(_0x5b614d){var _0x4b5a28=typeof _0x46a592[_0xb8b2('0x1c')]===_0xb8b2('0x1d')&&typeof _0x46a592[_0xb8b2('0x1e')]===_0xb8b2('0x1d');var _0xf04672=_0x5b614d['count'];var _0x47b94f=_0x4b5a28?0x0:_0x46a592[_0xb8b2('0x1c')];var _0x153b69=_0x4b5a28?_0x5b614d[_0xb8b2('0x1f')]:_0x46a592[_0xb8b2('0x1c')]+_0x46a592['limit'];var _0x23af66;if(_0x153b69>=_0xf04672){_0x153b69=_0xf04672;_0x23af66=0xc8;}else{_0x23af66=0xce;}_0x142fb0[_0xb8b2('0x1a')](_0x23af66);return _0x142fb0[_0xb8b2('0x20')](_0xb8b2('0x21'),_0x47b94f+'-'+_0x153b69+'/'+_0xf04672)[_0xb8b2('0x1b')](_0x5b614d);}return null;};}function patchUpdates(_0x1cbc65){return function(_0x34ca46){try{jsonpatch['apply'](_0x34ca46,_0x1cbc65,!![]);}catch(_0x382bbf){return BPromise[_0xb8b2('0x22')](_0x382bbf);}return _0x34ca46[_0xb8b2('0x23')]();};}function saveUpdates(_0x162d41,_0x316d3c){return function(_0x5a0a43){if(_0x5a0a43){return _0x5a0a43[_0xb8b2('0x24')](_0x162d41)['then'](function(_0xe3b28){return _0xe3b28;});}return null;};}function removeEntity(_0x8239a7,_0x2b40f8){return function(_0x20082f){if(_0x20082f){return _0x20082f['destroy']()[_0xb8b2('0x25')](function(){var _0x2502ae=_0x20082f[_0xb8b2('0x26')]({'plain':!![]});var _0x5a2afe='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x5a2afe,'resourceId':_0x2502ae['id']}})[_0xb8b2('0x25')](function(){return _0x20082f;});})[_0xb8b2('0x25')](function(){_0x8239a7[_0xb8b2('0x1a')](0xcc)[_0xb8b2('0x19')]();});}};}function handleEntityNotFound(_0x14ba5c,_0x2026db){return function(_0x3f3424){if(!_0x3f3424){_0x14ba5c[_0xb8b2('0x27')](0x194);}return _0x3f3424;};}function handleError(_0xf5f561,_0x2bf940){_0x2bf940=_0x2bf940||0x1f4;return function(_0x2a236d){logger[_0xb8b2('0x28')](_0x2a236d[_0xb8b2('0x29')]);if(_0x2a236d[_0xb8b2('0x2a')]){delete _0x2a236d[_0xb8b2('0x2a')];}_0xf5f561[_0xb8b2('0x1a')](_0x2bf940)[_0xb8b2('0x2b')](_0x2a236d);};}exports['index']=function(_0x37ea31,_0x1899d9){var _0x42b97f={},_0x394359={},_0x21b008={'count':0x0,'rows':[]};var _0x493c16=_[_0xb8b2('0x2c')](db[_0xb8b2('0x2d')][_0xb8b2('0x2e')],function(_0x52d2e9){return{'name':_0x52d2e9[_0xb8b2('0x2f')],'type':_0x52d2e9[_0xb8b2('0x30')]['key']};});_0x394359[_0xb8b2('0x31')]=_[_0xb8b2('0x2c')](_0x493c16,_0xb8b2('0x2a'));_0x394359[_0xb8b2('0x32')]=_[_0xb8b2('0x33')](_0x37ea31[_0xb8b2('0x32')]);_0x394359[_0xb8b2('0x34')]=_[_0xb8b2('0x35')](_0x394359[_0xb8b2('0x31')],_0x394359[_0xb8b2('0x32')]);_0x42b97f['attributes']=_[_0xb8b2('0x35')](_0x394359[_0xb8b2('0x31')],qs['fields'](_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x36')]));_0x42b97f[_0xb8b2('0x37')]=_0x42b97f[_0xb8b2('0x37')][_0xb8b2('0x38')]?_0x42b97f[_0xb8b2('0x37')]:_0x394359[_0xb8b2('0x31')];if(!_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x39')](_0xb8b2('0x3a'))){_0x42b97f[_0xb8b2('0x1e')]=qs[_0xb8b2('0x1e')](_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x1e')]);_0x42b97f[_0xb8b2('0x1c')]=qs[_0xb8b2('0x1c')](_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x1c')]);}_0x42b97f[_0xb8b2('0x3b')]=qs[_0xb8b2('0x3c')](_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x3c')]);_0x42b97f[_0xb8b2('0x3d')]=qs[_0xb8b2('0x34')](_[_0xb8b2('0x3e')](_0x37ea31[_0xb8b2('0x32')],_0x394359[_0xb8b2('0x34')]),_0x493c16);if(_0x37ea31['query']['filter']){_0x42b97f[_0xb8b2('0x3d')]=_['merge'](_0x42b97f[_0xb8b2('0x3d')],{'$or':_[_0xb8b2('0x2c')](_0x493c16,function(_0x30c686){if(_0x30c686[_0xb8b2('0x30')]!=='VIRTUAL'){var _0x517473={};_0x517473[_0x30c686[_0xb8b2('0x2a')]]={'$like':'%'+_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x3f')]+'%'};return _0x517473;}})});}_0x42b97f=_[_0xb8b2('0x40')]({},_0x42b97f,_0x37ea31[_0xb8b2('0x41')]);var _0x4fa963={'where':_0x42b97f[_0xb8b2('0x3d')]};return db[_0xb8b2('0x2d')][_0xb8b2('0x1f')](_0x4fa963)[_0xb8b2('0x25')](function(_0x283eb5){_0x21b008['count']=_0x283eb5;if(_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x42')]){_0x42b97f[_0xb8b2('0x43')]=[{'all':!![]}];}return db[_0xb8b2('0x2d')][_0xb8b2('0x44')](_0x42b97f);})[_0xb8b2('0x25')](function(_0x37370a){_0x21b008[_0xb8b2('0x45')]=_0x37370a;return _0x21b008;})[_0xb8b2('0x25')](respondWithFilteredResult(_0x1899d9,_0x42b97f))[_0xb8b2('0x46')](handleError(_0x1899d9,null));};exports['show']=function(_0x486d4b,_0x419e3e){var _0x51756b={'raw':![],'where':{'id':_0x486d4b[_0xb8b2('0x47')]['id']}},_0x4651e2={};_0x4651e2[_0xb8b2('0x31')]=_[_0xb8b2('0x33')](db[_0xb8b2('0x2d')]['rawAttributes']);_0x4651e2[_0xb8b2('0x32')]=_[_0xb8b2('0x33')](_0x486d4b[_0xb8b2('0x32')]);_0x4651e2[_0xb8b2('0x34')]=_[_0xb8b2('0x35')](_0x4651e2[_0xb8b2('0x31')],_0x4651e2[_0xb8b2('0x32')]);_0x51756b[_0xb8b2('0x37')]=_[_0xb8b2('0x35')](_0x4651e2[_0xb8b2('0x31')],qs[_0xb8b2('0x36')](_0x486d4b['query'][_0xb8b2('0x36')]));_0x51756b[_0xb8b2('0x37')]=_0x51756b[_0xb8b2('0x37')][_0xb8b2('0x38')]?_0x51756b[_0xb8b2('0x37')]:_0x4651e2[_0xb8b2('0x31')];if(_0x486d4b[_0xb8b2('0x32')][_0xb8b2('0x42')]){_0x51756b[_0xb8b2('0x43')]=[{'all':!![]}];}_0x51756b=_[_0xb8b2('0x40')]({},_0x51756b,_0x486d4b[_0xb8b2('0x41')]);return db[_0xb8b2('0x2d')][_0xb8b2('0x48')](_0x51756b)['then'](handleEntityNotFound(_0x419e3e,null))[_0xb8b2('0x25')](respondWithResult(_0x419e3e,null))[_0xb8b2('0x46')](handleError(_0x419e3e,null));};exports['create']=function(_0x35b691,_0x2b9c9a){return db[_0xb8b2('0x2d')]['create'](_0x35b691[_0xb8b2('0x49')],{})[_0xb8b2('0x25')](function(_0x1f106a){var _0x2d0ed5=_0x35b691[_0xb8b2('0x4a')][_0xb8b2('0x26')]({'plain':!![]});if(!_0x2d0ed5)throw new Error(_0xb8b2('0x4b'));if(_0x2d0ed5[_0xb8b2('0x4c')]===_0xb8b2('0x4a')){var _0x3397b0=_0x1f106a[_0xb8b2('0x26')]({'plain':!![]});var _0x4434b3=_0xb8b2('0x4d');return db[_0xb8b2('0x4e')][_0xb8b2('0x48')]({'where':{'name':_0x4434b3,'userProfileId':_0x2d0ed5['userProfileId']},'raw':!![]})['then'](function(_0x46ab13){if(_0x46ab13&&_0x46ab13[_0xb8b2('0x4f')]===0x0){return db[_0xb8b2('0x50')][_0xb8b2('0x51')]({'name':_0x3397b0[_0xb8b2('0x2a')],'resourceId':_0x3397b0['id'],'type':_0x46ab13[_0xb8b2('0x2a')],'sectionId':_0x46ab13['id']},{})['then'](function(){return _0x1f106a;});}else{return _0x1f106a;}})[_0xb8b2('0x46')](function(_0x3a07b5){logger[_0xb8b2('0x28')](_0xb8b2('0x52'),_0x3a07b5);throw _0x3a07b5;});}return _0x1f106a;})[_0xb8b2('0x25')](respondWithResult(_0x2b9c9a,0xc9))[_0xb8b2('0x46')](handleError(_0x2b9c9a,null));};exports[_0xb8b2('0x24')]=function(_0x25ad26,_0x567892){if(_0x25ad26[_0xb8b2('0x49')]['id']){delete _0x25ad26['body']['id'];}return db[_0xb8b2('0x2d')][_0xb8b2('0x48')]({'where':{'id':_0x25ad26[_0xb8b2('0x47')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x567892,null))[_0xb8b2('0x25')](saveUpdates(_0x25ad26[_0xb8b2('0x49')],null))[_0xb8b2('0x25')](respondWithResult(_0x567892,null))['catch'](handleError(_0x567892,null));};exports[_0xb8b2('0x53')]=function(_0xf450d7,_0x1ad5d4){return db[_0xb8b2('0x2d')][_0xb8b2('0x48')]({'where':{'id':_0xf450d7['params']['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x1ad5d4,null))['then'](removeEntity(_0x1ad5d4,null))['catch'](handleError(_0x1ad5d4,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 3268a79..a407516 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 _0x83ee=['VoiceExtension','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','Set','format','CDR(type)=%s','chanspy','merge','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length','concat','User','findAll','agent','catch','define','voice_chanspy','bulkCreate','then'];(function(_0x16aae9,_0x11031a){var _0x412d60=function(_0x78681){while(--_0x78681){_0x16aae9['push'](_0x16aae9['shift']());}};_0x412d60(++_0x11031a);}(_0x83ee,0xb6));var _0xe83e=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x83ee[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require('lodash');var util=require(_0xe83e('0x0'));var BPromise=require(_0xe83e('0x1'));var attributes=require(_0xe83e('0x2'));var getUserApplications=function(_0x1f83b0,_0xdb5b27,_0x2005e7){var _0x39d91a=0x1;var _0x451bb1=[];var _0x337d8e={'context':_0xdb5b27[_0xe83e('0x3')]||_0xe83e('0x4'),'exten':util['format'](_0xe83e('0x5'),_0x1f83b0[_0xe83e('0x6')],_0x2005e7),'type':_0xe83e('0x7'),'isApp':![],'ChanSpyId':_0x1f83b0['id'],'UserId':_0xdb5b27['id']};_0x451bb1[_0xe83e('0x8')](_['merge']({'app':_0xe83e('0x9'),'appdata':util[_0xe83e('0xa')](_0xe83e('0xb'),_0xe83e('0xc')),'priority':_0x39d91a++},_0x337d8e));if(_0x1f83b0['record']){_0x451bb1[_0xe83e('0x8')](_[_0xe83e('0xd')]({'app':'MixMonitor','appdata':util[_0xe83e('0xa')](_0xe83e('0xe'),_0x1f83b0[_0xe83e('0xf')]),'priority':_0x39d91a++},_0x337d8e));}if(_0x1f83b0[_0xe83e('0x10')]){_0x451bb1[_0xe83e('0x8')](_[_0xe83e('0xd')]({'app':_0xe83e('0x11'),'appdata':_0x1f83b0[_0xe83e('0x12')],'priority':_0x39d91a++},_0x337d8e));}_0x451bb1[_0xe83e('0x8')](_[_0xe83e('0xd')]({'app':_0xe83e('0x13'),'appdata':util[_0xe83e('0xa')]('SIP/%s,%s',_0xdb5b27[_0xe83e('0x14')],_0x1f83b0[_0xe83e('0x15')]?_0x1f83b0['options'][_0xe83e('0x16')](''):''),'priority':_0x39d91a++},_0x337d8e));if(_0x1f83b0['record']){_0x451bb1[_0xe83e('0x8')](_['merge']({'app':_0xe83e('0x17'),'priority':_0x39d91a++},_0x337d8e));}return _0x451bb1;};var getChanSpyApplications=function(_0x53814d,_0x374acf){var _0xa7899a=[];for(var _0x3561f6=0x0,_0x1b5cc0=0x1;_0x3561f6<_0x374acf[_0xe83e('0x18')];_0x3561f6++,_0x1b5cc0=0x1){_0xa7899a=_0xa7899a['concat'](getUserApplications(_0x53814d,_0x374acf[_0x3561f6],_0x374acf[_0x3561f6]['internal']));if(_0x374acf[_0x3561f6]['internal']!=_0x374acf[_0x3561f6]['name']){_0xa7899a=_0xa7899a[_0xe83e('0x19')](getUserApplications(_0x53814d,_0x374acf[_0x3561f6],_0x374acf[_0x3561f6]['name']));}}return _0xa7899a;};var getChanSpyPromise=function(_0x3a7cd3,_0x31c84f){return new BPromise(function(_0x389202,_0x3be8ae){return _0x3a7cd3[_0xe83e('0x1a')][_0xe83e('0x1b')]({'attributes':['id',_0xe83e('0x14'),'internal'],'where':{'role':_0xe83e('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2b917a){if(_0x2b917a){return _0x389202(getChanSpyApplications(_0x31c84f,_0x2b917a));}return _0x389202([]);})[_0xe83e('0x1d')](function(_0x5b055b){_0x3be8ae(_0x5b055b);});});};module['exports']=function(_0x74a30a,_0x10c68c){var _0x14e8af=_0x74a30a['models'];return _0x74a30a[_0xe83e('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0xe83e('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d3063,_0x11dfc8,_0x3baf63){return getChanSpyPromise(_0x14e8af,_0x3d3063)['then'](function(_0x340b1e){if(_0x340b1e&&_0x340b1e[_0xe83e('0x18')]){return _0x14e8af['VoiceExtension'][_0xe83e('0x20')](_0x340b1e);}})[_0xe83e('0x21')](function(){_0x3baf63();})[_0xe83e('0x1d')](function(_0x1ddefc){_0x3baf63(_0x1ddefc);});},'afterUpdate':function(_0x311a34,_0xb0d900,_0x5df910){return _0x14e8af[_0xe83e('0x22')][_0xe83e('0x23')]({'where':{'ChanSpyId':_0x311a34['id']}})[_0xe83e('0x21')](function(){return getChanSpyPromise(_0x14e8af,_0x311a34);})['then'](function(_0x2d4822){if(_0x2d4822&&_0x2d4822[_0xe83e('0x18')]){return _0x14e8af[_0xe83e('0x22')][_0xe83e('0x20')](_0x2d4822);}})[_0xe83e('0x21')](function(){_0x5df910();})[_0xe83e('0x1d')](function(_0x226dbf){_0x5df910(_0x226dbf);});},'afterDestroy':function(_0x10348d,_0x119001,_0x1d11ea){return _0x14e8af[_0xe83e('0x22')][_0xe83e('0x23')]({'where':{'ChanSpyId':_0x10348d['id']}})[_0xe83e('0x21')](function(){_0x1d11ea();})[_0xe83e('0x1d')](function(_0x5edf9f){_0x1d11ea(_0x5edf9f);});}}});}; \ No newline at end of file +var _0x6026=['options','join','StopMixMonitor','length','concat','findAll','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','merge','Set','format','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','password','push','ChanSpy','SIP/%s,%s','name'];(function(_0x551223,_0x4c84ed){var _0x12cf16=function(_0x2fe771){while(--_0x2fe771){_0x551223['push'](_0x551223['shift']());}};_0x12cf16(++_0x4c84ed);}(_0x6026,0x7e));var _0x6602=function(_0x4956d2,_0x12cf69){_0x4956d2=_0x4956d2-0x0;var _0x27d60c=_0x6026[_0x4956d2];return _0x27d60c;};'use strict';var _=require(_0x6602('0x0'));var util=require('util');var BPromise=require(_0x6602('0x1'));var attributes=require(_0x6602('0x2'));var getUserApplications=function(_0xc7a631,_0x1f72c6,_0x2d29e9){var _0x29afed=0x1;var _0x32a2ce=[];var _0x53ceb0={'context':_0x1f72c6[_0x6602('0x3')]||_0x6602('0x4'),'exten':util['format'](_0x6602('0x5'),_0xc7a631[_0x6602('0x6')],_0x2d29e9),'type':_0x6602('0x7'),'isApp':![],'ChanSpyId':_0xc7a631['id'],'UserId':_0x1f72c6['id']};_0x32a2ce['push'](_[_0x6602('0x8')]({'app':_0x6602('0x9'),'appdata':util[_0x6602('0xa')](_0x6602('0xb'),_0x6602('0xc')),'priority':_0x29afed++},_0x53ceb0));if(_0xc7a631[_0x6602('0xd')]){_0x32a2ce['push'](_['merge']({'app':'MixMonitor','appdata':util['format'](_0x6602('0xe'),_0xc7a631[_0x6602('0xf')]),'priority':_0x29afed++},_0x53ceb0));}if(_0xc7a631[_0x6602('0x10')]){_0x32a2ce['push'](_[_0x6602('0x8')]({'app':'Authenticate','appdata':_0xc7a631[_0x6602('0x11')],'priority':_0x29afed++},_0x53ceb0));}_0x32a2ce[_0x6602('0x12')](_['merge']({'app':_0x6602('0x13'),'appdata':util[_0x6602('0xa')](_0x6602('0x14'),_0x1f72c6[_0x6602('0x15')],_0xc7a631[_0x6602('0x16')]?_0xc7a631[_0x6602('0x16')][_0x6602('0x17')](''):''),'priority':_0x29afed++},_0x53ceb0));if(_0xc7a631[_0x6602('0xd')]){_0x32a2ce[_0x6602('0x12')](_['merge']({'app':_0x6602('0x18'),'priority':_0x29afed++},_0x53ceb0));}return _0x32a2ce;};var getChanSpyApplications=function(_0x2a2ce8,_0x349565){var _0x286442=[];for(var _0xc3e0dc=0x0,_0x30b217=0x1;_0xc3e0dc<_0x349565[_0x6602('0x19')];_0xc3e0dc++,_0x30b217=0x1){_0x286442=_0x286442['concat'](getUserApplications(_0x2a2ce8,_0x349565[_0xc3e0dc],_0x349565[_0xc3e0dc]['internal']));if(_0x349565[_0xc3e0dc]['internal']!=_0x349565[_0xc3e0dc][_0x6602('0x15')]){_0x286442=_0x286442[_0x6602('0x1a')](getUserApplications(_0x2a2ce8,_0x349565[_0xc3e0dc],_0x349565[_0xc3e0dc][_0x6602('0x15')]));}}return _0x286442;};var getChanSpyPromise=function(_0x359750,_0x39516f){return new BPromise(function(_0x5cf47e,_0x1348e7){return _0x359750['User'][_0x6602('0x1b')]({'attributes':['id','name','internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x6602('0x1c')](function(_0x77e714){if(_0x77e714){return _0x5cf47e(getChanSpyApplications(_0x39516f,_0x77e714));}return _0x5cf47e([]);})[_0x6602('0x1d')](function(_0x577777){_0x1348e7(_0x577777);});});};module[_0x6602('0x1e')]=function(_0x16b96f,_0x28cceb){var _0x29c187=_0x16b96f['models'];return _0x16b96f[_0x6602('0x1f')](_0x6602('0x20'),attributes,{'tableName':_0x6602('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x53634d,_0x3e27fb,_0x113c57){return getChanSpyPromise(_0x29c187,_0x53634d)[_0x6602('0x1c')](function(_0x4857ba){if(_0x4857ba&&_0x4857ba[_0x6602('0x19')]){return _0x29c187[_0x6602('0x22')]['bulkCreate'](_0x4857ba);}})['then'](function(){_0x113c57();})[_0x6602('0x1d')](function(_0x57624d){_0x113c57(_0x57624d);});},'afterUpdate':function(_0x55425e,_0x431b7b,_0x4e17ea){return _0x29c187['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x55425e['id']}})[_0x6602('0x1c')](function(){return getChanSpyPromise(_0x29c187,_0x55425e);})[_0x6602('0x1c')](function(_0xd30d6d){if(_0xd30d6d&&_0xd30d6d[_0x6602('0x19')]){return _0x29c187[_0x6602('0x22')][_0x6602('0x23')](_0xd30d6d);}})['then'](function(){_0x4e17ea();})[_0x6602('0x1d')](function(_0x1f1b95){_0x4e17ea(_0x1f1b95);});},'afterDestroy':function(_0x3f8003,_0x1cbeea,_0x494b18){return _0x29c187[_0x6602('0x22')][_0x6602('0x24')]({'where':{'ChanSpyId':_0x3f8003['id']}})[_0x6602('0x1c')](function(){_0x494b18();})[_0x6602('0x1d')](function(_0x3f3604){_0x494b18(_0x3f3604);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 04fac4a..e4eef5e 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 _0x4ded=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x4ded,0x116));var _0xd4de=function(_0x2823a4,_0x390cb9){_0x2823a4=_0x2823a4-0x0;var _0x15e91f=_0x4ded[_0x2823a4];return _0x15e91f;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});} \ No newline at end of file +var _0xa45c=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x51489,_0x3e95a4){var _0x3ead23=function(_0x3c6efe){while(--_0x3c6efe){_0x51489['push'](_0x51489['shift']());}};_0x3ead23(++_0x3e95a4);}(_0xa45c,0x6d));var _0xca45=function(_0x39d153,_0x33e821){_0x39d153=_0x39d153-0x0;var _0x1caef4=_0xa45c[_0x39d153];return _0x1caef4;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index a2522e5..b4229d4 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 _0x2442=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2442,0x15f));var _0x2244=function(_0x2da1f9,_0x5e4269){_0x2da1f9=_0x2da1f9-0x0;var _0x22ef92=_0x2442[_0x2da1f9];return _0x22ef92;};'use strict';var multer=require(_0x2244('0x0'));var util=require(_0x2244('0x1'));var path=require(_0x2244('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2244('0x3')]();var fs_extra=require(_0x2244('0x4'));var auth=require(_0x2244('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2244('0x6'));var controller=require(_0x2244('0x7'));router[_0x2244('0x8')]('/',auth[_0x2244('0x9')](),controller[_0x2244('0xa')]);router[_0x2244('0x8')](_0x2244('0xb'),auth[_0x2244('0x9')](),controller[_0x2244('0xc')]);router['post']('/',auth[_0x2244('0x9')](),controller[_0x2244('0xd')]);router[_0x2244('0xe')](_0x2244('0xb'),auth[_0x2244('0x9')](),controller[_0x2244('0xf')]);router[_0x2244('0x10')](_0x2244('0xb'),auth[_0x2244('0x9')](),controller[_0x2244('0x11')]);module[_0x2244('0x12')]=router; \ No newline at end of file +var _0x3984=['exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0xa65bc3,_0x2bd50c){var _0x1ab82c=function(_0x4dc6a4){while(--_0x4dc6a4){_0xa65bc3['push'](_0xa65bc3['shift']());}};_0x1ab82c(++_0x2bd50c);}(_0x3984,0xc7));var _0x4398=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0x3984[_0x51c52b];return _0x581ce3;};'use strict';var multer=require(_0x4398('0x0'));var util=require(_0x4398('0x1'));var path=require(_0x4398('0x2'));var timeout=require(_0x4398('0x3'));var express=require(_0x4398('0x4'));var router=express['Router']();var fs_extra=require(_0x4398('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4398('0x6'));var controller=require(_0x4398('0x7'));router[_0x4398('0x8')]('/',auth[_0x4398('0x9')](),controller[_0x4398('0xa')]);router[_0x4398('0x8')](_0x4398('0xb'),auth[_0x4398('0x9')](),controller[_0x4398('0xc')]);router[_0x4398('0xd')]('/',auth['isAuthenticated'](),controller[_0x4398('0xe')]);router['put'](_0x4398('0xb'),auth['isAuthenticated'](),controller[_0x4398('0xf')]);router[_0x4398('0x10')](_0x4398('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4398('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 4360b33..4cc0428 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 _0xc632=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x45fd89,_0x388a7d){var _0x16787f=function(_0x3f515f){while(--_0x3f515f){_0x45fd89['push'](_0x45fd89['shift']());}};_0x16787f(++_0x388a7d);}(_0xc632,0xf0));var _0x2c63=function(_0x2cfb20,_0x53cb5){_0x2cfb20=_0x2cfb20-0x0;var _0x2c7af9=_0xc632[_0x2cfb20];return _0x2c7af9;};'use strict';var Sequelize=require(_0x2c63('0x0'));module[_0x2c63('0x1')]={'name':{'type':Sequelize[_0x2c63('0x2')],'unique':_0x2c63('0x3')},'description':{'type':Sequelize[_0x2c63('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2c63('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0948=['STRING','BOOLEAN','sequelize','exports','name'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0x0948,0x129));var _0x8094=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x0948[_0x5d6270];return _0x168f26;};'use strict';var Sequelize=require(_0x8094('0x0'));module[_0x8094('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8094('0x2')},'description':{'type':Sequelize[_0x8094('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8094('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index ff00ae6..0ba9dba 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 _0x488a=['bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3e81d9,_0x488e01){var _0x311823=function(_0x3785fd){while(--_0x3785fd){_0x3e81d9['push'](_0x3e81d9['shift']());}};_0x311823(++_0x488e01);}(_0x488a,0x64));var _0xa488=function(_0x18e640,_0x554827){_0x18e640=_0x18e640-0x0;var _0x3a8e5f=_0x488a[_0x18e640];return _0x3a8e5f;};'use strict';var emlformat=require(_0xa488('0x0'));var rimraf=require(_0xa488('0x1'));var zipdir=require(_0xa488('0x2'));var jsonpatch=require(_0xa488('0x3'));var rp=require(_0xa488('0x4'));var moment=require(_0xa488('0x5'));var BPromise=require(_0xa488('0x6'));var Mustache=require('mustache');var util=require(_0xa488('0x7'));var path=require(_0xa488('0x8'));var sox=require(_0xa488('0x9'));var csv=require(_0xa488('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa488('0xb'));var _=require('lodash');var squel=require(_0xa488('0xc'));var crypto=require(_0xa488('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa488('0xe'));var toCsv=require(_0xa488('0xa'));var querystring=require(_0xa488('0xf'));var Papa=require(_0xa488('0x10'));var Redis=require(_0xa488('0x11'));var authService=require(_0xa488('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa488('0x13'));var logger=require(_0xa488('0x14'))(_0xa488('0x15'));var utils=require(_0xa488('0x16'));var config=require(_0xa488('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa488('0x18'))['db'];var jayson=require(_0xa488('0x19'));var client=jayson[_0xa488('0x1a')][_0xa488('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5867a7,_0xe82e97,_0xac260a,_0x4b976b){return new BPromise(function(_0x469aba,_0x5f9b96){var _0x4dea76=_0x4b976b||client;return _0x4dea76[_0xa488('0x1c')](_0x5867a7,_0xac260a)[_0xa488('0x1d')](function(_0x3c5d35){logger['info'](_0xa488('0x1e'),_0xe82e97,_0xa488('0x1f'));logger[_0xa488('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xe82e97,'request\x20sent',JSON['stringify'](_0x3c5d35));if(_0x3c5d35[_0xa488('0x21')]){if(_0x3c5d35['error']['code']===0x1f4){logger['error'](_0xa488('0x1e'),_0xe82e97,_0x3c5d35['error'][_0xa488('0x22')]);return _0x5f9b96(_0x3c5d35[_0xa488('0x21')][_0xa488('0x22')]);}logger[_0xa488('0x21')](_0xa488('0x1e'),_0xe82e97,_0x3c5d35[_0xa488('0x21')][_0xa488('0x22')]);return _0x469aba(_0x3c5d35[_0xa488('0x21')]['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0xe82e97,_0xa488('0x1f'));_0x469aba(_0x3c5d35[_0xa488('0x23')][_0xa488('0x22')]);}})[_0xa488('0x24')](function(_0x1024d2){logger[_0xa488('0x21')]('VoiceContext,\x20%s,\x20%s',_0xe82e97,_0x1024d2);_0x5f9b96(_0x1024d2);});});}function respondWithStatusCode(_0x9c1019,_0xc9e248){_0xc9e248=_0xc9e248||0xcc;return function(_0x572091){if(_0x572091){return _0x9c1019[_0xa488('0x25')](_0xc9e248);}return _0x9c1019['status'](_0xc9e248)[_0xa488('0x26')]();};}function respondWithResult(_0x475d83,_0x11d9d0){_0x11d9d0=_0x11d9d0||0xc8;return function(_0x102e43){if(_0x102e43){return _0x475d83[_0xa488('0x27')](_0x11d9d0)[_0xa488('0x28')](_0x102e43);}};}function respondWithFilteredResult(_0xb6c6ea,_0x4e2e93){return function(_0x49a3b4){if(_0x49a3b4){var _0xd7ec75=typeof _0x4e2e93[_0xa488('0x29')]===_0xa488('0x2a')&&typeof _0x4e2e93[_0xa488('0x2b')]==='undefined';var _0x27aee7=_0x49a3b4[_0xa488('0x2c')];var _0x2791b8=_0xd7ec75?0x0:_0x4e2e93['offset'];var _0x8a356a=_0xd7ec75?_0x49a3b4[_0xa488('0x2c')]:_0x4e2e93[_0xa488('0x29')]+_0x4e2e93['limit'];var _0x3b086b;if(_0x8a356a>=_0x27aee7){_0x8a356a=_0x27aee7;_0x3b086b=0xc8;}else{_0x3b086b=0xce;}_0xb6c6ea[_0xa488('0x27')](_0x3b086b);return _0xb6c6ea[_0xa488('0x2d')](_0xa488('0x2e'),_0x2791b8+'-'+_0x8a356a+'/'+_0x27aee7)[_0xa488('0x28')](_0x49a3b4);}return null;};}function patchUpdates(_0x749f29){return function(_0x55548f){try{jsonpatch[_0xa488('0x2f')](_0x55548f,_0x749f29,!![]);}catch(_0x5c664f){return BPromise[_0xa488('0x30')](_0x5c664f);}return _0x55548f[_0xa488('0x31')]();};}function saveUpdates(_0x39b384,_0x2cfcb6){return function(_0x58a588){if(_0x58a588){return _0x58a588[_0xa488('0x32')](_0x39b384)['then'](function(_0x3d6641){return _0x3d6641;});}return null;};}function removeEntity(_0x42b5e0,_0x42995a){return function(_0x1701d2){if(_0x1701d2){return _0x1701d2[_0xa488('0x33')]()[_0xa488('0x1d')](function(){var _0x3c90e9=_0x1701d2[_0xa488('0x34')]({'plain':!![]});var _0x72b4f9=_0xa488('0x35');return db[_0xa488('0x36')][_0xa488('0x33')]({'where':{'type':_0x72b4f9,'resourceId':_0x3c90e9['id']}})[_0xa488('0x1d')](function(){return _0x1701d2;});})[_0xa488('0x1d')](function(){_0x42b5e0[_0xa488('0x27')](0xcc)[_0xa488('0x26')]();});}};}function handleEntityNotFound(_0x46a84e,_0x13f598){return function(_0x17f56f){if(!_0x17f56f){_0x46a84e[_0xa488('0x25')](0x194);}return _0x17f56f;};}function handleError(_0x8fd889,_0x2a2360){_0x2a2360=_0x2a2360||0x1f4;return function(_0x12daea){logger['error'](_0x12daea[_0xa488('0x37')]);if(_0x12daea[_0xa488('0x38')]){delete _0x12daea[_0xa488('0x38')];}_0x8fd889[_0xa488('0x27')](_0x2a2360)[_0xa488('0x39')](_0x12daea);};}exports[_0xa488('0x3a')]=function(_0x415758,_0x2d2bd5){var _0x556e79={},_0x1286db={},_0x2385f0={'count':0x0,'rows':[]};var _0x4cf120=_['map'](db[_0xa488('0x3b')][_0xa488('0x3c')],function(_0x4ea484){return{'name':_0x4ea484['fieldName'],'type':_0x4ea484[_0xa488('0x3d')]['key']};});_0x1286db[_0xa488('0x3e')]=_[_0xa488('0x3f')](_0x4cf120,_0xa488('0x38'));_0x1286db[_0xa488('0x40')]=_[_0xa488('0x41')](_0x415758['query']);_0x1286db[_0xa488('0x42')]=_[_0xa488('0x43')](_0x1286db[_0xa488('0x3e')],_0x1286db['query']);_0x556e79[_0xa488('0x44')]=_[_0xa488('0x43')](_0x1286db[_0xa488('0x3e')],qs[_0xa488('0x45')](_0x415758[_0xa488('0x40')]['fields']));_0x556e79[_0xa488('0x44')]=_0x556e79[_0xa488('0x44')][_0xa488('0x46')]?_0x556e79['attributes']:_0x1286db[_0xa488('0x3e')];if(!_0x415758[_0xa488('0x40')][_0xa488('0x47')](_0xa488('0x48'))){_0x556e79[_0xa488('0x2b')]=qs['limit'](_0x415758[_0xa488('0x40')][_0xa488('0x2b')]);_0x556e79[_0xa488('0x29')]=qs[_0xa488('0x29')](_0x415758[_0xa488('0x40')]['offset']);}_0x556e79[_0xa488('0x49')]=qs[_0xa488('0x4a')](_0x415758[_0xa488('0x40')][_0xa488('0x4a')]);_0x556e79[_0xa488('0x4b')]=qs[_0xa488('0x42')](_[_0xa488('0x4c')](_0x415758[_0xa488('0x40')],_0x1286db['filters']),_0x4cf120);if(_0x415758['query']['filter']){_0x556e79['where']=_[_0xa488('0x4d')](_0x556e79[_0xa488('0x4b')],{'$or':_[_0xa488('0x3f')](_0x4cf120,function(_0x3c8517){if(_0x3c8517[_0xa488('0x3d')]!==_0xa488('0x4e')){var _0x14490e={};_0x14490e[_0x3c8517[_0xa488('0x38')]]={'$like':'%'+_0x415758[_0xa488('0x40')]['filter']+'%'};return _0x14490e;}})});}_0x556e79=_[_0xa488('0x4d')]({},_0x556e79,_0x415758['options']);var _0x4afeca={'where':_0x556e79[_0xa488('0x4b')]};return db[_0xa488('0x3b')][_0xa488('0x2c')](_0x4afeca)[_0xa488('0x1d')](function(_0x733511){_0x2385f0[_0xa488('0x2c')]=_0x733511;if(_0x415758[_0xa488('0x40')][_0xa488('0x4f')]){_0x556e79[_0xa488('0x50')]=[{'all':!![]}];}return db[_0xa488('0x3b')][_0xa488('0x51')](_0x556e79);})['then'](function(_0x2df18c){_0x2385f0[_0xa488('0x52')]=_0x2df18c;return _0x2385f0;})['then'](respondWithFilteredResult(_0x2d2bd5,_0x556e79))[_0xa488('0x24')](handleError(_0x2d2bd5,null));};exports[_0xa488('0x53')]=function(_0x4c0e28,_0x4f40db){var _0x4b67c8={'raw':![],'where':{'id':_0x4c0e28[_0xa488('0x54')]['id']}},_0x4bb3fb={};_0x4bb3fb[_0xa488('0x3e')]=_[_0xa488('0x41')](db[_0xa488('0x3b')]['rawAttributes']);_0x4bb3fb['query']=_[_0xa488('0x41')](_0x4c0e28[_0xa488('0x40')]);_0x4bb3fb[_0xa488('0x42')]=_['intersection'](_0x4bb3fb[_0xa488('0x3e')],_0x4bb3fb['query']);_0x4b67c8['attributes']=_[_0xa488('0x43')](_0x4bb3fb['model'],qs['fields'](_0x4c0e28['query']['fields']));_0x4b67c8[_0xa488('0x44')]=_0x4b67c8['attributes'][_0xa488('0x46')]?_0x4b67c8[_0xa488('0x44')]:_0x4bb3fb[_0xa488('0x3e')];if(_0x4c0e28['query'][_0xa488('0x4f')]){_0x4b67c8['include']=[{'all':!![]}];}_0x4b67c8=_[_0xa488('0x4d')]({},_0x4b67c8,_0x4c0e28[_0xa488('0x55')]);return db[_0xa488('0x3b')][_0xa488('0x56')](_0x4b67c8)[_0xa488('0x1d')](handleEntityNotFound(_0x4f40db,null))[_0xa488('0x1d')](respondWithResult(_0x4f40db,null))[_0xa488('0x24')](handleError(_0x4f40db,null));};exports[_0xa488('0x57')]=function(_0x585ed7,_0x2383e1,_0x15a853){var _0x52a15d;return db[_0xa488('0x3b')][_0xa488('0x57')](_0x585ed7[_0xa488('0x58')],{'raw':!![]})[_0xa488('0x1d')](function(_0x27536f){_0x52a15d=_0x27536f;return db[_0xa488('0x3b')][_0xa488('0x51')]({'raw':!![]});})[_0xa488('0x1d')](function(_0x4e87ce){var _0x444e05=fs[_0xa488('0x59')](path[_0xa488('0x5a')](config[_0xa488('0x5b')],_0xa488('0x5c')),_0xa488('0x5d'));var _0x4fd6c5=ejs[_0xa488('0x5e')](_0x444e05,{'contexts':_0x4e87ce||[]});fs[_0xa488('0x5f')](_0xa488('0x60'),_0x4fd6c5);})[_0xa488('0x1d')](function(){return respondWithRpcPromise(_0xa488('0x61'),_0xa488('0x57'),{'module':'chan_sip.so'});})['then'](function(){var _0x382dba=_0x585ed7[_0xa488('0x62')]['get']({'plain':!![]});if(!_0x382dba)throw new Error(_0xa488('0x63'));if(_0x382dba[_0xa488('0x64')]===_0xa488('0x62')){var _0x578814=_0x52a15d[_0xa488('0x34')]({'plain':!![]});return db[_0xa488('0x65')][_0xa488('0x56')]({'where':{'name':_0xa488('0x35'),'userProfileId':_0x382dba[_0xa488('0x66')]},'raw':!![]})[_0xa488('0x1d')](function(_0x16cb0e){if(_0x16cb0e&&_0x16cb0e[_0xa488('0x67')]===0x0){return db['UserProfileResource'][_0xa488('0x57')]({'name':_0x578814[_0xa488('0x38')],'resourceId':_0x578814['id'],'type':_0x16cb0e[_0xa488('0x38')],'sectionId':_0x16cb0e['id']},{})[_0xa488('0x1d')](function(){return _0x52a15d;});}else{return _0x52a15d;}})[_0xa488('0x24')](function(_0x4c042e){logger[_0xa488('0x21')](_0xa488('0x68'),_0x4c042e);throw _0x4c042e;});}return _0x52a15d;})['then'](respondWithResult(_0x2383e1,0xc9))['catch'](handleError(_0x2383e1,null));};exports[_0xa488('0x32')]=function(_0x2db439,_0x5bf967,_0x344c31){var _0x74c69f;return db[_0xa488('0x3b')]['find']({'where':{'id':_0x2db439[_0xa488('0x54')]['id']}})[_0xa488('0x1d')](handleEntityNotFound(_0x5bf967,null))[_0xa488('0x1d')](saveUpdates(_0x2db439[_0xa488('0x58')],null))[_0xa488('0x1d')](function(_0x375c2f){if(_0x375c2f){_0x74c69f=_0x375c2f;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x2b055d){var _0x4c77fc=fs[_0xa488('0x59')](path['join'](config[_0xa488('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x2614f0=ejs[_0xa488('0x5e')](_0x4c77fc,{'contexts':_0x2b055d||[]});fs[_0xa488('0x5f')](_0xa488('0x60'),_0x2614f0);})[_0xa488('0x1d')](function(){return respondWithRpcPromise(_0xa488('0x61'),_0xa488('0x32'),{'module':_0xa488('0x69')});})['then'](function(){return _0x74c69f;})[_0xa488('0x1d')](respondWithResult(_0x5bf967,null))[_0xa488('0x24')](handleError(_0x5bf967,null));};exports['destroy']=function(_0x5dbb4d,_0x5089b5,_0x4324b4){var _0x4a569c;return db['VoiceContext'][_0xa488('0x56')]({'where':{'id':_0x5dbb4d[_0xa488('0x54')]['id']}})['then'](handleEntityNotFound(_0x5089b5,null))[_0xa488('0x1d')](removeEntity(_0x5089b5,null))[_0xa488('0x1d')](function(){return db['VoiceContext'][_0xa488('0x51')]({'raw':!![]});})[_0xa488('0x1d')](function(_0x23119c){var _0x2c2335=fs[_0xa488('0x59')](path[_0xa488('0x5a')](config[_0xa488('0x5b')],_0xa488('0x5c')),_0xa488('0x5d'));var _0x1e76b3=ejs[_0xa488('0x5e')](_0x2c2335,{'contexts':_0x23119c});fs['writeFileSync'](_0xa488('0x60'),_0x1e76b3);return respondWithRpcPromise(_0xa488('0x61'),'destroy',{'module':'chan_sip.so'});})[_0xa488('0x24')](handleError(_0x5089b5,null));}; \ No newline at end of file +var _0x10f6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','destroy','get','Contexts','UserProfileResource','name','index','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','VoiceContext','includeAll','include','findAll','rows','show','params','intersection','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x10f6,0xc7));var _0x610f=function(_0x2b9202,_0x2a8edb){_0x2b9202=_0x2b9202-0x0;var _0x85f119=_0x10f6[_0x2b9202];return _0x85f119;};'use strict';var emlformat=require(_0x610f('0x0'));var rimraf=require(_0x610f('0x1'));var zipdir=require(_0x610f('0x2'));var jsonpatch=require(_0x610f('0x3'));var rp=require(_0x610f('0x4'));var moment=require(_0x610f('0x5'));var BPromise=require(_0x610f('0x6'));var Mustache=require(_0x610f('0x7'));var util=require('util');var path=require(_0x610f('0x8'));var sox=require(_0x610f('0x9'));var csv=require(_0x610f('0xa'));var ejs=require(_0x610f('0xb'));var fs=require('fs');var fs_extra=require(_0x610f('0xc'));var _=require(_0x610f('0xd'));var squel=require(_0x610f('0xe'));var crypto=require(_0x610f('0xf'));var jsforce=require(_0x610f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x610f('0xa'));var querystring=require(_0x610f('0x11'));var Papa=require(_0x610f('0x12'));var Redis=require(_0x610f('0x13'));var authService=require(_0x610f('0x14'));var qs=require(_0x610f('0x15'));var as=require(_0x610f('0x16'));var hardwareService=require(_0x610f('0x17'));var logger=require('../../config/logger')(_0x610f('0x18'));var utils=require('../../config/utils');var config=require(_0x610f('0x19'));var licenseUtil=require(_0x610f('0x1a'));var db=require(_0x610f('0x1b'))['db'];var jayson=require(_0x610f('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14b78e,_0x432216,_0x22773b,_0x23b8dc){return new BPromise(function(_0x11ae46,_0xee6ea3){var _0x4938a2=_0x23b8dc||client;return _0x4938a2[_0x610f('0x1d')](_0x14b78e,_0x22773b)[_0x610f('0x1e')](function(_0x2748db){logger[_0x610f('0x1f')](_0x610f('0x20'),_0x432216,_0x610f('0x21'));logger[_0x610f('0x22')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x432216,_0x610f('0x21'),JSON[_0x610f('0x23')](_0x2748db));if(_0x2748db[_0x610f('0x24')]){if(_0x2748db[_0x610f('0x24')][_0x610f('0x25')]===0x1f4){logger['error'](_0x610f('0x20'),_0x432216,_0x2748db[_0x610f('0x24')]['message']);return _0xee6ea3(_0x2748db[_0x610f('0x24')][_0x610f('0x26')]);}logger[_0x610f('0x24')]('VoiceContext,\x20%s,\x20%s',_0x432216,_0x2748db[_0x610f('0x24')][_0x610f('0x26')]);return _0x11ae46(_0x2748db[_0x610f('0x24')][_0x610f('0x26')]);}else{logger[_0x610f('0x1f')](_0x610f('0x20'),_0x432216,_0x610f('0x21'));_0x11ae46(_0x2748db[_0x610f('0x27')][_0x610f('0x26')]);}})[_0x610f('0x28')](function(_0x5ed720){logger[_0x610f('0x24')](_0x610f('0x20'),_0x432216,_0x5ed720);_0xee6ea3(_0x5ed720);});});}function respondWithStatusCode(_0x412142,_0x5edf30){_0x5edf30=_0x5edf30||0xcc;return function(_0x577845){if(_0x577845){return _0x412142[_0x610f('0x29')](_0x5edf30);}return _0x412142[_0x610f('0x2a')](_0x5edf30)[_0x610f('0x2b')]();};}function respondWithResult(_0x5d0f59,_0xa5d7c0){_0xa5d7c0=_0xa5d7c0||0xc8;return function(_0x47c07e){if(_0x47c07e){return _0x5d0f59['status'](_0xa5d7c0)[_0x610f('0x2c')](_0x47c07e);}};}function respondWithFilteredResult(_0x1744bb,_0x3175ff){return function(_0x5c7d86){if(_0x5c7d86){var _0x38b348=typeof _0x3175ff[_0x610f('0x2d')]===_0x610f('0x2e')&&typeof _0x3175ff['limit']===_0x610f('0x2e');var _0x2c81de=_0x5c7d86['count'];var _0x43c83d=_0x38b348?0x0:_0x3175ff[_0x610f('0x2d')];var _0x1fd7d1=_0x38b348?_0x5c7d86[_0x610f('0x2f')]:_0x3175ff[_0x610f('0x2d')]+_0x3175ff['limit'];var _0x4a0e16;if(_0x1fd7d1>=_0x2c81de){_0x1fd7d1=_0x2c81de;_0x4a0e16=0xc8;}else{_0x4a0e16=0xce;}_0x1744bb[_0x610f('0x2a')](_0x4a0e16);return _0x1744bb[_0x610f('0x30')]('Content-Range',_0x43c83d+'-'+_0x1fd7d1+'/'+_0x2c81de)['json'](_0x5c7d86);}return null;};}function patchUpdates(_0x2c537c){return function(_0x2e2bd2){try{jsonpatch[_0x610f('0x31')](_0x2e2bd2,_0x2c537c,!![]);}catch(_0x1d2100){return BPromise[_0x610f('0x32')](_0x1d2100);}return _0x2e2bd2['save']();};}function saveUpdates(_0x556611,_0x104fce){return function(_0x1dbb34){if(_0x1dbb34){return _0x1dbb34['update'](_0x556611)[_0x610f('0x1e')](function(_0xae571e){return _0xae571e;});}return null;};}function removeEntity(_0x3837ea,_0x220325){return function(_0x304022){if(_0x304022){return _0x304022[_0x610f('0x33')]()[_0x610f('0x1e')](function(){var _0x16a57d=_0x304022[_0x610f('0x34')]({'plain':!![]});var _0x394431=_0x610f('0x35');return db[_0x610f('0x36')]['destroy']({'where':{'type':_0x394431,'resourceId':_0x16a57d['id']}})[_0x610f('0x1e')](function(){return _0x304022;});})[_0x610f('0x1e')](function(){_0x3837ea['status'](0xcc)[_0x610f('0x2b')]();});}};}function handleEntityNotFound(_0x43d878,_0x3baf9e){return function(_0x1c36a7){if(!_0x1c36a7){_0x43d878[_0x610f('0x29')](0x194);}return _0x1c36a7;};}function handleError(_0x2fc77c,_0x18a4d0){_0x18a4d0=_0x18a4d0||0x1f4;return function(_0x16e2df){logger[_0x610f('0x24')](_0x16e2df['stack']);if(_0x16e2df[_0x610f('0x37')]){delete _0x16e2df[_0x610f('0x37')];}_0x2fc77c[_0x610f('0x2a')](_0x18a4d0)['send'](_0x16e2df);};}exports[_0x610f('0x38')]=function(_0x4d18e9,_0x1b5631){var _0x162e68={},_0xf48fa={},_0x55cc99={'count':0x0,'rows':[]};var _0x4e036b=_['map'](db['VoiceContext'][_0x610f('0x39')],function(_0x5430b1){return{'name':_0x5430b1[_0x610f('0x3a')],'type':_0x5430b1[_0x610f('0x3b')][_0x610f('0x3c')]};});_0xf48fa[_0x610f('0x3d')]=_['map'](_0x4e036b,_0x610f('0x37'));_0xf48fa['query']=_[_0x610f('0x3e')](_0x4d18e9[_0x610f('0x3f')]);_0xf48fa[_0x610f('0x40')]=_['intersection'](_0xf48fa[_0x610f('0x3d')],_0xf48fa[_0x610f('0x3f')]);_0x162e68[_0x610f('0x41')]=_['intersection'](_0xf48fa[_0x610f('0x3d')],qs['fields'](_0x4d18e9['query'][_0x610f('0x42')]));_0x162e68[_0x610f('0x41')]=_0x162e68['attributes'][_0x610f('0x43')]?_0x162e68[_0x610f('0x41')]:_0xf48fa[_0x610f('0x3d')];if(!_0x4d18e9['query'][_0x610f('0x44')](_0x610f('0x45'))){_0x162e68[_0x610f('0x46')]=qs[_0x610f('0x46')](_0x4d18e9[_0x610f('0x3f')][_0x610f('0x46')]);_0x162e68[_0x610f('0x2d')]=qs[_0x610f('0x2d')](_0x4d18e9[_0x610f('0x3f')][_0x610f('0x2d')]);}_0x162e68[_0x610f('0x47')]=qs[_0x610f('0x48')](_0x4d18e9[_0x610f('0x3f')][_0x610f('0x48')]);_0x162e68[_0x610f('0x49')]=qs[_0x610f('0x40')](_[_0x610f('0x4a')](_0x4d18e9[_0x610f('0x3f')],_0xf48fa[_0x610f('0x40')]),_0x4e036b);if(_0x4d18e9[_0x610f('0x3f')][_0x610f('0x4b')]){_0x162e68[_0x610f('0x49')]=_['merge'](_0x162e68[_0x610f('0x49')],{'$or':_[_0x610f('0x4c')](_0x4e036b,function(_0x2f1d41){if(_0x2f1d41[_0x610f('0x3b')]!==_0x610f('0x4d')){var _0x59e7d2={};_0x59e7d2[_0x2f1d41[_0x610f('0x37')]]={'$like':'%'+_0x4d18e9[_0x610f('0x3f')][_0x610f('0x4b')]+'%'};return _0x59e7d2;}})});}_0x162e68=_[_0x610f('0x4e')]({},_0x162e68,_0x4d18e9[_0x610f('0x4f')]);var _0x8264e={'where':_0x162e68[_0x610f('0x49')]};return db[_0x610f('0x50')][_0x610f('0x2f')](_0x8264e)[_0x610f('0x1e')](function(_0x473016){_0x55cc99[_0x610f('0x2f')]=_0x473016;if(_0x4d18e9[_0x610f('0x3f')][_0x610f('0x51')]){_0x162e68[_0x610f('0x52')]=[{'all':!![]}];}return db[_0x610f('0x50')][_0x610f('0x53')](_0x162e68);})[_0x610f('0x1e')](function(_0x93fa86){_0x55cc99[_0x610f('0x54')]=_0x93fa86;return _0x55cc99;})[_0x610f('0x1e')](respondWithFilteredResult(_0x1b5631,_0x162e68))[_0x610f('0x28')](handleError(_0x1b5631,null));};exports[_0x610f('0x55')]=function(_0x7be4e1,_0x24bc85){var _0x57b62f={'raw':![],'where':{'id':_0x7be4e1[_0x610f('0x56')]['id']}},_0x3b92c9={};_0x3b92c9[_0x610f('0x3d')]=_['keys'](db[_0x610f('0x50')][_0x610f('0x39')]);_0x3b92c9[_0x610f('0x3f')]=_[_0x610f('0x3e')](_0x7be4e1['query']);_0x3b92c9[_0x610f('0x40')]=_[_0x610f('0x57')](_0x3b92c9[_0x610f('0x3d')],_0x3b92c9['query']);_0x57b62f[_0x610f('0x41')]=_['intersection'](_0x3b92c9['model'],qs[_0x610f('0x42')](_0x7be4e1[_0x610f('0x3f')][_0x610f('0x42')]));_0x57b62f[_0x610f('0x41')]=_0x57b62f[_0x610f('0x41')][_0x610f('0x43')]?_0x57b62f[_0x610f('0x41')]:_0x3b92c9[_0x610f('0x3d')];if(_0x7be4e1[_0x610f('0x3f')]['includeAll']){_0x57b62f[_0x610f('0x52')]=[{'all':!![]}];}_0x57b62f=_['merge']({},_0x57b62f,_0x7be4e1[_0x610f('0x4f')]);return db[_0x610f('0x50')][_0x610f('0x58')](_0x57b62f)[_0x610f('0x1e')](handleEntityNotFound(_0x24bc85,null))[_0x610f('0x1e')](respondWithResult(_0x24bc85,null))[_0x610f('0x28')](handleError(_0x24bc85,null));};exports[_0x610f('0x59')]=function(_0x4d1d78,_0x1583f3,_0x5a464a){var _0x556a00;return db[_0x610f('0x50')][_0x610f('0x59')](_0x4d1d78[_0x610f('0x5a')],{'raw':!![]})[_0x610f('0x1e')](function(_0x4fb904){_0x556a00=_0x4fb904;return db[_0x610f('0x50')][_0x610f('0x53')]({'raw':!![]});})[_0x610f('0x1e')](function(_0x4aa682){var _0x35b122=fs[_0x610f('0x5b')](path[_0x610f('0x5c')](config[_0x610f('0x5d')],_0x610f('0x5e')),_0x610f('0x5f'));var _0x5b418f=ejs[_0x610f('0x60')](_0x35b122,{'contexts':_0x4aa682||[]});fs[_0x610f('0x61')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5b418f);})[_0x610f('0x1e')](function(){return respondWithRpcPromise(_0x610f('0x62'),'create',{'module':_0x610f('0x63')});})[_0x610f('0x1e')](function(){var _0x453c0f=_0x4d1d78[_0x610f('0x64')][_0x610f('0x34')]({'plain':!![]});if(!_0x453c0f)throw new Error(_0x610f('0x65'));if(_0x453c0f[_0x610f('0x66')]==='user'){var _0x3ccfac=_0x556a00[_0x610f('0x34')]({'plain':!![]});return db[_0x610f('0x67')][_0x610f('0x58')]({'where':{'name':_0x610f('0x35'),'userProfileId':_0x453c0f[_0x610f('0x68')]},'raw':!![]})['then'](function(_0x2d3750){if(_0x2d3750&&_0x2d3750[_0x610f('0x69')]===0x0){return db['UserProfileResource'][_0x610f('0x59')]({'name':_0x3ccfac[_0x610f('0x37')],'resourceId':_0x3ccfac['id'],'type':_0x2d3750[_0x610f('0x37')],'sectionId':_0x2d3750['id']},{})['then'](function(){return _0x556a00;});}else{return _0x556a00;}})['catch'](function(_0x1cd568){logger['error'](_0x610f('0x6a'),_0x1cd568);throw _0x1cd568;});}return _0x556a00;})[_0x610f('0x1e')](respondWithResult(_0x1583f3,0xc9))['catch'](handleError(_0x1583f3,null));};exports[_0x610f('0x6b')]=function(_0x62c8a,_0x5ccaf0,_0x3aefa8){var _0x924f03;return db['VoiceContext'][_0x610f('0x58')]({'where':{'id':_0x62c8a['params']['id']}})[_0x610f('0x1e')](handleEntityNotFound(_0x5ccaf0,null))['then'](saveUpdates(_0x62c8a['body'],null))[_0x610f('0x1e')](function(_0x5abce5){if(_0x5abce5){_0x924f03=_0x5abce5;return db[_0x610f('0x50')][_0x610f('0x53')]({'raw':!![]});}})[_0x610f('0x1e')](function(_0x555ab4){var _0x22389b=fs['readFileSync'](path[_0x610f('0x5c')](config['root'],_0x610f('0x5e')),'utf8');var _0x2474f0=ejs['render'](_0x22389b,{'contexts':_0x555ab4||[]});fs['writeFileSync'](_0x610f('0x6c'),_0x2474f0);})['then'](function(){return respondWithRpcPromise(_0x610f('0x62'),_0x610f('0x6b'),{'module':'chan_sip.so'});})[_0x610f('0x1e')](function(){return _0x924f03;})[_0x610f('0x1e')](respondWithResult(_0x5ccaf0,null))[_0x610f('0x28')](handleError(_0x5ccaf0,null));};exports[_0x610f('0x33')]=function(_0x161d17,_0x41f150,_0x2b9e39){var _0x400dbe;return db['VoiceContext']['find']({'where':{'id':_0x161d17[_0x610f('0x56')]['id']}})[_0x610f('0x1e')](handleEntityNotFound(_0x41f150,null))['then'](removeEntity(_0x41f150,null))['then'](function(){return db['VoiceContext'][_0x610f('0x53')]({'raw':!![]});})['then'](function(_0x192ce5){var _0x1269e1=fs[_0x610f('0x5b')](path[_0x610f('0x5c')](config[_0x610f('0x5d')],'server/files/templates/context.ejs'),_0x610f('0x5f'));var _0x553b44=ejs[_0x610f('0x60')](_0x1269e1,{'contexts':_0x192ce5});fs[_0x610f('0x61')](_0x610f('0x6c'),_0x553b44);return respondWithRpcPromise(_0x610f('0x62'),_0x610f('0x33'),{'module':_0x610f('0x63')});})[_0x610f('0x28')](handleError(_0x41f150,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 000bc37..d9ad517 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 _0x38d1=['path','rimraf','../../config/environment','./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x38d1,0x1b6));var _0x138d=function(_0x1c4ea9,_0x3f214b){_0x1c4ea9=_0x1c4ea9-0x0;var _0x3c8429=_0x38d1[_0x1c4ea9];return _0x3c8429;};'use strict';var _=require(_0x138d('0x0'));var util=require(_0x138d('0x1'));var logger=require(_0x138d('0x2'))(_0x138d('0x3'));var moment=require(_0x138d('0x4'));var BPromise=require(_0x138d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x138d('0x6'));var rimraf=require(_0x138d('0x7'));var config=require(_0x138d('0x8'));var attributes=require(_0x138d('0x9'));module['exports']=function(_0x1b6fc0,_0x3c299e){return _0x1b6fc0['define'](_0x138d('0xa'),attributes,{'tableName':_0x138d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x342e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','../../config/logger'];(function(_0x4eb044,_0x5e8045){var _0x2c8c50=function(_0x465248){while(--_0x465248){_0x4eb044['push'](_0x4eb044['shift']());}};_0x2c8c50(++_0x5e8045);}(_0x342e,0x19e));var _0xe342=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x342e[_0x5090d4];return _0x56c310;};'use strict';var _=require('lodash');var util=require(_0xe342('0x0'));var logger=require(_0xe342('0x1'))('api');var moment=require(_0xe342('0x2'));var BPromise=require(_0xe342('0x3'));var rp=require(_0xe342('0x4'));var fs=require('fs');var path=require(_0xe342('0x5'));var rimraf=require(_0xe342('0x6'));var config=require(_0xe342('0x7'));var attributes=require(_0xe342('0x8'));module[_0xe342('0x9')]=function(_0x134eab,_0x9b1f2d){return _0x134eab[_0xe342('0xa')](_0xe342('0xb'),attributes,{'tableName':_0xe342('0xc'),'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 15bc586..5a08af2 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 _0x7916=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0xae4691,_0x58372c){var _0x537f7f=function(_0x4502de){while(--_0x4502de){_0xae4691['push'](_0xae4691['shift']());}};_0x537f7f(++_0x58372c);}(_0x7916,0x128));var _0x6791=function(_0x125703,_0x12dd6e){_0x125703=_0x125703-0x0;var _0x43cb71=_0x7916[_0x125703];return _0x43cb71;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});} \ No newline at end of file +var _0x2deb=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var moment=require(_0xb2de('0x2'));var BPromise=require(_0xb2de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2de('0x4'))['db'];var utils=require(_0xb2de('0x5'));var logger=require(_0xb2de('0x6'))(_0xb2de('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2de('0x8')][_0xb2de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191004,_0x49307b,_0x253d0b){return new BPromise(function(_0x1a4c44,_0x53ab0e){return client[_0xb2de('0xa')](_0x191004,_0x253d0b)[_0xb2de('0xb')](function(_0x1d40ec){logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));logger[_0xb2de('0xe')](_0xb2de('0xf'),_0x49307b,'request\x20sent',JSON['stringify'](_0x1d40ec));if(_0x1d40ec[_0xb2de('0x10')]){if(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x11')]===0x1f4){logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);return _0x53ab0e(_0x1d40ec['error'][_0xb2de('0x12')]);}logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec['error'][_0xb2de('0x12')]);return _0x1a4c44(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);}else{logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));_0x1a4c44(_0x1d40ec[_0xb2de('0x13')][_0xb2de('0x12')]);}})[_0xb2de('0x14')](function(_0x2dc15c){logger[_0xb2de('0x10')](_0xb2de('0xc'),_0x49307b,_0x2dc15c);_0x53ab0e(_0x2dc15c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e1d92c7..9dabb74 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 _0x9d2a=['index','/describe','isAuthenticated','describe','/:id','put','update','delete','multer','util','path','../../components/interaction/service','../../config/environment','get'];(function(_0x4dc7bb,_0xf1c679){var _0x3ff3ef=function(_0x258651){while(--_0x258651){_0x4dc7bb['push'](_0x4dc7bb['shift']());}};_0x3ff3ef(++_0xf1c679);}(_0x9d2a,0x1e4));var _0xa9d2=function(_0x49645a,_0x28f417){_0x49645a=_0x49645a-0x0;var _0x2b2c26=_0x9d2a[_0x49645a];return _0x2b2c26;};'use strict';var multer=require(_0xa9d2('0x0'));var util=require(_0xa9d2('0x1'));var path=require(_0xa9d2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa9d2('0x3'));var config=require(_0xa9d2('0x4'));var controller=require('./voiceDialReport.controller');router[_0xa9d2('0x5')]('/',auth['isAuthenticated'](),controller[_0xa9d2('0x6')]);router[_0xa9d2('0x5')](_0xa9d2('0x7'),auth[_0xa9d2('0x8')](),controller[_0xa9d2('0x9')]);router[_0xa9d2('0x5')](_0xa9d2('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa9d2('0xb')](_0xa9d2('0xa'),auth[_0xa9d2('0x8')](),controller[_0xa9d2('0xc')]);router[_0xa9d2('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5862=['put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x38cdd0,_0x28ec1e){var _0x1c1da9=function(_0xc3fc4b){while(--_0xc3fc4b){_0x38cdd0['push'](_0x38cdd0['shift']());}};_0x1c1da9(++_0x28ec1e);}(_0x5862,0x17f));var _0x2586=function(_0x47a5e9,_0xe3c62c){_0x47a5e9=_0x47a5e9-0x0;var _0x31fc68=_0x5862[_0x47a5e9];return _0x31fc68;};'use strict';var multer=require(_0x2586('0x0'));var util=require(_0x2586('0x1'));var path=require('path');var timeout=require(_0x2586('0x2'));var express=require(_0x2586('0x3'));var router=express[_0x2586('0x4')]();var fs_extra=require(_0x2586('0x5'));var auth=require(_0x2586('0x6'));var interaction=require(_0x2586('0x7'));var config=require(_0x2586('0x8'));var controller=require(_0x2586('0x9'));router[_0x2586('0xa')]('/',auth[_0x2586('0xb')](),controller[_0x2586('0xc')]);router['get']('/describe',auth[_0x2586('0xb')](),controller['describe']);router[_0x2586('0xa')](_0x2586('0xd'),auth[_0x2586('0xb')](),controller[_0x2586('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2586('0xf')]);router[_0x2586('0x10')](_0x2586('0xd'),auth[_0x2586('0xb')](),controller[_0x2586('0x11')]);router['delete'](_0x2586('0xd'),auth[_0x2586('0xb')](),controller[_0x2586('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0c5b62d..5fc917f 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 _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x7c24d3,_0x4a7c69){var _0x5f2a71=function(_0x521a73){while(--_0x521a73){_0x7c24d3['push'](_0x7c24d3['shift']());}};_0x5f2a71(++_0x4a7c69);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x493cea,_0x144c6a){_0x493cea=_0x493cea-0x0;var _0x1c32ba=_0xf3cd[_0x493cea];return _0x1c32ba;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0xaf0ff3,_0x168769){var _0x9b36f7=function(_0x3e92cf){while(--_0x3e92cf){_0xaf0ff3['push'](_0xaf0ff3['shift']());}};_0x9b36f7(++_0x168769);}(_0x008c,0x188));var _0xc008=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x008c[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 93c847a..2839437 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 _0x7f43=['hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f43,0xf8));var _0x37f4=function(_0x538903,_0x568780){_0x538903=_0x538903-0x0;var _0x5e9b9d=_0x7f43[_0x538903];return _0x5e9b9d;};'use strict';var emlformat=require(_0x37f4('0x0'));var rimraf=require(_0x37f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37f4('0x2'));var rp=require(_0x37f4('0x3'));var moment=require(_0x37f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x37f4('0x5'));var util=require(_0x37f4('0x6'));var path=require(_0x37f4('0x7'));var sox=require(_0x37f4('0x8'));var csv=require(_0x37f4('0x9'));var ejs=require(_0x37f4('0xa'));var fs=require('fs');var fs_extra=require(_0x37f4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x37f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x37f4('0xd'));var toCsv=require(_0x37f4('0x9'));var querystring=require(_0x37f4('0xe'));var Papa=require(_0x37f4('0xf'));var Redis=require(_0x37f4('0x10'));var authService=require(_0x37f4('0x11'));var qs=require(_0x37f4('0x12'));var as=require(_0x37f4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37f4('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x37f4('0x15'));var db=require(_0x37f4('0x16'))['db'];function respondWithStatusCode(_0x5eeb92,_0x270335){_0x270335=_0x270335||0xcc;return function(_0x126940){if(_0x126940){return _0x5eeb92['sendStatus'](_0x270335);}return _0x5eeb92[_0x37f4('0x17')](_0x270335)[_0x37f4('0x18')]();};}function respondWithResult(_0x216346,_0x3637ad){_0x3637ad=_0x3637ad||0xc8;return function(_0x13c2c6){if(_0x13c2c6){return _0x216346[_0x37f4('0x17')](_0x3637ad)[_0x37f4('0x19')](_0x13c2c6);}};}function respondWithFilteredResult(_0x42f128,_0x1311ad){return function(_0x554cc2){if(_0x554cc2){var _0x3f17de=typeof _0x1311ad['offset']===_0x37f4('0x1a')&&typeof _0x1311ad[_0x37f4('0x1b')]===_0x37f4('0x1a');var _0x51f388=_0x554cc2[_0x37f4('0x1c')];var _0x8b890d=_0x3f17de?0x0:_0x1311ad[_0x37f4('0x1d')];var _0x3a31e9=_0x3f17de?_0x554cc2[_0x37f4('0x1c')]:_0x1311ad[_0x37f4('0x1d')]+_0x1311ad[_0x37f4('0x1b')];var _0x1c7a8e;if(_0x3a31e9>=_0x51f388){_0x3a31e9=_0x51f388;_0x1c7a8e=0xc8;}else{_0x1c7a8e=0xce;}_0x42f128[_0x37f4('0x17')](_0x1c7a8e);return _0x42f128[_0x37f4('0x1e')](_0x37f4('0x1f'),_0x8b890d+'-'+_0x3a31e9+'/'+_0x51f388)[_0x37f4('0x19')](_0x554cc2);}return null;};}function patchUpdates(_0x5d1eac){return function(_0x3538f4){try{jsonpatch[_0x37f4('0x20')](_0x3538f4,_0x5d1eac,!![]);}catch(_0x3c569c){return BPromise[_0x37f4('0x21')](_0x3c569c);}return _0x3538f4[_0x37f4('0x22')]();};}function saveUpdates(_0x48c702,_0x592cb4){return function(_0x30fdd8){if(_0x30fdd8){return _0x30fdd8[_0x37f4('0x23')](_0x48c702)['then'](function(_0x5f0d27){return _0x5f0d27;});}return null;};}function removeEntity(_0x4a6e8b,_0x540cae){return function(_0x6fe66e){if(_0x6fe66e){return _0x6fe66e[_0x37f4('0x24')]()[_0x37f4('0x25')](function(){_0x4a6e8b['status'](0xcc)[_0x37f4('0x18')]();});}};}function handleEntityNotFound(_0x3f0486,_0x34d699){return function(_0x142cb5){if(!_0x142cb5){_0x3f0486[_0x37f4('0x26')](0x194);}return _0x142cb5;};}function handleError(_0x33784c,_0x4600dc){_0x4600dc=_0x4600dc||0x1f4;return function(_0x59e793){logger[_0x37f4('0x27')](_0x59e793[_0x37f4('0x28')]);if(_0x59e793[_0x37f4('0x29')]){delete _0x59e793['name'];}_0x33784c[_0x37f4('0x17')](_0x4600dc)['send'](_0x59e793);};}exports[_0x37f4('0x2a')]=function(_0x3ca0da,_0x584475){var _0x308ca8={},_0x4258db={},_0xf7f69d={'count':0x0,'rows':[]};var _0x20c634=_[_0x37f4('0x2b')](db[_0x37f4('0x2c')]['rawAttributes'],function(_0x29c1d0){return{'name':_0x29c1d0[_0x37f4('0x2d')],'type':_0x29c1d0[_0x37f4('0x2e')][_0x37f4('0x2f')]};});_0x4258db[_0x37f4('0x30')]=_[_0x37f4('0x2b')](_0x20c634,_0x37f4('0x29'));_0x4258db[_0x37f4('0x31')]=_[_0x37f4('0x32')](_0x3ca0da[_0x37f4('0x31')]);_0x4258db[_0x37f4('0x33')]=_[_0x37f4('0x34')](_0x4258db[_0x37f4('0x30')],_0x4258db[_0x37f4('0x31')]);_0x308ca8[_0x37f4('0x35')]=_[_0x37f4('0x34')](_0x4258db[_0x37f4('0x30')],qs[_0x37f4('0x36')](_0x3ca0da[_0x37f4('0x31')][_0x37f4('0x36')]));_0x308ca8[_0x37f4('0x35')]=_0x308ca8[_0x37f4('0x35')][_0x37f4('0x37')]?_0x308ca8[_0x37f4('0x35')]:_0x4258db[_0x37f4('0x30')];if(!_0x3ca0da['query'][_0x37f4('0x38')](_0x37f4('0x39'))){_0x308ca8['limit']=qs[_0x37f4('0x1b')](_0x3ca0da[_0x37f4('0x31')]['limit']);_0x308ca8[_0x37f4('0x1d')]=qs[_0x37f4('0x1d')](_0x3ca0da[_0x37f4('0x31')][_0x37f4('0x1d')]);}_0x308ca8['order']=qs[_0x37f4('0x3a')](_0x3ca0da[_0x37f4('0x31')][_0x37f4('0x3a')]);_0x308ca8['where']=qs[_0x37f4('0x33')](_[_0x37f4('0x3b')](_0x3ca0da[_0x37f4('0x31')],_0x4258db[_0x37f4('0x33')]),_0x20c634);if(_0x3ca0da[_0x37f4('0x31')][_0x37f4('0x3c')]){_0x308ca8[_0x37f4('0x3d')]=_[_0x37f4('0x3e')](_0x308ca8['where'],{'$or':_['map'](_0x20c634,function(_0x4ef48a){if(_0x4ef48a['type']!==_0x37f4('0x3f')){var _0x318ee5={};_0x318ee5[_0x4ef48a[_0x37f4('0x29')]]={'$like':'%'+_0x3ca0da[_0x37f4('0x31')]['filter']+'%'};return _0x318ee5;}})});}_0x308ca8=_[_0x37f4('0x3e')]({},_0x308ca8,_0x3ca0da[_0x37f4('0x40')]);var _0x58e4c5={'where':_0x308ca8[_0x37f4('0x3d')]};return db['VoiceDialReport'][_0x37f4('0x1c')](_0x58e4c5)['then'](function(_0xad538){_0xf7f69d[_0x37f4('0x1c')]=_0xad538;if(_0x3ca0da[_0x37f4('0x31')]['includeAll']){_0x308ca8[_0x37f4('0x41')]=[{'all':!![]}];}return db[_0x37f4('0x2c')][_0x37f4('0x42')](_0x308ca8);})[_0x37f4('0x25')](function(_0x4c5512){_0xf7f69d[_0x37f4('0x43')]=_0x4c5512;return _0xf7f69d;})['then'](respondWithFilteredResult(_0x584475,_0x308ca8))[_0x37f4('0x44')](handleError(_0x584475,null));};exports[_0x37f4('0x45')]=function(_0x3e4373,_0x1be965){var _0xf28fd8={'raw':!![],'where':{'id':_0x3e4373[_0x37f4('0x46')]['id']}},_0x337469={};_0x337469[_0x37f4('0x30')]=_['keys'](db['VoiceDialReport'][_0x37f4('0x47')]);_0x337469[_0x37f4('0x31')]=_[_0x37f4('0x32')](_0x3e4373[_0x37f4('0x31')]);_0x337469[_0x37f4('0x33')]=_[_0x37f4('0x34')](_0x337469[_0x37f4('0x30')],_0x337469[_0x37f4('0x31')]);_0xf28fd8['attributes']=_[_0x37f4('0x34')](_0x337469[_0x37f4('0x30')],qs[_0x37f4('0x36')](_0x3e4373[_0x37f4('0x31')]['fields']));_0xf28fd8[_0x37f4('0x35')]=_0xf28fd8[_0x37f4('0x35')]['length']?_0xf28fd8[_0x37f4('0x35')]:_0x337469[_0x37f4('0x30')];if(_0x3e4373[_0x37f4('0x31')]['includeAll']){_0xf28fd8[_0x37f4('0x41')]=[{'all':!![]}];}_0xf28fd8=_[_0x37f4('0x3e')]({},_0xf28fd8,_0x3e4373[_0x37f4('0x40')]);return db['VoiceDialReport']['find'](_0xf28fd8)['then'](handleEntityNotFound(_0x1be965,null))['then'](respondWithResult(_0x1be965,null))[_0x37f4('0x44')](handleError(_0x1be965,null));};exports[_0x37f4('0x48')]=function(_0x1f48fb,_0xbeea68){return db['VoiceDialReport'][_0x37f4('0x48')](_0x1f48fb['body'],{})[_0x37f4('0x25')](respondWithResult(_0xbeea68,0xc9))[_0x37f4('0x44')](handleError(_0xbeea68,null));};exports[_0x37f4('0x23')]=function(_0x403e79,_0x2ca1c5){if(_0x403e79[_0x37f4('0x49')]['id']){delete _0x403e79[_0x37f4('0x49')]['id'];}return db[_0x37f4('0x2c')]['find']({'where':{'id':_0x403e79[_0x37f4('0x46')]['id']}})[_0x37f4('0x25')](handleEntityNotFound(_0x2ca1c5,null))[_0x37f4('0x25')](saveUpdates(_0x403e79['body'],null))[_0x37f4('0x25')](respondWithResult(_0x2ca1c5,null))[_0x37f4('0x44')](handleError(_0x2ca1c5,null));};exports[_0x37f4('0x24')]=function(_0x1149f1,_0x21854d){return db[_0x37f4('0x2c')][_0x37f4('0x4a')]({'where':{'id':_0x1149f1[_0x37f4('0x46')]['id']}})[_0x37f4('0x25')](handleEntityNotFound(_0x21854d,null))['then'](removeEntity(_0x21854d,null))[_0x37f4('0x44')](handleError(_0x21854d,null));};exports[_0x37f4('0x4b')]=function(_0x159196,_0x403ada){return db[_0x37f4('0x2c')]['describe']()[_0x37f4('0x25')](respondWithResult(_0x403ada,null))[_0x37f4('0x44')](handleError(_0x403ada,null));}; \ No newline at end of file +var _0xcd4e=['fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','end','stack','name','index','map','VoiceDialReport','key','model','query','keys','filters','intersection','attributes'];(function(_0x1b3903,_0x430341){var _0x4dca6f=function(_0x4159e5){while(--_0x4159e5){_0x1b3903['push'](_0x1b3903['shift']());}};_0x4dca6f(++_0x430341);}(_0xcd4e,0x148));var _0xecd4=function(_0x1d3d93,_0x286537){_0x1d3d93=_0x1d3d93-0x0;var _0x10cd6d=_0xcd4e[_0x1d3d93];return _0x10cd6d;};'use strict';var emlformat=require(_0xecd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecd4('0x1'));var jsonpatch=require(_0xecd4('0x2'));var rp=require(_0xecd4('0x3'));var moment=require(_0xecd4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xecd4('0x5'));var util=require(_0xecd4('0x6'));var path=require('path');var sox=require(_0xecd4('0x7'));var csv=require(_0xecd4('0x8'));var ejs=require(_0xecd4('0x9'));var fs=require('fs');var fs_extra=require(_0xecd4('0xa'));var _=require('lodash');var squel=require(_0xecd4('0xb'));var crypto=require(_0xecd4('0xc'));var jsforce=require(_0xecd4('0xd'));var deskjs=require(_0xecd4('0xe'));var toCsv=require(_0xecd4('0x8'));var querystring=require(_0xecd4('0xf'));var Papa=require(_0xecd4('0x10'));var Redis=require(_0xecd4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xecd4('0x12'));var as=require(_0xecd4('0x13'));var hardwareService=require(_0xecd4('0x14'));var logger=require(_0xecd4('0x15'))(_0xecd4('0x16'));var utils=require(_0xecd4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xecd4('0x18'));var db=require(_0xecd4('0x19'))['db'];function respondWithStatusCode(_0x4ee3bd,_0x1ac91d){_0x1ac91d=_0x1ac91d||0xcc;return function(_0x1b3d74){if(_0x1b3d74){return _0x4ee3bd[_0xecd4('0x1a')](_0x1ac91d);}return _0x4ee3bd[_0xecd4('0x1b')](_0x1ac91d)['end']();};}function respondWithResult(_0x1a7334,_0x32c10e){_0x32c10e=_0x32c10e||0xc8;return function(_0x3094b8){if(_0x3094b8){return _0x1a7334['status'](_0x32c10e)['json'](_0x3094b8);}};}function respondWithFilteredResult(_0x10b60b,_0x1217d2){return function(_0x54f104){if(_0x54f104){var _0x52243c=typeof _0x1217d2[_0xecd4('0x1c')]===_0xecd4('0x1d')&&typeof _0x1217d2['limit']===_0xecd4('0x1d');var _0x22a764=_0x54f104[_0xecd4('0x1e')];var _0x2da3c7=_0x52243c?0x0:_0x1217d2[_0xecd4('0x1c')];var _0x57bac0=_0x52243c?_0x54f104[_0xecd4('0x1e')]:_0x1217d2['offset']+_0x1217d2[_0xecd4('0x1f')];var _0x5412ce;if(_0x57bac0>=_0x22a764){_0x57bac0=_0x22a764;_0x5412ce=0xc8;}else{_0x5412ce=0xce;}_0x10b60b['status'](_0x5412ce);return _0x10b60b[_0xecd4('0x20')](_0xecd4('0x21'),_0x2da3c7+'-'+_0x57bac0+'/'+_0x22a764)[_0xecd4('0x22')](_0x54f104);}return null;};}function patchUpdates(_0x4a6f68){return function(_0x8d83fd){try{jsonpatch[_0xecd4('0x23')](_0x8d83fd,_0x4a6f68,!![]);}catch(_0x4503ad){return BPromise['reject'](_0x4503ad);}return _0x8d83fd[_0xecd4('0x24')]();};}function saveUpdates(_0x21e76d,_0x15a7fb){return function(_0x4cde41){if(_0x4cde41){return _0x4cde41['update'](_0x21e76d)[_0xecd4('0x25')](function(_0x1b11a6){return _0x1b11a6;});}return null;};}function removeEntity(_0xf30502,_0x5d1589){return function(_0x18aa00){if(_0x18aa00){return _0x18aa00[_0xecd4('0x26')]()[_0xecd4('0x25')](function(){_0xf30502[_0xecd4('0x1b')](0xcc)[_0xecd4('0x27')]();});}};}function handleEntityNotFound(_0x4dde53,_0x58eb5c){return function(_0x10b29b){if(!_0x10b29b){_0x4dde53[_0xecd4('0x1a')](0x194);}return _0x10b29b;};}function handleError(_0xe57b56,_0x62497e){_0x62497e=_0x62497e||0x1f4;return function(_0x3bca39){logger['error'](_0x3bca39[_0xecd4('0x28')]);if(_0x3bca39[_0xecd4('0x29')]){delete _0x3bca39[_0xecd4('0x29')];}_0xe57b56[_0xecd4('0x1b')](_0x62497e)['send'](_0x3bca39);};}exports[_0xecd4('0x2a')]=function(_0x5009af,_0x160464){var _0x4f051e={},_0x4ce47f={},_0x4c3402={'count':0x0,'rows':[]};var _0x1d8725=_[_0xecd4('0x2b')](db[_0xecd4('0x2c')]['rawAttributes'],function(_0x13e31a){return{'name':_0x13e31a['fieldName'],'type':_0x13e31a['type'][_0xecd4('0x2d')]};});_0x4ce47f[_0xecd4('0x2e')]=_['map'](_0x1d8725,_0xecd4('0x29'));_0x4ce47f[_0xecd4('0x2f')]=_[_0xecd4('0x30')](_0x5009af[_0xecd4('0x2f')]);_0x4ce47f[_0xecd4('0x31')]=_[_0xecd4('0x32')](_0x4ce47f[_0xecd4('0x2e')],_0x4ce47f[_0xecd4('0x2f')]);_0x4f051e[_0xecd4('0x33')]=_[_0xecd4('0x32')](_0x4ce47f[_0xecd4('0x2e')],qs['fields'](_0x5009af[_0xecd4('0x2f')][_0xecd4('0x34')]));_0x4f051e[_0xecd4('0x33')]=_0x4f051e[_0xecd4('0x33')][_0xecd4('0x35')]?_0x4f051e[_0xecd4('0x33')]:_0x4ce47f['model'];if(!_0x5009af[_0xecd4('0x2f')]['hasOwnProperty'](_0xecd4('0x36'))){_0x4f051e[_0xecd4('0x1f')]=qs[_0xecd4('0x1f')](_0x5009af[_0xecd4('0x2f')][_0xecd4('0x1f')]);_0x4f051e[_0xecd4('0x1c')]=qs[_0xecd4('0x1c')](_0x5009af[_0xecd4('0x2f')][_0xecd4('0x1c')]);}_0x4f051e[_0xecd4('0x37')]=qs[_0xecd4('0x38')](_0x5009af[_0xecd4('0x2f')]['sort']);_0x4f051e['where']=qs['filters'](_[_0xecd4('0x39')](_0x5009af['query'],_0x4ce47f[_0xecd4('0x31')]),_0x1d8725);if(_0x5009af[_0xecd4('0x2f')][_0xecd4('0x3a')]){_0x4f051e[_0xecd4('0x3b')]=_[_0xecd4('0x3c')](_0x4f051e['where'],{'$or':_[_0xecd4('0x2b')](_0x1d8725,function(_0xefd21c){if(_0xefd21c[_0xecd4('0x3d')]!=='VIRTUAL'){var _0x180fda={};_0x180fda[_0xefd21c[_0xecd4('0x29')]]={'$like':'%'+_0x5009af[_0xecd4('0x2f')][_0xecd4('0x3a')]+'%'};return _0x180fda;}})});}_0x4f051e=_[_0xecd4('0x3c')]({},_0x4f051e,_0x5009af[_0xecd4('0x3e')]);var _0x568c28={'where':_0x4f051e[_0xecd4('0x3b')]};return db[_0xecd4('0x2c')][_0xecd4('0x1e')](_0x568c28)[_0xecd4('0x25')](function(_0x5f3f09){_0x4c3402[_0xecd4('0x1e')]=_0x5f3f09;if(_0x5009af[_0xecd4('0x2f')][_0xecd4('0x3f')]){_0x4f051e['include']=[{'all':!![]}];}return db[_0xecd4('0x2c')][_0xecd4('0x40')](_0x4f051e);})['then'](function(_0x1a6a55){_0x4c3402[_0xecd4('0x41')]=_0x1a6a55;return _0x4c3402;})[_0xecd4('0x25')](respondWithFilteredResult(_0x160464,_0x4f051e))[_0xecd4('0x42')](handleError(_0x160464,null));};exports[_0xecd4('0x43')]=function(_0x246987,_0x5058cb){var _0x3e5e29={'raw':!![],'where':{'id':_0x246987[_0xecd4('0x44')]['id']}},_0x162d08={};_0x162d08[_0xecd4('0x2e')]=_[_0xecd4('0x30')](db[_0xecd4('0x2c')][_0xecd4('0x45')]);_0x162d08[_0xecd4('0x2f')]=_['keys'](_0x246987['query']);_0x162d08[_0xecd4('0x31')]=_[_0xecd4('0x32')](_0x162d08[_0xecd4('0x2e')],_0x162d08['query']);_0x3e5e29[_0xecd4('0x33')]=_[_0xecd4('0x32')](_0x162d08[_0xecd4('0x2e')],qs['fields'](_0x246987[_0xecd4('0x2f')][_0xecd4('0x34')]));_0x3e5e29[_0xecd4('0x33')]=_0x3e5e29['attributes'][_0xecd4('0x35')]?_0x3e5e29[_0xecd4('0x33')]:_0x162d08[_0xecd4('0x2e')];if(_0x246987[_0xecd4('0x2f')][_0xecd4('0x3f')]){_0x3e5e29[_0xecd4('0x46')]=[{'all':!![]}];}_0x3e5e29=_[_0xecd4('0x3c')]({},_0x3e5e29,_0x246987[_0xecd4('0x3e')]);return db[_0xecd4('0x2c')][_0xecd4('0x47')](_0x3e5e29)[_0xecd4('0x25')](handleEntityNotFound(_0x5058cb,null))['then'](respondWithResult(_0x5058cb,null))['catch'](handleError(_0x5058cb,null));};exports[_0xecd4('0x48')]=function(_0x532cf,_0x3c421c){return db[_0xecd4('0x2c')][_0xecd4('0x48')](_0x532cf[_0xecd4('0x49')],{})[_0xecd4('0x25')](respondWithResult(_0x3c421c,0xc9))[_0xecd4('0x42')](handleError(_0x3c421c,null));};exports[_0xecd4('0x4a')]=function(_0x13d2e9,_0xe068c5){if(_0x13d2e9['body']['id']){delete _0x13d2e9['body']['id'];}return db[_0xecd4('0x2c')][_0xecd4('0x47')]({'where':{'id':_0x13d2e9[_0xecd4('0x44')]['id']}})['then'](handleEntityNotFound(_0xe068c5,null))[_0xecd4('0x25')](saveUpdates(_0x13d2e9[_0xecd4('0x49')],null))[_0xecd4('0x25')](respondWithResult(_0xe068c5,null))[_0xecd4('0x42')](handleError(_0xe068c5,null));};exports[_0xecd4('0x26')]=function(_0x200742,_0x34c4e7){return db[_0xecd4('0x2c')]['find']({'where':{'id':_0x200742[_0xecd4('0x44')]['id']}})[_0xecd4('0x25')](handleEntityNotFound(_0x34c4e7,null))[_0xecd4('0x25')](removeEntity(_0x34c4e7,null))[_0xecd4('0x42')](handleError(_0x34c4e7,null));};exports[_0xecd4('0x4b')]=function(_0x6cacc,_0x47cb77){return db[_0xecd4('0x2c')][_0xecd4('0x4b')]()[_0xecd4('0x25')](respondWithResult(_0x47cb77,null))[_0xecd4('0x42')](handleError(_0x47cb77,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index fcb7920..61eca41 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 _0x6a2a=['../../config/logger','bluebird','rimraf','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','util'];(function(_0xe0090f,_0x2dded1){var _0x5caf15=function(_0x4517ed){while(--_0x4517ed){_0xe0090f['push'](_0xe0090f['shift']());}};_0x5caf15(++_0x2dded1);}(_0x6a2a,0x1ee));var _0xa6a2=function(_0x2007e6,_0x43b204){_0x2007e6=_0x2007e6-0x0;var _0x31a410=_0x6a2a[_0x2007e6];return _0x31a410;};'use strict';var _=require('lodash');var util=require(_0xa6a2('0x0'));var logger=require(_0xa6a2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa6a2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6a2('0x3'));var config=require('../../config/environment');var attributes=require(_0xa6a2('0x4'));module[_0xa6a2('0x5')]=function(_0x414e1e,_0x3a104b){return _0x414e1e[_0xa6a2('0x6')]('VoiceDialReport',attributes,{'tableName':_0xa6a2('0x7'),'paranoid':![],'indexes':[{'fields':[_0xa6a2('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6aa=['request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','lodash','../../config/logger','api','moment','bluebird'];(function(_0x55f56b,_0x25e359){var _0x3c1559=function(_0x2c74d6){while(--_0x2c74d6){_0x55f56b['push'](_0x55f56b['shift']());}};_0x3c1559(++_0x25e359);}(_0xc6aa,0x127));var _0xac6a=function(_0x134f57,_0x2af7d8){_0x134f57=_0x134f57-0x0;var _0x47a386=_0xc6aa[_0x134f57];return _0x47a386;};'use strict';var _=require(_0xac6a('0x0'));var util=require('util');var logger=require(_0xac6a('0x1'))(_0xac6a('0x2'));var moment=require(_0xac6a('0x3'));var BPromise=require(_0xac6a('0x4'));var rp=require(_0xac6a('0x5'));var fs=require('fs');var path=require(_0xac6a('0x6'));var rimraf=require(_0xac6a('0x7'));var config=require('../../config/environment');var attributes=require(_0xac6a('0x8'));module[_0xac6a('0x9')]=function(_0x1785ae,_0x26bb19){return _0x1785ae[_0xac6a('0xa')](_0xac6a('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index f2bee0d..a456637 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 _0xba1e=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','catch','UpdateVoiceDialReport','body','where','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x352096,_0x3b02b0){var _0x3de2f6=function(_0xa46902){while(--_0xa46902){_0x352096['push'](_0x352096['shift']());}};_0x3de2f6(++_0x3b02b0);}(_0xba1e,0x198));var _0xeba1=function(_0x1f707f,_0xb97d26){_0x1f707f=_0x1f707f-0x0;var _0x30368b=_0xba1e[_0x1f707f];return _0x30368b;};'use strict';var _=require('lodash');var util=require(_0xeba1('0x0'));var moment=require(_0xeba1('0x1'));var BPromise=require('bluebird');var rs=require(_0xeba1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeba1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xeba1('0x4'))('rpc');var config=require(_0xeba1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xeba1('0x6')][_0xeba1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a99ad,_0x1acdfd,_0x48d98d){return new BPromise(function(_0x1c81aa,_0x5c7e47){return client[_0xeba1('0x8')](_0x4a99ad,_0x48d98d)[_0xeba1('0x9')](function(_0x17bd4f){logger['info'](_0xeba1('0xa'),_0x1acdfd,_0xeba1('0xb'));logger[_0xeba1('0xc')](_0xeba1('0xd'),_0x1acdfd,'request\x20sent',JSON['stringify'](_0x17bd4f));if(_0x17bd4f[_0xeba1('0xe')]){if(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0xf')]===0x1f4){logger[_0xeba1('0xe')](_0xeba1('0xa'),_0x1acdfd,_0x17bd4f['error']['message']);return _0x5c7e47(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1acdfd,_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);return _0x1c81aa(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);}else{logger[_0xeba1('0x11')](_0xeba1('0xa'),_0x1acdfd,_0xeba1('0xb'));_0x1c81aa(_0x17bd4f['result'][_0xeba1('0x10')]);}})['catch'](function(_0x265e63){logger['error'](_0xeba1('0xa'),_0x1acdfd,_0x265e63);_0x5c7e47(_0x265e63);});});}exports[_0xeba1('0x12')]=function(_0x28222e){var _0x31b9bc=this;return new Promise(function(_0x2a6ff2,_0x125430){return db[_0xeba1('0x13')][_0xeba1('0x14')](_0x28222e['body'],{'raw':_0x28222e[_0xeba1('0x15')]?_0x28222e['options'][_0xeba1('0x16')]===undefined?!![]:![]:!![]})[_0xeba1('0x9')](function(_0x3b1982){logger[_0xeba1('0x11')](_0xeba1('0x12'),_0x28222e);logger['debug'](_0xeba1('0x12'),_0x28222e,JSON[_0xeba1('0x17')](_0x3b1982));_0x2a6ff2(_0x3b1982);})[_0xeba1('0x18')](function(_0x1a35c3){logger['error']('CreateVoiceDialReport',_0x1a35c3[_0xeba1('0x10')],_0x28222e);_0x125430(_0x31b9bc['error'](0x1f4,_0x1a35c3[_0xeba1('0x10')]));});});};exports[_0xeba1('0x19')]=function(_0x1333a3){var _0x3eb44e=this;return new Promise(function(_0x3a63bb,_0x439298){return db[_0xeba1('0x13')]['update'](_0x1333a3[_0xeba1('0x1a')],{'raw':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1333a3[_0xeba1('0x15')]?_0x1333a3['options'][_0xeba1('0x1b')]||null:null,'attributes':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')][_0xeba1('0x1c')]||null:null,'limit':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')][_0xeba1('0x1d')]||null:null})[_0xeba1('0x9')](function(_0x17edbd){logger[_0xeba1('0x11')]('UpdateVoiceDialReport',_0x1333a3);logger['debug'](_0xeba1('0x19'),_0x1333a3,JSON[_0xeba1('0x17')](_0x17edbd));_0x3a63bb(_0x17edbd);})[_0xeba1('0x18')](function(_0x4ccd54){logger[_0xeba1('0xe')](_0xeba1('0x19'),_0x4ccd54[_0xeba1('0x10')],_0x1333a3);_0x439298(_0x3eb44e['error'](0x1f4,_0x4ccd54[_0xeba1('0x10')]));});});}; \ No newline at end of file +var _0xa388=['CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','limit','then','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa388,0x1da));var _0x8a38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa388[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8a38('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8a38('0x1'));var fs=require('fs');var Redis=require(_0x8a38('0x2'));var db=require(_0x8a38('0x3'))['db'];var utils=require(_0x8a38('0x4'));var logger=require(_0x8a38('0x5'))(_0x8a38('0x6'));var config=require(_0x8a38('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8a38('0x8')][_0x8a38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x222519,_0x333efd,_0x223f32){return new BPromise(function(_0xc42daf,_0x5f3fb3){return client[_0x8a38('0xa')](_0x222519,_0x223f32)['then'](function(_0x29bad9){logger[_0x8a38('0xb')](_0x8a38('0xc'),_0x333efd,_0x8a38('0xd'));logger[_0x8a38('0xe')](_0x8a38('0xf'),_0x333efd,_0x8a38('0xd'),JSON[_0x8a38('0x10')](_0x29bad9));if(_0x29bad9['error']){if(_0x29bad9[_0x8a38('0x11')][_0x8a38('0x12')]===0x1f4){logger['error'](_0x8a38('0xc'),_0x333efd,_0x29bad9['error'][_0x8a38('0x13')]);return _0x5f3fb3(_0x29bad9[_0x8a38('0x11')][_0x8a38('0x13')]);}logger[_0x8a38('0x11')](_0x8a38('0xc'),_0x333efd,_0x29bad9[_0x8a38('0x11')]['message']);return _0xc42daf(_0x29bad9[_0x8a38('0x11')][_0x8a38('0x13')]);}else{logger[_0x8a38('0xb')](_0x8a38('0xc'),_0x333efd,_0x8a38('0xd'));_0xc42daf(_0x29bad9['result'][_0x8a38('0x13')]);}})[_0x8a38('0x14')](function(_0x1badcb){logger[_0x8a38('0x11')](_0x8a38('0xc'),_0x333efd,_0x1badcb);_0x5f3fb3(_0x1badcb);});});}exports[_0x8a38('0x15')]=function(_0x37110d){var _0x45304e=this;return new Promise(function(_0x225f7b,_0x5e42d8){return db[_0x8a38('0x16')][_0x8a38('0x17')](_0x37110d[_0x8a38('0x18')],{'raw':_0x37110d[_0x8a38('0x19')]?_0x37110d[_0x8a38('0x19')][_0x8a38('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x24ccff){logger[_0x8a38('0xb')](_0x8a38('0x15'),_0x37110d);logger['debug'](_0x8a38('0x15'),_0x37110d,JSON[_0x8a38('0x10')](_0x24ccff));_0x225f7b(_0x24ccff);})[_0x8a38('0x14')](function(_0xee381){logger[_0x8a38('0x11')](_0x8a38('0x15'),_0xee381[_0x8a38('0x13')],_0x37110d);_0x5e42d8(_0x45304e['error'](0x1f4,_0xee381[_0x8a38('0x13')]));});});};exports[_0x8a38('0x1b')]=function(_0x102aaa){var _0x6431cf=this;return new Promise(function(_0x5cf4bf,_0x1cb562){return db['VoiceDialReport'][_0x8a38('0x1c')](_0x102aaa[_0x8a38('0x18')],{'raw':_0x102aaa[_0x8a38('0x19')]?_0x102aaa['options'][_0x8a38('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x102aaa['options']?_0x102aaa[_0x8a38('0x19')][_0x8a38('0x1d')]||null:null,'attributes':_0x102aaa[_0x8a38('0x19')]?_0x102aaa[_0x8a38('0x19')][_0x8a38('0x1e')]||null:null,'limit':_0x102aaa['options']?_0x102aaa['options'][_0x8a38('0x1f')]||null:null})[_0x8a38('0x20')](function(_0x29905f){logger[_0x8a38('0xb')]('UpdateVoiceDialReport',_0x102aaa);logger['debug']('UpdateVoiceDialReport',_0x102aaa,JSON[_0x8a38('0x10')](_0x29905f));_0x5cf4bf(_0x29905f);})['catch'](function(_0x1b4f5f){logger[_0x8a38('0x11')]('UpdateVoiceDialReport',_0x1b4f5f[_0x8a38('0x13')],_0x102aaa);_0x1cb562(_0x6431cf[_0x8a38('0x11')](0x1f4,_0x1b4f5f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a2f0eb3..7e44105 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 _0x2462=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','/:id/applications','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x28dce9,_0x39baf8){var _0x413a6a=function(_0x2931dd){while(--_0x2931dd){_0x28dce9['push'](_0x28dce9['shift']());}};_0x413a6a(++_0x39baf8);}(_0x2462,0x1c8));var _0x2246=function(_0x288e07,_0x390cdd){_0x288e07=_0x288e07-0x0;var _0xa08b86=_0x2462[_0x288e07];return _0xa08b86;};'use strict';var multer=require(_0x2246('0x0'));var util=require(_0x2246('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2246('0x2'));var router=express[_0x2246('0x3')]();var fs_extra=require(_0x2246('0x4'));var auth=require(_0x2246('0x5'));var interaction=require(_0x2246('0x6'));var config=require(_0x2246('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x2246('0x8')](),controller[_0x2246('0x9')]);router[_0x2246('0xa')](_0x2246('0xb'),auth[_0x2246('0x8')](),controller[_0x2246('0xc')]);router[_0x2246('0xd')]('/',auth['isAuthenticated'](),controller[_0x2246('0xe')]);router['post'](_0x2246('0xf'),auth[_0x2246('0x8')](),controller['addApplications']);router['put'](_0x2246('0xb'),auth[_0x2246('0x8')](),controller[_0x2246('0x10')]);router[_0x2246('0x11')]('/:id',auth[_0x2246('0x8')](),controller[_0x2246('0x12')]);module[_0x2246('0x13')]=router; \ No newline at end of file +var _0x24fc=['./voiceExtension.controller','get','index','/:id','isAuthenticated','post','create','/:id/applications','addApplications','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xdf3dbc,_0x3fbe15){var _0x2c23be=function(_0x907e7){while(--_0x907e7){_0xdf3dbc['push'](_0xdf3dbc['shift']());}};_0x2c23be(++_0x3fbe15);}(_0x24fc,0x75));var _0xc24f=function(_0x33a814,_0x4f94bc){_0x33a814=_0x33a814-0x0;var _0x29f4c3=_0x24fc[_0x33a814];return _0x29f4c3;};'use strict';var multer=require('multer');var util=require(_0xc24f('0x0'));var path=require(_0xc24f('0x1'));var timeout=require(_0xc24f('0x2'));var express=require(_0xc24f('0x3'));var router=express[_0xc24f('0x4')]();var fs_extra=require(_0xc24f('0x5'));var auth=require(_0xc24f('0x6'));var interaction=require(_0xc24f('0x7'));var config=require(_0xc24f('0x8'));var controller=require(_0xc24f('0x9'));router[_0xc24f('0xa')]('/',auth['isAuthenticated'](),controller[_0xc24f('0xb')]);router[_0xc24f('0xa')](_0xc24f('0xc'),auth[_0xc24f('0xd')](),controller['show']);router[_0xc24f('0xe')]('/',auth[_0xc24f('0xd')](),controller[_0xc24f('0xf')]);router['post'](_0xc24f('0x10'),auth[_0xc24f('0xd')](),controller[_0xc24f('0x11')]);router['put'](_0xc24f('0xc'),auth['isAuthenticated'](),controller[_0xc24f('0x12')]);router[_0xc24f('0x13')]('/:id',auth[_0xc24f('0xd')](),controller['destroy']);module[_0xc24f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ca354c5..82b644f 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x219e9b,_0x295d91){var _0x332e80=function(_0x567792){while(--_0x567792){_0x219e9b['push'](_0x219e9b['shift']());}};_0x332e80(++_0x295d91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a25f1e3..8d8bd0a 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 _0x3154=['ignore','map','value','includes','UserProfileResource','error','stack','name','send','VoiceExtension','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','options','find','params','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','destroy','then','get','InboundRoutes','OutboundRoutes','InternalRoutes','internal'];(function(_0x38b1fe,_0x53aedb){var _0x1b3f86=function(_0x2d4112){while(--_0x2d4112){_0x38b1fe['push'](_0x38b1fe['shift']());}};_0x1b3f86(++_0x53aedb);}(_0x3154,0xfe));var _0x4315=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3154[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4315('0x0'));var Redis=require(_0x4315('0x1'));var qs=require(_0x4315('0x2'));var logger=require(_0x4315('0x3'))(_0x4315('0x4'));var config=require(_0x4315('0x5'));var db=require(_0x4315('0x6'))['db'];config[_0x4315('0x7')]=_[_0x4315('0x8')](config[_0x4315('0x7')],{'host':_0x4315('0x9'),'port':0x18eb});var socket=require(_0x4315('0xa'))(new Redis(config[_0x4315('0x7')]));require('./voiceExtension.socket')[_0x4315('0xb')](socket);function respondWithStatusCode(_0x2e95d7,_0x23d381){_0x23d381=_0x23d381||0xcc;return function(_0x56274d){if(_0x56274d){return _0x2e95d7[_0x4315('0xc')](_0x23d381);}return _0x2e95d7[_0x4315('0xd')](_0x23d381)[_0x4315('0xe')]();};}function respondWithResult(_0x3bcf2b,_0x12c896){_0x12c896=_0x12c896||0xc8;return function(_0x5d2385){if(_0x5d2385){return _0x3bcf2b[_0x4315('0xd')](_0x12c896)[_0x4315('0xf')](_0x5d2385);}};}function respondWithFilteredResult(_0x3147fa,_0x551ce1){return function(_0x4b7f81){if(_0x4b7f81){var _0xf5e9f0=typeof _0x551ce1['offset']==='undefined'&&typeof _0x551ce1[_0x4315('0x10')]===_0x4315('0x11');var _0xc7e8bf=_0x4b7f81[_0x4315('0x12')];var _0x558cc7=_0xf5e9f0?0x0:_0x551ce1[_0x4315('0x13')];var _0x154def=_0xf5e9f0?_0x4b7f81['count']:_0x551ce1[_0x4315('0x13')]+_0x551ce1[_0x4315('0x10')];var _0x3f99f2;if(_0x154def>=_0xc7e8bf){_0x154def=_0xc7e8bf;_0x3f99f2=0xc8;}else{_0x3f99f2=0xce;}_0x3147fa[_0x4315('0xd')](_0x3f99f2);return _0x3147fa['set'](_0x4315('0x14'),_0x558cc7+'-'+_0x154def+'/'+_0xc7e8bf)[_0x4315('0xf')](_0x4b7f81);}return null;};}function removeEntity(_0x5a2bcf){return function(_0x3efff2){if(_0x3efff2){return _0x3efff2[_0x4315('0x15')]()[_0x4315('0x16')](function(){var _0x9f0a93=_0x3efff2[_0x4315('0x17')]({'plain':!![]});var _0x44b5b9=[{'name':_0x4315('0x18'),'value':'inbound','ignore':![]},{'name':_0x4315('0x19'),'value':'outbound','ignore':![]},{'name':_0x4315('0x1a'),'value':_0x4315('0x1b'),'ignore':![]}];var _0x323c2a=_(_0x44b5b9)['filter'](_0x4315('0x1c'))[_0x4315('0x1d')]('value')[_0x4315('0x1e')]();if(_[_0x4315('0x1f')](_0x323c2a,_0x9f0a93['type'])){return;}var _0x2cd595=_['find'](_0x44b5b9,[_0x4315('0x1e'),_0x9f0a93['type']])['name'];return db[_0x4315('0x20')][_0x4315('0x15')]({'where':{'type':_0x2cd595,'resourceId':_0x9f0a93['id']}})[_0x4315('0x16')](function(){return _0x3efff2;});})[_0x4315('0x16')](function(){_0x5a2bcf[_0x4315('0xd')](0xcc)[_0x4315('0xe')]();});}};}function handleEntityNotFound(_0x23df46){return function(_0x195dcb){if(!_0x195dcb){_0x23df46[_0x4315('0xc')](0x194);}return _0x195dcb;};}function handleError(_0x55d224,_0xdd3ec7){_0xdd3ec7=_0xdd3ec7||0x1f4;return function(_0x3bea9e){logger[_0x4315('0x21')](_0x3bea9e[_0x4315('0x22')]);if(_0x3bea9e[_0x4315('0x23')]){delete _0x3bea9e[_0x4315('0x23')];}_0x55d224[_0x4315('0xd')](_0xdd3ec7)[_0x4315('0x24')](_0x3bea9e);};}exports['index']=function(_0x2eef9e,_0x377efd){var _0xc0eb46={},_0x420b1b={},_0x19ccc9={'count':0x0,'rows':[]};var _0x44b7bc=_['map'](db[_0x4315('0x25')][_0x4315('0x26')],function(_0x28eac8){return{'name':_0x28eac8['fieldName'],'type':_0x28eac8[_0x4315('0x27')][_0x4315('0x28')]};});_0x420b1b[_0x4315('0x29')]=_[_0x4315('0x1d')](_0x44b7bc,_0x4315('0x23'));_0x420b1b[_0x4315('0x2a')]=_['keys'](_0x2eef9e['query']);_0x420b1b[_0x4315('0x2b')]=_[_0x4315('0x2c')](_0x420b1b[_0x4315('0x29')],_0x420b1b[_0x4315('0x2a')]);_0xc0eb46[_0x4315('0x2d')]=_[_0x4315('0x2c')](_0x420b1b['model'],qs[_0x4315('0x2e')](_0x2eef9e[_0x4315('0x2a')][_0x4315('0x2e')]));_0xc0eb46[_0x4315('0x2d')]=_0xc0eb46['attributes'][_0x4315('0x2f')]?_0xc0eb46['attributes']:_0x420b1b[_0x4315('0x29')];if(!_0x2eef9e[_0x4315('0x2a')]['hasOwnProperty'](_0x4315('0x30'))){_0xc0eb46[_0x4315('0x10')]=qs['limit'](_0x2eef9e['query'][_0x4315('0x10')]);_0xc0eb46[_0x4315('0x13')]=qs[_0x4315('0x13')](_0x2eef9e[_0x4315('0x2a')][_0x4315('0x13')]);}_0xc0eb46[_0x4315('0x31')]=qs[_0x4315('0x32')](_0x2eef9e[_0x4315('0x2a')][_0x4315('0x32')]);_0xc0eb46[_0x4315('0x33')]=qs[_0x4315('0x2b')](_[_0x4315('0x34')](_0x2eef9e['query'],_0x420b1b[_0x4315('0x2b')]),_0x44b7bc);if(_0x2eef9e[_0x4315('0x2a')][_0x4315('0x35')]){_0xc0eb46[_0x4315('0x33')]=_[_0x4315('0x36')](_0xc0eb46[_0x4315('0x33')],{'$or':_[_0x4315('0x1d')](_0x44b7bc,function(_0x1b2422){if(_0x1b2422[_0x4315('0x27')]!==_0x4315('0x37')){var _0x515634={};_0x515634[_0x1b2422[_0x4315('0x23')]]={'$like':'%'+_0x2eef9e[_0x4315('0x2a')][_0x4315('0x35')]+'%'};return _0x515634;}})});}_0xc0eb46=_['merge']({},_0xc0eb46,_0x2eef9e['options']);var _0x5050ea={'where':_0xc0eb46[_0x4315('0x33')]};return db['VoiceExtension'][_0x4315('0x12')](_0x5050ea)[_0x4315('0x16')](function(_0x3380a7){_0x19ccc9[_0x4315('0x12')]=_0x3380a7;if(_0x2eef9e[_0x4315('0x2a')][_0x4315('0x38')]){_0xc0eb46[_0x4315('0x39')]=[{'all':!![]}];}return db[_0x4315('0x25')][_0x4315('0x3a')](_0xc0eb46);})['then'](function(_0x1bd212){_0x19ccc9[_0x4315('0x3b')]=_0x1bd212;return _0x19ccc9;})[_0x4315('0x16')](respondWithFilteredResult(_0x377efd,_0xc0eb46))[_0x4315('0x3c')](handleError(_0x377efd,null));};exports['show']=function(_0x5138a6,_0x3edb1d){var _0x45a7d6={'raw':![],'where':{'id':_0x5138a6['params']['id']}},_0x12da19={};_0x12da19['model']=_[_0x4315('0x3d')](db[_0x4315('0x25')][_0x4315('0x26')]);_0x12da19[_0x4315('0x2a')]=_[_0x4315('0x3d')](_0x5138a6[_0x4315('0x2a')]);_0x12da19[_0x4315('0x2b')]=_[_0x4315('0x2c')](_0x12da19[_0x4315('0x29')],_0x12da19['query']);_0x45a7d6[_0x4315('0x2d')]=_['intersection'](_0x12da19[_0x4315('0x29')],qs[_0x4315('0x2e')](_0x5138a6['query'][_0x4315('0x2e')]));_0x45a7d6['attributes']=_0x45a7d6['attributes'][_0x4315('0x2f')]?_0x45a7d6[_0x4315('0x2d')]:_0x12da19[_0x4315('0x29')];if(_0x5138a6[_0x4315('0x2a')][_0x4315('0x38')]){_0x45a7d6[_0x4315('0x39')]=[{'all':!![]}];}_0x45a7d6=_[_0x4315('0x36')]({},_0x45a7d6,_0x5138a6[_0x4315('0x3e')]);return db[_0x4315('0x25')][_0x4315('0x3f')](_0x45a7d6)[_0x4315('0x16')](handleEntityNotFound(_0x3edb1d,null))[_0x4315('0x16')](respondWithResult(_0x3edb1d,null))[_0x4315('0x3c')](handleError(_0x3edb1d,null));};exports[_0x4315('0x15')]=function(_0x503ff9,_0x14a480){return db[_0x4315('0x25')]['find']({'where':{'id':_0x503ff9[_0x4315('0x40')]['id']}})[_0x4315('0x16')](handleEntityNotFound(_0x14a480,null))[_0x4315('0x16')](removeEntity(_0x14a480,null))[_0x4315('0x3c')](handleError(_0x14a480,null));};exports[_0x4315('0x41')]=function(_0x167eb5,_0x467bbb){if(_0x167eb5[_0x4315('0x42')][_0x4315('0x27')]===_0x4315('0x43')&&!_[_0x4315('0x44')](_0x167eb5[_0x4315('0x42')][_0x4315('0x45')],'_')){_0x167eb5['body'][_0x4315('0x45')]='_'[_0x4315('0x46')](_0x167eb5[_0x4315('0x42')]['exten']);}return db['VoiceExtension'][_0x4315('0x41')](_0x167eb5['body'],{'raw':![]})[_0x4315('0x16')](function(_0x3732ab){var _0x383c26=_0x167eb5[_0x4315('0x47')]['get']({'plain':!![]});if(!_0x383c26)throw new Error(_0x4315('0x48'));if(_0x383c26['role']===_0x4315('0x47')){var _0x2b8cb0=_0x3732ab[_0x4315('0x17')]({'plain':!![]});var _0x221210=[{'name':_0x4315('0x18'),'value':_0x4315('0x49')},{'name':_0x4315('0x19'),'value':_0x4315('0x43')},{'name':_0x4315('0x1a'),'value':_0x4315('0x1b')}];var _0x493e36=_[_0x4315('0x3f')](_0x221210,['value',_0x2b8cb0['type']])['name'];return db['UserProfileSection'][_0x4315('0x3f')]({'where':{'name':_0x493e36,'userProfileId':_0x383c26[_0x4315('0x4a')]},'raw':!![]})['then'](function(_0x4294b9){if(_0x4294b9&&_0x4294b9[_0x4315('0x4b')]===0x0){return db[_0x4315('0x20')][_0x4315('0x41')]({'name':_0x2b8cb0['name'],'resourceId':_0x2b8cb0['id'],'type':_0x4294b9['name'],'sectionId':_0x4294b9['id']},{})[_0x4315('0x16')](function(){return _0x3732ab;});}else{return _0x3732ab;}})['catch'](function(_0x415499){logger[_0x4315('0x21')](_0x4315('0x4c'),_0x415499);throw _0x415499;});}return _0x3732ab;})['then'](respondWithResult(_0x467bbb,0xc9))[_0x4315('0x3c')](handleError(_0x467bbb,null));};exports[_0x4315('0x4d')]=function(_0xe8983f,_0x30d101){if(_0xe8983f[_0x4315('0x42')]['id']){delete _0xe8983f[_0x4315('0x42')]['id'];}return db[_0x4315('0x25')]['find']({'where':{'id':_0xe8983f[_0x4315('0x40')]['id']}})[_0x4315('0x16')](handleEntityNotFound(_0x30d101,null))[_0x4315('0x16')](function(_0x51c273){if(_0x51c273){return db['VoiceExtension'][_0x4315('0x4d')](_[_0x4315('0x34')](_0xe8983f[_0x4315('0x42')],[_0x4315('0x45'),_0x4315('0x4e'),'description',_0x4315('0x4f'),_0x4315('0x50'),_0x4315('0x51'),_0x4315('0x52')]),{'where':{'context':_0x51c273['context'],'exten':_0x51c273[_0x4315('0x45')]},'individualHooks':!![]})[_0x4315('0x16')](function(_0x2d2757){return _0x2d2757;});}return null;})[_0x4315('0x16')](respondWithStatusCode(_0x30d101,null))[_0x4315('0x3c')](handleError(_0x30d101,null));};exports[_0x4315('0x53')]=function(_0x4629bd,_0x12c6c3){var _0x4fa3d1=_0x4629bd[_0x4315('0x40')]['id'];var _0x3be75e=_0x4629bd['body'];var _0x2c4ebd=0xc8;var _0x3ad4b1=null;return db[_0x4315('0x54')]['transaction']({'isolationLevel':db['sequelize'][_0x4315('0x55')][_0x4315('0x56')][_0x4315('0x57')]},function(_0x170809){return db['VoiceExtension'][_0x4315('0x58')]({'where':{'id':_0x4fa3d1},'transaction':_0x170809})[_0x4315('0x16')](function(_0x440f4e){if(_0x440f4e){return db[_0x4315('0x25')][_0x4315('0x15')]({'where':{'VoiceExtensionId':_0x4fa3d1},'transaction':_0x170809})[_0x4315('0x16')](function(){var _0x1c5f38=_[_0x4315('0x1d')](_0x3be75e,function(_0x78d0a5){_0x78d0a5[_0x4315('0x59')]=_0x4fa3d1;_0x78d0a5[_0x4315('0x5a')]=!![];return _0x78d0a5;});return _0x440f4e[_0x4315('0x5b')](_0x1c5f38);})[_0x4315('0x16')](function(_0x50d7cd){return db['VoiceExtension'][_0x4315('0x5c')](_0x50d7cd,{'transaction':_0x170809});});}else{_0x2c4ebd=0x194;_0x3ad4b1=[];}});})[_0x4315('0x16')](function(){if(_0x2c4ebd!==0x194){return db[_0x4315('0x25')][_0x4315('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4fa3d1},'order':'cast(priority\x20as\x20unsigned)'})[_0x4315('0x16')](function(_0x31ad9b){_0x3ad4b1=_0x31ad9b;});}})[_0x4315('0x3c')](function(_0x3b3737){_0x2c4ebd=0x1f4;logger[_0x4315('0x21')](_0x3b3737['stack']);if(_0x3b3737['name']){delete _0x3b3737['name'];}_0x3ad4b1=_0x3b3737;})['finally'](function(){if(_0x3ad4b1===null){_0x12c6c3['sendStatus'](_0x2c4ebd);}else{if(_0x2c4ebd===0x1f4){_0x12c6c3[_0x4315('0xd')](_0x2c4ebd)[_0x4315('0x24')](_0x3ad4b1);}else{_0x12c6c3[_0x4315('0xd')](_0x2c4ebd)['json'](_0x3ad4b1);}}});}; \ No newline at end of file +var _0x165c=['get','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','alias','addApplications','sequelize','ISOLATION_LEVELS','findOne','VoiceExtensionId','createRouting','findAndCountAll','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','then','InboundRoutes','OutboundRoutes','InternalRoutes','internal','ignore','value','includes','type','find','UserProfileResource','destroy','error','stack','name','index','map','VoiceExtension','fieldName','key','model','query','intersection','attributes','fields','length','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','keys','include','catch','create','body','outbound','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xd765e7,_0x29faa0){var _0x1d6ded=function(_0x29ea60){while(--_0x29ea60){_0xd765e7['push'](_0xd765e7['shift']());}};_0x1d6ded(++_0x29faa0);}(_0x165c,0x128));var _0xc165=function(_0x31d97a,_0x13b7b9){_0x31d97a=_0x31d97a-0x0;var _0x314a7f=_0x165c[_0x31d97a];return _0x314a7f;};'use strict';var _=require(_0xc165('0x0'));var Redis=require(_0xc165('0x1'));var qs=require(_0xc165('0x2'));var logger=require(_0xc165('0x3'))(_0xc165('0x4'));var config=require(_0xc165('0x5'));var db=require(_0xc165('0x6'))['db'];config[_0xc165('0x7')]=_[_0xc165('0x8')](config['redis'],{'host':_0xc165('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc165('0x7')]));require(_0xc165('0xa'))[_0xc165('0xb')](socket);function respondWithStatusCode(_0x35a4b4,_0x41f08b){_0x41f08b=_0x41f08b||0xcc;return function(_0x5b8c6c){if(_0x5b8c6c){return _0x35a4b4[_0xc165('0xc')](_0x41f08b);}return _0x35a4b4['status'](_0x41f08b)[_0xc165('0xd')]();};}function respondWithResult(_0x35a36f,_0x16c37e){_0x16c37e=_0x16c37e||0xc8;return function(_0x57a2d4){if(_0x57a2d4){return _0x35a36f[_0xc165('0xe')](_0x16c37e)[_0xc165('0xf')](_0x57a2d4);}};}function respondWithFilteredResult(_0x5f44a2,_0x3e4fc6){return function(_0x1415ef){if(_0x1415ef){var _0x1add6c=typeof _0x3e4fc6[_0xc165('0x10')]==='undefined'&&typeof _0x3e4fc6[_0xc165('0x11')]===_0xc165('0x12');var _0x176b13=_0x1415ef[_0xc165('0x13')];var _0x5570c4=_0x1add6c?0x0:_0x3e4fc6[_0xc165('0x10')];var _0x341ae7=_0x1add6c?_0x1415ef[_0xc165('0x13')]:_0x3e4fc6[_0xc165('0x10')]+_0x3e4fc6[_0xc165('0x11')];var _0x156664;if(_0x341ae7>=_0x176b13){_0x341ae7=_0x176b13;_0x156664=0xc8;}else{_0x156664=0xce;}_0x5f44a2[_0xc165('0xe')](_0x156664);return _0x5f44a2[_0xc165('0x14')](_0xc165('0x15'),_0x5570c4+'-'+_0x341ae7+'/'+_0x176b13)[_0xc165('0xf')](_0x1415ef);}return null;};}function removeEntity(_0x16c572){return function(_0x4c8166){if(_0x4c8166){return _0x4c8166['destroy']()[_0xc165('0x16')](function(){var _0x5d9213=_0x4c8166['get']({'plain':!![]});var _0x1ac326=[{'name':_0xc165('0x17'),'value':'inbound','ignore':![]},{'name':_0xc165('0x18'),'value':'outbound','ignore':![]},{'name':_0xc165('0x19'),'value':_0xc165('0x1a'),'ignore':![]}];var _0x272c8c=_(_0x1ac326)['filter'](_0xc165('0x1b'))['map'](_0xc165('0x1c'))[_0xc165('0x1c')]();if(_[_0xc165('0x1d')](_0x272c8c,_0x5d9213[_0xc165('0x1e')])){return;}var _0x2a5fba=_[_0xc165('0x1f')](_0x1ac326,[_0xc165('0x1c'),_0x5d9213[_0xc165('0x1e')]])['name'];return db[_0xc165('0x20')][_0xc165('0x21')]({'where':{'type':_0x2a5fba,'resourceId':_0x5d9213['id']}})[_0xc165('0x16')](function(){return _0x4c8166;});})[_0xc165('0x16')](function(){_0x16c572[_0xc165('0xe')](0xcc)[_0xc165('0xd')]();});}};}function handleEntityNotFound(_0x5a05dc){return function(_0x23f554){if(!_0x23f554){_0x5a05dc[_0xc165('0xc')](0x194);}return _0x23f554;};}function handleError(_0x44cee5,_0x55eed1){_0x55eed1=_0x55eed1||0x1f4;return function(_0x16c577){logger[_0xc165('0x22')](_0x16c577[_0xc165('0x23')]);if(_0x16c577[_0xc165('0x24')]){delete _0x16c577[_0xc165('0x24')];}_0x44cee5[_0xc165('0xe')](_0x55eed1)['send'](_0x16c577);};}exports[_0xc165('0x25')]=function(_0x581a0a,_0x9e3467){var _0x552ca1={},_0x1ff0fb={},_0x326539={'count':0x0,'rows':[]};var _0x5b7d8b=_[_0xc165('0x26')](db[_0xc165('0x27')]['rawAttributes'],function(_0xd0d887){return{'name':_0xd0d887[_0xc165('0x28')],'type':_0xd0d887[_0xc165('0x1e')][_0xc165('0x29')]};});_0x1ff0fb[_0xc165('0x2a')]=_[_0xc165('0x26')](_0x5b7d8b,_0xc165('0x24'));_0x1ff0fb[_0xc165('0x2b')]=_['keys'](_0x581a0a[_0xc165('0x2b')]);_0x1ff0fb['filters']=_[_0xc165('0x2c')](_0x1ff0fb['model'],_0x1ff0fb['query']);_0x552ca1[_0xc165('0x2d')]=_[_0xc165('0x2c')](_0x1ff0fb[_0xc165('0x2a')],qs[_0xc165('0x2e')](_0x581a0a[_0xc165('0x2b')]['fields']));_0x552ca1[_0xc165('0x2d')]=_0x552ca1[_0xc165('0x2d')][_0xc165('0x2f')]?_0x552ca1['attributes']:_0x1ff0fb[_0xc165('0x2a')];if(!_0x581a0a[_0xc165('0x2b')]['hasOwnProperty']('nolimit')){_0x552ca1[_0xc165('0x11')]=qs[_0xc165('0x11')](_0x581a0a['query']['limit']);_0x552ca1[_0xc165('0x10')]=qs[_0xc165('0x10')](_0x581a0a[_0xc165('0x2b')][_0xc165('0x10')]);}_0x552ca1[_0xc165('0x30')]=qs['sort'](_0x581a0a[_0xc165('0x2b')]['sort']);_0x552ca1[_0xc165('0x31')]=qs[_0xc165('0x32')](_[_0xc165('0x33')](_0x581a0a[_0xc165('0x2b')],_0x1ff0fb[_0xc165('0x32')]),_0x5b7d8b);if(_0x581a0a['query'][_0xc165('0x34')]){_0x552ca1[_0xc165('0x31')]=_[_0xc165('0x35')](_0x552ca1[_0xc165('0x31')],{'$or':_[_0xc165('0x26')](_0x5b7d8b,function(_0x34e85f){if(_0x34e85f['type']!==_0xc165('0x36')){var _0x1471ff={};_0x1471ff[_0x34e85f['name']]={'$like':'%'+_0x581a0a[_0xc165('0x2b')][_0xc165('0x34')]+'%'};return _0x1471ff;}})});}_0x552ca1=_[_0xc165('0x35')]({},_0x552ca1,_0x581a0a[_0xc165('0x37')]);var _0x295dde={'where':_0x552ca1[_0xc165('0x31')]};return db[_0xc165('0x27')][_0xc165('0x13')](_0x295dde)[_0xc165('0x16')](function(_0x2a17df){_0x326539[_0xc165('0x13')]=_0x2a17df;if(_0x581a0a[_0xc165('0x2b')][_0xc165('0x38')]){_0x552ca1['include']=[{'all':!![]}];}return db[_0xc165('0x27')][_0xc165('0x39')](_0x552ca1);})['then'](function(_0x20202f){_0x326539[_0xc165('0x3a')]=_0x20202f;return _0x326539;})[_0xc165('0x16')](respondWithFilteredResult(_0x9e3467,_0x552ca1))['catch'](handleError(_0x9e3467,null));};exports[_0xc165('0x3b')]=function(_0x1f50fc,_0x6d0d65){var _0x3e9b7e={'raw':![],'where':{'id':_0x1f50fc[_0xc165('0x3c')]['id']}},_0x2484ff={};_0x2484ff[_0xc165('0x2a')]=_['keys'](db[_0xc165('0x27')][_0xc165('0x3d')]);_0x2484ff[_0xc165('0x2b')]=_[_0xc165('0x3e')](_0x1f50fc[_0xc165('0x2b')]);_0x2484ff[_0xc165('0x32')]=_['intersection'](_0x2484ff['model'],_0x2484ff['query']);_0x3e9b7e[_0xc165('0x2d')]=_[_0xc165('0x2c')](_0x2484ff[_0xc165('0x2a')],qs[_0xc165('0x2e')](_0x1f50fc[_0xc165('0x2b')][_0xc165('0x2e')]));_0x3e9b7e['attributes']=_0x3e9b7e[_0xc165('0x2d')][_0xc165('0x2f')]?_0x3e9b7e[_0xc165('0x2d')]:_0x2484ff['model'];if(_0x1f50fc['query'][_0xc165('0x38')]){_0x3e9b7e[_0xc165('0x3f')]=[{'all':!![]}];}_0x3e9b7e=_[_0xc165('0x35')]({},_0x3e9b7e,_0x1f50fc[_0xc165('0x37')]);return db[_0xc165('0x27')][_0xc165('0x1f')](_0x3e9b7e)[_0xc165('0x16')](handleEntityNotFound(_0x6d0d65,null))[_0xc165('0x16')](respondWithResult(_0x6d0d65,null))['catch'](handleError(_0x6d0d65,null));};exports['destroy']=function(_0x1cf32c,_0x121805){return db[_0xc165('0x27')][_0xc165('0x1f')]({'where':{'id':_0x1cf32c[_0xc165('0x3c')]['id']}})['then'](handleEntityNotFound(_0x121805,null))['then'](removeEntity(_0x121805,null))[_0xc165('0x40')](handleError(_0x121805,null));};exports[_0xc165('0x41')]=function(_0x152baa,_0x4e9f34){if(_0x152baa[_0xc165('0x42')][_0xc165('0x1e')]===_0xc165('0x43')&&!_['startsWith'](_0x152baa['body'][_0xc165('0x44')],'_')){_0x152baa[_0xc165('0x42')][_0xc165('0x44')]='_'['concat'](_0x152baa['body'][_0xc165('0x44')]);}return db[_0xc165('0x27')]['create'](_0x152baa[_0xc165('0x42')],{'raw':![]})[_0xc165('0x16')](function(_0xb5139c){var _0x56f00a=_0x152baa[_0xc165('0x45')]['get']({'plain':!![]});if(!_0x56f00a)throw new Error(_0xc165('0x46'));if(_0x56f00a[_0xc165('0x47')]===_0xc165('0x45')){var _0x5794f9=_0xb5139c[_0xc165('0x48')]({'plain':!![]});var _0x20085c=[{'name':_0xc165('0x17'),'value':_0xc165('0x49')},{'name':_0xc165('0x18'),'value':'outbound'},{'name':_0xc165('0x19'),'value':_0xc165('0x1a')}];var _0x315f82=_[_0xc165('0x1f')](_0x20085c,['value',_0x5794f9[_0xc165('0x1e')]])['name'];return db[_0xc165('0x4a')][_0xc165('0x1f')]({'where':{'name':_0x315f82,'userProfileId':_0x56f00a[_0xc165('0x4b')]},'raw':!![]})['then'](function(_0x4a3edd){if(_0x4a3edd&&_0x4a3edd[_0xc165('0x4c')]===0x0){return db[_0xc165('0x20')][_0xc165('0x41')]({'name':_0x5794f9[_0xc165('0x24')],'resourceId':_0x5794f9['id'],'type':_0x4a3edd[_0xc165('0x24')],'sectionId':_0x4a3edd['id']},{})['then'](function(){return _0xb5139c;});}else{return _0xb5139c;}})[_0xc165('0x40')](function(_0x1a91f5){logger[_0xc165('0x22')](_0xc165('0x4d'),_0x1a91f5);throw _0x1a91f5;});}return _0xb5139c;})['then'](respondWithResult(_0x4e9f34,0xc9))['catch'](handleError(_0x4e9f34,null));};exports['update']=function(_0x52a90a,_0x1134c9){if(_0x52a90a['body']['id']){delete _0x52a90a[_0xc165('0x42')]['id'];}return db['VoiceExtension'][_0xc165('0x1f')]({'where':{'id':_0x52a90a[_0xc165('0x3c')]['id']}})[_0xc165('0x16')](handleEntityNotFound(_0x1134c9,null))[_0xc165('0x16')](function(_0x27c789){if(_0x27c789){return db[_0xc165('0x27')][_0xc165('0x4e')](_[_0xc165('0x33')](_0x52a90a[_0xc165('0x42')],['exten',_0xc165('0x4f'),_0xc165('0x50'),_0xc165('0x51'),_0xc165('0x52'),'mandatoryDisposition',_0xc165('0x53')]),{'where':{'context':_0x27c789[_0xc165('0x4f')],'exten':_0x27c789[_0xc165('0x44')]},'individualHooks':!![]})[_0xc165('0x16')](function(_0x3613e2){return _0x3613e2;});}return null;})['then'](respondWithStatusCode(_0x1134c9,null))[_0xc165('0x40')](handleError(_0x1134c9,null));};exports[_0xc165('0x54')]=function(_0xc568c6,_0x246e6a){var _0x1f7ca1=_0xc568c6['params']['id'];var _0x228fc7=_0xc568c6[_0xc165('0x42')];var _0x5b4932=0xc8;var _0x1f96df=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xc165('0x55')]['Transaction'][_0xc165('0x56')]['READ_COMMITTED']},function(_0x23ba4b){return db[_0xc165('0x27')][_0xc165('0x57')]({'where':{'id':_0x1f7ca1},'transaction':_0x23ba4b})[_0xc165('0x16')](function(_0x4e701a){if(_0x4e701a){return db[_0xc165('0x27')][_0xc165('0x21')]({'where':{'VoiceExtensionId':_0x1f7ca1},'transaction':_0x23ba4b})[_0xc165('0x16')](function(){var _0x5c328e=_[_0xc165('0x26')](_0x228fc7,function(_0x3ad605){_0x3ad605[_0xc165('0x58')]=_0x1f7ca1;_0x3ad605['isApp']=!![];return _0x3ad605;});return _0x4e701a[_0xc165('0x59')](_0x5c328e);})[_0xc165('0x16')](function(_0x3859d0){return db[_0xc165('0x27')]['bulkCreate'](_0x3859d0,{'transaction':_0x23ba4b});});}else{_0x5b4932=0x194;_0x1f96df=[];}});})[_0xc165('0x16')](function(){if(_0x5b4932!==0x194){return db[_0xc165('0x27')][_0xc165('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1f7ca1},'order':'cast(priority\x20as\x20unsigned)'})[_0xc165('0x16')](function(_0x888d97){_0x1f96df=_0x888d97;});}})[_0xc165('0x40')](function(_0x35c9af){_0x5b4932=0x1f4;logger[_0xc165('0x22')](_0x35c9af[_0xc165('0x23')]);if(_0x35c9af['name']){delete _0x35c9af[_0xc165('0x24')];}_0x1f96df=_0x35c9af;})['finally'](function(){if(_0x1f96df===null){_0x246e6a[_0xc165('0xc')](_0x5b4932);}else{if(_0x5b4932===0x1f4){_0x246e6a['status'](_0x5b4932)[_0xc165('0x5b')](_0x1f96df);}else{_0x246e6a[_0xc165('0xe')](_0x5b4932)[_0xc165('0xf')](_0x1f96df);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e9fc1c3..06a090b 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 _0xc990=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','save','update','remove','emit'];(function(_0x386af8,_0x377b3e){var _0x16ca73=function(_0x5bddeb){while(--_0x5bddeb){_0x386af8['push'](_0x386af8['shift']());}};_0x16ca73(++_0x377b3e);}(_0xc990,0x1a7));var _0x0c99=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xc990[_0x279d37];return _0x530173;};'use strict';var EventEmitter=require(_0x0c99('0x0'));var VoiceExtension=require(_0x0c99('0x1'))['db'][_0x0c99('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0c99('0x3'),'afterUpdate':_0x0c99('0x4'),'afterDestroy':_0x0c99('0x5')};function emitEvent(_0x484e73){return function(_0x8c77d9,_0x1a776f,_0x5b18b8){VoiceExtensionEvents[_0x0c99('0x6')](_0x484e73+':'+_0x8c77d9['id'],_0x8c77d9);VoiceExtensionEvents['emit'](_0x484e73,_0x8c77d9);_0x5b18b8(null);};}for(var e in events){if(events[_0x0c99('0x7')](e)){var event=events[e];VoiceExtension[_0x0c99('0x8')](e,emitEvent(event));}}module[_0x0c99('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x833e=['events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1e9300,_0x1cd496){var _0x39573d=function(_0x327de2){while(--_0x327de2){_0x1e9300['push'](_0x1e9300['shift']());}};_0x39573d(++_0x1cd496);}(_0x833e,0x104));var _0xe833=function(_0x228ed3,_0x2eb76a){_0x228ed3=_0x228ed3-0x0;var _0x4f3da3=_0x833e[_0x228ed3];return _0x4f3da3;};'use strict';var EventEmitter=require(_0xe833('0x0'));var VoiceExtension=require(_0xe833('0x1'))['db'][_0xe833('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe833('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe833('0x4'),'afterDestroy':_0xe833('0x5')};function emitEvent(_0x5252bc){return function(_0x53e0f4,_0x9b7d6e,_0x5c59af){VoiceExtensionEvents['emit'](_0x5252bc+':'+_0x53e0f4['id'],_0x53e0f4);VoiceExtensionEvents[_0xe833('0x6')](_0x5252bc,_0x53e0f4);_0x5c59af(null);};}for(var e in events){if(events[_0xe833('0x7')](e)){var event=events[e];VoiceExtension[_0xe833('0x8')](e,emitEvent(event));}}module[_0xe833('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 7ceeef1..4efa8b9 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 _0xcbc2=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','url','split','name','param','prefix','phone','join','options','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','CDR(type)=','type','context','exten','inbound','CDR(routeid)=','push','Set','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xcbc2,0x180));var _0x2cbc=function(_0x27250c,_0x3e6637){_0x27250c=_0x27250c-0x0;var _0x7e3095=_0xcbc2[_0x27250c];return _0x7e3095;};'use strict';var _=require('lodash');var attributes=require(_0x2cbc('0x0'));module[_0x2cbc('0x1')]=function(_0x15b07a){var _0x5b3115=_0x15b07a[_0x2cbc('0x2')];function _0x595fa6(_0x3f7bc3){var _0x2638ff=0x2;var _0x17d2a3=[{'type':_0x3f7bc3['type'],'app':'Set','appdata':_0x2cbc('0x3')+_0x3f7bc3[_0x2cbc('0x4')],'context':_0x3f7bc3[_0x2cbc('0x5')],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']}];if(_0x3f7bc3[_0x2cbc('0x4')]==='inbound'){_0x17d2a3['push']({'type':_0x2cbc('0x7'),'app':'Set','appdata':_0x2cbc('0x8')+_0x3f7bc3['id'],'context':_0x3f7bc3[_0x2cbc('0x5')],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']});}_0x17d2a3[_0x2cbc('0x9')]({'type':_0x3f7bc3['type'],'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0xb'),'context':_0x3f7bc3['context'],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']},{'type':_0x3f7bc3[_0x2cbc('0x4')],'app':'Set','appdata':_0x2cbc('0xc'),'context':_0x3f7bc3[_0x2cbc('0x5')],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']},{'type':_0x3f7bc3[_0x2cbc('0x4')],'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0xd'),'context':_0x3f7bc3[_0x2cbc('0x5')],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']});return _0x17d2a3;}function _0x98dc6d(_0x260931){var _0xd966af=0x2;var _0x45a3d1=[{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0xf'),'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':'Set','appdata':_0x2cbc('0x10')+(_0x260931['cutdigits']?_0x2cbc('0x11')+_0x260931[_0x2cbc('0x12')]+'}':_0x2cbc('0x13')),'context':_0x260931['context'],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x8')+_0x260931['id'],'context':_0x260931['context'],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0x14'),'appdata':_0x2cbc('0x15')+(_0xd966af+0x2)+_0x2cbc('0x16')+(_0xd966af+0x1)+')','context':_0x260931['context'],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':'Set','appdata':_0x260931[_0x2cbc('0x12')]?_0x2cbc('0x17')+_0x260931['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':'Set','appdata':_0x2cbc('0xb'),'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931['exten'],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x260931['context'],'exten':_0x260931['exten'],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0xd'),'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x18')+_0x260931['id'],'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']}];if(_0x260931[_0x2cbc('0x19')](_0x2cbc('0x1a'))&&_0x260931['recordingFormat']!==_0x2cbc('0x1b')){_0x45a3d1[_0x2cbc('0x9')]({'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x1c'),'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x260931[_0x2cbc('0x1a')]||_0x2cbc('0x1d'),'context':_0x260931['context'],'exten':_0x260931['exten'],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']});}return _0x45a3d1;}function _0x1c57c9(_0x58ec13,_0x795f86){var _0x1ae3f2=[{'name':_0x2cbc('0x1e'),'param':0x0},{'name':_0x2cbc('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x2cbc('0x20'),'param':0x3}];var _0x2edf1f={};var _0x23a476=_0x795f86[_0x2cbc('0x21')](',');var _0x518abf=[];for(var _0x31dbf2=0x0;_0x31dbf2<_0x1ae3f2['length'];_0x31dbf2++){switch(_0x1ae3f2[_0x31dbf2][_0x2cbc('0x22')]){case'trunk':_0x2edf1f[_0x2cbc('0x1e')]=_0x23a476[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]]['split']('/')[0x1];_0x2edf1f['phone']=_0x23a476[_0x1ae3f2[_0x31dbf2]['param']][_0x2cbc('0x21')]('/')[0x2];_0x2edf1f[_0x2cbc('0x24')]=_0x2edf1f[_0x2cbc('0x25')]?_0x2edf1f[_0x2cbc('0x25')][_0x2cbc('0x21')]('$')[0x0]:undefined;_0x2edf1f[_0x2cbc('0x25')]=_0x58ec13['cutdigits']?(_0x2edf1f[_0x2cbc('0x24')]||'')+_0x2cbc('0x11')+_0x58ec13[_0x2cbc('0x12')]+'}':(_0x2edf1f[_0x2cbc('0x24')]||'')+_0x2cbc('0x13');_0x518abf[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]]=['SIP',_0x2edf1f[_0x2cbc('0x1e')],_0x2edf1f[_0x2cbc('0x25')]][_0x2cbc('0x26')]('/');break;case _0x2cbc('0x27'):_0x2edf1f['options']=_0x23a476[_0x1ae3f2[_0x31dbf2]['param']];if(_0x58ec13[_0x2cbc('0x1a')]!==_0x2cbc('0x1b')){if(_0x2edf1f[_0x2cbc('0x27')][_0x2cbc('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x2edf1f[_0x2cbc('0x27')]+=_0x2cbc('0x29');}}else{_0x2edf1f['options']=_0x2edf1f['options']['replace'](_0x2cbc('0x29'),'');}_0x518abf[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]]=_0x2edf1f['options'];break;default:_0x518abf[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]]=_0x23a476[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]];}}return _0x518abf[_0x2cbc('0x26')](',');}function _0x24cb59(_0x54ed5d,_0xeea3b1,_0x3f8228){return new Promise(function(_0x3a567f,_0x1d580e){var _0x2c6ff6=[];if(_['isEmpty'](_0xeea3b1))return _0x3a567f(_0x2c6ff6);_0x5b3115[_0x2cbc('0x2a')][_0x2cbc('0x2b')]({'attributes':['id',_0x2cbc('0x2c'),_0x2cbc('0x2d')],'raw':!![]})[_0x2cbc('0x2e')](function(_0x26bc8c){for(var _0x5f0471=0x0,_0xe99f84=0x0;_0x5f0471<_0xeea3b1[_0x2cbc('0x2f')];_0x5f0471++,_0xe99f84=0x0){var _0x3ab0cc=_0xeea3b1[_0x5f0471];var _0xead560=[];var _0x2b0d63=[];delete _0x3ab0cc['id'];if(_0x3ab0cc['interval']!==_0x2cbc('0x30')){_0x3ab0cc[_0x2cbc('0x31')]=[_0x3ab0cc['interval']];}else{_0x3ab0cc[_0x2cbc('0x31')]=_0x3ab0cc['IntervalId']?_[_0x2cbc('0x32')](_[_0x2cbc('0x33')](_0x26bc8c,{'IntervalId':_0x3ab0cc[_0x2cbc('0x2d')]}),'interval'):[];}_0x3ab0cc[_0x2cbc('0x5')]=_0x54ed5d[_0x2cbc('0x5')];_0x3ab0cc[_0x2cbc('0x6')]=_0x54ed5d[_0x2cbc('0x6')];if(_0x3ab0cc[_0x2cbc('0x4')])_0x3ab0cc[_0x2cbc('0x4')]=_0x3ab0cc['type'][_0x2cbc('0x34')]();if(_0x54ed5d['type']==='outbound'){if(_0x3ab0cc['hasOwnProperty'](_0x2cbc('0x35'))&&_0x3ab0cc[_0x2cbc('0x35')]&&_0x3ab0cc['tag']!=='--'){_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc['type'][_0x2cbc('0x34')](),'app':'Set','appdata':'CDR(tag)='+_0x3ab0cc['tag'],'context':_0x54ed5d['context'],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}_0xead560['push']({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0x14'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3ab0cc['callerID']?_0x2cbc('0x36')+_0x3ab0cc[_0x2cbc('0x37')]+')':_0x2cbc('0x38')),'context':_0x54ed5d[_0x2cbc('0x5')],'exten':_0x54ed5d['exten'],'priority':_0x3ab0cc[_0x2cbc('0x31')]['length']+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}else{if(_0x3ab0cc[_0x2cbc('0x19')]('answer')){if([_0x2cbc('0x39'),_0x2cbc('0x3a')][_0x2cbc('0x3b')](_0x3ab0cc[_0x2cbc('0x3c')]['toLowerCase']())&&_0x3ab0cc[_0x2cbc('0x3d')]!==_0x2cbc('0x3e')){if(_0x3ab0cc['answer']){_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x54ed5d[_0x2cbc('0x5')],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x3f'),'context':_0x54ed5d['context'],'exten':_0x54ed5d['exten'],'priority':_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}else{_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0x14'),'appdata':_0x2cbc('0x40'),'context':_0x54ed5d['context'],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc['intervals'][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x41'),'context':_0x54ed5d[_0x2cbc('0x5')],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc[_0x2cbc('0x31')]['length']+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}}}}for(var _0x283630=0x0;_0x283630<_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')];_0x283630++){var _0x49d5a7=_0x3f8228+_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')];var _0x544c66=_0x283630===_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')]-0x1?_0x3f8228+_0xead560['length']+_0x2b0d63['length']+0x2:_0x3f8228+_0x283630+0x1;_0xead560[_0x2cbc('0x42')](_0x283630,0x0,{'type':_0x54ed5d[_0x2cbc('0x4')],'app':_0x2cbc('0x43'),'appdata':_0x3ab0cc['intervals'][_0x283630]+'?'+_0x54ed5d['context']+_0x2cbc('0x44')+_0x49d5a7+':'+_0x54ed5d['context']+',${EXTEN},'+_0x544c66,'exten':_0x54ed5d['exten'],'context':_0x54ed5d[_0x2cbc('0x5')],'priority':_0x3f8228+_0x283630,'VoiceExtensionId':_0x54ed5d['id']});}if(_0x3ab0cc['appType']===_0x2cbc('0x45')){_0x3ab0cc[_0x2cbc('0x46')]=_0x1c57c9(_0x54ed5d,_0x3ab0cc[_0x2cbc('0x46')]);}if(_0x3ab0cc[_0x2cbc('0x3d')]==='agi'){_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':'Set','appdata':_0x2cbc('0x47'),'context':_0x54ed5d[_0x2cbc('0x5')],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc['intervals'][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}_0x3ab0cc[_0x2cbc('0x48')]=_0xead560[_0x2cbc('0x2f')]?_[_0x2cbc('0x49')](_0xead560)[_0x2cbc('0x48')]+0x1:_0x3f8228;_0x2c6ff6=_[_0x2cbc('0x4a')](_0x2c6ff6,_0xead560,[_0x3ab0cc],_0x2b0d63);_0x3f8228=_[_0x2cbc('0x49')](_0x2c6ff6)[_0x2cbc('0x48')]+0x1;}return _0x3a567f(_0x2c6ff6);})[_0x2cbc('0x4b')](function(_0x176e8c){_0x1d580e(_0x176e8c);});});}return _0x15b07a[_0x2cbc('0x4c')](_0x2cbc('0x4d'),attributes,{'tableName':_0x2cbc('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1560e6){var _0x40de64=this[_0x2cbc('0x4f')]({'plain':!![]});var _0x41797c=_0x40de64['type']==='outbound'?_0x98dc6d(_0x40de64):_0x595fa6(_0x40de64);return _0x24cb59(_0x40de64,_0x1560e6,_[_0x2cbc('0x49')](_0x41797c)['priority']+0x1)[_0x2cbc('0x2e')](function(_0x41716b){var _0x3befeb=_[_0x2cbc('0x4a')](_0x41797c,_0x41716b);_0x3befeb[_0x2cbc('0x9')]({'type':_0x40de64[_0x2cbc('0x4')],'app':_0x2cbc('0x50'),'exten':_0x40de64['exten'],'context':_0x40de64[_0x2cbc('0x5')],'priority':_['last'](_0x3befeb)[_0x2cbc('0x48')]+0x1,'VoiceExtensionId':_0x40de64['id']});return _0x3befeb;});}}});}; \ No newline at end of file +var _0x9b65=['lodash','./voiceExtension.attributes','models','type','Set','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','name','param','prefix','phone','${EXTEN}','join','options','indexOf','U(xcally-mixmonitor-context)','Interval','interval','IntervalId','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','get','then','Hangup'];(function(_0x33e2ec,_0xa04eb){var _0x5f031f=function(_0xa35e32){while(--_0xa35e32){_0x33e2ec['push'](_0x33e2ec['shift']());}};_0x5f031f(++_0xa04eb);}(_0x9b65,0x130));var _0x59b6=function(_0x183fac,_0x5c4b00){_0x183fac=_0x183fac-0x0;var _0x5ee86a=_0x9b65[_0x183fac];return _0x5ee86a;};'use strict';var _=require(_0x59b6('0x0'));var attributes=require(_0x59b6('0x1'));module['exports']=function(_0x3fd59d){var _0x2010f4=_0x3fd59d[_0x59b6('0x2')];function _0x5cd97c(_0x300882){var _0x32dbca=0x2;var _0xdc4b7=[{'type':_0x300882[_0x59b6('0x3')],'app':_0x59b6('0x4'),'appdata':'CDR(type)='+_0x300882[_0x59b6('0x3')],'context':_0x300882[_0x59b6('0x5')],'exten':_0x300882[_0x59b6('0x6')],'priority':_0x32dbca++,'VoiceExtensionId':_0x300882['id']}];if(_0x300882['type']===_0x59b6('0x7')){_0xdc4b7[_0x59b6('0x8')]({'type':_0x59b6('0x7'),'app':'Set','appdata':_0x59b6('0x9')+_0x300882['id'],'context':_0x300882[_0x59b6('0x5')],'exten':_0x300882[_0x59b6('0x6')],'priority':_0x32dbca++,'VoiceExtensionId':_0x300882['id']});}_0xdc4b7['push']({'type':_0x300882[_0x59b6('0x3')],'app':_0x59b6('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x300882['context'],'exten':_0x300882[_0x59b6('0x6')],'priority':_0x32dbca++,'VoiceExtensionId':_0x300882['id']},{'type':_0x300882[_0x59b6('0x3')],'app':_0x59b6('0x4'),'appdata':_0x59b6('0xa'),'context':_0x300882[_0x59b6('0x5')],'exten':_0x300882[_0x59b6('0x6')],'priority':_0x32dbca++,'VoiceExtensionId':_0x300882['id']},{'type':_0x300882[_0x59b6('0x3')],'app':_0x59b6('0x4'),'appdata':_0x59b6('0xb'),'context':_0x300882['context'],'exten':_0x300882['exten'],'priority':_0x32dbca++,'VoiceExtensionId':_0x300882['id']});return _0xdc4b7;}function _0x17cb25(_0x2e9232){var _0x7d8be=0x2;var _0x32c8b8=[{'type':'outbound','app':'Set','appdata':_0x59b6('0xc'),'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232[_0x59b6('0x6')],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':_0x59b6('0xd'),'app':_0x59b6('0x4'),'appdata':_0x59b6('0xe')+(_0x2e9232[_0x59b6('0xf')]?_0x59b6('0x10')+_0x2e9232[_0x59b6('0xf')]+'}':'${EXTEN}'),'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232['exten'],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':_0x59b6('0xd'),'app':_0x59b6('0x4'),'appdata':_0x59b6('0x9')+_0x2e9232['id'],'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232['exten'],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':_0x59b6('0xd'),'app':_0x59b6('0x11'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x7d8be+0x2)+_0x59b6('0x12')+(_0x7d8be+0x1)+')','context':_0x2e9232['context'],'exten':_0x2e9232['exten'],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':_0x59b6('0xd'),'app':_0x59b6('0x4'),'appdata':_0x2e9232[_0x59b6('0xf')]?_0x59b6('0x13')+_0x2e9232[_0x59b6('0xf')]+'}':_0x59b6('0x14'),'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232[_0x59b6('0x6')],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':_0x59b6('0xd'),'app':'Set','appdata':_0x59b6('0x15'),'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232[_0x59b6('0x6')],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':_0x59b6('0xd'),'app':_0x59b6('0x4'),'appdata':_0x59b6('0xa'),'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232[_0x59b6('0x6')],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':_0x59b6('0xd'),'app':_0x59b6('0x4'),'appdata':_0x59b6('0xb'),'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232[_0x59b6('0x6')],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':_0x59b6('0xd'),'app':_0x59b6('0x4'),'appdata':_0x59b6('0x16')+_0x2e9232['id'],'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232['exten'],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']}];if(_0x2e9232[_0x59b6('0x17')](_0x59b6('0x18'))&&_0x2e9232[_0x59b6('0x18')]!==_0x59b6('0x19')){_0x32c8b8[_0x59b6('0x8')]({'type':'outbound','app':_0x59b6('0x4'),'appdata':_0x59b6('0x1a'),'context':_0x2e9232[_0x59b6('0x5')],'exten':_0x2e9232[_0x59b6('0x6')],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']},{'type':'outbound','app':_0x59b6('0x4'),'appdata':_0x59b6('0x1b')+_0x2e9232[_0x59b6('0x18')]||_0x59b6('0x1c'),'context':_0x2e9232['context'],'exten':_0x2e9232[_0x59b6('0x6')],'priority':_0x7d8be++,'VoiceExtensionId':_0x2e9232['id']});}return _0x32c8b8;}function _0x3cb21c(_0x70a7f0,_0x42f3d6){var _0x52c553=[{'name':_0x59b6('0x1d'),'param':0x0},{'name':_0x59b6('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':_0x59b6('0x1f'),'param':0x3}];var _0x51f1bb={};var _0x167bbe=_0x42f3d6[_0x59b6('0x20')](',');var _0x4d4261=[];for(var _0x15c77c=0x0;_0x15c77c<_0x52c553[_0x59b6('0x21')];_0x15c77c++){switch(_0x52c553[_0x15c77c][_0x59b6('0x22')]){case _0x59b6('0x1d'):_0x51f1bb[_0x59b6('0x1d')]=_0x167bbe[_0x52c553[_0x15c77c][_0x59b6('0x23')]][_0x59b6('0x20')]('/')[0x1];_0x51f1bb['phone']=_0x167bbe[_0x52c553[_0x15c77c][_0x59b6('0x23')]][_0x59b6('0x20')]('/')[0x2];_0x51f1bb[_0x59b6('0x24')]=_0x51f1bb[_0x59b6('0x25')]?_0x51f1bb[_0x59b6('0x25')][_0x59b6('0x20')]('$')[0x0]:undefined;_0x51f1bb[_0x59b6('0x25')]=_0x70a7f0[_0x59b6('0xf')]?(_0x51f1bb[_0x59b6('0x24')]||'')+_0x59b6('0x10')+_0x70a7f0['cutdigits']+'}':(_0x51f1bb[_0x59b6('0x24')]||'')+_0x59b6('0x26');_0x4d4261[_0x52c553[_0x15c77c][_0x59b6('0x23')]]=['SIP',_0x51f1bb[_0x59b6('0x1d')],_0x51f1bb[_0x59b6('0x25')]][_0x59b6('0x27')]('/');break;case _0x59b6('0x28'):_0x51f1bb[_0x59b6('0x28')]=_0x167bbe[_0x52c553[_0x15c77c][_0x59b6('0x23')]];if(_0x70a7f0[_0x59b6('0x18')]!==_0x59b6('0x19')){if(_0x51f1bb[_0x59b6('0x28')][_0x59b6('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x51f1bb[_0x59b6('0x28')]+=_0x59b6('0x2a');}}else{_0x51f1bb[_0x59b6('0x28')]=_0x51f1bb[_0x59b6('0x28')]['replace']('U(xcally-mixmonitor-context)','');}_0x4d4261[_0x52c553[_0x15c77c][_0x59b6('0x23')]]=_0x51f1bb[_0x59b6('0x28')];break;default:_0x4d4261[_0x52c553[_0x15c77c][_0x59b6('0x23')]]=_0x167bbe[_0x52c553[_0x15c77c][_0x59b6('0x23')]];}}return _0x4d4261[_0x59b6('0x27')](',');}function _0x5267e2(_0x587723,_0x3703cc,_0x5ef40d){return new Promise(function(_0x27149a,_0x19de88){var _0xbd21bc=[];if(_['isEmpty'](_0x3703cc))return _0x27149a(_0xbd21bc);_0x2010f4[_0x59b6('0x2b')]['findAll']({'attributes':['id',_0x59b6('0x2c'),_0x59b6('0x2d')],'raw':!![]})['then'](function(_0x37a0ce){for(var _0x17b71f=0x0,_0x56d712=0x0;_0x17b71f<_0x3703cc[_0x59b6('0x21')];_0x17b71f++,_0x56d712=0x0){var _0x3e8ce8=_0x3703cc[_0x17b71f];var _0x3bad58=[];var _0xa7a2f2=[];delete _0x3e8ce8['id'];if(_0x3e8ce8[_0x59b6('0x2c')]!=='*,*,*,*'){_0x3e8ce8[_0x59b6('0x2e')]=[_0x3e8ce8['interval']];}else{_0x3e8ce8[_0x59b6('0x2e')]=_0x3e8ce8[_0x59b6('0x2d')]?_[_0x59b6('0x2f')](_[_0x59b6('0x30')](_0x37a0ce,{'IntervalId':_0x3e8ce8[_0x59b6('0x2d')]}),'interval'):[];}_0x3e8ce8[_0x59b6('0x5')]=_0x587723[_0x59b6('0x5')];_0x3e8ce8[_0x59b6('0x6')]=_0x587723[_0x59b6('0x6')];if(_0x3e8ce8[_0x59b6('0x3')])_0x3e8ce8[_0x59b6('0x3')]=_0x3e8ce8['type'][_0x59b6('0x31')]();if(_0x587723[_0x59b6('0x3')]==='outbound'){if(_0x3e8ce8[_0x59b6('0x17')](_0x59b6('0x32'))&&_0x3e8ce8[_0x59b6('0x32')]&&_0x3e8ce8[_0x59b6('0x32')]!=='--'){_0x3bad58['push']({'type':_0x3e8ce8['type'][_0x59b6('0x31')](),'app':_0x59b6('0x4'),'appdata':_0x59b6('0x33')+_0x3e8ce8['tag'],'context':_0x587723[_0x59b6('0x5')],'exten':_0x587723['exten'],'priority':_0x3e8ce8[_0x59b6('0x2e')]['length']+_0x5ef40d+_0x56d712++,'VoiceExtensionId':_0x587723['id']});}_0x3bad58[_0x59b6('0x8')]({'type':_0x3e8ce8['type'][_0x59b6('0x31')](),'app':_0x59b6('0x11'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3e8ce8[_0x59b6('0x34')]?'Set(CALLERID(all)='+_0x3e8ce8['callerID']+')':_0x59b6('0x35')),'context':_0x587723['context'],'exten':_0x587723[_0x59b6('0x6')],'priority':_0x3e8ce8['intervals'][_0x59b6('0x21')]+_0x5ef40d+_0x56d712++,'VoiceExtensionId':_0x587723['id']});}else{if(_0x3e8ce8[_0x59b6('0x17')](_0x59b6('0x36'))){if([_0x59b6('0x37'),_0x59b6('0x38')][_0x59b6('0x39')](_0x3e8ce8['app'][_0x59b6('0x31')]())&&_0x3e8ce8['appType']!=='custom'){if(_0x3e8ce8[_0x59b6('0x36')]){_0x3bad58['push']({'type':_0x3e8ce8[_0x59b6('0x3')][_0x59b6('0x31')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x587723[_0x59b6('0x5')],'exten':_0x587723[_0x59b6('0x6')],'priority':_0x3e8ce8[_0x59b6('0x2e')][_0x59b6('0x21')]+_0x5ef40d+_0x56d712++,'VoiceExtensionId':_0x587723['id']});_0x3bad58[_0x59b6('0x8')]({'type':_0x3e8ce8[_0x59b6('0x3')][_0x59b6('0x31')](),'app':_0x59b6('0x4'),'appdata':_0x59b6('0x3a'),'context':_0x587723[_0x59b6('0x5')],'exten':_0x587723[_0x59b6('0x6')],'priority':_0x3e8ce8[_0x59b6('0x2e')][_0x59b6('0x21')]+_0x5ef40d+_0x56d712++,'VoiceExtensionId':_0x587723['id']});}else{_0x3bad58[_0x59b6('0x8')]({'type':_0x3e8ce8[_0x59b6('0x3')][_0x59b6('0x31')](),'app':'ExecIf','appdata':_0x59b6('0x3b'),'context':_0x587723[_0x59b6('0x5')],'exten':_0x587723['exten'],'priority':_0x3e8ce8[_0x59b6('0x2e')][_0x59b6('0x21')]+_0x5ef40d+_0x56d712++,'VoiceExtensionId':_0x587723['id']});_0x3bad58[_0x59b6('0x8')]({'type':_0x3e8ce8[_0x59b6('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x59b6('0x3c'),'context':_0x587723[_0x59b6('0x5')],'exten':_0x587723[_0x59b6('0x6')],'priority':_0x3e8ce8[_0x59b6('0x2e')][_0x59b6('0x21')]+_0x5ef40d+_0x56d712++,'VoiceExtensionId':_0x587723['id']});}}}}for(var _0x37b930=0x0;_0x37b930<_0x3e8ce8[_0x59b6('0x2e')]['length'];_0x37b930++){var _0x4d0e4c=_0x5ef40d+_0x3e8ce8[_0x59b6('0x2e')][_0x59b6('0x21')];var _0x54e983=_0x37b930===_0x3e8ce8[_0x59b6('0x2e')][_0x59b6('0x21')]-0x1?_0x5ef40d+_0x3bad58[_0x59b6('0x21')]+_0xa7a2f2[_0x59b6('0x21')]+0x2:_0x5ef40d+_0x37b930+0x1;_0x3bad58['splice'](_0x37b930,0x0,{'type':_0x587723['type'],'app':'GotoIfTime','appdata':_0x3e8ce8[_0x59b6('0x2e')][_0x37b930]+'?'+_0x587723['context']+_0x59b6('0x3d')+_0x4d0e4c+':'+_0x587723[_0x59b6('0x5')]+_0x59b6('0x3d')+_0x54e983,'exten':_0x587723[_0x59b6('0x6')],'context':_0x587723[_0x59b6('0x5')],'priority':_0x5ef40d+_0x37b930,'VoiceExtensionId':_0x587723['id']});}if(_0x3e8ce8[_0x59b6('0x3e')]===_0x59b6('0x3f')){_0x3e8ce8[_0x59b6('0x40')]=_0x3cb21c(_0x587723,_0x3e8ce8[_0x59b6('0x40')]);}if(_0x3e8ce8[_0x59b6('0x3e')]===_0x59b6('0x41')){_0x3bad58['push']({'type':_0x3e8ce8[_0x59b6('0x3')][_0x59b6('0x31')](),'app':_0x59b6('0x4'),'appdata':_0x59b6('0x42'),'context':_0x587723[_0x59b6('0x5')],'exten':_0x587723['exten'],'priority':_0x3e8ce8['intervals'][_0x59b6('0x21')]+_0x5ef40d+_0x56d712++,'VoiceExtensionId':_0x587723['id']});}_0x3e8ce8[_0x59b6('0x43')]=_0x3bad58['length']?_[_0x59b6('0x44')](_0x3bad58)[_0x59b6('0x43')]+0x1:_0x5ef40d;_0xbd21bc=_[_0x59b6('0x45')](_0xbd21bc,_0x3bad58,[_0x3e8ce8],_0xa7a2f2);_0x5ef40d=_[_0x59b6('0x44')](_0xbd21bc)[_0x59b6('0x43')]+0x1;}return _0x27149a(_0xbd21bc);})[_0x59b6('0x46')](function(_0x4b14ed){_0x19de88(_0x4b14ed);});});}return _0x3fd59d[_0x59b6('0x47')](_0x59b6('0x48'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5643b1){var _0x4df047=this[_0x59b6('0x49')]({'plain':!![]});var _0x18435f=_0x4df047[_0x59b6('0x3')]===_0x59b6('0xd')?_0x17cb25(_0x4df047):_0x5cd97c(_0x4df047);return _0x5267e2(_0x4df047,_0x5643b1,_[_0x59b6('0x44')](_0x18435f)[_0x59b6('0x43')]+0x1)[_0x59b6('0x4a')](function(_0x461d87){var _0x5c29b0=_[_0x59b6('0x45')](_0x18435f,_0x461d87);_0x5c29b0[_0x59b6('0x8')]({'type':_0x4df047[_0x59b6('0x3')],'app':_0x59b6('0x4b'),'exten':_0x4df047[_0x59b6('0x6')],'context':_0x4df047[_0x59b6('0x5')],'priority':_['last'](_0x5c29b0)['priority']+0x1,'VoiceExtensionId':_0x4df047['id']});return _0x5c29b0;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index f9b3692..cea44b3 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 _0x0024=['error','code','message','info','GetVoiceExtension','findAll','options','raw','attributes','limit','include','model','then','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0024,0xa8));var _0x4002=function(_0x5c0746,_0x2d4e25){_0x5c0746=_0x5c0746-0x0;var _0x73e33a=_0x0024[_0x5c0746];return _0x73e33a;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var moment=require('moment');var BPromise=require(_0x4002('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4002('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4002('0x3'))(_0x4002('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4002('0x5')][_0x4002('0x6')]({'port':0x232a});config[_0x4002('0x7')]=_[_0x4002('0x8')](config['redis'],{'host':_0x4002('0x9'),'port':0x18eb});var socket=require(_0x4002('0xa'))(new Redis(config[_0x4002('0x7')]));require(_0x4002('0xb'))['register'](socket);function respondWithRpcPromise(_0x5f32c7,_0x21c971,_0x26fd5d){return new BPromise(function(_0x397864,_0x12c368){return client[_0x4002('0xc')](_0x5f32c7,_0x26fd5d)['then'](function(_0x53c0ef){logger['info'](_0x4002('0xd'),_0x21c971,_0x4002('0xe'));logger[_0x4002('0xf')](_0x4002('0x10'),_0x21c971,'request\x20sent',JSON[_0x4002('0x11')](_0x53c0ef));if(_0x53c0ef[_0x4002('0x12')]){if(_0x53c0ef[_0x4002('0x12')][_0x4002('0x13')]===0x1f4){logger[_0x4002('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x12c368(_0x53c0ef[_0x4002('0x12')][_0x4002('0x14')]);}logger[_0x4002('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x397864(_0x53c0ef['error'][_0x4002('0x14')]);}else{logger[_0x4002('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x21c971,_0x4002('0xe'));_0x397864(_0x53c0ef['result']['message']);}})['catch'](function(_0x22820f){logger[_0x4002('0x12')](_0x4002('0xd'),_0x21c971,_0x22820f);_0x12c368(_0x22820f);});});}exports[_0x4002('0x16')]=function(_0x514dfe){var _0x3bf83a=this;return new Promise(function(_0x1a5364,_0x172317){return db['VoiceExtension'][_0x4002('0x17')]({'raw':_0x514dfe['options']?_0x514dfe[_0x4002('0x18')][_0x4002('0x19')]===undefined?!![]:![]:!![],'where':_0x514dfe[_0x4002('0x18')]?_0x514dfe['options']['where']||null:null,'attributes':_0x514dfe[_0x4002('0x18')]?_0x514dfe[_0x4002('0x18')][_0x4002('0x1a')]||null:null,'limit':_0x514dfe['options']?_0x514dfe[_0x4002('0x18')][_0x4002('0x1b')]||null:null,'include':_0x514dfe[_0x4002('0x18')]?_0x514dfe[_0x4002('0x18')][_0x4002('0x1c')]?_['map'](_0x514dfe[_0x4002('0x18')][_0x4002('0x1c')],function(_0x385c35){return{'model':db[_0x385c35[_0x4002('0x1d')]],'as':_0x385c35['as'],'attributes':_0x385c35[_0x4002('0x1a')],'include':_0x385c35[_0x4002('0x1c')]?_['map'](_0x385c35[_0x4002('0x1c')],function(_0x2d148e){return{'model':db[_0x2d148e['model']],'as':_0x2d148e['as'],'attributes':_0x2d148e[_0x4002('0x1a')],'include':_0x2d148e[_0x4002('0x1c')]?_['map'](_0x2d148e[_0x4002('0x1c')],function(_0x278907){return{'model':db[_0x278907[_0x4002('0x1d')]],'as':_0x278907['as'],'attributes':_0x278907[_0x4002('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4002('0x1e')](function(_0x37ee79){logger[_0x4002('0x15')]('GetVoiceExtension',_0x514dfe);logger[_0x4002('0xf')](_0x4002('0x16'),_0x514dfe,JSON[_0x4002('0x11')](_0x37ee79));_0x1a5364(_0x37ee79);})['catch'](function(_0x52f488){logger[_0x4002('0x12')](_0x4002('0x16'),_0x52f488[_0x4002('0x14')],_0x514dfe);_0x172317(_0x3bf83a[_0x4002('0x12')](0x1f4,_0x52f488[_0x4002('0x14')]));});});}; \ No newline at end of file +var _0x16a6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceExtension','options','attributes','limit','include','model','map','lodash','util','bluebird','randomstring'];(function(_0x43c970,_0x2540cb){var _0x1ca73a=function(_0x1b87c0){while(--_0x1b87c0){_0x43c970['push'](_0x43c970['shift']());}};_0x1ca73a(++_0x2540cb);}(_0x16a6,0x15c));var _0x616a=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x16a6[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var moment=require('moment');var BPromise=require(_0x616a('0x2'));var rs=require(_0x616a('0x3'));var fs=require('fs');var Redis=require(_0x616a('0x4'));var db=require(_0x616a('0x5'))['db'];var utils=require(_0x616a('0x6'));var logger=require(_0x616a('0x7'))('rpc');var config=require(_0x616a('0x8'));var jayson=require(_0x616a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x616a('0xa')]=_[_0x616a('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x616a('0xc'))(new Redis(config['redis']));require(_0x616a('0xd'))['register'](socket);function respondWithRpcPromise(_0x3256a1,_0x235970,_0x2a4984){return new BPromise(function(_0x57d339,_0x1ab052){return client[_0x616a('0xe')](_0x3256a1,_0x2a4984)[_0x616a('0xf')](function(_0x47674e){logger[_0x616a('0x10')](_0x616a('0x11'),_0x235970,_0x616a('0x12'));logger[_0x616a('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x235970,_0x616a('0x12'),JSON[_0x616a('0x14')](_0x47674e));if(_0x47674e[_0x616a('0x15')]){if(_0x47674e[_0x616a('0x15')][_0x616a('0x16')]===0x1f4){logger['error'](_0x616a('0x11'),_0x235970,_0x47674e[_0x616a('0x15')][_0x616a('0x17')]);return _0x1ab052(_0x47674e[_0x616a('0x15')][_0x616a('0x17')]);}logger['error'](_0x616a('0x11'),_0x235970,_0x47674e[_0x616a('0x15')]['message']);return _0x57d339(_0x47674e['error'][_0x616a('0x17')]);}else{logger[_0x616a('0x10')](_0x616a('0x11'),_0x235970,'request\x20sent');_0x57d339(_0x47674e[_0x616a('0x18')][_0x616a('0x17')]);}})['catch'](function(_0x535d2b){logger[_0x616a('0x15')](_0x616a('0x11'),_0x235970,_0x535d2b);_0x1ab052(_0x535d2b);});});}exports[_0x616a('0x19')]=function(_0x31b711){var _0x505b9f=this;return new Promise(function(_0x499132,_0x5568fd){return db['VoiceExtension']['findAll']({'raw':_0x31b711['options']?_0x31b711[_0x616a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x31b711[_0x616a('0x1a')]?_0x31b711[_0x616a('0x1a')]['where']||null:null,'attributes':_0x31b711[_0x616a('0x1a')]?_0x31b711[_0x616a('0x1a')][_0x616a('0x1b')]||null:null,'limit':_0x31b711[_0x616a('0x1a')]?_0x31b711['options'][_0x616a('0x1c')]||null:null,'include':_0x31b711[_0x616a('0x1a')]?_0x31b711[_0x616a('0x1a')][_0x616a('0x1d')]?_['map'](_0x31b711[_0x616a('0x1a')]['include'],function(_0x30c1a){return{'model':db[_0x30c1a[_0x616a('0x1e')]],'as':_0x30c1a['as'],'attributes':_0x30c1a['attributes'],'include':_0x30c1a['include']?_['map'](_0x30c1a[_0x616a('0x1d')],function(_0x7ebd63){return{'model':db[_0x7ebd63[_0x616a('0x1e')]],'as':_0x7ebd63['as'],'attributes':_0x7ebd63[_0x616a('0x1b')],'include':_0x7ebd63['include']?_[_0x616a('0x1f')](_0x7ebd63[_0x616a('0x1d')],function(_0x195b73){return{'model':db[_0x195b73[_0x616a('0x1e')]],'as':_0x195b73['as'],'attributes':_0x195b73[_0x616a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x616a('0xf')](function(_0x41a22d){logger['info'](_0x616a('0x19'),_0x31b711);logger[_0x616a('0x13')]('GetVoiceExtension',_0x31b711,JSON[_0x616a('0x14')](_0x41a22d));_0x499132(_0x41a22d);})['catch'](function(_0x5f00d0){logger[_0x616a('0x15')](_0x616a('0x19'),_0x5f00d0[_0x616a('0x17')],_0x31b711);_0x5568fd(_0x505b9f['error'](0x1f4,_0x5f00d0[_0x616a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 7bc82ee..1e088af 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x4c4066,_0x5f8ec3){var _0x5e56a5=function(_0x400348){while(--_0x400348){_0x4c4066['push'](_0x4c4066['shift']());}};_0x5e56a5(++_0x5f8ec3);}(_0x7a54,0x106));var _0x47a5=function(_0x549245,_0x416216){_0x549245=_0x549245-0x0;var _0x1a7ca8=_0x7a54[_0x549245];return _0x1a7ca8;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x432e35,_0x47d666){var _0x221080=function(_0xbdc124){while(--_0xbdc124){_0x432e35['push'](_0x432e35['shift']());}};_0x221080(++_0x47d666);}(_0x4975,0x86));var _0x5497=function(_0x10678d,_0x516533){_0x10678d=_0x10678d-0x0;var _0x1ce2eb=_0x4975[_0x10678d];return _0x1ce2eb;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 71b0875..9461a58 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 _0xb091=['getMessages','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages'];(function(_0x17a329,_0x5d2f43){var _0x761387=function(_0x2e1ad3){while(--_0x2e1ad3){_0x17a329['push'](_0x17a329['shift']());}};_0x761387(++_0x5d2f43);}(_0xb091,0x16e));var _0x1b09=function(_0x3b6826,_0x5a10c5){_0x3b6826=_0x3b6826-0x0;var _0x163763=_0xb091[_0x3b6826];return _0x163763;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')](_0x1b09('0x10'),auth['isAuthenticated'](),controller[_0x1b09('0x11')]);router[_0x1b09('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1b09('0x13')]);module[_0x1b09('0x14')]=router; \ No newline at end of file +var _0x5496=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get','isAuthenticated','show','getMessages','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x4645a8,_0x5d6525){var _0x34a3e7=function(_0x38252b){while(--_0x38252b){_0x4645a8['push'](_0x4645a8['shift']());}};_0x34a3e7(++_0x5d6525);}(_0x5496,0x175));var _0x6549=function(_0x26271c,_0x2aa226){_0x26271c=_0x26271c-0x0;var _0x8302b7=_0x5496[_0x26271c];return _0x8302b7;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id/messages',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')]('/',auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router[_0x6549('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6549('0x11')]);router[_0x6549('0x12')](_0x6549('0x13'),auth[_0x6549('0xb')](),controller[_0x6549('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9d7b6cf..b9a5995 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 _0x41c8=['ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes'];(function(_0x33b303,_0x4ae984){var _0x104ed3=function(_0x28f61a){while(--_0x28f61a){_0x33b303['push'](_0x33b303['shift']());}};_0x104ed3(++_0x4ae984);}(_0x41c8,0x139));var _0x841c=function(_0x248871,_0x86f568){_0x248871=_0x248871-0x0;var _0x1267a5=_0x41c8[_0x248871];return _0x1267a5;};'use strict';var Sequelize=require(_0x841c('0x0'));module[_0x841c('0x1')]={'customer_id':{'type':Sequelize[_0x841c('0x2')]},'context':{'type':Sequelize[_0x841c('0x2')],'defaultValue':_0x841c('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x841c('0x2')],'defaultValue':'','allowNull':![],'unique':_0x841c('0x4')},'password':{'type':Sequelize[_0x841c('0x2')]},'fullname':{'type':Sequelize[_0x841c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x219fb1){this[_0x841c('0x5')]('email',typeof _0x219fb1===_0x841c('0x6')&&_0x219fb1[_0x841c('0x7')]()?_0x219fb1[_0x841c('0x7')]():null);}},'pager':{'type':Sequelize[_0x841c('0x2')]},'tz':{'type':Sequelize[_0x841c('0x2')],'defaultValue':_0x841c('0x8')},'attach':{'type':Sequelize['ENUM'](_0x841c('0x9'),'no'),'defaultValue':_0x841c('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x841c('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x841c('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x841c('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':_0x841c('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x841c('0xc')},'emailsubject':{'type':Sequelize[_0x841c('0x2')]},'emailbody':{'type':Sequelize[_0x841c('0x2')]},'maxsecs':{'type':Sequelize[_0x841c('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x841c('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x841c('0xe')](_0x841c('0xf'))+_0x841c('0x10')+this[_0x841c('0xe')]('mailbox');}}}; \ No newline at end of file +var _0xcf73=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x184260,_0xddab56){var _0x4a7dac=function(_0x3ff33f){while(--_0x3ff33f){_0x184260['push'](_0x184260['shift']());}};_0x4a7dac(++_0xddab56);}(_0xcf73,0x159));var _0x3cf7=function(_0x5309af,_0x3fd58b){_0x5309af=_0x5309af-0x0;var _0x259ea9=_0xcf73[_0x5309af];return _0x259ea9;};'use strict';var Sequelize=require('sequelize');module[_0x3cf7('0x0')]={'customer_id':{'type':Sequelize[_0x3cf7('0x1')]},'context':{'type':Sequelize[_0x3cf7('0x1')],'defaultValue':_0x3cf7('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3cf7('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3cf7('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x3cf7('0x1')]},'email':{'type':Sequelize[_0x3cf7('0x1')],'validate':{'isEmail':!![]},'set':function(_0x31a6d3){this[_0x3cf7('0x4')](_0x3cf7('0x5'),typeof _0x31a6d3===_0x3cf7('0x6')&&_0x31a6d3[_0x3cf7('0x7')]()?_0x31a6d3[_0x3cf7('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x3cf7('0x1')],'defaultValue':_0x3cf7('0x8')},'attach':{'type':Sequelize[_0x3cf7('0x9')](_0x3cf7('0xa'),'no'),'defaultValue':_0x3cf7('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x3cf7('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x3cf7('0x1')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3cf7('0x9')](_0x3cf7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3cf7('0x9')](_0x3cf7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3cf7('0x9')](_0x3cf7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3cf7('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3cf7('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3cf7('0x9')](_0x3cf7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3cf7('0xa'),'no'),'defaultValue':_0x3cf7('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3cf7('0x9')](_0x3cf7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3cf7('0x9')](_0x3cf7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3cf7('0x9')](_0x3cf7('0xa'),'no'),'defaultValue':_0x3cf7('0xa'),'allowNull':![]},'stamp':{'type':_0x3cf7('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3cf7('0x1')]},'maxsecs':{'type':Sequelize[_0x3cf7('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3cf7('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3cf7('0xe')]('fullname')+'\x20-\x20'+this[_0x3cf7('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 98f03e1..b6a4106 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 _0xbfcc=['stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','nolimit','VoiceMailMessage','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','then','destroy','get','Voicemails','UserProfileResource','error'];(function(_0x13f890,_0x1681d7){var _0x314a20=function(_0x61d631){while(--_0x61d631){_0x13f890['push'](_0x13f890['shift']());}};_0x314a20(++_0x1681d7);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xbfcc[_0x2c1dcd];return _0x158ce5;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){var _0x49f5bf=_0x34cffa[_0xcbfc('0x23')]({'plain':!![]});var _0x51284a=_0xcbfc('0x24');return db[_0xcbfc('0x25')]['destroy']({'where':{'type':_0x51284a,'resourceId':_0x49f5bf['id']}})[_0xcbfc('0x21')](function(){return _0x34cffa;});})[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x3c3afd,_0x2f7549){return function(_0x41f3b8){if(!_0x41f3b8){_0x3c3afd['sendStatus'](0x194);}return _0x41f3b8;};}function handleError(_0x29f896,_0x1ec530){_0x1ec530=_0x1ec530||0x1f4;return function(_0x4f632a){logger[_0xcbfc('0x26')](_0x4f632a[_0xcbfc('0x27')]);if(_0x4f632a[_0xcbfc('0x28')]){delete _0x4f632a[_0xcbfc('0x28')];}_0x29f896[_0xcbfc('0x18')](_0x1ec530)[_0xcbfc('0x29')](_0x4f632a);};}exports[_0xcbfc('0x2a')]=function(_0x5366cf,_0x41b68b){var _0x433300={},_0x3f9d20={},_0x20a378={'count':0x0,'rows':[]};var _0x500a0b=_[_0xcbfc('0x2b')](db[_0xcbfc('0x2c')][_0xcbfc('0x2d')],function(_0x245986){return{'name':_0x245986[_0xcbfc('0x2e')],'type':_0x245986[_0xcbfc('0x2f')][_0xcbfc('0x30')]};});_0x3f9d20['model']=_[_0xcbfc('0x2b')](_0x500a0b,_0xcbfc('0x28'));_0x3f9d20['query']=_[_0xcbfc('0x31')](_0x5366cf[_0xcbfc('0x32')]);_0x3f9d20[_0xcbfc('0x33')]=_['intersection'](_0x3f9d20['model'],_0x3f9d20['query']);_0x433300[_0xcbfc('0x34')]=_[_0xcbfc('0x35')](_0x3f9d20[_0xcbfc('0x36')],qs[_0xcbfc('0x37')](_0x5366cf[_0xcbfc('0x32')][_0xcbfc('0x37')]));_0x433300[_0xcbfc('0x34')]=_0x433300[_0xcbfc('0x34')]['length']?_0x433300[_0xcbfc('0x34')]:_0x3f9d20[_0xcbfc('0x36')];if(!_0x5366cf['query'][_0xcbfc('0x38')]('nolimit')){_0x433300[_0xcbfc('0x19')]=qs[_0xcbfc('0x19')](_0x5366cf[_0xcbfc('0x32')]['limit']);_0x433300[_0xcbfc('0x1b')]=qs['offset'](_0x5366cf['query'][_0xcbfc('0x1b')]);}_0x433300[_0xcbfc('0x39')]=qs[_0xcbfc('0x3a')](_0x5366cf[_0xcbfc('0x32')][_0xcbfc('0x3a')]);_0x433300[_0xcbfc('0x3b')]=qs[_0xcbfc('0x33')](_[_0xcbfc('0x3c')](_0x5366cf['query'],_0x3f9d20[_0xcbfc('0x33')]),_0x500a0b);if(_0x5366cf['query'][_0xcbfc('0x3d')]){_0x433300[_0xcbfc('0x3b')]=_[_0xcbfc('0x3e')](_0x433300[_0xcbfc('0x3b')],{'$or':_['map'](_0x500a0b,function(_0x5306e9){if(_0x5306e9[_0xcbfc('0x2f')]!==_0xcbfc('0x3f')){var _0x404f46={};_0x404f46[_0x5306e9[_0xcbfc('0x28')]]={'$like':'%'+_0x5366cf[_0xcbfc('0x32')]['filter']+'%'};return _0x404f46;}})});}_0x433300=_[_0xcbfc('0x3e')]({},_0x433300,_0x5366cf[_0xcbfc('0x40')]);var _0xf2da32={'where':_0x433300['where']};return db[_0xcbfc('0x2c')][_0xcbfc('0x1c')](_0xf2da32)[_0xcbfc('0x21')](function(_0x4ca55c){_0x20a378[_0xcbfc('0x1c')]=_0x4ca55c;if(_0x5366cf[_0xcbfc('0x32')][_0xcbfc('0x41')]){_0x433300[_0xcbfc('0x42')]=[{'all':!![]}];}return db[_0xcbfc('0x2c')][_0xcbfc('0x43')](_0x433300);})[_0xcbfc('0x21')](function(_0x561544){_0x20a378[_0xcbfc('0x44')]=_0x561544;return _0x20a378;})[_0xcbfc('0x21')](respondWithFilteredResult(_0x41b68b,_0x433300))['catch'](handleError(_0x41b68b,null));};exports[_0xcbfc('0x45')]=function(_0x50a01c,_0x17b87b){var _0xdc0521={'raw':!![],'where':{'id':_0x50a01c[_0xcbfc('0x46')]['id']}},_0xd609ec={};_0xd609ec[_0xcbfc('0x36')]=_[_0xcbfc('0x31')](db['VoiceMail'][_0xcbfc('0x2d')]);_0xd609ec[_0xcbfc('0x32')]=_[_0xcbfc('0x31')](_0x50a01c[_0xcbfc('0x32')]);_0xd609ec[_0xcbfc('0x33')]=_[_0xcbfc('0x35')](_0xd609ec[_0xcbfc('0x36')],_0xd609ec['query']);_0xdc0521[_0xcbfc('0x34')]=_[_0xcbfc('0x35')](_0xd609ec['model'],qs[_0xcbfc('0x37')](_0x50a01c[_0xcbfc('0x32')][_0xcbfc('0x37')]));_0xdc0521['attributes']=_0xdc0521[_0xcbfc('0x34')][_0xcbfc('0x47')]?_0xdc0521[_0xcbfc('0x34')]:_0xd609ec[_0xcbfc('0x36')];if(_0x50a01c[_0xcbfc('0x32')][_0xcbfc('0x41')]){_0xdc0521[_0xcbfc('0x42')]=[{'all':!![]}];}_0xdc0521=_['merge']({},_0xdc0521,_0x50a01c['options']);return db[_0xcbfc('0x2c')][_0xcbfc('0x48')](_0xdc0521)[_0xcbfc('0x21')](handleEntityNotFound(_0x17b87b,null))[_0xcbfc('0x21')](respondWithResult(_0x17b87b,null))['catch'](handleError(_0x17b87b,null));};exports['create']=function(_0x2e89bf,_0xe5c5ef){return db[_0xcbfc('0x2c')]['create'](_0x2e89bf[_0xcbfc('0x49')],{})[_0xcbfc('0x21')](function(_0x4446b7){var _0x4b3096=_0x2e89bf[_0xcbfc('0x4a')][_0xcbfc('0x23')]({'plain':!![]});if(!_0x4b3096)throw new Error(_0xcbfc('0x4b'));if(_0x4b3096[_0xcbfc('0x4c')]===_0xcbfc('0x4a')){var _0xd9976d=_0x4446b7[_0xcbfc('0x23')]({'plain':!![]});var _0x374998=_0xcbfc('0x24');return db[_0xcbfc('0x4d')]['find']({'where':{'name':_0x374998,'userProfileId':_0x4b3096[_0xcbfc('0x4e')]},'raw':!![]})[_0xcbfc('0x21')](function(_0x44cc11){if(_0x44cc11&&_0x44cc11['autoAssociation']===0x0){return db[_0xcbfc('0x25')][_0xcbfc('0x4f')]({'name':_0xd9976d['name'],'resourceId':_0xd9976d['id'],'type':_0x44cc11[_0xcbfc('0x28')],'sectionId':_0x44cc11['id']},{})[_0xcbfc('0x21')](function(){return _0x4446b7;});}else{return _0x4446b7;}})[_0xcbfc('0x50')](function(_0x25e48d){logger['error'](_0xcbfc('0x51'),_0x25e48d);throw _0x25e48d;});}return _0x4446b7;})[_0xcbfc('0x21')](respondWithResult(_0xe5c5ef,0xc9))['catch'](handleError(_0xe5c5ef,null));};exports[_0xcbfc('0x52')]=function(_0x34db13,_0x3ed9f0){if(_0x34db13[_0xcbfc('0x49')]['id']){delete _0x34db13[_0xcbfc('0x49')]['id'];}return db[_0xcbfc('0x2c')][_0xcbfc('0x48')]({'where':{'id':_0x34db13[_0xcbfc('0x46')]['id']}})[_0xcbfc('0x21')](handleEntityNotFound(_0x3ed9f0,null))[_0xcbfc('0x21')](saveUpdates(_0x34db13['body'],null))[_0xcbfc('0x21')](respondWithResult(_0x3ed9f0,null))['catch'](handleError(_0x3ed9f0,null));};exports['destroy']=function(_0x4a10e6,_0x4239da){return db[_0xcbfc('0x2c')][_0xcbfc('0x48')]({'where':{'id':_0x4a10e6[_0xcbfc('0x46')]['id']}})[_0xcbfc('0x21')](handleEntityNotFound(_0x4239da,null))[_0xcbfc('0x21')](removeEntity(_0x4239da,null))[_0xcbfc('0x50')](handleError(_0x4239da,null));};exports[_0xcbfc('0x53')]=function(_0x4d2df1,_0x9e0c38,_0xf5f5e1){return db[_0xcbfc('0x2c')]['findOne']({'where':{'id':_0x4d2df1[_0xcbfc('0x46')]['id']}})[_0xcbfc('0x21')](handleEntityNotFound(_0x9e0c38,null))[_0xcbfc('0x21')](function(_0x3b526f){var _0x1ed350;var _0x310b78={},_0x34ec1d={};_0x34ec1d['model']=_[_0xcbfc('0x31')](db['VoiceMailMessage'][_0xcbfc('0x2d')]);_0x34ec1d[_0xcbfc('0x32')]=_['keys'](_0x4d2df1[_0xcbfc('0x32')]);_0x34ec1d['filters']=_[_0xcbfc('0x35')](_0x34ec1d[_0xcbfc('0x36')],_0x34ec1d[_0xcbfc('0x32')]);_0x310b78[_0xcbfc('0x34')]=_[_0xcbfc('0x35')](_0x34ec1d[_0xcbfc('0x36')],qs['fields'](_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x37')]));_0x310b78['attributes']=_0x310b78[_0xcbfc('0x34')][_0xcbfc('0x47')]?_0x310b78[_0xcbfc('0x34')]:_0x34ec1d[_0xcbfc('0x36')];if(!_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x38')](_0xcbfc('0x54'))){_0x310b78[_0xcbfc('0x19')]=qs['limit'](_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x19')]);_0x310b78[_0xcbfc('0x1b')]=qs[_0xcbfc('0x1b')](_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x1b')]);}_0x310b78[_0xcbfc('0x39')]=qs[_0xcbfc('0x3a')](_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x3a')]);_0x310b78['where']=qs[_0xcbfc('0x33')](_[_0xcbfc('0x3c')](_0x4d2df1['query'],_0x34ec1d[_0xcbfc('0x33')]));if(_0x4d2df1['query']['filter']){_0x310b78[_0xcbfc('0x3b')]=_[_0xcbfc('0x3e')](_0x310b78[_0xcbfc('0x3b')],{'$or':_[_0xcbfc('0x2b')](_0x310b78[_0xcbfc('0x34')],function(_0x4d8d2a){var _0x53babd={};_0x53babd[_0x4d8d2a]={'$like':'%'+_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x3d')]+'%'};return _0x53babd;})});}_0x310b78[_0xcbfc('0x3b')]=_[_0xcbfc('0x3e')](_0x310b78[_0xcbfc('0x3b')],{'mailboxuser':_0x3b526f['mailbox']});_0x310b78=_[_0xcbfc('0x3e')]({},_0x310b78,_0x4d2df1[_0xcbfc('0x40')]);return db[_0xcbfc('0x55')]['findAndCountAll'](_0x310b78)['then'](respondWithFilteredResult(_0x9e0c38,_0x310b78));})['catch'](handleError(_0x9e0c38,null));}; \ No newline at end of file +var _0x80ed=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','end','sendStatus','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0xd8efb0,_0x2fb48b){var _0x3d962c=function(_0x2db9e4){while(--_0x2db9e4){_0xd8efb0['push'](_0xd8efb0['shift']());}};_0x3d962c(++_0x2fb48b);}(_0x80ed,0x11c));var _0xd80e=function(_0x4b72a7,_0x1f35a0){_0x4b72a7=_0x4b72a7-0x0;var _0x4bc64f=_0x80ed[_0x4b72a7];return _0x4bc64f;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];function respondWithStatusCode(_0x118f53,_0x1d3fcf){_0x1d3fcf=_0x1d3fcf||0xcc;return function(_0x4fb01c){if(_0x4fb01c){return _0x118f53['sendStatus'](_0x1d3fcf);}return _0x118f53['status'](_0x1d3fcf)['end']();};}function respondWithResult(_0x145766,_0x3d233b){_0x3d233b=_0x3d233b||0xc8;return function(_0x3096ae){if(_0x3096ae){return _0x145766[_0xd80e('0x1b')](_0x3d233b)[_0xd80e('0x1c')](_0x3096ae);}};}function respondWithFilteredResult(_0x58a17e,_0x595683){return function(_0x2c8c61){if(_0x2c8c61){var _0x3124e8=typeof _0x595683[_0xd80e('0x1d')]===_0xd80e('0x1e')&&typeof _0x595683[_0xd80e('0x1f')]===_0xd80e('0x1e');var _0x22ab67=_0x2c8c61['count'];var _0x21ceec=_0x3124e8?0x0:_0x595683[_0xd80e('0x1d')];var _0x3b543d=_0x3124e8?_0x2c8c61[_0xd80e('0x20')]:_0x595683['offset']+_0x595683[_0xd80e('0x1f')];var _0x175c67;if(_0x3b543d>=_0x22ab67){_0x3b543d=_0x22ab67;_0x175c67=0xc8;}else{_0x175c67=0xce;}_0x58a17e[_0xd80e('0x1b')](_0x175c67);return _0x58a17e['set'](_0xd80e('0x21'),_0x21ceec+'-'+_0x3b543d+'/'+_0x22ab67)[_0xd80e('0x1c')](_0x2c8c61);}return null;};}function patchUpdates(_0x2765ea){return function(_0x147134){try{jsonpatch[_0xd80e('0x22')](_0x147134,_0x2765ea,!![]);}catch(_0x5509d4){return BPromise['reject'](_0x5509d4);}return _0x147134[_0xd80e('0x23')]();};}function saveUpdates(_0x3fa159,_0x3b39bf){return function(_0x2d46e7){if(_0x2d46e7){return _0x2d46e7[_0xd80e('0x24')](_0x3fa159)[_0xd80e('0x25')](function(_0x43152c){return _0x43152c;});}return null;};}function removeEntity(_0x5430b6,_0x1fbf8a){return function(_0x57d70){if(_0x57d70){return _0x57d70[_0xd80e('0x26')]()['then'](function(){var _0x635ce0=_0x57d70[_0xd80e('0x27')]({'plain':!![]});var _0xe9bb59='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0xe9bb59,'resourceId':_0x635ce0['id']}})[_0xd80e('0x25')](function(){return _0x57d70;});})['then'](function(){_0x5430b6[_0xd80e('0x1b')](0xcc)[_0xd80e('0x28')]();});}};}function handleEntityNotFound(_0x4e8ed9,_0x24bafb){return function(_0xe1c04a){if(!_0xe1c04a){_0x4e8ed9[_0xd80e('0x29')](0x194);}return _0xe1c04a;};}function handleError(_0x46c05d,_0x5376eb){_0x5376eb=_0x5376eb||0x1f4;return function(_0x15f317){logger[_0xd80e('0x2a')](_0x15f317[_0xd80e('0x2b')]);if(_0x15f317[_0xd80e('0x2c')]){delete _0x15f317[_0xd80e('0x2c')];}_0x46c05d[_0xd80e('0x1b')](_0x5376eb)[_0xd80e('0x2d')](_0x15f317);};}exports[_0xd80e('0x2e')]=function(_0x5522dd,_0x54504e){var _0x30f9bd={},_0x1303eb={},_0x400220={'count':0x0,'rows':[]};var _0x32360c=_[_0xd80e('0x2f')](db[_0xd80e('0x30')]['rawAttributes'],function(_0x568d82){return{'name':_0x568d82[_0xd80e('0x31')],'type':_0x568d82[_0xd80e('0x32')][_0xd80e('0x33')]};});_0x1303eb[_0xd80e('0x34')]=_[_0xd80e('0x2f')](_0x32360c,_0xd80e('0x2c'));_0x1303eb[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x5522dd['query']);_0x1303eb['filters']=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],_0x1303eb[_0xd80e('0x35')]);_0x30f9bd[_0xd80e('0x38')]=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x5522dd[_0xd80e('0x35')][_0xd80e('0x39')]));_0x30f9bd[_0xd80e('0x38')]=_0x30f9bd['attributes'][_0xd80e('0x3a')]?_0x30f9bd['attributes']:_0x1303eb[_0xd80e('0x34')];if(!_0x5522dd[_0xd80e('0x35')][_0xd80e('0x3b')](_0xd80e('0x3c'))){_0x30f9bd['limit']=qs[_0xd80e('0x1f')](_0x5522dd['query'][_0xd80e('0x1f')]);_0x30f9bd['offset']=qs[_0xd80e('0x1d')](_0x5522dd[_0xd80e('0x35')]['offset']);}_0x30f9bd[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x5522dd[_0xd80e('0x35')]['sort']);_0x30f9bd[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x5522dd[_0xd80e('0x35')],_0x1303eb[_0xd80e('0x40')]),_0x32360c);if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x42')]){_0x30f9bd[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x30f9bd['where'],{'$or':_['map'](_0x32360c,function(_0x4e92f6){if(_0x4e92f6[_0xd80e('0x32')]!==_0xd80e('0x44')){var _0x55925e={};_0x55925e[_0x4e92f6[_0xd80e('0x2c')]]={'$like':'%'+_0x5522dd['query'][_0xd80e('0x42')]+'%'};return _0x55925e;}})});}_0x30f9bd=_['merge']({},_0x30f9bd,_0x5522dd[_0xd80e('0x45')]);var _0xae1514={'where':_0x30f9bd['where']};return db['VoiceMail'][_0xd80e('0x20')](_0xae1514)[_0xd80e('0x25')](function(_0x439673){_0x400220[_0xd80e('0x20')]=_0x439673;if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x46')]){_0x30f9bd[_0xd80e('0x47')]=[{'all':!![]}];}return db[_0xd80e('0x30')][_0xd80e('0x48')](_0x30f9bd);})[_0xd80e('0x25')](function(_0x1bbb36){_0x400220[_0xd80e('0x49')]=_0x1bbb36;return _0x400220;})[_0xd80e('0x25')](respondWithFilteredResult(_0x54504e,_0x30f9bd))[_0xd80e('0x4a')](handleError(_0x54504e,null));};exports[_0xd80e('0x4b')]=function(_0x7f80a,_0x558911){var _0x52213c={'raw':!![],'where':{'id':_0x7f80a[_0xd80e('0x4c')]['id']}},_0x5bdea5={};_0x5bdea5['model']=_[_0xd80e('0x36')](db[_0xd80e('0x30')][_0xd80e('0x4d')]);_0x5bdea5[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x7f80a[_0xd80e('0x35')]);_0x5bdea5['filters']=_['intersection'](_0x5bdea5['model'],_0x5bdea5[_0xd80e('0x35')]);_0x52213c['attributes']=_[_0xd80e('0x37')](_0x5bdea5[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x7f80a[_0xd80e('0x35')][_0xd80e('0x39')]));_0x52213c['attributes']=_0x52213c[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x52213c[_0xd80e('0x38')]:_0x5bdea5['model'];if(_0x7f80a[_0xd80e('0x35')][_0xd80e('0x46')]){_0x52213c[_0xd80e('0x47')]=[{'all':!![]}];}_0x52213c=_['merge']({},_0x52213c,_0x7f80a[_0xd80e('0x45')]);return db[_0xd80e('0x30')][_0xd80e('0x4e')](_0x52213c)[_0xd80e('0x25')](handleEntityNotFound(_0x558911,null))[_0xd80e('0x25')](respondWithResult(_0x558911,null))[_0xd80e('0x4a')](handleError(_0x558911,null));};exports['create']=function(_0x5aad1b,_0x275985){return db[_0xd80e('0x30')][_0xd80e('0x4f')](_0x5aad1b['body'],{})['then'](function(_0x1762a8){var _0xff0980=_0x5aad1b[_0xd80e('0x50')][_0xd80e('0x27')]({'plain':!![]});if(!_0xff0980)throw new Error(_0xd80e('0x51'));if(_0xff0980['role']===_0xd80e('0x50')){var _0x5c392d=_0x1762a8[_0xd80e('0x27')]({'plain':!![]});var _0x31107b='Voicemails';return db[_0xd80e('0x52')][_0xd80e('0x4e')]({'where':{'name':_0x31107b,'userProfileId':_0xff0980[_0xd80e('0x53')]},'raw':!![]})[_0xd80e('0x25')](function(_0x44b2f5){if(_0x44b2f5&&_0x44b2f5[_0xd80e('0x54')]===0x0){return db[_0xd80e('0x55')]['create']({'name':_0x5c392d[_0xd80e('0x2c')],'resourceId':_0x5c392d['id'],'type':_0x44b2f5[_0xd80e('0x2c')],'sectionId':_0x44b2f5['id']},{})[_0xd80e('0x25')](function(){return _0x1762a8;});}else{return _0x1762a8;}})['catch'](function(_0x52ab04){logger[_0xd80e('0x2a')](_0xd80e('0x56'),_0x52ab04);throw _0x52ab04;});}return _0x1762a8;})[_0xd80e('0x25')](respondWithResult(_0x275985,0xc9))[_0xd80e('0x4a')](handleError(_0x275985,null));};exports[_0xd80e('0x24')]=function(_0x8b7a70,_0x53b2b8){if(_0x8b7a70[_0xd80e('0x57')]['id']){delete _0x8b7a70['body']['id'];}return db[_0xd80e('0x30')]['find']({'where':{'id':_0x8b7a70[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x53b2b8,null))[_0xd80e('0x25')](saveUpdates(_0x8b7a70[_0xd80e('0x57')],null))[_0xd80e('0x25')](respondWithResult(_0x53b2b8,null))[_0xd80e('0x4a')](handleError(_0x53b2b8,null));};exports['destroy']=function(_0x13270c,_0x4e7edd){return db[_0xd80e('0x30')][_0xd80e('0x4e')]({'where':{'id':_0x13270c['params']['id']}})['then'](handleEntityNotFound(_0x4e7edd,null))[_0xd80e('0x25')](removeEntity(_0x4e7edd,null))[_0xd80e('0x4a')](handleError(_0x4e7edd,null));};exports[_0xd80e('0x58')]=function(_0x570a02,_0x568770,_0x1ba0ed){return db[_0xd80e('0x30')]['findOne']({'where':{'id':_0x570a02[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x568770,null))[_0xd80e('0x25')](function(_0x539390){var _0x41dda0;var _0x589c0b={},_0x720eab={};_0x720eab[_0xd80e('0x34')]=_[_0xd80e('0x36')](db[_0xd80e('0x59')]['rawAttributes']);_0x720eab[_0xd80e('0x35')]=_['keys'](_0x570a02[_0xd80e('0x35')]);_0x720eab['filters']=_[_0xd80e('0x37')](_0x720eab[_0xd80e('0x34')],_0x720eab[_0xd80e('0x35')]);_0x589c0b[_0xd80e('0x38')]=_['intersection'](_0x720eab[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x570a02['query'][_0xd80e('0x39')]));_0x589c0b[_0xd80e('0x38')]=_0x589c0b[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x589c0b['attributes']:_0x720eab[_0xd80e('0x34')];if(!_0x570a02[_0xd80e('0x35')]['hasOwnProperty'](_0xd80e('0x3c'))){_0x589c0b[_0xd80e('0x1f')]=qs[_0xd80e('0x1f')](_0x570a02['query']['limit']);_0x589c0b['offset']=qs['offset'](_0x570a02[_0xd80e('0x35')]['offset']);}_0x589c0b[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x570a02[_0xd80e('0x35')]['sort']);_0x589c0b[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x570a02[_0xd80e('0x35')],_0x720eab[_0xd80e('0x40')]));if(_0x570a02[_0xd80e('0x35')][_0xd80e('0x42')]){_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b['where'],{'$or':_['map'](_0x589c0b[_0xd80e('0x38')],function(_0x410ed6){var _0x10104c={};_0x10104c[_0x410ed6]={'$like':'%'+_0x570a02[_0xd80e('0x35')]['filter']+'%'};return _0x10104c;})});}_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b[_0xd80e('0x3f')],{'mailboxuser':_0x539390[_0xd80e('0x5a')]});_0x589c0b=_[_0xd80e('0x43')]({},_0x589c0b,_0x570a02['options']);return db[_0xd80e('0x59')][_0xd80e('0x5b')](_0x589c0b)[_0xd80e('0x25')](respondWithFilteredResult(_0x568770,_0x589c0b));})[_0xd80e('0x4a')](handleError(_0x568770,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5be349d..f1a8315 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 _0x3259=['./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x257e8f,_0xdc7fc9){var _0x2d8b1e=function(_0x24739a){while(--_0x24739a){_0x257e8f['push'](_0x257e8f['shift']());}};_0x2d8b1e(++_0xdc7fc9);}(_0x3259,0x1c1));var _0x9325=function(_0x952c0c,_0x386b5e){_0x952c0c=_0x952c0c-0x0;var _0x2dc8cf=_0x3259[_0x952c0c];return _0x2dc8cf;};'use strict';var _=require(_0x9325('0x0'));var util=require(_0x9325('0x1'));var logger=require(_0x9325('0x2'))(_0x9325('0x3'));var moment=require(_0x9325('0x4'));var BPromise=require(_0x9325('0x5'));var rp=require(_0x9325('0x6'));var fs=require('fs');var path=require(_0x9325('0x7'));var rimraf=require(_0x9325('0x8'));var config=require(_0x9325('0x9'));var attributes=require(_0x9325('0xa'));module[_0x9325('0xb')]=function(_0x4dfbac,_0x157625){return _0x4dfbac[_0x9325('0xc')](_0x9325('0xd'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9325('0xe'),'fields':[_0x9325('0xf'),_0x9325('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4792=['request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4792,0x170));var _0x2479=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x4792[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0x2479('0x0'));var util=require(_0x2479('0x1'));var logger=require(_0x2479('0x2'))(_0x2479('0x3'));var moment=require(_0x2479('0x4'));var BPromise=require(_0x2479('0x5'));var rp=require(_0x2479('0x6'));var fs=require('fs');var path=require(_0x2479('0x7'));var rimraf=require(_0x2479('0x8'));var config=require(_0x2479('0x9'));var attributes=require('./voiceMail.attributes');module[_0x2479('0xa')]=function(_0xef5283,_0x3bcc44){return _0xef5283[_0x2479('0xb')](_0x2479('0xc'),attributes,{'tableName':_0x2479('0xd'),'paranoid':![],'indexes':[{'name':_0x2479('0xe'),'fields':[_0x2479('0xf'),_0x2479('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index eb320ae..e200a0a 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 _0x7645=['http','request','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4e3558,_0x53aa25){var _0x52324b=function(_0x4d79d9){while(--_0x4d79d9){_0x4e3558['push'](_0x4e3558['shift']());}};_0x52324b(++_0x53aa25);}(_0x7645,0x1d5));var _0x5764=function(_0x5b71b3,_0x4ad845){_0x5b71b3=_0x5b71b3-0x0;var _0x2bee43=_0x7645[_0x5b71b3];return _0x2bee43;};'use strict';var _=require(_0x5764('0x0'));var util=require(_0x5764('0x1'));var moment=require(_0x5764('0x2'));var BPromise=require(_0x5764('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5764('0x4'));var db=require(_0x5764('0x5'))['db'];var utils=require(_0x5764('0x6'));var logger=require(_0x5764('0x7'))(_0x5764('0x8'));var config=require('../../config/environment');var jayson=require(_0x5764('0x9'));var client=jayson[_0x5764('0xa')][_0x5764('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c5380,_0x1a6a19,_0x3447ab){return new BPromise(function(_0x7063d,_0x12b336){return client[_0x5764('0xc')](_0x4c5380,_0x3447ab)[_0x5764('0xd')](function(_0x24f0e6){logger['info'](_0x5764('0xe'),_0x1a6a19,'request\x20sent');logger[_0x5764('0xf')](_0x5764('0x10'),_0x1a6a19,'request\x20sent',JSON[_0x5764('0x11')](_0x24f0e6));if(_0x24f0e6['error']){if(_0x24f0e6['error'][_0x5764('0x12')]===0x1f4){logger[_0x5764('0x13')]('VoiceMail,\x20%s,\x20%s',_0x1a6a19,_0x24f0e6[_0x5764('0x13')]['message']);return _0x12b336(_0x24f0e6['error'][_0x5764('0x14')]);}logger[_0x5764('0x13')](_0x5764('0xe'),_0x1a6a19,_0x24f0e6[_0x5764('0x13')][_0x5764('0x14')]);return _0x7063d(_0x24f0e6[_0x5764('0x13')][_0x5764('0x14')]);}else{logger[_0x5764('0x15')](_0x5764('0xe'),_0x1a6a19,'request\x20sent');_0x7063d(_0x24f0e6[_0x5764('0x16')][_0x5764('0x14')]);}})[_0x5764('0x17')](function(_0x21f88d){logger['error'](_0x5764('0xe'),_0x1a6a19,_0x21f88d);_0x12b336(_0x21f88d);});});} \ No newline at end of file +var _0xcdad=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x39c65b,_0x4b5a02){var _0x487fee=function(_0x5d3a6b){while(--_0x5d3a6b){_0x39c65b['push'](_0x39c65b['shift']());}};_0x487fee(++_0x4b5a02);}(_0xcdad,0x1da));var _0xdcda=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xcdad[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0xdcda('0x0'));var util=require(_0xdcda('0x1'));var moment=require(_0xdcda('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcda('0x3'));var fs=require('fs');var Redis=require(_0xdcda('0x4'));var db=require(_0xdcda('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcda('0x6'))(_0xdcda('0x7'));var config=require(_0xdcda('0x8'));var jayson=require(_0xdcda('0x9'));var client=jayson[_0xdcda('0xa')][_0xdcda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x456eee,_0x4d2f8c,_0x3dc17c){return new BPromise(function(_0x155332,_0x27110b){return client[_0xdcda('0xc')](_0x456eee,_0x3dc17c)[_0xdcda('0xd')](function(_0x2ce9cc){logger[_0xdcda('0xe')](_0xdcda('0xf'),_0x4d2f8c,'request\x20sent');logger[_0xdcda('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4d2f8c,_0xdcda('0x11'),JSON[_0xdcda('0x12')](_0x2ce9cc));if(_0x2ce9cc[_0xdcda('0x13')]){if(_0x2ce9cc[_0xdcda('0x13')][_0xdcda('0x14')]===0x1f4){logger['error'](_0xdcda('0xf'),_0x4d2f8c,_0x2ce9cc[_0xdcda('0x13')]['message']);return _0x27110b(_0x2ce9cc[_0xdcda('0x13')][_0xdcda('0x15')]);}logger[_0xdcda('0x13')]('VoiceMail,\x20%s,\x20%s',_0x4d2f8c,_0x2ce9cc[_0xdcda('0x13')][_0xdcda('0x15')]);return _0x155332(_0x2ce9cc[_0xdcda('0x13')]['message']);}else{logger[_0xdcda('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4d2f8c,_0xdcda('0x11'));_0x155332(_0x2ce9cc[_0xdcda('0x16')]['message']);}})[_0xdcda('0x17')](function(_0x46a5fa){logger['error'](_0xdcda('0xf'),_0x4d2f8c,_0x46a5fa);_0x27110b(_0x46a5fa);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 7b3897b..87749d1 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 _0xefc3=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','download','post','put','update','delete'];(function(_0x28a3a1,_0x488bd6){var _0x268719=function(_0x525071){while(--_0x525071){_0x28a3a1['push'](_0x28a3a1['shift']());}};_0x268719(++_0x488bd6);}(_0xefc3,0x1d5));var _0x3efc=function(_0x397e93,_0x24f3af){_0x397e93=_0x397e93-0x0;var _0x4c39ab=_0xefc3[_0x397e93];return _0x4c39ab;};'use strict';var multer=require(_0x3efc('0x0'));var util=require('util');var path=require(_0x3efc('0x1'));var timeout=require(_0x3efc('0x2'));var express=require(_0x3efc('0x3'));var router=express[_0x3efc('0x4')]();var fs_extra=require(_0x3efc('0x5'));var auth=require(_0x3efc('0x6'));var interaction=require(_0x3efc('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x3efc('0x8')]('/',auth[_0x3efc('0x9')](),controller[_0x3efc('0xa')]);router[_0x3efc('0x8')](_0x3efc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3efc('0x8')]('/:id/download',auth[_0x3efc('0x9')](),controller[_0x3efc('0xc')]);router[_0x3efc('0xd')]('/',auth[_0x3efc('0x9')](),controller['create']);router[_0x3efc('0xe')](_0x3efc('0xb'),auth['isAuthenticated'](),controller[_0x3efc('0xf')]);router[_0x3efc('0x10')](_0x3efc('0xb'),auth['isAuthenticated'](),controller[_0x3efc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x91a4=['destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','show','/:id/download','download','isAuthenticated','create','put','update','delete'];(function(_0x29de25,_0x41bcc8){var _0x28b5d0=function(_0x6e80c3){while(--_0x6e80c3){_0x29de25['push'](_0x29de25['shift']());}};_0x28b5d0(++_0x41bcc8);}(_0x91a4,0x1e2));var _0x491a=function(_0x2b1854,_0xb6249c){_0x2b1854=_0x2b1854-0x0;var _0x1bb311=_0x91a4[_0x2b1854];return _0x1bb311;};'use strict';var multer=require(_0x491a('0x0'));var util=require(_0x491a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x491a('0x2'));var router=express[_0x491a('0x3')]();var fs_extra=require(_0x491a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x491a('0x5'));var config=require(_0x491a('0x6'));var controller=require(_0x491a('0x7'));router[_0x491a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x491a('0x9'),auth['isAuthenticated'](),controller[_0x491a('0xa')]);router[_0x491a('0x8')](_0x491a('0xb'),auth['isAuthenticated'](),controller[_0x491a('0xc')]);router['post']('/',auth[_0x491a('0xd')](),controller[_0x491a('0xe')]);router[_0x491a('0xf')](_0x491a('0x9'),auth[_0x491a('0xd')](),controller[_0x491a('0x10')]);router[_0x491a('0x11')]('/:id',auth[_0x491a('0xd')](),controller[_0x491a('0x12')]);module[_0x491a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9bf46d9..8d05042 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 _0xc51e=['BLOB','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','STRING'];(function(_0x58b8db,_0x4e4c71){var _0x53aea6=function(_0x2c5d9b){while(--_0x2c5d9b){_0x58b8db['push'](_0x58b8db['shift']());}};_0x53aea6(++_0x4e4c71);}(_0xc51e,0x1b8));var _0xec51=function(_0x5cb7dd,_0x290cfb){_0x5cb7dd=_0x5cb7dd-0x0;var _0x5ee23e=_0xc51e[_0x5cb7dd];return _0x5ee23e;};'use strict';var Sequelize=require(_0xec51('0x0'));module[_0xec51('0x1')]={'name':{'type':Sequelize[_0xec51('0x2')],'get':function(_0x11c430){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xec51('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0xec51('0x5'))}}; \ No newline at end of file +var _0x622a=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP'];(function(_0x870a2a,_0x4def3b){var _0x487a29=function(_0x11366f){while(--_0x11366f){_0x870a2a['push'](_0x870a2a['shift']());}};_0x487a29(++_0x4def3b);}(_0x622a,0x1d8));var _0xa622=function(_0x2147fa,_0x2df287){_0x2147fa=_0x2147fa-0x0;var _0xfdb821=_0x622a[_0x2147fa];return _0xfdb821;};'use strict';var Sequelize=require(_0xa622('0x0'));module[_0xa622('0x1')]={'name':{'type':Sequelize[_0xa622('0x2')],'get':function(_0xdae7ed){return this[_0xa622('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xa622('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xa622('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa622('0x5')],'defaultValue':''},'stamp':{'type':_0xa622('0x7'),'defaultValue':Sequelize[_0xa622('0x8')](_0xa622('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c70b2e0..0aa351c 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 _0xa448=['moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','end','sendStatus','error','name','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','rows','params','find','catch','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','zip-dir','fast-json-patch'];(function(_0xfd183f,_0x21bbde){var _0x40b42e=function(_0x5dfbf3){while(--_0x5dfbf3){_0xfd183f['push'](_0xfd183f['shift']());}};_0x40b42e(++_0x21bbde);}(_0xa448,0xe7));var _0x8a44=function(_0x2204c2,_0x21bb81){_0x2204c2=_0x2204c2-0x0;var _0x234f68=_0xa448[_0x2204c2];return _0x234f68;};'use strict';var emlformat=require(_0x8a44('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a44('0x1'));var jsonpatch=require(_0x8a44('0x2'));var rp=require('request-promise');var moment=require(_0x8a44('0x3'));var BPromise=require(_0x8a44('0x4'));var Mustache=require('mustache');var util=require(_0x8a44('0x5'));var path=require(_0x8a44('0x6'));var sox=require('sox');var csv=require(_0x8a44('0x7'));var ejs=require(_0x8a44('0x8'));var fs=require('fs');var fs_extra=require(_0x8a44('0x9'));var _=require(_0x8a44('0xa'));var squel=require('squel');var crypto=require(_0x8a44('0xb'));var jsforce=require(_0x8a44('0xc'));var deskjs=require(_0x8a44('0xd'));var toCsv=require(_0x8a44('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a44('0xe'));var qs=require(_0x8a44('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a44('0x10'));var logger=require(_0x8a44('0x11'))(_0x8a44('0x12'));var utils=require(_0x8a44('0x13'));var config=require(_0x8a44('0x14'));var licenseUtil=require(_0x8a44('0x15'));var db=require(_0x8a44('0x16'))['db'];function respondWithStatusCode(_0x4d30ff,_0x107537){_0x107537=_0x107537||0xcc;return function(_0x5a843b){if(_0x5a843b){return _0x4d30ff['sendStatus'](_0x107537);}return _0x4d30ff[_0x8a44('0x17')](_0x107537)['end']();};}function respondWithResult(_0x4e97d6,_0x3f0a94){_0x3f0a94=_0x3f0a94||0xc8;return function(_0xdb3442){if(_0xdb3442){return _0x4e97d6[_0x8a44('0x17')](_0x3f0a94)['json'](_0xdb3442);}};}function respondWithFilteredResult(_0xcc0e83,_0xaab8d5){return function(_0x3f717b){if(_0x3f717b){var _0x5c278d=typeof _0xaab8d5[_0x8a44('0x18')]===_0x8a44('0x19')&&typeof _0xaab8d5[_0x8a44('0x1a')]==='undefined';var _0x15304f=_0x3f717b['count'];var _0x4e0a75=_0x5c278d?0x0:_0xaab8d5[_0x8a44('0x18')];var _0x4851cc=_0x5c278d?_0x3f717b[_0x8a44('0x1b')]:_0xaab8d5[_0x8a44('0x18')]+_0xaab8d5[_0x8a44('0x1a')];var _0x161337;if(_0x4851cc>=_0x15304f){_0x4851cc=_0x15304f;_0x161337=0xc8;}else{_0x161337=0xce;}_0xcc0e83[_0x8a44('0x17')](_0x161337);return _0xcc0e83[_0x8a44('0x1c')](_0x8a44('0x1d'),_0x4e0a75+'-'+_0x4851cc+'/'+_0x15304f)[_0x8a44('0x1e')](_0x3f717b);}return null;};}function patchUpdates(_0x5c40a4){return function(_0x1358b3){try{jsonpatch[_0x8a44('0x1f')](_0x1358b3,_0x5c40a4,!![]);}catch(_0x5c6c83){return BPromise['reject'](_0x5c6c83);}return _0x1358b3[_0x8a44('0x20')]();};}function saveUpdates(_0x327380,_0x15d576){return function(_0x1538c2){if(_0x1538c2){return _0x1538c2[_0x8a44('0x21')](_0x327380)[_0x8a44('0x22')](function(_0x1b526d){return _0x1b526d;});}return null;};}function removeEntity(_0x285f8b,_0x109e02){return function(_0x353327){if(_0x353327){return _0x353327['destroy']()[_0x8a44('0x22')](function(){_0x285f8b[_0x8a44('0x17')](0xcc)[_0x8a44('0x23')]();});}};}function handleEntityNotFound(_0x5b98f5,_0x4310f6){return function(_0xb8ec79){if(!_0xb8ec79){_0x5b98f5[_0x8a44('0x24')](0x194);}return _0xb8ec79;};}function handleError(_0x5777d4,_0x81bf9){_0x81bf9=_0x81bf9||0x1f4;return function(_0x59c6ff){logger[_0x8a44('0x25')](_0x59c6ff['stack']);if(_0x59c6ff[_0x8a44('0x26')]){delete _0x59c6ff[_0x8a44('0x26')];}_0x5777d4[_0x8a44('0x17')](_0x81bf9)['send'](_0x59c6ff);};}exports['index']=function(_0x270ecd,_0x1fa00f){var _0x5ce05f={},_0x24cde7={},_0x126117={'count':0x0,'rows':[]};var _0x52db04=_['map'](db['VoiceMailMessage'][_0x8a44('0x27')],function(_0x70bc6a){return{'name':_0x70bc6a[_0x8a44('0x28')],'type':_0x70bc6a[_0x8a44('0x29')]['key']};});_0x24cde7[_0x8a44('0x2a')]=_['differenceBy'](_[_0x8a44('0x2b')](_0x52db04,'name'),[_0x8a44('0x26')]);_0x24cde7[_0x8a44('0x2c')]=_[_0x8a44('0x2d')](_0x270ecd[_0x8a44('0x2c')]);_0x24cde7[_0x8a44('0x2e')]=_[_0x8a44('0x2f')](_0x24cde7[_0x8a44('0x2a')],_0x24cde7[_0x8a44('0x2c')]);_0x5ce05f[_0x8a44('0x30')]=_[_0x8a44('0x2f')](_0x24cde7[_0x8a44('0x2a')],qs[_0x8a44('0x31')](_0x270ecd[_0x8a44('0x2c')]['fields']));_0x5ce05f[_0x8a44('0x30')]=_0x5ce05f[_0x8a44('0x30')][_0x8a44('0x32')]?_0x5ce05f['attributes']:_0x24cde7['model'];if(!_0x270ecd['query']['hasOwnProperty']('nolimit')){_0x5ce05f[_0x8a44('0x1a')]=qs[_0x8a44('0x1a')](_0x270ecd[_0x8a44('0x2c')][_0x8a44('0x1a')]);_0x5ce05f['offset']=qs[_0x8a44('0x18')](_0x270ecd[_0x8a44('0x2c')][_0x8a44('0x18')]);}_0x5ce05f[_0x8a44('0x33')]=qs[_0x8a44('0x34')](_0x270ecd[_0x8a44('0x2c')]['sort']);_0x5ce05f['where']=qs[_0x8a44('0x2e')](_['pick'](_0x270ecd[_0x8a44('0x2c')],_0x24cde7[_0x8a44('0x2e')]),_0x52db04);if(_0x270ecd[_0x8a44('0x2c')][_0x8a44('0x35')]){_0x5ce05f[_0x8a44('0x36')]=_[_0x8a44('0x37')](_0x5ce05f[_0x8a44('0x36')],{'$or':_[_0x8a44('0x2b')](_0x52db04,function(_0x6b4071){if(_0x6b4071['type']!==_0x8a44('0x38')){var _0x581812={};_0x581812[_0x6b4071['name']]={'$like':'%'+_0x270ecd['query'][_0x8a44('0x35')]+'%'};return _0x581812;}})});}_0x5ce05f=_[_0x8a44('0x37')]({},_0x5ce05f,_0x270ecd[_0x8a44('0x39')]);var _0x2c7398={'where':_0x5ce05f['where']};return db[_0x8a44('0x3a')][_0x8a44('0x1b')](_0x2c7398)[_0x8a44('0x22')](function(_0x3fa1c1){_0x126117['count']=_0x3fa1c1;if(_0x270ecd['query'][_0x8a44('0x3b')]){_0x5ce05f[_0x8a44('0x3c')]=[{'all':!![]}];}return db[_0x8a44('0x3a')][_0x8a44('0x3d')](_0x5ce05f);})[_0x8a44('0x22')](function(_0x39fa0c){_0x126117[_0x8a44('0x3e')]=_0x39fa0c;return _0x126117;})[_0x8a44('0x22')](respondWithFilteredResult(_0x1fa00f,_0x5ce05f))['catch'](handleError(_0x1fa00f,null));};exports['show']=function(_0x33758c,_0x4f7f93){var _0xf35d80={'raw':!![],'where':{'id':_0x33758c[_0x8a44('0x3f')]['id']}},_0x55a70={};_0x55a70[_0x8a44('0x2a')]=_['keys'](db[_0x8a44('0x3a')][_0x8a44('0x27')]);_0x55a70[_0x8a44('0x2c')]=_[_0x8a44('0x2d')](_0x33758c['query']);_0x55a70[_0x8a44('0x2e')]=_[_0x8a44('0x2f')](_0x55a70[_0x8a44('0x2a')],_0x55a70[_0x8a44('0x2c')]);_0xf35d80['attributes']=_[_0x8a44('0x2f')](_0x55a70[_0x8a44('0x2a')],qs[_0x8a44('0x31')](_0x33758c[_0x8a44('0x2c')][_0x8a44('0x31')]));_0xf35d80['attributes']=_0xf35d80[_0x8a44('0x30')][_0x8a44('0x32')]?_0xf35d80[_0x8a44('0x30')]:_0x55a70['model'];if(_0x33758c['query']['includeAll']){_0xf35d80['include']=[{'all':!![]}];}_0xf35d80=_[_0x8a44('0x37')]({},_0xf35d80,_0x33758c[_0x8a44('0x39')]);return db[_0x8a44('0x3a')][_0x8a44('0x40')](_0xf35d80)[_0x8a44('0x22')](handleEntityNotFound(_0x4f7f93,null))['then'](respondWithResult(_0x4f7f93,null))[_0x8a44('0x41')](handleError(_0x4f7f93,null));};exports['create']=function(_0x393e52,_0x3e80f5){return db['VoiceMailMessage']['create'](_0x393e52[_0x8a44('0x42')],{})['then'](respondWithResult(_0x3e80f5,0xc9))[_0x8a44('0x41')](handleError(_0x3e80f5,null));};exports['update']=function(_0x1e6469,_0x282afa){if(_0x1e6469['body']['id']){delete _0x1e6469['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x1e6469[_0x8a44('0x3f')]['id']}})[_0x8a44('0x22')](handleEntityNotFound(_0x282afa,null))[_0x8a44('0x22')](saveUpdates(_0x1e6469[_0x8a44('0x42')],null))['then'](respondWithResult(_0x282afa,null))[_0x8a44('0x41')](handleError(_0x282afa,null));};exports[_0x8a44('0x43')]=function(_0x171fa7,_0x59d779){return db[_0x8a44('0x3a')]['find']({'where':{'id':_0x171fa7[_0x8a44('0x3f')]['id']}})[_0x8a44('0x22')](handleEntityNotFound(_0x59d779,null))['then'](removeEntity(_0x59d779,null))[_0x8a44('0x41')](handleError(_0x59d779,null));};exports[_0x8a44('0x44')]=function(_0x25963f,_0xebf5ce,_0x49afc8){return db[_0x8a44('0x3a')][_0x8a44('0x40')]({'where':{'id':_0x25963f[_0x8a44('0x3f')]['id']},'attributes':['id',_0x8a44('0x45'),_0x8a44('0x46')]})[_0x8a44('0x22')](handleEntityNotFound(_0xebf5ce,null))[_0x8a44('0x22')](function(_0x3a97bc){if(_0x3a97bc){if(!_0x3a97bc[_0x8a44('0x45')]){throw new db[(_0x8a44('0x47'))][(_0x8a44('0x48'))](_0x8a44('0x49'));}var _0x50fbfa={'Content-Type':_0x8a44('0x4a'),'Content-Disposition':_0x8a44('0x4b')};if(_0x3a97bc[_0x8a44('0x46')]){_0x50fbfa[_0x8a44('0x4c')]='attachment;\x20filename=\x22'+_0x3a97bc[_0x8a44('0x46')]+_0x8a44('0x4d');}_0xebf5ce[_0x8a44('0x1c')](_0x50fbfa);return _0xebf5ce['send'](new Buffer(_0x3a97bc[_0x8a44('0x45')]));}})[_0x8a44('0x41')](handleError(_0xebf5ce,null));}; \ No newline at end of file +var _0x2245=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','model','differenceBy','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','VoiceMailMessage','findAll','catch','show','params','include','find','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format'];(function(_0x5aeda7,_0x74556a){var _0x122f8a=function(_0x38d083){while(--_0x38d083){_0x5aeda7['push'](_0x5aeda7['shift']());}};_0x122f8a(++_0x74556a);}(_0x2245,0xf2));var _0x5224=function(_0x5bf6f6,_0x14ebc4){_0x5bf6f6=_0x5bf6f6-0x0;var _0x1fd3c4=_0x2245[_0x5bf6f6];return _0x1fd3c4;};'use strict';var emlformat=require(_0x5224('0x0'));var rimraf=require(_0x5224('0x1'));var zipdir=require(_0x5224('0x2'));var jsonpatch=require(_0x5224('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5224('0x4'));var Mustache=require(_0x5224('0x5'));var util=require(_0x5224('0x6'));var path=require('path');var sox=require(_0x5224('0x7'));var csv=require(_0x5224('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5224('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5224('0xa'));var jsforce=require(_0x5224('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5224('0xc'));var Papa=require(_0x5224('0xd'));var Redis=require(_0x5224('0xe'));var authService=require(_0x5224('0xf'));var qs=require(_0x5224('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5224('0x11'));var logger=require(_0x5224('0x12'))(_0x5224('0x13'));var utils=require(_0x5224('0x14'));var config=require(_0x5224('0x15'));var licenseUtil=require(_0x5224('0x16'));var db=require(_0x5224('0x17'))['db'];function respondWithStatusCode(_0x16fda4,_0x268f73){_0x268f73=_0x268f73||0xcc;return function(_0x34d190){if(_0x34d190){return _0x16fda4[_0x5224('0x18')](_0x268f73);}return _0x16fda4[_0x5224('0x19')](_0x268f73)[_0x5224('0x1a')]();};}function respondWithResult(_0x29b3be,_0x2a490f){_0x2a490f=_0x2a490f||0xc8;return function(_0x1bb3f4){if(_0x1bb3f4){return _0x29b3be[_0x5224('0x19')](_0x2a490f)[_0x5224('0x1b')](_0x1bb3f4);}};}function respondWithFilteredResult(_0x5ace6c,_0x1555dc){return function(_0x431062){if(_0x431062){var _0x5af71b=typeof _0x1555dc[_0x5224('0x1c')]===_0x5224('0x1d')&&typeof _0x1555dc[_0x5224('0x1e')]===_0x5224('0x1d');var _0x416887=_0x431062[_0x5224('0x1f')];var _0x58c7b7=_0x5af71b?0x0:_0x1555dc['offset'];var _0x487e45=_0x5af71b?_0x431062['count']:_0x1555dc['offset']+_0x1555dc[_0x5224('0x1e')];var _0xdc0a;if(_0x487e45>=_0x416887){_0x487e45=_0x416887;_0xdc0a=0xc8;}else{_0xdc0a=0xce;}_0x5ace6c[_0x5224('0x19')](_0xdc0a);return _0x5ace6c[_0x5224('0x20')]('Content-Range',_0x58c7b7+'-'+_0x487e45+'/'+_0x416887)[_0x5224('0x1b')](_0x431062);}return null;};}function patchUpdates(_0x193223){return function(_0x1e637a){try{jsonpatch[_0x5224('0x21')](_0x1e637a,_0x193223,!![]);}catch(_0x3c6c95){return BPromise[_0x5224('0x22')](_0x3c6c95);}return _0x1e637a[_0x5224('0x23')]();};}function saveUpdates(_0xb10bec,_0x347101){return function(_0x468565){if(_0x468565){return _0x468565[_0x5224('0x24')](_0xb10bec)[_0x5224('0x25')](function(_0x1c6e93){return _0x1c6e93;});}return null;};}function removeEntity(_0x2d5143,_0x4d8996){return function(_0x4b2d4a){if(_0x4b2d4a){return _0x4b2d4a[_0x5224('0x26')]()['then'](function(){_0x2d5143[_0x5224('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba8fdb,_0x3e9486){return function(_0x1c8284){if(!_0x1c8284){_0xba8fdb[_0x5224('0x18')](0x194);}return _0x1c8284;};}function handleError(_0x40d7ae,_0x51b571){_0x51b571=_0x51b571||0x1f4;return function(_0x18090f){logger['error'](_0x18090f[_0x5224('0x27')]);if(_0x18090f[_0x5224('0x28')]){delete _0x18090f[_0x5224('0x28')];}_0x40d7ae[_0x5224('0x19')](_0x51b571)['send'](_0x18090f);};}exports[_0x5224('0x29')]=function(_0x79dc5a,_0x22998e){var _0x3c9b15={},_0x8fdda8={},_0x2bb149={'count':0x0,'rows':[]};var _0x51f5e3=_[_0x5224('0x2a')](db['VoiceMailMessage'][_0x5224('0x2b')],function(_0x4f1b7e){return{'name':_0x4f1b7e[_0x5224('0x2c')],'type':_0x4f1b7e['type']['key']};});_0x8fdda8[_0x5224('0x2d')]=_[_0x5224('0x2e')](_[_0x5224('0x2a')](_0x51f5e3,_0x5224('0x28')),[_0x5224('0x28')]);_0x8fdda8[_0x5224('0x2f')]=_[_0x5224('0x30')](_0x79dc5a[_0x5224('0x2f')]);_0x8fdda8['filters']=_['intersection'](_0x8fdda8[_0x5224('0x2d')],_0x8fdda8[_0x5224('0x2f')]);_0x3c9b15[_0x5224('0x31')]=_[_0x5224('0x32')](_0x8fdda8['model'],qs[_0x5224('0x33')](_0x79dc5a[_0x5224('0x2f')][_0x5224('0x33')]));_0x3c9b15[_0x5224('0x31')]=_0x3c9b15['attributes'][_0x5224('0x34')]?_0x3c9b15[_0x5224('0x31')]:_0x8fdda8[_0x5224('0x2d')];if(!_0x79dc5a['query'][_0x5224('0x35')]('nolimit')){_0x3c9b15[_0x5224('0x1e')]=qs[_0x5224('0x1e')](_0x79dc5a[_0x5224('0x2f')][_0x5224('0x1e')]);_0x3c9b15[_0x5224('0x1c')]=qs[_0x5224('0x1c')](_0x79dc5a['query'][_0x5224('0x1c')]);}_0x3c9b15['order']=qs[_0x5224('0x36')](_0x79dc5a['query'][_0x5224('0x36')]);_0x3c9b15[_0x5224('0x37')]=qs['filters'](_['pick'](_0x79dc5a[_0x5224('0x2f')],_0x8fdda8[_0x5224('0x38')]),_0x51f5e3);if(_0x79dc5a[_0x5224('0x2f')][_0x5224('0x39')]){_0x3c9b15[_0x5224('0x37')]=_[_0x5224('0x3a')](_0x3c9b15[_0x5224('0x37')],{'$or':_[_0x5224('0x2a')](_0x51f5e3,function(_0x3ee60e){if(_0x3ee60e[_0x5224('0x3b')]!==_0x5224('0x3c')){var _0x6b3a08={};_0x6b3a08[_0x3ee60e[_0x5224('0x28')]]={'$like':'%'+_0x79dc5a['query'][_0x5224('0x39')]+'%'};return _0x6b3a08;}})});}_0x3c9b15=_[_0x5224('0x3a')]({},_0x3c9b15,_0x79dc5a[_0x5224('0x3d')]);var _0x498f0b={'where':_0x3c9b15[_0x5224('0x37')]};return db[_0x5224('0x3e')][_0x5224('0x1f')](_0x498f0b)['then'](function(_0x1aff41){_0x2bb149[_0x5224('0x1f')]=_0x1aff41;if(_0x79dc5a[_0x5224('0x2f')]['includeAll']){_0x3c9b15['include']=[{'all':!![]}];}return db[_0x5224('0x3e')][_0x5224('0x3f')](_0x3c9b15);})[_0x5224('0x25')](function(_0x5e6cb3){_0x2bb149['rows']=_0x5e6cb3;return _0x2bb149;})[_0x5224('0x25')](respondWithFilteredResult(_0x22998e,_0x3c9b15))[_0x5224('0x40')](handleError(_0x22998e,null));};exports[_0x5224('0x41')]=function(_0x2c3a31,_0x1afbb3){var _0x136272={'raw':!![],'where':{'id':_0x2c3a31[_0x5224('0x42')]['id']}},_0x1ce411={};_0x1ce411[_0x5224('0x2d')]=_['keys'](db[_0x5224('0x3e')]['rawAttributes']);_0x1ce411[_0x5224('0x2f')]=_[_0x5224('0x30')](_0x2c3a31[_0x5224('0x2f')]);_0x1ce411[_0x5224('0x38')]=_[_0x5224('0x32')](_0x1ce411[_0x5224('0x2d')],_0x1ce411[_0x5224('0x2f')]);_0x136272[_0x5224('0x31')]=_['intersection'](_0x1ce411[_0x5224('0x2d')],qs[_0x5224('0x33')](_0x2c3a31[_0x5224('0x2f')]['fields']));_0x136272[_0x5224('0x31')]=_0x136272[_0x5224('0x31')][_0x5224('0x34')]?_0x136272[_0x5224('0x31')]:_0x1ce411[_0x5224('0x2d')];if(_0x2c3a31[_0x5224('0x2f')]['includeAll']){_0x136272[_0x5224('0x43')]=[{'all':!![]}];}_0x136272=_[_0x5224('0x3a')]({},_0x136272,_0x2c3a31[_0x5224('0x3d')]);return db[_0x5224('0x3e')][_0x5224('0x44')](_0x136272)[_0x5224('0x25')](handleEntityNotFound(_0x1afbb3,null))['then'](respondWithResult(_0x1afbb3,null))['catch'](handleError(_0x1afbb3,null));};exports['create']=function(_0x10d489,_0x3e6f0e){return db[_0x5224('0x3e')]['create'](_0x10d489[_0x5224('0x45')],{})['then'](respondWithResult(_0x3e6f0e,0xc9))[_0x5224('0x40')](handleError(_0x3e6f0e,null));};exports['update']=function(_0xdfcf16,_0x1591e8){if(_0xdfcf16[_0x5224('0x45')]['id']){delete _0xdfcf16[_0x5224('0x45')]['id'];}return db['VoiceMailMessage'][_0x5224('0x44')]({'where':{'id':_0xdfcf16[_0x5224('0x42')]['id']}})[_0x5224('0x25')](handleEntityNotFound(_0x1591e8,null))[_0x5224('0x25')](saveUpdates(_0xdfcf16[_0x5224('0x45')],null))[_0x5224('0x25')](respondWithResult(_0x1591e8,null))['catch'](handleError(_0x1591e8,null));};exports[_0x5224('0x26')]=function(_0x3d53d6,_0x261eb4){return db['VoiceMailMessage']['find']({'where':{'id':_0x3d53d6[_0x5224('0x42')]['id']}})[_0x5224('0x25')](handleEntityNotFound(_0x261eb4,null))[_0x5224('0x25')](removeEntity(_0x261eb4,null))[_0x5224('0x40')](handleError(_0x261eb4,null));};exports[_0x5224('0x46')]=function(_0x17cb79,_0x5bda15,_0x5f5986){return db[_0x5224('0x3e')][_0x5224('0x44')]({'where':{'id':_0x17cb79[_0x5224('0x42')]['id']},'attributes':['id',_0x5224('0x47'),_0x5224('0x48')]})['then'](handleEntityNotFound(_0x5bda15,null))['then'](function(_0x39044c){if(_0x39044c){if(!_0x39044c['recording']){throw new db[(_0x5224('0x49'))][(_0x5224('0x4a'))](_0x5224('0x4b'));}var _0x4c3aa3={'Content-Type':_0x5224('0x4c'),'Content-Disposition':_0x5224('0x4d')};if(_0x39044c[_0x5224('0x48')]){_0x4c3aa3[_0x5224('0x4e')]=_0x5224('0x4f')+_0x39044c['msg_id']+_0x5224('0x50');}_0x5bda15[_0x5224('0x20')](_0x4c3aa3);return _0x5bda15['send'](new Buffer(_0x39044c[_0x5224('0x47')]));}})[_0x5224('0x40')](handleError(_0x5bda15,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b518bb5..b4ece78 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 _0x722c=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes'];(function(_0x50221f,_0x59ef1a){var _0x5ed563=function(_0x2464b2){while(--_0x2464b2){_0x50221f['push'](_0x50221f['shift']());}};_0x5ed563(++_0x59ef1a);}(_0x722c,0x122));var _0xc722=function(_0x241044,_0x41c81b){_0x241044=_0x241044-0x0;var _0x50b4b8=_0x722c[_0x241044];return _0x50b4b8;};'use strict';var _=require(_0xc722('0x0'));var util=require('util');var logger=require(_0xc722('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc722('0x2'));var rp=require(_0xc722('0x3'));var fs=require('fs');var path=require(_0xc722('0x4'));var rimraf=require(_0xc722('0x5'));var config=require('../../config/environment');var attributes=require(_0xc722('0x6'));module['exports']=function(_0x1bfdc9,_0x1de671){return _0x1bfdc9[_0xc722('0x7')](_0xc722('0x8'),attributes,{'tableName':_0xc722('0x9'),'paranoid':![],'indexes':[{'name':_0xc722('0xa'),'fields':[_0xc722('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa1be=['api','moment','bluebird','request-promise','path','rimraf','VoiceMailMessage','dir','lodash','../../config/logger'];(function(_0x35a875,_0x381100){var _0xb9b7ed=function(_0x22bafa){while(--_0x22bafa){_0x35a875['push'](_0x35a875['shift']());}};_0xb9b7ed(++_0x381100);}(_0xa1be,0x134));var _0xea1b=function(_0x58a408,_0x81b462){_0x58a408=_0x58a408-0x0;var _0x670d9f=_0xa1be[_0x58a408];return _0x670d9f;};'use strict';var _=require(_0xea1b('0x0'));var util=require('util');var logger=require(_0xea1b('0x1'))(_0xea1b('0x2'));var moment=require(_0xea1b('0x3'));var BPromise=require(_0xea1b('0x4'));var rp=require(_0xea1b('0x5'));var fs=require('fs');var path=require(_0xea1b('0x6'));var rimraf=require(_0xea1b('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x250793,_0x5656db){return _0x250793['define'](_0xea1b('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xea1b('0x9'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a6fb3d7..e49aeb1 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 _0x1900=['rpc','../../config/environment','client','http','request','then','info','error','code','VoiceMailMessage,\x20%s,\x20%s','message','request\x20sent','catch','util','randomstring','../../config/utils','../../config/logger'];(function(_0x4ba2da,_0x2a4ba1){var _0x19c3da=function(_0x48f968){while(--_0x48f968){_0x4ba2da['push'](_0x4ba2da['shift']());}};_0x19c3da(++_0x2a4ba1);}(_0x1900,0x95));var _0x0190=function(_0x305795,_0x260eb7){_0x305795=_0x305795-0x0;var _0x5ee0b9=_0x1900[_0x305795];return _0x5ee0b9;};'use strict';var _=require('lodash');var util=require(_0x0190('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0190('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0190('0x2'));var logger=require(_0x0190('0x3'))(_0x0190('0x4'));var config=require(_0x0190('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0190('0x6')][_0x0190('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51d867,_0x6d5905,_0x476bdc){return new BPromise(function(_0x12d4f5,_0x2a129a){return client[_0x0190('0x8')](_0x51d867,_0x476bdc)[_0x0190('0x9')](function(_0x1ce15a){logger[_0x0190('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x6d5905,'request\x20sent');logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x6d5905,'request\x20sent',JSON['stringify'](_0x1ce15a));if(_0x1ce15a[_0x0190('0xb')]){if(_0x1ce15a['error'][_0x0190('0xc')]===0x1f4){logger[_0x0190('0xb')](_0x0190('0xd'),_0x6d5905,_0x1ce15a['error'][_0x0190('0xe')]);return _0x2a129a(_0x1ce15a[_0x0190('0xb')][_0x0190('0xe')]);}logger[_0x0190('0xb')](_0x0190('0xd'),_0x6d5905,_0x1ce15a[_0x0190('0xb')][_0x0190('0xe')]);return _0x12d4f5(_0x1ce15a[_0x0190('0xb')][_0x0190('0xe')]);}else{logger['info'](_0x0190('0xd'),_0x6d5905,_0x0190('0xf'));_0x12d4f5(_0x1ce15a['result'][_0x0190('0xe')]);}})[_0x0190('0x10')](function(_0x3c4b31){logger['error'](_0x0190('0xd'),_0x6d5905,_0x3c4b31);_0x2a129a(_0x3c4b31);});});} \ No newline at end of file +var _0xa95b=['request\x20sent','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x1f72d6,_0x2f6ea6){var _0x27f3b8=function(_0x488932){while(--_0x488932){_0x1f72d6['push'](_0x1f72d6['shift']());}};_0x27f3b8(++_0x2f6ea6);}(_0xa95b,0x181));var _0xba95=function(_0x2bdb58,_0x580ec2){_0x2bdb58=_0x2bdb58-0x0;var _0x50e771=_0xa95b[_0x2bdb58];return _0x50e771;};'use strict';var _=require(_0xba95('0x0'));var util=require(_0xba95('0x1'));var moment=require(_0xba95('0x2'));var BPromise=require(_0xba95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba95('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba95('0x5'))(_0xba95('0x6'));var config=require(_0xba95('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56fe0b,_0x2d5938,_0x2a0285){return new BPromise(function(_0x3e8688,_0x221c55){return client[_0xba95('0x8')](_0x56fe0b,_0x2a0285)[_0xba95('0x9')](function(_0x199ca6){logger[_0xba95('0xa')](_0xba95('0xb'),_0x2d5938,'request\x20sent');logger[_0xba95('0xc')](_0xba95('0xd'),_0x2d5938,_0xba95('0xe'),JSON['stringify'](_0x199ca6));if(_0x199ca6[_0xba95('0xf')]){if(_0x199ca6[_0xba95('0xf')][_0xba95('0x10')]===0x1f4){logger[_0xba95('0xf')](_0xba95('0xb'),_0x2d5938,_0x199ca6[_0xba95('0xf')][_0xba95('0x11')]);return _0x221c55(_0x199ca6[_0xba95('0xf')][_0xba95('0x11')]);}logger[_0xba95('0xf')](_0xba95('0xb'),_0x2d5938,_0x199ca6[_0xba95('0xf')][_0xba95('0x11')]);return _0x3e8688(_0x199ca6['error']['message']);}else{logger['info'](_0xba95('0xb'),_0x2d5938,_0xba95('0xe'));_0x3e8688(_0x199ca6[_0xba95('0x12')][_0xba95('0x11')]);}})['catch'](function(_0x2cc1e4){logger[_0xba95('0xf')](_0xba95('0xb'),_0x2d5938,_0x2cc1e4);_0x221c55(_0x2cc1e4);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 50517bc..c08687a 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 _0xe86d=['/:id','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','connect-timeout','express','Router','fs-extra','./voiceMusicOnHold.controller','get','isAuthenticated','index'];(function(_0x2c2ced,_0x57af0a){var _0x2d4457=function(_0x46d2aa){while(--_0x46d2aa){_0x2c2ced['push'](_0x2c2ced['shift']());}};_0x2d4457(++_0x57af0a);}(_0xe86d,0x107));var _0xde86=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe86d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xde86('0x0'));var util=require(_0xde86('0x1'));var path=require('path');var timeout=require(_0xde86('0x2'));var express=require(_0xde86('0x3'));var router=express[_0xde86('0x4')]();var fs_extra=require(_0xde86('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde86('0x6'));router[_0xde86('0x7')]('/',auth[_0xde86('0x8')](),controller[_0xde86('0x9')]);router[_0xde86('0x7')](_0xde86('0xa'),auth[_0xde86('0x8')](),controller['show']);router['get'](_0xde86('0xb'),auth[_0xde86('0x8')](),controller[_0xde86('0xc')]);router[_0xde86('0xd')]('/',auth[_0xde86('0x8')](),controller['create']);router['post'](_0xde86('0xb'),auth[_0xde86('0x8')](),controller[_0xde86('0xe')]);router[_0xde86('0xf')](_0xde86('0xa'),auth[_0xde86('0x8')](),controller[_0xde86('0x10')]);router[_0xde86('0x11')](_0xde86('0xa'),auth['isAuthenticated'](),controller[_0xde86('0x12')]);router[_0xde86('0x11')](_0xde86('0x13'),auth[_0xde86('0x8')](),controller[_0xde86('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6ec0=['addSound','put','update','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create'];(function(_0x5d4e01,_0xf80214){var _0x45f871=function(_0x510b48){while(--_0x510b48){_0x5d4e01['push'](_0x5d4e01['shift']());}};_0x45f871(++_0xf80214);}(_0x6ec0,0x91));var _0x06ec=function(_0x554db4,_0x4cbe7b){_0x554db4=_0x554db4-0x0;var _0x6b1dd1=_0x6ec0[_0x554db4];return _0x6b1dd1;};'use strict';var multer=require('multer');var util=require(_0x06ec('0x0'));var path=require(_0x06ec('0x1'));var timeout=require('connect-timeout');var express=require(_0x06ec('0x2'));var router=express[_0x06ec('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x06ec('0x4'));var config=require(_0x06ec('0x5'));var controller=require(_0x06ec('0x6'));router[_0x06ec('0x7')]('/',auth[_0x06ec('0x8')](),controller[_0x06ec('0x9')]);router['get'](_0x06ec('0xa'),auth[_0x06ec('0x8')](),controller['show']);router[_0x06ec('0x7')](_0x06ec('0xb'),auth[_0x06ec('0x8')](),controller[_0x06ec('0xc')]);router[_0x06ec('0xd')]('/',auth[_0x06ec('0x8')](),controller[_0x06ec('0xe')]);router[_0x06ec('0xd')](_0x06ec('0xb'),auth['isAuthenticated'](),controller[_0x06ec('0xf')]);router[_0x06ec('0x10')](_0x06ec('0xa'),auth['isAuthenticated'](),controller[_0x06ec('0x11')]);router[_0x06ec('0x12')]('/:id',auth[_0x06ec('0x8')](),controller['destroy']);router[_0x06ec('0x12')]('/:id/sounds/:id2',auth[_0x06ec('0x8')](),controller['removeSound']);module[_0x06ec('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 189092d..07868a0 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 _0x9931=['files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','STRING','custom'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x9931,0xcd));var _0x1993=function(_0x3bfb3c,_0x3c24c3){_0x3bfb3c=_0x3bfb3c-0x0;var _0x4a0919=_0x9931[_0x3bfb3c];return _0x4a0919;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1993('0x0')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x1993('0x1'),_0x1993('0x2'),'mp3nb',_0x1993('0x3'),_0x1993('0x4'),_0x1993('0x5')),'allowNull':!![],'defaultValue':_0x1993('0x2')},'directory':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![]},'digit':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![],'defaultValue':_0x1993('0x6')},'format':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![]},'stamp':{'type':_0x1993('0x7')},'defaultEntry':{'type':Sequelize[_0x1993('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x74bf=['quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom'];(function(_0x44099b,_0x56c5b1){var _0x5ba55d=function(_0x259eb5){while(--_0x259eb5){_0x44099b['push'](_0x44099b['shift']());}};_0x5ba55d(++_0x56c5b1);}(_0x74bf,0x1c3));var _0xf74b=function(_0x3161b8,_0x2ddde4){_0x3161b8=_0x3161b8-0x0;var _0x42d60d=_0x74bf[_0x3161b8];return _0x42d60d;};'use strict';var Sequelize=require(_0xf74b('0x0'));module[_0xf74b('0x1')]={'name':{'type':Sequelize[_0xf74b('0x2')],'allowNull':![],'unique':_0xf74b('0x3')},'mode':{'type':Sequelize['ENUM'](_0xf74b('0x4'),'files','mp3nb',_0xf74b('0x5'),_0xf74b('0x6'),_0xf74b('0x7')),'allowNull':!![],'defaultValue':_0xf74b('0x8')},'directory':{'type':Sequelize[_0xf74b('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xf74b('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf74b('0x9')},'format':{'type':Sequelize[_0xf74b('0x2')],'allowNull':!![]},'stamp':{'type':_0xf74b('0xa')},'defaultEntry':{'type':Sequelize[_0xf74b('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 3f42f2d..7889dee 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 _0x795f=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','then','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','length','find','body','params','sequelize','transaction','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','save_name','converted_format','server/files/sounds/converted','%s.%s','basename','extname','format','symlinkSync','removeSound','findOne','id2','Sound','createdAt','message','pick','getSounds','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x150eaf,_0xcc6e33){var _0x41c3dd=function(_0x56624b){while(--_0x56624b){_0x150eaf['push'](_0x150eaf['shift']());}};_0x41c3dd(++_0xcc6e33);}(_0x795f,0xcf));var _0xf795=function(_0x46b20b,_0x7c3ca7){_0x46b20b=_0x46b20b-0x0;var _0x3cd8bd=_0x795f[_0x46b20b];return _0x3cd8bd;};'use strict';var emlformat=require(_0xf795('0x0'));var rimraf=require(_0xf795('0x1'));var zipdir=require(_0xf795('0x2'));var jsonpatch=require(_0xf795('0x3'));var rp=require(_0xf795('0x4'));var moment=require(_0xf795('0x5'));var BPromise=require(_0xf795('0x6'));var Mustache=require('mustache');var util=require(_0xf795('0x7'));var path=require(_0xf795('0x8'));var sox=require(_0xf795('0x9'));var csv=require(_0xf795('0xa'));var ejs=require(_0xf795('0xb'));var fs=require('fs');var fs_extra=require(_0xf795('0xc'));var _=require('lodash');var squel=require(_0xf795('0xd'));var crypto=require(_0xf795('0xe'));var jsforce=require(_0xf795('0xf'));var deskjs=require(_0xf795('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf795('0x11'));var Redis=require('ioredis');var authService=require(_0xf795('0x12'));var qs=require(_0xf795('0x13'));var as=require(_0xf795('0x14'));var hardwareService=require(_0xf795('0x15'));var logger=require(_0xf795('0x16'))(_0xf795('0x17'));var utils=require(_0xf795('0x18'));var config=require(_0xf795('0x19'));var licenseUtil=require(_0xf795('0x1a'));var db=require(_0xf795('0x1b'))['db'];function respondWithStatusCode(_0x507bd1,_0x13d9f1){_0x13d9f1=_0x13d9f1||0xcc;return function(_0x2f39a8){if(_0x2f39a8){return _0x507bd1[_0xf795('0x1c')](_0x13d9f1);}return _0x507bd1['status'](_0x13d9f1)['end']();};}function respondWithResult(_0x379be9,_0x54fa25){_0x54fa25=_0x54fa25||0xc8;return function(_0x5748dc){if(_0x5748dc){return _0x379be9[_0xf795('0x1d')](_0x54fa25)[_0xf795('0x1e')](_0x5748dc);}};}function respondWithFilteredResult(_0x4f4476,_0x37a463){return function(_0x1ed363){if(_0x1ed363){var _0x2d42f1=typeof _0x37a463[_0xf795('0x1f')]==='undefined'&&typeof _0x37a463[_0xf795('0x20')]===_0xf795('0x21');var _0x4ba99b=_0x1ed363[_0xf795('0x22')];var _0x2605a=_0x2d42f1?0x0:_0x37a463[_0xf795('0x1f')];var _0x3f7136=_0x2d42f1?_0x1ed363[_0xf795('0x22')]:_0x37a463[_0xf795('0x1f')]+_0x37a463[_0xf795('0x20')];var _0x1bef29;if(_0x3f7136>=_0x4ba99b){_0x3f7136=_0x4ba99b;_0x1bef29=0xc8;}else{_0x1bef29=0xce;}_0x4f4476['status'](_0x1bef29);return _0x4f4476['set'](_0xf795('0x23'),_0x2605a+'-'+_0x3f7136+'/'+_0x4ba99b)['json'](_0x1ed363);}return null;};}function patchUpdates(_0x4a2869){return function(_0x24aecb){try{jsonpatch['apply'](_0x24aecb,_0x4a2869,!![]);}catch(_0x435bc3){return BPromise['reject'](_0x435bc3);}return _0x24aecb['save']();};}function saveUpdates(_0x4c97bd,_0x42d07b){return function(_0x196c45){if(_0x196c45){return _0x196c45['update'](_0x4c97bd)['then'](function(_0xcad389){return _0xcad389;});}return null;};}function removeEntity(_0x3c77c7,_0x17595a){return function(_0x3ea206){if(_0x3ea206){return _0x3ea206['destroy']()[_0xf795('0x24')](function(){var _0x3b4e3c=_0x3ea206[_0xf795('0x25')]({'plain':!![]});var _0x166d67=_0xf795('0x26');return db[_0xf795('0x27')]['destroy']({'where':{'type':_0x166d67,'resourceId':_0x3b4e3c['id']}})[_0xf795('0x24')](function(){return _0x3ea206;});})['then'](function(){_0x3c77c7[_0xf795('0x1d')](0xcc)[_0xf795('0x28')]();});}};}function handleEntityNotFound(_0x20eb97,_0x3b695c){return function(_0x197ed2){if(!_0x197ed2){_0x20eb97['sendStatus'](0x194);}return _0x197ed2;};}function handleError(_0x4123f1,_0x3a1a62){_0x3a1a62=_0x3a1a62||0x1f4;return function(_0x5795bc){logger[_0xf795('0x29')](_0x5795bc[_0xf795('0x2a')]);if(_0x5795bc['name']){delete _0x5795bc[_0xf795('0x2b')];}_0x4123f1[_0xf795('0x1d')](_0x3a1a62)[_0xf795('0x2c')](_0x5795bc);};}exports[_0xf795('0x2d')]=function(_0x4277dc,_0x50839d){var _0x5094e4={},_0x42e099={},_0x2cc931={'count':0x0,'rows':[]};var _0x47a3ee=_[_0xf795('0x2e')](db[_0xf795('0x2f')][_0xf795('0x30')],function(_0x332eef){return{'name':_0x332eef[_0xf795('0x31')],'type':_0x332eef[_0xf795('0x32')]['key']};});_0x42e099[_0xf795('0x33')]=_['map'](_0x47a3ee,'name');_0x42e099[_0xf795('0x34')]=_[_0xf795('0x35')](_0x4277dc[_0xf795('0x34')]);_0x42e099['filters']=_['intersection'](_0x42e099[_0xf795('0x33')],_0x42e099[_0xf795('0x34')]);_0x5094e4['attributes']=_[_0xf795('0x36')](_0x42e099[_0xf795('0x33')],qs[_0xf795('0x37')](_0x4277dc[_0xf795('0x34')][_0xf795('0x37')]));_0x5094e4[_0xf795('0x38')]=_0x5094e4[_0xf795('0x38')]['length']?_0x5094e4['attributes']:_0x42e099[_0xf795('0x33')];if(!_0x4277dc[_0xf795('0x34')]['hasOwnProperty']('nolimit')){_0x5094e4[_0xf795('0x20')]=qs[_0xf795('0x20')](_0x4277dc['query'][_0xf795('0x20')]);_0x5094e4[_0xf795('0x1f')]=qs['offset'](_0x4277dc[_0xf795('0x34')][_0xf795('0x1f')]);}_0x5094e4['order']=qs[_0xf795('0x39')](_0x4277dc[_0xf795('0x34')][_0xf795('0x39')]);delete _0x4277dc[_0xf795('0x34')][_0xf795('0x39')];_0x5094e4[_0xf795('0x3a')]=qs[_0xf795('0x3b')](_['pick'](_0x4277dc[_0xf795('0x34')],_0x42e099[_0xf795('0x3b')]),_0x47a3ee);if(_0x4277dc[_0xf795('0x34')][_0xf795('0x3c')]){_0x5094e4[_0xf795('0x3a')]=_[_0xf795('0x3d')](_0x5094e4[_0xf795('0x3a')],{'$or':_['map'](_0x47a3ee,function(_0x3ef237){if(_0x3ef237['type']!=='VIRTUAL'){var _0x3abee9={};_0x3abee9[_0x3ef237['name']]={'$like':'%'+_0x4277dc[_0xf795('0x34')][_0xf795('0x3c')]+'%'};return _0x3abee9;}})});}_0x5094e4=_[_0xf795('0x3d')]({},_0x5094e4,_0x4277dc[_0xf795('0x3e')]);var _0x5380e2={'where':_0x5094e4[_0xf795('0x3a')]};return db[_0xf795('0x2f')][_0xf795('0x22')](_0x5380e2)[_0xf795('0x24')](function(_0x1d10ac){_0x2cc931[_0xf795('0x22')]=_0x1d10ac;if(_0x4277dc[_0xf795('0x34')][_0xf795('0x3f')]){_0x5094e4[_0xf795('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x5094e4);})[_0xf795('0x24')](function(_0x1b9959){_0x2cc931[_0xf795('0x41')]=_0x1b9959;return _0x2cc931;})['then'](respondWithFilteredResult(_0x50839d,_0x5094e4))[_0xf795('0x42')](handleError(_0x50839d,null));};exports[_0xf795('0x43')]=function(_0x301d7f,_0x3ffa12){var _0x198cbc={'raw':![],'where':{'id':_0x301d7f['params']['id']}},_0x511701={};_0x511701[_0xf795('0x33')]=_[_0xf795('0x35')](db[_0xf795('0x2f')][_0xf795('0x30')]);_0x511701[_0xf795('0x34')]=_['keys'](_0x301d7f[_0xf795('0x34')]);_0x511701[_0xf795('0x3b')]=_[_0xf795('0x36')](_0x511701[_0xf795('0x33')],_0x511701[_0xf795('0x34')]);_0x198cbc['attributes']=_['intersection'](_0x511701[_0xf795('0x33')],qs[_0xf795('0x37')](_0x301d7f[_0xf795('0x34')]['fields']));_0x198cbc[_0xf795('0x38')]=_0x198cbc['attributes'][_0xf795('0x44')]?_0x198cbc[_0xf795('0x38')]:_0x511701[_0xf795('0x33')];if(_0x301d7f[_0xf795('0x34')][_0xf795('0x3f')]){_0x198cbc['include']=[{'all':!![]}];}_0x198cbc=_[_0xf795('0x3d')]({},_0x198cbc,_0x301d7f[_0xf795('0x3e')]);return db['VoiceMusicOnHold'][_0xf795('0x45')](_0x198cbc)['then'](handleEntityNotFound(_0x3ffa12,null))[_0xf795('0x24')](respondWithResult(_0x3ffa12,null))[_0xf795('0x42')](handleError(_0x3ffa12,null));};exports['update']=function(_0x7964e,_0x1ebfcb){if(_0x7964e['body']['id']){delete _0x7964e[_0xf795('0x46')]['id'];}return db[_0xf795('0x2f')][_0xf795('0x45')]({'where':{'id':_0x7964e[_0xf795('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ebfcb,null))['then'](saveUpdates(_0x7964e[_0xf795('0x46')],null))[_0xf795('0x24')](respondWithResult(_0x1ebfcb,null))[_0xf795('0x42')](handleError(_0x1ebfcb,null));};exports['create']=function(_0x5f201a,_0x1b7797,_0x36edb5){return db[_0xf795('0x48')][_0xf795('0x49')](function(_0x94a1c7){if(_0x5f201a['body']['mode']===_0xf795('0x4a')){_0x5f201a[_0xf795('0x46')][_0xf795('0x4b')]=path[_0xf795('0x4c')](config[_0xf795('0x4d')],_0xf795('0x4e'),_0x5f201a[_0xf795('0x46')][_0xf795('0x2b')]);}return db['VoiceMusicOnHold'][_0xf795('0x4f')](_0x5f201a[_0xf795('0x46')],{'transaction':_0x94a1c7})[_0xf795('0x24')](function(_0x51d476){if(_0x5f201a['body']['mode']===_0xf795('0x4a')){fs[_0xf795('0x50')](_0x51d476[_0xf795('0x4b')],parseInt(_0xf795('0x51'),0x8));}var _0x4499fa=_0x5f201a[_0xf795('0x52')][_0xf795('0x25')]({'plain':!![]});if(!_0x4499fa)throw new Error(_0xf795('0x53'));if(_0x4499fa['role']===_0xf795('0x52')){var _0x4f72c2=_0x51d476[_0xf795('0x25')]({'plain':!![]});return db[_0xf795('0x54')][_0xf795('0x45')]({'where':{'name':_0xf795('0x26'),'userProfileId':_0x4499fa['userProfileId']},'raw':!![]})[_0xf795('0x24')](function(_0x2a1db6){if(_0x2a1db6&&_0x2a1db6['autoAssociation']===0x0){return db[_0xf795('0x27')][_0xf795('0x4f')]({'name':_0x4f72c2['name'],'resourceId':_0x4f72c2['id'],'type':_0x2a1db6['name'],'sectionId':_0x2a1db6['id']},{})[_0xf795('0x24')](function(){return _0x51d476;});}else{return _0x51d476;}})[_0xf795('0x42')](function(_0x167416){logger[_0xf795('0x29')](_0xf795('0x55'),_0x167416);});}return _0x51d476;});})['then'](respondWithResult(_0x1b7797,0xc9))[_0xf795('0x42')](handleError(_0x1b7797,null));};exports['destroy']=function(_0x47dfe3,_0x154a9e,_0x242c14){var _0x1771e1;return db[_0xf795('0x2f')][_0xf795('0x45')]({'where':{'id':_0x47dfe3[_0xf795('0x47')]['id']}})[_0xf795('0x24')](function(_0x558d59){if(_0x558d59){return db['sequelize'][_0xf795('0x49')](function(_0x44baa1){return _0x558d59[_0xf795('0x56')]({'transaction':_0x44baa1,'raw':!![]})[_0xf795('0x24')](function(_0x412f81){if(_0x412f81['directory']){fs[_0xf795('0x57')](_0x412f81[_0xf795('0x4b')])[_0xf795('0x58')](function(_0x1f10f0){fs[_0xf795('0x59')](path[_0xf795('0x4c')](_0x412f81['directory'],_0x1f10f0));});fs[_0xf795('0x5a')](_0x412f81['directory']);}return _0x412f81;});})[_0xf795('0x42')](function(_0x4d1b33){throw new db[(_0xf795('0x5b'))][(_0xf795('0x5c'))](_0x4d1b33['message']);});}})[_0xf795('0x24')](handleEntityNotFound(_0x154a9e,null))[_0xf795('0x24')](removeEntity(_0x154a9e,null))[_0xf795('0x42')](handleError(_0x154a9e,null));};exports['addSound']=function(_0x14b312,_0x3e296b,_0x5af172){return db[_0xf795('0x48')][_0xf795('0x49')](function(_0x565e95){var _0x166861;return db[_0xf795('0x2f')][_0xf795('0x45')]({'where':{'id':_0x14b312[_0xf795('0x47')]['id']}})['then'](function(_0x55f977){if(_0x55f977){_0x166861=_0x55f977;return _0x55f977[_0xf795('0x5d')](_0x14b312[_0xf795('0x46')]['id'],{'transaction':_0x565e95});}})['then'](function(_0x414b6d){if(_0x414b6d){return db['Sound']['findOne']({'where':{'id':_0x14b312[_0xf795('0x46')]['id']},'attributes':['id','name',_0xf795('0x5e'),_0xf795('0x5f'),'createdAt'],'raw':!![]});}})[_0xf795('0x24')](function(_0x1cdd72){if(_0x1cdd72){var _0x4f2a30=path[_0xf795('0x4c')](config[_0xf795('0x4d')],_0xf795('0x60'),util['format'](_0xf795('0x61'),path[_0xf795('0x62')](_0x1cdd72['save_name'],path[_0xf795('0x63')](_0x1cdd72['save_name'])),_0x1cdd72['converted_format']));var _0x48a2d6=path[_0xf795('0x4c')](config[_0xf795('0x4d')],_0xf795('0x4e'),_0x166861[_0xf795('0x2b')],util[_0xf795('0x64')](_0xf795('0x61'),_0x1cdd72[_0xf795('0x2b')],_0x1cdd72[_0xf795('0x5f')]));fs[_0xf795('0x65')](_0x4f2a30,_0x48a2d6);return _0x1cdd72;}})[_0xf795('0x42')](function(_0x43c365){throw new db[(_0xf795('0x5b'))][(_0xf795('0x5c'))](_0x43c365['message']);});})['then'](handleEntityNotFound(_0x3e296b,null))[_0xf795('0x24')](respondWithResult(_0x3e296b,0xc9))[_0xf795('0x42')](handleError(_0x3e296b,null));};exports[_0xf795('0x66')]=function(_0x2c5d13,_0x2751cd,_0x84856c){return db[_0xf795('0x48')][_0xf795('0x49')](function(_0x51a1f0){var _0x1fab53;return db[_0xf795('0x2f')][_0xf795('0x67')]({'where':{'id':_0x2c5d13['params']['id']}})[_0xf795('0x24')](handleEntityNotFound(_0x2751cd,null))[_0xf795('0x24')](function(_0x3c7a71){if(_0x3c7a71){_0x1fab53=_0x3c7a71;return _0x3c7a71[_0xf795('0x66')](_0x2c5d13[_0xf795('0x47')][_0xf795('0x68')]);}})[_0xf795('0x24')](function(_0x2d8bef){if(_0x2d8bef){return db[_0xf795('0x69')][_0xf795('0x67')]({'where':{'id':_0x2c5d13[_0xf795('0x47')][_0xf795('0x68')]},'attributes':['id',_0xf795('0x2b'),'save_name','converted_format',_0xf795('0x6a')],'raw':!![]});}})[_0xf795('0x24')](function(_0x92d19c){if(_0x92d19c){fs[_0xf795('0x59')](path[_0xf795('0x4c')](_0x1fab53[_0xf795('0x4b')],util[_0xf795('0x64')]('%s.%s',_0x92d19c['name'],_0x92d19c[_0xf795('0x5f')])));return _0x92d19c;}})['catch'](function(_0x112661){throw new db[(_0xf795('0x5b'))][(_0xf795('0x5c'))](_0x112661[_0xf795('0x6b')]);});})[_0xf795('0x24')](handleEntityNotFound(_0x2751cd,null))[_0xf795('0x24')](respondWithStatusCode(_0x2751cd,0xcc))[_0xf795('0x42')](handleError(_0x2751cd,null));};exports['getSounds']=function(_0xc80038,_0xc41a7a,_0x4dae11){var _0xb1a628={};var _0x266789={};var _0xcadd74;var _0x4739d8;return db[_0xf795('0x2f')][_0xf795('0x67')]({'where':{'id':_0xc80038[_0xf795('0x47')]['id']}})[_0xf795('0x24')](handleEntityNotFound(_0xc41a7a,null))[_0xf795('0x24')](function(_0x50a2da){if(_0x50a2da){_0xcadd74=_0x50a2da;_0x266789[_0xf795('0x33')]=_['keys'](db[_0xf795('0x69')][_0xf795('0x30')]);_0x266789['query']=_[_0xf795('0x35')](_0xc80038[_0xf795('0x34')]);_0x266789[_0xf795('0x3b')]=_['intersection'](_0x266789[_0xf795('0x33')],_0x266789[_0xf795('0x34')]);_0xb1a628[_0xf795('0x38')]=_[_0xf795('0x36')](_0x266789[_0xf795('0x33')],qs[_0xf795('0x37')](_0xc80038[_0xf795('0x34')]['fields']));_0xb1a628[_0xf795('0x38')]=_0xb1a628['attributes'][_0xf795('0x44')]?_0xb1a628[_0xf795('0x38')]:_0x266789['model'];_0xb1a628['order']=qs[_0xf795('0x39')](_0xc80038[_0xf795('0x34')][_0xf795('0x39')]);_0xb1a628[_0xf795('0x3a')]=qs[_0xf795('0x3b')](_[_0xf795('0x6c')](_0xc80038['query'],_0x266789[_0xf795('0x3b')]));if(_0xc80038[_0xf795('0x34')]['filter']){_0xb1a628[_0xf795('0x3a')]=_['merge'](_0xb1a628[_0xf795('0x3a')],{'$or':_[_0xf795('0x2e')](_0xb1a628[_0xf795('0x38')],function(_0xef4825){var _0x768786={};_0x768786[_0xef4825]={'$like':'%'+_0xc80038[_0xf795('0x34')][_0xf795('0x3c')]+'%'};return _0x768786;})});}_0xb1a628=_[_0xf795('0x3d')]({},_0xb1a628,_0xc80038[_0xf795('0x3e')]);return _0xcadd74[_0xf795('0x6d')](_0xb1a628);}})['then'](function(_0x119bbe){if(_0x119bbe){_0x4739d8=_0x119bbe[_0xf795('0x44')];if(!_0xc80038[_0xf795('0x34')][_0xf795('0x6e')](_0xf795('0x6f'))){_0xb1a628[_0xf795('0x20')]=qs['limit'](_0xc80038[_0xf795('0x34')]['limit']);_0xb1a628[_0xf795('0x1f')]=qs[_0xf795('0x1f')](_0xc80038[_0xf795('0x34')]['offset']);}return _0xcadd74[_0xf795('0x6d')](_0xb1a628);}})[_0xf795('0x24')](function(_0x478160){if(_0x478160){return _0x478160?{'count':_0x4739d8,'rows':_0x478160}:null;}})['then'](respondWithResult(_0xc41a7a,null))[_0xf795('0x42')](handleError(_0xc41a7a,null));}; \ No newline at end of file +var _0xd8a5=['Sequelize','ValidationError','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','save_name','extname','format','symlinkSync','message','removeSound','id2','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceMusicOnHold','include','rows','catch','intersection','includeAll','find','body','create','sequelize','transaction','files','directory','root','server/files/moh','mode','mkdirSync','0777','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readdirSync','unlinkSync','join','rmdirSync'];(function(_0x11722b,_0x247eb2){var _0x2065f0=function(_0x102b0f){while(--_0x102b0f){_0x11722b['push'](_0x11722b['shift']());}};_0x2065f0(++_0x247eb2);}(_0xd8a5,0xf1));var _0x5d8a=function(_0x2abf6a,_0xe2269d){_0x2abf6a=_0x2abf6a-0x0;var _0x1e4558=_0xd8a5[_0x2abf6a];return _0x1e4558;};'use strict';var emlformat=require(_0x5d8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d8a('0x1'));var jsonpatch=require(_0x5d8a('0x2'));var rp=require(_0x5d8a('0x3'));var moment=require(_0x5d8a('0x4'));var BPromise=require(_0x5d8a('0x5'));var Mustache=require(_0x5d8a('0x6'));var util=require(_0x5d8a('0x7'));var path=require(_0x5d8a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5d8a('0x9'));var fs=require('fs');var fs_extra=require(_0x5d8a('0xa'));var _=require(_0x5d8a('0xb'));var squel=require(_0x5d8a('0xc'));var crypto=require(_0x5d8a('0xd'));var jsforce=require(_0x5d8a('0xe'));var deskjs=require(_0x5d8a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d8a('0x10'));var Papa=require(_0x5d8a('0x11'));var Redis=require(_0x5d8a('0x12'));var authService=require(_0x5d8a('0x13'));var qs=require(_0x5d8a('0x14'));var as=require(_0x5d8a('0x15'));var hardwareService=require(_0x5d8a('0x16'));var logger=require('../../config/logger')(_0x5d8a('0x17'));var utils=require(_0x5d8a('0x18'));var config=require(_0x5d8a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b8553,_0x5db7cd){_0x5db7cd=_0x5db7cd||0xcc;return function(_0x9cdb25){if(_0x9cdb25){return _0x3b8553[_0x5d8a('0x1a')](_0x5db7cd);}return _0x3b8553[_0x5d8a('0x1b')](_0x5db7cd)[_0x5d8a('0x1c')]();};}function respondWithResult(_0x3c999d,_0xd2f428){_0xd2f428=_0xd2f428||0xc8;return function(_0x57a5a0){if(_0x57a5a0){return _0x3c999d[_0x5d8a('0x1b')](_0xd2f428)[_0x5d8a('0x1d')](_0x57a5a0);}};}function respondWithFilteredResult(_0x57dfd2,_0x246214){return function(_0x454e50){if(_0x454e50){var _0x2b53ee=typeof _0x246214['offset']===_0x5d8a('0x1e')&&typeof _0x246214[_0x5d8a('0x1f')]===_0x5d8a('0x1e');var _0x34e6a5=_0x454e50[_0x5d8a('0x20')];var _0x5b8d9c=_0x2b53ee?0x0:_0x246214[_0x5d8a('0x21')];var _0x29e95b=_0x2b53ee?_0x454e50['count']:_0x246214[_0x5d8a('0x21')]+_0x246214[_0x5d8a('0x1f')];var _0x5428d6;if(_0x29e95b>=_0x34e6a5){_0x29e95b=_0x34e6a5;_0x5428d6=0xc8;}else{_0x5428d6=0xce;}_0x57dfd2[_0x5d8a('0x1b')](_0x5428d6);return _0x57dfd2['set'](_0x5d8a('0x22'),_0x5b8d9c+'-'+_0x29e95b+'/'+_0x34e6a5)[_0x5d8a('0x1d')](_0x454e50);}return null;};}function patchUpdates(_0x74508b){return function(_0x238c8f){try{jsonpatch[_0x5d8a('0x23')](_0x238c8f,_0x74508b,!![]);}catch(_0x77815b){return BPromise[_0x5d8a('0x24')](_0x77815b);}return _0x238c8f[_0x5d8a('0x25')]();};}function saveUpdates(_0x455cca,_0x583414){return function(_0x3d365a){if(_0x3d365a){return _0x3d365a[_0x5d8a('0x26')](_0x455cca)[_0x5d8a('0x27')](function(_0x48d9d0){return _0x48d9d0;});}return null;};}function removeEntity(_0x49f662,_0x559392){return function(_0x198637){if(_0x198637){return _0x198637[_0x5d8a('0x28')]()[_0x5d8a('0x27')](function(){var _0x140a7f=_0x198637[_0x5d8a('0x29')]({'plain':!![]});var _0x54f7c5='MusicOnHolds';return db['UserProfileResource'][_0x5d8a('0x28')]({'where':{'type':_0x54f7c5,'resourceId':_0x140a7f['id']}})[_0x5d8a('0x27')](function(){return _0x198637;});})[_0x5d8a('0x27')](function(){_0x49f662['status'](0xcc)[_0x5d8a('0x1c')]();});}};}function handleEntityNotFound(_0x2e2278,_0x5b35a6){return function(_0x487c61){if(!_0x487c61){_0x2e2278['sendStatus'](0x194);}return _0x487c61;};}function handleError(_0x44a2d4,_0x428291){_0x428291=_0x428291||0x1f4;return function(_0x380808){logger['error'](_0x380808['stack']);if(_0x380808[_0x5d8a('0x2a')]){delete _0x380808[_0x5d8a('0x2a')];}_0x44a2d4[_0x5d8a('0x1b')](_0x428291)['send'](_0x380808);};}exports[_0x5d8a('0x2b')]=function(_0x1ebb4a,_0x3c865d){var _0x2b256a={},_0x153803={},_0x114cce={'count':0x0,'rows':[]};var _0x174638=_[_0x5d8a('0x2c')](db['VoiceMusicOnHold'][_0x5d8a('0x2d')],function(_0x18b914){return{'name':_0x18b914[_0x5d8a('0x2e')],'type':_0x18b914[_0x5d8a('0x2f')][_0x5d8a('0x30')]};});_0x153803[_0x5d8a('0x31')]=_[_0x5d8a('0x2c')](_0x174638,_0x5d8a('0x2a'));_0x153803[_0x5d8a('0x32')]=_[_0x5d8a('0x33')](_0x1ebb4a['query']);_0x153803[_0x5d8a('0x34')]=_['intersection'](_0x153803[_0x5d8a('0x31')],_0x153803[_0x5d8a('0x32')]);_0x2b256a[_0x5d8a('0x35')]=_['intersection'](_0x153803[_0x5d8a('0x31')],qs[_0x5d8a('0x36')](_0x1ebb4a[_0x5d8a('0x32')][_0x5d8a('0x36')]));_0x2b256a[_0x5d8a('0x35')]=_0x2b256a['attributes'][_0x5d8a('0x37')]?_0x2b256a[_0x5d8a('0x35')]:_0x153803['model'];if(!_0x1ebb4a['query'][_0x5d8a('0x38')](_0x5d8a('0x39'))){_0x2b256a[_0x5d8a('0x1f')]=qs[_0x5d8a('0x1f')](_0x1ebb4a[_0x5d8a('0x32')][_0x5d8a('0x1f')]);_0x2b256a['offset']=qs[_0x5d8a('0x21')](_0x1ebb4a[_0x5d8a('0x32')][_0x5d8a('0x21')]);}_0x2b256a[_0x5d8a('0x3a')]=qs[_0x5d8a('0x3b')](_0x1ebb4a[_0x5d8a('0x32')][_0x5d8a('0x3b')]);delete _0x1ebb4a[_0x5d8a('0x32')][_0x5d8a('0x3b')];_0x2b256a[_0x5d8a('0x3c')]=qs[_0x5d8a('0x34')](_[_0x5d8a('0x3d')](_0x1ebb4a[_0x5d8a('0x32')],_0x153803['filters']),_0x174638);if(_0x1ebb4a[_0x5d8a('0x32')][_0x5d8a('0x3e')]){_0x2b256a[_0x5d8a('0x3c')]=_[_0x5d8a('0x3f')](_0x2b256a[_0x5d8a('0x3c')],{'$or':_[_0x5d8a('0x2c')](_0x174638,function(_0x52cd3e){if(_0x52cd3e['type']!=='VIRTUAL'){var _0x189fa0={};_0x189fa0[_0x52cd3e[_0x5d8a('0x2a')]]={'$like':'%'+_0x1ebb4a[_0x5d8a('0x32')]['filter']+'%'};return _0x189fa0;}})});}_0x2b256a=_['merge']({},_0x2b256a,_0x1ebb4a[_0x5d8a('0x40')]);var _0xc70a6f={'where':_0x2b256a['where']};return db[_0x5d8a('0x41')]['count'](_0xc70a6f)[_0x5d8a('0x27')](function(_0x31d5da){_0x114cce['count']=_0x31d5da;if(_0x1ebb4a[_0x5d8a('0x32')]['includeAll']){_0x2b256a[_0x5d8a('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x2b256a);})[_0x5d8a('0x27')](function(_0x5ec48d){_0x114cce[_0x5d8a('0x43')]=_0x5ec48d;return _0x114cce;})[_0x5d8a('0x27')](respondWithFilteredResult(_0x3c865d,_0x2b256a))[_0x5d8a('0x44')](handleError(_0x3c865d,null));};exports['show']=function(_0x4fd24d,_0x2336b4){var _0x4a5d7d={'raw':![],'where':{'id':_0x4fd24d['params']['id']}},_0x491143={};_0x491143['model']=_[_0x5d8a('0x33')](db['VoiceMusicOnHold']['rawAttributes']);_0x491143[_0x5d8a('0x32')]=_[_0x5d8a('0x33')](_0x4fd24d[_0x5d8a('0x32')]);_0x491143[_0x5d8a('0x34')]=_['intersection'](_0x491143[_0x5d8a('0x31')],_0x491143[_0x5d8a('0x32')]);_0x4a5d7d['attributes']=_[_0x5d8a('0x45')](_0x491143[_0x5d8a('0x31')],qs[_0x5d8a('0x36')](_0x4fd24d[_0x5d8a('0x32')][_0x5d8a('0x36')]));_0x4a5d7d[_0x5d8a('0x35')]=_0x4a5d7d[_0x5d8a('0x35')][_0x5d8a('0x37')]?_0x4a5d7d['attributes']:_0x491143[_0x5d8a('0x31')];if(_0x4fd24d[_0x5d8a('0x32')][_0x5d8a('0x46')]){_0x4a5d7d[_0x5d8a('0x42')]=[{'all':!![]}];}_0x4a5d7d=_['merge']({},_0x4a5d7d,_0x4fd24d['options']);return db[_0x5d8a('0x41')][_0x5d8a('0x47')](_0x4a5d7d)[_0x5d8a('0x27')](handleEntityNotFound(_0x2336b4,null))[_0x5d8a('0x27')](respondWithResult(_0x2336b4,null))[_0x5d8a('0x44')](handleError(_0x2336b4,null));};exports[_0x5d8a('0x26')]=function(_0x3f67f2,_0x3101d6){if(_0x3f67f2['body']['id']){delete _0x3f67f2[_0x5d8a('0x48')]['id'];}return db[_0x5d8a('0x41')][_0x5d8a('0x47')]({'where':{'id':_0x3f67f2['params']['id']}})['then'](handleEntityNotFound(_0x3101d6,null))[_0x5d8a('0x27')](saveUpdates(_0x3f67f2['body'],null))[_0x5d8a('0x27')](respondWithResult(_0x3101d6,null))['catch'](handleError(_0x3101d6,null));};exports[_0x5d8a('0x49')]=function(_0x49b5f3,_0x57b55d,_0x103503){return db[_0x5d8a('0x4a')][_0x5d8a('0x4b')](function(_0x3c2e88){if(_0x49b5f3[_0x5d8a('0x48')]['mode']===_0x5d8a('0x4c')){_0x49b5f3[_0x5d8a('0x48')][_0x5d8a('0x4d')]=path['join'](config[_0x5d8a('0x4e')],_0x5d8a('0x4f'),_0x49b5f3[_0x5d8a('0x48')]['name']);}return db[_0x5d8a('0x41')][_0x5d8a('0x49')](_0x49b5f3[_0x5d8a('0x48')],{'transaction':_0x3c2e88})[_0x5d8a('0x27')](function(_0x146abc){if(_0x49b5f3[_0x5d8a('0x48')][_0x5d8a('0x50')]===_0x5d8a('0x4c')){fs[_0x5d8a('0x51')](_0x146abc['directory'],parseInt(_0x5d8a('0x52'),0x8));}var _0x151909=_0x49b5f3[_0x5d8a('0x53')]['get']({'plain':!![]});if(!_0x151909)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x151909['role']===_0x5d8a('0x53')){var _0x474417=_0x146abc[_0x5d8a('0x29')]({'plain':!![]});return db[_0x5d8a('0x54')][_0x5d8a('0x47')]({'where':{'name':_0x5d8a('0x55'),'userProfileId':_0x151909[_0x5d8a('0x56')]},'raw':!![]})[_0x5d8a('0x27')](function(_0x32345e){if(_0x32345e&&_0x32345e[_0x5d8a('0x57')]===0x0){return db['UserProfileResource'][_0x5d8a('0x49')]({'name':_0x474417[_0x5d8a('0x2a')],'resourceId':_0x474417['id'],'type':_0x32345e['name'],'sectionId':_0x32345e['id']},{})['then'](function(){return _0x146abc;});}else{return _0x146abc;}})['catch'](function(_0x13ffeb){logger[_0x5d8a('0x58')](_0x5d8a('0x59'),_0x13ffeb);});}return _0x146abc;});})['then'](respondWithResult(_0x57b55d,0xc9))[_0x5d8a('0x44')](handleError(_0x57b55d,null));};exports[_0x5d8a('0x28')]=function(_0x3a9d06,_0x4552bd,_0x631ecf){var _0x48d6f2;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x3a9d06[_0x5d8a('0x5a')]['id']}})['then'](function(_0x4c8919){if(_0x4c8919){return db[_0x5d8a('0x4a')]['transaction'](function(_0x2399f9){return _0x4c8919[_0x5d8a('0x28')]({'transaction':_0x2399f9,'raw':!![]})[_0x5d8a('0x27')](function(_0x2edad3){if(_0x2edad3[_0x5d8a('0x4d')]){fs[_0x5d8a('0x5b')](_0x2edad3[_0x5d8a('0x4d')])['forEach'](function(_0x41e5bb){fs[_0x5d8a('0x5c')](path[_0x5d8a('0x5d')](_0x2edad3['directory'],_0x41e5bb));});fs[_0x5d8a('0x5e')](_0x2edad3['directory']);}return _0x2edad3;});})[_0x5d8a('0x44')](function(_0x489419){throw new db[(_0x5d8a('0x5f'))][(_0x5d8a('0x60'))](_0x489419['message']);});}})[_0x5d8a('0x27')](handleEntityNotFound(_0x4552bd,null))['then'](removeEntity(_0x4552bd,null))['catch'](handleError(_0x4552bd,null));};exports[_0x5d8a('0x61')]=function(_0x5c2248,_0x198eec,_0xc577cb){return db[_0x5d8a('0x4a')]['transaction'](function(_0x359e59){var _0x316489;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5c2248[_0x5d8a('0x5a')]['id']}})[_0x5d8a('0x27')](function(_0x4dc434){if(_0x4dc434){_0x316489=_0x4dc434;return _0x4dc434[_0x5d8a('0x61')](_0x5c2248[_0x5d8a('0x48')]['id'],{'transaction':_0x359e59});}})[_0x5d8a('0x27')](function(_0x107b19){if(_0x107b19){return db[_0x5d8a('0x62')][_0x5d8a('0x63')]({'where':{'id':_0x5c2248[_0x5d8a('0x48')]['id']},'attributes':['id',_0x5d8a('0x2a'),'save_name',_0x5d8a('0x64'),_0x5d8a('0x65')],'raw':!![]});}})[_0x5d8a('0x27')](function(_0xa36315){if(_0xa36315){var _0x314f2d=path[_0x5d8a('0x5d')](config['root'],_0x5d8a('0x66'),util['format'](_0x5d8a('0x67'),path[_0x5d8a('0x68')](_0xa36315[_0x5d8a('0x69')],path[_0x5d8a('0x6a')](_0xa36315[_0x5d8a('0x69')])),_0xa36315[_0x5d8a('0x64')]));var _0x55d3ae=path[_0x5d8a('0x5d')](config[_0x5d8a('0x4e')],'server/files/moh',_0x316489['name'],util[_0x5d8a('0x6b')](_0x5d8a('0x67'),_0xa36315[_0x5d8a('0x2a')],_0xa36315[_0x5d8a('0x64')]));fs[_0x5d8a('0x6c')](_0x314f2d,_0x55d3ae);return _0xa36315;}})[_0x5d8a('0x44')](function(_0x2f5937){throw new db[(_0x5d8a('0x5f'))][(_0x5d8a('0x60'))](_0x2f5937[_0x5d8a('0x6d')]);});})['then'](handleEntityNotFound(_0x198eec,null))[_0x5d8a('0x27')](respondWithResult(_0x198eec,0xc9))[_0x5d8a('0x44')](handleError(_0x198eec,null));};exports[_0x5d8a('0x6e')]=function(_0x1b3005,_0x4bc2f9,_0x1101fc){return db['sequelize'][_0x5d8a('0x4b')](function(_0x1c1301){var _0x5d3ca5;return db['VoiceMusicOnHold'][_0x5d8a('0x63')]({'where':{'id':_0x1b3005[_0x5d8a('0x5a')]['id']}})[_0x5d8a('0x27')](handleEntityNotFound(_0x4bc2f9,null))['then'](function(_0x1dddc9){if(_0x1dddc9){_0x5d3ca5=_0x1dddc9;return _0x1dddc9[_0x5d8a('0x6e')](_0x1b3005['params'][_0x5d8a('0x6f')]);}})[_0x5d8a('0x27')](function(_0xcf504a){if(_0xcf504a){return db[_0x5d8a('0x62')][_0x5d8a('0x63')]({'where':{'id':_0x1b3005[_0x5d8a('0x5a')][_0x5d8a('0x6f')]},'attributes':['id',_0x5d8a('0x2a'),_0x5d8a('0x69'),'converted_format',_0x5d8a('0x65')],'raw':!![]});}})['then'](function(_0x4187b5){if(_0x4187b5){fs['unlinkSync'](path['join'](_0x5d3ca5[_0x5d8a('0x4d')],util[_0x5d8a('0x6b')](_0x5d8a('0x67'),_0x4187b5[_0x5d8a('0x2a')],_0x4187b5[_0x5d8a('0x64')])));return _0x4187b5;}})[_0x5d8a('0x44')](function(_0x5d0e7f){throw new db[(_0x5d8a('0x5f'))][(_0x5d8a('0x60'))](_0x5d0e7f[_0x5d8a('0x6d')]);});})['then'](handleEntityNotFound(_0x4bc2f9,null))[_0x5d8a('0x27')](respondWithStatusCode(_0x4bc2f9,0xcc))[_0x5d8a('0x44')](handleError(_0x4bc2f9,null));};exports['getSounds']=function(_0x3ab7fd,_0xc0edab,_0x5f14cd){var _0x2b9211={};var _0x3f04a8={};var _0x40ab14;var _0x4a84b0;return db['VoiceMusicOnHold'][_0x5d8a('0x63')]({'where':{'id':_0x3ab7fd[_0x5d8a('0x5a')]['id']}})[_0x5d8a('0x27')](handleEntityNotFound(_0xc0edab,null))[_0x5d8a('0x27')](function(_0x4b992e){if(_0x4b992e){_0x40ab14=_0x4b992e;_0x3f04a8['model']=_['keys'](db[_0x5d8a('0x62')][_0x5d8a('0x2d')]);_0x3f04a8[_0x5d8a('0x32')]=_[_0x5d8a('0x33')](_0x3ab7fd[_0x5d8a('0x32')]);_0x3f04a8[_0x5d8a('0x34')]=_[_0x5d8a('0x45')](_0x3f04a8[_0x5d8a('0x31')],_0x3f04a8[_0x5d8a('0x32')]);_0x2b9211[_0x5d8a('0x35')]=_[_0x5d8a('0x45')](_0x3f04a8[_0x5d8a('0x31')],qs[_0x5d8a('0x36')](_0x3ab7fd[_0x5d8a('0x32')][_0x5d8a('0x36')]));_0x2b9211[_0x5d8a('0x35')]=_0x2b9211[_0x5d8a('0x35')][_0x5d8a('0x37')]?_0x2b9211[_0x5d8a('0x35')]:_0x3f04a8['model'];_0x2b9211[_0x5d8a('0x3a')]=qs[_0x5d8a('0x3b')](_0x3ab7fd[_0x5d8a('0x32')]['sort']);_0x2b9211['where']=qs[_0x5d8a('0x34')](_['pick'](_0x3ab7fd[_0x5d8a('0x32')],_0x3f04a8[_0x5d8a('0x34')]));if(_0x3ab7fd['query'][_0x5d8a('0x3e')]){_0x2b9211[_0x5d8a('0x3c')]=_[_0x5d8a('0x3f')](_0x2b9211['where'],{'$or':_[_0x5d8a('0x2c')](_0x2b9211[_0x5d8a('0x35')],function(_0x57cd0f){var _0x400534={};_0x400534[_0x57cd0f]={'$like':'%'+_0x3ab7fd[_0x5d8a('0x32')][_0x5d8a('0x3e')]+'%'};return _0x400534;})});}_0x2b9211=_[_0x5d8a('0x3f')]({},_0x2b9211,_0x3ab7fd['options']);return _0x40ab14['getSounds'](_0x2b9211);}})['then'](function(_0x348c03){if(_0x348c03){_0x4a84b0=_0x348c03['length'];if(!_0x3ab7fd[_0x5d8a('0x32')][_0x5d8a('0x38')]('nolimit')){_0x2b9211[_0x5d8a('0x1f')]=qs[_0x5d8a('0x1f')](_0x3ab7fd[_0x5d8a('0x32')][_0x5d8a('0x1f')]);_0x2b9211[_0x5d8a('0x21')]=qs[_0x5d8a('0x21')](_0x3ab7fd[_0x5d8a('0x32')][_0x5d8a('0x21')]);}return _0x40ab14['getSounds'](_0x2b9211);}})[_0x5d8a('0x27')](function(_0x2d5c39){if(_0x2d5c39){return _0x2d5c39?{'count':_0x4a84b0,'rows':_0x2d5c39}:null;}})[_0x5d8a('0x27')](respondWithResult(_0xc0edab,null))[_0x5d8a('0x44')](handleError(_0xc0edab,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2be2adc..783c031 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 _0x4024=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x4024,0x1b0));var _0x4402=function(_0x41b683,_0x10e5ab){_0x41b683=_0x41b683-0x0;var _0x3e8d91=_0x4024[_0x41b683];return _0x3e8d91;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require('../../config/logger')(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var BPromise=require(_0x4402('0x4'));var rp=require(_0x4402('0x5'));var fs=require('fs');var path=require(_0x4402('0x6'));var rimraf=require(_0x4402('0x7'));var config=require('../../config/environment');var attributes=require(_0x4402('0x8'));module[_0x4402('0x9')]=function(_0x5d1cb2,_0x1e05e4){return _0x5d1cb2[_0x4402('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0x4402('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92a3=['VoiceMusicOnHold','lodash','../../config/logger','api','moment','bluebird','../../config/environment','exports'];(function(_0x3a3e30,_0x5996b5){var _0x19f849=function(_0xc6e736){while(--_0xc6e736){_0x3a3e30['push'](_0x3a3e30['shift']());}};_0x19f849(++_0x5996b5);}(_0x92a3,0x71));var _0x392a=function(_0x24dc71,_0x17b0cd){_0x24dc71=_0x24dc71-0x0;var _0x4ad0bf=_0x92a3[_0x24dc71];return _0x4ad0bf;};'use strict';var _=require(_0x392a('0x0'));var util=require('util');var logger=require(_0x392a('0x1'))(_0x392a('0x2'));var moment=require(_0x392a('0x3'));var BPromise=require(_0x392a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x392a('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x392a('0x6')]=function(_0x3e0915,_0x29cda9){return _0x3e0915['define'](_0x392a('0x7'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 30d068a..b6b041a 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(_0x38e37d,_0x85eaab){var _0x245c8a=function(_0x386469){while(--_0x386469){_0x38e37d['push'](_0x38e37d['shift']());}};_0x245c8a(++_0x85eaab);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0xcb91[_0x2ed7d1];return _0x38ae3c;};'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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x1d2512,_0x59d6da){var _0x93a1da=function(_0x465989){while(--_0x465989){_0x1d2512['push'](_0x1d2512['shift']());}};_0x93a1da(++_0x59d6da);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e9ecd76..52482cd 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 _0x0ef0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/users','getTeams','post','create','addAgents','/:id/teams','addTeams','update','delete','destroy','removeAgents','removeTeams','exports','multer','util'];(function(_0xec1138,_0x55d122){var _0xf09bdb=function(_0x4bf9ce){while(--_0x4bf9ce){_0xec1138['push'](_0xec1138['shift']());}};_0xf09bdb(++_0x55d122);}(_0x0ef0,0x80));var _0x00ef=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0x0ef0[_0x5c0dcb];return _0x183a0e;};'use strict';var multer=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var path=require('path');var timeout=require(_0x00ef('0x2'));var express=require(_0x00ef('0x3'));var router=express[_0x00ef('0x4')]();var fs_extra=require(_0x00ef('0x5'));var auth=require(_0x00ef('0x6'));var interaction=require(_0x00ef('0x7'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x00ef('0x8')]('/',auth[_0x00ef('0x9')](),controller[_0x00ef('0xa')]);router[_0x00ef('0x8')]('/describe',auth[_0x00ef('0x9')](),controller[_0x00ef('0xb')]);router[_0x00ef('0x8')](_0x00ef('0xc'),auth[_0x00ef('0x9')](),controller['show']);router[_0x00ef('0x8')](_0x00ef('0xd'),auth[_0x00ef('0x9')](),controller['getAgents']);router[_0x00ef('0x8')]('/:id/teams',auth[_0x00ef('0x9')](),controller[_0x00ef('0xe')]);router[_0x00ef('0xf')]('/',auth[_0x00ef('0x9')](),controller[_0x00ef('0x10')]);router['post'](_0x00ef('0xd'),auth['isAuthenticated'](),controller[_0x00ef('0x11')]);router[_0x00ef('0xf')](_0x00ef('0x12'),auth['isAuthenticated'](),controller[_0x00ef('0x13')]);router['put']('/:id',auth[_0x00ef('0x9')](),controller[_0x00ef('0x14')]);router[_0x00ef('0x15')](_0x00ef('0xc'),auth['isAuthenticated'](),controller[_0x00ef('0x16')]);router['delete'](_0x00ef('0xd'),auth[_0x00ef('0x9')](),controller[_0x00ef('0x17')]);router['delete'](_0x00ef('0x12'),auth[_0x00ef('0x9')](),controller[_0x00ef('0x18')]);module[_0x00ef('0x19')]=router; \ No newline at end of file +var _0x85d0=['/describe','describe','/:id','isAuthenticated','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x85d0,0x164));var _0x085d=function(_0x480d2f,_0x5e6bd3){_0x480d2f=_0x480d2f-0x0;var _0x21ffc3=_0x85d0[_0x480d2f];return _0x21ffc3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x085d('0x0'));var router=express[_0x085d('0x1')]();var fs_extra=require(_0x085d('0x2'));var auth=require(_0x085d('0x3'));var interaction=require(_0x085d('0x4'));var config=require(_0x085d('0x5'));var controller=require('./voicePrefix.controller');router[_0x085d('0x6')]('/',auth['isAuthenticated'](),controller[_0x085d('0x7')]);router[_0x085d('0x6')](_0x085d('0x8'),auth['isAuthenticated'](),controller[_0x085d('0x9')]);router[_0x085d('0x6')](_0x085d('0xa'),auth[_0x085d('0xb')](),controller[_0x085d('0xc')]);router[_0x085d('0x6')](_0x085d('0xd'),auth[_0x085d('0xb')](),controller[_0x085d('0xe')]);router['get'](_0x085d('0xf'),auth[_0x085d('0xb')](),controller[_0x085d('0x10')]);router[_0x085d('0x11')]('/',auth['isAuthenticated'](),controller[_0x085d('0x12')]);router[_0x085d('0x11')]('/:id/users',auth[_0x085d('0xb')](),controller[_0x085d('0x13')]);router[_0x085d('0x11')](_0x085d('0xf'),auth['isAuthenticated'](),controller[_0x085d('0x14')]);router[_0x085d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x085d('0x16')]);router[_0x085d('0x17')](_0x085d('0xa'),auth[_0x085d('0xb')](),controller[_0x085d('0x18')]);router['delete'](_0x085d('0xd'),auth[_0x085d('0xb')](),controller[_0x085d('0x19')]);router[_0x085d('0x17')](_0x085d('0xf'),auth[_0x085d('0xb')](),controller[_0x085d('0x1a')]);module[_0x085d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 114584a..09af433 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 _0xf709=['STRING','INTEGER','sequelize','exports','VIRTUAL','system-','getDataValue','name'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xf709,0x1c2));var _0x9f70=function(_0x100668,_0x16bfe2){_0x100668=_0x100668-0x0;var _0x3a3c61=_0xf709[_0x100668];return _0x3a3c61;};'use strict';var Sequelize=require(_0x9f70('0x0'));module[_0x9f70('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x9f70('0x2')],'get':function(_0x3717c7){return _0x9f70('0x3')+this[_0x9f70('0x4')](_0x9f70('0x5'))+'-';}},'description':{'type':Sequelize[_0x9f70('0x6')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x9f70('0x7')]}}; \ No newline at end of file +var _0x07dc=['VIRTUAL','name','INTEGER','exports','STRING'];(function(_0x29cd9e,_0x5146e1){var _0x53a4d3=function(_0x584b3e){while(--_0x584b3e){_0x29cd9e['push'](_0x29cd9e['shift']());}};_0x53a4d3(++_0x5146e1);}(_0x07dc,0xf8));var _0xc07d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x07dc[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xc07d('0x0')]={'name':{'type':Sequelize[_0xc07d('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xc07d('0x2')],'get':function(_0x3c1944){return'system-'+this['getDataValue'](_0xc07d('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xc07d('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ef81bbe..4fd8247 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 _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x1c9a,0x98));var _0xa1c9=function(_0x31fb59,_0x11e371){_0x31fb59=_0x31fb59-0x0;var _0x21aea6=_0x1c9a[_0x31fb59];return _0x21aea6;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,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(_0x518c2e,_0x4afdb2){var _0x40e45f=function(_0x357da4){while(--_0x357da4){_0x518c2e['push'](_0x518c2e['shift']());}};_0x40e45f(++_0x4afdb2);}(_0x5204,0xdf));var _0x4520=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x5204[_0x352d28];return _0x387d7e;};'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 0b96f64..f5e9402 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 _0x30b3=['remove','emit','hasOwnProperty','hook','events','VoicePrefix','setMaxListeners','save','update'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x30b3,0x1e1));var _0x330b=function(_0xc2f54d,_0x242f6f){_0xc2f54d=_0xc2f54d-0x0;var _0x85900c=_0x30b3[_0xc2f54d];return _0x85900c;};'use strict';var EventEmitter=require(_0x330b('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x330b('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x330b('0x2')](0x0);var events={'afterCreate':_0x330b('0x3'),'afterUpdate':_0x330b('0x4'),'afterDestroy':_0x330b('0x5')};function emitEvent(_0x3bfafc){return function(_0xb95d38,_0x2d684c,_0x2a5d71){VoicePrefixEvents['emit'](_0x3bfafc+':'+_0xb95d38['id'],_0xb95d38);VoicePrefixEvents[_0x330b('0x6')](_0x3bfafc,_0xb95d38);_0x2a5d71(null);};}for(var e in events){if(events[_0x330b('0x7')](e)){var event=events[e];VoicePrefix[_0x330b('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x44e8=['emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix','save','update'];(function(_0xc1adf1,_0x1ec932){var _0x12a7c9=function(_0x33446f){while(--_0x33446f){_0xc1adf1['push'](_0xc1adf1['shift']());}};_0x12a7c9(++_0x1ec932);}(_0x44e8,0x15a));var _0x844e=function(_0x55a912,_0xc705c1){_0x55a912=_0x55a912-0x0;var _0x30f199=_0x44e8[_0x55a912];return _0x30f199;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x844e('0x0'))['db'][_0x844e('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x844e('0x2'),'afterUpdate':_0x844e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3fdbdd){return function(_0x546e4f,_0x395231,_0x12ded0){VoicePrefixEvents[_0x844e('0x4')](_0x3fdbdd+':'+_0x546e4f['id'],_0x546e4f);VoicePrefixEvents[_0x844e('0x4')](_0x3fdbdd,_0x546e4f);_0x12ded0(null);};}for(var e in events){if(events[_0x844e('0x5')](e)){var event=events[e];VoicePrefix[_0x844e('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 3cf17ee..e7609e0 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 _0x91ea=['voice_prefixes','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x2d2888,_0x49f4c0){var _0x14d427=function(_0x198ab6){while(--_0x198ab6){_0x2d2888['push'](_0x2d2888['shift']());}};_0x14d427(++_0x49f4c0);}(_0x91ea,0x115));var _0xa91e=function(_0x2d60d5,_0x2e3fe5){_0x2d60d5=_0x2d60d5-0x0;var _0x4520f9=_0x91ea[_0x2d60d5];return _0x4520f9;};'use strict';var _=require('lodash');var util=require(_0xa91e('0x0'));var logger=require('../../config/logger')(_0xa91e('0x1'));var moment=require(_0xa91e('0x2'));var BPromise=require(_0xa91e('0x3'));var rp=require(_0xa91e('0x4'));var fs=require('fs');var path=require(_0xa91e('0x5'));var rimraf=require(_0xa91e('0x6'));var config=require(_0xa91e('0x7'));var attributes=require(_0xa91e('0x8'));module[_0xa91e('0x9')]=function(_0x203d6c,_0x43e8d2){return _0x203d6c[_0xa91e('0xa')]('VoicePrefix',attributes,{'tableName':_0xa91e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb93c=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x5ef7c1,_0x52196d){var _0x57ff09=function(_0x14a498){while(--_0x14a498){_0x5ef7c1['push'](_0x5ef7c1['shift']());}};_0x57ff09(++_0x52196d);}(_0xb93c,0x16a));var _0xcb93=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0xb93c[_0x3c6b7d];return _0x1d3ed2;};'use strict';var _=require(_0xcb93('0x0'));var util=require(_0xcb93('0x1'));var logger=require(_0xcb93('0x2'))(_0xcb93('0x3'));var moment=require(_0xcb93('0x4'));var BPromise=require(_0xcb93('0x5'));var rp=require(_0xcb93('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0xcb93('0x7')]=function(_0x4a022f,_0x199b39){return _0x4a022f[_0xcb93('0x8')](_0xcb93('0x9'),attributes,{'tableName':_0xcb93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 92160d5..bf82dba 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 _0xdcd5=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcd5,0x110));var _0x5dcd=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0xdcd5[_0x1d0499];return _0x153fb3;};'use strict';var _=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var moment=require(_0x5dcd('0x2'));var BPromise=require(_0x5dcd('0x3'));var rs=require(_0x5dcd('0x4'));var fs=require('fs');var Redis=require(_0x5dcd('0x5'));var db=require(_0x5dcd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dcd('0x7'))(_0x5dcd('0x8'));var config=require(_0x5dcd('0x9'));var jayson=require(_0x5dcd('0xa'));var client=jayson[_0x5dcd('0xb')][_0x5dcd('0xc')]({'port':0x232a});config[_0x5dcd('0xd')]=_[_0x5dcd('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5dcd('0xf'))(new Redis(config[_0x5dcd('0xd')]));require(_0x5dcd('0x10'))['register'](socket);function respondWithRpcPromise(_0x1e1161,_0x29c3e1,_0xf0e115){return new BPromise(function(_0x1d46bc,_0x22680f){return client[_0x5dcd('0x11')](_0x1e1161,_0xf0e115)[_0x5dcd('0x12')](function(_0x57c64d){logger['info'](_0x5dcd('0x13'),_0x29c3e1,_0x5dcd('0x14'));logger['debug'](_0x5dcd('0x15'),_0x29c3e1,_0x5dcd('0x14'),JSON[_0x5dcd('0x16')](_0x57c64d));if(_0x57c64d[_0x5dcd('0x17')]){if(_0x57c64d[_0x5dcd('0x17')][_0x5dcd('0x18')]===0x1f4){logger[_0x5dcd('0x17')](_0x5dcd('0x13'),_0x29c3e1,_0x57c64d['error'][_0x5dcd('0x19')]);return _0x22680f(_0x57c64d[_0x5dcd('0x17')]['message']);}logger[_0x5dcd('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x29c3e1,_0x57c64d[_0x5dcd('0x17')][_0x5dcd('0x19')]);return _0x1d46bc(_0x57c64d[_0x5dcd('0x17')]['message']);}else{logger[_0x5dcd('0x1a')](_0x5dcd('0x13'),_0x29c3e1,_0x5dcd('0x14'));_0x1d46bc(_0x57c64d['result'][_0x5dcd('0x19')]);}})[_0x5dcd('0x1b')](function(_0x564b){logger['error'](_0x5dcd('0x13'),_0x29c3e1,_0x564b);_0x22680f(_0x564b);});});} \ No newline at end of file +var _0x6931=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x6931,0x1a9));var _0x1693=function(_0x4f7c2f,_0x4732f2){_0x4f7c2f=_0x4f7c2f-0x0;var _0xdfbd19=_0x6931[_0x4f7c2f];return _0xdfbd19;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var BPromise=require(_0x1693('0x3'));var rs=require(_0x1693('0x4'));var fs=require('fs');var Redis=require(_0x1693('0x5'));var db=require(_0x1693('0x6'))['db'];var utils=require(_0x1693('0x7'));var logger=require('../../config/logger')(_0x1693('0x8'));var config=require(_0x1693('0x9'));var jayson=require(_0x1693('0xa'));var client=jayson[_0x1693('0xb')][_0x1693('0xc')]({'port':0x232a});config['redis']=_[_0x1693('0xd')](config[_0x1693('0xe')],{'host':_0x1693('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1693('0xe')]));require(_0x1693('0x10'))[_0x1693('0x11')](socket);function respondWithRpcPromise(_0x141ea9,_0x2af3d1,_0x181184){return new BPromise(function(_0x26ba4b,_0x3807dd){return client[_0x1693('0x12')](_0x141ea9,_0x181184)[_0x1693('0x13')](function(_0x1ba755){logger['info'](_0x1693('0x14'),_0x2af3d1,_0x1693('0x15'));logger[_0x1693('0x16')](_0x1693('0x17'),_0x2af3d1,_0x1693('0x15'),JSON[_0x1693('0x18')](_0x1ba755));if(_0x1ba755[_0x1693('0x19')]){if(_0x1ba755['error'][_0x1693('0x1a')]===0x1f4){logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error'][_0x1693('0x1b')]);return _0x3807dd(_0x1ba755[_0x1693('0x19')]['message']);}logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error']['message']);return _0x26ba4b(_0x1ba755['error'][_0x1693('0x1b')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2af3d1,_0x1693('0x15'));_0x26ba4b(_0x1ba755[_0x1693('0x1c')][_0x1693('0x1b')]);}})[_0x1693('0x1d')](function(_0x28edfe){logger[_0x1693('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x2af3d1,_0x28edfe);_0x3807dd(_0x28edfe);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index cb1296f..0ddd81a 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 _0x682e=['register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x682e,0x1ce));var _0xe682=function(_0x57fa81,_0x4d79b7){_0x57fa81=_0x57fa81-0x0;var _0x276a2d=_0x682e[_0x57fa81];return _0x276a2d;};'use strict';var VoicePrefixEvents=require(_0xe682('0x0'));var events=[_0xe682('0x1'),_0xe682('0x2'),_0xe682('0x3')];function createListener(_0x1fc41a,_0x31f019){return function(_0x5cbf47){_0x31f019[_0xe682('0x4')](_0x1fc41a,_0x5cbf47);};}function removeListener(_0x10c8cd,_0x3705a2){return function(){VoicePrefixEvents[_0xe682('0x5')](_0x10c8cd,_0x3705a2);};}exports[_0xe682('0x6')]=function(_0x51e786){for(var _0x3b4c98=0x0,_0xd6995=events[_0xe682('0x7')];_0x3b4c98<_0xd6995;_0x3b4c98++){var _0x1ab428=events[_0x3b4c98];var _0x4e7e7d=createListener(_0xe682('0x8')+_0x1ab428,_0x51e786);VoicePrefixEvents['on'](_0x1ab428,_0x4e7e7d);}}; \ No newline at end of file +var _0x5fc7=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x429620,_0x1328b4){var _0x2b79f4=function(_0x2c1f50){while(--_0x2c1f50){_0x429620['push'](_0x429620['shift']());}};_0x2b79f4(++_0x1328b4);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x5fc7[_0x2becba];return _0x90b5dd;};'use strict';var VoicePrefixEvents=require(_0x75fc('0x0'));var events=[_0x75fc('0x1'),_0x75fc('0x2'),_0x75fc('0x3')];function createListener(_0x196e85,_0xca767f){return function(_0x2e89f5){_0xca767f[_0x75fc('0x4')](_0x196e85,_0x2e89f5);};}function removeListener(_0x756c32,_0x51e8b4){return function(){VoicePrefixEvents[_0x75fc('0x5')](_0x756c32,_0x51e8b4);};}exports[_0x75fc('0x6')]=function(_0x52c644){for(var _0x1d1303=0x0,_0xc85b45=events[_0x75fc('0x7')];_0x1d1303<_0xc85b45;_0x1d1303++){var _0x347ce8=events[_0x1d1303];var _0x17a1d5=createListener(_0x75fc('0x8')+_0x347ce8,_0x52c644);VoicePrefixEvents['on'](_0x347ce8,_0x17a1d5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index c697874..146e73a 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(_0x26c488,_0xd793a){var _0x527b17=function(_0x4c6216){while(--_0x4c6216){_0x26c488['push'](_0x26c488['shift']());}};_0x527b17(++_0xd793a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xb10b,0x12a));var _0xbb10=function(_0x33a47b,_0x25022a){_0x33a47b=_0x33a47b-0x0;var _0x3164d0=_0xb10b[_0x33a47b];return _0x3164d0;};'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 f2405f8..9f6d070 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 _0x6361=['agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','inbound','default','ENUM','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','outbound','preview','booked','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'];(function(_0x3e06dd,_0x55694f){var _0x4bbb8b=function(_0x3586fa){while(--_0x3586fa){_0x3e06dd['push'](_0x3e06dd['shift']());}};_0x4bbb8b(++_0x55694f);}(_0x6361,0xd2));var _0x1636=function(_0x116b78,_0x214acd){_0x116b78=_0x116b78-0x0;var _0x67780d=_0x6361[_0x116b78];return _0x67780d;};'use strict';var Sequelize=require(_0x1636('0x0'));module['exports']={'name':{'type':Sequelize[_0x1636('0x1')],'allowNull':![],'unique':_0x1636('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1636('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x1636('0x3')},'musiconhold':{'type':Sequelize[_0x1636('0x1')],'defaultValue':_0x1636('0x4')},'announce':{'type':Sequelize[_0x1636('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1636('0x5')]('rr',_0x1636('0x6'),_0x1636('0x7'),'fewestcalls',_0x1636('0x8'),_0x1636('0x9'),_0x1636('0xa'),_0x1636('0xb'),_0x1636('0xc')),'allowNull':![],'defaultValue':_0x1636('0x6'),'set':function(_0x57adbd){this[_0x1636('0xd')](_0x1636('0xe'),_0x57adbd?_0x57adbd:_0x1636('0x9'));},'get':function(){var _0x11fd7f=this[_0x1636('0xf')]('type');var _0x36e278=this[_0x1636('0xf')](_0x1636('0x10'));var _0x469603=this[_0x1636('0xf')](_0x1636('0xe'));if(_0x11fd7f===_0x1636('0x11')){if(_0x36e278===_0x1636('0x12')){return null;}if(_0x36e278===_0x1636('0x13')&&!['rrmemory','roundrobin']['includes'](_0x469603)){this[_0x1636('0xd')](_0x1636('0xe'),'rrmemory');}}return _0x469603;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1636('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1636('0x1')]},'weight':{'type':Sequelize[_0x1636('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':_0x1636('0x15')},'autopause':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no',_0x1636('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1636('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x1636('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1636('0x5')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1636('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1636('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1636('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':_0x1636('0x15')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x1636('0x15'),'no',_0x1636('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1636('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x1636('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x1636('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1636('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1636('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1636('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1636('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1636('0x1')]},'queue_quantity1':{'type':Sequelize[_0x1636('0x1')]},'queue_quantity2':{'type':Sequelize[_0x1636('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x1636('0x1')]},'queue_less_than':{'type':Sequelize[_0x1636('0x1')]},'periodic_announce':{'type':Sequelize[_0x1636('0x18')],'set':function(_0x5290f1){this[_0x1636('0xd')]('periodic_announce',_0x5290f1?_0x5290f1[_0x1636('0x19')](','):[]);},'get':function(){return this[_0x1636('0xf')](_0x1636('0x1a'))?this['getDataValue'](_0x1636('0x1a'))[_0x1636('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x1636('0x1')],'defaultValue':_0x1636('0x15'),'set':function(_0x25dc46){this[_0x1636('0xd')](_0x1636('0x1c'),_0x25dc46?_0x25dc46['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x1636('0x1c'))?this[_0x1636('0xf')](_0x1636('0x1c'))[_0x1636('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1636('0x1')],'defaultValue':'no','set':function(_0x5453b3){this[_0x1636('0xd')](_0x1636('0x1d'),_0x5453b3?_0x5453b3[_0x1636('0x19')](','):undefined);},'get':function(){return this[_0x1636('0xf')](_0x1636('0x1d'))?this[_0x1636('0xf')]('leavewhenempty')[_0x1636('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1636('0x5')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1636('0x1')]},'description':{'type':Sequelize[_0x1636('0x1')]},'acw':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':0x0,'set':function(_0x446dfc){this[_0x1636('0xd')](_0x1636('0x1f'),_0x446dfc);if(_0x446dfc){if(this[_0x1636('0xf')](_0x1636('0x20'))<0x2){this[_0x1636('0xd')](_0x1636('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':0x0,'comment':_0x1636('0x21')},'dialMethod':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x12'),_0x1636('0x22'),_0x1636('0x23'),'predictive',_0x1636('0x13')),'defaultValue':_0x1636('0x22'),'comment':_0x1636('0x24')},'dialLimitChannel':{'type':Sequelize[_0x1636('0x14')](0x4)[_0x1636('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1636('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x1636('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1636('0x27')},'dialPowerLevel':{'type':Sequelize[_0x1636('0x28')](0x2)[_0x1636('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1636('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x2a'),'dropRate'),'defaultValue':_0x1636('0x2b'),'comment':_0x1636('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1636('0x28')](0x2)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1636('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1636('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1636('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x1636('0x1')],'defaultValue':_0x1636('0x2f'),'comment':_0x1636('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x1636('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x3,'comment':_0x1636('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1636('0x38')},'dialTimezone':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1636('0x39')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1636('0x3a'),_0x1636('0x3b'),_0x1636('0x3c')),'defaultValue':_0x1636('0x3a')},'dialAMDActive':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1636('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1636('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x1636('0x14')](0x9)[_0x1636('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1636('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1636('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1636('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1636('0x14')](0x9)[_0x1636('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1636('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x1636('0x14')](0x9)[_0x1636('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1636('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1636('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1636('0x14')](0x5)[_0x1636('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1636('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1636('0x14')](0x9)[_0x1636('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1636('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0x1636('0x14')](0x5)[_0x1636('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1636('0x44')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1636('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x46'),'ASC'),'defaultValue':_0x1636('0x46')},'dialQueueProject2':{'type':Sequelize[_0x1636('0x1')],'comment':_0x1636('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1636('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1636('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x49')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1636('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':![],'comment':_0x1636('0x51'),'set':function(_0x2f389a){if(!_0x2f389a)this['setDataValue'](_0x1636('0x52'),null);this[_0x1636('0xd')](_0x1636('0x53'),_0x2f389a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1636('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x78bf=['#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ringall','random','rrmemory','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','preview','booked','roundrobin','includes','INTEGER','ENUM','yes','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','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','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0x78bf,0x10a));var _0xf78b=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x78bf[_0x14363e];return _0x17c56d;};'use strict';var Sequelize=require(_0xf78b('0x0'));module[_0xf78b('0x1')]={'name':{'type':Sequelize[_0xf78b('0x2')],'allowNull':![],'unique':_0xf78b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf78b('0x4'),_0xf78b('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':_0xf78b('0x6')},'announce':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xf78b('0x7'),'leastrecent','fewestcalls',_0xf78b('0x8'),_0xf78b('0x9'),'linear',_0xf78b('0xa'),_0xf78b('0xb')),'allowNull':![],'defaultValue':_0xf78b('0x7'),'set':function(_0x790303){this[_0xf78b('0xc')]('strategy',_0x790303?_0x790303:_0xf78b('0x9'));},'get':function(){var _0x114270=this[_0xf78b('0xd')](_0xf78b('0xe'));var _0x7b012b=this['getDataValue'](_0xf78b('0xf'));var _0x190b52=this[_0xf78b('0xd')](_0xf78b('0x10'));if(_0x114270===_0xf78b('0x5')){if(_0x7b012b===_0xf78b('0x11')){return null;}if(_0x7b012b===_0xf78b('0x12')&&![_0xf78b('0x9'),_0xf78b('0x13')][_0xf78b('0x14')](_0x190b52)){this[_0xf78b('0xc')](_0xf78b('0x10'),'rrmemory');}}return _0x190b52;}},'servicelevel':{'type':Sequelize[_0xf78b('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf78b('0x15')](0xb)},'timeout':{'type':Sequelize[_0xf78b('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf78b('0x2')]},'weight':{'type':Sequelize[_0xf78b('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf78b('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf78b('0x16')]('yes','no'),'defaultValue':_0xf78b('0x17')},'autopause':{'type':Sequelize[_0xf78b('0x16')](_0xf78b('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf78b('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xf78b('0x16')](_0xf78b('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf78b('0x16')](_0xf78b('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf78b('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf78b('0x16')](_0xf78b('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xf78b('0x16')](_0xf78b('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xf78b('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf78b('0x16')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf78b('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xf78b('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf78b('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xf78b('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf78b('0x16')](_0xf78b('0x17'),'no'),'defaultValue':_0xf78b('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xf78b('0x17'),'no',_0xf78b('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xf78b('0x16')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf78b('0x2')]},'queue_youarenext':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf78b('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf78b('0x2')]},'queue_quantity1':{'type':Sequelize[_0xf78b('0x2')]},'queue_quantity2':{'type':Sequelize[_0xf78b('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xf78b('0x2')]},'queue_less_than':{'type':Sequelize[_0xf78b('0x2')]},'periodic_announce':{'type':Sequelize[_0xf78b('0x19')],'set':function(_0xd179d){this[_0xf78b('0xc')]('periodic_announce',_0xd179d?_0xd179d[_0xf78b('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xf78b('0x1b'))?this[_0xf78b('0xd')](_0xf78b('0x1b'))[_0xf78b('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':_0xf78b('0x17'),'set':function(_0x187dc3){this[_0xf78b('0xc')]('joinempty',_0x187dc3?_0x187dc3['join'](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xf78b('0xd')](_0xf78b('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xa02446){this[_0xf78b('0xc')](_0xf78b('0x1e'),_0xa02446?_0xa02446[_0xf78b('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xf78b('0x1e'))?this[_0xf78b('0xd')](_0xf78b('0x1e'))[_0xf78b('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xf78b('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xf78b('0x16')](_0xf78b('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf78b('0x16')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf78b('0x2')]},'description':{'type':Sequelize[_0xf78b('0x2')]},'acw':{'type':Sequelize[_0xf78b('0x1f')],'defaultValue':0x0,'set':function(_0x20c072){this[_0xf78b('0xc')](_0xf78b('0x20'),_0x20c072);if(_0x20c072){if(this[_0xf78b('0xd')]('wrapuptime')<0x2){this[_0xf78b('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf78b('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf78b('0x1f')],'defaultValue':0x0,'comment':_0xf78b('0x21')},'dialMethod':{'type':Sequelize['ENUM'](_0xf78b('0x11'),_0xf78b('0x22'),_0xf78b('0x23'),'predictive',_0xf78b('0x12')),'defaultValue':_0xf78b('0x22'),'comment':_0xf78b('0x24')},'dialLimitChannel':{'type':Sequelize[_0xf78b('0x15')](0x4)[_0xf78b('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf78b('0x26')},'dialLimitQueue':{'type':Sequelize[_0xf78b('0x15')](0x4)[_0xf78b('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf78b('0x27')},'dialPowerLevel':{'type':Sequelize[_0xf78b('0x28')](0x2)[_0xf78b('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xf78b('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xf78b('0x2a'),_0xf78b('0x2b')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf78b('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf78b('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf78b('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf78b('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':_0xf78b('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xf78b('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf78b('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf78b('0x15')](0x5)[_0xf78b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf78b('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf78b('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf78b('0x15')](0x5)[_0xf78b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf78b('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf78b('0x15')](0x5)[_0xf78b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf78b('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf78b('0x35')},'dialTimezone':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':_0xf78b('0x36')},'dialPrefix':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xf78b('0x37'),_0xf78b('0x38'),_0xf78b('0x39')),'defaultValue':_0xf78b('0x37')},'dialAMDActive':{'type':Sequelize[_0xf78b('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xf78b('0x15')](0x9)[_0xf78b('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf78b('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf78b('0x15')](0x9)[_0xf78b('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xf78b('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xf78b('0x15')](0x9)[_0xf78b('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf78b('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf78b('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf78b('0x15')](0x9)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf78b('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf78b('0x15')](0x5)[_0xf78b('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf78b('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf78b('0x15')](0x9)[_0xf78b('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xf78b('0x15')](0x5)[_0xf78b('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf78b('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xf78b('0x1f')],'defaultValue':0x0,'comment':_0xf78b('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf78b('0x16')](_0xf78b('0x41'),_0xf78b('0x42')),'defaultValue':_0xf78b('0x41')},'dialQueueProject2':{'type':Sequelize[_0xf78b('0x2')],'comment':_0xf78b('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf78b('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xf78b('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf78b('0x44')},'dialCutDigit':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf78b('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf78b('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf78b('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf78b('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0xf78b('0x15')](0x5)[_0xf78b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf78b('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf78b('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf78b('0x15')](0x5)[_0xf78b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf78b('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf78b('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf78b('0x15')](0x5)[_0xf78b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf78b('0x15')](0x3)[_0xf78b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf78b('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xf78b('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xf78b('0x1f')],'defaultValue':![],'comment':_0xf78b('0x4d'),'set':function(_0x28b7c3){if(!_0x28b7c3)this[_0xf78b('0xc')]('mandatoryDispositionPauseId',null);this[_0xf78b('0xc')](_0xf78b('0x4e'),_0x28b7c3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf78b('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf78b('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xf78b('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xf78b('0x25')],'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 0795ab4..60e63c2 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 _0x34e8=['body','role','user','QueueCampaigns','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','includeAll','merge','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','where','filter','CmHopper','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userVoiceQueue:remove','spread','push','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','CmListId','ListId','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','ContactId','cm_contacts','ListId\x20=\x20?','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','map','value','type','UserProfileResource','error','stack','name','VoiceQueue','rawAttributes','fieldName','key','getOptions','include','query','findAll','catch','show','keys','filters','model','attributes','intersection','fields','length','create'];(function(_0x43ee7e,_0x78e09b){var _0x22d326=function(_0x2261a4){while(--_0x2261a4){_0x43ee7e['push'](_0x43ee7e['shift']());}};_0x22d326(++_0x78e09b);}(_0x34e8,0x12c));var _0x834e=function(_0x238e6b,_0x2c5cf7){_0x238e6b=_0x238e6b-0x0;var _0x3d9365=_0x34e8[_0x238e6b];return _0x3d9365;};'use strict';var moment=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));var squel=require('squel');var Redis=require(_0x834e('0x4'));var qs=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var config=require(_0x834e('0x8'));var db=require(_0x834e('0x9'))['db'];config[_0x834e('0xa')]=_['defaults'](config[_0x834e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x834e('0xb'))(new Redis(config[_0x834e('0xa')]));require(_0x834e('0xc'))[_0x834e('0xd')](socket);function respondWithStatusCode(_0x33ea05,_0x23501c){_0x23501c=_0x23501c||0xcc;return function(_0x363786){if(_0x363786){return _0x33ea05[_0x834e('0xe')](_0x23501c);}return _0x33ea05[_0x834e('0xf')](_0x23501c)[_0x834e('0x10')]();};}function respondWithResult(_0x1e41fe,_0x36e124){_0x36e124=_0x36e124||0xc8;return function(_0x14038b){if(_0x14038b){return _0x1e41fe[_0x834e('0xf')](_0x36e124)[_0x834e('0x11')](_0x14038b);}};}function respondWithFilteredResult(_0x1e00de,_0x2fd95c){return function(_0x538bb3){if(_0x538bb3){var _0x5e5b6d=typeof _0x2fd95c[_0x834e('0x12')]==='undefined'&&typeof _0x2fd95c[_0x834e('0x13')]===_0x834e('0x14');var _0x28e659=_0x538bb3[_0x834e('0x15')];var _0x50e860=_0x5e5b6d?0x0:_0x2fd95c[_0x834e('0x12')];var _0x302cbd=_0x5e5b6d?_0x538bb3['count']:_0x2fd95c[_0x834e('0x12')]+_0x2fd95c['limit'];var _0x38a8cd;if(_0x302cbd>=_0x28e659){_0x302cbd=_0x28e659;_0x38a8cd=0xc8;}else{_0x38a8cd=0xce;}_0x1e00de[_0x834e('0xf')](_0x38a8cd);return _0x1e00de['set'](_0x834e('0x16'),_0x50e860+'-'+_0x302cbd+'/'+_0x28e659)[_0x834e('0x11')](_0x538bb3);}return null;};}function saveUpdates(_0x370fb5){return function(_0x50b3f6){if(_0x50b3f6){return _0x50b3f6[_0x834e('0x17')](_0x370fb5)[_0x834e('0x18')](function(_0x34e41a){return _0x34e41a;});}return null;};}function removeEntity(_0xb993a1){return function(_0x237947){if(_0x237947){return _0x237947[_0x834e('0x19')]()[_0x834e('0x18')](function(){var _0x595515=_0x237947[_0x834e('0x1a')]({'plain':!![]});var _0x1fd2c6=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c'),'ignore':![]},{'name':'QueueCampaigns','value':_0x834e('0x1d'),'ignore':![]}];var _0x62f8f1=_(_0x1fd2c6)['filter'](_0x834e('0x1e'))[_0x834e('0x1f')](_0x834e('0x20'))['value']();if(_['includes'](_0x62f8f1,_0x595515[_0x834e('0x21')])){return;}var _0x34563b=_['find'](_0x1fd2c6,[_0x834e('0x20'),_0x595515[_0x834e('0x21')]])['name'];return db[_0x834e('0x22')][_0x834e('0x19')]({'where':{'type':_0x34563b,'resourceId':_0x595515['id']}})[_0x834e('0x18')](function(){return _0x237947;});})['then'](function(){_0xb993a1[_0x834e('0xf')](0xcc)[_0x834e('0x10')]();});}};}function handleEntityNotFound(_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x5e1cc5[_0x834e('0xe')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x23')](_0x3f1b0b[_0x834e('0x24')]);if(_0x3f1b0b[_0x834e('0x25')]){delete _0x3f1b0b[_0x834e('0x25')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={};var _0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x1f')](db[_0x834e('0x26')][_0x834e('0x27')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x28')],'type':_0x1e026a[_0x834e('0x21')][_0x834e('0x29')]};});_0x567cea=qs[_0x834e('0x2a')](_0x5dacc1,_0x58c1d7);var _0x278db3={'where':_0x567cea['where']};return db[_0x834e('0x26')]['count'](_0x278db3)[_0x834e('0x18')](function(_0x3787b0){_0x106d6a[_0x834e('0x15')]=_0x3787b0;_0x567cea[_0x834e('0x2b')]=qs[_0x834e('0x2b')](_0x58c1d7[_0x834e('0x2c')]);return db[_0x834e('0x26')][_0x834e('0x2d')](_0x567cea);})[_0x834e('0x18')](function(_0x12b2bc){_0x106d6a['rows']=_0x12b2bc;return _0x106d6a;})[_0x834e('0x18')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x2e')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x2f')]=function(_0xaf01f4,_0x595cc0){var _0x3f88ad={'raw':![],'where':{'id':_0xaf01f4['params']['id']}},_0x379d60={};_0x379d60['model']=_['keys'](db[_0x834e('0x26')][_0x834e('0x27')]);_0x379d60[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xaf01f4[_0x834e('0x2c')]);_0x379d60[_0x834e('0x31')]=_['intersection'](_0x379d60[_0x834e('0x32')],_0x379d60['query']);_0x3f88ad[_0x834e('0x33')]=_[_0x834e('0x34')](_0x379d60['model'],qs[_0x834e('0x35')](_0xaf01f4[_0x834e('0x2c')]['fields']));_0x3f88ad['attributes']=_0x3f88ad[_0x834e('0x33')][_0x834e('0x36')]?_0x3f88ad[_0x834e('0x33')]:_0x379d60[_0x834e('0x32')];if(_0xaf01f4[_0x834e('0x2c')]['includeAll']){_0x3f88ad[_0x834e('0x2b')]=[{'all':!![]}];}_0x3f88ad=_['merge']({},_0x3f88ad,_0xaf01f4['options']);return db[_0x834e('0x26')]['find'](_0x3f88ad)[_0x834e('0x18')](handleEntityNotFound(_0x595cc0,null))[_0x834e('0x18')](respondWithResult(_0x595cc0,null))[_0x834e('0x2e')](handleError(_0x595cc0,null));};exports[_0x834e('0x37')]=function(_0x2b7933,_0x574ea8){return db[_0x834e('0x26')][_0x834e('0x37')](_0x2b7933[_0x834e('0x38')],{})['then'](function(_0x35380e){var _0x16ac45=_0x2b7933['user'][_0x834e('0x1a')]({'plain':!![]});if(!_0x16ac45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16ac45[_0x834e('0x39')]===_0x834e('0x3a')){var _0x4a18bb=_0x35380e['get']({'plain':!![]});var _0x22ea21=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c')},{'name':_0x834e('0x3b'),'value':_0x834e('0x1d')}];var _0x23feea=_[_0x834e('0x3c')](_0x22ea21,['value',_0x4a18bb[_0x834e('0x21')]])['name'];return db[_0x834e('0x3d')]['find']({'where':{'name':_0x23feea,'userProfileId':_0x16ac45[_0x834e('0x3e')]},'raw':!![]})['then'](function(_0x361f60){if(_0x361f60&&_0x361f60[_0x834e('0x3f')]===0x0){return db['UserProfileResource'][_0x834e('0x37')]({'name':_0x4a18bb[_0x834e('0x25')],'resourceId':_0x4a18bb['id'],'type':_0x361f60[_0x834e('0x25')],'sectionId':_0x361f60['id']},{})[_0x834e('0x18')](function(){return _0x35380e;});}else{return _0x35380e;}})[_0x834e('0x2e')](function(_0x1a7149){logger[_0x834e('0x23')](_0x834e('0x40'),_0x1a7149);throw _0x1a7149;});}return _0x35380e;})[_0x834e('0x18')](respondWithResult(_0x574ea8,0xc9))[_0x834e('0x2e')](handleError(_0x574ea8,null));};exports['clone']=function(_0x3124be,_0x6fff27){var _0x47a8a9={'where':{'id':_0x3124be[_0x834e('0x41')]['id']}},_0x112306={};_0x112306[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x26')][_0x834e('0x27')]);_0x47a8a9['attributes']=_['intersection'](_0x112306[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3124be[_0x834e('0x2c')][_0x834e('0x35')]));_0x47a8a9[_0x834e('0x33')]=_0x47a8a9[_0x834e('0x33')][_0x834e('0x36')]?_0x47a8a9[_0x834e('0x33')]:_0x112306[_0x834e('0x32')];if(_0x3124be[_0x834e('0x2c')][_0x834e('0x42')]){_0x47a8a9[_0x834e('0x2b')]=[{'all':!![]}];}_0x47a8a9=_[_0x834e('0x43')]({},_0x47a8a9,_0x3124be[_0x834e('0x44')]);return db[_0x834e('0x26')][_0x834e('0x3c')](_0x47a8a9)[_0x834e('0x18')](handleEntityNotFound(_0x6fff27,null))[_0x834e('0x18')](function(_0x420841){if(_0x420841){var _0x1adf86=_0x420841['get']({'plain':!![]});_0x1adf86=qs[_0x834e('0x45')](_0x1adf86,['id',_0x834e('0x46'),'updatedAt']);_0x3124be[_0x834e('0x38')]=_[_0x834e('0x45')](_0x3124be['body'],['id',_0x834e('0x46'),_0x834e('0x47')]);return db[_0x834e('0x26')][_0x834e('0x37')](_[_0x834e('0x43')](_0x1adf86,_0x3124be[_0x834e('0x38')]),{'include':_0x3124be[_0x834e('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0x834e('0x18')](function(_0x8bc6c6){var _0x3e0550=_0x3124be[_0x834e('0x3a')][_0x834e('0x1a')]({'plain':!![]});if(!_0x3e0550)throw new Error(_0x834e('0x48'));if(_0x3e0550[_0x834e('0x39')]===_0x834e('0x3a')){var _0x5afa07=_0x8bc6c6[_0x834e('0x1a')]({'plain':!![]});var _0x4dc104=[{'name':_0x834e('0x1b'),'value':'inbound'},{'name':_0x834e('0x3b'),'value':'outbound'}];var _0x527eef=_[_0x834e('0x3c')](_0x4dc104,[_0x834e('0x20'),_0x5afa07['type']])['name'];return db[_0x834e('0x3d')][_0x834e('0x3c')]({'where':{'name':_0x527eef,'userProfileId':_0x3e0550[_0x834e('0x3e')]},'raw':!![]})[_0x834e('0x18')](function(_0x21c417){if(_0x21c417&&_0x21c417[_0x834e('0x3f')]===0x0){return db[_0x834e('0x22')][_0x834e('0x37')]({'name':_0x5afa07['name'],'resourceId':_0x5afa07['id'],'type':_0x21c417[_0x834e('0x25')],'sectionId':_0x21c417['id']},{})[_0x834e('0x18')](function(){return _0x8bc6c6;});}else{return _0x8bc6c6;}})['catch'](function(_0x281342){logger['error'](_0x834e('0x40'),_0x281342);throw _0x281342;});}return _0x8bc6c6;});}})[_0x834e('0x18')](respondWithResult(_0x6fff27,0xc9))['catch'](handleError(_0x6fff27,null));};exports[_0x834e('0x17')]=function(_0x37ee0e,_0x2de29a){if(_0x37ee0e[_0x834e('0x38')]['id']){delete _0x37ee0e['body']['id'];}return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x37ee0e[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2de29a,null))[_0x834e('0x18')](saveUpdates(_0x37ee0e[_0x834e('0x38')],null))[_0x834e('0x18')](respondWithResult(_0x2de29a,null))[_0x834e('0x2e')](handleError(_0x2de29a,null));};exports[_0x834e('0x19')]=function(_0x125f37,_0x3a1426){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x125f37[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x3a1426,null))[_0x834e('0x18')](removeEntity(_0x3a1426,null))[_0x834e('0x2e')](handleError(_0x3a1426,null));};exports[_0x834e('0x49')]=function(_0x460a7a,_0x17b8e3){var _0x297cce={'raw':![],'where':{}};var _0x14ed83={};var _0x193a15={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x460a7a[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x17b8e3,null))[_0x834e('0x18')](function(_0x25d6f4){if(_0x25d6f4){_0x14ed83[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmHopper'][_0x834e('0x27')]);_0x14ed83['query']=_['keys'](_0x460a7a[_0x834e('0x2c')]);_0x14ed83[_0x834e('0x31')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],_0x14ed83[_0x834e('0x2c')]);_0x297cce[_0x834e('0x33')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],qs['fields'](_0x460a7a[_0x834e('0x2c')]['fields']));_0x297cce[_0x834e('0x33')]=_0x297cce[_0x834e('0x33')]['length']?_0x297cce['attributes']:_0x14ed83[_0x834e('0x32')];if(!_0x460a7a[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x297cce[_0x834e('0x13')]=qs['limit'](_0x460a7a[_0x834e('0x2c')][_0x834e('0x13')]);_0x297cce[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x12')]);}_0x297cce[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x4e')]);_0x297cce['where']=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x460a7a[_0x834e('0x2c')],_0x14ed83[_0x834e('0x31')]));_0x297cce['where'][_0x834e('0x50')]=_0x25d6f4['id'];if(_0x460a7a['query']['filter']){_0x297cce['where']=_[_0x834e('0x43')](_0x297cce[_0x834e('0x51')],{'$or':_['map'](_0x297cce[_0x834e('0x33')],function(_0x1b200d){var _0x4d4477={};_0x4d4477[_0x1b200d]={'$like':'%'+_0x460a7a[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4d4477;})});}_0x297cce=_['merge']({},_0x297cce,_0x460a7a['options']);return db[_0x834e('0x53')][_0x834e('0x15')]({'where':_0x297cce[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x1d8e7){_0x193a15['count']=_0x1d8e7;if(_0x460a7a[_0x834e('0x2c')]['includeAll']){_0x297cce[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x53')][_0x834e('0x2d')](_0x297cce);})['then'](function(_0x33a3cd){_0x193a15[_0x834e('0x54')]=_0x33a3cd;return _0x193a15;});}})['then'](respondWithFilteredResult(_0x17b8e3,_0x297cce))[_0x834e('0x2e')](handleError(_0x17b8e3,null));};exports[_0x834e('0x55')]=function(_0xb4e130,_0x50d0a3){var _0x214014={'raw':!![],'where':{}};var _0x1d4e66={};var _0x402692={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0xb4e130[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x50d0a3,null))[_0x834e('0x18')](function(_0xd49002){if(_0xd49002){_0x1d4e66[_0x834e('0x32')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x1d4e66[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xb4e130[_0x834e('0x2c')]);_0x1d4e66[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d4e66['model'],_0x1d4e66['query']);_0x214014[_0x834e('0x33')]=_[_0x834e('0x34')](_0x1d4e66[_0x834e('0x32')],qs[_0x834e('0x35')](_0xb4e130[_0x834e('0x2c')]['fields']));_0x214014[_0x834e('0x33')]=_0x214014[_0x834e('0x33')][_0x834e('0x36')]?_0x214014['attributes']:_0x1d4e66[_0x834e('0x32')];if(!_0xb4e130[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x214014[_0x834e('0x13')]=qs['limit'](_0xb4e130['query'][_0x834e('0x13')]);_0x214014[_0x834e('0x12')]=qs['offset'](_0xb4e130[_0x834e('0x2c')]['offset']);}_0x214014[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0xb4e130[_0x834e('0x2c')]['sort']);_0x214014[_0x834e('0x51')]=qs['filters'](_['pick'](_0xb4e130['query'],_0x1d4e66[_0x834e('0x31')]));_0x214014[_0x834e('0x51')][_0x834e('0x50')]=_0xd49002['id'];if(_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]){_0x214014[_0x834e('0x51')]=_[_0x834e('0x43')](_0x214014[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x214014['attributes'],function(_0x2f775a){var _0x54e70d={};_0x54e70d[_0x2f775a]={'$like':'%'+_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x54e70d;})});}_0x214014=_[_0x834e('0x43')]({},_0x214014,_0xb4e130[_0x834e('0x44')]);return db[_0x834e('0x56')][_0x834e('0x15')]({'where':_0x214014['where']})['then'](function(_0xeb096d){_0x402692[_0x834e('0x15')]=_0xeb096d;if(_0xb4e130['query'][_0x834e('0x42')]){_0x214014[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x56')][_0x834e('0x2d')](_0x214014);})[_0x834e('0x18')](function(_0x5a75e3){_0x402692[_0x834e('0x54')]=_0x5a75e3;return _0x402692;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x50d0a3,_0x214014))['catch'](handleError(_0x50d0a3,null));};exports['getHopperFinals']=function(_0x5ede29,_0x1e5252){var _0x1f3e26={'raw':!![],'where':{}};var _0x4f716d={};var _0x23ce49={'count':0x0,'rows':[]};return db[_0x834e('0x26')]['findOne']({'where':{'id':_0x5ede29[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e5252,null))['then'](function(_0x41dfd9){if(_0x41dfd9){_0x4f716d[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x57')]['rawAttributes']);_0x4f716d[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5ede29[_0x834e('0x2c')]);_0x4f716d[_0x834e('0x31')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],_0x4f716d[_0x834e('0x2c')]);_0x1f3e26[_0x834e('0x33')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x35')]));_0x1f3e26[_0x834e('0x33')]=_0x1f3e26[_0x834e('0x33')][_0x834e('0x36')]?_0x1f3e26[_0x834e('0x33')]:_0x4f716d[_0x834e('0x32')];if(!_0x5ede29[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1f3e26[_0x834e('0x13')]=qs['limit'](_0x5ede29[_0x834e('0x2c')][_0x834e('0x13')]);_0x1f3e26[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x12')]);}_0x1f3e26[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5ede29[_0x834e('0x2c')]['sort']);_0x1f3e26['where']=qs['filters'](_[_0x834e('0x4f')](_0x5ede29['query'],_0x4f716d[_0x834e('0x31')]));_0x1f3e26[_0x834e('0x51')][_0x834e('0x50')]=_0x41dfd9['id'];if(_0x5ede29['query'][_0x834e('0x52')]){_0x1f3e26[_0x834e('0x51')]=_[_0x834e('0x43')](_0x1f3e26[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x1f3e26[_0x834e('0x33')],function(_0x528052){var _0x10dd7b={};_0x10dd7b[_0x528052]={'$like':'%'+_0x5ede29[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x10dd7b;})});}_0x1f3e26=_[_0x834e('0x43')]({},_0x1f3e26,_0x5ede29[_0x834e('0x44')]);return db['CmHopperFinal']['count']({'where':_0x1f3e26['where']})['then'](function(_0x1dfa2e){_0x23ce49[_0x834e('0x15')]=_0x1dfa2e;if(_0x5ede29['query'][_0x834e('0x42')]){_0x1f3e26[_0x834e('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x834e('0x2d')](_0x1f3e26);})[_0x834e('0x18')](function(_0xbf7693){_0x23ce49[_0x834e('0x54')]=_0xbf7693;return _0x23ce49;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x1e5252,_0x1f3e26))[_0x834e('0x2e')](handleError(_0x1e5252,null));};exports['getHopperBlacks']=function(_0x5a49fc,_0x43b92f){var _0x30ab20={'raw':!![],'where':{}};var _0x1d2e12={};var _0x58bdd6={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5a49fc['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x43b92f,null))[_0x834e('0x18')](function(_0x216d1f){if(_0x216d1f){_0x1d2e12[_0x834e('0x32')]=_['keys'](db[_0x834e('0x58')]['rawAttributes']);_0x1d2e12['query']=_[_0x834e('0x30')](_0x5a49fc[_0x834e('0x2c')]);_0x1d2e12[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d2e12[_0x834e('0x32')],_0x1d2e12[_0x834e('0x2c')]);_0x30ab20['attributes']=_['intersection'](_0x1d2e12[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x35')]));_0x30ab20[_0x834e('0x33')]=_0x30ab20[_0x834e('0x33')][_0x834e('0x36')]?_0x30ab20['attributes']:_0x1d2e12[_0x834e('0x32')];if(!_0x5a49fc[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x30ab20[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x13')]);_0x30ab20[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x12')]);}_0x30ab20[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x4e')]);_0x30ab20[_0x834e('0x51')]=qs['filters'](_[_0x834e('0x4f')](_0x5a49fc[_0x834e('0x2c')],_0x1d2e12['filters']));_0x30ab20[_0x834e('0x51')]['VoiceQueueId']=_0x216d1f['id'];if(_0x5a49fc[_0x834e('0x2c')]['filter']){_0x30ab20[_0x834e('0x51')]=_['merge'](_0x30ab20[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x30ab20[_0x834e('0x33')],function(_0x1aac37){var _0x57ee25={};_0x57ee25[_0x1aac37]={'$like':'%'+_0x5a49fc[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x57ee25;})});}_0x30ab20=_[_0x834e('0x43')]({},_0x30ab20,_0x5a49fc[_0x834e('0x44')]);return db[_0x834e('0x58')][_0x834e('0x15')]({'where':_0x30ab20[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x2aa430){_0x58bdd6[_0x834e('0x15')]=_0x2aa430;if(_0x5a49fc[_0x834e('0x2c')][_0x834e('0x42')]){_0x30ab20[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x58')][_0x834e('0x2d')](_0x30ab20);})[_0x834e('0x18')](function(_0xe84914){_0x58bdd6['rows']=_0xe84914;return _0x58bdd6;});}})['then'](respondWithFilteredResult(_0x43b92f,_0x30ab20))[_0x834e('0x2e')](handleError(_0x43b92f,null));};exports[_0x834e('0x59')]=function(_0x3f52b9,_0x213303){var _0x3bf1b6={};var _0x31f336={};var _0x22f90d;var _0x40fd40;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x3f52b9[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x213303,null))['then'](function(_0x1bd254){if(_0x1bd254){_0x22f90d=_0x1bd254;_0x31f336['model']=_[_0x834e('0x30')](db[_0x834e('0x5a')][_0x834e('0x27')]);_0x31f336['query']=_[_0x834e('0x30')](_0x3f52b9[_0x834e('0x2c')]);_0x31f336['filters']=_['intersection'](_0x31f336[_0x834e('0x32')],_0x31f336[_0x834e('0x2c')]);_0x3bf1b6['attributes']=_[_0x834e('0x34')](_0x31f336[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x35')]));_0x3bf1b6['attributes']=_0x3bf1b6['attributes'][_0x834e('0x36')]?_0x3bf1b6['attributes']:_0x31f336['model'];_0x3bf1b6['order']=qs[_0x834e('0x4e')](_0x3f52b9[_0x834e('0x2c')]['sort']);_0x3bf1b6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x3f52b9[_0x834e('0x2c')],_0x31f336['filters']));if(_0x3f52b9[_0x834e('0x2c')][_0x834e('0x52')]){_0x3bf1b6[_0x834e('0x51')]=_['merge'](_0x3bf1b6[_0x834e('0x51')],{'$or':_['map'](_0x3bf1b6[_0x834e('0x33')],function(_0x4af2a2){var _0x461420={};_0x461420[_0x4af2a2]={'$like':'%'+_0x3f52b9[_0x834e('0x2c')]['filter']+'%'};return _0x461420;})});}_0x3bf1b6=_[_0x834e('0x43')]({},_0x3bf1b6,_0x3f52b9[_0x834e('0x44')]);return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})[_0x834e('0x18')](function(_0x410895){if(_0x410895){_0x40fd40=_0x410895[_0x834e('0x36')];if(!_0x3f52b9['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x3bf1b6[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x13')]);_0x3bf1b6['offset']=qs[_0x834e('0x12')](_0x3f52b9['query']['offset']);}return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})['then'](function(_0x4c5da4){if(_0x4c5da4){return _0x4c5da4?{'count':_0x40fd40,'rows':_0x4c5da4}:null;}})[_0x834e('0x18')](respondWithResult(_0x213303,null))[_0x834e('0x2e')](handleError(_0x213303,null));};exports[_0x834e('0x5b')]=function(_0x2e5886,_0x38fbc4){var _0x3e0ee6=_0x2e5886[_0x834e('0x38')][_0x834e('0x5c')];var _0x1d3ca9=_[_0x834e('0x1f')](_0x3e0ee6,'id');return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0x1d3ca9},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id','name',_0x834e('0x5f'),'voicePause',_0x834e('0x60')],'raw':!![]}]})[_0x834e('0x18')](function(_0x284412){if(_0x284412){var _0x2cdbe0=_['flatMap'](_0x284412,function(_0x5f558a){var _0x37d8dd=_0x5f558a[_0x834e('0x1a')]({'plain':!![]});_0x37d8dd['Agents'][_0x834e('0x61')](function(_0xfa7b14){_0xfa7b14['penalty']=_[_0x834e('0x3c')](_0x3e0ee6,{'id':_0x37d8dd['id']})[_0x834e('0x62')];});return _0x37d8dd[_0x834e('0x5e')];});return db[_0x834e('0x26')]['find']({'where':{'id':_0x2e5886['params']['id']}})['then'](function(_0x48e14c){return db[_0x834e('0x63')][_0x834e('0x64')](function(_0x47891e){return _0x48e14c[_0x834e('0x5b')](_0x1d3ca9,{'transaction':_0x47891e})['then'](function(){return BPromise[_0x834e('0x65')](_0x3e0ee6,function(_0x13b39a){return db[_0x834e('0x66')][_0x834e('0x67')]({'TeamId':_0x13b39a['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id'],'penalty':_0x13b39a[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){return BPromise['each'](_0x2cdbe0,function(_0x12a0f3){return db[_0x834e('0x68')]['findOrCreate']({'where':{'UserId':_0x12a0f3['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id']},'defaults':{'penalty':_0x12a0f3[_0x834e('0x62')]},'transaction':_0x47891e});});})['then'](function(){return BPromise['each'](_['filter'](_0x2cdbe0,{'online':!![]}),function(_0x3edbbb){return db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x3edbbb['name'],'UserId':_0x3edbbb['id'],'queue_name':_0x48e14c[_0x834e('0x25')],'VoiceQueueId':_0x48e14c['id'],'interface':_[_0x834e('0x6a')](_0x3edbbb[_0x834e('0x60')])?util[_0x834e('0x6b')](_0x834e('0x6c'),_0x3edbbb[_0x834e('0x25')]):_0x3edbbb[_0x834e('0x60')],'paused':_0x3edbbb[_0x834e('0x6d')]||![],'penalty':_0x3edbbb[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){_0x2cdbe0['forEach'](function(_0x5d6b66){socket[_0x834e('0x6e')](_0x834e('0x6f'),{'UserId':_0x5d6b66['id'],'VoiceQueueId':_0x48e14c['id']});});});});});}})[_0x834e('0x18')](respondWithStatusCode(_0x38fbc4,null))[_0x834e('0x2e')](handleError(_0x38fbc4,null));};exports[_0x834e('0x70')]=function(_0xd22e8f,_0x281922){return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')]},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x281922,null))[_0x834e('0x18')](function(_0x3b13be){var _0x3f5b2e=_[_0x834e('0x1f')](_0x3b13be,'id');var _0x495697=[];var _0x5943a3=[];var _0x4e7c43=squel[_0x834e('0x72')]();_0x4e7c43[_0x834e('0x73')](_0x834e('0x74'))[_0x834e('0x75')](_0x834e('0x76'),'tq')[_0x834e('0x77')](_0x834e('0x78'),'ut',_0x834e('0x79'))['where']('VoiceQueueId\x20=\x20?',_0xd22e8f['params']['id']);for(var _0x5a5602=0x0;_0x5a5602<_0x3b13be[_0x834e('0x36')];_0x5a5602+=0x1){let _0xd108fa=_0x3b13be[_0x5a5602];for(var _0x37defd=0x0;_0x37defd<_0xd108fa[_0x834e('0x5e')][_0x834e('0x36')];_0x37defd+=0x1){let _0x386e10=_0xd108fa[_0x834e('0x5e')][_0x37defd];var _0x29ef2f=_0x4e7c43[_0x834e('0x7a')]();_0x29ef2f['where']('ut.UserId\x20=\x20?',_0x386e10['id']);_0x5943a3['push'](db['sequelize'][_0x834e('0x2c')](_0x29ef2f[_0x834e('0x7b')](),{'type':db[_0x834e('0x63')][_0x834e('0x7c')][_0x834e('0x7d')]})[_0x834e('0x18')](function(_0x416bea){if(_0x416bea[_0x834e('0x36')]===0x1){return _0x386e10['id'];}else{var _0x86d08c=_[_0x834e('0x7e')](_[_0x834e('0x1f')](_0x416bea,_0x834e('0x7f')),function(_0x1fd72b){return _[_0x834e('0x80')](_0x3f5b2e,_0x1fd72b);});if(_0x86d08c){return _0x386e10['id'];}}}));}}return BPromise[_0x834e('0x81')](_0x5943a3)[_0x834e('0x18')](function(_0x5022f2){_0x495697=_(_0x495697)[_0x834e('0x82')](_0x5022f2)['compact']()[_0x834e('0x20')]();return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0xd22e8f['params']['id']}})[_0x834e('0x18')](function(_0x3d9d85){return db['sequelize']['transaction'](function(_0x1c3b23){return _0x3d9d85[_0x834e('0x70')](_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')],{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){if(!_[_0x834e('0x83')](_0x495697)){return _0x3d9d85[_0x834e('0x84')](_0x495697,{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){return db['UserVoiceQueueRt'][_0x834e('0x19')]({'where':{'VoiceQueueId':_0xd22e8f[_0x834e('0x41')]['id'],'UserId':_0x495697},'transaction':_0x1c3b23});});}})[_0x834e('0x18')](function(){_0x495697[_0x834e('0x61')](function(_0x1912e6){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':_0x1912e6,'VoiceQueueId':_0x3d9d85['id']});});});});});});})['then'](respondWithStatusCode(_0x281922,null))[_0x834e('0x2e')](handleError(_0x281922,null));};exports['addAgents']=function(_0x586fa5,_0x1115b7){var _0x1e0bc9,_0x4b16fa;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x586fa5['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x1115b7,null))[_0x834e('0x18')](function(_0x5d994e){if(_0x5d994e){_0x4b16fa=_0x5d994e;return _0x5d994e['addAgents'](_0x586fa5[_0x834e('0x38')][_0x834e('0x71')],_['omit'](_0x586fa5['body'],[_0x834e('0x71'),'id'])||{})[_0x834e('0x86')](function(_0x5d6f5e){for(var _0x480290=0x0;_0x480290<_0x586fa5['body']['ids'][_0x834e('0x36')];_0x480290+=0x1){socket['emit'](_0x834e('0x6f'),{'UserId':Number(_0x586fa5['body'][_0x834e('0x71')][_0x480290]),'VoiceQueueId':Number(_0x586fa5[_0x834e('0x41')]['id'])});}return _0x5d6f5e;});}})[_0x834e('0x18')](function(_0x3d2569){_0x1e0bc9=_0x3d2569||[];if(_0x4b16fa){return db['User'][_0x834e('0x2d')]({'where':{'id':_0x586fa5[_0x834e('0x38')][_0x834e('0x71')]},'attributes':['id',_0x834e('0x25'),_0x834e('0x5f'),_0x834e('0x6d'),_0x834e('0x60')],'raw':!![]});}})[_0x834e('0x18')](function(_0x464ae6){if(!_[_0x834e('0x83')](_0x464ae6)){var _0x590e52=[];for(var _0x40e12e=0x0;_0x40e12e<_0x464ae6['length'];_0x40e12e++){if(_0x464ae6[_0x40e12e][_0x834e('0x5f')]){_0x590e52[_0x834e('0x87')](db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x464ae6[_0x40e12e][_0x834e('0x25')],'UserId':_0x464ae6[_0x40e12e]['id'],'queue_name':_0x4b16fa['name'],'VoiceQueueId':_0x4b16fa['id'],'interface':_[_0x834e('0x6a')](_0x464ae6[_0x40e12e]['interface'])?util['format'](_0x834e('0x6c'),_0x464ae6[_0x40e12e][_0x834e('0x25')]):_0x464ae6[_0x40e12e][_0x834e('0x60')],'paused':_0x464ae6[_0x40e12e]['voicePause']||![],'penalty':_0x586fa5[_0x834e('0x38')][_0x834e('0x62')]||0x0}));}}return BPromise[_0x834e('0x81')](_0x590e52);}})[_0x834e('0x18')](function(){return _0x1e0bc9;})[_0x834e('0x18')](respondWithResult(_0x1115b7,null))[_0x834e('0x2e')](handleError(_0x1115b7,null));};exports[_0x834e('0x84')]=function(_0x687dab,_0x125787){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x687dab['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x125787,null))[_0x834e('0x18')](function(_0x121d4f){if(_0x121d4f){return _0x121d4f[_0x834e('0x84')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])['then'](function(){if(_[_0x834e('0x88')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])){for(var _0x37dea1=0x0;_0x37dea1<_0x687dab[_0x834e('0x2c')][_0x834e('0x71')][_0x834e('0x36')];_0x37dea1+=0x1){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':Number(_0x687dab[_0x834e('0x2c')]['ids'][_0x37dea1]),'VoiceQueueId':Number(_0x687dab['params']['id'])});}}else{socket[_0x834e('0x6e')]('userVoiceQueue:remove',{'UserId':Number(_0x687dab[_0x834e('0x2c')][_0x834e('0x71')]),'VoiceQueueId':Number(_0x687dab[_0x834e('0x41')]['id'])});}});}})[_0x834e('0x18')](function(_0x1daa58){return db[_0x834e('0x69')]['destroy']({'where':{'VoiceQueueId':_0x687dab[_0x834e('0x41')]['id'],'UserId':_0x687dab['query']['ids']}})['then'](function(){return _0x1daa58;});})[_0x834e('0x18')](respondWithStatusCode(_0x125787,null))[_0x834e('0x2e')](handleError(_0x125787,null));};exports['getAgents']=function(_0x5cb379,_0x494e08){var _0x2515f6={};var _0x45c8e6={};var _0x3512d8;var _0x5e0bfe;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5cb379[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x494e08,null))[_0x834e('0x18')](function(_0x3c1a19){if(_0x3c1a19){_0x3512d8=_0x3c1a19;_0x45c8e6['model']=_['keys'](db['User']['rawAttributes']);_0x45c8e6[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5cb379[_0x834e('0x2c')]);_0x45c8e6[_0x834e('0x31')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],_0x45c8e6[_0x834e('0x2c')]);_0x2515f6[_0x834e('0x33')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x35')]));_0x2515f6[_0x834e('0x33')]=_0x2515f6[_0x834e('0x33')]['length']?_0x2515f6['attributes']:_0x45c8e6[_0x834e('0x32')];_0x2515f6[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5cb379['query'][_0x834e('0x4e')]);_0x2515f6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x5cb379[_0x834e('0x2c')],_0x45c8e6[_0x834e('0x31')]));if(_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]){_0x2515f6[_0x834e('0x51')]=_['merge'](_0x2515f6[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x2515f6[_0x834e('0x33')],function(_0x2f1de8){var _0x4b6834={};_0x4b6834[_0x2f1de8]={'$like':'%'+_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4b6834;})});}_0x2515f6=_[_0x834e('0x43')]({},_0x2515f6,_0x5cb379[_0x834e('0x44')]);return _0x3512d8[_0x834e('0x89')](_0x2515f6);}})[_0x834e('0x18')](function(_0x3f6ead){if(_0x3f6ead){_0x5e0bfe=_0x3f6ead[_0x834e('0x36')];if(!_0x5cb379[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x2515f6['limit']=qs[_0x834e('0x13')](_0x5cb379['query'][_0x834e('0x13')]);_0x2515f6[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x3512d8['getAgents'](_0x2515f6);}})[_0x834e('0x18')](function(_0x29f970){if(_0x29f970){return _0x29f970?{'count':_0x5e0bfe,'rows':_0x29f970}:null;}})['then'](respondWithResult(_0x494e08,null))['catch'](handleError(_0x494e08,null));};exports[_0x834e('0x8a')]=function(_0x4db3c5,_0x4e6a75){var _0x57a989={};var _0x26cb93={};var _0x39bd0c;var _0xbd9400;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x4db3c5[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x4e6a75,null))['then'](function(_0x28825c){if(_0x28825c){_0x39bd0c=_0x28825c;_0x26cb93[_0x834e('0x32')]=_['keys'](db['UserVoiceQueueRt'][_0x834e('0x27')]);_0x26cb93[_0x834e('0x2c')]=_['keys'](_0x4db3c5['query']);_0x26cb93[_0x834e('0x31')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],_0x26cb93['query']);_0x57a989[_0x834e('0x33')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],qs['fields'](_0x4db3c5[_0x834e('0x2c')]['fields']));_0x57a989[_0x834e('0x33')]=_0x57a989[_0x834e('0x33')][_0x834e('0x36')]?_0x57a989[_0x834e('0x33')]:_0x26cb93[_0x834e('0x32')];_0x57a989['order']=qs[_0x834e('0x4e')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x4e')]);_0x57a989[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x4db3c5['query'],_0x26cb93[_0x834e('0x31')]));if(_0x4db3c5[_0x834e('0x2c')][_0x834e('0x52')]){_0x57a989['where']=_[_0x834e('0x43')](_0x57a989[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x57a989[_0x834e('0x33')],function(_0x53faec){var _0x3cc563={};_0x3cc563[_0x53faec]={'$like':'%'+_0x4db3c5[_0x834e('0x2c')]['filter']+'%'};return _0x3cc563;})});}_0x57a989=_[_0x834e('0x43')]({},_0x57a989,_0x4db3c5[_0x834e('0x44')]);return _0x39bd0c[_0x834e('0x8a')](_0x57a989);}})[_0x834e('0x18')](function(_0x4b0246){if(_0x4b0246){_0xbd9400=_0x4b0246[_0x834e('0x36')];if(!_0x4db3c5['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x57a989[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x13')]);_0x57a989['offset']=qs['offset'](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x39bd0c['getMembers'](_0x57a989);}})[_0x834e('0x18')](function(_0x4af796){return _0x4af796?{'count':_0xbd9400,'rows':_0x4af796}:null;})[_0x834e('0x18')](respondWithResult(_0x4e6a75,null))[_0x834e('0x2e')](handleError(_0x4e6a75,null));};exports[_0x834e('0x8b')]=function(_0x151b58,_0x2ec7b0){var _0x1ca24b={};var _0x36836f={};var _0x56ae60;var _0x122b03;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x151b58[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2ec7b0,null))['then'](function(_0x167642){if(_0x167642){_0x56ae60=_0x167642;_0x36836f[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmList']['rawAttributes']);_0x36836f['query']=_[_0x834e('0x30')](_0x151b58[_0x834e('0x2c')]);_0x36836f[_0x834e('0x31')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],_0x36836f[_0x834e('0x2c')]);_0x1ca24b[_0x834e('0x33')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],qs[_0x834e('0x35')](_0x151b58[_0x834e('0x2c')]['fields']));_0x1ca24b[_0x834e('0x33')]=_0x1ca24b[_0x834e('0x33')][_0x834e('0x36')]?_0x1ca24b[_0x834e('0x33')]:_0x36836f[_0x834e('0x32')];_0x1ca24b[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x151b58[_0x834e('0x2c')]['sort']);_0x1ca24b[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x151b58[_0x834e('0x2c')],_0x36836f[_0x834e('0x31')]));if(_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]){_0x1ca24b['where']=_['merge'](_0x1ca24b[_0x834e('0x51')],{'$or':_['map'](_0x1ca24b[_0x834e('0x33')],function(_0x433cb4){var _0x18638d={};_0x18638d[_0x433cb4]={'$like':'%'+_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x18638d;})});}_0x1ca24b=_['merge']({},_0x1ca24b,_0x151b58[_0x834e('0x44')]);return _0x56ae60['getLists'](_0x1ca24b);}})['then'](function(_0x3d8b08){if(_0x3d8b08){_0x122b03=_0x3d8b08[_0x834e('0x36')];if(!_0x151b58[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1ca24b[_0x834e('0x13')]=qs['limit'](_0x151b58[_0x834e('0x2c')][_0x834e('0x13')]);_0x1ca24b['offset']=qs[_0x834e('0x12')](_0x151b58[_0x834e('0x2c')]['offset']);}return _0x56ae60[_0x834e('0x8b')](_0x1ca24b);}})[_0x834e('0x18')](function(_0x47a239){if(_0x47a239){return _0x47a239?{'count':_0x122b03,'rows':_0x47a239}:null;}})[_0x834e('0x18')](respondWithResult(_0x2ec7b0,null))[_0x834e('0x2e')](handleError(_0x2ec7b0,null));};exports[_0x834e('0x8c')]=function(_0x3b658a,_0x34a13d){var _0x29b8fd=moment()[_0x834e('0x6b')](_0x834e('0x8d'));var _0x208bbe,_0xe0b3;return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x3b658a[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x34a13d,null))[_0x834e('0x18')](function(_0x371767){if(_0x371767){_0xe0b3=_0x371767;return _0x371767[_0x834e('0x8c')](_0x3b658a[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x3b658a[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x5af6fc){var _0x2ddbc0;_0x208bbe=_0x5af6fc||[];var _0x1cd122=[];if(_0x5af6fc){for(var _0x49be08=0x0;_0x49be08<_0x5af6fc['length'];_0x49be08+=0x1){var _0x563f20=_0x5af6fc[_0x49be08][_0x834e('0x1a')]({'plain':!![]});_0xe0b3[_0x834e('0x8e')]=_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]?_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]:_0xe0b3[_0x834e('0x8e')];switch(_0xe0b3['dialCheckDuplicateType']){case'always':_0x2ddbc0=squel['insert']()['into'](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt','ContactId','ListId',_0x834e('0x50'),'createdAt','updatedAt'],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','updatedAt')['from']('cm_contacts')['where'](_0x834e('0x95'))[_0x834e('0x51')]('ListId\x20=\x20?',_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0x834e('0x75')](_0x834e('0x98'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]()))[_0x834e('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))['from'](_0x834e('0x8f'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;case _0x834e('0x9b'):_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt',_0x834e('0x9e'),'ListId',_0x834e('0x50'),'createdAt',_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')['field'](_0x563f20['CmListId'][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),_0x834e('0x50'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))['field']('\x27'+_0x29b8fd+'\x27','updatedAt')[_0x834e('0x75')](_0x834e('0x9f'))[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))[_0x834e('0x75')](_0x834e('0x8f'))[_0x834e('0x51')]('VoiceQueueId\x20=\x20?',_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;default:_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')](['phone','scheduledAt',_0x834e('0x9e'),'ListId','VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel['select']()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','scheduledAt')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))['from']('cm_contacts')[_0x834e('0x51')](_0x834e('0x95'))['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96')))[_0x834e('0x7b')]();}_0x1cd122[_0x834e('0x87')](db[_0x834e('0x63')]['query'](_0x2ddbc0));}return BPromise['all'](_0x1cd122);}})['then'](function(){var _0xbafedb=[];var _0x1d004f=squel[_0x834e('0x9c')]()['into']('cm_hopper_additional_phones')[_0x834e('0x90')]([_0x834e('0xa1'),_0x834e('0x91'),_0x834e('0xa2'),_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0xa3'))[_0x834e('0x73')](_0x834e('0xa4'))['field'](_0x834e('0xa5'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','createdAt')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))[_0x834e('0x75')](_0x834e('0xa6'),'ci')[_0x834e('0x77')](_0x834e('0x8f'),'h',_0x834e('0xa7'))[_0x834e('0x51')](_0x834e('0xa8'),_0x29b8fd)[_0x834e('0x51')](_0x834e('0xa9'),_0x834e('0xaa')))[_0x834e('0x7b')]();_0xbafedb[_0x834e('0x87')](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d004f));return BPromise[_0x834e('0x81')](_0xbafedb);})[_0x834e('0x18')](function(){return _0x208bbe;})[_0x834e('0x18')](respondWithResult(_0x34a13d,null))[_0x834e('0x2e')](handleError(_0x34a13d,null));};exports[_0x834e('0xab')]=function(_0x239efd,_0x2f7170){return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x239efd[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2f7170,null))[_0x834e('0x18')](function(_0x3fd7a3){if(_0x3fd7a3){return _0x3fd7a3[_0x834e('0xab')](_0x239efd[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x41d0a7){if(_0x41d0a7){return db[_0x834e('0x53')][_0x834e('0x19')]({'where':{'ListId':_0x239efd['query'][_0x834e('0x71')],'VoiceQueueId':_0x239efd[_0x834e('0x41')]['id']}})['then'](function(){return _0x41d0a7;});}})[_0x834e('0x18')](respondWithStatusCode(_0x2f7170,null))[_0x834e('0x2e')](handleError(_0x2f7170,null));};exports['getBlackLists']=function(_0x16a7a9,_0x18b8c7){var _0x576ece={};var _0x51c877={};var _0x54915f;var _0x32d06c;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x16a7a9[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x18b8c7,null))[_0x834e('0x18')](function(_0x132711){if(_0x132711){_0x54915f=_0x132711;_0x51c877[_0x834e('0x32')]=_['keys'](db[_0x834e('0xac')][_0x834e('0x27')]);_0x51c877[_0x834e('0x2c')]=_['keys'](_0x16a7a9[_0x834e('0x2c')]);_0x51c877[_0x834e('0x31')]=_['intersection'](_0x51c877[_0x834e('0x32')],_0x51c877[_0x834e('0x2c')]);_0x576ece['attributes']=_[_0x834e('0x34')](_0x51c877[_0x834e('0x32')],qs[_0x834e('0x35')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x35')]));_0x576ece['attributes']=_0x576ece['attributes'][_0x834e('0x36')]?_0x576ece[_0x834e('0x33')]:_0x51c877[_0x834e('0x32')];_0x576ece['order']=qs[_0x834e('0x4e')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x4e')]);_0x576ece[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x16a7a9['query'],_0x51c877[_0x834e('0x31')]));if(_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]){_0x576ece[_0x834e('0x51')]=_[_0x834e('0x43')](_0x576ece['where'],{'$or':_['map'](_0x576ece[_0x834e('0x33')],function(_0x5eca84){var _0xcb4fe4={};_0xcb4fe4[_0x5eca84]={'$like':'%'+_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0xcb4fe4;})});}_0x576ece=_[_0x834e('0x43')]({},_0x576ece,_0x16a7a9[_0x834e('0x44')]);return _0x54915f[_0x834e('0xad')](_0x576ece);}})[_0x834e('0x18')](function(_0x5b4718){if(_0x5b4718){_0x32d06c=_0x5b4718[_0x834e('0x36')];if(!_0x16a7a9[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x576ece[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x16a7a9['query'][_0x834e('0x13')]);_0x576ece['offset']=qs[_0x834e('0x12')](_0x16a7a9['query'][_0x834e('0x12')]);}return _0x54915f[_0x834e('0xad')](_0x576ece);}})['then'](function(_0x3757bf){if(_0x3757bf){return _0x3757bf?{'count':_0x32d06c,'rows':_0x3757bf}:null;}})['then'](respondWithResult(_0x18b8c7,null))[_0x834e('0x2e')](handleError(_0x18b8c7,null));};exports[_0x834e('0xae')]=function(_0x395b48,_0x5b4208){var _0x4c9b90;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x395b48[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x5b4208,null))[_0x834e('0x18')](function(_0x414ff2){if(_0x414ff2){return _0x414ff2[_0x834e('0xae')](_0x395b48[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x395b48[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x3aeca7){var _0x1d9e00;_0x4c9b90=_0x3aeca7||[];var _0x11db76=[];if(_0x3aeca7){for(var _0x37f058=0x0;_0x37f058<_0x3aeca7[_0x834e('0x36')];_0x37f058+=0x1){var _0x354497=_0x3aeca7[_0x37f058]['get']({'plain':!![]});_0x1d9e00=squel[_0x834e('0x9c')]()['into'](_0x834e('0xaf'))[_0x834e('0x90')]([_0x834e('0x91'),_0x834e('0x9e'),_0x834e('0x94'),'VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x354497[_0x834e('0x93')]['toString'](),'ListId')['field'](_0x395b48['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('NOW()',_0x834e('0x46'))[_0x834e('0x73')](_0x834e('0xb0'),'updatedAt')[_0x834e('0x75')]('cm_contacts')[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')[_0x834e('0x51')]('ListId\x20=\x20?',_0x354497[_0x834e('0x93')][_0x834e('0x7b')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x11db76['push'](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d9e00));}return BPromise['all'](_0x11db76);}})[_0x834e('0x18')](function(){return _0x4c9b90;})[_0x834e('0x18')](respondWithResult(_0x5b4208,null))[_0x834e('0x2e')](handleError(_0x5b4208,null));};exports['removeBlackLists']=function(_0x5cb260,_0x5b3fda){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x5cb260[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b3fda,null))[_0x834e('0x18')](function(_0x1e5e2a){if(_0x1e5e2a){return _0x1e5e2a[_0x834e('0xb1')](_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x549c2f){if(_0x549c2f){return db['CmHopperBlack'][_0x834e('0x19')]({'where':{'ListId':_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')],'VoiceQueueId':_0x5cb260[_0x834e('0x41')]['id']}})[_0x834e('0x18')](function(){return _0x549c2f;});}})[_0x834e('0x18')](respondWithStatusCode(_0x5b3fda,null))[_0x834e('0x2e')](handleError(_0x5b3fda,null));}; \ No newline at end of file +var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x457b74,_0xecd07a){var _0x38e079=function(_0x405da9){while(--_0x405da9){_0x457b74['push'](_0x457b74['shift']());}};_0x38e079(++_0xecd07a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 882e456..05f97f5 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 _0x1441=['emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x594a5c,_0x357420){var _0x28fe3a=function(_0x1dd39b){while(--_0x1dd39b){_0x594a5c['push'](_0x594a5c['shift']());}};_0x28fe3a(++_0x357420);}(_0x1441,0x193));var _0x1144=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x1441[_0x2389bc];return _0x170548;};'use strict';var EventEmitter=require(_0x1144('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1144('0x1'),'afterUpdate':_0x1144('0x2'),'afterDestroy':'remove'};function emitEvent(_0xb43b28){return function(_0x177b47,_0x3f33bc,_0x259481){VoiceQueueEvents['emit'](_0xb43b28+':'+_0x177b47['id'],_0x177b47);VoiceQueueEvents[_0x1144('0x3')](_0xb43b28,_0x177b47);_0x259481(null);};}for(var e in events){if(events[_0x1144('0x4')](e)){var event=events[e];VoiceQueue[_0x1144('0x5')](e,emitEvent(event));}}module[_0x1144('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xdd29=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1e8934,_0x2f41b3){var _0x4bb2c5=function(_0x4e4944){while(--_0x4e4944){_0x1e8934['push'](_0x1e8934['shift']());}};_0x4bb2c5(++_0x2f41b3);}(_0xdd29,0xd2));var _0x9dd2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd29[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x9dd2('0x0'))['db'][_0x9dd2('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9dd2('0x2')](0x0);var events={'afterCreate':_0x9dd2('0x3'),'afterUpdate':_0x9dd2('0x4'),'afterDestroy':_0x9dd2('0x5')};function emitEvent(_0x15d330){return function(_0x48215a,_0x55f1f4,_0x2eefb1){VoiceQueueEvents[_0x9dd2('0x6')](_0x15d330+':'+_0x48215a['id'],_0x48215a);VoiceQueueEvents[_0x9dd2('0x6')](_0x15d330,_0x48215a);_0x2eefb1(null);};}for(var e in events){if(events[_0x9dd2('0x7')](e)){var event=events[e];VoiceQueue[_0x9dd2('0x8')](e,emitEvent(event));}}module[_0x9dd2('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 65ad7fd..a17d353 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x26cd05,_0x1f7d74){var _0x3e13b9=function(_0x1af957){while(--_0x1af957){_0x26cd05['push'](_0x26cd05['shift']());}};_0x3e13b9(++_0x1f7d74);}(_0x008c,0x188));var _0xc008=function(_0x151ae3,_0x3a9195){_0x151ae3=_0x151ae3-0x0;var _0x564680=_0x008c[_0x151ae3];return _0x564680;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x3149a4,_0x3bb042){var _0x19cfe5=function(_0x3060a1){while(--_0x3060a1){_0x3149a4['push'](_0x3149a4['shift']());}};_0x19cfe5(++_0x3bb042);}(_0x34e8,0x12c));var _0x834e=function(_0x4f37c0,_0x511ea9){_0x4f37c0=_0x4f37c0-0x0;var _0x4ed011=_0x34e8[_0x4f37c0];return _0x4ed011;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 3675063..7b99acd 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 _0x10a5=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','options','raw','attributes','limit','include','map','model','debug','ShowVoiceQueue','find','where','util','bluebird'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x10a5,0x101));var _0x510a=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x10a5[_0x2cfb48];return _0xc4594f;};'use strict';var _=require('lodash');var util=require(_0x510a('0x0'));var moment=require('moment');var BPromise=require(_0x510a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x510a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x510a('0x3'));var logger=require(_0x510a('0x4'))(_0x510a('0x5'));var config=require(_0x510a('0x6'));var jayson=require(_0x510a('0x7'));var client=jayson['client'][_0x510a('0x8')]({'port':0x232a});config[_0x510a('0x9')]=_[_0x510a('0xa')](config['redis'],{'host':_0x510a('0xb'),'port':0x18eb});var socket=require(_0x510a('0xc'))(new Redis(config[_0x510a('0x9')]));require(_0x510a('0xd'))['register'](socket);function respondWithRpcPromise(_0x489267,_0x501f64,_0x5d9c61){return new BPromise(function(_0x46b19d,_0x41a14e){return client[_0x510a('0xe')](_0x489267,_0x5d9c61)[_0x510a('0xf')](function(_0xda63d4){logger[_0x510a('0x10')](_0x510a('0x11'),_0x501f64,_0x510a('0x12'));logger['debug'](_0x510a('0x13'),_0x501f64,_0x510a('0x12'),JSON[_0x510a('0x14')](_0xda63d4));if(_0xda63d4['error']){if(_0xda63d4[_0x510a('0x15')]['code']===0x1f4){logger['error'](_0x510a('0x11'),_0x501f64,_0xda63d4[_0x510a('0x15')][_0x510a('0x16')]);return _0x41a14e(_0xda63d4[_0x510a('0x15')][_0x510a('0x16')]);}logger[_0x510a('0x15')](_0x510a('0x11'),_0x501f64,_0xda63d4[_0x510a('0x15')][_0x510a('0x16')]);return _0x46b19d(_0xda63d4[_0x510a('0x15')]['message']);}else{logger['info'](_0x510a('0x11'),_0x501f64,_0x510a('0x12'));_0x46b19d(_0xda63d4[_0x510a('0x17')][_0x510a('0x16')]);}})[_0x510a('0x18')](function(_0x47fa8e){logger[_0x510a('0x15')](_0x510a('0x11'),_0x501f64,_0x47fa8e);_0x41a14e(_0x47fa8e);});});}exports[_0x510a('0x19')]=function(_0x2a0f7b){var _0x34ee25=this;return new Promise(function(_0x59fb58,_0x52b105){return db['VoiceQueue']['findAll']({'raw':_0x2a0f7b['options']?_0x2a0f7b[_0x510a('0x1a')][_0x510a('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a0f7b[_0x510a('0x1a')]?_0x2a0f7b[_0x510a('0x1a')]['where']||null:null,'attributes':_0x2a0f7b[_0x510a('0x1a')]?_0x2a0f7b[_0x510a('0x1a')][_0x510a('0x1c')]||null:null,'limit':_0x2a0f7b['options']?_0x2a0f7b['options'][_0x510a('0x1d')]||null:null,'include':_0x2a0f7b[_0x510a('0x1a')]?_0x2a0f7b[_0x510a('0x1a')][_0x510a('0x1e')]?_[_0x510a('0x1f')](_0x2a0f7b[_0x510a('0x1a')]['include'],function(_0x40a08f){return{'model':db[_0x40a08f[_0x510a('0x20')]],'as':_0x40a08f['as'],'attributes':_0x40a08f[_0x510a('0x1c')],'include':_0x40a08f[_0x510a('0x1e')]?_['map'](_0x40a08f[_0x510a('0x1e')],function(_0x20d04b){return{'model':db[_0x20d04b['model']],'as':_0x20d04b['as'],'attributes':_0x20d04b[_0x510a('0x1c')],'include':_0x20d04b[_0x510a('0x1e')]?_['map'](_0x20d04b[_0x510a('0x1e')],function(_0x5ba54e){return{'model':db[_0x5ba54e[_0x510a('0x20')]],'as':_0x5ba54e['as'],'attributes':_0x5ba54e[_0x510a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x510a('0xf')](function(_0x4af3be){logger[_0x510a('0x10')](_0x510a('0x19'),_0x2a0f7b);logger[_0x510a('0x21')]('GetVoiceQueue',_0x2a0f7b,JSON['stringify'](_0x4af3be));_0x59fb58(_0x4af3be);})[_0x510a('0x18')](function(_0x3e121c){logger['error'](_0x510a('0x19'),_0x3e121c[_0x510a('0x16')],_0x2a0f7b);_0x52b105(_0x34ee25[_0x510a('0x15')](0x1f4,_0x3e121c[_0x510a('0x16')]));});});};exports[_0x510a('0x22')]=function(_0x5d7392){var _0x5e0bde=this;return new Promise(function(_0x4c2920,_0x1bf602){return db['VoiceQueue'][_0x510a('0x23')]({'raw':_0x5d7392['options']?_0x5d7392['options'][_0x510a('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d7392[_0x510a('0x1a')]?_0x5d7392[_0x510a('0x1a')][_0x510a('0x24')]||null:null,'attributes':_0x5d7392[_0x510a('0x1a')]?_0x5d7392[_0x510a('0x1a')]['attributes']||null:null,'include':_0x5d7392[_0x510a('0x1a')]?_0x5d7392['options']['include']?_[_0x510a('0x1f')](_0x5d7392['options'][_0x510a('0x1e')],function(_0x45057a){return{'model':db[_0x45057a[_0x510a('0x20')]],'as':_0x45057a['as'],'attributes':_0x45057a[_0x510a('0x1c')],'include':_0x45057a[_0x510a('0x1e')]?_['map'](_0x45057a[_0x510a('0x1e')],function(_0x3a51ab){return{'model':db[_0x3a51ab[_0x510a('0x20')]],'as':_0x3a51ab['as'],'attributes':_0x3a51ab[_0x510a('0x1c')],'include':_0x3a51ab['include']?_[_0x510a('0x1f')](_0x3a51ab['include'],function(_0x19ba50){return{'model':db[_0x19ba50[_0x510a('0x20')]],'as':_0x19ba50['as'],'attributes':_0x19ba50[_0x510a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x510a('0xf')](function(_0x255e1d){logger[_0x510a('0x10')](_0x510a('0x22'),_0x5d7392);logger[_0x510a('0x21')](_0x510a('0x22'),_0x5d7392,JSON[_0x510a('0x14')](_0x255e1d));_0x4c2920(_0x255e1d);})['catch'](function(_0x1652d7){logger['error'](_0x510a('0x22'),_0x1652d7[_0x510a('0x16')],_0x5d7392);_0x1bf602(_0x5e0bde['error'](0x1f4,_0x1652d7[_0x510a('0x16')]));});});}; \ No newline at end of file +var _0x7009=['attributes','limit','map','include','model','stringify','find','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where'];(function(_0x16da4c,_0x3e97d2){var _0x190266=function(_0x225f93){while(--_0x225f93){_0x16da4c['push'](_0x16da4c['shift']());}};_0x190266(++_0x3e97d2);}(_0x7009,0x18e));var _0x9700=function(_0x2a912b,_0x1f4b9b){_0x2a912b=_0x2a912b-0x0;var _0x1d631c=_0x7009[_0x2a912b];return _0x1d631c;};'use strict';var _=require(_0x9700('0x0'));var util=require(_0x9700('0x1'));var moment=require('moment');var BPromise=require(_0x9700('0x2'));var rs=require(_0x9700('0x3'));var fs=require('fs');var Redis=require(_0x9700('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9700('0x5'));var logger=require(_0x9700('0x6'))(_0x9700('0x7'));var config=require(_0x9700('0x8'));var jayson=require(_0x9700('0x9'));var client=jayson['client'][_0x9700('0xa')]({'port':0x232a});config[_0x9700('0xb')]=_[_0x9700('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9700('0xd'))(new Redis(config[_0x9700('0xb')]));require('./voiceQueue.socket')[_0x9700('0xe')](socket);function respondWithRpcPromise(_0x542dc7,_0x5afc88,_0x1e6c8e){return new BPromise(function(_0x3d9ca6,_0x15f52e){return client['request'](_0x542dc7,_0x1e6c8e)[_0x9700('0xf')](function(_0x219409){logger[_0x9700('0x10')](_0x9700('0x11'),_0x5afc88,_0x9700('0x12'));logger[_0x9700('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5afc88,_0x9700('0x12'),JSON['stringify'](_0x219409));if(_0x219409[_0x9700('0x14')]){if(_0x219409[_0x9700('0x14')][_0x9700('0x15')]===0x1f4){logger[_0x9700('0x14')](_0x9700('0x11'),_0x5afc88,_0x219409[_0x9700('0x14')][_0x9700('0x16')]);return _0x15f52e(_0x219409[_0x9700('0x14')]['message']);}logger[_0x9700('0x14')](_0x9700('0x11'),_0x5afc88,_0x219409[_0x9700('0x14')][_0x9700('0x16')]);return _0x3d9ca6(_0x219409[_0x9700('0x14')][_0x9700('0x16')]);}else{logger['info'](_0x9700('0x11'),_0x5afc88,_0x9700('0x12'));_0x3d9ca6(_0x219409[_0x9700('0x17')][_0x9700('0x16')]);}})[_0x9700('0x18')](function(_0x3a54ab){logger[_0x9700('0x14')](_0x9700('0x11'),_0x5afc88,_0x3a54ab);_0x15f52e(_0x3a54ab);});});}exports[_0x9700('0x19')]=function(_0x3e019f){var _0x25a4e5=this;return new Promise(function(_0x5291ac,_0x3c829a){return db[_0x9700('0x1a')][_0x9700('0x1b')]({'raw':_0x3e019f[_0x9700('0x1c')]?_0x3e019f[_0x9700('0x1c')][_0x9700('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e019f[_0x9700('0x1c')]?_0x3e019f[_0x9700('0x1c')][_0x9700('0x1e')]||null:null,'attributes':_0x3e019f[_0x9700('0x1c')]?_0x3e019f['options'][_0x9700('0x1f')]||null:null,'limit':_0x3e019f['options']?_0x3e019f[_0x9700('0x1c')][_0x9700('0x20')]||null:null,'include':_0x3e019f[_0x9700('0x1c')]?_0x3e019f[_0x9700('0x1c')]['include']?_[_0x9700('0x21')](_0x3e019f['options'][_0x9700('0x22')],function(_0x59e09d){return{'model':db[_0x59e09d[_0x9700('0x23')]],'as':_0x59e09d['as'],'attributes':_0x59e09d[_0x9700('0x1f')],'include':_0x59e09d[_0x9700('0x22')]?_['map'](_0x59e09d[_0x9700('0x22')],function(_0x140aed){return{'model':db[_0x140aed['model']],'as':_0x140aed['as'],'attributes':_0x140aed[_0x9700('0x1f')],'include':_0x140aed[_0x9700('0x22')]?_[_0x9700('0x21')](_0x140aed[_0x9700('0x22')],function(_0x2dc67e){return{'model':db[_0x2dc67e[_0x9700('0x23')]],'as':_0x2dc67e['as'],'attributes':_0x2dc67e[_0x9700('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2331ea){logger['info']('GetVoiceQueue',_0x3e019f);logger[_0x9700('0x13')]('GetVoiceQueue',_0x3e019f,JSON[_0x9700('0x24')](_0x2331ea));_0x5291ac(_0x2331ea);})['catch'](function(_0x2de4dd){logger[_0x9700('0x14')](_0x9700('0x19'),_0x2de4dd['message'],_0x3e019f);_0x3c829a(_0x25a4e5[_0x9700('0x14')](0x1f4,_0x2de4dd[_0x9700('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x971c9f){var _0xd17339=this;return new Promise(function(_0x9a6c6f,_0x24297c){return db[_0x9700('0x1a')][_0x9700('0x25')]({'raw':_0x971c9f[_0x9700('0x1c')]?_0x971c9f[_0x9700('0x1c')][_0x9700('0x1d')]===undefined?!![]:![]:!![],'where':_0x971c9f[_0x9700('0x1c')]?_0x971c9f[_0x9700('0x1c')]['where']||null:null,'attributes':_0x971c9f[_0x9700('0x1c')]?_0x971c9f[_0x9700('0x1c')][_0x9700('0x1f')]||null:null,'include':_0x971c9f['options']?_0x971c9f[_0x9700('0x1c')]['include']?_[_0x9700('0x21')](_0x971c9f[_0x9700('0x1c')]['include'],function(_0x381683){return{'model':db[_0x381683['model']],'as':_0x381683['as'],'attributes':_0x381683[_0x9700('0x1f')],'include':_0x381683['include']?_['map'](_0x381683[_0x9700('0x22')],function(_0x2ae793){return{'model':db[_0x2ae793[_0x9700('0x23')]],'as':_0x2ae793['as'],'attributes':_0x2ae793['attributes'],'include':_0x2ae793[_0x9700('0x22')]?_[_0x9700('0x21')](_0x2ae793['include'],function(_0xfc61b6){return{'model':db[_0xfc61b6[_0x9700('0x23')]],'as':_0xfc61b6['as'],'attributes':_0xfc61b6[_0x9700('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9700('0xf')](function(_0x5712bd){logger[_0x9700('0x10')](_0x9700('0x26'),_0x971c9f);logger[_0x9700('0x13')](_0x9700('0x26'),_0x971c9f,JSON[_0x9700('0x24')](_0x5712bd));_0x9a6c6f(_0x5712bd);})[_0x9700('0x18')](function(_0x1848f2){logger[_0x9700('0x14')](_0x9700('0x26'),_0x1848f2[_0x9700('0x16')],_0x971c9f);_0x24297c(_0xd17339[_0x9700('0x14')](0x1f4,_0x1848f2[_0x9700('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 463e151..d91a2ac 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 _0xba24=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','length'];(function(_0x36da4a,_0x880fcc){var _0x550534=function(_0xfcf4ac){while(--_0xfcf4ac){_0x36da4a['push'](_0x36da4a['shift']());}};_0x550534(++_0x880fcc);}(_0xba24,0x17b));var _0x4ba2=function(_0x2b75e4,_0x34b47b){_0x2b75e4=_0x2b75e4-0x0;var _0x344627=_0xba24[_0x2b75e4];return _0x344627;};'use strict';var VoiceQueueEvents=require(_0x4ba2('0x0'));var events=[_0x4ba2('0x1'),_0x4ba2('0x2'),'update'];function createListener(_0x1bda6f,_0x550607){return function(_0x5edde6){_0x550607[_0x4ba2('0x3')](_0x1bda6f,_0x5edde6);};}function removeListener(_0x2ae1e9,_0x44ab6b){return function(){VoiceQueueEvents[_0x4ba2('0x4')](_0x2ae1e9,_0x44ab6b);};}exports['register']=function(_0x5ca804){for(var _0x5174eb=0x0,_0x2bee95=events[_0x4ba2('0x5')];_0x5174eb<_0x2bee95;_0x5174eb++){var _0x77a730=events[_0x5174eb];var _0x27c091=createListener(_0x4ba2('0x6')+_0x77a730,_0x5ca804);VoiceQueueEvents['on'](_0x77a730,_0x27c091);}}; \ No newline at end of file +var _0x4b43=['update','emit','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x3d8698,_0x129083){var _0x5c237d=function(_0x265804){while(--_0x265804){_0x3d8698['push'](_0x3d8698['shift']());}};_0x5c237d(++_0x129083);}(_0x4b43,0x13d));var _0x34b4=function(_0x5c6653,_0x427b1a){_0x5c6653=_0x5c6653-0x0;var _0xc4f00b=_0x4b43[_0x5c6653];return _0xc4f00b;};'use strict';var VoiceQueueEvents=require(_0x34b4('0x0'));var events=[_0x34b4('0x1'),_0x34b4('0x2'),_0x34b4('0x3')];function createListener(_0xaeee13,_0x38013f){return function(_0x5d82c1){_0x38013f[_0x34b4('0x4')](_0xaeee13,_0x5d82c1);};}function removeListener(_0x143e50,_0x2e7c33){return function(){VoiceQueueEvents['removeListener'](_0x143e50,_0x2e7c33);};}exports[_0x34b4('0x5')]=function(_0x5bdff7){for(var _0x578619=0x0,_0x24d87c=events[_0x34b4('0x6')];_0x578619<_0x24d87c;_0x578619++){var _0x5e0c8c=events[_0x578619];var _0x1a80c9=createListener(_0x34b4('0x7')+_0x5e0c8c,_0x5bdff7);VoiceQueueEvents['on'](_0x5e0c8c,_0x1a80c9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8584c42..7e84a19 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 _0x99fb=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','util','path','express'];(function(_0x1b4213,_0x1f2388){var _0x3bc68d=function(_0x2338e5){while(--_0x2338e5){_0x1b4213['push'](_0x1b4213['shift']());}};_0x3bc68d(++_0x1f2388);}(_0x99fb,0xc5));var _0xb99f=function(_0x2830c8,_0x4c9f6f){_0x2830c8=_0x2830c8-0x0;var _0xc372dc=_0x99fb[_0x2830c8];return _0xc372dc;};'use strict';var multer=require('multer');var util=require(_0xb99f('0x0'));var path=require(_0xb99f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb99f('0x2'));var router=express[_0xb99f('0x3')]();var fs_extra=require(_0xb99f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb99f('0x5'));var config=require(_0xb99f('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xb99f('0x7')]('/',auth[_0xb99f('0x8')](),controller['index']);router['get']('/describe',auth[_0xb99f('0x8')](),controller[_0xb99f('0x9')]);router['get'](_0xb99f('0xa'),auth[_0xb99f('0x8')](),controller[_0xb99f('0xb')]);router[_0xb99f('0x7')](_0xb99f('0xc'),auth['isAuthenticated'](),controller[_0xb99f('0xd')]);router[_0xb99f('0xe')]('/',auth['isAuthenticated'](),controller[_0xb99f('0xf')]);router[_0xb99f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb99f('0x11')]);router['delete'](_0xb99f('0xc'),auth[_0xb99f('0x8')](),controller[_0xb99f('0x12')]);module[_0xb99f('0x13')]=router; \ No newline at end of file +var _0xcf38=['isAuthenticated','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x1a137b,_0x250313){var _0x1cf871=function(_0x238b5d){while(--_0x238b5d){_0x1a137b['push'](_0x1a137b['shift']());}};_0x1cf871(++_0x250313);}(_0xcf38,0xd3));var _0x8cf3=function(_0x25e221,_0x3c16c7){_0x25e221=_0x25e221-0x0;var _0x84fb0a=_0xcf38[_0x25e221];return _0x84fb0a;};'use strict';var multer=require(_0x8cf3('0x0'));var util=require(_0x8cf3('0x1'));var path=require(_0x8cf3('0x2'));var timeout=require(_0x8cf3('0x3'));var express=require(_0x8cf3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8cf3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8cf3('0x6'));var controller=require(_0x8cf3('0x7'));router[_0x8cf3('0x8')]('/',auth[_0x8cf3('0x9')](),controller['index']);router[_0x8cf3('0x8')]('/describe',auth[_0x8cf3('0x9')](),controller['describe']);router[_0x8cf3('0x8')](_0x8cf3('0xa'),auth[_0x8cf3('0x9')](),controller[_0x8cf3('0xb')]);router[_0x8cf3('0x8')](_0x8cf3('0xc'),auth[_0x8cf3('0x9')](),controller[_0x8cf3('0xd')]);router[_0x8cf3('0xe')]('/',auth['isAuthenticated'](),controller[_0x8cf3('0xf')]);router[_0x8cf3('0x10')](_0x8cf3('0xc'),auth[_0x8cf3('0x9')](),controller[_0x8cf3('0x11')]);router['delete'](_0x8cf3('0xc'),auth['isAuthenticated'](),controller[_0x8cf3('0x12')]);module[_0x8cf3('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 497ca40..6202c46 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 _0x6e4b=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x15ac1b,_0x4a313e){var _0x158f91=function(_0x1e861e){while(--_0x1e861e){_0x15ac1b['push'](_0x15ac1b['shift']());}};_0x158f91(++_0x4a313e);}(_0x6e4b,0x195));var _0xb6e4=function(_0x5ae9fc,_0x18070c){_0x5ae9fc=_0x5ae9fc-0x0;var _0x292205=_0x6e4b[_0x5ae9fc];return _0x292205;};'use strict';var Sequelize=require(_0xb6e4('0x0'));var moment=require(_0xb6e4('0x1'));module[_0xb6e4('0x2')]={'type':{'type':Sequelize[_0xb6e4('0x3')]},'uniqueid':{'type':Sequelize[_0xb6e4('0x3')]},'calleridnum':{'type':Sequelize[_0xb6e4('0x3')]},'calleridname':{'type':Sequelize[_0xb6e4('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xb6e4('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xff556f){var _0x351c9d=moment(_0xff556f);var _0x4027e6=moment(this[_0xb6e4('0x5')](_0xb6e4('0x6')))[_0xb6e4('0x7')](_0xb6e4('0x8'));var _0x3b45b7=_0x351c9d[_0xb6e4('0x9')](_0x4027e6,_0xb6e4('0xa'));this[_0xb6e4('0xb')]('queuecallerleaveAt',_0xff556f);this[_0xb6e4('0xb')](_0xb6e4('0xc'),_0x3b45b7||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xb6e4('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xb6e4('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xb6e4('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb6e4('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xb6e4('0x3')],'comment':_0xb6e4('0xf')},'originalposition':{'type':Sequelize[_0xb6e4('0xd')]},'channel':{'type':Sequelize[_0xb6e4('0x3')]},'connectedlinenum':{'type':Sequelize[_0xb6e4('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb6e4('0x3')]},'exten':{'type':Sequelize[_0xb6e4('0x3')]},'priority':{'type':Sequelize[_0xb6e4('0x3')]},'holdtime':{'type':Sequelize[_0xb6e4('0xd')]},'mohtime':{'type':Sequelize[_0xb6e4('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb6e4('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb6e4('0x3')]},'transfer':{'type':Sequelize[_0xb6e4('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb6e4('0x3')],'comment':_0xb6e4('0x10')},'transferexten':{'type':Sequelize[_0xb6e4('0x3')]},'transferuniqueid':{'type':Sequelize[_0xb6e4('0x3')]},'disposition':{'type':Sequelize[_0xb6e4('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb6e4('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xb6e4('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x21bd=['INTEGER','BOOLEAN','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt'];(function(_0x41074e,_0x200750){var _0x5b3b1f=function(_0x180e95){while(--_0x180e95){_0x41074e['push'](_0x41074e['shift']());}};_0x5b3b1f(++_0x200750);}(_0x21bd,0x106));var _0xd21b=function(_0x3d1c10,_0x27e34f){_0x3d1c10=_0x3d1c10-0x0;var _0x3779ac=_0x21bd[_0x3d1c10];return _0x3779ac;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd21b('0x0'));module[_0xd21b('0x1')]={'type':{'type':Sequelize[_0xd21b('0x2')]},'uniqueid':{'type':Sequelize[_0xd21b('0x2')]},'calleridnum':{'type':Sequelize[_0xd21b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xd21b('0x3')],'set':function(_0x9191f){var _0x2e9159=moment(_0x9191f);var _0x5325b7=moment(this[_0xd21b('0x4')](_0xd21b('0x5')))[_0xd21b('0x6')](_0xd21b('0x7'));var _0x4cd889=_0x2e9159['diff'](_0x5325b7,_0xd21b('0x8'));this[_0xd21b('0x9')](_0xd21b('0xa'),_0x9191f);this[_0xd21b('0x9')]('holdtime',_0x4cd889||null);}},'position':{'type':Sequelize[_0xd21b('0xb')]},'count':{'type':Sequelize[_0xd21b('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xd21b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xd21b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd21b('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd21b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xd21b('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xd21b('0xb')]},'channel':{'type':Sequelize[_0xd21b('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd21b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd21b('0x2')]},'accountcode':{'type':Sequelize[_0xd21b('0x2')]},'context':{'type':Sequelize[_0xd21b('0x2')]},'exten':{'type':Sequelize[_0xd21b('0x2')]},'priority':{'type':Sequelize[_0xd21b('0x2')]},'holdtime':{'type':Sequelize[_0xd21b('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd21b('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd21b('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd21b('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd21b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xd21b('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0xd21b('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index a162b76..266747b 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 _0x13e0=['Content-Range','save','update','then','destroy','end','error','stack','name','send','index','VoiceQueueReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','length','options','find','catch','body','describe','getVoiceQueuesReport','hasOwnProperty','order','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x138144,_0x14a733){var _0x489bbd=function(_0x5324c1){while(--_0x5324c1){_0x138144['push'](_0x138144['shift']());}};_0x489bbd(++_0x14a733);}(_0x13e0,0x119));var _0x013e=function(_0x29b462,_0x1b741b){_0x29b462=_0x29b462-0x0;var _0x39b72f=_0x13e0[_0x29b462];return _0x39b72f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x013e('0x0'));var jsonpatch=require(_0x013e('0x1'));var rp=require(_0x013e('0x2'));var moment=require(_0x013e('0x3'));var BPromise=require(_0x013e('0x4'));var Mustache=require(_0x013e('0x5'));var util=require(_0x013e('0x6'));var path=require('path');var sox=require(_0x013e('0x7'));var csv=require(_0x013e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x013e('0x9'));var _=require(_0x013e('0xa'));var squel=require(_0x013e('0xb'));var crypto=require(_0x013e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x013e('0x8'));var querystring=require(_0x013e('0xd'));var Papa=require(_0x013e('0xe'));var Redis=require('ioredis');var authService=require(_0x013e('0xf'));var qs=require(_0x013e('0x10'));var as=require(_0x013e('0x11'));var hardwareService=require(_0x013e('0x12'));var logger=require('../../config/logger')(_0x013e('0x13'));var utils=require('../../config/utils');var config=require(_0x013e('0x14'));var licenseUtil=require(_0x013e('0x15'));var db=require(_0x013e('0x16'))['db'];config[_0x013e('0x17')]=_['defaults'](config['redis'],{'host':_0x013e('0x18'),'port':0x18eb});var socket=require(_0x013e('0x19'))(new Redis(config[_0x013e('0x17')]));require(_0x013e('0x1a'))[_0x013e('0x1b')](socket);function respondWithStatusCode(_0x50dc63,_0xb37706){_0xb37706=_0xb37706||0xcc;return function(_0x5da507){if(_0x5da507){return _0x50dc63[_0x013e('0x1c')](_0xb37706);}return _0x50dc63[_0x013e('0x1d')](_0xb37706)['end']();};}function respondWithResult(_0x5e74f0,_0x15dfef){_0x15dfef=_0x15dfef||0xc8;return function(_0x5b93f2){if(_0x5b93f2){return _0x5e74f0[_0x013e('0x1d')](_0x15dfef)[_0x013e('0x1e')](_0x5b93f2);}};}function respondWithFilteredResult(_0x32fcfc,_0x23a355){return function(_0x37ad73){if(_0x37ad73){var _0x4de73f=typeof _0x23a355[_0x013e('0x1f')]===_0x013e('0x20')&&typeof _0x23a355[_0x013e('0x21')]===_0x013e('0x20');var _0x18c4de=_0x37ad73[_0x013e('0x22')];var _0x40861c=_0x4de73f?0x0:_0x23a355['offset'];var _0x24a388=_0x4de73f?_0x37ad73[_0x013e('0x22')]:_0x23a355['offset']+_0x23a355[_0x013e('0x21')];var _0x48a677;if(_0x24a388>=_0x18c4de){_0x24a388=_0x18c4de;_0x48a677=0xc8;}else{_0x48a677=0xce;}_0x32fcfc[_0x013e('0x1d')](_0x48a677);return _0x32fcfc['set'](_0x013e('0x23'),_0x40861c+'-'+_0x24a388+'/'+_0x18c4de)[_0x013e('0x1e')](_0x37ad73);}return null;};}function patchUpdates(_0x106218){return function(_0x2f7889){try{jsonpatch['apply'](_0x2f7889,_0x106218,!![]);}catch(_0x55aba9){return BPromise['reject'](_0x55aba9);}return _0x2f7889[_0x013e('0x24')]();};}function saveUpdates(_0x4e69c2,_0x58b40d){return function(_0x4a1e32){if(_0x4a1e32){return _0x4a1e32[_0x013e('0x25')](_0x4e69c2)[_0x013e('0x26')](function(_0x7bb5da){return _0x7bb5da;});}return null;};}function removeEntity(_0x206885,_0x1689b3){return function(_0x3e89cb){if(_0x3e89cb){return _0x3e89cb[_0x013e('0x27')]()[_0x013e('0x26')](function(){_0x206885[_0x013e('0x1d')](0xcc)[_0x013e('0x28')]();});}};}function handleEntityNotFound(_0x5110ff,_0x593d22){return function(_0x590166){if(!_0x590166){_0x5110ff['sendStatus'](0x194);}return _0x590166;};}function handleError(_0xfbb811,_0x1357c3){_0x1357c3=_0x1357c3||0x1f4;return function(_0x5e869e){logger[_0x013e('0x29')](_0x5e869e[_0x013e('0x2a')]);if(_0x5e869e[_0x013e('0x2b')]){delete _0x5e869e[_0x013e('0x2b')];}_0xfbb811['status'](_0x1357c3)[_0x013e('0x2c')](_0x5e869e);};}exports[_0x013e('0x2d')]=function(_0x5cf110,_0x4a5de3){var _0x445454={},_0x37e74a={},_0x5ba59e={'count':0x0,'rows':[]};var _0x5a6903=_['map'](db[_0x013e('0x2e')][_0x013e('0x2f')],function(_0x3a1e83){return{'name':_0x3a1e83['fieldName'],'type':_0x3a1e83[_0x013e('0x30')][_0x013e('0x31')]};});_0x37e74a[_0x013e('0x32')]=_[_0x013e('0x33')](_0x5a6903,_0x013e('0x2b'));_0x37e74a['query']=_[_0x013e('0x34')](_0x5cf110[_0x013e('0x35')]);_0x37e74a[_0x013e('0x36')]=_[_0x013e('0x37')](_0x37e74a[_0x013e('0x32')],_0x37e74a[_0x013e('0x35')]);_0x445454[_0x013e('0x38')]=_[_0x013e('0x37')](_0x37e74a[_0x013e('0x32')],qs[_0x013e('0x39')](_0x5cf110[_0x013e('0x35')][_0x013e('0x39')]));_0x445454[_0x013e('0x38')]=_0x445454[_0x013e('0x38')]['length']?_0x445454['attributes']:_0x37e74a['model'];if(!_0x5cf110[_0x013e('0x35')]['hasOwnProperty'](_0x013e('0x3a'))){_0x445454['limit']=qs[_0x013e('0x21')](_0x5cf110['query'][_0x013e('0x21')]);_0x445454[_0x013e('0x1f')]=qs['offset'](_0x5cf110[_0x013e('0x35')][_0x013e('0x1f')]);}_0x445454['order']=qs[_0x013e('0x3b')](_0x5cf110[_0x013e('0x35')][_0x013e('0x3b')]);_0x445454[_0x013e('0x3c')]=qs['filters'](_['pick'](_0x5cf110['query'],_0x37e74a['filters']),_0x5a6903);if(_0x5cf110[_0x013e('0x35')]['filter']){_0x445454['where']=_[_0x013e('0x3d')](_0x445454[_0x013e('0x3c')],{'$or':_[_0x013e('0x33')](_0x5a6903,function(_0x17ebdb){if(_0x17ebdb['type']!==_0x013e('0x3e')){var _0x445d31={};_0x445d31[_0x17ebdb[_0x013e('0x2b')]]={'$like':'%'+_0x5cf110[_0x013e('0x35')][_0x013e('0x3f')]+'%'};return _0x445d31;}})});}_0x445454=_[_0x013e('0x3d')]({},_0x445454,_0x5cf110['options']);var _0x22e8dd={'where':_0x445454[_0x013e('0x3c')]};return db[_0x013e('0x2e')]['count'](_0x22e8dd)['then'](function(_0xfc0aed){_0x5ba59e[_0x013e('0x22')]=_0xfc0aed;if(_0x5cf110[_0x013e('0x35')][_0x013e('0x40')]){_0x445454[_0x013e('0x41')]=[{'all':!![]}];}return db[_0x013e('0x2e')][_0x013e('0x42')](_0x445454);})[_0x013e('0x26')](function(_0x251e03){_0x5ba59e[_0x013e('0x43')]=_0x251e03;return _0x5ba59e;})['then'](respondWithFilteredResult(_0x4a5de3,_0x445454))['catch'](handleError(_0x4a5de3,null));};exports[_0x013e('0x44')]=function(_0x5bf069,_0x310c63){var _0x55b7ed={'raw':![],'where':{'id':_0x5bf069[_0x013e('0x45')]['id']}},_0x1da086={};_0x1da086['model']=_[_0x013e('0x34')](db[_0x013e('0x2e')][_0x013e('0x2f')]);_0x1da086[_0x013e('0x35')]=_[_0x013e('0x34')](_0x5bf069['query']);_0x1da086[_0x013e('0x36')]=_[_0x013e('0x37')](_0x1da086[_0x013e('0x32')],_0x1da086[_0x013e('0x35')]);_0x55b7ed[_0x013e('0x38')]=_['intersection'](_0x1da086[_0x013e('0x32')],qs[_0x013e('0x39')](_0x5bf069[_0x013e('0x35')][_0x013e('0x39')]));_0x55b7ed[_0x013e('0x38')]=_0x55b7ed[_0x013e('0x38')][_0x013e('0x46')]?_0x55b7ed['attributes']:_0x1da086['model'];if(_0x5bf069[_0x013e('0x35')]['includeAll']){_0x55b7ed[_0x013e('0x41')]=[{'all':!![]}];}_0x55b7ed=_[_0x013e('0x3d')]({},_0x55b7ed,_0x5bf069[_0x013e('0x47')]);return db['VoiceQueueReport'][_0x013e('0x48')](_0x55b7ed)['then'](handleEntityNotFound(_0x310c63,null))['then'](respondWithResult(_0x310c63,null))[_0x013e('0x49')](handleError(_0x310c63,null));};exports['create']=function(_0x2b0385,_0x200c4a){return db[_0x013e('0x2e')]['create'](_0x2b0385['body'],{})[_0x013e('0x26')](respondWithResult(_0x200c4a,0xc9))[_0x013e('0x49')](handleError(_0x200c4a,null));};exports[_0x013e('0x25')]=function(_0x1eefdf,_0x24f4c5){if(_0x1eefdf[_0x013e('0x4a')]['id']){delete _0x1eefdf[_0x013e('0x4a')]['id'];}return db['VoiceQueueReport'][_0x013e('0x48')]({'where':{'id':_0x1eefdf['params']['id']}})[_0x013e('0x26')](handleEntityNotFound(_0x24f4c5,null))['then'](saveUpdates(_0x1eefdf[_0x013e('0x4a')],null))['then'](respondWithResult(_0x24f4c5,null))[_0x013e('0x49')](handleError(_0x24f4c5,null));};exports[_0x013e('0x27')]=function(_0x58579d,_0x23f062){return db['VoiceQueueReport'][_0x013e('0x48')]({'where':{'id':_0x58579d[_0x013e('0x45')]['id']}})['then'](handleEntityNotFound(_0x23f062,null))[_0x013e('0x26')](removeEntity(_0x23f062,null))[_0x013e('0x49')](handleError(_0x23f062,null));};exports['describe']=function(_0x2de74b,_0x2f3ab2){return db[_0x013e('0x2e')][_0x013e('0x4b')]()['then'](respondWithResult(_0x2f3ab2,null))[_0x013e('0x49')](handleError(_0x2f3ab2,null));};exports[_0x013e('0x4c')]=function(_0x3c1fe7,_0x408a7c){var _0x50cdb8={},_0xaf36dc={},_0x2d6a1b={'count':0x0,'rows':[]};_0xaf36dc[_0x013e('0x32')]=_[_0x013e('0x34')](db[_0x013e('0x2e')][_0x013e('0x2f')]);_0xaf36dc[_0x013e('0x35')]=_[_0x013e('0x34')](_0x3c1fe7[_0x013e('0x35')]);_0xaf36dc['filters']=_[_0x013e('0x37')](_0xaf36dc['model'],_0xaf36dc['query']);_0x50cdb8[_0x013e('0x38')]=_[_0x013e('0x37')](_0xaf36dc[_0x013e('0x32')],qs['fields'](_0x3c1fe7[_0x013e('0x35')][_0x013e('0x39')]));_0x50cdb8['attributes']=_0x50cdb8[_0x013e('0x38')][_0x013e('0x46')]?_0x50cdb8[_0x013e('0x38')]:_0xaf36dc['model'];if(!_0x3c1fe7[_0x013e('0x35')][_0x013e('0x4d')](_0x013e('0x3a'))){_0x50cdb8['limit']=qs[_0x013e('0x21')](_0x3c1fe7[_0x013e('0x35')][_0x013e('0x21')]);_0x50cdb8[_0x013e('0x1f')]=qs['offset'](_0x3c1fe7['query'][_0x013e('0x1f')]);}_0x50cdb8[_0x013e('0x4e')]=qs['sort'](_0x3c1fe7[_0x013e('0x35')]['sort']);_0x50cdb8['where']=qs[_0x013e('0x36')](_['pick'](_0x3c1fe7[_0x013e('0x35')],_0xaf36dc['filters']));if(_0x3c1fe7['query'][_0x013e('0x3f')]){_0x50cdb8['where']=_[_0x013e('0x3d')](_0x50cdb8['where'],{'$or':_[_0x013e('0x33')](_0x50cdb8['attributes'],function(_0x405ea7){var _0x1e9511={};_0x1e9511[_0x405ea7]={'$like':'%'+_0x3c1fe7[_0x013e('0x35')][_0x013e('0x3f')]+'%'};return _0x1e9511;})});}_0x50cdb8=_['merge']({},_0x50cdb8,_0x3c1fe7['options']);var _0x4b70d2={'where':_0x50cdb8[_0x013e('0x3c')]};return db[_0x013e('0x2e')][_0x013e('0x22')](_0x4b70d2)[_0x013e('0x26')](function(_0x112749){_0x2d6a1b[_0x013e('0x22')]=_0x112749;if(_0x3c1fe7[_0x013e('0x35')][_0x013e('0x40')]){_0x50cdb8[_0x013e('0x41')]=[{'all':!![]}];}return db[_0x013e('0x2e')][_0x013e('0x42')](_0x50cdb8);})[_0x013e('0x26')](function(_0xd916a2){_0x2d6a1b['rows']=_0xd916a2;return _0x2d6a1b;})['then'](respondWithFilteredResult(_0x408a7c,_0x50cdb8,'getVoiceQueuesReport'))[_0x013e('0x49')](handleError(_0x408a7c,null,_0x013e('0x4c')));}; \ No newline at end of file +var _0xa0ef=['api','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','VoiceQueueReport','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','describe','getVoiceQueuesReport','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4edf36,_0x499604){var _0xd08151=function(_0x116777){while(--_0x116777){_0x4edf36['push'](_0x4edf36['shift']());}};_0xd08151(++_0x499604);}(_0xa0ef,0x125));var _0xfa0e=function(_0x2dbfb5,_0x621e9a){_0x2dbfb5=_0x2dbfb5-0x0;var _0x3ae10a=_0xa0ef[_0x2dbfb5];return _0x3ae10a;};'use strict';var emlformat=require(_0xfa0e('0x0'));var rimraf=require(_0xfa0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa0e('0x2'));var rp=require(_0xfa0e('0x3'));var moment=require(_0xfa0e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfa0e('0x5'));var util=require(_0xfa0e('0x6'));var path=require(_0xfa0e('0x7'));var sox=require(_0xfa0e('0x8'));var csv=require(_0xfa0e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa0e('0xa'));var _=require(_0xfa0e('0xb'));var squel=require(_0xfa0e('0xc'));var crypto=require(_0xfa0e('0xd'));var jsforce=require(_0xfa0e('0xe'));var deskjs=require(_0xfa0e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfa0e('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfa0e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfa0e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa0e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfa0e('0x14'));var db=require(_0xfa0e('0x15'))['db'];config['redis']=_[_0xfa0e('0x16')](config[_0xfa0e('0x17')],{'host':_0xfa0e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa0e('0x17')]));require('./voiceQueueReport.socket')[_0xfa0e('0x19')](socket);function respondWithStatusCode(_0x13f483,_0x5f011b){_0x5f011b=_0x5f011b||0xcc;return function(_0x14bcb0){if(_0x14bcb0){return _0x13f483[_0xfa0e('0x1a')](_0x5f011b);}return _0x13f483['status'](_0x5f011b)['end']();};}function respondWithResult(_0x190f56,_0x425982){_0x425982=_0x425982||0xc8;return function(_0x4cb701){if(_0x4cb701){return _0x190f56[_0xfa0e('0x1b')](_0x425982)[_0xfa0e('0x1c')](_0x4cb701);}};}function respondWithFilteredResult(_0x203a81,_0x553161){return function(_0x55f5f3){if(_0x55f5f3){var _0x476def=typeof _0x553161[_0xfa0e('0x1d')]===_0xfa0e('0x1e')&&typeof _0x553161[_0xfa0e('0x1f')]===_0xfa0e('0x1e');var _0x18b7a4=_0x55f5f3[_0xfa0e('0x20')];var _0x6258f1=_0x476def?0x0:_0x553161['offset'];var _0x3387a6=_0x476def?_0x55f5f3[_0xfa0e('0x20')]:_0x553161[_0xfa0e('0x1d')]+_0x553161['limit'];var _0x32550a;if(_0x3387a6>=_0x18b7a4){_0x3387a6=_0x18b7a4;_0x32550a=0xc8;}else{_0x32550a=0xce;}_0x203a81['status'](_0x32550a);return _0x203a81['set'](_0xfa0e('0x21'),_0x6258f1+'-'+_0x3387a6+'/'+_0x18b7a4)[_0xfa0e('0x1c')](_0x55f5f3);}return null;};}function patchUpdates(_0x235880){return function(_0x43a923){try{jsonpatch['apply'](_0x43a923,_0x235880,!![]);}catch(_0x20c930){return BPromise[_0xfa0e('0x22')](_0x20c930);}return _0x43a923[_0xfa0e('0x23')]();};}function saveUpdates(_0x205b90,_0x461dd2){return function(_0x243ce8){if(_0x243ce8){return _0x243ce8[_0xfa0e('0x24')](_0x205b90)['then'](function(_0x1861af){return _0x1861af;});}return null;};}function removeEntity(_0x40aded,_0x2b2220){return function(_0x1330f1){if(_0x1330f1){return _0x1330f1['destroy']()[_0xfa0e('0x25')](function(){_0x40aded['status'](0xcc)[_0xfa0e('0x26')]();});}};}function handleEntityNotFound(_0x276992,_0x4cb79f){return function(_0x4d8f45){if(!_0x4d8f45){_0x276992[_0xfa0e('0x1a')](0x194);}return _0x4d8f45;};}function handleError(_0x4d1f3c,_0x38520a){_0x38520a=_0x38520a||0x1f4;return function(_0x26be9f){logger[_0xfa0e('0x27')](_0x26be9f[_0xfa0e('0x28')]);if(_0x26be9f['name']){delete _0x26be9f[_0xfa0e('0x29')];}_0x4d1f3c[_0xfa0e('0x1b')](_0x38520a)[_0xfa0e('0x2a')](_0x26be9f);};}exports[_0xfa0e('0x2b')]=function(_0x11abaa,_0x3c77f7){var _0xb4ac55={},_0x57f29c={},_0x3bbf73={'count':0x0,'rows':[]};var _0x469094=_[_0xfa0e('0x2c')](db[_0xfa0e('0x2d')]['rawAttributes'],function(_0x4cda2c){return{'name':_0x4cda2c['fieldName'],'type':_0x4cda2c[_0xfa0e('0x2e')][_0xfa0e('0x2f')]};});_0x57f29c[_0xfa0e('0x30')]=_[_0xfa0e('0x2c')](_0x469094,_0xfa0e('0x29'));_0x57f29c['query']=_[_0xfa0e('0x31')](_0x11abaa['query']);_0x57f29c[_0xfa0e('0x32')]=_[_0xfa0e('0x33')](_0x57f29c[_0xfa0e('0x30')],_0x57f29c[_0xfa0e('0x34')]);_0xb4ac55[_0xfa0e('0x35')]=_[_0xfa0e('0x33')](_0x57f29c[_0xfa0e('0x30')],qs[_0xfa0e('0x36')](_0x11abaa[_0xfa0e('0x34')]['fields']));_0xb4ac55[_0xfa0e('0x35')]=_0xb4ac55[_0xfa0e('0x35')][_0xfa0e('0x37')]?_0xb4ac55['attributes']:_0x57f29c[_0xfa0e('0x30')];if(!_0x11abaa[_0xfa0e('0x34')][_0xfa0e('0x38')](_0xfa0e('0x39'))){_0xb4ac55['limit']=qs['limit'](_0x11abaa['query'][_0xfa0e('0x1f')]);_0xb4ac55[_0xfa0e('0x1d')]=qs[_0xfa0e('0x1d')](_0x11abaa[_0xfa0e('0x34')][_0xfa0e('0x1d')]);}_0xb4ac55[_0xfa0e('0x3a')]=qs[_0xfa0e('0x3b')](_0x11abaa[_0xfa0e('0x34')][_0xfa0e('0x3b')]);_0xb4ac55[_0xfa0e('0x3c')]=qs[_0xfa0e('0x32')](_[_0xfa0e('0x3d')](_0x11abaa[_0xfa0e('0x34')],_0x57f29c[_0xfa0e('0x32')]),_0x469094);if(_0x11abaa[_0xfa0e('0x34')][_0xfa0e('0x3e')]){_0xb4ac55[_0xfa0e('0x3c')]=_[_0xfa0e('0x3f')](_0xb4ac55[_0xfa0e('0x3c')],{'$or':_[_0xfa0e('0x2c')](_0x469094,function(_0x21c456){if(_0x21c456[_0xfa0e('0x2e')]!=='VIRTUAL'){var _0x567124={};_0x567124[_0x21c456[_0xfa0e('0x29')]]={'$like':'%'+_0x11abaa[_0xfa0e('0x34')][_0xfa0e('0x3e')]+'%'};return _0x567124;}})});}_0xb4ac55=_['merge']({},_0xb4ac55,_0x11abaa[_0xfa0e('0x40')]);var _0x3cd9ec={'where':_0xb4ac55[_0xfa0e('0x3c')]};return db[_0xfa0e('0x2d')][_0xfa0e('0x20')](_0x3cd9ec)['then'](function(_0x52cdd5){_0x3bbf73[_0xfa0e('0x20')]=_0x52cdd5;if(_0x11abaa[_0xfa0e('0x34')][_0xfa0e('0x41')]){_0xb4ac55[_0xfa0e('0x42')]=[{'all':!![]}];}return db[_0xfa0e('0x2d')]['findAll'](_0xb4ac55);})[_0xfa0e('0x25')](function(_0x55d4f4){_0x3bbf73[_0xfa0e('0x43')]=_0x55d4f4;return _0x3bbf73;})[_0xfa0e('0x25')](respondWithFilteredResult(_0x3c77f7,_0xb4ac55))[_0xfa0e('0x44')](handleError(_0x3c77f7,null));};exports[_0xfa0e('0x45')]=function(_0x28455f,_0x32e4de){var _0x810c9={'raw':![],'where':{'id':_0x28455f[_0xfa0e('0x46')]['id']}},_0x1862b1={};_0x1862b1['model']=_['keys'](db[_0xfa0e('0x2d')][_0xfa0e('0x47')]);_0x1862b1[_0xfa0e('0x34')]=_[_0xfa0e('0x31')](_0x28455f['query']);_0x1862b1[_0xfa0e('0x32')]=_['intersection'](_0x1862b1['model'],_0x1862b1[_0xfa0e('0x34')]);_0x810c9[_0xfa0e('0x35')]=_['intersection'](_0x1862b1['model'],qs[_0xfa0e('0x36')](_0x28455f[_0xfa0e('0x34')]['fields']));_0x810c9['attributes']=_0x810c9[_0xfa0e('0x35')][_0xfa0e('0x37')]?_0x810c9[_0xfa0e('0x35')]:_0x1862b1[_0xfa0e('0x30')];if(_0x28455f['query'][_0xfa0e('0x41')]){_0x810c9[_0xfa0e('0x42')]=[{'all':!![]}];}_0x810c9=_['merge']({},_0x810c9,_0x28455f[_0xfa0e('0x40')]);return db['VoiceQueueReport']['find'](_0x810c9)[_0xfa0e('0x25')](handleEntityNotFound(_0x32e4de,null))[_0xfa0e('0x25')](respondWithResult(_0x32e4de,null))[_0xfa0e('0x44')](handleError(_0x32e4de,null));};exports[_0xfa0e('0x48')]=function(_0x3b6120,_0x173643){return db[_0xfa0e('0x2d')]['create'](_0x3b6120[_0xfa0e('0x49')],{})[_0xfa0e('0x25')](respondWithResult(_0x173643,0xc9))[_0xfa0e('0x44')](handleError(_0x173643,null));};exports[_0xfa0e('0x24')]=function(_0x1cfba0,_0x3f7d53){if(_0x1cfba0['body']['id']){delete _0x1cfba0[_0xfa0e('0x49')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x1cfba0[_0xfa0e('0x46')]['id']}})[_0xfa0e('0x25')](handleEntityNotFound(_0x3f7d53,null))[_0xfa0e('0x25')](saveUpdates(_0x1cfba0[_0xfa0e('0x49')],null))[_0xfa0e('0x25')](respondWithResult(_0x3f7d53,null))['catch'](handleError(_0x3f7d53,null));};exports['destroy']=function(_0x5bce3a,_0x215307){return db['VoiceQueueReport'][_0xfa0e('0x4a')]({'where':{'id':_0x5bce3a['params']['id']}})[_0xfa0e('0x25')](handleEntityNotFound(_0x215307,null))[_0xfa0e('0x25')](removeEntity(_0x215307,null))[_0xfa0e('0x44')](handleError(_0x215307,null));};exports['describe']=function(_0x1a635c,_0x14c376){return db[_0xfa0e('0x2d')][_0xfa0e('0x4b')]()[_0xfa0e('0x25')](respondWithResult(_0x14c376,null))[_0xfa0e('0x44')](handleError(_0x14c376,null));};exports[_0xfa0e('0x4c')]=function(_0x493515,_0x1ea443){var _0x2fbf5b={},_0x1d753b={},_0x30f830={'count':0x0,'rows':[]};_0x1d753b[_0xfa0e('0x30')]=_['keys'](db[_0xfa0e('0x2d')][_0xfa0e('0x47')]);_0x1d753b['query']=_[_0xfa0e('0x31')](_0x493515[_0xfa0e('0x34')]);_0x1d753b[_0xfa0e('0x32')]=_['intersection'](_0x1d753b[_0xfa0e('0x30')],_0x1d753b[_0xfa0e('0x34')]);_0x2fbf5b['attributes']=_['intersection'](_0x1d753b[_0xfa0e('0x30')],qs[_0xfa0e('0x36')](_0x493515[_0xfa0e('0x34')][_0xfa0e('0x36')]));_0x2fbf5b[_0xfa0e('0x35')]=_0x2fbf5b[_0xfa0e('0x35')][_0xfa0e('0x37')]?_0x2fbf5b['attributes']:_0x1d753b[_0xfa0e('0x30')];if(!_0x493515[_0xfa0e('0x34')]['hasOwnProperty']('nolimit')){_0x2fbf5b[_0xfa0e('0x1f')]=qs[_0xfa0e('0x1f')](_0x493515['query'][_0xfa0e('0x1f')]);_0x2fbf5b[_0xfa0e('0x1d')]=qs[_0xfa0e('0x1d')](_0x493515[_0xfa0e('0x34')][_0xfa0e('0x1d')]);}_0x2fbf5b[_0xfa0e('0x3a')]=qs['sort'](_0x493515['query'][_0xfa0e('0x3b')]);_0x2fbf5b[_0xfa0e('0x3c')]=qs['filters'](_[_0xfa0e('0x3d')](_0x493515['query'],_0x1d753b[_0xfa0e('0x32')]));if(_0x493515[_0xfa0e('0x34')]['filter']){_0x2fbf5b[_0xfa0e('0x3c')]=_[_0xfa0e('0x3f')](_0x2fbf5b[_0xfa0e('0x3c')],{'$or':_[_0xfa0e('0x2c')](_0x2fbf5b[_0xfa0e('0x35')],function(_0x1c5da9){var _0x3abece={};_0x3abece[_0x1c5da9]={'$like':'%'+_0x493515[_0xfa0e('0x34')]['filter']+'%'};return _0x3abece;})});}_0x2fbf5b=_[_0xfa0e('0x3f')]({},_0x2fbf5b,_0x493515[_0xfa0e('0x40')]);var _0x120b5f={'where':_0x2fbf5b[_0xfa0e('0x3c')]};return db[_0xfa0e('0x2d')][_0xfa0e('0x20')](_0x120b5f)['then'](function(_0xf64439){_0x30f830[_0xfa0e('0x20')]=_0xf64439;if(_0x493515[_0xfa0e('0x34')]['includeAll']){_0x2fbf5b['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xfa0e('0x4d')](_0x2fbf5b);})['then'](function(_0x4c206b){_0x30f830[_0xfa0e('0x43')]=_0x4c206b;return _0x30f830;})[_0xfa0e('0x25')](respondWithFilteredResult(_0x1ea443,_0x2fbf5b,'getVoiceQueuesReport'))[_0xfa0e('0x44')](handleError(_0x1ea443,null,_0xfa0e('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 55ed3fc..570be8e 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 _0xf66e=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf66e,0x15e));var _0xef66=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xf66e[_0x164eca];return _0x2ce562;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xef66('0x0'))['db'][_0xef66('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xef66('0x2')](0x0);var events={'afterCreate':_0xef66('0x3'),'afterUpdate':_0xef66('0x4'),'afterDestroy':_0xef66('0x5')};function emitEvent(_0x13159e){return function(_0x3a32b7,_0x53dc11,_0x27a87a){VoiceQueueReportEvents[_0xef66('0x6')](_0x13159e+':'+_0x3a32b7['id'],_0x3a32b7);VoiceQueueReportEvents[_0xef66('0x6')](_0x13159e,_0x3a32b7);_0x27a87a(null);};}for(var e in events){if(events[_0xef66('0x7')](e)){var event=events[e];VoiceQueueReport[_0xef66('0x8')](e,emitEvent(event));}}module[_0xef66('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x6eaa=['hasOwnProperty','hook','exports','events','save','update','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6eaa,0x1bb));var _0xa6ea=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0x6eaa[_0x3ab353];return _0x1e2285;};'use strict';var EventEmitter=require(_0xa6ea('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6ea('0x1'),'afterUpdate':_0xa6ea('0x2'),'afterDestroy':_0xa6ea('0x3')};function emitEvent(_0x1d1556){return function(_0x487016,_0x90501b,_0x414a94){VoiceQueueReportEvents[_0xa6ea('0x4')](_0x1d1556+':'+_0x487016['id'],_0x487016);VoiceQueueReportEvents['emit'](_0x1d1556,_0x487016);_0x414a94(null);};}for(var e in events){if(events[_0xa6ea('0x5')](e)){var event=events[e];VoiceQueueReport[_0xa6ea('0x6')](e,emitEvent(event));}}module[_0xa6ea('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 60bf56b..e8b0005 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 _0xe4b1=['../../config/logger','api','bluebird','path','rimraf','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','calleridnum','lodash','util'];(function(_0x5e0e55,_0x5a00bf){var _0x33b682=function(_0x436d7d){while(--_0x436d7d){_0x5e0e55['push'](_0x5e0e55['shift']());}};_0x33b682(++_0x5a00bf);}(_0xe4b1,0x17e));var _0x1e4b=function(_0x578c1f,_0x5c52fc){_0x578c1f=_0x578c1f-0x0;var _0x39bef2=_0xe4b1[_0x578c1f];return _0x39bef2;};'use strict';var _=require(_0x1e4b('0x0'));var util=require(_0x1e4b('0x1'));var logger=require(_0x1e4b('0x2'))(_0x1e4b('0x3'));var moment=require('moment');var BPromise=require(_0x1e4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e4b('0x5'));var rimraf=require(_0x1e4b('0x6'));var config=require('../../config/environment');var attributes=require(_0x1e4b('0x7'));module[_0x1e4b('0x8')]=function(_0x2f9aca,_0x55d6ca){return _0x2f9aca['define'](_0x1e4b('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x1e4b('0xa')]},{'fields':[_0x1e4b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1601=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0xd05f1f,_0x244be5){var _0x2ca242=function(_0x105129){while(--_0x105129){_0xd05f1f['push'](_0xd05f1f['shift']());}};_0x2ca242(++_0x244be5);}(_0x1601,0x1e3));var _0x1160=function(_0x26ed29,_0x2288f1){_0x26ed29=_0x26ed29-0x0;var _0x26182c=_0x1601[_0x26ed29];return _0x26182c;};'use strict';var _=require(_0x1160('0x0'));var util=require(_0x1160('0x1'));var logger=require(_0x1160('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1160('0x3'));var rp=require(_0x1160('0x4'));var fs=require('fs');var path=require(_0x1160('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1160('0x6'));module[_0x1160('0x7')]=function(_0x2f8d0d,_0x105f5f){return _0x2f8d0d[_0x1160('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x1160('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1160('0xa')]},{'fields':[_0x1160('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c97d5b9..69583fe 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 _0xd7a6=['limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','VoiceQueueReport','findAll','options','raw','include','map','model','attributes','then','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where'];(function(_0x315d84,_0x3dacc3){var _0x560da1=function(_0x22ccb0){while(--_0x22ccb0){_0x315d84['push'](_0x315d84['shift']());}};_0x560da1(++_0x3dacc3);}(_0xd7a6,0xad));var _0x6d7a=function(_0x4a21fd,_0x557e5c){_0x4a21fd=_0x4a21fd-0x0;var _0x10afff=_0xd7a6[_0x4a21fd];return _0x10afff;};'use strict';var _=require(_0x6d7a('0x0'));var util=require(_0x6d7a('0x1'));var moment=require(_0x6d7a('0x2'));var BPromise=require(_0x6d7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d7a('0x4'))['db'];var utils=require(_0x6d7a('0x5'));var logger=require(_0x6d7a('0x6'))(_0x6d7a('0x7'));var config=require(_0x6d7a('0x8'));var jayson=require(_0x6d7a('0x9'));var client=jayson['client'][_0x6d7a('0xa')]({'port':0x232a});config[_0x6d7a('0xb')]=_['defaults'](config[_0x6d7a('0xb')],{'host':_0x6d7a('0xc'),'port':0x18eb});var socket=require(_0x6d7a('0xd'))(new Redis(config[_0x6d7a('0xb')]));require(_0x6d7a('0xe'))['register'](socket);function respondWithRpcPromise(_0x22bab6,_0x21e21c,_0x3c5637){return new BPromise(function(_0x5ac99c,_0x1131ff){return client['request'](_0x22bab6,_0x3c5637)['then'](function(_0x2bc5f6){logger[_0x6d7a('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x21e21c,_0x6d7a('0x10'));logger[_0x6d7a('0x11')](_0x6d7a('0x12'),_0x21e21c,_0x6d7a('0x10'),JSON[_0x6d7a('0x13')](_0x2bc5f6));if(_0x2bc5f6[_0x6d7a('0x14')]){if(_0x2bc5f6[_0x6d7a('0x14')][_0x6d7a('0x15')]===0x1f4){logger[_0x6d7a('0x14')](_0x6d7a('0x16'),_0x21e21c,_0x2bc5f6['error'][_0x6d7a('0x17')]);return _0x1131ff(_0x2bc5f6[_0x6d7a('0x14')][_0x6d7a('0x17')]);}logger[_0x6d7a('0x14')](_0x6d7a('0x16'),_0x21e21c,_0x2bc5f6[_0x6d7a('0x14')][_0x6d7a('0x17')]);return _0x5ac99c(_0x2bc5f6[_0x6d7a('0x14')]['message']);}else{logger[_0x6d7a('0xf')](_0x6d7a('0x16'),_0x21e21c,_0x6d7a('0x10'));_0x5ac99c(_0x2bc5f6[_0x6d7a('0x18')][_0x6d7a('0x17')]);}})['catch'](function(_0x35ef17){logger[_0x6d7a('0x14')](_0x6d7a('0x16'),_0x21e21c,_0x35ef17);_0x1131ff(_0x35ef17);});});}exports['GetVoiceQueueReport']=function(_0x5adf18){var _0xa55478=this;return new Promise(function(_0x324489,_0x4ed191){return db[_0x6d7a('0x19')][_0x6d7a('0x1a')]({'raw':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18[_0x6d7a('0x1b')][_0x6d7a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18['options']['where']||null:null,'attributes':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18[_0x6d7a('0x1b')]['attributes']||null:null,'limit':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18[_0x6d7a('0x1b')]['limit']||null:null,'include':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18[_0x6d7a('0x1b')][_0x6d7a('0x1d')]?_[_0x6d7a('0x1e')](_0x5adf18[_0x6d7a('0x1b')][_0x6d7a('0x1d')],function(_0x2b9860){return{'model':db[_0x2b9860[_0x6d7a('0x1f')]],'as':_0x2b9860['as'],'attributes':_0x2b9860[_0x6d7a('0x20')],'include':_0x2b9860[_0x6d7a('0x1d')]?_[_0x6d7a('0x1e')](_0x2b9860['include'],function(_0x46fa24){return{'model':db[_0x46fa24[_0x6d7a('0x1f')]],'as':_0x46fa24['as'],'attributes':_0x46fa24[_0x6d7a('0x20')],'include':_0x46fa24['include']?_[_0x6d7a('0x1e')](_0x46fa24[_0x6d7a('0x1d')],function(_0x3bb720){return{'model':db[_0x3bb720['model']],'as':_0x3bb720['as'],'attributes':_0x3bb720[_0x6d7a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6d7a('0x21')](function(_0x16c61e){logger['info'](_0x6d7a('0x22'),_0x5adf18);logger[_0x6d7a('0x11')]('GetVoiceQueueReport',_0x5adf18,JSON[_0x6d7a('0x13')](_0x16c61e));_0x324489(_0x16c61e);})[_0x6d7a('0x23')](function(_0x260256){logger[_0x6d7a('0x14')](_0x6d7a('0x22'),_0x260256['message'],_0x5adf18);_0x4ed191(_0xa55478[_0x6d7a('0x14')](0x1f4,_0x260256['message']));});});};exports[_0x6d7a('0x24')]=function(_0x3e554a){var _0x2bfa62=this;return new Promise(function(_0x1ac8c9,_0x1aa2f3){return db[_0x6d7a('0x19')][_0x6d7a('0x25')](_0x3e554a[_0x6d7a('0x26')],{'raw':_0x3e554a[_0x6d7a('0x1b')]?_0x3e554a[_0x6d7a('0x1b')][_0x6d7a('0x1c')]===undefined?!![]:![]:!![]})[_0x6d7a('0x21')](function(_0x43a89e){logger[_0x6d7a('0xf')](_0x6d7a('0x24'),_0x3e554a);logger[_0x6d7a('0x11')](_0x6d7a('0x24'),_0x3e554a,JSON['stringify'](_0x43a89e));_0x1ac8c9(_0x43a89e);})[_0x6d7a('0x23')](function(_0xfe5a39){logger[_0x6d7a('0x14')](_0x6d7a('0x24'),_0xfe5a39[_0x6d7a('0x17')],_0x3e554a);_0x1aa2f3(_0x2bfa62['error'](0x1f4,_0xfe5a39[_0x6d7a('0x17')]));});});};exports[_0x6d7a('0x27')]=function(_0x54b6ff){var _0x8dea9a=this;return new Promise(function(_0xde7bcd,_0xea5b02){return db['VoiceQueueReport'][_0x6d7a('0x28')](_0x54b6ff[_0x6d7a('0x26')],{'raw':_0x54b6ff[_0x6d7a('0x1b')]?_0x54b6ff['options'][_0x6d7a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54b6ff[_0x6d7a('0x1b')]?_0x54b6ff['options'][_0x6d7a('0x29')]||null:null,'attributes':_0x54b6ff[_0x6d7a('0x1b')]?_0x54b6ff['options'][_0x6d7a('0x20')]||null:null,'limit':_0x54b6ff[_0x6d7a('0x1b')]?_0x54b6ff['options'][_0x6d7a('0x2a')]||null:null})['then'](function(_0x2819d0){logger[_0x6d7a('0xf')](_0x6d7a('0x27'),_0x54b6ff);logger[_0x6d7a('0x11')]('UpdateVoiceQueueReport',_0x54b6ff,JSON['stringify'](_0x2819d0));_0xde7bcd(_0x2819d0);})[_0x6d7a('0x23')](function(_0x1fcd3e){logger['error']('UpdateVoiceQueueReport',_0x1fcd3e[_0x6d7a('0x17')],_0x54b6ff);_0xea5b02(_0x8dea9a[_0x6d7a('0x14')](0x1f4,_0x1fcd3e[_0x6d7a('0x17')]));});});}; \ No newline at end of file +var _0xa972=['limit','map','model','include','attributes','then','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueueReport','options','where'];(function(_0x64ba97,_0x2662d2){var _0x2d655b=function(_0x26719a){while(--_0x26719a){_0x64ba97['push'](_0x64ba97['shift']());}};_0x2d655b(++_0x2662d2);}(_0xa972,0x88));var _0x2a97=function(_0x5276c1,_0x971d74){_0x5276c1=_0x5276c1-0x0;var _0x3b6133=_0xa972[_0x5276c1];return _0x3b6133;};'use strict';var _=require(_0x2a97('0x0'));var util=require(_0x2a97('0x1'));var moment=require('moment');var BPromise=require(_0x2a97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a97('0x3'))['db'];var utils=require(_0x2a97('0x4'));var logger=require(_0x2a97('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2a97('0x6'));var client=jayson[_0x2a97('0x7')][_0x2a97('0x8')]({'port':0x232a});config[_0x2a97('0x9')]=_[_0x2a97('0xa')](config[_0x2a97('0x9')],{'host':_0x2a97('0xb'),'port':0x18eb});var socket=require(_0x2a97('0xc'))(new Redis(config[_0x2a97('0x9')]));require(_0x2a97('0xd'))[_0x2a97('0xe')](socket);function respondWithRpcPromise(_0x5a7548,_0x548c01,_0x3b1cda){return new BPromise(function(_0xdd34b,_0x37035b){return client['request'](_0x5a7548,_0x3b1cda)['then'](function(_0xd662c4){logger[_0x2a97('0xf')](_0x2a97('0x10'),_0x548c01,_0x2a97('0x11'));logger[_0x2a97('0x12')](_0x2a97('0x13'),_0x548c01,'request\x20sent',JSON[_0x2a97('0x14')](_0xd662c4));if(_0xd662c4[_0x2a97('0x15')]){if(_0xd662c4['error'][_0x2a97('0x16')]===0x1f4){logger['error'](_0x2a97('0x10'),_0x548c01,_0xd662c4[_0x2a97('0x15')][_0x2a97('0x17')]);return _0x37035b(_0xd662c4[_0x2a97('0x15')]['message']);}logger[_0x2a97('0x15')](_0x2a97('0x10'),_0x548c01,_0xd662c4['error']['message']);return _0xdd34b(_0xd662c4[_0x2a97('0x15')][_0x2a97('0x17')]);}else{logger[_0x2a97('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x548c01,_0x2a97('0x11'));_0xdd34b(_0xd662c4['result'][_0x2a97('0x17')]);}})[_0x2a97('0x18')](function(_0x412b45){logger[_0x2a97('0x15')](_0x2a97('0x10'),_0x548c01,_0x412b45);_0x37035b(_0x412b45);});});}exports['GetVoiceQueueReport']=function(_0x2992b6){var _0x5d9b34=this;return new Promise(function(_0x245f6b,_0x52143b){return db[_0x2a97('0x19')]['findAll']({'raw':_0x2992b6[_0x2a97('0x1a')]?_0x2992b6[_0x2a97('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2992b6[_0x2a97('0x1a')]?_0x2992b6[_0x2a97('0x1a')][_0x2a97('0x1b')]||null:null,'attributes':_0x2992b6['options']?_0x2992b6[_0x2a97('0x1a')]['attributes']||null:null,'limit':_0x2992b6['options']?_0x2992b6[_0x2a97('0x1a')][_0x2a97('0x1c')]||null:null,'include':_0x2992b6[_0x2a97('0x1a')]?_0x2992b6['options']['include']?_[_0x2a97('0x1d')](_0x2992b6[_0x2a97('0x1a')]['include'],function(_0x215d5f){return{'model':db[_0x215d5f[_0x2a97('0x1e')]],'as':_0x215d5f['as'],'attributes':_0x215d5f['attributes'],'include':_0x215d5f[_0x2a97('0x1f')]?_[_0x2a97('0x1d')](_0x215d5f[_0x2a97('0x1f')],function(_0x2c08f4){return{'model':db[_0x2c08f4[_0x2a97('0x1e')]],'as':_0x2c08f4['as'],'attributes':_0x2c08f4[_0x2a97('0x20')],'include':_0x2c08f4[_0x2a97('0x1f')]?_['map'](_0x2c08f4['include'],function(_0x5b6d8c){return{'model':db[_0x5b6d8c[_0x2a97('0x1e')]],'as':_0x5b6d8c['as'],'attributes':_0x5b6d8c[_0x2a97('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2a97('0x21')](function(_0x207509){logger[_0x2a97('0xf')](_0x2a97('0x22'),_0x2992b6);logger[_0x2a97('0x12')](_0x2a97('0x22'),_0x2992b6,JSON[_0x2a97('0x14')](_0x207509));_0x245f6b(_0x207509);})['catch'](function(_0x21fac1){logger[_0x2a97('0x15')]('GetVoiceQueueReport',_0x21fac1['message'],_0x2992b6);_0x52143b(_0x5d9b34[_0x2a97('0x15')](0x1f4,_0x21fac1[_0x2a97('0x17')]));});});};exports[_0x2a97('0x23')]=function(_0x5197dc){var _0xc85711=this;return new Promise(function(_0x2b2d7f,_0x152ba9){return db[_0x2a97('0x19')][_0x2a97('0x24')](_0x5197dc[_0x2a97('0x25')],{'raw':_0x5197dc[_0x2a97('0x1a')]?_0x5197dc['options']['raw']===undefined?!![]:![]:!![]})[_0x2a97('0x21')](function(_0x2d019e){logger[_0x2a97('0xf')]('CreateVoiceQueueReport',_0x5197dc);logger[_0x2a97('0x12')](_0x2a97('0x23'),_0x5197dc,JSON[_0x2a97('0x14')](_0x2d019e));_0x2b2d7f(_0x2d019e);})[_0x2a97('0x18')](function(_0x26831d){logger[_0x2a97('0x15')](_0x2a97('0x23'),_0x26831d[_0x2a97('0x17')],_0x5197dc);_0x152ba9(_0xc85711[_0x2a97('0x15')](0x1f4,_0x26831d[_0x2a97('0x17')]));});});};exports[_0x2a97('0x26')]=function(_0x24ef82){var _0x4d27c6=this;return new Promise(function(_0x583149,_0x65dc13){return db[_0x2a97('0x19')][_0x2a97('0x27')](_0x24ef82['body'],{'raw':_0x24ef82[_0x2a97('0x1a')]?_0x24ef82[_0x2a97('0x1a')][_0x2a97('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24ef82[_0x2a97('0x1a')]?_0x24ef82[_0x2a97('0x1a')][_0x2a97('0x1b')]||null:null,'attributes':_0x24ef82[_0x2a97('0x1a')]?_0x24ef82['options']['attributes']||null:null,'limit':_0x24ef82[_0x2a97('0x1a')]?_0x24ef82[_0x2a97('0x1a')]['limit']||null:null})[_0x2a97('0x21')](function(_0x38ee7b){logger[_0x2a97('0xf')](_0x2a97('0x26'),_0x24ef82);logger[_0x2a97('0x12')](_0x2a97('0x26'),_0x24ef82,JSON[_0x2a97('0x14')](_0x38ee7b));_0x583149(_0x38ee7b);})[_0x2a97('0x18')](function(_0x307687){logger[_0x2a97('0x15')]('UpdateVoiceQueueReport',_0x307687['message'],_0x24ef82);_0x65dc13(_0x4d27c6['error'](0x1f4,_0x307687[_0x2a97('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 66dba2d..489e888 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 _0x7b4c=['voiceQueueReport:','save','remove','emit','register'];(function(_0x155096,_0x1c63c3){var _0x266965=function(_0x6a070f){while(--_0x6a070f){_0x155096['push'](_0x155096['shift']());}};_0x266965(++_0x1c63c3);}(_0x7b4c,0x1dc));var _0xc7b4=function(_0x36071b,_0x32d0cc){_0x36071b=_0x36071b-0x0;var _0x3ae7eb=_0x7b4c[_0x36071b];return _0x3ae7eb;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xc7b4('0x0'),_0xc7b4('0x1'),'update'];function createListener(_0x41fed5,_0x1748aa){return function(_0x18f913){_0x1748aa[_0xc7b4('0x2')](_0x41fed5,_0x18f913);};}function removeListener(_0x2aecfb,_0x29799e){return function(){VoiceQueueReportEvents['removeListener'](_0x2aecfb,_0x29799e);};}exports[_0xc7b4('0x3')]=function(_0x2ba472){for(var _0x28daa6=0x0,_0x3283fd=events['length'];_0x28daa6<_0x3283fd;_0x28daa6++){var _0x22be2f=events[_0x28daa6];var _0x5b498c=createListener(_0xc7b4('0x4')+_0x22be2f,_0x2ba472);VoiceQueueReportEvents['on'](_0x22be2f,_0x5b498c);}}; \ No newline at end of file +var _0x207c=['length','voiceQueueReport:','save','remove','update','emit'];(function(_0x2d7580,_0xa895a5){var _0x508b36=function(_0x444583){while(--_0x444583){_0x2d7580['push'](_0x2d7580['shift']());}};_0x508b36(++_0xa895a5);}(_0x207c,0x1e8));var _0xc207=function(_0xaf8f29,_0x5754cf){_0xaf8f29=_0xaf8f29-0x0;var _0x391fed=_0x207c[_0xaf8f29];return _0x391fed;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xc207('0x0'),_0xc207('0x1'),_0xc207('0x2')];function createListener(_0xaaba3d,_0x2b40be){return function(_0x12f1f2){_0x2b40be[_0xc207('0x3')](_0xaaba3d,_0x12f1f2);};}function removeListener(_0x4b9daa,_0x38ff02){return function(){VoiceQueueReportEvents['removeListener'](_0x4b9daa,_0x38ff02);};}exports['register']=function(_0x55023e){for(var _0xc88789=0x0,_0x314561=events[_0xc207('0x4')];_0xc88789<_0x314561;_0xc88789++){var _0x59ff6f=events[_0xc88789];var _0x25cb97=createListener(_0xc207('0x5')+_0x59ff6f,_0x55023e);VoiceQueueReportEvents['on'](_0x59ff6f,_0x25cb97);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d6b0ed5..e25c4a3 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 _0x4bfd=['exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x509e2f,_0x40be7b){var _0x36a911=function(_0x564c0c){while(--_0x564c0c){_0x509e2f['push'](_0x509e2f['shift']());}};_0x36a911(++_0x40be7b);}(_0x4bfd,0x153));var _0xd4bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4bfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd4bf('0x0'));var util=require('util');var path=require(_0xd4bf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd4bf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd4bf('0x3'));var interaction=require(_0xd4bf('0x4'));var config=require('../../config/environment');var controller=require(_0xd4bf('0x5'));router[_0xd4bf('0x6')]('/',auth[_0xd4bf('0x7')](),controller[_0xd4bf('0x8')]);router[_0xd4bf('0x6')](_0xd4bf('0x9'),auth[_0xd4bf('0x7')](),controller['show']);router[_0xd4bf('0xa')]('/',auth[_0xd4bf('0x7')](),controller[_0xd4bf('0xb')]);router['put'](_0xd4bf('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd4bf('0x9'),auth[_0xd4bf('0x7')](),controller['destroy']);module[_0xd4bf('0xc')]=router; \ No newline at end of file +var _0x6ac8=['../../config/environment','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra'];(function(_0x25d884,_0x230bf5){var _0x59cda0=function(_0x5c691a){while(--_0x5c691a){_0x25d884['push'](_0x25d884['shift']());}};_0x59cda0(++_0x230bf5);}(_0x6ac8,0x83));var _0x86ac=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x6ac8[_0x138f59];return _0x3d114d;};'use strict';var multer=require('multer');var util=require(_0x86ac('0x0'));var path=require('path');var timeout=require(_0x86ac('0x1'));var express=require('express');var router=express[_0x86ac('0x2')]();var fs_extra=require(_0x86ac('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x86ac('0x4'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x86ac('0x5')](),controller['index']);router[_0x86ac('0x6')](_0x86ac('0x7'),auth[_0x86ac('0x5')](),controller[_0x86ac('0x8')]);router['post']('/',auth[_0x86ac('0x5')](),controller[_0x86ac('0x9')]);router[_0x86ac('0xa')]('/:id',auth[_0x86ac('0x5')](),controller[_0x86ac('0xb')]);router[_0x86ac('0xc')](_0x86ac('0x7'),auth[_0x86ac('0x5')](),controller[_0x86ac('0xd')]);module[_0x86ac('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 2f3fe28..e870c44 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 _0x9d9a=['exports','STRING','DATE','sequelize','moment'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x9d9a,0x1ca));var _0xa9d9=function(_0x161885,_0x383938){_0x161885=_0x161885-0x0;var _0x45107c=_0x9d9a[_0x161885];return _0x45107c;};'use strict';var Sequelize=require(_0xa9d9('0x0'));var moment=require(_0xa9d9('0x1'));module[_0xa9d9('0x2')]={'time':{'type':Sequelize[_0xa9d9('0x3')]},'callid':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa9d9('0x4')],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x637f=['sequelize','moment','exports','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x5230a9,_0x44d7a9){var _0x1134b4=function(_0x4f2f13){while(--_0x4f2f13){_0x5230a9['push'](_0x5230a9['shift']());}};_0x1134b4(++_0x44d7a9);}(_0x637f,0x190));var _0xf637=function(_0x399bfc,_0x36d4b0){_0x399bfc=_0x399bfc-0x0;var _0x36846d=_0x637f[_0x399bfc];return _0x36846d;};'use strict';var Sequelize=require(_0xf637('0x0'));var moment=require(_0xf637('0x1'));module[_0xf637('0x2')]={'time':{'type':Sequelize[_0xf637('0x3')]},'callid':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf637('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0xf637('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8780516..1eb753d 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 _0x1371=['count','offset','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','limit'];(function(_0x164af7,_0x1109f6){var _0x56dd78=function(_0x6e4104){while(--_0x6e4104){_0x164af7['push'](_0x164af7['shift']());}};_0x56dd78(++_0x1109f6);}(_0x1371,0x79));var _0x1137=function(_0x1fcc75,_0x45ce35){_0x1fcc75=_0x1fcc75-0x0;var _0x41a818=_0x1371[_0x1fcc75];return _0x41a818;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1137('0x0'));var jsonpatch=require(_0x1137('0x1'));var rp=require(_0x1137('0x2'));var moment=require(_0x1137('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1137('0x4'));var util=require('util');var path=require(_0x1137('0x5'));var sox=require(_0x1137('0x6'));var csv=require(_0x1137('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1137('0x8'));var _=require(_0x1137('0x9'));var squel=require(_0x1137('0xa'));var crypto=require(_0x1137('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1137('0x7'));var querystring=require(_0x1137('0xc'));var Papa=require(_0x1137('0xd'));var Redis=require(_0x1137('0xe'));var authService=require(_0x1137('0xf'));var qs=require(_0x1137('0x10'));var as=require(_0x1137('0x11'));var hardwareService=require(_0x1137('0x12'));var logger=require(_0x1137('0x13'))(_0x1137('0x14'));var utils=require(_0x1137('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1137('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a19b1,_0x4b9563){_0x4b9563=_0x4b9563||0xcc;return function(_0x10eca8){if(_0x10eca8){return _0x5a19b1[_0x1137('0x17')](_0x4b9563);}return _0x5a19b1[_0x1137('0x18')](_0x4b9563)[_0x1137('0x19')]();};}function respondWithResult(_0x38cfd0,_0x44cceb){_0x44cceb=_0x44cceb||0xc8;return function(_0x875269){if(_0x875269){return _0x38cfd0[_0x1137('0x18')](_0x44cceb)['json'](_0x875269);}};}function respondWithFilteredResult(_0x236606,_0x9a2468){return function(_0x52ba8a){if(_0x52ba8a){var _0x5cf2a9=typeof _0x9a2468['offset']==='undefined'&&typeof _0x9a2468[_0x1137('0x1a')]==='undefined';var _0x122f99=_0x52ba8a[_0x1137('0x1b')];var _0x2603e3=_0x5cf2a9?0x0:_0x9a2468[_0x1137('0x1c')];var _0x4212c5=_0x5cf2a9?_0x52ba8a[_0x1137('0x1b')]:_0x9a2468[_0x1137('0x1c')]+_0x9a2468[_0x1137('0x1a')];var _0x10b503;if(_0x4212c5>=_0x122f99){_0x4212c5=_0x122f99;_0x10b503=0xc8;}else{_0x10b503=0xce;}_0x236606[_0x1137('0x18')](_0x10b503);return _0x236606['set'](_0x1137('0x1d'),_0x2603e3+'-'+_0x4212c5+'/'+_0x122f99)[_0x1137('0x1e')](_0x52ba8a);}return null;};}function patchUpdates(_0x215616){return function(_0x5902c7){try{jsonpatch[_0x1137('0x1f')](_0x5902c7,_0x215616,!![]);}catch(_0x5e2669){return BPromise[_0x1137('0x20')](_0x5e2669);}return _0x5902c7[_0x1137('0x21')]();};}function saveUpdates(_0x1d0a07,_0x1446e5){return function(_0x5d086f){if(_0x5d086f){return _0x5d086f[_0x1137('0x22')](_0x1d0a07)['then'](function(_0x15bcd3){return _0x15bcd3;});}return null;};}function removeEntity(_0x3f1867,_0x3c1aa8){return function(_0x35675c){if(_0x35675c){return _0x35675c[_0x1137('0x23')]()[_0x1137('0x24')](function(){_0x3f1867['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0e76,_0x594b3e){return function(_0x2f25a7){if(!_0x2f25a7){_0x1b0e76['sendStatus'](0x194);}return _0x2f25a7;};}function handleError(_0x437903,_0xca67db){_0xca67db=_0xca67db||0x1f4;return function(_0x12bd20){logger[_0x1137('0x25')](_0x12bd20[_0x1137('0x26')]);if(_0x12bd20[_0x1137('0x27')]){delete _0x12bd20[_0x1137('0x27')];}_0x437903[_0x1137('0x18')](_0xca67db)[_0x1137('0x28')](_0x12bd20);};}exports[_0x1137('0x29')]=function(_0x15d7f4,_0x1b8073){var _0x59a8e4={},_0x22167f={},_0x4026d6={'count':0x0,'rows':[]};var _0x5b78bd=_[_0x1137('0x2a')](db[_0x1137('0x2b')][_0x1137('0x2c')],function(_0x265efd){return{'name':_0x265efd[_0x1137('0x2d')],'type':_0x265efd['type'][_0x1137('0x2e')]};});_0x22167f[_0x1137('0x2f')]=_[_0x1137('0x2a')](_0x5b78bd,_0x1137('0x27'));_0x22167f[_0x1137('0x30')]=_[_0x1137('0x31')](_0x15d7f4[_0x1137('0x30')]);_0x22167f[_0x1137('0x32')]=_['intersection'](_0x22167f['model'],_0x22167f[_0x1137('0x30')]);_0x59a8e4[_0x1137('0x33')]=_[_0x1137('0x34')](_0x22167f[_0x1137('0x2f')],qs[_0x1137('0x35')](_0x15d7f4['query'][_0x1137('0x35')]));_0x59a8e4[_0x1137('0x33')]=_0x59a8e4[_0x1137('0x33')]['length']?_0x59a8e4[_0x1137('0x33')]:_0x22167f[_0x1137('0x2f')];if(!_0x15d7f4[_0x1137('0x30')][_0x1137('0x36')]('nolimit')){_0x59a8e4[_0x1137('0x1a')]=qs[_0x1137('0x1a')](_0x15d7f4[_0x1137('0x30')][_0x1137('0x1a')]);_0x59a8e4[_0x1137('0x1c')]=qs[_0x1137('0x1c')](_0x15d7f4[_0x1137('0x30')][_0x1137('0x1c')]);}_0x59a8e4[_0x1137('0x37')]=qs[_0x1137('0x38')](_0x15d7f4[_0x1137('0x30')]['sort']);_0x59a8e4[_0x1137('0x39')]=qs[_0x1137('0x32')](_[_0x1137('0x3a')](_0x15d7f4[_0x1137('0x30')],_0x22167f[_0x1137('0x32')]),_0x5b78bd);if(_0x15d7f4[_0x1137('0x30')][_0x1137('0x3b')]){_0x59a8e4[_0x1137('0x39')]=_[_0x1137('0x3c')](_0x59a8e4['where'],{'$or':_[_0x1137('0x2a')](_0x5b78bd,function(_0xe823da){if(_0xe823da[_0x1137('0x3d')]!==_0x1137('0x3e')){var _0x470d13={};_0x470d13[_0xe823da[_0x1137('0x27')]]={'$like':'%'+_0x15d7f4['query'][_0x1137('0x3b')]+'%'};return _0x470d13;}})});}_0x59a8e4=_[_0x1137('0x3c')]({},_0x59a8e4,_0x15d7f4['options']);var _0x22636c={'where':_0x59a8e4[_0x1137('0x39')]};return db[_0x1137('0x2b')]['count'](_0x22636c)[_0x1137('0x24')](function(_0x2ae7ec){_0x4026d6[_0x1137('0x1b')]=_0x2ae7ec;if(_0x15d7f4[_0x1137('0x30')][_0x1137('0x3f')]){_0x59a8e4[_0x1137('0x40')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x1137('0x41')](_0x59a8e4);})['then'](function(_0x5b095f){_0x4026d6[_0x1137('0x42')]=_0x5b095f;return _0x4026d6;})[_0x1137('0x24')](respondWithFilteredResult(_0x1b8073,_0x59a8e4))[_0x1137('0x43')](handleError(_0x1b8073,null));};exports[_0x1137('0x44')]=function(_0xc7cf0e,_0x42d0dd){var _0x58b2bd={'raw':!![],'where':{'id':_0xc7cf0e[_0x1137('0x45')]['id']}},_0x208afa={};_0x208afa[_0x1137('0x2f')]=_[_0x1137('0x31')](db['VoiceQueuesLog'][_0x1137('0x2c')]);_0x208afa['query']=_[_0x1137('0x31')](_0xc7cf0e[_0x1137('0x30')]);_0x208afa[_0x1137('0x32')]=_[_0x1137('0x34')](_0x208afa[_0x1137('0x2f')],_0x208afa[_0x1137('0x30')]);_0x58b2bd[_0x1137('0x33')]=_[_0x1137('0x34')](_0x208afa['model'],qs[_0x1137('0x35')](_0xc7cf0e['query'][_0x1137('0x35')]));_0x58b2bd['attributes']=_0x58b2bd[_0x1137('0x33')][_0x1137('0x46')]?_0x58b2bd[_0x1137('0x33')]:_0x208afa[_0x1137('0x2f')];if(_0xc7cf0e['query']['includeAll']){_0x58b2bd[_0x1137('0x40')]=[{'all':!![]}];}_0x58b2bd=_[_0x1137('0x3c')]({},_0x58b2bd,_0xc7cf0e[_0x1137('0x47')]);return db[_0x1137('0x2b')][_0x1137('0x48')](_0x58b2bd)[_0x1137('0x24')](handleEntityNotFound(_0x42d0dd,null))[_0x1137('0x24')](respondWithResult(_0x42d0dd,null))['catch'](handleError(_0x42d0dd,null));};exports['create']=function(_0x2935cd,_0x4c0a82){return db['VoiceQueuesLog']['create'](_0x2935cd[_0x1137('0x49')],{})[_0x1137('0x24')](respondWithResult(_0x4c0a82,0xc9))[_0x1137('0x43')](handleError(_0x4c0a82,null));};exports[_0x1137('0x22')]=function(_0x1aeecb,_0x13512d){if(_0x1aeecb[_0x1137('0x49')]['id']){delete _0x1aeecb[_0x1137('0x49')]['id'];}return db[_0x1137('0x2b')][_0x1137('0x48')]({'where':{'id':_0x1aeecb[_0x1137('0x45')]['id']}})[_0x1137('0x24')](handleEntityNotFound(_0x13512d,null))[_0x1137('0x24')](saveUpdates(_0x1aeecb[_0x1137('0x49')],null))[_0x1137('0x24')](respondWithResult(_0x13512d,null))[_0x1137('0x43')](handleError(_0x13512d,null));};exports[_0x1137('0x23')]=function(_0x4aad32,_0x42c10a){return db[_0x1137('0x2b')]['find']({'where':{'id':_0x4aad32['params']['id']}})[_0x1137('0x24')](handleEntityNotFound(_0x42c10a,null))[_0x1137('0x24')](removeEntity(_0x42c10a,null))[_0x1137('0x43')](handleError(_0x42c10a,null));}; \ No newline at end of file +var _0xc762=['end','json','undefined','limit','count','offset','status','set','apply','save','update','then','stack','name','send','index','map','VoiceQueuesLog','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','rows','catch','params','rawAttributes','create','body','find','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x165d04,_0x3e5136){var _0xe363fa=function(_0x572d55){while(--_0x572d55){_0x165d04['push'](_0x165d04['shift']());}};_0xe363fa(++_0x3e5136);}(_0xc762,0x1d2));var _0x2c76=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xc762[_0x5a4400];return _0xf9b532;};'use strict';var emlformat=require(_0x2c76('0x0'));var rimraf=require(_0x2c76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c76('0x2'));var rp=require('request-promise');var moment=require(_0x2c76('0x3'));var BPromise=require(_0x2c76('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2c76('0x5'));var sox=require(_0x2c76('0x6'));var csv=require('to-csv');var ejs=require(_0x2c76('0x7'));var fs=require('fs');var fs_extra=require(_0x2c76('0x8'));var _=require(_0x2c76('0x9'));var squel=require(_0x2c76('0xa'));var crypto=require('crypto');var jsforce=require(_0x2c76('0xb'));var deskjs=require(_0x2c76('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2c76('0xd'));var Papa=require('papaparse');var Redis=require(_0x2c76('0xe'));var authService=require(_0x2c76('0xf'));var qs=require(_0x2c76('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c76('0x11'));var logger=require(_0x2c76('0x12'))(_0x2c76('0x13'));var utils=require(_0x2c76('0x14'));var config=require(_0x2c76('0x15'));var licenseUtil=require(_0x2c76('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27be68,_0x5a048d){_0x5a048d=_0x5a048d||0xcc;return function(_0xda7724){if(_0xda7724){return _0x27be68[_0x2c76('0x17')](_0x5a048d);}return _0x27be68['status'](_0x5a048d)[_0x2c76('0x18')]();};}function respondWithResult(_0x1d6821,_0x2cb8cd){_0x2cb8cd=_0x2cb8cd||0xc8;return function(_0xa79ab1){if(_0xa79ab1){return _0x1d6821['status'](_0x2cb8cd)[_0x2c76('0x19')](_0xa79ab1);}};}function respondWithFilteredResult(_0xaca45,_0x4ae113){return function(_0x24eed5){if(_0x24eed5){var _0x4fe78c=typeof _0x4ae113['offset']===_0x2c76('0x1a')&&typeof _0x4ae113[_0x2c76('0x1b')]===_0x2c76('0x1a');var _0x36cf21=_0x24eed5[_0x2c76('0x1c')];var _0x35fd10=_0x4fe78c?0x0:_0x4ae113[_0x2c76('0x1d')];var _0x436b4c=_0x4fe78c?_0x24eed5[_0x2c76('0x1c')]:_0x4ae113[_0x2c76('0x1d')]+_0x4ae113[_0x2c76('0x1b')];var _0x31cb08;if(_0x436b4c>=_0x36cf21){_0x436b4c=_0x36cf21;_0x31cb08=0xc8;}else{_0x31cb08=0xce;}_0xaca45[_0x2c76('0x1e')](_0x31cb08);return _0xaca45[_0x2c76('0x1f')]('Content-Range',_0x35fd10+'-'+_0x436b4c+'/'+_0x36cf21)['json'](_0x24eed5);}return null;};}function patchUpdates(_0x188713){return function(_0x1cc3fd){try{jsonpatch[_0x2c76('0x20')](_0x1cc3fd,_0x188713,!![]);}catch(_0x2c1147){return BPromise['reject'](_0x2c1147);}return _0x1cc3fd[_0x2c76('0x21')]();};}function saveUpdates(_0x4ce93c,_0x2924bd){return function(_0x3c3d03){if(_0x3c3d03){return _0x3c3d03[_0x2c76('0x22')](_0x4ce93c)['then'](function(_0x46ecfb){return _0x46ecfb;});}return null;};}function removeEntity(_0x428077,_0x457705){return function(_0x5084c6){if(_0x5084c6){return _0x5084c6['destroy']()[_0x2c76('0x23')](function(){_0x428077[_0x2c76('0x1e')](0xcc)[_0x2c76('0x18')]();});}};}function handleEntityNotFound(_0x467766,_0x3d20f2){return function(_0x2a352d){if(!_0x2a352d){_0x467766['sendStatus'](0x194);}return _0x2a352d;};}function handleError(_0x1c3a12,_0x28fddf){_0x28fddf=_0x28fddf||0x1f4;return function(_0x507855){logger['error'](_0x507855[_0x2c76('0x24')]);if(_0x507855[_0x2c76('0x25')]){delete _0x507855[_0x2c76('0x25')];}_0x1c3a12[_0x2c76('0x1e')](_0x28fddf)[_0x2c76('0x26')](_0x507855);};}exports[_0x2c76('0x27')]=function(_0x3cca75,_0x4e35bf){var _0x3fd13f={},_0x543699={},_0x50a591={'count':0x0,'rows':[]};var _0x2f6f95=_[_0x2c76('0x28')](db[_0x2c76('0x29')]['rawAttributes'],function(_0x5086d8){return{'name':_0x5086d8['fieldName'],'type':_0x5086d8[_0x2c76('0x2a')][_0x2c76('0x2b')]};});_0x543699[_0x2c76('0x2c')]=_[_0x2c76('0x28')](_0x2f6f95,'name');_0x543699[_0x2c76('0x2d')]=_[_0x2c76('0x2e')](_0x3cca75[_0x2c76('0x2d')]);_0x543699[_0x2c76('0x2f')]=_[_0x2c76('0x30')](_0x543699['model'],_0x543699['query']);_0x3fd13f[_0x2c76('0x31')]=_[_0x2c76('0x30')](_0x543699[_0x2c76('0x2c')],qs[_0x2c76('0x32')](_0x3cca75[_0x2c76('0x2d')][_0x2c76('0x32')]));_0x3fd13f[_0x2c76('0x31')]=_0x3fd13f[_0x2c76('0x31')][_0x2c76('0x33')]?_0x3fd13f[_0x2c76('0x31')]:_0x543699[_0x2c76('0x2c')];if(!_0x3cca75[_0x2c76('0x2d')][_0x2c76('0x34')](_0x2c76('0x35'))){_0x3fd13f['limit']=qs[_0x2c76('0x1b')](_0x3cca75[_0x2c76('0x2d')][_0x2c76('0x1b')]);_0x3fd13f[_0x2c76('0x1d')]=qs[_0x2c76('0x1d')](_0x3cca75['query'][_0x2c76('0x1d')]);}_0x3fd13f[_0x2c76('0x36')]=qs[_0x2c76('0x37')](_0x3cca75[_0x2c76('0x2d')][_0x2c76('0x37')]);_0x3fd13f[_0x2c76('0x38')]=qs[_0x2c76('0x2f')](_[_0x2c76('0x39')](_0x3cca75[_0x2c76('0x2d')],_0x543699[_0x2c76('0x2f')]),_0x2f6f95);if(_0x3cca75['query']['filter']){_0x3fd13f[_0x2c76('0x38')]=_[_0x2c76('0x3a')](_0x3fd13f[_0x2c76('0x38')],{'$or':_[_0x2c76('0x28')](_0x2f6f95,function(_0x466b54){if(_0x466b54[_0x2c76('0x2a')]!==_0x2c76('0x3b')){var _0x394a0b={};_0x394a0b[_0x466b54['name']]={'$like':'%'+_0x3cca75[_0x2c76('0x2d')]['filter']+'%'};return _0x394a0b;}})});}_0x3fd13f=_[_0x2c76('0x3a')]({},_0x3fd13f,_0x3cca75[_0x2c76('0x3c')]);var _0x42db55={'where':_0x3fd13f[_0x2c76('0x38')]};return db[_0x2c76('0x29')]['count'](_0x42db55)[_0x2c76('0x23')](function(_0x48ca04){_0x50a591[_0x2c76('0x1c')]=_0x48ca04;if(_0x3cca75[_0x2c76('0x2d')]['includeAll']){_0x3fd13f[_0x2c76('0x3d')]=[{'all':!![]}];}return db[_0x2c76('0x29')]['findAll'](_0x3fd13f);})[_0x2c76('0x23')](function(_0x326f08){_0x50a591[_0x2c76('0x3e')]=_0x326f08;return _0x50a591;})[_0x2c76('0x23')](respondWithFilteredResult(_0x4e35bf,_0x3fd13f))[_0x2c76('0x3f')](handleError(_0x4e35bf,null));};exports['show']=function(_0xd9cda3,_0x2ac70b){var _0x2fe891={'raw':!![],'where':{'id':_0xd9cda3[_0x2c76('0x40')]['id']}},_0x44004d={};_0x44004d[_0x2c76('0x2c')]=_['keys'](db[_0x2c76('0x29')][_0x2c76('0x41')]);_0x44004d[_0x2c76('0x2d')]=_['keys'](_0xd9cda3[_0x2c76('0x2d')]);_0x44004d[_0x2c76('0x2f')]=_[_0x2c76('0x30')](_0x44004d[_0x2c76('0x2c')],_0x44004d['query']);_0x2fe891[_0x2c76('0x31')]=_[_0x2c76('0x30')](_0x44004d[_0x2c76('0x2c')],qs[_0x2c76('0x32')](_0xd9cda3[_0x2c76('0x2d')][_0x2c76('0x32')]));_0x2fe891[_0x2c76('0x31')]=_0x2fe891[_0x2c76('0x31')]['length']?_0x2fe891[_0x2c76('0x31')]:_0x44004d[_0x2c76('0x2c')];if(_0xd9cda3[_0x2c76('0x2d')]['includeAll']){_0x2fe891[_0x2c76('0x3d')]=[{'all':!![]}];}_0x2fe891=_[_0x2c76('0x3a')]({},_0x2fe891,_0xd9cda3['options']);return db['VoiceQueuesLog']['find'](_0x2fe891)[_0x2c76('0x23')](handleEntityNotFound(_0x2ac70b,null))[_0x2c76('0x23')](respondWithResult(_0x2ac70b,null))[_0x2c76('0x3f')](handleError(_0x2ac70b,null));};exports[_0x2c76('0x42')]=function(_0xbb1328,_0x2dbe84){return db[_0x2c76('0x29')][_0x2c76('0x42')](_0xbb1328[_0x2c76('0x43')],{})[_0x2c76('0x23')](respondWithResult(_0x2dbe84,0xc9))[_0x2c76('0x3f')](handleError(_0x2dbe84,null));};exports[_0x2c76('0x22')]=function(_0x538acf,_0x5dc98e){if(_0x538acf[_0x2c76('0x43')]['id']){delete _0x538acf['body']['id'];}return db[_0x2c76('0x29')][_0x2c76('0x44')]({'where':{'id':_0x538acf[_0x2c76('0x40')]['id']}})[_0x2c76('0x23')](handleEntityNotFound(_0x5dc98e,null))[_0x2c76('0x23')](saveUpdates(_0x538acf[_0x2c76('0x43')],null))[_0x2c76('0x23')](respondWithResult(_0x5dc98e,null))['catch'](handleError(_0x5dc98e,null));};exports[_0x2c76('0x45')]=function(_0x53aa18,_0x10023e){return db['VoiceQueuesLog']['find']({'where':{'id':_0x53aa18[_0x2c76('0x40')]['id']}})[_0x2c76('0x23')](handleEntityNotFound(_0x10023e,null))[_0x2c76('0x23')](removeEntity(_0x10023e,null))[_0x2c76('0x3f')](handleError(_0x10023e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ac14af5..4171eeb 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 _0xfcf0=['VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x4d59d7,_0x41ba47){var _0x454a5e=function(_0x52f8dc){while(--_0x52f8dc){_0x4d59d7['push'](_0x4d59d7['shift']());}};_0x454a5e(++_0x41ba47);}(_0xfcf0,0xc8));var _0x0fcf=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xfcf0[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require(_0x0fcf('0x2'))(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x5'));var config=require(_0x0fcf('0x6'));var attributes=require(_0x0fcf('0x7'));module[_0x0fcf('0x8')]=function(_0x3e2d86,_0x1477f9){return _0x3e2d86[_0x0fcf('0x9')](_0x0fcf('0xa'),attributes,{'tableName':_0x0fcf('0xb'),'paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xd'),_0x0fcf('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xde5d=['rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','event_dtm','dtm','lodash','../../config/logger','api','request-promise','path'];(function(_0x446ecc,_0x22b25b){var _0x534173=function(_0x42c1bd){while(--_0x42c1bd){_0x446ecc['push'](_0x446ecc['shift']());}};_0x534173(++_0x22b25b);}(_0xde5d,0xd7));var _0xdde5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xde5d[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xdde5('0x0'));var util=require('util');var logger=require(_0xdde5('0x1'))(_0xdde5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdde5('0x3'));var fs=require('fs');var path=require(_0xdde5('0x4'));var rimraf=require(_0xdde5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdde5('0x6'));module[_0xdde5('0x7')]=function(_0x409af0,_0x28df99){return _0x409af0['define'](_0xdde5('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xdde5('0x9'),'fields':['event',_0xdde5('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ecf8c92..4459597 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 _0xc678=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x54c961,_0x85056d){var _0x112c6e=function(_0x308c82){while(--_0x308c82){_0x54c961['push'](_0x54c961['shift']());}};_0x112c6e(++_0x85056d);}(_0xc678,0x1b4));var _0x8c67=function(_0x9f80fb,_0x1e48c1){_0x9f80fb=_0x9f80fb-0x0;var _0x32002d=_0xc678[_0x9f80fb];return _0x32002d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c67('0x0'));var BPromise=require(_0x8c67('0x1'));var rs=require(_0x8c67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c67('0x3'))['db'];var utils=require(_0x8c67('0x4'));var logger=require(_0x8c67('0x5'))(_0x8c67('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c67('0x7'));var client=jayson['client'][_0x8c67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4ceb,_0x4c2ffe,_0x207de1){return new BPromise(function(_0x22d7e4,_0x41ac88){return client[_0x8c67('0x9')](_0x1b4ceb,_0x207de1)[_0x8c67('0xa')](function(_0x5bac97){logger[_0x8c67('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4c2ffe,_0x8c67('0xc'));logger[_0x8c67('0xd')](_0x8c67('0xe'),_0x4c2ffe,'request\x20sent',JSON[_0x8c67('0xf')](_0x5bac97));if(_0x5bac97[_0x8c67('0x10')]){if(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x11')]===0x1f4){logger['error'](_0x8c67('0x12'),_0x4c2ffe,_0x5bac97['error']['message']);return _0x41ac88(_0x5bac97['error']['message']);}logger[_0x8c67('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4c2ffe,_0x5bac97[_0x8c67('0x10')]['message']);return _0x22d7e4(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x13')]);}else{logger[_0x8c67('0xb')](_0x8c67('0x12'),_0x4c2ffe,'request\x20sent');_0x22d7e4(_0x5bac97[_0x8c67('0x14')][_0x8c67('0x13')]);}})[_0x8c67('0x15')](function(_0x1bae2f){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4c2ffe,_0x1bae2f);_0x41ac88(_0x1bae2f);});});} \ No newline at end of file +var _0x53ed=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c4467,_0x5e22d8){var _0x3fef57=function(_0x49679b){while(--_0x49679b){_0x5c4467['push'](_0x5c4467['shift']());}};_0x3fef57(++_0x5e22d8);}(_0x53ed,0x76));var _0xd53e=function(_0x3765a0,_0x44093e){_0x3765a0=_0x3765a0-0x0;var _0x348aa3=_0x53ed[_0x3765a0];return _0x348aa3;};'use strict';var _=require(_0xd53e('0x0'));var util=require(_0xd53e('0x1'));var moment=require(_0xd53e('0x2'));var BPromise=require(_0xd53e('0x3'));var rs=require(_0xd53e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd53e('0x5'))['db'];var utils=require(_0xd53e('0x6'));var logger=require(_0xd53e('0x7'))(_0xd53e('0x8'));var config=require('../../config/environment');var jayson=require(_0xd53e('0x9'));var client=jayson['client'][_0xd53e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfc0b5a,_0x163fd1,_0x56ddc7){return new BPromise(function(_0x34a04e,_0x59f49b){return client[_0xd53e('0xb')](_0xfc0b5a,_0x56ddc7)[_0xd53e('0xc')](function(_0x51313d){logger[_0xd53e('0xd')](_0xd53e('0xe'),_0x163fd1,_0xd53e('0xf'));logger[_0xd53e('0x10')](_0xd53e('0x11'),_0x163fd1,_0xd53e('0xf'),JSON[_0xd53e('0x12')](_0x51313d));if(_0x51313d[_0xd53e('0x13')]){if(_0x51313d[_0xd53e('0x13')][_0xd53e('0x14')]===0x1f4){logger['error'](_0xd53e('0xe'),_0x163fd1,_0x51313d[_0xd53e('0x13')][_0xd53e('0x15')]);return _0x59f49b(_0x51313d[_0xd53e('0x13')][_0xd53e('0x15')]);}logger[_0xd53e('0x13')](_0xd53e('0xe'),_0x163fd1,_0x51313d[_0xd53e('0x13')][_0xd53e('0x15')]);return _0x34a04e(_0x51313d[_0xd53e('0x13')][_0xd53e('0x15')]);}else{logger[_0xd53e('0xd')](_0xd53e('0xe'),_0x163fd1,'request\x20sent');_0x34a04e(_0x51313d['result'][_0xd53e('0x15')]);}})[_0xd53e('0x16')](function(_0x461bba){logger[_0xd53e('0x13')](_0xd53e('0xe'),_0x163fd1,_0x461bba);_0x59f49b(_0x461bba);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 19549a6..00ea1e1 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 _0x890e=['./voiceRecording.controller','get','isAuthenticated','index','describe','show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x890e,0xb4));var _0xe890=function(_0x1e1268,_0x3f7692){_0x1e1268=_0x1e1268-0x0;var _0x53c294=_0x890e[_0x1e1268];return _0x53c294;};'use strict';var multer=require(_0xe890('0x0'));var util=require(_0xe890('0x1'));var path=require(_0xe890('0x2'));var timeout=require(_0xe890('0x3'));var express=require(_0xe890('0x4'));var router=express[_0xe890('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe890('0x6'));var interaction=require(_0xe890('0x7'));var config=require(_0xe890('0x8'));var controller=require(_0xe890('0x9'));router[_0xe890('0xa')]('/',auth[_0xe890('0xb')](),controller[_0xe890('0xc')]);router[_0xe890('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xe890('0xd')]);router[_0xe890('0xa')]('/:id',auth[_0xe890('0xb')](),controller[_0xe890('0xe')]);router[_0xe890('0xa')](_0xe890('0xf'),auth[_0xe890('0xb')](),controller['download']);router[_0xe890('0xa')](_0xe890('0x10'),controller['downloads']);router['get'](_0xe890('0x11'),auth[_0xe890('0xb')](),controller[_0xe890('0x12')]);router['post']('/',auth[_0xe890('0xb')](),controller[_0xe890('0x13')]);router[_0xe890('0x14')]('/:id/transcribe',auth[_0xe890('0xb')](),controller[_0xe890('0x15')]);router[_0xe890('0x16')](_0xe890('0x17'),auth[_0xe890('0xb')](),controller[_0xe890('0x18')]);router[_0xe890('0x19')](_0xe890('0x17'),auth[_0xe890('0xb')](),controller['destroy']);module[_0xe890('0x1a')]=router; \ No newline at end of file +var _0x2a02=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a02,0xa0));var _0x22a0=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x2a02[_0x28f32c];return _0x355402;};'use strict';var multer=require('multer');var util=require(_0x22a0('0x0'));var path=require(_0x22a0('0x1'));var timeout=require('connect-timeout');var express=require(_0x22a0('0x2'));var router=express[_0x22a0('0x3')]();var fs_extra=require(_0x22a0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x22a0('0x5'));var config=require(_0x22a0('0x6'));var controller=require(_0x22a0('0x7'));router[_0x22a0('0x8')]('/',auth['isAuthenticated'](),controller[_0x22a0('0x9')]);router[_0x22a0('0x8')](_0x22a0('0xa'),auth[_0x22a0('0xb')](),controller['describe']);router[_0x22a0('0x8')]('/:id',auth[_0x22a0('0xb')](),controller[_0x22a0('0xc')]);router['get'](_0x22a0('0xd'),auth[_0x22a0('0xb')](),controller['download']);router[_0x22a0('0x8')](_0x22a0('0xe'),controller['downloads']);router[_0x22a0('0x8')](_0x22a0('0xf'),auth[_0x22a0('0xb')](),controller[_0x22a0('0x10')]);router[_0x22a0('0x11')]('/',auth[_0x22a0('0xb')](),controller[_0x22a0('0x12')]);router[_0x22a0('0x11')](_0x22a0('0xf'),auth[_0x22a0('0xb')](),controller[_0x22a0('0x13')]);router[_0x22a0('0x14')](_0x22a0('0x15'),auth[_0x22a0('0xb')](),controller[_0x22a0('0x16')]);router[_0x22a0('0x17')](_0x22a0('0x15'),auth[_0x22a0('0xb')](),controller[_0x22a0('0x18')]);module[_0x22a0('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index fadf798..6bd0493 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(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 af98d3c..18af715 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 _0x8c12=['aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','map','VoiceRecording','rawAttributes','type','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','download','uniqueid','value','existsSync','secrets','recording','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','$and','push','%s.cypher','decryptFile','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','File:\x20\x22','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x35b07e,_0x4c5a33){var _0xcb745e=function(_0x30468b){while(--_0x30468b){_0x35b07e['push'](_0x35b07e['shift']());}};_0xcb745e(++_0x4c5a33);}(_0x8c12,0x82));var _0x28c1=function(_0x5a33ee,_0x126a2b){_0x5a33ee=_0x5a33ee-0x0;var _0xe51e3a=_0x8c12[_0x5a33ee];return _0xe51e3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x28c1('0x1'));var moment=require(_0x28c1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x28c1('0x3'));var util=require('util');var path=require(_0x28c1('0x4'));var sox=require(_0x28c1('0x5'));var csv=require(_0x28c1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x28c1('0x7'));var crypto=require(_0x28c1('0x8'));var jsforce=require(_0x28c1('0x9'));var deskjs=require(_0x28c1('0xa'));var toCsv=require(_0x28c1('0x6'));var querystring=require(_0x28c1('0xb'));var Papa=require(_0x28c1('0xc'));var AWS=require(_0x28c1('0xd'));var uuidv4=require(_0x28c1('0xe'));var Redis=require(_0x28c1('0xf'));var authService=require(_0x28c1('0x10'));var qs=require(_0x28c1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28c1('0x12'));var logger=require(_0x28c1('0x13'))('api');var utils=require(_0x28c1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x28c1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x82747,_0x2b3368){_0x2b3368=_0x2b3368||0xcc;return function(_0x45fdd2){if(_0x45fdd2){return _0x82747[_0x28c1('0x16')](_0x2b3368);}return _0x82747[_0x28c1('0x17')](_0x2b3368)[_0x28c1('0x18')]();};}function respondWithResult(_0x464f24,_0x184252){_0x184252=_0x184252||0xc8;return function(_0x3654fe){if(_0x3654fe){return _0x464f24[_0x28c1('0x17')](_0x184252)[_0x28c1('0x19')](_0x3654fe);}};}function respondWithFilteredResult(_0x5db1fc,_0x39b345){return function(_0x4b20c2){if(_0x4b20c2){var _0x3f6b01=typeof _0x39b345['offset']==='undefined'&&typeof _0x39b345[_0x28c1('0x1a')]===_0x28c1('0x1b');var _0xfb9a75=_0x4b20c2[_0x28c1('0x1c')];var _0xe0e763=_0x3f6b01?0x0:_0x39b345[_0x28c1('0x1d')];var _0x57e770=_0x3f6b01?_0x4b20c2[_0x28c1('0x1c')]:_0x39b345[_0x28c1('0x1d')]+_0x39b345['limit'];var _0x22a62f;if(_0x57e770>=_0xfb9a75){_0x57e770=_0xfb9a75;_0x22a62f=0xc8;}else{_0x22a62f=0xce;}_0x5db1fc[_0x28c1('0x17')](_0x22a62f);return _0x5db1fc['set'](_0x28c1('0x1e'),_0xe0e763+'-'+_0x57e770+'/'+_0xfb9a75)[_0x28c1('0x19')](_0x4b20c2);}return null;};}function patchUpdates(_0x18973a){return function(_0x32cd5b){try{jsonpatch[_0x28c1('0x1f')](_0x32cd5b,_0x18973a,!![]);}catch(_0x313d15){return BPromise[_0x28c1('0x20')](_0x313d15);}return _0x32cd5b[_0x28c1('0x21')]();};}function saveUpdates(_0x2f2532,_0x9381a6){return function(_0xdb7d5b){if(_0xdb7d5b){return _0xdb7d5b[_0x28c1('0x22')](_0x2f2532)[_0x28c1('0x23')](function(_0x61bb81){return _0x61bb81;});}return null;};}function removeEntity(_0x420ceb,_0x1e5772){return function(_0x3935ec){if(_0x3935ec){return _0x3935ec[_0x28c1('0x24')]()[_0x28c1('0x23')](function(){_0x420ceb[_0x28c1('0x17')](0xcc)[_0x28c1('0x18')]();});}};}function handleEntityNotFound(_0x318de6,_0x4b0560){return function(_0x576ee3){if(!_0x576ee3){_0x318de6['sendStatus'](0x194);}return _0x576ee3;};}function handleError(_0x4bb3b3,_0x214044){_0x214044=_0x214044||0x1f4;return function(_0x259e86){logger['error'](_0x259e86[_0x28c1('0x25')]);if(_0x259e86['name']){delete _0x259e86['name'];}_0x4bb3b3[_0x28c1('0x17')](_0x214044)['send'](_0x259e86);};}exports['index']=function(_0x27e707,_0x6b3fdd){var _0x1553fd={},_0x1dec3b={},_0x15ca82={'count':0x0,'rows':[]};var _0x2c3fc5=_[_0x28c1('0x26')](db[_0x28c1('0x27')][_0x28c1('0x28')],function(_0x5834ed){return{'name':_0x5834ed['fieldName'],'type':_0x5834ed[_0x28c1('0x29')]['key']};});_0x1dec3b[_0x28c1('0x2a')]=_[_0x28c1('0x2b')](_[_0x28c1('0x26')](_0x2c3fc5,_0x28c1('0x2c')),[_0x28c1('0x2d')]);_0x1dec3b[_0x28c1('0x2e')]=_[_0x28c1('0x2f')](_0x27e707[_0x28c1('0x2e')]);_0x1dec3b[_0x28c1('0x30')]=_[_0x28c1('0x31')](_0x1dec3b[_0x28c1('0x2a')],_0x1dec3b[_0x28c1('0x2e')]);_0x1553fd[_0x28c1('0x32')]=_['intersection'](_0x1dec3b[_0x28c1('0x2a')],qs[_0x28c1('0x33')](_0x27e707['query'][_0x28c1('0x33')]));_0x1553fd[_0x28c1('0x32')]=_0x1553fd[_0x28c1('0x32')][_0x28c1('0x34')]?_0x1553fd['attributes']:_0x1dec3b[_0x28c1('0x2a')];if(!_0x27e707['query'][_0x28c1('0x35')]('nolimit')){_0x1553fd[_0x28c1('0x1a')]=qs[_0x28c1('0x1a')](_0x27e707[_0x28c1('0x2e')][_0x28c1('0x1a')]);_0x1553fd[_0x28c1('0x1d')]=qs[_0x28c1('0x1d')](_0x27e707[_0x28c1('0x2e')]['offset']);}_0x1553fd[_0x28c1('0x36')]=qs[_0x28c1('0x37')](_0x27e707[_0x28c1('0x2e')][_0x28c1('0x37')]);_0x1553fd[_0x28c1('0x38')]=qs[_0x28c1('0x30')](_[_0x28c1('0x39')](_0x27e707['query'],_0x1dec3b[_0x28c1('0x30')]),_0x2c3fc5);if(_0x27e707[_0x28c1('0x2e')][_0x28c1('0x3a')]){_0x1553fd[_0x28c1('0x38')]=_['merge'](_0x1553fd['where'],{'$or':_['map'](_0x2c3fc5,function(_0x58b523){if(_0x58b523[_0x28c1('0x29')]!==_0x28c1('0x3b')){var _0x2d87c8={};_0x2d87c8[_0x58b523[_0x28c1('0x2c')]]={'$like':'%'+_0x27e707[_0x28c1('0x2e')][_0x28c1('0x3a')]+'%'};return _0x2d87c8;}})});}_0x1553fd=_['merge']({},_0x1553fd,_0x27e707[_0x28c1('0x3c')]);var _0x498c5d={'where':_0x1553fd[_0x28c1('0x38')]};return db[_0x28c1('0x27')][_0x28c1('0x1c')](_0x498c5d)[_0x28c1('0x23')](function(_0x2e0b96){_0x15ca82[_0x28c1('0x1c')]=_0x2e0b96;if(_0x27e707['query'][_0x28c1('0x3d')]){_0x1553fd[_0x28c1('0x3e')]=[{'all':!![]}];}return db[_0x28c1('0x27')][_0x28c1('0x3f')](_0x1553fd);})[_0x28c1('0x23')](function(_0x552d82){_0x15ca82[_0x28c1('0x40')]=_0x552d82;return _0x15ca82;})[_0x28c1('0x23')](respondWithFilteredResult(_0x6b3fdd,_0x1553fd))[_0x28c1('0x41')](handleError(_0x6b3fdd,null));};exports[_0x28c1('0x42')]=function(_0xc8cb1e,_0x3f345f){var _0x563762={'raw':![],'where':{'id':_0xc8cb1e[_0x28c1('0x43')]['id']}},_0x57a862={};_0x57a862[_0x28c1('0x2a')]=_[_0x28c1('0x2f')](db['VoiceRecording'][_0x28c1('0x28')]);_0x57a862[_0x28c1('0x2e')]=_[_0x28c1('0x2f')](_0xc8cb1e[_0x28c1('0x2e')]);_0x57a862[_0x28c1('0x30')]=_['intersection'](_0x57a862[_0x28c1('0x2a')],_0x57a862[_0x28c1('0x2e')]);_0x563762['attributes']=_[_0x28c1('0x31')](_0x57a862['model'],qs[_0x28c1('0x33')](_0xc8cb1e[_0x28c1('0x2e')][_0x28c1('0x33')]));_0x563762['attributes']=_0x563762[_0x28c1('0x32')][_0x28c1('0x34')]?_0x563762[_0x28c1('0x32')]:_0x57a862[_0x28c1('0x2a')];if(_0xc8cb1e[_0x28c1('0x2e')]['includeAll']){_0x563762[_0x28c1('0x3e')]=[{'all':!![]}];}_0x563762=_[_0x28c1('0x44')]({},_0x563762,_0xc8cb1e[_0x28c1('0x3c')]);return db['VoiceRecording']['find'](_0x563762)['then'](handleEntityNotFound(_0x3f345f,null))[_0x28c1('0x23')](respondWithResult(_0x3f345f,null))[_0x28c1('0x41')](handleError(_0x3f345f,null));};exports[_0x28c1('0x45')]=function(_0x4cd610,_0xfd1602){return db[_0x28c1('0x27')][_0x28c1('0x45')](_0x4cd610[_0x28c1('0x46')],{})[_0x28c1('0x23')](respondWithResult(_0xfd1602,0xc9))[_0x28c1('0x41')](handleError(_0xfd1602,null));};exports['update']=function(_0x1c94e0,_0x3a7f69){if(_0x1c94e0[_0x28c1('0x46')]['id']){delete _0x1c94e0[_0x28c1('0x46')]['id'];}return db[_0x28c1('0x27')][_0x28c1('0x47')]({'where':{'id':_0x1c94e0[_0x28c1('0x43')]['id']}})[_0x28c1('0x23')](handleEntityNotFound(_0x3a7f69,null))[_0x28c1('0x23')](saveUpdates(_0x1c94e0['body'],null))[_0x28c1('0x23')](respondWithResult(_0x3a7f69,null))[_0x28c1('0x41')](handleError(_0x3a7f69,null));};exports[_0x28c1('0x48')]=function(_0x5b1b94,_0x5a52e5){return db['VoiceRecording']['describe']()[_0x28c1('0x23')](respondWithResult(_0x5a52e5,null))['catch'](handleError(_0x5a52e5,null));};exports[_0x28c1('0x49')]=function(_0x52373b,_0x5d6408,_0x439c1b){var _0x5d659b=require('../../components/encryptor');var _0x5c256f=![];var _0x140ce2={};if(_0x52373b['query'][_0x28c1('0x29')]&&_0x52373b['query'][_0x28c1('0x29')]===_0x28c1('0x4a')){_0x140ce2[_0x28c1('0x4a')]=_0x52373b['params']['id'];}else{_0x140ce2['id']=_0x52373b['params']['id'];}return db[_0x28c1('0x27')][_0x28c1('0x47')]({'where':_0x140ce2,'attributes':['id',_0x28c1('0x4b')],'raw':!![]})[_0x28c1('0x23')](handleEntityNotFound(_0x5d6408,null))[_0x28c1('0x23')](function(_0x49456a){if(_0x49456a){var _0x3a3db2=_0x49456a[_0x28c1('0x4b')];var _0x529fcd=util[_0x28c1('0x2d')]('%s.cypher',_0x3a3db2);if(fs[_0x28c1('0x4c')](_0x529fcd)){_0x5c256f=!![];return _0x5d659b['decryptFile'](_0x529fcd,_0x3a3db2,config[_0x28c1('0x4d')][_0x28c1('0x4e')])['then'](function(){return _0x49456a;});}return _0x49456a;}})[_0x28c1('0x23')](function(_0x45133f){if(_0x45133f){var _0x503338=_0x45133f[_0x28c1('0x4b')];if(!fs['existsSync'](_0x503338)){throw new db['Sequelize'][(_0x28c1('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x45133f[_0x28c1('0x50')]){return _0x5d6408[_0x28c1('0x49')](_0x503338,_0x45133f[_0x28c1('0x50')]+path[_0x28c1('0x51')](_0x503338),function(){if(_0x5c256f){fs[_0x28c1('0x52')](_0x503338);}});}else{return _0x5d6408['download'](_0x503338,function(_0x547d27){if(_0x5c256f){fs[_0x28c1('0x52')](_0x503338);}});}}})[_0x28c1('0x41')](function(_0x451e37){if(_0x451e37['message']===_0x28c1('0x53')){_0x5d6408[_0x28c1('0x17')](0x194)[_0x28c1('0x54')](_0x28c1('0x55'));}else{return handleError(_0x5d6408,null);}});};exports[_0x28c1('0x56')]=function(_0x34f684,_0x527175,_0x4bb513){var _0x3e241b=require(_0x28c1('0x57'));var _0x12663=![];var _0x2e927a={'$and':[db['sequelize'][_0x28c1('0x38')](db[_0x28c1('0x58')]['fn'](_0x28c1('0x59'),db[_0x28c1('0x58')]['col'](_0x28c1('0x4a'))),_0x34f684[_0x28c1('0x2e')][_0x28c1('0x5a')])]};if(_0x34f684[_0x28c1('0x2e')][_0x28c1('0x29')]&&_0x34f684['query'][_0x28c1('0x29')]===_0x28c1('0x4a')){_0x2e927a[_0x28c1('0x5b')][_0x28c1('0x5c')]({'uniqueid':_0x34f684[_0x28c1('0x43')]['id']});}else{_0x2e927a[_0x28c1('0x5b')][_0x28c1('0x5c')]({'id':_0x34f684[_0x28c1('0x43')]['id']});}return db[_0x28c1('0x27')][_0x28c1('0x47')]({'where':_0x2e927a,'attributes':['id',_0x28c1('0x4b')],'raw':!![]})[_0x28c1('0x23')](handleEntityNotFound(_0x527175,null))[_0x28c1('0x23')](function(_0x5cd14f){if(_0x5cd14f){var _0x5b0dfa=util['format'](_0x28c1('0x5d'),_0x5cd14f[_0x28c1('0x4b')]);if(fs[_0x28c1('0x4c')](_0x5b0dfa)){_0x12663=!![];return _0x3e241b[_0x28c1('0x5e')](_0x5b0dfa,_0x5cd14f[_0x28c1('0x4b')],config['secrets'][_0x28c1('0x4e')])[_0x28c1('0x23')](function(){return _0x5cd14f;});}return _0x5cd14f;}})[_0x28c1('0x23')](function(_0x2cf1b3){if(_0x2cf1b3){if(!fs[_0x28c1('0x4c')](_0x2cf1b3[_0x28c1('0x4b')])){throw new db['Sequelize'][(_0x28c1('0x4f'))](_0x28c1('0x53'));}if(_0x2cf1b3[_0x28c1('0x50')]){return _0x527175[_0x28c1('0x49')](_0x2cf1b3[_0x28c1('0x4b')],_0x2cf1b3[_0x28c1('0x50')]+path[_0x28c1('0x51')](_0x2cf1b3['value']),function(){if(_0x12663){fs[_0x28c1('0x52')](_0x2cf1b3['value']);}});}else{return _0x527175[_0x28c1('0x49')](_0x2cf1b3[_0x28c1('0x4b')],function(_0x74d9b7){if(_0x12663){fs['unlink'](_0x2cf1b3['value']);}});}}})[_0x28c1('0x41')](handleError(_0x527175,null));};exports[_0x28c1('0x24')]=function(_0x4de485,_0x1e3f76){return db['VoiceRecording'][_0x28c1('0x47')]({'where':{'id':_0x4de485[_0x28c1('0x43')]['id']}})[_0x28c1('0x23')](function(_0x42bd19){if(_['isNil'](_0x42bd19)){throw new ReferenceError('Entity\x20not\x20found');}return _0x42bd19;})[_0x28c1('0x23')](function(_0x2fadfb){var _0x2ff051=_0x2fadfb[_0x28c1('0x4b')];logger[_0x28c1('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x2ff051);if(!_['isNil'](_0x2fadfb[_0x28c1('0x4b')])&&fs[_0x28c1('0x4c')](_0x2ff051)){logger['info']('File:\x20\x22'+_0x2ff051+_0x28c1('0x60'));fs[_0x28c1('0x61')](_0x2ff051);}_0x2ff051=_0x2ff051+'.cypher';if(!_[_0x28c1('0x62')](_0x2fadfb['value'])&&fs[_0x28c1('0x4c')](_0x2ff051)){logger['info'](_0x28c1('0x63')+_0x2ff051+_0x28c1('0x60'));fs[_0x28c1('0x61')](_0x2ff051);}return _0x2fadfb;})[_0x28c1('0x23')](function(_0x31f3fa){if(!_0x31f3fa)throw new InternalError();return _0x31f3fa[_0x28c1('0x24')]();})[_0x28c1('0x23')](function(){_0x1e3f76[_0x28c1('0x17')](0xcc)['end']();})[_0x28c1('0x41')](handleError(_0x1e3f76,null));};function getBucketslist(_0xd63d50,_0x1d9273,_0xf4d4b1){return new Promise(function(_0x1f0805,_0xbf390f){var _0x858ed7=new AWS['S3']({'accessKeyId':_0x1d9273,'secretAccessKey':_0xd63d50,'region':_0xf4d4b1});_0x858ed7[_0x28c1('0x64')]({},function(_0x59f84b,_0xfd809){if(_0x59f84b){return _0xbf390f(_0x59f84b);}else{return _0x1f0805(_0xfd809);}});});}function createBucket(_0x555c54,_0x1f83b5,_0x5cb00e,_0x5af07d){return new Promise(function(_0x25435d,_0x336610){var _0x2a9648=new AWS['S3']({'accessKeyId':_0x1f83b5,'secretAccessKey':_0x555c54,'region':_0x5cb00e});_0x2a9648[_0x28c1('0x65')]({'Bucket':_0x5af07d},function(_0x26d75c,_0x3a15ce){if(_0x26d75c){return _0x336610(_0x26d75c);}else{return _0x25435d(_0x3a15ce);}});});}function uploadFile(_0x1b8446,_0x19ea07,_0x3bba75,_0x589da7,_0xd352e8,_0x2030c9){return new Promise(function(_0x54932e,_0x267199){var _0x3cd705=new AWS['S3']({'accessKeyId':_0x19ea07,'secretAccessKey':_0x1b8446,'region':_0x3bba75});_0x3cd705[_0x28c1('0x66')]({'Bucket':_0x589da7,'Key':_0xd352e8,'Body':_0x2030c9},function(_0x2b122d,_0x27834b){if(_0x2b122d){return _0x267199(_0x2b122d);}else{return _0x54932e(_0x27834b);}});});}function startTranscribe(_0x5bbb52,_0x53af41,_0x2273de,_0x2032ad,_0x9825a,_0x27e6aa){return new Promise(function(_0x2d5666,_0x44778f){var _0x47c915=new AWS['TranscribeService']({'accessKeyId':_0x53af41,'secretAccessKey':_0x5bbb52,'region':_0x2273de});_0x47c915[_0x28c1('0x67')]({'TranscriptionJobName':_0x2032ad,'LanguageCode':_0x9825a,'Media':{'MediaFileUri':_0x27e6aa}},function(_0x4ab48d,_0x3bb0e0){if(_0x4ab48d){return _0x44778f(_0x4ab48d);}else{return _0x2d5666(_0x3bb0e0);}});});}function transcribe(_0x1f26b2,_0x247ae2,_0x53c0e1,_0x245c92,_0x43a2c0,_0x1fe62c,_0x3a715c){return new Promise(function(_0x20bf7e,_0x101d11){var _0x1c3a94={};logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')](_0x28c1('0x68'),_0x1f26b2,_0x43a2c0));return uploadFile(_0x247ae2,_0x53c0e1,_0x245c92,_0x43a2c0,path['basename'](_0x1fe62c),fs[_0x28c1('0x69')](_0x1fe62c))[_0x28c1('0x23')](function(_0x449704){logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')](_0x28c1('0x6a'),_0x1f26b2,_0x43a2c0,_0x449704[_0x28c1('0x6b')]));_0x1c3a94[_0x28c1('0x6c')]=_0x449704['Bucket'];_0x1c3a94[_0x28c1('0x6d')]=_0x449704[_0x28c1('0x6b')];logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')](_0x28c1('0x6e'),_0x1f26b2));return startTranscribe(_0x247ae2,_0x53c0e1,_0x245c92,uuidv4(),_0x3a715c,_0x449704[_0x28c1('0x6b')]);})[_0x28c1('0x23')](function(_0x2cdf5c){logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')](_0x28c1('0x6f'),_0x1f26b2,_0x2cdf5c[_0x28c1('0x70')][_0x28c1('0x71')]));_0x1c3a94[_0x28c1('0x72')]=_0x2cdf5c[_0x28c1('0x70')][_0x28c1('0x71')];_0x1c3a94['transcribeStatus']=_0x2cdf5c[_0x28c1('0x70')][_0x28c1('0x73')];return _0x20bf7e(_0x1c3a94);})['catch'](function(_0x428244){return _0x101d11(_0x428244);});});}exports['runTranscribe']=function(_0x6e58a9,_0x5549f9,_0x55ee4d){var _0x33ab67;var _0x2e7063;var _0x1b0b30;var _0x21afcf=require('../../components/encryptor');return db[_0x28c1('0x27')]['findOne']({'where':{'id':_0x6e58a9[_0x28c1('0x43')]['id']}})['then'](function(_0xed5a6d){if(_0xed5a6d){var _0x2fdf75=util[_0x28c1('0x2d')](_0x28c1('0x5d'),_0xed5a6d[_0x28c1('0x4b')]);if(fs[_0x28c1('0x4c')](_0x2fdf75)){cypher=!![];return _0x21afcf[_0x28c1('0x5e')](_0x2fdf75,_0xed5a6d['value'],config[_0x28c1('0x4d')][_0x28c1('0x4e')])[_0x28c1('0x23')](function(){return _0xed5a6d;});}return _0xed5a6d;}})[_0x28c1('0x23')](function(_0x9f3111){if(!_0x9f3111){throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))](_0x28c1('0x75'));}_0x2e7063=_0x9f3111;return db[_0x28c1('0x76')]['findOne']({'where':{'id':0x1}});})[_0x28c1('0x23')](handleEntityNotFound(_0x5549f9,null))[_0x28c1('0x23')](function(_0x573aa3){if(_0x573aa3){_0x33ab67=_0x573aa3;if(!_0x33ab67['transcribe']||!_0x33ab67[_0x28c1('0x77')]||!_0x33ab67['transcribeRegion']||!_0x33ab67['language']||!_0x33ab67[_0x28c1('0x6c')]){throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))]('Transcribe\x20not\x20configured');}if(_0x6e58a9['body'][_0x28c1('0x78')]&&(!_0x33ab67[_0x28c1('0x79')]||!_0x33ab67[_0x28c1('0x7a')]||!_0x33ab67[_0x28c1('0x7b')]||!_0x33ab67[_0x28c1('0x7c')]||!_0x33ab67[_0x28c1('0x6c')])){throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))](_0x28c1('0x7d'));}return db[_0x28c1('0x7e')][_0x28c1('0x7f')]({'where':{'id':_0x33ab67[_0x28c1('0x77')]}});}})['then'](function(_0x350df5){if(!_0x350df5){throw new db['Sequelize'][(_0x28c1('0x4f'))](_0x28c1('0x80'));}if(!_0x350df5[_0x28c1('0x81')]||!_0x350df5[_0x28c1('0x82')]){throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))](_0x28c1('0x83'));}_0x1b0b30=_0x350df5;return getBucketslist(_0x1b0b30[_0x28c1('0x81')],_0x1b0b30['data2'],_0x33ab67[_0x28c1('0x84')]);})['then'](function(_0x21585a){if(_0x21585a&&_0x21585a[_0x28c1('0x85')]){var _0x524f51=_[_0x28c1('0x47')](_0x21585a[_0x28c1('0x85')],function(_0x2dc4db){return _0x2dc4db['Name']===_0x33ab67['bucket'];});if(!_0x524f51){logger['info'](util['format'](_0x28c1('0x86'),_0x6e58a9[_0x28c1('0x43')]['id'],_0x33ab67[_0x28c1('0x6c')]));return createBucket(_0x1b0b30[_0x28c1('0x81')],_0x1b0b30[_0x28c1('0x82')],_0x33ab67[_0x28c1('0x84')],_0x33ab67[_0x28c1('0x6c')]);}logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x6e58a9['params']['id'],_0x33ab67[_0x28c1('0x6c')]));return;}})[_0x28c1('0x23')](function(_0x403f50){if(_0x2e7063['transcribeStatus']==='NEW'){return transcribe(_0x6e58a9[_0x28c1('0x43')]['id'],_0x1b0b30[_0x28c1('0x81')],_0x1b0b30['data2'],_0x33ab67[_0x28c1('0x84')],_0x33ab67[_0x28c1('0x6c')],_0x2e7063['value'],_0x33ab67['language']);}else{logger[_0x28c1('0x5f')](util['format'](_0x28c1('0x87'),_0x6e58a9[_0x28c1('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x28c1('0x23')](function(_0x3dd6a0){if(_0x3dd6a0){_0x3dd6a0[_0x28c1('0x88')]=_0x6e58a9[_0x28c1('0x46')][_0x28c1('0x78')];return _0x2e7063[_0x28c1('0x89')](_0x3dd6a0);}})[_0x28c1('0x23')](respondWithResult(_0x5549f9,null))[_0x28c1('0x41')](handleError(_0x5549f9,null));};function writeFile(_0x4508a1,_0x76efc){return new Promise(function(_0x53ce83,_0x3a2b5c){fs[_0x28c1('0x8a')](_0x76efc,_0x4508a1,function(_0xbfaecf,_0x5d8121){if(_0xbfaecf){return _0x3a2b5c(_0xbfaecf);}else{return _0x53ce83(_0x5d8121);}});});}exports['downloadTranscribe']=function(_0xcc8f97,_0x351b4e,_0x1307fc){return db[_0x28c1('0x27')][_0x28c1('0x7f')]({'where':{'id':_0xcc8f97[_0x28c1('0x43')]['id']}})[_0x28c1('0x23')](handleEntityNotFound(_0x351b4e))['then'](function(_0xddb39e){if(_0xddb39e&&_0xddb39e[_0x28c1('0x8b')]){var _0x568045=_0xddb39e[_0x28c1('0x8b')];var _0x2a5c1c=config['root']+_0x28c1('0x8c')+_0xddb39e['id']+_0x28c1('0x8d');if(fs[_0x28c1('0x4c')](_0x2a5c1c)){return _0x2a5c1c;}return writeFile(_0x568045,_0x2a5c1c)[_0x28c1('0x23')](function(){return _0x2a5c1c;});}else{throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))](_0x28c1('0x8e'));}})['then'](function(_0x89ec54){return _0x351b4e['download'](_0x89ec54);})[_0x28c1('0x41')](handleError(_0x351b4e));}; \ No newline at end of file +var _0xbbed=['reject','update','then','destroy','status','error','stack','name','index','map','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','VoiceRecording','rows','params','rawAttributes','include','find','catch','body','../../components/encryptor','uniqueid','value','existsSync','secrets','recording','Sequelize','ValidationError','filename','download','extname','unlink','message','downloads','sequelize','MD5','token','$and','push','%s.cypher','VoiceRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','transcribeName','TranscriptionJobName','TranscriptionJob','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','transcribeRegion','transcribeStatus','tempSentiment','writeFile','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','limit','undefined','count','offset','set','Content-Range','apply'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbbed,0x199));var _0xdbbe=function(_0x422aa4,_0x21508e){_0x422aa4=_0x422aa4-0x0;var _0x139a00=_0xbbed[_0x422aa4];return _0x139a00;};'use strict';var emlformat=require(_0xdbbe('0x0'));var rimraf=require(_0xdbbe('0x1'));var zipdir=require(_0xdbbe('0x2'));var jsonpatch=require(_0xdbbe('0x3'));var rp=require(_0xdbbe('0x4'));var moment=require(_0xdbbe('0x5'));var BPromise=require(_0xdbbe('0x6'));var Mustache=require(_0xdbbe('0x7'));var util=require(_0xdbbe('0x8'));var path=require(_0xdbbe('0x9'));var sox=require(_0xdbbe('0xa'));var csv=require('to-csv');var ejs=require(_0xdbbe('0xb'));var fs=require('fs');var fs_extra=require(_0xdbbe('0xc'));var _=require(_0xdbbe('0xd'));var squel=require(_0xdbbe('0xe'));var crypto=require(_0xdbbe('0xf'));var jsforce=require(_0xdbbe('0x10'));var deskjs=require(_0xdbbe('0x11'));var toCsv=require(_0xdbbe('0x12'));var querystring=require(_0xdbbe('0x13'));var Papa=require(_0xdbbe('0x14'));var AWS=require(_0xdbbe('0x15'));var uuidv4=require(_0xdbbe('0x16'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdbbe('0x17'));var as=require(_0xdbbe('0x18'));var hardwareService=require(_0xdbbe('0x19'));var logger=require(_0xdbbe('0x1a'))(_0xdbbe('0x1b'));var utils=require(_0xdbbe('0x1c'));var config=require(_0xdbbe('0x1d'));var licenseUtil=require(_0xdbbe('0x1e'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16cd80,_0x3e2099){_0x3e2099=_0x3e2099||0xcc;return function(_0x5eb26b){if(_0x5eb26b){return _0x16cd80[_0xdbbe('0x1f')](_0x3e2099);}return _0x16cd80['status'](_0x3e2099)[_0xdbbe('0x20')]();};}function respondWithResult(_0x2c83bc,_0x3bc702){_0x3bc702=_0x3bc702||0xc8;return function(_0x24fb42){if(_0x24fb42){return _0x2c83bc['status'](_0x3bc702)[_0xdbbe('0x21')](_0x24fb42);}};}function respondWithFilteredResult(_0x107e33,_0x3037ce){return function(_0x31ba9c){if(_0x31ba9c){var _0x208ccc=typeof _0x3037ce['offset']==='undefined'&&typeof _0x3037ce[_0xdbbe('0x22')]===_0xdbbe('0x23');var _0x835365=_0x31ba9c[_0xdbbe('0x24')];var _0x49f827=_0x208ccc?0x0:_0x3037ce[_0xdbbe('0x25')];var _0x4784f4=_0x208ccc?_0x31ba9c['count']:_0x3037ce[_0xdbbe('0x25')]+_0x3037ce[_0xdbbe('0x22')];var _0x30eb;if(_0x4784f4>=_0x835365){_0x4784f4=_0x835365;_0x30eb=0xc8;}else{_0x30eb=0xce;}_0x107e33['status'](_0x30eb);return _0x107e33[_0xdbbe('0x26')](_0xdbbe('0x27'),_0x49f827+'-'+_0x4784f4+'/'+_0x835365)[_0xdbbe('0x21')](_0x31ba9c);}return null;};}function patchUpdates(_0x1b3c96){return function(_0x4d3536){try{jsonpatch[_0xdbbe('0x28')](_0x4d3536,_0x1b3c96,!![]);}catch(_0x708ceb){return BPromise[_0xdbbe('0x29')](_0x708ceb);}return _0x4d3536['save']();};}function saveUpdates(_0x4eb72d,_0x35695d){return function(_0x39c732){if(_0x39c732){return _0x39c732[_0xdbbe('0x2a')](_0x4eb72d)[_0xdbbe('0x2b')](function(_0x35640c){return _0x35640c;});}return null;};}function removeEntity(_0x159f51,_0x125646){return function(_0x1f017d){if(_0x1f017d){return _0x1f017d[_0xdbbe('0x2c')]()['then'](function(){_0x159f51[_0xdbbe('0x2d')](0xcc)[_0xdbbe('0x20')]();});}};}function handleEntityNotFound(_0x2104b8,_0x521e3a){return function(_0x35be0a){if(!_0x35be0a){_0x2104b8['sendStatus'](0x194);}return _0x35be0a;};}function handleError(_0x163d44,_0x793a7a){_0x793a7a=_0x793a7a||0x1f4;return function(_0x16c537){logger[_0xdbbe('0x2e')](_0x16c537[_0xdbbe('0x2f')]);if(_0x16c537[_0xdbbe('0x30')]){delete _0x16c537[_0xdbbe('0x30')];}_0x163d44['status'](_0x793a7a)['send'](_0x16c537);};}exports[_0xdbbe('0x31')]=function(_0x31327d,_0x24c66f){var _0x543d5f={},_0x362634={},_0x3caf49={'count':0x0,'rows':[]};var _0x10f840=_[_0xdbbe('0x32')](db['VoiceRecording']['rawAttributes'],function(_0x2df6f9){return{'name':_0x2df6f9[_0xdbbe('0x33')],'type':_0x2df6f9[_0xdbbe('0x34')][_0xdbbe('0x35')]};});_0x362634[_0xdbbe('0x36')]=_[_0xdbbe('0x37')](_[_0xdbbe('0x32')](_0x10f840,_0xdbbe('0x30')),[_0xdbbe('0x38')]);_0x362634['query']=_[_0xdbbe('0x39')](_0x31327d[_0xdbbe('0x3a')]);_0x362634[_0xdbbe('0x3b')]=_[_0xdbbe('0x3c')](_0x362634[_0xdbbe('0x36')],_0x362634[_0xdbbe('0x3a')]);_0x543d5f[_0xdbbe('0x3d')]=_[_0xdbbe('0x3c')](_0x362634[_0xdbbe('0x36')],qs[_0xdbbe('0x3e')](_0x31327d[_0xdbbe('0x3a')][_0xdbbe('0x3e')]));_0x543d5f[_0xdbbe('0x3d')]=_0x543d5f[_0xdbbe('0x3d')][_0xdbbe('0x3f')]?_0x543d5f[_0xdbbe('0x3d')]:_0x362634[_0xdbbe('0x36')];if(!_0x31327d[_0xdbbe('0x3a')][_0xdbbe('0x40')](_0xdbbe('0x41'))){_0x543d5f[_0xdbbe('0x22')]=qs[_0xdbbe('0x22')](_0x31327d['query'][_0xdbbe('0x22')]);_0x543d5f[_0xdbbe('0x25')]=qs['offset'](_0x31327d[_0xdbbe('0x3a')]['offset']);}_0x543d5f[_0xdbbe('0x42')]=qs[_0xdbbe('0x43')](_0x31327d[_0xdbbe('0x3a')][_0xdbbe('0x43')]);_0x543d5f['where']=qs[_0xdbbe('0x3b')](_[_0xdbbe('0x44')](_0x31327d[_0xdbbe('0x3a')],_0x362634['filters']),_0x10f840);if(_0x31327d[_0xdbbe('0x3a')][_0xdbbe('0x45')]){_0x543d5f[_0xdbbe('0x46')]=_[_0xdbbe('0x47')](_0x543d5f[_0xdbbe('0x46')],{'$or':_['map'](_0x10f840,function(_0x60531b){if(_0x60531b[_0xdbbe('0x34')]!=='VIRTUAL'){var _0x2fd857={};_0x2fd857[_0x60531b[_0xdbbe('0x30')]]={'$like':'%'+_0x31327d[_0xdbbe('0x3a')][_0xdbbe('0x45')]+'%'};return _0x2fd857;}})});}_0x543d5f=_[_0xdbbe('0x47')]({},_0x543d5f,_0x31327d[_0xdbbe('0x48')]);var _0x2d9552={'where':_0x543d5f['where']};return db['VoiceRecording'][_0xdbbe('0x24')](_0x2d9552)[_0xdbbe('0x2b')](function(_0x4d4b30){_0x3caf49['count']=_0x4d4b30;if(_0x31327d['query'][_0xdbbe('0x49')]){_0x543d5f['include']=[{'all':!![]}];}return db[_0xdbbe('0x4a')]['findAll'](_0x543d5f);})['then'](function(_0x499720){_0x3caf49[_0xdbbe('0x4b')]=_0x499720;return _0x3caf49;})[_0xdbbe('0x2b')](respondWithFilteredResult(_0x24c66f,_0x543d5f))['catch'](handleError(_0x24c66f,null));};exports['show']=function(_0x14c991,_0x1cb08a){var _0x2616df={'raw':![],'where':{'id':_0x14c991[_0xdbbe('0x4c')]['id']}},_0x535522={};_0x535522[_0xdbbe('0x36')]=_[_0xdbbe('0x39')](db[_0xdbbe('0x4a')][_0xdbbe('0x4d')]);_0x535522[_0xdbbe('0x3a')]=_[_0xdbbe('0x39')](_0x14c991[_0xdbbe('0x3a')]);_0x535522[_0xdbbe('0x3b')]=_[_0xdbbe('0x3c')](_0x535522[_0xdbbe('0x36')],_0x535522['query']);_0x2616df[_0xdbbe('0x3d')]=_[_0xdbbe('0x3c')](_0x535522[_0xdbbe('0x36')],qs[_0xdbbe('0x3e')](_0x14c991['query'][_0xdbbe('0x3e')]));_0x2616df[_0xdbbe('0x3d')]=_0x2616df[_0xdbbe('0x3d')][_0xdbbe('0x3f')]?_0x2616df[_0xdbbe('0x3d')]:_0x535522['model'];if(_0x14c991['query'][_0xdbbe('0x49')]){_0x2616df[_0xdbbe('0x4e')]=[{'all':!![]}];}_0x2616df=_['merge']({},_0x2616df,_0x14c991['options']);return db[_0xdbbe('0x4a')][_0xdbbe('0x4f')](_0x2616df)[_0xdbbe('0x2b')](handleEntityNotFound(_0x1cb08a,null))[_0xdbbe('0x2b')](respondWithResult(_0x1cb08a,null))[_0xdbbe('0x50')](handleError(_0x1cb08a,null));};exports['create']=function(_0x3ebc5b,_0x4ef37e){return db['VoiceRecording']['create'](_0x3ebc5b['body'],{})[_0xdbbe('0x2b')](respondWithResult(_0x4ef37e,0xc9))[_0xdbbe('0x50')](handleError(_0x4ef37e,null));};exports[_0xdbbe('0x2a')]=function(_0x3271c3,_0x4ad18d){if(_0x3271c3[_0xdbbe('0x51')]['id']){delete _0x3271c3[_0xdbbe('0x51')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x3271c3[_0xdbbe('0x4c')]['id']}})[_0xdbbe('0x2b')](handleEntityNotFound(_0x4ad18d,null))['then'](saveUpdates(_0x3271c3[_0xdbbe('0x51')],null))['then'](respondWithResult(_0x4ad18d,null))['catch'](handleError(_0x4ad18d,null));};exports['describe']=function(_0xe69ff9,_0x16cbc6){return db[_0xdbbe('0x4a')]['describe']()['then'](respondWithResult(_0x16cbc6,null))[_0xdbbe('0x50')](handleError(_0x16cbc6,null));};exports['download']=function(_0x27a7c4,_0x5cddf0,_0x41851d){var _0xd84484=require(_0xdbbe('0x52'));var _0x2016a5=![];var _0x25c5e6={};if(_0x27a7c4[_0xdbbe('0x3a')][_0xdbbe('0x34')]&&_0x27a7c4[_0xdbbe('0x3a')][_0xdbbe('0x34')]===_0xdbbe('0x53')){_0x25c5e6[_0xdbbe('0x53')]=_0x27a7c4[_0xdbbe('0x4c')]['id'];}else{_0x25c5e6['id']=_0x27a7c4[_0xdbbe('0x4c')]['id'];}return db[_0xdbbe('0x4a')][_0xdbbe('0x4f')]({'where':_0x25c5e6,'attributes':['id',_0xdbbe('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x5cddf0,null))[_0xdbbe('0x2b')](function(_0x3f52f0){if(_0x3f52f0){var _0x5627be=_0x3f52f0[_0xdbbe('0x54')];var _0x168409=util[_0xdbbe('0x38')]('%s.cypher',_0x5627be);if(fs[_0xdbbe('0x55')](_0x168409)){_0x2016a5=!![];return _0xd84484['decryptFile'](_0x168409,_0x5627be,config[_0xdbbe('0x56')][_0xdbbe('0x57')])[_0xdbbe('0x2b')](function(){return _0x3f52f0;});}return _0x3f52f0;}})[_0xdbbe('0x2b')](function(_0x4dab30){if(_0x4dab30){var _0x552f09=_0x4dab30['value'];if(!fs[_0xdbbe('0x55')](_0x552f09)){throw new db[(_0xdbbe('0x58'))][(_0xdbbe('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x4dab30[_0xdbbe('0x5a')]){return _0x5cddf0[_0xdbbe('0x5b')](_0x552f09,_0x4dab30['filename']+path[_0xdbbe('0x5c')](_0x552f09),function(){if(_0x2016a5){fs[_0xdbbe('0x5d')](_0x552f09);}});}else{return _0x5cddf0[_0xdbbe('0x5b')](_0x552f09,function(_0x441898){if(_0x2016a5){fs[_0xdbbe('0x5d')](_0x552f09);}});}}})['catch'](function(_0xc08956){if(_0xc08956[_0xdbbe('0x5e')]==='VoiceRecording\x20not\x20found'){_0x5cddf0[_0xdbbe('0x2d')](0x194)['send']('Not\x20found');}else{return handleError(_0x5cddf0,null);}});};exports[_0xdbbe('0x5f')]=function(_0xe84117,_0x2f23b1,_0x3c2561){var _0x17712f=require('../../components/encryptor');var _0x1dabd4=![];var _0x17ed4a={'$and':[db[_0xdbbe('0x60')][_0xdbbe('0x46')](db['sequelize']['fn'](_0xdbbe('0x61'),db[_0xdbbe('0x60')]['col']('uniqueid')),_0xe84117[_0xdbbe('0x3a')][_0xdbbe('0x62')])]};if(_0xe84117['query'][_0xdbbe('0x34')]&&_0xe84117[_0xdbbe('0x3a')][_0xdbbe('0x34')]===_0xdbbe('0x53')){_0x17ed4a[_0xdbbe('0x63')]['push']({'uniqueid':_0xe84117['params']['id']});}else{_0x17ed4a[_0xdbbe('0x63')][_0xdbbe('0x64')]({'id':_0xe84117[_0xdbbe('0x4c')]['id']});}return db['VoiceRecording'][_0xdbbe('0x4f')]({'where':_0x17ed4a,'attributes':['id',_0xdbbe('0x54')],'raw':!![]})[_0xdbbe('0x2b')](handleEntityNotFound(_0x2f23b1,null))[_0xdbbe('0x2b')](function(_0x34d4ca){if(_0x34d4ca){var _0x2d3afa=util[_0xdbbe('0x38')](_0xdbbe('0x65'),_0x34d4ca[_0xdbbe('0x54')]);if(fs[_0xdbbe('0x55')](_0x2d3afa)){_0x1dabd4=!![];return _0x17712f['decryptFile'](_0x2d3afa,_0x34d4ca['value'],config[_0xdbbe('0x56')]['recording'])[_0xdbbe('0x2b')](function(){return _0x34d4ca;});}return _0x34d4ca;}})[_0xdbbe('0x2b')](function(_0x2f647f){if(_0x2f647f){if(!fs[_0xdbbe('0x55')](_0x2f647f[_0xdbbe('0x54')])){throw new db[(_0xdbbe('0x58'))][(_0xdbbe('0x59'))](_0xdbbe('0x66'));}if(_0x2f647f['filename']){return _0x2f23b1[_0xdbbe('0x5b')](_0x2f647f[_0xdbbe('0x54')],_0x2f647f[_0xdbbe('0x5a')]+path[_0xdbbe('0x5c')](_0x2f647f[_0xdbbe('0x54')]),function(){if(_0x1dabd4){fs[_0xdbbe('0x5d')](_0x2f647f['value']);}});}else{return _0x2f23b1[_0xdbbe('0x5b')](_0x2f647f[_0xdbbe('0x54')],function(_0x4cf487){if(_0x1dabd4){fs[_0xdbbe('0x5d')](_0x2f647f[_0xdbbe('0x54')]);}});}}})[_0xdbbe('0x50')](handleError(_0x2f23b1,null));};exports[_0xdbbe('0x2c')]=function(_0x53106b,_0x41838a){return db[_0xdbbe('0x4a')][_0xdbbe('0x4f')]({'where':{'id':_0x53106b['params']['id']}})[_0xdbbe('0x2b')](function(_0x1fbce9){if(_['isNil'](_0x1fbce9)){throw new ReferenceError(_0xdbbe('0x67'));}return _0x1fbce9;})[_0xdbbe('0x2b')](function(_0xe79dce){var _0x4804d5=_0xe79dce[_0xdbbe('0x54')];logger[_0xdbbe('0x68')](_0xdbbe('0x69'),_0x4804d5);if(!_[_0xdbbe('0x6a')](_0xe79dce[_0xdbbe('0x54')])&&fs[_0xdbbe('0x55')](_0x4804d5)){logger[_0xdbbe('0x68')](_0xdbbe('0x6b')+_0x4804d5+_0xdbbe('0x6c'));fs[_0xdbbe('0x6d')](_0x4804d5);}_0x4804d5=_0x4804d5+_0xdbbe('0x6e');if(!_[_0xdbbe('0x6a')](_0xe79dce[_0xdbbe('0x54')])&&fs['existsSync'](_0x4804d5)){logger[_0xdbbe('0x68')](_0xdbbe('0x6b')+_0x4804d5+_0xdbbe('0x6c'));fs[_0xdbbe('0x6d')](_0x4804d5);}return _0xe79dce;})[_0xdbbe('0x2b')](function(_0x5a6f76){if(!_0x5a6f76)throw new InternalError();return _0x5a6f76[_0xdbbe('0x2c')]();})[_0xdbbe('0x2b')](function(){_0x41838a[_0xdbbe('0x2d')](0xcc)[_0xdbbe('0x20')]();})['catch'](handleError(_0x41838a,null));};function getBucketslist(_0x317c77,_0x102cd4,_0x24ffa9){return new Promise(function(_0x368896,_0x2b66f7){var _0x32c681=new AWS['S3']({'accessKeyId':_0x102cd4,'secretAccessKey':_0x317c77,'region':_0x24ffa9});_0x32c681[_0xdbbe('0x6f')]({},function(_0x46c585,_0x8cf9f0){if(_0x46c585){return _0x2b66f7(_0x46c585);}else{return _0x368896(_0x8cf9f0);}});});}function createBucket(_0x1c44f2,_0x1144b9,_0x302f9b,_0x48febe){return new Promise(function(_0x58c97a,_0x49602b){var _0xd6ef6b=new AWS['S3']({'accessKeyId':_0x1144b9,'secretAccessKey':_0x1c44f2,'region':_0x302f9b});_0xd6ef6b[_0xdbbe('0x70')]({'Bucket':_0x48febe},function(_0x442ea2,_0x2576aa){if(_0x442ea2){return _0x49602b(_0x442ea2);}else{return _0x58c97a(_0x2576aa);}});});}function uploadFile(_0x591cb1,_0x4cca7a,_0x3f4a56,_0x1c5564,_0x1eb167,_0xab2048){return new Promise(function(_0x55f4bc,_0xacb40f){var _0x4f24b8=new AWS['S3']({'accessKeyId':_0x4cca7a,'secretAccessKey':_0x591cb1,'region':_0x3f4a56});_0x4f24b8[_0xdbbe('0x71')]({'Bucket':_0x1c5564,'Key':_0x1eb167,'Body':_0xab2048},function(_0x2d6f86,_0x465041){if(_0x2d6f86){return _0xacb40f(_0x2d6f86);}else{return _0x55f4bc(_0x465041);}});});}function startTranscribe(_0x1c78a4,_0x1a3ee5,_0x19bebf,_0x2178b2,_0x315ebf,_0x322bdb){return new Promise(function(_0x3e11a6,_0x22c42b){var _0x5b2810=new AWS[(_0xdbbe('0x72'))]({'accessKeyId':_0x1a3ee5,'secretAccessKey':_0x1c78a4,'region':_0x19bebf});_0x5b2810[_0xdbbe('0x73')]({'TranscriptionJobName':_0x2178b2,'LanguageCode':_0x315ebf,'Media':{'MediaFileUri':_0x322bdb}},function(_0x156305,_0x399525){if(_0x156305){return _0x22c42b(_0x156305);}else{return _0x3e11a6(_0x399525);}});});}function transcribe(_0x10ab55,_0x30cab0,_0x350e37,_0x58356,_0x5ae1e8,_0x1e1b16,_0x3f304d){return new Promise(function(_0x3187e6,_0x2d9497){var _0x5d7139={};logger[_0xdbbe('0x68')](util[_0xdbbe('0x38')](_0xdbbe('0x74'),_0x10ab55,_0x5ae1e8));return uploadFile(_0x30cab0,_0x350e37,_0x58356,_0x5ae1e8,path[_0xdbbe('0x75')](_0x1e1b16),fs['readFileSync'](_0x1e1b16))[_0xdbbe('0x2b')](function(_0x21626e){logger[_0xdbbe('0x68')](util[_0xdbbe('0x38')](_0xdbbe('0x76'),_0x10ab55,_0x5ae1e8,_0x21626e[_0xdbbe('0x77')]));_0x5d7139[_0xdbbe('0x78')]=_0x21626e['Bucket'];_0x5d7139[_0xdbbe('0x79')]=_0x21626e['Location'];logger[_0xdbbe('0x68')](util[_0xdbbe('0x38')](_0xdbbe('0x7a'),_0x10ab55));return startTranscribe(_0x30cab0,_0x350e37,_0x58356,uuidv4(),_0x3f304d,_0x21626e['Location']);})[_0xdbbe('0x2b')](function(_0xfa2c9e){logger[_0xdbbe('0x68')](util[_0xdbbe('0x38')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x10ab55,_0xfa2c9e['TranscriptionJob']['TranscriptionJobName']));_0x5d7139[_0xdbbe('0x7b')]=_0xfa2c9e['TranscriptionJob'][_0xdbbe('0x7c')];_0x5d7139['transcribeStatus']=_0xfa2c9e[_0xdbbe('0x7d')][_0xdbbe('0x7e')];return _0x3187e6(_0x5d7139);})[_0xdbbe('0x50')](function(_0xba8f17){return _0x2d9497(_0xba8f17);});});}exports['runTranscribe']=function(_0x23789d,_0x3fd3bd,_0x886d16){var _0x125be5;var _0x38195e;var _0x41d758;var _0x1654df=require('../../components/encryptor');return db[_0xdbbe('0x4a')][_0xdbbe('0x7f')]({'where':{'id':_0x23789d[_0xdbbe('0x4c')]['id']}})[_0xdbbe('0x2b')](function(_0x449040){if(_0x449040){var _0x18aa6c=util[_0xdbbe('0x38')](_0xdbbe('0x65'),_0x449040['value']);if(fs[_0xdbbe('0x55')](_0x18aa6c)){cypher=!![];return _0x1654df['decryptFile'](_0x18aa6c,_0x449040['value'],config[_0xdbbe('0x56')][_0xdbbe('0x57')])[_0xdbbe('0x2b')](function(){return _0x449040;});}return _0x449040;}})[_0xdbbe('0x2b')](function(_0x2ac943){if(!_0x2ac943){throw new db[(_0xdbbe('0x58'))]['ValidationError'](_0xdbbe('0x80'));}_0x38195e=_0x2ac943;return db['Setting'][_0xdbbe('0x7f')]({'where':{'id':0x1}});})[_0xdbbe('0x2b')](handleEntityNotFound(_0x3fd3bd,null))[_0xdbbe('0x2b')](function(_0x297c92){if(_0x297c92){_0x125be5=_0x297c92;if(!_0x125be5[_0xdbbe('0x81')]||!_0x125be5[_0xdbbe('0x82')]||!_0x125be5['transcribeRegion']||!_0x125be5['language']||!_0x125be5[_0xdbbe('0x78')]){throw new db['Sequelize'][(_0xdbbe('0x59'))](_0xdbbe('0x83'));}if(_0x23789d[_0xdbbe('0x51')][_0xdbbe('0x84')]&&(!_0x125be5[_0xdbbe('0x85')]||!_0x125be5[_0xdbbe('0x86')]||!_0x125be5['sentimentRegion']||!_0x125be5['language']||!_0x125be5[_0xdbbe('0x78')])){throw new db[(_0xdbbe('0x58'))][(_0xdbbe('0x59'))](_0xdbbe('0x87'));}return db[_0xdbbe('0x88')]['findOne']({'where':{'id':_0x125be5['transcribeAccountId']}});}})[_0xdbbe('0x2b')](function(_0x4b614d){if(!_0x4b614d){throw new db[(_0xdbbe('0x58'))][(_0xdbbe('0x59'))](_0xdbbe('0x89'));}if(!_0x4b614d[_0xdbbe('0x8a')]||!_0x4b614d[_0xdbbe('0x8b')]){throw new db[(_0xdbbe('0x58'))]['ValidationError'](_0xdbbe('0x8c'));}_0x41d758=_0x4b614d;return getBucketslist(_0x41d758['data1'],_0x41d758[_0xdbbe('0x8b')],_0x125be5['transcribeRegion']);})['then'](function(_0x4c2b40){if(_0x4c2b40&&_0x4c2b40[_0xdbbe('0x8d')]){var _0x3794ab=_[_0xdbbe('0x4f')](_0x4c2b40[_0xdbbe('0x8d')],function(_0x326863){return _0x326863['Name']===_0x125be5[_0xdbbe('0x78')];});if(!_0x3794ab){logger[_0xdbbe('0x68')](util[_0xdbbe('0x38')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x23789d[_0xdbbe('0x4c')]['id'],_0x125be5[_0xdbbe('0x78')]));return createBucket(_0x41d758['data1'],_0x41d758[_0xdbbe('0x8b')],_0x125be5[_0xdbbe('0x8e')],_0x125be5[_0xdbbe('0x78')]);}logger[_0xdbbe('0x68')](util[_0xdbbe('0x38')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x23789d[_0xdbbe('0x4c')]['id'],_0x125be5[_0xdbbe('0x78')]));return;}})[_0xdbbe('0x2b')](function(_0x360fc8){if(_0x38195e[_0xdbbe('0x8f')]==='NEW'){return transcribe(_0x23789d[_0xdbbe('0x4c')]['id'],_0x41d758['data1'],_0x41d758['data2'],_0x125be5[_0xdbbe('0x8e')],_0x125be5[_0xdbbe('0x78')],_0x38195e[_0xdbbe('0x54')],_0x125be5['language']);}else{logger[_0xdbbe('0x68')](util[_0xdbbe('0x38')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x23789d[_0xdbbe('0x4c')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xdbbe('0x2b')](function(_0x278e69){if(_0x278e69){_0x278e69[_0xdbbe('0x90')]=_0x23789d['body'][_0xdbbe('0x84')];return _0x38195e['updateAttributes'](_0x278e69);}})[_0xdbbe('0x2b')](respondWithResult(_0x3fd3bd,null))[_0xdbbe('0x50')](handleError(_0x3fd3bd,null));};function writeFile(_0x7abea4,_0x100850){return new Promise(function(_0xd3bbfc,_0x2f8d46){fs[_0xdbbe('0x91')](_0x100850,_0x7abea4,function(_0xc7cff6,_0x41337c){if(_0xc7cff6){return _0x2f8d46(_0xc7cff6);}else{return _0xd3bbfc(_0x41337c);}});});}exports['downloadTranscribe']=function(_0x2fa3a0,_0x8296b2,_0x494ab5){return db[_0xdbbe('0x4a')][_0xdbbe('0x7f')]({'where':{'id':_0x2fa3a0[_0xdbbe('0x4c')]['id']}})[_0xdbbe('0x2b')](handleEntityNotFound(_0x8296b2))[_0xdbbe('0x2b')](function(_0x55ea3c){if(_0x55ea3c&&_0x55ea3c[_0xdbbe('0x92')]){var _0x11ac3c=_0x55ea3c['fileText'];var _0x403537=config[_0xdbbe('0x93')]+'/server/files/transcribes/transcribe_'+_0x55ea3c['id']+_0xdbbe('0x94');if(fs[_0xdbbe('0x55')](_0x403537)){return _0x403537;}return writeFile(_0x11ac3c,_0x403537)[_0xdbbe('0x2b')](function(){return _0x403537;});}else{throw new db[(_0xdbbe('0x58'))][(_0xdbbe('0x59'))](_0xdbbe('0x95'));}})[_0xdbbe('0x2b')](function(_0x39ce40){return _0x8296b2[_0xdbbe('0x5b')](_0x39ce40);})[_0xdbbe('0x50')](handleError(_0x8296b2));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ad4a0e9..6ae8e20 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 _0xca66=['define','VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xca66,0x8b));var _0x6ca6=function(_0x206494,_0x3e8c0d){_0x206494=_0x206494-0x0;var _0x2376fd=_0xca66[_0x206494];return _0x2376fd;};'use strict';var attributes=require(_0x6ca6('0x0'));module['exports']=function(_0x5bad57,_0x43246d){return _0x5bad57[_0x6ca6('0x1')](_0x6ca6('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x6ca6('0x3'),'fields':['uniqueid']},{'name':_0x6ca6('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x89c3=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x321ccf,_0x2e780d){var _0x3a9a2a=function(_0x3291c2){while(--_0x3291c2){_0x321ccf['push'](_0x321ccf['shift']());}};_0x3a9a2a(++_0x2e780d);}(_0x89c3,0xff));var _0x389c=function(_0x55f2a9,_0x122b5e){_0x55f2a9=_0x55f2a9-0x0;var _0x1c1751=_0x89c3[_0x55f2a9];return _0x1c1751;};'use strict';var attributes=require(_0x389c('0x0'));module[_0x389c('0x1')]=function(_0x462669,_0x56e907){return _0x462669[_0x389c('0x2')](_0x389c('0x3'),attributes,{'tableName':_0x389c('0x4'),'paranoid':![],'indexes':[{'name':_0x389c('0x5'),'fields':['uniqueid']},{'name':_0x389c('0x6'),'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 68f1c76..d393b20 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 _0x6050=['existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','../../components/encryptor','Setting','findOne','callRecordingEncryption'];(function(_0x558d7c,_0x2bb3c2){var _0x4f720e=function(_0xf4f835){while(--_0xf4f835){_0x558d7c['push'](_0x558d7c['shift']());}};_0x4f720e(++_0x2bb3c2);}(_0x6050,0x196));var _0x0605=function(_0x39b802,_0x216248){_0x39b802=_0x39b802-0x0;var _0x25918d=_0x6050[_0x39b802];return _0x25918d;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});}exports[_0x0605('0x16')]=function(_0x2b7b5a){var _0x1d57ba=this;return new Promise(function(_0x193520,_0x40abb2){return db[_0x0605('0x17')][_0x0605('0x18')](_0x2b7b5a[_0x0605('0x19')],{'raw':_0x2b7b5a[_0x0605('0x1a')]?_0x2b7b5a['options'][_0x0605('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b7b5a[_0x0605('0x1a')]?_0x2b7b5a[_0x0605('0x1a')][_0x0605('0x1c')]||null:null,'attributes':_0x2b7b5a[_0x0605('0x1a')]?_0x2b7b5a[_0x0605('0x1a')][_0x0605('0x1d')]||null:null,'limit':_0x2b7b5a[_0x0605('0x1a')]?_0x2b7b5a[_0x0605('0x1a')]['limit']||null:null})[_0x0605('0xb')](function(_0x4fe293){logger[_0x0605('0x14')](_0x0605('0x16'),_0x2b7b5a);logger[_0x0605('0xe')](_0x0605('0x16'),_0x2b7b5a,JSON[_0x0605('0x10')](_0x4fe293));_0x193520(_0x4fe293);})[_0x0605('0x15')](function(_0x2ea61d){logger[_0x0605('0x11')](_0x0605('0x16'),_0x2ea61d[_0x0605('0x13')],_0x2b7b5a);_0x40abb2(_0x1d57ba[_0x0605('0x11')](0x1f4,_0x2ea61d[_0x0605('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x6bc204){var _0x3c8e36=this;return new Promise(function(_0x4b1e0c,_0x4d9a31){var _0x55ebd8=require(_0x0605('0x1e'));var _0x226825;return db[_0x0605('0x1f')][_0x0605('0x20')]({'attributes':['id',_0x0605('0x21')],'where':{'id':0x1},'raw':!![]})[_0x0605('0xb')](function(_0x4e32ef){_0x226825=_0x4e32ef;return db[_0x0605('0x17')]['create'](_0x6bc204[_0x0605('0x19')]);})[_0x0605('0xb')](function(_0x421c26){if(_0x226825[_0x0605('0x21')]&&fs[_0x0605('0x22')](_0x421c26[_0x0605('0x23')])){var _0x56dd1a=util[_0x0605('0x24')](_0x0605('0x25'),_0x421c26[_0x0605('0x23')]);return _0x55ebd8[_0x0605('0x26')](_0x421c26[_0x0605('0x23')],_0x56dd1a,config[_0x0605('0x27')][_0x0605('0x28')])[_0x0605('0xb')](function(){fs[_0x0605('0x29')](_0x421c26[_0x0605('0x23')]);logger[_0x0605('0x14')](_0x0605('0x2a'));return _0x421c26;});}return _0x421c26;})[_0x0605('0xb')](function(_0x992e4f){logger[_0x0605('0x14')](_0x0605('0x2b'),_0x6bc204);logger[_0x0605('0xe')](_0x0605('0x2b'),_0x6bc204,JSON[_0x0605('0x10')](_0x992e4f));_0x4b1e0c(_0x992e4f);})[_0x0605('0x15')](function(_0x3a1c75){logger[_0x0605('0x11')](_0x0605('0x2b'),_0x3a1c75[_0x0605('0x13')],_0x6bc204);_0x4d9a31(_0x3c8e36[_0x0605('0x11')](0x1f4,_0x3a1c75[_0x0605('0x13')]));});});}; \ No newline at end of file +var _0x8f4c=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x213180,_0x563e68){var _0x274663=function(_0x586ead){while(--_0x586ead){_0x213180['push'](_0x213180['shift']());}};_0x274663(++_0x563e68);}(_0x8f4c,0x113));var _0xc8f4=function(_0xef8337,_0xa3b04a){_0xef8337=_0xef8337-0x0;var _0x278454=_0x8f4c[_0xef8337];return _0x278454;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108076[_0xc8f4('0x1b')]?_0x108076['options'][_0xc8f4('0x1d')]||null:null,'attributes':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1e')]||null:null,'limit':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x5e62aa){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON['stringify'](_0x5e62aa));_0x4763c1(_0x5e62aa);})[_0xc8f4('0x16')](function(_0x4a44e0){logger[_0xc8f4('0x11')]('UpdateVoiceRecording',_0x4a44e0[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0x4a44e0['message']));});});};exports[_0xc8f4('0x20')]=function(_0x21062f){var _0x11f766=this;return new Promise(function(_0x2fa052,_0x4ce586){var _0x3db490=require(_0xc8f4('0x21'));var _0x5db666;return db[_0xc8f4('0x22')][_0xc8f4('0x23')]({'attributes':['id',_0xc8f4('0x24')],'where':{'id':0x1},'raw':!![]})[_0xc8f4('0xb')](function(_0x24bef0){_0x5db666=_0x24bef0;return db[_0xc8f4('0x18')]['create'](_0x21062f[_0xc8f4('0x1a')]);})[_0xc8f4('0xb')](function(_0x1ea3d9){if(_0x5db666['callRecordingEncryption']&&fs[_0xc8f4('0x25')](_0x1ea3d9[_0xc8f4('0x26')])){var _0x5ab6cb=util['format']('%s.cypher',_0x1ea3d9[_0xc8f4('0x26')]);return _0x3db490[_0xc8f4('0x27')](_0x1ea3d9[_0xc8f4('0x26')],_0x5ab6cb,config[_0xc8f4('0x28')][_0xc8f4('0x29')])[_0xc8f4('0xb')](function(){fs[_0xc8f4('0x2a')](_0x1ea3d9[_0xc8f4('0x26')]);logger['info'](_0xc8f4('0x2b'));return _0x1ea3d9;});}return _0x1ea3d9;})[_0xc8f4('0xb')](function(_0x3910f3){logger['info'](_0xc8f4('0x20'),_0x21062f);logger[_0xc8f4('0xe')]('CreateVoiceRecording',_0x21062f,JSON[_0xc8f4('0x10')](_0x3910f3));_0x2fa052(_0x3910f3);})[_0xc8f4('0x16')](function(_0x36f24f){logger['error'](_0xc8f4('0x20'),_0x36f24f[_0xc8f4('0x13')],_0x21062f);_0x4ce586(_0x11f766[_0xc8f4('0x11')](0x1f4,_0x36f24f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 25ace42..3cdf29d 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 _0x2f2f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','post','create','destroy','exports','connect-timeout'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x2f2f,0x14f));var _0xf2f2=function(_0x91ca39,_0x402d37){_0x91ca39=_0x91ca39-0x0;var _0x24f214=_0x2f2f[_0x91ca39];return _0x24f214;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf2f2('0x0'));var express=require(_0xf2f2('0x1'));var router=express[_0xf2f2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf2f2('0x3'));var interaction=require(_0xf2f2('0x4'));var config=require(_0xf2f2('0x5'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf2f2('0x6')]);router[_0xf2f2('0x7')](_0xf2f2('0x8'),auth['isAuthenticated'](),controller[_0xf2f2('0x9')]);router[_0xf2f2('0x7')](_0xf2f2('0xa'),auth[_0xf2f2('0xb')](),controller['show']);router[_0xf2f2('0xc')]('/',auth[_0xf2f2('0xb')](),controller[_0xf2f2('0xd')]);router['put'](_0xf2f2('0xa'),auth[_0xf2f2('0xb')](),controller['update']);router['delete'](_0xf2f2('0xa'),auth[_0xf2f2('0xb')](),controller[_0xf2f2('0xe')]);module[_0xf2f2('0xf')]=router; \ No newline at end of file +var _0x39d0=['index','/describe','describe','show','post','create','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x209575,_0x417ae0){var _0x5b183d=function(_0x353a2c){while(--_0x353a2c){_0x209575['push'](_0x209575['shift']());}};_0x5b183d(++_0x417ae0);}(_0x39d0,0x118));var _0x039d=function(_0x3434a4,_0x4004e4){_0x3434a4=_0x3434a4-0x0;var _0x4cbb4b=_0x39d0[_0x3434a4];return _0x4cbb4b;};'use strict';var multer=require(_0x039d('0x0'));var util=require('util');var path=require(_0x039d('0x1'));var timeout=require(_0x039d('0x2'));var express=require(_0x039d('0x3'));var router=express['Router']();var fs_extra=require(_0x039d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x039d('0x5'));router[_0x039d('0x6')]('/',auth[_0x039d('0x7')](),controller[_0x039d('0x8')]);router['get'](_0x039d('0x9'),auth[_0x039d('0x7')](),controller[_0x039d('0xa')]);router[_0x039d('0x6')]('/:id',auth[_0x039d('0x7')](),controller[_0x039d('0xb')]);router[_0x039d('0xc')]('/',auth['isAuthenticated'](),controller[_0x039d('0xd')]);router['put'](_0x039d('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x039d('0xf')]('/:id',auth[_0x039d('0x7')](),controller[_0x039d('0x10')]);module[_0x039d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f58cf0b..d2e5b7d 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 _0x8e2b=['STRING','Yes','sequelize','exports','ENUM','blind','attended'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8e2b,0x1a6));var _0xb8e2=function(_0x2c31f0,_0x1f57b4){_0x2c31f0=_0x2c31f0-0x0;var _0xe0d53d=_0x8e2b[_0x2c31f0];return _0xe0d53d;};'use strict';var Sequelize=require(_0xb8e2('0x0'));var moment=require('moment');module[_0xb8e2('0x1')]={'type':{'type':Sequelize[_0xb8e2('0x2')](_0xb8e2('0x3'),_0xb8e2('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xb8e2('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xb8e2('0x5')]},'transferercalleridname':{'type':Sequelize[_0xb8e2('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb8e2('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb8e2('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xb8e2('0x5')]},'transferercontext':{'type':Sequelize[_0xb8e2('0x5')]},'transfererexten':{'type':Sequelize[_0xb8e2('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb8e2('0x5')]},'transfereechannel':{'type':Sequelize[_0xb8e2('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb8e2('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xb8e2('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb8e2('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb8e2('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xb8e2('0x5')]},'transfereecontext':{'type':Sequelize[_0xb8e2('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xb8e2('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xb8e2('0x6'),'No')},'context':{'type':Sequelize[_0xb8e2('0x5')]},'extension':{'type':Sequelize[_0xb8e2('0x5')]}}; \ No newline at end of file +var _0xe893=['moment','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x4cd9c6,_0x53b1f6){var _0x15a88d=function(_0x3ab18f){while(--_0x3ab18f){_0x4cd9c6['push'](_0x4cd9c6['shift']());}};_0x15a88d(++_0x53b1f6);}(_0xe893,0x16c));var _0x3e89=function(_0x54f415,_0x52be28){_0x54f415=_0x54f415-0x0;var _0xaca73b=_0xe893[_0x54f415];return _0xaca73b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3e89('0x0'));module[_0x3e89('0x1')]={'type':{'type':Sequelize[_0x3e89('0x2')](_0x3e89('0x3'),_0x3e89('0x4'))},'result':{'type':Sequelize[_0x3e89('0x5')]},'transfererchannel':{'type':Sequelize[_0x3e89('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x3e89('0x5')]},'transferercalleridname':{'type':Sequelize[_0x3e89('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3e89('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x3e89('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x3e89('0x5')]},'transferercontext':{'type':Sequelize[_0x3e89('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x3e89('0x5')]},'transfereechannel':{'type':Sequelize[_0x3e89('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x3e89('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x3e89('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3e89('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x3e89('0x5')]},'transfereecontext':{'type':Sequelize[_0x3e89('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x3e89('0x5')]},'isexternal':{'type':Sequelize[_0x3e89('0x2')](_0x3e89('0x6'),'No')},'context':{'type':Sequelize[_0x3e89('0x5')]},'extension':{'type':Sequelize[_0x3e89('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8572d6e..2e37695 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 _0xd731=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','VoiceTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','update','body','describe','eml-format','rimraf','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'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xd731,0xca));var _0x1d73=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd731[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x1d73('0x0'));var rimraf=require(_0x1d73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d73('0x2'));var moment=require(_0x1d73('0x3'));var BPromise=require(_0x1d73('0x4'));var Mustache=require(_0x1d73('0x5'));var util=require(_0x1d73('0x6'));var path=require(_0x1d73('0x7'));var sox=require(_0x1d73('0x8'));var csv=require(_0x1d73('0x9'));var ejs=require(_0x1d73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d73('0xb'));var squel=require(_0x1d73('0xc'));var crypto=require(_0x1d73('0xd'));var jsforce=require(_0x1d73('0xe'));var deskjs=require(_0x1d73('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d73('0x10'));var Redis=require(_0x1d73('0x11'));var authService=require(_0x1d73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1d73('0x13'));var hardwareService=require(_0x1d73('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1d73('0x15'));var config=require(_0x1d73('0x16'));var licenseUtil=require(_0x1d73('0x17'));var db=require(_0x1d73('0x18'))['db'];function respondWithStatusCode(_0x2326da,_0x42b10d){_0x42b10d=_0x42b10d||0xcc;return function(_0x255150){if(_0x255150){return _0x2326da['sendStatus'](_0x42b10d);}return _0x2326da[_0x1d73('0x19')](_0x42b10d)[_0x1d73('0x1a')]();};}function respondWithResult(_0x33e919,_0x1f4ca5){_0x1f4ca5=_0x1f4ca5||0xc8;return function(_0x29f30b){if(_0x29f30b){return _0x33e919[_0x1d73('0x19')](_0x1f4ca5)[_0x1d73('0x1b')](_0x29f30b);}};}function respondWithFilteredResult(_0x3096ce,_0x4d6934){return function(_0x2eba9d){if(_0x2eba9d){var _0x39008f=typeof _0x4d6934[_0x1d73('0x1c')]===_0x1d73('0x1d')&&typeof _0x4d6934[_0x1d73('0x1e')]===_0x1d73('0x1d');var _0x4998fb=_0x2eba9d[_0x1d73('0x1f')];var _0x3242fe=_0x39008f?0x0:_0x4d6934[_0x1d73('0x1c')];var _0x1ff144=_0x39008f?_0x2eba9d[_0x1d73('0x1f')]:_0x4d6934['offset']+_0x4d6934[_0x1d73('0x1e')];var _0x32179c;if(_0x1ff144>=_0x4998fb){_0x1ff144=_0x4998fb;_0x32179c=0xc8;}else{_0x32179c=0xce;}_0x3096ce['status'](_0x32179c);return _0x3096ce[_0x1d73('0x20')](_0x1d73('0x21'),_0x3242fe+'-'+_0x1ff144+'/'+_0x4998fb)[_0x1d73('0x1b')](_0x2eba9d);}return null;};}function patchUpdates(_0x582c6d){return function(_0x1f40d3){try{jsonpatch[_0x1d73('0x22')](_0x1f40d3,_0x582c6d,!![]);}catch(_0x246d98){return BPromise[_0x1d73('0x23')](_0x246d98);}return _0x1f40d3[_0x1d73('0x24')]();};}function saveUpdates(_0x4a901a,_0x441269){return function(_0x2707c2){if(_0x2707c2){return _0x2707c2['update'](_0x4a901a)['then'](function(_0x2f13b5){return _0x2f13b5;});}return null;};}function removeEntity(_0x5e19e7,_0x547f8d){return function(_0xe73678){if(_0xe73678){return _0xe73678['destroy']()[_0x1d73('0x25')](function(){_0x5e19e7[_0x1d73('0x19')](0xcc)[_0x1d73('0x1a')]();});}};}function handleEntityNotFound(_0x503e85,_0x57e8e0){return function(_0x1ea1a4){if(!_0x1ea1a4){_0x503e85['sendStatus'](0x194);}return _0x1ea1a4;};}function handleError(_0x37e717,_0x3ced0b){_0x3ced0b=_0x3ced0b||0x1f4;return function(_0x4bbed9){logger[_0x1d73('0x26')](_0x4bbed9[_0x1d73('0x27')]);if(_0x4bbed9[_0x1d73('0x28')]){delete _0x4bbed9['name'];}_0x37e717[_0x1d73('0x19')](_0x3ced0b)[_0x1d73('0x29')](_0x4bbed9);};}exports['index']=function(_0x3d3f80,_0x3dbf2e){var _0x9373f3={},_0x2de5b9={},_0x57e2f0={'count':0x0,'rows':[]};var _0x1edfd1=_[_0x1d73('0x2a')](db[_0x1d73('0x2b')][_0x1d73('0x2c')],function(_0x2463b8){return{'name':_0x2463b8['fieldName'],'type':_0x2463b8['type']['key']};});_0x2de5b9[_0x1d73('0x2d')]=_['map'](_0x1edfd1,_0x1d73('0x28'));_0x2de5b9['query']=_[_0x1d73('0x2e')](_0x3d3f80[_0x1d73('0x2f')]);_0x2de5b9[_0x1d73('0x30')]=_[_0x1d73('0x31')](_0x2de5b9['model'],_0x2de5b9[_0x1d73('0x2f')]);_0x9373f3[_0x1d73('0x32')]=_[_0x1d73('0x31')](_0x2de5b9['model'],qs['fields'](_0x3d3f80['query'][_0x1d73('0x33')]));_0x9373f3[_0x1d73('0x32')]=_0x9373f3[_0x1d73('0x32')][_0x1d73('0x34')]?_0x9373f3['attributes']:_0x2de5b9[_0x1d73('0x2d')];if(!_0x3d3f80['query'][_0x1d73('0x35')](_0x1d73('0x36'))){_0x9373f3['limit']=qs['limit'](_0x3d3f80[_0x1d73('0x2f')]['limit']);_0x9373f3[_0x1d73('0x1c')]=qs[_0x1d73('0x1c')](_0x3d3f80[_0x1d73('0x2f')][_0x1d73('0x1c')]);}_0x9373f3['order']=qs['sort'](_0x3d3f80[_0x1d73('0x2f')][_0x1d73('0x37')]);_0x9373f3[_0x1d73('0x38')]=qs['filters'](_[_0x1d73('0x39')](_0x3d3f80[_0x1d73('0x2f')],_0x2de5b9[_0x1d73('0x30')]),_0x1edfd1);if(_0x3d3f80[_0x1d73('0x2f')][_0x1d73('0x3a')]){_0x9373f3[_0x1d73('0x38')]=_[_0x1d73('0x3b')](_0x9373f3['where'],{'$or':_[_0x1d73('0x2a')](_0x1edfd1,function(_0x3c8474){if(_0x3c8474[_0x1d73('0x3c')]!==_0x1d73('0x3d')){var _0x2780cc={};_0x2780cc[_0x3c8474[_0x1d73('0x28')]]={'$like':'%'+_0x3d3f80[_0x1d73('0x2f')][_0x1d73('0x3a')]+'%'};return _0x2780cc;}})});}_0x9373f3=_[_0x1d73('0x3b')]({},_0x9373f3,_0x3d3f80['options']);var _0xc23c01={'where':_0x9373f3[_0x1d73('0x38')]};return db['VoiceTransferReport'][_0x1d73('0x1f')](_0xc23c01)[_0x1d73('0x25')](function(_0x135e87){_0x57e2f0[_0x1d73('0x1f')]=_0x135e87;if(_0x3d3f80[_0x1d73('0x2f')]['includeAll']){_0x9373f3[_0x1d73('0x3e')]=[{'all':!![]}];}return db[_0x1d73('0x2b')]['findAll'](_0x9373f3);})[_0x1d73('0x25')](function(_0x22e76f){_0x57e2f0[_0x1d73('0x3f')]=_0x22e76f;return _0x57e2f0;})[_0x1d73('0x25')](respondWithFilteredResult(_0x3dbf2e,_0x9373f3))[_0x1d73('0x40')](handleError(_0x3dbf2e,null));};exports[_0x1d73('0x41')]=function(_0x1b20c1,_0x3f2952){var _0x18082d={'raw':!![],'where':{'id':_0x1b20c1[_0x1d73('0x42')]['id']}},_0x16b39a={};_0x16b39a[_0x1d73('0x2d')]=_['keys'](db[_0x1d73('0x2b')][_0x1d73('0x2c')]);_0x16b39a['query']=_[_0x1d73('0x2e')](_0x1b20c1['query']);_0x16b39a['filters']=_['intersection'](_0x16b39a[_0x1d73('0x2d')],_0x16b39a[_0x1d73('0x2f')]);_0x18082d[_0x1d73('0x32')]=_[_0x1d73('0x31')](_0x16b39a[_0x1d73('0x2d')],qs[_0x1d73('0x33')](_0x1b20c1[_0x1d73('0x2f')][_0x1d73('0x33')]));_0x18082d[_0x1d73('0x32')]=_0x18082d[_0x1d73('0x32')]['length']?_0x18082d['attributes']:_0x16b39a[_0x1d73('0x2d')];if(_0x1b20c1[_0x1d73('0x2f')][_0x1d73('0x43')]){_0x18082d[_0x1d73('0x3e')]=[{'all':!![]}];}_0x18082d=_['merge']({},_0x18082d,_0x1b20c1[_0x1d73('0x44')]);return db['VoiceTransferReport'][_0x1d73('0x45')](_0x18082d)[_0x1d73('0x25')](handleEntityNotFound(_0x3f2952,null))[_0x1d73('0x25')](respondWithResult(_0x3f2952,null))[_0x1d73('0x40')](handleError(_0x3f2952,null));};exports['create']=function(_0x24e11c,_0x5202fe){return db[_0x1d73('0x2b')][_0x1d73('0x46')](_0x24e11c['body'],{})[_0x1d73('0x25')](respondWithResult(_0x5202fe,0xc9))['catch'](handleError(_0x5202fe,null));};exports[_0x1d73('0x47')]=function(_0x128efd,_0x569b63){if(_0x128efd[_0x1d73('0x48')]['id']){delete _0x128efd[_0x1d73('0x48')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x128efd[_0x1d73('0x42')]['id']}})['then'](handleEntityNotFound(_0x569b63,null))['then'](saveUpdates(_0x128efd[_0x1d73('0x48')],null))[_0x1d73('0x25')](respondWithResult(_0x569b63,null))[_0x1d73('0x40')](handleError(_0x569b63,null));};exports['destroy']=function(_0x405e1c,_0x3f1456){return db[_0x1d73('0x2b')][_0x1d73('0x45')]({'where':{'id':_0x405e1c['params']['id']}})['then'](handleEntityNotFound(_0x3f1456,null))['then'](removeEntity(_0x3f1456,null))[_0x1d73('0x40')](handleError(_0x3f1456,null));};exports[_0x1d73('0x49')]=function(_0x5d1de6,_0x541c92){return db['VoiceTransferReport'][_0x1d73('0x49')]()[_0x1d73('0x25')](respondWithResult(_0x541c92,null))[_0x1d73('0x40')](handleError(_0x541c92,null));}; \ No newline at end of file +var _0xf10c=['type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','error','send','index','map','VoiceTransferReport','rawAttributes','fieldName'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf10c,0xf6));var _0xcf10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf10c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcf10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf10('0x1'));var jsonpatch=require(_0xcf10('0x2'));var rp=require(_0xcf10('0x3'));var moment=require('moment');var BPromise=require(_0xcf10('0x4'));var Mustache=require('mustache');var util=require(_0xcf10('0x5'));var path=require('path');var sox=require(_0xcf10('0x6'));var csv=require(_0xcf10('0x7'));var ejs=require(_0xcf10('0x8'));var fs=require('fs');var fs_extra=require(_0xcf10('0x9'));var _=require(_0xcf10('0xa'));var squel=require(_0xcf10('0xb'));var crypto=require(_0xcf10('0xc'));var jsforce=require(_0xcf10('0xd'));var deskjs=require(_0xcf10('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcf10('0xf'));var Papa=require(_0xcf10('0x10'));var Redis=require(_0xcf10('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf10('0x12'))(_0xcf10('0x13'));var utils=require(_0xcf10('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253dbe,_0x2d1324){_0x2d1324=_0x2d1324||0xcc;return function(_0x2d1519){if(_0x2d1519){return _0x253dbe[_0xcf10('0x15')](_0x2d1324);}return _0x253dbe[_0xcf10('0x16')](_0x2d1324)[_0xcf10('0x17')]();};}function respondWithResult(_0x3ed752,_0x2e09d4){_0x2e09d4=_0x2e09d4||0xc8;return function(_0x449389){if(_0x449389){return _0x3ed752['status'](_0x2e09d4)['json'](_0x449389);}};}function respondWithFilteredResult(_0x5852e1,_0x33e15e){return function(_0x394516){if(_0x394516){var _0x2a8eff=typeof _0x33e15e[_0xcf10('0x18')]===_0xcf10('0x19')&&typeof _0x33e15e['limit']==='undefined';var _0x7989c6=_0x394516[_0xcf10('0x1a')];var _0x956116=_0x2a8eff?0x0:_0x33e15e[_0xcf10('0x18')];var _0x19e876=_0x2a8eff?_0x394516[_0xcf10('0x1a')]:_0x33e15e[_0xcf10('0x18')]+_0x33e15e[_0xcf10('0x1b')];var _0x17b51c;if(_0x19e876>=_0x7989c6){_0x19e876=_0x7989c6;_0x17b51c=0xc8;}else{_0x17b51c=0xce;}_0x5852e1['status'](_0x17b51c);return _0x5852e1[_0xcf10('0x1c')]('Content-Range',_0x956116+'-'+_0x19e876+'/'+_0x7989c6)[_0xcf10('0x1d')](_0x394516);}return null;};}function patchUpdates(_0x17c9e8){return function(_0x52efba){try{jsonpatch[_0xcf10('0x1e')](_0x52efba,_0x17c9e8,!![]);}catch(_0x1948f6){return BPromise[_0xcf10('0x1f')](_0x1948f6);}return _0x52efba[_0xcf10('0x20')]();};}function saveUpdates(_0x4fea18,_0x1d4812){return function(_0x5cb5ca){if(_0x5cb5ca){return _0x5cb5ca[_0xcf10('0x21')](_0x4fea18)['then'](function(_0x4448d1){return _0x4448d1;});}return null;};}function removeEntity(_0x2be7c0,_0x1685a1){return function(_0x5d10e8){if(_0x5d10e8){return _0x5d10e8['destroy']()[_0xcf10('0x22')](function(){_0x2be7c0[_0xcf10('0x16')](0xcc)[_0xcf10('0x17')]();});}};}function handleEntityNotFound(_0x2457bb,_0x417951){return function(_0x18bcd4){if(!_0x18bcd4){_0x2457bb['sendStatus'](0x194);}return _0x18bcd4;};}function handleError(_0x50f179,_0x4d4687){_0x4d4687=_0x4d4687||0x1f4;return function(_0x5b8697){logger[_0xcf10('0x23')](_0x5b8697['stack']);if(_0x5b8697['name']){delete _0x5b8697['name'];}_0x50f179[_0xcf10('0x16')](_0x4d4687)[_0xcf10('0x24')](_0x5b8697);};}exports[_0xcf10('0x25')]=function(_0x4a3663,_0x5b1c77){var _0x30a390={},_0x98f038={},_0x5d5420={'count':0x0,'rows':[]};var _0x440500=_[_0xcf10('0x26')](db[_0xcf10('0x27')][_0xcf10('0x28')],function(_0x73ae21){return{'name':_0x73ae21[_0xcf10('0x29')],'type':_0x73ae21[_0xcf10('0x2a')][_0xcf10('0x2b')]};});_0x98f038[_0xcf10('0x2c')]=_[_0xcf10('0x26')](_0x440500,_0xcf10('0x2d'));_0x98f038['query']=_[_0xcf10('0x2e')](_0x4a3663[_0xcf10('0x2f')]);_0x98f038[_0xcf10('0x30')]=_[_0xcf10('0x31')](_0x98f038['model'],_0x98f038[_0xcf10('0x2f')]);_0x30a390[_0xcf10('0x32')]=_['intersection'](_0x98f038[_0xcf10('0x2c')],qs[_0xcf10('0x33')](_0x4a3663[_0xcf10('0x2f')]['fields']));_0x30a390['attributes']=_0x30a390['attributes'][_0xcf10('0x34')]?_0x30a390[_0xcf10('0x32')]:_0x98f038[_0xcf10('0x2c')];if(!_0x4a3663[_0xcf10('0x2f')][_0xcf10('0x35')](_0xcf10('0x36'))){_0x30a390['limit']=qs[_0xcf10('0x1b')](_0x4a3663[_0xcf10('0x2f')][_0xcf10('0x1b')]);_0x30a390[_0xcf10('0x18')]=qs['offset'](_0x4a3663[_0xcf10('0x2f')][_0xcf10('0x18')]);}_0x30a390[_0xcf10('0x37')]=qs[_0xcf10('0x38')](_0x4a3663[_0xcf10('0x2f')]['sort']);_0x30a390['where']=qs[_0xcf10('0x30')](_[_0xcf10('0x39')](_0x4a3663[_0xcf10('0x2f')],_0x98f038[_0xcf10('0x30')]),_0x440500);if(_0x4a3663['query'][_0xcf10('0x3a')]){_0x30a390[_0xcf10('0x3b')]=_['merge'](_0x30a390[_0xcf10('0x3b')],{'$or':_[_0xcf10('0x26')](_0x440500,function(_0x549dee){if(_0x549dee['type']!=='VIRTUAL'){var _0x257e8d={};_0x257e8d[_0x549dee[_0xcf10('0x2d')]]={'$like':'%'+_0x4a3663['query'][_0xcf10('0x3a')]+'%'};return _0x257e8d;}})});}_0x30a390=_[_0xcf10('0x3c')]({},_0x30a390,_0x4a3663[_0xcf10('0x3d')]);var _0x68e2ed={'where':_0x30a390[_0xcf10('0x3b')]};return db[_0xcf10('0x27')][_0xcf10('0x1a')](_0x68e2ed)[_0xcf10('0x22')](function(_0x156dfd){_0x5d5420['count']=_0x156dfd;if(_0x4a3663[_0xcf10('0x2f')][_0xcf10('0x3e')]){_0x30a390[_0xcf10('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xcf10('0x40')](_0x30a390);})[_0xcf10('0x22')](function(_0x11d6a8){_0x5d5420[_0xcf10('0x41')]=_0x11d6a8;return _0x5d5420;})[_0xcf10('0x22')](respondWithFilteredResult(_0x5b1c77,_0x30a390))[_0xcf10('0x42')](handleError(_0x5b1c77,null));};exports['show']=function(_0x9ba244,_0x134661){var _0x2041d4={'raw':!![],'where':{'id':_0x9ba244[_0xcf10('0x43')]['id']}},_0x16eb8f={};_0x16eb8f[_0xcf10('0x2c')]=_[_0xcf10('0x2e')](db[_0xcf10('0x27')]['rawAttributes']);_0x16eb8f[_0xcf10('0x2f')]=_[_0xcf10('0x2e')](_0x9ba244[_0xcf10('0x2f')]);_0x16eb8f[_0xcf10('0x30')]=_['intersection'](_0x16eb8f[_0xcf10('0x2c')],_0x16eb8f[_0xcf10('0x2f')]);_0x2041d4[_0xcf10('0x32')]=_['intersection'](_0x16eb8f['model'],qs[_0xcf10('0x33')](_0x9ba244[_0xcf10('0x2f')][_0xcf10('0x33')]));_0x2041d4[_0xcf10('0x32')]=_0x2041d4[_0xcf10('0x32')][_0xcf10('0x34')]?_0x2041d4[_0xcf10('0x32')]:_0x16eb8f['model'];if(_0x9ba244[_0xcf10('0x2f')]['includeAll']){_0x2041d4[_0xcf10('0x3f')]=[{'all':!![]}];}_0x2041d4=_[_0xcf10('0x3c')]({},_0x2041d4,_0x9ba244[_0xcf10('0x3d')]);return db[_0xcf10('0x27')][_0xcf10('0x44')](_0x2041d4)['then'](handleEntityNotFound(_0x134661,null))[_0xcf10('0x22')](respondWithResult(_0x134661,null))[_0xcf10('0x42')](handleError(_0x134661,null));};exports[_0xcf10('0x45')]=function(_0x3aaa35,_0x50e294){return db[_0xcf10('0x27')][_0xcf10('0x45')](_0x3aaa35[_0xcf10('0x46')],{})[_0xcf10('0x22')](respondWithResult(_0x50e294,0xc9))[_0xcf10('0x42')](handleError(_0x50e294,null));};exports[_0xcf10('0x21')]=function(_0x3e2cb9,_0x5b40a){if(_0x3e2cb9[_0xcf10('0x46')]['id']){delete _0x3e2cb9[_0xcf10('0x46')]['id'];}return db[_0xcf10('0x27')][_0xcf10('0x44')]({'where':{'id':_0x3e2cb9['params']['id']}})[_0xcf10('0x22')](handleEntityNotFound(_0x5b40a,null))[_0xcf10('0x22')](saveUpdates(_0x3e2cb9[_0xcf10('0x46')],null))[_0xcf10('0x22')](respondWithResult(_0x5b40a,null))[_0xcf10('0x42')](handleError(_0x5b40a,null));};exports['destroy']=function(_0x1a366a,_0x34b383){return db[_0xcf10('0x27')][_0xcf10('0x44')]({'where':{'id':_0x1a366a[_0xcf10('0x43')]['id']}})[_0xcf10('0x22')](handleEntityNotFound(_0x34b383,null))[_0xcf10('0x22')](removeEntity(_0x34b383,null))[_0xcf10('0x42')](handleError(_0x34b383,null));};exports[_0xcf10('0x47')]=function(_0x4d2dbb,_0x3db835){return db[_0xcf10('0x27')][_0xcf10('0x47')]()[_0xcf10('0x22')](respondWithResult(_0x3db835,null))[_0xcf10('0x42')](handleError(_0x3db835,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 51be6e4..b1b7916 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 _0x22fe=['request-promise','rimraf','../../config/environment','exports','VoiceTransferReport','util','../../config/logger','api','moment'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0x22fe,0xdd));var _0xe22f=function(_0x492d45,_0x2ebf5d){_0x492d45=_0x492d45-0x0;var _0x2fc6ff=_0x22fe[_0x492d45];return _0x2fc6ff;};'use strict';var _=require('lodash');var util=require(_0xe22f('0x0'));var logger=require(_0xe22f('0x1'))(_0xe22f('0x2'));var moment=require(_0xe22f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe22f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe22f('0x5'));var config=require(_0xe22f('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xe22f('0x7')]=function(_0x49934e,_0x5ae4e0){return _0x49934e['define'](_0xe22f('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaac6=['path','rimraf','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xaac6,0xae));var _0x6aac=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0xaac6[_0x513047];return _0x15b779;};'use strict';var _=require(_0x6aac('0x0'));var util=require(_0x6aac('0x1'));var logger=require(_0x6aac('0x2'))(_0x6aac('0x3'));var moment=require(_0x6aac('0x4'));var BPromise=require('bluebird');var rp=require(_0x6aac('0x5'));var fs=require('fs');var path=require(_0x6aac('0x6'));var rimraf=require(_0x6aac('0x7'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x6aac('0x8')]=function(_0x48e64e,_0xe6aa26){return _0x48e64e[_0x6aac('0x9')](_0x6aac('0xa'),attributes,{'tableName':_0x6aac('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 5b69ab3..8ab6585 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 _0x1220=['client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x33fac5,_0xdd796a){var _0x4e5d6a=function(_0x9fda77){while(--_0x9fda77){_0x33fac5['push'](_0x33fac5['shift']());}};_0x4e5d6a(++_0xdd796a);}(_0x1220,0x149));var _0x0122=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x1220[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x0122('0x0'));var util=require('util');var moment=require(_0x0122('0x1'));var BPromise=require(_0x0122('0x2'));var rs=require(_0x0122('0x3'));var fs=require('fs');var Redis=require(_0x0122('0x4'));var db=require(_0x0122('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0122('0x6'))(_0x0122('0x7'));var config=require('../../config/environment');var jayson=require(_0x0122('0x8'));var client=jayson[_0x0122('0x9')][_0x0122('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d5329,_0x575b6c,_0x404192){return new BPromise(function(_0x3b851b,_0x31085e){return client['request'](_0x4d5329,_0x404192)[_0x0122('0xb')](function(_0x3bef96){logger[_0x0122('0xc')](_0x0122('0xd'),_0x575b6c,_0x0122('0xe'));logger[_0x0122('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x575b6c,'request\x20sent',JSON[_0x0122('0x10')](_0x3bef96));if(_0x3bef96[_0x0122('0x11')]){if(_0x3bef96[_0x0122('0x11')][_0x0122('0x12')]===0x1f4){logger['error'](_0x0122('0xd'),_0x575b6c,_0x3bef96[_0x0122('0x11')][_0x0122('0x13')]);return _0x31085e(_0x3bef96[_0x0122('0x11')][_0x0122('0x13')]);}logger[_0x0122('0x11')](_0x0122('0xd'),_0x575b6c,_0x3bef96[_0x0122('0x11')][_0x0122('0x13')]);return _0x3b851b(_0x3bef96[_0x0122('0x11')]['message']);}else{logger['info'](_0x0122('0xd'),_0x575b6c,_0x0122('0xe'));_0x3b851b(_0x3bef96['result'][_0x0122('0x13')]);}})[_0x0122('0x14')](function(_0x4b7a9d){logger[_0x0122('0x11')](_0x0122('0xd'),_0x575b6c,_0x4b7a9d);_0x31085e(_0x4b7a9d);});});}exports[_0x0122('0x15')]=function(_0x3d9c51){var _0xb47aaa=this;return new Promise(function(_0xe38d5,_0x3e4e1f){return db['VoiceTransferReport'][_0x0122('0x16')](_0x3d9c51[_0x0122('0x17')],{'raw':_0x3d9c51['options']?_0x3d9c51[_0x0122('0x18')][_0x0122('0x19')]===undefined?!![]:![]:!![]})[_0x0122('0xb')](function(_0x3c4440){logger[_0x0122('0xc')](_0x0122('0x15'),_0x3d9c51);logger[_0x0122('0xf')](_0x0122('0x15'),_0x3d9c51,JSON[_0x0122('0x10')](_0x3c4440));_0xe38d5(_0x3c4440);})[_0x0122('0x14')](function(_0x3364a3){logger['error']('CreateVoiceTransferReport',_0x3364a3['message'],_0x3d9c51);_0x3e4e1f(_0xb47aaa[_0x0122('0x11')](0x1f4,_0x3364a3[_0x0122('0x13')]));});});}; \ No newline at end of file +var _0x08f9=['message','info','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x278b11,_0xf762a5){var _0x14235c=function(_0x3bc57e){while(--_0x3bc57e){_0x278b11['push'](_0x278b11['shift']());}};_0x14235c(++_0xf762a5);}(_0x08f9,0x191));var _0x908f=function(_0x5caa38,_0x7c4a6c){_0x5caa38=_0x5caa38-0x0;var _0x5b3b8d=_0x08f9[_0x5caa38];return _0x5b3b8d;};'use strict';var _=require(_0x908f('0x0'));var util=require(_0x908f('0x1'));var moment=require('moment');var BPromise=require(_0x908f('0x2'));var rs=require(_0x908f('0x3'));var fs=require('fs');var Redis=require(_0x908f('0x4'));var db=require(_0x908f('0x5'))['db'];var utils=require(_0x908f('0x6'));var logger=require('../../config/logger')(_0x908f('0x7'));var config=require('../../config/environment');var jayson=require(_0x908f('0x8'));var client=jayson[_0x908f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cd744,_0x32aa99,_0x47e8d8){return new BPromise(function(_0x31f11c,_0x20185e){return client[_0x908f('0xa')](_0x5cd744,_0x47e8d8)[_0x908f('0xb')](function(_0x1b9913){logger['info'](_0x908f('0xc'),_0x32aa99,_0x908f('0xd'));logger[_0x908f('0xe')](_0x908f('0xf'),_0x32aa99,_0x908f('0xd'),JSON[_0x908f('0x10')](_0x1b9913));if(_0x1b9913[_0x908f('0x11')]){if(_0x1b9913[_0x908f('0x11')][_0x908f('0x12')]===0x1f4){logger[_0x908f('0x11')](_0x908f('0xc'),_0x32aa99,_0x1b9913[_0x908f('0x11')]['message']);return _0x20185e(_0x1b9913[_0x908f('0x11')][_0x908f('0x13')]);}logger[_0x908f('0x11')](_0x908f('0xc'),_0x32aa99,_0x1b9913[_0x908f('0x11')]['message']);return _0x31f11c(_0x1b9913[_0x908f('0x11')]['message']);}else{logger[_0x908f('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x32aa99,_0x908f('0xd'));_0x31f11c(_0x1b9913['result'][_0x908f('0x13')]);}})[_0x908f('0x15')](function(_0x32f7ca){logger[_0x908f('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x32aa99,_0x32f7ca);_0x20185e(_0x32f7ca);});});}exports['CreateVoiceTransferReport']=function(_0x61a4b4){var _0x12e51d=this;return new Promise(function(_0x278127,_0xd04871){return db[_0x908f('0x16')][_0x908f('0x17')](_0x61a4b4[_0x908f('0x18')],{'raw':_0x61a4b4[_0x908f('0x19')]?_0x61a4b4[_0x908f('0x19')][_0x908f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1797cd){logger['info']('CreateVoiceTransferReport',_0x61a4b4);logger[_0x908f('0xe')]('CreateVoiceTransferReport',_0x61a4b4,JSON[_0x908f('0x10')](_0x1797cd));_0x278127(_0x1797cd);})[_0x908f('0x15')](function(_0x59c436){logger[_0x908f('0x11')](_0x908f('0x1b'),_0x59c436[_0x908f('0x13')],_0x61a4b4);_0xd04871(_0x12e51d[_0x908f('0x11')](0x1f4,_0x59c436[_0x908f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0a035c6..ebe31b3 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 _0xaa88=['/hold','/unhold','/calls','calls','transfer','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer'];(function(_0x59ccc6,_0x467c23){var _0x35a288=function(_0x3cb0a6){while(--_0x3cb0a6){_0x59ccc6['push'](_0x59ccc6['shift']());}};_0x35a288(++_0x467c23);}(_0xaa88,0x137));var _0x8aa8=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xaa88[_0x2bc3f4];return _0x14ac53;};'use strict';var express=require(_0x8aa8('0x0'));var router=express[_0x8aa8('0x1')]();var auth=require(_0x8aa8('0x2'));var controller=require(_0x8aa8('0x3'));router['post'](_0x8aa8('0x4'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x7')]);router[_0x8aa8('0x8')](_0x8aa8('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x8aa8('0xa')]);router['post'](_0x8aa8('0xb'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0xc')]);router['post'](_0x8aa8('0xd'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['hold']);router[_0x8aa8('0x8')](_0x8aa8('0xe'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['unhold']);router[_0x8aa8('0x8')](_0x8aa8('0xf'),auth['isAuthenticated'](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x8')]('/transfer',auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x519a2f,_0x1e23dc){var _0xb28f2b=function(_0x332fe4){while(--_0x332fe4){_0x519a2f['push'](_0x519a2f['shift']());}};_0xb28f2b(++_0x1e23dc);}(_0xb821,0xa7));var _0x1b82=function(_0x58dff1,_0x4b1a69){_0x58dff1=_0x58dff1-0x0;var _0x599c47=_0xb821[_0x58dff1];return _0x599c47;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 02985b2..8755c7f 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 _0x24b3=['../../mysqldb','util','http','../../config/logger','ioredis','localhost','socket.io-emitter','redis','string','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','then','message','catch','User','findOne','agent','VoiceChannels','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','conference\x20fired:','webbar:conference','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash'];(function(_0x29eaaf,_0x18cc33){var _0xd350fc=function(_0x3c6474){while(--_0x3c6474){_0x29eaaf['push'](_0x29eaaf['shift']());}};_0xd350fc(++_0x18cc33);}(_0x24b3,0xd3));var _0x324b=function(_0x28ac11,_0x57ba78){_0x28ac11=_0x28ac11-0x0;var _0x14e3bf=_0x24b3[_0x28ac11];return _0x14e3bf;};'use strict';var path=require(_0x324b('0x0'));var fs=require('fs');var _=require(_0x324b('0x1'));var db=require(_0x324b('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x324b('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x324b('0x4')]({'port':0x232a});var logger=require(_0x324b('0x5'))('webbarapi');var Redis=require(_0x324b('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x324b('0x7'),'port':0x18eb});var io=require(_0x324b('0x8'))(new Redis(config[_0x324b('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x324b('0xa'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x324b('0xa')},'callbackUrl':{'type':_0x324b('0xa')}});var hangupValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':_0x324b('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':_0x324b('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':'string','required':[!![],_0x324b('0xd')]},'transferNumber':{'type':_0x324b('0xa'),'required':[!![],_0x324b('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':_0x324b('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':_0x324b('0xa'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x2d65ae,_0x30e7c4,_0x5ebed0){logger[_0x324b('0xf')](_0x2d65ae,_0x30e7c4,JSON[_0x324b('0x10')](_0x5ebed0));io['to'](_0x2d65ae)[_0x324b('0x11')](_0x30e7c4,_0x5ebed0);}function handleError(_0x1f797c){return function(_0x209104){console[_0x324b('0x12')](_0x324b('0x13'),_0x209104,_0x209104 instanceof RangeError);logger[_0x324b('0x14')](_0x209104[_0x324b('0x15')]);if(_0x209104 instanceof RangeError){if(_0x209104[_0x324b('0x16')]){delete _0x209104[_0x324b('0x16')];}_0x1f797c[_0x324b('0x17')](0x194)[_0x324b('0x18')](_0x209104);}else{if(_0x209104['name']){delete _0x209104['name'];}_0x1f797c[_0x324b('0x17')](0x1f4)['send'](_0x209104);}};}function checkError(){return function(_0xb34f7){if(!_0xb34f7){throw new RangeError('NotFound');}return _0xb34f7;};}function respondWithRpcPromise(_0x1fb9ed,_0x49c3f5){return new BPromise(function(_0x1df4b5,_0x397cd3){var _0x30091d=amiClient;return _0x30091d['request'](_0x1fb9ed,_0x49c3f5)[_0x324b('0x19')](function(_0xdc74d2){if(_0xdc74d2[_0x324b('0x14')]){if(_0xdc74d2['error']['code']===0x1f4){return _0x397cd3(_0xdc74d2[_0x324b('0x14')]['message']);}return _0x1df4b5(_0xdc74d2[_0x324b('0x14')][_0x324b('0x1a')]);}else{_0x1df4b5(_0xdc74d2['result']);}})[_0x324b('0x1b')](function(_0x51c3ad){_0x397cd3(_0x51c3ad);});});}function getAgent(_0x38996d){return db[_0x324b('0x1c')][_0x324b('0x1d')]({'where':{'id':_0x38996d,'role':_0x324b('0x1e')}})[_0x324b('0x19')](checkError());}function getAgentCheckSession(_0x12815b,_0x46f79a){return new BPromise(function(_0x48bb79,_0x1b7587){var _0x19241a=respondWithRpcPromise(_0x324b('0x1f'));var _0x3656d0=getAgent(_0x12815b);Promise['all']([_0x19241a,_0x3656d0])[_0x324b('0x19')](function(_0x10fb26){var _0x4cc6b4=_0x10fb26[0x0];var _0x33d541=_0x10fb26[0x1];var _0x573dc1=_['filter'](_0x4cc6b4[_0x324b('0x20')],function(_0xfbe94d){return _0xfbe94d[_0x324b('0x21')]==_0x33d541['id']&&_0xfbe94d[_0x324b('0x22')]==_0x46f79a;});if(_0x573dc1['length']==0x1){_0x48bb79(_0x33d541);}else{_0x1b7587(new RangeError(_0x324b('0x23')+_0x46f79a+_0x324b('0x24')));}});});}exports[_0x324b('0x25')]=function(_0xcf1dc8,_0x2b124c){logger[_0x324b('0xf')](_0x324b('0x26'),_0xcf1dc8[_0x324b('0x27')]);var _0x4b8084=originateValidation[_0x324b('0x28')](_0xcf1dc8['body']);if(_0x4b8084[_0x324b('0x29')]>0x0){return _0x2b124c[_0x324b('0x17')](0x190)[_0x324b('0x2a')](_0x4b8084);}var _0x2c4ca5=_0xcf1dc8[_0x324b('0x27')][_0x324b('0x2b')];var _0x5c2ab7=_0xcf1dc8['body'][_0x324b('0x2c')];var _0x2cb875=_0xcf1dc8[_0x324b('0x27')][_0x324b('0x2d')];var _0x154d16=_0xcf1dc8[_0x324b('0x27')]['callbackUrl'];return getAgent(_0x2c4ca5)[_0x324b('0x19')](function(_0x1e6729){logger[_0x324b('0xf')](_0x324b('0x2e'),_0x1e6729[_0x324b('0x16')]);emit(util[_0x324b('0x2f')](_0x324b('0x30'),_0x1e6729[_0x324b('0x16')]),_0x324b('0x31'),{'callNumber':_0x5c2ab7,'callerId':_0x2cb875,'callbackUrl':_0x154d16});return _0x2b124c[_0x324b('0x17')](0xc8)[_0x324b('0x2a')]({'error':![],'message':_0x324b('0x32')});})['catch'](handleError(_0x2b124c));};exports[_0x324b('0x33')]=function(_0x5eeb18,_0x300c96){logger[_0x324b('0xf')]('hangup\x20fired:',_0x5eeb18[_0x324b('0x27')]);var _0x4b560d=hangupValidation[_0x324b('0x28')](_0x5eeb18['body']);if(_0x4b560d[_0x324b('0x29')]>0x0){return _0x300c96[_0x324b('0x17')](0x190)['json'](_0x4b560d);}var _0x2216d2=_0x5eeb18[_0x324b('0x27')]['userId'];var _0x4e5f5d=_0x5eeb18['body'][_0x324b('0x22')];return getAgent(_0x2216d2)['then'](function(_0x37554d){logger[_0x324b('0xf')](_0x324b('0x2e'),_0x37554d[_0x324b('0x16')]);emit(util[_0x324b('0x2f')]('user:%s',_0x37554d[_0x324b('0x16')]),_0x324b('0x34'),{'sessionId':_0x4e5f5d});return _0x300c96[_0x324b('0x17')](0xc8)['json']({'error':![],'message':_0x324b('0x35')});})[_0x324b('0x1b')](handleError(_0x300c96));};exports[_0x324b('0x36')]=function(_0x228c4f,_0x1a9473){logger[_0x324b('0xf')](_0x324b('0x37'),_0x228c4f[_0x324b('0x27')]);var _0x512ef3=answerValidation[_0x324b('0x28')](_0x228c4f[_0x324b('0x27')]);if(_0x512ef3['length']>0x0){return _0x1a9473[_0x324b('0x17')](0x190)[_0x324b('0x2a')](_0x512ef3);}var _0x484d65=_0x228c4f[_0x324b('0x27')]['userId'];var _0x1f797a=_0x228c4f[_0x324b('0x27')][_0x324b('0x22')];return getAgent(_0x484d65)[_0x324b('0x19')](function(_0x2b517c){logger[_0x324b('0xf')](_0x324b('0x2e'),_0x2b517c[_0x324b('0x16')]);emit(util['format'](_0x324b('0x30'),_0x2b517c['name']),_0x324b('0x38'),{'sessionId':_0x1f797a});return _0x1a9473['status'](0xc8)[_0x324b('0x2a')]({'error':![],'message':_0x324b('0x39')});})['catch'](handleError(_0x1a9473));};exports[_0x324b('0x3a')]=function(_0x5afd22,_0x4a98ed){logger[_0x324b('0xf')](_0x324b('0x3b'),_0x5afd22[_0x324b('0x27')]);var _0x3b123d=holdValidation[_0x324b('0x28')](_0x5afd22[_0x324b('0x27')]);if(_0x3b123d[_0x324b('0x29')]>0x0){return _0x4a98ed[_0x324b('0x17')](0x190)[_0x324b('0x2a')](_0x3b123d);}var _0x453f79=_0x5afd22[_0x324b('0x27')][_0x324b('0x2b')];var _0x43e620=_0x5afd22['body'][_0x324b('0x22')];return getAgent(_0x453f79)['then'](function(_0x2dd2a7){logger[_0x324b('0xf')]('entityFound:',_0x2dd2a7[_0x324b('0x16')]);emit(util['format']('user:%s',_0x2dd2a7['name']),_0x324b('0x3c'),{'sessionId':_0x43e620});return _0x4a98ed[_0x324b('0x17')](0xc8)['json']({'error':![],'message':_0x324b('0x3d')});})[_0x324b('0x1b')](handleError(_0x4a98ed));};exports[_0x324b('0x3e')]=function(_0x11d75e,_0x17023b){logger[_0x324b('0xf')](_0x324b('0x3f'),_0x11d75e[_0x324b('0x27')]);var _0xe196e1=unholdValidation[_0x324b('0x28')](_0x11d75e['body']);if(_0xe196e1[_0x324b('0x29')]>0x0){return _0x17023b[_0x324b('0x17')](0x190)[_0x324b('0x2a')](_0xe196e1);}var _0x1b6b74=_0x11d75e[_0x324b('0x27')]['userId'];var _0x5e9b5e=_0x11d75e[_0x324b('0x27')][_0x324b('0x22')];return getAgent(_0x1b6b74)[_0x324b('0x19')](function(_0x1edfb3){logger[_0x324b('0xf')]('entityFound:',_0x1edfb3[_0x324b('0x16')]);emit(util[_0x324b('0x2f')](_0x324b('0x30'),_0x1edfb3[_0x324b('0x16')]),_0x324b('0x40'),{'sessionId':_0x5e9b5e});return _0x17023b['status'](0xc8)[_0x324b('0x2a')]({'error':![],'message':_0x324b('0x41')});})[_0x324b('0x1b')](handleError(_0x17023b));};exports['calls']=function(_0x259c22,_0x28baea){logger['info']('calls\x20fired:',_0x28baea['body']);var _0x41f286=callsValidation[_0x324b('0x28')](_0x259c22[_0x324b('0x27')]);if(_0x41f286[_0x324b('0x29')]>0x0){return _0x28baea['status'](0x190)['json'](_0x41f286);}var _0x5918e6=_0x259c22[_0x324b('0x27')][_0x324b('0x2b')];var _0x5c5a2a=respondWithRpcPromise(_0x324b('0x1f'));var _0x5be4ee=getAgent(_0x5918e6);return Promise['all']([_0x5c5a2a,_0x5be4ee])[_0x324b('0x19')](function(_0x1d96db){var _0x5223cd=_0x1d96db[0x0];var _0x365ebc=_0x1d96db[0x1];var _0x543ed1=_['filter'](_0x5223cd['rows'],function(_0x1a86a7){return _0x1a86a7[_0x324b('0x21')]==_0x365ebc['id'];});return _0x28baea[_0x324b('0x17')](0xc8)[_0x324b('0x2a')]({'count':_0x543ed1[_0x324b('0x29')],'rows':_0x543ed1});})[_0x324b('0x1b')](handleError(_0x28baea));};exports['conference']=function(_0x59affe,_0x2c10b1){logger[_0x324b('0xf')](_0x324b('0x42'),_0x59affe['body']);var _0x4b6cff=conferenceValidation['validate'](_0x59affe[_0x324b('0x27')]);if(_0x4b6cff[_0x324b('0x29')]>0x0){return _0x2c10b1[_0x324b('0x17')](0x190)['json'](_0x4b6cff);}var _0x1d87bd=_0x59affe[_0x324b('0x27')][_0x324b('0x2b')];return getAgent(_0x1d87bd)[_0x324b('0x19')](function(_0x4f0b04){logger['info'](_0x324b('0x2e'),_0x4f0b04['name']);emit(util[_0x324b('0x2f')](_0x324b('0x30'),_0x4f0b04[_0x324b('0x16')]),_0x324b('0x43'));return _0x2c10b1[_0x324b('0x17')](0xc8)[_0x324b('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0x324b('0x1b')](handleError(_0x2c10b1));};exports['transfer']=function(_0x4c84ee,_0xb0cd27){logger[_0x324b('0xf')]('transfer\x20fired:',_0x4c84ee[_0x324b('0x27')]);var _0x2cef0c=transferValidation[_0x324b('0x28')](_0x4c84ee[_0x324b('0x27')]);if(_0x2cef0c[_0x324b('0x29')]>0x0){return _0xb0cd27[_0x324b('0x17')](0x190)['json'](_0x2cef0c);}var _0x135151=_0x4c84ee[_0x324b('0x27')][_0x324b('0x2b')];var _0x46869b=_0x4c84ee[_0x324b('0x27')][_0x324b('0x22')];var _0x5198f5=_0x4c84ee[_0x324b('0x27')][_0x324b('0x44')];return getAgent(_0x135151)[_0x324b('0x19')](function(_0x13d571){logger[_0x324b('0xf')](_0x324b('0x2e'),_0x13d571[_0x324b('0x16')]);emit(util[_0x324b('0x2f')](_0x324b('0x30'),_0x13d571[_0x324b('0x16')]),_0x324b('0x45'),{'sessionId':_0x46869b,'transferNumber':_0x5198f5});return _0xb0cd27[_0x324b('0x17')](0xc8)[_0x324b('0x2a')]({'error':![],'message':_0x324b('0x46')});})[_0x324b('0x1b')](handleError(_0xb0cd27));}; \ No newline at end of file +var _0xe35c=['info','stringify','emit','log','handleError:','error','stack','name','status','request','then','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callbackUrl','user:%s','webbar:originate','hangup','hangup\x20fired:','userId','entityFound:','format','webbar:hangup','hangup\x20executed!','catch','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required'];(function(_0x571f36,_0x58551e){var _0x12724f=function(_0x6e7d5f){while(--_0x6e7d5f){_0x571f36['push'](_0x571f36['shift']());}};_0x12724f(++_0x58551e);}(_0xe35c,0xd5));var _0xce35=function(_0x521c79,_0x301016){_0x521c79=_0x521c79-0x0;var _0xfbee65=_0xe35c[_0x521c79];return _0xfbee65;};'use strict';var path=require(_0xce35('0x0'));var fs=require('fs');var _=require(_0xce35('0x1'));var db=require(_0xce35('0x2'))['db'];var config=require(_0xce35('0x3'));var util=require(_0xce35('0x4'));var BPromise=require(_0xce35('0x5'));var jayson=require(_0xce35('0x6'));var amiClient=jayson['client'][_0xce35('0x7')]({'port':0x232a});var logger=require(_0xce35('0x8'))(_0xce35('0x9'));var Redis=require(_0xce35('0xa'));config[_0xce35('0xb')]=_[_0xce35('0xc')](config[_0xce35('0xb')],{'host':_0xce35('0xd'),'port':0x18eb});var io=require(_0xce35('0xe'))(new Redis(config[_0xce35('0xb')]));var Schema=require(_0xce35('0xf'));var originateValidation=new Schema({'userId':{'type':_0xce35('0x10'),'required':[!![],_0xce35('0x11')]},'callNumber':{'type':_0xce35('0x12'),'required':[!![],_0xce35('0x13')]},'callerId':{'type':_0xce35('0x12')},'callbackUrl':{'type':_0xce35('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0xce35('0x10'),'required':[!![],_0xce35('0x11')]},'sessionId':{'type':_0xce35('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xce35('0x11')]},'sessionId':{'type':_0xce35('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xce35('0x10'),'required':[!![],_0xce35('0x11')]},'sessionId':{'type':_0xce35('0x12'),'required':[!![],_0xce35('0x14')]},'transferNumber':{'type':_0xce35('0x12'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xce35('0x11')]},'sessionId':{'type':_0xce35('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xce35('0x10'),'required':[!![],_0xce35('0x11')]},'sessionId':{'type':_0xce35('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xce35('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xce35('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x2e4057,_0x57523b,_0x4519de){logger[_0xce35('0x15')](_0x2e4057,_0x57523b,JSON[_0xce35('0x16')](_0x4519de));io['to'](_0x2e4057)[_0xce35('0x17')](_0x57523b,_0x4519de);}function handleError(_0x588327){return function(_0x2870ab){console[_0xce35('0x18')](_0xce35('0x19'),_0x2870ab,_0x2870ab instanceof RangeError);logger[_0xce35('0x1a')](_0x2870ab[_0xce35('0x1b')]);if(_0x2870ab instanceof RangeError){if(_0x2870ab[_0xce35('0x1c')]){delete _0x2870ab[_0xce35('0x1c')];}_0x588327[_0xce35('0x1d')](0x194)['send'](_0x2870ab);}else{if(_0x2870ab[_0xce35('0x1c')]){delete _0x2870ab['name'];}_0x588327['status'](0x1f4)['send'](_0x2870ab);}};}function checkError(){return function(_0x35dc1a){if(!_0x35dc1a){throw new RangeError('NotFound');}return _0x35dc1a;};}function respondWithRpcPromise(_0x1ef81f,_0x28522f){return new BPromise(function(_0x1c6b98,_0x326176){var _0x5af2e5=amiClient;return _0x5af2e5[_0xce35('0x1e')](_0x1ef81f,_0x28522f)[_0xce35('0x1f')](function(_0x52fc6e){if(_0x52fc6e[_0xce35('0x1a')]){if(_0x52fc6e['error']['code']===0x1f4){return _0x326176(_0x52fc6e[_0xce35('0x1a')][_0xce35('0x20')]);}return _0x1c6b98(_0x52fc6e[_0xce35('0x1a')][_0xce35('0x20')]);}else{_0x1c6b98(_0x52fc6e[_0xce35('0x21')]);}})['catch'](function(_0x26caab){_0x326176(_0x26caab);});});}function getAgent(_0x54fccd){return db[_0xce35('0x22')][_0xce35('0x23')]({'where':{'id':_0x54fccd,'role':_0xce35('0x24')}})[_0xce35('0x1f')](checkError());}function getAgentCheckSession(_0x4376fd,_0x1da5c9){return new BPromise(function(_0x1a40ce,_0x46b64c){var _0xd7c678=respondWithRpcPromise(_0xce35('0x25'));var _0x4ebf7b=getAgent(_0x4376fd);Promise[_0xce35('0x26')]([_0xd7c678,_0x4ebf7b])[_0xce35('0x1f')](function(_0x47ceee){var _0x5f2111=_0x47ceee[0x0];var _0x129aa5=_0x47ceee[0x1];var _0x4aa760=_[_0xce35('0x27')](_0x5f2111[_0xce35('0x28')],function(_0x491a93){return _0x491a93[_0xce35('0x29')]==_0x129aa5['id']&&_0x491a93[_0xce35('0x2a')]==_0x1da5c9;});if(_0x4aa760[_0xce35('0x2b')]==0x1){_0x1a40ce(_0x129aa5);}else{_0x46b64c(new RangeError(_0xce35('0x2c')+_0x1da5c9+_0xce35('0x2d')));}});});}exports[_0xce35('0x2e')]=function(_0xc47d97,_0x3b1400){logger[_0xce35('0x15')](_0xce35('0x2f'),_0xc47d97[_0xce35('0x30')]);var _0x4782f2=originateValidation[_0xce35('0xf')](_0xc47d97[_0xce35('0x30')]);if(_0x4782f2[_0xce35('0x2b')]>0x0){return _0x3b1400[_0xce35('0x1d')](0x190)[_0xce35('0x31')](_0x4782f2);}var _0x1b0c8b=_0xc47d97[_0xce35('0x30')]['userId'];var _0x3af94e=_0xc47d97[_0xce35('0x30')][_0xce35('0x32')];var _0x215871=_0xc47d97[_0xce35('0x30')]['callerId'];var _0x523bfd=_0xc47d97['body'][_0xce35('0x33')];return getAgent(_0x1b0c8b)['then'](function(_0x3c8f90){logger[_0xce35('0x15')]('entityFound:',_0x3c8f90[_0xce35('0x1c')]);emit(util['format'](_0xce35('0x34'),_0x3c8f90[_0xce35('0x1c')]),_0xce35('0x35'),{'callNumber':_0x3af94e,'callerId':_0x215871,'callbackUrl':_0x523bfd});return _0x3b1400[_0xce35('0x1d')](0xc8)[_0xce35('0x31')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x3b1400));};exports[_0xce35('0x36')]=function(_0x4167e3,_0x3fb719){logger['info'](_0xce35('0x37'),_0x4167e3[_0xce35('0x30')]);var _0xd4c9d2=hangupValidation[_0xce35('0xf')](_0x4167e3['body']);if(_0xd4c9d2[_0xce35('0x2b')]>0x0){return _0x3fb719['status'](0x190)['json'](_0xd4c9d2);}var _0x5e2476=_0x4167e3[_0xce35('0x30')][_0xce35('0x38')];var _0x196b58=_0x4167e3['body'][_0xce35('0x2a')];return getAgent(_0x5e2476)[_0xce35('0x1f')](function(_0x23054e){logger['info'](_0xce35('0x39'),_0x23054e[_0xce35('0x1c')]);emit(util[_0xce35('0x3a')](_0xce35('0x34'),_0x23054e['name']),_0xce35('0x3b'),{'sessionId':_0x196b58});return _0x3fb719[_0xce35('0x1d')](0xc8)[_0xce35('0x31')]({'error':![],'message':_0xce35('0x3c')});})[_0xce35('0x3d')](handleError(_0x3fb719));};exports['answer']=function(_0x12cd0e,_0x5decc1){logger[_0xce35('0x15')](_0xce35('0x3e'),_0x12cd0e[_0xce35('0x30')]);var _0x3ec65d=answerValidation['validate'](_0x12cd0e[_0xce35('0x30')]);if(_0x3ec65d['length']>0x0){return _0x5decc1[_0xce35('0x1d')](0x190)[_0xce35('0x31')](_0x3ec65d);}var _0x469ee6=_0x12cd0e[_0xce35('0x30')]['userId'];var _0x269cee=_0x12cd0e[_0xce35('0x30')][_0xce35('0x2a')];return getAgent(_0x469ee6)[_0xce35('0x1f')](function(_0x467d57){logger['info'](_0xce35('0x39'),_0x467d57[_0xce35('0x1c')]);emit(util['format'](_0xce35('0x34'),_0x467d57[_0xce35('0x1c')]),_0xce35('0x3f'),{'sessionId':_0x269cee});return _0x5decc1[_0xce35('0x1d')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0xce35('0x3d')](handleError(_0x5decc1));};exports[_0xce35('0x40')]=function(_0x124ad7,_0x3cfdd1){logger[_0xce35('0x15')](_0xce35('0x41'),_0x124ad7['body']);var _0x2df4e5=holdValidation[_0xce35('0xf')](_0x124ad7[_0xce35('0x30')]);if(_0x2df4e5[_0xce35('0x2b')]>0x0){return _0x3cfdd1[_0xce35('0x1d')](0x190)[_0xce35('0x31')](_0x2df4e5);}var _0x53e85d=_0x124ad7[_0xce35('0x30')][_0xce35('0x38')];var _0x15adda=_0x124ad7[_0xce35('0x30')][_0xce35('0x2a')];return getAgent(_0x53e85d)['then'](function(_0x186ed4){logger['info'](_0xce35('0x39'),_0x186ed4[_0xce35('0x1c')]);emit(util[_0xce35('0x3a')]('user:%s',_0x186ed4['name']),_0xce35('0x42'),{'sessionId':_0x15adda});return _0x3cfdd1[_0xce35('0x1d')](0xc8)['json']({'error':![],'message':_0xce35('0x43')});})[_0xce35('0x3d')](handleError(_0x3cfdd1));};exports[_0xce35('0x44')]=function(_0x31653c,_0x356812){logger[_0xce35('0x15')](_0xce35('0x45'),_0x31653c[_0xce35('0x30')]);var _0x1bc491=unholdValidation[_0xce35('0xf')](_0x31653c['body']);if(_0x1bc491[_0xce35('0x2b')]>0x0){return _0x356812[_0xce35('0x1d')](0x190)['json'](_0x1bc491);}var _0xe17f25=_0x31653c[_0xce35('0x30')][_0xce35('0x38')];var _0x1780be=_0x31653c[_0xce35('0x30')][_0xce35('0x2a')];return getAgent(_0xe17f25)[_0xce35('0x1f')](function(_0x1a3331){logger[_0xce35('0x15')](_0xce35('0x39'),_0x1a3331[_0xce35('0x1c')]);emit(util[_0xce35('0x3a')](_0xce35('0x34'),_0x1a3331[_0xce35('0x1c')]),'webbar:unhold',{'sessionId':_0x1780be});return _0x356812['status'](0xc8)[_0xce35('0x31')]({'error':![],'message':_0xce35('0x46')});})[_0xce35('0x3d')](handleError(_0x356812));};exports[_0xce35('0x47')]=function(_0x2cc9ff,_0x134af4){logger['info'](_0xce35('0x48'),_0x134af4['body']);var _0x2b279d=callsValidation[_0xce35('0xf')](_0x2cc9ff[_0xce35('0x30')]);if(_0x2b279d[_0xce35('0x2b')]>0x0){return _0x134af4[_0xce35('0x1d')](0x190)[_0xce35('0x31')](_0x2b279d);}var _0x42785c=_0x2cc9ff[_0xce35('0x30')][_0xce35('0x38')];var _0x235c05=respondWithRpcPromise('VoiceChannels');var _0x4b0e7b=getAgent(_0x42785c);return Promise['all']([_0x235c05,_0x4b0e7b])[_0xce35('0x1f')](function(_0x4b49dc){var _0x28bbbb=_0x4b49dc[0x0];var _0x43e24e=_0x4b49dc[0x1];var _0x57334e=_[_0xce35('0x27')](_0x28bbbb[_0xce35('0x28')],function(_0x4d8d75){return _0x4d8d75[_0xce35('0x29')]==_0x43e24e['id'];});return _0x134af4[_0xce35('0x1d')](0xc8)['json']({'count':_0x57334e[_0xce35('0x2b')],'rows':_0x57334e});})[_0xce35('0x3d')](handleError(_0x134af4));};exports['conference']=function(_0xf62ac3,_0x4e73a1){logger[_0xce35('0x15')]('conference\x20fired:',_0xf62ac3[_0xce35('0x30')]);var _0x1cacae=conferenceValidation[_0xce35('0xf')](_0xf62ac3[_0xce35('0x30')]);if(_0x1cacae[_0xce35('0x2b')]>0x0){return _0x4e73a1['status'](0x190)[_0xce35('0x31')](_0x1cacae);}var _0x4d0c3e=_0xf62ac3[_0xce35('0x30')][_0xce35('0x38')];return getAgent(_0x4d0c3e)[_0xce35('0x1f')](function(_0x508e23){logger[_0xce35('0x15')](_0xce35('0x39'),_0x508e23[_0xce35('0x1c')]);emit(util[_0xce35('0x3a')](_0xce35('0x34'),_0x508e23[_0xce35('0x1c')]),_0xce35('0x49'));return _0x4e73a1[_0xce35('0x1d')](0xc8)[_0xce35('0x31')]({'error':![],'message':'conference\x20executed!'});})[_0xce35('0x3d')](handleError(_0x4e73a1));};exports[_0xce35('0x4a')]=function(_0x1c4ed8,_0x1924c7){logger[_0xce35('0x15')](_0xce35('0x4b'),_0x1c4ed8['body']);var _0x7cdf4a=transferValidation[_0xce35('0xf')](_0x1c4ed8[_0xce35('0x30')]);if(_0x7cdf4a['length']>0x0){return _0x1924c7[_0xce35('0x1d')](0x190)['json'](_0x7cdf4a);}var _0x1208be=_0x1c4ed8[_0xce35('0x30')][_0xce35('0x38')];var _0xef1e75=_0x1c4ed8[_0xce35('0x30')][_0xce35('0x2a')];var _0x465214=_0x1c4ed8[_0xce35('0x30')][_0xce35('0x4c')];return getAgent(_0x1208be)[_0xce35('0x1f')](function(_0x1eae3e){logger['info'](_0xce35('0x39'),_0x1eae3e[_0xce35('0x1c')]);emit(util['format']('user:%s',_0x1eae3e[_0xce35('0x1c')]),'webbar:transfer',{'sessionId':_0xef1e75,'transferNumber':_0x465214});return _0x1924c7['status'](0xc8)[_0xce35('0x31')]({'error':![],'message':_0xce35('0x4d')});})['catch'](handleError(_0x1924c7));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d2f949e..968d78e 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 _0xd2bd=['addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','send','put','update','destroy','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','/describe','isAuthenticated','describe','/:id','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd2bd,0xc1));var _0xdd2b=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xd2bd[_0x2dd390];return _0x3afe47;};'use strict';var multer=require(_0xdd2b('0x0'));var util=require(_0xdd2b('0x1'));var path=require(_0xdd2b('0x2'));var timeout=require(_0xdd2b('0x3'));var express=require(_0xdd2b('0x4'));var router=express[_0xdd2b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd2b('0x6'));var config=require(_0xdd2b('0x7'));var controller=require(_0xdd2b('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdd2b('0x9'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0xb')]);router['get'](_0xdd2b('0xc'),auth[_0xdd2b('0xa')](),controller['show']);router[_0xdd2b('0xd')](_0xdd2b('0xe'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0xf')]);router[_0xdd2b('0xd')](_0xdd2b('0x10'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x11')]);router['get'](_0xdd2b('0x12'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x13')]);router['get']('/:id/applications',auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x14')]);router[_0xdd2b('0x15')]('/',auth['isAuthenticated'](),controller[_0xdd2b('0x16')]);router[_0xdd2b('0x15')](_0xdd2b('0xe'),auth[_0xdd2b('0xa')](),controller['addDisposition']);router[_0xdd2b('0x15')](_0xdd2b('0x10'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x17')]);router[_0xdd2b('0x15')]('/:id/users',auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x18')]);router['post'](_0xdd2b('0x19'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x1a')]);router[_0xdd2b('0x15')](_0xdd2b('0x1b'),controller[_0xdd2b('0x1c')]);router['post']('/:id/send',auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x1d')]);router[_0xdd2b('0x1e')](_0xdd2b('0xc'),auth['isAuthenticated'](),controller[_0xdd2b('0x1f')]);router['delete'](_0xdd2b('0xc'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x20')]);router[_0xdd2b('0x21')](_0xdd2b('0xe'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x22')]);router[_0xdd2b('0x21')](_0xdd2b('0x10'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x23')]);router[_0xdd2b('0x21')](_0xdd2b('0x12'),auth[_0xdd2b('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xa781=['/:id','destroy','/:id/dispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAgents','/:id/applications','addApplications','/:id/notify','/:id/send','send','put','update','delete'];(function(_0x311552,_0x91f5cf){var _0x5d5c3c=function(_0x2e4555){while(--_0x2e4555){_0x311552['push'](_0x311552['shift']());}};_0x5d5c3c(++_0x91f5cf);}(_0xa781,0x1be));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1a78('0x0'));var util=require(_0x1a78('0x1'));var path=require(_0x1a78('0x2'));var timeout=require(_0x1a78('0x3'));var express=require(_0x1a78('0x4'));var router=express[_0x1a78('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1a78('0x6'));var interaction=require(_0x1a78('0x7'));var config=require(_0x1a78('0x8'));var controller=require(_0x1a78('0x9'));router[_0x1a78('0xa')]('/',auth[_0x1a78('0xb')](),controller[_0x1a78('0xc')]);router[_0x1a78('0xa')](_0x1a78('0xd'),auth[_0x1a78('0xb')](),controller[_0x1a78('0xe')]);router[_0x1a78('0xa')]('/:id',auth[_0x1a78('0xb')](),controller[_0x1a78('0xf')]);router[_0x1a78('0xa')]('/:id/dispositions',auth[_0x1a78('0xb')](),controller[_0x1a78('0x10')]);router[_0x1a78('0xa')](_0x1a78('0x11'),auth['isAuthenticated'](),controller[_0x1a78('0x12')]);router[_0x1a78('0xa')](_0x1a78('0x13'),auth[_0x1a78('0xb')](),controller[_0x1a78('0x14')]);router[_0x1a78('0xa')]('/:id/applications',auth[_0x1a78('0xb')](),controller[_0x1a78('0x15')]);router[_0x1a78('0x16')]('/',auth[_0x1a78('0xb')](),controller[_0x1a78('0x17')]);router[_0x1a78('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1a78('0x18')]);router[_0x1a78('0x16')](_0x1a78('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/:id/users',auth[_0x1a78('0xb')](),controller[_0x1a78('0x19')]);router[_0x1a78('0x16')](_0x1a78('0x1a'),auth[_0x1a78('0xb')](),controller[_0x1a78('0x1b')]);router[_0x1a78('0x16')](_0x1a78('0x1c'),controller['notify']);router[_0x1a78('0x16')](_0x1a78('0x1d'),auth[_0x1a78('0xb')](),controller[_0x1a78('0x1e')]);router[_0x1a78('0x1f')]('/:id',auth[_0x1a78('0xb')](),controller[_0x1a78('0x20')]);router[_0x1a78('0x21')](_0x1a78('0x22'),auth[_0x1a78('0xb')](),controller[_0x1a78('0x23')]);router[_0x1a78('0x21')](_0x1a78('0x24'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1a78('0x25')]);router[_0x1a78('0x21')](_0x1a78('0x13'),auth['isAuthenticated'](),controller[_0x1a78('0x26')]);module[_0x1a78('0x27')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6a7a578..bbe9249 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 _0xd8f3=['sequelize','randomstring','exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition'];(function(_0x2654ec,_0x30d1ba){var _0x4c3b5=function(_0x464e80){while(--_0x464e80){_0x2654ec['push'](_0x2654ec['shift']());}};_0x4c3b5(++_0x30d1ba);}(_0xd8f3,0xc4));var _0x3d8f=function(_0x38de8f,_0x355e35){_0x38de8f=_0x38de8f-0x0;var _0x59cadf=_0xd8f3[_0x38de8f];return _0x59cadf;};'use strict';var Sequelize=require(_0x3d8f('0x0'));var rs=require(_0x3d8f('0x1'));module[_0x3d8f('0x2')]={'name':{'type':Sequelize[_0x3d8f('0x3')],'unique':_0x3d8f('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x3d8f('0x3')],'defaultValue':function(){return rs[_0x3d8f('0x5')]();}},'phone':{'type':Sequelize[_0x3d8f('0x3')]},'type':{'type':Sequelize[_0x3d8f('0x6')]('twilio',_0x3d8f('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x3d8f('0x3')]},'authToken':{'type':Sequelize[_0x3d8f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3d8f('0x8')],'defaultValue':function(){return _0x3d8f('0x9');}},'notificationSound':{'type':Sequelize[_0x3d8f('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3d8f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3d8f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3d8f('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3d8f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3d8f('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3d8f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3d8f('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3d8f('0xa')],'defaultValue':![],'comment':_0x3d8f('0xc'),'set':function(_0x4ad3c8){if(!_0x4ad3c8){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x3d8f('0xd'),_0x4ad3c8);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb072=['INTEGER','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','sinch','TEXT'];(function(_0x22d6e6,_0x41a3e0){var _0x2eb9a2=function(_0x1be80c){while(--_0x1be80c){_0x22d6e6['push'](_0x22d6e6['shift']());}};_0x2eb9a2(++_0x41a3e0);}(_0xb072,0x1cd));var _0x2b07=function(_0x42b683,_0x150e5e){_0x42b683=_0x42b683-0x0;var _0xf3a6f2=_0xb072[_0x42b683];return _0xf3a6f2;};'use strict';var Sequelize=require(_0x2b07('0x0'));var rs=require(_0x2b07('0x1'));module['exports']={'name':{'type':Sequelize[_0x2b07('0x2')],'unique':_0x2b07('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x2b07('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x2b07('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x2b07('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x2b07('0x2')]},'type':{'type':Sequelize[_0x2b07('0x4')]('twilio',_0x2b07('0x5'))},'accountSid':{'type':Sequelize[_0x2b07('0x2')]},'baseUrl':{'type':Sequelize[_0x2b07('0x2')]},'authToken':{'type':Sequelize[_0x2b07('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2b07('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['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2b07('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2b07('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2b07('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2b07('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2b07('0x8')],'defaultValue':![],'comment':_0x2b07('0x9'),'set':function(_0x72f255){if(!_0x72f255){this[_0x2b07('0xa')](_0x2b07('0xb'),null);}this[_0x2b07('0xa')](_0x2b07('0xc'),_0x72f255);}},'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 c9b03e4..3c40f11 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 _0xd89b=['CmContact','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','mandatoryDispositionPause','keys','find','create','body','role','user','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','sendStatus','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','MessageSid','sinch','from','notifications','messageId','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','send','\x0a','to\x20is\x20mandatory','List'];(function(_0x4a5577,_0x449d77){var _0x4fd4e3=function(_0x373996){while(--_0x373996){_0x4a5577['push'](_0x4a5577['shift']());}};_0x4fd4e3(++_0x449d77);}(_0xd89b,0xca));var _0xbd89=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xd89b[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd89('0x0'));var zipdir=require(_0xbd89('0x1'));var jsonpatch=require(_0xbd89('0x2'));var rp=require(_0xbd89('0x3'));var moment=require(_0xbd89('0x4'));var BPromise=require(_0xbd89('0x5'));var Mustache=require(_0xbd89('0x6'));var util=require(_0xbd89('0x7'));var path=require(_0xbd89('0x8'));var sox=require('sox');var csv=require(_0xbd89('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbd89('0xa'));var crypto=require(_0xbd89('0xb'));var jsforce=require(_0xbd89('0xc'));var deskjs=require(_0xbd89('0xd'));var toCsv=require(_0xbd89('0x9'));var querystring=require(_0xbd89('0xe'));var Papa=require(_0xbd89('0xf'));var Redis=require(_0xbd89('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbd89('0x11'));var as=require(_0xbd89('0x12'));var hardwareService=require(_0xbd89('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbd89('0x14'));var config=require(_0xbd89('0x15'));var licenseUtil=require(_0xbd89('0x16'));var db=require(_0xbd89('0x17'))['db'];config[_0xbd89('0x18')]=_['defaults'](config[_0xbd89('0x18')],{'host':_0xbd89('0x19'),'port':0x18eb});var socket=require(_0xbd89('0x1a'))(new Redis(config[_0xbd89('0x18')]));require(_0xbd89('0x1b'))['register'](socket);var jayson=require(_0xbd89('0x1c'));var client=jayson['client'][_0xbd89('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x12fc65,_0x1ba0f5,_0x1a6b59,_0x1e516c){return new BPromise(function(_0x5a659c,_0x1f857e){var _0x3f2ed2=_0x1e516c||client;return _0x3f2ed2[_0xbd89('0x1e')](_0x12fc65,_0x1a6b59)[_0xbd89('0x1f')](function(_0xa31b1d){logger[_0xbd89('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x1ba0f5,_0xbd89('0x21'));logger[_0xbd89('0x22')](_0xbd89('0x23'),_0x1ba0f5,'request\x20sent',JSON['stringify'](_0xa31b1d));if(_0xa31b1d[_0xbd89('0x24')]){if(_0xa31b1d['error'][_0xbd89('0x25')]===0x1f4){logger[_0xbd89('0x24')](_0xbd89('0x26'),_0x1ba0f5,_0xa31b1d['error'][_0xbd89('0x27')]);return _0x1f857e(_0xa31b1d['error'][_0xbd89('0x27')]);}logger[_0xbd89('0x24')](_0xbd89('0x26'),_0x1ba0f5,_0xa31b1d[_0xbd89('0x24')]['message']);return _0x5a659c(_0xa31b1d[_0xbd89('0x24')]['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1ba0f5,_0xbd89('0x21'));_0x5a659c(_0xa31b1d[_0xbd89('0x28')]['message']);}})[_0xbd89('0x29')](function(_0x1ccebf){logger['error'](_0xbd89('0x26'),_0x1ba0f5,_0x1ccebf);_0x1f857e(_0x1ccebf);});});}function respondWithStatusCode(_0x5a5847,_0xdd08d9){_0xdd08d9=_0xdd08d9||0xcc;return function(_0x162eca){if(_0x162eca){return _0x5a5847['sendStatus'](_0xdd08d9);}return _0x5a5847['status'](_0xdd08d9)[_0xbd89('0x2a')]();};}function respondWithResult(_0x2d7552,_0x186e3c){_0x186e3c=_0x186e3c||0xc8;return function(_0x129f07){if(_0x129f07){return _0x2d7552[_0xbd89('0x2b')](_0x186e3c)[_0xbd89('0x2c')](_0x129f07);}};}function respondWithFilteredResult(_0x195f94,_0x5e6c11){return function(_0x360b54){if(_0x360b54){var _0x5afaeb=typeof _0x5e6c11[_0xbd89('0x2d')]===_0xbd89('0x2e')&&typeof _0x5e6c11[_0xbd89('0x2f')]===_0xbd89('0x2e');var _0xad238a=_0x360b54['count'];var _0xc44f28=_0x5afaeb?0x0:_0x5e6c11[_0xbd89('0x2d')];var _0x3affcd=_0x5afaeb?_0x360b54['count']:_0x5e6c11[_0xbd89('0x2d')]+_0x5e6c11[_0xbd89('0x2f')];var _0x2fcd7a;if(_0x3affcd>=_0xad238a){_0x3affcd=_0xad238a;_0x2fcd7a=0xc8;}else{_0x2fcd7a=0xce;}_0x195f94[_0xbd89('0x2b')](_0x2fcd7a);return _0x195f94['set'](_0xbd89('0x30'),_0xc44f28+'-'+_0x3affcd+'/'+_0xad238a)['json'](_0x360b54);}return null;};}function patchUpdates(_0x2fdaed){return function(_0x3aec27){try{jsonpatch[_0xbd89('0x31')](_0x3aec27,_0x2fdaed,!![]);}catch(_0x2dd753){return BPromise[_0xbd89('0x32')](_0x2dd753);}return _0x3aec27[_0xbd89('0x33')]();};}function saveUpdates(_0x3dbdca,_0x20de25){return function(_0x48865b){if(_0x48865b){return _0x48865b[_0xbd89('0x34')](_0x3dbdca)[_0xbd89('0x1f')](function(_0xc3ee2b){return _0xc3ee2b;});}return null;};}function removeEntity(_0x1d7f0b,_0x7719d){return function(_0x1546d){if(_0x1546d){return _0x1546d[_0xbd89('0x35')]()[_0xbd89('0x1f')](function(){var _0x4a582c=_0x1546d[_0xbd89('0x36')]({'plain':!![]});var _0x19942b=_0xbd89('0x37');return db[_0xbd89('0x38')][_0xbd89('0x35')]({'where':{'type':_0x19942b,'resourceId':_0x4a582c['id']}})['then'](function(){return _0x1546d;});})[_0xbd89('0x1f')](function(){_0x1d7f0b['status'](0xcc)[_0xbd89('0x2a')]();});}};}function handleEntityNotFound(_0x655878,_0x2714f7){return function(_0x1517d4){if(!_0x1517d4){_0x655878['sendStatus'](0x194);}return _0x1517d4;};}function handleError(_0x549135,_0x44212c){_0x44212c=_0x44212c||0x1f4;return function(_0x550cb4){logger['error'](_0x550cb4[_0xbd89('0x39')]);if(_0x550cb4[_0xbd89('0x3a')]){delete _0x550cb4['name'];}_0x549135['status'](_0x44212c)['send'](_0x550cb4);};}exports[_0xbd89('0x3b')]=function(_0x47b490,_0x6256ca){var _0x84a472={'include':[{'model':db[_0xbd89('0x3c')],'as':'mandatoryDispositionPause'}]},_0x12d2dd={},_0x163a8c={'count':0x0,'rows':[]};var _0x567a54=_[_0xbd89('0x3d')](db[_0xbd89('0x3e')][_0xbd89('0x3f')],function(_0x48ced3){return{'name':_0x48ced3[_0xbd89('0x40')],'type':_0x48ced3[_0xbd89('0x41')][_0xbd89('0x42')]};});_0x12d2dd[_0xbd89('0x43')]=_[_0xbd89('0x3d')](_0x567a54,_0xbd89('0x3a'));_0x12d2dd[_0xbd89('0x44')]=_['keys'](_0x47b490[_0xbd89('0x44')]);_0x12d2dd[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x12d2dd[_0xbd89('0x43')],_0x12d2dd[_0xbd89('0x44')]);_0x84a472['attributes']=_[_0xbd89('0x46')](_0x12d2dd[_0xbd89('0x43')],qs[_0xbd89('0x47')](_0x47b490[_0xbd89('0x44')][_0xbd89('0x47')]));_0x84a472['attributes']=_0x84a472[_0xbd89('0x48')][_0xbd89('0x49')]?_0x84a472['attributes']:_0x12d2dd[_0xbd89('0x43')];if(!_0x47b490[_0xbd89('0x44')][_0xbd89('0x4a')](_0xbd89('0x4b'))){_0x84a472[_0xbd89('0x2f')]=qs[_0xbd89('0x2f')](_0x47b490[_0xbd89('0x44')][_0xbd89('0x2f')]);_0x84a472[_0xbd89('0x2d')]=qs['offset'](_0x47b490[_0xbd89('0x44')]['offset']);}_0x84a472[_0xbd89('0x4c')]=qs[_0xbd89('0x4d')](_0x47b490[_0xbd89('0x44')][_0xbd89('0x4d')]);_0x84a472[_0xbd89('0x4e')]=qs['filters'](_[_0xbd89('0x4f')](_0x47b490[_0xbd89('0x44')],_0x12d2dd[_0xbd89('0x45')]),_0x567a54);if(_0x47b490['query'][_0xbd89('0x50')]){_0x84a472['where']=_[_0xbd89('0x51')](_0x84a472['where'],{'$or':_[_0xbd89('0x3d')](_0x567a54,function(_0x38d3d1){if(_0x38d3d1[_0xbd89('0x41')]!==_0xbd89('0x52')){var _0x4abff6={};_0x4abff6[_0x38d3d1['name']]={'$like':'%'+_0x47b490[_0xbd89('0x44')][_0xbd89('0x50')]+'%'};return _0x4abff6;}})});}_0x84a472=_[_0xbd89('0x51')]({},_0x84a472,_0x47b490[_0xbd89('0x53')]);var _0x115607={'where':_0x84a472[_0xbd89('0x4e')]};return db[_0xbd89('0x3e')][_0xbd89('0x54')](_0x115607)[_0xbd89('0x1f')](function(_0x20b199){_0x163a8c['count']=_0x20b199;if(_0x47b490[_0xbd89('0x44')][_0xbd89('0x55')]){_0x84a472[_0xbd89('0x56')]=[{'all':!![]}];}return db[_0xbd89('0x3e')]['findAll'](_0x84a472);})[_0xbd89('0x1f')](function(_0x23c6d3){_0x163a8c['rows']=_0x23c6d3;return _0x163a8c;})[_0xbd89('0x1f')](respondWithFilteredResult(_0x6256ca,_0x84a472))[_0xbd89('0x29')](handleError(_0x6256ca,null));};exports[_0xbd89('0x57')]=function(_0x237e39,_0x332938){var _0x50a48b={'raw':![],'where':{'id':_0x237e39[_0xbd89('0x58')]['id']},'include':[{'model':db[_0xbd89('0x3c')],'as':_0xbd89('0x59')}]},_0x5a0a2b={};_0x5a0a2b[_0xbd89('0x43')]=_[_0xbd89('0x5a')](db[_0xbd89('0x3e')]['rawAttributes']);_0x5a0a2b[_0xbd89('0x44')]=_[_0xbd89('0x5a')](_0x237e39[_0xbd89('0x44')]);_0x5a0a2b[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x5a0a2b['model'],_0x5a0a2b['query']);_0x50a48b[_0xbd89('0x48')]=_[_0xbd89('0x46')](_0x5a0a2b['model'],qs['fields'](_0x237e39['query'][_0xbd89('0x47')]));_0x50a48b[_0xbd89('0x48')]=_0x50a48b[_0xbd89('0x48')][_0xbd89('0x49')]?_0x50a48b['attributes']:_0x5a0a2b[_0xbd89('0x43')];if(_0x237e39[_0xbd89('0x44')][_0xbd89('0x55')]){_0x50a48b[_0xbd89('0x56')]=[{'all':!![]}];}_0x50a48b=_[_0xbd89('0x51')]({},_0x50a48b,_0x237e39[_0xbd89('0x53')]);return db[_0xbd89('0x3e')][_0xbd89('0x5b')](_0x50a48b)[_0xbd89('0x1f')](handleEntityNotFound(_0x332938,null))[_0xbd89('0x1f')](respondWithResult(_0x332938,null))[_0xbd89('0x29')](handleError(_0x332938,null));};exports[_0xbd89('0x5c')]=function(_0x26520b,_0x17245f){return db[_0xbd89('0x3e')][_0xbd89('0x5c')](_0x26520b[_0xbd89('0x5d')],{})[_0xbd89('0x1f')](function(_0x4e0821){var _0xc107c9=_0x26520b['user'][_0xbd89('0x36')]({'plain':!![]});if(!_0xc107c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc107c9[_0xbd89('0x5e')]===_0xbd89('0x5f')){var _0x5975d9=_0x4e0821[_0xbd89('0x36')]({'plain':!![]});var _0x3597b0=_0xbd89('0x37');return db['UserProfileSection'][_0xbd89('0x5b')]({'where':{'name':_0x3597b0,'userProfileId':_0xc107c9[_0xbd89('0x60')]},'raw':!![]})['then'](function(_0x47012f){if(_0x47012f&&_0x47012f[_0xbd89('0x61')]===0x0){return db[_0xbd89('0x38')][_0xbd89('0x5c')]({'name':_0x5975d9['name'],'resourceId':_0x5975d9['id'],'type':_0x47012f[_0xbd89('0x3a')],'sectionId':_0x47012f['id']},{})[_0xbd89('0x1f')](function(){return _0x4e0821;});}else{return _0x4e0821;}})[_0xbd89('0x29')](function(_0x5906bd){logger[_0xbd89('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5906bd);throw _0x5906bd;});}return _0x4e0821;})[_0xbd89('0x1f')](respondWithResult(_0x17245f,0xc9))[_0xbd89('0x29')](handleError(_0x17245f,null));};exports[_0xbd89('0x34')]=function(_0x584eaf,_0x2e97ed){if(_0x584eaf[_0xbd89('0x5d')]['id']){delete _0x584eaf[_0xbd89('0x5d')]['id'];}return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x584eaf[_0xbd89('0x58')]['id']},'include':[{'model':db[_0xbd89('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xbd89('0x1f')](handleEntityNotFound(_0x2e97ed,null))[_0xbd89('0x1f')](saveUpdates(_0x584eaf[_0xbd89('0x5d')],null))['then'](respondWithResult(_0x2e97ed,null))['catch'](handleError(_0x2e97ed,null));};exports[_0xbd89('0x35')]=function(_0x31a573,_0x368f0b){return db[_0xbd89('0x3e')]['find']({'where':{'id':_0x31a573[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0x368f0b,null))['then'](removeEntity(_0x368f0b,null))['catch'](handleError(_0x368f0b,null));};exports[_0xbd89('0x62')]=function(_0x4be061,_0x2a58d2){return db[_0xbd89('0x3e')][_0xbd89('0x62')]()[_0xbd89('0x1f')](respondWithResult(_0x2a58d2,null))[_0xbd89('0x29')](handleError(_0x2a58d2,null));};exports[_0xbd89('0x63')]=function(_0x4d7a19,_0x36269d,_0x5fb844){if(_0x4d7a19[_0xbd89('0x5d')]['id']){delete _0x4d7a19['body']['id'];}return db[_0xbd89('0x3e')]['find']({'where':{'id':_0x4d7a19[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0x36269d,null))[_0xbd89('0x1f')](function(_0x1d7e1a){if(_0x1d7e1a){_0x4d7a19['body'][_0xbd89('0x64')]=_0x1d7e1a['id'];return db[_0xbd89('0x65')][_0xbd89('0x5c')](_0x4d7a19[_0xbd89('0x5d')]);}})['then'](respondWithResult(_0x36269d,null))[_0xbd89('0x29')](handleError(_0x36269d,null));};exports[_0xbd89('0x66')]=function(_0x2df7e5,_0x34cfe4,_0x408000){var _0x4ed2ab={'raw':![],'where':{}};var _0x104d24={};var _0x5d5dad={'count':0x0,'rows':[]};return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x2df7e5['params']['id']}})['then'](handleEntityNotFound(_0x34cfe4,null))['then'](function(_0x304763){if(_0x304763){_0x104d24[_0xbd89('0x43')]=_[_0xbd89('0x5a')](db[_0xbd89('0x65')][_0xbd89('0x3f')]);_0x104d24['query']=_[_0xbd89('0x5a')](_0x2df7e5['query']);_0x104d24[_0xbd89('0x45')]=_['intersection'](_0x104d24['model'],_0x104d24['query']);_0x4ed2ab[_0xbd89('0x48')]=_['intersection'](_0x104d24[_0xbd89('0x43')],qs[_0xbd89('0x47')](_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x47')]));_0x4ed2ab[_0xbd89('0x48')]=_0x4ed2ab[_0xbd89('0x48')][_0xbd89('0x49')]?_0x4ed2ab[_0xbd89('0x48')]:_0x104d24[_0xbd89('0x43')];if(!_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x4a')](_0xbd89('0x4b'))){_0x4ed2ab[_0xbd89('0x2f')]=qs[_0xbd89('0x2f')](_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x2f')]);_0x4ed2ab[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x2d')]);}_0x4ed2ab[_0xbd89('0x4c')]=qs[_0xbd89('0x4d')](_0x2df7e5['query']['sort']);_0x4ed2ab[_0xbd89('0x4e')]=qs[_0xbd89('0x45')](_[_0xbd89('0x4f')](_0x2df7e5[_0xbd89('0x44')],_0x104d24[_0xbd89('0x45')]));_0x4ed2ab['where'][_0xbd89('0x64')]=_0x304763['id'];if(_0x2df7e5['query'][_0xbd89('0x50')]){_0x4ed2ab[_0xbd89('0x4e')]=_['merge'](_0x4ed2ab[_0xbd89('0x4e')],{'$or':_['map'](_0x4ed2ab[_0xbd89('0x48')],function(_0x2f6f4d){var _0x583530={};_0x583530[_0x2f6f4d]={'$like':'%'+_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x50')]+'%'};return _0x583530;})});}_0x4ed2ab=_[_0xbd89('0x51')]({},_0x4ed2ab,_0x2df7e5[_0xbd89('0x53')]);return db[_0xbd89('0x65')][_0xbd89('0x54')]({'where':_0x4ed2ab['where']})[_0xbd89('0x1f')](function(_0x3af97a){_0x5d5dad[_0xbd89('0x54')]=_0x3af97a;if(_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x55')]){_0x4ed2ab[_0xbd89('0x56')]=[{'all':!![]}];}return db[_0xbd89('0x65')][_0xbd89('0x68')](_0x4ed2ab);})[_0xbd89('0x1f')](function(_0x27e59f){_0x5d5dad[_0xbd89('0x69')]=_0x27e59f;return _0x5d5dad;});}})['then'](respondWithFilteredResult(_0x34cfe4,_0x4ed2ab))['catch'](handleError(_0x34cfe4,null));};exports['removeDispositions']=function(_0x4bea5f,_0x224ee0,_0x51635d){return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x4bea5f['params']['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x224ee0,null))['then'](function(_0x5322f0){if(_0x5322f0){return _0x5322f0[_0xbd89('0x6a')](_0x4bea5f[_0xbd89('0x44')][_0xbd89('0x6b')]);}})['then'](respondWithStatusCode(_0x224ee0,null))[_0xbd89('0x29')](handleError(_0x224ee0,null));};exports[_0xbd89('0x6c')]=function(_0x2603bb,_0x2e788c,_0x544ad4){if(_0x2603bb['body']['id']){delete _0x2603bb[_0xbd89('0x5d')]['id'];}return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x2603bb[_0xbd89('0x58')]['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x2e788c,null))[_0xbd89('0x1f')](function(_0x4b3346){if(_0x4b3346){_0x2603bb[_0xbd89('0x5d')]['WhatsappAccountId']=_0x4b3346['id'];return db[_0xbd89('0x6d')][_0xbd89('0x5c')](_0x2603bb['body']);}})[_0xbd89('0x1f')](respondWithResult(_0x2e788c,null))[_0xbd89('0x29')](handleError(_0x2e788c,null));};exports['getAnswers']=function(_0x265afe,_0x5e5ae7,_0x14c86b){var _0x593bf7={'raw':![],'where':{}};var _0x2532e9={};var _0x691a31={'count':0x0,'rows':[]};return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x265afe[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e5ae7,null))['then'](function(_0x3d25b8){if(_0x3d25b8){_0x2532e9[_0xbd89('0x43')]=_[_0xbd89('0x5a')](db[_0xbd89('0x6d')][_0xbd89('0x3f')]);_0x2532e9[_0xbd89('0x44')]=_[_0xbd89('0x5a')](_0x265afe[_0xbd89('0x44')]);_0x2532e9[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x2532e9['model'],_0x2532e9[_0xbd89('0x44')]);_0x593bf7['attributes']=_[_0xbd89('0x46')](_0x2532e9[_0xbd89('0x43')],qs[_0xbd89('0x47')](_0x265afe[_0xbd89('0x44')][_0xbd89('0x47')]));_0x593bf7[_0xbd89('0x48')]=_0x593bf7[_0xbd89('0x48')][_0xbd89('0x49')]?_0x593bf7[_0xbd89('0x48')]:_0x2532e9[_0xbd89('0x43')];if(!_0x265afe[_0xbd89('0x44')]['hasOwnProperty'](_0xbd89('0x4b'))){_0x593bf7[_0xbd89('0x2f')]=qs[_0xbd89('0x2f')](_0x265afe[_0xbd89('0x44')][_0xbd89('0x2f')]);_0x593bf7[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x265afe['query'][_0xbd89('0x2d')]);}_0x593bf7[_0xbd89('0x4c')]=qs[_0xbd89('0x4d')](_0x265afe[_0xbd89('0x44')][_0xbd89('0x4d')]);_0x593bf7['where']=qs[_0xbd89('0x45')](_[_0xbd89('0x4f')](_0x265afe[_0xbd89('0x44')],_0x2532e9[_0xbd89('0x45')]));_0x593bf7[_0xbd89('0x4e')][_0xbd89('0x64')]=_0x3d25b8['id'];if(_0x265afe[_0xbd89('0x44')]['filter']){_0x593bf7[_0xbd89('0x4e')]=_[_0xbd89('0x51')](_0x593bf7['where'],{'$or':_[_0xbd89('0x3d')](_0x593bf7[_0xbd89('0x48')],function(_0x619b56){var _0x593a60={};_0x593a60[_0x619b56]={'$like':'%'+_0x265afe[_0xbd89('0x44')]['filter']+'%'};return _0x593a60;})});}_0x593bf7=_['merge']({},_0x593bf7,_0x265afe[_0xbd89('0x53')]);return db[_0xbd89('0x6d')]['count']({'where':_0x593bf7[_0xbd89('0x4e')]})[_0xbd89('0x1f')](function(_0x2fd14c){_0x691a31[_0xbd89('0x54')]=_0x2fd14c;if(_0x265afe[_0xbd89('0x44')][_0xbd89('0x55')]){_0x593bf7[_0xbd89('0x56')]=[{'all':!![]}];}return db[_0xbd89('0x6d')][_0xbd89('0x68')](_0x593bf7);})[_0xbd89('0x1f')](function(_0x70104e){_0x691a31[_0xbd89('0x69')]=_0x70104e;return _0x691a31;});}})[_0xbd89('0x1f')](respondWithFilteredResult(_0x5e5ae7,_0x593bf7))['catch'](handleError(_0x5e5ae7,null));};exports['removeAnswers']=function(_0xad4be6,_0x23319f,_0x5e89dc){return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0xad4be6[_0xbd89('0x58')]['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x23319f,null))[_0xbd89('0x1f')](function(_0x131a87){if(_0x131a87){return _0x131a87[_0xbd89('0x6e')](_0xad4be6[_0xbd89('0x44')][_0xbd89('0x6b')]);}})['then'](respondWithStatusCode(_0x23319f,null))[_0xbd89('0x29')](handleError(_0x23319f,null));};exports[_0xbd89('0x6f')]=function(_0x46bf40,_0x12e44e,_0xfda6c1){return db['WhatsappAccount'][_0xbd89('0x5b')]({'where':{'id':_0x46bf40[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0x12e44e,null))[_0xbd89('0x1f')](function(_0x50b8da){if(_0x50b8da){return _0x50b8da['addAgents'](_0x46bf40['body'][_0xbd89('0x6b')],_[_0xbd89('0x70')](_0x46bf40['body'],['ids','id'])||{})[_0xbd89('0x71')](function(_0x1b7cba){for(var _0x1ec779=0x0;_0x1ec779<_0x46bf40[_0xbd89('0x5d')][_0xbd89('0x6b')][_0xbd89('0x49')];_0x1ec779+=0x1){socket[_0xbd89('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x46bf40[_0xbd89('0x5d')]['ids'][_0x1ec779]),'WhatsappAccountId':Number(_0x46bf40['params']['id'])});}return _0x1b7cba;});}})[_0xbd89('0x1f')](respondWithResult(_0x12e44e,null))[_0xbd89('0x29')](handleError(_0x12e44e,null));};exports[_0xbd89('0x73')]=function(_0x2cc6ee,_0x3c0d53,_0x1a2b74){return db['WhatsappAccount'][_0xbd89('0x5b')]({'where':{'id':_0x2cc6ee['params']['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x3c0d53,null))[_0xbd89('0x1f')](function(_0x47073a){if(_0x47073a){return _0x47073a['removeAgents'](_0x2cc6ee['query']['ids'])[_0xbd89('0x1f')](function(){if(_[_0xbd89('0x74')](_0x2cc6ee[_0xbd89('0x44')][_0xbd89('0x6b')])){for(var _0x574124=0x0;_0x574124<_0x2cc6ee[_0xbd89('0x44')][_0xbd89('0x6b')][_0xbd89('0x49')];_0x574124+=0x1){socket['emit'](_0xbd89('0x75'),{'UserId':Number(_0x2cc6ee['query'][_0xbd89('0x6b')][_0x574124]),'WhatsappAccountId':Number(_0x2cc6ee[_0xbd89('0x58')]['id'])});}}else{socket[_0xbd89('0x72')](_0xbd89('0x75'),{'UserId':Number(_0x2cc6ee[_0xbd89('0x44')][_0xbd89('0x6b')]),'WhatsappAccountId':Number(_0x2cc6ee[_0xbd89('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c0d53,null))[_0xbd89('0x29')](handleError(_0x3c0d53,null));};exports[_0xbd89('0x76')]=function(_0x50c8e0,_0xbf80c2,_0xb8b265){var _0x3eca14={};var _0x33872e={};var _0x459c49;var _0x26bc3f;return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x50c8e0[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0xbf80c2,null))['then'](function(_0x105b63){if(_0x105b63){_0x459c49=_0x105b63;_0x33872e['model']=_['keys'](db[_0xbd89('0x77')][_0xbd89('0x3f')]);_0x33872e[_0xbd89('0x44')]=_[_0xbd89('0x5a')](_0x50c8e0['query']);_0x33872e[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x33872e['model'],_0x33872e[_0xbd89('0x44')]);_0x3eca14[_0xbd89('0x48')]=_['intersection'](_0x33872e[_0xbd89('0x43')],qs[_0xbd89('0x47')](_0x50c8e0['query'][_0xbd89('0x47')]));_0x3eca14['attributes']=_0x3eca14['attributes'][_0xbd89('0x49')]?_0x3eca14['attributes']:_0x33872e['model'];_0x3eca14['order']=qs['sort'](_0x50c8e0['query'][_0xbd89('0x4d')]);_0x3eca14[_0xbd89('0x4e')]=qs[_0xbd89('0x45')](_[_0xbd89('0x4f')](_0x50c8e0['query'],_0x33872e[_0xbd89('0x45')]));if(_0x50c8e0['query'][_0xbd89('0x50')]){_0x3eca14[_0xbd89('0x4e')]=_[_0xbd89('0x51')](_0x3eca14[_0xbd89('0x4e')],{'$or':_['map'](_0x3eca14[_0xbd89('0x48')],function(_0x47f520){var _0x234d33={};_0x234d33[_0x47f520]={'$like':'%'+_0x50c8e0['query']['filter']+'%'};return _0x234d33;})});}_0x3eca14=_[_0xbd89('0x51')]({},_0x3eca14,_0x50c8e0[_0xbd89('0x53')]);return _0x459c49[_0xbd89('0x76')](_0x3eca14);}})[_0xbd89('0x1f')](function(_0x575816){if(_0x575816){_0x26bc3f=_0x575816['length'];if(!_0x50c8e0[_0xbd89('0x44')]['hasOwnProperty'](_0xbd89('0x4b'))){_0x3eca14[_0xbd89('0x2f')]=qs[_0xbd89('0x2f')](_0x50c8e0['query'][_0xbd89('0x2f')]);_0x3eca14[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x50c8e0[_0xbd89('0x44')][_0xbd89('0x2d')]);}return _0x459c49['getAgents'](_0x3eca14);}})[_0xbd89('0x1f')](function(_0x3455a9){if(_0x3455a9){return _0x3455a9?{'count':_0x26bc3f,'rows':_0x3455a9}:null;}})['then'](respondWithResult(_0xbf80c2,null))[_0xbd89('0x29')](handleError(_0xbf80c2,null));};exports[_0xbd89('0x78')]=function(_0x673da3,_0x4c0314){var _0x194df1=_0x673da3[_0xbd89('0x58')]['id'];var _0x51430a=_0x673da3[_0xbd89('0x5d')];var _0x2f2cb7=0xc8;var _0x4d5354=null;return db[_0xbd89('0x79')]['transaction']({'isolationLevel':db[_0xbd89('0x79')][_0xbd89('0x7a')][_0xbd89('0x7b')][_0xbd89('0x7c')]},function(_0x517b8a){return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x194df1},'transaction':_0x517b8a})[_0xbd89('0x1f')](function(_0x3c3601){if(_0x3c3601){return db['WhatsappApplication'][_0xbd89('0x35')]({'where':{'WhatsappAccountId':_0x194df1},'transaction':_0x517b8a})['then'](function(){var _0x47b772=_[_0xbd89('0x3d')](_0x51430a,function(_0x271190){_0x271190[_0xbd89('0x64')]=_0x194df1;return _0x271190;});return db[_0xbd89('0x7d')]['bulkCreate'](_0x47b772,{'transaction':_0x517b8a});});}else{_0x2f2cb7=0x194;_0x4d5354=[];}});})['then'](function(){if(_0x2f2cb7!==0x194){return db[_0xbd89('0x7d')][_0xbd89('0x7e')]({'where':{'WhatsappAccountId':_0x194df1},'order':_0xbd89('0x7f')})[_0xbd89('0x1f')](function(_0xdadaea){_0x4d5354=_0xdadaea;});}})[_0xbd89('0x29')](function(_0x431620){_0x2f2cb7=0x1f4;logger[_0xbd89('0x24')](_0x431620[_0xbd89('0x39')]);if(_0x431620[_0xbd89('0x3a')]){delete _0x431620[_0xbd89('0x3a')];}_0x4d5354=_0x431620;})['finally'](function(){if(_0x4d5354===null){_0x4c0314[_0xbd89('0x80')](_0x2f2cb7);}else{if(_0x2f2cb7===0x1f4){_0x4c0314[_0xbd89('0x2b')](_0x2f2cb7)['send'](_0x4d5354);}else{_0x4c0314['status'](_0x2f2cb7)[_0xbd89('0x2c')](_0x4d5354);}}});};exports[_0xbd89('0x81')]=function(_0x248fe2,_0x229e17,_0x31ec19){var _0x15cf48={};var _0x59b190={};var _0x3a7c7a;var _0x104f2b;return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x248fe2[_0xbd89('0x58')]['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x229e17,null))[_0xbd89('0x1f')](function(_0x278d67){if(_0x278d67){_0x3a7c7a=_0x278d67;_0x59b190[_0xbd89('0x43')]=_['keys'](db[_0xbd89('0x7d')]['rawAttributes']);_0x59b190[_0xbd89('0x44')]=_[_0xbd89('0x5a')](_0x248fe2['query']);_0x59b190[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x59b190[_0xbd89('0x43')],_0x59b190[_0xbd89('0x44')]);_0x15cf48['attributes']=_[_0xbd89('0x46')](_0x59b190[_0xbd89('0x43')],qs['fields'](_0x248fe2[_0xbd89('0x44')][_0xbd89('0x47')]));_0x15cf48[_0xbd89('0x48')]=_0x15cf48[_0xbd89('0x48')][_0xbd89('0x49')]?_0x15cf48[_0xbd89('0x48')]:_0x59b190[_0xbd89('0x43')];_0x15cf48['order']=qs[_0xbd89('0x4d')](_0x248fe2['query'][_0xbd89('0x4d')]);_0x15cf48[_0xbd89('0x4e')]=qs[_0xbd89('0x45')](_[_0xbd89('0x4f')](_0x248fe2[_0xbd89('0x44')],_0x59b190[_0xbd89('0x45')]));if(_0x248fe2[_0xbd89('0x44')]['filter']){_0x15cf48[_0xbd89('0x4e')]=_[_0xbd89('0x51')](_0x15cf48[_0xbd89('0x4e')],{'$or':_[_0xbd89('0x3d')](_0x15cf48[_0xbd89('0x48')],function(_0x2f8235){var _0x1ec76d={};_0x1ec76d[_0x2f8235]={'$like':'%'+_0x248fe2[_0xbd89('0x44')][_0xbd89('0x50')]+'%'};return _0x1ec76d;})});}_0x15cf48=_[_0xbd89('0x51')]({},_0x15cf48,_0x248fe2[_0xbd89('0x53')]);return _0x3a7c7a[_0xbd89('0x81')](_0x15cf48);}})[_0xbd89('0x1f')](function(_0x26dfea){if(_0x26dfea){_0x104f2b=_0x26dfea['length'];if(!_0x248fe2['query'][_0xbd89('0x4a')](_0xbd89('0x4b'))){_0x15cf48['limit']=qs['limit'](_0x248fe2[_0xbd89('0x44')]['limit']);_0x15cf48[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x248fe2[_0xbd89('0x44')][_0xbd89('0x2d')]);}return _0x3a7c7a[_0xbd89('0x81')](_0x15cf48);}})[_0xbd89('0x1f')](function(_0x35477d){if(_0x35477d){return _0x35477d?{'count':_0x104f2b,'rows':_0x35477d}:null;}})['then'](respondWithResult(_0x229e17,null))[_0xbd89('0x29')](handleError(_0x229e17,null));};exports[_0xbd89('0x82')]=function(_0x581192,_0x91e596,_0x41dfc7){var _0x3183a9={'channel':_0xbd89('0x83')};var _0x508896=[];var _0x250244=[];var _0x5ca58f={};return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x581192['params']['id']},'include':[{'model':db[_0xbd89('0x7d')],'as':_0xbd89('0x84')}]})[_0xbd89('0x1f')](handleEntityNotFound(_0x91e596,null))[_0xbd89('0x1f')](function(_0x3f7d05){_0x3183a9[_0xbd89('0x85')]=_0x3f7d05;if(_0x3183a9[_0xbd89('0x85')]&&_0x3183a9[_0xbd89('0x85')][_0xbd89('0x41')]==='sinch'&&_0x581192[_0xbd89('0x5d')]['statuses']){if(_0x581192['body'][_0xbd89('0x86')][_0xbd89('0x49')]===0x0)return;if(_0x581192['body'][_0xbd89('0x86')][0x0][_0xbd89('0x87')]!==_0xbd89('0x88'))return;return db[_0xbd89('0x89')]['update']({'read':!![],'readAt':_0x581192[_0xbd89('0x5d')][_0xbd89('0x86')][0x0][_0xbd89('0x8a')]},{'where':{'messageId':_0x581192[_0xbd89('0x5d')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xbd89('0x1f')](function(_0x155f4c){return _0x91e596[_0xbd89('0x2b')](0xc8)['json'](_0x155f4c);});}_0x3183a9[_0xbd89('0x8b')]=_[_0xbd89('0x8c')](_0x3f7d05[_0xbd89('0x84')],[_0xbd89('0x7f')],[_0xbd89('0x8d')]);if(_0x3183a9[_0xbd89('0x85')][_0xbd89('0x84')]){delete _0x3183a9['account'][_0xbd89('0x84')];}return db['CmContact'][_0xbd89('0x62')]()[_0xbd89('0x1f')](function(_0x474250){if(!_0x474250){throw new db[(_0xbd89('0x8e'))]['ValidationError']('no\x20available\x20attributes');}_0x508896=_[_0xbd89('0x8f')](_[_0xbd89('0x5a')](_0x474250),[_0xbd89('0x90'),_0xbd89('0x91')]);_0x250244=_[_0xbd89('0x8f')](_[_0xbd89('0x5a')](_0x474250),[_0xbd89('0x90'),'updatedAt',_0xbd89('0x92'),_0xbd89('0x93')]);_0x3183a9[_0xbd89('0x5d')]={'mapKey':_0xbd89('0x94')};if(_0x3183a9[_0xbd89('0x85')]&&_0x3183a9[_0xbd89('0x85')][_0xbd89('0x41')]===_0xbd89('0x95')){_0x3183a9[_0xbd89('0x5d')]['from']=_0x581192[_0xbd89('0x5d')][_0xbd89('0x96')][_0xbd89('0x97')](_0xbd89('0x98'),'');_0x3183a9['body'][_0xbd89('0x5d')]=_0x581192[_0xbd89('0x5d')]['Body'];_0x3183a9[_0xbd89('0x5d')]['messageId']=_0x581192[_0xbd89('0x5d')][_0xbd89('0x99')];}if(_0x3183a9[_0xbd89('0x85')]&&_0x3183a9[_0xbd89('0x85')]['type']===_0xbd89('0x9a')){_0x3183a9['body'][_0xbd89('0x9b')]=_0x581192[_0xbd89('0x5d')][_0xbd89('0x9c')][0x0][_0xbd89('0x9b')];_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x5d')]=_0x581192[_0xbd89('0x5d')][_0xbd89('0x9c')][0x0]['message'][_0xbd89('0x5d')];_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x9d')]=_0x581192[_0xbd89('0x5d')]['notifications'][0x0]['message_id'];}if(_0x3183a9[_0xbd89('0x5d')]['id']){delete _0x3183a9[_0xbd89('0x5d')]['id'];}if(_[_0xbd89('0x9e')](_0x3183a9[_0xbd89('0x5d')]['from'])){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x5d')])||_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x5d')]===''){throw new db['Sequelize'][(_0xbd89('0x9f'))](_0xbd89('0xa0'));}if(_['isNil'](_0x3183a9[_0xbd89('0x5d')][_0xbd89('0xa1')])){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x250244);}if(!_['includes'](_0x250244,_0x3183a9[_0xbd89('0x5d')][_0xbd89('0xa1')])){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))](_0xbd89('0xa2')+_0x250244);}_0x5ca58f[_0x3183a9[_0xbd89('0x5d')]['mapKey']]=_0x3183a9['body'][_0xbd89('0x9b')];return db[_0xbd89('0xa3')][_0xbd89('0x5b')]({'where':{'id':_0x3183a9[_0xbd89('0x85')][_0xbd89('0x93')]},'include':[{'model':db['CmContact'],'as':_0xbd89('0xa4'),'where':_0x5ca58f,'limit':0x1,'order':[[_0xbd89('0x91'),_0xbd89('0xa5')]]}]});})[_0xbd89('0x1f')](handleEntityNotFound(_0x91e596,null))[_0xbd89('0x1f')](function(_0x56ba0c){if(_0x56ba0c){_0x3183a9[_0xbd89('0xa6')]=_[_0xbd89('0x70')](_0x56ba0c,[_0xbd89('0xa4')]);if(_0x56ba0c[_0xbd89('0xa4')]['length']){return _0x56ba0c[_0xbd89('0xa4')][0x0];}var _0xb8c72b=_['defaults'](_0x3183a9[_0xbd89('0x5d')],{'firstName':_0x3183a9[_0xbd89('0x5d')]['from'],'ListId':_0x56ba0c['id']});_0xb8c72b[_0x3183a9[_0xbd89('0x5d')][_0xbd89('0xa1')]]=_0x3183a9['body'][_0xbd89('0x9b')];return db['CmContact'][_0xbd89('0x5c')](_0xb8c72b,{'fields':_0x508896,'raw':!![]});}})[_0xbd89('0x1f')](handleEntityNotFound(_0x91e596,null))[_0xbd89('0x1f')](function(_0x401317){if(_0x401317){_0x3183a9[_0xbd89('0xa7')]=_0x401317;var _0x5f2692={'ContactId':_0x401317['id'],'phone':_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x9b')],'WhatsappAccountId':_0x581192[_0xbd89('0x58')]['id']};var _0x479848={'ContactId':_0x401317['id'],'WhatsappAccountId':_0x581192[_0xbd89('0x58')]['id'],'closed':![]};return db[_0xbd89('0xa8')][_0xbd89('0x5b')]({'where':_0x479848})[_0xbd89('0x1f')](function(_0x3dabd8){if(_0x3dabd8){return[_0x3dabd8,![]];}return db[_0xbd89('0xa8')][_0xbd89('0x5c')](_0x5f2692)['then'](function(_0x62d892){return[_0x62d892,!![]];});});}})[_0xbd89('0x71')](function(_0x15309c,_0x49ec11){_0x3183a9[_0xbd89('0xa9')]=_0x15309c['get']({'plain':!![]});_0x3183a9[_0xbd89('0xa9')][_0xbd89('0xaa')]=![];if(_0x49ec11){if(_0x3183a9['account'][_0xbd89('0xab')]){_0x3183a9['applications'][_0xbd89('0xac')]({'id':0x0,'priority':_0x3183a9['applications'][_0xbd89('0x49')]+0x1,'app':'close','appdata':_0xbd89('0xad'),'interval':_0xbd89('0xae')});}_0x3183a9[_0xbd89('0xa9')]['created']=!![];}return db[_0xbd89('0x89')][_0xbd89('0x5c')]({'phone':_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x9b')],'messageId':_0x3183a9[_0xbd89('0x5d')]['messageId'],'body':_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x5d')],'WhatsappAccountId':_0x581192[_0xbd89('0x58')]['id'],'WhatsappInteractionId':_0x15309c['id'],'direction':'in','ContactId':_0x15309c['ContactId'],'AttachmentId':_0x3183a9['body']['AttachmentId']});})[_0xbd89('0x1f')](function(_0x160742){_0x3183a9[_0xbd89('0x27')]=_0x160742;if(!_0x3183a9['interaction'][_0xbd89('0xaf')])return;return db[_0xbd89('0x77')][_0xbd89('0x5b')]({'attributes':['id',_0xbd89('0x3a')],'where':{'id':_0x3183a9[_0xbd89('0xa9')][_0xbd89('0xaf')]}});})[_0xbd89('0x1f')](function(_0x16af34){if(_0x16af34){_0x3183a9['applications'][_0xbd89('0xb0')]({'id':0x0,'priority':0x0,'app':_0xbd89('0xb1'),'appdata':_0x16af34[_0xbd89('0x3a')]+','+(_0x3183a9[_0xbd89('0x85')][_0xbd89('0xb2')]||0xa),'interval':_0xbd89('0xae')});}if(!_0x3183a9['interaction'][_0xbd89('0xb3')])return;return db[_0xbd89('0xb4')][_0xbd89('0x5b')]({'attributes':['id','name'],'where':{'id':_0x3183a9[_0xbd89('0xa9')][_0xbd89('0xb3')]}});})['then'](function(_0x14f11e){if(_0x14f11e){_0x3183a9[_0xbd89('0x8b')]['unshift']({'id':0x0,'priority':0x1,'app':_0xbd89('0xb5'),'appdata':_0x14f11e[_0xbd89('0x3a')]+','+(_0x3183a9[_0xbd89('0x85')][_0xbd89('0xb6')]||0x12c),'interval':_0xbd89('0xae')});}return respondWithRpcPromise(_0xbd89('0xb7'),_0xbd89('0xb8'),_0x3183a9);})[_0xbd89('0x1f')](function(_0xfb9c1d){if(_0xfb9c1d){var _0x590302=0xc8;var _0x2586a5=_0xbd89('0xb9');logger[_0xbd89('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2586a5,_0x590302,_0xbd89('0xba'));logger[_0xbd89('0x22')](_0xbd89('0xbb'),_0x2586a5,_0x590302,_0xbd89('0xba'),JSON[_0xbd89('0xbc')](_0xfb9c1d));if(_0x3183a9[_0xbd89('0x85')][_0xbd89('0x41')]===_0xbd89('0x95')){return _0x91e596[_0xbd89('0x2b')](_0x590302)[_0xbd89('0xbd')]('Content-Type','text/xml')[_0xbd89('0xbe')](_0xbd89('0xbf'));}else{return _0x91e596[_0xbd89('0x2b')](_0x590302)[_0xbd89('0x2c')](_0xfb9c1d);}}});})[_0xbd89('0x29')](handleError(_0x91e596,null));};exports[_0xbd89('0xbe')]=function(_0x3e95b3,_0x474d1c,_0x3844a4){var _0x59484f,_0x11b417,_0x6cc93b;if(_[_0xbd89('0x9e')](_0x3e95b3['body'][_0xbd89('0x5d')])||_0x3e95b3[_0xbd89('0x5d')][_0xbd89('0x5d')]===''){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))](_0xbd89('0xa0'));}if(_['isNil'](_0x3e95b3[_0xbd89('0x5d')]['to'])){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))](_0xbd89('0xc0'));}_0x59484f=_0x3e95b3['body']['to'];return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x3e95b3[_0xbd89('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xbd89('0xc1'),'include':[{'model':db['CmContact'],'as':_0xbd89('0xa4'),'where':{'mobile':_0x59484f},'limit':0x1,'order':[[_0xbd89('0x91'),_0xbd89('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x474d1c,null))['then'](function(_0x409dcc){if(_0x409dcc&&_0x409dcc[_0xbd89('0xc1')]){_0x11b417=_0x409dcc[_0xbd89('0x36')]({'plain':!![]});if(_0x11b417[_0xbd89('0xc1')]&&_0x11b417[_0xbd89('0xc1')][_0xbd89('0xa4')][_0xbd89('0x49')]){return _0x11b417[_0xbd89('0xc1')]['Contacts'][0x0];}return db[_0xbd89('0xc2')][_0xbd89('0x5c')](_['defaults'](_0x3e95b3['body'],{'firstName':_0x59484f,'mobile':_0x59484f,'phone':_0x59484f,'ListId':_0x11b417['ListId']}));}})['then'](handleEntityNotFound(_0x474d1c,null))[_0xbd89('0x1f')](function(_0x4221b1){if(_0x4221b1){_0x6cc93b=_0x4221b1;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x6cc93b['id'],'closed':![],'WhatsappAccountId':_0x11b417['id']}})['then'](function(_0x3d765d){if(_0x3d765d){return[_0x3d765d,![]];}return db[_0xbd89('0xa8')][_0xbd89('0x5c')]({'UserId':_0x3e95b3[_0xbd89('0x5f')]['id'],'ContactId':_0x6cc93b['id'],'WhatsappAccountId':_0x11b417['id'],'phone':_0x59484f,'firstMsgDirection':_0xbd89('0xc3'),'Messages':[_[_0xbd89('0x51')](_0x3e95b3[_0xbd89('0x5d')],{'read':![],'body':_0x3e95b3[_0xbd89('0x5d')]['body'],'phone':_0x59484f,'WhatsappAccountId':_0x11b417['id'],'UserId':_0x3e95b3['user']['id'],'ContactId':_0x6cc93b['id']})]},{'include':[{'model':db[_0xbd89('0x89')],'as':'Messages'}]})['then'](function(_0x3a886c){return[_0x3a886c,!![]];});});}})[_0xbd89('0x71')](function(_0x196923,_0x3cf8af){if(_0x3cf8af){return _0x196923;}return db[_0xbd89('0x89')][_0xbd89('0x5c')](_[_0xbd89('0x51')](_0x3e95b3[_0xbd89('0x5d')],{'read':![],'body':_0x3e95b3[_0xbd89('0x5d')][_0xbd89('0x5d')],'phone':_0x59484f,'WhatsappAccountId':_0x11b417['id'],'WhatsappInteractionId':_0x196923['id'],'UserId':_0x3e95b3[_0xbd89('0x5f')]['id'],'ContactId':_0x6cc93b['id']}))['then'](function(_0x245458){_0x196923['dataValues'][_0xbd89('0xc4')]=[];_0x196923[_0xbd89('0xc5')]['Messages'][_0xbd89('0xac')](_0x245458[_0xbd89('0xc5')]);return _0x196923;});})[_0xbd89('0x1f')](respondWithResult(_0x474d1c,null))[_0xbd89('0x29')](handleError(_0x474d1c,null));}; \ No newline at end of file +var _0xc465=['updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','message_id','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','DESC','list','Contacts','defaults','contact','WhatsappInteraction','spread','interaction','created','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','queueId','queue','waitForTheAssignedQueue','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','offset','count','limit','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','WhatsappAccount','includeAll','include','findAll','rows','show','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','hasOwnProperty','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','priority','finally','getApplications','notify','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference'];(function(_0x2d862c,_0x321ec9){var _0x15d4e9=function(_0x380c0f){while(--_0x380c0f){_0x2d862c['push'](_0x2d862c['shift']());}};_0x15d4e9(++_0x321ec9);}(_0xc465,0x100));var _0x5c46=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xc465[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x5c46('0x0'));var rimraf=require(_0x5c46('0x1'));var zipdir=require(_0x5c46('0x2'));var jsonpatch=require(_0x5c46('0x3'));var rp=require(_0x5c46('0x4'));var moment=require(_0x5c46('0x5'));var BPromise=require(_0x5c46('0x6'));var Mustache=require(_0x5c46('0x7'));var util=require(_0x5c46('0x8'));var path=require('path');var sox=require(_0x5c46('0x9'));var csv=require(_0x5c46('0xa'));var ejs=require(_0x5c46('0xb'));var fs=require('fs');var fs_extra=require(_0x5c46('0xc'));var _=require(_0x5c46('0xd'));var squel=require(_0x5c46('0xe'));var crypto=require(_0x5c46('0xf'));var jsforce=require(_0x5c46('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5c46('0xa'));var querystring=require(_0x5c46('0x11'));var Papa=require(_0x5c46('0x12'));var Redis=require(_0x5c46('0x13'));var authService=require(_0x5c46('0x14'));var qs=require(_0x5c46('0x15'));var as=require(_0x5c46('0x16'));var hardwareService=require(_0x5c46('0x17'));var logger=require(_0x5c46('0x18'))(_0x5c46('0x19'));var utils=require(_0x5c46('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x5c46('0x1b'));var db=require(_0x5c46('0x1c'))['db'];config[_0x5c46('0x1d')]=_['defaults'](config[_0x5c46('0x1d')],{'host':_0x5c46('0x1e'),'port':0x18eb});var socket=require(_0x5c46('0x1f'))(new Redis(config[_0x5c46('0x1d')]));require(_0x5c46('0x20'))['register'](socket);var jayson=require(_0x5c46('0x21'));var client=jayson[_0x5c46('0x22')][_0x5c46('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x24de43,_0x1866f8,_0x46ea73,_0x1b9790){return new BPromise(function(_0x4c612b,_0x56a5bf){var _0x27239b=_0x1b9790||client;return _0x27239b[_0x5c46('0x24')](_0x24de43,_0x46ea73)[_0x5c46('0x25')](function(_0x5742a6){logger[_0x5c46('0x26')](_0x5c46('0x27'),_0x1866f8,_0x5c46('0x28'));logger['debug'](_0x5c46('0x29'),_0x1866f8,_0x5c46('0x28'),JSON[_0x5c46('0x2a')](_0x5742a6));if(_0x5742a6['error']){if(_0x5742a6[_0x5c46('0x2b')]['code']===0x1f4){logger[_0x5c46('0x2b')](_0x5c46('0x27'),_0x1866f8,_0x5742a6[_0x5c46('0x2b')][_0x5c46('0x2c')]);return _0x56a5bf(_0x5742a6[_0x5c46('0x2b')][_0x5c46('0x2c')]);}logger[_0x5c46('0x2b')](_0x5c46('0x27'),_0x1866f8,_0x5742a6['error'][_0x5c46('0x2c')]);return _0x4c612b(_0x5742a6[_0x5c46('0x2b')][_0x5c46('0x2c')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1866f8,_0x5c46('0x28'));_0x4c612b(_0x5742a6[_0x5c46('0x2d')][_0x5c46('0x2c')]);}})[_0x5c46('0x2e')](function(_0x2a3641){logger[_0x5c46('0x2b')]('WhatsappAccount,\x20%s,\x20%s',_0x1866f8,_0x2a3641);_0x56a5bf(_0x2a3641);});});}function respondWithStatusCode(_0x479c7e,_0x5edec9){_0x5edec9=_0x5edec9||0xcc;return function(_0x1e92e5){if(_0x1e92e5){return _0x479c7e[_0x5c46('0x2f')](_0x5edec9);}return _0x479c7e[_0x5c46('0x30')](_0x5edec9)[_0x5c46('0x31')]();};}function respondWithResult(_0x45f79f,_0x105dad){_0x105dad=_0x105dad||0xc8;return function(_0x329c9d){if(_0x329c9d){return _0x45f79f[_0x5c46('0x30')](_0x105dad)[_0x5c46('0x32')](_0x329c9d);}};}function respondWithFilteredResult(_0x11260d,_0x20d79f){return function(_0x34b1fd){if(_0x34b1fd){var _0x207132=typeof _0x20d79f['offset']===_0x5c46('0x33')&&typeof _0x20d79f['limit']==='undefined';var _0xdea9f8=_0x34b1fd['count'];var _0x4fe740=_0x207132?0x0:_0x20d79f[_0x5c46('0x34')];var _0x52e96e=_0x207132?_0x34b1fd[_0x5c46('0x35')]:_0x20d79f[_0x5c46('0x34')]+_0x20d79f[_0x5c46('0x36')];var _0x28aa7a;if(_0x52e96e>=_0xdea9f8){_0x52e96e=_0xdea9f8;_0x28aa7a=0xc8;}else{_0x28aa7a=0xce;}_0x11260d[_0x5c46('0x30')](_0x28aa7a);return _0x11260d['set']('Content-Range',_0x4fe740+'-'+_0x52e96e+'/'+_0xdea9f8)[_0x5c46('0x32')](_0x34b1fd);}return null;};}function patchUpdates(_0x3ac265){return function(_0x139ba2){try{jsonpatch[_0x5c46('0x37')](_0x139ba2,_0x3ac265,!![]);}catch(_0x3a98ab){return BPromise[_0x5c46('0x38')](_0x3a98ab);}return _0x139ba2[_0x5c46('0x39')]();};}function saveUpdates(_0x2a7773,_0x4089bf){return function(_0xda9295){if(_0xda9295){return _0xda9295[_0x5c46('0x3a')](_0x2a7773)[_0x5c46('0x25')](function(_0x4d7dd8){return _0x4d7dd8;});}return null;};}function removeEntity(_0x2bc1f7,_0x1915f2){return function(_0x3fb7bf){if(_0x3fb7bf){return _0x3fb7bf[_0x5c46('0x3b')]()[_0x5c46('0x25')](function(){var _0x244832=_0x3fb7bf[_0x5c46('0x3c')]({'plain':!![]});var _0x44f6b2='WhatsappAccounts';return db[_0x5c46('0x3d')][_0x5c46('0x3b')]({'where':{'type':_0x44f6b2,'resourceId':_0x244832['id']}})[_0x5c46('0x25')](function(){return _0x3fb7bf;});})['then'](function(){_0x2bc1f7[_0x5c46('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa97be2,_0x59b87f){return function(_0x38aeb1){if(!_0x38aeb1){_0xa97be2['sendStatus'](0x194);}return _0x38aeb1;};}function handleError(_0x2baa2a,_0x27134e){_0x27134e=_0x27134e||0x1f4;return function(_0xe4ff3f){logger['error'](_0xe4ff3f[_0x5c46('0x3e')]);if(_0xe4ff3f[_0x5c46('0x3f')]){delete _0xe4ff3f[_0x5c46('0x3f')];}_0x2baa2a[_0x5c46('0x30')](_0x27134e)[_0x5c46('0x40')](_0xe4ff3f);};}exports[_0x5c46('0x41')]=function(_0x4cd6dd,_0xb2659e){var _0x7fd7f6={'include':[{'model':db[_0x5c46('0x42')],'as':_0x5c46('0x43')}]},_0x49671c={},_0x2ffc13={'count':0x0,'rows':[]};var _0x5f1391=_[_0x5c46('0x44')](db['WhatsappAccount'][_0x5c46('0x45')],function(_0x252d85){return{'name':_0x252d85[_0x5c46('0x46')],'type':_0x252d85['type'][_0x5c46('0x47')]};});_0x49671c[_0x5c46('0x48')]=_['map'](_0x5f1391,'name');_0x49671c[_0x5c46('0x49')]=_[_0x5c46('0x4a')](_0x4cd6dd[_0x5c46('0x49')]);_0x49671c[_0x5c46('0x4b')]=_[_0x5c46('0x4c')](_0x49671c['model'],_0x49671c['query']);_0x7fd7f6[_0x5c46('0x4d')]=_['intersection'](_0x49671c['model'],qs[_0x5c46('0x4e')](_0x4cd6dd[_0x5c46('0x49')][_0x5c46('0x4e')]));_0x7fd7f6['attributes']=_0x7fd7f6[_0x5c46('0x4d')][_0x5c46('0x4f')]?_0x7fd7f6[_0x5c46('0x4d')]:_0x49671c[_0x5c46('0x48')];if(!_0x4cd6dd[_0x5c46('0x49')]['hasOwnProperty'](_0x5c46('0x50'))){_0x7fd7f6[_0x5c46('0x36')]=qs[_0x5c46('0x36')](_0x4cd6dd[_0x5c46('0x49')][_0x5c46('0x36')]);_0x7fd7f6[_0x5c46('0x34')]=qs[_0x5c46('0x34')](_0x4cd6dd[_0x5c46('0x49')]['offset']);}_0x7fd7f6['order']=qs[_0x5c46('0x51')](_0x4cd6dd[_0x5c46('0x49')][_0x5c46('0x51')]);_0x7fd7f6[_0x5c46('0x52')]=qs[_0x5c46('0x4b')](_[_0x5c46('0x53')](_0x4cd6dd[_0x5c46('0x49')],_0x49671c[_0x5c46('0x4b')]),_0x5f1391);if(_0x4cd6dd[_0x5c46('0x49')]['filter']){_0x7fd7f6[_0x5c46('0x52')]=_[_0x5c46('0x54')](_0x7fd7f6[_0x5c46('0x52')],{'$or':_['map'](_0x5f1391,function(_0x45092b){if(_0x45092b[_0x5c46('0x55')]!==_0x5c46('0x56')){var _0x14ee5f={};_0x14ee5f[_0x45092b['name']]={'$like':'%'+_0x4cd6dd[_0x5c46('0x49')][_0x5c46('0x57')]+'%'};return _0x14ee5f;}})});}_0x7fd7f6=_[_0x5c46('0x54')]({},_0x7fd7f6,_0x4cd6dd[_0x5c46('0x58')]);var _0x4ee7eb={'where':_0x7fd7f6[_0x5c46('0x52')]};return db[_0x5c46('0x59')][_0x5c46('0x35')](_0x4ee7eb)[_0x5c46('0x25')](function(_0x2d5160){_0x2ffc13[_0x5c46('0x35')]=_0x2d5160;if(_0x4cd6dd[_0x5c46('0x49')][_0x5c46('0x5a')]){_0x7fd7f6[_0x5c46('0x5b')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x5c46('0x5c')](_0x7fd7f6);})[_0x5c46('0x25')](function(_0x5e5515){_0x2ffc13[_0x5c46('0x5d')]=_0x5e5515;return _0x2ffc13;})[_0x5c46('0x25')](respondWithFilteredResult(_0xb2659e,_0x7fd7f6))[_0x5c46('0x2e')](handleError(_0xb2659e,null));};exports[_0x5c46('0x5e')]=function(_0x17942d,_0x4186f9){var _0x461e03={'raw':![],'where':{'id':_0x17942d['params']['id']},'include':[{'model':db[_0x5c46('0x42')],'as':_0x5c46('0x43')}]},_0x55539d={};_0x55539d['model']=_[_0x5c46('0x4a')](db['WhatsappAccount'][_0x5c46('0x45')]);_0x55539d[_0x5c46('0x49')]=_[_0x5c46('0x4a')](_0x17942d[_0x5c46('0x49')]);_0x55539d[_0x5c46('0x4b')]=_[_0x5c46('0x4c')](_0x55539d['model'],_0x55539d[_0x5c46('0x49')]);_0x461e03[_0x5c46('0x4d')]=_['intersection'](_0x55539d['model'],qs[_0x5c46('0x4e')](_0x17942d[_0x5c46('0x49')][_0x5c46('0x4e')]));_0x461e03[_0x5c46('0x4d')]=_0x461e03[_0x5c46('0x4d')][_0x5c46('0x4f')]?_0x461e03[_0x5c46('0x4d')]:_0x55539d[_0x5c46('0x48')];if(_0x17942d[_0x5c46('0x49')][_0x5c46('0x5a')]){_0x461e03[_0x5c46('0x5b')]=[{'all':!![]}];}_0x461e03=_[_0x5c46('0x54')]({},_0x461e03,_0x17942d[_0x5c46('0x58')]);return db[_0x5c46('0x59')][_0x5c46('0x5f')](_0x461e03)[_0x5c46('0x25')](handleEntityNotFound(_0x4186f9,null))[_0x5c46('0x25')](respondWithResult(_0x4186f9,null))[_0x5c46('0x2e')](handleError(_0x4186f9,null));};exports['create']=function(_0x15a1c1,_0x1da6dc){return db[_0x5c46('0x59')][_0x5c46('0x60')](_0x15a1c1[_0x5c46('0x61')],{})['then'](function(_0x281c71){var _0x25b64f=_0x15a1c1[_0x5c46('0x62')][_0x5c46('0x3c')]({'plain':!![]});if(!_0x25b64f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25b64f[_0x5c46('0x63')]==='user'){var _0x108b97=_0x281c71['get']({'plain':!![]});var _0x2b979c='WhatsappAccounts';return db[_0x5c46('0x64')][_0x5c46('0x5f')]({'where':{'name':_0x2b979c,'userProfileId':_0x25b64f[_0x5c46('0x65')]},'raw':!![]})[_0x5c46('0x25')](function(_0x11ee92){if(_0x11ee92&&_0x11ee92[_0x5c46('0x66')]===0x0){return db['UserProfileResource']['create']({'name':_0x108b97['name'],'resourceId':_0x108b97['id'],'type':_0x11ee92[_0x5c46('0x3f')],'sectionId':_0x11ee92['id']},{})[_0x5c46('0x25')](function(){return _0x281c71;});}else{return _0x281c71;}})[_0x5c46('0x2e')](function(_0x39e8a1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39e8a1);throw _0x39e8a1;});}return _0x281c71;})[_0x5c46('0x25')](respondWithResult(_0x1da6dc,0xc9))[_0x5c46('0x2e')](handleError(_0x1da6dc,null));};exports[_0x5c46('0x3a')]=function(_0x2d8289,_0x45ab39){if(_0x2d8289[_0x5c46('0x61')]['id']){delete _0x2d8289[_0x5c46('0x61')]['id'];}return db['WhatsappAccount'][_0x5c46('0x5f')]({'where':{'id':_0x2d8289[_0x5c46('0x67')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x5c46('0x25')](handleEntityNotFound(_0x45ab39,null))[_0x5c46('0x25')](saveUpdates(_0x2d8289[_0x5c46('0x61')],null))[_0x5c46('0x25')](respondWithResult(_0x45ab39,null))[_0x5c46('0x2e')](handleError(_0x45ab39,null));};exports[_0x5c46('0x3b')]=function(_0x1cadde,_0x281333){return db[_0x5c46('0x59')]['find']({'where':{'id':_0x1cadde['params']['id']}})[_0x5c46('0x25')](handleEntityNotFound(_0x281333,null))['then'](removeEntity(_0x281333,null))[_0x5c46('0x2e')](handleError(_0x281333,null));};exports['describe']=function(_0x430e57,_0x4ab9ff){return db[_0x5c46('0x59')][_0x5c46('0x68')]()[_0x5c46('0x25')](respondWithResult(_0x4ab9ff,null))[_0x5c46('0x2e')](handleError(_0x4ab9ff,null));};exports[_0x5c46('0x69')]=function(_0x1b2f84,_0x2d1936,_0x192cde){if(_0x1b2f84['body']['id']){delete _0x1b2f84[_0x5c46('0x61')]['id'];}return db[_0x5c46('0x59')][_0x5c46('0x5f')]({'where':{'id':_0x1b2f84[_0x5c46('0x67')]['id']}})[_0x5c46('0x25')](handleEntityNotFound(_0x2d1936,null))[_0x5c46('0x25')](function(_0x28e8a4){if(_0x28e8a4){_0x1b2f84[_0x5c46('0x61')][_0x5c46('0x6a')]=_0x28e8a4['id'];return db[_0x5c46('0x6b')][_0x5c46('0x60')](_0x1b2f84['body']);}})[_0x5c46('0x25')](respondWithResult(_0x2d1936,null))[_0x5c46('0x2e')](handleError(_0x2d1936,null));};exports[_0x5c46('0x6c')]=function(_0x4d9bc5,_0x54e734,_0x21333e){var _0x1b0001={'raw':![],'where':{}};var _0x4ead9c={};var _0x1d0cd5={'count':0x0,'rows':[]};return db[_0x5c46('0x59')][_0x5c46('0x6d')]({'where':{'id':_0x4d9bc5[_0x5c46('0x67')]['id']}})['then'](handleEntityNotFound(_0x54e734,null))[_0x5c46('0x25')](function(_0x46a2b4){if(_0x46a2b4){_0x4ead9c[_0x5c46('0x48')]=_[_0x5c46('0x4a')](db[_0x5c46('0x6b')][_0x5c46('0x45')]);_0x4ead9c['query']=_[_0x5c46('0x4a')](_0x4d9bc5[_0x5c46('0x49')]);_0x4ead9c[_0x5c46('0x4b')]=_['intersection'](_0x4ead9c[_0x5c46('0x48')],_0x4ead9c[_0x5c46('0x49')]);_0x1b0001['attributes']=_[_0x5c46('0x4c')](_0x4ead9c[_0x5c46('0x48')],qs[_0x5c46('0x4e')](_0x4d9bc5['query']['fields']));_0x1b0001[_0x5c46('0x4d')]=_0x1b0001[_0x5c46('0x4d')]['length']?_0x1b0001[_0x5c46('0x4d')]:_0x4ead9c[_0x5c46('0x48')];if(!_0x4d9bc5[_0x5c46('0x49')]['hasOwnProperty']('nolimit')){_0x1b0001[_0x5c46('0x36')]=qs['limit'](_0x4d9bc5[_0x5c46('0x49')][_0x5c46('0x36')]);_0x1b0001['offset']=qs['offset'](_0x4d9bc5[_0x5c46('0x49')][_0x5c46('0x34')]);}_0x1b0001[_0x5c46('0x6e')]=qs['sort'](_0x4d9bc5[_0x5c46('0x49')][_0x5c46('0x51')]);_0x1b0001[_0x5c46('0x52')]=qs[_0x5c46('0x4b')](_['pick'](_0x4d9bc5['query'],_0x4ead9c[_0x5c46('0x4b')]));_0x1b0001[_0x5c46('0x52')][_0x5c46('0x6a')]=_0x46a2b4['id'];if(_0x4d9bc5[_0x5c46('0x49')][_0x5c46('0x57')]){_0x1b0001[_0x5c46('0x52')]=_['merge'](_0x1b0001[_0x5c46('0x52')],{'$or':_[_0x5c46('0x44')](_0x1b0001[_0x5c46('0x4d')],function(_0xa135fc){var _0x228560={};_0x228560[_0xa135fc]={'$like':'%'+_0x4d9bc5['query'][_0x5c46('0x57')]+'%'};return _0x228560;})});}_0x1b0001=_['merge']({},_0x1b0001,_0x4d9bc5['options']);return db[_0x5c46('0x6b')][_0x5c46('0x35')]({'where':_0x1b0001[_0x5c46('0x52')]})[_0x5c46('0x25')](function(_0x292090){_0x1d0cd5[_0x5c46('0x35')]=_0x292090;if(_0x4d9bc5[_0x5c46('0x49')][_0x5c46('0x5a')]){_0x1b0001[_0x5c46('0x5b')]=[{'all':!![]}];}return db[_0x5c46('0x6b')][_0x5c46('0x5c')](_0x1b0001);})[_0x5c46('0x25')](function(_0x403e5e){_0x1d0cd5[_0x5c46('0x5d')]=_0x403e5e;return _0x1d0cd5;});}})['then'](respondWithFilteredResult(_0x54e734,_0x1b0001))[_0x5c46('0x2e')](handleError(_0x54e734,null));};exports[_0x5c46('0x6f')]=function(_0x26d5cb,_0x1ab7c8,_0x283801){return db[_0x5c46('0x59')][_0x5c46('0x5f')]({'where':{'id':_0x26d5cb[_0x5c46('0x67')]['id']}})['then'](handleEntityNotFound(_0x1ab7c8,null))[_0x5c46('0x25')](function(_0x50c54a){if(_0x50c54a){return _0x50c54a[_0x5c46('0x6f')](_0x26d5cb[_0x5c46('0x49')][_0x5c46('0x70')]);}})[_0x5c46('0x25')](respondWithStatusCode(_0x1ab7c8,null))[_0x5c46('0x2e')](handleError(_0x1ab7c8,null));};exports[_0x5c46('0x71')]=function(_0x1e2f59,_0x173e96,_0xa35db2){if(_0x1e2f59[_0x5c46('0x61')]['id']){delete _0x1e2f59['body']['id'];}return db[_0x5c46('0x59')]['find']({'where':{'id':_0x1e2f59['params']['id']}})[_0x5c46('0x25')](handleEntityNotFound(_0x173e96,null))['then'](function(_0x47c73b){if(_0x47c73b){_0x1e2f59[_0x5c46('0x61')]['WhatsappAccountId']=_0x47c73b['id'];return db['CannedAnswer'][_0x5c46('0x60')](_0x1e2f59[_0x5c46('0x61')]);}})[_0x5c46('0x25')](respondWithResult(_0x173e96,null))[_0x5c46('0x2e')](handleError(_0x173e96,null));};exports[_0x5c46('0x72')]=function(_0x27f034,_0x42a470,_0x1f7c6d){var _0x563cf7={'raw':![],'where':{}};var _0x5075a4={};var _0x5610cd={'count':0x0,'rows':[]};return db[_0x5c46('0x59')]['findOne']({'where':{'id':_0x27f034[_0x5c46('0x67')]['id']}})[_0x5c46('0x25')](handleEntityNotFound(_0x42a470,null))[_0x5c46('0x25')](function(_0x4f4c44){if(_0x4f4c44){_0x5075a4['model']=_[_0x5c46('0x4a')](db[_0x5c46('0x73')][_0x5c46('0x45')]);_0x5075a4[_0x5c46('0x49')]=_[_0x5c46('0x4a')](_0x27f034['query']);_0x5075a4[_0x5c46('0x4b')]=_[_0x5c46('0x4c')](_0x5075a4['model'],_0x5075a4['query']);_0x563cf7[_0x5c46('0x4d')]=_[_0x5c46('0x4c')](_0x5075a4[_0x5c46('0x48')],qs[_0x5c46('0x4e')](_0x27f034[_0x5c46('0x49')][_0x5c46('0x4e')]));_0x563cf7[_0x5c46('0x4d')]=_0x563cf7[_0x5c46('0x4d')][_0x5c46('0x4f')]?_0x563cf7[_0x5c46('0x4d')]:_0x5075a4['model'];if(!_0x27f034[_0x5c46('0x49')]['hasOwnProperty'](_0x5c46('0x50'))){_0x563cf7[_0x5c46('0x36')]=qs[_0x5c46('0x36')](_0x27f034[_0x5c46('0x49')][_0x5c46('0x36')]);_0x563cf7[_0x5c46('0x34')]=qs[_0x5c46('0x34')](_0x27f034[_0x5c46('0x49')][_0x5c46('0x34')]);}_0x563cf7[_0x5c46('0x6e')]=qs[_0x5c46('0x51')](_0x27f034[_0x5c46('0x49')][_0x5c46('0x51')]);_0x563cf7[_0x5c46('0x52')]=qs[_0x5c46('0x4b')](_[_0x5c46('0x53')](_0x27f034['query'],_0x5075a4['filters']));_0x563cf7['where'][_0x5c46('0x6a')]=_0x4f4c44['id'];if(_0x27f034[_0x5c46('0x49')]['filter']){_0x563cf7['where']=_[_0x5c46('0x54')](_0x563cf7[_0x5c46('0x52')],{'$or':_[_0x5c46('0x44')](_0x563cf7['attributes'],function(_0x2add5a){var _0x4a3909={};_0x4a3909[_0x2add5a]={'$like':'%'+_0x27f034[_0x5c46('0x49')][_0x5c46('0x57')]+'%'};return _0x4a3909;})});}_0x563cf7=_['merge']({},_0x563cf7,_0x27f034['options']);return db[_0x5c46('0x73')][_0x5c46('0x35')]({'where':_0x563cf7[_0x5c46('0x52')]})['then'](function(_0x16f4a4){_0x5610cd[_0x5c46('0x35')]=_0x16f4a4;if(_0x27f034[_0x5c46('0x49')][_0x5c46('0x5a')]){_0x563cf7['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5c46('0x5c')](_0x563cf7);})[_0x5c46('0x25')](function(_0x17eb6c){_0x5610cd[_0x5c46('0x5d')]=_0x17eb6c;return _0x5610cd;});}})[_0x5c46('0x25')](respondWithFilteredResult(_0x42a470,_0x563cf7))[_0x5c46('0x2e')](handleError(_0x42a470,null));};exports[_0x5c46('0x74')]=function(_0x45e22c,_0xea1eb,_0x1aa6bc){return db[_0x5c46('0x59')]['find']({'where':{'id':_0x45e22c[_0x5c46('0x67')]['id']}})['then'](handleEntityNotFound(_0xea1eb,null))[_0x5c46('0x25')](function(_0x10b82d){if(_0x10b82d){return _0x10b82d[_0x5c46('0x74')](_0x45e22c[_0x5c46('0x49')][_0x5c46('0x70')]);}})[_0x5c46('0x25')](respondWithStatusCode(_0xea1eb,null))[_0x5c46('0x2e')](handleError(_0xea1eb,null));};exports[_0x5c46('0x75')]=function(_0x154827,_0x6b5919,_0x46b00d){return db[_0x5c46('0x59')]['find']({'where':{'id':_0x154827[_0x5c46('0x67')]['id']}})[_0x5c46('0x25')](handleEntityNotFound(_0x6b5919,null))[_0x5c46('0x25')](function(_0x14b88a){if(_0x14b88a){return _0x14b88a[_0x5c46('0x75')](_0x154827[_0x5c46('0x61')][_0x5c46('0x70')],_[_0x5c46('0x76')](_0x154827[_0x5c46('0x61')],['ids','id'])||{})['spread'](function(_0x3cc752){for(var _0x530a46=0x0;_0x530a46<_0x154827[_0x5c46('0x61')][_0x5c46('0x70')][_0x5c46('0x4f')];_0x530a46+=0x1){socket[_0x5c46('0x77')](_0x5c46('0x78'),{'UserId':Number(_0x154827[_0x5c46('0x61')][_0x5c46('0x70')][_0x530a46]),'WhatsappAccountId':Number(_0x154827[_0x5c46('0x67')]['id'])});}return _0x3cc752;});}})['then'](respondWithResult(_0x6b5919,null))[_0x5c46('0x2e')](handleError(_0x6b5919,null));};exports[_0x5c46('0x79')]=function(_0x3877a6,_0x3efca8,_0x4b9a63){return db[_0x5c46('0x59')][_0x5c46('0x5f')]({'where':{'id':_0x3877a6[_0x5c46('0x67')]['id']}})[_0x5c46('0x25')](handleEntityNotFound(_0x3efca8,null))[_0x5c46('0x25')](function(_0x26500d){if(_0x26500d){return _0x26500d[_0x5c46('0x79')](_0x3877a6[_0x5c46('0x49')][_0x5c46('0x70')])[_0x5c46('0x25')](function(){if(_[_0x5c46('0x7a')](_0x3877a6[_0x5c46('0x49')][_0x5c46('0x70')])){for(var _0x5b817d=0x0;_0x5b817d<_0x3877a6[_0x5c46('0x49')]['ids'][_0x5c46('0x4f')];_0x5b817d+=0x1){socket[_0x5c46('0x77')](_0x5c46('0x7b'),{'UserId':Number(_0x3877a6[_0x5c46('0x49')][_0x5c46('0x70')][_0x5b817d]),'WhatsappAccountId':Number(_0x3877a6[_0x5c46('0x67')]['id'])});}}else{socket[_0x5c46('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0x3877a6[_0x5c46('0x49')][_0x5c46('0x70')]),'WhatsappAccountId':Number(_0x3877a6[_0x5c46('0x67')]['id'])});}});}})[_0x5c46('0x25')](respondWithStatusCode(_0x3efca8,null))['catch'](handleError(_0x3efca8,null));};exports[_0x5c46('0x7c')]=function(_0x13ba65,_0x153305,_0x11700b){var _0x3d602e={};var _0x2b6e46={};var _0x3d60d6;var _0x490984;return db[_0x5c46('0x59')][_0x5c46('0x6d')]({'where':{'id':_0x13ba65['params']['id']}})[_0x5c46('0x25')](handleEntityNotFound(_0x153305,null))[_0x5c46('0x25')](function(_0x18bdb2){if(_0x18bdb2){_0x3d60d6=_0x18bdb2;_0x2b6e46[_0x5c46('0x48')]=_[_0x5c46('0x4a')](db[_0x5c46('0x7d')][_0x5c46('0x45')]);_0x2b6e46[_0x5c46('0x49')]=_[_0x5c46('0x4a')](_0x13ba65[_0x5c46('0x49')]);_0x2b6e46[_0x5c46('0x4b')]=_[_0x5c46('0x4c')](_0x2b6e46['model'],_0x2b6e46[_0x5c46('0x49')]);_0x3d602e[_0x5c46('0x4d')]=_['intersection'](_0x2b6e46[_0x5c46('0x48')],qs[_0x5c46('0x4e')](_0x13ba65[_0x5c46('0x49')][_0x5c46('0x4e')]));_0x3d602e[_0x5c46('0x4d')]=_0x3d602e['attributes'][_0x5c46('0x4f')]?_0x3d602e[_0x5c46('0x4d')]:_0x2b6e46[_0x5c46('0x48')];_0x3d602e[_0x5c46('0x6e')]=qs['sort'](_0x13ba65[_0x5c46('0x49')][_0x5c46('0x51')]);_0x3d602e[_0x5c46('0x52')]=qs['filters'](_[_0x5c46('0x53')](_0x13ba65['query'],_0x2b6e46[_0x5c46('0x4b')]));if(_0x13ba65[_0x5c46('0x49')][_0x5c46('0x57')]){_0x3d602e['where']=_[_0x5c46('0x54')](_0x3d602e['where'],{'$or':_['map'](_0x3d602e[_0x5c46('0x4d')],function(_0x4034e9){var _0x2e4504={};_0x2e4504[_0x4034e9]={'$like':'%'+_0x13ba65['query']['filter']+'%'};return _0x2e4504;})});}_0x3d602e=_['merge']({},_0x3d602e,_0x13ba65[_0x5c46('0x58')]);return _0x3d60d6[_0x5c46('0x7c')](_0x3d602e);}})[_0x5c46('0x25')](function(_0x468fe7){if(_0x468fe7){_0x490984=_0x468fe7[_0x5c46('0x4f')];if(!_0x13ba65['query'][_0x5c46('0x7e')]('nolimit')){_0x3d602e[_0x5c46('0x36')]=qs[_0x5c46('0x36')](_0x13ba65[_0x5c46('0x49')][_0x5c46('0x36')]);_0x3d602e[_0x5c46('0x34')]=qs['offset'](_0x13ba65[_0x5c46('0x49')][_0x5c46('0x34')]);}return _0x3d60d6[_0x5c46('0x7c')](_0x3d602e);}})['then'](function(_0x376a6e){if(_0x376a6e){return _0x376a6e?{'count':_0x490984,'rows':_0x376a6e}:null;}})[_0x5c46('0x25')](respondWithResult(_0x153305,null))[_0x5c46('0x2e')](handleError(_0x153305,null));};exports[_0x5c46('0x7f')]=function(_0x733373,_0x5608b4){var _0x21aa06=_0x733373[_0x5c46('0x67')]['id'];var _0x19dd9f=_0x733373[_0x5c46('0x61')];var _0x53f338=0xc8;var _0x203a91=null;return db[_0x5c46('0x80')][_0x5c46('0x81')]({'isolationLevel':db[_0x5c46('0x80')][_0x5c46('0x82')][_0x5c46('0x83')]['READ_COMMITTED']},function(_0x31db6e){return db[_0x5c46('0x59')][_0x5c46('0x6d')]({'where':{'id':_0x21aa06},'transaction':_0x31db6e})[_0x5c46('0x25')](function(_0x39fde5){if(_0x39fde5){return db[_0x5c46('0x84')][_0x5c46('0x3b')]({'where':{'WhatsappAccountId':_0x21aa06},'transaction':_0x31db6e})[_0x5c46('0x25')](function(){var _0x2f57f5=_['map'](_0x19dd9f,function(_0xd89117){_0xd89117[_0x5c46('0x6a')]=_0x21aa06;return _0xd89117;});return db[_0x5c46('0x84')]['bulkCreate'](_0x2f57f5,{'transaction':_0x31db6e});});}else{_0x53f338=0x194;_0x203a91=[];}});})['then'](function(){if(_0x53f338!==0x194){return db[_0x5c46('0x84')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x21aa06},'order':_0x5c46('0x85')})[_0x5c46('0x25')](function(_0x56aa0b){_0x203a91=_0x56aa0b;});}})[_0x5c46('0x2e')](function(_0x3834cc){_0x53f338=0x1f4;logger[_0x5c46('0x2b')](_0x3834cc['stack']);if(_0x3834cc[_0x5c46('0x3f')]){delete _0x3834cc[_0x5c46('0x3f')];}_0x203a91=_0x3834cc;})[_0x5c46('0x86')](function(){if(_0x203a91===null){_0x5608b4['sendStatus'](_0x53f338);}else{if(_0x53f338===0x1f4){_0x5608b4[_0x5c46('0x30')](_0x53f338)[_0x5c46('0x40')](_0x203a91);}else{_0x5608b4[_0x5c46('0x30')](_0x53f338)[_0x5c46('0x32')](_0x203a91);}}});};exports[_0x5c46('0x87')]=function(_0x58dafe,_0x55e438,_0x509003){var _0x3a89e5={};var _0x2acf64={};var _0x52f421;var _0x1a4620;return db[_0x5c46('0x59')][_0x5c46('0x6d')]({'where':{'id':_0x58dafe[_0x5c46('0x67')]['id']}})[_0x5c46('0x25')](handleEntityNotFound(_0x55e438,null))[_0x5c46('0x25')](function(_0x42967c){if(_0x42967c){_0x52f421=_0x42967c;_0x2acf64[_0x5c46('0x48')]=_[_0x5c46('0x4a')](db[_0x5c46('0x84')][_0x5c46('0x45')]);_0x2acf64[_0x5c46('0x49')]=_[_0x5c46('0x4a')](_0x58dafe[_0x5c46('0x49')]);_0x2acf64[_0x5c46('0x4b')]=_[_0x5c46('0x4c')](_0x2acf64[_0x5c46('0x48')],_0x2acf64[_0x5c46('0x49')]);_0x3a89e5[_0x5c46('0x4d')]=_[_0x5c46('0x4c')](_0x2acf64['model'],qs[_0x5c46('0x4e')](_0x58dafe[_0x5c46('0x49')]['fields']));_0x3a89e5[_0x5c46('0x4d')]=_0x3a89e5['attributes']['length']?_0x3a89e5[_0x5c46('0x4d')]:_0x2acf64[_0x5c46('0x48')];_0x3a89e5[_0x5c46('0x6e')]=qs[_0x5c46('0x51')](_0x58dafe[_0x5c46('0x49')][_0x5c46('0x51')]);_0x3a89e5[_0x5c46('0x52')]=qs[_0x5c46('0x4b')](_[_0x5c46('0x53')](_0x58dafe[_0x5c46('0x49')],_0x2acf64[_0x5c46('0x4b')]));if(_0x58dafe[_0x5c46('0x49')][_0x5c46('0x57')]){_0x3a89e5['where']=_['merge'](_0x3a89e5[_0x5c46('0x52')],{'$or':_['map'](_0x3a89e5[_0x5c46('0x4d')],function(_0x580d07){var _0x40b2dc={};_0x40b2dc[_0x580d07]={'$like':'%'+_0x58dafe[_0x5c46('0x49')]['filter']+'%'};return _0x40b2dc;})});}_0x3a89e5=_['merge']({},_0x3a89e5,_0x58dafe['options']);return _0x52f421[_0x5c46('0x87')](_0x3a89e5);}})[_0x5c46('0x25')](function(_0x2fe313){if(_0x2fe313){_0x1a4620=_0x2fe313['length'];if(!_0x58dafe[_0x5c46('0x49')][_0x5c46('0x7e')](_0x5c46('0x50'))){_0x3a89e5['limit']=qs[_0x5c46('0x36')](_0x58dafe[_0x5c46('0x49')][_0x5c46('0x36')]);_0x3a89e5[_0x5c46('0x34')]=qs['offset'](_0x58dafe[_0x5c46('0x49')][_0x5c46('0x34')]);}return _0x52f421[_0x5c46('0x87')](_0x3a89e5);}})[_0x5c46('0x25')](function(_0x54bc8b){if(_0x54bc8b){return _0x54bc8b?{'count':_0x1a4620,'rows':_0x54bc8b}:null;}})[_0x5c46('0x25')](respondWithResult(_0x55e438,null))[_0x5c46('0x2e')](handleError(_0x55e438,null));};exports[_0x5c46('0x88')]=function(_0x2a665e,_0x23ba01,_0x508dc3){var _0x5be913={'channel':'whatsapp'};var _0x746cdf=[];var _0xb723ef=[];var _0x50a8d7={};return db['WhatsappAccount']['find']({'where':{'id':_0x2a665e['params']['id']},'include':[{'model':db[_0x5c46('0x84')],'as':_0x5c46('0x89')}]})[_0x5c46('0x25')](handleEntityNotFound(_0x23ba01,null))['then'](function(_0x42c346){_0x5be913['account']=_0x42c346;if(_0x5be913[_0x5c46('0x8a')]&&_0x5be913['account']['type']===_0x5c46('0x8b')&&_0x2a665e[_0x5c46('0x61')][_0x5c46('0x8c')]){if(_0x2a665e['body']['statuses'][_0x5c46('0x4f')]===0x0)return;if(_0x2a665e['body'][_0x5c46('0x8c')][0x0]['state']!==_0x5c46('0x8d'))return;return db[_0x5c46('0x8e')][_0x5c46('0x3a')]({'read':!![],'readAt':_0x2a665e[_0x5c46('0x61')][_0x5c46('0x8c')][0x0][_0x5c46('0x8f')]},{'where':{'messageId':_0x2a665e[_0x5c46('0x61')][_0x5c46('0x8c')][0x0]['message_id']},'individualHooks':!![]})[_0x5c46('0x25')](function(_0x57d2dc){return _0x23ba01['status'](0xc8)['json'](_0x57d2dc);});}_0x5be913[_0x5c46('0x90')]=_[_0x5c46('0x91')](_0x42c346[_0x5c46('0x89')],[_0x5c46('0x85')],[_0x5c46('0x92')]);if(_0x5be913[_0x5c46('0x8a')]['Applications']){delete _0x5be913[_0x5c46('0x8a')]['Applications'];}return db[_0x5c46('0x93')]['describe']()[_0x5c46('0x25')](function(_0x1f69eb){if(!_0x1f69eb){throw new db[(_0x5c46('0x94'))]['ValidationError'](_0x5c46('0x95'));}_0x746cdf=_['difference'](_['keys'](_0x1f69eb),[_0x5c46('0x96'),'updatedAt']);_0xb723ef=_[_0x5c46('0x97')](_[_0x5c46('0x4a')](_0x1f69eb),[_0x5c46('0x96'),_0x5c46('0x98'),_0x5c46('0x99'),_0x5c46('0x9a')]);_0x5be913['body']={'mapKey':'mobile'};if(_0x5be913[_0x5c46('0x8a')]&&_0x5be913[_0x5c46('0x8a')][_0x5c46('0x55')]===_0x5c46('0x9b')){_0x5be913[_0x5c46('0x61')][_0x5c46('0x9c')]=_0x2a665e[_0x5c46('0x61')][_0x5c46('0x9d')][_0x5c46('0x9e')](_0x5c46('0x9f'),'');_0x5be913[_0x5c46('0x61')][_0x5c46('0x61')]=_0x2a665e['body'][_0x5c46('0xa0')];_0x5be913[_0x5c46('0x61')][_0x5c46('0xa1')]=_0x2a665e[_0x5c46('0x61')]['MessageSid'];}if(_0x5be913[_0x5c46('0x8a')]&&_0x5be913[_0x5c46('0x8a')][_0x5c46('0x55')]===_0x5c46('0x8b')){_0x5be913['body'][_0x5c46('0x9c')]=_0x2a665e[_0x5c46('0x61')][_0x5c46('0xa2')][0x0][_0x5c46('0x9c')];_0x5be913[_0x5c46('0x61')][_0x5c46('0x61')]=_0x2a665e[_0x5c46('0x61')]['notifications'][0x0][_0x5c46('0x2c')]['body'];_0x5be913[_0x5c46('0x61')]['messageId']=_0x2a665e[_0x5c46('0x61')][_0x5c46('0xa2')][0x0][_0x5c46('0xa3')];}if(_0x5be913['body']['id']){delete _0x5be913['body']['id'];}if(_[_0x5c46('0xa4')](_0x5be913[_0x5c46('0x61')][_0x5c46('0x9c')])){throw new db['Sequelize'][(_0x5c46('0xa5'))](_0x5c46('0xa6'));}if(_[_0x5c46('0xa4')](_0x5be913[_0x5c46('0x61')][_0x5c46('0x61')])||_0x5be913[_0x5c46('0x61')][_0x5c46('0x61')]===''){throw new db[(_0x5c46('0x94'))][(_0x5c46('0xa5'))](_0x5c46('0xa7'));}if(_['isNil'](_0x5be913[_0x5c46('0x61')][_0x5c46('0xa8')])){throw new db['Sequelize'][(_0x5c46('0xa5'))](_0x5c46('0xa9')+_0xb723ef);}if(!_[_0x5c46('0xaa')](_0xb723ef,_0x5be913['body'][_0x5c46('0xa8')])){throw new db[(_0x5c46('0x94'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb723ef);}_0x50a8d7[_0x5be913[_0x5c46('0x61')][_0x5c46('0xa8')]]=_0x5be913[_0x5c46('0x61')][_0x5c46('0x9c')];return db['CmList'][_0x5c46('0x5f')]({'where':{'id':_0x5be913[_0x5c46('0x8a')][_0x5c46('0x9a')]},'include':[{'model':db[_0x5c46('0x93')],'as':'Contacts','where':_0x50a8d7,'limit':0x1,'order':[['updatedAt',_0x5c46('0xab')]]}]});})[_0x5c46('0x25')](handleEntityNotFound(_0x23ba01,null))[_0x5c46('0x25')](function(_0x1139a4){if(_0x1139a4){_0x5be913[_0x5c46('0xac')]=_[_0x5c46('0x76')](_0x1139a4,[_0x5c46('0xad')]);if(_0x1139a4[_0x5c46('0xad')]['length']){return _0x1139a4[_0x5c46('0xad')][0x0];}var _0x29f227=_[_0x5c46('0xae')](_0x5be913[_0x5c46('0x61')],{'firstName':_0x5be913[_0x5c46('0x61')][_0x5c46('0x9c')],'ListId':_0x1139a4['id']});_0x29f227[_0x5be913['body'][_0x5c46('0xa8')]]=_0x5be913[_0x5c46('0x61')][_0x5c46('0x9c')];return db[_0x5c46('0x93')][_0x5c46('0x60')](_0x29f227,{'fields':_0x746cdf,'raw':!![]});}})['then'](handleEntityNotFound(_0x23ba01,null))['then'](function(_0xf63d6){if(_0xf63d6){_0x5be913[_0x5c46('0xaf')]=_0xf63d6;var _0x470fc0={'ContactId':_0xf63d6['id'],'phone':_0x5be913[_0x5c46('0x61')][_0x5c46('0x9c')],'WhatsappAccountId':_0x2a665e[_0x5c46('0x67')]['id']};var _0x391597={'ContactId':_0xf63d6['id'],'WhatsappAccountId':_0x2a665e[_0x5c46('0x67')]['id'],'closed':![]};return db[_0x5c46('0xb0')]['find']({'where':_0x391597})[_0x5c46('0x25')](function(_0x27fe90){if(_0x27fe90){return[_0x27fe90,![]];}return db[_0x5c46('0xb0')][_0x5c46('0x60')](_0x470fc0)['then'](function(_0x59742c){return[_0x59742c,!![]];});});}})[_0x5c46('0xb1')](function(_0x2e31be,_0x5691f3){_0x5be913['interaction']=_0x2e31be[_0x5c46('0x3c')]({'plain':!![]});_0x5be913[_0x5c46('0xb2')][_0x5c46('0xb3')]=![];if(_0x5691f3){if(_0x5be913[_0x5c46('0x8a')]['autoclose']){_0x5be913['applications'][_0x5c46('0xb4')]({'id':0x0,'priority':_0x5be913['applications'][_0x5c46('0x4f')]+0x1,'app':'close','appdata':_0x5c46('0xb5'),'interval':_0x5c46('0xb6')});}_0x5be913[_0x5c46('0xb2')][_0x5c46('0xb3')]=!![];}return db[_0x5c46('0x8e')][_0x5c46('0x60')]({'phone':_0x5be913[_0x5c46('0x61')][_0x5c46('0x9c')],'messageId':_0x5be913[_0x5c46('0x61')][_0x5c46('0xa1')],'body':_0x5be913['body'][_0x5c46('0x61')],'WhatsappAccountId':_0x2a665e[_0x5c46('0x67')]['id'],'WhatsappInteractionId':_0x2e31be['id'],'direction':'in','ContactId':_0x2e31be[_0x5c46('0xb7')],'AttachmentId':_0x5be913['body'][_0x5c46('0xb8')]});})[_0x5c46('0x25')](function(_0x59d59f){_0x5be913[_0x5c46('0x2c')]=_0x59d59f;if(!_0x5be913[_0x5c46('0xb2')]['UserId'])return;return db[_0x5c46('0x7d')][_0x5c46('0x5f')]({'attributes':['id',_0x5c46('0x3f')],'where':{'id':_0x5be913['interaction'][_0x5c46('0xb9')]}});})[_0x5c46('0x25')](function(_0x86eb06){if(_0x86eb06){_0x5be913[_0x5c46('0x90')][_0x5c46('0xba')]({'id':0x0,'priority':0x0,'app':_0x5c46('0xbb'),'appdata':_0x86eb06[_0x5c46('0x3f')]+','+(_0x5be913['account']['waitForTheAssignedAgent']||0xa),'interval':_0x5c46('0xb6')});}if(!_0x5be913[_0x5c46('0xb2')]['queueId'])return;return db['WhatsappQueue'][_0x5c46('0x5f')]({'attributes':['id',_0x5c46('0x3f')],'where':{'id':_0x5be913[_0x5c46('0xb2')][_0x5c46('0xbc')]}});})[_0x5c46('0x25')](function(_0x1f9534){if(_0x1f9534){_0x5be913['applications'][_0x5c46('0xba')]({'id':0x0,'priority':0x1,'app':_0x5c46('0xbd'),'appdata':_0x1f9534['name']+','+(_0x5be913[_0x5c46('0x8a')][_0x5c46('0xbe')]||0x12c),'interval':_0x5c46('0xb6')});}return respondWithRpcPromise('Start','startRouting',_0x5be913);})['then'](function(_0x41ad81){if(_0x41ad81){var _0x2cd0f5=0xc8;var _0x2c3d79=_0x5c46('0xbf');logger['info'](_0x5c46('0x29'),_0x2c3d79,_0x2cd0f5,_0x5c46('0xc0'));logger[_0x5c46('0xc1')](_0x5c46('0xc2'),_0x2c3d79,_0x2cd0f5,_0x5c46('0xc0'),JSON['stringify'](_0x41ad81));if(_0x5be913[_0x5c46('0x8a')][_0x5c46('0x55')]===_0x5c46('0x9b')){return _0x23ba01[_0x5c46('0x30')](_0x2cd0f5)['set'](_0x5c46('0xc3'),_0x5c46('0xc4'))[_0x5c46('0x40')](_0x5c46('0xc5'));}else{return _0x23ba01[_0x5c46('0x30')](_0x2cd0f5)[_0x5c46('0x32')](_0x41ad81);}}});})[_0x5c46('0x2e')](handleError(_0x23ba01,null));};exports['send']=function(_0x40c0c9,_0x3c5744,_0x5a6aac){var _0x19ce0c,_0x379359,_0x52441c;if(_[_0x5c46('0xa4')](_0x40c0c9[_0x5c46('0x61')]['body'])||_0x40c0c9[_0x5c46('0x61')][_0x5c46('0x61')]===''){throw new db[(_0x5c46('0x94'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x40c0c9[_0x5c46('0x61')]['to'])){throw new db['Sequelize'][(_0x5c46('0xa5'))](_0x5c46('0xc6'));}_0x19ce0c=_0x40c0c9[_0x5c46('0x61')]['to'];return db[_0x5c46('0x59')][_0x5c46('0x5f')]({'where':{'id':_0x40c0c9[_0x5c46('0x67')]['id']},'include':[{'model':db[_0x5c46('0xc7')],'as':_0x5c46('0xc8'),'include':[{'model':db[_0x5c46('0x93')],'as':_0x5c46('0xad'),'where':{'mobile':_0x19ce0c},'limit':0x1,'order':[[_0x5c46('0x98'),_0x5c46('0xab')]]}]}]})[_0x5c46('0x25')](handleEntityNotFound(_0x3c5744,null))[_0x5c46('0x25')](function(_0x12eaf4){if(_0x12eaf4&&_0x12eaf4['List']){_0x379359=_0x12eaf4[_0x5c46('0x3c')]({'plain':!![]});if(_0x379359['List']&&_0x379359['List'][_0x5c46('0xad')][_0x5c46('0x4f')]){return _0x379359[_0x5c46('0xc8')][_0x5c46('0xad')][0x0];}return db['CmContact'][_0x5c46('0x60')](_[_0x5c46('0xae')](_0x40c0c9[_0x5c46('0x61')],{'firstName':_0x19ce0c,'mobile':_0x19ce0c,'phone':_0x19ce0c,'ListId':_0x379359[_0x5c46('0x9a')]}));}})[_0x5c46('0x25')](handleEntityNotFound(_0x3c5744,null))[_0x5c46('0x25')](function(_0x272124){if(_0x272124){_0x52441c=_0x272124;return db[_0x5c46('0xb0')][_0x5c46('0x5f')]({'where':{'ContactId':_0x52441c['id'],'closed':![],'WhatsappAccountId':_0x379359['id']}})['then'](function(_0xa01160){if(_0xa01160){return[_0xa01160,![]];}return db['WhatsappInteraction'][_0x5c46('0x60')]({'UserId':_0x40c0c9['user']['id'],'ContactId':_0x52441c['id'],'WhatsappAccountId':_0x379359['id'],'phone':_0x19ce0c,'firstMsgDirection':_0x5c46('0xc9'),'Messages':[_['merge'](_0x40c0c9['body'],{'read':![],'body':_0x40c0c9[_0x5c46('0x61')]['body'],'phone':_0x19ce0c,'WhatsappAccountId':_0x379359['id'],'UserId':_0x40c0c9[_0x5c46('0x62')]['id'],'ContactId':_0x52441c['id']})]},{'include':[{'model':db[_0x5c46('0x8e')],'as':'Messages'}]})['then'](function(_0xa4e206){return[_0xa4e206,!![]];});});}})[_0x5c46('0xb1')](function(_0x5e3a09,_0x627ef0){if(_0x627ef0){return _0x5e3a09;}return db['WhatsappMessage'][_0x5c46('0x60')](_[_0x5c46('0x54')](_0x40c0c9[_0x5c46('0x61')],{'read':![],'body':_0x40c0c9[_0x5c46('0x61')]['body'],'phone':_0x19ce0c,'WhatsappAccountId':_0x379359['id'],'WhatsappInteractionId':_0x5e3a09['id'],'UserId':_0x40c0c9[_0x5c46('0x62')]['id'],'ContactId':_0x52441c['id']}))[_0x5c46('0x25')](function(_0xccdb60){_0x5e3a09[_0x5c46('0xca')][_0x5c46('0xcb')]=[];_0x5e3a09['dataValues'][_0x5c46('0xcb')][_0x5c46('0xb4')](_0xccdb60['dataValues']);return _0x5e3a09;});})[_0x5c46('0x25')](respondWithResult(_0x3c5744,null))[_0x5c46('0x2e')](handleError(_0x3c5744,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 03e1961..f97d8fc 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 _0x5458=['remove','emit','hasOwnProperty','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0xc38cb0,_0x53d0dd){var _0x55bb59=function(_0x2e2cd4){while(--_0x2e2cd4){_0xc38cb0['push'](_0xc38cb0['shift']());}};_0x55bb59(++_0x53d0dd);}(_0x5458,0x1e0));var _0x8545=function(_0x2e80f2,_0x4a8364){_0x2e80f2=_0x2e80f2-0x0;var _0x12ef3c=_0x5458[_0x2e80f2];return _0x12ef3c;};'use strict';var EventEmitter=require(_0x8545('0x0'));var WhatsappAccount=require(_0x8545('0x1'))['db'][_0x8545('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8545('0x3')](0x0);var events={'afterCreate':_0x8545('0x4'),'afterUpdate':_0x8545('0x5'),'afterDestroy':_0x8545('0x6')};function emitEvent(_0x84992){return function(_0x38de41,_0x26c34b,_0x18bbb7){WhatsappAccountEvents[_0x8545('0x7')](_0x84992+':'+_0x38de41['id'],_0x38de41);WhatsappAccountEvents[_0x8545('0x7')](_0x84992,_0x38de41);_0x18bbb7(null);};}for(var e in events){if(events[_0x8545('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x9be9=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x9be9,0x128));var _0x99be=function(_0x198c07,_0x290791){_0x198c07=_0x198c07-0x0;var _0x22f257=_0x9be9[_0x198c07];return _0x22f257;};'use strict';var EventEmitter=require(_0x99be('0x0'));var WhatsappAccount=require(_0x99be('0x1'))['db'][_0x99be('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x99be('0x3')](0x0);var events={'afterCreate':_0x99be('0x4'),'afterUpdate':_0x99be('0x5'),'afterDestroy':_0x99be('0x6')};function emitEvent(_0x599ad2){return function(_0x28d50d,_0x4beb46,_0x41329a){WhatsappAccountEvents[_0x99be('0x7')](_0x599ad2+':'+_0x28d50d['id'],_0x28d50d);WhatsappAccountEvents[_0x99be('0x7')](_0x599ad2,_0x28d50d);_0x41329a(null);};}for(var e in events){if(events[_0x99be('0x8')](e)){var event=events[e];WhatsappAccount[_0x99be('0x9')](e,emitEvent(event));}}module[_0x99be('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index c39e83c..17374fe 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 _0x6ede=['whatsapp_accounts','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappAccount'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x6ede,0x1e5));var _0xe6ed=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x6ede[_0x24697b];return _0x585b99;};'use strict';var _=require(_0xe6ed('0x0'));var util=require(_0xe6ed('0x1'));var logger=require('../../config/logger')(_0xe6ed('0x2'));var moment=require('moment');var BPromise=require(_0xe6ed('0x3'));var rp=require(_0xe6ed('0x4'));var fs=require('fs');var path=require(_0xe6ed('0x5'));var rimraf=require(_0xe6ed('0x6'));var config=require(_0xe6ed('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xe6ed('0x8')]=function(_0x85c7c8,_0x21e780){return _0x85c7c8['define'](_0xe6ed('0x9'),attributes,{'tableName':_0xe6ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9110=['../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','moment','bluebird','request-promise','path','rimraf'];(function(_0x5475a6,_0x2e1d92){var _0x4683bd=function(_0x2c8bdb){while(--_0x2c8bdb){_0x5475a6['push'](_0x5475a6['shift']());}};_0x4683bd(++_0x2e1d92);}(_0x9110,0x1e5));var _0x0911=function(_0x460c0e,_0x28eab0){_0x460c0e=_0x460c0e-0x0;var _0x1e0be1=_0x9110[_0x460c0e];return _0x1e0be1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0911('0x0'));var BPromise=require(_0x0911('0x1'));var rp=require(_0x0911('0x2'));var fs=require('fs');var path=require(_0x0911('0x3'));var rimraf=require(_0x0911('0x4'));var config=require(_0x0911('0x5'));var attributes=require(_0x0911('0x6'));module['exports']=function(_0x4454a4,_0xb6da8e){return _0x4454a4[_0x0911('0x7')](_0x0911('0x8'),attributes,{'tableName':_0x0911('0x9'),'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 feeff0e..2c6df79 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 _0x3859=['http','redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1441de,_0x408ed9){var _0x26567d=function(_0x354208){while(--_0x354208){_0x1441de['push'](_0x1441de['shift']());}};_0x26567d(++_0x408ed9);}(_0x3859,0xf2));var _0x9385=function(_0x2101a8,_0x4fdf0d){_0x2101a8=_0x2101a8-0x0;var _0x1f112d=_0x3859[_0x2101a8];return _0x1f112d;};'use strict';var _=require(_0x9385('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9385('0x1'));var rs=require(_0x9385('0x2'));var fs=require('fs');var Redis=require(_0x9385('0x3'));var db=require(_0x9385('0x4'))['db'];var utils=require(_0x9385('0x5'));var logger=require(_0x9385('0x6'))(_0x9385('0x7'));var config=require(_0x9385('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9385('0x9')][_0x9385('0xa')]({'port':0x232a});config[_0x9385('0xb')]=_['defaults'](config[_0x9385('0xb')],{'host':_0x9385('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9385('0xd'))[_0x9385('0xe')](socket);function respondWithRpcPromise(_0x4c6d3f,_0x161adf,_0x459f3c){return new BPromise(function(_0x2ee876,_0x564ea7){return client[_0x9385('0xf')](_0x4c6d3f,_0x459f3c)[_0x9385('0x10')](function(_0x1e0218){logger[_0x9385('0x11')](_0x9385('0x12'),_0x161adf,_0x9385('0x13'));logger['debug'](_0x9385('0x14'),_0x161adf,'request\x20sent',JSON['stringify'](_0x1e0218));if(_0x1e0218['error']){if(_0x1e0218[_0x9385('0x15')]['code']===0x1f4){logger[_0x9385('0x15')](_0x9385('0x12'),_0x161adf,_0x1e0218[_0x9385('0x15')][_0x9385('0x16')]);return _0x564ea7(_0x1e0218['error'][_0x9385('0x16')]);}logger[_0x9385('0x15')](_0x9385('0x12'),_0x161adf,_0x1e0218[_0x9385('0x15')][_0x9385('0x16')]);return _0x2ee876(_0x1e0218[_0x9385('0x15')]['message']);}else{logger['info'](_0x9385('0x12'),_0x161adf,_0x9385('0x13'));_0x2ee876(_0x1e0218[_0x9385('0x17')]['message']);}})[_0x9385('0x18')](function(_0x2cc5ae){logger[_0x9385('0x15')](_0x9385('0x12'),_0x161adf,_0x2cc5ae);_0x564ea7(_0x2cc5ae);});});}exports[_0x9385('0x19')]=function(_0x3a5d93){var _0x9761ad=this;return new Promise(function(_0xd6c9d0,_0x583888){return db[_0x9385('0x1a')][_0x9385('0x1b')]({'raw':_0x3a5d93[_0x9385('0x1c')]?_0x3a5d93[_0x9385('0x1c')][_0x9385('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a5d93[_0x9385('0x1c')]?_0x3a5d93[_0x9385('0x1c')][_0x9385('0x1e')]||null:null,'attributes':_0x3a5d93['options']?_0x3a5d93[_0x9385('0x1c')][_0x9385('0x1f')]||null:null,'include':_0x3a5d93[_0x9385('0x1c')]?_0x3a5d93[_0x9385('0x1c')][_0x9385('0x20')]?_['map'](_0x3a5d93[_0x9385('0x1c')][_0x9385('0x20')],function(_0x411b2f){return{'model':db[_0x411b2f[_0x9385('0x21')]],'as':_0x411b2f['as'],'attributes':_0x411b2f[_0x9385('0x1f')],'include':_0x411b2f['include']?_[_0x9385('0x22')](_0x411b2f[_0x9385('0x20')],function(_0x69128){return{'model':db[_0x69128[_0x9385('0x21')]],'as':_0x69128['as'],'attributes':_0x69128[_0x9385('0x1f')],'include':_0x69128[_0x9385('0x20')]?_[_0x9385('0x22')](_0x69128['include'],function(_0x9b9b2a){return{'model':db[_0x9b9b2a[_0x9385('0x21')]],'as':_0x9b9b2a['as'],'attributes':_0x9b9b2a[_0x9385('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e152c){logger[_0x9385('0x11')](_0x9385('0x19'),_0x3a5d93);logger[_0x9385('0x23')](_0x9385('0x19'),_0x3a5d93,JSON['stringify'](_0x2e152c));_0xd6c9d0(_0x2e152c);})['catch'](function(_0x434787){logger[_0x9385('0x15')]('ShowWhatsappAccount',_0x434787['message'],_0x3a5d93);_0x583888(_0x9761ad['error'](0x1f4,_0x434787[_0x9385('0x16')]));});});}; \ No newline at end of file +var _0x9a02=['localhost','./whatsappAccount.socket','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','include','map','attributes','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','defaults'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9a02,0x15c));var _0x29a0=function(_0x8ed9aa,_0x9a96d6){_0x8ed9aa=_0x8ed9aa-0x0;var _0x17b5c2=_0x9a02[_0x8ed9aa];return _0x17b5c2;};'use strict';var _=require(_0x29a0('0x0'));var util=require(_0x29a0('0x1'));var moment=require(_0x29a0('0x2'));var BPromise=require(_0x29a0('0x3'));var rs=require(_0x29a0('0x4'));var fs=require('fs');var Redis=require(_0x29a0('0x5'));var db=require(_0x29a0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x29a0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x29a0('0x8')][_0x29a0('0x9')]({'port':0x232a});config[_0x29a0('0xa')]=_[_0x29a0('0xb')](config['redis'],{'host':_0x29a0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29a0('0xa')]));require(_0x29a0('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d423f,_0x26a673,_0x4e863f){return new BPromise(function(_0x121946,_0x5777fc){return client[_0x29a0('0xe')](_0x5d423f,_0x4e863f)['then'](function(_0x2f3e55){logger[_0x29a0('0xf')](_0x29a0('0x10'),_0x26a673,_0x29a0('0x11'));logger[_0x29a0('0x12')](_0x29a0('0x13'),_0x26a673,_0x29a0('0x11'),JSON[_0x29a0('0x14')](_0x2f3e55));if(_0x2f3e55[_0x29a0('0x15')]){if(_0x2f3e55['error'][_0x29a0('0x16')]===0x1f4){logger['error'](_0x29a0('0x10'),_0x26a673,_0x2f3e55[_0x29a0('0x15')][_0x29a0('0x17')]);return _0x5777fc(_0x2f3e55[_0x29a0('0x15')][_0x29a0('0x17')]);}logger[_0x29a0('0x15')](_0x29a0('0x10'),_0x26a673,_0x2f3e55[_0x29a0('0x15')]['message']);return _0x121946(_0x2f3e55[_0x29a0('0x15')][_0x29a0('0x17')]);}else{logger[_0x29a0('0xf')](_0x29a0('0x10'),_0x26a673,'request\x20sent');_0x121946(_0x2f3e55[_0x29a0('0x18')][_0x29a0('0x17')]);}})[_0x29a0('0x19')](function(_0x498f2f){logger[_0x29a0('0x15')](_0x29a0('0x10'),_0x26a673,_0x498f2f);_0x5777fc(_0x498f2f);});});}exports[_0x29a0('0x1a')]=function(_0x1430a3){var _0x21813d=this;return new Promise(function(_0x5ade02,_0x1dbc2d){return db[_0x29a0('0x1b')][_0x29a0('0x1c')]({'raw':_0x1430a3[_0x29a0('0x1d')]?_0x1430a3[_0x29a0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1430a3[_0x29a0('0x1d')]?_0x1430a3[_0x29a0('0x1d')][_0x29a0('0x1e')]||null:null,'attributes':_0x1430a3[_0x29a0('0x1d')]?_0x1430a3[_0x29a0('0x1d')]['attributes']||null:null,'include':_0x1430a3['options']?_0x1430a3['options'][_0x29a0('0x1f')]?_[_0x29a0('0x20')](_0x1430a3['options'][_0x29a0('0x1f')],function(_0x37cfdc){return{'model':db[_0x37cfdc['model']],'as':_0x37cfdc['as'],'attributes':_0x37cfdc[_0x29a0('0x21')],'include':_0x37cfdc[_0x29a0('0x1f')]?_['map'](_0x37cfdc['include'],function(_0x237f63){return{'model':db[_0x237f63[_0x29a0('0x22')]],'as':_0x237f63['as'],'attributes':_0x237f63[_0x29a0('0x21')],'include':_0x237f63[_0x29a0('0x1f')]?_[_0x29a0('0x20')](_0x237f63[_0x29a0('0x1f')],function(_0x47de40){return{'model':db[_0x47de40[_0x29a0('0x22')]],'as':_0x47de40['as'],'attributes':_0x47de40['attributes']};}):[]};}):[]};}):[]:[]})[_0x29a0('0x23')](function(_0x1c77c4){logger['info'](_0x29a0('0x1a'),_0x1430a3);logger[_0x29a0('0x12')](_0x29a0('0x1a'),_0x1430a3,JSON['stringify'](_0x1c77c4));_0x5ade02(_0x1c77c4);})['catch'](function(_0x4fdf2a){logger[_0x29a0('0x15')](_0x29a0('0x1a'),_0x4fdf2a[_0x29a0('0x17')],_0x1430a3);_0x1dbc2d(_0x21813d[_0x29a0('0x15')](0x1f4,_0x4fdf2a[_0x29a0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 99f0816..3911b95 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 _0x10c6=['emit','register','length','./whatsappAccount.events','save'];(function(_0x5cfe9a,_0x48b31a){var _0x2210ba=function(_0x1a2757){while(--_0x1a2757){_0x5cfe9a['push'](_0x5cfe9a['shift']());}};_0x2210ba(++_0x48b31a);}(_0x10c6,0x8f));var _0x610c=function(_0x22e228,_0x233f85){_0x22e228=_0x22e228-0x0;var _0x58af1d=_0x10c6[_0x22e228];return _0x58af1d;};'use strict';var WhatsappAccountEvents=require(_0x610c('0x0'));var events=[_0x610c('0x1'),'remove','update'];function createListener(_0x473747,_0x4c4034){return function(_0x38cffa){_0x4c4034[_0x610c('0x2')](_0x473747,_0x38cffa);};}function removeListener(_0x3452fc,_0x4a11bc){return function(){WhatsappAccountEvents['removeListener'](_0x3452fc,_0x4a11bc);};}exports[_0x610c('0x3')]=function(_0x573124){for(var _0x23353e=0x0,_0x53b6c5=events[_0x610c('0x4')];_0x23353e<_0x53b6c5;_0x23353e++){var _0x4ac7ce=events[_0x23353e];var _0x39f6ef=createListener('whatsappAccount:'+_0x4ac7ce,_0x573124);WhatsappAccountEvents['on'](_0x4ac7ce,_0x39f6ef);}}; \ No newline at end of file +var _0x1959=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x1959,0xe7));var _0x9195=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0x1959[_0x2fcf18];return _0x4c68cc;};'use strict';var WhatsappAccountEvents=require(_0x9195('0x0'));var events=[_0x9195('0x1'),_0x9195('0x2'),_0x9195('0x3')];function createListener(_0x2e5304,_0x33223f){return function(_0x3899d9){_0x33223f[_0x9195('0x4')](_0x2e5304,_0x3899d9);};}function removeListener(_0x235a79,_0x2689a0){return function(){WhatsappAccountEvents[_0x9195('0x5')](_0x235a79,_0x2689a0);};}exports[_0x9195('0x6')]=function(_0x28bc87){for(var _0x2d155a=0x0,_0x4d6517=events[_0x9195('0x7')];_0x2d155a<_0x4d6517;_0x2d155a++){var _0x460351=events[_0x2d155a];var _0x92b4fa=createListener(_0x9195('0x8')+_0x460351,_0x28bc87);WhatsappAccountEvents['on'](_0x460351,_0x92b4fa);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0785c2b..17f87e8 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 _0x37c6=['isAuthenticated','show','create','put','update','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id'];(function(_0xb9cb84,_0x32e936){var _0x272e1c=function(_0xadddcb){while(--_0xadddcb){_0xb9cb84['push'](_0xb9cb84['shift']());}};_0x272e1c(++_0x32e936);}(_0x37c6,0xba));var _0x637c=function(_0x2cc887,_0x21e1d1){_0x2cc887=_0x2cc887-0x0;var _0xaa2a2c=_0x37c6[_0x2cc887];return _0xaa2a2c;};'use strict';var multer=require(_0x637c('0x0'));var util=require('util');var path=require(_0x637c('0x1'));var timeout=require(_0x637c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x637c('0x3'));var config=require(_0x637c('0x4'));var controller=require(_0x637c('0x5'));router[_0x637c('0x6')]('/',auth['isAuthenticated'](),controller[_0x637c('0x7')]);router[_0x637c('0x6')](_0x637c('0x8'),auth[_0x637c('0x9')](),controller[_0x637c('0xa')]);router['post']('/',auth[_0x637c('0x9')](),controller[_0x637c('0xb')]);router[_0x637c('0xc')](_0x637c('0x8'),auth[_0x637c('0x9')](),controller[_0x637c('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x637c('0xe')]=router; \ No newline at end of file +var _0xfef2=['../../config/environment','./whatsappApplication.controller','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f8972,_0x1d66d1){var _0x406423=function(_0x1b5e7d){while(--_0x1b5e7d){_0x3f8972['push'](_0x3f8972['shift']());}};_0x406423(++_0x1d66d1);}(_0xfef2,0x19c));var _0x2fef=function(_0x4dedd3,_0x175841){_0x4dedd3=_0x4dedd3-0x0;var _0x48f768=_0xfef2[_0x4dedd3];return _0x48f768;};'use strict';var multer=require(_0x2fef('0x0'));var util=require(_0x2fef('0x1'));var path=require(_0x2fef('0x2'));var timeout=require(_0x2fef('0x3'));var express=require(_0x2fef('0x4'));var router=express['Router']();var fs_extra=require(_0x2fef('0x5'));var auth=require(_0x2fef('0x6'));var interaction=require(_0x2fef('0x7'));var config=require(_0x2fef('0x8'));var controller=require(_0x2fef('0x9'));router['get']('/',auth[_0x2fef('0xa')](),controller[_0x2fef('0xb')]);router['get']('/:id',auth[_0x2fef('0xa')](),controller[_0x2fef('0xc')]);router[_0x2fef('0xd')]('/',auth['isAuthenticated'](),controller[_0x2fef('0xe')]);router[_0x2fef('0xf')](_0x2fef('0x10'),auth[_0x2fef('0xa')](),controller[_0x2fef('0x11')]);router['delete'](_0x2fef('0x10'),auth[_0x2fef('0xa')](),controller[_0x2fef('0x12')]);module[_0x2fef('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 26fbc60..654ee52 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 _0x0d28=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x5012e0,_0x47a186){var _0x72706d=function(_0x13d02e){while(--_0x13d02e){_0x5012e0['push'](_0x5012e0['shift']());}};_0x72706d(++_0x47a186);}(_0x0d28,0xf1));var _0x80d2=function(_0x1d6a12,_0x49b3d3){_0x1d6a12=_0x1d6a12-0x0;var _0x3a79ca=_0x0d28[_0x1d6a12];return _0x3a79ca;};'use strict';var Sequelize=require(_0x80d2('0x0'));module[_0x80d2('0x1')]={'priority':{'type':Sequelize[_0x80d2('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x80d2('0x3')},'appdata':{'type':Sequelize[_0x80d2('0x4')]()},'description':{'type':Sequelize[_0x80d2('0x5')]},'interval':{'type':Sequelize[_0x80d2('0x5')],'defaultValue':_0x80d2('0x6')}}; \ No newline at end of file +var _0x0718=['exports','STRING','noop'];(function(_0x2f1172,_0x5f5b26){var _0x58e374=function(_0x1a61fa){while(--_0x1a61fa){_0x2f1172['push'](_0x2f1172['shift']());}};_0x58e374(++_0x5f5b26);}(_0x0718,0x1c2));var _0x8071=function(_0x20713e,_0x44f710){_0x20713e=_0x20713e-0x0;var _0x7d998b=_0x0718[_0x20713e];return _0x7d998b;};'use strict';var Sequelize=require('sequelize');module[_0x8071('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8071('0x1')],'allowNull':![],'defaultValue':_0x8071('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8071('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 6233f1e..6118a84 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 _0x583c=['body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappApplication','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3fbdf4,_0x43428a){var _0x248e6e=function(_0xbee9f5){while(--_0xbee9f5){_0x3fbdf4['push'](_0x3fbdf4['shift']());}};_0x248e6e(++_0x43428a);}(_0x583c,0x12b));var _0xc583=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0x583c[_0x25c988];return _0x45fcc2;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];function respondWithStatusCode(_0x87632d,_0x24343b){_0x24343b=_0x24343b||0xcc;return function(_0x267da0){if(_0x267da0){return _0x87632d[_0xc583('0x18')](_0x24343b);}return _0x87632d[_0xc583('0x19')](_0x24343b)[_0xc583('0x1a')]();};}function respondWithResult(_0xf81809,_0x1c6b79){_0x1c6b79=_0x1c6b79||0xc8;return function(_0x5403a3){if(_0x5403a3){return _0xf81809[_0xc583('0x19')](_0x1c6b79)['json'](_0x5403a3);}};}function respondWithFilteredResult(_0x19f46a,_0x299fa1){return function(_0x510090){if(_0x510090){var _0x263552=typeof _0x299fa1[_0xc583('0x1b')]==='undefined'&&typeof _0x299fa1[_0xc583('0x1c')]===_0xc583('0x1d');var _0x5127fa=_0x510090[_0xc583('0x1e')];var _0x8a2d84=_0x263552?0x0:_0x299fa1[_0xc583('0x1b')];var _0x36e0fd=_0x263552?_0x510090['count']:_0x299fa1[_0xc583('0x1b')]+_0x299fa1['limit'];var _0x227ec2;if(_0x36e0fd>=_0x5127fa){_0x36e0fd=_0x5127fa;_0x227ec2=0xc8;}else{_0x227ec2=0xce;}_0x19f46a[_0xc583('0x19')](_0x227ec2);return _0x19f46a[_0xc583('0x1f')](_0xc583('0x20'),_0x8a2d84+'-'+_0x36e0fd+'/'+_0x5127fa)[_0xc583('0x21')](_0x510090);}return null;};}function patchUpdates(_0x12b910){return function(_0x3ce81b){try{jsonpatch[_0xc583('0x22')](_0x3ce81b,_0x12b910,!![]);}catch(_0x37fcd4){return BPromise[_0xc583('0x23')](_0x37fcd4);}return _0x3ce81b[_0xc583('0x24')]();};}function saveUpdates(_0x3b31bc,_0x21466f){return function(_0x478ee1){if(_0x478ee1){return _0x478ee1['update'](_0x3b31bc)[_0xc583('0x25')](function(_0x3e075c){return _0x3e075c;});}return null;};}function removeEntity(_0x8443dc,_0x5ceef1){return function(_0x1521e2){if(_0x1521e2){return _0x1521e2[_0xc583('0x26')]()[_0xc583('0x25')](function(){_0x8443dc[_0xc583('0x19')](0xcc)[_0xc583('0x1a')]();});}};}function handleEntityNotFound(_0x48c95e,_0x4cad36){return function(_0x45871c){if(!_0x45871c){_0x48c95e['sendStatus'](0x194);}return _0x45871c;};}function handleError(_0x45ef74,_0xcbe9b2){_0xcbe9b2=_0xcbe9b2||0x1f4;return function(_0xbabf24){logger[_0xc583('0x27')](_0xbabf24[_0xc583('0x28')]);if(_0xbabf24['name']){delete _0xbabf24[_0xc583('0x29')];}_0x45ef74[_0xc583('0x19')](_0xcbe9b2)['send'](_0xbabf24);};}exports[_0xc583('0x2a')]=function(_0x483357,_0x2c9088){var _0x8d4ecb={},_0x1c80b1={},_0x3ed083={'count':0x0,'rows':[]};var _0x1b2b49=_[_0xc583('0x2b')](db[_0xc583('0x2c')]['rawAttributes'],function(_0x529dbe){return{'name':_0x529dbe[_0xc583('0x2d')],'type':_0x529dbe[_0xc583('0x2e')][_0xc583('0x2f')]};});_0x1c80b1[_0xc583('0x30')]=_[_0xc583('0x2b')](_0x1b2b49,'name');_0x1c80b1[_0xc583('0x31')]=_['keys'](_0x483357['query']);_0x1c80b1[_0xc583('0x32')]=_[_0xc583('0x33')](_0x1c80b1[_0xc583('0x30')],_0x1c80b1[_0xc583('0x31')]);_0x8d4ecb[_0xc583('0x34')]=_['intersection'](_0x1c80b1[_0xc583('0x30')],qs[_0xc583('0x35')](_0x483357[_0xc583('0x31')]['fields']));_0x8d4ecb[_0xc583('0x34')]=_0x8d4ecb['attributes'][_0xc583('0x36')]?_0x8d4ecb[_0xc583('0x34')]:_0x1c80b1[_0xc583('0x30')];if(!_0x483357[_0xc583('0x31')][_0xc583('0x37')]('nolimit')){_0x8d4ecb[_0xc583('0x1c')]=qs['limit'](_0x483357[_0xc583('0x31')]['limit']);_0x8d4ecb[_0xc583('0x1b')]=qs[_0xc583('0x1b')](_0x483357[_0xc583('0x31')][_0xc583('0x1b')]);}_0x8d4ecb[_0xc583('0x38')]=qs[_0xc583('0x39')](_0x483357['query']['sort']);_0x8d4ecb[_0xc583('0x3a')]=qs[_0xc583('0x32')](_['pick'](_0x483357[_0xc583('0x31')],_0x1c80b1[_0xc583('0x32')]),_0x1b2b49);if(_0x483357[_0xc583('0x31')][_0xc583('0x3b')]){_0x8d4ecb[_0xc583('0x3a')]=_[_0xc583('0x3c')](_0x8d4ecb['where'],{'$or':_[_0xc583('0x2b')](_0x1b2b49,function(_0x595351){if(_0x595351[_0xc583('0x2e')]!==_0xc583('0x3d')){var _0x39bed4={};_0x39bed4[_0x595351['name']]={'$like':'%'+_0x483357['query']['filter']+'%'};return _0x39bed4;}})});}_0x8d4ecb=_[_0xc583('0x3c')]({},_0x8d4ecb,_0x483357[_0xc583('0x3e')]);var _0x2b957d={'where':_0x8d4ecb[_0xc583('0x3a')]};return db['WhatsappApplication'][_0xc583('0x1e')](_0x2b957d)[_0xc583('0x25')](function(_0x594a0b){_0x3ed083['count']=_0x594a0b;if(_0x483357[_0xc583('0x31')]['includeAll']){_0x8d4ecb[_0xc583('0x3f')]=[{'all':!![]}];}return db[_0xc583('0x2c')][_0xc583('0x40')](_0x8d4ecb);})[_0xc583('0x25')](function(_0x58553e){_0x3ed083[_0xc583('0x41')]=_0x58553e;return _0x3ed083;})[_0xc583('0x25')](respondWithFilteredResult(_0x2c9088,_0x8d4ecb))[_0xc583('0x42')](handleError(_0x2c9088,null));};exports[_0xc583('0x43')]=function(_0x2c1c22,_0x5e6e7e){var _0x3ffeb7={'raw':!![],'where':{'id':_0x2c1c22['params']['id']}},_0x5f5a97={};_0x5f5a97[_0xc583('0x30')]=_[_0xc583('0x44')](db['WhatsappApplication']['rawAttributes']);_0x5f5a97[_0xc583('0x31')]=_[_0xc583('0x44')](_0x2c1c22[_0xc583('0x31')]);_0x5f5a97[_0xc583('0x32')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],_0x5f5a97['query']);_0x3ffeb7[_0xc583('0x34')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],qs[_0xc583('0x35')](_0x2c1c22[_0xc583('0x31')][_0xc583('0x35')]));_0x3ffeb7[_0xc583('0x34')]=_0x3ffeb7['attributes'][_0xc583('0x36')]?_0x3ffeb7[_0xc583('0x34')]:_0x5f5a97[_0xc583('0x30')];if(_0x2c1c22['query']['includeAll']){_0x3ffeb7['include']=[{'all':!![]}];}_0x3ffeb7=_[_0xc583('0x3c')]({},_0x3ffeb7,_0x2c1c22['options']);return db[_0xc583('0x2c')][_0xc583('0x45')](_0x3ffeb7)[_0xc583('0x25')](handleEntityNotFound(_0x5e6e7e,null))[_0xc583('0x25')](respondWithResult(_0x5e6e7e,null))[_0xc583('0x42')](handleError(_0x5e6e7e,null));};exports[_0xc583('0x46')]=function(_0x302038,_0x32cfbf){return db[_0xc583('0x2c')][_0xc583('0x46')](_0x302038[_0xc583('0x47')],{})['then'](respondWithResult(_0x32cfbf,0xc9))[_0xc583('0x42')](handleError(_0x32cfbf,null));};exports[_0xc583('0x48')]=function(_0x453df7,_0x230a45){if(_0x453df7['body']['id']){delete _0x453df7[_0xc583('0x47')]['id'];}return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x453df7[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x230a45,null))[_0xc583('0x25')](saveUpdates(_0x453df7[_0xc583('0x47')],null))[_0xc583('0x25')](respondWithResult(_0x230a45,null))[_0xc583('0x42')](handleError(_0x230a45,null));};exports['destroy']=function(_0x1f4901,_0x1919fa){return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x1f4901[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x1919fa,null))[_0xc583('0x25')](removeEntity(_0x1919fa,null))[_0xc583('0x42')](handleError(_0x1919fa,null));}; \ No newline at end of file +var _0x3a15=['fields','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','params','length','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','query','keys','attributes','intersection'];(function(_0x16c8c6,_0x10fde4){var _0x35c645=function(_0xe1c153){while(--_0xe1c153){_0x16c8c6['push'](_0x16c8c6['shift']());}};_0x35c645(++_0x10fde4);}(_0x3a15,0xde));var _0x53a1=function(_0x1319ab,_0x4aadf5){_0x1319ab=_0x1319ab-0x0;var _0x11d131=_0x3a15[_0x1319ab];return _0x11d131;};'use strict';var emlformat=require(_0x53a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53a1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53a1('0x2'));var moment=require(_0x53a1('0x3'));var BPromise=require(_0x53a1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53a1('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53a1('0x6'));var _=require('lodash');var squel=require(_0x53a1('0x7'));var crypto=require(_0x53a1('0x8'));var jsforce=require(_0x53a1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x53a1('0xa'));var querystring=require(_0x53a1('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53a1('0xc'));var as=require(_0x53a1('0xd'));var hardwareService=require(_0x53a1('0xe'));var logger=require(_0x53a1('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53a1('0x10'));var db=require(_0x53a1('0x11'))['db'];function respondWithStatusCode(_0x50cd84,_0x1a89e9){_0x1a89e9=_0x1a89e9||0xcc;return function(_0x17d23b){if(_0x17d23b){return _0x50cd84[_0x53a1('0x12')](_0x1a89e9);}return _0x50cd84['status'](_0x1a89e9)[_0x53a1('0x13')]();};}function respondWithResult(_0x456144,_0x3d66f5){_0x3d66f5=_0x3d66f5||0xc8;return function(_0x36e275){if(_0x36e275){return _0x456144[_0x53a1('0x14')](_0x3d66f5)[_0x53a1('0x15')](_0x36e275);}};}function respondWithFilteredResult(_0x762aaa,_0x3313fe){return function(_0x474d58){if(_0x474d58){var _0x552306=typeof _0x3313fe[_0x53a1('0x16')]===_0x53a1('0x17')&&typeof _0x3313fe[_0x53a1('0x18')]===_0x53a1('0x17');var _0x153ce9=_0x474d58[_0x53a1('0x19')];var _0x1cb902=_0x552306?0x0:_0x3313fe['offset'];var _0x3c7bed=_0x552306?_0x474d58['count']:_0x3313fe[_0x53a1('0x16')]+_0x3313fe[_0x53a1('0x18')];var _0x6f21f7;if(_0x3c7bed>=_0x153ce9){_0x3c7bed=_0x153ce9;_0x6f21f7=0xc8;}else{_0x6f21f7=0xce;}_0x762aaa[_0x53a1('0x14')](_0x6f21f7);return _0x762aaa[_0x53a1('0x1a')](_0x53a1('0x1b'),_0x1cb902+'-'+_0x3c7bed+'/'+_0x153ce9)['json'](_0x474d58);}return null;};}function patchUpdates(_0x16916f){return function(_0x167671){try{jsonpatch['apply'](_0x167671,_0x16916f,!![]);}catch(_0xcea683){return BPromise[_0x53a1('0x1c')](_0xcea683);}return _0x167671['save']();};}function saveUpdates(_0x2f0f7e,_0x11253c){return function(_0x5173a3){if(_0x5173a3){return _0x5173a3[_0x53a1('0x1d')](_0x2f0f7e)[_0x53a1('0x1e')](function(_0x5f4135){return _0x5f4135;});}return null;};}function removeEntity(_0x1140a0,_0x1a4dab){return function(_0x471e34){if(_0x471e34){return _0x471e34[_0x53a1('0x1f')]()['then'](function(){_0x1140a0[_0x53a1('0x14')](0xcc)[_0x53a1('0x13')]();});}};}function handleEntityNotFound(_0x2a71f1,_0x1027d4){return function(_0x3bf15c){if(!_0x3bf15c){_0x2a71f1[_0x53a1('0x12')](0x194);}return _0x3bf15c;};}function handleError(_0x507a9e,_0xc8a720){_0xc8a720=_0xc8a720||0x1f4;return function(_0xc86808){logger[_0x53a1('0x20')](_0xc86808[_0x53a1('0x21')]);if(_0xc86808[_0x53a1('0x22')]){delete _0xc86808[_0x53a1('0x22')];}_0x507a9e[_0x53a1('0x14')](_0xc8a720)[_0x53a1('0x23')](_0xc86808);};}exports[_0x53a1('0x24')]=function(_0x162bd1,_0x255768){var _0x15a530={},_0x5cb95e={},_0x61d58c={'count':0x0,'rows':[]};var _0x384f20=_[_0x53a1('0x25')](db[_0x53a1('0x26')][_0x53a1('0x27')],function(_0x2da6b5){return{'name':_0x2da6b5[_0x53a1('0x28')],'type':_0x2da6b5['type']['key']};});_0x5cb95e[_0x53a1('0x29')]=_[_0x53a1('0x25')](_0x384f20,_0x53a1('0x22'));_0x5cb95e[_0x53a1('0x2a')]=_[_0x53a1('0x2b')](_0x162bd1[_0x53a1('0x2a')]);_0x5cb95e['filters']=_['intersection'](_0x5cb95e[_0x53a1('0x29')],_0x5cb95e[_0x53a1('0x2a')]);_0x15a530[_0x53a1('0x2c')]=_[_0x53a1('0x2d')](_0x5cb95e[_0x53a1('0x29')],qs[_0x53a1('0x2e')](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x2e')]));_0x15a530[_0x53a1('0x2c')]=_0x15a530['attributes']['length']?_0x15a530[_0x53a1('0x2c')]:_0x5cb95e[_0x53a1('0x29')];if(!_0x162bd1[_0x53a1('0x2a')]['hasOwnProperty'](_0x53a1('0x2f'))){_0x15a530[_0x53a1('0x18')]=qs[_0x53a1('0x18')](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x18')]);_0x15a530[_0x53a1('0x16')]=qs['offset'](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x16')]);}_0x15a530[_0x53a1('0x30')]=qs[_0x53a1('0x31')](_0x162bd1['query'][_0x53a1('0x31')]);_0x15a530['where']=qs[_0x53a1('0x32')](_[_0x53a1('0x33')](_0x162bd1[_0x53a1('0x2a')],_0x5cb95e[_0x53a1('0x32')]),_0x384f20);if(_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x34')]){_0x15a530[_0x53a1('0x35')]=_[_0x53a1('0x36')](_0x15a530[_0x53a1('0x35')],{'$or':_['map'](_0x384f20,function(_0x2ae1f4){if(_0x2ae1f4[_0x53a1('0x37')]!==_0x53a1('0x38')){var _0x2d8216={};_0x2d8216[_0x2ae1f4[_0x53a1('0x22')]]={'$like':'%'+_0x162bd1['query'][_0x53a1('0x34')]+'%'};return _0x2d8216;}})});}_0x15a530=_[_0x53a1('0x36')]({},_0x15a530,_0x162bd1[_0x53a1('0x39')]);var _0x3da61c={'where':_0x15a530[_0x53a1('0x35')]};return db['WhatsappApplication']['count'](_0x3da61c)[_0x53a1('0x1e')](function(_0x3eb628){_0x61d58c[_0x53a1('0x19')]=_0x3eb628;if(_0x162bd1[_0x53a1('0x2a')]['includeAll']){_0x15a530['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x53a1('0x3a')](_0x15a530);})[_0x53a1('0x1e')](function(_0x45fb6d){_0x61d58c[_0x53a1('0x3b')]=_0x45fb6d;return _0x61d58c;})['then'](respondWithFilteredResult(_0x255768,_0x15a530))[_0x53a1('0x3c')](handleError(_0x255768,null));};exports['show']=function(_0x5c5c15,_0x21f531){var _0x4baec9={'raw':!![],'where':{'id':_0x5c5c15[_0x53a1('0x3d')]['id']}},_0x2e8242={};_0x2e8242['model']=_[_0x53a1('0x2b')](db['WhatsappApplication'][_0x53a1('0x27')]);_0x2e8242['query']=_[_0x53a1('0x2b')](_0x5c5c15['query']);_0x2e8242['filters']=_[_0x53a1('0x2d')](_0x2e8242['model'],_0x2e8242['query']);_0x4baec9[_0x53a1('0x2c')]=_[_0x53a1('0x2d')](_0x2e8242[_0x53a1('0x29')],qs['fields'](_0x5c5c15[_0x53a1('0x2a')][_0x53a1('0x2e')]));_0x4baec9[_0x53a1('0x2c')]=_0x4baec9[_0x53a1('0x2c')][_0x53a1('0x3e')]?_0x4baec9['attributes']:_0x2e8242[_0x53a1('0x29')];if(_0x5c5c15[_0x53a1('0x2a')]['includeAll']){_0x4baec9[_0x53a1('0x3f')]=[{'all':!![]}];}_0x4baec9=_[_0x53a1('0x36')]({},_0x4baec9,_0x5c5c15[_0x53a1('0x39')]);return db[_0x53a1('0x26')][_0x53a1('0x40')](_0x4baec9)['then'](handleEntityNotFound(_0x21f531,null))[_0x53a1('0x1e')](respondWithResult(_0x21f531,null))[_0x53a1('0x3c')](handleError(_0x21f531,null));};exports['create']=function(_0x5aabe1,_0x2d352d){return db[_0x53a1('0x26')][_0x53a1('0x41')](_0x5aabe1[_0x53a1('0x42')],{})[_0x53a1('0x1e')](respondWithResult(_0x2d352d,0xc9))[_0x53a1('0x3c')](handleError(_0x2d352d,null));};exports[_0x53a1('0x1d')]=function(_0x3c4aa3,_0x7dd2ee){if(_0x3c4aa3[_0x53a1('0x42')]['id']){delete _0x3c4aa3['body']['id'];}return db['WhatsappApplication'][_0x53a1('0x40')]({'where':{'id':_0x3c4aa3['params']['id']}})[_0x53a1('0x1e')](handleEntityNotFound(_0x7dd2ee,null))[_0x53a1('0x1e')](saveUpdates(_0x3c4aa3[_0x53a1('0x42')],null))['then'](respondWithResult(_0x7dd2ee,null))[_0x53a1('0x3c')](handleError(_0x7dd2ee,null));};exports[_0x53a1('0x1f')]=function(_0x455527,_0xbfe9aa){return db[_0x53a1('0x26')]['find']({'where':{'id':_0x455527[_0x53a1('0x3d')]['id']}})[_0x53a1('0x1e')](handleEntityNotFound(_0xbfe9aa,null))[_0x53a1('0x1e')](removeEntity(_0xbfe9aa,null))[_0x53a1('0x3c')](handleError(_0xbfe9aa,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7844c59..82e78d7 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 _0x2e8a=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','define','whatsapp_applications','utf8mb4'];(function(_0x308dcc,_0x2d1178){var _0x361717=function(_0x618aae){while(--_0x618aae){_0x308dcc['push'](_0x308dcc['shift']());}};_0x361717(++_0x2d1178);}(_0x2e8a,0xc7));var _0xa2e8=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x2e8a[_0xce93c];return _0x230720;};'use strict';var _=require('lodash');var util=require(_0xa2e8('0x0'));var logger=require(_0xa2e8('0x1'))('api');var moment=require(_0xa2e8('0x2'));var BPromise=require(_0xa2e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x4593d2,_0x32fb35){return _0x4593d2[_0xa2e8('0x5')]('WhatsappApplication',attributes,{'tableName':_0xa2e8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa2e8('0x7'),'collate':_0xa2e8('0x8')});}; \ No newline at end of file +var _0xacfe=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4'];(function(_0x31a65c,_0x44b8e9){var _0x6e43f6=function(_0x288bcb){while(--_0x288bcb){_0x31a65c['push'](_0x31a65c['shift']());}};_0x6e43f6(++_0x44b8e9);}(_0xacfe,0xfd));var _0xeacf=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xacfe[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeacf('0x0'))(_0xeacf('0x1'));var moment=require(_0xeacf('0x2'));var BPromise=require(_0xeacf('0x3'));var rp=require(_0xeacf('0x4'));var fs=require('fs');var path=require(_0xeacf('0x5'));var rimraf=require(_0xeacf('0x6'));var config=require(_0xeacf('0x7'));var attributes=require(_0xeacf('0x8'));module[_0xeacf('0x9')]=function(_0x369ad7,_0x229f28){return _0x369ad7[_0xeacf('0xa')]('WhatsappApplication',attributes,{'tableName':_0xeacf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeacf('0xc'),'collate':_0xeacf('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1fe4728..9bdf803 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 _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7bae,0x13b));var _0xe7ba=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7bae[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file +var _0xe5b3=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x4e1119,_0x32dc78){var _0x35f53d=function(_0x2bbfe0){while(--_0x2bbfe0){_0x4e1119['push'](_0x4e1119['shift']());}};_0x35f53d(++_0x32dc78);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4473be,_0x529ba7){_0x4473be=_0x4473be-0x0;var _0x4a2ede=_0xe5b3[_0x4473be];return _0x4a2ede;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c173056..9868058 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 _0xaa37=['describe','show','/:id/messages','getMessages','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated'];(function(_0x54fa11,_0x246e0a){var _0x11cd53=function(_0x1ea8a2){while(--_0x1ea8a2){_0x54fa11['push'](_0x54fa11['shift']());}};_0x11cd53(++_0x246e0a);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xaa37[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var path=require(_0x7aa3('0x2'));var timeout=require(_0x7aa3('0x3'));var express=require('express');var router=express[_0x7aa3('0x4')]();var fs_extra=require(_0x7aa3('0x5'));var auth=require(_0x7aa3('0x6'));var interaction=require(_0x7aa3('0x7'));var config=require(_0x7aa3('0x8'));var controller=require(_0x7aa3('0x9'));router[_0x7aa3('0xa')]('/',auth['isAuthenticated'](),controller[_0x7aa3('0xb')]);router[_0x7aa3('0xa')]('/describe',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xd')]);router[_0x7aa3('0xa')]('/:id',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xe')]);router[_0x7aa3('0xa')](_0x7aa3('0xf'),auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x10')]);router['get']('/:id/download',auth[_0x7aa3('0xc')](),controller['download']);router[_0x7aa3('0x11')]('/',auth[_0x7aa3('0xc')](),controller['create']);router[_0x7aa3('0x11')](_0x7aa3('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x7aa3('0x12'),auth[_0x7aa3('0xc')](),interaction[_0x7aa3('0x13')](_0x7aa3('0x14'),_0x7aa3('0x15')),controller['addTags']);router[_0x7aa3('0x16')](_0x7aa3('0x17'),auth[_0x7aa3('0xc')](),interaction[_0x7aa3('0x13')]('whatsapp','whatsappinteraction:update'),controller[_0x7aa3('0x18')]);router['delete'](_0x7aa3('0x17'),auth[_0x7aa3('0xc')](),interaction['tracked'](_0x7aa3('0x14'),_0x7aa3('0x19')),controller[_0x7aa3('0x1a')]);router[_0x7aa3('0x1b')](_0x7aa3('0x12'),auth['isAuthenticated'](),controller[_0x7aa3('0x1c')]);module[_0x7aa3('0x1d')]=router; \ No newline at end of file +var _0xdbb1=['/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','multer','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','index','get','/describe','isAuthenticated'];(function(_0x51e347,_0x1b565a){var _0x49ab46=function(_0x5962cf){while(--_0x5962cf){_0x51e347['push'](_0x51e347['shift']());}};_0x49ab46(++_0x1b565a);}(_0xdbb1,0x105));var _0x1dbb=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xdbb1[_0x4d07cc];return _0x42de3b;};'use strict';var multer=require(_0x1dbb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1dbb('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1dbb('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1dbb('0x3'));var controller=require(_0x1dbb('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x1dbb('0x5')]);router[_0x1dbb('0x6')](_0x1dbb('0x7'),auth[_0x1dbb('0x8')](),controller['describe']);router[_0x1dbb('0x6')](_0x1dbb('0x9'),auth['isAuthenticated'](),controller[_0x1dbb('0xa')]);router[_0x1dbb('0x6')](_0x1dbb('0xb'),auth[_0x1dbb('0x8')](),controller[_0x1dbb('0xc')]);router[_0x1dbb('0x6')](_0x1dbb('0xd'),auth[_0x1dbb('0x8')](),controller[_0x1dbb('0xe')]);router[_0x1dbb('0xf')]('/',auth[_0x1dbb('0x8')](),controller['create']);router[_0x1dbb('0xf')](_0x1dbb('0xb'),auth[_0x1dbb('0x8')](),controller[_0x1dbb('0x10')]);router['post']('/:id/tags',auth[_0x1dbb('0x8')](),interaction[_0x1dbb('0x11')](_0x1dbb('0x12'),_0x1dbb('0x13')),controller[_0x1dbb('0x14')]);router['put'](_0x1dbb('0x9'),auth[_0x1dbb('0x8')](),interaction[_0x1dbb('0x11')]('whatsapp',_0x1dbb('0x15')),controller[_0x1dbb('0x16')]);router['delete'](_0x1dbb('0x9'),auth[_0x1dbb('0x8')](),interaction[_0x1dbb('0x11')](_0x1dbb('0x12'),_0x1dbb('0x17')),controller[_0x1dbb('0x18')]);router[_0x1dbb('0x19')](_0x1dbb('0x1a'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 6372ce1..59396a9 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 _0xd914=['moment','BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize'];(function(_0x11e210,_0x6ddd11){var _0x18f889=function(_0x321a8c){while(--_0x321a8c){_0x11e210['push'](_0x11e210['shift']());}};_0x18f889(++_0x6ddd11);}(_0xd914,0x17f));var _0x4d91=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xd914[_0x134827];return _0x366671;};'use strict';var Sequelize=require(_0x4d91('0x0'));var moment=require(_0x4d91('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4d91('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d91('0x3')]},'disposition':{'type':Sequelize[_0x4d91('0x4')]},'secondDisposition':{'type':Sequelize[_0x4d91('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4d91('0x4')]},'note':{'type':Sequelize[_0x4d91('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4d91('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4d91('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d91('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4d91('0x6')]('in',_0x4d91('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4d91('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4d91('0x7')]}}; \ No newline at end of file +var _0x5458=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize'];(function(_0x12d917,_0x59ddd4){var _0x576d1a=function(_0x360f23){while(--_0x360f23){_0x12d917['push'](_0x12d917['shift']());}};_0x576d1a(++_0x59ddd4);}(_0x5458,0x1c7));var _0x8545=function(_0x3986d7,_0x33937a){_0x3986d7=_0x3986d7-0x0;var _0x1860ae=_0x5458[_0x3986d7];return _0x1860ae;};'use strict';var Sequelize=require(_0x8545('0x0'));var moment=require(_0x8545('0x1'));module[_0x8545('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8545('0x3')]},'disposition':{'type':Sequelize[_0x8545('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8545('0x4')]},'note':{'type':Sequelize[_0x8545('0x4')]},'phone':{'type':Sequelize[_0x8545('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8545('0x5')]('in',_0x8545('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8545('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8545('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8545('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 83b55ef..724f602 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 _0x5b4e=['renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','query','catch','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','closed','closedAt','disposition','basename','createReadStream','pipe','direction','out','System','Contact','value'];(function(_0x15af84,_0x7a5b4d){var _0x5ac0a4=function(_0x97cb67){while(--_0x97cb67){_0x15af84['push'](_0x15af84['shift']());}};_0x5ac0a4(++_0x7a5b4d);}(_0x5b4e,0x10a));var _0xe5b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b4e[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require(_0xe5b4('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe5b4('0x1'));var BPromise=require(_0xe5b4('0x2'));var util=require(_0xe5b4('0x3'));var path=require(_0xe5b4('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe5b4('0x5'));var Redis=require(_0xe5b4('0x6'));var interaction=require(_0xe5b4('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe5b4('0x8'));var logger=require(_0xe5b4('0x9'))(_0xe5b4('0xa'));var config=require('../../config/environment');var db=require(_0xe5b4('0xb'))['db'];config[_0xe5b4('0xc')]=_[_0xe5b4('0xd')](config[_0xe5b4('0xc')],{'host':_0xe5b4('0xe'),'port':0x18eb});var socket=require(_0xe5b4('0xf'))(new Redis(config[_0xe5b4('0xc')]));require('./whatsappInteraction.socket')[_0xe5b4('0x10')](socket);function respondWithStatusCode(_0x5a1fea,_0x44a2a6){_0x44a2a6=_0x44a2a6||0xcc;return function(_0x154d6e){if(_0x154d6e){return _0x5a1fea[_0xe5b4('0x11')](_0x44a2a6);}return _0x5a1fea[_0xe5b4('0x12')](_0x44a2a6)['end']();};}function respondWithResult(_0x195371,_0x269598){_0x269598=_0x269598||0xc8;return function(_0x2c969f){if(_0x2c969f){return _0x195371[_0xe5b4('0x12')](_0x269598)[_0xe5b4('0x13')](_0x2c969f);}};}function respondWithFilteredResult(_0x11ad53,_0xbcd514){return function(_0x57e873){if(_0x57e873){var _0x412993=typeof _0xbcd514[_0xe5b4('0x14')]===_0xe5b4('0x15')&&typeof _0xbcd514[_0xe5b4('0x16')]==='undefined';var _0x382e6b=_0x57e873['count'];var _0x50d329=_0x412993?0x0:_0xbcd514['offset'];var _0x439917=_0x412993?_0x57e873[_0xe5b4('0x17')]:_0xbcd514[_0xe5b4('0x14')]+_0xbcd514[_0xe5b4('0x16')];var _0x372a89;if(_0x439917>=_0x382e6b){_0x439917=_0x382e6b;_0x372a89=0xc8;}else{_0x372a89=0xce;}_0x11ad53['status'](_0x372a89);return _0x11ad53[_0xe5b4('0x18')](_0xe5b4('0x19'),_0x50d329+'-'+_0x439917+'/'+_0x382e6b)[_0xe5b4('0x13')](_0x57e873);}return null;};}function saveUpdates(_0x17f312){return function(_0x1dbf7f){if(_0x1dbf7f){return _0x1dbf7f[_0xe5b4('0x1a')](_0x17f312)[_0xe5b4('0x1b')](function(_0x54deb4){return _0x54deb4;});}return null;};}function removeEntity(_0xdf49bc){return function(_0x154340){if(_0x154340){return _0x154340[_0xe5b4('0x1c')]()[_0xe5b4('0x1b')](function(){_0xdf49bc['status'](0xcc)[_0xe5b4('0x1d')]();});}};}function handleEntityNotFound(_0x20ede9){return function(_0x40d043){if(!_0x40d043){_0x20ede9[_0xe5b4('0x11')](0x194);}return _0x40d043;};}function handleError(_0x37c940,_0x1cc19e){_0x1cc19e=_0x1cc19e||0x1f4;return function(_0x1a38c1){logger[_0xe5b4('0x1e')](_0x1a38c1['stack']);if(_0x1a38c1['name']){delete _0x1a38c1[_0xe5b4('0x1f')];}_0x37c940[_0xe5b4('0x12')](_0x1cc19e)[_0xe5b4('0x20')](_0x1a38c1);};}exports[_0xe5b4('0x21')]=function(_0x465cb1,_0x2e5a1a){var _0x7eac54={};var _0x7abd47=_['map'](db[_0xe5b4('0x22')][_0xe5b4('0x23')],function(_0x4bf8e4){return{'name':_0x4bf8e4[_0xe5b4('0x24')],'type':_0x4bf8e4[_0xe5b4('0x25')][_0xe5b4('0x26')]};});_0x7eac54=qs[_0xe5b4('0x27')](_0x7abd47,_0x465cb1);return interaction['findAll']('whatsapp',_0x465cb1[_0xe5b4('0x28')],_0x465cb1['user'],_0x7eac54,_0x7abd47)[_0xe5b4('0x1b')](respondWithFilteredResult(_0x2e5a1a,_0x7eac54))[_0xe5b4('0x29')](handleError(_0x2e5a1a,null));};exports['show']=function(_0xcf3dae,_0x4447b0){var _0x5573f9={'raw':![],'where':{'id':_0xcf3dae[_0xe5b4('0x2a')]['id']}},_0x2e0f52={};_0x2e0f52[_0xe5b4('0x2b')]=_[_0xe5b4('0x2c')](db[_0xe5b4('0x22')]['rawAttributes']);_0x2e0f52[_0xe5b4('0x28')]=_['keys'](_0xcf3dae[_0xe5b4('0x28')]);_0x2e0f52[_0xe5b4('0x2d')]=_[_0xe5b4('0x2e')](_0x2e0f52['model'],_0x2e0f52['query']);_0x5573f9['attributes']=_[_0xe5b4('0x2e')](_0x2e0f52[_0xe5b4('0x2b')],qs[_0xe5b4('0x2f')](_0xcf3dae['query'][_0xe5b4('0x2f')]));_0x5573f9[_0xe5b4('0x30')]=_0x5573f9[_0xe5b4('0x30')][_0xe5b4('0x31')]?_0x5573f9[_0xe5b4('0x30')]:_0x2e0f52['model'];if(_0xcf3dae[_0xe5b4('0x28')][_0xe5b4('0x32')]){_0x5573f9[_0xe5b4('0x33')]=[{'all':!![]}];}_0x5573f9=_['merge']({},_0x5573f9,_0xcf3dae[_0xe5b4('0x34')]);return db[_0xe5b4('0x22')][_0xe5b4('0x35')](_0x5573f9)[_0xe5b4('0x1b')](handleEntityNotFound(_0x4447b0,null))['then'](respondWithResult(_0x4447b0,null))['catch'](handleError(_0x4447b0,null));};exports['create']=function(_0x177802,_0x54d54b){return db[_0xe5b4('0x22')][_0xe5b4('0x36')](_0x177802[_0xe5b4('0x37')],{})['then'](respondWithResult(_0x54d54b,0xc9))[_0xe5b4('0x29')](handleError(_0x54d54b,null));};exports['update']=function(_0x2972ed,_0x55f346){if(_0x2972ed[_0xe5b4('0x37')]['id']){delete _0x2972ed[_0xe5b4('0x37')]['id'];}return db[_0xe5b4('0x22')][_0xe5b4('0x35')]({'where':{'id':_0x2972ed[_0xe5b4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x55f346,null))[_0xe5b4('0x1b')](saveUpdates(_0x2972ed[_0xe5b4('0x37')],null))[_0xe5b4('0x1b')](respondWithResult(_0x55f346,null))['catch'](handleError(_0x55f346,null));};exports[_0xe5b4('0x1c')]=function(_0x327898,_0x4d1e21){return db[_0xe5b4('0x22')][_0xe5b4('0x35')]({'where':{'id':_0x327898[_0xe5b4('0x2a')]['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x4d1e21,null))[_0xe5b4('0x1b')](removeEntity(_0x4d1e21,null))[_0xe5b4('0x29')](handleError(_0x4d1e21,null));};exports['describe']=function(_0x33ee94,_0x354e65){return db[_0xe5b4('0x22')][_0xe5b4('0x38')]()['then'](respondWithResult(_0x354e65,null))[_0xe5b4('0x29')](handleError(_0x354e65,null));};exports[_0xe5b4('0x39')]=function(_0x1b6c4f,_0x4176d0){return db[_0xe5b4('0x3a')][_0xe5b4('0x35')]({'where':{'id':_0x1b6c4f[_0xe5b4('0x2a')]['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x4176d0,null))[_0xe5b4('0x1b')](function(_0xb2408c){if(_0xb2408c){return _0xb2408c[_0xe5b4('0x39')](_0x1b6c4f['body']['ids'],_[_0xe5b4('0x3b')](_0x1b6c4f[_0xe5b4('0x37')],[_0xe5b4('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x4176d0,null))[_0xe5b4('0x29')](handleError(_0x4176d0,null));};exports[_0xe5b4('0x3d')]=function(_0x16b3ae,_0x55cb66){var _0x24ab36={'raw':![],'where':{}};var _0x56eb32={};var _0x22f565={'count':0x0,'rows':[]};return db[_0xe5b4('0x22')][_0xe5b4('0x3e')]({'where':{'id':_0x16b3ae['params']['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x55cb66,null))[_0xe5b4('0x1b')](function(_0x165e61){if(_0x165e61){_0x56eb32['model']=_[_0xe5b4('0x2c')](db[_0xe5b4('0x3a')][_0xe5b4('0x23')]);_0x56eb32[_0xe5b4('0x28')]=_[_0xe5b4('0x2c')](_0x16b3ae[_0xe5b4('0x28')]);_0x56eb32[_0xe5b4('0x2d')]=_[_0xe5b4('0x2e')](_0x56eb32[_0xe5b4('0x2b')],_0x56eb32['query']);_0x24ab36[_0xe5b4('0x30')]=_[_0xe5b4('0x2e')](_0x56eb32[_0xe5b4('0x2b')],qs[_0xe5b4('0x2f')](_0x16b3ae[_0xe5b4('0x28')][_0xe5b4('0x2f')]));_0x24ab36[_0xe5b4('0x30')]=_0x24ab36['attributes'][_0xe5b4('0x31')]?_0x24ab36[_0xe5b4('0x30')]:_0x56eb32['model'];if(!_0x16b3ae[_0xe5b4('0x28')]['hasOwnProperty'](_0xe5b4('0x3f'))){_0x24ab36[_0xe5b4('0x16')]=qs[_0xe5b4('0x16')](_0x16b3ae[_0xe5b4('0x28')][_0xe5b4('0x16')]);_0x24ab36[_0xe5b4('0x14')]=qs[_0xe5b4('0x14')](_0x16b3ae['query'][_0xe5b4('0x14')]);}_0x24ab36[_0xe5b4('0x40')]=qs[_0xe5b4('0x41')](_0x16b3ae['query'][_0xe5b4('0x41')]);_0x24ab36[_0xe5b4('0x42')]=qs[_0xe5b4('0x2d')](_[_0xe5b4('0x43')](_0x16b3ae['query'],_0x56eb32[_0xe5b4('0x2d')]));_0x24ab36['where'][_0xe5b4('0x44')]=_0x165e61['id'];if(_0x16b3ae[_0xe5b4('0x28')][_0xe5b4('0x45')]){_0x24ab36[_0xe5b4('0x42')]=_[_0xe5b4('0x46')](_0x24ab36[_0xe5b4('0x42')],{'$or':_[_0xe5b4('0x47')](_0x24ab36[_0xe5b4('0x30')],function(_0x157e5d){var _0x52f831={};_0x52f831[_0x157e5d]={'$like':'%'+_0x16b3ae[_0xe5b4('0x28')]['filter']+'%'};return _0x52f831;})});}if(_0x16b3ae['query'][_0xe5b4('0x48')]){var _0x36d039=_0x16b3ae['query']['$gte']['split'](',');var _0x4cd0c5={};_0x4cd0c5[_0x36d039[0x0]]={'$gte':moment(_0x36d039[0x1])[_0xe5b4('0x49')](_0xe5b4('0x4a'))};_0x24ab36['where']=_[_0xe5b4('0x46')](_0x24ab36['where'],_0x4cd0c5);}_0x24ab36=_[_0xe5b4('0x46')]({},_0x24ab36,_0x16b3ae[_0xe5b4('0x34')]);return db[_0xe5b4('0x3a')][_0xe5b4('0x17')]({'where':_0x24ab36[_0xe5b4('0x42')]})['then'](function(_0xcb2686){_0x22f565['count']=_0xcb2686;if(_0x16b3ae[_0xe5b4('0x28')]['includeAll']){_0x24ab36[_0xe5b4('0x33')]=[{'all':!![]}];}return db[_0xe5b4('0x3a')]['findAll'](_0x24ab36);})['then'](function(_0x403d11){_0x22f565['rows']=_0x403d11;return _0x22f565;});}})[_0xe5b4('0x1b')](respondWithFilteredResult(_0x55cb66,_0x24ab36))[_0xe5b4('0x29')](handleError(_0x55cb66,null));};exports[_0xe5b4('0x4b')]=function(_0x2cce33,_0x4f9535){return db[_0xe5b4('0x22')]['find']({'where':{'id':_0x2cce33[_0xe5b4('0x2a')]['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x4f9535,null))[_0xe5b4('0x1b')](function(_0x36463b){if(_0x36463b){return _0x36463b[_0xe5b4('0x4c')](_0x2cce33[_0xe5b4('0x37')]['ids'],_['omit'](_0x2cce33[_0xe5b4('0x37')],['ids','id'])||{})[_0xe5b4('0x4d')](function(){return db[_0xe5b4('0x4e')][_0xe5b4('0x4f')]({'attributes':['id',_0xe5b4('0x1f'),_0xe5b4('0x50')],'where':{'id':_0x2cce33['body'][_0xe5b4('0x3c')]}});})[_0xe5b4('0x1b')](function(_0x433061){socket[_0xe5b4('0x51')](_0xe5b4('0x52'),{'id':Number(_0x2cce33[_0xe5b4('0x2a')]['id']),'tags':_0x433061||[]});return{'id':Number(_0x2cce33[_0xe5b4('0x2a')]['id']),'tags':_0x433061||[]};});}})[_0xe5b4('0x1b')](respondWithResult(_0x4f9535,null))[_0xe5b4('0x29')](handleError(_0x4f9535,null));};exports[_0xe5b4('0x53')]=function(_0x28e4ff,_0x190446){return db[_0xe5b4('0x22')][_0xe5b4('0x35')]({'where':{'id':_0x28e4ff[_0xe5b4('0x2a')]['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x190446,null))[_0xe5b4('0x1b')](function(_0x356e69){if(_0x356e69){return _0x356e69[_0xe5b4('0x53')](_0x28e4ff[_0xe5b4('0x28')]['ids']);}})[_0xe5b4('0x1b')](respondWithStatusCode(_0x190446,null))[_0xe5b4('0x29')](handleError(_0x190446,null));};exports[_0xe5b4('0x54')]=function(_0x329c51,_0x48429d){var _0x52a19c=moment()[_0xe5b4('0x55')]()[_0xe5b4('0x56')]();var _0x21af6a=path['join'](config[_0xe5b4('0x57')],_0xe5b4('0x58'),_0xe5b4('0x59'),'tmp');var _0x3935ef=path[_0xe5b4('0x5a')](config[_0xe5b4('0x57')],_0xe5b4('0x58'),_0xe5b4('0x59'),_0xe5b4('0x5b'));var _0x249391=path['join'](_0x21af6a,_0x52a19c);var _0x5be73a=util[_0xe5b4('0x49')](_0xe5b4('0x5c'),_0x329c51[_0xe5b4('0x2a')]['id'],_0x52a19c);var _0x951853=path[_0xe5b4('0x5a')](_0x21af6a,_0x5be73a);var _0x5298b4=[];_0x5298b4[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x5e')],'as':'User','attributes':['id',_0xe5b4('0x5f')],'raw':!![]});_0x5298b4[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x60')],'as':'Contact','attributes':['id',_0xe5b4('0x61'),_0xe5b4('0x62')],'raw':!![]});if(_0x329c51[_0xe5b4('0x28')][_0xe5b4('0x5b')]){_0x5298b4[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x63')],'as':_0xe5b4('0x63'),'raw':!![]});}var _0x502c7e=[{'model':db[_0xe5b4('0x3a')],'as':_0xe5b4('0x64'),'attributes':['id','body',_0xe5b4('0x65'),'direction',_0xe5b4('0x66'),_0xe5b4('0x67')],'include':_0x5298b4}];_0x502c7e[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x68')],'as':'Account','attributes':['id',_0xe5b4('0x1f')]});_0x502c7e[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x5e')],'as':_0xe5b4('0x69'),'attributes':['id',_0xe5b4('0x5f')]});return db[_0xe5b4('0x22')]['find']({'where':{'id':_0x329c51[_0xe5b4('0x2a')]['id']},'include':_0x502c7e})[_0xe5b4('0x1b')](handleEntityNotFound(_0x48429d,null))[_0xe5b4('0x1b')](function(_0x37ace2){if(_0x37ace2){var _0x508b70=_0x37ace2[_0xe5b4('0x6a')]({'plain':!![]});fs[_0xe5b4('0x6b')](_0x249391);var _0x2ab09a={'channel':_0xe5b4('0x6c'),'account':_0x508b70[_0xe5b4('0x6d')][_0xe5b4('0x1f')],'agent':_0x508b70[_0xe5b4('0x69')]?_0x508b70[_0xe5b4('0x69')][_0xe5b4('0x5f')]:'N.A.','createdAt':moment(_0x508b70['createdAt'])[_0xe5b4('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe5b4('0x56')](),'closedAt':_0x508b70[_0xe5b4('0x6e')]?moment(_0x508b70[_0xe5b4('0x6f')])[_0xe5b4('0x49')](_0xe5b4('0x4a'))['toString']():'','disposition':_0x508b70[_0xe5b4('0x70')],'messages':_(_0x508b70['Messages'])[_0xe5b4('0x45')]({'secret':![]})[_0xe5b4('0x47')](function(_0x514347){if(_0x514347['Attachment']){var _0x459b6a=path[_0xe5b4('0x5a')](_0x3935ef,_0x514347[_0xe5b4('0x63')][_0xe5b4('0x71')]);if(fs['existsSync'](_0x459b6a)){fs[_0xe5b4('0x72')](_0x459b6a)[_0xe5b4('0x73')](fs['createWriteStream'](path[_0xe5b4('0x5a')](_0x249391,_0x514347[_0xe5b4('0x63')]['basename'])));}}return{'date':moment(_0x514347[_0xe5b4('0x65')])[_0xe5b4('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe5b4('0x56')](),'sender':_0x514347[_0xe5b4('0x74')]===_0xe5b4('0x75')?_0x514347[_0xe5b4('0x5e')]?_0x514347['User'][_0xe5b4('0x5f')]:_0xe5b4('0x76'):_0x514347[_0xe5b4('0x77')][_0xe5b4('0x61')]+(_0x514347[_0xe5b4('0x77')][_0xe5b4('0x62')]?'\x20'+_0x514347[_0xe5b4('0x77')][_0xe5b4('0x62')]:''),'body':_0x514347['Attachment']?_0x514347[_0xe5b4('0x63')][_0xe5b4('0x71')]:_0x514347[_0xe5b4('0x37')],'direction':_0x514347['direction']==='out'?'A':'C','secret':_0x514347[_0xe5b4('0x66')],'read':_0x514347['read'],'attachment':_0x514347[_0xe5b4('0x63')]};})[_0xe5b4('0x78')]()};return ejs[_0xe5b4('0x79')](path[_0xe5b4('0x5a')](config['root'],_0xe5b4('0x58'),_0xe5b4('0x7a'),_0xe5b4('0x7b')),{'interaction':_0x2ab09a})[_0xe5b4('0x1b')](function(_0x1865af){var _0x43749d=path[_0xe5b4('0x5a')](_0x249391,_0xe5b4('0x7c')+_0x508b70['id']+'-'+_0x52a19c+_0xe5b4('0x7d'));var _0x2b8ce4={'path':_0x43749d,'channel':_0xe5b4('0x6c'),'interactionId':_0x508b70['id']};return pdf[_0xe5b4('0x7e')](_0x1865af,_0x2b8ce4);})['then'](function(){return new BPromise(function(_0x340812,_0x3d2639){zipdir(_0x249391,{'saveTo':_0x951853},function(_0x1f2e9c,_0x405f0f){if(_0x1f2e9c)return _0x3d2639(_0x1f2e9c);return _0x340812(_0x405f0f);});})['then'](function(){return new BPromise(function(_0x48c4d3,_0x574800){rimraf(_0x249391,function(_0x5b7e45){if(_0x5b7e45)_0x574800(_0x5b7e45);return _0x48c4d3();});});})['then'](function(){return _0x48429d[_0xe5b4('0x54')](_0x951853,_0x5be73a,function(_0x107d84){if(_0x107d84){console[_0xe5b4('0x7f')](_0xe5b4('0x80'),_0x107d84);}else{fs['unlinkSync'](_0x951853);}});});});}else{return _0x48429d[_0xe5b4('0x11')](0xc8);}})[_0xe5b4('0x29')](handleError(_0x48429d,null));}; \ No newline at end of file +var _0x71a3=['keys','WhatsappInteraction','intersection','attributes','model','fields','length','includeAll','include','merge','options','create','body','find','destroy','WhatsappMessage','addMessage','ids','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','Tag','color','emit','whatsappInteractionTags:save','download','unix','toString','join','root','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','closed','closedAt','existsSync','pipe','createWriteStream','out','System','firstName','lastName','basename','secret','value','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','update','then','error','stack','name','send','index','map','rawAttributes','type','key','findAll','whatsapp','query','user','catch','show','params'];(function(_0x28f632,_0x19c6b5){var _0x1bbfa2=function(_0x403808){while(--_0x403808){_0x28f632['push'](_0x28f632['shift']());}};_0x1bbfa2(++_0x19c6b5);}(_0x71a3,0xd4));var _0x371a=function(_0x23b980,_0x57697f){_0x23b980=_0x23b980-0x0;var _0x475354=_0x71a3[_0x23b980];return _0x475354;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x371a('0x0'));var moment=require(_0x371a('0x1'));var BPromise=require('bluebird');var util=require(_0x371a('0x2'));var path=require('path');var ejs=require(_0x371a('0x3'));var fs=require('fs');var _=require(_0x371a('0x4'));var Redis=require(_0x371a('0x5'));var interaction=require(_0x371a('0x6'));var qs=require(_0x371a('0x7'));var pdf=require(_0x371a('0x8'));var logger=require(_0x371a('0x9'))(_0x371a('0xa'));var config=require('../../config/environment');var db=require(_0x371a('0xb'))['db'];config['redis']=_['defaults'](config[_0x371a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x371a('0xd'))(new Redis(config['redis']));require(_0x371a('0xe'))[_0x371a('0xf')](socket);function respondWithStatusCode(_0x4b1053,_0x140ef8){_0x140ef8=_0x140ef8||0xcc;return function(_0x475f02){if(_0x475f02){return _0x4b1053[_0x371a('0x10')](_0x140ef8);}return _0x4b1053['status'](_0x140ef8)[_0x371a('0x11')]();};}function respondWithResult(_0x56b36c,_0x4ba50d){_0x4ba50d=_0x4ba50d||0xc8;return function(_0x4afb2f){if(_0x4afb2f){return _0x56b36c['status'](_0x4ba50d)[_0x371a('0x12')](_0x4afb2f);}};}function respondWithFilteredResult(_0x13bb89,_0x1d0109){return function(_0x2c8412){if(_0x2c8412){var _0x15ef45=typeof _0x1d0109[_0x371a('0x13')]==='undefined'&&typeof _0x1d0109[_0x371a('0x14')]===_0x371a('0x15');var _0x14d290=_0x2c8412[_0x371a('0x16')];var _0x224252=_0x15ef45?0x0:_0x1d0109[_0x371a('0x13')];var _0x59a4c4=_0x15ef45?_0x2c8412[_0x371a('0x16')]:_0x1d0109[_0x371a('0x13')]+_0x1d0109[_0x371a('0x14')];var _0x10de37;if(_0x59a4c4>=_0x14d290){_0x59a4c4=_0x14d290;_0x10de37=0xc8;}else{_0x10de37=0xce;}_0x13bb89[_0x371a('0x17')](_0x10de37);return _0x13bb89[_0x371a('0x18')](_0x371a('0x19'),_0x224252+'-'+_0x59a4c4+'/'+_0x14d290)['json'](_0x2c8412);}return null;};}function saveUpdates(_0x48acee){return function(_0x2ad3da){if(_0x2ad3da){return _0x2ad3da[_0x371a('0x1a')](_0x48acee)[_0x371a('0x1b')](function(_0x5d7c85){return _0x5d7c85;});}return null;};}function removeEntity(_0x534ba5){return function(_0x18ca74){if(_0x18ca74){return _0x18ca74['destroy']()[_0x371a('0x1b')](function(){_0x534ba5[_0x371a('0x17')](0xcc)[_0x371a('0x11')]();});}};}function handleEntityNotFound(_0x319564){return function(_0x35f633){if(!_0x35f633){_0x319564[_0x371a('0x10')](0x194);}return _0x35f633;};}function handleError(_0xb85239,_0x5ea12e){_0x5ea12e=_0x5ea12e||0x1f4;return function(_0x24e7dd){logger[_0x371a('0x1c')](_0x24e7dd[_0x371a('0x1d')]);if(_0x24e7dd[_0x371a('0x1e')]){delete _0x24e7dd[_0x371a('0x1e')];}_0xb85239['status'](_0x5ea12e)[_0x371a('0x1f')](_0x24e7dd);};}exports[_0x371a('0x20')]=function(_0x184b4d,_0x5b097d){var _0x1be11f={};var _0x2de48=_[_0x371a('0x21')](db['WhatsappInteraction'][_0x371a('0x22')],function(_0x416f62){return{'name':_0x416f62['fieldName'],'type':_0x416f62[_0x371a('0x23')][_0x371a('0x24')]};});_0x1be11f=qs['getOptions'](_0x2de48,_0x184b4d);return interaction[_0x371a('0x25')](_0x371a('0x26'),_0x184b4d[_0x371a('0x27')],_0x184b4d[_0x371a('0x28')],_0x1be11f,_0x2de48)['then'](respondWithFilteredResult(_0x5b097d,_0x1be11f))[_0x371a('0x29')](handleError(_0x5b097d,null));};exports[_0x371a('0x2a')]=function(_0x32c25e,_0x2fce28){var _0xc0449e={'raw':![],'where':{'id':_0x32c25e[_0x371a('0x2b')]['id']}},_0x42d0c0={};_0x42d0c0['model']=_[_0x371a('0x2c')](db[_0x371a('0x2d')][_0x371a('0x22')]);_0x42d0c0[_0x371a('0x27')]=_[_0x371a('0x2c')](_0x32c25e[_0x371a('0x27')]);_0x42d0c0['filters']=_[_0x371a('0x2e')](_0x42d0c0['model'],_0x42d0c0[_0x371a('0x27')]);_0xc0449e[_0x371a('0x2f')]=_[_0x371a('0x2e')](_0x42d0c0[_0x371a('0x30')],qs[_0x371a('0x31')](_0x32c25e[_0x371a('0x27')][_0x371a('0x31')]));_0xc0449e[_0x371a('0x2f')]=_0xc0449e[_0x371a('0x2f')][_0x371a('0x32')]?_0xc0449e['attributes']:_0x42d0c0[_0x371a('0x30')];if(_0x32c25e[_0x371a('0x27')][_0x371a('0x33')]){_0xc0449e[_0x371a('0x34')]=[{'all':!![]}];}_0xc0449e=_[_0x371a('0x35')]({},_0xc0449e,_0x32c25e[_0x371a('0x36')]);return db['WhatsappInteraction']['find'](_0xc0449e)[_0x371a('0x1b')](handleEntityNotFound(_0x2fce28,null))[_0x371a('0x1b')](respondWithResult(_0x2fce28,null))['catch'](handleError(_0x2fce28,null));};exports[_0x371a('0x37')]=function(_0x1d9fc2,_0xf8528d){return db[_0x371a('0x2d')][_0x371a('0x37')](_0x1d9fc2[_0x371a('0x38')],{})[_0x371a('0x1b')](respondWithResult(_0xf8528d,0xc9))[_0x371a('0x29')](handleError(_0xf8528d,null));};exports['update']=function(_0x181d9e,_0x56d78e){if(_0x181d9e['body']['id']){delete _0x181d9e[_0x371a('0x38')]['id'];}return db[_0x371a('0x2d')][_0x371a('0x39')]({'where':{'id':_0x181d9e[_0x371a('0x2b')]['id']}})['then'](handleEntityNotFound(_0x56d78e,null))[_0x371a('0x1b')](saveUpdates(_0x181d9e['body'],null))[_0x371a('0x1b')](respondWithResult(_0x56d78e,null))[_0x371a('0x29')](handleError(_0x56d78e,null));};exports[_0x371a('0x3a')]=function(_0x1076eb,_0x41477b){return db['WhatsappInteraction'][_0x371a('0x39')]({'where':{'id':_0x1076eb[_0x371a('0x2b')]['id']}})[_0x371a('0x1b')](handleEntityNotFound(_0x41477b,null))[_0x371a('0x1b')](removeEntity(_0x41477b,null))['catch'](handleError(_0x41477b,null));};exports['describe']=function(_0x2485e5,_0x112e1f){return db[_0x371a('0x2d')]['describe']()['then'](respondWithResult(_0x112e1f,null))['catch'](handleError(_0x112e1f,null));};exports['addMessage']=function(_0x355ba3,_0x2f044c){return db[_0x371a('0x3b')][_0x371a('0x39')]({'where':{'id':_0x355ba3[_0x371a('0x2b')]['id']}})[_0x371a('0x1b')](handleEntityNotFound(_0x2f044c,null))[_0x371a('0x1b')](function(_0x32f6cf){if(_0x32f6cf){return _0x32f6cf[_0x371a('0x3c')](_0x355ba3['body'][_0x371a('0x3d')],_['omit'](_0x355ba3[_0x371a('0x38')],[_0x371a('0x3d'),'id'])||{});}})[_0x371a('0x1b')](respondWithResult(_0x2f044c,null))[_0x371a('0x29')](handleError(_0x2f044c,null));};exports['getMessages']=function(_0x81e53b,_0x458d59){var _0x455de6={'raw':![],'where':{}};var _0x446f89={};var _0x453744={'count':0x0,'rows':[]};return db[_0x371a('0x2d')][_0x371a('0x3e')]({'where':{'id':_0x81e53b[_0x371a('0x2b')]['id']}})[_0x371a('0x1b')](handleEntityNotFound(_0x458d59,null))[_0x371a('0x1b')](function(_0x5461fc){if(_0x5461fc){_0x446f89[_0x371a('0x30')]=_['keys'](db[_0x371a('0x3b')][_0x371a('0x22')]);_0x446f89[_0x371a('0x27')]=_[_0x371a('0x2c')](_0x81e53b[_0x371a('0x27')]);_0x446f89[_0x371a('0x3f')]=_[_0x371a('0x2e')](_0x446f89[_0x371a('0x30')],_0x446f89[_0x371a('0x27')]);_0x455de6[_0x371a('0x2f')]=_[_0x371a('0x2e')](_0x446f89['model'],qs[_0x371a('0x31')](_0x81e53b[_0x371a('0x27')][_0x371a('0x31')]));_0x455de6[_0x371a('0x2f')]=_0x455de6[_0x371a('0x2f')][_0x371a('0x32')]?_0x455de6['attributes']:_0x446f89[_0x371a('0x30')];if(!_0x81e53b[_0x371a('0x27')][_0x371a('0x40')](_0x371a('0x41'))){_0x455de6['limit']=qs[_0x371a('0x14')](_0x81e53b[_0x371a('0x27')][_0x371a('0x14')]);_0x455de6[_0x371a('0x13')]=qs[_0x371a('0x13')](_0x81e53b[_0x371a('0x27')][_0x371a('0x13')]);}_0x455de6[_0x371a('0x42')]=qs['sort'](_0x81e53b[_0x371a('0x27')][_0x371a('0x43')]);_0x455de6[_0x371a('0x44')]=qs[_0x371a('0x3f')](_[_0x371a('0x45')](_0x81e53b[_0x371a('0x27')],_0x446f89[_0x371a('0x3f')]));_0x455de6['where'][_0x371a('0x46')]=_0x5461fc['id'];if(_0x81e53b['query'][_0x371a('0x47')]){_0x455de6[_0x371a('0x44')]=_[_0x371a('0x35')](_0x455de6[_0x371a('0x44')],{'$or':_[_0x371a('0x21')](_0x455de6[_0x371a('0x2f')],function(_0x2f7b5d){var _0x37127f={};_0x37127f[_0x2f7b5d]={'$like':'%'+_0x81e53b[_0x371a('0x27')][_0x371a('0x47')]+'%'};return _0x37127f;})});}if(_0x81e53b['query'][_0x371a('0x48')]){var _0x3b22dc=_0x81e53b[_0x371a('0x27')][_0x371a('0x48')][_0x371a('0x49')](',');var _0x2b14ea={};_0x2b14ea[_0x3b22dc[0x0]]={'$gte':moment(_0x3b22dc[0x1])[_0x371a('0x4a')](_0x371a('0x4b'))};_0x455de6[_0x371a('0x44')]=_[_0x371a('0x35')](_0x455de6[_0x371a('0x44')],_0x2b14ea);}_0x455de6=_[_0x371a('0x35')]({},_0x455de6,_0x81e53b[_0x371a('0x36')]);return db[_0x371a('0x3b')][_0x371a('0x16')]({'where':_0x455de6[_0x371a('0x44')]})[_0x371a('0x1b')](function(_0x4fe8be){_0x453744[_0x371a('0x16')]=_0x4fe8be;if(_0x81e53b['query']['includeAll']){_0x455de6[_0x371a('0x34')]=[{'all':!![]}];}return db[_0x371a('0x3b')][_0x371a('0x25')](_0x455de6);})['then'](function(_0x5866c1){_0x453744[_0x371a('0x4c')]=_0x5866c1;return _0x453744;});}})[_0x371a('0x1b')](respondWithFilteredResult(_0x458d59,_0x455de6))[_0x371a('0x29')](handleError(_0x458d59,null));};exports[_0x371a('0x4d')]=function(_0x40e675,_0x1198f5){return db['WhatsappInteraction'][_0x371a('0x39')]({'where':{'id':_0x40e675[_0x371a('0x2b')]['id']}})[_0x371a('0x1b')](handleEntityNotFound(_0x1198f5,null))['then'](function(_0x48c5c2){if(_0x48c5c2){return _0x48c5c2[_0x371a('0x4e')](_0x40e675['body'][_0x371a('0x3d')],_[_0x371a('0x4f')](_0x40e675[_0x371a('0x38')],[_0x371a('0x3d'),'id'])||{})['spread'](function(){return db[_0x371a('0x50')][_0x371a('0x25')]({'attributes':['id',_0x371a('0x1e'),_0x371a('0x51')],'where':{'id':_0x40e675[_0x371a('0x38')]['ids']}});})[_0x371a('0x1b')](function(_0xd0f4f){socket[_0x371a('0x52')](_0x371a('0x53'),{'id':Number(_0x40e675[_0x371a('0x2b')]['id']),'tags':_0xd0f4f||[]});return{'id':Number(_0x40e675[_0x371a('0x2b')]['id']),'tags':_0xd0f4f||[]};});}})[_0x371a('0x1b')](respondWithResult(_0x1198f5,null))['catch'](handleError(_0x1198f5,null));};exports['removeTags']=function(_0xbed46d,_0x25235d){return db['WhatsappInteraction'][_0x371a('0x39')]({'where':{'id':_0xbed46d['params']['id']}})[_0x371a('0x1b')](handleEntityNotFound(_0x25235d,null))[_0x371a('0x1b')](function(_0x3b8ece){if(_0x3b8ece){return _0x3b8ece['removeTags'](_0xbed46d[_0x371a('0x27')][_0x371a('0x3d')]);}})[_0x371a('0x1b')](respondWithStatusCode(_0x25235d,null))[_0x371a('0x29')](handleError(_0x25235d,null));};exports[_0x371a('0x54')]=function(_0x508cbf,_0x520592){var _0x5342ee=moment()[_0x371a('0x55')]()[_0x371a('0x56')]();var _0x3314f3=path[_0x371a('0x57')](config[_0x371a('0x58')],'server',_0x371a('0x59'),_0x371a('0x5a'));var _0x3dddbf=path[_0x371a('0x57')](config[_0x371a('0x58')],'server','files',_0x371a('0x5b'));var _0x552018=path[_0x371a('0x57')](_0x3314f3,_0x5342ee);var _0x13e2c0=util['format'](_0x371a('0x5c'),_0x508cbf['params']['id'],_0x5342ee);var _0x237ca2=path[_0x371a('0x57')](_0x3314f3,_0x13e2c0);var _0x94482b=[];_0x94482b[_0x371a('0x5d')]({'model':db[_0x371a('0x5e')],'as':_0x371a('0x5e'),'attributes':['id',_0x371a('0x5f')],'raw':!![]});_0x94482b[_0x371a('0x5d')]({'model':db[_0x371a('0x60')],'as':_0x371a('0x61'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x508cbf[_0x371a('0x27')][_0x371a('0x5b')]){_0x94482b[_0x371a('0x5d')]({'model':db[_0x371a('0x62')],'as':_0x371a('0x62'),'raw':!![]});}var _0x18de40=[{'model':db['WhatsappMessage'],'as':_0x371a('0x63'),'attributes':['id','body',_0x371a('0x64'),_0x371a('0x65'),'secret',_0x371a('0x66')],'include':_0x94482b}];_0x18de40[_0x371a('0x5d')]({'model':db[_0x371a('0x67')],'as':_0x371a('0x68'),'attributes':['id',_0x371a('0x1e')]});_0x18de40[_0x371a('0x5d')]({'model':db[_0x371a('0x5e')],'as':_0x371a('0x69'),'attributes':['id',_0x371a('0x5f')]});return db[_0x371a('0x2d')][_0x371a('0x39')]({'where':{'id':_0x508cbf['params']['id']},'include':_0x18de40})['then'](handleEntityNotFound(_0x520592,null))[_0x371a('0x1b')](function(_0x23ba99){if(_0x23ba99){var _0x523fd4=_0x23ba99['get']({'plain':!![]});fs[_0x371a('0x6a')](_0x552018);var _0x5b154c={'channel':_0x371a('0x6b'),'account':_0x523fd4[_0x371a('0x68')][_0x371a('0x1e')],'agent':_0x523fd4[_0x371a('0x69')]?_0x523fd4[_0x371a('0x69')]['fullname']:_0x371a('0x6c'),'createdAt':moment(_0x523fd4[_0x371a('0x64')])['format'](_0x371a('0x4b'))[_0x371a('0x56')](),'closedAt':_0x523fd4[_0x371a('0x6d')]?moment(_0x523fd4[_0x371a('0x6e')])[_0x371a('0x4a')](_0x371a('0x4b'))['toString']():'','disposition':_0x523fd4['disposition'],'messages':_(_0x523fd4[_0x371a('0x63')])[_0x371a('0x47')]({'secret':![]})[_0x371a('0x21')](function(_0x266708){if(_0x266708['Attachment']){var _0x42240d=path[_0x371a('0x57')](_0x3dddbf,_0x266708[_0x371a('0x62')]['basename']);if(fs[_0x371a('0x6f')](_0x42240d)){fs['createReadStream'](_0x42240d)[_0x371a('0x70')](fs[_0x371a('0x71')](path[_0x371a('0x57')](_0x552018,_0x266708[_0x371a('0x62')]['basename'])));}}return{'date':moment(_0x266708[_0x371a('0x64')])[_0x371a('0x4a')](_0x371a('0x4b'))[_0x371a('0x56')](),'sender':_0x266708[_0x371a('0x65')]===_0x371a('0x72')?_0x266708[_0x371a('0x5e')]?_0x266708['User'][_0x371a('0x5f')]:_0x371a('0x73'):_0x266708[_0x371a('0x61')][_0x371a('0x74')]+(_0x266708['Contact'][_0x371a('0x75')]?'\x20'+_0x266708[_0x371a('0x61')]['lastName']:''),'body':_0x266708['Attachment']?_0x266708['Attachment'][_0x371a('0x76')]:_0x266708[_0x371a('0x38')],'direction':_0x266708[_0x371a('0x65')]==='out'?'A':'C','secret':_0x266708[_0x371a('0x77')],'read':_0x266708[_0x371a('0x66')],'attachment':_0x266708[_0x371a('0x62')]};})[_0x371a('0x78')]()};return ejs['renderFile'](path[_0x371a('0x57')](config[_0x371a('0x58')],_0x371a('0x79'),_0x371a('0x7a'),_0x371a('0x7b')),{'interaction':_0x5b154c})['then'](function(_0x63be8){var _0x482b52=path[_0x371a('0x57')](_0x552018,'transcript-'+_0x523fd4['id']+'-'+_0x5342ee+_0x371a('0x7c'));var _0x55575f={'path':_0x482b52,'channel':_0x371a('0x6b'),'interactionId':_0x523fd4['id']};return pdf[_0x371a('0x7d')](_0x63be8,_0x55575f);})[_0x371a('0x1b')](function(){return new BPromise(function(_0x556611,_0x2008a3){zipdir(_0x552018,{'saveTo':_0x237ca2},function(_0x6c13ac,_0x272c2f){if(_0x6c13ac)return _0x2008a3(_0x6c13ac);return _0x556611(_0x272c2f);});})[_0x371a('0x1b')](function(){return new BPromise(function(_0x52cf47,_0x5cb2c1){rimraf(_0x552018,function(_0x155570){if(_0x155570)_0x5cb2c1(_0x155570);return _0x52cf47();});});})[_0x371a('0x1b')](function(){return _0x520592['download'](_0x237ca2,_0x13e2c0,function(_0x5e1caf){if(_0x5e1caf){console[_0x371a('0x7e')]('err',_0x5e1caf);}else{fs[_0x371a('0x7f')](_0x237ca2);}});});});}else{return _0x520592[_0x371a('0x10')](0xc8);}})['catch'](handleError(_0x520592,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c8eed7f..18d95fb 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 _0x2083=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x34a587,_0x38314d){var _0x31485f=function(_0x128af2){while(--_0x128af2){_0x34a587['push'](_0x34a587['shift']());}};_0x31485f(++_0x38314d);}(_0x2083,0x137));var _0x3208=function(_0x15491c,_0xcb4e47){_0x15491c=_0x15491c-0x0;var _0x23c024=_0x2083[_0x15491c];return _0x23c024;};'use strict';var EventEmitter=require(_0x3208('0x0'));var WhatsappInteraction=require(_0x3208('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x3208('0x1'))['db'][_0x3208('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3208('0x3')](0x0);var events={'afterCreate':_0x3208('0x4'),'afterUpdate':_0x3208('0x5'),'afterDestroy':_0x3208('0x6')};function emitEvent(_0x1535fb){return function(_0x574345,_0x52318e,_0x5c8d7f){_0x574345[_0x3208('0x7')]({'attributes':['id'],'raw':!![]})[_0x3208('0x8')](function(_0x3d4b9d){_0x574345[_0x3208('0x9')]('Users',_0x3d4b9d[_0x3208('0xa')](function(_0x441a64){return{'id':_0x441a64['id']};}));return WhatsappMessage[_0x3208('0xb')]({'where':{'WhatsappInteractionId':_0x574345['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4e3bf7){_0x574345[_0x3208('0x9')](_0x3208('0xc'),_0x4e3bf7[_0x3208('0xd')]);WhatsappInteractionEvents[_0x3208('0xe')](_0x1535fb+':'+_0x574345['id'],_0x574345);WhatsappInteractionEvents['emit'](_0x1535fb,_0x574345);_0x5c8d7f(null);})['catch'](_0x5c8d7f(null));};}for(var e in events){if(events[_0x3208('0xf')](e)){var event=events[e];WhatsappInteraction[_0x3208('0x10')](e,emitEvent(event));}}module[_0x3208('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xb16f=['map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','then','setDataValue'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb16f,0xf6));var _0xfb16=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xb16f[_0x152121];return _0x592a85;};'use strict';var EventEmitter=require(_0xfb16('0x0'));var WhatsappInteraction=require(_0xfb16('0x1'))['db'][_0xfb16('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xfb16('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xfb16('0x4')](0x0);var events={'afterCreate':_0xfb16('0x5'),'afterUpdate':_0xfb16('0x6'),'afterDestroy':'remove'};function emitEvent(_0x21fee8){return function(_0x5317a0,_0x4dadf4,_0x5ed3ef){_0x5317a0['getUsers']({'attributes':['id'],'raw':!![]})[_0xfb16('0x7')](function(_0x4de946){_0x5317a0[_0xfb16('0x8')]('Users',_0x4de946[_0xfb16('0x9')](function(_0x2b9baf){return{'id':_0x2b9baf['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x5317a0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5cdd02){_0x5317a0[_0xfb16('0x8')](_0xfb16('0xa'),_0x5cdd02[_0xfb16('0xb')]);WhatsappInteractionEvents[_0xfb16('0xc')](_0x21fee8+':'+_0x5317a0['id'],_0x5317a0);WhatsappInteractionEvents[_0xfb16('0xc')](_0x21fee8,_0x5317a0);_0x5ed3ef(null);})[_0xfb16('0xd')](_0x5ed3ef(null));};}for(var e in events){if(events[_0xfb16('0xe')](e)){var event=events[e];WhatsappInteraction[_0xfb16('0xf')](e,emitEvent(event));}}module[_0xfb16('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b3536d4..a96a944 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 _0x659c=['exports','define','WhatsappInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','request-promise','path','./whatsappInteraction.attributes'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x659c,0x1aa));var _0xc659=function(_0x2b012b,_0x463e28){_0x2b012b=_0x2b012b-0x0;var _0x32c4cf=_0x659c[_0x2b012b];return _0x32c4cf;};'use strict';var _=require(_0xc659('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc659('0x1'));var moment=require(_0xc659('0x2'));var BPromise=require('bluebird');var rp=require(_0xc659('0x3'));var fs=require('fs');var path=require(_0xc659('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc659('0x5'));module[_0xc659('0x6')]=function(_0x369dc0,_0x312440){return _0x369dc0[_0xc659('0x7')](_0xc659('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51b67f,_0x2cc93d,_0x56885a){if(_0x51b67f['changed']('closed')){_0x51b67f[_0xc659('0x9')]=moment()[_0xc659('0xa')](_0xc659('0xb'));}_0x56885a(null,_0x51b67f);}}});}; \ No newline at end of file +var _0x9648=['request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird'];(function(_0x31ce68,_0x372a84){var _0x102491=function(_0x7ab4e){while(--_0x7ab4e){_0x31ce68['push'](_0x31ce68['shift']());}};_0x102491(++_0x372a84);}(_0x9648,0xa4));var _0x8964=function(_0x2edce4,_0x315299){_0x2edce4=_0x2edce4-0x0;var _0x42ff7d=_0x9648[_0x2edce4];return _0x42ff7d;};'use strict';var _=require(_0x8964('0x0'));var util=require('util');var logger=require(_0x8964('0x1'))('api');var moment=require(_0x8964('0x2'));var BPromise=require(_0x8964('0x3'));var rp=require(_0x8964('0x4'));var fs=require('fs');var path=require(_0x8964('0x5'));var rimraf=require('rimraf');var config=require(_0x8964('0x6'));var attributes=require(_0x8964('0x7'));module[_0x8964('0x8')]=function(_0x2968ef,_0xcf2dbf){return _0x2968ef[_0x8964('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x8964('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11bf9a,_0x4a04b7,_0x3b625c){if(_0x11bf9a['changed'](_0x8964('0xb'))){_0x11bf9a['closedAt']=moment()[_0x8964('0xc')](_0x8964('0xd'));}_0x3b625c(null,_0x11bf9a);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 34cf927..a7364ab 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 _0xca7a=['attributes','limit','AddTagsToWhatsappInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xca7a,0xe1));var _0xaca7=function(_0x53084c,_0x4a10a7){_0x53084c=_0x53084c-0x0;var _0x3725c5=_0xca7a[_0x53084c];return _0x3725c5;};'use strict';var _=require(_0xaca7('0x0'));var util=require(_0xaca7('0x1'));var moment=require(_0xaca7('0x2'));var BPromise=require(_0xaca7('0x3'));var rs=require(_0xaca7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaca7('0x5'))['db'];var utils=require(_0xaca7('0x6'));var logger=require(_0xaca7('0x7'))(_0xaca7('0x8'));var config=require('../../config/environment');var jayson=require(_0xaca7('0x9'));var client=jayson['client'][_0xaca7('0xa')]({'port':0x232a});config['redis']=_[_0xaca7('0xb')](config[_0xaca7('0xc')],{'host':_0xaca7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xaca7('0xe')](socket);function respondWithRpcPromise(_0x414d3d,_0x558037,_0x588cc2){return new BPromise(function(_0x42bdd1,_0x20077a){return client[_0xaca7('0xf')](_0x414d3d,_0x588cc2)[_0xaca7('0x10')](function(_0x22cad8){logger['info'](_0xaca7('0x11'),_0x558037,_0xaca7('0x12'));logger[_0xaca7('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x558037,_0xaca7('0x12'),JSON[_0xaca7('0x14')](_0x22cad8));if(_0x22cad8['error']){if(_0x22cad8[_0xaca7('0x15')][_0xaca7('0x16')]===0x1f4){logger['error'](_0xaca7('0x11'),_0x558037,_0x22cad8['error'][_0xaca7('0x17')]);return _0x20077a(_0x22cad8['error'][_0xaca7('0x17')]);}logger[_0xaca7('0x15')](_0xaca7('0x11'),_0x558037,_0x22cad8[_0xaca7('0x15')][_0xaca7('0x17')]);return _0x42bdd1(_0x22cad8[_0xaca7('0x15')][_0xaca7('0x17')]);}else{logger[_0xaca7('0x18')](_0xaca7('0x11'),_0x558037,'request\x20sent');_0x42bdd1(_0x22cad8[_0xaca7('0x19')][_0xaca7('0x17')]);}})[_0xaca7('0x1a')](function(_0x366ed6){logger[_0xaca7('0x15')](_0xaca7('0x11'),_0x558037,_0x366ed6);_0x20077a(_0x366ed6);});});}exports[_0xaca7('0x1b')]=function(_0x4475ca){var _0x264303=this;return new Promise(function(_0x1f0468,_0x4354b8){return db[_0xaca7('0x1c')][_0xaca7('0x1d')](_0x4475ca['body'],{'raw':_0x4475ca['options']?_0x4475ca[_0xaca7('0x1e')][_0xaca7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4475ca[_0xaca7('0x1e')]?_0x4475ca[_0xaca7('0x1e')][_0xaca7('0x20')]||null:null,'attributes':_0x4475ca[_0xaca7('0x1e')]?_0x4475ca['options'][_0xaca7('0x21')]||null:null,'limit':_0x4475ca[_0xaca7('0x1e')]?_0x4475ca[_0xaca7('0x1e')][_0xaca7('0x22')]||null:null})[_0xaca7('0x10')](function(_0x1d76f5){logger[_0xaca7('0x18')]('UpdateWhatsappInteraction',_0x4475ca);logger[_0xaca7('0x13')](_0xaca7('0x1b'),_0x4475ca,JSON[_0xaca7('0x14')](_0x1d76f5));_0x1f0468(_0x1d76f5);})[_0xaca7('0x1a')](function(_0x4fe95f){logger[_0xaca7('0x15')](_0xaca7('0x1b'),_0x4fe95f[_0xaca7('0x17')],_0x4475ca);_0x4354b8(_0x264303[_0xaca7('0x15')](0x1f4,_0x4fe95f[_0xaca7('0x17')]));});});};exports[_0xaca7('0x23')]=function(_0x22ce74){return new Promise(function(_0x488a01,_0x5197b7){return db[_0xaca7('0x1c')][_0xaca7('0x24')]({'where':_0x22ce74[_0xaca7('0x1e')]?_0x22ce74[_0xaca7('0x1e')][_0xaca7('0x20')]||null:null})[_0xaca7('0x10')](function(_0x1d4252){if(_0x1d4252){return _0x1d4252[_0xaca7('0x25')](_0x22ce74[_0xaca7('0x26')]['ids'],_[_0xaca7('0x27')](_0x22ce74[_0xaca7('0x26')],[_0xaca7('0x28'),'id'])||{});}})[_0xaca7('0x29')](function(_0x9275ef){logger[_0xaca7('0x18')](_0xaca7('0x2a'),_0x22ce74);logger[_0xaca7('0x13')](_0xaca7('0x2a'),_0x22ce74,JSON[_0xaca7('0x14')](_0x9275ef));_0x488a01(_0x9275ef);})['catch'](function(_0x16656d){logger[_0xaca7('0x15')]('AddTags',_0x16656d['message'],_0x22ce74);_0x5197b7(_this[_0xaca7('0x15')](0x1f4,_0x16656d[_0xaca7('0x17')]));});});}; \ No newline at end of file +var _0x3741=['UpdateWhatsappInteraction','WhatsappInteraction','body','options','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x437a86,_0x219ea0){var _0x58d422=function(_0x4cfa5e){while(--_0x4cfa5e){_0x437a86['push'](_0x437a86['shift']());}};_0x58d422(++_0x219ea0);}(_0x3741,0xe0));var _0x1374=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0x3741[_0x5275b8];return _0x568a9b;};'use strict';var _=require(_0x1374('0x0'));var util=require(_0x1374('0x1'));var moment=require(_0x1374('0x2'));var BPromise=require(_0x1374('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1374('0x4'));var db=require(_0x1374('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1374('0x6'));var config=require('../../config/environment');var jayson=require(_0x1374('0x7'));var client=jayson['client'][_0x1374('0x8')]({'port':0x232a});config[_0x1374('0x9')]=_[_0x1374('0xa')](config['redis'],{'host':_0x1374('0xb'),'port':0x18eb});var socket=require(_0x1374('0xc'))(new Redis(config[_0x1374('0x9')]));require(_0x1374('0xd'))[_0x1374('0xe')](socket);function respondWithRpcPromise(_0x2e4804,_0x9edd11,_0x9f6e33){return new BPromise(function(_0x134369,_0x590238){return client[_0x1374('0xf')](_0x2e4804,_0x9f6e33)[_0x1374('0x10')](function(_0x442b3e){logger[_0x1374('0x11')](_0x1374('0x12'),_0x9edd11,_0x1374('0x13'));logger[_0x1374('0x14')](_0x1374('0x15'),_0x9edd11,_0x1374('0x13'),JSON[_0x1374('0x16')](_0x442b3e));if(_0x442b3e['error']){if(_0x442b3e[_0x1374('0x17')][_0x1374('0x18')]===0x1f4){logger[_0x1374('0x17')](_0x1374('0x12'),_0x9edd11,_0x442b3e[_0x1374('0x17')][_0x1374('0x19')]);return _0x590238(_0x442b3e[_0x1374('0x17')][_0x1374('0x19')]);}logger[_0x1374('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x9edd11,_0x442b3e[_0x1374('0x17')]['message']);return _0x134369(_0x442b3e['error'][_0x1374('0x19')]);}else{logger[_0x1374('0x11')](_0x1374('0x12'),_0x9edd11,_0x1374('0x13'));_0x134369(_0x442b3e[_0x1374('0x1a')]['message']);}})[_0x1374('0x1b')](function(_0x7a9f1c){logger[_0x1374('0x17')](_0x1374('0x12'),_0x9edd11,_0x7a9f1c);_0x590238(_0x7a9f1c);});});}exports[_0x1374('0x1c')]=function(_0x3ed2c6){var _0x110332=this;return new Promise(function(_0x1bef7d,_0xe2c7ce){return db[_0x1374('0x1d')]['update'](_0x3ed2c6[_0x1374('0x1e')],{'raw':_0x3ed2c6[_0x1374('0x1f')]?_0x3ed2c6[_0x1374('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ed2c6['options']?_0x3ed2c6['options'][_0x1374('0x20')]||null:null,'attributes':_0x3ed2c6[_0x1374('0x1f')]?_0x3ed2c6[_0x1374('0x1f')][_0x1374('0x21')]||null:null,'limit':_0x3ed2c6['options']?_0x3ed2c6[_0x1374('0x1f')][_0x1374('0x22')]||null:null})['then'](function(_0x52e031){logger[_0x1374('0x11')](_0x1374('0x1c'),_0x3ed2c6);logger[_0x1374('0x14')](_0x1374('0x1c'),_0x3ed2c6,JSON[_0x1374('0x16')](_0x52e031));_0x1bef7d(_0x52e031);})[_0x1374('0x1b')](function(_0x491019){logger[_0x1374('0x17')](_0x1374('0x1c'),_0x491019['message'],_0x3ed2c6);_0xe2c7ce(_0x110332[_0x1374('0x17')](0x1f4,_0x491019['message']));});});};exports[_0x1374('0x23')]=function(_0x1357f1){return new Promise(function(_0x3ebb06,_0x1e721c){return db['WhatsappInteraction'][_0x1374('0x24')]({'where':_0x1357f1[_0x1374('0x1f')]?_0x1357f1[_0x1374('0x1f')]['where']||null:null})[_0x1374('0x10')](function(_0x324b51){if(_0x324b51){return _0x324b51[_0x1374('0x25')](_0x1357f1[_0x1374('0x1e')][_0x1374('0x26')],_[_0x1374('0x27')](_0x1357f1['body'],[_0x1374('0x26'),'id'])||{});}})[_0x1374('0x28')](function(_0x16162e){logger[_0x1374('0x11')]('AddTags',_0x1357f1);logger['debug']('AddTags',_0x1357f1,JSON[_0x1374('0x16')](_0x16162e));_0x3ebb06(_0x16162e);})[_0x1374('0x1b')](function(_0x20ab56){logger[_0x1374('0x17')](_0x1374('0x29'),_0x20ab56[_0x1374('0x19')],_0x1357f1);_0x1e721c(_this[_0x1374('0x17')](0x1f4,_0x20ab56[_0x1374('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ca90fff..8454fc7 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 _0x4aa5=['length','whatsappInteraction:','remove','emit','removeListener','register'];(function(_0x5a8729,_0x5823e7){var _0x22a4cf=function(_0x573df2){while(--_0x573df2){_0x5a8729['push'](_0x5a8729['shift']());}};_0x22a4cf(++_0x5823e7);}(_0x4aa5,0x122));var _0x54aa=function(_0x4d35e9,_0x495e08){_0x4d35e9=_0x4d35e9-0x0;var _0x241a08=_0x4aa5[_0x4d35e9];return _0x241a08;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x54aa('0x0'),'update'];function createListener(_0x65c54f,_0x59fcd6){return function(_0xa45ae2){_0x59fcd6[_0x54aa('0x1')](_0x65c54f,_0xa45ae2);};}function removeListener(_0x2202ed,_0x4718fe){return function(){WhatsappInteractionEvents[_0x54aa('0x2')](_0x2202ed,_0x4718fe);};}exports[_0x54aa('0x3')]=function(_0x531d38){for(var _0x13dd41=0x0,_0x285b1d=events[_0x54aa('0x4')];_0x13dd41<_0x285b1d;_0x13dd41++){var _0x29d4cd=events[_0x13dd41];var _0x1b5236=createListener(_0x54aa('0x5')+_0x29d4cd,_0x531d38);WhatsappInteractionEvents['on'](_0x29d4cd,_0x1b5236);}}; \ No newline at end of file +var _0xb1db=['remove','update','emit','length','./whatsappInteraction.events','save'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb1db,0x1ae));var _0xbb1d=function(_0x3e3c75,_0xdf7296){_0x3e3c75=_0x3e3c75-0x0;var _0x404925=_0xb1db[_0x3e3c75];return _0x404925;};'use strict';var WhatsappInteractionEvents=require(_0xbb1d('0x0'));var events=[_0xbb1d('0x1'),_0xbb1d('0x2'),_0xbb1d('0x3')];function createListener(_0x3e7d4e,_0x8e7775){return function(_0x1082a9){_0x8e7775[_0xbb1d('0x4')](_0x3e7d4e,_0x1082a9);};}function removeListener(_0x467482,_0x8249f5){return function(){WhatsappInteractionEvents['removeListener'](_0x467482,_0x8249f5);};}exports['register']=function(_0x2351ae){for(var _0x1be73a=0x0,_0x408711=events[_0xbb1d('0x5')];_0x1be73a<_0x408711;_0x1be73a++){var _0x537c8a=events[_0x1be73a];var _0x3fb953=createListener('whatsappInteraction:'+_0x537c8a,_0x2351ae);WhatsappInteractionEvents['on'](_0x537c8a,_0x3fb953);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 77798fa..ffecdd0 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 _0x267e=['../../config/environment','./whatsappMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','tracked','whatsapp','create','/:id/status','status','put','update','accept','/:id/reject','destroy','exports','util','path','fs-extra'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x267e,0x8d));var _0xe267=function(_0x89dcf5,_0x3f10ad){_0x89dcf5=_0x89dcf5-0x0;var _0xcaaa63=_0x267e[_0x89dcf5];return _0xcaaa63;};'use strict';var multer=require('multer');var util=require(_0xe267('0x0'));var path=require(_0xe267('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe267('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe267('0x3'));var controller=require(_0xe267('0x4'));router[_0xe267('0x5')]('/',auth['isAuthenticated'](),controller[_0xe267('0x6')]);router['get'](_0xe267('0x7'),auth['isAuthenticated'](),controller[_0xe267('0x8')]);router[_0xe267('0x5')](_0xe267('0x9'),auth[_0xe267('0xa')](),controller[_0xe267('0xb')]);router[_0xe267('0xc')]('/',auth[_0xe267('0xa')](),interaction[_0xe267('0xd')](_0xe267('0xe'),'whatsappmessage:create'),controller[_0xe267('0xf')]);router[_0xe267('0xc')](_0xe267('0x10'),controller[_0xe267('0x11')]);router[_0xe267('0x12')]('/:id',auth[_0xe267('0xa')](),controller[_0xe267('0x13')]);router[_0xe267('0x12')]('/:id/accept',auth[_0xe267('0xa')](),controller[_0xe267('0x14')]);router[_0xe267('0x12')](_0xe267('0x15'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xe267('0x9'),auth[_0xe267('0xa')](),controller[_0xe267('0x16')]);module[_0xe267('0x17')]=router; \ No newline at end of file +var _0xef41=['status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','whatsappmessage:create','create'];(function(_0x56d9a2,_0x2b2e9f){var _0x181e2e=function(_0x4b01ed){while(--_0x4b01ed){_0x56d9a2['push'](_0x56d9a2['shift']());}};_0x181e2e(++_0x2b2e9f);}(_0xef41,0x192));var _0x1ef4=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0xef41[_0xd7b0a4];return _0x184e9e;};'use strict';var multer=require(_0x1ef4('0x0'));var util=require('util');var path=require(_0x1ef4('0x1'));var timeout=require(_0x1ef4('0x2'));var express=require(_0x1ef4('0x3'));var router=express[_0x1ef4('0x4')]();var fs_extra=require(_0x1ef4('0x5'));var auth=require(_0x1ef4('0x6'));var interaction=require(_0x1ef4('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x1ef4('0x8')]('/',auth[_0x1ef4('0x9')](),controller[_0x1ef4('0xa')]);router[_0x1ef4('0x8')](_0x1ef4('0xb'),auth[_0x1ef4('0x9')](),controller[_0x1ef4('0xc')]);router[_0x1ef4('0x8')](_0x1ef4('0xd'),auth[_0x1ef4('0x9')](),controller[_0x1ef4('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x1ef4('0xf')]('whatsapp',_0x1ef4('0x10')),controller[_0x1ef4('0x11')]);router['post']('/:id/status',controller[_0x1ef4('0x12')]);router[_0x1ef4('0x13')](_0x1ef4('0xd'),auth[_0x1ef4('0x9')](),controller[_0x1ef4('0x14')]);router[_0x1ef4('0x13')](_0x1ef4('0x15'),auth['isAuthenticated'](),controller[_0x1ef4('0x16')]);router['put'](_0x1ef4('0x17'),auth[_0x1ef4('0x9')](),controller[_0x1ef4('0x18')]);router[_0x1ef4('0x19')](_0x1ef4('0xd'),auth[_0x1ef4('0x9')](),controller[_0x1ef4('0x1a')]);module[_0x1ef4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9500a4c..6cde4d7 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 _0x5d95=['ENUM','out','STRING','sequelize','exports','medium','BOOLEAN'];(function(_0x43c206,_0x56b5a9){var _0x57319f=function(_0x2b7239){while(--_0x2b7239){_0x43c206['push'](_0x43c206['shift']());}};_0x57319f(++_0x56b5a9);}(_0x5d95,0x161));var _0x55d9=function(_0x2e9bea,_0x5c1f2b){_0x2e9bea=_0x2e9bea-0x0;var _0x1882eb=_0x5d95[_0x2e9bea];return _0x1882eb;};'use strict';var Sequelize=require(_0x55d9('0x0'));module[_0x55d9('0x1')]={'body':{'type':Sequelize['TEXT'](_0x55d9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x55d9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x55d9('0x4')]('in',_0x55d9('0x5')),'defaultValue':_0x55d9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x55d9('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x55d9('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x86e7=['sequelize','exports','TEXT','medium','ENUM','out','STRING','DATE'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x86e7,0x130));var _0x786e=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x86e7[_0x946518];return _0x909b69;};'use strict';var Sequelize=require(_0x786e('0x0'));module[_0x786e('0x1')]={'body':{'type':Sequelize[_0x786e('0x2')](_0x786e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x786e('0x4')]('in',_0x786e('0x5')),'defaultValue':_0x786e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x786e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x786e('0x6')]},'readAt':{'type':Sequelize[_0x786e('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x786e('0x6')]},'providerResponse':{'type':Sequelize[_0x786e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1b43b30..0bc4482 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 _0xdb24=['fullname','internal','format','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','client','http','whatsapp-interactions','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','WhatsappMessage','rawAttributes','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','order','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','accept','whatsapp','acceptMessage','reject','UserId','agent','get','WhatsappInteractionId','interaction','user','role','stringify','null','ContactId','Sequelize','QueryTypes','SELECT','contact','User'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0xdb24,0x153));var _0x4db2=function(_0x131f37,_0x1fdb32){_0x131f37=_0x131f37-0x0;var _0x272809=_0xdb24[_0x131f37];return _0x272809;};'use strict';var util=require('util');var _=require(_0x4db2('0x0'));var Redis=require(_0x4db2('0x1'));var interactionService=require(_0x4db2('0x2'));var qs=require(_0x4db2('0x3'));var logger=require(_0x4db2('0x4'))(_0x4db2('0x5'));var config=require(_0x4db2('0x6'));var db=require(_0x4db2('0x7'))['db'];config['redis']=_['defaults'](config[_0x4db2('0x8')],{'host':_0x4db2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4db2('0x8')]));require(_0x4db2('0xa'))[_0x4db2('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4db2('0xc')][_0x4db2('0xd')]({'port':0x232c});var client9002=jayson[_0x4db2('0xc')][_0x4db2('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x4db2('0xe'));function respondWithRpcPromise(_0xc7e35d,_0x3971e9,_0x3a9c0c,_0xd71079){return new Promise(function(_0x2558d5,_0x4c0e11){var _0x378d7c=_0xd71079||client;return _0x378d7c[_0x4db2('0xf')](_0xc7e35d,_0x3a9c0c)[_0x4db2('0x10')](function(_0x746ac1){logger['info'](_0x4db2('0x11'),_0x3971e9,_0x4db2('0x12'));logger[_0x4db2('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3971e9,_0x4db2('0x12'),JSON['stringify'](_0x746ac1));if(_0x746ac1[_0x4db2('0x14')]){if(_0x746ac1[_0x4db2('0x14')]['code']===0x1f4){logger[_0x4db2('0x14')](_0x4db2('0x11'),_0x3971e9,_0x746ac1['error'][_0x4db2('0x15')]);return _0x4c0e11(_0x746ac1[_0x4db2('0x14')][_0x4db2('0x15')]);}logger[_0x4db2('0x14')](_0x4db2('0x11'),_0x3971e9,_0x746ac1[_0x4db2('0x14')][_0x4db2('0x15')]);return _0x2558d5(_0x746ac1[_0x4db2('0x14')][_0x4db2('0x15')]);}else{logger[_0x4db2('0x16')](_0x4db2('0x11'),_0x3971e9,'request\x20sent');_0x2558d5(_0x746ac1[_0x4db2('0x17')]['message']);}})[_0x4db2('0x18')](function(_0x179e61){logger[_0x4db2('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x3971e9,_0x179e61);_0x4c0e11(_0x179e61);});});}function respondWithResult(_0x223724,_0x5cafe6){_0x5cafe6=_0x5cafe6||0xc8;return function(_0x4f0b93){if(_0x4f0b93){return _0x223724[_0x4db2('0x19')](_0x5cafe6)[_0x4db2('0x1a')](_0x4f0b93);}};}function respondWithFilteredResult(_0x343906,_0x485077){return function(_0xc404fc){if(_0xc404fc){var _0x377b2e=typeof _0x485077[_0x4db2('0x1b')]===_0x4db2('0x1c')&&typeof _0x485077[_0x4db2('0x1d')]===_0x4db2('0x1c');var _0xd44214=_0xc404fc[_0x4db2('0x1e')];var _0x552e34=_0x377b2e?0x0:_0x485077[_0x4db2('0x1b')];var _0x133e82=_0x377b2e?_0xc404fc[_0x4db2('0x1e')]:_0x485077[_0x4db2('0x1b')]+_0x485077[_0x4db2('0x1d')];var _0x58793c;if(_0x133e82>=_0xd44214){_0x133e82=_0xd44214;_0x58793c=0xc8;}else{_0x58793c=0xce;}_0x343906['status'](_0x58793c);return _0x343906[_0x4db2('0x1f')](_0x4db2('0x20'),_0x552e34+'-'+_0x133e82+'/'+_0xd44214)[_0x4db2('0x1a')](_0xc404fc);}return null;};}function saveUpdates(_0x44588f){return function(_0x2fb512){if(_0x2fb512){return _0x2fb512[_0x4db2('0x21')](_0x44588f)[_0x4db2('0x10')](function(_0x2023cf){return _0x2023cf;});}return null;};}function removeEntity(_0x576c7c){return function(_0x130de7){if(_0x130de7){return _0x130de7[_0x4db2('0x22')]()['then'](function(){_0x576c7c[_0x4db2('0x19')](0xcc)[_0x4db2('0x23')]();});}};}function handleEntityNotFound(_0x53fffe){return function(_0x5aea14){if(!_0x5aea14){_0x53fffe[_0x4db2('0x24')](0x194);}return _0x5aea14;};}function handleError(_0x15e114,_0x4e05c1){_0x4e05c1=_0x4e05c1||0x1f4;return function(_0x5d49b1){logger['error'](_0x5d49b1[_0x4db2('0x25')]);if(_0x5d49b1['name']){delete _0x5d49b1[_0x4db2('0x26')];}_0x15e114[_0x4db2('0x19')](_0x4e05c1)[_0x4db2('0x27')](_0x5d49b1);};}exports['index']=function(_0x45d731,_0x3d6be5){var _0xef2edc={},_0x4997a2={},_0x316b67={'count':0x0,'rows':[]};var _0x168db8=_['map'](db[_0x4db2('0x28')][_0x4db2('0x29')],function(_0x4c8b75){return{'name':_0x4c8b75['fieldName'],'type':_0x4c8b75[_0x4db2('0x2a')][_0x4db2('0x2b')]};});_0x4997a2[_0x4db2('0x2c')]=_[_0x4db2('0x2d')](_0x168db8,_0x4db2('0x26'));_0x4997a2['query']=_['keys'](_0x45d731[_0x4db2('0x2e')]);_0x4997a2['filters']=_[_0x4db2('0x2f')](_0x4997a2['model'],_0x4997a2[_0x4db2('0x2e')]);_0xef2edc[_0x4db2('0x30')]=_[_0x4db2('0x2f')](_0x4997a2[_0x4db2('0x2c')],qs[_0x4db2('0x31')](_0x45d731[_0x4db2('0x2e')]['fields']));_0xef2edc['attributes']=_0xef2edc[_0x4db2('0x30')]['length']?_0xef2edc[_0x4db2('0x30')]:_0x4997a2[_0x4db2('0x2c')];if(!_0x45d731[_0x4db2('0x2e')][_0x4db2('0x32')]('nolimit')){_0xef2edc[_0x4db2('0x1d')]=qs[_0x4db2('0x1d')](_0x45d731['query'][_0x4db2('0x1d')]);_0xef2edc[_0x4db2('0x1b')]=qs['offset'](_0x45d731[_0x4db2('0x2e')][_0x4db2('0x1b')]);}_0xef2edc[_0x4db2('0x33')]=qs['sort'](_0x45d731[_0x4db2('0x2e')]['sort']);_0xef2edc['where']=qs[_0x4db2('0x34')](_[_0x4db2('0x35')](_0x45d731[_0x4db2('0x2e')],_0x4997a2[_0x4db2('0x34')]),_0x168db8);if(_0x45d731['query'][_0x4db2('0x36')]){_0xef2edc[_0x4db2('0x37')]=_[_0x4db2('0x38')](_0xef2edc['where'],{'$or':_[_0x4db2('0x2d')](_0x168db8,function(_0x301a28){if(_0x301a28[_0x4db2('0x2a')]!==_0x4db2('0x39')){var _0x251daa={};_0x251daa[_0x301a28[_0x4db2('0x26')]]={'$like':'%'+_0x45d731[_0x4db2('0x2e')][_0x4db2('0x36')]+'%'};return _0x251daa;}})});}_0xef2edc=_[_0x4db2('0x38')]({},_0xef2edc,_0x45d731[_0x4db2('0x3a')]);var _0x3aba82={'where':_0xef2edc['where']};return db[_0x4db2('0x28')][_0x4db2('0x1e')](_0x3aba82)[_0x4db2('0x10')](function(_0x106302){_0x316b67['count']=_0x106302;if(_0x45d731[_0x4db2('0x2e')][_0x4db2('0x3b')]){_0xef2edc[_0x4db2('0x3c')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x4db2('0x3d')](_0xef2edc);})[_0x4db2('0x10')](function(_0x246bc8){_0x316b67[_0x4db2('0x3e')]=_0x246bc8;return _0x316b67;})[_0x4db2('0x10')](respondWithFilteredResult(_0x3d6be5,_0xef2edc))['catch'](handleError(_0x3d6be5,null));};exports[_0x4db2('0x3f')]=function(_0x55bc6a,_0xa5dfb5){var _0x768a13={'raw':!![],'where':{'id':_0x55bc6a[_0x4db2('0x40')]['id']}},_0x425bb2={};_0x425bb2[_0x4db2('0x2c')]=_[_0x4db2('0x41')](db[_0x4db2('0x28')][_0x4db2('0x29')]);_0x425bb2[_0x4db2('0x2e')]=_[_0x4db2('0x41')](_0x55bc6a[_0x4db2('0x2e')]);_0x425bb2[_0x4db2('0x34')]=_[_0x4db2('0x2f')](_0x425bb2['model'],_0x425bb2[_0x4db2('0x2e')]);_0x768a13[_0x4db2('0x30')]=_['intersection'](_0x425bb2[_0x4db2('0x2c')],qs['fields'](_0x55bc6a[_0x4db2('0x2e')][_0x4db2('0x31')]));_0x768a13['attributes']=_0x768a13['attributes']['length']?_0x768a13[_0x4db2('0x30')]:_0x425bb2[_0x4db2('0x2c')];if(_0x55bc6a['query'][_0x4db2('0x3b')]){_0x768a13[_0x4db2('0x3c')]=[{'all':!![]}];}_0x768a13=_[_0x4db2('0x38')]({},_0x768a13,_0x55bc6a[_0x4db2('0x3a')]);return db[_0x4db2('0x28')][_0x4db2('0x42')](_0x768a13)[_0x4db2('0x10')](handleEntityNotFound(_0xa5dfb5,null))['then'](respondWithResult(_0xa5dfb5,null))[_0x4db2('0x18')](handleError(_0xa5dfb5,null));};exports[_0x4db2('0x43')]=function(_0x4ae9e0,_0x5dd573){return db[_0x4db2('0x28')][_0x4db2('0x43')](_0x4ae9e0[_0x4db2('0x44')],{})['then'](respondWithResult(_0x5dd573,0xc9))[_0x4db2('0x18')](handleError(_0x5dd573,null));};exports['update']=function(_0x3fc5b4,_0x4b6f3d){if(_0x3fc5b4[_0x4db2('0x44')]['id']){delete _0x3fc5b4['body']['id'];}return db[_0x4db2('0x28')][_0x4db2('0x42')]({'where':{'id':_0x3fc5b4[_0x4db2('0x40')]['id']}})[_0x4db2('0x10')](handleEntityNotFound(_0x4b6f3d,null))[_0x4db2('0x10')](saveUpdates(_0x3fc5b4['body'],null))[_0x4db2('0x10')](respondWithResult(_0x4b6f3d,null))[_0x4db2('0x18')](handleError(_0x4b6f3d,null));};exports['destroy']=function(_0x2da132,_0x2dc990){return db[_0x4db2('0x28')][_0x4db2('0x42')]({'where':{'id':_0x2da132['params']['id']}})[_0x4db2('0x10')](handleEntityNotFound(_0x2dc990,null))['then'](removeEntity(_0x2dc990,null))[_0x4db2('0x18')](handleError(_0x2dc990,null));};exports[_0x4db2('0x45')]=function(_0x37358f,_0x138c8d){return db[_0x4db2('0x28')][_0x4db2('0x45')]()[_0x4db2('0x10')](respondWithResult(_0x138c8d,null))[_0x4db2('0x18')](handleError(_0x138c8d,null));};exports[_0x4db2('0x46')]=function(_0x1f29ee,_0x54ba1e){var _0x1d88ae=_0x4db2('0x47');return interactionService[_0x4db2('0x48')](_0x1f29ee,_0x1d88ae)[_0x4db2('0x10')](respondWithResult(_0x54ba1e,null))[_0x4db2('0x18')](handleError(_0x54ba1e,null));};exports[_0x4db2('0x49')]=function(_0x1981b9,_0x5913bb){var _0x4fd0b3={'agent':{},'channel':_0x4db2('0x47')};if(_0x1981b9[_0x4db2('0x44')]['id']){delete _0x1981b9['body']['id'];}_0x1981b9['body']['UserId']=_0x1981b9[_0x4db2('0x44')][_0x4db2('0x4a')]||_0x1981b9['user']['id'];_0x4fd0b3[_0x4db2('0x4b')]['id']=_0x1981b9[_0x4db2('0x44')][_0x4db2('0x4a')];return db[_0x4db2('0x28')]['find']({'where':{'id':_0x1981b9[_0x4db2('0x40')]['id'],'UserId':null}})[_0x4db2('0x10')](handleEntityNotFound(_0x5913bb,null))[_0x4db2('0x10')](function(_0x374bde){if(_0x374bde){_0x4fd0b3[_0x4db2('0x15')]=_0x374bde[_0x4db2('0x4c')]({'plain':!![]});return db['WhatsappInteraction'][_0x4db2('0x42')]({'where':{'id':_0x374bde[_0x4db2('0x4d')]}});}return null;})[_0x4db2('0x10')](handleEntityNotFound(_0x5913bb,null))['then'](function(_0x3e1328){if(_0x3e1328){_0x4fd0b3[_0x4db2('0x4e')]=_0x3e1328[_0x4db2('0x4c')]({'plain':!![]});interaction_log[_0x4db2('0x16')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1981b9[_0x4db2('0x4f')]['id'],_0x1981b9[_0x4db2('0x4f')]['name'],_0x1981b9[_0x4db2('0x4f')][_0x4db2('0x50')],_0x4fd0b3[_0x4db2('0x4e')]['id'],_0x1981b9[_0x4db2('0x44')]?JSON[_0x4db2('0x51')](_0x1981b9['body']):_0x4db2('0x52'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4fd0b3);}return null;})['then'](function(_0x27287c){var _0x2ad2e4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x27287c[_0x4db2('0x15')][_0x4db2('0x53')];return db['sequelize'][_0x4db2('0x2e')](_0x2ad2e4,{'type':db[_0x4db2('0x54')][_0x4db2('0x55')][_0x4db2('0x56')],'raw':!![]})[_0x4db2('0x10')](function(_0xc8b14b){return _0xc8b14b;});})[_0x4db2('0x10')](function(_0x224dbf){if(_0x224dbf){_0x4fd0b3[_0x4db2('0x15')][_0x4db2('0x57')]=_0x224dbf[0x0];if(!_0x1981b9[_0x4db2('0x44')]['UserId'])return;return db[_0x4db2('0x58')]['find']({'where':{'id':_0x1981b9[_0x4db2('0x44')][_0x4db2('0x4a')],'role':'agent'},'attributes':['id','name',_0x4db2('0x59'),'email',_0x4db2('0x5a')],'raw':!![]});}return null;})['then'](function(_0x267594){if(!_0x267594)return null;_0x4fd0b3[_0x4db2('0x15')][_0x4db2('0x4b')]=_0x267594;return _0x4fd0b3;})['then'](function(_0x2fa3de){if(_0x2fa3de){_0x2fa3de[_0x4db2('0x15')]['interface']=util[_0x4db2('0x5b')]('SIP/%s',_0x1981b9[_0x4db2('0x4f')][_0x4db2('0x26')]);_0x2fa3de[_0x4db2('0x15')][_0x4db2('0x5c')]=_0x4fd0b3[_0x4db2('0x5c')];_0x2fa3de[_0x4db2('0x15')][_0x4db2('0x5d')]=_0x4fd0b3[_0x4db2('0x5c')];_0x2fa3de[_0x4db2('0x15')][_0x4db2('0x5e')]=_0x4db2('0x49');respondWithRpcPromise(_0x4db2('0x5f'),_0x4db2('0x5f'),{'event':_0x4db2('0x60'),'message':_0x2fa3de[_0x4db2('0x15')]},client9002);return _0x4fd0b3;}return null;})[_0x4db2('0x10')](respondWithResult(_0x5913bb,null))[_0x4db2('0x18')](handleError(_0x5913bb,null));};exports[_0x4db2('0x19')]=function(_0x12d844,_0x5dce0f){if(_0x12d844['body']['id']){delete _0x12d844[_0x4db2('0x44')]['id'];}var _0x3aa5cd;return db[_0x4db2('0x28')][_0x4db2('0x42')]({'where':{'id':_0x12d844['params']['id']}})[_0x4db2('0x10')](handleEntityNotFound(_0x5dce0f,null))['then'](function(_0x340a12){if(_0x340a12){_0x3aa5cd=_0x340a12;return db[_0x4db2('0x61')]['find']({'where':{'id':_0x340a12[_0x4db2('0x62')]}});}})[_0x4db2('0x10')](handleEntityNotFound(_0x5dce0f,null))[_0x4db2('0x10')](function(_0x353de2){if(_0x353de2){logger[_0x4db2('0x13')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x4db2('0x19'),_0x4db2('0x63'),_0x353de2[_0x4db2('0x2a')],util['inspect'](_0x12d844[_0x4db2('0x44')],{'showHidden':![],'depth':null}));switch(_0x353de2[_0x4db2('0x2a')]){case'twilio':if(_0x12d844[_0x4db2('0x44')][_0x4db2('0x64')]&&_0x12d844[_0x4db2('0x44')]['MessageSid']===_0x3aa5cd[_0x4db2('0x65')]&&_0x12d844['body'][_0x4db2('0x66')]&&_0x12d844[_0x4db2('0x44')][_0x4db2('0x66')]===_0x4db2('0x67')){return _0x3aa5cd[_0x4db2('0x21')]({'read':!![]});}else{logger[_0x4db2('0x14')](_0x4db2('0x68'),_0x4db2('0x19'),_0x4db2('0x69'),util[_0x4db2('0x6a')](_0x12d844['body'],{'showHidden':![],'depth':null}));}break;}return _0x3aa5cd;}})[_0x4db2('0x10')](respondWithResult(_0x5dce0f,null))['catch'](handleError(_0x5dce0f,null));}; \ No newline at end of file +var _0xcd40=['json','offset','undefined','count','limit','Content-Range','update','end','sendStatus','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','describe','accept','whatsapp','acceptMessage','reject','UserId','user','agent','get','WhatsappInteraction','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','interface','SIP/%s','motionChannel','channel','EventManager','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status'];(function(_0x1a2b00,_0x49c0d6){var _0x5c3cfb=function(_0x5ecd11){while(--_0x5ecd11){_0x1a2b00['push'](_0x1a2b00['shift']());}};_0x5c3cfb(++_0x49c0d6);}(_0xcd40,0xc8));var _0x0cd4=function(_0x10973c,_0x5a0c6b){_0x10973c=_0x10973c-0x0;var _0x54bbf4=_0xcd40[_0x10973c];return _0x54bbf4;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0x0cd4('0x0'));var interactionService=require(_0x0cd4('0x1'));var qs=require(_0x0cd4('0x2'));var logger=require(_0x0cd4('0x3'))('api');var config=require(_0x0cd4('0x4'));var db=require(_0x0cd4('0x5'))['db'];config[_0x0cd4('0x6')]=_[_0x0cd4('0x7')](config['redis'],{'host':_0x0cd4('0x8'),'port':0x18eb});var socket=require(_0x0cd4('0x9'))(new Redis(config[_0x0cd4('0x6')]));require(_0x0cd4('0xa'))[_0x0cd4('0xb')](socket);var jayson=require(_0x0cd4('0xc'));var client=jayson[_0x0cd4('0xd')][_0x0cd4('0xe')]({'port':0x232c});var client9002=jayson[_0x0cd4('0xd')][_0x0cd4('0xe')]({'port':0x232a});var interaction_log=require(_0x0cd4('0x3'))(_0x0cd4('0xf'));function respondWithRpcPromise(_0x1ff004,_0x40c140,_0x2837ec,_0x4db199){return new Promise(function(_0x18942b,_0x250edb){var _0x371f25=_0x4db199||client;return _0x371f25[_0x0cd4('0x10')](_0x1ff004,_0x2837ec)[_0x0cd4('0x11')](function(_0x1305d6){logger[_0x0cd4('0x12')](_0x0cd4('0x13'),_0x40c140,_0x0cd4('0x14'));logger[_0x0cd4('0x15')](_0x0cd4('0x16'),_0x40c140,'request\x20sent',JSON['stringify'](_0x1305d6));if(_0x1305d6[_0x0cd4('0x17')]){if(_0x1305d6[_0x0cd4('0x17')][_0x0cd4('0x18')]===0x1f4){logger['error'](_0x0cd4('0x13'),_0x40c140,_0x1305d6[_0x0cd4('0x17')][_0x0cd4('0x19')]);return _0x250edb(_0x1305d6[_0x0cd4('0x17')][_0x0cd4('0x19')]);}logger[_0x0cd4('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x40c140,_0x1305d6[_0x0cd4('0x17')][_0x0cd4('0x19')]);return _0x18942b(_0x1305d6['error']['message']);}else{logger[_0x0cd4('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x40c140,_0x0cd4('0x14'));_0x18942b(_0x1305d6['result'][_0x0cd4('0x19')]);}})[_0x0cd4('0x1a')](function(_0x3c6341){logger[_0x0cd4('0x17')](_0x0cd4('0x13'),_0x40c140,_0x3c6341);_0x250edb(_0x3c6341);});});}function respondWithResult(_0x55fc22,_0x3e3f47){_0x3e3f47=_0x3e3f47||0xc8;return function(_0x574773){if(_0x574773){return _0x55fc22[_0x0cd4('0x1b')](_0x3e3f47)[_0x0cd4('0x1c')](_0x574773);}};}function respondWithFilteredResult(_0x1b08f8,_0x30c70c){return function(_0x185c46){if(_0x185c46){var _0xc895ef=typeof _0x30c70c[_0x0cd4('0x1d')]==='undefined'&&typeof _0x30c70c['limit']===_0x0cd4('0x1e');var _0x255df7=_0x185c46[_0x0cd4('0x1f')];var _0x1e180e=_0xc895ef?0x0:_0x30c70c[_0x0cd4('0x1d')];var _0x1f0b94=_0xc895ef?_0x185c46[_0x0cd4('0x1f')]:_0x30c70c[_0x0cd4('0x1d')]+_0x30c70c[_0x0cd4('0x20')];var _0x56d509;if(_0x1f0b94>=_0x255df7){_0x1f0b94=_0x255df7;_0x56d509=0xc8;}else{_0x56d509=0xce;}_0x1b08f8[_0x0cd4('0x1b')](_0x56d509);return _0x1b08f8['set'](_0x0cd4('0x21'),_0x1e180e+'-'+_0x1f0b94+'/'+_0x255df7)[_0x0cd4('0x1c')](_0x185c46);}return null;};}function saveUpdates(_0x40e333){return function(_0x46f95a){if(_0x46f95a){return _0x46f95a[_0x0cd4('0x22')](_0x40e333)[_0x0cd4('0x11')](function(_0x4d722b){return _0x4d722b;});}return null;};}function removeEntity(_0x214cca){return function(_0xabf725){if(_0xabf725){return _0xabf725['destroy']()[_0x0cd4('0x11')](function(){_0x214cca[_0x0cd4('0x1b')](0xcc)[_0x0cd4('0x23')]();});}};}function handleEntityNotFound(_0x3faa8f){return function(_0x486eb4){if(!_0x486eb4){_0x3faa8f[_0x0cd4('0x24')](0x194);}return _0x486eb4;};}function handleError(_0x1ec382,_0x20d745){_0x20d745=_0x20d745||0x1f4;return function(_0x210546){logger['error'](_0x210546[_0x0cd4('0x25')]);if(_0x210546[_0x0cd4('0x26')]){delete _0x210546[_0x0cd4('0x26')];}_0x1ec382['status'](_0x20d745)[_0x0cd4('0x27')](_0x210546);};}exports[_0x0cd4('0x28')]=function(_0x55acd6,_0x4523fd){var _0x2ed093={},_0x189335={},_0x40ebcf={'count':0x0,'rows':[]};var _0x55192c=_['map'](db[_0x0cd4('0x29')][_0x0cd4('0x2a')],function(_0x4c9813){return{'name':_0x4c9813[_0x0cd4('0x2b')],'type':_0x4c9813['type'][_0x0cd4('0x2c')]};});_0x189335[_0x0cd4('0x2d')]=_[_0x0cd4('0x2e')](_0x55192c,'name');_0x189335[_0x0cd4('0x2f')]=_[_0x0cd4('0x30')](_0x55acd6[_0x0cd4('0x2f')]);_0x189335[_0x0cd4('0x31')]=_[_0x0cd4('0x32')](_0x189335[_0x0cd4('0x2d')],_0x189335['query']);_0x2ed093[_0x0cd4('0x33')]=_[_0x0cd4('0x32')](_0x189335[_0x0cd4('0x2d')],qs[_0x0cd4('0x34')](_0x55acd6['query']['fields']));_0x2ed093[_0x0cd4('0x33')]=_0x2ed093[_0x0cd4('0x33')][_0x0cd4('0x35')]?_0x2ed093[_0x0cd4('0x33')]:_0x189335[_0x0cd4('0x2d')];if(!_0x55acd6[_0x0cd4('0x2f')][_0x0cd4('0x36')](_0x0cd4('0x37'))){_0x2ed093[_0x0cd4('0x20')]=qs['limit'](_0x55acd6['query'][_0x0cd4('0x20')]);_0x2ed093[_0x0cd4('0x1d')]=qs[_0x0cd4('0x1d')](_0x55acd6[_0x0cd4('0x2f')][_0x0cd4('0x1d')]);}_0x2ed093[_0x0cd4('0x38')]=qs[_0x0cd4('0x39')](_0x55acd6['query'][_0x0cd4('0x39')]);_0x2ed093[_0x0cd4('0x3a')]=qs[_0x0cd4('0x31')](_[_0x0cd4('0x3b')](_0x55acd6[_0x0cd4('0x2f')],_0x189335[_0x0cd4('0x31')]),_0x55192c);if(_0x55acd6[_0x0cd4('0x2f')][_0x0cd4('0x3c')]){_0x2ed093[_0x0cd4('0x3a')]=_[_0x0cd4('0x3d')](_0x2ed093[_0x0cd4('0x3a')],{'$or':_[_0x0cd4('0x2e')](_0x55192c,function(_0x40fab3){if(_0x40fab3[_0x0cd4('0x3e')]!==_0x0cd4('0x3f')){var _0x2f42d7={};_0x2f42d7[_0x40fab3[_0x0cd4('0x26')]]={'$like':'%'+_0x55acd6['query'][_0x0cd4('0x3c')]+'%'};return _0x2f42d7;}})});}_0x2ed093=_['merge']({},_0x2ed093,_0x55acd6[_0x0cd4('0x40')]);var _0xc7a3f1={'where':_0x2ed093[_0x0cd4('0x3a')]};return db[_0x0cd4('0x29')]['count'](_0xc7a3f1)[_0x0cd4('0x11')](function(_0x2ebbd3){_0x40ebcf[_0x0cd4('0x1f')]=_0x2ebbd3;if(_0x55acd6[_0x0cd4('0x2f')][_0x0cd4('0x41')]){_0x2ed093[_0x0cd4('0x42')]=[{'all':!![]}];}return db[_0x0cd4('0x29')][_0x0cd4('0x43')](_0x2ed093);})[_0x0cd4('0x11')](function(_0x268566){_0x40ebcf[_0x0cd4('0x44')]=_0x268566;return _0x40ebcf;})['then'](respondWithFilteredResult(_0x4523fd,_0x2ed093))[_0x0cd4('0x1a')](handleError(_0x4523fd,null));};exports[_0x0cd4('0x45')]=function(_0x1cf7f6,_0x519fd4){var _0x14996f={'raw':!![],'where':{'id':_0x1cf7f6[_0x0cd4('0x46')]['id']}},_0x594123={};_0x594123[_0x0cd4('0x2d')]=_[_0x0cd4('0x30')](db[_0x0cd4('0x29')]['rawAttributes']);_0x594123[_0x0cd4('0x2f')]=_[_0x0cd4('0x30')](_0x1cf7f6['query']);_0x594123[_0x0cd4('0x31')]=_['intersection'](_0x594123[_0x0cd4('0x2d')],_0x594123[_0x0cd4('0x2f')]);_0x14996f[_0x0cd4('0x33')]=_['intersection'](_0x594123[_0x0cd4('0x2d')],qs[_0x0cd4('0x34')](_0x1cf7f6[_0x0cd4('0x2f')][_0x0cd4('0x34')]));_0x14996f['attributes']=_0x14996f[_0x0cd4('0x33')][_0x0cd4('0x35')]?_0x14996f['attributes']:_0x594123[_0x0cd4('0x2d')];if(_0x1cf7f6[_0x0cd4('0x2f')][_0x0cd4('0x41')]){_0x14996f[_0x0cd4('0x42')]=[{'all':!![]}];}_0x14996f=_['merge']({},_0x14996f,_0x1cf7f6['options']);return db[_0x0cd4('0x29')][_0x0cd4('0x47')](_0x14996f)[_0x0cd4('0x11')](handleEntityNotFound(_0x519fd4,null))[_0x0cd4('0x11')](respondWithResult(_0x519fd4,null))[_0x0cd4('0x1a')](handleError(_0x519fd4,null));};exports[_0x0cd4('0x48')]=function(_0x40944d,_0x4cc88e){return db[_0x0cd4('0x29')][_0x0cd4('0x48')](_0x40944d[_0x0cd4('0x49')],{})[_0x0cd4('0x11')](respondWithResult(_0x4cc88e,0xc9))[_0x0cd4('0x1a')](handleError(_0x4cc88e,null));};exports[_0x0cd4('0x22')]=function(_0x12ac15,_0x4d7891){if(_0x12ac15[_0x0cd4('0x49')]['id']){delete _0x12ac15[_0x0cd4('0x49')]['id'];}return db[_0x0cd4('0x29')]['find']({'where':{'id':_0x12ac15[_0x0cd4('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d7891,null))[_0x0cd4('0x11')](saveUpdates(_0x12ac15['body'],null))[_0x0cd4('0x11')](respondWithResult(_0x4d7891,null))[_0x0cd4('0x1a')](handleError(_0x4d7891,null));};exports[_0x0cd4('0x4a')]=function(_0x3615b5,_0x28c653){return db[_0x0cd4('0x29')]['find']({'where':{'id':_0x3615b5[_0x0cd4('0x46')]['id']}})['then'](handleEntityNotFound(_0x28c653,null))[_0x0cd4('0x11')](removeEntity(_0x28c653,null))[_0x0cd4('0x1a')](handleError(_0x28c653,null));};exports['describe']=function(_0x2da10d,_0x1373af){return db[_0x0cd4('0x29')][_0x0cd4('0x4b')]()[_0x0cd4('0x11')](respondWithResult(_0x1373af,null))[_0x0cd4('0x1a')](handleError(_0x1373af,null));};exports[_0x0cd4('0x4c')]=function(_0x2558be,_0x180149){var _0x1e8a04=_0x0cd4('0x4d');return interactionService[_0x0cd4('0x4e')](_0x2558be,_0x1e8a04)[_0x0cd4('0x11')](respondWithResult(_0x180149,null))['catch'](handleError(_0x180149,null));};exports[_0x0cd4('0x4f')]=function(_0x43c337,_0x23ad0c){var _0x30baad={'agent':{},'channel':_0x0cd4('0x4d')};if(_0x43c337[_0x0cd4('0x49')]['id']){delete _0x43c337[_0x0cd4('0x49')]['id'];}_0x43c337[_0x0cd4('0x49')][_0x0cd4('0x50')]=_0x43c337[_0x0cd4('0x49')][_0x0cd4('0x50')]||_0x43c337[_0x0cd4('0x51')]['id'];_0x30baad[_0x0cd4('0x52')]['id']=_0x43c337['body']['UserId'];return db[_0x0cd4('0x29')]['find']({'where':{'id':_0x43c337[_0x0cd4('0x46')]['id'],'UserId':null}})[_0x0cd4('0x11')](handleEntityNotFound(_0x23ad0c,null))[_0x0cd4('0x11')](function(_0x2930d3){if(_0x2930d3){_0x30baad[_0x0cd4('0x19')]=_0x2930d3[_0x0cd4('0x53')]({'plain':!![]});return db[_0x0cd4('0x54')]['find']({'where':{'id':_0x2930d3['WhatsappInteractionId']}});}return null;})[_0x0cd4('0x11')](handleEntityNotFound(_0x23ad0c,null))[_0x0cd4('0x11')](function(_0x1f3549){if(_0x1f3549){_0x30baad[_0x0cd4('0x55')]=_0x1f3549[_0x0cd4('0x53')]({'plain':!![]});interaction_log[_0x0cd4('0x12')](_0x0cd4('0x56'),_0x43c337[_0x0cd4('0x51')]['id'],_0x43c337[_0x0cd4('0x51')][_0x0cd4('0x26')],_0x43c337['user'][_0x0cd4('0x57')],_0x30baad[_0x0cd4('0x55')]['id'],_0x43c337['body']?JSON[_0x0cd4('0x58')](_0x43c337[_0x0cd4('0x49')]):'null');return respondWithRpcPromise(_0x0cd4('0x59'),_0x0cd4('0x5a'),_0x30baad);}return null;})[_0x0cd4('0x11')](function(_0x505e02){var _0x410e62=_0x0cd4('0x5b')+_0x505e02['message'][_0x0cd4('0x5c')];return db[_0x0cd4('0x5d')][_0x0cd4('0x2f')](_0x410e62,{'type':db[_0x0cd4('0x5e')]['QueryTypes'][_0x0cd4('0x5f')],'raw':!![]})[_0x0cd4('0x11')](function(_0xdbd1b2){return _0xdbd1b2;});})['then'](function(_0x351096){if(_0x351096){_0x30baad['message'][_0x0cd4('0x60')]=_0x351096[0x0];if(!_0x43c337['body'][_0x0cd4('0x50')])return;return db[_0x0cd4('0x61')][_0x0cd4('0x47')]({'where':{'id':_0x43c337[_0x0cd4('0x49')][_0x0cd4('0x50')],'role':'agent'},'attributes':['id',_0x0cd4('0x26'),_0x0cd4('0x62'),_0x0cd4('0x63'),'internal'],'raw':!![]});}return null;})[_0x0cd4('0x11')](function(_0x35f62a){if(!_0x35f62a)return null;_0x30baad['message'][_0x0cd4('0x52')]=_0x35f62a;return _0x30baad;})[_0x0cd4('0x11')](function(_0x3953ee){if(_0x3953ee){_0x3953ee[_0x0cd4('0x19')][_0x0cd4('0x64')]=util['format'](_0x0cd4('0x65'),_0x43c337['user'][_0x0cd4('0x26')]);_0x3953ee['message']['channel']=_0x30baad['channel'];_0x3953ee['message'][_0x0cd4('0x66')]=_0x30baad[_0x0cd4('0x67')];_0x3953ee[_0x0cd4('0x19')]['event']='reject';respondWithRpcPromise(_0x0cd4('0x68'),_0x0cd4('0x68'),{'event':_0x0cd4('0x69'),'message':_0x3953ee[_0x0cd4('0x19')]},client9002);return _0x30baad;}return null;})[_0x0cd4('0x11')](respondWithResult(_0x23ad0c,null))[_0x0cd4('0x1a')](handleError(_0x23ad0c,null));};exports[_0x0cd4('0x1b')]=function(_0x369403,_0x4c68b2){if(_0x369403['body']['id']){delete _0x369403[_0x0cd4('0x49')]['id'];}var _0x2dd403;return db['WhatsappMessage'][_0x0cd4('0x47')]({'where':{'id':_0x369403[_0x0cd4('0x46')]['id']}})[_0x0cd4('0x11')](handleEntityNotFound(_0x4c68b2,null))[_0x0cd4('0x11')](function(_0x1a2151){if(_0x1a2151){_0x2dd403=_0x1a2151;return db['WhatsappAccount']['find']({'where':{'id':_0x1a2151[_0x0cd4('0x6a')]}});}})[_0x0cd4('0x11')](handleEntityNotFound(_0x4c68b2,null))['then'](function(_0x597494){if(_0x597494){logger[_0x0cd4('0x15')](_0x0cd4('0x6b'),_0x0cd4('0x1b'),_0x0cd4('0x6c'),_0x597494[_0x0cd4('0x3e')],util[_0x0cd4('0x6d')](_0x369403[_0x0cd4('0x49')],{'showHidden':![],'depth':null}));switch(_0x597494[_0x0cd4('0x3e')]){case _0x0cd4('0x6e'):if(_0x369403[_0x0cd4('0x49')][_0x0cd4('0x6f')]&&_0x369403[_0x0cd4('0x49')][_0x0cd4('0x6f')]===_0x2dd403['messageId']&&_0x369403[_0x0cd4('0x49')][_0x0cd4('0x70')]&&_0x369403['body'][_0x0cd4('0x70')]==='read'){return _0x2dd403[_0x0cd4('0x22')]({'read':!![]});}else{logger[_0x0cd4('0x17')](_0x0cd4('0x71'),'status','twilio',util[_0x0cd4('0x6d')](_0x369403[_0x0cd4('0x49')],{'showHidden':![],'depth':null}));}break;}return _0x2dd403;}})[_0x0cd4('0x11')](respondWithResult(_0x4c68b2,null))[_0x0cd4('0x1a')](handleError(_0x4c68b2,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c7c5ebb..bb71f13 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 _0x8caf=['remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x4912ca,_0x1345b0){_0x4912ca=_0x4912ca-0x0;var _0x1b8006=_0x8caf[_0x4912ca];return _0x1b8006;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf8ca('0x0'))['db'][_0xf8ca('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf8ca('0x2')](0x0);var events={'afterCreate':_0xf8ca('0x3'),'afterUpdate':_0xf8ca('0x4'),'afterDestroy':_0xf8ca('0x5')};function emitEvent(_0x4e6684){return function(_0x129ca9,_0x23939c,_0x2a9691){WhatsappMessageEvents[_0xf8ca('0x6')](_0x4e6684+':'+_0x129ca9['id'],_0x129ca9);WhatsappMessageEvents[_0xf8ca('0x6')](_0x4e6684,_0x129ca9);_0x2a9691(null);};}for(var e in events){if(events[_0xf8ca('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xf8ca('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x1752=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x1788e0,_0x5cbba7){var _0x4cb790=function(_0x51dc8b){while(--_0x51dc8b){_0x1788e0['push'](_0x1788e0['shift']());}};_0x4cb790(++_0x5cbba7);}(_0x1752,0xa5));var _0x2175=function(_0x3093ba,_0x4bc13d){_0x3093ba=_0x3093ba-0x0;var _0x395741=_0x1752[_0x3093ba];return _0x395741;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x2175('0x0'))['db'][_0x2175('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2175('0x2')](0x0);var events={'afterCreate':_0x2175('0x3'),'afterUpdate':_0x2175('0x4'),'afterDestroy':_0x2175('0x5')};function emitEvent(_0x56c315){return function(_0x1ee277,_0x22c167,_0x12b8d9){WhatsappMessageEvents[_0x2175('0x6')](_0x56c315+':'+_0x1ee277['id'],_0x1ee277);WhatsappMessageEvents[_0x2175('0x6')](_0x56c315,_0x1ee277);_0x12b8d9(null);};}for(var e in events){if(events[_0x2175('0x7')](e)){var event=events[e];WhatsappMessage[_0x2175('0x8')](e,emitEvent(event));}}module[_0x2175('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 940758e..c70c3ba 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 _0xf2cc=['out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','message_id','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','direction','toLowerCase'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xf2cc,0x1a8));var _0xcf2c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf2cc[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xcf2c('0x0'));var util=require('util');var logger=require(_0xcf2c('0x1'))(_0xcf2c('0x2'));var moment=require(_0xcf2c('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf2c('0x4'));var fetch=require(_0xcf2c('0x5'));var fs=require('fs');var path=require(_0xcf2c('0x6'));var rimraf=require(_0xcf2c('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf2c('0x8'));module['exports']=function(_0x9f1849,_0x213bef){return _0x9f1849['define'](_0xcf2c('0x9'),attributes,{'tableName':_0xcf2c('0xa'),'paranoid':![],'indexes':[{'name':_0xcf2c('0xb'),'fields':[_0xcf2c('0xb')]},{'name':_0xcf2c('0xc'),'fields':[_0xcf2c('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x185ccc,_0xc6aab2,_0x21bc44){var _0x4523b0=_0x9f1849['models'];var _0xad20ff=_0x185ccc['get']({'plain':!![]});if(_0xad20ff[_0xcf2c('0xe')][_0xcf2c('0xf')]()==='in'||_0xad20ff[_0xcf2c('0xe')][_0xcf2c('0xf')]()===_0xcf2c('0x10')&&!_0xad20ff[_0xcf2c('0x11')]&&!_[_0xcf2c('0x12')](_0xad20ff[_0xcf2c('0x13')])){_0x4523b0['WhatsappInteraction'][_0xcf2c('0x14')]({'where':{'id':_0xad20ff[_0xcf2c('0x15')]}})[_0xcf2c('0x16')](function(_0x4e0652){if(_0x4e0652){_0x4e0652[_0xcf2c('0x17')]({'lastMsgAt':_0xad20ff[_0xcf2c('0x18')],'lastMsgDirection':_0xad20ff[_0xcf2c('0xe')]['toLowerCase']()});}})[_0xcf2c('0x19')](function(_0x17944d){console[_0xcf2c('0x1a')](_0x17944d);});}if(_0xad20ff[_0xcf2c('0xe')]===_0xcf2c('0x10')&&!_0xad20ff[_0xcf2c('0x11')]){var _0x22ebb7;_0x4523b0[_0xcf2c('0x1b')][_0xcf2c('0x1c')]({'where':{'id':_0xad20ff[_0xcf2c('0x1d')]},'raw':!![]})[_0xcf2c('0x16')](function(_0x12872a){_0x22ebb7=_0x12872a;if(_0x22ebb7&&_0x22ebb7[_0xcf2c('0x1e')]){switch(_0x22ebb7[_0xcf2c('0x1e')]){case _0xcf2c('0x1f'):var _0x195c71=require(_0xcf2c('0x1f'));if(_0x22ebb7[_0xcf2c('0x20')]&&_0x22ebb7[_0xcf2c('0x21')]&&_0x22ebb7[_0xcf2c('0x22')]){var _0x4738a4=new _0x195c71(_0x22ebb7['accountSid'],_0x22ebb7[_0xcf2c('0x21')]);_0x4738a4[_0xcf2c('0x23')][_0xcf2c('0x24')]({'body':_0xad20ff[_0xcf2c('0xd')],'to':_0xcf2c('0x25')+_0xad20ff[_0xcf2c('0x22')],'from':_0xcf2c('0x25')+_0x22ebb7['phone'],'statusCallback':_0x22ebb7[_0xcf2c('0x26')]+_0xcf2c('0x27')+_0xad20ff['id']+'/status?token='+_0x22ebb7['token']})[_0xcf2c('0x16')](function(_0x10c1fc){if(_0x10c1fc[_0xcf2c('0x28')]){return _0x185ccc['update']({'messageId':_0x10c1fc[_0xcf2c('0x28')]});}})[_0xcf2c('0x19')](function(_0x2ec06d){logger[_0xcf2c('0x1a')](_0xcf2c('0x29'),_0xcf2c('0x2a'),'twilio',util['inspect'](_0x2ec06d,{'showHidden':![],'depth':null}));});}else{logger[_0xcf2c('0x1a')](_0xcf2c('0x29'),_0xcf2c('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xcf2c('0x2b'):var _0x4f9cb8=_0x22ebb7[_0xcf2c('0x20')];var _0x936704=_0x22ebb7[_0xcf2c('0x21')];var _0x1d4ae8=_0x22ebb7[_0xcf2c('0x2c')]+_0xcf2c('0x2d')+_0x4f9cb8+_0xcf2c('0x2e');var _0x22978f={'to':[_0xad20ff[_0xcf2c('0x22')]],'message':{'type':'text','text':_0xad20ff[_0xcf2c('0xd')]}};var _0x371b8b={'method':_0xcf2c('0x2f'),'uri':_0x1d4ae8,'headers':{'Authorization':_0xcf2c('0x30')+_0x936704,'Content-Type':'application/json'},'body':_0x22978f,'json':!![]};rp(_0x371b8b)['then'](function(_0x113df0){if(_0x113df0['statuses'][0x0][_0xcf2c('0x31')]){return _0x185ccc[_0xcf2c('0x17')]({'messageId':_0x113df0[_0xcf2c('0x32')][0x0][_0xcf2c('0x31')]});}})[_0xcf2c('0x19')](function(_0x158d94){logger[_0xcf2c('0x33')]('WhatsappMessage,\x20%s',_0x158d94);});break;}}})[_0xcf2c('0x34')](function(){_0x21bc44();});}else{_0x21bc44();}}},'charset':_0xcf2c('0x35'),'collate':_0xcf2c('0x36')});}; \ No newline at end of file +var _0x0178=['WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','createdAt','catch','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','phone','accountSid','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','update','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','finally','utf8mb4','lodash','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','define'];(function(_0xeb4f14,_0x40b0bb){var _0xbdb9ae=function(_0x1ccfe4){while(--_0x1ccfe4){_0xeb4f14['push'](_0xeb4f14['shift']());}};_0xbdb9ae(++_0x40b0bb);}(_0x0178,0x1e6));var _0x8017=function(_0x453209,_0xb138cf){_0x453209=_0x453209-0x0;var _0x5b3d1d=_0x0178[_0x453209];return _0x5b3d1d;};'use strict';var _=require(_0x8017('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8017('0x1'));var moment=require(_0x8017('0x2'));var BPromise=require(_0x8017('0x3'));var rp=require(_0x8017('0x4'));var fetch=require(_0x8017('0x5'));var fs=require('fs');var path=require(_0x8017('0x6'));var rimraf=require('rimraf');var config=require(_0x8017('0x7'));var attributes=require(_0x8017('0x8'));module['exports']=function(_0x4ff3f7,_0x5dab34){return _0x4ff3f7[_0x8017('0x9')](_0x8017('0xa'),attributes,{'tableName':_0x8017('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8017('0xc')]},{'name':_0x8017('0xd'),'fields':[_0x8017('0xe')],'type':_0x8017('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b7be5,_0x19a709,_0x507b95){var _0x574d65=_0x4ff3f7[_0x8017('0x10')];var _0x5beac3=_0x4b7be5[_0x8017('0x11')]({'plain':!![]});if(_0x5beac3[_0x8017('0x12')][_0x8017('0x13')]()==='in'||_0x5beac3[_0x8017('0x12')][_0x8017('0x13')]()===_0x8017('0x14')&&!_0x5beac3['secret']&&!_[_0x8017('0x15')](_0x5beac3[_0x8017('0x16')])){_0x574d65[_0x8017('0x17')]['findOne']({'where':{'id':_0x5beac3[_0x8017('0x18')]}})[_0x8017('0x19')](function(_0x5a21c0){if(_0x5a21c0){_0x5a21c0['update']({'lastMsgAt':_0x5beac3[_0x8017('0x1a')],'lastMsgDirection':_0x5beac3[_0x8017('0x12')][_0x8017('0x13')]()});}})[_0x8017('0x1b')](function(_0xe85267){console['error'](_0xe85267);});}if(_0x5beac3['direction']===_0x8017('0x14')&&!_0x5beac3[_0x8017('0x1c')]){var _0xb90de3;_0x574d65[_0x8017('0x1d')][_0x8017('0x1e')]({'where':{'id':_0x5beac3[_0x8017('0x1f')]},'raw':!![]})[_0x8017('0x19')](function(_0x91d2d6){_0xb90de3=_0x91d2d6;if(_0xb90de3&&_0xb90de3['type']){switch(_0xb90de3[_0x8017('0x20')]){case _0x8017('0x21'):var _0x57fd81=require(_0x8017('0x21'));if(_0xb90de3['accountSid']&&_0xb90de3['authToken']&&_0xb90de3[_0x8017('0x22')]){var _0x5ac156=new _0x57fd81(_0xb90de3[_0x8017('0x23')],_0xb90de3[_0x8017('0x24')]);_0x5ac156[_0x8017('0x25')][_0x8017('0x26')]({'body':_0x5beac3[_0x8017('0xe')],'to':_0x8017('0x27')+_0x5beac3[_0x8017('0x22')],'from':'whatsapp:'+_0xb90de3['phone'],'statusCallback':_0xb90de3[_0x8017('0x28')]+_0x8017('0x29')+_0x5beac3['id']+_0x8017('0x2a')+_0xb90de3[_0x8017('0x2b')]})[_0x8017('0x19')](function(_0x771a83){if(_0x771a83['sid']){return _0x4b7be5[_0x8017('0x2c')]({'messageId':_0x771a83[_0x8017('0x2d')]});}})[_0x8017('0x1b')](function(_0x2a482c){logger[_0x8017('0x2e')](_0x8017('0x2f'),_0x8017('0x30'),_0x8017('0x21'),util[_0x8017('0x31')](_0x2a482c,{'showHidden':![],'depth':null}));});}else{logger[_0x8017('0x2e')](_0x8017('0x2f'),_0x8017('0x30'),_0x8017('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x8017('0x32'):var _0xe4eef0=_0xb90de3[_0x8017('0x23')];var _0x556708=_0xb90de3[_0x8017('0x24')];var _0x185ff5=_0xb90de3[_0x8017('0x33')]+_0x8017('0x34')+_0xe4eef0+_0x8017('0x35');var _0x45c82c={'to':[_0x5beac3[_0x8017('0x22')]],'message':{'type':_0x8017('0x36'),'text':_0x5beac3[_0x8017('0xe')]}};var _0x5ad744={'method':_0x8017('0x37'),'uri':_0x185ff5,'headers':{'Authorization':'Bearer\x20'+_0x556708,'Content-Type':_0x8017('0x38')},'body':_0x45c82c,'json':!![]};rp(_0x5ad744)[_0x8017('0x19')](function(_0x35ec7f){if(_0x35ec7f[_0x8017('0x39')][0x0][_0x8017('0x3a')]){return _0x4b7be5['update']({'messageId':_0x35ec7f[_0x8017('0x39')][0x0][_0x8017('0x3a')]});}})[_0x8017('0x1b')](function(_0x39a716){logger[_0x8017('0x3b')]('WhatsappMessage,\x20%s',_0x39a716);});break;}}})[_0x8017('0x3c')](function(){_0x507b95();});}else{_0x507b95();}}},'charset':_0x8017('0x3d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f65604d..5b7c9a7 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 _0x7778=['ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','WhatsappMessage','create','options','CreateWhatsappMessage','lodash','moment'];(function(_0x4ee949,_0x439a41){var _0x37d68f=function(_0x474369){while(--_0x474369){_0x4ee949['push'](_0x4ee949['shift']());}};_0x37d68f(++_0x439a41);}(_0x7778,0x150));var _0x8777=function(_0x5c224d,_0x17172b){_0x5c224d=_0x5c224d-0x0;var _0x41eea2=_0x7778[_0x5c224d];return _0x41eea2;};'use strict';var _=require(_0x8777('0x0'));var util=require('util');var moment=require(_0x8777('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8777('0x2'));var db=require(_0x8777('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8777('0x4'));var config=require(_0x8777('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8777('0x6')][_0x8777('0x7')]({'port':0x232a});config[_0x8777('0x8')]=_[_0x8777('0x9')](config[_0x8777('0x8')],{'host':_0x8777('0xa'),'port':0x18eb});var socket=require(_0x8777('0xb'))(new Redis(config[_0x8777('0x8')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2bc1ff,_0x5efcae,_0x5daddc){return new BPromise(function(_0x340f1b,_0x46eeeb){return client['request'](_0x2bc1ff,_0x5daddc)[_0x8777('0xc')](function(_0x195ff3){logger[_0x8777('0xd')](_0x8777('0xe'),_0x5efcae,_0x8777('0xf'));logger[_0x8777('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5efcae,'request\x20sent',JSON[_0x8777('0x11')](_0x195ff3));if(_0x195ff3[_0x8777('0x12')]){if(_0x195ff3[_0x8777('0x12')][_0x8777('0x13')]===0x1f4){logger['error'](_0x8777('0xe'),_0x5efcae,_0x195ff3[_0x8777('0x12')][_0x8777('0x14')]);return _0x46eeeb(_0x195ff3[_0x8777('0x12')][_0x8777('0x14')]);}logger[_0x8777('0x12')](_0x8777('0xe'),_0x5efcae,_0x195ff3[_0x8777('0x12')][_0x8777('0x14')]);return _0x340f1b(_0x195ff3[_0x8777('0x12')][_0x8777('0x14')]);}else{logger[_0x8777('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x5efcae,_0x8777('0xf'));_0x340f1b(_0x195ff3['result'][_0x8777('0x14')]);}})[_0x8777('0x15')](function(_0x5157a3){logger[_0x8777('0x12')](_0x8777('0xe'),_0x5efcae,_0x5157a3);_0x46eeeb(_0x5157a3);});});}exports['CreateWhatsappMessage']=function(_0x158f48){var _0x3e56ed=this;return new Promise(function(_0x5c91d7,_0x4601b7){return db[_0x8777('0x16')][_0x8777('0x17')](_0x158f48['body'],{'raw':_0x158f48[_0x8777('0x18')]?_0x158f48['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x479386){logger[_0x8777('0xd')](_0x8777('0x19'),_0x158f48);logger[_0x8777('0x10')]('CreateWhatsappMessage',_0x158f48,JSON[_0x8777('0x11')](_0x479386));_0x5c91d7(_0x479386);})['catch'](function(_0x14ca7b){logger[_0x8777('0x12')]('CreateWhatsappMessage',_0x14ca7b[_0x8777('0x14')],_0x158f48);_0x4601b7(_0x3e56ed[_0x8777('0x12')](0x1f4,_0x14ca7b[_0x8777('0x14')]));});});}; \ No newline at end of file +var _0xc6b3=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','create','body','options','raw','util','moment','bluebird'];(function(_0x1dae99,_0x4207dc){var _0x1cda0c=function(_0x50d809){while(--_0x50d809){_0x1dae99['push'](_0x1dae99['shift']());}};_0x1cda0c(++_0x4207dc);}(_0xc6b3,0x126));var _0x3c6b=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0xc6b3[_0x187d80];return _0x498a77;};'use strict';var _=require('lodash');var util=require(_0x3c6b('0x0'));var moment=require(_0x3c6b('0x1'));var BPromise=require(_0x3c6b('0x2'));var rs=require(_0x3c6b('0x3'));var fs=require('fs');var Redis=require(_0x3c6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c6b('0x5'));var logger=require(_0x3c6b('0x6'))(_0x3c6b('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c6b('0x8'));var client=jayson['client'][_0x3c6b('0x9')]({'port':0x232a});config['redis']=_[_0x3c6b('0xa')](config[_0x3c6b('0xb')],{'host':_0x3c6b('0xc'),'port':0x18eb});var socket=require(_0x3c6b('0xd'))(new Redis(config['redis']));require(_0x3c6b('0xe'))['register'](socket);function respondWithRpcPromise(_0x51632c,_0x5388af,_0x5e15a8){return new BPromise(function(_0x5709d6,_0x6bcc91){return client[_0x3c6b('0xf')](_0x51632c,_0x5e15a8)[_0x3c6b('0x10')](function(_0x2fbfef){logger['info'](_0x3c6b('0x11'),_0x5388af,_0x3c6b('0x12'));logger[_0x3c6b('0x13')](_0x3c6b('0x14'),_0x5388af,_0x3c6b('0x12'),JSON[_0x3c6b('0x15')](_0x2fbfef));if(_0x2fbfef['error']){if(_0x2fbfef[_0x3c6b('0x16')][_0x3c6b('0x17')]===0x1f4){logger[_0x3c6b('0x16')](_0x3c6b('0x11'),_0x5388af,_0x2fbfef[_0x3c6b('0x16')][_0x3c6b('0x18')]);return _0x6bcc91(_0x2fbfef[_0x3c6b('0x16')][_0x3c6b('0x18')]);}logger[_0x3c6b('0x16')](_0x3c6b('0x11'),_0x5388af,_0x2fbfef[_0x3c6b('0x16')]['message']);return _0x5709d6(_0x2fbfef[_0x3c6b('0x16')][_0x3c6b('0x18')]);}else{logger[_0x3c6b('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x5388af,_0x3c6b('0x12'));_0x5709d6(_0x2fbfef[_0x3c6b('0x1a')][_0x3c6b('0x18')]);}})[_0x3c6b('0x1b')](function(_0x34673e){logger[_0x3c6b('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x5388af,_0x34673e);_0x6bcc91(_0x34673e);});});}exports[_0x3c6b('0x1c')]=function(_0x4bb662){var _0x2e269e=this;return new Promise(function(_0x9baa0a,_0x5c1209){return db['WhatsappMessage'][_0x3c6b('0x1d')](_0x4bb662[_0x3c6b('0x1e')],{'raw':_0x4bb662[_0x3c6b('0x1f')]?_0x4bb662[_0x3c6b('0x1f')][_0x3c6b('0x20')]===undefined?!![]:![]:!![]})[_0x3c6b('0x10')](function(_0x3725eb){logger['info'](_0x3c6b('0x1c'),_0x4bb662);logger[_0x3c6b('0x13')]('CreateWhatsappMessage',_0x4bb662,JSON['stringify'](_0x3725eb));_0x9baa0a(_0x3725eb);})['catch'](function(_0x47fe3d){logger['error'](_0x3c6b('0x1c'),_0x47fe3d[_0x3c6b('0x18')],_0x4bb662);_0x5c1209(_0x2e269e[_0x3c6b('0x16')](0x1f4,_0x47fe3d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e486a03..42a7343 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 _0xe032=['./whatsappMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xe032,0x103));var _0x2e03=function(_0x235563,_0x260ece){_0x235563=_0x235563-0x0;var _0x219be0=_0xe032[_0x235563];return _0x219be0;};'use strict';var WhatsappMessageEvents=require(_0x2e03('0x0'));var events=[_0x2e03('0x1'),_0x2e03('0x2'),_0x2e03('0x3')];function createListener(_0x109010,_0x595585){return function(_0x17e1ad){_0x595585[_0x2e03('0x4')](_0x109010,_0x17e1ad);};}function removeListener(_0xe39d37,_0xdc282d){return function(){WhatsappMessageEvents[_0x2e03('0x5')](_0xe39d37,_0xdc282d);};}exports[_0x2e03('0x6')]=function(_0x2ce5ed){for(var _0x47031d=0x0,_0x16c217=events['length'];_0x47031d<_0x16c217;_0x47031d++){var _0x43ca1f=events[_0x47031d];var _0x4c454e=createListener('whatsappMessage:'+_0x43ca1f,_0x2ce5ed);WhatsappMessageEvents['on'](_0x43ca1f,_0x4c454e);}}; \ No newline at end of file +var _0x5d36=['./whatsappMessage.events','save','remove','update','emit','removeListener','length','whatsappMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d36,0x160));var _0x65d3=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0x5d36[_0x5b1c50];return _0x2d379b;};'use strict';var WhatsappMessageEvents=require(_0x65d3('0x0'));var events=[_0x65d3('0x1'),_0x65d3('0x2'),_0x65d3('0x3')];function createListener(_0x3e6af7,_0x2a14b7){return function(_0x5e973a){_0x2a14b7[_0x65d3('0x4')](_0x3e6af7,_0x5e973a);};}function removeListener(_0x4f98ef,_0x5c3222){return function(){WhatsappMessageEvents[_0x65d3('0x5')](_0x4f98ef,_0x5c3222);};}exports['register']=function(_0x13d0ee){for(var _0x35e6b0=0x0,_0x190032=events[_0x65d3('0x6')];_0x35e6b0<_0x190032;_0x35e6b0++){var _0x598697=events[_0x35e6b0];var _0x5997be=createListener(_0x65d3('0x7')+_0x598697,_0x13d0ee);WhatsappMessageEvents['on'](_0x598697,_0x5997be);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e01c0cc..b824090 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 _0x1d63=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','/:id','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x1d63,0xa4));var _0x31d6=function(_0x516a26,_0x51ce24){_0x516a26=_0x516a26-0x0;var _0x3fbde8=_0x1d63[_0x516a26];return _0x3fbde8;};'use strict';var multer=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var path=require(_0x31d6('0x2'));var timeout=require(_0x31d6('0x3'));var express=require(_0x31d6('0x4'));var router=express['Router']();var fs_extra=require(_0x31d6('0x5'));var auth=require(_0x31d6('0x6'));var interaction=require(_0x31d6('0x7'));var config=require(_0x31d6('0x8'));var controller=require(_0x31d6('0x9'));router[_0x31d6('0xa')]('/',auth[_0x31d6('0xb')](),controller['index']);router[_0x31d6('0xa')](_0x31d6('0xc'),auth['isAuthenticated'](),controller[_0x31d6('0xd')]);router[_0x31d6('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x31d6('0xa')](_0x31d6('0xe'),auth[_0x31d6('0xb')](),controller['getMembers']);router[_0x31d6('0xa')](_0x31d6('0xf'),auth[_0x31d6('0xb')](),controller[_0x31d6('0x10')]);router[_0x31d6('0xa')]('/:id/users',auth[_0x31d6('0xb')](),controller[_0x31d6('0x11')]);router[_0x31d6('0x12')]('/',auth[_0x31d6('0xb')](),controller[_0x31d6('0x13')]);router[_0x31d6('0x12')]('/:id/teams',auth[_0x31d6('0xb')](),controller[_0x31d6('0x14')]);router[_0x31d6('0x12')](_0x31d6('0x15'),auth['isAuthenticated'](),controller[_0x31d6('0x16')]);router['put'](_0x31d6('0x17'),auth[_0x31d6('0xb')](),controller[_0x31d6('0x18')]);router[_0x31d6('0x19')](_0x31d6('0x17'),auth[_0x31d6('0xb')](),controller['destroy']);router[_0x31d6('0x19')](_0x31d6('0xf'),auth[_0x31d6('0xb')](),controller[_0x31d6('0x1a')]);router[_0x31d6('0x19')](_0x31d6('0x15'),auth['isAuthenticated'](),controller[_0x31d6('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x49e5=['fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','destroy','/:id/teams','removeTeams','delete','removeAgents','exports','multer','path','Router'];(function(_0x35bad0,_0x21927d){var _0x4fe50f=function(_0x1873df){while(--_0x1873df){_0x35bad0['push'](_0x35bad0['shift']());}};_0x4fe50f(++_0x21927d);}(_0x49e5,0x15c));var _0x549e=function(_0x414d02,_0xf25ab3){_0x414d02=_0x414d02-0x0;var _0x19db72=_0x49e5[_0x414d02];return _0x19db72;};'use strict';var multer=require(_0x549e('0x0'));var util=require('util');var path=require(_0x549e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x549e('0x2')]();var fs_extra=require(_0x549e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x549e('0x4'));var controller=require('./whatsappQueue.controller');router[_0x549e('0x5')]('/',auth[_0x549e('0x6')](),controller[_0x549e('0x7')]);router[_0x549e('0x5')](_0x549e('0x8'),auth[_0x549e('0x6')](),controller[_0x549e('0x9')]);router[_0x549e('0x5')](_0x549e('0xa'),auth[_0x549e('0x6')](),controller[_0x549e('0xb')]);router[_0x549e('0x5')](_0x549e('0xc'),auth[_0x549e('0x6')](),controller['getMembers']);router[_0x549e('0x5')]('/:id/teams',auth['isAuthenticated'](),controller[_0x549e('0xd')]);router[_0x549e('0x5')](_0x549e('0xe'),auth['isAuthenticated'](),controller[_0x549e('0xf')]);router['post']('/',auth[_0x549e('0x6')](),controller[_0x549e('0x10')]);router[_0x549e('0x11')]('/:id/teams',auth[_0x549e('0x6')](),controller[_0x549e('0x12')]);router['post']('/:id/users',auth[_0x549e('0x6')](),controller['addAgents']);router[_0x549e('0x13')](_0x549e('0xa'),auth[_0x549e('0x6')](),controller[_0x549e('0x14')]);router['delete']('/:id',auth[_0x549e('0x6')](),controller[_0x549e('0x15')]);router['delete'](_0x549e('0x16'),auth[_0x549e('0x6')](),controller[_0x549e('0x17')]);router[_0x549e('0x18')](_0x549e('0xe'),auth[_0x549e('0x6')](),controller[_0x549e('0x19')]);module[_0x549e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d0b6c9b..5c1246f 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 _0xaf1d=['STRING','name','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x2cc4cc,_0x365c54){var _0x59b023=function(_0x54e18f){while(--_0x54e18f){_0x2cc4cc['push'](_0x2cc4cc['shift']());}};_0x59b023(++_0x365c54);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x45686b,_0x26d1c9){_0x45686b=_0x45686b-0x0;var _0x35cc00=_0xaf1d[_0x45686b];return _0x35cc00;};'use strict';var Sequelize=require(_0xdaf1('0x0'));module[_0xdaf1('0x1')]={'name':{'type':Sequelize[_0xdaf1('0x2')],'unique':_0xdaf1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdaf1('0x4')](_0xdaf1('0x5'),'beepall',_0xdaf1('0x6'))},'description':{'type':Sequelize[_0xdaf1('0x2')]}}; \ No newline at end of file +var _0xbdeb=['rrmemory','beepall','roundrobin','exports','name','ENUM'];(function(_0x25501d,_0x90e0ce){var _0x277c99=function(_0x353642){while(--_0x353642){_0x25501d['push'](_0x25501d['shift']());}};_0x277c99(++_0x90e0ce);}(_0xbdeb,0x6f));var _0xbbde=function(_0x4a8b72,_0xb54e90){_0x4a8b72=_0x4a8b72-0x0;var _0x217237=_0xbdeb[_0x4a8b72];return _0x217237;};'use strict';var Sequelize=require('sequelize');module[_0xbbde('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbbde('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbbde('0x2')](_0xbbde('0x3'),_0xbbde('0x4'),_0xbbde('0x5'))},'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 97ee1af..a99d45c 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 _0x8571=['../../config/logger','api','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','index','map','type','key','getOptions','where','WhatsappQueue','include','rows','catch','show','params','model','keys','rawAttributes','intersection','query','attributes','fields','length','includeAll','merge','options','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','describe','findOne','filters','hasOwnProperty','sort','pick','WhatsappQueueId','filter','findAll','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','nolimit','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs'];(function(_0x415093,_0x51ef7f){var _0x2857a5=function(_0x5ce372){while(--_0x5ce372){_0x415093['push'](_0x415093['shift']());}};_0x2857a5(++_0x51ef7f);}(_0x8571,0x1e8));var _0x1857=function(_0x23ab06,_0x4b9354){_0x23ab06=_0x23ab06-0x0;var _0x5b6c74=_0x8571[_0x23ab06];return _0x5b6c74;};'use strict';var BPromise=require(_0x1857('0x0'));var util=require('util');var _=require(_0x1857('0x1'));var squel=require(_0x1857('0x2'));var Redis=require('ioredis');var qs=require(_0x1857('0x3'));var logger=require(_0x1857('0x4'))(_0x1857('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1857('0x6')]=_['defaults'](config[_0x1857('0x6')],{'host':_0x1857('0x7'),'port':0x18eb});var socket=require(_0x1857('0x8'))(new Redis(config[_0x1857('0x6')]));require(_0x1857('0x9'))['register'](socket);function respondWithStatusCode(_0x44dd2d,_0x288da0){_0x288da0=_0x288da0||0xcc;return function(_0x108d82){if(_0x108d82){return _0x44dd2d[_0x1857('0xa')](_0x288da0);}return _0x44dd2d[_0x1857('0xb')](_0x288da0)['end']();};}function respondWithResult(_0x627e3a,_0x22331a){_0x22331a=_0x22331a||0xc8;return function(_0x39d51e){if(_0x39d51e){return _0x627e3a['status'](_0x22331a)[_0x1857('0xc')](_0x39d51e);}};}function respondWithFilteredResult(_0x3d04b6,_0x35748a){return function(_0x54bbf5){if(_0x54bbf5){var _0x169af4=typeof _0x35748a['offset']==='undefined'&&typeof _0x35748a[_0x1857('0xd')]===_0x1857('0xe');var _0x486205=_0x54bbf5['count'];var _0xcbbc5d=_0x169af4?0x0:_0x35748a[_0x1857('0xf')];var _0xe71970=_0x169af4?_0x54bbf5[_0x1857('0x10')]:_0x35748a[_0x1857('0xf')]+_0x35748a[_0x1857('0xd')];var _0x5d5123;if(_0xe71970>=_0x486205){_0xe71970=_0x486205;_0x5d5123=0xc8;}else{_0x5d5123=0xce;}_0x3d04b6[_0x1857('0xb')](_0x5d5123);return _0x3d04b6[_0x1857('0x11')](_0x1857('0x12'),_0xcbbc5d+'-'+_0xe71970+'/'+_0x486205)['json'](_0x54bbf5);}return null;};}function saveUpdates(_0xf1e778){return function(_0x555f7f){if(_0x555f7f){return _0x555f7f[_0x1857('0x13')](_0xf1e778)['then'](function(_0x14d50d){return _0x14d50d;});}return null;};}function removeEntity(_0xfec58a){return function(_0x2a56bd){if(_0x2a56bd){return _0x2a56bd[_0x1857('0x14')]()[_0x1857('0x15')](function(){var _0x7952c5=_0x2a56bd[_0x1857('0x16')]({'plain':!![]});var _0x4af836=_0x1857('0x17');return db[_0x1857('0x18')][_0x1857('0x14')]({'where':{'type':_0x4af836,'resourceId':_0x7952c5['id']}})[_0x1857('0x15')](function(){return _0x2a56bd;});})[_0x1857('0x15')](function(){_0xfec58a[_0x1857('0xb')](0xcc)[_0x1857('0x19')]();});}};}function handleEntityNotFound(_0x189c86){return function(_0x2ff933){if(!_0x2ff933){_0x189c86[_0x1857('0xa')](0x194);}return _0x2ff933;};}function handleError(_0x40a2dc,_0x421f78){_0x421f78=_0x421f78||0x1f4;return function(_0x57e769){logger[_0x1857('0x1a')](_0x57e769[_0x1857('0x1b')]);if(_0x57e769[_0x1857('0x1c')]){delete _0x57e769[_0x1857('0x1c')];}_0x40a2dc[_0x1857('0xb')](_0x421f78)[_0x1857('0x1d')](_0x57e769);};}exports[_0x1857('0x1e')]=function(_0x12115d,_0x40bd28){var _0x5f2010={};var _0x233f60={'count':0x0,'rows':[]};var _0x375cca=_[_0x1857('0x1f')](db['WhatsappQueue']['rawAttributes'],function(_0x54ac4e){return{'name':_0x54ac4e['fieldName'],'type':_0x54ac4e[_0x1857('0x20')][_0x1857('0x21')]};});_0x5f2010=qs[_0x1857('0x22')](_0x375cca,_0x12115d);var _0xc2e6dc={'where':_0x5f2010[_0x1857('0x23')]};return db[_0x1857('0x24')][_0x1857('0x10')](_0xc2e6dc)['then'](function(_0x42e31e){_0x233f60[_0x1857('0x10')]=_0x42e31e;_0x5f2010[_0x1857('0x25')]=qs[_0x1857('0x25')](_0x12115d['query']);return db[_0x1857('0x24')]['findAll'](_0x5f2010);})[_0x1857('0x15')](function(_0x1658a5){_0x233f60[_0x1857('0x26')]=_0x1658a5;return _0x233f60;})['then'](respondWithFilteredResult(_0x40bd28,_0x5f2010))[_0x1857('0x27')](handleError(_0x40bd28,null));};exports[_0x1857('0x28')]=function(_0xfacb93,_0x4f8130){var _0x4080e7={'raw':!![],'where':{'id':_0xfacb93[_0x1857('0x29')]['id']}},_0x15f5f4={};_0x15f5f4[_0x1857('0x2a')]=_[_0x1857('0x2b')](db['WhatsappQueue'][_0x1857('0x2c')]);_0x15f5f4['query']=_[_0x1857('0x2b')](_0xfacb93['query']);_0x15f5f4['filters']=_[_0x1857('0x2d')](_0x15f5f4[_0x1857('0x2a')],_0x15f5f4[_0x1857('0x2e')]);_0x4080e7[_0x1857('0x2f')]=_[_0x1857('0x2d')](_0x15f5f4['model'],qs['fields'](_0xfacb93['query'][_0x1857('0x30')]));_0x4080e7[_0x1857('0x2f')]=_0x4080e7['attributes'][_0x1857('0x31')]?_0x4080e7[_0x1857('0x2f')]:_0x15f5f4[_0x1857('0x2a')];if(_0xfacb93[_0x1857('0x2e')][_0x1857('0x32')]){_0x4080e7[_0x1857('0x25')]=[{'all':!![]}];}_0x4080e7=_[_0x1857('0x33')]({},_0x4080e7,_0xfacb93[_0x1857('0x34')]);return db['WhatsappQueue'][_0x1857('0x35')](_0x4080e7)[_0x1857('0x15')](handleEntityNotFound(_0x4f8130,null))['then'](respondWithResult(_0x4f8130,null))['catch'](handleError(_0x4f8130,null));};exports['create']=function(_0x1f3b7a,_0x580353){return db[_0x1857('0x24')]['create'](_0x1f3b7a[_0x1857('0x36')],{})[_0x1857('0x15')](function(_0x2fc8e3){var _0x57f346=_0x1f3b7a[_0x1857('0x37')][_0x1857('0x16')]({'plain':!![]});if(!_0x57f346)throw new Error(_0x1857('0x38'));if(_0x57f346[_0x1857('0x39')]===_0x1857('0x37')){var _0x58b6c5=_0x2fc8e3[_0x1857('0x16')]({'plain':!![]});var _0x1e75b5=_0x1857('0x17');return db[_0x1857('0x3a')]['find']({'where':{'name':_0x1e75b5,'userProfileId':_0x57f346[_0x1857('0x3b')]},'raw':!![]})[_0x1857('0x15')](function(_0x122c99){if(_0x122c99&&_0x122c99[_0x1857('0x3c')]===0x0){return db[_0x1857('0x18')][_0x1857('0x3d')]({'name':_0x58b6c5[_0x1857('0x1c')],'resourceId':_0x58b6c5['id'],'type':_0x122c99['name'],'sectionId':_0x122c99['id']},{})[_0x1857('0x15')](function(){return _0x2fc8e3;});}else{return _0x2fc8e3;}})[_0x1857('0x27')](function(_0x1b079c){logger[_0x1857('0x1a')](_0x1857('0x3e'),_0x1b079c);throw _0x1b079c;});}return _0x2fc8e3;})[_0x1857('0x15')](respondWithResult(_0x580353,0xc9))[_0x1857('0x27')](handleError(_0x580353,null));};exports[_0x1857('0x13')]=function(_0x2695d3,_0x2ba64c){if(_0x2695d3[_0x1857('0x36')]['id']){delete _0x2695d3['body']['id'];}return db[_0x1857('0x24')]['find']({'where':{'id':_0x2695d3[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x2ba64c,null))[_0x1857('0x15')](saveUpdates(_0x2695d3[_0x1857('0x36')],null))[_0x1857('0x15')](respondWithResult(_0x2ba64c,null))[_0x1857('0x27')](handleError(_0x2ba64c,null));};exports[_0x1857('0x14')]=function(_0x48b884,_0x16695d){return db['WhatsappQueue'][_0x1857('0x35')]({'where':{'id':_0x48b884[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x16695d,null))['then'](removeEntity(_0x16695d,null))[_0x1857('0x27')](handleError(_0x16695d,null));};exports['describe']=function(_0x596fad,_0x25edf9){return db[_0x1857('0x24')][_0x1857('0x3f')]()[_0x1857('0x15')](respondWithResult(_0x25edf9,null))[_0x1857('0x27')](handleError(_0x25edf9,null));};exports['getMembers']=function(_0x263022,_0xf7e33){var _0x355d87={'raw':!![],'where':{}},_0x65bccc={},_0x4a7fcc;return db[_0x1857('0x24')][_0x1857('0x40')]({'where':{'id':_0x263022[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0xf7e33,null))[_0x1857('0x15')](function(_0x177265){if(_0x177265){_0x4a7fcc=_0x177265[_0x1857('0x16')]({'plain':!![]});_0x65bccc[_0x1857('0x2a')]=_[_0x1857('0x2b')](db['UserWhatsappQueue'][_0x1857('0x2c')]);_0x65bccc[_0x1857('0x2e')]=_['keys'](_0x263022[_0x1857('0x2e')]);_0x65bccc[_0x1857('0x41')]=_[_0x1857('0x2d')](_0x65bccc['model'],_0x65bccc[_0x1857('0x2e')]);_0x355d87[_0x1857('0x2f')]=_[_0x1857('0x2d')](_0x65bccc[_0x1857('0x2a')],qs[_0x1857('0x30')](_0x263022[_0x1857('0x2e')][_0x1857('0x30')]));_0x355d87[_0x1857('0x2f')]=_0x355d87[_0x1857('0x2f')]['length']?_0x355d87[_0x1857('0x2f')]:_0x65bccc[_0x1857('0x2a')];if(!_0x263022['query'][_0x1857('0x42')]('nolimit')){_0x355d87[_0x1857('0xd')]=qs[_0x1857('0xd')](_0x263022['query'][_0x1857('0xd')]);_0x355d87['offset']=qs[_0x1857('0xf')](_0x263022[_0x1857('0x2e')]['offset']);}_0x355d87['order']=qs['sort'](_0x263022[_0x1857('0x2e')][_0x1857('0x43')]);_0x355d87['where']=qs['filters'](_[_0x1857('0x44')](_0x263022[_0x1857('0x2e')],_0x65bccc['filters']));_0x355d87[_0x1857('0x23')][_0x1857('0x45')]=_0x177265['id'];if(_0x263022[_0x1857('0x2e')][_0x1857('0x46')]){_0x355d87[_0x1857('0x23')]=_['merge'](_0x355d87[_0x1857('0x23')],{'$or':_['map'](_0x355d87[_0x1857('0x2f')],function(_0x1fead7){var _0x142da9={};_0x142da9[_0x1fead7]={'$like':'%'+_0x263022[_0x1857('0x2e')][_0x1857('0x46')]+'%'};return _0x142da9;})});}_0x355d87=_[_0x1857('0x33')]({},_0x355d87,_0x263022[_0x1857('0x34')]);return db['UserWhatsappQueue'][_0x1857('0x47')](_0x355d87);}})[_0x1857('0x15')](function(_0xe66fe5){if(_0xe66fe5){return db[_0x1857('0x48')][_0x1857('0x49')]({'where':{'id':_[_0x1857('0x1f')](_0xe66fe5,'UserId'),'role':_0x1857('0x4a')},'attributes':['id',_0x1857('0x1c'),_0x1857('0x4b'),_0x1857('0x4c'),_0x1857('0x4d')]});}})[_0x1857('0x15')](function(_0x4b26d5){if(_0x4b26d5){return{'count':_0x4b26d5[_0x1857('0x10')],'rows':_[_0x1857('0x1f')](_0x4b26d5['rows'],function(_0x30e3a0){return{'membername':_0x30e3a0[_0x1857('0x1c')],'UserId':_0x30e3a0['id'],'queue_name':_0x4a7fcc[_0x1857('0x1c')],'WhatsappQueueId':_0x4a7fcc['id'],'interface':util[_0x1857('0x4e')](_0x1857('0x4f'),_0x1857('0x50'),_0x30e3a0[_0x1857('0x1c')]),'penalty':0x0,'paused':_0x30e3a0[_0x1857('0x4b')],'createdAt':_0x30e3a0[_0x1857('0x4d')],'updatedAt':_0x30e3a0[_0x1857('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1857('0x15')](respondWithFilteredResult(_0xf7e33,_0x355d87))[_0x1857('0x27')](handleError(_0xf7e33,null));};exports[_0x1857('0x51')]=function(_0x5f23e6,_0x3ea124){var _0x51036e={};var _0x265030={};var _0x12e39b;var _0x307421;return db[_0x1857('0x24')][_0x1857('0x40')]({'where':{'id':_0x5f23e6[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x3ea124,null))[_0x1857('0x15')](function(_0xee3cc2){if(_0xee3cc2){_0x12e39b=_0xee3cc2;_0x265030['model']=_['keys'](db[_0x1857('0x52')][_0x1857('0x2c')]);_0x265030[_0x1857('0x2e')]=_['keys'](_0x5f23e6[_0x1857('0x2e')]);_0x265030[_0x1857('0x41')]=_[_0x1857('0x2d')](_0x265030['model'],_0x265030['query']);_0x51036e[_0x1857('0x2f')]=_[_0x1857('0x2d')](_0x265030[_0x1857('0x2a')],qs['fields'](_0x5f23e6['query'][_0x1857('0x30')]));_0x51036e[_0x1857('0x2f')]=_0x51036e[_0x1857('0x2f')]['length']?_0x51036e[_0x1857('0x2f')]:_0x265030['model'];_0x51036e[_0x1857('0x53')]=qs[_0x1857('0x43')](_0x5f23e6[_0x1857('0x2e')][_0x1857('0x43')]);_0x51036e[_0x1857('0x23')]=qs[_0x1857('0x41')](_['pick'](_0x5f23e6[_0x1857('0x2e')],_0x265030[_0x1857('0x41')]));if(_0x5f23e6[_0x1857('0x2e')][_0x1857('0x46')]){_0x51036e[_0x1857('0x23')]=_[_0x1857('0x33')](_0x51036e[_0x1857('0x23')],{'$or':_['map'](_0x51036e[_0x1857('0x2f')],function(_0x1dc990){var _0x49db03={};_0x49db03[_0x1dc990]={'$like':'%'+_0x5f23e6[_0x1857('0x2e')]['filter']+'%'};return _0x49db03;})});}_0x51036e=_[_0x1857('0x33')]({},_0x51036e,_0x5f23e6[_0x1857('0x34')]);return _0x12e39b[_0x1857('0x51')](_0x51036e);}})[_0x1857('0x15')](function(_0x43df9b){if(_0x43df9b){_0x307421=_0x43df9b['length'];if(!_0x5f23e6[_0x1857('0x2e')][_0x1857('0x42')](_0x1857('0x54'))){_0x51036e[_0x1857('0xd')]=qs[_0x1857('0xd')](_0x5f23e6[_0x1857('0x2e')][_0x1857('0xd')]);_0x51036e['offset']=qs[_0x1857('0xf')](_0x5f23e6[_0x1857('0x2e')][_0x1857('0xf')]);}return _0x12e39b[_0x1857('0x51')](_0x51036e);}})['then'](function(_0x108ddd){if(_0x108ddd){return _0x108ddd?{'count':_0x307421,'rows':_0x108ddd}:null;}})[_0x1857('0x15')](respondWithResult(_0x3ea124,null))['catch'](handleError(_0x3ea124,null));};exports[_0x1857('0x55')]=function(_0x22b488,_0x3bd08f){var _0x2a5044=_0x22b488[_0x1857('0x36')][_0x1857('0x56')];return db['Team'][_0x1857('0x47')]({'where':{'id':_0x2a5044},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1857('0x57'),'attributes':['id','name',_0x1857('0x58'),_0x1857('0x59'),'interface'],'raw':!![]}]})[_0x1857('0x15')](function(_0x46397d){if(_0x46397d){var _0x45e24a=_[_0x1857('0x5a')](_0x46397d,function(_0x4508df){var _0x2c6641=_0x4508df[_0x1857('0x16')]({'plain':!![]});return _0x2c6641[_0x1857('0x57')];});return db[_0x1857('0x24')][_0x1857('0x35')]({'where':{'id':_0x22b488[_0x1857('0x29')]['id']}})[_0x1857('0x15')](function(_0x4e3bf9){return db['sequelize'][_0x1857('0x5b')](function(_0x4e05d5){return _0x4e3bf9['addTeams'](_0x2a5044,{'transaction':_0x4e05d5})[_0x1857('0x15')](function(){return BPromise[_0x1857('0x5c')](_0x45e24a,function(_0x8b03c5){return db['UserWhatsappQueue'][_0x1857('0x5d')]({'where':{'UserId':_0x8b03c5['id'],'WhatsappQueueId':_0x22b488[_0x1857('0x29')]['id']},'transaction':_0x4e05d5});});})[_0x1857('0x15')](function(){_0x45e24a[_0x1857('0x5e')](function(_0x4d035a){socket[_0x1857('0x5f')]('userWhatsappQueue:save',{'UserId':_0x4d035a['id'],'WhatsappQueueId':_0x4e3bf9['id']});});});});});}})['then'](respondWithStatusCode(_0x3bd08f,null))[_0x1857('0x27')](handleError(_0x3bd08f,null));};exports[_0x1857('0x60')]=function(_0x4cef53,_0x135c7b){return db[_0x1857('0x52')][_0x1857('0x47')]({'where':{'id':_0x4cef53[_0x1857('0x2e')][_0x1857('0x56')]},'attributes':['id'],'include':[{'model':db[_0x1857('0x48')],'as':_0x1857('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x135c7b,null))[_0x1857('0x15')](function(_0x4cab5a){var _0x19afff=_['map'](_0x4cab5a,'id');var _0x7a541b=[];var _0x3ddb55=[];var _0x5935ae=squel[_0x1857('0x61')]();_0x5935ae[_0x1857('0x62')]('tq.TeamId')['from'](_0x1857('0x63'),'tq')[_0x1857('0x64')]('user_has_teams','ut',_0x1857('0x65'))['where'](_0x1857('0x66'),_0x4cef53['params']['id']);for(var _0x539ca0=0x0;_0x539ca0<_0x4cab5a[_0x1857('0x31')];_0x539ca0+=0x1){let _0x2705ed=_0x4cab5a[_0x539ca0];for(var _0x2a35d4=0x0;_0x2a35d4<_0x2705ed['Agents'][_0x1857('0x31')];_0x2a35d4+=0x1){let _0x47c514=_0x2705ed[_0x1857('0x57')][_0x2a35d4];var _0x254a95=_0x5935ae[_0x1857('0x67')]();_0x254a95[_0x1857('0x23')](_0x1857('0x68'),_0x47c514['id']);_0x3ddb55['push'](db[_0x1857('0x69')]['query'](_0x254a95[_0x1857('0x6a')](),{'type':db['sequelize'][_0x1857('0x6b')][_0x1857('0x6c')]})[_0x1857('0x15')](function(_0x24fb6e){if(_0x24fb6e[_0x1857('0x31')]===0x1){return _0x47c514['id'];}else{var _0x57406b=_[_0x1857('0x6d')](_[_0x1857('0x1f')](_0x24fb6e,'TeamId'),function(_0x934ab){return _[_0x1857('0x6e')](_0x19afff,_0x934ab);});if(_0x57406b){return _0x47c514['id'];}}}));}}return BPromise[_0x1857('0x6f')](_0x3ddb55)[_0x1857('0x15')](function(_0x24d3e8){_0x7a541b=_(_0x7a541b)[_0x1857('0x70')](_0x24d3e8)[_0x1857('0x71')]()[_0x1857('0x72')]();return db[_0x1857('0x24')][_0x1857('0x35')]({'where':{'id':_0x4cef53[_0x1857('0x29')]['id']}})[_0x1857('0x15')](function(_0x27bbc9){return db[_0x1857('0x69')][_0x1857('0x5b')](function(_0x571d3e){return _0x27bbc9['removeTeams'](_0x4cef53[_0x1857('0x2e')][_0x1857('0x56')],{'transaction':_0x571d3e})[_0x1857('0x15')](function(){if(!_[_0x1857('0x73')](_0x7a541b)){return _0x27bbc9[_0x1857('0x74')](_0x7a541b,{'transaction':_0x571d3e});}})[_0x1857('0x15')](function(){_0x7a541b[_0x1857('0x5e')](function(_0x4fd53f){socket[_0x1857('0x5f')](_0x1857('0x75'),{'UserId':_0x4fd53f,'WhatsappQueueId':_0x27bbc9['id']});});});});});});})['then'](respondWithStatusCode(_0x135c7b,null))['catch'](handleError(_0x135c7b,null));};exports[_0x1857('0x76')]=function(_0x20240e,_0x5b9b00){return db[_0x1857('0x24')][_0x1857('0x35')]({'where':{'id':_0x20240e[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x5b9b00,null))['then'](function(_0x3c0caf){if(_0x3c0caf){return _0x3c0caf[_0x1857('0x76')](_0x20240e['body'][_0x1857('0x56')],_[_0x1857('0x77')](_0x20240e[_0x1857('0x36')],[_0x1857('0x56'),'id'])||{})['spread'](function(_0x1a062f){for(var _0xa2b139=0x0;_0xa2b139<_0x20240e[_0x1857('0x36')][_0x1857('0x56')][_0x1857('0x31')];_0xa2b139+=0x1){socket[_0x1857('0x5f')](_0x1857('0x78'),{'UserId':Number(_0x20240e[_0x1857('0x36')][_0x1857('0x56')][_0xa2b139]),'WhatsappQueueId':Number(_0x20240e['params']['id'])});}return _0x1a062f;});}})[_0x1857('0x15')](respondWithResult(_0x5b9b00,null))['catch'](handleError(_0x5b9b00,null));};exports[_0x1857('0x74')]=function(_0xb69888,_0x3d5cd4){return db[_0x1857('0x24')][_0x1857('0x35')]({'where':{'id':_0xb69888['params']['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x3d5cd4,null))[_0x1857('0x15')](function(_0x3e30da){if(_0x3e30da){return _0x3e30da['removeAgents'](_0xb69888[_0x1857('0x2e')][_0x1857('0x56')])[_0x1857('0x15')](function(){if(_[_0x1857('0x79')](_0xb69888['query'][_0x1857('0x56')])){for(var _0x442bc7=0x0;_0x442bc7<_0xb69888[_0x1857('0x2e')][_0x1857('0x56')]['length'];_0x442bc7+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0xb69888[_0x1857('0x2e')][_0x1857('0x56')][_0x442bc7]),'WhatsappQueueId':Number(_0xb69888[_0x1857('0x29')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0xb69888['query']['ids']),'WhatsappQueueId':Number(_0xb69888['params']['id'])});}});}})[_0x1857('0x15')](respondWithStatusCode(_0x3d5cd4,null))[_0x1857('0x27')](handleError(_0x3d5cd4,null));};exports['getAgents']=function(_0xc8a3e7,_0x4b93dd){var _0xa18035={};var _0x4de7a7={};var _0x109d27;var _0x49c848;return db[_0x1857('0x24')]['findOne']({'where':{'id':_0xc8a3e7[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x4b93dd,null))[_0x1857('0x15')](function(_0xd503e3){if(_0xd503e3){_0x109d27=_0xd503e3;_0x4de7a7[_0x1857('0x2a')]=_[_0x1857('0x2b')](db[_0x1857('0x48')][_0x1857('0x2c')]);_0x4de7a7[_0x1857('0x2e')]=_[_0x1857('0x2b')](_0xc8a3e7[_0x1857('0x2e')]);_0x4de7a7['filters']=_[_0x1857('0x2d')](_0x4de7a7[_0x1857('0x2a')],_0x4de7a7[_0x1857('0x2e')]);_0xa18035[_0x1857('0x2f')]=_[_0x1857('0x2d')](_0x4de7a7[_0x1857('0x2a')],qs[_0x1857('0x30')](_0xc8a3e7['query']['fields']));_0xa18035['attributes']=_0xa18035[_0x1857('0x2f')][_0x1857('0x31')]?_0xa18035[_0x1857('0x2f')]:_0x4de7a7[_0x1857('0x2a')];_0xa18035[_0x1857('0x53')]=qs[_0x1857('0x43')](_0xc8a3e7['query'][_0x1857('0x43')]);_0xa18035['where']=qs[_0x1857('0x41')](_[_0x1857('0x44')](_0xc8a3e7[_0x1857('0x2e')],_0x4de7a7[_0x1857('0x41')]));if(_0xc8a3e7[_0x1857('0x2e')]['filter']){_0xa18035['where']=_[_0x1857('0x33')](_0xa18035[_0x1857('0x23')],{'$or':_[_0x1857('0x1f')](_0xa18035[_0x1857('0x2f')],function(_0x9da7a9){var _0x41e2be={};_0x41e2be[_0x9da7a9]={'$like':'%'+_0xc8a3e7[_0x1857('0x2e')][_0x1857('0x46')]+'%'};return _0x41e2be;})});}_0xa18035=_[_0x1857('0x33')]({},_0xa18035,_0xc8a3e7['options']);return _0x109d27[_0x1857('0x7a')](_0xa18035);}})[_0x1857('0x15')](function(_0x5d2a31){if(_0x5d2a31){_0x49c848=_0x5d2a31[_0x1857('0x31')];if(!_0xc8a3e7['query'][_0x1857('0x42')](_0x1857('0x54'))){_0xa18035[_0x1857('0xd')]=qs[_0x1857('0xd')](_0xc8a3e7['query'][_0x1857('0xd')]);_0xa18035['offset']=qs[_0x1857('0xf')](_0xc8a3e7[_0x1857('0x2e')][_0x1857('0xf')]);}return _0x109d27[_0x1857('0x7a')](_0xa18035);}})['then'](function(_0x2114fe){if(_0x2114fe){return _0x2114fe?{'count':_0x49c848,'rows':_0x2114fe}:null;}})[_0x1857('0x15')](respondWithResult(_0x4b93dd,null))[_0x1857('0x27')](handleError(_0x4b93dd,null));}; \ No newline at end of file +var _0x544c=['../../config/environment','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','get','WhatsappQueues','error','name','send','index','fieldName','type','key','getOptions','where','WhatsappQueue','include','query','findAll','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','update','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','sort','pick','filter','map','options','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','rawAttributes','ids','online','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','order','getAgents','nolimit','bluebird','util','lodash','../../components/parsers/qs'];(function(_0x3bb278,_0x5c641b){var _0x492160=function(_0x489d75){while(--_0x489d75){_0x3bb278['push'](_0x3bb278['shift']());}};_0x492160(++_0x5c641b);}(_0x544c,0x1dc));var _0xc544=function(_0x456fc1,_0x5e289d){_0x456fc1=_0x456fc1-0x0;var _0x35587a=_0x544c[_0x456fc1];return _0x35587a;};'use strict';var BPromise=require(_0xc544('0x0'));var util=require(_0xc544('0x1'));var _=require(_0xc544('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0xc544('0x3'));var logger=require('../../config/logger')('api');var config=require(_0xc544('0x4'));var db=require('../../mysqldb')['db'];config[_0xc544('0x5')]=_['defaults'](config[_0xc544('0x5')],{'host':_0xc544('0x6'),'port':0x18eb});var socket=require(_0xc544('0x7'))(new Redis(config[_0xc544('0x5')]));require(_0xc544('0x8'))[_0xc544('0x9')](socket);function respondWithStatusCode(_0x372d4c,_0x1ce87a){_0x1ce87a=_0x1ce87a||0xcc;return function(_0x30639a){if(_0x30639a){return _0x372d4c[_0xc544('0xa')](_0x1ce87a);}return _0x372d4c[_0xc544('0xb')](_0x1ce87a)[_0xc544('0xc')]();};}function respondWithResult(_0x372ae8,_0x3b4000){_0x3b4000=_0x3b4000||0xc8;return function(_0x581a54){if(_0x581a54){return _0x372ae8[_0xc544('0xb')](_0x3b4000)[_0xc544('0xd')](_0x581a54);}};}function respondWithFilteredResult(_0x4786ae,_0x1e56f8){return function(_0x595c1a){if(_0x595c1a){var _0x2fa28b=typeof _0x1e56f8[_0xc544('0xe')]===_0xc544('0xf')&&typeof _0x1e56f8[_0xc544('0x10')]==='undefined';var _0x2905dd=_0x595c1a[_0xc544('0x11')];var _0x5078a7=_0x2fa28b?0x0:_0x1e56f8[_0xc544('0xe')];var _0x33766d=_0x2fa28b?_0x595c1a[_0xc544('0x11')]:_0x1e56f8[_0xc544('0xe')]+_0x1e56f8[_0xc544('0x10')];var _0x11c5d9;if(_0x33766d>=_0x2905dd){_0x33766d=_0x2905dd;_0x11c5d9=0xc8;}else{_0x11c5d9=0xce;}_0x4786ae[_0xc544('0xb')](_0x11c5d9);return _0x4786ae['set'](_0xc544('0x12'),_0x5078a7+'-'+_0x33766d+'/'+_0x2905dd)[_0xc544('0xd')](_0x595c1a);}return null;};}function saveUpdates(_0x3f959b){return function(_0xcdd824){if(_0xcdd824){return _0xcdd824['update'](_0x3f959b)[_0xc544('0x13')](function(_0x330bdf){return _0x330bdf;});}return null;};}function removeEntity(_0x33a3f1){return function(_0x26513b){if(_0x26513b){return _0x26513b[_0xc544('0x14')]()[_0xc544('0x13')](function(){var _0x433b34=_0x26513b[_0xc544('0x15')]({'plain':!![]});var _0x2b49c9=_0xc544('0x16');return db['UserProfileResource'][_0xc544('0x14')]({'where':{'type':_0x2b49c9,'resourceId':_0x433b34['id']}})[_0xc544('0x13')](function(){return _0x26513b;});})['then'](function(){_0x33a3f1[_0xc544('0xb')](0xcc)[_0xc544('0xc')]();});}};}function handleEntityNotFound(_0x5ba803){return function(_0x5062cd){if(!_0x5062cd){_0x5ba803[_0xc544('0xa')](0x194);}return _0x5062cd;};}function handleError(_0x10fd7f,_0x5e5a35){_0x5e5a35=_0x5e5a35||0x1f4;return function(_0x362a79){logger[_0xc544('0x17')](_0x362a79['stack']);if(_0x362a79[_0xc544('0x18')]){delete _0x362a79[_0xc544('0x18')];}_0x10fd7f[_0xc544('0xb')](_0x5e5a35)[_0xc544('0x19')](_0x362a79);};}exports[_0xc544('0x1a')]=function(_0x7df66c,_0x1f9ba7){var _0x291cde={};var _0x13715e={'count':0x0,'rows':[]};var _0x5a3f22=_['map'](db['WhatsappQueue']['rawAttributes'],function(_0x252213){return{'name':_0x252213[_0xc544('0x1b')],'type':_0x252213[_0xc544('0x1c')][_0xc544('0x1d')]};});_0x291cde=qs[_0xc544('0x1e')](_0x5a3f22,_0x7df66c);var _0x5df3aa={'where':_0x291cde[_0xc544('0x1f')]};return db[_0xc544('0x20')][_0xc544('0x11')](_0x5df3aa)[_0xc544('0x13')](function(_0x3b6ef3){_0x13715e['count']=_0x3b6ef3;_0x291cde[_0xc544('0x21')]=qs[_0xc544('0x21')](_0x7df66c[_0xc544('0x22')]);return db['WhatsappQueue'][_0xc544('0x23')](_0x291cde);})[_0xc544('0x13')](function(_0x8ebb12){_0x13715e['rows']=_0x8ebb12;return _0x13715e;})[_0xc544('0x13')](respondWithFilteredResult(_0x1f9ba7,_0x291cde))['catch'](handleError(_0x1f9ba7,null));};exports[_0xc544('0x24')]=function(_0x43a4a9,_0x982704){var _0x352360={'raw':!![],'where':{'id':_0x43a4a9[_0xc544('0x25')]['id']}},_0x810445={};_0x810445[_0xc544('0x26')]=_['keys'](db[_0xc544('0x20')]['rawAttributes']);_0x810445[_0xc544('0x22')]=_[_0xc544('0x27')](_0x43a4a9[_0xc544('0x22')]);_0x810445[_0xc544('0x28')]=_[_0xc544('0x29')](_0x810445[_0xc544('0x26')],_0x810445['query']);_0x352360['attributes']=_[_0xc544('0x29')](_0x810445['model'],qs[_0xc544('0x2a')](_0x43a4a9[_0xc544('0x22')][_0xc544('0x2a')]));_0x352360[_0xc544('0x2b')]=_0x352360['attributes'][_0xc544('0x2c')]?_0x352360[_0xc544('0x2b')]:_0x810445[_0xc544('0x26')];if(_0x43a4a9[_0xc544('0x22')][_0xc544('0x2d')]){_0x352360[_0xc544('0x21')]=[{'all':!![]}];}_0x352360=_[_0xc544('0x2e')]({},_0x352360,_0x43a4a9['options']);return db[_0xc544('0x20')][_0xc544('0x2f')](_0x352360)['then'](handleEntityNotFound(_0x982704,null))['then'](respondWithResult(_0x982704,null))[_0xc544('0x30')](handleError(_0x982704,null));};exports['create']=function(_0x276e9c,_0x1242d7){return db['WhatsappQueue'][_0xc544('0x31')](_0x276e9c[_0xc544('0x32')],{})[_0xc544('0x13')](function(_0x54eff3){var _0x287f46=_0x276e9c[_0xc544('0x33')]['get']({'plain':!![]});if(!_0x287f46)throw new Error(_0xc544('0x34'));if(_0x287f46[_0xc544('0x35')]===_0xc544('0x33')){var _0x23dee8=_0x54eff3[_0xc544('0x15')]({'plain':!![]});var _0x327ccc='WhatsappQueues';return db[_0xc544('0x36')][_0xc544('0x2f')]({'where':{'name':_0x327ccc,'userProfileId':_0x287f46['userProfileId']},'raw':!![]})[_0xc544('0x13')](function(_0x43a571){if(_0x43a571&&_0x43a571[_0xc544('0x37')]===0x0){return db[_0xc544('0x38')][_0xc544('0x31')]({'name':_0x23dee8[_0xc544('0x18')],'resourceId':_0x23dee8['id'],'type':_0x43a571['name'],'sectionId':_0x43a571['id']},{})[_0xc544('0x13')](function(){return _0x54eff3;});}else{return _0x54eff3;}})[_0xc544('0x30')](function(_0x12829a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12829a);throw _0x12829a;});}return _0x54eff3;})['then'](respondWithResult(_0x1242d7,0xc9))[_0xc544('0x30')](handleError(_0x1242d7,null));};exports[_0xc544('0x39')]=function(_0x532bac,_0x16295c){if(_0x532bac[_0xc544('0x32')]['id']){delete _0x532bac[_0xc544('0x32')]['id'];}return db[_0xc544('0x20')][_0xc544('0x2f')]({'where':{'id':_0x532bac[_0xc544('0x25')]['id']}})[_0xc544('0x13')](handleEntityNotFound(_0x16295c,null))[_0xc544('0x13')](saveUpdates(_0x532bac[_0xc544('0x32')],null))[_0xc544('0x13')](respondWithResult(_0x16295c,null))[_0xc544('0x30')](handleError(_0x16295c,null));};exports['destroy']=function(_0x5cc9c1,_0x3f8e4b){return db[_0xc544('0x20')]['find']({'where':{'id':_0x5cc9c1[_0xc544('0x25')]['id']}})[_0xc544('0x13')](handleEntityNotFound(_0x3f8e4b,null))[_0xc544('0x13')](removeEntity(_0x3f8e4b,null))['catch'](handleError(_0x3f8e4b,null));};exports['describe']=function(_0x10ce59,_0xe5c451){return db[_0xc544('0x20')][_0xc544('0x3a')]()[_0xc544('0x13')](respondWithResult(_0xe5c451,null))[_0xc544('0x30')](handleError(_0xe5c451,null));};exports[_0xc544('0x3b')]=function(_0x16bc31,_0x4d9566){var _0x5b66a3={'raw':!![],'where':{}},_0x12e1f8={},_0x17c949;return db['WhatsappQueue'][_0xc544('0x3c')]({'where':{'id':_0x16bc31[_0xc544('0x25')]['id']}})[_0xc544('0x13')](handleEntityNotFound(_0x4d9566,null))[_0xc544('0x13')](function(_0x51dd72){if(_0x51dd72){_0x17c949=_0x51dd72['get']({'plain':!![]});_0x12e1f8['model']=_[_0xc544('0x27')](db[_0xc544('0x3d')]['rawAttributes']);_0x12e1f8[_0xc544('0x22')]=_[_0xc544('0x27')](_0x16bc31['query']);_0x12e1f8['filters']=_[_0xc544('0x29')](_0x12e1f8[_0xc544('0x26')],_0x12e1f8['query']);_0x5b66a3['attributes']=_['intersection'](_0x12e1f8[_0xc544('0x26')],qs[_0xc544('0x2a')](_0x16bc31['query']['fields']));_0x5b66a3[_0xc544('0x2b')]=_0x5b66a3[_0xc544('0x2b')][_0xc544('0x2c')]?_0x5b66a3['attributes']:_0x12e1f8['model'];if(!_0x16bc31[_0xc544('0x22')][_0xc544('0x3e')]('nolimit')){_0x5b66a3['limit']=qs[_0xc544('0x10')](_0x16bc31['query'][_0xc544('0x10')]);_0x5b66a3[_0xc544('0xe')]=qs[_0xc544('0xe')](_0x16bc31['query']['offset']);}_0x5b66a3['order']=qs[_0xc544('0x3f')](_0x16bc31[_0xc544('0x22')][_0xc544('0x3f')]);_0x5b66a3[_0xc544('0x1f')]=qs['filters'](_[_0xc544('0x40')](_0x16bc31[_0xc544('0x22')],_0x12e1f8[_0xc544('0x28')]));_0x5b66a3['where']['WhatsappQueueId']=_0x51dd72['id'];if(_0x16bc31[_0xc544('0x22')][_0xc544('0x41')]){_0x5b66a3['where']=_[_0xc544('0x2e')](_0x5b66a3['where'],{'$or':_[_0xc544('0x42')](_0x5b66a3[_0xc544('0x2b')],function(_0x828750){var _0x148a5f={};_0x148a5f[_0x828750]={'$like':'%'+_0x16bc31['query']['filter']+'%'};return _0x148a5f;})});}_0x5b66a3=_[_0xc544('0x2e')]({},_0x5b66a3,_0x16bc31[_0xc544('0x43')]);return db[_0xc544('0x3d')][_0xc544('0x23')](_0x5b66a3);}})[_0xc544('0x13')](function(_0x19ea36){if(_0x19ea36){return db[_0xc544('0x44')][_0xc544('0x45')]({'where':{'id':_[_0xc544('0x42')](_0x19ea36,_0xc544('0x46')),'role':_0xc544('0x47')},'attributes':['id',_0xc544('0x18'),_0xc544('0x48'),_0xc544('0x49'),'createdAt']});}})[_0xc544('0x13')](function(_0x378fde){if(_0x378fde){return{'count':_0x378fde['count'],'rows':_[_0xc544('0x42')](_0x378fde[_0xc544('0x4a')],function(_0x1c4694){return{'membername':_0x1c4694['name'],'UserId':_0x1c4694['id'],'queue_name':_0x17c949['name'],'WhatsappQueueId':_0x17c949['id'],'interface':util[_0xc544('0x4b')](_0xc544('0x4c'),_0xc544('0x4d'),_0x1c4694[_0xc544('0x18')]),'penalty':0x0,'paused':_0x1c4694[_0xc544('0x48')],'createdAt':_0x1c4694[_0xc544('0x4e')],'updatedAt':_0x1c4694[_0xc544('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc544('0x13')](respondWithFilteredResult(_0x4d9566,_0x5b66a3))[_0xc544('0x30')](handleError(_0x4d9566,null));};exports[_0xc544('0x4f')]=function(_0x4d829f,_0x207641){var _0x4b9624={};var _0x31bacb={};var _0x451812;var _0x5c91de;return db['WhatsappQueue'][_0xc544('0x3c')]({'where':{'id':_0x4d829f['params']['id']}})['then'](handleEntityNotFound(_0x207641,null))[_0xc544('0x13')](function(_0x44cc78){if(_0x44cc78){_0x451812=_0x44cc78;_0x31bacb[_0xc544('0x26')]=_[_0xc544('0x27')](db[_0xc544('0x50')][_0xc544('0x51')]);_0x31bacb['query']=_[_0xc544('0x27')](_0x4d829f['query']);_0x31bacb['filters']=_[_0xc544('0x29')](_0x31bacb[_0xc544('0x26')],_0x31bacb[_0xc544('0x22')]);_0x4b9624[_0xc544('0x2b')]=_['intersection'](_0x31bacb[_0xc544('0x26')],qs[_0xc544('0x2a')](_0x4d829f[_0xc544('0x22')][_0xc544('0x2a')]));_0x4b9624['attributes']=_0x4b9624[_0xc544('0x2b')]['length']?_0x4b9624['attributes']:_0x31bacb[_0xc544('0x26')];_0x4b9624['order']=qs[_0xc544('0x3f')](_0x4d829f[_0xc544('0x22')]['sort']);_0x4b9624[_0xc544('0x1f')]=qs[_0xc544('0x28')](_[_0xc544('0x40')](_0x4d829f['query'],_0x31bacb[_0xc544('0x28')]));if(_0x4d829f[_0xc544('0x22')][_0xc544('0x41')]){_0x4b9624[_0xc544('0x1f')]=_[_0xc544('0x2e')](_0x4b9624['where'],{'$or':_[_0xc544('0x42')](_0x4b9624[_0xc544('0x2b')],function(_0x5d14e3){var _0x275fa5={};_0x275fa5[_0x5d14e3]={'$like':'%'+_0x4d829f[_0xc544('0x22')][_0xc544('0x41')]+'%'};return _0x275fa5;})});}_0x4b9624=_['merge']({},_0x4b9624,_0x4d829f['options']);return _0x451812[_0xc544('0x4f')](_0x4b9624);}})[_0xc544('0x13')](function(_0x11f117){if(_0x11f117){_0x5c91de=_0x11f117[_0xc544('0x2c')];if(!_0x4d829f[_0xc544('0x22')][_0xc544('0x3e')]('nolimit')){_0x4b9624[_0xc544('0x10')]=qs[_0xc544('0x10')](_0x4d829f['query'][_0xc544('0x10')]);_0x4b9624[_0xc544('0xe')]=qs[_0xc544('0xe')](_0x4d829f[_0xc544('0x22')][_0xc544('0xe')]);}return _0x451812[_0xc544('0x4f')](_0x4b9624);}})[_0xc544('0x13')](function(_0x5cfaa4){if(_0x5cfaa4){return _0x5cfaa4?{'count':_0x5c91de,'rows':_0x5cfaa4}:null;}})['then'](respondWithResult(_0x207641,null))[_0xc544('0x30')](handleError(_0x207641,null));};exports['addTeams']=function(_0x171872,_0x2734e4){var _0x131a10=_0x171872[_0xc544('0x32')][_0xc544('0x52')];return db[_0xc544('0x50')]['findAll']({'where':{'id':_0x131a10},'attributes':['id'],'include':[{'model':db[_0xc544('0x44')],'as':'Agents','attributes':['id',_0xc544('0x18'),_0xc544('0x53'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x91facf){if(_0x91facf){var _0x417184=_[_0xc544('0x54')](_0x91facf,function(_0xfe147){var _0x17b50c=_0xfe147[_0xc544('0x15')]({'plain':!![]});return _0x17b50c[_0xc544('0x55')];});return db['WhatsappQueue'][_0xc544('0x2f')]({'where':{'id':_0x171872[_0xc544('0x25')]['id']}})[_0xc544('0x13')](function(_0x5db900){return db[_0xc544('0x56')][_0xc544('0x57')](function(_0x244c6c){return _0x5db900[_0xc544('0x58')](_0x131a10,{'transaction':_0x244c6c})['then'](function(){return BPromise[_0xc544('0x59')](_0x417184,function(_0x4ddab2){return db[_0xc544('0x3d')][_0xc544('0x5a')]({'where':{'UserId':_0x4ddab2['id'],'WhatsappQueueId':_0x171872[_0xc544('0x25')]['id']},'transaction':_0x244c6c});});})['then'](function(){_0x417184[_0xc544('0x5b')](function(_0x1014c3){socket[_0xc544('0x5c')](_0xc544('0x5d'),{'UserId':_0x1014c3['id'],'WhatsappQueueId':_0x5db900['id']});});});});});}})[_0xc544('0x13')](respondWithStatusCode(_0x2734e4,null))[_0xc544('0x30')](handleError(_0x2734e4,null));};exports[_0xc544('0x5e')]=function(_0x5af362,_0x2c0b35){return db[_0xc544('0x50')]['findAll']({'where':{'id':_0x5af362['query'][_0xc544('0x52')]},'attributes':['id'],'include':[{'model':db[_0xc544('0x44')],'as':_0xc544('0x55'),'attributes':['id'],'raw':!![]}]})[_0xc544('0x13')](handleEntityNotFound(_0x2c0b35,null))[_0xc544('0x13')](function(_0x2ed34a){var _0x1cd707=_[_0xc544('0x42')](_0x2ed34a,'id');var _0x55a838=[];var _0x5cd1bc=[];var _0x4026ea=squel[_0xc544('0x5f')]();_0x4026ea[_0xc544('0x60')]('tq.TeamId')[_0xc544('0x61')]('team_has_whatsapp_queues','tq')['join'](_0xc544('0x62'),'ut',_0xc544('0x63'))['where']('WhatsappQueueId\x20=\x20?',_0x5af362[_0xc544('0x25')]['id']);for(var _0x1acd9c=0x0;_0x1acd9c<_0x2ed34a[_0xc544('0x2c')];_0x1acd9c+=0x1){let _0x5a0590=_0x2ed34a[_0x1acd9c];for(var _0x24655b=0x0;_0x24655b<_0x5a0590[_0xc544('0x55')][_0xc544('0x2c')];_0x24655b+=0x1){let _0x48a0f1=_0x5a0590[_0xc544('0x55')][_0x24655b];var _0x472598=_0x4026ea[_0xc544('0x64')]();_0x472598['where'](_0xc544('0x65'),_0x48a0f1['id']);_0x5cd1bc[_0xc544('0x66')](db[_0xc544('0x56')][_0xc544('0x22')](_0x472598[_0xc544('0x67')](),{'type':db[_0xc544('0x56')][_0xc544('0x68')][_0xc544('0x69')]})[_0xc544('0x13')](function(_0xb2e9eb){if(_0xb2e9eb[_0xc544('0x2c')]===0x1){return _0x48a0f1['id'];}else{var _0x5a4038=_[_0xc544('0x6a')](_[_0xc544('0x42')](_0xb2e9eb,_0xc544('0x6b')),function(_0x2edc0e){return _['includes'](_0x1cd707,_0x2edc0e);});if(_0x5a4038){return _0x48a0f1['id'];}}}));}}return BPromise[_0xc544('0x6c')](_0x5cd1bc)['then'](function(_0x4a4222){_0x55a838=_(_0x55a838)[_0xc544('0x6d')](_0x4a4222)['compact']()[_0xc544('0x6e')]();return db[_0xc544('0x20')][_0xc544('0x2f')]({'where':{'id':_0x5af362['params']['id']}})[_0xc544('0x13')](function(_0x4e0cf0){return db[_0xc544('0x56')][_0xc544('0x57')](function(_0x3af0d7){return _0x4e0cf0[_0xc544('0x5e')](_0x5af362[_0xc544('0x22')]['ids'],{'transaction':_0x3af0d7})[_0xc544('0x13')](function(){if(!_['isEmpty'](_0x55a838)){return _0x4e0cf0[_0xc544('0x6f')](_0x55a838,{'transaction':_0x3af0d7});}})[_0xc544('0x13')](function(){_0x55a838[_0xc544('0x5b')](function(_0xfaa8b5){socket[_0xc544('0x5c')](_0xc544('0x70'),{'UserId':_0xfaa8b5,'WhatsappQueueId':_0x4e0cf0['id']});});});});});});})[_0xc544('0x13')](respondWithStatusCode(_0x2c0b35,null))[_0xc544('0x30')](handleError(_0x2c0b35,null));};exports[_0xc544('0x71')]=function(_0x47101e,_0x20294b){return db[_0xc544('0x20')][_0xc544('0x2f')]({'where':{'id':_0x47101e[_0xc544('0x25')]['id']}})[_0xc544('0x13')](handleEntityNotFound(_0x20294b,null))[_0xc544('0x13')](function(_0x1f4339){if(_0x1f4339){return _0x1f4339[_0xc544('0x71')](_0x47101e[_0xc544('0x32')]['ids'],_[_0xc544('0x72')](_0x47101e[_0xc544('0x32')],[_0xc544('0x52'),'id'])||{})[_0xc544('0x73')](function(_0xa8a874){for(var _0x4f322e=0x0;_0x4f322e<_0x47101e[_0xc544('0x32')][_0xc544('0x52')]['length'];_0x4f322e+=0x1){socket[_0xc544('0x5c')]('userWhatsappQueue:save',{'UserId':Number(_0x47101e['body'][_0xc544('0x52')][_0x4f322e]),'WhatsappQueueId':Number(_0x47101e[_0xc544('0x25')]['id'])});}return _0xa8a874;});}})[_0xc544('0x13')](respondWithResult(_0x20294b,null))['catch'](handleError(_0x20294b,null));};exports['removeAgents']=function(_0x53f1c5,_0x55d5bc){return db['WhatsappQueue'][_0xc544('0x2f')]({'where':{'id':_0x53f1c5[_0xc544('0x25')]['id']}})[_0xc544('0x13')](handleEntityNotFound(_0x55d5bc,null))[_0xc544('0x13')](function(_0x21865a){if(_0x21865a){return _0x21865a[_0xc544('0x6f')](_0x53f1c5[_0xc544('0x22')]['ids'])[_0xc544('0x13')](function(){if(_[_0xc544('0x74')](_0x53f1c5[_0xc544('0x22')][_0xc544('0x52')])){for(var _0x4f64e7=0x0;_0x4f64e7<_0x53f1c5[_0xc544('0x22')][_0xc544('0x52')][_0xc544('0x2c')];_0x4f64e7+=0x1){socket[_0xc544('0x5c')](_0xc544('0x70'),{'UserId':Number(_0x53f1c5[_0xc544('0x22')]['ids'][_0x4f64e7]),'WhatsappQueueId':Number(_0x53f1c5[_0xc544('0x25')]['id'])});}}else{socket[_0xc544('0x5c')](_0xc544('0x70'),{'UserId':Number(_0x53f1c5[_0xc544('0x22')][_0xc544('0x52')]),'WhatsappQueueId':Number(_0x53f1c5['params']['id'])});}});}})['then'](respondWithStatusCode(_0x55d5bc,null))[_0xc544('0x30')](handleError(_0x55d5bc,null));};exports['getAgents']=function(_0x289d2f,_0x2e47a9){var _0x46c0f6={};var _0xa4cb2a={};var _0x440a07;var _0x261232;return db[_0xc544('0x20')][_0xc544('0x3c')]({'where':{'id':_0x289d2f['params']['id']}})['then'](handleEntityNotFound(_0x2e47a9,null))[_0xc544('0x13')](function(_0x5ae889){if(_0x5ae889){_0x440a07=_0x5ae889;_0xa4cb2a[_0xc544('0x26')]=_[_0xc544('0x27')](db['User'][_0xc544('0x51')]);_0xa4cb2a['query']=_[_0xc544('0x27')](_0x289d2f[_0xc544('0x22')]);_0xa4cb2a[_0xc544('0x28')]=_[_0xc544('0x29')](_0xa4cb2a['model'],_0xa4cb2a[_0xc544('0x22')]);_0x46c0f6[_0xc544('0x2b')]=_[_0xc544('0x29')](_0xa4cb2a[_0xc544('0x26')],qs[_0xc544('0x2a')](_0x289d2f[_0xc544('0x22')][_0xc544('0x2a')]));_0x46c0f6[_0xc544('0x2b')]=_0x46c0f6[_0xc544('0x2b')][_0xc544('0x2c')]?_0x46c0f6['attributes']:_0xa4cb2a['model'];_0x46c0f6[_0xc544('0x75')]=qs['sort'](_0x289d2f[_0xc544('0x22')][_0xc544('0x3f')]);_0x46c0f6['where']=qs[_0xc544('0x28')](_[_0xc544('0x40')](_0x289d2f[_0xc544('0x22')],_0xa4cb2a['filters']));if(_0x289d2f[_0xc544('0x22')][_0xc544('0x41')]){_0x46c0f6[_0xc544('0x1f')]=_[_0xc544('0x2e')](_0x46c0f6['where'],{'$or':_[_0xc544('0x42')](_0x46c0f6[_0xc544('0x2b')],function(_0x545c3d){var _0xe0c5ff={};_0xe0c5ff[_0x545c3d]={'$like':'%'+_0x289d2f[_0xc544('0x22')][_0xc544('0x41')]+'%'};return _0xe0c5ff;})});}_0x46c0f6=_['merge']({},_0x46c0f6,_0x289d2f[_0xc544('0x43')]);return _0x440a07[_0xc544('0x76')](_0x46c0f6);}})[_0xc544('0x13')](function(_0x189c81){if(_0x189c81){_0x261232=_0x189c81[_0xc544('0x2c')];if(!_0x289d2f['query'][_0xc544('0x3e')](_0xc544('0x77'))){_0x46c0f6[_0xc544('0x10')]=qs['limit'](_0x289d2f[_0xc544('0x22')][_0xc544('0x10')]);_0x46c0f6[_0xc544('0xe')]=qs[_0xc544('0xe')](_0x289d2f[_0xc544('0x22')][_0xc544('0xe')]);}return _0x440a07['getAgents'](_0x46c0f6);}})[_0xc544('0x13')](function(_0x4662e0){if(_0x4662e0){return _0x4662e0?{'count':_0x261232,'rows':_0x4662e0}:null;}})['then'](respondWithResult(_0x2e47a9,null))[_0xc544('0x30')](handleError(_0x2e47a9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ac8a8cc..a9f2980 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 _0xa44a=['hasOwnProperty','hook','exports','events','save','remove','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa44a,0x8f));var _0xaa44=function(_0x2b17f9,_0x23f737){_0x2b17f9=_0x2b17f9-0x0;var _0x2f13c9=_0xa44a[_0x2b17f9];return _0x2f13c9;};'use strict';var EventEmitter=require(_0xaa44('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa44('0x1'),'afterUpdate':'update','afterDestroy':_0xaa44('0x2')};function emitEvent(_0x11d656){return function(_0x387b93,_0x4912f4,_0x908366){WhatsappQueueEvents['emit'](_0x11d656+':'+_0x387b93['id'],_0x387b93);WhatsappQueueEvents[_0xaa44('0x3')](_0x11d656,_0x387b93);_0x908366(null);};}for(var e in events){if(events[_0xaa44('0x4')](e)){var event=events[e];WhatsappQueue[_0xaa44('0x5')](e,emitEvent(event));}}module[_0xaa44('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9f8e=['WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3d8d62,_0x5a159e){var _0x2a18f3=function(_0x15dd29){while(--_0x15dd29){_0x3d8d62['push'](_0x3d8d62['shift']());}};_0x2a18f3(++_0x5a159e);}(_0x9f8e,0x1ca));var _0xe9f8=function(_0x254971,_0x4f60ca){_0x254971=_0x254971-0x0;var _0x2452ca=_0x9f8e[_0x254971];return _0x2452ca;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xe9f8('0x0'))['db'][_0xe9f8('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe9f8('0x2')](0x0);var events={'afterCreate':_0xe9f8('0x3'),'afterUpdate':_0xe9f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa73964){return function(_0x3e59a7,_0x7a8358,_0xbb4c14){WhatsappQueueEvents[_0xe9f8('0x5')](_0xa73964+':'+_0x3e59a7['id'],_0x3e59a7);WhatsappQueueEvents[_0xe9f8('0x5')](_0xa73964,_0x3e59a7);_0xbb4c14(null);};}for(var e in events){if(events[_0xe9f8('0x6')](e)){var event=events[e];WhatsappQueue[_0xe9f8('0x7')](e,emitEvent(event));}}module[_0xe9f8('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index fb0403f..b5fe62c 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 _0xd099=['util','../../config/logger','api','moment','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x2eac8e,_0x33320b){var _0x3c8d50=function(_0x57f5c3){while(--_0x57f5c3){_0x2eac8e['push'](_0x2eac8e['shift']());}};_0x3c8d50(++_0x33320b);}(_0xd099,0x137));var _0x9d09=function(_0x571714,_0x30d2b3){_0x571714=_0x571714-0x0;var _0x599a14=_0xd099[_0x571714];return _0x599a14;};'use strict';var _=require(_0x9d09('0x0'));var util=require(_0x9d09('0x1'));var logger=require(_0x9d09('0x2'))(_0x9d09('0x3'));var moment=require(_0x9d09('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d09('0x5'));var rimraf=require(_0x9d09('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d09('0x7'));module[_0x9d09('0x8')]=function(_0x5afc58,_0x3ddcbe){return _0x5afc58[_0x9d09('0x9')](_0x9d09('0xa'),attributes,{'tableName':_0x9d09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdde6=['exports','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes'];(function(_0x2606bd,_0x3148ea){var _0x1b6f75=function(_0x23f433){while(--_0x23f433){_0x2606bd['push'](_0x2606bd['shift']());}};_0x1b6f75(++_0x3148ea);}(_0xdde6,0x157));var _0x6dde=function(_0x49b4e6,_0x498295){_0x49b4e6=_0x49b4e6-0x0;var _0x47852b=_0xdde6[_0x49b4e6];return _0x47852b;};'use strict';var _=require(_0x6dde('0x0'));var util=require(_0x6dde('0x1'));var logger=require(_0x6dde('0x2'))('api');var moment=require(_0x6dde('0x3'));var BPromise=require(_0x6dde('0x4'));var rp=require(_0x6dde('0x5'));var fs=require('fs');var path=require(_0x6dde('0x6'));var rimraf=require('rimraf');var config=require(_0x6dde('0x7'));var attributes=require(_0x6dde('0x8'));module[_0x6dde('0x9')]=function(_0x5a33c3,_0x31ffed){return _0x5a33c3['define']('WhatsappQueue',attributes,{'tableName':_0x6dde('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index d1d2e69..18f0a13 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 _0x5c03=['message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowWhatsappQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x5c03,0x119));var _0x35c0=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5c03[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0x35c0('0x0'));var moment=require(_0x35c0('0x1'));var BPromise=require(_0x35c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35c0('0x3'));var db=require(_0x35c0('0x4'))['db'];var utils=require(_0x35c0('0x5'));var logger=require(_0x35c0('0x6'))(_0x35c0('0x7'));var config=require(_0x35c0('0x8'));var jayson=require(_0x35c0('0x9'));var client=jayson[_0x35c0('0xa')]['http']({'port':0x232a});config['redis']=_[_0x35c0('0xb')](config[_0x35c0('0xc')],{'host':_0x35c0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35c0('0xc')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x337d85,_0x4fa4db,_0x30934){return new BPromise(function(_0x2e2422,_0x5cb2aa){return client[_0x35c0('0xe')](_0x337d85,_0x30934)[_0x35c0('0xf')](function(_0x5b1396){logger[_0x35c0('0x10')](_0x35c0('0x11'),_0x4fa4db,_0x35c0('0x12'));logger['debug'](_0x35c0('0x13'),_0x4fa4db,'request\x20sent',JSON[_0x35c0('0x14')](_0x5b1396));if(_0x5b1396[_0x35c0('0x15')]){if(_0x5b1396[_0x35c0('0x15')][_0x35c0('0x16')]===0x1f4){logger['error'](_0x35c0('0x11'),_0x4fa4db,_0x5b1396[_0x35c0('0x15')][_0x35c0('0x17')]);return _0x5cb2aa(_0x5b1396[_0x35c0('0x15')]['message']);}logger[_0x35c0('0x15')](_0x35c0('0x11'),_0x4fa4db,_0x5b1396['error'][_0x35c0('0x17')]);return _0x2e2422(_0x5b1396['error'][_0x35c0('0x17')]);}else{logger[_0x35c0('0x10')](_0x35c0('0x11'),_0x4fa4db,'request\x20sent');_0x2e2422(_0x5b1396[_0x35c0('0x18')][_0x35c0('0x17')]);}})['catch'](function(_0x4917bb){logger[_0x35c0('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4fa4db,_0x4917bb);_0x5cb2aa(_0x4917bb);});});}exports[_0x35c0('0x19')]=function(_0x5b2351){var _0x236750=this;return new Promise(function(_0x4bef87,_0x5e82ad){return db[_0x35c0('0x1a')][_0x35c0('0x1b')]({'raw':_0x5b2351[_0x35c0('0x1c')]?_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x1d')]===undefined?!![]:![]:!![],'where':_0x5b2351[_0x35c0('0x1c')]?_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x1e')]||null:null,'attributes':_0x5b2351['options']?_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x1f')]||null:null,'limit':_0x5b2351[_0x35c0('0x1c')]?_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x20')]||null:null,'include':_0x5b2351[_0x35c0('0x1c')]?_0x5b2351[_0x35c0('0x1c')]['include']?_[_0x35c0('0x21')](_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x22')],function(_0x4b3734){return{'model':db[_0x4b3734[_0x35c0('0x23')]],'as':_0x4b3734['as'],'attributes':_0x4b3734[_0x35c0('0x1f')],'include':_0x4b3734['include']?_['map'](_0x4b3734['include'],function(_0x127950){return{'model':db[_0x127950[_0x35c0('0x23')]],'as':_0x127950['as'],'attributes':_0x127950[_0x35c0('0x1f')],'include':_0x127950[_0x35c0('0x22')]?_[_0x35c0('0x21')](_0x127950[_0x35c0('0x22')],function(_0x2aee3e){return{'model':db[_0x2aee3e['model']],'as':_0x2aee3e['as'],'attributes':_0x2aee3e[_0x35c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x35c0('0xf')](function(_0x295f41){logger['info'](_0x35c0('0x19'),_0x5b2351);logger[_0x35c0('0x24')](_0x35c0('0x19'),_0x5b2351,JSON[_0x35c0('0x14')](_0x295f41));_0x4bef87(_0x295f41);})['catch'](function(_0x4dad12){logger[_0x35c0('0x15')](_0x35c0('0x19'),_0x4dad12[_0x35c0('0x17')],_0x5b2351);_0x5e82ad(_0x236750[_0x35c0('0x15')](0x1f4,_0x4dad12['message']));});});};exports[_0x35c0('0x25')]=function(_0x5d9f23){var _0x4dd2c3=this;return new Promise(function(_0x3c952f,_0x1c20fc){return db[_0x35c0('0x1a')]['find']({'raw':_0x5d9f23[_0x35c0('0x1c')]?_0x5d9f23['options'][_0x35c0('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d9f23[_0x35c0('0x1c')]?_0x5d9f23['options'][_0x35c0('0x1e')]||null:null,'attributes':_0x5d9f23[_0x35c0('0x1c')]?_0x5d9f23['options'][_0x35c0('0x1f')]||null:null,'include':_0x5d9f23[_0x35c0('0x1c')]?_0x5d9f23[_0x35c0('0x1c')][_0x35c0('0x22')]?_[_0x35c0('0x21')](_0x5d9f23[_0x35c0('0x1c')][_0x35c0('0x22')],function(_0x158640){return{'model':db[_0x158640[_0x35c0('0x23')]],'as':_0x158640['as'],'attributes':_0x158640[_0x35c0('0x1f')],'include':_0x158640[_0x35c0('0x22')]?_[_0x35c0('0x21')](_0x158640[_0x35c0('0x22')],function(_0x5e85fb){return{'model':db[_0x5e85fb['model']],'as':_0x5e85fb['as'],'attributes':_0x5e85fb[_0x35c0('0x1f')],'include':_0x5e85fb[_0x35c0('0x22')]?_[_0x35c0('0x21')](_0x5e85fb[_0x35c0('0x22')],function(_0x5d9a46){return{'model':db[_0x5d9a46['model']],'as':_0x5d9a46['as'],'attributes':_0x5d9a46[_0x35c0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26dc4d){logger[_0x35c0('0x10')](_0x35c0('0x25'),_0x5d9f23);logger[_0x35c0('0x24')]('ShowWhatsappQueue',_0x5d9f23,JSON['stringify'](_0x26dc4d));_0x3c952f(_0x26dc4d);})['catch'](function(_0x3e6f11){logger[_0x35c0('0x15')](_0x35c0('0x25'),_0x3e6f11[_0x35c0('0x17')],_0x5d9f23);_0x1c20fc(_0x4dd2c3[_0x35c0('0x15')](0x1f4,_0x3e6f11['message']));});});}; \ No newline at end of file +var _0x2f93=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','request\x20sent','debug','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include','map','model','find','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x2f93,0x9a));var _0x32f9=function(_0x2c2785,_0x30dc45){_0x2c2785=_0x2c2785-0x0;var _0x43206d=_0x2f93[_0x2c2785];return _0x43206d;};'use strict';var _=require(_0x32f9('0x0'));var util=require(_0x32f9('0x1'));var moment=require(_0x32f9('0x2'));var BPromise=require(_0x32f9('0x3'));var rs=require(_0x32f9('0x4'));var fs=require('fs');var Redis=require(_0x32f9('0x5'));var db=require(_0x32f9('0x6'))['db'];var utils=require(_0x32f9('0x7'));var logger=require(_0x32f9('0x8'))(_0x32f9('0x9'));var config=require(_0x32f9('0xa'));var jayson=require(_0x32f9('0xb'));var client=jayson[_0x32f9('0xc')]['http']({'port':0x232a});config[_0x32f9('0xd')]=_['defaults'](config[_0x32f9('0xd')],{'host':_0x32f9('0xe'),'port':0x18eb});var socket=require(_0x32f9('0xf'))(new Redis(config[_0x32f9('0xd')]));require(_0x32f9('0x10'))[_0x32f9('0x11')](socket);function respondWithRpcPromise(_0x252f81,_0xbe1167,_0x5ec732){return new BPromise(function(_0x336ae6,_0x5674c7){return client['request'](_0x252f81,_0x5ec732)[_0x32f9('0x12')](function(_0x4eed25){logger[_0x32f9('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0xbe1167,_0x32f9('0x14'));logger[_0x32f9('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xbe1167,_0x32f9('0x14'),JSON[_0x32f9('0x16')](_0x4eed25));if(_0x4eed25[_0x32f9('0x17')]){if(_0x4eed25[_0x32f9('0x17')]['code']===0x1f4){logger['error'](_0x32f9('0x18'),_0xbe1167,_0x4eed25[_0x32f9('0x17')][_0x32f9('0x19')]);return _0x5674c7(_0x4eed25['error'][_0x32f9('0x19')]);}logger[_0x32f9('0x17')](_0x32f9('0x18'),_0xbe1167,_0x4eed25['error']['message']);return _0x336ae6(_0x4eed25[_0x32f9('0x17')]['message']);}else{logger[_0x32f9('0x13')](_0x32f9('0x18'),_0xbe1167,_0x32f9('0x14'));_0x336ae6(_0x4eed25[_0x32f9('0x1a')][_0x32f9('0x19')]);}})[_0x32f9('0x1b')](function(_0x41308a){logger[_0x32f9('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0xbe1167,_0x41308a);_0x5674c7(_0x41308a);});});}exports[_0x32f9('0x1c')]=function(_0x436d9e){var _0x21670d=this;return new Promise(function(_0x24f2ce,_0x2fa65f){return db[_0x32f9('0x1d')]['findAll']({'raw':_0x436d9e[_0x32f9('0x1e')]?_0x436d9e['options'][_0x32f9('0x1f')]===undefined?!![]:![]:!![],'where':_0x436d9e[_0x32f9('0x1e')]?_0x436d9e['options'][_0x32f9('0x20')]||null:null,'attributes':_0x436d9e[_0x32f9('0x1e')]?_0x436d9e['options'][_0x32f9('0x21')]||null:null,'limit':_0x436d9e[_0x32f9('0x1e')]?_0x436d9e[_0x32f9('0x1e')][_0x32f9('0x22')]||null:null,'include':_0x436d9e['options']?_0x436d9e[_0x32f9('0x1e')][_0x32f9('0x23')]?_[_0x32f9('0x24')](_0x436d9e[_0x32f9('0x1e')][_0x32f9('0x23')],function(_0x11bf36){return{'model':db[_0x11bf36['model']],'as':_0x11bf36['as'],'attributes':_0x11bf36['attributes'],'include':_0x11bf36[_0x32f9('0x23')]?_[_0x32f9('0x24')](_0x11bf36[_0x32f9('0x23')],function(_0x4c91e5){return{'model':db[_0x4c91e5[_0x32f9('0x25')]],'as':_0x4c91e5['as'],'attributes':_0x4c91e5['attributes'],'include':_0x4c91e5[_0x32f9('0x23')]?_[_0x32f9('0x24')](_0x4c91e5[_0x32f9('0x23')],function(_0x31dec0){return{'model':db[_0x31dec0['model']],'as':_0x31dec0['as'],'attributes':_0x31dec0[_0x32f9('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d56a2){logger[_0x32f9('0x13')]('GetWhatsappQueue',_0x436d9e);logger[_0x32f9('0x15')](_0x32f9('0x1c'),_0x436d9e,JSON[_0x32f9('0x16')](_0x2d56a2));_0x24f2ce(_0x2d56a2);})[_0x32f9('0x1b')](function(_0x668162){logger[_0x32f9('0x17')](_0x32f9('0x1c'),_0x668162[_0x32f9('0x19')],_0x436d9e);_0x2fa65f(_0x21670d['error'](0x1f4,_0x668162['message']));});});};exports['ShowWhatsappQueue']=function(_0x58e666){var _0x297561=this;return new Promise(function(_0x54b4f8,_0x1b5004){return db[_0x32f9('0x1d')][_0x32f9('0x26')]({'raw':_0x58e666[_0x32f9('0x1e')]?_0x58e666[_0x32f9('0x1e')][_0x32f9('0x1f')]===undefined?!![]:![]:!![],'where':_0x58e666[_0x32f9('0x1e')]?_0x58e666[_0x32f9('0x1e')][_0x32f9('0x20')]||null:null,'attributes':_0x58e666[_0x32f9('0x1e')]?_0x58e666[_0x32f9('0x1e')][_0x32f9('0x21')]||null:null,'include':_0x58e666['options']?_0x58e666[_0x32f9('0x1e')][_0x32f9('0x23')]?_['map'](_0x58e666[_0x32f9('0x1e')][_0x32f9('0x23')],function(_0x385983){return{'model':db[_0x385983['model']],'as':_0x385983['as'],'attributes':_0x385983[_0x32f9('0x21')],'include':_0x385983[_0x32f9('0x23')]?_['map'](_0x385983[_0x32f9('0x23')],function(_0x581bd9){return{'model':db[_0x581bd9[_0x32f9('0x25')]],'as':_0x581bd9['as'],'attributes':_0x581bd9['attributes'],'include':_0x581bd9[_0x32f9('0x23')]?_[_0x32f9('0x24')](_0x581bd9['include'],function(_0xfae886){return{'model':db[_0xfae886[_0x32f9('0x25')]],'as':_0xfae886['as'],'attributes':_0xfae886[_0x32f9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x32f9('0x12')](function(_0x5cd696){logger[_0x32f9('0x13')](_0x32f9('0x27'),_0x58e666);logger[_0x32f9('0x15')](_0x32f9('0x27'),_0x58e666,JSON[_0x32f9('0x16')](_0x5cd696));_0x54b4f8(_0x5cd696);})[_0x32f9('0x1b')](function(_0x55bbd9){logger['error']('ShowWhatsappQueue',_0x55bbd9[_0x32f9('0x19')],_0x58e666);_0x1b5004(_0x297561[_0x32f9('0x17')](0x1f4,_0x55bbd9[_0x32f9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 581803d..5ce5120 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 _0x1ee0=['remove','update','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x94e205,_0x580c07){var _0x3b5e5f=function(_0x31f169){while(--_0x31f169){_0x94e205['push'](_0x94e205['shift']());}};_0x3b5e5f(++_0x580c07);}(_0x1ee0,0x1a9));var _0x01ee=function(_0x4f75c8,_0x4ef999){_0x4f75c8=_0x4f75c8-0x0;var _0x3e75ff=_0x1ee0[_0x4f75c8];return _0x3e75ff;};'use strict';var WhatsappQueueEvents=require(_0x01ee('0x0'));var events=[_0x01ee('0x1'),_0x01ee('0x2'),_0x01ee('0x3')];function createListener(_0x57d997,_0x382f3e){return function(_0xccf986){_0x382f3e['emit'](_0x57d997,_0xccf986);};}function removeListener(_0x249bbc,_0x50876f){return function(){WhatsappQueueEvents['removeListener'](_0x249bbc,_0x50876f);};}exports[_0x01ee('0x4')]=function(_0x3da84d){for(var _0x22d1f7=0x0,_0x479bab=events[_0x01ee('0x5')];_0x22d1f7<_0x479bab;_0x22d1f7++){var _0x2f9d0f=events[_0x22d1f7];var _0x18ec3e=createListener(_0x01ee('0x6')+_0x2f9d0f,_0x3da84d);WhatsappQueueEvents['on'](_0x2f9d0f,_0x18ec3e);}}; \ No newline at end of file +var _0xc447=['whatsappQueue:','./whatsappQueue.events','save','update','emit','removeListener'];(function(_0x59cfa8,_0xee08e3){var _0x39a3a9=function(_0x309883){while(--_0x309883){_0x59cfa8['push'](_0x59cfa8['shift']());}};_0x39a3a9(++_0xee08e3);}(_0xc447,0x16f));var _0x7c44=function(_0xcb24f3,_0x4f5989){_0xcb24f3=_0xcb24f3-0x0;var _0x33c5c3=_0xc447[_0xcb24f3];return _0x33c5c3;};'use strict';var WhatsappQueueEvents=require(_0x7c44('0x0'));var events=[_0x7c44('0x1'),'remove',_0x7c44('0x2')];function createListener(_0x52ee7c,_0x6617cd){return function(_0x25650a){_0x6617cd[_0x7c44('0x3')](_0x52ee7c,_0x25650a);};}function removeListener(_0x4c7d9c,_0x46d62f){return function(){WhatsappQueueEvents[_0x7c44('0x4')](_0x4c7d9c,_0x46d62f);};}exports['register']=function(_0x8d2dfd){for(var _0x2062a8=0x0,_0x3f3cae=events['length'];_0x2062a8<_0x3f3cae;_0x2062a8++){var _0x62ef4=events[_0x2062a8];var _0x2bdc9c=createListener(_0x7c44('0x5')+_0x62ef4,_0x8d2dfd);WhatsappQueueEvents['on'](_0x62ef4,_0x2bdc9c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 13b6b7e..de66dd0 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 _0x6c93=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x3e10a2,_0x29262f){var _0x2bba1d=function(_0x4e11f4){while(--_0x4e11f4){_0x3e10a2['push'](_0x3e10a2['shift']());}};_0x2bba1d(++_0x29262f);}(_0x6c93,0x160));var _0x36c9=function(_0x7629e,_0x40c972){_0x7629e=_0x7629e-0x0;var _0x19569b=_0x6c93[_0x7629e];return _0x19569b;};'use strict';var multer=require(_0x36c9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x36c9('0x1'));var express=require(_0x36c9('0x2'));var router=express[_0x36c9('0x3')]();var fs_extra=require(_0x36c9('0x4'));var auth=require(_0x36c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x36c9('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0x36c9('0x7')]('/',auth[_0x36c9('0x8')](),controller[_0x36c9('0x9')]);router[_0x36c9('0x7')](_0x36c9('0xa'),auth[_0x36c9('0x8')](),controller[_0x36c9('0xb')]);router[_0x36c9('0x7')](_0x36c9('0xc'),auth[_0x36c9('0x8')](),controller[_0x36c9('0xd')]);router[_0x36c9('0xe')]('/',auth['isAuthenticated'](),controller[_0x36c9('0xf')]);router['put'](_0x36c9('0xc'),auth[_0x36c9('0x8')](),controller[_0x36c9('0x10')]);router[_0x36c9('0x11')](_0x36c9('0xc'),auth[_0x36c9('0x8')](),controller[_0x36c9('0x12')]);module[_0x36c9('0x13')]=router; \ No newline at end of file +var _0xb73d=['./whatsappQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0xb73d,0xa7));var _0xdb73=function(_0xd913a2,_0x54c8ed){_0xd913a2=_0xd913a2-0x0;var _0x87e189=_0xb73d[_0xd913a2];return _0x87e189;};'use strict';var multer=require(_0xdb73('0x0'));var util=require('util');var path=require(_0xdb73('0x1'));var timeout=require(_0xdb73('0x2'));var express=require(_0xdb73('0x3'));var router=express[_0xdb73('0x4')]();var fs_extra=require(_0xdb73('0x5'));var auth=require(_0xdb73('0x6'));var interaction=require(_0xdb73('0x7'));var config=require(_0xdb73('0x8'));var controller=require(_0xdb73('0x9'));router[_0xdb73('0xa')]('/',auth['isAuthenticated'](),controller[_0xdb73('0xb')]);router['get']('/describe',auth[_0xdb73('0xc')](),controller[_0xdb73('0xd')]);router[_0xdb73('0xa')](_0xdb73('0xe'),auth[_0xdb73('0xc')](),controller[_0xdb73('0xf')]);router[_0xdb73('0x10')]('/',auth[_0xdb73('0xc')](),controller['create']);router[_0xdb73('0x11')](_0xdb73('0xe'),auth[_0xdb73('0xc')](),controller[_0xdb73('0x12')]);router[_0xdb73('0x13')]('/:id',auth[_0xdb73('0xc')](),controller[_0xdb73('0x14')]);module[_0xdb73('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index cdb54d6..9d869fd 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2711c0,_0x48c848){var _0x2bd9f6=function(_0x41cc5e){while(--_0x41cc5e){_0x2711c0['push'](_0x2711c0['shift']());}};_0x2bd9f6(++_0x48c848);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4ba79f,_0x5a193f){var _0x20a5e2=function(_0x1e8c30){while(--_0x1e8c30){_0x4ba79f['push'](_0x4ba79f['shift']());}};_0x20a5e2(++_0x5a193f);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 0c4fb72..9300306 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 _0x7d25=['mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','includeAll','include','rows','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xcf155d,_0x1e15c7){var _0x8473ef=function(_0x264429){while(--_0x264429){_0xcf155d['push'](_0xcf155d['shift']());}};_0x8473ef(++_0x1e15c7);}(_0x7d25,0x8a));var _0x57d2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x7d25[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x3c7de8,_0x452d5e){return function(_0x4363b3){if(!_0x4363b3){_0x3c7de8['sendStatus'](0x194);}return _0x4363b3;};}function handleError(_0x1d203c,_0x608b10){_0x608b10=_0x608b10||0x1f4;return function(_0x995928){logger[_0x57d2('0x26')](_0x995928[_0x57d2('0x27')]);if(_0x995928[_0x57d2('0x28')]){delete _0x995928[_0x57d2('0x28')];}_0x1d203c['status'](_0x608b10)[_0x57d2('0x29')](_0x995928);};}exports[_0x57d2('0x2a')]=function(_0x277426,_0x1fe383){var _0x1957a6={},_0x7c33f3={},_0x1dd6cb={'count':0x0,'rows':[]};var _0x1d3a3a=_[_0x57d2('0x2b')](db[_0x57d2('0x2c')]['rawAttributes'],function(_0x4e9178){return{'name':_0x4e9178[_0x57d2('0x2d')],'type':_0x4e9178[_0x57d2('0x2e')][_0x57d2('0x2f')]};});_0x7c33f3['model']=_[_0x57d2('0x2b')](_0x1d3a3a,_0x57d2('0x28'));_0x7c33f3[_0x57d2('0x30')]=_[_0x57d2('0x31')](_0x277426[_0x57d2('0x30')]);_0x7c33f3[_0x57d2('0x32')]=_[_0x57d2('0x33')](_0x7c33f3[_0x57d2('0x34')],_0x7c33f3[_0x57d2('0x30')]);_0x1957a6['attributes']=_[_0x57d2('0x33')](_0x7c33f3[_0x57d2('0x34')],qs['fields'](_0x277426[_0x57d2('0x30')][_0x57d2('0x35')]));_0x1957a6['attributes']=_0x1957a6[_0x57d2('0x36')][_0x57d2('0x37')]?_0x1957a6[_0x57d2('0x36')]:_0x7c33f3[_0x57d2('0x34')];if(!_0x277426[_0x57d2('0x30')]['hasOwnProperty']('nolimit')){_0x1957a6['limit']=qs['limit'](_0x277426[_0x57d2('0x30')][_0x57d2('0x1e')]);_0x1957a6[_0x57d2('0x1d')]=qs[_0x57d2('0x1d')](_0x277426[_0x57d2('0x30')]['offset']);}_0x1957a6[_0x57d2('0x38')]=qs['sort'](_0x277426[_0x57d2('0x30')][_0x57d2('0x39')]);_0x1957a6[_0x57d2('0x3a')]=qs['filters'](_[_0x57d2('0x3b')](_0x277426[_0x57d2('0x30')],_0x7c33f3['filters']),_0x1d3a3a);if(_0x277426[_0x57d2('0x30')][_0x57d2('0x3c')]){_0x1957a6[_0x57d2('0x3a')]=_[_0x57d2('0x3d')](_0x1957a6[_0x57d2('0x3a')],{'$or':_[_0x57d2('0x2b')](_0x1d3a3a,function(_0x47f379){if(_0x47f379[_0x57d2('0x2e')]!=='VIRTUAL'){var _0x1d3303={};_0x1d3303[_0x47f379[_0x57d2('0x28')]]={'$like':'%'+_0x277426[_0x57d2('0x30')][_0x57d2('0x3c')]+'%'};return _0x1d3303;}})});}_0x1957a6=_[_0x57d2('0x3d')]({},_0x1957a6,_0x277426['options']);var _0x282e6e={'where':_0x1957a6[_0x57d2('0x3a')]};return db['WhatsappQueueReport'][_0x57d2('0x1c')](_0x282e6e)[_0x57d2('0x24')](function(_0x1713bc){_0x1dd6cb['count']=_0x1713bc;if(_0x277426[_0x57d2('0x30')][_0x57d2('0x3e')]){_0x1957a6[_0x57d2('0x3f')]=[{'all':!![]}];}return db[_0x57d2('0x2c')]['findAll'](_0x1957a6);})['then'](function(_0x11a2ec){_0x1dd6cb[_0x57d2('0x40')]=_0x11a2ec;return _0x1dd6cb;})[_0x57d2('0x24')](respondWithFilteredResult(_0x1fe383,_0x1957a6))['catch'](handleError(_0x1fe383,null));};exports['show']=function(_0xebeac5,_0x5116b5){var _0xe42c98={'raw':!![],'where':{'id':_0xebeac5[_0x57d2('0x41')]['id']}},_0x1bb8ad={};_0x1bb8ad[_0x57d2('0x34')]=_[_0x57d2('0x31')](db['WhatsappQueueReport'][_0x57d2('0x42')]);_0x1bb8ad[_0x57d2('0x30')]=_['keys'](_0xebeac5[_0x57d2('0x30')]);_0x1bb8ad['filters']=_[_0x57d2('0x33')](_0x1bb8ad[_0x57d2('0x34')],_0x1bb8ad[_0x57d2('0x30')]);_0xe42c98[_0x57d2('0x36')]=_['intersection'](_0x1bb8ad['model'],qs[_0x57d2('0x35')](_0xebeac5['query']['fields']));_0xe42c98[_0x57d2('0x36')]=_0xe42c98['attributes']['length']?_0xe42c98[_0x57d2('0x36')]:_0x1bb8ad['model'];if(_0xebeac5[_0x57d2('0x30')]['includeAll']){_0xe42c98[_0x57d2('0x3f')]=[{'all':!![]}];}_0xe42c98=_['merge']({},_0xe42c98,_0xebeac5['options']);return db[_0x57d2('0x2c')][_0x57d2('0x43')](_0xe42c98)[_0x57d2('0x24')](handleEntityNotFound(_0x5116b5,null))[_0x57d2('0x24')](respondWithResult(_0x5116b5,null))[_0x57d2('0x44')](handleError(_0x5116b5,null));};exports[_0x57d2('0x45')]=function(_0x4c88dd,_0x4541b2){return db[_0x57d2('0x2c')][_0x57d2('0x45')](_0x4c88dd[_0x57d2('0x46')],{})[_0x57d2('0x24')](respondWithResult(_0x4541b2,0xc9))[_0x57d2('0x44')](handleError(_0x4541b2,null));};exports[_0x57d2('0x23')]=function(_0x406375,_0x51f172){if(_0x406375[_0x57d2('0x46')]['id']){delete _0x406375[_0x57d2('0x46')]['id'];}return db['WhatsappQueueReport'][_0x57d2('0x43')]({'where':{'id':_0x406375['params']['id']}})['then'](handleEntityNotFound(_0x51f172,null))[_0x57d2('0x24')](saveUpdates(_0x406375[_0x57d2('0x46')],null))[_0x57d2('0x24')](respondWithResult(_0x51f172,null))[_0x57d2('0x44')](handleError(_0x51f172,null));};exports['destroy']=function(_0x265d24,_0x176e24){return db['WhatsappQueueReport']['find']({'where':{'id':_0x265d24[_0x57d2('0x41')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x176e24,null))[_0x57d2('0x24')](removeEntity(_0x176e24,null))[_0x57d2('0x44')](handleError(_0x176e24,null));};exports[_0x57d2('0x47')]=function(_0x396220,_0x5a3e86){return db['WhatsappQueueReport']['describe']()[_0x57d2('0x24')](respondWithResult(_0x5a3e86,null))['catch'](handleError(_0x5a3e86,null));}; \ No newline at end of file +var _0xe820=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x409d62,_0x41507c){var _0x2e2d31=function(_0x533658){while(--_0x533658){_0x409d62['push'](_0x409d62['shift']());}};_0x2e2d31(++_0x41507c);}(_0xe820,0xd2));var _0x0e82=function(_0xbdedb9,_0x1d0027){_0xbdedb9=_0xbdedb9-0x0;var _0x1ff27c=_0xe820[_0xbdedb9];return _0x1ff27c;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];function respondWithStatusCode(_0x21c40b,_0x1da28a){_0x1da28a=_0x1da28a||0xcc;return function(_0x166dc2){if(_0x166dc2){return _0x21c40b[_0x0e82('0x18')](_0x1da28a);}return _0x21c40b['status'](_0x1da28a)[_0x0e82('0x19')]();};}function respondWithResult(_0x5c161c,_0x48d99b){_0x48d99b=_0x48d99b||0xc8;return function(_0x1e4ddb){if(_0x1e4ddb){return _0x5c161c['status'](_0x48d99b)['json'](_0x1e4ddb);}};}function respondWithFilteredResult(_0x5a2d28,_0x3298c7){return function(_0x4d1aa0){if(_0x4d1aa0){var _0x585b9b=typeof _0x3298c7[_0x0e82('0x1a')]==='undefined'&&typeof _0x3298c7[_0x0e82('0x1b')]===_0x0e82('0x1c');var _0x233c6d=_0x4d1aa0[_0x0e82('0x1d')];var _0x53622b=_0x585b9b?0x0:_0x3298c7[_0x0e82('0x1a')];var _0x310aac=_0x585b9b?_0x4d1aa0[_0x0e82('0x1d')]:_0x3298c7[_0x0e82('0x1a')]+_0x3298c7[_0x0e82('0x1b')];var _0x1230e6;if(_0x310aac>=_0x233c6d){_0x310aac=_0x233c6d;_0x1230e6=0xc8;}else{_0x1230e6=0xce;}_0x5a2d28[_0x0e82('0x1e')](_0x1230e6);return _0x5a2d28[_0x0e82('0x1f')](_0x0e82('0x20'),_0x53622b+'-'+_0x310aac+'/'+_0x233c6d)[_0x0e82('0x21')](_0x4d1aa0);}return null;};}function patchUpdates(_0x5903c){return function(_0x493280){try{jsonpatch['apply'](_0x493280,_0x5903c,!![]);}catch(_0x294696){return BPromise[_0x0e82('0x22')](_0x294696);}return _0x493280[_0x0e82('0x23')]();};}function saveUpdates(_0xb0a31,_0xd48046){return function(_0x1bdad4){if(_0x1bdad4){return _0x1bdad4[_0x0e82('0x24')](_0xb0a31)[_0x0e82('0x25')](function(_0x56b3ad){return _0x56b3ad;});}return null;};}function removeEntity(_0x1b71b4,_0x13f023){return function(_0x3d6c28){if(_0x3d6c28){return _0x3d6c28[_0x0e82('0x26')]()['then'](function(){_0x1b71b4[_0x0e82('0x1e')](0xcc)[_0x0e82('0x19')]();});}};}function handleEntityNotFound(_0x7a9399,_0x16e11c){return function(_0x4900d3){if(!_0x4900d3){_0x7a9399[_0x0e82('0x18')](0x194);}return _0x4900d3;};}function handleError(_0x51dbcd,_0x595319){_0x595319=_0x595319||0x1f4;return function(_0x384f88){logger[_0x0e82('0x27')](_0x384f88['stack']);if(_0x384f88[_0x0e82('0x28')]){delete _0x384f88[_0x0e82('0x28')];}_0x51dbcd[_0x0e82('0x1e')](_0x595319)['send'](_0x384f88);};}exports[_0x0e82('0x29')]=function(_0x25fa4e,_0x4ee65a){var _0xabc536={},_0x59a5b6={},_0x4300f9={'count':0x0,'rows':[]};var _0x3ec302=_['map'](db[_0x0e82('0x2a')][_0x0e82('0x2b')],function(_0x661718){return{'name':_0x661718['fieldName'],'type':_0x661718['type'][_0x0e82('0x2c')]};});_0x59a5b6['model']=_[_0x0e82('0x2d')](_0x3ec302,'name');_0x59a5b6[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x25fa4e[_0x0e82('0x2e')]);_0x59a5b6['filters']=_[_0x0e82('0x30')](_0x59a5b6['model'],_0x59a5b6[_0x0e82('0x2e')]);_0xabc536[_0x0e82('0x31')]=_[_0x0e82('0x30')](_0x59a5b6[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x25fa4e[_0x0e82('0x2e')]['fields']));_0xabc536[_0x0e82('0x31')]=_0xabc536[_0x0e82('0x31')][_0x0e82('0x34')]?_0xabc536[_0x0e82('0x31')]:_0x59a5b6[_0x0e82('0x32')];if(!_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x35')](_0x0e82('0x36'))){_0xabc536[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x1b')]);_0xabc536[_0x0e82('0x1a')]=qs[_0x0e82('0x1a')](_0x25fa4e[_0x0e82('0x2e')]['offset']);}_0xabc536[_0x0e82('0x37')]=qs[_0x0e82('0x38')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x38')]);_0xabc536['where']=qs[_0x0e82('0x39')](_[_0x0e82('0x3a')](_0x25fa4e['query'],_0x59a5b6[_0x0e82('0x39')]),_0x3ec302);if(_0x25fa4e['query']['filter']){_0xabc536[_0x0e82('0x3b')]=_[_0x0e82('0x3c')](_0xabc536[_0x0e82('0x3b')],{'$or':_[_0x0e82('0x2d')](_0x3ec302,function(_0x61a5ce){if(_0x61a5ce[_0x0e82('0x3d')]!==_0x0e82('0x3e')){var _0x50fed8={};_0x50fed8[_0x61a5ce['name']]={'$like':'%'+_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x3f')]+'%'};return _0x50fed8;}})});}_0xabc536=_[_0x0e82('0x3c')]({},_0xabc536,_0x25fa4e[_0x0e82('0x40')]);var _0x265872={'where':_0xabc536[_0x0e82('0x3b')]};return db[_0x0e82('0x2a')][_0x0e82('0x1d')](_0x265872)['then'](function(_0x3ba181){_0x4300f9[_0x0e82('0x1d')]=_0x3ba181;if(_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x41')]){_0xabc536[_0x0e82('0x42')]=[{'all':!![]}];}return db[_0x0e82('0x2a')][_0x0e82('0x43')](_0xabc536);})['then'](function(_0x311cb8){_0x4300f9[_0x0e82('0x44')]=_0x311cb8;return _0x4300f9;})[_0x0e82('0x25')](respondWithFilteredResult(_0x4ee65a,_0xabc536))[_0x0e82('0x45')](handleError(_0x4ee65a,null));};exports[_0x0e82('0x46')]=function(_0x423b14,_0x453cd3){var _0x50322b={'raw':!![],'where':{'id':_0x423b14['params']['id']}},_0x581764={};_0x581764['model']=_['keys'](db['WhatsappQueueReport'][_0x0e82('0x2b')]);_0x581764[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x423b14[_0x0e82('0x2e')]);_0x581764[_0x0e82('0x39')]=_[_0x0e82('0x30')](_0x581764[_0x0e82('0x32')],_0x581764[_0x0e82('0x2e')]);_0x50322b['attributes']=_['intersection'](_0x581764[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x423b14[_0x0e82('0x2e')][_0x0e82('0x33')]));_0x50322b[_0x0e82('0x31')]=_0x50322b[_0x0e82('0x31')][_0x0e82('0x34')]?_0x50322b[_0x0e82('0x31')]:_0x581764['model'];if(_0x423b14[_0x0e82('0x2e')]['includeAll']){_0x50322b[_0x0e82('0x42')]=[{'all':!![]}];}_0x50322b=_['merge']({},_0x50322b,_0x423b14[_0x0e82('0x40')]);return db['WhatsappQueueReport'][_0x0e82('0x47')](_0x50322b)[_0x0e82('0x25')](handleEntityNotFound(_0x453cd3,null))[_0x0e82('0x25')](respondWithResult(_0x453cd3,null))['catch'](handleError(_0x453cd3,null));};exports['create']=function(_0x331668,_0x132c45){return db[_0x0e82('0x2a')]['create'](_0x331668[_0x0e82('0x48')],{})['then'](respondWithResult(_0x132c45,0xc9))[_0x0e82('0x45')](handleError(_0x132c45,null));};exports[_0x0e82('0x24')]=function(_0x162890,_0x64406e){if(_0x162890[_0x0e82('0x48')]['id']){delete _0x162890[_0x0e82('0x48')]['id'];}return db[_0x0e82('0x2a')][_0x0e82('0x47')]({'where':{'id':_0x162890[_0x0e82('0x49')]['id']}})[_0x0e82('0x25')](handleEntityNotFound(_0x64406e,null))[_0x0e82('0x25')](saveUpdates(_0x162890[_0x0e82('0x48')],null))['then'](respondWithResult(_0x64406e,null))[_0x0e82('0x45')](handleError(_0x64406e,null));};exports[_0x0e82('0x26')]=function(_0x576726,_0x360858){return db['WhatsappQueueReport']['find']({'where':{'id':_0x576726[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x360858,null))[_0x0e82('0x25')](removeEntity(_0x360858,null))[_0x0e82('0x45')](handleError(_0x360858,null));};exports[_0x0e82('0x4a')]=function(_0x149100,_0xdbb813){return db['WhatsappQueueReport'][_0x0e82('0x4a')]()['then'](respondWithResult(_0xdbb813,null))[_0x0e82('0x45')](handleError(_0xdbb813,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ed66bef..5dcc5e6 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 _0x7622=['../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7622,0x11e));var _0x2762=function(_0x4edf34,_0x481dd2){_0x4edf34=_0x4edf34-0x0;var _0x2304f7=_0x7622[_0x4edf34];return _0x2304f7;};'use strict';var _=require(_0x2762('0x0'));var util=require(_0x2762('0x1'));var logger=require(_0x2762('0x2'))(_0x2762('0x3'));var moment=require(_0x2762('0x4'));var BPromise=require('bluebird');var rp=require(_0x2762('0x5'));var fs=require('fs');var path=require(_0x2762('0x6'));var rimraf=require(_0x2762('0x7'));var config=require(_0x2762('0x8'));var attributes=require(_0x2762('0x9'));module['exports']=function(_0x4c8d33,_0x22098c){return _0x4c8d33[_0x2762('0xa')](_0x2762('0xb'),attributes,{'tableName':_0x2762('0xc'),'paranoid':![],'indexes':[{'name':_0x2762('0xd'),'fields':[_0x2762('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaedd=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','../../config/logger'];(function(_0x4d1bee,_0x127e8c){var _0x100df5=function(_0x3f6efa){while(--_0x3f6efa){_0x4d1bee['push'](_0x4d1bee['shift']());}};_0x100df5(++_0x127e8c);}(_0xaedd,0x9a));var _0xdaed=function(_0x4db850,_0x5f00e3){_0x4db850=_0x4db850-0x0;var _0x36fd42=_0xaedd[_0x4db850];return _0x36fd42;};'use strict';var _=require(_0xdaed('0x0'));var util=require('util');var logger=require(_0xdaed('0x1'))(_0xdaed('0x2'));var moment=require(_0xdaed('0x3'));var BPromise=require('bluebird');var rp=require(_0xdaed('0x4'));var fs=require('fs');var path=require(_0xdaed('0x5'));var rimraf=require(_0xdaed('0x6'));var config=require(_0xdaed('0x7'));var attributes=require(_0xdaed('0x8'));module[_0xdaed('0x9')]=function(_0x1e00a7,_0xbeb898){return _0x1e00a7[_0xdaed('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdaed('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ec8f6e4..1cda741 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 _0xef0d=['CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','update','body','options','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueueReport','raw'];(function(_0x49f40a,_0x2497c3){var _0x1d6dcc=function(_0x3a3dec){while(--_0x3a3dec){_0x49f40a['push'](_0x49f40a['shift']());}};_0x1d6dcc(++_0x2497c3);}(_0xef0d,0x6a));var _0xdef0=function(_0x1284de,_0x57e407){_0x1284de=_0x1284de-0x0;var _0xb1fe8c=_0xef0d[_0x1284de];return _0xb1fe8c;};'use strict';var _=require(_0xdef0('0x0'));var util=require(_0xdef0('0x1'));var moment=require('moment');var BPromise=require(_0xdef0('0x2'));var rs=require(_0xdef0('0x3'));var fs=require('fs');var Redis=require(_0xdef0('0x4'));var db=require(_0xdef0('0x5'))['db'];var utils=require(_0xdef0('0x6'));var logger=require(_0xdef0('0x7'))(_0xdef0('0x8'));var config=require(_0xdef0('0x9'));var jayson=require(_0xdef0('0xa'));var client=jayson[_0xdef0('0xb')][_0xdef0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a96f7,_0x442ae5,_0x4d549c){return new BPromise(function(_0x425d8b,_0x10eace){return client['request'](_0x4a96f7,_0x4d549c)[_0xdef0('0xd')](function(_0x22ff44){logger[_0xdef0('0xe')](_0xdef0('0xf'),_0x442ae5,_0xdef0('0x10'));logger[_0xdef0('0x11')](_0xdef0('0x12'),_0x442ae5,_0xdef0('0x10'),JSON[_0xdef0('0x13')](_0x22ff44));if(_0x22ff44['error']){if(_0x22ff44[_0xdef0('0x14')][_0xdef0('0x15')]===0x1f4){logger[_0xdef0('0x14')](_0xdef0('0xf'),_0x442ae5,_0x22ff44[_0xdef0('0x14')][_0xdef0('0x16')]);return _0x10eace(_0x22ff44['error'][_0xdef0('0x16')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x442ae5,_0x22ff44[_0xdef0('0x14')][_0xdef0('0x16')]);return _0x425d8b(_0x22ff44[_0xdef0('0x14')][_0xdef0('0x16')]);}else{logger[_0xdef0('0xe')](_0xdef0('0xf'),_0x442ae5,'request\x20sent');_0x425d8b(_0x22ff44[_0xdef0('0x17')][_0xdef0('0x16')]);}})['catch'](function(_0x5b502d){logger[_0xdef0('0x14')](_0xdef0('0xf'),_0x442ae5,_0x5b502d);_0x10eace(_0x5b502d);});});}exports['CreateWhatsappQueueReport']=function(_0x2f6d82){var _0x2d8e13=this;return new Promise(function(_0x237509,_0x2e64f0){return db[_0xdef0('0x18')]['create'](_0x2f6d82['body'],{'raw':_0x2f6d82['options']?_0x2f6d82['options'][_0xdef0('0x19')]===undefined?!![]:![]:!![]})[_0xdef0('0xd')](function(_0x309011){logger[_0xdef0('0xe')](_0xdef0('0x1a'),_0x2f6d82);logger[_0xdef0('0x11')](_0xdef0('0x1a'),_0x2f6d82,JSON[_0xdef0('0x13')](_0x309011));_0x237509(_0x309011);})[_0xdef0('0x1b')](function(_0x190be2){logger[_0xdef0('0x14')](_0xdef0('0x1a'),_0x190be2[_0xdef0('0x16')],_0x2f6d82);_0x2e64f0(_0x2d8e13[_0xdef0('0x14')](0x1f4,_0x190be2[_0xdef0('0x16')]));});});};exports[_0xdef0('0x1c')]=function(_0x4ca1e7){var _0x3d8e1c=this;return new Promise(function(_0x15acc7,_0x143075){return db[_0xdef0('0x18')][_0xdef0('0x1d')](_0x4ca1e7[_0xdef0('0x1e')],{'raw':_0x4ca1e7[_0xdef0('0x1f')]?_0x4ca1e7[_0xdef0('0x1f')][_0xdef0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ca1e7[_0xdef0('0x1f')]?_0x4ca1e7[_0xdef0('0x1f')]['where']||null:null,'attributes':_0x4ca1e7[_0xdef0('0x1f')]?_0x4ca1e7[_0xdef0('0x1f')]['attributes']||null:null,'limit':_0x4ca1e7['options']?_0x4ca1e7['options'][_0xdef0('0x20')]||null:null})[_0xdef0('0xd')](function(_0x150ac1){logger['info'](_0xdef0('0x1c'),_0x4ca1e7);logger['debug']('UpdateWhatsappQueueReport',_0x4ca1e7,JSON[_0xdef0('0x13')](_0x150ac1));_0x15acc7(_0x150ac1);})[_0xdef0('0x1b')](function(_0x4ab230){logger['error'](_0xdef0('0x1c'),_0x4ab230[_0xdef0('0x16')],_0x4ca1e7);_0x143075(_0x3d8e1c['error'](0x1f4,_0x4ab230[_0xdef0('0x16')]));});});}; \ No newline at end of file +var _0xb6ec=['message','info','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','stringify','catch','UpdateWhatsappQueueReport','update','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','error','code','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x23d8e7,_0x498fec){var _0x212547=function(_0x5a3a6f){while(--_0x5a3a6f){_0x23d8e7['push'](_0x23d8e7['shift']());}};_0x212547(++_0x498fec);}(_0xb6ec,0x1ef));var _0xcb6e=function(_0x3cc640,_0x2db79a){_0x3cc640=_0x3cc640-0x0;var _0x11fab1=_0xb6ec[_0x3cc640];return _0x11fab1;};'use strict';var _=require(_0xcb6e('0x0'));var util=require('util');var moment=require(_0xcb6e('0x1'));var BPromise=require(_0xcb6e('0x2'));var rs=require(_0xcb6e('0x3'));var fs=require('fs');var Redis=require(_0xcb6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb6e('0x5'));var logger=require(_0xcb6e('0x6'))(_0xcb6e('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb6e('0x8'));var client=jayson['client'][_0xcb6e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58adec,_0x95a2c4,_0x51a70f){return new BPromise(function(_0x11e6fa,_0x5c21ec){return client[_0xcb6e('0xa')](_0x58adec,_0x51a70f)[_0xcb6e('0xb')](function(_0x1308b4){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x95a2c4,_0xcb6e('0xc'));logger[_0xcb6e('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x95a2c4,_0xcb6e('0xc'),JSON['stringify'](_0x1308b4));if(_0x1308b4[_0xcb6e('0xe')]){if(_0x1308b4[_0xcb6e('0xe')][_0xcb6e('0xf')]===0x1f4){logger[_0xcb6e('0xe')](_0xcb6e('0x10'),_0x95a2c4,_0x1308b4['error'][_0xcb6e('0x11')]);return _0x5c21ec(_0x1308b4['error'][_0xcb6e('0x11')]);}logger[_0xcb6e('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x95a2c4,_0x1308b4[_0xcb6e('0xe')]['message']);return _0x11e6fa(_0x1308b4[_0xcb6e('0xe')]['message']);}else{logger[_0xcb6e('0x12')](_0xcb6e('0x10'),_0x95a2c4,_0xcb6e('0xc'));_0x11e6fa(_0x1308b4[_0xcb6e('0x13')][_0xcb6e('0x11')]);}})['catch'](function(_0x5cd6d2){logger[_0xcb6e('0xe')](_0xcb6e('0x10'),_0x95a2c4,_0x5cd6d2);_0x5c21ec(_0x5cd6d2);});});}exports[_0xcb6e('0x14')]=function(_0x25b130){var _0x31ef46=this;return new Promise(function(_0x3071a3,_0x5924cc){return db[_0xcb6e('0x15')][_0xcb6e('0x16')](_0x25b130[_0xcb6e('0x17')],{'raw':_0x25b130[_0xcb6e('0x18')]?_0x25b130[_0xcb6e('0x18')][_0xcb6e('0x19')]===undefined?!![]:![]:!![]})[_0xcb6e('0xb')](function(_0x51853e){logger[_0xcb6e('0x12')](_0xcb6e('0x14'),_0x25b130);logger[_0xcb6e('0xd')](_0xcb6e('0x14'),_0x25b130,JSON[_0xcb6e('0x1a')](_0x51853e));_0x3071a3(_0x51853e);})[_0xcb6e('0x1b')](function(_0x4a4857){logger[_0xcb6e('0xe')](_0xcb6e('0x14'),_0x4a4857[_0xcb6e('0x11')],_0x25b130);_0x5924cc(_0x31ef46[_0xcb6e('0xe')](0x1f4,_0x4a4857[_0xcb6e('0x11')]));});});};exports[_0xcb6e('0x1c')]=function(_0x224e88){var _0x4dde07=this;return new Promise(function(_0x8b781d,_0x571bdd){return db[_0xcb6e('0x15')][_0xcb6e('0x1d')](_0x224e88[_0xcb6e('0x17')],{'raw':_0x224e88['options']?_0x224e88[_0xcb6e('0x18')][_0xcb6e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x224e88[_0xcb6e('0x18')]?_0x224e88[_0xcb6e('0x18')][_0xcb6e('0x1e')]||null:null,'attributes':_0x224e88[_0xcb6e('0x18')]?_0x224e88[_0xcb6e('0x18')][_0xcb6e('0x1f')]||null:null,'limit':_0x224e88[_0xcb6e('0x18')]?_0x224e88[_0xcb6e('0x18')]['limit']||null:null})['then'](function(_0x29fefd){logger['info'](_0xcb6e('0x1c'),_0x224e88);logger[_0xcb6e('0xd')](_0xcb6e('0x1c'),_0x224e88,JSON[_0xcb6e('0x1a')](_0x29fefd));_0x8b781d(_0x29fefd);})[_0xcb6e('0x1b')](function(_0x384014){logger['error'](_0xcb6e('0x1c'),_0x384014['message'],_0x224e88);_0x571bdd(_0x4dde07[_0xcb6e('0xe')](0x1f4,_0x384014['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 55c647e..d2331e5 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 _0xa968=['describe','/:id','show','post','create','put','delete','exports','multer','path','express','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xa968,0x88));var _0x8a96=function(_0xc9504b,_0xe2f814){_0xc9504b=_0xc9504b-0x0;var _0x5e6894=_0xa968[_0xc9504b];return _0x5e6894;};'use strict';var multer=require(_0x8a96('0x0'));var util=require('util');var path=require(_0x8a96('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a96('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8a96('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8a96('0x4'));var controller=require(_0x8a96('0x5'));router['get']('/',auth[_0x8a96('0x6')](),controller['index']);router[_0x8a96('0x7')]('/describe',auth[_0x8a96('0x6')](),controller[_0x8a96('0x8')]);router[_0x8a96('0x7')](_0x8a96('0x9'),auth[_0x8a96('0x6')](),controller[_0x8a96('0xa')]);router[_0x8a96('0xb')]('/',auth[_0x8a96('0x6')](),controller[_0x8a96('0xc')]);router[_0x8a96('0xd')](_0x8a96('0x9'),auth[_0x8a96('0x6')](),controller['update']);router[_0x8a96('0xe')](_0x8a96('0x9'),auth[_0x8a96('0x6')](),controller['destroy']);module[_0x8a96('0xf')]=router; \ No newline at end of file +var _0xa3de=['describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0xa3de,0x198));var _0xea3d=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0xa3de[_0x13f980];return _0x27153c;};'use strict';var multer=require(_0xea3d('0x0'));var util=require('util');var path=require(_0xea3d('0x1'));var timeout=require(_0xea3d('0x2'));var express=require('express');var router=express[_0xea3d('0x3')]();var fs_extra=require(_0xea3d('0x4'));var auth=require(_0xea3d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea3d('0x6'));var controller=require(_0xea3d('0x7'));router['get']('/',auth[_0xea3d('0x8')](),controller['index']);router[_0xea3d('0x9')]('/describe',auth[_0xea3d('0x8')](),controller[_0xea3d('0xa')]);router['get'](_0xea3d('0xb'),auth['isAuthenticated'](),controller[_0xea3d('0xc')]);router[_0xea3d('0xd')]('/',auth[_0xea3d('0x8')](),controller['create']);router[_0xea3d('0xe')](_0xea3d('0xb'),auth[_0xea3d('0x8')](),controller[_0xea3d('0xf')]);router[_0xea3d('0x10')](_0xea3d('0xb'),auth[_0xea3d('0x8')](),controller[_0xea3d('0x11')]);module[_0xea3d('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index b594c97..5525876 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 _0xf08c=['exports','STRING','account','agent','queue','DATE','sequelize'];(function(_0xa99637,_0x3dbb51){var _0x59a591=function(_0x5d6325){while(--_0x5d6325){_0xa99637['push'](_0xa99637['shift']());}};_0x59a591(++_0x3dbb51);}(_0xf08c,0xb5));var _0xcf08=function(_0x18c512,_0x115f65){_0x18c512=_0x18c512-0x0;var _0x58fb36=_0xf08c[_0x18c512];return _0x58fb36;};'use strict';var Sequelize=require(_0xcf08('0x0'));module[_0xcf08('0x1')]={'uniqueid':{'type':Sequelize[_0xcf08('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcf08('0x3'),_0xcf08('0x4'),_0xcf08('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xcf08('0x6')]}}; \ No newline at end of file +var _0xd7d1=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x2e4e5b,_0x3093da){var _0x26c748=function(_0x314588){while(--_0x314588){_0x2e4e5b['push'](_0x2e4e5b['shift']());}};_0x26c748(++_0x3093da);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x121ba9,_0x4b38a9){_0x121ba9=_0x121ba9-0x0;var _0x1f341a=_0xd7d1[_0x121ba9];return _0x1f341a;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'uniqueid':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1d7d('0x3')](_0x1d7d('0x4'),_0x1d7d('0x5'),_0x1d7d('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x1d7d('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 68bdaf3..4b144bc 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 _0x2dcf=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js'];(function(_0x4aef35,_0x280312){var _0x5880ce=function(_0x2ca253){while(--_0x2ca253){_0x4aef35['push'](_0x4aef35['shift']());}};_0x5880ce(++_0x280312);}(_0x2dcf,0x1b0));var _0xf2dc=function(_0x34c3ba,_0x4d1f3c){_0x34c3ba=_0x34c3ba-0x0;var _0x1c0a76=_0x2dcf[_0x34c3ba];return _0x1c0a76;};'use strict';var emlformat=require(_0xf2dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2dc('0x1'));var jsonpatch=require(_0xf2dc('0x2'));var rp=require('request-promise');var moment=require(_0xf2dc('0x3'));var BPromise=require(_0xf2dc('0x4'));var Mustache=require('mustache');var util=require(_0xf2dc('0x5'));var path=require(_0xf2dc('0x6'));var sox=require('sox');var csv=require(_0xf2dc('0x7'));var ejs=require(_0xf2dc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf2dc('0x9'));var crypto=require('crypto');var jsforce=require(_0xf2dc('0xa'));var deskjs=require(_0xf2dc('0xb'));var toCsv=require(_0xf2dc('0x7'));var querystring=require(_0xf2dc('0xc'));var Papa=require('papaparse');var Redis=require(_0xf2dc('0xd'));var authService=require(_0xf2dc('0xe'));var qs=require(_0xf2dc('0xf'));var as=require(_0xf2dc('0x10'));var hardwareService=require(_0xf2dc('0x11'));var logger=require(_0xf2dc('0x12'))(_0xf2dc('0x13'));var utils=require(_0xf2dc('0x14'));var config=require(_0xf2dc('0x15'));var licenseUtil=require(_0xf2dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15bd5f,_0x18eac3){_0x18eac3=_0x18eac3||0xcc;return function(_0x1d6137){if(_0x1d6137){return _0x15bd5f[_0xf2dc('0x17')](_0x18eac3);}return _0x15bd5f[_0xf2dc('0x18')](_0x18eac3)['end']();};}function respondWithResult(_0x587062,_0x486538){_0x486538=_0x486538||0xc8;return function(_0x4f337b){if(_0x4f337b){return _0x587062[_0xf2dc('0x18')](_0x486538)[_0xf2dc('0x19')](_0x4f337b);}};}function respondWithFilteredResult(_0x1d28bd,_0x214922){return function(_0x55defa){if(_0x55defa){var _0x4e3d2a=typeof _0x214922[_0xf2dc('0x1a')]==='undefined'&&typeof _0x214922[_0xf2dc('0x1b')]==='undefined';var _0x15858d=_0x55defa[_0xf2dc('0x1c')];var _0x8436f9=_0x4e3d2a?0x0:_0x214922[_0xf2dc('0x1a')];var _0x4c9ab1=_0x4e3d2a?_0x55defa['count']:_0x214922[_0xf2dc('0x1a')]+_0x214922[_0xf2dc('0x1b')];var _0x36228c;if(_0x4c9ab1>=_0x15858d){_0x4c9ab1=_0x15858d;_0x36228c=0xc8;}else{_0x36228c=0xce;}_0x1d28bd[_0xf2dc('0x18')](_0x36228c);return _0x1d28bd[_0xf2dc('0x1d')]('Content-Range',_0x8436f9+'-'+_0x4c9ab1+'/'+_0x15858d)[_0xf2dc('0x19')](_0x55defa);}return null;};}function patchUpdates(_0x197b13){return function(_0x4ea49d){try{jsonpatch[_0xf2dc('0x1e')](_0x4ea49d,_0x197b13,!![]);}catch(_0x1602ac){return BPromise[_0xf2dc('0x1f')](_0x1602ac);}return _0x4ea49d[_0xf2dc('0x20')]();};}function saveUpdates(_0x4ce3e3,_0x33e050){return function(_0x51119e){if(_0x51119e){return _0x51119e[_0xf2dc('0x21')](_0x4ce3e3)[_0xf2dc('0x22')](function(_0x524651){return _0x524651;});}return null;};}function removeEntity(_0xea6038,_0x499139){return function(_0x36c8a3){if(_0x36c8a3){return _0x36c8a3[_0xf2dc('0x23')]()[_0xf2dc('0x22')](function(){_0xea6038[_0xf2dc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef4d1,_0x3a973c){return function(_0x2e2f2c){if(!_0x2e2f2c){_0x3ef4d1['sendStatus'](0x194);}return _0x2e2f2c;};}function handleError(_0x505041,_0x116f09){_0x116f09=_0x116f09||0x1f4;return function(_0x59302d){logger[_0xf2dc('0x24')](_0x59302d['stack']);if(_0x59302d['name']){delete _0x59302d[_0xf2dc('0x25')];}_0x505041[_0xf2dc('0x18')](_0x116f09)[_0xf2dc('0x26')](_0x59302d);};}exports[_0xf2dc('0x27')]=function(_0x3cba46,_0x182752){var _0x2d62ae={},_0x471185={},_0x49052f={'count':0x0,'rows':[]};var _0x528f4f=_[_0xf2dc('0x28')](db[_0xf2dc('0x29')][_0xf2dc('0x2a')],function(_0x3428fc){return{'name':_0x3428fc[_0xf2dc('0x2b')],'type':_0x3428fc[_0xf2dc('0x2c')][_0xf2dc('0x2d')]};});_0x471185['model']=_[_0xf2dc('0x28')](_0x528f4f,'name');_0x471185['query']=_['keys'](_0x3cba46[_0xf2dc('0x2e')]);_0x471185[_0xf2dc('0x2f')]=_[_0xf2dc('0x30')](_0x471185[_0xf2dc('0x31')],_0x471185['query']);_0x2d62ae[_0xf2dc('0x32')]=_[_0xf2dc('0x30')](_0x471185[_0xf2dc('0x31')],qs[_0xf2dc('0x33')](_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x33')]));_0x2d62ae['attributes']=_0x2d62ae[_0xf2dc('0x32')][_0xf2dc('0x34')]?_0x2d62ae[_0xf2dc('0x32')]:_0x471185[_0xf2dc('0x31')];if(!_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x35')](_0xf2dc('0x36'))){_0x2d62ae[_0xf2dc('0x1b')]=qs[_0xf2dc('0x1b')](_0x3cba46['query']['limit']);_0x2d62ae['offset']=qs[_0xf2dc('0x1a')](_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x1a')]);}_0x2d62ae[_0xf2dc('0x37')]=qs[_0xf2dc('0x38')](_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x38')]);_0x2d62ae[_0xf2dc('0x39')]=qs[_0xf2dc('0x2f')](_[_0xf2dc('0x3a')](_0x3cba46[_0xf2dc('0x2e')],_0x471185[_0xf2dc('0x2f')]),_0x528f4f);if(_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x3b')]){_0x2d62ae['where']=_[_0xf2dc('0x3c')](_0x2d62ae[_0xf2dc('0x39')],{'$or':_[_0xf2dc('0x28')](_0x528f4f,function(_0xafc5f9){if(_0xafc5f9['type']!==_0xf2dc('0x3d')){var _0x3280b0={};_0x3280b0[_0xafc5f9[_0xf2dc('0x25')]]={'$like':'%'+_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x3b')]+'%'};return _0x3280b0;}})});}_0x2d62ae=_[_0xf2dc('0x3c')]({},_0x2d62ae,_0x3cba46[_0xf2dc('0x3e')]);var _0x1e6576={'where':_0x2d62ae[_0xf2dc('0x39')]};return db[_0xf2dc('0x29')][_0xf2dc('0x1c')](_0x1e6576)[_0xf2dc('0x22')](function(_0x382b5d){_0x49052f[_0xf2dc('0x1c')]=_0x382b5d;if(_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x3f')]){_0x2d62ae[_0xf2dc('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xf2dc('0x41')](_0x2d62ae);})[_0xf2dc('0x22')](function(_0x8ac447){_0x49052f['rows']=_0x8ac447;return _0x49052f;})[_0xf2dc('0x22')](respondWithFilteredResult(_0x182752,_0x2d62ae))[_0xf2dc('0x42')](handleError(_0x182752,null));};exports[_0xf2dc('0x43')]=function(_0x47d1db,_0x3506a8){var _0x4edfc1={'raw':!![],'where':{'id':_0x47d1db['params']['id']}},_0x108cbe={};_0x108cbe[_0xf2dc('0x31')]=_[_0xf2dc('0x44')](db[_0xf2dc('0x29')]['rawAttributes']);_0x108cbe[_0xf2dc('0x2e')]=_[_0xf2dc('0x44')](_0x47d1db[_0xf2dc('0x2e')]);_0x108cbe[_0xf2dc('0x2f')]=_[_0xf2dc('0x30')](_0x108cbe[_0xf2dc('0x31')],_0x108cbe[_0xf2dc('0x2e')]);_0x4edfc1[_0xf2dc('0x32')]=_[_0xf2dc('0x30')](_0x108cbe['model'],qs[_0xf2dc('0x33')](_0x47d1db[_0xf2dc('0x2e')]['fields']));_0x4edfc1[_0xf2dc('0x32')]=_0x4edfc1['attributes'][_0xf2dc('0x34')]?_0x4edfc1[_0xf2dc('0x32')]:_0x108cbe[_0xf2dc('0x31')];if(_0x47d1db[_0xf2dc('0x2e')][_0xf2dc('0x3f')]){_0x4edfc1[_0xf2dc('0x40')]=[{'all':!![]}];}_0x4edfc1=_[_0xf2dc('0x3c')]({},_0x4edfc1,_0x47d1db[_0xf2dc('0x3e')]);return db['WhatsappTransferReport'][_0xf2dc('0x45')](_0x4edfc1)[_0xf2dc('0x22')](handleEntityNotFound(_0x3506a8,null))['then'](respondWithResult(_0x3506a8,null))['catch'](handleError(_0x3506a8,null));};exports[_0xf2dc('0x46')]=function(_0x21a7be,_0x2e05fb){return db['WhatsappTransferReport'][_0xf2dc('0x46')](_0x21a7be[_0xf2dc('0x47')],{})[_0xf2dc('0x22')](respondWithResult(_0x2e05fb,0xc9))['catch'](handleError(_0x2e05fb,null));};exports['update']=function(_0x51f3e6,_0x51d23a){if(_0x51f3e6['body']['id']){delete _0x51f3e6[_0xf2dc('0x47')]['id'];}return db[_0xf2dc('0x29')]['find']({'where':{'id':_0x51f3e6['params']['id']}})[_0xf2dc('0x22')](handleEntityNotFound(_0x51d23a,null))[_0xf2dc('0x22')](saveUpdates(_0x51f3e6[_0xf2dc('0x47')],null))[_0xf2dc('0x22')](respondWithResult(_0x51d23a,null))[_0xf2dc('0x42')](handleError(_0x51d23a,null));};exports[_0xf2dc('0x23')]=function(_0x448bb2,_0x2d719e){return db['WhatsappTransferReport'][_0xf2dc('0x45')]({'where':{'id':_0x448bb2[_0xf2dc('0x48')]['id']}})[_0xf2dc('0x22')](handleEntityNotFound(_0x2d719e,null))['then'](removeEntity(_0x2d719e,null))[_0xf2dc('0x42')](handleError(_0x2d719e,null));};exports[_0xf2dc('0x49')]=function(_0x33f6c9,_0x1baf94){return db[_0xf2dc('0x29')][_0xf2dc('0x49')]()['then'](respondWithResult(_0x1baf94,null))[_0xf2dc('0x42')](handleError(_0x1baf94,null));}; \ No newline at end of file +var _0xb838=['query','keys','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','include','findAll','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','key','model'];(function(_0x4c9f74,_0x2bf01d){var _0x4ee384=function(_0x9e729c){while(--_0x9e729c){_0x4c9f74['push'](_0x4c9f74['shift']());}};_0x4ee384(++_0x2bf01d);}(_0xb838,0x14b));var _0x8b83=function(_0x2b0208,_0x51a788){_0x2b0208=_0x2b0208-0x0;var _0xdd7e03=_0xb838[_0x2b0208];return _0xdd7e03;};'use strict';var emlformat=require(_0x8b83('0x0'));var rimraf=require(_0x8b83('0x1'));var zipdir=require(_0x8b83('0x2'));var jsonpatch=require(_0x8b83('0x3'));var rp=require(_0x8b83('0x4'));var moment=require(_0x8b83('0x5'));var BPromise=require(_0x8b83('0x6'));var Mustache=require(_0x8b83('0x7'));var util=require(_0x8b83('0x8'));var path=require(_0x8b83('0x9'));var sox=require(_0x8b83('0xa'));var csv=require(_0x8b83('0xb'));var ejs=require(_0x8b83('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b83('0xd'));var squel=require('squel');var crypto=require(_0x8b83('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8b83('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b83('0x10'));var Redis=require(_0x8b83('0x11'));var authService=require(_0x8b83('0x12'));var qs=require(_0x8b83('0x13'));var as=require(_0x8b83('0x14'));var hardwareService=require(_0x8b83('0x15'));var logger=require('../../config/logger')(_0x8b83('0x16'));var utils=require(_0x8b83('0x17'));var config=require(_0x8b83('0x18'));var licenseUtil=require(_0x8b83('0x19'));var db=require(_0x8b83('0x1a'))['db'];function respondWithStatusCode(_0x41faee,_0x1df688){_0x1df688=_0x1df688||0xcc;return function(_0x3df74c){if(_0x3df74c){return _0x41faee[_0x8b83('0x1b')](_0x1df688);}return _0x41faee[_0x8b83('0x1c')](_0x1df688)[_0x8b83('0x1d')]();};}function respondWithResult(_0x238b99,_0x352a4d){_0x352a4d=_0x352a4d||0xc8;return function(_0x5407e9){if(_0x5407e9){return _0x238b99[_0x8b83('0x1c')](_0x352a4d)[_0x8b83('0x1e')](_0x5407e9);}};}function respondWithFilteredResult(_0x5bfa7e,_0xd19fa5){return function(_0x514382){if(_0x514382){var _0x4ed029=typeof _0xd19fa5[_0x8b83('0x1f')]==='undefined'&&typeof _0xd19fa5['limit']==='undefined';var _0x389ddd=_0x514382[_0x8b83('0x20')];var _0x3e5230=_0x4ed029?0x0:_0xd19fa5['offset'];var _0x187b79=_0x4ed029?_0x514382['count']:_0xd19fa5[_0x8b83('0x1f')]+_0xd19fa5['limit'];var _0xf4134a;if(_0x187b79>=_0x389ddd){_0x187b79=_0x389ddd;_0xf4134a=0xc8;}else{_0xf4134a=0xce;}_0x5bfa7e[_0x8b83('0x1c')](_0xf4134a);return _0x5bfa7e[_0x8b83('0x21')](_0x8b83('0x22'),_0x3e5230+'-'+_0x187b79+'/'+_0x389ddd)[_0x8b83('0x1e')](_0x514382);}return null;};}function patchUpdates(_0x45774c){return function(_0xe8eb68){try{jsonpatch[_0x8b83('0x23')](_0xe8eb68,_0x45774c,!![]);}catch(_0x42e9b6){return BPromise[_0x8b83('0x24')](_0x42e9b6);}return _0xe8eb68[_0x8b83('0x25')]();};}function saveUpdates(_0x5b83d2,_0x4cbe4f){return function(_0x5a9a85){if(_0x5a9a85){return _0x5a9a85[_0x8b83('0x26')](_0x5b83d2)[_0x8b83('0x27')](function(_0x3bb867){return _0x3bb867;});}return null;};}function removeEntity(_0x40548b,_0x2bd977){return function(_0x224473){if(_0x224473){return _0x224473['destroy']()[_0x8b83('0x27')](function(){_0x40548b[_0x8b83('0x1c')](0xcc)[_0x8b83('0x1d')]();});}};}function handleEntityNotFound(_0x4bd88f,_0x5484ca){return function(_0x5ba326){if(!_0x5ba326){_0x4bd88f[_0x8b83('0x1b')](0x194);}return _0x5ba326;};}function handleError(_0x3ad030,_0x2068eb){_0x2068eb=_0x2068eb||0x1f4;return function(_0x3f1d45){logger[_0x8b83('0x28')](_0x3f1d45[_0x8b83('0x29')]);if(_0x3f1d45[_0x8b83('0x2a')]){delete _0x3f1d45[_0x8b83('0x2a')];}_0x3ad030[_0x8b83('0x1c')](_0x2068eb)['send'](_0x3f1d45);};}exports[_0x8b83('0x2b')]=function(_0x533c83,_0x106d00){var _0x240ea5={},_0x4fed30={},_0x57619e={'count':0x0,'rows':[]};var _0x1e6610=_[_0x8b83('0x2c')](db['WhatsappTransferReport'][_0x8b83('0x2d')],function(_0x3fc375){return{'name':_0x3fc375[_0x8b83('0x2e')],'type':_0x3fc375['type'][_0x8b83('0x2f')]};});_0x4fed30[_0x8b83('0x30')]=_[_0x8b83('0x2c')](_0x1e6610,_0x8b83('0x2a'));_0x4fed30[_0x8b83('0x31')]=_[_0x8b83('0x32')](_0x533c83[_0x8b83('0x31')]);_0x4fed30[_0x8b83('0x33')]=_[_0x8b83('0x34')](_0x4fed30['model'],_0x4fed30['query']);_0x240ea5['attributes']=_[_0x8b83('0x34')](_0x4fed30['model'],qs[_0x8b83('0x35')](_0x533c83[_0x8b83('0x31')][_0x8b83('0x35')]));_0x240ea5[_0x8b83('0x36')]=_0x240ea5['attributes'][_0x8b83('0x37')]?_0x240ea5[_0x8b83('0x36')]:_0x4fed30[_0x8b83('0x30')];if(!_0x533c83['query']['hasOwnProperty'](_0x8b83('0x38'))){_0x240ea5[_0x8b83('0x39')]=qs[_0x8b83('0x39')](_0x533c83['query'][_0x8b83('0x39')]);_0x240ea5[_0x8b83('0x1f')]=qs[_0x8b83('0x1f')](_0x533c83['query']['offset']);}_0x240ea5['order']=qs[_0x8b83('0x3a')](_0x533c83[_0x8b83('0x31')][_0x8b83('0x3a')]);_0x240ea5[_0x8b83('0x3b')]=qs['filters'](_[_0x8b83('0x3c')](_0x533c83['query'],_0x4fed30[_0x8b83('0x33')]),_0x1e6610);if(_0x533c83[_0x8b83('0x31')][_0x8b83('0x3d')]){_0x240ea5[_0x8b83('0x3b')]=_[_0x8b83('0x3e')](_0x240ea5[_0x8b83('0x3b')],{'$or':_['map'](_0x1e6610,function(_0x7cadeb){if(_0x7cadeb['type']!==_0x8b83('0x3f')){var _0x373cb8={};_0x373cb8[_0x7cadeb[_0x8b83('0x2a')]]={'$like':'%'+_0x533c83[_0x8b83('0x31')][_0x8b83('0x3d')]+'%'};return _0x373cb8;}})});}_0x240ea5=_[_0x8b83('0x3e')]({},_0x240ea5,_0x533c83[_0x8b83('0x40')]);var _0x5dc7fe={'where':_0x240ea5['where']};return db[_0x8b83('0x41')][_0x8b83('0x20')](_0x5dc7fe)[_0x8b83('0x27')](function(_0x242179){_0x57619e['count']=_0x242179;if(_0x533c83[_0x8b83('0x31')][_0x8b83('0x42')]){_0x240ea5[_0x8b83('0x43')]=[{'all':!![]}];}return db[_0x8b83('0x41')][_0x8b83('0x44')](_0x240ea5);})[_0x8b83('0x27')](function(_0x39c531){_0x57619e['rows']=_0x39c531;return _0x57619e;})[_0x8b83('0x27')](respondWithFilteredResult(_0x106d00,_0x240ea5))['catch'](handleError(_0x106d00,null));};exports[_0x8b83('0x45')]=function(_0x46436a,_0x167832){var _0xc60cdf={'raw':!![],'where':{'id':_0x46436a[_0x8b83('0x46')]['id']}},_0x151ddc={};_0x151ddc[_0x8b83('0x30')]=_[_0x8b83('0x32')](db['WhatsappTransferReport'][_0x8b83('0x2d')]);_0x151ddc[_0x8b83('0x31')]=_[_0x8b83('0x32')](_0x46436a[_0x8b83('0x31')]);_0x151ddc[_0x8b83('0x33')]=_[_0x8b83('0x34')](_0x151ddc[_0x8b83('0x30')],_0x151ddc[_0x8b83('0x31')]);_0xc60cdf['attributes']=_[_0x8b83('0x34')](_0x151ddc[_0x8b83('0x30')],qs[_0x8b83('0x35')](_0x46436a[_0x8b83('0x31')][_0x8b83('0x35')]));_0xc60cdf[_0x8b83('0x36')]=_0xc60cdf[_0x8b83('0x36')][_0x8b83('0x37')]?_0xc60cdf['attributes']:_0x151ddc['model'];if(_0x46436a[_0x8b83('0x31')][_0x8b83('0x42')]){_0xc60cdf['include']=[{'all':!![]}];}_0xc60cdf=_[_0x8b83('0x3e')]({},_0xc60cdf,_0x46436a[_0x8b83('0x40')]);return db[_0x8b83('0x41')]['find'](_0xc60cdf)[_0x8b83('0x27')](handleEntityNotFound(_0x167832,null))[_0x8b83('0x27')](respondWithResult(_0x167832,null))[_0x8b83('0x47')](handleError(_0x167832,null));};exports[_0x8b83('0x48')]=function(_0x8b8ebc,_0x20fde5){return db[_0x8b83('0x41')][_0x8b83('0x48')](_0x8b8ebc[_0x8b83('0x49')],{})['then'](respondWithResult(_0x20fde5,0xc9))[_0x8b83('0x47')](handleError(_0x20fde5,null));};exports[_0x8b83('0x26')]=function(_0x118a7f,_0x3c400f){if(_0x118a7f['body']['id']){delete _0x118a7f['body']['id'];}return db[_0x8b83('0x41')][_0x8b83('0x4a')]({'where':{'id':_0x118a7f[_0x8b83('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c400f,null))['then'](saveUpdates(_0x118a7f[_0x8b83('0x49')],null))['then'](respondWithResult(_0x3c400f,null))[_0x8b83('0x47')](handleError(_0x3c400f,null));};exports['destroy']=function(_0x873521,_0x53ad6){return db[_0x8b83('0x41')]['find']({'where':{'id':_0x873521[_0x8b83('0x46')]['id']}})[_0x8b83('0x27')](handleEntityNotFound(_0x53ad6,null))[_0x8b83('0x27')](removeEntity(_0x53ad6,null))['catch'](handleError(_0x53ad6,null));};exports[_0x8b83('0x4b')]=function(_0x24c302,_0x360229){return db[_0x8b83('0x41')][_0x8b83('0x4b')]()[_0x8b83('0x27')](respondWithResult(_0x360229,null))[_0x8b83('0x47')](handleError(_0x360229,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index dba0369..d100f4f 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 _0x26b0=['bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x4c3ac3,_0x7177d8){var _0xd7ff02=function(_0x5b9ac8){while(--_0x5b9ac8){_0x4c3ac3['push'](_0x4c3ac3['shift']());}};_0xd7ff02(++_0x7177d8);}(_0x26b0,0x14e));var _0x026b=function(_0x2e23f7,_0x35f041){_0x2e23f7=_0x2e23f7-0x0;var _0x436114=_0x26b0[_0x2e23f7];return _0x436114;};'use strict';var _=require(_0x026b('0x0'));var util=require(_0x026b('0x1'));var logger=require(_0x026b('0x2'))('api');var moment=require(_0x026b('0x3'));var BPromise=require(_0x026b('0x4'));var rp=require(_0x026b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x026b('0x6'));var config=require(_0x026b('0x7'));var attributes=require(_0x026b('0x8'));module[_0x026b('0x9')]=function(_0x3436be,_0x38a6ff){return _0x3436be[_0x026b('0xa')](_0x026b('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x026b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd8=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcdd8,0x15b));var _0x8cdd=function(_0x1ccbbe,_0x324cfa){_0x1ccbbe=_0x1ccbbe-0x0;var _0x56a61e=_0xcdd8[_0x1ccbbe];return _0x56a61e;};'use strict';var _=require(_0x8cdd('0x0'));var util=require(_0x8cdd('0x1'));var logger=require(_0x8cdd('0x2'))(_0x8cdd('0x3'));var moment=require(_0x8cdd('0x4'));var BPromise=require(_0x8cdd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cdd('0x6'));var rimraf=require(_0x8cdd('0x7'));var config=require(_0x8cdd('0x8'));var attributes=require(_0x8cdd('0x9'));module[_0x8cdd('0xa')]=function(_0x12ebd6,_0x527035){return _0x12ebd6[_0x8cdd('0xb')](_0x8cdd('0xc'),attributes,{'tableName':_0x8cdd('0xd'),'paranoid':![],'indexes':[{'name':_0x8cdd('0xe'),'fields':[_0x8cdd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 83db10f..9e13d59 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 _0x5d65=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2a3847,_0x1b512c){var _0xeb305=function(_0x108523){while(--_0x108523){_0x2a3847['push'](_0x2a3847['shift']());}};_0xeb305(++_0x1b512c);}(_0x5d65,0x1f2));var _0x55d6=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x5d65[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x55d6('0x0'));var util=require(_0x55d6('0x1'));var moment=require(_0x55d6('0x2'));var BPromise=require(_0x55d6('0x3'));var rs=require(_0x55d6('0x4'));var fs=require('fs');var Redis=require(_0x55d6('0x5'));var db=require(_0x55d6('0x6'))['db'];var utils=require(_0x55d6('0x7'));var logger=require(_0x55d6('0x8'))(_0x55d6('0x9'));var config=require(_0x55d6('0xa'));var jayson=require(_0x55d6('0xb'));var client=jayson['client'][_0x55d6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dc5b9,_0x269ba2,_0x2069f2){return new BPromise(function(_0x2f4b3d,_0x9a19f9){return client['request'](_0x5dc5b9,_0x2069f2)['then'](function(_0x1438ef){logger[_0x55d6('0xd')](_0x55d6('0xe'),_0x269ba2,'request\x20sent');logger[_0x55d6('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x269ba2,_0x55d6('0x10'),JSON[_0x55d6('0x11')](_0x1438ef));if(_0x1438ef[_0x55d6('0x12')]){if(_0x1438ef[_0x55d6('0x12')][_0x55d6('0x13')]===0x1f4){logger[_0x55d6('0x12')](_0x55d6('0xe'),_0x269ba2,_0x1438ef['error']['message']);return _0x9a19f9(_0x1438ef['error'][_0x55d6('0x14')]);}logger[_0x55d6('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x269ba2,_0x1438ef[_0x55d6('0x12')]['message']);return _0x2f4b3d(_0x1438ef['error'][_0x55d6('0x14')]);}else{logger[_0x55d6('0xd')](_0x55d6('0xe'),_0x269ba2,_0x55d6('0x10'));_0x2f4b3d(_0x1438ef[_0x55d6('0x15')][_0x55d6('0x14')]);}})[_0x55d6('0x16')](function(_0xd829f5){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x269ba2,_0xd829f5);_0x9a19f9(_0xd829f5);});});} \ No newline at end of file +var _0x47fa=['then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x483e77,_0x433e9b){var _0x359df0=function(_0x3c3d57){while(--_0x3c3d57){_0x483e77['push'](_0x483e77['shift']());}};_0x359df0(++_0x433e9b);}(_0x47fa,0x68));var _0xa47f=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x47fa[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0xa47f('0x0'));var util=require(_0xa47f('0x1'));var moment=require(_0xa47f('0x2'));var BPromise=require(_0xa47f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa47f('0x4'));var db=require(_0xa47f('0x5'))['db'];var utils=require(_0xa47f('0x6'));var logger=require(_0xa47f('0x7'))(_0xa47f('0x8'));var config=require('../../config/environment');var jayson=require(_0xa47f('0x9'));var client=jayson[_0xa47f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e3907,_0x45b3c3,_0x34d1cf){return new BPromise(function(_0x5afbce,_0x47d84f){return client['request'](_0x1e3907,_0x34d1cf)[_0xa47f('0xb')](function(_0x465323){logger['info'](_0xa47f('0xc'),_0x45b3c3,_0xa47f('0xd'));logger[_0xa47f('0xe')](_0xa47f('0xf'),_0x45b3c3,_0xa47f('0xd'),JSON[_0xa47f('0x10')](_0x465323));if(_0x465323['error']){if(_0x465323[_0xa47f('0x11')][_0xa47f('0x12')]===0x1f4){logger[_0xa47f('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x45b3c3,_0x465323['error']['message']);return _0x47d84f(_0x465323[_0xa47f('0x11')][_0xa47f('0x13')]);}logger[_0xa47f('0x11')](_0xa47f('0xc'),_0x45b3c3,_0x465323[_0xa47f('0x11')][_0xa47f('0x13')]);return _0x5afbce(_0x465323[_0xa47f('0x11')]['message']);}else{logger[_0xa47f('0x14')](_0xa47f('0xc'),_0x45b3c3,'request\x20sent');_0x5afbce(_0x465323[_0xa47f('0x15')][_0xa47f('0x13')]);}})[_0xa47f('0x16')](function(_0x3d93c9){logger[_0xa47f('0x11')](_0xa47f('0xc'),_0x45b3c3,_0x3d93c9);_0x47d84f(_0x3d93c9);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e8fd64b..ba76817 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0738=['./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status','join','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule'];(function(_0x3e5ee7,_0x148db7){var _0x3fe720=function(_0x5952ba){while(--_0x5952ba){_0x3e5ee7['push'](_0x3e5ee7['shift']());}};_0x3fe720(++_0x148db7);}(_0x0738,0x6e));var _0x8073=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x0738[_0x1b70e3];return _0x1452ab;};'use strict';var _=require(_0x8073('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x8073('0x1'));var checkLicense=require(_0x8073('0x2'));var rpc=require(_0x8073('0x3'));var config=require(_0x8073('0x4'));var logger=require(_0x8073('0x5'))(_0x8073('0x6'));var pm2=require(_0x8073('0x7'));var pm2Config=require(_0x8073('0x8'));var schedule=require(_0x8073('0x9'));var chat=require(_0x8073('0xa'));var whatsapp=require(_0x8073('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x8073('0xc'));function main(){return db[_0x8073('0xd')][_0x8073('0xe')]()[_0x8073('0xf')](function(){if(config[_0x8073('0x10')]){return seedDb[_0x8073('0x11')]();}})[_0x8073('0xf')](function(){return checkLicense[_0x8073('0x11')]();})[_0x8073('0xf')](function(){return rpc['listen']();})['then'](function(_0x28e17b){logger[_0x8073('0x12')](_0x28e17b);return chat[_0x8073('0x13')]();})[_0x8073('0xf')](function(){return whatsapp['start']();})[_0x8073('0xf')](function(){return schedule[_0x8073('0x13')]();})['then'](function(){return transcribe[_0x8073('0x13')]();})['then'](function(){return provider[_0x8073('0x13')]();})[_0x8073('0xf')](function(_0x10c69a){logger[_0x8073('0x12')](_0x10c69a);return pm2['start'](pm2Config);})[_0x8073('0xf')](function(_0x459644){var _0x116aa=_0x459644[_0x8073('0x14')](function(_0x2ec7af){return typeof _0x2ec7af[_0x8073('0x15')]===_0x8073('0x16')&&_0x2ec7af['exitCode']>=0x0;});if(_0x116aa[_0x8073('0x17')]>0x0){throw new Error(_0x116aa['length']+_0x8073('0x18')+_[_0x8073('0x19')](_0x116aa,function(_0x1d1541){return'\x22'+_0x1d1541[_0x8073('0x1a')][_0x8073('0x1b')]+'\x22';}));}logger[_0x8073('0x12')](_0x8073('0x1c'),_[_0x8073('0x19')](_[_0x8073('0x14')](_0x459644,{'status':_0x8073('0x1d')}),'name')['join']());logger[_0x8073('0x12')](_0x8073('0x1e'),_['map'](_[_0x8073('0x14')](_0x459644,function(_0x3e4395){return _0x3e4395[_0x8073('0x1f')]!==_0x8073('0x1d');}),_0x8073('0x1b'))[_0x8073('0x20')]()||_0x8073('0x21'));console['log'](_0x8073('0x22'));})['catch'](function(_0x24b515){console[_0x8073('0x23')](_0x8073('0x24'),_0x24b515);logger[_0x8073('0x25')](_0x8073('0x26'),_0x24b515);process[_0x8073('0x27')](0x1);});}main(); \ No newline at end of file +var _0x446c=['exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','seedDB','default','listen','start','info','filter'];(function(_0x417d27,_0x1e58fb){var _0x1a660a=function(_0x2b4d36){while(--_0x2b4d36){_0x417d27['push'](_0x417d27['shift']());}};_0x1a660a(++_0x1e58fb);}(_0x446c,0x156));var _0xc446=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0x446c[_0x41cfd4];return _0x190f48;};'use strict';var _=require(_0xc446('0x0'));var db=require(_0xc446('0x1'))['db'];var seedDb=require(_0xc446('0x2'));var checkLicense=require(_0xc446('0x3'));var rpc=require('./rpc');var config=require(_0xc446('0x4'));var logger=require(_0xc446('0x5'))(_0xc446('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0xc446('0x7'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require(_0xc446('0x8'));var transcribe=require(_0xc446('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize'][_0xc446('0xa')]()[_0xc446('0xb')](function(){if(config[_0xc446('0xc')]){return seedDb[_0xc446('0xd')]();}})[_0xc446('0xb')](function(){return checkLicense['default']();})[_0xc446('0xb')](function(){return rpc[_0xc446('0xe')]();})[_0xc446('0xb')](function(_0x3783d9){logger['info'](_0x3783d9);return chat[_0xc446('0xf')]();})[_0xc446('0xb')](function(){return whatsapp[_0xc446('0xf')]();})[_0xc446('0xb')](function(){return schedule[_0xc446('0xf')]();})[_0xc446('0xb')](function(){return transcribe[_0xc446('0xf')]();})[_0xc446('0xb')](function(){return provider[_0xc446('0xf')]();})[_0xc446('0xb')](function(_0x89a7){logger[_0xc446('0x10')](_0x89a7);return pm2[_0xc446('0xf')](pm2Config);})[_0xc446('0xb')](function(_0x21d8e4){var _0x20afd7=_0x21d8e4[_0xc446('0x11')](function(_0x20e51b){return typeof _0x20e51b[_0xc446('0x12')]==='number'&&_0x20e51b[_0xc446('0x12')]>=0x0;});if(_0x20afd7[_0xc446('0x13')]>0x0){throw new Error(_0x20afd7[_0xc446('0x13')]+_0xc446('0x14')+_[_0xc446('0x15')](_0x20afd7,function(_0x274040){return'\x22'+_0x274040[_0xc446('0x16')][_0xc446('0x17')]+'\x22';}));}logger[_0xc446('0x10')](_0xc446('0x18'),_['map'](_[_0xc446('0x11')](_0x21d8e4,{'status':_0xc446('0x19')}),'name')[_0xc446('0x1a')]());logger[_0xc446('0x10')](_0xc446('0x1b'),_[_0xc446('0x15')](_[_0xc446('0x11')](_0x21d8e4,function(_0x37108c){return _0x37108c[_0xc446('0x1c')]!==_0xc446('0x19');}),_0xc446('0x17'))[_0xc446('0x1a')]()||'None');console[_0xc446('0x1d')](_0xc446('0x1e'));})[_0xc446('0x1f')](function(_0x5bbde7){console[_0xc446('0x1d')](_0xc446('0x20'),_0x5bbde7);logger[_0xc446('0x21')](_0xc446('0x22'),_0x5bbde7);process[_0xc446('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index fcb400e..b2a3b41 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 _0x9d36=['toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','promisify','sign','secret','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','role','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','use','ChatInteraction','findOne','params','closed','then','query','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','pass','Wrong\x20credentials.','user','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','redirect','/dashboards/general','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split'];(function(_0x576771,_0x2db682){var _0x3b64af=function(_0x3b997c){while(--_0x3b997c){_0x576771['push'](_0x576771['shift']());}};_0x3b64af(++_0x2db682);}(_0x9d36,0x9b));var _0x69d3=function(_0x61e66c,_0x54a018){_0x61e66c=_0x61e66c-0x0;var _0xa491e7=_0x9d36[_0x61e66c];return _0xa491e7;};'use strict';var db=require(_0x69d3('0x0'))['db'];var config=require(_0x69d3('0x1'));var hardwareConf=require(_0x69d3('0x2'));var licenseUtil=require(_0x69d3('0x3'));var encryptor=require(_0x69d3('0x4'));var _=require('lodash');var jwt=require(_0x69d3('0x5'));var expressJwt=require(_0x69d3('0x6'));var compose=require(_0x69d3('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x69d3('0x8'));var BPromise=require(_0x69d3('0x9'));var util=require(_0x69d3('0xa'));var moment=require(_0x69d3('0xb'));var validateJwt=expressJwt({'secret':config[_0x69d3('0xc')]['session']});var userAttributes=['id',_0x69d3('0xd'),'fullname',_0x69d3('0xe'),_0x69d3('0xf'),_0x69d3('0x10'),_0x69d3('0x11'),_0x69d3('0x12'),_0x69d3('0x13'),_0x69d3('0x14'),_0x69d3('0x15'),_0x69d3('0x16'),_0x69d3('0x17'),_0x69d3('0x18'),_0x69d3('0x19'),'pauseType',_0x69d3('0x1a'),_0x69d3('0x1b'),_0x69d3('0x1c'),_0x69d3('0x1d'),_0x69d3('0x1e'),_0x69d3('0x1f'),'alias','phoneBarAutoAnswer',_0x69d3('0x20'),_0x69d3('0x21'),_0x69d3('0x22'),_0x69d3('0x23'),_0x69d3('0x24'),_0x69d3('0x25'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x69d3('0x26'),'hotdesk',_0x69d3('0x27'),_0x69d3('0x28'),_0x69d3('0x29'),'settingsEnabled',_0x69d3('0x2a'),'downloadVoiceRecordings',_0x69d3('0x2b'),'downloadAttachments',_0x69d3('0x2c'),'selectRecallMeCampaign',_0x69d3('0x2d'),_0x69d3('0x2e'),'emailAutoanswer',_0x69d3('0x2f'),'smsAutoanswer',_0x69d3('0x30'),_0x69d3('0x31'),_0x69d3('0x32'),'faxAutoanswer',_0x69d3('0x33'),_0x69d3('0x34'),_0x69d3('0x35'),_0x69d3('0x36')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x69d3('0x37')](function(_0x138952,_0x314432,_0x5d84a0){if(_0x138952['user']){_0x5d84a0();}else{return db[_0x69d3('0x38')][_0x69d3('0x39')]({'where':{'id':_0x138952[_0x69d3('0x3a')]['id']},'attributes':['id',_0x69d3('0x3b'),'disposition'],'raw':!![]})[_0x69d3('0x3c')](function(_0x115e16){if(_0x115e16&&_0x115e16[_0x69d3('0x3b')]&&!_0x138952[_0x69d3('0x3d')]['forceDownload']){return _0x314432[_0x69d3('0x3e')](_0x115e16[_0x69d3('0x3f')]===_0x69d3('0x40')?0x195:0x193)[_0x69d3('0x41')]({'message':_0x115e16[_0x69d3('0x3f')]===_0x69d3('0x40')?_0x69d3('0x42'):_0x69d3('0x43')});}else{_0x5d84a0();}})[_0x69d3('0x44')](function(_0x4a7b71){_0x5d84a0(_0x4a7b71);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5e1ffb){return compose()['use'](function(_0x2aa92d,_0x4af6c4,_0x362ef0){var _0x4f1f09;if(_0x2aa92d[_0x69d3('0x45')][_0x69d3('0x46')]){if(_[_0x69d3('0x47')](_0x2aa92d[_0x69d3('0x45')][_0x69d3('0x46')],_0x69d3('0x48'))){var _0x57efbf=basicAuth(_0x2aa92d);db[_0x69d3('0x49')]['find']({'where':{'name':_0x57efbf[_0x69d3('0xe')]}})[_0x69d3('0x3c')](function(_0x57bbbb){if(!_0x57bbbb||!_0x57bbbb[_0x69d3('0x4a')](_0x57efbf[_0x69d3('0x4b')])){return _0x4af6c4['status'](0x191)[_0x69d3('0x41')]({'message':_0x69d3('0x4c')});}_0x2aa92d[_0x69d3('0x4d')]={'id':_0x57bbbb['id']};_0x362ef0();})[_0x69d3('0x44')](function(_0x585650){_0x362ef0(_0x585650);});}else if(_[_0x69d3('0x47')](_0x2aa92d[_0x69d3('0x45')][_0x69d3('0x46')],'Bearer')){validateJwt(_0x2aa92d,_0x4af6c4,_0x362ef0);}else{if(_0x5e1ffb){_0x362ef0();}else{return _0x4af6c4[_0x69d3('0x3e')](0x193)[_0x69d3('0x41')]({'message':_0x69d3('0x4e')});}}}else if(_0x2aa92d[_0x69d3('0x3d')][_0x69d3('0x4f')]){try{var _0x395fd1={'audience':hardwareConf[_0x69d3('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x2aa92d['query']['apikey'],_0x395fd1)['then'](function(_0x495d0a){return db['User'][_0x69d3('0x51')]({'where':{'id':_0x495d0a[_0x69d3('0x52')]}})['then'](function(_0x4c9324){_0x4f1f09=_0x4c9324;return db['Setting'][_0x69d3('0x39')]({'where':{'id':0x1},'attributes':[_0x69d3('0x53'),_0x69d3('0x54')],'raw':!![]});})['then'](function(_0x1e0e80){if(!_0x4f1f09||!_['isEqual'](_0x4f1f09[_0x69d3('0x55')],_0x495d0a[_0x69d3('0x56')])){return _0x4af6c4[_0x69d3('0x3e')](0x191)[_0x69d3('0x41')]({'message':_0x69d3('0x57')});}if(_0x4f1f09[_0x69d3('0x58')]){return _0x4af6c4[_0x69d3('0x3e')](0x191)[_0x69d3('0x41')]({'message':_0x69d3('0x59')});}if(_0x4f1f09[_0x69d3('0x5a')]){if(_0x1e0e80[_0x69d3('0x54')]>0x0){if(moment(_0x4f1f09['blockedAt'])[_0x69d3('0x5b')](_0x1e0e80[_0x69d3('0x54')],_0x69d3('0x5c'))>moment()){return _0x4af6c4['status'](0x191)[_0x69d3('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4af6c4[_0x69d3('0x3e')](0x191)[_0x69d3('0x41')]({'message':_0x69d3('0x59')});}}_0x2aa92d[_0x69d3('0x4d')]={'id':_0x4f1f09['id']};_0x362ef0();});})[_0x69d3('0x44')](function(){return _0x4af6c4[_0x69d3('0x3e')](0x191)[_0x69d3('0x41')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x801daa){_0x362ef0(_0x801daa);}}else if(_0x5e1ffb){_0x362ef0();}else{return _0x4af6c4[_0x69d3('0x3e')](0x193)[_0x69d3('0x41')]({'message':_0x69d3('0x4e')});}})['use'](function(_0x1efdd5,_0x51c8e7,_0x443b4d){if(_0x1efdd5[_0x69d3('0x4d')]){db[_0x69d3('0x49')]['find']({'where':{'id':_0x1efdd5[_0x69d3('0x4d')]['id']},'attributes':userAttributes})[_0x69d3('0x3c')](function(_0x53e759){if(!_0x53e759){return _0x51c8e7['status'](0x194)[_0x69d3('0x41')]({'message':'User\x20not\x20found.'});}_0x1efdd5[_0x69d3('0x4d')]=_0x53e759;_0x443b4d();})[_0x69d3('0x44')](function(_0x5dd6aa){_0x443b4d(_0x5dd6aa);});}else if(_0x5e1ffb){_0x443b4d();}else{return _0x51c8e7[_0x69d3('0x3e')](0x194)[_0x69d3('0x41')]({'message':_0x69d3('0x5d')});}});};exports[_0x69d3('0x5e')]=function canUpdate(){return compose()['use'](function(_0x1984e2,_0x210634,_0x53a32d){return licenseUtil[_0x69d3('0x5f')]()['then'](function(_0x171655){if(_0x171655[_0x69d3('0x60')]){_0x53a32d();}else{return _0x210634[_0x69d3('0x3e')](0x193)[_0x69d3('0x41')]({'message':_0x69d3('0x61')});}})[_0x69d3('0x44')](function(_0x406b6b){_0x53a32d(_0x406b6b);});});};exports[_0x69d3('0x62')]=function isWebrtcLicence(){return compose()[_0x69d3('0x37')](function(_0x186427,_0x223f27,_0x4d26c1){return licenseUtil['getLicense']()[_0x69d3('0x3c')](function(_0x1ead26){if(_0x1ead26[_0x69d3('0x63')]){_0x4d26c1();}else{return _0x223f27[_0x69d3('0x3e')](0x193)['json']({'message':_0x69d3('0x61')});}})[_0x69d3('0x44')](function(_0x41de0a){_0x4d26c1(_0x41de0a);});});};exports[_0x69d3('0x64')]=function(_0x149d44,_0x4c141e,_0x113df3){_0x149d44['isMiddleware']=!![];return _0x113df3();};exports[_0x69d3('0x65')]=function signToken(_0x2e10ad){return signJwt(_0x2e10ad);};exports[_0x69d3('0x66')]=function(_0x777188,_0x3ec0d9){if(!_0x777188['user']){return _0x3ec0d9[_0x69d3('0x3e')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3dc51d={'payload':{'id':_0x777188['user']['id'],'role':_0x777188['user'][_0x69d3('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3dc51d)[_0x69d3('0x3c')](function(_0xbd560e){_0x3ec0d9[_0x69d3('0x67')]('motion.token',_0xbd560e);_0x3ec0d9[_0x69d3('0x68')](_0x69d3('0x69'));})[_0x69d3('0x44')](function(_0x358961){return _0x3ec0d9[_0x69d3('0x3e')](0x1f4)['send'](_0x358961);});};exports['retrieveApiKey']=function(_0x5b9b97){if(_['isNil'](_0x5b9b97[_0x69d3('0x55')])||_[_0x69d3('0x6a')](_0x5b9b97[_0x69d3('0x6b')])){return null;}else{return createJwt(_0x5b9b97);}};exports['generateApiKey']=function(_0x261a91){_0x261a91[_0x69d3('0x55')]=generateNonce();_0x261a91[_0x69d3('0x6b')]=generateIssuedAt();return createJwt(_0x261a91);};exports[_0x69d3('0x6c')]=function(_0x2c259a,_0x49f057){var _0x220c05=_0x2c259a['query'][_0x69d3('0x4f')];if(_0x220c05){var _0x1dd23b={'nonce':_0x49f057['apiKeyNonce'],'iat':_0x49f057['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x69d3('0x50')]()};return verifyJwt(_0x220c05,_0x1dd23b)[_0x69d3('0x3c')](function(){return generateApiKey(_0x49f057);});}else{throw{'message':_0x69d3('0x6d')};}};exports[_0x69d3('0x6e')]=function(_0x4ebdf1){var _0x73e5d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x73e5d8[_0x69d3('0x6f')](_0x4ebdf1))throw new db['Sequelize']['ValidationError'](_0x69d3('0x70'));return;};exports[_0x69d3('0x71')]=function(_0x1c719e,_0x43ad41,_0x364405){var _0x419334=encryptor['decryptString'](_0x43ad41)[_0x69d3('0x72')](',');for(var _0x12adbc=0x0;_0x12adbc<_0x364405;_0x12adbc++){if(!_0x419334[_0x12adbc])break;if(_0x1c719e[_0x69d3('0x73')]()===_0x419334[_0x12adbc][_0x69d3('0x73')]()){var _0x1f6652=util[_0x69d3('0x74')](_0x69d3('0x75'),_0x364405);if(_0x364405===0x1){_0x1f6652=_0x69d3('0x76');}throw new db['Sequelize']['ValidationError'](_0x1f6652);}}return;};exports['updatePasswordsHistory']=function(_0x5b50b8,_0x410db5){var _0x302054=_0x410db5?encryptor['decryptString'](_0x410db5)['split'](','):[];if(_0x302054[_0x69d3('0x77')]===0x5){_0x302054[_0x69d3('0x78')](-0x1,0x1);}_0x302054[_0x69d3('0x79')](_0x5b50b8);return encryptor[_0x69d3('0x7a')](_0x302054['join'](','));};function signJwt(_0xbf0b94){var _0x3dcfff=BPromise[_0x69d3('0x7b')](jwt[_0x69d3('0x7c')],{'context':jwt});var _0x142393=_0xbf0b94[_0x69d3('0x7d')]||config['secrets']['session'];return new BPromise(function(_0x39b480,_0x3b56de){_0x3dcfff(_0xbf0b94[_0x69d3('0x7e')],_0x142393,_0xbf0b94[_0x69d3('0x7f')])[_0x69d3('0x3c')](function(_0x595b51){_0x39b480(_0x595b51);})[_0x69d3('0x44')](function(_0x282740){_0x3b56de(_0x282740);});});}function verifyJwt(_0x530b82,_0x3dacd6,_0x2c61f4){var _0x421990=BPromise[_0x69d3('0x7b')](jwt['verify'],{'context':jwt});var _0x284bdd=_0x2c61f4||config[_0x69d3('0xc')][_0x69d3('0x80')];return new BPromise(function(_0x487a96,_0x471845){_0x421990(_0x530b82,_0x284bdd,_0x3dacd6)[_0x69d3('0x3c')](function(_0x3531bb){_0x487a96(_0x3531bb);})[_0x69d3('0x44')](function(_0x27d586){_0x471845(_0x27d586);});});}function generateNonce(){return crypto[_0x69d3('0x81')](0x10)[_0x69d3('0x82')](_0x69d3('0x83'));}function generateIssuedAt(){return Math[_0x69d3('0x84')](Date[_0x69d3('0x85')]()/0x3e8)[_0x69d3('0x82')]();}function createJwt(_0x5a8e00){var _0x1ae4af={'payload':{'iat':_0x5a8e00[_0x69d3('0x6b')],'nonce':_0x5a8e00[_0x69d3('0x55')]},'options':{'algorithm':_0x69d3('0x86'),'subject':_0x5a8e00['id'][_0x69d3('0x82')](),'issuer':hardwareConf[_0x69d3('0x50')](),'audience':hardwareConf[_0x69d3('0x50')]()}};return signJwt(_0x1ae4af)[_0x69d3('0x3c')](function(_0x25e817){return{'iat':_0x5a8e00[_0x69d3('0x6b')],'nonce':_0x5a8e00[_0x69d3('0x55')],'token':_0x25e817};});} \ No newline at end of file +var _0x94d3=['mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','findOne','params','closed','disposition','query','status','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','use','authorization','startsWith','headers','Basic','User','find','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','then','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','role','motion.token','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','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.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','unshift','join','promisify','sign','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','voicePause'];(function(_0x3a1acb,_0x141a13){var _0x1ec58d=function(_0x3ad750){while(--_0x3ad750){_0x3a1acb['push'](_0x3a1acb['shift']());}};_0x1ec58d(++_0x141a13);}(_0x94d3,0x195));var _0x394d=function(_0xd11f85,_0x45bed1){_0xd11f85=_0xd11f85-0x0;var _0x1f1f7d=_0x94d3[_0xd11f85];return _0x1f1f7d;};'use strict';var db=require(_0x394d('0x0'))['db'];var config=require(_0x394d('0x1'));var hardwareConf=require(_0x394d('0x2'));var licenseUtil=require(_0x394d('0x3'));var encryptor=require(_0x394d('0x4'));var _=require(_0x394d('0x5'));var jwt=require(_0x394d('0x6'));var expressJwt=require(_0x394d('0x7'));var compose=require(_0x394d('0x8'));var basicAuth=require(_0x394d('0x9'));var crypto=require(_0x394d('0xa'));var BPromise=require(_0x394d('0xb'));var util=require(_0x394d('0xc'));var moment=require(_0x394d('0xd'));var validateJwt=expressJwt({'secret':config[_0x394d('0xe')][_0x394d('0xf')]});var userAttributes=['id','role',_0x394d('0x10'),_0x394d('0x11'),_0x394d('0x12'),_0x394d('0x13'),_0x394d('0x14'),_0x394d('0x15'),_0x394d('0x16'),_0x394d('0x17'),'chatPause',_0x394d('0x18'),_0x394d('0x19'),_0x394d('0x1a'),_0x394d('0x1b'),_0x394d('0x1c'),_0x394d('0x1d'),'lastLoginAt',_0x394d('0x1e'),'crudPermissions','allowmessenger',_0x394d('0x1f'),_0x394d('0x20'),_0x394d('0x21'),_0x394d('0x22'),_0x394d('0x23'),_0x394d('0x24'),'phoneBarEnableDtmfTone',_0x394d('0x25'),_0x394d('0x26'),'phoneBarPrefixRequired',_0x394d('0x27'),'phoneBarRemoteControlPort',_0x394d('0x28'),_0x394d('0x29'),'userProfileId',_0x394d('0x2a'),_0x394d('0x2b'),_0x394d('0x2c'),_0x394d('0x2d'),_0x394d('0x2e'),_0x394d('0x2f'),_0x394d('0x30'),_0x394d('0x31'),_0x394d('0x32'),_0x394d('0x33'),'emailAutoanswer',_0x394d('0x34'),_0x394d('0x35'),_0x394d('0x36'),'openchannelAutoanswer',_0x394d('0x37'),_0x394d('0x38'),_0x394d('0x39'),_0x394d('0x3a'),_0x394d('0x3b'),'messengerSoundNotification'];exports[_0x394d('0x3c')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x363227,_0x491dab,_0x172f5d){if(_0x363227[_0x394d('0x3d')]){_0x172f5d();}else{return db[_0x394d('0x3e')][_0x394d('0x3f')]({'where':{'id':_0x363227[_0x394d('0x40')]['id']},'attributes':['id',_0x394d('0x41'),_0x394d('0x42')],'raw':!![]})['then'](function(_0x46f3a5){if(_0x46f3a5&&_0x46f3a5['closed']&&!_0x363227[_0x394d('0x43')]['forceDownload']){return _0x491dab[_0x394d('0x44')](_0x46f3a5[_0x394d('0x42')]===_0x394d('0x45')?0x195:0x193)[_0x394d('0x46')]({'message':_0x46f3a5['disposition']===_0x394d('0x45')?_0x394d('0x47'):_0x394d('0x48')});}else{_0x172f5d();}})[_0x394d('0x49')](function(_0x2c639f){_0x172f5d(_0x2c639f);});}});};exports[_0x394d('0x4a')]=function isAuthenticated(_0x1dfbab){return compose()[_0x394d('0x4b')](function(_0x2dd488,_0x3c2833,_0x396e64){var _0x2b46cb;if(_0x2dd488['headers'][_0x394d('0x4c')]){if(_[_0x394d('0x4d')](_0x2dd488[_0x394d('0x4e')][_0x394d('0x4c')],_0x394d('0x4f'))){var _0x2782d1=basicAuth(_0x2dd488);db[_0x394d('0x50')][_0x394d('0x51')]({'where':{'name':_0x2782d1[_0x394d('0x11')]}})['then'](function(_0x1602d8){if(!_0x1602d8||!_0x1602d8['authenticate'](_0x2782d1[_0x394d('0x52')])){return _0x3c2833[_0x394d('0x44')](0x191)[_0x394d('0x46')]({'message':_0x394d('0x53')});}_0x2dd488[_0x394d('0x3d')]={'id':_0x1602d8['id']};_0x396e64();})[_0x394d('0x49')](function(_0x4e6c99){_0x396e64(_0x4e6c99);});}else if(_[_0x394d('0x4d')](_0x2dd488[_0x394d('0x4e')][_0x394d('0x4c')],_0x394d('0x54'))){validateJwt(_0x2dd488,_0x3c2833,_0x396e64);}else{if(_0x1dfbab){_0x396e64();}else{return _0x3c2833['status'](0x193)[_0x394d('0x46')]({'message':_0x394d('0x55')});}}}else if(_0x2dd488['query'][_0x394d('0x56')]){try{var _0x1940df={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x394d('0x57')]()};verifyJwt(_0x2dd488['query'][_0x394d('0x56')],_0x1940df)[_0x394d('0x58')](function(_0x221420){return db['User'][_0x394d('0x51')]({'where':{'id':_0x221420[_0x394d('0x59')]}})[_0x394d('0x58')](function(_0xe4d540){_0x2b46cb=_0xe4d540;return db[_0x394d('0x5a')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x394d('0x5b')],'raw':!![]});})['then'](function(_0x48e2de){if(!_0x2b46cb||!_[_0x394d('0x5c')](_0x2b46cb[_0x394d('0x5d')],_0x221420[_0x394d('0x5e')])){return _0x3c2833[_0x394d('0x44')](0x191)['json']({'message':_0x394d('0x5f')});}if(_0x2b46cb[_0x394d('0x60')]){return _0x3c2833[_0x394d('0x44')](0x191)[_0x394d('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x2b46cb[_0x394d('0x61')]){if(_0x48e2de[_0x394d('0x5b')]>0x0){if(moment(_0x2b46cb['blockedAt'])[_0x394d('0x62')](_0x48e2de[_0x394d('0x5b')],_0x394d('0x63'))>moment()){return _0x3c2833[_0x394d('0x44')](0x191)[_0x394d('0x46')]({'message':_0x394d('0x64')});}}else{return _0x3c2833['status'](0x191)['json']({'message':_0x394d('0x64')});}}_0x2dd488[_0x394d('0x3d')]={'id':_0x2b46cb['id']};_0x396e64();});})[_0x394d('0x49')](function(){return _0x3c2833[_0x394d('0x44')](0x191)[_0x394d('0x46')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x594d8f){_0x396e64(_0x594d8f);}}else if(_0x1dfbab){_0x396e64();}else{return _0x3c2833[_0x394d('0x44')](0x193)[_0x394d('0x46')]({'message':_0x394d('0x55')});}})['use'](function(_0x5bf683,_0x4dec37,_0x495a84){if(_0x5bf683[_0x394d('0x3d')]){db[_0x394d('0x50')][_0x394d('0x51')]({'where':{'id':_0x5bf683['user']['id']},'attributes':userAttributes})['then'](function(_0x42ed84){if(!_0x42ed84){return _0x4dec37[_0x394d('0x44')](0x194)[_0x394d('0x46')]({'message':_0x394d('0x65')});}_0x5bf683['user']=_0x42ed84;_0x495a84();})[_0x394d('0x49')](function(_0xeba89f){_0x495a84(_0xeba89f);});}else if(_0x1dfbab){_0x495a84();}else{return _0x4dec37[_0x394d('0x44')](0x194)['json']({'message':_0x394d('0x66')});}});};exports[_0x394d('0x67')]=function canUpdate(){return compose()[_0x394d('0x4b')](function(_0x5c518b,_0x13819f,_0x4a1057){return licenseUtil[_0x394d('0x68')]()[_0x394d('0x58')](function(_0xc003dd){if(_0xc003dd[_0x394d('0x69')]){_0x4a1057();}else{return _0x13819f[_0x394d('0x44')](0x193)[_0x394d('0x46')]({'message':'Forbidden'});}})['catch'](function(_0x324079){_0x4a1057(_0x324079);});});};exports[_0x394d('0x6a')]=function isWebrtcLicence(){return compose()[_0x394d('0x4b')](function(_0x518aee,_0x232334,_0x2e3171){return licenseUtil[_0x394d('0x68')]()['then'](function(_0xceeefe){if(_0xceeefe[_0x394d('0x6b')]){_0x2e3171();}else{return _0x232334[_0x394d('0x44')](0x193)[_0x394d('0x46')]({'message':'Forbidden'});}})[_0x394d('0x49')](function(_0x43936f){_0x2e3171(_0x43936f);});});};exports[_0x394d('0x6c')]=function(_0x5bbe15,_0x1692c2,_0xccf629){_0x5bbe15[_0x394d('0x6c')]=!![];return _0xccf629();};exports[_0x394d('0x6d')]=function signToken(_0x146226){return signJwt(_0x146226);};exports[_0x394d('0x6e')]=function(_0x1f44f4,_0x51be19){if(!_0x1f44f4[_0x394d('0x3d')]){return _0x51be19[_0x394d('0x44')](0x194)[_0x394d('0x46')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x18645={'payload':{'id':_0x1f44f4[_0x394d('0x3d')]['id'],'role':_0x1f44f4[_0x394d('0x3d')][_0x394d('0x6f')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18645)[_0x394d('0x58')](function(_0x5d8b63){_0x51be19['cookie'](_0x394d('0x70'),_0x5d8b63);_0x51be19['redirect'](_0x394d('0x71'));})[_0x394d('0x49')](function(_0x16f9c6){return _0x51be19[_0x394d('0x44')](0x1f4)[_0x394d('0x72')](_0x16f9c6);});};exports['retrieveApiKey']=function(_0x1f792d){if(_[_0x394d('0x73')](_0x1f792d[_0x394d('0x5d')])||_[_0x394d('0x73')](_0x1f792d[_0x394d('0x74')])){return null;}else{return createJwt(_0x1f792d);}};exports[_0x394d('0x75')]=function(_0x3d4cd1){_0x3d4cd1[_0x394d('0x5d')]=generateNonce();_0x3d4cd1[_0x394d('0x74')]=generateIssuedAt();return createJwt(_0x3d4cd1);};exports[_0x394d('0x76')]=function(_0xd3221b,_0x3523cd){var _0x27b453=_0xd3221b['query'][_0x394d('0x56')];if(_0x27b453){var _0x1e0582={'nonce':_0x3523cd[_0x394d('0x5d')],'iat':_0x3523cd[_0x394d('0x74')],'audience':hardwareConf[_0x394d('0x57')](),'issuer':hardwareConf[_0x394d('0x57')]()};return verifyJwt(_0x27b453,_0x1e0582)[_0x394d('0x58')](function(){return generateApiKey(_0x3523cd);});}else{throw{'message':_0x394d('0x77')};}};exports[_0x394d('0x78')]=function(_0x6e202e){var _0x2d4c6d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2d4c6d[_0x394d('0x79')](_0x6e202e))throw new db['Sequelize'][(_0x394d('0x7a'))](_0x394d('0x7b'));return;};exports[_0x394d('0x7c')]=function(_0x17beb0,_0xde030e,_0x4518c0){var _0xcaad78=encryptor[_0x394d('0x7d')](_0xde030e)[_0x394d('0x7e')](',');for(var _0x3b22d5=0x0;_0x3b22d5<_0x4518c0;_0x3b22d5++){if(!_0xcaad78[_0x3b22d5])break;if(_0x17beb0[_0x394d('0x7f')]()===_0xcaad78[_0x3b22d5][_0x394d('0x7f')]()){var _0x34c409=util[_0x394d('0x80')](_0x394d('0x81'),_0x4518c0);if(_0x4518c0===0x1){_0x34c409=_0x394d('0x82');}throw new db['Sequelize'][(_0x394d('0x7a'))](_0x34c409);}}return;};exports['updatePasswordsHistory']=function(_0x88987a,_0x101342){var _0x5da450=_0x101342?encryptor[_0x394d('0x7d')](_0x101342)[_0x394d('0x7e')](','):[];if(_0x5da450['length']===0x5){_0x5da450['splice'](-0x1,0x1);}_0x5da450[_0x394d('0x83')](_0x88987a);return encryptor['encryptString'](_0x5da450[_0x394d('0x84')](','));};function signJwt(_0x9f56c8){var _0x53b6cd=BPromise[_0x394d('0x85')](jwt[_0x394d('0x86')],{'context':jwt});var _0x3d0703=_0x9f56c8['secret']||config[_0x394d('0xe')][_0x394d('0xf')];return new BPromise(function(_0x1c2de9,_0x4abeca){_0x53b6cd(_0x9f56c8[_0x394d('0x87')],_0x3d0703,_0x9f56c8['options'])['then'](function(_0x57508a){_0x1c2de9(_0x57508a);})[_0x394d('0x49')](function(_0x359fef){_0x4abeca(_0x359fef);});});}function verifyJwt(_0x56028f,_0x7fcec3,_0x5ebac1){var _0xfdd0cf=BPromise[_0x394d('0x85')](jwt[_0x394d('0x88')],{'context':jwt});var _0x4f7a63=_0x5ebac1||config[_0x394d('0xe')]['session'];return new BPromise(function(_0x1581b3,_0x54ad03){_0xfdd0cf(_0x56028f,_0x4f7a63,_0x7fcec3)[_0x394d('0x58')](function(_0x1989c7){_0x1581b3(_0x1989c7);})['catch'](function(_0x3a1386){_0x54ad03(_0x3a1386);});});}function generateNonce(){return crypto[_0x394d('0x89')](0x10)[_0x394d('0x8a')](_0x394d('0x8b'));}function generateIssuedAt(){return Math[_0x394d('0x8c')](Date[_0x394d('0x8d')]()/0x3e8)[_0x394d('0x8a')]();}function createJwt(_0x17a4cf){var _0x54c091={'payload':{'iat':_0x17a4cf[_0x394d('0x74')],'nonce':_0x17a4cf[_0x394d('0x5d')]},'options':{'algorithm':_0x394d('0x8e'),'subject':_0x17a4cf['id'][_0x394d('0x8a')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x54c091)['then'](function(_0x208fd9){return{'iat':_0x17a4cf[_0x394d('0x74')],'nonce':_0x17a4cf['apiKeyNonce'],'token':_0x208fd9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index b9a70e4..77d78aa 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 _0x2d01=['getFilteredContacts','catch','describe','CmContact','keys','startsWith','map','CmCustomField','slice','all','length','cf_','fieldType','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2d01,0x7a));var _0x12d0=function(_0x5dca82,_0x136a46){_0x5dca82=_0x5dca82-0x0;var _0x403d5e=_0x2d01[_0x5dca82];return _0x403d5e;};'use strict';var _=require(_0x12d0('0x0'));var sqlUtils=require(_0x12d0('0x1'));var db=require(_0x12d0('0x2'))['db'];exports['findAll']=function(_0x3c80c2,_0x5f2c66,_0x14f8f6,_0x1a1beb){var _0x2de5e0={'count':0x0,'rows':[]};var _0x451b0b=sqlUtils[_0x12d0('0x3')](_0x5f2c66,_0x3c80c2);if(_0x451b0b){return Promise[_0x12d0('0x4')](_0x2de5e0);}var _0x15f659=sqlUtils['getContactsSubquery']();var _0x4267fc={};var _0x5947ac=![];var _0x1ba6eb=![];return Promise[_0x12d0('0x4')]()[_0x12d0('0x5')](function(){if(_0x3c80c2[_0x12d0('0x6')]){return sqlUtils[_0x12d0('0x7')](_0x3c80c2[_0x12d0('0x6')],_0x1a1beb);}else{return sqlUtils[_0x12d0('0x8')](_0x3c80c2,_0x1a1beb);}})[_0x12d0('0x5')](function(_0x44fa9f){_0x15f659[_0x12d0('0x9')](_0x44fa9f['default']);_0x15f659[_0x12d0('0x9')](_0x44fa9f[_0x12d0('0xa')]);_0x15f659['where'](_0x44fa9f[_0x12d0('0xb')]);_0x15f659[_0x12d0('0x9')](_0x44fa9f[_0x12d0('0xc')][_0x12d0('0xd')]);_0x4267fc=_0x44fa9f[_0x12d0('0xe')];_0x1ba6eb=_0x44fa9f[_0x12d0('0xc')][_0x12d0('0xf')];return sqlUtils[_0x12d0('0x10')](_0x5f2c66,_0x3c80c2,_0x1ba6eb);})['then'](function(_0x189771){_0x15f659['where'](_0x189771);var _0x366de1=_0x3c80c2[_0x12d0('0x6')]?_0x4267fc[_0x12d0('0x11')]:_0x3c80c2[_0x12d0('0x12')];_0x5947ac=_0x366de1?!![]:![];return sqlUtils[_0x12d0('0x13')](_0x15f659,_0x366de1);})[_0x12d0('0x5')](function(_0x41217b){_0x2de5e0[_0x12d0('0x14')]=_0x41217b;if(_0x2de5e0[_0x12d0('0x14')]===0x0){return;}if(_0x3c80c2['User']){_0x1ba6eb=!![];}return sqlUtils[_0x12d0('0x15')](_0x15f659,_0x3c80c2['fields'],_0x14f8f6,_0x5947ac,_0x4267fc[_0x12d0('0xd')],_0x1ba6eb);})[_0x12d0('0x5')](function(_0xbb90f5){if(!_0xbb90f5){return[];}return sqlUtils[_0x12d0('0x16')](_0xbb90f5,_0x3c80c2,_0x14f8f6);})[_0x12d0('0x5')](function(_0x979a0d){_0x2de5e0['rows']=_0x979a0d;return _0x2de5e0;})[_0x12d0('0x17')](function(_0x21a765){throw _0x21a765;});};exports[_0x12d0('0x18')]=function(){var _0x581258={};var _0x290809=[];return db[_0x12d0('0x19')][_0x12d0('0x18')]()['then'](function(_0x36707b){_0x581258=_0x36707b;var _0x1f6ecd=Object[_0x12d0('0x1a')](_0x581258)['filter'](function(_0x4ca386){return _[_0x12d0('0x1b')](_0x4ca386,'cf_')?_0x4ca386:undefined;});var _0x314485=_0x1f6ecd[_0x12d0('0x1c')](function(_0xc64ac){return db[_0x12d0('0x1d')]['findOne']({'where':{'id':_0xc64ac[_0x12d0('0x1e')](0x3)},'raw':!![]});});return Promise[_0x12d0('0x1f')](_0x314485);})[_0x12d0('0x5')](function(_0x16f74e){for(var _0x33dd5f=0x0;_0x33dd5f<_0x16f74e[_0x12d0('0x20')];_0x33dd5f++){if(_0x16f74e[_0x33dd5f]){var _0x16d084=_0x12d0('0x21')+_0x16f74e[_0x33dd5f]['id'];_0x581258[_0x16d084][_0x12d0('0x22')]=_0x16f74e[_0x33dd5f]['type'];}}_0x290809=_[_0x12d0('0x1c')](Object[_0x12d0('0x1a')](_0x581258),function(_0x1b4652){return{'name':_0x1b4652,'type':_0x581258[_0x1b4652][_0x12d0('0x23')]};});return _0x290809;})[_0x12d0('0x17')](function(_0x331857){throw _0x331857;});}; \ No newline at end of file +var _0x9e0b=['catch','lodash','./sql-utils','findAll','getContactsSubquery','resolve','then','search','parseQueryParameters','where','default','fields','filter','user','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','rows','describe','startsWith','CmCustomField','findOne','slice','cf_','fieldType','type','keys'];(function(_0x5d3733,_0x48cade){var _0x237bae=function(_0x3c9793){while(--_0x3c9793){_0x5d3733['push'](_0x5d3733['shift']());}};_0x237bae(++_0x48cade);}(_0x9e0b,0x1c1));var _0xb9e0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9e0b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xb9e0('0x0'));var sqlUtils=require(_0xb9e0('0x1'));var db=require('../../mysqldb')['db'];exports[_0xb9e0('0x2')]=function(_0x5e6e36,_0xd7dc80,_0x343777,_0x22138e){var _0x3aa10a={'count':0x0,'rows':[]};var _0x307e85=sqlUtils['skipContactsQuery'](_0xd7dc80,_0x5e6e36);if(_0x307e85){return Promise['resolve'](_0x3aa10a);}var _0x2c8a3b=sqlUtils[_0xb9e0('0x3')]();var _0x2b9eca={};var _0x327fec=![];var _0x4c866d=![];return Promise[_0xb9e0('0x4')]()[_0xb9e0('0x5')](function(){if(_0x5e6e36[_0xb9e0('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x5e6e36['search'],_0x22138e);}else{return sqlUtils[_0xb9e0('0x7')](_0x5e6e36,_0x22138e);}})[_0xb9e0('0x5')](function(_0x5f2989){_0x2c8a3b[_0xb9e0('0x8')](_0x5f2989[_0xb9e0('0x9')]);_0x2c8a3b[_0xb9e0('0x8')](_0x5f2989[_0xb9e0('0xa')]);_0x2c8a3b['where'](_0x5f2989[_0xb9e0('0xb')]);_0x2c8a3b[_0xb9e0('0x8')](_0x5f2989[_0xb9e0('0xc')]['clause']);_0x2b9eca=_0x5f2989[_0xb9e0('0xd')];_0x4c866d=_0x5f2989[_0xb9e0('0xc')][_0xb9e0('0xe')];return sqlUtils[_0xb9e0('0xf')](_0xd7dc80,_0x5e6e36,_0x4c866d);})[_0xb9e0('0x5')](function(_0x4aeb55){_0x2c8a3b['where'](_0x4aeb55);var _0x2f5fbd=_0x5e6e36[_0xb9e0('0x6')]?_0x2b9eca[_0xb9e0('0x10')]:_0x5e6e36[_0xb9e0('0x11')];_0x327fec=_0x2f5fbd?!![]:![];return sqlUtils[_0xb9e0('0x12')](_0x2c8a3b,_0x2f5fbd);})['then'](function(_0x1218cf){_0x3aa10a[_0xb9e0('0x13')]=_0x1218cf;if(_0x3aa10a[_0xb9e0('0x13')]===0x0){return;}if(_0x5e6e36['User']){_0x4c866d=!![];}return sqlUtils[_0xb9e0('0x14')](_0x2c8a3b,_0x5e6e36[_0xb9e0('0xa')],_0x343777,_0x327fec,_0x2b9eca['clause'],_0x4c866d);})[_0xb9e0('0x5')](function(_0xdffa){if(!_0xdffa){return[];}return sqlUtils['getFilteredContacts'](_0xdffa,_0x5e6e36,_0x343777);})[_0xb9e0('0x5')](function(_0x8a2718){_0x3aa10a[_0xb9e0('0x15')]=_0x8a2718;return _0x3aa10a;})['catch'](function(_0x3e1c53){throw _0x3e1c53;});};exports[_0xb9e0('0x16')]=function(){var _0x30a2b9={};var _0x32048f=[];return db['CmContact']['describe']()[_0xb9e0('0x5')](function(_0x3d83ca){_0x30a2b9=_0x3d83ca;var _0x5b251f=Object['keys'](_0x30a2b9)['filter'](function(_0x1d05b0){return _[_0xb9e0('0x17')](_0x1d05b0,'cf_')?_0x1d05b0:undefined;});var _0x2aa831=_0x5b251f['map'](function(_0x56195b){return db[_0xb9e0('0x18')][_0xb9e0('0x19')]({'where':{'id':_0x56195b[_0xb9e0('0x1a')](0x3)},'raw':!![]});});return Promise['all'](_0x2aa831);})[_0xb9e0('0x5')](function(_0x230404){for(var _0x4c6d7d=0x0;_0x4c6d7d<_0x230404['length'];_0x4c6d7d++){if(_0x230404[_0x4c6d7d]){var _0x54e4e1=_0xb9e0('0x1b')+_0x230404[_0x4c6d7d]['id'];_0x30a2b9[_0x54e4e1][_0xb9e0('0x1c')]=_0x230404[_0x4c6d7d][_0xb9e0('0x1d')];}}_0x32048f=_['map'](Object[_0xb9e0('0x1e')](_0x30a2b9),function(_0x4f8fca){return{'name':_0x4f8fca,'type':_0x30a2b9[_0x4f8fca][_0xb9e0('0x1d')]};});return _0x32048f;})[_0xb9e0('0x1f')](function(_0xef7aeb){throw _0xef7aeb;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 23e0d0c..0d0aff5 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 _0x7312=['select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','includes','push','TagIds','field','expr','replace','escapeLIKESpecialChars','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','value','start','end','Tag','map','tags','clause','ids','user','and','uc.UserId\x20=\x20?','skip','some','Contact','forEach','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','User','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','offset','subqry.id','limit','having','order','subqry.','DESC','color','keyBy','Sequelize','SELECT','CmContact','query','toString','Tags','split','clone','COUNT(*)','c.id','getSelectedTags','isEmpty','t.id\x20IN\x20?','QueryTypes','sequelize','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true'];(function(_0x512a22,_0x59d3ad){var _0x504680=function(_0x2705e5){while(--_0x2705e5){_0x512a22['push'](_0x512a22['shift']());}};_0x504680(++_0x59d3ad);}(_0x7312,0x14b));var _0x2731=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x7312[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x2731('0x0'));var squel=require(_0x2731('0x1'));var as=require(_0x2731('0x2'));var qs=require('../parsers/qs');var utils=require(_0x2731('0x3'));var db=require(_0x2731('0x4'))['db'];function skipContactsQuery(_0x566640,_0x2a80e2){var _0x3729ad=![];if(_0x566640[_0x2731('0x5')]===_0x2731('0x6')&&!_0x2a80e2[_0x2731('0x7')]&&!_0x2a80e2[_0x2731('0x8')]&&_0x2a80e2[_0x2731('0x9')]!==_0x2731('0xa')){_0x3729ad=!![];}return _0x3729ad;}function getContactsSubquery(){return squel[_0x2731('0xb')]()[_0x2731('0xc')](_0x2731('0xd'),'c')[_0x2731('0xe')](_0x2731('0xf'));}function applyJoinClauses(_0x4fe091,_0x5d66bd){var _0x29a862=_0x5d66bd?'c':_0x2731('0x10');_0x4fe091['left_join'](_0x2731('0x11'),'uc',_0x2731('0x12')+_0x29a862+_0x2731('0x13'))[_0x2731('0x14')](_0x2731('0x15'),'ct','ct.CmContactId\x20=\x20'+_0x29a862+_0x2731('0x13'))[_0x2731('0x14')]('tools_tags','t',_0x2731('0x16'));return _0x4fe091;}function addFieldsToQuery(_0x52e3fb,_0x1f05b2,_0x23cde0,_0x3c2694,_0x227e91){var _0x47c843=_0x227e91?'c':'subqry';if(!_0x1f05b2){_0x1f05b2=['id',_0x2731('0x17'),_0x2731('0x18'),_0x2731('0x19'),_0x2731('0x1a'),'fax',_0x2731('0x1b'),_0x2731('0x8'),_0x2731('0x1c'),_0x2731('0x1d'),_0x2731('0x1e'),_0x2731('0x1f'),'TagIds'];}else if(!_0x1f05b2[_0x2731('0x20')]('id')){_0x1f05b2[_0x2731('0x21')]('id');}var _0x403ecb=_0x23cde0&&_0x227e91||!_0x23cde0&&!_0x227e91;if(_0x3c2694){_0x403ecb=_0x3c2694&&_0x227e91||!_0x3c2694&&!_0x227e91;}_0x1f05b2['forEach'](function(_0x2f4ffc){if(_0x2f4ffc===_0x2731('0x22')){if(_0x403ecb){_0x52e3fb[_0x2731('0x23')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2f4ffc);}else if(_0x23cde0||_0x3c2694){_0x52e3fb[_0x2731('0x23')](_0x47c843+'.'+_0x2f4ffc);}}else{_0x52e3fb['field'](_0x47c843+'.'+_0x2f4ffc);}});return _0x52e3fb;}function getSqlClauses(){var _0x2301ff={'default':squel['expr'](),'fields':squel[_0x2731('0x24')](),'filter':squel[_0x2731('0x24')](),'tags':{'clause':squel[_0x2731('0x24')](),'ids':null},'user':{'clause':squel[_0x2731('0x24')](),'skip':![]}};return _0x2301ff;}function parseTagParameter(_0x587850){var _0x2a9f68=squel['expr']();if(_0x587850){var _0x28fec1=utils['getSelectedTags'](_0x587850);_0x28fec1['forEach'](function(_0x50e358){_0x2a9f68['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x50e358+',%');});}return _0x2a9f68;}function parseSearchFilter(_0x2103fb){var _0x34eecd=squel['expr']();if(_0x2103fb){var _0x2ff7ac=_0x2103fb[_0x2731('0x25')]('\x5c','\x5c\x5c')[_0x2731('0x25')](/'/g,'\x27\x27');var _0x54c961=qs[_0x2731('0x26')](_0x2ff7ac);if(_0x2ff7ac['split']('\x20')[_0x2731('0x27')]>0x1){_0x34eecd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2731('0x28')](_0x2ff7ac,!![]),null);}else{if(qs[_0x2731('0x29')](_0x2ff7ac)){_0x34eecd['or'](_0x2731('0x2a'),_0x54c961+'%');_0x34eecd['or'](_0x2731('0x2b'),_0x54c961+'%');_0x34eecd['or'](_0x2731('0x2c'),_0x54c961+'%');_0x34eecd['or'](_0x2731('0x2d'),_0x54c961+'%');}else if(qs[_0x2731('0x2e')](_0x2ff7ac)){_0x34eecd['or'](_0x2731('0x2f'),_0x54c961+'%');}else{_0x34eecd['or'](_0x2731('0x30'),'%'+_0x54c961+'%');_0x34eecd['or'](_0x2731('0x31'),'%'+_0x54c961+'%');_0x34eecd['or'](_0x2731('0x2f'),'%'+_0x54c961+'%');}}}return _0x34eecd;}function parseAdvancedSearchFilter(_0x4c6eac,_0x4dc54a){var _0x37e5ce=getSqlClauses();var _0x3900f7=as['parseSearch'](_0x4c6eac);var _0x15473a=_0x3900f7[_0x2731('0x32')];for(var _0x3a51f4=0x0;_0x3a51f4<_0x3900f7[_0x2731('0x33')][_0x2731('0x27')];_0x3a51f4++){var _0x13e202=_0x3900f7[_0x2731('0x33')][_0x3a51f4];var _0x1a58bc='c';var _0x2d20b1=_[_0x2731('0x34')](_0x4dc54a,[_0x2731('0x35'),_0x13e202[_0x2731('0x23')]]);if(_0x2d20b1){if(_0x13e202['field']===_0x2731('0x36')||_0x2d20b1[_0x2731('0x37')]===_0x2731('0x38')){_0x13e202[_0x2731('0x39')]=_0x2731('0x3a');}var _0x5c2ef1=as['buildExpression'](_0x1a58bc,_0x2d20b1[_0x2731('0x3b')],_0x13e202);_0x37e5ce['default'][_0x15473a](_0x5c2ef1['text'],_0x5c2ef1[_0x2731('0x3c')][_0x2731('0x3d')],_0x5c2ef1[_0x2731('0x3c')][_0x2731('0x3e')]);}else{if(_0x13e202[_0x2731('0x23')]===_0x2731('0x3f')){var _0x248363=_0x13e202[_0x2731('0x3c')]['split'](',')[_0x2731('0x40')](function(_0x5910ec){return Number(_0x5910ec);});var _0x1906e0=parseTagParameter(_0x248363);_0x37e5ce[_0x2731('0x41')][_0x2731('0x42')]['and'](_0x1906e0);_0x37e5ce[_0x2731('0x41')][_0x2731('0x43')]=_0x248363;}else if(_0x13e202[_0x2731('0x23')]==='User'){_0x37e5ce[_0x2731('0x44')][_0x2731('0x42')][_0x2731('0x45')](_0x2731('0x46'),_0x13e202[_0x2731('0x3c')]);_0x37e5ce[_0x2731('0x44')][_0x2731('0x47')]=!![];}}}return _0x37e5ce;}function parseModelFields(_0xfa8203,_0xa7571b){var _0xba1645=squel[_0x2731('0x24')]();var _0x3554ba=_(_0xfa8203)['keys']()[_0x2731('0x40')](function(_0x222690){return _[_0x2731('0x48')](_0xa7571b,[_0x2731('0x35'),_0x222690])?_0x222690:undefined;})['compact']()[_0x2731('0x3c')]();if(_0xfa8203[_0x2731('0x49')]){_0x3554ba[_0x2731('0x21')]('Contact');}if(_0xfa8203['User']){_0x3554ba[_0x2731('0x21')]('User');}if(_0x3554ba[_0x2731('0x27')]>0x0){_0x3554ba[_0x2731('0x4a')](function(_0x2e0119){if(_0x2e0119===_0x2731('0x8')){_0xba1645['and'](_0x2731('0x4b'),[][_0x2731('0x4c')](_0xfa8203[_0x2e0119]));}else if(_0x2e0119==='Contact'){var _0x338c7d='%'+_0xfa8203[_0x2e0119]+'%';_0xba1645[_0x2731('0x45')](_0x2731('0x4d'),_0x338c7d);}else if(_0x2e0119===_0x2731('0x4e')){_0xba1645[_0x2731('0x45')]('uc.UserId\x20=\x20?',_0xfa8203[_0x2e0119]);}else{_0xba1645[_0x2731('0x45')]('c.'+_0x2e0119+_0x2731('0x4f'),_0xfa8203[_0x2e0119]);}});}return _0xba1645;}function parseQueryParameters(_0x55f3b3,_0x3b8537){var _0x3cab9b=getSqlClauses();return Promise[_0x2731('0x50')]()[_0x2731('0x51')](function(){return parseModelFields(_0x55f3b3,_0x3b8537);})[_0x2731('0x51')](function(_0xf5a641){_0x3cab9b[_0x2731('0x52')]['and'](_0xf5a641);return parseTagParameter(_0x55f3b3[_0x2731('0x53')]);})[_0x2731('0x51')](function(_0x232e16){_0x3cab9b[_0x2731('0x41')][_0x2731('0x42')]['and'](_0x232e16);return parseSearchFilter(_0x55f3b3['filter']);})[_0x2731('0x51')](function(_0x29de52){_0x3cab9b[_0x2731('0x54')]=_0x29de52;return _0x3cab9b;});}function checkListsRestrictions(_0x5ae939,_0x168219,_0x145b35){var _0x434e5d=squel[_0x2731('0x24')]();return Promise[_0x2731('0x50')]()[_0x2731('0x51')](function(){if(_0x168219['search']&&_0x5ae939[_0x2731('0x5')]==='agent'&&!_0x145b35){return _0x5ae939[_0x2731('0x55')]({'attributes':['id'],'raw':!![]});}})[_0x2731('0x51')](function(_0x58f43f){if(_0x58f43f){if(_0x58f43f[_0x2731('0x27')]===0x0){_0x434e5d[_0x2731('0x45')](_0x2731('0x56'));}else{_0x434e5d['and'](_0x2731('0x4b'),_['map'](_0x58f43f,'id'));}}})[_0x2731('0x51')](function(){return _0x434e5d;});}function buildContactsQuery(_0x4348e5,_0x100851,_0x4576cd,_0x4841d6,_0x5911bd,_0x2ac3d1){if(_0x100851){_0x100851=_0x4576cd[_0x2731('0x57')];}_0x4348e5=addFieldsToQuery(_0x4348e5,_0x100851,_0x4841d6,_0x2ac3d1,!![]);var _0x468886=squel[_0x2731('0xb')]();_0x468886=addFieldsToQuery(_0x468886,_0x100851,_0x4841d6,_0x2ac3d1,![]);if(_0x4841d6||_0x2ac3d1){_0x4348e5=applyJoinClauses(_0x4348e5,!![]);_0x4348e5[_0x2731('0x58')]('c.id');if(_0x4576cd['limit']){_0x468886['limit'](_0x4576cd['limit']);}if(_0x4576cd[_0x2731('0x59')]){_0x468886[_0x2731('0x59')](_0x4576cd[_0x2731('0x59')]);}}else{_0x468886=applyJoinClauses(_0x468886,![]);_0x468886[_0x2731('0x58')](_0x2731('0x5a'));if(_0x4576cd['limit']){_0x4348e5['limit'](_0x4576cd[_0x2731('0x5b')]);}if(_0x4576cd[_0x2731('0x59')]){_0x4348e5['offset'](_0x4576cd['offset']);}}_0x468886[_0x2731('0x5c')](_0x5911bd);if(_0x4576cd[_0x2731('0x5d')]){_0x4576cd[_0x2731('0x5d')][_0x2731('0x4a')](function(_0x282172){_0x4348e5[_0x2731('0x5d')]('c.'+_0x282172[0x0],_0x282172[0x1]==='DESC'?![]:!![]);_0x468886[_0x2731('0x5d')](_0x2731('0x5e')+_0x282172[0x0],_0x282172[0x1]===_0x2731('0x5f')?![]:!![]);});}_0x468886[_0x2731('0xc')](_0x4348e5,_0x2731('0x10'));return _0x468886;}function getFilteredContacts(_0x37edb3){var _0x47bbfe=[];return db['Tag']['findAll']({'attributes':['id',_0x2731('0x35'),_0x2731('0x60')],'raw':!![]})[_0x2731('0x51')](function(_0xd4cd40){_0x47bbfe=_[_0x2731('0x61')](_0xd4cd40,'id');var _0x168280={'type':db[_0x2731('0x62')]['QueryTypes'][_0x2731('0x63')],'model':db[_0x2731('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x2731('0x65')](_0x37edb3[_0x2731('0x66')](),_0x168280);})['then'](function(_0x5b2265){_0x5b2265[_0x2731('0x4a')](function(_0x3e29f7){if(_0x3e29f7[_0x2731('0x22')]){_0x3e29f7[_0x2731('0x67')]=[];_0x3e29f7['TagIds'][_0x2731('0x68')](',')[_0x2731('0x4a')](function(_0x5809ff){_0x3e29f7['Tags']['push'](_0x47bbfe[_0x5809ff]);});}delete _0x3e29f7['TagIds'];});return _0x5b2265;});}function countFilteredContacts(_0x3260fb,_0x2d5ca2){var _0xbda441=_0x3260fb[_0x2731('0x69')]();_0xbda441[_0x2731('0x23')](_0x2731('0x6a'));_0xbda441=applyJoinClauses(_0xbda441,!![]);_0x3260fb[_0x2731('0x58')](_0x2731('0x6b'));var _0x2a6071=utils[_0x2731('0x6c')](_0x2d5ca2);if(!_[_0x2731('0x6d')](_0x2a6071)){_0xbda441[_0x2731('0xe')](_0x2731('0x6e'),_0x2a6071);}var _0x4e92e9={'type':db[_0x2731('0x62')][_0x2731('0x6f')][_0x2731('0x63')],'raw':!![]};return db[_0x2731('0x70')][_0x2731('0x65')](_0xbda441[_0x2731('0x66')](),_0x4e92e9)[_0x2731('0x51')](function(_0x14c119){return _0x14c119[0x0]['COUNT(*)'];});}module[_0x2731('0x71')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xbb5a=['isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','buildExpression','type','default','value','map','tags','clause','and','ids','User','user','skip','keys','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','tag','filter','getLists','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','Tag','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','clone','getSelectedTags','isEmpty','t.id\x20IN\x20?','exports','../parsers/qs','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','select','from','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','mobile','fax','CompanyId','createdAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?'];(function(_0x4fc4a2,_0x16dff5){var _0x4c9a55=function(_0x4f505f){while(--_0x4f505f){_0x4fc4a2['push'](_0x4fc4a2['shift']());}};_0x4c9a55(++_0x16dff5);}(_0xbb5a,0xa6));var _0xabb5=function(_0x184ffd,_0x4149dd){_0x184ffd=_0x184ffd-0x0;var _0x2f1e66=_0xbb5a[_0x184ffd];return _0x2f1e66;};'use strict';var _=require('lodash');var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xabb5('0x0'));var utils=require(_0xabb5('0x1'));var db=require(_0xabb5('0x2'))['db'];function skipContactsQuery(_0xc283e,_0x2861c3){var _0x271cf2=![];if(_0xc283e[_0xabb5('0x3')]==='agent'&&!_0x2861c3[_0xabb5('0x4')]&&!_0x2861c3[_0xabb5('0x5')]&&_0x2861c3[_0xabb5('0x6')]!==_0xabb5('0x7')){_0x271cf2=!![];}return _0x271cf2;}function getContactsSubquery(){return squel[_0xabb5('0x8')]()[_0xabb5('0x9')]('cm_contacts','c')[_0xabb5('0xa')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x2e66f4,_0x43a0ed){var _0x5b7404=_0x43a0ed?'c':_0xabb5('0xb');_0x2e66f4[_0xabb5('0xc')](_0xabb5('0xd'),'uc',_0xabb5('0xe')+_0x5b7404+_0xabb5('0xf'))['left_join'](_0xabb5('0x10'),'ct',_0xabb5('0x11')+_0x5b7404+_0xabb5('0xf'))[_0xabb5('0xc')](_0xabb5('0x12'),'t',_0xabb5('0x13'));return _0x2e66f4;}function addFieldsToQuery(_0x4e5f06,_0x26590b,_0x1436fb,_0x2ff8bd,_0x592f62){var _0x1fe0f4=_0x592f62?'c':_0xabb5('0xb');if(!_0x26590b){_0x26590b=['id',_0xabb5('0x14'),'lastName','phone',_0xabb5('0x15'),_0xabb5('0x16'),'email',_0xabb5('0x5'),_0xabb5('0x17'),_0xabb5('0x18'),'updatedAt','deletedAt',_0xabb5('0x19')];}else if(!_0x26590b[_0xabb5('0x1a')]('id')){_0x26590b[_0xabb5('0x1b')]('id');}var _0x4e9187=_0x1436fb&&_0x592f62||!_0x1436fb&&!_0x592f62;if(_0x2ff8bd){_0x4e9187=_0x2ff8bd&&_0x592f62||!_0x2ff8bd&&!_0x592f62;}_0x26590b[_0xabb5('0x1c')](function(_0xbf0b3d){if(_0xbf0b3d==='TagIds'){if(_0x4e9187){_0x4e5f06[_0xabb5('0x1d')](_0xabb5('0x1e'),_0xbf0b3d);}else if(_0x1436fb||_0x2ff8bd){_0x4e5f06[_0xabb5('0x1d')](_0x1fe0f4+'.'+_0xbf0b3d);}}else{_0x4e5f06[_0xabb5('0x1d')](_0x1fe0f4+'.'+_0xbf0b3d);}});return _0x4e5f06;}function getSqlClauses(){var _0xb8c92e={'default':squel[_0xabb5('0x1f')](),'fields':squel[_0xabb5('0x1f')](),'filter':squel[_0xabb5('0x1f')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0xb8c92e;}function parseTagParameter(_0x1fa180){var _0x50d946=squel[_0xabb5('0x1f')]();if(_0x1fa180){var _0x389c1b=utils['getSelectedTags'](_0x1fa180);_0x389c1b[_0xabb5('0x1c')](function(_0x70a0e6){_0x50d946['or'](_0xabb5('0x20'),'%,'+_0x70a0e6+',%');});}return _0x50d946;}function parseSearchFilter(_0x549ce2){var _0x4e57cd=squel[_0xabb5('0x1f')]();if(_0x549ce2){var _0x3dbf6d=_0x549ce2[_0xabb5('0x21')]('\x5c','\x5c\x5c')[_0xabb5('0x21')](/'/g,'\x27\x27');var _0x59a0c0=qs['escapeLIKESpecialChars'](_0x3dbf6d);if(_0x3dbf6d[_0xabb5('0x22')]('\x20')[_0xabb5('0x23')]>0x1){_0x4e57cd['or'](_0xabb5('0x24'),qs[_0xabb5('0x25')](_0x3dbf6d,!![]),null);}else{if(qs['isNumeric'](_0x3dbf6d)){_0x4e57cd['or'](_0xabb5('0x26'),_0x59a0c0+'%');_0x4e57cd['or'](_0xabb5('0x27'),_0x59a0c0+'%');_0x4e57cd['or'](_0xabb5('0x28'),_0x59a0c0+'%');_0x4e57cd['or'](_0xabb5('0x29'),_0x59a0c0+'%');}else if(qs[_0xabb5('0x2a')](_0x3dbf6d)){_0x4e57cd['or'](_0xabb5('0x2b'),_0x59a0c0+'%');}else{_0x4e57cd['or'](_0xabb5('0x2c'),'%'+_0x59a0c0+'%');_0x4e57cd['or']('c.lastName\x20LIKE\x20?','%'+_0x59a0c0+'%');_0x4e57cd['or'](_0xabb5('0x2b'),'%'+_0x59a0c0+'%');}}}return _0x4e57cd;}function parseAdvancedSearchFilter(_0x4f4924,_0x3ea480){var _0x410861=getSqlClauses();var _0x1b3cbb=as[_0xabb5('0x2d')](_0x4f4924);var _0x3f85dd=_0x1b3cbb[_0xabb5('0x2e')];for(var _0x29d20c=0x0;_0x29d20c<_0x1b3cbb['conditions'][_0xabb5('0x23')];_0x29d20c++){var _0x89137a=_0x1b3cbb[_0xabb5('0x2f')][_0x29d20c];var _0x875f3a='c';var _0x1fcc4e=_[_0xabb5('0x30')](_0x3ea480,[_0xabb5('0x31'),_0x89137a['field']]);if(_0x1fcc4e){if(_0x89137a[_0xabb5('0x1d')]===_0xabb5('0x32')||_0x1fcc4e[_0xabb5('0x33')]===_0xabb5('0x34')){_0x89137a['castTo']='DATE';}var _0x32d4c0=as[_0xabb5('0x35')](_0x875f3a,_0x1fcc4e[_0xabb5('0x36')],_0x89137a);_0x410861[_0xabb5('0x37')][_0x3f85dd](_0x32d4c0['text'],_0x32d4c0['value']['start'],_0x32d4c0[_0xabb5('0x38')]['end']);}else{if(_0x89137a[_0xabb5('0x1d')]==='Tag'){var _0x1a283e=_0x89137a['value'][_0xabb5('0x22')](',')[_0xabb5('0x39')](function(_0x1461b8){return Number(_0x1461b8);});var _0x673352=parseTagParameter(_0x1a283e);_0x410861[_0xabb5('0x3a')][_0xabb5('0x3b')][_0xabb5('0x3c')](_0x673352);_0x410861['tags'][_0xabb5('0x3d')]=_0x1a283e;}else if(_0x89137a[_0xabb5('0x1d')]===_0xabb5('0x3e')){_0x410861['user']['clause'][_0xabb5('0x3c')]('uc.UserId\x20=\x20?',_0x89137a['value']);_0x410861[_0xabb5('0x3f')][_0xabb5('0x40')]=!![];}}}return _0x410861;}function parseModelFields(_0x165819,_0x502448){var _0x14ebe8=squel[_0xabb5('0x1f')]();var _0x196bac=_(_0x165819)[_0xabb5('0x41')]()[_0xabb5('0x39')](function(_0x40de5a){return _['some'](_0x502448,['name',_0x40de5a])?_0x40de5a:undefined;})[_0xabb5('0x42')]()[_0xabb5('0x38')]();if(_0x165819['Contact']){_0x196bac[_0xabb5('0x1b')](_0xabb5('0x43'));}if(_0x165819[_0xabb5('0x3e')]){_0x196bac[_0xabb5('0x1b')](_0xabb5('0x3e'));}if(_0x196bac[_0xabb5('0x23')]>0x0){_0x196bac['forEach'](function(_0x35c63d){if(_0x35c63d===_0xabb5('0x5')){_0x14ebe8[_0xabb5('0x3c')](_0xabb5('0x44'),[][_0xabb5('0x45')](_0x165819[_0x35c63d]));}else if(_0x35c63d===_0xabb5('0x43')){var _0x25bfdd='%'+_0x165819[_0x35c63d]+'%';_0x14ebe8['and'](_0xabb5('0x46'),_0x25bfdd);}else if(_0x35c63d===_0xabb5('0x3e')){_0x14ebe8[_0xabb5('0x3c')](_0xabb5('0x47'),_0x165819[_0x35c63d]);}else{_0x14ebe8[_0xabb5('0x3c')]('c.'+_0x35c63d+_0xabb5('0x48'),_0x165819[_0x35c63d]);}});}return _0x14ebe8;}function parseQueryParameters(_0x1ef76c,_0x4c6718){var _0x5382e3=getSqlClauses();return Promise[_0xabb5('0x49')]()[_0xabb5('0x4a')](function(){return parseModelFields(_0x1ef76c,_0x4c6718);})[_0xabb5('0x4a')](function(_0x4dd6cf){_0x5382e3['fields'][_0xabb5('0x3c')](_0x4dd6cf);return parseTagParameter(_0x1ef76c[_0xabb5('0x4b')]);})[_0xabb5('0x4a')](function(_0x13faef){_0x5382e3[_0xabb5('0x3a')]['clause'][_0xabb5('0x3c')](_0x13faef);return parseSearchFilter(_0x1ef76c[_0xabb5('0x4c')]);})[_0xabb5('0x4a')](function(_0x13ae53){_0x5382e3['filter']=_0x13ae53;return _0x5382e3;});}function checkListsRestrictions(_0xa3848d,_0x2fe802,_0x340184){var _0x120280=squel[_0xabb5('0x1f')]();return Promise['resolve']()[_0xabb5('0x4a')](function(){if(_0x2fe802['search']&&_0xa3848d[_0xabb5('0x3')]==='agent'&&!_0x340184){return _0xa3848d[_0xabb5('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0xabb5('0x4a')](function(_0x257c2a){if(_0x257c2a){if(_0x257c2a['length']===0x0){_0x120280[_0xabb5('0x3c')]('c.ListId\x20IS\x20NULL');}else{_0x120280[_0xabb5('0x3c')]('c.ListId\x20IN\x20?',_[_0xabb5('0x39')](_0x257c2a,'id'));}}})[_0xabb5('0x4a')](function(){return _0x120280;});}function buildContactsQuery(_0x595d14,_0x47fbbe,_0x152fae,_0x420bb5,_0x42da94,_0x4ccc49){if(_0x47fbbe){_0x47fbbe=_0x152fae[_0xabb5('0x4e')];}_0x595d14=addFieldsToQuery(_0x595d14,_0x47fbbe,_0x420bb5,_0x4ccc49,!![]);var _0x1a9628=squel[_0xabb5('0x8')]();_0x1a9628=addFieldsToQuery(_0x1a9628,_0x47fbbe,_0x420bb5,_0x4ccc49,![]);if(_0x420bb5||_0x4ccc49){_0x595d14=applyJoinClauses(_0x595d14,!![]);_0x595d14[_0xabb5('0x4f')](_0xabb5('0x50'));if(_0x152fae[_0xabb5('0x51')]){_0x1a9628[_0xabb5('0x51')](_0x152fae[_0xabb5('0x51')]);}if(_0x152fae['offset']){_0x1a9628['offset'](_0x152fae[_0xabb5('0x52')]);}}else{_0x1a9628=applyJoinClauses(_0x1a9628,![]);_0x1a9628[_0xabb5('0x4f')](_0xabb5('0x53'));if(_0x152fae[_0xabb5('0x51')]){_0x595d14['limit'](_0x152fae['limit']);}if(_0x152fae[_0xabb5('0x52')]){_0x595d14[_0xabb5('0x52')](_0x152fae['offset']);}}_0x1a9628[_0xabb5('0x54')](_0x42da94);if(_0x152fae[_0xabb5('0x55')]){_0x152fae[_0xabb5('0x55')][_0xabb5('0x1c')](function(_0x1ca44e){_0x595d14[_0xabb5('0x55')]('c.'+_0x1ca44e[0x0],_0x1ca44e[0x1]===_0xabb5('0x56')?![]:!![]);_0x1a9628[_0xabb5('0x55')](_0xabb5('0x57')+_0x1ca44e[0x0],_0x1ca44e[0x1]===_0xabb5('0x56')?![]:!![]);});}_0x1a9628['from'](_0x595d14,'subqry');return _0x1a9628;}function getFilteredContacts(_0x361de2){var _0x340139=[];return db[_0xabb5('0x58')][_0xabb5('0x59')]({'attributes':['id','name',_0xabb5('0x5a')],'raw':!![]})['then'](function(_0x4be716){_0x340139=_[_0xabb5('0x5b')](_0x4be716,'id');var _0x124e34={'type':db[_0xabb5('0x5c')]['QueryTypes'][_0xabb5('0x5d')],'model':db[_0xabb5('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xabb5('0x5f')][_0xabb5('0x60')](_0x361de2[_0xabb5('0x61')](),_0x124e34);})[_0xabb5('0x4a')](function(_0x4b0e97){_0x4b0e97['forEach'](function(_0x381cee){if(_0x381cee['TagIds']){_0x381cee[_0xabb5('0x62')]=[];_0x381cee[_0xabb5('0x19')][_0xabb5('0x22')](',')[_0xabb5('0x1c')](function(_0x362f28){_0x381cee['Tags'][_0xabb5('0x1b')](_0x340139[_0x362f28]);});}delete _0x381cee[_0xabb5('0x19')];});return _0x4b0e97;});}function countFilteredContacts(_0x5a0dac,_0x2ae02d){var _0x1b9fca=_0x5a0dac[_0xabb5('0x63')]();_0x1b9fca[_0xabb5('0x1d')]('COUNT(*)');_0x1b9fca=applyJoinClauses(_0x1b9fca,!![]);_0x5a0dac[_0xabb5('0x4f')](_0xabb5('0x50'));var _0x26b2b9=utils[_0xabb5('0x64')](_0x2ae02d);if(!_[_0xabb5('0x65')](_0x26b2b9)){_0x1b9fca[_0xabb5('0xa')](_0xabb5('0x66'),_0x26b2b9);}var _0x48ecc4={'type':db[_0xabb5('0x5c')]['QueryTypes'][_0xabb5('0x5d')],'raw':!![]};return db[_0xabb5('0x5f')][_0xabb5('0x60')](_0x1b9fca[_0xabb5('0x61')](),_0x48ecc4)[_0xabb5('0x4a')](function(_0x167c3e){return _0x167c3e[0x0]['COUNT(*)'];});}module[_0xabb5('0x67')]={'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 2fa0892..e0fb18a 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 _0x45f2=['filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','update','final','binary','write','end','close','unlink','decryptFile','createWriteStream','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x45f2,0xa2));var _0x245f=function(_0x474e2b,_0x18ca18){_0x474e2b=_0x474e2b-0x0;var _0xc24922=_0x45f2[_0x474e2b];return _0xc24922;};'use strict';var crypto=require(_0x245f('0x0'));var fs=require('fs');var BPromise=require(_0x245f('0x1'));var _=require('lodash');var config=require(_0x245f('0x2'));var logger=require('../../config/logger')(_0x245f('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x245f('0x4')][_0x245f('0x5')],'algorithm':_0x245f('0x6')};const fileOptions={'algorithm':_0x245f('0x7')};if(config[_0x245f('0x8')]&&config[_0x245f('0x8')][_0x245f('0x9')]){var isSupported=isAlgorithmSupported(config[_0x245f('0x8')][_0x245f('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x245f('0x8')][_0x245f('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x245f('0xa')](config[_0x245f('0x8')][_0x245f('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x19d95b){return AES_SUPPORTED_RX[_0x245f('0xb')](_0x19d95b);}function getSupportedCiphers(){return crypto[_0x245f('0xc')]()[_0x245f('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4bf1e5){return getSupportedCiphers()[_0x245f('0xe')](_0x4bf1e5)>-0x1;}function combineOptions(_0x5011fb){var _0x40fca6={};for(var _0x440dfc in fileOptions){if(fileOptions[_0x245f('0xf')](_0x440dfc)){_0x40fca6[_0x440dfc]=fileOptions[_0x440dfc];}}if(_0x5011fb){for(var _0x1ef6e0 in _0x5011fb){if(_0x5011fb['hasOwnProperty'](_0x1ef6e0)){_0x40fca6[_0x1ef6e0]=_0x5011fb[_0x1ef6e0];}}}return _0x40fca6;}exports[_0x245f('0x10')]=function(_0x5ee978,_0x35b37c,_0x31a911,_0x794ac2){return new BPromise(function(_0x216ab1,_0x18ad0e){_0x794ac2=combineOptions(_0x794ac2);var _0xbae015=new Buffer(_0x31a911);var _0x52ff3c=fs[_0x245f('0x11')](_0x5ee978);var _0x4ea4ba=fs['createWriteStream'](_0x35b37c);var _0x2b8cd3=crypto[_0x245f('0x12')](_0x794ac2['algorithm'],_0xbae015);_0x52ff3c['on']('data',function(_0x4b9420){var _0x2580f6=new Buffer(_0x2b8cd3[_0x245f('0x13')](_0x4b9420),'binary');_0x4ea4ba['write'](_0x2580f6);});_0x52ff3c['on']('end',function(){try{var _0x56e699=new Buffer(_0x2b8cd3[_0x245f('0x14')]('binary'),_0x245f('0x15'));_0x4ea4ba[_0x245f('0x16')](_0x56e699);_0x4ea4ba[_0x245f('0x17')]();_0x4ea4ba['on'](_0x245f('0x18'),function(){return _0x216ab1(_0x35b37c);});}catch(_0x1bc676){fs[_0x245f('0x19')](_0x35b37c);return _0x18ad0e(_0x1bc676);}});});};exports[_0x245f('0x1a')]=function(_0xaeddee,_0x1acde3,_0x2123d9,_0x14f3e6){return new BPromise(function(_0x3e2767,_0x4a0b0f){_0x14f3e6=combineOptions(_0x14f3e6);var _0x51cb50=new Buffer(_0x2123d9);var _0x1bd995=fs[_0x245f('0x11')](_0xaeddee);var _0x34696c=fs[_0x245f('0x1b')](_0x1acde3);var _0x84d5db=crypto[_0x245f('0x1c')](_0x14f3e6[_0x245f('0x9')],_0x51cb50);_0x1bd995['on'](_0x245f('0x1d'),function(_0x46fb52){var _0x220771=new Buffer(_0x84d5db[_0x245f('0x13')](_0x46fb52),_0x245f('0x15'));_0x34696c['write'](_0x220771);});_0x1bd995['on'](_0x245f('0x17'),function(){try{var _0x4271c0=new Buffer(_0x84d5db[_0x245f('0x14')](_0x245f('0x15')),_0x245f('0x15'));_0x34696c[_0x245f('0x16')](_0x4271c0);_0x34696c[_0x245f('0x17')]();_0x34696c['on']('close',function(){return _0x3e2767(_0x1acde3);});}catch(_0x417804){fs['unlink'](_0x1acde3);return _0x4a0b0f(_0x417804);}});});};exports[_0x245f('0x1e')]=function(_0x5850f5,_0x1cb2ca,_0x4700df){var _0x4c8b93=_0x4700df||stringOptions['algorithm'];var _0x2eb5ca=_0x1cb2ca||stringOptions[_0x245f('0x1f')];var _0x1649a0=crypto[_0x245f('0x12')](_0x4c8b93,_0x2eb5ca);var _0x52aa66=_0x1649a0[_0x245f('0x13')](_0x5850f5,_0x245f('0x20'),'base64');_0x52aa66+=_0x1649a0[_0x245f('0x14')](_0x245f('0x21'));return _0x52aa66;};exports[_0x245f('0x22')]=function(_0x340453,_0x170edc,_0x208b41){var _0x452f8e=_0x208b41||stringOptions[_0x245f('0x9')];var _0xa2f41a=_0x170edc||stringOptions[_0x245f('0x1f')];var _0x26543a=crypto[_0x245f('0x1c')](_0x452f8e,_0xa2f41a);var _0x4b5b43=_0x26543a['update'](_0x340453,_0x245f('0x21'),_0x245f('0x20'));_0x4b5b43+=_0x26543a[_0x245f('0x14')](_0x245f('0x20'));return _0x4b5b43;}; \ No newline at end of file +var _0xc940=['aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','write','unlink','createDecipher','final','close','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets'];(function(_0x34e79d,_0x1fb826){var _0x56afa8=function(_0x5177f4){while(--_0x5177f4){_0x34e79d['push'](_0x34e79d['shift']());}};_0x56afa8(++_0x1fb826);}(_0xc940,0x11a));var _0x0c94=function(_0x983b,_0x415b47){_0x983b=_0x983b-0x0;var _0x30ae07=_0xc940[_0x983b];return _0x30ae07;};'use strict';var crypto=require(_0x0c94('0x0'));var fs=require('fs');var BPromise=require(_0x0c94('0x1'));var _=require(_0x0c94('0x2'));var config=require(_0x0c94('0x3'));var logger=require(_0x0c94('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0c94('0x5')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x0c94('0x6')};if(config[_0x0c94('0x7')]&&config[_0x0c94('0x7')][_0x0c94('0x8')]){var isSupported=isAlgorithmSupported(config[_0x0c94('0x7')][_0x0c94('0x8')]);if(isSupported){fileOptions[_0x0c94('0x8')]=config[_0x0c94('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0c94('0x9')](',\x20');logger[_0x0c94('0xa')](config['encrypt'][_0x0c94('0x8')],_0x0c94('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x5ea3be){return AES_SUPPORTED_RX[_0x0c94('0xc')](_0x5ea3be);}function getSupportedCiphers(){return crypto[_0x0c94('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x4245b9){return getSupportedCiphers()['indexOf'](_0x4245b9)>-0x1;}function combineOptions(_0x18542){var _0x5dbc8e={};for(var _0xaeb508 in fileOptions){if(fileOptions[_0x0c94('0xe')](_0xaeb508)){_0x5dbc8e[_0xaeb508]=fileOptions[_0xaeb508];}}if(_0x18542){for(var _0x1fea4b in _0x18542){if(_0x18542['hasOwnProperty'](_0x1fea4b)){_0x5dbc8e[_0x1fea4b]=_0x18542[_0x1fea4b];}}}return _0x5dbc8e;}exports[_0x0c94('0xf')]=function(_0x5c6a72,_0x5b25cf,_0x50e6ea,_0x3b95d1){return new BPromise(function(_0x542677,_0x4047f6){_0x3b95d1=combineOptions(_0x3b95d1);var _0x565839=new Buffer(_0x50e6ea);var _0x153c10=fs[_0x0c94('0x10')](_0x5c6a72);var _0x41844d=fs[_0x0c94('0x11')](_0x5b25cf);var _0x16c192=crypto[_0x0c94('0x12')](_0x3b95d1[_0x0c94('0x8')],_0x565839);_0x153c10['on'](_0x0c94('0x13'),function(_0xb7261d){var _0x527de5=new Buffer(_0x16c192[_0x0c94('0x14')](_0xb7261d),_0x0c94('0x15'));_0x41844d['write'](_0x527de5);});_0x153c10['on'](_0x0c94('0x16'),function(){try{var _0x14bff4=new Buffer(_0x16c192['final'](_0x0c94('0x15')),_0x0c94('0x15'));_0x41844d[_0x0c94('0x17')](_0x14bff4);_0x41844d[_0x0c94('0x16')]();_0x41844d['on']('close',function(){return _0x542677(_0x5b25cf);});}catch(_0x8274f5){fs[_0x0c94('0x18')](_0x5b25cf);return _0x4047f6(_0x8274f5);}});});};exports['decryptFile']=function(_0x278493,_0x4e207a,_0x3af3e6,_0xd2d068){return new BPromise(function(_0x2bf691,_0x18f2d5){_0xd2d068=combineOptions(_0xd2d068);var _0x2df324=new Buffer(_0x3af3e6);var _0x1dce97=fs[_0x0c94('0x10')](_0x278493);var _0x4413c7=fs['createWriteStream'](_0x4e207a);var _0x5a4928=crypto[_0x0c94('0x19')](_0xd2d068[_0x0c94('0x8')],_0x2df324);_0x1dce97['on'](_0x0c94('0x13'),function(_0x21191d){var _0xbb6864=new Buffer(_0x5a4928[_0x0c94('0x14')](_0x21191d),_0x0c94('0x15'));_0x4413c7[_0x0c94('0x17')](_0xbb6864);});_0x1dce97['on'](_0x0c94('0x16'),function(){try{var _0x20528a=new Buffer(_0x5a4928[_0x0c94('0x1a')](_0x0c94('0x15')),_0x0c94('0x15'));_0x4413c7[_0x0c94('0x17')](_0x20528a);_0x4413c7['end']();_0x4413c7['on'](_0x0c94('0x1b'),function(){return _0x2bf691(_0x4e207a);});}catch(_0xaec973){fs['unlink'](_0x4e207a);return _0x18f2d5(_0xaec973);}});});};exports['encryptString']=function(_0x2c6766,_0x3d6b49,_0x52765b){var _0x39286a=_0x52765b||stringOptions[_0x0c94('0x8')];var _0x21f396=_0x3d6b49||stringOptions[_0x0c94('0x1c')];var _0x2583df=crypto[_0x0c94('0x12')](_0x39286a,_0x21f396);var _0x42407c=_0x2583df['update'](_0x2c6766,'utf8','base64');_0x42407c+=_0x2583df[_0x0c94('0x1a')](_0x0c94('0x1d'));return _0x42407c;};exports[_0x0c94('0x1e')]=function(_0x405a81,_0x1682ad,_0x51c604){var _0x3e0301=_0x51c604||stringOptions[_0x0c94('0x8')];var _0x522529=_0x1682ad||stringOptions[_0x0c94('0x1c')];var _0x54e3d7=crypto[_0x0c94('0x19')](_0x3e0301,_0x522529);var _0x52f115=_0x54e3d7[_0x0c94('0x14')](_0x405a81,'base64',_0x0c94('0x1f'));_0x52f115+=_0x54e3d7['final'](_0x0c94('0x1f'));return _0x52f115;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 01342f9..3dbcfbb 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 _0xc286=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','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','num','Empty','length','range','isInteger','forEach','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x119c94,_0x580a55){var _0x55ebee=function(_0x5195ec){while(--_0x5195ec){_0x119c94['push'](_0x119c94['shift']());}};_0x55ebee(++_0x580a55);}(_0xc286,0xda));var _0x6c28=function(_0x22e4d8,_0x3d4684){_0x22e4d8=_0x22e4d8-0x0;var _0x2b54ad=_0xc286[_0x22e4d8];return _0x2b54ad;};'use strict';var util=require('util');var path=require(_0x6c28('0x0'));var _=require('lodash');var csv=require(_0x6c28('0x1'));var fs=require('fs');var BPromise=require(_0x6c28('0x2'));var zipdir=require(_0x6c28('0x3'));var rimraf=require(_0x6c28('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6c28('0x5'))[_0x6c28('0x6')];var logger=require(_0x6c28('0x7'))(_0x6c28('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6c28('0x9')][0x3];var PATH=process[_0x6c28('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x201a4e,_0xa9cb7d){var _0x5bb311={'status':_0x201a4e};var _0x527e74={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa9cb7d){_0x5bb311['savename']=_0xa9cb7d;}return db[_0x6c28('0xa')][_0x6c28('0xb')](_0x5bb311,_0x527e74);}function main(){var _0x153270=0x1388;var _0x5e5efd;logger[_0x6c28('0xc')](util[_0x6c28('0xd')](_0x6c28('0xe'),EXTRACTED_REPORT_ID,_0x6c28('0xf')));return db[_0x6c28('0x10')][_0x6c28('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6c28('0x12'),_0x6c28('0x13')]})[_0x6c28('0x14')](function(_0xc17f18){if(_0xc17f18){_0x5e5efd=_0xc17f18;_0x153270=_0x5e5efd[_0x6c28('0x13')]||0x1388;}})[_0x6c28('0x14')](function(){return dbH[_0x6c28('0x15')][_0x6c28('0x16')](util[_0x6c28('0xd')](_0x6c28('0x17'),QUERY),{'type':dbH[_0x6c28('0x15')][_0x6c28('0x18')]['SELECT']});})[_0x6c28('0x14')](function(_0x5a65b2){if(!_0x5a65b2[0x0][_0x6c28('0x19')]){return analyticExtractedReport(_0x6c28('0x1a'));}var _0x184da6=[];var _0x332b59=0x0;if(_0x5e5efd[_0x6c28('0x12')]){if(_0x5a65b2&&_0x5a65b2[_0x6c28('0x1b')]){var _0xe741cc=_[_0x6c28('0x1c')](_0x5a65b2[0x0]['num']/_0x153270);var _0x3a8e7e=Number[_0x6c28('0x1d')](_0x5a65b2[0x0][_0x6c28('0x19')]/_0x153270)?_0x5a65b2[0x0][_0x6c28('0x19')]%_0x153270:0x0;_0xe741cc[_0x6c28('0x1e')](function(_0x1d6294){if(_0x1d6294>0x0){_0x332b59+=_0x153270;}_0x184da6[_0x6c28('0x1f')](dbH[_0x6c28('0x15')][_0x6c28('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x153270,_0x332b59),{'type':dbH[_0x6c28('0x15')][_0x6c28('0x18')][_0x6c28('0x20')]}));});if(_0x3a8e7e>0x0){_0x332b59+=_0x153270;_0x184da6[_0x6c28('0x1f')](dbH['sequelize'][_0x6c28('0x16')](util[_0x6c28('0xd')](_0x6c28('0x21'),QUERY,_0x3a8e7e,_0x332b59),{'type':dbH[_0x6c28('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x184da6[_0x6c28('0x1f')](dbH[_0x6c28('0x15')][_0x6c28('0x16')](QUERY,{'type':dbH[_0x6c28('0x15')][_0x6c28('0x18')][_0x6c28('0x20')]}));}var _0x11d650=path[_0x6c28('0x22')](PATH);var _0x13b775=path[_0x6c28('0x23')](PATH,'.csv');var _0x249f1c=_0x5e5efd[_0x6c28('0x12')]&&_0x184da6[_0x6c28('0x1b')]>0x1;var _0x15c953=[];if(!fs[_0x6c28('0x24')](path[_0x6c28('0x25')](_0x11d650,_0x13b775))&&_0x249f1c){fs[_0x6c28('0x26')](path[_0x6c28('0x25')](_0x11d650,_0x13b775));}return BPromise[_0x6c28('0x27')](_0x184da6,function(_0x3ddedf){_0x15c953[_0x6c28('0x1f')](_0x3ddedf);})[_0x6c28('0x14')](function(){for(var _0x1c446e=0x0;_0x1c446e<_0x15c953['length'];_0x1c446e+=0x1){var _0x181c0c;var _0x2c9b50=_0x15c953[_0x1c446e];if(_0x249f1c){_0x181c0c=path[_0x6c28('0x25')](_0x11d650,_0x13b775,util[_0x6c28('0xd')](_0x6c28('0x28'),_0x13b775,_0x1c446e,_0x6c28('0x29')));}else{_0x181c0c=path[_0x6c28('0x25')](_0x11d650,util[_0x6c28('0xd')]('%s.%s',_0x13b775,_0x6c28('0x29')));}fs[_0x6c28('0x2a')](_0x181c0c,csv(_0x2c9b50));}})[_0x6c28('0x14')](function(){if(_0x249f1c){return new Promise(function(_0x4f3b4e){zipdir(path[_0x6c28('0x25')](_0x11d650,_0x13b775),{'saveTo':path[_0x6c28('0x25')](_0x11d650,util[_0x6c28('0xd')](_0x6c28('0x2b'),_0x13b775,_0x6c28('0x2c')))},function(_0x51e372,_0x3e82cd){rimraf(path[_0x6c28('0x25')](_0x11d650,_0x13b775),function(){});_0x4f3b4e(_0x6c28('0x2d'));});});}})['then'](function(){logger[_0x6c28('0xc')](util[_0x6c28('0xd')](_0x6c28('0x2e'),EXTRACTED_REPORT_ID,_0x6c28('0xf')));return analyticExtractedReport(_0x6c28('0x2f'),_0x249f1c?util['format'](_0x6c28('0x2b'),_0x13b775,_0x249f1c?'zip':_0x6c28('0x29')):null);});})[_0x6c28('0x30')](function(_0x1b5477){logger[_0x6c28('0xc')](util[_0x6c28('0xd')](_0x6c28('0x31'),EXTRACTED_REPORT_ID,_0x6c28('0xf')),util[_0x6c28('0x32')](_0x1b5477,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6c28('0x33'));})[_0x6c28('0x34')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x679b=['zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','info','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','QueryTypes','num','length','range','isInteger','forEach','push','query','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','finally','exit','util','path','lodash'];(function(_0x48b62c,_0x3bc483){var _0x58a6de=function(_0x3308ef){while(--_0x3308ef){_0x48b62c['push'](_0x48b62c['shift']());}};_0x58a6de(++_0x3bc483);}(_0x679b,0x138));var _0xb679=function(_0x2c63d7,_0x317ac5){_0x2c63d7=_0x2c63d7-0x0;var _0x572d50=_0x679b[_0x2c63d7];return _0x572d50;};'use strict';var util=require(_0xb679('0x0'));var path=require(_0xb679('0x1'));var _=require(_0xb679('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xb679('0x3'));var rimraf=require(_0xb679('0x4'));var db=require(_0xb679('0x5'))['db'];var dbH=require(_0xb679('0x5'))[_0xb679('0x6')];var logger=require('../../config/logger')(_0xb679('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb679('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xb679('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x22f0b5,_0x48b620){var _0xa055d8={'status':_0x22f0b5};var _0x1bebed={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x48b620){_0xa055d8['savename']=_0x48b620;}return db[_0xb679('0x9')]['update'](_0xa055d8,_0x1bebed);}function main(){var _0x91c9c8=0x1388;var _0x4e93a7;logger[_0xb679('0xa')](util[_0xb679('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb679('0xc')));return db[_0xb679('0xd')][_0xb679('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb679('0xf'),_0xb679('0x10')]})[_0xb679('0x11')](function(_0x264e21){if(_0x264e21){_0x4e93a7=_0x264e21;_0x91c9c8=_0x4e93a7['splitSizeCsv']||0x1388;}})[_0xb679('0x11')](function(){return dbH[_0xb679('0x12')]['query'](util[_0xb679('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xb679('0x13')]['SELECT']});})[_0xb679('0x11')](function(_0x38ffea){if(!_0x38ffea[0x0][_0xb679('0x14')]){return analyticExtractedReport('Empty');}var _0x2ba91d=[];var _0x5b25fc=0x0;if(_0x4e93a7[_0xb679('0xf')]){if(_0x38ffea&&_0x38ffea[_0xb679('0x15')]){var _0x53ff5f=_[_0xb679('0x16')](_0x38ffea[0x0]['num']/_0x91c9c8);var _0x1c54cf=Number[_0xb679('0x17')](_0x38ffea[0x0]['num']/_0x91c9c8)?_0x38ffea[0x0][_0xb679('0x14')]%_0x91c9c8:0x0;_0x53ff5f[_0xb679('0x18')](function(_0x406382){if(_0x406382>0x0){_0x5b25fc+=_0x91c9c8;}_0x2ba91d[_0xb679('0x19')](dbH[_0xb679('0x12')][_0xb679('0x1a')](util[_0xb679('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x91c9c8,_0x5b25fc),{'type':dbH[_0xb679('0x12')][_0xb679('0x13')][_0xb679('0x1b')]}));});if(_0x1c54cf>0x0){_0x5b25fc+=_0x91c9c8;_0x2ba91d[_0xb679('0x19')](dbH[_0xb679('0x12')][_0xb679('0x1a')](util[_0xb679('0xb')](_0xb679('0x1c'),QUERY,_0x1c54cf,_0x5b25fc),{'type':dbH[_0xb679('0x12')][_0xb679('0x13')]['SELECT']}));}}}else{_0x2ba91d[_0xb679('0x19')](dbH[_0xb679('0x12')][_0xb679('0x1a')](QUERY,{'type':dbH[_0xb679('0x12')][_0xb679('0x13')]['SELECT']}));}var _0xa1f807=path[_0xb679('0x1d')](PATH);var _0x20fc14=path[_0xb679('0x1e')](PATH,_0xb679('0x1f'));var _0xe5cf83=_0x4e93a7['split']&&_0x2ba91d['length']>0x1;var _0x5bf282=[];if(!fs[_0xb679('0x20')](path['join'](_0xa1f807,_0x20fc14))&&_0xe5cf83){fs['mkdirSync'](path[_0xb679('0x21')](_0xa1f807,_0x20fc14));}return BPromise[_0xb679('0x22')](_0x2ba91d,function(_0x2eeb16){_0x5bf282[_0xb679('0x19')](_0x2eeb16);})[_0xb679('0x11')](function(){for(var _0x54db1d=0x0;_0x54db1d<_0x5bf282[_0xb679('0x15')];_0x54db1d+=0x1){var _0xecc96e;var _0x8e03ae=_0x5bf282[_0x54db1d];if(_0xe5cf83){_0xecc96e=path['join'](_0xa1f807,_0x20fc14,util[_0xb679('0xb')]('%s%d.%s',_0x20fc14,_0x54db1d,_0xb679('0x23')));}else{_0xecc96e=path['join'](_0xa1f807,util['format'](_0xb679('0x24'),_0x20fc14,'csv'));}fs[_0xb679('0x25')](_0xecc96e,csv(_0x8e03ae));}})[_0xb679('0x11')](function(){if(_0xe5cf83){return new Promise(function(_0x29da73){zipdir(path[_0xb679('0x21')](_0xa1f807,_0x20fc14),{'saveTo':path[_0xb679('0x21')](_0xa1f807,util[_0xb679('0xb')](_0xb679('0x24'),_0x20fc14,_0xb679('0x26')))},function(_0x543c89,_0x44a897){rimraf(path[_0xb679('0x21')](_0xa1f807,_0x20fc14),function(){});_0x29da73(_0xb679('0x27'));});});}})['then'](function(){logger['info'](util[_0xb679('0xb')](_0xb679('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xb679('0x29'),_0xe5cf83?util[_0xb679('0xb')](_0xb679('0x24'),_0x20fc14,_0xe5cf83?_0xb679('0x26'):_0xb679('0x23')):null);});})[_0xb679('0x2a')](function(_0x2f6b8c){logger[_0xb679('0xa')](util[_0xb679('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x2f6b8c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb679('0x2b')](function(){process[_0xb679('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 56c0c95..3205640 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 _0x4db4=['then','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','map','pick','value','length','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','margin','landscape','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4db4,0x195));var _0x44db=function(_0x1938d7,_0x52cf17){_0x1938d7=_0x1938d7-0x0;var _0x36f41d=_0x4db4[_0x1938d7];return _0x36f41d;};'use strict';var _=require(_0x44db('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x44db('0x1'));var moment=require(_0x44db('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x44db('0x3'));var zipdir=require(_0x44db('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x44db('0x5'))[_0x44db('0x6')];var window=new JSDOM('')[_0x44db('0x7')];var BPromise=require(_0x44db('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x44db('0x9'))[_0x44db('0xa')];var logger=require(_0x44db('0xb'))(_0x44db('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x44db('0xd')][0x3];var PATH=process[_0x44db('0xd')][0x4];var NAME=process[_0x44db('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2c0edc,_0x3ab6f6){var _0x17d7df={'status':_0x2c0edc};var _0x2a4ddd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3ab6f6){_0x17d7df[_0x44db('0xe')]=_0x3ab6f6;}return db[_0x44db('0xf')]['update'](_0x17d7df,_0x2a4ddd);}function getHeaders(_0x13549f){return _[_0x44db('0x10')](_0x13549f,function(_0xcefde1){return{'text':_0xcefde1,'style':'tableHeader'};});}function getRows(_0x23f0a7,_0x583ba5){return _[_0x44db('0x10')](_0x583ba5,function(_0x3f3097){return _(_0x3f3097)[_0x44db('0x11')](_0x23f0a7)[_0x44db('0x10')](function(_0x205739){return _0x205739?_['toString'](_0x205739):'';})[_0x44db('0x12')]();});}function createTable(_0x521b8d,_0xbfe817){var _0xc2d8b0={'widths':_['fill'](Array(_0x521b8d[_0x44db('0x13')]),0x91),'heights':function(_0x517736){return _0x517736===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xba4c11=getHeaders(_0x521b8d);_0xc2d8b0[_0x44db('0x14')][_0x44db('0x15')](_0xba4c11);var _0x5511f9=getRows(_0x521b8d,_0xbfe817);_0xc2d8b0[_0x44db('0x14')]=_0xc2d8b0[_0x44db('0x14')][_0x44db('0x16')](_0x5511f9);return _0xc2d8b0;}function createTables(_0x44a220){var _0x1f2279=[];var _0x443684=_[_0x44db('0x17')](Object[_0x44db('0x18')](_0x44a220[0x0]),0x5);_0x443684['forEach'](function(_0x11b8f3){_0x1f2279['push'](createTable(_0x11b8f3,_0x44a220));});return _0x1f2279;}function getPDFDocDefinition(_0x52d4bb){var _0x27dc19=util[_0x44db('0x19')](_0x44db('0x1a'),NAME,EXTRACTED_REPORT[_0x44db('0x1b')],moment(EXTRACTED_REPORT[_0x44db('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x44db('0x19')](FORMAT));var _0x179021=[];for(var _0x34d81b=0x0;_0x34d81b<_0x52d4bb['length'];_0x34d81b++){var _0x3a5ea0=[];if(_0x34d81b===0x0){_0x3a5ea0[_0x44db('0x15')]({'text':_0x27dc19,'style':_0x44db('0x1d')});}var _0x2fb8d6={'table':_0x52d4bb[_0x34d81b]};if(_0x34d81b>0x0){_0x2fb8d6[_0x44db('0x1e')]='before';_0x2fb8d6[_0x44db('0x1f')]=[0x0,0x46,0x0,0x0];}_0x3a5ea0[_0x44db('0x15')](_0x2fb8d6);_0x179021[_0x44db('0x15')](_0x3a5ea0);}return{'pageSize':'A4','pageOrientation':_0x44db('0x20'),'content':_0x179021,'footer':function(_0x5c9a7b,_0x1a1194){return{'text':_0x5c9a7b[_0x44db('0x21')]()+_0x44db('0x22')+_0x1a1194,'style':_0x44db('0x23')};},'defaultStyle':{'font':_0x44db('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x44db('0x25')},'footer':{'alignment':_0x44db('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x22e39b){var _0x4baa29=0x1388;var _0x202509;if(!_0x22e39b[0x0][_0x44db('0x27')]){return analyticExtractedReport(_0x44db('0x28'));}return db[_0x44db('0x29')][_0x44db('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x44db('0x2b'),_0x44db('0x2c')]})[_0x44db('0x2d')](function(_0x40c95c){if(_0x40c95c){_0x202509=_0x40c95c;_0x4baa29=_0x202509[_0x44db('0x2c')]||0x3e8;}})['then'](function(){var _0x209bad=[];var _0x3daa66=0x0;if(_0x202509[_0x44db('0x2b')]){if(_0x22e39b&&_0x22e39b[_0x44db('0x13')]){var _0x5797cf=_[_0x44db('0x2e')](_0x22e39b[0x0]['num']/_0x4baa29);var _0x42818a=Number['isInteger'](_0x22e39b[0x0]['num']/_0x4baa29)?_0x22e39b[0x0][_0x44db('0x27')]%_0x4baa29:0x0;_0x5797cf[_0x44db('0x2f')](function(_0x2511d6){if(_0x2511d6>0x0){_0x3daa66+=_0x4baa29;}_0x209bad[_0x44db('0x15')](dbH['sequelize']['query'](util[_0x44db('0x19')](_0x44db('0x30'),QUERY,_0x4baa29,_0x3daa66),{'type':dbH[_0x44db('0x31')][_0x44db('0x32')][_0x44db('0x33')]}));});if(_0x42818a>0x0){_0x3daa66+=_0x4baa29;_0x209bad[_0x44db('0x15')](dbH[_0x44db('0x31')]['query'](util[_0x44db('0x19')](_0x44db('0x30'),QUERY,_0x42818a,_0x3daa66),{'type':dbH[_0x44db('0x31')][_0x44db('0x32')][_0x44db('0x33')]}));}}}else{_0x209bad[_0x44db('0x15')](dbH[_0x44db('0x31')][_0x44db('0x34')](QUERY,{'type':dbH['sequelize'][_0x44db('0x32')][_0x44db('0x33')]}));}var _0x4dc2ef=path['dirname'](PATH);var _0x3b4e41=path[_0x44db('0x35')](PATH,_0x44db('0x36'));var _0x4add37=_0x202509[_0x44db('0x2b')]&&_0x209bad['length']>0x1;var _0x53bb50=[];if(!fs[_0x44db('0x37')](path[_0x44db('0x38')](_0x4dc2ef,_0x3b4e41))&&_0x4add37){fs[_0x44db('0x39')](path['join'](_0x4dc2ef,_0x3b4e41));}return BPromise[_0x44db('0x3a')](_0x209bad,function(_0x3bb549){_0x53bb50['push'](_0x3bb549);})[_0x44db('0x2d')](function(){var _0x25e372=[];for(var _0x4f5d73=0x0;_0x4f5d73<_0x53bb50[_0x44db('0x13')];_0x4f5d73+=0x1){var _0x59c05f=_0x53bb50[_0x4f5d73];var _0x2d6dd0=createTables(_[_0x44db('0x3b')](_0x59c05f));var _0x4db22e;var _0x297f68=getPDFDocDefinition(_0x2d6dd0);var _0x180307=getPDFPrinter();var _0x38b246=_0x180307[_0x44db('0x3c')](_0x297f68);if(_0x4add37){_0x4db22e=path[_0x44db('0x38')](_0x4dc2ef,_0x3b4e41,util[_0x44db('0x19')](_0x44db('0x3d'),_0x3b4e41,_0x4f5d73,_0x44db('0x3e')));}else{_0x4db22e=path['join'](_0x4dc2ef,util[_0x44db('0x19')](_0x44db('0x3f'),_0x3b4e41,_0x44db('0x3e')));}_0x25e372['push'](writePDFDocument(_0x38b246,_0x4db22e));}return Promise[_0x44db('0x40')](_0x25e372);})[_0x44db('0x2d')](function(){if(_0x4add37){return new Promise(function(_0x578eb9){zipdir(path['join'](_0x4dc2ef,_0x3b4e41),{'saveTo':path[_0x44db('0x38')](_0x4dc2ef,util[_0x44db('0x19')](_0x44db('0x3f'),_0x3b4e41,_0x44db('0x41')))},function(){rimraf(path[_0x44db('0x38')](_0x4dc2ef,_0x3b4e41),function(){});_0x578eb9(_0x44db('0x42'));});});}})[_0x44db('0x2d')](function(){if(!_0x4add37)return;rimraf(path[_0x44db('0x38')](_0x4dc2ef,_0x3b4e41),function(){});})[_0x44db('0x2d')](function(){logger['info'](util[_0x44db('0x19')](_0x44db('0x43'),EXTRACTED_REPORT_ID,_0x44db('0x44')));return analyticExtractedReport('Completed',_0x4add37?util['format'](_0x44db('0x3f'),_0x3b4e41,_0x4add37?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x44db('0x45')](util['format'](_0x44db('0x46'),EXTRACTED_REPORT_ID,_0x44db('0x44')));return db['AnalyticExtractedReport'][_0x44db('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x29c8df){EXTRACTED_REPORT=_0x29c8df;return dbH[_0x44db('0x31')][_0x44db('0x34')](util[_0x44db('0x19')](_0x44db('0x48'),QUERY),{'type':dbH[_0x44db('0x31')]['QueryTypes'][_0x44db('0x33')]});})['then'](extractReport)['catch'](function(_0x362708){logger[_0x44db('0x45')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x44db('0x44')),util[_0x44db('0x49')](_0x362708,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x44db('0x4a'));})[_0x44db('0x4b')](function(){process[_0x44db('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x7e89c8=new PdfPrinter({'Arial':{'normal':__dirname+_0x44db('0x4d'),'bold':__dirname+_0x44db('0x4e'),'italics':__dirname+_0x44db('0x4f'),'bolditalics':__dirname+_0x44db('0x50')}});return _0x7e89c8;}function getPDFDocDefinitionFromHTML(_0x33e1a3,_0x410fe5){var _0x5d9ebd=util[_0x44db('0x19')](_0x44db('0x51'),_0x410fe5['channel'],_0x410fe5[_0x44db('0x52')]);var _0x52400a=moment()[_0x44db('0x19')](_0x44db('0x53'))[_0x44db('0x21')]();var _0x2c0d3e=htmlToPdfmake(_0x33e1a3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2c0d3e],'defaultStyle':{'font':_0x44db('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x44db('0x1d')}];},'footer':function(_0x13e7d1,_0x45b5aa){return[{'text':util['format'](_0x44db('0x54'),_0x5d9ebd,_0x13e7d1,_0x45b5aa,_0x52400a),'style':_0x44db('0x23')}];}};}function writePDFDocument(_0x588cb2,_0x31d1e5){return new Promise(function(_0x38f2df,_0x521215){var _0x4bbe2b=_0x588cb2[_0x44db('0x55')](fs[_0x44db('0x56')](_0x31d1e5));_0x4bbe2b['on'](_0x44db('0x57'),function(){_0x38f2df('finish');});_0x4bbe2b['on'](_0x44db('0x58'),function(_0x30cb6b){_0x521215(_0x30cb6b);});_0x588cb2['end']();});}exports[_0x44db('0x59')]=function(_0x2a6e45,_0x3164f9){var _0x357b37=getPDFPrinter();var _0x395996=getPDFDocDefinitionFromHTML(_0x2a6e45,_0x3164f9);var _0x47e4e4=_0x357b37[_0x44db('0x3c')](_0x395996);return writePDFDocument(_0x47e4e4,_0x3164f9[_0x44db('0x1')])['catch'](function(_0x180f05){throw _0x180f05;});}; \ No newline at end of file +var _0x4f11=['%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','pdf','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','createPdfKitDocument','path','catch','lodash','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','value','fill','length','body','concat','chunk','keys','push','name','startDate','format','header','pageBreak','before','landscape','\x20/\x20','Empty','split','then','splitSizePdf','range','num','isInteger','sequelize','query','QueryTypes'];(function(_0x384c01,_0x1e0dc5){var _0x300793=function(_0x32bb86){while(--_0x32bb86){_0x384c01['push'](_0x384c01['shift']());}};_0x300793(++_0x1e0dc5);}(_0x4f11,0x1d7));var _0x14f1=function(_0x595f00,_0x5f54a7){_0x595f00=_0x595f00-0x0;var _0x37b17b=_0x4f11[_0x595f00];return _0x37b17b;};'use strict';var _=require(_0x14f1('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x14f1('0x1'));var PdfPrinter=require(_0x14f1('0x2'));var zipdir=require(_0x14f1('0x3'));var rimraf=require(_0x14f1('0x4'));var JSDOM=require(_0x14f1('0x5'))[_0x14f1('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x14f1('0x7'));var db=require(_0x14f1('0x8'))['db'];var dbH=require(_0x14f1('0x8'))[_0x14f1('0x9')];var logger=require(_0x14f1('0xa'))(_0x14f1('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x14f1('0xc')][0x2]);var QUERY=process[_0x14f1('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x14f1('0xc')][0x5];var FORMAT=_0x14f1('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b5aad,_0x40a081){var _0x4da561={'status':_0x5b5aad};var _0x4c0a22={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x40a081){_0x4da561[_0x14f1('0xe')]=_0x40a081;}return db['AnalyticExtractedReport'][_0x14f1('0xf')](_0x4da561,_0x4c0a22);}function getHeaders(_0x1a2106){return _[_0x14f1('0x10')](_0x1a2106,function(_0xab8a96){return{'text':_0xab8a96,'style':_0x14f1('0x11')};});}function getRows(_0x2c443a,_0x50802e){return _[_0x14f1('0x10')](_0x50802e,function(_0x38b743){return _(_0x38b743)[_0x14f1('0x12')](_0x2c443a)[_0x14f1('0x10')](function(_0x22b7cd){return _0x22b7cd?_['toString'](_0x22b7cd):'';})[_0x14f1('0x13')]();});}function createTable(_0x8365ad,_0x2178fb){var _0x4d5e71={'widths':_[_0x14f1('0x14')](Array(_0x8365ad[_0x14f1('0x15')]),0x91),'heights':function(_0x4e7ba2){return _0x4e7ba2===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5d8624=getHeaders(_0x8365ad);_0x4d5e71[_0x14f1('0x16')]['push'](_0x5d8624);var _0x288892=getRows(_0x8365ad,_0x2178fb);_0x4d5e71[_0x14f1('0x16')]=_0x4d5e71[_0x14f1('0x16')][_0x14f1('0x17')](_0x288892);return _0x4d5e71;}function createTables(_0x2991cc){var _0x46b78c=[];var _0x3f7282=_[_0x14f1('0x18')](Object[_0x14f1('0x19')](_0x2991cc[0x0]),0x5);_0x3f7282['forEach'](function(_0x55e080){_0x46b78c[_0x14f1('0x1a')](createTable(_0x55e080,_0x2991cc));});return _0x46b78c;}function getPDFDocDefinition(_0x2e94f4){var _0x275f67=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x14f1('0x1b')],moment(EXTRACTED_REPORT[_0x14f1('0x1c')])[_0x14f1('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x14f1('0x1d')](FORMAT));var _0x18dc38=[];for(var _0x1b195a=0x0;_0x1b195a<_0x2e94f4[_0x14f1('0x15')];_0x1b195a++){var _0x25b664=[];if(_0x1b195a===0x0){_0x25b664[_0x14f1('0x1a')]({'text':_0x275f67,'style':_0x14f1('0x1e')});}var _0x4a7597={'table':_0x2e94f4[_0x1b195a]};if(_0x1b195a>0x0){_0x4a7597[_0x14f1('0x1f')]=_0x14f1('0x20');_0x4a7597['margin']=[0x0,0x46,0x0,0x0];}_0x25b664[_0x14f1('0x1a')](_0x4a7597);_0x18dc38[_0x14f1('0x1a')](_0x25b664);}return{'pageSize':'A4','pageOrientation':_0x14f1('0x21'),'content':_0x18dc38,'footer':function(_0x3ada11,_0x391a10){return{'text':_0x3ada11['toString']()+_0x14f1('0x22')+_0x391a10,'style':'footer'};},'defaultStyle':{'font':'Arial'},'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(_0x20f7c3){var _0x1255c1=0x1388;var _0x466f81;if(!_0x20f7c3[0x0]['num']){return analyticExtractedReport(_0x14f1('0x23'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x14f1('0x24'),'splitSizePdf']})[_0x14f1('0x25')](function(_0x2b1120){if(_0x2b1120){_0x466f81=_0x2b1120;_0x1255c1=_0x466f81[_0x14f1('0x26')]||0x3e8;}})['then'](function(){var _0x5d7546=[];var _0x4f61ab=0x0;if(_0x466f81[_0x14f1('0x24')]){if(_0x20f7c3&&_0x20f7c3[_0x14f1('0x15')]){var _0xed447a=_[_0x14f1('0x27')](_0x20f7c3[0x0][_0x14f1('0x28')]/_0x1255c1);var _0x552a26=Number[_0x14f1('0x29')](_0x20f7c3[0x0][_0x14f1('0x28')]/_0x1255c1)?_0x20f7c3[0x0][_0x14f1('0x28')]%_0x1255c1:0x0;_0xed447a['forEach'](function(_0x550aa4){if(_0x550aa4>0x0){_0x4f61ab+=_0x1255c1;}_0x5d7546[_0x14f1('0x1a')](dbH[_0x14f1('0x2a')][_0x14f1('0x2b')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1255c1,_0x4f61ab),{'type':dbH['sequelize'][_0x14f1('0x2c')]['SELECT']}));});if(_0x552a26>0x0){_0x4f61ab+=_0x1255c1;_0x5d7546[_0x14f1('0x1a')](dbH[_0x14f1('0x2a')][_0x14f1('0x2b')](util['format'](_0x14f1('0x2d'),QUERY,_0x552a26,_0x4f61ab),{'type':dbH[_0x14f1('0x2a')][_0x14f1('0x2c')][_0x14f1('0x2e')]}));}}}else{_0x5d7546[_0x14f1('0x1a')](dbH[_0x14f1('0x2a')][_0x14f1('0x2b')](QUERY,{'type':dbH['sequelize'][_0x14f1('0x2c')][_0x14f1('0x2e')]}));}var _0x5a92b8=path[_0x14f1('0x2f')](PATH);var _0x19d385=path[_0x14f1('0x30')](PATH,_0x14f1('0x31'));var _0x4abf86=_0x466f81[_0x14f1('0x24')]&&_0x5d7546[_0x14f1('0x15')]>0x1;var _0x38f5f5=[];if(!fs[_0x14f1('0x32')](path[_0x14f1('0x33')](_0x5a92b8,_0x19d385))&&_0x4abf86){fs[_0x14f1('0x34')](path[_0x14f1('0x33')](_0x5a92b8,_0x19d385));}return BPromise[_0x14f1('0x35')](_0x5d7546,function(_0xa71e72){_0x38f5f5[_0x14f1('0x1a')](_0xa71e72);})[_0x14f1('0x25')](function(){var _0x4aa97f=[];for(var _0x2f39d4=0x0;_0x2f39d4<_0x38f5f5[_0x14f1('0x15')];_0x2f39d4+=0x1){var _0xcc8697=_0x38f5f5[_0x2f39d4];var _0x51a885=createTables(_['flatten'](_0xcc8697));var _0xb7bb3;var _0x10d6e9=getPDFDocDefinition(_0x51a885);var _0x165d4b=getPDFPrinter();var _0x39e28f=_0x165d4b['createPdfKitDocument'](_0x10d6e9);if(_0x4abf86){_0xb7bb3=path[_0x14f1('0x33')](_0x5a92b8,_0x19d385,util['format']('%s%d.%s',_0x19d385,_0x2f39d4,_0x14f1('0x36')));}else{_0xb7bb3=path[_0x14f1('0x33')](_0x5a92b8,util[_0x14f1('0x1d')]('%s.%s',_0x19d385,_0x14f1('0x36')));}_0x4aa97f[_0x14f1('0x1a')](writePDFDocument(_0x39e28f,_0xb7bb3));}return Promise[_0x14f1('0x37')](_0x4aa97f);})[_0x14f1('0x25')](function(){if(_0x4abf86){return new Promise(function(_0x4ec524){zipdir(path[_0x14f1('0x33')](_0x5a92b8,_0x19d385),{'saveTo':path[_0x14f1('0x33')](_0x5a92b8,util[_0x14f1('0x1d')]('%s.%s',_0x19d385,_0x14f1('0x38')))},function(){rimraf(path[_0x14f1('0x33')](_0x5a92b8,_0x19d385),function(){});_0x4ec524('zip\x20finished');});});}})[_0x14f1('0x25')](function(){if(!_0x4abf86)return;rimraf(path[_0x14f1('0x33')](_0x5a92b8,_0x19d385),function(){});})[_0x14f1('0x25')](function(){logger[_0x14f1('0x39')](util[_0x14f1('0x1d')](_0x14f1('0x3a'),EXTRACTED_REPORT_ID,_0x14f1('0x3b')));return analyticExtractedReport(_0x14f1('0x3c'),_0x4abf86?util['format']('%s.%s',_0x19d385,_0x4abf86?_0x14f1('0x38'):_0x14f1('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x14f1('0x39')](util[_0x14f1('0x1d')](_0x14f1('0x3d'),EXTRACTED_REPORT_ID,_0x14f1('0x3b')));return db[_0x14f1('0x3e')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x14f1('0x25')](function(_0x5b354c){EXTRACTED_REPORT=_0x5b354c;return dbH[_0x14f1('0x2a')]['query'](util['format'](_0x14f1('0x3f'),QUERY),{'type':dbH[_0x14f1('0x2a')][_0x14f1('0x2c')][_0x14f1('0x2e')]});})[_0x14f1('0x25')](extractReport)['catch'](function(_0x279cd3){logger[_0x14f1('0x39')](util[_0x14f1('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x279cd3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x14f1('0x40'));})[_0x14f1('0x41')](function(){process[_0x14f1('0x42')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2c57fa=new PdfPrinter({'Arial':{'normal':__dirname+_0x14f1('0x43'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x14f1('0x44'),'bolditalics':__dirname+_0x14f1('0x45')}});return _0x2c57fa;}function getPDFDocDefinitionFromHTML(_0x1aa6e6,_0xbd5a84){var _0x1493a9=util[_0x14f1('0x1d')](_0x14f1('0x46'),_0xbd5a84[_0x14f1('0x47')],_0xbd5a84[_0x14f1('0x48')]);var _0x2f31ae=moment()['format'](_0x14f1('0x49'))[_0x14f1('0x4a')]();var _0x123322=htmlToPdfmake(_0x1aa6e6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x123322],'defaultStyle':{'font':_0x14f1('0x4b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x14f1('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x14f1('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x14f1('0x1e')}];},'footer':function(_0x22263a,_0x300b04){return[{'text':util[_0x14f1('0x1d')](_0x14f1('0x4d'),_0x1493a9,_0x22263a,_0x300b04,_0x2f31ae),'style':_0x14f1('0x4e')}];}};}function writePDFDocument(_0x369ccb,_0x515d86){return new Promise(function(_0x3aada2,_0x4f78e1){var _0x5056b2=_0x369ccb['pipe'](fs[_0x14f1('0x4f')](_0x515d86));_0x5056b2['on'](_0x14f1('0x50'),function(){_0x3aada2('finish');});_0x5056b2['on'](_0x14f1('0x51'),function(_0x302059){_0x4f78e1(_0x302059);});_0x369ccb[_0x14f1('0x52')]();});}exports['createPdfFromHTML']=function(_0x304a40,_0x351fee){var _0x46cd22=getPDFPrinter();var _0x536364=getPDFDocDefinitionFromHTML(_0x304a40,_0x351fee);var _0x5d75d5=_0x46cd22[_0x14f1('0x53')](_0x536364);return writePDFDocument(_0x5d75d5,_0x351fee[_0x14f1('0x54')])[_0x14f1('0x55')](function(_0x279848){throw _0x279848;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 65c7fca..01ea8b1 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 _0xefad=['%s.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s'];(function(_0x62040,_0x49cb23){var _0x8c8a9=function(_0x3b72ac){while(--_0x3b72ac){_0x62040['push'](_0x62040['shift']());}};_0x8c8a9(++_0x49cb23);}(_0xefad,0x1d6));var _0xdefa=function(_0x53bd6f,_0x15828a){_0x53bd6f=_0x53bd6f-0x0;var _0x5f4e08=_0xefad[_0x53bd6f];return _0x5f4e08;};'use strict';var util=require(_0xdefa('0x0'));var path=require('path');var _=require(_0xdefa('0x1'));var fs=require('fs');var json2xls=require(_0xdefa('0x2'));var BPromise=require(_0xdefa('0x3'));var zipdir=require(_0xdefa('0x4'));var rimraf=require(_0xdefa('0x5'));var db=require(_0xdefa('0x6'))['db'];var dbH=require(_0xdefa('0x6'))[_0xdefa('0x7')];var logger=require(_0xdefa('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdefa('0x9')][0x2]);var QUERY=process[_0xdefa('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x7cbdb1,_0xfe80f7){var _0x31382d={'status':_0x7cbdb1};var _0x5a8897={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xfe80f7){_0x31382d['savename']=_0xfe80f7;}return db['AnalyticExtractedReport'][_0xdefa('0xa')](_0x31382d,_0x5a8897);}function main(){var _0xeb3171=0x1388;var _0x1c57cc;logger[_0xdefa('0xb')](util[_0xdefa('0xc')](_0xdefa('0xd'),EXTRACTED_REPORT_ID,_0xdefa('0xe')));return db[_0xdefa('0xf')][_0xdefa('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdefa('0x11'),_0xdefa('0x12')]})[_0xdefa('0x13')](function(_0x3c2e8a){if(_0x3c2e8a){_0x1c57cc=_0x3c2e8a;_0xeb3171=_0x1c57cc['splitSizeXlsx']||0x1388;}})[_0xdefa('0x13')](function(){return dbH[_0xdefa('0x14')][_0xdefa('0x15')](util[_0xdefa('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xdefa('0x14')][_0xdefa('0x16')][_0xdefa('0x17')]});})['then'](function(_0x3cf842){if(!_0x3cf842[0x0][_0xdefa('0x18')]){return analyticExtractedReport(_0xdefa('0x19'));}var _0x9e2c18=[];var _0x174441=0x0;if(_0x1c57cc['split']){if(_0x3cf842&&_0x3cf842[_0xdefa('0x1a')]){var _0x4138b2=_[_0xdefa('0x1b')](_0x3cf842[0x0][_0xdefa('0x18')]/_0xeb3171);var _0x3f3b86=Number[_0xdefa('0x1c')](_0x3cf842[0x0][_0xdefa('0x18')]/_0xeb3171)?_0x3cf842[0x0][_0xdefa('0x18')]%_0xeb3171:0x0;_0x4138b2[_0xdefa('0x1d')](function(_0x2ba495){if(_0x2ba495>0x0){_0x174441+=_0xeb3171;}_0x9e2c18['push'](dbH[_0xdefa('0x14')][_0xdefa('0x15')](util['format'](_0xdefa('0x1e'),QUERY,_0xeb3171,_0x174441),{'type':dbH[_0xdefa('0x14')][_0xdefa('0x16')]['SELECT']}));});if(_0x3f3b86>0x0){_0x174441+=_0xeb3171;_0x9e2c18['push'](dbH[_0xdefa('0x14')]['query'](util[_0xdefa('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3f3b86,_0x174441),{'type':dbH[_0xdefa('0x14')]['QueryTypes'][_0xdefa('0x17')]}));}}}else{_0x9e2c18[_0xdefa('0x1f')](dbH[_0xdefa('0x14')][_0xdefa('0x15')](QUERY,{'type':dbH['sequelize'][_0xdefa('0x16')][_0xdefa('0x17')]}));}var _0x34c1d7=path[_0xdefa('0x20')](PATH);var _0x573257=path[_0xdefa('0x21')](PATH,_0xdefa('0x22'));var _0x4434b7=_0x1c57cc['split']&&_0x9e2c18[_0xdefa('0x1a')]>0x1;var _0x2501b6=[];if(!fs[_0xdefa('0x23')](path['join'](_0x34c1d7,_0x573257))&&_0x4434b7){fs[_0xdefa('0x24')](path[_0xdefa('0x25')](_0x34c1d7,_0x573257));}return BPromise[_0xdefa('0x26')](_0x9e2c18,function(_0x522e89){_0x2501b6[_0xdefa('0x1f')](_0x522e89);})[_0xdefa('0x13')](function(){for(var _0x4c87ea=0x0;_0x4c87ea<_0x2501b6[_0xdefa('0x1a')];_0x4c87ea+=0x1){var _0x2bf770;var _0x376b39=_0x2501b6[_0x4c87ea];if(_0x4434b7){_0x2bf770=path[_0xdefa('0x25')](_0x34c1d7,_0x573257,util[_0xdefa('0xc')](_0xdefa('0x27'),_0x573257,_0x4c87ea,'xlsx'));}else{_0x2bf770=path['join'](_0x34c1d7,util[_0xdefa('0xc')](_0xdefa('0x28'),_0x573257,_0xdefa('0x29')));}fs[_0xdefa('0x2a')](_0x2bf770,json2xls(_0x376b39),'binary');}})['then'](function(){if(_0x4434b7){return new Promise(function(_0x4c2b65){zipdir(path['join'](_0x34c1d7,_0x573257),{'saveTo':path['join'](_0x34c1d7,util[_0xdefa('0xc')](_0xdefa('0x28'),_0x573257,_0xdefa('0x2b')))},function(_0x407ffe,_0x6ddbe4){rimraf(path[_0xdefa('0x25')](_0x34c1d7,_0x573257),function(){});_0x4c2b65(_0xdefa('0x2c'));});});}})[_0xdefa('0x13')](function(){logger[_0xdefa('0xb')](util['format'](_0xdefa('0x2d'),EXTRACTED_REPORT_ID,_0xdefa('0xe')));return analyticExtractedReport(_0xdefa('0x2e'),_0x4434b7?util['format'](_0xdefa('0x28'),_0x573257,_0x4434b7?'zip':_0xdefa('0x29')):null);});})[_0xdefa('0x2f')](function(_0x391362){logger['info'](util[_0xdefa('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xdefa('0xe')),util['inspect'](_0x391362,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdefa('0x30'));})[_0xdefa('0x31')](function(){process[_0xdefa('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe3bb=['bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','push','dirname','existsSync','mkdirSync','join','%s%d.%s','binary','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xe3bb,0x1c8));var _0xbe3b=function(_0x338988,_0x1dbc86){_0x338988=_0x338988-0x0;var _0xfdf1d0=_0xe3bb[_0x338988];return _0xfdf1d0;};'use strict';var util=require(_0xbe3b('0x0'));var path=require(_0xbe3b('0x1'));var _=require(_0xbe3b('0x2'));var fs=require('fs');var json2xls=require(_0xbe3b('0x3'));var BPromise=require(_0xbe3b('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xbe3b('0x5'));var db=require(_0xbe3b('0x6'))['db'];var dbH=require(_0xbe3b('0x6'))[_0xbe3b('0x7')];var logger=require(_0xbe3b('0x8'))(_0xbe3b('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbe3b('0xa')][0x3];var PATH=process[_0xbe3b('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x577b78,_0xb3865d){var _0x2d4c37={'status':_0x577b78};var _0x28651e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb3865d){_0x2d4c37[_0xbe3b('0xb')]=_0xb3865d;}return db[_0xbe3b('0xc')]['update'](_0x2d4c37,_0x28651e);}function main(){var _0xa980c5=0x1388;var _0x2b2ed2;logger[_0xbe3b('0xd')](util[_0xbe3b('0xe')](_0xbe3b('0xf'),EXTRACTED_REPORT_ID,_0xbe3b('0x10')));return db[_0xbe3b('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbe3b('0x12'),_0xbe3b('0x13')]})[_0xbe3b('0x14')](function(_0x1023d3){if(_0x1023d3){_0x2b2ed2=_0x1023d3;_0xa980c5=_0x2b2ed2['splitSizeXlsx']||0x1388;}})[_0xbe3b('0x14')](function(){return dbH[_0xbe3b('0x15')][_0xbe3b('0x16')](util[_0xbe3b('0xe')](_0xbe3b('0x17'),QUERY),{'type':dbH['sequelize'][_0xbe3b('0x18')][_0xbe3b('0x19')]});})[_0xbe3b('0x14')](function(_0x2d268e){if(!_0x2d268e[0x0][_0xbe3b('0x1a')]){return analyticExtractedReport('Empty');}var _0x4498ce=[];var _0x226ec2=0x0;if(_0x2b2ed2['split']){if(_0x2d268e&&_0x2d268e[_0xbe3b('0x1b')]){var _0x8a9957=_[_0xbe3b('0x1c')](_0x2d268e[0x0]['num']/_0xa980c5);var _0x3383f4=Number[_0xbe3b('0x1d')](_0x2d268e[0x0][_0xbe3b('0x1a')]/_0xa980c5)?_0x2d268e[0x0][_0xbe3b('0x1a')]%_0xa980c5:0x0;_0x8a9957['forEach'](function(_0x83c6a0){if(_0x83c6a0>0x0){_0x226ec2+=_0xa980c5;}_0x4498ce[_0xbe3b('0x1e')](dbH[_0xbe3b('0x15')][_0xbe3b('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa980c5,_0x226ec2),{'type':dbH[_0xbe3b('0x15')][_0xbe3b('0x18')]['SELECT']}));});if(_0x3383f4>0x0){_0x226ec2+=_0xa980c5;_0x4498ce['push'](dbH[_0xbe3b('0x15')][_0xbe3b('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3383f4,_0x226ec2),{'type':dbH[_0xbe3b('0x15')][_0xbe3b('0x18')]['SELECT']}));}}}else{_0x4498ce[_0xbe3b('0x1e')](dbH['sequelize'][_0xbe3b('0x16')](QUERY,{'type':dbH[_0xbe3b('0x15')]['QueryTypes']['SELECT']}));}var _0x8b6cf0=path[_0xbe3b('0x1f')](PATH);var _0x3d81c3=path['basename'](PATH,'.xlsx');var _0x11b4fe=_0x2b2ed2[_0xbe3b('0x12')]&&_0x4498ce[_0xbe3b('0x1b')]>0x1;var _0x408e82=[];if(!fs[_0xbe3b('0x20')](path['join'](_0x8b6cf0,_0x3d81c3))&&_0x11b4fe){fs[_0xbe3b('0x21')](path[_0xbe3b('0x22')](_0x8b6cf0,_0x3d81c3));}return BPromise['each'](_0x4498ce,function(_0x32c2b3){_0x408e82[_0xbe3b('0x1e')](_0x32c2b3);})['then'](function(){for(var _0x1d068d=0x0;_0x1d068d<_0x408e82[_0xbe3b('0x1b')];_0x1d068d+=0x1){var _0x5a9405;var _0x42449c=_0x408e82[_0x1d068d];if(_0x11b4fe){_0x5a9405=path[_0xbe3b('0x22')](_0x8b6cf0,_0x3d81c3,util[_0xbe3b('0xe')](_0xbe3b('0x23'),_0x3d81c3,_0x1d068d,'xlsx'));}else{_0x5a9405=path['join'](_0x8b6cf0,util[_0xbe3b('0xe')]('%s.%s',_0x3d81c3,'xlsx'));}fs['writeFileSync'](_0x5a9405,json2xls(_0x42449c),_0xbe3b('0x24'));}})[_0xbe3b('0x14')](function(){if(_0x11b4fe){return new Promise(function(_0x1d8a69){zipdir(path['join'](_0x8b6cf0,_0x3d81c3),{'saveTo':path['join'](_0x8b6cf0,util['format'](_0xbe3b('0x25'),_0x3d81c3,'zip'))},function(_0x12ee28,_0x4f98bc){rimraf(path[_0xbe3b('0x22')](_0x8b6cf0,_0x3d81c3),function(){});_0x1d8a69('zip\x20finished');});});}})[_0xbe3b('0x14')](function(){logger[_0xbe3b('0xd')](util[_0xbe3b('0xe')](_0xbe3b('0x26'),EXTRACTED_REPORT_ID,_0xbe3b('0x10')));return analyticExtractedReport('Completed',_0x11b4fe?util[_0xbe3b('0xe')]('%s.%s',_0x3d81c3,_0x11b4fe?_0xbe3b('0x27'):'xlsx'):null);});})[_0xbe3b('0x28')](function(_0x553c60){logger['info'](util[_0xbe3b('0xe')](_0xbe3b('0x29'),EXTRACTED_REPORT_ID,_0xbe3b('0x10')),util[_0xbe3b('0x2a')](_0x553c60,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbe3b('0x2b'));})[_0xbe3b('0x2c')](function(){process[_0xbe3b('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 2e5717d..3ded1e0 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 _0xb64b=['push','type','format','CDR(type)=%s','context','priority','inbound','Set','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','interval','*,*,*,*','tag','CDR(tag)=','length','outbound','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','intervals','findAll','IntervalId','then','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extension','find','extensions'];(function(_0x298ad8,_0x351904){var _0xb68f4c=function(_0xcd3d3){while(--_0xcd3d3){_0x298ad8['push'](_0x298ad8['shift']());}};_0xb68f4c(++_0x351904);}(_0xb64b,0x76));var _0xbb64=function(_0x1b5bc2,_0x453d84){_0x1b5bc2=_0x1b5bc2-0x0;var _0x1a5382=_0xb64b[_0x1b5bc2];return _0x1a5382;};'use strict';var _=require(_0xbb64('0x0'));var util=require('util');function rewrite(_0x300dd1,_0x25a31c){var _0x16b655=this;return _0x300dd1[_0xbb64('0x1')][_0xbb64('0x2')]['findAll']({'raw':!![]})['then'](function(_0x2b6a7e){_0x16b655[_0xbb64('0x3')]=_0x2b6a7e;return _0x300dd1[_0xbb64('0x1')]['VoiceExtension'][_0xbb64('0x4')]({'where':{'IntervalId':_0x25a31c[_0xbb64('0x5')]},'raw':!![]});})[_0xbb64('0x6')](function(_0x48d378){return _0x300dd1['models'][_0xbb64('0x7')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xbb64('0x8')](_0x48d378,_0xbb64('0x9')))}},'order':[{'raw':_0xbb64('0xa')}],'raw':!![]});})['then'](function(_0x342b88){var _0x265739=_[_0xbb64('0xb')](_0x342b88,{'priority':'1'});var _0x66d19=_[_0xbb64('0xb')](_0x342b88,{'isApp':0x1});var _0x4513ed=_[_0xbb64('0xc')](_0x66d19,_0xbb64('0x9'));var _0x421dd7=['queue',_0xbb64('0xd')];var _0xdcf9eb=[];var _0x5e59fa=[];for(var _0x30d2fa in _0x4513ed){if(_0x4513ed[_0xbb64('0xe')](_0x30d2fa)){_0x16b655['priority']=0x2;_0x16b655['extensions']=[];_0x16b655[_0xbb64('0xf')]=_[_0xbb64('0x10')](_0x265739,{'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')]});_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':util[_0xbb64('0x14')](_0xbb64('0x15'),_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')]),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655[_0xbb64('0x17')]++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0]['VoiceExtensionId']});if(_0x4513ed[_0x30d2fa][0x0]['type']===_0xbb64('0x18')){_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x19'),'appdata':'CDR(routeid)='+_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')],'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x16b655[_0xbb64('0x17')]++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}else if(_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')]==='outbound'){if(_0x16b655[_0xbb64('0xf')]){_0x16b655[_0xbb64('0x11')]['push']({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':_0xbb64('0x1b')+(_0x16b655['extension'][_0xbb64('0x1c')]?'${EXTEN:'+_0x16b655['extension']['cutdigits']+'}':_0xbb64('0x1d')),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655[_0xbb64('0x17')]++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}_0x16b655['extensions']['push']({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x1e')+_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')],'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});var _0x5ddee2=_0x16b655[_0xbb64('0x17')]++;_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x1f'),'appdata':_0xbb64('0x20')+(_0x5ddee2+0x2)+'):Goto('+(_0x5ddee2+0x1)+')','context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x5ddee2,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});if(_0x16b655['extension']){_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':_0x16b655['extension'][_0xbb64('0x1c')]?_0xbb64('0x21')+_0x16b655['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4513ed[_0x30d2fa][0x0]['context'],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':'Set','appdata':_0xbb64('0x22')+_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')],'context':_0x4513ed[_0x30d2fa][0x0]['context'],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});if(_0x16b655[_0xbb64('0xf')]&&_0x16b655[_0xbb64('0xf')][_0xbb64('0xe')]('recordingFormat')&&_0x16b655[_0xbb64('0xf')][_0xbb64('0x23')]!=='none'){_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x24'),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x25')+_0x16b655[_0xbb64('0xf')]['recordingFormat']||'wav','context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}}_0x16b655['extensions'][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':_0xbb64('0x26'),'context':_0x4513ed[_0x30d2fa][0x0]['context'],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});_0x16b655[_0xbb64('0x11')]['push']({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x27'),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':_0xbb64('0x28'),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x16b655[_0xbb64('0x17')]++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});for(var _0x551bc2=0x0,_0x24fb7f=0x0;_0x551bc2<_0x4513ed[_0x30d2fa]['length'];_0x551bc2+=0x1,_0x24fb7f=0x0){var _0x420501=_0x4513ed[_0x30d2fa][_0x551bc2];if(_0x420501[_0xbb64('0x13')]){_0x420501[_0xbb64('0x13')]=_0x420501[_0xbb64('0x13')]['toLowerCase']();}var _0xe415a2=[];var _0x38daa3=[];delete _0x420501['id'];delete _0x420501['createdAt'];delete _0x420501['updatedAt'];var _0x2d9384=_0x420501[_0xbb64('0x29')]!==_0xbb64('0x2a')?[_0x420501[_0xbb64('0x29')]]:_0x420501[_0xbb64('0x5')]?_['map'](_[_0xbb64('0xb')](_0x16b655[_0xbb64('0x3')],{'IntervalId':_0x420501[_0xbb64('0x5')]}),_0xbb64('0x29')):[];if(_0x420501[_0xbb64('0xe')](_0xbb64('0x2b'))){if(_0x420501[_0xbb64('0x2b')]&&_0x420501['tag']!=='--'){_0xe415a2['push']({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x2c')+_0x420501[_0xbb64('0x2b')],'context':_0x420501[_0xbb64('0x16')],'exten':_0x420501['exten'],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}}if(_0x420501[_0xbb64('0x13')]===_0xbb64('0x2e')&&_0x420501['hasOwnProperty'](_0xbb64('0x2f'))){if(_0x420501[_0xbb64('0x2f')]){_0xe415a2[_0xbb64('0x12')]({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x1f'),'appdata':_0xbb64('0x30')+_0x420501[_0xbb64('0x2f')]+')','context':_0x420501['context'],'exten':_0x420501['exten'],'priority':_0x2d9384['length']+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}else{_0xe415a2[_0xbb64('0x12')]({'type':_0x420501['type'],'app':_0xbb64('0x1f'),'appdata':_0xbb64('0x31'),'context':_0x420501[_0xbb64('0x16')],'exten':_0x420501[_0xbb64('0x9')],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}}if(_0x420501['hasOwnProperty'](_0xbb64('0x32'))){if(_0x421dd7['indexOf'](_0x420501[_0xbb64('0x33')]['toLowerCase']())>=0x0&&_0x420501[_0xbb64('0x34')]!==_0xbb64('0x35')){if(_0x420501[_0xbb64('0x32')]){_0xe415a2['push']({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x1f'),'appdata':_0xbb64('0x36'),'context':_0x420501['context'],'exten':_0x420501[_0xbb64('0x9')],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655['priority']+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});_0xe415a2['push']({'type':_0x420501['type'],'app':'Set','appdata':_0xbb64('0x37'),'context':_0x420501[_0xbb64('0x16')],'exten':_0x420501['exten'],'priority':_0x2d9384['length']+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}else{_0xe415a2[_0xbb64('0x12')]({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x420501[_0xbb64('0x16')],'exten':_0x420501[_0xbb64('0x9')],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501['VoiceExtensionId']});_0xe415a2[_0xbb64('0x12')]({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x38'),'context':_0x420501[_0xbb64('0x16')],'exten':_0x420501[_0xbb64('0x9')],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}}}for(var _0x18115e=0x0;_0x18115e<_0x2d9384[_0xbb64('0x2d')];_0x18115e+=0x1){var _0x182b44=_0x16b655['priority']+_0x2d9384[_0xbb64('0x2d')];var _0x2666a3=_0x18115e===_0x2d9384[_0xbb64('0x2d')]-0x1?_0x16b655[_0xbb64('0x17')]+_0xe415a2['length']+_0x38daa3[_0xbb64('0x2d')]+0x2:_0x16b655['priority']+_0x18115e+0x1;_0xe415a2[_0xbb64('0x39')](_0x18115e,0x0,{'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x3a'),'appdata':_0x2d9384[_0x18115e]+'?'+_0x420501[_0xbb64('0x16')]+',${EXTEN},'+_0x182b44+':'+_0x420501[_0xbb64('0x16')]+',${EXTEN},'+_0x2666a3,'exten':_0x420501[_0xbb64('0x9')],'context':_0x420501[_0xbb64('0x16')],'priority':_0x16b655[_0xbb64('0x17')]+_0x18115e,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}_0x420501['priority']=_0xe415a2['length']?_[_0xbb64('0x3b')](_0xe415a2)[_0xbb64('0x17')]+0x1:_0x16b655[_0xbb64('0x17')];_0x16b655[_0xbb64('0x17')]=(_0x38daa3[_0xbb64('0x2d')]?_[_0xbb64('0x3b')](_0x38daa3)[_0xbb64('0x17')]:_0x420501[_0xbb64('0x17')])+0x1;_0x16b655[_0xbb64('0x11')]=_[_0xbb64('0x3c')](_0x16b655[_0xbb64('0x11')],_0xe415a2,[_0x420501],_0x38daa3);}_0x16b655['extensions']['push']({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':_0xbb64('0x3d'),'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'priority':_0x16b655[_0xbb64('0x17')],'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});_0xdcf9eb['push'](_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]);_0x5e59fa=_[_0xbb64('0x3c')](_0x5e59fa,_0x16b655[_0xbb64('0x11')]);}}return _0x300dd1[_0xbb64('0x3e')](function(_0x48bd0d){return _0x300dd1['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0xdcf9eb}},'transaction':_0x48bd0d})['then'](function(_0xb91c32){return _0x300dd1['models'][_0xbb64('0x7')][_0xbb64('0x3f')](_[_0xbb64('0x40')](_0x5e59fa,_0xbb64('0x17')),{'transaction':_0x48bd0d});});});})[_0xbb64('0x41')](function(_0x45c71d){console[_0xbb64('0x42')](_0x45c71d);});}exports[_0xbb64('0x43')]=rewrite; \ No newline at end of file +var _0x5cd4=['indexOf','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','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x5cd4,0xed));var _0x45cd=function(_0x214f07,_0x3b9a2b){_0x214f07=_0x214f07-0x0;var _0x36be9b=_0x5cd4[_0x214f07];return _0x36be9b;};'use strict';var _=require(_0x45cd('0x0'));var util=require(_0x45cd('0x1'));function rewrite(_0x5de012,_0x13e8f8){var _0x2acc64=this;return _0x5de012[_0x45cd('0x2')][_0x45cd('0x3')][_0x45cd('0x4')]({'raw':!![]})[_0x45cd('0x5')](function(_0xb9b1db){_0x2acc64[_0x45cd('0x6')]=_0xb9b1db;return _0x5de012['models'][_0x45cd('0x7')][_0x45cd('0x4')]({'where':{'IntervalId':_0x13e8f8[_0x45cd('0x8')]},'raw':!![]});})[_0x45cd('0x5')](function(_0x45061f){return _0x5de012[_0x45cd('0x2')][_0x45cd('0x7')][_0x45cd('0x4')]({'where':{'exten':{'$in':_[_0x45cd('0x9')](_['map'](_0x45061f,_0x45cd('0xa')))}},'order':[{'raw':_0x45cd('0xb')}],'raw':!![]});})[_0x45cd('0x5')](function(_0x5684ae){var _0x3e0771=_[_0x45cd('0xc')](_0x5684ae,{'priority':'1'});var _0x38785c=_['filter'](_0x5684ae,{'isApp':0x1});var _0x1ebe21=_[_0x45cd('0xd')](_0x38785c,_0x45cd('0xa'));var _0x27aac6=[_0x45cd('0xe'),_0x45cd('0xf')];var _0xa7842c=[];var _0x127cea=[];for(var _0x1b4a7b in _0x1ebe21){if(_0x1ebe21[_0x45cd('0x10')](_0x1b4a7b)){_0x2acc64[_0x45cd('0x11')]=0x2;_0x2acc64[_0x45cd('0x12')]=[];_0x2acc64[_0x45cd('0x13')]=_['find'](_0x3e0771,{'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')]});_0x2acc64[_0x45cd('0x12')][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')],'app':_0x45cd('0x16'),'appdata':util[_0x45cd('0x17')](_0x45cd('0x18'),_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')]),'context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0]['exten'],'priority':_0x2acc64[_0x45cd('0x11')]++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')]});if(_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')]==='inbound'){_0x2acc64[_0x45cd('0x12')][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')],'app':_0x45cd('0x16'),'appdata':_0x45cd('0x1b')+_0x1ebe21[_0x1b4a7b][0x0]['VoiceExtensionId'],'context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x2acc64['priority']++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')]});}else if(_0x1ebe21[_0x1b4a7b][0x0]['type']===_0x45cd('0x1c')){if(_0x2acc64[_0x45cd('0x13')]){_0x2acc64[_0x45cd('0x12')][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0]['type'],'app':_0x45cd('0x16'),'appdata':_0x45cd('0x1d')+(_0x2acc64[_0x45cd('0x13')]['cutdigits']?_0x45cd('0x1e')+_0x2acc64[_0x45cd('0x13')][_0x45cd('0x1f')]+'}':_0x45cd('0x20')),'context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x2acc64[_0x45cd('0x11')]++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0]['VoiceExtensionId']});}_0x2acc64[_0x45cd('0x12')][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')],'app':_0x45cd('0x16'),'appdata':_0x45cd('0x1b')+_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')],'context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x2acc64[_0x45cd('0x11')]++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')]});var _0x52f5b3=_0x2acc64['priority']++;_0x2acc64[_0x45cd('0x12')][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')],'app':'ExecIf','appdata':_0x45cd('0x21')+(_0x52f5b3+0x2)+_0x45cd('0x22')+(_0x52f5b3+0x1)+')','context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x52f5b3,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')]});if(_0x2acc64[_0x45cd('0x13')]){_0x2acc64['extensions'][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')],'app':_0x45cd('0x16'),'appdata':_0x2acc64[_0x45cd('0x13')][_0x45cd('0x1f')]?_0x45cd('0x23')+_0x2acc64[_0x45cd('0x13')][_0x45cd('0x1f')]+'}':_0x45cd('0x24'),'context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0]['exten'],'priority':_0x2acc64['priority']++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0]['VoiceExtensionId']});}_0x2acc64[_0x45cd('0x12')][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0]['type'],'app':_0x45cd('0x16'),'appdata':_0x45cd('0x25')+_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')],'context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x2acc64[_0x45cd('0x11')]++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')]});if(_0x2acc64[_0x45cd('0x13')]&&_0x2acc64['extension'][_0x45cd('0x10')](_0x45cd('0x26'))&&_0x2acc64['extension']['recordingFormat']!=='none'){_0x2acc64[_0x45cd('0x12')][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0]['type'],'app':_0x45cd('0x16'),'appdata':_0x45cd('0x27'),'context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x2acc64[_0x45cd('0x11')]++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0]['VoiceExtensionId']});_0x2acc64['extensions'][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0]['type'],'app':_0x45cd('0x16'),'appdata':_0x45cd('0x28')+_0x2acc64[_0x45cd('0x13')][_0x45cd('0x26')]||'wav','context':_0x1ebe21[_0x1b4a7b][0x0]['context'],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x2acc64[_0x45cd('0x11')]++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0]['VoiceExtensionId']});}}_0x2acc64[_0x45cd('0x12')]['push']({'type':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')],'app':_0x45cd('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0]['exten'],'priority':_0x2acc64[_0x45cd('0x11')]++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')]});_0x2acc64['extensions'][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x2acc64[_0x45cd('0x11')]++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')]});_0x2acc64[_0x45cd('0x12')][_0x45cd('0x14')]({'type':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')],'app':'Set','appdata':_0x45cd('0x29'),'context':_0x1ebe21[_0x1b4a7b][0x0]['context'],'exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'priority':_0x2acc64['priority']++,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0]['VoiceExtensionId']});for(var _0x1768cc=0x0,_0x485d17=0x0;_0x1768cc<_0x1ebe21[_0x1b4a7b][_0x45cd('0x2a')];_0x1768cc+=0x1,_0x485d17=0x0){var _0xd3aebe=_0x1ebe21[_0x1b4a7b][_0x1768cc];if(_0xd3aebe[_0x45cd('0x15')]){_0xd3aebe['type']=_0xd3aebe[_0x45cd('0x15')][_0x45cd('0x2b')]();}var _0x1ab8ca=[];var _0x215980=[];delete _0xd3aebe['id'];delete _0xd3aebe[_0x45cd('0x2c')];delete _0xd3aebe[_0x45cd('0x2d')];var _0x4c8f2c=_0xd3aebe[_0x45cd('0x2e')]!==_0x45cd('0x2f')?[_0xd3aebe[_0x45cd('0x2e')]]:_0xd3aebe[_0x45cd('0x8')]?_[_0x45cd('0x30')](_[_0x45cd('0xc')](_0x2acc64[_0x45cd('0x6')],{'IntervalId':_0xd3aebe[_0x45cd('0x8')]}),'interval'):[];if(_0xd3aebe['hasOwnProperty'](_0x45cd('0x31'))){if(_0xd3aebe[_0x45cd('0x31')]&&_0xd3aebe['tag']!=='--'){_0x1ab8ca[_0x45cd('0x14')]({'type':_0xd3aebe['type'],'app':_0x45cd('0x16'),'appdata':'CDR(tag)='+_0xd3aebe[_0x45cd('0x31')],'context':_0xd3aebe[_0x45cd('0x19')],'exten':_0xd3aebe[_0x45cd('0xa')],'priority':_0x4c8f2c['length']+_0x2acc64[_0x45cd('0x11')]+_0x485d17++,'VoiceExtensionId':_0xd3aebe['VoiceExtensionId']});}}if(_0xd3aebe[_0x45cd('0x15')]===_0x45cd('0x1c')&&_0xd3aebe[_0x45cd('0x10')]('callerID')){if(_0xd3aebe['callerID']){_0x1ab8ca[_0x45cd('0x14')]({'type':_0xd3aebe[_0x45cd('0x15')],'app':'ExecIf','appdata':_0x45cd('0x32')+_0xd3aebe[_0x45cd('0x33')]+')','context':_0xd3aebe['context'],'exten':_0xd3aebe[_0x45cd('0xa')],'priority':_0x4c8f2c['length']+_0x2acc64[_0x45cd('0x11')]+_0x485d17++,'VoiceExtensionId':_0xd3aebe['VoiceExtensionId']});}else{_0x1ab8ca[_0x45cd('0x14')]({'type':_0xd3aebe[_0x45cd('0x15')],'app':_0x45cd('0x34'),'appdata':_0x45cd('0x35'),'context':_0xd3aebe[_0x45cd('0x19')],'exten':_0xd3aebe[_0x45cd('0xa')],'priority':_0x4c8f2c['length']+_0x2acc64['priority']+_0x485d17++,'VoiceExtensionId':_0xd3aebe[_0x45cd('0x1a')]});}}if(_0xd3aebe[_0x45cd('0x10')](_0x45cd('0x36'))){if(_0x27aac6[_0x45cd('0x37')](_0xd3aebe['app'][_0x45cd('0x2b')]())>=0x0&&_0xd3aebe[_0x45cd('0x38')]!==_0x45cd('0x39')){if(_0xd3aebe['answer']){_0x1ab8ca['push']({'type':_0xd3aebe[_0x45cd('0x15')],'app':'ExecIf','appdata':_0x45cd('0x3a'),'context':_0xd3aebe[_0x45cd('0x19')],'exten':_0xd3aebe[_0x45cd('0xa')],'priority':_0x4c8f2c['length']+_0x2acc64[_0x45cd('0x11')]+_0x485d17++,'VoiceExtensionId':_0xd3aebe[_0x45cd('0x1a')]});_0x1ab8ca['push']({'type':_0xd3aebe[_0x45cd('0x15')],'app':'Set','appdata':_0x45cd('0x3b'),'context':_0xd3aebe[_0x45cd('0x19')],'exten':_0xd3aebe['exten'],'priority':_0x4c8f2c[_0x45cd('0x2a')]+_0x2acc64[_0x45cd('0x11')]+_0x485d17++,'VoiceExtensionId':_0xd3aebe[_0x45cd('0x1a')]});}else{_0x1ab8ca[_0x45cd('0x14')]({'type':_0xd3aebe[_0x45cd('0x15')],'app':'ExecIf','appdata':_0x45cd('0x3c'),'context':_0xd3aebe[_0x45cd('0x19')],'exten':_0xd3aebe[_0x45cd('0xa')],'priority':_0x4c8f2c['length']+_0x2acc64['priority']+_0x485d17++,'VoiceExtensionId':_0xd3aebe[_0x45cd('0x1a')]});_0x1ab8ca[_0x45cd('0x14')]({'type':_0xd3aebe[_0x45cd('0x15')],'app':_0x45cd('0x16'),'appdata':_0x45cd('0x3d'),'context':_0xd3aebe[_0x45cd('0x19')],'exten':_0xd3aebe[_0x45cd('0xa')],'priority':_0x4c8f2c[_0x45cd('0x2a')]+_0x2acc64[_0x45cd('0x11')]+_0x485d17++,'VoiceExtensionId':_0xd3aebe['VoiceExtensionId']});}}}for(var _0x1ecfd6=0x0;_0x1ecfd6<_0x4c8f2c[_0x45cd('0x2a')];_0x1ecfd6+=0x1){var _0x4e2046=_0x2acc64[_0x45cd('0x11')]+_0x4c8f2c[_0x45cd('0x2a')];var _0xff72b0=_0x1ecfd6===_0x4c8f2c[_0x45cd('0x2a')]-0x1?_0x2acc64[_0x45cd('0x11')]+_0x1ab8ca[_0x45cd('0x2a')]+_0x215980[_0x45cd('0x2a')]+0x2:_0x2acc64[_0x45cd('0x11')]+_0x1ecfd6+0x1;_0x1ab8ca[_0x45cd('0x3e')](_0x1ecfd6,0x0,{'type':_0xd3aebe[_0x45cd('0x15')],'app':_0x45cd('0x3f'),'appdata':_0x4c8f2c[_0x1ecfd6]+'?'+_0xd3aebe['context']+_0x45cd('0x40')+_0x4e2046+':'+_0xd3aebe['context']+_0x45cd('0x40')+_0xff72b0,'exten':_0xd3aebe[_0x45cd('0xa')],'context':_0xd3aebe[_0x45cd('0x19')],'priority':_0x2acc64[_0x45cd('0x11')]+_0x1ecfd6,'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x1a')]});}_0xd3aebe[_0x45cd('0x11')]=_0x1ab8ca[_0x45cd('0x2a')]?_[_0x45cd('0x41')](_0x1ab8ca)[_0x45cd('0x11')]+0x1:_0x2acc64['priority'];_0x2acc64[_0x45cd('0x11')]=(_0x215980[_0x45cd('0x2a')]?_[_0x45cd('0x41')](_0x215980)[_0x45cd('0x11')]:_0xd3aebe[_0x45cd('0x11')])+0x1;_0x2acc64[_0x45cd('0x12')]=_[_0x45cd('0x42')](_0x2acc64[_0x45cd('0x12')],_0x1ab8ca,[_0xd3aebe],_0x215980);}_0x2acc64[_0x45cd('0x12')]['push']({'type':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x15')],'app':'Hangup','exten':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0xa')],'context':_0x1ebe21[_0x1b4a7b][0x0][_0x45cd('0x19')],'priority':_0x2acc64[_0x45cd('0x11')],'VoiceExtensionId':_0x1ebe21[_0x1b4a7b][0x0]['VoiceExtensionId']});_0xa7842c['push'](_0x1ebe21[_0x1b4a7b][0x0]['VoiceExtensionId']);_0x127cea=_[_0x45cd('0x42')](_0x127cea,_0x2acc64[_0x45cd('0x12')]);}}return _0x5de012[_0x45cd('0x43')](function(_0x1f0134){return _0x5de012[_0x45cd('0x2')][_0x45cd('0x7')][_0x45cd('0x44')]({'where':{'VoiceExtensionId':{'$in':_0xa7842c}},'transaction':_0x1f0134})[_0x45cd('0x5')](function(_0x2ba934){return _0x5de012[_0x45cd('0x2')][_0x45cd('0x7')][_0x45cd('0x45')](_['sortBy'](_0x127cea,_0x45cd('0x11')),{'transaction':_0x1f0134});});});})[_0x45cd('0x46')](function(_0x59f5bf){console[_0x45cd('0x47')](_0x59f5bf);});}exports[_0x45cd('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a5e94e7..2a31387 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 _0x4637=['cm_hopper','fromQuery','phone','scheduledAt','ContactId','updatedAt','field','NOW()','toString','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','from','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','createdAt','cm_hopper_black','VoiceQueue','findAll','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','query','all','outbound','CmList','BlackLists','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','duplicate','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4637,0xaa));var _0x7463=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4637[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require(_0x7463('0x0'));var util=require(_0x7463('0x1'));var _=require(_0x7463('0x2'));var fs=require('fs');var squel=require(_0x7463('0x3'));var Papa=require(_0x7463('0x4'));var Redis=require('ioredis');var db=require(_0x7463('0x5'))['db'];var config=require(_0x7463('0x6'));var logger=require(_0x7463('0x7'))(_0x7463('0x8'));config[_0x7463('0x9')]=_['defaults'](config[_0x7463('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7463('0xa'))(new Redis(config['redis']));require(_0x7463('0xb'))[_0x7463('0xc')](socket);try{if(!process['argv'][0x2]||process[_0x7463('0xd')][0x2]===_0x7463('0xe')||process[_0x7463('0xd')][0x2]===_0x7463('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x7463('0xd')][0x2];if(!process[_0x7463('0xd')][0x3]||process[_0x7463('0xd')][0x3]===_0x7463('0xe')||process[_0x7463('0xd')][0x3]==='null'||!process[_0x7463('0xd')][0x4]||process[_0x7463('0xd')][0x4]===_0x7463('0xe')||process[_0x7463('0xd')][0x4]===_0x7463('0xf')){throw new Error(_0x7463('0x10'));}var FIELDS=_[_0x7463('0x11')](process[_0x7463('0xd')][0x3]['split'](','),process[_0x7463('0xd')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x7463('0xe')||process[_0x7463('0xd')][0x5]===_0x7463('0xf')){throw new Error(_0x7463('0x12'));}var LISTID=process[_0x7463('0xd')][0x5];var COMPANYID=process[_0x7463('0xd')][0x6]&&process[_0x7463('0xd')][0x6]!=='undefined'&&process['argv'][0x6]!=='null'?process[_0x7463('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x7463('0xd')][0x7]!==_0x7463('0xe')&&process['argv'][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x7463('0xd')][0x8]||process['argv'][0x8]===_0x7463('0xe')||process[_0x7463('0xd')][0x8]===_0x7463('0xf')){throw new Error(_0x7463('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3975c1){logger[_0x7463('0x14')](_0x3975c1);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(_0x27d50a,_0x49a412,_0x40c68e,_0x5eb076){var _0x31ab07={'message':_0x49a412};_0x31ab07[_0x27d50a]=!![];if(_0x40c68e){_0x31ab07[_0x7463('0x15')]=_0x40c68e;}if(_0x5eb076){_0x31ab07['index']=_0x5eb076;}return _0x31ab07;}function isEmail(_0x1927c5){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))*$/[_0x7463('0x16')](_0x1927c5);}function checkRow(_0x1031f0,_0x2a7989,_0x4bea9c){return new BPromise(function(_0x22528b,_0x55adce){if(_[_0x7463('0x17')](_0x1031f0)){return _0x55adce(handleCheckRowError(_0x7463('0x14'),_0x7463('0x18'),null,_0x4bea9c));}if(_0x1031f0[_0x7463('0x19')]&&_0x1031f0['errors'][_0x7463('0x1a')]){var _0x4cbad2=_[_0x7463('0x1b')](_0x1031f0['errors'],_0x7463('0x1c'))[_0x7463('0x1d')](';');return _0x55adce(handleCheckRowError(_0x7463('0x14'),_0x4cbad2,null,_0x4bea9c));}var _0x4d63d8={};for(var _0x3642e4 in FIELDS){if(FIELDS['hasOwnProperty'](_0x3642e4)&&FIELDS[_0x3642e4]){_0x4d63d8[_0x3642e4]=_0x1031f0[_0x7463('0x1e')][0x0][FIELDS[_0x3642e4]]||_0x1031f0['data'][0x0]['\ufeff'+FIELDS[_0x3642e4]];}}if(!_0x4d63d8[_0x7463('0x1f')]){return _0x55adce(handleCheckRowError('error',_0x7463('0x20'),null,_0x4bea9c));}if(!_0x4d63d8['phone']){return _0x55adce(handleCheckRowError('error',_0x7463('0x21'),null,_0x4bea9c));}if(_0x4d63d8[_0x7463('0x22')]){var _0x2c6219=moment(_0x4d63d8[_0x7463('0x22')],_0x7463('0x23'));if(!_0x2c6219[_0x7463('0x24')]()){return _0x55adce(handleCheckRowError(_0x7463('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4bea9c));}}if(_0x4d63d8[_0x7463('0x25')]){if(!isEmail(_0x4d63d8['email'])){return _0x55adce(handleCheckRowError(_0x7463('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x4bea9c));}}_0x4d63d8[_0x7463('0x26')]=LISTID;_0x4d63d8[_0x7463('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7463('0x1a')]&&_0x2a7989){var _0x5aff6f={};for(var _0x742b6f=0x0,_0x4a142f=DUPLICATES[_0x7463('0x1a')];_0x742b6f<_0x4a142f;_0x742b6f+=0x1){_0x5aff6f[DUPLICATES[_0x742b6f]]=_0x4d63d8[DUPLICATES[_0x742b6f]];}var _0xd5c940=_[_0x7463('0x28')](_0x2a7989,_0x5aff6f);if(_0xd5c940){return _0x55adce(handleCheckRowError(_0x7463('0x29'),'Duplicate\x20Contact',_0xd5c940,_0x4bea9c));}}return db[_0x7463('0x2a')][_0x7463('0x2b')](_0x4d63d8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4d63d8)})[_0x7463('0x2c')](function(_0x5bed91){if(DUPLICATES&&DUPLICATES[_0x7463('0x1a')]&&_0x2a7989){_0x2a7989[_0x7463('0x2d')](_[_0x7463('0x2e')](_0x4d63d8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5bed91['id'];return _0x22528b();})[_0x7463('0x2f')](function(_0x1627fa){return _0x55adce(handleCheckRowError(_0x7463('0x14'),_0x7463('0x30')+(_0x1627fa[_0x7463('0x1c')]||JSON[_0x7463('0x31')](_0x1627fa)),null,_0x4bea9c));});});}function checkHopper(){function _0x5cfd0a(){return function(_0x1417b0){logger[_0x7463('0x14')](_0x7463('0x32'),'checkHopper',util[_0x7463('0x33')](_0x1417b0,{'showHidden':![],'depth':null}));};}var _0x45c5af=function(_0x50f17a,_0x4888a4){var _0x59e206=squel[_0x7463('0x34')]()[_0x7463('0x35')](_0x7463('0x36'))[_0x7463('0x37')]([_0x7463('0x38'),_0x7463('0x39'),_0x7463('0x3a'),_0x7463('0x26'),_0x4888a4,'createdAt',_0x7463('0x3b')],squel['select']()[_0x7463('0x3c')](_0x7463('0x38'),_0x7463('0x38'))[_0x7463('0x3c')](_0x7463('0x3d'),'scheduledAt')[_0x7463('0x3c')]('id',_0x7463('0x3a'))['field'](LISTID[_0x7463('0x3e')](),_0x7463('0x26'))['field'](_0x50f17a['id'][_0x7463('0x3e')](),_0x4888a4)[_0x7463('0x3c')](_0x7463('0x3d'),'createdAt')['field']('NOW()',_0x7463('0x3b'))['from'](_0x7463('0x3f'))[_0x7463('0x40')]('deletedAt\x20IS\x20NULL')[_0x7463('0x40')](_0x7463('0x41'),LISTID[_0x7463('0x3e')]())['where'](_0x7463('0x42'))[_0x7463('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7463('0x43')]()[_0x7463('0x3c')](_0x7463('0x38'))[_0x7463('0x44')]('cm_hopper')[_0x7463('0x40')](_0x4888a4+_0x7463('0x45'),_0x50f17a['id']['toString']())))[_0x7463('0x3e')]();return _0x59e206;};var _0x30525c=function(_0x1b4755,_0x429da5){var _0x567d30=squel['insert']()[_0x7463('0x35')](_0x7463('0x36'))[_0x7463('0x37')]([_0x7463('0x38'),_0x7463('0x39'),_0x7463('0x3a'),_0x7463('0x26'),_0x429da5,'createdAt','updatedAt'],squel[_0x7463('0x43')]()[_0x7463('0x3c')](_0x7463('0x38'),_0x7463('0x38'))[_0x7463('0x3c')](_0x7463('0x3d'),_0x7463('0x39'))[_0x7463('0x3c')]('id',_0x7463('0x3a'))['field'](LISTID['toString'](),_0x7463('0x26'))[_0x7463('0x3c')](_0x1b4755['id'][_0x7463('0x3e')](),_0x429da5)[_0x7463('0x3c')](_0x7463('0x3d'),'createdAt')[_0x7463('0x3c')](_0x7463('0x3d'),_0x7463('0x3b'))[_0x7463('0x44')](_0x7463('0x3f'))[_0x7463('0x40')](_0x7463('0x46'))[_0x7463('0x40')](_0x7463('0x41'),LISTID[_0x7463('0x3e')]())[_0x7463('0x40')](_0x7463('0x47'),squel[_0x7463('0x48')](hopperContacts))[_0x7463('0x40')](_0x7463('0x42'))[_0x7463('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7463('0x43')]()[_0x7463('0x3c')](_0x7463('0x49'))[_0x7463('0x44')](_0x7463('0x4a'))[_0x7463('0x40')](_0x429da5+_0x7463('0x45'),_0x1b4755['id']['toString']()))[_0x7463('0x40')](_0x7463('0x4b'),squel[_0x7463('0x43')]()[_0x7463('0x3c')]('phone')[_0x7463('0x44')](_0x7463('0x36'))[_0x7463('0x40')](_0x429da5+'\x20=\x20?',_0x1b4755['id'][_0x7463('0x3e')]())))['toString']();return _0x567d30;};function _0x44dfc9(_0x5f0354,_0x350c8b){var _0x12d22b=squel['insert']()[_0x7463('0x35')](_0x7463('0x36'))['fromQuery']([_0x7463('0x38'),_0x7463('0x39'),_0x7463('0x3a'),_0x7463('0x26'),_0x350c8b,_0x7463('0x4c'),_0x7463('0x3b')],squel[_0x7463('0x43')]()['field'](_0x7463('0x38'),_0x7463('0x38'))['field'](_0x7463('0x3d'),_0x7463('0x39'))[_0x7463('0x3c')]('id',_0x7463('0x3a'))[_0x7463('0x3c')](LISTID[_0x7463('0x3e')](),'ListId')['field'](_0x5f0354['id'][_0x7463('0x3e')](),_0x350c8b)[_0x7463('0x3c')](_0x7463('0x3d'),_0x7463('0x4c'))[_0x7463('0x3c')](_0x7463('0x3d'),_0x7463('0x3b'))[_0x7463('0x44')](_0x7463('0x3f'))['where'](_0x7463('0x46'))['where'](_0x7463('0x41'),LISTID['toString']())[_0x7463('0x40')](_0x7463('0x47'),squel[_0x7463('0x48')](hopperContacts))[_0x7463('0x40')](_0x7463('0x42')))[_0x7463('0x3e')]();return _0x12d22b;}function _0x58e41d(_0x2dcc86,_0x3f5be0){var _0x4f4a9e=squel[_0x7463('0x34')]()[_0x7463('0x35')](_0x7463('0x4d'))['fromQuery']([_0x7463('0x38'),'ContactId',_0x7463('0x26'),_0x3f5be0,_0x7463('0x4c'),'updatedAt'],squel[_0x7463('0x43')]()[_0x7463('0x3c')](_0x7463('0x38'),_0x7463('0x38'))[_0x7463('0x3c')]('id',_0x7463('0x3a'))['field'](LISTID[_0x7463('0x3e')](),_0x7463('0x26'))[_0x7463('0x3c')](_0x2dcc86['id']['toString'](),_0x3f5be0)[_0x7463('0x3c')]('NOW()',_0x7463('0x4c'))['field'](_0x7463('0x3d'),_0x7463('0x3b'))[_0x7463('0x44')](_0x7463('0x3f'))[_0x7463('0x40')](_0x7463('0x46'))[_0x7463('0x40')](_0x7463('0x41'),LISTID['toString']())['where'](_0x7463('0x47'),squel[_0x7463('0x48')](hopperContacts))['where'](_0x7463('0x42')))[_0x7463('0x3e')]();return _0x4f4a9e;}return db[_0x7463('0x4e')][_0x7463('0x4f')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x7463('0x2c')](function(_0x297fd3){var _0x1cea4b=[];if(_0x297fd3){var _0x5a286b;for(var _0x3cde8b=0x0,_0xb3b3b7;_0x3cde8b<_0x297fd3[_0x7463('0x1a')];_0x3cde8b+=0x1){_0xb3b3b7=_0x297fd3[_0x3cde8b][_0x7463('0x50')]({'plain':!![]});switch(_0xb3b3b7[_0x7463('0x51')]){case _0x7463('0x52'):_0x1cea4b[_0x7463('0x2d')](db[_0x7463('0x53')]['query'](_0x30525c(_0xb3b3b7,_0x7463('0x54')))[_0x7463('0x2c')](function(){})[_0x7463('0x2f')](_0x5cfd0a()));break;case'onlyIfOpen':_0x1cea4b['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x45c5af(_0xb3b3b7,_0x7463('0x54')))['then'](function(){})['catch'](_0x5cfd0a()));break;default:_0x1cea4b['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x44dfc9(_0xb3b3b7,'VoiceQueueId'))[_0x7463('0x2c')](function(){})['catch'](_0x5cfd0a()));}}}return _0x1cea4b;})[_0x7463('0x56')]()[_0x7463('0x2c')](function(){return db[_0x7463('0x4e')][_0x7463('0x4f')]({'where':{'type':_0x7463('0x57')},'attributes':['id'],'include':[{'model':db[_0x7463('0x58')],'as':_0x7463('0x59'),'where':{'id':LISTID}}]})[_0x7463('0x2c')](function(_0x37e1b8){var _0x164f7c=[];if(_0x37e1b8){var _0x56ba11;for(var _0xb3ff41=0x0,_0x35d52c;_0xb3ff41<_0x37e1b8[_0x7463('0x1a')];_0xb3ff41+=0x1){_0x35d52c=_0x37e1b8[_0xb3ff41]['get']({'plain':!![]});_0x164f7c['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x58e41d(_0x35d52c,_0x7463('0x54')))['then'](function(){})[_0x7463('0x2f')](_0x5cfd0a()));}}return _0x164f7c;})[_0x7463('0x56')]();})['then'](function(){return db[_0x7463('0x5a')][_0x7463('0x4f')]({'attributes':['id',_0x7463('0x51')],'include':[{'model':db[_0x7463('0x58')],'as':_0x7463('0x5b'),'where':{'id':LISTID}}]})[_0x7463('0x2c')](function(_0x5bb91d){var _0x3341bc=[];if(_0x5bb91d){for(var _0x4480cb=0x0,_0x55dd82;_0x4480cb<_0x5bb91d[_0x7463('0x1a')];_0x4480cb+=0x1){_0x55dd82=_0x5bb91d[_0x4480cb][_0x7463('0x50')]({'plain':!![]});switch(_0x55dd82[_0x7463('0x51')]){case _0x7463('0x52'):_0x3341bc[_0x7463('0x2d')](db[_0x7463('0x53')]['query'](_0x30525c(_0x55dd82,_0x7463('0x5c')))[_0x7463('0x2c')](function(){})[_0x7463('0x2f')](_0x5cfd0a()));break;case _0x7463('0x5d'):_0x3341bc['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x45c5af(_0x55dd82,_0x7463('0x5c')))['then'](function(){})['catch'](_0x5cfd0a()));break;default:_0x3341bc['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x44dfc9(_0x55dd82,_0x7463('0x5c')))[_0x7463('0x2c')](function(){})[_0x7463('0x2f')](_0x5cfd0a()));}}}return _0x3341bc;})[_0x7463('0x56')]();})[_0x7463('0x2c')](function(){return db['Campaign'][_0x7463('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x7463('0x58')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x5d2ca9){var _0x42745d=[];if(_0x5d2ca9){for(var _0x49a60e=0x0,_0x31f72e;_0x49a60e<_0x5d2ca9[_0x7463('0x1a')];_0x49a60e+=0x1){_0x31f72e=_0x5d2ca9[_0x49a60e][_0x7463('0x50')]({'plain':!![]});_0x42745d[_0x7463('0x2d')](db[_0x7463('0x53')][_0x7463('0x55')](_0x58e41d(_0x31f72e,_0x7463('0x5c')))[_0x7463('0x2c')](function(){})['catch'](_0x5cfd0a()));}}return _0x42745d;})[_0x7463('0x56')]();})['catch'](function(_0x41309c){logger[_0x7463('0x14')](_0x7463('0x5e'),_0x7463('0x5f'),_0x41309c[_0x7463('0x1c')]);});}var processPromises=function(_0x5e5acd){return BPromise['all'](promises)['then'](function(_0x17a3c1){})[_0x7463('0x2f')](function(_0x15c735){logger[_0x7463('0x14')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x15c735));})[_0x7463('0x60')](function(){socket[_0x7463('0x61')](_0x7463('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5e5acd){return _0x5e5acd[_0x7463('0x63')]();}});};var endCsv=function(){return BPromise[_0x7463('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7463('0x2c')](function(){socket[_0x7463('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7463('0x65')](FILEPATH);}catch(_0x364c6c){logger[_0x7463('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x7463('0x31')](_0x364c6c));}finally{process[_0x7463('0x66')](0x0);}});};process['on'](_0x7463('0x67'),function(){logger[_0x7463('0x68')](_0x7463('0x69'));endCsv();});function main(){return BPromise[_0x7463('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7463('0x6a')](',');return db['CmContact'][_0x7463('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xdcf0dd){var _0x2fb5eb=fs[_0x7463('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7463('0x6c')](_0x2fb5eb,{'header':!![],'skipEmptyLines':!![],'step':function(_0x28aa41,_0x135937){total+=0x1;var _0x43f221=total;promises[_0x7463('0x2d')](checkRow(_0x28aa41,_0xdcf0dd,_0x43f221)['then'](function(){success+=0x1;})[_0x7463('0x2f')](function(_0x4fa8a4){if(_0x4fa8a4[_0x7463('0x14')]){errors+=0x1;delete _0x4fa8a4['error'];}else if(_0x4fa8a4[_0x7463('0x29')]){duplicates+=0x1;delete _0x4fa8a4[_0x7463('0x29')];}rows['push'](_0x4fa8a4);}));if(total%0xc8===0x0){_0x135937['pause']();return processPromises(_0x135937);}},'complete':function(){return processPromises()[_0x7463('0x2c')](function(){logger[_0x7463('0x68')](_0x7463('0x6d'));endCsv();});},'error':function(_0xe4331,_0x36e119){logger[_0x7463('0x68')](_0x7463('0x6e'),JSON[_0x7463('0x31')](_0xe4331));endCsv();}});})[_0x7463('0x2f')](function(_0x4be32c){logger[_0x7463('0x14')](_0x7463('0x6f'),JSON[_0x7463('0x31')](_0x4be32c));});}main(); \ No newline at end of file +var _0xc548=['cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','message','join','data','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','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','updatedAt','select','field','NOW()','ContactId','toString','createdAt','from','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','findAll','outbound','dialCheckDuplicateType','get','sequelize','query','VoiceQueueId','catch','onlyIfOpen','CmList','BlackLists','all','Campaign','Lists','always','CampaignId'];(function(_0xe44ae9,_0x2ab661){var _0x2ccef2=function(_0x524af7){while(--_0x524af7){_0xe44ae9['push'](_0xe44ae9['shift']());}};_0x2ccef2(++_0x2ab661);}(_0xc548,0x15d));var _0x8c54=function(_0x1587af,_0x3c73ee){_0x1587af=_0x1587af-0x0;var _0x15d3a6=_0xc548[_0x1587af];return _0x15d3a6;};'use strict';var BPromise=require(_0x8c54('0x0'));var util=require(_0x8c54('0x1'));var _=require(_0x8c54('0x2'));var fs=require('fs');var squel=require(_0x8c54('0x3'));var Papa=require(_0x8c54('0x4'));var Redis=require(_0x8c54('0x5'));var db=require(_0x8c54('0x6'))['db'];var config=require(_0x8c54('0x7'));var logger=require(_0x8c54('0x8'))(_0x8c54('0x9'));config[_0x8c54('0xa')]=_[_0x8c54('0xb')](config[_0x8c54('0xa')],{'host':_0x8c54('0xc'),'port':0x18eb});var socket=require(_0x8c54('0xd'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x8c54('0xe')](socket);try{if(!process[_0x8c54('0xf')][0x2]||process[_0x8c54('0xf')][0x2]===_0x8c54('0x10')||process[_0x8c54('0xf')][0x2]===_0x8c54('0x11')){throw new Error(_0x8c54('0x12'));}var FILEPATH=process['argv'][0x2];if(!process[_0x8c54('0xf')][0x3]||process[_0x8c54('0xf')][0x3]==='undefined'||process[_0x8c54('0xf')][0x3]===_0x8c54('0x11')||!process[_0x8c54('0xf')][0x4]||process[_0x8c54('0xf')][0x4]===_0x8c54('0x10')||process[_0x8c54('0xf')][0x4]===_0x8c54('0x11')){throw new Error(_0x8c54('0x13'));}var FIELDS=_['zipObject'](process[_0x8c54('0xf')][0x3][_0x8c54('0x14')](','),process['argv'][0x4][_0x8c54('0x14')](','));if(!process[_0x8c54('0xf')][0x5]||process[_0x8c54('0xf')][0x5]===_0x8c54('0x10')||process[_0x8c54('0xf')][0x5]===_0x8c54('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x8c54('0xf')][0x5];var COMPANYID=process[_0x8c54('0xf')][0x6]&&process[_0x8c54('0xf')][0x6]!=='undefined'&&process[_0x8c54('0xf')][0x6]!==_0x8c54('0x11')?process[_0x8c54('0xf')][0x6]:null;var DUPLICATES=process[_0x8c54('0xf')][0x7]&&process['argv'][0x7]!==_0x8c54('0x10')&&process[_0x8c54('0xf')][0x7]!==_0x8c54('0x11')?process[_0x8c54('0xf')][0x7]:null;if(!process[_0x8c54('0xf')][0x8]||process[_0x8c54('0xf')][0x8]===_0x8c54('0x10')||process[_0x8c54('0xf')][0x8]===_0x8c54('0x11')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x8c54('0xf')][0x8];}catch(_0x49abb7){logger[_0x8c54('0x15')](_0x49abb7);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(_0x4c510a,_0x53ea4e,_0x1f24cc,_0x523384){var _0x4ddd0c={'message':_0x53ea4e};_0x4ddd0c[_0x4c510a]=!![];if(_0x1f24cc){_0x4ddd0c[_0x8c54('0x16')]=_0x1f24cc;}if(_0x523384){_0x4ddd0c['index']=_0x523384;}return _0x4ddd0c;}function isEmail(_0x55fbb1){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))*$/[_0x8c54('0x17')](_0x55fbb1);}function checkRow(_0x5c5df2,_0x4f4cd0,_0x13b19b){return new BPromise(function(_0x55a48b,_0xfceaab){if(_[_0x8c54('0x18')](_0x5c5df2)){return _0xfceaab(handleCheckRowError(_0x8c54('0x15'),_0x8c54('0x19'),null,_0x13b19b));}if(_0x5c5df2['errors']&&_0x5c5df2['errors'][_0x8c54('0x1a')]){var _0x31d7e8=_[_0x8c54('0x1b')](_0x5c5df2['errors'],_0x8c54('0x1c'))[_0x8c54('0x1d')](';');return _0xfceaab(handleCheckRowError(_0x8c54('0x15'),_0x31d7e8,null,_0x13b19b));}var _0x199b47={};for(var _0x2d8d0e in FIELDS){if(FIELDS['hasOwnProperty'](_0x2d8d0e)&&FIELDS[_0x2d8d0e]){_0x199b47[_0x2d8d0e]=_0x5c5df2[_0x8c54('0x1e')][0x0][FIELDS[_0x2d8d0e]]||_0x5c5df2['data'][0x0]['\ufeff'+FIELDS[_0x2d8d0e]];}}if(!_0x199b47['firstName']){return _0xfceaab(handleCheckRowError(_0x8c54('0x15'),_0x8c54('0x1f'),null,_0x13b19b));}if(!_0x199b47[_0x8c54('0x20')]){return _0xfceaab(handleCheckRowError(_0x8c54('0x15'),_0x8c54('0x21'),null,_0x13b19b));}if(_0x199b47[_0x8c54('0x22')]){var _0x55caa3=moment(_0x199b47[_0x8c54('0x22')],_0x8c54('0x23'));if(!_0x55caa3['isValid']()){return _0xfceaab(handleCheckRowError(_0x8c54('0x15'),_0x8c54('0x24'),null,_0x13b19b));}}if(_0x199b47[_0x8c54('0x25')]){if(!isEmail(_0x199b47[_0x8c54('0x25')])){return _0xfceaab(handleCheckRowError(_0x8c54('0x15'),_0x8c54('0x26'),null,_0x13b19b));}}_0x199b47[_0x8c54('0x27')]=LISTID;_0x199b47[_0x8c54('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8c54('0x1a')]&&_0x4f4cd0){var _0x125313={};for(var _0x5555e4=0x0,_0x57c172=DUPLICATES[_0x8c54('0x1a')];_0x5555e4<_0x57c172;_0x5555e4+=0x1){_0x125313[DUPLICATES[_0x5555e4]]=_0x199b47[DUPLICATES[_0x5555e4]];}var _0x484de9=_[_0x8c54('0x29')](_0x4f4cd0,_0x125313);if(_0x484de9){return _0xfceaab(handleCheckRowError('duplicate',_0x8c54('0x2a'),_0x484de9,_0x13b19b));}}return db['CmContact'][_0x8c54('0x2b')](_0x199b47,{'raw':!![],'hooks':![],'fields':_[_0x8c54('0x2c')](_0x199b47)})[_0x8c54('0x2d')](function(_0x57bd35){if(DUPLICATES&&DUPLICATES['length']&&_0x4f4cd0){_0x4f4cd0[_0x8c54('0x2e')](_[_0x8c54('0x2f')](_0x199b47,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x57bd35['id'];return _0x55a48b();})['catch'](function(_0x56b561){return _0xfceaab(handleCheckRowError(_0x8c54('0x15'),_0x8c54('0x30')+(_0x56b561['message']||JSON[_0x8c54('0x31')](_0x56b561)),null,_0x13b19b));});});}function checkHopper(){function _0x403ff7(){return function(_0x250cd6){logger[_0x8c54('0x15')](_0x8c54('0x32'),_0x8c54('0x33'),util['inspect'](_0x250cd6,{'showHidden':![],'depth':null}));};}var _0x25e917=function(_0x1908b0,_0xf8a84e){var _0x120711=squel[_0x8c54('0x34')]()['into'](_0x8c54('0x35'))[_0x8c54('0x36')](['phone',_0x8c54('0x37'),'ContactId',_0x8c54('0x27'),_0xf8a84e,'createdAt',_0x8c54('0x38')],squel[_0x8c54('0x39')]()['field']('phone',_0x8c54('0x20'))[_0x8c54('0x3a')](_0x8c54('0x3b'),_0x8c54('0x37'))['field']('id',_0x8c54('0x3c'))['field'](LISTID['toString'](),_0x8c54('0x27'))['field'](_0x1908b0['id'][_0x8c54('0x3d')](),_0xf8a84e)[_0x8c54('0x3a')](_0x8c54('0x3b'),_0x8c54('0x3e'))[_0x8c54('0x3a')]('NOW()','updatedAt')[_0x8c54('0x3f')]('cm_contacts')[_0x8c54('0x40')](_0x8c54('0x41'))['where']('ListId\x20=\x20?',LISTID[_0x8c54('0x3d')]())[_0x8c54('0x40')](_0x8c54('0x42'))[_0x8c54('0x40')](_0x8c54('0x43'),squel[_0x8c54('0x39')]()[_0x8c54('0x3a')]('phone')[_0x8c54('0x3f')](_0x8c54('0x35'))['where'](_0xf8a84e+_0x8c54('0x44'),_0x1908b0['id']['toString']())))[_0x8c54('0x3d')]();return _0x120711;};var _0x17b459=function(_0x4ae3b6,_0x5d5d20){var _0x4c353b=squel[_0x8c54('0x34')]()[_0x8c54('0x45')](_0x8c54('0x35'))[_0x8c54('0x36')]([_0x8c54('0x20'),_0x8c54('0x37'),_0x8c54('0x3c'),_0x8c54('0x27'),_0x5d5d20,'createdAt',_0x8c54('0x38')],squel['select']()[_0x8c54('0x3a')](_0x8c54('0x20'),'phone')[_0x8c54('0x3a')](_0x8c54('0x3b'),'scheduledAt')[_0x8c54('0x3a')]('id',_0x8c54('0x3c'))['field'](LISTID[_0x8c54('0x3d')](),_0x8c54('0x27'))[_0x8c54('0x3a')](_0x4ae3b6['id'][_0x8c54('0x3d')](),_0x5d5d20)[_0x8c54('0x3a')](_0x8c54('0x3b'),_0x8c54('0x3e'))[_0x8c54('0x3a')]('NOW()',_0x8c54('0x38'))['from'](_0x8c54('0x46'))[_0x8c54('0x40')](_0x8c54('0x41'))[_0x8c54('0x40')](_0x8c54('0x47'),LISTID[_0x8c54('0x3d')]())[_0x8c54('0x40')](_0x8c54('0x48'),squel[_0x8c54('0x49')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x8c54('0x40')](_0x8c54('0x43'),squel[_0x8c54('0x39')]()[_0x8c54('0x3a')]('calleridnum')['from'](_0x8c54('0x4a'))[_0x8c54('0x40')](_0x5d5d20+_0x8c54('0x44'),_0x4ae3b6['id']['toString']()))[_0x8c54('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8c54('0x39')]()['field'](_0x8c54('0x20'))[_0x8c54('0x3f')]('cm_hopper')['where'](_0x5d5d20+'\x20=\x20?',_0x4ae3b6['id'][_0x8c54('0x3d')]())))[_0x8c54('0x3d')]();return _0x4c353b;};function _0x29d2c9(_0x317304,_0x18492f){var _0x15c692=squel[_0x8c54('0x34')]()[_0x8c54('0x45')]('cm_hopper')['fromQuery']([_0x8c54('0x20'),'scheduledAt','ContactId',_0x8c54('0x27'),_0x18492f,_0x8c54('0x3e'),_0x8c54('0x38')],squel[_0x8c54('0x39')]()[_0x8c54('0x3a')](_0x8c54('0x20'),_0x8c54('0x20'))['field']('NOW()',_0x8c54('0x37'))[_0x8c54('0x3a')]('id','ContactId')[_0x8c54('0x3a')](LISTID[_0x8c54('0x3d')](),_0x8c54('0x27'))[_0x8c54('0x3a')](_0x317304['id']['toString'](),_0x18492f)[_0x8c54('0x3a')]('NOW()',_0x8c54('0x3e'))['field'](_0x8c54('0x3b'),_0x8c54('0x38'))['from'](_0x8c54('0x46'))[_0x8c54('0x40')](_0x8c54('0x41'))[_0x8c54('0x40')]('ListId\x20=\x20?',LISTID[_0x8c54('0x3d')]())[_0x8c54('0x40')](_0x8c54('0x48'),squel[_0x8c54('0x49')](hopperContacts))[_0x8c54('0x40')](_0x8c54('0x42')))[_0x8c54('0x3d')]();return _0x15c692;}function _0x2250d4(_0x180715,_0x54d5c7){var _0x1fd32a=squel[_0x8c54('0x34')]()[_0x8c54('0x45')]('cm_hopper_black')[_0x8c54('0x36')]([_0x8c54('0x20'),_0x8c54('0x3c'),_0x8c54('0x27'),_0x54d5c7,_0x8c54('0x3e'),_0x8c54('0x38')],squel['select']()[_0x8c54('0x3a')]('phone',_0x8c54('0x20'))[_0x8c54('0x3a')]('id',_0x8c54('0x3c'))[_0x8c54('0x3a')](LISTID[_0x8c54('0x3d')](),_0x8c54('0x27'))[_0x8c54('0x3a')](_0x180715['id'][_0x8c54('0x3d')](),_0x54d5c7)['field'](_0x8c54('0x3b'),_0x8c54('0x3e'))[_0x8c54('0x3a')](_0x8c54('0x3b'),_0x8c54('0x38'))['from']('cm_contacts')[_0x8c54('0x40')](_0x8c54('0x41'))[_0x8c54('0x40')](_0x8c54('0x47'),LISTID[_0x8c54('0x3d')]())[_0x8c54('0x40')](_0x8c54('0x48'),squel[_0x8c54('0x49')](hopperContacts))[_0x8c54('0x40')](_0x8c54('0x42')))[_0x8c54('0x3d')]();return _0x1fd32a;}return db['VoiceQueue'][_0x8c54('0x4b')]({'where':{'type':_0x8c54('0x4c')},'attributes':['id',_0x8c54('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x362402){var _0x29931a=[];if(_0x362402){var _0x14cc17;for(var _0x214ad0=0x0,_0x49e344;_0x214ad0<_0x362402[_0x8c54('0x1a')];_0x214ad0+=0x1){_0x49e344=_0x362402[_0x214ad0][_0x8c54('0x4e')]({'plain':!![]});switch(_0x49e344[_0x8c54('0x4d')]){case'always':_0x29931a['push'](db[_0x8c54('0x4f')][_0x8c54('0x50')](_0x17b459(_0x49e344,_0x8c54('0x51')))[_0x8c54('0x2d')](function(){})[_0x8c54('0x52')](_0x403ff7()));break;case _0x8c54('0x53'):_0x29931a[_0x8c54('0x2e')](db[_0x8c54('0x4f')]['query'](_0x25e917(_0x49e344,_0x8c54('0x51')))[_0x8c54('0x2d')](function(){})['catch'](_0x403ff7()));break;default:_0x29931a[_0x8c54('0x2e')](db[_0x8c54('0x4f')][_0x8c54('0x50')](_0x29d2c9(_0x49e344,'VoiceQueueId'))[_0x8c54('0x2d')](function(){})[_0x8c54('0x52')](_0x403ff7()));}}}return _0x29931a;})['all']()[_0x8c54('0x2d')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x8c54('0x54')],'as':_0x8c54('0x55'),'where':{'id':LISTID}}]})[_0x8c54('0x2d')](function(_0x528a65){var _0x4f7115=[];if(_0x528a65){var _0x26eea7;for(var _0x542fef=0x0,_0x3e3478;_0x542fef<_0x528a65['length'];_0x542fef+=0x1){_0x3e3478=_0x528a65[_0x542fef]['get']({'plain':!![]});_0x4f7115['push'](db['sequelize'][_0x8c54('0x50')](_0x2250d4(_0x3e3478,_0x8c54('0x51')))[_0x8c54('0x2d')](function(){})[_0x8c54('0x52')](_0x403ff7()));}}return _0x4f7115;})[_0x8c54('0x56')]();})[_0x8c54('0x2d')](function(){return db[_0x8c54('0x57')][_0x8c54('0x4b')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8c54('0x54')],'as':_0x8c54('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x4d983d){var _0x731525=[];if(_0x4d983d){for(var _0x372730=0x0,_0x30cde3;_0x372730<_0x4d983d['length'];_0x372730+=0x1){_0x30cde3=_0x4d983d[_0x372730][_0x8c54('0x4e')]({'plain':!![]});switch(_0x30cde3[_0x8c54('0x4d')]){case _0x8c54('0x59'):_0x731525[_0x8c54('0x2e')](db[_0x8c54('0x4f')]['query'](_0x17b459(_0x30cde3,'CampaignId'))[_0x8c54('0x2d')](function(){})[_0x8c54('0x52')](_0x403ff7()));break;case'onlyIfOpen':_0x731525[_0x8c54('0x2e')](db['sequelize'][_0x8c54('0x50')](_0x25e917(_0x30cde3,_0x8c54('0x5a')))['then'](function(){})[_0x8c54('0x52')](_0x403ff7()));break;default:_0x731525['push'](db['sequelize'][_0x8c54('0x50')](_0x29d2c9(_0x30cde3,'CampaignId'))['then'](function(){})[_0x8c54('0x52')](_0x403ff7()));}}}return _0x731525;})[_0x8c54('0x56')]();})[_0x8c54('0x2d')](function(){return db[_0x8c54('0x57')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x8c54('0x54')],'as':_0x8c54('0x55'),'where':{'id':LISTID}}]})[_0x8c54('0x2d')](function(_0x566adb){var _0xf3aee2=[];if(_0x566adb){for(var _0xb9d515=0x0,_0xb63e66;_0xb9d515<_0x566adb['length'];_0xb9d515+=0x1){_0xb63e66=_0x566adb[_0xb9d515][_0x8c54('0x4e')]({'plain':!![]});_0xf3aee2[_0x8c54('0x2e')](db[_0x8c54('0x4f')]['query'](_0x2250d4(_0xb63e66,'CampaignId'))[_0x8c54('0x2d')](function(){})['catch'](_0x403ff7()));}}return _0xf3aee2;})[_0x8c54('0x56')]();})[_0x8c54('0x52')](function(_0x39309d){logger[_0x8c54('0x15')](_0x8c54('0x5b'),_0x8c54('0x5c'),_0x39309d['message']);});}var processPromises=function(_0x1a0e2c){return BPromise[_0x8c54('0x56')](promises)[_0x8c54('0x2d')](function(_0x213cec){})[_0x8c54('0x52')](function(_0x42fbcd){logger[_0x8c54('0x15')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x42fbcd));})[_0x8c54('0x5d')](function(){socket[_0x8c54('0x5e')](_0x8c54('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1a0e2c){return _0x1a0e2c[_0x8c54('0x60')]();}});};var endCsv=function(){return BPromise[_0x8c54('0x61')]()[_0x8c54('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x8c54('0x2d')](function(){socket[_0x8c54('0x5e')](_0x8c54('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x4fbea9){logger[_0x8c54('0x15')](_0x8c54('0x62'),JSON['stringify'](_0x4fbea9));}finally{process[_0x8c54('0x63')](0x0);}});};process['on'](_0x8c54('0x64'),function(){logger[_0x8c54('0x65')](_0x8c54('0x66'));endCsv();});function main(){return BPromise[_0x8c54('0x61')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8c54('0x14')](',');return db[_0x8c54('0x67')][_0x8c54('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8c54('0x2d')](function(_0x2cf695){var _0x4ac480=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8c54('0x68')](_0x4ac480,{'header':!![],'skipEmptyLines':!![],'step':function(_0x429a35,_0x383b8c){total+=0x1;var _0x49cc09=total;promises[_0x8c54('0x2e')](checkRow(_0x429a35,_0x2cf695,_0x49cc09)[_0x8c54('0x2d')](function(){success+=0x1;})['catch'](function(_0x53ab74){if(_0x53ab74['error']){errors+=0x1;delete _0x53ab74[_0x8c54('0x15')];}else if(_0x53ab74[_0x8c54('0x69')]){duplicates+=0x1;delete _0x53ab74[_0x8c54('0x69')];}rows[_0x8c54('0x2e')](_0x53ab74);}));if(total%0xc8===0x0){_0x383b8c[_0x8c54('0x6a')]();return processPromises(_0x383b8c);}},'complete':function(){return processPromises()['then'](function(){logger[_0x8c54('0x65')](_0x8c54('0x6b'));endCsv();});},'error':function(_0xabd501,_0x21b976){logger[_0x8c54('0x65')](_0x8c54('0x6c'),JSON[_0x8c54('0x31')](_0xabd501));endCsv();}});})['catch'](function(_0x19a217){logger[_0x8c54('0x15')](_0x8c54('0x6d'),JSON[_0x8c54('0x31')](_0x19a217));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 566abef..834b308 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 _0x6467=['length','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.updatedAt','insert','cm_hopper_black','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ListId','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','error','errors','code','message','query','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','spread','catch','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','keys','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','description','replace','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','exit','complete','argv','existsSync','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','split'];(function(_0x4e673e,_0x3413b8){var _0x837f41=function(_0x1f06b9){while(--_0x1f06b9){_0x4e673e['push'](_0x4e673e['shift']());}};_0x837f41(++_0x3413b8);}(_0x6467,0x9b));var _0x7646=function(_0x1662c7,_0x1b1989){_0x1662c7=_0x1662c7-0x0;var _0x845dbb=_0x6467[_0x1662c7];return _0x845dbb;};'use strict';var fs=require('fs');var path=require(_0x7646('0x0'));var _=require(_0x7646('0x1'));var Papa=require(_0x7646('0x2'));var util=require(_0x7646('0x3'));var BPromise=require('bluebird');var moment=require(_0x7646('0x4'));var squel=require('squel');var Redis=require(_0x7646('0x5'));var db=require(_0x7646('0x6'))['db'];var config=require(_0x7646('0x7'));var shared=require(_0x7646('0x8'));var logger=require(_0x7646('0x9'))(_0x7646('0xa'));config[_0x7646('0xb')]=_[_0x7646('0xc')](config['redis'],{'host':_0x7646('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7646('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5204c8){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))*$/[_0x7646('0xe')](_0x5204c8);}function selectNotIn(_0x1d2e37,_0x442cbb,_0x8a9e46,_0x512f18,_0x4d759d){return squel[_0x7646('0xf')]()[_0x7646('0x10')](_0x7646('0x11'))[_0x7646('0x12')](_0x512f18)[_0x7646('0x13')](_0x442cbb,null,_0x442cbb+_0x7646('0x14')+_0x512f18+'.'+_0x8a9e46)[_0x7646('0x15')](_0x512f18+'.'+_0x8a9e46+_0x7646('0x16')+_0x1d2e37+'.'+_0x8a9e46)[_0x7646('0x15')](_0x442cbb+_0x7646('0x17')+_0x4d759d[_0x7646('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e63e1,_0x41dca5){promisesAdditionalPhones=[];return db[_0x7646('0x18')][_0x7646('0x19')]({'raw':!![],'attributes':['id',_0x7646('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7646('0x1b')](function(_0x50707a){if(_0x50707a!==null){var _0x3a7039=[];for(var _0x260c09=0x0;_0x260c09<_0x50707a['length'];_0x260c09++){var _0x3ab94c=_0x50707a[_0x260c09];_0x3a7039[_0x7646('0x1c')](insertAdditionalPhones(_0x3ab94c));}}Promise[_0x7646('0x1d')](_0x3a7039)[_0x7646('0x1b')](function(){_0x4e63e1({'val':0x1});});});});}function insertAdditionalPhones(_0x408a4e){return new Promise(function(_0x19b0c5,_0x52178d){var _0x3358fb=_0x408a4e[_0x7646('0x1a')];var _0x34dbef=_0x3358fb[_0x7646('0x1e')](';');var _0x2697ec=[];orderBy=0x0;for(var _0x2fbf3c=0x0;_0x2fbf3c<_0x34dbef[_0x7646('0x1f')];_0x2fbf3c++){_0x2697ec[_0x7646('0x1c')](splitAdditionalPhone(_0x408a4e['id'],_0x34dbef[_0x2fbf3c]));}Promise[_0x7646('0x1d')](_0x2697ec)[_0x7646('0x1b')](function(){_0x19b0c5({'val':_0x34dbef[_0x7646('0x1f')]});});});}function splitAdditionalPhone(_0x39d4d8,_0x4fa30d){return new Promise(function(_0x2b5d72,_0x4903f0){var _0x45d0b8=_0x4fa30d[_0x7646('0x1e')](':');var _0x3197b=_0x45d0b8[0x0];var _0x570d11=_0x45d0b8[0x1];if(!_[_0x7646('0x20')](_0x570d11)){var _0x16d26d=_0x570d11[_0x7646('0x1e')]('|');var _0x4b4d03=[];for(var _0x8e6caa=0x0;_0x8e6caa<_0x16d26d[_0x7646('0x1f')];_0x8e6caa++){if(_0x16d26d[_0x8e6caa]!==''){var _0x1b2608=_[_0x7646('0x21')](promisesAdditionalPhones,{'contactId':_0x39d4d8,'phone':_0x16d26d[_0x8e6caa]});if(_0x1b2608['length']==0x0){orderBy++;promisesAdditionalPhones[_0x7646('0x1c')]({'contactId':_0x39d4d8,'contactTypeId':_0x3197b,'phone':_0x16d26d[_0x8e6caa],'orderBy':orderBy});}}}_0x2b5d72({'ok':0x1});}else _0x2b5d72({'res':0x0});});}function createAdditionalPhone(_0x4d03e2,_0x37b123,_0x5765e6,_0x3c2b75){var _0x467652='';var _0x335866='';var _0x10846c=_0x5765e6['split']('§');_0x467652=_0x10846c[0x0];if(_0x10846c['length']==0x2)_0x335866=_0x10846c[0x1];return new Promise(function(_0x44b3fc,_0x35eba9){return db[_0x7646('0x22')]['findOne']({'where':{'CmContactId':_0x4d03e2,'item':_0x467652}})[_0x7646('0x1b')](function(_0x1cd1b6){if(_0x1cd1b6){return db[_0x7646('0x22')][_0x7646('0x23')]({'ItemTypeId':_0x37b123,'description':_0x335866,'OrderBy':_0x3c2b75},{'where':{'CmContactId':_0x4d03e2,'item':_0x467652}})[_0x7646('0x1b')](function(_0x56bcd3){_0x44b3fc({'res':_0x7646('0x24')});});}else{return db['CmContactHasItem'][_0x7646('0x25')]({'CmContactId':_0x4d03e2,'item':_0x467652,'description':_0x335866,'ItemTypeId':_0x37b123,'OrderBy':_0x3c2b75,'ItemClass':_0x7646('0x26')})[_0x7646('0x1b')](function(_0x453b8f){_0x44b3fc({'res':_0x7646('0x27')});});}});});}function insertCmHopper(_0x180631,_0x4eb8c2,_0x110021,_0xd236e2,_0x30e025){var _0x52eaf9=['cm_contacts.phone',_0x7646('0x28'),_0x7646('0x29'),_0x7646('0x2a'),_0x4eb8c2+'.'+_0xd236e2,_0x7646('0x2b'),'cm_contacts.updatedAt',_0x7646('0x2c'),_0x7646('0x2d'),'\x22'+_0x30e025+'\x22'];return squel['insert']()[_0x7646('0x2e')](_0x7646('0x2f'))[_0x7646('0x30')]([_0x7646('0x11'),_0x7646('0x31'),_0x7646('0x32'),'ListId',_0xd236e2,_0x7646('0x33'),_0x7646('0x34'),_0x7646('0x35'),_0x7646('0x36'),_0x7646('0x37')],squel[_0x7646('0xf')]()[_0x7646('0x38')](_0x52eaf9)['from'](_0x4eb8c2)[_0x7646('0x13')](_0x7646('0x39'),null,_0x7646('0x3a')+_0x4eb8c2+_0x7646('0x3b'))[_0x7646('0x13')](_0x110021,null,_0x110021+'.id\x20=\x20'+_0x4eb8c2+'.'+_0xd236e2)[_0x7646('0x15')](_0x4eb8c2+_0x7646('0x3c'),_0x180631)[_0x7646('0x15')](_0x7646('0x3d'),NOW)[_0x7646('0x15')](_0x7646('0x3e'),selectNotIn(_0x4eb8c2,_0x110021,_0xd236e2,'cm_hopper',[_0x7646('0x3f'),_0x7646('0x40')]))['where'](_0x7646('0x3e'),selectNotIn(_0x4eb8c2,_0x110021,_0xd236e2,_0x7646('0x2f'),[_0x7646('0x3f')])))['toString']();}function insertCmHopperBlack(_0x283ad1,_0x57833c,_0x119b53,_0xeb7273){var _0x4c54d3=[_0x7646('0x41'),_0x7646('0x29'),_0x7646('0x2a'),_0x57833c+'.'+_0xeb7273,_0x7646('0x2b'),_0x7646('0x42')];return squel[_0x7646('0x43')]()[_0x7646('0x2e')](_0x7646('0x44'))['fromQuery']([_0x7646('0x11'),_0x7646('0x32'),'ListId',_0xeb7273,_0x7646('0x33'),'updatedAt'],squel['select']()[_0x7646('0x38')](_0x4c54d3)[_0x7646('0x12')](_0x57833c)['join'](_0x7646('0x39'),null,_0x7646('0x3a')+_0x57833c+_0x7646('0x3b'))[_0x7646('0x13')](_0x119b53,null,_0x119b53+_0x7646('0x14')+_0x57833c+'.'+_0xeb7273)[_0x7646('0x15')](_0x57833c+_0x7646('0x3c'),_0x283ad1)[_0x7646('0x15')](_0x7646('0x3d'),NOW)[_0x7646('0x15')](_0x7646('0x3e'),squel[_0x7646('0xf')]()[_0x7646('0x10')](_0x7646('0x11'))['from'](_0x7646('0x44'))[_0x7646('0x15')](_0x7646('0x45'),_0x283ad1)['where'](_0xeb7273+_0x7646('0x16')+_0x57833c+'.'+_0xeb7273)))[_0x7646('0x46')]();}function insertTzCmHopper(_0x7e9d9c,_0x5d03a0,_0x4e9f5a,_0x1639c8,_0x59411c,_0xc7d46){var _0x560347=[_0x7646('0x41'),_0x7646('0x47')+_0xc7d46+_0x7646('0x48'),_0x7646('0x29'),_0x7646('0x2a'),_0x5d03a0+'.'+_0x1639c8,'cm_contacts.createdAt',_0x7646('0x42'),'cm_contacts.priority',_0x7646('0x2d'),'\x22'+_0x59411c+'\x22'];var _0x5d0654=squel[_0x7646('0x43')]()[_0x7646('0x2e')]('cm_hopper')['fromQuery']([_0x7646('0x11'),'scheduledat',_0x7646('0x32'),_0x7646('0x49'),_0x1639c8,_0x7646('0x33'),_0x7646('0x34'),_0x7646('0x35'),_0x7646('0x36'),_0x7646('0x37')],squel[_0x7646('0xf')]()[_0x7646('0x38')](_0x560347)[_0x7646('0x12')](_0x5d03a0)['join']('cm_contacts',null,_0x7646('0x3a')+_0x5d03a0+'.CmListId')[_0x7646('0x13')](_0x4e9f5a,null,_0x4e9f5a+_0x7646('0x14')+_0x5d03a0+'.'+_0x1639c8)[_0x7646('0x13')](_0xc7d46,null,_0xc7d46+'.id\x20=\x20'+_0x5d03a0+'.'+_0x1639c8)['where'](_0x5d03a0+_0x7646('0x3c'),_0x7e9d9c)[_0x7646('0x15')](_0x7646('0x3d'),NOW)[_0x7646('0x15')](_0x7646('0x3e'),selectNotIn(_0x5d03a0,_0x4e9f5a,_0x1639c8,'cm_hopper',['\x22always\x22',_0x7646('0x40')]))[_0x7646('0x15')](_0x7646('0x3e'),selectNotIn(_0x5d03a0,_0x4e9f5a,_0x1639c8,_0x7646('0x2f'),[_0x7646('0x3f')])))['toString']();return _0x5d0654;}function insertTzCmHopperBlack(_0x113435,_0x4d1644,_0x3e2d5c,_0x40e522){var _0x1a1cb3=['cm_contacts.phone',_0x7646('0x29'),_0x7646('0x2a'),_0x4d1644+'.'+_0x40e522,'cm_contacts.createdAt',_0x7646('0x42')];return squel[_0x7646('0x43')]()[_0x7646('0x2e')](_0x7646('0x44'))[_0x7646('0x30')](['phone',_0x7646('0x32'),_0x7646('0x49'),_0x40e522,_0x7646('0x33'),'updatedAt'],squel[_0x7646('0xf')]()[_0x7646('0x38')](_0x1a1cb3)['from'](_0x4d1644)[_0x7646('0x13')]('cm_contacts',null,_0x7646('0x3a')+_0x4d1644+_0x7646('0x3b'))[_0x7646('0x13')](_0x3e2d5c,null,_0x3e2d5c+_0x7646('0x14')+_0x4d1644+'.'+_0x40e522)[_0x7646('0x15')](_0x4d1644+_0x7646('0x3c'),_0x113435)[_0x7646('0x15')](_0x7646('0x3d'),NOW)['where'](_0x7646('0x3e'),squel[_0x7646('0xf')]()[_0x7646('0x10')](_0x7646('0x11'))[_0x7646('0x12')](_0x7646('0x44'))[_0x7646('0x15')](_0x7646('0x45'),_0x113435)[_0x7646('0x15')](_0x40e522+_0x7646('0x16')+_0x4d1644+'.'+_0x40e522)))[_0x7646('0x46')]();}function insertCmHopperAdditionalPhones(_0x58c0b0){var _0x557164=[_0x7646('0x4a'),'cm_contact_has_items.item',_0x7646('0x4b'),_0x7646('0x4c'),_0x7646('0x4d')];return squel[_0x7646('0x43')]()[_0x7646('0x2e')](_0x7646('0x4e'))[_0x7646('0x30')](['CmHopperId',_0x7646('0x11'),_0x7646('0x4f'),'createdAt',_0x7646('0x34')],squel[_0x7646('0xf')]()[_0x7646('0x38')](_0x557164)['from'](_0x7646('0x2f'))[_0x7646('0x13')]('cm_contacts',null,_0x7646('0x50'))[_0x7646('0x13')](_0x7646('0x51'),null,_0x7646('0x52'))[_0x7646('0x15')](_0x7646('0x53'),_0x58c0b0)[_0x7646('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x7646('0x46')]();}function insertCmContact(_0x2695fe,_0x53c3f9,_0x3282bd,_0x4888dc){var _0x24b4ef=_[_0x7646('0x54')](_['keys'](_0x4888dc),[_0x7646('0x49'),'CompanyId',_0x7646('0x33'),_0x7646('0x34'),_0x7646('0x55')]);return squel[_0x7646('0x43')]()[_0x7646('0x2e')](_0x7646('0x39'))[_0x7646('0x30')](_0x24b4ef,squel[_0x7646('0xf')]()[_0x7646('0x38')](_0x24b4ef)[_0x7646('0x12')](_0x53c3f9)[_0x7646('0x15')]('('+_0x3282bd[_0x7646('0x13')](',')+_0x7646('0x56'),squel['select']()[_0x7646('0x38')](_0x3282bd)[_0x7646('0x12')](_0x7646('0x39'))[_0x7646('0x15')]('ListId\x20=\x20?',_0x2695fe)[_0x7646('0x15')](_0x7646('0x57')))[_0x7646('0x15')](_0x7646('0x58'),squel[_0x7646('0xf')]()[_0x7646('0x10')](_0x7646('0x59'),'min_id')[_0x7646('0x12')](_0x53c3f9)[_0x7646('0x5a')](_0x3282bd[_0x7646('0x13')](','))))['toString']();}function handleStop(){logger[_0x7646('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3adcbf){logger[_0x7646('0x5c')](_0x3adcbf['message']);process['exit'](0x1);}function handleError(_0x10ae77,_0x2e7731){stats[_0x7646('0x5d')][_0x7646('0x1c')]({'name':_0x2e7731[_0x7646('0x5e')],'message':_0x2e7731[_0x7646('0x5f')],'row':_0x10ae77});}function handleQuery(_0x5b4a0a){logger[_0x7646('0x5b')](_0x5b4a0a);return db['sequelize'][_0x7646('0x60')](_0x5b4a0a)['spread'](function(_0x71826f){results[_0x7646('0x1c')](_0x71826f);})['catch'](function(_0x967c7a){logger[_0x7646('0x5c')](_0x967c7a[_0x7646('0x5f')]);});}function updateTzCampaigns(_0x320091){return new Promise(function(_0x58990c,_0x13e22c){var _0xf24937=squel[_0x7646('0xf')]()['fields']([_0x7646('0x61'),'campaigns.dialTimezone'])[_0x7646('0x12')]('campaigns')[_0x7646('0x13')](_0x7646('0x62'),null,_0x7646('0x63'))[_0x7646('0x15')]('campaigns_has_cm_lists.CmListId='+_0x320091);db[_0x7646('0x64')]['query'](_0xf24937['toString']())[_0x7646('0x65')](function(_0xa3e424){var _0x4d6e59=[];for(var _0x525962=0x0;_0x525962<_0xa3e424[_0x7646('0x1f')];_0x525962++){_0x4d6e59[_0x7646('0x1c')](getTimezoneData(_0xa3e424[_0x525962],tmp_campaigns));}BPromise[_0x7646('0x1d')](_0x4d6e59)[_0x7646('0x1b')](function(){_0x58990c({'val':0x1});});})[_0x7646('0x66')](function(_0x42955e){logger[_0x7646('0x5c')](_0x42955e[_0x7646('0x5f')]);_0x58990c({'val':0x0});});});}function updateTzVoiceQueues(_0x1013e9){return new Promise(function(_0x5d35e5,_0x136137){var _0x23a1db=squel[_0x7646('0xf')]()[_0x7646('0x38')](['voice_queues.id','voice_queues.dialTimezone'])[_0x7646('0x12')](_0x7646('0x67'))['join'](_0x7646('0x68'),null,_0x7646('0x69'))[_0x7646('0x15')](_0x7646('0x6a')+_0x1013e9);db['sequelize'][_0x7646('0x60')](_0x23a1db[_0x7646('0x46')]())[_0x7646('0x65')](function(_0x1bd8cb){var _0x1a15ee=[];for(var _0x53c51c=0x0;_0x53c51c<_0x1bd8cb[_0x7646('0x1f')];_0x53c51c++){_0x1a15ee[_0x7646('0x1c')](getTimezoneData(_0x1bd8cb[_0x53c51c],tmp_voice_queues));}BPromise['all'](_0x1a15ee)[_0x7646('0x1b')](function(){_0x5d35e5({'val':0x1});});})[_0x7646('0x66')](function(_0x590297){logger[_0x7646('0x5c')](_0x590297[_0x7646('0x5f')]);_0x5d35e5({'val':0x0});});});}function getTimezoneData(_0x38321a,_0x47e689){return new Promise(function(_0x3bf6d8,_0x4f4c32){var _0x1f4db=shared[_0x7646('0x6b')];var _0x3c809e=_0x1f4db[_0x38321a[_0x7646('0x6c')]];if(_['isNil'](_0x3c809e)){_0x3bf6d8({'ret':0x1});}else{var _0x2ba259=_0x3c809e['utcOffset'];var _0x2309c7=squel[_0x7646('0x43')]()[_0x7646('0x2e')](_0x47e689)[_0x7646('0x6d')]('id',_0x38321a['id'])['set'](_0x7646('0x6e'),_0x2ba259)[_0x7646('0x6d')](_0x7646('0x6c'),_0x38321a['dialTimezone'])[_0x7646('0x46')]();return db['sequelize'][_0x7646('0x60')](_0x2309c7)[_0x7646('0x65')](function(_0x5a468c){_0x3bf6d8({'ret':0x1});})['catch'](function(_0x2c4c29){logger[_0x7646('0x5c')](_0x2c4c29['message']);_0x4f4c32({'ret':0x1});});}});}function handleTZQuery(_0x21a6a7){logger[_0x7646('0x5b')](_0x21a6a7);return db[_0x7646('0x64')][_0x7646('0x60')](_0x21a6a7)[_0x7646('0x65')](function(_0x1beffd){})[_0x7646('0x66')](function(_0x752d36){logger['error'](_0x752d36['message']);});}function main(_0x604b70,_0x18484e,_0x524a40,_0x376537){logger[_0x7646('0x5b')]('main',_0x604b70,JSON[_0x7646('0x6f')](_0x18484e));process[_0x7646('0x70')](_0x7646('0x71'));var _0x1887dc=_0x18484e['binding'];var _0x422857=_[_0x7646('0x72')](_0x1887dc);var _0x249335=_0x18484e[_0x7646('0x73')];var _0xf1f9c5=path[_0x7646('0x13')](config[_0x7646('0x74')],_0x7646('0x75'),_0x249335+_0x7646('0x76'));hasTZ=_['keys'](_0x1887dc)['includes'](_0x7646('0x6c'));var _0x8f29ee=_[_0x7646('0x77')](_0x1887dc)[_0x7646('0x13')]();logger[_0x7646('0x5b')](_0x7646('0x78'),_0x8f29ee);db[_0x7646('0x79')][_0x7646('0x19')]({'raw':!![],'attributes':['id',_0x7646('0x7a')]})[_0x7646('0x1b')](function(_0x1cd0fa){for(var _0x20e09f=0x0;_0x20e09f<_0x1cd0fa[_0x7646('0x1f')];_0x20e09f++){if(_0x1cd0fa[_0x20e09f][_0x7646('0x7a')]in _0x1887dc){contactItemTypes['push'](_0x1cd0fa[_0x20e09f]);delete _0x422857[_0x1cd0fa[_0x20e09f][_0x7646('0x7a')]];hasAdditionalPhones=!![];}for(var _0x165e0a in _0x1887dc){if(_0x1cd0fa[_0x20e09f][_0x7646('0x7a')]+_0x7646('0x7b')===_0x165e0a){phoneDescriptions['push']({'itemTypeId':_0x1cd0fa[_0x20e09f]['id'],'description':_0x165e0a});delete _0x422857[_0x165e0a];}}}if(hasAdditionalPhones)_0x422857['AdditionalPhones']='';var _0x121730=_[_0x7646('0x77')](_0x422857)[_0x7646('0x13')]();logger[_0x7646('0x5b')](_0x7646('0x78'),_0x121730);fs[_0x7646('0x7c')](_0xf1f9c5,_0x121730+'\x0a');Papa[_0x7646('0x7d')](fs[_0x7646('0x7e')](_0x604b70),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3facbe,_0xfc6f74){try{for(var _0x335dbf=0x0,_0x131e2e=[];_0x335dbf<_0x3facbe[_0x7646('0x7f')][_0x7646('0x1f')];_0x335dbf++){stats[_0x7646('0x80')]+=0x1;if(_0x3facbe[_0x7646('0x5d')][_0x335dbf]){handleError(_0x3facbe[_0x7646('0x7f')][_0x335dbf],_0x3facbe[_0x7646('0x5d')][_0x335dbf]);}else{var _0x50f51b=[];var _0x299705=[];var _0x48a13d={};for(var _0x103179 in _0x1887dc){let _0xeac64e=contactItemTypes[_0x7646('0x81')](_0x52aebc=>_0x52aebc['name']===_0x103179);let _0x180217=contactItemTypes[_0x7646('0x81')](_0x5c5b29=>_0x5c5b29[_0x7646('0x7a')]+_0x7646('0x7b')===_0x103179);if(_[_0x7646('0x20')](_0xeac64e)&&_[_0x7646('0x20')](_0x180217)){if(_0x1887dc[_0x7646('0x82')](_0x103179)){if(_0x3facbe[_0x7646('0x7f')][_0x335dbf][_0x1887dc[_0x103179]]){var _0x25e1cd=_[_0x7646('0x83')](_0x3facbe[_0x7646('0x7f')][_0x335dbf][_0x1887dc[_0x103179]]['replace'](/"/g,'\x27'));switch(_0x103179){case _0x7646('0x31'):var _0x5626e2=moment(_0x25e1cd,_0x7646('0x84'),!![]);if(_0x5626e2[_0x7646('0x85')]()){_0x131e2e[_0x7646('0x1c')]('\x22'+_0x25e1cd+'\x22');}else{_0x50f51b[_0x7646('0x1c')](_0x7646('0x86'));}break;case _0x7646('0x35'):var _0x18c422=parseInt(_0x25e1cd);_0x25e1cd=_[_0x7646('0x87')](_0x18c422)||_0x18c422<0x0||_0x18c422>0x4?_0x376537?0x3:0x2:_0x18c422;_0x131e2e['push']('\x22'+_0x25e1cd+'\x22');break;case _0x7646('0x36'):var _0x244610=parseInt(_0x25e1cd);if(_[_0x7646('0x88')](_0x244610)&&_['includes'](_0x524a40,_0x244610)){_0x131e2e[_0x7646('0x1c')]('\x22'+_0x244610+'\x22');}else{_0x50f51b['push'](_0x7646('0x89'));}break;case _0x7646('0x8a'):if(isEmail(_0x25e1cd)){_0x131e2e['push']('\x22'+_0x25e1cd+'\x22');}else{_0x50f51b[_0x7646('0x1c')](_0x7646('0x8b'));}break;case _0x7646('0x8c'):var _0x432c52=moment(_0x25e1cd,'YYYY-MM-DD',!![]);if(_0x432c52[_0x7646('0x85')]()){_0x131e2e[_0x7646('0x1c')]('\x22'+_0x25e1cd+'\x22');}else{_0x50f51b[_0x7646('0x1c')](_0x7646('0x8d'));}break;case'dialTimezone':var _0x3036c3=shared['timezones'];var _0x54573f=_0x3036c3[_0x25e1cd];if(!_[_0x7646('0x20')](_0x54573f)){var _0x198d19=_0x54573f[_0x7646('0x8e')];_0x131e2e[_0x7646('0x1c')]('\x22'+_0x25e1cd+'\x22');_0x131e2e['push']('\x22'+_0x198d19+'\x22');}break;default:_0x131e2e[_0x7646('0x1c')]('\x22'+_0x25e1cd+'\x22');}}else{switch(_0x103179){case _0x7646('0x8f'):case'phone':_0x50f51b[_0x7646('0x1c')](_0x103179+'\x20not\x20specified');break;default:_0x131e2e['push']('\x22\x22');}}}}else{var _0x160673='';if(!_[_0x7646('0x20')](_0xeac64e)){if(!_0x48a13d[_0x7646('0x82')](_0xeac64e['id'])){if(!_[_0x7646('0x20')](_0x3facbe['data'][_0x335dbf][_0x1887dc[_0x103179]])){var _0x25e1cd=_[_0x7646('0x83')](_0x3facbe[_0x7646('0x7f')][_0x335dbf][_0x1887dc[_0x103179]]['replace'](/"/g,'\x27'));var _0x1c8f0b=phoneDescriptions['find'](_0x52c0ca=>_0x52c0ca['itemTypeId']===_0xeac64e['id']);if(!_[_0x7646('0x20')](_0x1c8f0b)){var _0x1eb8c5=_[_0x7646('0x83')](_0x3facbe[_0x7646('0x7f')][_0x335dbf][_0x1887dc[_0x1c8f0b[_0x7646('0x90')]]][_0x7646('0x91')](/"/g,'\x27'));if(!_['isNil'](_0x1eb8c5))_0x25e1cd=_0x25e1cd+'§'+_0x1eb8c5;}if(_0x160673=='')_0x160673=_0x25e1cd;else _0x160673+='|'+_0x25e1cd;}_0x299705[_0x7646('0x1c')](_0xeac64e['id']+':'+_0x160673);_0x48a13d[_0xeac64e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x131e2e[_0x7646('0x1c')]('\x22'+_0x299705['join'](';')+'\x22');}if(_0x50f51b[_0x7646('0x1f')]){handleError(_0x3facbe[_0x7646('0x7f')][_0x335dbf],{'code':'SystemRow','message':_0x50f51b[_0x7646('0x13')]()});}else{fs[_0x7646('0x92')](_0xf1f9c5,_0x131e2e[_0x7646('0x13')]()+'\x0a');}_0x131e2e=[];}if(!(stats[_0x7646('0x80')]%0xc8)){socket['emit'](_0x7646('0x93')+_0x249335,stats);stats[_0x7646('0x5d')]=[];}}if(stopped){logger[_0x7646('0x5b')](_0x7646('0x94'));_0xfc6f74[_0x7646('0x95')]();}}catch(_0x1cbeaa){handleError(_0x3facbe[_0x7646('0x7f')][_0x335dbf],{'code':_0x7646('0x96'),'message':_0x1cbeaa[_0x7646('0x5f')]});logger[_0x7646('0x5c')](_0x7646('0x97'),_0x1cbeaa[_0x7646('0x5f')]);}},'complete':function(){try{var _0x4e43da=[];var _0x54400e=[];var _0x406f6f=_0x7646('0x39');if(_0x18484e[_0x7646('0x98')]&&_0x18484e['duplicates'][_0x7646('0x1f')]){_0x406f6f=_0x7646('0x99')+_0x249335;_0x4e43da[_0x7646('0x1c')](_0x7646('0x9a')+_0x406f6f+_0x7646('0x9b'));}tmp_campaigns=_0x7646('0x9c')+_0x249335;tmp_voice_queues=_0x7646('0x9d')+_0x249335;_0x54400e[_0x7646('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7646('0x9e'));_0x54400e[_0x7646('0x1c')](_0x7646('0x9a')+tmp_voice_queues+_0x7646('0x9e'));BPromise[_0x7646('0x9f')](_0x54400e,handleTZQuery)[_0x7646('0x1b')](function(_0x47512d){updateTzCampaigns(_0x18484e[_0x7646('0x49')])['then'](function(_0xe97a6c){updateTzVoiceQueues(_0x18484e[_0x7646('0x49')])['then'](function(_0x5a8826){if(hasTZ)_0x121730=_0x121730[_0x7646('0x91')](_0x7646('0x6c'),'dialTimezone,utcOffset');var _0xb953bc=util[_0x7646('0xa0')](_0x7646('0xa1'),_0xf1f9c5,_0x406f6f,_0x121730,_0x18484e['ListId'],_0x18484e[_0x7646('0xa2')]||null,NOW,NOW);if(_[_0x7646('0x20')](_0x1887dc[_0x7646('0x31')])){_0xb953bc+=',\x20scheduledAt\x20=\x20NOW()';}_0x4e43da['push'](_0xb953bc);if(_0x18484e[_0x7646('0x98')]&&_0x18484e[_0x7646('0x98')]['length']){_0x4e43da[_0x7646('0x1c')](insertCmContact(_0x18484e['ListId'],_0x406f6f,_0x18484e[_0x7646('0x98')],_0x1887dc));_0x4e43da[_0x7646('0x1c')](_0x7646('0xa3')+_0x406f6f+';');}BPromise[_0x7646('0x9f')](_0x4e43da,handleQuery)[_0x7646('0x1b')](function(_0x30708d){BPromise[_0x7646('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x4e43da=[];for(var _0x5c3d86=0x0;_0x5c3d86\x20\x20');}var _0x9f3bc2=path[_0x7646('0x13')](config['root'],_0x7646('0x75'),process[_0x7646('0xb0')][0x2]);if(!fs[_0x7646('0xb1')](_0x9f3bc2)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x33daf5={};try{_0x33daf5=JSON['parse'](process[_0x7646('0xb0')][0x3]);if(!_0x33daf5[_0x7646('0xb2')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x33daf5['binding'][_0x7646('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x33daf5['binding']['firstName']){throw new Error(_0x7646('0xb3'));}var _0x499050=0x0;if(_0x33daf5[_0x7646('0xb2')][_0x7646('0x36')]){_0x499050=0x1;}if(!_0x33daf5[_0x7646('0x49')]){throw new Error(_0x7646('0xb4'));}}catch(_0x5b1e91){throw new Error(_0x7646('0xb5'));}var _0x2b7d9e=[];try{_0x2b7d9e=_[_0x7646('0xb6')](JSON[_0x7646('0x7d')](process[_0x7646('0xb0')][0x4]),'id');}catch(_0x14b319){logger[_0x7646('0x5b')](_0x7646('0xb7'));}main(_0x9f3bc2,_0x33daf5,_0x2b7d9e,_0x499050);}validate();process['on'](_0x7646('0xb8'),handleStop);process['on'](_0x7646('0xb9'),handleUncaughtException); \ No newline at end of file +var _0xbd1d=['cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','select','fields','from','cm_contacts','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.updatedAt','into','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','UserId','recallme','\x22always\x22','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','error','message','exit','code','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists.CmListId=','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','utcOffset','set','offset','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','errors','find','_description','isNil','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','hasOwnProperty','appendFileSync','emit','contact:import:','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt'];(function(_0x552389,_0x1307d5){var _0xeeeac=function(_0x5231c1){while(--_0x5231c1){_0x552389['push'](_0x552389['shift']());}};_0xeeeac(++_0x1307d5);}(_0xbd1d,0x14c));var _0xdbd1=function(_0x1c8791,_0x17d51f){_0x1c8791=_0x1c8791-0x0;var _0x44e64c=_0xbd1d[_0x1c8791];return _0x44e64c;};'use strict';var fs=require('fs');var path=require(_0xdbd1('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xdbd1('0x1'));var BPromise=require(_0xdbd1('0x2'));var moment=require('moment');var squel=require(_0xdbd1('0x3'));var Redis=require(_0xdbd1('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xdbd1('0x5'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0xdbd1('0x6'));config[_0xdbd1('0x7')]=_[_0xdbd1('0x8')](config[_0xdbd1('0x7')],{'host':_0xdbd1('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbd1('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xdbd1('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xdbd1('0xa')](_0xdbd1('0xb'));function isEmail(_0x507bb0){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))*$/[_0xdbd1('0xc')](_0x507bb0);}function selectNotIn(_0x182fb7,_0x99f677,_0x4e0210,_0xc0fe9f,_0x57e3c5){return squel['select']()[_0xdbd1('0xd')](_0xdbd1('0xe'))['from'](_0xc0fe9f)[_0xdbd1('0xf')](_0x99f677,null,_0x99f677+'.id\x20=\x20'+_0xc0fe9f+'.'+_0x4e0210)[_0xdbd1('0x10')](_0xc0fe9f+'.'+_0x4e0210+_0xdbd1('0x11')+_0x182fb7+'.'+_0x4e0210)[_0xdbd1('0x10')](_0x99f677+_0xdbd1('0x12')+_0x57e3c5[_0xdbd1('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x585184,_0x2637ee){promisesAdditionalPhones=[];return db[_0xdbd1('0x13')][_0xdbd1('0x14')]({'raw':!![],'attributes':['id',_0xdbd1('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xdbd1('0x16')](function(_0x327e03){if(_0x327e03!==null){var _0x329e94=[];for(var _0x5bdab6=0x0;_0x5bdab6<_0x327e03[_0xdbd1('0x17')];_0x5bdab6++){var _0x4e0896=_0x327e03[_0x5bdab6];_0x329e94[_0xdbd1('0x18')](insertAdditionalPhones(_0x4e0896));}}Promise[_0xdbd1('0x19')](_0x329e94)[_0xdbd1('0x16')](function(){_0x585184({'val':0x1});});});});}function insertAdditionalPhones(_0xdeaa4c){return new Promise(function(_0x221c6b,_0x4f5d50){var _0x210f86=_0xdeaa4c[_0xdbd1('0x15')];var _0x5dd1a2=_0x210f86[_0xdbd1('0x1a')](';');var _0x537f18=[];orderBy=0x0;for(var _0x438514=0x0;_0x438514<_0x5dd1a2[_0xdbd1('0x17')];_0x438514++){_0x537f18[_0xdbd1('0x18')](splitAdditionalPhone(_0xdeaa4c['id'],_0x5dd1a2[_0x438514]));}Promise[_0xdbd1('0x19')](_0x537f18)[_0xdbd1('0x16')](function(){_0x221c6b({'val':_0x5dd1a2[_0xdbd1('0x17')]});});});}function splitAdditionalPhone(_0xfebda1,_0x1d8aa7){return new Promise(function(_0x143fa6,_0x390ed0){var _0x5f3b33=_0x1d8aa7[_0xdbd1('0x1a')](':');var _0x120d68=_0x5f3b33[0x0];var _0x353337=_0x5f3b33[0x1];if(!_['isNil'](_0x353337)){var _0x33360f=_0x353337[_0xdbd1('0x1a')]('|');var _0x5d794c=[];for(var _0x472537=0x0;_0x472537<_0x33360f['length'];_0x472537++){if(_0x33360f[_0x472537]!==''){var _0x4218f0=_['filter'](promisesAdditionalPhones,{'contactId':_0xfebda1,'phone':_0x33360f[_0x472537]});if(_0x4218f0[_0xdbd1('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0xdbd1('0x18')]({'contactId':_0xfebda1,'contactTypeId':_0x120d68,'phone':_0x33360f[_0x472537],'orderBy':orderBy});}}}_0x143fa6({'ok':0x1});}else _0x143fa6({'res':0x0});});}function createAdditionalPhone(_0x83e323,_0x8005a4,_0x3c3227,_0x456582){var _0x4a8ca2='';var _0x4862a2='';var _0x44d3f7=_0x3c3227['split']('§');_0x4a8ca2=_0x44d3f7[0x0];if(_0x44d3f7['length']==0x2)_0x4862a2=_0x44d3f7[0x1];return new Promise(function(_0x1e09f7,_0x3a2a3b){return db['CmContactHasItem'][_0xdbd1('0x1b')]({'where':{'CmContactId':_0x83e323,'item':_0x4a8ca2}})[_0xdbd1('0x16')](function(_0x3a6e0b){if(_0x3a6e0b){return db[_0xdbd1('0x1c')][_0xdbd1('0x1d')]({'ItemTypeId':_0x8005a4,'description':_0x4862a2,'OrderBy':_0x456582},{'where':{'CmContactId':_0x83e323,'item':_0x4a8ca2}})[_0xdbd1('0x16')](function(_0xa1c55d){_0x1e09f7({'res':_0xdbd1('0x1e')});});}else{return db['CmContactHasItem'][_0xdbd1('0x1f')]({'CmContactId':_0x83e323,'item':_0x4a8ca2,'description':_0x4862a2,'ItemTypeId':_0x8005a4,'OrderBy':_0x456582,'ItemClass':_0xdbd1('0x20')})[_0xdbd1('0x16')](function(_0x49b382){_0x1e09f7({'res':_0xdbd1('0x21')});});}});});}function insertCmHopper(_0x30b04b,_0x2fb7a2,_0x66df3b,_0xcb9f6f,_0x2427f2){var _0x5213f1=['cm_contacts.phone',_0xdbd1('0x22'),_0xdbd1('0x23'),_0xdbd1('0x24'),_0x2fb7a2+'.'+_0xcb9f6f,_0xdbd1('0x25'),'cm_contacts.updatedAt',_0xdbd1('0x26'),_0xdbd1('0x27'),'\x22'+_0x2427f2+'\x22'];return squel[_0xdbd1('0x28')]()['into'](_0xdbd1('0x29'))[_0xdbd1('0x2a')]([_0xdbd1('0xe'),'scheduledat',_0xdbd1('0x2b'),_0xdbd1('0x2c'),_0xcb9f6f,_0xdbd1('0x2d'),_0xdbd1('0x2e'),_0xdbd1('0x2f'),'UserId','recallme'],squel[_0xdbd1('0x30')]()[_0xdbd1('0x31')](_0x5213f1)[_0xdbd1('0x32')](_0x2fb7a2)[_0xdbd1('0xf')](_0xdbd1('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x2fb7a2+'.CmListId')[_0xdbd1('0xf')](_0x66df3b,null,_0x66df3b+_0xdbd1('0x34')+_0x2fb7a2+'.'+_0xcb9f6f)[_0xdbd1('0x10')](_0x2fb7a2+_0xdbd1('0x35'),_0x30b04b)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdbd1('0x10')](_0xdbd1('0x36'),selectNotIn(_0x2fb7a2,_0x66df3b,_0xcb9f6f,_0xdbd1('0x29'),['\x22always\x22',_0xdbd1('0x37')]))[_0xdbd1('0x10')](_0xdbd1('0x36'),selectNotIn(_0x2fb7a2,_0x66df3b,_0xcb9f6f,_0xdbd1('0x29'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x267bf6,_0x10599b,_0x81204e,_0x4b6316){var _0x56accd=[_0xdbd1('0x38'),_0xdbd1('0x23'),_0xdbd1('0x24'),_0x10599b+'.'+_0x4b6316,_0xdbd1('0x25'),_0xdbd1('0x39')];return squel[_0xdbd1('0x28')]()[_0xdbd1('0x3a')]('cm_hopper_black')[_0xdbd1('0x2a')](['phone','ContactId',_0xdbd1('0x2c'),_0x4b6316,'createdAt',_0xdbd1('0x2e')],squel[_0xdbd1('0x30')]()[_0xdbd1('0x31')](_0x56accd)[_0xdbd1('0x32')](_0x10599b)[_0xdbd1('0xf')]('cm_contacts',null,_0xdbd1('0x3b')+_0x10599b+_0xdbd1('0x3c'))[_0xdbd1('0xf')](_0x81204e,null,_0x81204e+_0xdbd1('0x34')+_0x10599b+'.'+_0x4b6316)[_0xdbd1('0x10')](_0x10599b+_0xdbd1('0x35'),_0x267bf6)[_0xdbd1('0x10')](_0xdbd1('0x3d'),NOW)[_0xdbd1('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xdbd1('0x30')]()['field']('phone')[_0xdbd1('0x32')](_0xdbd1('0x3e'))[_0xdbd1('0x10')]('ListId\x20=\x20?',_0x267bf6)['where'](_0x4b6316+_0xdbd1('0x11')+_0x10599b+'.'+_0x4b6316)))[_0xdbd1('0x3f')]();}function insertTzCmHopper(_0x2d057e,_0x2a6d3,_0x2281ed,_0x5b61d6,_0xa0d813,_0x435bee){var _0x5c06c5=[_0xdbd1('0x38'),_0xdbd1('0x40')+_0x435bee+_0xdbd1('0x41'),'cm_contacts.id','cm_contacts.ListId',_0x2a6d3+'.'+_0x5b61d6,_0xdbd1('0x25'),'cm_contacts.updatedAt',_0xdbd1('0x26'),'cm_contacts.UserId','\x22'+_0xa0d813+'\x22'];var _0x3a3220=squel[_0xdbd1('0x28')]()[_0xdbd1('0x3a')](_0xdbd1('0x29'))[_0xdbd1('0x2a')]([_0xdbd1('0xe'),_0xdbd1('0x42'),_0xdbd1('0x2b'),_0xdbd1('0x2c'),_0x5b61d6,_0xdbd1('0x2d'),_0xdbd1('0x2e'),_0xdbd1('0x2f'),_0xdbd1('0x43'),_0xdbd1('0x44')],squel[_0xdbd1('0x30')]()[_0xdbd1('0x31')](_0x5c06c5)['from'](_0x2a6d3)['join'](_0xdbd1('0x33'),null,_0xdbd1('0x3b')+_0x2a6d3+_0xdbd1('0x3c'))[_0xdbd1('0xf')](_0x2281ed,null,_0x2281ed+'.id\x20=\x20'+_0x2a6d3+'.'+_0x5b61d6)[_0xdbd1('0xf')](_0x435bee,null,_0x435bee+_0xdbd1('0x34')+_0x2a6d3+'.'+_0x5b61d6)[_0xdbd1('0x10')](_0x2a6d3+'.CmListId\x20=\x20?',_0x2d057e)[_0xdbd1('0x10')](_0xdbd1('0x3d'),NOW)[_0xdbd1('0x10')](_0xdbd1('0x36'),selectNotIn(_0x2a6d3,_0x2281ed,_0x5b61d6,_0xdbd1('0x29'),[_0xdbd1('0x45'),_0xdbd1('0x37')]))[_0xdbd1('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a6d3,_0x2281ed,_0x5b61d6,_0xdbd1('0x29'),[_0xdbd1('0x45')])))[_0xdbd1('0x3f')]();return _0x3a3220;}function insertTzCmHopperBlack(_0x23e694,_0x3c5178,_0x2ec026,_0x164ee7){var _0x4ab18f=[_0xdbd1('0x38'),'cm_contacts.id',_0xdbd1('0x24'),_0x3c5178+'.'+_0x164ee7,'cm_contacts.createdAt',_0xdbd1('0x39')];return squel[_0xdbd1('0x28')]()[_0xdbd1('0x3a')]('cm_hopper_black')[_0xdbd1('0x2a')](['phone',_0xdbd1('0x2b'),'ListId',_0x164ee7,_0xdbd1('0x2d'),_0xdbd1('0x2e')],squel[_0xdbd1('0x30')]()[_0xdbd1('0x31')](_0x4ab18f)[_0xdbd1('0x32')](_0x3c5178)[_0xdbd1('0xf')](_0xdbd1('0x33'),null,_0xdbd1('0x3b')+_0x3c5178+_0xdbd1('0x3c'))['join'](_0x2ec026,null,_0x2ec026+_0xdbd1('0x34')+_0x3c5178+'.'+_0x164ee7)[_0xdbd1('0x10')](_0x3c5178+_0xdbd1('0x35'),_0x23e694)[_0xdbd1('0x10')](_0xdbd1('0x3d'),NOW)[_0xdbd1('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xdbd1('0x30')]()['field'](_0xdbd1('0xe'))['from'](_0xdbd1('0x3e'))[_0xdbd1('0x10')](_0xdbd1('0x46'),_0x23e694)[_0xdbd1('0x10')](_0x164ee7+'\x20=\x20'+_0x3c5178+'.'+_0x164ee7)))[_0xdbd1('0x3f')]();}function insertCmHopperAdditionalPhones(_0x347f7a){var _0x1718f6=[_0xdbd1('0x47'),_0xdbd1('0x48'),'cm_contact_has_items.OrderBy',_0xdbd1('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0xdbd1('0x28')]()[_0xdbd1('0x3a')](_0xdbd1('0x4a'))['fromQuery']([_0xdbd1('0x4b'),_0xdbd1('0xe'),_0xdbd1('0x4c'),'createdAt',_0xdbd1('0x2e')],squel[_0xdbd1('0x30')]()[_0xdbd1('0x31')](_0x1718f6)[_0xdbd1('0x32')]('cm_hopper')[_0xdbd1('0xf')](_0xdbd1('0x33'),null,_0xdbd1('0x4d'))['join'](_0xdbd1('0x4e'),null,_0xdbd1('0x4f'))['where']('cm_hopper.ListId\x20=\x20?',_0x347f7a)[_0xdbd1('0x10')](_0xdbd1('0x3d'),NOW))['toString']();}function insertCmContact(_0x497108,_0x113ca3,_0x431e95,_0x11e5ba){var _0x518fff=_[_0xdbd1('0x50')](_[_0xdbd1('0x51')](_0x11e5ba),[_0xdbd1('0x2c'),_0xdbd1('0x52'),'createdAt',_0xdbd1('0x2e'),_0xdbd1('0x53')]);return squel[_0xdbd1('0x28')]()[_0xdbd1('0x3a')](_0xdbd1('0x33'))[_0xdbd1('0x2a')](_0x518fff,squel[_0xdbd1('0x30')]()['fields'](_0x518fff)[_0xdbd1('0x32')](_0x113ca3)[_0xdbd1('0x10')]('('+_0x431e95[_0xdbd1('0xf')](',')+_0xdbd1('0x54'),squel['select']()[_0xdbd1('0x31')](_0x431e95)[_0xdbd1('0x32')](_0xdbd1('0x33'))[_0xdbd1('0x10')](_0xdbd1('0x46'),_0x497108)[_0xdbd1('0x10')](_0xdbd1('0x55')))[_0xdbd1('0x10')](_0xdbd1('0x56'),squel[_0xdbd1('0x30')]()['field'](_0xdbd1('0x57'),_0xdbd1('0x58'))[_0xdbd1('0x32')](_0x113ca3)['group'](_0x431e95[_0xdbd1('0xf')](','))))['toString']();}function handleStop(){logger[_0xdbd1('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x221edc){logger[_0xdbd1('0x5a')](_0x221edc[_0xdbd1('0x5b')]);process[_0xdbd1('0x5c')](0x1);}function handleError(_0x23119f,_0xa694ae){stats['errors']['push']({'name':_0xa694ae[_0xdbd1('0x5d')],'message':_0xa694ae[_0xdbd1('0x5b')],'row':_0x23119f});}function handleQuery(_0x59c236){logger[_0xdbd1('0x59')](_0x59c236);return db[_0xdbd1('0x5e')][_0xdbd1('0x5f')](_0x59c236)[_0xdbd1('0x60')](function(_0x3b5c80){results[_0xdbd1('0x18')](_0x3b5c80);})['catch'](function(_0xadb703){logger['error'](_0xadb703[_0xdbd1('0x5b')]);});}function updateTzCampaigns(_0x613fcb){return new Promise(function(_0x2de4f1,_0x304db1){var _0x4a28db=squel[_0xdbd1('0x30')]()[_0xdbd1('0x31')]([_0xdbd1('0x61'),_0xdbd1('0x62')])['from'](_0xdbd1('0x63'))[_0xdbd1('0xf')]('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0xdbd1('0x64')+_0x613fcb);db[_0xdbd1('0x5e')][_0xdbd1('0x5f')](_0x4a28db[_0xdbd1('0x3f')]())[_0xdbd1('0x60')](function(_0x1e5f23){var _0x9765ed=[];for(var _0x206710=0x0;_0x206710<_0x1e5f23[_0xdbd1('0x17')];_0x206710++){_0x9765ed[_0xdbd1('0x18')](getTimezoneData(_0x1e5f23[_0x206710],tmp_campaigns));}BPromise[_0xdbd1('0x19')](_0x9765ed)['then'](function(){_0x2de4f1({'val':0x1});});})[_0xdbd1('0x65')](function(_0x8634f3){logger['error'](_0x8634f3['message']);_0x2de4f1({'val':0x0});});});}function updateTzVoiceQueues(_0x4a4571){return new Promise(function(_0x3bf2c0,_0x1dba24){var _0x2b8cc1=squel[_0xdbd1('0x30')]()[_0xdbd1('0x31')]([_0xdbd1('0x66'),_0xdbd1('0x67')])[_0xdbd1('0x32')](_0xdbd1('0x68'))['join'](_0xdbd1('0x69'),null,_0xdbd1('0x6a'))[_0xdbd1('0x10')](_0xdbd1('0x6b')+_0x4a4571);db[_0xdbd1('0x5e')][_0xdbd1('0x5f')](_0x2b8cc1[_0xdbd1('0x3f')]())[_0xdbd1('0x60')](function(_0x866f38){var _0x9ec8cc=[];for(var _0x32f296=0x0;_0x32f296<_0x866f38[_0xdbd1('0x17')];_0x32f296++){_0x9ec8cc['push'](getTimezoneData(_0x866f38[_0x32f296],tmp_voice_queues));}BPromise[_0xdbd1('0x19')](_0x9ec8cc)['then'](function(){_0x3bf2c0({'val':0x1});});})[_0xdbd1('0x65')](function(_0x263a1d){logger[_0xdbd1('0x5a')](_0x263a1d[_0xdbd1('0x5b')]);_0x3bf2c0({'val':0x0});});});}function getTimezoneData(_0x27ee10,_0x52dd19){return new Promise(function(_0x46191d,_0x485a52){var _0xcda96e=shared['timezones'];var _0x462666=_0xcda96e[_0x27ee10[_0xdbd1('0x6c')]];if(_['isNil'](_0x462666)){_0x46191d({'ret':0x1});}else{var _0x48bb3f=_0x462666[_0xdbd1('0x6d')];var _0x496820=squel['insert']()[_0xdbd1('0x3a')](_0x52dd19)[_0xdbd1('0x6e')]('id',_0x27ee10['id'])[_0xdbd1('0x6e')](_0xdbd1('0x6f'),_0x48bb3f)['set'](_0xdbd1('0x6c'),_0x27ee10[_0xdbd1('0x6c')])[_0xdbd1('0x3f')]();return db[_0xdbd1('0x5e')][_0xdbd1('0x5f')](_0x496820)[_0xdbd1('0x60')](function(_0x21b116){_0x46191d({'ret':0x1});})[_0xdbd1('0x65')](function(_0xdf8773){logger['error'](_0xdf8773[_0xdbd1('0x5b')]);_0x485a52({'ret':0x1});});}});}function handleTZQuery(_0x431a2a){logger[_0xdbd1('0x59')](_0x431a2a);return db[_0xdbd1('0x5e')][_0xdbd1('0x5f')](_0x431a2a)[_0xdbd1('0x60')](function(_0x53c42d){})[_0xdbd1('0x65')](function(_0x28958e){logger['error'](_0x28958e[_0xdbd1('0x5b')]);});}function main(_0x1538c0,_0x2a5dc6,_0x2e1e8a,_0x347875){logger[_0xdbd1('0x59')]('main',_0x1538c0,JSON['stringify'](_0x2a5dc6));process['send'](_0xdbd1('0x70'));var _0x4cc80f=_0x2a5dc6[_0xdbd1('0x71')];var _0x5bfc66=_['clone'](_0x4cc80f);var _0x177ad2=_0x2a5dc6[_0xdbd1('0x72')];var _0x5c3f4d=path[_0xdbd1('0xf')](config[_0xdbd1('0x73')],_0xdbd1('0x74'),_0x177ad2+_0xdbd1('0x75'));hasTZ=_[_0xdbd1('0x51')](_0x4cc80f)[_0xdbd1('0x76')](_0xdbd1('0x6c'));var _0x99700b=_['keys'](_0x4cc80f)[_0xdbd1('0xf')]();logger[_0xdbd1('0x59')](_0xdbd1('0x77'),_0x99700b);db[_0xdbd1('0x78')][_0xdbd1('0x14')]({'raw':!![],'attributes':['id','name']})[_0xdbd1('0x16')](function(_0x5e458c){for(var _0xbebaa3=0x0;_0xbebaa3<_0x5e458c[_0xdbd1('0x17')];_0xbebaa3++){if(_0x5e458c[_0xbebaa3][_0xdbd1('0x79')]in _0x4cc80f){contactItemTypes['push'](_0x5e458c[_0xbebaa3]);delete _0x5bfc66[_0x5e458c[_0xbebaa3][_0xdbd1('0x79')]];hasAdditionalPhones=!![];}for(var _0x2e25de in _0x4cc80f){if(_0x5e458c[_0xbebaa3]['name']+'_description'===_0x2e25de){phoneDescriptions['push']({'itemTypeId':_0x5e458c[_0xbebaa3]['id'],'description':_0x2e25de});delete _0x5bfc66[_0x2e25de];}}}if(hasAdditionalPhones)_0x5bfc66['AdditionalPhones']='';var _0x132138=_['keys'](_0x5bfc66)[_0xdbd1('0xf')]();logger[_0xdbd1('0x59')](_0xdbd1('0x77'),_0x132138);fs[_0xdbd1('0x7a')](_0x5c3f4d,_0x132138+'\x0a');Papa[_0xdbd1('0x7b')](fs[_0xdbd1('0x7c')](_0x1538c0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x584bac,_0x4bd1a0){try{for(var _0x22479f=0x0,_0x3a9967=[];_0x22479f<_0x584bac[_0xdbd1('0x7d')][_0xdbd1('0x17')];_0x22479f++){stats[_0xdbd1('0x7e')]+=0x1;if(_0x584bac['errors'][_0x22479f]){handleError(_0x584bac[_0xdbd1('0x7d')][_0x22479f],_0x584bac[_0xdbd1('0x7f')][_0x22479f]);}else{var _0x4c8338=[];var _0x43d535=[];var _0x54c3b2={};for(var _0x4ceb88 in _0x4cc80f){let _0x22b8a8=contactItemTypes['find'](_0x1bfc41=>_0x1bfc41[_0xdbd1('0x79')]===_0x4ceb88);let _0x1121c3=contactItemTypes[_0xdbd1('0x80')](_0x4d0b9d=>_0x4d0b9d[_0xdbd1('0x79')]+_0xdbd1('0x81')===_0x4ceb88);if(_[_0xdbd1('0x82')](_0x22b8a8)&&_[_0xdbd1('0x82')](_0x1121c3)){if(_0x4cc80f['hasOwnProperty'](_0x4ceb88)){if(_0x584bac[_0xdbd1('0x7d')][_0x22479f][_0x4cc80f[_0x4ceb88]]){var _0x3392fd=_[_0xdbd1('0x83')](_0x584bac[_0xdbd1('0x7d')][_0x22479f][_0x4cc80f[_0x4ceb88]][_0xdbd1('0x84')](/"/g,'\x27'));switch(_0x4ceb88){case _0xdbd1('0x42'):var _0x10aa71=moment(_0x3392fd,_0xdbd1('0xb'),!![]);if(_0x10aa71[_0xdbd1('0x85')]()){_0x3a9967['push']('\x22'+_0x3392fd+'\x22');}else{_0x4c8338[_0xdbd1('0x18')](_0xdbd1('0x86'));}break;case _0xdbd1('0x2f'):var _0x46f6a8=parseInt(_0x3392fd);_0x3392fd=_[_0xdbd1('0x87')](_0x46f6a8)||_0x46f6a8<0x0||_0x46f6a8>0x4?_0x347875?0x3:0x2:_0x46f6a8;_0x3a9967[_0xdbd1('0x18')]('\x22'+_0x3392fd+'\x22');break;case _0xdbd1('0x43'):var _0x1ae68e=parseInt(_0x3392fd);if(_[_0xdbd1('0x88')](_0x1ae68e)&&_['includes'](_0x2e1e8a,_0x1ae68e)){_0x3a9967[_0xdbd1('0x18')]('\x22'+_0x1ae68e+'\x22');}else{_0x4c8338['push'](_0xdbd1('0x89'));}break;case _0xdbd1('0x8a'):if(isEmail(_0x3392fd)){_0x3a9967[_0xdbd1('0x18')]('\x22'+_0x3392fd+'\x22');}else{_0x4c8338[_0xdbd1('0x18')](_0xdbd1('0x8b'));}break;case _0xdbd1('0x8c'):var _0xae8cc9=moment(_0x3392fd,_0xdbd1('0x8d'),!![]);if(_0xae8cc9[_0xdbd1('0x85')]()){_0x3a9967[_0xdbd1('0x18')]('\x22'+_0x3392fd+'\x22');}else{_0x4c8338[_0xdbd1('0x18')](_0xdbd1('0x8e'));}break;case'dialTimezone':var _0x461263=shared[_0xdbd1('0x8f')];var _0x59a65c=_0x461263[_0x3392fd];if(!_[_0xdbd1('0x82')](_0x59a65c)){var _0x3f6052=_0x59a65c[_0xdbd1('0x6d')];_0x3a9967[_0xdbd1('0x18')]('\x22'+_0x3392fd+'\x22');_0x3a9967[_0xdbd1('0x18')]('\x22'+_0x3f6052+'\x22');}break;default:_0x3a9967['push']('\x22'+_0x3392fd+'\x22');}}else{switch(_0x4ceb88){case _0xdbd1('0x90'):case _0xdbd1('0xe'):_0x4c8338[_0xdbd1('0x18')](_0x4ceb88+_0xdbd1('0x91'));break;default:_0x3a9967[_0xdbd1('0x18')]('\x22\x22');}}}}else{var _0x5a77d6='';if(!_[_0xdbd1('0x82')](_0x22b8a8)){if(!_0x54c3b2[_0xdbd1('0x92')](_0x22b8a8['id'])){if(!_[_0xdbd1('0x82')](_0x584bac[_0xdbd1('0x7d')][_0x22479f][_0x4cc80f[_0x4ceb88]])){var _0x3392fd=_[_0xdbd1('0x83')](_0x584bac['data'][_0x22479f][_0x4cc80f[_0x4ceb88]]['replace'](/"/g,'\x27'));var _0x1a5112=phoneDescriptions[_0xdbd1('0x80')](_0x2e54d3=>_0x2e54d3['itemTypeId']===_0x22b8a8['id']);if(!_[_0xdbd1('0x82')](_0x1a5112)){var _0x555ecd=_[_0xdbd1('0x83')](_0x584bac[_0xdbd1('0x7d')][_0x22479f][_0x4cc80f[_0x1a5112['description']]][_0xdbd1('0x84')](/"/g,'\x27'));if(!_['isNil'](_0x555ecd))_0x3392fd=_0x3392fd+'§'+_0x555ecd;}if(_0x5a77d6=='')_0x5a77d6=_0x3392fd;else _0x5a77d6+='|'+_0x3392fd;}_0x43d535['push'](_0x22b8a8['id']+':'+_0x5a77d6);_0x54c3b2[_0x22b8a8['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3a9967[_0xdbd1('0x18')]('\x22'+_0x43d535['join'](';')+'\x22');}if(_0x4c8338['length']){handleError(_0x584bac[_0xdbd1('0x7d')][_0x22479f],{'code':'SystemRow','message':_0x4c8338[_0xdbd1('0xf')]()});}else{fs[_0xdbd1('0x93')](_0x5c3f4d,_0x3a9967[_0xdbd1('0xf')]()+'\x0a');}_0x3a9967=[];}if(!(stats[_0xdbd1('0x7e')]%0xc8)){socket[_0xdbd1('0x94')](_0xdbd1('0x95')+_0x177ad2,stats);stats['errors']=[];}}if(stopped){logger['info']('Abort\x20parser');_0x4bd1a0[_0xdbd1('0x96')]();}}catch(_0x3349e1){handleError(_0x584bac['data'][_0x22479f],{'code':_0xdbd1('0x97'),'message':_0x3349e1['message']});logger[_0xdbd1('0x5a')]('step',_0x3349e1[_0xdbd1('0x5b')]);}},'complete':function(){try{var _0x1a4a2f=[];var _0x35cb4f=[];var _0x2e7de8=_0xdbd1('0x33');if(_0x2a5dc6[_0xdbd1('0x98')]&&_0x2a5dc6[_0xdbd1('0x98')][_0xdbd1('0x17')]){_0x2e7de8=_0xdbd1('0x99')+_0x177ad2;_0x1a4a2f[_0xdbd1('0x18')](_0xdbd1('0x9a')+_0x2e7de8+_0xdbd1('0x9b'));}tmp_campaigns=_0xdbd1('0x9c')+_0x177ad2;tmp_voice_queues=_0xdbd1('0x9d')+_0x177ad2;_0x35cb4f[_0xdbd1('0x18')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xdbd1('0x9e'));_0x35cb4f['push'](_0xdbd1('0x9a')+tmp_voice_queues+_0xdbd1('0x9e'));BPromise[_0xdbd1('0x9f')](_0x35cb4f,handleTZQuery)[_0xdbd1('0x16')](function(_0x4ed594){updateTzCampaigns(_0x2a5dc6[_0xdbd1('0x2c')])[_0xdbd1('0x16')](function(_0x233241){updateTzVoiceQueues(_0x2a5dc6[_0xdbd1('0x2c')])[_0xdbd1('0x16')](function(_0x1aba22){if(hasTZ)_0x132138=_0x132138[_0xdbd1('0x84')]('dialTimezone',_0xdbd1('0xa0'));var _0x532263=util[_0xdbd1('0xa')](_0xdbd1('0xa1'),_0x5c3f4d,_0x2e7de8,_0x132138,_0x2a5dc6[_0xdbd1('0x2c')],_0x2a5dc6[_0xdbd1('0x52')]||null,NOW,NOW);if(_[_0xdbd1('0x82')](_0x4cc80f[_0xdbd1('0x42')])){_0x532263+=_0xdbd1('0xa2');}_0x1a4a2f[_0xdbd1('0x18')](_0x532263);if(_0x2a5dc6[_0xdbd1('0x98')]&&_0x2a5dc6[_0xdbd1('0x98')][_0xdbd1('0x17')]){_0x1a4a2f[_0xdbd1('0x18')](insertCmContact(_0x2a5dc6[_0xdbd1('0x2c')],_0x2e7de8,_0x2a5dc6[_0xdbd1('0x98')],_0x4cc80f));_0x1a4a2f['push'](_0xdbd1('0xa3')+_0x2e7de8+';');}BPromise[_0xdbd1('0x9f')](_0x1a4a2f,handleQuery)[_0xdbd1('0x16')](function(_0x255de2){BPromise['all']([handleAdditionalPhones()])[_0xdbd1('0x16')](function(){_0x1a4a2f=[];for(var _0x30a4c4=0x0;_0x30a4c4\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','spread','length','isNil','push','all','catch','error','AdditionalPhones','split','filter','CmContactHasItem','then','update','inserted','CmContact','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f75,0x71));var _0x56f7=function(_0x483a3b,_0x5fd1bf){_0x483a3b=_0x483a3b-0x0;var _0x16fe1c=_0x6f75[_0x483a3b];return _0x16fe1c;};'use strict';var fs=require('fs');var path=require(_0x56f7('0x0'));var _=require(_0x56f7('0x1'));var Papa=require(_0x56f7('0x2'));var util=require(_0x56f7('0x3'));var BPromise=require(_0x56f7('0x4'));var moment=require(_0x56f7('0x5'));var squel=require(_0x56f7('0x6'));var Redis=require('ioredis');var db=require(_0x56f7('0x7'))['db'];var config=require(_0x56f7('0x8'));var logger=require(_0x56f7('0x9'))('import');config['redis']=_['defaults'](config[_0x56f7('0xa')],{'host':_0x56f7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56f7('0xa')]));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']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x56f7('0xc')+moment()[_0x56f7('0xd')](_0x56f7('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3887c2){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))*$/[_0x56f7('0xf')](_0x3887c2);}function selectNotIn(_0x1ae37d,_0x2f6386,_0x28d9fe,_0x394a5a,_0x11dedc){return squel[_0x56f7('0x10')]()[_0x56f7('0x11')](_0x56f7('0x12'))[_0x56f7('0x13')](_0x394a5a)['join'](_0x2f6386,null,_0x2f6386+_0x56f7('0x14')+_0x394a5a+'.'+_0x28d9fe)[_0x56f7('0x15')](_0x394a5a+'.'+_0x28d9fe+_0x56f7('0x16')+_0x1ae37d+'.'+_0x28d9fe)[_0x56f7('0x15')](_0x2f6386+_0x56f7('0x17')+_0x11dedc[_0x56f7('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1616d9,_0xdac70a){promisesAdditionalPhones=[];promisesContact=[];return db[_0x56f7('0x19')]['query']('select\x20*\x20from\x20'+tempTableName)[_0x56f7('0x1a')](function(_0x26c83a){if(_0x26c83a!==null){var _0x436a07=[];for(var _0x2a3713=0x0;_0x2a3713<_0x26c83a[_0x56f7('0x1b')];_0x2a3713++){var _0x156136=_0x26c83a[_0x2a3713];if(!_['isNil'](_0x156136[_0x56f7('0x12')])){if(!_[_0x56f7('0x1c')](_0x156136['AdditionalPhones']))_0x436a07['push'](insertAdditionalPhones(_0x156136));promisesContact[_0x56f7('0x1d')]({'contact':_0x156136});}}}Promise[_0x56f7('0x1e')](_0x436a07)['then'](function(){_0x1616d9({'val':0x1});});})[_0x56f7('0x1f')](function(_0x18fc2a){logger[_0x56f7('0x20')](_0x18fc2a['message']);});});}function insertAdditionalPhones(_0x5a944d){return new Promise(function(_0x5cf936,_0x17ec96){var _0x3602ee=_0x5a944d[_0x56f7('0x21')];if(_[_0x56f7('0x1c')](_0x3602ee))_0x17ec96({'val':0x0});else{var _0x476dd8=_0x3602ee[_0x56f7('0x22')](';');var _0x4ea835=[];orderBy=0x0;for(var _0x4a9fed=0x0;_0x4a9fed<_0x476dd8[_0x56f7('0x1b')];_0x4a9fed++){_0x4ea835[_0x56f7('0x1d')](splitAdditionalPhone(_0x5a944d['id'],_0x476dd8[_0x4a9fed]));}Promise[_0x56f7('0x1e')](_0x4ea835)['then'](function(){_0x5cf936({'val':_0x476dd8[_0x56f7('0x1b')]});});}});}function splitAdditionalPhone(_0x675b5a,_0x21e322){return new Promise(function(_0x101836,_0x3e06b4){var _0x443db4=_0x21e322[_0x56f7('0x22')](':');var _0x30cc36=_0x443db4[0x0];var _0x243611=_0x443db4[0x1];if(_0x243611!==''){var _0x3db61f=_0x243611[_0x56f7('0x22')]('|');var _0x4d6db4=[];for(var _0x1b5267=0x0;_0x1b5267<_0x3db61f[_0x56f7('0x1b')];_0x1b5267++){if(_0x3db61f[_0x1b5267]!==''){var _0x584590=_[_0x56f7('0x23')](promisesAdditionalPhones,{'contactId':_0x675b5a,'phone':_0x3db61f[_0x1b5267]});if(_0x584590[_0x56f7('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x56f7('0x1d')]({'contactId':_0x675b5a,'contactTypeId':_0x30cc36,'phone':_0x3db61f[_0x1b5267],'orderBy':orderBy});}}}_0x101836({'ok':0x1});}else _0x101836({'res':0x0});});}function createAdditionalPhone(_0x3b12c3,_0x345684,_0x1712fb,_0x72fbcb){var _0x1657de='';var _0x4c59a0='';var _0x306d8b=_0x1712fb[_0x56f7('0x22')]('§');_0x1657de=_0x306d8b[0x0];if(_0x306d8b['length']==0x2)_0x4c59a0=_0x306d8b[0x1];return new Promise(function(_0x481805,_0x47699e){return db[_0x56f7('0x24')]['findOne']({'where':{'CmContactId':_0x3b12c3,'item':_0x1657de}})[_0x56f7('0x25')](function(_0x1bd0c2){if(_0x1bd0c2){return db[_0x56f7('0x24')][_0x56f7('0x26')]({'ItemTypeId':_0x345684,'description':_0x4c59a0,'OrderBy':_0x72fbcb},{'where':{'CmContactId':_0x3b12c3,'item':_0x1657de}})['then'](function(_0x4a2be0){_0x481805({'res':'updated'});});}else{return db[_0x56f7('0x24')]['create']({'CmContactId':_0x3b12c3,'item':_0x1657de,'ItemTypeId':_0x345684,'description':_0x4c59a0,'OrderBy':_0x72fbcb,'ItemClass':'PHONE'})['then'](function(_0x18d2f7){_0x481805({'res':_0x56f7('0x27')});});}});});}function updateContact(_0x3c4efa){return new Promise(function(_0x3a2759,_0x5e051c){var _0x2b021c=_0x3c4efa['id'];delete _0x3c4efa['id'];return db[_0x56f7('0x28')][_0x56f7('0x26')](_0x3c4efa,{'where':{'id':_0x2b021c}})[_0x56f7('0x25')](function(_0x407a79){updatedRows+=0x1;return db['CmHopper'][_0x56f7('0x26')]({'phone':_0x3c4efa['phone']},{'where':{'ContactId':_0x2b021c}})[_0x56f7('0x25')](function(_0x4cb06b){_0x3a2759({'ret':'OK'});});});});}function insertCmHopper(_0x48ff44,_0x2a62a2,_0x4148f4,_0x275176,_0x1a254e){var _0x903324=[_0x56f7('0x29'),'cm_contacts.scheduledat',_0x56f7('0x2a'),_0x56f7('0x2b'),_0x2a62a2+'.'+_0x275176,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x56f7('0x2c'),_0x56f7('0x2d'),'\x22'+_0x1a254e+'\x22'];return squel[_0x56f7('0x2e')]()['into'](_0x56f7('0x2f'))[_0x56f7('0x30')]([_0x56f7('0x12'),_0x56f7('0x31'),'ContactId',_0x56f7('0x32'),_0x275176,_0x56f7('0x33'),_0x56f7('0x34'),_0x56f7('0x35'),_0x56f7('0x36'),_0x56f7('0x37')],squel['select']()[_0x56f7('0x38')](_0x903324)[_0x56f7('0x13')](_0x2a62a2)[_0x56f7('0x18')](_0x56f7('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x2a62a2+_0x56f7('0x3a'))[_0x56f7('0x18')](_0x4148f4,null,_0x4148f4+_0x56f7('0x14')+_0x2a62a2+'.'+_0x275176)['where'](_0x2a62a2+'.CmListId\x20=\x20?',_0x48ff44)['where'](_0x56f7('0x3b'),NOW)[_0x56f7('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a62a2,_0x4148f4,_0x275176,'cm_hopper',[_0x56f7('0x3c'),_0x56f7('0x3d')]))[_0x56f7('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a62a2,_0x4148f4,_0x275176,'cm_hopper',[_0x56f7('0x3c')])))['toString']();}function insertCmHopperBlack(_0x16bc96,_0x5bc667,_0x1f0d1d,_0x4e8e56){var _0xbb2154=[_0x56f7('0x29'),_0x56f7('0x2a'),_0x56f7('0x2b'),_0x5bc667+'.'+_0x4e8e56,_0x56f7('0x3e'),_0x56f7('0x3f')];return squel['insert']()[_0x56f7('0x40')](_0x56f7('0x41'))[_0x56f7('0x30')](['phone',_0x56f7('0x42'),'ListId',_0x4e8e56,_0x56f7('0x33'),_0x56f7('0x34')],squel['select']()[_0x56f7('0x38')](_0xbb2154)[_0x56f7('0x13')](_0x5bc667)[_0x56f7('0x18')](_0x56f7('0x39'),null,_0x56f7('0x43')+_0x5bc667+'.CmListId')[_0x56f7('0x18')](_0x1f0d1d,null,_0x1f0d1d+'.id\x20=\x20'+_0x5bc667+'.'+_0x4e8e56)[_0x56f7('0x15')](_0x5bc667+'.CmListId\x20=\x20?',_0x16bc96)[_0x56f7('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x56f7('0x15')](_0x56f7('0x44'),squel[_0x56f7('0x10')]()['field']('phone')[_0x56f7('0x13')](_0x56f7('0x41'))['where'](_0x56f7('0x45'),_0x16bc96)['where'](_0x4e8e56+_0x56f7('0x46'),_0x5bc667+'.'+_0x4e8e56)))['toString']();}function insertCmHopperAdditionalPhones(_0x5bc884){var _0x9bbdd0=[_0x56f7('0x47'),'cm_contact_has_items.item',_0x56f7('0x48'),_0x56f7('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x56f7('0x2e')]()['into'](_0x56f7('0x4a'))[_0x56f7('0x30')]([_0x56f7('0x4b'),_0x56f7('0x12'),_0x56f7('0x4c'),'createdAt',_0x56f7('0x34')],squel[_0x56f7('0x10')]()[_0x56f7('0x38')](_0x9bbdd0)['from'](_0x56f7('0x2f'))[_0x56f7('0x18')]('cm_contacts',null,_0x56f7('0x4d'))[_0x56f7('0x18')](_0x56f7('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x56f7('0x15')](_0x56f7('0x4f'),_0x5bc884)[_0x56f7('0x15')](_0x56f7('0x3b'),NOW))['toString']();}function insertCmContact(_0x4a8a65,_0x166f9c,_0x5929cf,_0x4df870){var _0x2d44d8=_[_0x56f7('0x50')](_['keys'](_0x4df870),['ListId',_0x56f7('0x51'),_0x56f7('0x33'),_0x56f7('0x34')]);return squel[_0x56f7('0x2e')]()[_0x56f7('0x40')](_0x56f7('0x39'))['fromQuery'](_0x2d44d8,squel['select']()[_0x56f7('0x38')](_0x2d44d8)[_0x56f7('0x13')](_0x166f9c)[_0x56f7('0x15')]('('+_0x5929cf[_0x56f7('0x18')](',')+_0x56f7('0x52'),squel[_0x56f7('0x10')]()[_0x56f7('0x38')](_0x5929cf)['from'](_0x56f7('0x39'))[_0x56f7('0x15')](_0x56f7('0x45'),_0x4a8a65))[_0x56f7('0x15')](_0x56f7('0x53'),squel[_0x56f7('0x10')]()['field']('MIN(id)',_0x56f7('0x54'))[_0x56f7('0x13')](_0x166f9c)['group'](_0x5929cf[_0x56f7('0x18')](','))))[_0x56f7('0x55')]();}function handleStop(){logger['info'](_0x56f7('0x56'));stopped=!![];}function handleUncaughtException(_0x19df90){logger[_0x56f7('0x20')](_0x19df90[_0x56f7('0x57')]);process[_0x56f7('0x58')](0x1);}function handleError(_0x1a5e91,_0x2a2e08){stats[_0x56f7('0x59')]['push']({'name':_0x2a2e08[_0x56f7('0x5a')],'message':_0x2a2e08[_0x56f7('0x57')],'row':_0x1a5e91});}function handleQuery(_0x20c0b8){logger['info'](_0x20c0b8);return db[_0x56f7('0x19')]['query'](_0x20c0b8)[_0x56f7('0x1a')](function(_0x478e08){results[_0x56f7('0x1d')](_0x478e08);})[_0x56f7('0x1f')](function(_0x3818d6){logger[_0x56f7('0x20')](_0x3818d6['message']);});}function main(_0x3c7139,_0xdb8bce,_0x37da8b,_0x5aaa25){logger[_0x56f7('0x5b')](_0x56f7('0x5c'),_0x3c7139,JSON[_0x56f7('0x5d')](_0xdb8bce));process[_0x56f7('0x5e')]('start');var _0x23db44=_0xdb8bce[_0x56f7('0x5f')];var _0x45372a=_[_0x56f7('0x60')](_0x23db44);var _0x121c31=_0xdb8bce[_0x56f7('0x61')];var _0x24dcbc=path['join'](config[_0x56f7('0x62')],_0x56f7('0x63'),_0x121c31+_0x56f7('0x64'));logger['info'](_0x56f7('0x65'),_0xdb8bce);db[_0x56f7('0x66')][_0x56f7('0x67')]({'raw':!![],'attributes':['id',_0x56f7('0x68')]})[_0x56f7('0x25')](function(_0x139c4e){for(var _0x2dd6c3=0x0;_0x2dd6c3<_0x139c4e[_0x56f7('0x1b')];_0x2dd6c3++){if(_0x139c4e[_0x2dd6c3][_0x56f7('0x68')]in _0x23db44){contactItemTypes[_0x56f7('0x1d')](_0x139c4e[_0x2dd6c3]);delete _0x45372a[_0x139c4e[_0x2dd6c3]['name']];hasAdditionalPhones=!![];}for(var _0x2788d7 in _0x23db44){if(_0x139c4e[_0x2dd6c3][_0x56f7('0x68')]+_0x56f7('0x69')===_0x2788d7){phoneDescriptions[_0x56f7('0x1d')]({'itemTypeId':_0x139c4e[_0x2dd6c3]['id'],'description':_0x2788d7});delete _0x45372a[_0x2788d7];}}}if(hasAdditionalPhones)_0x45372a['AdditionalPhones']='';var _0xf269ed=_[_0x56f7('0x6a')](_0x45372a)[_0x56f7('0x18')]();logger[_0x56f7('0x5b')](_0x56f7('0x6b'),_0xf269ed);fs['writeFileSync'](_0x24dcbc,_0xf269ed+'\x0a');Papa[_0x56f7('0x6c')](fs[_0x56f7('0x6d')](_0x3c7139),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b0abf,_0x330973){try{for(var _0x3d6e23=0x0,_0x223a1b=[];_0x3d6e23<_0x5b0abf[_0x56f7('0x6e')]['length'];_0x3d6e23++){stats[_0x56f7('0x6f')]+=0x1;if(_0x5b0abf[_0x56f7('0x59')][_0x3d6e23]){handleError(_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23],_0x5b0abf['errors'][_0x3d6e23]);}else{var _0x525041=[];var _0x95e360=[];var _0x2ec701={};for(var _0x4b07ff in _0x23db44){let _0x1e71d3=contactItemTypes[_0x56f7('0x70')](_0x27a98f=>_0x27a98f[_0x56f7('0x68')]===_0x4b07ff);let _0x2ff2f2=contactItemTypes[_0x56f7('0x70')](_0x2f0f2e=>_0x2f0f2e[_0x56f7('0x68')]+'_description'===_0x4b07ff);if(_[_0x56f7('0x1c')](_0x1e71d3)&&_[_0x56f7('0x1c')](_0x2ff2f2)){if(_0x23db44['hasOwnProperty'](_0x4b07ff)){if(_0x5b0abf['data'][_0x3d6e23][_0x23db44[_0x4b07ff]]){var _0x33631a=_[_0x56f7('0x71')](_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23][_0x23db44[_0x4b07ff]]['replace'](/"/g,'\x27'));switch(_0x4b07ff){case'scheduledat':var _0x47b62b=moment(_0x33631a,_0x56f7('0x72'),!![]);if(_0x47b62b['isValid']()){_0x223a1b['push']('\x22'+_0x33631a+'\x22');}else{_0x525041['push'](_0x56f7('0x73'));}break;case _0x56f7('0x35'):var _0x26b935=parseInt(_0x33631a);_0x33631a=_[_0x56f7('0x74')](_0x26b935)||_0x26b935<0x0||_0x26b935>0x4?_0x5aaa25?0x3:0x2:_0x26b935;_0x223a1b['push']('\x22'+_0x33631a+'\x22');break;case _0x56f7('0x36'):var _0x44c8c4=parseInt(_0x33631a);if(_[_0x56f7('0x75')](_0x44c8c4)&&_['includes'](_0x37da8b,_0x44c8c4)){_0x223a1b[_0x56f7('0x1d')]('\x22'+_0x44c8c4+'\x22');}else{_0x525041[_0x56f7('0x1d')](_0x56f7('0x76'));}break;case _0x56f7('0x77'):if(isEmail(_0x33631a)){_0x223a1b[_0x56f7('0x1d')]('\x22'+_0x33631a+'\x22');}else{_0x525041[_0x56f7('0x1d')](_0x56f7('0x78'));}break;case _0x56f7('0x79'):var _0x106302=moment(_0x33631a,'YYYY-MM-DD',!![]);if(_0x106302[_0x56f7('0x7a')]()){_0x223a1b[_0x56f7('0x1d')]('\x22'+_0x33631a+'\x22');}else{_0x525041['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x223a1b[_0x56f7('0x1d')]('\x22'+_0x33631a+'\x22');}}else{switch(_0x4b07ff){case'firstName':case _0x56f7('0x12'):_0x525041[_0x56f7('0x1d')](_0x4b07ff+_0x56f7('0x7b'));break;default:_0x223a1b['push']('\x22\x22');}}}}else{var _0x14bd22='';if(!_[_0x56f7('0x1c')](_0x1e71d3)){if(!_0x2ec701[_0x56f7('0x7c')](_0x1e71d3['id'])){for(var _0x59bbbf=0x0;_0x59bbbf<_0x23db44[_0x4b07ff][_0x56f7('0x1b')];_0x59bbbf++){var _0x33631a=_['trim'](_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23][_0x23db44[_0x4b07ff][_0x59bbbf]]['replace'](/"/g,'\x27'));var _0x5df16d=phoneDescriptions[_0x56f7('0x70')](_0x287ba1=>_0x287ba1[_0x56f7('0x7d')]===_0x1e71d3['id']);if(!_[_0x56f7('0x1c')](_0x5df16d)){var _0x2dd3c6=_['trim'](_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23][_0x23db44[_0x5df16d[_0x56f7('0x7e')]][0x0]][_0x56f7('0x7f')](/"/g,'\x27'));if(!_[_0x56f7('0x1c')](_0x2dd3c6))_0x33631a=_0x33631a+'§'+_0x2dd3c6;}if(_0x14bd22=='')_0x14bd22=_0x33631a;else _0x14bd22+='|'+_0x33631a;}_0x95e360['push'](_0x1e71d3['id']+':'+_0x14bd22);_0x2ec701[_0x1e71d3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x223a1b['push']('\x22'+_0x95e360[_0x56f7('0x18')](';')+'\x22');}if(_0x525041[_0x56f7('0x1b')]){handleError(_0x5b0abf['data'][_0x3d6e23],{'code':_0x56f7('0x80'),'message':_0x525041[_0x56f7('0x18')]()});}else{fs[_0x56f7('0x81')](_0x24dcbc,_0x223a1b[_0x56f7('0x18')]()+'\x0a');}_0x223a1b=[];}if(!(stats[_0x56f7('0x6f')]%0xc8)){socket[_0x56f7('0x82')]('contact:import:'+_0x121c31,stats);stats[_0x56f7('0x59')]=[];}}if(stopped){logger['info'](_0x56f7('0x83'));_0x330973[_0x56f7('0x84')]();}}catch(_0x2d97cd){handleError(_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23],{'code':_0x56f7('0x85'),'message':_0x2d97cd['message']});logger[_0x56f7('0x20')](_0x56f7('0x86'),_0x2d97cd[_0x56f7('0x57')]);}},'complete':function(){try{var _0x2e1e6b=[];var _0x15ef5e=tempTableName;_0x2e1e6b[_0x56f7('0x1d')](_0x56f7('0x87')+_0x15ef5e+_0x56f7('0x88'));logger['info'](_0x56f7('0x89'),contactItemTypes['length']);var _0x340dc6=util['format'](_0x56f7('0x8a'),_0x24dcbc,_0x15ef5e,_0xf269ed,_0xdb8bce[_0x56f7('0x32')],_0xdb8bce[_0x56f7('0x51')]||null,NOW,NOW);if(_[_0x56f7('0x1c')](_0x23db44[_0x56f7('0x31')])){_0x340dc6+=',\x20scheduledAt\x20=\x20NOW()';}_0x2e1e6b[_0x56f7('0x1d')](_0x340dc6);BPromise[_0x56f7('0x8b')](_0x2e1e6b,handleQuery)[_0x56f7('0x25')](function(_0x3b2b12){BPromise['all']([handleAdditionalPhones()])[_0x56f7('0x25')](function(){_0x2e1e6b=[];for(var _0x380bf6=0x0;_0x380bf6\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','squel','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0xa664,0x132));var _0x4a66=function(_0x2d540d,_0xe68b09){_0x2d540d=_0x2d540d-0x0;var _0x5f58f=_0xa664[_0x2d540d];return _0x5f58f;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x4a66('0x0'));var Papa=require(_0x4a66('0x1'));var util=require(_0x4a66('0x2'));var BPromise=require(_0x4a66('0x3'));var moment=require('moment');var squel=require(_0x4a66('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x4a66('0x5'));var logger=require(_0x4a66('0x6'))(_0x4a66('0x7'));config[_0x4a66('0x8')]=_[_0x4a66('0x9')](config[_0x4a66('0x8')],{'host':_0x4a66('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a66('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x4a66('0xb')](_0x4a66('0xc'));var tempTableName=_0x4a66('0xd')+moment()['format'](_0x4a66('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x124ed0){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'](_0x124ed0);}function selectNotIn(_0x11b0b7,_0x33430f,_0x42a9fc,_0x75fd00,_0x2bebf3){return squel[_0x4a66('0xf')]()[_0x4a66('0x10')](_0x4a66('0x11'))[_0x4a66('0x12')](_0x75fd00)[_0x4a66('0x13')](_0x33430f,null,_0x33430f+_0x4a66('0x14')+_0x75fd00+'.'+_0x42a9fc)[_0x4a66('0x15')](_0x75fd00+'.'+_0x42a9fc+_0x4a66('0x16')+_0x11b0b7+'.'+_0x42a9fc)[_0x4a66('0x15')](_0x33430f+_0x4a66('0x17')+_0x2bebf3[_0x4a66('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x11f34f,_0x4e9868){promisesAdditionalPhones=[];promisesContact=[];return db[_0x4a66('0x18')][_0x4a66('0x19')](_0x4a66('0x1a')+tempTableName)[_0x4a66('0x1b')](function(_0x199ddf){if(_0x199ddf!==null){var _0x4625ae=[];for(var _0xceefbd=0x0;_0xceefbd<_0x199ddf[_0x4a66('0x1c')];_0xceefbd++){var _0x59fdb0=_0x199ddf[_0xceefbd];if(!_[_0x4a66('0x1d')](_0x59fdb0[_0x4a66('0x11')])){if(!_[_0x4a66('0x1d')](_0x59fdb0[_0x4a66('0x1e')]))_0x4625ae['push'](insertAdditionalPhones(_0x59fdb0));promisesContact[_0x4a66('0x1f')]({'contact':_0x59fdb0});}}}Promise[_0x4a66('0x20')](_0x4625ae)[_0x4a66('0x21')](function(){_0x11f34f({'val':0x1});});})['catch'](function(_0x4e8e62){logger[_0x4a66('0x22')](_0x4e8e62[_0x4a66('0x23')]);});});}function insertAdditionalPhones(_0x25fb2c){return new Promise(function(_0x4c78e1,_0x5de482){var _0x22ad33=_0x25fb2c[_0x4a66('0x1e')];if(_[_0x4a66('0x1d')](_0x22ad33))_0x5de482({'val':0x0});else{var _0x4704c3=_0x22ad33[_0x4a66('0x24')](';');var _0x3d649d=[];orderBy=0x0;for(var _0x451f4e=0x0;_0x451f4e<_0x4704c3[_0x4a66('0x1c')];_0x451f4e++){_0x3d649d[_0x4a66('0x1f')](splitAdditionalPhone(_0x25fb2c['id'],_0x4704c3[_0x451f4e]));}Promise[_0x4a66('0x20')](_0x3d649d)[_0x4a66('0x21')](function(){_0x4c78e1({'val':_0x4704c3[_0x4a66('0x1c')]});});}});}function splitAdditionalPhone(_0xad793e,_0x41457b){return new Promise(function(_0x83ae44,_0xfacfbe){var _0x2cd979=_0x41457b['split'](':');var _0x2a9ba1=_0x2cd979[0x0];var _0x4d58c=_0x2cd979[0x1];if(_0x4d58c!==''){var _0x54c1c5=_0x4d58c[_0x4a66('0x24')]('|');var _0x3cb2c4=[];for(var _0x47184e=0x0;_0x47184e<_0x54c1c5[_0x4a66('0x1c')];_0x47184e++){if(_0x54c1c5[_0x47184e]!==''){var _0x3260d4=_['filter'](promisesAdditionalPhones,{'contactId':_0xad793e,'phone':_0x54c1c5[_0x47184e]});if(_0x3260d4['length']==0x0){orderBy++;promisesAdditionalPhones[_0x4a66('0x1f')]({'contactId':_0xad793e,'contactTypeId':_0x2a9ba1,'phone':_0x54c1c5[_0x47184e],'orderBy':orderBy});}}}_0x83ae44({'ok':0x1});}else _0x83ae44({'res':0x0});});}function createAdditionalPhone(_0x42871c,_0xbba8bc,_0x257485,_0xa81e68){var _0x80782e='';var _0x1412f1='';var _0x32bd79=_0x257485[_0x4a66('0x24')]('§');_0x80782e=_0x32bd79[0x0];if(_0x32bd79[_0x4a66('0x1c')]==0x2)_0x1412f1=_0x32bd79[0x1];return new Promise(function(_0x360376,_0x2274c9){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x42871c,'item':_0x80782e}})[_0x4a66('0x21')](function(_0x563501){if(_0x563501){return db[_0x4a66('0x25')][_0x4a66('0x26')]({'ItemTypeId':_0xbba8bc,'description':_0x1412f1,'OrderBy':_0xa81e68},{'where':{'CmContactId':_0x42871c,'item':_0x80782e}})[_0x4a66('0x21')](function(_0x387bac){_0x360376({'res':'updated'});});}else{return db[_0x4a66('0x25')][_0x4a66('0x27')]({'CmContactId':_0x42871c,'item':_0x80782e,'ItemTypeId':_0xbba8bc,'description':_0x1412f1,'OrderBy':_0xa81e68,'ItemClass':_0x4a66('0x28')})[_0x4a66('0x21')](function(_0x5da8d5){_0x360376({'res':'inserted'});});}});});}function updateContact(_0x33aa91){return new Promise(function(_0x24b7a7,_0x417d97){var _0x278483=_0x33aa91['id'];delete _0x33aa91['id'];return db[_0x4a66('0x29')][_0x4a66('0x26')](_0x33aa91,{'where':{'id':_0x278483}})[_0x4a66('0x21')](function(_0xee22c4){updatedRows+=0x1;return db[_0x4a66('0x2a')][_0x4a66('0x26')]({'phone':_0x33aa91['phone']},{'where':{'ContactId':_0x278483}})['then'](function(_0x4fc148){_0x24b7a7({'ret':'OK'});});});});}function insertCmHopper(_0x154606,_0x30a8df,_0x46177a,_0x33d37e,_0xf46e7a){var _0x55c874=[_0x4a66('0x2b'),'cm_contacts.scheduledat','cm_contacts.id',_0x4a66('0x2c'),_0x30a8df+'.'+_0x33d37e,_0x4a66('0x2d'),_0x4a66('0x2e'),_0x4a66('0x2f'),'cm_contacts.UserId','\x22'+_0xf46e7a+'\x22'];return squel[_0x4a66('0x30')]()['into'](_0x4a66('0x31'))[_0x4a66('0x32')]([_0x4a66('0x11'),_0x4a66('0x33'),_0x4a66('0x34'),_0x4a66('0x35'),_0x33d37e,_0x4a66('0x36'),_0x4a66('0x37'),_0x4a66('0x38'),_0x4a66('0x39'),_0x4a66('0x3a')],squel[_0x4a66('0xf')]()[_0x4a66('0x3b')](_0x55c874)[_0x4a66('0x12')](_0x30a8df)[_0x4a66('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x30a8df+_0x4a66('0x3c'))[_0x4a66('0x13')](_0x46177a,null,_0x46177a+_0x4a66('0x14')+_0x30a8df+'.'+_0x33d37e)[_0x4a66('0x15')](_0x30a8df+_0x4a66('0x3d'),_0x154606)[_0x4a66('0x15')](_0x4a66('0x3e'),NOW)[_0x4a66('0x15')](_0x4a66('0x3f'),selectNotIn(_0x30a8df,_0x46177a,_0x33d37e,_0x4a66('0x31'),[_0x4a66('0x40'),_0x4a66('0x41')]))[_0x4a66('0x15')](_0x4a66('0x3f'),selectNotIn(_0x30a8df,_0x46177a,_0x33d37e,_0x4a66('0x31'),['\x22always\x22'])))[_0x4a66('0x42')]();}function insertCmHopperBlack(_0x236db9,_0x4c608f,_0xc071c7,_0x1ecd9e){var _0x37a2ed=['cm_contacts.phone',_0x4a66('0x43'),_0x4a66('0x2c'),_0x4c608f+'.'+_0x1ecd9e,_0x4a66('0x2d'),'cm_contacts.updatedAt'];return squel[_0x4a66('0x30')]()[_0x4a66('0x44')]('cm_hopper_black')[_0x4a66('0x32')](['phone',_0x4a66('0x34'),'ListId',_0x1ecd9e,_0x4a66('0x36'),_0x4a66('0x37')],squel[_0x4a66('0xf')]()[_0x4a66('0x3b')](_0x37a2ed)[_0x4a66('0x12')](_0x4c608f)['join']('cm_contacts',null,_0x4a66('0x45')+_0x4c608f+_0x4a66('0x3c'))[_0x4a66('0x13')](_0xc071c7,null,_0xc071c7+_0x4a66('0x14')+_0x4c608f+'.'+_0x1ecd9e)[_0x4a66('0x15')](_0x4c608f+'.CmListId\x20=\x20?',_0x236db9)['where'](_0x4a66('0x3e'),NOW)[_0x4a66('0x15')](_0x4a66('0x3f'),squel['select']()[_0x4a66('0x10')]('phone')['from'](_0x4a66('0x46'))[_0x4a66('0x15')]('ListId\x20=\x20?',_0x236db9)[_0x4a66('0x15')](_0x1ecd9e+_0x4a66('0x47'),_0x4c608f+'.'+_0x1ecd9e)))['toString']();}function insertCmHopperAdditionalPhones(_0x3387b4){var _0x303ceb=[_0x4a66('0x48'),_0x4a66('0x49'),_0x4a66('0x4a'),'cm_contact_has_items.createdAt',_0x4a66('0x4b')];return squel[_0x4a66('0x30')]()[_0x4a66('0x44')](_0x4a66('0x4c'))[_0x4a66('0x32')]([_0x4a66('0x4d'),_0x4a66('0x11'),_0x4a66('0x4e'),_0x4a66('0x36'),_0x4a66('0x37')],squel[_0x4a66('0xf')]()[_0x4a66('0x3b')](_0x303ceb)[_0x4a66('0x12')]('cm_hopper')['join'](_0x4a66('0x4f'),null,_0x4a66('0x50'))[_0x4a66('0x13')](_0x4a66('0x51'),null,_0x4a66('0x52'))[_0x4a66('0x15')]('cm_hopper.ListId\x20=\x20?',_0x3387b4)[_0x4a66('0x15')](_0x4a66('0x3e'),NOW))['toString']();}function insertCmContact(_0x15b50e,_0x8589b4,_0x5ecb9d,_0x18c1e9){var _0x59eac3=_[_0x4a66('0x53')](_['keys'](_0x18c1e9),['ListId',_0x4a66('0x54'),_0x4a66('0x36'),'updatedAt']);return squel['insert']()[_0x4a66('0x44')](_0x4a66('0x4f'))['fromQuery'](_0x59eac3,squel[_0x4a66('0xf')]()[_0x4a66('0x3b')](_0x59eac3)[_0x4a66('0x12')](_0x8589b4)[_0x4a66('0x15')]('('+_0x5ecb9d[_0x4a66('0x13')](',')+_0x4a66('0x55'),squel['select']()[_0x4a66('0x3b')](_0x5ecb9d)[_0x4a66('0x12')](_0x4a66('0x4f'))[_0x4a66('0x15')](_0x4a66('0x56'),_0x15b50e))['where'](_0x4a66('0x57'),squel[_0x4a66('0xf')]()[_0x4a66('0x10')](_0x4a66('0x58'),'min_id')[_0x4a66('0x12')](_0x8589b4)[_0x4a66('0x59')](_0x5ecb9d[_0x4a66('0x13')](','))))[_0x4a66('0x42')]();}function handleStop(){logger['info'](_0x4a66('0x5a'));stopped=!![];}function handleUncaughtException(_0x284ac6){logger[_0x4a66('0x22')](_0x284ac6[_0x4a66('0x23')]);process[_0x4a66('0x5b')](0x1);}function handleError(_0xce8e3a,_0x23fba8){stats[_0x4a66('0x5c')]['push']({'name':_0x23fba8[_0x4a66('0x5d')],'message':_0x23fba8[_0x4a66('0x23')],'row':_0xce8e3a});}function handleQuery(_0x35cb93){logger[_0x4a66('0x5e')](_0x35cb93);return db[_0x4a66('0x18')][_0x4a66('0x19')](_0x35cb93)['spread'](function(_0x1f9cc1){results[_0x4a66('0x1f')](_0x1f9cc1);})['catch'](function(_0x5ad839){logger['error'](_0x5ad839[_0x4a66('0x23')]);});}function main(_0x438a83,_0x15d4b6,_0x1b7059,_0x181118){logger['info'](_0x4a66('0x5f'),_0x438a83,JSON[_0x4a66('0x60')](_0x15d4b6));process['send'](_0x4a66('0x61'));var _0x9adcaa=_0x15d4b6[_0x4a66('0x62')];var _0x87a543=_[_0x4a66('0x63')](_0x9adcaa);var _0x577554=_0x15d4b6[_0x4a66('0x64')];var _0xf1aad=path[_0x4a66('0x13')](config[_0x4a66('0x65')],'server/files/tmp',_0x577554+'.csv');logger[_0x4a66('0x5e')](_0x4a66('0x66'),_0x15d4b6);db[_0x4a66('0x67')][_0x4a66('0x68')]({'raw':!![],'attributes':['id',_0x4a66('0x69')]})['then'](function(_0x492593){for(var _0x1d7f9=0x0;_0x1d7f9<_0x492593[_0x4a66('0x1c')];_0x1d7f9++){if(_0x492593[_0x1d7f9][_0x4a66('0x69')]in _0x9adcaa){contactItemTypes[_0x4a66('0x1f')](_0x492593[_0x1d7f9]);delete _0x87a543[_0x492593[_0x1d7f9]['name']];hasAdditionalPhones=!![];}for(var _0x17a91c in _0x9adcaa){if(_0x492593[_0x1d7f9][_0x4a66('0x69')]+_0x4a66('0x6a')===_0x17a91c){phoneDescriptions[_0x4a66('0x1f')]({'itemTypeId':_0x492593[_0x1d7f9]['id'],'description':_0x17a91c});delete _0x87a543[_0x17a91c];}}}if(hasAdditionalPhones)_0x87a543[_0x4a66('0x1e')]='';var _0x179f82=_[_0x4a66('0x6b')](_0x87a543)[_0x4a66('0x13')]();logger[_0x4a66('0x5e')](_0x4a66('0x6c'),_0x179f82);fs[_0x4a66('0x6d')](_0xf1aad,_0x179f82+'\x0a');Papa[_0x4a66('0x6e')](fs[_0x4a66('0x6f')](_0x438a83),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1b2571,_0x204778){try{for(var _0x169123=0x0,_0x43eb7a=[];_0x169123<_0x1b2571[_0x4a66('0x70')][_0x4a66('0x1c')];_0x169123++){stats['rows']+=0x1;if(_0x1b2571[_0x4a66('0x5c')][_0x169123]){handleError(_0x1b2571[_0x4a66('0x70')][_0x169123],_0x1b2571['errors'][_0x169123]);}else{var _0xdfbfb7=[];var _0x2462f0=[];var _0x3159c3={};for(var _0x2ca03f in _0x9adcaa){let _0x220933=contactItemTypes[_0x4a66('0x71')](_0x520840=>_0x520840[_0x4a66('0x69')]===_0x2ca03f);let _0x38b40c=contactItemTypes[_0x4a66('0x71')](_0x35a3d6=>_0x35a3d6['name']+_0x4a66('0x6a')===_0x2ca03f);if(_['isNil'](_0x220933)&&_['isNil'](_0x38b40c)){if(_0x9adcaa[_0x4a66('0x72')](_0x2ca03f)){if(_0x1b2571[_0x4a66('0x70')][_0x169123][_0x9adcaa[_0x2ca03f]]){var _0x2cb695=_[_0x4a66('0x73')](_0x1b2571[_0x4a66('0x70')][_0x169123][_0x9adcaa[_0x2ca03f]]['replace'](/"/g,'\x27'));switch(_0x2ca03f){case _0x4a66('0x33'):var _0x1d6c9e=moment(_0x2cb695,_0x4a66('0xc'),!![]);if(_0x1d6c9e['isValid']()){_0x43eb7a['push']('\x22'+_0x2cb695+'\x22');}else{_0xdfbfb7[_0x4a66('0x1f')](_0x4a66('0x74'));}break;case'priority':var _0x4fdaa1=parseInt(_0x2cb695);_0x2cb695=_[_0x4a66('0x75')](_0x4fdaa1)||_0x4fdaa1<0x0||_0x4fdaa1>0x4?_0x181118?0x3:0x2:_0x4fdaa1;_0x43eb7a[_0x4a66('0x1f')]('\x22'+_0x2cb695+'\x22');break;case _0x4a66('0x39'):var _0x4725a1=parseInt(_0x2cb695);if(_[_0x4a66('0x76')](_0x4725a1)&&_[_0x4a66('0x77')](_0x1b7059,_0x4725a1)){_0x43eb7a[_0x4a66('0x1f')]('\x22'+_0x4725a1+'\x22');}else{_0xdfbfb7[_0x4a66('0x1f')]('agent\x20not\x20exists');}break;case _0x4a66('0x78'):if(isEmail(_0x2cb695)){_0x43eb7a[_0x4a66('0x1f')]('\x22'+_0x2cb695+'\x22');}else{_0xdfbfb7['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2c84ff=moment(_0x2cb695,_0x4a66('0x79'),!![]);if(_0x2c84ff[_0x4a66('0x7a')]()){_0x43eb7a[_0x4a66('0x1f')]('\x22'+_0x2cb695+'\x22');}else{_0xdfbfb7[_0x4a66('0x1f')](_0x4a66('0x7b'));}break;default:_0x43eb7a[_0x4a66('0x1f')]('\x22'+_0x2cb695+'\x22');}}else{switch(_0x2ca03f){case _0x4a66('0x7c'):case _0x4a66('0x11'):_0xdfbfb7[_0x4a66('0x1f')](_0x2ca03f+'\x20not\x20specified');break;default:_0x43eb7a[_0x4a66('0x1f')]('\x22\x22');}}}}else{var _0x21b056='';if(!_['isNil'](_0x220933)){if(!_0x3159c3['hasOwnProperty'](_0x220933['id'])){for(var _0x4b12ef=0x0;_0x4b12ef<_0x9adcaa[_0x2ca03f]['length'];_0x4b12ef++){var _0x2cb695=_[_0x4a66('0x73')](_0x1b2571['data'][_0x169123][_0x9adcaa[_0x2ca03f][_0x4b12ef]][_0x4a66('0x7d')](/"/g,'\x27'));var _0x48f5f5=phoneDescriptions[_0x4a66('0x71')](_0x4ae6e3=>_0x4ae6e3['itemTypeId']===_0x220933['id']);if(!_[_0x4a66('0x1d')](_0x48f5f5)){var _0x4916af=_[_0x4a66('0x73')](_0x1b2571['data'][_0x169123][_0x9adcaa[_0x48f5f5[_0x4a66('0x7e')]][0x0]][_0x4a66('0x7d')](/"/g,'\x27'));if(!_['isNil'](_0x4916af))_0x2cb695=_0x2cb695+'§'+_0x4916af;}if(_0x21b056=='')_0x21b056=_0x2cb695;else _0x21b056+='|'+_0x2cb695;}_0x2462f0[_0x4a66('0x1f')](_0x220933['id']+':'+_0x21b056);_0x3159c3[_0x220933['id']]=0x1;}}}}if(hasAdditionalPhones){_0x43eb7a['push']('\x22'+_0x2462f0['join'](';')+'\x22');}if(_0xdfbfb7[_0x4a66('0x1c')]){handleError(_0x1b2571[_0x4a66('0x70')][_0x169123],{'code':_0x4a66('0x7f'),'message':_0xdfbfb7['join']()});}else{fs[_0x4a66('0x80')](_0xf1aad,_0x43eb7a[_0x4a66('0x13')]()+'\x0a');}_0x43eb7a=[];}if(!(stats[_0x4a66('0x81')]%0xc8)){socket[_0x4a66('0x82')]('contact:import:'+_0x577554,stats);stats['errors']=[];}}if(stopped){logger[_0x4a66('0x5e')](_0x4a66('0x83'));_0x204778['abort']();}}catch(_0x4189b4){handleError(_0x1b2571[_0x4a66('0x70')][_0x169123],{'code':_0x4a66('0x84'),'message':_0x4189b4[_0x4a66('0x23')]});logger[_0x4a66('0x22')](_0x4a66('0x85'),_0x4189b4[_0x4a66('0x23')]);}},'complete':function(){try{var _0x353e24=[];var _0x2e3194=tempTableName;_0x353e24[_0x4a66('0x1f')](_0x4a66('0x86')+_0x2e3194+_0x4a66('0x87'));logger['info'](_0x4a66('0x88'),contactItemTypes[_0x4a66('0x1c')]);var _0x51d748=util[_0x4a66('0xb')](_0x4a66('0x89'),_0xf1aad,_0x2e3194,_0x179f82,_0x15d4b6[_0x4a66('0x35')],_0x15d4b6[_0x4a66('0x54')]||null,NOW,NOW);if(_[_0x4a66('0x1d')](_0x9adcaa['scheduledat'])){_0x51d748+=_0x4a66('0x8a');}_0x353e24[_0x4a66('0x1f')](_0x51d748);BPromise[_0x4a66('0x8b')](_0x353e24,handleQuery)[_0x4a66('0x21')](function(_0x22c0d6){BPromise[_0x4a66('0x20')]([handleAdditionalPhones()])[_0x4a66('0x21')](function(){_0x353e24=[];for(var _0x4f2936=0x0;_0x4f2936\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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.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','updateInteraction','./utils','getAccountFK','role','select','field','name','from','tools_tags','_interactions','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','interactionsTags','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','value','end','unreadMessages','read','and','Contact','operator','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','clause','tags','ids','User','$substring','user','UserId','body','plainBody','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','agent','i.thirdDisposition','i.secondDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','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','i.createdAt','i.closed'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfad9,0x174));var _0x9fad=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xfad9[_0x2d2258];return _0x18e155;};'use strict';var _=require(_0x9fad('0x0'));var squel=require('squel');var as=require(_0x9fad('0x1'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x9fad('0x2')];var utils=require(_0x9fad('0x3'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x4eb718,_0x3fe8ff,_0x133043){var _0x320bcb=![];var _0x50f082=utils[_0x9fad('0x4')](_0x4eb718);if(_0x3fe8ff[_0x9fad('0x5')]==='agent'&&!_0x133043['search']&&!_0x133043[_0x50f082]){_0x320bcb=!![];}return _0x320bcb;}function getTagsQuery(){return squel[_0x9fad('0x6')]()[_0x9fad('0x7')]('id')[_0x9fad('0x7')](_0x9fad('0x8'))[_0x9fad('0x7')]('color')[_0x9fad('0x9')](_0x9fad('0xa'));}function getUsersQuery(_0x59d2ca,_0x39cd51){var _0x4f7dea=utils['getInteractionFK'](_0x59d2ca);var _0x5c8e33='user_has_'+_0x59d2ca+_0x9fad('0xb');var _0x1a974a=squel[_0x9fad('0x6')]()[_0x9fad('0x7')](_0x9fad('0xc'))['field'](_0x9fad('0xd'))[_0x9fad('0x7')](_0x9fad('0xe')+_0x4f7dea)[_0x9fad('0x9')](_0x5c8e33,'ui')['left_join'](_0x9fad('0xf'),'u',_0x9fad('0x10'));if(_0x39cd51[_0x9fad('0x11')]>0x0){_0x1a974a[_0x9fad('0x12')]('ui.'+_0x4f7dea+_0x9fad('0x13'),_[_0x9fad('0x14')](_0x39cd51,'id'));}return _0x1a974a;}function getInteractionsQuery(_0x4ad15d){var _0x43f1a1=utils[_0x9fad('0x15')](_0x4ad15d);var _0x4989fb=utils[_0x9fad('0x4')](_0x4ad15d);var _0x3f707f=utils[_0x9fad('0x16')](_0x4ad15d);return squel[_0x9fad('0x6')]()[_0x9fad('0x9')](_0x43f1a1[_0x9fad('0x17')],'i')[_0x9fad('0x18')](_0x9fad('0x19'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9fad('0x18')](_0x9fad('0xf'),'o',_0x9fad('0x1a'))['left_join'](_0x43f1a1['accounts'],'a',_0x9fad('0x1b')+_0x4989fb)[_0x9fad('0x18')](_0x43f1a1[_0x9fad('0x1c')],'me',_0x9fad('0x1d')+_0x3f707f+'\x20=\x20i.id')[_0x9fad('0x18')](_0x43f1a1[_0x9fad('0x1e')],'it','it.'+_0x3f707f+_0x9fad('0x1f'))[_0x9fad('0x18')](_0x9fad('0xa'),'t',_0x9fad('0x20'));}function getSqlClauses(){var _0x340dd9={'body':squel['expr'](),'contact':squel[_0x9fad('0x21')](),'default':squel[_0x9fad('0x21')](),'fields':squel['expr'](),'filter':squel[_0x9fad('0x21')](),'read':squel[_0x9fad('0x21')](),'tags':{'clause':squel[_0x9fad('0x21')](),'ids':null},'user':squel['expr']()};return _0x340dd9;}function parseTagParameter(_0x1f2781){var _0x28c5c1=squel[_0x9fad('0x21')]();if(_0x1f2781){var _0x287687=utils[_0x9fad('0x22')](_0x1f2781);_0x287687[_0x9fad('0x23')](function(_0x270d76){_0x28c5c1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x270d76+',%');});}return _0x28c5c1;}function parseReadParameter(_0x62385a){var _0x2333b1='';if(_0x62385a){_0x2333b1='unreadMessages\x20{OPERATOR}\x200';if(_0x62385a==='1'){_0x2333b1=_0x2333b1[_0x9fad('0x24')](_0x9fad('0x25'),'=');}else{_0x2333b1=_0x2333b1[_0x9fad('0x24')]('{OPERATOR}','>');}}return _0x2333b1;}function parseSearchFilter(_0x5f0fd0,_0xacf40c){var _0x415c58=squel['expr']();if(_0xacf40c){var _0x16a41b=_0xacf40c[_0x9fad('0x24')]('\x5c','\x5c\x5c')[_0x9fad('0x24')](/'/g,'\x27\x27');var _0x20cb28=qs[_0x9fad('0x26')](_0x16a41b);if(qs[_0x9fad('0x27')](_0x16a41b)){_0x415c58['or'](_0x9fad('0x28'),_0x20cb28+'%');if(['sms','whatsapp'][_0x9fad('0x29')](_0x5f0fd0)){_0x415c58['or'](_0x9fad('0x2a'),_0x20cb28+'%');}else if(_0x5f0fd0===_0x9fad('0x2b')){_0x415c58['or'](_0x9fad('0x2c'),_0x20cb28+'%');}else if(_0x5f0fd0===_0x9fad('0x2d')){_0x415c58['or'](_0x9fad('0x2e'),_0x20cb28+'%');}}else if(_0x5f0fd0===_0x9fad('0x2f')&&qs[_0x9fad('0x30')](_0x16a41b)){_0x415c58['or'](_0x9fad('0x31'),_0x20cb28+'%');}else{if(_0x5f0fd0===_0x9fad('0x2f')){_0x415c58['or'](_0x9fad('0x32'),qs[_0x9fad('0x33')](_0x16a41b,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x16a41b));}else if(_0x5f0fd0!==_0x9fad('0x2b')){_0x415c58['or'](_0x9fad('0x34'),qs[_0x9fad('0x33')](_0x16a41b));}_0x415c58['or'](_0x9fad('0x35'),qs['getFullTextValue'](_0x16a41b,!![]),null);}}return _0x415c58;}function parseAdvancedSearchFilter(_0x4c991d,_0x5902f8){var _0x55469a=getSqlClauses();var _0x569fb9=as[_0x9fad('0x36')](_0x4c991d);var _0x192c3d=_0x569fb9[_0x9fad('0x37')];for(var _0xb8cf9=0x0;_0xb8cf9<_0x569fb9[_0x9fad('0x38')][_0x9fad('0x11')];_0xb8cf9++){var _0x45716b=_0x569fb9[_0x9fad('0x38')][_0xb8cf9];var _0x11a64b='i';var _0x27a89f=_[_0x9fad('0x39')](_0x5902f8,[_0x9fad('0x8'),_0x45716b[_0x9fad('0x7')]]);if(_0x27a89f){var _0x8bfda5=as[_0x9fad('0x3a')](_0x11a64b,_0x27a89f[_0x9fad('0x3b')],_0x45716b);_0x55469a[_0x9fad('0x3c')][_0x192c3d](_0x8bfda5[_0x9fad('0x3d')],_0x8bfda5[_0x9fad('0x3e')]['start'],_0x8bfda5[_0x9fad('0x3e')][_0x9fad('0x3f')]);}else{switch(_0x45716b[_0x9fad('0x7')]){case _0x9fad('0x40'):var _0x14a2ff=parseReadParameter(_0x45716b[_0x9fad('0x3e')]);_0x55469a[_0x9fad('0x41')][_0x9fad('0x42')](_0x14a2ff);break;case _0x9fad('0x43'):if(_0x45716b[_0x9fad('0x44')]==='$substring'){if(_0x45716b[_0x9fad('0x3e')]['split']('\x20')[_0x9fad('0x11')]>0x1){_0x55469a[_0x9fad('0x45')][_0x192c3d](_0x9fad('0x35'),qs[_0x9fad('0x33')](_0x45716b[_0x9fad('0x3e')],!![]),null);}else{var _0xe52356='%'+_0x45716b[_0x9fad('0x3e')]+'%';_0x55469a['contact'][_0x192c3d](_0x9fad('0x46'),_0xe52356,_0xe52356,_0xe52356);}}else{_0x27a89f=_[_0x9fad('0x39')](_0x5902f8,[_0x9fad('0x8'),_0x9fad('0x47')]);_0x45716b[_0x9fad('0x7')]='ContactId';_0x8bfda5=as['buildExpression'](_0x11a64b,_0x27a89f['type'],_0x45716b);_0x55469a['contact'][_0x192c3d](_0x8bfda5[_0x9fad('0x3d')],_0x8bfda5[_0x9fad('0x3e')][_0x9fad('0x48')],_0x8bfda5[_0x9fad('0x3e')]['end']);}break;case'Tag':var _0x1bc4ab=_0x45716b[_0x9fad('0x3e')]['split'](',')[_0x9fad('0x14')](function(_0x52745e){return Number(_0x52745e);});var _0x2dc545=parseTagParameter(_0x1bc4ab);_0x55469a['tags'][_0x9fad('0x49')]['and'](_0x2dc545);_0x55469a[_0x9fad('0x4a')][_0x9fad('0x4b')]=_0x1bc4ab;break;case _0x9fad('0x4c'):if(_0x45716b[_0x9fad('0x44')]===_0x9fad('0x4d')){_0x55469a[_0x9fad('0x4e')][_0x192c3d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x45716b[_0x9fad('0x3e')]+'%',null);}else{_0x27a89f=_[_0x9fad('0x39')](_0x5902f8,[_0x9fad('0x8'),_0x9fad('0x4f')]);_0x45716b[_0x9fad('0x7')]=_0x9fad('0x4f');_0x8bfda5=as['buildExpression'](_0x11a64b,_0x27a89f['type'],_0x45716b);_0x55469a['user'][_0x192c3d](_0x8bfda5['text'],_0x8bfda5[_0x9fad('0x3e')][_0x9fad('0x48')],_0x8bfda5[_0x9fad('0x3e')]['end']);}break;case _0x9fad('0x50'):case _0x9fad('0x51'):_0x8bfda5=as[_0x9fad('0x3a')]('me',null,_0x45716b);_0x55469a[_0x9fad('0x50')][_0x192c3d](_0x8bfda5['text'],_0x8bfda5[_0x9fad('0x3e')]['start'],_0x8bfda5[_0x9fad('0x3e')][_0x9fad('0x3f')]);break;}}}return _0x55469a;}function parseModelFields(_0x462df9,_0x2e024a,_0x1949cd){var _0x428c8f=utils[_0x9fad('0x4')](_0x462df9);var _0x5948c3=squel[_0x9fad('0x21')]();var _0x3ba0fb=_(_0x2e024a)[_0x9fad('0x52')]()['map'](function(_0x5d8316){return _['some'](_0x1949cd,[_0x9fad('0x8'),_0x5d8316])?_0x5d8316:undefined;})[_0x9fad('0x53')]()[_0x9fad('0x3e')]();if(_0x3ba0fb['length']>0x0){_0x3ba0fb['forEach'](function(_0x18674f){if(_0x18674f===_0x428c8f){_0x5948c3[_0x9fad('0x42')]('i.'+_0x428c8f+_0x9fad('0x13'),[][_0x9fad('0x54')](_0x2e024a[_0x18674f]));}else if(_0x18674f===_0x9fad('0x55')){var _0x27b481=JSON[_0x9fad('0x56')](_0x2e024a[_0x18674f])[_0x9fad('0x57')];var _0x46230d=JSON[_0x9fad('0x56')](_0x2e024a[_0x18674f])[_0x9fad('0x58')];_0x5948c3[_0x9fad('0x42')](_0x9fad('0x59'),_0x27b481,_0x46230d);}else{if(_0x2e024a[_0x18674f]===_0x9fad('0x5a')){_0x5948c3[_0x9fad('0x42')]('i.'+_0x18674f+'\x20IS\x20NULL');}else{_0x5948c3[_0x9fad('0x42')]('i.'+_0x18674f+_0x9fad('0x5b'),_0x2e024a[_0x18674f]);}}});}return _0x5948c3;}function parseQueryParameters(_0x30694e,_0x7d69f0,_0x4add14){var _0x480db2=getSqlClauses();return Promise[_0x9fad('0x5c')]()[_0x9fad('0x5d')](function(){return parseModelFields(_0x30694e,_0x7d69f0,_0x4add14);})[_0x9fad('0x5d')](function(_0xec5a60){_0x480db2[_0x9fad('0x5e')]['and'](_0xec5a60);return parseReadParameter(_0x7d69f0[_0x9fad('0x41')]);})[_0x9fad('0x5d')](function(_0x1b7e33){_0x480db2['read'][_0x9fad('0x42')](_0x1b7e33);return parseTagParameter(_0x7d69f0[_0x9fad('0x5f')]);})[_0x9fad('0x5d')](function(_0x568e23){_0x480db2['tags'][_0x9fad('0x49')][_0x9fad('0x42')](_0x568e23);return parseSearchFilter(_0x30694e,_0x7d69f0[_0x9fad('0x60')]);})[_0x9fad('0x5d')](function(_0x3a5567){_0x480db2[_0x9fad('0x60')]=_0x3a5567;return _0x480db2;});}function checkAccountsRestrictions(_0x376349,_0x4e0805,_0x384bb0){var _0x2e4c1d=utils[_0x9fad('0x4')](_0x376349);var _0x2e84b7=_0x9fad('0x61')+_[_0x9fad('0x62')](_0x376349)+(_0x376349===_0x9fad('0x63')?_0x9fad('0x64'):_0x9fad('0x65'));var _0xafa8b1=squel['expr']();return Promise[_0x9fad('0x5c')]()[_0x9fad('0x5d')](function(){if(_0x384bb0['search']&&_0x4e0805[_0x9fad('0x5')]===_0x9fad('0x66')){return _0x4e0805[_0x2e84b7]({'attributes':['id'],'raw':!![]});}})[_0x9fad('0x5d')](function(_0x4c8f84){if(_0x4c8f84){if(_0x4c8f84[_0x9fad('0x11')]===0x0){_0xafa8b1[_0x9fad('0x42')]('i.'+_0x2e4c1d+'\x20IS\x20NULL');}else{_0xafa8b1['and']('i.'+_0x2e4c1d+_0x9fad('0x13'),_[_0x9fad('0x14')](_0x4c8f84,'id'));}}else if(!_0x384bb0[_0x2e4c1d]){_0xafa8b1[_0x9fad('0x42')]('i.'+_0x2e4c1d+'\x20IS\x20NOT\x20NULL');}})[_0x9fad('0x5d')](function(){return _0xafa8b1;});}function getClosedOrderClause(_0xf085b,_0x57bb00){var _0x128428='';var _0x51f4b9=[_0x9fad('0x67'),_0x9fad('0x68'),'i.disposition'];if(_0xf085b===_0x9fad('0x2f')){_0x51f4b9[_0x9fad('0x69')](_0x9fad('0x6a'));}if(_0x57bb00[_0x9fad('0x6b')]==='0'&&_0xf085b==='mail'){_0x128428='i.substatus';}else{if(_0x57bb00['closed']==='1'){_0x51f4b9[_0x9fad('0x6c')]();}_0x128428=_0x9fad('0x6d')+_0x51f4b9['join'](',\x20')+')';}return _0x128428;}function getFilteredInteractions(_0x24611b,_0x2d8e2c,_0x5b1f3e,_0x3cd70a){var _0x2027af=utils[_0x9fad('0x16')](_0x24611b);var _0x49ebc7=_[_0x9fad('0x62')](_0x24611b)+_0x9fad('0x6e');var _0x319457=[];var _0x45b969=getTagsQuery();var _0x6acb8={'type':db[_0x9fad('0x6f')][_0x9fad('0x70')][_0x9fad('0x71')],'raw':!![]};var _0x2dcea6=[];var _0x40e1e2=[];return db[_0x9fad('0x72')][_0x9fad('0x73')](_0x45b969[_0x9fad('0x74')](),_0x6acb8)[_0x9fad('0x5d')](function(_0x5c4905){_0x319457=_[_0x9fad('0x75')](_0x5c4905,'id');_0x6acb8=_[_0x9fad('0x76')](_0x6acb8,{'model':db[_0x49ebc7],'mapToModel':!![],'nest':!![]});if(_0x5b1f3e[_0x9fad('0x5e')]){_0x3cd70a[_0x9fad('0x77')][_0x9fad('0x23')](function(_0x3c5d3e){_0x2d8e2c['field']('i.'+_0x3c5d3e);});}else{_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x78'),_0x9fad('0x40'));_0x2d8e2c[_0x9fad('0x7')]('a.key',_0x9fad('0x79'));_0x2d8e2c['field'](_0x9fad('0x7a'),_0x9fad('0x7b'));if(_0x24611b===_0x9fad('0x2f')){_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x7c'),_0x9fad('0x7d'));_0x2d8e2c['field'](_0x9fad('0x7e'),'contactName');_0x2d8e2c[_0x9fad('0x7')]('i.id');_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x7f'));_0x2d8e2c[_0x9fad('0x7')]('i.updatedAt');_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x80'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x81'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x82'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x83'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x84'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x85'));_0x2d8e2c['field'](_0x9fad('0x86'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x68'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x67'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x6a'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x87'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x88'));_0x2d8e2c[_0x9fad('0x7')]('i.MailAccountId');_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x89'));}else if(_0x24611b===_0x9fad('0x2d')){_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x8a'),_0x9fad('0x8b'));}else{_0x2d8e2c['field'](_0x9fad('0x8c'),_0x9fad('0x8b'));}if(_0x24611b!=='mail'){_0x2d8e2c[_0x9fad('0x7')]('i.*');}_0x2d8e2c['field'](_0x9fad('0x8d'),_0x9fad('0x8e'));_0x2d8e2c['field'](_0x9fad('0x8f'),_0x9fad('0x90'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x91'),_0x9fad('0x92'));_0x2d8e2c[_0x9fad('0x7')]('c.phone',_0x9fad('0x93'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x94'),'Contact.mobile');_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x95'),_0x9fad('0x96'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x97'),_0x9fad('0x98'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x99'),_0x9fad('0x9a'));_0x2d8e2c['field'](_0x9fad('0x9b'),_0x9fad('0x9c'));}if(_0x3cd70a[_0x9fad('0x9d')]){_0x2d8e2c[_0x9fad('0x9d')](_0x3cd70a['limit']);}if(_0x3cd70a[_0x9fad('0x9e')]){_0x2d8e2c[_0x9fad('0x9e')](_0x3cd70a[_0x9fad('0x9e')]);}return db[_0x9fad('0x72')][_0x9fad('0x73')](_0x2d8e2c[_0x9fad('0x74')](),_0x6acb8);})[_0x9fad('0x5d')](function(_0x103ed9){_0x2dcea6=_0x103ed9;var _0x1afc83=getUsersQuery(_0x24611b,_0x2dcea6);return db['sequelize']['query'](_0x1afc83[_0x9fad('0x74')](),_0x6acb8);})[_0x9fad('0x5d')](function(_0x1c76fa){_0x40e1e2=_[_0x9fad('0x9f')](_0x1c76fa,_0x2027af);if(_0x24611b===_0x9fad('0x2f')){return db[_0x9fad('0xa0')]['findOne']({'attributes':[_0x9fad('0xa1')],'raw':!![]});}})['then'](function(_0x34d334){var _0x4f5911=_0x34d334?_0x34d334[_0x9fad('0xa1')]:undefined;var _0x257edf=_0x2dcea6[_0x9fad('0x14')](function(_0x1748db){return updateInteraction(_0x1748db,_0x319457,_0x40e1e2,_0x4f5911);});return Promise[_0x9fad('0xa2')](_0x257edf);});}function countFilteredInteractions(_0x319c12,_0x48e5fd){var _0x39a0e2=_0x319c12[_0x9fad('0xa3')]();_0x39a0e2['field'](_0x9fad('0xa4'));_0x39a0e2[_0x9fad('0x7')](_0x9fad('0x78'),_0x9fad('0x40'));var _0x599499=utils[_0x9fad('0x22')](_0x48e5fd);if(!_[_0x9fad('0xa5')](_0x599499)){_0x39a0e2[_0x9fad('0x12')]('t.id\x20IN\x20?',_0x599499);}var _0x25d607={'type':db[_0x9fad('0x6f')][_0x9fad('0x70')][_0x9fad('0x71')],'raw':!![]};return db[_0x9fad('0x72')]['query'](_0x39a0e2[_0x9fad('0x74')](),_0x25d607);}module[_0x9fad('0xa6')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xa5bb=['i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','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.*','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','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','t.id\x20IN\x20?','SELECT','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','search','select','field','color','from','getInteractionFK','user_has_','_interactions','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','sms','whatsapp','includes','fax','i.from\x20LIKE\x20?','mail','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)','conditions','find','name','type','default','text','end','value','and','operator','contact','ContactId','Tag','split','map','tags','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','buildExpression','start','plainBody','some','forEach','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','tag','filter','get','capitalize','Websites','Accounts','agent','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','sequelize','query','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0xa5bb,0xc7));var _0xba5b=function(_0x1a6c95,_0x371942){_0x1a6c95=_0x1a6c95-0x0;var _0x5f1d41=_0xa5bb[_0x1a6c95];return _0x5f1d41;};'use strict';var _=require('lodash');var squel=require(_0xba5b('0x0'));var as=require(_0xba5b('0x1'));var qs=require(_0xba5b('0x2'));var updateInteraction=require(_0xba5b('0x3'))[_0xba5b('0x4')];var utils=require(_0xba5b('0x5'));var db=require(_0xba5b('0x6'))['db'];function skipInteractionsQuery(_0x3433cf,_0x514fc5,_0x51457d){var _0x140d12=![];var _0x57c740=utils[_0xba5b('0x7')](_0x3433cf);if(_0x514fc5[_0xba5b('0x8')]==='agent'&&!_0x51457d[_0xba5b('0x9')]&&!_0x51457d[_0x57c740]){_0x140d12=!![];}return _0x140d12;}function getTagsQuery(){return squel[_0xba5b('0xa')]()[_0xba5b('0xb')]('id')[_0xba5b('0xb')]('name')['field'](_0xba5b('0xc'))[_0xba5b('0xd')]('tools_tags');}function getUsersQuery(_0x5723a7,_0x29f8da){var _0x1cdabe=utils[_0xba5b('0xe')](_0x5723a7);var _0x49a8f4=_0xba5b('0xf')+_0x5723a7+_0xba5b('0x10');var _0x4b8b64=squel[_0xba5b('0xa')]()[_0xba5b('0xb')]('u.id')['field']('u.fullname')['field'](_0xba5b('0x11')+_0x1cdabe)[_0xba5b('0xd')](_0x49a8f4,'ui')[_0xba5b('0x12')](_0xba5b('0x13'),'u',_0xba5b('0x14'));if(_0x29f8da[_0xba5b('0x15')]>0x0){_0x4b8b64[_0xba5b('0x16')](_0xba5b('0x11')+_0x1cdabe+_0xba5b('0x17'),_['map'](_0x29f8da,'id'));}return _0x4b8b64;}function getInteractionsQuery(_0x3ca092){var _0x5b6a32=utils[_0xba5b('0x18')](_0x3ca092);var _0xdd88a6=utils[_0xba5b('0x7')](_0x3ca092);var _0x2ce516=utils[_0xba5b('0xe')](_0x3ca092);return squel[_0xba5b('0xa')]()[_0xba5b('0xd')](_0x5b6a32[_0xba5b('0x19')],'i')[_0xba5b('0x12')](_0xba5b('0x1a'),'c',_0xba5b('0x1b'))[_0xba5b('0x12')](_0xba5b('0x13'),'o',_0xba5b('0x1c'))[_0xba5b('0x12')](_0x5b6a32[_0xba5b('0x1d')],'a',_0xba5b('0x1e')+_0xdd88a6)[_0xba5b('0x12')](_0x5b6a32[_0xba5b('0x1f')],'me',_0xba5b('0x20')+_0x2ce516+'\x20=\x20i.id')[_0xba5b('0x12')](_0x5b6a32[_0xba5b('0x21')],'it','it.'+_0x2ce516+_0xba5b('0x22'))[_0xba5b('0x12')]('tools_tags','t',_0xba5b('0x23'));}function getSqlClauses(){var _0x54d808={'body':squel[_0xba5b('0x24')](),'contact':squel['expr'](),'default':squel[_0xba5b('0x24')](),'fields':squel['expr'](),'filter':squel[_0xba5b('0x24')](),'read':squel[_0xba5b('0x24')](),'tags':{'clause':squel[_0xba5b('0x24')](),'ids':null},'user':squel[_0xba5b('0x24')]()};return _0x54d808;}function parseTagParameter(_0x52e568){var _0x38b976=squel[_0xba5b('0x24')]();if(_0x52e568){var _0x5f4e2b=utils[_0xba5b('0x25')](_0x52e568);_0x5f4e2b['forEach'](function(_0x2b526d){_0x38b976['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b526d+',%');});}return _0x38b976;}function parseReadParameter(_0x195111){var _0x3a487e='';if(_0x195111){_0x3a487e='unreadMessages\x20{OPERATOR}\x200';if(_0x195111==='1'){_0x3a487e=_0x3a487e[_0xba5b('0x26')](_0xba5b('0x27'),'=');}else{_0x3a487e=_0x3a487e['replace'](_0xba5b('0x27'),'>');}}return _0x3a487e;}function parseSearchFilter(_0x4d1195,_0x4ff9a1){var _0x5d7442=squel[_0xba5b('0x24')]();if(_0x4ff9a1){var _0x4076b1=_0x4ff9a1[_0xba5b('0x26')]('\x5c','\x5c\x5c')[_0xba5b('0x26')](/'/g,'\x27\x27');var _0xa9735c=qs[_0xba5b('0x28')](_0x4076b1);if(qs[_0xba5b('0x29')](_0x4076b1)){_0x5d7442['or']('i.id\x20LIKE\x20?',_0xa9735c+'%');if([_0xba5b('0x2a'),_0xba5b('0x2b')][_0xba5b('0x2c')](_0x4d1195)){_0x5d7442['or']('i.phone\x20LIKE\x20?',_0xa9735c+'%');}else if(_0x4d1195===_0xba5b('0x2d')){_0x5d7442['or']('i.fax\x20LIKE\x20?',_0xa9735c+'%');}else if(_0x4d1195==='openchannel'){_0x5d7442['or'](_0xba5b('0x2e'),_0xa9735c+'%');}}else if(_0x4d1195===_0xba5b('0x2f')&&qs['isEmail'](_0x4076b1)){_0x5d7442['or']('c.email\x20LIKE\x20?',_0xa9735c+'%');}else{if(_0x4d1195===_0xba5b('0x2f')){_0x5d7442['or'](_0xba5b('0x30'),qs[_0xba5b('0x31')](_0x4076b1,!![]))['or'](_0xba5b('0x32'),qs[_0xba5b('0x31')](_0x4076b1));}else if(_0x4d1195!==_0xba5b('0x2d')){_0x5d7442['or'](_0xba5b('0x33'),qs[_0xba5b('0x31')](_0x4076b1));}_0x5d7442['or'](_0xba5b('0x34'),qs['getFullTextValue'](_0x4076b1,!![]),null);}}return _0x5d7442;}function parseAdvancedSearchFilter(_0x4eb019,_0x534ef4){var _0x53c6f8=getSqlClauses();var _0x386c1a=as['parseSearch'](_0x4eb019);var _0x48befa=_0x386c1a['sqlOperator'];for(var _0x19ceae=0x0;_0x19ceae<_0x386c1a[_0xba5b('0x35')][_0xba5b('0x15')];_0x19ceae++){var _0x5c1991=_0x386c1a[_0xba5b('0x35')][_0x19ceae];var _0x75e8a2='i';var _0x2a16e7=_[_0xba5b('0x36')](_0x534ef4,[_0xba5b('0x37'),_0x5c1991[_0xba5b('0xb')]]);if(_0x2a16e7){var _0x4ce38d=as['buildExpression'](_0x75e8a2,_0x2a16e7[_0xba5b('0x38')],_0x5c1991);_0x53c6f8[_0xba5b('0x39')][_0x48befa](_0x4ce38d[_0xba5b('0x3a')],_0x4ce38d['value']['start'],_0x4ce38d['value'][_0xba5b('0x3b')]);}else{switch(_0x5c1991[_0xba5b('0xb')]){case'unreadMessages':var _0x1ac86a=parseReadParameter(_0x5c1991[_0xba5b('0x3c')]);_0x53c6f8['read'][_0xba5b('0x3d')](_0x1ac86a);break;case'Contact':if(_0x5c1991[_0xba5b('0x3e')]==='$substring'){if(_0x5c1991[_0xba5b('0x3c')]['split']('\x20')[_0xba5b('0x15')]>0x1){_0x53c6f8['contact'][_0x48befa](_0xba5b('0x34'),qs['getFullTextValue'](_0x5c1991[_0xba5b('0x3c')],!![]),null);}else{var _0xfa96fa='%'+_0x5c1991[_0xba5b('0x3c')]+'%';_0x53c6f8[_0xba5b('0x3f')][_0x48befa]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xfa96fa,_0xfa96fa,_0xfa96fa);}}else{_0x2a16e7=_[_0xba5b('0x36')](_0x534ef4,[_0xba5b('0x37'),_0xba5b('0x40')]);_0x5c1991[_0xba5b('0xb')]='ContactId';_0x4ce38d=as['buildExpression'](_0x75e8a2,_0x2a16e7[_0xba5b('0x38')],_0x5c1991);_0x53c6f8['contact'][_0x48befa](_0x4ce38d['text'],_0x4ce38d[_0xba5b('0x3c')]['start'],_0x4ce38d[_0xba5b('0x3c')][_0xba5b('0x3b')]);}break;case _0xba5b('0x41'):var _0x42f766=_0x5c1991[_0xba5b('0x3c')][_0xba5b('0x42')](',')[_0xba5b('0x43')](function(_0x46059c){return Number(_0x46059c);});var _0x100a9c=parseTagParameter(_0x42f766);_0x53c6f8['tags']['clause'][_0xba5b('0x3d')](_0x100a9c);_0x53c6f8[_0xba5b('0x44')][_0xba5b('0x45')]=_0x42f766;break;case'User':if(_0x5c1991[_0xba5b('0x3e')]==='$substring'){_0x53c6f8[_0xba5b('0x46')][_0x48befa](_0xba5b('0x47'),'%'+_0x5c1991['value']+'%',null);}else{_0x2a16e7=_[_0xba5b('0x36')](_0x534ef4,['name',_0xba5b('0x48')]);_0x5c1991[_0xba5b('0xb')]='UserId';_0x4ce38d=as[_0xba5b('0x49')](_0x75e8a2,_0x2a16e7[_0xba5b('0x38')],_0x5c1991);_0x53c6f8[_0xba5b('0x46')][_0x48befa](_0x4ce38d[_0xba5b('0x3a')],_0x4ce38d[_0xba5b('0x3c')][_0xba5b('0x4a')],_0x4ce38d[_0xba5b('0x3c')][_0xba5b('0x3b')]);}break;case'body':case _0xba5b('0x4b'):_0x4ce38d=as[_0xba5b('0x49')]('me',null,_0x5c1991);_0x53c6f8['body'][_0x48befa](_0x4ce38d[_0xba5b('0x3a')],_0x4ce38d['value'][_0xba5b('0x4a')],_0x4ce38d[_0xba5b('0x3c')]['end']);break;}}}return _0x53c6f8;}function parseModelFields(_0x59b587,_0x4bdea8,_0x26443e){var _0x3b8efa=utils[_0xba5b('0x7')](_0x59b587);var _0x485c2c=squel[_0xba5b('0x24')]();var _0x42e153=_(_0x4bdea8)['keys']()[_0xba5b('0x43')](function(_0x59aa6a){return _[_0xba5b('0x4c')](_0x26443e,['name',_0x59aa6a])?_0x59aa6a:undefined;})['compact']()['value']();if(_0x42e153['length']>0x0){_0x42e153[_0xba5b('0x4d')](function(_0x720f3c){if(_0x720f3c===_0x3b8efa){_0x485c2c[_0xba5b('0x3d')]('i.'+_0x3b8efa+'\x20IN\x20?',[]['concat'](_0x4bdea8[_0x720f3c]));}else if(_0x720f3c===_0xba5b('0x4e')){var _0x1da9c4=JSON[_0xba5b('0x4f')](_0x4bdea8[_0x720f3c])[_0xba5b('0x50')];var _0x56b641=JSON['parse'](_0x4bdea8[_0x720f3c])['$lte'];_0x485c2c[_0xba5b('0x3d')](_0xba5b('0x51'),_0x1da9c4,_0x56b641);}else{if(_0x4bdea8[_0x720f3c]==='null'){_0x485c2c[_0xba5b('0x3d')]('i.'+_0x720f3c+_0xba5b('0x52'));}else{_0x485c2c[_0xba5b('0x3d')]('i.'+_0x720f3c+_0xba5b('0x53'),_0x4bdea8[_0x720f3c]);}}});}return _0x485c2c;}function parseQueryParameters(_0x15cf48,_0x388060,_0x396c23){var _0x1fdb23=getSqlClauses();return Promise[_0xba5b('0x54')]()[_0xba5b('0x55')](function(){return parseModelFields(_0x15cf48,_0x388060,_0x396c23);})[_0xba5b('0x55')](function(_0x4268cb){_0x1fdb23[_0xba5b('0x56')][_0xba5b('0x3d')](_0x4268cb);return parseReadParameter(_0x388060[_0xba5b('0x57')]);})[_0xba5b('0x55')](function(_0x26f1c9){_0x1fdb23[_0xba5b('0x57')][_0xba5b('0x3d')](_0x26f1c9);return parseTagParameter(_0x388060[_0xba5b('0x58')]);})[_0xba5b('0x55')](function(_0x5e1efc){_0x1fdb23[_0xba5b('0x44')]['clause'][_0xba5b('0x3d')](_0x5e1efc);return parseSearchFilter(_0x15cf48,_0x388060[_0xba5b('0x59')]);})[_0xba5b('0x55')](function(_0x513c95){_0x1fdb23[_0xba5b('0x59')]=_0x513c95;return _0x1fdb23;});}function checkAccountsRestrictions(_0x4399fa,_0x160e8a,_0x3255df){var _0x11e28=utils[_0xba5b('0x7')](_0x4399fa);var _0x5144d8=_0xba5b('0x5a')+_[_0xba5b('0x5b')](_0x4399fa)+(_0x4399fa==='chat'?_0xba5b('0x5c'):_0xba5b('0x5d'));var _0x8ac394=squel[_0xba5b('0x24')]();return Promise[_0xba5b('0x54')]()['then'](function(){if(_0x3255df[_0xba5b('0x9')]&&_0x160e8a[_0xba5b('0x8')]===_0xba5b('0x5e')){return _0x160e8a[_0x5144d8]({'attributes':['id'],'raw':!![]});}})[_0xba5b('0x55')](function(_0x2acf28){if(_0x2acf28){if(_0x2acf28['length']===0x0){_0x8ac394[_0xba5b('0x3d')]('i.'+_0x11e28+_0xba5b('0x52'));}else{_0x8ac394[_0xba5b('0x3d')]('i.'+_0x11e28+_0xba5b('0x17'),_[_0xba5b('0x43')](_0x2acf28,'id'));}}else if(!_0x3255df[_0x11e28]){_0x8ac394[_0xba5b('0x3d')]('i.'+_0x11e28+'\x20IS\x20NOT\x20NULL');}})[_0xba5b('0x55')](function(){return _0x8ac394;});}function getClosedOrderClause(_0x312365,_0x4256c9){var _0x3ecc68='';var _0x545f67=[_0xba5b('0x5f'),_0xba5b('0x60'),_0xba5b('0x61')];if(_0x312365==='mail'){_0x545f67[_0xba5b('0x62')](_0xba5b('0x63'));}if(_0x4256c9['closed']==='0'&&_0x312365===_0xba5b('0x2f')){_0x3ecc68=_0xba5b('0x63');}else{if(_0x4256c9[_0xba5b('0x64')]==='1'){_0x545f67[_0xba5b('0x65')]();}_0x3ecc68=_0xba5b('0x66')+_0x545f67[_0xba5b('0x67')](',\x20')+')';}return _0x3ecc68;}function getFilteredInteractions(_0x45c69b,_0x278a34,_0x2bab89,_0x2c7108){var _0x376b48=utils['getInteractionFK'](_0x45c69b);var _0x34b8bb=_[_0xba5b('0x5b')](_0x45c69b)+_0xba5b('0x68');var _0x4dee52=[];var _0x5cdbf3=getTagsQuery();var _0x57456c={'type':db[_0xba5b('0x69')][_0xba5b('0x6a')]['SELECT'],'raw':!![]};var _0x3b9ed7=[];var _0x3dde03=[];return db[_0xba5b('0x6b')][_0xba5b('0x6c')](_0x5cdbf3['toString'](),_0x57456c)[_0xba5b('0x55')](function(_0xf55608){_0x4dee52=_[_0xba5b('0x6d')](_0xf55608,'id');_0x57456c=_[_0xba5b('0x6e')](_0x57456c,{'model':db[_0x34b8bb],'mapToModel':!![],'nest':!![]});if(_0x2bab89[_0xba5b('0x56')]){_0x2c7108['attributes'][_0xba5b('0x4d')](function(_0x4ad804){_0x278a34[_0xba5b('0xb')]('i.'+_0x4ad804);});}else{_0x278a34[_0xba5b('0xb')](_0xba5b('0x6f'),_0xba5b('0x70'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x71'),_0xba5b('0x72'));_0x278a34['field'](_0xba5b('0x73'),_0xba5b('0x74'));if(_0x45c69b===_0xba5b('0x2f')){_0x278a34[_0xba5b('0xb')](_0xba5b('0x75'),_0xba5b('0x76'));_0x278a34[_0xba5b('0xb')]('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');_0x278a34['field'](_0xba5b('0x77'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x78'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x79'));_0x278a34['field'](_0xba5b('0x7a'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x7b'));_0x278a34[_0xba5b('0xb')]('i.attach');_0x278a34[_0xba5b('0xb')](_0xba5b('0x7c'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x7d'));_0x278a34['field'](_0xba5b('0x7e'));_0x278a34[_0xba5b('0xb')]('i.disposition');_0x278a34['field'](_0xba5b('0x60'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x5f'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x63'));_0x278a34['field'](_0xba5b('0x7f'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x80'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x81'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x82'));}else if(_0x45c69b==='openchannel'){_0x278a34[_0xba5b('0xb')](_0xba5b('0x83'),_0xba5b('0x84'));}else{_0x278a34[_0xba5b('0xb')](_0xba5b('0x85'),_0xba5b('0x84'));}if(_0x45c69b!==_0xba5b('0x2f')){_0x278a34[_0xba5b('0xb')](_0xba5b('0x86'));}_0x278a34[_0xba5b('0xb')](_0xba5b('0x87'),_0xba5b('0x88'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x89'),_0xba5b('0x8a'));_0x278a34['field'](_0xba5b('0x8b'),'Contact.email');_0x278a34[_0xba5b('0xb')](_0xba5b('0x8c'),_0xba5b('0x8d'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x8e'),_0xba5b('0x8f'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x90'),_0xba5b('0x91'));_0x278a34[_0xba5b('0xb')](_0xba5b('0x92'),'Owner.fullname');_0x278a34[_0xba5b('0xb')](_0xba5b('0x93'),'Owner.internal');_0x278a34[_0xba5b('0xb')](_0xba5b('0x94'),_0xba5b('0x95'));}if(_0x2c7108[_0xba5b('0x96')]){_0x278a34[_0xba5b('0x96')](_0x2c7108['limit']);}if(_0x2c7108[_0xba5b('0x97')]){_0x278a34[_0xba5b('0x97')](_0x2c7108[_0xba5b('0x97')]);}return db[_0xba5b('0x6b')][_0xba5b('0x6c')](_0x278a34[_0xba5b('0x98')](),_0x57456c);})[_0xba5b('0x55')](function(_0x570a9b){_0x3b9ed7=_0x570a9b;var _0x5c0690=getUsersQuery(_0x45c69b,_0x3b9ed7);return db[_0xba5b('0x6b')][_0xba5b('0x6c')](_0x5c0690[_0xba5b('0x98')](),_0x57456c);})['then'](function(_0x4f5741){_0x3dde03=_[_0xba5b('0x99')](_0x4f5741,_0x376b48);if(_0x45c69b===_0xba5b('0x2f')){return db[_0xba5b('0x9a')]['findOne']({'attributes':[_0xba5b('0x9b')],'raw':!![]});}})[_0xba5b('0x55')](function(_0x54f77f){var _0x5b2190=_0x54f77f?_0x54f77f[_0xba5b('0x9b')]:undefined;var _0x49d67c=_0x3b9ed7['map'](function(_0x489e04){return updateInteraction(_0x489e04,_0x4dee52,_0x3dde03,_0x5b2190);});return Promise[_0xba5b('0x9c')](_0x49d67c);});}function countFilteredInteractions(_0x30ed5b,_0x61b92b){var _0x646b62=_0x30ed5b[_0xba5b('0x9d')]();_0x646b62['field'](_0xba5b('0x9e'));_0x646b62[_0xba5b('0xb')](_0xba5b('0x6f'),_0xba5b('0x70'));var _0x276752=utils[_0xba5b('0x25')](_0x61b92b);if(!_['isEmpty'](_0x276752)){_0x646b62['where'](_0xba5b('0x9f'),_0x276752);}var _0x164adb={'type':db[_0xba5b('0x69')]['QueryTypes'][_0xba5b('0xa0')],'raw':!![]};return db[_0xba5b('0x6b')]['query'](_0x646b62['toString'](),_0x164adb);}module[_0xba5b('0xa1')]={'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 7fe072c..152112a 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 _0x221e=['UserId','talking','MailMessage','findOne','out','plainBody','-id','then','trimStart','catch','Users','TagIds','lodash','../../mysqldb','map','split','forEach','push','waiting','answered','unmanaged','total','closed','disposition','abandoned'];(function(_0x16806a,_0x1b2325){var _0x3b6d5c=function(_0x194525){while(--_0x194525){_0x16806a['push'](_0x16806a['shift']());}};_0x3b6d5c(++_0x1b2325);}(_0x221e,0x89));var _0xe221=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x221e[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xe221('0x0'));var db=require(_0xe221('0x1'))['db'];function getInteractionUsers(_0x4355ce,_0x2be4a1){return new Promise(function(_0x419c8e,_0x2d852e){try{var _0x31224f=[];if(_0x2be4a1[_0x4355ce]){_0x31224f=_0x2be4a1[_0x4355ce][_0xe221('0x2')](function(_0x11f753){return{'id':_0x11f753['id'],'fullname':_0x11f753['fullname']};});}return _0x419c8e(_0x31224f);}catch(_0x25c961){_0x2d852e(_0x25c961);}});}function getInteractionTags(_0x1f38d5,_0x1bf887){var _0x565b2c=[];if(_0x1f38d5){_0x1f38d5[_0xe221('0x3')](',')[_0xe221('0x4')](function(_0x1577c9){_0x565b2c[_0xe221('0x5')](_0x1bf887[_0x1577c9]);});}return _0x565b2c;}function updateWaitingCounter(_0x5cb030){if(_0x5cb030[_0xe221('0x6')]){_0x5cb030[_0xe221('0x6')]-=0x1;}}function updateInteractionCounters(_0x1f0870){_0x1f0870[_0xe221('0x6')]=0x0;_0x1f0870['talking']=0x0;_0x1f0870[_0xe221('0x7')]=0x0;_0x1f0870[_0xe221('0x8')]=0x0;_0x1f0870['abandoned']=0x0;_0x1f0870[_0xe221('0x9')]=0x0;if(_0x1f0870[_0xe221('0xa')]){if(_0x1f0870[_0xe221('0xb')]===_0xe221('0xc')){_0x1f0870[_0xe221('0xc')]+=0x1;updateWaitingCounter(_0x1f0870);}if(_0x1f0870[_0xe221('0xd')]){_0x1f0870[_0xe221('0x7')]+=0x1;if(_0x1f0870['talking']){_0x1f0870[_0xe221('0xe')]-=0x1;}}else{if(_0x1f0870[_0xe221('0xb')]){_0x1f0870[_0xe221('0x8')]+=0x1;updateWaitingCounter(_0x1f0870);}}}else{if(!_0x1f0870['UserId']){_0x1f0870[_0xe221('0x6')]+=0x1;}if(_0x1f0870[_0xe221('0xd')]){_0x1f0870[_0xe221('0xe')]+=0x1;updateWaitingCounter(_0x1f0870);}}_0x1f0870[_0xe221('0x9')]+=0x1;return _0x1f0870;}function getLastMessageText(_0x3f9104){return db[_0xe221('0xf')][_0xe221('0x10')]({'where':{'$and':[{'MailInteractionId':_0x3f9104['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe221('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe221('0x12')],'order':_0xe221('0x13'),'raw':!![]})[_0xe221('0x14')](function(_0x7f2ea){if(_0x7f2ea&&_0x7f2ea[_0xe221('0x12')]){_0x3f9104['lastMsgText']=_[_0xe221('0x15')](_0x7f2ea['plainBody']);}return _0x3f9104;})[_0xe221('0x16')](function(_0x55889f){throw _0x55889f;});}exports['updateInteraction']=function(_0x28a454,_0x42edb7,_0x4620a4,_0x912ea0){return new Promise(function(_0x194dfa,_0x20f24a){return getInteractionUsers(_0x28a454['id'],_0x4620a4)[_0xe221('0x14')](function(_0x1a645f){_0x28a454[_0xe221('0x17')]=_0x1a645f;return getInteractionTags(_0x28a454['TagIds'],_0x42edb7);})[_0xe221('0x14')](function(_0x21cb1e){_0x28a454['Tags']=_0x21cb1e;delete _0x28a454[_0xe221('0x18')];return updateInteractionCounters(_0x28a454);})[_0xe221('0x14')](function(_0xe9be5b){if(_0x912ea0){return getLastMessageText(_0xe9be5b);}else{return _0xe9be5b;}})[_0xe221('0x14')](function(_0x1bf2da){_0x194dfa(_0x1bf2da);})[_0xe221('0x16')](function(_0x588ab0){_0x20f24a(_0x588ab0);});});}; \ No newline at end of file +var _0xc2a4=['plainBody','-id','lastMsgText','trimStart','catch','then','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','waiting','talking','answered','total','closed','disposition','abandoned','unmanaged','UserId','MailMessage','findOne','out'];(function(_0x44d1bf,_0x5f4a5a){var _0x33e1a2=function(_0xc66808){while(--_0xc66808){_0x44d1bf['push'](_0x44d1bf['shift']());}};_0x33e1a2(++_0x5f4a5a);}(_0xc2a4,0x166));var _0x4c2a=function(_0x4269cb,_0x48b027){_0x4269cb=_0x4269cb-0x0;var _0x562afa=_0xc2a4[_0x4269cb];return _0x562afa;};'use strict';var _=require(_0x4c2a('0x0'));var db=require(_0x4c2a('0x1'))['db'];function getInteractionUsers(_0x28106b,_0x4c7f27){return new Promise(function(_0x223d82,_0x103cf7){try{var _0x49dfed=[];if(_0x4c7f27[_0x28106b]){_0x49dfed=_0x4c7f27[_0x28106b][_0x4c2a('0x2')](function(_0x423506){return{'id':_0x423506['id'],'fullname':_0x423506[_0x4c2a('0x3')]};});}return _0x223d82(_0x49dfed);}catch(_0x4c0c5c){_0x103cf7(_0x4c0c5c);}});}function getInteractionTags(_0x486386,_0x314cb9){var _0x42f944=[];if(_0x486386){_0x486386[_0x4c2a('0x4')](',')['forEach'](function(_0x2411a6){_0x42f944['push'](_0x314cb9[_0x2411a6]);});}return _0x42f944;}function updateWaitingCounter(_0x12b08b){if(_0x12b08b[_0x4c2a('0x5')]){_0x12b08b[_0x4c2a('0x5')]-=0x1;}}function updateInteractionCounters(_0x5aa362){_0x5aa362[_0x4c2a('0x5')]=0x0;_0x5aa362[_0x4c2a('0x6')]=0x0;_0x5aa362[_0x4c2a('0x7')]=0x0;_0x5aa362['unmanaged']=0x0;_0x5aa362['abandoned']=0x0;_0x5aa362[_0x4c2a('0x8')]=0x0;if(_0x5aa362[_0x4c2a('0x9')]){if(_0x5aa362[_0x4c2a('0xa')]===_0x4c2a('0xb')){_0x5aa362['abandoned']+=0x1;updateWaitingCounter(_0x5aa362);}if(_0x5aa362['UserId']){_0x5aa362['answered']+=0x1;if(_0x5aa362[_0x4c2a('0x6')]){_0x5aa362['talking']-=0x1;}}else{if(_0x5aa362[_0x4c2a('0xa')]){_0x5aa362[_0x4c2a('0xc')]+=0x1;updateWaitingCounter(_0x5aa362);}}}else{if(!_0x5aa362['UserId']){_0x5aa362[_0x4c2a('0x5')]+=0x1;}if(_0x5aa362[_0x4c2a('0xd')]){_0x5aa362[_0x4c2a('0x6')]+=0x1;updateWaitingCounter(_0x5aa362);}}_0x5aa362[_0x4c2a('0x8')]+=0x1;return _0x5aa362;}function getLastMessageText(_0x1feab4){return db[_0x4c2a('0xe')][_0x4c2a('0xf')]({'where':{'$and':[{'MailInteractionId':_0x1feab4['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4c2a('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4c2a('0x11')],'order':_0x4c2a('0x12'),'raw':!![]})['then'](function(_0x2d8cbe){if(_0x2d8cbe&&_0x2d8cbe[_0x4c2a('0x11')]){_0x1feab4[_0x4c2a('0x13')]=_[_0x4c2a('0x14')](_0x2d8cbe[_0x4c2a('0x11')]);}return _0x1feab4;})[_0x4c2a('0x15')](function(_0x33cde7){throw _0x33cde7;});}exports['updateInteraction']=function(_0x517c8c,_0x5f5337,_0x2bb4a4,_0x2c378f){return new Promise(function(_0x585a16,_0x324b4e){return getInteractionUsers(_0x517c8c['id'],_0x2bb4a4)[_0x4c2a('0x16')](function(_0x2613b5){_0x517c8c['Users']=_0x2613b5;return getInteractionTags(_0x517c8c[_0x4c2a('0x17')],_0x5f5337);})[_0x4c2a('0x16')](function(_0x221078){_0x517c8c[_0x4c2a('0x18')]=_0x221078;delete _0x517c8c[_0x4c2a('0x17')];return updateInteractionCounters(_0x517c8c);})[_0x4c2a('0x16')](function(_0x26323f){if(_0x2c378f){return getLastMessageText(_0x26323f);}else{return _0x26323f;}})[_0x4c2a('0x16')](function(_0x15b3da){_0x585a16(_0x15b3da);})[_0x4c2a('0x15')](function(_0x7794dc){_0x324b4e(_0x7794dc);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index fa35212..039a0ee 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 _0x7acb=['role','null','Interaction','then','update','info','catch','error','toLowerCase','stringify','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20body=','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x2d3abc,_0x2a0d9e){var _0xc16f0=function(_0x27733){while(--_0x27733){_0x2d3abc['push'](_0x2d3abc['shift']());}};_0xc16f0(++_0x2a0d9e);}(_0x7acb,0x95));var _0xb7ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7acb[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var db=require(_0xb7ac('0x0'))['db'];var loggers={'openchannel':require(_0xb7ac('0x1'))('openchannel-interactions'),'mail':require(_0xb7ac('0x1'))(_0xb7ac('0x2')),'fax':require(_0xb7ac('0x1'))(_0xb7ac('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xb7ac('0x1'))('chat-interactions'),'whatsapp':require(_0xb7ac('0x1'))(_0xb7ac('0x4'))};function getAccountFK(_0x381523){return _[_0xb7ac('0x5')](_0x381523)+(_0x381523===_0xb7ac('0x6')?_0xb7ac('0x7'):_0xb7ac('0x8'))+'Id';}function getInteractionFK(_0x1f2768){return _[_0xb7ac('0x5')](_0x1f2768)+'InteractionId';}function getInteractionId(_0x1e0482,_0x1202c0,_0x4a11e5){if(_0x1e0482&&_0x1e0482[_[_0xb7ac('0x9')](_0x4a11e5)+_0xb7ac('0xa')]){return _0x1e0482[_['upperFirst'](_0x4a11e5)+_0xb7ac('0xa')];}else if(_0x1e0482&&_0x1e0482['id']){return _0x1e0482['id'];}else if(_0x1202c0&&_0x1202c0['id']){return _0x1202c0['id'];}else{return'unknown';}}function getInteractionsTables(_0x2731c5){return{'accounts':_0x2731c5+'_'+(_0x2731c5===_0xb7ac('0x6')?_0xb7ac('0xb'):_0xb7ac('0xc')),'interactions':_0x2731c5+_0xb7ac('0xd'),'interactionsTags':_0x2731c5+_0xb7ac('0xe'),'messages':_0x2731c5+_0xb7ac('0xf'),'userInteractions':_0xb7ac('0x10')+_0x2731c5+_0xb7ac('0xd')};}function getSelectedTags(_0x1c09bc){var _0x8500da=[];if(_0x1c09bc){_0x8500da=Array[_0xb7ac('0x11')](_0x1c09bc)?_0x1c09bc:[_0x1c09bc];}return _0x8500da;}function log(_0x5a9352,_0x3c42e1,_0xa1b390,_0x2824c2,_0x1df927,_0x20179d){loggers[_0x1df927['toLowerCase']()][_0x5a9352](_0xb7ac('0x12'),_0x20179d[_0xb7ac('0x13')](),_0x3c42e1?_0x3c42e1['id']:null,_0x3c42e1?_0x3c42e1[_0xb7ac('0x14')]:null,_0x3c42e1?_0x3c42e1[_0xb7ac('0x15')]:null,getInteractionId(_0xa1b390,_0x2824c2,_0x1df927),_0xa1b390?JSON['stringify'](_0xa1b390):_0xb7ac('0x16'));}function updateUser(_0x15841a,_0x305ba2,_0xf2d3cf,_0x2859a8,_0xcd1cf4){db[_[_0xb7ac('0x9')](_0x2859a8)+_0xb7ac('0x17')]['findOne']({'where':{'id':getInteractionId(_0x305ba2,_0xf2d3cf,_0x2859a8)}})[_0xb7ac('0x18')](function(_0x2edf89){if(_0x2edf89){return _0x2edf89[_0xb7ac('0x19')]({'UserId':_0x15841a?_0x15841a['id']:null});}})[_0xb7ac('0x18')](function(_0x4c3ce2){if(_0x4c3ce2){log(_0xb7ac('0x1a'),_0x15841a,_0x305ba2,_0xf2d3cf,_0x2859a8,_0xcd1cf4);}})[_0xb7ac('0x1b')](function(){log(_0xb7ac('0x1c'),_0x15841a,_0x305ba2,_0xf2d3cf,_0x2859a8,_0xcd1cf4);});}function logAcceptMessage(_0x2e4c42,_0x18f91e,_0x39b607,_0x2cac8c){var _0x2d04c8=loggers[_0x2e4c42[_0xb7ac('0x1d')]()];var _0xac3310=_0x18f91e['id'];var _0x25d4a3=_0x18f91e['name'];var _0x3b43f6=_0x18f91e['role'];var _0x269762=JSON[_0xb7ac('0x1e')](_0x2cac8c||null);_0x2d04c8['info']('['+_0x2e4c42['toUpperCase']()+_0xb7ac('0x1f')+_0xac3310+_0xb7ac('0x20')+_0x25d4a3+'\x20role='+_0x3b43f6+'\x20interaction='+_0x39b607+_0xb7ac('0x21')+_0x269762);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x744f=['update','then','info','error','stringify','MESSAGE:ACCEPT]\x20id=','\x20role=','\x20interaction=','\x20body=','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','InteractionId','upperFirst','unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction'];(function(_0x449c88,_0x3e7aab){var _0x148220=function(_0x18a5f5){while(--_0x18a5f5){_0x449c88['push'](_0x449c88['shift']());}};_0x148220(++_0x3e7aab);}(_0x744f,0x96));var _0xf744=function(_0x4f9b88,_0x39065a){_0x4f9b88=_0x4f9b88-0x0;var _0x2521aa=_0x744f[_0x4f9b88];return _0x2521aa;};'use strict';var _=require('lodash');var db=require(_0xf744('0x0'))['db'];var loggers={'openchannel':require(_0xf744('0x1'))(_0xf744('0x2')),'mail':require(_0xf744('0x1'))(_0xf744('0x3')),'fax':require('../../config/logger')(_0xf744('0x4')),'sms':require(_0xf744('0x1'))('sms-interactions'),'chat':require(_0xf744('0x1'))('chat-interactions'),'whatsapp':require(_0xf744('0x1'))(_0xf744('0x5'))};function getAccountFK(_0x4fe4e2){return _[_0xf744('0x6')](_0x4fe4e2)+(_0x4fe4e2===_0xf744('0x7')?'Website':'Account')+'Id';}function getInteractionFK(_0x171a25){return _[_0xf744('0x6')](_0x171a25)+_0xf744('0x8');}function getInteractionId(_0x4fb5a5,_0x4575c7,_0xe6b503){if(_0x4fb5a5&&_0x4fb5a5[_[_0xf744('0x9')](_0xe6b503)+'InteractionId']){return _0x4fb5a5[_[_0xf744('0x9')](_0xe6b503)+_0xf744('0x8')];}else if(_0x4fb5a5&&_0x4fb5a5['id']){return _0x4fb5a5['id'];}else if(_0x4575c7&&_0x4575c7['id']){return _0x4575c7['id'];}else{return _0xf744('0xa');}}function getInteractionsTables(_0x93c4b8){return{'accounts':_0x93c4b8+'_'+(_0x93c4b8==='chat'?_0xf744('0xb'):_0xf744('0xc')),'interactions':_0x93c4b8+'_interactions','interactionsTags':_0x93c4b8+_0xf744('0xd'),'messages':_0x93c4b8+_0xf744('0xe'),'userInteractions':_0xf744('0xf')+_0x93c4b8+_0xf744('0x10')};}function getSelectedTags(_0x544b57){var _0x26a326=[];if(_0x544b57){_0x26a326=Array[_0xf744('0x11')](_0x544b57)?_0x544b57:[_0x544b57];}return _0x26a326;}function log(_0x42a5af,_0x53dea9,_0x248c14,_0x1ab9f8,_0x54f6a1,_0x33a633){loggers[_0x54f6a1[_0xf744('0x12')]()][_0x42a5af](_0xf744('0x13'),_0x33a633[_0xf744('0x14')](),_0x53dea9?_0x53dea9['id']:null,_0x53dea9?_0x53dea9[_0xf744('0x15')]:null,_0x53dea9?_0x53dea9[_0xf744('0x16')]:null,getInteractionId(_0x248c14,_0x1ab9f8,_0x54f6a1),_0x248c14?JSON['stringify'](_0x248c14):_0xf744('0x17'));}function updateUser(_0x6480dc,_0x45359d,_0x2e375a,_0x1d7971,_0x1c647c){db[_[_0xf744('0x9')](_0x1d7971)+_0xf744('0x18')]['findOne']({'where':{'id':getInteractionId(_0x45359d,_0x2e375a,_0x1d7971)}})['then'](function(_0x7add25){if(_0x7add25){return _0x7add25[_0xf744('0x19')]({'UserId':_0x6480dc?_0x6480dc['id']:null});}})[_0xf744('0x1a')](function(_0x4d2096){if(_0x4d2096){log(_0xf744('0x1b'),_0x6480dc,_0x45359d,_0x2e375a,_0x1d7971,_0x1c647c);}})['catch'](function(){log(_0xf744('0x1c'),_0x6480dc,_0x45359d,_0x2e375a,_0x1d7971,_0x1c647c);});}function logAcceptMessage(_0x4d2ae4,_0x513ff9,_0x53a89b,_0x2b4295){var _0x31fefe=loggers[_0x4d2ae4[_0xf744('0x12')]()];var _0x57cb3d=_0x513ff9['id'];var _0x4e0b53=_0x513ff9[_0xf744('0x15')];var _0x48c6f5=_0x513ff9['role'];var _0x32c51b=JSON[_0xf744('0x1d')](_0x2b4295||null);_0x31fefe[_0xf744('0x1b')]('['+_0x4d2ae4[_0xf744('0x14')]()+_0xf744('0x1e')+_0x57cb3d+'\x20name='+_0x4e0b53+_0xf744('0x1f')+_0x48c6f5+_0xf744('0x20')+_0x53a89b+_0xf744('0x21')+_0x32c51b);}module[_0xf744('0x22')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index bb29d5d..ec5d290 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 _0xd6a2=['admin','isUserLimit','crypto','util','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','update','base64','utf8','final','hasOwnProperty','License','findOne','then','count','status','json','format','users','User'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd6a2,0x115));var _0x2d6a=function(_0x1ca4a4,_0x5d092b){_0x1ca4a4=_0x1ca4a4-0x0;var _0x1b2f3c=_0xd6a2[_0x1ca4a4];return _0x1b2f3c;};'use strict';var crypto=require(_0x2d6a('0x0'));var util=require(_0x2d6a('0x1'));var compose=require('composable-middleware');var db=require(_0x2d6a('0x2'))['db'];var config=require(_0x2d6a('0x3'));function getValueFromLicense(_0x2e40e0,_0x43cc1b){if(_0x2e40e0&&_0x43cc1b){if(_0x43cc1b['data1']&&_0x43cc1b[_0x2d6a('0x4')]){var _0x27376f=_0x43cc1b[_0x2d6a('0x5')];var _0x2d6d31=_0x43cc1b[_0x2d6a('0x4')];var _0x212d7d=_0x27376f['split']('-')[0x4];var _0xc166ea=_0x27376f[_0x2d6a('0x6')]('-')[0x0];var _0x4bc78a=crypto[_0x2d6a('0x7')](_0x2d6a('0x8'),util['format']('%s:%s:%s',_0x212d7d,_0x27376f,_0xc166ea));var _0xad76b5=_0x4bc78a[_0x2d6a('0x9')](_0x2d6d31,_0x2d6a('0xa'),_0x2d6a('0xb'));_0xad76b5+=_0x4bc78a[_0x2d6a('0xc')](_0x2d6a('0xb'));var _0xb770a7=JSON['parse'](_0xad76b5);return _0xb770a7[_0x2d6a('0xd')](_0x2e40e0)?_0xb770a7[_0x2e40e0]:null;}}return null;}function isLimit(_0x2fcded,_0xe341a6,_0x1b2e9a,_0x171a5f){var _0x126dd8=_0xe341a6;return compose()['use'](function(_0x236f7e,_0x2e18a4,_0x139b4b){return db[_0x2d6a('0xe')][_0x2d6a('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5ca458){var _0x40003c=getValueFromLicense(_0x2fcded,_0x5ca458);return _0x40003c?_0x40003c:_0x126dd8;})[_0x2d6a('0x10')](function(_0x2f376a){_0x126dd8=_0x2f376a;return _0x1b2e9a[_0x2d6a('0x11')](_0x171a5f);})[_0x2d6a('0x10')](function(_0x2b1581){if(_0x2b1581>=_0x126dd8){return _0x2e18a4[_0x2d6a('0x12')](0x193)[_0x2d6a('0x13')]({'message':util[_0x2d6a('0x14')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2fcded)});}_0x139b4b();})['catch'](function(_0x11d6ae){_0x139b4b(_0x11d6ae);});});}function isUserLimit(){return isLimit(_0x2d6a('0x15'),0x1,db[_0x2d6a('0x16')],{'where':{'$or':[{'role':_0x2d6a('0x17')},{'role':'user'}]}});}exports[_0x2d6a('0x18')]=isUserLimit; \ No newline at end of file +var _0x016d=['base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','format','%s:%s:%s','update'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x016d,0x102));var _0xd016=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x016d[_0x122ef9];return _0x42fba0;};'use strict';var crypto=require(_0xd016('0x0'));var util=require(_0xd016('0x1'));var compose=require(_0xd016('0x2'));var db=require(_0xd016('0x3'))['db'];var config=require(_0xd016('0x4'));function getValueFromLicense(_0x1868a2,_0x34eb8b){if(_0x1868a2&&_0x34eb8b){if(_0x34eb8b['data1']&&_0x34eb8b[_0xd016('0x5')]){var _0x30421e=_0x34eb8b[_0xd016('0x6')];var _0x4c0890=_0x34eb8b[_0xd016('0x5')];var _0x311de6=_0x30421e[_0xd016('0x7')]('-')[0x4];var _0x415ec8=_0x30421e['split']('-')[0x0];var _0x44b23=crypto[_0xd016('0x8')]('aes-256-ctr',util[_0xd016('0x9')](_0xd016('0xa'),_0x311de6,_0x30421e,_0x415ec8));var _0x144f2f=_0x44b23[_0xd016('0xb')](_0x4c0890,_0xd016('0xc'),_0xd016('0xd'));_0x144f2f+=_0x44b23[_0xd016('0xe')](_0xd016('0xd'));var _0x2ffe24=JSON[_0xd016('0xf')](_0x144f2f);return _0x2ffe24[_0xd016('0x10')](_0x1868a2)?_0x2ffe24[_0x1868a2]:null;}}return null;}function isLimit(_0x2d3010,_0x2e9b96,_0x1bea7b,_0x47e5af){var _0x19daa4=_0x2e9b96;return compose()[_0xd016('0x11')](function(_0x43100e,_0x25a3c9,_0xacfca0){return db[_0xd016('0x12')][_0xd016('0x13')]({'where':{'id':0x1},'raw':!![]})[_0xd016('0x14')](function(_0x15ea32){var _0x5511aa=getValueFromLicense(_0x2d3010,_0x15ea32);return _0x5511aa?_0x5511aa:_0x19daa4;})[_0xd016('0x14')](function(_0x59b2d8){_0x19daa4=_0x59b2d8;return _0x1bea7b[_0xd016('0x15')](_0x47e5af);})[_0xd016('0x14')](function(_0x34e97d){if(_0x34e97d>=_0x19daa4){return _0x25a3c9[_0xd016('0x16')](0x193)[_0xd016('0x17')]({'message':util[_0xd016('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2d3010)});}_0xacfca0();})[_0xd016('0x18')](function(_0x3e4a1b){_0xacfca0(_0x3e4a1b);});});}function isUserLimit(){return isLimit(_0xd016('0x19'),0x1,db[_0xd016('0x1a')],{'where':{'$or':[{'role':_0xd016('0x1b')},{'role':_0xd016('0x1c')}]}});}exports[_0xd016('0x1d')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 99f4fb1..4c63322 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 _0x82f8=['operator','value','$gt','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','>\x20?','$lte','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','utcOffset','add','hours','minutes','lodash','moment','parseSearch','startsWith','[$or]','and','replace','split','slice','shift','filter','indexOf','map','buildExpression'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x82f8,0x162));var _0x882f=function(_0x3947ee,_0x2956db){_0x3947ee=_0x3947ee-0x0;var _0x2ce2cb=_0x82f8[_0x3947ee];return _0x2ce2cb;};'use strict';var _=require(_0x882f('0x0'));var moment=require(_0x882f('0x1'));exports[_0x882f('0x2')]=function(_0x15731f){var _0x54b672={'conditions':[]};_0x54b672['sqlOperator']=_[_0x882f('0x3')](_0x15731f,_0x882f('0x4'))?'or':_0x882f('0x5');var _0x18f1f2=_0x15731f[_0x882f('0x6')]('[$and]','')['replace']('[$or]','')['split']('||');for(var _0x2f9ce1=0x0;_0x2f9ce1<_0x18f1f2['length'];_0x2f9ce1++){var _0x136837=_0x18f1f2[_0x2f9ce1][_0x882f('0x7')](':=');var _0x526b36=_0x136837[0x0];var _0x20a44e=_0x136837[_0x882f('0x8')](0x1);_0x20a44e['forEach'](function(_0x1ee4e0){var _0x4d807f=_0x1ee4e0[_0x882f('0x7')]('[')[_0x882f('0x9')]();var _0xbdeb42=_0x1ee4e0['match'](/\[(.*?)\]/g);_0xbdeb42['forEach'](function(_0x98050a){var _0x1a4e86=_0x98050a[_0x882f('0x7')]('[')[_0x882f('0xa')](function(_0x17105e){return _0x17105e[_0x882f('0xb')](']')>-0x1;})[_0x882f('0xc')](function(_0x969c79){return _0x969c79['split'](']')[0x0];})[0x0];_0x54b672['conditions']['push']({'field':_0x526b36,'operator':_0x4d807f,'value':_0x1a4e86});});});}return _0x54b672;};exports[_0x882f('0xd')]=function(_0x4b2c2c,_0x3d74df,_0x49ae45){var _0x23d8c3={};if(_0x3d74df==='DATE'){if(_0x49ae45[_0x882f('0xe')]==='$eq'){_0x49ae45[_0x882f('0xe')]='$between';_0x49ae45[_0x882f('0xf')]+=','+_0x49ae45[_0x882f('0xf')];}else if(_['includes']([_0x882f('0x10'),'$lte'],_0x49ae45['operator'])){_0x49ae45[_0x882f('0xf')]=moment(_0x49ae45['value'])['add'](0x1,_0x882f('0x11'))[_0x882f('0x12')](_0x882f('0x13'));}}if(_0x49ae45[_0x882f('0x14')]){_0x3d74df=_0x49ae45[_0x882f('0x14')];_0x23d8c3[_0x882f('0x15')]='CAST('+_0x4b2c2c+'.'+_0x49ae45[_0x882f('0x16')]+_0x882f('0x17')+_0x49ae45[_0x882f('0x14')]+')\x20'+parseOperator(_0x49ae45[_0x882f('0xe')]);}else{_0x23d8c3['text']=_0x4b2c2c+'.'+_0x49ae45[_0x882f('0x16')]+'\x20'+parseOperator(_0x49ae45[_0x882f('0xe')]);}if(_[_0x882f('0x18')]([_0x882f('0x19'),_0x882f('0x1a')],_0x49ae45[_0x882f('0xe')]))_0x23d8c3[_0x882f('0x15')]='('+_0x23d8c3[_0x882f('0x15')]+_0x882f('0x1b')+_0x4b2c2c+'.'+_0x49ae45[_0x882f('0x16')]+'\x20IS\x20NULL)';_0x23d8c3[_0x882f('0xf')]=parseValue(_0x3d74df,_0x49ae45['operator'],_0x49ae45[_0x882f('0xf')]);return _0x23d8c3;};function parseOperator(_0x1877ea){var _0xd5b1b6;switch(_0x1877ea){case _0x882f('0x1c'):_0xd5b1b6='IN\x20?';break;case'$notIn':_0xd5b1b6=_0x882f('0x1d');break;case'$eq':_0xd5b1b6=_0x882f('0x1e');break;case _0x882f('0x19'):_0xd5b1b6='<>\x20?';break;case _0x882f('0x1f'):case _0x882f('0x20'):case _0x882f('0x21'):_0xd5b1b6='LIKE\x20?';break;case'$lt':_0xd5b1b6='<\x20?';break;case _0x882f('0x10'):_0xd5b1b6=_0x882f('0x22');break;case _0x882f('0x23'):_0xd5b1b6=_0x882f('0x24');break;case _0x882f('0x25'):_0xd5b1b6=_0x882f('0x26');break;case _0x882f('0x27'):_0xd5b1b6=_0x882f('0x28');break;}return _0xd5b1b6;}function parseValue(_0x1f18f7,_0x16df80,_0xe8d35){var _0x1a564f={'start':undefined,'end':undefined};switch(_0x16df80){case _0x882f('0x1c'):case _0x882f('0x1a'):_0x1a564f[_0x882f('0x29')]=_0xe8d35['split'](',');break;case _0x882f('0x1f'):_0x1a564f[_0x882f('0x29')]='%'+_0xe8d35+'%';break;case _0x882f('0x20'):_0x1a564f['start']=_0xe8d35+'%';break;case _0x882f('0x21'):_0x1a564f['start']='%'+_0xe8d35;break;case _0x882f('0x27'):var _0xa63894=_0xe8d35[_0x882f('0x7')](',');var _0xe8d35=_0xa63894['shift']();var _0x2e2676=_0xa63894['pop']();if(_0x1f18f7==='DATE'){_0xe8d35=moment(_0xe8d35)[_0x882f('0x2a')](0x0,!![])[_0x882f('0x12')]();_0x2e2676=moment(_0x2e2676)[_0x882f('0x2a')](0x0,!![])[_0x882f('0x2b')](0x17,_0x882f('0x2c'))['add'](0x3b,_0x882f('0x2d'))[_0x882f('0x2b')](0x3b,'seconds')[_0x882f('0x12')]();}_0x1a564f={'start':_0xe8d35,'end':_0x2e2676};break;default:_0x1a564f[_0x882f('0x29')]=_0xe8d35;break;}return _0x1a564f;} \ No newline at end of file +var _0x4987=['$eq','operator','$between','includes','$gt','$lte','value','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','<=\x20?','>=\x20?','start','pop','utcOffset','hours','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','match','forEach','indexOf','map','DATE'];(function(_0x548133,_0x202b47){var _0x543ade=function(_0x2f090c){while(--_0x2f090c){_0x548133['push'](_0x548133['shift']());}};_0x543ade(++_0x202b47);}(_0x4987,0x1ba));var _0x7498=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x4987[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x7498('0x0'));var moment=require(_0x7498('0x1'));exports['parseSearch']=function(_0x95fc95){var _0x1cf107={'conditions':[]};_0x1cf107[_0x7498('0x2')]=_[_0x7498('0x3')](_0x95fc95,_0x7498('0x4'))?'or':_0x7498('0x5');var _0x335b81=_0x95fc95[_0x7498('0x6')](_0x7498('0x7'),'')[_0x7498('0x6')](_0x7498('0x4'),'')[_0x7498('0x8')]('||');for(var _0x2e02fc=0x0;_0x2e02fc<_0x335b81[_0x7498('0x9')];_0x2e02fc++){var _0x130014=_0x335b81[_0x2e02fc]['split'](':=');var _0x18989f=_0x130014[0x0];var _0x4d6786=_0x130014[_0x7498('0xa')](0x1);_0x4d6786['forEach'](function(_0x1fb6eb){var _0x40b989=_0x1fb6eb['split']('[')[_0x7498('0xb')]();var _0x432330=_0x1fb6eb[_0x7498('0xc')](/\[(.*?)\]/g);_0x432330[_0x7498('0xd')](function(_0x54132a){var _0x215e46=_0x54132a[_0x7498('0x8')]('[')['filter'](function(_0x2608b9){return _0x2608b9[_0x7498('0xe')](']')>-0x1;})[_0x7498('0xf')](function(_0x1839b1){return _0x1839b1['split'](']')[0x0];})[0x0];_0x1cf107['conditions']['push']({'field':_0x18989f,'operator':_0x40b989,'value':_0x215e46});});});}return _0x1cf107;};exports['buildExpression']=function(_0xacfb30,_0x15f836,_0x1d1af2){var _0x5182f4={};if(_0x15f836===_0x7498('0x10')){if(_0x1d1af2['operator']===_0x7498('0x11')){_0x1d1af2[_0x7498('0x12')]=_0x7498('0x13');_0x1d1af2['value']+=','+_0x1d1af2['value'];}else if(_[_0x7498('0x14')]([_0x7498('0x15'),_0x7498('0x16')],_0x1d1af2['operator'])){_0x1d1af2[_0x7498('0x17')]=moment(_0x1d1af2[_0x7498('0x17')])[_0x7498('0x18')](0x1,_0x7498('0x19'))[_0x7498('0x1a')](_0x7498('0x1b'));}}if(_0x1d1af2[_0x7498('0x1c')]){_0x15f836=_0x1d1af2[_0x7498('0x1c')];_0x5182f4[_0x7498('0x1d')]=_0x7498('0x1e')+_0xacfb30+'.'+_0x1d1af2[_0x7498('0x1f')]+_0x7498('0x20')+_0x1d1af2[_0x7498('0x1c')]+')\x20'+parseOperator(_0x1d1af2['operator']);}else{_0x5182f4[_0x7498('0x1d')]=_0xacfb30+'.'+_0x1d1af2['field']+'\x20'+parseOperator(_0x1d1af2[_0x7498('0x12')]);}if(_[_0x7498('0x14')](['$ne',_0x7498('0x21')],_0x1d1af2[_0x7498('0x12')]))_0x5182f4['text']='('+_0x5182f4['text']+'\x20OR\x20'+_0xacfb30+'.'+_0x1d1af2[_0x7498('0x1f')]+_0x7498('0x22');_0x5182f4[_0x7498('0x17')]=parseValue(_0x15f836,_0x1d1af2['operator'],_0x1d1af2[_0x7498('0x17')]);return _0x5182f4;};function parseOperator(_0x3a4954){var _0xd01928;switch(_0x3a4954){case _0x7498('0x23'):_0xd01928=_0x7498('0x24');break;case _0x7498('0x21'):_0xd01928='NOT\x20IN\x20?';break;case'$eq':_0xd01928=_0x7498('0x25');break;case'$ne':_0xd01928=_0x7498('0x26');break;case _0x7498('0x27'):case _0x7498('0x28'):case _0x7498('0x29'):_0xd01928=_0x7498('0x2a');break;case'$lt':_0xd01928=_0x7498('0x2b');break;case _0x7498('0x15'):_0xd01928='>\x20?';break;case'$lte':_0xd01928=_0x7498('0x2c');break;case'$gte':_0xd01928=_0x7498('0x2d');break;case _0x7498('0x13'):_0xd01928='BETWEEN\x20?\x20AND\x20?';break;}return _0xd01928;}function parseValue(_0x519717,_0x572a75,_0x23c10f){var _0xfe0d65={'start':undefined,'end':undefined};switch(_0x572a75){case'$in':case _0x7498('0x21'):_0xfe0d65['start']=_0x23c10f[_0x7498('0x8')](',');break;case _0x7498('0x27'):_0xfe0d65[_0x7498('0x2e')]='%'+_0x23c10f+'%';break;case'$startsWith':_0xfe0d65['start']=_0x23c10f+'%';break;case'$endsWith':_0xfe0d65['start']='%'+_0x23c10f;break;case _0x7498('0x13'):var _0x310d4f=_0x23c10f[_0x7498('0x8')](',');var _0x23c10f=_0x310d4f['shift']();var _0x13641f=_0x310d4f[_0x7498('0x2f')]();if(_0x519717===_0x7498('0x10')){_0x23c10f=moment(_0x23c10f)[_0x7498('0x30')](0x0,!![])[_0x7498('0x1a')]();_0x13641f=moment(_0x13641f)['utcOffset'](0x0,!![])[_0x7498('0x18')](0x17,_0x7498('0x31'))[_0x7498('0x18')](0x3b,'minutes')[_0x7498('0x18')](0x3b,_0x7498('0x32'))[_0x7498('0x1a')]();}_0xfe0d65={'start':_0x23c10f,'end':_0x13641f};break;default:_0xfe0d65[_0x7498('0x2e')]=_0x23c10f;break;}return _0xfe0d65;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2db03cc..48351f2 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 _0x74da=['fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','cast','col','substr','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','{EXPR}','replace','trim','forEach','push','join','getOptions','query','$id','intersection','attributes','order','where','pick','filter','includes','columns','value','merge','VIRTUAL','lower','options','includeAll','include','../../mysqldb','parse','keys','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x74da,0x17c));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var db=require(_0xa74d('0x0'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xf481cd){var _0x52e614=['ne'];try{var _0x55398b=JSON[_0xa74d('0x1')](_0xf481cd);var _0x5aaf44=Object[_0xa74d('0x2')](_0x55398b)[0x0];return _0x52e614['includes'](_0x5aaf44);}catch(_0x40f35f){return![];}}function getOperatorValue(_0x3848d4){var _0x4849cc=JSON[_0xa74d('0x1')](_0x3848d4);var _0x2062b3=Object[_0xa74d('0x2')](_0x4849cc)[0x0];var _0x570c98=_0x4849cc[_0x2062b3];return{['$'+_0x2062b3]:_0x570c98};}function parseIncludeModel(_0x4f24da){var _0x203e41=JSON[_0xa74d('0x1')](_0x4f24da);return{'model':db[_0x203e41[_0xa74d('0x3')]],'as':_0x203e41['alias'],'attributes':_0x203e41[_0xa74d('0x4')],'raw':_0x203e41[_0xa74d('0x5')]};}exports['fields']=function(_0x13b2a6){var _0x51fd6b=null;if(_0x13b2a6){_0x51fd6b=_0x13b2a6[_0xa74d('0x6')](',');}return _0x51fd6b;};exports[_0xa74d('0x7')]=function(_0x51d2a7,_0x5b8723){var _0x2f595e={};if(!_[_0xa74d('0x8')](_0x51d2a7)){_[_0xa74d('0x9')](_0x51d2a7,function(_0x501c55,_0x358ec6){try{if(_0x5b8723){var _0x3091ee=_['find'](_0x5b8723,{'name':_0x358ec6})||{};if(hasSequelizeOperator(_0x501c55)){_0x2f595e[_0x358ec6]=getOperatorValue(_0x501c55);}else if(_0x3091ee[_0xa74d('0xa')]===_0xa74d('0xb')&&_[_0xa74d('0xc')](_0x501c55)){var _0x3bb80c=JSON[_0xa74d('0x1')](_0x501c55);var _0x27e588={'$gte':moment(moment(_0x3bb80c[_0xa74d('0xd')])[_0xa74d('0xe')](_0xa74d('0xf')))['utc']()[_0xa74d('0xe')](),'$lte':moment(moment(_0x3bb80c[_0xa74d('0x10')])[_0xa74d('0xe')]('YYYY-MM-DD'))[_0xa74d('0x11')]()[_0xa74d('0x12')](0x1,'s')[_0xa74d('0xe')]()};_0x2f595e[_0x358ec6]=_0x27e588;}else if(_0x3091ee[_0xa74d('0x13')]==='uniqueid'){_0x2f595e[_0x358ec6]=_0x501c55;}else{_0x2f595e[_0x358ec6]=_[_0xa74d('0x14')](_0x501c55)?_0x501c55:JSON[_0xa74d('0x1')](_0x501c55);}}else{_0x2f595e[_0x358ec6]=_[_0xa74d('0x14')](_0x501c55)?_0x501c55:JSON[_0xa74d('0x1')](_0x501c55);}}catch(_0x3b055b){_0x2f595e[_0x358ec6]=_0x501c55[_0xa74d('0x6')](',');}});}return _0x2f595e;};exports[_0xa74d('0x15')]=function(_0x417b23){_0x417b23=parseInt(_0x417b23,0xa);if(!_0x417b23||_0x417b23<0x0){_0x417b23=LIMIT_VALUE;}return _0x417b23;};exports[_0xa74d('0x16')]=function(_0x514ade){_0x514ade=parseInt(_0x514ade,0xa);if(!_0x514ade||_0x514ade<0x0){_0x514ade=0x0;}return _0x514ade;};exports[_0xa74d('0x17')]=function(_0x1fefa4){var _0x1250c8,_0x28e2a2=null;if(_0x1fefa4){_0x1250c8=_0x1fefa4[_0xa74d('0x6')](',');_0x28e2a2=_[_0xa74d('0x18')](_0x1250c8,function(_0x275823){if(_0x275823[_0xa74d('0x19')]('-')===0x0){return[_0x275823===_0xa74d('0x1a')?sequelize[_0xa74d('0x1b')](sequelize[_0xa74d('0x1c')](_0xa74d('0x1a')),'unsigned'):_0x275823[_0xa74d('0x1d')](0x1),'DESC'];}else{return[_0x275823===_0xa74d('0x1a')?sequelize[_0xa74d('0x1b')](sequelize['col'](_0xa74d('0x1a')),'unsigned'):_0x275823,_0xa74d('0x1e')];}});}return _0x28e2a2;};exports[_0xa74d('0x1f')]=function(_0x4dac33,_0x5556db){if(_[_0xa74d('0x8')](_0x4dac33)){return _0x4dac33;}if(_[_0xa74d('0x14')](_0x4dac33)){for(var _0x4761b9=0x0;_0x4761b9<_0x4dac33[_0xa74d('0x20')];_0x4761b9+=0x1){_0x4dac33[_0x4761b9]=this['omit'](_0x4dac33[_0x4761b9],_0x5556db);}return _0x4dac33;}if(!_[_0xa74d('0x21')](_0x4dac33)){return _0x4dac33;}if(_['isString'](_0x5556db)){_0x5556db=[_0x5556db];}if(!_['isArray'](_0x5556db)){return _0x4dac33;}for(var _0xd41c4c=0x0;_0xd41c4c<_0x5556db[_0xa74d('0x20')];_0xd41c4c+=0x1){_[_0xa74d('0x22')](_0x4dac33,_0x5556db[_0xd41c4c]);}for(var _0x33afb5 in _0x4dac33){if(_0x4dac33[_0xa74d('0x23')](_0x33afb5)){_0x4dac33[_0x33afb5]=this['omit'](_0x4dac33[_0x33afb5],_0x5556db);}}return _0x4dac33;};exports[_0xa74d('0x24')]=function(_0x445740){return _0x445740[_0xa74d('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa74d('0x26')]=function(_0x443f01){return _0x443f01['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xa74d('0x27')]=function(_0x4866c6,_0x13ccea){var _0x40b731=[];var _0x56fc1a=/([^:]")"+/g;var _0x1f8a95=/[*<>~@-]/g;var _0x9236=/[ `!@#$%^&*()_\-?~<>]/;var _0x5ec5e1=/[ ,]+/;var _0x1ddb59=_0x13ccea?'\x22{EXPR}\x22':_0xa74d('0x28');if(_0x13ccea){_0x4866c6=_0x4866c6[_0xa74d('0x29')](_0x1f8a95,'\x20')[_0xa74d('0x2a')]();}_0x4866c6[_0xa74d('0x6')](_0x5ec5e1)[_0xa74d('0x2b')](function(_0x41b018){_0x41b018=_0x41b018[_0xa74d('0x29')](_0x56fc1a,'$1');_0x41b018='+'+_0x41b018+'*';var _0x2043a6=_0x41b018[_0xa74d('0x25')](_0x9236);if(_0x2043a6){_0x41b018='\x22'+_0x41b018+'\x22';}_0x40b731[_0xa74d('0x2c')](_0x41b018);});_0x1ddb59=_0x1ddb59[_0xa74d('0x29')](_0xa74d('0x28'),_0x40b731[_0xa74d('0x2d')]('\x20'));return _0x1ddb59;};exports[_0xa74d('0x2e')]=function(_0x57c8f4,_0x117b28,_0x355757){var _0x233179={},_0x4b7a9e={};if(_0x117b28[_0xa74d('0x2f')][_0xa74d('0x30')]){_0x117b28[_0xa74d('0x2f')]['id']=_0x117b28[_0xa74d('0x2f')][_0xa74d('0x30')];delete _0x117b28[_0xa74d('0x2f')][_0xa74d('0x30')];}_0x233179[_0xa74d('0x3')]=_[_0xa74d('0x18')](_0x57c8f4,_0xa74d('0x13'));_0x233179[_0xa74d('0x2f')]=_[_0xa74d('0x2')](_0x117b28[_0xa74d('0x2f')]);_0x233179['filters']=_[_0xa74d('0x31')](_0x233179['model'],_0x233179['query']);_0x4b7a9e[_0xa74d('0x32')]=_[_0xa74d('0x31')](_0x233179['model'],this['fields'](_0x117b28[_0xa74d('0x2f')][_0xa74d('0x4')]));_0x4b7a9e['attributes']=_0x4b7a9e[_0xa74d('0x32')]['length']?_0x4b7a9e[_0xa74d('0x32')]:_0x233179['model'];if(!_0x117b28[_0xa74d('0x2f')][_0xa74d('0x23')]('nolimit')){_0x4b7a9e[_0xa74d('0x15')]=this[_0xa74d('0x15')](_0x117b28[_0xa74d('0x2f')][_0xa74d('0x15')]);_0x4b7a9e[_0xa74d('0x16')]=this[_0xa74d('0x16')](_0x117b28[_0xa74d('0x2f')]['offset']);}_0x4b7a9e[_0xa74d('0x33')]=this[_0xa74d('0x17')](_0x117b28[_0xa74d('0x2f')]['sort']);_0x4b7a9e[_0xa74d('0x34')]=this[_0xa74d('0x7')](_[_0xa74d('0x35')](_0x117b28['query'],_0x233179[_0xa74d('0x7')]),_0x57c8f4);if(_0x117b28[_0xa74d('0x2f')][_0xa74d('0x36')]){var _0x78a51c=_0x57c8f4;var _0x53a994=_0x117b28[_0xa74d('0x2f')]['filter'];if(typeof _0x53a994==='object'){_0x78a51c=_[_0xa74d('0x36')](_0x57c8f4,function(_0x4e43b3){return _[_0xa74d('0x37')](_0x53a994[_0xa74d('0x38')],_0x4e43b3[_0xa74d('0x13')]);});_0x53a994=_0x53a994[_0xa74d('0x39')];}_0x4b7a9e[_0xa74d('0x34')]=_[_0xa74d('0x3a')](_0x4b7a9e[_0xa74d('0x34')],{'$or':_[_0xa74d('0x18')](_0x78a51c,function(_0x593010){if(_0x593010[_0xa74d('0xa')]!==_0xa74d('0x3b')){if(_0x355757){return sequelize[_0xa74d('0x34')](sequelize['fn'](_0xa74d('0x3c'),sequelize[_0xa74d('0x1c')](_0x593010[_0xa74d('0x13')])),{'$like':sequelize['fn'](_0xa74d('0x3c'),'%'+_0x117b28['query'][_0xa74d('0x36')]+'%')});}else{var _0x242f34={};_0x242f34[_0x593010[_0xa74d('0x13')]]={'$like':'%'+_0x117b28[_0xa74d('0x2f')]['filter']+'%'};return _0x242f34;}}})});}_0x4b7a9e=_[_0xa74d('0x3a')]({},_0x4b7a9e,_0x117b28[_0xa74d('0x3d')]);return _0x4b7a9e;};exports['include']=function(_0x1cc09f){var _0x25a093=[];if(_0x1cc09f[_0xa74d('0x3e')]){_0x25a093['push']({'all':!![]});}else if(_0x1cc09f[_0xa74d('0x3f')]){if(Array['isArray'](_0x1cc09f[_0xa74d('0x3f')])){_0x25a093=Object[_0xa74d('0x2')](_0x1cc09f['include'])['map'](function(_0x180bb8){return parseIncludeModel(_0x1cc09f[_0xa74d('0x3f')][_0x180bb8]);});}else{var _0x3a4797=parseIncludeModel(_0x1cc09f['include']);_0x25a093[_0xa74d('0x2c')](_0x3a4797);}}return _0x25a093;};exports['escapeLIKESpecialChars']=function(_0x44e0ee){return _0x44e0ee[_0xa74d('0x29')](/[%_^-]/g,function(_0x42711a){return'\x5c'+_0x42711a;});}; \ No newline at end of file +var _0xcd12=['split','filters','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','unsigned','DESC','ASC','omit','isEmpty','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','match','getFullTextValue','{EXPR}','trim','forEach','push','replace','join','getOptions','$id','query','intersection','attributes','length','nolimit','where','pick','filter','columns','value','merge','type','VIRTUAL','lower','options','include','escapeLIKESpecialChars','sequelize','moment','../../mysqldb','keys','includes','parse','model','alias','fields','raw'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0xcd12,0xc5));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require(_0x2cd1('0x0'));var moment=require(_0x2cd1('0x1'));var db=require(_0x2cd1('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x283685){var _0x3010dc=['ne'];try{var _0x2e8d27=JSON['parse'](_0x283685);var _0x138e23=Object[_0x2cd1('0x3')](_0x2e8d27)[0x0];return _0x3010dc[_0x2cd1('0x4')](_0x138e23);}catch(_0x1c3d67){return![];}}function getOperatorValue(_0x1ea7e4){var _0x3099bd=JSON[_0x2cd1('0x5')](_0x1ea7e4);var _0x5a2018=Object[_0x2cd1('0x3')](_0x3099bd)[0x0];var _0x4c2ee3=_0x3099bd[_0x5a2018];return{['$'+_0x5a2018]:_0x4c2ee3};}function parseIncludeModel(_0x12051f){var _0xe22e41=JSON[_0x2cd1('0x5')](_0x12051f);return{'model':db[_0xe22e41[_0x2cd1('0x6')]],'as':_0xe22e41[_0x2cd1('0x7')],'attributes':_0xe22e41[_0x2cd1('0x8')],'raw':_0xe22e41[_0x2cd1('0x9')]};}exports['fields']=function(_0x1b12be){var _0xe4d378=null;if(_0x1b12be){_0xe4d378=_0x1b12be[_0x2cd1('0xa')](',');}return _0xe4d378;};exports[_0x2cd1('0xb')]=function(_0x3be47a,_0x4c7808){var _0x265773={};if(!_['isEmpty'](_0x3be47a)){_[_0x2cd1('0xc')](_0x3be47a,function(_0x37d0b2,_0x4c17ab){try{if(_0x4c7808){var _0x31b299=_[_0x2cd1('0xd')](_0x4c7808,{'name':_0x4c17ab})||{};if(hasSequelizeOperator(_0x37d0b2)){_0x265773[_0x4c17ab]=getOperatorValue(_0x37d0b2);}else if(_0x31b299['type']===_0x2cd1('0xe')&&_[_0x2cd1('0xf')](_0x37d0b2)){var _0x41c57c=JSON[_0x2cd1('0x5')](_0x37d0b2);var _0x380705={'$gte':moment(moment(_0x41c57c[_0x2cd1('0x10')])[_0x2cd1('0x11')](_0x2cd1('0x12')))[_0x2cd1('0x13')]()[_0x2cd1('0x11')](),'$lte':moment(moment(_0x41c57c[_0x2cd1('0x14')])[_0x2cd1('0x11')]('YYYY-MM-DD'))[_0x2cd1('0x13')]()[_0x2cd1('0x15')](0x1,'s')[_0x2cd1('0x11')]()};_0x265773[_0x4c17ab]=_0x380705;}else if(_0x31b299[_0x2cd1('0x16')]===_0x2cd1('0x17')){_0x265773[_0x4c17ab]=_0x37d0b2;}else{_0x265773[_0x4c17ab]=_[_0x2cd1('0x18')](_0x37d0b2)?_0x37d0b2:JSON[_0x2cd1('0x5')](_0x37d0b2);}}else{_0x265773[_0x4c17ab]=_[_0x2cd1('0x18')](_0x37d0b2)?_0x37d0b2:JSON['parse'](_0x37d0b2);}}catch(_0xd5ecc1){_0x265773[_0x4c17ab]=_0x37d0b2[_0x2cd1('0xa')](',');}});}return _0x265773;};exports[_0x2cd1('0x19')]=function(_0x3efd04){_0x3efd04=parseInt(_0x3efd04,0xa);if(!_0x3efd04||_0x3efd04<0x0){_0x3efd04=LIMIT_VALUE;}return _0x3efd04;};exports[_0x2cd1('0x1a')]=function(_0x2bc058){_0x2bc058=parseInt(_0x2bc058,0xa);if(!_0x2bc058||_0x2bc058<0x0){_0x2bc058=0x0;}return _0x2bc058;};exports[_0x2cd1('0x1b')]=function(_0x4f7710){var _0x12087a,_0x41267f=null;if(_0x4f7710){_0x12087a=_0x4f7710[_0x2cd1('0xa')](',');_0x41267f=_[_0x2cd1('0x1c')](_0x12087a,function(_0x49b02f){if(_0x49b02f[_0x2cd1('0x1d')]('-')===0x0){return[_0x49b02f===_0x2cd1('0x1e')?sequelize[_0x2cd1('0x1f')](sequelize['col'](_0x2cd1('0x1e')),_0x2cd1('0x20')):_0x49b02f['substr'](0x1),_0x2cd1('0x21')];}else{return[_0x49b02f===_0x2cd1('0x1e')?sequelize[_0x2cd1('0x1f')](sequelize['col'](_0x2cd1('0x1e')),_0x2cd1('0x20')):_0x49b02f,_0x2cd1('0x22')];}});}return _0x41267f;};exports[_0x2cd1('0x23')]=function(_0x19e8c0,_0x22c4f5){if(_[_0x2cd1('0x24')](_0x19e8c0)){return _0x19e8c0;}if(_[_0x2cd1('0x18')](_0x19e8c0)){for(var _0x5002d8=0x0;_0x5002d8<_0x19e8c0['length'];_0x5002d8+=0x1){_0x19e8c0[_0x5002d8]=this[_0x2cd1('0x23')](_0x19e8c0[_0x5002d8],_0x22c4f5);}return _0x19e8c0;}if(!_[_0x2cd1('0x25')](_0x19e8c0)){return _0x19e8c0;}if(_[_0x2cd1('0x26')](_0x22c4f5)){_0x22c4f5=[_0x22c4f5];}if(!_[_0x2cd1('0x18')](_0x22c4f5)){return _0x19e8c0;}for(var _0x32fa8d=0x0;_0x32fa8d<_0x22c4f5['length'];_0x32fa8d+=0x1){_[_0x2cd1('0x27')](_0x19e8c0,_0x22c4f5[_0x32fa8d]);}for(var _0x4f745b in _0x19e8c0){if(_0x19e8c0[_0x2cd1('0x28')](_0x4f745b)){_0x19e8c0[_0x4f745b]=this[_0x2cd1('0x23')](_0x19e8c0[_0x4f745b],_0x22c4f5);}}return _0x19e8c0;};exports['isNumeric']=function(_0xf74535){return _0xf74535['match'](RegExp(_0x2cd1('0x29')))?!![]:![];};exports['isEmail']=function(_0x1bcf58){return _0x1bcf58[_0x2cd1('0x2a')](/^\S+@\S+$/)?!![]:![];};exports[_0x2cd1('0x2b')]=function(_0x30ecab,_0x4b497a){var _0x52dad2=[];var _0x1698bf=/([^:]")"+/g;var _0x3a0631=/[*<>~@-]/g;var _0x386b19=/[ `!@#$%^&*()_\-?~<>]/;var _0x3735fe=/[ ,]+/;var _0x305f11=_0x4b497a?'\x22{EXPR}\x22':_0x2cd1('0x2c');if(_0x4b497a){_0x30ecab=_0x30ecab['replace'](_0x3a0631,'\x20')[_0x2cd1('0x2d')]();}_0x30ecab[_0x2cd1('0xa')](_0x3735fe)[_0x2cd1('0x2e')](function(_0x43458b){_0x43458b=_0x43458b['replace'](_0x1698bf,'$1');_0x43458b='+'+_0x43458b+'*';var _0x36be11=_0x43458b['match'](_0x386b19);if(_0x36be11){_0x43458b='\x22'+_0x43458b+'\x22';}_0x52dad2[_0x2cd1('0x2f')](_0x43458b);});_0x305f11=_0x305f11[_0x2cd1('0x30')](_0x2cd1('0x2c'),_0x52dad2[_0x2cd1('0x31')]('\x20'));return _0x305f11;};exports[_0x2cd1('0x32')]=function(_0x1e12ae,_0x3677d7,_0x512b66){var _0x4ec155={},_0x142b33={};if(_0x3677d7['query'][_0x2cd1('0x33')]){_0x3677d7[_0x2cd1('0x34')]['id']=_0x3677d7[_0x2cd1('0x34')]['$id'];delete _0x3677d7[_0x2cd1('0x34')]['$id'];}_0x4ec155['model']=_[_0x2cd1('0x1c')](_0x1e12ae,_0x2cd1('0x16'));_0x4ec155[_0x2cd1('0x34')]=_[_0x2cd1('0x3')](_0x3677d7['query']);_0x4ec155[_0x2cd1('0xb')]=_[_0x2cd1('0x35')](_0x4ec155['model'],_0x4ec155[_0x2cd1('0x34')]);_0x142b33[_0x2cd1('0x36')]=_[_0x2cd1('0x35')](_0x4ec155[_0x2cd1('0x6')],this[_0x2cd1('0x8')](_0x3677d7[_0x2cd1('0x34')][_0x2cd1('0x8')]));_0x142b33[_0x2cd1('0x36')]=_0x142b33[_0x2cd1('0x36')][_0x2cd1('0x37')]?_0x142b33[_0x2cd1('0x36')]:_0x4ec155[_0x2cd1('0x6')];if(!_0x3677d7[_0x2cd1('0x34')]['hasOwnProperty'](_0x2cd1('0x38'))){_0x142b33[_0x2cd1('0x19')]=this['limit'](_0x3677d7[_0x2cd1('0x34')][_0x2cd1('0x19')]);_0x142b33['offset']=this[_0x2cd1('0x1a')](_0x3677d7[_0x2cd1('0x34')][_0x2cd1('0x1a')]);}_0x142b33['order']=this['sort'](_0x3677d7[_0x2cd1('0x34')][_0x2cd1('0x1b')]);_0x142b33[_0x2cd1('0x39')]=this[_0x2cd1('0xb')](_[_0x2cd1('0x3a')](_0x3677d7[_0x2cd1('0x34')],_0x4ec155[_0x2cd1('0xb')]),_0x1e12ae);if(_0x3677d7[_0x2cd1('0x34')][_0x2cd1('0x3b')]){var _0xce882a=_0x1e12ae;var _0x5631c9=_0x3677d7[_0x2cd1('0x34')]['filter'];if(typeof _0x5631c9==='object'){_0xce882a=_[_0x2cd1('0x3b')](_0x1e12ae,function(_0x15b5b0){return _[_0x2cd1('0x4')](_0x5631c9[_0x2cd1('0x3c')],_0x15b5b0[_0x2cd1('0x16')]);});_0x5631c9=_0x5631c9[_0x2cd1('0x3d')];}_0x142b33['where']=_[_0x2cd1('0x3e')](_0x142b33['where'],{'$or':_['map'](_0xce882a,function(_0x63fca5){if(_0x63fca5[_0x2cd1('0x3f')]!==_0x2cd1('0x40')){if(_0x512b66){return sequelize['where'](sequelize['fn']('lower',sequelize['col'](_0x63fca5['name'])),{'$like':sequelize['fn'](_0x2cd1('0x41'),'%'+_0x3677d7[_0x2cd1('0x34')][_0x2cd1('0x3b')]+'%')});}else{var _0x33c91d={};_0x33c91d[_0x63fca5[_0x2cd1('0x16')]]={'$like':'%'+_0x3677d7[_0x2cd1('0x34')]['filter']+'%'};return _0x33c91d;}}})});}_0x142b33=_[_0x2cd1('0x3e')]({},_0x142b33,_0x3677d7[_0x2cd1('0x42')]);return _0x142b33;};exports[_0x2cd1('0x43')]=function(_0xb32413){var _0x5f1c5e=[];if(_0xb32413['includeAll']){_0x5f1c5e[_0x2cd1('0x2f')]({'all':!![]});}else if(_0xb32413[_0x2cd1('0x43')]){if(Array[_0x2cd1('0x18')](_0xb32413[_0x2cd1('0x43')])){_0x5f1c5e=Object[_0x2cd1('0x3')](_0xb32413[_0x2cd1('0x43')])[_0x2cd1('0x1c')](function(_0x5d93e1){return parseIncludeModel(_0xb32413[_0x2cd1('0x43')][_0x5d93e1]);});}else{var _0x4cd675=parseIncludeModel(_0xb32413['include']);_0x5f1c5e['push'](_0x4cd675);}}return _0x5f1c5e;};exports[_0x2cd1('0x44')]=function(_0x47058c){return _0x47058c[_0x2cd1('0x30')](/[%_^-]/g,function(_0x3589b5){return'\x5c'+_0x3589b5;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 80a7669..a1fd401 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 _0x3445=['pauseType','find','globalStatus','catch','fields','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','openchannelPause','whatsappPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','mailStatus','faxStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','role','faxStatusTime','chatCurrentCapacity','faxCurrentCapacity','smsCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','every','length','idle','unknown','unavailable','ringing','isNil','voicePause','pause','chatStatus','smsStatus','voiceStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','flatten','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','name','fullname','smsPause'];(function(_0x4254cb,_0x391af5){var _0x2eeaad=function(_0x1850ea){while(--_0x1850ea){_0x4254cb['push'](_0x4254cb['shift']());}};_0x2eeaad(++_0x391af5);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var jayson=require(_0x5344('0x1'));var db=require(_0x5344('0x2'))['db'];var amiClient=jayson[_0x5344('0x3')][_0x5344('0x4')]({'port':0x232a});var routingClient=jayson[_0x5344('0x3')][_0x5344('0x4')]({'port':0x232c});function isAgentPaused(_0x5d75ff,_0x4a8e2b){var _0x3a602c=[_0x5d75ff[_0x5344('0x5')],_0x5d75ff[_0x5344('0x6')],_0x5d75ff[_0x5344('0x7')],_0x5d75ff['openchannelPause'],_0x5d75ff['smsPause'],_0x5d75ff['voicePause'],_0x5d75ff['whatsappPause']];if(!_0x4a8e2b)return _[_0x5344('0x8')](_0x3a602c);var _0x4adb8a=_['filter'](_0x3a602c);return _0x4adb8a[_0x5344('0x9')]>0x0&&_0x4adb8a[_0x5344('0x9')]<_0x3a602c[_0x5344('0x9')]?!![]:![];}function isIdle(_0x50041b){return _0x50041b===_0x5344('0xa')||_0x50041b===_0x5344('0xb')||_0x50041b===_0x5344('0xc')||_0x50041b===_0x5344('0xd')||_[_0x5344('0xe')](_0x50041b);}function isAgentIdle(_0x255763){if(_0x255763['voiceStatus']!==_0x5344('0xa')&&_0x255763[_0x5344('0xf')]){_0x255763['voiceStatus']=_0x5344('0x10');return![];}return _['every']([_0x255763[_0x5344('0x11')],_0x255763['faxStatus'],_0x255763['mailStatus'],_0x255763['openchannelStatus'],_0x255763[_0x5344('0x12')],_0x255763[_0x5344('0x13')],_0x255763[_0x5344('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x5344('0x15')](_0x5344('0x16'),{})[_0x5344('0x17')](function(_0x16f302){if(_0x16f302[_0x5344('0x18')]){throw new Error(_0x5344('0x19'));}var _0x405630=_0x16f302['result'];return routingClient[_0x5344('0x15')](_0x5344('0x16'),{})[_0x5344('0x17')](function(_0x215fbd){if(_0x215fbd['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x508e34=_0x215fbd[_0x5344('0x1a')];return _['merge']({},_0x405630,_0x508e34);});})['catch'](function(_0x4a636e){throw _0x4a636e;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x2630ff){var _0xa623c5=_0x5344('0xb');if(isAgentPaused(_0x2630ff))_0xa623c5=_0x5344('0x10');else if(isAgentPaused(_0x2630ff,!![]))_0xa623c5=_0x5344('0x1b');else if(isAgentIdle(_0x2630ff))_0xa623c5=_0x5344('0xa');else _0xa623c5=_0x5344('0x1c');return _0xa623c5;}exports[_0x5344('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x22caa8,_0xdcf9d1){var _0x52fd4a=_['isArray'](_0x22caa8)?_0x22caa8:[_0x22caa8];var _0x9e5807=_[_0x5344('0x1e')](_0xdcf9d1)+_0x5344('0x1f');var _0x434e0d=_[_0x5344('0x20')](_0x52fd4a,function(_0x49a578){return db[_0x9e5807][_0x5344('0x21')]({'where':{'id':_0x49a578}})[_0x5344('0x17')](function(_0xe1c211){if(!_0xe1c211)return[];return _0xe1c211[_0x5344('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x434e0d)[_0x5344('0x17')](function(_0x2fbe7a){var _0x437162=_(_0x2fbe7a)[_0x5344('0x23')]()['map']('id')['uniq']()[_0x5344('0x24')]();return _0x437162;});}exports[_0x5344('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3471a9,_0x28b50b,_0x494997){try{if(_0x28b50b[_0x5344('0x9')]>0x0){_0x3471a9=_0x3471a9[_0x5344('0x26')](function(_0xf4eafd){return _0x28b50b[_0x5344('0x27')](_0xf4eafd['id']);});}var _0x1867d6=_0x3471a9[_0x5344('0x26')](function(_0x40a526){var _0x4d87bc=_0x5344('0x1c');if(isAgentIdle(_0x40a526)){_0x4d87bc='idle';}return _0x4d87bc===_0x494997;});return _[_0x5344('0x20')](_0x1867d6,'id');}catch(_0x2ad28e){throw _0x2ad28e;}}exports[_0x5344('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xdaa060,_0x43a1e2,_0x175892){return Promise[_0x5344('0x29')]()[_0x5344('0x17')](function(){if(_0x43a1e2[_0x5344('0x9')]>0x0){_0xdaa060=_0xdaa060['filter'](function(_0x477639){return _0x43a1e2[_0x5344('0x27')](_0x477639['id']);});}return _0xdaa060;})[_0x5344('0x17')](function(){return db[_0x5344('0x2a')]['findAll']({'attributes':['id',_0x5344('0x2b'),_0x5344('0x2c'),'chatPause',_0x5344('0x6'),_0x5344('0x7'),'openchannelPause',_0x5344('0x2d'),_0x5344('0xf'),'whatsappPause',_0x5344('0x2e')],'where':{'id':{'$in':_[_0x5344('0x20')](_0xdaa060,'id')}},'raw':!![]});})['then'](function(_0x4655fa){return _0x4655fa[_0x5344('0x20')](function(_0x32220c){var _0x311198=_[_0x5344('0x2f')](_0xdaa060,['id',_0x32220c['id']]);var _0x593598=filterAgentAttributes(_0x311198);_['merge'](_0x32220c,_0x593598);_0x32220c[_0x5344('0x30')]=getAgentStatus(_0x32220c);return _0x32220c;});})['then'](function(_0x51a9aa){var _0x57a969=sortAgentsByStatus(_0x51a9aa,_0x175892);return _[_0x5344('0x20')](_0x57a969,'id');})[_0x5344('0x31')](function(_0x5e60e3){throw _0x5e60e3;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x25b6cb){var _0x51ca57={'fields':[],'order':null};var _0x5c2d1a=_0x25b6cb['split'](',');_0x51ca57[_0x5344('0x32')]=_[_0x5344('0x26')](_0x5c2d1a,function(_0x363622){if(!_0x363622[_0x5344('0x27')](_0x5344('0x30'))){return!![];}_0x51ca57['order']=_[_0x5344('0x33')](_0x363622,'-')?_0x5344('0x34'):_0x5344('0x35');return![];});return _0x51ca57;}exports[_0x5344('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x525088){if(!_0x525088){_0x525088=_0x5344('0x37');}if(_0x525088[_0x5344('0x27')](_0x5344('0x2c'))&&!_0x525088[_0x5344('0x27')](_0x5344('0x38'))){var _0x40fe19=_0x525088[_0x5344('0x39')](0x0,_0x525088[_0x5344('0x3a')]('fullname'));_0x525088+=','+_0x40fe19+_0x5344('0x38');}return _0x525088;}exports[_0x5344('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x3f3ce4,_0x1a209e){var _0x5655ce=_0x3f3ce4[_0x5344('0x3c')](function(_0x3b7fd6,_0x51720d){if(_0x3b7fd6[_0x5344('0x30')]===_0x51720d[_0x5344('0x30')]){if(_0x3b7fd6['globalStatus']===_0x5344('0x10')){if(_0x1a209e===_0x5344('0x34')){return(_0x3b7fd6['pauseType']||'')<(_0x51720d[_0x5344('0x2e')]||'')||_0x3b7fd6[_0x5344('0x2c')][_0x5344('0x3d')]()>_0x51720d[_0x5344('0x2c')][_0x5344('0x3d')]()?0x1:-0x1;}else{return(_0x3b7fd6[_0x5344('0x2e')]||'')<(_0x51720d[_0x5344('0x2e')]||'')||_0x3b7fd6[_0x5344('0x2c')]['toLowerCase']()>_0x51720d[_0x5344('0x2c')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1a209e===_0x5344('0x34')){return _0x3b7fd6['fullname']['toLowerCase']()<_0x51720d[_0x5344('0x2c')]['toLowerCase']()?0x1:-0x1;}else{return _0x3b7fd6['fullname'][_0x5344('0x3d')]()<_0x51720d[_0x5344('0x2c')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1a209e==='DESC'){return _0x3b7fd6[_0x5344('0x30')]<_0x51720d[_0x5344('0x30')]?0x1:-0x1;}else{return _0x3b7fd6[_0x5344('0x30')]<_0x51720d[_0x5344('0x30')]?-0x1:0x1;}}});return _0x5655ce;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x76e380){var _0x497413=[_0x5344('0x3e'),_0x5344('0x3f'),_0x5344('0x40'),_0x5344('0x41'),_0x5344('0x2e'),'lastPauseAt',_0x5344('0x38'),'address',_0x5344('0x5'),_0x5344('0x42'),'mailPause',_0x5344('0x2d'),_0x5344('0x43'),_0x5344('0x6'),_0x5344('0xf'),'chatCapacity',_0x5344('0x44'),_0x5344('0x45'),_0x5344('0x46'),_0x5344('0x47'),_0x5344('0x48'),'chatCurrentCapacity',_0x5344('0x49'),_0x5344('0x4a'),'smsCurrentCapacity',_0x5344('0x4b'),'faxCurrentCapacity',_0x5344('0x11'),_0x5344('0x4c'),_0x5344('0x4d'),_0x5344('0x12'),_0x5344('0x14'),_0x5344('0x4e'),_0x5344('0x13'),'chatStatusTime',_0x5344('0x4f'),_0x5344('0x50'),_0x5344('0x51'),_0x5344('0x52'),'faxStatusTime',_0x5344('0x53'),_0x5344('0x54'),_0x5344('0x55'),'screenrecording',_0x5344('0x56'),_0x5344('0x57')];var _0x678db5=['chatPause','openchannelPause',_0x5344('0x7'),_0x5344('0x2d'),_0x5344('0x43'),'faxPause',_0x5344('0xf'),_0x5344('0x3f')];var _0x30dc2f=_(_0x76e380)[_0x5344('0x58')](_0x678db5)[_0x5344('0x59')](_0x497413)[_0x5344('0x24')]();return _0x30dc2f;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x5344('0x2b'),_0x5344('0x2c'),_0x5344('0x5a'),_0x5344('0x38'),_0x5344('0x3f'),_0x5344('0x30'),_0x5344('0x3e'),_0x5344('0x40'),'pauseType','lastPauseAt',_0x5344('0x6'),_0x5344('0x5'),_0x5344('0x7'),'openchannelPause',_0x5344('0x2d'),_0x5344('0xf'),'whatsappPause',_0x5344('0x11'),_0x5344('0x4e'),_0x5344('0x4d'),'openchannelStatus','smsStatus',_0x5344('0x13'),'whatsappStatus','chatStatusTime',_0x5344('0x5b'),_0x5344('0x50'),_0x5344('0x4f'),_0x5344('0x51'),_0x5344('0x53'),_0x5344('0x52'),'chatCapacity',_0x5344('0x48'),_0x5344('0x45'),'openchannelCapacity',_0x5344('0x46'),_0x5344('0x47'),_0x5344('0x5c'),_0x5344('0x5d'),_0x5344('0x4a'),'openchannelCurrentCapacity',_0x5344('0x5e'),_0x5344('0x4b'),_0x5344('0x56'),_0x5344('0x57'),_0x5344('0x55'),_0x5344('0x5f'),_0x5344('0x54'),'screenrecording'];}exports[_0x5344('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x24bb=['faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','chatStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','omit','role','internal','openchannelStatus','faxStatusTime','openchannelStatusTime','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','http','client','chatPause','faxPause','mailPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','pause','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','then','all','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','openchannelPause','smsPause','pauseType','find','catch','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity'];(function(_0x54c05f,_0x30fa51){var _0x57913a=function(_0x182821){while(--_0x182821){_0x54c05f['push'](_0x54c05f['shift']());}};_0x57913a(++_0x30fa51);}(_0x24bb,0x19f));var _0xb24b=function(_0x3a49d0,_0xab8397){_0x3a49d0=_0x3a49d0-0x0;var _0xe4f732=_0x24bb[_0x3a49d0];return _0xe4f732;};'use strict';var _=require(_0xb24b('0x0'));var jayson=require('jayson/promise');var db=require(_0xb24b('0x1'))['db'];var amiClient=jayson['client'][_0xb24b('0x2')]({'port':0x232a});var routingClient=jayson[_0xb24b('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x264025,_0x48ff68){var _0x52eba3=[_0x264025[_0xb24b('0x4')],_0x264025[_0xb24b('0x5')],_0x264025[_0xb24b('0x6')],_0x264025['openchannelPause'],_0x264025['smsPause'],_0x264025[_0xb24b('0x7')],_0x264025[_0xb24b('0x8')]];if(!_0x48ff68)return _[_0xb24b('0x9')](_0x52eba3);var _0x8f07ac=_[_0xb24b('0xa')](_0x52eba3);return _0x8f07ac[_0xb24b('0xb')]>0x0&&_0x8f07ac[_0xb24b('0xb')]<_0x52eba3[_0xb24b('0xb')]?!![]:![];}function isIdle(_0x50acfe){return _0x50acfe===_0xb24b('0xc')||_0x50acfe===_0xb24b('0xd')||_0x50acfe===_0xb24b('0xe')||_0x50acfe===_0xb24b('0xf')||_['isNil'](_0x50acfe);}function isAgentIdle(_0x48b94b){if(_0x48b94b[_0xb24b('0x10')]!==_0xb24b('0xc')&&_0x48b94b['voicePause']){_0x48b94b[_0xb24b('0x10')]=_0xb24b('0x11');return![];}return _[_0xb24b('0x9')]([_0x48b94b['chatStatus'],_0x48b94b[_0xb24b('0x12')],_0x48b94b[_0xb24b('0x13')],_0x48b94b['openchannelStatus'],_0x48b94b[_0xb24b('0x14')],_0x48b94b[_0xb24b('0x10')],_0x48b94b[_0xb24b('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xb24b('0x16')](_0xb24b('0x17'),{})['then'](function(_0x3f3676){if(_0x3f3676[_0xb24b('0x18')]){throw new Error(_0xb24b('0x19'));}var _0x1f7941=_0x3f3676[_0xb24b('0x1a')];return routingClient[_0xb24b('0x16')](_0xb24b('0x17'),{})['then'](function(_0x3285c4){if(_0x3285c4[_0xb24b('0x18')]){throw new Error(_0xb24b('0x1b'));}var _0x594b38=_0x3285c4[_0xb24b('0x1a')];return _[_0xb24b('0x1c')]({},_0x1f7941,_0x594b38);});})['catch'](function(_0x45f623){throw _0x45f623;});}exports[_0xb24b('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3f76f0){var _0x1a508f=_0xb24b('0xd');if(isAgentPaused(_0x3f76f0))_0x1a508f=_0xb24b('0x11');else if(isAgentPaused(_0x3f76f0,!![]))_0x1a508f='*pause';else if(isAgentIdle(_0x3f76f0))_0x1a508f=_0xb24b('0xc');else _0x1a508f=_0xb24b('0x1e');return _0x1a508f;}exports[_0xb24b('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x2e8664,_0xfc656d){var _0x5cede6=_[_0xb24b('0x20')](_0x2e8664)?_0x2e8664:[_0x2e8664];var _0x44ee07=_[_0xb24b('0x21')](_0xfc656d)+_0xb24b('0x22');var _0x4de9b6=_[_0xb24b('0x23')](_0x5cede6,function(_0x5f560f){return db[_0x44ee07]['findOne']({'where':{'id':_0x5f560f}})[_0xb24b('0x24')](function(_0x360c3e){if(!_0x360c3e)return[];return _0x360c3e['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xb24b('0x25')](_0x4de9b6)[_0xb24b('0x24')](function(_0x1f7045){var _0x10d830=_(_0x1f7045)['flatten']()['map']('id')['uniq']()[_0xb24b('0x26')]();return _0x10d830;});}exports[_0xb24b('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x38975f,_0x5d0435,_0x1f11d5){try{if(_0x5d0435[_0xb24b('0xb')]>0x0){_0x38975f=_0x38975f[_0xb24b('0xa')](function(_0x53888d){return _0x5d0435[_0xb24b('0x28')](_0x53888d['id']);});}var _0x12d30a=_0x38975f[_0xb24b('0xa')](function(_0x5de4f0){var _0xf53d92=_0xb24b('0x1e');if(isAgentIdle(_0x5de4f0)){_0xf53d92=_0xb24b('0xc');}return _0xf53d92===_0x1f11d5;});return _[_0xb24b('0x23')](_0x12d30a,'id');}catch(_0x4561b9){throw _0x4561b9;}}exports[_0xb24b('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1d2b34,_0x508323,_0x1e120b){return Promise[_0xb24b('0x2a')]()[_0xb24b('0x24')](function(){if(_0x508323[_0xb24b('0xb')]>0x0){_0x1d2b34=_0x1d2b34[_0xb24b('0xa')](function(_0x1ee935){return _0x508323[_0xb24b('0x28')](_0x1ee935['id']);});}return _0x1d2b34;})[_0xb24b('0x24')](function(){return db['User'][_0xb24b('0x2b')]({'attributes':['id',_0xb24b('0x2c'),_0xb24b('0x2d'),'chatPause','faxPause',_0xb24b('0x6'),_0xb24b('0x2e'),_0xb24b('0x2f'),_0xb24b('0x7'),_0xb24b('0x8'),_0xb24b('0x30')],'where':{'id':{'$in':_[_0xb24b('0x23')](_0x1d2b34,'id')}},'raw':!![]});})['then'](function(_0x2c2add){return _0x2c2add['map'](function(_0x1d91db){var _0x81e4d9=_[_0xb24b('0x31')](_0x1d2b34,['id',_0x1d91db['id']]);var _0x5c4d2f=filterAgentAttributes(_0x81e4d9);_[_0xb24b('0x1c')](_0x1d91db,_0x5c4d2f);_0x1d91db['globalStatus']=getAgentStatus(_0x1d91db);return _0x1d91db;});})[_0xb24b('0x24')](function(_0x3dfae8){var _0x3e5bc6=sortAgentsByStatus(_0x3dfae8,_0x1e120b);return _[_0xb24b('0x23')](_0x3e5bc6,'id');})[_0xb24b('0x32')](function(_0x572094){throw _0x572094;});}exports[_0xb24b('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x169fae){var _0x5edcf3={'fields':[],'order':null};var _0x13ac86=_0x169fae[_0xb24b('0x34')](',');_0x5edcf3[_0xb24b('0x35')]=_['filter'](_0x13ac86,function(_0x5b2936){if(!_0x5b2936[_0xb24b('0x28')](_0xb24b('0x36'))){return!![];}_0x5edcf3[_0xb24b('0x37')]=_[_0xb24b('0x38')](_0x5b2936,'-')?_0xb24b('0x39'):_0xb24b('0x3a');return![];});return _0x5edcf3;}exports[_0xb24b('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x24bd42){if(!_0x24bd42){_0x24bd42=_0xb24b('0x3c');}if(_0x24bd42[_0xb24b('0x28')](_0xb24b('0x2d'))&&!_0x24bd42[_0xb24b('0x28')]('internal')){var _0x5e97cb=_0x24bd42['substring'](0x0,_0x24bd42[_0xb24b('0x3d')](_0xb24b('0x2d')));_0x24bd42+=','+_0x5e97cb+'internal';}return _0x24bd42;}exports[_0xb24b('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x277420,_0x5008e9){var _0x41c740=_0x277420['sort'](function(_0x191bff,_0x56c7f8){if(_0x191bff[_0xb24b('0x36')]===_0x56c7f8[_0xb24b('0x36')]){if(_0x191bff[_0xb24b('0x36')]==='pause'){if(_0x5008e9==='DESC'){return(_0x191bff[_0xb24b('0x30')]||'')<(_0x56c7f8[_0xb24b('0x30')]||'')||_0x191bff[_0xb24b('0x2d')][_0xb24b('0x3f')]()>_0x56c7f8[_0xb24b('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return(_0x191bff[_0xb24b('0x30')]||'')<(_0x56c7f8['pauseType']||'')||_0x191bff[_0xb24b('0x2d')][_0xb24b('0x3f')]()>_0x56c7f8[_0xb24b('0x2d')][_0xb24b('0x3f')]()?-0x1:0x1;}}else{if(_0x5008e9==='DESC'){return _0x191bff[_0xb24b('0x2d')]['toLowerCase']()<_0x56c7f8[_0xb24b('0x2d')][_0xb24b('0x3f')]()?0x1:-0x1;}else{return _0x191bff['fullname'][_0xb24b('0x3f')]()<_0x56c7f8[_0xb24b('0x2d')][_0xb24b('0x3f')]()?-0x1:0x1;}}}else{if(_0x5008e9===_0xb24b('0x39')){return _0x191bff['globalStatus']<_0x56c7f8[_0xb24b('0x36')]?0x1:-0x1;}else{return _0x191bff[_0xb24b('0x36')]<_0x56c7f8['globalStatus']?-0x1:0x1;}}});return _0x41c740;}exports[_0xb24b('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x7dc8b6){var _0x2f4b43=[_0xb24b('0x41'),_0xb24b('0x42'),_0xb24b('0x43'),'lastPauseAt','pauseType',_0xb24b('0x44'),'internal',_0xb24b('0x45'),'chatPause',_0xb24b('0x2e'),_0xb24b('0x6'),_0xb24b('0x2f'),_0xb24b('0x8'),_0xb24b('0x5'),_0xb24b('0x7'),_0xb24b('0x46'),_0xb24b('0x47'),_0xb24b('0x48'),_0xb24b('0x49'),_0xb24b('0x4a'),_0xb24b('0x4b'),_0xb24b('0x4c'),_0xb24b('0x4d'),_0xb24b('0x4e'),'smsCurrentCapacity',_0xb24b('0x4f'),_0xb24b('0x50'),_0xb24b('0x51'),'openchannelStatus',_0xb24b('0x13'),_0xb24b('0x14'),_0xb24b('0x15'),_0xb24b('0x12'),_0xb24b('0x10'),_0xb24b('0x52'),'openchannelStatusTime','mailStatusTime',_0xb24b('0x53'),_0xb24b('0x54'),'faxStatusTime',_0xb24b('0x55'),_0xb24b('0x56'),_0xb24b('0x57'),_0xb24b('0x58'),_0xb24b('0x59'),'phoneBarEnableAutomaticScreenRecording'];var _0x22fbd1=[_0xb24b('0x4'),_0xb24b('0x2e'),_0xb24b('0x6'),_0xb24b('0x2f'),_0xb24b('0x8'),_0xb24b('0x5'),'voicePause',_0xb24b('0x42')];var _0x421b02=_(_0x7dc8b6)[_0xb24b('0x5a')](_0x22fbd1)['pick'](_0x2f4b43)[_0xb24b('0x26')]();return _0x421b02;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xb24b('0x2c'),_0xb24b('0x2d'),_0xb24b('0x5b'),_0xb24b('0x5c'),_0xb24b('0x42'),'globalStatus',_0xb24b('0x41'),_0xb24b('0x43'),_0xb24b('0x30'),_0xb24b('0x44'),_0xb24b('0x5'),'chatPause',_0xb24b('0x6'),_0xb24b('0x2e'),_0xb24b('0x2f'),'voicePause',_0xb24b('0x8'),_0xb24b('0x51'),_0xb24b('0x12'),_0xb24b('0x13'),_0xb24b('0x5d'),_0xb24b('0x14'),_0xb24b('0x10'),_0xb24b('0x15'),_0xb24b('0x52'),_0xb24b('0x5e'),'mailStatusTime',_0xb24b('0x5f'),_0xb24b('0x53'),_0xb24b('0x55'),_0xb24b('0x54'),'chatCapacity',_0xb24b('0x4b'),_0xb24b('0x48'),_0xb24b('0x47'),_0xb24b('0x49'),_0xb24b('0x4a'),'chatCurrentCapacity','faxCurrentCapacity','mailCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity',_0xb24b('0x4f'),_0xb24b('0x59'),'phoneBarEnableAutomaticScreenRecording',_0xb24b('0x57'),_0xb24b('0x60'),_0xb24b('0x56'),_0xb24b('0x58')];}exports[_0xb24b('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 7e5c67d..7f5d6ef 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 _0xd6df=['error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','get','originated','find','merge','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then'];(function(_0x48686a,_0x4bbd26){var _0x45824b=function(_0x4b6ab8){while(--_0x4b6ab8){_0x48686a['push'](_0x48686a['shift']());}};_0x45824b(++_0x4bbd26);}(_0xd6df,0x181));var _0xfd6d=function(_0x5856c0,_0x4d2167){_0x5856c0=_0x5856c0-0x0;var _0x3a4627=_0xd6df[_0x5856c0];return _0x3a4627;};'use strict';var _=require('lodash');var jayson=require(_0xfd6d('0x0'));var util=require(_0xfd6d('0x1'));var amiClient=jayson[_0xfd6d('0x2')][_0xfd6d('0x3')]({'port':0x232a});var routingClient=jayson[_0xfd6d('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xfd6d('0x4'),_0xfd6d('0x5'),_0xfd6d('0x6'),_0xfd6d('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xfd6d('0x8'),_0xfd6d('0x9'),_0xfd6d('0xa'),_0xfd6d('0xb'),_0xfd6d('0xc'),_0xfd6d('0xd'),'ringing',_0xfd6d('0xe'),_0xfd6d('0xf'),_0xfd6d('0x10'),_0xfd6d('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xfd6d('0x12'),'originated',_0xfd6d('0x13'),_0xfd6d('0x14'),'dialActive','dialMethod',_0xfd6d('0x15'),_0xfd6d('0x16'),_0xfd6d('0x17'),_0xfd6d('0x18'),_0xfd6d('0x19'),_0xfd6d('0x1a'),_0xfd6d('0x1b'),_0xfd6d('0x1c'),_0xfd6d('0x1d'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xfd6d('0x1e'),'predictiveIntervalAnsweredCalls',_0xfd6d('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0xfd6d('0x20'),_0xfd6d('0x21')];function getRealtimeQueues(_0x114582,_0x2b398b){var _0x35762f=_0x2b398b===_0xfd6d('0x22')?amiClient:routingClient;return _0x35762f[_0xfd6d('0x23')](_[_0xfd6d('0x24')](_0x2b398b)+_0xfd6d('0x25'),_0x114582)[_0xfd6d('0x26')](function(_0x313016){if(_0x313016[_0xfd6d('0x27')])throw new Error(util[_0xfd6d('0x28')](_0xfd6d('0x29'),_0x2b398b));return _0x313016[_0xfd6d('0x2a')];})[_0xfd6d('0x2b')](function(_0x2afcab){throw _0x2afcab;});}exports[_0xfd6d('0x2c')]=getRealtimeQueues;function initializeQueues(_0x446b75,_0x17f4a5,_0x1e37bd,_0x402f42){var _0x4738cb=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1e37bd===_0xfd6d('0x22')){if(_0x402f42===_0xfd6d('0x2d')){_0x4738cb=_0x4738cb[_0xfd6d('0x2e')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x402f42===_0xfd6d('0x2f')){_0x4738cb=_0x4738cb[_0xfd6d('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x446b75['map'](function(_0x3cdb90){var _0xb2a9c8=_0x3cdb90[_0xfd6d('0x30')]({'plain':!![]});_0xb2a9c8[_0xfd6d('0x6')]=0x0;_0xb2a9c8[_0xfd6d('0xb')]=0x0;_0xb2a9c8[_0xfd6d('0x5')]=0x0;_0xb2a9c8[_0xfd6d('0x4')]=0x0;_0xb2a9c8['waiting']=0x0;if(_0x1e37bd===_0xfd6d('0x22')){_0xb2a9c8['talking']=0x0;_0xb2a9c8['busy']=0x0;if(_0x402f42===_0xfd6d('0x2f')){_0xb2a9c8['pTalking']=0x0;_0xb2a9c8[_0xfd6d('0x31')]=0x0;}}var _0x47fff2=_[_0xfd6d('0x32')](_0x17f4a5,['id',_0xb2a9c8['id']]);if(_0x47fff2){_[_0xfd6d('0x33')](_0xb2a9c8,_['pick'](_0x47fff2,_0x4738cb));}return _0xb2a9c8;});}exports[_0xfd6d('0x34')]=initializeQueues; \ No newline at end of file +var _0x620a=['http','available','loggedIn','waiting','busy','invalid','loggedInDb','notInUse','ringing','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','outbound','concat','map','get','merge','pick','initializeQueues','jayson/promise','util','client'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x620a,0x8a));var _0xa620=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x620a[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var jayson=require(_0xa620('0x0'));var util=require(_0xa620('0x1'));var amiClient=jayson[_0xa620('0x2')][_0xa620('0x3')]({'port':0x232a});var routingClient=jayson[_0xa620('0x2')][_0xa620('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xa620('0x4'),_0xa620('0x5'),'paused',_0xa620('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xa620('0x7'),'inUse',_0xa620('0x8'),_0xa620('0x9'),_0xa620('0xa'),'onHold',_0xa620('0xb'),_0xa620('0xc'),_0xa620('0xd'),_0xa620('0xe'),_0xa620('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xa620('0x10'),'originated',_0xa620('0x11'),_0xa620('0x12'),'dialActive',_0xa620('0x13'),_0xa620('0x14'),_0xa620('0x15'),_0xa620('0x16'),'erlangCalls',_0xa620('0x17'),'erlangAbandonmentRate','erlangBusyFactor',_0xa620('0x18'),_0xa620('0x19'),_0xa620('0x1a'),_0xa620('0x1b'),'predictiveIntervalTotalCalls',_0xa620('0x1c'),_0xa620('0x1d'),_0xa620('0x1e'),'predictiveIntervalAvgHoldtime',_0xa620('0x1f')];function getRealtimeQueues(_0x5a8164,_0x49f38f){var _0x264b1e=_0x49f38f===_0xa620('0x20')?amiClient:routingClient;return _0x264b1e[_0xa620('0x21')](_['startCase'](_0x49f38f)+'Queues',_0x5a8164)[_0xa620('0x22')](function(_0x2dee0e){if(_0x2dee0e[_0xa620('0x23')])throw new Error(util['format'](_0xa620('0x24'),_0x49f38f));return _0x2dee0e[_0xa620('0x25')];})['catch'](function(_0x157830){throw _0x157830;});}exports[_0xa620('0x26')]=getRealtimeQueues;function initializeQueues(_0x335269,_0x267b24,_0x2b33ca,_0x2ce3a6){var _0x438c42=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2b33ca===_0xa620('0x20')){if(_0x2ce3a6===_0xa620('0x27')){_0x438c42=_0x438c42['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2ce3a6===_0xa620('0x28')){_0x438c42=_0x438c42[_0xa620('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x335269[_0xa620('0x2a')](function(_0x1d971e){var _0x173453=_0x1d971e[_0xa620('0x2b')]({'plain':!![]});_0x173453['paused']=0x0;_0x173453['loggedInDb']=0x0;_0x173453[_0xa620('0x5')]=0x0;_0x173453[_0xa620('0x4')]=0x0;_0x173453[_0xa620('0x6')]=0x0;if(_0x2b33ca==='voice'){_0x173453['talking']=0x0;_0x173453[_0xa620('0x7')]=0x0;if(_0x2ce3a6===_0xa620('0x28')){_0x173453[_0xa620('0x10')]=0x0;_0x173453['originated']=0x0;}}var _0x5146a9=_['find'](_0x267b24,['id',_0x173453['id']]);if(_0x5146a9){_[_0xa620('0x2c')](_0x173453,_[_0xa620('0x2d')](_0x5146a9,_0x438c42));}return _0x173453;});}exports[_0xa620('0x2e')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 7d0b657..5d58161 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x1ae417,_0x1b11dc){var _0x5ae66c=function(_0x58a91f){while(--_0x58a91f){_0x1ae417['push'](_0x1ae417['shift']());}};_0x5ae66c(++_0x1b11dc);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4f13f8,_0x5e13c5){var _0x1e6b83=function(_0x26e15b){while(--_0x26e15b){_0x4f13f8['push'](_0x4f13f8['shift']());}};_0x1e6b83(++_0x5e13c5);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d847912..0241908 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 _0xcf28=['utf8','replace','hostname','ipAddress','md5','update','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','digest','hex','getUuid','test','licenseToken','dmidecode\x20--string\x20system-uuid'];(function(_0x370eb5,_0x568fa3){var _0x28852f=function(_0x4e32f0){while(--_0x4e32f0){_0x370eb5['push'](_0x370eb5['shift']());}};_0x28852f(++_0x568fa3);}(_0xcf28,0x1b7));var _0x8cf2=function(_0x108a63,_0x350742){_0x108a63=_0x108a63-0x0;var _0x4d4254=_0xcf28[_0x108a63];return _0x4d4254;};'use strict';var _=require(_0x8cf2('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x8cf2('0x1'));var exec=require(_0x8cf2('0x2'))[_0x8cf2('0x3')];var config=require(_0x8cf2('0x4'));function getInterfaces(){var _0xc3ceca=[];var _0x424678=os[_0x8cf2('0x5')]();var _0x4c794a=_[_0x8cf2('0x6')](_[_0x8cf2('0x7')](_0x424678));for(var _0x12bd46=0x0;_0x12bd46<_0x4c794a[_0x8cf2('0x8')];_0x12bd46++){var _0x4de964=_0x424678[_0x4c794a[_0x12bd46]][_0x8cf2('0x9')](function(_0xff63c7){return _0xff63c7[_0x8cf2('0xa')]===_0x8cf2('0xb')&&_0xff63c7['internal']===![];});_0xc3ceca=_0xc3ceca[_0x8cf2('0xc')](_0x4de964);}return _0xc3ceca;}function getFirstInterface(){var _0x5d4d44=_[_0x8cf2('0xd')](getInterfaces());return{'macAddress':_0x5d4d44&&_0x5d4d44[_0x8cf2('0xe')]?_0x5d4d44['mac']:_0x8cf2('0xf'),'ipAddress':_0x5d4d44&&_0x5d4d44['address']?_0x5d4d44['address']:_0x8cf2('0x10')};}exports[_0x8cf2('0x11')]=getFirstInterface;function getCPUhash(){var _0x59e0a3=_[_0x8cf2('0x6')](os[_0x8cf2('0x12')]()[_0x8cf2('0x13')](function(_0xa04ad2){return _0xa04ad2[_0x8cf2('0x14')];}))[_0x8cf2('0x15')](':');return crypto[_0x8cf2('0x16')]('md5')['update'](_0x59e0a3)[_0x8cf2('0x17')](_0x8cf2('0x18'));}exports[_0x8cf2('0x19')]=function(){var _0xa4b4fc=os['platform']();var _0x8d34f4=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x8d34f4[_0x8cf2('0x1a')](config[_0x8cf2('0x1b')])){return config[_0x8cf2('0x1b')];}else if(_0xa4b4fc==='win32'){return exec(_0x8cf2('0x1c'),{'encoding':_0x8cf2('0x1d')})[_0x8cf2('0x1e')]('\x0d\x0a','');}else{var _0x176d0b=getFirstInterface();var _0x3cd607=getCPUhash();var _0x4ba85e=_0x3cd607+'|'+os[_0x8cf2('0x1f')]()+'|'+_0x176d0b['macAddress']+'|'+_0x176d0b[_0x8cf2('0x20')];var _0x2f8ae6=crypto[_0x8cf2('0x16')](_0x8cf2('0x21'))[_0x8cf2('0x22')](_0x4ba85e)[_0x8cf2('0x17')]('hex');return _0x2f8ae6[_0x8cf2('0x23')](0x0,0x8)+'-'+_0x2f8ae6[_0x8cf2('0x23')](0x8,0xc)+'-'+_0x2f8ae6[_0x8cf2('0x23')](0xc,0x10)+'-'+_0x2f8ae6[_0x8cf2('0x23')](0x10,0x14)+'-'+_0x2f8ae6[_0x8cf2('0x23')](0x14);}}; \ No newline at end of file +var _0x95ad=['map','model','join','createHash','md5','update','digest','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','family','IPv4','internal','concat','mac','address','127.0.0.1','cpus'];(function(_0x244470,_0x380cdf){var _0x55b602=function(_0x32de9c){while(--_0x32de9c){_0x244470['push'](_0x244470['shift']());}};_0x55b602(++_0x380cdf);}(_0x95ad,0x189));var _0xd95a=function(_0xf40b3d,_0x19a6c8){_0xf40b3d=_0xf40b3d-0x0;var _0x20d425=_0x95ad[_0xf40b3d];return _0x20d425;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0xd95a('0x0'));var exec=require(_0xd95a('0x1'))[_0xd95a('0x2')];var config=require(_0xd95a('0x3'));function getInterfaces(){var _0x3d46e0=[];var _0x43f328=os[_0xd95a('0x4')]();var _0xec1f5c=_[_0xd95a('0x5')](_['keys'](_0x43f328));for(var _0x4f9f77=0x0;_0x4f9f77<_0xec1f5c[_0xd95a('0x6')];_0x4f9f77++){var _0x2bcac7=_0x43f328[_0xec1f5c[_0x4f9f77]]['filter'](function(_0x1b2dc9){return _0x1b2dc9[_0xd95a('0x7')]===_0xd95a('0x8')&&_0x1b2dc9[_0xd95a('0x9')]===![];});_0x3d46e0=_0x3d46e0[_0xd95a('0xa')](_0x2bcac7);}return _0x3d46e0;}function getFirstInterface(){var _0x7210a9=_['head'](getInterfaces());return{'macAddress':_0x7210a9&&_0x7210a9[_0xd95a('0xb')]?_0x7210a9[_0xd95a('0xb')]:'00:00:00:00:00:00','ipAddress':_0x7210a9&&_0x7210a9[_0xd95a('0xc')]?_0x7210a9[_0xd95a('0xc')]:_0xd95a('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xf727d2=_[_0xd95a('0x5')](os[_0xd95a('0xe')]()[_0xd95a('0xf')](function(_0x597b9a){return _0x597b9a[_0xd95a('0x10')];}))[_0xd95a('0x11')](':');return crypto[_0xd95a('0x12')](_0xd95a('0x13'))[_0xd95a('0x14')](_0xf727d2)[_0xd95a('0x15')]('hex');}exports[_0xd95a('0x16')]=function(){var _0x13eeef=os[_0xd95a('0x17')]();var _0x8a9f58=/[0-9a-f-]{36}/;if(config[_0xd95a('0x18')]&&_0x8a9f58[_0xd95a('0x19')](config[_0xd95a('0x18')])){return config[_0xd95a('0x18')];}else if(_0x13eeef==='win32'){return exec(_0xd95a('0x1a'),{'encoding':_0xd95a('0x1b')})[_0xd95a('0x1c')]('\x0d\x0a','');}else{var _0x35fc64=getFirstInterface();var _0xf6f39=getCPUhash();var _0x21ec75=_0xf6f39+'|'+os[_0xd95a('0x1d')]()+'|'+_0x35fc64[_0xd95a('0x1e')]+'|'+_0x35fc64[_0xd95a('0x1f')];var _0x27ee26=crypto[_0xd95a('0x12')](_0xd95a('0x13'))[_0xd95a('0x14')](_0x21ec75)[_0xd95a('0x15')](_0xd95a('0x20'));return _0x27ee26[_0xd95a('0x21')](0x0,0x8)+'-'+_0x27ee26[_0xd95a('0x21')](0x8,0xc)+'-'+_0x27ee26[_0xd95a('0x21')](0xc,0x10)+'-'+_0x27ee26[_0xd95a('0x21')](0x10,0x14)+'-'+_0x27ee26['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0657a14..24cb62c 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 _0x087d=['default','util','moment','request-promise','bluebird','pkginfo','version','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','spread','message'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x087d,0xa5));var _0xd087=function(_0x233f44,_0x148a02){_0x233f44=_0x233f44-0x0;var _0x32349c=_0x087d[_0x233f44];return _0x32349c;};'use strict';var util=require(_0xd087('0x0'));var moment=require(_0xd087('0x1'));var rp=require(_0xd087('0x2'));var BPromise=require(_0xd087('0x3'));var pkginfo=require(_0xd087('0x4'))(module,_0xd087('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xd087('0x6'));var logger=require(_0xd087('0x7'))(_0xd087('0x8'));var HOST=_0xd087('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x55bb85){return new BPromise(function(_0x6e321d,_0x515a0d){var _0x48880d=util[_0xd087('0xa')](_0xd087('0xb'),HOST,_0x55bb85,module[_0xd087('0xc')][_0xd087('0x5')]);if(oldToken){_0x48880d=util[_0xd087('0xa')](_0xd087('0xd'),HOST,_0x55bb85,module['exports']['version'],oldToken);}var _0x465796={'uri':_0x48880d,'method':_0xd087('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x465796)[_0xd087('0xf')](function(_0x30a41e){_0x6e321d(_0x30a41e);})['catch'](function(_0x52a959){_0x515a0d(_0x52a959);});});}function manageLicense(_0x5f125d,_0xfcbc70){var _0x53f211=_0xfcbc70[_0xd087('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x53f211['data1']!==_0x5f125d&&!_0x53f211[_0xd087('0x11')]){oldToken=_0x53f211[_0xd087('0x12')];}httpRequest(_0x5f125d)[_0xd087('0xf')](function(_0x112ead){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x112ead[_0xd087('0x13')]){isOldTokenSent=![];if(!_0x53f211[_0xd087('0x8')]&&_0x53f211[_0xd087('0x8')]!=_0x112ead['license']||_0x53f211[_0xd087('0x8')]&&_0x53f211[_0xd087('0x11')]){logger['info'](_0xd087('0x14'));}if(_0x53f211[_0xd087('0x8')]&&!_0x53f211[_0xd087('0x11')]&&_0x53f211[_0xd087('0x8')]!=_0x112ead['license']){logger[_0xd087('0x15')](_0xd087('0x16'));}if(_0x53f211[_0xd087('0x8')]&&!_0x53f211[_0xd087('0x11')]&&_0x53f211[_0xd087('0x8')]==_0x112ead['license']){return _0xfcbc70;}return _0xfcbc70['update']({'data1':_0x5f125d,'data2':null,'license':_0x112ead['license']});}else{if(_0x112ead[_0xd087('0x8')]||_0x53f211[_0xd087('0x8')]){if(!_0x53f211[_0xd087('0x11')]){if(_0x53f211[_0xd087('0x12')]==_0x5f125d){GRAY_PERIOD_REASON=_0xd087('0x17');logger[_0xd087('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xd087('0x18');logger[_0xd087('0x15')](_0xd087('0x19'),_0x53f211[_0xd087('0x12')],_0x5f125d);}logger[_0xd087('0x15')](_0xd087('0x1a'),GRAY_PERIOD_REASON[_0xd087('0x1b')](),moment()[_0xd087('0xa')](_0xd087('0x1c')));return _0xfcbc70[_0xd087('0x1d')]({'data2':encryptor['encryptString'](moment()['format'](_0xd087('0x1c')))});}else{if(moment()[_0xd087('0x1e')](encryptor[_0xd087('0x1f')](_0x53f211[_0xd087('0x11')]),_0xd087('0x20'))>DAYS){logger['info'](_0xd087('0x21'),moment()[_0xd087('0xa')](_0xd087('0x1c')));isOldTokenSent=![];return _0xfcbc70[_0xd087('0x1d')]({'data1':_0x5f125d,'data2':null,'license':null});}}}else{if(_0x53f211[_0xd087('0x12')]!=_0x5f125d){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x53f211[_0xd087('0x12')],_0x5f125d);return _0xfcbc70['update']({'data1':_0x5f125d,'data2':null,'license':null});}}}return _0xfcbc70;})[_0xd087('0xf')](function(_0x243734){_0xfcbc70=_0x243734;})[_0xd087('0x22')](function(_0x2a51b4){logger[_0xd087('0x23')](_0x2a51b4['message']);})[_0xd087('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xd087('0x25')](),_0xfcbc70);},TIME);});}function defaultLicense(){var _0x2a687a=hardware[_0xd087('0x25')]();if(_0x2a687a){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2a687a}})[_0xd087('0x26')](function(_0x234a8a,_0x4a7a92){logger[_0xd087('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x2a687a);manageLicense(_0x2a687a,_0x234a8a);})[_0xd087('0x22')](function(_0x148e3d){logger['error'](_0x148e3d[_0xd087('0x27')]);});}}exports[_0xd087('0x28')]=defaultLicense; \ No newline at end of file +var _0xc112=['Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','get','data1','then','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update'];(function(_0x18e55e,_0x4818f8){var _0x388553=function(_0x16eea0){while(--_0x16eea0){_0x18e55e['push'](_0x18e55e['shift']());}};_0x388553(++_0x4818f8);}(_0xc112,0xf4));var _0x2c11=function(_0x5592bb,_0xfdd6af){_0x5592bb=_0x5592bb-0x0;var _0x2ffffc=_0xc112[_0x5592bb];return _0x2ffffc;};'use strict';var util=require(_0x2c11('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0x2c11('0x1'));var pkginfo=require(_0x2c11('0x2'))(module,'version');var db=require(_0x2c11('0x3'))['db'];var encryptor=require(_0x2c11('0x4'));var hardware=require(_0x2c11('0x5'));var logger=require(_0x2c11('0x6'))(_0x2c11('0x7'));var HOST=_0x2c11('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x51ccb1){return new BPromise(function(_0x50d263,_0x346b71){var _0x20542b=util[_0x2c11('0x9')](_0x2c11('0xa'),HOST,_0x51ccb1,module['exports'][_0x2c11('0xb')]);if(oldToken){_0x20542b=util[_0x2c11('0x9')](_0x2c11('0xc'),HOST,_0x51ccb1,module[_0x2c11('0xd')]['version'],oldToken);}var _0x5c72bf={'uri':_0x20542b,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x5c72bf)['then'](function(_0x13adc9){_0x50d263(_0x13adc9);})['catch'](function(_0x3d6054){_0x346b71(_0x3d6054);});});}function manageLicense(_0x521dd8,_0x49a24c){var _0x1b6fd4=_0x49a24c[_0x2c11('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x1b6fd4[_0x2c11('0xf')]!==_0x521dd8&&!_0x1b6fd4['data2']){oldToken=_0x1b6fd4['data1'];}httpRequest(_0x521dd8)[_0x2c11('0x10')](function(_0x3c9aee){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3c9aee[_0x2c11('0x11')]){isOldTokenSent=![];if(!_0x1b6fd4['license']&&_0x1b6fd4['license']!=_0x3c9aee[_0x2c11('0x7')]||_0x1b6fd4['license']&&_0x1b6fd4[_0x2c11('0x12')]){logger['info'](_0x2c11('0x13'));}if(_0x1b6fd4[_0x2c11('0x7')]&&!_0x1b6fd4[_0x2c11('0x12')]&&_0x1b6fd4['license']!=_0x3c9aee[_0x2c11('0x7')]){logger[_0x2c11('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x1b6fd4[_0x2c11('0x7')]&&!_0x1b6fd4[_0x2c11('0x12')]&&_0x1b6fd4[_0x2c11('0x7')]==_0x3c9aee[_0x2c11('0x7')]){return _0x49a24c;}return _0x49a24c[_0x2c11('0x15')]({'data1':_0x521dd8,'data2':null,'license':_0x3c9aee[_0x2c11('0x7')]});}else{if(_0x3c9aee['license']||_0x1b6fd4[_0x2c11('0x7')]){if(!_0x1b6fd4[_0x2c11('0x12')]){if(_0x1b6fd4[_0x2c11('0xf')]==_0x521dd8){GRAY_PERIOD_REASON=_0x2c11('0x16');logger[_0x2c11('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x2c11('0x17');logger[_0x2c11('0x14')](_0x2c11('0x18'),_0x1b6fd4[_0x2c11('0xf')],_0x521dd8);}logger[_0x2c11('0x14')](_0x2c11('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2c11('0x9')](_0x2c11('0x1a')));return _0x49a24c[_0x2c11('0x15')]({'data2':encryptor[_0x2c11('0x1b')](moment()[_0x2c11('0x9')](_0x2c11('0x1a')))});}else{if(moment()['diff'](encryptor[_0x2c11('0x1c')](_0x1b6fd4[_0x2c11('0x12')]),_0x2c11('0x1d'))>DAYS){logger[_0x2c11('0x14')](_0x2c11('0x1e'),moment()[_0x2c11('0x9')](_0x2c11('0x1a')));isOldTokenSent=![];return _0x49a24c[_0x2c11('0x15')]({'data1':_0x521dd8,'data2':null,'license':null});}}}else{if(_0x1b6fd4[_0x2c11('0xf')]!=_0x521dd8){logger[_0x2c11('0x14')](_0x2c11('0x18'),_0x1b6fd4[_0x2c11('0xf')],_0x521dd8);return _0x49a24c[_0x2c11('0x15')]({'data1':_0x521dd8,'data2':null,'license':null});}}}return _0x49a24c;})['then'](function(_0x3e8e95){_0x49a24c=_0x3e8e95;})['catch'](function(_0x3c16e7){logger[_0x2c11('0x1f')](_0x3c16e7[_0x2c11('0x20')]);})[_0x2c11('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x2c11('0x22')](),_0x49a24c);},TIME);});}function defaultLicense(){var _0xfcba69=hardware[_0x2c11('0x22')]();if(_0xfcba69){return db['License'][_0x2c11('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0xfcba69}})['spread'](function(_0x491977,_0x5624db){logger[_0x2c11('0x14')](_0x2c11('0x24'),_0xfcba69);manageLicense(_0xfcba69,_0x491977);})['catch'](function(_0x27458b){logger['error'](_0x27458b['message']);});}}exports[_0x2c11('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6b91a58..62bfab3 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 _0x28d0=['col','admin','telephone','users','telephones','forEach','user','count','catch','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','uuid','machineUuid','decryptString','deadline','add','days','grayReason','disabled','message','User','findAll','role','COUNT','sequelize'];(function(_0x48884c,_0x32cca4){var _0x3a2b8e=function(_0x52788e){while(--_0x52788e){_0x48884c['push'](_0x48884c['shift']());}};_0x3a2b8e(++_0x32cca4);}(_0x28d0,0x16b));var _0x028d=function(_0x156a6e,_0x4078ea){_0x156a6e=_0x156a6e-0x0;var _0x1bab0a=_0x28d0[_0x156a6e];return _0x1bab0a;};'use strict';var util=require('util');var _=require(_0x028d('0x0'));var moment=require(_0x028d('0x1'));var BPromise=require(_0x028d('0x2'));var hardware=require(_0x028d('0x3'));var encryptor=require(_0x028d('0x4'));var db=require(_0x028d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x028d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x028d('0x7'),'machineUuid':hardware[_0x028d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x028d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x028d('0x9'),'machineUuid':hardware[_0x028d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4c2554){return new BPromise(function(_0x32c4df,_0x302dde){return db[_0x028d('0xa')][_0x028d('0xb')](_[_0x028d('0xc')](_0x4c2554,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x269b83){return checkLicense(_0x269b83,null);})[_0x028d('0xd')](function(_0x36fd2f){_0x32c4df(_0x36fd2f);return;})['catch'](function(_0x21750b){_0x302dde(_0x21750b);});});}function checkLicense(_0x3c6138,_0x373b52){if(!_0x3c6138){demoLicense['uuid']=_0x3c6138[_0x028d('0xe')];return demoLicense;}try{var _0x49a25b=_0x373b52||_0x3c6138[_0x028d('0xf')];if(_[_0x028d('0x10')](_0x49a25b)){throw new Error(_0x028d('0x11'));}var _0x9d2cd7=_0x3c6138[_0x028d('0xe')];var _0x2d1be0=_0x3c6138[_0x028d('0x12')];var _0x5a602b=_0x9d2cd7['split']('-')[0x4];var _0x7e4537=_0x9d2cd7[_0x028d('0x13')]('-')[0x0];var _0xf7809=encryptor['decryptString'](_0x49a25b,util[_0x028d('0x14')](_0x028d('0x15'),_0x5a602b,_0x9d2cd7,_0x7e4537));var _0x49044b=JSON[_0x028d('0x16')](_0xf7809);_0x49044b['demo']=![];_0x49044b[_0x028d('0x17')]=_0x9d2cd7;_0x49044b[_0x028d('0x18')]=hardware[_0x028d('0x8')]();if(_0x2d1be0){var _0x56c1ec=encryptor[_0x028d('0x19')](_0x2d1be0);_0x49044b['gray']=_0x56c1ec;_0x49044b[_0x028d('0x1a')]=moment(_0x56c1ec)[_0x028d('0x1b')](0x7,_0x028d('0x1c'))[_0x028d('0x14')]();_0x49044b[_0x028d('0x1d')]=_0x49044b['uuid']!=_0x49044b[_0x028d('0x18')]?'changed':_0x028d('0x1e');}return _0x49044b;}catch(_0x1ea453){breakingLicense[_0x028d('0x17')]=_0x3c6138[_0x028d('0xe')];breakingLicense[_0x028d('0x1f')]=_0x1ea453[_0x028d('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xfc51e3,_0x21f3f7){getLicense()['then'](function(_0x19099f){return db[_0x028d('0x20')][_0x028d('0x21')]({'attributes':[_0x028d('0x22'),[db['sequelize']['fn'](_0x028d('0x23'),db[_0x028d('0x24')][_0x028d('0x25')](_0x028d('0x22'))),'count']],'group':_0x028d('0x22'),'where':{'role':{'$or':[_0x028d('0x26'),'user',_0x028d('0x27')]}},'raw':!![]})[_0x028d('0xd')](function(_0x45ffc8){var _0xb50f8b={'user':_0x19099f[_0x028d('0x28')]||0x0,'telephone':_0x19099f[_0x028d('0x29')]||0x0};_0x45ffc8[_0x028d('0x2a')](function(_0x45f9cf){var _0x35e2bd=_0x45f9cf[_0x028d('0x22')]===_0x028d('0x26')?_0x028d('0x2b'):_0x45f9cf[_0x028d('0x22')];_0xb50f8b[_0x35e2bd]-=_0x45f9cf[_0x028d('0x2c')];if(_0xb50f8b[_0x35e2bd]<0x0)_0xb50f8b[_0x35e2bd]=0x0;});_0xfc51e3(_0xb50f8b);return;});})[_0x028d('0x2d')](function(_0x31a576){_0x21f3f7(_0x31a576);});});}function checkUserLimits(_0x13d5e1){return new BPromise(function(_0x48df86,_0x51c36b){getLimits()['then'](function(_0x30fe83){var _0x23450c=_[_0x028d('0x2e')](_['countBy'](_0x13d5e1,_0x028d('0x22')),[_0x028d('0x26'),_0x028d('0x2b'),_0x028d('0x27')]);var _0x2c9182=(_0x23450c['admin']||0x0)+(_0x23450c[_0x028d('0x2b')]||0x0);var _0x4c98c1=_0x23450c[_0x028d('0x27')]||0x0;if(_0x2c9182>_0x30fe83[_0x028d('0x2b')])return _0x51c36b(_0x028d('0x2f'));if(_0x4c98c1>_0x30fe83['telephone'])return _0x51c36b(_0x028d('0x30'));return _0x48df86();})[_0x028d('0x2d')](function(_0x3d7ed0){_0x51c36b(_0x3d7ed0);});});}module[_0x028d('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8683=['License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','demo','uuid','decryptString','deadline','add','format','grayReason','machineUuid','changed','disabled','message','User','role','COUNT','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','find','defaults','then','catch','data1','isEmpty'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x8683,0x1eb));var _0x3868=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x8683[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0x3868('0x0'));var _=require(_0x3868('0x1'));var moment=require(_0x3868('0x2'));var BPromise=require('bluebird');var hardware=require(_0x3868('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x3868('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3868('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3868('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3868('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3868('0x7'),'machineUuid':hardware[_0x3868('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x18790e){return new BPromise(function(_0x52f4e6,_0x3f7430){return db['License'][_0x3868('0x9')](_[_0x3868('0xa')](_0x18790e,{'raw':!![],'where':{'id':0x1}}))[_0x3868('0xb')](function(_0x137681){return checkLicense(_0x137681,null);})[_0x3868('0xb')](function(_0x513b2f){_0x52f4e6(_0x513b2f);return;})[_0x3868('0xc')](function(_0x4f4c8d){_0x3f7430(_0x4f4c8d);});});}function checkLicense(_0x1b7113,_0x3d66b7){if(!_0x1b7113){demoLicense['uuid']=_0x1b7113[_0x3868('0xd')];return demoLicense;}try{var _0x23e99c=_0x3d66b7||_0x1b7113['license'];if(_[_0x3868('0xe')](_0x23e99c)){throw new Error(_0x3868('0xf'));}var _0x286215=_0x1b7113[_0x3868('0xd')];var _0x1d6e65=_0x1b7113[_0x3868('0x10')];var _0x25c301=_0x286215[_0x3868('0x11')]('-')[0x4];var _0x31f374=_0x286215[_0x3868('0x11')]('-')[0x0];var _0x12ce6c=encryptor['decryptString'](_0x23e99c,util['format'](_0x3868('0x12'),_0x25c301,_0x286215,_0x31f374));var _0x15d930=JSON[_0x3868('0x13')](_0x12ce6c);_0x15d930[_0x3868('0x14')]=![];_0x15d930[_0x3868('0x15')]=_0x286215;_0x15d930['machineUuid']=hardware[_0x3868('0x8')]();if(_0x1d6e65){var _0x13c8b0=encryptor[_0x3868('0x16')](_0x1d6e65);_0x15d930['gray']=_0x13c8b0;_0x15d930[_0x3868('0x17')]=moment(_0x13c8b0)[_0x3868('0x18')](0x7,'days')[_0x3868('0x19')]();_0x15d930[_0x3868('0x1a')]=_0x15d930[_0x3868('0x15')]!=_0x15d930[_0x3868('0x1b')]?_0x3868('0x1c'):_0x3868('0x1d');}return _0x15d930;}catch(_0x2ee7c1){breakingLicense[_0x3868('0x15')]=_0x1b7113[_0x3868('0xd')];breakingLicense[_0x3868('0x1e')]=_0x2ee7c1['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x121ead,_0x225969){getLicense()['then'](function(_0x10a3bb){return db[_0x3868('0x1f')]['findAll']({'attributes':[_0x3868('0x20'),[db['sequelize']['fn'](_0x3868('0x21'),db['sequelize'][_0x3868('0x22')](_0x3868('0x20'))),_0x3868('0x23')]],'group':'role','where':{'role':{'$or':[_0x3868('0x24'),_0x3868('0x25'),_0x3868('0x26')]}},'raw':!![]})[_0x3868('0xb')](function(_0x285186){var _0x2f28fd={'user':_0x10a3bb[_0x3868('0x27')]||0x0,'telephone':_0x10a3bb[_0x3868('0x28')]||0x0};_0x285186[_0x3868('0x29')](function(_0x40e349){var _0x4c57b0=_0x40e349[_0x3868('0x20')]===_0x3868('0x24')?_0x3868('0x25'):_0x40e349['role'];_0x2f28fd[_0x4c57b0]-=_0x40e349[_0x3868('0x23')];if(_0x2f28fd[_0x4c57b0]<0x0)_0x2f28fd[_0x4c57b0]=0x0;});_0x121ead(_0x2f28fd);return;});})[_0x3868('0xc')](function(_0x8e84b9){_0x225969(_0x8e84b9);});});}function checkUserLimits(_0x799f66){return new BPromise(function(_0xf36096,_0x52fa79){getLimits()[_0x3868('0xb')](function(_0x217786){var _0x48ab37=_[_0x3868('0x2a')](_[_0x3868('0x2b')](_0x799f66,_0x3868('0x20')),['admin',_0x3868('0x25'),_0x3868('0x26')]);var _0x1b2c81=(_0x48ab37['admin']||0x0)+(_0x48ab37[_0x3868('0x25')]||0x0);var _0x1d8b38=_0x48ab37[_0x3868('0x26')]||0x0;if(_0x1b2c81>_0x217786['user'])return _0x52fa79('License\x20limit\x20reached\x20for\x20users');if(_0x1d8b38>_0x217786['telephone'])return _0x52fa79(_0x3868('0x2c'));return _0xf36096();})['catch'](function(_0x7ac5df){_0x52fa79(_0x7ac5df);});});}module[_0x3868('0x2d')]={'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 dd1875a..fa57509 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 _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xfb11[_0x8de54f];return _0x14cba4;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x6cb4=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x26097a,_0x147c0c){var _0x3121a4=function(_0x545009){while(--_0x545009){_0x26097a['push'](_0x26097a['shift']());}};_0x3121a4(++_0x147c0c);}(_0x6cb4,0xff));var _0x46cb=function(_0x465930,_0x2fb227){_0x465930=_0x465930-0x0;var _0x30bd1d=_0x6cb4[_0x465930];return _0x30bd1d;};'use strict';module[_0x46cb('0x0')]={'DOMAIN':_0x46cb('0x1'),'SESSION_SECRET':_0x46cb('0x2'),'GOOGLE_ID':_0x46cb('0x3'),'GOOGLE_SECRET':_0x46cb('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 5abdb06..edc41f2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63bd=['../utils/loggers','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x63bd,0xf6));var _0xd63b=function(_0x2358ef,_0x1d1e30){_0x2358ef=_0x2358ef-0x0;var _0x1ee6ab=_0x63bd[_0x2358ef];return _0x1ee6ab;};'use strict';var fileLogger=require(_0xd63b('0x0'))['fileLogger'];module[_0xd63b('0x1')]=fileLogger; \ No newline at end of file +var _0x1d92=['../utils/loggers','exports'];(function(_0xc53205,_0x1a9c71){var _0x507af8=function(_0x4fce7f){while(--_0x4fce7f){_0xc53205['push'](_0xc53205['shift']());}};_0x507af8(++_0x1a9c71);}(_0x1d92,0x150));var _0x21d9=function(_0x3a2deb,_0x2f8c2d){_0x3a2deb=_0x3a2deb-0x0;var _0x203ab0=_0x1d92[_0x3a2deb];return _0x203ab0;};'use strict';var fileLogger=require(_0x21d9('0x0'))['fileLogger'];module[_0x21d9('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 42a9ff5..6a9651f 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 _0x3044=['../../services/agi/index.js','email','../../services/email/index.js','xdr','../../services/xdr/index.js','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x5cdacf,_0x7c82b1){var _0xa68a8b=function(_0x4b3818){while(--_0x4b3818){_0x5cdacf['push'](_0x5cdacf['shift']());}};_0xa68a8b(++_0x7c82b1);}(_0x3044,0x130));var _0x4304=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x3044[_0x2283dc];return _0x16db90;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x4304('0x0')](path[_0x4304('0x1')](cfg[_0x4304('0x2')],_0x4304('0x3')))};var pm2config={'apps':[{'name':_0x4304('0x4'),'script':path[_0x4304('0x1')](__dirname,_0x4304('0x5')),'env':env},{'name':_0x4304('0x6'),'script':path[_0x4304('0x1')](__dirname,_0x4304('0x7')),'env':env},{'name':'agi','script':path[_0x4304('0x1')](__dirname,_0x4304('0x8')),'env':env},{'name':_0x4304('0x9'),'script':path['join'](__dirname,_0x4304('0xa')),'env':env},{'name':'routing','script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x4304('0xb'),'script':path[_0x4304('0x1')](__dirname,_0x4304('0xc')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xfe2f=['path','../../config/environment','join','root','legacy-libs','express','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x527761,_0x596c8d){var _0x419ef4=function(_0x43f23a){while(--_0x43f23a){_0x527761['push'](_0x527761['shift']());}};_0x419ef4(++_0x596c8d);}(_0xfe2f,0x9a));var _0xffe2=function(_0x36e2b6,_0x303250){_0x36e2b6=_0x36e2b6-0x0;var _0x29ab41=_0xfe2f[_0x36e2b6];return _0x29ab41;};'use strict';var path=require(_0xffe2('0x0'));var cfg=require(_0xffe2('0x1'));var env={'NODE_PATH':path['resolve'](path[_0xffe2('0x2')](cfg[_0xffe2('0x3')],_0xffe2('0x4')))};var pm2config={'apps':[{'name':_0xffe2('0x5'),'script':path[_0xffe2('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0xffe2('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xffe2('0x6'),'script':path[_0xffe2('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xffe2('0x7'),'script':path['join'](__dirname,_0xffe2('0x8')),'env':env},{'name':_0xffe2('0x9'),'script':path[_0xffe2('0x2')](__dirname,_0xffe2('0xa')),'env':env},{'name':_0xffe2('0xb'),'script':path[_0xffe2('0x2')](__dirname,_0xffe2('0xc')),'env':env}]};module[_0xffe2('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3e1041f..f958f43 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 _0xbd9d=['bluebird','connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x5746aa,_0x471995){var _0x2b7e3a=function(_0x51813c){while(--_0x51813c){_0x5746aa['push'](_0x5746aa['shift']());}};_0x2b7e3a(++_0x471995);}(_0xbd9d,0x151));var _0xdbd9=function(_0x22a715,_0x4b3c23){_0x22a715=_0x22a715-0x0;var _0x403051=_0xbd9d[_0x22a715];return _0x403051;};'use strict';var pm2=require(_0xdbd9('0x0'));var BPromise=require(_0xdbd9('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x7c2194,_0x51f914){return pm2['connect'](function(_0x7d8635){if(_0x7d8635){return _0x51f914(_0x7d8635);}return _0x7c2194(_0xdbd9('0x2'));});});};exports['start']=function(_0x4fd9be){return connect()[_0xdbd9('0x3')](function(){return new BPromise(function(_0x50a970,_0xc13210){return pm2[_0xdbd9('0x4')](_0x4fd9be,function(_0x2c3240,_0x13625d){if(_0x2c3240){return _0xc13210(_0x2c3240);}pm2[_0xdbd9('0x5')]();return _0x50a970(_0x13625d);});});});};exports[_0xdbd9('0x6')]=function(_0x20e36a){return connect()[_0xdbd9('0x3')](function(){return new BPromise(function(_0x21abb1,_0x3168d7){return pm2['stop'](_0x20e36a,function(_0x4fe73e,_0x1f9ab4){if(_0x4fe73e){return _0x3168d7(_0x4fe73e);}pm2[_0xdbd9('0x5')]();return _0x21abb1(_0x1f9ab4);});});});};exports['restart']=function(_0x28159c){return connect()[_0xdbd9('0x3')](function(){return new BPromise(function(_0x32cff8,_0x4da0e2){return pm2[_0xdbd9('0x7')](_0x28159c,function(_0x5adaa1,_0x32ae8b){if(_0x5adaa1){return _0x4da0e2(_0x5adaa1);}pm2[_0xdbd9('0x5')]();return _0x32cff8(_0x32ae8b);});});});};exports[_0xdbd9('0x8')]=function(){return connect()[_0xdbd9('0x3')](function(){return new BPromise(function(_0x5312a3,_0x339490){return pm2[_0xdbd9('0x8')](function(_0x454ed8,_0x439769){if(_0x454ed8){return _0x339490(_0x454ed8);}pm2[_0xdbd9('0x5')]();return _0x5312a3(_0x439769);});});});};exports[_0xdbd9('0x9')]=function(_0x3855a2){return connect()['then'](function(){return new BPromise(function(_0x2340a9,_0x7d38bc){return pm2['describe'](_0x3855a2,function(_0x3749a1,_0xa26ce8){if(_0x3749a1){return _0x7d38bc(_0x3749a1);}pm2['disconnect']();return _0x2340a9(_0xa26ce8);});});});};exports['delete']=function(_0xa7d73b){return connect()['then'](function(){return new BPromise(function(_0x660be5,_0x139d81){return pm2[_0xdbd9('0xa')](_0xa7d73b,function(_0x2357fb,_0x293bab){if(_0x2357fb){return _0x139d81(_0x2357fb);}pm2[_0xdbd9('0x5')]();return _0x660be5(_0x293bab);});});});};exports[_0xdbd9('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x21acdd,_0x2dd4d4){return pm2[_0xdbd9('0xb')](function(_0x361ad9){if(_0x361ad9){return _0x2dd4d4(_0x361ad9);}return _0x21acdd(_0xdbd9('0xc'));});});});}; \ No newline at end of file +var _0x5d91=['connected','start','then','disconnect','stop','restart','list','describe','dump','saved','pm2','bluebird','./config','connect'];(function(_0x5751ff,_0x56e757){var _0x11eac2=function(_0x518c26){while(--_0x518c26){_0x5751ff['push'](_0x5751ff['shift']());}};_0x11eac2(++_0x56e757);}(_0x5d91,0xf8));var _0x15d9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5d91[_0x14add3];return _0x4a174f;};'use strict';var pm2=require(_0x15d9('0x0'));var BPromise=require(_0x15d9('0x1'));var config=require(_0x15d9('0x2'));function connect(){return new BPromise(function(_0x1ef2d3,_0x27149e){return pm2[_0x15d9('0x3')](function(_0x47f35a){if(_0x47f35a){return _0x27149e(_0x47f35a);}return _0x1ef2d3(_0x15d9('0x4'));});});};exports[_0x15d9('0x5')]=function(_0x461dd4){return connect()[_0x15d9('0x6')](function(){return new BPromise(function(_0x494d5c,_0x16c7fe){return pm2[_0x15d9('0x5')](_0x461dd4,function(_0x4902b2,_0x134e36){if(_0x4902b2){return _0x16c7fe(_0x4902b2);}pm2[_0x15d9('0x7')]();return _0x494d5c(_0x134e36);});});});};exports[_0x15d9('0x8')]=function(_0x173a9c){return connect()[_0x15d9('0x6')](function(){return new BPromise(function(_0xc5a389,_0x865b56){return pm2[_0x15d9('0x8')](_0x173a9c,function(_0x3ff04e,_0x1ff3dc){if(_0x3ff04e){return _0x865b56(_0x3ff04e);}pm2[_0x15d9('0x7')]();return _0xc5a389(_0x1ff3dc);});});});};exports[_0x15d9('0x9')]=function(_0x2736f1){return connect()[_0x15d9('0x6')](function(){return new BPromise(function(_0x2b9e73,_0xcf46b7){return pm2['restart'](_0x2736f1,function(_0x1fe2e6,_0x3fb40d){if(_0x1fe2e6){return _0xcf46b7(_0x1fe2e6);}pm2[_0x15d9('0x7')]();return _0x2b9e73(_0x3fb40d);});});});};exports['list']=function(){return connect()[_0x15d9('0x6')](function(){return new BPromise(function(_0x3d1565,_0x53ff54){return pm2[_0x15d9('0xa')](function(_0x53b655,_0x5f5abb){if(_0x53b655){return _0x53ff54(_0x53b655);}pm2[_0x15d9('0x7')]();return _0x3d1565(_0x5f5abb);});});});};exports[_0x15d9('0xb')]=function(_0x2a7f71){return connect()[_0x15d9('0x6')](function(){return new BPromise(function(_0x52ea26,_0x4ba018){return pm2[_0x15d9('0xb')](_0x2a7f71,function(_0x21a99c,_0x13a022){if(_0x21a99c){return _0x4ba018(_0x21a99c);}pm2[_0x15d9('0x7')]();return _0x52ea26(_0x13a022);});});});};exports['delete']=function(_0x4aefc2){return connect()[_0x15d9('0x6')](function(){return new BPromise(function(_0x374c80,_0x56d102){return pm2['delete'](_0x4aefc2,function(_0x4e37f0,_0x18b71a){if(_0x4e37f0){return _0x56d102(_0x4e37f0);}pm2[_0x15d9('0x7')]();return _0x374c80(_0x18b71a);});});});};exports[_0x15d9('0xc')]=function(){return connect()[_0x15d9('0x6')](function(){return new BPromise(function(_0x4d483d,_0x14b75c){return pm2[_0x15d9('0xc')](function(_0x292a96){if(_0x292a96){return _0x14b75c(_0x292a96);}return _0x4d483d(_0x15d9('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 03ce088..de1025b 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 _0x5084=['emit','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','then','ChatInteraction','findAll','subtract','chatTimeout','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x42f163,_0x22deb7){var _0xdc3131=function(_0x41fe93){while(--_0x41fe93){_0x42f163['push'](_0x42f163['shift']());}};_0xdc3131(++_0x22deb7);}(_0x5084,0x1d2));var _0x4508=function(_0x56b5d1,_0x19156e){_0x56b5d1=_0x56b5d1-0x0;var _0x2ee00d=_0x5084[_0x56b5d1];return _0x2ee00d;};'use strict';var _=require(_0x4508('0x0'));var moment=require('moment');var Redis=require(_0x4508('0x1'));var util=require(_0x4508('0x2'));var config=require(_0x4508('0x3'));var db=require(_0x4508('0x4'))['db'];var logger=require(_0x4508('0x5'))(_0x4508('0x6'));config[_0x4508('0x7')]=_['defaults'](config[_0x4508('0x7')],{'host':_0x4508('0x8'),'port':0x18eb});var io=require(_0x4508('0x9'))(new Redis(config[_0x4508('0x7')]));function closeInteractions(){var _0x3c1e9a=0x0;var _0x201764=[];return db[_0x4508('0xa')][_0x4508('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x4508('0xc')](function(_0x1edf60){_0x3c1e9a=_0x1edf60['chatTimeout'];if(_0x3c1e9a){return db[_0x4508('0xd')][_0x4508('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4508('0xf')](_0x1edf60[_0x4508('0x10')],_0x4508('0x11'))}}});}else{return[];}})[_0x4508('0xc')](function(_0x5b1cc0){if(_0x5b1cc0&&_0x5b1cc0[_0x4508('0x12')]){_0x201764=_[_0x4508('0x13')](_0x5b1cc0||[],'id');logger[_0x4508('0x14')](_0x4508('0x15'),_0x201764[_0x4508('0x16')]());return db['ChatInteraction'][_0x4508('0x17')]({'closeReason':_0x4508('0x18'),'disposition':_0x4508('0x19'),'closed':!![],'closedAt':moment()[_0x4508('0x1a')](_0x4508('0x1b'))},{'where':{'id':_0x201764}});}})[_0x4508('0xc')](function(){if(_0x201764&&_0x201764['length']){logger[_0x4508('0x14')](_0x4508('0x1c'),_0x201764['join']());for(var _0x2f7c80=0x0;_0x2f7c80<_0x201764[_0x4508('0x12')];_0x2f7c80++){io[_0x4508('0x1d')]('chatInteraction:update',{'id':_0x201764[_0x2f7c80],'closed':!![]});}}})[_0x4508('0x1e')](function(_0x553105){logger['error'](_0x4508('0x1f'),_0x553105?util['inspect'](_0x553105,{'showHidden':![],'depth':null}):'');});}exports[_0x4508('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5833=['length','emit','catch','error','inspect','ioredis','util','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','then','findAll','subtract','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x1fcfec,_0x4f5ffa){var _0x4be5c2=function(_0x4c412e){while(--_0x4c412e){_0x1fcfec['push'](_0x1fcfec['shift']());}};_0x4be5c2(++_0x4f5ffa);}(_0x5833,0x1e1));var _0x3583=function(_0x464811,_0x41ffd6){_0x464811=_0x464811-0x0;var _0x3ffa71=_0x5833[_0x464811];return _0x3ffa71;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x3583('0x0'));var util=require(_0x3583('0x1'));var config=require(_0x3583('0x2'));var db=require(_0x3583('0x3'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0x3583('0x4')](config[_0x3583('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3583('0x6'))(new Redis(config[_0x3583('0x5')]));function closeInteractions(){var _0x434d3e=0x0;var _0x238de8=[];return db[_0x3583('0x7')][_0x3583('0x8')]({'raw':!![],'attributes':['id',_0x3583('0x9')],'where':{'id':0x1}})[_0x3583('0xa')](function(_0x36870){_0x434d3e=_0x36870['chatTimeout'];if(_0x434d3e){return db['ChatInteraction'][_0x3583('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3583('0xc')](_0x36870[_0x3583('0x9')],_0x3583('0xd'))}}});}else{return[];}})['then'](function(_0x3210d5){if(_0x3210d5&&_0x3210d5['length']){_0x238de8=_[_0x3583('0xe')](_0x3210d5||[],'id');logger['info'](_0x3583('0xf'),_0x238de8[_0x3583('0x10')]());return db[_0x3583('0x11')][_0x3583('0x12')]({'closeReason':_0x3583('0x13'),'disposition':_0x3583('0x14'),'closed':!![],'closedAt':moment()['format'](_0x3583('0x15'))},{'where':{'id':_0x238de8}});}})[_0x3583('0xa')](function(){if(_0x238de8&&_0x238de8['length']){logger['info'](_0x3583('0x16'),_0x238de8[_0x3583('0x10')]());for(var _0x3c14a7=0x0;_0x3c14a7<_0x238de8[_0x3583('0x17')];_0x3c14a7++){io[_0x3583('0x18')]('chatInteraction:update',{'id':_0x238de8[_0x3c14a7],'closed':!![]});}}})[_0x3583('0x19')](function(_0x2a8ca8){logger[_0x3583('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2a8ca8?util[_0x3583('0x1b')](_0x2a8ca8,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 8114c2f..2b95c4a 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 _0x6ae7=['startAllRefreshIntervals','exports'];(function(_0x1cc1c4,_0x2d38f7){var _0x2d2a2d=function(_0x147c8f){while(--_0x147c8f){_0x1cc1c4['push'](_0x1cc1c4['shift']());}};_0x2d2a2d(++_0x2d38f7);}(_0x6ae7,0x134));var _0x76ae=function(_0x9bdbe7,_0x16ea08){_0x9bdbe7=_0x9bdbe7-0x0;var _0x13748f=_0x6ae7[_0x9bdbe7];return _0x13748f;};'use strict';function start(){var _0x3303ae=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x3303ae[_0x76ae('0x0')]();}module[_0x76ae('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x48dc=['startAllRefreshIntervals'];(function(_0x1565bb,_0x14226c){var _0x3169c2=function(_0x2ff6d0){while(--_0x2ff6d0){_0x1565bb['push'](_0x1565bb['shift']());}};_0x3169c2(++_0x14226c);}(_0x48dc,0x1be));var _0xc48d=function(_0x4ed786,_0x74f270){_0x4ed786=_0x4ed786-0x0;var _0x2f0243=_0x48dc[_0x4ed786];return _0x2f0243;};'use strict';function start(){var _0x2ae504=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x2ae504[_0xc48d('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 894a993..669c62b 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 _0x3421=['subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','intersection','length','exists','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','startAt','add','add\x20cron','stop\x20cron','isBetween','endAt','update','update\x20cron','run','start','util','path','moment','cron-job-manager','bluebird','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','AnalyticExtractedReport','findOne','then','catch','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','basename','zip','existsSync','status','message','attachments','stringify','Sent','Empty','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','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','error','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','operation','stop','still\x20loading','case\x20completed','case\x20empty','data','case\x20failed','Unrecognized\x20status:','entity','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x3421,0x100));var _0x1342=function(_0x2ce098,_0x228fa8){_0x2ce098=_0x2ce098-0x0;var _0x54ad56=_0x3421[_0x2ce098];return _0x54ad56;};'use strict';var fs=require('fs');var util=require(_0x1342('0x0'));var path=require(_0x1342('0x1'));var _=require('lodash');var moment=require(_0x1342('0x2'));var CronJobManager=require(_0x1342('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x1342('0x4'));var logger=require('../logger')('schedule');var db=require(_0x1342('0x5'))['db'];const retry=require(_0x1342('0x6'));var analyticCustomReportController=require(_0x1342('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1342('0x8')][_0x1342('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x80eb2b){const _0x42f890={};if(typeof _0x80eb2b==='number'){_0x42f890['id']=_0x80eb2b;}return db[_0x1342('0xa')][_0x1342('0xb')]({'where':_0x42f890})[_0x1342('0xc')](function(_0x22b3e8){return _0x22b3e8;})[_0x1342('0xd')](function(_0x18d728){logger['error'](_0x18d728);});}function handleSendEmail(_0x590ff3,_0x12a0d3){logger[_0x1342('0xe')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x590ff3[_0x1342('0xf')]);var _0x5aa9de=!![];var _0x48b103=_0x590ff3[_0x1342('0x10')][_0x1342('0x11')]();var _0x54751e={'account':_0x48b103,'message':{'from':util[_0x1342('0x12')](_0x1342('0x13'),_0x590ff3[_0x1342('0x10')]['name'],_0x590ff3['MailAccount']['email']||_0x590ff3[_0x1342('0x10')][_0x1342('0x14')][_0x1342('0x15')]),'to':_0x590ff3[_0x1342('0xf')],'cc':_0x590ff3['cc'],'bcc':_0x590ff3[_0x1342('0x16')],'subject':util[_0x1342('0x12')](_0x1342('0x17'),_0x12a0d3[_0x1342('0x18')],_0x590ff3[_0x1342('0x19')],_0x590ff3['subtractUnit'])}};var _0x32eb19=path[_0x1342('0x1a')](__dirname,_0x1342('0x1b'));var _0x4cb7f7=_0x12a0d3[_0x1342('0x1c')];var _0x26170d=util['format']('%s.%s',path[_0x1342('0x1d')](_0x12a0d3['savename'],path['extname'](_0x12a0d3['savename'])),_0x1342('0x1e'));var _0x12b980=path[_0x1342('0x1a')](_0x32eb19,_0x4cb7f7);var _0x4a819d=path[_0x1342('0x1a')](_0x32eb19,_0x26170d);if(fs[_0x1342('0x1f')](_0x12b980)){_0x12a0d3[_0x1342('0x20')]='Sent';_0x54751e[_0x1342('0x21')][_0x1342('0x22')]=[{'filename':_0x4cb7f7,'path':_0x12b980}];_0x54751e[_0x1342('0x21')]['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x1342('0x23')](_0x12a0d3,null,0x2));}else if(fs['existsSync'](_0x4a819d)){_0x12a0d3[_0x1342('0x20')]=_0x1342('0x24');_0x54751e['message'][_0x1342('0x22')]=[{'filename':_0x26170d,'path':_0x4a819d}];}else{if(_0x12a0d3[_0x1342('0x20')]===_0x1342('0x25')){_0x54751e['message'][_0x1342('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x590ff3[_0x1342('0x27')]){_0x5aa9de=![];logger['info'](_0x1342('0x28'));}}else if(_0x12a0d3['status']===_0x1342('0x29')){_0x54751e[_0x1342('0x21')][_0x1342('0x26')]=_0x1342('0x2a');}else if(_0x12a0d3['status']===_0x1342('0x2b')){_0x54751e[_0x1342('0x21')][_0x1342('0x26')]=_0x1342('0x2c');}else if(_0x12a0d3['status']===_0x1342('0x2d')){_0x54751e[_0x1342('0x21')][_0x1342('0x26')]=_0x1342('0x2e');}else{logger[_0x1342('0x2f')](_0x1342('0x30'),_0x12a0d3[_0x1342('0x20')]);}}if(_0x5aa9de){return client[_0x1342('0x31')](_0x1342('0x32'),_0x54751e)[_0x1342('0xc')](function(_0x4ab223){if(_0x4ab223[_0x1342('0x2f')]){return logger[_0x1342('0x2f')](_0x1342('0x33'),JSON[_0x1342('0x23')](_0x4ab223));}return logger['info'](_0x1342('0x34'));})['catch'](function(_0x44477a){return logger['error']('error\x20mail',JSON[_0x1342('0x23')](_0x44477a));});}}function handleError(){return function(_0x231cf8){return logger['error'](JSON[_0x1342('0x23')](_0x231cf8));};}function loading(_0x1558b7){logger[_0x1342('0xe')](_0x1342('0x35'));if(_0x1558b7[_0x1342('0x36')]===_0x1558b7[_0x1342('0x37')][_0x1342('0x38')]){handleSendEmail(_0x1558b7[_0x1342('0x39')],_0x1558b7['data']);_0x1558b7[_0x1342('0x3a')][_0x1342('0x3b')]();}else{_0x1558b7[_0x1342('0x3a')][_0x1342('0x6')](_0x1342('0x3c'));}}function completed(_0x94be){logger[_0x1342('0xe')](_0x1342('0x3d'));handleSendEmail(_0x94be['job'],_0x94be['data']);_0x94be[_0x1342('0x3a')][_0x1342('0x3b')]();}function empty(_0x344055){logger[_0x1342('0xe')](_0x1342('0x3e'));handleSendEmail(_0x344055[_0x1342('0x39')],_0x344055[_0x1342('0x3f')]);_0x344055[_0x1342('0x3a')][_0x1342('0x3b')]();}function failed(_0x44566f){logger[_0x1342('0xe')](_0x1342('0x40'));handleSendEmail(_0x44566f[_0x1342('0x39')],_0x44566f['data']);_0x44566f[_0x1342('0x3a')]['stop']();}function urecognized(_0x4e6bc3){logger[_0x1342('0x2f')](_0x1342('0x41'),_0x4e6bc3[_0x1342('0x42')][_0x1342('0x43')][_0x1342('0x20')]);_0x4e6bc3['operation'][_0x1342('0x3b')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x3e16d7,_0xc8a9ce){const _0x299f43={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0xcb0d0d=retry[_0x1342('0x3a')](_0x299f43);_0xcb0d0d[_0x1342('0x44')](_0x33b036=>{logger[_0x1342('0xe')](_0x1342('0x45')+_0x3e16d7['id']+_0x1342('0x46')+_0x33b036);try{getReportData(_0xc8a9ce['id'])[_0x1342('0xc')](function(_0x22d121){_0xc8a9ce=_0x22d121;logger[_0x1342('0xe')]('report\x20status:',_0x22d121[_0x1342('0x43')]['status']);if(!reportStatusStrategies[_0x22d121[_0x1342('0x43')]['status']]){logger[_0x1342('0x2f')]('report\x20status:',_0x22d121['dataValues'][_0x1342('0x20')]);_0xcb0d0d[_0x1342('0x6')]();}reportStatusStrategies[_0x22d121[_0x1342('0x43')]['status']]({'operation':_0xcb0d0d,'currentAttempt':_0x33b036,'retryOptions':_0x299f43,'job':_0x3e16d7,'data':_0xc8a9ce,'entity':_0x22d121});});}catch(_0x15adf1){_0xcb0d0d[_0x1342('0x6')](_0x15adf1);}});}function handleResult(_0x5ba94e){return function(_0x602cd){if(_0x5ba94e['sendMail']&&_0x5ba94e[_0x1342('0x10')]&&_0x5ba94e[_0x1342('0x10')][_0x1342('0x14')]&&!_[_0x1342('0x47')](_0x5ba94e['email'])){retryer(_0x5ba94e,_0x602cd);}};}function handleJob(_0x34a1a1){return function(){try{if(_[_0x1342('0x47')](_0x34a1a1[_0x1342('0x19')])){return logger[_0x1342('0xe')](_0x1342('0x48'));}if(_[_0x1342('0x47')](_0x34a1a1[_0x1342('0x49')])){return logger[_0x1342('0xe')](_0x1342('0x4a'));}var _0x13114a={'startDate':moment()[_0x1342('0x4b')](_0x34a1a1[_0x1342('0x19')],_0x34a1a1[_0x1342('0x49')])[_0x1342('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x1342('0x12')](_0x1342('0x4c')),'type':'scheduled','output':_0x34a1a1['output'],'name':_0x34a1a1[_0x1342('0x18')]};if(!_[_0x1342('0x47')](_0x34a1a1[_0x1342('0x4d')])){logger[_0x1342('0xe')](_0x1342('0x4e'),_0x34a1a1[_0x1342('0x4d')]);return analyticDefaultReportController[_0x1342('0x4f')]({'id':_0x34a1a1['DefaultReportId']},_0x13114a)[_0x1342('0xc')](handleResult(_0x34a1a1))['catch'](handleError());}if(!_[_0x1342('0x47')](_0x34a1a1['CustomReportId'])){logger['info'](_0x1342('0x50'),_0x34a1a1[_0x1342('0x51')]);return analyticCustomReportController[_0x1342('0x4f')]({'id':_0x34a1a1['CustomReportId']},_0x13114a)[_0x1342('0xc')](handleResult(_0x34a1a1))[_0x1342('0xd')](handleError());}}catch(_0xe8c31e){logger[_0x1342('0x2f')](JSON[_0x1342('0x23')](_0xe8c31e));}return logger[_0x1342('0xe')]('no\x20report\x20id');};}function getJobs(_0x27552b){var _0x4b017c={};if(_0x27552b){_0x4b017c['id']=_0x27552b;}return db[_0x1342('0x52')][_0x1342('0x53')]({'where':_0x4b017c,'include':[{'model':db[_0x1342('0x10')],'attributes':['id',_0x1342('0x18'),'email'],'include':[{'model':db[_0x1342('0x54')],'as':_0x1342('0x14'),'include':[{'model':db['CloudProvider'],'as':_0x1342('0x55')}]}]}]})[_0x1342('0xc')](function(_0x210d28){var _0x469ed8=_[_0x1342('0x56')](manager[_0x1342('0x57')]);var _0x357baf=_[_0x1342('0x58')](_0x210d28,function(_0xd705b5){return _0xd705b5['id'][_0x1342('0x59')]();});var _0x2c591d=_[_0x1342('0x5a')](_0x210d28,function(_0x44af48){return _0x44af48['id'][_0x1342('0x59')]();});var _0x3abfae=_0x27552b?_0x357baf:_['difference'](_0x357baf,_0x469ed8);var _0x535caf=_[_0x1342('0x5b')](_0x357baf,_0x469ed8);var _0x2cec99=_['difference'](_0x469ed8,_0x357baf);var _0x4fdcc7;var _0x4471a6;for(_0x4fdcc7=0x0;_0x4fdcc7<_0x2cec99[_0x1342('0x5c')]&&!_0x27552b;_0x4fdcc7+=0x1){_0x4471a6=_0x2cec99[_0x4fdcc7][_0x1342('0x59')]();if(manager[_0x1342('0x5d')](_0x4471a6)){manager[_0x1342('0x3b')](_0x4471a6);manager[_0x1342('0x5e')](_0x4471a6);logger[_0x1342('0xe')](_0x1342('0x5f'),_0x4471a6);}}logger[_0x1342('0xe')](_0x1342('0x60'),JSON['stringify'](_0x3abfae));for(_0x4fdcc7=0x0;_0x4fdcc7<_0x3abfae[_0x1342('0x5c')];_0x4fdcc7+=0x1){_0x4471a6=_0x3abfae[_0x4fdcc7][_0x1342('0x59')]();if(_0x27552b){logger[_0x1342('0xe')](JSON[_0x1342('0x23')](_0x2c591d[_0x4471a6]));BPromise['resolve']()['then'](handleJob(_0x2c591d[_0x4471a6]));logger[_0x1342('0xe')](_0x1342('0x61'),_0x2c591d[_0x4471a6][_0x1342('0x18')],_0x2c591d[_0x4471a6][_0x1342('0x62')]);}else if(_0x2c591d[_0x4471a6][_0x1342('0x62')]&&_0x2c591d[_0x4471a6][_0x1342('0x63')]&&moment()['isBetween'](_0x2c591d[_0x4471a6][_0x1342('0x64')],_0x2c591d[_0x4471a6]['endAt'])){manager[_0x1342('0x65')](_0x4471a6,_0x2c591d[_0x4471a6][_0x1342('0x62')],handleJob(_0x2c591d[_0x4471a6]));manager['start'](_0x4471a6);logger[_0x1342('0xe')](_0x1342('0x66'),_0x2c591d[_0x4471a6][_0x1342('0x18')],_0x2c591d[_0x4471a6][_0x1342('0x62')]);}else if(manager[_0x1342('0x5d')](_0x4471a6)){manager[_0x1342('0x3b')](_0x4471a6);manager[_0x1342('0x5e')](_0x4471a6);logger[_0x1342('0xe')](_0x1342('0x67'),_0x2c591d[_0x4471a6]['name'],_0x2c591d[_0x4471a6]['cron']);}}for(_0x4fdcc7=0x0,_0x4471a6;_0x4fdcc7<_0x535caf[_0x1342('0x5c')]&&!_0x27552b;_0x4fdcc7+=0x1){_0x4471a6=_0x535caf[_0x4fdcc7][_0x1342('0x59')]();if(manager[_0x1342('0x5d')](_0x4471a6)){if(_0x2c591d[_0x4471a6][_0x1342('0x62')]&&_0x2c591d[_0x4471a6][_0x1342('0x63')]&&moment()[_0x1342('0x68')](_0x2c591d[_0x4471a6][_0x1342('0x64')],_0x2c591d[_0x4471a6][_0x1342('0x69')])){manager[_0x1342('0x6a')](_0x4471a6,_0x2c591d[_0x4471a6]['cron'],handleJob(_0x2c591d[_0x4471a6]));logger[_0x1342('0xe')](_0x1342('0x6b'),_0x2c591d[_0x4471a6]['name'],_0x2c591d[_0x4471a6][_0x1342('0x62')]);}else{manager[_0x1342('0x3b')](_0x4471a6);manager[_0x1342('0x5e')](_0x4471a6);logger[_0x1342('0xe')](_0x1342('0x67'),_0x2c591d[_0x4471a6][_0x1342('0x18')],_0x2c591d[_0x4471a6][_0x1342('0x62')]);}}}})[_0x1342('0xd')](function(_0x451cd2){logger[_0x1342('0x2f')](JSON['stringify'](_0x451cd2));});}exports[_0x1342('0x6c')]=function(_0x7f0b0c){return getJobs(_0x7f0b0c);};exports[_0x1342('0x6d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe0d5=['CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','delete\x20cron','toRun','length','resolve','run\x20job','active','startAt','add','add\x20cron','cron','deleteJob','isBetween','endAt','update','update\x20cron','stop\x20cron','run','start','path','lodash','moment','cron-job-manager','jayson/promise','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','Smtp','bcc','format','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','message','attachments','text','stringify','existsSync','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','[handleSendEmail]\x20Unrecognized\x20status:','error\x20mail','email\x20sent','catch','currentAttempt','retryOptions','retries','job','data','operation','retry','still\x20loading','case\x20empty','stop','case\x20failed','Unrecognized\x20status:','entity','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','dataValues','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport'];(function(_0x2d0b66,_0x43cc5e){var _0x21b7f5=function(_0x183e13){while(--_0x183e13){_0x2d0b66['push'](_0x2d0b66['shift']());}};_0x21b7f5(++_0x43cc5e);}(_0xe0d5,0xfe));var _0x5e0d=function(_0x3fce6c,_0x5c5440){_0x3fce6c=_0x3fce6c-0x0;var _0x229d62=_0xe0d5[_0x3fce6c];return _0x229d62;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x5e0d('0x0'));var _=require(_0x5e0d('0x1'));var moment=require(_0x5e0d('0x2'));var CronJobManager=require(_0x5e0d('0x3'));var jayson=require(_0x5e0d('0x4'));var BPromise=require('bluebird');var logger=require(_0x5e0d('0x5'))('schedule');var db=require(_0x5e0d('0x6'))['db'];const retry=require('retry');var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x5e0d('0x7'));var client=jayson[_0x5e0d('0x8')][_0x5e0d('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x579d1d){const _0x5bceb8={};if(typeof _0x579d1d==='number'){_0x5bceb8['id']=_0x579d1d;}return db[_0x5e0d('0xa')][_0x5e0d('0xb')]({'where':_0x5bceb8})[_0x5e0d('0xc')](function(_0x352ba8){return _0x352ba8;})['catch'](function(_0x214258){logger[_0x5e0d('0xd')](_0x214258);});}function handleSendEmail(_0x5655c0,_0x5d5e8c){logger[_0x5e0d('0xe')](_0x5e0d('0xf'),_0x5655c0[_0x5e0d('0x10')]);var _0x43f42c=!![];var _0x16e11a=_0x5655c0[_0x5e0d('0x11')][_0x5e0d('0x12')]();var _0x4ef682={'account':_0x16e11a,'message':{'from':util['format'](_0x5e0d('0x13'),_0x5655c0[_0x5e0d('0x11')]['name'],_0x5655c0[_0x5e0d('0x11')]['email']||_0x5655c0['MailAccount'][_0x5e0d('0x14')]['user']),'to':_0x5655c0[_0x5e0d('0x10')],'cc':_0x5655c0['cc'],'bcc':_0x5655c0[_0x5e0d('0x15')],'subject':util[_0x5e0d('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x5d5e8c[_0x5e0d('0x17')],_0x5655c0[_0x5e0d('0x18')],_0x5655c0[_0x5e0d('0x19')])}};var _0xc840ce=path[_0x5e0d('0x1a')](__dirname,_0x5e0d('0x1b'));var _0x488731=_0x5d5e8c[_0x5e0d('0x1c')];var _0x458bf6=util['format'](_0x5e0d('0x1d'),path[_0x5e0d('0x1e')](_0x5d5e8c[_0x5e0d('0x1c')],path[_0x5e0d('0x1f')](_0x5d5e8c[_0x5e0d('0x1c')])),_0x5e0d('0x20'));var _0x1b0e72=path[_0x5e0d('0x1a')](_0xc840ce,_0x488731);var _0x4a5c1b=path[_0x5e0d('0x1a')](_0xc840ce,_0x458bf6);if(fs['existsSync'](_0x1b0e72)){_0x5d5e8c[_0x5e0d('0x21')]='Sent';_0x4ef682[_0x5e0d('0x22')][_0x5e0d('0x23')]=[{'filename':_0x488731,'path':_0x1b0e72}];_0x4ef682[_0x5e0d('0x22')][_0x5e0d('0x24')]=util[_0x5e0d('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[_0x5e0d('0x25')](_0x5d5e8c,null,0x2));}else if(fs[_0x5e0d('0x26')](_0x4a5c1b)){_0x5d5e8c[_0x5e0d('0x21')]=_0x5e0d('0x27');_0x4ef682[_0x5e0d('0x22')]['attachments']=[{'filename':_0x458bf6,'path':_0x4a5c1b}];}else{if(_0x5d5e8c['status']===_0x5e0d('0x28')){_0x4ef682[_0x5e0d('0x22')][_0x5e0d('0x24')]=_0x5e0d('0x29');if(!_0x5655c0[_0x5e0d('0x2a')]){_0x43f42c=![];logger[_0x5e0d('0xe')](_0x5e0d('0x2b'));}}else if(_0x5d5e8c[_0x5e0d('0x21')]===_0x5e0d('0x2c')){_0x4ef682[_0x5e0d('0x22')][_0x5e0d('0x24')]=_0x5e0d('0x2d');}else if(_0x5d5e8c['status']===_0x5e0d('0x2e')){_0x4ef682[_0x5e0d('0x22')][_0x5e0d('0x24')]='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';}else if(_0x5d5e8c['status']==='Failed'){_0x4ef682[_0x5e0d('0x22')]['text']='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[_0x5e0d('0xd')](_0x5e0d('0x2f'),_0x5d5e8c[_0x5e0d('0x21')]);}}if(_0x43f42c){return client['request']('SendMail',_0x4ef682)[_0x5e0d('0xc')](function(_0x677ee9){if(_0x677ee9['error']){return logger[_0x5e0d('0xd')](_0x5e0d('0x30'),JSON[_0x5e0d('0x25')](_0x677ee9));}return logger[_0x5e0d('0xe')](_0x5e0d('0x31'));})[_0x5e0d('0x32')](function(_0x3fac58){return logger[_0x5e0d('0xd')](_0x5e0d('0x30'),JSON[_0x5e0d('0x25')](_0x3fac58));});}}function handleError(){return function(_0x4d4d8d){return logger[_0x5e0d('0xd')](JSON['stringify'](_0x4d4d8d));};}function loading(_0x3107aa){logger[_0x5e0d('0xe')]('case\x20loading');if(_0x3107aa[_0x5e0d('0x33')]===_0x3107aa[_0x5e0d('0x34')][_0x5e0d('0x35')]){handleSendEmail(_0x3107aa[_0x5e0d('0x36')],_0x3107aa[_0x5e0d('0x37')]);_0x3107aa[_0x5e0d('0x38')]['stop']();}else{_0x3107aa[_0x5e0d('0x38')][_0x5e0d('0x39')](_0x5e0d('0x3a'));}}function completed(_0x158453){logger['info']('case\x20completed');handleSendEmail(_0x158453['job'],_0x158453[_0x5e0d('0x37')]);_0x158453[_0x5e0d('0x38')]['stop']();}function empty(_0x3a731c){logger['info'](_0x5e0d('0x3b'));handleSendEmail(_0x3a731c[_0x5e0d('0x36')],_0x3a731c[_0x5e0d('0x37')]);_0x3a731c[_0x5e0d('0x38')][_0x5e0d('0x3c')]();}function failed(_0x249769){logger[_0x5e0d('0xe')](_0x5e0d('0x3d'));handleSendEmail(_0x249769['job'],_0x249769[_0x5e0d('0x37')]);_0x249769[_0x5e0d('0x38')][_0x5e0d('0x3c')]();}function urecognized(_0x47d489){logger[_0x5e0d('0xd')](_0x5e0d('0x3e'),_0x47d489[_0x5e0d('0x3f')]['dataValues'][_0x5e0d('0x21')]);_0x47d489[_0x5e0d('0x38')][_0x5e0d('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1f14b2,_0xebbb9e){const _0x4cbcd9={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x4aca66=retry['operation'](_0x4cbcd9);_0x4aca66[_0x5e0d('0x40')](_0x57fb25=>{logger[_0x5e0d('0xe')](_0x5e0d('0x41')+_0x1f14b2['id']+_0x5e0d('0x42')+_0x57fb25);try{getReportData(_0xebbb9e['id'])[_0x5e0d('0xc')](function(_0x4114fc){_0xebbb9e=_0x4114fc;logger[_0x5e0d('0xe')](_0x5e0d('0x43'),_0x4114fc['dataValues'][_0x5e0d('0x21')]);if(!reportStatusStrategies[_0x4114fc[_0x5e0d('0x44')]['status']]){logger['error'](_0x5e0d('0x43'),_0x4114fc[_0x5e0d('0x44')]['status']);_0x4aca66['retry']();}reportStatusStrategies[_0x4114fc[_0x5e0d('0x44')][_0x5e0d('0x21')]]({'operation':_0x4aca66,'currentAttempt':_0x57fb25,'retryOptions':_0x4cbcd9,'job':_0x1f14b2,'data':_0xebbb9e,'entity':_0x4114fc});});}catch(_0x593c08){_0x4aca66[_0x5e0d('0x39')](_0x593c08);}});}function handleResult(_0x427dc3){return function(_0x4d139f){if(_0x427dc3[_0x5e0d('0x45')]&&_0x427dc3[_0x5e0d('0x11')]&&_0x427dc3['MailAccount'][_0x5e0d('0x14')]&&!_[_0x5e0d('0x46')](_0x427dc3[_0x5e0d('0x10')])){retryer(_0x427dc3,_0x4d139f);}};}function handleJob(_0x2216a1){return function(){try{if(_[_0x5e0d('0x46')](_0x2216a1[_0x5e0d('0x18')])){return logger[_0x5e0d('0xe')](_0x5e0d('0x47'));}if(_['isNil'](_0x2216a1[_0x5e0d('0x19')])){return logger[_0x5e0d('0xe')](_0x5e0d('0x48'));}var _0x12afd0={'startDate':moment()[_0x5e0d('0x49')](_0x2216a1[_0x5e0d('0x18')],_0x2216a1[_0x5e0d('0x19')])[_0x5e0d('0x16')](_0x5e0d('0x4a')),'endDate':moment()['format'](_0x5e0d('0x4a')),'type':'scheduled','output':_0x2216a1[_0x5e0d('0x4b')],'name':_0x2216a1[_0x5e0d('0x17')]};if(!_['isNil'](_0x2216a1[_0x5e0d('0x4c')])){logger[_0x5e0d('0xe')](_0x5e0d('0x4d'),_0x2216a1[_0x5e0d('0x4c')]);return analyticDefaultReportController[_0x5e0d('0x4e')]({'id':_0x2216a1[_0x5e0d('0x4c')]},_0x12afd0)[_0x5e0d('0xc')](handleResult(_0x2216a1))[_0x5e0d('0x32')](handleError());}if(!_[_0x5e0d('0x46')](_0x2216a1[_0x5e0d('0x4f')])){logger[_0x5e0d('0xe')](_0x5e0d('0x50'),_0x2216a1[_0x5e0d('0x4f')]);return analyticCustomReportController[_0x5e0d('0x4e')]({'id':_0x2216a1[_0x5e0d('0x4f')]},_0x12afd0)[_0x5e0d('0xc')](handleResult(_0x2216a1))[_0x5e0d('0x32')](handleError());}}catch(_0x54c4c8){logger['error'](JSON[_0x5e0d('0x25')](_0x54c4c8));}return logger['info'](_0x5e0d('0x51'));};}function getJobs(_0x3ea8f4){var _0x26393c={};if(_0x3ea8f4){_0x26393c['id']=_0x3ea8f4;}return db[_0x5e0d('0x52')][_0x5e0d('0x53')]({'where':_0x26393c,'include':[{'model':db[_0x5e0d('0x11')],'attributes':['id',_0x5e0d('0x17'),_0x5e0d('0x10')],'include':[{'model':db[_0x5e0d('0x54')],'as':_0x5e0d('0x14'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})['then'](function(_0x59529f){var _0x4821ef=_[_0x5e0d('0x55')](manager[_0x5e0d('0x56')]);var _0x41000f=_[_0x5e0d('0x57')](_0x59529f,function(_0x2279d6){return _0x2279d6['id'][_0x5e0d('0x58')]();});var _0x6783bd=_[_0x5e0d('0x59')](_0x59529f,function(_0xcc4029){return _0xcc4029['id'][_0x5e0d('0x58')]();});var _0x21e372=_0x3ea8f4?_0x41000f:_[_0x5e0d('0x5a')](_0x41000f,_0x4821ef);var _0x7d2790=_[_0x5e0d('0x5b')](_0x41000f,_0x4821ef);var _0x240ebd=_['difference'](_0x4821ef,_0x41000f);var _0x2b3a1b;var _0x9638b8;for(_0x2b3a1b=0x0;_0x2b3a1b<_0x240ebd['length']&&!_0x3ea8f4;_0x2b3a1b+=0x1){_0x9638b8=_0x240ebd[_0x2b3a1b][_0x5e0d('0x58')]();if(manager[_0x5e0d('0x5c')](_0x9638b8)){manager[_0x5e0d('0x3c')](_0x9638b8);manager['deleteJob'](_0x9638b8);logger['info'](_0x5e0d('0x5d'),_0x9638b8);}}logger['info'](_0x5e0d('0x5e'),JSON[_0x5e0d('0x25')](_0x21e372));for(_0x2b3a1b=0x0;_0x2b3a1b<_0x21e372[_0x5e0d('0x5f')];_0x2b3a1b+=0x1){_0x9638b8=_0x21e372[_0x2b3a1b][_0x5e0d('0x58')]();if(_0x3ea8f4){logger['info'](JSON[_0x5e0d('0x25')](_0x6783bd[_0x9638b8]));BPromise[_0x5e0d('0x60')]()[_0x5e0d('0xc')](handleJob(_0x6783bd[_0x9638b8]));logger[_0x5e0d('0xe')](_0x5e0d('0x61'),_0x6783bd[_0x9638b8]['name'],_0x6783bd[_0x9638b8]['cron']);}else if(_0x6783bd[_0x9638b8]['cron']&&_0x6783bd[_0x9638b8][_0x5e0d('0x62')]&&moment()['isBetween'](_0x6783bd[_0x9638b8][_0x5e0d('0x63')],_0x6783bd[_0x9638b8]['endAt'])){manager[_0x5e0d('0x64')](_0x9638b8,_0x6783bd[_0x9638b8]['cron'],handleJob(_0x6783bd[_0x9638b8]));manager['start'](_0x9638b8);logger[_0x5e0d('0xe')](_0x5e0d('0x65'),_0x6783bd[_0x9638b8][_0x5e0d('0x17')],_0x6783bd[_0x9638b8][_0x5e0d('0x66')]);}else if(manager['exists'](_0x9638b8)){manager[_0x5e0d('0x3c')](_0x9638b8);manager[_0x5e0d('0x67')](_0x9638b8);logger[_0x5e0d('0xe')]('stop\x20cron',_0x6783bd[_0x9638b8][_0x5e0d('0x17')],_0x6783bd[_0x9638b8]['cron']);}}for(_0x2b3a1b=0x0,_0x9638b8;_0x2b3a1b<_0x7d2790[_0x5e0d('0x5f')]&&!_0x3ea8f4;_0x2b3a1b+=0x1){_0x9638b8=_0x7d2790[_0x2b3a1b][_0x5e0d('0x58')]();if(manager['exists'](_0x9638b8)){if(_0x6783bd[_0x9638b8][_0x5e0d('0x66')]&&_0x6783bd[_0x9638b8][_0x5e0d('0x62')]&&moment()[_0x5e0d('0x68')](_0x6783bd[_0x9638b8]['startAt'],_0x6783bd[_0x9638b8][_0x5e0d('0x69')])){manager[_0x5e0d('0x6a')](_0x9638b8,_0x6783bd[_0x9638b8]['cron'],handleJob(_0x6783bd[_0x9638b8]));logger[_0x5e0d('0xe')](_0x5e0d('0x6b'),_0x6783bd[_0x9638b8]['name'],_0x6783bd[_0x9638b8]['cron']);}else{manager['stop'](_0x9638b8);manager[_0x5e0d('0x67')](_0x9638b8);logger[_0x5e0d('0xe')](_0x5e0d('0x6c'),_0x6783bd[_0x9638b8][_0x5e0d('0x17')],_0x6783bd[_0x9638b8]['cron']);}}}})['catch'](function(_0x5cc9b3){logger[_0x5e0d('0xd')](JSON[_0x5e0d('0x25')](_0x5cc9b3));});}exports[_0x5e0d('0x6d')]=function(_0x4c9212){return getJobs(_0x4c9212);};exports[_0x5e0d('0x6e')]=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 f331652..337ebfc 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 _0xa20a=['transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Sentiment\x20Analysis\x20not\x20configured','Neutral','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','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'];(function(_0x1ead8f,_0x325f7d){var _0x87e090=function(_0x2a42d1){while(--_0x2a42d1){_0x1ead8f['push'](_0x1ead8f['shift']());}};_0x87e090(++_0x325f7d);}(_0xa20a,0x74));var _0xaa20=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa20a[_0x40a045];return _0x1a687c;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xaa20('0x0'));var util=require(_0xaa20('0x1'));var BPromise=require(_0xaa20('0x2'));var db=require(_0xaa20('0x3'))['db'];var logger=require('../../config/logger')(_0xaa20('0x4'));function getTranscriptionJob(_0x20a8ad,_0x1497a0,_0x40cb4c,_0x46ae89){return new Promise(function(_0x5ac74e,_0x54ecbc){var _0x413b88=new AWS[(_0xaa20('0x5'))]({'accessKeyId':_0x1497a0,'secretAccessKey':_0x20a8ad,'region':_0x40cb4c});_0x413b88[_0xaa20('0x6')]({'TranscriptionJobName':_0x46ae89},function(_0x181df0,_0x271ed1){if(_0x181df0){return _0x54ecbc(_0x181df0);}else{return _0x5ac74e(_0x271ed1);}});});}function sentiment(_0x1983e8,_0x1e0186,_0x12d403,_0x17692f,_0x1f1d3a){return new Promise(function(_0x3b71a4,_0x590395){var _0xcc3d59=new AWS[(_0xaa20('0x7'))]({'accessKeyId':_0x1e0186,'secretAccessKey':_0x1983e8,'region':_0x12d403});_0xcc3d59['detectSentiment']({'Text':_0x17692f,'LanguageCode':_0x1f1d3a[_0xaa20('0x8')](0x0,0x2)},function(_0x249f4a,_0x2d527a){if(_0x249f4a){return _0x590395(_0x249f4a);}else{return _0x3b71a4(_0x2d527a);}});});}function checkTranscribeJob(_0x1e18cc,_0x36f915,_0x2fdd4f){var _0x48848f;return new BPromise(function(_0x2ef6e3,_0x163677){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0xb'),_0x1e18cc['id'],_0x1e18cc[_0xaa20('0xc')]));return getTranscriptionJob(_0x2fdd4f[_0xaa20('0xd')],_0x2fdd4f[_0xaa20('0xe')],_0x36f915[_0xaa20('0xf')],_0x1e18cc[_0xaa20('0xc')])[_0xaa20('0x10')](function(_0x30f531){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x11'),_0x1e18cc['id'],_0x1e18cc[_0xaa20('0xc')],_0x30f531[_0xaa20('0x12')]['TranscriptionJobStatus']));if(!_0x1e18cc[_0xaa20('0x13')]){switch(_0x30f531['TranscriptionJob'][_0xaa20('0x14')]){case _0xaa20('0x15'):var _0x4c0bdb={'transcribeStatus':_0x30f531[_0xaa20('0x12')][_0xaa20('0x14')],'fileUri':_0x30f531[_0xaa20('0x12')][_0xaa20('0x16')][_0xaa20('0x17')]};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x1e18cc['id']));return rp({'uri':_0x30f531['TranscriptionJob']['Transcript'][_0xaa20('0x17')],'json':!![]})[_0xaa20('0x10')](function(_0x10c96e){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x18'),_0x1e18cc['id']));if(_0x10c96e&&_0x10c96e[_0xaa20('0x19')]&&_0x10c96e[_0xaa20('0x19')][_0xaa20('0x1a')]&&_0x10c96e['results']['transcripts'][_0xaa20('0x1b')]){_0x4c0bdb[_0xaa20('0x13')]='';for(var _0x55ac29=0x0;_0x55ac29<_0x10c96e[_0xaa20('0x19')][_0xaa20('0x1a')]['length'];_0x55ac29++){_0x4c0bdb[_0xaa20('0x13')]+=_0x10c96e[_0xaa20('0x19')]['transcripts'][_0x55ac29][_0xaa20('0x1c')]+'';}}return _0x1e18cc['update'](_0x4c0bdb);})[_0xaa20('0x10')](function(){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x1d'),_0x1e18cc['id']));if(!_0x1e18cc[_0xaa20('0x1e')]){throw new db[(_0xaa20('0x1f'))]['ValidationError'](_0xaa20('0x20'));}if(!_0x36f915['sentiment']||!_0x36f915['sentimentAccountId']||!_0x36f915[_0xaa20('0x21')]||!_0x36f915[_0xaa20('0x22')]||!_0x36f915[_0xaa20('0x23')]){throw new db[(_0xaa20('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4c0bdb[_0xaa20('0x13')]){throw new Error(_0xaa20('0x24'));}if(_0x36f915['sentimentAccountId']===_0x2fdd4f['id']){return _0x2fdd4f;}else{return db[_0xaa20('0x25')][_0xaa20('0x26')]({'where':{'id':_settings[_0xaa20('0x27')]}});}})[_0xaa20('0x10')](function(_0x27b988){if(!_0x27b988){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x29'));}if(!_0x27b988[_0xaa20('0xd')]||!_0x27b988[_0xaa20('0xe')]){throw new db['Sequelize'][(_0xaa20('0x28'))](_0xaa20('0x2a'));}_0x48848f=_0x27b988;logger[_0xaa20('0x9')](util[_0xaa20('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1e18cc['id']));return sentiment(_0x48848f['data1'],_0x48848f[_0xaa20('0xe')],_0x36f915[_0xaa20('0x21')],_0x4c0bdb[_0xaa20('0x13')],_0x36f915['language']);})[_0xaa20('0x10')](function(_0x2cf8a0){logger[_0xaa20('0x9')](util['format'](_0xaa20('0x2b'),_0x1e18cc['id']));return _0x1e18cc[_0xaa20('0x2c')]({'sentiment':_0x2cf8a0[_0xaa20('0x2d')],'sPositive':_0x2cf8a0[_0xaa20('0x2e')][_0xaa20('0x2f')],'sNegative':_0x2cf8a0[_0xaa20('0x2e')][_0xaa20('0x30')],'sMixed':_0x2cf8a0['SentimentScore'][_0xaa20('0x31')],'sNeutral':_0x2cf8a0['SentimentScore']['Neutral']});})[_0xaa20('0x10')](function(){logger[_0xaa20('0x9')](util['format'](_0xaa20('0x1d'),_0x1e18cc['id']));_0x2ef6e3();});case _0xaa20('0x32'):return _0x1e18cc[_0xaa20('0x2c')]({'transcribeStatus':_0xaa20('0x32'),'failureReason':_0x30f531[_0xaa20('0x12')][_0xaa20('0x33')]})[_0xaa20('0x10')](function(){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x1d'),_0x1e18cc['id']));_0x2ef6e3();});default:logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x34'),_0x1e18cc['id']));break;}}else{return BPromise[_0xaa20('0x35')]()['then'](function(){if(!_0x1e18cc[_0xaa20('0x1e')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x36f915[_0xaa20('0x36')]||!_0x36f915['sentimentAccountId']||!_0x36f915[_0xaa20('0x21')]||!_0x36f915['language']||!_0x36f915[_0xaa20('0x23')]){throw new db['Sequelize'][(_0xaa20('0x28'))](_0xaa20('0x37'));}if(!_0x1e18cc[_0xaa20('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x36f915[_0xaa20('0x27')]===_0x2fdd4f['id']){return _0x2fdd4f;}else{return db[_0xaa20('0x25')][_0xaa20('0x26')]({'where':{'id':_settings[_0xaa20('0x27')]}});}})[_0xaa20('0x10')](function(_0x1481c3){if(!_0x1481c3){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x29'));}if(!_0x1481c3['data1']||!_0x1481c3[_0xaa20('0xe')]){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x2a'));}_0x48848f=_0x1481c3;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1e18cc['id']));return sentiment(_0x48848f['data1'],_0x48848f['data2'],_0x36f915[_0xaa20('0x21')],_0x1e18cc[_0xaa20('0x13')],_0x36f915['language']);})[_0xaa20('0x10')](function(_0x34da3c){logger[_0xaa20('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1e18cc['id']));return _0x1e18cc['update']({'sentiment':_0x34da3c[_0xaa20('0x2d')],'sPositive':_0x34da3c['SentimentScore'][_0xaa20('0x2f')],'sNegative':_0x34da3c['SentimentScore'][_0xaa20('0x30')],'sMixed':_0x34da3c[_0xaa20('0x2e')][_0xaa20('0x31')],'sNeutral':_0x34da3c[_0xaa20('0x2e')][_0xaa20('0x38')],'transcribeStatus':_0xaa20('0x15')});})[_0xaa20('0x10')](function(){logger['info'](util[_0xaa20('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1e18cc['id']));_0x2ef6e3();});}})['catch'](function(_0x19df3b){if(_0x19df3b){if(!_0x19df3b[_0xaa20('0x39')]||_0x19df3b[_0xaa20('0x39')]!==_0xaa20('0x3a')){logger[_0xaa20('0x3b')](util[_0xaa20('0xa')](_0xaa20('0x3c'),_0x1e18cc['id']),util[_0xaa20('0x3d')](_0x19df3b,{'showHidden':![],'depth':null}));}}_0x2ef6e3();});});}function checkTranscribe(){var _0x21cdbd;var _0x597d12;var _0x14de4a;return db['VoiceRecording'][_0xaa20('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xaa20('0x10')](function(_0x209a48){if(!_0x209a48||!_0x209a48['length']){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x3f'));}_0x21cdbd=_0x209a48;return db[_0xaa20('0x40')][_0xaa20('0x26')]({'where':{'id':0x1}});})['then'](function(_0x3a9b1a){if(!_0x3a9b1a){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x41'));}_0x597d12=_0x3a9b1a;if(!_0x597d12[_0xaa20('0x4')]||!_0x597d12[_0xaa20('0x42')]||!_0x597d12[_0xaa20('0xf')]||!_0x597d12[_0xaa20('0x22')]||!_0x597d12[_0xaa20('0x23')]){throw new db['Sequelize'][(_0xaa20('0x28'))](_0xaa20('0x43'));}return db['CloudProvider'][_0xaa20('0x26')]({'where':{'id':_0x597d12['transcribeAccountId']}});})[_0xaa20('0x10')](function(_0x23174e){if(!_0x23174e){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x29'));}if(!_0x23174e[_0xaa20('0xd')]||!_0x23174e[_0xaa20('0xe')]){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))]('Cloud\x20Provider\x20not\x20configured');}_0x14de4a=_0x23174e;var _0xdb599f=[];_0x21cdbd[_0xaa20('0x44')](function(_0x5e6bfa){_0xdb599f[_0xaa20('0x45')](checkTranscribeJob(_0x5e6bfa,_0x597d12,_0x14de4a));});return BPromise[_0xaa20('0x46')](_0xdb599f);})['catch'](function(_0x15f764){if(_0x15f764){if(!_0x15f764['name']||_0x15f764[_0xaa20('0x39')]!==_0xaa20('0x3a')){logger[_0xaa20('0x3b')](util[_0xaa20('0x3d')](_0x15f764,{'showHidden':![],'depth':null}));}}});}exports[_0xaa20('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x351d=['lodash','request-promise','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Transcript\x20not\x20available','CloudProvider','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','tempSentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','Sentiment','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','start'];(function(_0x341a8a,_0xcca93b){var _0x3f5321=function(_0x43b97f){while(--_0x43b97f){_0x341a8a['push'](_0x341a8a['shift']());}};_0x3f5321(++_0xcca93b);}(_0x351d,0x90));var _0xd351=function(_0xa87ad9,_0x135024){_0xa87ad9=_0xa87ad9-0x0;var _0x6f7e20=_0x351d[_0xa87ad9];return _0x6f7e20;};var _=require(_0xd351('0x0'));var AWS=require('aws-sdk');var rp=require(_0xd351('0x1'));var util=require(_0xd351('0x2'));var BPromise=require(_0xd351('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xd351('0x4'))('transcribe');function getTranscriptionJob(_0x41d16d,_0x151391,_0x49610f,_0x1cd581){return new Promise(function(_0x45e9e5,_0x88bd2b){var _0x5318b2=new AWS[(_0xd351('0x5'))]({'accessKeyId':_0x151391,'secretAccessKey':_0x41d16d,'region':_0x49610f});_0x5318b2[_0xd351('0x6')]({'TranscriptionJobName':_0x1cd581},function(_0x4e1b06,_0x2e9a2a){if(_0x4e1b06){return _0x88bd2b(_0x4e1b06);}else{return _0x45e9e5(_0x2e9a2a);}});});}function sentiment(_0xb4f580,_0x51c5f4,_0x586c60,_0x44bf81,_0x4904b4){return new Promise(function(_0x34cfc7,_0x39b8c8){var _0x5949a4=new AWS[(_0xd351('0x7'))]({'accessKeyId':_0x51c5f4,'secretAccessKey':_0xb4f580,'region':_0x586c60});_0x5949a4[_0xd351('0x8')]({'Text':_0x44bf81,'LanguageCode':_0x4904b4['substring'](0x0,0x2)},function(_0x12f262,_0x59f502){if(_0x12f262){return _0x39b8c8(_0x12f262);}else{return _0x34cfc7(_0x59f502);}});});}function checkTranscribeJob(_0x54dd65,_0x3eb40c,_0x15549a){var _0x23445f;return new BPromise(function(_0x1eb2a9,_0x4917d5){logger[_0xd351('0x9')](util[_0xd351('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x54dd65['id'],_0x54dd65[_0xd351('0xb')]));return getTranscriptionJob(_0x15549a[_0xd351('0xc')],_0x15549a[_0xd351('0xd')],_0x3eb40c[_0xd351('0xe')],_0x54dd65[_0xd351('0xb')])['then'](function(_0x9f790f){logger['info'](util['format'](_0xd351('0xf'),_0x54dd65['id'],_0x54dd65['transcribeName'],_0x9f790f[_0xd351('0x10')][_0xd351('0x11')]));if(!_0x54dd65[_0xd351('0x12')]){switch(_0x9f790f['TranscriptionJob'][_0xd351('0x11')]){case _0xd351('0x13'):var _0x77985a={'transcribeStatus':_0x9f790f[_0xd351('0x10')]['TranscriptionJobStatus'],'fileUri':_0x9f790f[_0xd351('0x10')]['Transcript']['TranscriptFileUri']};logger[_0xd351('0x9')](util['format'](_0xd351('0x14'),_0x54dd65['id']));return rp({'uri':_0x9f790f[_0xd351('0x10')][_0xd351('0x15')][_0xd351('0x16')],'json':!![]})[_0xd351('0x17')](function(_0x53e729){logger[_0xd351('0x9')](util[_0xd351('0xa')](_0xd351('0x18'),_0x54dd65['id']));if(_0x53e729&&_0x53e729['results']&&_0x53e729[_0xd351('0x19')][_0xd351('0x1a')]&&_0x53e729[_0xd351('0x19')]['transcripts'][_0xd351('0x1b')]){_0x77985a[_0xd351('0x12')]='';for(var _0x4626c4=0x0;_0x4626c4<_0x53e729[_0xd351('0x19')]['transcripts'][_0xd351('0x1b')];_0x4626c4++){_0x77985a['fileText']+=_0x53e729[_0xd351('0x19')][_0xd351('0x1a')][_0x4626c4]['transcript']+'';}}return _0x54dd65[_0xd351('0x1c')](_0x77985a);})['then'](function(){logger['info'](util[_0xd351('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x54dd65['id']));if(!_0x54dd65['tempSentiment']){throw new db[(_0xd351('0x1d'))]['ValidationError'](_0xd351('0x1e'));}if(!_0x3eb40c[_0xd351('0x1f')]||!_0x3eb40c[_0xd351('0x20')]||!_0x3eb40c['sentimentRegion']||!_0x3eb40c[_0xd351('0x21')]||!_0x3eb40c['bucket']){throw new db[(_0xd351('0x1d'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x77985a[_0xd351('0x12')]){throw new Error(_0xd351('0x22'));}if(_0x3eb40c[_0xd351('0x20')]===_0x15549a['id']){return _0x15549a;}else{return db[_0xd351('0x23')]['findOne']({'where':{'id':_settings[_0xd351('0x20')]}});}})[_0xd351('0x17')](function(_0x38023c){if(!_0x38023c){throw new db[(_0xd351('0x1d'))][(_0xd351('0x24'))](_0xd351('0x25'));}if(!_0x38023c[_0xd351('0xc')]||!_0x38023c[_0xd351('0xd')]){throw new db[(_0xd351('0x1d'))]['ValidationError'](_0xd351('0x26'));}_0x23445f=_0x38023c;logger[_0xd351('0x9')](util[_0xd351('0xa')](_0xd351('0x27'),_0x54dd65['id']));return sentiment(_0x23445f['data1'],_0x23445f[_0xd351('0xd')],_0x3eb40c[_0xd351('0x28')],_0x77985a[_0xd351('0x12')],_0x3eb40c[_0xd351('0x21')]);})[_0xd351('0x17')](function(_0x37fbb8){logger[_0xd351('0x9')](util[_0xd351('0xa')](_0xd351('0x29'),_0x54dd65['id']));return _0x54dd65['update']({'sentiment':_0x37fbb8['Sentiment'],'sPositive':_0x37fbb8[_0xd351('0x2a')][_0xd351('0x2b')],'sNegative':_0x37fbb8[_0xd351('0x2a')][_0xd351('0x2c')],'sMixed':_0x37fbb8[_0xd351('0x2a')][_0xd351('0x2d')],'sNeutral':_0x37fbb8['SentimentScore']['Neutral']});})[_0xd351('0x17')](function(){logger['info'](util[_0xd351('0xa')](_0xd351('0x2e'),_0x54dd65['id']));_0x1eb2a9();});case _0xd351('0x2f'):return _0x54dd65[_0xd351('0x1c')]({'transcribeStatus':_0xd351('0x2f'),'failureReason':_0x9f790f[_0xd351('0x10')][_0xd351('0x30')]})[_0xd351('0x17')](function(){logger[_0xd351('0x9')](util[_0xd351('0xa')](_0xd351('0x2e'),_0x54dd65['id']));_0x1eb2a9();});default:logger['info'](util[_0xd351('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x54dd65['id']));break;}}else{return BPromise[_0xd351('0x31')]()[_0xd351('0x17')](function(){if(!_0x54dd65[_0xd351('0x32')]){throw new db[(_0xd351('0x1d'))][(_0xd351('0x24'))](_0xd351('0x1e'));}if(!_0x3eb40c['sentiment']||!_0x3eb40c[_0xd351('0x20')]||!_0x3eb40c[_0xd351('0x28')]||!_0x3eb40c['language']||!_0x3eb40c[_0xd351('0x33')]){throw new db[(_0xd351('0x1d'))][(_0xd351('0x24'))](_0xd351('0x34'));}if(!_0x54dd65[_0xd351('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x3eb40c['sentimentAccountId']===_0x15549a['id']){return _0x15549a;}else{return db[_0xd351('0x23')][_0xd351('0x35')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x16677f){if(!_0x16677f){throw new db[(_0xd351('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x16677f[_0xd351('0xc')]||!_0x16677f[_0xd351('0xd')]){throw new db[(_0xd351('0x1d'))][(_0xd351('0x24'))](_0xd351('0x26'));}_0x23445f=_0x16677f;logger[_0xd351('0x9')](util[_0xd351('0xa')](_0xd351('0x27'),_0x54dd65['id']));return sentiment(_0x23445f[_0xd351('0xc')],_0x23445f['data2'],_0x3eb40c['sentimentRegion'],_0x54dd65[_0xd351('0x12')],_0x3eb40c[_0xd351('0x21')]);})[_0xd351('0x17')](function(_0x35f38f){logger[_0xd351('0x9')](util[_0xd351('0xa')](_0xd351('0x29'),_0x54dd65['id']));return _0x54dd65[_0xd351('0x1c')]({'sentiment':_0x35f38f[_0xd351('0x36')],'sPositive':_0x35f38f[_0xd351('0x2a')][_0xd351('0x2b')],'sNegative':_0x35f38f[_0xd351('0x2a')][_0xd351('0x2c')],'sMixed':_0x35f38f[_0xd351('0x2a')][_0xd351('0x2d')],'sNeutral':_0x35f38f[_0xd351('0x2a')]['Neutral'],'transcribeStatus':_0xd351('0x13')});})[_0xd351('0x17')](function(){logger[_0xd351('0x9')](util['format'](_0xd351('0x2e'),_0x54dd65['id']));_0x1eb2a9();});}})[_0xd351('0x37')](function(_0x3505fa){if(_0x3505fa){if(!_0x3505fa[_0xd351('0x38')]||_0x3505fa[_0xd351('0x38')]!=='SequelizeValidationError'){logger[_0xd351('0x39')](util['format'](_0xd351('0x3a'),_0x54dd65['id']),util[_0xd351('0x3b')](_0x3505fa,{'showHidden':![],'depth':null}));}}_0x1eb2a9();});});}function checkTranscribe(){var _0x4fd7c4;var _0x57c1b4;var _0x1bd727;return db[_0xd351('0x3c')][_0xd351('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xd351('0x17')](function(_0x35b52a){if(!_0x35b52a||!_0x35b52a['length']){throw new db[(_0xd351('0x1d'))]['ValidationError'](_0xd351('0x3e'));}_0x4fd7c4=_0x35b52a;return db[_0xd351('0x3f')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x25ea1e){if(!_0x25ea1e){throw new db['Sequelize'][(_0xd351('0x24'))](_0xd351('0x40'));}_0x57c1b4=_0x25ea1e;if(!_0x57c1b4[_0xd351('0x41')]||!_0x57c1b4['transcribeAccountId']||!_0x57c1b4[_0xd351('0xe')]||!_0x57c1b4['language']||!_0x57c1b4['bucket']){throw new db['Sequelize'][(_0xd351('0x24'))](_0xd351('0x42'));}return db[_0xd351('0x23')]['findOne']({'where':{'id':_0x57c1b4['transcribeAccountId']}});})[_0xd351('0x17')](function(_0x42f248){if(!_0x42f248){throw new db['Sequelize'][(_0xd351('0x24'))](_0xd351('0x25'));}if(!_0x42f248['data1']||!_0x42f248[_0xd351('0xd')]){throw new db['Sequelize'][(_0xd351('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x1bd727=_0x42f248;var _0x6f0446=[];_0x4fd7c4[_0xd351('0x43')](function(_0x169ab1){_0x6f0446[_0xd351('0x44')](checkTranscribeJob(_0x169ab1,_0x57c1b4,_0x1bd727));});return BPromise[_0xd351('0x45')](_0x6f0446);})[_0xd351('0x37')](function(_0x1bcbb0){if(_0x1bcbb0){if(!_0x1bcbb0['name']||_0x1bcbb0['name']!==_0xd351('0x46')){logger[_0xd351('0x39')](util['inspect'](_0x1bcbb0,{'showHidden':![],'depth':null}));}}});}exports[_0xd351('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 5160428..208d9b8 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 _0xa414=['format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','system'];(function(_0x34fa8e,_0x2d8a80){var _0x3865c6=function(_0x16a284){while(--_0x16a284){_0x34fa8e['push'](_0x34fa8e['shift']());}};_0x3865c6(++_0x2d8a80);}(_0xa414,0xc3));var _0x4a41=function(_0x368ca2,_0x4d00b4){_0x368ca2=_0x368ca2-0x0;var _0x2c3fd2=_0xa414[_0x368ca2];return _0x2c3fd2;};'use strict';var _=require('lodash');var moment=require(_0x4a41('0x0'));var Redis=require(_0x4a41('0x1'));var util=require(_0x4a41('0x2'));var config=require(_0x4a41('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x4a41('0x4'))(_0x4a41('0x5'));config[_0x4a41('0x6')]=_[_0x4a41('0x7')](config[_0x4a41('0x6')],{'host':_0x4a41('0x8'),'port':0x18eb});var io=require(_0x4a41('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x59ece6=[];return db['WhatsappInteraction'][_0x4a41('0xa')]({'raw':!![],'attributes':['id',_0x4a41('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4a41('0xc')](0x18,_0x4a41('0xd'))}}})[_0x4a41('0xe')](function(_0x341e50){if(_0x341e50&&_0x341e50[_0x4a41('0xf')]){_0x59ece6=_[_0x4a41('0x10')](_0x341e50||[],'id');logger[_0x4a41('0x11')](_0x4a41('0x12'),_0x59ece6['join']());return db[_0x4a41('0x13')][_0x4a41('0x14')]({'closeReason':_0x4a41('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4a41('0x16')](_0x4a41('0x17'))},{'where':{'id':_0x59ece6}});}})[_0x4a41('0xe')](function(){if(_0x59ece6&&_0x59ece6[_0x4a41('0xf')]){logger[_0x4a41('0x11')](_0x4a41('0x18'),_0x59ece6[_0x4a41('0x19')]());for(var _0x2af4ab=0x0;_0x2af4ab<_0x59ece6['length'];_0x2af4ab++){io['emit'](_0x4a41('0x1a'),{'id':_0x59ece6[_0x2af4ab],'closed':!![]});}}})[_0x4a41('0x1b')](function(_0x5d31ee){logger[_0x4a41('0x1c')](_0x4a41('0x1d'),_0x5d31ee?util['inspect'](_0x5d31ee,{'showHidden':![],'depth':null}):'');});}exports[_0x4a41('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x883b=['inspect','moment','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0x883b,0x15d));var _0xb883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xb883('0x0'));var Redis=require(_0xb883('0x1'));var util=require(_0xb883('0x2'));var config=require('../../config/environment');var db=require(_0xb883('0x3'))['db'];var logger=require('../logger')(_0xb883('0x4'));config[_0xb883('0x5')]=_[_0xb883('0x6')](config[_0xb883('0x5')],{'host':_0xb883('0x7'),'port':0x18eb});var io=require(_0xb883('0x8'))(new Redis(config[_0xb883('0x5')]));function closeInteractions(){var _0x37c207=[];return db[_0xb883('0x9')][_0xb883('0xa')]({'raw':!![],'attributes':['id',_0xb883('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb883('0xc')](0x18,_0xb883('0xd'))}}})[_0xb883('0xe')](function(_0x3216ae){if(_0x3216ae&&_0x3216ae[_0xb883('0xf')]){_0x37c207=_['map'](_0x3216ae||[],'id');logger[_0xb883('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x37c207[_0xb883('0x11')]());return db['WhatsappInteraction'][_0xb883('0x12')]({'closeReason':_0xb883('0x13'),'disposition':_0xb883('0x14'),'closed':!![],'closedAt':moment()[_0xb883('0x15')](_0xb883('0x16'))},{'where':{'id':_0x37c207}});}})[_0xb883('0xe')](function(){if(_0x37c207&&_0x37c207['length']){logger[_0xb883('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x37c207[_0xb883('0x11')]());for(var _0x4712fc=0x0;_0x4712fc<_0x37c207[_0xb883('0xf')];_0x4712fc++){io[_0xb883('0x17')](_0xb883('0x18'),{'id':_0x37c207[_0x4712fc],'closed':!![]});}}})[_0xb883('0x19')](function(_0x23a3b4){logger[_0xb883('0x1a')](_0xb883('0x1b'),_0x23a3b4?util[_0xb883('0x1c')](_0x23a3b4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index b38c1c4..19fca83 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a41=['now','CmContact','log','contacts1','then','CmHopper','bulkCreate','hopper1','contacts2','finished\x20populating','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x52d8cc,_0x2760ed){var _0x4eb02a=function(_0x4c8905){while(--_0x4c8905){_0x52d8cc['push'](_0x52d8cc['shift']());}};_0x4eb02a(++_0x2760ed);}(_0x7a41,0xb7));var _0x17a4=function(_0x456838,_0x2c723d){_0x456838=_0x456838-0x0;var _0x31e31c=_0x7a41[_0x456838];return _0x31e31c;};'use strict';var util=require(_0x17a4('0x0'));var db=require(_0x17a4('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x17a4('0x2')]({'id':i,'firstName':_0x17a4('0x3')+i,'lastName':_0x17a4('0x4')+i,'phone':0xf879fb460+i,'email':_0x17a4('0x5')+i+_0x17a4('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x17a4('0x7')](),'updatedAt':Date[_0x17a4('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x17a4('0x3')+i,'lastName':_0x17a4('0x4')+i,'phone':0xf879fb460+i,'email':_0x17a4('0x5')+i+_0x17a4('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x17a4('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x17a4('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x17a4('0x7')](),'updatedAt':Date['now']()});}db[_0x17a4('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0x17a4('0x8')]['bulkCreate'](contacts);})['then'](function(){console[_0x17a4('0x9')]('finished\x20populating',_0x17a4('0xa'));return db['CmHopper']['destroy']({'where':{}});})[_0x17a4('0xb')](function(){return db[_0x17a4('0xc')][_0x17a4('0xd')](hopper);})['then'](function(){console['log']('finished\x20populating',_0x17a4('0xe'));return db[_0x17a4('0x8')]['bulkCreate'](contacts2);})[_0x17a4('0xb')](function(){console[_0x17a4('0x9')]('finished\x20populating',_0x17a4('0xf'));return db[_0x17a4('0xc')][_0x17a4('0xd')](hopper2);})[_0x17a4('0xb')](function(){console[_0x17a4('0x9')](_0x17a4('0x10'),_0x17a4('0x11'));})[_0x17a4('0x12')](function(_0x3a3c91){console['log'](_0x3a3c91);}); \ No newline at end of file +var _0xa7c4=['finished\x20populating','contacts1','CmHopper','then','CmContact','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','now','Biondo','@xcally.com','destroy','bulkCreate','log'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xa7c4,0xbc));var _0x4a7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7c4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4a7c('0x0'));var db=require(_0x4a7c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4a7c('0x2')]({'id':i,'firstName':_0x4a7c('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4a7c('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4a7c('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x4a7c('0x3')+i,'lastName':_0x4a7c('0x5')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4a7c('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x4a7c('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4a7c('0x4')](),'updatedAt':Date[_0x4a7c('0x4')]()});}db['CmContact'][_0x4a7c('0x7')]({'where':{}})['then'](function(){return db['CmContact'][_0x4a7c('0x8')](contacts);})['then'](function(){console[_0x4a7c('0x9')](_0x4a7c('0xa'),_0x4a7c('0xb'));return db[_0x4a7c('0xc')][_0x4a7c('0x7')]({'where':{}});})[_0x4a7c('0xd')](function(){return db[_0x4a7c('0xc')][_0x4a7c('0x8')](hopper);})['then'](function(){console['log'](_0x4a7c('0xa'),'hopper1');return db[_0x4a7c('0xe')][_0x4a7c('0x8')](contacts2);})['then'](function(){console[_0x4a7c('0x9')]('finished\x20populating',_0x4a7c('0xf'));return db[_0x4a7c('0xc')][_0x4a7c('0x8')](hopper2);})['then'](function(){console[_0x4a7c('0x9')]('finished\x20populating',_0x4a7c('0x10'));})[_0x4a7c('0x11')](function(_0x441ef7){console[_0x4a7c('0x9')](_0x441ef7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e3f03da..749bb45 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3129=['push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','log','add\x20user','catch','../mysqldb'];(function(_0x433d30,_0x5e44e1){var _0x3959ae=function(_0x564d6f){while(--_0x564d6f){_0x433d30['push'](_0x433d30['shift']());}};_0x3959ae(++_0x5e44e1);}(_0x3129,0x18e));var _0x9312=function(_0x4c4662,_0x54f08c){_0x4c4662=_0x4c4662-0x0;var _0x35fc3=_0x3129[_0x4c4662];return _0x35fc3;};'use strict';var util=require('util');var db=require(_0x9312('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9312('0x1')]({'name':util[_0x9312('0x2')](_0x9312('0x3'),_0x9312('0x4'),i),'fullname':util[_0x9312('0x2')](_0x9312('0x3'),_0x9312('0x4'),i),'email':util[_0x9312('0x2')](_0x9312('0x5'),_0x9312('0x4'),i),'role':_0x9312('0x4'),'password':_0x9312('0x6'),'internal':0xfa0+i,'type':_0x9312('0x7'),'transport':[_0x9312('0x8'),'ws',_0x9312('0x9')],'disallow':[_0x9312('0xa')],'allow':[_0x9312('0xb')],'defaultuser':util[_0x9312('0x2')](_0x9312('0x3'),_0x9312('0x4'),i),'encryption':'yes','avpf':_0x9312('0xc'),'force_avp':_0x9312('0xc'),'icesupport':_0x9312('0xc'),'dtlsenable':_0x9312('0xc'),'dtlsverify':'no','dtlscertfile':_0x9312('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x9312('0x2')](_0x9312('0xe'),util[_0x9312('0x2')](_0x9312('0x3'),_0x9312('0x4'),i),0xfa0+i)});}db[_0x9312('0xf')]['bulkCreate'](users)['then'](function(){console[_0x9312('0x10')](_0x9312('0x11'));})[_0x9312('0x12')](function(_0x1c9630){console[_0x9312('0x10')](_0x1c9630);}); \ No newline at end of file +var _0x34d1=['push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','log','add\x20user','catch','../mysqldb'];(function(_0x5efe01,_0x4feeac){var _0x33fe13=function(_0x2d154b){while(--_0x2d154b){_0x5efe01['push'](_0x5efe01['shift']());}};_0x33fe13(++_0x4feeac);}(_0x34d1,0x103));var _0x134d=function(_0x56a4b5,_0x52337b){_0x56a4b5=_0x56a4b5-0x0;var _0x392b5f=_0x34d1[_0x56a4b5];return _0x392b5f;};'use strict';var util=require('util');var db=require(_0x134d('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x134d('0x1')]({'name':util[_0x134d('0x2')](_0x134d('0x3'),'agent',i),'fullname':util[_0x134d('0x2')](_0x134d('0x3'),_0x134d('0x4'),i),'email':util['format'](_0x134d('0x5'),_0x134d('0x4'),i),'role':_0x134d('0x4'),'password':_0x134d('0x6'),'internal':0xfa0+i,'type':_0x134d('0x7'),'transport':[_0x134d('0x8'),'ws',_0x134d('0x9')],'disallow':[_0x134d('0xa')],'allow':[_0x134d('0xb')],'defaultuser':util[_0x134d('0x2')](_0x134d('0x3'),_0x134d('0x4'),i),'encryption':_0x134d('0xc'),'avpf':'yes','force_avp':'yes','icesupport':_0x134d('0xc'),'dtlsenable':_0x134d('0xc'),'dtlsverify':'no','dtlscertfile':_0x134d('0xd'),'dtlsprivatekey':_0x134d('0xe'),'dtlssetup':_0x134d('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x134d('0x2')]('%s%s',_0x134d('0x4'),i),0xfa0+i)});}db['User'][_0x134d('0x10')](users)['then'](function(){console[_0x134d('0x11')](_0x134d('0x12'));})[_0x134d('0x13')](function(_0x4074cb){console[_0x134d('0x11')](_0x4074cb);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 133302f..7bd54a6 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc6d=['user:%s','voice:inbound','hasOwnProperty','include','push','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','userProfileId','ChatQueue','FaxQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','join','default','connection','request','remoteAddress','remotePort','connectedAt','log','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','role','name','agent','type','ivr','findOne','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','telephone','Campaign','then','format','length','query','User','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions'];(function(_0xb81593,_0x53ffad){var _0x57bfae=function(_0x2f67d5){while(--_0x2f67d5){_0xb81593['push'](_0xb81593['shift']());}};_0x57bfae(++_0x53ffad);}(_0xcc6d,0x1a9));var _0xdcc6=function(_0x3520ce,_0x4e0252){_0x3520ce=_0x3520ce-0x0;var _0x19e5e7=_0xcc6d[_0x3520ce];return _0x19e5e7;};'use strict';var _=require(_0xdcc6('0x0'));var util=require(_0xdcc6('0x1'));var BPromise=require(_0xdcc6('0x2'));var db=require(_0xdcc6('0x3'))['db'];var config=require(_0xdcc6('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xdcc6('0x5'),'model':db['User'],'attributes':['id','name',_0xdcc6('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdcc6('0x7')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xdcc6('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xdcc6('0x9')],'where':{'type':_0xdcc6('0xa')}};function getAssociatedResources(_0x195e2a,_0x911d24,_0x45fa41){return db['UserProfileSection'][_0xdcc6('0xb')]({'where':{'name':_0x195e2a,'userProfileId':_0x911d24},'raw':!![]})['then'](function(_0x5e1249){if(_0x5e1249){if(_0x5e1249['autoAssociation']){switch(_0x195e2a){case'VoiceQueues':case _0xdcc6('0xc'):case'FaxQueues':case'SmsQueues':case _0xdcc6('0xd'):case _0xdcc6('0xe'):case _0xdcc6('0xf'):return db[_0x45fa41][_0xdcc6('0x10')](queryQueues);case _0xdcc6('0x11'):return db[_0x45fa41][_0xdcc6('0x10')](queryTelephones);case _0xdcc6('0x12'):return db[_0x45fa41][_0xdcc6('0x10')](queryTrunks);case _0xdcc6('0x13'):return db[_0x45fa41][_0xdcc6('0x10')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0xdcc6('0x14')],'where':{'sectionId':_0x5e1249['id']},'raw':!![]})['then'](function(_0x1936e1){if(_0x1936e1){var _0x472308={'where':{'id':_[_0xdcc6('0x15')](_0x1936e1,_0xdcc6('0x14'))},'raw':!![]};switch(_0x45fa41){case'User':_0x472308[_0xdcc6('0x16')][_0xdcc6('0x6')]=_0xdcc6('0x17');break;case _0xdcc6('0x18'):_0x472308[_0xdcc6('0x16')]['type']=_0xdcc6('0xa');break;}return db[_0x45fa41][_0xdcc6('0x10')](_0x472308);}else{return[];}});}}else{return[];}})[_0xdcc6('0x19')](function(_0x3c801d){return _0x3c801d;});}function joinOrLeaveQueues(_0xb20c60,_0x52be46,_0x51ef83,_0x29995b){_0xb20c60[_0x52be46](util[_0xdcc6('0x1a')]('%s:queue:%s',_0x51ef83,_0x29995b['name']));if(_0x29995b['Agents']){for(var _0x27f067=0x0;_0x27f067<_0x29995b[_0xdcc6('0x5')][_0xdcc6('0x1b')];_0x27f067+=0x1){_0xb20c60[_0x52be46](util[_0xdcc6('0x1a')]('user:%s',_0x29995b[_0xdcc6('0x5')][_0x27f067][_0xdcc6('0x7')]));}}}function joinOrLeave(_0x384c77,_0x4115fd,_0x4d44e2){var _0x51a96d;if(_0x384c77['handshake'][_0xdcc6('0x1c')]['id']){db[_0xdcc6('0x1d')]['find']({'attributes':['id',_0xdcc6('0x7'),_0xdcc6('0x6'),'userProfileId'],'where':{'id':_0x384c77['handshake'][_0xdcc6('0x1c')]['id']},'include':[{'model':db[_0xdcc6('0x1e')],'as':_0xdcc6('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xdcc6('0x20')],'as':_0xdcc6('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xdcc6('0x22')],'as':_0xdcc6('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xdcc6('0x24')],'as':_0xdcc6('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdcc6('0x26')],'as':_0xdcc6('0x27'),'attributes':['id'],'raw':!![]}]})[_0xdcc6('0x19')](function(_0xfd50e1){if(_0xfd50e1){_0x51a96d=_0xfd50e1;_0x384c77[_0x4115fd](util[_0xdcc6('0x1a')](_0xdcc6('0x28'),_0xfd50e1[_0xdcc6('0x7')]));var _0x29019d=[];switch(_0xfd50e1[_0xdcc6('0x6')]){case'admin':_0x384c77[_0x4115fd](_0xdcc6('0x29'));_0x384c77[_0x4115fd]('voice:outbound');if(queryQueues[_0xdcc6('0x2a')]('include')){delete queryQueues[_0xdcc6('0x2b')];}_0x29019d[_0xdcc6('0x2c')](db['VoiceQueue'][_0xdcc6('0x10')](queryQueues));_0x29019d['push'](db['ChatQueue'][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db['FaxQueue'][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x2d')][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x2e')][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x2f')]['findAll'](queryQueues));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x30')][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db['User']['findAll'](queryTelephones));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x31')][_0xdcc6('0x10')](queryTrunks));_0x29019d['push'](db[_0xdcc6('0x18')][_0xdcc6('0x10')](queryCampaigns));_0x29019d[_0xdcc6('0x2c')](db['User'][_0xdcc6('0x10')](queryAgents));break;case _0xdcc6('0x32'):_0x384c77[_0x4115fd]('voice:inbound');_0x384c77[_0x4115fd](_0xdcc6('0x33'));_0x29019d['push'](getAssociatedResources('VoiceQueues',_0xfd50e1[_0xdcc6('0x34')],'VoiceQueue'));_0x29019d[_0xdcc6('0x2c')](getAssociatedResources('ChatQueues',_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x35')));_0x29019d[_0xdcc6('0x2c')](getAssociatedResources(_0xdcc6('0x36'),_0xfd50e1[_0xdcc6('0x34')],'FaxQueue'));_0x29019d[_0xdcc6('0x2c')](getAssociatedResources('SmsQueues',_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x2d')));_0x29019d['push'](getAssociatedResources(_0xdcc6('0xd'),_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x2e')));_0x29019d['push'](getAssociatedResources(_0xdcc6('0xe'),_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x2f')));_0x29019d[_0xdcc6('0x2c')](getAssociatedResources(_0xdcc6('0xf'),_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x30')));_0x29019d['push'](getAssociatedResources(_0xdcc6('0x11'),_0xfd50e1['userProfileId'],_0xdcc6('0x1d')));_0x29019d['push'](getAssociatedResources('Trunks',_0xfd50e1[_0xdcc6('0x34')],'Trunk'));_0x29019d['push'](getAssociatedResources('IvrCampaigns',_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x18')));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x1d')]['findAll'](queryAgents));break;case _0xdcc6('0x8'):_0x384c77[_0x4115fd](_0xdcc6('0x29'));_0x384c77[_0x4115fd](_0xdcc6('0x33'));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1['getVoiceQueues']({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1[_0xdcc6('0x37')]({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1[_0xdcc6('0x38')]({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1['getSmsQueues']({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1['getMailQueues']({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1[_0xdcc6('0x39')]({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1[_0xdcc6('0x3a')]({'attributes':['id',_0xdcc6('0x7')]}));break;}return BPromise[_0xdcc6('0x3b')](_0x29019d);}})[_0xdcc6('0x19')](function(_0x1cf772){if(_0x1cf772&&_0x1cf772[_0xdcc6('0x1b')]){for(var _0x5c990d=0x0;_0x5c990d<_0x1cf772[_0xdcc6('0x1b')];_0x5c990d+=0x1){for(var _0x24ee42=0x0;_0x24ee42<_0x1cf772[_0x5c990d][_0xdcc6('0x1b')];_0x24ee42+=0x1){switch(_0x5c990d){case 0x0:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x3c'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x1:joinOrLeaveQueues(_0x384c77,_0x4115fd,'chat',_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x2:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x3d'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x3:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x3e'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x4:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x3f'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x5:joinOrLeaveQueues(_0x384c77,_0x4115fd,'openchannel',_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x6:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x40'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x7:if(_0x51a96d[_0xdcc6('0x6')]!=='agent')_0x384c77[_0x4115fd](util['format'](_0xdcc6('0x41'),_0x1cf772[_0x5c990d][_0x24ee42][_0xdcc6('0x7')]));break;case 0x8:if(_0x51a96d[_0xdcc6('0x6')]!==_0xdcc6('0x8'))_0x384c77[_0x4115fd](util['format'](_0xdcc6('0x42'),_0x1cf772[_0x5c990d][_0x24ee42][_0xdcc6('0x7')]));break;case 0x9:if(_0x51a96d[_0xdcc6('0x6')]!==_0xdcc6('0x8'))_0x384c77[_0x4115fd](util[_0xdcc6('0x1a')](_0xdcc6('0x43'),_0x1cf772[_0x5c990d][_0x24ee42]['type'],_0x1cf772[_0x5c990d][_0x24ee42][_0xdcc6('0x7')]));break;case 0xa:_0x384c77[_0x4115fd](util['format'](_0xdcc6('0x28'),_0x1cf772[_0x5c990d][_0x24ee42][_0xdcc6('0x7')]));break;}}}}})[_0xdcc6('0x19')](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x384fc6=_['map'](_0x51a96d[_0xdcc6('0x1f')],'id');return _0x51a96d[_0xdcc6('0x45')](_0x384fc6)[_0xdcc6('0x19')](function(){for(var _0x3d2c48=0x0;_0x3d2c48<_0x384fc6[_0xdcc6('0x1b')];_0x3d2c48+=0x1){_0x4d44e2[_0xdcc6('0x46')](_0xdcc6('0x47'),{'ChatInteractionId':Number(_0x384fc6[_0x3d2c48]),'UserId':Number(_0x51a96d['id'])});}});}})['then'](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x23f2be=_[_0xdcc6('0x15')](_0x51a96d['MailInteractions'],'id');return _0x51a96d[_0xdcc6('0x48')](_0x23f2be)[_0xdcc6('0x19')](function(){for(var _0x53d162=0x0;_0x53d162<_0x23f2be[_0xdcc6('0x1b')];_0x53d162+=0x1){_0x4d44e2[_0xdcc6('0x46')](_0xdcc6('0x49'),{'MailInteractionId':Number(_0x23f2be[_0x53d162]),'UserId':Number(_0x51a96d['id'])});}});}})[_0xdcc6('0x19')](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x127bc0=_[_0xdcc6('0x15')](_0x51a96d[_0xdcc6('0x23')],'id');return _0x51a96d['removeFaxInteractions'](_0x127bc0)[_0xdcc6('0x19')](function(){for(var _0x2114b9=0x0;_0x2114b9<_0x127bc0[_0xdcc6('0x1b')];_0x2114b9+=0x1){_0x4d44e2[_0xdcc6('0x46')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x127bc0[_0x2114b9]),'UserId':Number(_0x51a96d['id'])});}});}})['then'](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x2c7db7=_[_0xdcc6('0x15')](_0x51a96d[_0xdcc6('0x25')],'id');return _0x51a96d[_0xdcc6('0x4a')](_0x2c7db7)[_0xdcc6('0x19')](function(){for(var _0x48a945=0x0;_0x48a945<_0x2c7db7[_0xdcc6('0x1b')];_0x48a945+=0x1){_0x4d44e2[_0xdcc6('0x46')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2c7db7[_0x48a945]),'UserId':Number(_0x51a96d['id'])});}});}})[_0xdcc6('0x19')](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x247fff=_['map'](_0x51a96d[_0xdcc6('0x4b')],'id');return _0x51a96d[_0xdcc6('0x4c')](_0x247fff)[_0xdcc6('0x19')](function(){for(var _0x106e14=0x0;_0x106e14<_0x247fff[_0xdcc6('0x1b')];_0x106e14+=0x1){_0x4d44e2[_0xdcc6('0x46')](_0xdcc6('0x4d'),{'OpenchannelInteractionId':Number(_0x247fff[_0x106e14]),'UserId':Number(_0x51a96d['id'])});}});}})['then'](function(){if(_0x4115fd==='leave'){var _0x2d4657=_[_0xdcc6('0x15')](_0x51a96d[_0xdcc6('0x27')],'id');return _0x51a96d['removeWhatsappInteractions'](_0x2d4657)[_0xdcc6('0x19')](function(){for(var _0x10a9e3=0x0;_0x10a9e3<_0x2d4657['length'];_0x10a9e3+=0x1){_0x4d44e2[_0xdcc6('0x46')](_0xdcc6('0x4e'),{'WhatsappInteractionId':Number(_0x2d4657[_0x10a9e3]),'UserId':Number(_0x51a96d['id'])});}});}})[_0xdcc6('0x4f')](function(_0x3a4e4e){_0x384c77['log'](_0x3a4e4e);});}}function onDisconnect(_0x41cf6e,_0x2b5f65){joinOrLeave(_0x41cf6e,_0xdcc6('0x44'),_0x2b5f65);}function onConnect(_0x4fb7a7){joinOrLeave(_0x4fb7a7,_0xdcc6('0x50'));}exports[_0xdcc6('0x51')]=function(_0x31f43c){_0x31f43c['on'](_0xdcc6('0x52'),function(_0x16fdc2){_0x16fdc2['setMaxListeners'](0x0);_0x16fdc2['address']=_0x16fdc2[_0xdcc6('0x53')][_0xdcc6('0x52')][_0xdcc6('0x54')]+':'+_0x16fdc2[_0xdcc6('0x53')]['connection'][_0xdcc6('0x55')];_0x16fdc2[_0xdcc6('0x56')]=new Date();_0x16fdc2[_0xdcc6('0x57')]=function(_0x28736f){console[_0xdcc6('0x57')]('SocketIO\x20'+_0x16fdc2[_0xdcc6('0x58')]['name']+'['+_0x16fdc2[_0xdcc6('0x59')]+']',_0x28736f);};_0x16fdc2['on'](_0xdcc6('0x5a'),function(){onDisconnect(_0x16fdc2,_0x31f43c);_0x16fdc2[_0xdcc6('0x57')](_0xdcc6('0x5b'));});onConnect(_0x16fdc2);_0x16fdc2['log'](_0xdcc6('0x5c'));});}; \ No newline at end of file +var _0x7da6=['SocketIO\x20','nsp','DISCONNECTED','CONNECTED','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','map','where','ivr','Agents','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','Campaign','user','ChatQueues','MailQueue','Telephones','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','log','default','connection','address','request','remoteAddress','remotePort','connectedAt'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7da6,0x124));var _0x67da=function(_0x3ecf95,_0x559a2c){_0x3ecf95=_0x3ecf95-0x0;var _0x3f1e72=_0x7da6[_0x3ecf95];return _0x3f1e72;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x67da('0x0'));var db=require(_0x67da('0x1'))['db'];var config=require(_0x67da('0x2'));var queryQueues={'attributes':['id',_0x67da('0x3')],'include':[{'as':'Agents','model':db[_0x67da('0x4')],'attributes':['id',_0x67da('0x3'),_0x67da('0x5')],'raw':!![],'where':{'role':_0x67da('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x67da('0x3')],'where':{'role':_0x67da('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x67da('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x67da('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x3c7119,_0x5f31ff,_0x1e8a4c){return db[_0x67da('0x9')][_0x67da('0xa')]({'where':{'name':_0x3c7119,'userProfileId':_0x5f31ff},'raw':!![]})[_0x67da('0xb')](function(_0x7adba5){if(_0x7adba5){if(_0x7adba5[_0x67da('0xc')]){switch(_0x3c7119){case _0x67da('0xd'):case'ChatQueues':case _0x67da('0xe'):case _0x67da('0xf'):case _0x67da('0x10'):case _0x67da('0x11'):case _0x67da('0x12'):return db[_0x1e8a4c][_0x67da('0x13')](queryQueues);case'Telephones':return db[_0x1e8a4c][_0x67da('0x13')](queryTelephones);case _0x67da('0x14'):return db[_0x1e8a4c][_0x67da('0x13')](queryTrunks);case _0x67da('0x15'):return db[_0x1e8a4c][_0x67da('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0x67da('0x13')]({'attributes':[_0x67da('0x16')],'where':{'sectionId':_0x7adba5['id']},'raw':!![]})['then'](function(_0x11e151){if(_0x11e151){var _0x3b7f96={'where':{'id':_[_0x67da('0x17')](_0x11e151,_0x67da('0x16'))},'raw':!![]};switch(_0x1e8a4c){case _0x67da('0x4'):_0x3b7f96[_0x67da('0x18')][_0x67da('0x5')]=_0x67da('0x7');break;case'Campaign':_0x3b7f96[_0x67da('0x18')]['type']=_0x67da('0x19');break;}return db[_0x1e8a4c]['findAll'](_0x3b7f96);}else{return[];}});}}else{return[];}})[_0x67da('0xb')](function(_0xa53a90){return _0xa53a90;});}function joinOrLeaveQueues(_0xf5aab7,_0x156abf,_0x4b91af,_0x2a43db){_0xf5aab7[_0x156abf](util['format']('%s:queue:%s',_0x4b91af,_0x2a43db[_0x67da('0x3')]));if(_0x2a43db[_0x67da('0x1a')]){for(var _0x249e9c=0x0;_0x249e9c<_0x2a43db[_0x67da('0x1a')]['length'];_0x249e9c+=0x1){_0xf5aab7[_0x156abf](util['format']('user:%s',_0x2a43db[_0x67da('0x1a')][_0x249e9c][_0x67da('0x3')]));}}}function joinOrLeave(_0x45fe05,_0xd32481,_0x2460c3){var _0x4e6cb1;if(_0x45fe05['handshake'][_0x67da('0x1b')]['id']){db[_0x67da('0x4')]['find']({'attributes':['id',_0x67da('0x3'),'role',_0x67da('0x1c')],'where':{'id':_0x45fe05[_0x67da('0x1d')][_0x67da('0x1b')]['id']},'include':[{'model':db[_0x67da('0x1e')],'as':_0x67da('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x67da('0x20')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x67da('0x21')],'as':_0x67da('0x22'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x67da('0x23')],'as':_0x67da('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x67da('0x25')],'as':_0x67da('0x26'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1cba18){if(_0x1cba18){_0x4e6cb1=_0x1cba18;_0x45fe05[_0xd32481](util[_0x67da('0x27')](_0x67da('0x28'),_0x1cba18[_0x67da('0x3')]));var _0x22fa93=[];switch(_0x1cba18[_0x67da('0x5')]){case _0x67da('0x29'):_0x45fe05[_0xd32481](_0x67da('0x2a'));_0x45fe05[_0xd32481](_0x67da('0x2b'));if(queryQueues[_0x67da('0x2c')](_0x67da('0x2d'))){delete queryQueues[_0x67da('0x2d')];}_0x22fa93[_0x67da('0x2e')](db[_0x67da('0x2f')]['findAll'](queryQueues));_0x22fa93[_0x67da('0x2e')](db[_0x67da('0x30')][_0x67da('0x13')](queryQueues));_0x22fa93[_0x67da('0x2e')](db[_0x67da('0x31')][_0x67da('0x13')](queryQueues));_0x22fa93['push'](db[_0x67da('0x32')][_0x67da('0x13')](queryQueues));_0x22fa93[_0x67da('0x2e')](db['MailQueue']['findAll'](queryQueues));_0x22fa93['push'](db['OpenchannelQueue'][_0x67da('0x13')](queryQueues));_0x22fa93['push'](db[_0x67da('0x33')][_0x67da('0x13')](queryQueues));_0x22fa93[_0x67da('0x2e')](db[_0x67da('0x4')][_0x67da('0x13')](queryTelephones));_0x22fa93[_0x67da('0x2e')](db[_0x67da('0x34')][_0x67da('0x13')](queryTrunks));_0x22fa93[_0x67da('0x2e')](db[_0x67da('0x35')][_0x67da('0x13')](queryCampaigns));_0x22fa93[_0x67da('0x2e')](db[_0x67da('0x4')][_0x67da('0x13')](queryAgents));break;case _0x67da('0x36'):_0x45fe05[_0xd32481](_0x67da('0x2a'));_0x45fe05[_0xd32481](_0x67da('0x2b'));_0x22fa93[_0x67da('0x2e')](getAssociatedResources(_0x67da('0xd'),_0x1cba18[_0x67da('0x1c')],_0x67da('0x2f')));_0x22fa93[_0x67da('0x2e')](getAssociatedResources(_0x67da('0x37'),_0x1cba18[_0x67da('0x1c')],_0x67da('0x30')));_0x22fa93[_0x67da('0x2e')](getAssociatedResources('FaxQueues',_0x1cba18[_0x67da('0x1c')],_0x67da('0x31')));_0x22fa93['push'](getAssociatedResources(_0x67da('0xf'),_0x1cba18[_0x67da('0x1c')],'SmsQueue'));_0x22fa93['push'](getAssociatedResources('MailQueues',_0x1cba18[_0x67da('0x1c')],_0x67da('0x38')));_0x22fa93[_0x67da('0x2e')](getAssociatedResources(_0x67da('0x11'),_0x1cba18[_0x67da('0x1c')],'OpenchannelQueue'));_0x22fa93[_0x67da('0x2e')](getAssociatedResources('WhatsappQueues',_0x1cba18[_0x67da('0x1c')],_0x67da('0x33')));_0x22fa93[_0x67da('0x2e')](getAssociatedResources(_0x67da('0x39'),_0x1cba18['userProfileId'],_0x67da('0x4')));_0x22fa93['push'](getAssociatedResources(_0x67da('0x14'),_0x1cba18[_0x67da('0x1c')],_0x67da('0x34')));_0x22fa93['push'](getAssociatedResources(_0x67da('0x15'),_0x1cba18[_0x67da('0x1c')],_0x67da('0x35')));_0x22fa93[_0x67da('0x2e')](db[_0x67da('0x4')][_0x67da('0x13')](queryAgents));break;case'agent':_0x45fe05[_0xd32481]('voice:inbound');_0x45fe05[_0xd32481](_0x67da('0x2b'));_0x22fa93[_0x67da('0x2e')](_0x1cba18['getVoiceQueues']({'attributes':['id',_0x67da('0x3')]}));_0x22fa93[_0x67da('0x2e')](_0x1cba18['getChatQueues']({'attributes':['id','name']}));_0x22fa93[_0x67da('0x2e')](_0x1cba18[_0x67da('0x3a')]({'attributes':['id',_0x67da('0x3')]}));_0x22fa93['push'](_0x1cba18[_0x67da('0x3b')]({'attributes':['id','name']}));_0x22fa93[_0x67da('0x2e')](_0x1cba18[_0x67da('0x3c')]({'attributes':['id',_0x67da('0x3')]}));_0x22fa93['push'](_0x1cba18[_0x67da('0x3d')]({'attributes':['id','name']}));_0x22fa93[_0x67da('0x2e')](_0x1cba18[_0x67da('0x3e')]({'attributes':['id',_0x67da('0x3')]}));break;}return BPromise[_0x67da('0x3f')](_0x22fa93);}})['then'](function(_0x43c5b5){if(_0x43c5b5&&_0x43c5b5['length']){for(var _0xc3587a=0x0;_0xc3587a<_0x43c5b5[_0x67da('0x40')];_0xc3587a+=0x1){for(var _0x18349e=0x0;_0x18349e<_0x43c5b5[_0xc3587a][_0x67da('0x40')];_0x18349e+=0x1){switch(_0xc3587a){case 0x0:joinOrLeaveQueues(_0x45fe05,_0xd32481,_0x67da('0x41'),_0x43c5b5[_0xc3587a][_0x18349e]);break;case 0x1:joinOrLeaveQueues(_0x45fe05,_0xd32481,_0x67da('0x42'),_0x43c5b5[_0xc3587a][_0x18349e]);break;case 0x2:joinOrLeaveQueues(_0x45fe05,_0xd32481,_0x67da('0x43'),_0x43c5b5[_0xc3587a][_0x18349e]);break;case 0x3:joinOrLeaveQueues(_0x45fe05,_0xd32481,_0x67da('0x44'),_0x43c5b5[_0xc3587a][_0x18349e]);break;case 0x4:joinOrLeaveQueues(_0x45fe05,_0xd32481,_0x67da('0x45'),_0x43c5b5[_0xc3587a][_0x18349e]);break;case 0x5:joinOrLeaveQueues(_0x45fe05,_0xd32481,'openchannel',_0x43c5b5[_0xc3587a][_0x18349e]);break;case 0x6:joinOrLeaveQueues(_0x45fe05,_0xd32481,_0x67da('0x46'),_0x43c5b5[_0xc3587a][_0x18349e]);break;case 0x7:if(_0x4e6cb1[_0x67da('0x5')]!==_0x67da('0x6'))_0x45fe05[_0xd32481](util[_0x67da('0x27')](_0x67da('0x47'),_0x43c5b5[_0xc3587a][_0x18349e]['name']));break;case 0x8:if(_0x4e6cb1[_0x67da('0x5')]!==_0x67da('0x6'))_0x45fe05[_0xd32481](util[_0x67da('0x27')](_0x67da('0x48'),_0x43c5b5[_0xc3587a][_0x18349e][_0x67da('0x3')]));break;case 0x9:if(_0x4e6cb1[_0x67da('0x5')]!==_0x67da('0x6'))_0x45fe05[_0xd32481](util[_0x67da('0x27')]('campaign:%s:%s',_0x43c5b5[_0xc3587a][_0x18349e][_0x67da('0x8')],_0x43c5b5[_0xc3587a][_0x18349e][_0x67da('0x3')]));break;case 0xa:_0x45fe05[_0xd32481](util[_0x67da('0x27')]('user:%s',_0x43c5b5[_0xc3587a][_0x18349e][_0x67da('0x3')]));break;}}}}})[_0x67da('0xb')](function(){if(_0xd32481===_0x67da('0x49')){var _0x4c0875=_[_0x67da('0x17')](_0x4e6cb1[_0x67da('0x1f')],'id');return _0x4e6cb1[_0x67da('0x4a')](_0x4c0875)[_0x67da('0xb')](function(){for(var _0x19ab4f=0x0;_0x19ab4f<_0x4c0875[_0x67da('0x40')];_0x19ab4f+=0x1){_0x2460c3[_0x67da('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4c0875[_0x19ab4f]),'UserId':Number(_0x4e6cb1['id'])});}});}})[_0x67da('0xb')](function(){if(_0xd32481===_0x67da('0x49')){var _0x4efb75=_[_0x67da('0x17')](_0x4e6cb1['MailInteractions'],'id');return _0x4e6cb1[_0x67da('0x4c')](_0x4efb75)[_0x67da('0xb')](function(){for(var _0x1f0939=0x0;_0x1f0939<_0x4efb75['length'];_0x1f0939+=0x1){_0x2460c3[_0x67da('0x4b')](_0x67da('0x4d'),{'MailInteractionId':Number(_0x4efb75[_0x1f0939]),'UserId':Number(_0x4e6cb1['id'])});}});}})['then'](function(){if(_0xd32481==='leave'){var _0x3375cc=_[_0x67da('0x17')](_0x4e6cb1[_0x67da('0x22')],'id');return _0x4e6cb1['removeFaxInteractions'](_0x3375cc)[_0x67da('0xb')](function(){for(var _0x5e5c92=0x0;_0x5e5c92<_0x3375cc['length'];_0x5e5c92+=0x1){_0x2460c3['emit'](_0x67da('0x4e'),{'FaxInteractionId':Number(_0x3375cc[_0x5e5c92]),'UserId':Number(_0x4e6cb1['id'])});}});}})['then'](function(){if(_0xd32481===_0x67da('0x49')){var _0x3753ab=_['map'](_0x4e6cb1[_0x67da('0x4f')],'id');return _0x4e6cb1[_0x67da('0x50')](_0x3753ab)[_0x67da('0xb')](function(){for(var _0x2c3271=0x0;_0x2c3271<_0x3753ab['length'];_0x2c3271+=0x1){_0x2460c3[_0x67da('0x4b')](_0x67da('0x51'),{'SmsInteractionId':Number(_0x3753ab[_0x2c3271]),'UserId':Number(_0x4e6cb1['id'])});}});}})['then'](function(){if(_0xd32481===_0x67da('0x49')){var _0x45f320=_[_0x67da('0x17')](_0x4e6cb1[_0x67da('0x24')],'id');return _0x4e6cb1[_0x67da('0x52')](_0x45f320)[_0x67da('0xb')](function(){for(var _0x4478b7=0x0;_0x4478b7<_0x45f320['length'];_0x4478b7+=0x1){_0x2460c3[_0x67da('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x45f320[_0x4478b7]),'UserId':Number(_0x4e6cb1['id'])});}});}})[_0x67da('0xb')](function(){if(_0xd32481===_0x67da('0x49')){var _0xb1c3fa=_['map'](_0x4e6cb1[_0x67da('0x26')],'id');return _0x4e6cb1[_0x67da('0x53')](_0xb1c3fa)[_0x67da('0xb')](function(){for(var _0x414364=0x0;_0x414364<_0xb1c3fa[_0x67da('0x40')];_0x414364+=0x1){_0x2460c3[_0x67da('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0xb1c3fa[_0x414364]),'UserId':Number(_0x4e6cb1['id'])});}});}})['catch'](function(_0x5b2f89){_0x45fe05[_0x67da('0x54')](_0x5b2f89);});}}function onDisconnect(_0x444f45,_0x254510){joinOrLeave(_0x444f45,_0x67da('0x49'),_0x254510);}function onConnect(_0x55db60){joinOrLeave(_0x55db60,'join');}exports[_0x67da('0x55')]=function(_0x473cf8){_0x473cf8['on'](_0x67da('0x56'),function(_0x194841){_0x194841['setMaxListeners'](0x0);_0x194841[_0x67da('0x57')]=_0x194841[_0x67da('0x58')]['connection'][_0x67da('0x59')]+':'+_0x194841[_0x67da('0x58')][_0x67da('0x56')][_0x67da('0x5a')];_0x194841[_0x67da('0x5b')]=new Date();_0x194841[_0x67da('0x54')]=function(_0x51eae5){console[_0x67da('0x54')](_0x67da('0x5c')+_0x194841[_0x67da('0x5d')]['name']+'['+_0x194841[_0x67da('0x57')]+']',_0x51eae5);};_0x194841['on']('disconnect',function(){onDisconnect(_0x194841,_0x473cf8);_0x194841[_0x67da('0x54')](_0x67da('0x5e'));});onConnect(_0x194841);_0x194841[_0x67da('0x54')](_0x67da('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 81cbacb..8bc0c00 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 _0x8e1d=['ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','SELECT','then','contact','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','catch','AfterCreateMessage','event','offlineMessage','opened','resolve','name','AfterCreate','closed','changed','substatus','sequelize','QueryTypes','AfterUpdate','User','find','fullname','email','internal','default','length','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','error','code','Trigger,\x20%s','get','channel','motionChannel','direction'];(function(_0x1cdbf6,_0x2edcc6){var _0xb5c0d9=function(_0x4d842a){while(--_0x4d842a){_0x1cdbf6['push'](_0x1cdbf6['shift']());}};_0xb5c0d9(++_0x2edcc6);}(_0x8e1d,0x76));var _0xd8e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8e1d[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xd8e1('0x0'));var db=require(_0xd8e1('0x1'))['db'];var jayson=require(_0xd8e1('0x2'));var logger=require(_0xd8e1('0x3'))(_0xd8e1('0x4'));var client=jayson[_0xd8e1('0x5')][_0xd8e1('0x6')]({'port':0x232a});var triggers=[{'channel':_0xd8e1('0x7'),'model':'ChatInteraction','event':_0xd8e1('0x8'),'condition':_0xd8e1('0x9'),'callback':afterCreate},{'channel':_0xd8e1('0x7'),'model':_0xd8e1('0xa'),'event':_0xd8e1('0xb'),'condition':_0xd8e1('0xc'),'callback':afterUpdate},{'channel':'Chat','model':_0xd8e1('0xd'),'event':_0xd8e1('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0xd8e1('0xe'),'event':_0xd8e1('0x8'),'condition':_0xd8e1('0xf'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xd8e1('0x10'),'event':_0xd8e1('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd8e1('0x11'),'model':_0xd8e1('0x10'),'event':_0xd8e1('0xb'),'condition':_0xd8e1('0xc'),'callback':afterUpdate},{'channel':'Sms','model':_0xd8e1('0x12'),'event':_0xd8e1('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd8e1('0x13'),'model':_0xd8e1('0x14'),'event':'afterCreate','condition':_0xd8e1('0x9'),'callback':afterCreate},{'channel':_0xd8e1('0x13'),'model':_0xd8e1('0x14'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd8e1('0x13'),'model':'WhatsappMessage','event':_0xd8e1('0x8'),'condition':_0xd8e1('0xf'),'callback':afterCreateMessage},{'channel':_0xd8e1('0x15'),'model':_0xd8e1('0x16'),'event':_0xd8e1('0x8'),'condition':_0xd8e1('0x9'),'callback':afterCreate},{'channel':_0xd8e1('0x15'),'model':_0xd8e1('0x16'),'event':_0xd8e1('0xb'),'condition':_0xd8e1('0xc'),'callback':afterUpdate},{'channel':_0xd8e1('0x15'),'model':_0xd8e1('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd8e1('0x18'),'model':_0xd8e1('0x19'),'event':_0xd8e1('0x8'),'condition':_0xd8e1('0x9'),'callback':afterCreate},{'channel':_0xd8e1('0x18'),'model':_0xd8e1('0x19'),'event':_0xd8e1('0xb'),'condition':_0xd8e1('0xc'),'callback':afterUpdate},{'channel':_0xd8e1('0x18'),'model':_0xd8e1('0x1a'),'event':_0xd8e1('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd8e1('0x1b'),'model':'OpenchannelInteraction','event':_0xd8e1('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd8e1('0x1b'),'model':_0xd8e1('0x1c'),'event':'afterUpdate','condition':_0xd8e1('0xc'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xd8e1('0x1d'),'event':_0xd8e1('0x8'),'condition':_0xd8e1('0xf'),'callback':afterCreateMessage}];function request(_0x593aea){return client['request'](_0xd8e1('0x1e'),_0x593aea)['then'](function(_0x205f85){logger['info']('Trigger,\x20%s','EventManager',_0x205f85);if(_0x205f85['error']){if(_0x205f85[_0xd8e1('0x1f')][_0xd8e1('0x20')]===0x1f4){logger['error'](_0xd8e1('0x21'),_0xd8e1('0x1e'),_0x205f85[_0xd8e1('0x1f')]);}}})['catch'](function(_0x564859){logger['error']('Trigger,\x20%s',_0xd8e1('0x1e'),_0x564859);});}function afterCreateMessage(_0x11cf46){return function(_0x1b4dfe){_0x1b4dfe=_0x1b4dfe[_0xd8e1('0x22')]({'plain':!![]});_0x1b4dfe[_0xd8e1('0x23')]=_0x11cf46;_0x1b4dfe[_0xd8e1('0x24')]=_0x11cf46;_0x1b4dfe['event']=_0x1b4dfe[_0xd8e1('0x25')];Promise['resolve']()['then'](function(){if(typeof _0x1b4dfe[_0xd8e1('0x26')]===_0xd8e1('0x27'))return null;var _0x347359=_0xd8e1('0x28')+_0x1b4dfe['ContactId'];return db['sequelize'][_0xd8e1('0x29')](_0x347359,{'type':db[_0xd8e1('0x2a')]['QueryTypes'][_0xd8e1('0x2b')],'raw':!![]});})[_0xd8e1('0x2c')](function(_0x43a78f){if(_0x43a78f){_0x1b4dfe[_0xd8e1('0x2d')]=_0x43a78f[0x0];}if(typeof _0x1b4dfe[_0xd8e1('0x2e')]==='undefined')return;return getAgent(_0x1b4dfe[_0xd8e1('0x2e')]);})[_0xd8e1('0x2c')](function(_0xd78792){if(_0xd78792){_0x1b4dfe[_0xd8e1('0x2f')]=util[_0xd8e1('0x30')](_0xd8e1('0x31'),_0xd78792['name']);_0x1b4dfe[_0xd8e1('0x32')]=_0xd78792;_0x1b4dfe[_0xd8e1('0x23')]=_0x11cf46;return request({'event':_0xd8e1('0x33'),'message':_0x1b4dfe});}else{return request({'event':_0xd8e1('0x34'),'message':_0x1b4dfe});}})[_0xd8e1('0x35')](function(_0x3284d7){logger['error'](_0xd8e1('0x21'),_0xd8e1('0x36'),_0x3284d7);});};}function afterCreateOfflineMessage(_0xcde568){return function(_0x19d0ca){_0x19d0ca=_0x19d0ca[_0xd8e1('0x22')]({'plain':!![]});_0x19d0ca[_0xd8e1('0x23')]=_0xcde568;_0x19d0ca[_0xd8e1('0x24')]=_0xcde568;_0x19d0ca[_0xd8e1('0x37')]=_0xd8e1('0x38');return request({'event':_0x19d0ca['event'],'message':_0x19d0ca});};}function afterCreate(_0x3f6372,_0x4f833f){return function(_0x1847a0){var _0x30d710=_0x1847a0[_0xd8e1('0x22')]({'plain':!![]});_0x30d710[_0xd8e1('0x23')]=_0x3f6372;_0x30d710[_0xd8e1('0x24')]=_0x3f6372;_0x30d710[_0xd8e1('0x37')]=_0xd8e1('0x39');Promise[_0xd8e1('0x3a')]()[_0xd8e1('0x2c')](function(){var _0x4d6725='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x30d710['ContactId'];return db['sequelize'][_0xd8e1('0x29')](_0x4d6725,{'type':db[_0xd8e1('0x2a')]['QueryTypes'][_0xd8e1('0x2b')],'raw':!![]});})[_0xd8e1('0x2c')](function(_0x1e6568){if(_0x1e6568){_0x30d710[_0xd8e1('0x2d')]=_0x1e6568[0x0];}if(_0x30d710[_0xd8e1('0x2e')]){return getAgent(_0x30d710['UserId']);}return;})['then'](function(_0x33e145){if(_0x33e145){_0x30d710[_0xd8e1('0x2f')]=util[_0xd8e1('0x30')](_0xd8e1('0x31'),_0x33e145[_0xd8e1('0x3b')]);_0x30d710[_0xd8e1('0x32')]=_0x33e145;}return request({'event':_0x4f833f,'message':_0x30d710});})[_0xd8e1('0x35')](function(_0x772ef9){logger[_0xd8e1('0x1f')](_0xd8e1('0x21'),_0xd8e1('0x3c'),_0x772ef9);});};}function afterUpdate(_0x1fc263){return function(_0x26535c){var _0x3db25b=_0x26535c['changed'](_0xd8e1('0x3d'))&&_0x26535c['closed'];var _0xe8418c=_0x26535c[_0xd8e1('0x3e')](_0xd8e1('0x3f'));if(_0x3db25b||_0xe8418c){var _0x33a72f=_0x3db25b?_0xd8e1('0xc'):_0xd8e1('0x3f');var _0x71c2f7=_0x26535c[_0xd8e1('0x22')]({'plain':!![]});_0x71c2f7['channel']=_0x1fc263;_0x71c2f7[_0xd8e1('0x24')]=_0x1fc263;_0x71c2f7['event']=_0x3db25b?'closed':'substatus';var _0x497c91=_0xd8e1('0x28')+_0x71c2f7['ContactId'];return db[_0xd8e1('0x40')][_0xd8e1('0x29')](_0x497c91,{'type':db['Sequelize'][_0xd8e1('0x41')]['SELECT'],'raw':!![]})[_0xd8e1('0x2c')](function(_0x34ba6b){if(_0x34ba6b){_0x71c2f7['contact']=_0x34ba6b[0x0];}if(typeof _0x71c2f7[_0xd8e1('0x2e')]==='undefined')return;return getAgent(_0x71c2f7['UserId']);})[_0xd8e1('0x2c')](function(_0x525dae){if(_0x525dae){_0x71c2f7['interface']=util['format'](_0xd8e1('0x31'),_0x525dae[_0xd8e1('0x3b')]);_0x71c2f7['agent']=_0x525dae;}return request({'event':_0x33a72f,'message':_0x71c2f7});})[_0xd8e1('0x35')](function(_0x5846ed){logger[_0xd8e1('0x1f')]('Trigger,\x20%s',_0xd8e1('0x42'),_0x5846ed);});}};}function getAgent(_0x411961){return db[_0xd8e1('0x43')][_0xd8e1('0x44')]({'where':{'id':_0x411961},'attributes':['id',_0xd8e1('0x3b'),_0xd8e1('0x45'),_0xd8e1('0x46'),_0xd8e1('0x47')],'raw':!![]})[_0xd8e1('0x2c')](function(_0x3f8f91){return _0x3f8f91;});}exports[_0xd8e1('0x48')]=function(){for(var _0x470f69=0x0;_0x470f69=_0x26fabe[_0xc5e0('0x11')]){throw Error(_0xc5e0('0x12'));}_0x3e9b0d(_0x3421bf);})[_0xc5e0('0x13')](function(_0x2c049e){_0x39e95c(_0x2c049e);});});}; \ No newline at end of file +var _0x3e21=['count','then','agents','catch','bluebird','../mysqldb','./license/util','voice','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','blockedAt','updateAttributes','getLicense','role','agent','User'];(function(_0x24465c,_0x426147){var _0x2bcf6f=function(_0x56bdb8){while(--_0x56bdb8){_0x24465c['push'](_0x24465c['shift']());}};_0x2bcf6f(++_0x426147);}(_0x3e21,0x1d2));var _0x13e2=function(_0x173377,_0x3a940e){_0x173377=_0x173377-0x0;var _0xf46120=_0x3e21[_0x173377];return _0xf46120;};'use strict';var _=require('lodash');var BPromise=require(_0x13e2('0x0'));var db=require(_0x13e2('0x1'))['db'];var util=require(_0x13e2('0x2'));var channels=[_0x13e2('0x3'),'mail',_0x13e2('0x4'),'fax',_0x13e2('0x5'),_0x13e2('0x6'),_0x13e2('0x7')];exports[_0x13e2('0x8')]=function(){return channels;};exports[_0x13e2('0x9')]=function(_0x19ef20){_0x19ef20=_0x19ef20[_0x13e2('0xa')]();return _['includes'](channels,_0x19ef20);};exports['clearBlockUser']=function(_0x3517e9,_0x110ea9,_0x5b2d84,_0x25b59f){var _0x301563={'loginAttempts':_0x110ea9,'blocked':_0x5b2d84};if(!_['isUndefined'](_0x25b59f)){_0x301563[_0x13e2('0xb')]=_0x25b59f;}return _0x3517e9[_0x13e2('0xc')](_0x301563);};exports[_0x13e2('0xd')]=function(_0x5bfd11){return new BPromise(function(_0x53f470,_0x4cb452){var _0x4e581c=0x0;if(_0x5bfd11[_0x13e2('0xe')]!==_0x13e2('0xf')){_0x53f470(_0x5bfd11);}db[_0x13e2('0x10')][_0x13e2('0x11')]({'where':{'role':_0x13e2('0xf'),'online':!![],'id':{'$ne':_0x5bfd11['id']}}})[_0x13e2('0x12')](function(_0x50179e){_0x4e581c=_0x50179e;return util['getLicense']();})[_0x13e2('0x12')](function(_0x5003f0){if(_0x5003f0&&_0x5003f0[_0x13e2('0x13')]&&_0x4e581c>=_0x5003f0['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x53f470(_0x5bfd11);})[_0x13e2('0x14')](function(_0x3959f7){_0x4cb452(_0x3959f7);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 0b3ef2b..d5bafef 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac00=['statusMessage','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','inherits','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','Bad\x20Request','Forbidden','error','stack'];(function(_0x5be0e7,_0x50b5f3){var _0x5f4cce=function(_0x163e64){while(--_0x163e64){_0x5be0e7['push'](_0x5be0e7['shift']());}};_0x5f4cce(++_0x50b5f3);}(_0xac00,0x10c));var _0x0ac0=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0xac00[_0x5e9689];return _0x2fac94;};'use strict';var util=require(_0x0ac0('0x0'));var logger=require(_0x0ac0('0x1'))(_0x0ac0('0x2'));var APIError=function(_0x55fad7,_0x2ba2f3){this[_0x0ac0('0x3')]=_0x55fad7||_0x0ac0('0x4');this[_0x0ac0('0x5')]=_0x2ba2f3||'Error';util[_0x0ac0('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3caaf6){this[_0x0ac0('0x3')]=_0x3caaf6||'Bad\x20Request';this[_0x0ac0('0x5')]='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x5ca7d3){this[_0x0ac0('0x3')]=_0x5ca7d3||'Forbidden';this[_0x0ac0('0x5')]='Forbidden';util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x34c475){this['message']=_0x34c475||_0x0ac0('0x7');this['name']=_0x0ac0('0x8');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2131f6){this[_0x0ac0('0x3')]=_0x2131f6||_0x0ac0('0x9');this[_0x0ac0('0x5')]=_0x0ac0('0xa');this[_0x0ac0('0xb')]=0x193;this[_0x0ac0('0xc')]={'type':_0x0ac0('0xd')};util[_0x0ac0('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x5bb6ad){this[_0x0ac0('0x3')]=_0x5bb6ad||_0x0ac0('0xe');this[_0x0ac0('0x5')]=_0x0ac0('0xf');util[_0x0ac0('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x147e17){switch(_0x147e17){case _0x0ac0('0x10'):return 0x190;case _0x0ac0('0x11'),_0x0ac0('0xa'):return 0x193;case _0x0ac0('0x8'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x2638c6){if(_0x2638c6==='Out\x20Of\x20Interval')return _0x2638c6;return null;}function handleError(_0x2691a3){return function(_0x5cc921){logger[_0x0ac0('0x12')](_0x5cc921[_0x0ac0('0x13')]);var _0x419f0e=getStatusCode(_0x5cc921[_0x0ac0('0x5')]);var _0x2a61a3=getCustomStatusMessage(_0x5cc921[_0x0ac0('0x5')]);if(_0x5cc921[_0x0ac0('0x5')]){delete _0x5cc921[_0x0ac0('0x5')];}if(_0x2a61a3){_0x2691a3[_0x0ac0('0x14')]=_0x2a61a3;}return _0x2691a3[_0x0ac0('0x15')](_0x419f0e)[_0x0ac0('0x16')](_0x5cc921);};}module[_0x0ac0('0x17')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x7f48=['Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','details','Conflict','error','stack','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name'];(function(_0x2af1e3,_0x3516cc){var _0x44143c=function(_0x54581c){while(--_0x54581c){_0x2af1e3['push'](_0x2af1e3['shift']());}};_0x44143c(++_0x3516cc);}(_0x7f48,0x72));var _0x87f4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x7f48[_0x580576];return _0x3f55a0;};'use strict';var util=require(_0x87f4('0x0'));var logger=require(_0x87f4('0x1'))(_0x87f4('0x2'));var APIError=function(_0x265c74,_0x1418ce){this[_0x87f4('0x3')]=_0x265c74||_0x87f4('0x4');this[_0x87f4('0x5')]=_0x1418ce||_0x87f4('0x6');util[_0x87f4('0x7')](APIError,Error);};var APIBadRequestError=function(_0x27b6f7){this[_0x87f4('0x3')]=_0x27b6f7||_0x87f4('0x8');this['name']='Bad\x20Request';util[_0x87f4('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x36c901){this[_0x87f4('0x3')]=_0x36c901||_0x87f4('0x9');this[_0x87f4('0x5')]=_0x87f4('0x9');util[_0x87f4('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x1e717e){this[_0x87f4('0x3')]=_0x1e717e||_0x87f4('0xa');this[_0x87f4('0x5')]=_0x87f4('0xb');util[_0x87f4('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f0274){this[_0x87f4('0x3')]=_0x4f0274||_0x87f4('0xc');this[_0x87f4('0x5')]=_0x87f4('0xd');this['code']=0x193;this[_0x87f4('0xe')]={'type':'OutOfInterval'};util[_0x87f4('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x25221b){this['message']=_0x25221b||'Resource\x20Conflict';this['name']=_0x87f4('0xf');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0xfe6113){switch(_0xfe6113){case'Bad\x20Request':return 0x190;case'Forbidden',_0x87f4('0xd'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x43cba9){if(_0x43cba9===_0x87f4('0xd'))return _0x43cba9;return null;}function handleError(_0x29ac69){return function(_0x5cbac7){logger[_0x87f4('0x10')](_0x5cbac7[_0x87f4('0x11')]);var _0x2019e6=getStatusCode(_0x5cbac7[_0x87f4('0x5')]);var _0xb5097a=getCustomStatusMessage(_0x5cbac7[_0x87f4('0x5')]);if(_0x5cbac7[_0x87f4('0x5')]){delete _0x5cbac7['name'];}if(_0xb5097a){_0x29ac69['statusMessage']=_0xb5097a;}return _0x29ac69['status'](_0x2019e6)[_0x87f4('0x12')](_0x5cbac7);};}module[_0x87f4('0x13')]={'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 4187d93..709aa48 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d30=['json','send','exports','status'];(function(_0x41875e,_0x347ba6){var _0x4c0a5c=function(_0x58beb7){while(--_0x58beb7){_0x41875e['push'](_0x41875e['shift']());}};_0x4c0a5c(++_0x347ba6);}(_0x4d30,0x1da));var _0x04d3=function(_0x1d4561,_0x566c1e){_0x1d4561=_0x1d4561-0x0;var _0x22e89f=_0x4d30[_0x1d4561];return _0x22e89f;};'use strict';module[_0x04d3('0x0')][0x194]=function pageNotFound(_0x2b2fdf,_0x358ef5){var _0x2dbb93='404';var _0x386e88=0x194;var _0x2f77a0={'status':_0x386e88};_0x358ef5[_0x04d3('0x1')](_0x2f77a0[_0x04d3('0x1')]);_0x358ef5['render'](_0x2dbb93,{},function(_0x44b2f5,_0x2e3fd8){if(_0x44b2f5){return _0x358ef5['status'](_0x2f77a0[_0x04d3('0x1')])[_0x04d3('0x2')](_0x2f77a0);}_0x358ef5[_0x04d3('0x3')](_0x2e3fd8);});}; \ No newline at end of file +var _0x28e1=['404','status','render','exports'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x28e1,0xcf));var _0x128e=function(_0x4bbf6d,_0x7390ed){_0x4bbf6d=_0x4bbf6d-0x0;var _0x474174=_0x28e1[_0x4bbf6d];return _0x474174;};'use strict';module[_0x128e('0x0')][0x194]=function pageNotFound(_0x29c580,_0x47100e){var _0x5f2285=_0x128e('0x1');var _0xb6118d=0x194;var _0x457333={'status':_0xb6118d};_0x47100e[_0x128e('0x2')](_0x457333['status']);_0x47100e[_0x128e('0x3')](_0x5f2285,{},function(_0x4f546b,_0x116ae5){if(_0x4f546b){return _0x47100e[_0x128e('0x2')](_0x457333['status'])['json'](_0x457333);}_0x47100e['send'](_0x116ae5);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 84cf899..a854e9b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf117=['../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','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','UserSetting','userSetting','hasMany','VoiceRecording','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','Interactions','List','ListId','team_has_mail_queues','Teams','Messages','MailInteractionId','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachment','Interaction','ChatWebsiteId','MailApplication','TagId','MailQueueReport','Items','Dispositions','Tags','FaxInteractionId','Account','team_has_fax_queues','FaxQueueReport','SmsAccountId','Applications','IntervalId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ProactiveActions','mandatoryDispositionPauseId','user_has_chat_websites','OpenchannelQueueReport','Agent','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','Phones','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Queue','OwnerId','CampaignId','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','fax_interaction_has_tags','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmContactId','AllConditions','AllCondition','AnyConditions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','SugarcrmAccount','Subjects','Description','DeskAccount','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','FreshsalesField','SessionId','JscriptyAnswerReport','ProjectId','team_has_sms_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToQueue','ToMailAccountId','FromAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../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','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','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../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','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x1aa9ac,_0x4c4c7d){var _0x705dfb=function(_0x187d9e){while(--_0x187d9e){_0x1aa9ac['push'](_0x1aa9ac['shift']());}};_0x705dfb(++_0x4c4c7d);}(_0xf117,0x122));var _0x7f11=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xf117[_0x26462c];return _0x509a42;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x7f11('0x0'));var _=require(_0x7f11('0x1'));var jstz=require(_0x7f11('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0x7f11('0x3')](config[_0x7f11('0x0')],{'database':_0x7f11('0x4'),'username':_0x7f11('0x5'),'password':_0x7f11('0x6'),'options':{'host':_0x7f11('0x7'),'port':0xcea,'dialect':_0x7f11('0x8'),'dialectOptions':{'charset':_0x7f11('0x9')},'logging':![],'timezone':timezone[_0x7f11('0xa')](),'define':{'charset':_0x7f11('0xb'),'collate':_0x7f11('0xc')}}});config[_0x7f11('0xd')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x7f11('0x4'),'username':_0x7f11('0x5'),'password':_0x7f11('0x6'),'options':{'host':_0x7f11('0x7'),'port':0xcea,'dialect':_0x7f11('0x8'),'dialectOptions':{'charset':_0x7f11('0x9')},'logging':![],'timezone':timezone[_0x7f11('0xa')](),'define':{'charset':_0x7f11('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7f11('0x0')][_0x7f11('0xe')],config[_0x7f11('0x0')][_0x7f11('0xf')],config[_0x7f11('0x0')][_0x7f11('0x10')],config[_0x7f11('0x0')][_0x7f11('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x7f11('0xd')][_0x7f11('0xf')],config['sequelizeHistory']['password'],config[_0x7f11('0xd')][_0x7f11('0x11')])};db[_0x7f11('0x12')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x14'));db[_0x7f11('0x15')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x16'));db[_0x7f11('0x17')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x18'));db[_0x7f11('0x19')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db[_0x7f11('0x1a')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x1b'));db[_0x7f11('0x1c')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x1d'));db['VoiceRecording']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x1e'));db[_0x7f11('0x1f')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x20'));db[_0x7f11('0x21')]=db['sequelize']['import'](_0x7f11('0x22'));db[_0x7f11('0x23')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x24'));db[_0x7f11('0x25')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x26'));db['VoiceDialReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x27'));db[_0x7f11('0x28')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x29'));db[_0x7f11('0x2a')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x2b'));db['MemberReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x2c'));db[_0x7f11('0x2d')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x2e'));db['VoiceTransferReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x2f'));db[_0x7f11('0x30')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x31'));db[_0x7f11('0x32')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x33'));db['UserChatQueue']=db[_0x7f11('0x0')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x7f11('0x34')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x35'));db[_0x7f11('0x36')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x37'));db[_0x7f11('0x38')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x39'));db['UserOpenchannelQueue']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x3a'));db[_0x7f11('0x3b')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x3c'));db[_0x7f11('0x3d')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x3e'));db[_0x7f11('0x3f')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x40'));db[_0x7f11('0x41')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x42'));db['MailQueue']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x43'));db[_0x7f11('0x44')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x45'));db['MailInteraction']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x46'));db[_0x7f11('0x47')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x48'));db['MailApplication']=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x49'));db[_0x7f11('0x4a')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x4b'));db[_0x7f11('0x4c')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x7f11('0x4d')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x4e'));db[_0x7f11('0x4f')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x50'));db[_0x7f11('0x51')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x7f11('0x52')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x53'));db['FaxQueue']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x54'));db['FaxQueueReport']=db['sequelize'][_0x7f11('0x13')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x55'));db[_0x7f11('0x56')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x57'));db[_0x7f11('0x58')]=db['sequelize']['import'](_0x7f11('0x59'));db[_0x7f11('0x5a')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x5b'));db[_0x7f11('0x5c')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x5d'));db[_0x7f11('0x5e')]=db[_0x7f11('0x0')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x7f11('0x5f')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x60'));db[_0x7f11('0x61')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x62'));db['OpenchannelQueue']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x63'));db[_0x7f11('0x64')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x65'));db['OpenchannelQueueReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x66'));db[_0x7f11('0x67')]=db['sequelize']['import'](_0x7f11('0x68'));db[_0x7f11('0x69')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x6a'));db[_0x7f11('0x6b')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x6c'));db[_0x7f11('0x6d')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x6e'));db[_0x7f11('0x6f')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x70'));db[_0x7f11('0x71')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x72'));db[_0x7f11('0x73')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x74'));db[_0x7f11('0x75')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/cmCompany/cmCompany.model');db[_0x7f11('0x76')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x77'));db[_0x7f11('0x78')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x79'));db[_0x7f11('0x7a')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x7b'));db['CmHopperFinal']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x7c'));db[_0x7f11('0x7d')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x7f11('0x7e')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x7f'));db['CmCustomField']=db['sequelize']['import'](_0x7f11('0x80'));db[_0x7f11('0x81')]=db['sequelize'][_0x7f11('0x13')]('../api/action/action.model');db[_0x7f11('0x82')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x83'));db[_0x7f11('0x84')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x85'));db[_0x7f11('0x86')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x87'));db['Condition']=db['sequelize'][_0x7f11('0x13')]('../api/condition/condition.model');db[_0x7f11('0x88')]=db['sequelize']['import']('../api/interval/interval.model');db[_0x7f11('0x89')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/pause/pause.model');db[_0x7f11('0x8a')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x8b'));db[_0x7f11('0x8c')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x8d'));db['Schedule']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x8e'));db['Sound']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x8f'));db[_0x7f11('0x90')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x91'));db[_0x7f11('0x92')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x93'));db[_0x7f11('0x94')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x95'));db['CmHopperAdditionalPhone']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x96'));db[_0x7f11('0x97')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x98'));db[_0x7f11('0x99')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x9a'));db[_0x7f11('0x9b')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x9c'));db['Integration']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x9d'));db[_0x7f11('0x9e')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/integrationReport/integrationReport.model');db[_0x7f11('0x9f')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xa0'));db[_0x7f11('0xa1')]=db['sequelize'][_0x7f11('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xa2'));db['AnalyticMetric']=db['sequelize']['import'](_0x7f11('0xa3'));db[_0x7f11('0xa4')]=db[_0x7f11('0x0')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db['sequelize'][_0x7f11('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x7f11('0xa5')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x7f11('0xa6')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xa7'));db[_0x7f11('0xa8')]=db[_0x7f11('0x0')]['import']('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x7f11('0x0')]['import'](_0x7f11('0xa9'));db[_0x7f11('0xaa')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xab'));db[_0x7f11('0xac')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xad'));db['DeskAccount']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xae'));db[_0x7f11('0xaf')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xb0'));db[_0x7f11('0xb1')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xb2'));db[_0x7f11('0xb3')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xb4'));db[_0x7f11('0xb5')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x7f11('0x0')]['import'](_0x7f11('0xb6'));db[_0x7f11('0xb7')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xb8'));db[_0x7f11('0xb9')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xba'));db['ZendeskField']=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xbb'));db[_0x7f11('0xbc')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xbd'));db[_0x7f11('0xbe')]=db[_0x7f11('0x0')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x7f11('0x0')]['import'](_0x7f11('0xbf'));db[_0x7f11('0xc0')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xc1'));db['VtigerField']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xc2'));db[_0x7f11('0xc3')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xc4'));db[_0x7f11('0xc5')]=db[_0x7f11('0x0')]['import'](_0x7f11('0xc6'));db[_0x7f11('0xc7')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xc8'));db[_0x7f11('0xc9')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xca'));db[_0x7f11('0xcb')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xcc'));db[_0x7f11('0xcd')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xce'));db[_0x7f11('0xcf')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xd0'));db[_0x7f11('0xd1')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xd2'));db['FreshsalesField']=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x7f11('0xd3')]=db['sequelize'][_0x7f11('0x13')]('../api/integration/integration.model');db['Network']=db[_0x7f11('0x0')]['import'](_0x7f11('0xd4'));db[_0x7f11('0xd5')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xd6'));db['ChatInternalMessage']=db['sequelize'][_0x7f11('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xd7'));db[_0x7f11('0xd8')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xd9'));db[_0x7f11('0xda')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xdb'));db[_0x7f11('0xdc')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xdd'));db['SquareReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xde'));db[_0x7f11('0xdf')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xe0'));db[_0x7f11('0xe1')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xe2'));db[_0x7f11('0xe3')]=db[_0x7f11('0x0')]['import'](_0x7f11('0xe4'));db[_0x7f11('0xe5')]=db[_0x7f11('0x0')]['import'](_0x7f11('0xe6'));db[_0x7f11('0xe7')]=db['sequelize']['import'](_0x7f11('0xe8'));db[_0x7f11('0xe9')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xea'));db[_0x7f11('0xeb')]=db[_0x7f11('0x0')]['import'](_0x7f11('0xec'));db[_0x7f11('0xed')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xee'));db[_0x7f11('0xef')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xf0'));db[_0x7f11('0xf1')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xf2'));db[_0x7f11('0xf3')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xf4'));db['Attachment']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xf5'));db[_0x7f11('0xf6')]=db['sequelize']['import'](_0x7f11('0xf7'));db[_0x7f11('0xf8')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x7f11('0xf9')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db['sequelize'][_0x7f11('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x7f11('0xfa')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xfb'));db[_0x7f11('0xfc')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xfd'));db['CmList']=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/cmList/cmList.model');db[_0x7f11('0xfe')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x7f11('0xff')]=db['sequelize'][_0x7f11('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x100'));db[_0x7f11('0x101')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x102'));db[_0x7f11('0x103')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x104'));db[_0x7f11('0x105')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x106'));db[_0x7f11('0x107')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x108'));db[_0x7f11('0x109')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x10a'));db[_0x7f11('0x10b')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x10c'));db[_0x7f11('0x10d')]=db['sequelize']['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x10e'));db[_0x7f11('0x10f')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x110'));db[_0x7f11('0x111')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0x7f11('0x112')]=db['sequelize'][_0x7f11('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x7f11('0x113')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x114'));db[_0x7f11('0x115')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/user-setting/user-setting.model');db[_0x7f11('0x116')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x117'));db[_0x7f11('0x12')][_0x7f11('0x118')](db['VoiceMail'],{'as':_0x7f11('0x21'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')]['hasOne'](db[_0x7f11('0x11b')],{'as':_0x7f11('0x11c'),'onDelete':'cascade','foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x11e')],{'as':'Recordings','foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x30')],{'as':_0x7f11('0x11f'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x19')],{'as':_0x7f11('0x120'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db['User'][_0x7f11('0x11d')](db[_0x7f11('0x121')],{'as':_0x7f11('0x122'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x7d')],{'as':_0x7f11('0x123'),'foreignKey':_0x7f11('0x11a')});db['User'][_0x7f11('0x11d')](db[_0x7f11('0x7e')],{'as':_0x7f11('0x7e'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x124')],{'as':'OpenchannelInteractions','foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')]['hasMany'](db[_0x7f11('0x69')],{'as':_0x7f11('0x125'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x58')],{'as':_0x7f11('0x126'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x51')],{'as':_0x7f11('0x127'),'foreignKey':'UserId'});db[_0x7f11('0x12')]['hasMany'](db[_0x7f11('0x128')],{'as':_0x7f11('0x129'),'foreignKey':'UserId'});db[_0x7f11('0x12')][_0x7f11('0x11d')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x7f11('0x12')]['hasMany'](db[_0x7f11('0x103')],{'as':_0x7f11('0x12a'),'foreignKey':_0x7f11('0x12b')});db['User'][_0x7f11('0x11d')](db[_0x7f11('0x78')],{'as':_0x7f11('0x12c'),'foreignKey':_0x7f11('0x11a'),'onDelete':_0x7f11('0x12d')});db[_0x7f11('0x12')][_0x7f11('0x12e')](db[_0x7f11('0xff')],{'as':_0x7f11('0xff'),'foreignKey':_0x7f11('0x12f')});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x71')],{'as':_0x7f11('0x131'),'through':_0x7f11('0x132')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x76')],{'as':_0x7f11('0x133'),'through':'cm_user_has_contacts'});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':_0x7f11('0x135'),'through':_0x7f11('0x136')});db[_0x7f11('0x12')][_0x7f11('0x130')](db['Team'],{'through':_0x7f11('0x137')});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x128')],{'as':_0x7f11('0x129'),'through':_0x7f11('0x138')});db[_0x7f11('0x12')]['belongsToMany'](db[_0x7f11('0x69')],{'as':_0x7f11('0x125'),'through':'user_has_chat_interactions'});db[_0x7f11('0x12')]['belongsToMany'](db[_0x7f11('0x51')],{'as':'FaxInteractions','through':_0x7f11('0x139')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x58')],{'as':_0x7f11('0x126'),'through':_0x7f11('0x13a')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x124')],{'as':_0x7f11('0x13b'),'through':_0x7f11('0x13c')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x109')],{'as':_0x7f11('0x13d'),'through':'user_has_whatsapp_interactions'});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x1c')],{'as':_0x7f11('0x13e'),'through':'UserVoiceQueue','required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0xfe')],{'as':_0x7f11('0x13f'),'through':_0x7f11('0x115'),'required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x140')],{'as':_0x7f11('0x141'),'through':'UserMailQueue','required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x6f')],{'as':_0x7f11('0x142'),'through':_0x7f11('0x143'),'required':![],'hooks':!![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x144')],{'as':_0x7f11('0x145'),'through':_0x7f11('0x36'),'required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db['SmsQueue'],{'as':_0x7f11('0x146'),'through':_0x7f11('0x38'),'required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x147')],{'as':_0x7f11('0x148'),'through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db[_0x7f11('0x10f')],{'as':_0x7f11('0x149'),'through':_0x7f11('0x3b'),'required':![]});db['User'][_0x7f11('0x130')](db[_0x7f11('0x134')],{'through':'cm_user_has_lists'});db[_0x7f11('0x12')]['belongsToMany'](db['ChatWebsite'],{'as':_0x7f11('0x14a'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0x7f11('0x4d')],{'as':_0x7f11('0x14b'),'through':_0x7f11('0x14c')});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x41')],{'as':'MailAccounts','through':_0x7f11('0x14d')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x5e')],{'as':_0x7f11('0x14e'),'through':_0x7f11('0x14f')});db[_0x7f11('0x12')]['belongsToMany'](db[_0x7f11('0x150')],{'as':'SmsAccounts','through':_0x7f11('0x151')});db[_0x7f11('0x12')][_0x7f11('0x130')](db['WhatsappAccount'],{'as':_0x7f11('0x152'),'through':'user_has_whatsapp_accounts'});db[_0x7f11('0x15')]['hasMany'](db['VoiceExtension'],{'as':_0x7f11('0x153'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x154')});db[_0x7f11('0x17')][_0x7f11('0x11d')](db['VoiceExtension'],{'onDelete':_0x7f11('0x119')});db[_0x7f11('0x19')][_0x7f11('0x11d')](db[_0x7f11('0x19')],{'as':'Applications','onDelete':_0x7f11('0x119')});db['VoiceMusicOnHold'][_0x7f11('0x130')](db[_0x7f11('0x155')],{'as':_0x7f11('0x156'),'through':_0x7f11('0x157')});db[_0x7f11('0x1c')][_0x7f11('0x11d')](db[_0x7f11('0x30')],{'as':_0x7f11('0x158'),'foreignKey':_0x7f11('0x159')});db[_0x7f11('0x1c')][_0x7f11('0x11d')](db['CmHopper'],{'as':_0x7f11('0x12c'),'foreignKey':_0x7f11('0x159')});db['VoiceQueue']['hasMany'](db[_0x7f11('0x121')],{'as':_0x7f11('0x122'),'foreignKey':_0x7f11('0x159')});db[_0x7f11('0x1c')][_0x7f11('0x11d')](db[_0x7f11('0x7d')],{'as':'HopperHistories','foreignKey':_0x7f11('0x159')});db['VoiceQueue'][_0x7f11('0x11d')](db[_0x7f11('0x7e')],{'as':_0x7f11('0x7e'),'foreignKey':_0x7f11('0x159')});db[_0x7f11('0x1c')][_0x7f11('0x11d')](db[_0x7f11('0x7a')],{'as':_0x7f11('0x15a'),'foreignKey':_0x7f11('0x159')});db['VoiceQueue'][_0x7f11('0x11d')](db[_0x7f11('0xda')],{'as':_0x7f11('0x15b'),'foreignKey':_0x7f11('0x159')});db[_0x7f11('0x1c')]['belongsTo'](db[_0x7f11('0x2d')],{'as':_0x7f11('0x2d'),'foreignKey':_0x7f11('0x15c')});db[_0x7f11('0x1c')][_0x7f11('0x12e')](db[_0x7f11('0x2d')],{'as':_0x7f11('0x15d'),'foreignKey':_0x7f11('0x15e')});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':_0x7f11('0x88'),'foreignKey':'IntervalId'});db[_0x7f11('0x1c')]['belongsTo'](db[_0x7f11('0x89')],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x1c')][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':'Lists','through':_0x7f11('0x160')});db[_0x7f11('0x1c')][_0x7f11('0x130')](db['User'],{'as':_0x7f11('0x161'),'through':_0x7f11('0x32')});db[_0x7f11('0x1c')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'as':'Teams','through':_0x7f11('0x112')});db[_0x7f11('0x1c')][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':_0x7f11('0x162'),'through':_0x7f11('0x163')});db[_0x7f11('0x11e')][_0x7f11('0x12e')](db['User'],{'as':_0x7f11('0x12'),'foreignKey':_0x7f11('0x11a')});db['ScreenRecording'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':'User','foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x21')][_0x7f11('0x11d')](db[_0x7f11('0x23')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x7f11('0x164'),'sourceKey':_0x7f11('0x165')});db[_0x7f11('0x23')][_0x7f11('0x12e')](db[_0x7f11('0x21')],{'foreignKey':_0x7f11('0x164'),'targetKey':_0x7f11('0x165')});db['VoiceCallReport'][_0x7f11('0x11d')](db[_0x7f11('0x2a')],{'as':_0x7f11('0x166'),'foreignKey':_0x7f11('0x167'),'constraints':![]});db[_0x7f11('0x25')][_0x7f11('0x11d')](db[_0x7f11('0x28')],{'as':_0x7f11('0x168'),'foreignKey':_0x7f11('0x167'),'constraints':![]});db[_0x7f11('0x25')]['belongsTo'](db[_0x7f11('0x12')],{'as':'User','foreignKey':_0x7f11('0x11a')});db['VoiceCallReport'][_0x7f11('0x12e')](db['CmContact'],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['MailServerIn'][_0x7f11('0x12e')](db[_0x7f11('0x41')],{'as':'MailAccount','foreignKey':_0x7f11('0x16b')});db['MailServerIn']['belongsTo'](db[_0x7f11('0x111')],{'as':_0x7f11('0x111'),'foreignKey':_0x7f11('0x16c'),'onDelete':'restrict'});db[_0x7f11('0x3f')]['belongsTo'](db[_0x7f11('0x41')],{'as':_0x7f11('0x41'),'foreignKey':_0x7f11('0x16b')});db['MailServerOut'][_0x7f11('0x12e')](db[_0x7f11('0x111')],{'as':_0x7f11('0x111'),'foreignKey':'CloudProviderId','onDelete':_0x7f11('0x16d')});db[_0x7f11('0x41')][_0x7f11('0x118')](db[_0x7f11('0x3d')],{'as':_0x7f11('0x16e'),'onDelete':_0x7f11('0x119')});db['MailAccount'][_0x7f11('0x118')](db[_0x7f11('0x3f')],{'as':_0x7f11('0x16f'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x41')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':'Dispositions','foreignKey':_0x7f11('0x16b'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x41')]['hasMany'](db[_0x7f11('0x84')],{'as':_0x7f11('0x170'),'foreignKey':'MailAccountId'});db[_0x7f11('0x41')][_0x7f11('0x11d')](db[_0x7f11('0x47')],{'as':'Messages','foreignKey':_0x7f11('0x16b')});db[_0x7f11('0x41')][_0x7f11('0x11d')](db[_0x7f11('0x128')],{'as':_0x7f11('0x171')});db[_0x7f11('0x41')][_0x7f11('0x11d')](db['MailApplication'],{'as':'Applications','foreignKey':_0x7f11('0x16b'),'onDelete':'cascade'});db[_0x7f11('0x41')]['belongsTo'](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db['MailAccount'][_0x7f11('0x12e')](db[_0x7f11('0x97')],{'as':_0x7f11('0x97'),'foreignKey':'TemplateId'});db[_0x7f11('0x41')][_0x7f11('0x12e')](db[_0x7f11('0x89')],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x41')][_0x7f11('0x130')](db['User'],{'as':_0x7f11('0x161'),'through':'user_has_mail_accounts'});db[_0x7f11('0x140')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':'UserMailQueue'});db[_0x7f11('0x140')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x174'),'as':_0x7f11('0x175')});db[_0x7f11('0x128')][_0x7f11('0x11d')](db[_0x7f11('0x47')],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x177')});db[_0x7f11('0x128')]['belongsTo'](db[_0x7f11('0x41')],{'as':'Account','foreignKey':_0x7f11('0x16b')});db[_0x7f11('0x128')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['MailInteraction'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x128')]['belongsToMany'](db[_0x7f11('0x90')],{'through':_0x7f11('0x179'),'as':'Tags'});db[_0x7f11('0x128')]['belongsToMany'](db[_0x7f11('0x90')],{'through':'mail_interaction_has_tags','as':_0x7f11('0x17a')});db[_0x7f11('0x128')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':_0x7f11('0x138'),'foreignKey':_0x7f11('0x177')});db[_0x7f11('0x47')][_0x7f11('0x11d')](db[_0x7f11('0x17c')],{'as':'Attachments','onDelete':_0x7f11('0x119')});db[_0x7f11('0x47')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x12')});db['MailMessage'][_0x7f11('0x12e')](db['CmContact'],{'onDelete':'cascade','as':_0x7f11('0x169')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':_0x7f11('0x17d'),'foreignKey':_0x7f11('0x177')});db[_0x7f11('0x47')][_0x7f11('0x12e')](db[_0x7f11('0x41')],{'as':'Account','foreignKey':_0x7f11('0x16b')});db[_0x7f11('0x47')]['belongsTo'](db[_0x7f11('0x64')],{'as':_0x7f11('0x64'),'foreignKey':_0x7f11('0x17e')});db['MailMessage'][_0x7f11('0x12e')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x17f')][_0x7f11('0x12e')](db[_0x7f11('0x140')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x17f')][_0x7f11('0x12e')](db[_0x7f11('0x41')],{'onDelete':'restrict'});db[_0x7f11('0x17f')]['belongsTo'](db[_0x7f11('0x88')],{'onDelete':_0x7f11('0x16d'),'foreignKey':'IntervalId'});db['MailApplication'][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':'restrict','foreignKey':_0x7f11('0x180')});db['MailQueueReport']['belongsTo'](db[_0x7f11('0x41')],{});db[_0x7f11('0x181')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x181')][_0x7f11('0x12e')](db['CmContact'],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x181')][_0x7f11('0x12e')](db[_0x7f11('0x128')],{});db[_0x7f11('0x181')][_0x7f11('0x12e')](db['MailMessage'],{});db[_0x7f11('0x181')]['belongsTo'](db[_0x7f11('0x12')],{});db[_0x7f11('0x181')][_0x7f11('0x12e')](db['MailQueue'],{});db[_0x7f11('0x4a')]['hasMany'](db[_0x7f11('0x4c')],{'as':_0x7f11('0x182'),'onDelete':'cascade'});db[_0x7f11('0x4d')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':_0x7f11('0x183'),'foreignKey':'FaxAccountId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x4d')][_0x7f11('0x11d')](db[_0x7f11('0x84')],{'as':_0x7f11('0x170'),'foreignKey':'FaxAccountId'});db[_0x7f11('0x4d')]['hasMany'](db[_0x7f11('0x51')],{'as':_0x7f11('0x171')});db[_0x7f11('0x4d')][_0x7f11('0x11d')](db[_0x7f11('0x4f')],{'as':'Applications','foreignKey':'FaxAccountId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x4d')][_0x7f11('0x11d')](db[_0x7f11('0x19')],{'as':'Exntensions','onDelete':_0x7f11('0x119')});db['FaxAccount']['hasMany'](db[_0x7f11('0x52')],{'as':_0x7f11('0x176')});db['FaxAccount'][_0x7f11('0x12e')](db[_0x7f11('0x2d')],{'as':_0x7f11('0x2d')});db[_0x7f11('0x4d')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x4d')][_0x7f11('0x12e')](db['Pause'],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x4d')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x14c')});db[_0x7f11('0x4f')]['belongsTo'](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x4f')][_0x7f11('0x12e')](db['FaxQueue'],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x4f')][_0x7f11('0x12e')](db[_0x7f11('0x4d')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x4f')][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':_0x7f11('0x16d'),'foreignKey':'TagId'});db[_0x7f11('0x51')][_0x7f11('0x11d')](db['FaxMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x7f11('0x51')][_0x7f11('0x12e')](db[_0x7f11('0x4d')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x7f11('0x51')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x51')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':'UserId'});db['FaxInteraction']['belongsToMany'](db[_0x7f11('0x90')],{'through':'fax_interaction_has_tags','as':_0x7f11('0x184')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Users','through':_0x7f11('0x139'),'foreignKey':_0x7f11('0x185')});db[_0x7f11('0x52')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'onDelete':'cascade','as':_0x7f11('0x12')});db[_0x7f11('0x52')][_0x7f11('0x12e')](db[_0x7f11('0x51')],{'as':_0x7f11('0x17d'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0x7f11('0x76')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x169')});db['FaxMessage']['belongsTo'](db[_0x7f11('0x17c')],{'as':_0x7f11('0x17c'),'foreignKey':'AttachmentId'});db[_0x7f11('0x52')][_0x7f11('0x12e')](db['FaxAccount'],{'as':_0x7f11('0x186'),'foreignKey':'FaxAccountId'});db[_0x7f11('0x144')]['belongsToMany'](db[_0x7f11('0x12')],{'as':'Agents','through':_0x7f11('0x36')});db['FaxQueue'][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x187'),'as':_0x7f11('0x175')});db[_0x7f11('0x188')][_0x7f11('0x12e')](db[_0x7f11('0x4d')],{});db[_0x7f11('0x188')][_0x7f11('0x12e')](db['CmList'],{'as':'List','foreignKey':_0x7f11('0x173')});db[_0x7f11('0x188')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x188')][_0x7f11('0x12e')](db[_0x7f11('0x51')],{});db['FaxQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x52')],{});db[_0x7f11('0x188')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db[_0x7f11('0x150')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':_0x7f11('0x183'),'foreignKey':_0x7f11('0x189'),'onDelete':'cascade'});db[_0x7f11('0x150')][_0x7f11('0x11d')](db['CannedAnswer'],{'as':_0x7f11('0x170'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x7f11('0x11d')](db[_0x7f11('0x5a')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x7f11('0x150')]['hasMany'](db[_0x7f11('0x58')],{'as':_0x7f11('0x171')});db['SmsAccount'][_0x7f11('0x11d')](db[_0x7f11('0x56')],{'as':_0x7f11('0x18a'),'foreignKey':_0x7f11('0x189'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x150')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x150')]['belongsTo'](db['Pause'],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x150')][_0x7f11('0x130')](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x7f11('0x56')]['belongsTo'](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x56')]['belongsTo'](db[_0x7f11('0x5c')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x56')]['belongsTo'](db[_0x7f11('0x150')],{'onDelete':'restrict'});db[_0x7f11('0x56')][_0x7f11('0x12e')](db[_0x7f11('0x88')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x18b')});db['SmsApplication'][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x180')});db[_0x7f11('0x58')]['hasMany'](db[_0x7f11('0x5a')],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x18c')});db[_0x7f11('0x58')][_0x7f11('0x12e')](db[_0x7f11('0x150')],{'as':'Account','foreignKey':_0x7f11('0x189')});db[_0x7f11('0x58')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x58')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x58')]['belongsToMany'](db[_0x7f11('0x90')],{'through':_0x7f11('0x18d'),'as':'Tags'});db[_0x7f11('0x58')]['belongsToMany'](db[_0x7f11('0x90')],{'through':_0x7f11('0x18d'),'as':_0x7f11('0x17a')});db[_0x7f11('0x58')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':_0x7f11('0x13a'),'foreignKey':_0x7f11('0x18c')});db[_0x7f11('0x5a')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x12')});db[_0x7f11('0x5a')][_0x7f11('0x12e')](db['CmContact'],{'onDelete':_0x7f11('0x119'),'as':'Contact'});db[_0x7f11('0x5a')]['belongsTo'](db[_0x7f11('0x58')],{'onDelete':'cascade','as':_0x7f11('0x17d'),'foreignKey':_0x7f11('0x18c')});db[_0x7f11('0x5a')][_0x7f11('0x12e')](db[_0x7f11('0x150')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x189')});db['SmsQueue'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':'UserSmsQueue','foreignKey':_0x7f11('0x18e')});db[_0x7f11('0x5c')][_0x7f11('0x130')](db['Team'],{'through':'team_has_sms_queues','as':'Teams'});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':_0x7f11('0x183'),'foreignKey':_0x7f11('0x18f'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db[_0x7f11('0x84')],{'as':_0x7f11('0x170'),'foreignKey':'OpenchannelAccountId'});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db[_0x7f11('0x124')],{'as':_0x7f11('0x171'),'foreignKey':_0x7f11('0x18f')});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db[_0x7f11('0x61')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db['OpenchannelApplication'],{'as':_0x7f11('0x18a'),'foreignKey':_0x7f11('0x18f'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x5e')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x5e')][_0x7f11('0x12e')](db[_0x7f11('0x89')],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x5e')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x7f11('0x12e')](db['User'],{'onDelete':_0x7f11('0x16d')});db['OpenchannelApplication'][_0x7f11('0x12e')](db[_0x7f11('0x147')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x190')});db['OpenchannelApplication']['belongsTo'](db[_0x7f11('0x5e')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x18f')});db[_0x7f11('0x5f')][_0x7f11('0x12e')](db[_0x7f11('0x88')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x5f')][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':'restrict','foreignKey':_0x7f11('0x180')});db[_0x7f11('0x124')][_0x7f11('0x11d')](db[_0x7f11('0x61')],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x191')});db[_0x7f11('0x124')]['belongsTo'](db[_0x7f11('0x5e')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x18f')});db[_0x7f11('0x124')]['belongsTo'](db[_0x7f11('0x76')],{'as':'Contact','foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x124')]['belongsTo'](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x124')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':'openchannel_interaction_has_tags','as':_0x7f11('0x184')});db[_0x7f11('0x124')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':'openchannel_interaction_has_tags','as':_0x7f11('0x17a')});db[_0x7f11('0x124')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x7f11('0x61')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'onDelete':'cascade','as':'User'});db[_0x7f11('0x61')]['belongsTo'](db[_0x7f11('0x76')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x169')});db[_0x7f11('0x61')][_0x7f11('0x12e')](db[_0x7f11('0x124')],{'onDelete':'cascade','as':_0x7f11('0x17d'),'foreignKey':'OpenchannelInteractionId'});db[_0x7f11('0x61')][_0x7f11('0x12e')](db[_0x7f11('0x17c')],{'as':_0x7f11('0x17c'),'foreignKey':_0x7f11('0x192')});db[_0x7f11('0x61')][_0x7f11('0x12e')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x7f11('0x18f')});db['OpenchannelQueue'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x7f11('0x190')});db['OpenchannelQueue']['belongsToMany'](db[_0x7f11('0xed')],{'through':_0x7f11('0x193'),'as':_0x7f11('0x175')});db[_0x7f11('0x64')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7f11('0x17e'),'onDelete':_0x7f11('0x119')});db['ChatWebsite'][_0x7f11('0x11d')](db[_0x7f11('0x84')],{'as':_0x7f11('0x170'),'foreignKey':_0x7f11('0x17e')});db[_0x7f11('0x64')][_0x7f11('0x11d')](db[_0x7f11('0x73')],{'as':_0x7f11('0x194')});db[_0x7f11('0x64')][_0x7f11('0x11d')](db[_0x7f11('0x69')],{'as':_0x7f11('0x171')});db[_0x7f11('0x64')]['hasMany'](db[_0x7f11('0x67')],{'as':_0x7f11('0x18a'),'foreignKey':_0x7f11('0x17e'),'onDelete':'cascade'});db['ChatWebsite'][_0x7f11('0x11d')](db['ChatMessage'],{'as':_0x7f11('0x176')});db[_0x7f11('0x64')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x64')][_0x7f11('0x12e')](db[_0x7f11('0x88')],{'as':_0x7f11('0x88'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x64')]['belongsTo'](db['MailAccount'],{'as':_0x7f11('0x41'),'foreignKey':_0x7f11('0x16b')});db[_0x7f11('0x64')][_0x7f11('0x12e')](db[_0x7f11('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x7f11('0x195')});db[_0x7f11('0x64')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x196')});db[_0x7f11('0x197')]['belongsTo'](db['OpenchannelAccount'],{});db[_0x7f11('0x197')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':'List','foreignKey':'ListId'});db[_0x7f11('0x197')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':'Contact','foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x197')][_0x7f11('0x12e')](db[_0x7f11('0x124')],{});db[_0x7f11('0x197')][_0x7f11('0x12e')](db[_0x7f11('0x61')],{});db[_0x7f11('0x197')][_0x7f11('0x12e')](db['User'],{});db[_0x7f11('0x197')][_0x7f11('0x12e')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x198'),'foreignKey':_0x7f11('0x11a'),'onDelete':'restrict'});db[_0x7f11('0x67')][_0x7f11('0x12e')](db[_0x7f11('0x6f')],{'as':'Queue','foreignKey':_0x7f11('0x199'),'onDelete':'restrict'});db[_0x7f11('0x67')][_0x7f11('0x12e')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x7f11('0x17e'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x67')][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x7f11('0x69')][_0x7f11('0x11d')](db[_0x7f11('0x6b')],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x19a')});db[_0x7f11('0x69')][_0x7f11('0x12e')](db[_0x7f11('0x64')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x17e')});db['ChatInteraction'][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x69')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':'chat_interaction_has_tags','as':_0x7f11('0x184')});db[_0x7f11('0x69')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':_0x7f11('0x19b'),'as':'ThroughTags'});db[_0x7f11('0x69')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':_0x7f11('0x19c'),'foreignKey':_0x7f11('0x19a')});db['ChatMessage'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x12')});db[_0x7f11('0x6b')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x169'),'foreignKey':'ContactId'});db[_0x7f11('0x6b')][_0x7f11('0x12e')](db['ChatInteraction'],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x17d'),'foreignKey':'ChatInteractionId'});db[_0x7f11('0x6b')][_0x7f11('0x12e')](db[_0x7f11('0x17c')],{'as':_0x7f11('0x17c'),'foreignKey':_0x7f11('0x192')});db[_0x7f11('0x6b')][_0x7f11('0x12e')](db[_0x7f11('0x64')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x17e')});db['ChatOfflineMessage'][_0x7f11('0x11d')](db[_0x7f11('0x17c')],{'as':_0x7f11('0x19d'),'foreignKey':_0x7f11('0x19e'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0x7f11('0x76')],{'onDelete':'cascade','as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x7f11('0x17e')});db[_0x7f11('0x6f')]['belongsToMany'](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x143'),'hooks':!![]});db[_0x7f11('0x6f')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x19f'),'as':'Teams'});db[_0x7f11('0x71')][_0x7f11('0x11d')](db[_0x7f11('0x1a0')],{'as':_0x7f11('0x176'),'foreignKey':_0x7f11('0x1a1'),'onDelete':_0x7f11('0x119')});db['ChatGroup'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Members','through':'chat_group_has_users'});db['ChatProactiveAction']['belongsTo'](db[_0x7f11('0x64')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x7f11('0x75')][_0x7f11('0x11d')](db['CmContact'],{'as':'Contacts','foreignKey':_0x7f11('0x1a2')});db[_0x7f11('0x76')][_0x7f11('0x11d')](db['CmContactHasItem'],{'as':_0x7f11('0x1a3'),'foreignKey':'CmContactId'});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0x7f11('0x12c'),'foreignKey':'ContactId'});db[_0x7f11('0x76')][_0x7f11('0x11d')](db[_0x7f11('0x121')],{'as':'HopperFinals','foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x76')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db['CmContact'][_0x7f11('0x11d')](db[_0x7f11('0x7e')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x7f11('0x76')][_0x7f11('0x11d')](db[_0x7f11('0xda')],{'as':'JscriptySessions','foreignKey':'ContactId'});db['CmContact'][_0x7f11('0x11d')](db[_0x7f11('0x124')],{'as':_0x7f11('0x13b'),'foreignKey':'ContactId','onDelete':_0x7f11('0x16d')});db['CmContact'][_0x7f11('0x11d')](db[_0x7f11('0x69')],{'as':_0x7f11('0x125'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x16d')});db['CmContact'][_0x7f11('0x11d')](db[_0x7f11('0x58')],{'as':_0x7f11('0x126'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x76')]['hasMany'](db['FaxInteraction'],{'as':_0x7f11('0x127'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x16d')});db['CmContact']['hasMany'](db[_0x7f11('0x128')],{'as':_0x7f11('0x129'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x76')][_0x7f11('0x12e')](db[_0x7f11('0x75')],{'as':_0x7f11('0x1a4'),'foreignKey':_0x7f11('0x1a2')});db['CmContact'][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':'List','foreignKey':_0x7f11('0x173'),'onDelete':_0x7f11('0x119')});db['CmContact'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':_0x7f11('0x1a5')});db[_0x7f11('0x76')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'as':_0x7f11('0x184'),'through':_0x7f11('0x1a6')});db[_0x7f11('0x76')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':'cm_contact_has_tags','as':_0x7f11('0x17a')});db[_0x7f11('0x78')][_0x7f11('0x11d')](db[_0x7f11('0x1a7')],{'as':_0x7f11('0x1a8'),'foreignKey':_0x7f11('0x1a9')});db['CmHopper']['belongsTo'](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x119')});db['CmHopper'][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x78')][_0x7f11('0x12e')](db['User'],{'as':_0x7f11('0x198'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x78')][_0x7f11('0x12e')](db[_0x7f11('0x1c')],{'as':_0x7f11('0x1aa'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x7f11('0x78')][_0x7f11('0x12e')](db['Campaign'],{'as':_0x7f11('0xf1'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x7f11('0x78')]['belongsTo'](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x1ab')});db['CmHopperBlack'][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':'ContactId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x7a')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':'List','foreignKey':_0x7f11('0x173'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x7a')][_0x7f11('0x12e')](db[_0x7f11('0x1c')],{'as':_0x7f11('0x1aa'),'foreignKey':'VoiceQueueId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x7a')]['belongsTo'](db[_0x7f11('0xf1')],{'as':_0x7f11('0xf1'),'foreignKey':_0x7f11('0x1ac'),'onDelete':_0x7f11('0x119')});db['Automation'][_0x7f11('0x11d')](db[_0x7f11('0x1ad')],{'as':{'plural':_0x7f11('0x1ae'),'singular':_0x7f11('0x1af')},'foreignKey':_0x7f11('0x1b0'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db[_0x7f11('0x82')][_0x7f11('0x11d')](db[_0x7f11('0x1ad')],{'as':{'plural':_0x7f11('0x1b1'),'singular':_0x7f11('0x1b2')},'foreignKey':_0x7f11('0x1b3'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db['Automation'][_0x7f11('0x11d')](db[_0x7f11('0x81')],{'as':_0x7f11('0x1b4'),'foreignKey':_0x7f11('0x1b5'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db[_0x7f11('0x86')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':_0x7f11('0x183'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0x7f11('0x88')]['hasMany'](db['Interval'],{'as':_0x7f11('0x1b6'),'foreignKey':'IntervalId','onDelete':_0x7f11('0x119'),'hooks':!![],'required':![]});db['Interval'][_0x7f11('0x11d')](db['VoiceExtension'],{'as':_0x7f11('0x120'),'foreignKey':_0x7f11('0x18b'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x88')][_0x7f11('0x11d')](db[_0x7f11('0x17f')],{'as':_0x7f11('0x1b7'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x88')]['hasMany'](db[_0x7f11('0x67')],{'as':'ChatApplications','foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x88')][_0x7f11('0x11d')](db[_0x7f11('0x4f')],{'as':'FaxApplications','foreignKey':_0x7f11('0x18b')});db['Interval'][_0x7f11('0x11d')](db[_0x7f11('0x56')],{'as':_0x7f11('0x1b8'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x1b9')]['belongsTo'](db[_0x7f11('0x41')],{});db[_0x7f11('0x1b9')][_0x7f11('0x12e')](db[_0x7f11('0xa1')],{'foreignKey':_0x7f11('0x1ba')});db[_0x7f11('0x1b9')][_0x7f11('0x12e')](db[_0x7f11('0x9f')],{'foreignKey':_0x7f11('0x1bb')});db['Sound']['belongsToMany'](db[_0x7f11('0x1a')],{'as':_0x7f11('0x1bc'),'through':_0x7f11('0x157'),'onDelete':_0x7f11('0x16d')});db['Tag'][_0x7f11('0x130')](db[_0x7f11('0x76')],{'through':_0x7f11('0x1a6')});db[_0x7f11('0x90')][_0x7f11('0x130')](db[_0x7f11('0x69')],{'through':_0x7f11('0x19b')});db['Tag']['belongsToMany'](db[_0x7f11('0x128')],{'through':'mail_interaction_has_tags'});db[_0x7f11('0x90')][_0x7f11('0x130')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db['Tag']['belongsToMany'](db['FaxInteraction'],{'through':_0x7f11('0x1bd')});db[_0x7f11('0x90')][_0x7f11('0x130')](db[_0x7f11('0x124')],{'through':_0x7f11('0x1be')});db[_0x7f11('0x90')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x7f11('0x1bf')});db['CmContactHasItem'][_0x7f11('0x12e')](db[_0x7f11('0x92')],{'as':_0x7f11('0x1c0'),'foreignKey':_0x7f11('0x1c1')});db[_0x7f11('0x1a7')]['belongsTo'](db['CmHopper'],{'as':'Hopper','foreignKey':_0x7f11('0x1a9')});db[_0x7f11('0x94')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x1c2')});db['Trigger']['hasMany'](db[_0x7f11('0x1ad')],{'as':{'plural':_0x7f11('0x1c3'),'singular':_0x7f11('0x1c4')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x7f11('0x99')][_0x7f11('0x11d')](db[_0x7f11('0x1ad')],{'as':{'plural':_0x7f11('0x1c5'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x7f11('0x119'),'hooks':!![]});db['Trigger'][_0x7f11('0x11d')](db[_0x7f11('0x81')],{'as':_0x7f11('0x1b4'),'foreignKey':_0x7f11('0x1c6'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db['AnalyticCustomReport'][_0x7f11('0x11d')](db[_0x7f11('0xa4')],{'as':'Fields','onDelete':_0x7f11('0x119'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x7f11('0xa1')]['hasMany'](db[_0x7f11('0xa4')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1ba')});db[_0x7f11('0x1c8')][_0x7f11('0x11d')](db[_0x7f11('0xa4')],{'as':'Fields','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1c9')});db['AnalyticFieldReport'][_0x7f11('0x12e')](db[_0x7f11('0x1c8')],{'foreignKey':'MetricId'});db[_0x7f11('0xa5')][_0x7f11('0x11d')](db[_0x7f11('0xa6')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xa6')]['hasMany'](db[_0x7f11('0xa8')],{'as':'Subjects','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db['SalesforceConfiguration'][_0x7f11('0x11d')](db[_0x7f11('0xa8')],{'as':_0x7f11('0x1cd'),'onDelete':'cascade','foreignKey':_0x7f11('0x1ce')});db['SalesforceConfiguration'][_0x7f11('0x11d')](db[_0x7f11('0xa8')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xa6')][_0x7f11('0x12e')](db['SalesforceAccount'],{'as':_0x7f11('0x186'),'foreignKey':'AccountId'});db[_0x7f11('0xa8')][_0x7f11('0x11d')](db['SalesforceField'],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xa8')]['hasMany'](db[_0x7f11('0xa8')],{'as':'Description','foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xa8')]['hasMany'](db[_0x7f11('0xa8')],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xa8')][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0x1d3')][_0x7f11('0x11d')](db[_0x7f11('0xaa')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':'AccountId'});db[_0x7f11('0xaa')][_0x7f11('0x11d')](db[_0x7f11('0xac')],{'as':_0x7f11('0x1d4'),'onDelete':_0x7f11('0x119'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x7f11('0x11d')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xaa')][_0x7f11('0x11d')](db['SugarcrmField'],{'as':'Fields','onDelete':_0x7f11('0x119'),'foreignKey':'FieldId'});db[_0x7f11('0xaa')][_0x7f11('0x12e')](db[_0x7f11('0x1d3')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xac')][_0x7f11('0x11d')](db[_0x7f11('0xac')],{'as':_0x7f11('0x1d0'),'foreignKey':'SubjectId'});db[_0x7f11('0xac')][_0x7f11('0x11d')](db[_0x7f11('0xac')],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xac')][_0x7f11('0x11d')](db['SugarcrmField'],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xac')][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0x1d6')][_0x7f11('0x11d')](db['DeskConfiguration'],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xaf')]['hasMany'](db[_0x7f11('0xb1')],{'as':_0x7f11('0x1d4'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xaf')][_0x7f11('0x11d')](db['DeskField'],{'as':_0x7f11('0x1cd'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1ce')});db['DeskConfiguration']['hasMany'](db[_0x7f11('0xb1')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':'FieldId'});db[_0x7f11('0xaf')][_0x7f11('0x12e')](db[_0x7f11('0x1d6')],{'as':'Account','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xaf')][_0x7f11('0x130')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x7f11('0xb1')][_0x7f11('0x11d')](db[_0x7f11('0xb1')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xb1')][_0x7f11('0x11d')](db[_0x7f11('0xb1')],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xb1')]['hasMany'](db[_0x7f11('0xb1')],{'as':'Field','foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xb1')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['ZohoAccount'][_0x7f11('0x11d')](db[_0x7f11('0xb5')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':'AccountId'});db['ZohoConfiguration']['hasMany'](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1d4'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xb5')][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1cd'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xb5')][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xb5')]['belongsTo'](db[_0x7f11('0xb3')],{'as':'Account','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0x1d7')][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0x1d7')][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1d5'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':'Field','foreignKey':'FieldId'});db[_0x7f11('0x1d7')]['belongsTo'](db['Variable'],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0xb7')][_0x7f11('0x11d')](db[_0x7f11('0xb9')],{'as':_0x7f11('0x1ca'),'onDelete':'cascade','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xb9')][_0x7f11('0x11d')](db[_0x7f11('0x1d8')],{'as':_0x7f11('0x1d4'),'foreignKey':'SubjectId'});db[_0x7f11('0xb9')][_0x7f11('0x11d')](db['ZendeskField'],{'as':_0x7f11('0x1cd'),'foreignKey':'DescriptionId'});db[_0x7f11('0xb9')][_0x7f11('0x11d')](db['ZendeskField'],{'as':_0x7f11('0x1c7'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xb9')]['belongsTo'](db[_0x7f11('0xb7')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xb9')]['belongsToMany'](db[_0x7f11('0x90')],{'through':_0x7f11('0x1d9')});db['ZendeskField']['hasMany'](db[_0x7f11('0x1d8')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db['ZendeskField']['hasMany'](db[_0x7f11('0x1d8')],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0x1d8')]['hasMany'](db['ZendeskField'],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0x1d8')][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0x1da')][_0x7f11('0x11d')](db[_0x7f11('0xbc')],{'as':_0x7f11('0x1ca'),'onDelete':'cascade','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xbc')][_0x7f11('0x11d')](db[_0x7f11('0xbe')],{'as':'Subjects','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db['FreshdeskConfiguration']['hasMany'](db[_0x7f11('0xbe')],{'as':_0x7f11('0x1cd'),'onDelete':'cascade','foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xbc')][_0x7f11('0x11d')](db[_0x7f11('0xbe')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xbc')]['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xbc')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':_0x7f11('0x1db')});db[_0x7f11('0xbe')][_0x7f11('0x11d')](db[_0x7f11('0xbe')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xbe')]['hasMany'](db['FreshdeskField'],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xbe')][_0x7f11('0x11d')](db[_0x7f11('0xbe')],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xbe')][_0x7f11('0x12e')](db['Variable'],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0x1dc')][_0x7f11('0x11d')](db[_0x7f11('0xc0')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration'][_0x7f11('0x11d')](db['VtigerField'],{'as':_0x7f11('0x1d4'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xc0')]['hasMany'](db[_0x7f11('0x1dd')],{'as':_0x7f11('0x1cd'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xc0')][_0x7f11('0x11d')](db[_0x7f11('0x1dd')],{'as':_0x7f11('0x1c7'),'foreignKey':_0x7f11('0x1cf')});db['VtigerConfiguration']['belongsTo'](db[_0x7f11('0x1dc')],{'as':'Account','foreignKey':'AccountId'});db[_0x7f11('0x1dd')][_0x7f11('0x11d')](db[_0x7f11('0x1dd')],{'as':_0x7f11('0x1d0'),'foreignKey':'SubjectId'});db[_0x7f11('0x1dd')][_0x7f11('0x11d')](db[_0x7f11('0x1dd')],{'as':'Description','foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0x1dd')][_0x7f11('0x11d')](db[_0x7f11('0x1dd')],{'as':'Field','foreignKey':'FieldId'});db[_0x7f11('0x1dd')]['belongsTo'](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0xc3')]['hasMany'](db[_0x7f11('0xc5')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cb')});db['ServicenowConfiguration'][_0x7f11('0x11d')](db['ServicenowField'],{'as':_0x7f11('0x1d4'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xc5')]['hasMany'](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1cd'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x7f11('0x11d')](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1c7'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xc5')]['belongsTo'](db[_0x7f11('0xc3')],{'as':'Account','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xc7')][_0x7f11('0x11d')](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xc7')][_0x7f11('0x11d')](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db['ServicenowField'][_0x7f11('0x11d')](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1d1'),'foreignKey':'FieldId'});db[_0x7f11('0xc7')][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':'Variable','foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0xc9')][_0x7f11('0x11d')](db[_0x7f11('0xcb')],{'as':_0x7f11('0x1ca'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x7f11('0xc9')][_0x7f11('0x12e')](db['CloudProvider'],{'as':_0x7f11('0x111'),'foreignKey':_0x7f11('0x16c')});db['Dynamics365Configuration']['hasMany'](db[_0x7f11('0xcd')],{'as':'Subjects','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xcb')][_0x7f11('0x11d')](db[_0x7f11('0xcd')],{'as':_0x7f11('0x1cd'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7f11('0xcb')][_0x7f11('0x11d')](db[_0x7f11('0xcd')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':'FieldId'});db[_0x7f11('0xcb')][_0x7f11('0x12e')](db[_0x7f11('0xc9')],{'as':_0x7f11('0x186'),'foreignKey':'AccountId'});db[_0x7f11('0xcd')]['hasMany'](db['Dynamics365Field'],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xcd')]['hasMany'](db['Dynamics365Field'],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xcd')][_0x7f11('0x11d')](db[_0x7f11('0xcd')],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x7f11('0x1d2')});db['FreshsalesAccount'][_0x7f11('0x11d')](db[_0x7f11('0xd1')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cb')});db['FreshsalesConfiguration'][_0x7f11('0x11d')](db[_0x7f11('0x1de')],{'as':_0x7f11('0x1d4'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xd1')][_0x7f11('0x11d')](db[_0x7f11('0x1de')],{'as':'Descriptions','foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xd1')]['hasMany'](db[_0x7f11('0x1de')],{'as':_0x7f11('0x1c7'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xd1')][_0x7f11('0x12e')](db[_0x7f11('0xcf')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0x1de')][_0x7f11('0x11d')](db[_0x7f11('0x1de')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0x1de')]['hasMany'](db[_0x7f11('0x1de')],{'as':_0x7f11('0x1d5'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0x7f11('0x11d')](db[_0x7f11('0x1de')],{'as':'Field','foreignKey':_0x7f11('0x1cf')});db['FreshsalesField'][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x64')],{});db[_0x7f11('0xd5')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0xd5')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0x7f11('0x69')],{});db['ChatQueueReport'][_0x7f11('0x12e')](db['ChatMessage'],{});db[_0x7f11('0xd5')]['belongsTo'](db[_0x7f11('0x12')],{});db[_0x7f11('0xd5')][_0x7f11('0x12e')](db[_0x7f11('0x6f')],{});db[_0x7f11('0x1a0')][_0x7f11('0x12e')](db['User'],{'onDelete':_0x7f11('0x119'),'foreignKey':'FromId'});db[_0x7f11('0x1a0')]['belongsTo'](db[_0x7f11('0x12')],{'onDelete':'cascade','foreignKey':'ToId'});db['JscriptySessionReport'][_0x7f11('0x11d')](db[_0x7f11('0xd8')],{'foreignKey':_0x7f11('0x1df'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0xda')]['hasMany'](db[_0x7f11('0x1e0')],{'foreignKey':_0x7f11('0x1df'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db['SmsAccount'],{});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['SmsQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x58')],{});db['SmsQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x5a')],{});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db[_0x7f11('0x5c')],{});db['JscriptyProject']['hasMany'](db[_0x7f11('0xda')],{'foreignKey':'ProjectId'});db[_0x7f11('0xe1')]['hasMany'](db[_0x7f11('0xd8')],{'foreignKey':_0x7f11('0x1e1')});db[_0x7f11('0xe1')]['hasMany'](db[_0x7f11('0x1e0')],{'foreignKey':_0x7f11('0x1e1')});db[_0x7f11('0xed')]['belongsToMany'](db[_0x7f11('0x12')],{'as':'Agents','through':_0x7f11('0x137')});db[_0x7f11('0xed')][_0x7f11('0x130')](db[_0x7f11('0x1c')],{'through':_0x7f11('0x112'),'as':_0x7f11('0x13e')});db[_0x7f11('0xed')]['belongsToMany'](db[_0x7f11('0x140')],{'through':_0x7f11('0x174'),'as':_0x7f11('0x141')});db[_0x7f11('0xed')][_0x7f11('0x130')](db[_0x7f11('0x6f')],{'through':_0x7f11('0x19f'),'as':_0x7f11('0x142')});db[_0x7f11('0xed')]['belongsToMany'](db[_0x7f11('0x144')],{'through':_0x7f11('0x187'),'as':_0x7f11('0x145')});db[_0x7f11('0xed')]['belongsToMany'](db[_0x7f11('0x5c')],{'through':_0x7f11('0x1e2'),'as':_0x7f11('0x146')});db['Team'][_0x7f11('0x130')](db[_0x7f11('0x147')],{'through':_0x7f11('0x193'),'as':_0x7f11('0x148')});db['Team'][_0x7f11('0x130')](db[_0x7f11('0x10f')],{'through':_0x7f11('0x1e3'),'as':_0x7f11('0x149')});db[_0x7f11('0xed')][_0x7f11('0x130')](db[_0x7f11('0xfe')],{'through':'TeamVoicePrefix','as':_0x7f11('0x13f')});db[_0x7f11('0xf1')][_0x7f11('0x11d')](db['CmHopper'],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x7f11('0xf1')][_0x7f11('0x11d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'CampaignId'});db['Campaign'][_0x7f11('0x11d')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x7f11('0xf1')][_0x7f11('0x11d')](db[_0x7f11('0x7a')],{'as':_0x7f11('0x15a'),'foreignKey':'CampaignId'});db[_0x7f11('0xf1')][_0x7f11('0x12e')](db[_0x7f11('0x2d')],{'as':_0x7f11('0x2d'),'foreignKey':_0x7f11('0x15c')});db['Campaign'][_0x7f11('0x12e')](db[_0x7f11('0x2d')],{'as':_0x7f11('0x15d'),'foreignKey':_0x7f11('0x15e')});db[_0x7f11('0xf1')][_0x7f11('0x12e')](db['Interval'],{'as':_0x7f11('0x88'),'foreignKey':_0x7f11('0x18b')});db['Campaign'][_0x7f11('0x12e')](db[_0x7f11('0xe7')],{'as':_0x7f11('0xe7'),'foreignKey':_0x7f11('0x1e4')});db['Campaign'][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':'Lists','through':_0x7f11('0x1e5')});db[_0x7f11('0xf1')][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':_0x7f11('0x162'),'through':_0x7f11('0x1e6')});db[_0x7f11('0x17c')][_0x7f11('0x12e')](db[_0x7f11('0x6d')],{'as':_0x7f11('0x6d'),'foreignKey':_0x7f11('0x19e')});db[_0x7f11('0xf8')]['belongsTo'](db[_0x7f11('0x47')],{});db[_0x7f11('0xf8')][_0x7f11('0x12e')](db[_0x7f11('0x128')],{});db[_0x7f11('0xf8')][_0x7f11('0x12e')](db[_0x7f11('0x41')],{'foreignKey':_0x7f11('0x1e7'),'as':'FromAccount'});db[_0x7f11('0xf8')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1e8'),'as':_0x7f11('0x1e9')});db[_0x7f11('0xf8')][_0x7f11('0x12e')](db['User'],{'foreignKey':_0x7f11('0x1ea'),'as':'ToAgent'});db[_0x7f11('0xf8')]['belongsTo'](db[_0x7f11('0x140')],{'foreignKey':'ToMailQueueId','as':_0x7f11('0x1eb')});db[_0x7f11('0xf8')]['belongsTo'](db[_0x7f11('0x41')],{'foreignKey':_0x7f11('0x1ec'),'as':'ToAccount'});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db['ChatMessage'],{});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db['ChatInteraction'],{});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db[_0x7f11('0x64')],{'foreignKey':'FromChatWebsiteId','as':_0x7f11('0x1ed')});db[_0x7f11('0xf9')]['belongsTo'](db[_0x7f11('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':'ToUserId','as':_0x7f11('0x1ee')});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db[_0x7f11('0x6f')],{'foreignKey':_0x7f11('0x1ef'),'as':_0x7f11('0x1eb')});db[_0x7f11('0xf9')]['belongsTo'](db[_0x7f11('0x64')],{'foreignKey':_0x7f11('0x1f0'),'as':_0x7f11('0x1f1')});db[_0x7f11('0x1f2')][_0x7f11('0x12e')](db['FaxMessage'],{});db['FaxTransferReport']['belongsTo'](db['FaxInteraction'],{});db['FaxTransferReport']['belongsTo'](db[_0x7f11('0x4d')],{'foreignKey':_0x7f11('0x1f3'),'as':_0x7f11('0x1ed')});db[_0x7f11('0x1f2')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1e8'),'as':'FromAgent'});db[_0x7f11('0x1f2')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':'ToUserId','as':_0x7f11('0x1ee')});db['FaxTransferReport'][_0x7f11('0x12e')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x7f11('0x1eb')});db[_0x7f11('0x1f2')][_0x7f11('0x12e')](db[_0x7f11('0x4d')],{'foreignKey':_0x7f11('0x1f4'),'as':'ToAccount'});db[_0x7f11('0xfa')][_0x7f11('0x12e')](db[_0x7f11('0x61')],{});db[_0x7f11('0xfa')][_0x7f11('0x12e')](db[_0x7f11('0x124')],{});db[_0x7f11('0xfa')]['belongsTo'](db[_0x7f11('0x5e')],{'foreignKey':_0x7f11('0x1f5'),'as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1e8'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1ea'),'as':_0x7f11('0x1ee')});db[_0x7f11('0xfa')][_0x7f11('0x12e')](db[_0x7f11('0x147')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x7f11('0xfa')][_0x7f11('0x12e')](db[_0x7f11('0x5e')],{'foreignKey':_0x7f11('0x1f6'),'as':_0x7f11('0x1f1')});db[_0x7f11('0xfc')]['belongsTo'](db[_0x7f11('0x5a')],{});db[_0x7f11('0xfc')][_0x7f11('0x12e')](db[_0x7f11('0x58')],{});db[_0x7f11('0xfc')][_0x7f11('0x12e')](db['SmsAccount'],{'foreignKey':_0x7f11('0x1f7'),'as':_0x7f11('0x1ed')});db[_0x7f11('0xfc')][_0x7f11('0x12e')](db['User'],{'foreignKey':_0x7f11('0x1e8'),'as':_0x7f11('0x1e9')});db[_0x7f11('0xfc')]['belongsTo'](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1ea'),'as':_0x7f11('0x1ee')});db[_0x7f11('0xfc')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x7f11('0x1f8'),'as':'ToQueue'});db[_0x7f11('0xfc')][_0x7f11('0x12e')](db[_0x7f11('0x150')],{'foreignKey':_0x7f11('0x1f9'),'as':'ToAccount'});db[_0x7f11('0x134')][_0x7f11('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7f11('0x173'),'onDelete':_0x7f11('0x119')});db['CmList'][_0x7f11('0x11d')](db[_0x7f11('0x1fa')],{'as':'CustomFields','foreignKey':_0x7f11('0x173')});db['CmList']['hasMany'](db[_0x7f11('0x76')],{'as':_0x7f11('0x133'),'onDelete':'cascade','foreignKey':_0x7f11('0x173')});db[_0x7f11('0x134')][_0x7f11('0x11d')](db[_0x7f11('0x121')],{'as':_0x7f11('0x122'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x134')][_0x7f11('0x11d')](db[_0x7f11('0x7d')],{'as':_0x7f11('0x123'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x134')][_0x7f11('0x11d')](db[_0x7f11('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x7f11('0x173')});db[_0x7f11('0x134')][_0x7f11('0x130')](db[_0x7f11('0x1c')],{'as':'Queues','through':_0x7f11('0x160')});db[_0x7f11('0x134')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Agents','through':_0x7f11('0x136')});db[_0x7f11('0xfe')][_0x7f11('0x11d')](db[_0x7f11('0x19')],{'as':_0x7f11('0x120'),'onDelete':_0x7f11('0x119')});db['VoicePrefix'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x115')});db[_0x7f11('0xfe')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x113'),'as':'Teams'});db['UserProfile']['hasMany'](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'foreignKey':_0x7f11('0x12f')});db[_0x7f11('0xff')][_0x7f11('0x11d')](db[_0x7f11('0x1fb')],{'as':_0x7f11('0x1fc'),'foreignKey':'userProfileId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x1fb')][_0x7f11('0x11d')](db['UserProfileResource'],{'as':_0x7f11('0x1fd'),'foreignKey':_0x7f11('0x1fe'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x105')]['hasMany'](db['Disposition'],{'as':_0x7f11('0x183'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x7f11('0x105')][_0x7f11('0x11d')](db['CannedAnswer'],{'as':_0x7f11('0x170'),'foreignKey':_0x7f11('0x1ff')});db['WhatsappAccount'][_0x7f11('0x11d')](db['WhatsappMessage'],{'as':_0x7f11('0x176'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x7f11('0x11d')](db[_0x7f11('0x109')],{'as':_0x7f11('0x171')});db[_0x7f11('0x105')][_0x7f11('0x11d')](db['WhatsappApplication'],{'as':_0x7f11('0x18a'),'foreignKey':'WhatsappAccountId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x105')]['belongsTo'](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':'ListId'});db[_0x7f11('0x105')][_0x7f11('0x12e')](db[_0x7f11('0x89')],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x105')][_0x7f11('0x130')](db['User'],{'as':_0x7f11('0x161'),'through':_0x7f11('0x200')});db[_0x7f11('0x107')]['belongsTo'](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x16d')});db['WhatsappApplication']['belongsTo'](db[_0x7f11('0x10f')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x7f11('0x12e')](db['WhatsappAccount'],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x107')]['belongsTo'](db[_0x7f11('0x88')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x107')][_0x7f11('0x12e')](db['Tag'],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x180')});db[_0x7f11('0x109')][_0x7f11('0x11d')](db['WhatsappMessage'],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x201')});db[_0x7f11('0x109')][_0x7f11('0x12e')](db[_0x7f11('0x105')],{'as':'Account','foreignKey':_0x7f11('0x1ff')});db['WhatsappInteraction'][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':'ContactId'});db[_0x7f11('0x109')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x109')][_0x7f11('0x130')](db['Tag'],{'through':_0x7f11('0x1bf'),'as':'Tags'});db[_0x7f11('0x109')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':_0x7f11('0x1bf'),'as':'ThroughTags'});db[_0x7f11('0x109')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Users','through':_0x7f11('0x202'),'foreignKey':_0x7f11('0x201')});db[_0x7f11('0x10b')]['belongsTo'](db[_0x7f11('0x12')],{'as':_0x7f11('0x12')});db[_0x7f11('0x10b')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'onDelete':'cascade','as':'Contact'});db[_0x7f11('0x10b')][_0x7f11('0x12e')](db[_0x7f11('0x109')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x17d'),'foreignKey':_0x7f11('0x201')});db[_0x7f11('0x10b')][_0x7f11('0x12e')](db[_0x7f11('0x105')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x1ff')});db['WhatsappQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x105')],{});db[_0x7f11('0x10d')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x10d')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['WhatsappQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x109')],{});db[_0x7f11('0x10d')][_0x7f11('0x12e')](db['WhatsappQueue'],{});db[_0x7f11('0x10d')]['belongsTo'](db[_0x7f11('0x10b')],{});db[_0x7f11('0x10d')]['belongsTo'](db[_0x7f11('0x12')],{});db[_0x7f11('0x203')][_0x7f11('0x12e')](db['WhatsappMessage'],{});db[_0x7f11('0x203')][_0x7f11('0x12e')](db[_0x7f11('0x109')],{});db['WhatsappTransferReport'][_0x7f11('0x12e')](db[_0x7f11('0x105')],{'foreignKey':_0x7f11('0x204'),'as':_0x7f11('0x1ed')});db[_0x7f11('0x203')][_0x7f11('0x12e')](db[_0x7f11('0x105')],{'foreignKey':_0x7f11('0x205'),'as':_0x7f11('0x1f1')});db['WhatsappTransferReport']['belongsTo'](db[_0x7f11('0x10f')],{'foreignKey':_0x7f11('0x206'),'as':_0x7f11('0x1eb')});db['WhatsappTransferReport'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':'FromUserId','as':_0x7f11('0x1e9')});db['WhatsappTransferReport'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1ea'),'as':_0x7f11('0x1ee')});db[_0x7f11('0x10f')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x3b'),'foreignKey':_0x7f11('0x207')});db[_0x7f11('0x10f')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x1e3'),'as':_0x7f11('0x175')});db[_0x7f11('0x11b')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x208'),'foreignKey':_0x7f11('0x11a'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db[_0x7f11('0x111')][_0x7f11('0x118')](db[_0x7f11('0xc9')],{'as':_0x7f11('0xc9'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x111')][_0x7f11('0x118')](db[_0x7f11('0x3d')],{'as':_0x7f11('0x16e'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x111')][_0x7f11('0x118')](db[_0x7f11('0x3f')],{'as':_0x7f11('0x16f'),'onDelete':_0x7f11('0x16d')});module[_0x7f11('0x209')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xaebd=['../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','cascade','UserId','hasOne','hasMany','Recordings','VoiceQueuesRt','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','UserVoiceQueue','MailQueues','ChatQueue','FaxQueue','SmsQueues','WhatsappQueues','ChatWebsites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','mailboxuser','mailbox','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','Messages','Interactions','List','ListId','Template','mandatoryDispositionPause','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','Tag','Tags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','MailApplication','TagId','MailQueueReport','DashboardItem','Items','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsApplication','sms_interaction_has_tags','ThroughTags','SmsInteractionId','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroupId','Members','CompanyId','Phones','CmContactId','HopperFinals','JscriptySessions','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','Queue','CampaignId','All','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Mohs','mail_interaction_has_tags','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerId','Fields','DefaultReportId','AnalyticMetric','MetricId','SalesforceConfiguration','AccountId','Subjects','SubjectId','Description','DescriptionId','Field','FieldId','Variable','VariableId','Descriptions','Subject','Configurations','int_desk_configuration_has_tags','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','VtigerField','ServicenowConfiguration','ServicenowAccount','Dynamics365Field','FreshsalesField','ToId','SessionId','ProjectId','TeamVoiceQueue','VoiceQueues','ChatQueues','OpenchannelQueues','team_has_whatsapp_queues','VoicePrefixes','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','HopperHistory','Queues','UserProfileSection','UserProfileSections','Resources','WhatsappAccountId','WhatsappAccount','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','sequelize','lodash','jstz','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../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','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaebd,0x105));var _0xdaeb=function(_0x5d6646,_0x13aa65){_0x5d6646=_0x5d6646-0x0;var _0x354f36=_0xaebd[_0x5d6646];return _0x354f36;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xdaeb('0x0'));var _=require(_0xdaeb('0x1'));var jstz=require(_0xdaeb('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0xdaeb('0x3')](config[_0xdaeb('0x0')],{'database':_0xdaeb('0x4'),'username':'xcall','password':_0xdaeb('0x5'),'options':{'host':_0xdaeb('0x6'),'port':0xcea,'dialect':_0xdaeb('0x7'),'dialectOptions':{'charset':_0xdaeb('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xdaeb('0x9'),'collate':_0xdaeb('0xa')}}});config[_0xdaeb('0xb')]=_[_0xdaeb('0x3')](config['sequelizeHistory'],{'database':_0xdaeb('0x4'),'username':_0xdaeb('0xc'),'password':_0xdaeb('0x5'),'options':{'host':_0xdaeb('0x6'),'port':0xcea,'dialect':_0xdaeb('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xdaeb('0x9'),'collate':_0xdaeb('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdaeb('0x0')][_0xdaeb('0xd')],config[_0xdaeb('0x0')][_0xdaeb('0xe')],config[_0xdaeb('0x0')][_0xdaeb('0xf')],config[_0xdaeb('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xdaeb('0xd')],config['sequelizeHistory'][_0xdaeb('0xe')],config[_0xdaeb('0xb')][_0xdaeb('0xf')],config['sequelizeHistory'][_0xdaeb('0x10')])};db[_0xdaeb('0x11')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x12'));db[_0xdaeb('0x13')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xdaeb('0x15')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x16'));db[_0xdaeb('0x17')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xdaeb('0x18')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x19'));db['VoiceQueue']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x1a'));db[_0xdaeb('0x1b')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x1c'));db['ScreenRecording']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x1d'));db[_0xdaeb('0x1e')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x1f'));db[_0xdaeb('0x20')]=db['sequelize']['import'](_0xdaeb('0x21'));db[_0xdaeb('0x22')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x23'));db[_0xdaeb('0x24')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xdaeb('0x25')]=db['sequelize']['import'](_0xdaeb('0x26'));db[_0xdaeb('0x27')]=db[_0xdaeb('0x0')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x28'));db[_0xdaeb('0x29')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x2a'));db[_0xdaeb('0x2b')]=db[_0xdaeb('0x0')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0xdaeb('0x2c')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x2d'));db[_0xdaeb('0x2e')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x2f'));db[_0xdaeb('0x30')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x31'));db[_0xdaeb('0x32')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x33'));db[_0xdaeb('0x34')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x35'));db[_0xdaeb('0x36')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x37'));db[_0xdaeb('0x38')]=db['sequelize'][_0xdaeb('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xdaeb('0x39')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x3a'));db[_0xdaeb('0x3b')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x3c'));db[_0xdaeb('0x3d')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x3e'));db[_0xdaeb('0x3f')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x40'));db[_0xdaeb('0x41')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x42'));db['MailInteraction']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x43'));db[_0xdaeb('0x44')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x45'));db['MailApplication']=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x46'));db['MailQueueReport']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x47'));db[_0xdaeb('0x48')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x49'));db['DashboardItem']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x4a'));db['FaxAccount']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x4b'));db[_0xdaeb('0x4c')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x4d'));db[_0xdaeb('0x4e')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x4f'));db[_0xdaeb('0x50')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x51'));db['FaxQueue']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x52'));db['FaxQueueReport']=db['sequelize']['import'](_0xdaeb('0x53'));db[_0xdaeb('0x54')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x55'));db['SmsApplication']=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x56'));db[_0xdaeb('0x57')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x58'));db['SmsMessage']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x59'));db[_0xdaeb('0x5a')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x5b'));db['OpenchannelAccount']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x5c'));db[_0xdaeb('0x5d')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x5e'));db[_0xdaeb('0x5f')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x60'));db[_0xdaeb('0x61')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0xdaeb('0x62')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x63'));db[_0xdaeb('0x64')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x65'));db[_0xdaeb('0x66')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x67'));db['ChatApplication']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x68'));db[_0xdaeb('0x69')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x6a'));db[_0xdaeb('0x6b')]=db['sequelize']['import'](_0xdaeb('0x6c'));db[_0xdaeb('0x6d')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x6e'));db['ChatQueue']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x6f'));db[_0xdaeb('0x70')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x71'));db[_0xdaeb('0x72')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x73'));db[_0xdaeb('0x74')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x75'));db[_0xdaeb('0x76')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x77'));db[_0xdaeb('0x78')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x79'));db[_0xdaeb('0x7a')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xdaeb('0x7b')]=db[_0xdaeb('0x0')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xdaeb('0x7c')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x7d'));db[_0xdaeb('0x7e')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x7f'));db[_0xdaeb('0x80')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x81'));db[_0xdaeb('0x82')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x83'));db[_0xdaeb('0x84')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x85'));db[_0xdaeb('0x86')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x87'));db[_0xdaeb('0x88')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/disposition/disposition.model');db[_0xdaeb('0x89')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x8a'));db['Interval']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x8b'));db['Pause']=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x8c'));db[_0xdaeb('0x8d')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/cdr/cdr.model');db[_0xdaeb('0x8e')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x8f'));db['Schedule']=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x90'));db[_0xdaeb('0x91')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x92'));db['Tag']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x93'));db['ContactItemType']=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/contactItemType/contactItemType.model');db[_0xdaeb('0x94')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x95'));db['CmHopperAdditionalPhone']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x96'));db['Template']=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/template/template.model');db[_0xdaeb('0x97')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x98'));db['Variable']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x99'));db['Integration']=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/integration/integration.model');db['IntegrationReport']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x9a'));db[_0xdaeb('0x9b')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x9c'));db[_0xdaeb('0x9d')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x9e'));db['AnalyticExtractedReport']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x9f'));db['AnalyticMetric']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xa0'));db[_0xdaeb('0xa1')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xa2'));db[_0xdaeb('0xa3')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xa4'));db[_0xdaeb('0xa5')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xa6'));db['SalesforceConfiguration']=db[_0xdaeb('0x0')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xdaeb('0xa7')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xa8'));db[_0xdaeb('0xa9')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xaa'));db[_0xdaeb('0xab')]=db['sequelize']['import'](_0xdaeb('0xac'));db[_0xdaeb('0xad')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xae'));db[_0xdaeb('0xaf')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xb0'));db[_0xdaeb('0xb1')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xdaeb('0xb2')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xb3'));db[_0xdaeb('0xb4')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xb5'));db[_0xdaeb('0xb6')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xb7'));db[_0xdaeb('0xb8')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xb9'));db[_0xdaeb('0xba')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xdaeb('0xbb')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xbc'));db[_0xdaeb('0xbd')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xbe'));db['FreshdeskAccount']=db['sequelize']['import'](_0xdaeb('0xbf'));db[_0xdaeb('0xc0')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xc1'));db['VtigerAccount']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xc2'));db['VtigerConfiguration']=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xc3'));db['ServicenowAccount']=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xc4'));db['ServicenowConfiguration']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xc5'));db[_0xdaeb('0xc6')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xc7'));db[_0xdaeb('0xc8')]=db['sequelize']['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0xdaeb('0xc9')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xca'));db[_0xdaeb('0xcb')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xcc'));db[_0xdaeb('0xcd')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xce'));db['FreshsalesField']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xcf'));db[_0xdaeb('0xd0')]=db['sequelize']['import'](_0xdaeb('0xd1'));db[_0xdaeb('0xd2')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xd3'));db[_0xdaeb('0xd4')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xd5'));db[_0xdaeb('0xd6')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xd7'));db[_0xdaeb('0xd8')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xd9'));db[_0xdaeb('0xda')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xdaeb('0xdb')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xdc'));db[_0xdaeb('0xdd')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xde'));db[_0xdaeb('0xdf')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xe0'));db['SquareDetailsReport']=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0xdaeb('0xe1')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0xdaeb('0xe2')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xe3'));db[_0xdaeb('0xe4')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xe5'));db[_0xdaeb('0xe6')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xe7'));db[_0xdaeb('0xe8')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xe9'));db[_0xdaeb('0xea')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xeb'));db[_0xdaeb('0xec')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xed'));db[_0xdaeb('0xee')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0xef'));db[_0xdaeb('0xf0')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xf1'));db[_0xdaeb('0xf2')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xf3'));db[_0xdaeb('0xf4')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xf5'));db['MailTransferReport']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xf6'));db[_0xdaeb('0xf7')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xf8'));db[_0xdaeb('0xf9')]=db[_0xdaeb('0x0')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xdaeb('0xfa')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xfb'));db[_0xdaeb('0xfc')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0xfd'));db[_0xdaeb('0xfe')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0xff'));db[_0xdaeb('0x100')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x101'));db[_0xdaeb('0x102')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x103'));db['UserProfileSection']=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x104'));db[_0xdaeb('0x105')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0xdaeb('0x106')]=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x107'));db['WhatsappAccount']=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x108'));db[_0xdaeb('0x109')]=db['sequelize']['import'](_0xdaeb('0x10a'));db[_0xdaeb('0x10b')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x10c'));db['WhatsappQueueReport']=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xdaeb('0x10d')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x10e'));db[_0xdaeb('0x10f')]=db[_0xdaeb('0x0')]['import'](_0xdaeb('0x110'));db[_0xdaeb('0x111')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x112'));db[_0xdaeb('0x113')]=db['sequelize'][_0xdaeb('0x14')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0xdaeb('0x114')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x115'));db[_0xdaeb('0x116')]=db[_0xdaeb('0x0')][_0xdaeb('0x14')](_0xdaeb('0x117'));db['MailInteractionHasTag']=db['sequelize'][_0xdaeb('0x14')](_0xdaeb('0x118'));db[_0xdaeb('0x11')]['hasOne'](db[_0xdaeb('0x1e')],{'as':_0xdaeb('0x1e'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x11')][_0xdaeb('0x11b')](db[_0xdaeb('0x116')],{'as':'userSetting','onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x11')][_0xdaeb('0x11c')](db[_0xdaeb('0x1b')],{'as':_0xdaeb('0x11d'),'foreignKey':'UserId'});db[_0xdaeb('0x11')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xdaeb('0x11e'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x11')][_0xdaeb('0x11c')](db[_0xdaeb('0x17')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0xdaeb('0x11')][_0xdaeb('0x11c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xdaeb('0x11a')});db['User'][_0xdaeb('0x11c')](db[_0xdaeb('0x7c')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xdaeb('0x11')][_0xdaeb('0x11c')](db[_0xdaeb('0x7e')],{'as':_0xdaeb('0x7e'),'foreignKey':_0xdaeb('0x11a')});db['User'][_0xdaeb('0x11c')](db[_0xdaeb('0x5f')],{'as':_0xdaeb('0x11f'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x11')]['hasMany'](db[_0xdaeb('0x69')],{'as':_0xdaeb('0x120'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x11')]['hasMany'](db[_0xdaeb('0x57')],{'as':'SmsInteractions','foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x11')]['hasMany'](db['FaxInteraction'],{'as':_0xdaeb('0x121'),'foreignKey':'UserId'});db['User'][_0xdaeb('0x11c')](db[_0xdaeb('0x122')],{'as':_0xdaeb('0x123'),'foreignKey':'UserId'});db[_0xdaeb('0x11')][_0xdaeb('0x11c')](db['WhatsappInteraction'],{'as':_0xdaeb('0x124'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x11')][_0xdaeb('0x11c')](db[_0xdaeb('0x106')],{'as':_0xdaeb('0x125'),'foreignKey':_0xdaeb('0x126')});db[_0xdaeb('0x11')][_0xdaeb('0x11c')](db[_0xdaeb('0x78')],{'as':_0xdaeb('0x127'),'foreignKey':_0xdaeb('0x11a'),'onDelete':'SET\x20NULL'});db[_0xdaeb('0x11')]['belongsTo'](db[_0xdaeb('0x102')],{'as':_0xdaeb('0x102'),'foreignKey':_0xdaeb('0x128')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db['ChatGroup'],{'as':_0xdaeb('0x12a'),'through':_0xdaeb('0x12b')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x12c'),'through':_0xdaeb('0x12d')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x12e'),'through':_0xdaeb('0x12f')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0xea')],{'through':_0xdaeb('0x130')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x122')],{'as':_0xdaeb('0x123'),'through':_0xdaeb('0x131')});db['User']['belongsToMany'](db[_0xdaeb('0x69')],{'as':_0xdaeb('0x120'),'through':_0xdaeb('0x132')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db['FaxInteraction'],{'as':_0xdaeb('0x121'),'through':'user_has_fax_interactions'});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x57')],{'as':_0xdaeb('0x133'),'through':_0xdaeb('0x134')});db['User']['belongsToMany'](db[_0xdaeb('0x5f')],{'as':_0xdaeb('0x11f'),'through':_0xdaeb('0x135')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db['WhatsappInteraction'],{'as':_0xdaeb('0x124'),'through':_0xdaeb('0x136')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x137')],{'as':'VoiceQueues','through':_0xdaeb('0x138'),'required':![]});db['User']['belongsToMany'](db[_0xdaeb('0x100')],{'as':'VoicePrefixes','through':_0xdaeb('0x114'),'required':![]});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x3f')],{'as':_0xdaeb('0x139'),'through':_0xdaeb('0x30'),'required':![]});db[_0xdaeb('0x11')]['belongsToMany'](db[_0xdaeb('0x13a')],{'as':'ChatQueues','through':_0xdaeb('0x2e'),'required':![],'hooks':!![]});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x13b')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x5a')],{'as':_0xdaeb('0x13c'),'through':'UserSmsQueue','required':![]});db['User'][_0xdaeb('0x129')](db[_0xdaeb('0x62')],{'as':'OpenchannelQueues','through':_0xdaeb('0x36'),'required':![]});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x10f')],{'as':_0xdaeb('0x13d'),'through':_0xdaeb('0x38'),'required':![]});db['User']['belongsToMany'](db[_0xdaeb('0xfe')],{'through':_0xdaeb('0x12f')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db['ChatWebsite'],{'as':_0xdaeb('0x13e'),'through':'user_has_chat_websites'});db['User'][_0xdaeb('0x129')](db[_0xdaeb('0x13f')],{'as':'FaxAccounts','through':_0xdaeb('0x140')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x3d')],{'as':_0xdaeb('0x141'),'through':_0xdaeb('0x142')});db[_0xdaeb('0x11')][_0xdaeb('0x129')](db[_0xdaeb('0x143')],{'as':'OpenchannelAccounts','through':_0xdaeb('0x144')});db[_0xdaeb('0x11')]['belongsToMany'](db[_0xdaeb('0x54')],{'as':'SmsAccounts','through':_0xdaeb('0x145')});db['User'][_0xdaeb('0x129')](db['WhatsappAccount'],{'as':_0xdaeb('0x146'),'through':_0xdaeb('0x147')});db[_0xdaeb('0x13')][_0xdaeb('0x11c')](db[_0xdaeb('0x17')],{'as':_0xdaeb('0x148'),'onDelete':'cascade','foreignKey':_0xdaeb('0x149')});db[_0xdaeb('0x15')][_0xdaeb('0x11c')](db[_0xdaeb('0x17')],{'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x17')]['hasMany'](db['VoiceExtension'],{'as':_0xdaeb('0x14a'),'onDelete':_0xdaeb('0x119')});db['VoiceMusicOnHold'][_0xdaeb('0x129')](db[_0xdaeb('0x91')],{'as':_0xdaeb('0x14b'),'through':_0xdaeb('0x14c')});db[_0xdaeb('0x137')][_0xdaeb('0x11c')](db[_0xdaeb('0x2c')],{'as':'Members','foreignKey':_0xdaeb('0x14d')});db[_0xdaeb('0x137')][_0xdaeb('0x11c')](db[_0xdaeb('0x78')],{'as':_0xdaeb('0x127'),'foreignKey':_0xdaeb('0x14d')});db[_0xdaeb('0x137')][_0xdaeb('0x11c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xdaeb('0x14d')});db[_0xdaeb('0x137')][_0xdaeb('0x11c')](db[_0xdaeb('0x7c')],{'as':_0xdaeb('0x14e'),'foreignKey':_0xdaeb('0x14d')});db[_0xdaeb('0x137')][_0xdaeb('0x11c')](db[_0xdaeb('0x7e')],{'as':_0xdaeb('0x7e'),'foreignKey':_0xdaeb('0x14d')});db[_0xdaeb('0x137')][_0xdaeb('0x11c')](db[_0xdaeb('0x7a')],{'as':_0xdaeb('0x14f'),'foreignKey':_0xdaeb('0x14d')});db[_0xdaeb('0x137')][_0xdaeb('0x11c')](db[_0xdaeb('0xdb')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xdaeb('0x150')](db[_0xdaeb('0x29')],{'as':_0xdaeb('0x29'),'foreignKey':_0xdaeb('0x151')});db[_0xdaeb('0x137')][_0xdaeb('0x150')](db[_0xdaeb('0x29')],{'as':_0xdaeb('0x152'),'foreignKey':_0xdaeb('0x153')});db[_0xdaeb('0x137')][_0xdaeb('0x150')](db['Interval'],{'as':_0xdaeb('0x154'),'foreignKey':_0xdaeb('0x155')});db[_0xdaeb('0x137')][_0xdaeb('0x150')](db[_0xdaeb('0x156')],{'as':'mandatoryDispositionPause','foreignKey':_0xdaeb('0x157')});db['VoiceQueue']['belongsToMany'](db[_0xdaeb('0xfe')],{'as':'Lists','through':_0xdaeb('0x158')});db['VoiceQueue'][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x138')});db[_0xdaeb('0x137')]['belongsToMany'](db[_0xdaeb('0xea')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0xdaeb('0x137')][_0xdaeb('0x129')](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x15a'),'through':'voice_queues_has_cm_blacklists'});db[_0xdaeb('0x1b')]['belongsTo'](db['User'],{'as':_0xdaeb('0x11'),'foreignKey':_0xdaeb('0x11a')});db['ScreenRecording'][_0xdaeb('0x150')](db['User'],{'as':_0xdaeb('0x11'),'foreignKey':_0xdaeb('0x11a')});db['VoiceMail'][_0xdaeb('0x11c')](db[_0xdaeb('0x20')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xdaeb('0x15b'),'sourceKey':_0xdaeb('0x15c')});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0xdaeb('0x15b'),'targetKey':_0xdaeb('0x15c')});db[_0xdaeb('0x22')][_0xdaeb('0x11c')](db[_0xdaeb('0x27')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xdaeb('0x22')][_0xdaeb('0x11c')](db[_0xdaeb('0x25')],{'as':'AgentReports','foreignKey':_0xdaeb('0x15d'),'constraints':![]});db['VoiceCallReport'][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x11'),'foreignKey':_0xdaeb('0x11a')});db['VoiceCallReport'][_0xdaeb('0x150')](db['CmContact'],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x39')]['belongsTo'](db[_0xdaeb('0x3d')],{'as':_0xdaeb('0x3d'),'foreignKey':_0xdaeb('0x160')});db[_0xdaeb('0x39')][_0xdaeb('0x150')](db[_0xdaeb('0x111')],{'as':_0xdaeb('0x111'),'foreignKey':_0xdaeb('0x161'),'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x3b')][_0xdaeb('0x150')](db[_0xdaeb('0x3d')],{'as':_0xdaeb('0x3d'),'foreignKey':'MailAccountId'});db[_0xdaeb('0x3b')]['belongsTo'](db[_0xdaeb('0x111')],{'as':'CloudProvider','foreignKey':_0xdaeb('0x161'),'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x3d')][_0xdaeb('0x11b')](db[_0xdaeb('0x39')],{'as':_0xdaeb('0x163'),'onDelete':'cascade'});db[_0xdaeb('0x3d')][_0xdaeb('0x11b')](db['MailServerOut'],{'as':_0xdaeb('0x164'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x3d')][_0xdaeb('0x11c')](db[_0xdaeb('0x88')],{'as':'Dispositions','foreignKey':_0xdaeb('0x160'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x3d')][_0xdaeb('0x11c')](db[_0xdaeb('0x86')],{'as':_0xdaeb('0x165'),'foreignKey':_0xdaeb('0x160')});db[_0xdaeb('0x3d')]['hasMany'](db[_0xdaeb('0x44')],{'as':_0xdaeb('0x166'),'foreignKey':_0xdaeb('0x160')});db[_0xdaeb('0x3d')][_0xdaeb('0x11c')](db[_0xdaeb('0x122')],{'as':_0xdaeb('0x167')});db['MailAccount'][_0xdaeb('0x11c')](db['MailApplication'],{'as':_0xdaeb('0x14a'),'foreignKey':_0xdaeb('0x160'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x3d')]['belongsTo'](db['CmList'],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169')});db['MailAccount'][_0xdaeb('0x150')](db['Template'],{'as':_0xdaeb('0x16a'),'foreignKey':'TemplateId'});db[_0xdaeb('0x3d')]['belongsTo'](db['Pause'],{'as':_0xdaeb('0x16b'),'foreignKey':_0xdaeb('0x157')});db['MailAccount'][_0xdaeb('0x129')](db['User'],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x142')});db[_0xdaeb('0x3f')]['belongsToMany'](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x30')});db[_0xdaeb('0x3f')]['belongsToMany'](db[_0xdaeb('0xea')],{'through':_0xdaeb('0x16c'),'as':_0xdaeb('0x16d')});db[_0xdaeb('0x122')][_0xdaeb('0x11c')](db[_0xdaeb('0x44')],{'as':_0xdaeb('0x166'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x16e')});db[_0xdaeb('0x122')][_0xdaeb('0x150')](db[_0xdaeb('0x3d')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x160')});db['MailInteraction']['belongsTo'](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x122')][_0xdaeb('0x150')](db['User'],{'as':_0xdaeb('0x170'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x122')][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'through':'mail_interaction_has_tags','as':_0xdaeb('0x172')});db['MailInteraction'][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db['MailInteraction'][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x173'),'through':_0xdaeb('0x131'),'foreignKey':_0xdaeb('0x16e')});db[_0xdaeb('0x44')][_0xdaeb('0x11c')](db[_0xdaeb('0xf2')],{'as':_0xdaeb('0x174'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x44')]['belongsTo'](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x11')});db[_0xdaeb('0x44')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'onDelete':_0xdaeb('0x119'),'as':'Contact'});db[_0xdaeb('0x44')][_0xdaeb('0x150')](db[_0xdaeb('0x122')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xdaeb('0x44')][_0xdaeb('0x150')](db[_0xdaeb('0x3d')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x160')});db['MailMessage'][_0xdaeb('0x150')](db['ChatWebsite'],{'as':_0xdaeb('0x64'),'foreignKey':_0xdaeb('0x175')});db[_0xdaeb('0x44')][_0xdaeb('0x150')](db[_0xdaeb('0x6d')],{'as':_0xdaeb('0x6d'),'foreignKey':_0xdaeb('0x176')});db['MailApplication'][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x177')]['belongsTo'](db['MailQueue'],{'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x177')]['belongsTo'](db[_0xdaeb('0x3d')],{'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x177')]['belongsTo'](db[_0xdaeb('0x154')],{'onDelete':_0xdaeb('0x162'),'foreignKey':_0xdaeb('0x155')});db['MailApplication'][_0xdaeb('0x150')](db[_0xdaeb('0x171')],{'onDelete':_0xdaeb('0x162'),'foreignKey':_0xdaeb('0x178')});db[_0xdaeb('0x179')][_0xdaeb('0x150')](db['MailAccount'],{});db[_0xdaeb('0x179')]['belongsTo'](db[_0xdaeb('0xfe')],{'as':'List','foreignKey':'ListId'});db[_0xdaeb('0x179')][_0xdaeb('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x179')]['belongsTo'](db[_0xdaeb('0x122')],{});db[_0xdaeb('0x179')][_0xdaeb('0x150')](db['MailMessage'],{});db['MailQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{});db[_0xdaeb('0x179')][_0xdaeb('0x150')](db[_0xdaeb('0x3f')],{});db[_0xdaeb('0x48')][_0xdaeb('0x11c')](db[_0xdaeb('0x17a')],{'as':_0xdaeb('0x17b'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x13f')][_0xdaeb('0x11c')](db[_0xdaeb('0x88')],{'as':_0xdaeb('0x17c'),'foreignKey':'FaxAccountId','onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x13f')]['hasMany'](db[_0xdaeb('0x86')],{'as':_0xdaeb('0x165'),'foreignKey':_0xdaeb('0x17d')});db[_0xdaeb('0x13f')][_0xdaeb('0x11c')](db[_0xdaeb('0x4e')],{'as':_0xdaeb('0x167')});db[_0xdaeb('0x13f')][_0xdaeb('0x11c')](db[_0xdaeb('0x4c')],{'as':_0xdaeb('0x14a'),'foreignKey':_0xdaeb('0x17d'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x13f')][_0xdaeb('0x11c')](db[_0xdaeb('0x17')],{'as':_0xdaeb('0x17e'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x13f')][_0xdaeb('0x11c')](db[_0xdaeb('0x50')],{'as':_0xdaeb('0x166')});db[_0xdaeb('0x13f')][_0xdaeb('0x150')](db[_0xdaeb('0x29')],{'as':_0xdaeb('0x29')});db[_0xdaeb('0x13f')][_0xdaeb('0x150')](db[_0xdaeb('0xfe')],{'as':'List','foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0x13f')]['belongsTo'](db[_0xdaeb('0x156')],{'as':_0xdaeb('0x16b'),'foreignKey':_0xdaeb('0x157')});db[_0xdaeb('0x13f')][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':'Agents','through':_0xdaeb('0x140')});db[_0xdaeb('0x4c')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'onDelete':_0xdaeb('0x162')});db['FaxApplication'][_0xdaeb('0x150')](db[_0xdaeb('0x13b')],{'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x4c')]['belongsTo'](db[_0xdaeb('0x13f')],{'onDelete':_0xdaeb('0x162')});db['FaxApplication'][_0xdaeb('0x150')](db[_0xdaeb('0x171')],{'onDelete':'restrict','foreignKey':_0xdaeb('0x178')});db[_0xdaeb('0x4e')][_0xdaeb('0x11c')](db[_0xdaeb('0x50')],{'as':_0xdaeb('0x166'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x17f')});db[_0xdaeb('0x4e')]['belongsTo'](db[_0xdaeb('0x13f')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x17d')});db[_0xdaeb('0x4e')]['belongsTo'](db['CmContact'],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x4e')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x170'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x4e')][_0xdaeb('0x129')](db['Tag'],{'through':_0xdaeb('0x180'),'as':_0xdaeb('0x172')});db[_0xdaeb('0x4e')][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xdaeb('0x4e')][_0xdaeb('0x129')](db['User'],{'as':_0xdaeb('0x173'),'through':_0xdaeb('0x181'),'foreignKey':'FaxInteractionId'});db[_0xdaeb('0x50')][_0xdaeb('0x150')](db['User'],{'onDelete':_0xdaeb('0x119'),'as':_0xdaeb('0x11')});db[_0xdaeb('0x50')]['belongsTo'](db[_0xdaeb('0x4e')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xdaeb('0x50')]['belongsTo'](db[_0xdaeb('0x76')],{'onDelete':_0xdaeb('0x119'),'as':_0xdaeb('0x15e')});db[_0xdaeb('0x50')][_0xdaeb('0x150')](db[_0xdaeb('0xf2')],{'as':_0xdaeb('0xf2'),'foreignKey':_0xdaeb('0x182')});db['FaxMessage'][_0xdaeb('0x150')](db['FaxAccount'],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x17d')});db[_0xdaeb('0x13b')][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x32')});db['FaxQueue'][_0xdaeb('0x129')](db[_0xdaeb('0xea')],{'through':_0xdaeb('0x183'),'as':_0xdaeb('0x16d')});db[_0xdaeb('0x184')][_0xdaeb('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x168'),'foreignKey':'ListId'});db['FaxQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db['FaxQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x4e')],{});db[_0xdaeb('0x184')]['belongsTo'](db[_0xdaeb('0x50')],{});db[_0xdaeb('0x184')][_0xdaeb('0x150')](db['User'],{});db[_0xdaeb('0x184')]['belongsTo'](db[_0xdaeb('0x13b')],{});db[_0xdaeb('0x54')][_0xdaeb('0x11c')](db[_0xdaeb('0x88')],{'as':_0xdaeb('0x17c'),'foreignKey':_0xdaeb('0x185'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x54')][_0xdaeb('0x11c')](db['CannedAnswer'],{'as':_0xdaeb('0x165'),'foreignKey':_0xdaeb('0x185')});db[_0xdaeb('0x54')]['hasMany'](db[_0xdaeb('0x186')],{'as':_0xdaeb('0x166'),'foreignKey':'SmsAccountId'});db[_0xdaeb('0x54')][_0xdaeb('0x11c')](db[_0xdaeb('0x57')],{'as':_0xdaeb('0x167')});db['SmsAccount'][_0xdaeb('0x11c')](db[_0xdaeb('0x187')],{'as':_0xdaeb('0x14a'),'foreignKey':_0xdaeb('0x185'),'onDelete':'cascade'});db['SmsAccount'][_0xdaeb('0x150')](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0x54')][_0xdaeb('0x150')](db[_0xdaeb('0x156')],{'as':_0xdaeb('0x16b'),'foreignKey':_0xdaeb('0x157')});db['SmsAccount'][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':'user_has_sms_accounts'});db['SmsApplication']['belongsTo'](db[_0xdaeb('0x11')],{'onDelete':_0xdaeb('0x162')});db['SmsApplication'][_0xdaeb('0x150')](db[_0xdaeb('0x5a')],{'onDelete':_0xdaeb('0x162')});db['SmsApplication'][_0xdaeb('0x150')](db[_0xdaeb('0x54')],{'onDelete':_0xdaeb('0x162')});db['SmsApplication'][_0xdaeb('0x150')](db['Interval'],{'onDelete':_0xdaeb('0x162'),'foreignKey':_0xdaeb('0x155')});db[_0xdaeb('0x187')][_0xdaeb('0x150')](db[_0xdaeb('0x171')],{'onDelete':'restrict','foreignKey':_0xdaeb('0x178')});db['SmsInteraction']['hasMany'](db[_0xdaeb('0x186')],{'as':_0xdaeb('0x166'),'onDelete':_0xdaeb('0x119'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0xdaeb('0x150')](db[_0xdaeb('0x54')],{'as':'Account','foreignKey':_0xdaeb('0x185')});db[_0xdaeb('0x57')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':'Contact','foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x57')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x170'),'foreignKey':'UserId'});db[_0xdaeb('0x57')][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'through':_0xdaeb('0x188'),'as':'Tags'});db[_0xdaeb('0x57')]['belongsToMany'](db[_0xdaeb('0x171')],{'through':_0xdaeb('0x188'),'as':_0xdaeb('0x189')});db[_0xdaeb('0x57')][_0xdaeb('0x129')](db['User'],{'as':_0xdaeb('0x173'),'through':_0xdaeb('0x134'),'foreignKey':_0xdaeb('0x18a')});db[_0xdaeb('0x186')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x11')});db[_0xdaeb('0x186')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'onDelete':'cascade','as':_0xdaeb('0x15e')});db[_0xdaeb('0x186')][_0xdaeb('0x150')](db[_0xdaeb('0x57')],{'onDelete':_0xdaeb('0x119'),'as':_0xdaeb('0x18b'),'foreignKey':'SmsInteractionId'});db[_0xdaeb('0x186')][_0xdaeb('0x150')](db[_0xdaeb('0x54')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x185')});db[_0xdaeb('0x5a')][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':'UserSmsQueue','foreignKey':_0xdaeb('0x18c')});db[_0xdaeb('0x5a')][_0xdaeb('0x129')](db[_0xdaeb('0xea')],{'through':_0xdaeb('0x18d'),'as':'Teams'});db[_0xdaeb('0x143')][_0xdaeb('0x11c')](db[_0xdaeb('0x88')],{'as':'Dispositions','foreignKey':_0xdaeb('0x18e'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x143')][_0xdaeb('0x11c')](db[_0xdaeb('0x86')],{'as':_0xdaeb('0x165'),'foreignKey':_0xdaeb('0x18e')});db[_0xdaeb('0x143')]['hasMany'](db[_0xdaeb('0x5f')],{'as':_0xdaeb('0x167'),'foreignKey':_0xdaeb('0x18e')});db[_0xdaeb('0x143')][_0xdaeb('0x11c')](db[_0xdaeb('0x61')],{'as':'Messages','foreignKey':_0xdaeb('0x18e')});db[_0xdaeb('0x143')]['hasMany'](db['OpenchannelApplication'],{'as':_0xdaeb('0x14a'),'foreignKey':_0xdaeb('0x18e'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x143')]['belongsTo'](db['CmList'],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0x143')]['belongsTo'](db[_0xdaeb('0x156')],{'as':_0xdaeb('0x16b'),'foreignKey':_0xdaeb('0x157')});db[_0xdaeb('0x143')]['belongsToMany'](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':'user_has_openchannel_accounts'});db[_0xdaeb('0x5d')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x5d')]['belongsTo'](db[_0xdaeb('0x62')],{'onDelete':_0xdaeb('0x162'),'foreignKey':_0xdaeb('0x18f')});db[_0xdaeb('0x5d')][_0xdaeb('0x150')](db[_0xdaeb('0x143')],{'onDelete':_0xdaeb('0x162'),'foreignKey':_0xdaeb('0x18e')});db[_0xdaeb('0x5d')][_0xdaeb('0x150')](db[_0xdaeb('0x154')],{'onDelete':'restrict','foreignKey':_0xdaeb('0x155')});db[_0xdaeb('0x5d')]['belongsTo'](db[_0xdaeb('0x171')],{'onDelete':_0xdaeb('0x162'),'foreignKey':_0xdaeb('0x178')});db['OpenchannelInteraction'][_0xdaeb('0x11c')](db[_0xdaeb('0x61')],{'as':_0xdaeb('0x166'),'onDelete':_0xdaeb('0x119'),'foreignKey':'OpenchannelInteractionId'});db[_0xdaeb('0x5f')][_0xdaeb('0x150')](db[_0xdaeb('0x143')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x18e')});db[_0xdaeb('0x5f')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db['OpenchannelInteraction'][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x170'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x5f')]['belongsToMany'](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xdaeb('0x172')});db[_0xdaeb('0x5f')][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'through':_0xdaeb('0x190'),'as':_0xdaeb('0x189')});db[_0xdaeb('0x5f')]['belongsToMany'](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x173'),'through':_0xdaeb('0x135'),'foreignKey':_0xdaeb('0x191')});db[_0xdaeb('0x61')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'onDelete':'cascade','as':_0xdaeb('0x11')});db['OpenchannelMessage']['belongsTo'](db[_0xdaeb('0x76')],{'onDelete':_0xdaeb('0x119'),'as':_0xdaeb('0x15e')});db[_0xdaeb('0x61')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0xdaeb('0x119'),'as':_0xdaeb('0x18b'),'foreignKey':_0xdaeb('0x191')});db[_0xdaeb('0x61')][_0xdaeb('0x150')](db[_0xdaeb('0xf2')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xdaeb('0x61')]['belongsTo'](db[_0xdaeb('0x143')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x18e')});db[_0xdaeb('0x62')]['belongsToMany'](db[_0xdaeb('0x11')],{'as':'Agents','through':_0xdaeb('0x36'),'foreignKey':_0xdaeb('0x18f')});db[_0xdaeb('0x62')][_0xdaeb('0x129')](db[_0xdaeb('0xea')],{'through':_0xdaeb('0x192'),'as':'Teams'});db[_0xdaeb('0x64')][_0xdaeb('0x11c')](db[_0xdaeb('0x88')],{'as':_0xdaeb('0x17c'),'foreignKey':'ChatWebsiteId','onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x64')]['hasMany'](db[_0xdaeb('0x86')],{'as':_0xdaeb('0x165'),'foreignKey':_0xdaeb('0x175')});db[_0xdaeb('0x64')]['hasMany'](db[_0xdaeb('0x72')],{'as':_0xdaeb('0x193')});db[_0xdaeb('0x64')][_0xdaeb('0x11c')](db[_0xdaeb('0x69')],{'as':'Interactions'});db[_0xdaeb('0x64')][_0xdaeb('0x11c')](db[_0xdaeb('0x194')],{'as':_0xdaeb('0x14a'),'foreignKey':_0xdaeb('0x175'),'onDelete':'cascade'});db[_0xdaeb('0x64')][_0xdaeb('0x11c')](db['ChatMessage'],{'as':'Messages'});db[_0xdaeb('0x64')][_0xdaeb('0x150')](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0x64')]['belongsTo'](db['Interval'],{'as':_0xdaeb('0x154'),'foreignKey':_0xdaeb('0x155')});db[_0xdaeb('0x64')][_0xdaeb('0x150')](db[_0xdaeb('0x3d')],{'as':_0xdaeb('0x3d'),'foreignKey':'MailAccountId'});db[_0xdaeb('0x64')][_0xdaeb('0x150')](db[_0xdaeb('0x156')],{'as':_0xdaeb('0x16b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdaeb('0x64')][_0xdaeb('0x129')](db['User'],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x195')});db[_0xdaeb('0x66')][_0xdaeb('0x150')](db[_0xdaeb('0x143')],{});db['OpenchannelQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169')});db['OpenchannelQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':'ContactId'});db[_0xdaeb('0x66')][_0xdaeb('0x150')](db[_0xdaeb('0x5f')],{});db['OpenchannelQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x61')],{});db[_0xdaeb('0x66')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{});db['OpenchannelQueueReport'][_0xdaeb('0x150')](db['OpenchannelQueue'],{});db[_0xdaeb('0x194')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x196'),'foreignKey':'UserId','onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x194')][_0xdaeb('0x150')](db['ChatQueue'],{'as':'Queue','foreignKey':_0xdaeb('0x197'),'onDelete':'restrict'});db['ChatApplication'][_0xdaeb('0x150')](db[_0xdaeb('0x64')],{'as':_0xdaeb('0x198'),'foreignKey':_0xdaeb('0x175'),'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x194')][_0xdaeb('0x150')](db[_0xdaeb('0x171')],{'onDelete':_0xdaeb('0x162'),'foreignKey':_0xdaeb('0x178')});db[_0xdaeb('0x69')]['hasMany'](db['ChatMessage'],{'as':_0xdaeb('0x166'),'onDelete':_0xdaeb('0x119'),'foreignKey':'ChatInteractionId'});db[_0xdaeb('0x69')]['belongsTo'](db['ChatWebsite'],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x175')});db[_0xdaeb('0x69')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db['ChatInteraction'][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x170'),'foreignKey':'UserId'});db[_0xdaeb('0x69')][_0xdaeb('0x129')](db['Tag'],{'through':_0xdaeb('0x199'),'as':_0xdaeb('0x172')});db['ChatInteraction'][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'through':_0xdaeb('0x199'),'as':_0xdaeb('0x189')});db['ChatInteraction'][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x173'),'through':_0xdaeb('0x132'),'foreignKey':_0xdaeb('0x19a')});db[_0xdaeb('0x6b')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'onDelete':_0xdaeb('0x119'),'as':'User'});db[_0xdaeb('0x6b')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'onDelete':_0xdaeb('0x119'),'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x6b')][_0xdaeb('0x150')](db['ChatInteraction'],{'onDelete':_0xdaeb('0x119'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0xdaeb('0x6b')][_0xdaeb('0x150')](db[_0xdaeb('0xf2')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xdaeb('0x6b')][_0xdaeb('0x150')](db[_0xdaeb('0x64')],{'as':'Account','foreignKey':_0xdaeb('0x175')});db[_0xdaeb('0x6d')][_0xdaeb('0x11c')](db[_0xdaeb('0xf2')],{'as':_0xdaeb('0x174'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xdaeb('0x119'),'hooks':!![]});db[_0xdaeb('0x6d')][_0xdaeb('0x150')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0xdaeb('0x6d')][_0xdaeb('0x150')](db[_0xdaeb('0x64')],{'as':'Account','foreignKey':_0xdaeb('0x175')});db['ChatQueue'][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x2e'),'hooks':!![]});db[_0xdaeb('0x13a')][_0xdaeb('0x129')](db[_0xdaeb('0xea')],{'through':'team_has_chat_queues','as':_0xdaeb('0x16d')});db[_0xdaeb('0x70')]['hasMany'](db[_0xdaeb('0xd6')],{'as':'Messages','foreignKey':_0xdaeb('0x19b'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x70')][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x19c'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0xdaeb('0x150')](db[_0xdaeb('0x64')],{'as':_0xdaeb('0x198'),'foreignKey':_0xdaeb('0x175')});db[_0xdaeb('0x74')][_0xdaeb('0x11c')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x12c'),'foreignKey':_0xdaeb('0x19d')});db[_0xdaeb('0x76')][_0xdaeb('0x11c')](db['CmContactHasItem'],{'as':_0xdaeb('0x19e'),'foreignKey':_0xdaeb('0x19f')});db[_0xdaeb('0x76')]['hasMany'](db['CmHopper'],{'as':_0xdaeb('0x127'),'foreignKey':'ContactId'});db[_0xdaeb('0x76')][_0xdaeb('0x11c')](db[_0xdaeb('0x7b')],{'as':_0xdaeb('0x1a0'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x76')]['hasMany'](db[_0xdaeb('0x7c')],{'as':_0xdaeb('0x14e'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x76')][_0xdaeb('0x11c')](db['ReportAgentPreview'],{'as':_0xdaeb('0x7e'),'foreignKey':'ContactId'});db['CmContact'][_0xdaeb('0x11c')](db[_0xdaeb('0xdb')],{'as':_0xdaeb('0x1a1'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x76')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xdaeb('0x11f'),'foreignKey':_0xdaeb('0x15f'),'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x76')]['hasMany'](db['ChatInteraction'],{'as':_0xdaeb('0x120'),'foreignKey':_0xdaeb('0x15f'),'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x76')][_0xdaeb('0x11c')](db[_0xdaeb('0x57')],{'as':_0xdaeb('0x133'),'foreignKey':_0xdaeb('0x15f'),'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x76')][_0xdaeb('0x11c')](db[_0xdaeb('0x4e')],{'as':_0xdaeb('0x121'),'foreignKey':_0xdaeb('0x15f'),'onDelete':'restrict'});db[_0xdaeb('0x76')][_0xdaeb('0x11c')](db[_0xdaeb('0x122')],{'as':_0xdaeb('0x123'),'foreignKey':_0xdaeb('0x15f'),'onDelete':_0xdaeb('0x162')});db['CmContact'][_0xdaeb('0x150')](db[_0xdaeb('0x74')],{'as':_0xdaeb('0x1a2'),'foreignKey':_0xdaeb('0x19d')});db[_0xdaeb('0x76')]['belongsTo'](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x76')][_0xdaeb('0x129')](db['User'],{'as':_0xdaeb('0x173'),'through':_0xdaeb('0x12d')});db[_0xdaeb('0x76')][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'as':_0xdaeb('0x172'),'through':_0xdaeb('0x1a3')});db[_0xdaeb('0x76')][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'through':_0xdaeb('0x1a3'),'as':_0xdaeb('0x189')});db['CmHopper']['hasMany'](db[_0xdaeb('0x1a4')],{'as':_0xdaeb('0x1a5'),'foreignKey':'CmHopperId'});db[_0xdaeb('0x78')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x78')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x196'),'foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x78')]['belongsTo'](db[_0xdaeb('0x137')],{'as':_0xdaeb('0x1a6'),'foreignKey':_0xdaeb('0x14d'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x78')][_0xdaeb('0x150')](db['Campaign'],{'as':_0xdaeb('0xee'),'foreignKey':_0xdaeb('0x1a7'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x78')]['belongsTo'](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x170'),'foreignKey':'OwnerId'});db[_0xdaeb('0x7a')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':'ContactId','onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x7a')][_0xdaeb('0x150')](db['CmList'],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169'),'onDelete':'cascade'});db[_0xdaeb('0x7a')][_0xdaeb('0x150')](db[_0xdaeb('0x137')],{'as':_0xdaeb('0x1a6'),'foreignKey':_0xdaeb('0x14d'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x7a')][_0xdaeb('0x150')](db[_0xdaeb('0xee')],{'as':_0xdaeb('0xee'),'foreignKey':'CampaignId','onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x84')][_0xdaeb('0x11c')](db[_0xdaeb('0x89')],{'as':{'plural':_0xdaeb('0x1a8'),'singular':'OneAll'},'foreignKey':_0xdaeb('0x1a9'),'onDelete':_0xdaeb('0x119'),'hooks':!![]});db[_0xdaeb('0x84')][_0xdaeb('0x11c')](db[_0xdaeb('0x89')],{'as':{'plural':_0xdaeb('0x1aa'),'singular':'OneAny'},'foreignKey':_0xdaeb('0x1ab'),'onDelete':_0xdaeb('0x119'),'hooks':!![]});db[_0xdaeb('0x84')][_0xdaeb('0x11c')](db[_0xdaeb('0x82')],{'as':_0xdaeb('0x1ac'),'foreignKey':_0xdaeb('0x1ad'),'onDelete':_0xdaeb('0x119'),'hooks':!![]});db[_0xdaeb('0x88')][_0xdaeb('0x11c')](db['Disposition'],{'as':_0xdaeb('0x17c'),'foreignKey':_0xdaeb('0x1ae'),'onDelete':'cascade'});db[_0xdaeb('0x154')][_0xdaeb('0x11c')](db[_0xdaeb('0x154')],{'as':_0xdaeb('0x1af'),'foreignKey':'IntervalId','onDelete':_0xdaeb('0x119'),'hooks':!![],'required':![]});db[_0xdaeb('0x154')]['hasMany'](db[_0xdaeb('0x17')],{'as':'Extensions','foreignKey':_0xdaeb('0x155'),'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x154')][_0xdaeb('0x11c')](db[_0xdaeb('0x177')],{'as':_0xdaeb('0x1b0'),'foreignKey':_0xdaeb('0x155')});db[_0xdaeb('0x154')][_0xdaeb('0x11c')](db[_0xdaeb('0x194')],{'as':_0xdaeb('0x1b1'),'foreignKey':_0xdaeb('0x155')});db[_0xdaeb('0x154')]['hasMany'](db[_0xdaeb('0x4c')],{'as':_0xdaeb('0x1b2'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db['SmsApplication'],{'as':_0xdaeb('0x1b3'),'foreignKey':_0xdaeb('0x155')});db['Schedule'][_0xdaeb('0x150')](db[_0xdaeb('0x3d')],{});db['Schedule']['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0xdaeb('0x1b4')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0xdaeb('0x1b5')});db[_0xdaeb('0x91')]['belongsToMany'](db[_0xdaeb('0x18')],{'as':_0xdaeb('0x1b6'),'through':'moh_has_sounds','onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x171')][_0xdaeb('0x129')](db[_0xdaeb('0x76')],{'through':_0xdaeb('0x1a3')});db[_0xdaeb('0x171')]['belongsToMany'](db['ChatInteraction'],{'through':_0xdaeb('0x199')});db[_0xdaeb('0x171')]['belongsToMany'](db[_0xdaeb('0x122')],{'through':_0xdaeb('0x1b7')});db[_0xdaeb('0x171')]['belongsToMany'](db[_0xdaeb('0x57')],{'through':'sms_interaction_has_tags'});db[_0xdaeb('0x171')][_0xdaeb('0x129')](db['FaxInteraction'],{'through':_0xdaeb('0x180')});db[_0xdaeb('0x171')][_0xdaeb('0x129')](db['OpenchannelInteraction'],{'through':_0xdaeb('0x190')});db['Tag'][_0xdaeb('0x129')](db[_0xdaeb('0x109')],{'through':_0xdaeb('0x1b8')});db[_0xdaeb('0x94')]['belongsTo'](db[_0xdaeb('0x1b9')],{'as':_0xdaeb('0x1ba'),'foreignKey':_0xdaeb('0x1bb')});db[_0xdaeb('0x1a4')][_0xdaeb('0x150')](db[_0xdaeb('0x78')],{'as':_0xdaeb('0x1bc'),'foreignKey':'CmHopperId'});db[_0xdaeb('0x94')]['belongsTo'](db['CmContact'],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x19f')});db[_0xdaeb('0x97')][_0xdaeb('0x11c')](db[_0xdaeb('0x89')],{'as':{'plural':_0xdaeb('0x1bd'),'singular':_0xdaeb('0x1be')},'foreignKey':_0xdaeb('0x1bf'),'onDelete':_0xdaeb('0x119'),'hooks':!![]});db[_0xdaeb('0x97')]['hasMany'](db['Condition'],{'as':{'plural':_0xdaeb('0x1c0'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0xdaeb('0x119'),'hooks':!![]});db['Trigger'][_0xdaeb('0x11c')](db['Action'],{'as':_0xdaeb('0x1ac'),'foreignKey':_0xdaeb('0x1c1'),'onDelete':'cascade','hooks':!![]});db[_0xdaeb('0x9b')][_0xdaeb('0x11c')](db[_0xdaeb('0xa1')],{'as':_0xdaeb('0x1c2'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1b5'),'hooks':!![]});db[_0xdaeb('0x9d')]['hasMany'](db[_0xdaeb('0xa1')],{'as':_0xdaeb('0x1c2'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c3')});db[_0xdaeb('0x1c4')][_0xdaeb('0x11c')](db[_0xdaeb('0xa1')],{'as':_0xdaeb('0x1c2'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c5')});db[_0xdaeb('0xa1')]['belongsTo'](db[_0xdaeb('0x1c4')],{'foreignKey':_0xdaeb('0x1c5')});db[_0xdaeb('0xa5')][_0xdaeb('0x11c')](db[_0xdaeb('0x1c6')],{'as':'Configurations','onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0x1c6')][_0xdaeb('0x11c')](db[_0xdaeb('0xa7')],{'as':_0xdaeb('0x1c8'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c9')});db['SalesforceConfiguration'][_0xdaeb('0x11c')](db[_0xdaeb('0xa7')],{'as':'Descriptions','onDelete':_0xdaeb('0x119'),'foreignKey':'DescriptionId'});db[_0xdaeb('0x1c6')][_0xdaeb('0x11c')](db['SalesforceField'],{'as':_0xdaeb('0x1c2'),'onDelete':_0xdaeb('0x119'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0xdaeb('0x150')](db[_0xdaeb('0xa5')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0xa7')][_0xdaeb('0x11c')](db['SalesforceField'],{'as':'Subject','foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0xa7')][_0xdaeb('0x11c')](db[_0xdaeb('0xa7')],{'as':_0xdaeb('0x1ca'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xa7')][_0xdaeb('0x11c')](db[_0xdaeb('0xa7')],{'as':_0xdaeb('0x1cc'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0xa7')][_0xdaeb('0x150')](db['Variable'],{'as':_0xdaeb('0x1ce'),'foreignKey':_0xdaeb('0x1cf')});db[_0xdaeb('0xa9')]['hasMany'](db[_0xdaeb('0xab')],{'as':'Configurations','onDelete':_0xdaeb('0x119'),'foreignKey':'AccountId'});db[_0xdaeb('0xab')][_0xdaeb('0x11c')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0xab')]['hasMany'](db['SugarcrmField'],{'as':_0xdaeb('0x1d0'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1cb')});db['SugarcrmConfiguration'][_0xdaeb('0x11c')](db[_0xdaeb('0xad')],{'as':'Fields','onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0xab')][_0xdaeb('0x150')](db['SugarcrmAccount'],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x1c7')});db['SugarcrmField'][_0xdaeb('0x11c')](db['SugarcrmField'],{'as':_0xdaeb('0x1d1'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0xad')][_0xdaeb('0x11c')](db[_0xdaeb('0xad')],{'as':_0xdaeb('0x1ca'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xad')][_0xdaeb('0x11c')](db[_0xdaeb('0xad')],{'as':_0xdaeb('0x1cc'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0xad')]['belongsTo'](db[_0xdaeb('0x1ce')],{'as':_0xdaeb('0x1ce'),'foreignKey':_0xdaeb('0x1cf')});db[_0xdaeb('0xaf')][_0xdaeb('0x11c')](db[_0xdaeb('0xb1')],{'as':_0xdaeb('0x1d2'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c7')});db['DeskConfiguration'][_0xdaeb('0x11c')](db[_0xdaeb('0xb2')],{'as':'Subjects','onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0xb1')][_0xdaeb('0x11c')](db[_0xdaeb('0xb2')],{'as':_0xdaeb('0x1d0'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xb1')][_0xdaeb('0x11c')](db['DeskField'],{'as':_0xdaeb('0x1c2'),'onDelete':_0xdaeb('0x119'),'foreignKey':'FieldId'});db[_0xdaeb('0xb1')][_0xdaeb('0x150')](db[_0xdaeb('0xaf')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0xb1')][_0xdaeb('0x129')](db[_0xdaeb('0x171')],{'through':_0xdaeb('0x1d3')});db[_0xdaeb('0xb2')][_0xdaeb('0x11c')](db[_0xdaeb('0xb2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xdaeb('0xb2')][_0xdaeb('0x11c')](db['DeskField'],{'as':_0xdaeb('0x1ca'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xb2')]['hasMany'](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xdaeb('0xb2')][_0xdaeb('0x150')](db[_0xdaeb('0x1ce')],{'as':_0xdaeb('0x1ce'),'foreignKey':_0xdaeb('0x1cf')});db['ZohoAccount'][_0xdaeb('0x11c')](db[_0xdaeb('0xb6')],{'as':_0xdaeb('0x1d2'),'onDelete':'cascade','foreignKey':_0xdaeb('0x1c7')});db['ZohoConfiguration'][_0xdaeb('0x11c')](db[_0xdaeb('0xb8')],{'as':_0xdaeb('0x1c8'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0xb6')][_0xdaeb('0x11c')](db[_0xdaeb('0xb8')],{'as':_0xdaeb('0x1d0'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xb6')][_0xdaeb('0x11c')](db[_0xdaeb('0xb8')],{'as':'Fields','onDelete':_0xdaeb('0x119'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xdaeb('0x150')](db[_0xdaeb('0xb4')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0xb8')]['hasMany'](db[_0xdaeb('0xb8')],{'as':_0xdaeb('0x1d1'),'foreignKey':'SubjectId'});db['ZohoField'][_0xdaeb('0x11c')](db[_0xdaeb('0xb8')],{'as':_0xdaeb('0x1ca'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xb8')][_0xdaeb('0x11c')](db[_0xdaeb('0xb8')],{'as':_0xdaeb('0x1cc'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0xb8')]['belongsTo'](db[_0xdaeb('0x1ce')],{'as':'Variable','foreignKey':_0xdaeb('0x1cf')});db[_0xdaeb('0xba')][_0xdaeb('0x11c')](db[_0xdaeb('0xbb')],{'as':_0xdaeb('0x1d2'),'onDelete':_0xdaeb('0x119'),'foreignKey':'AccountId'});db[_0xdaeb('0xbb')][_0xdaeb('0x11c')](db['ZendeskField'],{'as':_0xdaeb('0x1c8'),'foreignKey':_0xdaeb('0x1c9')});db['ZendeskConfiguration'][_0xdaeb('0x11c')](db[_0xdaeb('0xbd')],{'as':_0xdaeb('0x1d0'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xbb')][_0xdaeb('0x11c')](db[_0xdaeb('0xbd')],{'as':_0xdaeb('0x1c2'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xdaeb('0x150')](db['ZendeskAccount'],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x1c7')});db['ZendeskConfiguration']['belongsToMany'](db[_0xdaeb('0x171')],{'through':'int_zendesk_configuration_has_tags'});db[_0xdaeb('0xbd')][_0xdaeb('0x11c')](db[_0xdaeb('0xbd')],{'as':_0xdaeb('0x1d1'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0xbd')]['hasMany'](db['ZendeskField'],{'as':_0xdaeb('0x1ca'),'foreignKey':_0xdaeb('0x1cb')});db['ZendeskField'][_0xdaeb('0x11c')](db['ZendeskField'],{'as':_0xdaeb('0x1cc'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0xbd')]['belongsTo'](db['Variable'],{'as':_0xdaeb('0x1ce'),'foreignKey':_0xdaeb('0x1cf')});db[_0xdaeb('0x1d4')][_0xdaeb('0x11c')](db[_0xdaeb('0xc0')],{'as':_0xdaeb('0x1d2'),'onDelete':'cascade','foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0xc0')][_0xdaeb('0x11c')](db[_0xdaeb('0x1d5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0xc0')][_0xdaeb('0x11c')](db[_0xdaeb('0x1d5')],{'as':_0xdaeb('0x1d0'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xc0')][_0xdaeb('0x11c')](db['FreshdeskField'],{'as':_0xdaeb('0x1c2'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0xc0')][_0xdaeb('0x150')](db[_0xdaeb('0x1d4')],{'as':'Account','foreignKey':'AccountId'});db[_0xdaeb('0xc0')]['belongsToMany'](db[_0xdaeb('0x171')],{'through':_0xdaeb('0x1d6')});db['FreshdeskField'][_0xdaeb('0x11c')](db[_0xdaeb('0x1d5')],{'as':_0xdaeb('0x1d1'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0x1d5')][_0xdaeb('0x11c')](db['FreshdeskField'],{'as':_0xdaeb('0x1ca'),'foreignKey':'DescriptionId'});db[_0xdaeb('0x1d5')][_0xdaeb('0x11c')](db['FreshdeskField'],{'as':'Field','foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0x1d5')][_0xdaeb('0x150')](db['Variable'],{'as':_0xdaeb('0x1ce'),'foreignKey':'VariableId'});db[_0xdaeb('0x1d7')]['hasMany'](db[_0xdaeb('0x1d8')],{'as':_0xdaeb('0x1d2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xdaeb('0x1d8')][_0xdaeb('0x11c')](db[_0xdaeb('0x1d9')],{'as':'Subjects','foreignKey':_0xdaeb('0x1c9')});db['VtigerConfiguration'][_0xdaeb('0x11c')](db[_0xdaeb('0x1d9')],{'as':_0xdaeb('0x1d0'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0x1d8')][_0xdaeb('0x11c')](db[_0xdaeb('0x1d9')],{'as':_0xdaeb('0x1c2'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0x1d8')][_0xdaeb('0x150')](db[_0xdaeb('0x1d7')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0x1d9')][_0xdaeb('0x11c')](db[_0xdaeb('0x1d9')],{'as':'Subject','foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0x1d9')][_0xdaeb('0x11c')](db[_0xdaeb('0x1d9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xdaeb('0x1d9')][_0xdaeb('0x11c')](db[_0xdaeb('0x1d9')],{'as':_0xdaeb('0x1cc'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0x1d9')][_0xdaeb('0x150')](db[_0xdaeb('0x1ce')],{'as':_0xdaeb('0x1ce'),'foreignKey':_0xdaeb('0x1cf')});db['ServicenowAccount'][_0xdaeb('0x11c')](db[_0xdaeb('0x1da')],{'as':_0xdaeb('0x1d2'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0x1da')][_0xdaeb('0x11c')](db[_0xdaeb('0xc6')],{'as':_0xdaeb('0x1c8'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0x1da')][_0xdaeb('0x11c')](db[_0xdaeb('0xc6')],{'as':_0xdaeb('0x1d0'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0xdaeb('0x11c')](db[_0xdaeb('0xc6')],{'as':_0xdaeb('0x1c2'),'foreignKey':_0xdaeb('0x1cd')});db['ServicenowConfiguration']['belongsTo'](db[_0xdaeb('0x1db')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0xc6')][_0xdaeb('0x11c')](db[_0xdaeb('0xc6')],{'as':_0xdaeb('0x1d1'),'foreignKey':_0xdaeb('0x1c9')});db['ServicenowField'][_0xdaeb('0x11c')](db[_0xdaeb('0xc6')],{'as':_0xdaeb('0x1ca'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xc6')][_0xdaeb('0x11c')](db[_0xdaeb('0xc6')],{'as':_0xdaeb('0x1cc'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0xc6')][_0xdaeb('0x150')](db['Variable'],{'as':_0xdaeb('0x1ce'),'foreignKey':_0xdaeb('0x1cf')});db[_0xdaeb('0xc8')][_0xdaeb('0x11c')](db[_0xdaeb('0xc9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xdaeb('0x1c7')});db['Dynamics365Account']['belongsTo'](db[_0xdaeb('0x111')],{'as':_0xdaeb('0x111'),'foreignKey':_0xdaeb('0x161')});db['Dynamics365Configuration'][_0xdaeb('0x11c')](db[_0xdaeb('0x1dc')],{'as':_0xdaeb('0x1c8'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0xc9')][_0xdaeb('0x11c')](db[_0xdaeb('0x1dc')],{'as':_0xdaeb('0x1d0'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xc9')][_0xdaeb('0x11c')](db[_0xdaeb('0x1dc')],{'as':_0xdaeb('0x1c2'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0xc9')][_0xdaeb('0x150')](db[_0xdaeb('0xc8')],{'as':_0xdaeb('0x16f'),'foreignKey':'AccountId'});db[_0xdaeb('0x1dc')]['hasMany'](db[_0xdaeb('0x1dc')],{'as':_0xdaeb('0x1d1'),'foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0x1dc')][_0xdaeb('0x11c')](db[_0xdaeb('0x1dc')],{'as':_0xdaeb('0x1ca'),'foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0x1dc')][_0xdaeb('0x11c')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xdaeb('0x1cd')});db[_0xdaeb('0x1dc')][_0xdaeb('0x150')](db['Variable'],{'as':_0xdaeb('0x1ce'),'foreignKey':_0xdaeb('0x1cf')});db[_0xdaeb('0xcb')][_0xdaeb('0x11c')](db['FreshsalesConfiguration'],{'as':_0xdaeb('0x1d2'),'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1c7')});db['FreshsalesConfiguration'][_0xdaeb('0x11c')](db[_0xdaeb('0x1dd')],{'as':_0xdaeb('0x1c8'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db[_0xdaeb('0x1dd')],{'as':'Descriptions','foreignKey':_0xdaeb('0x1cb')});db[_0xdaeb('0xcd')][_0xdaeb('0x11c')](db[_0xdaeb('0x1dd')],{'as':_0xdaeb('0x1c2'),'foreignKey':'FieldId'});db[_0xdaeb('0xcd')][_0xdaeb('0x150')](db[_0xdaeb('0xcb')],{'as':'Account','foreignKey':_0xdaeb('0x1c7')});db[_0xdaeb('0x1dd')][_0xdaeb('0x11c')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xdaeb('0x1c9')});db[_0xdaeb('0x1dd')][_0xdaeb('0x11c')](db['FreshsalesField'],{'as':'Description','foreignKey':_0xdaeb('0x1cb')});db['FreshsalesField'][_0xdaeb('0x11c')](db[_0xdaeb('0x1dd')],{'as':_0xdaeb('0x1cc'),'foreignKey':_0xdaeb('0x1cd')});db['FreshsalesField'][_0xdaeb('0x150')](db[_0xdaeb('0x1ce')],{'as':_0xdaeb('0x1ce'),'foreignKey':_0xdaeb('0x1cf')});db['ChatQueueReport'][_0xdaeb('0x150')](db['ChatWebsite'],{});db[_0xdaeb('0xd4')][_0xdaeb('0x150')](db[_0xdaeb('0xfe')],{'as':'List','foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0xd4')][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0xd4')]['belongsTo'](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db[_0xdaeb('0x6b')],{});db[_0xdaeb('0xd4')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{});db[_0xdaeb('0xd4')][_0xdaeb('0x150')](db[_0xdaeb('0x13a')],{});db['ChatInternalMessage']['belongsTo'](db[_0xdaeb('0x11')],{'onDelete':_0xdaeb('0x119'),'foreignKey':'FromId'});db[_0xdaeb('0xd6')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x1de')});db['JscriptySessionReport'][_0xdaeb('0x11c')](db[_0xdaeb('0xda')],{'foreignKey':_0xdaeb('0x1df'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0xdb')][_0xdaeb('0x11c')](db['JscriptyAnswerReport'],{'foreignKey':_0xdaeb('0x1df'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0xdd')][_0xdaeb('0x150')](db[_0xdaeb('0x54')],{});db[_0xdaeb('0xdd')]['belongsTo'](db['CmList'],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0xdd')]['belongsTo'](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0xdd')][_0xdaeb('0x150')](db[_0xdaeb('0x57')],{});db[_0xdaeb('0xdd')]['belongsTo'](db[_0xdaeb('0x186')],{});db[_0xdaeb('0xdd')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{});db['SmsQueueReport'][_0xdaeb('0x150')](db['SmsQueue'],{});db[_0xdaeb('0xe1')][_0xdaeb('0x11c')](db['JscriptySessionReport'],{'foreignKey':_0xdaeb('0x1e0')});db[_0xdaeb('0xe1')][_0xdaeb('0x11c')](db['JscriptyQuestionReport'],{'foreignKey':_0xdaeb('0x1e0')});db[_0xdaeb('0xe1')]['hasMany'](db[_0xdaeb('0xd8')],{'foreignKey':'ProjectId'});db['Team'][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':'user_has_teams'});db[_0xdaeb('0xea')][_0xdaeb('0x129')](db['VoiceQueue'],{'through':_0xdaeb('0x1e1'),'as':_0xdaeb('0x1e2')});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0xdaeb('0x16c'),'as':_0xdaeb('0x139')});db[_0xdaeb('0xea')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xdaeb('0x1e3')});db[_0xdaeb('0xea')][_0xdaeb('0x129')](db['FaxQueue'],{'through':_0xdaeb('0x183'),'as':'FaxQueues'});db['Team'][_0xdaeb('0x129')](db['SmsQueue'],{'through':_0xdaeb('0x18d'),'as':_0xdaeb('0x13c')});db['Team']['belongsToMany'](db[_0xdaeb('0x62')],{'through':_0xdaeb('0x192'),'as':_0xdaeb('0x1e4')});db[_0xdaeb('0xea')][_0xdaeb('0x129')](db['WhatsappQueue'],{'through':_0xdaeb('0x1e5'),'as':_0xdaeb('0x13d')});db[_0xdaeb('0xea')][_0xdaeb('0x129')](db[_0xdaeb('0x100')],{'through':_0xdaeb('0x113'),'as':_0xdaeb('0x1e6')});db[_0xdaeb('0xee')][_0xdaeb('0x11c')](db[_0xdaeb('0x78')],{'as':'Hoppers','foreignKey':_0xdaeb('0x1a7')});db[_0xdaeb('0xee')][_0xdaeb('0x11c')](db[_0xdaeb('0x7b')],{'as':_0xdaeb('0x1a0'),'foreignKey':_0xdaeb('0x1a7')});db[_0xdaeb('0xee')][_0xdaeb('0x11c')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xdaeb('0xee')][_0xdaeb('0x11c')](db['CmHopperBlack'],{'as':_0xdaeb('0x14f'),'foreignKey':_0xdaeb('0x1a7')});db[_0xdaeb('0xee')][_0xdaeb('0x150')](db[_0xdaeb('0x29')],{'as':_0xdaeb('0x29'),'foreignKey':_0xdaeb('0x151')});db['Campaign']['belongsTo'](db[_0xdaeb('0x29')],{'as':_0xdaeb('0x152'),'foreignKey':_0xdaeb('0x153')});db[_0xdaeb('0xee')]['belongsTo'](db[_0xdaeb('0x154')],{'as':'Interval','foreignKey':_0xdaeb('0x155')});db[_0xdaeb('0xee')][_0xdaeb('0x150')](db[_0xdaeb('0x1e7')],{'as':_0xdaeb('0x1e7'),'foreignKey':_0xdaeb('0x1e8')});db[_0xdaeb('0xee')]['belongsToMany'](db[_0xdaeb('0xfe')],{'as':'Lists','through':_0xdaeb('0x1e9')});db['Campaign']['belongsToMany'](db[_0xdaeb('0xfe')],{'as':'BlackLists','through':_0xdaeb('0x1ea')});db[_0xdaeb('0xf2')][_0xdaeb('0x150')](db[_0xdaeb('0x6d')],{'as':_0xdaeb('0x6d'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport']['belongsTo'](db['MailMessage'],{});db['MailTransferReport'][_0xdaeb('0x150')](db[_0xdaeb('0x122')],{});db[_0xdaeb('0x1eb')][_0xdaeb('0x150')](db[_0xdaeb('0x3d')],{'foreignKey':_0xdaeb('0x1ec'),'as':_0xdaeb('0x1ed')});db['MailTransferReport'][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'foreignKey':_0xdaeb('0x1ee'),'as':_0xdaeb('0x1ef')});db[_0xdaeb('0x1eb')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'foreignKey':_0xdaeb('0x1f0'),'as':_0xdaeb('0x1f1')});db['MailTransferReport'][_0xdaeb('0x150')](db[_0xdaeb('0x3f')],{'foreignKey':_0xdaeb('0x1f2'),'as':'ToQueue'});db['MailTransferReport'][_0xdaeb('0x150')](db['MailAccount'],{'foreignKey':_0xdaeb('0x1f3'),'as':_0xdaeb('0x1f4')});db[_0xdaeb('0xf7')][_0xdaeb('0x150')](db[_0xdaeb('0x6b')],{});db[_0xdaeb('0xf7')]['belongsTo'](db[_0xdaeb('0x69')],{});db[_0xdaeb('0xf7')]['belongsTo'](db[_0xdaeb('0x64')],{'foreignKey':_0xdaeb('0x1f5'),'as':'FromAccount'});db[_0xdaeb('0xf7')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'foreignKey':_0xdaeb('0x1ee'),'as':_0xdaeb('0x1ef')});db[_0xdaeb('0xf7')][_0xdaeb('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0xdaeb('0x1f1')});db['ChatTransferReport'][_0xdaeb('0x150')](db[_0xdaeb('0x13a')],{'foreignKey':_0xdaeb('0x1f6'),'as':_0xdaeb('0x1f7')});db[_0xdaeb('0xf7')][_0xdaeb('0x150')](db[_0xdaeb('0x64')],{'foreignKey':_0xdaeb('0x1f8'),'as':_0xdaeb('0x1f4')});db[_0xdaeb('0xf9')][_0xdaeb('0x150')](db[_0xdaeb('0x50')],{});db[_0xdaeb('0xf9')][_0xdaeb('0x150')](db['FaxInteraction'],{});db[_0xdaeb('0xf9')][_0xdaeb('0x150')](db['FaxAccount'],{'foreignKey':_0xdaeb('0x1f9'),'as':_0xdaeb('0x1ed')});db['FaxTransferReport'][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'foreignKey':_0xdaeb('0x1ee'),'as':'FromAgent'});db[_0xdaeb('0xf9')][_0xdaeb('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0xdaeb('0x1f1')});db[_0xdaeb('0xf9')]['belongsTo'](db[_0xdaeb('0x13b')],{'foreignKey':_0xdaeb('0x1fa'),'as':'ToQueue'});db[_0xdaeb('0xf9')][_0xdaeb('0x150')](db[_0xdaeb('0x13f')],{'foreignKey':'ToFaxAccountId','as':_0xdaeb('0x1f4')});db[_0xdaeb('0xfa')]['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xdaeb('0x5f')],{});db[_0xdaeb('0xfa')][_0xdaeb('0x150')](db[_0xdaeb('0x143')],{'foreignKey':_0xdaeb('0x1fb'),'as':_0xdaeb('0x1ed')});db[_0xdaeb('0xfa')][_0xdaeb('0x150')](db['User'],{'foreignKey':_0xdaeb('0x1ee'),'as':_0xdaeb('0x1ef')});db['OpenchannelTransferReport'][_0xdaeb('0x150')](db['User'],{'foreignKey':_0xdaeb('0x1f0'),'as':'ToAgent'});db[_0xdaeb('0xfa')][_0xdaeb('0x150')](db[_0xdaeb('0x62')],{'foreignKey':_0xdaeb('0x1fc'),'as':_0xdaeb('0x1f7')});db[_0xdaeb('0xfa')][_0xdaeb('0x150')](db[_0xdaeb('0x143')],{'foreignKey':_0xdaeb('0x1fd'),'as':_0xdaeb('0x1f4')});db['SmsTransferReport'][_0xdaeb('0x150')](db['SmsMessage'],{});db[_0xdaeb('0xfc')][_0xdaeb('0x150')](db['SmsInteraction'],{});db[_0xdaeb('0xfc')]['belongsTo'](db[_0xdaeb('0x54')],{'foreignKey':_0xdaeb('0x1fe'),'as':_0xdaeb('0x1ed')});db[_0xdaeb('0xfc')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'foreignKey':_0xdaeb('0x1ee'),'as':_0xdaeb('0x1ef')});db[_0xdaeb('0xfc')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'foreignKey':_0xdaeb('0x1f0'),'as':_0xdaeb('0x1f1')});db[_0xdaeb('0xfc')][_0xdaeb('0x150')](db[_0xdaeb('0x5a')],{'foreignKey':_0xdaeb('0x1ff'),'as':'ToQueue'});db[_0xdaeb('0xfc')][_0xdaeb('0x150')](db[_0xdaeb('0x54')],{'foreignKey':'ToSmsAccountId','as':_0xdaeb('0x1f4')});db[_0xdaeb('0xfe')][_0xdaeb('0x11c')](db[_0xdaeb('0x88')],{'as':_0xdaeb('0x17c'),'foreignKey':_0xdaeb('0x169'),'onDelete':_0xdaeb('0x119')});db['CmList'][_0xdaeb('0x11c')](db[_0xdaeb('0x80')],{'as':_0xdaeb('0x200'),'foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0xfe')][_0xdaeb('0x11c')](db[_0xdaeb('0x76')],{'as':'Contacts','onDelete':_0xdaeb('0x119'),'foreignKey':_0xdaeb('0x169')});db['CmList']['hasMany'](db[_0xdaeb('0x7b')],{'as':'HopperFinals','foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0xfe')]['hasMany'](db[_0xdaeb('0x7c')],{'as':_0xdaeb('0x201'),'foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0xfe')]['hasMany'](db['ReportAgentPreview'],{'as':_0xdaeb('0x7e'),'foreignKey':_0xdaeb('0x169')});db[_0xdaeb('0xfe')]['belongsToMany'](db[_0xdaeb('0x137')],{'as':_0xdaeb('0x202'),'through':'voice_queues_has_cm_lists'});db[_0xdaeb('0xfe')][_0xdaeb('0x129')](db['User'],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x12f')});db['VoicePrefix'][_0xdaeb('0x11c')](db[_0xdaeb('0x17')],{'as':'Extensions','onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x100')][_0xdaeb('0x129')](db['User'],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x114')});db[_0xdaeb('0x100')]['belongsToMany'](db['Team'],{'through':_0xdaeb('0x113'),'as':'Teams'});db[_0xdaeb('0x102')][_0xdaeb('0x11c')](db[_0xdaeb('0x11')],{'as':'Users','foreignKey':_0xdaeb('0x128')});db['UserProfile'][_0xdaeb('0x11c')](db[_0xdaeb('0x203')],{'as':_0xdaeb('0x204'),'foreignKey':'userProfileId','onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x203')][_0xdaeb('0x11c')](db[_0xdaeb('0x105')],{'as':_0xdaeb('0x205'),'foreignKey':'sectionId','onDelete':_0xdaeb('0x119')});db['WhatsappAccount']['hasMany'](db[_0xdaeb('0x88')],{'as':'Dispositions','foreignKey':_0xdaeb('0x206'),'onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x207')][_0xdaeb('0x11c')](db[_0xdaeb('0x86')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xdaeb('0x207')][_0xdaeb('0x11c')](db['WhatsappMessage'],{'as':_0xdaeb('0x166'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xdaeb('0x11c')](db[_0xdaeb('0x109')],{'as':'Interactions'});db[_0xdaeb('0x207')][_0xdaeb('0x11c')](db[_0xdaeb('0x208')],{'as':_0xdaeb('0x14a'),'foreignKey':'WhatsappAccountId','onDelete':_0xdaeb('0x119')});db[_0xdaeb('0x207')][_0xdaeb('0x150')](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x168'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xdaeb('0x150')](db[_0xdaeb('0x156')],{'as':'mandatoryDispositionPause','foreignKey':_0xdaeb('0x157')});db[_0xdaeb('0x207')][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x159'),'through':_0xdaeb('0x147')});db['WhatsappApplication']['belongsTo'](db[_0xdaeb('0x11')],{'onDelete':'restrict'});db[_0xdaeb('0x208')][_0xdaeb('0x150')](db[_0xdaeb('0x10f')],{'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x208')]['belongsTo'](db[_0xdaeb('0x207')],{'onDelete':_0xdaeb('0x162')});db['WhatsappApplication'][_0xdaeb('0x150')](db['Interval'],{'onDelete':_0xdaeb('0x162'),'foreignKey':_0xdaeb('0x155')});db['WhatsappApplication'][_0xdaeb('0x150')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xdaeb('0x178')});db['WhatsappInteraction']['hasMany'](db[_0xdaeb('0x10b')],{'as':_0xdaeb('0x166'),'onDelete':_0xdaeb('0x119'),'foreignKey':'WhatsappInteractionId'});db[_0xdaeb('0x109')][_0xdaeb('0x150')](db[_0xdaeb('0x207')],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x206')});db[_0xdaeb('0x109')][_0xdaeb('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x109')][_0xdaeb('0x150')](db['User'],{'as':'Owner','foreignKey':_0xdaeb('0x11a')});db[_0xdaeb('0x109')]['belongsToMany'](db['Tag'],{'through':_0xdaeb('0x1b8'),'as':_0xdaeb('0x172')});db['WhatsappInteraction']['belongsToMany'](db[_0xdaeb('0x171')],{'through':_0xdaeb('0x1b8'),'as':_0xdaeb('0x189')});db[_0xdaeb('0x109')][_0xdaeb('0x129')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x173'),'through':'user_has_whatsapp_interactions','foreignKey':_0xdaeb('0x209')});db['WhatsappMessage']['belongsTo'](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x11')});db[_0xdaeb('0x10b')]['belongsTo'](db[_0xdaeb('0x76')],{'onDelete':_0xdaeb('0x119'),'as':_0xdaeb('0x15e')});db[_0xdaeb('0x10b')][_0xdaeb('0x150')](db[_0xdaeb('0x109')],{'onDelete':_0xdaeb('0x119'),'as':_0xdaeb('0x18b'),'foreignKey':_0xdaeb('0x209')});db[_0xdaeb('0x10b')]['belongsTo'](db['WhatsappAccount'],{'as':_0xdaeb('0x16f'),'foreignKey':_0xdaeb('0x206')});db['WhatsappQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x207')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xdaeb('0xfe')],{'as':_0xdaeb('0x168'),'foreignKey':_0xdaeb('0x169')});db['WhatsappQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x76')],{'as':_0xdaeb('0x15e'),'foreignKey':_0xdaeb('0x15f')});db[_0xdaeb('0x20a')][_0xdaeb('0x150')](db[_0xdaeb('0x109')],{});db['WhatsappQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x10f')],{});db['WhatsappQueueReport'][_0xdaeb('0x150')](db[_0xdaeb('0x10b')],{});db[_0xdaeb('0x20a')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{});db[_0xdaeb('0x10d')][_0xdaeb('0x150')](db[_0xdaeb('0x10b')],{});db[_0xdaeb('0x10d')][_0xdaeb('0x150')](db[_0xdaeb('0x109')],{});db[_0xdaeb('0x10d')][_0xdaeb('0x150')](db[_0xdaeb('0x207')],{'foreignKey':_0xdaeb('0x20b'),'as':'FromAccount'});db[_0xdaeb('0x10d')][_0xdaeb('0x150')](db[_0xdaeb('0x207')],{'foreignKey':_0xdaeb('0x20c'),'as':'ToAccount'});db[_0xdaeb('0x10d')][_0xdaeb('0x150')](db[_0xdaeb('0x10f')],{'foreignKey':_0xdaeb('0x20d'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0xdaeb('0x11')],{'foreignKey':_0xdaeb('0x1ee'),'as':_0xdaeb('0x1ef')});db['WhatsappTransferReport'][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'foreignKey':_0xdaeb('0x1f0'),'as':_0xdaeb('0x1f1')});db[_0xdaeb('0x10f')]['belongsToMany'](db[_0xdaeb('0x11')],{'as':'Agents','through':_0xdaeb('0x38'),'foreignKey':'WhatsappQueueId'});db[_0xdaeb('0x10f')][_0xdaeb('0x129')](db['Team'],{'through':_0xdaeb('0x1e5'),'as':_0xdaeb('0x16d')});db[_0xdaeb('0x116')][_0xdaeb('0x150')](db[_0xdaeb('0x11')],{'as':_0xdaeb('0x20e'),'foreignKey':_0xdaeb('0x11a'),'onDelete':_0xdaeb('0x119'),'hooks':!![]});db[_0xdaeb('0x111')]['hasOne'](db[_0xdaeb('0xc8')],{'as':_0xdaeb('0xc8'),'onDelete':_0xdaeb('0x162')});db[_0xdaeb('0x111')]['hasOne'](db[_0xdaeb('0x39')],{'as':_0xdaeb('0x163'),'onDelete':'restrict'});db[_0xdaeb('0x111')][_0xdaeb('0x11b')](db[_0xdaeb('0x3b')],{'as':_0xdaeb('0x164'),'onDelete':_0xdaeb('0x162')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 732e320..8d30093 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90b1=['./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./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/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/mail_interaction_has_tags','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','get','sendFile','appPath','path','express','./errors','setupLoggers','./api/client-side-logs','default','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','./api/cmContact','/api/cm/hopper','/api/cm/hopper_final'];(function(_0x15a5c1,_0x177ad3){var _0x19cb2e=function(_0xacdb01){while(--_0xacdb01){_0x15a5c1['push'](_0x15a5c1['shift']());}};_0x19cb2e(++_0x177ad3);}(_0x90b1,0x1bb));var _0x190b=function(_0x4ff681,_0x30ba0f){_0x4ff681=_0x4ff681-0x0;var _0x2465d0=_0x90b1[_0x4ff681];return _0x2465d0;};'use strict';var path=require(_0x190b('0x0'));var express=require(_0x190b('0x1'));var errors=require(_0x190b('0x2'));var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x190b('0x3')];var clientSideLogs=require(_0x190b('0x4'));exports[_0x190b('0x5')]=function(_0x120ddc){return setupLoggers(_0x120ddc)['then'](function(){_0x120ddc['use']('/api/users',require('./api/user'));_0x120ddc[_0x190b('0x6')](_0x190b('0x7'),require(_0x190b('0x8')));_0x120ddc[_0x190b('0x6')](_0x190b('0x9'),require(_0x190b('0xa')));_0x120ddc[_0x190b('0x6')]('/api/voice/extensions',require(_0x190b('0xb')));_0x120ddc[_0x190b('0x6')](_0x190b('0xc'),require(_0x190b('0xd')));_0x120ddc[_0x190b('0x6')](_0x190b('0xe'),require(_0x190b('0xf')));_0x120ddc[_0x190b('0x6')]('/api/voice/recordings',require(_0x190b('0x10')));_0x120ddc[_0x190b('0x6')]('/api/screen/recordings',require(_0x190b('0x11')));_0x120ddc[_0x190b('0x6')](_0x190b('0x12'),require(_0x190b('0x13')));_0x120ddc[_0x190b('0x6')](_0x190b('0x14'),require(_0x190b('0x15')));_0x120ddc[_0x190b('0x6')](_0x190b('0x16'),require(_0x190b('0x17')));_0x120ddc[_0x190b('0x6')](_0x190b('0x18'),require(_0x190b('0x19')));_0x120ddc[_0x190b('0x6')](_0x190b('0x1a'),require(_0x190b('0x1b')));_0x120ddc[_0x190b('0x6')]('/api/voice/queues/reports',require(_0x190b('0x1c')));_0x120ddc['use'](_0x190b('0x1d'),require(_0x190b('0x1e')));_0x120ddc[_0x190b('0x6')](_0x190b('0x1f'),require('./api/trunk'));_0x120ddc[_0x190b('0x6')](_0x190b('0x20'),require(_0x190b('0x21')));_0x120ddc[_0x190b('0x6')](_0x190b('0x22'),require(_0x190b('0x23')));_0x120ddc['use'](_0x190b('0x24'),require(_0x190b('0x25')));_0x120ddc['use'](_0x190b('0x26'),require('./api/mailQueue'));_0x120ddc['use'](_0x190b('0x27'),require(_0x190b('0x28')));_0x120ddc[_0x190b('0x6')]('/api/mail/interactions',require(_0x190b('0x29')));_0x120ddc[_0x190b('0x6')](_0x190b('0x2a'),require(_0x190b('0x2b')));_0x120ddc[_0x190b('0x6')](_0x190b('0x2c'),require(_0x190b('0x2d')));_0x120ddc['use']('/api/mail/reports/queue',require(_0x190b('0x2e')));_0x120ddc[_0x190b('0x6')]('/api/dashboards',require('./api/dashboard'));_0x120ddc[_0x190b('0x6')]('/api/dashboards/items',require(_0x190b('0x2f')));_0x120ddc[_0x190b('0x6')]('/api/fax/accounts',require(_0x190b('0x30')));_0x120ddc[_0x190b('0x6')]('/api/fax/applications',require(_0x190b('0x31')));_0x120ddc[_0x190b('0x6')](_0x190b('0x32'),require('./api/faxInteraction'));_0x120ddc['use'](_0x190b('0x33'),require('./api/faxMessage'));_0x120ddc[_0x190b('0x6')](_0x190b('0x34'),require('./api/faxQueue'));_0x120ddc[_0x190b('0x6')]('/api/fax/reports/queue',require(_0x190b('0x35')));_0x120ddc['use'](_0x190b('0x36'),require('./api/smsAccount'));_0x120ddc[_0x190b('0x6')](_0x190b('0x37'),require('./api/smsApplication'));_0x120ddc[_0x190b('0x6')](_0x190b('0x38'),require(_0x190b('0x39')));_0x120ddc[_0x190b('0x6')](_0x190b('0x3a'),require(_0x190b('0x3b')));_0x120ddc[_0x190b('0x6')](_0x190b('0x3c'),require('./api/smsQueue'));_0x120ddc['use'](_0x190b('0x3d'),require(_0x190b('0x3e')));_0x120ddc['use'](_0x190b('0x3f'),require(_0x190b('0x40')));_0x120ddc[_0x190b('0x6')](_0x190b('0x41'),require(_0x190b('0x42')));_0x120ddc[_0x190b('0x6')](_0x190b('0x43'),require('./api/openchannelMessage'));_0x120ddc['use'](_0x190b('0x44'),require(_0x190b('0x45')));_0x120ddc[_0x190b('0x6')]('/api/chat/websites',require(_0x190b('0x46')));_0x120ddc[_0x190b('0x6')](_0x190b('0x47'),require('./api/openchannelQueueReport'));_0x120ddc[_0x190b('0x6')]('/api/chat/applications',require('./api/chatApplication'));_0x120ddc[_0x190b('0x6')](_0x190b('0x48'),require('./api/chatInteraction'));_0x120ddc[_0x190b('0x6')](_0x190b('0x49'),require(_0x190b('0x4a')));_0x120ddc['use'](_0x190b('0x4b'),require(_0x190b('0x4c')));_0x120ddc['use']('/api/chat/queues',require(_0x190b('0x4d')));_0x120ddc['use'](_0x190b('0x4e'),require(_0x190b('0x4f')));_0x120ddc[_0x190b('0x6')](_0x190b('0x50'),require('./api/chatProactiveAction'));_0x120ddc[_0x190b('0x6')]('/api/cm/companies',require(_0x190b('0x51')));_0x120ddc[_0x190b('0x6')]('/api/cm/contacts',require(_0x190b('0x52')));_0x120ddc[_0x190b('0x6')](_0x190b('0x53'),require('./api/cmHopper'));_0x120ddc[_0x190b('0x6')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x120ddc['use'](_0x190b('0x54'),require(_0x190b('0x55')));_0x120ddc[_0x190b('0x6')](_0x190b('0x56'),require('./api/cmHopperHistory'));_0x120ddc['use'](_0x190b('0x57'),require('./api/cmCustomField'));_0x120ddc[_0x190b('0x6')](_0x190b('0x58'),require('./api/action'));_0x120ddc[_0x190b('0x6')](_0x190b('0x59'),require(_0x190b('0x5a')));_0x120ddc['use'](_0x190b('0x5b'),require(_0x190b('0x5c')));_0x120ddc['use'](_0x190b('0x5d'),require('./api/disposition'));_0x120ddc[_0x190b('0x6')](_0x190b('0x5e'),require(_0x190b('0x5f')));_0x120ddc['use'](_0x190b('0x60'),require('./api/interval'));_0x120ddc[_0x190b('0x6')](_0x190b('0x61'),require(_0x190b('0x62')));_0x120ddc[_0x190b('0x6')](_0x190b('0x63'),require(_0x190b('0x64')));_0x120ddc[_0x190b('0x6')]('/api/voiceQueuesLog',require(_0x190b('0x65')));_0x120ddc[_0x190b('0x6')](_0x190b('0x66'),require('./api/schedule'));_0x120ddc[_0x190b('0x6')](_0x190b('0x67'),require(_0x190b('0x68')));_0x120ddc[_0x190b('0x6')](_0x190b('0x69'),require('./api/tag'));_0x120ddc[_0x190b('0x6')](_0x190b('0x6a'),require(_0x190b('0x6b')));_0x120ddc['use'](_0x190b('0x6c'),require(_0x190b('0x6d')));_0x120ddc[_0x190b('0x6')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x120ddc[_0x190b('0x6')](_0x190b('0x6e'),require(_0x190b('0x6f')));_0x120ddc[_0x190b('0x6')](_0x190b('0x70'),require(_0x190b('0x71')));_0x120ddc['use'](_0x190b('0x72'),require(_0x190b('0x73')));_0x120ddc[_0x190b('0x6')]('/api/integrations',require(_0x190b('0x74')));_0x120ddc[_0x190b('0x6')](_0x190b('0x75'),require('./api/integrationReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0x76'),require(_0x190b('0x77')));_0x120ddc[_0x190b('0x6')](_0x190b('0x78'),require(_0x190b('0x79')));_0x120ddc[_0x190b('0x6')](_0x190b('0x7a'),require(_0x190b('0x7b')));_0x120ddc[_0x190b('0x6')](_0x190b('0x7c'),require('./api/analyticMetric'));_0x120ddc[_0x190b('0x6')]('/api/analytics/field_reports',require(_0x190b('0x7d')));_0x120ddc[_0x190b('0x6')]('/api/analytics/tree_reports',require(_0x190b('0x7e')));_0x120ddc[_0x190b('0x6')](_0x190b('0x7f'),require(_0x190b('0x80')));_0x120ddc[_0x190b('0x6')](_0x190b('0x81'),require(_0x190b('0x82')));_0x120ddc[_0x190b('0x6')]('/api/integrations/salesforce/fields',require(_0x190b('0x83')));_0x120ddc[_0x190b('0x6')](_0x190b('0x84'),require('./api/intSugarcrmAccount'));_0x120ddc[_0x190b('0x6')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x120ddc[_0x190b('0x6')](_0x190b('0x85'),require(_0x190b('0x86')));_0x120ddc[_0x190b('0x6')](_0x190b('0x87'),require(_0x190b('0x88')));_0x120ddc[_0x190b('0x6')](_0x190b('0x89'),require(_0x190b('0x8a')));_0x120ddc[_0x190b('0x6')](_0x190b('0x8b'),require(_0x190b('0x8c')));_0x120ddc[_0x190b('0x6')](_0x190b('0x8d'),require('./api/intZohoAccount'));_0x120ddc[_0x190b('0x6')](_0x190b('0x8e'),require(_0x190b('0x8f')));_0x120ddc[_0x190b('0x6')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x120ddc[_0x190b('0x6')](_0x190b('0x90'),require('./api/intZendeskAccount'));_0x120ddc[_0x190b('0x6')]('/api/integrations/zendesk/configurations',require(_0x190b('0x91')));_0x120ddc[_0x190b('0x6')](_0x190b('0x92'),require('./api/intZendeskField'));_0x120ddc[_0x190b('0x6')](_0x190b('0x93'),require(_0x190b('0x94')));_0x120ddc[_0x190b('0x6')](_0x190b('0x95'),require(_0x190b('0x96')));_0x120ddc[_0x190b('0x6')](_0x190b('0x97'),require(_0x190b('0x98')));_0x120ddc['use']('/api/integrations/vtiger/accounts',require(_0x190b('0x99')));_0x120ddc[_0x190b('0x6')](_0x190b('0x9a'),require(_0x190b('0x9b')));_0x120ddc['use'](_0x190b('0x9c'),require(_0x190b('0x9d')));_0x120ddc['use'](_0x190b('0x9e'),require(_0x190b('0x9f')));_0x120ddc[_0x190b('0x6')](_0x190b('0xa0'),require(_0x190b('0xa1')));_0x120ddc[_0x190b('0x6')](_0x190b('0xa2'),require(_0x190b('0xa3')));_0x120ddc['use'](_0x190b('0xa4'),require('./api/intDynamics365Account'));_0x120ddc['use'](_0x190b('0xa5'),require(_0x190b('0xa6')));_0x120ddc[_0x190b('0x6')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x120ddc[_0x190b('0x6')](_0x190b('0xa7'),require(_0x190b('0xa8')));_0x120ddc[_0x190b('0x6')](_0x190b('0xa9'),require(_0x190b('0xaa')));_0x120ddc[_0x190b('0x6')](_0x190b('0xab'),require('./api/intFreshsalesField'));_0x120ddc[_0x190b('0x6')](_0x190b('0xac'),require(_0x190b('0xad')));_0x120ddc[_0x190b('0x6')](_0x190b('0xae'),require('./api/chatQueueReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0xaf'),require(_0x190b('0xb0')));_0x120ddc['use'](_0x190b('0xb1'),require(_0x190b('0xb2')));_0x120ddc[_0x190b('0x6')](_0x190b('0xb3'),require('./api/jscriptyQuestionReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0xb4'),require(_0x190b('0xb5')));_0x120ddc[_0x190b('0x6')]('/api/sms/reports/queue',require(_0x190b('0xb6')));_0x120ddc['use'](_0x190b('0xb7'),require(_0x190b('0xb8')));_0x120ddc[_0x190b('0x6')](_0x190b('0xb9'),require('./api/squareReportDetail'));_0x120ddc[_0x190b('0x6')]('/api/jscripty/projects',require(_0x190b('0xba')));_0x120ddc['use']('/api/settings',require(_0x190b('0xbb')));_0x120ddc['use'](_0x190b('0xbc'),require(_0x190b('0xbd')));_0x120ddc[_0x190b('0x6')](_0x190b('0xbe'),require(_0x190b('0xbf')));_0x120ddc['use'](_0x190b('0xc0'),require(_0x190b('0xc1')));_0x120ddc[_0x190b('0x6')]('/api/square/messages',require(_0x190b('0xc2')));_0x120ddc[_0x190b('0x6')]('/api/teams',require(_0x190b('0xc3')));_0x120ddc[_0x190b('0x6')](_0x190b('0xc4'),require('./api/license'));_0x120ddc[_0x190b('0x6')](_0x190b('0xc5'),require(_0x190b('0xc6')));_0x120ddc[_0x190b('0x6')]('/api/migrations',require(_0x190b('0xc7')));_0x120ddc[_0x190b('0x6')](_0x190b('0xc8'),require('./api/attachment'));_0x120ddc[_0x190b('0x6')](_0x190b('0xc9'),require(_0x190b('0xca')));_0x120ddc['use'](_0x190b('0xcb'),require(_0x190b('0xcc')));_0x120ddc[_0x190b('0x6')](_0x190b('0xcd'),require(_0x190b('0xce')));_0x120ddc['use']('/api/fax/reports/transfer',require(_0x190b('0xcf')));_0x120ddc[_0x190b('0x6')]('/api/openchannel/reports/transfer',require(_0x190b('0xd0')));_0x120ddc[_0x190b('0x6')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0xd1'),require('./api/cmList'));_0x120ddc['use'](_0x190b('0xd2'),require(_0x190b('0xd3')));_0x120ddc[_0x190b('0x6')](_0x190b('0xd4'),require(_0x190b('0xd5')));_0x120ddc['use']('/api/userProfile/sections',require(_0x190b('0xd6')));_0x120ddc['use'](_0x190b('0xd7'),require(_0x190b('0xd8')));_0x120ddc[_0x190b('0x6')](_0x190b('0xd9'),require(_0x190b('0xda')));_0x120ddc[_0x190b('0x6')](_0x190b('0xdb'),require(_0x190b('0xdc')));_0x120ddc[_0x190b('0x6')](_0x190b('0xdd'),require(_0x190b('0xde')));_0x120ddc['use'](_0x190b('0xdf'),require(_0x190b('0xe0')));_0x120ddc[_0x190b('0x6')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x120ddc[_0x190b('0x6')](_0x190b('0xe1'),require('./api/whatsappQueueReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0xe2'),require(_0x190b('0xe3')));_0x120ddc['use'](_0x190b('0xe4'),require(_0x190b('0xe5')));_0x120ddc['use'](_0x190b('0xe6'),require(_0x190b('0xe7')));_0x120ddc['use'](_0x190b('0xe8'),require('./api/realtime'));_0x120ddc['use']('/api/user-settings',require('./api/user-setting'));_0x120ddc[_0x190b('0x6')](_0x190b('0xe9'),require('./api/mailInteractionHasTag'));_0x120ddc[_0x190b('0x6')](_0x190b('0xea'),require('./api/authLocal'));_0x120ddc[_0x190b('0x6')](_0x190b('0xeb'),require(_0x190b('0xec')));_0x120ddc[_0x190b('0x6')](_0x190b('0xed'),require(_0x190b('0xee')));_0x120ddc[_0x190b('0x6')](_0x190b('0xef'),require(_0x190b('0xf0')));_0x120ddc['use'](_0x190b('0xf1'),require('./api/rpc'));_0x120ddc['use'](_0x190b('0xf2'),require(_0x190b('0xf3')));_0x120ddc[_0x190b('0x6')](_0x190b('0xf4'),require(_0x190b('0xf5')));_0x120ddc[_0x190b('0x6')](_0x190b('0xf6'),require(_0x190b('0xf7')));_0x120ddc[_0x190b('0x6')](_0x190b('0xf8'),require(_0x190b('0xf9')));_0x120ddc[_0x190b('0x6')]('/api/logs',clientSideLogs);_0x120ddc[_0x190b('0x6')](_0x190b('0xfa'),express[_0x190b('0xfb')](path[_0x190b('0xfc')](config[_0x190b('0xfd')],_0x190b('0xfa'))));_0x120ddc[_0x190b('0x6')](_0x190b('0xfe'),express[_0x190b('0xfb')](path['join'](config[_0x190b('0xfd')],_0x190b('0xfe'))));_0x120ddc[_0x190b('0x6')]('/demo',express[_0x190b('0xfb')](path[_0x190b('0xfc')](config['root'],'/demo')));_0x120ddc[_0x190b('0x6')](_0x190b('0xff'),express[_0x190b('0xfb')](path[_0x190b('0xfc')](config[_0x190b('0xfd')],_0x190b('0x100'),_0x190b('0x101'))));_0x120ddc[_0x190b('0x6')](_0x190b('0x102'),express[_0x190b('0xfb')](path['join'](config[_0x190b('0xfd')],_0x190b('0x103'))));_0x120ddc[_0x190b('0x104')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x190b('0x105')](errors[0x194]);_0x120ddc[_0x190b('0x104')]('/*')[_0x190b('0x105')](function(_0x3ac90d,_0x1c5cf3){_0x1c5cf3[_0x190b('0x106')](path['resolve'](_0x120ddc[_0x190b('0x105')](_0x190b('0x107'))+'/index.html'));});return _0x120ddc;});}; \ No newline at end of file +var _0x32b6=['./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/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/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','/demo','root','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./config/environment','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x32b6,0x1d1));var _0x632b=function(_0x3351de,_0x5a2349){_0x3351de=_0x3351de-0x0;var _0x41fa11=_0x32b6[_0x3351de];return _0x41fa11;};'use strict';var path=require(_0x632b('0x0'));var express=require(_0x632b('0x1'));var errors=require('./errors');var config=require(_0x632b('0x2'));var setupLoggers=require(_0x632b('0x3'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x632b('0x4')]=function(_0x3435e8){return setupLoggers(_0x3435e8)[_0x632b('0x5')](function(){_0x3435e8[_0x632b('0x6')](_0x632b('0x7'),require(_0x632b('0x8')));_0x3435e8[_0x632b('0x6')](_0x632b('0x9'),require(_0x632b('0xa')));_0x3435e8[_0x632b('0x6')]('/api/voice/contexts',require(_0x632b('0xb')));_0x3435e8[_0x632b('0x6')](_0x632b('0xc'),require(_0x632b('0xd')));_0x3435e8['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x3435e8[_0x632b('0x6')]('/api/voice/queues',require(_0x632b('0xe')));_0x3435e8[_0x632b('0x6')](_0x632b('0xf'),require(_0x632b('0x10')));_0x3435e8[_0x632b('0x6')](_0x632b('0x11'),require(_0x632b('0x12')));_0x3435e8[_0x632b('0x6')](_0x632b('0x13'),require('./api/voiceMail'));_0x3435e8[_0x632b('0x6')](_0x632b('0x14'),require(_0x632b('0x15')));_0x3435e8['use'](_0x632b('0x16'),require(_0x632b('0x17')));_0x3435e8[_0x632b('0x6')](_0x632b('0x18'),require(_0x632b('0x19')));_0x3435e8[_0x632b('0x6')]('/api/voice/agents/reports',require(_0x632b('0x1a')));_0x3435e8['use']('/api/voice/queues/reports',require(_0x632b('0x1b')));_0x3435e8['use'](_0x632b('0x1c'),require(_0x632b('0x1d')));_0x3435e8[_0x632b('0x6')]('/api/trunks',require(_0x632b('0x1e')));_0x3435e8[_0x632b('0x6')](_0x632b('0x1f'),require(_0x632b('0x20')));_0x3435e8['use'](_0x632b('0x21'),require(_0x632b('0x22')));_0x3435e8['use'](_0x632b('0x23'),require('./api/mailAccount'));_0x3435e8['use'](_0x632b('0x24'),require('./api/mailQueue'));_0x3435e8[_0x632b('0x6')](_0x632b('0x25'),require(_0x632b('0x26')));_0x3435e8['use'](_0x632b('0x27'),require(_0x632b('0x28')));_0x3435e8['use'](_0x632b('0x29'),require(_0x632b('0x2a')));_0x3435e8[_0x632b('0x6')](_0x632b('0x2b'),require(_0x632b('0x2c')));_0x3435e8[_0x632b('0x6')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x3435e8[_0x632b('0x6')]('/api/dashboards',require(_0x632b('0x2d')));_0x3435e8[_0x632b('0x6')]('/api/dashboards/items',require(_0x632b('0x2e')));_0x3435e8[_0x632b('0x6')](_0x632b('0x2f'),require(_0x632b('0x30')));_0x3435e8[_0x632b('0x6')](_0x632b('0x31'),require(_0x632b('0x32')));_0x3435e8[_0x632b('0x6')](_0x632b('0x33'),require('./api/faxInteraction'));_0x3435e8[_0x632b('0x6')](_0x632b('0x34'),require(_0x632b('0x35')));_0x3435e8[_0x632b('0x6')](_0x632b('0x36'),require(_0x632b('0x37')));_0x3435e8[_0x632b('0x6')](_0x632b('0x38'),require(_0x632b('0x39')));_0x3435e8[_0x632b('0x6')](_0x632b('0x3a'),require(_0x632b('0x3b')));_0x3435e8[_0x632b('0x6')](_0x632b('0x3c'),require(_0x632b('0x3d')));_0x3435e8[_0x632b('0x6')](_0x632b('0x3e'),require(_0x632b('0x3f')));_0x3435e8[_0x632b('0x6')](_0x632b('0x40'),require('./api/smsMessage'));_0x3435e8[_0x632b('0x6')](_0x632b('0x41'),require(_0x632b('0x42')));_0x3435e8[_0x632b('0x6')]('/api/openchannel/accounts',require(_0x632b('0x43')));_0x3435e8['use'](_0x632b('0x44'),require(_0x632b('0x45')));_0x3435e8['use'](_0x632b('0x46'),require(_0x632b('0x47')));_0x3435e8[_0x632b('0x6')](_0x632b('0x48'),require(_0x632b('0x49')));_0x3435e8[_0x632b('0x6')](_0x632b('0x4a'),require(_0x632b('0x4b')));_0x3435e8['use']('/api/chat/websites',require(_0x632b('0x4c')));_0x3435e8[_0x632b('0x6')](_0x632b('0x4d'),require(_0x632b('0x4e')));_0x3435e8[_0x632b('0x6')](_0x632b('0x4f'),require(_0x632b('0x50')));_0x3435e8[_0x632b('0x6')]('/api/chat/interactions',require('./api/chatInteraction'));_0x3435e8[_0x632b('0x6')]('/api/chat/messages',require(_0x632b('0x51')));_0x3435e8[_0x632b('0x6')](_0x632b('0x52'),require(_0x632b('0x53')));_0x3435e8[_0x632b('0x6')](_0x632b('0x54'),require(_0x632b('0x55')));_0x3435e8[_0x632b('0x6')](_0x632b('0x56'),require(_0x632b('0x57')));_0x3435e8[_0x632b('0x6')](_0x632b('0x58'),require(_0x632b('0x59')));_0x3435e8[_0x632b('0x6')](_0x632b('0x5a'),require(_0x632b('0x5b')));_0x3435e8[_0x632b('0x6')]('/api/cm/contacts',require('./api/cmContact'));_0x3435e8['use']('/api/cm/hopper',require('./api/cmHopper'));_0x3435e8[_0x632b('0x6')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x3435e8['use'](_0x632b('0x5c'),require(_0x632b('0x5d')));_0x3435e8[_0x632b('0x6')](_0x632b('0x5e'),require('./api/cmHopperHistory'));_0x3435e8[_0x632b('0x6')](_0x632b('0x5f'),require(_0x632b('0x60')));_0x3435e8['use'](_0x632b('0x61'),require(_0x632b('0x62')));_0x3435e8[_0x632b('0x6')](_0x632b('0x63'),require(_0x632b('0x64')));_0x3435e8[_0x632b('0x6')]('/api/canned_answers',require(_0x632b('0x65')));_0x3435e8[_0x632b('0x6')](_0x632b('0x66'),require(_0x632b('0x67')));_0x3435e8['use']('/api/conditions',require(_0x632b('0x68')));_0x3435e8[_0x632b('0x6')](_0x632b('0x69'),require(_0x632b('0x6a')));_0x3435e8[_0x632b('0x6')](_0x632b('0x6b'),require('./api/pause'));_0x3435e8[_0x632b('0x6')](_0x632b('0x6c'),require(_0x632b('0x6d')));_0x3435e8[_0x632b('0x6')](_0x632b('0x6e'),require(_0x632b('0x6f')));_0x3435e8[_0x632b('0x6')](_0x632b('0x70'),require('./api/schedule'));_0x3435e8[_0x632b('0x6')]('/api/sounds',require(_0x632b('0x71')));_0x3435e8['use'](_0x632b('0x72'),require(_0x632b('0x73')));_0x3435e8[_0x632b('0x6')](_0x632b('0x74'),require(_0x632b('0x75')));_0x3435e8['use'](_0x632b('0x76'),require(_0x632b('0x77')));_0x3435e8[_0x632b('0x6')]('/api/cm_hopper_additional_phones',require(_0x632b('0x78')));_0x3435e8[_0x632b('0x6')](_0x632b('0x79'),require(_0x632b('0x7a')));_0x3435e8[_0x632b('0x6')]('/api/triggers',require(_0x632b('0x7b')));_0x3435e8['use'](_0x632b('0x7c'),require(_0x632b('0x7d')));_0x3435e8[_0x632b('0x6')](_0x632b('0x7e'),require(_0x632b('0x7f')));_0x3435e8['use']('/api/integrations/reports',require(_0x632b('0x80')));_0x3435e8[_0x632b('0x6')](_0x632b('0x81'),require(_0x632b('0x82')));_0x3435e8[_0x632b('0x6')](_0x632b('0x83'),require('./api/analyticDefaultReport'));_0x3435e8[_0x632b('0x6')](_0x632b('0x84'),require(_0x632b('0x85')));_0x3435e8['use'](_0x632b('0x86'),require(_0x632b('0x87')));_0x3435e8[_0x632b('0x6')](_0x632b('0x88'),require('./api/analyticFieldReport'));_0x3435e8[_0x632b('0x6')](_0x632b('0x89'),require(_0x632b('0x8a')));_0x3435e8[_0x632b('0x6')](_0x632b('0x8b'),require('./api/intSalesforceAccount'));_0x3435e8[_0x632b('0x6')](_0x632b('0x8c'),require(_0x632b('0x8d')));_0x3435e8[_0x632b('0x6')](_0x632b('0x8e'),require('./api/intSalesforceField'));_0x3435e8[_0x632b('0x6')](_0x632b('0x8f'),require(_0x632b('0x90')));_0x3435e8[_0x632b('0x6')](_0x632b('0x91'),require(_0x632b('0x92')));_0x3435e8[_0x632b('0x6')](_0x632b('0x93'),require(_0x632b('0x94')));_0x3435e8[_0x632b('0x6')](_0x632b('0x95'),require('./api/intDeskAccount'));_0x3435e8[_0x632b('0x6')](_0x632b('0x96'),require(_0x632b('0x97')));_0x3435e8[_0x632b('0x6')](_0x632b('0x98'),require('./api/intDeskField'));_0x3435e8[_0x632b('0x6')](_0x632b('0x99'),require(_0x632b('0x9a')));_0x3435e8[_0x632b('0x6')](_0x632b('0x9b'),require(_0x632b('0x9c')));_0x3435e8[_0x632b('0x6')]('/api/integrations/zoho/fields',require(_0x632b('0x9d')));_0x3435e8['use'](_0x632b('0x9e'),require('./api/intZendeskAccount'));_0x3435e8[_0x632b('0x6')]('/api/integrations/zendesk/configurations',require(_0x632b('0x9f')));_0x3435e8[_0x632b('0x6')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x3435e8[_0x632b('0x6')](_0x632b('0xa0'),require(_0x632b('0xa1')));_0x3435e8[_0x632b('0x6')]('/api/integrations/freshdesk/configurations',require(_0x632b('0xa2')));_0x3435e8[_0x632b('0x6')]('/api/integrations/freshdesk/fields',require(_0x632b('0xa3')));_0x3435e8['use'](_0x632b('0xa4'),require(_0x632b('0xa5')));_0x3435e8['use'](_0x632b('0xa6'),require(_0x632b('0xa7')));_0x3435e8[_0x632b('0x6')](_0x632b('0xa8'),require('./api/intVtigerField'));_0x3435e8[_0x632b('0x6')](_0x632b('0xa9'),require(_0x632b('0xaa')));_0x3435e8[_0x632b('0x6')]('/api/integrations/servicenow/configurations',require(_0x632b('0xab')));_0x3435e8[_0x632b('0x6')](_0x632b('0xac'),require(_0x632b('0xad')));_0x3435e8[_0x632b('0x6')](_0x632b('0xae'),require('./api/intDynamics365Account'));_0x3435e8[_0x632b('0x6')](_0x632b('0xaf'),require(_0x632b('0xb0')));_0x3435e8['use']('/api/integrations/dynamics365/fields',require(_0x632b('0xb1')));_0x3435e8[_0x632b('0x6')](_0x632b('0xb2'),require(_0x632b('0xb3')));_0x3435e8[_0x632b('0x6')](_0x632b('0xb4'),require(_0x632b('0xb5')));_0x3435e8['use'](_0x632b('0xb6'),require(_0x632b('0xb7')));_0x3435e8[_0x632b('0x6')](_0x632b('0xb8'),require(_0x632b('0xb9')));_0x3435e8[_0x632b('0x6')]('/api/chat/reports/queue',require(_0x632b('0xba')));_0x3435e8[_0x632b('0x6')](_0x632b('0xbb'),require(_0x632b('0xbc')));_0x3435e8['use'](_0x632b('0xbd'),require(_0x632b('0xbe')));_0x3435e8[_0x632b('0x6')]('/api/jscripty/questions/reports',require(_0x632b('0xbf')));_0x3435e8[_0x632b('0x6')](_0x632b('0xc0'),require(_0x632b('0xc1')));_0x3435e8[_0x632b('0x6')](_0x632b('0xc2'),require('./api/smsQueueReport'));_0x3435e8[_0x632b('0x6')](_0x632b('0xc3'),require('./api/squareReport'));_0x3435e8['use']('/api/square/details/reports',require(_0x632b('0xc4')));_0x3435e8[_0x632b('0x6')](_0x632b('0xc5'),require(_0x632b('0xc6')));_0x3435e8[_0x632b('0x6')]('/api/settings',require('./api/setting'));_0x3435e8[_0x632b('0x6')](_0x632b('0xc7'),require('./api/squareOdbc'));_0x3435e8['use'](_0x632b('0xc8'),require(_0x632b('0xc9')));_0x3435e8['use'](_0x632b('0xca'),require(_0x632b('0xcb')));_0x3435e8[_0x632b('0x6')]('/api/square/messages',require('./api/squareMessage'));_0x3435e8['use'](_0x632b('0xcc'),require(_0x632b('0xcd')));_0x3435e8[_0x632b('0x6')]('/api/license',require('./api/license'));_0x3435e8['use'](_0x632b('0xce'),require('./api/campaign'));_0x3435e8[_0x632b('0x6')](_0x632b('0xcf'),require(_0x632b('0xd0')));_0x3435e8[_0x632b('0x6')](_0x632b('0xd1'),require(_0x632b('0xd2')));_0x3435e8[_0x632b('0x6')](_0x632b('0xd3'),require(_0x632b('0xd4')));_0x3435e8[_0x632b('0x6')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x3435e8[_0x632b('0x6')]('/api/chat/reports/transfer',require(_0x632b('0xd5')));_0x3435e8[_0x632b('0x6')](_0x632b('0xd6'),require(_0x632b('0xd7')));_0x3435e8['use'](_0x632b('0xd8'),require('./api/openchannelTransferReport'));_0x3435e8['use']('/api/sms/reports/transfer',require(_0x632b('0xd9')));_0x3435e8['use'](_0x632b('0xda'),require(_0x632b('0xdb')));_0x3435e8[_0x632b('0x6')](_0x632b('0xdc'),require(_0x632b('0xdd')));_0x3435e8['use']('/api/userProfiles',require(_0x632b('0xde')));_0x3435e8[_0x632b('0x6')](_0x632b('0xdf'),require(_0x632b('0xe0')));_0x3435e8[_0x632b('0x6')](_0x632b('0xe1'),require(_0x632b('0xe2')));_0x3435e8['use'](_0x632b('0xe3'),require(_0x632b('0xe4')));_0x3435e8['use']('/api/whatsapp/accounts',require(_0x632b('0xe5')));_0x3435e8['use']('/api/whatsapp/applications',require(_0x632b('0xe6')));_0x3435e8['use'](_0x632b('0xe7'),require('./api/whatsappInteraction'));_0x3435e8[_0x632b('0x6')]('/api/whatsapp/messages',require(_0x632b('0xe8')));_0x3435e8[_0x632b('0x6')]('/api/whatsapp/reports/queue',require(_0x632b('0xe9')));_0x3435e8[_0x632b('0x6')](_0x632b('0xea'),require(_0x632b('0xeb')));_0x3435e8[_0x632b('0x6')](_0x632b('0xec'),require(_0x632b('0xed')));_0x3435e8[_0x632b('0x6')]('/api/cloudProviders',require('./api/cloudProvider'));_0x3435e8[_0x632b('0x6')](_0x632b('0xee'),require(_0x632b('0xef')));_0x3435e8[_0x632b('0x6')](_0x632b('0xf0'),require(_0x632b('0xf1')));_0x3435e8['use'](_0x632b('0xf2'),require('./api/mailInteractionHasTag'));_0x3435e8[_0x632b('0x6')]('/api/auth/local',require(_0x632b('0xf3')));_0x3435e8[_0x632b('0x6')](_0x632b('0xf4'),require(_0x632b('0xf5')));_0x3435e8['use'](_0x632b('0xf6'),require(_0x632b('0xf7')));_0x3435e8['use'](_0x632b('0xf8'),require(_0x632b('0xf9')));_0x3435e8[_0x632b('0x6')](_0x632b('0xfa'),require(_0x632b('0xfb')));_0x3435e8['use'](_0x632b('0xfc'),require(_0x632b('0xfd')));_0x3435e8['use'](_0x632b('0xfe'),require('./api/system'));_0x3435e8[_0x632b('0x6')]('/api/pm2',require(_0x632b('0xff')));_0x3435e8['use'](_0x632b('0x100'),require(_0x632b('0x101')));_0x3435e8[_0x632b('0x6')](_0x632b('0x102'),clientSideLogs);_0x3435e8[_0x632b('0x6')]('/apidoc',express[_0x632b('0x103')](path[_0x632b('0x104')](config['root'],_0x632b('0x105'))));_0x3435e8['use'](_0x632b('0x106'),express['static'](path[_0x632b('0x104')](config['root'],_0x632b('0x106'))));_0x3435e8[_0x632b('0x6')](_0x632b('0x107'),express['static'](path[_0x632b('0x104')](config[_0x632b('0x108')],_0x632b('0x107'))));_0x3435e8[_0x632b('0x6')](_0x632b('0x109'),express[_0x632b('0x103')](path[_0x632b('0x104')](config[_0x632b('0x108')],_0x632b('0x10a'),_0x632b('0x10b'))));_0x3435e8[_0x632b('0x6')](_0x632b('0x10c'),express[_0x632b('0x103')](path['join'](config[_0x632b('0x108')],_0x632b('0x10d'))));_0x3435e8[_0x632b('0x10e')](_0x632b('0x10f'))[_0x632b('0x110')](errors[0x194]);_0x3435e8[_0x632b('0x10e')]('/*')[_0x632b('0x110')](function(_0xade1af,_0x191991){_0x191991[_0x632b('0x111')](path[_0x632b('0x112')](_0x3435e8[_0x632b('0x110')]('appPath')+_0x632b('0x113')));});return _0x3435e8;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c28cfa8..9eab237 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a7=['../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/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/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.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','server','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc'];(function(_0x497fd3,_0xf9207e){var _0x1558a0=function(_0x2c2ed0){while(--_0x2c2ed0){_0x497fd3['push'](_0x497fd3['shift']());}};_0x1558a0(++_0xf9207e);}(_0xb9a7,0x172));var _0x7b9a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb9a7[_0x36c5b0];return _0xf19333;};'use strict';var jayson=require(_0x7b9a('0x0'));var _=require('lodash');var config=require(_0x7b9a('0x1'));exports[_0x7b9a('0x2')]=function(){return new Promise(function(_0x17d7b5,_0x24662f){var _0x11e127={};_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x4')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x5')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x6')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x7')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x8')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x9')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xa')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xb')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xc')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0xd')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xe')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xf')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x10')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/mailMessage/mailMessage.rpc'));_0x11e127=_['merge'](_0x11e127,require('../api/mailApplication/mailApplication.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x11')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x12')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x13')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x14')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x15')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x16')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x17')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x18')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/smsInteraction/smsInteraction.rpc'));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x19')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x1a')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x1b')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x1c')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x1d')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x1e')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x1f')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/chatInteraction/chatInteraction.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/chatMessage/chatMessage.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x20')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x21')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x22')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x23')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x24')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x25')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x26')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x27')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x28')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/sound/sound.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x29')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x2a')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/trigger/trigger.rpc'));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x2b')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x2c')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x2d')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x2e')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x2f')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x30')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x31')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x32')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x33')));_0x11e127=_['merge'](_0x11e127,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x34')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x35')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x36')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/squareReport/squareReport.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x37')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x38')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/squareOdbc/squareOdbc.rpc'));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x39')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x3a')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3b')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3c')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3d')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3e')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3f')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x40')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x41')));_0x11e127=_['merge'](_0x11e127,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x333b76=jayson[_0x7b9a('0x42')](_0x11e127)['http']();var _0x41be80=config[_0x7b9a('0x43')][_0x7b9a('0x44')]||config[_0x7b9a('0x44')]+0x1;var _0x16476a=config[_0x7b9a('0x43')]['ip']||'localhost';_0x333b76['on'](_0x7b9a('0x45'),function(_0x917668){return _0x24662f(_0x917668);});_0x333b76[_0x7b9a('0x2')](_0x41be80,_0x16476a,function(){console[_0x7b9a('0x46')](_0x7b9a('0x47'),_0x16476a,_0x41be80);require(_0x7b9a('0x48'))[_0x7b9a('0x49')]();return _0x17d7b5(_0x7b9a('0x4a')+_0x16476a+':'+_0x41be80);});});}; \ No newline at end of file +var _0x9a4e=['../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','port','rpc','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x373d5f,_0x52c008){var _0x56aed6=function(_0x424c98){while(--_0x424c98){_0x373d5f['push'](_0x373d5f['shift']());}};_0x56aed6(++_0x52c008);}(_0x9a4e,0x158));var _0xe9a4=function(_0x4dda0b,_0x18c805){_0x4dda0b=_0x4dda0b-0x0;var _0x1c9001=_0x9a4e[_0x4dda0b];return _0x1c9001;};'use strict';var jayson=require(_0xe9a4('0x0'));var _=require(_0xe9a4('0x1'));var config=require(_0xe9a4('0x2'));exports['listen']=function(){return new Promise(function(_0x5a1003,_0x575295){var _0x46231f={};_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x3')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/voiceExtension/voiceExtension.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x5')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x6')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x7')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x8')));_0x46231f=_['merge'](_0x46231f,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x9')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/memberReport/memberReport.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0xa')));_0x46231f=_['merge'](_0x46231f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0xb')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0xc')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0xd')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0xe')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0xf')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x10')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x11')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x12')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x13')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x14')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/faxInteraction/faxInteraction.rpc'));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x15')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x16')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x17')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x18')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x19')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x1a')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x1b')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x1c')));_0x46231f=_['merge'](_0x46231f,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x1d')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x1e')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x1f')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x20')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x21')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x22')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x23')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x24')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x25')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x26')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x27')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x28')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x29')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x2a')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x2b')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x2c')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x2d')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x2e')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x2f')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x30')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x31')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x32')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x33')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x34')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x35')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x36')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x37')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x38')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x39')));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x3a')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x3b')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x3c')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/squareProject/squareProject.rpc'));_0x46231f=_['merge'](_0x46231f,require(_0xe9a4('0x3d')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/squareMessage/squareMessage.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x3e')));_0x46231f=_['merge'](_0x46231f,require('../api/attachment/attachment.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x3f')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x40')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x41')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require(_0xe9a4('0x42')));_0x46231f=_[_0xe9a4('0x4')](_0x46231f,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0xaf0f74=jayson['server'](_0x46231f)[_0xe9a4('0x43')]();var _0x13488d=config['rpc'][_0xe9a4('0x44')]||config[_0xe9a4('0x44')]+0x1;var _0x3ddbf7=config[_0xe9a4('0x45')]['ip']||_0xe9a4('0x46');_0xaf0f74['on'](_0xe9a4('0x47'),function(_0x3c59f3){return _0x575295(_0x3c59f3);});_0xaf0f74[_0xe9a4('0x48')](_0x13488d,_0x3ddbf7,function(){console[_0xe9a4('0x49')](_0xe9a4('0x4a'),_0x3ddbf7,_0x13488d);require(_0xe9a4('0x4b'))[_0xe9a4('0x4c')]();return _0x5a1003(_0xe9a4('0x4d')+_0x3ddbf7+':'+_0x13488d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8595384..b3ff462 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 _0x36d4=['GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','hangup','search','function','substring','no\x20code','replace','result=','indexOf','startsWith','length','match','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','write','inherits','prototype','sendRequest','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable'];(function(_0x2ebc49,_0x233068){var _0x2acd77=function(_0x18ba79){while(--_0x18ba79){_0x2ebc49['push'](_0x2ebc49['shift']());}};_0x2acd77(++_0x233068);}(_0x36d4,0x17d));var _0x436d=function(_0x2f023d,_0x29dfe5){_0x2f023d=_0x2f023d-0x0;var _0x4ef240=_0x36d4[_0x2f023d];return _0x4ef240;};'use strict';var util=require(_0x436d('0x0'));var _=require(_0x436d('0x1'));var EventEmitter=require(_0x436d('0x2'))[_0x436d('0x3')];var AGIReply=require(_0x436d('0x4'));var AGIError=require(_0x436d('0x5'));function AGIChannel(_0x47c5e3){var _0x296d0a=this,_0x29af36=new AGIReply(),_0x201144=![],_0x8250e6={};EventEmitter[_0x436d('0x6')](_0x296d0a);_0x47c5e3['setEncoding'](_0x436d('0x7'));_0x47c5e3[_0x436d('0x8')](0x8*0x3c*0x3c*0x3e8);_0x29af36[_0x436d('0x9')](_0x436d('0x7'));_0x29af36['on'](_0x436d('0xa'),function(_0x29603a){for(var _0x13d8f6 in _0x29603a){_0x296d0a[_0x13d8f6]=_0x29603a[_0x13d8f6];}_0x296d0a[_0x436d('0xb')](_0x436d('0xc'));});_0x29af36['on']('line',function(_0x1e7813){if(_0x1e7813['toLowerCase']()==_0x436d('0xd')){_0x296d0a[_0x436d('0xb')](_0x436d('0xd'));return;}if(_0x1e7813['substring'](0x0,0xb)=='520-Invalid'){_0x201144=!![];}if(_0x201144){_0x8250e6['rx']+=_0x1e7813+'\x0a';if(_0x1e7813[_0x436d('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x201144=![];}}else{_0x8250e6['rx']=_0x1e7813;}if(_0x201144){return;}if(typeof _0x8250e6['cb']==_0x436d('0xf')){var _0x118d4b=_0x8250e6['rx'][_0x436d('0x10')](0x0,0x3),_0x1fd9cd=null,_0x13965f=null;_0x118d4b=parseInt(_0x118d4b);if(isNaN(_0x118d4b)){_0x8250e6['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x436d('0x11')});return;}if(_0x118d4b!=0xc8){_0x8250e6['cb'](null,{'code':_0x118d4b,'result':-0x1,'extra':'KO'});return;}_0x1fd9cd=_0x8250e6['rx'][_0x436d('0x10')](0x4)[_0x436d('0x12')](_0x436d('0x13'),'');if(_0x1fd9cd['indexOf']('\x20')!=-0x1){_0x1fd9cd=_0x1fd9cd['substr'](0x0,_0x1fd9cd[_0x436d('0x14')]('\x20'));}if(_[_0x436d('0x15')](_0x1fd9cd,'-1')){_0x1fd9cd=parseInt(_0x1fd9cd);}_0x13965f=_0x8250e6['rx']['split']('\x20');if(_0x13965f[_0x436d('0x16')]==0x3){_0x13965f=_0x13965f[0x2][_0x436d('0x10')](0x1,_0x13965f[0x2][_0x436d('0x16')]-0x1);}else if(_0x13965f[_0x436d('0x16')]>0x3){var _0x1a1fc4=/\((.+)\)/;var _0x28f073=_0x8250e6['rx'][_0x436d('0x17')](_0x1a1fc4);if(_0x28f073){_0x13965f=_0x28f073[0x1];}else{_0x13965f=null;}}else{_0x13965f=null;}_0x8250e6['cb'](null,{'code':_0x118d4b,'result':_0x1fd9cd,'extra':_0x13965f});}});_0x47c5e3['on'](_0x436d('0x18'),function(_0x3c0056){_0x296d0a[_0x436d('0xb')](_0x436d('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x3c0056['code']));});_0x47c5e3['on'](_0x436d('0x19'),function(){_0x296d0a[_0x436d('0xb')](_0x436d('0x19'),new AGIError(_0x436d('0x1a')));});_0x47c5e3['on'](_0x436d('0x1b'),function(){_0x296d0a[_0x436d('0xb')]('timeout',new AGIError(_0x436d('0x1c')));_0x47c5e3['destroy']();});_0x47c5e3[_0x436d('0x1d')](_0x29af36);this['command']=function(_0x3a2019,_0x128f23){var _0x3a2019=_0x3a2019||'',_0x128f23=typeof _0x128f23==_0x436d('0xf')?_0x128f23:new Function();_0x8250e6={'tx':_0x3a2019,'rx':'','cb':_0x128f23};_0x47c5e3[_0x436d('0x1e')](_0x3a2019+'\x0a');},this[_0x436d('0x19')]=function(){_0x47c5e3['destroy']();};}util[_0x436d('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x436d('0x20')][_0x436d('0x21')]=function(_0x5a5ebd){return this['command']['sync'](this,_0x5a5ebd);};AGIChannel['prototype'][_0x436d('0x22')]=function(){return this['sendRequest'](_0x436d('0x23'));};AGIChannel[_0x436d('0x20')]['getData']=function(_0x42b7af,_0x4f4320,_0x545ca5){_0x42b7af=_0x42b7af===undefined?_0x436d('0x24'):_0x42b7af;_0x4f4320=_0x4f4320===undefined?'5':_0x4f4320;_0x545ca5=_0x545ca5===undefined?'1':_0x545ca5;return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x26'),_0x42b7af,_0x4f4320*0x3e8,_0x545ca5));};AGIChannel[_0x436d('0x20')][_0x436d('0x27')]=function(_0x289ef5){_0x289ef5=_0x289ef5||'NO\x20MESSAGE';return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x28'),_0x289ef5));};AGIChannel[_0x436d('0x20')][_0x436d('0x29')]=function(_0x46d447,_0x2002bd){if(_[_0x436d('0x2a')](_0x2002bd)){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x2b'),_0x46d447,_0x2002bd['join'](',')));}return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x2b'),_0x46d447,_0x2002bd));};AGIChannel[_0x436d('0x20')][_0x436d('0x2c')]=function(_0x44ca84){return this[_0x436d('0x21')](util[_0x436d('0x25')]('SET\x20CONTEXT\x20%s',_0x44ca84));};AGIChannel['prototype']['setExtension']=function(_0x494c4e){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x2d'),_0x494c4e));};AGIChannel[_0x436d('0x20')][_0x436d('0x2e')]=function(_0x3eef7d){return this['sendRequest'](util[_0x436d('0x25')](_0x436d('0x2f'),_0x3eef7d));};AGIChannel[_0x436d('0x20')][_0x436d('0xd')]=function(){return this['sendRequest'](_0x436d('0x30'));};AGIChannel['prototype']['setVariable']=function(_0x586289,_0x2be28){var _0x25f486=_[_0x436d('0x31')](_0x2be28)||_[_0x436d('0x32')](_0x2be28)?_0x2be28[_0x436d('0x33')]():_0x2be28;return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x34'),_0x586289,_0x25f486?_0x25f486[_0x436d('0x33')]()[_0x436d('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x436d('0x20')][_0x436d('0x35')]=function(_0x453164,_0x5b9ab4){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x36'),_0x453164,_0x5b9ab4));};AGIChannel[_0x436d('0x20')][_0x436d('0x37')]=function(_0x1027a9,_0x5385f4){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x38'),_0x1027a9,_0x5385f4));};AGIChannel[_0x436d('0x20')][_0x436d('0x39')]=function(_0x1f1245,_0x36a557){return this['sendRequest'](util['format'](_0x436d('0x3a'),_0x1f1245,_0x36a557));};AGIChannel[_0x436d('0x20')]['continueAt']=function(_0x2e519f,_0x279461,_0x895037){_0x279461=_0x279461||this[_0x436d('0x3b')];_0x895037=_0x895037||0x1;this[_0x436d('0x2c')](_0x2e519f);this[_0x436d('0x3c')](_0x279461);this[_0x436d('0x2e')](_0x895037);return this[_0x436d('0x27')](util[_0x436d('0x25')](_0x436d('0x3d'),_0x2e519f,_0x279461,_0x895037));};AGIChannel[_0x436d('0x20')][_0x436d('0x3e')]=function(_0x78e781){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x3f'),_0x78e781));};AGIChannel['prototype'][_0x436d('0x40')]=function(_0x4129e6,_0x257be1,_0x3f0c3d,_0x2bc227,_0x1bb171,_0x200baf){_0x257be1=_0x257be1||'wav';_0x3f0c3d=_0x3f0c3d||'';_0x2bc227=_0x2bc227===undefined?-0x1:_0x2bc227==='-1'?-0x1:_0x2bc227*0x3e8;_0x1bb171=_0x1bb171===undefined?'':'s='+_0x1bb171;_0x200baf=_0x200baf?'BEEP':'';return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x41'),_0x4129e6,_0x257be1,_0x3f0c3d,_0x2bc227,_0x200baf,_0x1bb171));};AGIChannel[_0x436d('0x20')][_0x436d('0x42')]=function(_0x36fc4b,_0x3e773a){_0x3e773a=_0x3e773a||'';return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x43'),_0x36fc4b,_0x3e773a));};AGIChannel[_0x436d('0x20')]['agi']=function(_0x32fc69){return this['exec'](_0x436d('0x44'),_0x32fc69);};AGIChannel[_0x436d('0x20')][_0x436d('0x45')]=function(_0x1bf8c4){return this[_0x436d('0x29')](_0x436d('0x46'),_0x1bf8c4);};AGIChannel[_0x436d('0x20')][_0x436d('0x18')]=function(_0x1236ca,_0x2e367f){this[_0x436d('0x27')](util[_0x436d('0x25')](_0x436d('0x47'),_0x1236ca['id'],_0x1236ca[_0x436d('0x48')],_0x2e367f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x436d('0x49')]=AGIChannel; \ No newline at end of file +var _0xb9a7=['E_AGI_SOCKET_TIMEOUT','pipe','write','destroy','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec','wait','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','function','substring','no\x20code','replace','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x41a596,_0x9963c){var _0x48cad1=function(_0x48736e){while(--_0x48736e){_0x41a596['push'](_0x41a596['shift']());}};_0x48cad1(++_0x9963c);}(_0xb9a7,0x172));var _0x7b9a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xb9a7[_0x255d5b];return _0x3e141a;};'use strict';var util=require(_0x7b9a('0x0'));var _=require('lodash');var EventEmitter=require(_0x7b9a('0x1'))[_0x7b9a('0x2')];var AGIReply=require(_0x7b9a('0x3'));var AGIError=require(_0x7b9a('0x4'));function AGIChannel(_0x11e127){var _0x105930=this,_0x2528b2=new AGIReply(),_0x25d6eb=![],_0x400af1={};EventEmitter[_0x7b9a('0x5')](_0x105930);_0x11e127[_0x7b9a('0x6')](_0x7b9a('0x7'));_0x11e127[_0x7b9a('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2528b2[_0x7b9a('0x6')](_0x7b9a('0x7'));_0x2528b2['on'](_0x7b9a('0x9'),function(_0x5a0e8b){for(var _0xaff1b7 in _0x5a0e8b){_0x105930[_0xaff1b7]=_0x5a0e8b[_0xaff1b7];}_0x105930[_0x7b9a('0xa')](_0x7b9a('0xb'));});_0x2528b2['on'](_0x7b9a('0xc'),function(_0x34af95){if(_0x34af95[_0x7b9a('0xd')]()==_0x7b9a('0xe')){_0x105930[_0x7b9a('0xa')](_0x7b9a('0xe'));return;}if(_0x34af95['substring'](0x0,0xb)==_0x7b9a('0xf')){_0x25d6eb=!![];}if(_0x25d6eb){_0x400af1['rx']+=_0x34af95+'\x0a';if(_0x34af95['search']('520\x20End\x20of\x20proper')!=-0x1){_0x25d6eb=![];}}else{_0x400af1['rx']=_0x34af95;}if(_0x25d6eb){return;}if(typeof _0x400af1['cb']==_0x7b9a('0x10')){var _0x1c5bcd=_0x400af1['rx'][_0x7b9a('0x11')](0x0,0x3),_0x339769=null,_0x293242=null;_0x1c5bcd=parseInt(_0x1c5bcd);if(isNaN(_0x1c5bcd)){_0x400af1['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7b9a('0x12')});return;}if(_0x1c5bcd!=0xc8){_0x400af1['cb'](null,{'code':_0x1c5bcd,'result':-0x1,'extra':'KO'});return;}_0x339769=_0x400af1['rx'][_0x7b9a('0x11')](0x4)[_0x7b9a('0x13')]('result=','');if(_0x339769['indexOf']('\x20')!=-0x1){_0x339769=_0x339769['substr'](0x0,_0x339769[_0x7b9a('0x14')]('\x20'));}if(_[_0x7b9a('0x15')](_0x339769,'-1')){_0x339769=parseInt(_0x339769);}_0x293242=_0x400af1['rx'][_0x7b9a('0x16')]('\x20');if(_0x293242[_0x7b9a('0x17')]==0x3){_0x293242=_0x293242[0x2]['substring'](0x1,_0x293242[0x2][_0x7b9a('0x17')]-0x1);}else if(_0x293242['length']>0x3){var _0x405172=/\((.+)\)/;var _0x842475=_0x400af1['rx'][_0x7b9a('0x18')](_0x405172);if(_0x842475){_0x293242=_0x842475[0x1];}else{_0x293242=null;}}else{_0x293242=null;}_0x400af1['cb'](null,{'code':_0x1c5bcd,'result':_0x339769,'extra':_0x293242});}});_0x11e127['on']('error',function(_0xa8d93d){_0x105930[_0x7b9a('0xa')](_0x7b9a('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0xa8d93d[_0x7b9a('0x1a')]));});_0x11e127['on'](_0x7b9a('0x1b'),function(){_0x105930['emit']('close',new AGIError(_0x7b9a('0x1c')));});_0x11e127['on'](_0x7b9a('0x1d'),function(){_0x105930[_0x7b9a('0xa')](_0x7b9a('0x1d'),new AGIError(_0x7b9a('0x1e')));_0x11e127['destroy']();});_0x11e127[_0x7b9a('0x1f')](_0x2528b2);this['command']=function(_0x1cb0a6,_0x413180){var _0x1cb0a6=_0x1cb0a6||'',_0x413180=typeof _0x413180==_0x7b9a('0x10')?_0x413180:new Function();_0x400af1={'tx':_0x1cb0a6,'rx':'','cb':_0x413180};_0x11e127[_0x7b9a('0x20')](_0x1cb0a6+'\x0a');},this['close']=function(){_0x11e127[_0x7b9a('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x23')]=function(_0x28a484){return this[_0x7b9a('0x24')][_0x7b9a('0x25')](this,_0x28a484);};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x26')]=function(){return this[_0x7b9a('0x23')](_0x7b9a('0x27'));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x28')]=function(_0x365373,_0x346eab,_0x2c92d5){_0x365373=_0x365373===undefined?_0x7b9a('0x29'):_0x365373;_0x346eab=_0x346eab===undefined?'5':_0x346eab;_0x2c92d5=_0x2c92d5===undefined?'1':_0x2c92d5;return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')](_0x7b9a('0x2b'),_0x365373,_0x346eab*0x3e8,_0x2c92d5));};AGIChannel[_0x7b9a('0x22')]['noop']=function(_0x3916e7){_0x3916e7=_0x3916e7||_0x7b9a('0x2c');return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')](_0x7b9a('0x2d'),_0x3916e7));};AGIChannel['prototype']['exec']=function(_0x112dc1,_0x12db92){if(_[_0x7b9a('0x2e')](_0x12db92)){return this['sendRequest'](util[_0x7b9a('0x2a')](_0x7b9a('0x2f'),_0x112dc1,_0x12db92[_0x7b9a('0x30')](',')));}return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')](_0x7b9a('0x2f'),_0x112dc1,_0x12db92));};AGIChannel[_0x7b9a('0x22')]['setContext']=function(_0x188424){return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')]('SET\x20CONTEXT\x20%s',_0x188424));};AGIChannel[_0x7b9a('0x22')]['setExtension']=function(_0x4b4c2a){return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')](_0x7b9a('0x31'),_0x4b4c2a));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x32')]=function(_0x386f21){return this[_0x7b9a('0x23')](util['format'](_0x7b9a('0x33'),_0x386f21));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0xe')]=function(){return this[_0x7b9a('0x23')](_0x7b9a('0x34'));};AGIChannel['prototype']['setVariable']=function(_0x26f3ac,_0x5448a8){var _0x1c2f5b=_[_0x7b9a('0x35')](_0x5448a8)||_[_0x7b9a('0x36')](_0x5448a8)?_0x5448a8[_0x7b9a('0x37')]():_0x5448a8;return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')](_0x7b9a('0x38'),_0x26f3ac,_0x1c2f5b?_0x1c2f5b[_0x7b9a('0x37')]()[_0x7b9a('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x39')]=function(_0x4ef84c,_0x288067){return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x4ef84c,_0x288067));};AGIChannel['prototype'][_0x7b9a('0x3a')]=function(_0x50fbf7,_0x333b76){return this[_0x7b9a('0x23')](util['format'](_0x7b9a('0x3b'),_0x50fbf7,_0x333b76));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x3c')]=function(_0x32a099,_0x16476a){return this[_0x7b9a('0x23')](util['format'](_0x7b9a('0x3d'),_0x32a099,_0x16476a));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x3e')]=function(_0x1097b6,_0xb5a85e,_0x2761f2){_0xb5a85e=_0xb5a85e||this[_0x7b9a('0x3f')];_0x2761f2=_0x2761f2||0x1;this[_0x7b9a('0x40')](_0x1097b6);this[_0x7b9a('0x41')](_0xb5a85e);this[_0x7b9a('0x32')](_0x2761f2);return this['noop'](util[_0x7b9a('0x2a')](_0x7b9a('0x42'),_0x1097b6,_0xb5a85e,_0x2761f2));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x43')]=function(_0x1ce24b){return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1ce24b));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x44')]=function(_0x4fe8df,_0x59e772,_0x530fa1,_0x5f04fd,_0x2b618d,_0x1e841b){_0x59e772=_0x59e772||_0x7b9a('0x45');_0x530fa1=_0x530fa1||'';_0x5f04fd=_0x5f04fd===undefined?-0x1:_0x5f04fd==='-1'?-0x1:_0x5f04fd*0x3e8;_0x2b618d=_0x2b618d===undefined?'':'s='+_0x2b618d;_0x1e841b=_0x1e841b?_0x7b9a('0x46'):'';return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')](_0x7b9a('0x47'),_0x4fe8df,_0x59e772,_0x530fa1,_0x5f04fd,_0x1e841b,_0x2b618d));};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x48')]=function(_0x3b03bb,_0x1b6105){_0x1b6105=_0x1b6105||'';return this[_0x7b9a('0x23')](util[_0x7b9a('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3b03bb,_0x1b6105));};AGIChannel['prototype'][_0x7b9a('0x49')]=function(_0x5478c3){return this[_0x7b9a('0x4a')]('AGI',_0x5478c3);};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x4b')]=function(_0x5bf43f){return this[_0x7b9a('0x4a')]('WAIT',_0x5bf43f);};AGIChannel[_0x7b9a('0x22')][_0x7b9a('0x19')]=function(_0xd726b6,_0x26c00a){this[_0x7b9a('0x4c')](util[_0x7b9a('0x2a')](_0x7b9a('0x4d'),_0xd726b6['id'],_0xd726b6[_0x7b9a('0x4e')],_0x26c00a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7b9a('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d8134a9..ae4fc2d 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 _0x15b7=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name'];(function(_0x952e5f,_0x3f3088){var _0x1e005f=function(_0x5b1a4c){while(--_0x5b1a4c){_0x952e5f['push'](_0x952e5f['shift']());}};_0x1e005f(++_0x3f3088);}(_0x15b7,0x142));var _0x715b=function(_0x1cc588,_0x3fe81d){_0x1cc588=_0x1cc588-0x0;var _0x528307=_0x15b7[_0x1cc588];return _0x528307;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x715b('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x715b('0x1'),'E_AGI_SERVER_CLOSE':_0x715b('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x715b('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x715b('0x4'),'E_AGI_SOCKET_ERROR':_0x715b('0x5'),'E_AGI_SOCKET_CLOSE':_0x715b('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x715b('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x715b('0x8')};function AGIError(_0x1f2742){var _0x1f2742=_0x1f2742||null,_0x3af951=_0x3af951||[],_0x40d46c=0x1,_0x19d35f='';if(!error[_0x1f2742]){_0x1f2742='E_AGI_UNDEFINED';}_0x3af951[_0x715b('0x9')](error[_0x1f2742]);while(arguments[_0x40d46c]){_0x3af951[_0x715b('0x9')](arguments[_0x40d46c]);_0x40d46c++;}_0x19d35f=util[_0x715b('0xa')][_0x715b('0xb')](util,_0x3af951);this[_0x715b('0xc')]=_0x19d35f;this[_0x715b('0xd')]=_0x1f2742;}module['exports']=AGIError; \ No newline at end of file +var _0x77e1=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x77e1,0xaf));var _0x177e=function(_0x13bead,_0x17bddc){_0x13bead=_0x13bead-0x0;var _0x12e9d7=_0x77e1[_0x13bead];return _0x12e9d7;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x177e('0x0'),'E_AGI_SERVER_CLOSE':_0x177e('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x177e('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x177e('0x3'),'E_AGI_SOCKET_ERROR':_0x177e('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x177e('0x5'),'E_AGI_COMMAND_EMPTY':_0x177e('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x177e('0x7')};function AGIError(_0x4dcfb4){var _0x4dcfb4=_0x4dcfb4||null,_0x4b7ca3=_0x4b7ca3||[],_0xd1af06=0x1,_0x127e6a='';if(!error[_0x4dcfb4]){_0x4dcfb4=_0x177e('0x8');}_0x4b7ca3[_0x177e('0x9')](error[_0x4dcfb4]);while(arguments[_0xd1af06]){_0x4b7ca3['push'](arguments[_0xd1af06]);_0xd1af06++;}_0x127e6a=util[_0x177e('0xa')][_0x177e('0xb')](util,_0x4b7ca3);this['message']=_0x127e6a;this['name']=_0x4dcfb4;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index d013729..f5561ab 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 _0x7bd6=['emit','error','message','agi','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7bd6,0x1a9));var _0x67bd=function(_0x3fa631,_0x24392c){_0x3fa631=_0x3fa631-0x0;var _0x5c9dec=_0x7bd6[_0x3fa631];return _0x5c9dec;};'use strict';var _=require(_0x67bd('0x0'));var EventEmitter=require(_0x67bd('0x1'))[_0x67bd('0x2')];var Redis=require(_0x67bd('0x3'));var AGIError=require(_0x67bd('0x4'));var config=require(_0x67bd('0x5'));config[_0x67bd('0x6')]=_[_0x67bd('0x7')](config[_0x67bd('0x6')],{'host':_0x67bd('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x67bd('0x6')]);sub[_0x67bd('0x9')]('agi',function(_0x140552){if(_0x140552)return eventEmitter[_0x67bd('0xa')](_0x67bd('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x140552));});sub['on'](_0x67bd('0xc'),function(_0x57ec98,_0x48b14c){if(_0x57ec98!==_0x67bd('0xd'))return;try{var _0x70c322=JSON['parse'](_0x48b14c);eventEmitter[_0x67bd('0xa')]('projectUpdate',_0x70c322);}catch(_0x3f0d82){eventEmitter['emit'](_0x67bd('0xb'),new AGIError(_0x67bd('0xe'),_0x3f0d82));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7f05=['./error','../../config/environment','redis','defaults','localhost','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','lodash','events','EventEmitter'];(function(_0x21f01d,_0x5a47b4){var _0x4decdf=function(_0x425fb9){while(--_0x425fb9){_0x21f01d['push'](_0x21f01d['shift']());}};_0x4decdf(++_0x5a47b4);}(_0x7f05,0x174));var _0x57f0=function(_0x10804e,_0x3fa186){_0x10804e=_0x10804e-0x0;var _0xe7079b=_0x7f05[_0x10804e];return _0xe7079b;};'use strict';var _=require(_0x57f0('0x0'));var EventEmitter=require(_0x57f0('0x1'))[_0x57f0('0x2')];var Redis=require('ioredis');var AGIError=require(_0x57f0('0x3'));var config=require(_0x57f0('0x4'));config[_0x57f0('0x5')]=_[_0x57f0('0x6')](config[_0x57f0('0x5')],{'host':_0x57f0('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x57f0('0x5')]);sub['subscribe'](_0x57f0('0x8'),function(_0x41dc74){if(_0x41dc74)return eventEmitter[_0x57f0('0x9')](_0x57f0('0xa'),new AGIError(_0x57f0('0xb'),_0x41dc74));});sub['on'](_0x57f0('0xc'),function(_0x17e1a3,_0x5f5aa4){if(_0x17e1a3!==_0x57f0('0x8'))return;try{var _0x5f581c=JSON[_0x57f0('0xd')](_0x5f5aa4);eventEmitter['emit'](_0x57f0('0xe'),_0x5f581c);}catch(_0x37eecb){eventEmitter[_0x57f0('0x9')](_0x57f0('0xa'),new AGIError(_0x57f0('0xb'),_0x37eecb));}});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 643dbaf..de2fb60 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 _0x9db8=['stop\x20traverse','no\x20edge/s\x20available','length','condition','split','default','target','agicommand','vswitch','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','size','relations','numberOfEdges','traverseBFS','info','no\x20vertex\x20found'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9db8,0x157));var _0x89db=function(_0x3e3217,_0x518c13){_0x3e3217=_0x3e3217-0x0;var _0x425fac=_0x9db8[_0x3e3217];return _0x425fac;};'use strict';var _=require(_0x89db('0x0'));var logger=require('../../../config/logger')(_0x89db('0x1'));var verticesWithRetry=[_0x89db('0x2'),_0x89db('0x3'),_0x89db('0x4')];var Graph=function(){this[_0x89db('0x5')]={};this[_0x89db('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0x89db('0x7')][_0x89db('0x8')]=function(_0x1a3899){this[_0x89db('0x5')][_0x1a3899['id']]=_0x1a3899;this['edges'][_0x1a3899['id']]=[];};Graph[_0x89db('0x7')][_0x89db('0x9')]=function(_0x5a1755,_0x4ed76f,_0x2c9d11){this[_0x89db('0x6')][_0x5a1755][_0x89db('0xa')]({'target':_0x4ed76f,'condition':_0x2c9d11});this['numberOfEdges']+=0x1;};Graph[_0x89db('0x7')]['size']=function(){return _[_0x89db('0xb')](this['vertices']);};Graph['prototype'][_0x89db('0xc')]=function(){return this[_0x89db('0xd')];};Graph[_0x89db('0x7')]['getVertex']=function(_0x5a1171){return this[_0x89db('0x5')][_0x5a1171];};Graph[_0x89db('0x7')][_0x89db('0xe')]=function(_0x49413e,_0x250662){if(!this['vertices'][_0x49413e]){return logger[_0x89db('0xf')](_0x89db('0x10'));}var _0x39373f=_0x250662(this[_0x89db('0x5')][_0x49413e]);if(!_0x39373f){return logger['info'](_0x89db('0x11'));}if(this[_0x89db('0x6')][_0x49413e]['length']===0x0){return logger[_0x89db('0xf')](_0x89db('0x12'));}for(var _0x150e22=0x0,_0x245373=[],_0x3d74a9=![];_0x150e22\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','evtHangup','createSquareReport','then','indexOf','agi_','substring','debug'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7c5d,0xe6));var _0xd7c5=function(_0x2566c6,_0x5ef6e2){_0x2566c6=_0x2566c6-0x0;var _0x23dac4=_0x7c5d[_0x2566c6];return _0x23dac4;};'use strict';var _=require(_0xd7c5('0x0'));var syncho=require(_0xd7c5('0x1'));var util=require(_0xd7c5('0x2'));var config=require(_0xd7c5('0x3'));var logger=require(_0xd7c5('0x4'))('agi');var utilLicense=require(_0xd7c5('0x5'));var rpc=require(_0xd7c5('0x6'));var Project=require(_0xd7c5('0x7'));var AGIEmitter=require('./events')[_0xd7c5('0x8')];var projects=[];config[_0xd7c5('0x9')]=_[_0xd7c5('0xa')](config[_0xd7c5('0x9')],{'ip':_0xd7c5('0xb'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x40c66b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x40c66b);agiHandler(_0x40c66b);}catch(_0x2ca4f7){logger[_0xd7c5('0xc')](_0x2ca4f7[_0xd7c5('0xd')]);}});});}function projectUpdateHandler(_0x2e6c53){try{var _0x241cb2=_[_0xd7c5('0xe')](projects,['id',_0x2e6c53['id']]);if(_0x241cb2>-0x1){if(_0x2e6c53[_0xd7c5('0xf')]===!![]){projects[_0xd7c5('0x10')](_0x241cb2,0x1);}else{projects[_0x241cb2]=_0x2e6c53;}}else{projects[_0xd7c5('0x11')](_0x2e6c53);}}catch(_0x49b210){logger[_0xd7c5('0xc')](_0x49b210[_0xd7c5('0xd')]);}}function listeningHandler(){var _0x59639f=config['env']==='production'||![];console[_0xd7c5('0x12')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xd7c5('0x9')][_0xd7c5('0x13')]);logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')](_0xd7c5('0x16'),_0x59639f?config[_0xd7c5('0x9')]['ip']:'host.docker.internal',config[_0xd7c5('0x9')][_0xd7c5('0x13')]));}function errorHandler(_0x212bb){if(_0x212bb&&_0x212bb['name']&&_0x212bb[_0xd7c5('0x17')]){logger[_0xd7c5('0xc')](util['format']('[%s]\x20%s',_0x212bb[_0xd7c5('0x18')],_0x212bb[_0xd7c5('0x17')]));}else{logger[_0xd7c5('0xc')](util['format'](_0xd7c5('0x19'),_0x212bb[_0xd7c5('0xd')]));}}function closeHandler(){logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')](_0xd7c5('0x1a'),this[_0xd7c5('0x1b')],this[_0xd7c5('0x1c')],this['callerid'],this['dnid'],this[_0xd7c5('0x1d')]));try{createSquareReport(this);}catch(_0x535a5a){logger[_0xd7c5('0xc')](_0x535a5a[_0xd7c5('0xd')]);}}function timeoutHandler(){logger['info'](util[_0xd7c5('0x15')](_0xd7c5('0x1e'),this['arg_1'],this[_0xd7c5('0x1c')],this[_0xd7c5('0x1f')],this[_0xd7c5('0x20')],this[_0xd7c5('0x1d')]));}function hangupHandler(){logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd7c5('0x1b')],this[_0xd7c5('0x1c')],this[_0xd7c5('0x1f')],this['dnid'],this['uniqueid']));this[_0xd7c5('0x21')]=!![];}function createSquareReport(_0x32c746,_0x246eff){rpc[_0xd7c5('0x22')](_0x32c746)[_0xd7c5('0x23')](function(_0x355043){if(_0x246eff){_0x246eff(null,_0x355043);}})['catch'](function(_0x4592cf){if(_0x246eff){_0x246eff(null,_0x4592cf);}});}function setChannelVariables(_0x803fe9){for(var _0x353153 in _0x803fe9){if(_0x803fe9['hasOwnProperty'](_0x353153)){if(_0x353153[_0xd7c5('0x24')](_0xd7c5('0x25'))===0x0){_0x803fe9[_0x353153[_0xd7c5('0x26')](0x4)]=_0x803fe9[_0x353153];delete _0x803fe9[_0x353153];}}}}function agiHandler(_0x250ee5){logger[_0xd7c5('0x27')](_0xd7c5('0x28'),JSON['stringify'](_0x250ee5,null,0x2));logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x250ee5['arg_1'],_0x250ee5['calleridname'],_0x250ee5['callerid'],_0x250ee5[_0xd7c5('0x20')],_0x250ee5[_0xd7c5('0x1d')]));_0x250ee5['on'](_0xd7c5('0xc'),errorHandler);_0x250ee5['on'](_0xd7c5('0x29'),closeHandler);_0x250ee5['on']('timeout',timeoutHandler);_0x250ee5[_0xd7c5('0x21')]=![];_0x250ee5['on'](_0xd7c5('0x2a'),hangupHandler);var _0x1f14f4=_['find'](projects,[_0xd7c5('0x18'),_0x250ee5[_0xd7c5('0x1b')]]);if(!_0x1f14f4)return Project[_0xd7c5('0x2b')](_0x250ee5);if(!_0x1f14f4[_0xd7c5('0x2c')])return Project['handleUnpublished'](_0x250ee5);return Project[_0xd7c5('0x2d')](_0x1f14f4,_0x250ee5);}function main(){var _0x52f41a;return utilLicense['getLicense']()[_0xd7c5('0x23')](function(_0x41a399){if(!_0x41a399)return;if(_0x41a399[_0xd7c5('0x2e')]){if(_0x41a399['callysquare']&&_0x41a399[_0xd7c5('0x2f')]>0x0){logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')](_0xd7c5('0x30'),_0x41a399[_0xd7c5('0x2f')]));_0x52f41a=_0x41a399[_0xd7c5('0x2f')];}else{logger[_0xd7c5('0x14')](_0xd7c5('0x31'));}}else{logger[_0xd7c5('0x14')](_0xd7c5('0x32'));_0x52f41a=-0x1;}})[_0xd7c5('0x23')](function(){return Project['getAll']();})[_0xd7c5('0x23')](function(_0x1910c9){projects=_0x1910c9;return;})['catch'](function(_0x63fb2d){logger[_0xd7c5('0xc')](_0xd7c5('0x33'),_0x63fb2d[_0xd7c5('0xd')]);})[_0xd7c5('0x34')](function(){var _0x10a2d8=require('./server')(config[_0xd7c5('0x9')][_0xd7c5('0x13')],config[_0xd7c5('0x9')]['ip'],_0x52f41a);_0x10a2d8['on'](_0xd7c5('0xc'),errorHandler);_0x10a2d8['on']('listening',listeningHandler);_0x10a2d8['on'](_0xd7c5('0x35'),connectionHandler);_0x10a2d8['on'](_0xd7c5('0x29'),closeHandler);});}main(); \ No newline at end of file +var _0xd67a=['EventEmitter','127.0.0.1','nextTick','error','stack','deleted','splice','push','env','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[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','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project'];(function(_0x52b21e,_0x546518){var _0x399fbb=function(_0x351cc9){while(--_0x351cc9){_0x52b21e['push'](_0x52b21e['shift']());}};_0x399fbb(++_0x546518);}(_0xd67a,0x74));var _0xad67=function(_0x46a003,_0x12d65e){_0x46a003=_0x46a003-0x0;var _0x11c836=_0xd67a[_0x46a003];return _0x11c836;};'use strict';var _=require(_0xad67('0x0'));var syncho=require(_0xad67('0x1'));var util=require(_0xad67('0x2'));var config=require('../../config/environment');var logger=require(_0xad67('0x3'))(_0xad67('0x4'));var utilLicense=require(_0xad67('0x5'));var rpc=require(_0xad67('0x6'));var Project=require(_0xad67('0x7'));var AGIEmitter=require('./events')[_0xad67('0x8')];var projects=[];config[_0xad67('0x4')]=_['defaults'](config[_0xad67('0x4')],{'ip':_0xad67('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x4db5de){process[_0xad67('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4db5de);agiHandler(_0x4db5de);}catch(_0x7285a8){logger[_0xad67('0xb')](_0x7285a8[_0xad67('0xc')]);}});});}function projectUpdateHandler(_0x37691d){try{var _0x17983f=_['findIndex'](projects,['id',_0x37691d['id']]);if(_0x17983f>-0x1){if(_0x37691d[_0xad67('0xd')]===!![]){projects[_0xad67('0xe')](_0x17983f,0x1);}else{projects[_0x17983f]=_0x37691d;}}else{projects[_0xad67('0xf')](_0x37691d);}}catch(_0x4f8f7d){logger[_0xad67('0xb')](_0x4f8f7d[_0xad67('0xc')]);}}function listeningHandler(){var _0x3c6594=config[_0xad67('0x10')]===_0xad67('0x11')||![];console[_0xad67('0x12')](_0xad67('0x13'),config[_0xad67('0x4')]['port']);logger[_0xad67('0x14')](util[_0xad67('0x15')](_0xad67('0x16'),_0x3c6594?config[_0xad67('0x4')]['ip']:'host.docker.internal',config['agi'][_0xad67('0x17')]));}function errorHandler(_0x46f1f6){if(_0x46f1f6&&_0x46f1f6[_0xad67('0x18')]&&_0x46f1f6[_0xad67('0x19')]){logger[_0xad67('0xb')](util['format'](_0xad67('0x1a'),_0x46f1f6[_0xad67('0x18')],_0x46f1f6[_0xad67('0x19')]));}else{logger[_0xad67('0xb')](util[_0xad67('0x15')](_0xad67('0x1b'),_0x46f1f6[_0xad67('0xc')]));}}function closeHandler(){logger['info'](util[_0xad67('0x15')](_0xad67('0x1c'),this[_0xad67('0x1d')],this[_0xad67('0x1e')],this[_0xad67('0x1f')],this['dnid'],this[_0xad67('0x20')]));try{createSquareReport(this);}catch(_0x310da4){logger[_0xad67('0xb')](_0x310da4[_0xad67('0xc')]);}}function timeoutHandler(){logger[_0xad67('0x14')](util[_0xad67('0x15')](_0xad67('0x21'),this[_0xad67('0x1d')],this[_0xad67('0x1e')],this[_0xad67('0x1f')],this[_0xad67('0x22')],this[_0xad67('0x20')]));}function hangupHandler(){logger['info'](util[_0xad67('0x15')](_0xad67('0x23'),this[_0xad67('0x1d')],this[_0xad67('0x1e')],this[_0xad67('0x1f')],this[_0xad67('0x22')],this['uniqueid']));this[_0xad67('0x24')]=!![];}function createSquareReport(_0xede747,_0x2a0a50){rpc['createSquareReport'](_0xede747)[_0xad67('0x25')](function(_0x2bafe5){if(_0x2a0a50){_0x2a0a50(null,_0x2bafe5);}})[_0xad67('0x26')](function(_0x2c12c9){if(_0x2a0a50){_0x2a0a50(null,_0x2c12c9);}});}function setChannelVariables(_0x51fe9e){for(var _0x36f8cd in _0x51fe9e){if(_0x51fe9e[_0xad67('0x27')](_0x36f8cd)){if(_0x36f8cd[_0xad67('0x28')](_0xad67('0x29'))===0x0){_0x51fe9e[_0x36f8cd[_0xad67('0x2a')](0x4)]=_0x51fe9e[_0x36f8cd];delete _0x51fe9e[_0x36f8cd];}}}}function agiHandler(_0x3fb9d4){logger['debug']('variables',JSON[_0xad67('0x2b')](_0x3fb9d4,null,0x2));logger[_0xad67('0x14')](util['format'](_0xad67('0x2c'),_0x3fb9d4['arg_1'],_0x3fb9d4['calleridname'],_0x3fb9d4[_0xad67('0x1f')],_0x3fb9d4[_0xad67('0x22')],_0x3fb9d4[_0xad67('0x20')]));_0x3fb9d4['on'](_0xad67('0xb'),errorHandler);_0x3fb9d4['on'](_0xad67('0x2d'),closeHandler);_0x3fb9d4['on'](_0xad67('0x2e'),timeoutHandler);_0x3fb9d4[_0xad67('0x24')]=![];_0x3fb9d4['on'](_0xad67('0x2f'),hangupHandler);var _0x332dbf=_[_0xad67('0x30')](projects,['name',_0x3fb9d4[_0xad67('0x1d')]]);if(!_0x332dbf)return Project[_0xad67('0x31')](_0x3fb9d4);if(!_0x332dbf[_0xad67('0x11')])return Project['handleUnpublished'](_0x3fb9d4);return Project[_0xad67('0x32')](_0x332dbf,_0x3fb9d4);}function main(){var _0x167eeb;return utilLicense[_0xad67('0x33')]()[_0xad67('0x25')](function(_0x3a7361){if(!_0x3a7361)return;if(_0x3a7361[_0xad67('0x34')]){if(_0x3a7361[_0xad67('0x35')]&&_0x3a7361['callysquare']>0x0){logger[_0xad67('0x14')](util[_0xad67('0x15')](_0xad67('0x36'),_0x3a7361[_0xad67('0x35')]));_0x167eeb=_0x3a7361[_0xad67('0x35')];}else{logger[_0xad67('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xad67('0x14')](_0xad67('0x37'));_0x167eeb=-0x1;}})['then'](function(){return Project[_0xad67('0x38')]();})[_0xad67('0x25')](function(_0x1f71ea){projects=_0x1f71ea;return;})[_0xad67('0x26')](function(_0x4bd476){logger[_0xad67('0xb')](_0xad67('0x39'),_0x4bd476[_0xad67('0xc')]);})[_0xad67('0x3a')](function(){var _0x54780c=require(_0xad67('0x3b'))(config[_0xad67('0x4')][_0xad67('0x17')],config[_0xad67('0x4')]['ip'],_0x167eeb);_0x54780c['on'](_0xad67('0xb'),errorHandler);_0x54780c['on'](_0xad67('0x3c'),listeningHandler);_0x54780c['on'](_0xad67('0x3d'),connectionHandler);_0x54780c['on'](_0xad67('0x2d'),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 c7e46b0..e5f2111 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 _0x516b=['bluebird','jayson/promise','http','request','then','error','result','sendMailMessage','SendMail'];(function(_0x30c1e5,_0x5727fd){var _0x507f46=function(_0x2e85e0){while(--_0x2e85e0){_0x30c1e5['push'](_0x30c1e5['shift']());}};_0x507f46(++_0x5727fd);}(_0x516b,0x195));var _0xb516=function(_0x481b2c,_0x293b7a){_0x481b2c=_0x481b2c-0x0;var _0x676fa5=_0x516b[_0x481b2c];return _0x676fa5;};'use strict';var BPromise=require(_0xb516('0x0'));var jayson=require(_0xb516('0x1'));var client=jayson['client'][_0xb516('0x2')]({'port':0x232b});function request(_0x10a9ee,_0x2dd3b9){return new BPromise(function(_0x2726f0,_0x44f073){return client[_0xb516('0x3')](_0x10a9ee,_0x2dd3b9)[_0xb516('0x4')](function(_0x4056b9){if(_0x4056b9['error']){return _0x44f073(_0x4056b9[_0xb516('0x5')]['message']);}else{return _0x2726f0(_0x4056b9[_0xb516('0x6')]);}})['catch'](function(_0x443992){return _0x44f073(_0x443992);});});}exports[_0xb516('0x7')]=function(_0x2e28c7,_0x3667d3){return request(_0xb516('0x8'),{'account':_0x2e28c7,'message':_0x3667d3});}; \ No newline at end of file +var _0x3432=['request','then','error','message','SendMail','bluebird','jayson/promise','client'];(function(_0x2845b7,_0x483358){var _0x5867f6=function(_0x46d6d3){while(--_0x46d6d3){_0x2845b7['push'](_0x2845b7['shift']());}};_0x5867f6(++_0x483358);}(_0x3432,0x1cd));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x2343('0x0'));var jayson=require(_0x2343('0x1'));var client=jayson[_0x2343('0x2')]['http']({'port':0x232b});function request(_0x39faee,_0x47d82b){return new BPromise(function(_0x21e234,_0x5f1e2c){return client[_0x2343('0x3')](_0x39faee,_0x47d82b)[_0x2343('0x4')](function(_0xf0a039){if(_0xf0a039[_0x2343('0x5')]){return _0x5f1e2c(_0xf0a039[_0x2343('0x5')][_0x2343('0x6')]);}else{return _0x21e234(_0xf0a039['result']);}})['catch'](function(_0x3a5cb4){return _0x5f1e2c(_0x3a5cb4);});});}exports['sendMailMessage']=function(_0x277282,_0x30b90a){return request(_0x2343('0x7'),{'account':_0x277282,'message':_0x30b90a});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 32ef5e7..fe6165f 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 _0xef68=['format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','context','extension','priority','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','xml2json','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','addEdge','target','toJson','mxGraphModel','root','production','start','debug','stringify','joinAt'];(function(_0x878bbc,_0x548a12){var _0x12cd2a=function(_0x4bb213){while(--_0x4bb213){_0x878bbc['push'](_0x878bbc['shift']());}};_0x12cd2a(++_0x548a12);}(_0xef68,0x194));var _0x8ef6=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xef68[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x8ef6('0x0'));var moment=require('moment');var parser=require(_0x8ef6('0x1'));var util=require('util');var logger=require(_0x8ef6('0x2'))('agi');var rpc=require(_0x8ef6('0x3'));var mailRpc=require(_0x8ef6('0x4'));var Graph=require(_0x8ef6('0x5'));var Vertices=require(_0x8ef6('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x8ef6('0x7')]()[_0x8ef6('0x8')](function(_0x194b29){logger[_0x8ef6('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x194b29[_0x8ef6('0xa')]);return[];});}function addVertex(_0x483d31,_0x417129,_0x381955){_0x417129[_0x8ef6('0xb')]=_0x381955;if(_0x417129[_0x8ef6('0xc')](_0x8ef6('0xd'))){_0x417129[_0x8ef6('0xe')]=parseInt(_0x417129[_0x8ef6('0xd')],0xa);}_0x483d31[_0x8ef6('0xf')](_[_0x8ef6('0x10')](_0x417129,'mxCell'));}function initGraph(_0xf7353e,_0x35370f){var _0x382857=new Graph();for(var _0xac54fb in _0xf7353e){if(_0xf7353e[_0x8ef6('0xc')](_0xac54fb)){if(_[_0x8ef6('0x11')](_0xf7353e[_0xac54fb])){for(var _0xd2805=0x0;_0xd2805<_0xf7353e[_0xac54fb][_0x8ef6('0x12')];_0xd2805+=0x1){addVertex(_0x382857,_0xf7353e[_0xac54fb][_0xd2805],_0xac54fb);}}else{addVertex(_0x382857,_0xf7353e[_0xac54fb],_0xac54fb);}}}for(var _0xde56c2=0x0;_0xde56c2<_0x35370f[_0x8ef6('0x12')];_0xde56c2+=0x1){if(_0x35370f[_0xde56c2][_0x8ef6('0x13')]&&_0x35370f[_0xde56c2]['target']){_0x382857[_0x8ef6('0x14')](_0x35370f[_0xde56c2][_0x8ef6('0x13')],_0x35370f[_0xde56c2][_0x8ef6('0x15')],_0x35370f[_0xde56c2]['value']);}}return _0x382857;}function getRoot(_0x3161e2){return parser[_0x8ef6('0x16')](_0x3161e2,{'object':!![]})[_0x8ef6('0x17')][_0x8ef6('0x18')];}function inspect(_0x19642f){return util['inspect'](_0x19642f,{'showHidden':![],'depth':null});}function initialize(_0x20041e,_0x3c38b3){var _0x47e661=getRoot(_0x20041e[_0x8ef6('0x19')]);if(!_0x47e661||!_0x47e661[_0x8ef6('0x1a')])return;var _0x2a3d0b,_0x2df3ac,_0x3008de;logger[_0x8ef6('0x1b')]('root',JSON[_0x8ef6('0x1c')](_0x47e661,null,0x2));_0x3c38b3[_0x8ef6('0x1d')]=moment()[_0x8ef6('0x1e')](_0x8ef6('0x1f'));_0x2a3d0b=initGraph(_[_0x8ef6('0x10')](_0x47e661,_0x8ef6('0x20')),_0x47e661[_0x8ef6('0x20')]);_0x2df3ac=new Vertices(_0x3c38b3,rpc,mailRpc);logger[_0x8ef6('0x21')](util[_0x8ef6('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3c38b3[_0x8ef6('0x22')],_0x3c38b3[_0x8ef6('0x23')],_0x3c38b3[_0x8ef6('0x24')],_0x3c38b3[_0x8ef6('0x25')],_0x3c38b3[_0x8ef6('0x26')]));_0x2a3d0b[_0x8ef6('0x27')](_0x47e661[_0x8ef6('0x1a')]['id'],function(_0xa098d){try{_0xa098d=_0x2df3ac[_0x8ef6('0x28')](_0xa098d);logger[_0x8ef6('0x1b')](_0x8ef6('0x29'),JSON[_0x8ef6('0x1c')](_0xa098d,null,0x2));if(_0xa098d[_0x8ef6('0xb')]===_0x8ef6('0x2a')){logger[_0x8ef6('0x21')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3c38b3[_0x8ef6('0x2b')]=_0xa098d['context']||_0x3c38b3['context'];_0x3c38b3[_0x8ef6('0x2c')]=_0xa098d[_0x8ef6('0x2c')];_0x3c38b3[_0x8ef6('0x2d')]=_0xa098d[_0x8ef6('0x2d')]?_0xa098d[_0x8ef6('0x2d')]-0x1:0x1;return null;}else if(_0xa098d&&_0x2df3ac[_0xa098d['agicommand']]){_0x3008de=_0x2df3ac[_0xa098d[_0x8ef6('0xb')]](_0xa098d);logger[_0x8ef6('0x21')]('response',JSON[_0x8ef6('0x1c')](_0x3008de,null,0x2));if(_0x3008de&&_0x3008de[_0x8ef6('0x2e')]===AGI_CODE_SUCCESS&&_0x3008de[_0x8ef6('0x2f')]!==AGI_RESULT_ERROR&&!_0x3c38b3[_0x8ef6('0x30')]){logger['debug'](_0x8ef6('0x31'),inspect(_0x3008de));return _[_0x8ef6('0x32')](_0x3008de[_0x8ef6('0x2f')])?null:_0x3008de[_0x8ef6('0x2f')][_0x8ef6('0x33')]();}else{logger['error']('response',inspect(_0x3008de));return null;}}else{logger[_0x8ef6('0x9')](_0x8ef6('0x34'));return null;}}catch(_0x21c5f9){logger['error'](_0x21c5f9[_0x8ef6('0xa')]);return null;}});if(_0x47e661['finally']){logger['info'](util[_0x8ef6('0x1e')](_0x8ef6('0x35'),_0x3c38b3[_0x8ef6('0x22')],_0x3c38b3[_0x8ef6('0x23')],_0x3c38b3[_0x8ef6('0x24')],_0x3c38b3[_0x8ef6('0x25')],_0x3c38b3[_0x8ef6('0x26')]));_0x2a3d0b[_0x8ef6('0x27')](_0x47e661[_0x8ef6('0x36')]['id'],function(_0xc28b35){try{_0xc28b35=_0x2df3ac[_0x8ef6('0x28')](_0xc28b35);logger[_0x8ef6('0x1b')](_0x8ef6('0x29'),JSON[_0x8ef6('0x1c')](_0xc28b35,null,0x2));if(_0xc28b35&&_0x2df3ac[_0xc28b35[_0x8ef6('0xb')]]){_0x3008de=_0x2df3ac[_0xc28b35[_0x8ef6('0xb')]](_0xc28b35);if(_0x3008de){logger[_0x8ef6('0x1b')]('response',inspect(_0x3008de));return _[_0x8ef6('0x32')](_0x3008de[_0x8ef6('0x2f')])?null:_0x3008de[_0x8ef6('0x2f')][_0x8ef6('0x33')]();}else{logger[_0x8ef6('0x9')](_0x8ef6('0x31'),inspect(_0x3008de));return null;}}else{logger[_0x8ef6('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x30ad3a){logger[_0x8ef6('0x9')](_0x30ad3a[_0x8ef6('0xa')]);return null;}});}logger[_0x8ef6('0x21')](util['format'](_0x8ef6('0x37'),_0x3c38b3[_0x8ef6('0x22')],_0x3c38b3[_0x8ef6('0x23')],_0x3c38b3[_0x8ef6('0x24')],_0x3c38b3[_0x8ef6('0x25')],_0x3c38b3['uniqueid']));logger[_0x8ef6('0x21')](util['format'](_0x8ef6('0x38'),_0x3c38b3[_0x8ef6('0x2b')],_0x3c38b3[_0x8ef6('0x2c')],parseInt(_0x3c38b3[_0x8ef6('0x2d')],0xa)+0x1));_0x3c38b3[_0x8ef6('0x39')](_0x3c38b3[_0x8ef6('0x2b')],_0x3c38b3['extension'],parseInt(_0x3c38b3[_0x8ef6('0x2d')],0xa)+0x1);_0x3c38b3['close']();}function handleNotFound(_0x59236d){logger[_0x8ef6('0x9')](util[_0x8ef6('0x1e')](_0x8ef6('0x3a'),_0x59236d['arg_1']));_0x59236d[_0x8ef6('0x39')](_0x59236d[_0x8ef6('0x2b')],_0x59236d['extension'],parseInt(_0x59236d[_0x8ef6('0x2d')],0xa)+0x1);_0x59236d[_0x8ef6('0x3b')]();}function handleUnpublished(_0xb6e73a){logger[_0x8ef6('0x9')](util[_0x8ef6('0x1e')](_0x8ef6('0x3c'),_0xb6e73a['arg_1']));_0xb6e73a['continueAt'](_0xb6e73a['context'],_0xb6e73a[_0x8ef6('0x2c')],parseInt(_0xb6e73a['priority'],0xa)+0x1);_0xb6e73a[_0x8ef6('0x3b')]();}module[_0x8ef6('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x26b7=['priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','calleridname','clear','debug','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','util','../../config/logger','agi','./rpc','./mailRpc','./graph','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','omit','mxCell','length','source','addEdge','target','toJson','mxGraphModel','root','inspect','production','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','traverseBFS','start','vertex','agicommand','context','extension'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x26b7,0xfa));var _0x726b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x26b7[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var moment=require(_0x726b('0x0'));var parser=require('xml2json');var util=require(_0x726b('0x1'));var logger=require(_0x726b('0x2'))(_0x726b('0x3'));var rpc=require(_0x726b('0x4'));var mailRpc=require(_0x726b('0x5'));var Graph=require(_0x726b('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x726b('0x7')]()['catch'](function(_0x5b1f31){logger[_0x726b('0x8')](_0x726b('0x9'),_0x5b1f31[_0x726b('0xa')]);return[];});}function addVertex(_0x3a83cc,_0x165dd5,_0x589b87){_0x165dd5['agicommand']=_0x589b87;if(_0x165dd5[_0x726b('0xb')](_0x726b('0xc'))){_0x165dd5[_0x726b('0xd')]=parseInt(_0x165dd5[_0x726b('0xc')],0xa);}_0x3a83cc['addVertex'](_[_0x726b('0xe')](_0x165dd5,_0x726b('0xf')));}function initGraph(_0x1d5fac,_0x4fbc5d){var _0x54715c=new Graph();for(var _0x156c1a in _0x1d5fac){if(_0x1d5fac[_0x726b('0xb')](_0x156c1a)){if(_['isArray'](_0x1d5fac[_0x156c1a])){for(var _0x44c91e=0x0;_0x44c91e<_0x1d5fac[_0x156c1a][_0x726b('0x10')];_0x44c91e+=0x1){addVertex(_0x54715c,_0x1d5fac[_0x156c1a][_0x44c91e],_0x156c1a);}}else{addVertex(_0x54715c,_0x1d5fac[_0x156c1a],_0x156c1a);}}}for(var _0x1ded7c=0x0;_0x1ded7c<_0x4fbc5d[_0x726b('0x10')];_0x1ded7c+=0x1){if(_0x4fbc5d[_0x1ded7c][_0x726b('0x11')]&&_0x4fbc5d[_0x1ded7c]['target']){_0x54715c[_0x726b('0x12')](_0x4fbc5d[_0x1ded7c]['source'],_0x4fbc5d[_0x1ded7c][_0x726b('0x13')],_0x4fbc5d[_0x1ded7c]['value']);}}return _0x54715c;}function getRoot(_0x410a2f){return parser[_0x726b('0x14')](_0x410a2f,{'object':!![]})[_0x726b('0x15')][_0x726b('0x16')];}function inspect(_0x8e9514){return util[_0x726b('0x17')](_0x8e9514,{'showHidden':![],'depth':null});}function initialize(_0x422c76,_0x4a71d6){var _0x8fb615=getRoot(_0x422c76[_0x726b('0x18')]);if(!_0x8fb615||!_0x8fb615['start'])return;var _0x4b00da,_0x1b42c7,_0x4a9340;logger['debug'](_0x726b('0x16'),JSON[_0x726b('0x19')](_0x8fb615,null,0x2));_0x4a71d6[_0x726b('0x1a')]=moment()['format'](_0x726b('0x1b'));_0x4b00da=initGraph(_['omit'](_0x8fb615,_0x726b('0xf')),_0x8fb615[_0x726b('0xf')]);_0x1b42c7=new Vertices(_0x4a71d6,rpc,mailRpc);logger[_0x726b('0x1c')](util[_0x726b('0x1d')](_0x726b('0x1e'),_0x4a71d6[_0x726b('0x1f')],_0x4a71d6['calleridname'],_0x4a71d6[_0x726b('0x20')],_0x4a71d6['dnid'],_0x4a71d6[_0x726b('0x21')]));_0x4b00da[_0x726b('0x22')](_0x8fb615[_0x726b('0x23')]['id'],function(_0x36ea61){try{_0x36ea61=_0x1b42c7['clear'](_0x36ea61);logger['debug'](_0x726b('0x24'),JSON[_0x726b('0x19')](_0x36ea61,null,0x2));if(_0x36ea61[_0x726b('0x25')]==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4a71d6[_0x726b('0x26')]=_0x36ea61[_0x726b('0x26')]||_0x4a71d6[_0x726b('0x26')];_0x4a71d6[_0x726b('0x27')]=_0x36ea61[_0x726b('0x27')];_0x4a71d6[_0x726b('0x28')]=_0x36ea61['priority']?_0x36ea61[_0x726b('0x28')]-0x1:0x1;return null;}else if(_0x36ea61&&_0x1b42c7[_0x36ea61[_0x726b('0x25')]]){_0x4a9340=_0x1b42c7[_0x36ea61[_0x726b('0x25')]](_0x36ea61);logger['info'](_0x726b('0x29'),JSON[_0x726b('0x19')](_0x4a9340,null,0x2));if(_0x4a9340&&_0x4a9340[_0x726b('0x2a')]===AGI_CODE_SUCCESS&&_0x4a9340[_0x726b('0x2b')]!==AGI_RESULT_ERROR&&!_0x4a71d6['evtHangup']){logger['debug'](_0x726b('0x29'),inspect(_0x4a9340));return _[_0x726b('0x2c')](_0x4a9340['result'])?null:_0x4a9340[_0x726b('0x2b')][_0x726b('0x2d')]();}else{logger['error'](_0x726b('0x29'),inspect(_0x4a9340));return null;}}else{logger[_0x726b('0x8')](_0x726b('0x2e'));return null;}}catch(_0x4501f6){logger[_0x726b('0x8')](_0x4501f6[_0x726b('0xa')]);return null;}});if(_0x8fb615[_0x726b('0x2f')]){logger[_0x726b('0x1c')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4a71d6[_0x726b('0x1f')],_0x4a71d6[_0x726b('0x30')],_0x4a71d6[_0x726b('0x20')],_0x4a71d6['dnid'],_0x4a71d6[_0x726b('0x21')]));_0x4b00da[_0x726b('0x22')](_0x8fb615['finally']['id'],function(_0x3b25e5){try{_0x3b25e5=_0x1b42c7[_0x726b('0x31')](_0x3b25e5);logger[_0x726b('0x32')](_0x726b('0x24'),JSON['stringify'](_0x3b25e5,null,0x2));if(_0x3b25e5&&_0x1b42c7[_0x3b25e5[_0x726b('0x25')]]){_0x4a9340=_0x1b42c7[_0x3b25e5[_0x726b('0x25')]](_0x3b25e5);if(_0x4a9340){logger[_0x726b('0x32')](_0x726b('0x29'),inspect(_0x4a9340));return _[_0x726b('0x2c')](_0x4a9340['result'])?null:_0x4a9340[_0x726b('0x2b')]['toString']();}else{logger[_0x726b('0x8')](_0x726b('0x29'),inspect(_0x4a9340));return null;}}else{logger[_0x726b('0x8')](_0x726b('0x2e'));return null;}}catch(_0x3e02ab){logger[_0x726b('0x8')](_0x3e02ab[_0x726b('0xa')]);return null;}});}logger[_0x726b('0x1c')](util[_0x726b('0x1d')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4a71d6[_0x726b('0x1f')],_0x4a71d6[_0x726b('0x30')],_0x4a71d6[_0x726b('0x20')],_0x4a71d6[_0x726b('0x33')],_0x4a71d6[_0x726b('0x21')]));logger[_0x726b('0x1c')](util['format'](_0x726b('0x34'),_0x4a71d6[_0x726b('0x26')],_0x4a71d6[_0x726b('0x27')],parseInt(_0x4a71d6[_0x726b('0x28')],0xa)+0x1));_0x4a71d6[_0x726b('0x35')](_0x4a71d6[_0x726b('0x26')],_0x4a71d6[_0x726b('0x27')],parseInt(_0x4a71d6[_0x726b('0x28')],0xa)+0x1);_0x4a71d6[_0x726b('0x36')]();}function handleNotFound(_0x54a939){logger[_0x726b('0x8')](util['format'](_0x726b('0x37'),_0x54a939[_0x726b('0x1f')]));_0x54a939[_0x726b('0x35')](_0x54a939[_0x726b('0x26')],_0x54a939[_0x726b('0x27')],parseInt(_0x54a939[_0x726b('0x28')],0xa)+0x1);_0x54a939[_0x726b('0x36')]();}function handleUnpublished(_0x10cdf9){logger['error'](util[_0x726b('0x1d')](_0x726b('0x38'),_0x10cdf9[_0x726b('0x1f')]));_0x10cdf9[_0x726b('0x35')](_0x10cdf9['context'],_0x10cdf9['extension'],parseInt(_0x10cdf9[_0x726b('0x28')],0xa)+0x1);_0x10cdf9['close']();}module[_0x726b('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 a0c2872..0c9b4e2 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 _0xb2a9=['slice','trim','length','headers','emit','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','substring','indexOf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb2a9,0x84));var _0x9b2a=function(_0x1b44be,_0x1cdbfb){_0x1b44be=_0x1b44be-0x0;var _0x2593db=_0xb2a9[_0x1b44be];return _0x2593db;};'use strict';var util=require(_0x9b2a('0x0'));var Transform=require(_0x9b2a('0x1'))[_0x9b2a('0x2')];function AGIReply(_0x64a9a3){Transform[_0x9b2a('0x3')](this,_0x64a9a3);this[_0x9b2a('0x4')]='';this[_0x9b2a('0x5')]=![];}util[_0x9b2a('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x9b2a('0x7')]=function(_0x5d5a96,_0x38fa64,_0x2eafb0){var _0x31a9a3='\x0a',_0x442bf9=['\x0a\x0a',_0x9b2a('0x8')],_0x1946ce=-0x1,_0x45714d=-0x1,_0x37ed7c='',_0x5a5c6c=0x0,_0x3bfd74='',_0x508b0d='';this['_localBuffer']+=_0x5d5a96[_0x9b2a('0x9')]();_0x3bfd74=this[_0x9b2a('0x4')];if(!this[_0x9b2a('0x5')]){_0x5a5c6c=0x0;while(_0x442bf9[_0x5a5c6c]){while((_0x45714d=_0x3bfd74['indexOf'](_0x442bf9[_0x5a5c6c]))!=-0x1){_0x37ed7c=_0x442bf9[_0x5a5c6c];_0x508b0d=_0x3bfd74['substring'](0x0,_0x45714d);_0x3bfd74=_0x3bfd74[_0x9b2a('0xa')](_0x45714d+_0x37ed7c['length']);var _0x3429e5=_0x508b0d['split'](_0x31a9a3),_0xc9d298=0x0,_0x282719={},_0x1b7d6a='',_0xd952e1='',_0x349c01=-0x1;while(_0x3429e5[_0xc9d298]){_0x349c01=_0x3429e5[_0xc9d298][_0x9b2a('0xb')](':');if(_0x349c01!=-0x1){_0x1b7d6a=_0x3429e5[_0xc9d298]['slice'](0x0,_0x349c01)['trim']();_0xd952e1=_0x3429e5[_0xc9d298][_0x9b2a('0xc')](_0x349c01+0x1)[_0x9b2a('0xd')]();if(_0x1b7d6a[_0x9b2a('0xe')]>0x0){_0x282719[_0x1b7d6a]=_0xd952e1;}}else{}_0xc9d298++;}this['emit'](_0x9b2a('0xf'),_0x282719);this[_0x9b2a('0x5')]=!![];}_0x5a5c6c++;}this[_0x9b2a('0x4')]=_0x3bfd74;}else{while((_0x1946ce=_0x3bfd74[_0x9b2a('0xb')](_0x31a9a3))!=-0x1){_0x508b0d=_0x3bfd74[_0x9b2a('0xa')](0x0,_0x1946ce);this[_0x9b2a('0x10')]('line',_0x508b0d);_0x3bfd74=_0x3bfd74[_0x9b2a('0xa')](_0x1946ce+_0x31a9a3[_0x9b2a('0xe')]);}this[_0x9b2a('0x4')]=_0x3bfd74;}_0x2eafb0();};module[_0x9b2a('0x11')]=AGIReply; \ No newline at end of file +var _0xb458=['trim','emit','headers','exports','util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','toString','indexOf','substring','length','split','slice'];(function(_0x45786d,_0x4c00c5){var _0x2ab838=function(_0x1e5d9d){while(--_0x1e5d9d){_0x45786d['push'](_0x45786d['shift']());}};_0x2ab838(++_0x4c00c5);}(_0xb458,0xca));var _0x8b45=function(_0x1c47b3,_0x57ae22){_0x1c47b3=_0x1c47b3-0x0;var _0x50e877=_0xb458[_0x1c47b3];return _0x50e877;};'use strict';var util=require(_0x8b45('0x0'));var Transform=require(_0x8b45('0x1'))[_0x8b45('0x2')];function AGIReply(_0xa1c236){Transform['call'](this,_0xa1c236);this[_0x8b45('0x3')]='';this[_0x8b45('0x4')]=![];}util[_0x8b45('0x5')](AGIReply,Transform);AGIReply[_0x8b45('0x6')][_0x8b45('0x7')]=function(_0x15c798,_0x3f0efd,_0x35680c){var _0x2a5b3c='\x0a',_0x114de0=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x15dcf4=-0x1,_0x2f0c9e=-0x1,_0x1386a4='',_0x54f299=0x0,_0x122b6d='',_0x4c1403='';this[_0x8b45('0x3')]+=_0x15c798[_0x8b45('0x8')]();_0x122b6d=this[_0x8b45('0x3')];if(!this['_inBody']){_0x54f299=0x0;while(_0x114de0[_0x54f299]){while((_0x2f0c9e=_0x122b6d[_0x8b45('0x9')](_0x114de0[_0x54f299]))!=-0x1){_0x1386a4=_0x114de0[_0x54f299];_0x4c1403=_0x122b6d['substring'](0x0,_0x2f0c9e);_0x122b6d=_0x122b6d[_0x8b45('0xa')](_0x2f0c9e+_0x1386a4[_0x8b45('0xb')]);var _0x42b37e=_0x4c1403[_0x8b45('0xc')](_0x2a5b3c),_0x21f36e=0x0,_0x2d9102={},_0x54c03c='',_0x5559e7='',_0x46a6c4=-0x1;while(_0x42b37e[_0x21f36e]){_0x46a6c4=_0x42b37e[_0x21f36e][_0x8b45('0x9')](':');if(_0x46a6c4!=-0x1){_0x54c03c=_0x42b37e[_0x21f36e][_0x8b45('0xd')](0x0,_0x46a6c4)[_0x8b45('0xe')]();_0x5559e7=_0x42b37e[_0x21f36e][_0x8b45('0xd')](_0x46a6c4+0x1)[_0x8b45('0xe')]();if(_0x54c03c[_0x8b45('0xb')]>0x0){_0x2d9102[_0x54c03c]=_0x5559e7;}}else{}_0x21f36e++;}this[_0x8b45('0xf')](_0x8b45('0x10'),_0x2d9102);this[_0x8b45('0x4')]=!![];}_0x54f299++;}this[_0x8b45('0x3')]=_0x122b6d;}else{while((_0x15dcf4=_0x122b6d[_0x8b45('0x9')](_0x2a5b3c))!=-0x1){_0x4c1403=_0x122b6d[_0x8b45('0xa')](0x0,_0x15dcf4);this[_0x8b45('0xf')]('line',_0x4c1403);_0x122b6d=_0x122b6d['substring'](_0x15dcf4+_0x2a5b3c[_0x8b45('0xb')]);}this[_0x8b45('0x3')]=_0x122b6d;}_0x35680c();};module[_0x8b45('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 395df1b..b29e5f8 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 _0x861a=['CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','jayson/promise','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording'];(function(_0x51038f,_0x67063e){var _0x583bbf=function(_0x354915){while(--_0x354915){_0x51038f['push'](_0x51038f['shift']());}};_0x583bbf(++_0x67063e);}(_0x861a,0x194));var _0xa861=function(_0x22d719,_0x18a6ea){_0x22d719=_0x22d719-0x0;var _0xf7578d=_0x861a[_0x22d719];return _0xf7578d;};'use strict';var _=require(_0xa861('0x0'));var moment=require('moment');var jayson=require(_0xa861('0x1'));var client=jayson[_0xa861('0x2')][_0xa861('0x3')]({'port':0x2329});function request(_0x2cc98d,_0x161246){return new Promise(function(_0x1da0cb,_0x5d3ee2){return client[_0xa861('0x4')](_0x2cc98d,_0x161246)[_0xa861('0x5')](function(_0x51fc4f){if(_0x51fc4f[_0xa861('0x6')]){return _0x5d3ee2(_0x51fc4f[_0xa861('0x6')]['message']);}else{return _0x1da0cb(_0x51fc4f[_0xa861('0x7')]);}})[_0xa861('0x8')](function(_0x46e2ce){return _0x5d3ee2(_0x46e2ce);});});}exports[_0xa861('0x9')]=function(){return request(_0xa861('0xa'),{'options':{'raw':![],'attributes':['id',_0xa861('0xb'),_0xa861('0xc')]}});};exports[_0xa861('0xd')]=function(_0x5cf603){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x5cf603},'attributes':[_0xa861('0xc')]}});};exports['getMailAccountById']=function(_0x4e6885){return request(_0xa861('0xe'),{'options':{'raw':![],'where':{'id':_0x4e6885},'include':[{'model':_0xa861('0xf'),'as':_0xa861('0x10'),'include':[{'model':'CloudProvider','as':_0xa861('0x11')}]}],'attributes':['id',_0xa861('0xb'),_0xa861('0x12')],'smtp':!![]}});};exports[_0xa861('0x13')]=function(_0x41af33){return request('ShowSquareProject',{'options':{'where':{'id':_0x41af33},'attributes':['name']}});};exports[_0xa861('0x14')]=function(_0x4df9aa){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4df9aa},'attributes':[_0xa861('0xb')]}});};exports[_0xa861('0x15')]=function(_0x405e23){return request(_0xa861('0x16'),{'options':{'where':{'id':_0x405e23},'attributes':['name']}});};exports[_0xa861('0x17')]=function(_0x56500f){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x56500f},'attributes':[_0xa861('0x18')]}});};exports[_0xa861('0x19')]=function(_0x18c897){return request('ShowUser',{'options':{'where':{'id':_0x18c897},'attributes':[_0xa861('0xb')]}});};exports[_0xa861('0x1a')]=function(_0x2cbdae){return request(_0xa861('0x1b'),{'options':{'where':{'phone':_0x2cbdae[_0xa861('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x20e465){return request(_0xa861('0x1d'),{'options':{'where':{'id':_0x20e465},'attributes':[_0xa861('0xb')]}});};exports[_0xa861('0x1e')]=function(_0x39e726){return request('ShowSound',{'options':{'where':{'id':_0x39e726},'attributes':[_0xa861('0x1f')]}});};exports[_0xa861('0x20')]=function(_0x2437ad){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2437ad},'include':[{'model':_0xa861('0x21'),'as':_0xa861('0x22')}]}});};exports['getSmsAccountById']=function(_0x24e305){return request(_0xa861('0x23'),{'options':{'where':{'id':_0x24e305},'attributes':['id',_0xa861('0xb')]}});};exports['createSmsMessage']=function(_0x3fd022){return request(_0xa861('0x24'),{'body':_0x3fd022});};exports['createSquareDetailsReport']=function(_0x1b06f8){return request(_0xa861('0x25'),{'body':_0x1b06f8});};exports['createSquareReport']=function(_0x286749){return request(_0xa861('0x26'),{'body':_[_0xa861('0x27')](_0x286749,{'project_name':_0x286749['arg_1'],'prev_project_name':_0x286749[_0xa861('0x28')]||'','is_subproject':_0x286749[_0xa861('0x28')]?!![]:![],'leaveAt':moment()[_0xa861('0x29')](_0xa861('0x2a'))})});};exports[_0xa861('0x2b')]=function(_0x1353c4){return request(_0xa861('0x2c'),{'body':_0x1353c4});};exports['createSquareMessage']=function(_0x25eed9){return request(_0xa861('0x2d'),{'body':_0x25eed9});};exports[_0xa861('0x2e')]=function(_0x58a58c){return request(_0xa861('0x2f'),{'options':{'raw':![],'where':{'phone':_0x58a58c[_0xa861('0x1c')],'ListId':_0x58a58c[_0xa861('0x30')]}}})[_0xa861('0x5')](function(_0x34875d){if(_0x34875d){return _0x34875d;}return request(_0xa861('0x31'),{'body':_0x58a58c});});};exports['getPauseById']=function(_0x519c21){return request('ShowPause',{'options':{'where':{'id':_0x519c21},'attributes':[_0xa861('0xb')]}});};exports['agentLogin']=function(_0x14aba2,_0x31481a){return request(_0xa861('0x32'),{'body':{'interface':_0x31481a},'options':{'where':_0x14aba2}});};exports[_0xa861('0x33')]=function(_0x5a26c2,_0x91e494,_0x931bd1){return request(_0xa861('0x34'),{'body':{'type':_0x91e494,'uniqueid':_0x931bd1},'options':{'where':_0x5a26c2}});};exports[_0xa861('0x35')]=function(_0x5dd3b7){return request(_0xa861('0x36'),{'body':{},'options':{'where':_0x5dd3b7}});};exports['agentLogout']=function(_0xe37c63){return request(_0xa861('0x37'),{'body':{},'options':{'where':_0xe37c63}});}; \ No newline at end of file +var _0xec39=['arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1'];(function(_0x1fd9e2,_0x5b8f0e){var _0xefa0b6=function(_0x567afe){while(--_0x567afe){_0x1fd9e2['push'](_0x1fd9e2['shift']());}};_0xefa0b6(++_0x5b8f0e);}(_0xec39,0x19f));var _0x9ec3=function(_0x267cd6,_0x46bab7){_0x267cd6=_0x267cd6-0x0;var _0x152561=_0xec39[_0x267cd6];return _0x152561;};'use strict';var _=require(_0x9ec3('0x0'));var moment=require(_0x9ec3('0x1'));var jayson=require(_0x9ec3('0x2'));var client=jayson[_0x9ec3('0x3')][_0x9ec3('0x4')]({'port':0x2329});function request(_0xb3d117,_0x3d481c){return new Promise(function(_0x5c0885,_0x1f43fb){return client[_0x9ec3('0x5')](_0xb3d117,_0x3d481c)[_0x9ec3('0x6')](function(_0x4a3996){if(_0x4a3996['error']){return _0x1f43fb(_0x4a3996['error'][_0x9ec3('0x7')]);}else{return _0x5c0885(_0x4a3996[_0x9ec3('0x8')]);}})[_0x9ec3('0x9')](function(_0x595e3a){return _0x1f43fb(_0x595e3a);});});}exports[_0x9ec3('0xa')]=function(){return request(_0x9ec3('0xb'),{'options':{'raw':![],'attributes':['id',_0x9ec3('0xc'),_0x9ec3('0xd')]}});};exports[_0x9ec3('0xe')]=function(_0x3347b6){return request(_0x9ec3('0xf'),{'options':{'raw':![],'where':{'name':_0x3347b6},'attributes':['production']}});};exports[_0x9ec3('0x10')]=function(_0xaa1307){return request(_0x9ec3('0x11'),{'options':{'raw':![],'where':{'id':_0xaa1307},'include':[{'model':_0x9ec3('0x12'),'as':_0x9ec3('0x13'),'include':[{'model':_0x9ec3('0x14'),'as':_0x9ec3('0x14')}]}],'attributes':['id','name',_0x9ec3('0x15')],'smtp':!![]}});};exports[_0x9ec3('0x16')]=function(_0x1bd7e6){return request('ShowSquareProject',{'options':{'where':{'id':_0x1bd7e6},'attributes':[_0x9ec3('0xc')]}});};exports['getVoiceQueueById']=function(_0x471112){return request(_0x9ec3('0x17'),{'options':{'where':{'id':_0x471112},'attributes':[_0x9ec3('0xc')]}});};exports[_0x9ec3('0x18')]=function(_0x42b0fb){return request(_0x9ec3('0x19'),{'options':{'where':{'id':_0x42b0fb},'attributes':[_0x9ec3('0xc')]}});};exports[_0x9ec3('0x1a')]=function(_0x453010){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x453010},'attributes':[_0x9ec3('0x1b')]}});};exports['getUserById']=function(_0x489ebb){return request(_0x9ec3('0x1c'),{'options':{'where':{'id':_0x489ebb},'attributes':[_0x9ec3('0xc')]}});};exports[_0x9ec3('0x1d')]=function(_0xa3bade){return request(_0x9ec3('0x1e'),{'options':{'where':{'phone':_0xa3bade['phone']},'attributes':['id']}});};exports[_0x9ec3('0x1f')]=function(_0x4a413c){return request(_0x9ec3('0x20'),{'options':{'where':{'id':_0x4a413c},'attributes':['name']}});};exports[_0x9ec3('0x21')]=function(_0x28e31f){return request(_0x9ec3('0x22'),{'options':{'where':{'id':_0x28e31f},'attributes':['save_name']}});};exports[_0x9ec3('0x23')]=function(_0x59fc83){return request(_0x9ec3('0x24'),{'options':{'raw':![],'where':{'id':_0x59fc83},'include':[{'model':'Interval','as':_0x9ec3('0x25')}]}});};exports[_0x9ec3('0x26')]=function(_0x149743){return request(_0x9ec3('0x27'),{'options':{'where':{'id':_0x149743},'attributes':['id',_0x9ec3('0xc')]}});};exports[_0x9ec3('0x28')]=function(_0x20de22){return request('CreateSmsMessage',{'body':_0x20de22});};exports[_0x9ec3('0x29')]=function(_0x17af83){return request(_0x9ec3('0x2a'),{'body':_0x17af83});};exports[_0x9ec3('0x2b')]=function(_0x3cd7fd){return request(_0x9ec3('0x2c'),{'body':_[_0x9ec3('0x2d')](_0x3cd7fd,{'project_name':_0x3cd7fd[_0x9ec3('0x2e')],'prev_project_name':_0x3cd7fd[_0x9ec3('0x2f')]||'','is_subproject':_0x3cd7fd[_0x9ec3('0x2f')]?!![]:![],'leaveAt':moment()[_0x9ec3('0x30')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x9ec3('0x31')]=function(_0x2c9e39){return request(_0x9ec3('0x32'),{'body':_0x2c9e39});};exports[_0x9ec3('0x33')]=function(_0x5caa01){return request(_0x9ec3('0x34'),{'body':_0x5caa01});};exports[_0x9ec3('0x35')]=function(_0x141149){return request(_0x9ec3('0x36'),{'options':{'raw':![],'where':{'phone':_0x141149[_0x9ec3('0x37')],'ListId':_0x141149[_0x9ec3('0x38')]}}})[_0x9ec3('0x6')](function(_0x1575b6){if(_0x1575b6){return _0x1575b6;}return request(_0x9ec3('0x39'),{'body':_0x141149});});};exports[_0x9ec3('0x3a')]=function(_0xe21f81){return request(_0x9ec3('0x3b'),{'options':{'where':{'id':_0xe21f81},'attributes':[_0x9ec3('0xc')]}});};exports[_0x9ec3('0x3c')]=function(_0x2b7113,_0x3b580f){return request(_0x9ec3('0x3d'),{'body':{'interface':_0x3b580f},'options':{'where':_0x2b7113}});};exports['agentPause']=function(_0x5caa5a,_0x4c50fd,_0x1e86a7){return request(_0x9ec3('0x3e'),{'body':{'type':_0x4c50fd,'uniqueid':_0x1e86a7},'options':{'where':_0x5caa5a}});};exports[_0x9ec3('0x3f')]=function(_0x1d8306){return request(_0x9ec3('0x40'),{'body':{},'options':{'where':_0x1d8306}});};exports[_0x9ec3('0x41')]=function(_0x2891fc){return request('LogoutUser',{'body':{},'options':{'where':_0x2891fc}});}; \ 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 f197a66..5c893f7 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 _0x36b2=['./lex','exports','./polly'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x36b2,0x6b));var _0x236b=function(_0x33595e,_0x560193){_0x33595e=_0x33595e-0x0;var _0x1c5398=_0x36b2[_0x33595e];return _0x1c5398;};var polly=require(_0x236b('0x0'));var lex=require(_0x236b('0x1'));module[_0x236b('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7c09=['./lex','exports'];(function(_0x42b678,_0x38ee8b){var _0x102def=function(_0x567128){while(--_0x567128){_0x42b678['push'](_0x42b678['shift']());}};_0x102def(++_0x38ee8b);}(_0x7c09,0x102));var _0x97c0=function(_0x4e4708,_0x5ae438){_0x4e4708=_0x4e4708-0x0;var _0x5823ca=_0x7c09[_0x4e4708];return _0x5823ca;};var polly=require('./polly');var lex=require(_0x97c0('0x0'));module[_0x97c0('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 9505dd0..c6b6aee 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 _0x2dae=['./lib/api'];(function(_0x19b6d7,_0x41130d){var _0x5ee0d5=function(_0x77f9af){while(--_0x77f9af){_0x19b6d7['push'](_0x19b6d7['shift']());}};_0x5ee0d5(++_0x41130d);}(_0x2dae,0xc3));var _0xe2da=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2dae[_0x4ae625];return _0x31accf;};'use strict';var lex=require(_0xe2da('0x0'));module['exports']=function(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97){return lex(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97);}; \ No newline at end of file +var _0xa571=['exports','./lib/api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa571,0x107));var _0x1a57=function(_0x42fe8d,_0x6e88aa){_0x42fe8d=_0x42fe8d-0x0;var _0xde69f3=_0xa571[_0x42fe8d];return _0xde69f3;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ 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 f0c4164..9e9f0a8 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(_0x2d3206,_0x434cf5){var _0x18702d=function(_0x4e0735){while(--_0x4e0735){_0x2d3206['push'](_0x2d3206['shift']());}};_0x18702d(++_0x434cf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x10c697,_0x359264){var _0x5544c2=function(_0x5bd087){while(--_0x5bd087){_0x10c697['push'](_0x10c697['shift']());}};_0x5544c2(++_0x359264);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 3deaa39..d9b7afe 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cd0=['exports','./lib/api'];(function(_0x3352ca,_0x5ab426){var _0x5ad969=function(_0x26118a){while(--_0x26118a){_0x3352ca['push'](_0x3352ca['shift']());}};_0x5ad969(++_0x5ab426);}(_0x0cd0,0x83));var _0x00cd=function(_0xac939f,_0x59237e){_0xac939f=_0xac939f-0x0;var _0x2a7030=_0x0cd0[_0xac939f];return _0x2a7030;};'use strict';var polly=require(_0x00cd('0x0'));module[_0x00cd('0x1')]=function(_0x571a63,_0x1c0075,_0x2a0bab,_0x4482e4,_0x128ca5,_0x464ee2,_0x59d5c8){return polly(_0x571a63,_0x1c0075,_0x2a0bab,_0x4482e4,_0x128ca5,_0x464ee2,_0x59d5c8);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x3159eb,_0xc56407,_0x2c3198,_0x184acd,_0x39498d,_0x570eaa,_0x280eea){return polly(_0x3159eb,_0xc56407,_0x2c3198,_0x184acd,_0x39498d,_0x570eaa,_0x280eea);}; \ 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 c377b7d..b7c6cb7 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 _0xf2a5=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','bluebird','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x521632,_0x531850){var _0x5c1402=function(_0xcfc57b){while(--_0xcfc57b){_0x521632['push'](_0x521632['shift']());}};_0x5c1402(++_0x531850);}(_0xf2a5,0x6a));var _0x5f2a=function(_0x109b77,_0x335d81){_0x109b77=_0x109b77-0x0;var _0x29c9a8=_0xf2a5[_0x109b77];return _0x29c9a8;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x5f2a('0x0'));var rs=require('randomstring');var AWS=require(_0x5f2a('0x1'));function pollyResult(_0x4deb2b,_0x2af604,_0x27ccf1){return new BPromise(function(_0x346bdc,_0x206e33){_0x4deb2b[_0x5f2a('0x2')](_0x2af604,function(_0x592d3b,_0x3c57d5){if(_0x592d3b){_0x206e33(_0x592d3b);}else if(_0x3c57d5){if(_0x3c57d5['AudioStream']instanceof Buffer){fs[_0x5f2a('0x3')](_0x27ccf1,_0x3c57d5[_0x5f2a('0x4')],function(_0x5a729c){if(_0x5a729c){_0x206e33(_0x5a729c);}else{_0x346bdc();}});}else{_0x206e33(new Error(_0x5f2a('0x5')));}}else{_0x206e33(new Error(_0x5f2a('0x6')));}});});}module[_0x5f2a('0x7')]=function(_0x3baba6,_0x2acea0,_0x4780ba,_0x53ead8,_0x130dd1,_0x3dc537,_0x561ee9){var _0x570393=new AWS['Polly']({'accessKeyId':_0x3baba6,'secretAccessKey':_0x2acea0,'region':_0x4780ba});var _0x2156ae={'Text':_0x130dd1,'TextType':_0x3dc537||_0x5f2a('0x8'),'OutputFormat':_0x5f2a('0x9'),'VoiceId':_0x53ead8};return pollyResult(_0x570393,_0x2156ae,_0x561ee9);}; \ No newline at end of file +var _0x6032=['synthesizeSpeech','AudioStream','exports','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x561eb7,_0x250764){var _0xb5c0be=function(_0xf2a26d){while(--_0xf2a26d){_0x561eb7['push'](_0x561eb7['shift']());}};_0xb5c0be(++_0x250764);}(_0x6032,0x191));var _0x2603=function(_0x223643,_0x111fcb){_0x223643=_0x223643-0x0;var _0x6f8006=_0x6032[_0x223643];return _0x6f8006;};'use strict';var fs=require('fs');var path=require(_0x2603('0x0'));var BPromise=require(_0x2603('0x1'));var rs=require(_0x2603('0x2'));var AWS=require(_0x2603('0x3'));function pollyResult(_0x2a39ce,_0x21f293,_0x3f6d23){return new BPromise(function(_0x95a71,_0x26432b){_0x2a39ce[_0x2603('0x4')](_0x21f293,function(_0x4dd6ad,_0x3b09a3){if(_0x4dd6ad){_0x26432b(_0x4dd6ad);}else if(_0x3b09a3){if(_0x3b09a3['AudioStream']instanceof Buffer){fs['writeFile'](_0x3f6d23,_0x3b09a3[_0x2603('0x5')],function(_0x3f0e0c){if(_0x3f0e0c){_0x26432b(_0x3f0e0c);}else{_0x95a71();}});}else{_0x26432b(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x26432b(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x2603('0x6')]=function(_0x5d9960,_0x181984,_0x5ebc61,_0x5e3c59,_0x1768ce,_0x559f28,_0xc55a2d){var _0x5699f6=new AWS['Polly']({'accessKeyId':_0x5d9960,'secretAccessKey':_0x181984,'region':_0x5ebc61});var _0xa75865={'Text':_0x1768ce,'TextType':_0x559f28||_0x2603('0x7'),'OutputFormat':_0x2603('0x8'),'VoiceId':_0x5e3c59};return pollyResult(_0x5699f6,_0xa75865,_0xc55a2d);}; \ 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 12cf77e..6f9ac97 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 _0x054e=['./lib/api','exports'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x054e,0x66));var _0xe054=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0x054e[_0x1e8b1e];return _0x4a0fde;};'use strict';var asr=require(_0xe054('0x0'));module[_0xe054('0x1')]=function(_0x1c1e6f,_0x5612fd,_0xd96430,_0x29d1fd){return asr(_0x1c1e6f,_0x5612fd,_0xd96430);}; \ No newline at end of file +var _0xbc3e=['./lib/api'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xbc3e,0xb6));var _0xebc3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbc3e[_0x3ab51d];return _0x29a04e;};'use strict';var asr=require(_0xebc3('0x0'));module['exports']=function(_0x46f294,_0x25b362,_0x57307f,_0x442297){return asr(_0x46f294,_0x25b362,_0x57307f);}; \ 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 e328831..8b3d3f3 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 _0x720c=['/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','POST'];(function(_0x5f30b9,_0x196dad){var _0x3e8ee9=function(_0x353912){while(--_0x353912){_0x5f30b9['push'](_0x5f30b9['shift']());}};_0x3e8ee9(++_0x196dad);}(_0x720c,0x154));var _0xc720=function(_0x2d9887,_0x1481f0){_0x2d9887=_0x2d9887-0x0;var _0x24fced=_0x720c[_0x2d9887];return _0x24fced;};'use strict';var url=require(_0xc720('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xc720('0x1');module[_0xc720('0x2')]=function(_0x304440,_0x127edb,_0x5e0261){return new BPromise(function(_0x3863fa,_0x2336e6){var _0x3e4155;if(typeof _0x304440!==_0xc720('0x3')||_0x304440[_0xc720('0x4')]===0x0){return _0x2336e6(_0xc720('0x5'));}if(typeof _0x127edb!==_0xc720('0x3')||_0x127edb['length']===0x0){return _0x2336e6(_0xc720('0x6'));}if(typeof _0x5e0261!==_0xc720('0x7')&&(typeof _0x5e0261!==_0xc720('0x3')||_0x5e0261[_0xc720('0x4')]===0x0)){return _0x2336e6(_0xc720('0x8'));}try{_0x3e4155=fs['readFileSync'](_0x304440)['toString'](_0xc720('0x9'));}catch(_0x4bea5d){return _0x2336e6(_0x4bea5d);}return _0x3863fa({'method':_0xc720('0xa'),'uri':host+_0xc720('0xb')+_0x127edb,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xc720('0xc'),'languageCode':_0x5e0261},'audio':{'content':_0x3e4155}},'json':!![]});});}; \ No newline at end of file +var _0x8128=['8000','url','exports','length','filepath\x20should\x20be\x20a\x20string','string','undefined','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x371f33,_0x278a69){var _0x246c96=function(_0x4f8bad){while(--_0x4f8bad){_0x371f33['push'](_0x371f33['shift']());}};_0x246c96(++_0x278a69);}(_0x8128,0x1b1));var _0x8812=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8128[_0x397e5f];return _0x5302b8;};'use strict';var url=require(_0x8812('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x8812('0x1')]=function(_0x1e472a,_0x4efc58,_0x5dbf05){return new BPromise(function(_0x1c189a,_0x2aeddc){var _0x21b1d5;if(typeof _0x1e472a!=='string'||_0x1e472a[_0x8812('0x2')]===0x0){return _0x2aeddc(_0x8812('0x3'));}if(typeof _0x4efc58!==_0x8812('0x4')||_0x4efc58[_0x8812('0x2')]===0x0){return _0x2aeddc('key\x20should\x20be\x20a\x20string');}if(typeof _0x5dbf05!==_0x8812('0x5')&&(typeof _0x5dbf05!==_0x8812('0x4')||_0x5dbf05['length']===0x0)){return _0x2aeddc('lang\x20should\x20be\x20a\x20string');}try{_0x21b1d5=fs['readFileSync'](_0x1e472a)[_0x8812('0x6')](_0x8812('0x7'));}catch(_0x40c677){return _0x2aeddc(_0x40c677);}return _0x1c189a({'method':_0x8812('0x8'),'uri':host+_0x8812('0x9')+_0x4efc58,'body':{'config':{'encoding':_0x8812('0xa'),'sampleRateHertz':_0x8812('0xb'),'languageCode':_0x5dbf05},'audio':{'content':_0x21b1d5}},'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 91eb4f6..9b3dfaf 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 _0xafa6=['exports','./asr'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xafa6,0x14d));var _0x6afa=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xafa6[_0x4a747d];return _0x3a5b5c;};var asr=require(_0x6afa('0x0'));module[_0x6afa('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5f59=['exports'];(function(_0x44c340,_0x575719){var _0x2cd080=function(_0x1109ea){while(--_0x1109ea){_0x44c340['push'](_0x44c340['shift']());}};_0x2cd080(++_0x575719);}(_0x5f59,0xe6));var _0x95f5=function(_0x12db51,_0x16a0e3){_0x12db51=_0x12db51-0x0;var _0x478fa5=_0x5f59[_0x12db51];return _0x478fa5;};var asr=require('./asr');module[_0x95f5('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 697902f..19bc5e4 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 _0x53c5=['displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','protocol','https:','host','WHAT_EVER','statusCode','error','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','get','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','.wav','writeFileSync','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','?key=','ssml','input','voice','MP3','resolve','generate','from','writeFile','then','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','uri','map','alternatives','transcript','results','confidence','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','result','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent'];(function(_0x1f23bf,_0x4a2a8a){var _0x366964=function(_0x7bbde8){while(--_0x7bbde8){_0x1f23bf['push'](_0x1f23bf['shift']());}};_0x366964(++_0x4a2a8a);}(_0x53c5,0x122));var _0x553c=function(_0xe60ab5,_0x667760){_0xe60ab5=_0xe60ab5-0x0;var _0x20850e=_0x53c5[_0xe60ab5];return _0x20850e;};'use strict';var apiai=require(_0x553c('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x553c('0x1'));var fs=require('fs');var http=require(_0x553c('0x2'));var https=require(_0x553c('0x3'));var md5=require(_0x553c('0x4'));var path=require(_0x553c('0x5'));var querystring=require(_0x553c('0x6'));var rp=require('request-promise');var rs=require(_0x553c('0x7'));var sox=require(_0x553c('0x8'));var tts=require(_0x553c('0x9'));var urlParse=require(_0x553c('0xa'))[_0x553c('0xb')];var util=require(_0x553c('0xc'));var aws=require(_0x553c('0xd'));var google=require(_0x553c('0xe'));var sestek=require('./sestek');var tilde=require(_0x553c('0xf'));var logger=require(_0x553c('0x10'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xf27ce2,_0x2419f8){return new BPromise(function(_0x6b8c86,_0x271d3a){var _0x242623=urlParse(_0xf27ce2);var _0x2f2aac=_0x242623[_0x553c('0x11')]===_0x553c('0x12')?https:http;var _0x5dbfce={'host':_0x242623[_0x553c('0x13')],'path':_0x242623['path'],'headers':{'user-agent':_0x553c('0x14')}};_0x2f2aac['get'](_0x5dbfce,function(_0x1c4593){if(_0x1c4593[_0x553c('0x15')]!==0xc8){logger[_0x553c('0x16')]('request\x20to\x20'+_0xf27ce2+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c4593['statusCode']+'\x20('+_0x1c4593[_0x553c('0x17')]+')');_0x271d3a(new Error(_0x553c('0x18')+_0xf27ce2+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c4593[_0x553c('0x15')]+'\x20('+_0x1c4593[_0x553c('0x17')]+')'));return;}var _0x4fc169=fs[_0x553c('0x19')](_0x2419f8);_0x4fc169['on'](_0x553c('0x1a'),function(){logger['info'](_0x553c('0x1b'));_0x4fc169[_0x553c('0x1c')](_0x6b8c86);});_0x4fc169['on']('error',function(_0x5dc06d){fs[_0x553c('0x1d')](_0x2419f8);logger[_0x553c('0x16')](_0x553c('0x1e'),_0x5dc06d);_0x271d3a(_0x5dc06d);});_0x1c4593[_0x553c('0x1f')](_0x4fc169);})['on'](_0x553c('0x16'),function(_0x47d2de){logger[_0x553c('0x16')](_0x47d2de);_0x271d3a(_0x47d2de);})['end']();});}function uploadFile(_0x3690f0){return new BPromise(function(_0x57383b,_0x37010d){var _0xc404ab=urlParse(_0x3690f0);var _0x3600ea=_0xc404ab[_0x553c('0x11')]===_0x553c('0x12')?https:http;var _0x17a41c={'host':_0xc404ab[_0x553c('0x13')],'path':_0xc404ab[_0x553c('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x3600ea[_0x553c('0x20')](_0x17a41c,function(_0x1690d9){if(_0x1690d9[_0x553c('0x15')]!==0xc8){_0x37010d(new Error(_0x553c('0x18')+_0x3690f0+'\x20failed,\x20status\x20code\x20=\x20'+_0x1690d9[_0x553c('0x15')]+'\x20('+_0x1690d9['statusMessage']+')'));return;}var _0x5376ee='';_0x1690d9['on']('data',function(_0x2b07e2){_0x5376ee+=_0x2b07e2;});_0x1690d9['on'](_0x553c('0x21'),function(){_0x57383b(_0x5376ee);});})['on']('error',function(_0x5dec87){_0x37010d(_0x5dec87);})[_0x553c('0x21')]();});}function convertFile(_0x49c536,_0x34ebdd){return new BPromise(function(_0x12922e,_0x2e71b){var _0x258b87=sox[_0x553c('0x22')](_0x49c536,_0x34ebdd,{'sampleRate':0x1f40,'format':_0x553c('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x258b87['on'](_0x553c('0x16'),function(_0x2feb9f){logger[_0x553c('0x16')](_0x553c('0x24'),_0x2feb9f);_0x2e71b(_0x2feb9f);});_0x258b87['on']('end',function(){logger[_0x553c('0x25')](_0x553c('0x26'));_0x12922e();});_0x258b87[_0x553c('0x27')]();});}function base64Decode(_0x43d35b,_0x3e6f39){var _0x533924=path['resolve'](__dirname,_0x553c('0x28'),rs['generate'](0x4)+_0x553c('0x29'));fs[_0x553c('0x2a')](_0x533924,_0x43d35b,'base64');return convertFile(_0x533924,_0x3e6f39)['then'](function(){try{fs[_0x553c('0x1d')](_0x533924);fs[_0x553c('0x2b')](_0x3e6f39,_0x553c('0x2c'));}catch(_0x3fc389){logger['error'](_0x3fc389);}return _0x3e6f39[_0x553c('0x2d')]('.')[0x0];});}function base64Encode(_0x2d16da){var _0x235990=fs[_0x553c('0x2e')](_0x2d16da);return new Buffer(_0x235990)[_0x553c('0x2f')](_0x553c('0x30'));}exports[_0x553c('0x31')]=function(_0xf6275a,_0x2b3299,_0x56b6af,_0x5f01f8,_0x5964fd,_0x10a313){var _0x3b3f79,_0x2c0202;var _0x5950f9='https://texttospeech.googleapis.com/v1/';var _0x4dae4c=_0x553c('0x32')+_0xf6275a;var _0x52450a={};if(_0x2b3299===_0x553c('0x33')){_0x52450a[_0x553c('0x34')]={'ssml':_0x56b6af};}else{_0x52450a[_0x553c('0x34')]={'text':_0x56b6af};};_0x52450a[_0x553c('0x35')]={'languageCode':_0x5f01f8,'ssmlGender':_0x5964fd};_0x52450a['audioConfig']={'audioEncoding':_0x553c('0x36'),'sampleRateHertz':0x1f40};var _0x3a5414={'url':_0x5950f9+'text:synthesize'+_0x4dae4c,'method':'POST','json':!![],'body':_0x52450a};return rp(_0x3a5414)['then'](function(_0x405836){return new BPromise(function(_0x35bf0e,_0x1df6d8){_0x3b3f79=path[_0x553c('0x37')](__dirname,'tmp',rs[_0x553c('0x38')](0x4)+'.mp3');var _0x288735=Buffer[_0x553c('0x39')](_0x405836['audioContent'],_0x553c('0x30'));return fs[_0x553c('0x3a')](_0x3b3f79,_0x288735,function(_0x355a6e){_0x1df6d8(_0x355a6e);},function(_0x588566){fs[_0x553c('0x2b')](_0x3b3f79,_0x553c('0x2c'));_0x35bf0e(_0x588566);});});})[_0x553c('0x3b')](function(_0x3b7417){_0x2c0202=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x3b3f79,_0x2c0202);})['then'](function(){try{fs[_0x553c('0x1d')](_0x3b3f79);fs[_0x553c('0x2b')](_0x2c0202,_0x553c('0x2c'));}catch(_0x4ded39){logger['error'](_0x4ded39);}logger['info'](_0x553c('0x3c'),_0x2c0202[_0x553c('0x2d')]('.')[0x0]);return _0x2c0202[_0x553c('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x200cec,_0x17ce67){var _0x535bc0=_0x553c('0x3d');var _0x249ae9,_0x15f490;var _0xf693b3;var _0xba2d7b={'encoding':_0x553c('0x3e'),'method':'POST','timeout':0x2710,'url':_0x535bc0,'headers':{'Content-Type':_0x553c('0x3f')},'body':_0x553c('0x40')+encodeURIComponent(JSON[_0x553c('0x41')]([[[_0x553c('0x42'),JSON['stringify']([_0x200cec,_0x17ce67||'en',![],'null']),null,'generic']]]))};return rp(_0xba2d7b)['then'](function(_0x20924a){try{_0xf693b3=eval(_0x20924a[_0x553c('0x43')](0x5))[0x0][0x2];}catch(_0x3a8b17){throw new Error(_0x553c('0x44')+_0x20924a[_0x553c('0x45')]);}if(!_0xf693b3){if(_0x200cec[_0x553c('0x46')]>0xc8){throw new Error(_0x553c('0x47'));}else{throw new Error(_0x553c('0x48')+_0x17ce67+_0x553c('0x49'));}}try{_0xf693b3=eval(_0xf693b3)[0x0];}catch(_0x84385f){throw new Error(_0x553c('0x44')+res[_0x553c('0x45')]);}const _0xbb517b=_0xf693b3;_0x249ae9=path['resolve'](__dirname,_0x553c('0x28'),rs[_0x553c('0x38')](0x4)+_0x553c('0x4a'));fs[_0x553c('0x2a')](_0x249ae9,_0xf693b3,{'encoding':_0x553c('0x30')});_0x15f490=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs['generate'](0x4)+_0x553c('0x29'));return convertFile(_0x249ae9,_0x15f490);})[_0x553c('0x3b')](function(){try{fs[_0x553c('0x1d')](_0x249ae9);fs['chmodSync'](_0x15f490,'777');}catch(_0x1f9322){logger['error'](_0x1f9322);}logger[_0x553c('0x25')](_0x553c('0x4b'),_0x15f490['split']('.')[0x0]);return _0x15f490[_0x553c('0x2d')]('.')[0x0];});};exports[_0x553c('0x4c')]=function(_0x5865e2,_0x2fecb9,_0x4b6b32){return google[_0x553c('0x4d')](_0x5865e2,_0x2fecb9,_0x4b6b32)[_0x553c('0x3b')](function(_0xc25f50){logger[_0x553c('0x25')](_0xc25f50[_0x553c('0x4e')]);return rp(_0xc25f50);})[_0x553c('0x3b')](function(_0x263652){var _0x27a4ee='';var _0x4a8dfd=0x0;try{fs['unlink'](_0x5865e2);}catch(_0x80611b){logger[_0x553c('0x16')](_0x80611b);}if(_0x263652&&_0x263652['results']){_0x27a4ee=_0x263652['results'][_0x553c('0x4f')](function(_0xd56c36){return _0xd56c36&&_0xd56c36['alternatives'][0x0]&&_0xd56c36[_0x553c('0x50')][0x0][_0x553c('0x51')]?_0xd56c36[_0x553c('0x50')][0x0]['transcript']:'';})['join']('\x0a');_0x4a8dfd=_0x263652[_0x553c('0x52')][_0x553c('0x4f')](function(_0x4669a3){return _0x4669a3&&_0x4669a3[_0x553c('0x50')][0x0]&&_0x4669a3[_0x553c('0x50')][0x0][_0x553c('0x53')]?_0x4669a3[_0x553c('0x50')][0x0][_0x553c('0x53')]:0x0;})[_0x553c('0x54')]('\x0a');}logger[_0x553c('0x25')]('googleASR\x20transcription',_0x27a4ee);logger[_0x553c('0x25')](_0x553c('0x55'),_0x4a8dfd);return{'transcript':_0x27a4ee,'confidence':_0x4a8dfd};})[_0x553c('0x56')](function(_0x470b5e){logger['error'](_0x553c('0x57'),_0x470b5e['statusCode'],_0x470b5e[_0x553c('0x58')],_0x470b5e[_0x553c('0x59')]);});};exports['googleDialogflow']=function(_0x441104,_0x264d8b,_0x18aa72,_0x4be4d5){var _0x4932df=apiai(_0x264d8b,{'language':_0x4be4d5||'en'});return _0x4932df['textRequest'](_0x18aa72,{'sessionId':md5(_0x441104)})[_0x553c('0x3b')](function(_0x30d0de){logger[_0x553c('0x25')](JSON['stringify'](_0x30d0de));return{'source':_0x30d0de[_0x553c('0x5a')]['source'],'resolvedQuery':_0x30d0de[_0x553c('0x5a')]['resolvedQuery'],'action':_0x30d0de[_0x553c('0x5a')][_0x553c('0x5b')],'actionIncomplete':_0x30d0de[_0x553c('0x5a')][_0x553c('0x5c')],'speech':_0x30d0de['result'][_0x553c('0x5d')][_0x553c('0x5e')],'score':_0x30d0de['result'][_0x553c('0x5f')],'statusCode':_0x30d0de[_0x553c('0x60')]['code'],'endConversation':_0x30d0de['result'][_0x553c('0x61')][_0x553c('0x62')]||![],'isFallbackIntent':_0x30d0de['result'][_0x553c('0x61')][_0x553c('0x63')]};});};exports[_0x553c('0x64')]=function(_0x563b2c,_0x4c1f72,_0x1b8ece,_0x1fc969,_0x38f9c9,_0x20186e){var _0x8615a0=_0x1fc969[_0x553c('0x65')](/\\n/g,'\x0a');var _0x20857f={'credentials':{'private_key':_0x8615a0,'client_email':_0x1b8ece}};var _0x4fa5fc=new dialogflow[(_0x553c('0x66'))](_0x20857f);var _0x40566a=_0x4fa5fc[_0x553c('0x67')](_0x4c1f72,md5(_0x563b2c));var _0x40660a={'session':_0x40566a,'queryInput':{'text':{'text':_0x38f9c9,'languageCode':_0x20186e}}};return _0x4fa5fc['detectIntent'](_0x40660a)[_0x553c('0x3b')](function(_0x20be11){if(_0x20be11&&_0x20be11[_0x553c('0x46')]){logger[_0x553c('0x25')](_0x553c('0x68'),JSON['stringify'](_0x20be11));var _0x4db435=_0x20be11[0x0];if(_0x4db435){var _0x4395bf={'action':_0x4db435[_0x553c('0x69')][_0x553c('0x5b')],'allRequiredParamsPresent':_0x4db435[_0x553c('0x69')]['allRequiredParamsPresent'],'endConversation':_0x4db435[_0x553c('0x69')][_0x553c('0x6a')]&&_0x4db435[_0x553c('0x69')][_0x553c('0x6a')][_0x553c('0x6b')]?_0x4db435[_0x553c('0x69')][_0x553c('0x6a')][_0x553c('0x6b')][_0x553c('0x6c')][_0x553c('0x6d')]:![],'fulfillmentText':_0x4db435[_0x553c('0x69')][_0x553c('0x6e')],'intentName':_0x4db435[_0x553c('0x69')][_0x553c('0x6f')]['name'],'intentDisplayName':_0x4db435[_0x553c('0x69')]['intent'][_0x553c('0x70')],'isFallbackIntent':_0x4db435[_0x553c('0x69')][_0x553c('0x6f')][_0x553c('0x71')],'languageCode':_0x4db435[_0x553c('0x69')][_0x553c('0x72')],'queryText':_0x4db435[_0x553c('0x69')][_0x553c('0x73')],'responseId':_0x4db435[_0x553c('0x74')],'score':_0x4db435[_0x553c('0x69')][_0x553c('0x75')],'speech':_0x4db435[_0x553c('0x69')][_0x553c('0x6e')],'providerResponse':JSON['stringify'](_0x20be11)};return _0x4395bf;}}});};exports['tildeASR']=function(_0x4514ac,_0x3e342a,_0x578e2f,_0x5dde12){return tilde[_0x553c('0x4d')](_0x4514ac,_0x3e342a,_0x578e2f,_0x5dde12)[_0x553c('0x3b')](function(_0x278d4c){try{fs[_0x553c('0x1d')](_0x4514ac);}catch(_0x5666ec){logger[_0x553c('0x16')](_0x5666ec);}logger[_0x553c('0x25')]('Tilde\x20ASR\x20transcription',_0x278d4c[_0x553c('0x51')]);logger[_0x553c('0x25')](_0x553c('0x76'),_0x278d4c['confidence']);return _0x278d4c;});};exports[_0x553c('0x77')]=function(_0x1b0482,_0x2d92db,_0x2feddc,_0x1ceaf5,_0x4edec6,_0x51a7e8){var _0x231174=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs[_0x553c('0x38')](0x4)+_0x553c('0x4a'));var _0x5abd0f;return aws[_0x553c('0x78')](_0x1b0482,_0x2d92db,_0x2feddc,_0x1ceaf5,_0x4edec6,_0x51a7e8,_0x231174)[_0x553c('0x3b')](function(){_0x5abd0f=path[_0x553c('0x37')](__dirname,'tmp',rs[_0x553c('0x38')](0x4)+_0x553c('0x29'));return convertFile(_0x231174,_0x5abd0f);})['then'](function(){try{fs['unlink'](_0x231174);fs['chmodSync'](_0x5abd0f,_0x553c('0x2c'));}catch(_0x458cde){logger[_0x553c('0x16')](_0x458cde);}return _0x5abd0f[_0x553c('0x2d')]('.')[0x0];});};exports[_0x553c('0x79')]=function(_0x5e5526,_0x3453a1,_0x367ca2,_0x1f044a,_0x9b6f67,_0x5e3d50){return aws['lex'](_0x5e5526,_0x3453a1,_0x367ca2,_0x1f044a,_0x9b6f67,_0x5e3d50)[_0x553c('0x3b')](function(_0x1696ce){logger[_0x553c('0x25')](JSON[_0x553c('0x41')](_0x1696ce));return _0x1696ce;});};exports[_0x553c('0x7a')]=function(_0x20cab9,_0x498758,_0x65c537,_0x452e39){var _0x57acdc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x20cab9,encodeURIComponent(_0x498758),_0x65c537,_0x452e39);var _0x2155b1=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs[_0x553c('0x38')](0x4)+_0x553c('0x4a'));var _0x954e20;return downloadFile(_0x57acdc,_0x2155b1)[_0x553c('0x3b')](function(){_0x954e20=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs[_0x553c('0x38')](0x4)+_0x553c('0x29'));return convertFile(_0x2155b1,_0x954e20);})[_0x553c('0x3b')](function(){try{fs['unlink'](_0x2155b1);fs[_0x553c('0x2b')](_0x954e20,_0x553c('0x2c'));}catch(_0x91d181){logger[_0x553c('0x16')](_0x91d181);}return _0x954e20[_0x553c('0x2d')]('.')[0x0];});};exports[_0x553c('0x7b')]=function(_0x4a4490,_0x12f45e,_0xf1a05c,_0x25b882){var _0x2e6da4=util['format'](_0x553c('0x7c'),ISPEECH_API,_0x12f45e,_0xf1a05c,base64Encode(_0x4a4490),_0x25b882?util[_0x553c('0x7d')](_0x553c('0x7e'),encodeURIComponent(_0x25b882)):'freeform=3');return uploadFile(_0x2e6da4)[_0x553c('0x3b')](function(_0x47edb6){return querystring['parse'](_0x47edb6);});};exports['sestekNDA']=function(_0x2fe313,_0x13b42a){return sestek['nda'](_0x2fe313,_0x13b42a)['then'](function(_0xcdf1ba){logger[_0x553c('0x25')](JSON[_0x553c('0x41')](_0xcdf1ba));var _0x564eac={'speech':_0xcdf1ba['text'],'action':_0xcdf1ba['channelData']?_0xcdf1ba[_0x553c('0x7f')][_0x553c('0x80')]:undefined,'actiondata':_0xcdf1ba[_0x553c('0x7f')]?_0xcdf1ba[_0x553c('0x7f')][_0x553c('0x81')]:undefined};if(_0xcdf1ba[_0x553c('0x7f')]&&_0xcdf1ba['channelData'][_0x553c('0x82')]){return base64Decode(_0xcdf1ba[_0x553c('0x7f')][_0x553c('0x82')][_0x553c('0x83')],path[_0x553c('0x37')](__dirname,'tmp',rs[_0x553c('0x38')](0x4)+_0x553c('0x29')))['then'](function(_0x291146){_0x564eac[_0x553c('0x84')]=_0x291146;return _0x564eac;});}return _0x564eac;});};exports[_0x553c('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x95c6=['goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','textRequest','result','resolvedQuery','action','actionIncomplete','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','get','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','tmp','writeFileSync','then','chmodSync','777','split','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','generate','.mp3','from','audioContent','base64','writeFile','googleCloudTTS\x20path','utf8','POST','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','slice','parse\x20response\x20failed:\x0a','length','\x22\x20might\x20not\x20exist','.wav'];(function(_0x5d8c7d,_0x3e6c01){var _0x326595=function(_0x57f7b1){while(--_0x57f7b1){_0x5d8c7d['push'](_0x5d8c7d['shift']());}};_0x326595(++_0x3e6c01);}(_0x95c6,0x14c));var _0x695c=function(_0x258fe1,_0x40a300){_0x258fe1=_0x258fe1-0x0;var _0x597fab=_0x95c6[_0x258fe1];return _0x597fab;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x695c('0x0'));var dialogflow=require(_0x695c('0x1'));var fs=require('fs');var http=require(_0x695c('0x2'));var https=require(_0x695c('0x3'));var md5=require(_0x695c('0x4'));var path=require('path');var querystring=require(_0x695c('0x5'));var rp=require(_0x695c('0x6'));var rs=require(_0x695c('0x7'));var sox=require(_0x695c('0x8'));var tts=require(_0x695c('0x9'));var urlParse=require(_0x695c('0xa'))[_0x695c('0xb')];var util=require('util');var aws=require('./aws');var google=require('./google');var sestek=require(_0x695c('0xc'));var tilde=require(_0x695c('0xd'));var logger=require(_0x695c('0xe'))(_0x695c('0xf'));var ISPEECH_API=_0x695c('0x10');function downloadFile(_0x18249f,_0x1eb7df){return new BPromise(function(_0x47c621,_0x154688){var _0x462525=urlParse(_0x18249f);var _0x501628=_0x462525[_0x695c('0x11')]===_0x695c('0x12')?https:http;var _0x2d3a6c={'host':_0x462525[_0x695c('0x13')],'path':_0x462525['path'],'headers':{'user-agent':_0x695c('0x14')}};_0x501628['get'](_0x2d3a6c,function(_0x1a2c62){if(_0x1a2c62[_0x695c('0x15')]!==0xc8){logger[_0x695c('0x16')]('request\x20to\x20'+_0x18249f+'\x20failed,\x20status\x20code\x20=\x20'+_0x1a2c62[_0x695c('0x15')]+'\x20('+_0x1a2c62[_0x695c('0x17')]+')');_0x154688(new Error(_0x695c('0x18')+_0x18249f+_0x695c('0x19')+_0x1a2c62[_0x695c('0x15')]+'\x20('+_0x1a2c62[_0x695c('0x17')]+')'));return;}var _0x427a1a=fs[_0x695c('0x1a')](_0x1eb7df);_0x427a1a['on'](_0x695c('0x1b'),function(){logger[_0x695c('0x1c')](_0x695c('0x1d'));_0x427a1a[_0x695c('0x1e')](_0x47c621);});_0x427a1a['on'](_0x695c('0x16'),function(_0x3d3573){fs[_0x695c('0x1f')](_0x1eb7df);logger[_0x695c('0x16')](_0x695c('0x20'),_0x3d3573);_0x154688(_0x3d3573);});_0x1a2c62[_0x695c('0x21')](_0x427a1a);})['on'](_0x695c('0x16'),function(_0x1e5468){logger[_0x695c('0x16')](_0x1e5468);_0x154688(_0x1e5468);})['end']();});}function uploadFile(_0x4c794d){return new BPromise(function(_0x3397d0,_0x46b267){var _0x446319=urlParse(_0x4c794d);var _0x5605e4=_0x446319[_0x695c('0x11')]===_0x695c('0x12')?https:http;var _0x127017={'host':_0x446319[_0x695c('0x13')],'path':_0x446319['path'],'headers':{'user-agent':_0x695c('0x14')}};_0x5605e4[_0x695c('0x22')](_0x127017,function(_0x54ec48){if(_0x54ec48['statusCode']!==0xc8){_0x46b267(new Error(_0x695c('0x18')+_0x4c794d+_0x695c('0x19')+_0x54ec48[_0x695c('0x15')]+'\x20('+_0x54ec48['statusMessage']+')'));return;}var _0x34d6d6='';_0x54ec48['on'](_0x695c('0x23'),function(_0x43c75c){_0x34d6d6+=_0x43c75c;});_0x54ec48['on'](_0x695c('0x24'),function(){_0x3397d0(_0x34d6d6);});})['on']('error',function(_0x2cab31){_0x46b267(_0x2cab31);})[_0x695c('0x24')]();});}function convertFile(_0xa81491,_0x115682){return new BPromise(function(_0xbffa1c,_0x1ff9ca){var _0x28362c=sox[_0x695c('0x25')](_0xa81491,_0x115682,{'sampleRate':0x1f40,'format':_0x695c('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x28362c['on'](_0x695c('0x16'),function(_0x435413){logger[_0x695c('0x16')](_0x695c('0x27'),_0x435413);_0x1ff9ca(_0x435413);});_0x28362c['on'](_0x695c('0x24'),function(){logger[_0x695c('0x1c')](_0x695c('0x28'));_0xbffa1c();});_0x28362c['start']();});}function base64Decode(_0x48514d,_0x111ed0){var _0x3be1ea=path['resolve'](__dirname,_0x695c('0x29'),rs['generate'](0x4)+'.wav');fs[_0x695c('0x2a')](_0x3be1ea,_0x48514d,'base64');return convertFile(_0x3be1ea,_0x111ed0)[_0x695c('0x2b')](function(){try{fs[_0x695c('0x1f')](_0x3be1ea);fs[_0x695c('0x2c')](_0x111ed0,_0x695c('0x2d'));}catch(_0x2dccd5){logger[_0x695c('0x16')](_0x2dccd5);}return _0x111ed0[_0x695c('0x2e')]('.')[0x0];});}function base64Encode(_0x29419d){var _0x2850dc=fs['readFileSync'](_0x29419d);return new Buffer(_0x2850dc)[_0x695c('0x2f')]('base64');}exports[_0x695c('0x30')]=function(_0x5d69f2,_0x57e86f,_0x3bc068,_0x25d01c,_0xc54fe9,_0x14da48){var _0x1856e7,_0x7a607e;var _0x11b7d7='https://texttospeech.googleapis.com/v1/';var _0x3ff1a0=_0x695c('0x31')+_0x5d69f2;var _0x138032={};if(_0x57e86f===_0x695c('0x32')){_0x138032[_0x695c('0x33')]={'ssml':_0x3bc068};}else{_0x138032[_0x695c('0x33')]={'text':_0x3bc068};};_0x138032[_0x695c('0x34')]={'languageCode':_0x25d01c,'ssmlGender':_0xc54fe9};_0x138032[_0x695c('0x35')]={'audioEncoding':_0x695c('0x36'),'sampleRateHertz':0x1f40};var _0x445fef={'url':_0x11b7d7+_0x695c('0x37')+_0x3ff1a0,'method':'POST','json':!![],'body':_0x138032};return rp(_0x445fef)[_0x695c('0x2b')](function(_0x163dc0){return new BPromise(function(_0x2b8fe5,_0x2841d5){_0x1856e7=path[_0x695c('0x38')](__dirname,_0x695c('0x29'),rs[_0x695c('0x39')](0x4)+_0x695c('0x3a'));var _0x27e7a1=Buffer[_0x695c('0x3b')](_0x163dc0[_0x695c('0x3c')],_0x695c('0x3d'));return fs[_0x695c('0x3e')](_0x1856e7,_0x27e7a1,function(_0x218663){_0x2841d5(_0x218663);},function(_0x3d7ea8){fs[_0x695c('0x2c')](_0x1856e7,_0x695c('0x2d'));_0x2b8fe5(_0x3d7ea8);});});})[_0x695c('0x2b')](function(_0x39c5a0){_0x7a607e=path['resolve'](__dirname,'tmp',rs[_0x695c('0x39')](0x4)+'.wav');return convertFile(_0x1856e7,_0x7a607e);})['then'](function(){try{fs['unlink'](_0x1856e7);fs[_0x695c('0x2c')](_0x7a607e,_0x695c('0x2d'));}catch(_0x29fa25){logger[_0x695c('0x16')](_0x29fa25);}logger['info'](_0x695c('0x3f'),_0x7a607e[_0x695c('0x2e')]('.')[0x0]);return _0x7a607e[_0x695c('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0xeaa767,_0x266184){var _0x16035d='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4ab8a9,_0x5175c6;var _0x2dbea6;var _0x25428c={'encoding':_0x695c('0x40'),'method':_0x695c('0x41'),'timeout':0x2710,'url':_0x16035d,'headers':{'Content-Type':_0x695c('0x42')},'body':_0x695c('0x43')+encodeURIComponent(JSON['stringify']([[[_0x695c('0x44'),JSON[_0x695c('0x45')]([_0xeaa767,_0x266184||'en',![],_0x695c('0x46')]),null,'generic']]]))};return rp(_0x25428c)[_0x695c('0x2b')](function(_0x1b1432){try{_0x2dbea6=eval(_0x1b1432[_0x695c('0x47')](0x5))[0x0][0x2];}catch(_0x2e46c1){throw new Error(_0x695c('0x48')+_0x1b1432[_0x695c('0x23')]);}if(!_0x2dbea6){if(_0xeaa767[_0x695c('0x49')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x266184+_0x695c('0x4a'));}}try{_0x2dbea6=eval(_0x2dbea6)[0x0];}catch(_0x2a5298){throw new Error(_0x695c('0x48')+res[_0x695c('0x23')]);}const _0xb3e65=_0x2dbea6;_0x4ab8a9=path[_0x695c('0x38')](__dirname,_0x695c('0x29'),rs[_0x695c('0x39')](0x4)+_0x695c('0x3a'));fs['writeFileSync'](_0x4ab8a9,_0x2dbea6,{'encoding':_0x695c('0x3d')});_0x5175c6=path['resolve'](__dirname,_0x695c('0x29'),rs['generate'](0x4)+_0x695c('0x4b'));return convertFile(_0x4ab8a9,_0x5175c6);})[_0x695c('0x2b')](function(){try{fs[_0x695c('0x1f')](_0x4ab8a9);fs[_0x695c('0x2c')](_0x5175c6,_0x695c('0x2d'));}catch(_0x5d2acc){logger[_0x695c('0x16')](_0x5d2acc);}logger[_0x695c('0x1c')](_0x695c('0x4c'),_0x5175c6[_0x695c('0x2e')]('.')[0x0]);return _0x5175c6[_0x695c('0x2e')]('.')[0x0];});};exports[_0x695c('0x4d')]=function(_0x183009,_0x1c0ff8,_0x4d7841){return google[_0x695c('0x4e')](_0x183009,_0x1c0ff8,_0x4d7841)['then'](function(_0x36d213){logger[_0x695c('0x1c')](_0x36d213[_0x695c('0x4f')]);return rp(_0x36d213);})['then'](function(_0x5d9631){var _0x1111da='';var _0x209ec7=0x0;try{fs[_0x695c('0x1f')](_0x183009);}catch(_0x4514fa){logger['error'](_0x4514fa);}if(_0x5d9631&&_0x5d9631[_0x695c('0x50')]){_0x1111da=_0x5d9631['results']['map'](function(_0x4a7a19){return _0x4a7a19&&_0x4a7a19[_0x695c('0x51')][0x0]&&_0x4a7a19[_0x695c('0x51')][0x0]['transcript']?_0x4a7a19['alternatives'][0x0][_0x695c('0x52')]:'';})[_0x695c('0x53')]('\x0a');_0x209ec7=_0x5d9631[_0x695c('0x50')][_0x695c('0x54')](function(_0x1580f2){return _0x1580f2&&_0x1580f2[_0x695c('0x51')][0x0]&&_0x1580f2[_0x695c('0x51')][0x0][_0x695c('0x55')]?_0x1580f2['alternatives'][0x0][_0x695c('0x55')]:0x0;})[_0x695c('0x53')]('\x0a');}logger[_0x695c('0x1c')](_0x695c('0x56'),_0x1111da);logger[_0x695c('0x1c')](_0x695c('0x57'),_0x209ec7);return{'transcript':_0x1111da,'confidence':_0x209ec7};})[_0x695c('0x58')](function(_0x7015f9){logger[_0x695c('0x16')]('[%s]\x20%s:%s',_0x7015f9[_0x695c('0x15')],_0x7015f9[_0x695c('0x59')],_0x7015f9['message']);});};exports['googleDialogflow']=function(_0x5f4129,_0x10043e,_0x165f79,_0xeb3570){var _0x5ba1f6=apiai(_0x10043e,{'language':_0xeb3570||'en'});return _0x5ba1f6[_0x695c('0x5a')](_0x165f79,{'sessionId':md5(_0x5f4129)})[_0x695c('0x2b')](function(_0x766c5c){logger['info'](JSON[_0x695c('0x45')](_0x766c5c));return{'source':_0x766c5c[_0x695c('0x5b')]['source'],'resolvedQuery':_0x766c5c[_0x695c('0x5b')][_0x695c('0x5c')],'action':_0x766c5c[_0x695c('0x5b')][_0x695c('0x5d')],'actionIncomplete':_0x766c5c[_0x695c('0x5b')][_0x695c('0x5e')],'speech':_0x766c5c[_0x695c('0x5b')]['fulfillment']['speech'],'score':_0x766c5c[_0x695c('0x5b')]['score'],'statusCode':_0x766c5c[_0x695c('0x5f')][_0x695c('0x60')],'endConversation':_0x766c5c['result'][_0x695c('0x61')]['endConversation']||![],'isFallbackIntent':_0x766c5c[_0x695c('0x5b')][_0x695c('0x61')][_0x695c('0x62')]};});};exports[_0x695c('0x63')]=function(_0x51b945,_0x14612c,_0x44f5f9,_0x3924e5,_0x368fbe,_0x15d6d6){var _0x2fbec9=_0x3924e5[_0x695c('0x64')](/\\n/g,'\x0a');var _0x4537d8={'credentials':{'private_key':_0x2fbec9,'client_email':_0x44f5f9}};var _0x1bcbb9=new dialogflow[(_0x695c('0x65'))](_0x4537d8);var _0x277547=_0x1bcbb9[_0x695c('0x66')](_0x14612c,md5(_0x51b945));var _0x3c718e={'session':_0x277547,'queryInput':{'text':{'text':_0x368fbe,'languageCode':_0x15d6d6}}};return _0x1bcbb9[_0x695c('0x67')](_0x3c718e)[_0x695c('0x2b')](function(_0x3f52a8){if(_0x3f52a8&&_0x3f52a8[_0x695c('0x49')]){logger[_0x695c('0x1c')]('Dialogflow\x20V2\x20response:',JSON[_0x695c('0x45')](_0x3f52a8));var _0x1a13be=_0x3f52a8[0x0];if(_0x1a13be){var _0x4254c9={'action':_0x1a13be[_0x695c('0x68')][_0x695c('0x5d')],'allRequiredParamsPresent':_0x1a13be[_0x695c('0x68')][_0x695c('0x69')],'endConversation':_0x1a13be[_0x695c('0x68')][_0x695c('0x6a')]&&_0x1a13be[_0x695c('0x68')][_0x695c('0x6a')][_0x695c('0x6b')]?_0x1a13be[_0x695c('0x68')][_0x695c('0x6a')][_0x695c('0x6b')][_0x695c('0x6c')][_0x695c('0x6d')]:![],'fulfillmentText':_0x1a13be[_0x695c('0x68')][_0x695c('0x6e')],'intentName':_0x1a13be[_0x695c('0x68')][_0x695c('0x6f')]['name'],'intentDisplayName':_0x1a13be[_0x695c('0x68')][_0x695c('0x6f')][_0x695c('0x70')],'isFallbackIntent':_0x1a13be[_0x695c('0x68')][_0x695c('0x6f')][_0x695c('0x71')],'languageCode':_0x1a13be['queryResult']['languageCode'],'queryText':_0x1a13be['queryResult'][_0x695c('0x72')],'responseId':_0x1a13be[_0x695c('0x73')],'score':_0x1a13be[_0x695c('0x68')][_0x695c('0x74')],'speech':_0x1a13be[_0x695c('0x68')][_0x695c('0x6e')],'providerResponse':JSON['stringify'](_0x3f52a8)};return _0x4254c9;}}});};exports[_0x695c('0x75')]=function(_0x20d175,_0x280b45,_0x2c24d9,_0xb05a3){return tilde[_0x695c('0x4e')](_0x20d175,_0x280b45,_0x2c24d9,_0xb05a3)[_0x695c('0x2b')](function(_0x2fad99){try{fs[_0x695c('0x1f')](_0x20d175);}catch(_0x579835){logger[_0x695c('0x16')](_0x579835);}logger[_0x695c('0x1c')](_0x695c('0x76'),_0x2fad99[_0x695c('0x52')]);logger['info'](_0x695c('0x77'),_0x2fad99['confidence']);return _0x2fad99;});};exports['awsPolly']=function(_0x118c4d,_0x1afe4b,_0x2557a5,_0x5b08fa,_0x45f9cf,_0xe1a21e){var _0x4bac12=path[_0x695c('0x38')](__dirname,_0x695c('0x29'),rs['generate'](0x4)+_0x695c('0x3a'));var _0x356265;return aws[_0x695c('0x78')](_0x118c4d,_0x1afe4b,_0x2557a5,_0x5b08fa,_0x45f9cf,_0xe1a21e,_0x4bac12)[_0x695c('0x2b')](function(){_0x356265=path[_0x695c('0x38')](__dirname,_0x695c('0x29'),rs[_0x695c('0x39')](0x4)+_0x695c('0x4b'));return convertFile(_0x4bac12,_0x356265);})['then'](function(){try{fs['unlink'](_0x4bac12);fs[_0x695c('0x2c')](_0x356265,_0x695c('0x2d'));}catch(_0x40c974){logger['error'](_0x40c974);}return _0x356265[_0x695c('0x2e')]('.')[0x0];});};exports[_0x695c('0x79')]=function(_0x5d47c2,_0x3f9edd,_0x324ac2,_0x842b8b,_0x49c3b4,_0x35c93c){return aws['lex'](_0x5d47c2,_0x3f9edd,_0x324ac2,_0x842b8b,_0x49c3b4,_0x35c93c)['then'](function(_0x481465){logger[_0x695c('0x1c')](JSON[_0x695c('0x45')](_0x481465));return _0x481465;});};exports[_0x695c('0x7a')]=function(_0x410e75,_0x28f2db,_0x2457d6,_0x2960d8){var _0x300878=util['format'](_0x695c('0x7b'),ISPEECH_API,_0x410e75,encodeURIComponent(_0x28f2db),_0x2457d6,_0x2960d8);var _0x286b69=path[_0x695c('0x38')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x3d64cc;return downloadFile(_0x300878,_0x286b69)['then'](function(){_0x3d64cc=path[_0x695c('0x38')](__dirname,_0x695c('0x29'),rs[_0x695c('0x39')](0x4)+'.wav');return convertFile(_0x286b69,_0x3d64cc);})[_0x695c('0x2b')](function(){try{fs[_0x695c('0x1f')](_0x286b69);fs[_0x695c('0x2c')](_0x3d64cc,_0x695c('0x2d'));}catch(_0x50de99){logger[_0x695c('0x16')](_0x50de99);}return _0x3d64cc[_0x695c('0x2e')]('.')[0x0];});};exports[_0x695c('0x7c')]=function(_0x174edb,_0x390e33,_0x12b973,_0x5f219f){var _0x14d70a=util[_0x695c('0x7d')](_0x695c('0x7e'),ISPEECH_API,_0x390e33,_0x12b973,base64Encode(_0x174edb),_0x5f219f?util['format'](_0x695c('0x7f'),encodeURIComponent(_0x5f219f)):_0x695c('0x80'));return uploadFile(_0x14d70a)['then'](function(_0x6610cf){return querystring[_0x695c('0xb')](_0x6610cf);});};exports['sestekNDA']=function(_0x12d22f,_0x390eb4){return sestek['nda'](_0x12d22f,_0x390eb4)['then'](function(_0x50e9f9){logger[_0x695c('0x1c')](JSON[_0x695c('0x45')](_0x50e9f9));var _0x316f89={'speech':_0x50e9f9[_0x695c('0x81')],'action':_0x50e9f9[_0x695c('0x82')]?_0x50e9f9[_0x695c('0x82')]['CustomAction']:undefined,'actiondata':_0x50e9f9['channelData']?_0x50e9f9[_0x695c('0x82')][_0x695c('0x83')]:undefined};if(_0x50e9f9[_0x695c('0x82')]&&_0x50e9f9[_0x695c('0x82')]['AudioFromTts']){return base64Decode(_0x50e9f9[_0x695c('0x82')][_0x695c('0x84')][_0x695c('0x85')],path[_0x695c('0x38')](__dirname,'tmp',rs[_0x695c('0x39')](0x4)+_0x695c('0x4b')))[_0x695c('0x2b')](function(_0x29b52a){_0x316f89[_0x695c('0x86')]=_0x29b52a;return _0x316f89;});}return _0x316f89;});};exports[_0x695c('0x87')]=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 1ddb095..c4303ca 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 _0x8e48=['exports'];(function(_0x587b43,_0x59b7cf){var _0x1771bc=function(_0x5339f1){while(--_0x5339f1){_0x587b43['push'](_0x587b43['shift']());}};_0x1771bc(++_0x59b7cf);}(_0x8e48,0xf8));var _0x88e4=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8e48[_0x618414];return _0x21c19a;};var nda=require('./nda');module[_0x88e4('0x0')]={'nda':nda}; \ No newline at end of file +var _0xd417=['exports','./nda'];(function(_0x5867a5,_0x15880a){var _0x3be668=function(_0x12a073){while(--_0x12a073){_0x5867a5['push'](_0x5867a5['shift']());}};_0x3be668(++_0x15880a);}(_0xd417,0x87));var _0x7d41=function(_0x5d34e1,_0x551fc2){_0x5d34e1=_0x5d34e1-0x0;var _0x3af5c8=_0xd417[_0x5d34e1];return _0x3af5c8;};var nda=require(_0x7d41('0x0'));module[_0x7d41('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 199c438..557efbd 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 _0x3189=['CustomAction','custom_action_data','body','CustomActionData','info','stringify','request-promise','url','agi','exports','ndauth_url','/token','username','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid','dnid','extension','text','access_token','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav'];(function(_0x37f415,_0x550675){var _0x2f644f=function(_0x13f015){while(--_0x13f015){_0x37f415['push'](_0x37f415['shift']());}};_0x2f644f(++_0x550675);}(_0x3189,0xae));var _0x9318=function(_0x3d30d3,_0x279633){_0x3d30d3=_0x3d30d3-0x0;var _0x4eb58c=_0x3189[_0x3d30d3];return _0x4eb58c;};'use strict';var rp=require(_0x9318('0x0'));var url=require(_0x9318('0x1'));var logger=require('../../../../../config/logger')(_0x9318('0x2'));module[_0x9318('0x3')]=function(_0x1e5359,_0x4eb59a){var _0x3dbe6b={'method':'POST','uri':url['resolve'](_0x4eb59a[_0x9318('0x4')],_0x9318('0x5')),'form':{'grant_type':'password','username':_0x4eb59a[_0x9318('0x6')],'password':_0x4eb59a['password']},'json':!![]};return rp(_0x3dbe6b)['then'](function(_0x2f6831){var _0x324307={'method':_0x9318('0x7'),'uri':url['resolve'](_0x4eb59a[_0x9318('0x8')],_0x9318('0x9')),'body':{'type':_0x4eb59a[_0x9318('0xa')]||_0x9318('0xb'),'channelId':'Nda','conversation':{'id':_0x1e5359['uniqueid']},'from':{'id':_0x1e5359[_0x9318('0xc')],'name':_0x1e5359['calleridname']},'recipient':{'id':_0x1e5359[_0x9318('0xd')],'name':_0x1e5359[_0x9318('0xe')]},'text':_0x4eb59a[_0x9318('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2f6831[_0x9318('0x10')]},'json':!![]};if(_0x4eb59a['project']){_0x324307['body'][_0x9318('0x11')]['ProjectName']=_0x4eb59a[_0x9318('0x12')];}if(_0x4eb59a[_0x9318('0x13')]=='1'){_0x324307['body'][_0x9318('0x11')][_0x9318('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9318('0x15')};}if(_0x4eb59a['custom_action']){_0x324307['body'][_0x9318('0x11')][_0x9318('0x16')]=_0x4eb59a['custom_action'];if(_0x4eb59a[_0x9318('0x17')]){_0x324307[_0x9318('0x18')]['channelData'][_0x9318('0x19')]=_0x4eb59a[_0x9318('0x17')];}}logger[_0x9318('0x1a')](JSON[_0x9318('0x1b')](_0x324307));return rp(_0x324307);});}; \ No newline at end of file +var _0xa2ab=['uniqueid','calleridname','dnid','extension','text','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda'];(function(_0x57e05f,_0x318b8d){var _0x435e54=function(_0x5de9eb){while(--_0x5de9eb){_0x57e05f['push'](_0x57e05f['shift']());}};_0x435e54(++_0x318b8d);}(_0xa2ab,0xa7));var _0xba2a=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0xa2ab[_0x540dcb];return _0x49353c;};'use strict';var rp=require(_0xba2a('0x0'));var url=require(_0xba2a('0x1'));var logger=require(_0xba2a('0x2'))('agi');module[_0xba2a('0x3')]=function(_0x385aac,_0x3c1bf2){var _0x142733={'method':_0xba2a('0x4'),'uri':url[_0xba2a('0x5')](_0x3c1bf2[_0xba2a('0x6')],'/token'),'form':{'grant_type':_0xba2a('0x7'),'username':_0x3c1bf2[_0xba2a('0x8')],'password':_0x3c1bf2[_0xba2a('0x7')]},'json':!![]};return rp(_0x142733)['then'](function(_0xd09a60){var _0xf818d1={'method':_0xba2a('0x4'),'uri':url[_0xba2a('0x5')](_0x3c1bf2['ndassistant_url'],_0xba2a('0x9')),'body':{'type':_0x3c1bf2[_0xba2a('0xa')]||_0xba2a('0xb'),'channelId':_0xba2a('0xc'),'conversation':{'id':_0x385aac[_0xba2a('0xd')]},'from':{'id':_0x385aac['callerid'],'name':_0x385aac[_0xba2a('0xe')]},'recipient':{'id':_0x385aac[_0xba2a('0xf')],'name':_0x385aac[_0xba2a('0x10')]},'text':_0x3c1bf2[_0xba2a('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xd09a60[_0xba2a('0x12')]},'json':!![]};if(_0x3c1bf2[_0xba2a('0x13')]){_0xf818d1[_0xba2a('0x14')][_0xba2a('0x15')][_0xba2a('0x16')]=_0x3c1bf2['project'];}if(_0x3c1bf2[_0xba2a('0x17')]=='1'){_0xf818d1[_0xba2a('0x14')][_0xba2a('0x15')][_0xba2a('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3c1bf2[_0xba2a('0x19')]){_0xf818d1[_0xba2a('0x14')][_0xba2a('0x15')][_0xba2a('0x1a')]=_0x3c1bf2['custom_action'];if(_0x3c1bf2[_0xba2a('0x1b')]){_0xf818d1[_0xba2a('0x14')]['channelData'][_0xba2a('0x1c')]=_0x3c1bf2['custom_action_data'];}}logger['info'](JSON[_0xba2a('0x1d')](_0xf818d1));return rp(_0xf818d1);});}; \ 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 519da2d..84bb5eb 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 _0x387a=['./lib/api','exports'];(function(_0x1b5d79,_0x3c6183){var _0xd74300=function(_0x3d66d1){while(--_0x3d66d1){_0x1b5d79['push'](_0x1b5d79['shift']());}};_0xd74300(++_0x3c6183);}(_0x387a,0x11a));var _0xa387=function(_0x249898,_0x3f4d52){_0x249898=_0x249898-0x0;var _0x19e3fa=_0x387a[_0x249898];return _0x19e3fa;};'use strict';var asr=require(_0xa387('0x0'));module[_0xa387('0x1')]=function(_0x3c1c09,_0x2fe755,_0x5d92d8,_0x13ed71){return asr(_0x3c1c09,_0x2fe755,_0x5d92d8,_0x13ed71);}; \ No newline at end of file +var _0xe59e=['exports'];(function(_0x43fc24,_0x2c59d8){var _0x57087f=function(_0x21e274){while(--_0x21e274){_0x43fc24['push'](_0x43fc24['shift']());}};_0x57087f(++_0x2c59d8);}(_0xe59e,0x158));var _0xee59=function(_0x99ab40,_0x59478e){_0x99ab40=_0x99ab40-0x0;var _0x141f5e=_0xe59e[_0x99ab40];return _0x141f5e;};'use strict';var asr=require('./lib/api');module[_0xee59('0x0')]=function(_0x45330c,_0x390fe3,_0x24b6a0,_0x178f77){return asr(_0x45330c,_0x390fe3,_0x24b6a0,_0x178f77);}; \ 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 cd30f34..27a9e3b 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 _0x327e=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','data','send','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x327e,0x1b5));var _0xe327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x327e[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe327('0x0'));var crypto=require(_0xe327('0x1'));var logger=require(_0xe327('0x2'))(_0xe327('0x3'));module[_0xe327('0x4')]=function(_0x40e95c,_0x13d3af,_0x1b2c78,_0x25adb7){return new BPromise(function(_0x1269f9,_0x3ea6a9){logger[_0xe327('0x5')]('Tilde\x20URI',_0x25adb7||_0xe327('0x6'));var _0x4a0478=new WebSocket(_0x25adb7||_0xe327('0x6'),{'perMessageDeflate':![]});var _0x3a9b41='';var _0x2edb08='0';var _0x3bd1ad='1';var _0x4f3239=_0xe327('0x7');function _0x1ffb9f(_0x27e497){var _0x17f07b=crypto[_0xe327('0x8')](_0xe327('0x9'));_0x17f07b[_0xe327('0xa')](_0x27e497);return _0x17f07b['digest'](_0xe327('0xb'));}function _0x1e56cd(){try{logger[_0xe327('0x5')](_0xe327('0xc'));var _0x21e92a=moment()['unix']();var _0x207897=_0x1ffb9f(_0x21e92a+_0x13d3af+_0x1b2c78);_0x4a0478['send'](JSON['stringify']({'appID':_0x13d3af,'timestamp':_0x21e92a,'appKey':_0x207897}));var _0x4858a7=fs['createReadStream'](_0x40e95c);_0x4858a7['on'](_0xe327('0xd'),function(_0x1378b3){_0x4a0478[_0xe327('0xe')](_0x1378b3);});_0x4858a7['on']('close',function(){_0x4a0478['send'](_0xe327('0xf'));});}catch(_0x43c3c5){logger['error'](_0xe327('0x10'),JSON['stringify'](_0x43c3c5));_0x4a0478[_0xe327('0x11')]();}}function _0x42a274(_0x828d4b){try{if(_0x828d4b){var _0x129522=JSON[_0xe327('0x12')](_0x828d4b);switch(_0x129522[_0xe327('0x13')]){case 0x0:if(_0x129522[_0xe327('0x14')]){if(_0x129522['result'][_0xe327('0x15')]){logger[_0xe327('0x5')](_0xe327('0x16'),JSON[_0xe327('0x17')](_0x129522['result'][_0xe327('0x18')]));_0x3a9b41=_0x129522[_0xe327('0x14')][_0xe327('0x18')][0x0]['transcript'];_0x2edb08=_0x129522[_0xe327('0x14')][_0xe327('0x18')][0x0]['likelihood'];_0x3bd1ad='0';_0x4f3239=_0xe327('0x19');_0x4a0478['terminate']();}}break;case 0x1:logger['info'](_0xe327('0x7'));_0x3bd1ad='1';_0x4f3239=_0xe327('0x7');break;case 0x2:logger[_0xe327('0x5')](_0xe327('0x1a'));_0x3bd1ad='2';_0x4f3239=_0xe327('0x1a');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3bd1ad='9';_0x4f3239=_0xe327('0x1b');break;case 0xa:logger['info'](_0xe327('0x1c'));_0x3bd1ad='10';_0x4f3239=_0xe327('0x1c');break;case 0xb:logger['info'](_0xe327('0x1d'));_0x3bd1ad='11';_0x4f3239=_0xe327('0x1d');}}}catch(_0x216c54){logger['error'](_0xe327('0x1e'),JSON[_0xe327('0x17')](_0x216c54));_0x4a0478['terminate']();}}function _0x4642bd(){logger['info'](_0xe327('0x1f'));_0x1269f9({'transcript':_0x3a9b41,'confidence':_0x2edb08,'status':_0x3bd1ad,'status_message':_0x4f3239});}function _0x19937b(_0x3ccaad){logger[_0xe327('0x20')](_0xe327('0x21'));if(!_[_0xe327('0x22')](_0x3ccaad)){logger[_0xe327('0x20')](_['isObject'](_0x3ccaad)?JSON[_0xe327('0x17')](_0x3ccaad):_0x3ccaad);}}_0x4a0478['on'](_0xe327('0x23'),_0x1e56cd);_0x4a0478['on'](_0xe327('0x24'),_0x42a274);_0x4a0478['on']('close',_0x4642bd);_0x4a0478['on'](_0xe327('0x20'),_0x19937b);});}; \ No newline at end of file +var _0x3754=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','moment','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x3b2a94,_0x4ff383){var _0x219d9d=function(_0x1374d3){while(--_0x1374d3){_0x3b2a94['push'](_0x3b2a94['shift']());}};_0x219d9d(++_0x4ff383);}(_0x3754,0xa8));var _0x4375=function(_0x5080dc,_0x2f2bae){_0x5080dc=_0x5080dc-0x0;var _0x267c03=_0x3754[_0x5080dc];return _0x267c03;};'use strict';var BPromise=require('bluebird');var _=require(_0x4375('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4375('0x1'));var crypto=require(_0x4375('0x2'));var logger=require(_0x4375('0x3'))('agi');module['exports']=function(_0x1fccb3,_0x250b0a,_0x4b62d9,_0x39163b){return new BPromise(function(_0x2d007a,_0x47faa0){logger[_0x4375('0x4')](_0x4375('0x5'),_0x39163b||_0x4375('0x6'));var _0x5e9cab=new WebSocket(_0x39163b||_0x4375('0x6'),{'perMessageDeflate':![]});var _0x2811a8='';var _0x14bc42='0';var _0x566c20='1';var _0x5a7828=_0x4375('0x7');function _0x4002d8(_0x3f16a8){var _0x7f2d8e=crypto['createHash']('sha1');_0x7f2d8e[_0x4375('0x8')](_0x3f16a8);return _0x7f2d8e[_0x4375('0x9')](_0x4375('0xa'));}function _0x24cc64(){try{logger[_0x4375('0x4')](_0x4375('0xb'));var _0x524162=moment()[_0x4375('0xc')]();var _0x1ad128=_0x4002d8(_0x524162+_0x250b0a+_0x4b62d9);_0x5e9cab['send'](JSON[_0x4375('0xd')]({'appID':_0x250b0a,'timestamp':_0x524162,'appKey':_0x1ad128}));var _0x106a44=fs['createReadStream'](_0x1fccb3);_0x106a44['on'](_0x4375('0xe'),function(_0x3e2ad2){_0x5e9cab[_0x4375('0xf')](_0x3e2ad2);});_0x106a44['on'](_0x4375('0x10'),function(){_0x5e9cab[_0x4375('0xf')]('EOS');});}catch(_0x31ff64){logger[_0x4375('0x11')](_0x4375('0x12'),JSON[_0x4375('0xd')](_0x31ff64));_0x5e9cab[_0x4375('0x13')]();}}function _0xea2bf3(_0x2475fc){try{if(_0x2475fc){var _0x175182=JSON[_0x4375('0x14')](_0x2475fc);switch(_0x175182[_0x4375('0x15')]){case 0x0:if(_0x175182[_0x4375('0x16')]){if(_0x175182[_0x4375('0x16')]['final']){logger[_0x4375('0x4')](_0x4375('0x17'),JSON[_0x4375('0xd')](_0x175182['result'][_0x4375('0x18')]));_0x2811a8=_0x175182[_0x4375('0x16')]['hypotheses'][0x0]['transcript'];_0x14bc42=_0x175182[_0x4375('0x16')]['hypotheses'][0x0][_0x4375('0x19')];_0x566c20='0';_0x5a7828=_0x4375('0x1a');_0x5e9cab[_0x4375('0x13')]();}}break;case 0x1:logger[_0x4375('0x4')](_0x4375('0x7'));_0x566c20='1';_0x5a7828=_0x4375('0x7');break;case 0x2:logger[_0x4375('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x566c20='2';_0x5a7828='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x4375('0x4')](_0x4375('0x1b'));_0x566c20='9';_0x5a7828=_0x4375('0x1b');break;case 0xa:logger[_0x4375('0x4')](_0x4375('0x1c'));_0x566c20='10';_0x5a7828=_0x4375('0x1c');break;case 0xb:logger[_0x4375('0x4')](_0x4375('0x1d'));_0x566c20='11';_0x5a7828=_0x4375('0x1d');}}}catch(_0xe3382e){logger[_0x4375('0x11')](_0x4375('0x1e'),JSON[_0x4375('0xd')](_0xe3382e));_0x5e9cab[_0x4375('0x13')]();}}function _0x1a7050(){logger[_0x4375('0x4')](_0x4375('0x1f'));_0x2d007a({'transcript':_0x2811a8,'confidence':_0x14bc42,'status':_0x566c20,'status_message':_0x5a7828});}function _0x2b9384(_0x22c033){logger[_0x4375('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x4375('0x20')](_0x22c033)){logger[_0x4375('0x11')](_['isObject'](_0x22c033)?JSON['stringify'](_0x22c033):_0x22c033);}}_0x5e9cab['on'](_0x4375('0x21'),_0x24cc64);_0x5e9cab['on'](_0x4375('0x22'),_0xea2bf3);_0x5e9cab['on']('close',_0x1a7050);_0x5e9cab['on'](_0x4375('0x11'),_0x2b9384);});}; \ 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 22285f6..330c92b 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 _0x7680=['./asr'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x7680,0x13f));var _0x0768=function(_0x5f41de,_0x1d3e30){_0x5f41de=_0x5f41de-0x0;var _0x12cbf7=_0x7680[_0x5f41de];return _0x12cbf7;};var asr=require(_0x0768('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9e60=['exports'];(function(_0x226bbe,_0x1b5def){var _0x46adaf=function(_0x35fd1f){while(--_0x35fd1f){_0x226bbe['push'](_0x226bbe['shift']());}};_0x46adaf(++_0x1b5def);}(_0x9e60,0x19c));var _0x09e6=function(_0x1a8da6,_0x115932){_0x1a8da6=_0x1a8da6-0x0;var _0x398f71=_0x9e60[_0x1a8da6];return _0x398f71;};var asr=require('./asr');module[_0x09e6('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e119ec8..eda201d 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(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0xe706,0xa3));var _0x6e70=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0xe706[_0x61b3ab];return _0x57097f;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 2fa7b8f..ff98249 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 _0xc818=['no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariableById','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','then','dsn','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','googleCloudTTS','apiKey','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','stringify','split','replaceAll','getVariable','getAndSetVariable','result','extra','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','response','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','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','appsecret','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured'];(function(_0x28aa92,_0x43b202){var _0x79644d=function(_0xcb8292){while(--_0xcb8292){_0x28aa92['push'](_0x28aa92['shift']());}};_0x79644d(++_0x43b202);}(_0xc818,0x1e3));var _0x8c81=function(_0x198a6a,_0x2fe488){_0x198a6a=_0x198a6a-0x0;var _0x35ab4e=_0xc818[_0x198a6a];return _0x35ab4e;};'use strict';var fs=require('fs');var util=require(_0x8c81('0x0'));var _=require(_0x8c81('0x1'));var sh=require(_0x8c81('0x2'));var odbc=require(_0x8c81('0x3'))();var rs=require('randomstring');var moment=require(_0x8c81('0x4'));var Mustache=require(_0x8c81('0x5'));var rp=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var scripts=require(_0x8c81('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8c81('0xb'),_0x8c81('0xc')];var verticesWithRetry=[_0x8c81('0xd'),_0x8c81('0xe'),'getsecretdigits'];var AGIVertices=function(_0x1173cf,_0x448af6,_0x186783){this[_0x8c81('0xf')]=_0x1173cf;this[_0x8c81('0x10')]=_0x448af6;this[_0x8c81('0x11')]=_0x186783;};AGIVertices[_0x8c81('0x12')]['getVariable']=function(_0x3de91f,_0x37dbb4){this[_0x8c81('0x10')][_0x8c81('0x13')](_0x3de91f)['then'](function(_0x5a2d9e){_0x37dbb4(null,_0x5a2d9e?_0x5a2d9e[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x31ff3f){_0x37dbb4(_0x31ff3f);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x16')]=function(_0x1b7b1b,_0xd04a1){this[_0x8c81('0x10')]['getVoiceQueueById'](_0x1b7b1b)['then'](function(_0x1db769){_0xd04a1(null,_0x1db769?_0x1db769[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x4fa5){_0xd04a1(_0x4fa5);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x17')]=function(_0x4f7180,_0x3683f0){this[_0x8c81('0x10')][_0x8c81('0x18')](_0x4f7180)[_0x8c81('0x19')](function(_0x17564e){_0x3683f0(null,_0x17564e?_0x17564e['name']:![]);})[_0x8c81('0x15')](function(_0x4d0b75){_0x3683f0(_0x4d0b75);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x216d29,_0x13e312){this[_0x8c81('0x10')]['getSquareOdbcById'](_0x216d29)[_0x8c81('0x19')](function(_0x2312d5){_0x13e312(null,_0x2312d5?_0x2312d5[_0x8c81('0x1a')]:![]);})['catch'](function(_0x261832){_0x13e312(_0x261832);});};AGIVertices[_0x8c81('0x12')]['getUser']=function(_0x35d61a,_0x31c4a2){this['rpc']['getUserById'](_0x35d61a)[_0x8c81('0x19')](function(_0x4f58ff){_0x31c4a2(null,_0x4f58ff?_0x4f58ff[_0x8c81('0x14')]:![]);})['catch'](function(_0x8c399c){_0x31c4a2(_0x8c399c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1b')]=function(_0xa0f0f7,_0x703dba){this[_0x8c81('0x10')][_0x8c81('0x1c')](_0xa0f0f7)[_0x8c81('0x19')](function(_0x4bfa48){_0x703dba(null,_0x4bfa48?_0x4bfa48['name']:![]);})[_0x8c81('0x15')](function(_0x1ee94c){_0x703dba(_0x1ee94c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1d')]=function(_0x3e5ed1,_0x1f9608){var _0x2e7ba2=this;this[_0x8c81('0x10')][_0x8c81('0x1e')](_0x3e5ed1)[_0x8c81('0x19')](function(_0x477a9e){_0x1f9608(null,_0x477a9e?_0x2e7ba2[_0x8c81('0x1f')](_0x477a9e[_0x8c81('0x20')]):![]);})['catch'](function(_0x1d73ac){_0x1f9608(_0x1d73ac);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x21')]=function(_0x29a52c,_0x428aba){this[_0x8c81('0x10')][_0x8c81('0x22')](_0x29a52c)[_0x8c81('0x19')](function(_0x2f419f){_0x428aba(null,_0x2f419f?_0x2f419f:![]);})['catch'](function(_0x2358be){_0x428aba(_0x2358be);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x23')]=function(_0x25654d,_0x1d931f,_0x551f0b){this[_0x8c81('0x11')][_0x8c81('0x23')](_0x25654d,_0x1d931f)[_0x8c81('0x19')](function(){_0x551f0b(null);})[_0x8c81('0x15')](function(_0x267c01){_0x551f0b(_0x267c01);});};AGIVertices['prototype']['getIntervals']=function(_0x1da1f1,_0x45e7fc){this[_0x8c81('0x10')]['getIntervalById'](_0x1da1f1)[_0x8c81('0x19')](function(_0x30b2a1){if(_0x30b2a1){if(_0x30b2a1[_0x8c81('0x24')]){_0x45e7fc(null,[_0x30b2a1[_0x8c81('0x25')]]);}else{_0x45e7fc(null,_['map'](_0x30b2a1[_0x8c81('0x26')],_0x8c81('0x25')));}}else{_0x45e7fc(null,![]);}})['catch'](function(_0x199478){_0x45e7fc(_0x199478);});};AGIVertices['prototype']['getSoundPath']=function(_0x3fc1c0){return util[_0x8c81('0x27')](_0x8c81('0x28'),FILES_PATH,_0x3fc1c0);};AGIVertices[_0x8c81('0x12')]['getQueryOdbc']=function(_0x30fa19,_0x252172,_0x3f14db){odbc['open'](_0x30fa19,function(_0x4c46dd){if(_0x4c46dd){logger[_0x8c81('0x29')](_0x8c81('0x2a'),_0x4c46dd);_0x3f14db(_0x4c46dd);}else{logger[_0x8c81('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x8c81('0x2c')](_0x252172,function(_0x5a30fa,_0x4ccca3){if(_0x5a30fa){logger['info'](_0x8c81('0x2d'),_0x252172);_0x3f14db(_0x5a30fa);}else{logger['info'](_0x8c81('0x2e'),_0x252172);odbc['close'](function(_0x4b2729){if(_0x4b2729){logger[_0x8c81('0x29')](_0x8c81('0x2f'),_0x4b2729);}_0x3f14db(null,_0x4ccca3);});}});}});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x30')]=function(_0x1e070d,_0x232ba7){this[_0x8c81('0x10')]['getSmsAccountById'](_0x1e070d)[_0x8c81('0x19')](function(_0x15e499){_0x232ba7(null,_0x15e499?_0x15e499:![]);})[_0x8c81('0x15')](function(_0x41f9d2){_0x232ba7(_0x41f9d2);});};AGIVertices[_0x8c81('0x12')]['createSmsMessage']=function(_0xc9dd61,_0x202f78){this[_0x8c81('0x10')][_0x8c81('0x31')](_0xc9dd61)[_0x8c81('0x19')](function(_0x2a2b97){_0x202f78(null,_0x2a2b97);})[_0x8c81('0x15')](function(_0x2c9085){_0x202f78(_0x2c9085);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x32')]=function(_0xae952a,_0xc7871,_0x5176d3){this['rpc'][_0x8c81('0x32')]({'uniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'node':_0xae952a[_0x8c81('0x34')],'application':_0xae952a[_0x8c81('0x35')],'data':_0xc7871||null,'project_name':this[_0x8c81('0xf')][_0x8c81('0x36')],'callerid':this['channel']['callerid']})[_0x8c81('0x19')](function(_0x2a8c67){if(_0x5176d3){_0x5176d3(null,_0x2a8c67);}})[_0x8c81('0x15')](function(_0x21891f){if(_0x5176d3){_0x5176d3(_0x21891f);}});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x37')]=function(_0x349a87,_0x55fe22,_0x41996c,_0xe20dad){this[_0x8c81('0x10')][_0x8c81('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x8c81('0xf')][_0x8c81('0x38')],'calleridname':this[_0x8c81('0xf')][_0x8c81('0x39')],'context':this[_0x8c81('0xf')][_0x8c81('0x3a')],'extension':this[_0x8c81('0xf')][_0x8c81('0x3b')],'priority':this[_0x8c81('0xf')][_0x8c81('0x3c')],'accountcode':this[_0x8c81('0xf')][_0x8c81('0x3d')],'dnid':this[_0x8c81('0xf')][_0x8c81('0x3e')],'projectName':this[_0x8c81('0xf')][_0x8c81('0x36')],'saveName':_0x55fe22,'filename':_0x349a87[_0x8c81('0x3f')]||_0x55fe22,'savePath':_0x41996c})[_0x8c81('0x19')](function(_0x39dbc8){_0xe20dad(null,_0x39dbc8);})[_0x8c81('0x15')](function(_0x16e822){_0xe20dad(_0x16e822);});};AGIVertices['prototype'][_0x8c81('0x40')]=function(_0x221f4f,_0x5c21f0,_0x18eb31,_0x1b928f,_0x38bb79){this['rpc'][_0x8c81('0x40')]({'uniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'body':_0x221f4f,'direction':_0x5c21f0,'providerName':_0x18eb31,'providerResponse':_0x1b928f})['then'](function(_0x51280e){if(_0x38bb79){_0x38bb79(null,_0x51280e);}})[_0x8c81('0x15')](function(_0x3f1d4c){if(_0x38bb79){_0x38bb79(_0x3f1d4c);}});};AGIVertices[_0x8c81('0x12')]['createCmContact']=function(_0x3c4f19,_0xc4fa7e){this[_0x8c81('0x10')][_0x8c81('0x41')]({'firstName':_[_0x8c81('0x42')](_0x3c4f19[_0x8c81('0x14')])||_[_0x8c81('0x43')](_0x3c4f19[_0x8c81('0x14')])?'callback_'+Math['random']():_0x3c4f19[_0x8c81('0x14')],'lastName':_[_0x8c81('0x42')](_0x3c4f19[_0x8c81('0x44')])||_[_0x8c81('0x43')](_0x3c4f19['lastName'])?null:_0x3c4f19[_0x8c81('0x44')],'phone':_0x3c4f19[_0x8c81('0x45')],'ListId':_0x3c4f19[_0x8c81('0x46')],'scheduledat':_0x3c4f19[_0x8c81('0x47')],'callbackUniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'tags':'callback','description':_0x8c81('0x48')+_0x3c4f19['scheduledAt'][_0x8c81('0x49')](),'priority':_0x3c4f19[_0x8c81('0x4a')]})[_0x8c81('0x19')](function(_0x5f39ff){_0xc4fa7e(null,_0x5f39ff);})['catch'](function(_0x30b694){_0xc4fa7e(_0x30b694);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x4b')]=function(_0x19d9bb,_0x3357ee){this[_0x8c81('0x10')][_0x8c81('0x4c')](_0x19d9bb)[_0x8c81('0x19')](function(_0x12ed28){_0x3357ee(null,_0x12ed28?_0x12ed28[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x30d6df){_0x3357ee(_0x30d6df);});};AGIVertices[_0x8c81('0x12')]['agentPause']=function(_0x11ef7a,_0x418977,_0x2a11d3){var _0x2bc8ab={'role':_0x8c81('0x4d')};_0x2bc8ab[_0x11ef7a]=this['channel'][_0x8c81('0x38')];this[_0x8c81('0x10')][_0x8c81('0x4e')](_0x2bc8ab,_0x418977,this[_0x8c81('0xf')][_0x8c81('0x33')])[_0x8c81('0x19')](function(_0x45f92e){_0x2a11d3(null,_[_0x8c81('0x43')](_0x45f92e)?![]:!![]);})['catch'](function(_0x28da6c){logger[_0x8c81('0x29')](_0x28da6c);_0x2a11d3(null,![]);});};AGIVertices[_0x8c81('0x12')]['agentUnpause']=function(_0x5b53f3,_0x4e7bb6){var _0x3d2d0e={'role':_0x8c81('0x4d')};_0x3d2d0e[_0x5b53f3]=this['channel'][_0x8c81('0x38')];this[_0x8c81('0x10')][_0x8c81('0x4f')](_0x3d2d0e)['then'](function(_0x59eaf1){_0x4e7bb6(null,_[_0x8c81('0x43')](_0x59eaf1)?![]:!![]);})[_0x8c81('0x15')](function(_0x111816){logger[_0x8c81('0x29')](_0x111816);_0x4e7bb6(null,![]);});};AGIVertices['prototype'][_0x8c81('0x50')]=function(_0x47ad6f,_0x3589d0){var _0x3deb72={'role':_0x8c81('0x4d')};_0x3deb72[_0x47ad6f]=this[_0x8c81('0xf')]['callerid'];this[_0x8c81('0x10')][_0x8c81('0x50')](_0x3deb72)[_0x8c81('0x19')](function(_0x306a66){_0x3589d0(null,_[_0x8c81('0x43')](_0x306a66)?![]:!![]);})[_0x8c81('0x15')](function(_0x2658e8){logger['error'](_0x2658e8);_0x3589d0(null,![]);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x51')]=function(_0x39c244,_0x36942e){var _0xa91282={'role':_0x8c81('0x4d')};_0xa91282[_0x39c244]=this[_0x8c81('0xf')]['callerid'];var _0x4e6168=_0x39c244!=_0x8c81('0x52')?util[_0x8c81('0x27')](_0x8c81('0x53'),'LOCAL',this[_0x8c81('0xf')][_0x8c81('0x38')]):undefined;this[_0x8c81('0x10')][_0x8c81('0x51')](_0xa91282,_0x4e6168)[_0x8c81('0x19')](function(_0x1a68e8){_0x36942e(null,_[_0x8c81('0x43')](_0x1a68e8)?![]:!![]);})['catch'](function(_0x2a6347){logger[_0x8c81('0x29')](_0x2a6347);_0x36942e(null,![]);});};AGIVertices['prototype'][_0x8c81('0x54')]=function(_0x4f5850,_0x40e5b5){sh[_0x8c81('0x55')](_['trim'](_0x4f5850),function(_0x2d3fa2,_0x40f800){var _0x1b435a=_0x40f800['replace'](/(\r\n|\n|\r)/gm,'');_0x40e5b5(null,_0x1b435a);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x56')]=function(_0x15e71a,_0x19426a){scripts[_0x8c81('0x56')](_0x15e71a[_0x8c81('0x57')],_0x15e71a['google_cloud_tts_text_type']||'text',_0x15e71a[_0x8c81('0x58')],_0x15e71a['languageCode']||'en-US',_0x15e71a[_0x8c81('0x59')]||_0x8c81('0x5a'),_0x15e71a[_0x8c81('0x5b')]||_0x8c81('0x5c'))[_0x8c81('0x19')](function(_0x3984a4){_0x19426a(null,_0x3984a4);})[_0x8c81('0x15')](function(_0x575764){_0x19426a(_0x575764);});};AGIVertices['prototype'][_0x8c81('0x5d')]=function(_0x512e3a,_0x5762db){scripts[_0x8c81('0x5d')](_0x512e3a[_0x8c81('0x58')],_0x512e3a[_0x8c81('0x5e')]||'en',0x1)[_0x8c81('0x19')](function(_0x9728e4){_0x5762db(null,_0x9728e4);})['catch'](function(_0x374795){_0x5762db(_0x374795);});};AGIVertices['prototype'][_0x8c81('0x5f')]=function(_0x22a4aa,_0x198c48){var _0x2e1962={'uri':_0x22a4aa[_0x8c81('0x60')],'method':_0x22a4aa['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x22a4aa[_0x8c81('0x61')])===_0x8c81('0x62')&&parseInt(_0x22a4aa[_0x8c81('0x61')])>=0x1?parseInt(_0x22a4aa[_0x8c81('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x8c81('0x63')]([_0x8c81('0x64'),'PUT'],_0x2e1962[_0x8c81('0x65')][_0x8c81('0x66')]())){try{_0x2e1962[_0x8c81('0x67')]=_0x22a4aa[_0x8c81('0xc')]?JSON[_0x8c81('0x68')](_0x22a4aa[_0x8c81('0xc')]):{};}catch(_0x866adb){logger[_0x8c81('0x29')](_0x8c81('0x69'),_0x866adb);}}try{_0x2e1962[_0x8c81('0x6a')]=_0x22a4aa[_0x8c81('0xb')]?JSON[_0x8c81('0x68')](_0x22a4aa[_0x8c81('0xb')]):{};}catch(_0x23b9f6){logger[_0x8c81('0x29')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x23b9f6);}if(_0x22a4aa[_0x8c81('0x6b')]){try{var _0x417163=require(_0x22a4aa[_0x8c81('0x6b')])[_0x8c81('0x6c')](this,_0x2e1962);_0x2e1962[_0x8c81('0x6d')]=Mustache[_0x8c81('0x6e')](_0x22a4aa['url'],_0x417163,{},['$$','$$']);if(_0x2e1962[_0x8c81('0x6a')]){_0x2e1962[_0x8c81('0x6a')]=JSON['parse'](Mustache[_0x8c81('0x6e')](JSON['stringify'](_0x2e1962[_0x8c81('0x6a')]),_0x417163,{},['$$','$$']));}if(_0x2e1962[_0x8c81('0x67')]){_0x2e1962['body']=JSON[_0x8c81('0x68')](Mustache[_0x8c81('0x6e')](JSON['stringify'](_0x2e1962['body']),_0x417163,{},['$$','$$']));}}catch(_0x9ba52e){logger['error'](_0x8c81('0x6f'),_0x9ba52e);}}rp(_0x2e1962)[_0x8c81('0x19')](function(_0x20df01){var _0x2374a2={'statusCode':_0x20df01[_0x8c81('0x70')]||0xc8,'statusMessage':_0x20df01['statusMessage']||'OK','headers':_0x20df01['headers']||{},'body':_0x20df01[_0x8c81('0x67')]||{}};_0x198c48(null,_0x2374a2);})[_0x8c81('0x15')](function(_0x4aeafe){var _0x58de6a={'statusCode':_0x4aeafe[_0x8c81('0x70')]||0x1f4,'statusMessage':_0x4aeafe['message']||_0x8c81('0x71'),'headers':_0x4aeafe[_0x8c81('0x72')][_0x8c81('0x6a')]||{},'body':_0x4aeafe[_0x8c81('0x72')]['body']||{}};_0x198c48(null,_0x58de6a);});};AGIVertices['prototype']['googleDialogflow']=function(_0xd39626,_0xc2828f){scripts[_0x8c81('0x73')](this[_0x8c81('0xf')][_0x8c81('0x33')],_0xd39626[_0x8c81('0x74')],_0xd39626[_0x8c81('0x58')],_0xd39626['dialogflow_language']||'en')[_0x8c81('0x19')](function(_0x5e3d40){_0xc2828f(null,_0x5e3d40);})['catch'](function(_0x31a3aa){_0xc2828f(_0x31a3aa);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x75')]=function(_0xa0c66e,_0x102d54){scripts['googleDialogflowV2'](this['channel'][_0x8c81('0x33')],_0xa0c66e[_0x8c81('0x76')],_0xa0c66e[_0x8c81('0x77')],_0xa0c66e[_0x8c81('0x78')],_0xa0c66e['text'],_0xa0c66e[_0x8c81('0x79')]||'en')[_0x8c81('0x19')](function(_0x2df0fa){_0x102d54(null,_0x2df0fa);})[_0x8c81('0x15')](function(_0x1d8e1c){_0x102d54(_0x1d8e1c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7a')]=function(_0x1fa933,_0x1936df){scripts[_0x8c81('0x7a')](this[_0x8c81('0xf')],_0x1fa933)[_0x8c81('0x19')](function(_0x3f1dab){_0x1936df(null,_0x3f1dab);})['catch'](function(_0x39a84f){_0x1936df(_0x39a84f);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7b')]=function(_0x27b542,_0x2a4815){scripts[_0x8c81('0x7b')](_0x27b542[_0x8c81('0x74')],_0x27b542[_0x8c81('0x58')],_0x27b542[_0x8c81('0x7c')]||'en-US',_0x27b542[_0x8c81('0x7d')])[_0x8c81('0x19')](function(_0x376b7d){_0x2a4815(null,_0x376b7d);})[_0x8c81('0x15')](function(_0x18ad13){_0x2a4815(_0x18ad13);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7e')]=function(_0x3183e6,_0x151a69,_0x457e00){scripts[_0x8c81('0x7e')](_0x151a69,_0x3183e6[_0x8c81('0x74')],_0x3183e6[_0x8c81('0x7f')]||_0x8c81('0x80'),this[_0x8c81('0x81')](_0x3183e6[_0x8c81('0x82')])?_0x3183e6[_0x8c81('0x82')]:undefined)[_0x8c81('0x19')](function(_0x2b1832){_0x457e00(null,_0x2b1832);})[_0x8c81('0x15')](function(_0x1db93c){_0x457e00(_0x1db93c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x83')]=function(_0x1108e6,_0x184a0b){scripts[_0x8c81('0x83')](_0x1108e6['aws_access_key_id'],_0x1108e6[_0x8c81('0x84')],_0x1108e6[_0x8c81('0x85')],_0x1108e6[_0x8c81('0x86')]||_0x8c81('0x87'),_0x1108e6[_0x8c81('0x58')],_0x1108e6[_0x8c81('0x88')]||_0x8c81('0x58'))[_0x8c81('0x19')](function(_0x12d591){_0x184a0b(null,_0x12d591);})[_0x8c81('0x15')](function(_0x3ad4d5){_0x184a0b(_0x3ad4d5);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x89')]=function(_0x23b7c4,_0x37220e){scripts[_0x8c81('0x89')](this[_0x8c81('0xf')][_0x8c81('0x33')],_0x23b7c4[_0x8c81('0x8a')],_0x23b7c4[_0x8c81('0x84')],_0x23b7c4[_0x8c81('0x8b')],_0x23b7c4[_0x8c81('0x58')],_0x23b7c4[_0x8c81('0x8c')])[_0x8c81('0x19')](function(_0x4e1e9d){_0x37220e(null,_0x4e1e9d);})[_0x8c81('0x15')](function(_0x4f9318){_0x37220e(_0x4f9318);});};AGIVertices[_0x8c81('0x12')]['googleASR']=function(_0x47da0c,_0x58a9e7,_0x148ac4){scripts[_0x8c81('0x8d')](_0x58a9e7,_0x47da0c[_0x8c81('0x74')],_0x47da0c[_0x8c81('0x8e')]||_0x8c81('0x80'))[_0x8c81('0x19')](function(_0x288981){_0x148ac4(null,_0x288981);})[_0x8c81('0x15')](function(_0x221988){_0x148ac4(_0x221988);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x8f')]=function(_0x20fdaf,_0x33f9a9,_0x4a19c4){scripts[_0x8c81('0x8f')](_0x33f9a9,_0x20fdaf[_0x8c81('0x90')],_0x20fdaf['appsecret'],_0x20fdaf[_0x8c81('0x6d')])[_0x8c81('0x19')](function(_0x353606){_0x4a19c4(null,_0x353606);})[_0x8c81('0x15')](function(_0x1224af){_0x4a19c4(_0x1224af);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x91')]=function(_0x4afc4b){var _0x2b8b52=_['includes'](verticesWithRetry,_0x4afc4b['agicommand'])?_0x4afc4b:_[_0x8c81('0x92')](_0x4afc4b);for(var _0x23ea3e in _0x2b8b52){if(_0x2b8b52[_0x8c81('0x93')](_0x23ea3e)){if(_0x2b8b52[_0x23ea3e]&&_['isString'](_0x2b8b52[_0x23ea3e])){if(_[_0x8c81('0x63')](recursiveMapAttributes,_0x23ea3e)){_0x2b8b52[_0x23ea3e]=this[_0x8c81('0x94')](_0x2b8b52[_0x23ea3e]);}else{_0x2b8b52[_0x23ea3e]=this[_0x8c81('0x95')](_0x2b8b52[_0x23ea3e]);}}}}return _0x2b8b52;};AGIVertices[_0x8c81('0x12')][_0x8c81('0x96')]=function(_0xfdc1a2){for(var _0x319fd8 in _0xfdc1a2){if(_0xfdc1a2['hasOwnProperty'](_0x319fd8)){if(_[_0x8c81('0x97')](_0xfdc1a2[_0x319fd8])){this[_0x8c81('0x96')](_0xfdc1a2[_0x319fd8]);}else if(_[_0x8c81('0x98')](_0xfdc1a2[_0x319fd8])){for(var _0x16a5c4=0x0;_0x16a5c4<_0xfdc1a2[_0x319fd8][_0x8c81('0x99')];_0x16a5c4++){this[_0x8c81('0x96')](_0xfdc1a2[_0x319fd8][_0x16a5c4]);}}else if(_['isString'](_0xfdc1a2[_0x319fd8])){_0xfdc1a2[_0x319fd8]=this[_0x8c81('0x95')](_0xfdc1a2[_0x319fd8]);}}}};AGIVertices['prototype'][_0x8c81('0x9a')]=function(_0x19324a,_0x13b30d){for(var _0x22c0fe in _0x19324a){if(_0x19324a[_0x8c81('0x93')](_0x22c0fe)){if(_[_0x8c81('0x97')](_0x19324a[_0x22c0fe])){if(!_[_0x8c81('0x42')](_0x19324a[_0x22c0fe])){this[_0x8c81('0x9a')](_0x19324a[_0x22c0fe],util[_0x8c81('0x27')]('%s.%s',_0x13b30d,_0x22c0fe));}}else if(_[_0x8c81('0x98')](_0x19324a[_0x22c0fe])){for(var _0x47851a=0x0;_0x47851a<_0x19324a[_0x22c0fe]['length'];_0x47851a++){this['saveRestApiResult'](_0x19324a[_0x22c0fe][_0x47851a],util[_0x8c81('0x27')](_0x8c81('0x9b'),_0x13b30d,_0x22c0fe+'['+_0x47851a+']'));}}else{if(!_['isNil'](_0x19324a[_0x22c0fe])){this[_0x8c81('0xf')][_0x8c81('0x9c')](util['format'](_0x8c81('0x9b'),_0x13b30d,_0x22c0fe),_0x19324a[_0x22c0fe]);}}}}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x94')]=function(_0x23dcc3){try{var _0x43c3eb=JSON['parse'](_0x23dcc3);this[_0x8c81('0x96')](_0x43c3eb);return JSON[_0x8c81('0x9d')](_0x43c3eb);}catch(_0x2cc3ba){return this['replaceAllVariables'](_0x23dcc3);}};AGIVertices[_0x8c81('0x12')]['replaceAllVariables']=function(_0x24e269){var _0x20230b=_0x24e269[_0x8c81('0x9e')]('{');for(var _0x3f154f=0x1;_0x3f154f<_0x20230b[_0x8c81('0x99')];_0x3f154f+=0x1){var _0x231516=_0x20230b[_0x3f154f][_0x8c81('0x9e')]('}');if(_0x231516[_0x8c81('0x99')]>0x1){_0x24e269=_0x24e269[_0x8c81('0x9f')]('{'+_0x231516[0x0]+'}',this['channel'][_0x8c81('0xa0')](_0x231516[0x0])['extra']||_0x231516[0x0]);}}if(_0x20230b['length']===0x1){return _0x24e269['toString']();}return this[_0x8c81('0x95')](_0x24e269);};AGIVertices['prototype'][_0x8c81('0xa1')]=function(_0x3c7302,_0x2cb331){var _0x534965=this[_0x8c81('0xf')]['getVariable'](_0x3c7302);if(_0x534965[_0x8c81('0xa2')]===-0x1){return _0x534965;}logger[_0x8c81('0x2b')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2cb331,_0x534965[_0x8c81('0xa3')]));return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x2cb331,_0x534965[_0x8c81('0xa3')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x81')]=function(_0x28aa15){return _0x28aa15&&_0x28aa15!=='0'&&_0x28aa15!=='-1'&&_0x28aa15!=='';};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa4')]=function(_0x4f0f00){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4f0f00,'-');_0x4f0f00['retry']=_0x4f0f00[_0x8c81('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x4291f8){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xa5'),_0x4291f8[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x4291f8[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}var _0x4adeb1='\x22'+_0x4291f8['text']+'\x22';if(this['isConfigured'](_0x4291f8[_0x8c81('0x72')])){_0x4adeb1+=','+_0x4291f8[_0x8c81('0x72')];}var _0x5d0e21=this[_0x8c81('0xf')][_0x8c81('0x55')]('MRCPSynth',_0x4adeb1);if(_0x5d0e21[_0x8c81('0xa2')]===-0x1){return _0x5d0e21;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xa8'),_0x4adeb1));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa9')]=function(_0x7c5c5){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xaa'),_0x7c5c5[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x7c5c5[_0x8c81('0xab')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20grammar\x20configured');}var _0x1b51f8=_0x7c5c5[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x7c5c5[_0x8c81('0x72')])){_0x1b51f8+=','+_0x7c5c5[_0x8c81('0x72')];}var _0xecf47b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xac'),_0x1b51f8);if(_0xecf47b[_0x8c81('0xa2')]===-0x1){return _0xecf47b;}var _0x5aa1bb=this[_0x8c81('0xa1')](_0x8c81('0xad'),_0x8c81('0xae'));if(_0x5aa1bb[_0x8c81('0xa2')]===-0x1){return _0x5aa1bb;}var _0x4b35f3=this[_0x8c81('0xa1')](_0x8c81('0xaf'),_0x8c81('0xb0'));if(_0x4b35f3[_0x8c81('0xa2')]===-0x1){return _0x4b35f3;}var _0x3de2c6=this[_0x8c81('0xa1')](_0x8c81('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x3de2c6[_0x8c81('0xa2')]===-0x1){return _0x3de2c6;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xb2'),_0x1b51f8));};AGIVertices['prototype'][_0x8c81('0x8')]=function(_0x57f14c){logger['info'](util['format'](_0x8c81('0xb3'),_0x57f14c['label']));return this[_0x8c81('0xf')][_0x8c81('0x8')]([_0x57f14c[_0x8c81('0xb4')],_0x57f14c[_0x8c81('0xb5')]]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0xb6')]=function(_0x581a09){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xb7'),_0x581a09['label']));if(this[_0x8c81('0x81')](_0x581a09[_0x8c81('0x61')])){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xb8'),_0x581a09[_0x8c81('0x61')]));var _0x4a1ea1=this[_0x8c81('0xf')]['wait'](_0x581a09[_0x8c81('0x61')]);if(_0x4a1ea1[_0x8c81('0xa2')]===-0x1){return _0x4a1ea1;}}return this[_0x8c81('0xf')][_0x8c81('0xb6')]();};AGIVertices['prototype']['callback']=function(_0x544990){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xb9'),_0x544990[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x544990[_0x8c81('0x46')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x544990,_0x8c81('0xba'));}_0x544990['scheduledAt']=moment();if(this[_0x8c81('0x81')](_0x544990[_0x8c81('0xbb')])){_0x544990['scheduledAt']=moment()[_0x8c81('0xbc')](_0x544990['delay'],_0x8c81('0xbd'));}if(!this[_0x8c81('0x81')](_0x544990[_0x8c81('0x4a')])){_0x544990[_0x8c81('0x4a')]=0x2;}this['createCmContact']['sync'](this,_0x544990);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x544990[_0x8c81('0x45')],_0x544990[_0x8c81('0x46')],_0x544990[_0x8c81('0x47')]));};AGIVertices[_0x8c81('0x12')]['custom_app']=function(_0x19f29e){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xbe'),_0x19f29e[_0x8c81('0x34')]));var _0x24b481=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x19f29e[_0x8c81('0xbf')],_0x19f29e[_0x8c81('0x72')]);if(_0x24b481[_0x8c81('0xa2')]===-0x1){return _0x24b481;}return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x19f29e['application'],_0x19f29e[_0x8c81('0x72')]));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc1')]=function(_0x1bcb85){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1bcb85[_0x8c81('0x34')]));if(!this['isConfigured'](_0x1bcb85[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}var _0x38e4a1='\x22'+_0x1bcb85[_0x8c81('0x58')]+'\x22';if(this[_0x8c81('0x81')](_0x1bcb85[_0x8c81('0x72')])){_0x38e4a1+=','+_0x1bcb85[_0x8c81('0x72')];}var _0x25728b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xc2'),_0x38e4a1);if(_0x25728b['result']===-0x1){return _0x25728b;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xa8'),_0x38e4a1));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc3')]=function(_0x321819){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x321819[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x321819['text'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xa7'));}var _0x4f1880='\x22'+_0x321819['text']+'\x22';if(this[_0x8c81('0x81')](_0x321819[_0x8c81('0x72')])){_0x4f1880+=','+_0x321819['options'];}var _0x7eec41=this[_0x8c81('0xf')]['exec'](_0x8c81('0xc2'),_0x4f1880);if(_0x7eec41['result']===-0x1){return _0x7eec41;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4f1880));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc4')]=function(_0x65e0fa){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0xc5'),_0x65e0fa[_0x8c81('0x34')]));if(!this['isConfigured'](_0x65e0fa['grammar'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xc6'));}var _0xd80cc0=_0x65e0fa[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x65e0fa[_0x8c81('0x72')])){_0xd80cc0+=','+_0x65e0fa[_0x8c81('0x72')];}var _0x30ce49=this['channel'][_0x8c81('0x55')](_0x8c81('0xac'),_0xd80cc0);if(_0x30ce49[_0x8c81('0xa2')]===-0x1){return _0x30ce49;}var _0x1f43ca=this[_0x8c81('0xa1')](_0x8c81('0xad'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1f43ca[_0x8c81('0xa2')]===-0x1){return _0x1f43ca;}var _0x5a8c91=this[_0x8c81('0xa1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5a8c91[_0x8c81('0xa2')]===-0x1){return _0x5a8c91;}var _0xb2544=this[_0x8c81('0xa1')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0xb2544[_0x8c81('0xa2')]===-0x1){return _0xb2544;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xd80cc0));};AGIVertices['prototype'][_0x8c81('0xc7')]=function(_0x5bce2b){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5bce2b['label']));if(!this[_0x8c81('0x81')](_0x5bce2b[_0x8c81('0xab')])){return this[_0x8c81('0xf')]['noop']('no\x20grammar\x20configured');}var _0x539443=_0x5bce2b[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x5bce2b[_0x8c81('0x72')])){_0x539443+=','+_0x5bce2b[_0x8c81('0x72')];}var _0x24f82e=this['channel'][_0x8c81('0x55')](_0x8c81('0xac'),_0x539443);if(_0x24f82e[_0x8c81('0xa2')]===-0x1){return _0x24f82e;}var _0x1eca51=this[_0x8c81('0xa1')]('RECOG_CONFIDENCE()',_0x8c81('0xc8'));if(_0x1eca51[_0x8c81('0xa2')]===-0x1){return _0x1eca51;}var _0x21ca21=this[_0x8c81('0xa1')](_0x8c81('0xaf'),_0x8c81('0xc9'));if(_0x21ca21[_0x8c81('0xa2')]===-0x1){return _0x21ca21;}var _0x29b7b8=this[_0x8c81('0xa1')](_0x8c81('0xb1'),_0x8c81('0xca'));if(_0x29b7b8[_0x8c81('0xa2')]===-0x1){return _0x29b7b8;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xb2'),_0x539443));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xcb')]=function(_0x45cb0a){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xcc'),_0x45cb0a[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x45cb0a['odbc_id'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xcd'));}var _0x1278f8=this[_0x8c81('0xce')][_0x8c81('0x6c')](this,_0x45cb0a[_0x8c81('0xcf')]);if(!_0x1278f8){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd0'));}if(!this['isConfigured'](_0x45cb0a[_0x8c81('0x2c')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd1'));}var _0x4f962b=_0x45cb0a[_0x8c81('0x2c')][_0x8c81('0xd2')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('query:\x20%s',_0x4f962b));var _0x973fbd=this[_0x8c81('0xd3')]['sync'](this,_0x1278f8,_0x4f962b);this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x45cb0a,_0x4f962b);if(!this['isConfigured'](_0x45cb0a[_0x8c81('0xd4')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xd5'));}var _0x4e7221=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x45cb0a['variable_id']);if(!_0x4e7221){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd6'));}var _0x31c1f9=this;_0x973fbd[_0x8c81('0xd7')](function(_0x5185b2,_0x3f4d52){Object[_0x8c81('0xd8')](_0x5185b2)[_0x8c81('0xd7')](function(_0x4d6c68){_0x31c1f9[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')]('%s[%s][%s]',_0x4e7221,_0x3f4d52,_0x4d6c68),_0x5185b2[_0x4d6c68]);});});this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0xd9'),_0x4e7221),_0x973fbd[_0x8c81('0x99')]);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xda'),_0x4e7221));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xdb')]=function(_0x1cdd2d){logger[_0x8c81('0xdc')](util[_0x8c81('0x27')](_0x8c81('0xdd'),_0x1cdd2d[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x1cdd2d[_0x8c81('0xde')])){return this['channel'][_0x8c81('0x29')](_0x1cdd2d,_0x8c81('0xdf'));}var _0x58543d=this[_0x8c81('0xe0')][_0x8c81('0x6c')](this,_0x1cdd2d[_0x8c81('0xde')]);if(!_0x58543d){return this['channel'][_0x8c81('0x29')](_0x1cdd2d,_0x8c81('0xe1'));}var _0x5e589b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xe2'),[util[_0x8c81('0x27')](_0x8c81('0xe3'),_0x58543d),_0x1cdd2d[_0x8c81('0x61')],_0x1cdd2d[_0x8c81('0xe4')],_0x1cdd2d[_0x8c81('0x60')]]);if(_0x5e589b[_0x8c81('0xa2')]===-0x1){return _0x5e589b;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xe5'),'DIAL'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xe6')]=function(_0x1d5121){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0xe7'),_0x1d5121['label']));if(!this['isConfigured'](_0x1d5121[_0x8c81('0x74')])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xe8'));}if(!this[_0x8c81('0x81')](_0x1d5121[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20text\x20configured');}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x1d5121);this[_0x8c81('0x40')](_0x1d5121[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0xea'),_0x1d5121[_0x8c81('0x58')]));var _0x24166d=this[_0x8c81('0x73')][_0x8c81('0x6c')](this,_0x1d5121);if(_0x24166d){for(var _0x1ef06c in _0x24166d){if(_0x24166d[_0x8c81('0x93')](_0x1ef06c)){this['channel'][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0xeb'),_0x1ef06c[_0x8c81('0x66')]()),_0x24166d[_0x1ef06c]);}}this[_0x8c81('0x40')](_0x24166d[_0x8c81('0xec')],_0x8c81('0xed'),_0x8c81('0xe6'),'');return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xee'),_0x24166d[_0x8c81('0xec')]));}return this['channel'][_0x8c81('0x29')](_0x1d5121,_0x8c81('0xef'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xf0')]=function(_0x52b2be){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xf1'),_0x52b2be[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x76')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf2'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x77')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf3'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x78')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xf4'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x79')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf5'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20text\x20configured');}this['channel'][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x52b2be);this[_0x8c81('0x40')](_0x52b2be[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xf6'),_0x52b2be[_0x8c81('0x58')]));var _0x3243fe=this['googleDialogflowV2'][_0x8c81('0x6c')](this,_0x52b2be);if(_0x3243fe){for(var _0x3fabfa in _0x3243fe){if(_0x3243fe[_0x8c81('0x93')](_0x3fabfa)){if(_0x3fabfa!=='providerResponse'){this[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')](_0x8c81('0xeb'),_0x3fabfa[_0x8c81('0x66')]()),_0x3243fe[_0x3fabfa]);}}}this['createSquareMessage'](_0x3243fe[_0x8c81('0xec')],_0x8c81('0xed'),_0x8c81('0xf0'),_0x3243fe[_0x8c81('0xf7')]);return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xf8'),_0x3243fe['speech']));}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x52b2be,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')][_0x8c81('0xf9')]=function(_0x262d55){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xfa'),_0x262d55['label']));if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xfb')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x8c81('0x81')](_0x262d55['username'])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xfc'));}if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xfd')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xfe'));}if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xff')])){return this['channel'][_0x8c81('0xa6')]('no\x20text\x20configured');}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x262d55);this[_0x8c81('0x40')](_0x262d55[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x100'),_0x262d55['text']));var _0xd5c5e6=this[_0x8c81('0x7a')]['sync'](this,_0x262d55);if(_0xd5c5e6){for(var _0x4af755 in _0xd5c5e6){if(_0xd5c5e6[_0x8c81('0x93')](_0x4af755)){this[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')](_0x8c81('0x101'),_0x4af755[_0x8c81('0x66')]()),_0xd5c5e6[_0x4af755]);}}this['createSquareMessage'](_0xd5c5e6[_0x8c81('0xec')],'out',_0x8c81('0xf9'),'');if(_0xd5c5e6[_0x8c81('0x102')]){this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0xd5c5e6[_0x8c81('0x102')]));var _0x407995=this[_0x8c81('0xf')][_0x8c81('0x103')](_0xd5c5e6[_0x8c81('0x102')]);try{fs[_0x8c81('0x104')](_0xd5c5e6[_0x8c81('0x102')]+'.wav');}catch(_0x4be698){logger['error'](_0x4be698);}return _0x407995;}else{return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x105'),_0xd5c5e6[_0x8c81('0xec')]));}}return this[_0x8c81('0xf')]['error'](_0x262d55,_0x8c81('0x106'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x107')]=function(_0x4af7d8){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x108'),_0x4af7d8[_0x8c81('0x34')]));return this[_0x8c81('0xf')]['noop'](_0x8c81('0x107'));};AGIVertices[_0x8c81('0x12')]['ext_dial']=function(_0x41ba3c){logger['info'](util['format'](_0x8c81('0x109'),_0x41ba3c[_0x8c81('0x34')]));var _0xe364d1='';if(_0x41ba3c[_0x8c81('0x10a')]){if(!this[_0x8c81('0x81')](_0x41ba3c[_0x8c81('0x10a')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10b'));}else{var _0x28d85c=parseInt(_0x41ba3c[_0x8c81('0x10a')],0xa);if(isNaN(_0x28d85c)){_0xe364d1=_0x41ba3c[_0x8c81('0x10a')];}else{_0xe364d1=this['getTrunk']['sync'](this,_0x41ba3c[_0x8c81('0x10a')]);if(!_0xe364d1){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10c'));}}}}else if(_0x41ba3c[_0x8c81('0x10d')]){_0xe364d1=_0x41ba3c['trunk_name'];}else{return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10b'));}var _0x3636ce=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xe2'),[util[_0x8c81('0x27')](_0x8c81('0x10e'),_0xe364d1,_0x41ba3c['phone']),_0x41ba3c[_0x8c81('0x61')],_0x41ba3c[_0x8c81('0xe4')],_0x41ba3c[_0x8c81('0x60')]]);if(_0x3636ce[_0x8c81('0xa2')]===-0x1){return _0x3636ce;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Executed\x20command\x20%s',_0x8c81('0xe2')));};AGIVertices['prototype']['finally']=function(_0x53a6f6){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x53a6f6[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0xa6')]('finally');};AGIVertices[_0x8c81('0x12')][_0x8c81('0xe')]=function(_0x3459a1){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x10f'),_0x3459a1[_0x8c81('0x34')]));if(_0x3459a1['retry']===0x0){return this['maxRetry'](_0x3459a1);}_0x3459a1[_0x8c81('0x110')]-=0x1;if(!this[_0x8c81('0x81')](_0x3459a1['file_id'])){return this['channel'][_0x8c81('0x29')](_0x3459a1,_0x8c81('0x111'));}var _0x33f865=this['getSound']['sync'](this,_0x3459a1[_0x8c81('0x112')]);if(!_0x33f865){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x3459a1,'no\x20file\x20audio\x20found');}if(!this[_0x8c81('0x81')](_0x3459a1[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x8c81('0xd5'));}var _0x1fa6a3=this[_0x8c81('0xf')]['getData'](_0x33f865,_0x3459a1[_0x8c81('0x113')],_0x3459a1['maxdigit']);var _0x263bfb=_0x1fa6a3['result']?_0x1fa6a3[_0x8c81('0xa2')][_0x8c81('0x49')]():'';logger[_0x8c81('0x2b')](_0x8c81('0x114'),JSON[_0x8c81('0x9d')](_0x1fa6a3));if(_0x1fa6a3[_0x8c81('0xa2')]===-0x1){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,_0x263bfb);return _0x1fa6a3;}else if(_0x1fa6a3[_0x8c81('0xa3')]===_0x8c81('0x61')){_0x1fa6a3[_0x8c81('0xa2')]=_0x263bfb[_0x8c81('0x99')]>=parseInt(_0x3459a1['mindigit'])?'x':'i';}else{_0x1fa6a3[_0x8c81('0xa2')]=_0x263bfb[_0x8c81('0x99')]>=parseInt(_0x3459a1[_0x8c81('0x115')])&&_0x263bfb[_0x8c81('0x99')]<=parseInt(_0x3459a1['maxdigit'])?'x':'i';}var _0x5587df=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x3459a1[_0x8c81('0xd4')]);if(!_0x5587df){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x3459a1,_0x8c81('0xd6'));}this[_0x8c81('0xf')]['setVariable'](_0x5587df,_0x263bfb);if(this[_0x8c81('0x81')](_0x3459a1['hiddendigitsnum'])){var _0xd71cc4=parseInt(_0x3459a1[_0x8c81('0x116')],0xa);var _0x2a7a39=rs[_0x8c81('0x117')]({'charset':'*','length':_0xd71cc4});var _0x27b0e6=_0x263bfb['length'];if(_0x27b0e6>0x0){if(_0x27b0e6>_0xd71cc4){this['createSquareDetailsReport'][_0x8c81('0x6c')](this,_0x3459a1,_0x3459a1[_0x8c81('0x118')]==='first'?_0x2a7a39+_0x263bfb[_0x8c81('0x119')](_0xd71cc4):_0x263bfb[_0x8c81('0x119')](0x0,_0x27b0e6-_0xd71cc4)+_0x2a7a39);}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,rs[_0x8c81('0x117')]({'charset':'*','length':_0x27b0e6}));}}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,'');}}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,_0x263bfb);}return _0x1fa6a3;};AGIVertices[_0x8c81('0x12')][_0x8c81('0x11a')]=function(_0x46ae88){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x11b'),_0x46ae88[_0x8c81('0x34')]));return this[_0x8c81('0xe')](_0x46ae88);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x11c')]=function(_0xbbeb50){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x11d'),_0xbbeb50[_0x8c81('0x34')]));this[_0x8c81('0x32')]['sync'](this,_0xbbeb50,_0xbbeb50['goalname']);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x11e'),_0xbbeb50[_0x8c81('0x11f')]));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x120')]=function(_0x46b98c){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x121'),_0x46b98c[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x8a')])||!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x84')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x122'));}if(!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x58')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x123'),_0x46b98c['text']));var _0x120fea=this['awsPolly'][_0x8c81('0x6c')](this,_0x46b98c);if(_0x120fea){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x124'),_0x120fea));var _0x236bb5=this[_0x8c81('0xf')][_0x8c81('0x103')](_0x120fea);try{fs[_0x8c81('0x104')](_0x120fea+_0x8c81('0x125'));}catch(_0x3a4f36){logger[_0x8c81('0x29')](_0x3a4f36);}return _0x236bb5;}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x46b98c,_0x8c81('0x126'));};AGIVertices[_0x8c81('0x12')]['awslex']=function(_0x2f1b04){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x127'),_0x2f1b04[_0x8c81('0x34')]));if(!this['isConfigured'](_0x2f1b04['aws_access_key_id'])||!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x84')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x8c')])){return this['channel']['noop'](_0x8c81('0x128'));}if(!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x58')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this['createSquareDetailsReport'](_0x2f1b04);this['createSquareMessage'](_0x2f1b04[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2f1b04['text']));var _0x449395=this[_0x8c81('0x89')][_0x8c81('0x6c')](this,_0x2f1b04);if(_0x449395){for(var _0x58daa6 in _0x449395){if(_0x449395['hasOwnProperty'](_0x58daa6)&&_['isString'](_0x449395[_0x58daa6])){this['channel'][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x129'),_0x58daa6[_0x8c81('0x66')]()),_0x449395[_0x58daa6]);}}if(_[_0x8c81('0x43')](_0x449395[_0x8c81('0x12a')])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0x12b'));}else{this['createSquareMessage'](_0x449395[_0x8c81('0x12a')],_0x8c81('0xed'),_0x8c81('0x12c'),'');return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x12d'),_0x449395['message']));}}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2f1b04,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')]['googleasr']=function(_0x6598f0){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x12e'),_0x6598f0[_0x8c81('0x34')],_0x6598f0[_0x8c81('0x61')]));if(!this['isConfigured'](_0x6598f0[_0x8c81('0x74')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xe8'));}var _0x280d0d=_0x8c81('0x12f');var _0x1c1896=util['format'](_0x8c81('0x130'),FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x360545=util['format'](_0x8c81('0x9b'),_0x1c1896,_0x280d0d);var _0xfb0b44=!![];if(_0x6598f0[_0x8c81('0x131')]==='NOBEEP'){_0xfb0b44=![];}var _0x4b9e5d=this[_0x8c81('0xf')][_0x8c81('0x132')](_0x1c1896,_0x280d0d,_0x6598f0[_0x8c81('0x133')],_0x6598f0[_0x8c81('0x61')],undefined,_0xfb0b44);if(_0x4b9e5d[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x134'),_0x360545));var _0x4bf5c6=this[_0x8c81('0x8d')][_0x8c81('0x6c')](this,_0x6598f0,_0x360545);if(_0x4bf5c6){for(var _0x1a7d63 in _0x4bf5c6){if(_0x4bf5c6[_0x8c81('0x93')](_0x1a7d63)){this['channel'][_0x8c81('0x9c')](util['format'](_0x8c81('0x135'),_0x1a7d63[_0x8c81('0x66')]()),_0x4bf5c6[_0x1a7d63]);}}return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x136'),JSON[_0x8c81('0x9d')](_0x4bf5c6)));}}return _0x4b9e5d;};AGIVertices['prototype'][_0x8c81('0x137')]=function(_0x20779f){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x138'),_0x20779f[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x20779f[_0x8c81('0x90')])){return this[_0x8c81('0xf')]['noop']('no\x20appid\x20configured');}if(!this[_0x8c81('0x81')](_0x20779f[_0x8c81('0x139')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20appsecret\x20configured');}var _0x598d66='wav';var _0x1b621c=util[_0x8c81('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x5a3734=util[_0x8c81('0x27')](_0x8c81('0x9b'),_0x1b621c,_0x598d66);var _0x40c6fa=!![];if(_0x20779f[_0x8c81('0x131')]===_0x8c81('0x13a')){_0x40c6fa=![];}var _0x52dbac=this[_0x8c81('0xf')][_0x8c81('0x132')](_0x1b621c,_0x598d66,_0x20779f[_0x8c81('0x133')],_0x20779f[_0x8c81('0x61')],undefined,_0x40c6fa);if(_0x52dbac[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x13b'),_0x5a3734));var _0x3bbea0=this[_0x8c81('0x8f')][_0x8c81('0x6c')](this,_0x20779f,_0x5a3734);if(_0x3bbea0){for(var _0x474dbb in _0x3bbea0){if(_0x3bbea0[_0x8c81('0x93')](_0x474dbb)){this[_0x8c81('0xf')][_0x8c81('0x9c')](util['format']('TILDE_ASR_%s',_0x474dbb[_0x8c81('0x66')]()),_0x3bbea0[_0x474dbb]);}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x13c'),JSON[_0x8c81('0x9d')](_0x3bbea0)));}}return _0x52dbac;};AGIVertices['prototype'][_0x8c81('0x13d')]=function(_0x22ce14){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x13e'),_0x22ce14[_0x8c81('0x34')]));return this['channel']['continueAt'](_0x22ce14[_0x8c81('0x3a')],_0x22ce14['extension'],_0x22ce14[_0x8c81('0x3c')]);};AGIVertices['prototype'][_0x8c81('0x13f')]=function(_0x50afad){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x140'),_0x50afad[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x50afad['condition'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x50afad,_0x8c81('0x141'));}try{var _0x5b79b9=eval(_0x50afad[_0x8c81('0x142')])?_0x8c81('0x143'):_0x8c81('0x144');this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x145'),_0x50afad[_0x8c81('0x142')],_0x5b79b9));return{'code':0xc8,'result':_0x5b79b9};}catch(_0x568d66){return{'code':0xc8,'result':_0x8c81('0x144')};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x146')]=function(_0x2b85fc){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x147'),_0x2b85fc[_0x8c81('0x34')]));if(!this['isConfigured'](_0x2b85fc[_0x8c81('0x148')])){return this['channel'][_0x8c81('0x29')](_0x2b85fc,_0x8c81('0x149'));}var _0x1d8f2c=this[_0x8c81('0x14a')][_0x8c81('0x6c')](this,_0x2b85fc[_0x8c81('0x148')]);if(!_0x1d8f2c){return this['channel']['error'](_0x2b85fc,'no\x20intervals\x20found');}for(var _0x53d4d7=0x0;_0x53d4d7<_0x1d8f2c[_0x8c81('0x99')];_0x53d4d7+=0x1){var _0x343b31=this[_0x8c81('0xf')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x1d8f2c[_0x53d4d7]));if(_0x343b31['result']===-0x1){return _0x343b31;}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x343b31[_0x8c81('0xa3')]));if(_0x343b31[_0x8c81('0xa3')]===_0x8c81('0x143')){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x8c81('0x143')));this[_0x8c81('0xf')]['noop'](util['format'](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x8c81('0x143')));return{'code':0xc8,'result':_0x8c81('0x143')};}else{logger['info'](util[_0x8c81('0x27')]('IFTIME\x20%s\x20%s',_0x1d8f2c[_0x53d4d7],_0x8c81('0x144')));this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],'false'));}}return{'code':0xc8,'result':_0x8c81('0x144')};};AGIVertices[_0x8c81('0x12')][_0x8c81('0x14c')]=function(_0x135af4){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14d'),_0x135af4[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0x14c')]();};AGIVertices[_0x8c81('0x12')][_0x8c81('0x14e')]=function(_0x49df03){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14f'),_0x49df03[_0x8c81('0x34')]));if(!this['isConfigured'](_0x49df03['key'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xe8'));}var _0x5f380b=_0x8c81('0x12f');var _0x43dd88=util['format'](_0x8c81('0x130'),FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x3dd6ed=util['format']('%s.%s',_0x43dd88,_0x5f380b);var _0x1df8af=!![];if(_0x49df03[_0x8c81('0x131')]===_0x8c81('0x13a')){_0x1df8af=![];}var _0x29148d=this['channel'][_0x8c81('0x132')](_0x43dd88,_0x5f380b,_0x49df03[_0x8c81('0x133')],_0x49df03['timeout'],undefined,_0x1df8af);if(_0x29148d[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x150'),_0x3dd6ed));var _0x2f91e7=this[_0x8c81('0x7e')][_0x8c81('0x6c')](this,_0x49df03,_0x3dd6ed);if(_0x2f91e7){for(var _0x8eb411 in _0x2f91e7){if(_0x2f91e7[_0x8c81('0x93')](_0x8eb411)){this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x151'),_0x8eb411[_0x8c81('0x66')]()),_0x2f91e7[_0x8eb411]);}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x152'),JSON['stringify'](_0x2f91e7)));}}return _0x29148d;};AGIVertices['prototype'][_0x8c81('0x153')]=function(_0xe87c0b){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x154'),_0xe87c0b[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xe87c0b[_0x8c81('0x74')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xe8'));}if(!this[_0x8c81('0x81')](_0xe87c0b['text'])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x155'),_0xe87c0b['text']));var _0xcc4bb1=this[_0x8c81('0x7b')][_0x8c81('0x6c')](this,_0xe87c0b);if(_0xcc4bb1){this['channel']['noop'](util[_0x8c81('0x27')](_0x8c81('0x150'),_0xcc4bb1));var _0x5955e3=this[_0x8c81('0xf')][_0x8c81('0x103')](_0xcc4bb1,_0xe87c0b[_0x8c81('0x133')]);try{fs['unlink'](_0xcc4bb1+_0x8c81('0x125'));}catch(_0x26d53d){logger[_0x8c81('0x29')](_0x26d53d);}return _0x5955e3;}return this['channel']['error'](_0xe87c0b,_0x8c81('0x156'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x157')]=function(_0x1cbe58){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1cbe58['label']));if(!this['isConfigured'](_0x1cbe58[_0x8c81('0x158')])){return this['channel'][_0x8c81('0x29')](_0x1cbe58,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')]['callerid'],_0x1cbe58[_0x8c81('0x158')]));var _0x1460c0=this[_0x8c81('0x51')]['sync'](this,_0x1cbe58[_0x8c81('0x158')]);if(_0x1460c0){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')]['callerid'],_0x1cbe58['findBy']));this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1cbe58[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1cbe58['findBy']));this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8c81('0x38')],_0x1cbe58['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x8c81('0x15d')]=function(_0x549874){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15e'),_0x549874['label']));if(!this[_0x8c81('0x81')](_0x549874['findBy'])){return this[_0x8c81('0xf')]['error'](_0x549874,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')]['callerid'],_0x549874['findBy']));var _0x5a046a=this[_0x8c81('0x50')][_0x8c81('0x6c')](this,_0x549874[_0x8c81('0x158')]);if(_0x5a046a){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));this['channel'][_0x8c81('0xa6')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0x549874[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x160')};}};AGIVertices[_0x8c81('0x12')]['math']=function(_0x18f4ff){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x161'),_0x18f4ff[_0x8c81('0x34')]));if(!this['isConfigured'](_0x18f4ff[_0x8c81('0x162')])){return this['channel'][_0x8c81('0x29')](_0x18f4ff,_0x8c81('0x163'));}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('math\x20%s',_0x18f4ff[_0x8c81('0x162')]));var _0x42fa37=eval(_0x18f4ff['operation']);if(!this[_0x8c81('0x81')](_0x18f4ff[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xd5'));}var _0x3e86af=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x18f4ff[_0x8c81('0xd4')]);if(!_0x3e86af){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x18f4ff,_0x8c81('0xd6'));}if(_[_0x8c81('0x98')](_0x42fa37)){var _0x3468ec=this;_0x42fa37[_0x8c81('0xd7')](function(_0x45f996,_0x36f4dc){_0x3468ec[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')]('%s[%s]',_0x3e86af,_0x36f4dc),_0x45f996);});return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x164'),_0x3e86af));}else{return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x3e86af,_0x42fa37);}};AGIVertices[_0x8c81('0x12')][_0x8c81('0xd')]=function(_0x4516f1){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x165'),_0x4516f1[_0x8c81('0x34')]));if(_0x4516f1['retry']===0x0){return this[_0x8c81('0xa4')](_0x4516f1);}_0x4516f1['retry']-=0x1;if(!this['isConfigured'](_0x4516f1['file_id'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4516f1,_0x8c81('0x111'));}var _0x417cea=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0x4516f1[_0x8c81('0x112')]);if(!_0x417cea){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4516f1,_0x8c81('0x166'));}var _0x1292c2=this[_0x8c81('0xf')][_0x8c81('0x167')](_0x417cea,_0x4516f1[_0x8c81('0x113')],_0x4516f1['digit']);var _0x26624f=_0x1292c2[_0x8c81('0xa2')];if(_0x1292c2[_0x8c81('0xa2')]===-0x1){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4516f1,'-1');return _0x1292c2;}else if(_0x1292c2[_0x8c81('0xa3')]===_0x8c81('0x61')){_0x1292c2[_0x8c81('0xa2')]=_0x1292c2[_0x8c81('0xa2')][_0x8c81('0x99')]>0x0?_0x1292c2[_0x8c81('0xa2')]:'t';}else if(_['isEmpty'](_0x1292c2[_0x8c81('0xa2')])){_0x1292c2[_0x8c81('0xa2')]='#';_0x26624f='#';}if(!this['isConfigured'](_0x4516f1[_0x8c81('0xd4')])){this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x464a9c=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x4516f1[_0x8c81('0xd4')]);if(!_0x464a9c){return this['channel']['error'](_0x4516f1,'no\x20variable\x20found');}this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x464a9c,_0x26624f);}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4516f1,_0x26624f);return _0x1292c2;};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa6')]=function(_0x5a6894){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5a6894[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x5a6894[_0x8c81('0x168')]||_0x5a6894[_0x8c81('0x34')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x169')]=function(_0x1d4394){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x16a'),_0x1d4394[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x1d4394[_0x8c81('0x158')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x1d4394,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394[_0x8c81('0x158')]));var _0x5ac59a=this[_0x8c81('0x4b')]['sync'](this,_0x1d4394[_0x8c81('0x16b')]);var _0xd2e897=this[_0x8c81('0x4e')][_0x8c81('0x6c')](this,_0x1d4394['findBy'],_0x5ac59a);if(_0xd2e897){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')]['callerid'],_0x1d4394[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0x1d4394['findBy']));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394['findBy']));return{'code':0xc8,'result':_0x8c81('0x160')};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x16c')]=function(_0x357694){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x16d'),_0x357694[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x357694[_0x8c81('0x112')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x357694,_0x8c81('0x111'));}var _0x180bd2=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0x357694[_0x8c81('0x112')]);if(!_0x180bd2){return this['channel'][_0x8c81('0x29')](_0x357694,_0x8c81('0x166'));}var _0x197368=this[_0x8c81('0xf')][_0x8c81('0x55')]('PLAYBACK',[_0x180bd2,_0x357694['opts']]);if(_0x197368[_0x8c81('0xa2')]===-0x1){return _0x197368;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x16e'),_0x180bd2));};AGIVertices[_0x8c81('0x12')]['queue']=function(_0xa22de4){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x16f'),_0xa22de4[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xa22de4[_0x8c81('0x170')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xa22de4,_0x8c81('0x171'));}var _0x45ee0d='';var _0x463de7=parseInt(_0xa22de4[_0x8c81('0x170')],0xa);if(isNaN(_0x463de7)){_0x45ee0d=_0xa22de4[_0x8c81('0x170')];}else{_0x45ee0d=this['getVoiceQueue'][_0x8c81('0x6c')](this,_0xa22de4[_0x8c81('0x170')]);if(!_0x45ee0d){return this[_0x8c81('0xf')]['error'](_0xa22de4,_0x8c81('0x172'));}}var _0xb2c1df='';if(this[_0x8c81('0x81')](_0xa22de4[_0x8c81('0x112')])){var _0x3c6825=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0xa22de4[_0x8c81('0x112')]);if(_0x3c6825){_0xb2c1df=_0x3c6825;}}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0xa22de4,_0x45ee0d);if(_0xa22de4[_0x8c81('0xe4')][_0x8c81('0x173')]('x')<0x0){_0xa22de4['opts']+='x';}if(_0xa22de4['opts'][_0x8c81('0x173')]('X')<0x0){_0xa22de4[_0x8c81('0xe4')]+='X';}this[_0x8c81('0xf')]['setVariable'](_0x8c81('0x174'),_0x45ee0d?_0x45ee0d[_0x8c81('0x175')]():'');var _0x215959=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0x176'),[_0x45ee0d,_0xa22de4[_0x8c81('0xe4')],_0xa22de4[_0x8c81('0x60')],_0xb2c1df,_0xa22de4[_0x8c81('0x61')],_0xa22de4[_0x8c81('0x8')],_0xa22de4[_0x8c81('0x177')],_0xa22de4[_0x8c81('0x178')],'',_0xa22de4[_0x8c81('0x179')]]);if(_0x215959['result']===-0x1){return _0x215959;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x176'),_0x45ee0d));};AGIVertices[_0x8c81('0x12')]['record']=function(_0x4b3df1){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4b3df1['label']));var _0x47a016=_0x4b3df1[_0x8c81('0x17a')]||_0x8c81('0x12f');var _0x1dac99=util['format'](_0x8c81('0x17b'),this[_0x8c81('0xf')][_0x8c81('0x33')],rs['generate'](0x5));var _0x5c5521=util['format'](_0x8c81('0x17c'),FILES_PATH,_0x1dac99,_0x47a016);var _0x5c56a0=util[_0x8c81('0x27')]('%s/recordings/%s',FILES_PATH,_0x1dac99);this[_0x8c81('0x37')][_0x8c81('0x6c')](this,_0x4b3df1,_0x1dac99,_0x5c5521);this['channel'][_0x8c81('0x9c')](_0x8c81('0x17d'),_0x1dac99);logger[_0x8c81('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5c56a0,_0x47a016,_0x4b3df1['escape_digits'],_0x4b3df1[_0x8c81('0x61')]);return this[_0x8c81('0xf')][_0x8c81('0x132')](_0x5c56a0,_0x47a016,_0x4b3df1[_0x8c81('0x17e')],_0x4b3df1[_0x8c81('0x61')],undefined,!![]);};AGIVertices[_0x8c81('0x12')]['restapi']=function(_0x4d04b2){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x17f'),_0x4d04b2[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x4d04b2[_0x8c81('0x60')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0x180'));}var _0x1fba2c=this['restAPI']['sync'](this,_0x4d04b2);logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x181'),util['inspect'](_0x1fba2c,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d04b2[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x182'));}var _0x21e98b=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x4d04b2[_0x8c81('0xd4')]);if(!_0x21e98b){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4d04b2,_0x8c81('0xd6'));}this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x183'),_0x21e98b),_0x1fba2c[_0x8c81('0x70')]?_0x1fba2c[_0x8c81('0x70')]:_0x8c81('0x184'));this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x185'),_0x21e98b),_0x1fba2c[_0x8c81('0x186')]?_0x1fba2c[_0x8c81('0x186')]:'OK');if(_0x1fba2c[_0x8c81('0x67')]){try{this['saveRestApiResult'](_0x1fba2c[_0x8c81('0x67')],_0x21e98b);}catch(_0x457953){logger[_0x8c81('0x29')](util[_0x8c81('0x27')](_0x8c81('0x187'),_0x21e98b));}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xda'),_0x21e98b));};AGIVertices['prototype'][_0x8c81('0x188')]=function(_0x593817){logger['info'](util['format'](_0x8c81('0x189'),_0x593817[_0x8c81('0x34')]));return this['channel']['sayDigits'](_0x593817['digits'][_0x8c81('0xd2')](/\s+/g,''),_0x593817['escape_digits']);};AGIVertices[_0x8c81('0x12')]['saynumber']=function(_0x17f6fd){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x18a'),_0x17f6fd[_0x8c81('0x34')]));return this['channel'][_0x8c81('0x18b')](_0x17f6fd[_0x8c81('0x62')][_0x8c81('0xd2')](/\s+/g,''),_0x17f6fd[_0x8c81('0x17e')]);};AGIVertices['prototype']['sayphonetic']=function(_0x278a40){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x18c'),_0x278a40[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0x18d')](_0x278a40[_0x8c81('0x58')],_0x278a40[_0x8c81('0x17e')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x18e')]=function(_0xfd717b){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x18f'),_0xfd717b['label']));if(!this['isConfigured'](_0xfd717b[_0x8c81('0x190')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x191'));}var _0xb67548=this[_0x8c81('0x21')][_0x8c81('0x6c')](this,_0xfd717b[_0x8c81('0x190')]);if(!_0xb67548||!_0xb67548['Smtp']){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xfd717b,'no\x20mail\x20account\x20found');}var _0x3fd9ef={'from':util[_0x8c81('0x27')](_0x8c81('0x192'),_0xb67548['name'],_0xb67548[_0x8c81('0x193')]||_0xb67548[_0x8c81('0x194')][_0x8c81('0x195')]),'to':_0xfd717b['to']||'','cc':_0xfd717b['cc']||'','bcc':_0xfd717b[_0x8c81('0x196')]||'','subject':_0xfd717b[_0x8c81('0x197')],'html':_0xfd717b[_0x8c81('0x58')],'text':_0xfd717b[_0x8c81('0x58')]};if(this['isConfigured'](_0xfd717b[_0x8c81('0x198')])){}logger['debug'](_0x8c81('0x199'),JSON[_0x8c81('0x9d')](_0x3fd9ef));this[_0x8c81('0x32')]['sync'](this,_0xfd717b,_0xfd717b[_0x8c81('0x190')]);this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x19a'),_0xb67548['name']));this['sendMailMessage']['sync'](this,_0xb67548[_0x8c81('0x19b')],_0x3fd9ef);return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x19c'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x19d')]=function(_0x1224ad){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x1224ad['label']));return this['channel']['noop'](_0x8c81('0x19e'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x19f')]=function(_0x17c22c){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1a0'),_0x17c22c[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x17c22c[_0x8c81('0x1a1')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0x1a2'));}var _0x102a31=this[_0x8c81('0x30')][_0x8c81('0x6c')](this,_0x17c22c[_0x8c81('0x1a1')]);if(!_0x102a31){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x17c22c,_0x8c81('0x1a3'));}var _0x59dc3b={'body':_0x17c22c[_0x8c81('0x1a4')],'phone':_0x17c22c['to']||'','SmsAccountId':_0x102a31['id']};logger[_0x8c81('0xdc')](_0x8c81('0x1a5'),JSON['stringify'](_0x59dc3b));this['createSquareDetailsReport']['sync'](this,_0x17c22c,_0x17c22c[_0x8c81('0x1a1')]);this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x1a6'),_0x102a31[_0x8c81('0x14')]));this[_0x8c81('0x31')][_0x8c81('0x6c')](this,_0x59dc3b);return this[_0x8c81('0xf')][_0x8c81('0xa6')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1a7')]=function(_0x2027a6){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2027a6[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x2027a6[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2027a6,'no\x20variable\x20selected');}var _0x14050b=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x2027a6[_0x8c81('0xd4')]);if(!_0x14050b){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2027a6,_0x8c81('0xd6'));}return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x14050b,_0x2027a6['variable_value']);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1a8')]=function(_0x315899){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x315899[_0x8c81('0x34')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1a9'));var _0x1e0c67=this[_0x8c81('0xf')][_0x8c81('0xa0')](_0x8c81('0x1aa'));if(!_[_0x8c81('0x42')](_0x1e0c67[_0x8c81('0xa3')])){this[_0x8c81('0xf')][_0x8c81('0x33')]=_0x1e0c67[_0x8c81('0xa3')];}if(_0x315899[_0x8c81('0xb6')]==='yes'){this[_0x8c81('0xf')][_0x8c81('0xa6')]('Answer');return this['channel'][_0x8c81('0xb6')]();}return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1ab'));};AGIVertices['prototype']['subproject']=function(_0x283abb){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1ac'),_0x283abb[_0x8c81('0x34')]));if(!this['isConfigured'](_0x283abb[_0x8c81('0x1ad')])){return this['channel'][_0x8c81('0x29')](_0x283abb,_0x8c81('0x1ae'));}var _0x1a3915=this[_0x8c81('0x17')][_0x8c81('0x6c')](this,_0x283abb[_0x8c81('0x1ad')]);if(!this['isConfigured'](_0x1a3915)){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x283abb,util['format'](_0x8c81('0x1af'),_0x283abb[_0x8c81('0x1ad')]));}if(_0x1a3915===this['channel']['arg_1']){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x283abb,_0x8c81('0x1b0'));}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x283abb,_0x1a3915);var _0x57cfa5=this[_0x8c81('0xf')]['exec'](_0x8c81('0x1b1'),util[_0x8c81('0x27')](_0x8c81('0x1b2'),config['agi']['host']||'127.0.0.1',_0x1a3915,this[_0x8c81('0xf')][_0x8c81('0x36')]));if(_0x57cfa5['result']===-0x1){return _0x57cfa5;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x1b1'),_0x1a3915));};AGIVertices['prototype']['system']=function(_0x284d34){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1b3'),_0x284d34['label']));var _0x334861=this[_0x8c81('0x54')][_0x8c81('0x6c')](this,_0x284d34[_0x8c81('0xb4')]);this[_0x8c81('0x32')]['sync'](this,_0x284d34,_0x284d34[_0x8c81('0xb4')]);if(this[_0x8c81('0x81')](_0x284d34[_0x8c81('0xd4')])){var _0x4fa1ee=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x284d34['variable_id']);if(_0x4fa1ee){this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x4fa1ee,_0x334861);return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x284d34['command'],_0x4fa1ee));}}return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x1b4'),_0x284d34[_0x8c81('0xb4')]));};AGIVertices['prototype'][_0x8c81('0x1b5')]=function(_0x1d0429){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1d0429[_0x8c81('0x34')]));_0x1d0429[_0x8c81('0x58')]=_0x1d0429['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c81('0x81')](_0x1d0429[_0x8c81('0x57')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1b6'));}if(!this['isConfigured'](_0x1d0429[_0x8c81('0x58')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1d0429[_0x8c81('0x58')]));var _0x489edc=this[_0x8c81('0x56')][_0x8c81('0x6c')](this,_0x1d0429);if(_0x489edc){this[_0x8c81('0xf')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x489edc));var _0xe20d46=this[_0x8c81('0xf')][_0x8c81('0x103')](_0x489edc);try{fs['unlink'](_0x489edc+_0x8c81('0x125'));}catch(_0x41a3d8){logger[_0x8c81('0x29')](_0x41a3d8);}return _0xe20d46;}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x1d0429,_0x8c81('0x1b7'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1b8')]=function(_0x1b2897){logger['info'](util['format'](_0x8c81('0x1b9'),_0x1b2897['label']));_0x1b2897[_0x8c81('0x58')]=_0x1b2897[_0x8c81('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c81('0x81')](_0x1b2897[_0x8c81('0x58')])){return this[_0x8c81('0xf')]['noop']('no\x20text\x20configured');}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x1ba'),_0x1b2897['text']));var _0x6c2163=this[_0x8c81('0x5d')][_0x8c81('0x6c')](this,_0x1b2897);if(_0x6c2163){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x1bb'),_0x6c2163));var _0x2654ea=this['channel'][_0x8c81('0x103')](_0x6c2163);try{fs['unlink'](_0x6c2163+_0x8c81('0x125'));}catch(_0x2ef1bf){logger[_0x8c81('0x29')](_0x2ef1bf);}return _0x2654ea;}return this['channel'][_0x8c81('0x29')](_0x1b2897,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1bc')]=function(_0xf1ee3f){logger['info'](util['format'](_0x8c81('0x1bd'),_0xf1ee3f[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xf1ee3f[_0x8c81('0x158')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xf1ee3f,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));var _0x38e220=this[_0x8c81('0x4f')][_0x8c81('0x6c')](this,_0xf1ee3f['findBy']);if(_0x38e220){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0xf1ee3f[_0x8c81('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1be')]=function(_0x383114){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x1bf'),_0x383114['label']));var _0xe2fb19=this['channel'][_0x8c81('0x55')](_0x8c81('0x1c0'),[_0x383114[_0x8c81('0x1c1')],_0x383114[_0x8c81('0x72')]]);if(_0xe2fb19[_0x8c81('0xa2')]===-0x1){return _0xe2fb19;}return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x1c0'),_0x383114['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x886c43){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1c2'),_0x886c43[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x886c43[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x886c43,'no\x20variable\x20selected');}var _0x17c9b3=this[_0x8c81('0xa0')]['sync'](this,_0x886c43[_0x8c81('0xd4')]);if(!_0x17c9b3){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x886c43,'no\x20variable\x20found');}var _0x1792fd=this['channel'][_0x8c81('0xa0')](_0x17c9b3);return{'code':0xc8,'result':_0x1792fd[_0x8c81('0xa3')]?_0x1792fd['extra']:'-'};};String[_0x8c81('0x12')][_0x8c81('0x9f')]=function(_0x5557c9,_0x456b58){return this[_0x8c81('0x9e')](_0x5557c9)['join'](_0x456b58);};module['exports']=AGIVertices; \ No newline at end of file +var _0x1670=['google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','extension','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','getSound','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','email','user','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','agi','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','moment','mustache','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','agentLogout','agentLogin','LOCAL','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','method','timeout','includes','POST','PUT','parse','headers','computedVariables','uri','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','split','replaceAll','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','phone','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','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','generate','NOBEEP','intKey'];(function(_0x3a1978,_0x21ab3d){var _0x5dab1e=function(_0x49c371){while(--_0x49c371){_0x3a1978['push'](_0x3a1978['shift']());}};_0x5dab1e(++_0x21ab3d);}(_0x1670,0x9a));var _0x0167=function(_0x11c8e5,_0x2876e1){_0x11c8e5=_0x11c8e5-0x0;var _0x46689a=_0x1670[_0x11c8e5];return _0x46689a;};'use strict';var fs=require('fs');var util=require(_0x0167('0x0'));var _=require(_0x0167('0x1'));var sh=require('shelljs');var odbc=require(_0x0167('0x2'))();var rs=require('randomstring');var moment=require(_0x0167('0x3'));var Mustache=require(_0x0167('0x4'));var rp=require(_0x0167('0x5'));var logger=require(_0x0167('0x6'))('agi');var config=require('../../config/environment');var scripts=require(_0x0167('0x7'));var FILES_PATH=_0x0167('0x8');var recursiveMapAttributes=[_0x0167('0x9'),_0x0167('0xa')];var verticesWithRetry=[_0x0167('0xb'),_0x0167('0xc'),_0x0167('0xd')];var AGIVertices=function(_0x416079,_0x5e9ba9,_0x4c6b78){this[_0x0167('0xe')]=_0x416079;this[_0x0167('0xf')]=_0x5e9ba9;this[_0x0167('0x10')]=_0x4c6b78;};AGIVertices[_0x0167('0x11')][_0x0167('0x12')]=function(_0x364dc7,_0x2257a8){this[_0x0167('0xf')][_0x0167('0x13')](_0x364dc7)[_0x0167('0x14')](function(_0x88e059){_0x2257a8(null,_0x88e059?_0x88e059[_0x0167('0x15')]:![]);})[_0x0167('0x16')](function(_0x2ebfa3){_0x2257a8(_0x2ebfa3);});};AGIVertices['prototype'][_0x0167('0x17')]=function(_0x4e2c53,_0x25e5d4){this['rpc'][_0x0167('0x18')](_0x4e2c53)[_0x0167('0x14')](function(_0x3fc778){_0x25e5d4(null,_0x3fc778?_0x3fc778['name']:![]);})['catch'](function(_0x547dea){_0x25e5d4(_0x547dea);});};AGIVertices[_0x0167('0x11')][_0x0167('0x19')]=function(_0x4c4cc7,_0xcb9473){this['rpc']['getSquareProjectById'](_0x4c4cc7)[_0x0167('0x14')](function(_0x574f04){_0xcb9473(null,_0x574f04?_0x574f04[_0x0167('0x15')]:![]);})['catch'](function(_0x16094a){_0xcb9473(_0x16094a);});};AGIVertices[_0x0167('0x11')][_0x0167('0x1a')]=function(_0x18e3fb,_0xc3f9fe){this[_0x0167('0xf')][_0x0167('0x1b')](_0x18e3fb)[_0x0167('0x14')](function(_0x35ed6a){_0xc3f9fe(null,_0x35ed6a?_0x35ed6a[_0x0167('0x1c')]:![]);})[_0x0167('0x16')](function(_0x8645e7){_0xc3f9fe(_0x8645e7);});};AGIVertices['prototype'][_0x0167('0x1d')]=function(_0xa9ae2d,_0x2375ff){this['rpc'][_0x0167('0x1e')](_0xa9ae2d)[_0x0167('0x14')](function(_0x43d6bc){_0x2375ff(null,_0x43d6bc?_0x43d6bc[_0x0167('0x15')]:![]);})['catch'](function(_0x38e811){_0x2375ff(_0x38e811);});};AGIVertices['prototype'][_0x0167('0x1f')]=function(_0x20feab,_0x36ffc7){this[_0x0167('0xf')][_0x0167('0x20')](_0x20feab)[_0x0167('0x14')](function(_0x31c5eb){_0x36ffc7(null,_0x31c5eb?_0x31c5eb['name']:![]);})[_0x0167('0x16')](function(_0x436865){_0x36ffc7(_0x436865);});};AGIVertices[_0x0167('0x11')]['getSound']=function(_0x11728b,_0x12e14a){var _0x4d612f=this;this[_0x0167('0xf')][_0x0167('0x21')](_0x11728b)['then'](function(_0x31bbdc){_0x12e14a(null,_0x31bbdc?_0x4d612f[_0x0167('0x22')](_0x31bbdc[_0x0167('0x23')]):![]);})['catch'](function(_0x210a3d){_0x12e14a(_0x210a3d);});};AGIVertices[_0x0167('0x11')]['getMailAccount']=function(_0x57c1e6,_0x3eba87){this[_0x0167('0xf')][_0x0167('0x24')](_0x57c1e6)[_0x0167('0x14')](function(_0x52414e){_0x3eba87(null,_0x52414e?_0x52414e:![]);})['catch'](function(_0x3d6506){_0x3eba87(_0x3d6506);});};AGIVertices['prototype']['sendMailMessage']=function(_0x4a4b87,_0x10fd32,_0x178803){this[_0x0167('0x10')][_0x0167('0x25')](_0x4a4b87,_0x10fd32)[_0x0167('0x14')](function(){_0x178803(null);})[_0x0167('0x16')](function(_0x487322){_0x178803(_0x487322);});};AGIVertices['prototype'][_0x0167('0x26')]=function(_0x168c09,_0x37c380){this[_0x0167('0xf')][_0x0167('0x27')](_0x168c09)[_0x0167('0x14')](function(_0x568fc2){if(_0x568fc2){if(_0x568fc2[_0x0167('0x28')]){_0x37c380(null,[_0x568fc2['interval']]);}else{_0x37c380(null,_['map'](_0x568fc2[_0x0167('0x29')],_0x0167('0x2a')));}}else{_0x37c380(null,![]);}})[_0x0167('0x16')](function(_0x4dfcd7){_0x37c380(_0x4dfcd7);});};AGIVertices[_0x0167('0x11')][_0x0167('0x22')]=function(_0x163f29){return util[_0x0167('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x163f29);};AGIVertices[_0x0167('0x11')][_0x0167('0x2c')]=function(_0x8c2a97,_0x4fa178,_0x2ba723){odbc[_0x0167('0x2d')](_0x8c2a97,function(_0x10498c){if(_0x10498c){logger[_0x0167('0x2e')](_0x0167('0x2f'),_0x10498c);_0x2ba723(_0x10498c);}else{logger['info'](_0x0167('0x30'));odbc[_0x0167('0x31')](_0x4fa178,function(_0x5d0c46,_0x3ca04e){if(_0x5d0c46){logger[_0x0167('0x32')](_0x0167('0x33'),_0x4fa178);_0x2ba723(_0x5d0c46);}else{logger[_0x0167('0x32')](_0x0167('0x34'),_0x4fa178);odbc[_0x0167('0x35')](function(_0x50797c){if(_0x50797c){logger[_0x0167('0x2e')](_0x0167('0x36'),_0x50797c);}_0x2ba723(null,_0x3ca04e);});}});}});};AGIVertices[_0x0167('0x11')][_0x0167('0x37')]=function(_0x49dc4d,_0x42cfe1){this[_0x0167('0xf')]['getSmsAccountById'](_0x49dc4d)[_0x0167('0x14')](function(_0x3c393a){_0x42cfe1(null,_0x3c393a?_0x3c393a:![]);})[_0x0167('0x16')](function(_0x4aec07){_0x42cfe1(_0x4aec07);});};AGIVertices[_0x0167('0x11')][_0x0167('0x38')]=function(_0x2b56d6,_0x1b9ed0){this[_0x0167('0xf')][_0x0167('0x38')](_0x2b56d6)[_0x0167('0x14')](function(_0x24841d){_0x1b9ed0(null,_0x24841d);})['catch'](function(_0x5e1bda){_0x1b9ed0(_0x5e1bda);});};AGIVertices['prototype'][_0x0167('0x39')]=function(_0x237969,_0x31d3da,_0x5c25c1){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x0167('0xe')][_0x0167('0x3a')],'node':_0x237969[_0x0167('0x3b')],'application':_0x237969[_0x0167('0x3c')],'data':_0x31d3da||null,'project_name':this[_0x0167('0xe')][_0x0167('0x3d')],'callerid':this['channel']['callerid']})['then'](function(_0xbc05f4){if(_0x5c25c1){_0x5c25c1(null,_0xbc05f4);}})['catch'](function(_0x117123){if(_0x5c25c1){_0x5c25c1(_0x117123);}});};AGIVertices[_0x0167('0x11')][_0x0167('0x3e')]=function(_0x501393,_0x482eed,_0x46cc2b,_0x11d19d){this[_0x0167('0xf')][_0x0167('0x3e')]({'uniqueid':this[_0x0167('0xe')][_0x0167('0x3a')],'callerid':this[_0x0167('0xe')][_0x0167('0x3f')],'calleridname':this[_0x0167('0xe')][_0x0167('0x40')],'context':this['channel']['context'],'extension':this[_0x0167('0xe')]['extension'],'priority':this[_0x0167('0xe')]['priority'],'accountcode':this[_0x0167('0xe')]['accountcode'],'dnid':this[_0x0167('0xe')][_0x0167('0x41')],'projectName':this['channel']['arg_1'],'saveName':_0x482eed,'filename':_0x501393['file']||_0x482eed,'savePath':_0x46cc2b})[_0x0167('0x14')](function(_0x55aaa0){_0x11d19d(null,_0x55aaa0);})['catch'](function(_0x18d29d){_0x11d19d(_0x18d29d);});};AGIVertices['prototype'][_0x0167('0x42')]=function(_0x362aff,_0xcc30da,_0x5851fe,_0x1d0e86,_0x5d1bbd){this['rpc']['createSquareMessage']({'uniqueid':this[_0x0167('0xe')][_0x0167('0x3a')],'body':_0x362aff,'direction':_0xcc30da,'providerName':_0x5851fe,'providerResponse':_0x1d0e86})[_0x0167('0x14')](function(_0x380880){if(_0x5d1bbd){_0x5d1bbd(null,_0x380880);}})[_0x0167('0x16')](function(_0x571c79){if(_0x5d1bbd){_0x5d1bbd(_0x571c79);}});};AGIVertices[_0x0167('0x11')][_0x0167('0x43')]=function(_0x2dc644,_0x441b4e){this['rpc']['createCmContact']({'firstName':_[_0x0167('0x44')](_0x2dc644['name'])||_[_0x0167('0x45')](_0x2dc644[_0x0167('0x15')])?_0x0167('0x46')+Math[_0x0167('0x47')]():_0x2dc644[_0x0167('0x15')],'lastName':_[_0x0167('0x44')](_0x2dc644[_0x0167('0x48')])||_[_0x0167('0x45')](_0x2dc644[_0x0167('0x48')])?null:_0x2dc644[_0x0167('0x48')],'phone':_0x2dc644['phone'],'ListId':_0x2dc644['list_id'],'scheduledat':_0x2dc644[_0x0167('0x49')],'callbackUniqueid':this['channel'][_0x0167('0x3a')],'tags':_0x0167('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x2dc644[_0x0167('0x49')][_0x0167('0x4b')](),'priority':_0x2dc644['callback_priority']})[_0x0167('0x14')](function(_0x47301e){_0x441b4e(null,_0x47301e);})[_0x0167('0x16')](function(_0xc0da7b){_0x441b4e(_0xc0da7b);});};AGIVertices['prototype'][_0x0167('0x4c')]=function(_0x2d6f1a,_0x41abf4){this['rpc'][_0x0167('0x4d')](_0x2d6f1a)[_0x0167('0x14')](function(_0x423af6){_0x41abf4(null,_0x423af6?_0x423af6[_0x0167('0x15')]:![]);})[_0x0167('0x16')](function(_0x217014){_0x41abf4(_0x217014);});};AGIVertices[_0x0167('0x11')][_0x0167('0x4e')]=function(_0x2a850d,_0x4d11e3,_0x2a34c0){var _0x4535a0={'role':_0x0167('0x4f')};_0x4535a0[_0x2a850d]=this[_0x0167('0xe')][_0x0167('0x3f')];this[_0x0167('0xf')]['agentPause'](_0x4535a0,_0x4d11e3,this[_0x0167('0xe')]['uniqueid'])['then'](function(_0x4c9118){_0x2a34c0(null,_[_0x0167('0x45')](_0x4c9118)?![]:!![]);})[_0x0167('0x16')](function(_0xd04fda){logger[_0x0167('0x2e')](_0xd04fda);_0x2a34c0(null,![]);});};AGIVertices[_0x0167('0x11')]['agentUnpause']=function(_0x20140b,_0x38994f){var _0x48abd1={'role':_0x0167('0x4f')};_0x48abd1[_0x20140b]=this[_0x0167('0xe')][_0x0167('0x3f')];this[_0x0167('0xf')]['agentUnpause'](_0x48abd1)['then'](function(_0x281131){_0x38994f(null,_[_0x0167('0x45')](_0x281131)?![]:!![]);})[_0x0167('0x16')](function(_0x1ad067){logger[_0x0167('0x2e')](_0x1ad067);_0x38994f(null,![]);});};AGIVertices[_0x0167('0x11')][_0x0167('0x50')]=function(_0x1456af,_0x2227ef){var _0x3b5c80={'role':_0x0167('0x4f')};_0x3b5c80[_0x1456af]=this[_0x0167('0xe')][_0x0167('0x3f')];this[_0x0167('0xf')][_0x0167('0x50')](_0x3b5c80)[_0x0167('0x14')](function(_0x346f5c){_0x2227ef(null,_[_0x0167('0x45')](_0x346f5c)?![]:!![]);})['catch'](function(_0x3c4eb4){logger[_0x0167('0x2e')](_0x3c4eb4);_0x2227ef(null,![]);});};AGIVertices['prototype'][_0x0167('0x51')]=function(_0x57050b,_0x36675c){var _0x259437={'role':_0x0167('0x4f')};_0x259437[_0x57050b]=this['channel'][_0x0167('0x3f')];var _0x3e3f53=_0x57050b!='internal'?util[_0x0167('0x2b')]('%s/%s@from-sip/n',_0x0167('0x52'),this['channel'][_0x0167('0x3f')]):undefined;this[_0x0167('0xf')]['agentLogin'](_0x259437,_0x3e3f53)[_0x0167('0x14')](function(_0x27c908){_0x36675c(null,_[_0x0167('0x45')](_0x27c908)?![]:!![]);})[_0x0167('0x16')](function(_0x59ebe0){logger['error'](_0x59ebe0);_0x36675c(null,![]);});};AGIVertices[_0x0167('0x11')][_0x0167('0x53')]=function(_0x184de7,_0x3bb946){sh['exec'](_[_0x0167('0x54')](_0x184de7),function(_0x4efa41,_0x422d22){var _0x589df7=_0x422d22['replace'](/(\r\n|\n|\r)/gm,'');_0x3bb946(null,_0x589df7);});};AGIVertices[_0x0167('0x11')][_0x0167('0x55')]=function(_0x23ec67,_0x474a5b){scripts['googleCloudTTS'](_0x23ec67[_0x0167('0x56')],_0x23ec67[_0x0167('0x57')]||_0x0167('0x58'),_0x23ec67[_0x0167('0x58')],_0x23ec67[_0x0167('0x59')]||_0x0167('0x5a'),_0x23ec67[_0x0167('0x5b')]||_0x0167('0x5c'),_0x23ec67[_0x0167('0x5d')]||'MP3')[_0x0167('0x14')](function(_0x483b55){_0x474a5b(null,_0x483b55);})[_0x0167('0x16')](function(_0x2be30e){_0x474a5b(_0x2be30e);});};AGIVertices['prototype']['googleTTS']=function(_0x4959c2,_0x17e725){scripts[_0x0167('0x5e')](_0x4959c2['text'],_0x4959c2['google_tts_language']||'en',0x1)[_0x0167('0x14')](function(_0x372058){_0x17e725(null,_0x372058);})['catch'](function(_0xa23d61){_0x17e725(_0xa23d61);});};AGIVertices[_0x0167('0x11')][_0x0167('0x5f')]=function(_0x30d32e,_0x426bf4){var _0x3c0bca={'uri':_0x30d32e['url'],'method':_0x30d32e[_0x0167('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x30d32e[_0x0167('0x61')])==='number'&&parseInt(_0x30d32e[_0x0167('0x61')])>=0x1?parseInt(_0x30d32e[_0x0167('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x0167('0x62')]([_0x0167('0x63'),_0x0167('0x64')],_0x3c0bca['method']['toUpperCase']())){try{_0x3c0bca['body']=_0x30d32e[_0x0167('0xa')]?JSON[_0x0167('0x65')](_0x30d32e[_0x0167('0xa')]):{};}catch(_0x12c745){logger[_0x0167('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x12c745);}}try{_0x3c0bca[_0x0167('0x66')]=_0x30d32e[_0x0167('0x9')]?JSON[_0x0167('0x65')](_0x30d32e[_0x0167('0x9')]):{};}catch(_0x605b7d){logger[_0x0167('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x605b7d);}if(_0x30d32e['computedVariables']){try{var _0x1690ff=require(_0x30d32e[_0x0167('0x67')])['sync'](this,_0x3c0bca);_0x3c0bca[_0x0167('0x68')]=Mustache[_0x0167('0x69')](_0x30d32e[_0x0167('0x6a')],_0x1690ff,{},['$$','$$']);if(_0x3c0bca[_0x0167('0x66')]){_0x3c0bca[_0x0167('0x66')]=JSON[_0x0167('0x65')](Mustache[_0x0167('0x69')](JSON[_0x0167('0x6b')](_0x3c0bca['headers']),_0x1690ff,{},['$$','$$']));}if(_0x3c0bca[_0x0167('0x6c')]){_0x3c0bca[_0x0167('0x6c')]=JSON[_0x0167('0x65')](Mustache[_0x0167('0x69')](JSON[_0x0167('0x6b')](_0x3c0bca[_0x0167('0x6c')]),_0x1690ff,{},['$$','$$']));}}catch(_0x344120){logger['error'](_0x0167('0x6d'),_0x344120);}}rp(_0x3c0bca)[_0x0167('0x14')](function(_0x4bf055){var _0x54866e={'statusCode':_0x4bf055[_0x0167('0x6e')]||0xc8,'statusMessage':_0x4bf055[_0x0167('0x6f')]||'OK','headers':_0x4bf055[_0x0167('0x66')]||{},'body':_0x4bf055[_0x0167('0x6c')]||{}};_0x426bf4(null,_0x54866e);})['catch'](function(_0x580b3a){var _0x15e0a5={'statusCode':_0x580b3a['statusCode']||0x1f4,'statusMessage':_0x580b3a['message']||_0x0167('0x70'),'headers':_0x580b3a[_0x0167('0x71')]['headers']||{},'body':_0x580b3a['options'][_0x0167('0x6c')]||{}};_0x426bf4(null,_0x15e0a5);});};AGIVertices['prototype'][_0x0167('0x72')]=function(_0x19adef,_0x9980e3){scripts[_0x0167('0x72')](this[_0x0167('0xe')][_0x0167('0x3a')],_0x19adef[_0x0167('0x73')],_0x19adef[_0x0167('0x58')],_0x19adef[_0x0167('0x74')]||'en')[_0x0167('0x14')](function(_0x71b54b){_0x9980e3(null,_0x71b54b);})['catch'](function(_0x4d0e86){_0x9980e3(_0x4d0e86);});};AGIVertices[_0x0167('0x11')][_0x0167('0x75')]=function(_0x2fb81e,_0x5b0e7b){scripts[_0x0167('0x75')](this[_0x0167('0xe')][_0x0167('0x3a')],_0x2fb81e[_0x0167('0x76')],_0x2fb81e[_0x0167('0x77')],_0x2fb81e[_0x0167('0x78')],_0x2fb81e['text'],_0x2fb81e['dialogflowV2_language']||'en')[_0x0167('0x14')](function(_0x1852dc){_0x5b0e7b(null,_0x1852dc);})[_0x0167('0x16')](function(_0x5d9fb5){_0x5b0e7b(_0x5d9fb5);});};AGIVertices[_0x0167('0x11')][_0x0167('0x79')]=function(_0x253582,_0xd7cf8c){scripts[_0x0167('0x79')](this[_0x0167('0xe')],_0x253582)[_0x0167('0x14')](function(_0x36667e){_0xd7cf8c(null,_0x36667e);})[_0x0167('0x16')](function(_0x5cace1){_0xd7cf8c(_0x5cace1);});};AGIVertices[_0x0167('0x11')][_0x0167('0x7a')]=function(_0x2d8015,_0xf5acbb){scripts[_0x0167('0x7a')](_0x2d8015[_0x0167('0x73')],_0x2d8015[_0x0167('0x58')],_0x2d8015['ispeech_tts_language']||'en-US',_0x2d8015[_0x0167('0x7b')])[_0x0167('0x14')](function(_0x959e64){_0xf5acbb(null,_0x959e64);})['catch'](function(_0x113e79){_0xf5acbb(_0x113e79);});};AGIVertices[_0x0167('0x11')][_0x0167('0x7c')]=function(_0x1d7218,_0x2523e1,_0x55f5a5){scripts[_0x0167('0x7c')](_0x2523e1,_0x1d7218[_0x0167('0x73')],_0x1d7218['ispeech_asr_language']||_0x0167('0x5a'),this['isConfigured'](_0x1d7218['model'])?_0x1d7218[_0x0167('0x7d')]:undefined)[_0x0167('0x14')](function(_0x2c6d1c){_0x55f5a5(null,_0x2c6d1c);})[_0x0167('0x16')](function(_0x4abe54){_0x55f5a5(_0x4abe54);});};AGIVertices[_0x0167('0x11')][_0x0167('0x7e')]=function(_0x4bc65a,_0x2f0481){scripts[_0x0167('0x7e')](_0x4bc65a[_0x0167('0x7f')],_0x4bc65a[_0x0167('0x80')],_0x4bc65a['aws_polly_region'],_0x4bc65a['aws_polly_voice']||_0x0167('0x81'),_0x4bc65a[_0x0167('0x58')],_0x4bc65a[_0x0167('0x82')]||_0x0167('0x58'))[_0x0167('0x14')](function(_0x1674a6){_0x2f0481(null,_0x1674a6);})[_0x0167('0x16')](function(_0x58c8be){_0x2f0481(_0x58c8be);});};AGIVertices[_0x0167('0x11')][_0x0167('0x83')]=function(_0x1c2f11,_0x4a27a2){scripts['awsLex'](this[_0x0167('0xe')]['uniqueid'],_0x1c2f11[_0x0167('0x7f')],_0x1c2f11[_0x0167('0x80')],_0x1c2f11[_0x0167('0x84')],_0x1c2f11[_0x0167('0x58')],_0x1c2f11[_0x0167('0x85')])[_0x0167('0x14')](function(_0x35bfa2){_0x4a27a2(null,_0x35bfa2);})['catch'](function(_0x4444b5){_0x4a27a2(_0x4444b5);});};AGIVertices[_0x0167('0x11')][_0x0167('0x86')]=function(_0x2c7405,_0xa72f07,_0x3a5a57){scripts[_0x0167('0x86')](_0xa72f07,_0x2c7405[_0x0167('0x73')],_0x2c7405['google_asr_language']||_0x0167('0x5a'))['then'](function(_0xada8ba){_0x3a5a57(null,_0xada8ba);})[_0x0167('0x16')](function(_0x1f273c){_0x3a5a57(_0x1f273c);});};AGIVertices[_0x0167('0x11')][_0x0167('0x87')]=function(_0x469007,_0x14aca9,_0x1ecbdb){scripts['tildeASR'](_0x14aca9,_0x469007[_0x0167('0x88')],_0x469007[_0x0167('0x89')],_0x469007[_0x0167('0x68')])[_0x0167('0x14')](function(_0x6809f6){_0x1ecbdb(null,_0x6809f6);})['catch'](function(_0x2c6e8f){_0x1ecbdb(_0x2c6e8f);});};AGIVertices[_0x0167('0x11')][_0x0167('0x8a')]=function(_0x1480f5){var _0x120585=_[_0x0167('0x62')](verticesWithRetry,_0x1480f5[_0x0167('0x3c')])?_0x1480f5:_[_0x0167('0x8b')](_0x1480f5);for(var _0xf8ea93 in _0x120585){if(_0x120585[_0x0167('0x8c')](_0xf8ea93)){if(_0x120585[_0xf8ea93]&&_['isString'](_0x120585[_0xf8ea93])){if(_[_0x0167('0x62')](recursiveMapAttributes,_0xf8ea93)){_0x120585[_0xf8ea93]=this[_0x0167('0x8d')](_0x120585[_0xf8ea93]);}else{_0x120585[_0xf8ea93]=this[_0x0167('0x8e')](_0x120585[_0xf8ea93]);}}}}return _0x120585;};AGIVertices[_0x0167('0x11')][_0x0167('0x8f')]=function(_0x2f2a6f){for(var _0x4072c0 in _0x2f2a6f){if(_0x2f2a6f['hasOwnProperty'](_0x4072c0)){if(_['isPlainObject'](_0x2f2a6f[_0x4072c0])){this[_0x0167('0x8f')](_0x2f2a6f[_0x4072c0]);}else if(_[_0x0167('0x90')](_0x2f2a6f[_0x4072c0])){for(var _0x327bdd=0x0;_0x327bdd<_0x2f2a6f[_0x4072c0][_0x0167('0x91')];_0x327bdd++){this[_0x0167('0x8f')](_0x2f2a6f[_0x4072c0][_0x327bdd]);}}else if(_[_0x0167('0x92')](_0x2f2a6f[_0x4072c0])){_0x2f2a6f[_0x4072c0]=this[_0x0167('0x8e')](_0x2f2a6f[_0x4072c0]);}}}};AGIVertices['prototype'][_0x0167('0x93')]=function(_0x4bfb3c,_0x581911){for(var _0x1d8beb in _0x4bfb3c){if(_0x4bfb3c[_0x0167('0x8c')](_0x1d8beb)){if(_['isPlainObject'](_0x4bfb3c[_0x1d8beb])){if(!_[_0x0167('0x44')](_0x4bfb3c[_0x1d8beb])){this[_0x0167('0x93')](_0x4bfb3c[_0x1d8beb],util[_0x0167('0x2b')](_0x0167('0x94'),_0x581911,_0x1d8beb));}}else if(_[_0x0167('0x90')](_0x4bfb3c[_0x1d8beb])){for(var _0x38f814=0x0;_0x38f814<_0x4bfb3c[_0x1d8beb][_0x0167('0x91')];_0x38f814++){this[_0x0167('0x93')](_0x4bfb3c[_0x1d8beb][_0x38f814],util[_0x0167('0x2b')](_0x0167('0x94'),_0x581911,_0x1d8beb+'['+_0x38f814+']'));}}else{if(!_[_0x0167('0x45')](_0x4bfb3c[_0x1d8beb])){this[_0x0167('0xe')]['setVariable'](util['format']('%s.%s',_0x581911,_0x1d8beb),_0x4bfb3c[_0x1d8beb]);}}}}};AGIVertices[_0x0167('0x11')][_0x0167('0x8d')]=function(_0x263d9c){try{var _0x328220=JSON[_0x0167('0x65')](_0x263d9c);this['recursiveNodeIndex'](_0x328220);return JSON[_0x0167('0x6b')](_0x328220);}catch(_0x17abdd){return this[_0x0167('0x8e')](_0x263d9c);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x4ce98e){var _0x1d78bd=_0x4ce98e[_0x0167('0x95')]('{');for(var _0x3e4bf9=0x1;_0x3e4bf9<_0x1d78bd[_0x0167('0x91')];_0x3e4bf9+=0x1){var _0x4d8974=_0x1d78bd[_0x3e4bf9][_0x0167('0x95')]('}');if(_0x4d8974[_0x0167('0x91')]>0x1){_0x4ce98e=_0x4ce98e[_0x0167('0x96')]('{'+_0x4d8974[0x0]+'}',this[_0x0167('0xe')][_0x0167('0x12')](_0x4d8974[0x0])[_0x0167('0x97')]||_0x4d8974[0x0]);}}if(_0x1d78bd[_0x0167('0x91')]===0x1){return _0x4ce98e[_0x0167('0x4b')]();}return this[_0x0167('0x8e')](_0x4ce98e);};AGIVertices[_0x0167('0x11')]['getAndSetVariable']=function(_0x545914,_0x2ed492){var _0x39a02c=this[_0x0167('0xe')][_0x0167('0x12')](_0x545914);if(_0x39a02c['result']===-0x1){return _0x39a02c;}logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x98'),_0x2ed492,_0x39a02c[_0x0167('0x97')]));return this['channel'][_0x0167('0x99')](_0x2ed492,_0x39a02c[_0x0167('0x97')]);};AGIVertices['prototype'][_0x0167('0x9a')]=function(_0x4aa1de){return _0x4aa1de&&_0x4aa1de!=='0'&&_0x4aa1de!=='-1'&&_0x4aa1de!=='';};AGIVertices[_0x0167('0x11')][_0x0167('0x9b')]=function(_0x3326f5){this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x3326f5,'-');_0x3326f5[_0x0167('0x9d')]=_0x3326f5[_0x0167('0x9b')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0167('0x11')][_0x0167('0x9e')]=function(_0x32bd3c){logger['info'](util[_0x0167('0x2b')](_0x0167('0x9f'),_0x32bd3c[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x32bd3c[_0x0167('0x58')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa1'));}var _0x57f54b='\x22'+_0x32bd3c[_0x0167('0x58')]+'\x22';if(this[_0x0167('0x9a')](_0x32bd3c['options'])){_0x57f54b+=','+_0x32bd3c[_0x0167('0x71')];}var _0x6dd389=this[_0x0167('0xe')][_0x0167('0xa2')](_0x0167('0xa3'),_0x57f54b);if(_0x6dd389[_0x0167('0xa4')]===-0x1){return _0x6dd389;}return this[_0x0167('0xe')]['noop'](util['format'](_0x0167('0xa5'),_0x57f54b));};AGIVertices[_0x0167('0x11')][_0x0167('0xa6')]=function(_0x1f86d7){logger[_0x0167('0x32')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x1f86d7[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x1f86d7[_0x0167('0xa7')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa8'));}var _0x3e2d82=_0x1f86d7[_0x0167('0xa7')];if(this[_0x0167('0x9a')](_0x1f86d7[_0x0167('0x71')])){_0x3e2d82+=','+_0x1f86d7['options'];}var _0x116de3=this[_0x0167('0xe')][_0x0167('0xa2')](_0x0167('0xa9'),_0x3e2d82);if(_0x116de3[_0x0167('0xa4')]===-0x1){return _0x116de3;}var _0x23ee76=this[_0x0167('0xaa')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x23ee76[_0x0167('0xa4')]===-0x1){return _0x23ee76;}var _0x19d414=this[_0x0167('0xaa')](_0x0167('0xab'),'MRCP_RECOG_TRANSCRIPT');if(_0x19d414[_0x0167('0xa4')]===-0x1){return _0x19d414;}var _0x50ba2f=this['getAndSetVariable'](_0x0167('0xac'),'MRCP_RECOG_INSTANCE');if(_0x50ba2f['result']===-0x1){return _0x50ba2f;}return this[_0x0167('0xe')]['noop'](util[_0x0167('0x2b')](_0x0167('0xad'),_0x3e2d82));};AGIVertices[_0x0167('0x11')]['agi']=function(_0x59b0c8){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0xae'),_0x59b0c8[_0x0167('0x3b')]));return this[_0x0167('0xe')]['agi']([_0x59b0c8['command'],_0x59b0c8['args']]);};AGIVertices[_0x0167('0x11')][_0x0167('0xaf')]=function(_0x10de10){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0xb0'),_0x10de10[_0x0167('0x3b')]));if(this[_0x0167('0x9a')](_0x10de10[_0x0167('0x61')])){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0xb1'),_0x10de10['timeout']));var _0x22a5af=this['channel'][_0x0167('0xb2')](_0x10de10[_0x0167('0x61')]);if(_0x22a5af[_0x0167('0xa4')]===-0x1){return _0x22a5af;}}return this[_0x0167('0xe')][_0x0167('0xaf')]();};AGIVertices['prototype'][_0x0167('0x4a')]=function(_0x2887c5){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0xb3'),_0x2887c5[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x2887c5[_0x0167('0xb4')])){return this['channel']['error'](_0x2887c5,_0x0167('0xb5'));}_0x2887c5[_0x0167('0x49')]=moment();if(this['isConfigured'](_0x2887c5[_0x0167('0xb6')])){_0x2887c5[_0x0167('0x49')]=moment()[_0x0167('0xb7')](_0x2887c5[_0x0167('0xb6')],_0x0167('0xb8'));}if(!this[_0x0167('0x9a')](_0x2887c5['callback_priority'])){_0x2887c5[_0x0167('0xb9')]=0x2;}this[_0x0167('0x43')][_0x0167('0x9c')](this,_0x2887c5);return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xba'),_0x2887c5['phone'],_0x2887c5[_0x0167('0xb4')],_0x2887c5[_0x0167('0x49')]));};AGIVertices[_0x0167('0x11')][_0x0167('0xbb')]=function(_0x4fb173){logger[_0x0167('0x32')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4fb173[_0x0167('0x3b')]));var _0x507106=this[_0x0167('0xe')][_0x0167('0xa2')](_0x4fb173[_0x0167('0xbc')],_0x4fb173[_0x0167('0x71')]);if(_0x507106[_0x0167('0xa4')]===-0x1){return _0x507106;}return this['channel'][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xbd'),_0x4fb173[_0x0167('0xbc')],_0x4fb173['options']));};AGIVertices['prototype'][_0x0167('0xbe')]=function(_0x3cdc90){logger['info'](util[_0x0167('0x2b')](_0x0167('0xbf'),_0x3cdc90['label']));if(!this['isConfigured'](_0x3cdc90[_0x0167('0x58')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa1'));}var _0x47133c='\x22'+_0x3cdc90[_0x0167('0x58')]+'\x22';if(this[_0x0167('0x9a')](_0x3cdc90[_0x0167('0x71')])){_0x47133c+=','+_0x3cdc90[_0x0167('0x71')];}var _0x18ad6e=this[_0x0167('0xe')][_0x0167('0xa2')]('MRCPSynth',_0x47133c);if(_0x18ad6e[_0x0167('0xa4')]===-0x1){return _0x18ad6e;}return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x47133c));};AGIVertices[_0x0167('0x11')][_0x0167('0xc0')]=function(_0x3ee306){logger[_0x0167('0x32')](util['format'](_0x0167('0xc1'),_0x3ee306[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x3ee306[_0x0167('0x58')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa1'));}var _0x176cea='\x22'+_0x3ee306[_0x0167('0x58')]+'\x22';if(this['isConfigured'](_0x3ee306['options'])){_0x176cea+=','+_0x3ee306[_0x0167('0x71')];}var _0x5051fb=this[_0x0167('0xe')]['exec']('MRCPSynth',_0x176cea);if(_0x5051fb[_0x0167('0xa4')]===-0x1){return _0x5051fb;}return this[_0x0167('0xe')][_0x0167('0xa0')](util['format'](_0x0167('0xa5'),_0x176cea));};AGIVertices['prototype'][_0x0167('0xc2')]=function(_0x1ab375){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0xc3'),_0x1ab375[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x1ab375[_0x0167('0xa7')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x2c2854=_0x1ab375['grammar'];if(this[_0x0167('0x9a')](_0x1ab375[_0x0167('0x71')])){_0x2c2854+=','+_0x1ab375[_0x0167('0x71')];}var _0xb56509=this[_0x0167('0xe')][_0x0167('0xa2')](_0x0167('0xa9'),_0x2c2854);if(_0xb56509[_0x0167('0xa4')]===-0x1){return _0xb56509;}var _0x2e9d84=this[_0x0167('0xaa')](_0x0167('0xc4'),_0x0167('0xc5'));if(_0x2e9d84[_0x0167('0xa4')]===-0x1){return _0x2e9d84;}var _0x53467a=this[_0x0167('0xaa')]('RECOG_INPUT()',_0x0167('0xc6'));if(_0x53467a['result']===-0x1){return _0x53467a;}var _0x482502=this[_0x0167('0xaa')]('RECOG_INSTANCE()',_0x0167('0xc7'));if(_0x482502[_0x0167('0xa4')]===-0x1){return _0x482502;}return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2c2854));};AGIVertices[_0x0167('0x11')][_0x0167('0xc8')]=function(_0x66847f){logger[_0x0167('0x32')](util[_0x0167('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x66847f[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x66847f[_0x0167('0xa7')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa8'));}var _0x1cf61e=_0x66847f[_0x0167('0xa7')];if(this[_0x0167('0x9a')](_0x66847f[_0x0167('0x71')])){_0x1cf61e+=','+_0x66847f[_0x0167('0x71')];}var _0x3494e0=this[_0x0167('0xe')][_0x0167('0xa2')](_0x0167('0xa9'),_0x1cf61e);if(_0x3494e0[_0x0167('0xa4')]===-0x1){return _0x3494e0;}var _0x551ffa=this['getAndSetVariable']('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x551ffa[_0x0167('0xa4')]===-0x1){return _0x551ffa;}var _0x2d4a72=this['getAndSetVariable'](_0x0167('0xab'),'SESTEK_ASR_TRANSCRIPT');if(_0x2d4a72['result']===-0x1){return _0x2d4a72;}var _0x2f736b=this[_0x0167('0xaa')]('RECOG_INSTANCE()',_0x0167('0xc9'));if(_0x2f736b['result']===-0x1){return _0x2f736b;}return this['channel'][_0x0167('0xa0')](util['format'](_0x0167('0xad'),_0x1cf61e));};AGIVertices[_0x0167('0x11')][_0x0167('0xca')]=function(_0x4062d7){logger[_0x0167('0x32')](util['format'](_0x0167('0xcb'),_0x4062d7[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x4062d7[_0x0167('0xcc')])){return this[_0x0167('0xe')]['error'](_0x4062d7,_0x0167('0xcd'));}var _0xc42211=this[_0x0167('0x1a')][_0x0167('0x9c')](this,_0x4062d7[_0x0167('0xcc')]);if(!_0xc42211){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x4062d7,_0x0167('0xce'));}if(!this['isConfigured'](_0x4062d7[_0x0167('0x31')])){return this['channel'][_0x0167('0x2e')](_0x4062d7,_0x0167('0xcf'));}var _0x351358=_0x4062d7[_0x0167('0x31')][_0x0167('0xd0')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x0167('0xa0')](util['format'](_0x0167('0xd1'),_0x351358));var _0x279738=this[_0x0167('0x2c')][_0x0167('0x9c')](this,_0xc42211,_0x351358);this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x4062d7,_0x351358);if(!this[_0x0167('0x9a')](_0x4062d7[_0x0167('0xd2')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xd3'));}var _0x533b6d=this[_0x0167('0x12')][_0x0167('0x9c')](this,_0x4062d7[_0x0167('0xd2')]);if(!_0x533b6d){return this['channel'][_0x0167('0x2e')](_0x4062d7,_0x0167('0xd4'));}var _0x33d6f7=this;_0x279738[_0x0167('0xd5')](function(_0x2b7974,_0x2ba2bd){Object[_0x0167('0xd6')](_0x2b7974)[_0x0167('0xd5')](function(_0x15b0ab){_0x33d6f7['channel']['setVariable'](util['format']('%s[%s][%s]',_0x533b6d,_0x2ba2bd,_0x15b0ab),_0x2b7974[_0x15b0ab]);});});this['channel'][_0x0167('0x99')](util['format'](_0x0167('0xd7'),_0x533b6d),_0x279738['length']);return this['channel']['noop'](util[_0x0167('0x2b')](_0x0167('0xd8'),_0x533b6d));};AGIVertices['prototype'][_0x0167('0xd9')]=function(_0x148006){logger['debug'](util[_0x0167('0x2b')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x148006[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x148006[_0x0167('0xda')])){return this['channel'][_0x0167('0x2e')](_0x148006,_0x0167('0xdb'));}var _0x3ffc15=this['getUser'][_0x0167('0x9c')](this,_0x148006['sip_id']);if(!_0x3ffc15){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x148006,_0x0167('0xdc'));}var _0x124f1c=this[_0x0167('0xe')][_0x0167('0xa2')](_0x0167('0xdd'),[util[_0x0167('0x2b')](_0x0167('0xde'),_0x3ffc15),_0x148006[_0x0167('0x61')],_0x148006[_0x0167('0xdf')],_0x148006[_0x0167('0x6a')]]);if(_0x124f1c[_0x0167('0xa4')]===-0x1){return _0x124f1c;}return this['channel'][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xe0'),_0x0167('0xdd')));};AGIVertices[_0x0167('0x11')][_0x0167('0xe1')]=function(_0x21876f){logger[_0x0167('0x32')](util[_0x0167('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x21876f[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x21876f[_0x0167('0x73')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xe2'));}if(!this[_0x0167('0x9a')](_0x21876f[_0x0167('0x58')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa1'));}this[_0x0167('0xe')]['bot']=!![];this[_0x0167('0x39')](_0x21876f);this[_0x0167('0x42')](_0x21876f[_0x0167('0x58')],'in','','');this[_0x0167('0xe')][_0x0167('0xa0')](util['format'](_0x0167('0xe3'),_0x21876f['text']));var _0x495679=this['googleDialogflow'][_0x0167('0x9c')](this,_0x21876f);if(_0x495679){for(var _0x29daf9 in _0x495679){if(_0x495679[_0x0167('0x8c')](_0x29daf9)){this[_0x0167('0xe')]['setVariable'](util[_0x0167('0x2b')](_0x0167('0xe4'),_0x29daf9[_0x0167('0xe5')]()),_0x495679[_0x29daf9]);}}this['createSquareMessage'](_0x495679[_0x0167('0xe6')],_0x0167('0xe7'),'dialogflow','');return this['channel'][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xe8'),_0x495679[_0x0167('0xe6')]));}return this[_0x0167('0xe')]['error'](_0x21876f,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x0167('0xe9')]=function(_0xd0e569){logger[_0x0167('0x32')](util[_0x0167('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0xd0e569[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0xd0e569[_0x0167('0x76')])){return this['channel'][_0x0167('0xa0')](_0x0167('0xea'));}if(!this['isConfigured'](_0xd0e569[_0x0167('0x77')])){return this['channel'][_0x0167('0xa0')](_0x0167('0xeb'));}if(!this['isConfigured'](_0xd0e569[_0x0167('0x78')])){return this[_0x0167('0xe')]['noop'](_0x0167('0xec'));}if(!this[_0x0167('0x9a')](_0xd0e569[_0x0167('0xed')])){return this[_0x0167('0xe')]['noop'](_0x0167('0xee'));}if(!this['isConfigured'](_0xd0e569[_0x0167('0x58')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa1'));}this[_0x0167('0xe')]['bot']=!![];this[_0x0167('0x39')](_0xd0e569);this[_0x0167('0x42')](_0xd0e569[_0x0167('0x58')],'in','','');this[_0x0167('0xe')][_0x0167('0xa0')](util['format'](_0x0167('0xef'),_0xd0e569[_0x0167('0x58')]));var _0x4bd0da=this[_0x0167('0x75')][_0x0167('0x9c')](this,_0xd0e569);if(_0x4bd0da){for(var _0x5ec6c1 in _0x4bd0da){if(_0x4bd0da[_0x0167('0x8c')](_0x5ec6c1)){if(_0x5ec6c1!=='providerResponse'){this[_0x0167('0xe')][_0x0167('0x99')](util[_0x0167('0x2b')](_0x0167('0xe4'),_0x5ec6c1[_0x0167('0xe5')]()),_0x4bd0da[_0x5ec6c1]);}}}this[_0x0167('0x42')](_0x4bd0da[_0x0167('0xe6')],_0x0167('0xe7'),_0x0167('0xe9'),_0x4bd0da['providerResponse']);return this['channel']['noop'](util[_0x0167('0x2b')]('DialogflowV2\x20Result\x20%s',_0x4bd0da['speech']));}return this[_0x0167('0xe')][_0x0167('0x2e')](_0xd0e569,_0x0167('0xf0'));};AGIVertices[_0x0167('0x11')][_0x0167('0xf1')]=function(_0xf7ab2f){logger[_0x0167('0x32')](util['format'](_0x0167('0xf2'),_0xf7ab2f[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0xf7ab2f['ndauth_url'])){return this[_0x0167('0xe')]['noop'](_0x0167('0xf3'));}if(!this['isConfigured'](_0xf7ab2f[_0x0167('0xf4')])){return this['channel']['noop'](_0x0167('0xf5'));}if(!this['isConfigured'](_0xf7ab2f[_0x0167('0xf6')])){return this[_0x0167('0xe')]['noop'](_0x0167('0xf7'));}if(!this[_0x0167('0x9a')](_0xf7ab2f[_0x0167('0xf8')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa1'));}this['channel'][_0x0167('0xf9')]=!![];this['createSquareDetailsReport'](_0xf7ab2f);this['createSquareMessage'](_0xf7ab2f[_0x0167('0x58')],'in','','');this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xfa'),_0xf7ab2f[_0x0167('0x58')]));var _0x391e30=this[_0x0167('0x79')][_0x0167('0x9c')](this,_0xf7ab2f);if(_0x391e30){for(var _0x4f17b4 in _0x391e30){if(_0x391e30[_0x0167('0x8c')](_0x4f17b4)){this[_0x0167('0xe')]['setVariable'](util[_0x0167('0x2b')](_0x0167('0xfb'),_0x4f17b4[_0x0167('0xe5')]()),_0x391e30[_0x4f17b4]);}}this[_0x0167('0x42')](_0x391e30[_0x0167('0xe6')],'out','sesteknda','');if(_0x391e30[_0x0167('0xfc')]){this['channel'][_0x0167('0xa0')](util[_0x0167('0x2b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x391e30[_0x0167('0xfc')]));var _0x448b4a=this['channel'][_0x0167('0xfd')](_0x391e30[_0x0167('0xfc')]);try{fs[_0x0167('0xfe')](_0x391e30[_0x0167('0xfc')]+_0x0167('0xff'));}catch(_0x15b0ca){logger[_0x0167('0x2e')](_0x15b0ca);}return _0x448b4a;}else{return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x100'),_0x391e30[_0x0167('0xe6')]));}}return this[_0x0167('0xe')][_0x0167('0x2e')](_0xf7ab2f,_0x0167('0x101'));};AGIVertices[_0x0167('0x11')][_0x0167('0x102')]=function(_0x5ca04b){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x103'),_0x5ca04b[_0x0167('0x3b')]));return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x102'));};AGIVertices[_0x0167('0x11')][_0x0167('0x104')]=function(_0x1be786){logger['info'](util[_0x0167('0x2b')](_0x0167('0x105'),_0x1be786[_0x0167('0x3b')]));var _0x2b22d1='';if(_0x1be786[_0x0167('0x106')]){if(!this['isConfigured'](_0x1be786[_0x0167('0x106')])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x1be786,'no\x20trunk\x20selected');}else{var _0x3983a2=parseInt(_0x1be786[_0x0167('0x106')],0xa);if(isNaN(_0x3983a2)){_0x2b22d1=_0x1be786[_0x0167('0x106')];}else{_0x2b22d1=this[_0x0167('0x1f')][_0x0167('0x9c')](this,_0x1be786[_0x0167('0x106')]);if(!_0x2b22d1){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x1be786,_0x0167('0x107'));}}}}else if(_0x1be786['trunk_name']){_0x2b22d1=_0x1be786[_0x0167('0x108')];}else{return this['channel']['error'](_0x1be786,_0x0167('0x109'));}var _0xd771f0=this[_0x0167('0xe')][_0x0167('0xa2')](_0x0167('0xdd'),[util['format'](_0x0167('0x10a'),_0x2b22d1,_0x1be786[_0x0167('0x10b')]),_0x1be786[_0x0167('0x61')],_0x1be786[_0x0167('0xdf')],_0x1be786[_0x0167('0x6a')]]);if(_0xd771f0[_0x0167('0xa4')]===-0x1){return _0xd771f0;}return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xe0'),_0x0167('0xdd')));};AGIVertices[_0x0167('0x11')][_0x0167('0x10c')]=function(_0x492d5e){logger[_0x0167('0x32')](util[_0x0167('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x492d5e[_0x0167('0x3b')]));return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x10c'));};AGIVertices[_0x0167('0x11')][_0x0167('0xc')]=function(_0x141993){logger['info'](util[_0x0167('0x2b')](_0x0167('0x10d'),_0x141993[_0x0167('0x3b')]));if(_0x141993[_0x0167('0x9d')]===0x0){return this[_0x0167('0x9b')](_0x141993);}_0x141993[_0x0167('0x9d')]-=0x1;if(!this[_0x0167('0x9a')](_0x141993['file_id'])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x141993,_0x0167('0x10e'));}var _0x130ca2=this['getSound']['sync'](this,_0x141993[_0x0167('0x10f')]);if(!_0x130ca2){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x141993,_0x0167('0x110'));}if(!this[_0x0167('0x9a')](_0x141993[_0x0167('0xd2')])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x0167('0xd3'));}var _0x14c165=this[_0x0167('0xe')][_0x0167('0x111')](_0x130ca2,_0x141993['response'],_0x141993[_0x0167('0x112')]);var _0x57353a=_0x14c165[_0x0167('0xa4')]?_0x14c165[_0x0167('0xa4')][_0x0167('0x4b')]():'';logger[_0x0167('0x32')](_0x0167('0x113'),JSON['stringify'](_0x14c165));if(_0x14c165['result']===-0x1){this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x141993,_0x57353a);return _0x14c165;}else if(_0x14c165[_0x0167('0x97')]==='timeout'){_0x14c165['result']=_0x57353a[_0x0167('0x91')]>=parseInt(_0x141993[_0x0167('0x114')])?'x':'i';}else{_0x14c165['result']=_0x57353a['length']>=parseInt(_0x141993[_0x0167('0x114')])&&_0x57353a[_0x0167('0x91')]<=parseInt(_0x141993['maxdigit'])?'x':'i';}var _0x21f637=this[_0x0167('0x12')][_0x0167('0x9c')](this,_0x141993[_0x0167('0xd2')]);if(!_0x21f637){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x141993,_0x0167('0xd4'));}this[_0x0167('0xe')][_0x0167('0x99')](_0x21f637,_0x57353a);if(this[_0x0167('0x9a')](_0x141993[_0x0167('0x115')])){var _0x211be7=parseInt(_0x141993[_0x0167('0x115')],0xa);var _0x82e966=rs['generate']({'charset':'*','length':_0x211be7});var _0x440811=_0x57353a['length'];if(_0x440811>0x0){if(_0x440811>_0x211be7){this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x141993,_0x141993[_0x0167('0x116')]===_0x0167('0x117')?_0x82e966+_0x57353a[_0x0167('0x118')](_0x211be7):_0x57353a[_0x0167('0x118')](0x0,_0x440811-_0x211be7)+_0x82e966);}else{this['createSquareDetailsReport'][_0x0167('0x9c')](this,_0x141993,rs['generate']({'charset':'*','length':_0x440811}));}}else{this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x141993,'');}}else{this['createSquareDetailsReport'][_0x0167('0x9c')](this,_0x141993,_0x57353a);}return _0x14c165;};AGIVertices[_0x0167('0x11')][_0x0167('0xd')]=function(_0x45513c){logger['info'](util[_0x0167('0x2b')](_0x0167('0x119'),_0x45513c['label']));return this[_0x0167('0xc')](_0x45513c);};AGIVertices['prototype'][_0x0167('0x11a')]=function(_0x4699ae){logger[_0x0167('0x32')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4699ae[_0x0167('0x3b')]));this[_0x0167('0x39')]['sync'](this,_0x4699ae,_0x4699ae['goalname']);return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x11b'),_0x4699ae[_0x0167('0x11c')]));};AGIVertices['prototype'][_0x0167('0x11d')]=function(_0x26cad4){logger[_0x0167('0x32')](util['format'](_0x0167('0x11e'),_0x26cad4[_0x0167('0x3b')]));if(!this['isConfigured'](_0x26cad4[_0x0167('0x7f')])||!this['isConfigured'](_0x26cad4[_0x0167('0x80')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x11f'));}if(!this[_0x0167('0x9a')](_0x26cad4['text'])){return this[_0x0167('0xe')][_0x0167('0xa0')]('no\x20text\x20configured');}this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x120'),_0x26cad4[_0x0167('0x58')]));var _0x1edcbb=this[_0x0167('0x7e')]['sync'](this,_0x26cad4);if(_0x1edcbb){this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x1edcbb));var _0x1014e3=this[_0x0167('0xe')][_0x0167('0xfd')](_0x1edcbb);try{fs[_0x0167('0xfe')](_0x1edcbb+_0x0167('0xff'));}catch(_0x143a85){logger[_0x0167('0x2e')](_0x143a85);}return _0x1014e3;}return this[_0x0167('0xe')][_0x0167('0x2e')](_0x26cad4,_0x0167('0x121'));};AGIVertices[_0x0167('0x11')][_0x0167('0x122')]=function(_0x4be1c9){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x123'),_0x4be1c9[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x4be1c9[_0x0167('0x7f')])||!this[_0x0167('0x9a')](_0x4be1c9['aws_secret_access_key'])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x11f'));}if(!this[_0x0167('0x9a')](_0x4be1c9[_0x0167('0x85')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x124'));}if(!this[_0x0167('0x9a')](_0x4be1c9[_0x0167('0x58')])){return this[_0x0167('0xe')]['noop'](_0x0167('0xa1'));}this[_0x0167('0xe')][_0x0167('0xf9')]=!![];this[_0x0167('0x39')](_0x4be1c9);this[_0x0167('0x42')](_0x4be1c9[_0x0167('0x58')],'in','','');this[_0x0167('0xe')]['noop'](util[_0x0167('0x2b')](_0x0167('0x125'),_0x4be1c9[_0x0167('0x58')]));var _0x272dc5=this[_0x0167('0x83')]['sync'](this,_0x4be1c9);if(_0x272dc5){for(var _0x4a63d9 in _0x272dc5){if(_0x272dc5[_0x0167('0x8c')](_0x4a63d9)&&_[_0x0167('0x92')](_0x272dc5[_0x4a63d9])){this[_0x0167('0xe')]['setVariable'](util['format'](_0x0167('0x126'),_0x4a63d9[_0x0167('0xe5')]()),_0x272dc5[_0x4a63d9]);}}if(_[_0x0167('0x45')](_0x272dc5[_0x0167('0x127')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x128'));}else{this['createSquareMessage'](_0x272dc5[_0x0167('0x127')],_0x0167('0xe7'),'amazonlex','');return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x129'),_0x272dc5[_0x0167('0x127')]));}}return this[_0x0167('0xe')][_0x0167('0x2e')](_0x4be1c9,_0x0167('0x12a'));};AGIVertices[_0x0167('0x11')][_0x0167('0x12b')]=function(_0x1c32ad){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x12c'),_0x1c32ad['label'],_0x1c32ad[_0x0167('0x61')]));if(!this['isConfigured'](_0x1c32ad[_0x0167('0x73')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xe2'));}var _0x4af799=_0x0167('0x12d');var _0x443ba7=util[_0x0167('0x2b')](_0x0167('0x12e'),FILES_PATH,rs[_0x0167('0x12f')](0x4));var _0x113e72=util['format'](_0x0167('0x94'),_0x443ba7,_0x4af799);var _0x1d7c34=!![];if(_0x1c32ad['beep']===_0x0167('0x130')){_0x1d7c34=![];}var _0x192f3c=this[_0x0167('0xe')]['recordFile'](_0x443ba7,_0x4af799,_0x1c32ad[_0x0167('0x131')],_0x1c32ad[_0x0167('0x61')],undefined,_0x1d7c34);if(_0x192f3c[_0x0167('0xa4')]!==-0x1){this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x132'),_0x113e72));var _0x2959fc=this[_0x0167('0x86')]['sync'](this,_0x1c32ad,_0x113e72);if(_0x2959fc){for(var _0xa1425f in _0x2959fc){if(_0x2959fc['hasOwnProperty'](_0xa1425f)){this['channel'][_0x0167('0x99')](util[_0x0167('0x2b')](_0x0167('0x133'),_0xa1425f[_0x0167('0xe5')]()),_0x2959fc[_0xa1425f]);}}return this['channel'][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x134'),JSON[_0x0167('0x6b')](_0x2959fc)));}}return _0x192f3c;};AGIVertices['prototype'][_0x0167('0x135')]=function(_0x26953a){logger['info'](util[_0x0167('0x2b')](_0x0167('0x136'),_0x26953a[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x26953a['appid'])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x137'));}if(!this[_0x0167('0x9a')](_0x26953a[_0x0167('0x89')])){return this['channel']['noop'](_0x0167('0x138'));}var _0x2ec6f4=_0x0167('0x12d');var _0x2513a8=util[_0x0167('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x0167('0x12f')](0x4));var _0x1fd92b=util[_0x0167('0x2b')](_0x0167('0x94'),_0x2513a8,_0x2ec6f4);var _0x33ee2c=!![];if(_0x26953a[_0x0167('0x139')]===_0x0167('0x130')){_0x33ee2c=![];}var _0xc61bd6=this[_0x0167('0xe')]['recordFile'](_0x2513a8,_0x2ec6f4,_0x26953a[_0x0167('0x131')],_0x26953a[_0x0167('0x61')],undefined,_0x33ee2c);if(_0xc61bd6['result']!==-0x1){this[_0x0167('0xe')][_0x0167('0xa0')](util['format'](_0x0167('0x13a'),_0x1fd92b));var _0x1c7e01=this[_0x0167('0x87')][_0x0167('0x9c')](this,_0x26953a,_0x1fd92b);if(_0x1c7e01){for(var _0x375828 in _0x1c7e01){if(_0x1c7e01[_0x0167('0x8c')](_0x375828)){this[_0x0167('0xe')][_0x0167('0x99')](util[_0x0167('0x2b')](_0x0167('0x13b'),_0x375828[_0x0167('0xe5')]()),_0x1c7e01[_0x375828]);}}return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x13c'),JSON['stringify'](_0x1c7e01)));}}return _0xc61bd6;};AGIVertices['prototype'][_0x0167('0x13d')]=function(_0x145940){logger[_0x0167('0x32')](util['format'](_0x0167('0x13e'),_0x145940[_0x0167('0x3b')]));return this['channel']['continueAt'](_0x145940[_0x0167('0x13f')],_0x145940[_0x0167('0x140')],_0x145940[_0x0167('0x141')]);};AGIVertices[_0x0167('0x11')]['gotoif']=function(_0x13cc7a){logger['info'](util['format'](_0x0167('0x142'),_0x13cc7a['label']));if(!this[_0x0167('0x9a')](_0x13cc7a[_0x0167('0x143')])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x13cc7a,_0x0167('0x144'));}try{var _0x433c7d=eval(_0x13cc7a[_0x0167('0x143')])?_0x0167('0x145'):'false';this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')]('EVAL\x20CONDITION\x20%s\x20%s',_0x13cc7a[_0x0167('0x143')],_0x433c7d));return{'code':0xc8,'result':_0x433c7d};}catch(_0x3333b5){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x0167('0x11')][_0x0167('0x146')]=function(_0x4b624d){logger[_0x0167('0x32')](util[_0x0167('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x4b624d[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x4b624d[_0x0167('0x147')])){return this['channel'][_0x0167('0x2e')](_0x4b624d,_0x0167('0x148'));}var _0x5a9eda=this[_0x0167('0x26')][_0x0167('0x9c')](this,_0x4b624d[_0x0167('0x147')]);if(!_0x5a9eda){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x4b624d,'no\x20intervals\x20found');}for(var _0x5aa739=0x0;_0x5aa739<_0x5a9eda['length'];_0x5aa739+=0x1){var _0x252d60=this[_0x0167('0xe')]['getVariable'](util[_0x0167('0x2b')](_0x0167('0x149'),_0x5a9eda[_0x5aa739]));if(_0x252d60['result']===-0x1){return _0x252d60;}logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x14a'),_0x5a9eda[_0x5aa739],_0x252d60[_0x0167('0x97')]));if(_0x252d60[_0x0167('0x97')]===_0x0167('0x145')){logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x5a9eda[_0x5aa739],_0x0167('0x145')));this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')]('IFTIME\x20%s\x20%s',_0x5a9eda[_0x5aa739],'true'));return{'code':0xc8,'result':_0x0167('0x145')};}else{logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x14a'),_0x5a9eda[_0x5aa739],_0x0167('0x14b')));this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x14a'),_0x5a9eda[_0x5aa739],_0x0167('0x14b')));}}return{'code':0xc8,'result':_0x0167('0x14b')};};AGIVertices['prototype'][_0x0167('0x14c')]=function(_0x5a26ed){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x14d'),_0x5a26ed[_0x0167('0x3b')]));return this[_0x0167('0xe')][_0x0167('0x14c')]();};AGIVertices[_0x0167('0x11')][_0x0167('0x14e')]=function(_0x179bd0){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x14f'),_0x179bd0[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x179bd0[_0x0167('0x73')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xe2'));}var _0x479fab=_0x0167('0x12d');var _0x31f55d=util['format'](_0x0167('0x12e'),FILES_PATH,rs[_0x0167('0x12f')](0x4));var _0x556f12=util['format'](_0x0167('0x94'),_0x31f55d,_0x479fab);var _0x5c6bc5=!![];if(_0x179bd0[_0x0167('0x139')]===_0x0167('0x130')){_0x5c6bc5=![];}var _0x1e6f41=this[_0x0167('0xe')]['recordFile'](_0x31f55d,_0x479fab,_0x179bd0[_0x0167('0x131')],_0x179bd0['timeout'],undefined,_0x5c6bc5);if(_0x1e6f41[_0x0167('0xa4')]!==-0x1){this[_0x0167('0xe')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x556f12));var _0x3ebc83=this[_0x0167('0x7c')][_0x0167('0x9c')](this,_0x179bd0,_0x556f12);if(_0x3ebc83){for(var _0x14469f in _0x3ebc83){if(_0x3ebc83[_0x0167('0x8c')](_0x14469f)){this[_0x0167('0xe')]['setVariable'](util['format']('ISPEECH_ASR_%s',_0x14469f[_0x0167('0xe5')]()),_0x3ebc83[_0x14469f]);}}return this[_0x0167('0xe')][_0x0167('0xa0')](util['format'](_0x0167('0x150'),JSON[_0x0167('0x6b')](_0x3ebc83)));}}return _0x1e6f41;};AGIVertices[_0x0167('0x11')][_0x0167('0x151')]=function(_0x13d431){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x152'),_0x13d431[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x13d431[_0x0167('0x73')])){return this['channel']['noop'](_0x0167('0xe2'));}if(!this[_0x0167('0x9a')](_0x13d431[_0x0167('0x58')])){return this[_0x0167('0xe')][_0x0167('0xa0')]('no\x20text\x20configured');}this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x153'),_0x13d431['text']));var _0x1b0a6b=this[_0x0167('0x7a')][_0x0167('0x9c')](this,_0x13d431);if(_0x1b0a6b){this['channel'][_0x0167('0xa0')](util['format'](_0x0167('0x154'),_0x1b0a6b));var _0x176bd4=this['channel'][_0x0167('0xfd')](_0x1b0a6b,_0x13d431[_0x0167('0x131')]);try{fs[_0x0167('0xfe')](_0x1b0a6b+_0x0167('0xff'));}catch(_0x49a552){logger[_0x0167('0x2e')](_0x49a552);}return _0x176bd4;}return this['channel'][_0x0167('0x2e')](_0x13d431,_0x0167('0x155'));};AGIVertices[_0x0167('0x11')][_0x0167('0x156')]=function(_0x16f924){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x157'),_0x16f924['label']));if(!this[_0x0167('0x9a')](_0x16f924['findBy'])){return this['channel']['error'](_0x16f924,_0x0167('0x158'));}logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x159'),this['channel'][_0x0167('0x3f')],_0x16f924[_0x0167('0x15a')]));var _0x4e62bd=this[_0x0167('0x51')][_0x0167('0x9c')](this,_0x16f924[_0x0167('0x15a')]);if(_0x4e62bd){logger['info'](util['format'](_0x0167('0x15b'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x16f924['findBy']));this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x15b'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x16f924['findBy']));return{'code':0xc8,'result':_0x0167('0x15c')};}else{logger['info'](util[_0x0167('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0167('0xe')][_0x0167('0x3f')],_0x16f924['findBy']));this['channel'][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x15d'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x16f924['findBy']));return{'code':0xc8,'result':_0x0167('0x15e')};}};AGIVertices[_0x0167('0x11')][_0x0167('0x15f')]=function(_0x528034){logger['info'](util['format'](_0x0167('0x160'),_0x528034[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x528034[_0x0167('0x15a')])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x528034,_0x0167('0x158'));}logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x159'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x528034['findBy']));var _0x477e2f=this[_0x0167('0x50')][_0x0167('0x9c')](this,_0x528034[_0x0167('0x15a')]);if(_0x477e2f){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x15b'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x528034[_0x0167('0x15a')]));this[_0x0167('0xe')]['noop'](util[_0x0167('0x2b')](_0x0167('0x15b'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x528034[_0x0167('0x15a')]));return{'code':0xc8,'result':_0x0167('0x15c')};}else{logger['info'](util[_0x0167('0x2b')](_0x0167('0x15d'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x528034[_0x0167('0x15a')]));this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x15d'),this[_0x0167('0xe')]['callerid'],_0x528034['findBy']));return{'code':0xc8,'result':_0x0167('0x15e')};}};AGIVertices[_0x0167('0x11')]['math']=function(_0x2db8a3){logger['info'](util[_0x0167('0x2b')](_0x0167('0x161'),_0x2db8a3['label']));if(!this[_0x0167('0x9a')](_0x2db8a3[_0x0167('0x162')])){return this[_0x0167('0xe')]['error'](_0x2db8a3,_0x0167('0x163'));}this['channel']['noop'](util[_0x0167('0x2b')]('math\x20%s',_0x2db8a3[_0x0167('0x162')]));var _0x52a892=eval(_0x2db8a3['operation']);if(!this[_0x0167('0x9a')](_0x2db8a3[_0x0167('0xd2')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xd3'));}var _0x3ffbcb=this['getVariable'][_0x0167('0x9c')](this,_0x2db8a3[_0x0167('0xd2')]);if(!_0x3ffbcb){return this[_0x0167('0xe')]['error'](_0x2db8a3,'no\x20variable\x20found');}if(_['isArray'](_0x52a892)){var _0x4c9149=this;_0x52a892[_0x0167('0xd5')](function(_0x5324f1,_0x169f7a){_0x4c9149[_0x0167('0xe')][_0x0167('0x99')](util['format'](_0x0167('0x164'),_0x3ffbcb,_0x169f7a),_0x5324f1);});return this[_0x0167('0xe')]['noop'](util[_0x0167('0x2b')]('variable\x20%s[key]\x20set',_0x3ffbcb));}else{return this[_0x0167('0xe')][_0x0167('0x99')](_0x3ffbcb,_0x52a892);}};AGIVertices[_0x0167('0x11')][_0x0167('0xb')]=function(_0x3fc70c){logger['info'](util[_0x0167('0x2b')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x3fc70c[_0x0167('0x3b')]));if(_0x3fc70c['retry']===0x0){return this[_0x0167('0x9b')](_0x3fc70c);}_0x3fc70c['retry']-=0x1;if(!this['isConfigured'](_0x3fc70c[_0x0167('0x10f')])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x3fc70c,_0x0167('0x10e'));}var _0x142936=this[_0x0167('0x165')][_0x0167('0x9c')](this,_0x3fc70c[_0x0167('0x10f')]);if(!_0x142936){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x3fc70c,_0x0167('0x110'));}var _0x2eba83=this[_0x0167('0xe')][_0x0167('0x111')](_0x142936,_0x3fc70c['response'],_0x3fc70c['digit']);var _0x9d3e5e=_0x2eba83['result'];if(_0x2eba83[_0x0167('0xa4')]===-0x1){this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x3fc70c,'-1');return _0x2eba83;}else if(_0x2eba83[_0x0167('0x97')]===_0x0167('0x61')){_0x2eba83[_0x0167('0xa4')]=_0x2eba83[_0x0167('0xa4')][_0x0167('0x91')]>0x0?_0x2eba83[_0x0167('0xa4')]:'t';}else if(_[_0x0167('0x44')](_0x2eba83[_0x0167('0xa4')])){_0x2eba83['result']='#';_0x9d3e5e='#';}if(!this[_0x0167('0x9a')](_0x3fc70c[_0x0167('0xd2')])){this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xd3'));}else{var _0x4e820a=this['getVariable'][_0x0167('0x9c')](this,_0x3fc70c[_0x0167('0xd2')]);if(!_0x4e820a){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x3fc70c,_0x0167('0xd4'));}this['channel'][_0x0167('0x99')](_0x4e820a,_0x9d3e5e);}this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x3fc70c,_0x9d3e5e);return _0x2eba83;};AGIVertices['prototype'][_0x0167('0xa0')]=function(_0x17af38){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x166'),_0x17af38[_0x0167('0x3b')]));return this[_0x0167('0xe')]['noop'](_0x17af38['output']||_0x17af38[_0x0167('0x3b')]);};AGIVertices[_0x0167('0x11')][_0x0167('0x167')]=function(_0x276df3){logger['info'](util[_0x0167('0x2b')](_0x0167('0x168'),_0x276df3[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x276df3['findBy'])){return this[_0x0167('0xe')]['error'](_0x276df3,_0x0167('0x158'));}logger[_0x0167('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0167('0xe')]['callerid'],_0x276df3[_0x0167('0x15a')]));var _0xcb3e8d=this[_0x0167('0x4c')]['sync'](this,_0x276df3[_0x0167('0x169')]);var _0x130d2e=this[_0x0167('0x4e')]['sync'](this,_0x276df3['findBy'],_0xcb3e8d);if(_0x130d2e){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x15b'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x276df3[_0x0167('0x15a')]));this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x15b'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x276df3[_0x0167('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0167('0x32')](util['format'](_0x0167('0x15d'),this['channel'][_0x0167('0x3f')],_0x276df3[_0x0167('0x15a')]));this[_0x0167('0xe')][_0x0167('0xa0')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0167('0xe')][_0x0167('0x3f')],_0x276df3[_0x0167('0x15a')]));return{'code':0xc8,'result':_0x0167('0x15e')};}};AGIVertices[_0x0167('0x11')][_0x0167('0x16a')]=function(_0x231eb6){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x16b'),_0x231eb6[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x231eb6['file_id'])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x231eb6,_0x0167('0x10e'));}var _0x43ed14=this['getSound']['sync'](this,_0x231eb6[_0x0167('0x10f')]);if(!_0x43ed14){return this[_0x0167('0xe')]['error'](_0x231eb6,_0x0167('0x110'));}var _0x32ff58=this[_0x0167('0xe')][_0x0167('0xa2')](_0x0167('0x16c'),[_0x43ed14,_0x231eb6[_0x0167('0xdf')]]);if(_0x32ff58[_0x0167('0xa4')]===-0x1){return _0x32ff58;}return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xbd'),_0x0167('0x16c'),_0x43ed14));};AGIVertices['prototype']['queue']=function(_0x143ab9){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x16d'),_0x143ab9[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x143ab9[_0x0167('0x16e')])){return this['channel'][_0x0167('0x2e')](_0x143ab9,_0x0167('0x16f'));}var _0x174943='';var _0x45ecc3=parseInt(_0x143ab9['queue_id'],0xa);if(isNaN(_0x45ecc3)){_0x174943=_0x143ab9[_0x0167('0x16e')];}else{_0x174943=this['getVoiceQueue'][_0x0167('0x9c')](this,_0x143ab9[_0x0167('0x16e')]);if(!_0x174943){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x143ab9,_0x0167('0x170'));}}var _0x282635='';if(this['isConfigured'](_0x143ab9[_0x0167('0x10f')])){var _0x3630b8=this['getSound']['sync'](this,_0x143ab9[_0x0167('0x10f')]);if(_0x3630b8){_0x282635=_0x3630b8;}}this['createSquareDetailsReport'][_0x0167('0x9c')](this,_0x143ab9,_0x174943);if(_0x143ab9[_0x0167('0xdf')][_0x0167('0x171')]('x')<0x0){_0x143ab9['opts']+='x';}if(_0x143ab9[_0x0167('0xdf')][_0x0167('0x171')]('X')<0x0){_0x143ab9[_0x0167('0xdf')]+='X';}this[_0x0167('0xe')][_0x0167('0x99')](_0x0167('0x172'),_0x174943?_0x174943['toLowerCase']():'');var _0x3f22c2=this['channel']['exec'](_0x0167('0x173'),[_0x174943,_0x143ab9['opts'],_0x143ab9[_0x0167('0x6a')],_0x282635,_0x143ab9['timeout'],_0x143ab9['agi'],_0x143ab9[_0x0167('0x174')],_0x143ab9[_0x0167('0x175')],'',_0x143ab9[_0x0167('0x176')]]);if(_0x3f22c2[_0x0167('0xa4')]===-0x1){return _0x3f22c2;}return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xbd'),'QUEUE',_0x174943));};AGIVertices['prototype'][_0x0167('0x177')]=function(_0x4566f4){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x178'),_0x4566f4[_0x0167('0x3b')]));var _0x2a8c85=_0x4566f4[_0x0167('0x179')]||_0x0167('0x12d');var _0x21fc6d=util['format']('%s_%s',this[_0x0167('0xe')]['uniqueid'],rs[_0x0167('0x12f')](0x5));var _0x2d6d2b=util['format'](_0x0167('0x17a'),FILES_PATH,_0x21fc6d,_0x2a8c85);var _0x28a961=util[_0x0167('0x2b')](_0x0167('0x12e'),FILES_PATH,_0x21fc6d);this['createSquareRecording']['sync'](this,_0x4566f4,_0x21fc6d,_0x2d6d2b);this[_0x0167('0xe')]['setVariable'](_0x0167('0x17b'),_0x21fc6d);logger[_0x0167('0x32')](_0x0167('0x17c'),_0x28a961,_0x2a8c85,_0x4566f4[_0x0167('0x17d')],_0x4566f4[_0x0167('0x61')]);return this[_0x0167('0xe')][_0x0167('0x17e')](_0x28a961,_0x2a8c85,_0x4566f4[_0x0167('0x17d')],_0x4566f4[_0x0167('0x61')],undefined,!![]);};AGIVertices[_0x0167('0x11')][_0x0167('0x17f')]=function(_0xe2e74d){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x180'),_0xe2e74d[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0xe2e74d['url'])){return this['channel'][_0x0167('0xa0')](_0x0167('0x181'));}var _0x2f9096=this['restAPI'][_0x0167('0x9c')](this,_0xe2e74d);logger['info'](util[_0x0167('0x2b')](_0x0167('0x182'),util['inspect'](_0x2f9096,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xe2e74d[_0x0167('0xd2')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x183'));}var _0x2aec70=this['getVariable']['sync'](this,_0xe2e74d['variable_id']);if(!_0x2aec70){return this[_0x0167('0xe')][_0x0167('0x2e')](_0xe2e74d,_0x0167('0xd4'));}this[_0x0167('0xe')][_0x0167('0x99')](util[_0x0167('0x2b')](_0x0167('0x184'),_0x2aec70),_0x2f9096[_0x0167('0x6e')]?_0x2f9096[_0x0167('0x6e')]:_0x0167('0x185'));this[_0x0167('0xe')][_0x0167('0x99')](util[_0x0167('0x2b')]('%s_STATUS_MESSAGE',_0x2aec70),_0x2f9096[_0x0167('0x6f')]?_0x2f9096[_0x0167('0x6f')]:'OK');if(_0x2f9096[_0x0167('0x6c')]){try{this['saveRestApiResult'](_0x2f9096[_0x0167('0x6c')],_0x2aec70);}catch(_0x95801b){logger[_0x0167('0x2e')](util[_0x0167('0x2b')](_0x0167('0x186'),_0x2aec70));}}return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0xd8'),_0x2aec70));};AGIVertices[_0x0167('0x11')][_0x0167('0x187')]=function(_0x2f28c2){logger['info'](util[_0x0167('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2f28c2['label']));return this[_0x0167('0xe')][_0x0167('0x188')](_0x2f28c2[_0x0167('0x189')][_0x0167('0xd0')](/\s+/g,''),_0x2f28c2[_0x0167('0x17d')]);};AGIVertices['prototype'][_0x0167('0x18a')]=function(_0x2de083){logger[_0x0167('0x32')](util['format'](_0x0167('0x18b'),_0x2de083[_0x0167('0x3b')]));return this['channel'][_0x0167('0x18c')](_0x2de083['number'][_0x0167('0xd0')](/\s+/g,''),_0x2de083[_0x0167('0x17d')]);};AGIVertices['prototype'][_0x0167('0x18d')]=function(_0x358a65){logger[_0x0167('0x32')](util['format'](_0x0167('0x18e'),_0x358a65['label']));return this[_0x0167('0xe')][_0x0167('0x18f')](_0x358a65[_0x0167('0x58')],_0x358a65['escape_digits']);};AGIVertices[_0x0167('0x11')][_0x0167('0x190')]=function(_0x470ef7){logger[_0x0167('0x32')](util['format'](_0x0167('0x191'),_0x470ef7[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x470ef7[_0x0167('0x192')])){return this[_0x0167('0xe')]['noop'](_0x0167('0x193'));}var _0x1affb5=this[_0x0167('0x194')]['sync'](this,_0x470ef7[_0x0167('0x192')]);if(!_0x1affb5||!_0x1affb5[_0x0167('0x195')]){return this[_0x0167('0xe')]['error'](_0x470ef7,'no\x20mail\x20account\x20found');}var _0xd44cb8={'from':util[_0x0167('0x2b')]('\x22%s\x22\x20<%s>',_0x1affb5[_0x0167('0x15')],_0x1affb5[_0x0167('0x196')]||_0x1affb5[_0x0167('0x195')][_0x0167('0x197')]),'to':_0x470ef7['to']||'','cc':_0x470ef7['cc']||'','bcc':_0x470ef7['bcc']||'','subject':_0x470ef7[_0x0167('0x198')],'html':_0x470ef7[_0x0167('0x58')],'text':_0x470ef7['text']};if(this[_0x0167('0x9a')](_0x470ef7[_0x0167('0x199')])){}logger[_0x0167('0x19a')](_0x0167('0x19b'),JSON[_0x0167('0x6b')](_0xd44cb8));this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x470ef7,_0x470ef7[_0x0167('0x192')]);this[_0x0167('0xe')]['noop'](util[_0x0167('0x2b')](_0x0167('0x19c'),_0x1affb5[_0x0167('0x15')]));this['sendMailMessage'][_0x0167('0x9c')](this,_0x1affb5['smtpOptions'],_0xd44cb8);return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x19d'));};AGIVertices[_0x0167('0x11')][_0x0167('0x19e')]=function(_0x1e0548){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x19f'),_0x1e0548[_0x0167('0x3b')]));return this[_0x0167('0xe')][_0x0167('0xa0')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x0167('0x11')][_0x0167('0x1a0')]=function(_0x2043e4){logger['info'](util[_0x0167('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2043e4[_0x0167('0x3b')]));if(!this['isConfigured'](_0x2043e4[_0x0167('0x1a1')])){return this['channel']['noop']('no\x20sms\x20account\x20configured');}var _0x22aafc=this[_0x0167('0x37')][_0x0167('0x9c')](this,_0x2043e4[_0x0167('0x1a1')]);if(!_0x22aafc){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x2043e4,_0x0167('0x1a2'));}var _0x3cc25d={'body':_0x2043e4[_0x0167('0x1a3')],'phone':_0x2043e4['to']||'','SmsAccountId':_0x22aafc['id']};logger['debug'](_0x0167('0x1a4'),JSON[_0x0167('0x6b')](_0x3cc25d));this['createSquareDetailsReport'][_0x0167('0x9c')](this,_0x2043e4,_0x2043e4[_0x0167('0x1a1')]);this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x1a5'),_0x22aafc[_0x0167('0x15')]));this[_0x0167('0x38')][_0x0167('0x9c')](this,_0x3cc25d);return this['channel'][_0x0167('0xa0')](_0x0167('0x1a6'));};AGIVertices['prototype']['set']=function(_0x15c1b6){logger[_0x0167('0x32')](util[_0x0167('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x15c1b6[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x15c1b6[_0x0167('0xd2')])){return this['channel'][_0x0167('0x2e')](_0x15c1b6,_0x0167('0x1a7'));}var _0x463f8b=this[_0x0167('0x12')][_0x0167('0x9c')](this,_0x15c1b6[_0x0167('0xd2')]);if(!_0x463f8b){return this[_0x0167('0xe')]['error'](_0x15c1b6,'no\x20variable\x20found');}return this[_0x0167('0xe')][_0x0167('0x99')](_0x463f8b,_0x15c1b6[_0x0167('0x1a8')]);};AGIVertices[_0x0167('0x11')][_0x0167('0x1a9')]=function(_0x5898f3){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x1aa'),_0x5898f3['label']));this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x1ab'));var _0x11b1fa=this[_0x0167('0xe')]['getVariable'](_0x0167('0x1ac'));if(!_['isEmpty'](_0x11b1fa[_0x0167('0x97')])){this[_0x0167('0xe')]['uniqueid']=_0x11b1fa[_0x0167('0x97')];}if(_0x5898f3[_0x0167('0xaf')]==='yes'){this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0x1ad'));return this[_0x0167('0xe')][_0x0167('0xaf')]();}return this[_0x0167('0xe')]['noop']('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x10d20e){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x1ae'),_0x10d20e[_0x0167('0x3b')]));if(!this[_0x0167('0x9a')](_0x10d20e['project_id'])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x10d20e,'no\x20subproject\x20selected');}var _0x46a604=this[_0x0167('0x19')][_0x0167('0x9c')](this,_0x10d20e['project_id']);if(!this[_0x0167('0x9a')](_0x46a604)){return this[_0x0167('0xe')]['error'](_0x10d20e,util[_0x0167('0x2b')](_0x0167('0x1af'),_0x10d20e[_0x0167('0x1b0')]));}if(_0x46a604===this['channel'][_0x0167('0x3d')]){return this['channel'][_0x0167('0x2e')](_0x10d20e,_0x0167('0x1b1'));}this[_0x0167('0x39')][_0x0167('0x9c')](this,_0x10d20e,_0x46a604);var _0x3ca093=this[_0x0167('0xe')]['exec'](_0x0167('0x1b2'),util[_0x0167('0x2b')](_0x0167('0x1b3'),config[_0x0167('0x1b4')][_0x0167('0x1b5')]||_0x0167('0x1b6'),_0x46a604,this[_0x0167('0xe')][_0x0167('0x3d')]));if(_0x3ca093[_0x0167('0xa4')]===-0x1){return _0x3ca093;}return this['channel'][_0x0167('0xa0')](util['format'](_0x0167('0xbd'),_0x0167('0x1b2'),_0x46a604));};AGIVertices[_0x0167('0x11')][_0x0167('0x1b7')]=function(_0x69830c){logger[_0x0167('0x32')](util['format'](_0x0167('0x1b8'),_0x69830c[_0x0167('0x3b')]));var _0x2bada1=this['shellCommand'][_0x0167('0x9c')](this,_0x69830c['command']);this['createSquareDetailsReport'][_0x0167('0x9c')](this,_0x69830c,_0x69830c[_0x0167('0x1b9')]);if(this[_0x0167('0x9a')](_0x69830c[_0x0167('0xd2')])){var _0x58deb3=this[_0x0167('0x12')]['sync'](this,_0x69830c[_0x0167('0xd2')]);if(_0x58deb3){this[_0x0167('0xe')][_0x0167('0x99')](_0x58deb3,_0x2bada1);return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x1ba'),_0x69830c[_0x0167('0x1b9')],_0x58deb3));}}return this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x69830c['command']));};AGIVertices[_0x0167('0x11')][_0x0167('0x1bb')]=function(_0x501850){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x1bc'),_0x501850['label']));_0x501850[_0x0167('0x58')]=_0x501850[_0x0167('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0167('0x9a')](_0x501850[_0x0167('0x56')])){return this[_0x0167('0xe')][_0x0167('0xa0')]('no\x20apiKey\x20configured');}if(!this[_0x0167('0x9a')](_0x501850[_0x0167('0x58')])){return this['channel'][_0x0167('0xa0')](_0x0167('0xa1'));}this[_0x0167('0xe')][_0x0167('0xa0')](util['format'](_0x0167('0x1bd'),_0x501850[_0x0167('0x58')]));var _0x399fd6=this['googleCloudTTS'][_0x0167('0x9c')](this,_0x501850);if(_0x399fd6){this[_0x0167('0xe')]['noop'](util[_0x0167('0x2b')](_0x0167('0x1be'),_0x399fd6));var _0x35797b=this[_0x0167('0xe')][_0x0167('0xfd')](_0x399fd6);try{fs[_0x0167('0xfe')](_0x399fd6+_0x0167('0xff'));}catch(_0x47888f){logger[_0x0167('0x2e')](_0x47888f);}return _0x35797b;}return this['channel']['error'](_0x501850,_0x0167('0x1bf'));};AGIVertices[_0x0167('0x11')][_0x0167('0x1c0')]=function(_0x45c38a){logger[_0x0167('0x32')](util[_0x0167('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x45c38a['label']));_0x45c38a[_0x0167('0x58')]=_0x45c38a[_0x0167('0x58')][_0x0167('0xd0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0167('0x9a')](_0x45c38a[_0x0167('0x58')])){return this[_0x0167('0xe')][_0x0167('0xa0')](_0x0167('0xa1'));}this[_0x0167('0xe')][_0x0167('0xa0')](util['format'](_0x0167('0x1c1'),_0x45c38a[_0x0167('0x58')]));var _0x202fdb=this[_0x0167('0x5e')]['sync'](this,_0x45c38a);if(_0x202fdb){this[_0x0167('0xe')][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x1c2'),_0x202fdb));var _0x216573=this[_0x0167('0xe')][_0x0167('0xfd')](_0x202fdb);try{fs[_0x0167('0xfe')](_0x202fdb+_0x0167('0xff'));}catch(_0x5d9067){logger[_0x0167('0x2e')](_0x5d9067);}return _0x216573;}return this[_0x0167('0xe')]['error'](_0x45c38a,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0167('0x11')][_0x0167('0x1c3')]=function(_0x145bd2){logger[_0x0167('0x32')](util[_0x0167('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x145bd2['label']));if(!this[_0x0167('0x9a')](_0x145bd2[_0x0167('0x15a')])){return this[_0x0167('0xe')][_0x0167('0x2e')](_0x145bd2,_0x0167('0x158'));}logger[_0x0167('0x32')](util[_0x0167('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0167('0xe')][_0x0167('0x3f')],_0x145bd2[_0x0167('0x15a')]));var _0x1ed316=this['agentUnpause']['sync'](this,_0x145bd2[_0x0167('0x15a')]);if(_0x1ed316){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x15b'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x145bd2[_0x0167('0x15a')]));this['channel'][_0x0167('0xa0')](util[_0x0167('0x2b')](_0x0167('0x15b'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x145bd2[_0x0167('0x15a')]));return{'code':0xc8,'result':_0x0167('0x15c')};}else{logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x15d'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x145bd2[_0x0167('0x15a')]));this[_0x0167('0xe')]['noop'](util[_0x0167('0x2b')](_0x0167('0x15d'),this[_0x0167('0xe')][_0x0167('0x3f')],_0x145bd2[_0x0167('0x15a')]));return{'code':0xc8,'result':_0x0167('0x15e')};}};AGIVertices['prototype'][_0x0167('0x1c4')]=function(_0x2b01f6){logger[_0x0167('0x32')](util[_0x0167('0x2b')](_0x0167('0x1c5'),_0x2b01f6[_0x0167('0x3b')]));var _0x2b0381=this[_0x0167('0xe')][_0x0167('0xa2')](_0x0167('0x1c6'),[_0x2b01f6[_0x0167('0x1c7')],_0x2b01f6[_0x0167('0x71')]]);if(_0x2b0381[_0x0167('0xa4')]===-0x1){return _0x2b0381;}return this[_0x0167('0xe')][_0x0167('0xa0')](util['format']('Executed\x20command\x20%s\x20%s',_0x0167('0x1c6'),_0x2b01f6[_0x0167('0x1c7')]));};AGIVertices[_0x0167('0x11')][_0x0167('0x1c8')]=function(_0x1596d5){logger['info'](util['format'](_0x0167('0x1c9'),_0x1596d5[_0x0167('0x3b')]));if(!this['isConfigured'](_0x1596d5[_0x0167('0xd2')])){return this[_0x0167('0xe')]['error'](_0x1596d5,'no\x20variable\x20selected');}var _0x5ef334=this[_0x0167('0x12')][_0x0167('0x9c')](this,_0x1596d5[_0x0167('0xd2')]);if(!_0x5ef334){return this[_0x0167('0xe')]['error'](_0x1596d5,_0x0167('0xd4'));}var _0x1bf54d=this['channel'][_0x0167('0x12')](_0x5ef334);return{'code':0xc8,'result':_0x1bf54d[_0x0167('0x97')]?_0x1bf54d[_0x0167('0x97')]:'-'};};String[_0x0167('0x11')][_0x0167('0x96')]=function(_0x29cdc2,_0x5966b5){return this[_0x0167('0x95')](_0x29cdc2)[_0x0167('0x1ca')](_0x5966b5);};module[_0x0167('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index af46693..3a7937f 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 _0x32df=['paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','YYYY-MM-DD\x20HH:mm:ss','updateAcw','finally','message','pauseType','saveUnpause','[ACW][TIMERS]','stringify','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','acw','interface','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available'];(function(_0x26604b,_0x56d4cc){var _0x16276c=function(_0x34ae98){while(--_0x34ae98){_0x26604b['push'](_0x26604b['shift']());}};_0x16276c(++_0x56d4cc);}(_0x32df,0x7d));var _0xf32d=function(_0x397e8d,_0x532637){_0x397e8d=_0x397e8d-0x0;var _0x173a32=_0x32df[_0x397e8d];return _0x173a32;};'use strict';var _=require(_0xf32d('0x0'));var moment=require(_0xf32d('0x1'));var ami=require(_0xf32d('0x2'));var logger=require(_0xf32d('0x3'))('acw');var RpcUser=require(_0xf32d('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x25997f){this[_0xf32d('0x5')]=_0x25997f[_0xf32d('0x5')];this[_0xf32d('0x6')]=_0x25997f[_0xf32d('0x6')];this[_0xf32d('0x7')]=_0x25997f['timers'];this[_0xf32d('0x8')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xf32d('0x9')](this));ami['on'](_0xf32d('0xa'),this[_0xf32d('0xb')][_0xf32d('0x9')](this));ami['on'](_0xf32d('0xc'),this[_0xf32d('0xd')][_0xf32d('0x9')](this));ami['on'](_0xf32d('0xe'),this[_0xf32d('0xf')][_0xf32d('0x9')](this));ami['on'](_0xf32d('0x10'),this[_0xf32d('0x11')][_0xf32d('0x9')](this));ami['on'](_0xf32d('0x12'),this[_0xf32d('0x13')][_0xf32d('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0xf32d('0x14')][_0xf32d('0x9')](this));}function getDiff(_0x2a9dac){var _0x5552ec=moment()[_0xf32d('0x15')](0x0);var _0x145380=moment(_0x2a9dac)[_0xf32d('0x15')](0x0);return _0x5552ec[_0xf32d('0x16')](_0x145380,'seconds');}Acw[_0xf32d('0x17')]['updateAcw']=function(_0x5b82f4,_0x1f56b3){var _0x238ceb=this;var _0x290fd3=getDiff(_0x238ceb[_0xf32d('0x7')][_0x5b82f4][_0xf32d('0x18')]);clearTimeout(_0x238ceb[_0xf32d('0x7')][_0x5b82f4][_0xf32d('0x19')]);_0x238ceb[_0xf32d('0x7')][_0x5b82f4][_0xf32d('0x19')]=![];return RpcVoiceAgentReport[_0xf32d('0x1a')]({'acwtime':_0x290fd3},_0x238ceb['timers'][_0x5b82f4][_0xf32d('0x1b')],_0x5b82f4)[_0xf32d('0x1c')](function(_0x440418){logger[_0xf32d('0x1d')](_0xf32d('0x1e'),_0x1f56b3,_0x290fd3,_0x440418);})[_0xf32d('0x1f')](function(_0x2bf764){logger[_0xf32d('0x20')](_0xf32d('0x21'),_0x1f56b3,_0x2bf764);})['finally'](function(){delete _0x238ceb[_0xf32d('0x7')][_0x5b82f4];});};Acw[_0xf32d('0x17')][_0xf32d('0x22')]=function(_0x28d12d){try{var _0x311b5a=this;var _0x2a11b3=this[_0xf32d('0x8')][_0x28d12d]['interface'];var _0x16dee5=this['channels'][_0x28d12d][_0xf32d('0x23')];var _0x3e9aab=this['voiceQueues'][_0x16dee5];var _0x149968=![];var _0x5690ce=_0xf32d('0x24');if(_0x3e9aab[_0xf32d('0x25')]&&_0x3e9aab[_0xf32d('0x26')][_0xf32d('0x27')]){_0x149968=!![];_0x5690ce=_0x3e9aab[_0xf32d('0x26')][_0xf32d('0x27')];}return ami['Action']({'action':_0xf32d('0x28'),'interface':_0x2a11b3,'paused':!![],'reason':_0x5690ce})['then'](function(){if(_0x311b5a[_0xf32d('0x6')][_0x2a11b3]){return RpcUser[_0xf32d('0x29')](_0x311b5a[_0xf32d('0x6')][_0x2a11b3]['id'])[_0xf32d('0x1c')](function(_0x402635){if(!_0x402635||_0x402635[_0xf32d('0x2a')]){logger[_0xf32d('0x1d')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x28d12d,_0x2a11b3,_0x16dee5);return;}logger['info'](_0xf32d('0x2b'),_0x28d12d,_0x2a11b3,_0x16dee5);var _0x26d8e1=_0x311b5a[_0xf32d('0x8')][_0x28d12d][_0xf32d('0x2c')]&&_0x311b5a['channels'][_0x28d12d][_0xf32d('0x2d')]?_0x311b5a[_0xf32d('0x8')][_0x28d12d]['destlinkedid']:_0x28d12d;return RpcUser['savePause'](_0x311b5a[_0xf32d('0x6')][_0x2a11b3],_0x5690ce,_0x26d8e1)[_0xf32d('0x1c')](function(_0xccbfcd){_0x311b5a[_0xf32d('0x5')][_0x16dee5][_0xf32d('0x2e')]-=0x1;_0x311b5a[_0xf32d('0x5')][_0x16dee5][_0xf32d('0x2f')]+=0x1;return _0xccbfcd;});})[_0xf32d('0x1c')](function(_0x298b6c){if(_0x149968||!_0x298b6c){return;}_0x311b5a[_0xf32d('0x7')][_0x2a11b3]={};logger['info'](_0xf32d('0x30'),_0x28d12d,_0x311b5a[_0xf32d('0x5')][_0x16dee5]['acwTimeout'],_0x2a11b3,_0x16dee5);_0x311b5a['timers'][_0x2a11b3][_0xf32d('0x19')]=setTimeout(_0x311b5a[_0xf32d('0x31')][_0xf32d('0x9')](_0x311b5a,_0x2a11b3),_0x311b5a[_0xf32d('0x5')][_0x16dee5][_0xf32d('0x32')]*0x3e8);_0x311b5a[_0xf32d('0x7')][_0x2a11b3][_0xf32d('0x18')]=moment()['format'](_0xf32d('0x33'));_0x311b5a[_0xf32d('0x7')][_0x2a11b3]['uniqueid']=_0x28d12d;_0x311b5a[_0xf32d('0x7')][_0x2a11b3][_0xf32d('0x23')]=_0x16dee5;_0x311b5a[_0xf32d('0x7')][_0x2a11b3][_0xf32d('0x34')]=_0x311b5a[_0xf32d('0x34')][_0xf32d('0x9')](_0x311b5a,_0x2a11b3,_0x28d12d);});}})[_0xf32d('0x1f')](function(){logger[_0xf32d('0x20')](_0xf32d('0x30'),_0x28d12d,_0x311b5a[_0xf32d('0x5')][_0x16dee5]['acwTimeout'],_0x2a11b3,_0x16dee5);})[_0xf32d('0x35')](function(){delete _0x311b5a[_0xf32d('0x8')][_0x28d12d];});}catch(_0xb7528c){logger['error']('[ACW][START]\x20%s',_0xb7528c[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0x31')]=function(_0x23ce7f){try{var _0x97bc21=this;if(_0x97bc21[_0xf32d('0x7')][_0x23ce7f]){_0x97bc21[_0xf32d('0x7')][_0x23ce7f][_0xf32d('0x19')]=![];var _0x180a81=_0x97bc21[_0xf32d('0x7')][_0x23ce7f]['uniqueid'];var _0x4f3fa9=_0x97bc21[_0xf32d('0x7')][_0x23ce7f]['queue'];var _0x17ebb0=_0x97bc21['voiceQueues'][_0x4f3fa9][_0xf32d('0x32')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x180a81,_0x23ce7f);RpcUser[_0xf32d('0x29')](this[_0xf32d('0x6')][_0x23ce7f]['id'])[_0xf32d('0x1c')](function(_0x49e40a){if(_0x49e40a[_0xf32d('0x37')]==='ACW'){return RpcUser[_0xf32d('0x38')](_0x97bc21['agents'][_0x23ce7f]);}});RpcVoiceAgentReport[_0xf32d('0x1a')]({'acwtime':_0x17ebb0,'agentacw':!![]},_0x180a81,_0x23ce7f)[_0xf32d('0x1c')](function(_0x4d9bfd){logger[_0xf32d('0x1d')](_0xf32d('0x1e'),_0x180a81,_0x17ebb0,_0x4d9bfd);})[_0xf32d('0x1f')](function(_0x1fa995){logger[_0xf32d('0x20')](_0xf32d('0x21'),_0x180a81,_0x1fa995);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x23ce7f);if(_0x97bc21[_0xf32d('0x7')]){logger[_0xf32d('0x1d')](_0xf32d('0x39'),JSON[_0xf32d('0x3a')](_0x97bc21[_0xf32d('0x7')]));}}}catch(_0x223b7a){logger['error']('[ACW][STOP]\x20%s',_0x223b7a['message']);}};Acw[_0xf32d('0x17')][_0xf32d('0x3b')]=function(_0x6b52fb){try{if(this[_0xf32d('0x5')][_0x6b52fb['queue']]&&(this[_0xf32d('0x5')][_0x6b52fb[_0xf32d('0x23')]]['acw']||this[_0xf32d('0x5')][_0x6b52fb[_0xf32d('0x23')]][_0xf32d('0x25')])){if(this['agents'][_0x6b52fb['interface']]){this['channels'][_0x6b52fb[_0xf32d('0x1b')]]={'queue':_0x6b52fb[_0xf32d('0x23')],'interface':_0x6b52fb['interface'],'destlinkedid':_0x6b52fb[_0xf32d('0x2d')]};}}}catch(_0x2c1bf6){logger[_0xf32d('0x20')](_0xf32d('0x3c'),_0x2c1bf6[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0x14')]=function(_0x5c9ff){try{if(this['voiceQueues'][_0x5c9ff[_0xf32d('0x23')]]&&(this[_0xf32d('0x5')][_0x5c9ff[_0xf32d('0x23')]][_0xf32d('0x3d')]||this['voiceQueues'][_0x5c9ff[_0xf32d('0x23')]][_0xf32d('0x25')])){if(this[_0xf32d('0x6')][_0x5c9ff['interface']]){this[_0xf32d('0x8')][_0x5c9ff['uniqueid']]={'queue':_0x5c9ff[_0xf32d('0x23')],'interface':_0x5c9ff[_0xf32d('0x3e')]};}}}catch(_0x403b00){logger[_0xf32d('0x20')]('[ACW][syncAgentConnectPreview]\x20%s',_0x403b00[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0xb')]=function(_0x5aa1c6){try{if(this['channels'][_0x5aa1c6[_0xf32d('0x1b')]]&&_['isUndefined'](this[_0xf32d('0x8')][_0x5aa1c6[_0xf32d('0x1b')]]['attended'])){logger[_0xf32d('0x1d')](_0xf32d('0x3f'),_0x5aa1c6[_0xf32d('0x1b')]);this[_0xf32d('0x22')](_0x5aa1c6[_0xf32d('0x1b')]);}else if(this[_0xf32d('0x8')][_0x5aa1c6[_0xf32d('0x40')]]&&_[_0xf32d('0x41')](this[_0xf32d('0x8')][_0x5aa1c6[_0xf32d('0x40')]][_0xf32d('0x2c')])){logger[_0xf32d('0x1d')](_0xf32d('0x42'),_0x5aa1c6[_0xf32d('0x40')]);this[_0xf32d('0x22')](_0x5aa1c6['linkedid']);}}catch(_0x2c76cb){logger[_0xf32d('0x20')]('[ACW][syncHangupRequest]\x20%s',_0x2c76cb[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0xd')]=function(_0x26e2d8){try{if(this[_0xf32d('0x8')][_0x26e2d8['uniqueid']]&&this[_0xf32d('0x8')][_0x26e2d8[_0xf32d('0x1b')]][_0xf32d('0x2c')]){logger[_0xf32d('0x1d')](_0xf32d('0x43'),_0x26e2d8['uniqueid']);this[_0xf32d('0x22')](_0x26e2d8[_0xf32d('0x1b')]);}else if(this[_0xf32d('0x8')][_0x26e2d8[_0xf32d('0x40')]]&&this['channels'][_0x26e2d8[_0xf32d('0x40')]]['attended']){logger[_0xf32d('0x1d')](_0xf32d('0x44'),_0x26e2d8['linkedid']);this[_0xf32d('0x22')](_0x26e2d8['linkedid']);}}catch(_0x29f0c3){logger['error'](_0xf32d('0x45'),_0x29f0c3[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')]['syncAttendedTransfer']=function(_0xbc646a){try{if(!_['isNil'](this[_0xf32d('0x8')][_0xbc646a['transfereeuniqueid']])){this['startAcw'](_0xbc646a[_0xf32d('0x46')]);if(this['channels'][_0xbc646a[_0xf32d('0x47')]]){this[_0xf32d('0x8')][_0xbc646a['secondtransfereruniqueid']][_0xf32d('0x2c')]=!![];this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x48')]]=this[_0xf32d('0x8')][_0xbc646a['secondtransfereruniqueid']];this[_0xf32d('0x49')](_0xbc646a[_0xf32d('0x47')]);}}else if(!_[_0xf32d('0x4a')](this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x48')]])){this[_0xf32d('0x22')](_0xbc646a[_0xf32d('0x48')]);if(this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x4b')]]){this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x4b')]][_0xf32d('0x2c')]=!![];this[_0xf32d('0x8')][_0xbc646a['transfereeuniqueid']]=this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x4b')]];this[_0xf32d('0x49')](_0xbc646a[_0xf32d('0x4b')]);}}}catch(_0xc08d0d){logger['error'](_0xf32d('0x4c'),_0xc08d0d[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0x13')]=function(_0x233f79){try{if(this[_0xf32d('0x8')][_0x233f79['transfereruniqueid']]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xf32d('0x3a')](_0x233f79['transfereruniqueid']));this[_0xf32d('0x22')](_0x233f79[_0xf32d('0x4d')]);}else if(this[_0xf32d('0x8')][_0x233f79[_0xf32d('0x4e')]]){logger[_0xf32d('0x1d')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xf32d('0x3a')](_0x233f79[_0xf32d('0x4e')]));this[_0xf32d('0x22')](_0x233f79[_0xf32d('0x4e')]);}}catch(_0x5b1bce){logger[_0xf32d('0x20')](_0xf32d('0x4f'),_0x5b1bce[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')]['syncAgentRingNoAnswer']=function(_0xb64208){try{if(this[_0xf32d('0x5')][_0xb64208[_0xf32d('0x23')]]&&this[_0xf32d('0x5')][_0xb64208[_0xf32d('0x23')]][_0xf32d('0x50')]===_0xf32d('0x51')){if(this[_0xf32d('0x6')][_0xb64208[_0xf32d('0x3e')]]){logger[_0xf32d('0x1d')](_0xf32d('0x52'),_0xb64208[_0xf32d('0x1b')],_0xb64208[_0xf32d('0x3e')],_0xb64208['queue']);return RpcUser[_0xf32d('0x53')](this[_0xf32d('0x6')][_0xb64208[_0xf32d('0x3e')]],'Auto-Pause',_0xb64208['uniqueid']);}}}catch(_0x1b1159){logger[_0xf32d('0x20')](_0xf32d('0x54'),_0x1b1159['message']);}};Acw[_0xf32d('0x17')][_0xf32d('0x49')]=function(_0x3b7ebd,_0x1be09a=0x2710){if(this[_0xf32d('0x8')][_0x3b7ebd]){setTimeout(()=>{delete this[_0xf32d('0x8')][_0x3b7ebd];},_0x1be09a);}};module[_0xf32d('0x55')]=Acw; \ No newline at end of file +var _0x5da4=['info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','YYYY-MM-DD\x20HH:mm:ss','error','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','voicePause'];(function(_0x4b7f4a,_0xefb42c){var _0x39a30d=function(_0x4e3865){while(--_0x4e3865){_0x4b7f4a['push'](_0x4b7f4a['shift']());}};_0x39a30d(++_0xefb42c);}(_0x5da4,0x18c));var _0x45da=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5da4[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0x45da('0x0'));var logger=require('../../../config/logger')(_0x45da('0x1'));var RpcUser=require(_0x45da('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x71cc05){this['voiceQueues']=_0x71cc05[_0x45da('0x3')];this['agents']=_0x71cc05[_0x45da('0x4')];this[_0x45da('0x5')]=_0x71cc05[_0x45da('0x5')];this[_0x45da('0x6')]={};ami['on'](_0x45da('0x7'),this[_0x45da('0x8')]['bind'](this));ami['on'](_0x45da('0x9'),this[_0x45da('0xa')][_0x45da('0xb')](this));ami['on'](_0x45da('0xc'),this[_0x45da('0xd')][_0x45da('0xb')](this));ami['on'](_0x45da('0xe'),this[_0x45da('0xf')][_0x45da('0xb')](this));ami['on']('attendedtransfer',this[_0x45da('0x10')][_0x45da('0xb')](this));ami['on'](_0x45da('0x11'),this[_0x45da('0x12')]['bind'](this));ami['on'](_0x45da('0x13'),this[_0x45da('0x14')][_0x45da('0xb')](this));}function getDiff(_0x45a443){var _0x877715=moment()[_0x45da('0x15')](0x0);var _0x3fd438=moment(_0x45a443)[_0x45da('0x15')](0x0);return _0x877715[_0x45da('0x16')](_0x3fd438,'seconds');}Acw[_0x45da('0x17')][_0x45da('0x18')]=function(_0x536dcc,_0x2421c4){var _0x1a7491=this;var _0x4b9ae0=getDiff(_0x1a7491[_0x45da('0x5')][_0x536dcc][_0x45da('0x19')]);clearTimeout(_0x1a7491[_0x45da('0x5')][_0x536dcc][_0x45da('0x1a')]);_0x1a7491[_0x45da('0x5')][_0x536dcc][_0x45da('0x1a')]=![];return RpcVoiceAgentReport[_0x45da('0x1b')]({'acwtime':_0x4b9ae0},_0x1a7491[_0x45da('0x5')][_0x536dcc][_0x45da('0x1c')],_0x536dcc)[_0x45da('0x1d')](function(_0x23e2f5){logger['info'](_0x45da('0x1e'),_0x2421c4,_0x4b9ae0,_0x23e2f5);})[_0x45da('0x1f')](function(_0x274818){logger['error'](_0x45da('0x20'),_0x2421c4,_0x274818);})[_0x45da('0x21')](function(){delete _0x1a7491['timers'][_0x536dcc];});};Acw[_0x45da('0x17')][_0x45da('0x22')]=function(_0x2ab755){try{var _0x9be834=this;var _0x365643=this[_0x45da('0x6')][_0x2ab755][_0x45da('0x23')];var _0x48419b=this['channels'][_0x2ab755][_0x45da('0x24')];var _0x202aab=this[_0x45da('0x3')][_0x48419b];var _0x1e6eee=![];var _0xa78ca7=_0x45da('0x25');if(_0x202aab[_0x45da('0x26')]&&_0x202aab[_0x45da('0x27')][_0x45da('0x28')]){_0x1e6eee=!![];_0xa78ca7=_0x202aab[_0x45da('0x27')][_0x45da('0x28')];}return ami[_0x45da('0x29')]({'action':_0x45da('0x2a'),'interface':_0x365643,'paused':!![],'reason':_0xa78ca7})[_0x45da('0x1d')](function(){if(_0x9be834[_0x45da('0x4')][_0x365643]){return RpcUser['getAgent'](_0x9be834[_0x45da('0x4')][_0x365643]['id'])[_0x45da('0x1d')](function(_0x510d2d){if(!_0x510d2d||_0x510d2d[_0x45da('0x2b')]){logger[_0x45da('0x2c')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2ab755,_0x365643,_0x48419b);return;}logger[_0x45da('0x2c')](_0x45da('0x2d'),_0x2ab755,_0x365643,_0x48419b);var _0x4d1ba6=_0x9be834['channels'][_0x2ab755][_0x45da('0x2e')]&&_0x9be834['channels'][_0x2ab755][_0x45da('0x2f')]?_0x9be834[_0x45da('0x6')][_0x2ab755][_0x45da('0x2f')]:_0x2ab755;return RpcUser['savePause'](_0x9be834[_0x45da('0x4')][_0x365643],_0xa78ca7,_0x4d1ba6)[_0x45da('0x1d')](function(_0x5e4d2a){_0x9be834[_0x45da('0x3')][_0x48419b][_0x45da('0x30')]-=0x1;_0x9be834['voiceQueues'][_0x48419b]['paused']+=0x1;return _0x5e4d2a;});})[_0x45da('0x1d')](function(_0x10114b){if(_0x1e6eee||!_0x10114b){return;}_0x9be834[_0x45da('0x5')][_0x365643]={};logger['info'](_0x45da('0x31'),_0x2ab755,_0x9be834[_0x45da('0x3')][_0x48419b][_0x45da('0x32')],_0x365643,_0x48419b);_0x9be834['timers'][_0x365643][_0x45da('0x1a')]=setTimeout(_0x9be834['stopAcw'][_0x45da('0xb')](_0x9be834,_0x365643),_0x9be834[_0x45da('0x3')][_0x48419b]['acwTimeout']*0x3e8);_0x9be834[_0x45da('0x5')][_0x365643][_0x45da('0x19')]=moment()['format'](_0x45da('0x33'));_0x9be834[_0x45da('0x5')][_0x365643][_0x45da('0x1c')]=_0x2ab755;_0x9be834['timers'][_0x365643]['queue']=_0x48419b;_0x9be834[_0x45da('0x5')][_0x365643]['updateAcw']=_0x9be834[_0x45da('0x18')][_0x45da('0xb')](_0x9be834,_0x365643,_0x2ab755);});}})[_0x45da('0x1f')](function(){logger[_0x45da('0x34')](_0x45da('0x31'),_0x2ab755,_0x9be834[_0x45da('0x3')][_0x48419b]['acwTimeout'],_0x365643,_0x48419b);})[_0x45da('0x21')](function(){delete _0x9be834[_0x45da('0x6')][_0x2ab755];});}catch(_0x5e31d2){logger[_0x45da('0x34')](_0x45da('0x35'),_0x5e31d2[_0x45da('0x36')]);}};Acw[_0x45da('0x17')][_0x45da('0x37')]=function(_0x2016c9){try{var _0xfd7951=this;if(_0xfd7951[_0x45da('0x5')][_0x2016c9]){_0xfd7951['timers'][_0x2016c9][_0x45da('0x1a')]=![];var _0x5f2516=_0xfd7951['timers'][_0x2016c9][_0x45da('0x1c')];var _0x404f2d=_0xfd7951[_0x45da('0x5')][_0x2016c9][_0x45da('0x24')];var _0x518385=_0xfd7951[_0x45da('0x3')][_0x404f2d][_0x45da('0x32')];logger['info'](_0x45da('0x38'),_0x5f2516,_0x2016c9);RpcUser['getAgent'](this['agents'][_0x2016c9]['id'])['then'](function(_0x587007){if(_0x587007[_0x45da('0x39')]===_0x45da('0x25')){return RpcUser[_0x45da('0x3a')](_0xfd7951[_0x45da('0x4')][_0x2016c9]);}});RpcVoiceAgentReport[_0x45da('0x1b')]({'acwtime':_0x518385,'agentacw':!![]},_0x5f2516,_0x2016c9)[_0x45da('0x1d')](function(_0x44dafb){logger[_0x45da('0x2c')](_0x45da('0x1e'),_0x5f2516,_0x518385,_0x44dafb);})[_0x45da('0x1f')](function(_0x1ce6a9){logger[_0x45da('0x34')](_0x45da('0x20'),_0x5f2516,_0x1ce6a9);});}else{logger[_0x45da('0x34')](_0x45da('0x3b'),_0x2016c9);if(_0xfd7951['timers']){logger[_0x45da('0x2c')](_0x45da('0x3c'),JSON[_0x45da('0x3d')](_0xfd7951[_0x45da('0x5')]));}}}catch(_0x12c86c){logger[_0x45da('0x34')](_0x45da('0x3e'),_0x12c86c[_0x45da('0x36')]);}};Acw[_0x45da('0x17')]['syncAgentConnect']=function(_0x4d9554){try{if(this['voiceQueues'][_0x4d9554['queue']]&&(this[_0x45da('0x3')][_0x4d9554[_0x45da('0x24')]]['acw']||this['voiceQueues'][_0x4d9554[_0x45da('0x24')]]['mandatoryDisposition'])){if(this[_0x45da('0x4')][_0x4d9554[_0x45da('0x23')]]){this[_0x45da('0x6')][_0x4d9554[_0x45da('0x1c')]]={'queue':_0x4d9554[_0x45da('0x24')],'interface':_0x4d9554[_0x45da('0x23')],'destlinkedid':_0x4d9554['destlinkedid']};}}}catch(_0x1ae871){logger[_0x45da('0x34')](_0x45da('0x3f'),_0x1ae871[_0x45da('0x36')]);}};Acw[_0x45da('0x17')][_0x45da('0x14')]=function(_0x1733b0){try{if(this['voiceQueues'][_0x1733b0[_0x45da('0x24')]]&&(this[_0x45da('0x3')][_0x1733b0[_0x45da('0x24')]]['acw']||this['voiceQueues'][_0x1733b0[_0x45da('0x24')]][_0x45da('0x26')])){if(this[_0x45da('0x4')][_0x1733b0[_0x45da('0x23')]]){this['channels'][_0x1733b0[_0x45da('0x1c')]]={'queue':_0x1733b0[_0x45da('0x24')],'interface':_0x1733b0[_0x45da('0x23')]};}}}catch(_0x177156){logger[_0x45da('0x34')](_0x45da('0x40'),_0x177156[_0x45da('0x36')]);}};Acw[_0x45da('0x17')][_0x45da('0xa')]=function(_0x1e5d7f){try{if(this['channels'][_0x1e5d7f[_0x45da('0x1c')]]&&_['isUndefined'](this[_0x45da('0x6')][_0x1e5d7f[_0x45da('0x1c')]][_0x45da('0x2e')])){logger[_0x45da('0x2c')]('[%s][HANGUP:UNIQUEID]',_0x1e5d7f[_0x45da('0x1c')]);this['startAcw'](_0x1e5d7f[_0x45da('0x1c')]);}else if(this[_0x45da('0x6')][_0x1e5d7f['linkedid']]&&_[_0x45da('0x41')](this[_0x45da('0x6')][_0x1e5d7f[_0x45da('0x42')]][_0x45da('0x2e')])){logger[_0x45da('0x2c')](_0x45da('0x43'),_0x1e5d7f[_0x45da('0x42')]);this[_0x45da('0x22')](_0x1e5d7f[_0x45da('0x42')]);}}catch(_0x138a6a){logger[_0x45da('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x138a6a[_0x45da('0x36')]);}};Acw[_0x45da('0x17')]['syncHangup']=function(_0x2745c5){try{if(this[_0x45da('0x6')][_0x2745c5[_0x45da('0x1c')]]&&this[_0x45da('0x6')][_0x2745c5[_0x45da('0x1c')]][_0x45da('0x2e')]){logger['info'](_0x45da('0x44'),_0x2745c5['uniqueid']);this['startAcw'](_0x2745c5[_0x45da('0x1c')]);}else if(this['channels'][_0x2745c5[_0x45da('0x42')]]&&this[_0x45da('0x6')][_0x2745c5[_0x45da('0x42')]][_0x45da('0x2e')]){logger[_0x45da('0x2c')](_0x45da('0x45'),_0x2745c5['linkedid']);this[_0x45da('0x22')](_0x2745c5[_0x45da('0x42')]);}}catch(_0x3425a7){logger[_0x45da('0x34')](_0x45da('0x46'),_0x3425a7['message']);}};Acw[_0x45da('0x17')]['syncAttendedTransfer']=function(_0x2e663d){try{if(!_[_0x45da('0x47')](this[_0x45da('0x6')][_0x2e663d[_0x45da('0x48')]])){this[_0x45da('0x22')](_0x2e663d[_0x45da('0x48')]);if(this['channels'][_0x2e663d[_0x45da('0x49')]]){this['channels'][_0x2e663d[_0x45da('0x49')]][_0x45da('0x2e')]=!![];this[_0x45da('0x6')][_0x2e663d['transfertargetuniqueid']]=this[_0x45da('0x6')][_0x2e663d[_0x45da('0x49')]];this[_0x45da('0x4a')](_0x2e663d[_0x45da('0x49')]);}}else if(!_[_0x45da('0x47')](this[_0x45da('0x6')][_0x2e663d[_0x45da('0x4b')]])){this[_0x45da('0x22')](_0x2e663d['transfertargetuniqueid']);if(this[_0x45da('0x6')][_0x2e663d[_0x45da('0x4c')]]){this[_0x45da('0x6')][_0x2e663d[_0x45da('0x4c')]][_0x45da('0x2e')]=!![];this[_0x45da('0x6')][_0x2e663d['transfereeuniqueid']]=this[_0x45da('0x6')][_0x2e663d[_0x45da('0x4c')]];this[_0x45da('0x4a')](_0x2e663d['origtransfereruniqueid']);}}}catch(_0x219c4e){logger[_0x45da('0x34')](_0x45da('0x4d'),_0x219c4e[_0x45da('0x36')]);}};Acw[_0x45da('0x17')][_0x45da('0x12')]=function(_0x30cfd1){try{if(this[_0x45da('0x6')][_0x30cfd1['transfereruniqueid']]){logger[_0x45da('0x2c')](_0x45da('0x4e'),JSON['stringify'](_0x30cfd1[_0x45da('0x4f')]));this[_0x45da('0x22')](_0x30cfd1[_0x45da('0x4f')]);}else if(this[_0x45da('0x6')][_0x30cfd1[_0x45da('0x50')]]){logger[_0x45da('0x2c')](_0x45da('0x51'),JSON['stringify'](_0x30cfd1[_0x45da('0x50')]));this['startAcw'](_0x30cfd1['transfererlinkedid']);}}catch(_0x1fae2c){logger['error'](_0x45da('0x52'),_0x1fae2c[_0x45da('0x36')]);}};Acw[_0x45da('0x17')][_0x45da('0xf')]=function(_0x1fa14a){try{if(this[_0x45da('0x3')][_0x1fa14a[_0x45da('0x24')]]&&this['voiceQueues'][_0x1fa14a[_0x45da('0x24')]]['autopause']===_0x45da('0x53')){if(this[_0x45da('0x4')][_0x1fa14a['interface']]){logger[_0x45da('0x2c')](_0x45da('0x54'),_0x1fa14a[_0x45da('0x1c')],_0x1fa14a[_0x45da('0x23')],_0x1fa14a['queue']);return RpcUser[_0x45da('0x55')](this['agents'][_0x1fa14a[_0x45da('0x23')]],'Auto-Pause',_0x1fa14a[_0x45da('0x1c')]);}}}catch(_0x2fd60d){logger[_0x45da('0x34')](_0x45da('0x56'),_0x2fd60d[_0x45da('0x36')]);}};Acw[_0x45da('0x17')][_0x45da('0x4a')]=function(_0x1a2089,_0x5e6a9b=0x2710){if(this[_0x45da('0x6')][_0x1a2089]){setTimeout(()=>{delete this['channels'][_0x1a2089];},_0x5e6a9b);}};module[_0x45da('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5a6bc3a..6503135 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 _0x6456=['format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','then','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x6456,0x13e));var _0x6645=function(_0x251208,_0x2ff516){_0x251208=_0x251208-0x0;var _0x284965=_0x6456[_0x251208];return _0x284965;};'use strict';var Manager=require(_0x6645('0x0'));var BPromise=require(_0x6645('0x1'));var util=require(_0x6645('0x2'));var logger=require('../../config/logger')(_0x6645('0x3'));var config=require(_0x6645('0x4'));var ami=new Manager(config[_0x6645('0x5')][_0x6645('0x6')],config[_0x6645('0x5')]['ip'],config['asterisk']['username'],config[_0x6645('0x5')][_0x6645('0x7')],!![]);ami[_0x6645('0x8')]();ami[_0x6645('0x9')]=BPromise[_0x6645('0xa')](ami[_0x6645('0xb')]);function error(_0xfcf7e9){logger['error'](util[_0x6645('0xc')](_0x6645('0xd'),config[_0x6645('0x5')][_0x6645('0xe')],config[_0x6645('0x5')]['ip'],config[_0x6645('0x5')][_0x6645('0x6')],util[_0x6645('0xf')](_0xfcf7e9,![],null)));}function close(){logger[_0x6645('0x10')](util[_0x6645('0xc')](_0x6645('0x11'),config[_0x6645('0x5')][_0x6645('0xe')],config[_0x6645('0x5')]['ip'],config[_0x6645('0x5')]['port']));}ami[_0x6645('0x12')]=function(){return function(){return ami[_0x6645('0x9')]({'action':_0x6645('0x13')});};};ami[_0x6645('0x14')]=function(){return function(){return ami[_0x6645('0x9')]({'action':_0x6645('0x15')});};};ami[_0x6645('0x16')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x6645('0x17')]=function(){return function(){return ami[_0x6645('0x9')]({'action':_0x6645('0x18')});};};ami[_0x6645('0x19')]=function(){return function(){return ami[_0x6645('0x9')]({'action':_0x6645('0x1a')});};};function connect(){logger[_0x6645('0x1b')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x6645('0x5')][_0x6645('0xe')],config[_0x6645('0x5')]['ip'],config[_0x6645('0x5')][_0x6645('0x6')]));ami['once']('error',error);ami[_0x6645('0x1c')](_0x6645('0x1d'),close);}ami['on'](_0x6645('0x1e'),connect);ami['on'](_0x6645('0x1f'),function(_0x4682db){logger[_0x6645('0x1b')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x6645('0xe')],config[_0x6645('0x5')]['ip'],config[_0x6645('0x5')][_0x6645('0x6')],util[_0x6645('0xf')](_0x4682db,![],null)));});ami['on']('fullybooted',function(){logger[_0x6645('0x1b')](util[_0x6645('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x6645('0x5')]['username'],config['asterisk']['ip'],config[_0x6645('0x5')][_0x6645('0x6')]));return Promise['resolve']()[_0x6645('0x20')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0x6645('0x20')](ami[_0x6645('0x16')]())['then'](ami[_0x6645('0x17')]())['then'](ami[_0x6645('0x19')]())['catch'](function(_0x3dc1ff){logger['error']('[ami.js][fullybooted]',util[_0x6645('0xf')](_0x3dc1ff,{'showHidden':![],'depth':null}));});});ami[_0x6645('0x1c')](_0x6645('0x10'),error);ami[_0x6645('0x1c')](_0x6645('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0xdcd8=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','Action','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','error','[ami.js][fullybooted]','exports','../../config/logger','ami','../../config/environment','port','asterisk','password','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect'];(function(_0xbaf853,_0x1d4cc7){var _0x54c07e=function(_0x22d461){while(--_0x22d461){_0xbaf853['push'](_0xbaf853['shift']());}};_0x54c07e(++_0x1d4cc7);}(_0xdcd8,0x1dd));var _0x8dcd=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xdcd8[_0x1558ab];return _0x53b64a;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require('util');var logger=require(_0x8dcd('0x0'))(_0x8dcd('0x1'));var config=require(_0x8dcd('0x2'));var ami=new Manager(config['asterisk'][_0x8dcd('0x3')],config[_0x8dcd('0x4')]['ip'],config[_0x8dcd('0x4')]['username'],config[_0x8dcd('0x4')][_0x8dcd('0x5')],!![]);ami[_0x8dcd('0x6')]();ami['Action']=BPromise[_0x8dcd('0x7')](ami[_0x8dcd('0x8')]);function error(_0x306715){logger['error'](util[_0x8dcd('0x9')](_0x8dcd('0xa'),config['asterisk'][_0x8dcd('0xb')],config['asterisk']['ip'],config[_0x8dcd('0x4')][_0x8dcd('0x3')],util[_0x8dcd('0xc')](_0x306715,![],null)));}function close(){logger['error'](util[_0x8dcd('0x9')](_0x8dcd('0xd'),config[_0x8dcd('0x4')][_0x8dcd('0xb')],config['asterisk']['ip'],config['asterisk'][_0x8dcd('0x3')]));}ami[_0x8dcd('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x8dcd('0xf')]=function(){return function(){return ami[_0x8dcd('0x10')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x8dcd('0x11')});};};ami[_0x8dcd('0x12')]=function(){return function(){return ami[_0x8dcd('0x10')]({'action':_0x8dcd('0x13')});};};ami[_0x8dcd('0x14')]=function(){return function(){return ami['Action']({'action':_0x8dcd('0x15')});};};function connect(){logger[_0x8dcd('0x16')](util[_0x8dcd('0x9')](_0x8dcd('0x17'),config[_0x8dcd('0x4')][_0x8dcd('0xb')],config['asterisk']['ip'],config[_0x8dcd('0x4')][_0x8dcd('0x3')]));ami['once']('error',error);ami[_0x8dcd('0x18')](_0x8dcd('0x19'),close);}ami['on']('connect',connect);ami['on'](_0x8dcd('0x1a'),function(_0x2c5728){logger['info'](util[_0x8dcd('0x9')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8dcd('0x4')]['username'],config[_0x8dcd('0x4')]['ip'],config[_0x8dcd('0x4')][_0x8dcd('0x3')],util[_0x8dcd('0xc')](_0x2c5728,![],null)));});ami['on']('fullybooted',function(){logger[_0x8dcd('0x16')](util[_0x8dcd('0x9')](_0x8dcd('0x1b'),config[_0x8dcd('0x4')][_0x8dcd('0xb')],config[_0x8dcd('0x4')]['ip'],config['asterisk'][_0x8dcd('0x3')]));return Promise[_0x8dcd('0x1c')]()[_0x8dcd('0x1d')](ami[_0x8dcd('0xe')]())[_0x8dcd('0x1d')](ami[_0x8dcd('0xf')]())['then'](ami[_0x8dcd('0x1e')]())['then'](ami['actionQueueSummary']())['then'](ami[_0x8dcd('0x14')]())[_0x8dcd('0x1f')](function(_0x25de8c){logger[_0x8dcd('0x20')](_0x8dcd('0x21'),util['inspect'](_0x25de8c,{'showHidden':![],'depth':null}));});});ami[_0x8dcd('0x18')](_0x8dcd('0x20'),error);ami['once'](_0x8dcd('0x19'),close);module[_0x8dcd('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5dbd952..64491d4 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 _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x4a8395,_0x5033fc){var _0x4ddc60=function(_0x2d1cb1){while(--_0x2d1cb1){_0x4a8395['push'](_0x4a8395['shift']());}};_0x4ddc60(++_0x5033fc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x127074,_0x3bd855){var _0x4c9463=function(_0xf337a6){while(--_0xf337a6){_0x127074['push'](_0x127074['shift']());}};_0x4c9463(++_0x3bd855);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5d2f04,_0x1c1fbf){_0x5d2f04=_0x5d2f04-0x0;var _0x1cb04d=_0x9bde[_0x5d2f04];return _0x1cb04d;};'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 96ac1dc..3913fc1 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 _0x9ac2=['syncCampaigns','isIVRCampaign','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','[ifTime][Action]','queue','uniqueId','uniqueid','decrementOriginate','[syncAgentConnect]','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','ivr','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','isNil','agents','stateinterface','locked','queueBooked','idHopper','paused','run','[Catch][Preview][syncQueueStatusComplete]','finally','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','xcally-motion-dialer','dialAMDActive','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','emit','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','value','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','[syncHangup]','AnswerAGI','AGI','[syncHangup2]','[syncAgentComplete]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','ACTIVE','checkDialMethod','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','[syncQueueSummary]','dialPreviewRecallmeReminder','filter','online','reachable','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','undefined','No\x20such\x20channel','[clearZombieChannels]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','setXMDContactVariables','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','talking','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','erlangCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','[checkContactBlack]','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','originated','temp','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','[actionOriginate]','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactLowerLimitOriginate','Contact','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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\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]','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','optionPredictive','startProgressive','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','inspect','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','then','content','true','catch','iftime\x20%s,%s','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','Global:\x20','Timezone:\x20','resetActiveCalls'];(function(_0x588370,_0x4563b9){var _0x1b0dc1=function(_0x2a1689){while(--_0x2a1689){_0x588370['push'](_0x588370['shift']());}};_0x1b0dc1(++_0x4563b9);}(_0x9ac2,0x18b));var _0x29ac=function(_0x5679e5,_0x4e45c9){_0x5679e5=_0x5679e5-0x0;var _0x34a94=_0x9ac2[_0x5679e5];return _0x34a94;};'use strict';var util=require(_0x29ac('0x0'));var _=require(_0x29ac('0x1'));var uuid=require(_0x29ac('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x29ac('0x3'));var utils=require(_0x29ac('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x29ac('0x5'));var config=require(_0x29ac('0x6'));var logger=require(_0x29ac('0x7'))(_0x29ac('0x8'));var loggerBooked=require('../../../config/logger')(_0x29ac('0x9'));var loggerPredictive=require(_0x29ac('0x7'))(_0x29ac('0xa'));var loggerPredictiveCalls=require(_0x29ac('0x7'))(_0x29ac('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x29ac('0xc'));var ami=require(_0x29ac('0xd'));config[_0x29ac('0xe')]=_[_0x29ac('0xf')](config['redis'],{'host':_0x29ac('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x29ac('0x11'));var voiceQueueRt=require(_0x29ac('0x12'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x29ac('0x13'));var Action=require(_0x29ac('0x14'));var History=require(_0x29ac('0x15'));var Final=require('./models/final');var AgentComplete=require(_0x29ac('0x16'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x29ac('0x17'));var ipAgi=process[_0x29ac('0x18')][_0x29ac('0x19')]||_0x29ac('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x29ac('0x1b')][_0x29ac('0x1c')]=function(_0x4a7df2){this['tail']=this[_0x29ac('0x1d')]?this[_0x29ac('0x1d')]['finally'](_0x4a7df2):_0x4a7df2();};function Dialer(_0x12bd8c,_0xd6575a){this[_0x29ac('0x1e')]=new Sequence();this[_0x29ac('0x1f')]=_0xd6575a;this['voiceQueues']=_0x12bd8c[_0x29ac('0x20')];this[_0x29ac('0x21')]=_0x12bd8c['campaigns'];this['agents']=_0x12bd8c['agents'];this[_0x29ac('0x22')]=_0x12bd8c[_0x29ac('0x22')];this[_0x29ac('0x23')]=config[_0x29ac('0x23')]||0x2;this[_0x29ac('0x24')]={};this[_0x29ac('0x25')]={};this['contactsId']={};this['uniqueId']={};this[_0x29ac('0x26')]={};this['startPredictive']={};this[_0x29ac('0x27')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x29ac('0x28')]={};this['queuesSummary']={};ami['on']('agentconnect',this[_0x29ac('0x29')][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x2b'),this[_0x29ac('0x2c')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x29ac('0x2a')](this));ami['on']('agentcomplete',this[_0x29ac('0x2d')][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x2e'),this[_0x29ac('0xc')][_0x29ac('0x2a')](this));ami['on']('custom:queuesummarycomplete',this[_0x29ac('0x2f')]['bind'](this));ami['on']('hangup',this[_0x29ac('0x30')][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x31'),this['syncNewExten'][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x32'),this[_0x29ac('0x33')][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x34'),this[_0x29ac('0x35')][_0x29ac('0x2a')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x29ac('0x2a')](this));this[_0x29ac('0x36')]();this[_0x29ac('0x37')]();RpcSetting[_0x29ac('0x38')]()['then'](function(_0x4a990b){previewRecallmeReminderInterval=_0x4a990b[_0x29ac('0x39')];});}function isNotNull(_0x39230e){return _0x39230e!==null&&!_[_0x29ac('0x3a')](_0x39230e);}function msgResponse(_0x20d618,_0x1ea514,_0x44640c){return{'action':_0x20d618,'response':_0x1ea514,'message':_0x44640c,'stack':_0x44640c};}function emit(_0x5eb861,_0x223052,_0x302303){io['to'](_0x5eb861)['emit'](_0x223052,_0x302303);}function emitOutboundVoiceQueueSummary(_0x19db18){if(_0x19db18[_0x29ac('0x3b')]===_0x29ac('0x3c')){logger[_0x29ac('0x3d')](_0x29ac('0x3e'),util['inspect'](_0x19db18,{'showHidden':![],'depth':null}));emit(util[_0x29ac('0x3f')](_0x29ac('0x40'),_0x19db18[_0x29ac('0x41')]),_0x29ac('0x42'),_0x19db18);}}function checkGetDataPredictive(_0x13655e){if(isNotNull(_0x13655e)&&!_[_0x29ac('0x43')](_0x13655e)){loggerPredictive[_0x29ac('0x44')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x29ac('0x44')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13655e[_0x29ac('0x45')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x46'),_0x13655e[_0x29ac('0x47')]);loggerPredictive['info'](_0x29ac('0x48'),_0x13655e[_0x29ac('0x49')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x4a'),_0x13655e[_0x29ac('0x4b')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x4c'),_0x13655e[_0x29ac('0x4d')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x4e'),_0x13655e[_0x29ac('0x4f')]);loggerPredictive['info'](_0x29ac('0x50'));if(_0x13655e['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x13655e[_0x29ac('0x4f')])&&_0x13655e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x29ac('0x44')](_0x29ac('0x51'));if(!_['isUndefined'](_0x13655e[_0x29ac('0x4d')])&&_0x13655e[_0x29ac('0x4d')]>0x0){return!![];}loggerPredictive[_0x29ac('0x44')](_0x29ac('0x52'));}else{loggerPredictive[_0x29ac('0x44')](_0x29ac('0x53'));}}else{loggerPredictive[_0x29ac('0x44')](_0x29ac('0x54'));}return![];}function mergeDataErlangB(_0x151375){return function(_0xbfc0c7){loggerPredictive['info'](_0x29ac('0x55'));loggerPredictive[_0x29ac('0x44')](_0x29ac('0x56'),_0xbfc0c7['erlangCalls']);loggerPredictive[_0x29ac('0x44')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xbfc0c7[_0x29ac('0x57')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x58'),_0xbfc0c7['erlangAbandonmentRate']);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xbfc0c7['erlangBusyFactor']);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x58'),_0xbfc0c7[_0x29ac('0x59')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x50'));_[_0x29ac('0x5a')](_0x151375,_0xbfc0c7);};}function ifInterval(_0x5bfe7f,_0x255eb0){if(_['isUndefined'](_0x255eb0)){return![];}return utils['getSeconds'](undefined,_0x255eb0)<_0x5bfe7f*0x3c;}function clearPredictiveAttributes(_0x5676f8){if(_0x5676f8[_0x29ac('0x27')]){_0x5676f8[_0x29ac('0x27')]=undefined;loggerPredictive['debug'](_0x5676f8['name'],'startProgressive\x20value\x20cleared');}if(_0x5676f8[_0x29ac('0x5b')]){_0x5676f8[_0x29ac('0x5b')]=undefined;loggerPredictive[_0x29ac('0x3d')](_0x5676f8['name'],_0x29ac('0x5c'));}if(_0x5676f8[_0x29ac('0x5d')]){clearInterval(_0x5676f8[_0x29ac('0x5d')]);_0x5676f8[_0x29ac('0x5d')]=undefined;loggerPredictive['debug'](_0x5676f8['name'],_0x29ac('0x5e'));}}function loggerCatchPredictive(_0x514b20,_0x3e00a7){return function(_0x229341){loggerPredictive[_0x29ac('0x5f')](_0x3e00a7[_0x29ac('0x41')],_0x514b20);loggerPredictive[_0x29ac('0x5f')](_0x229341[_0x29ac('0x60')]);clearPredictiveAttributes(_0x3e00a7);};}function loggerCatch(_0x11c790){return function(_0x3b6557){logger['error'](_0x11c790,util['inspect'](_0x3b6557,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x183ce3){return function(_0x3125ac){if(isNotNull(_0x3125ac)&&isNotNull(_0x3125ac[0x0])){if(_0x3125ac[0x0][_0x29ac('0x61')]>0x0){_0x183ce3['message']=utils['CAMPAIGN_STATUS'][_0x29ac('0x62')];logger[_0x29ac('0x44')](_0x29ac('0x63')+_0x183ce3['name'],_0x3125ac[0x0]['contactsRescheduled'],_0x29ac('0x64'));}else{_0x183ce3[_0x29ac('0x65')]=utils[_0x29ac('0x66')]['NO_AVAILABLE_CONTACTS'];logger[_0x29ac('0x44')](_0x29ac('0x67')+_0x183ce3[_0x29ac('0x41')]);}}};}function createObjHistory(_0x43d128,_0x59778b,_0x2ab1a4,_0x27271f,_0x552105){_0x43d128[_0x29ac('0x65')]=_0x2ab1a4;var _0x17ad91=new Action(_0x43d128,_0x59778b);var _0x56fff1=new History(_0x17ad91);_0x56fff1[_0x29ac('0x68')]=_0x27271f;_0x56fff1[_0x29ac('0x69')]=_0x552105;_0x56fff1[_0x29ac('0x6a')]=_0x17ad91[_0x29ac('0x6b')];return _0x56fff1;}function unlockQueueStatus(_0x49868e,_0xea2ef2){setTimeout(function(){if(_[_0x29ac('0x3a')](_0x49868e[_0x29ac('0x6c')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0xea2ef2);}_0x49868e[_0x29ac('0x6c')]=!![];loggerBooked['info'](_0x29ac('0x6d'),_0xea2ef2,JSON[_0x29ac('0x6e')](_[_0x29ac('0x6f')](_0x49868e,[_0x29ac('0x41'),_0x29ac('0x6c')])));},0x1f3);}function checkInterval(_0x204815){return function(){if(!isNotNull(_0x204815['Interval'])){_0x204815['message']=utils[_0x29ac('0x66')]['NULL_INTERVAL'];throw _0x204815[_0x29ac('0x41')]+_0x29ac('0x70');}if(!isNotNull(_0x204815[_0x29ac('0x71')][_0x29ac('0x72')])){_0x204815[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x73')];throw _0x204815[_0x29ac('0x41')]+_0x29ac('0x70');}if(!isNotNull(_[_0x29ac('0x43')](_0x204815[_0x29ac('0x71')][_0x29ac('0x72')]))){_0x204815[_0x29ac('0x65')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x204815[_0x29ac('0x41')]+_0x29ac('0x70');}};}function checkIsIVRCampaignActive(_0xfffbf9){return function(){if(!utils['isIVRCampaignActive'](_0xfffbf9)){_0xfffbf9[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x74')];throw _0xfffbf9['name']+_0x29ac('0x75');}};}function emitCampaignSummary(_0x155701){if(utils['isIVRCampaign'](_0x155701)){emit(util[_0x29ac('0x3f')]('campaign:ivr:%s',_0x155701['name']),'campaign:save',_0x155701);}}function loggerCatchQueueSummary(_0x2a0576,_0x53dda7){return function(_0x588352){clearPredictiveAttributes(_0x53dda7);emitCampaignSummary(_0x53dda7);loggerSyncQueueSummary[_0x29ac('0x3d')](_0x2a0576,util[_0x29ac('0x76')](_0x588352,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x877783){if(_0x877783['sendMessageOneNotActive']){if(_0x877783['originated']===0x0){_0x877783[_0x29ac('0x77')]=![];_0x877783['message']=utils['CAMPAIGN_STATUS'][_0x29ac('0x74')];loggerSyncQueueSummary['debug'](_0x29ac('0x78'),_0x877783['name'],'is\x20not\x20active');}else{_0x877783[_0x29ac('0x65')]=utils[_0x29ac('0x66')]['DISACTIVED'];loggerSyncQueueSummary[_0x29ac('0x3d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x877783[_0x29ac('0x41')],_0x29ac('0x79'));}emitCampaignSummary(_0x877783);}}function myreject(_0x505119){return function(_0x5f12da){return _0x505119(msgResponse('[ifTime][Action]',_0x29ac('0x7a'),JSON[_0x29ac('0x6e')](_0x5f12da)));};}Dialer[_0x29ac('0x1b')][_0x29ac('0x7b')]=function(_0x32e3d6){return!_[_0x29ac('0x3a')](_0x32e3d6)&&_0x32e3d6&&!_[_0x29ac('0x3a')](_0x32e3d6[_0x29ac('0x41')])&&!_['isUndefined'](_0x32e3d6[_0x29ac('0x7c')])&&_0x32e3d6['active']&&(this[_0x29ac('0x22')][util[_0x29ac('0x3f')](_0x29ac('0x7d'),_0x32e3d6[_0x29ac('0x41')])][_0x29ac('0x7e')]==='reachable'||this[_0x29ac('0x22')][util[_0x29ac('0x3f')](_0x29ac('0x7d'),_0x32e3d6[_0x29ac('0x41')])]['status']===_0x29ac('0x7f'));};Dialer[_0x29ac('0x1b')]['checkIsTrunkReachable']=function(_0x4ed09a){var _0x59ce1b=this;return function(){if(!_0x59ce1b[_0x29ac('0x7b')](_0x4ed09a[_0x29ac('0x80')])){if(!_0x59ce1b['isTrunkReachable'](_0x4ed09a[_0x29ac('0x81')])){_0x4ed09a[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x82')];throw _0x4ed09a[_0x29ac('0x41')]+_0x29ac('0x83');}}};};Dialer[_0x29ac('0x1b')][_0x29ac('0x84')]=function(_0x1f9d52,_0x18e004,_0x18e00b,_0x857352){var _0xb4c957=this;return function(){var _0xd99a0c=!![];return _0xb4c957['ifTimeIvr'](_0x1f9d52,_0x18e004,_0x18e00b,_0x857352,_0xd99a0c);};};Dialer['prototype'][_0x29ac('0x85')]=function(_0x335990,_0x15a577,_0x346124,_0x2942d1){var _0x293eb0=this;return function(){var _0x1feee6=![];return _0x293eb0[_0x29ac('0x86')](_0x335990[_0x29ac('0x72')],_0x15a577,_0x346124,_0x2942d1,_0x1feee6);};};Dialer['prototype'][_0x29ac('0x86')]=function(_0x1c046e,_0xc78ad2,_0x24f28e,_0x440ea6,_0x41ab5a){var _0x551883=[];return new Promise(function(_0xea043b,_0x5e9910){if(!isNotNull(_0x1c046e)){_0x440ea6['message']=utils[_0x29ac('0x66')][_0x29ac('0x73')];return _0x5e9910(msgResponse(_0x29ac('0x87'),_0x29ac('0x88'),_0x24f28e+_0x29ac('0x89')));}if(_[_0x29ac('0x43')](_0x1c046e)){_0x440ea6[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x8a')];return _0x5e9910(msgResponse(_0x29ac('0x87'),'Failure',_0x24f28e+'\x20Intervals\x20is\x20empty\x20'));}if(_0xc78ad2&&_['isUndefined'](config[_0x29ac('0x8b')][_0xc78ad2])){_0x440ea6[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x8c')];return _0x5e9910(msgResponse(_0x29ac('0x87'),_0x29ac('0x88'),_0x24f28e+_0x29ac('0x8d')+_0xc78ad2));}if(_[_0x29ac('0x8e')](_0x1c046e)){for(var _0x44ead7=0x0;_0x44ead7<_0x1c046e[_0x29ac('0x8f')];_0x44ead7+=0x1){_0x551883[_0x29ac('0x90')](ami[_0x29ac('0x91')]({'action':_0x29ac('0x92'),'command':util[_0x29ac('0x3f')]('iftime\x20%s,%s',_0x1c046e[_0x44ead7]['interval'],!_[_0x29ac('0x3a')](config[_0x29ac('0x8b')][_0xc78ad2])?_0xc78ad2:'')})[_0x29ac('0x93')](function(_0x170022){return _0x170022[_0x29ac('0x94')]['indexOf'](_0x29ac('0x95'))>=0x0;})[_0x29ac('0x96')](myreject(_0x5e9910)));}}else{_0x551883['push'](ami[_0x29ac('0x91')]({'action':_0x29ac('0x92'),'command':util['format'](_0x29ac('0x97'),_0x1c046e,!_[_0x29ac('0x3a')](config[_0x29ac('0x8b')][_0xc78ad2])?_0xc78ad2:'')})[_0x29ac('0x93')](function(_0x5e17e0){return _0x5e17e0[_0x29ac('0x94')][_0x29ac('0x98')](_0x29ac('0x95'))>=0x0;})[_0x29ac('0x96')](myreject(_0x5e9910)));}Promise[_0x29ac('0x99')](_0x551883)['then'](function(_0x3f8b90){var _0x108246=_[_0x29ac('0x9a')](_0x3f8b90);if(_0x108246){return _0xea043b(_0x108246);}else{_0x440ea6[_0x29ac('0x65')]=_0x41ab5a?utils['CAMPAIGN_STATUS'][_0x29ac('0x9b')]:utils[_0x29ac('0x66')]['OVERTIME_INTERVAL'];return _0x5e9910(msgResponse('[ifTime][promiseAll]',_0x29ac('0x88'),_0x29ac('0x9c')+_0x41ab5a+'\x20'+_0x24f28e+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x1c046e,{'showHidden':![],'depth':null})+_0x29ac('0x9d')+_0xc78ad2));}})[_0x29ac('0x96')](function(_0x524d6f){return _0x5e9910(msgResponse(_0x29ac('0x87'),_0x29ac('0x88'),JSON[_0x29ac('0x6e')](_0x524d6f)));});});};Dialer[_0x29ac('0x1b')]['loopCampaigns']=function(){var _0x35a4e2=this;return cmHopper[_0x29ac('0x9e')]({'active':![]},{'where':{'active':!![]}})[_0x29ac('0x93')](function(){setInterval(function(){_0x35a4e2[_0x29ac('0x9f')]();},0x3e8);});};Dialer[_0x29ac('0x1b')][_0x29ac('0x9f')]=function(){var _0x1eea20=this;var _0x1f994d;for(var _0x42f4d7 in this[_0x29ac('0x21')]){if(typeof this[_0x29ac('0x21')][_0x42f4d7]!=='undefined'){_0x1f994d=this[_0x29ac('0x21')][_0x42f4d7];if(utils[_0x29ac('0xa0')](_0x1f994d)&&utils[_0x29ac('0xa1')](_0x1f994d)){_0x1f994d[_0x29ac('0x77')]=!![];Promise[_0x29ac('0xa2')]()['then'](checkIsIVRCampaignActive(_0x1f994d))[_0x29ac('0x93')](checkInterval(_0x1f994d))['then'](_0x1eea20['checkIsTrunkReachable'](_0x1f994d))[_0x29ac('0x93')](_0x1eea20['checkIfTime'](_0x1f994d[_0x29ac('0xa3')],_0x1f994d['dialTimezone'],_0x1f994d[_0x29ac('0x41')],_0x1f994d))['then'](_0x1eea20['checkIfTimeIntervals'](_0x1f994d['Interval'],_0x1f994d[_0x29ac('0xa4')],_0x1f994d['name'],_0x1f994d))[_0x29ac('0x93')](_0x1eea20[_0x29ac('0xa5')](_0x1f994d))[_0x29ac('0x96')](loggerCatchQueueSummary(_0x29ac('0xa6'),_0x1f994d));}else{notSendMessagesCampaign(_0x1f994d);}}}};Dialer[_0x29ac('0x1b')]['checkDialMethod']=function(_0x49b876){if(_0x49b876[_0x29ac('0xa7')]!=='predictive'){clearPredictiveAttributes(_0x49b876);}switch(_0x49b876['dialMethod']){case _0x29ac('0xa8'):this[_0x29ac('0xa9')](_0x49b876,0x1);break;case _0x29ac('0xaa'):this[_0x29ac('0xa9')](_0x49b876,_0x49b876[_0x29ac('0xab')]);break;case _0x29ac('0xa'):this['predictive'](_0x49b876);break;case _0x29ac('0x9'):this['handlePower'](_0x49b876,0x1);break;default:logger[_0x29ac('0x5f')](_0x29ac('0xac'),_0x49b876[_0x29ac('0x41')],_0x29ac('0xad'));}};Dialer[_0x29ac('0x1b')][_0x29ac('0x87')]=function(_0x15024e,_0x2a509c){var _0x3a152d=_0x15024e[_0x29ac('0xa4')];var _0x4173d6=_0x2a509c?_0x15024e[_0x29ac('0xa3')]:_0x15024e[_0x29ac('0x71')][_0x29ac('0x72')];logger['silly']('Dialer::ifTime()',_0x4173d6,_0x3a152d,_0x15024e[_0x29ac('0x41')],util['format'](_0x29ac('0xae'),_0x15024e['name'],_0x15024e['id']));var _0x7a4385=null;return Interval[_0x29ac('0xaf')](_0x4173d6,_0x3a152d)[_0x29ac('0x93')](function(_0xaa51e6){if(_0xaa51e6===!![]){return _0xaa51e6;}else{_0x15024e[_0x29ac('0x65')]=_0x2a509c?utils[_0x29ac('0x66')][_0x29ac('0x9b')]:utils[_0x29ac('0x66')][_0x29ac('0xb0')];_0x7a4385=msgResponse(_0x29ac('0xb1'),_0x29ac('0x88'),'Global:\x20'+_0x2a509c+'\x20'+_0x15024e[_0x29ac('0x41')]+_0x29ac('0xb2')+util[_0x29ac('0x76')](_0x4173d6,{'showHidden':![],'depth':null})+_0x29ac('0x9d')+_0x3a152d);}if(_0x7a4385!==null){logger[_0x29ac('0xb3')](_0x29ac('0xb4'),_0x7a4385);_0x7a4385[_0x29ac('0xb5')]=_0x2a509c;throw _0x7a4385;}})[_0x29ac('0x96')](function(_0x48f033){logger[_0x29ac('0x5f')]('AMI\x20IfTime',_0x48f033);throw msgResponse(_0x29ac('0xb6'),_0x29ac('0x7a'),util[_0x29ac('0x76')](_0x48f033,{'showHidden':![],'depth':null}));});};Dialer[_0x29ac('0x1b')][_0x29ac('0x29')]=function(_0x3a7f94){if(this[_0x29ac('0x20')][_0x3a7f94[_0x29ac('0xb7')]]){if(this[_0x29ac('0xb8')][_0x3a7f94[_0x29ac('0xb9')]]&&this[_0x29ac('0xb8')][_0x3a7f94['uniqueid']][_0x29ac('0x3b')]!=='ivr'){utils[_0x29ac('0xba')](this[_0x29ac('0x20')][_0x3a7f94[_0x29ac('0xb7')]],_0x29ac('0xbb'));this[_0x29ac('0xb8')][_0x3a7f94[_0x29ac('0xb9')]]['answertime']=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));}}};Dialer[_0x29ac('0x1b')][_0x29ac('0x2d')]=function(_0x2e4186){var _0x2f4b2f=this[_0x29ac('0xb8')][_0x2e4186[_0x29ac('0xb9')]];if(this[_0x29ac('0x20')][_0x2e4186[_0x29ac('0xb7')]]){if(_0x2f4b2f&&_0x2f4b2f['type']!=='ivr'){delete this[_0x29ac('0xb8')][_0x2e4186['uniqueid']];this[_0x29ac('0x20')][_0x2e4186[_0x29ac('0xb7')]][_0x29ac('0xbd')]+=0x1;var _0x465b68=new AgentComplete(_0x2f4b2f,_0x2e4186);if(_0x2e4186[_0x29ac('0xbe')]===_0x29ac('0xbf')){_0x465b68['agiafterat']=this[_0x29ac('0x20')][_0x2e4186[_0x29ac('0xb7')]]['dialQueueProject2']&&this['voiceQueues'][_0x2e4186[_0x29ac('0xb7')]][_0x29ac('0xc0')]?moment()[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x465b68)[_0x29ac('0x96')](loggerCatch(_0x29ac('0xc1')));hopperUtils[_0x29ac('0xc2')](_0x465b68)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x29ac('0x1b')][_0x29ac('0x2c')]=function(_0x571117){var _0x44743e=this[_0x29ac('0xb8')][_0x571117[_0x29ac('0xb9')]];var _0x170710=this;var _0x3aac6d=![];var _0x44a01f;var _0x2411e3;if(this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]]){if(_0x44743e&&_0x44743e[_0x29ac('0x3b')]!==_0x29ac('0xc3')){delete this[_0x29ac('0xb8')][_0x571117['uniqueid']];utils[_0x29ac('0xba')](this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]],'[syncQueueCallerAbandon]');_0x44743e[_0x29ac('0xc4')]=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));var _0xac78f3=new QueueCallerAbandon(_0x44743e,_0x571117);if(utils[_0x29ac('0xc5')](_0x44743e[_0x29ac('0xc4')],_0x44743e[_0x29ac('0xc6')])>=_0x44743e[_0x29ac('0xc7')]){this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0x49')]+=0x1;this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xc8')]+=0x1;_0xac78f3[_0x29ac('0x68')]=0xa;_0xac78f3[_0x29ac('0x69')]='Drop';_0xac78f3[_0x29ac('0xc9')]=_0x29ac('0xca');_0xac78f3[_0x29ac('0xcb')]=this['voiceQueues'][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xcc')]?moment()[_0x29ac('0x3f')](_0x29ac('0xbc')):undefined;_0xac78f3[_0x29ac('0xcd')]+=0x1;_0xac78f3[_0x29ac('0xce')]+=0x1;_0x44a01f=this['voiceQueues'][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xcf')];_0x2411e3=this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xd0')];hopperUtils[_0x29ac('0xd1')](_0xac78f3,_0xac78f3[_0x29ac('0x68')],_0x44743e[_0x29ac('0xd2')])[_0x29ac('0x93')](function(_0x4810e0){_0x3aac6d=_0x4810e0[_0x29ac('0xd3')]==0x1;if(_0xac78f3[_0x29ac('0xcd')]>=_0x170710[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xd4')]){_0x170710[_0x29ac('0xd5')](_0xac78f3,_0x4810e0[_0x29ac('0xd3')]);}else{hopperUtils[_0x29ac('0xd6')]({'active':![],'countdropretry':_0xac78f3[_0x29ac('0xcd')],'scheduledat':moment()[_0x29ac('0xd7')](_0x170710[_0x29ac('0x20')][_0x571117['queue']][_0x29ac('0xcf')],'minutes')[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x44743e[_0x29ac('0xd8')],'ListId':_0x44743e[_0x29ac('0xd9')],'VoiceQueueId':_0x44743e[_0x29ac('0xda')]||undefined,'CampaignId':_0x44743e[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0xdc')));var _0x4c0e81=new History(_0xac78f3);_0x4c0e81['state']=0xa;_0x4c0e81[_0x29ac('0x69')]='Drop';_0x4c0e81[_0x29ac('0x6b')]=moment()['format'](_0x29ac('0xbc'));_0x4c0e81[_0x29ac('0x6a')]=_0x4c0e81[_0x29ac('0x6b')];_0x4c0e81[_0x29ac('0xdd')]=_0xac78f3[_0x29ac('0xdd')];_0x4c0e81[_0x29ac('0xde')]=_0xac78f3[_0x29ac('0xde')];hopperUtils[_0x29ac('0xdf')](_0x4c0e81)[_0x29ac('0x96')](loggerCatch(_0x29ac('0xe0')));}})[_0x29ac('0x93')](function(){if(_0x3aac6d)hopperUtils['swapAdditionalPhones'](_0xac78f3,_0x44a01f,_0x2411e3)['then'](function(){return 0x1;});});}else{this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x29ac('0x20')][_0x571117['queue']][_0x29ac('0xe1')]+=0x1;_0xac78f3[_0x29ac('0x68')]=0xb;_0xac78f3[_0x29ac('0x69')]=_0x29ac('0xe2');_0xac78f3[_0x29ac('0xc9')]=_0x29ac('0xe3');_0xac78f3[_0x29ac('0xe4')]+=0x1;_0xac78f3[_0x29ac('0xce')]+=0x1;_0x44a01f=this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xe5')];_0x2411e3=this['voiceQueues'][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xd0')];hopperUtils[_0x29ac('0xd1')](_0xac78f3,_0xac78f3[_0x29ac('0x68')],_0x44743e[_0x29ac('0xd2')])[_0x29ac('0x93')](function(_0x3129fa){if(_0xac78f3[_0x29ac('0xe4')]>=_0x170710[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xe6')]){_0x170710['queueCallerAbandonCreateState'](_0xac78f3,_0x3129fa[_0x29ac('0xd3')]);}else{hopperUtils[_0x29ac('0xd6')]({'active':![],'countabandonedretry':_0xac78f3['countabandonedretry'],'scheduledat':moment()[_0x29ac('0xd7')](_0x170710['voiceQueues'][_0x571117[_0x29ac('0xb7')]]['dialAbandonedRetryFrequency'],_0x29ac('0xe7'))['format'](_0x29ac('0xbc')),'ContactId':_0x44743e['ContactId'],'ListId':_0x44743e[_0x29ac('0xd9')],'VoiceQueueId':_0x44743e[_0x29ac('0xda')]||undefined,'CampaignId':_0x44743e[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0xe8')));var _0xc021cf=new History(_0xac78f3);_0xc021cf['state']=0xb;_0xc021cf[_0x29ac('0x69')]=_0x29ac('0xe2');_0xc021cf[_0x29ac('0x6b')]=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));_0xc021cf[_0x29ac('0x6a')]=_0xc021cf[_0x29ac('0x6b')];_0xc021cf[_0x29ac('0xdd')]=_0xac78f3[_0x29ac('0xdd')];_0xc021cf[_0x29ac('0xde')]=_0xac78f3[_0x29ac('0xde')];hopperUtils['createHistory'](_0xc021cf)[_0x29ac('0x96')](loggerCatch(_0x29ac('0xe9')));}})['then'](function(){if(_0x3aac6d)hopperUtils[_0x29ac('0xea')](_0xac78f3,_0x44a01f,_0x2411e3)[_0x29ac('0x93')](function(){return 0x1;});});}}}};Dialer[_0x29ac('0x1b')][_0x29ac('0xeb')]=function(_0x110da6){if(this['actions'][_0x110da6[_0x29ac('0xb9')]]){this[_0x29ac('0x25')][_0x110da6['uniqueid']]['channel']=_0x110da6[_0x29ac('0xec')];}if(this['uniqueId'][_0x110da6[_0x29ac('0xb9')]]){this[_0x29ac('0xb8')][_0x110da6['uniqueid']][_0x29ac('0xec')]=_0x110da6[_0x29ac('0xec')];}};Dialer['prototype'][_0x29ac('0x35')]=function(_0xcbbdf6){if(!this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]]){return;}var _0x1de35f=this[_0x29ac('0x20')][this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]]['queue']][_0x29ac('0xee')]||_0x29ac('0xef');if(_0x1de35f===_0x29ac('0xf0')){if(this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]]&&_[_0x29ac('0xf1')](this[_0x29ac('0x25')][_0xcbbdf6['actionid']]['locked'])&&_0xcbbdf6[_0x29ac('0x7e')]==='1'&&_0xcbbdf6['paused']==='0'){if(this[_0x29ac('0xf2')][_0xcbbdf6['stateinterface']]){if(!this['agents'][_0xcbbdf6[_0x29ac('0xf3')]]['locked']){this[_0x29ac('0xf2')][_0xcbbdf6[_0x29ac('0xf3')]][_0x29ac('0xf4')]=!![];this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xf4')]=!![];this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xf3')]=_0xcbbdf6[_0x29ac('0xf3')];}}}}else if(_0x1de35f===_0x29ac('0xef')){if(this[_0x29ac('0x25')][_0xcbbdf6['actionid']]){if(this[_0x29ac('0xf2')][_0xcbbdf6[_0x29ac('0xf3')]]){this[_0x29ac('0x25')][_0xcbbdf6['actionid']][_0x29ac('0xf3')]=_0xcbbdf6[_0x29ac('0xf3')];if(_[_0x29ac('0xf1')](this[_0x29ac('0xf5')][this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xb7')]])){this[_0x29ac('0xf5')][this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xb7')]]=[];}this[_0x29ac('0xf5')][this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xb7')]][_0x29ac('0x90')](_[_0x29ac('0x5a')](_[_0x29ac('0x6f')](this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]],[_0x29ac('0xf6'),'stateinterface']),{'status':_0xcbbdf6[_0x29ac('0x7e')],'paused':_0xcbbdf6[_0x29ac('0xf7')]}));}}}};Dialer[_0x29ac('0x1b')]['syncQueueStatusComplete']=function(_0x4286c9){if(!this[_0x29ac('0x25')][_0x4286c9['actionid']]){return;}var _0x5d224a=this;var _0x514fcd=this['voiceQueues'][this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]['queue']];var _0x75034a=_0x514fcd[_0x29ac('0xee')]||_0x29ac('0xef');if(_0x75034a===_0x29ac('0xf0')){if(this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]&&this[_0x29ac('0x25')][_0x4286c9['actionid']][_0x29ac('0xf3')]){this[_0x29ac('0x1f')][_0x29ac('0xf8')](this['actions'][_0x4286c9['actionid']][_0x29ac('0xf6')],this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]['stateinterface'])[_0x29ac('0x96')](function(_0x2855e5){logger[_0x29ac('0x5f')](_0x29ac('0xf9'),util[_0x29ac('0x76')](_0x2855e5,{'showHidden':![],'depth':null}));})[_0x29ac('0xfa')](function(){utils['decrementOriginate'](_0x5d224a[_0x29ac('0x20')][_0x5d224a[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]],_0x29ac('0xfb'));_0x5d224a[_0x29ac('0xf2')][_0x5d224a['actions'][_0x4286c9[_0x29ac('0xed')]]['stateinterface']][_0x29ac('0xf4')]=![];delete _0x5d224a['actions'][_0x4286c9['actionid']];unlockQueueStatus(_0x514fcd);});}else{utils['decrementOriginate'](this['voiceQueues'][this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]],_0x29ac('0xfb'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x4286c9['actionid']][_0x29ac('0xd8')],'ListId':this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xd9')],'VoiceQueueId':this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xda')]||undefined,'CampaignId':this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0xfc')));delete this['actions'][_0x4286c9[_0x29ac('0xed')]];unlockQueueStatus(_0x514fcd);}}else if(_0x75034a===_0x29ac('0xef')){var _0xac5544;if(this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]&&!_[_0x29ac('0x43')](this[_0x29ac('0xf5')][this[_0x29ac('0x25')][_0x4286c9['actionid']][_0x29ac('0xb7')]])){if(this[_0x29ac('0x28')][_0x5d224a[_0x29ac('0x25')][_0x4286c9['actionid']][_0x29ac('0xb7')]]){this['queueBookedRR'][_0x5d224a['actions'][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]]=this[_0x29ac('0x28')][this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]['queue']]?this[_0x29ac('0x28')][this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]]:this['queueBooked'][this[_0x29ac('0x25')][_0x4286c9['actionid']][_0x29ac('0xb7')]]?this['queueBooked'][this['actions'][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]][_0x29ac('0xfd')]||0x0:0x0;}this[_0x29ac('0xf5')][this['actions'][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]][_0x29ac('0xfd')]=this[_0x29ac('0x28')][this['actions'][_0x4286c9['actionid']][_0x29ac('0xb7')]];for(var _0x4b1f76=0x0;_0x4b1f76=_0xd3654e['dialGlobalMaxRetry']){_0x680985[_0x29ac('0x122')](_0x4a1d75,_0x40234f,_0x178651,_0x29ac('0x123'));}else{if(_0x4a1d75['countmachineretry']>=_0xd3654e[_0x29ac('0x124')]){_0x680985[_0x29ac('0x125')](_0x4a1d75,_0x40234f,_0x178651,_0x29ac('0x126'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4a1d75[_0x29ac('0x11e')],'scheduledat':moment()[_0x29ac('0xd7')](_0xd3654e[_0x29ac('0x127')],_0x29ac('0xe7'))[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x4a1d75[_0x29ac('0xd8')],'ListId':_0x4a1d75[_0x29ac('0xd9')],'VoiceQueueId':_0x4a1d75['VoiceQueueId']||undefined,'CampaignId':_0x4a1d75[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x128')));_0x40234f({'reschedule':0x1});}}});}if(_0x30b8b2['type']===_0x29ac('0xc3')&&this[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]][_0x29ac('0x110')]&&_0xf085cc['value']===_0x29ac('0x111')){delete this['uniqueId'][_0xf085cc[_0x29ac('0xb9')]];utils[_0x29ac('0xba')](this[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]],_0x29ac('0x112'));_0x3692a1=new Hangup(_0x30b8b2,_0xf085cc);_0x3692a1[_0x29ac('0x68')]=0x12;_0x3692a1[_0x29ac('0x69')]=_0x29ac('0x114');_0x3692a1[_0x29ac('0x115')]=_0x29ac('0x116');ami[_0x29ac('0x129')](_0x29ac('0x117'),ut['buildObj'](_0x3692a1,'amd'));this['saveInDb'](_0x3692a1,_0x29ac('0x12a'),_0x29ac('0x12b'));}if(_0x30b8b2[_0x29ac('0x3b')]==='ivr'&&this['campaigns'][_0x30b8b2[_0x29ac('0xb7')]][_0x29ac('0x110')]&&_0xf085cc[_0x29ac('0x12c')]===_0x29ac('0x11c')){return new Promise(function(_0x42320a,_0x433ae8){delete _0x680985[_0x29ac('0xb8')][_0xf085cc[_0x29ac('0xb9')]];utils[_0x29ac('0xba')](_0x680985[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]],_0x29ac('0x112'));_0x680985[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]][_0x29ac('0xbd')]+=0x1;_0x680985[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]][_0x29ac('0x113')]+=0x1;var _0x42d4fe=_0x680985[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]];var _0x523bb7=new Hangup(_0x30b8b2,_0xf085cc);_0x523bb7[_0x29ac('0x68')]=0x13;_0x523bb7['statedesc']=_0x29ac('0x11d');_0x523bb7[_0x29ac('0x115')]=_0x29ac('0x116');_0x523bb7[_0x29ac('0x11e')]+=0x1;_0x523bb7[_0x29ac('0xce')]+=0x1;_0x523bb7[_0x29ac('0x119')]=!![];ami[_0x29ac('0x129')](_0x29ac('0x117'),ut['buildObj'](_0x523bb7,_0x29ac('0x119')));hopperUtils[_0x29ac('0xdf')](_0x523bb7)['catch'](loggerCatch(_0x29ac('0x11f')));if(_0x523bb7['countbusyretry']+_0x523bb7[_0x29ac('0x12d')]+_0x523bb7['countnoanswerretry']+_0x523bb7[_0x29ac('0x12e')]+_0x523bb7['countdropretry']+_0x523bb7[_0x29ac('0xe4')]+_0x523bb7['countmachineretry']+_0x523bb7['countagentrejectretry']>=_0x42d4fe[_0x29ac('0x12f')]){_0x680985[_0x29ac('0x122')](_0x523bb7,_0x42320a,_0x433ae8,'reason19\x20machine....');}else{if(_0x523bb7[_0x29ac('0x11e')]>=_0x42d4fe[_0x29ac('0x124')]){_0x680985['createStateFinal'](_0x523bb7,_0x42320a,_0x433ae8,_0x29ac('0x126'));}else{hopperUtils[_0x29ac('0xd6')]({'active':![],'countmachineretry':_0x523bb7[_0x29ac('0x11e')],'scheduledat':moment()[_0x29ac('0xd7')](_0x42d4fe['dialMachineRetryFrequency'],_0x29ac('0xe7'))[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x523bb7['ContactId'],'ListId':_0x523bb7[_0x29ac('0xd9')],'VoiceQueueId':_0x523bb7[_0x29ac('0xda')]||undefined,'CampaignId':_0x523bb7['CampaignId']||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x128')));_0x42320a({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x3f60a1){var _0x4dafb3=this[_0x29ac('0xb8')][_0x3f60a1[_0x29ac('0xb9')]];var _0x1c8552;if(!_0x4dafb3){return;}if(_0x4dafb3[_0x29ac('0x3b')]===_0x29ac('0xc3')){delete this[_0x29ac('0xb8')][_0x3f60a1['uniqueid']];utils[_0x29ac('0xba')](this[_0x29ac('0x21')][_0x4dafb3[_0x29ac('0xb7')]],'[syncHangup]');this['campaigns'][_0x4dafb3[_0x29ac('0xb7')]][_0x29ac('0x130')]+=0x1;if(_0x3f60a1[_0x29ac('0x131')]===_0x29ac('0x132')){const _0x2e0b54=new AgentComplete(_0x4dafb3,_0x3f60a1);_0x2e0b54[_0x29ac('0xdb')]=this[_0x29ac('0x21')][_0x4dafb3['queue']]['id'];hopperUtils[_0x29ac('0xdf')](_0x2e0b54)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x133')));hopperUtils[_0x29ac('0xc2')](_0x2e0b54)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x134')));}else{_0x1c8552=new Hangup(_0x4dafb3,_0x3f60a1);hopperUtils[_0x29ac('0xdf')](_0x1c8552)['catch'](loggerCatch(_0x29ac('0x135')));hopperUtils[_0x29ac('0xc2')](_0x1c8552)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x136')));}}else{if(isNotNull(this[_0x29ac('0x20')][_0x4dafb3['queue']][_0x29ac('0x137')])){delete this[_0x29ac('0xb8')][_0x3f60a1[_0x29ac('0xb9')]];utils[_0x29ac('0xba')](this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]],_0x29ac('0x138'));this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]]['outboundAnswerCallsDay']+=0x1;this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]][_0x29ac('0x113')]+=0x1;_0x1c8552=new Hangup(_0x4dafb3,_0x3f60a1);_0x1c8552[_0x29ac('0x68')]=0x10;_0x1c8552[_0x29ac('0x69')]=_0x29ac('0x139');_0x1c8552['membername']=_0x29ac('0x13a');hopperUtils[_0x29ac('0xdf')](_0x1c8552)[_0x29ac('0x96')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x29ac('0xc2')](_0x1c8552)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x136')));}else{delete this[_0x29ac('0xb8')][_0x3f60a1[_0x29ac('0xb9')]];utils[_0x29ac('0xba')](this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]],_0x29ac('0x13b'));if(_0x3f60a1[_0x29ac('0x131')]===_0x29ac('0x132')){this['voiceQueues'][_0x4dafb3[_0x29ac('0xb7')]][_0x29ac('0xbd')]+=0x1;const _0x35cca1=new AgentComplete(_0x4dafb3,_0x3f60a1);_0x35cca1[_0x29ac('0xda')]=this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]]['id'];hopperUtils['createHistory'](_0x35cca1)[_0x29ac('0x96')](loggerCatch(_0x29ac('0xc1')));hopperUtils[_0x29ac('0xc2')](_0x35cca1)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x13c')));}else{this[_0x29ac('0x20')][_0x4dafb3['queue']][_0x29ac('0x13d')]+=0x1;_0x1c8552=new Hangup(_0x4dafb3,_0x3f60a1);_0x1c8552[_0x29ac('0x68')]=0xc;_0x1c8552[_0x29ac('0x69')]=_0x3f60a1[_0x29ac('0x131')];_0x1c8552[_0x29ac('0x115')]=_0x29ac('0x13e');hopperUtils[_0x29ac('0xdf')](_0x1c8552)['catch'](loggerCatch(_0x29ac('0x13f')));hopperUtils[_0x29ac('0xc2')](_0x1c8552)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x138')));}}}};Dialer['prototype']['syncQueueSummary']=function(_0x5c2255){var _0x112570=this;if(!_0x112570[_0x29ac('0x140')][_0x5c2255[_0x29ac('0x41')]]){_0x112570['queuesSummary'][_0x5c2255[_0x29ac('0x41')]]={'running':![]};}else if(_0x112570[_0x29ac('0x140')][_0x5c2255[_0x29ac('0x41')]][_0x29ac('0x141')]===!![]){return;}else if(_0x112570[_0x29ac('0x140')][_0x5c2255['name']][_0x29ac('0x141')]===![]){_0x112570[_0x29ac('0x140')][_0x5c2255['name']][_0x29ac('0x141')]=!![];}var _0x1592bd=_0x112570[_0x29ac('0x20')][_0x5c2255[_0x29ac('0x41')]];var _0x47efee=_0x1592bd[_0x29ac('0x65')]!==utils[_0x29ac('0x66')][_0x29ac('0x74')];var _0xc7f2c3=utils[_0x29ac('0x142')](_0x1592bd);_0x1592bd[_0x29ac('0x143')]=utils['getQueueCampaignStatusMessage'](_0x1592bd,_0x112570['trunks']);Promise[_0x29ac('0xa2')]()[_0x29ac('0x93')](function(){if(_0x1592bd[_0x29ac('0x143')]===utils[_0x29ac('0x66')]['INACTIVE']){if(_0x47efee){clearPredictiveAttributes(_0x1592bd);_0x5c2255[_0x29ac('0x5b')]=undefined;_0x5c2255['startProgressive']=undefined;}if(_0x1592bd[_0x29ac('0x143')]===utils[_0x29ac('0x66')][_0x29ac('0x74')]){_0x5c2255['available']=0x0;_0x5c2255[_0x29ac('0xf7')]=0x0;_0x5c2255['inUse']=0x0;_0x5c2255['talking']=0x0;_0x5c2255['pTalking']=0x0;}}else if(_0x1592bd[_0x29ac('0x143')]===utils[_0x29ac('0x66')][_0x29ac('0x144')]&&!_0xc7f2c3){return _0x112570[_0x29ac('0x87')](_0x1592bd,!![])[_0x29ac('0x93')](function(){return _0x112570[_0x29ac('0x87')](_0x1592bd,![]);})[_0x29ac('0x93')](function(){return _0x112570[_0x29ac('0x145')](_0x1592bd);})[_0x29ac('0x96')](function(_0x3e0be3){loggerSyncQueueSummary[_0x29ac('0x3d')]('[syncQueueSummary]',util[_0x29ac('0x76')](_0x3e0be3,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1592bd);});}else{clearPredictiveAttributes(_0x1592bd);}})[_0x29ac('0x93')](function(){var _0x49d605=_0x5c2255[_0x29ac('0x146')](_0x1592bd);if(_0x49d605||_0x1592bd[_0x29ac('0x147')]){_0x1592bd[_0x29ac('0x147')]=![];_0x5c2255[_0x29ac('0x148')](_0x1592bd);Object['assign'](_0x1592bd,_0x5c2255);emitOutboundVoiceQueueSummary(_0x5c2255);}_0x112570[_0x29ac('0x140')][_0x1592bd[_0x29ac('0x41')]][_0x29ac('0x141')]=![];})[_0x29ac('0x96')](function(_0x3d244b){logger[_0x29ac('0x5f')](_0x29ac('0x149'),util[_0x29ac('0x76')](_0x3d244b,{'showHidden':![],'depth':null}));_0x112570[_0x29ac('0x140')][_0x1592bd[_0x29ac('0x41')]]['running']=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x5e74c9=_['filter'](this[_0x29ac('0x20')],function(_0xb4b40c){return _0xb4b40c[_0x29ac('0x14a')];});var _0x107ac8=_[_0x29ac('0x14b')](this['agents'],function(_0x211eef){return _0x211eef[_0x29ac('0x14c')]&&_0x211eef['status']===_0x29ac('0x14d');});if(_0x5e74c9[_0x29ac('0x8f')]>0x0&&_0x107ac8[_0x29ac('0x8f')]>0x0){return Promise[_0x29ac('0xa2')]()[_0x29ac('0x93')](cmHopper['handlePreviewRecallNotifications'](_[_0x29ac('0x14e')](_0x5e74c9,'id'),previewRecallmeReminderInterval,_['map'](_0x107ac8,'id')))['then'](function(_0x45e731){for(var _0xfb3a3c=0x0;_0xfb3a3c<_0x45e731[_0x29ac('0x8f')];_0xfb3a3c++){var _0x45631b=_0x45e731[_0xfb3a3c]['Agent'][_0x29ac('0x41')];if(_0x45631b)io['to'](util[_0x29ac('0x3f')](_0x29ac('0x14f'),_0x45631b))[_0x29ac('0x129')](_0x29ac('0x150'),{'hopper':_0x45e731[_0xfb3a3c]});}})[_0x29ac('0x96')](function(_0x50198d){logger['error'](_0x29ac('0x151'),_0x50198d);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x29ac('0x1b')][_0x29ac('0x37')]=function(){var _0x38eefd=this;setInterval(function(){_0x38eefd['clearZombieChannels'](_0x38eefd[_0x29ac('0xb8')],_0x29ac('0x152'));_0x38eefd[_0x29ac('0x153')](_0x38eefd[_0x29ac('0x25')],_0x29ac('0x154'));},0x32c8);};Dialer[_0x29ac('0x1b')][_0x29ac('0x153')]=function(_0x3b89ab,_0x126bdb){var _0x54bc55=this;for(var _0x2813a5 in _0x3b89ab){if(typeof _0x3b89ab[_0x2813a5]!==_0x29ac('0x155')){this[_0x29ac('0x1e')][_0x29ac('0x1c')](function(){if(!_[_0x29ac('0xf1')](_0x3b89ab[_0x2813a5])){return ami[_0x29ac('0x91')]({'action':'status','channel':_0x3b89ab[_0x2813a5][_0x29ac('0xec')]})['catch'](function(_0x14c808){if(_0x14c808[_0x29ac('0x65')]===_0x29ac('0x156')){setTimeout(function(){if(_0x3b89ab[_0x2813a5]&&_0x3b89ab[_0x2813a5][_0x29ac('0x3b')]!==_0x29ac('0xc3')){utils[_0x29ac('0xba')](_0x54bc55['voiceQueues'][_0x3b89ab[_0x2813a5][_0x29ac('0xb7')]],'[clearZombieChannels]');logger[_0x29ac('0x5f')]('[Dialer][checkChannel]',_0x126bdb,_0x2813a5,_0x3b89ab[_0x2813a5][_0x29ac('0xb7')]);delete _0x3b89ab[_0x2813a5];}if(_0x3b89ab[_0x2813a5]&&_0x3b89ab[_0x2813a5][_0x29ac('0x3b')]===_0x29ac('0xc3')){utils['decrementOriginate'](_0x54bc55['campaigns'][_0x3b89ab[_0x2813a5]['queue']],_0x29ac('0x157'));logger[_0x29ac('0x5f')]('[Dialer][checkChannel][ivr]',_0x126bdb,_0x2813a5,_0x3b89ab[_0x2813a5][_0x29ac('0xb7')]);delete _0x3b89ab[_0x2813a5];}},0x2328);}});}});}}};Dialer[_0x29ac('0x1b')][_0x29ac('0x158')]=function(_0x5cb639){return Promise[_0x29ac('0xa2')]()[_0x29ac('0x93')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5cb639))[_0x29ac('0x96')](loggerCatch(_0x29ac('0x159')));};Dialer[_0x29ac('0x1b')][_0x29ac('0x15a')]=function(_0x45713e,_0x451243,_0x12434d){var _0x314e00={'state':0x19,'statedesc':_0x29ac('0x15b')};utils[_0x29ac('0xba')](_0x451243,_0x29ac('0x15c')+_0x45713e);this[_0x29ac('0x11a')](_[_0x29ac('0x5a')](_0x314e00,_[_0x29ac('0x6f')](_0x12434d,[_0x29ac('0xd8'),_0x29ac('0xd9'),_0x29ac('0x15d'),_0x29ac('0xda'),_0x29ac('0xdb')])),_0x29ac('0x15e'),'[emptyContact]');logger['error'](_0x45713e);};Dialer[_0x29ac('0x1b')][_0x29ac('0x11a')]=function(_0x53dabb,_0x2dcaac,_0x535fde){hopperUtils[_0x29ac('0xdf')](_0x53dabb)[_0x29ac('0x96')](loggerCatch(_0x2dcaac));hopperUtils[_0x29ac('0xc2')](_0x53dabb)[_0x29ac('0x96')](loggerCatch(_0x535fde));};Dialer[_0x29ac('0x1b')][_0x29ac('0xd5')]=function(_0x1d260c,_0x529b4e){hopperUtils['createHistory'](_0x1d260c)['catch'](loggerCatch(_0x29ac('0xc1')));if(_0x529b4e==0x0){hopperUtils[_0x29ac('0xc2')](_0x1d260c)['catch'](loggerCatch(_0x29ac('0x15f')));}};Dialer[_0x29ac('0x1b')][_0x29ac('0x151')]=function(_0x4a1e34){return Promise[_0x29ac('0xa2')]()[_0x29ac('0x93')](cmHopper[_0x29ac('0x160')](_0x4a1e34['id'],previewRecallmeReminderInterval))[_0x29ac('0x93')](function(_0x530284){for(var _0x1a43b6=0x0;_0x1a43b6<_0x530284[_0x29ac('0x8f')];_0x1a43b6++){var _0xd5ad23=_0x530284[_0x1a43b6]['Agent']['name'];if(_0xd5ad23)io['to'](util[_0x29ac('0x3f')](_0x29ac('0x14f'),_0xd5ad23))[_0x29ac('0x129')](_0x29ac('0x150'),{'hopper':_0x530284[_0x1a43b6]});}})['catch'](function(){});};Dialer[_0x29ac('0x1b')][_0x29ac('0xa5')]=function(_0x185623){var _0x1a162f=this;return function(){_0x1a162f['handleIvr'](_0x185623);};};Dialer[_0x29ac('0x1b')][_0x29ac('0x161')]=function(_0x529b76,_0x5aeb17){var _0x45fff5=this;var _0x26aa3f=uuid['v4']();this['actions'][_0x26aa3f]=new Action(_0x529b76,_0x5aeb17,_0x26aa3f);return new Promise(function(_0x1f844b,_0x39e2a4){if(_['isUndefined'](_0x529b76)&&typeof _0x529b76!==_0x29ac('0x162')){return _0x39e2a4(msgResponse(_0x29ac('0x163'),_0x29ac('0x88'),_0x29ac('0x164')));}if(_[_0x29ac('0x3a')](_0x5aeb17[_0x29ac('0x165')])||_0x5aeb17[_0x29ac('0x165')]===null){return _0x39e2a4(msgResponse(_0x29ac('0x163'),_0x29ac('0x88'),_0x29ac('0x166')));}var _0x6b2bb1={'XMD-CALLERID':_0x45fff5['actions'][_0x26aa3f][_0x29ac('0x167')](),'XMD-AGI':_0x529b76['dialQueueProject']?util['format'](_0x29ac('0x168'),ipAgi,_0x529b76[_0x29ac('0x137')]):_0x29ac('0x169'),'XMD-AGIAFTER':_0x529b76['dialQueueProject2']?util[_0x29ac('0x3f')]('\x22agi://%s/square,%s\x22',ipAgi,_0x529b76[_0x29ac('0xcc')]):'NONE','XMD-QUEUE':utils[_0x29ac('0x16a')](_0x529b76)?util[_0x29ac('0x3f')](_0x29ac('0x16b'),_0x529b76[_0x29ac('0x41')],_0x529b76['dialQueueOptions']||'',_0x529b76[_0x29ac('0xc0')]?'c':'',_0x529b76[_0x29ac('0xc7')]||0x3):_0x29ac('0x169'),'XMD-CONTACTID':_0x5aeb17[_0x29ac('0xd8')],'XMD-CDRTYPE':_0x29ac('0x8'),'CALLERID(all)':_0x45fff5[_0x29ac('0x25')][_0x26aa3f][_0x29ac('0x167')](),'XMD-AMD':_0x529b76['dialAMDActive']?_0x29ac('0x144'):_0x29ac('0x169'),'XMD-DESTINATION':_0x29ac('0x10f')};if(_0x529b76[_0x29ac('0x110')]){_0x6b2bb1[_0x29ac('0x16c')]=_0x529b76[_0x29ac('0x16d')]||0x9c4;_0x6b2bb1[_0x29ac('0x16e')]=_0x529b76['dialAMDGreeting']||0x5dc;_0x6b2bb1[_0x29ac('0x16f')]=_0x529b76[_0x29ac('0x170')]||0x320;_0x6b2bb1['XMD-AMDTOTALANALYSISTIME']=_0x529b76[_0x29ac('0x171')]||0x1388;_0x6b2bb1[_0x29ac('0x172')]=_0x529b76[_0x29ac('0x173')]||0x64;_0x6b2bb1['XMD-AMDBETWEENWORDSSILENCE']=_0x529b76[_0x29ac('0x174')]||0x32;_0x6b2bb1[_0x29ac('0x175')]=_0x529b76['dialAMDMaximumNumberOfWords']||0x3;_0x6b2bb1['XMD-AMDSILENCETHRESHOLD']=_0x529b76[_0x29ac('0x176')]||0x100;_0x6b2bb1['XMD-AMDMAXIMUMWORDLENGTH']=_0x529b76[_0x29ac('0x177')]||0x1388;}if(utils['isOutboundQueue'](_0x529b76)){_0x6b2bb1['XMD-VOICEQUEUEID']=_0x5aeb17['VoiceQueueId'];}else{_0x6b2bb1[_0x29ac('0x178')]=_0x5aeb17[_0x29ac('0xdb')];}var _0xd3cc17=utils[_0x29ac('0x179')](_0x5aeb17['Contact']);Object['assign'](_0x6b2bb1,_0xd3cc17);var _0x188b06=_0x45fff5['isTrunkReachable'](_0x529b76['Trunk'])?utils['getCallerId'](_0x529b76[_0x29ac('0x80')]['callerid'],_0x529b76[_0x29ac('0x17a')],_0x529b76['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x29ac('0x17b')](_0x529b76[_0x29ac('0x17c')],_0x529b76['dialRandomLastDigitCallerIdNumber']):_0x529b76[_0x29ac('0x17c')]):utils[_0x29ac('0x17d')](_[_0x29ac('0xf1')](_0x529b76[_0x29ac('0x81')])?_0x529b76[_0x29ac('0x80')][_0x29ac('0x17e')]:_0x529b76[_0x29ac('0x81')][_0x29ac('0x17e')],_0x529b76[_0x29ac('0x17a')],_0x529b76[_0x29ac('0x17f')]>0x0?utils['getCallerIdRandom'](_0x529b76[_0x29ac('0x17c')],_0x529b76[_0x29ac('0x17f')]):_0x529b76['dialOriginateCallerIdNumber']);if(_0x188b06){_0x6b2bb1['XMD-ORIGINATECALLERIDNAME']=_0x45fff5[_0x29ac('0x25')][_0x26aa3f][_0x29ac('0x180')]=utils[_0x29ac('0x181')](_0x188b06);_0x6b2bb1[_0x29ac('0x182')]=_0x5aeb17[_0x29ac('0x165')];}_0x529b76[_0x29ac('0x183')]=_0x6b2bb1;return ami['Action']({'actionid':_0x26aa3f,'action':_0x29ac('0x163'),'channel':_0x45fff5['isTrunkReachable'](_0x529b76[_0x29ac('0x80')])?util[_0x29ac('0x3f')](_0x29ac('0x184'),_0x529b76['Trunk'][_0x29ac('0x41')],isNotNull(_0x529b76[_0x29ac('0x185')])?_0x529b76[_0x29ac('0x185')]['trim']()||'':'',_0x529b76['dialCutDigit']>0x0?_0x5aeb17['phone'][_0x29ac('0x186')](_0x529b76[_0x29ac('0x187')]):_0x5aeb17[_0x29ac('0x165')]):util['format']('SIP/%s/%s%s',_[_0x29ac('0xf1')](_0x529b76[_0x29ac('0x81')])?_0x529b76[_0x29ac('0x80')][_0x29ac('0x41')]:_0x529b76['TrunkBackup'][_0x29ac('0x41')],isNotNull(_0x529b76[_0x29ac('0x185')])?_0x529b76[_0x29ac('0x185')][_0x29ac('0x188')]()||'':'',_0x529b76[_0x29ac('0x187')]>0x0?_0x5aeb17[_0x29ac('0x165')]['substring'](_0x529b76[_0x29ac('0x187')]):_0x5aeb17[_0x29ac('0x165')]),'callerid':_0x188b06,'Exten':_0x29ac('0x10f'),'Context':_0x29ac('0x189'),'Priority':'1','variable':_0x6b2bb1,'timeout':(_0x529b76[_0x29ac('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x26aa3f})['then'](function(_0x411d82){return _0x1f844b(_0x411d82);})[_0x29ac('0x96')](function(_0x1744fb){_0x529b76[_0x29ac('0x18b')]+=0x1;var _0x236716=new History(_0x45fff5[_0x29ac('0x25')][_0x26aa3f]);logger[_0x29ac('0x5f')](util['format'](_0x29ac('0x18c'),JSON[_0x29ac('0x6e')](_0x1744fb)));_0x236716[_0x29ac('0x68')]=0xe;_0x236716[_0x29ac('0x69')]=_0x29ac('0x18d');_0x236716[_0x29ac('0x6b')]=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));_0x236716[_0x29ac('0x6a')]=_0x236716[_0x29ac('0x6b')];hopperUtils[_0x29ac('0xdf')](_0x236716)['catch'](loggerCatch(_0x29ac('0x18e')));_0x45fff5[_0x29ac('0xc2')](_0x236716)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x18e')))['finally'](function(){delete _0x45fff5[_0x29ac('0x25')][_0x26aa3f];return _0x39e2a4(msgResponse(_0x29ac('0x163'),_0x29ac('0x7a'),_0x29ac('0x18f')));});});});};Dialer[_0x29ac('0x1b')][_0x29ac('0x190')]=function(_0x32b9a2,_0x40597e,_0x1d940e){var _0x5186c8=new History(_0x40597e);if(_0x5186c8[_0x29ac('0x120')]+_0x5186c8[_0x29ac('0x12d')]+_0x5186c8['countnoanswerretry']+_0x5186c8[_0x29ac('0x12e')]+_0x5186c8[_0x29ac('0xcd')]+_0x5186c8['countabandonedretry']+_0x5186c8[_0x29ac('0x11e')]+_0x5186c8[_0x29ac('0x121')]>=_0x1d940e[_0x29ac('0x12f')]-0x1){return!![];}switch(_0x32b9a2){case 0x3:if(_0x5186c8[_0x29ac('0x191')]>=_0x1d940e[_0x29ac('0x192')]-0x1){return!![];}hopperUtils[_0x29ac('0xd6')]({'active':![],'countnoanswerretry':_0x5186c8[_0x29ac('0x191')]+=0x1,'scheduledat':moment()['add'](_0x1d940e[_0x29ac('0x193')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8['ContactId'],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x194')));break;case 0x5:if(_0x5186c8[_0x29ac('0x120')]>=_0x1d940e[_0x29ac('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x5186c8['countbusyretry']+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e[_0x29ac('0x196')],'minutes')[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x197')));break;case 0x8:if(_0x5186c8[_0x29ac('0x12d')]>=_0x1d940e[_0x29ac('0x198')]-0x1){return!![];}hopperUtils[_0x29ac('0xd6')]({'active':![],'countcongestionretry':_0x5186c8[_0x29ac('0x12d')]+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e[_0x29ac('0x199')],_0x29ac('0xe7'))[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x19a')));break;case 0x0:if(_0x5186c8[_0x29ac('0x12e')]>=_0x1d940e['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x29ac('0xd6')]({'active':![],'countnosuchnumberretry':_0x5186c8[_0x29ac('0x12e')]+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e[_0x29ac('0x19b')],_0x29ac('0xe7'))[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8['VoiceQueueId']||undefined,'CampaignId':_0x5186c8['CampaignId']||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x19c')));}break;case 0xa:if(_0x5186c8[_0x29ac('0xcd')]>=_0x1d940e[_0x29ac('0xd4')]-0x1){return!![];}hopperUtils[_0x29ac('0xd6')]({'active':![],'countdropretry':_0x5186c8[_0x29ac('0xcd')]+=0x1,'scheduledat':moment()['add'](_0x1d940e['dialDropRetryFrequency'],_0x29ac('0xe7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8['CampaignId']||undefined})['catch'](loggerCatch(_0x29ac('0xdc')));break;case 0xb:if(_0x5186c8[_0x29ac('0xe4')]>=_0x1d940e['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5186c8['countabandonedretry']+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e[_0x29ac('0xe5')],_0x29ac('0xe7'))[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8['VoiceQueueId']||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})['catch'](loggerCatch(_0x29ac('0xe8')));break;case 0x13:if(_0x5186c8[_0x29ac('0x11e')]>=_0x1d940e[_0x29ac('0x124')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5186c8[_0x29ac('0x11e')]+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e['dialMachineRetryFrequency'],'minutes')[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x128')));break;case 0x14:if(_0x5186c8[_0x29ac('0x121')]>=_0x1d940e[_0x29ac('0x19d')]-0x1){return!![];}hopperUtils[_0x29ac('0xd6')]({'active':![],'countagentrejectretry':_0x5186c8[_0x29ac('0x121')]+=0x1,'scheduledat':moment()['add'](_0x1d940e[_0x29ac('0x19e')],_0x29ac('0xe7'))[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8['ContactId'],'ListId':_0x5186c8['ListId'],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x19f')));break;default:return!![];}};Dialer[_0x29ac('0x1b')][_0x29ac('0x10c')]=function(_0x170f45,_0x27aa5c,_0x1c2b2f){var _0x297ec6=this;var _0x15560b=new History(_0x170f45);var _0x5e1487=![];var _0xd909a3;var _0x286a6a;return new Promise(function(_0x3426d7,_0x70ce51){if(_[_0x29ac('0x3a')](_0x27aa5c)&&typeof _0x27aa5c!==_0x29ac('0x162')){return _0x70ce51(msgResponse(_0x29ac('0x1a0'),_0x29ac('0x88'),'entity\x20is\x20undefine'));}if(_[_0x29ac('0x3a')](_0x1c2b2f)&&typeof _0x1c2b2f!==_0x29ac('0x162')){return _0x70ce51(msgResponse(_0x29ac('0x1a0'),_0x29ac('0x88'),_0x29ac('0x1a1')));}hopperUtils[_0x29ac('0xd1')](_0x15560b,_0x1c2b2f[_0x29ac('0xbe')],_0x27aa5c)[_0x29ac('0x93')](function(_0x206f8){if(_0x206f8['additional']==0x1)_0x5e1487=!![];switch(_0x1c2b2f['reason']){case'0':_0x27aa5c[_0x29ac('0x1a2')]+=0x1;_0x15560b['state']=0x0;_0x15560b['statedesc']=_0x29ac('0x1a3');_0x15560b[_0x29ac('0x12e')]+=0x1;_0x15560b['countglobal']+=0x1;ami[_0x29ac('0x129')]('custom:agentnosuchnumber',ut[_0x29ac('0x118')](_0x170f45,'nosuchnumber'));_0xd909a3=_0x27aa5c[_0x29ac('0x19b')];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils[_0x29ac('0xdf')](_0x15560b)[_0x29ac('0x96')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x297ec6[_0x29ac('0x190')](0x0,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x12e')]>=_0x27aa5c[_0x29ac('0x1a4')]){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1a5'));}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x27aa5c['outboundNoAnswerCallsDay']+=0x1;_0x15560b[_0x29ac('0x68')]=0x3;_0x15560b['statedesc']=_0x29ac('0x1a6');_0x15560b[_0x29ac('0x191')]+=0x1;_0x15560b[_0x29ac('0xce')]+=0x1;var _0x27d605=ut['buildNoAnswerEventPayload'](_0x170f45,_0x27aa5c);ami[_0x29ac('0x129')](_0x29ac('0x1a7'),_0x27d605);_0xd909a3=_0x27aa5c['dialNoAnswerRetryFrequency'];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils['createHistory'](_0x15560b)[_0x29ac('0x96')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x297ec6['checkRetriveMax'](0x3,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x191')]>=_0x27aa5c[_0x29ac('0x192')]){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1a8'));}else{_0x297ec6['stateGlobal'](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1a8'));}}break;case'5':_0x27aa5c[_0x29ac('0x1a9')]+=0x1;_0x15560b[_0x29ac('0x68')]=0x5;_0x15560b[_0x29ac('0x69')]=_0x29ac('0x1aa');_0x15560b[_0x29ac('0x120')]+=0x1;_0x15560b[_0x29ac('0xce')]+=0x1;ami[_0x29ac('0x129')](_0x29ac('0x1ab'),ut['buildObj'](_0x170f45,'busy'));_0xd909a3=_0x27aa5c[_0x29ac('0x196')];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils[_0x29ac('0xdf')](_0x15560b)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1ac')));if(_0x297ec6[_0x29ac('0x190')](0x5,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x120')]>=_0x27aa5c['dialBusyMaxRetry']){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1ad'));}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1ad'));}}break;case'8':_0x27aa5c[_0x29ac('0x1ae')]+=0x1;_0x15560b['state']=0x8;_0x15560b[_0x29ac('0x69')]='Congestion';_0x15560b[_0x29ac('0x12d')]+=0x1;_0x15560b['countglobal']+=0x1;_0xd909a3=_0x27aa5c[_0x29ac('0x199')];_0x286a6a=_0x27aa5c['callAdditionalPhoneAfterMin'];ami['emit'](_0x29ac('0x1af'),ut['buildObj'](_0x170f45,_0x29ac('0x1b0')));hopperUtils[_0x29ac('0xdf')](_0x15560b)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1b1')));if(_0x297ec6['checkRetriveMax'](0x8,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x12d')]>=_0x27aa5c[_0x29ac('0x198')]){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1b2'));}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,'reason\x208\x20congestion');}}break;case'11':_0x27aa5c[_0x29ac('0x1b3')]+=0x1;_0x15560b[_0x29ac('0x68')]=0xb;_0x15560b['statedesc']=_0x29ac('0xe2');_0x15560b[_0x29ac('0xe4')]+=0x1;_0x15560b[_0x29ac('0xce')]+=0x1;_0xd909a3=_0x27aa5c[_0x29ac('0xe5')];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils[_0x29ac('0xdf')](_0x15560b)['catch'](loggerCatch(_0x29ac('0xe9')));if(_0x297ec6['checkRetriveMax'](0xb,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0xe4')]>=_0x27aa5c['dialAbandonedMaxRetry']){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,'reason\x2011\x20abandoned');}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1b4'));}}break;case'20':_0x27aa5c['outboundRejectCallsDay']+=0x1;_0x15560b[_0x29ac('0x68')]=0x14;_0x15560b['statedesc']=_0x29ac('0x1b5');_0x15560b[_0x29ac('0x121')]+=0x1;_0x15560b[_0x29ac('0xce')]+=0x1;_0xd909a3=_0x27aa5c['dialAgentRejectRetryFrequency'];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];ami[_0x29ac('0x129')](_0x29ac('0x1b6'),ut[_0x29ac('0x118')](_0x170f45,'agentreject'));hopperUtils['createHistory'](_0x15560b)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1b7')));if(_0x297ec6[_0x29ac('0x190')](0x14,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b['countagentrejectretry']>=_0x27aa5c[_0x29ac('0x19d')]){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1b8'));}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1b8'));}}break;default:_0x27aa5c['outboundUnknownCallsDay']+=0x1;_0x15560b[_0x29ac('0x68')]=0xc;_0x15560b[_0x29ac('0x69')]=_0x1c2b2f[_0x29ac('0xbe')];_0xd909a3=_0x27aa5c[_0x29ac('0x19e')];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils[_0x29ac('0xdf')](_0x15560b)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1b9')));if(_0x297ec6['checkRetriveMax'](_0x1c2b2f[_0x29ac('0xbe')],_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x120')]+_0x15560b[_0x29ac('0x12d')]+_0x15560b['countnoanswerretry']+_0x15560b[_0x29ac('0x12e')]+_0x15560b['countdropretry']+_0x15560b[_0x29ac('0xe4')]+_0x15560b['countmachineretry']+_0x15560b[_0x29ac('0x121')]>=_0x27aa5c[_0x29ac('0x12f')]){_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,_0x1c2b2f[_0x29ac('0xbe')]);}else{_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x1c2b2f[_0x29ac('0xbe')]);}}}})[_0x29ac('0x93')](function(){if(_0x5e1487){hopperUtils[_0x29ac('0xea')](_0x15560b,_0xd909a3,_0x286a6a)[_0x29ac('0x93')](function(){return _0x3426d7(0x1);});}});});};Dialer[_0x29ac('0x1b')][_0x29ac('0x122')]=function(_0x29ca3c,_0x13b0be,_0xdcf762,_0x4b1081){var _0x1ede7f=new Final(_0x29ca3c);_0x1ede7f[_0x29ac('0x68')]=0xf;_0x1ede7f['statedesc']=_0x29ac('0x1ba');this[_0x29ac('0x125')](_0x1ede7f,_0x13b0be,_0xdcf762,_0x4b1081);};Dialer['prototype']['createStateFinal']=function(_0x598626,_0x54bc23,_0x111add,_0x3155c0){hopperUtils[_0x29ac('0xc2')](_0x598626)['then'](function(){return _0x54bc23(msgResponse(_0x29ac('0x1a0'),_0x29ac('0x10a'),_0x3155c0));})[_0x29ac('0x96')](function(){return _0x111add(msgResponse(_0x29ac('0x1bb'),_0x29ac('0x88'),_0x29ac('0x1bc')));});};Dialer[_0x29ac('0x1b')][_0x29ac('0xa')]=function(_0xf2816d){var _0x493bec=_0xf2816d['dialPredictiveOptimizationPercentage']/0x64;var _0xa0020c=_0xf2816d[_0x29ac('0x1bd')]/(_0xf2816d[_0x29ac('0x1bd')]+_0xf2816d[_0x29ac('0xbd')]);var _0x375fc9=Math[_0x29ac('0x1be')](_0xf2816d[_0x29ac('0x1bf')]*(_0xf2816d[_0x29ac('0x1c0')]/0x64));var _0x1e5536=Math['round'](_0xf2816d[_0x29ac('0x1bf')]*(_0xf2816d['predictiveIntervalMinThreshold']/0x64));var _0x54f8c1=_0xf2816d['available']+_0xf2816d[_0x29ac('0x1c1')];var _0x21e691=Math[_0x29ac('0x1c2')](_0xf2816d['erlangCalls']*_0xf2816d[_0x29ac('0x59')]*_0xf2816d[_0x29ac('0x1c3')]*_0xf2816d['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0xf2816d[_0x29ac('0x27')])){if(!_[_0x29ac('0x3a')](_0xf2816d[_0x29ac('0x5b')])){_0xf2816d[_0x29ac('0x5b')]=undefined;loggerPredictive[_0x29ac('0x5f')](_0x29ac('0x1c4'),_0x29ac('0x1c5'));}if(!_['isUndefined'](_0xf2816d[_0x29ac('0x5d')])){loggerPredictive[_0x29ac('0x5f')]('[startMethodPredictive][StartProgressive]',_0x29ac('0x1c6'));clearInterval(_0xf2816d[_0x29ac('0x5d')]);_0xf2816d[_0x29ac('0x5d')]=undefined;}_0xf2816d['startProgressive']=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));loggerPredictive[_0x29ac('0x44')](_0xf2816d[_0x29ac('0x41')],_0x29ac('0x1c7'),_0xf2816d[_0x29ac('0x27')]);this[_0x29ac('0xa9')](_0xf2816d,0x1);}else if(ifInterval(_0xf2816d[_0x29ac('0x1c8')],_0xf2816d[_0x29ac('0x27')])){this[_0x29ac('0xa9')](_0xf2816d,0x1);loggerPredictiveCalls[_0x29ac('0x44')]('[startMethodPredictive][StartProgressive][Loop]',_0xf2816d[_0x29ac('0x27')],_0xf2816d[_0x29ac('0x41')]);_0xf2816d[_0x29ac('0x1c9')]=0x0;_0xf2816d[_0x29ac('0xc8')]=0x0;}else if(_0x493bec<_0xa0020c&&_0xf2816d[_0x29ac('0x1ca')]===_0x29ac('0x1cb')){clearPredictiveAttributes(_0xf2816d);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x1cc'),_0x29ac('0x1cd'),_0xa0020c,_0x29ac('0x27'),_0xf2816d[_0x29ac('0x41')]);}else if(_0x21e691<_0xf2816d[_0x29ac('0xc8')]&&_0xf2816d[_0x29ac('0x1ca')]===_0x29ac('0x1cb')){clearPredictiveAttributes(_0xf2816d);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x1ce'),_0x29ac('0x1cf'),_0x21e691,'Drop\x20in\x20this\x20interval',_0xf2816d['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0xf2816d[_0x29ac('0x41')]);}else if(!ifInterval(_0xf2816d[_0x29ac('0x1c8')],_0xf2816d[_0x29ac('0x27')])&&_['isUndefined'](_0xf2816d[_0x29ac('0x5b')])&&!_['isUndefined'](_0xf2816d[_0x29ac('0x27')])){_0xf2816d[_0x29ac('0x5b')]=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));loggerPredictive['info'](_0xf2816d[_0x29ac('0x41')],_0x29ac('0x1d0'),_0xf2816d['startPredictive']);hopperUtils[_0x29ac('0x1d1')](_0xf2816d[_0x29ac('0x1c8')])[_0x29ac('0x93')](this[_0x29ac('0x1d2')](_0xf2816d))['then'](mergeDataErlangB(_0xf2816d))[_0x29ac('0x93')](this[_0x29ac('0x1d3')](_0xf2816d))[_0x29ac('0x96')](loggerCatchPredictive(_0x29ac('0x1d4'),_0xf2816d));}else if(!ifInterval(_0xf2816d[_0x29ac('0x1c8')],_0xf2816d[_0x29ac('0x5b')])){_0xf2816d[_0x29ac('0xc8')]=0x0;_0xf2816d[_0x29ac('0x5b')]=moment()['format'](_0x29ac('0xbc'));loggerPredictive[_0x29ac('0x44')](_0xf2816d['name'],_0x29ac('0x1d5'),_0xf2816d[_0x29ac('0x5b')]);clearInterval(_0xf2816d[_0x29ac('0x5d')]);_0xf2816d['handlePredictive']=undefined;hopperUtils[_0x29ac('0x1d1')](_0xf2816d[_0x29ac('0x1c8')])['then'](this['getDataPredictive'](_0xf2816d))['then'](mergeDataErlangB(_0xf2816d))[_0x29ac('0x93')](this['startMethodPredictive'](_0xf2816d))['catch'](loggerCatchPredictive(_0x29ac('0x1d6'),_0xf2816d));}else if(_0xf2816d[_0x29ac('0x1bf')]&&_0x54f8c1<_0xf2816d['predictiveIntervalAvailable']-_0x1e5536){clearPredictiveAttributes(_0xf2816d);loggerPredictive[_0x29ac('0x44')](_0xf2816d[_0x29ac('0x41')],_0x29ac('0x1d7'),_0x54f8c1,')\x20are\x20less\x20than\x20threshold\x20(',_0xf2816d[_0x29ac('0x1bf')],'-',_0x1e5536,'=',_0xf2816d[_0x29ac('0x1bf')]-_0x1e5536,')');}else if(_0xf2816d[_0x29ac('0x1bf')]&&_0x54f8c1>_0xf2816d[_0x29ac('0x1bf')]+_0x375fc9){clearPredictiveAttributes(_0xf2816d);loggerPredictive[_0x29ac('0x44')](_0xf2816d[_0x29ac('0x41')],_0x29ac('0x1d7'),_0x54f8c1,_0x29ac('0x1d8'),_0xf2816d[_0x29ac('0x1bf')],'+',_0x375fc9,'=',_0xf2816d[_0x29ac('0x1bf')]+_0x375fc9,')');}};Dialer[_0x29ac('0x1b')][_0x29ac('0x1d2')]=function(_0x50457f){var _0x562527=this;return function(_0x37be80){return new Promise(function(_0x1148ca,_0x5e8edf){_['merge'](_0x50457f,_0x37be80[0x0]);if(checkGetDataPredictive(_0x37be80[0x0])){var _0x193e8e=_0x50457f[_0x29ac('0x1bf')]=_0x50457f['talking']+_0x50457f[_0x29ac('0x1d9')];var _0x4dc799=_0x50457f[_0x29ac('0x1c8')]*0x3c;var _0x15568b=_0x37be80[0x0][_0x29ac('0x4f')]+_0x37be80[0x0][_0x29ac('0x4d')];var _0x5343d2=(_0x37be80[0x0][_0x29ac('0x47')]+_0x37be80[0x0][_0x29ac('0x49')]+_0x37be80[0x0][_0x29ac('0x4b')])/_0x37be80[0x0][_0x29ac('0x45')];_0x50457f['predictiveIntervalHitRate']=_0x5343d2>0x0?_0x5343d2:0x1;switch(_0x50457f['dialPredictiveOptimization']){case _0x29ac('0x1cb'):var _0xbc3b54=_0x50457f[_0x29ac('0x1da')]/0x64;return _0x562527[_0x29ac('0x1db')](_0x193e8e,_0x4dc799,_0x15568b,_0x5343d2,_0xbc3b54)[_0x29ac('0x93')](function(_0x54a92a){return _0x1148ca(_0x54a92a);});case _0x29ac('0x1dc'):var _0x16c0f7=_0x50457f['dialPredictiveOptimizationPercentage']/0x64;return _0x562527[_0x29ac('0x1dd')](_0x193e8e,_0x4dc799,_0x15568b,_0x5343d2,_0x16c0f7)['then'](function(_0x954f43){return _0x1148ca(_0x954f43);});default:return _0x5e8edf(msgResponse(_0x29ac('0x1de'),_0x29ac('0x88'),_0x29ac('0x1df')));}}else{return _0x5e8edf(msgResponse('[getDataPredictive]',_0x29ac('0x88'),_0x29ac('0x1e0')));}});};};Dialer[_0x29ac('0x1b')][_0x29ac('0x1e1')]=function(_0x223dd8){var _0x58451d=this;return function(_0x55bb34){return new Promise(function(_0x27a2f5,_0x341108){_[_0x29ac('0x5a')](_0x223dd8,_0x55bb34[0x0]);if(checkGetDataPredictive(_0x55bb34[0x0])){loggerPredictive[_0x29ac('0x44')](JSON[_0x29ac('0x6e')](_0x55bb34[0x0]));if(_0x223dd8[_0x29ac('0x1ca')]==='dropRate'){return _0x58451d['getVoiceQueueRtPauses'](_0x223dd8['id'])[_0x29ac('0x93')](function(_0x262d26){var _0x41703a=_0x223dd8[_0x29ac('0x1e2')]-_0x262d26[0x0][_0x29ac('0x1e3')];var _0x581f2d=_0x223dd8[_0x29ac('0x1c8')]*0x3c;var _0x33fbfb=_0x55bb34[0x0][_0x29ac('0x4f')]+_0x55bb34[0x0]['predictiveIntervalAvgHoldtime'];var _0x4b6185=(_0x55bb34[0x0][_0x29ac('0x47')]+_0x55bb34[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x55bb34[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x55bb34[0x0][_0x29ac('0x45')];var _0x399d1b=_0x223dd8[_0x29ac('0x1da')]/0x64;_0x223dd8[_0x29ac('0x1e4')]=_0x262d26[0x0][_0x29ac('0x1e3')]||0x0;_0x223dd8[_0x29ac('0x1c3')]=_0x4b6185>0x0?_0x4b6185:0x1;return _0x58451d['abandonmentRate'](_0x41703a,_0x581f2d,_0x33fbfb,_0x4b6185,_0x399d1b);})[_0x29ac('0x93')](function(_0x1492c7){return _0x27a2f5(_0x1492c7);})[_0x29ac('0x96')](function(_0x2413ee){return _0x341108(msgResponse(_0x29ac('0x1e5'),'Failure',JSON[_0x29ac('0x6e')](_0x2413ee)));});}if(_0x223dd8['dialPredictiveOptimization']===_0x29ac('0x1dc')){return _0x58451d['getVoiceQueueRtPauses'](_0x223dd8['id'])[_0x29ac('0x93')](function(_0x1f3051){var _0x487662=_0x223dd8['loggedIn']-_0x1f3051[0x0][_0x29ac('0x1e3')];var _0x24e091=_0x223dd8[_0x29ac('0x1c8')]*0x3c;var _0xce8244=_0x55bb34[0x0][_0x29ac('0x4f')]+_0x55bb34[0x0][_0x29ac('0x4d')];var _0x46e228=(_0x55bb34[0x0][_0x29ac('0x47')]+_0x55bb34[0x0][_0x29ac('0x49')]+_0x55bb34[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x55bb34[0x0][_0x29ac('0x45')];var _0x1e463b=_0x223dd8['dialPredictiveOptimizationPercentage']/0x64;_0x223dd8[_0x29ac('0x1e4')]=_0x1f3051[0x0]['outboundQueuePauses']||0x0;_0x223dd8['predictiveIntervalHitRate']=_0x46e228>0x0?_0x46e228:0x1;return _0x58451d[_0x29ac('0x1dd')](_0x487662,_0x24e091,_0xce8244,_0x46e228,_0x1e463b);})['then'](function(_0x5a559f){return _0x27a2f5(_0x5a559f);})[_0x29ac('0x96')](function(_0x3fb67f){return _0x341108(msgResponse(_0x29ac('0x1e5'),'Failure',JSON['stringify'](_0x3fb67f)));});}}else{return _0x341108(msgResponse(_0x29ac('0x1de'),_0x29ac('0x88'),'check\x20failure'));}});};};Dialer[_0x29ac('0x1b')]['startMethodPredictive']=function(_0x1d3970){var _0x1bedb1=this;return function(){var _0x1e92db=0x0;var _0x1e70bf=Math[_0x29ac('0x1c2')](_0x1d3970['erlangCallToSecond']*0x3e8);if(_0x1e70bf>0x0){_0x1e70bf=_0x1e70bf<0x64?0x64:_0x1e70bf;loggerPredictive[_0x29ac('0x44')](_0x1d3970[_0x29ac('0x41')],_0x29ac('0x1e6'),_0x1e70bf,_0x29ac('0x1e7'));_0x1d3970['handlePredictive']=setInterval(function(){_0x1bedb1[_0x29ac('0x5d')](_0x1d3970);loggerPredictiveCalls[_0x29ac('0x44')]('[handlePredictive]',_0x1e92db+=0x1);},_0x1e70bf);}else{loggerPredictive[_0x29ac('0x44')](_0x1d3970[_0x29ac('0x41')],_0x29ac('0x1e8'));}};};Dialer['prototype'][_0x29ac('0x1e9')]=function(_0x2a3376,_0x5f1c7a){var _0x5b956f=this;return function(_0x52cf7f){if(_[_0x29ac('0x43')](_0x52cf7f)){if(_[_0x29ac('0xf1')](_0x5f1c7a[_0x29ac('0x15d')])||!_0x5f1c7a['recallme']){if(_0x2a3376[_0x29ac('0xa7')]==='booked'){_0x2a3376[_0x29ac('0x6c')]=_['isUndefined'](_0x2a3376[_0x29ac('0x6c')])?!![]:_0x2a3376[_0x29ac('0x6c')];var _0x3d0016=uuid['v4']();_0x5b956f[_0x29ac('0x25')][_0x3d0016]=new Action(_0x2a3376,_0x5f1c7a,_0x3d0016);loggerBooked[_0x29ac('0x44')](_0x29ac('0x1ea'),_0x3d0016,'queueStatusComplete:\x20',JSON[_0x29ac('0x6e')](_0x2a3376[_0x29ac('0x6c')]),_0x29ac('0x1eb'),_0x2a3376[_0x29ac('0x41')]);if(_0x2a3376[_0x29ac('0x6c')]){_0x2a3376[_0x29ac('0x6c')]=![];_0x5b956f[_0x29ac('0xf5')][_0x5b956f['actions'][_0x3d0016][_0x29ac('0xb7')]]=[];ami[_0x29ac('0x91')]({'actionid':_0x3d0016,'action':_0x29ac('0x1ec'),'queue':_0x2a3376['name']})['catch'](function(){utils[_0x29ac('0xba')](_0x2a3376,'[checkContactBlack]');hopperUtils[_0x29ac('0xd6')]({'active':![],'ContactId':_0x5b956f[_0x29ac('0x25')][_0x3d0016]['ContactId'],'ListId':_0x5b956f[_0x29ac('0x25')][_0x3d0016]['ListId'],'VoiceQueueId':_0x5b956f['actions'][_0x3d0016][_0x29ac('0xda')]||undefined,'CampaignId':_0x5b956f['actions'][_0x3d0016][_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1ed')));delete _0x5b956f[_0x29ac('0x25')][_0x3d0016];});}else{loggerBooked['info'](_0x29ac('0x1ee'),JSON[_0x29ac('0x6e')](_0x2a3376['queueStatusComplete']),_0x29ac('0x1eb'),_0x2a3376[_0x29ac('0x41')]);utils['decrementOriginate'](_0x2a3376,_0x29ac('0x1ef'));hopperUtils[_0x29ac('0xd6')]({'active':![],'ContactId':_0x5b956f[_0x29ac('0x25')][_0x3d0016]['ContactId'],'ListId':_0x5b956f['actions'][_0x3d0016][_0x29ac('0xd9')],'VoiceQueueId':_0x5b956f[_0x29ac('0x25')][_0x3d0016][_0x29ac('0xda')]||undefined,'CampaignId':_0x5b956f[_0x29ac('0x25')][_0x3d0016][_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1ed')));delete _0x5b956f[_0x29ac('0x25')][_0x3d0016];}}else{return _0x5b956f['actionOriginate'](_0x2a3376,_0x5f1c7a);}}else{if(utils[_0x29ac('0xc5')](undefined,_0x5f1c7a[_0x29ac('0x1f0')])<_0x2a3376[_0x29ac('0x1f1')]*0x3c){if(_0x5f1c7a[_0x29ac('0x1f2')]&&!_0x5f1c7a[_0x29ac('0x1f2')][_0x29ac('0x1f3')]){_0x5b956f['preview']['run'](_0x5f1c7a['id'])[_0x29ac('0xfa')](function(){utils[_0x29ac('0xba')](_0x2a3376,'[checkContactBlack]');});}else{hopperUtils['unlockContact']({'active':![]},_0x5f1c7a['id'],0x1)['finally'](function(){utils[_0x29ac('0xba')](_0x2a3376,_0x29ac('0x1ef'));});}}else{_0x2a3376[_0x29ac('0x1f4')]+=0x1;utils[_0x29ac('0xba')](_0x2a3376,_0x29ac('0x1ef'));if(_0x2a3376[_0x29ac('0x1f5')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5f1c7a[_0x29ac('0xd8')],'ListId':_0x5f1c7a['ListId'],'VoiceQueueId':_0x5f1c7a[_0x29ac('0xda')]||undefined,'CampaignId':_0x5f1c7a[_0x29ac('0xdb')]||undefined})['catch'](loggerCatch(_0x29ac('0x1f6')));hopperUtils[_0x29ac('0xdf')](createObjHistory(_0x2a3376,_0x5f1c7a,utils[_0x29ac('0x66')][_0x29ac('0x1f7')],0x17,_0x29ac('0x1f8')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5b956f[_0x29ac('0x11a')](createObjHistory(_0x2a3376,_0x5f1c7a,utils[_0x29ac('0x66')]['RECALL_TIMEOUT'],0x16,_0x29ac('0x1f9')),_0x29ac('0x1fa'),'[Originate][HistoryRecallClose]');}}}}else{_0x2a3376[_0x29ac('0x1fb')]+=0x1;_0x5b956f[_0x29ac('0x11a')](createObjHistory(_0x2a3376,_0x5f1c7a,utils[_0x29ac('0x66')][_0x29ac('0x1fc')],0xd,_0x29ac('0x1fd')),'[Originate][historyBlacklist]',_0x29ac('0x1fe'));throw _0x29ac('0x1ff');}};};Dialer['prototype'][_0x29ac('0x200')]=function(_0xc3e732){var _0x5519dd=this;var _0x240388=_0xc3e732[_0x29ac('0x201')]-_0xc3e732[_0x29ac('0x202')];emitCampaignSummary(_0xc3e732);if(_0x240388>0x0&&_0xc3e732[_0x29ac('0x203')]==0x0){if(_0x240388>this[_0x29ac('0x23')]){_0x240388=this[_0x29ac('0x23')];}_0xc3e732[_0x29ac('0x203')]=0x1;hopperUtils['getContactDialerIvr'](_0xc3e732,_0x240388)[_0x29ac('0x93')](function(_0x175f97){_0xc3e732[_0x29ac('0x203')]=0x0;if(_0x175f97){if(!utils[_0x29ac('0x204')](_0x175f97)){_0xc3e732[_0x29ac('0x65')]=utils['CAMPAIGN_STATUS'][_0x29ac('0x205')];logger[_0x29ac('0x44')](_0x29ac('0x206')+_0xc3e732['name']);}else{_0xc3e732[_0x29ac('0x202')]+=_0x175f97[_0x29ac('0x8f')];_0xc3e732[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x207')];for(var _0x5cc1c8=0x0;_0x5cc1c8<_0x175f97[_0x29ac('0x8f')];_0x5cc1c8+=0x1){_0xc3e732[_0x29ac('0x208')]+=0x1;if(_[_0x29ac('0xf1')](_0x175f97[_0x5cc1c8])||_[_0x29ac('0xf1')](_0x175f97[_0x5cc1c8]['Contact'])||_[_0x29ac('0xf1')](_0x175f97[_0x5cc1c8][_0x29ac('0x165')])){_0x5519dd[_0x29ac('0x15a')]('[actionOriginate]\x20',_0xc3e732,_0x175f97[_0x5cc1c8]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x29ac('0x6f')](_0x175f97[_0x5cc1c8],[_0x29ac('0xdb'),_0x29ac('0x165')]))[_0x29ac('0x93')](_0x5519dd[_0x29ac('0x1e9')](_0xc3e732,_0x175f97[_0x5cc1c8]))[_0x29ac('0x96')](function(_0x2f75a1){logger[_0x29ac('0x5f')](_0x29ac('0x209'),_0x2f75a1);utils[_0x29ac('0xba')](_0xc3e732,_0x29ac('0x20a'));});}}}}})['catch'](function(_0x283e11){_0xc3e732[_0x29ac('0x203')]=0x0;logger['error'](_0x29ac('0x20b'),_0x283e11);});}};Dialer[_0x29ac('0x1b')][_0x29ac('0xa9')]=function(_0x410e37,_0x28e14f){var _0x526ca8=this;var _0x1a4092=[];if(_0x28e14f<0x1||_0x410e37[_0x29ac('0xa7')]===_0x29ac('0x9')){_0x28e14f=0x1;}var _0x4c52de=Math['floor'](_0x410e37[_0x29ac('0x1d9')]*_0x28e14f)-_0x410e37[_0x29ac('0x202')];if(_0x410e37['dialLimitQueue']>0x0){var _0x2d32ec=_0x410e37[_0x29ac('0x20c')]-_0x410e37[_0x29ac('0x202')]-_0x410e37[_0x29ac('0x1c1')]-_0x410e37[_0x29ac('0x20d')];if(_0x4c52de>_0x2d32ec){_0x4c52de=_0x2d32ec;}}if(_0x4c52de>0x0&&_0x410e37[_0x29ac('0x203')]==0x0){if(_0x410e37[_0x29ac('0xa7')]==='booked'){_0x4c52de=0x1;}if(_0x4c52de>this['maxNumberOriginate']){_0x4c52de=this[_0x29ac('0x23')];}for(var _0x113098 in this[_0x29ac('0xf2')]){if(typeof this[_0x29ac('0xf2')][_0x113098]!=='undefined'){if(this[_0x29ac('0xf2')][_0x113098]['state']===_0x29ac('0x20e')&&this[_0x29ac('0xf2')][_0x113098][_0x29ac('0x7e')]==='reachable'){_0x1a4092['push'](this[_0x29ac('0xf2')][_0x113098]['id']);}}}_0x410e37[_0x29ac('0x203')]=0x1;hopperUtils[_0x29ac('0x20f')](_0x410e37,_0x1a4092,_0x4c52de)[_0x29ac('0x93')](function(_0x1e6a8f){_0x410e37[_0x29ac('0x203')]=0x0;if(_0x1e6a8f){if(!utils[_0x29ac('0x204')](_0x1e6a8f)){hopperUtils[_0x29ac('0x210')](_0x410e37)['then'](sendMessageReschedule(_0x410e37))['catch'](loggerCatch(_0x29ac('0x211')));}else{_0x410e37[_0x29ac('0x202')]+=_0x1e6a8f[_0x29ac('0x8f')];_0x410e37[_0x29ac('0x65')]=_0x410e37[_0x29ac('0xa7')]==='booked'?utils[_0x29ac('0x66')]['ACTIVE']:utils[_0x29ac('0x66')][_0x29ac('0x207')];for(var _0x566bd1=0x0;_0x566bd1<_0x1e6a8f[_0x29ac('0x8f')];_0x566bd1+=0x1){if(_[_0x29ac('0xf1')](_0x1e6a8f[_0x566bd1])||_['isNil'](_0x1e6a8f[_0x566bd1]['Contact'])||_[_0x29ac('0xf1')](_0x1e6a8f[_0x566bd1][_0x29ac('0x165')])){_0x526ca8[_0x29ac('0x15a')](_0x29ac('0x212'),_0x410e37,_0x1e6a8f[_0x566bd1]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x1e6a8f[_0x566bd1],['VoiceQueueId','phone']))[_0x29ac('0x93')](_0x526ca8[_0x29ac('0x1e9')](_0x410e37,_0x1e6a8f[_0x566bd1]))[_0x29ac('0x96')](function(_0x2266f1){logger[_0x29ac('0x5f')](_0x29ac('0x213'),_0x2266f1);utils[_0x29ac('0xba')](_0x410e37,_0x29ac('0x214'));});}}}}})[_0x29ac('0x96')](function(_0x200749){_0x410e37[_0x29ac('0x203')]=0x0;logger[_0x29ac('0x5f')](_0x29ac('0x20b'),_0x200749);});}};Dialer[_0x29ac('0x1b')][_0x29ac('0x5d')]=function(_0x5adaed){if(_0x5adaed['dialLimitQueue']>0x0){var _0x126071=_0x5adaed[_0x29ac('0x20c')]-_0x5adaed[_0x29ac('0x202')]-_0x5adaed[_0x29ac('0x1c1')];if(_0x126071>0x0&&_0x5adaed[_0x29ac('0x203')]==0x0){this[_0x29ac('0x215')](_0x5adaed);}else{loggerPredictiveCalls[_0x29ac('0x44')](_0x29ac('0x216'));}}else{this['tryOriginatePredictive'](_0x5adaed);}};Dialer[_0x29ac('0x1b')]['tryOriginatePredictive']=function(_0x4b8c61){var _0x2eb02a=this;var _0x8742ed=[];_0x4b8c61[_0x29ac('0x202')]+=0x1;for(var _0x2db3df in this[_0x29ac('0xf2')]){if(typeof this[_0x29ac('0xf2')][_0x2db3df]!==_0x29ac('0x155')){if(this[_0x29ac('0xf2')][_0x2db3df][_0x29ac('0x68')]===_0x29ac('0x20e')&&this['agents'][_0x2db3df][_0x29ac('0x7e')]===_0x29ac('0x14d')){_0x8742ed[_0x29ac('0x90')](this[_0x29ac('0xf2')][_0x2db3df]['id']);}}}_0x4b8c61[_0x29ac('0x203')]=0x1;return this[_0x29ac('0x20f')](_0x4b8c61['id'],_0x8742ed,0x1,_0x4b8c61[_0x29ac('0x217')],_0x4b8c61)[_0x29ac('0x93')](function(_0x5d3ddb){_0x4b8c61[_0x29ac('0x203')]=0x1;if(_0x5d3ddb){if(!utils[_0x29ac('0x204')](_0x5d3ddb)){utils[_0x29ac('0x218')](_0x4b8c61,0x1,0x0);return hopperUtils[_0x29ac('0x210')](_0x4b8c61)['then'](sendMessageReschedule(_0x4b8c61))[_0x29ac('0x96')](loggerCatch(_0x29ac('0x211')));}else{_0x4b8c61[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x207')];if(_[_0x29ac('0xf1')](_0x5d3ddb[0x0])||_[_0x29ac('0xf1')](_0x5d3ddb[0x0][_0x29ac('0x219')])||_[_0x29ac('0xf1')](_0x5d3ddb[0x0][_0x29ac('0x165')])){_0x2eb02a[_0x29ac('0x15a')]('[actionOriginate]\x20',_0x4b8c61,_0x5d3ddb[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x29ac('0x6f')](_0x5d3ddb[0x0],['VoiceQueueId',_0x29ac('0x165')]))[_0x29ac('0x93')](_0x2eb02a[_0x29ac('0x1e9')](_0x4b8c61,_0x5d3ddb[0x0]))[_0x29ac('0x96')](function(_0x16d766){logger[_0x29ac('0x5f')]('[actionOriginatePredictive]',_0x16d766);utils[_0x29ac('0xba')](_0x4b8c61,'[actionOriginatePredictive]');});}}}})['catch'](function(_0x22413e){_0x4b8c61[_0x29ac('0x203')]=0x0;logger[_0x29ac('0x5f')](_0x29ac('0x20b'),_0x22413e);});};Dialer['prototype'][_0x29ac('0x1db')]=function(_0x112f83,_0x2bde8c,_0x65f107,_0x58d94a,_0x250464,_0x418e6c){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x29ac('0x44')](_0x29ac('0x21a'),_0x112f83);loggerPredictive['info'](_0x29ac('0x21b'),_0x2bde8c);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x21c'),_0x65f107);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58d94a);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x21d'),_0x250464);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x50'));return new Promise(function(_0x9bea16,_0x309915){if(_0x112f83<=0x0||isNaN(_0x112f83)){return _0x309915(msgResponse(_0x29ac('0x21e'),_0x29ac('0x7a'),_0x29ac('0x21f')+_0x112f83));}if(_0x65f107<=0x0||isNaN(_0x65f107)){return _0x309915(msgResponse('[abandonmentRate]','Error',_0x29ac('0x220')+_0x65f107));}if(_0x58d94a<=0x0||isNaN(_0x58d94a)){return _0x309915(msgResponse(_0x29ac('0x21e'),'Error','p\x20=\x20'+_0x58d94a));}if(_0x2bde8c<=0x0||isNaN(_0x2bde8c)){return _0x309915(msgResponse(_0x29ac('0x21e'),_0x29ac('0x7a'),_0x29ac('0x221')+_0x2bde8c));}if(_0x250464<=0x0||isNaN(_0x250464)){return _0x309915(msgResponse(_0x29ac('0x21e'),_0x29ac('0x7a'),_0x29ac('0x222')+_0x250464));}_0x418e6c=_0x418e6c||0x0;var _0x42e485=0x1/_0x65f107;var _0x5ead04=0x0;var _0x357896=0x0;var _0x5425b6=0x0;var _0x384153=0x0;for(var _0x554c53=0x0;_0x5425b6<_0x250464;_0x554c53+=0x1){_0x357896=_0x554c53/_0x2bde8c;_0x5ead04=(_0x58d94a*_0x357896+_0x418e6c)/_0x42e485;_0x5425b6=utils[_0x29ac('0x223')](_0x5ead04,_0x112f83);_0x384153=_0x5ead04/_0x112f83*(0x1-utils['erlangb'](_0x5ead04,_0x112f83));}return _0x9bea16({'erlangCalls':_0x554c53,'erlangCallToSecond':_0x2bde8c/_0x554c53,'erlangAbandonmentRate':_0x5425b6,'erlangBusyFactor':_0x384153});});};Dialer[_0x29ac('0x1b')][_0x29ac('0x1dd')]=function(_0x4ccb51,_0x1785e6,_0x48b3ab,_0x529f5a,_0x541979,_0x2e6f19){loggerPredictive[_0x29ac('0x44')](_0x29ac('0x224'));loggerPredictive['info'](_0x29ac('0x21a'),_0x4ccb51);loggerPredictive['info'](_0x29ac('0x21b'),_0x1785e6);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x21c'),_0x48b3ab);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x225'),_0x529f5a);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x226'),_0x541979);loggerPredictive[_0x29ac('0x44')]('---------------------------');return new Promise(function(_0xdd69be,_0x2c61cb){if(_0x4ccb51<=0x0||isNaN(_0x4ccb51)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),_0x29ac('0x7a'),_0x29ac('0x21f')+_0x4ccb51));}if(_0x48b3ab<=0x0||isNaN(_0x48b3ab)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),_0x29ac('0x7a'),_0x29ac('0x220')+_0x48b3ab));}if(_0x529f5a<=0x0||isNaN(_0x529f5a)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),_0x29ac('0x7a'),'p\x20=\x20'+_0x529f5a));}if(_0x1785e6<=0x0||isNaN(_0x1785e6)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),_0x29ac('0x7a'),'interval\x20=\x20'+_0x1785e6));}if(_0x541979<=0x0||isNaN(_0x541979)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),'Error',_0x29ac('0x228')+_0x541979));}_0x2e6f19=_0x2e6f19||0x0;var _0x897fb3=0x1/_0x48b3ab;var _0x5408e7=0x0;var _0x3d9aa3=0x0;var _0x29966a=0x0;var _0x2d166c=0x0;for(var _0x481ead=0x0;_0x2d166c<_0x541979;_0x481ead+=0x1){_0x3d9aa3=_0x481ead/_0x1785e6;_0x5408e7=(_0x529f5a*_0x3d9aa3+_0x2e6f19)/_0x897fb3;_0x29966a=utils['erlangb'](_0x5408e7,_0x4ccb51);_0x2d166c=_0x5408e7/_0x4ccb51*(0x1-utils[_0x29ac('0x223')](_0x5408e7,_0x4ccb51));}return _0xdd69be({'erlangCalls':_0x481ead,'erlangCallToSecond':_0x1785e6/_0x481ead,'erlangAbandonmentRate':_0x29966a,'erlangBusyFactor':_0x2d166c});});};module[_0x29ac('0x229')]=Dialer; \ No newline at end of file +var _0x7412=['custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','[CatchErlangB]','floor','milliseconds','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','getContactDialer','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[actionOriginatePredictive]','--------\x20Drop\x20Rate\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]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\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]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','isEmpty','info','-----\x20Stats\x20Predictive\x20---','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','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','predictiveIntervalTotalCalls','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','---------------------------','merge','getSeconds','startProgressive','debug','name','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','[ifTime][Action]','Error','active','reachable','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','command','iftime\x20%s,%s','interval','indexOf','true','catch','push','content','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','resolve','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueId','uniqueid','ivr','decrementOriginate','queue','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','dialQueueProject2','createHistory','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','queueCallerAbandonCreateState','additional','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','calleridnum','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','rrmemory','queueBooked','idHopper','status','run','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','custom:amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[rescheduleContact][Machine]','cause-txt','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','[syncHangup]','AnswerAGI','AGI','[syncHangup2]','Normal\x20Clearing','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','dialPreviewRecallmeReminder','filter','online','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','undefined','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','saveInDb','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','user:%s','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumWordLength','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','callAdditionalPhoneAfterMin','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency'];(function(_0x2d7181,_0x54b669){var _0x4055b9=function(_0x35038c){while(--_0x35038c){_0x2d7181['push'](_0x2d7181['shift']());}};_0x4055b9(++_0x54b669);}(_0x7412,0x73));var _0x2741=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x7412[_0x7e2eb0];return _0xd92de4;};'use strict';var util=require(_0x2741('0x0'));var _=require(_0x2741('0x1'));var uuid=require(_0x2741('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x2741('0x3'));var utils=require('./utils');var hopperUtils=require(_0x2741('0x4'));var ut=require(_0x2741('0x5'));var config=require(_0x2741('0x6'));var logger=require(_0x2741('0x7'))(_0x2741('0x8'));var loggerBooked=require('../../../config/logger')(_0x2741('0x9'));var loggerPredictive=require('../../../config/logger')(_0x2741('0xa'));var loggerPredictiveCalls=require(_0x2741('0x7'))(_0x2741('0xb'));var loggerSyncQueueSummary=require(_0x2741('0x7'))(_0x2741('0xc'));var ami=require(_0x2741('0xd'));config[_0x2741('0xe')]=_[_0x2741('0xf')](config[_0x2741('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2741('0xe')]));var cmHopper=require(_0x2741('0x10'));var voiceQueueRt=require(_0x2741('0x11'));var RpcSetting=require(_0x2741('0x12'));var Interval=require(_0x2741('0x13'));var Action=require(_0x2741('0x14'));var History=require(_0x2741('0x15'));var Final=require(_0x2741('0x16'));var AgentComplete=require(_0x2741('0x17'));var QueueCallerAbandon=require(_0x2741('0x18'));var Hangup=require(_0x2741('0x19'));var ipAgi=process[_0x2741('0x1a')]['XCALLY_IP_AGI']||_0x2741('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2741('0x1c')][_0x2741('0x1d')]=function(_0x335d32){this[_0x2741('0x1e')]=this[_0x2741('0x1e')]?this[_0x2741('0x1e')][_0x2741('0x1f')](_0x335d32):_0x335d32();};function Dialer(_0x2274fe,_0x5c8fd5){this['sequence']=new Sequence();this[_0x2741('0x20')]=_0x5c8fd5;this[_0x2741('0x21')]=_0x2274fe[_0x2741('0x21')];this[_0x2741('0x22')]=_0x2274fe['campaigns'];this[_0x2741('0x23')]=_0x2274fe[_0x2741('0x23')];this[_0x2741('0x24')]=_0x2274fe[_0x2741('0x24')];this[_0x2741('0x25')]=config[_0x2741('0x25')]||0x2;this['channels']={};this[_0x2741('0x26')]={};this[_0x2741('0x27')]={};this['uniqueId']={};this[_0x2741('0x28')]={};this[_0x2741('0x29')]={};this['startProgressive']={};this[_0x2741('0x2a')]={};this['queueBooked']={};this[_0x2741('0x2b')]={};this[_0x2741('0x2c')]={};ami['on'](_0x2741('0x2d'),this['syncAgentConnect'][_0x2741('0x2e')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x2741('0x2e')](this));ami['on'](_0x2741('0x2f'),this[_0x2741('0x30')][_0x2741('0x2e')](this));ami['on'](_0x2741('0x31'),this[_0x2741('0x32')][_0x2741('0x2e')](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0x2741('0x33'),this[_0x2741('0x34')][_0x2741('0x2e')](this));ami['on'](_0x2741('0x35'),this[_0x2741('0x36')]['bind'](this));ami['on'](_0x2741('0x37'),this[_0x2741('0x38')][_0x2741('0x2e')](this));ami['on']('varset',this[_0x2741('0x39')][_0x2741('0x2e')](this));ami['on']('queuemember',this[_0x2741('0x3a')][_0x2741('0x2e')](this));ami['on'](_0x2741('0x3b'),this[_0x2741('0x3c')]['bind'](this));this[_0x2741('0x3d')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x2741('0x3e')](function(_0x3e430a){previewRecallmeReminderInterval=_0x3e430a[_0x2741('0x3f')];});}function isNotNull(_0x2b2a1f){return _0x2b2a1f!==null&&!_[_0x2741('0x40')](_0x2b2a1f);}function msgResponse(_0x34b1b1,_0x28dd80,_0x10e9b9){return{'action':_0x34b1b1,'response':_0x28dd80,'message':_0x10e9b9,'stack':_0x10e9b9};}function emit(_0x218458,_0x576fea,_0x116d7d){io['to'](_0x218458)[_0x2741('0x41')](_0x576fea,_0x116d7d);}function emitOutboundVoiceQueueSummary(_0x4a9591){if(_0x4a9591[_0x2741('0x42')]===_0x2741('0x43')){logger['debug'](_0x2741('0x44'),util[_0x2741('0x45')](_0x4a9591,{'showHidden':![],'depth':null}));emit(util[_0x2741('0x46')](_0x2741('0x47'),_0x4a9591['name']),'voice_queue:save',_0x4a9591);}}function checkGetDataPredictive(_0x1cdb7d){if(isNotNull(_0x1cdb7d)&&!_[_0x2741('0x48')](_0x1cdb7d)){loggerPredictive[_0x2741('0x49')](_0x2741('0x4a'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cdb7d['predictiveIntervalTotalCalls']);loggerPredictive[_0x2741('0x49')](_0x2741('0x4b'),_0x1cdb7d[_0x2741('0x4c')]);loggerPredictive['info'](_0x2741('0x4d'),_0x1cdb7d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x2741('0x4e'),_0x1cdb7d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x2741('0x4f'),_0x1cdb7d[_0x2741('0x50')]);loggerPredictive['info'](_0x2741('0x51'),_0x1cdb7d[_0x2741('0x52')]);loggerPredictive['info']('---------------------------');if(_0x1cdb7d[_0x2741('0x53')]>0x0){if(!_[_0x2741('0x40')](_0x1cdb7d['predictiveIntervalAvgTalktime'])&&_0x1cdb7d[_0x2741('0x52')]>0x0){return!![];}loggerPredictive[_0x2741('0x49')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x1cdb7d[_0x2741('0x50')])&&_0x1cdb7d['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x2741('0x49')](_0x2741('0x54'));}else{loggerPredictive[_0x2741('0x49')](_0x2741('0x55'));}}else{loggerPredictive['info'](_0x2741('0x56'));}return![];}function mergeDataErlangB(_0x210c54){return function(_0xf8351c){loggerPredictive['info'](_0x2741('0x57'));loggerPredictive[_0x2741('0x49')](_0x2741('0x58'),_0xf8351c[_0x2741('0x59')]);loggerPredictive['info'](_0x2741('0x5a'),_0xf8351c[_0x2741('0x5b')]);loggerPredictive[_0x2741('0x49')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf8351c[_0x2741('0x5c')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf8351c['erlangBusyFactor']);loggerPredictive[_0x2741('0x49')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf8351c['erlangAbandonmentRate']);loggerPredictive[_0x2741('0x49')](_0x2741('0x5d'));_[_0x2741('0x5e')](_0x210c54,_0xf8351c);};}function ifInterval(_0x5b7049,_0x59a52b){if(_[_0x2741('0x40')](_0x59a52b)){return![];}return utils[_0x2741('0x5f')](undefined,_0x59a52b)<_0x5b7049*0x3c;}function clearPredictiveAttributes(_0x628db2){if(_0x628db2[_0x2741('0x60')]){_0x628db2['startProgressive']=undefined;loggerPredictive[_0x2741('0x61')](_0x628db2[_0x2741('0x62')],_0x2741('0x63'));}if(_0x628db2[_0x2741('0x29')]){_0x628db2[_0x2741('0x29')]=undefined;loggerPredictive['debug'](_0x628db2[_0x2741('0x62')],'startPredictive\x20value\x20cleared');}if(_0x628db2[_0x2741('0x64')]){clearInterval(_0x628db2[_0x2741('0x64')]);_0x628db2['handlePredictive']=undefined;loggerPredictive[_0x2741('0x61')](_0x628db2[_0x2741('0x62')],_0x2741('0x65'));}}function loggerCatchPredictive(_0x37ace2,_0x393b11){return function(_0x12ad19){loggerPredictive[_0x2741('0x66')](_0x393b11[_0x2741('0x62')],_0x37ace2);loggerPredictive[_0x2741('0x66')](_0x12ad19['stack']);clearPredictiveAttributes(_0x393b11);};}function loggerCatch(_0x1bb649){return function(_0x4211cf){logger[_0x2741('0x66')](_0x1bb649,util[_0x2741('0x45')](_0x4211cf,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x393b76){return function(_0x3affc3){if(isNotNull(_0x3affc3)&&isNotNull(_0x3affc3[0x0])){if(_0x3affc3[0x0]['contactsRescheduled']>0x0){_0x393b76[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x69')];logger[_0x2741('0x49')](_0x2741('0x6a')+_0x393b76['name'],_0x3affc3[0x0][_0x2741('0x6b')],_0x2741('0x6c'));}else{_0x393b76['message']=utils[_0x2741('0x68')][_0x2741('0x6d')];logger[_0x2741('0x49')](_0x2741('0x6e')+_0x393b76[_0x2741('0x62')]);}}};}function createObjHistory(_0x437a57,_0x284423,_0x232378,_0x5dd2a4,_0xa13461){_0x437a57[_0x2741('0x67')]=_0x232378;var _0x111a36=new Action(_0x437a57,_0x284423);var _0x20fa6=new History(_0x111a36);_0x20fa6[_0x2741('0x6f')]=_0x5dd2a4;_0x20fa6[_0x2741('0x70')]=_0xa13461;_0x20fa6[_0x2741('0x71')]=_0x111a36[_0x2741('0x72')];return _0x20fa6;}function unlockQueueStatus(_0x2552a0,_0x339b42){setTimeout(function(){if(_[_0x2741('0x40')](_0x2552a0[_0x2741('0x73')])){loggerBooked[_0x2741('0x66')]('[unlockQueueStatus][undefined]',_0x339b42);}_0x2552a0[_0x2741('0x73')]=!![];loggerBooked[_0x2741('0x49')](_0x2741('0x74'),_0x339b42,JSON[_0x2741('0x75')](_[_0x2741('0x76')](_0x2552a0,[_0x2741('0x62'),_0x2741('0x73')])));},0x1f3);}function checkInterval(_0x338442){return function(){if(!isNotNull(_0x338442[_0x2741('0x77')])){_0x338442[_0x2741('0x67')]=utils[_0x2741('0x68')]['NULL_INTERVAL'];throw _0x338442['name']+_0x2741('0x78');}if(!isNotNull(_0x338442[_0x2741('0x77')][_0x2741('0x79')])){_0x338442[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x7a')];throw _0x338442['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2741('0x48')](_0x338442[_0x2741('0x77')][_0x2741('0x79')]))){_0x338442[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x7a')];throw _0x338442['name']+_0x2741('0x78');}};}function checkIsIVRCampaignActive(_0x4bc4c1){return function(){if(!utils[_0x2741('0x7b')](_0x4bc4c1)){_0x4bc4c1[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x7c')];throw _0x4bc4c1['name']+_0x2741('0x7d');}};}function emitCampaignSummary(_0x29d1a5){if(utils[_0x2741('0x7e')](_0x29d1a5)){emit(util[_0x2741('0x46')]('campaign:ivr:%s',_0x29d1a5['name']),_0x2741('0x7f'),_0x29d1a5);}}function loggerCatchQueueSummary(_0x3242f9,_0x180145){return function(_0x195712){clearPredictiveAttributes(_0x180145);emitCampaignSummary(_0x180145);loggerSyncQueueSummary['debug'](_0x3242f9,util['inspect'](_0x195712,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x38ab65){if(_0x38ab65['sendMessageOneNotActive']){if(_0x38ab65[_0x2741('0x80')]===0x0){_0x38ab65[_0x2741('0x81')]=![];_0x38ab65[_0x2741('0x67')]=utils[_0x2741('0x68')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x2741('0x82'),_0x38ab65[_0x2741('0x62')],_0x2741('0x83'));}else{_0x38ab65[_0x2741('0x67')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0x2741('0x61')](_0x2741('0x82'),_0x38ab65[_0x2741('0x62')],'is\x20deactivated');}emitCampaignSummary(_0x38ab65);}}function myreject(_0x437f10){return function(_0x14a382){return _0x437f10(msgResponse(_0x2741('0x84'),_0x2741('0x85'),JSON[_0x2741('0x75')](_0x14a382)));};}Dialer[_0x2741('0x1c')]['isTrunkReachable']=function(_0xc90235){return!_['isUndefined'](_0xc90235)&&_0xc90235&&!_[_0x2741('0x40')](_0xc90235[_0x2741('0x62')])&&!_['isUndefined'](_0xc90235['active'])&&_0xc90235[_0x2741('0x86')]&&(this[_0x2741('0x24')][util[_0x2741('0x46')]('SIP/%s',_0xc90235[_0x2741('0x62')])]['status']===_0x2741('0x87')||this[_0x2741('0x24')][util[_0x2741('0x46')]('SIP/%s',_0xc90235[_0x2741('0x62')])]['status']==='unmonitored');};Dialer[_0x2741('0x1c')][_0x2741('0x88')]=function(_0x162d15){var _0xb2ae98=this;return function(){if(!_0xb2ae98[_0x2741('0x89')](_0x162d15[_0x2741('0x8a')])){if(!_0xb2ae98[_0x2741('0x89')](_0x162d15[_0x2741('0x8b')])){_0x162d15[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x8c')];throw _0x162d15[_0x2741('0x62')]+_0x2741('0x8d');}}};};Dialer['prototype'][_0x2741('0x8e')]=function(_0x3720ef,_0x38e500,_0x15dbee,_0x4efbb3){var _0xbb9bd3=this;return function(){var _0x2c7387=!![];return _0xbb9bd3['ifTimeIvr'](_0x3720ef,_0x38e500,_0x15dbee,_0x4efbb3,_0x2c7387);};};Dialer['prototype'][_0x2741('0x8f')]=function(_0x5c1efd,_0x473030,_0x2bfc66,_0x57799d){var _0x450e3d=this;return function(){var _0x69c84c=![];return _0x450e3d['ifTimeIvr'](_0x5c1efd[_0x2741('0x79')],_0x473030,_0x2bfc66,_0x57799d,_0x69c84c);};};Dialer[_0x2741('0x1c')][_0x2741('0x90')]=function(_0x4f5afc,_0x1d1261,_0xcf9f28,_0x1ed23b,_0x6faa9){var _0x154882=[];return new Promise(function(_0x1c522c,_0x370dc3){if(!isNotNull(_0x4f5afc)){_0x1ed23b[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x7a')];return _0x370dc3(msgResponse(_0x2741('0x91'),_0x2741('0x92'),_0xcf9f28+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x2741('0x48')](_0x4f5afc)){_0x1ed23b[_0x2741('0x67')]=utils['CAMPAIGN_STATUS'][_0x2741('0x93')];return _0x370dc3(msgResponse(_0x2741('0x91'),_0x2741('0x92'),_0xcf9f28+_0x2741('0x94')));}if(_0x1d1261&&_['isUndefined'](config[_0x2741('0x95')][_0x1d1261])){_0x1ed23b[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x96')];return _0x370dc3(msgResponse(_0x2741('0x91'),_0x2741('0x92'),_0xcf9f28+_0x2741('0x97')+_0x1d1261));}if(_[_0x2741('0x98')](_0x4f5afc)){for(var _0x30bbdd=0x0;_0x30bbdd<_0x4f5afc[_0x2741('0x99')];_0x30bbdd+=0x1){_0x154882['push'](ami[_0x2741('0x9a')]({'action':_0x2741('0x9b'),'command':util['format'](_0x2741('0x9c'),_0x4f5afc[_0x30bbdd][_0x2741('0x9d')],!_['isUndefined'](config[_0x2741('0x95')][_0x1d1261])?_0x1d1261:'')})[_0x2741('0x3e')](function(_0x429310){return _0x429310['content'][_0x2741('0x9e')](_0x2741('0x9f'))>=0x0;})[_0x2741('0xa0')](myreject(_0x370dc3)));}}else{_0x154882[_0x2741('0xa1')](ami['Action']({'action':_0x2741('0x9b'),'command':util[_0x2741('0x46')]('iftime\x20%s,%s',_0x4f5afc,!_[_0x2741('0x40')](config[_0x2741('0x95')][_0x1d1261])?_0x1d1261:'')})[_0x2741('0x3e')](function(_0x52d646){return _0x52d646[_0x2741('0xa2')][_0x2741('0x9e')](_0x2741('0x9f'))>=0x0;})[_0x2741('0xa0')](myreject(_0x370dc3)));}Promise[_0x2741('0xa3')](_0x154882)['then'](function(_0x6a9552){var _0x45ec3d=_[_0x2741('0xa4')](_0x6a9552);if(_0x45ec3d){return _0x1c522c(_0x45ec3d);}else{_0x1ed23b['message']=_0x6faa9?utils[_0x2741('0x68')][_0x2741('0xa5')]:utils[_0x2741('0x68')][_0x2741('0xa6')];return _0x370dc3(msgResponse(_0x2741('0xa7'),'Failure',_0x2741('0xa8')+_0x6faa9+'\x20'+_0xcf9f28+_0x2741('0xa9')+util['inspect'](_0x4f5afc,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1d1261));}})['catch'](function(_0x5c5dac){return _0x370dc3(msgResponse(_0x2741('0x91'),_0x2741('0x92'),JSON[_0x2741('0x75')](_0x5c5dac)));});});};Dialer['prototype'][_0x2741('0x3d')]=function(){var _0x2e37a9=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x2e37a9[_0x2741('0xaa')]();},0x3e8);});};Dialer['prototype'][_0x2741('0xaa')]=function(){var _0x42f534=this;var _0x4062dc;for(var _0x3557f8 in this['campaigns']){if(typeof this[_0x2741('0x22')][_0x3557f8]!=='undefined'){_0x4062dc=this['campaigns'][_0x3557f8];if(utils[_0x2741('0x7e')](_0x4062dc)&&utils[_0x2741('0x7b')](_0x4062dc)){_0x4062dc[_0x2741('0x81')]=!![];Promise[_0x2741('0xab')]()['then'](checkIsIVRCampaignActive(_0x4062dc))[_0x2741('0x3e')](checkInterval(_0x4062dc))[_0x2741('0x3e')](_0x42f534['checkIsTrunkReachable'](_0x4062dc))['then'](_0x42f534[_0x2741('0x8e')](_0x4062dc['dialGlobalInterval'],_0x4062dc[_0x2741('0xac')],_0x4062dc[_0x2741('0x62')],_0x4062dc))[_0x2741('0x3e')](_0x42f534[_0x2741('0x8f')](_0x4062dc[_0x2741('0x77')],_0x4062dc[_0x2741('0xac')],_0x4062dc[_0x2741('0x62')],_0x4062dc))[_0x2741('0x3e')](_0x42f534['launchHandleIvr'](_0x4062dc))[_0x2741('0xa0')](loggerCatchQueueSummary(_0x2741('0xad'),_0x4062dc));}else{notSendMessagesCampaign(_0x4062dc);}}}};Dialer[_0x2741('0x1c')][_0x2741('0xae')]=function(_0x256249){if(_0x256249[_0x2741('0xaf')]!==_0x2741('0xa')){clearPredictiveAttributes(_0x256249);}switch(_0x256249['dialMethod']){case _0x2741('0xb0'):this[_0x2741('0xb1')](_0x256249,0x1);break;case _0x2741('0xb2'):this[_0x2741('0xb1')](_0x256249,_0x256249[_0x2741('0xb3')]);break;case _0x2741('0xa'):this[_0x2741('0xa')](_0x256249);break;case _0x2741('0x9'):this[_0x2741('0xb1')](_0x256249,0x1);break;default:logger[_0x2741('0x66')]('Queue',_0x256249[_0x2741('0x62')],_0x2741('0xb4'));}};Dialer[_0x2741('0x1c')][_0x2741('0x91')]=function(_0x55dabf,_0x155265){var _0x17ebc2=_0x55dabf[_0x2741('0xac')];var _0x3b29ac=_0x155265?_0x55dabf['dialGlobalInterval']:_0x55dabf['Interval'][_0x2741('0x79')];logger[_0x2741('0xb5')](_0x2741('0xb6'),_0x3b29ac,_0x17ebc2,_0x55dabf[_0x2741('0x62')],util['format'](_0x2741('0xb7'),_0x55dabf[_0x2741('0x62')],_0x55dabf['id']));var _0x1e8582=null;return Interval[_0x2741('0xb8')](_0x3b29ac,_0x17ebc2)['then'](function(_0x29aaf7){if(_0x29aaf7===!![]){return _0x29aaf7;}else{_0x55dabf[_0x2741('0x67')]=_0x155265?utils[_0x2741('0x68')][_0x2741('0xa5')]:utils[_0x2741('0x68')]['OVERTIME_INTERVAL'];_0x1e8582=msgResponse(_0x2741('0xa7'),_0x2741('0x92'),_0x2741('0xa8')+_0x155265+'\x20'+_0x55dabf[_0x2741('0x62')]+_0x2741('0xa9')+util[_0x2741('0x45')](_0x3b29ac,{'showHidden':![],'depth':null})+_0x2741('0xb9')+_0x17ebc2);}if(_0x1e8582!==null){logger['silly'](_0x2741('0xba'),_0x1e8582);_0x1e8582[_0x2741('0xbb')]=_0x155265;throw _0x1e8582;}})[_0x2741('0xa0')](function(_0x53ef0e){logger[_0x2741('0x66')](_0x2741('0xbc'),_0x53ef0e);throw msgResponse(_0x2741('0x84'),_0x2741('0x85'),util['inspect'](_0x53ef0e,{'showHidden':![],'depth':null}));});};Dialer[_0x2741('0x1c')]['syncAgentConnect']=function(_0x48bf90){if(this[_0x2741('0x21')][_0x48bf90['queue']]){if(this[_0x2741('0xbd')][_0x48bf90[_0x2741('0xbe')]]&&this[_0x2741('0xbd')][_0x48bf90[_0x2741('0xbe')]][_0x2741('0x42')]!==_0x2741('0xbf')){utils[_0x2741('0xc0')](this[_0x2741('0x21')][_0x48bf90[_0x2741('0xc1')]],_0x2741('0xc2'));this['uniqueId'][_0x48bf90[_0x2741('0xbe')]][_0x2741('0xc3')]=moment()[_0x2741('0x46')](_0x2741('0xc4'));}}};Dialer[_0x2741('0x1c')][_0x2741('0x32')]=function(_0x36e8dd){var _0x44a096=this['uniqueId'][_0x36e8dd[_0x2741('0xbe')]];if(this[_0x2741('0x21')][_0x36e8dd[_0x2741('0xc1')]]){if(_0x44a096&&_0x44a096['type']!==_0x2741('0xbf')){delete this['uniqueId'][_0x36e8dd['uniqueid']];this[_0x2741('0x21')][_0x36e8dd[_0x2741('0xc1')]][_0x2741('0xc5')]+=0x1;var _0x5ab808=new AgentComplete(_0x44a096,_0x36e8dd);if(_0x36e8dd['reason']===_0x2741('0xc6')){_0x5ab808['agiafterat']=this[_0x2741('0x21')][_0x36e8dd[_0x2741('0xc1')]][_0x2741('0xc7')]&&this['voiceQueues'][_0x36e8dd[_0x2741('0xc1')]]['dialAgiAfterHangupAgent']?moment()[_0x2741('0x46')](_0x2741('0xc4')):undefined;}hopperUtils[_0x2741('0xc8')](_0x5ab808)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x2741('0xc9')](_0x5ab808)[_0x2741('0xa0')](loggerCatch(_0x2741('0xca')));}}};Dialer[_0x2741('0x1c')][_0x2741('0xcb')]=function(_0x4b508d){var _0xa9fd0a=this[_0x2741('0xbd')][_0x4b508d[_0x2741('0xbe')]];var _0x101fd5=this;var _0x5088d1=![];var _0x46bfc7;var _0x5b7f91;if(this[_0x2741('0x21')][_0x4b508d['queue']]){if(_0xa9fd0a&&_0xa9fd0a[_0x2741('0x42')]!=='ivr'){delete this[_0x2741('0xbd')][_0x4b508d[_0x2741('0xbe')]];utils['decrementOriginate'](this['voiceQueues'][_0x4b508d[_0x2741('0xc1')]],'[syncQueueCallerAbandon]');_0xa9fd0a['droptime']=moment()[_0x2741('0x46')](_0x2741('0xc4'));var _0x3cfcfe=new QueueCallerAbandon(_0xa9fd0a,_0x4b508d);if(utils[_0x2741('0x5f')](_0xa9fd0a['droptime'],_0xa9fd0a[_0x2741('0xcc')])>=_0xa9fd0a[_0x2741('0xcd')]){this[_0x2741('0x21')][_0x4b508d['queue']][_0x2741('0xce')]+=0x1;this[_0x2741('0x21')][_0x4b508d['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x2741('0x21')][_0x4b508d[_0x2741('0xc1')]][_0x2741('0xcf')]+=0x1;_0x3cfcfe[_0x2741('0x6f')]=0xa;_0x3cfcfe[_0x2741('0x70')]='Drop';_0x3cfcfe[_0x2741('0xd0')]=_0x2741('0xd1');_0x3cfcfe[_0x2741('0xd2')]=this[_0x2741('0x21')][_0x4b508d[_0x2741('0xc1')]][_0x2741('0xc7')]?moment()[_0x2741('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x3cfcfe[_0x2741('0xd3')]+=0x1;_0x3cfcfe['countglobal']+=0x1;_0x46bfc7=this[_0x2741('0x21')][_0x4b508d[_0x2741('0xc1')]][_0x2741('0xd4')];_0x5b7f91=this[_0x2741('0x21')][_0x4b508d[_0x2741('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x2741('0xd5')](_0x3cfcfe,_0x3cfcfe[_0x2741('0x6f')],_0xa9fd0a[_0x2741('0xd6')])[_0x2741('0x3e')](function(_0x58e714){_0x5088d1=_0x58e714['additional']==0x1;if(_0x3cfcfe[_0x2741('0xd3')]>=_0x101fd5['voiceQueues'][_0x4b508d[_0x2741('0xc1')]]['dialDropMaxRetry']){_0x101fd5[_0x2741('0xd7')](_0x3cfcfe,_0x58e714[_0x2741('0xd8')]);}else{hopperUtils[_0x2741('0xd9')]({'active':![],'countdropretry':_0x3cfcfe[_0x2741('0xd3')],'scheduledat':moment()[_0x2741('0xda')](_0x101fd5[_0x2741('0x21')][_0x4b508d[_0x2741('0xc1')]][_0x2741('0xd4')],_0x2741('0xdb'))['format'](_0x2741('0xc4')),'ContactId':_0xa9fd0a[_0x2741('0xdc')],'ListId':_0xa9fd0a[_0x2741('0xdd')],'VoiceQueueId':_0xa9fd0a[_0x2741('0xde')]||undefined,'CampaignId':_0xa9fd0a[_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch('[rescheduleContact][Drop]'));var _0x588cb6=new History(_0x3cfcfe);_0x588cb6[_0x2741('0x6f')]=0xa;_0x588cb6[_0x2741('0x70')]='Drop';_0x588cb6[_0x2741('0x72')]=moment()[_0x2741('0x46')](_0x2741('0xc4'));_0x588cb6[_0x2741('0x71')]=_0x588cb6[_0x2741('0x72')];_0x588cb6[_0x2741('0xe0')]=_0x3cfcfe[_0x2741('0xe0')];_0x588cb6['calleridnum']=_0x3cfcfe['calleridnum'];hopperUtils[_0x2741('0xc8')](_0x588cb6)[_0x2741('0xa0')](loggerCatch(_0x2741('0xe1')));}})[_0x2741('0x3e')](function(){if(_0x5088d1)hopperUtils[_0x2741('0xe2')](_0x3cfcfe,_0x46bfc7,_0x5b7f91)['then'](function(){return 0x1;});});}else{this[_0x2741('0x21')][_0x4b508d['queue']][_0x2741('0xe3')]+=0x1;this[_0x2741('0x21')][_0x4b508d[_0x2741('0xc1')]][_0x2741('0xe4')]+=0x1;_0x3cfcfe[_0x2741('0x6f')]=0xb;_0x3cfcfe['statedesc']=_0x2741('0xe5');_0x3cfcfe['dropreason']=_0x2741('0xe6');_0x3cfcfe[_0x2741('0xe7')]+=0x1;_0x3cfcfe[_0x2741('0xe8')]+=0x1;_0x46bfc7=this['voiceQueues'][_0x4b508d['queue']][_0x2741('0xe9')];_0x5b7f91=this[_0x2741('0x21')][_0x4b508d[_0x2741('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x3cfcfe,_0x3cfcfe['state'],_0xa9fd0a[_0x2741('0xd6')])[_0x2741('0x3e')](function(_0x5b1e4b){if(_0x3cfcfe['countabandonedretry']>=_0x101fd5[_0x2741('0x21')][_0x4b508d['queue']][_0x2741('0xea')]){_0x101fd5['queueCallerAbandonCreateState'](_0x3cfcfe,_0x5b1e4b['additional']);}else{hopperUtils[_0x2741('0xd9')]({'active':![],'countabandonedretry':_0x3cfcfe[_0x2741('0xe7')],'scheduledat':moment()[_0x2741('0xda')](_0x101fd5[_0x2741('0x21')][_0x4b508d['queue']]['dialAbandonedRetryFrequency'],_0x2741('0xdb'))[_0x2741('0x46')](_0x2741('0xc4')),'ContactId':_0xa9fd0a[_0x2741('0xdc')],'ListId':_0xa9fd0a[_0x2741('0xdd')],'VoiceQueueId':_0xa9fd0a[_0x2741('0xde')]||undefined,'CampaignId':_0xa9fd0a[_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x40be72=new History(_0x3cfcfe);_0x40be72[_0x2741('0x6f')]=0xb;_0x40be72['statedesc']=_0x2741('0xe5');_0x40be72[_0x2741('0x72')]=moment()[_0x2741('0x46')](_0x2741('0xc4'));_0x40be72[_0x2741('0x71')]=_0x40be72[_0x2741('0x72')];_0x40be72[_0x2741('0xe0')]=_0x3cfcfe[_0x2741('0xe0')];_0x40be72[_0x2741('0xeb')]=_0x3cfcfe['calleridnum'];hopperUtils['createHistory'](_0x40be72)[_0x2741('0xa0')](loggerCatch(_0x2741('0xec')));}})[_0x2741('0x3e')](function(){if(_0x5088d1)hopperUtils['swapAdditionalPhones'](_0x3cfcfe,_0x46bfc7,_0x5b7f91)['then'](function(){return 0x1;});});}}}};Dialer[_0x2741('0x1c')][_0x2741('0x38')]=function(_0x7fd91e){if(this['actions'][_0x7fd91e[_0x2741('0xbe')]]){this[_0x2741('0x26')][_0x7fd91e[_0x2741('0xbe')]][_0x2741('0xed')]=_0x7fd91e[_0x2741('0xed')];}if(this['uniqueId'][_0x7fd91e[_0x2741('0xbe')]]){this['uniqueId'][_0x7fd91e[_0x2741('0xbe')]][_0x2741('0xed')]=_0x7fd91e[_0x2741('0xed')];}};Dialer[_0x2741('0x1c')][_0x2741('0x3a')]=function(_0x242646){if(!this['actions'][_0x242646[_0x2741('0xee')]]){return;}var _0x5ccf6b=this['voiceQueues'][this[_0x2741('0x26')][_0x242646[_0x2741('0xee')]][_0x2741('0xc1')]][_0x2741('0xef')]||'rrmemory';if(_0x5ccf6b===_0x2741('0xf0')){if(this[_0x2741('0x26')][_0x242646[_0x2741('0xee')]]&&_[_0x2741('0xf1')](this[_0x2741('0x26')][_0x242646[_0x2741('0xee')]][_0x2741('0xf2')])&&_0x242646['status']==='1'&&_0x242646[_0x2741('0xf3')]==='0'){if(this[_0x2741('0x23')][_0x242646['stateinterface']]){if(!this[_0x2741('0x23')][_0x242646[_0x2741('0xf4')]]['locked']){this['agents'][_0x242646[_0x2741('0xf4')]][_0x2741('0xf2')]=!![];this[_0x2741('0x26')][_0x242646['actionid']]['locked']=!![];this[_0x2741('0x26')][_0x242646[_0x2741('0xee')]][_0x2741('0xf4')]=_0x242646[_0x2741('0xf4')];}}}}else if(_0x5ccf6b===_0x2741('0xf5')){if(this[_0x2741('0x26')][_0x242646[_0x2741('0xee')]]){if(this[_0x2741('0x23')][_0x242646[_0x2741('0xf4')]]){this[_0x2741('0x26')][_0x242646[_0x2741('0xee')]][_0x2741('0xf4')]=_0x242646[_0x2741('0xf4')];if(_[_0x2741('0xf1')](this[_0x2741('0xf6')][this[_0x2741('0x26')][_0x242646[_0x2741('0xee')]][_0x2741('0xc1')]])){this[_0x2741('0xf6')][this['actions'][_0x242646[_0x2741('0xee')]][_0x2741('0xc1')]]=[];}this[_0x2741('0xf6')][this[_0x2741('0x26')][_0x242646[_0x2741('0xee')]][_0x2741('0xc1')]]['push'](_[_0x2741('0x5e')](_[_0x2741('0x76')](this[_0x2741('0x26')][_0x242646['actionid']],[_0x2741('0xf7'),_0x2741('0xf4')]),{'status':_0x242646[_0x2741('0xf8')],'paused':_0x242646[_0x2741('0xf3')]}));}}}};Dialer[_0x2741('0x1c')][_0x2741('0x3c')]=function(_0x16cc2e){if(!this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]]){return;}var _0x578d3a=this;var _0x22945c=this['voiceQueues'][this['actions'][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]];var _0x1e5f2e=_0x22945c[_0x2741('0xef')]||_0x2741('0xf5');if(_0x1e5f2e===_0x2741('0xf0')){if(this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]]&&this['actions'][_0x16cc2e['actionid']][_0x2741('0xf4')]){this[_0x2741('0x20')][_0x2741('0xf9')](this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]]['idHopper'],this[_0x2741('0x26')][_0x16cc2e['actionid']][_0x2741('0xf4')])[_0x2741('0xa0')](function(_0x11233f){logger[_0x2741('0x66')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x2741('0x45')](_0x11233f,{'showHidden':![],'depth':null}));})[_0x2741('0x1f')](function(){utils['decrementOriginate'](_0x578d3a['voiceQueues'][_0x578d3a['actions'][_0x16cc2e[_0x2741('0xee')]]['queue']],_0x2741('0xfa'));_0x578d3a[_0x2741('0x23')][_0x578d3a[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xf4')]][_0x2741('0xf2')]=![];delete _0x578d3a[_0x2741('0x26')][_0x16cc2e['actionid']];unlockQueueStatus(_0x22945c);});}else{utils[_0x2741('0xc0')](this[_0x2741('0x21')][this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]],_0x2741('0xfa'));hopperUtils[_0x2741('0xd9')]({'active':![],'ContactId':this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]]['ContactId'],'ListId':this['actions'][_0x16cc2e[_0x2741('0xee')]]['ListId'],'VoiceQueueId':this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xde')]||undefined,'CampaignId':this['actions'][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch(_0x2741('0xfb')));delete this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]];unlockQueueStatus(_0x22945c);}}else if(_0x1e5f2e==='rrmemory'){var _0x4efe68;if(this['actions'][_0x16cc2e[_0x2741('0xee')]]&&!_['isEmpty'](this[_0x2741('0xf6')][this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]])){if(this[_0x2741('0x2b')][_0x578d3a['actions'][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]]){this['queueBookedRR'][_0x578d3a[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]]=this['queueBookedRR'][this[_0x2741('0x26')][_0x16cc2e['actionid']][_0x2741('0xc1')]]?this[_0x2741('0x2b')][this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]]:this[_0x2741('0xf6')][this['actions'][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]]?this[_0x2741('0xf6')][this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]][_0x2741('0xfc')]||0x0:0x0;}this['queueBooked'][this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]][_0x2741('0xfc')]=this[_0x2741('0x2b')][this[_0x2741('0x26')][_0x16cc2e[_0x2741('0xee')]][_0x2741('0xc1')]];for(var _0x43c1fe=0x0;_0x43c1fe=_0x292352[_0x2741('0x123')]){_0x308793[_0x2741('0x124')](_0x37f53d,_0x85730a,_0x3419d2,_0x2741('0x125'));}else{if(_0x37f53d[_0x2741('0x11c')]>=_0x292352[_0x2741('0x126')]){_0x308793[_0x2741('0x127')](_0x37f53d,_0x85730a,_0x3419d2,_0x2741('0x128'));}else{hopperUtils[_0x2741('0xd9')]({'active':![],'countmachineretry':_0x37f53d[_0x2741('0x11c')],'scheduledat':moment()['add'](_0x292352[_0x2741('0x129')],_0x2741('0xdb'))[_0x2741('0x46')](_0x2741('0xc4')),'ContactId':_0x37f53d[_0x2741('0xdc')],'ListId':_0x37f53d['ListId'],'VoiceQueueId':_0x37f53d['VoiceQueueId']||undefined,'CampaignId':_0x37f53d[_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch('[rescheduleContact][Machine]'));_0x85730a({'reschedule':0x1});}}});}if(_0x1f89cf[_0x2741('0x42')]==='ivr'&&this[_0x2741('0x22')][_0x1f89cf[_0x2741('0xc1')]][_0x2741('0x10f')]&&_0x94e73a['value']===_0x2741('0x110')){delete this[_0x2741('0xbd')][_0x94e73a[_0x2741('0xbe')]];utils[_0x2741('0xc0')](this[_0x2741('0x22')][_0x1f89cf[_0x2741('0xc1')]],_0x2741('0x111'));_0x2a6213=new Hangup(_0x1f89cf,_0x94e73a);_0x2a6213[_0x2741('0x6f')]=0x12;_0x2a6213[_0x2741('0x70')]='HangupInAMD';_0x2a6213[_0x2741('0x114')]='AMD';ami['emit'](_0x2741('0x12a'),ut[_0x2741('0x11d')](_0x2a6213,_0x2741('0x116')));this['saveInDb'](_0x2a6213,_0x2741('0x12b'),_0x2741('0x12c'));}if(_0x1f89cf[_0x2741('0x42')]==='ivr'&&this[_0x2741('0x22')][_0x1f89cf[_0x2741('0xc1')]]['dialAMDActive']&&_0x94e73a[_0x2741('0x119')]===_0x2741('0x11a')){return new Promise(function(_0xd24bfc,_0x5366fb){delete _0x308793['uniqueId'][_0x94e73a[_0x2741('0xbe')]];utils[_0x2741('0xc0')](_0x308793[_0x2741('0x22')][_0x1f89cf[_0x2741('0xc1')]],_0x2741('0x111'));_0x308793[_0x2741('0x22')][_0x1f89cf['queue']][_0x2741('0xc5')]+=0x1;_0x308793[_0x2741('0x22')][_0x1f89cf[_0x2741('0xc1')]][_0x2741('0x112')]+=0x1;var _0x4c5858=_0x308793[_0x2741('0x22')][_0x1f89cf[_0x2741('0xc1')]];var _0x475277=new Hangup(_0x1f89cf,_0x94e73a);_0x475277[_0x2741('0x6f')]=0x13;_0x475277[_0x2741('0x70')]=_0x2741('0x11b');_0x475277['membername']=_0x2741('0x115');_0x475277[_0x2741('0x11c')]+=0x1;_0x475277['countglobal']+=0x1;_0x475277[_0x2741('0x116')]=!![];ami['emit'](_0x2741('0x12a'),ut[_0x2741('0x11d')](_0x475277,_0x2741('0x116')));hopperUtils[_0x2741('0xc8')](_0x475277)[_0x2741('0xa0')](loggerCatch(_0x2741('0x11e')));if(_0x475277[_0x2741('0x11f')]+_0x475277['countcongestionretry']+_0x475277[_0x2741('0x120')]+_0x475277['countnosuchnumberretry']+_0x475277[_0x2741('0xd3')]+_0x475277['countabandonedretry']+_0x475277[_0x2741('0x11c')]+_0x475277[_0x2741('0x122')]>=_0x4c5858[_0x2741('0x123')]){_0x308793[_0x2741('0x124')](_0x475277,_0xd24bfc,_0x5366fb,'reason19\x20machine....');}else{if(_0x475277[_0x2741('0x11c')]>=_0x4c5858[_0x2741('0x126')]){_0x308793[_0x2741('0x127')](_0x475277,_0xd24bfc,_0x5366fb,_0x2741('0x128'));}else{hopperUtils[_0x2741('0xd9')]({'active':![],'countmachineretry':_0x475277['countmachineretry'],'scheduledat':moment()[_0x2741('0xda')](_0x4c5858[_0x2741('0x129')],'minutes')[_0x2741('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x475277[_0x2741('0xdc')],'ListId':_0x475277[_0x2741('0xdd')],'VoiceQueueId':_0x475277[_0x2741('0xde')]||undefined,'CampaignId':_0x475277[_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch(_0x2741('0x12d')));_0xd24bfc({'reschedule':0x1});}}});}}};Dialer[_0x2741('0x1c')]['syncHangup']=function(_0x34c0ca){var _0x2fbb1a=this['uniqueId'][_0x34c0ca[_0x2741('0xbe')]];var _0x3d28f5;if(!_0x2fbb1a){return;}if(_0x2fbb1a['type']==='ivr'){delete this[_0x2741('0xbd')][_0x34c0ca['uniqueid']];utils[_0x2741('0xc0')](this[_0x2741('0x22')][_0x2fbb1a[_0x2741('0xc1')]],'[syncHangup]');this[_0x2741('0x22')][_0x2fbb1a['queue']]['ivrAnswerCallsDay']+=0x1;if(_0x34c0ca[_0x2741('0x12e')]==='Normal\x20Clearing'){const _0x50ed2e=new AgentComplete(_0x2fbb1a,_0x34c0ca);_0x50ed2e[_0x2741('0xdf')]=this[_0x2741('0x22')][_0x2fbb1a[_0x2741('0xc1')]]['id'];hopperUtils['createHistory'](_0x50ed2e)[_0x2741('0xa0')](loggerCatch(_0x2741('0x12f')));hopperUtils[_0x2741('0xc9')](_0x50ed2e)[_0x2741('0xa0')](loggerCatch(_0x2741('0x130')));}else{_0x3d28f5=new Hangup(_0x2fbb1a,_0x34c0ca);hopperUtils[_0x2741('0xc8')](_0x3d28f5)[_0x2741('0xa0')](loggerCatch(_0x2741('0x131')));hopperUtils[_0x2741('0xc9')](_0x3d28f5)[_0x2741('0xa0')](loggerCatch(_0x2741('0x132')));}}else{if(isNotNull(this[_0x2741('0x21')][_0x2fbb1a[_0x2741('0xc1')]][_0x2741('0x133')])){delete this['uniqueId'][_0x34c0ca[_0x2741('0xbe')]];utils[_0x2741('0xc0')](this[_0x2741('0x21')][_0x2fbb1a['queue']],_0x2741('0x134'));this[_0x2741('0x21')][_0x2fbb1a[_0x2741('0xc1')]][_0x2741('0xc5')]+=0x1;this[_0x2741('0x21')][_0x2fbb1a[_0x2741('0xc1')]][_0x2741('0x112')]+=0x1;_0x3d28f5=new Hangup(_0x2fbb1a,_0x34c0ca);_0x3d28f5['state']=0x10;_0x3d28f5[_0x2741('0x70')]=_0x2741('0x135');_0x3d28f5[_0x2741('0x114')]=_0x2741('0x136');hopperUtils[_0x2741('0xc8')](_0x3d28f5)[_0x2741('0xa0')](loggerCatch(_0x2741('0x131')));hopperUtils[_0x2741('0xc9')](_0x3d28f5)[_0x2741('0xa0')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0x2741('0xbd')][_0x34c0ca['uniqueid']];utils[_0x2741('0xc0')](this[_0x2741('0x21')][_0x2fbb1a[_0x2741('0xc1')]],_0x2741('0x137'));if(_0x34c0ca[_0x2741('0x12e')]===_0x2741('0x138')){this[_0x2741('0x21')][_0x2fbb1a[_0x2741('0xc1')]][_0x2741('0xc5')]+=0x1;const _0x21799a=new AgentComplete(_0x2fbb1a,_0x34c0ca);_0x21799a[_0x2741('0xde')]=this['voiceQueues'][_0x2fbb1a['queue']]['id'];hopperUtils[_0x2741('0xc8')](_0x21799a)[_0x2741('0xa0')](loggerCatch(_0x2741('0x139')));hopperUtils['moveContactManagedDialer'](_0x21799a)[_0x2741('0xa0')](loggerCatch(_0x2741('0xca')));}else{this[_0x2741('0x21')][_0x2fbb1a[_0x2741('0xc1')]][_0x2741('0x13a')]+=0x1;_0x3d28f5=new Hangup(_0x2fbb1a,_0x34c0ca);_0x3d28f5['state']=0xc;_0x3d28f5[_0x2741('0x70')]=_0x34c0ca[_0x2741('0x12e')];_0x3d28f5[_0x2741('0x114')]='Unknown';hopperUtils['createHistory'](_0x3d28f5)['catch'](loggerCatch('[syncHangup][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x3d28f5)['catch'](loggerCatch('[syncHangup]'));}}}};Dialer[_0x2741('0x1c')][_0x2741('0xc')]=function(_0xeb0661){var _0x2ce9c4=this;if(!_0x2ce9c4['queuesSummary'][_0xeb0661[_0x2741('0x62')]]){_0x2ce9c4[_0x2741('0x2c')][_0xeb0661[_0x2741('0x62')]]={'running':![]};}else if(_0x2ce9c4[_0x2741('0x2c')][_0xeb0661[_0x2741('0x62')]][_0x2741('0x13b')]===!![]){return;}else if(_0x2ce9c4[_0x2741('0x2c')][_0xeb0661[_0x2741('0x62')]]['running']===![]){_0x2ce9c4[_0x2741('0x2c')][_0xeb0661[_0x2741('0x62')]][_0x2741('0x13b')]=!![];}var _0x3d827a=_0x2ce9c4[_0x2741('0x21')][_0xeb0661[_0x2741('0x62')]];var _0x306688=_0x3d827a['message']!==utils[_0x2741('0x68')][_0x2741('0x7c')];var _0x202ea4=utils[_0x2741('0x13c')](_0x3d827a);_0x3d827a['statusMessage']=utils[_0x2741('0x13d')](_0x3d827a,_0x2ce9c4[_0x2741('0x24')]);Promise[_0x2741('0xab')]()[_0x2741('0x3e')](function(){if(_0x3d827a[_0x2741('0x13e')]===utils[_0x2741('0x68')]['INACTIVE']){if(_0x306688){clearPredictiveAttributes(_0x3d827a);_0xeb0661[_0x2741('0x29')]=undefined;_0xeb0661[_0x2741('0x60')]=undefined;}if(_0x3d827a[_0x2741('0x13e')]===utils[_0x2741('0x68')][_0x2741('0x7c')]){_0xeb0661[_0x2741('0x13f')]=0x0;_0xeb0661[_0x2741('0xf3')]=0x0;_0xeb0661[_0x2741('0x140')]=0x0;_0xeb0661['talking']=0x0;_0xeb0661[_0x2741('0x141')]=0x0;}}else if(_0x3d827a[_0x2741('0x13e')]===utils['CAMPAIGN_STATUS'][_0x2741('0x142')]&&!_0x202ea4){return _0x2ce9c4['ifTime'](_0x3d827a,!![])['then'](function(){return _0x2ce9c4['ifTime'](_0x3d827a,![]);})[_0x2741('0x3e')](function(){return _0x2ce9c4['checkDialMethod'](_0x3d827a);})['catch'](function(_0x3049f7){loggerSyncQueueSummary[_0x2741('0x61')]('[syncQueueSummary]',util[_0x2741('0x45')](_0x3049f7,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3d827a);});}else{clearPredictiveAttributes(_0x3d827a);}})[_0x2741('0x3e')](function(){var _0x56f8b9=_0xeb0661[_0x2741('0x143')](_0x3d827a);if(_0x56f8b9||_0x3d827a[_0x2741('0x144')]){_0x3d827a[_0x2741('0x144')]=![];_0xeb0661[_0x2741('0x145')](_0x3d827a);Object[_0x2741('0x146')](_0x3d827a,_0xeb0661);emitOutboundVoiceQueueSummary(_0xeb0661);}_0x2ce9c4['queuesSummary'][_0x3d827a['name']][_0x2741('0x13b')]=![];})[_0x2741('0xa0')](function(_0x15900c){logger[_0x2741('0x66')](_0x2741('0x147'),util['inspect'](_0x15900c,{'showHidden':![],'depth':null}));_0x2ce9c4[_0x2741('0x2c')][_0x3d827a[_0x2741('0x62')]]['running']=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x6ff3b1=_['filter'](this['voiceQueues'],function(_0x78537f){return _0x78537f[_0x2741('0x148')];});var _0x4dad20=_[_0x2741('0x149')](this[_0x2741('0x23')],function(_0xd4deb8){return _0xd4deb8[_0x2741('0x14a')]&&_0xd4deb8[_0x2741('0xf8')]===_0x2741('0x87');});if(_0x6ff3b1[_0x2741('0x99')]>0x0&&_0x4dad20[_0x2741('0x99')]>0x0){return Promise[_0x2741('0xab')]()[_0x2741('0x3e')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x6ff3b1,'id'),previewRecallmeReminderInterval,_[_0x2741('0x14b')](_0x4dad20,'id')))['then'](function(_0x1546ee){for(var _0x363e02=0x0;_0x363e02<_0x1546ee[_0x2741('0x99')];_0x363e02++){var _0xc73f85=_0x1546ee[_0x363e02][_0x2741('0x14c')][_0x2741('0x62')];if(_0xc73f85)io['to'](util[_0x2741('0x46')]('user:%s',_0xc73f85))[_0x2741('0x41')](_0x2741('0x14d'),{'hopper':_0x1546ee[_0x363e02]});}})[_0x2741('0xa0')](function(_0x4ca964){logger[_0x2741('0x66')](_0x2741('0x14e'),_0x4ca964);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x2741('0x14f')]=function(){var _0x493bd8=this;setInterval(function(){_0x493bd8[_0x2741('0x150')](_0x493bd8[_0x2741('0xbd')],_0x2741('0x151'));_0x493bd8[_0x2741('0x150')](_0x493bd8['actions'],_0x2741('0x152'));},0x32c8);};Dialer['prototype'][_0x2741('0x150')]=function(_0xec9397,_0x1c9b9f){var _0x2ad4ff=this;for(var _0x92ace8 in _0xec9397){if(typeof _0xec9397[_0x92ace8]!==_0x2741('0x153')){this[_0x2741('0x154')][_0x2741('0x1d')](function(){if(!_['isNil'](_0xec9397[_0x92ace8])){return ami[_0x2741('0x9a')]({'action':_0x2741('0xf8'),'channel':_0xec9397[_0x92ace8][_0x2741('0xed')]})[_0x2741('0xa0')](function(_0x4146e8){if(_0x4146e8['message']===_0x2741('0x155')){setTimeout(function(){if(_0xec9397[_0x92ace8]&&_0xec9397[_0x92ace8][_0x2741('0x42')]!=='ivr'){utils['decrementOriginate'](_0x2ad4ff[_0x2741('0x21')][_0xec9397[_0x92ace8][_0x2741('0xc1')]],'[clearZombieChannels]');logger[_0x2741('0x66')](_0x2741('0x156'),_0x1c9b9f,_0x92ace8,_0xec9397[_0x92ace8][_0x2741('0xc1')]);delete _0xec9397[_0x92ace8];}if(_0xec9397[_0x92ace8]&&_0xec9397[_0x92ace8]['type']===_0x2741('0xbf')){utils[_0x2741('0xc0')](_0x2ad4ff[_0x2741('0x22')][_0xec9397[_0x92ace8][_0x2741('0xc1')]],_0x2741('0x157'));logger[_0x2741('0x66')](_0x2741('0x158'),_0x1c9b9f,_0x92ace8,_0xec9397[_0x92ace8][_0x2741('0xc1')]);delete _0xec9397[_0x92ace8];}},0x2328);}});}});}}};Dialer[_0x2741('0x1c')][_0x2741('0x159')]=function(_0x4a055d){return Promise[_0x2741('0xab')]()[_0x2741('0x3e')](voiceQueueRt[_0x2741('0x159')](_0x4a055d))[_0x2741('0xa0')](loggerCatch(_0x2741('0x15a')));};Dialer[_0x2741('0x1c')][_0x2741('0x15b')]=function(_0x5ec4a5,_0x172dc1,_0x1d0d53){var _0x2747e1={'state':0x19,'statedesc':_0x2741('0x15c')};utils[_0x2741('0xc0')](_0x172dc1,_0x2741('0x15d')+_0x5ec4a5);this['saveInDb'](_[_0x2741('0x5e')](_0x2747e1,_['pick'](_0x1d0d53,[_0x2741('0xdc'),_0x2741('0xdd'),_0x2741('0x15e'),_0x2741('0xde'),_0x2741('0xdf')])),_0x2741('0x15f'),_0x2741('0x15d'));logger[_0x2741('0x66')](_0x5ec4a5);};Dialer[_0x2741('0x1c')][_0x2741('0x160')]=function(_0x2a9525,_0xe60001,_0x4da3f5){hopperUtils['createHistory'](_0x2a9525)[_0x2741('0xa0')](loggerCatch(_0xe60001));hopperUtils['moveContactManagedDialer'](_0x2a9525)['catch'](loggerCatch(_0x4da3f5));};Dialer[_0x2741('0x1c')][_0x2741('0xd7')]=function(_0x5a6d5f,_0x37dd35){hopperUtils[_0x2741('0xc8')](_0x5a6d5f)['catch'](loggerCatch(_0x2741('0x139')));if(_0x37dd35==0x0){hopperUtils[_0x2741('0xc9')](_0x5a6d5f)[_0x2741('0xa0')](loggerCatch(_0x2741('0x161')));}};Dialer[_0x2741('0x1c')][_0x2741('0x14e')]=function(_0x408cf2){return Promise[_0x2741('0xab')]()[_0x2741('0x3e')](cmHopper[_0x2741('0x162')](_0x408cf2['id'],previewRecallmeReminderInterval))[_0x2741('0x3e')](function(_0x3587b7){for(var _0x38c6b9=0x0;_0x38c6b9<_0x3587b7['length'];_0x38c6b9++){var _0x3d056f=_0x3587b7[_0x38c6b9][_0x2741('0x14c')]['name'];if(_0x3d056f)io['to'](util[_0x2741('0x46')](_0x2741('0x163'),_0x3d056f))['emit'](_0x2741('0x14d'),{'hopper':_0x3587b7[_0x38c6b9]});}})['catch'](function(){});};Dialer[_0x2741('0x1c')][_0x2741('0x164')]=function(_0x1898df){var _0xd7297e=this;return function(){_0xd7297e[_0x2741('0x165')](_0x1898df);};};Dialer[_0x2741('0x1c')][_0x2741('0x166')]=function(_0xc35311,_0x36472c){var _0x148acd=this;var _0x46a2b9=uuid['v4']();this[_0x2741('0x26')][_0x46a2b9]=new Action(_0xc35311,_0x36472c,_0x46a2b9);return new Promise(function(_0x380437,_0x24152c){if(_[_0x2741('0x40')](_0xc35311)&&typeof _0xc35311!==_0x2741('0x167')){return _0x24152c(msgResponse(_0x2741('0x168'),'Failure',_0x2741('0x169')));}if(_[_0x2741('0x40')](_0x36472c[_0x2741('0x16a')])||_0x36472c[_0x2741('0x16a')]===null){return _0x24152c(msgResponse(_0x2741('0x168'),_0x2741('0x92'),_0x2741('0x16b')));}var _0x2377c5={'XMD-CALLERID':_0x148acd[_0x2741('0x26')][_0x46a2b9][_0x2741('0x16c')](),'XMD-AGI':_0xc35311[_0x2741('0x133')]?util[_0x2741('0x46')](_0x2741('0x16d'),ipAgi,_0xc35311[_0x2741('0x133')]):_0x2741('0x16e'),'XMD-AGIAFTER':_0xc35311[_0x2741('0xc7')]?util[_0x2741('0x46')]('\x22agi://%s/square,%s\x22',ipAgi,_0xc35311[_0x2741('0xc7')]):_0x2741('0x16e'),'XMD-QUEUE':utils['isOutboundQueue'](_0xc35311)?util[_0x2741('0x46')]('\x22%s,%s%s,,,%s\x22',_0xc35311[_0x2741('0x62')],_0xc35311[_0x2741('0x16f')]||'',_0xc35311[_0x2741('0x170')]?'c':'',_0xc35311[_0x2741('0xcd')]||0x3):'NONE','XMD-CONTACTID':_0x36472c[_0x2741('0xdc')],'XMD-CDRTYPE':_0x2741('0x8'),'CALLERID(all)':_0x148acd['actions'][_0x46a2b9][_0x2741('0x16c')](),'XMD-AMD':_0xc35311[_0x2741('0x10f')]?_0x2741('0x142'):_0x2741('0x16e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xc35311[_0x2741('0x10f')]){_0x2377c5[_0x2741('0x171')]=_0xc35311[_0x2741('0x172')]||0x9c4;_0x2377c5[_0x2741('0x173')]=_0xc35311[_0x2741('0x174')]||0x5dc;_0x2377c5['XMD-AMDAFTERGREETINGSILENCE']=_0xc35311[_0x2741('0x175')]||0x320;_0x2377c5[_0x2741('0x176')]=_0xc35311[_0x2741('0x177')]||0x1388;_0x2377c5['XMD-AMDMINWORDLENGTH']=_0xc35311[_0x2741('0x178')]||0x64;_0x2377c5['XMD-AMDBETWEENWORDSSILENCE']=_0xc35311['dialAMDBetweenWordsSilence']||0x32;_0x2377c5[_0x2741('0x179')]=_0xc35311['dialAMDMaximumNumberOfWords']||0x3;_0x2377c5['XMD-AMDSILENCETHRESHOLD']=_0xc35311['dialAMDSilenceThreshold']||0x100;_0x2377c5['XMD-AMDMAXIMUMWORDLENGTH']=_0xc35311[_0x2741('0x17a')]||0x1388;}if(utils[_0x2741('0x17b')](_0xc35311)){_0x2377c5['XMD-VOICEQUEUEID']=_0x36472c[_0x2741('0xde')];}else{_0x2377c5[_0x2741('0x17c')]=_0x36472c[_0x2741('0xdf')];}var _0x54ba79=utils[_0x2741('0x17d')](_0x36472c[_0x2741('0x17e')]);Object[_0x2741('0x146')](_0x2377c5,_0x54ba79);var _0x5eff37=_0x148acd['isTrunkReachable'](_0xc35311[_0x2741('0x8a')])?utils['getCallerId'](_0xc35311[_0x2741('0x8a')][_0x2741('0x17f')],_0xc35311[_0x2741('0x180')],_0xc35311[_0x2741('0x181')]>0x0?utils[_0x2741('0x182')](_0xc35311['dialOriginateCallerIdNumber'],_0xc35311['dialRandomLastDigitCallerIdNumber']):_0xc35311[_0x2741('0x183')]):utils['getCallerId'](_[_0x2741('0xf1')](_0xc35311[_0x2741('0x8b')])?_0xc35311[_0x2741('0x8a')][_0x2741('0x17f')]:_0xc35311['TrunkBackup'][_0x2741('0x17f')],_0xc35311['dialOriginateCallerIdName'],_0xc35311[_0x2741('0x181')]>0x0?utils[_0x2741('0x182')](_0xc35311[_0x2741('0x183')],_0xc35311[_0x2741('0x181')]):_0xc35311[_0x2741('0x183')]);if(_0x5eff37){_0x2377c5[_0x2741('0x184')]=_0x148acd['actions'][_0x46a2b9][_0x2741('0x185')]=utils[_0x2741('0x186')](_0x5eff37);_0x2377c5[_0x2741('0x187')]=_0x36472c[_0x2741('0x16a')];}_0xc35311[_0x2741('0x188')]=_0x2377c5;return ami[_0x2741('0x9a')]({'actionid':_0x46a2b9,'action':_0x2741('0x168'),'channel':_0x148acd['isTrunkReachable'](_0xc35311[_0x2741('0x8a')])?util['format'](_0x2741('0x189'),_0xc35311['Trunk']['name'],isNotNull(_0xc35311['dialPrefix'])?_0xc35311['dialPrefix'][_0x2741('0x18a')]()||'':'',_0xc35311[_0x2741('0x18b')]>0x0?_0x36472c[_0x2741('0x16a')][_0x2741('0x18c')](_0xc35311[_0x2741('0x18b')]):_0x36472c[_0x2741('0x16a')]):util[_0x2741('0x46')](_0x2741('0x189'),_[_0x2741('0xf1')](_0xc35311[_0x2741('0x8b')])?_0xc35311[_0x2741('0x8a')][_0x2741('0x62')]:_0xc35311['TrunkBackup'][_0x2741('0x62')],isNotNull(_0xc35311[_0x2741('0x18d')])?_0xc35311['dialPrefix'][_0x2741('0x18a')]()||'':'',_0xc35311['dialCutDigit']>0x0?_0x36472c[_0x2741('0x16a')][_0x2741('0x18c')](_0xc35311[_0x2741('0x18b')]):_0x36472c[_0x2741('0x16a')]),'callerid':_0x5eff37,'Exten':_0x2741('0x10e'),'Context':_0x2741('0x18e'),'Priority':'1','variable':_0x2377c5,'timeout':(_0xc35311['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x46a2b9})[_0x2741('0x3e')](function(_0x2e7fa4){return _0x380437(_0x2e7fa4);})[_0x2741('0xa0')](function(_0xda5922){_0xc35311[_0x2741('0x18f')]+=0x1;var _0x2c8fe5=new History(_0x148acd[_0x2741('0x26')][_0x46a2b9]);logger[_0x2741('0x66')](util[_0x2741('0x46')](_0x2741('0x190'),JSON[_0x2741('0x75')](_0xda5922)));_0x2c8fe5['state']=0xe;_0x2c8fe5[_0x2741('0x70')]=_0x2741('0x191');_0x2c8fe5['starttime']=moment()[_0x2741('0x46')](_0x2741('0xc4'));_0x2c8fe5[_0x2741('0x71')]=_0x2c8fe5['starttime'];hopperUtils[_0x2741('0xc8')](_0x2c8fe5)[_0x2741('0xa0')](loggerCatch('[originate][error]'));_0x148acd[_0x2741('0xc9')](_0x2c8fe5)['catch'](loggerCatch(_0x2741('0x192')))[_0x2741('0x1f')](function(){delete _0x148acd[_0x2741('0x26')][_0x46a2b9];return _0x24152c(msgResponse(_0x2741('0x168'),_0x2741('0x85'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x2741('0x193')]=function(_0x92413,_0x119675,_0x4db893){var _0x53e3e4=new History(_0x119675);if(_0x53e3e4[_0x2741('0x11f')]+_0x53e3e4[_0x2741('0x194')]+_0x53e3e4[_0x2741('0x120')]+_0x53e3e4[_0x2741('0x121')]+_0x53e3e4['countdropretry']+_0x53e3e4[_0x2741('0xe7')]+_0x53e3e4['countmachineretry']+_0x53e3e4[_0x2741('0x122')]>=_0x4db893[_0x2741('0x123')]-0x1){return!![];}switch(_0x92413){case 0x3:if(_0x53e3e4[_0x2741('0x120')]>=_0x4db893[_0x2741('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x53e3e4['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x2741('0xda')](_0x4db893[_0x2741('0x196')],'minutes')[_0x2741('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53e3e4['ContactId'],'ListId':_0x53e3e4['ListId'],'VoiceQueueId':_0x53e3e4[_0x2741('0xde')]||undefined,'CampaignId':_0x53e3e4[_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x53e3e4['countbusyretry']>=_0x4db893[_0x2741('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x53e3e4[_0x2741('0x11f')]+=0x1,'scheduledat':moment()[_0x2741('0xda')](_0x4db893['dialBusyRetryFrequency'],'minutes')['format'](_0x2741('0xc4')),'ContactId':_0x53e3e4[_0x2741('0xdc')],'ListId':_0x53e3e4[_0x2741('0xdd')],'VoiceQueueId':_0x53e3e4[_0x2741('0xde')]||undefined,'CampaignId':_0x53e3e4['CampaignId']||undefined})['catch'](loggerCatch(_0x2741('0x198')));break;case 0x8:if(_0x53e3e4['countcongestionretry']>=_0x4db893[_0x2741('0x199')]-0x1){return!![];}hopperUtils[_0x2741('0xd9')]({'active':![],'countcongestionretry':_0x53e3e4[_0x2741('0x194')]+=0x1,'scheduledat':moment()[_0x2741('0xda')](_0x4db893['dialCongestionRetryFrequency'],_0x2741('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53e3e4[_0x2741('0xdc')],'ListId':_0x53e3e4['ListId'],'VoiceQueueId':_0x53e3e4[_0x2741('0xde')]||undefined,'CampaignId':_0x53e3e4[_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch(_0x2741('0x19a')));break;case 0x0:if(_0x53e3e4['countnosuchnumberretry']>=_0x4db893['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x2741('0xd9')]({'active':![],'countnosuchnumberretry':_0x53e3e4[_0x2741('0x121')]+=0x1,'scheduledat':moment()['add'](_0x4db893[_0x2741('0x19b')],_0x2741('0xdb'))[_0x2741('0x46')](_0x2741('0xc4')),'ContactId':_0x53e3e4[_0x2741('0xdc')],'ListId':_0x53e3e4[_0x2741('0xdd')],'VoiceQueueId':_0x53e3e4['VoiceQueueId']||undefined,'CampaignId':_0x53e3e4['CampaignId']||undefined})[_0x2741('0xa0')](loggerCatch(_0x2741('0x19c')));}break;case 0xa:if(_0x53e3e4['countdropretry']>=_0x4db893[_0x2741('0x19d')]-0x1){return!![];}hopperUtils[_0x2741('0xd9')]({'active':![],'countdropretry':_0x53e3e4['countdropretry']+=0x1,'scheduledat':moment()[_0x2741('0xda')](_0x4db893['dialDropRetryFrequency'],'minutes')[_0x2741('0x46')](_0x2741('0xc4')),'ContactId':_0x53e3e4['ContactId'],'ListId':_0x53e3e4['ListId'],'VoiceQueueId':_0x53e3e4[_0x2741('0xde')]||undefined,'CampaignId':_0x53e3e4[_0x2741('0xdf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x53e3e4['countabandonedretry']>=_0x4db893[_0x2741('0xea')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x53e3e4[_0x2741('0xe7')]+=0x1,'scheduledat':moment()[_0x2741('0xda')](_0x4db893['dialAbandonedRetryFrequency'],_0x2741('0xdb'))[_0x2741('0x46')](_0x2741('0xc4')),'ContactId':_0x53e3e4['ContactId'],'ListId':_0x53e3e4[_0x2741('0xdd')],'VoiceQueueId':_0x53e3e4[_0x2741('0xde')]||undefined,'CampaignId':_0x53e3e4['CampaignId']||undefined})[_0x2741('0xa0')](loggerCatch(_0x2741('0x19e')));break;case 0x13:if(_0x53e3e4[_0x2741('0x11c')]>=_0x4db893[_0x2741('0x126')]-0x1){return!![];}hopperUtils[_0x2741('0xd9')]({'active':![],'countmachineretry':_0x53e3e4['countmachineretry']+=0x1,'scheduledat':moment()[_0x2741('0xda')](_0x4db893[_0x2741('0x129')],'minutes')[_0x2741('0x46')](_0x2741('0xc4')),'ContactId':_0x53e3e4[_0x2741('0xdc')],'ListId':_0x53e3e4[_0x2741('0xdd')],'VoiceQueueId':_0x53e3e4['VoiceQueueId']||undefined,'CampaignId':_0x53e3e4[_0x2741('0xdf')]||undefined})['catch'](loggerCatch(_0x2741('0x12d')));break;case 0x14:if(_0x53e3e4[_0x2741('0x122')]>=_0x4db893['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x2741('0xd9')]({'active':![],'countagentrejectretry':_0x53e3e4[_0x2741('0x122')]+=0x1,'scheduledat':moment()[_0x2741('0xda')](_0x4db893[_0x2741('0x19f')],_0x2741('0xdb'))[_0x2741('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53e3e4['ContactId'],'ListId':_0x53e3e4[_0x2741('0xdd')],'VoiceQueueId':_0x53e3e4['VoiceQueueId']||undefined,'CampaignId':_0x53e3e4[_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x2741('0x1c')][_0x2741('0x109')]=function(_0xe231e4,_0x3d0242,_0x3c8000){var _0x3b6855=this;var _0x4bec0d=new History(_0xe231e4);var _0x5d61ec=![];var _0x4bc03a;var _0x43a43b;return new Promise(function(_0x1e33ee,_0x3d618e){if(_['isUndefined'](_0x3d0242)&&typeof _0x3d0242!==_0x2741('0x167')){return _0x3d618e(msgResponse(_0x2741('0x1a0'),'Failure',_0x2741('0x1a1')));}if(_[_0x2741('0x40')](_0x3c8000)&&typeof _0x3c8000!==_0x2741('0x167')){return _0x3d618e(msgResponse(_0x2741('0x1a0'),_0x2741('0x92'),'evt\x20is\x20undefine'));}hopperUtils[_0x2741('0xd5')](_0x4bec0d,_0x3c8000[_0x2741('0x1a2')],_0x3d0242)[_0x2741('0x3e')](function(_0x502d67){if(_0x502d67[_0x2741('0xd8')]==0x1)_0x5d61ec=!![];switch(_0x3c8000[_0x2741('0x1a2')]){case'0':_0x3d0242[_0x2741('0x1a3')]+=0x1;_0x4bec0d[_0x2741('0x6f')]=0x0;_0x4bec0d['statedesc']=_0x2741('0x1a4');_0x4bec0d['countnosuchnumberretry']+=0x1;_0x4bec0d[_0x2741('0xe8')]+=0x1;ami['emit'](_0x2741('0x1a5'),ut[_0x2741('0x11d')](_0xe231e4,_0x2741('0x1a6')));_0x4bc03a=_0x3d0242['dialNoSuchNumberRetryFrequency'];_0x43a43b=_0x3d0242['callAdditionalPhoneAfterMin'];hopperUtils[_0x2741('0xc8')](_0x4bec0d)[_0x2741('0xa0')](loggerCatch(_0x2741('0x11e')));if(_0x3b6855['checkRetriveMax'](0x0,_0xe231e4,_0x3d0242)&&!_0x5d61ec){if(_0x4bec0d['countnosuchnumberretry']>=_0x3d0242['dialNoSuchNumberMaxRetry']){_0x3b6855[_0x2741('0x127')](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x2741('0x1a7'));}else{_0x3b6855['stateGlobal'](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x2741('0x1a7'));}}break;case'3':_0x3d0242[_0x2741('0x1a8')]+=0x1;_0x4bec0d['state']=0x3;_0x4bec0d[_0x2741('0x70')]='NoAnswer';_0x4bec0d[_0x2741('0x120')]+=0x1;_0x4bec0d[_0x2741('0xe8')]+=0x1;var _0x3d19cf=ut[_0x2741('0x1a9')](_0xe231e4,_0x3d0242);ami[_0x2741('0x41')](_0x2741('0x1aa'),_0x3d19cf);_0x4bc03a=_0x3d0242[_0x2741('0x196')];_0x43a43b=_0x3d0242[_0x2741('0x1ab')];hopperUtils[_0x2741('0xc8')](_0x4bec0d)[_0x2741('0xa0')](loggerCatch(_0x2741('0x1ac')));if(_0x3b6855['checkRetriveMax'](0x3,_0xe231e4,_0x3d0242)&&!_0x5d61ec){if(_0x4bec0d[_0x2741('0x120')]>=_0x3d0242['dialNoAnswerMaxRetry']){_0x3b6855[_0x2741('0x127')](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x2741('0x1ad'));}else{_0x3b6855[_0x2741('0x124')](_0x4bec0d,_0x1e33ee,_0x3d618e,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3d0242[_0x2741('0x1ae')]+=0x1;_0x4bec0d['state']=0x5;_0x4bec0d['statedesc']=_0x2741('0x1af');_0x4bec0d[_0x2741('0x11f')]+=0x1;_0x4bec0d[_0x2741('0xe8')]+=0x1;ami[_0x2741('0x41')](_0x2741('0x1b0'),ut[_0x2741('0x11d')](_0xe231e4,'busy'));_0x4bc03a=_0x3d0242[_0x2741('0x1b1')];_0x43a43b=_0x3d0242[_0x2741('0x1ab')];hopperUtils[_0x2741('0xc8')](_0x4bec0d)[_0x2741('0xa0')](loggerCatch(_0x2741('0x1b2')));if(_0x3b6855[_0x2741('0x193')](0x5,_0xe231e4,_0x3d0242)&&!_0x5d61ec){if(_0x4bec0d['countbusyretry']>=_0x3d0242[_0x2741('0x197')]){_0x3b6855[_0x2741('0x127')](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x2741('0x1b3'));}else{_0x3b6855[_0x2741('0x124')](_0x4bec0d,_0x1e33ee,_0x3d618e,'reason\x205\x20busy');}}break;case'8':_0x3d0242[_0x2741('0x1b4')]+=0x1;_0x4bec0d['state']=0x8;_0x4bec0d[_0x2741('0x70')]=_0x2741('0x1b5');_0x4bec0d['countcongestionretry']+=0x1;_0x4bec0d[_0x2741('0xe8')]+=0x1;_0x4bc03a=_0x3d0242[_0x2741('0x1b6')];_0x43a43b=_0x3d0242[_0x2741('0x1ab')];ami[_0x2741('0x41')](_0x2741('0x1b7'),ut[_0x2741('0x11d')](_0xe231e4,_0x2741('0x1b8')));hopperUtils['createHistory'](_0x4bec0d)['catch'](loggerCatch(_0x2741('0x1b9')));if(_0x3b6855['checkRetriveMax'](0x8,_0xe231e4,_0x3d0242)&&!_0x5d61ec){if(_0x4bec0d['countcongestionretry']>=_0x3d0242[_0x2741('0x199')]){_0x3b6855['createStateFinal'](_0x4bec0d,_0x1e33ee,_0x3d618e,'reason\x208\x20congestion');}else{_0x3b6855[_0x2741('0x124')](_0x4bec0d,_0x1e33ee,_0x3d618e,'reason\x208\x20congestion');}}break;case'11':_0x3d0242[_0x2741('0x1ba')]+=0x1;_0x4bec0d[_0x2741('0x6f')]=0xb;_0x4bec0d[_0x2741('0x70')]='Abandoned';_0x4bec0d[_0x2741('0xe7')]+=0x1;_0x4bec0d['countglobal']+=0x1;_0x4bc03a=_0x3d0242['dialAbandonedRetryFrequency'];_0x43a43b=_0x3d0242[_0x2741('0x1ab')];hopperUtils[_0x2741('0xc8')](_0x4bec0d)[_0x2741('0xa0')](loggerCatch(_0x2741('0xec')));if(_0x3b6855['checkRetriveMax'](0xb,_0xe231e4,_0x3d0242)&&!_0x5d61ec){if(_0x4bec0d[_0x2741('0xe7')]>=_0x3d0242[_0x2741('0xea')]){_0x3b6855[_0x2741('0x127')](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x2741('0x1bb'));}else{_0x3b6855[_0x2741('0x124')](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x2741('0x1bb'));}}break;case'20':_0x3d0242['outboundRejectCallsDay']+=0x1;_0x4bec0d['state']=0x14;_0x4bec0d[_0x2741('0x70')]=_0x2741('0x1bc');_0x4bec0d['countagentrejectretry']+=0x1;_0x4bec0d[_0x2741('0xe8')]+=0x1;_0x4bc03a=_0x3d0242[_0x2741('0x19f')];_0x43a43b=_0x3d0242['callAdditionalPhoneAfterMin'];ami['emit'](_0x2741('0x1bd'),ut[_0x2741('0x11d')](_0xe231e4,_0x2741('0x1be')));hopperUtils[_0x2741('0xc8')](_0x4bec0d)['catch'](loggerCatch(_0x2741('0x1bf')));if(_0x3b6855['checkRetriveMax'](0x14,_0xe231e4,_0x3d0242)&&!_0x5d61ec){if(_0x4bec0d['countagentrejectretry']>=_0x3d0242[_0x2741('0x1c0')]){_0x3b6855['createStateFinal'](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x2741('0x1c1'));}else{_0x3b6855[_0x2741('0x124')](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x2741('0x1c1'));}}break;default:_0x3d0242[_0x2741('0x13a')]+=0x1;_0x4bec0d['state']=0xc;_0x4bec0d['statedesc']=_0x3c8000[_0x2741('0x1a2')];_0x4bc03a=_0x3d0242[_0x2741('0x19f')];_0x43a43b=_0x3d0242[_0x2741('0x1ab')];hopperUtils['createHistory'](_0x4bec0d)[_0x2741('0xa0')](loggerCatch(_0x2741('0x1c2')));if(_0x3b6855[_0x2741('0x193')](_0x3c8000[_0x2741('0x1a2')],_0xe231e4,_0x3d0242)&&!_0x5d61ec){if(_0x4bec0d[_0x2741('0x11f')]+_0x4bec0d[_0x2741('0x194')]+_0x4bec0d['countnoanswerretry']+_0x4bec0d[_0x2741('0x121')]+_0x4bec0d['countdropretry']+_0x4bec0d[_0x2741('0xe7')]+_0x4bec0d[_0x2741('0x11c')]+_0x4bec0d[_0x2741('0x122')]>=_0x3d0242[_0x2741('0x123')]){_0x3b6855[_0x2741('0x124')](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x3c8000[_0x2741('0x1a2')]);}else{_0x3b6855['createStateFinal'](_0x4bec0d,_0x1e33ee,_0x3d618e,_0x3c8000['reason']);}}}})[_0x2741('0x3e')](function(){if(_0x5d61ec){hopperUtils['swapAdditionalPhones'](_0x4bec0d,_0x4bc03a,_0x43a43b)['then'](function(){return _0x1e33ee(0x1);});}});});};Dialer[_0x2741('0x1c')][_0x2741('0x124')]=function(_0x27d3c4,_0x4f9d29,_0x335bf8,_0x5bcc75){var _0x3cc239=new Final(_0x27d3c4);_0x3cc239[_0x2741('0x6f')]=0xf;_0x3cc239[_0x2741('0x70')]='Global';this[_0x2741('0x127')](_0x3cc239,_0x4f9d29,_0x335bf8,_0x5bcc75);};Dialer[_0x2741('0x1c')]['createStateFinal']=function(_0x12a942,_0x1f1c62,_0x25bd65,_0x275a66){hopperUtils[_0x2741('0xc9')](_0x12a942)['then'](function(){return _0x1f1c62(msgResponse('[callProgressDetecting]',_0x2741('0x107'),_0x275a66));})[_0x2741('0xa0')](function(){return _0x25bd65(msgResponse(_0x2741('0x1c3'),'Failure',_0x2741('0x1c4')));});};Dialer[_0x2741('0x1c')][_0x2741('0xa')]=function(_0x3e10f1){var _0x53d626=_0x3e10f1[_0x2741('0x1c5')]/0x64;var _0x5e81d2=_0x3e10f1[_0x2741('0x1c6')]/(_0x3e10f1[_0x2741('0x1c6')]+_0x3e10f1[_0x2741('0xc5')]);var _0x12e587=Math[_0x2741('0x1c7')](_0x3e10f1[_0x2741('0x1c8')]*(_0x3e10f1[_0x2741('0x1c9')]/0x64));var _0x140e3e=Math[_0x2741('0x1c7')](_0x3e10f1[_0x2741('0x1c8')]*(_0x3e10f1[_0x2741('0x1ca')]/0x64));var _0x34c6d9=_0x3e10f1['available']+_0x3e10f1[_0x2741('0x1cb')];var _0x6fa744=Math['floor'](_0x3e10f1[_0x2741('0x59')]*_0x3e10f1[_0x2741('0x5c')]*_0x3e10f1[_0x2741('0x1cc')]*_0x3e10f1[_0x2741('0x1cd')]);if(_[_0x2741('0x40')](_0x3e10f1[_0x2741('0x60')])){if(!_[_0x2741('0x40')](_0x3e10f1[_0x2741('0x29')])){_0x3e10f1[_0x2741('0x29')]=undefined;loggerPredictive[_0x2741('0x66')]('[startMethodPredictive][StartProgressive]',_0x2741('0x1ce'));}if(!_[_0x2741('0x40')](_0x3e10f1[_0x2741('0x64')])){loggerPredictive[_0x2741('0x66')](_0x2741('0x1cf'),_0x2741('0x1d0'));clearInterval(_0x3e10f1[_0x2741('0x64')]);_0x3e10f1[_0x2741('0x64')]=undefined;}_0x3e10f1['startProgressive']=moment()[_0x2741('0x46')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2741('0x49')](_0x3e10f1[_0x2741('0x62')],_0x2741('0x1d1'),_0x3e10f1[_0x2741('0x60')]);this['handlePower'](_0x3e10f1,0x1);}else if(ifInterval(_0x3e10f1[_0x2741('0x1d2')],_0x3e10f1['startProgressive'])){this[_0x2741('0xb1')](_0x3e10f1,0x1);loggerPredictiveCalls[_0x2741('0x49')]('[startMethodPredictive][StartProgressive][Loop]',_0x3e10f1[_0x2741('0x60')],_0x3e10f1[_0x2741('0x62')]);_0x3e10f1[_0x2741('0x59')]=0x0;_0x3e10f1['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x53d626<_0x5e81d2&&_0x3e10f1['dialPredictiveOptimization']===_0x2741('0x1d3')){clearPredictiveAttributes(_0x3e10f1);loggerPredictive[_0x2741('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x2741('0x1d4'),_0x5e81d2,_0x2741('0x60'),_0x3e10f1[_0x2741('0x62')]);}else if(_0x6fa744<_0x3e10f1[_0x2741('0xcf')]&&_0x3e10f1[_0x2741('0x1d5')]===_0x2741('0x1d3')){clearPredictiveAttributes(_0x3e10f1);loggerPredictive[_0x2741('0x49')](_0x2741('0x1d6'),_0x2741('0x1d7'),_0x6fa744,_0x2741('0x1d8'),_0x3e10f1[_0x2741('0xcf')],_0x2741('0x60'),_0x3e10f1[_0x2741('0x62')]);}else if(!ifInterval(_0x3e10f1['dialPredictiveInterval'],_0x3e10f1[_0x2741('0x60')])&&_[_0x2741('0x40')](_0x3e10f1[_0x2741('0x29')])&&!_[_0x2741('0x40')](_0x3e10f1[_0x2741('0x60')])){_0x3e10f1['startPredictive']=moment()['format'](_0x2741('0xc4'));loggerPredictive['info'](_0x3e10f1['name'],'started\x20in\x20predictive\x20at',_0x3e10f1[_0x2741('0x29')]);hopperUtils[_0x2741('0x1d9')](_0x3e10f1[_0x2741('0x1d2')])[_0x2741('0x3e')](this[_0x2741('0x1da')](_0x3e10f1))[_0x2741('0x3e')](mergeDataErlangB(_0x3e10f1))['then'](this['startMethodPredictive'](_0x3e10f1))['catch'](loggerCatchPredictive(_0x2741('0x1db'),_0x3e10f1));}else if(!ifInterval(_0x3e10f1[_0x2741('0x1d2')],_0x3e10f1['startPredictive'])){_0x3e10f1[_0x2741('0xcf')]=0x0;_0x3e10f1['startPredictive']=moment()[_0x2741('0x46')](_0x2741('0xc4'));loggerPredictive[_0x2741('0x49')](_0x3e10f1['name'],_0x2741('0x1dc'),_0x3e10f1[_0x2741('0x29')]);clearInterval(_0x3e10f1['handlePredictive']);_0x3e10f1['handlePredictive']=undefined;hopperUtils[_0x2741('0x1d9')](_0x3e10f1[_0x2741('0x1d2')])['then'](this[_0x2741('0x1da')](_0x3e10f1))[_0x2741('0x3e')](mergeDataErlangB(_0x3e10f1))[_0x2741('0x3e')](this[_0x2741('0x1dd')](_0x3e10f1))[_0x2741('0xa0')](loggerCatchPredictive(_0x2741('0x1de'),_0x3e10f1));}else if(_0x3e10f1[_0x2741('0x1c8')]&&_0x34c6d9<_0x3e10f1[_0x2741('0x1c8')]-_0x140e3e){clearPredictiveAttributes(_0x3e10f1);loggerPredictive[_0x2741('0x49')](_0x3e10f1[_0x2741('0x62')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x34c6d9,')\x20are\x20less\x20than\x20threshold\x20(',_0x3e10f1[_0x2741('0x1c8')],'-',_0x140e3e,'=',_0x3e10f1[_0x2741('0x1c8')]-_0x140e3e,')');}else if(_0x3e10f1['predictiveIntervalAvailable']&&_0x34c6d9>_0x3e10f1[_0x2741('0x1c8')]+_0x12e587){clearPredictiveAttributes(_0x3e10f1);loggerPredictive[_0x2741('0x49')](_0x3e10f1[_0x2741('0x62')],_0x2741('0x1df'),_0x34c6d9,')\x20are\x20more\x20than\x20threshold\x20(',_0x3e10f1[_0x2741('0x1c8')],'+',_0x12e587,'=',_0x3e10f1[_0x2741('0x1c8')]+_0x12e587,')');}};Dialer[_0x2741('0x1c')][_0x2741('0x1da')]=function(_0x40b9c7){var _0x33fbed=this;return function(_0x3a961c){return new Promise(function(_0x135c5d,_0xa14d6){_[_0x2741('0x5e')](_0x40b9c7,_0x3a961c[0x0]);if(checkGetDataPredictive(_0x3a961c[0x0])){var _0x2ce837=_0x40b9c7['predictiveIntervalAvailable']=_0x40b9c7[_0x2741('0x1cb')]+_0x40b9c7['available'];var _0x2445ca=_0x40b9c7['dialPredictiveInterval']*0x3c;var _0xe49428=_0x3a961c[0x0][_0x2741('0x52')]+_0x3a961c[0x0][_0x2741('0x50')];var _0x9737d5=(_0x3a961c[0x0][_0x2741('0x4c')]+_0x3a961c[0x0][_0x2741('0xce')]+_0x3a961c[0x0][_0x2741('0xe3')])/_0x3a961c[0x0]['predictiveIntervalTotalCalls'];_0x40b9c7['predictiveIntervalHitRate']=_0x9737d5>0x0?_0x9737d5:0x1;switch(_0x40b9c7[_0x2741('0x1d5')]){case _0x2741('0x1d3'):var _0x165659=_0x40b9c7[_0x2741('0x1c5')]/0x64;return _0x33fbed[_0x2741('0x1e0')](_0x2ce837,_0x2445ca,_0xe49428,_0x9737d5,_0x165659)[_0x2741('0x3e')](function(_0x4390fb){return _0x135c5d(_0x4390fb);});case _0x2741('0x1e1'):var _0x226d74=_0x40b9c7[_0x2741('0x1c5')]/0x64;return _0x33fbed[_0x2741('0x1e2')](_0x2ce837,_0x2445ca,_0xe49428,_0x9737d5,_0x226d74)['then'](function(_0x15eae2){return _0x135c5d(_0x15eae2);});default:return _0xa14d6(msgResponse(_0x2741('0x1e3'),_0x2741('0x92'),_0x2741('0x1e4')));}}else{return _0xa14d6(msgResponse('[getDataPredictive]','Failure',_0x2741('0x1e5')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x49bbe2){var _0x448bd9=this;return function(_0x27cb28){return new Promise(function(_0x4a3454,_0x30863e){_[_0x2741('0x5e')](_0x49bbe2,_0x27cb28[0x0]);if(checkGetDataPredictive(_0x27cb28[0x0])){loggerPredictive['info'](JSON['stringify'](_0x27cb28[0x0]));if(_0x49bbe2[_0x2741('0x1d5')]===_0x2741('0x1d3')){return _0x448bd9[_0x2741('0x159')](_0x49bbe2['id'])['then'](function(_0xfc0e1f){var _0x214145=_0x49bbe2[_0x2741('0x1e6')]-_0xfc0e1f[0x0][_0x2741('0x1e7')];var _0x5c30e8=_0x49bbe2[_0x2741('0x1d2')]*0x3c;var _0x1d05fd=_0x27cb28[0x0][_0x2741('0x52')]+_0x27cb28[0x0]['predictiveIntervalAvgHoldtime'];var _0x3f70f4=(_0x27cb28[0x0][_0x2741('0x4c')]+_0x27cb28[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x27cb28[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x27cb28[0x0][_0x2741('0x53')];var _0x1fa564=_0x49bbe2[_0x2741('0x1c5')]/0x64;_0x49bbe2['predictiveIntervalPauses']=_0xfc0e1f[0x0]['outboundQueuePauses']||0x0;_0x49bbe2['predictiveIntervalHitRate']=_0x3f70f4>0x0?_0x3f70f4:0x1;return _0x448bd9[_0x2741('0x1e0')](_0x214145,_0x5c30e8,_0x1d05fd,_0x3f70f4,_0x1fa564);})['then'](function(_0x18fa80){return _0x4a3454(_0x18fa80);})[_0x2741('0xa0')](function(_0x34011d){return _0x30863e(msgResponse('[CatchErlangB]','Failure',JSON[_0x2741('0x75')](_0x34011d)));});}if(_0x49bbe2['dialPredictiveOptimization']===_0x2741('0x1e1')){return _0x448bd9[_0x2741('0x159')](_0x49bbe2['id'])[_0x2741('0x3e')](function(_0x4692fb){var _0x2c4b8a=_0x49bbe2[_0x2741('0x1e6')]-_0x4692fb[0x0]['outboundQueuePauses'];var _0x12e205=_0x49bbe2[_0x2741('0x1d2')]*0x3c;var _0x1eaa3d=_0x27cb28[0x0][_0x2741('0x52')]+_0x27cb28[0x0][_0x2741('0x50')];var _0x1fec81=(_0x27cb28[0x0][_0x2741('0x4c')]+_0x27cb28[0x0][_0x2741('0xce')]+_0x27cb28[0x0][_0x2741('0xe3')])/_0x27cb28[0x0]['predictiveIntervalTotalCalls'];var _0x23de18=_0x49bbe2[_0x2741('0x1c5')]/0x64;_0x49bbe2['predictiveIntervalPauses']=_0x4692fb[0x0][_0x2741('0x1e7')]||0x0;_0x49bbe2[_0x2741('0x1cc')]=_0x1fec81>0x0?_0x1fec81:0x1;return _0x448bd9[_0x2741('0x1e2')](_0x2c4b8a,_0x12e205,_0x1eaa3d,_0x1fec81,_0x23de18);})[_0x2741('0x3e')](function(_0x3e0abd){return _0x4a3454(_0x3e0abd);})['catch'](function(_0x586be9){return _0x30863e(msgResponse(_0x2741('0x1e8'),_0x2741('0x92'),JSON['stringify'](_0x586be9)));});}}else{return _0x30863e(msgResponse('[getDataPredictive]',_0x2741('0x92'),_0x2741('0x1e5')));}});};};Dialer[_0x2741('0x1c')][_0x2741('0x1dd')]=function(_0x3590f5){var _0x2955da=this;return function(){var _0x3f4001=0x0;var _0x4111ee=Math[_0x2741('0x1e9')](_0x3590f5[_0x2741('0x5b')]*0x3e8);if(_0x4111ee>0x0){_0x4111ee=_0x4111ee<0x64?0x64:_0x4111ee;loggerPredictive[_0x2741('0x49')](_0x3590f5[_0x2741('0x62')],'one\x20call\x20every:',_0x4111ee,_0x2741('0x1ea'));_0x3590f5['handlePredictive']=setInterval(function(){_0x2955da[_0x2741('0x64')](_0x3590f5);loggerPredictiveCalls[_0x2741('0x49')](_0x2741('0x1eb'),_0x3f4001+=0x1);},_0x4111ee);}else{loggerPredictive['info'](_0x3590f5[_0x2741('0x62')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x2741('0x1c')][_0x2741('0x1ec')]=function(_0x2a8f46,_0x4742e0){var _0x215c5d=this;return function(_0x36e019){if(_['isEmpty'](_0x36e019)){if(_[_0x2741('0xf1')](_0x4742e0[_0x2741('0x15e')])||!_0x4742e0[_0x2741('0x1ed')]){if(_0x2a8f46['dialMethod']===_0x2741('0x9')){_0x2a8f46[_0x2741('0x73')]=_[_0x2741('0x40')](_0x2a8f46[_0x2741('0x73')])?!![]:_0x2a8f46[_0x2741('0x73')];var _0x3290af=uuid['v4']();_0x215c5d[_0x2741('0x26')][_0x3290af]=new Action(_0x2a8f46,_0x4742e0,_0x3290af);loggerBooked[_0x2741('0x49')](_0x2741('0x1ee'),_0x3290af,_0x2741('0x1ef'),JSON[_0x2741('0x75')](_0x2a8f46[_0x2741('0x73')]),_0x2741('0x1f0'),_0x2a8f46[_0x2741('0x62')]);if(_0x2a8f46[_0x2741('0x73')]){_0x2a8f46[_0x2741('0x73')]=![];_0x215c5d['queueBooked'][_0x215c5d[_0x2741('0x26')][_0x3290af][_0x2741('0xc1')]]=[];ami[_0x2741('0x9a')]({'actionid':_0x3290af,'action':_0x2741('0x1f1'),'queue':_0x2a8f46[_0x2741('0x62')]})[_0x2741('0xa0')](function(){utils['decrementOriginate'](_0x2a8f46,_0x2741('0x1f2'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x215c5d[_0x2741('0x26')][_0x3290af]['ContactId'],'ListId':_0x215c5d[_0x2741('0x26')][_0x3290af][_0x2741('0xdd')],'VoiceQueueId':_0x215c5d[_0x2741('0x26')][_0x3290af][_0x2741('0xde')]||undefined,'CampaignId':_0x215c5d[_0x2741('0x26')][_0x3290af][_0x2741('0xdf')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x215c5d[_0x2741('0x26')][_0x3290af];});}else{loggerBooked[_0x2741('0x49')](_0x2741('0x1f3'),JSON[_0x2741('0x75')](_0x2a8f46[_0x2741('0x73')]),_0x2741('0x1f0'),_0x2a8f46[_0x2741('0x62')]);utils[_0x2741('0xc0')](_0x2a8f46,'[checkContactBlack]');hopperUtils[_0x2741('0xd9')]({'active':![],'ContactId':_0x215c5d['actions'][_0x3290af]['ContactId'],'ListId':_0x215c5d['actions'][_0x3290af][_0x2741('0xdd')],'VoiceQueueId':_0x215c5d[_0x2741('0x26')][_0x3290af][_0x2741('0xde')]||undefined,'CampaignId':_0x215c5d[_0x2741('0x26')][_0x3290af][_0x2741('0xdf')]||undefined})[_0x2741('0xa0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x215c5d['actions'][_0x3290af];}}else{return _0x215c5d[_0x2741('0x166')](_0x2a8f46,_0x4742e0);}}else{if(utils['getSeconds'](undefined,_0x4742e0[_0x2741('0x1f4')])<_0x2a8f46[_0x2741('0x1f5')]*0x3c){if(_0x4742e0[_0x2741('0x14c')]&&!_0x4742e0['Agent'][_0x2741('0x1f6')]){_0x215c5d[_0x2741('0x20')][_0x2741('0xf9')](_0x4742e0['id'])[_0x2741('0x1f')](function(){utils[_0x2741('0xc0')](_0x2a8f46,_0x2741('0x1f2'));});}else{hopperUtils['unlockContact']({'active':![]},_0x4742e0['id'],0x1)['finally'](function(){utils[_0x2741('0xc0')](_0x2a8f46,'[checkContactBlack]');});}}else{_0x2a8f46[_0x2741('0x1f7')]+=0x1;utils[_0x2741('0xc0')](_0x2a8f46,_0x2741('0x1f2'));if(_0x2a8f46[_0x2741('0x1f8')]){hopperUtils[_0x2741('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4742e0['ContactId'],'ListId':_0x4742e0[_0x2741('0xdd')],'VoiceQueueId':_0x4742e0[_0x2741('0xde')]||undefined,'CampaignId':_0x4742e0['CampaignId']||undefined})[_0x2741('0xa0')](loggerCatch(_0x2741('0x1f9')));hopperUtils[_0x2741('0xc8')](createObjHistory(_0x2a8f46,_0x4742e0,utils[_0x2741('0x68')][_0x2741('0x1fa')],0x17,'RecallInQueue'))[_0x2741('0xa0')](loggerCatch(_0x2741('0x1fb')));}else{_0x215c5d['saveInDb'](createObjHistory(_0x2a8f46,_0x4742e0,utils[_0x2741('0x68')][_0x2741('0x1fc')],0x16,_0x2741('0x1fd')),_0x2741('0x1fe'),'[Originate][HistoryRecallClose]');}}}}else{_0x2a8f46[_0x2741('0x1ff')]+=0x1;_0x215c5d[_0x2741('0x160')](createObjHistory(_0x2a8f46,_0x4742e0,utils[_0x2741('0x68')][_0x2741('0x200')],0xd,'Blacklist'),_0x2741('0x201'),_0x2741('0x202'));throw'inBlackList';}};};Dialer[_0x2741('0x1c')][_0x2741('0x165')]=function(_0x36bb7d){var _0x42fd87=this;var _0x217655=_0x36bb7d[_0x2741('0x203')]-_0x36bb7d[_0x2741('0x80')];emitCampaignSummary(_0x36bb7d);if(_0x217655>0x0&&_0x36bb7d['temp']==0x0){if(_0x217655>this[_0x2741('0x25')]){_0x217655=this[_0x2741('0x25')];}_0x36bb7d[_0x2741('0x204')]=0x1;hopperUtils[_0x2741('0x205')](_0x36bb7d,_0x217655)[_0x2741('0x3e')](function(_0x26a2ec){_0x36bb7d[_0x2741('0x204')]=0x0;if(_0x26a2ec){if(!utils[_0x2741('0x206')](_0x26a2ec)){_0x36bb7d[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x6d')];logger[_0x2741('0x49')](_0x2741('0x207')+_0x36bb7d[_0x2741('0x62')]);}else{_0x36bb7d[_0x2741('0x80')]+=_0x26a2ec['length'];_0x36bb7d[_0x2741('0x67')]=utils[_0x2741('0x68')][_0x2741('0x208')];for(var _0x22497e=0x0;_0x22497e<_0x26a2ec[_0x2741('0x99')];_0x22497e+=0x1){_0x36bb7d['ivrTotalCallsDays']+=0x1;if(_[_0x2741('0xf1')](_0x26a2ec[_0x22497e])||_[_0x2741('0xf1')](_0x26a2ec[_0x22497e][_0x2741('0x17e')])||_[_0x2741('0xf1')](_0x26a2ec[_0x22497e]['phone'])){_0x42fd87[_0x2741('0x15b')]('[actionOriginate]\x20',_0x36bb7d,_0x26a2ec[_0x22497e]);}else{hopperUtils[_0x2741('0x209')](_['pick'](_0x26a2ec[_0x22497e],[_0x2741('0xdf'),_0x2741('0x16a')]))[_0x2741('0x3e')](_0x42fd87[_0x2741('0x1ec')](_0x36bb7d,_0x26a2ec[_0x22497e]))[_0x2741('0xa0')](function(_0x522cdb){logger[_0x2741('0x66')](_0x2741('0x20a'),_0x522cdb);utils[_0x2741('0xc0')](_0x36bb7d,_0x2741('0x20b'));});}}}}})[_0x2741('0xa0')](function(_0x420f2c){_0x36bb7d[_0x2741('0x204')]=0x0;logger['error'](_0x2741('0x20c'),_0x420f2c);});}};Dialer[_0x2741('0x1c')][_0x2741('0xb1')]=function(_0xa488ac,_0x3daa7b){var _0x3bb5b6=this;var _0x139c1e=[];if(_0x3daa7b<0x1||_0xa488ac[_0x2741('0xaf')]===_0x2741('0x9')){_0x3daa7b=0x1;}var _0x1ed2bd=Math[_0x2741('0x1e9')](_0xa488ac[_0x2741('0x13f')]*_0x3daa7b)-_0xa488ac[_0x2741('0x80')];if(_0xa488ac[_0x2741('0x20d')]>0x0){var _0x540777=_0xa488ac[_0x2741('0x20d')]-_0xa488ac[_0x2741('0x80')]-_0xa488ac['talking']-_0xa488ac[_0x2741('0x141')];if(_0x1ed2bd>_0x540777){_0x1ed2bd=_0x540777;}}if(_0x1ed2bd>0x0&&_0xa488ac[_0x2741('0x204')]==0x0){if(_0xa488ac[_0x2741('0xaf')]===_0x2741('0x9')){_0x1ed2bd=0x1;}if(_0x1ed2bd>this[_0x2741('0x25')]){_0x1ed2bd=this[_0x2741('0x25')];}for(var _0x759d51 in this[_0x2741('0x23')]){if(typeof this['agents'][_0x759d51]!==_0x2741('0x153')){if(this['agents'][_0x759d51][_0x2741('0x6f')]==='not_inuse'&&this[_0x2741('0x23')][_0x759d51][_0x2741('0xf8')]===_0x2741('0x87')){_0x139c1e[_0x2741('0xa1')](this[_0x2741('0x23')][_0x759d51]['id']);}}}_0xa488ac[_0x2741('0x204')]=0x1;hopperUtils['getContactDialer'](_0xa488ac,_0x139c1e,_0x1ed2bd)['then'](function(_0x588333){_0xa488ac[_0x2741('0x204')]=0x0;if(_0x588333){if(!utils[_0x2741('0x206')](_0x588333)){hopperUtils[_0x2741('0x20e')](_0xa488ac)[_0x2741('0x3e')](sendMessageReschedule(_0xa488ac))[_0x2741('0xa0')](loggerCatch(_0x2741('0x20f')));}else{_0xa488ac[_0x2741('0x80')]+=_0x588333[_0x2741('0x99')];_0xa488ac[_0x2741('0x67')]=_0xa488ac['dialMethod']===_0x2741('0x9')?utils[_0x2741('0x68')][_0x2741('0x142')]:utils[_0x2741('0x68')][_0x2741('0x208')];for(var _0x53c73d=0x0;_0x53c73d<_0x588333[_0x2741('0x99')];_0x53c73d+=0x1){if(_['isNil'](_0x588333[_0x53c73d])||_[_0x2741('0xf1')](_0x588333[_0x53c73d][_0x2741('0x17e')])||_[_0x2741('0xf1')](_0x588333[_0x53c73d][_0x2741('0x16a')])){_0x3bb5b6[_0x2741('0x15b')](_0x2741('0x210'),_0xa488ac,_0x588333[_0x53c73d]);}else{hopperUtils[_0x2741('0x211')](_['pick'](_0x588333[_0x53c73d],['VoiceQueueId',_0x2741('0x16a')]))[_0x2741('0x3e')](_0x3bb5b6['checkContactBlack'](_0xa488ac,_0x588333[_0x53c73d]))[_0x2741('0xa0')](function(_0xd402a0){logger[_0x2741('0x66')]('[actionOriginate]',_0xd402a0);utils[_0x2741('0xc0')](_0xa488ac,_0x2741('0x212'));});}}}}})['catch'](function(_0x2d75f7){_0xa488ac['temp']=0x0;logger[_0x2741('0x66')](_0x2741('0x20c'),_0x2d75f7);});}};Dialer[_0x2741('0x1c')][_0x2741('0x64')]=function(_0x4936a7){if(_0x4936a7[_0x2741('0x20d')]>0x0){var _0x2e1de1=_0x4936a7[_0x2741('0x20d')]-_0x4936a7['originated']-_0x4936a7[_0x2741('0x1cb')];if(_0x2e1de1>0x0&&_0x4936a7['temp']==0x0){this[_0x2741('0x213')](_0x4936a7);}else{loggerPredictiveCalls[_0x2741('0x49')](_0x2741('0x214'));}}else{this[_0x2741('0x213')](_0x4936a7);}};Dialer[_0x2741('0x1c')][_0x2741('0x213')]=function(_0x119d8f){var _0x20e505=this;var _0x55bd65=[];_0x119d8f['originated']+=0x1;for(var _0x2439fe in this[_0x2741('0x23')]){if(typeof this[_0x2741('0x23')][_0x2439fe]!=='undefined'){if(this['agents'][_0x2439fe][_0x2741('0x6f')]===_0x2741('0x215')&&this[_0x2741('0x23')][_0x2439fe][_0x2741('0xf8')]===_0x2741('0x87')){_0x55bd65[_0x2741('0xa1')](this['agents'][_0x2439fe]['id']);}}}_0x119d8f[_0x2741('0x204')]=0x1;return this[_0x2741('0x216')](_0x119d8f['id'],_0x55bd65,0x1,_0x119d8f[_0x2741('0x217')],_0x119d8f)['then'](function(_0x886959){_0x119d8f['temp']=0x1;if(_0x886959){if(!utils['checkContactEmpty'](_0x886959)){utils[_0x2741('0x218')](_0x119d8f,0x1,0x0);return hopperUtils[_0x2741('0x20e')](_0x119d8f)['then'](sendMessageReschedule(_0x119d8f))[_0x2741('0xa0')](loggerCatch(_0x2741('0x20f')));}else{_0x119d8f['message']=utils[_0x2741('0x68')]['RUNNING'];if(_[_0x2741('0xf1')](_0x886959[0x0])||_[_0x2741('0xf1')](_0x886959[0x0]['Contact'])||_[_0x2741('0xf1')](_0x886959[0x0][_0x2741('0x16a')])){_0x20e505[_0x2741('0x15b')]('[actionOriginate]\x20',_0x119d8f,_0x886959[0x0]);}else{return hopperUtils[_0x2741('0x211')](_[_0x2741('0x76')](_0x886959[0x0],[_0x2741('0xde'),_0x2741('0x16a')]))['then'](_0x20e505[_0x2741('0x1ec')](_0x119d8f,_0x886959[0x0]))[_0x2741('0xa0')](function(_0x399c68){logger['error'](_0x2741('0x219'),_0x399c68);utils[_0x2741('0xc0')](_0x119d8f,_0x2741('0x219'));});}}}})[_0x2741('0xa0')](function(_0x3e9d85){_0x119d8f[_0x2741('0x204')]=0x0;logger[_0x2741('0x66')](_0x2741('0x20c'),_0x3e9d85);});};Dialer['prototype'][_0x2741('0x1e0')]=function(_0x216268,_0x2c4afa,_0x4feecf,_0x56dcbd,_0x1fecc0,_0x3b56a3){loggerPredictive[_0x2741('0x49')](_0x2741('0x21a'));loggerPredictive[_0x2741('0x49')]('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',_0x216268);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c4afa);loggerPredictive['info'](_0x2741('0x21b'),_0x4feecf);loggerPredictive['info'](_0x2741('0x21c'),_0x56dcbd);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1fecc0);loggerPredictive[_0x2741('0x49')](_0x2741('0x5d'));return new Promise(function(_0x91b0d4,_0x148b57){if(_0x216268<=0x0||isNaN(_0x216268)){return _0x148b57(msgResponse(_0x2741('0x21d'),'Error',_0x2741('0x21e')+_0x216268));}if(_0x4feecf<=0x0||isNaN(_0x4feecf)){return _0x148b57(msgResponse(_0x2741('0x21d'),_0x2741('0x85'),'Ts\x20=\x20'+_0x4feecf));}if(_0x56dcbd<=0x0||isNaN(_0x56dcbd)){return _0x148b57(msgResponse(_0x2741('0x21d'),_0x2741('0x85'),_0x2741('0x21f')+_0x56dcbd));}if(_0x2c4afa<=0x0||isNaN(_0x2c4afa)){return _0x148b57(msgResponse(_0x2741('0x21d'),'Error',_0x2741('0x220')+_0x2c4afa));}if(_0x1fecc0<=0x0||isNaN(_0x1fecc0)){return _0x148b57(msgResponse('[abandonmentRate]',_0x2741('0x85'),_0x2741('0x221')+_0x1fecc0));}_0x3b56a3=_0x3b56a3||0x0;var _0x1235ec=0x1/_0x4feecf;var _0x2d235a=0x0;var _0x26bda9=0x0;var _0x3b52ad=0x0;var _0x1a1504=0x0;for(var _0x1c4e33=0x0;_0x3b52ad<_0x1fecc0;_0x1c4e33+=0x1){_0x26bda9=_0x1c4e33/_0x2c4afa;_0x2d235a=(_0x56dcbd*_0x26bda9+_0x3b56a3)/_0x1235ec;_0x3b52ad=utils[_0x2741('0x222')](_0x2d235a,_0x216268);_0x1a1504=_0x2d235a/_0x216268*(0x1-utils[_0x2741('0x222')](_0x2d235a,_0x216268));}return _0x91b0d4({'erlangCalls':_0x1c4e33,'erlangCallToSecond':_0x2c4afa/_0x1c4e33,'erlangAbandonmentRate':_0x3b52ad,'erlangBusyFactor':_0x1a1504});});};Dialer[_0x2741('0x1c')]['busyFactor']=function(_0x27ec82,_0x4709ef,_0x346d4e,_0x31712b,_0x5e5276,_0x18d675){loggerPredictive[_0x2741('0x49')](_0x2741('0x223'));loggerPredictive[_0x2741('0x49')]('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',_0x27ec82);loggerPredictive['info'](_0x2741('0x224'),_0x4709ef);loggerPredictive[_0x2741('0x49')](_0x2741('0x21b'),_0x346d4e);loggerPredictive[_0x2741('0x49')](_0x2741('0x21c'),_0x31712b);loggerPredictive[_0x2741('0x49')](_0x2741('0x225'),_0x5e5276);loggerPredictive[_0x2741('0x49')]('---------------------------');return new Promise(function(_0xe1bc6d,_0x51c357){if(_0x27ec82<=0x0||isNaN(_0x27ec82)){return _0x51c357(msgResponse(_0x2741('0x226'),_0x2741('0x85'),_0x2741('0x21e')+_0x27ec82));}if(_0x346d4e<=0x0||isNaN(_0x346d4e)){return _0x51c357(msgResponse('[busyFactor]',_0x2741('0x85'),_0x2741('0x227')+_0x346d4e));}if(_0x31712b<=0x0||isNaN(_0x31712b)){return _0x51c357(msgResponse(_0x2741('0x226'),_0x2741('0x85'),_0x2741('0x21f')+_0x31712b));}if(_0x4709ef<=0x0||isNaN(_0x4709ef)){return _0x51c357(msgResponse(_0x2741('0x226'),_0x2741('0x85'),_0x2741('0x220')+_0x4709ef));}if(_0x5e5276<=0x0||isNaN(_0x5e5276)){return _0x51c357(msgResponse(_0x2741('0x226'),_0x2741('0x85'),_0x2741('0x228')+_0x5e5276));}_0x18d675=_0x18d675||0x0;var _0x35fb64=0x1/_0x346d4e;var _0x136f6e=0x0;var _0x510ac6=0x0;var _0x17da8b=0x0;var _0x2d0eb0=0x0;for(var _0x466ccd=0x0;_0x2d0eb0<_0x5e5276;_0x466ccd+=0x1){_0x510ac6=_0x466ccd/_0x4709ef;_0x136f6e=(_0x31712b*_0x510ac6+_0x18d675)/_0x35fb64;_0x17da8b=utils['erlangb'](_0x136f6e,_0x27ec82);_0x2d0eb0=_0x136f6e/_0x27ec82*(0x1-utils[_0x2741('0x222')](_0x136f6e,_0x27ec82));}return _0xe1bc6d({'erlangCalls':_0x466ccd,'erlangCallToSecond':_0x4709ef/_0x466ccd,'erlangAbandonmentRate':_0x17da8b,'erlangBusyFactor':_0x2d0eb0});});};module[_0x2741('0x229')]=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 40672e4..9f0e722 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 _0x31f4=['callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','format','number','substring','dialCutDigit','getQueue','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback'];(function(_0xb786da,_0x329f86){var _0x5eb28c=function(_0x4c89f2){while(--_0x4c89f2){_0xb786da['push'](_0xb786da['shift']());}};_0x5eb28c(++_0x329f86);}(_0x31f4,0xd8));var _0x431f=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x31f4[_0x1a0daa];return _0x1dbe15;};'use strict';var util=require('util');var _=require(_0x431f('0x0'));var moment=require(_0x431f('0x1'));function checkNameSurname(_0x2e526a,_0x1487da,_0x3765a2){var _0x139916='';if(!_['isNil'](_0x1487da)&&_0x431f('0x2')===typeof _0x1487da){_0x139916+=_0x1487da;}if(!_[_0x431f('0x3')](_0x3765a2)&&_0x431f('0x2')===typeof _0x3765a2){_0x139916+='\x20'+_0x3765a2;}if(_0x139916!==''){return _0x139916;}return _0x2e526a;}function Action(_0x1ed889,_0x3898c9,_0x529bce){this[_0x431f('0x4')]=_0x1ed889;this[_0x431f('0x5')]=_0x529bce||undefined;this[_0x431f('0x6')]=checkNameSurname(_0x3898c9[_0x431f('0x7')]['phone'],_0x3898c9[_0x431f('0x7')][_0x431f('0x8')],_0x3898c9[_0x431f('0x7')][_0x431f('0x9')]);this['number']=_0x3898c9['phone'];this[_0x431f('0xa')]=_0x1ed889['name'];this[_0x431f('0xb')]=_0x3898c9[_0x431f('0xb')]||![];this['type']=_0x1ed889[_0x431f('0xc')];this[_0x431f('0xd')]=_0x1ed889[_0x431f('0xd')]||0x3;this['scheduledat']=_0x3898c9[_0x431f('0xe')];this[_0x431f('0xf')]=_0x3898c9['countbusyretry'];this[_0x431f('0x10')]=_0x3898c9['countcongestionretry'];this[_0x431f('0x11')]=_0x3898c9[_0x431f('0x11')];this[_0x431f('0x12')]=_0x3898c9[_0x431f('0x12')];this[_0x431f('0x13')]=_0x3898c9[_0x431f('0x13')];this[_0x431f('0x14')]=_0x3898c9[_0x431f('0x14')];this[_0x431f('0x15')]=_0x3898c9['countmachineretry'];this['countagentrejectretry']=_0x3898c9['countagentrejectretry'];this[_0x431f('0x16')]=_0x3898c9['ContactId'];this[_0x431f('0x17')]=_0x3898c9[_0x431f('0x17')];this['UserId']=_0x3898c9[_0x431f('0x18')];this[_0x431f('0x19')]=_0x3898c9['VoiceQueueId'];this[_0x431f('0x1a')]=_0x3898c9[_0x431f('0x1a')];this['idHopper']=_0x3898c9['id'];this[_0x431f('0x1b')]=_0x3898c9[_0x431f('0x7')]['firstName']||'';this[_0x431f('0x1c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x431f('0x1d')]=_0x3898c9[_0x431f('0x1d')];this[_0x431f('0x1e')]=_0x3898c9['callbackuniqueid'];this['callbackat']=_0x3898c9[_0x431f('0x1f')];this['recallme']=_0x3898c9['recallme'];this[_0x431f('0x20')]='';this[_0x431f('0x21')]='';}Action[_0x431f('0x22')][_0x431f('0x23')]=function(){return util[_0x431f('0x24')]('\x22%s\x22\x20<%s>',this[_0x431f('0x6')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x431f('0x25')][_0x431f('0x26')](this[_0x431f('0x4')][_0x431f('0x27')]):this['number']);};Action['prototype'][_0x431f('0x28')]=function(){return this[_0x431f('0xa')];};module['exports']=Action; \ No newline at end of file +var _0x80fc=['countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','substring','dialCutDigit','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x80fc,0x197));var _0xc80f=function(_0x25e358,_0x183b2f){_0x25e358=_0x25e358-0x0;var _0x3c1c66=_0x80fc[_0x25e358];return _0x3c1c66;};'use strict';var util=require('util');var _=require(_0xc80f('0x0'));var moment=require(_0xc80f('0x1'));function checkNameSurname(_0x47434b,_0x2c8b06,_0x581cf9){var _0x134ad1='';if(!_[_0xc80f('0x2')](_0x2c8b06)&&_0xc80f('0x3')===typeof _0x2c8b06){_0x134ad1+=_0x2c8b06;}if(!_[_0xc80f('0x2')](_0x581cf9)&&'string'===typeof _0x581cf9){_0x134ad1+='\x20'+_0x581cf9;}if(_0x134ad1!==''){return _0x134ad1;}return _0x47434b;}function Action(_0xd8de61,_0x27aa2f,_0x2e2a42){this[_0xc80f('0x4')]=_0xd8de61;this[_0xc80f('0x5')]=_0x2e2a42||undefined;this['name']=checkNameSurname(_0x27aa2f[_0xc80f('0x6')]['phone'],_0x27aa2f['Contact'][_0xc80f('0x7')],_0x27aa2f['Contact'][_0xc80f('0x8')]);this[_0xc80f('0x9')]=_0x27aa2f[_0xc80f('0xa')];this[_0xc80f('0xb')]=_0xd8de61[_0xc80f('0xc')];this[_0xc80f('0xd')]=_0x27aa2f[_0xc80f('0xd')]||![];this[_0xc80f('0xe')]=_0xd8de61[_0xc80f('0xe')];this['dialQueueTimeout']=_0xd8de61[_0xc80f('0xf')]||0x3;this[_0xc80f('0x10')]=_0x27aa2f[_0xc80f('0x10')];this[_0xc80f('0x11')]=_0x27aa2f[_0xc80f('0x11')];this[_0xc80f('0x12')]=_0x27aa2f['countcongestionretry'];this[_0xc80f('0x13')]=_0x27aa2f[_0xc80f('0x13')];this[_0xc80f('0x14')]=_0x27aa2f[_0xc80f('0x14')];this[_0xc80f('0x15')]=_0x27aa2f[_0xc80f('0x15')];this['countabandonedretry']=_0x27aa2f[_0xc80f('0x16')];this[_0xc80f('0x17')]=_0x27aa2f[_0xc80f('0x17')];this['countagentrejectretry']=_0x27aa2f['countagentrejectretry'];this[_0xc80f('0x18')]=_0x27aa2f[_0xc80f('0x18')];this[_0xc80f('0x19')]=_0x27aa2f[_0xc80f('0x19')];this[_0xc80f('0x1a')]=_0x27aa2f['UserId'];this[_0xc80f('0x1b')]=_0x27aa2f[_0xc80f('0x1b')];this[_0xc80f('0x1c')]=_0x27aa2f[_0xc80f('0x1c')];this['idHopper']=_0x27aa2f['id'];this[_0xc80f('0x1d')]=_0x27aa2f[_0xc80f('0x6')][_0xc80f('0x7')]||'';this[_0xc80f('0x1e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xc80f('0x1f')]=_0x27aa2f[_0xc80f('0x1f')];this[_0xc80f('0x20')]=_0x27aa2f[_0xc80f('0x20')];this['callbackat']=_0x27aa2f[_0xc80f('0x21')];this[_0xc80f('0x22')]=_0x27aa2f[_0xc80f('0x22')];this[_0xc80f('0x23')]='';this[_0xc80f('0x24')]='';}Action[_0xc80f('0x25')][_0xc80f('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xc80f('0xc')],this[_0xc80f('0x4')]['dialCutDigit']>0x0?this['number'][_0xc80f('0x27')](this[_0xc80f('0x4')][_0xc80f('0x28')]):this[_0xc80f('0x9')]);};Action['prototype'][_0xc80f('0x29')]=function(){return this['queue'];};module[_0xc80f('0x2a')]=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 591e991..8338deb 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 _0x0d6e=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','statedesc'];(function(_0x3e055e,_0x37c730){var _0x3e792f=function(_0x1ac384){while(--_0x1ac384){_0x3e055e['push'](_0x3e055e['shift']());}};_0x3e792f(++_0x37c730);}(_0x0d6e,0x81));var _0xe0d6=function(_0x4ef4e7,_0x42e7e9){_0x4ef4e7=_0x4ef4e7-0x0;var _0x3a7c7c=_0x0d6e[_0x4ef4e7];return _0x3a7c7c;};'use strict';var moment=require(_0xe0d6('0x0'));var utils=require(_0xe0d6('0x1'));function AgentComplete(_0x312bd9,_0xb045dc){this['state']=0x4;this[_0xe0d6('0x2')]='Answer';this[_0xe0d6('0x3')]=_0x312bd9[_0xe0d6('0x3')];this[_0xe0d6('0x4')]=_0x312bd9[_0xe0d6('0x4')];this[_0xe0d6('0x5')]=_0x312bd9[_0xe0d6('0x4')]===_0xe0d6('0x6')?_0xe0d6('0x7'):_0x312bd9[_0xe0d6('0x4')];this['countbusyretry']=_0x312bd9[_0xe0d6('0x8')];this[_0xe0d6('0x9')]=_0x312bd9[_0xe0d6('0x9')];this[_0xe0d6('0xa')]=_0x312bd9[_0xe0d6('0xa')];this[_0xe0d6('0xb')]=_0x312bd9[_0xe0d6('0x8')]+_0x312bd9[_0xe0d6('0x9')]+_0x312bd9['countnoanswerretry']+_0x312bd9[_0xe0d6('0xc')]+_0x312bd9[_0xe0d6('0xd')]+_0x312bd9[_0xe0d6('0xe')]+_0x312bd9[_0xe0d6('0xf')]+_0x312bd9[_0xe0d6('0x10')];this['countnosuchnumberretry']=_0x312bd9[_0xe0d6('0xc')];this[_0xe0d6('0xd')]=_0x312bd9[_0xe0d6('0xd')];this[_0xe0d6('0xe')]=_0x312bd9[_0xe0d6('0xe')];this[_0xe0d6('0xf')]=_0x312bd9[_0xe0d6('0xf')];this[_0xe0d6('0x10')]=_0x312bd9[_0xe0d6('0x10')];this[_0xe0d6('0x11')]=_0xb045dc[_0xe0d6('0x11')];this[_0xe0d6('0x12')]=_0x312bd9[_0xe0d6('0x13')];this['calleridnum']=_0x312bd9['number'];this[_0xe0d6('0x14')]=_0x312bd9[_0xe0d6('0x14')];this[_0xe0d6('0x15')]=_0x312bd9[_0xe0d6('0x15')];this[_0xe0d6('0x16')]=_0x312bd9['answertime'];this['endtime']=moment()[_0xe0d6('0x17')](_0xe0d6('0x18'));this[_0xe0d6('0x19')]=utils['getSeconds'](_0x312bd9[_0xe0d6('0x15')],_0x312bd9[_0xe0d6('0x14')]);this[_0xe0d6('0x1a')]=utils[_0xe0d6('0x1b')](_0x312bd9[_0xe0d6('0x16')],_0x312bd9['responsetime']);this[_0xe0d6('0x1c')]=utils['getSeconds'](this[_0xe0d6('0x1d')],_0x312bd9[_0xe0d6('0x16')]);this['queue']=_0xb045dc[_0xe0d6('0x7')];this['membername']=_0xb045dc[_0xe0d6('0x1e')];this[_0xe0d6('0x1f')]=_0xb045dc['reason'];this[_0xe0d6('0x20')]=_0x312bd9[_0xe0d6('0x20')];this[_0xe0d6('0x21')]=_0x312bd9[_0xe0d6('0x21')];this['callbackat']=_0x312bd9[_0xe0d6('0x22')];this['recallme']=_0x312bd9[_0xe0d6('0x23')];this[_0xe0d6('0x24')]=_0x312bd9[_0xe0d6('0x24')];this[_0xe0d6('0x25')]=_0x312bd9['ListId'];this[_0xe0d6('0x26')]=_0x312bd9[_0xe0d6('0x26')];this[_0xe0d6('0x27')]=_0x312bd9[_0xe0d6('0x27')];this[_0xe0d6('0x28')]=_0x312bd9[_0xe0d6('0x28')];this[_0xe0d6('0x29')]=_0x312bd9[_0xe0d6('0x29')]||'';this[_0xe0d6('0x2a')]=_0x312bd9[_0xe0d6('0x2a')]||'';this[_0xe0d6('0x2b')]=_0x312bd9[_0xe0d6('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x0f85=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','Answer','scheduledat'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x0f85,0x10f));var _0x50f8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0f85[_0x4a9fb1];return _0x348672;};'use strict';var moment=require(_0x50f8('0x0'));var utils=require(_0x50f8('0x1'));function AgentComplete(_0x443bd8,_0x2adaaa){this['state']=0x4;this[_0x50f8('0x2')]=_0x50f8('0x3');this[_0x50f8('0x4')]=_0x443bd8[_0x50f8('0x4')];this[_0x50f8('0x5')]=_0x443bd8['type'];this[_0x50f8('0x6')]=_0x443bd8[_0x50f8('0x5')]===_0x50f8('0x7')?_0x50f8('0x8'):_0x443bd8['type'];this['countbusyretry']=_0x443bd8[_0x50f8('0x9')];this[_0x50f8('0xa')]=_0x443bd8['countcongestionretry'];this['countnoanswerretry']=_0x443bd8['countnoanswerretry'];this[_0x50f8('0xb')]=_0x443bd8[_0x50f8('0x9')]+_0x443bd8['countcongestionretry']+_0x443bd8[_0x50f8('0xc')]+_0x443bd8['countnosuchnumberretry']+_0x443bd8[_0x50f8('0xd')]+_0x443bd8[_0x50f8('0xe')]+_0x443bd8[_0x50f8('0xf')]+_0x443bd8['countagentrejectretry'];this[_0x50f8('0x10')]=_0x443bd8[_0x50f8('0x10')];this[_0x50f8('0xd')]=_0x443bd8[_0x50f8('0xd')];this['countabandonedretry']=_0x443bd8[_0x50f8('0xe')];this[_0x50f8('0xf')]=_0x443bd8[_0x50f8('0xf')];this['countagentrejectretry']=_0x443bd8[_0x50f8('0x11')];this[_0x50f8('0x12')]=_0x2adaaa[_0x50f8('0x12')];this['calleridname']=_0x443bd8[_0x50f8('0x13')];this[_0x50f8('0x14')]=_0x443bd8[_0x50f8('0x15')];this[_0x50f8('0x16')]=_0x443bd8[_0x50f8('0x16')];this['responsetime']=_0x443bd8[_0x50f8('0x17')];this[_0x50f8('0x18')]=_0x443bd8[_0x50f8('0x18')];this[_0x50f8('0x19')]=moment()[_0x50f8('0x1a')](_0x50f8('0x1b'));this[_0x50f8('0x1c')]=utils['getSeconds'](_0x443bd8['responsetime'],_0x443bd8[_0x50f8('0x16')]);this[_0x50f8('0x1d')]=utils['getSeconds'](_0x443bd8[_0x50f8('0x18')],_0x443bd8[_0x50f8('0x17')]);this[_0x50f8('0x1e')]=utils[_0x50f8('0x1f')](this[_0x50f8('0x19')],_0x443bd8[_0x50f8('0x18')]);this[_0x50f8('0x8')]=_0x2adaaa['queue'];this[_0x50f8('0x20')]=_0x2adaaa[_0x50f8('0x20')];this[_0x50f8('0x21')]=_0x2adaaa[_0x50f8('0x21')];this[_0x50f8('0x22')]=_0x443bd8[_0x50f8('0x22')];this[_0x50f8('0x23')]=_0x443bd8[_0x50f8('0x23')];this[_0x50f8('0x24')]=_0x443bd8['callbackat'];this['recallme']=_0x443bd8['recallme'];this[_0x50f8('0x25')]=_0x443bd8[_0x50f8('0x25')];this[_0x50f8('0x26')]=_0x443bd8[_0x50f8('0x26')];this[_0x50f8('0x27')]=_0x443bd8[_0x50f8('0x27')];this[_0x50f8('0x28')]=_0x443bd8[_0x50f8('0x28')];this[_0x50f8('0x29')]=_0x443bd8[_0x50f8('0x29')];this['originatecalleridnum']=_0x443bd8[_0x50f8('0x2a')]||'';this[_0x50f8('0x2b')]=_0x443bd8[_0x50f8('0x2b')]||'';this[_0x50f8('0x2c')]=_0x443bd8['agiafterat'];}module[_0x50f8('0x2d')]=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 8970bac..87fc4f2 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 _0x7eeb=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum'];(function(_0x3104f6,_0x45d998){var _0x5bcc96=function(_0x504c0d){while(--_0x504c0d){_0x3104f6['push'](_0x3104f6['shift']());}};_0x5bcc96(++_0x45d998);}(_0x7eeb,0x78));var _0xb7ee=function(_0x5497d3,_0x193adf){_0x5497d3=_0x5497d3-0x0;var _0x42f1ef=_0x7eeb[_0x5497d3];return _0x42f1ef;};'use strict';function Final(_0x4b56e1){this[_0xb7ee('0x0')]=_0x4b56e1['uniqueid'];this[_0xb7ee('0x1')]=_0x4b56e1[_0xb7ee('0x1')];this[_0xb7ee('0x2')]=_0x4b56e1[_0xb7ee('0x2')];this[_0xb7ee('0x3')]=_0x4b56e1[_0xb7ee('0x2')]===_0xb7ee('0x4')?_0xb7ee('0x5'):_0x4b56e1[_0xb7ee('0x2')];this[_0xb7ee('0x6')]=_0x4b56e1[_0xb7ee('0x6')];this[_0xb7ee('0x7')]=_0x4b56e1[_0xb7ee('0x7')];this[_0xb7ee('0x8')]=_0x4b56e1[_0xb7ee('0x8')];this['countglobal']=_0x4b56e1[_0xb7ee('0x6')]+_0x4b56e1['countcongestionretry']+_0x4b56e1[_0xb7ee('0x8')]+_0x4b56e1[_0xb7ee('0x9')]+_0x4b56e1[_0xb7ee('0xa')]+_0x4b56e1['countabandonedretry']+_0x4b56e1['countmachineretry']+_0x4b56e1['countagentrejectretry'];this[_0xb7ee('0x9')]=_0x4b56e1['countnosuchnumberretry'];this[_0xb7ee('0xa')]=_0x4b56e1[_0xb7ee('0xa')];this['countabandonedretry']=_0x4b56e1[_0xb7ee('0xb')];this[_0xb7ee('0xc')]=_0x4b56e1[_0xb7ee('0xc')];this[_0xb7ee('0xd')]=_0x4b56e1['countagentrejectretry'];this['queue']=_0x4b56e1[_0xb7ee('0x5')];this['calleridname']=_0x4b56e1[_0xb7ee('0xe')];this[_0xb7ee('0xf')]=_0x4b56e1[_0xb7ee('0xf')];this['starttime']=_0x4b56e1[_0xb7ee('0x10')];this[_0xb7ee('0x11')]=_0x4b56e1[_0xb7ee('0x11')];this[_0xb7ee('0x12')]=_0x4b56e1[_0xb7ee('0x11')];this[_0xb7ee('0x13')]=_0x4b56e1[_0xb7ee('0x13')]||0x0;this[_0xb7ee('0x14')]=_0x4b56e1[_0xb7ee('0x14')]||0x0;this[_0xb7ee('0x15')]=_0x4b56e1[_0xb7ee('0x15')]||0x0;this[_0xb7ee('0x16')]=_0x4b56e1[_0xb7ee('0x16')];this[_0xb7ee('0x17')]=_0x4b56e1[_0xb7ee('0x17')];this['callbackat']=_0x4b56e1[_0xb7ee('0x18')];this[_0xb7ee('0x19')]=_0x4b56e1['recallme'];this[_0xb7ee('0x1a')]=_0x4b56e1[_0xb7ee('0x1a')];this[_0xb7ee('0x1b')]=_0x4b56e1[_0xb7ee('0x1b')];this[_0xb7ee('0x1c')]=_0x4b56e1['UserId'];this[_0xb7ee('0x1d')]=_0x4b56e1[_0xb7ee('0x1d')];this['CampaignId']=_0x4b56e1['CampaignId'];this[_0xb7ee('0x1e')]=_0x4b56e1['originatecalleridnum']||'';this[_0xb7ee('0x1f')]=_0x4b56e1[_0xb7ee('0x1f')]||'';this['state']=_0x4b56e1['state'];this[_0xb7ee('0x20')]=_0x4b56e1[_0xb7ee('0x20')];}module[_0xb7ee('0x21')]=Final; \ No newline at end of file +var _0x2c96=['originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2c96,0x6d));var _0x62c9=function(_0xd36fbc,_0x36147c){_0xd36fbc=_0xd36fbc-0x0;var _0x3b78dd=_0x2c96[_0xd36fbc];return _0x3b78dd;};'use strict';function Final(_0x226b1a){this[_0x62c9('0x0')]=_0x226b1a[_0x62c9('0x0')];this[_0x62c9('0x1')]=_0x226b1a['scheduledat'];this[_0x62c9('0x2')]=_0x226b1a['type'];this[_0x62c9('0x3')]=_0x226b1a[_0x62c9('0x2')]===_0x62c9('0x4')?_0x62c9('0x5'):_0x226b1a[_0x62c9('0x2')];this[_0x62c9('0x6')]=_0x226b1a['countbusyretry'];this[_0x62c9('0x7')]=_0x226b1a[_0x62c9('0x7')];this['countnoanswerretry']=_0x226b1a[_0x62c9('0x8')];this['countglobal']=_0x226b1a[_0x62c9('0x6')]+_0x226b1a['countcongestionretry']+_0x226b1a[_0x62c9('0x8')]+_0x226b1a['countnosuchnumberretry']+_0x226b1a[_0x62c9('0x9')]+_0x226b1a['countabandonedretry']+_0x226b1a[_0x62c9('0xa')]+_0x226b1a['countagentrejectretry'];this[_0x62c9('0xb')]=_0x226b1a[_0x62c9('0xb')];this['countdropretry']=_0x226b1a[_0x62c9('0x9')];this[_0x62c9('0xc')]=_0x226b1a[_0x62c9('0xc')];this[_0x62c9('0xa')]=_0x226b1a[_0x62c9('0xa')];this[_0x62c9('0xd')]=_0x226b1a['countagentrejectretry'];this['queue']=_0x226b1a[_0x62c9('0x5')];this[_0x62c9('0xe')]=_0x226b1a[_0x62c9('0xe')];this[_0x62c9('0xf')]=_0x226b1a[_0x62c9('0xf')];this[_0x62c9('0x10')]=_0x226b1a[_0x62c9('0x10')];this[_0x62c9('0x11')]=_0x226b1a[_0x62c9('0x11')];this[_0x62c9('0x12')]=_0x226b1a[_0x62c9('0x11')];this['ringtime']=_0x226b1a[_0x62c9('0x13')]||0x0;this[_0x62c9('0x14')]=_0x226b1a['holdtime']||0x0;this[_0x62c9('0x15')]=_0x226b1a[_0x62c9('0x15')]||0x0;this['callback']=_0x226b1a[_0x62c9('0x16')];this[_0x62c9('0x17')]=_0x226b1a['callbackuniqueid'];this[_0x62c9('0x18')]=_0x226b1a['callbackat'];this[_0x62c9('0x19')]=_0x226b1a[_0x62c9('0x19')];this['ContactId']=_0x226b1a[_0x62c9('0x1a')];this[_0x62c9('0x1b')]=_0x226b1a['ListId'];this[_0x62c9('0x1c')]=_0x226b1a[_0x62c9('0x1c')];this[_0x62c9('0x1d')]=_0x226b1a[_0x62c9('0x1d')];this[_0x62c9('0x1e')]=_0x226b1a[_0x62c9('0x1e')];this[_0x62c9('0x1f')]=_0x226b1a[_0x62c9('0x1f')]||'';this[_0x62c9('0x20')]=_0x226b1a[_0x62c9('0x20')]||'';this[_0x62c9('0x21')]=_0x226b1a[_0x62c9('0x21')];this[_0x62c9('0x22')]=_0x226b1a['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 9560628..05a8938 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 _0x997d=['reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','IVR'];(function(_0x22f649,_0x190bbc){var _0x2fc66c=function(_0x109314){while(--_0x109314){_0x22f649['push'](_0x22f649['shift']());}};_0x2fc66c(++_0x190bbc);}(_0x997d,0x18d));var _0xd997=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x997d[_0x47a349];return _0x18ab75;};'use strict';var moment=require(_0xd997('0x0'));var utils=require(_0xd997('0x1'));function Hangup(_0xb4a538,_0x1684f1){this[_0xd997('0x2')]=0x4;this[_0xd997('0x3')]=_0xd997('0x4');this[_0xd997('0x5')]=_0xb4a538['scheduledat'];this[_0xd997('0x6')]=_0xb4a538[_0xd997('0x6')];this[_0xd997('0x7')]=_0xb4a538[_0xd997('0x6')]===_0xd997('0x8')?_0xd997('0x9'):_0xb4a538['type'];this[_0xd997('0xa')]=_0xb4a538[_0xd997('0xa')]||![];this[_0xd997('0xb')]=_0xb4a538[_0xd997('0xb')];this[_0xd997('0xc')]=_0xb4a538[_0xd997('0xc')];this[_0xd997('0xd')]=_0xb4a538[_0xd997('0xd')];this[_0xd997('0xe')]=_0xb4a538[_0xd997('0xb')]+_0xb4a538[_0xd997('0xc')]+_0xb4a538[_0xd997('0xd')]+_0xb4a538['countnosuchnumberretry']+_0xb4a538['countdropretry']+_0xb4a538[_0xd997('0xf')]+_0xb4a538[_0xd997('0x10')]+_0xb4a538[_0xd997('0x11')];this[_0xd997('0x12')]=_0xb4a538['countnosuchnumberretry'];this[_0xd997('0x13')]=_0xb4a538[_0xd997('0x13')];this['countabandonedretry']=_0xb4a538[_0xd997('0xf')];this[_0xd997('0x10')]=_0xb4a538[_0xd997('0x10')];this[_0xd997('0x11')]=_0xb4a538[_0xd997('0x11')];this[_0xd997('0x14')]=_0x1684f1[_0xd997('0x14')];this[_0xd997('0x15')]=_0xb4a538[_0xd997('0x16')];this[_0xd997('0x17')]=_0xb4a538[_0xd997('0x18')];this[_0xd997('0x19')]=_0xb4a538[_0xd997('0x19')];this['responsetime']=_0xb4a538[_0xd997('0x1a')];this['endtime']=moment()[_0xd997('0x1b')](_0xd997('0x1c'));this[_0xd997('0x1d')]=utils[_0xd997('0x1e')](_0xb4a538['responsetime'],_0xb4a538[_0xd997('0x19')]);this['holdtime']=0x0;this['talktime']=utils[_0xd997('0x1e')](this['endtime'],_0xb4a538['responsetime']);this[_0xd997('0x9')]=_0xb4a538['queue'];this[_0xd997('0x1f')]=_0xd997('0x20');this[_0xd997('0x21')]=_0x1684f1[_0xd997('0x22')];this[_0xd997('0x23')]=_0xb4a538['callback'];this['callbackuniqueid']=_0xb4a538[_0xd997('0x24')];this[_0xd997('0x25')]=_0xb4a538[_0xd997('0x25')];this[_0xd997('0x26')]=_0xb4a538[_0xd997('0x26')];this[_0xd997('0x27')]=_0xb4a538['ContactId'];this[_0xd997('0x28')]=_0xb4a538[_0xd997('0x28')];this['UserId']=_0xb4a538['UserId'];this['VoiceQueueId']=_0xb4a538['VoiceQueueId'];this['CampaignId']=_0xb4a538[_0xd997('0x29')];}module[_0xd997('0x2a')]=Hangup; \ No newline at end of file +var _0x9fde=['../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','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','moment'];(function(_0x804071,_0x1c5f98){var _0x43a063=function(_0x4dbab3){while(--_0x4dbab3){_0x804071['push'](_0x804071['shift']());}};_0x43a063(++_0x1c5f98);}(_0x9fde,0x125));var _0xe9fd=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0x9fde[_0xee5d2a];return _0x346948;};'use strict';var moment=require(_0xe9fd('0x0'));var utils=require(_0xe9fd('0x1'));function Hangup(_0x16ca26,_0x577107){this[_0xe9fd('0x2')]=0x4;this[_0xe9fd('0x3')]=_0xe9fd('0x4');this[_0xe9fd('0x5')]=_0x16ca26[_0xe9fd('0x5')];this['type']=_0x16ca26[_0xe9fd('0x6')];this[_0xe9fd('0x7')]=_0x16ca26[_0xe9fd('0x6')]===_0xe9fd('0x8')?_0xe9fd('0x9'):_0x16ca26[_0xe9fd('0x6')];this[_0xe9fd('0xa')]=_0x16ca26['amd']||![];this[_0xe9fd('0xb')]=_0x16ca26[_0xe9fd('0xb')];this[_0xe9fd('0xc')]=_0x16ca26[_0xe9fd('0xc')];this['countnoanswerretry']=_0x16ca26['countnoanswerretry'];this['countglobal']=_0x16ca26[_0xe9fd('0xb')]+_0x16ca26[_0xe9fd('0xc')]+_0x16ca26['countnoanswerretry']+_0x16ca26[_0xe9fd('0xd')]+_0x16ca26[_0xe9fd('0xe')]+_0x16ca26[_0xe9fd('0xf')]+_0x16ca26['countmachineretry']+_0x16ca26[_0xe9fd('0x10')];this[_0xe9fd('0xd')]=_0x16ca26['countnosuchnumberretry'];this[_0xe9fd('0xe')]=_0x16ca26[_0xe9fd('0xe')];this[_0xe9fd('0xf')]=_0x16ca26['countabandonedretry'];this['countmachineretry']=_0x16ca26['countmachineretry'];this[_0xe9fd('0x10')]=_0x16ca26[_0xe9fd('0x10')];this['uniqueid']=_0x577107[_0xe9fd('0x11')];this[_0xe9fd('0x12')]=_0x16ca26[_0xe9fd('0x13')];this[_0xe9fd('0x14')]=_0x16ca26[_0xe9fd('0x15')];this[_0xe9fd('0x16')]=_0x16ca26[_0xe9fd('0x16')];this['responsetime']=_0x16ca26[_0xe9fd('0x17')];this[_0xe9fd('0x18')]=moment()[_0xe9fd('0x19')](_0xe9fd('0x1a'));this['ringtime']=utils[_0xe9fd('0x1b')](_0x16ca26[_0xe9fd('0x17')],_0x16ca26[_0xe9fd('0x16')]);this[_0xe9fd('0x1c')]=0x0;this[_0xe9fd('0x1d')]=utils[_0xe9fd('0x1b')](this[_0xe9fd('0x18')],_0x16ca26[_0xe9fd('0x17')]);this[_0xe9fd('0x9')]=_0x16ca26['queue'];this[_0xe9fd('0x1e')]=_0xe9fd('0x1f');this[_0xe9fd('0x20')]=_0x577107['cause-txt'];this[_0xe9fd('0x21')]=_0x16ca26['callback'];this[_0xe9fd('0x22')]=_0x16ca26[_0xe9fd('0x22')];this[_0xe9fd('0x23')]=_0x16ca26[_0xe9fd('0x23')];this[_0xe9fd('0x24')]=_0x16ca26[_0xe9fd('0x24')];this[_0xe9fd('0x25')]=_0x16ca26[_0xe9fd('0x25')];this[_0xe9fd('0x26')]=_0x16ca26[_0xe9fd('0x26')];this[_0xe9fd('0x27')]=_0x16ca26[_0xe9fd('0x27')];this[_0xe9fd('0x28')]=_0x16ca26[_0xe9fd('0x28')];this[_0xe9fd('0x29')]=_0x16ca26[_0xe9fd('0x29')];}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 7b3c798..6903913 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 _0x2b29=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x2b29,0x135));var _0x92b2=function(_0x2bca44,_0x411dc6){_0x2bca44=_0x2bca44-0x0;var _0x13d554=_0x2b29[_0x2bca44];return _0x13d554;};'use strict';var utils=require(_0x92b2('0x0'));function History(_0x47b0ed){this[_0x92b2('0x1')]=_0x47b0ed[_0x92b2('0x1')];this['scheduledat']=_0x47b0ed[_0x92b2('0x2')]||undefined;this[_0x92b2('0x3')]=_0x47b0ed[_0x92b2('0x3')];this[_0x92b2('0x4')]=_0x47b0ed['type']===_0x92b2('0x5')?_0x92b2('0x6'):_0x47b0ed['type'];this[_0x92b2('0x7')]=_0x47b0ed['countbusyretry'];this['countcongestionretry']=_0x47b0ed[_0x92b2('0x8')];this[_0x92b2('0x9')]=_0x47b0ed[_0x92b2('0x9')];this[_0x92b2('0xa')]=_0x47b0ed[_0x92b2('0x7')]+_0x47b0ed[_0x92b2('0x8')]+_0x47b0ed[_0x92b2('0x9')]+_0x47b0ed['countnosuchnumberretry']+_0x47b0ed[_0x92b2('0xb')]+_0x47b0ed[_0x92b2('0xc')]+_0x47b0ed['countmachineretry']+_0x47b0ed[_0x92b2('0xd')];this[_0x92b2('0xe')]=_0x47b0ed[_0x92b2('0xe')];this['countdropretry']=_0x47b0ed[_0x92b2('0xb')];this[_0x92b2('0xc')]=_0x47b0ed[_0x92b2('0xc')];this[_0x92b2('0xf')]=_0x47b0ed[_0x92b2('0xf')];this[_0x92b2('0xd')]=_0x47b0ed[_0x92b2('0xd')];this['queue']=_0x47b0ed['queue'];this['calleridname']=_0x47b0ed['name'];this[_0x92b2('0x10')]=_0x47b0ed[_0x92b2('0x11')];this[_0x92b2('0x12')]=_0x47b0ed[_0x92b2('0x12')];this[_0x92b2('0x13')]=_0x47b0ed[_0x92b2('0x13')];this[_0x92b2('0x14')]=_0x47b0ed['responsetime'];this['ringtime']=utils['getSeconds'](_0x47b0ed[_0x92b2('0x13')],_0x47b0ed[_0x92b2('0x12')]);this[_0x92b2('0x15')]=0x0;this[_0x92b2('0x16')]=0x0;this[_0x92b2('0x17')]=_0x47b0ed['callback'];this[_0x92b2('0x18')]=_0x47b0ed[_0x92b2('0x18')];this[_0x92b2('0x19')]=_0x47b0ed[_0x92b2('0x19')];this[_0x92b2('0x1a')]=_0x47b0ed['recallme'];this[_0x92b2('0x1b')]=_0x47b0ed[_0x92b2('0x1b')];this[_0x92b2('0x1c')]=_0x47b0ed[_0x92b2('0x1c')];this[_0x92b2('0x1d')]=_0x47b0ed[_0x92b2('0x1d')];this[_0x92b2('0x1e')]=_0x47b0ed[_0x92b2('0x1e')];this[_0x92b2('0x1f')]=_0x47b0ed[_0x92b2('0x1f')];this[_0x92b2('0x20')]=_0x47b0ed[_0x92b2('0x20')]||'';this[_0x92b2('0x21')]=_0x47b0ed['originatecalleridname']||'';this[_0x92b2('0x22')]=_0x47b0ed[_0x92b2('0x22')];this[_0x92b2('0x23')]=_0x47b0ed[_0x92b2('0x23')];}module[_0x92b2('0x24')]=History; \ No newline at end of file +var _0x92ce=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x49846c,_0x28581c){var _0x4fffa9=function(_0x4476ce){while(--_0x4476ce){_0x49846c['push'](_0x49846c['shift']());}};_0x4fffa9(++_0x28581c);}(_0x92ce,0xa0));var _0xe92c=function(_0x1fd594,_0x596a93){_0x1fd594=_0x1fd594-0x0;var _0x4b6a8f=_0x92ce[_0x1fd594];return _0x4b6a8f;};'use strict';var utils=require(_0xe92c('0x0'));function History(_0x4432ed){this[_0xe92c('0x1')]=_0x4432ed[_0xe92c('0x1')];this[_0xe92c('0x2')]=_0x4432ed[_0xe92c('0x2')]||undefined;this[_0xe92c('0x3')]=_0x4432ed[_0xe92c('0x3')];this[_0xe92c('0x4')]=_0x4432ed[_0xe92c('0x3')]===_0xe92c('0x5')?_0xe92c('0x6'):_0x4432ed[_0xe92c('0x3')];this['countbusyretry']=_0x4432ed[_0xe92c('0x7')];this[_0xe92c('0x8')]=_0x4432ed[_0xe92c('0x8')];this[_0xe92c('0x9')]=_0x4432ed['countnoanswerretry'];this[_0xe92c('0xa')]=_0x4432ed[_0xe92c('0x7')]+_0x4432ed[_0xe92c('0x8')]+_0x4432ed[_0xe92c('0x9')]+_0x4432ed[_0xe92c('0xb')]+_0x4432ed['countdropretry']+_0x4432ed[_0xe92c('0xc')]+_0x4432ed[_0xe92c('0xd')]+_0x4432ed[_0xe92c('0xe')];this['countnosuchnumberretry']=_0x4432ed[_0xe92c('0xb')];this[_0xe92c('0xf')]=_0x4432ed[_0xe92c('0xf')];this[_0xe92c('0xc')]=_0x4432ed[_0xe92c('0xc')];this['countmachineretry']=_0x4432ed[_0xe92c('0xd')];this['countagentrejectretry']=_0x4432ed[_0xe92c('0xe')];this['queue']=_0x4432ed[_0xe92c('0x6')];this['calleridname']=_0x4432ed[_0xe92c('0x10')];this[_0xe92c('0x11')]=_0x4432ed['number'];this[_0xe92c('0x12')]=_0x4432ed[_0xe92c('0x12')];this[_0xe92c('0x13')]=_0x4432ed[_0xe92c('0x13')];this[_0xe92c('0x14')]=_0x4432ed[_0xe92c('0x13')];this[_0xe92c('0x15')]=utils[_0xe92c('0x16')](_0x4432ed[_0xe92c('0x13')],_0x4432ed['starttime']);this[_0xe92c('0x17')]=0x0;this['talktime']=0x0;this[_0xe92c('0x18')]=_0x4432ed[_0xe92c('0x18')];this[_0xe92c('0x19')]=_0x4432ed[_0xe92c('0x19')];this[_0xe92c('0x1a')]=_0x4432ed['callbackat'];this[_0xe92c('0x1b')]=_0x4432ed[_0xe92c('0x1b')];this[_0xe92c('0x1c')]=_0x4432ed[_0xe92c('0x1c')];this[_0xe92c('0x1d')]=_0x4432ed[_0xe92c('0x1d')];this[_0xe92c('0x1e')]=_0x4432ed[_0xe92c('0x1e')];this[_0xe92c('0x1f')]=_0x4432ed[_0xe92c('0x1f')];this['CampaignId']=_0x4432ed[_0xe92c('0x20')];this[_0xe92c('0x21')]=_0x4432ed[_0xe92c('0x21')]||'';this[_0xe92c('0x22')]=_0x4432ed['originatecalleridname']||'';this[_0xe92c('0x23')]=_0x4432ed[_0xe92c('0x23')];this['statedesc']=_0x4432ed[_0xe92c('0x24')];}module[_0xe92c('0x25')]=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 24830ef..03d3164 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 _0x9cdb=['talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','getSeconds'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9cdb,0x94));var _0xb9cd=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x9cdb[_0x2f57b2];return _0x5ace77;};'use strict';var utils=require(_0xb9cd('0x0'));function QueueCallerAbandon(_0x32830b,_0x21d456){this[_0xb9cd('0x1')]=_0x32830b[_0xb9cd('0x1')];this[_0xb9cd('0x2')]=_0x32830b[_0xb9cd('0x2')];this['campaigntype']=_0x32830b[_0xb9cd('0x2')]===_0xb9cd('0x3')?_0xb9cd('0x4'):_0x32830b[_0xb9cd('0x2')];this[_0xb9cd('0x5')]=_0x32830b[_0xb9cd('0x5')];this[_0xb9cd('0x6')]=_0x32830b[_0xb9cd('0x6')];this[_0xb9cd('0x7')]=_0x32830b[_0xb9cd('0x7')];this[_0xb9cd('0x8')]=_0x32830b[_0xb9cd('0x5')]+_0x32830b[_0xb9cd('0x6')]+_0x32830b[_0xb9cd('0x7')]+_0x32830b[_0xb9cd('0x9')]+_0x32830b[_0xb9cd('0xa')]+_0x32830b[_0xb9cd('0xb')]+_0x32830b['countmachineretry']+_0x32830b[_0xb9cd('0xc')];this[_0xb9cd('0x9')]=_0x32830b[_0xb9cd('0x9')];this[_0xb9cd('0xa')]=_0x32830b[_0xb9cd('0xa')];this[_0xb9cd('0xb')]=_0x32830b[_0xb9cd('0xb')];this[_0xb9cd('0xd')]=_0x32830b[_0xb9cd('0xd')];this[_0xb9cd('0xc')]=_0x32830b[_0xb9cd('0xc')];this['uniqueid']=_0x21d456['uniqueid'];this[_0xb9cd('0xe')]=_0x32830b[_0xb9cd('0xf')];this[_0xb9cd('0x10')]=_0x32830b[_0xb9cd('0x11')];this[_0xb9cd('0x12')]=_0x32830b[_0xb9cd('0x12')];this[_0xb9cd('0x13')]=_0x32830b[_0xb9cd('0x13')];this[_0xb9cd('0x14')]=_0x32830b[_0xb9cd('0x14')];this['dropreason']=_0x32830b['dropreason'];this[_0xb9cd('0x15')]=this[_0xb9cd('0x14')];this[_0xb9cd('0x16')]=utils[_0xb9cd('0x17')](_0x32830b[_0xb9cd('0x13')],_0x32830b[_0xb9cd('0x12')]);this['holdtime']=utils[_0xb9cd('0x17')](this[_0xb9cd('0x14')],_0x32830b[_0xb9cd('0x13')]);this[_0xb9cd('0x18')]=0x0;this[_0xb9cd('0x4')]=_0x21d456[_0xb9cd('0x4')];this[_0xb9cd('0x19')]=_0x21d456[_0xb9cd('0x1a')];this['reason']=_0x21d456[_0xb9cd('0x1b')];this['callback']=_0x32830b[_0xb9cd('0x1c')];this['callbackuniqueid']=_0x32830b[_0xb9cd('0x1d')];this['callbackat']=_0x32830b[_0xb9cd('0x1e')];this[_0xb9cd('0x1f')]=_0x32830b[_0xb9cd('0x1f')];this[_0xb9cd('0x20')]=_0x32830b[_0xb9cd('0x20')];this['ListId']=_0x32830b[_0xb9cd('0x21')];this[_0xb9cd('0x22')]=_0x32830b[_0xb9cd('0x22')];this[_0xb9cd('0x23')]=_0x32830b[_0xb9cd('0x23')];this[_0xb9cd('0x24')]=_0x32830b[_0xb9cd('0x24')];this[_0xb9cd('0x25')]=_0x32830b['originatecalleridnum']||'';this[_0xb9cd('0x26')]=_0x32830b[_0xb9cd('0x26')]||'';this['agiafterat']=_0x32830b[_0xb9cd('0x27')];this[_0xb9cd('0x28')]=_0x32830b[_0xb9cd('0x28')];this[_0xb9cd('0x29')]=_0x32830b['statedesc'];}module[_0xb9cd('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x770c=['statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','droptime','dropreason','ringtime','responsetime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state'];(function(_0x3af5b0,_0x283199){var _0x5681db=function(_0x5c366a){while(--_0x5c366a){_0x3af5b0['push'](_0x3af5b0['shift']());}};_0x5681db(++_0x283199);}(_0x770c,0xf8));var _0xc770=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x770c[_0x19e35c];return _0x3e1fe8;};'use strict';var utils=require(_0xc770('0x0'));function QueueCallerAbandon(_0x323119,_0x4b2367){this['scheduledat']=_0x323119[_0xc770('0x1')];this[_0xc770('0x2')]=_0x323119['type'];this[_0xc770('0x3')]=_0x323119[_0xc770('0x2')]==='outbound'?_0xc770('0x4'):_0x323119['type'];this[_0xc770('0x5')]=_0x323119['countbusyretry'];this[_0xc770('0x6')]=_0x323119['countcongestionretry'];this['countnoanswerretry']=_0x323119[_0xc770('0x7')];this[_0xc770('0x8')]=_0x323119['countbusyretry']+_0x323119['countcongestionretry']+_0x323119[_0xc770('0x7')]+_0x323119[_0xc770('0x9')]+_0x323119[_0xc770('0xa')]+_0x323119['countabandonedretry']+_0x323119['countmachineretry']+_0x323119[_0xc770('0xb')];this['countnosuchnumberretry']=_0x323119[_0xc770('0x9')];this['countdropretry']=_0x323119['countdropretry'];this[_0xc770('0xc')]=_0x323119[_0xc770('0xc')];this[_0xc770('0xd')]=_0x323119[_0xc770('0xd')];this[_0xc770('0xb')]=_0x323119[_0xc770('0xb')];this[_0xc770('0xe')]=_0x4b2367[_0xc770('0xe')];this[_0xc770('0xf')]=_0x323119['name'];this[_0xc770('0x10')]=_0x323119[_0xc770('0x11')];this[_0xc770('0x12')]=_0x323119[_0xc770('0x12')];this['responsetime']=_0x323119['responsetime'];this[_0xc770('0x13')]=_0x323119[_0xc770('0x13')];this['dropreason']=_0x323119[_0xc770('0x14')];this['endtime']=this[_0xc770('0x13')];this[_0xc770('0x15')]=utils['getSeconds'](_0x323119['responsetime'],_0x323119[_0xc770('0x12')]);this['holdtime']=utils['getSeconds'](this['droptime'],_0x323119[_0xc770('0x16')]);this[_0xc770('0x17')]=0x0;this[_0xc770('0x4')]=_0x4b2367[_0xc770('0x4')];this[_0xc770('0x18')]=_0x4b2367[_0xc770('0x19')];this[_0xc770('0x1a')]=_0x4b2367['reason'];this['callback']=_0x323119[_0xc770('0x1b')];this[_0xc770('0x1c')]=_0x323119[_0xc770('0x1c')];this[_0xc770('0x1d')]=_0x323119[_0xc770('0x1d')];this[_0xc770('0x1e')]=_0x323119[_0xc770('0x1e')];this[_0xc770('0x1f')]=_0x323119[_0xc770('0x1f')];this[_0xc770('0x20')]=_0x323119[_0xc770('0x20')];this[_0xc770('0x21')]=_0x323119[_0xc770('0x21')];this[_0xc770('0x22')]=_0x323119[_0xc770('0x22')];this['CampaignId']=_0x323119[_0xc770('0x23')];this[_0xc770('0x24')]=_0x323119[_0xc770('0x24')]||'';this[_0xc770('0x25')]=_0x323119[_0xc770('0x25')]||'';this['agiafterat']=_0x323119['agiafterat'];this[_0xc770('0x26')]=_0x323119[_0xc770('0x26')];this[_0xc770('0x27')]=_0x323119[_0xc770('0x27')];}module[_0xc770('0x28')]=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 89e2f76..8848dd8 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 _0x4888=['[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime'];(function(_0xcfa72c,_0x6dc88c){var _0xce192b=function(_0x4a7843){while(--_0x4a7843){_0xcfa72c['push'](_0xcfa72c['shift']());}};_0xce192b(++_0x6dc88c);}(_0x4888,0x198));var _0x8488=function(_0x5ee89d,_0x1a7c29){_0x5ee89d=_0x5ee89d-0x0;var _0x3fa4cc=_0x4888[_0x5ee89d];return _0x3fa4cc;};'use strict';var util=require('util');var logger=require(_0x8488('0x0'))(_0x8488('0x1'));var cmHopper=require(_0x8488('0x2'));var cmHopperAdditionalPhone=require(_0x8488('0x3'));var cmHopperBlack=require(_0x8488('0x4'));var cmHopperHistory=require(_0x8488('0x5'));function inspectError(_0x19e51d){return util['inspect'](_0x19e51d,{'showHidden':![],'depth':null});}function getContactDialer(_0x267093,_0xf45c3f,_0x1a97f4){return cmHopper[_0x8488('0x6')](_0x267093['id'],_0xf45c3f,_0x1a97f4,_0x267093[_0x8488('0x7')])[_0x8488('0x8')](function(_0x5250a1){_0x267093['temp']=0x0;logger['error']('[getContactDialer]',inspectError(_0x5250a1));});}exports[_0x8488('0x6')]=getContactDialer;function getContactDialerIvr(_0x1bae81,_0x542bd8){return cmHopper[_0x8488('0x9')](_0x1bae81['id'],_0x542bd8,_0x1bae81[_0x8488('0x7')])[_0x8488('0x8')](function(_0x19a2ee){_0x1bae81['temp']=0x0;logger[_0x8488('0xa')](_0x8488('0xb'),inspectError(_0x19a2ee));});}exports[_0x8488('0x9')]=getContactDialerIvr;function countReScheduled(_0x256bab){return cmHopper[_0x8488('0xc')](_0x256bab)['catch'](function(_0x14462e){logger[_0x8488('0xa')]('[countReScheduled]',inspectError(_0x14462e));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x150b52){return cmHopper['rescheduleContact'](_0x150b52)[_0x8488('0x8')](function(_0x4e94fc){logger['error'](_0x8488('0xd'),inspectError(_0x4e94fc));});}exports[_0x8488('0xe')]=rescheduleContact;function unlockContact(_0x5700b,_0x2bcb7c,_0x3b3cfa){return cmHopper[_0x8488('0xf')](_0x5700b,_0x2bcb7c,_0x3b3cfa)[_0x8488('0x8')](function(_0x4e44af){logger[_0x8488('0xa')](_0x8488('0x10'),inspectError(_0x4e44af));});}exports[_0x8488('0xf')]=unlockContact;function moveContactManagedDialer(_0x37361d){return cmHopper[_0x8488('0x11')](_0x37361d)[_0x8488('0x8')](function(_0x1aedb1){logger[_0x8488('0xa')](_0x8488('0x12'),inspectError(_0x1aedb1));});}exports[_0x8488('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x10bfd6){return cmHopperBlack[_0x8488('0x13')](_0x10bfd6)[_0x8488('0x8')](function(_0x554ec6){logger['error'](_0x8488('0x14'),inspectError(_0x554ec6));});}exports[_0x8488('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0xbb10fe){return cmHopperBlack[_0x8488('0x15')](_0xbb10fe)[_0x8488('0x8')](function(_0x1bef99){logger[_0x8488('0xa')](_0x8488('0x16'),inspectError(_0x1bef99));});}exports[_0x8488('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5123d0,_0x476a14,_0x4e07e1){return cmHopperAdditionalPhone[_0x8488('0x17')](_0x5123d0,_0x476a14,_0x4e07e1)[_0x8488('0x8')](function(_0x290b33){logger['error']('[verifyAdditionalPhone]',inspectError(_0x290b33));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x59b5e2,_0x472624,_0x51fe30){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x59b5e2,_0x472624,_0x51fe30)[_0x8488('0x8')](function(_0x2f350a){logger[_0x8488('0xa')](_0x8488('0x18'),inspectError(_0x2f350a));});}exports[_0x8488('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x503b83){return cmHopperHistory[_0x8488('0x1a')](_0x503b83)[_0x8488('0x8')](function(_0xf9720e){logger[_0x8488('0xa')](_0x8488('0x1b'),inspectError(_0xf9720e));});}exports[_0x8488('0x1a')]=avgHandleTime;function createHistory(_0x2c15ff){return cmHopperHistory[_0x8488('0x1c')](_0x2c15ff)[_0x8488('0x8')](function(_0x1d9317){logger[_0x8488('0xa')]('[createHistory]',inspectError(_0x1d9317));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x4fb4=['moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]'];(function(_0x5ade16,_0x3ab6c0){var _0x13696b=function(_0x2e16b5){while(--_0x2e16b5){_0x5ade16['push'](_0x5ade16['shift']());}};_0x13696b(++_0x3ab6c0);}(_0x4fb4,0x190));var _0x44fb=function(_0x57bcaa,_0x229400){_0x57bcaa=_0x57bcaa-0x0;var _0x56f274=_0x4fb4[_0x57bcaa];return _0x56f274;};'use strict';var util=require('util');var logger=require(_0x44fb('0x0'))(_0x44fb('0x1'));var cmHopper=require(_0x44fb('0x2'));var cmHopperAdditionalPhone=require(_0x44fb('0x3'));var cmHopperBlack=require(_0x44fb('0x4'));var cmHopperHistory=require(_0x44fb('0x5'));function inspectError(_0x53ee5d){return util[_0x44fb('0x6')](_0x53ee5d,{'showHidden':![],'depth':null});}function getContactDialer(_0x953327,_0x308b96,_0x26fbd6){return cmHopper[_0x44fb('0x7')](_0x953327['id'],_0x308b96,_0x26fbd6,_0x953327[_0x44fb('0x8')])[_0x44fb('0x9')](function(_0x2a4d75){_0x953327['temp']=0x0;logger[_0x44fb('0xa')](_0x44fb('0xb'),inspectError(_0x2a4d75));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x42fcc2,_0x3d9002){return cmHopper[_0x44fb('0xc')](_0x42fcc2['id'],_0x3d9002,_0x42fcc2[_0x44fb('0x8')])[_0x44fb('0x9')](function(_0x44c83b){_0x42fcc2[_0x44fb('0xd')]=0x0;logger[_0x44fb('0xa')](_0x44fb('0xe'),inspectError(_0x44c83b));});}exports[_0x44fb('0xc')]=getContactDialerIvr;function countReScheduled(_0x4b202d){return cmHopper[_0x44fb('0xf')](_0x4b202d)[_0x44fb('0x9')](function(_0x40cb86){logger[_0x44fb('0xa')](_0x44fb('0x10'),inspectError(_0x40cb86));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x1fc8fa){return cmHopper[_0x44fb('0x11')](_0x1fc8fa)[_0x44fb('0x9')](function(_0x449150){logger[_0x44fb('0xa')]('[rescheduleContact]',inspectError(_0x449150));});}exports[_0x44fb('0x11')]=rescheduleContact;function unlockContact(_0x18268c,_0x472658,_0x147fe0){return cmHopper[_0x44fb('0x12')](_0x18268c,_0x472658,_0x147fe0)[_0x44fb('0x9')](function(_0x19b828){logger['error'](_0x44fb('0x13'),inspectError(_0x19b828));});}exports[_0x44fb('0x12')]=unlockContact;function moveContactManagedDialer(_0x2e0efd){return cmHopper[_0x44fb('0x14')](_0x2e0efd)[_0x44fb('0x9')](function(_0x22c2eb){logger[_0x44fb('0xa')](_0x44fb('0x15'),inspectError(_0x22c2eb));});}exports[_0x44fb('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1fc48c){return cmHopperBlack['checkIsBlackList'](_0x1fc48c)['catch'](function(_0x4b50f5){logger[_0x44fb('0xa')](_0x44fb('0x16'),inspectError(_0x4b50f5));});}exports[_0x44fb('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x544647){return cmHopperBlack[_0x44fb('0x18')](_0x544647)[_0x44fb('0x9')](function(_0x3394e2){logger['error']('[checkIsBlackListIvr]',inspectError(_0x3394e2));});}exports[_0x44fb('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5cf7ec,_0x441d79,_0x4fc66d){return cmHopperAdditionalPhone[_0x44fb('0x19')](_0x5cf7ec,_0x441d79,_0x4fc66d)[_0x44fb('0x9')](function(_0x1f3d5c){logger['error']('[verifyAdditionalPhone]',inspectError(_0x1f3d5c));});}exports[_0x44fb('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0xa50a49,_0x1c831e,_0x733c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xa50a49,_0x1c831e,_0x733c)[_0x44fb('0x9')](function(_0x3a7cd1){logger['error']('[swapAdditionalPhone]',inspectError(_0x3a7cd1));});}exports[_0x44fb('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x2611d6){return cmHopperHistory[_0x44fb('0x1b')](_0x2611d6)[_0x44fb('0x9')](function(_0xb7e5e8){logger[_0x44fb('0xa')](_0x44fb('0x1c'),inspectError(_0xb7e5e8));});}exports[_0x44fb('0x1b')]=avgHandleTime;function createHistory(_0x6bd0b4){return cmHopperHistory['createHistory'](_0x6bd0b4)['catch'](function(_0x587984){logger[_0x44fb('0xa')]('[createHistory]',inspectError(_0x587984));});}exports[_0x44fb('0x1d')]=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 8e185dd..2b0a3f9 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 _0xddbf=['setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','checkContactEmpty','[checkContactLowerLimitOriginate]\x20','createdAt','tags','updatedAt','undefined','description','length','XMD-','substring','toUpperCase'];(function(_0x2968fe,_0x4d11bb){var _0x1b361f=function(_0xe96328){while(--_0xe96328){_0x2968fe['push'](_0x2968fe['shift']());}};_0x1b361f(++_0x4d11bb);}(_0xddbf,0x1c8));var _0xfddb=function(_0x344a56,_0x1045a4){_0x344a56=_0x344a56-0x0;var _0x2ac981=_0xddbf[_0x344a56];return _0x2ac981;};'use strict';var _=require(_0xfddb('0x0'));var moment=require(_0xfddb('0x1'));var util=require(_0xfddb('0x2'));var logger=require(_0xfddb('0x3'))('dialer');var timezones=require(_0xfddb('0x4'))[_0xfddb('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xfddb('0x6'),'BLACKLIST':_0xfddb('0x7'),'CONTACTS_RESCHEDULED':_0xfddb('0x8'),'DEACTIVATED':_0xfddb('0x9'),'DISACTIVED':_0xfddb('0xa'),'EMPTY_INTERVAL':_0xfddb('0xb'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xfddb('0xc'),'OVERTIME_INTERVAL':_0xfddb('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xfddb('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xfddb('0xf'),'RUNNING':_0xfddb('0x10'),'UNKNOWN_TIMEZONE':_0xfddb('0x11'),'UNREACHABLE_TRUNK':_0xfddb('0x12')};exports[_0xfddb('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x15ba9f){return _0x15ba9f['dialMethod']===_0xfddb('0x14');}exports[_0xfddb('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x332586){return _0x332586[_0xfddb('0x16')]===_0xfddb('0x17');}exports[_0xfddb('0x18')]=isIVRCampaign;function isOutboundQueue(_0x116849){return _0x116849['type']===_0xfddb('0x19');}exports[_0xfddb('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x226121){return _0x226121[_0xfddb('0x1b')];}exports[_0xfddb('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x42d4b1){return _0x42d4b1['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x1a4b62,_0x40702d){var _0x21b96f=moment(_0x1a4b62)['milliseconds'](0x0);var _0x1d242e=moment(_0x40702d)[_0xfddb('0x1d')](0x0);return _0x21b96f[_0xfddb('0x1e')](_0x1d242e,_0xfddb('0x1f'));}exports[_0xfddb('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x405dc3,_0x58bf89){var _0x234e0b=![];var _0x58a57d=_0x405dc3[_0xfddb('0x21')]!==_0x58bf89[_0xfddb('0x21')]||_0x405dc3[_0xfddb('0x1b')]!==_0x58bf89['dialActive']||_0x405dc3[_0xfddb('0x22')]!==_0x58bf89[_0xfddb('0x22')];var _0xa9e057=_0x405dc3['available']!==_0x58bf89[_0xfddb('0x23')]||_0x405dc3[_0xfddb('0x24')]!==_0x58bf89[_0xfddb('0x24')]||_0x405dc3[_0xfddb('0x25')]!==_0x58bf89['loggedInDb']||_0x405dc3[_0xfddb('0x26')]!==_0x58bf89[_0xfddb('0x26')]||_0x405dc3[_0xfddb('0x27')]!==_0x58bf89[_0xfddb('0x27')]||_0x405dc3[_0xfddb('0x28')]!==_0x58bf89[_0xfddb('0x28')]||_0x405dc3[_0xfddb('0x29')]!==_0x58bf89[_0xfddb('0x29')]||_0x405dc3[_0xfddb('0x2a')]!==_0x58bf89[_0xfddb('0x2a')]||_0x405dc3[_0xfddb('0x2b')]!==_0x58bf89['originated'];if(_0x405dc3['Trunk']&&_0x58bf89[_0xfddb('0x2c')]){_0x234e0b=_0x405dc3[_0xfddb('0x2c')]['name']!==_0x58bf89[_0xfddb('0x2c')][_0xfddb('0x2d')]||_0x405dc3[_0xfddb('0x2c')][_0xfddb('0x2e')]!==_0x58bf89[_0xfddb('0x2c')][_0xfddb('0x2e')];}return _0x58a57d||_0xa9e057||_0x234e0b;}exports[_0xfddb('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1e41af){var _0x187438=null;var _0x32a341=_0x1e41af['dialTimezone'];if(_[_0xfddb('0x30')](_0x1e41af[_0xfddb('0x31')])||_[_0xfddb('0x30')](_0x1e41af[_0xfddb('0x32')])||_[_0xfddb('0x30')](_0x1e41af[_0xfddb('0x32')][_0xfddb('0x33')])){_0x187438=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xfddb('0x34')](_0x1e41af[_0xfddb('0x31')])||_[_0xfddb('0x34')](_0x1e41af[_0xfddb('0x32')][_0xfddb('0x33')])){_0x187438=CAMPAIGN_STATUS[_0xfddb('0x35')];}else if(_0x32a341&&!timezones[_0x32a341]){_0x187438=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x187438;}function checkAnyValidTrunk(_0x2f47b5,_0x283f05){var _0x3fcdd5=null;var _0x598506='SIP/';var _0x42ecb0=[_0xfddb('0x36'),_0xfddb('0x37')];var _0x59ab45=!![];if(_0x2f47b5[_0xfddb('0x2c')]&&_0x2f47b5[_0xfddb('0x2c')][_0xfddb('0x2e')]){_0x598506+=_0x2f47b5[_0xfddb('0x2c')][_0xfddb('0x2d')];_0x3fcdd5=_0x283f05[_0x598506];_0x59ab45=_0x42ecb0[_0xfddb('0x38')](_0x3fcdd5[_0xfddb('0x39')]);}else if(_0x2f47b5[_0xfddb('0x3a')]&&_0x2f47b5[_0xfddb('0x3a')][_0xfddb('0x2e')]){_0x598506+=_0x2f47b5[_0xfddb('0x3a')][_0xfddb('0x2d')];_0x3fcdd5=_0x283f05[_0x598506];_0x59ab45=_0x42ecb0['includes'](_0x3fcdd5[_0xfddb('0x39')]);}return _0x59ab45;}function getQueueCampaignStatusMessage(_0x180a63,_0x3486bf){var _0x2787ab=CAMPAIGN_STATUS[_0xfddb('0x6')];var _0x52762d=isPreviewCampaign(_0x180a63);if(!isQueueCampaignActive(_0x180a63)){if(_0x52762d){_0x2787ab=CAMPAIGN_STATUS[_0xfddb('0x3b')];}else{if(_0x180a63[_0xfddb('0x2b')]===0x0&&_0x180a63[_0xfddb('0x27')]===0x0&&_0x180a63[_0xfddb('0x29')]===0x0&&(_0x180a63[_0xfddb('0x28')]||0x0)===0x0){_0x2787ab=CAMPAIGN_STATUS['INACTIVE'];}else{_0x2787ab=CAMPAIGN_STATUS[_0xfddb('0x3c')];}}}else if(_0x180a63[_0xfddb('0x24')]===0x0){_0x2787ab=CAMPAIGN_STATUS[_0xfddb('0x3d')];}else if(!checkAnyValidTrunk(_0x180a63,_0x3486bf)){_0x2787ab=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x180a63)){var _0x50df2d=checkAnyValidQueueCampaignInterval(_0x180a63);if(_0x50df2d){_0x2787ab=_0x50df2d;}}return _0x2787ab;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x124d16){var _0x3eb527=CAMPAIGN_STATUS['DISACTIVED'];if(_0x124d16['originated']===0x0&&_0x124d16[_0xfddb('0x27')]===0x0&&_0x124d16[_0xfddb('0x29')]===0x0&&(_0x124d16['pTalking']||0x0)===0x0){_0x3eb527=CAMPAIGN_STATUS[_0xfddb('0x3b')];}return _0x3eb527;}exports[_0xfddb('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x241170){var _0x52a4b9=_0x241170['match'](/"(.*?)"/);return _0x52a4b9?_0x52a4b9[0x1]:_0x241170;}exports[_0xfddb('0x3f')]=extractCalleridName;function getCallerId(_0x5e6b23,_0x9fbc6e,_0x170b56){if(!_[_0xfddb('0x40')](_0x170b56)&&typeof _0x170b56===_0xfddb('0x41')&&!_[_0xfddb('0x34')](_0x170b56)){if(!_[_0xfddb('0x40')](_0x9fbc6e)&&typeof _0x9fbc6e===_0xfddb('0x41')&&!_[_0xfddb('0x34')](_0x9fbc6e)){return util[_0xfddb('0x42')](_0xfddb('0x43'),_0x9fbc6e,_0x170b56);}return util[_0xfddb('0x42')](_0xfddb('0x43'),_0x170b56,_0x170b56);}if(!_[_0xfddb('0x40')](_0x5e6b23)&&typeof _0x5e6b23===_0xfddb('0x41')&&!_[_0xfddb('0x34')](_0x5e6b23)){return _0x5e6b23;}return _0xfddb('0x44');}exports[_0xfddb('0x45')]=getCallerId;function getCallerIdRandom(_0x5ebaf7,_0x17f916){var _0x16969b;var _0x1d5b1b;var _0x1d316b;if(_0x17f916<=0x0){_0x17f916=0x1;}_0x16969b=new RegExp(_0xfddb('0x46')+_0x17f916+'}$');_0x1d5b1b=Math[_0xfddb('0x47')](0xa,_0x17f916-0x1);_0x1d316b=Math[_0xfddb('0x47')](0xa,_0x17f916)-0x1;return util[_0xfddb('0x42')]('%s',_[_0xfddb('0x48')](_0x5ebaf7,_0x16969b,_[_0xfddb('0x49')](_0x1d5b1b,_0x1d316b)[_0xfddb('0x4a')]()));}exports[_0xfddb('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x1d5f81,_0x42b9f6){if(_0x1d5f81[_0xfddb('0x2b')]&&_0x1d5f81['originated']>0x0){_0x1d5f81[_0xfddb('0x2b')]-=0x1;}else{logger[_0xfddb('0x4c')](_0xfddb('0x4d'),_0x42b9f6);}}exports[_0xfddb('0x4e')]=decrementOriginate;function checkContactEmpty(_0x2ae463){return _0x2ae463&&_0x2ae463['length']>0x0;}exports[_0xfddb('0x4f')]=checkContactEmpty;function erlangb(_0x1c2a5e,_0x532afc){if(_0x532afc===0x0){return 0x0;}var _0x4c33fa=0x1;for(var _0x5e332=0x1;_0x5e332<=_0x532afc;_0x5e332+=0x1){_0x4c33fa=0x1+_0x4c33fa*_0x5e332/_0x1c2a5e;}return 0x1/_0x4c33fa;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x5bad14,_0x544c76,_0x4020de){if(_0x544c76>_0x4020de){for(var _0x3a7c7f=0x0;_0x3a7c7f<_0x544c76-_0x4020de;_0x3a7c7f+=0x1){decrementOriginate(_0x5bad14,_0xfddb('0x50'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x209fbb){var _0x3613ee={};var _0x174ab9=['id',_0xfddb('0x51'),_0xfddb('0x52'),_0xfddb('0x53')];const _0x1558a3=0xfa;if(_0x209fbb){for(var _0x44f636 in _0x209fbb){if(typeof _0x209fbb[_0x44f636]!==_0xfddb('0x54')){if(!_['isNil'](_0x209fbb[_0x44f636])&&!_0x174ab9[_0xfddb('0x38')](_0x44f636)){if(_0x44f636===_0xfddb('0x55')&&_0x209fbb[_0x44f636][_0xfddb('0x56')]>_0x1558a3){_0x3613ee[_0xfddb('0x57')+_0x44f636['toUpperCase']()]=_0x209fbb[_0x44f636]['toString']()[_0xfddb('0x58')](0x0,_0x1558a3);}else{_0x3613ee['XMD-'+_0x44f636[_0xfddb('0x59')]()]=_0x209fbb[_0x44f636];}}}}}return _0x3613ee;}exports[_0xfddb('0x5a')]=setXMDContactVariables; \ No newline at end of file +var _0x880b=['RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','milliseconds','seconds','message','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','decrementOriginate','length','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','description','XMD-','toUpperCase','substring','setXMDContactVariables','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'];(function(_0xa911e,_0x1a9f9a){var _0x28bd6f=function(_0x3b15ad){while(--_0x3b15ad){_0xa911e['push'](_0xa911e['shift']());}};_0x28bd6f(++_0x1a9f9a);}(_0x880b,0xa9));var _0xb880=function(_0x4964eb,_0x18a716){_0x4964eb=_0x4964eb-0x0;var _0x5313fd=_0x880b[_0x4964eb];return _0x5313fd;};'use strict';var _=require(_0xb880('0x0'));var moment=require(_0xb880('0x1'));var util=require(_0xb880('0x2'));var logger=require(_0xb880('0x3'))(_0xb880('0x4'));var timezones=require(_0xb880('0x5'))[_0xb880('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0xb880('0x7'),'BLACKLIST':_0xb880('0x8'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xb880('0x9'),'DISACTIVED':_0xb880('0xa'),'EMPTY_INTERVAL':_0xb880('0xb'),'INACTIVE':_0xb880('0xc'),'NO_AGENTS_LOGGED':_0xb880('0xd'),'NO_AVAILABLE_CONTACTS':_0xb880('0xe'),'NULL_INTERVAL':_0xb880('0xf'),'OVERTIME_INTERVAL':_0xb880('0x10'),'OVERTIME_GLOBAL_INTERVAL':_0xb880('0x11'),'QUEUE_RECALL':_0xb880('0x12'),'RECALL_TIMEOUT':_0xb880('0x13'),'RUNNING':_0xb880('0x14'),'UNKNOWN_TIMEZONE':_0xb880('0x15'),'UNREACHABLE_TRUNK':_0xb880('0x16')};exports[_0xb880('0x17')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x411a0d){return _0x411a0d[_0xb880('0x18')]===_0xb880('0x19');}exports[_0xb880('0x1a')]=isPreviewCampaign;function isIVRCampaign(_0x40d5f7){return _0x40d5f7[_0xb880('0x1b')]==='ivr';}exports[_0xb880('0x1c')]=isIVRCampaign;function isOutboundQueue(_0x2ada27){return _0x2ada27[_0xb880('0x1b')]===_0xb880('0x1d');}exports[_0xb880('0x1e')]=isOutboundQueue;function isQueueCampaignActive(_0x2cd2cd){return _0x2cd2cd[_0xb880('0x1f')];}exports[_0xb880('0x20')]=isQueueCampaignActive;function isIVRCampaignActive(_0x21334f){return _0x21334f['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x362948,_0x288a1e){var _0x3d09f6=moment(_0x362948)[_0xb880('0x21')](0x0);var _0x12e607=moment(_0x288a1e)[_0xb880('0x21')](0x0);return _0x3d09f6['diff'](_0x12e607,_0xb880('0x22'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x4e290b,_0x4613b6){var _0x5ca636=![];var _0x175a76=_0x4e290b[_0xb880('0x18')]!==_0x4613b6[_0xb880('0x18')]||_0x4e290b[_0xb880('0x1f')]!==_0x4613b6[_0xb880('0x1f')]||_0x4e290b[_0xb880('0x23')]!==_0x4613b6[_0xb880('0x23')];var _0x531e1e=_0x4e290b['available']!==_0x4613b6['available']||_0x4e290b[_0xb880('0x24')]!==_0x4613b6['loggedIn']||_0x4e290b[_0xb880('0x25')]!==_0x4613b6[_0xb880('0x25')]||_0x4e290b[_0xb880('0x26')]!==_0x4613b6['paused']||_0x4e290b[_0xb880('0x27')]!==_0x4613b6[_0xb880('0x27')]||_0x4e290b['pTalking']!==_0x4613b6[_0xb880('0x28')]||_0x4e290b[_0xb880('0x29')]!==_0x4613b6[_0xb880('0x29')]||_0x4e290b[_0xb880('0x2a')]!==_0x4613b6['inUse']||_0x4e290b[_0xb880('0x2b')]!==_0x4613b6[_0xb880('0x2b')];if(_0x4e290b[_0xb880('0x2c')]&&_0x4613b6[_0xb880('0x2c')]){_0x5ca636=_0x4e290b[_0xb880('0x2c')][_0xb880('0x2d')]!==_0x4613b6[_0xb880('0x2c')]['name']||_0x4e290b['Trunk'][_0xb880('0x2e')]!==_0x4613b6[_0xb880('0x2c')][_0xb880('0x2e')];}return _0x175a76||_0x531e1e||_0x5ca636;}exports[_0xb880('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x238efd){var _0x40dd79=null;var _0x283ced=_0x238efd[_0xb880('0x30')];if(_[_0xb880('0x31')](_0x238efd['dialGlobalInterval'])||_[_0xb880('0x31')](_0x238efd[_0xb880('0x32')])||_['isNil'](_0x238efd[_0xb880('0x32')]['Intervals'])){_0x40dd79=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xb880('0x33')](_0x238efd[_0xb880('0x34')])||_[_0xb880('0x33')](_0x238efd[_0xb880('0x32')]['Intervals'])){_0x40dd79=CAMPAIGN_STATUS[_0xb880('0x35')];}else if(_0x283ced&&!timezones[_0x283ced]){_0x40dd79=CAMPAIGN_STATUS[_0xb880('0x36')];}return _0x40dd79;}function checkAnyValidTrunk(_0x131e7f,_0x18278e){var _0x511223=null;var _0x94dd1=_0xb880('0x37');var _0x5e0a56=[_0xb880('0x38'),_0xb880('0x39')];var _0x12b7ab=!![];if(_0x131e7f['Trunk']&&_0x131e7f[_0xb880('0x2c')][_0xb880('0x2e')]){_0x94dd1+=_0x131e7f[_0xb880('0x2c')][_0xb880('0x2d')];_0x511223=_0x18278e[_0x94dd1];_0x12b7ab=_0x5e0a56[_0xb880('0x3a')](_0x511223[_0xb880('0x3b')]);}else if(_0x131e7f[_0xb880('0x3c')]&&_0x131e7f[_0xb880('0x3c')]['active']){_0x94dd1+=_0x131e7f[_0xb880('0x3c')][_0xb880('0x2d')];_0x511223=_0x18278e[_0x94dd1];_0x12b7ab=_0x5e0a56['includes'](_0x511223[_0xb880('0x3b')]);}return _0x12b7ab;}function getQueueCampaignStatusMessage(_0x40674d,_0x853256){var _0x500a66=CAMPAIGN_STATUS[_0xb880('0x7')];var _0x51585c=isPreviewCampaign(_0x40674d);if(!isQueueCampaignActive(_0x40674d)){if(_0x51585c){_0x500a66=CAMPAIGN_STATUS[_0xb880('0x3d')];}else{if(_0x40674d[_0xb880('0x2b')]===0x0&&_0x40674d['talking']===0x0&&_0x40674d['waiting']===0x0&&(_0x40674d[_0xb880('0x28')]||0x0)===0x0){_0x500a66=CAMPAIGN_STATUS[_0xb880('0x3d')];}else{_0x500a66=CAMPAIGN_STATUS[_0xb880('0x3e')];}}}else if(_0x40674d[_0xb880('0x24')]===0x0){_0x500a66=CAMPAIGN_STATUS[_0xb880('0x3f')];}else if(!checkAnyValidTrunk(_0x40674d,_0x853256)){_0x500a66=CAMPAIGN_STATUS[_0xb880('0x40')];}else if(!isPreviewCampaign(_0x40674d)){var _0x767b2b=checkAnyValidQueueCampaignInterval(_0x40674d);if(_0x767b2b){_0x500a66=_0x767b2b;}}return _0x500a66;}exports[_0xb880('0x41')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x52b97a){var _0x289b19=CAMPAIGN_STATUS['DISACTIVED'];if(_0x52b97a[_0xb880('0x2b')]===0x0&&_0x52b97a[_0xb880('0x27')]===0x0&&_0x52b97a[_0xb880('0x29')]===0x0&&(_0x52b97a[_0xb880('0x28')]||0x0)===0x0){_0x289b19=CAMPAIGN_STATUS[_0xb880('0x3d')];}return _0x289b19;}exports[_0xb880('0x42')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2b2076){var _0x2abc9f=_0x2b2076[_0xb880('0x43')](/"(.*?)"/);return _0x2abc9f?_0x2abc9f[0x1]:_0x2b2076;}exports[_0xb880('0x44')]=extractCalleridName;function getCallerId(_0xc2e7fa,_0x598d74,_0x4fffcc){if(!_[_0xb880('0x45')](_0x4fffcc)&&typeof _0x4fffcc===_0xb880('0x46')&&!_[_0xb880('0x33')](_0x4fffcc)){if(!_[_0xb880('0x45')](_0x598d74)&&typeof _0x598d74===_0xb880('0x46')&&!_['isEmpty'](_0x598d74)){return util[_0xb880('0x47')](_0xb880('0x48'),_0x598d74,_0x4fffcc);}return util[_0xb880('0x47')](_0xb880('0x48'),_0x4fffcc,_0x4fffcc);}if(!_[_0xb880('0x45')](_0xc2e7fa)&&typeof _0xc2e7fa===_0xb880('0x46')&&!_['isEmpty'](_0xc2e7fa)){return _0xc2e7fa;}return _0xb880('0x49');}exports[_0xb880('0x4a')]=getCallerId;function getCallerIdRandom(_0x1a52e4,_0x2bf2dc){var _0x3cf966;var _0x2cca9b;var _0x28d1d1;if(_0x2bf2dc<=0x0){_0x2bf2dc=0x1;}_0x3cf966=new RegExp(_0xb880('0x4b')+_0x2bf2dc+'}$');_0x2cca9b=Math[_0xb880('0x4c')](0xa,_0x2bf2dc-0x1);_0x28d1d1=Math['pow'](0xa,_0x2bf2dc)-0x1;return util[_0xb880('0x47')]('%s',_[_0xb880('0x4d')](_0x1a52e4,_0x3cf966,_[_0xb880('0x4e')](_0x2cca9b,_0x28d1d1)[_0xb880('0x4f')]()));}exports[_0xb880('0x50')]=getCallerIdRandom;function decrementOriginate(_0x3d81b1,_0x24f930){if(_0x3d81b1['originated']&&_0x3d81b1[_0xb880('0x2b')]>0x0){_0x3d81b1[_0xb880('0x2b')]-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value',_0x24f930);}}exports[_0xb880('0x51')]=decrementOriginate;function checkContactEmpty(_0x3d73ff){return _0x3d73ff&&_0x3d73ff[_0xb880('0x52')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x431a10,_0x23ed0e){if(_0x23ed0e===0x0){return 0x0;}var _0x12f5d1=0x1;for(var _0x2f50ac=0x1;_0x2f50ac<=_0x23ed0e;_0x2f50ac+=0x1){_0x12f5d1=0x1+_0x12f5d1*_0x2f50ac/_0x431a10;}return 0x1/_0x12f5d1;}exports[_0xb880('0x53')]=erlangb;function checkContactLowerLimitOriginate(_0x136a14,_0x501bd8,_0x4fbd3e){if(_0x501bd8>_0x4fbd3e){for(var _0x4bd5cb=0x0;_0x4bd5cb<_0x501bd8-_0x4fbd3e;_0x4bd5cb+=0x1){decrementOriginate(_0x136a14,_0xb880('0x54'));}}}exports[_0xb880('0x55')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x32a842){var _0x42627b={};var _0x219b76=['id',_0xb880('0x56'),_0xb880('0x57'),_0xb880('0x58')];const _0x27f9=0xfa;if(_0x32a842){for(var _0x2bd673 in _0x32a842){if(typeof _0x32a842[_0x2bd673]!=='undefined'){if(!_[_0xb880('0x31')](_0x32a842[_0x2bd673])&&!_0x219b76[_0xb880('0x3a')](_0x2bd673)){if(_0x2bd673===_0xb880('0x59')&&_0x32a842[_0x2bd673][_0xb880('0x52')]>_0x27f9){_0x42627b[_0xb880('0x5a')+_0x2bd673[_0xb880('0x5b')]()]=_0x32a842[_0x2bd673][_0xb880('0x4f')]()[_0xb880('0x5c')](0x0,_0x27f9);}else{_0x42627b[_0xb880('0x5a')+_0x2bd673[_0xb880('0x5b')]()]=_0x32a842[_0x2bd673];}}}}}return _0x42627b;}exports[_0xb880('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 ba8b018..98fd2f4 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(_0x2f2a0e,_0x2f5593){var _0x4b2d9d=function(_0x5a3c2b){while(--_0x5a3c2b){_0x2f2a0e['push'](_0x2f2a0e['shift']());}};_0x4b2d9d(++_0x2f5593);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x2256d8,_0x46fb9d){var _0x50e4aa=function(_0x16a325){while(--_0x16a325){_0x2256d8['push'](_0x2256d8['shift']());}};_0x50e4aa(++_0x46fb9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 6d2be6a..caa6064 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 _0x19c4=['channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','name','.pdf','application/pdf','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','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','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','variable'];(function(_0x27799b,_0xc3152b){var _0x522e82=function(_0x5cc404){while(--_0x5cc404){_0x27799b['push'](_0x27799b['shift']());}};_0x522e82(++_0xc3152b);}(_0x19c4,0x144));var _0x419c=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x19c4[_0x1fd675];return _0x16b554;};'use strict';var util=require(_0x419c('0x0'));var _=require(_0x419c('0x1'));var BPromise=require('bluebird');var uuid=require(_0x419c('0x2'));var moment=require(_0x419c('0x3'));var path=require(_0x419c('0x4'));var tiff2pdf=require(_0x419c('0x5'));var gs=require('./util/gs');var logger=require(_0x419c('0x6'))(_0x419c('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x419c('0x8'));var Action=require(_0x419c('0x9'));var faxAccount=require(_0x419c('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x419c('0xb'));function Fax(_0x5ed6a9){this[_0x419c('0xc')]={};this[_0x419c('0xd')]=_0x5ed6a9['faxAccounts'];this['trunks']=_0x5ed6a9[_0x419c('0xe')];this[_0x419c('0xf')]={};ami['on']('newchannel',this['syncNewchannel'][_0x419c('0x10')](this));ami['on'](_0x419c('0x11'),this[_0x419c('0x12')]['bind'](this));ami['on'](_0x419c('0x13'),this[_0x419c('0x14')][_0x419c('0x10')](this));ami['on'](_0x419c('0x15'),this[_0x419c('0x16')][_0x419c('0x10')](this));ami['on'](_0x419c('0x17'),this[_0x419c('0x18')]['bind'](this));ami['on'](_0x419c('0x19'),this[_0x419c('0x1a')][_0x419c('0x10')](this));ami['on']('hangup',this[_0x419c('0x1b')][_0x419c('0x10')](this));ami['on'](_0x419c('0x1c'),this[_0x419c('0x1d')][_0x419c('0x10')](this));}Fax[_0x419c('0x1e')][_0x419c('0x1f')]=function(_0x33c8a7){if(_0x33c8a7[_0x419c('0x20')]===_0x419c('0x21')){for(var _0x49dac8 in this['faxAccounts']){if(this[_0x419c('0xd')][_0x419c('0x22')](_0x49dac8)){if(_0x33c8a7[_0x419c('0x23')]===this[_0x419c('0xd')][_0x49dac8][_0x419c('0x24')]){this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]]={};this['channels'][_0x33c8a7['uniqueid']][_0x419c('0x26')]=_0x33c8a7[_0x419c('0x26')];this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]]['id']=this[_0x419c('0xd')][_0x49dac8]['id'];this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]]['name']=this[_0x419c('0xd')][_0x49dac8]['name'];logger[_0x419c('0x27')](_0x33c8a7['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x419c('0xf')][_0x33c8a7[_0x419c('0x25')]]){this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]]={};this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]][_0x419c('0x26')]=_0x33c8a7['channel'];logger[_0x419c('0x27')](_0x33c8a7[_0x419c('0x25')],_0x419c('0x28'));}};Fax[_0x419c('0x1e')]['syncVarSet']=function(_0x3b464d){if(this[_0x419c('0xc')][_0x3b464d[_0x419c('0x25')]]){for(var _0x7ac591 in _0x3b464d[_0x419c('0x29')]){if(_0x3b464d[_0x419c('0x29')]['hasOwnProperty'](_0x7ac591)){this[_0x419c('0xc')][_0x3b464d[_0x419c('0x25')]][_0x7ac591]=_0x3b464d['value'];}}}};Fax['prototype'][_0x419c('0x14')]=function(_0x5cd6b4){if(this[_0x419c('0xc')][_0x5cd6b4[_0x419c('0x25')]]){this[_0x419c('0xc')][_0x5cd6b4[_0x419c('0x25')]][_0x419c('0x2a')]=_0x5cd6b4[_0x419c('0x2a')];this[_0x419c('0xc')][_0x5cd6b4['uniqueid']][_0x419c('0x2b')]=_0x5cd6b4['channelstatedesc'];}};Fax[_0x419c('0x1e')]['syncNewExten']=function(_0x5e0985){if(this['channels'][_0x5e0985['uniqueid']]){for(var _0x752573 in _0x5e0985['variable']){if(_0x5e0985[_0x419c('0x29')][_0x419c('0x22')](_0x752573)){this[_0x419c('0xc')][_0x5e0985[_0x419c('0x25')]][_0x752573]=_0x5e0985[_0x419c('0x2c')];}}}};Fax[_0x419c('0x1e')][_0x419c('0x18')]=function(_0x52a111){if(this['channels'][_0x52a111['uniqueid']]){this[_0x419c('0xc')][_0x52a111[_0x419c('0x25')]][_0x419c('0x2d')]=_0x52a111[_0x419c('0x2d')];this[_0x419c('0xc')][_0x52a111[_0x419c('0x25')]][_0x419c('0x2e')]=_0x52a111[_0x419c('0x2e')];this[_0x419c('0xc')][_0x52a111[_0x419c('0x25')]]['localstationid']=_0x52a111[_0x419c('0x24')];this[_0x419c('0xc')][_0x52a111['uniqueid']][_0x419c('0x2f')]=_0x52a111[_0x419c('0x2f')];logger[_0x419c('0x27')](_0x52a111[_0x419c('0x25')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x244e2b){var _0xe98320=this;if(this[_0x419c('0xc')][_0x244e2b['uniqueid']]){var _0x40ea80=this['channels'][_0x244e2b[_0x419c('0x25')]]['id'];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]][_0x419c('0x30')]=_0x244e2b[_0x419c('0x30')];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]][_0x419c('0x31')]=_0x244e2b[_0x419c('0x31')];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]]['localstationid']=_0x244e2b[_0x419c('0x24')];this['channels'][_0x244e2b[_0x419c('0x25')]]['resolution']=_0x244e2b[_0x419c('0x32')];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]][_0x419c('0x33')]=_0x244e2b[_0x419c('0x33')];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]][_0x419c('0x2f')]=_0x244e2b[_0x419c('0x2f')];this['channels'][_0x244e2b[_0x419c('0x25')]][_0x419c('0x34')]=_0x244e2b[_0x419c('0x34')];if(this[_0x419c('0xc')][_0x244e2b['uniqueid']][_0x419c('0x31')]>0x0){tiff2pdf(_0x244e2b[_0x419c('0x2f')],_0x419c('0x35'),function(_0x32e479){logger[_0x419c('0x27')](_0x244e2b['uniqueid'],_0x419c('0x36'),_0x32e479[_0x419c('0x37')]);attachment[_0x419c('0x38')]({'name':path[_0x419c('0x39')](_0x244e2b[_0x419c('0x2f')])['name'],'basename':path[_0x419c('0x39')](_0x244e2b['filename'])[_0x419c('0x3a')]+_0x419c('0x3b'),'type':_0x419c('0x3c')})['then'](function(_0x503ab7){faxAccount[_0x419c('0x3d')](_0x40ea80,{'from':_0x244e2b['calleridnum'],'mapKey':_0x419c('0x7'),'body':path[_0x419c('0x39')](_0x244e2b['filename'])['name']+_0x419c('0x3b'),'AttachmentId':_0x503ab7['id']})[_0x419c('0x3e')](function(_0x1b59a2){logger['error'](_0x244e2b['uniqueid'],_0x419c('0x3f'),JSON['stringify'](_0x1b59a2));});})['catch'](function(_0x326370){logger[_0x419c('0x40')](_0x244e2b['uniqueid'],_0x419c('0x41'),JSON[_0x419c('0x42')](_0x326370));});});}logger[_0x419c('0x27')](_0x244e2b[_0x419c('0x25')],'\x20receiveFax\x20');}};Fax[_0x419c('0x1e')][_0x419c('0x1d')]=function(_0x128a18){if(this[_0x419c('0xf')][_0x128a18['uniqueid']]){_[_0x419c('0x43')](this[_0x419c('0xc')][_0x128a18[_0x419c('0x25')]],_[_0x419c('0x44')](_0x128a18,['response',_0x419c('0x45')]));}};function updateStatus(_0x49b5e4){if(_0x49b5e4['AttachmentId']){faxMessage[_0x419c('0x46')](_0x49b5e4[_0x419c('0x47')],{'failMessage':_0x419c('0x48')})[_0x419c('0x49')](function(_0x59efa8){ut['logger'](_0x419c('0x4a'),_0x59efa8);})[_0x419c('0x3e')](function(_0x376fc3){ut[_0x419c('0x4b')](_0x419c('0x4c'),_0x376fc3);});}else{ut[_0x419c('0x4b')](_0x419c('0x4d'));}}Fax[_0x419c('0x1e')][_0x419c('0x4e')]=function(_0x109fb6,_0x462b9b,_0x5d74a4){var _0x595d17=this;var _0x547525={};if(_0x462b9b){_0x547525={'read':_0x462b9b};}else{_0x547525={'failMessage':_0x5d74a4};}if(this['actions'][_0x109fb6]['AttachmentId']){faxMessage[_0x419c('0x46')](this['actions'][_0x109fb6][_0x419c('0x47')],_0x547525)[_0x419c('0x49')](function(_0x38797a){ut[_0x419c('0x4b')](_0x419c('0x4f'),_0x38797a);})[_0x419c('0x3e')](function(_0x14ee04){ut['logger'](_0x419c('0x50'),_0x14ee04);})[_0x419c('0x51')](function(){delete _0x595d17[_0x419c('0xc')][_0x109fb6];delete _0x595d17[_0x419c('0xf')][_0x109fb6];});}else{ut['logger'](_0x419c('0x52'));this[_0x419c('0x53')](_0x109fb6);delete this[_0x419c('0xf')][_0x109fb6];}};Fax[_0x419c('0x1e')]['syncHangup']=function(_0x2657e8){var _0x5df71a=this;if(this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]]){if(this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]]){this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]]['id']=this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]]['id'];this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]]['name']=this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]][_0x419c('0x3a')];}logger['info'](_0x2657e8['uniqueid'],this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]]?_0x419c('0x54'):_0x419c('0x55'),JSON[_0x419c('0x42')](this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]]));if(this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]]){if(this['channels'][_0x2657e8[_0x419c('0x25')]][_0x419c('0x56')]>0x0&&this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]][_0x419c('0x17')]===_0x419c('0x57')){this['updateStatus'](_0x2657e8[_0x419c('0x25')],!![]);}else{this[_0x419c('0x4e')](_0x2657e8[_0x419c('0x25')],![],this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]][_0x419c('0x58')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x2657e8[_0x419c('0x25')]]['faxstatusstring']:_0x419c('0x59'));}}}};Fax[_0x419c('0x1e')][_0x419c('0x5a')]=function(_0x5835e7){var _0x494170=this;return new BPromise(function(_0x5dc4bc,_0x570a0a){_0x494170['execOriginate'](_0x5835e7,_0x494170[_0x419c('0xd')][_0x5835e7[_0x419c('0x5b')]])[_0x419c('0x49')](function(_0xcbb3c0){ut[_0x419c('0x4b')](_0x419c('0x5c'),_0xcbb3c0);_0x5dc4bc(ut['message'](_0x419c('0x5d')));})[_0x419c('0x3e')](function(_0x518d90){ut[_0x419c('0x4b')](_0x419c('0x5e'),_0x518d90);updateStatus(_0x5835e7);_0x570a0a(ut[_0x419c('0x37')](_0x419c('0x5f')));});});};Fax[_0x419c('0x1e')][_0x419c('0x60')]=function(_0x153a77){var _0x3913de=this;return new BPromise(function(_0x5f00ab,_0x172a42){var _0x5c5f17=_0x3913de[_0x419c('0x61')](_0x3913de[_0x419c('0xd')][_0x153a77[_0x419c('0x5b')]][_0x419c('0x62')],_0x153a77);if(_0x5c5f17[_0x419c('0x63')]){_0x5f00ab(ut[_0x419c('0x37')]('Trunk\x20Reachable'));}else{_0x172a42(ut[_0x419c('0x37')](_0x5c5f17[_0x419c('0x37')]));}});};function originate(_0x5e343d,_0x2da6f0,_0xfbfa35){return new BPromise(function(_0x279099,_0x362890){if(_0xfbfa35){var _0x1de1ef=util['format'](_0x419c('0x64'),path[_0x419c('0x39')](_0x5e343d[_0x419c('0x4')])[_0x419c('0x3a')],_0x5e343d[_0x419c('0x4')]);gs['execute'](_0x1de1ef)[_0x419c('0x49')](function(){_0x5e343d[_0x419c('0x4')]=util[_0x419c('0x65')](_0x419c('0x66'),path['parse'](_0x5e343d['path'])['dir'],path[_0x419c('0x39')](_0x5e343d[_0x419c('0x4')])[_0x419c('0x3a')]);_0x2da6f0[_0x419c('0x67')]=_0x5e343d[_0x419c('0x4')];ut[_0x419c('0x4b')](_0x419c('0x68'),'');ami[_0x419c('0x69')](ut['variablesAction'](_0x5e343d,_0x2da6f0))[_0x419c('0x49')](function(_0x2ffcf6){_0x279099(_0x2ffcf6);})[_0x419c('0x3e')](function(_0x5d4816){_0x362890(_0x5d4816);});})['catch'](function(_0x2f3b4d){_0x362890(_0x2f3b4d);});}else{ami[_0x419c('0x69')](ut[_0x419c('0x6a')](_0x5e343d,_0x2da6f0))['then'](function(_0x4b086b){_0x279099(_0x4b086b);})['catch'](function(_0x3c620e){_0x362890(_0x3c620e);});}});}Fax['prototype'][_0x419c('0x6b')]=function(_0x31630d,_0x58bb8c){var _0x18b5e8=this;return new BPromise(function(_0x3ca09d,_0x53286b){var _0x546b59=uuid['v4']();var _0x26a8ca=ut[_0x419c('0x6c')](_0x31630d,_0x58bb8c);_0x18b5e8[_0x419c('0xf')][_0x546b59]=new Action(_0x546b59,_0x58bb8c,_0x31630d);var _0x3442f0=_0x18b5e8['actions'][_0x546b59];if(path[_0x419c('0x39')](_0x31630d[_0x419c('0x4')])['ext']===_0x419c('0x3b')){originate(_0x3442f0,_0x26a8ca,!![])[_0x419c('0x49')](function(_0x5dcbb0){_0x3ca09d(_0x5dcbb0);})[_0x419c('0x3e')](function(_0xba1d7a){_0x53286b(_0xba1d7a);});}else{originate(_0x3442f0,_0x26a8ca,![])[_0x419c('0x49')](function(_0x3af800){_0x3ca09d(_0x3af800);})['catch'](function(_0x1dd7ec){_0x53286b(_0x1dd7ec);});}});};Fax[_0x419c('0x1e')][_0x419c('0x6d')]=function(_0x2e720d){return!_[_0x419c('0x6e')](_0x2e720d)&&!_[_0x419c('0x6e')](_0x2e720d['name'])&&!_['isNil'](_0x2e720d[_0x419c('0x6f')])&&_0x2e720d[_0x419c('0x6f')]&&!_['isNil'](this[_0x419c('0xe')][util[_0x419c('0x65')](_0x419c('0x70'),_0x2e720d[_0x419c('0x3a')])])&&!_['isNil'](this[_0x419c('0xe')][util[_0x419c('0x65')](_0x419c('0x70'),_0x2e720d[_0x419c('0x3a')])]['status'])&&(this[_0x419c('0xe')][util['format'](_0x419c('0x70'),_0x2e720d[_0x419c('0x3a')])][_0x419c('0x2e')]===_0x419c('0x71')||this['trunks'][util[_0x419c('0x65')](_0x419c('0x70'),_0x2e720d[_0x419c('0x3a')])]['status']===_0x419c('0x72'));};Fax[_0x419c('0x1e')][_0x419c('0x61')]=function(_0x5b42fe,_0x1c800d){if(!this[_0x419c('0x6d')](_0x5b42fe)){ut['logger'](_0x419c('0x73'),_[_0x419c('0x6e')](_0x5b42fe)?'':_0x5b42fe[_0x419c('0x3a')]+_0x419c('0x74'));return{'isValid':![],'message':_0x419c('0x75')};}if(_[_0x419c('0x6e')](_0x1c800d[_0x419c('0x7')])){ut[_0x419c('0x4b')](_0x419c('0x76'),JSON[_0x419c('0x42')](_0x1c800d));return{'isValid':![],'message':_0x419c('0x77')};}if(_[_0x419c('0x6e')](_0x1c800d[_0x419c('0x4')])){ut[_0x419c('0x4b')](_0x419c('0x78'),JSON[_0x419c('0x42')](_0x1c800d));return{'isValid':![],'message':_0x419c('0x79')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0x419c('0x1e')][_0x419c('0x53')]=function(_0xe04c08,_0x3f7a40=0x2710){if(this[_0x419c('0xc')][_0xe04c08]){setTimeout(()=>{delete this[_0x419c('0xc')][_0xe04c08];},_0x3f7a40);}};module['exports']=Fax; \ No newline at end of file +var _0x2279=['../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','status','localstationid','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','then','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','pick','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','message','Fax\x20received','checkAfterSend','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax'];(function(_0x33d997,_0x278b20){var _0x10d1bd=function(_0x2f66b7){while(--_0x2f66b7){_0x33d997['push'](_0x33d997['shift']());}};_0x10d1bd(++_0x278b20);}(_0x2279,0x71));var _0x9227=function(_0x20a297,_0x5cd60a){_0x20a297=_0x20a297-0x0;var _0x30f78b=_0x2279[_0x20a297];return _0x30f78b;};'use strict';var util=require(_0x9227('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x9227('0x1'));var moment=require(_0x9227('0x2'));var path=require('path');var tiff2pdf=require(_0x9227('0x3'));var gs=require(_0x9227('0x4'));var logger=require(_0x9227('0x5'))(_0x9227('0x6'));var ami=require(_0x9227('0x7'));var rpcDb=require(_0x9227('0x8'));var Channel=require(_0x9227('0x9'));var ut=require(_0x9227('0xa'));var Action=require(_0x9227('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x9227('0xc'));var faxMessage=require(_0x9227('0xd'));function Fax(_0x332b71){this['channels']={};this[_0x9227('0xe')]=_0x332b71[_0x9227('0xe')];this[_0x9227('0xf')]=_0x332b71[_0x9227('0xf')];this[_0x9227('0x10')]={};ami['on'](_0x9227('0x11'),this[_0x9227('0x12')][_0x9227('0x13')](this));ami['on'](_0x9227('0x14'),this[_0x9227('0x15')]['bind'](this));ami['on'](_0x9227('0x16'),this[_0x9227('0x17')][_0x9227('0x13')](this));ami['on'](_0x9227('0x18'),this[_0x9227('0x19')][_0x9227('0x13')](this));ami['on'](_0x9227('0x1a'),this['syncFaxStatus'][_0x9227('0x13')](this));ami['on'](_0x9227('0x1b'),this['syncReceiveFax']['bind'](this));ami['on'](_0x9227('0x1c'),this[_0x9227('0x1d')]['bind'](this));ami['on'](_0x9227('0x1e'),this['syncOriginateResponse'][_0x9227('0x13')](this));}Fax[_0x9227('0x1f')][_0x9227('0x12')]=function(_0x2d39b8){if(_0x2d39b8[_0x9227('0x20')]===_0x9227('0x21')){for(var _0x4bf5cb in this[_0x9227('0xe')]){if(this[_0x9227('0xe')][_0x9227('0x22')](_0x4bf5cb)){if(_0x2d39b8[_0x9227('0x23')]===this[_0x9227('0xe')][_0x4bf5cb]['localstationid']){this[_0x9227('0x24')][_0x2d39b8[_0x9227('0x25')]]={};this['channels'][_0x2d39b8[_0x9227('0x25')]]['channel']=_0x2d39b8['channel'];this['channels'][_0x2d39b8[_0x9227('0x25')]]['id']=this[_0x9227('0xe')][_0x4bf5cb]['id'];this[_0x9227('0x24')][_0x2d39b8[_0x9227('0x25')]][_0x9227('0x26')]=this[_0x9227('0xe')][_0x4bf5cb][_0x9227('0x26')];logger[_0x9227('0x27')](_0x2d39b8[_0x9227('0x25')],_0x9227('0x28'));}}}}if(this[_0x9227('0x10')][_0x2d39b8['uniqueid']]){this[_0x9227('0x24')][_0x2d39b8[_0x9227('0x25')]]={};this['channels'][_0x2d39b8[_0x9227('0x25')]]['channel']=_0x2d39b8['channel'];logger[_0x9227('0x27')](_0x2d39b8[_0x9227('0x25')],'\x20syncNewchannel\x20');}};Fax[_0x9227('0x1f')][_0x9227('0x15')]=function(_0x145dac){if(this['channels'][_0x145dac[_0x9227('0x25')]]){for(var _0x4ec3e7 in _0x145dac[_0x9227('0x29')]){if(_0x145dac['variable'][_0x9227('0x22')](_0x4ec3e7)){this[_0x9227('0x24')][_0x145dac[_0x9227('0x25')]][_0x4ec3e7]=_0x145dac[_0x9227('0x2a')];}}}};Fax[_0x9227('0x1f')]['syncNewState']=function(_0x526ede){if(this[_0x9227('0x24')][_0x526ede['uniqueid']]){this[_0x9227('0x24')][_0x526ede[_0x9227('0x25')]][_0x9227('0x2b')]=_0x526ede[_0x9227('0x2b')];this['channels'][_0x526ede['uniqueid']]['channelstatedesc']=_0x526ede[_0x9227('0x2c')];}};Fax['prototype'][_0x9227('0x19')]=function(_0x3d05d1){if(this[_0x9227('0x24')][_0x3d05d1[_0x9227('0x25')]]){for(var _0x35bfa1 in _0x3d05d1[_0x9227('0x29')]){if(_0x3d05d1[_0x9227('0x29')][_0x9227('0x22')](_0x35bfa1)){this[_0x9227('0x24')][_0x3d05d1[_0x9227('0x25')]][_0x35bfa1]=_0x3d05d1['value'];}}}};Fax[_0x9227('0x1f')][_0x9227('0x2d')]=function(_0x14b197){if(this[_0x9227('0x24')][_0x14b197[_0x9227('0x25')]]){this[_0x9227('0x24')][_0x14b197['uniqueid']]['operation']=_0x14b197['operation'];this[_0x9227('0x24')][_0x14b197['uniqueid']][_0x9227('0x2e')]=_0x14b197['status'];this['channels'][_0x14b197[_0x9227('0x25')]][_0x9227('0x2f')]=_0x14b197[_0x9227('0x2f')];this[_0x9227('0x24')][_0x14b197[_0x9227('0x25')]]['filename']=_0x14b197[_0x9227('0x30')];logger[_0x9227('0x27')](_0x14b197[_0x9227('0x25')],_0x9227('0x31'));}};Fax[_0x9227('0x1f')]['syncReceiveFax']=function(_0x3534a0){var _0x3e29db=this;if(this[_0x9227('0x24')][_0x3534a0['uniqueid']]){var _0x3f80fb=this[_0x9227('0x24')][_0x3534a0[_0x9227('0x25')]]['id'];this[_0x9227('0x24')][_0x3534a0[_0x9227('0x25')]]['remotestationid']=_0x3534a0['remotestationid'];this[_0x9227('0x24')][_0x3534a0[_0x9227('0x25')]][_0x9227('0x32')]=_0x3534a0[_0x9227('0x32')];this[_0x9227('0x24')][_0x3534a0[_0x9227('0x25')]][_0x9227('0x2f')]=_0x3534a0['localstationid'];this[_0x9227('0x24')][_0x3534a0[_0x9227('0x25')]][_0x9227('0x33')]=_0x3534a0[_0x9227('0x33')];this[_0x9227('0x24')][_0x3534a0[_0x9227('0x25')]][_0x9227('0x34')]=_0x3534a0['transferrate'];this[_0x9227('0x24')][_0x3534a0[_0x9227('0x25')]][_0x9227('0x30')]=_0x3534a0[_0x9227('0x30')];this[_0x9227('0x24')][_0x3534a0['uniqueid']][_0x9227('0x35')]=_0x3534a0[_0x9227('0x35')];if(this[_0x9227('0x24')][_0x3534a0[_0x9227('0x25')]][_0x9227('0x32')]>0x0){tiff2pdf(_0x3534a0[_0x9227('0x30')],_0x9227('0x36'),function(_0x509f96){logger[_0x9227('0x27')](_0x3534a0[_0x9227('0x25')],'\x20result\x20conversion\x20file\x20',_0x509f96['message']);attachment[_0x9227('0x37')]({'name':path['parse'](_0x3534a0[_0x9227('0x30')])[_0x9227('0x26')],'basename':path[_0x9227('0x38')](_0x3534a0[_0x9227('0x30')])[_0x9227('0x26')]+_0x9227('0x39'),'type':'application/pdf'})[_0x9227('0x3a')](function(_0x55e930){faxAccount[_0x9227('0x3b')](_0x3f80fb,{'from':_0x3534a0[_0x9227('0x35')],'mapKey':_0x9227('0x6'),'body':path[_0x9227('0x38')](_0x3534a0[_0x9227('0x30')])[_0x9227('0x26')]+_0x9227('0x39'),'AttachmentId':_0x55e930['id']})[_0x9227('0x3c')](function(_0x14fa69){logger['error'](_0x3534a0[_0x9227('0x25')],_0x9227('0x3d'),JSON[_0x9227('0x3e')](_0x14fa69));});})[_0x9227('0x3c')](function(_0x5d3fe1){logger[_0x9227('0x3f')](_0x3534a0[_0x9227('0x25')],_0x9227('0x40'),JSON[_0x9227('0x3e')](_0x5d3fe1));});});}logger['info'](_0x3534a0[_0x9227('0x25')],_0x9227('0x40'));}};Fax[_0x9227('0x1f')][_0x9227('0x41')]=function(_0x4afc58){if(this['actions'][_0x4afc58[_0x9227('0x25')]]){_['merge'](this['channels'][_0x4afc58[_0x9227('0x25')]],_[_0x9227('0x42')](_0x4afc58,['response','reason']));}};function updateStatus(_0x4f3d9b){if(_0x4f3d9b[_0x9227('0x43')]){faxMessage[_0x9227('0x44')](_0x4f3d9b[_0x9227('0x43')],{'failMessage':_0x9227('0x45')})[_0x9227('0x3a')](function(_0xc9ab54){ut[_0x9227('0x46')](_0x9227('0x47'),_0xc9ab54);})[_0x9227('0x3c')](function(_0x52c735){ut[_0x9227('0x46')](_0x9227('0x48'),_0x52c735);});}else{ut['logger'](_0x9227('0x49'));}}Fax[_0x9227('0x1f')][_0x9227('0x4a')]=function(_0x5c3945,_0x52e49d,_0x38872d){var _0xeb10ae=this;var _0x5d0352={};if(_0x52e49d){_0x5d0352={'read':_0x52e49d};}else{_0x5d0352={'failMessage':_0x38872d};}if(this[_0x9227('0x10')][_0x5c3945]['AttachmentId']){faxMessage[_0x9227('0x44')](this[_0x9227('0x10')][_0x5c3945][_0x9227('0x43')],_0x5d0352)[_0x9227('0x3a')](function(_0x2acb3b){ut[_0x9227('0x46')](_0x9227('0x4b'),_0x2acb3b);})['catch'](function(_0x2c40e7){ut[_0x9227('0x46')](_0x9227('0x4c'),_0x2c40e7);})[_0x9227('0x4d')](function(){delete _0xeb10ae[_0x9227('0x24')][_0x5c3945];delete _0xeb10ae[_0x9227('0x10')][_0x5c3945];});}else{ut[_0x9227('0x46')](_0x9227('0x4e'));this[_0x9227('0x4f')](_0x5c3945);delete this[_0x9227('0x10')][_0x5c3945];}};Fax['prototype']['syncHangup']=function(_0x1a70e8){var _0x6dc4d5=this;if(this[_0x9227('0x24')][_0x1a70e8[_0x9227('0x25')]]){if(this['actions'][_0x1a70e8[_0x9227('0x25')]]){this[_0x9227('0x24')][_0x1a70e8['uniqueid']]['id']=this[_0x9227('0x10')][_0x1a70e8[_0x9227('0x25')]]['id'];this[_0x9227('0x24')][_0x1a70e8[_0x9227('0x25')]][_0x9227('0x26')]=this[_0x9227('0x10')][_0x1a70e8[_0x9227('0x25')]][_0x9227('0x26')];}logger['info'](_0x1a70e8[_0x9227('0x25')],this[_0x9227('0x10')][_0x1a70e8['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x9227('0x50'),JSON[_0x9227('0x3e')](this['channels'][_0x1a70e8[_0x9227('0x25')]]));if(this['actions'][_0x1a70e8[_0x9227('0x25')]]){if(this[_0x9227('0x24')][_0x1a70e8['uniqueid']][_0x9227('0x51')]>0x0&&this[_0x9227('0x24')][_0x1a70e8[_0x9227('0x25')]]['faxstatus']===_0x9227('0x52')){this[_0x9227('0x4a')](_0x1a70e8[_0x9227('0x25')],!![]);}else{this[_0x9227('0x4a')](_0x1a70e8[_0x9227('0x25')],![],this[_0x9227('0x24')][_0x1a70e8[_0x9227('0x25')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x9227('0x24')][_0x1a70e8[_0x9227('0x25')]][_0x9227('0x53')]:_0x9227('0x54'));}}}};Fax[_0x9227('0x1f')][_0x9227('0x55')]=function(_0x524360){var _0x1bc58b=this;return new BPromise(function(_0x6496e2,_0x168b39){_0x1bc58b['execOriginate'](_0x524360,_0x1bc58b['faxAccounts'][_0x524360['FaxAccountId']])[_0x9227('0x3a')](function(_0x14e13d){ut[_0x9227('0x46')](_0x9227('0x56'),_0x14e13d);_0x6496e2(ut[_0x9227('0x57')](_0x9227('0x58')));})[_0x9227('0x3c')](function(_0x5658a4){ut[_0x9227('0x46')]('[Fax][execOriginate][failure]',_0x5658a4);updateStatus(_0x524360);_0x168b39(ut[_0x9227('0x57')]('Fax\x20failed'));});});};Fax[_0x9227('0x1f')][_0x9227('0x59')]=function(_0x37b060){var _0x42294b=this;return new BPromise(function(_0x323b04,_0x375dfc){var _0x5a45d3=_0x42294b[_0x9227('0x5a')](_0x42294b['faxAccounts'][_0x37b060[_0x9227('0x5b')]][_0x9227('0x5c')],_0x37b060);if(_0x5a45d3['isValid']){_0x323b04(ut[_0x9227('0x57')](_0x9227('0x5d')));}else{_0x375dfc(ut[_0x9227('0x57')](_0x5a45d3[_0x9227('0x57')]));}});};function originate(_0x19d5eb,_0x5870c8,_0x3b348c){return new BPromise(function(_0x1b3f94,_0x9c7522){if(_0x3b348c){var _0x12784e=util['format'](_0x9227('0x5e'),path[_0x9227('0x38')](_0x19d5eb[_0x9227('0x5f')])['name'],_0x19d5eb['path']);gs[_0x9227('0x60')](_0x12784e)[_0x9227('0x3a')](function(){_0x19d5eb[_0x9227('0x5f')]=util[_0x9227('0x61')](_0x9227('0x62'),path[_0x9227('0x38')](_0x19d5eb[_0x9227('0x5f')])[_0x9227('0x63')],path[_0x9227('0x38')](_0x19d5eb['path'])[_0x9227('0x26')]);_0x5870c8['XMF-PATH']=_0x19d5eb[_0x9227('0x5f')];ut[_0x9227('0x46')](_0x9227('0x64'),'');ami[_0x9227('0x65')](ut[_0x9227('0x66')](_0x19d5eb,_0x5870c8))[_0x9227('0x3a')](function(_0x10741c){_0x1b3f94(_0x10741c);})[_0x9227('0x3c')](function(_0x2d891b){_0x9c7522(_0x2d891b);});})[_0x9227('0x3c')](function(_0x1a1ba2){_0x9c7522(_0x1a1ba2);});}else{ami[_0x9227('0x65')](ut['variablesAction'](_0x19d5eb,_0x5870c8))[_0x9227('0x3a')](function(_0x587c1d){_0x1b3f94(_0x587c1d);})[_0x9227('0x3c')](function(_0x2ba301){_0x9c7522(_0x2ba301);});}});}Fax[_0x9227('0x1f')][_0x9227('0x67')]=function(_0x3ca111,_0xbc4307){var _0x3ddbe7=this;return new BPromise(function(_0x370eb9,_0x459386){var _0x215bf5=uuid['v4']();var _0x4df51b=ut[_0x9227('0x68')](_0x3ca111,_0xbc4307);_0x3ddbe7['actions'][_0x215bf5]=new Action(_0x215bf5,_0xbc4307,_0x3ca111);var _0x50ef5c=_0x3ddbe7['actions'][_0x215bf5];if(path[_0x9227('0x38')](_0x3ca111['path'])[_0x9227('0x69')]===_0x9227('0x39')){originate(_0x50ef5c,_0x4df51b,!![])[_0x9227('0x3a')](function(_0x37ad14){_0x370eb9(_0x37ad14);})['catch'](function(_0x913b44){_0x459386(_0x913b44);});}else{originate(_0x50ef5c,_0x4df51b,![])['then'](function(_0x2d4583){_0x370eb9(_0x2d4583);})[_0x9227('0x3c')](function(_0xcb6e2c){_0x459386(_0xcb6e2c);});}});};Fax[_0x9227('0x1f')]['isTrunkReachable']=function(_0x2d9780){return!_['isNil'](_0x2d9780)&&!_[_0x9227('0x6a')](_0x2d9780[_0x9227('0x26')])&&!_['isNil'](_0x2d9780['active'])&&_0x2d9780[_0x9227('0x6b')]&&!_[_0x9227('0x6a')](this[_0x9227('0xf')][util[_0x9227('0x61')](_0x9227('0x6c'),_0x2d9780[_0x9227('0x26')])])&&!_[_0x9227('0x6a')](this[_0x9227('0xf')][util[_0x9227('0x61')](_0x9227('0x6c'),_0x2d9780[_0x9227('0x26')])]['status'])&&(this['trunks'][util['format'](_0x9227('0x6c'),_0x2d9780['name'])][_0x9227('0x2e')]===_0x9227('0x6d')||this['trunks'][util[_0x9227('0x61')](_0x9227('0x6c'),_0x2d9780[_0x9227('0x26')])][_0x9227('0x2e')]===_0x9227('0x6e'));};Fax[_0x9227('0x1f')][_0x9227('0x5a')]=function(_0x1eacbf,_0x52556c){if(!this[_0x9227('0x6f')](_0x1eacbf)){ut[_0x9227('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x9227('0x6a')](_0x1eacbf)?'':_0x1eacbf[_0x9227('0x26')]+_0x9227('0x70'));return{'isValid':![],'message':_0x9227('0x71')};}if(_[_0x9227('0x6a')](_0x52556c[_0x9227('0x6')])){ut['logger'](_0x9227('0x72'),JSON[_0x9227('0x3e')](_0x52556c));return{'isValid':![],'message':_0x9227('0x73')};}if(_[_0x9227('0x6a')](_0x52556c['path'])){ut[_0x9227('0x46')](_0x9227('0x74'),JSON[_0x9227('0x3e')](_0x52556c));return{'isValid':![],'message':_0x9227('0x75')};}return{'isValid':!![],'message':_0x9227('0x76')};};Fax['prototype'][_0x9227('0x4f')]=function(_0x539fa6,_0x1a9e40=0x2710){if(this[_0x9227('0x24')][_0x539fa6]){setTimeout(()=>{delete this[_0x9227('0x24')][_0x539fa6];},_0x1a9e40);}};module[_0x9227('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 6c46cf7..f2c722c 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 _0x946d=['lodash','../rpc/faxAccount','error','notify','resolve','then','catch','util','../../../config/logger'];(function(_0x1fdb63,_0x38efab){var _0xd842c9=function(_0x5be500){while(--_0x5be500){_0x1fdb63['push'](_0x1fdb63['shift']());}};_0xd842c9(++_0x38efab);}(_0x946d,0x166));var _0xd946=function(_0x43ec1c,_0x8c42ba){_0x43ec1c=_0x43ec1c-0x0;var _0xcb0afb=_0x946d[_0x43ec1c];return _0xcb0afb;};'use strict';var util=require(_0xd946('0x0'));var BPromise=require('bluebird');var logger=require(_0xd946('0x1'))('preview');var _=require(_0xd946('0x2'));var faxAccount=require(_0xd946('0x3'));function loggerCatch(_0x15da48){return function(_0x30eef7){logger[_0xd946('0x4')](_0x15da48,util['inspect'](_0x30eef7,{'showHidden':![],'depth':null}));};}exports[_0xd946('0x5')]=function(_0x112038,_0x415fd0){return BPromise[_0xd946('0x6')]()[_0xd946('0x7')](faxAccount[_0xd946('0x5')](_0x112038,_0x415fd0))[_0xd946('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xb8b3=['[Notify]\x20','bluebird','../../../config/logger','preview','error','notify','catch'];(function(_0x190aff,_0x2cb56c){var _0x3a934c=function(_0x4222cc){while(--_0x4222cc){_0x190aff['push'](_0x190aff['shift']());}};_0x3a934c(++_0x2cb56c);}(_0xb8b3,0x1ba));var _0x3b8b=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xb8b3[_0xd22d95];return _0x15d7a3;};'use strict';var util=require('util');var BPromise=require(_0x3b8b('0x0'));var logger=require(_0x3b8b('0x1'))(_0x3b8b('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x571b80){return function(_0x334766){logger[_0x3b8b('0x3')](_0x571b80,util['inspect'](_0x334766,{'showHidden':![],'depth':null}));};}exports[_0x3b8b('0x4')]=function(_0xe5188e,_0x951ee1){return BPromise['resolve']()['then'](faxAccount[_0x3b8b('0x4')](_0xe5188e,_0x951ee1))[_0x3b8b('0x5')](loggerCatch(_0x3b8b('0x6')));}; \ 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 d2a33f6..ec00065 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 _0x3607=['inspect','util','fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3607,0x172));var _0x7360=function(_0x17337d,_0xb44970){_0x17337d=_0x17337d-0x0;var _0x365362=_0x3607[_0x17337d];return _0x365362;};'use strict';var util=require(_0x7360('0x0'));var logger=require('../../../../config/logger')(_0x7360('0x1'));var BPromise=require(_0x7360('0x2'));var exec=require(_0x7360('0x3'))[_0x7360('0x4')];exports['execute']=function(_0x1074a9){return new BPromise(function(_0x4c95d1,_0x2886a9){exec(_0x1074a9,function(_0x21fb0a,_0x4f4e79,_0x332d80){logger[_0x7360('0x5')](_0x7360('0x6'),_0x4f4e79);if(_0x21fb0a){logger[_0x7360('0x5')](_0x7360('0x6'),_0x7360('0x7'),util[_0x7360('0x8')](_0x21fb0a,{'showHidden':![],'depth':null}),_0x4f4e79,_0x332d80);_0x2886a9(_0x21fb0a);}_0x4c95d1(_0x4f4e79);});});}; \ No newline at end of file +var _0x960b=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','bluebird'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0x960b,0xde));var _0xb960=function(_0x5646cf,_0x2f365c){_0x5646cf=_0x5646cf-0x0;var _0x4b7dee=_0x960b[_0x5646cf];return _0x4b7dee;};'use strict';var util=require(_0xb960('0x0'));var logger=require(_0xb960('0x1'))('fax');var BPromise=require(_0xb960('0x2'));var exec=require(_0xb960('0x3'))[_0xb960('0x4')];exports[_0xb960('0x5')]=function(_0x2033c2){return new BPromise(function(_0x2c50ac,_0x2eefd4){exec(_0x2033c2,function(_0x52ff75,_0x33b443,_0xb3bc39){logger[_0xb960('0x6')](_0xb960('0x7'),_0x33b443);if(_0x52ff75){logger['info'](_0xb960('0x7'),_0xb960('0x8'),util['inspect'](_0x52ff75,{'showHidden':![],'depth':null}),_0x33b443,_0xb3bc39);_0x2eefd4(_0x52ff75);}_0x2c50ac(_0x33b443);});});}; \ 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 f38a529..dad9d97 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 _0xfffd=['ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format','localstationid','util','../../../../config/logger','fax','message','info'];(function(_0x40042a,_0x3efa20){var _0x3af43b=function(_0x4deacd){while(--_0x4deacd){_0x40042a['push'](_0x40042a['shift']());}};_0x3af43b(++_0x3efa20);}(_0xfffd,0xe2));var _0xdfff=function(_0x49905b,_0x5aa72f){_0x49905b=_0x49905b-0x0;var _0x1543bf=_0xfffd[_0x49905b];return _0x1543bf;};'use strict';var util=require(_0xdfff('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xdfff('0x1'))(_0xdfff('0x2'));exports[_0xdfff('0x3')]=function(_0x57eea7){return{'message':_0x57eea7};};exports['logger']=function(_0x14d08e,_0x37823d){logger[_0xdfff('0x4')](_0x14d08e,util['inspect'](_0x37823d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x17f484,_0x23342f){var _0x448a7d={'XMF-ECM':_0x23342f[_0xdfff('0x5')],'XMF-HEADERINFO':_0x23342f[_0xdfff('0x6')],'XMF-MINRATE':_0x23342f[_0xdfff('0x7')],'XMF-MAXRATE':_0x23342f[_0xdfff('0x8')],'XMF-MODEM':util['format'](_0xdfff('0x9'),_0x23342f[_0xdfff('0xa')]),'XMF-GATEWAY':_0x23342f[_0xdfff('0xb')],'XMF-FAXDETECT':_0x23342f[_0xdfff('0xc')],'XMF-T38TIMEOUT':_0x23342f['t38timeout'],'XMF-LOCALSTATIONID':_0x23342f['localstationid'],'XMF-PATH':_0x17f484[_0xdfff('0xd')]};return _0x448a7d;};exports[_0xdfff('0xe')]=function(_0x186579,_0x29d83e){return{'actionid':_0x186579[_0xdfff('0xf')],'action':_0xdfff('0x10'),'channel':_0x186579[_0xdfff('0x11')],'Exten':_0xdfff('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0xdfff('0x13')]('\x22%s\x22\x20<%s>',_0x186579[_0xdfff('0x6')]?_0x186579[_0xdfff('0x6')]:'',_0x186579[_0xdfff('0x14')]),'variable':_0x29d83e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x186579[_0xdfff('0xf')]};}; \ No newline at end of file +var _0x7547=['localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','util','lodash','moment','../../../../config/logger','fax','message','logger','info','addVariables','ecm','headerinfo','minrate','format','modem','gateway','faxdetect','t38timeout'];(function(_0x316aa2,_0x2eb7a0){var _0x45343e=function(_0x4a4241){while(--_0x4a4241){_0x316aa2['push'](_0x316aa2['shift']());}};_0x45343e(++_0x2eb7a0);}(_0x7547,0x127));var _0x7754=function(_0x53c775,_0x25bf9b){_0x53c775=_0x53c775-0x0;var _0x4da887=_0x7547[_0x53c775];return _0x4da887;};'use strict';var util=require(_0x7754('0x0'));var _=require(_0x7754('0x1'));var moment=require(_0x7754('0x2'));var logger=require(_0x7754('0x3'))(_0x7754('0x4'));exports[_0x7754('0x5')]=function(_0xdff8ec){return{'message':_0xdff8ec};};exports[_0x7754('0x6')]=function(_0x4b7006,_0x220777){logger[_0x7754('0x7')](_0x4b7006,util['inspect'](_0x220777,{'showHidden':![],'depth':null}));};exports[_0x7754('0x8')]=function(_0x39d52b,_0x358e7c){var _0x158a07={'XMF-ECM':_0x358e7c[_0x7754('0x9')],'XMF-HEADERINFO':_0x358e7c[_0x7754('0xa')],'XMF-MINRATE':_0x358e7c[_0x7754('0xb')],'XMF-MAXRATE':_0x358e7c['maxrate'],'XMF-MODEM':util[_0x7754('0xc')]('\x22%s\x22',_0x358e7c[_0x7754('0xd')]),'XMF-GATEWAY':_0x358e7c[_0x7754('0xe')],'XMF-FAXDETECT':_0x358e7c[_0x7754('0xf')],'XMF-T38TIMEOUT':_0x358e7c[_0x7754('0x10')],'XMF-LOCALSTATIONID':_0x358e7c[_0x7754('0x11')],'XMF-PATH':_0x39d52b[_0x7754('0x12')]};return _0x158a07;};exports[_0x7754('0x13')]=function(_0x358abe,_0x5946dc){return{'actionid':_0x358abe['uniqueid'],'action':_0x7754('0x14'),'channel':_0x358abe[_0x7754('0x15')],'Exten':_0x7754('0x16'),'Context':_0x7754('0x17'),'Priority':'1','callerid':util[_0x7754('0xc')]('\x22%s\x22\x20<%s>',_0x358abe['headerinfo']?_0x358abe['headerinfo']:'',_0x358abe[_0x7754('0x11')]),'variable':_0x5946dc,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x358abe['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index d337d05..1bc2a6e 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 _0xf6a2=['initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts'];(function(_0x3c7899,_0x12decb){var _0x2dc8cf=function(_0x4ed765){while(--_0x4ed765){_0x3c7899['push'](_0x3c7899['shift']());}};_0x2dc8cf(++_0x12decb);}(_0xf6a2,0x1d0));var _0x2f6a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf6a2[_0x50a0c2];return _0x5ebadd;};'use strict';var util=require(_0x2f6a('0x0'));var moment=require(_0x2f6a('0x1'));var server=require(_0x2f6a('0x2'));var Realtime=require(_0x2f6a('0x3'));var Report=require(_0x2f6a('0x4'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x2f6a('0x5'));var Preview=require(_0x2f6a('0x6'));var Fax=require(_0x2f6a('0x7'));var user=require(_0x2f6a('0x8'));var voiceQueue=require(_0x2f6a('0x9'));var voiceQueueReport=require(_0x2f6a('0xa'));var voiceCallReport=require(_0x2f6a('0xb'));var trunk=require(_0x2f6a('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x2f6a('0xd'));var cmHopperHistory=require(_0x2f6a('0xe'));var campaign=require(_0x2f6a('0xf'));var voiceExtension=require(_0x2f6a('0x10'));var faxAccount=require(_0x2f6a('0x11'));var zendesk=require(_0x2f6a('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x2f6a('0x13'));var freshdesk=require(_0x2f6a('0x14'));var desk=require(_0x2f6a('0x15'));var zoho=require(_0x2f6a('0x16'));var vtiger=require(_0x2f6a('0x17'));var freshsales=require(_0x2f6a('0x18'));var servicenow=require(_0x2f6a('0x19'));var dynamics365=require(_0x2f6a('0x1a'));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')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x2f6a('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2f6a('0x1c')](_0x2f6a('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x2f6a('0x1d')](user[_0x2f6a('0x1e')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x1f')]())['then'](user[_0x2f6a('0x20')]())['then'](realtime['initTelephones']())[_0x2f6a('0x1d')](trunk[_0x2f6a('0x21')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x22')]())[_0x2f6a('0x1d')](voiceQueue[_0x2f6a('0x23')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x24')]())['then'](trigger[_0x2f6a('0x25')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x26')]())[_0x2f6a('0x1d')](template['getTemplates']())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x27')]())['then'](zendesk[_0x2f6a('0x28')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x29')]())[_0x2f6a('0x1d')](salesforce[_0x2f6a('0x2a')]())['then'](realtime[_0x2f6a('0x2b')]())['then'](sugarcrm[_0x2f6a('0x2c')]())['then'](realtime[_0x2f6a('0x2d')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x2f6a('0x1d')](realtime['initFreshdeskAccounts']())[_0x2f6a('0x1d')](desk[_0x2f6a('0x2e')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x2f')]())[_0x2f6a('0x1d')](zoho[_0x2f6a('0x30')]())[_0x2f6a('0x1d')](realtime['initZohoAccounts']())[_0x2f6a('0x1d')](vtiger[_0x2f6a('0x31')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x32')]())[_0x2f6a('0x1d')](freshsales[_0x2f6a('0x33')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x34')]())['then'](servicenow[_0x2f6a('0x35')]())['then'](realtime['initServicenowAccounts']())[_0x2f6a('0x1d')](dynamics365[_0x2f6a('0x36')]())[_0x2f6a('0x1d')](realtime['initDynamics365Accounts']())['then'](campaign['getCampaigns']())['then'](realtime[_0x2f6a('0x37')]())[_0x2f6a('0x1d')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x2f6a('0x38')]())[_0x2f6a('0x1d')](faxAccount[_0x2f6a('0x39')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x3a')]())[_0x2f6a('0x1d')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x2f6a('0x1d')](voiceQueueReport[_0x2f6a('0x3b')]())['then'](realtime[_0x2f6a('0x3c')]())['then'](cmHopperHistory[_0x2f6a('0x3d')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x3e')]())[_0x2f6a('0x1d')](cmHopperHistory[_0x2f6a('0x3f')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x40')]())['then'](voiceCallReport[_0x2f6a('0x41')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x42')]())['catch'](function(_0x5b2089){logger[_0x2f6a('0x43')](_0x2f6a('0x44'),util[_0x2f6a('0x45')](_0x5b2089,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2f6a('0x46')](realtime,preview,fax)[_0x2f6a('0x1d')](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x2f6a('0x47')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x241548){logger[_0x2f6a('0x43')](_0x2f6a('0x48'),util[_0x2f6a('0x45')](_0x241548,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x744c=['then','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','[index.js][initParams]','sync','catch','[index.js][main]','inspect','util','moment','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','../../config/logger','ami','hour'];(function(_0xf164d9,_0x3799e6){var _0x367c3b=function(_0x33a7bd){while(--_0x33a7bd){_0xf164d9['push'](_0xf164d9['shift']());}};_0x367c3b(++_0x3799e6);}(_0x744c,0x1bd));var _0xc744=function(_0x204836,_0x34d172){_0x204836=_0x204836-0x0;var _0x335884=_0x744c[_0x204836];return _0x335884;};'use strict';var util=require(_0xc744('0x0'));var moment=require(_0xc744('0x1'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xc744('0x2'));var Acw=require('./acw');var Trigger=require(_0xc744('0x3'));var Dialer=require(_0xc744('0x4'));var Preview=require(_0xc744('0x5'));var Fax=require('./fax');var user=require(_0xc744('0x6'));var voiceQueue=require(_0xc744('0x7'));var voiceQueueReport=require(_0xc744('0x8'));var voiceCallReport=require(_0xc744('0x9'));var trunk=require(_0xc744('0xa'));var trigger=require(_0xc744('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0xc744('0xc'));var campaign=require(_0xc744('0xd'));var voiceExtension=require(_0xc744('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc744('0xf'));var sugarcrm=require(_0xc744('0x10'));var freshdesk=require(_0xc744('0x11'));var desk=require(_0xc744('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xc744('0x13'));var freshsales=require(_0xc744('0x14'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xc744('0x15'))(_0xc744('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xc744('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc744('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xc744('0x18')](user['getAgents']())[_0xc744('0x18')](realtime[_0xc744('0x19')]())[_0xc744('0x18')](user['getTelephones']())[_0xc744('0x18')](realtime[_0xc744('0x1a')]())['then'](trunk[_0xc744('0x1b')]())[_0xc744('0x18')](realtime[_0xc744('0x1c')]())['then'](voiceQueue[_0xc744('0x1d')]())[_0xc744('0x18')](realtime['initVoiceQueues']())['then'](trigger[_0xc744('0x1e')]())[_0xc744('0x18')](realtime[_0xc744('0x1f')]())[_0xc744('0x18')](template[_0xc744('0x20')]())[_0xc744('0x18')](realtime[_0xc744('0x21')]())[_0xc744('0x18')](zendesk[_0xc744('0x22')]())[_0xc744('0x18')](realtime[_0xc744('0x23')]())[_0xc744('0x18')](salesforce[_0xc744('0x24')]())[_0xc744('0x18')](realtime[_0xc744('0x25')]())['then'](sugarcrm[_0xc744('0x26')]())['then'](realtime[_0xc744('0x27')]())[_0xc744('0x18')](freshdesk[_0xc744('0x28')]())[_0xc744('0x18')](realtime['initFreshdeskAccounts']())[_0xc744('0x18')](desk['getDeskAccounts']())[_0xc744('0x18')](realtime[_0xc744('0x29')]())[_0xc744('0x18')](zoho[_0xc744('0x2a')]())[_0xc744('0x18')](realtime['initZohoAccounts']())[_0xc744('0x18')](vtiger[_0xc744('0x2b')]())[_0xc744('0x18')](realtime[_0xc744('0x2c')]())[_0xc744('0x18')](freshsales[_0xc744('0x2d')]())['then'](realtime['initFreshsalesAccounts']())[_0xc744('0x18')](servicenow[_0xc744('0x2e')]())[_0xc744('0x18')](realtime[_0xc744('0x2f')]())['then'](dynamics365[_0xc744('0x30')]())[_0xc744('0x18')](realtime[_0xc744('0x31')]())[_0xc744('0x18')](campaign[_0xc744('0x32')]())[_0xc744('0x18')](realtime['initCampaigns']())[_0xc744('0x18')](voiceExtension['getVoiceExtensions']())[_0xc744('0x18')](realtime[_0xc744('0x33')]())[_0xc744('0x18')](faxAccount[_0xc744('0x34')]())[_0xc744('0x18')](realtime[_0xc744('0x35')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0xc744('0x36')]()[_0xc744('0x18')](voiceQueueReport[_0xc744('0x37')]())[_0xc744('0x18')](realtime[_0xc744('0x38')]())[_0xc744('0x18')](cmHopperHistory[_0xc744('0x39')]())[_0xc744('0x18')](realtime[_0xc744('0x3a')]())[_0xc744('0x18')](cmHopperHistory['getCampaignHopperHistory']())[_0xc744('0x18')](realtime[_0xc744('0x3b')]())[_0xc744('0x18')](voiceCallReport['getVoiceCallReports']())[_0xc744('0x18')](realtime[_0xc744('0x3c')]())['catch'](function(_0x5143fa){logger[_0xc744('0x3d')](_0xc744('0x3e'),util['inspect'](_0x5143fa,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xc744('0x18')](function(){return initRealtime();})[_0xc744('0x18')](function(){return initParams();})[_0xc744('0x18')](function(){report[_0xc744('0x3f')]();setInterval(initRealtime,0x1388);})[_0xc744('0x40')](function(_0x402366){logger['error'](_0xc744('0x41'),util[_0xc744('0x42')](_0x402366,{'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 f225183..7a6009d 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 _0xacf5=['lodash','util','moment','md5','ioredis','redis','name','email','accountcode','fullname','unknown','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusQueue','local','prototype','state','toLowerCase','idle','inuse','voiceStatus','toNumber','format','stateTime','status','onhold','stringify','user:%s','emit','user:ami:update','omit','user:presence','exports'];(function(_0x15c9f1,_0x20529f){var _0x468ea6=function(_0x292360){while(--_0x292360){_0x15c9f1['push'](_0x15c9f1['shift']());}};_0x468ea6(++_0x20529f);}(_0xacf5,0x128));var _0x5acf=function(_0x896ce,_0x288208){_0x896ce=_0x896ce-0x0;var _0x4fc85a=_0xacf5[_0x896ce];return _0x4fc85a;};'use strict';var _=require(_0x5acf('0x0'));var util=require(_0x5acf('0x1'));var moment=require(_0x5acf('0x2'));var md5=require(_0x5acf('0x3'));var Redis=require(_0x5acf('0x4'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x5acf('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x5ee488){this['id']=_0x5ee488['id']||0x0;this[_0x5acf('0x6')]=_0x5ee488[_0x5acf('0x6')]||'';this[_0x5acf('0x7')]=_0x5ee488[_0x5acf('0x7')]||'';this['accountcode']=_0x5ee488[_0x5acf('0x8')]||'';this[_0x5acf('0x9')]=_0x5ee488[_0x5acf('0x9')]||'';this['state']=_0x5acf('0xa');this['stateTime']=0x0;this['status']=_0x5acf('0xa');this[_0x5acf('0xb')]='';this[_0x5acf('0xc')]='';this[_0x5acf('0xd')]='';this[_0x5acf('0xe')]='';this[_0x5acf('0xf')]=_0x5ee488[_0x5acf('0xf')]||![];this['voiceStatus']='unknown';this[_0x5acf('0x10')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x5acf('0x11')]='';this['onhold']=![];this[_0x5acf('0x12')]=![];this[_0x5acf('0x3')]='';}Agent[_0x5acf('0x13')]['updateStatusRealtime']=function(_0x5dca90){var _0x498db9;if(_0x5dca90&&_0x5dca90[_0x5acf('0x14')]){_0x498db9=_0x5dca90['state'][_0x5acf('0x15')]();switch(_0x498db9){case'not_inuse':_0x498db9=_0x5acf('0x16');break;case _0x5acf('0x17'):_0x498db9='talking';break;}}if(_0x498db9&&this[_0x5acf('0x18')]!==_0x498db9||_0x5dca90['statePause']){this[_0x5acf('0x10')]=_[_0x5acf('0x19')](moment()[_0x5acf('0x1a')]('x'));}if(_0x498db9){this[_0x5acf('0x18')]=_0x498db9;}var _0x327ea3={'id':this['id'],'name':this[_0x5acf('0x6')],'email':this[_0x5acf('0x7')],'accountcode':this[_0x5acf('0x8')],'fullname':this[_0x5acf('0x9')],'state':this['state'],'stateTime':this[_0x5acf('0x1b')],'status':this[_0x5acf('0x1c')],'address':this[_0x5acf('0xb')],'online':this[_0x5acf('0xf')],'voiceStatus':this[_0x5acf('0x18')],'voiceStatusTime':this[_0x5acf('0x10')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x5acf('0xe')],'onhold':this[_0x5acf('0x1d')]};var _0x2071b2=md5(JSON[_0x5acf('0x1e')](_0x327ea3));if(this[_0x5acf('0x3')]!==_0x2071b2){this[_0x5acf('0x3')]=_0x2071b2;io['to'](util['format'](_0x5acf('0x1f'),_0x327ea3[_0x5acf('0x6')]))[_0x5acf('0x20')](_0x5acf('0x21'),_[_0x5acf('0x22')](_0x327ea3,[_0x5acf('0xf')]));io[_0x5acf('0x20')](_0x5acf('0x23'),_0x327ea3);}};module[_0x5acf('0x24')]=Agent; \ No newline at end of file +var _0xec94=['toNumber','format','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xec94,0x1e8));var _0x4ec9=function(_0x14146b,_0xc72b05){_0x14146b=_0x14146b-0x0;var _0x4ab737=_0xec94[_0x14146b];return _0x4ab737;};'use strict';var _=require(_0x4ec9('0x0'));var util=require(_0x4ec9('0x1'));var moment=require(_0x4ec9('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4ec9('0x3')]=_[_0x4ec9('0x4')](config['redis'],{'host':_0x4ec9('0x5'),'port':0x18eb});var io=require(_0x4ec9('0x6'))(new Redis(config[_0x4ec9('0x3')]));function Agent(_0x11d05e){this['id']=_0x11d05e['id']||0x0;this['name']=_0x11d05e[_0x4ec9('0x7')]||'';this[_0x4ec9('0x8')]=_0x11d05e[_0x4ec9('0x8')]||'';this['accountcode']=_0x11d05e[_0x4ec9('0x9')]||'';this[_0x4ec9('0xa')]=_0x11d05e['fullname']||'';this[_0x4ec9('0xb')]=_0x4ec9('0xc');this[_0x4ec9('0xd')]=0x0;this[_0x4ec9('0xe')]=_0x4ec9('0xc');this[_0x4ec9('0xf')]='';this['phone']='';this[_0x4ec9('0x10')]='';this[_0x4ec9('0x11')]='';this[_0x4ec9('0x12')]=_0x11d05e[_0x4ec9('0x12')]||![];this[_0x4ec9('0x13')]='unknown';this[_0x4ec9('0x14')]=0x0;this[_0x4ec9('0x15')]='';this[_0x4ec9('0x16')]='';this[_0x4ec9('0x17')]=![];this[_0x4ec9('0x18')]=![];this[_0x4ec9('0x19')]='';}Agent[_0x4ec9('0x1a')][_0x4ec9('0x1b')]=function(_0x6a0ef0){var _0x322a9d;if(_0x6a0ef0&&_0x6a0ef0[_0x4ec9('0xb')]){_0x322a9d=_0x6a0ef0[_0x4ec9('0xb')]['toLowerCase']();switch(_0x322a9d){case _0x4ec9('0x1c'):_0x322a9d='idle';break;case _0x4ec9('0x1d'):_0x322a9d=_0x4ec9('0x1e');break;}}if(_0x322a9d&&this[_0x4ec9('0x13')]!==_0x322a9d||_0x6a0ef0[_0x4ec9('0x1f')]){this[_0x4ec9('0x14')]=_[_0x4ec9('0x20')](moment()[_0x4ec9('0x21')]('x'));}if(_0x322a9d){this[_0x4ec9('0x13')]=_0x322a9d;}var _0x5d5581={'id':this['id'],'name':this[_0x4ec9('0x7')],'email':this[_0x4ec9('0x8')],'accountcode':this['accountcode'],'fullname':this[_0x4ec9('0xa')],'state':this[_0x4ec9('0xb')],'stateTime':this[_0x4ec9('0xd')],'status':this['status'],'address':this[_0x4ec9('0xf')],'online':this[_0x4ec9('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x4ec9('0x15')],'voiceStatusQueue':this[_0x4ec9('0x16')],'interface':this[_0x4ec9('0x11')],'onhold':this[_0x4ec9('0x17')]};var _0x41581a=md5(JSON['stringify'](_0x5d5581));if(this['md5']!==_0x41581a){this['md5']=_0x41581a;io['to'](util[_0x4ec9('0x21')](_0x4ec9('0x22'),_0x5d5581[_0x4ec9('0x7')]))[_0x4ec9('0x23')](_0x4ec9('0x24'),_[_0x4ec9('0x25')](_0x5d5581,['online']));io[_0x4ec9('0x23')](_0x4ec9('0x26'),_0x5d5581);}};module[_0x4ec9('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 3015483..455ae6c 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 _0x0152=['dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x552fc5,_0x54972e){var _0x3ae584=function(_0x4fa784){while(--_0x4fa784){_0x552fc5['push'](_0x552fc5['shift']());}};_0x3ae584(++_0x54972e);}(_0x0152,0x1c3));var _0x2015=function(_0x5af45f,_0x30be2f){_0x5af45f=_0x5af45f-0x0;var _0x1bab77=_0x0152[_0x5af45f];return _0x1bab77;};'use strict';function Campaign(_0x4bff92){this['id']=_0x4bff92['id']||0x0;this[_0x2015('0x0')]=_0x4bff92[_0x2015('0x0')]||'';this[_0x2015('0x1')]=_0x4bff92[_0x2015('0x1')]||_0x2015('0x2');this[_0x2015('0x3')]=0x0;this['temp']=0x0;this[_0x2015('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x2015('0x5')]='';this[_0x2015('0x6')]=!![];this[_0x2015('0x7')]=_0x4bff92[_0x2015('0x7')];this[_0x2015('0x8')]=_0x4bff92['limitCalls'];this[_0x2015('0x9')]=_0x4bff92['dialTimezone']||null;this[_0x2015('0xa')]=_0x4bff92[_0x2015('0xa')]?_0x4bff92[_0x2015('0xa')]:null;this[_0x2015('0xb')]=_0x4bff92[_0x2015('0xb')];this[_0x2015('0xc')]=_0x4bff92[_0x2015('0xc')];this[_0x2015('0xd')]=_0x4bff92[_0x2015('0xd')]||0x1e;this[_0x2015('0xe')]=_0x4bff92[_0x2015('0xe')];this[_0x2015('0xf')]=_0x4bff92['dialCongestionRetryFrequency'];this[_0x2015('0x10')]=_0x4bff92[_0x2015('0x10')];this['dialBusyRetryFrequency']=_0x4bff92['dialBusyRetryFrequency'];this[_0x2015('0x11')]=_0x4bff92[_0x2015('0x11')];this['dialNoAnswerRetryFrequency']=_0x4bff92[_0x2015('0x12')];this[_0x2015('0x13')]=_0x4bff92[_0x2015('0x13')];this[_0x2015('0x14')]=_0x4bff92[_0x2015('0x14')]||0x3;this[_0x2015('0x15')]=_0x4bff92['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2015('0x16')]=_0x4bff92['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4bff92[_0x2015('0x17')]||0x96;this[_0x2015('0x18')]=_0x4bff92[_0x2015('0x18')]||0x3;this[_0x2015('0x19')]=_0x4bff92['dialAbandonedRetryFrequency']||0x96;this[_0x2015('0x1a')]=_0x4bff92[_0x2015('0x1a')]||0x3;this[_0x2015('0x1b')]=_0x4bff92[_0x2015('0x1b')]||0x96;this[_0x2015('0x1c')]=_0x4bff92[_0x2015('0x1c')]||0x3;this[_0x2015('0x1d')]=_0x4bff92[_0x2015('0x1d')]||0x96;this[_0x2015('0x1e')]=_0x4bff92[_0x2015('0x1e')]||_0x2015('0x1f');this['dialPrefix']=_0x4bff92[_0x2015('0x20')]||undefined;this[_0x2015('0x21')]=_0x4bff92[_0x2015('0x21')]||undefined;this[_0x2015('0x22')]=_0x4bff92[_0x2015('0x22')]||undefined;this['TrunkBackup']=_0x4bff92[_0x2015('0x23')]?_0x4bff92[_0x2015('0x23')]:undefined;this['Trunk']=_0x4bff92[_0x2015('0x24')]?_0x4bff92['Trunk']:undefined;this[_0x2015('0x25')]=_0x4bff92['Interval']?_0x4bff92[_0x2015('0x25')]:undefined;this[_0x2015('0x26')]=_0x4bff92[_0x2015('0x26')]?_0x4bff92[_0x2015('0x26')]:undefined;this[_0x2015('0x27')]=_0x4bff92[_0x2015('0x26')]?_0x4bff92[_0x2015('0x26')]['name']:undefined;this['dialAMDActive']=_0x4bff92[_0x2015('0x28')]||![];this[_0x2015('0x29')]=_0x4bff92['dialAMDInitialSilence'];this[_0x2015('0x2a')]=_0x4bff92[_0x2015('0x2a')];this[_0x2015('0x2b')]=_0x4bff92[_0x2015('0x2b')];this['dialAMDTotalAnalysisTime']=_0x4bff92[_0x2015('0x2c')];this['dialAMDMinWordLength']=_0x4bff92[_0x2015('0x2d')];this[_0x2015('0x2e')]=_0x4bff92[_0x2015('0x2e')];this[_0x2015('0x2f')]=_0x4bff92[_0x2015('0x2f')];this[_0x2015('0x30')]=_0x4bff92[_0x2015('0x30')];this[_0x2015('0x31')]=_0x4bff92[_0x2015('0x31')];}module['exports']=Campaign; \ No newline at end of file +var _0xc01c=['ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay'];(function(_0x319071,_0x41c793){var _0x352756=function(_0x3fb55e){while(--_0x3fb55e){_0x319071['push'](_0x319071['shift']());}};_0x352756(++_0x41c793);}(_0xc01c,0x159));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x3ce2a1){this['id']=_0x3ce2a1['id']||0x0;this['name']=_0x3ce2a1[_0xcc01('0x0')]||'';this['type']=_0x3ce2a1[_0xcc01('0x1')]||'campaign';this[_0xcc01('0x2')]=0x0;this[_0xcc01('0x3')]=0x0;this[_0xcc01('0x4')]=0x0;this[_0xcc01('0x5')]=0x0;this[_0xcc01('0x6')]='';this[_0xcc01('0x7')]=!![];this[_0xcc01('0x8')]=_0x3ce2a1[_0xcc01('0x8')];this['limitCalls']=_0x3ce2a1[_0xcc01('0x9')];this['dialTimezone']=_0x3ce2a1[_0xcc01('0xa')]||null;this[_0xcc01('0xb')]=_0x3ce2a1[_0xcc01('0xb')]?_0x3ce2a1[_0xcc01('0xb')]:null;this[_0xcc01('0xc')]=_0x3ce2a1[_0xcc01('0xc')];this[_0xcc01('0xd')]=_0x3ce2a1[_0xcc01('0xd')];this[_0xcc01('0xe')]=_0x3ce2a1['dialOriginateTimeout']||0x1e;this[_0xcc01('0xf')]=_0x3ce2a1[_0xcc01('0xf')];this[_0xcc01('0x10')]=_0x3ce2a1[_0xcc01('0x10')];this[_0xcc01('0x11')]=_0x3ce2a1[_0xcc01('0x11')];this['dialBusyRetryFrequency']=_0x3ce2a1[_0xcc01('0x12')];this[_0xcc01('0x13')]=_0x3ce2a1[_0xcc01('0x13')];this[_0xcc01('0x14')]=_0x3ce2a1['dialNoAnswerRetryFrequency'];this[_0xcc01('0x15')]=_0x3ce2a1[_0xcc01('0x15')];this['dialNoSuchNumberMaxRetry']=_0x3ce2a1[_0xcc01('0x16')]||0x3;this[_0xcc01('0x17')]=_0x3ce2a1['dialNoSuchNumberRetryFrequency']||0x96;this[_0xcc01('0x18')]=_0x3ce2a1[_0xcc01('0x18')]||0x3;this[_0xcc01('0x19')]=_0x3ce2a1[_0xcc01('0x19')]||0x96;this[_0xcc01('0x1a')]=_0x3ce2a1[_0xcc01('0x1a')]||0x3;this[_0xcc01('0x1b')]=_0x3ce2a1[_0xcc01('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x3ce2a1[_0xcc01('0x1c')]||0x3;this[_0xcc01('0x1d')]=_0x3ce2a1[_0xcc01('0x1d')]||0x96;this[_0xcc01('0x1e')]=_0x3ce2a1[_0xcc01('0x1e')]||0x3;this[_0xcc01('0x1f')]=_0x3ce2a1['dialAgentRejectRetryFrequency']||0x96;this[_0xcc01('0x20')]=_0x3ce2a1[_0xcc01('0x20')]||'DESC';this['dialPrefix']=_0x3ce2a1['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x3ce2a1[_0xcc01('0x21')]||undefined;this[_0xcc01('0x22')]=_0x3ce2a1[_0xcc01('0x22')]||undefined;this[_0xcc01('0x23')]=_0x3ce2a1[_0xcc01('0x23')]?_0x3ce2a1['TrunkBackup']:undefined;this[_0xcc01('0x24')]=_0x3ce2a1[_0xcc01('0x24')]?_0x3ce2a1[_0xcc01('0x24')]:undefined;this['Interval']=_0x3ce2a1[_0xcc01('0x25')]?_0x3ce2a1[_0xcc01('0x25')]:undefined;this[_0xcc01('0x26')]=_0x3ce2a1[_0xcc01('0x26')]?_0x3ce2a1[_0xcc01('0x26')]:undefined;this['dialQueueProject']=_0x3ce2a1[_0xcc01('0x26')]?_0x3ce2a1['SquareProject'][_0xcc01('0x0')]:undefined;this[_0xcc01('0x27')]=_0x3ce2a1[_0xcc01('0x27')]||![];this[_0xcc01('0x28')]=_0x3ce2a1[_0xcc01('0x28')];this['dialAMDGreeting']=_0x3ce2a1[_0xcc01('0x29')];this[_0xcc01('0x2a')]=_0x3ce2a1[_0xcc01('0x2a')];this[_0xcc01('0x2b')]=_0x3ce2a1[_0xcc01('0x2b')];this[_0xcc01('0x2c')]=_0x3ce2a1[_0xcc01('0x2c')];this[_0xcc01('0x2d')]=_0x3ce2a1[_0xcc01('0x2d')];this[_0xcc01('0x2e')]=_0x3ce2a1['dialAMDMaximumNumberOfWords'];this[_0xcc01('0x2f')]=_0x3ce2a1['dialAMDSilenceThreshold'];this[_0xcc01('0x30')]=_0x3ce2a1[_0xcc01('0x30')];}module[_0xcc01('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8b29f6c..eb41345 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 _0x7d8a=['type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime'];(function(_0x133a5f,_0x4d19a9){var _0x208c8d=function(_0x2c7538){while(--_0x2c7538){_0x133a5f['push'](_0x133a5f['shift']());}};_0x208c8d(++_0x4d19a9);}(_0x7d8a,0xbf));var _0xa7d8=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x7d8a[_0x1bc0ae];return _0x501104;};'use strict';function Channel(){this[_0xa7d8('0x0')]=null;this[_0xa7d8('0x1')]='';this[_0xa7d8('0x2')]='';this['calleridnum']=0x0;this[_0xa7d8('0x3')]='';this['connectedlinenum']=undefined;this[_0xa7d8('0x4')]=undefined;this[_0xa7d8('0x5')]=0x0;this[_0xa7d8('0x6')]='';this[_0xa7d8('0x7')]=0x0;this[_0xa7d8('0x8')]=0x0;this['exten']=0x0;this[_0xa7d8('0x9')]=![];this[_0xa7d8('0xa')]=null;this[_0xa7d8('0xb')]=null;this[_0xa7d8('0xc')]=![];this['abandoned']=![];this[_0xa7d8('0xd')]='';this[_0xa7d8('0xe')]='';this[_0xa7d8('0xf')]=0x0;this['billableseconds']=0x0;this[_0xa7d8('0x10')]=0x0;this[_0xa7d8('0x11')]=null;this[_0xa7d8('0x12')]=null;this['disposition']=null;this[_0xa7d8('0x13')]=![];this[_0xa7d8('0x14')]=null;this[_0xa7d8('0x15')]=null;this[_0xa7d8('0x16')]=[];this[_0xa7d8('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0xa7d8('0x18')]=0x0;}module[_0xa7d8('0x19')]=Channel; \ No newline at end of file +var _0x1f92=['connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x1f92,0x1ad));var _0x21f9=function(_0x108a2e,_0x28ea30){_0x108a2e=_0x108a2e-0x0;var _0x33ffd3=_0x1f92[_0x108a2e];return _0x33ffd3;};'use strict';function Channel(){this[_0x21f9('0x0')]=null;this['channel']='';this[_0x21f9('0x1')]='';this[_0x21f9('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x21f9('0x3')]=undefined;this[_0x21f9('0x4')]=0x0;this[_0x21f9('0x5')]='';this[_0x21f9('0x6')]=0x0;this[_0x21f9('0x7')]=0x0;this[_0x21f9('0x8')]=0x0;this[_0x21f9('0x9')]=![];this[_0x21f9('0xa')]=null;this[_0x21f9('0xb')]=null;this[_0x21f9('0xc')]=![];this[_0x21f9('0xd')]=![];this[_0x21f9('0xe')]='';this['lastdata']='';this[_0x21f9('0xf')]=0x0;this[_0x21f9('0x10')]=0x0;this[_0x21f9('0x11')]=0x0;this['type']=null;this['tag']=null;this[_0x21f9('0x12')]=null;this[_0x21f9('0x13')]=![];this['monitorFilename']=null;this[_0x21f9('0x14')]=null;this[_0x21f9('0x15')]=[];this[_0x21f9('0x16')]=undefined;this[_0x21f9('0x17')]=undefined;this[_0x21f9('0x18')]=undefined;this[_0x21f9('0x19')]=0x0;}module[_0x21f9('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0488884..e58cf7e 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 _0x1256=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType'];(function(_0x45b8b0,_0x1f875f){var _0x405624=function(_0x52d3ac){while(--_0x52d3ac){_0x45b8b0['push'](_0x45b8b0['shift']());}};_0x405624(++_0x1f875f);}(_0x1256,0xe0));var _0x6125=function(_0x851fae,_0x5efd08){_0x851fae=_0x851fae-0x0;var _0x12dcff=_0x1256[_0x851fae];return _0x12dcff;};'use strict';function DeskAccount(_0x2f455e){this['id']=_0x2f455e['id']||0x0;this[_0x6125('0x0')]=_0x2f455e['name']||'';this[_0x6125('0x1')]=_0x2f455e[_0x6125('0x1')]||'';this[_0x6125('0x2')]=_0x2f455e[_0x6125('0x2')]||'';this[_0x6125('0x3')]=_0x2f455e[_0x6125('0x3')]||'';this[_0x6125('0x4')]=_0x2f455e[_0x6125('0x4')]||'';this[_0x6125('0x5')]=_0x2f455e['consumerKey']||'';this[_0x6125('0x6')]=_0x2f455e[_0x6125('0x6')]||'';this[_0x6125('0x7')]=_0x2f455e[_0x6125('0x7')]||'';this[_0x6125('0x8')]=_0x2f455e[_0x6125('0x8')]||'';this[_0x6125('0x9')]=_0x2f455e[_0x6125('0x9')]||'';this['serverUrl']=_0x2f455e[_0x6125('0xa')]||'';this['Configurations']=_0x2f455e[_0x6125('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xb939=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret'];(function(_0x122cc0,_0x800b0f){var _0x57ca49=function(_0x15712f){while(--_0x15712f){_0x122cc0['push'](_0x122cc0['shift']());}};_0x57ca49(++_0x800b0f);}(_0xb939,0x1b4));var _0x9b93=function(_0x56bf62,_0xf9fa59){_0x56bf62=_0x56bf62-0x0;var _0x205493=_0xb939[_0x56bf62];return _0x205493;};'use strict';function DeskAccount(_0x31ce50){this['id']=_0x31ce50['id']||0x0;this['name']=_0x31ce50[_0x9b93('0x0')]||'';this[_0x9b93('0x1')]=_0x31ce50[_0x9b93('0x1')]||'';this['remoteUri']=_0x31ce50[_0x9b93('0x2')]||'';this[_0x9b93('0x3')]=_0x31ce50[_0x9b93('0x3')]||'';this[_0x9b93('0x4')]=_0x31ce50[_0x9b93('0x4')]||'';this['consumerKey']=_0x31ce50[_0x9b93('0x5')]||'';this[_0x9b93('0x6')]=_0x31ce50[_0x9b93('0x6')]||'';this['token']=_0x31ce50['token']||'';this['tokenSecret']=_0x31ce50[_0x9b93('0x7')]||'';this[_0x9b93('0x8')]=_0x31ce50[_0x9b93('0x8')]||'';this[_0x9b93('0x9')]=_0x31ce50[_0x9b93('0x9')]||'';this[_0x9b93('0xa')]=_0x31ce50[_0x9b93('0xa')]||{};}module[_0x9b93('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 c6741e8..cf1cfe3 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 _0x820e=['modernAuthentication','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0xa8fb74,_0x34ffca){var _0x2c68ab=function(_0x3b06d7){while(--_0x3b06d7){_0xa8fb74['push'](_0xa8fb74['shift']());}};_0x2c68ab(++_0x34ffca);}(_0x820e,0x18f));var _0xe820=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x820e[_0x432682];return _0x463d05;};'use strict';function Dynamics365Account(_0x556431){this['id']=_0x556431['id']||0x0;this[_0xe820('0x0')]=_0x556431[_0xe820('0x0')]||'';this[_0xe820('0x1')]=_0x556431[_0xe820('0x1')]||'';this[_0xe820('0x2')]=_0x556431[_0xe820('0x2')]||'';this[_0xe820('0x3')]=_0x556431[_0xe820('0x3')]||'';this['tenantId']=_0x556431[_0xe820('0x4')]||'';this[_0xe820('0x5')]=_0x556431['clientId']||'';this[_0xe820('0x6')]=_0x556431['clientSecret']||{};this[_0xe820('0x7')]=_0x556431[_0xe820('0x7')]||'';this[_0xe820('0x8')]=_0x556431[_0xe820('0x8')]||![];this[_0xe820('0x9')]=_0x556431[_0xe820('0x9')]||{};this['CloudProvider']=_0x556431['CloudProvider']||{};}module[_0xe820('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xd7f3=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri'];(function(_0x5d7190,_0x22089f){var _0x2f3043=function(_0x93f47f){while(--_0x93f47f){_0x5d7190['push'](_0x5d7190['shift']());}};_0x2f3043(++_0x22089f);}(_0xd7f3,0x167));var _0x3d7f=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0xd7f3[_0x35181c];return _0xe14bf9;};'use strict';function Dynamics365Account(_0x23cb03){this['id']=_0x23cb03['id']||0x0;this[_0x3d7f('0x0')]=_0x23cb03[_0x3d7f('0x0')]||'';this['username']=_0x23cb03[_0x3d7f('0x1')]||'';this[_0x3d7f('0x2')]=_0x23cb03[_0x3d7f('0x2')]||'';this['remoteUri']=_0x23cb03[_0x3d7f('0x3')]||'';this['tenantId']=_0x23cb03[_0x3d7f('0x4')]||'';this[_0x3d7f('0x5')]=_0x23cb03['clientId']||'';this[_0x3d7f('0x6')]=_0x23cb03[_0x3d7f('0x6')]||{};this[_0x3d7f('0x7')]=_0x23cb03[_0x3d7f('0x7')]||'';this[_0x3d7f('0x8')]=_0x23cb03[_0x3d7f('0x8')]||![];this['Configurations']=_0x23cb03[_0x3d7f('0x9')]||{};this[_0x3d7f('0xa')]=_0x23cb03['CloudProvider']||{};}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 9c9aad5..56abfff 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 _0xdf49=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','ecm'];(function(_0x4a220b,_0x509237){var _0x59c102=function(_0x30c569){while(--_0x30c569){_0x4a220b['push'](_0x4a220b['shift']());}};_0x59c102(++_0x509237);}(_0xdf49,0x157));var _0x9df4=function(_0x59b533,_0x59fdcc){_0x59b533=_0x59b533-0x0;var _0x2beced=_0xdf49[_0x59b533];return _0x2beced;};'use strict';function FaxAccount(_0x17f781){this['id']=_0x17f781['id']||0x0;this['name']=_0x17f781[_0x9df4('0x0')]||'';this['description']=_0x17f781['description'];this[_0x9df4('0x1')]=_0x17f781[_0x9df4('0x1')];this['headerinfo']=_0x17f781[_0x9df4('0x2')];this[_0x9df4('0x3')]=_0x17f781[_0x9df4('0x3')];this[_0x9df4('0x4')]=_0x17f781[_0x9df4('0x4')]||0x960;this[_0x9df4('0x5')]=_0x17f781[_0x9df4('0x5')]||0x3840;this[_0x9df4('0x6')]=_0x17f781['modem']||_0x9df4('0x7');this[_0x9df4('0x8')]=_0x17f781[_0x9df4('0x8')]||'no';this[_0x9df4('0x9')]=_0x17f781[_0x9df4('0x9')]||'no';this[_0x9df4('0xa')]=_0x17f781[_0x9df4('0xa')]||0x1388;this['tech']=_0x17f781[_0x9df4('0xb')]||'SIP';this['Trunk']=_0x17f781[_0x9df4('0xc')]?_0x17f781[_0x9df4('0xc')]:undefined;this[_0x9df4('0xd')]=_0x17f781[_0x9df4('0xd')];this[_0x9df4('0xe')]=_0x17f781[_0x9df4('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x3da1=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x147186,_0x58685c){var _0x1b92ab=function(_0x5c6e08){while(--_0x5c6e08){_0x147186['push'](_0x147186['shift']());}};_0x1b92ab(++_0x58685c);}(_0x3da1,0x7d));var _0x13da=function(_0x1d6be0,_0x5e2b0b){_0x1d6be0=_0x1d6be0-0x0;var _0x4b6c6c=_0x3da1[_0x1d6be0];return _0x4b6c6c;};'use strict';function FaxAccount(_0x522aaf){this['id']=_0x522aaf['id']||0x0;this[_0x13da('0x0')]=_0x522aaf[_0x13da('0x0')]||'';this['description']=_0x522aaf[_0x13da('0x1')];this[_0x13da('0x2')]=_0x522aaf[_0x13da('0x2')];this[_0x13da('0x3')]=_0x522aaf[_0x13da('0x3')];this[_0x13da('0x4')]=_0x522aaf[_0x13da('0x4')];this[_0x13da('0x5')]=_0x522aaf[_0x13da('0x5')]||0x960;this[_0x13da('0x6')]=_0x522aaf[_0x13da('0x6')]||0x3840;this[_0x13da('0x7')]=_0x522aaf['modem']||_0x13da('0x8');this[_0x13da('0x9')]=_0x522aaf[_0x13da('0x9')]||'no';this[_0x13da('0xa')]=_0x522aaf[_0x13da('0xa')]||'no';this['t38timeout']=_0x522aaf[_0x13da('0xb')]||0x1388;this['tech']=_0x522aaf[_0x13da('0xc')]||_0x13da('0xd');this[_0x13da('0xe')]=_0x522aaf[_0x13da('0xe')]?_0x522aaf['Trunk']:undefined;this['ListId']=_0x522aaf[_0x13da('0xf')];this[_0x13da('0x10')]=_0x522aaf[_0x13da('0x10')];}module[_0x13da('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 003a264..c1ec984 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 _0xf81a=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xf81a,0x178));var _0xaf81=function(_0x4dc591,_0x1b3156){_0x4dc591=_0x4dc591-0x0;var _0x1db009=_0xf81a[_0x4dc591];return _0x1db009;};'use strict';function FreshdeskAccount(_0x3e272b){this['id']=_0x3e272b['id']||0x0;this[_0xaf81('0x0')]=_0x3e272b[_0xaf81('0x0')]||'';this['username']=_0x3e272b[_0xaf81('0x1')]||'';this[_0xaf81('0x2')]=_0x3e272b[_0xaf81('0x3')]||'';this['remoteUri']=_0x3e272b[_0xaf81('0x4')]||'';this['serverUrl']=_0x3e272b[_0xaf81('0x5')]||'';this['Configurations']=_0x3e272b[_0xaf81('0x6')]||{};}module[_0xaf81('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x0690=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0xa6d34c,_0x4a6575){var _0x118b9c=function(_0xb0aab4){while(--_0xb0aab4){_0xa6d34c['push'](_0xa6d34c['shift']());}};_0x118b9c(++_0x4a6575);}(_0x0690,0xad));var _0x0069=function(_0x4db7c6,_0x20f162){_0x4db7c6=_0x4db7c6-0x0;var _0x51d85f=_0x0690[_0x4db7c6];return _0x51d85f;};'use strict';function FreshdeskAccount(_0x26e5a2){this['id']=_0x26e5a2['id']||0x0;this[_0x0069('0x0')]=_0x26e5a2[_0x0069('0x0')]||'';this[_0x0069('0x1')]=_0x26e5a2['username']||'';this[_0x0069('0x2')]=_0x26e5a2[_0x0069('0x3')]||'';this[_0x0069('0x4')]=_0x26e5a2['remoteUri']||'';this[_0x0069('0x5')]=_0x26e5a2[_0x0069('0x5')]||'';this[_0x0069('0x6')]=_0x26e5a2['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 2f86b55..91ed3c1 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 _0xdb70=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x447b32,_0x51b42b){var _0x22dfc8=function(_0x49ad87){while(--_0x49ad87){_0x447b32['push'](_0x447b32['shift']());}};_0x22dfc8(++_0x51b42b);}(_0xdb70,0xa0));var _0x0db7=function(_0x5938ab,_0x45cae1){_0x5938ab=_0x5938ab-0x0;var _0x17bd46=_0xdb70[_0x5938ab];return _0x17bd46;};'use strict';function FreshsalesAccount(_0x1c9665){this['id']=_0x1c9665['id']||0x0;this[_0x0db7('0x0')]=_0x1c9665[_0x0db7('0x0')]||'';this['username']=_0x1c9665[_0x0db7('0x1')]||'';this[_0x0db7('0x2')]=_0x1c9665[_0x0db7('0x3')]||'';this[_0x0db7('0x4')]=_0x1c9665[_0x0db7('0x4')]||'';this[_0x0db7('0x5')]=_0x1c9665[_0x0db7('0x5')]||'';this[_0x0db7('0x6')]=_0x1c9665[_0x0db7('0x6')]||{};}module[_0x0db7('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x960c=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x960c,0x113));var _0xc960=function(_0x299685,_0x1e1236){_0x299685=_0x299685-0x0;var _0x2128b1=_0x960c[_0x299685];return _0x2128b1;};'use strict';function FreshsalesAccount(_0x2cc998){this['id']=_0x2cc998['id']||0x0;this['name']=_0x2cc998[_0xc960('0x0')]||'';this['username']=_0x2cc998[_0xc960('0x1')]||'';this[_0xc960('0x2')]=_0x2cc998[_0xc960('0x3')]||'';this['remoteUri']=_0x2cc998[_0xc960('0x4')]||'';this[_0xc960('0x5')]=_0x2cc998['serverUrl']||'';this['Configurations']=_0x2cc998[_0xc960('0x6')]||{};}module[_0xc960('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 d8fc5cf..46ed13e 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 _0x2e7b=['holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','priority'];(function(_0x13ff86,_0x1263f9){var _0x24242a=function(_0x5a2abb){while(--_0x5a2abb){_0x13ff86['push'](_0x13ff86['shift']());}};_0x24242a(++_0x1263f9);}(_0x2e7b,0x130));var _0xb2e7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2e7b[_0x3b380d];return _0x54502b;};'use strict';function QueueReport(){this[_0xb2e7('0x0')]=_0xb2e7('0x1');this[_0xb2e7('0x2')]='';this[_0xb2e7('0x3')]='';this[_0xb2e7('0x4')]='';this[_0xb2e7('0x5')]='';this['queuecallerjoinAt']=null;this[_0xb2e7('0x6')]=null;this[_0xb2e7('0x7')]=0x1;this[_0xb2e7('0x8')]=0x1;this['queuecallerabandon']=![];this[_0xb2e7('0x9')]=null;this[_0xb2e7('0xa')]=![];this[_0xb2e7('0xb')]=null;this[_0xb2e7('0xc')]=![];this[_0xb2e7('0xd')]=null;this['originalposition']=0x1;this[_0xb2e7('0xe')]='';this[_0xb2e7('0xf')]='';this[_0xb2e7('0x10')]='';this[_0xb2e7('0x11')]='';this[_0xb2e7('0x12')]='';this['exten']='';this[_0xb2e7('0x13')]='';this[_0xb2e7('0x14')]=0x0;this[_0xb2e7('0x15')]=![];this[_0xb2e7('0x16')]='';this[_0xb2e7('0x17')]='voice';this[_0xb2e7('0x18')]=0x0;this[_0xb2e7('0x19')]={};}module[_0xb2e7('0x1a')]=QueueReport; \ No newline at end of file +var _0xd8f7=['motionChannel','mohtime','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context','exten','priority','assigned','lastAssignedTo'];(function(_0x59a5a0,_0x50cb00){var _0x3de9cf=function(_0x3c866){while(--_0x3c866){_0x59a5a0['push'](_0x59a5a0['shift']());}};_0x3de9cf(++_0x50cb00);}(_0xd8f7,0x7f));var _0x7d8f=function(_0x30c9a9,_0x51d03d){_0x30c9a9=_0x30c9a9-0x0;var _0x1c58c6=_0xd8f7[_0x30c9a9];return _0x1c58c6;};'use strict';function QueueReport(){this['type']=_0x7d8f('0x0');this[_0x7d8f('0x1')]='';this[_0x7d8f('0x2')]='';this[_0x7d8f('0x3')]='';this[_0x7d8f('0x4')]='';this[_0x7d8f('0x5')]=null;this[_0x7d8f('0x6')]=null;this[_0x7d8f('0x7')]=0x1;this[_0x7d8f('0x8')]=0x1;this[_0x7d8f('0x9')]=![];this[_0x7d8f('0xa')]=null;this[_0x7d8f('0xb')]=![];this[_0x7d8f('0xc')]=null;this[_0x7d8f('0xd')]=![];this[_0x7d8f('0xe')]=null;this[_0x7d8f('0xf')]=0x1;this[_0x7d8f('0x10')]='';this[_0x7d8f('0x11')]='';this['connectedlinename']='';this['accountcode']='';this[_0x7d8f('0x12')]='';this[_0x7d8f('0x13')]='';this[_0x7d8f('0x14')]='';this['holdtime']=0x0;this[_0x7d8f('0x15')]=![];this[_0x7d8f('0x16')]='';this[_0x7d8f('0x17')]='voice';this[_0x7d8f('0x18')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 9bdfcd3..46d5b91 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 _0xf65d=['type','integrationTab','Configurations','exports','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0xe002f,_0x5af963){var _0x5de752=function(_0x220f89){while(--_0x220f89){_0xe002f['push'](_0xe002f['shift']());}};_0x5de752(++_0x5af963);}(_0xf65d,0x13a));var _0xdf65=function(_0x4471b3,_0x511a9f){_0x4471b3=_0x4471b3-0x0;var _0x386593=_0xf65d[_0x4471b3];return _0x386593;};'use strict';function SalesforceAccount(_0x12450b){this['id']=_0x12450b['id']||0x0;this['name']=_0x12450b['name']||'';this[_0xdf65('0x0')]=_0x12450b[_0xdf65('0x0')]||'';this[_0xdf65('0x1')]=_0x12450b['remoteUri']||'';this[_0xdf65('0x2')]=_0x12450b['password']||'';this[_0xdf65('0x3')]=_0x12450b[_0xdf65('0x3')]||'';this[_0xdf65('0x4')]=_0x12450b[_0xdf65('0x4')]||'';this[_0xdf65('0x5')]=_0x12450b[_0xdf65('0x5')]||'';this[_0xdf65('0x6')]=_0x12450b[_0xdf65('0x6')]||_0xdf65('0x7');this['serverUrl']=_0x12450b['serverUrl']||'';this[_0xdf65('0x8')]=_0x12450b[_0xdf65('0x8')]||{};}module[_0xdf65('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xf097=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x51c079,_0x55b71e){var _0x1bc89a=function(_0x1d0868){while(--_0x1d0868){_0x51c079['push'](_0x51c079['shift']());}};_0x1bc89a(++_0x55b71e);}(_0xf097,0x10c));var _0x7f09=function(_0x2aa020,_0x5339dd){_0x2aa020=_0x2aa020-0x0;var _0x308379=_0xf097[_0x2aa020];return _0x308379;};'use strict';function SalesforceAccount(_0xc01f8d){this['id']=_0xc01f8d['id']||0x0;this['name']=_0xc01f8d[_0x7f09('0x0')]||'';this[_0x7f09('0x1')]=_0xc01f8d['username']||'';this[_0x7f09('0x2')]=_0xc01f8d['remoteUri']||'';this[_0x7f09('0x3')]=_0xc01f8d[_0x7f09('0x3')]||'';this[_0x7f09('0x4')]=_0xc01f8d[_0x7f09('0x4')]||'';this[_0x7f09('0x5')]=_0xc01f8d[_0x7f09('0x5')]||'';this[_0x7f09('0x6')]=_0xc01f8d[_0x7f09('0x6')]||'';this['type']=_0xc01f8d[_0x7f09('0x7')]||_0x7f09('0x8');this[_0x7f09('0x9')]=_0xc01f8d[_0x7f09('0x9')]||'';this['Configurations']=_0xc01f8d[_0x7f09('0xa')]||{};}module[_0x7f09('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 0be668a..cbe224c 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 _0xe529=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x3c2666,_0x15fd23){var _0x10c814=function(_0x4660c0){while(--_0x4660c0){_0x3c2666['push'](_0x3c2666['shift']());}};_0x10c814(++_0x15fd23);}(_0xe529,0xc1));var _0x9e52=function(_0x5300b6,_0x4a5846){_0x5300b6=_0x5300b6-0x0;var _0x58980e=_0xe529[_0x5300b6];return _0x58980e;};'use strict';function ServicenowAccount(_0x3c45b2){this['id']=_0x3c45b2['id']||0x0;this[_0x9e52('0x0')]=_0x3c45b2[_0x9e52('0x0')]||'';this[_0x9e52('0x1')]=_0x3c45b2['username']||'';this[_0x9e52('0x2')]=_0x3c45b2[_0x9e52('0x2')]||'';this[_0x9e52('0x3')]=_0x3c45b2[_0x9e52('0x3')]||'';this[_0x9e52('0x4')]=_0x3c45b2['serverUrl']||'';this[_0x9e52('0x5')]=_0x3c45b2['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x742f=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2894d5,_0x159d6b){var _0x343dd7=function(_0x3ee396){while(--_0x3ee396){_0x2894d5['push'](_0x2894d5['shift']());}};_0x343dd7(++_0x159d6b);}(_0x742f,0xc2));var _0xf742=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x742f[_0x4e6ae6];return _0x23c108;};'use strict';function ServicenowAccount(_0x594aaf){this['id']=_0x594aaf['id']||0x0;this[_0xf742('0x0')]=_0x594aaf[_0xf742('0x0')]||'';this[_0xf742('0x1')]=_0x594aaf[_0xf742('0x1')]||'';this[_0xf742('0x2')]=_0x594aaf[_0xf742('0x2')]||'';this['remoteUri']=_0x594aaf[_0xf742('0x3')]||'';this[_0xf742('0x4')]=_0x594aaf[_0xf742('0x4')]||'';this[_0xf742('0x5')]=_0x594aaf['Configurations']||{};}module[_0xf742('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d046332..26f0fad 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 _0xdcbd=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1b3163,_0x589734){var _0x428ee6=function(_0x5e4ded){while(--_0x5e4ded){_0x1b3163['push'](_0x1b3163['shift']());}};_0x428ee6(++_0x589734);}(_0xdcbd,0xb6));var _0xddcb=function(_0x473a5b,_0x1d31b7){_0x473a5b=_0x473a5b-0x0;var _0x48007a=_0xdcbd[_0x473a5b];return _0x48007a;};'use strict';function SugarcrmAccount(_0x4ce832){this['id']=_0x4ce832['id']||0x0;this['name']=_0x4ce832[_0xddcb('0x0')]||'';this[_0xddcb('0x1')]=_0x4ce832['username']||'';this[_0xddcb('0x2')]=_0x4ce832['password']||'';this['remoteUri']=_0x4ce832[_0xddcb('0x3')]||'';this[_0xddcb('0x4')]=_0x4ce832[_0xddcb('0x4')]||'';this[_0xddcb('0x5')]=_0x4ce832[_0xddcb('0x5')]||{};}module[_0xddcb('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xfbc6=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xfbc6,0x13c));var _0x6fbc=function(_0x14dd10,_0x4900d6){_0x14dd10=_0x14dd10-0x0;var _0x5cb641=_0xfbc6[_0x14dd10];return _0x5cb641;};'use strict';function SugarcrmAccount(_0x3b19b4){this['id']=_0x3b19b4['id']||0x0;this['name']=_0x3b19b4[_0x6fbc('0x0')]||'';this[_0x6fbc('0x1')]=_0x3b19b4['username']||'';this['password']=_0x3b19b4[_0x6fbc('0x2')]||'';this[_0x6fbc('0x3')]=_0x3b19b4[_0x6fbc('0x3')]||'';this[_0x6fbc('0x4')]=_0x3b19b4[_0x6fbc('0x4')]||'';this[_0x6fbc('0x5')]=_0x3b19b4['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c1a7914..8759cd5 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 _0xb939=['name','accountcode','state','unknown','stateTime','status'];(function(_0x3c6266,_0x503711){var _0x39fb79=function(_0x4fd8b8){while(--_0x4fd8b8){_0x3c6266['push'](_0x3c6266['shift']());}};_0x39fb79(++_0x503711);}(_0xb939,0xd2));var _0x9b93=function(_0x262263,_0xf13273){_0x262263=_0x262263-0x0;var _0x1c7829=_0xb939[_0x262263];return _0x1c7829;};'use strict';function Telephone(_0x52ffbd){this['id']=_0x52ffbd['id']||0x0;this[_0x9b93('0x0')]=_0x52ffbd['name']||'';this[_0x9b93('0x1')]=_0x52ffbd[_0x9b93('0x1')]||'';this[_0x9b93('0x2')]=_0x9b93('0x3');this[_0x9b93('0x4')]=0x0;this[_0x9b93('0x5')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xd9b6=['exports','name','state','unknown','stateTime','status','address'];(function(_0x6d765d,_0x3f05ad){var _0x4a632e=function(_0x2d4c38){while(--_0x2d4c38){_0x6d765d['push'](_0x6d765d['shift']());}};_0x4a632e(++_0x3f05ad);}(_0xd9b6,0x17b));var _0x6d9b=function(_0x2db29c,_0xdfad2c){_0x2db29c=_0x2db29c-0x0;var _0x54a99c=_0xd9b6[_0x2db29c];return _0x54a99c;};'use strict';function Telephone(_0x35f669){this['id']=_0x35f669['id']||0x0;this[_0x6d9b('0x0')]=_0x35f669[_0x6d9b('0x0')]||'';this['accountcode']=_0x35f669['accountcode']||'';this[_0x6d9b('0x1')]=_0x6d9b('0x2');this[_0x6d9b('0x3')]=0x0;this[_0x6d9b('0x4')]=_0x6d9b('0x2');this[_0x6d9b('0x5')]='';}module[_0x6d9b('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 94bc7cc..0c9d274 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(_0x1f036d,_0x45e323){var _0x624d56=function(_0x536c17){while(--_0x536c17){_0x1f036d['push'](_0x1f036d['shift']());}};_0x624d56(++_0x45e323);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x1a6503,_0x1d4081){var _0x2bee33=function(_0xba06c7){while(--_0xba06c7){_0x1a6503['push'](_0x1a6503['shift']());}};_0x2bee33(++_0x1d4081);}(_0xb10b,0x12a));var _0xbb10=function(_0x5efbd0,_0x299553){_0x5efbd0=_0x5efbd0-0x0;var _0x475ec9=_0xb10b[_0x5efbd0];return _0x475ec9;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 58d06e3..3957a9f 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x274321,_0x4c20ac){var _0x449cf8=function(_0x557ebf){while(--_0x557ebf){_0x274321['push'](_0x274321['shift']());}};_0x449cf8(++_0x4c20ac);}(_0xda2d,0x102));var _0xdda2=function(_0x3294d2,_0xfcc7a5){_0x3294d2=_0x3294d2-0x0;var _0x44ffa0=_0xda2d[_0x3294d2];return _0x44ffa0;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 7dba657..0dad230 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 _0x2d16=['split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf'];(function(_0x296632,_0x5234cc){var _0x59f7d2=function(_0xeef0d7){while(--_0xeef0d7){_0x296632['push'](_0x296632['shift']());}};_0x59f7d2(++_0x5234cc);}(_0x2d16,0x13b));var _0x62d1=function(_0x115795,_0x3dc6b8){_0x115795=_0x115795-0x0;var _0x26e31a=_0x2d16[_0x115795];return _0x26e31a;};'use strict';function Trunk(_0x447756){this['id']=_0x447756['id']||0x0;this[_0x62d1('0x0')]=_0x447756[_0x62d1('0x0')]||![];this['name']=_0x447756[_0x62d1('0x1')]||'';this[_0x62d1('0x2')]=_0x62d1('0x3');this[_0x62d1('0x4')]=0x0;this[_0x62d1('0x5')]=_0x62d1('0x3');this[_0x62d1('0x6')]=_0x447756['registry']&&_0x447756[_0x62d1('0x6')][_0x62d1('0x7')](':')?_0x447756[_0x62d1('0x6')][_0x62d1('0x8')](':')[0x0]:'';this[_0x62d1('0x9')]='';this[_0x62d1('0xa')]='';this[_0x62d1('0xb')]='';this[_0x62d1('0xc')]='';this[_0x62d1('0xd')]='';this[_0x62d1('0xe')]=_0x62d1('0x3');this[_0x62d1('0xf')]='';this[_0x62d1('0x10')]='';this[_0x62d1('0x11')]=_0x447756[_0x62d1('0x11')]||'';}module[_0x62d1('0x12')]=Trunk; \ No newline at end of file +var _0x5771=['stateTime','status','unknown','registry','split','host','domainport','refresh','stateRegistry','registrationtime','defaultuser','active','name','state'];(function(_0x52e06a,_0x671ab2){var _0xde95f1=function(_0x57df62){while(--_0x57df62){_0x52e06a['push'](_0x52e06a['shift']());}};_0xde95f1(++_0x671ab2);}(_0x5771,0x1cb));var _0x1577=function(_0x252bb7,_0x63e975){_0x252bb7=_0x252bb7-0x0;var _0x5d3138=_0x5771[_0x252bb7];return _0x5d3138;};'use strict';function Trunk(_0x380ceb){this['id']=_0x380ceb['id']||0x0;this[_0x1577('0x0')]=_0x380ceb[_0x1577('0x0')]||![];this[_0x1577('0x1')]=_0x380ceb['name']||'';this[_0x1577('0x2')]='unknown';this[_0x1577('0x3')]=0x0;this[_0x1577('0x4')]=_0x1577('0x5');this[_0x1577('0x6')]=_0x380ceb[_0x1577('0x6')]&&_0x380ceb[_0x1577('0x6')]['indexOf'](':')?_0x380ceb['registry'][_0x1577('0x7')](':')[0x0]:'';this[_0x1577('0x8')]='';this['port']='';this['domain']='';this[_0x1577('0x9')]='';this[_0x1577('0xa')]='';this[_0x1577('0xb')]='unknown';this[_0x1577('0xc')]='';this['address']='';this[_0x1577('0xd')]=_0x380ceb[_0x1577('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0a2077c..c3d57d2 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 _0x2527=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2527,0xde));var _0x7252=function(_0x493fe6,_0x50ecf7){_0x493fe6=_0x493fe6-0x0;var _0x21ce12=_0x2527[_0x493fe6];return _0x21ce12;};'use strict';function voiceExtension(_0x5e6714){this['id']=_0x5e6714['id']||0x0;this[_0x7252('0x0')]=_0x5e6714['exten']||'';this['recordingFormat']=_0x5e6714[_0x7252('0x1')]||'none';this['mandatoryDisposition']=_0x5e6714[_0x7252('0x2')]||![];}module[_0x7252('0x3')]=voiceExtension; \ No newline at end of file +var _0x0567=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x3cfed5,_0x4422c){var _0x54e28e=function(_0x28d4e4){while(--_0x28d4e4){_0x3cfed5['push'](_0x3cfed5['shift']());}};_0x54e28e(++_0x4422c);}(_0x0567,0x189));var _0x7056=function(_0x97245,_0x54e965){_0x97245=_0x97245-0x0;var _0x1a5eac=_0x0567[_0x97245];return _0x1a5eac;};'use strict';function voiceExtension(_0x1e672b){this['id']=_0x1e672b['id']||0x0;this[_0x7056('0x0')]=_0x1e672b[_0x7056('0x0')]||'';this[_0x7056('0x1')]=_0x1e672b['recordingFormat']||_0x7056('0x2');this['mandatoryDisposition']=_0x1e672b[_0x7056('0x3')]||![];}module[_0x7056('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 879bb25..5d2d403 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 _0x77f7=['Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','wrandom','name','monitor_format','type','inbound','waiting','answered','sumHoldTime','sumBillable','abandoned','available','busy','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry'];(function(_0x9b4b12,_0x5b26b8){var _0x1d8fdc=function(_0xfc7c53){while(--_0xfc7c53){_0x9b4b12['push'](_0x9b4b12['shift']());}};_0x1d8fdc(++_0x5b26b8);}(_0x77f7,0xbd));var _0x777f=function(_0x2b1e8e,_0x1f52c7){_0x2b1e8e=_0x2b1e8e-0x0;var _0x48268f=_0x77f7[_0x2b1e8e];return _0x48268f;};'use strict';var monitorFormat={'wav':_0x777f('0x0'),'wav49':_0x777f('0x1'),'gsm':_0x777f('0x2')};var strategy={'fewestcalls':_0x777f('0x3'),'leastrecent':_0x777f('0x4'),'linear':_0x777f('0x5'),'random':_0x777f('0x6'),'ringall':_0x777f('0x7'),'rr':_0x777f('0x8'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x777f('0x9')};function VoiceQueue(_0x188bf1){this['id']=_0x188bf1['id']||0x0;this[_0x777f('0xa')]=_0x188bf1[_0x777f('0xa')]||'';this[_0x777f('0xb')]=_0x188bf1[_0x777f('0xb')]||'';this[_0x777f('0xc')]=_0x188bf1[_0x777f('0xc')]||_0x777f('0xd');this[_0x777f('0xe')]=0x0;this['total']=0x0;this[_0x777f('0xf')]=0x0;this['sumDuration']=0x0;this[_0x777f('0x10')]=0x0;this[_0x777f('0x11')]=0x0;this['unmanaged']=0x0;this[_0x777f('0x12')]=0x0;this[_0x777f('0x13')]=0x0;this[_0x777f('0x14')]=0x0;this['inUse']=0x0;this[_0x777f('0x15')]=0x0;this[_0x777f('0x16')]=0x0;this[_0x777f('0x17')]=0x0;this[_0x777f('0x18')]=0x0;this[_0x777f('0x19')]=0x0;this[_0x777f('0x1a')]=0x0;this['ringInUse']=0x0;this[_0x777f('0x1b')]=0x0;this[_0x777f('0x1c')]=0x0;this['unknown']=0x0;this[_0x777f('0x1d')]=_0x188bf1[_0x777f('0x1d')]||![];this[_0x777f('0x1e')]=_0x188bf1[_0x777f('0x1e')]||0xa;this[_0x777f('0x1f')]=_0x188bf1[_0x777f('0x1f')]||'no';this[_0x777f('0x20')]=!![];this['message']='';this[_0x777f('0x21')]='';this[_0x777f('0x22')]=0x0;this[_0x777f('0x23')]=0x0;this[_0x777f('0x24')]=_0x188bf1[_0x777f('0x24')]||null;this[_0x777f('0x25')]=_0x188bf1[_0x777f('0x25')]?_0x188bf1['dialGlobalInterval']:null;this['dialActive']=_0x188bf1[_0x777f('0x26')];this[_0x777f('0x27')]=_0x188bf1[_0x777f('0x27')]||_0x777f('0x28');this[_0x777f('0x29')]=_0x188bf1[_0x777f('0x29')]||0x0;this[_0x777f('0x2a')]=_0x188bf1[_0x777f('0x2a')]||0x0;this['dialPowerLevel']=_0x188bf1[_0x777f('0x2b')]||0x1;this['dialPredictiveOptimization']=_0x188bf1[_0x777f('0x2c')]||_0x777f('0x2d');this[_0x777f('0x2e')]=_0x188bf1[_0x777f('0x2e')]||0.03;this[_0x777f('0x2f')]=_0x188bf1[_0x777f('0x2f')]||0x258;this[_0x777f('0x30')]=_0x188bf1['dialOriginateCallerIdName']||_0x777f('0x31');this[_0x777f('0x32')]=_0x188bf1['dialOriginateCallerIdNumber']||_0x777f('0x31');this['dialOriginateTimeout']=_0x188bf1[_0x777f('0x33')]||0x1e;this[_0x777f('0x34')]=_0x188bf1[_0x777f('0x34')]||_0x777f('0x35');this[_0x777f('0x36')]=_0x188bf1[_0x777f('0x36')]||0x3;this[_0x777f('0x37')]=_0x188bf1[_0x777f('0x37')]||undefined;this[_0x777f('0x38')]=_0x188bf1['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x188bf1[_0x777f('0x39')]||0x96;this[_0x777f('0x3a')]=_0x188bf1[_0x777f('0x3a')]||0x3;this[_0x777f('0x3b')]=_0x188bf1[_0x777f('0x3b')]||0x96;this[_0x777f('0x3c')]=_0x188bf1[_0x777f('0x3c')]||0x3;this['dialNoAnswerRetryFrequency']=_0x188bf1[_0x777f('0x3d')]||0x96;this[_0x777f('0x3e')]=_0x188bf1['dialNoSuchNumberMaxRetry']||0x3;this[_0x777f('0x3f')]=_0x188bf1[_0x777f('0x3f')]||0x96;this['dialDropMaxRetry']=_0x188bf1['dialDropMaxRetry']||0x3;this[_0x777f('0x40')]=_0x188bf1[_0x777f('0x40')]||0x96;this[_0x777f('0x41')]=_0x188bf1[_0x777f('0x41')]||0x3;this[_0x777f('0x42')]=_0x188bf1[_0x777f('0x42')]||0x96;this[_0x777f('0x43')]=_0x188bf1[_0x777f('0x43')]||0x3;this[_0x777f('0x44')]=_0x188bf1[_0x777f('0x44')]||0x96;this['dialAgentRejectMaxRetry']=_0x188bf1[_0x777f('0x45')]||0x3;this[_0x777f('0x46')]=_0x188bf1[_0x777f('0x46')]||0x96;this[_0x777f('0x47')]=_0x188bf1[_0x777f('0x47')]||0x3;this[_0x777f('0x48')]=_0x188bf1['dialGlobalMaxRetry']||0x4;this[_0x777f('0x49')]=_0x188bf1[_0x777f('0x49')]?_0x188bf1['Trunk']:undefined;this[_0x777f('0x4a')]=_0x188bf1['TrunkBackup']?_0x188bf1['TrunkBackup']:undefined;this[_0x777f('0x4b')]=_0x188bf1[_0x777f('0x4b')]||undefined;this[_0x777f('0x4c')]=_0x188bf1[_0x777f('0x4c')]?_0x188bf1[_0x777f('0x4c')]:undefined;this[_0x777f('0x4d')]=_0x188bf1[_0x777f('0x4d')]||_0x777f('0x4e');this['dialRandomLastDigitCallerIdNumber']=_0x188bf1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x777f('0x4f')]=_0x188bf1[_0x777f('0x4f')]||undefined;this[_0x777f('0x50')]=strategy[_0x188bf1[_0x777f('0x50')]];this[_0x777f('0x51')]=!![];this[_0x777f('0x52')]=_0x188bf1[_0x777f('0x52')]||![];this[_0x777f('0x53')]=_0x188bf1['dialAMDInitialSilence'];this[_0x777f('0x54')]=_0x188bf1[_0x777f('0x54')];this[_0x777f('0x55')]=_0x188bf1[_0x777f('0x55')];this[_0x777f('0x56')]=_0x188bf1[_0x777f('0x56')];this[_0x777f('0x57')]=_0x188bf1[_0x777f('0x57')];this['dialAMDBetweenWordsSilence']=_0x188bf1['dialAMDBetweenWordsSilence'];this[_0x777f('0x58')]=_0x188bf1['dialAMDMaximumNumberOfWords'];this[_0x777f('0x59')]=_0x188bf1[_0x777f('0x59')];this[_0x777f('0x5a')]=_0x188bf1[_0x777f('0x5a')];this[_0x777f('0x5b')]=0x0;this['pTalking']=0x0;this[_0x777f('0x5c')]=_0x188bf1[_0x777f('0x5c')];this[_0x777f('0x5d')]=0x0;this[_0x777f('0x5e')]=0x0;this[_0x777f('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x777f('0x60')]=0x0;this[_0x777f('0x61')]=0x0;this[_0x777f('0x62')]=0x0;this[_0x777f('0x63')]=0x0;this[_0x777f('0x64')]=0x0;this[_0x777f('0x65')]=0x0;this[_0x777f('0x66')]=0x0;this[_0x777f('0x67')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x777f('0x68')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x777f('0x69')]=1.05;this[_0x777f('0x6a')]=0x0;this[_0x777f('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x777f('0x6c')]=0x0;this[_0x777f('0x6d')]=0x0;this[_0x777f('0x6e')]=0x0;this[_0x777f('0x6f')]=0x0;this['predictiveIntervalMaxThreshold']=_0x188bf1[_0x777f('0x70')]||0x14;this[_0x777f('0x71')]=_0x188bf1[_0x777f('0x70')]||0xa;this[_0x777f('0x72')]=0x0;this[_0x777f('0x73')]=0x0;this[_0x777f('0x74')]=0x1;this[_0x777f('0x75')]=0x0;this[_0x777f('0x76')]=0x0;this[_0x777f('0x77')]=0x0;this[_0x777f('0x78')]=0x0;this[_0x777f('0x79')]=_0x188bf1[_0x777f('0x79')]||0x1e;this[_0x777f('0x7a')]=_0x188bf1[_0x777f('0x7a')]||![];this[_0x777f('0x7b')]=!!_0x188bf1['dialPreviewAutoRecallMe']||![];this[_0x777f('0x7c')]=!!_0x188bf1[_0x777f('0x7c')]||![];this[_0x777f('0x7d')]=_0x188bf1[_0x777f('0x7d')]||undefined;this['dialAgiAfterHangupClient']=_0x188bf1[_0x777f('0x7e')]||![];this[_0x777f('0x7f')]=_0x188bf1[_0x777f('0x7f')]||![];this['monitor_format']=monitorFormat[_0x188bf1['monitor_format']]?monitorFormat[_0x188bf1[_0x777f('0xb')]]:undefined;this['mandatoryDisposition']=_0x188bf1['mandatoryDisposition']||![];this[_0x777f('0x80')]=_0x188bf1[_0x777f('0x80')]?_0x188bf1[_0x777f('0x80')]:undefined;this[_0x777f('0x81')]=![];}module[_0x777f('0x82')]=VoiceQueue; \ No newline at end of file +var _0xae75=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','sumHoldTime','sumBillable','abandoned','busy','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x66f441,_0x4997cd){var _0xc5edd7=function(_0x5864a9){while(--_0x5864a9){_0x66f441['push'](_0x66f441['shift']());}};_0xc5edd7(++_0x4997cd);}(_0xae75,0xce));var _0x5ae7=function(_0x520b00,_0x302b5d){_0x520b00=_0x520b00-0x0;var _0x4b2cca=_0xae75[_0x520b00];return _0x4b2cca;};'use strict';var monitorFormat={'wav':_0x5ae7('0x0'),'wav49':_0x5ae7('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x5ae7('0x2'),'leastrecent':_0x5ae7('0x3'),'linear':_0x5ae7('0x4'),'random':_0x5ae7('0x5'),'ringall':_0x5ae7('0x6'),'rr':_0x5ae7('0x7'),'rrmemory':_0x5ae7('0x8'),'rrordered':_0x5ae7('0x9'),'wrandom':_0x5ae7('0xa')};function VoiceQueue(_0x33d211){this['id']=_0x33d211['id']||0x0;this[_0x5ae7('0xb')]=_0x33d211[_0x5ae7('0xb')]||'';this[_0x5ae7('0xc')]=_0x33d211[_0x5ae7('0xc')]||'';this[_0x5ae7('0xd')]=_0x33d211[_0x5ae7('0xd')]||'inbound';this[_0x5ae7('0xe')]=0x0;this[_0x5ae7('0xf')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x5ae7('0x10')]=0x0;this[_0x5ae7('0x11')]=0x0;this['unmanaged']=0x0;this[_0x5ae7('0x12')]=0x0;this['available']=0x0;this[_0x5ae7('0x13')]=0x0;this['inUse']=0x0;this[_0x5ae7('0x14')]=0x0;this[_0x5ae7('0x15')]=0x0;this[_0x5ae7('0x16')]=0x0;this[_0x5ae7('0x17')]=0x0;this[_0x5ae7('0x18')]=0x0;this[_0x5ae7('0x19')]=0x0;this['ringInUse']=0x0;this[_0x5ae7('0x1a')]=0x0;this[_0x5ae7('0x1b')]=0x0;this['unknown']=0x0;this[_0x5ae7('0x1c')]=_0x33d211[_0x5ae7('0x1c')]||![];this[_0x5ae7('0x1d')]=_0x33d211[_0x5ae7('0x1d')]||0xa;this[_0x5ae7('0x1e')]=_0x33d211[_0x5ae7('0x1e')]||'no';this[_0x5ae7('0x1f')]=!![];this[_0x5ae7('0x20')]='';this['statusMessage']='';this[_0x5ae7('0x21')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x33d211['dialTimezone']||null;this[_0x5ae7('0x22')]=_0x33d211['dialGlobalInterval']?_0x33d211['dialGlobalInterval']:null;this['dialActive']=_0x33d211['dialActive'];this[_0x5ae7('0x23')]=_0x33d211[_0x5ae7('0x23')]||_0x5ae7('0x24');this[_0x5ae7('0x25')]=_0x33d211['dialLimitChannel']||0x0;this[_0x5ae7('0x26')]=_0x33d211[_0x5ae7('0x26')]||0x0;this[_0x5ae7('0x27')]=_0x33d211[_0x5ae7('0x27')]||0x1;this[_0x5ae7('0x28')]=_0x33d211[_0x5ae7('0x28')]||_0x5ae7('0x29');this[_0x5ae7('0x2a')]=_0x33d211[_0x5ae7('0x2a')]||0.03;this[_0x5ae7('0x2b')]=_0x33d211[_0x5ae7('0x2b')]||0x258;this[_0x5ae7('0x2c')]=_0x33d211[_0x5ae7('0x2c')]||'anonymous';this[_0x5ae7('0x2d')]=_0x33d211[_0x5ae7('0x2d')]||_0x5ae7('0x2e');this[_0x5ae7('0x2f')]=_0x33d211[_0x5ae7('0x2f')]||0x1e;this['dialQueueOptions']=_0x33d211[_0x5ae7('0x30')]||_0x5ae7('0x31');this[_0x5ae7('0x32')]=_0x33d211[_0x5ae7('0x32')]||0x3;this[_0x5ae7('0x33')]=_0x33d211['dialQueueProject']||undefined;this[_0x5ae7('0x34')]=_0x33d211[_0x5ae7('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x33d211[_0x5ae7('0x35')]||0x96;this[_0x5ae7('0x36')]=_0x33d211[_0x5ae7('0x36')]||0x3;this[_0x5ae7('0x37')]=_0x33d211[_0x5ae7('0x37')]||0x96;this[_0x5ae7('0x38')]=_0x33d211[_0x5ae7('0x38')]||0x3;this[_0x5ae7('0x39')]=_0x33d211[_0x5ae7('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x33d211[_0x5ae7('0x3a')]||0x3;this[_0x5ae7('0x3b')]=_0x33d211[_0x5ae7('0x3b')]||0x96;this[_0x5ae7('0x3c')]=_0x33d211[_0x5ae7('0x3c')]||0x3;this[_0x5ae7('0x3d')]=_0x33d211[_0x5ae7('0x3d')]||0x96;this['dialAbandonedMaxRetry']=_0x33d211['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x33d211[_0x5ae7('0x3e')]||0x96;this[_0x5ae7('0x3f')]=_0x33d211[_0x5ae7('0x3f')]||0x3;this['dialMachineRetryFrequency']=_0x33d211[_0x5ae7('0x40')]||0x96;this['dialAgentRejectMaxRetry']=_0x33d211[_0x5ae7('0x41')]||0x3;this[_0x5ae7('0x42')]=_0x33d211[_0x5ae7('0x42')]||0x96;this[_0x5ae7('0x43')]=_0x33d211[_0x5ae7('0x43')]||0x3;this[_0x5ae7('0x44')]=_0x33d211[_0x5ae7('0x44')]||0x4;this['Trunk']=_0x33d211[_0x5ae7('0x45')]?_0x33d211['Trunk']:undefined;this['TrunkBackup']=_0x33d211['TrunkBackup']?_0x33d211[_0x5ae7('0x46')]:undefined;this[_0x5ae7('0x47')]=_0x33d211[_0x5ae7('0x47')]||undefined;this[_0x5ae7('0x48')]=_0x33d211['Interval']?_0x33d211[_0x5ae7('0x48')]:undefined;this[_0x5ae7('0x49')]=_0x33d211[_0x5ae7('0x49')]||_0x5ae7('0x4a');this[_0x5ae7('0x4b')]=_0x33d211[_0x5ae7('0x4b')]||undefined;this[_0x5ae7('0x4c')]=_0x33d211[_0x5ae7('0x4c')]||undefined;this[_0x5ae7('0x4d')]=strategy[_0x33d211[_0x5ae7('0x4d')]];this[_0x5ae7('0x4e')]=!![];this[_0x5ae7('0x4f')]=_0x33d211[_0x5ae7('0x4f')]||![];this[_0x5ae7('0x50')]=_0x33d211['dialAMDInitialSilence'];this[_0x5ae7('0x51')]=_0x33d211['dialAMDGreeting'];this[_0x5ae7('0x52')]=_0x33d211['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x33d211[_0x5ae7('0x53')];this[_0x5ae7('0x54')]=_0x33d211[_0x5ae7('0x54')];this[_0x5ae7('0x55')]=_0x33d211[_0x5ae7('0x55')];this['dialAMDMaximumNumberOfWords']=_0x33d211[_0x5ae7('0x56')];this[_0x5ae7('0x57')]=_0x33d211[_0x5ae7('0x57')];this[_0x5ae7('0x58')]=_0x33d211[_0x5ae7('0x58')];this[_0x5ae7('0x59')]=0x0;this[_0x5ae7('0x5a')]=0x0;this[_0x5ae7('0x5b')]=_0x33d211['timeout'];this[_0x5ae7('0x5c')]=0x0;this[_0x5ae7('0x5d')]=0x0;this[_0x5ae7('0x5e')]=0x0;this[_0x5ae7('0x5f')]=0x0;this[_0x5ae7('0x60')]=0x0;this[_0x5ae7('0x61')]=0x0;this[_0x5ae7('0x62')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x5ae7('0x63')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x5ae7('0x64')]=0x0;this[_0x5ae7('0x65')]=0x0;this[_0x5ae7('0x66')]=0x0;this[_0x5ae7('0x67')]=0x0;this[_0x5ae7('0x68')]=undefined;this[_0x5ae7('0x69')]=undefined;this[_0x5ae7('0x6a')]=undefined;this[_0x5ae7('0x6b')]=1.05;this[_0x5ae7('0x6c')]=0x0;this[_0x5ae7('0x6d')]=0x0;this[_0x5ae7('0x6e')]=0x0;this[_0x5ae7('0x6f')]=0x0;this[_0x5ae7('0x70')]=0x0;this[_0x5ae7('0x71')]=0x0;this[_0x5ae7('0x72')]=0x0;this[_0x5ae7('0x73')]=0x0;this[_0x5ae7('0x74')]=_0x33d211[_0x5ae7('0x75')]||0x14;this['predictiveIntervalMinThreshold']=_0x33d211['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x5ae7('0x76')]=0x0;this[_0x5ae7('0x77')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x5ae7('0x78')]=0x0;this[_0x5ae7('0x79')]=0x0;this['erlangBusyFactor']=0x0;this[_0x5ae7('0x7a')]=_0x33d211[_0x5ae7('0x7a')]||0x1e;this[_0x5ae7('0x7b')]=_0x33d211[_0x5ae7('0x7b')]||![];this['dialPreviewAutoRecallMe']=!!_0x33d211['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x33d211[_0x5ae7('0x7c')]||![];this[_0x5ae7('0x7d')]=_0x33d211[_0x5ae7('0x7d')]||undefined;this[_0x5ae7('0x7e')]=_0x33d211['dialAgiAfterHangupClient']||![];this[_0x5ae7('0x7f')]=_0x33d211[_0x5ae7('0x7f')]||![];this[_0x5ae7('0xc')]=monitorFormat[_0x33d211[_0x5ae7('0xc')]]?monitorFormat[_0x33d211[_0x5ae7('0xc')]]:undefined;this[_0x5ae7('0x80')]=_0x33d211[_0x5ae7('0x80')]||![];this[_0x5ae7('0x81')]=_0x33d211[_0x5ae7('0x81')]?_0x33d211[_0x5ae7('0x81')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x5ae7('0x82')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 2dbe3b7..f8945f9 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 _0xb0df=['outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','SIP/','online','incall','includes','status','booked','length','queue','dialer','exten','compareToOutboundQueue','some','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','available','answered','inUse','originated','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0x4ab956,_0x50b68c){var _0x1c1f57=function(_0x8e0899){while(--_0x8e0899){_0x4ab956['push'](_0x4ab956['shift']());}};_0x1c1f57(++_0x50b68c);}(_0xb0df,0x85));var _0xfb0d=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0xb0df[_0x65d12e];return _0x4274e0;};'use strict';var INBOUND_COUNTERS=['available',_0xfb0d('0x0'),_0xfb0d('0x1'),_0xfb0d('0x2'),_0xfb0d('0x3'),_0xfb0d('0x4'),_0xfb0d('0x5')];var OUTBOUND_COUNTERS=[_0xfb0d('0x6'),_0xfb0d('0x7'),_0xfb0d('0x8'),'loggedIn',_0xfb0d('0x1'),_0xfb0d('0x9'),'outboundAbandonedCallsDay','outboundAnswerCallsDay',_0xfb0d('0xa'),_0xfb0d('0xb'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0xfb0d('0xc'),_0xfb0d('0xd'),'outboundRejectCallsDay',_0xfb0d('0xe'),_0xfb0d('0x2'),_0xfb0d('0xf'),_0xfb0d('0x4'),_0xfb0d('0x10'),_0xfb0d('0x11'),'total',_0xfb0d('0x5')];function VoiceQueueSummary(_0x580405){this['id']=_0x580405['id'];this[_0xfb0d('0x12')]=_0x580405[_0xfb0d('0x12')];this[_0xfb0d('0x13')]=_0x580405[_0xfb0d('0x13')];this[_0xfb0d('0x14')]=_0x580405[_0xfb0d('0x14')]||0x0;this[_0xfb0d('0x7')]=_0x580405['answered']||0x0;this['available']=_0x580405['available']||0x0;this[_0xfb0d('0x15')]=_0x580405[_0xfb0d('0x15')]||0x0;this[_0xfb0d('0x8')]=_0x580405[_0xfb0d('0x8')]||0x0;this[_0xfb0d('0x16')]=_0x580405[_0xfb0d('0x16')]||0x0;this[_0xfb0d('0x0')]=_0x580405['loggedIn']||0x0;this[_0xfb0d('0x1')]=_0x580405[_0xfb0d('0x1')]||0x0;this[_0xfb0d('0x17')]=_0x580405[_0xfb0d('0x17')]||0x0;this['notInUse']=_0x580405[_0xfb0d('0x18')]||0x0;this[_0xfb0d('0x2')]=_0x580405[_0xfb0d('0x2')]||0x0;this[_0xfb0d('0x3')]=_0x580405[_0xfb0d('0x3')]||0x0;this[_0xfb0d('0x19')]=_0x580405[_0xfb0d('0x19')];this['sumBillable']=_0x580405[_0xfb0d('0x10')];this[_0xfb0d('0x11')]=_0x580405[_0xfb0d('0x11')];this[_0xfb0d('0x1a')]=_0x580405[_0xfb0d('0x1a')]||0x0;this[_0xfb0d('0x4')]=_0x580405[_0xfb0d('0x4')]||0x0;this[_0xfb0d('0x1b')]=_0x580405[_0xfb0d('0x1b')]||0x0;this[_0xfb0d('0x1c')]=_0x580405[_0xfb0d('0x1c')];this[_0xfb0d('0x1d')]=_0x580405['unavailable']||0x0;this[_0xfb0d('0x1e')]=_0x580405[_0xfb0d('0x1e')]||0x0;this['unmanaged']=_0x580405['unmanaged']||0x0;this[_0xfb0d('0x5')]=_0x580405[_0xfb0d('0x5')]||0x0;if(_0x580405['type']===_0xfb0d('0x1f')){this[_0xfb0d('0xf')]=_0x580405[_0xfb0d('0xf')]||0x0;this[_0xfb0d('0x20')]=_0x580405[_0xfb0d('0x20')];this[_0xfb0d('0x21')]=_0x580405[_0xfb0d('0x21')];this[_0xfb0d('0x22')]=_0x580405[_0xfb0d('0x22')];this[_0xfb0d('0x23')]=_0x580405[_0xfb0d('0x23')];this[_0xfb0d('0x24')]=_0x580405['dialOriginateTimeout'];this[_0xfb0d('0x25')]=_0x580405[_0xfb0d('0x25')];this['temp']=_0x580405[_0xfb0d('0x26')];this[_0xfb0d('0x27')]=_0x580405[_0xfb0d('0x27')];this[_0xfb0d('0x28')]=_0x580405['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x580405[_0xfb0d('0xa')];this['outboundBusyCallsDay']=_0x580405[_0xfb0d('0xb')];this['outboundCongestionCallsDay']=_0x580405[_0xfb0d('0x29')];this[_0xfb0d('0x2a')]=_0x580405[_0xfb0d('0x2a')];this[_0xfb0d('0x2b')]=_0x580405['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x580405[_0xfb0d('0x2c')];this[_0xfb0d('0x2d')]=_0x580405[_0xfb0d('0x2d')];this[_0xfb0d('0xc')]=_0x580405['outboundNoSuchCallsDay'];this[_0xfb0d('0x2e')]=_0x580405['outboundOriginateFailureCallsDay'];this[_0xfb0d('0xd')]=_0x580405['outboundReCallsDay'];this[_0xfb0d('0x2f')]=_0x580405[_0xfb0d('0x2f')];this[_0xfb0d('0xe')]=_0x580405[_0xfb0d('0xe')];this[_0xfb0d('0x30')]=_0x580405[_0xfb0d('0x30')];this['predictiveIntervalAvgHoldtime']=_0x580405[_0xfb0d('0x31')];this[_0xfb0d('0x32')]=_0x580405[_0xfb0d('0x32')];this[_0xfb0d('0x33')]=_0x580405[_0xfb0d('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x580405[_0xfb0d('0x34')];this[_0xfb0d('0x35')]=_0x580405[_0xfb0d('0x35')];this[_0xfb0d('0x36')]=_0x580405['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x580405['predictiveIntervalHitRate'];this[_0xfb0d('0x37')]=_0x580405[_0xfb0d('0x37')];this[_0xfb0d('0x38')]=_0x580405[_0xfb0d('0x38')];this[_0xfb0d('0x39')]=_0x580405[_0xfb0d('0x39')];this[_0xfb0d('0x3a')]=_0x580405['predictiveIntervalTotalCalls'];this[_0xfb0d('0x9')]=_0x580405[_0xfb0d('0x9')];this['erlangCalls']=_0x580405['erlangCalls'];this[_0xfb0d('0x3b')]=_0x580405[_0xfb0d('0x3b')];this[_0xfb0d('0x3c')]=_0x580405[_0xfb0d('0x3c')];this[_0xfb0d('0x3d')]=_0x580405['erlangBusyFactor'];this[_0xfb0d('0x3e')]=_0x580405[_0xfb0d('0x3e')];this[_0xfb0d('0x3f')]=_0x580405[_0xfb0d('0x3f')];this['message']=_0x580405[_0xfb0d('0x40')];this[_0xfb0d('0x41')]=_0x580405['statusMessage'];}if(_0x580405[_0xfb0d('0x42')]){this[_0xfb0d('0x42')]={'id':_0x580405[_0xfb0d('0x42')]['id'],'name':_0x580405[_0xfb0d('0x42')][_0xfb0d('0x12')],'active':_0x580405[_0xfb0d('0x42')]['active'],'callerid':_0x580405[_0xfb0d('0x42')][_0xfb0d('0x43')]};}}VoiceQueueSummary[_0xfb0d('0x44')]['createReport']=function(_0x22f73b,_0xe571c4,_0x51233a,_0x11e2ae){this['loggedInDb']=0x0;this[_0xfb0d('0x4')]=0x0;this[_0xfb0d('0x2')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0xfb0d('0x8')]=0x0;this['busy']=0x0;this[_0xfb0d('0x16')]=0x0;this[_0xfb0d('0x1d')]=0x0;this[_0xfb0d('0x3')]=0x0;this[_0xfb0d('0x19')]=0x0;this[_0xfb0d('0x17')]=0x0;if(_0x51233a){if(_0x51233a[_0xfb0d('0x6')]){this[_0xfb0d('0x6')]=Number(_0x51233a['available']);}if(_0x51233a[_0xfb0d('0x45')]){this[_0xfb0d('0x0')]=Number(_0x51233a[_0xfb0d('0x45')]);}if(_0x51233a[_0xfb0d('0x46')]){this[_0xfb0d('0x5')]=Number(_0x51233a['callers']);}}for(var _0x3fff94=0x0;_0x3fff94<_0x22f73b['length'];_0x3fff94++){var _0x91cc9e=_0xe571c4[_0xfb0d('0x47')+_0x22f73b[_0x3fff94][_0xfb0d('0x12')]];if(_0x91cc9e&&_0x91cc9e[_0xfb0d('0x48')]){this[_0xfb0d('0x1')]+=0x1;}if(_0x22f73b[_0x3fff94][_0xfb0d('0x49')]==='1'){this[_0xfb0d('0x4')]+=0x1;}if(_0x22f73b[_0x3fff94]['paused']==='1'&&!['2','7','8'][_0xfb0d('0x4a')](_0x22f73b[_0x3fff94][_0xfb0d('0x4b')])){this[_0xfb0d('0x2')]+=0x1;}switch(_0x22f73b[_0x3fff94][_0xfb0d('0x4b')]){case'0':this[_0xfb0d('0x1e')]+=0x1;break;case'1':this[_0xfb0d('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xfb0d('0x15')]+=0x1;break;case'4':this[_0xfb0d('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xfb0d('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xfb0d('0x21')]===_0xfb0d('0x4c')){var _0x3bb2dd=Object['keys'](_0x11e2ae);for(var _0x3d6893=0x0;_0x3d6893<_0x3bb2dd[_0xfb0d('0x4d')];_0x3d6893++){var _0x16c6ea=_0x3bb2dd[_0x3d6893];var _0xc6785d=_0x11e2ae[_0x16c6ea];if(_0xc6785d[_0xfb0d('0x4e')]===this[_0xfb0d('0x12')]&&_0xc6785d[_0xfb0d('0x1c')]===_0xfb0d('0x4f')&&_0xc6785d[_0xfb0d('0x50')]==='xcally-motion-preview'){this[_0xfb0d('0x4')]+=0x1;}}if(this['talking']>this[_0xfb0d('0x8')]){this['talking']=this[_0xfb0d('0x8')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xfb0d('0x44')]['compareToInboundQueue']=function(_0x16d3b7){var _0x42e06c=![];if(_0x16d3b7){_0x42e06c=INBOUND_COUNTERS['some'](function(_0x46c545){return this[_0x46c545]!==_0x16d3b7[_0x46c545];},this);}return _0x42e06c;};VoiceQueueSummary[_0xfb0d('0x44')][_0xfb0d('0x51')]=function(_0x1b8090){var _0x19a732=![];var _0x53ee4c=![];var _0x1cc7d6=![];if(_0x1b8090){_0x19a732=this['dialMethod']!==_0x1b8090[_0xfb0d('0x21')]||this[_0xfb0d('0x20')]!==_0x1b8090[_0xfb0d('0x20')]||this['message']!==_0x1b8090[_0xfb0d('0x40')]||this[_0xfb0d('0x41')]!==_0x1b8090[_0xfb0d('0x41')];_0x53ee4c=OUTBOUND_COUNTERS[_0xfb0d('0x52')](function(_0x527965){return this[_0x527965]!==_0x1b8090[_0x527965];},this);if(this[_0xfb0d('0x42')]&&_0x1b8090[_0xfb0d('0x42')]){_0x1cc7d6=this[_0xfb0d('0x42')][_0xfb0d('0x12')]!==_0x1b8090[_0xfb0d('0x42')][_0xfb0d('0x12')]||this[_0xfb0d('0x42')][_0xfb0d('0x53')]!==_0x1b8090['Trunk'][_0xfb0d('0x53')];}}return _0x19a732||_0x53ee4c||_0x1cc7d6;};VoiceQueueSummary[_0xfb0d('0x44')][_0xfb0d('0x54')]=function(_0x585848){this[_0xfb0d('0x7')]=_0x585848[_0xfb0d('0x7')];this[_0xfb0d('0x40')]=_0x585848[_0xfb0d('0x40')];this['statusMessage']=_0x585848[_0xfb0d('0x41')];this['originated']=_0x585848[_0xfb0d('0x9')];this['outboundAbandonedCallsDay']=_0x585848[_0xfb0d('0x55')];this[_0xfb0d('0x28')]=_0x585848['outboundAnswerCallsDay'];this[_0xfb0d('0xa')]=_0x585848[_0xfb0d('0xa')];this[_0xfb0d('0xb')]=_0x585848[_0xfb0d('0xb')];this[_0xfb0d('0x29')]=_0x585848[_0xfb0d('0x29')];this[_0xfb0d('0x2d')]=_0x585848['outboundNoAnswerCallsDay'];this[_0xfb0d('0xc')]=_0x585848[_0xfb0d('0xc')];this['outboundReCallsDay']=_0x585848['outboundReCallsDay'];this[_0xfb0d('0x2f')]=_0x585848[_0xfb0d('0x2f')];this[_0xfb0d('0xe')]=_0x585848[_0xfb0d('0xe')];this[_0xfb0d('0x10')]=_0x585848['sumBillable'];this[_0xfb0d('0x11')]=_0x585848['sumDuration'];this[_0xfb0d('0x1b')]=_0x585848[_0xfb0d('0x1b')];if(this[_0xfb0d('0x21')]==='preview'){this['pTalking']=_0x585848[_0xfb0d('0xf')];}};module[_0xfb0d('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0x4491=['booked','queue','dialer','exten','compareToInboundQueue','compareToOutboundQueue','some','updateReportFromOutboundQueue','available','loggedInDb','ringing','talking','waiting','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','paused','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','SIP/','online','incall','status'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x4491,0x1bb));var _0x1449=function(_0x4aed12,_0x5c946e){_0x4aed12=_0x4aed12-0x0;var _0x2fafdb=_0x4491[_0x4aed12];return _0x2fafdb;};'use strict';var INBOUND_COUNTERS=[_0x1449('0x0'),'loggedIn',_0x1449('0x1'),'paused',_0x1449('0x2'),_0x1449('0x3'),_0x1449('0x4')];var OUTBOUND_COUNTERS=[_0x1449('0x0'),_0x1449('0x5'),_0x1449('0x6'),'loggedIn',_0x1449('0x1'),'originated',_0x1449('0x7'),_0x1449('0x8'),_0x1449('0x9'),_0x1449('0xa'),_0x1449('0xb'),_0x1449('0xc'),'outboundNoSuchCallsDay',_0x1449('0xd'),_0x1449('0xe'),'outboundUnknownCallsDay',_0x1449('0xf'),_0x1449('0x10'),'talking',_0x1449('0x11'),_0x1449('0x12'),'total',_0x1449('0x4')];function VoiceQueueSummary(_0x47d4f0){this['id']=_0x47d4f0['id'];this['name']=_0x47d4f0[_0x1449('0x13')];this[_0x1449('0x14')]=_0x47d4f0[_0x1449('0x14')];this[_0x1449('0x15')]=_0x47d4f0[_0x1449('0x15')]||0x0;this[_0x1449('0x5')]=_0x47d4f0[_0x1449('0x5')]||0x0;this[_0x1449('0x0')]=_0x47d4f0[_0x1449('0x0')]||0x0;this[_0x1449('0x16')]=_0x47d4f0[_0x1449('0x16')]||0x0;this[_0x1449('0x6')]=_0x47d4f0[_0x1449('0x6')]||0x0;this[_0x1449('0x17')]=_0x47d4f0[_0x1449('0x17')]||0x0;this['loggedIn']=_0x47d4f0[_0x1449('0x18')]||0x0;this[_0x1449('0x1')]=_0x47d4f0['loggedInDb']||0x0;this[_0x1449('0x19')]=_0x47d4f0[_0x1449('0x19')]||0x0;this[_0x1449('0x1a')]=_0x47d4f0[_0x1449('0x1a')]||0x0;this[_0x1449('0xf')]=_0x47d4f0[_0x1449('0xf')]||0x0;this[_0x1449('0x2')]=_0x47d4f0[_0x1449('0x2')]||0x0;this[_0x1449('0x1b')]=_0x47d4f0[_0x1449('0x1b')];this[_0x1449('0x11')]=_0x47d4f0[_0x1449('0x11')];this[_0x1449('0x12')]=_0x47d4f0['sumDuration'];this[_0x1449('0x1c')]=_0x47d4f0['sumHoldTime']||0x0;this[_0x1449('0x3')]=_0x47d4f0[_0x1449('0x3')]||0x0;this[_0x1449('0x1d')]=_0x47d4f0[_0x1449('0x1d')]||0x0;this[_0x1449('0x1e')]=_0x47d4f0['type'];this['unavailable']=_0x47d4f0[_0x1449('0x1f')]||0x0;this[_0x1449('0x20')]=_0x47d4f0[_0x1449('0x20')]||0x0;this[_0x1449('0x21')]=_0x47d4f0['unmanaged']||0x0;this[_0x1449('0x4')]=_0x47d4f0['waiting']||0x0;if(_0x47d4f0[_0x1449('0x1e')]===_0x1449('0x22')){this['pTalking']=_0x47d4f0['pTalking']||0x0;this['dialActive']=_0x47d4f0[_0x1449('0x23')];this[_0x1449('0x24')]=_0x47d4f0[_0x1449('0x24')];this['dialOriginateCallerIdName']=_0x47d4f0[_0x1449('0x25')];this['dialOriginateCallerIdNumber']=_0x47d4f0[_0x1449('0x26')];this['dialOriginateTimeout']=_0x47d4f0['dialOriginateTimeout'];this[_0x1449('0x27')]=_0x47d4f0[_0x1449('0x27')];this['temp']=_0x47d4f0[_0x1449('0x28')];this['outboundAnswerAgiCallsDay']=_0x47d4f0[_0x1449('0x29')];this[_0x1449('0x8')]=_0x47d4f0['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x47d4f0[_0x1449('0x9')];this['outboundBusyCallsDay']=_0x47d4f0[_0x1449('0xa')];this[_0x1449('0xb')]=_0x47d4f0[_0x1449('0xb')];this[_0x1449('0x2a')]=_0x47d4f0[_0x1449('0x2a')];this[_0x1449('0x2b')]=_0x47d4f0[_0x1449('0x2b')];this[_0x1449('0x2c')]=_0x47d4f0[_0x1449('0x2c')];this[_0x1449('0xc')]=_0x47d4f0[_0x1449('0xc')];this[_0x1449('0x2d')]=_0x47d4f0[_0x1449('0x2d')];this[_0x1449('0x2e')]=_0x47d4f0[_0x1449('0x2e')];this[_0x1449('0xd')]=_0x47d4f0[_0x1449('0xd')];this['outboundRejectCallsDay']=_0x47d4f0[_0x1449('0xe')];this['outboundUnknownCallsDay']=_0x47d4f0[_0x1449('0x2f')];this[_0x1449('0x30')]=_0x47d4f0[_0x1449('0x30')];this[_0x1449('0x31')]=_0x47d4f0[_0x1449('0x31')];this[_0x1449('0x32')]=_0x47d4f0[_0x1449('0x32')];this[_0x1449('0x33')]=_0x47d4f0['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x47d4f0['predictiveIntervalDroppedCallsTimeout'];this[_0x1449('0x34')]=_0x47d4f0[_0x1449('0x34')];this[_0x1449('0x35')]=_0x47d4f0[_0x1449('0x35')];this[_0x1449('0x36')]=_0x47d4f0[_0x1449('0x36')];this[_0x1449('0x37')]=_0x47d4f0[_0x1449('0x37')];this['predictiveIntervalPauses']=_0x47d4f0[_0x1449('0x38')];this[_0x1449('0x39')]=_0x47d4f0[_0x1449('0x39')];this[_0x1449('0x3a')]=_0x47d4f0[_0x1449('0x3a')];this[_0x1449('0x3b')]=_0x47d4f0['originated'];this[_0x1449('0x3c')]=_0x47d4f0[_0x1449('0x3c')];this['erlangCallToSecond']=_0x47d4f0[_0x1449('0x3d')];this['erlangAbandonmentRate']=_0x47d4f0[_0x1449('0x3e')];this[_0x1449('0x3f')]=_0x47d4f0[_0x1449('0x3f')];this[_0x1449('0x40')]=_0x47d4f0['startPredictive'];this[_0x1449('0x41')]=_0x47d4f0[_0x1449('0x41')];this[_0x1449('0x42')]=_0x47d4f0[_0x1449('0x42')];this[_0x1449('0x43')]=_0x47d4f0[_0x1449('0x43')];}if(_0x47d4f0[_0x1449('0x44')]){this[_0x1449('0x44')]={'id':_0x47d4f0[_0x1449('0x44')]['id'],'name':_0x47d4f0[_0x1449('0x44')]['name'],'active':_0x47d4f0[_0x1449('0x44')][_0x1449('0x45')],'callerid':_0x47d4f0[_0x1449('0x44')][_0x1449('0x46')]};}}VoiceQueueSummary[_0x1449('0x47')][_0x1449('0x48')]=function(_0x599cf1,_0x267a25,_0x3bf512,_0x4f7752){this[_0x1449('0x1')]=0x0;this[_0x1449('0x3')]=0x0;this[_0x1449('0xf')]=0x0;this[_0x1449('0x20')]=0x0;this[_0x1449('0x1a')]=0x0;this[_0x1449('0x6')]=0x0;this[_0x1449('0x16')]=0x0;this[_0x1449('0x17')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x1449('0x19')]=0x0;if(_0x3bf512){if(_0x3bf512[_0x1449('0x0')]){this['available']=Number(_0x3bf512[_0x1449('0x0')]);}if(_0x3bf512[_0x1449('0x49')]){this[_0x1449('0x18')]=Number(_0x3bf512[_0x1449('0x49')]);}if(_0x3bf512[_0x1449('0x4a')]){this[_0x1449('0x4')]=Number(_0x3bf512[_0x1449('0x4a')]);}}for(var _0x4eeec0=0x0;_0x4eeec0<_0x599cf1['length'];_0x4eeec0++){var _0x35bb7a=_0x267a25[_0x1449('0x4b')+_0x599cf1[_0x4eeec0][_0x1449('0x13')]];if(_0x35bb7a&&_0x35bb7a[_0x1449('0x4c')]){this[_0x1449('0x1')]+=0x1;}if(_0x599cf1[_0x4eeec0][_0x1449('0x4d')]==='1'){this[_0x1449('0x3')]+=0x1;}if(_0x599cf1[_0x4eeec0]['paused']==='1'&&!['2','7','8']['includes'](_0x599cf1[_0x4eeec0]['status'])){this[_0x1449('0xf')]+=0x1;}switch(_0x599cf1[_0x4eeec0][_0x1449('0x4e')]){case'0':this[_0x1449('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x1449('0x17')]+=0x1;break;case'5':this[_0x1449('0x1f')]+=0x1;break;case'6':this[_0x1449('0x2')]+=0x1;break;case'7':this[_0x1449('0x1b')]+=0x1;break;case'8':this[_0x1449('0x19')]+=0x1;break;}}if(this[_0x1449('0x24')]===_0x1449('0x4f')){var _0x1cb9f4=Object['keys'](_0x4f7752);for(var _0x58b2ca=0x0;_0x58b2ca<_0x1cb9f4['length'];_0x58b2ca++){var _0x467243=_0x1cb9f4[_0x58b2ca];var _0x4656b4=_0x4f7752[_0x467243];if(_0x4656b4[_0x1449('0x50')]===this[_0x1449('0x13')]&&_0x4656b4['type']===_0x1449('0x51')&&_0x4656b4[_0x1449('0x52')]==='xcally-motion-preview'){this[_0x1449('0x3')]+=0x1;}}if(this[_0x1449('0x3')]>this[_0x1449('0x6')]){this[_0x1449('0x3')]=this[_0x1449('0x6')];}this[_0x1449('0x10')]=0x0;}return this;};VoiceQueueSummary[_0x1449('0x47')][_0x1449('0x53')]=function(_0x103d57){var _0x1dc18b=![];if(_0x103d57){_0x1dc18b=INBOUND_COUNTERS['some'](function(_0x941737){return this[_0x941737]!==_0x103d57[_0x941737];},this);}return _0x1dc18b;};VoiceQueueSummary['prototype'][_0x1449('0x54')]=function(_0x4ea3ba){var _0x1d14fe=![];var _0x222db9=![];var _0x3826b2=![];if(_0x4ea3ba){_0x1d14fe=this[_0x1449('0x24')]!==_0x4ea3ba[_0x1449('0x24')]||this['dialActive']!==_0x4ea3ba[_0x1449('0x23')]||this[_0x1449('0x42')]!==_0x4ea3ba['message']||this[_0x1449('0x43')]!==_0x4ea3ba[_0x1449('0x43')];_0x222db9=OUTBOUND_COUNTERS[_0x1449('0x55')](function(_0x1bc972){return this[_0x1bc972]!==_0x4ea3ba[_0x1bc972];},this);if(this['Trunk']&&_0x4ea3ba[_0x1449('0x44')]){_0x3826b2=this[_0x1449('0x44')][_0x1449('0x13')]!==_0x4ea3ba[_0x1449('0x44')][_0x1449('0x13')]||this['Trunk'][_0x1449('0x45')]!==_0x4ea3ba['Trunk'][_0x1449('0x45')];}}return _0x1d14fe||_0x222db9||_0x3826b2;};VoiceQueueSummary['prototype'][_0x1449('0x56')]=function(_0x44bfac){this[_0x1449('0x5')]=_0x44bfac[_0x1449('0x5')];this[_0x1449('0x42')]=_0x44bfac['message'];this[_0x1449('0x43')]=_0x44bfac[_0x1449('0x43')];this[_0x1449('0x3b')]=_0x44bfac[_0x1449('0x3b')];this['outboundAbandonedCallsDay']=_0x44bfac[_0x1449('0x7')];this[_0x1449('0x8')]=_0x44bfac[_0x1449('0x8')];this['outboundBlacklistCallsDay']=_0x44bfac[_0x1449('0x9')];this[_0x1449('0xa')]=_0x44bfac[_0x1449('0xa')];this['outboundCongestionCallsDay']=_0x44bfac['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x44bfac[_0x1449('0xc')];this[_0x1449('0x2d')]=_0x44bfac[_0x1449('0x2d')];this[_0x1449('0xd')]=_0x44bfac[_0x1449('0xd')];this['outboundRejectCallsDay']=_0x44bfac[_0x1449('0xe')];this[_0x1449('0x2f')]=_0x44bfac[_0x1449('0x2f')];this[_0x1449('0x11')]=_0x44bfac[_0x1449('0x11')];this['sumDuration']=_0x44bfac[_0x1449('0x12')];this[_0x1449('0x1d')]=_0x44bfac[_0x1449('0x1d')];if(this['dialMethod']==='preview'){this[_0x1449('0x10')]=_0x44bfac[_0x1449('0x10')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f1b6c60..f914b3a 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 _0xe89e=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xe89e,0x116));var _0xee89=function(_0x1c0138,_0x4603c5){_0x1c0138=_0x1c0138-0x0;var _0x55add3=_0xe89e[_0x1c0138];return _0x55add3;};'use strict';function VtigerAccount(_0x462715){this['id']=_0x462715['id']||0x0;this[_0xee89('0x0')]=_0x462715[_0xee89('0x0')]||'';this[_0xee89('0x1')]=_0x462715[_0xee89('0x1')]||'';this[_0xee89('0x2')]=_0x462715['accessKey']||'';this[_0xee89('0x3')]=_0x462715[_0xee89('0x3')]||'';this['serverUrl']=_0x462715[_0xee89('0x4')]||'';this[_0xee89('0x5')]=_0x462715[_0xee89('0x5')]||{};}module[_0xee89('0x6')]=VtigerAccount; \ No newline at end of file +var _0x15dc=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x267c2c,_0x2522fb){var _0xbc751e=function(_0x56d481){while(--_0x56d481){_0x267c2c['push'](_0x267c2c['shift']());}};_0xbc751e(++_0x2522fb);}(_0x15dc,0x91));var _0xc15d=function(_0x3e2852,_0x1acbe8){_0x3e2852=_0x3e2852-0x0;var _0x1822fa=_0x15dc[_0x3e2852];return _0x1822fa;};'use strict';function VtigerAccount(_0x139db6){this['id']=_0x139db6['id']||0x0;this[_0xc15d('0x0')]=_0x139db6[_0xc15d('0x0')]||'';this[_0xc15d('0x1')]=_0x139db6[_0xc15d('0x1')]||'';this[_0xc15d('0x2')]=_0x139db6[_0xc15d('0x2')]||'';this[_0xc15d('0x3')]=_0x139db6['remoteUri']||'';this[_0xc15d('0x4')]=_0x139db6[_0xc15d('0x4')]||'';this['Configurations']=_0x139db6[_0xc15d('0x5')]||{};}module[_0xc15d('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 2d1ae98..6f9b2d0 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 _0x78a6=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x78a6,0x1a6));var _0x678a=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x78a6[_0x4ea69d];return _0x5318e0;};'use strict';function ZendeskAccount(_0x4d7f2e){this['id']=_0x4d7f2e['id']||0x0;this[_0x678a('0x0')]=_0x4d7f2e[_0x678a('0x0')]||'';this['username']=_0x4d7f2e[_0x678a('0x1')]||'';this[_0x678a('0x2')]=_0x4d7f2e[_0x678a('0x2')]||'';this[_0x678a('0x3')]=_0x4d7f2e[_0x678a('0x3')]||'';this[_0x678a('0x4')]=_0x4d7f2e[_0x678a('0x4')]||'';this[_0x678a('0x5')]=_0x4d7f2e[_0x678a('0x5')]||'';this[_0x678a('0x6')]=_0x4d7f2e[_0x678a('0x6')]||_0x678a('0x7');this[_0x678a('0x8')]=_0x4d7f2e['serverUrl']||'';this[_0x678a('0x9')]=_0x4d7f2e[_0x678a('0x9')]||{};}module[_0x678a('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x9dee=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x124a1a,_0x33dae3){var _0x1d1b92=function(_0x351456){while(--_0x351456){_0x124a1a['push'](_0x124a1a['shift']());}};_0x1d1b92(++_0x33dae3);}(_0x9dee,0x92));var _0xe9de=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x9dee[_0x3048ea];return _0x1a13c4;};'use strict';function ZendeskAccount(_0xa5edad){this['id']=_0xa5edad['id']||0x0;this[_0xe9de('0x0')]=_0xa5edad['name']||'';this[_0xe9de('0x1')]=_0xa5edad['username']||'';this['password']=_0xa5edad[_0xe9de('0x2')]||'';this[_0xe9de('0x3')]=_0xa5edad[_0xe9de('0x3')]||'';this[_0xe9de('0x4')]=_0xa5edad['remoteUri']||'';this[_0xe9de('0x5')]=_0xa5edad['authType']||'';this['type']=_0xa5edad[_0xe9de('0x6')]||_0xe9de('0x7');this[_0xe9de('0x8')]=_0xa5edad[_0xe9de('0x8')]||'';this['Configurations']=_0xa5edad[_0xe9de('0x9')]||{};}module[_0xe9de('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 353f275..79ffd3a 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 _0x1723=['name','description','host','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x4d94e2,_0x3b3b7e){var _0x1d43a3=function(_0x472321){while(--_0x472321){_0x4d94e2['push'](_0x4d94e2['shift']());}};_0x1d43a3(++_0x3b3b7e);}(_0x1723,0xbd));var _0x3172=function(_0x43e5ae,_0x505bbf){_0x43e5ae=_0x43e5ae-0x0;var _0x1e5731=_0x1723[_0x43e5ae];return _0x1e5731;};'use strict';function ZohoAccount(_0x55028b){this['id']=_0x55028b['id']||0x0;this[_0x3172('0x0')]=_0x55028b['name']||'';this[_0x3172('0x1')]=_0x55028b['description']||'';this[_0x3172('0x2')]=_0x55028b[_0x3172('0x2')]||'';this['zone']=_0x55028b['zone']||'';this['clientId']=_0x55028b['clientId']||'';this[_0x3172('0x3')]=_0x55028b[_0x3172('0x3')]||'';this[_0x3172('0x4')]=_0x55028b[_0x3172('0x4')]||'';this['code']=_0x55028b[_0x3172('0x5')]||'';this['refreshToken']=_0x55028b[_0x3172('0x6')]||'';this[_0x3172('0x7')]=_0x55028b[_0x3172('0x7')]||{};}module[_0x3172('0x8')]=ZohoAccount; \ No newline at end of file +var _0x3f94=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f94,0x69));var _0x43f9=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x3f94[_0x55abd9];return _0x3e5669;};'use strict';function ZohoAccount(_0x5df260){this['id']=_0x5df260['id']||0x0;this[_0x43f9('0x0')]=_0x5df260[_0x43f9('0x0')]||'';this[_0x43f9('0x1')]=_0x5df260['description']||'';this[_0x43f9('0x2')]=_0x5df260[_0x43f9('0x2')]||'';this['zone']=_0x5df260['zone']||'';this[_0x43f9('0x3')]=_0x5df260[_0x43f9('0x3')]||'';this['clientSecret']=_0x5df260[_0x43f9('0x4')]||'';this[_0x43f9('0x5')]=_0x5df260[_0x43f9('0x5')]||'';this[_0x43f9('0x6')]=_0x5df260[_0x43f9('0x6')]||'';this[_0x43f9('0x7')]=_0x5df260[_0x43f9('0x7')]||'';this[_0x43f9('0x8')]=_0x5df260[_0x43f9('0x8')]||{};}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 6125335..658e918 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 _0x02ce=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','firstName','lastName','active','phone','scheduledat'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x02ce,0x1ac));var _0xe02c=function(_0x436277,_0x5df0e9){_0x436277=_0x436277-0x0;var _0x33de60=_0x02ce[_0x436277];return _0x33de60;};'use strict';var util=require(_0xe02c('0x0'));var _=require(_0xe02c('0x1'));var moment=require(_0xe02c('0x2'));function checkNameSurname(_0x5a49d9,_0x2d73b6,_0x53d2a3){var _0x2b3d58='';if(!_[_0xe02c('0x3')](_0x2d73b6)&&_0xe02c('0x4')===typeof _0x2d73b6){_0x2b3d58+=_0x2d73b6;}if(!_[_0xe02c('0x3')](_0x53d2a3)&&_0xe02c('0x4')===typeof _0x53d2a3){_0x2b3d58+='\x20'+_0x53d2a3;}if(_0x2b3d58!==''){return _0x2b3d58;}return _0x5a49d9;}function Action(_0x229653,_0x3f7436,_0x2b804f,_0x36a87f,_0x4fecb3){this['uniqueid']=_0x2b804f||undefined;this[_0xe02c('0x5')]=_0x229653['id'];this[_0xe02c('0x6')]=_0x3f7436[_0xe02c('0x7')];this[_0xe02c('0x8')]=_0x3f7436[_0xe02c('0x8')];this[_0xe02c('0x9')]=_0xe02c('0x6');this[_0xe02c('0xa')]=![];this[_0xe02c('0xb')]=_[_0xe02c('0x3')](_0x229653[_0xe02c('0xc')])?undefined:_0x229653[_0xe02c('0xc')][_0xe02c('0x7')];this[_0xe02c('0xd')]=this[_0xe02c('0xb')]?util[_0xe02c('0xe')](_0xe02c('0xf'),this[_0xe02c('0xb')]):_0x36a87f||undefined;this['calleridname']=checkNameSurname(_0x229653[_0xe02c('0x10')]['phone'],_0x229653['Contact'][_0xe02c('0x11')],_0x229653['Contact'][_0xe02c('0x12')]);this['active']=_0x229653[_0xe02c('0x13')]||![];this['calleridnum']=_0x229653[_0xe02c('0x14')];this[_0xe02c('0x15')]=_0x229653['scheduledat'];this[_0xe02c('0x16')]=_0x229653[_0xe02c('0x16')]||0x0;this['countcongestionretry']=_0x229653[_0xe02c('0x17')]||0x0;this[_0xe02c('0x18')]=_0x229653['countnoanswerretry']||0x0;this['countglobal']=(_0x229653[_0xe02c('0x16')]||0x0)+(_0x229653['countcongestionretry']||0x0)+(_0x229653[_0xe02c('0x18')]||0x0)+(_0x229653[_0xe02c('0x19')]||0x0)+(_0x229653[_0xe02c('0x1a')]||0x0)+(_0x229653[_0xe02c('0x1b')]||0x0)+(_0x229653[_0xe02c('0x1c')]||0x0)+(_0x229653['countagentrejectretry']||0x0);this[_0xe02c('0x19')]=_0x229653['countnosuchnumberretry']||0x0;this['countdropretry']=_0x229653[_0xe02c('0x1a')]||0x0;this[_0xe02c('0x1b')]=_0x229653['countabandonedretry']||0x0;this[_0xe02c('0x1c')]=_0x229653[_0xe02c('0x1c')]||0x0;this['countagentrejectretry']=_0x229653[_0xe02c('0x1d')]||0x0;this[_0xe02c('0x1e')]=_0x229653[_0xe02c('0x1e')];this[_0xe02c('0x1f')]=_0x229653[_0xe02c('0x1f')];this[_0xe02c('0x20')]=_0x229653[_0xe02c('0x20')];this[_0xe02c('0x21')]=_0x229653[_0xe02c('0x21')];this[_0xe02c('0x22')]=_0x229653[_0xe02c('0x22')];this['ListId']=_0x229653[_0xe02c('0x23')];this[_0xe02c('0x24')]=_[_0xe02c('0x3')](_0x229653[_0xe02c('0xc')])?_0x229653[_0xe02c('0x24')]:_0x229653[_0xe02c('0xc')]['id'];this[_0xe02c('0x25')]=_0x229653[_0xe02c('0x25')];this['originatecalleridnum']='';this[_0xe02c('0x26')]='';}Action[_0xe02c('0x27')][_0xe02c('0x28')]=function(){return util['format'](_0xe02c('0x29'),this[_0xe02c('0x2a')],this[_0xe02c('0x2b')]);};module[_0xe02c('0x2c')]=Action; \ No newline at end of file +var _0xfcbb=['name','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x3d8238,_0x27dd94){_0x3d8238=_0x3d8238-0x0;var _0x5651be=_0xfcbb[_0x3d8238];return _0x5651be;};'use strict';var util=require(_0xbfcb('0x0'));var _=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));function checkNameSurname(_0x5a1002,_0x5747a4,_0x462349){var _0x280329='';if(!_[_0xbfcb('0x3')](_0x5747a4)&&_0xbfcb('0x4')===typeof _0x5747a4){_0x280329+=_0x5747a4;}if(!_[_0xbfcb('0x3')](_0x462349)&&'string'===typeof _0x462349){_0x280329+='\x20'+_0x462349;}if(_0x280329!==''){return _0x280329;}return _0x5a1002;}function Action(_0x5201d3,_0x32c2aa,_0x4990c,_0x8d4e6a,_0x2df839){this[_0xbfcb('0x5')]=_0x4990c||undefined;this[_0xbfcb('0x6')]=_0x5201d3['id'];this[_0xbfcb('0x7')]=_0x32c2aa['name'];this[_0xbfcb('0x8')]=_0x32c2aa[_0xbfcb('0x8')];this[_0xbfcb('0x9')]='queue';this[_0xbfcb('0xa')]=![];this[_0xbfcb('0xb')]=_[_0xbfcb('0x3')](_0x5201d3[_0xbfcb('0xc')])?undefined:_0x5201d3[_0xbfcb('0xc')][_0xbfcb('0xd')];this['channelAgent']=this[_0xbfcb('0xb')]?util[_0xbfcb('0xe')](_0xbfcb('0xf'),this[_0xbfcb('0xb')]):_0x8d4e6a||undefined;this['calleridname']=checkNameSurname(_0x5201d3[_0xbfcb('0x10')]['phone'],_0x5201d3[_0xbfcb('0x10')][_0xbfcb('0x11')],_0x5201d3[_0xbfcb('0x10')][_0xbfcb('0x12')]);this[_0xbfcb('0x13')]=_0x5201d3[_0xbfcb('0x13')]||![];this[_0xbfcb('0x14')]=_0x5201d3[_0xbfcb('0x15')];this[_0xbfcb('0x16')]=_0x5201d3[_0xbfcb('0x16')];this[_0xbfcb('0x17')]=_0x5201d3[_0xbfcb('0x17')]||0x0;this[_0xbfcb('0x18')]=_0x5201d3[_0xbfcb('0x18')]||0x0;this[_0xbfcb('0x19')]=_0x5201d3[_0xbfcb('0x19')]||0x0;this[_0xbfcb('0x1a')]=(_0x5201d3[_0xbfcb('0x17')]||0x0)+(_0x5201d3[_0xbfcb('0x18')]||0x0)+(_0x5201d3[_0xbfcb('0x19')]||0x0)+(_0x5201d3[_0xbfcb('0x1b')]||0x0)+(_0x5201d3[_0xbfcb('0x1c')]||0x0)+(_0x5201d3['countabandonedretry']||0x0)+(_0x5201d3[_0xbfcb('0x1d')]||0x0)+(_0x5201d3[_0xbfcb('0x1e')]||0x0);this['countnosuchnumberretry']=_0x5201d3[_0xbfcb('0x1b')]||0x0;this[_0xbfcb('0x1c')]=_0x5201d3['countdropretry']||0x0;this['countabandonedretry']=_0x5201d3[_0xbfcb('0x1f')]||0x0;this[_0xbfcb('0x1d')]=_0x5201d3[_0xbfcb('0x1d')]||0x0;this[_0xbfcb('0x1e')]=_0x5201d3[_0xbfcb('0x1e')]||0x0;this['callback']=_0x5201d3[_0xbfcb('0x20')];this[_0xbfcb('0x21')]=_0x5201d3[_0xbfcb('0x21')];this[_0xbfcb('0x22')]=_0x5201d3[_0xbfcb('0x22')];this[_0xbfcb('0x23')]=_0x5201d3[_0xbfcb('0x23')];this[_0xbfcb('0x24')]=_0x5201d3[_0xbfcb('0x24')];this[_0xbfcb('0x25')]=_0x5201d3[_0xbfcb('0x25')];this[_0xbfcb('0x26')]=_[_0xbfcb('0x3')](_0x5201d3[_0xbfcb('0xc')])?_0x5201d3[_0xbfcb('0x26')]:_0x5201d3[_0xbfcb('0xc')]['id'];this['VoiceQueueId']=_0x5201d3[_0xbfcb('0x27')];this[_0xbfcb('0x28')]='';this['originatecalleridname']='';}Action[_0xbfcb('0x29')][_0xbfcb('0x2a')]=function(){return util[_0xbfcb('0xe')](_0xbfcb('0x2b'),this[_0xbfcb('0x2c')],this[_0xbfcb('0x2d')]);};module[_0xbfcb('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 48d512b..0b11cc0 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 _0x9a18=['finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','logger','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','preview','dialMethod','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','decrementOriginate','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','starttime','format','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','totalGlobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','createAgentHistory','logAgent','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][getContactPreview]','Call\x20unsuccessful','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridNumber','assign','merge','toLowerVariables','variables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','unlockContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail'];(function(_0x283ca5,_0x259097){var _0x2f3270=function(_0x46711d){while(--_0x46711d){_0x283ca5['push'](_0x283ca5['shift']());}};_0x2f3270(++_0x259097);}(_0x9a18,0x13a));var _0x89a1=function(_0x1c18ca,_0x3da48c){_0x1c18ca=_0x1c18ca-0x0;var _0xbff7c4=_0x9a18[_0x1c18ca];return _0xbff7c4;};'use strict';var util=require(_0x89a1('0x0'));var _=require(_0x89a1('0x1'));var uuid=require(_0x89a1('0x2'));var moment=require(_0x89a1('0x3'));var Redis=require(_0x89a1('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x89a1('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x89a1('0x6'));var ut=require(_0x89a1('0x7'));var utils=require('../dialer/utils');config[_0x89a1('0x8')]=_['defaults'](config[_0x89a1('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x89a1('0x9'))(new Redis(config[_0x89a1('0x8')]));var Sequence=function(){};Sequence[_0x89a1('0xa')][_0x89a1('0xb')]=function(_0x23430c){this[_0x89a1('0xc')]=this[_0x89a1('0xc')]?this['tail'][_0x89a1('0xd')](_0x23430c):_0x23430c();};function Preview(_0x479afe){this[_0x89a1('0xe')]=new Sequence();this[_0x89a1('0xf')]=_0x479afe[_0x89a1('0x10')];this[_0x89a1('0x11')]=_0x479afe[_0x89a1('0x11')];this[_0x89a1('0x12')]={};this[_0x89a1('0x13')]=_0x479afe['agents'];this[_0x89a1('0x14')]=0x0;ami['on']('originateresponse',this[_0x89a1('0x15')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x17'),this[_0x89a1('0x18')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x19'),this[_0x89a1('0x1a')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x1b'),this[_0x89a1('0x1c')]['bind'](this));ami['on'](_0x89a1('0x1d'),this[_0x89a1('0x1e')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x1f'),this[_0x89a1('0x20')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x21'),this[_0x89a1('0x22')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x23'),this['syncBlindTransfer']['bind'](this));this[_0x89a1('0x24')](this[_0x89a1('0xf')]);}function emit(_0x1ce4a8,_0x47cf3d,_0x6b8b53){io['to'](_0x1ce4a8)['emit'](_0x47cf3d,_0x6b8b53);}function emitVoiceQueueChannelRemove(_0x4f677a){logger[_0x89a1('0x25')](_0x89a1('0x26'),JSON[_0x89a1('0x27')](_0x4f677a));emit(util['format'](_0x89a1('0x28'),_0x4f677a[_0x89a1('0x29')]),_0x89a1('0x2a'),_0x4f677a);io[_0x89a1('0x2b')](_0x89a1('0x2c'),_0x4f677a);}function notSendMessagesQueue(_0x703ac7){if(_0x703ac7[_0x89a1('0x2d')]){if(_0x703ac7[_0x89a1('0x2e')]===0x0&&_0x703ac7[_0x89a1('0x2f')]===0x0){_0x703ac7[_0x89a1('0x2d')]=![];_0x703ac7[_0x89a1('0x30')]=0x0;_0x703ac7[_0x89a1('0x31')]=0x0;_0x703ac7[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x34')];ut['logger'](_0x89a1('0x35'),_0x703ac7[_0x89a1('0x29')]+_0x89a1('0x36'));}else{_0x703ac7[_0x89a1('0x32')]=utils[_0x89a1('0x33')]['DEACTIVATED'];ut[_0x89a1('0x37')](_0x89a1('0x35'),_0x703ac7[_0x89a1('0x29')]+_0x89a1('0x38'));}}}Preview['prototype']['loopCampaigns']=function(){var _0x393647=this;setInterval(function(){_0x393647[_0x89a1('0x39')]();},0x7cf);};Preview[_0x89a1('0xa')][_0x89a1('0x39')]=function(){var _0x5535da=this[_0x89a1('0xf')];this[_0x89a1('0x14')]+=0x1;for(var _0x2dc141 in _0x5535da){if(_0x5535da[_0x89a1('0x3a')](_0x2dc141)&&(_0x5535da[_0x2dc141]['dialMethod']===_0x89a1('0x3b')||_0x5535da[_0x2dc141][_0x89a1('0x3c')]==='booked')&&_0x5535da[_0x2dc141][_0x89a1('0x3d')]===_0x89a1('0x3e')){if(this[_0x89a1('0x14')]>0x7){this[_0x89a1('0x14')]=0x0;this[_0x89a1('0x3f')]();}}if(_0x5535da[_0x89a1('0x3a')](_0x2dc141)&&_0x5535da[_0x2dc141][_0x89a1('0x3c')]===_0x89a1('0x3b')&&_0x5535da[_0x2dc141][_0x89a1('0x3d')]===_0x89a1('0x3e')){if(_0x5535da[_0x2dc141][_0x89a1('0x40')]){this[_0x89a1('0x41')](_0x5535da[_0x2dc141]);if(_0x5535da[_0x2dc141][_0x89a1('0x42')])this[_0x89a1('0x43')](_0x5535da[_0x2dc141]);}else{notSendMessagesQueue(_0x5535da[_0x2dc141]);}}}};Preview['prototype'][_0x89a1('0x44')]=function(_0xc6e77a){var _0x5401f1=this;this['sequence'][_0x89a1('0xb')](function(){if(!_[_0x89a1('0x45')](_0x5401f1[_0x89a1('0x12')][_0xc6e77a])){loggerAction[_0x89a1('0x25')](_0x89a1('0x46'),_0xc6e77a,_0x89a1('0x47'),_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')],_0x89a1('0x49'),JSON['stringify'](_0x5401f1[_0x89a1('0xf')][_0x5401f1['actions'][_0xc6e77a][_0x89a1('0x48')]][_0x89a1('0x2e')]),_0x89a1('0x4a'),JSON[_0x89a1('0x27')](_0x5401f1['campaignsPreview'][_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')]][_0x89a1('0x2f')]),JSON[_0x89a1('0x27')](_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x4b')]),JSON['stringify'](_['pick'](_0x5401f1[_0x89a1('0x12')][_0xc6e77a],['contactId',_0x89a1('0x4c'),_0x89a1('0x4d'),_0x89a1('0x4e')])));return ami[_0x89a1('0x4f')]({'action':'status','channel':_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x50')]})['catch'](function(_0x336175){if(_0x336175[_0x89a1('0x32')]===_0x89a1('0x51')){setTimeout(function(){if(_0x5401f1['actions'][_0xc6e77a]){utils[_0x89a1('0x52')](_0x5401f1[_0x89a1('0xf')][_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')]],'[clearZombieChannel]');if(_0x5401f1[_0x89a1('0x12')][_0xc6e77a]['dialAnswer']===!![]){ut[_0x89a1('0x53')](_0x5401f1[_0x89a1('0xf')][_0x5401f1[_0x89a1('0x12')][_0xc6e77a]['queue']],'[clearZombieChannel]');ut[_0x89a1('0x54')](_0x89a1('0x55')+_0xc6e77a,_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')]);}ut['loggerError'](_0x89a1('0x56')+_0xc6e77a,_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')]);delete _0x5401f1[_0x89a1('0x12')][_0xc6e77a];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x3233c7=this;loggerAction['info'](_0x89a1('0x57'),_[_0x89a1('0x58')](this[_0x89a1('0x12')]));for(var _0x157cb5 in this[_0x89a1('0x12')]){if(_0x3233c7[_0x89a1('0x12')][_0x89a1('0x3a')](_0x157cb5)){_0x3233c7[_0x89a1('0x44')](_0x157cb5);}}};Preview[_0x89a1('0xa')][_0x89a1('0x43')]=function(_0x502d1f){var _0x354cfc=this;rpcDb[_0x89a1('0x59')](_0x502d1f['id'],ut[_0x89a1('0x5a')](this[_0x89a1('0x13')]))[_0x89a1('0x5b')](function(_0x2c7cc1){if(!_[_0x89a1('0x45')](_0x2c7cc1)){for(var _0xfa453f=0x0;_0xfa453f<_0x2c7cc1[_0x89a1('0x5c')];_0xfa453f+=0x1){if(ut[_0x89a1('0x5d')](_0x2c7cc1[_0xfa453f]['scheduledat'])<_0x502d1f[_0x89a1('0x5e')]*0x3c){if(_0x2c7cc1[_0xfa453f]['Agent']&&!_0x2c7cc1[_0xfa453f][_0x89a1('0x5f')]['voicePause']){_0x354cfc[_0x89a1('0x60')](_0x2c7cc1[_0xfa453f]['id'])[_0x89a1('0x5b')](ut[_0x89a1('0x61')](_0x89a1('0x62')))[_0x89a1('0x63')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x89a1('0x64')](_0x2c7cc1[_0xfa453f]['id']);}}else{var _0x41d0eb=new Action(_0x2c7cc1[_0xfa453f],_0x502d1f);_0x41d0eb[_0x89a1('0x65')]=moment()[_0x89a1('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x502d1f[_0x89a1('0x67')]+=0x1;ut[_0x89a1('0x68')](_0x41d0eb,0x17,_0x89a1('0x69'));if(_0x502d1f[_0x89a1('0x6a')]){rpcDb['rescheduleContactInQueue'](ut[_0x89a1('0x6b')](_0x2c7cc1[_0xfa453f]));rpcDb['createCustomerHistory'](_0x41d0eb,_0x89a1('0x6c'));}else{ut['logCustomer'](_0x41d0eb,0x16,_0x89a1('0x6d'));rpcDb[_0x89a1('0x6e')](_0x41d0eb,_0x89a1('0x6f'));rpcDb[_0x89a1('0x70')](_0x41d0eb,'[HistoryRecallClose]');}}}}})[_0x89a1('0x63')](ut[_0x89a1('0x61')]('[getContactRecallMe]'));};Preview['prototype'][_0x89a1('0x41')]=function(_0x44c29a){_0x44c29a[_0x89a1('0x2d')]=!![];if(ut['IsNotLoggedIn'](_0x44c29a[_0x89a1('0x71')])){_0x44c29a[_0x89a1('0x32')]=utils['CAMPAIGN_STATUS'][_0x89a1('0x72')];}else if(!ut[_0x89a1('0x73')](_0x44c29a[_0x89a1('0x40')])){_0x44c29a[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x34')];}else if(!this['isTrunkReachable'](_0x44c29a[_0x89a1('0x74')])){if(!this[_0x89a1('0x75')](_0x44c29a['TrunkBackup'])){_0x44c29a['message']=utils[_0x89a1('0x33')][_0x89a1('0x76')];}else{_0x44c29a[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x77')];}}else{_0x44c29a[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x77')];}};Preview[_0x89a1('0xa')][_0x89a1('0x78')]=function(_0x1da1c5,_0xb5d5a2,_0xeaa5cf){var _0xa00f50=this;var _0x1392ab=this['actions'][_0xb5d5a2];var _0x20cf2c=this[_0x89a1('0xf')][_0x1392ab[_0x89a1('0x48')]];var _0x150bb4;var _0x100d92=![];var _0x71f8d7=0x2;var _0x10053f=0x3;if(_0x20cf2c){switch(_0xeaa5cf){case'1':_0x20cf2c[_0x89a1('0x79')]+=0x1;_0x1392ab[_0x89a1('0x7a')]+=0x1;_0x1392ab['countglobal']=ut['totalGlobal'](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x0,_0x89a1('0x7b'));ami[_0x89a1('0x2b')](_0x89a1('0x7c'),ut['buildObj'](_0x1392ab,'nosuchnumber'));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0x7d'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'0',_0x20cf2c)[_0x89a1('0x5b')](function(_0x36deb8){_0x100d92=_0x36deb8[_0x89a1('0x7f')]==0x1;_0x71f8d7=_0x20cf2c[_0x89a1('0x80')];_0x10053f=_0x20cf2c['callAdditionalPhoneAfterMin'];if(!_0x100d92){if(ut['totalGlobal'](_0x1392ab)>=_0x20cf2c['dialGlobalMaxRetry']){_0x150bb4=ut['cloneAction'](_0x1392ab,0xf,_0x89a1('0x81'));rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0x82'));}else{if(_0x1392ab[_0x89a1('0x7a')]>=_0x20cf2c[_0x89a1('0x83')]){rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0x82'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0x7a'),_0x20cf2c[_0x89a1('0x80')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}delete this[_0x89a1('0x12')][_0x1da1c5[_0x89a1('0x88')]];}else{_0x1392ab[_0x89a1('0x7a')]++;logger['info'](_0x89a1('0x89'),_0x1392ab['countnosuchnumberretry']);logger[_0x89a1('0x25')]('id',_0x1392ab[_0x89a1('0x8a')]);_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countnosuchnumberretry':_0x1392ab[_0x89a1('0x7a')]}})['then'](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});break;case _0x89a1('0x8d'):var _0x1cf5ad=moment()[_0x89a1('0x66')](_0x89a1('0x8e'));_0x1392ab[_0x89a1('0x8f')]=_0x1cf5ad;_0x1392ab[_0x89a1('0x90')]=_0x1cf5ad;_0x1392ab['dialAnswer']=!![];_0x20cf2c[_0x89a1('0x2f')]+=0x1;logger[_0x89a1('0x25')](_0x89a1('0x91'),_0x1392ab[_0x89a1('0x92')],_0x89a1('0x93'),_0x20cf2c[_0x89a1('0x29')],_0x89a1('0x4a'),_0x20cf2c[_0x89a1('0x2f')]);ami[_0x89a1('0x2b')](_0x89a1('0x94'),ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0x96'),this['campaignsPreview'][_0x1392ab[_0x89a1('0x48')]]));if(_0x20cf2c['acw']||_0x20cf2c[_0x89a1('0x97')]){ami[_0x89a1('0x2b')](_0x89a1('0x98'),{'queue':_0x1392ab[_0x89a1('0x48')],'interface':_0x1392ab[_0x89a1('0x99')],'uniqueid':_0x1392ab['uniqueid']});}break;case'16':ami[_0x89a1('0x2b')](_0x89a1('0x9a'),ut['buildObj'](_0x1392ab,_0x89a1('0x9b'),this['campaignsPreview'][_0x1392ab[_0x89a1('0x48')]]));emitVoiceQueueChannelRemove(ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0x9b')));_0x20cf2c[_0x89a1('0x9c')]+=0x1;_0x20cf2c[_0x89a1('0x9d')]+=0x1;_0x20cf2c['answered']+=0x1;ut[_0x89a1('0x53')](_0x20cf2c,_0x89a1('0x9e'));_0x1392ab['countglobal']=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x4,_0x89a1('0xa0'));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xa1'));rpcDb[_0x89a1('0x70')](_0x1392ab,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x89a1('0xa2')](_0x1392ab);_0x20cf2c[_0x89a1('0xa3')]+=_0x1392ab[_0x89a1('0xa4')];_0x20cf2c[_0x89a1('0xa5')]+=_0x1392ab[_0x89a1('0xa4')];logger[_0x89a1('0x25')](_0x89a1('0xa6'),_0x1392ab['uniqueid'],'\x20Queue',_0x20cf2c['name'],_0x89a1('0x4a'),_0x20cf2c[_0x89a1('0x2f')]);delete this[_0x89a1('0x12')][_0x1da1c5[_0x89a1('0x88')]];break;case _0x89a1('0xa7'):_0x20cf2c[_0x89a1('0xa8')]+=0x1;_0x1392ab[_0x89a1('0xa9')]+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x5,_0x89a1('0xab'));_0x71f8d7=_0x20cf2c[_0x89a1('0xac')];_0x10053f=_0x20cf2c[_0x89a1('0xad')];ami['emit'](_0x89a1('0xae'),ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0xaf')));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xb0'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'5',_0x20cf2c)[_0x89a1('0x5b')](function(_0x9b45d2){_0x100d92=_0x9b45d2[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0xf,'Global');rpcDb['createCustomerFinal'](_0x150bb4,_0x89a1('0xb3'));}else{if(_0x1392ab[_0x89a1('0xa9')]>=_0x20cf2c[_0x89a1('0xb4')]){rpcDb['createCustomerFinal'](_0x1392ab,_0x89a1('0xb0'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0xa9'),_0x20cf2c[_0x89a1('0xac')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab['countbusyretry']++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countbusyretry':_0x1392ab[_0x89a1('0xa9')]}})[_0x89a1('0x5b')](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});break;case _0x89a1('0xb5'):_0x20cf2c[_0x89a1('0xb6')]+=0x1;_0x1392ab['countnoanswerretry']+=0x1;_0x1392ab['countglobal']=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x3,_0x89a1('0xb7'));_0x71f8d7=_0x20cf2c['dialNoAnswerRetryFrequency'];_0x10053f=_0x20cf2c[_0x89a1('0xad')];var _0x3d9f59=ut['buildNoAnswerEventPayload'](_0x1392ab,_0x20cf2c);ami[_0x89a1('0x2b')](_0x89a1('0xb8'),_0x3d9f59);rpcDb[_0x89a1('0x6e')](_0x1392ab,'[callProgressDetectingCustomer][logNoAnswer]');_0xa00f50['verifyAdditionalPhones'](_0x1392ab,'3',_0x20cf2c)['then'](function(_0x20bc5d){_0x100d92=_0x20bc5d['additional']==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0xf,_0x89a1('0x81'));rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0xb9'));}else{if(_0x1392ab[_0x89a1('0xba')]>=_0x20cf2c['dialNoAnswerMaxRetry']){rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0xbb'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1392ab,_0x89a1('0xba'),_0x20cf2c[_0x89a1('0xbc')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab[_0x89a1('0xba')]++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})['then'](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});break;case'CONGESTION':_0x20cf2c[_0x89a1('0xbd')]+=0x1;_0x1392ab['countcongestionretry']+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut['logCustomer'](_0x1392ab,0x8,_0x89a1('0xbe'));_0x71f8d7=_0x20cf2c['dialCongestionRetryFrequency'];_0x10053f=_0x20cf2c['callAdditionalPhoneAfterMin'];ami[_0x89a1('0x2b')](_0x89a1('0xbf'),ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0xc0')));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xc1'));_0xa00f50['verifyAdditionalPhones'](_0x1392ab,'8',_0x20cf2c)[_0x89a1('0x5b')](function(_0x1b06eb){_0x100d92=_0x1b06eb[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut['cloneAction'](_0x1392ab,0xf,'Global');rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0xc2'));}else{if(_0x1392ab['countcongestionretry']>=_0x20cf2c[_0x89a1('0xc3')]){rpcDb['createCustomerFinal'](_0x1392ab,_0x89a1('0xc1'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0xc4'),_0x20cf2c[_0x89a1('0xac')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab[_0x89a1('0xc4')]++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countcongestionretry':_0x1392ab[_0x89a1('0xc4')]}})['then'](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)['then'](function(){});});}});break;case _0x89a1('0xc5'):_0x20cf2c[_0x89a1('0xc6')]+=0x1;_0x1392ab[_0x89a1('0xc7')]+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x14,_0x89a1('0xc8'));_0x71f8d7=_0x20cf2c[_0x89a1('0xc9')];_0x10053f=_0x20cf2c[_0x89a1('0xad')];ami[_0x89a1('0x2b')](_0x89a1('0xca'),ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0xcb')));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xcc'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'20',_0x20cf2c)[_0x89a1('0x5b')](function(_0xeb8345){_0x100d92=_0xeb8345[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut['totalGlobal'](_0x1392ab)>=_0x20cf2c['dialGlobalMaxRetry']){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0x14,_0x89a1('0xc8'));rpcDb['createCustomerFinal'](_0x150bb4,_0x89a1('0xcd'));}else{if(_0x1392ab[_0x89a1('0xc7')]>=_0x20cf2c[_0x89a1('0xce')]){rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0xcd'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0xc7'),_0x20cf2c[_0x89a1('0xc9')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab[_0x89a1('0xba')]++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab['idContact'],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})[_0x89a1('0x5b')](function(){_0xa00f50['swapAdditionalPhones'](_0x1392ab,_0x71f8d7,_0x10053f)['then'](function(){});});}});break;case _0x89a1('0xcf'):_0x20cf2c[_0x89a1('0xd0')]+=0x1;_0x1392ab[_0x89a1('0xd1')]+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0xb,_0x89a1('0xd2'));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xd3'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'11',_0x20cf2c)[_0x89a1('0x5b')](function(_0x2d37d3){_0x100d92=_0x2d37d3[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0xf,'Global');rpcDb['createCustomerFinal'](_0x150bb4,_0x89a1('0xd3'));}else{if(_0x1392ab[_0x89a1('0xd4')]>=_0x20cf2c[_0x89a1('0xd5')]){rpcDb['createCustomerFinal'](_0x1392ab,_0x89a1('0xd3'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0xd1'),_0x20cf2c['dialAbandonedRetryFrequency']),_0x1392ab['unlockAgent'],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab[_0x89a1('0xba')]++;_0xa00f50['incrementPreviewCounters']({'id':_0x1392ab['idContact'],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})[_0x89a1('0x5b')](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)['then'](function(){});});}});break;case'18':_0x20cf2c[_0x89a1('0xd6')]+=0x1;_0x1392ab['countmachineretry']+=0x1;_0x1392ab['countglobal']=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x12,_0x1da1c5[_0x89a1('0xd7')]||_0x1da1c5[_0x89a1('0xd8')]);ami['emit'](_0x89a1('0xd9'),ut[_0x89a1('0x95')](_0x1392ab,'amd'));rpcDb['createCustomerHistory'](_0x1392ab,_0x89a1('0xda'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'18',_0x20cf2c)[_0x89a1('0x5b')](function(_0x1b8a62){_0x100d92=_0x1b8a62[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c['dialGlobalMaxRetry']){_0x150bb4=ut['cloneAction'](_0x1392ab,0x12,'Global');rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0xda'));}else{rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0xda'));}}else{_0x1392ab[_0x89a1('0xba')]++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab['idContact'],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})[_0x89a1('0x5b')](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});delete this['actions'][_0x1da1c5[_0x89a1('0x88')]];break;case'19':_0x20cf2c['outboundUnknownCallsDay']+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut['logCustomer'](_0x1392ab,0x13,_0x1da1c5[_0x89a1('0xd7')]||_0x1da1c5[_0x89a1('0xd8')]);ami[_0x89a1('0x2b')](_0x89a1('0xd9'),ut['buildObj'](_0x1392ab,_0x89a1('0xdb')));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xdc'));_0xa00f50['verifyAdditionalPhones'](_0x1392ab,'18',_0x20cf2c)[_0x89a1('0x5b')](function(_0x19ace5){_0x100d92=_0x19ace5['additional']==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0xf,'Global');rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0xdc'));}else{rpcDb[_0x89a1('0x70')](_0x1392ab,'[callProgressDetectingCustomer][machine]');}}else{_0x1392ab['countnoanswerretry']++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})[_0x89a1('0x5b')](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});delete this[_0x89a1('0x12')][_0x1da1c5['linkedid']];break;default:if(_0x1392ab[_0x89a1('0x4b')]){ut[_0x89a1('0x53')](_0x20cf2c,_0x89a1('0xdd'));ut[_0x89a1('0x54')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x20cf2c[_0x89a1('0x29')],_0x1da1c5);}_0x20cf2c[_0x89a1('0xd6')]+=0x1;_0x1392ab['countglobal']=ut['totalGlobal'](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0xc,_0x1da1c5['cause-txt']||_0x1da1c5['dialstatus']);_0x71f8d7=_0x20cf2c[_0x89a1('0xc9')];_0x10053f=_0x20cf2c[_0x89a1('0xad')];rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xde'));_0xa00f50['verifyAdditionalPhones'](_0x1392ab,'20',_0x20cf2c)[_0x89a1('0x5b')](function(_0x281626){_0x100d92=_0x281626[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut['cloneAction'](_0x1392ab,0xf,'Global');rpcDb['createCustomerFinal'](_0x150bb4,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0xdf'));}delete this['actions'][_0x1da1c5[_0x89a1('0x88')]];}else{_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)['then'](function(){});}});}if(!(_0x1392ab[_0x89a1('0x4b')]&&_0xeaa5cf==='16')){utils['decrementOriginate'](_0x20cf2c,'[callProgressDetectingCustomer]');logger[_0x89a1('0x25')](_0x89a1('0xe0'),_0x1392ab[_0x89a1('0x92')],_0x89a1('0x93'),_0x20cf2c[_0x89a1('0x29')],_0x89a1('0x49'),_0x20cf2c[_0x89a1('0x2e')]);}if(_0xeaa5cf!==_0x89a1('0x8d')){delete this[_0x89a1('0x12')][_0x1da1c5[_0x89a1('0x88')]];delete this['actions'][_0x1da1c5[_0x89a1('0xe1')]];}_0x20cf2c['queueSummaryCountersUpdated']=!![];}};Preview[_0x89a1('0xa')]['callProgressDetectingAgent']=function(_0x51ab1e,_0x1234b8,_0x2878ae){if(_[_0x89a1('0xe2')](_0x1234b8)&&_0x89a1('0xe3')!==typeof _0x1234b8){return;}if(_[_0x89a1('0xe2')](_0x2878ae)&&_0x89a1('0xe3')!==typeof _0x2878ae){return;}switch(_0x2878ae[_0x89a1('0xe4')]){case'0':ut['logAgent'](_0x51ab1e,0x0,_0x89a1('0x7b'));rpcDb[_0x89a1('0xe5')](_0x51ab1e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x51ab1e,0x3,_0x89a1('0xb7'));rpcDb[_0x89a1('0xe5')](_0x51ab1e,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x51ab1e,0x5,'Busy');rpcDb[_0x89a1('0xe5')](_0x51ab1e,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x89a1('0xe6')](_0x51ab1e,0x8,_0x89a1('0xbe'));rpcDb[_0x89a1('0xe5')](_0x51ab1e,_0x89a1('0xe7'));break;case'22':ut[_0x89a1('0xe6')](_0x51ab1e,0x16,_0x89a1('0xe8'));rpcDb[_0x89a1('0xe5')](_0x51ab1e,_0x89a1('0xe9'));break;default:ut[_0x89a1('0xe6')](_0x51ab1e,0xc,_0x2878ae[_0x89a1('0xe4')]);rpcDb[_0x89a1('0xe5')](_0x51ab1e,_0x89a1('0xe7'));}utils[_0x89a1('0x52')](_0x1234b8,_0x89a1('0xea'));logger['info'](_0x89a1('0xeb'),_0x51ab1e[_0x89a1('0x92')],_0x89a1('0x93'),_0x1234b8[_0x89a1('0x29')],_0x89a1('0x49'),_0x1234b8['originated']);delete this[_0x89a1('0x12')][_0x51ab1e[_0x89a1('0x92')]];};Preview[_0x89a1('0xa')][_0x89a1('0x7e')]=function(_0x357331,_0x2d991c,_0x551159){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x357331,_0x2d991c,_0x551159)[_0x89a1('0x63')](logger[_0x89a1('0x25')](_0x89a1('0xec')));};Preview[_0x89a1('0xa')][_0x89a1('0x8c')]=function(_0x17f4fa,_0x2e42cf,_0x483678){return cmHopperAdditionalPhone[_0x89a1('0x8c')](_0x17f4fa,_0x2e42cf,_0x483678)[_0x89a1('0x63')](logger[_0x89a1('0x25')](_0x89a1('0xed')));};Preview[_0x89a1('0xa')][_0x89a1('0x8b')]=function(_0x65785d){return Promise[_0x89a1('0xee')]()[_0x89a1('0x5b')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x65785d))[_0x89a1('0x63')](logger['info']('[incrementPreviewCounters]\x20'));};Preview[_0x89a1('0xa')]['checkInBlack']=function(_0x5ed43e,_0x270b2a,_0x1926cf,_0x29d026,_0x6f071){var _0x26019b=this;return new Promise(function(_0x55bee8,_0x4bb19d){if(_[_0x89a1('0x45')](_0x270b2a)||_['isNil'](_0x270b2a[_0x89a1('0xef')])||_[_0x89a1('0x45')](_0x270b2a[_0x89a1('0xf0')])||_[_0x89a1('0x45')](_0x270b2a['VoiceQueueId'])){_0x4bb19d(ut[_0x89a1('0x32')](_0x89a1('0xf1'),_0x29d026,_0x6f071));return;}var _0x635dd1=uuid['v4']();var _0x433be7=_0x26019b[_0x89a1('0xf')][_0x270b2a[_0x89a1('0x47')][_0x89a1('0x29')]];var _0x567311=_0x1926cf?_0x26019b[_0x89a1('0x13')][_0x1926cf]['id']:undefined;_0x26019b[_0x89a1('0x12')][_0x635dd1]=new Action(_0x270b2a,_0x433be7,_0x635dd1,_0x1926cf,_0x567311);var _0x4c803a=_0x26019b[_0x89a1('0x12')][_0x635dd1];_0x4c803a[_0x89a1('0x86')]=_0x29d026;_0x4c803a['activeContact']=_0x6f071;_0x4c803a[_0x89a1('0xf2')]=_0x1926cf;if(_[_0x89a1('0xf3')](_0x5ed43e)){_0x26019b['execCall'](_0x4c803a,_0x433be7,_0x270b2a,_0x1926cf)[_0x89a1('0x5b')](function(_0x44c481){logger[_0x89a1('0x25')](_0x89a1('0xf4'),'Queue:\x20'+_0x4c803a[_0x89a1('0x48')]+_0x89a1('0xf5')+_0x4c803a[_0x89a1('0x8a')],JSON['stringify'](_0x44c481));ami[_0x89a1('0x2b')]('custom:agentcalled',ut[_0x89a1('0x95')](_0x4c803a,'called',_0x26019b['campaignsPreview'][_0x4c803a[_0x89a1('0x48')]]));_0x55bee8(ut[_0x89a1('0x32')](_0x89a1('0xf6')));})[_0x89a1('0x63')](function(_0x2d3a98){ut[_0x89a1('0x37')]('[Preview][execCall][failure]',_0x2d3a98);_0x4bb19d(ut[_0x89a1('0x32')](_0x89a1('0xf7'),_0x29d026,_0x6f071));});}else{_0x433be7[_0x89a1('0xf8')]+=0x1;ut[_0x89a1('0xf9')](_0x4c803a);rpcDb[_0x89a1('0xfa')](_0x4c803a,_0x89a1('0xfb'));delete _0x26019b[_0x89a1('0x12')][_0x635dd1];_0x4bb19d(ut[_0x89a1('0x32')]('Contact\x20in\x20black\x20List',_0x29d026,_0x6f071));}});};Preview[_0x89a1('0xa')][_0x89a1('0x75')]=function(_0x56c6a3){return!_[_0x89a1('0x45')](_0x56c6a3)&&!_[_0x89a1('0x45')](_0x56c6a3[_0x89a1('0x29')])&&!_[_0x89a1('0x45')](_0x56c6a3[_0x89a1('0xfc')])&&_0x56c6a3['active']&&!_['isNil'](this[_0x89a1('0x11')][util[_0x89a1('0x66')](_0x89a1('0xfd'),_0x56c6a3[_0x89a1('0x29')])])&&!_[_0x89a1('0x45')](this['trunks'][util[_0x89a1('0x66')](_0x89a1('0xfd'),_0x56c6a3[_0x89a1('0x29')])][_0x89a1('0xfe')])&&(this[_0x89a1('0x11')][util[_0x89a1('0x66')](_0x89a1('0xfd'),_0x56c6a3[_0x89a1('0x29')])]['status']===_0x89a1('0xff')||this[_0x89a1('0x11')][util[_0x89a1('0x66')](_0x89a1('0xfd'),_0x56c6a3['name'])][_0x89a1('0xfe')]===_0x89a1('0x100'));};Preview['prototype'][_0x89a1('0x60')]=function(_0x3f23e6,_0x5da478){return this[_0x89a1('0x101')](_0x3f23e6,_0x5da478)[_0x89a1('0x5b')](function(_0x400d2f){return _['pick'](_0x400d2f,[_0x89a1('0x32')]);})[_0x89a1('0x63')](function(_0x12352f){if(_0x12352f[_0x89a1('0x102')]){rpcDb['unlockContact'](_0x3f23e6);}if(_0x12352f[_0x89a1('0xfc')]){rpcDb[_0x89a1('0x64')](_0x3f23e6);}throw _[_0x89a1('0x103')](_0x12352f,[_0x89a1('0x32')]);});};Preview[_0x89a1('0xa')]['execRun']=function(_0x567711,_0x169e4f){var _0x14f211=this;var _0x5db5c2,_0x51423a;return rpcDb[_0x89a1('0x104')](_0x567711)['then'](function(_0x2a11b9){if(!_['isNil'](_0x2a11b9[0x0])){_0x51423a=_0x2a11b9[0x0]['recallme']?![]:!![];_0x5db5c2=_0x2a11b9[0x0][_0x89a1('0x105')]?!![]:![];_0x5db5c2=_0x169e4f?!![]:_0x5db5c2;}var _0x1c0d4b=_0x14f211[_0x89a1('0x106')](_0x2a11b9);if(_0x1c0d4b[_0x89a1('0x107')]){rpcDb[_0x89a1('0x108')](_[_0x89a1('0x103')](_0x2a11b9[0x0],[_0x89a1('0x4d'),_0x89a1('0xf0')]))[_0x89a1('0x5b')](function(_0x440368){_0x14f211[_0x89a1('0x109')](_0x440368,_0x2a11b9[0x0],_0x169e4f,_0x51423a,_0x5db5c2)[_0x89a1('0x5b')](function(_0x386a30){return _0x386a30;})[_0x89a1('0x63')](function(_0x1ac863){throw _0x1ac863;});})['catch'](function(_0x4f9ce9){ut[_0x89a1('0x37')]('[Preview][checkIsBlackList]',_0x4f9ce9);throw ut[_0x89a1('0x32')]('Call\x20unsuccessful',_0x51423a,_0x5db5c2);});}else{throw ut['message'](_0x1c0d4b[_0x89a1('0x32')],_0x51423a,_0x5db5c2);}})[_0x89a1('0x63')](function(_0x188677){ut[_0x89a1('0x37')](_0x89a1('0x10a'),_0x188677);throw ut[_0x89a1('0x32')](_0x89a1('0x10b'),![],!![]);});};Preview['prototype'][_0x89a1('0x106')]=function(_0x12ff62){if(_[_0x89a1('0x45')](_0x12ff62)||_[_0x89a1('0xf3')](_0x12ff62)||!_[_0x89a1('0x45')](_0x12ff62[0x0][_0x89a1('0x5f')])&&_[_0x89a1('0x45')](_0x12ff62[0x0][_0x89a1('0x5f')][_0x89a1('0x29')])){ut[_0x89a1('0x37')]('[Preview][validateContact][Empty\x20Contact]',_0x12ff62);return{'isValid':![],'message':_0x89a1('0x10c')};}var _0x40ff55=this['campaignsPreview'][_0x12ff62[0x0]['Queue'][_0x89a1('0x29')]];_0x40ff55[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x77')];if(_[_0x89a1('0x45')](_0x40ff55)){ut[_0x89a1('0x37')](_0x89a1('0x10d'),_0x40ff55);return{'isValid':![],'message':_0x89a1('0x10e')};}if(!this['isTrunkReachable'](_0x40ff55[_0x89a1('0x74')])){ut['logger'](_0x89a1('0x10f'),_0x89a1('0x110')+_0x40ff55[_0x89a1('0x29')]+_0x89a1('0x111'));if(!this[_0x89a1('0x75')](_0x40ff55[_0x89a1('0x112')])){ut[_0x89a1('0x37')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x40ff55['name']+_0x89a1('0x113'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x40ff55[_0x89a1('0x40')])){ut[_0x89a1('0x37')]('[Preview][validateContact][Campaign\x20Active]',_0x40ff55[_0x89a1('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x40ff55[_0x89a1('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x89a1('0x114')};};Preview[_0x89a1('0xa')][_0x89a1('0x115')]=function(_0x67212a,_0x58fa28,_0x16a969,_0xd2f65b){var _0xfc6650=this;return new Promise(function(_0x3f7b56,_0x249c46){var _0x472811=_0x67212a[_0x89a1('0x92')];var _0x17cc06=_0xfc6650[_0x89a1('0x75')](_0x58fa28[_0x89a1('0x74')])?util[_0x89a1('0x66')](_0x89a1('0x116'),_0x58fa28['Trunk'][_0x89a1('0x29')],_[_0x89a1('0x45')](_0x58fa28[_0x89a1('0x117')])?'':_0x58fa28[_0x89a1('0x117')][_0x89a1('0x118')]()||'',_0x58fa28[_0x89a1('0x119')]>0x0?_0x16a969['phone']['substring'](_0x58fa28[_0x89a1('0x119')]):_0x16a969[_0x89a1('0xf0')]):util[_0x89a1('0x66')](_0x89a1('0x116'),_['isNil'](_0x58fa28[_0x89a1('0x112')])?_0x58fa28[_0x89a1('0x74')][_0x89a1('0x29')]:_0x58fa28[_0x89a1('0x112')][_0x89a1('0x29')],_[_0x89a1('0x45')](_0x58fa28[_0x89a1('0x117')])?'':_0x58fa28[_0x89a1('0x117')][_0x89a1('0x118')]()||'',_0x58fa28[_0x89a1('0x119')]>0x0?_0x16a969[_0x89a1('0xf0')][_0x89a1('0x11a')](_0x58fa28[_0x89a1('0x119')]):_0x16a969['phone']);var _0x382962=_0xfc6650[_0x89a1('0x75')](_0x58fa28[_0x89a1('0x74')])?ut['getCallerId'](_0x58fa28['Trunk'][_0x89a1('0x11b')],_0x58fa28[_0x89a1('0x11c')],_0x58fa28[_0x89a1('0x11d')]>0x0?ut['getCallerIdRandom'](_0x58fa28[_0x89a1('0x11e')],_0x58fa28[_0x89a1('0x11d')]):_0x58fa28[_0x89a1('0x11e')]):ut[_0x89a1('0x11f')](_[_0x89a1('0x45')](_0x58fa28[_0x89a1('0x112')])?_0x58fa28[_0x89a1('0x74')][_0x89a1('0x11b')]:_0x58fa28['TrunkBackup']['callerid'],_0x58fa28['dialOriginateCallerIdName'],_0x58fa28[_0x89a1('0x11d')]>0x0?ut[_0x89a1('0x120')](_0x58fa28[_0x89a1('0x11e')],_0x58fa28[_0x89a1('0x11d')]):_0x58fa28['dialOriginateCallerIdNumber']);if(_0x382962){_0x67212a[_0x89a1('0x121')]=ut['extractCalleridName'](_0x382962);_0x67212a['originatecalleridnum']=ut[_0x89a1('0x122')](_0x382962);}var _0x5c610e=ut['addVariables'](_0x58fa28,_0x16a969,_0x17cc06,_0x382962,_0x472811,_0x67212a);var _0x80eac3=utils['setXMDContactVariables'](_0x16a969[_0x89a1('0xef')]);Object[_0x89a1('0x123')](_0x5c610e,_0x80eac3);_[_0x89a1('0x124')](_0x67212a,ut[_0x89a1('0x125')](_0x5c610e));_0x67212a[_0x89a1('0x65')]=moment()['format'](_0x89a1('0x8e'));_0x58fa28[_0x89a1('0x126')]=_0x5c610e;var _0x514238=ut[_0x89a1('0x127')](_0x67212a,_0x58fa28,_0x5c610e,_0x67212a[_0x89a1('0x87')],_0xd2f65b);return ami['Action'](_0x514238)[_0x89a1('0x5b')](function(_0x363420){_0x58fa28['originated']+=0x1;logger[_0x89a1('0x25')]('[originated][increment]',_0x472811,_0x89a1('0x93'),_0x58fa28['name'],'originated:\x20',_0x58fa28[_0x89a1('0x2e')]);_0x3f7b56(_0x363420);})[_0x89a1('0x63')](function(_0x12cdee){ut[_0x89a1('0xe6')](_0x67212a,0xe,_0x89a1('0x128'));rpcDb['createAgentHistory'](_0x67212a,_0x89a1('0x129'));_0x249c46(_0x12cdee);});});};Preview[_0x89a1('0xa')][_0x89a1('0x1e')]=function(_0x35cfe1){if(this['actions'][_0x35cfe1[_0x89a1('0x88')]]){this[_0x89a1('0x12')][_0x35cfe1[_0x89a1('0x88')]]['channel']=_0x35cfe1[_0x89a1('0x50')];}};Preview[_0x89a1('0xa')][_0x89a1('0x15')]=function(_0x47837e){var _0x30abac=this;var _0x113621=this[_0x89a1('0x12')][_0x47837e[_0x89a1('0x12a')]];if(_0x113621){if(_0x113621['lookAgent']&&this[_0x89a1('0x13')][_0x113621[_0x89a1('0xf2')]]){ut[_0x89a1('0x12b')](_0x113621,this[_0x89a1('0x13')][_0x113621[_0x89a1('0xf2')]][_0x89a1('0x29')],this['agents'][_0x113621[_0x89a1('0xf2')]]['id']);}var _0x459de0=_[_0x89a1('0x12c')](_0x113621);_0x459de0[_0x89a1('0x8f')]=moment()[_0x89a1('0x66')](_0x89a1('0x8e'));var _0x23e46f=_0x30abac[_0x89a1('0xf')][_0x113621[_0x89a1('0x48')]];if(ut['isFailure'](_0x47837e[_0x89a1('0x12d')])){if(_0x113621[_0x89a1('0x86')]){rpcDb[_0x89a1('0x12e')](_0x113621[_0x89a1('0x8a')]);}if(_0x113621['activeContact']){rpcDb[_0x89a1('0x64')](_0x113621[_0x89a1('0x8a')]);}ami['emit'](_0x89a1('0x12f'),ut[_0x89a1('0x95')](_0x113621,_0x89a1('0x130'),this[_0x89a1('0xf')][_0x113621[_0x89a1('0x48')]]));this[_0x89a1('0x131')](_0x459de0,_0x23e46f,_0x47837e);}else{_0x113621[_0x89a1('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0x89a1('0xe6')](_0x459de0,0x4,_0x89a1('0xa0'));rpcDb[_0x89a1('0xe5')](_0x459de0,_0x89a1('0x132'));}}};Preview[_0x89a1('0xa')][_0x89a1('0x18')]=function(_0x49e7fd){var _0x1ccb2c=this['actions'][_0x49e7fd[_0x89a1('0x88')]];var _0x4c6fe6;if(_0x1ccb2c){_0x4c6fe6=this[_0x89a1('0xf')][_0x1ccb2c[_0x89a1('0x48')]];logger['info'](_0x89a1('0x133'),_0x49e7fd[_0x89a1('0x88')],_0x89a1('0x93'),_0x4c6fe6['name'],_0x89a1('0x4a'),_0x4c6fe6['pTalking']);}if(this['actions'][_0x49e7fd[_0x89a1('0x88')]]&&_0x49e7fd['linkedid']!==_0x49e7fd[_0x89a1('0x92')]){if(_0x49e7fd[_0x89a1('0x134')]==='16'&&this[_0x89a1('0x12')][_0x49e7fd['linkedid']][_0x89a1('0x4b')]){this[_0x89a1('0x78')](_0x49e7fd,_0x49e7fd[_0x89a1('0x88')],_0x49e7fd[_0x89a1('0x134')]);}else if(this[_0x89a1('0x12')][_0x49e7fd['linkedid']][_0x89a1('0x4b')]){logger['info']('[syncHangup][talking][cause]',_0x49e7fd[_0x89a1('0x88')],_0x49e7fd[_0x89a1('0x134')],_0x89a1('0x93'),_0x4c6fe6[_0x89a1('0x29')],_0x89a1('0x4a'),_0x4c6fe6[_0x89a1('0x2f')]);this[_0x89a1('0x78')](_0x49e7fd,_0x49e7fd[_0x89a1('0x88')],_0x49e7fd[_0x89a1('0x134')]);}}else if(_0x1ccb2c&&_[_0x89a1('0x45')](_0x1ccb2c[_0x89a1('0x135')])&&_0x4c6fe6[_0x89a1('0x136')]&&_0x49e7fd[_0x89a1('0x88')]===_0x49e7fd[_0x89a1('0x92')]&&_['isNil'](_0x49e7fd[_0x89a1('0xe4')])&&_0x49e7fd['cause']==='16'&&_0x49e7fd[_0x89a1('0x137')]==='6'&&_['isUndefined'](_0x1ccb2c[_0x89a1('0x138')])){if(_0x1ccb2c[_0x89a1('0x86')]){rpcDb['unlockContact'](_0x1ccb2c['idContact']);}if(_0x1ccb2c[_0x89a1('0x87')]){rpcDb[_0x89a1('0x64')](_0x1ccb2c[_0x89a1('0x8a')]);}_0x49e7fd[_0x89a1('0xe4')]='22';this[_0x89a1('0x131')](_0x1ccb2c,_0x4c6fe6,_0x49e7fd);}else if(_0x1ccb2c&&_0x1ccb2c[_0x89a1('0x138')]){if(_0x49e7fd['cause']==='16'&&this[_0x89a1('0x12')][_0x49e7fd[_0x89a1('0x88')]][_0x89a1('0x4b')]){logger[_0x89a1('0x25')](_0x89a1('0x139'),_0x49e7fd['linkedid'],_0x49e7fd[_0x89a1('0x134')],'\x20Queue',_0x4c6fe6[_0x89a1('0x29')],_0x89a1('0x4a'),_0x4c6fe6['pTalking']);this[_0x89a1('0x78')](_0x49e7fd,_0x49e7fd[_0x89a1('0x88')],_0x49e7fd[_0x89a1('0x134')]);}else if(this[_0x89a1('0x12')][_0x49e7fd[_0x89a1('0x88')]][_0x89a1('0x4b')]){logger[_0x89a1('0x25')](_0x89a1('0x13a'),_0x49e7fd['linkedid'],_0x49e7fd[_0x89a1('0x134')],'\x20Queue',_0x4c6fe6[_0x89a1('0x29')],_0x89a1('0x4a'),_0x4c6fe6[_0x89a1('0x2f')]);this[_0x89a1('0x78')](_0x49e7fd,_0x49e7fd[_0x89a1('0x88')],_0x49e7fd['cause']);}}};Preview[_0x89a1('0xa')][_0x89a1('0x1c')]=function(_0x15fa7d){if(this['actions'][_0x15fa7d['destlinkedid']]&&_0x15fa7d[_0x89a1('0xe1')]!==_0x15fa7d[_0x89a1('0x13b')]){this[_0x89a1('0x78')](_0x15fa7d,_0x15fa7d['destlinkedid'],_0x15fa7d[_0x89a1('0xd8')]);}};Preview[_0x89a1('0xa')][_0x89a1('0x1a')]=function(_0x495e39){if(this[_0x89a1('0x12')][_0x495e39[_0x89a1('0x88')]]&&_0x495e39[_0x89a1('0x88')]!==_0x495e39[_0x89a1('0x92')]&&!this[_0x89a1('0x12')][_0x495e39[_0x89a1('0x88')]][_0x89a1('0x4b')]){if(_0x495e39['cause']==='1'){this['callProgressDetectingCustomer'](_0x495e39,_0x495e39[_0x89a1('0x88')],_0x495e39['cause']);}}};Preview[_0x89a1('0xa')][_0x89a1('0x13c')]=function(_0x5c91ef,_0x51b315,_0x473213){if(this[_0x89a1('0x12')][_0x5c91ef]){if(_[_0x89a1('0x45')](this['actions'][_0x5c91ef][_0x89a1('0x126')])){this[_0x89a1('0x12')][_0x5c91ef][_0x89a1('0x126')]={};}this[_0x89a1('0x12')][_0x5c91ef][_0x89a1('0x126')][_0x51b315]=_0x473213;}};Preview['prototype'][_0x89a1('0x20')]=function(_0x299bbe){try{if(!_[_0x89a1('0x45')](_0x299bbe)){if(ut[_0x89a1('0x13d')](_[_0x89a1('0x13e')](_0x299bbe['variable'])[0x0])){this[_0x89a1('0x13c')](_0x299bbe[_0x89a1('0x92')],_[_0x89a1('0x13e')](_0x299bbe[_0x89a1('0x13f')])[0x0],_0x299bbe[_0x89a1('0x140')]);}}}catch(_0x518b89){logger[_0x89a1('0x141')](_0x89a1('0x142'),util[_0x89a1('0x143')](_0x518b89,{'showHidden':![],'depth':null}));}};Preview[_0x89a1('0xa')]['syncAttendedTransfer']=function(_0x552639){if(_0x552639){if(this[_0x89a1('0x12')][_0x552639[_0x89a1('0x144')]]){this[_0x89a1('0x12')][_0x552639['transfertargetlinkedid']][_0x89a1('0x138')]=!![];}}};Preview[_0x89a1('0xa')][_0x89a1('0x145')]=function(_0x4bd506){if(_0x4bd506){if(this['actions'][_0x4bd506['transfererlinkedid']]){this['actions'][_0x4bd506['transfererlinkedid']][_0x89a1('0x138')]=!![];}}};module[_0x89a1('0x146')]=Preview; \ No newline at end of file +var _0x1dd5=['originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','merge','starttime','variables','variablesAction','[originated][increment]','OriginateError','actionid','lookAgent','logLookAgent','isFailure','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','filterKey','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','defaults','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','emit','info','stringify','format','voice:queue:%s','name','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','\x20is\x20deactivated','dialMethod','preview','type','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','originated:\x20','queue','UserId','Action','status','channel','No\x20such\x20channel','decrementOriginate','dialAnswer','decrementTalking','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','getDiff','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','catch','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','pTalking','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','buildObj','connect','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','additional','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalking][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','NoSuchNumber','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','pick','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber'];(function(_0x694103,_0x4801){var _0x1866c5=function(_0x2298ad){while(--_0x2298ad){_0x694103['push'](_0x694103['shift']());}};_0x1866c5(++_0x4801);}(_0x1dd5,0x173));var _0x51dd=function(_0x31dc25,_0x2f42a2){_0x31dc25=_0x31dc25-0x0;var _0x4747b9=_0x1dd5[_0x31dc25];return _0x4747b9;};'use strict';var util=require(_0x51dd('0x0'));var _=require(_0x51dd('0x1'));var uuid=require(_0x51dd('0x2'));var moment=require(_0x51dd('0x3'));var Redis=require(_0x51dd('0x4'));var config=require(_0x51dd('0x5'));var logger=require(_0x51dd('0x6'))('preview');var loggerAction=require(_0x51dd('0x6'))(_0x51dd('0x7'));var ami=require(_0x51dd('0x8'));var rpcDb=require(_0x51dd('0x9'));var cmHopperAdditionalPhone=require(_0x51dd('0xa'));var Action=require(_0x51dd('0xb'));var ut=require('./util/util');var utils=require(_0x51dd('0xc'));config['redis']=_[_0x51dd('0xd')](config[_0x51dd('0xe')],{'host':_0x51dd('0xf'),'port':0x18eb});var io=require(_0x51dd('0x10'))(new Redis(config[_0x51dd('0xe')]));var Sequence=function(){};Sequence[_0x51dd('0x11')]['enqueue']=function(_0x4d2e9d){this[_0x51dd('0x12')]=this[_0x51dd('0x12')]?this[_0x51dd('0x12')][_0x51dd('0x13')](_0x4d2e9d):_0x4d2e9d();};function Preview(_0x28a9fb){this[_0x51dd('0x14')]=new Sequence();this[_0x51dd('0x15')]=_0x28a9fb[_0x51dd('0x16')];this[_0x51dd('0x17')]=_0x28a9fb[_0x51dd('0x17')];this[_0x51dd('0x18')]={};this[_0x51dd('0x19')]=_0x28a9fb['agents'];this[_0x51dd('0x1a')]=0x0;ami['on'](_0x51dd('0x1b'),this[_0x51dd('0x1c')][_0x51dd('0x1d')](this));ami['on'](_0x51dd('0x1e'),this['syncHangup'][_0x51dd('0x1d')](this));ami['on']('hanguprequest',this[_0x51dd('0x1f')][_0x51dd('0x1d')](this));ami['on'](_0x51dd('0x20'),this[_0x51dd('0x21')]['bind'](this));ami['on'](_0x51dd('0x22'),this[_0x51dd('0x23')][_0x51dd('0x1d')](this));ami['on'](_0x51dd('0x24'),this[_0x51dd('0x25')][_0x51dd('0x1d')](this));ami['on'](_0x51dd('0x26'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x51dd('0x27')]['bind'](this));this[_0x51dd('0x28')](this['campaignsPreview']);}function emit(_0xc451a4,_0x295d90,_0x470c4c){io['to'](_0xc451a4)[_0x51dd('0x29')](_0x295d90,_0x470c4c);}function emitVoiceQueueChannelRemove(_0x174c66){logger[_0x51dd('0x2a')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x51dd('0x2b')](_0x174c66));emit(util[_0x51dd('0x2c')](_0x51dd('0x2d'),_0x174c66[_0x51dd('0x2e')]),'voice_queue_channel:remove',_0x174c66);io[_0x51dd('0x29')](_0x51dd('0x2f'),_0x174c66);}function notSendMessagesQueue(_0x5dd179){if(_0x5dd179[_0x51dd('0x30')]){if(_0x5dd179[_0x51dd('0x31')]===0x0&&_0x5dd179['pTalking']===0x0){_0x5dd179[_0x51dd('0x30')]=![];_0x5dd179[_0x51dd('0x32')]=0x0;_0x5dd179[_0x51dd('0x33')]=0x0;_0x5dd179['message']=utils[_0x51dd('0x34')][_0x51dd('0x35')];ut[_0x51dd('0x36')](_0x51dd('0x37'),_0x5dd179[_0x51dd('0x2e')]+'\x20is\x20not\x20active');}else{_0x5dd179[_0x51dd('0x38')]=utils[_0x51dd('0x34')][_0x51dd('0x39')];ut[_0x51dd('0x36')](_0x51dd('0x37'),_0x5dd179['name']+_0x51dd('0x3a'));}}}Preview[_0x51dd('0x11')][_0x51dd('0x28')]=function(){var _0x24050b=this;setInterval(function(){_0x24050b['syncCampaigns']();},0x7cf);};Preview[_0x51dd('0x11')]['syncCampaigns']=function(){var _0x466d80=this[_0x51dd('0x15')];this[_0x51dd('0x1a')]+=0x1;for(var _0x3302cd in _0x466d80){if(_0x466d80['hasOwnProperty'](_0x3302cd)&&(_0x466d80[_0x3302cd][_0x51dd('0x3b')]===_0x51dd('0x3c')||_0x466d80[_0x3302cd][_0x51dd('0x3b')]==='booked')&&_0x466d80[_0x3302cd][_0x51dd('0x3d')]==='outbound'){if(this[_0x51dd('0x1a')]>0x7){this[_0x51dd('0x1a')]=0x0;this[_0x51dd('0x3e')]();}}if(_0x466d80[_0x51dd('0x3f')](_0x3302cd)&&_0x466d80[_0x3302cd][_0x51dd('0x3b')]==='preview'&&_0x466d80[_0x3302cd][_0x51dd('0x3d')]==='outbound'){if(_0x466d80[_0x3302cd][_0x51dd('0x40')]){this[_0x51dd('0x41')](_0x466d80[_0x3302cd]);if(_0x466d80[_0x3302cd][_0x51dd('0x42')])this[_0x51dd('0x43')](_0x466d80[_0x3302cd]);}else{notSendMessagesQueue(_0x466d80[_0x3302cd]);}}}};Preview[_0x51dd('0x11')][_0x51dd('0x44')]=function(_0x58f2c5){var _0x3782b8=this;this[_0x51dd('0x14')][_0x51dd('0x45')](function(){if(!_[_0x51dd('0x46')](_0x3782b8[_0x51dd('0x18')][_0x58f2c5])){loggerAction[_0x51dd('0x2a')](_0x51dd('0x47'),_0x58f2c5,'Queue',_0x3782b8[_0x51dd('0x18')][_0x58f2c5]['queue'],_0x51dd('0x48'),JSON[_0x51dd('0x2b')](_0x3782b8['campaignsPreview'][_0x3782b8[_0x51dd('0x18')][_0x58f2c5][_0x51dd('0x49')]]['originated']),'pTalking:\x20',JSON['stringify'](_0x3782b8[_0x51dd('0x15')][_0x3782b8[_0x51dd('0x18')][_0x58f2c5][_0x51dd('0x49')]]['pTalking']),JSON[_0x51dd('0x2b')](_0x3782b8[_0x51dd('0x18')][_0x58f2c5]['dialAnswer']),JSON[_0x51dd('0x2b')](_['pick'](_0x3782b8[_0x51dd('0x18')][_0x58f2c5],['contactId',_0x51dd('0x4a'),'VoiceQueueId','ListId'])));return ami[_0x51dd('0x4b')]({'action':_0x51dd('0x4c'),'channel':_0x3782b8[_0x51dd('0x18')][_0x58f2c5][_0x51dd('0x4d')]})['catch'](function(_0x2b65f0){if(_0x2b65f0['message']===_0x51dd('0x4e')){setTimeout(function(){if(_0x3782b8[_0x51dd('0x18')][_0x58f2c5]){utils[_0x51dd('0x4f')](_0x3782b8[_0x51dd('0x15')][_0x3782b8[_0x51dd('0x18')][_0x58f2c5]['queue']],'[clearZombieChannel]');if(_0x3782b8[_0x51dd('0x18')][_0x58f2c5][_0x51dd('0x50')]===!![]){ut[_0x51dd('0x51')](_0x3782b8[_0x51dd('0x15')][_0x3782b8['actions'][_0x58f2c5]['queue']],_0x51dd('0x52'));ut['loggerError'](_0x51dd('0x53')+_0x58f2c5,_0x3782b8[_0x51dd('0x18')][_0x58f2c5][_0x51dd('0x49')]);}ut[_0x51dd('0x54')](_0x51dd('0x55')+_0x58f2c5,_0x3782b8[_0x51dd('0x18')][_0x58f2c5][_0x51dd('0x49')]);delete _0x3782b8[_0x51dd('0x18')][_0x58f2c5];}},0x2328);}});}});};Preview['prototype'][_0x51dd('0x3e')]=function(){var _0x36a83a=this;loggerAction[_0x51dd('0x2a')](_0x51dd('0x56'),_[_0x51dd('0x57')](this['actions']));for(var _0x39ac48 in this[_0x51dd('0x18')]){if(_0x36a83a[_0x51dd('0x18')][_0x51dd('0x3f')](_0x39ac48)){_0x36a83a[_0x51dd('0x44')](_0x39ac48);}}};Preview[_0x51dd('0x11')]['recallMe']=function(_0x53e94e){var _0x4ef193=this;rpcDb[_0x51dd('0x58')](_0x53e94e['id'],ut['agentReadyId'](this[_0x51dd('0x19')]))['then'](function(_0xd3f016){if(!_[_0x51dd('0x46')](_0xd3f016)){for(var _0x582aa1=0x0;_0x582aa1<_0xd3f016['length'];_0x582aa1+=0x1){if(ut[_0x51dd('0x59')](_0xd3f016[_0x582aa1]['scheduledat'])<_0x53e94e[_0x51dd('0x5a')]*0x3c){if(_0xd3f016[_0x582aa1]['Agent']&&!_0xd3f016[_0x582aa1][_0x51dd('0x5b')][_0x51dd('0x5c')]){_0x4ef193[_0x51dd('0x5d')](_0xd3f016[_0x582aa1]['id'])[_0x51dd('0x5e')](ut[_0x51dd('0x5f')]('[RecallMe]'))[_0x51dd('0x60')](ut[_0x51dd('0x5f')](_0x51dd('0x61')));}else{rpcDb[_0x51dd('0x62')](_0xd3f016[_0x582aa1]['id']);}}else{var _0x4d31e8=new Action(_0xd3f016[_0x582aa1],_0x53e94e);_0x4d31e8['starttime']=moment()[_0x51dd('0x2c')](_0x51dd('0x63'));_0x53e94e['outboundReCallsDay']+=0x1;ut[_0x51dd('0x64')](_0x4d31e8,0x17,_0x51dd('0x65'));if(_0x53e94e[_0x51dd('0x66')]){rpcDb[_0x51dd('0x67')](ut[_0x51dd('0x68')](_0xd3f016[_0x582aa1]));rpcDb[_0x51dd('0x69')](_0x4d31e8,_0x51dd('0x6a'));}else{ut[_0x51dd('0x64')](_0x4d31e8,0x16,'RecallFailedTimeout');rpcDb[_0x51dd('0x69')](_0x4d31e8,_0x51dd('0x6b'));rpcDb[_0x51dd('0x6c')](_0x4d31e8,_0x51dd('0x6b'));}}}}})[_0x51dd('0x60')](ut[_0x51dd('0x5f')](_0x51dd('0x6d')));};Preview[_0x51dd('0x11')][_0x51dd('0x41')]=function(_0x2a5284){_0x2a5284[_0x51dd('0x30')]=!![];if(ut[_0x51dd('0x6e')](_0x2a5284['loggedIn'])){_0x2a5284[_0x51dd('0x38')]=utils[_0x51dd('0x34')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x51dd('0x6f')](_0x2a5284['dialActive'])){_0x2a5284[_0x51dd('0x38')]=utils[_0x51dd('0x34')][_0x51dd('0x35')];}else if(!this[_0x51dd('0x70')](_0x2a5284[_0x51dd('0x71')])){if(!this[_0x51dd('0x70')](_0x2a5284[_0x51dd('0x72')])){_0x2a5284['message']=utils[_0x51dd('0x34')][_0x51dd('0x73')];}else{_0x2a5284[_0x51dd('0x38')]=utils[_0x51dd('0x34')][_0x51dd('0x74')];}}else{_0x2a5284[_0x51dd('0x38')]=utils[_0x51dd('0x34')]['ACTIVE'];}};Preview[_0x51dd('0x11')]['callProgressDetectingCustomer']=function(_0xea31ea,_0x163f04,_0x41ed3c){var _0x56471f=this;var _0x578ac6=this[_0x51dd('0x18')][_0x163f04];var _0x12d7bb=this['campaignsPreview'][_0x578ac6['queue']];var _0x31f18d;var _0xa20be2=![];var _0x38eba6=0x2;var _0xd01f77=0x3;if(_0x12d7bb){switch(_0x41ed3c){case'1':_0x12d7bb[_0x51dd('0x75')]+=0x1;_0x578ac6[_0x51dd('0x76')]+=0x1;_0x578ac6[_0x51dd('0x77')]=ut[_0x51dd('0x78')](_0x578ac6);ut[_0x51dd('0x64')](_0x578ac6,0x0,'NoSuchNumber');ami[_0x51dd('0x29')](_0x51dd('0x79'),ut['buildObj'](_0x578ac6,_0x51dd('0x7a')));rpcDb[_0x51dd('0x69')](_0x578ac6,_0x51dd('0x7b'));_0x56471f[_0x51dd('0x7c')](_0x578ac6,'0',_0x12d7bb)[_0x51dd('0x5e')](function(_0x5c1fbf){_0xa20be2=_0x5c1fbf['additional']==0x1;_0x38eba6=_0x12d7bb[_0x51dd('0x7d')];_0xd01f77=_0x12d7bb[_0x51dd('0x7e')];if(!_0xa20be2){if(ut[_0x51dd('0x78')](_0x578ac6)>=_0x12d7bb[_0x51dd('0x7f')]){_0x31f18d=ut[_0x51dd('0x80')](_0x578ac6,0xf,_0x51dd('0x81'));rpcDb[_0x51dd('0x6c')](_0x31f18d,_0x51dd('0x82'));}else{if(_0x578ac6[_0x51dd('0x76')]>=_0x12d7bb[_0x51dd('0x83')]){rpcDb[_0x51dd('0x6c')](_0x578ac6,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x51dd('0x84')](_0x578ac6,'countnosuchnumberretry',_0x12d7bb['dialNoSuchNumberRetryFrequency']),_0x578ac6[_0x51dd('0x85')],_0x578ac6[_0x51dd('0x86')]);}}delete this[_0x51dd('0x18')][_0xea31ea[_0x51dd('0x87')]];}else{_0x578ac6[_0x51dd('0x76')]++;logger['info'](_0x51dd('0x88'),_0x578ac6['countnosuchnumberretry']);logger['info']('id',_0x578ac6[_0x51dd('0x89')]);_0x56471f[_0x51dd('0x8a')]({'id':_0x578ac6['idContact'],'field':{'countnosuchnumberretry':_0x578ac6[_0x51dd('0x76')]}})['then'](function(){_0x56471f[_0x51dd('0x8b')](_0x578ac6,_0x38eba6,_0xd01f77)['then'](function(){});});}});break;case _0x51dd('0x8c'):var _0x459f6f=moment()[_0x51dd('0x2c')](_0x51dd('0x63'));_0x578ac6[_0x51dd('0x8d')]=_0x459f6f;_0x578ac6[_0x51dd('0x8e')]=_0x459f6f;_0x578ac6[_0x51dd('0x50')]=!![];_0x12d7bb[_0x51dd('0x8f')]+=0x1;logger[_0x51dd('0x2a')](_0x51dd('0x90'),_0x578ac6[_0x51dd('0x91')],'\x20Queue',_0x12d7bb[_0x51dd('0x2e')],_0x51dd('0x92'),_0x12d7bb[_0x51dd('0x8f')]);ami['emit'](_0x51dd('0x93'),ut[_0x51dd('0x94')](_0x578ac6,_0x51dd('0x95'),this[_0x51dd('0x15')][_0x578ac6[_0x51dd('0x49')]]));if(_0x12d7bb['acw']||_0x12d7bb[_0x51dd('0x96')]){ami[_0x51dd('0x29')](_0x51dd('0x97'),{'queue':_0x578ac6[_0x51dd('0x49')],'interface':_0x578ac6[_0x51dd('0x98')],'uniqueid':_0x578ac6[_0x51dd('0x91')]});}break;case'16':ami[_0x51dd('0x29')](_0x51dd('0x99'),ut['buildObj'](_0x578ac6,_0x51dd('0x9a'),this[_0x51dd('0x15')][_0x578ac6['queue']]));emitVoiceQueueChannelRemove(ut[_0x51dd('0x94')](_0x578ac6,'complete'));_0x12d7bb[_0x51dd('0x9b')]+=0x1;_0x12d7bb[_0x51dd('0x9c')]+=0x1;_0x12d7bb[_0x51dd('0x9d')]+=0x1;ut[_0x51dd('0x51')](_0x12d7bb,_0x51dd('0x9e'));_0x578ac6['countglobal']=ut['totalGlobal'](_0x578ac6);ut[_0x51dd('0x64')](_0x578ac6,0x4,_0x51dd('0x9f'));rpcDb['createCustomerHistory'](_0x578ac6,_0x51dd('0xa0'));rpcDb[_0x51dd('0x6c')](_0x578ac6,_0x51dd('0xa1'));rpcDb[_0x51dd('0xa2')](_0x578ac6);_0x12d7bb[_0x51dd('0xa3')]+=_0x578ac6[_0x51dd('0xa4')];_0x12d7bb[_0x51dd('0xa5')]+=_0x578ac6['talktime'];logger['info'](_0x51dd('0xa6'),_0x578ac6['uniqueid'],'\x20Queue',_0x12d7bb[_0x51dd('0x2e')],'pTalking:\x20',_0x12d7bb[_0x51dd('0x8f')]);delete this['actions'][_0xea31ea['linkedid']];break;case _0x51dd('0xa7'):_0x12d7bb[_0x51dd('0xa8')]+=0x1;_0x578ac6[_0x51dd('0xa9')]+=0x1;_0x578ac6[_0x51dd('0x77')]=ut['totalGlobal'](_0x578ac6);ut[_0x51dd('0x64')](_0x578ac6,0x5,_0x51dd('0xaa'));_0x38eba6=_0x12d7bb[_0x51dd('0xab')];_0xd01f77=_0x12d7bb[_0x51dd('0x7e')];ami[_0x51dd('0x29')](_0x51dd('0xac'),ut[_0x51dd('0x94')](_0x578ac6,'busy'));rpcDb[_0x51dd('0x69')](_0x578ac6,'[callProgressDetectingCustomer][logBusy]');_0x56471f[_0x51dd('0x7c')](_0x578ac6,'5',_0x12d7bb)['then'](function(_0x2ba39e){_0xa20be2=_0x2ba39e[_0x51dd('0xad')]==0x1;if(!_0xa20be2){if(ut[_0x51dd('0x78')](_0x578ac6)>=_0x12d7bb[_0x51dd('0x7f')]){_0x31f18d=ut['cloneAction'](_0x578ac6,0xf,_0x51dd('0x81'));rpcDb[_0x51dd('0x6c')](_0x31f18d,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x578ac6['countbusyretry']>=_0x12d7bb[_0x51dd('0xae')]){rpcDb['createCustomerFinal'](_0x578ac6,_0x51dd('0xaf'));}else{rpcDb[_0x51dd('0xb0')](ut[_0x51dd('0x84')](_0x578ac6,_0x51dd('0xa9'),_0x12d7bb['dialBusyRetryFrequency']),_0x578ac6[_0x51dd('0x85')],_0x578ac6['activeContact']);}}}else{_0x578ac6[_0x51dd('0xa9')]++;_0x56471f[_0x51dd('0x8a')]({'id':_0x578ac6[_0x51dd('0x89')],'field':{'countbusyretry':_0x578ac6['countbusyretry']}})[_0x51dd('0x5e')](function(){_0x56471f[_0x51dd('0x8b')](_0x578ac6,_0x38eba6,_0xd01f77)[_0x51dd('0x5e')](function(){});});}});break;case _0x51dd('0xb1'):_0x12d7bb[_0x51dd('0xb2')]+=0x1;_0x578ac6[_0x51dd('0xb3')]+=0x1;_0x578ac6[_0x51dd('0x77')]=ut[_0x51dd('0x78')](_0x578ac6);ut[_0x51dd('0x64')](_0x578ac6,0x3,_0x51dd('0xb4'));_0x38eba6=_0x12d7bb[_0x51dd('0xb5')];_0xd01f77=_0x12d7bb['callAdditionalPhoneAfterMin'];var _0x5a6e8e=ut[_0x51dd('0xb6')](_0x578ac6,_0x12d7bb);ami['emit'](_0x51dd('0xb7'),_0x5a6e8e);rpcDb[_0x51dd('0x69')](_0x578ac6,_0x51dd('0xb8'));_0x56471f['verifyAdditionalPhones'](_0x578ac6,'3',_0x12d7bb)['then'](function(_0x10c392){_0xa20be2=_0x10c392[_0x51dd('0xad')]==0x1;if(!_0xa20be2){if(ut['totalGlobal'](_0x578ac6)>=_0x12d7bb[_0x51dd('0x7f')]){_0x31f18d=ut[_0x51dd('0x80')](_0x578ac6,0xf,_0x51dd('0x81'));rpcDb[_0x51dd('0x6c')](_0x31f18d,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x578ac6[_0x51dd('0xb3')]>=_0x12d7bb[_0x51dd('0xb9')]){rpcDb['createCustomerFinal'](_0x578ac6,_0x51dd('0xb8'));}else{rpcDb['rescheduleContact'](ut[_0x51dd('0x84')](_0x578ac6,'countnoanswerretry',_0x12d7bb['dialNoAnswerRetryFrequency']),_0x578ac6[_0x51dd('0x85')],_0x578ac6[_0x51dd('0x86')]);}}}else{_0x578ac6[_0x51dd('0xb3')]++;_0x56471f[_0x51dd('0x8a')]({'id':_0x578ac6[_0x51dd('0x89')],'field':{'countnoanswerretry':_0x578ac6['countnoanswerretry']}})[_0x51dd('0x5e')](function(){_0x56471f['swapAdditionalPhones'](_0x578ac6,_0x38eba6,_0xd01f77)[_0x51dd('0x5e')](function(){});});}});break;case'CONGESTION':_0x12d7bb[_0x51dd('0xba')]+=0x1;_0x578ac6[_0x51dd('0xbb')]+=0x1;_0x578ac6[_0x51dd('0x77')]=ut['totalGlobal'](_0x578ac6);ut['logCustomer'](_0x578ac6,0x8,_0x51dd('0xbc'));_0x38eba6=_0x12d7bb[_0x51dd('0xbd')];_0xd01f77=_0x12d7bb[_0x51dd('0x7e')];ami[_0x51dd('0x29')](_0x51dd('0xbe'),ut[_0x51dd('0x94')](_0x578ac6,_0x51dd('0xbf')));rpcDb[_0x51dd('0x69')](_0x578ac6,_0x51dd('0xc0'));_0x56471f['verifyAdditionalPhones'](_0x578ac6,'8',_0x12d7bb)[_0x51dd('0x5e')](function(_0x4a2dcc){_0xa20be2=_0x4a2dcc['additional']==0x1;if(!_0xa20be2){if(ut['totalGlobal'](_0x578ac6)>=_0x12d7bb['dialGlobalMaxRetry']){_0x31f18d=ut[_0x51dd('0x80')](_0x578ac6,0xf,_0x51dd('0x81'));rpcDb[_0x51dd('0x6c')](_0x31f18d,_0x51dd('0xc1'));}else{if(_0x578ac6[_0x51dd('0xbb')]>=_0x12d7bb['dialCongestionMaxRetry']){rpcDb[_0x51dd('0x6c')](_0x578ac6,_0x51dd('0xc0'));}else{rpcDb[_0x51dd('0xb0')](ut['scheduledAt'](_0x578ac6,_0x51dd('0xbb'),_0x12d7bb['dialBusyRetryFrequency']),_0x578ac6[_0x51dd('0x85')],_0x578ac6[_0x51dd('0x86')]);}}}else{_0x578ac6['countcongestionretry']++;_0x56471f[_0x51dd('0x8a')]({'id':_0x578ac6[_0x51dd('0x89')],'field':{'countcongestionretry':_0x578ac6[_0x51dd('0xbb')]}})['then'](function(){_0x56471f[_0x51dd('0x8b')](_0x578ac6,_0x38eba6,_0xd01f77)[_0x51dd('0x5e')](function(){});});}});break;case _0x51dd('0xc2'):_0x12d7bb[_0x51dd('0xc3')]+=0x1;_0x578ac6[_0x51dd('0xc4')]+=0x1;_0x578ac6['countglobal']=ut[_0x51dd('0x78')](_0x578ac6);ut[_0x51dd('0x64')](_0x578ac6,0x14,_0x51dd('0xc5'));_0x38eba6=_0x12d7bb[_0x51dd('0xc6')];_0xd01f77=_0x12d7bb['callAdditionalPhoneAfterMin'];ami[_0x51dd('0x29')](_0x51dd('0xc7'),ut['buildObj'](_0x578ac6,_0x51dd('0xc8')));rpcDb[_0x51dd('0x69')](_0x578ac6,_0x51dd('0xc9'));_0x56471f[_0x51dd('0x7c')](_0x578ac6,'20',_0x12d7bb)[_0x51dd('0x5e')](function(_0x2f424a){_0xa20be2=_0x2f424a['additional']==0x1;if(!_0xa20be2){if(ut[_0x51dd('0x78')](_0x578ac6)>=_0x12d7bb['dialGlobalMaxRetry']){_0x31f18d=ut[_0x51dd('0x80')](_0x578ac6,0x14,_0x51dd('0xc5'));rpcDb[_0x51dd('0x6c')](_0x31f18d,_0x51dd('0xca'));}else{if(_0x578ac6['countagentrejectretry']>=_0x12d7bb['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x578ac6,_0x51dd('0xca'));}else{rpcDb[_0x51dd('0xb0')](ut[_0x51dd('0x84')](_0x578ac6,'countagentrejectretry',_0x12d7bb[_0x51dd('0xc6')]),_0x578ac6[_0x51dd('0x85')],_0x578ac6[_0x51dd('0x86')]);}}}else{_0x578ac6[_0x51dd('0xb3')]++;_0x56471f[_0x51dd('0x8a')]({'id':_0x578ac6[_0x51dd('0x89')],'field':{'countnoanswerretry':_0x578ac6[_0x51dd('0xb3')]}})[_0x51dd('0x5e')](function(){_0x56471f[_0x51dd('0x8b')](_0x578ac6,_0x38eba6,_0xd01f77)[_0x51dd('0x5e')](function(){});});}});break;case _0x51dd('0xcb'):_0x12d7bb[_0x51dd('0xcc')]+=0x1;_0x578ac6[_0x51dd('0xcd')]+=0x1;_0x578ac6[_0x51dd('0x77')]=ut[_0x51dd('0x78')](_0x578ac6);ut[_0x51dd('0x64')](_0x578ac6,0xb,_0x51dd('0xce'));rpcDb[_0x51dd('0x69')](_0x578ac6,_0x51dd('0xcf'));_0x56471f[_0x51dd('0x7c')](_0x578ac6,'11',_0x12d7bb)[_0x51dd('0x5e')](function(_0x182573){_0xa20be2=_0x182573[_0x51dd('0xad')]==0x1;if(!_0xa20be2){if(ut[_0x51dd('0x78')](_0x578ac6)>=_0x12d7bb[_0x51dd('0x7f')]){_0x31f18d=ut[_0x51dd('0x80')](_0x578ac6,0xf,_0x51dd('0x81'));rpcDb['createCustomerFinal'](_0x31f18d,_0x51dd('0xcf'));}else{if(_0x578ac6['countabandonedetry']>=_0x12d7bb[_0x51dd('0xd0')]){rpcDb[_0x51dd('0x6c')](_0x578ac6,_0x51dd('0xcf'));}else{rpcDb[_0x51dd('0xb0')](ut[_0x51dd('0x84')](_0x578ac6,'countabandonedretry',_0x12d7bb[_0x51dd('0xd1')]),_0x578ac6[_0x51dd('0x85')],_0x578ac6[_0x51dd('0x86')]);}}}else{_0x578ac6[_0x51dd('0xb3')]++;_0x56471f[_0x51dd('0x8a')]({'id':_0x578ac6[_0x51dd('0x89')],'field':{'countnoanswerretry':_0x578ac6[_0x51dd('0xb3')]}})[_0x51dd('0x5e')](function(){_0x56471f['swapAdditionalPhones'](_0x578ac6,_0x38eba6,_0xd01f77)['then'](function(){});});}});break;case'18':_0x12d7bb[_0x51dd('0xd2')]+=0x1;_0x578ac6[_0x51dd('0xd3')]+=0x1;_0x578ac6[_0x51dd('0x77')]=ut[_0x51dd('0x78')](_0x578ac6);ut[_0x51dd('0x64')](_0x578ac6,0x12,_0xea31ea['cause-txt']||_0xea31ea['dialstatus']);ami[_0x51dd('0x29')]('custom:amd',ut[_0x51dd('0x94')](_0x578ac6,'amd'));rpcDb[_0x51dd('0x69')](_0x578ac6,'[callProgressDetectingCustomer][hangupInAMD]');_0x56471f[_0x51dd('0x7c')](_0x578ac6,'18',_0x12d7bb)[_0x51dd('0x5e')](function(_0x368aa2){_0xa20be2=_0x368aa2[_0x51dd('0xad')]==0x1;if(!_0xa20be2){if(ut[_0x51dd('0x78')](_0x578ac6)>=_0x12d7bb[_0x51dd('0x7f')]){_0x31f18d=ut['cloneAction'](_0x578ac6,0x12,_0x51dd('0x81'));rpcDb[_0x51dd('0x6c')](_0x31f18d,_0x51dd('0xd4'));}else{rpcDb['createCustomerFinal'](_0x578ac6,_0x51dd('0xd4'));}}else{_0x578ac6[_0x51dd('0xb3')]++;_0x56471f[_0x51dd('0x8a')]({'id':_0x578ac6[_0x51dd('0x89')],'field':{'countnoanswerretry':_0x578ac6['countnoanswerretry']}})[_0x51dd('0x5e')](function(){_0x56471f[_0x51dd('0x8b')](_0x578ac6,_0x38eba6,_0xd01f77)[_0x51dd('0x5e')](function(){});});}});delete this[_0x51dd('0x18')][_0xea31ea[_0x51dd('0x87')]];break;case'19':_0x12d7bb['outboundUnknownCallsDay']+=0x1;_0x578ac6[_0x51dd('0x77')]=ut['totalGlobal'](_0x578ac6);ut[_0x51dd('0x64')](_0x578ac6,0x13,_0xea31ea[_0x51dd('0xd5')]||_0xea31ea['dialstatus']);ami[_0x51dd('0x29')](_0x51dd('0xd6'),ut[_0x51dd('0x94')](_0x578ac6,_0x51dd('0xd7')));rpcDb[_0x51dd('0x69')](_0x578ac6,'[callProgressDetectingCustomer][machine]');_0x56471f[_0x51dd('0x7c')](_0x578ac6,'18',_0x12d7bb)['then'](function(_0x5868be){_0xa20be2=_0x5868be[_0x51dd('0xad')]==0x1;if(!_0xa20be2){if(ut[_0x51dd('0x78')](_0x578ac6)>=_0x12d7bb[_0x51dd('0x7f')]){_0x31f18d=ut[_0x51dd('0x80')](_0x578ac6,0xf,'Global');rpcDb[_0x51dd('0x6c')](_0x31f18d,_0x51dd('0xd8'));}else{rpcDb[_0x51dd('0x6c')](_0x578ac6,_0x51dd('0xd8'));}}else{_0x578ac6['countnoanswerretry']++;_0x56471f[_0x51dd('0x8a')]({'id':_0x578ac6[_0x51dd('0x89')],'field':{'countnoanswerretry':_0x578ac6[_0x51dd('0xb3')]}})[_0x51dd('0x5e')](function(){_0x56471f[_0x51dd('0x8b')](_0x578ac6,_0x38eba6,_0xd01f77)[_0x51dd('0x5e')](function(){});});}});delete this[_0x51dd('0x18')][_0xea31ea['linkedid']];break;default:if(_0x578ac6['dialAnswer']){ut['decrementTalking'](_0x12d7bb,'[default]');ut[_0x51dd('0x54')](_0x51dd('0xd9')+_0x12d7bb[_0x51dd('0x2e')],_0xea31ea);}_0x12d7bb[_0x51dd('0xd2')]+=0x1;_0x578ac6[_0x51dd('0x77')]=ut[_0x51dd('0x78')](_0x578ac6);ut['logCustomer'](_0x578ac6,0xc,_0xea31ea['cause-txt']||_0xea31ea[_0x51dd('0xda')]);_0x38eba6=_0x12d7bb[_0x51dd('0xc6')];_0xd01f77=_0x12d7bb[_0x51dd('0x7e')];rpcDb[_0x51dd('0x69')](_0x578ac6,_0x51dd('0xdb'));_0x56471f[_0x51dd('0x7c')](_0x578ac6,'20',_0x12d7bb)[_0x51dd('0x5e')](function(_0x24e7ea){_0xa20be2=_0x24e7ea[_0x51dd('0xad')]==0x1;if(!_0xa20be2){if(ut[_0x51dd('0x78')](_0x578ac6)>=_0x12d7bb['dialGlobalMaxRetry']){_0x31f18d=ut[_0x51dd('0x80')](_0x578ac6,0xf,'Global');rpcDb[_0x51dd('0x6c')](_0x31f18d,_0x51dd('0xdc'));}else{rpcDb[_0x51dd('0x6c')](_0x578ac6,_0x51dd('0xdc'));}delete this['actions'][_0xea31ea['linkedid']];}else{_0x56471f['swapAdditionalPhones'](_0x578ac6,_0x38eba6,_0xd01f77)[_0x51dd('0x5e')](function(){});}});}if(!(_0x578ac6['dialAnswer']&&_0x41ed3c==='16')){utils[_0x51dd('0x4f')](_0x12d7bb,_0x51dd('0xdd'));logger['info'](_0x51dd('0xde'),_0x578ac6[_0x51dd('0x91')],_0x51dd('0xdf'),_0x12d7bb[_0x51dd('0x2e')],'originated:\x20',_0x12d7bb['originated']);}if(_0x41ed3c!==_0x51dd('0x8c')){delete this[_0x51dd('0x18')][_0xea31ea[_0x51dd('0x87')]];delete this[_0x51dd('0x18')][_0xea31ea[_0x51dd('0xe0')]];}_0x12d7bb['queueSummaryCountersUpdated']=!![];}};Preview['prototype'][_0x51dd('0xe1')]=function(_0x2fc7fb,_0x21a1c0,_0x33e28a){if(_[_0x51dd('0xe2')](_0x21a1c0)&&_0x51dd('0xe3')!==typeof _0x21a1c0){return;}if(_[_0x51dd('0xe2')](_0x33e28a)&&_0x51dd('0xe3')!==typeof _0x33e28a){return;}switch(_0x33e28a[_0x51dd('0xe4')]){case'0':ut['logAgent'](_0x2fc7fb,0x0,_0x51dd('0xe5'));rpcDb[_0x51dd('0xe6')](_0x2fc7fb,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x51dd('0xe7')](_0x2fc7fb,0x3,_0x51dd('0xb4'));rpcDb[_0x51dd('0xe6')](_0x2fc7fb,_0x51dd('0xe8'));break;case'5':ut[_0x51dd('0xe7')](_0x2fc7fb,0x5,'Busy');rpcDb[_0x51dd('0xe6')](_0x2fc7fb,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x51dd('0xe7')](_0x2fc7fb,0x8,'Congestion');rpcDb[_0x51dd('0xe6')](_0x2fc7fb,_0x51dd('0xe9'));break;case'22':ut[_0x51dd('0xe7')](_0x2fc7fb,0x16,'AnswerAGI');rpcDb[_0x51dd('0xe6')](_0x2fc7fb,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x2fc7fb,0xc,_0x33e28a[_0x51dd('0xe4')]);rpcDb['createAgentHistory'](_0x2fc7fb,_0x51dd('0xe9'));}utils[_0x51dd('0x4f')](_0x21a1c0,_0x51dd('0xea'));logger[_0x51dd('0x2a')](_0x51dd('0xeb'),_0x2fc7fb['uniqueid'],_0x51dd('0xdf'),_0x21a1c0[_0x51dd('0x2e')],_0x51dd('0x48'),_0x21a1c0['originated']);delete this[_0x51dd('0x18')][_0x2fc7fb[_0x51dd('0x91')]];};Preview[_0x51dd('0x11')]['verifyAdditionalPhones']=function(_0x8985e6,_0x312170,_0xe31aa1){return cmHopperAdditionalPhone[_0x51dd('0x7c')](_0x8985e6,_0x312170,_0xe31aa1)['catch'](logger[_0x51dd('0x2a')]('[verifyAdditionalPhone]\x20'));};Preview['prototype'][_0x51dd('0x8b')]=function(_0x36f16d,_0x14f7b2,_0x5aff85){return cmHopperAdditionalPhone[_0x51dd('0x8b')](_0x36f16d,_0x14f7b2,_0x5aff85)[_0x51dd('0x60')](logger[_0x51dd('0x2a')](_0x51dd('0xec')));};Preview['prototype']['incrementPreviewCounters']=function(_0x116bc1){return Promise[_0x51dd('0xed')]()[_0x51dd('0x5e')](cmHopperAdditionalPhone[_0x51dd('0x8a')](_0x116bc1))['catch'](logger[_0x51dd('0x2a')](_0x51dd('0xee')));};Preview[_0x51dd('0x11')][_0x51dd('0xef')]=function(_0x58550a,_0xbe3155,_0x2e8d53,_0x2942f6,_0x1e9195){var _0x28ff17=this;return new Promise(function(_0x33e7d9,_0x3bdf9f){if(_[_0x51dd('0x46')](_0xbe3155)||_[_0x51dd('0x46')](_0xbe3155[_0x51dd('0xf0')])||_[_0x51dd('0x46')](_0xbe3155[_0x51dd('0xf1')])||_[_0x51dd('0x46')](_0xbe3155['VoiceQueueId'])){_0x3bdf9f(ut[_0x51dd('0x38')](_0x51dd('0xf2'),_0x2942f6,_0x1e9195));return;}var _0x17ca3b=uuid['v4']();var _0x222cf0=_0x28ff17[_0x51dd('0x15')][_0xbe3155['Queue'][_0x51dd('0x2e')]];var _0x907ce7=_0x2e8d53?_0x28ff17[_0x51dd('0x19')][_0x2e8d53]['id']:undefined;_0x28ff17[_0x51dd('0x18')][_0x17ca3b]=new Action(_0xbe3155,_0x222cf0,_0x17ca3b,_0x2e8d53,_0x907ce7);var _0x4a19dc=_0x28ff17[_0x51dd('0x18')][_0x17ca3b];_0x4a19dc[_0x51dd('0x85')]=_0x2942f6;_0x4a19dc[_0x51dd('0x86')]=_0x1e9195;_0x4a19dc['lookAgent']=_0x2e8d53;if(_[_0x51dd('0xf3')](_0x58550a)){_0x28ff17[_0x51dd('0xf4')](_0x4a19dc,_0x222cf0,_0xbe3155,_0x2e8d53)[_0x51dd('0x5e')](function(_0x2b8bc8){logger[_0x51dd('0x2a')]('[Preview][execCall][success]',_0x51dd('0xf5')+_0x4a19dc[_0x51dd('0x49')]+'\x20IdHopper:\x20'+_0x4a19dc[_0x51dd('0x89')],JSON[_0x51dd('0x2b')](_0x2b8bc8));ami['emit'](_0x51dd('0xf6'),ut[_0x51dd('0x94')](_0x4a19dc,'called',_0x28ff17[_0x51dd('0x15')][_0x4a19dc[_0x51dd('0x49')]]));_0x33e7d9(ut['message']('Calling'));})['catch'](function(_0x1f8f8d){ut['logger'](_0x51dd('0xf7'),_0x1f8f8d);_0x3bdf9f(ut[_0x51dd('0x38')](_0x51dd('0xf8'),_0x2942f6,_0x1e9195));});}else{_0x222cf0[_0x51dd('0xf9')]+=0x1;ut[_0x51dd('0xfa')](_0x4a19dc);rpcDb[_0x51dd('0xfb')](_0x4a19dc,_0x51dd('0xfc'));delete _0x28ff17[_0x51dd('0x18')][_0x17ca3b];_0x3bdf9f(ut[_0x51dd('0x38')](_0x51dd('0xfd'),_0x2942f6,_0x1e9195));}});};Preview[_0x51dd('0x11')][_0x51dd('0x70')]=function(_0x32c27d){return!_[_0x51dd('0x46')](_0x32c27d)&&!_[_0x51dd('0x46')](_0x32c27d[_0x51dd('0x2e')])&&!_[_0x51dd('0x46')](_0x32c27d[_0x51dd('0xfe')])&&_0x32c27d[_0x51dd('0xfe')]&&!_[_0x51dd('0x46')](this['trunks'][util[_0x51dd('0x2c')](_0x51dd('0xff'),_0x32c27d[_0x51dd('0x2e')])])&&!_[_0x51dd('0x46')](this[_0x51dd('0x17')][util['format'](_0x51dd('0xff'),_0x32c27d[_0x51dd('0x2e')])][_0x51dd('0x4c')])&&(this[_0x51dd('0x17')][util['format'](_0x51dd('0xff'),_0x32c27d['name'])]['status']===_0x51dd('0x100')||this[_0x51dd('0x17')][util[_0x51dd('0x2c')](_0x51dd('0xff'),_0x32c27d[_0x51dd('0x2e')])][_0x51dd('0x4c')]===_0x51dd('0x101'));};Preview[_0x51dd('0x11')][_0x51dd('0x5d')]=function(_0xeceb4d,_0x2910b2){return this['execRun'](_0xeceb4d,_0x2910b2)[_0x51dd('0x5e')](function(_0x41cb65){return _[_0x51dd('0x102')](_0x41cb65,[_0x51dd('0x38')]);})['catch'](function(_0x5a8e9c){if(_0x5a8e9c[_0x51dd('0x103')]){rpcDb[_0x51dd('0x104')](_0xeceb4d);}if(_0x5a8e9c['active']){rpcDb['disableContact'](_0xeceb4d);}throw _[_0x51dd('0x102')](_0x5a8e9c,[_0x51dd('0x38')]);});};Preview[_0x51dd('0x11')][_0x51dd('0x105')]=function(_0x18c46c,_0x1d945a){var _0x5ad878=this;var _0x1c33d6,_0x298e24;return rpcDb[_0x51dd('0x106')](_0x18c46c)[_0x51dd('0x5e')](function(_0x39c520){if(!_[_0x51dd('0x46')](_0x39c520[0x0])){_0x298e24=_0x39c520[0x0][_0x51dd('0x107')]?![]:!![];_0x1c33d6=_0x39c520[0x0][_0x51dd('0x107')]?!![]:![];_0x1c33d6=_0x1d945a?!![]:_0x1c33d6;}var _0x4e13d7=_0x5ad878[_0x51dd('0x108')](_0x39c520);if(_0x4e13d7[_0x51dd('0x109')]){rpcDb[_0x51dd('0x10a')](_[_0x51dd('0x102')](_0x39c520[0x0],[_0x51dd('0x10b'),'phone']))[_0x51dd('0x5e')](function(_0xdd75bd){_0x5ad878[_0x51dd('0xef')](_0xdd75bd,_0x39c520[0x0],_0x1d945a,_0x298e24,_0x1c33d6)['then'](function(_0x257890){return _0x257890;})[_0x51dd('0x60')](function(_0xdd595c){throw _0xdd595c;});})[_0x51dd('0x60')](function(_0x18f58a){ut[_0x51dd('0x36')](_0x51dd('0x10c'),_0x18f58a);throw ut[_0x51dd('0x38')](_0x51dd('0x10d'),_0x298e24,_0x1c33d6);});}else{throw ut[_0x51dd('0x38')](_0x4e13d7[_0x51dd('0x38')],_0x298e24,_0x1c33d6);}})[_0x51dd('0x60')](function(_0x1d24d2){ut['logger'](_0x51dd('0x10e'),_0x1d24d2);throw ut[_0x51dd('0x38')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x51dd('0x11')][_0x51dd('0x108')]=function(_0x578e95){if(_[_0x51dd('0x46')](_0x578e95)||_[_0x51dd('0xf3')](_0x578e95)||!_[_0x51dd('0x46')](_0x578e95[0x0][_0x51dd('0x5b')])&&_[_0x51dd('0x46')](_0x578e95[0x0]['Agent'][_0x51dd('0x2e')])){ut[_0x51dd('0x36')](_0x51dd('0x10f'),_0x578e95);return{'isValid':![],'message':_0x51dd('0x110')};}var _0x28db5e=this[_0x51dd('0x15')][_0x578e95[0x0][_0x51dd('0x111')][_0x51dd('0x2e')]];_0x28db5e[_0x51dd('0x38')]=utils[_0x51dd('0x34')][_0x51dd('0x74')];if(_[_0x51dd('0x46')](_0x28db5e)){ut[_0x51dd('0x36')](_0x51dd('0x112'),_0x28db5e);return{'isValid':![],'message':_0x51dd('0x113')};}if(!this['isTrunkReachable'](_0x28db5e[_0x51dd('0x71')])){ut[_0x51dd('0x36')](_0x51dd('0x114'),'campaign\x20Name:\x20'+_0x28db5e[_0x51dd('0x2e')]+_0x51dd('0x115'));if(!this[_0x51dd('0x70')](_0x28db5e['TrunkBackup'])){ut[_0x51dd('0x36')](_0x51dd('0x114'),_0x28db5e[_0x51dd('0x2e')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x51dd('0x116')};}}if(!ut[_0x51dd('0x6f')](_0x28db5e[_0x51dd('0x40')])){ut[_0x51dd('0x36')](_0x51dd('0x117'),_0x28db5e['name']+_0x51dd('0x118'));return{'isValid':![],'message':_0x51dd('0x119')+_0x28db5e[_0x51dd('0x2e')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x51dd('0x11a')};};Preview[_0x51dd('0x11')][_0x51dd('0xf4')]=function(_0xce64de,_0x5d82f3,_0x35e415,_0x183857){var _0x427b90=this;return new Promise(function(_0x106890,_0x5ac4ba){var _0x1bb7c0=_0xce64de[_0x51dd('0x91')];var _0x3409b0=_0x427b90['isTrunkReachable'](_0x5d82f3[_0x51dd('0x71')])?util[_0x51dd('0x2c')]('SIP/%s/%s%s',_0x5d82f3[_0x51dd('0x71')]['name'],_[_0x51dd('0x46')](_0x5d82f3['dialPrefix'])?'':_0x5d82f3[_0x51dd('0x11b')][_0x51dd('0x11c')]()||'',_0x5d82f3[_0x51dd('0x11d')]>0x0?_0x35e415[_0x51dd('0xf1')][_0x51dd('0x11e')](_0x5d82f3[_0x51dd('0x11d')]):_0x35e415[_0x51dd('0xf1')]):util[_0x51dd('0x2c')](_0x51dd('0x11f'),_[_0x51dd('0x46')](_0x5d82f3['TrunkBackup'])?_0x5d82f3['Trunk'][_0x51dd('0x2e')]:_0x5d82f3[_0x51dd('0x72')]['name'],_[_0x51dd('0x46')](_0x5d82f3[_0x51dd('0x11b')])?'':_0x5d82f3[_0x51dd('0x11b')][_0x51dd('0x11c')]()||'',_0x5d82f3[_0x51dd('0x11d')]>0x0?_0x35e415['phone']['substring'](_0x5d82f3[_0x51dd('0x11d')]):_0x35e415[_0x51dd('0xf1')]);var _0x23df50=_0x427b90['isTrunkReachable'](_0x5d82f3[_0x51dd('0x71')])?ut[_0x51dd('0x120')](_0x5d82f3['Trunk'][_0x51dd('0x121')],_0x5d82f3[_0x51dd('0x122')],_0x5d82f3['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x51dd('0x123')](_0x5d82f3['dialOriginateCallerIdNumber'],_0x5d82f3[_0x51dd('0x124')]):_0x5d82f3['dialOriginateCallerIdNumber']):ut[_0x51dd('0x120')](_[_0x51dd('0x46')](_0x5d82f3[_0x51dd('0x72')])?_0x5d82f3[_0x51dd('0x71')][_0x51dd('0x121')]:_0x5d82f3[_0x51dd('0x72')]['callerid'],_0x5d82f3[_0x51dd('0x122')],_0x5d82f3[_0x51dd('0x124')]>0x0?ut[_0x51dd('0x123')](_0x5d82f3['dialOriginateCallerIdNumber'],_0x5d82f3[_0x51dd('0x124')]):_0x5d82f3['dialOriginateCallerIdNumber']);if(_0x23df50){_0xce64de[_0x51dd('0x125')]=ut[_0x51dd('0x126')](_0x23df50);_0xce64de['originatecalleridnum']=ut[_0x51dd('0x127')](_0x23df50);}var _0x18d949=ut[_0x51dd('0x128')](_0x5d82f3,_0x35e415,_0x3409b0,_0x23df50,_0x1bb7c0,_0xce64de);var _0x499c28=utils[_0x51dd('0x129')](_0x35e415[_0x51dd('0xf0')]);Object['assign'](_0x18d949,_0x499c28);_[_0x51dd('0x12a')](_0xce64de,ut['toLowerVariables'](_0x18d949));_0xce64de[_0x51dd('0x12b')]=moment()[_0x51dd('0x2c')](_0x51dd('0x63'));_0x5d82f3[_0x51dd('0x12c')]=_0x18d949;var _0xff9c75=ut[_0x51dd('0x12d')](_0xce64de,_0x5d82f3,_0x18d949,_0xce64de[_0x51dd('0x86')],_0x183857);return ami[_0x51dd('0x4b')](_0xff9c75)[_0x51dd('0x5e')](function(_0x517da0){_0x5d82f3[_0x51dd('0x31')]+=0x1;logger[_0x51dd('0x2a')](_0x51dd('0x12e'),_0x1bb7c0,'\x20Queue',_0x5d82f3[_0x51dd('0x2e')],'originated:\x20',_0x5d82f3[_0x51dd('0x31')]);_0x106890(_0x517da0);})['catch'](function(_0x4df4b6){ut['logAgent'](_0xce64de,0xe,_0x51dd('0x12f'));rpcDb[_0x51dd('0xe6')](_0xce64de,'[originateFailure][logOriginateFailure]');_0x5ac4ba(_0x4df4b6);});});};Preview['prototype'][_0x51dd('0x23')]=function(_0x56a79d){if(this[_0x51dd('0x18')][_0x56a79d[_0x51dd('0x87')]]){this[_0x51dd('0x18')][_0x56a79d[_0x51dd('0x87')]]['channel']=_0x56a79d[_0x51dd('0x4d')];}};Preview['prototype']['syncOriginateResponse']=function(_0x4939f3){var _0x28b24a=this;var _0x4ea464=this[_0x51dd('0x18')][_0x4939f3[_0x51dd('0x130')]];if(_0x4ea464){if(_0x4ea464[_0x51dd('0x131')]&&this[_0x51dd('0x19')][_0x4ea464['lookAgent']]){ut[_0x51dd('0x132')](_0x4ea464,this[_0x51dd('0x19')][_0x4ea464[_0x51dd('0x131')]][_0x51dd('0x2e')],this[_0x51dd('0x19')][_0x4ea464[_0x51dd('0x131')]]['id']);}var _0xf0a376=_['clone'](_0x4ea464);_0xf0a376[_0x51dd('0x8d')]=moment()[_0x51dd('0x2c')](_0x51dd('0x63'));var _0x4490d0=_0x28b24a[_0x51dd('0x15')][_0x4ea464['queue']];if(ut[_0x51dd('0x133')](_0x4939f3['response'])){if(_0x4ea464[_0x51dd('0x85')]){rpcDb['unlockContact'](_0x4ea464['idContact']);}if(_0x4ea464['activeContact']){rpcDb[_0x51dd('0x62')](_0x4ea464[_0x51dd('0x89')]);}ami[_0x51dd('0x29')]('custom:agentringnoanswer',ut[_0x51dd('0x94')](_0x4ea464,_0x51dd('0x134'),this[_0x51dd('0x15')][_0x4ea464[_0x51dd('0x49')]]));this[_0x51dd('0xe1')](_0xf0a376,_0x4490d0,_0x4939f3);}else{_0x4ea464['starttime']=moment()['format'](_0x51dd('0x63'));ut[_0x51dd('0xe7')](_0xf0a376,0x4,'Answer');rpcDb['createAgentHistory'](_0xf0a376,_0x51dd('0x135'));}}};Preview[_0x51dd('0x11')][_0x51dd('0x136')]=function(_0x381856){var _0x301067=this[_0x51dd('0x18')][_0x381856[_0x51dd('0x87')]];var _0x52ff51;if(_0x301067){_0x52ff51=this[_0x51dd('0x15')][_0x301067[_0x51dd('0x49')]];logger['info'](_0x51dd('0x137'),_0x381856[_0x51dd('0x87')],_0x51dd('0xdf'),_0x52ff51['name'],_0x51dd('0x92'),_0x52ff51[_0x51dd('0x8f')]);}if(this[_0x51dd('0x18')][_0x381856[_0x51dd('0x87')]]&&_0x381856[_0x51dd('0x87')]!==_0x381856[_0x51dd('0x91')]){if(_0x381856[_0x51dd('0x138')]==='16'&&this['actions'][_0x381856[_0x51dd('0x87')]][_0x51dd('0x50')]){this[_0x51dd('0x139')](_0x381856,_0x381856[_0x51dd('0x87')],_0x381856[_0x51dd('0x138')]);}else if(this[_0x51dd('0x18')][_0x381856[_0x51dd('0x87')]][_0x51dd('0x50')]){logger[_0x51dd('0x2a')]('[syncHangup][talking][cause]',_0x381856[_0x51dd('0x87')],_0x381856['cause'],_0x51dd('0xdf'),_0x52ff51['name'],_0x51dd('0x92'),_0x52ff51[_0x51dd('0x8f')]);this[_0x51dd('0x139')](_0x381856,_0x381856[_0x51dd('0x87')],_0x381856[_0x51dd('0x138')]);}}else if(_0x301067&&_[_0x51dd('0x46')](_0x301067[_0x51dd('0x13a')])&&_0x52ff51[_0x51dd('0x13b')]&&_0x381856[_0x51dd('0x87')]===_0x381856[_0x51dd('0x91')]&&_[_0x51dd('0x46')](_0x381856['reason'])&&_0x381856[_0x51dd('0x138')]==='16'&&_0x381856[_0x51dd('0x13c')]==='6'&&_[_0x51dd('0xe2')](_0x301067[_0x51dd('0x13d')])){if(_0x301067[_0x51dd('0x85')]){rpcDb[_0x51dd('0x104')](_0x301067[_0x51dd('0x89')]);}if(_0x301067[_0x51dd('0x86')]){rpcDb['disableContact'](_0x301067['idContact']);}_0x381856[_0x51dd('0xe4')]='22';this[_0x51dd('0xe1')](_0x301067,_0x52ff51,_0x381856);}else if(_0x301067&&_0x301067['transfer']){if(_0x381856[_0x51dd('0x138')]==='16'&&this['actions'][_0x381856[_0x51dd('0x87')]][_0x51dd('0x50')]){logger[_0x51dd('0x2a')](_0x51dd('0x13e'),_0x381856[_0x51dd('0x87')],_0x381856[_0x51dd('0x138')],_0x51dd('0xdf'),_0x52ff51[_0x51dd('0x2e')],_0x51dd('0x92'),_0x52ff51[_0x51dd('0x8f')]);this[_0x51dd('0x139')](_0x381856,_0x381856['linkedid'],_0x381856['cause']);}else if(this[_0x51dd('0x18')][_0x381856[_0x51dd('0x87')]][_0x51dd('0x50')]){logger[_0x51dd('0x2a')](_0x51dd('0x13f'),_0x381856[_0x51dd('0x87')],_0x381856[_0x51dd('0x138')],'\x20Queue',_0x52ff51[_0x51dd('0x2e')],_0x51dd('0x92'),_0x52ff51[_0x51dd('0x8f')]);this[_0x51dd('0x139')](_0x381856,_0x381856[_0x51dd('0x87')],_0x381856['cause']);}}};Preview['prototype'][_0x51dd('0x21')]=function(_0x36a3e0){if(this[_0x51dd('0x18')][_0x36a3e0[_0x51dd('0xe0')]]&&_0x36a3e0[_0x51dd('0xe0')]!==_0x36a3e0[_0x51dd('0x140')]){this['callProgressDetectingCustomer'](_0x36a3e0,_0x36a3e0['destlinkedid'],_0x36a3e0['dialstatus']);}};Preview[_0x51dd('0x11')][_0x51dd('0x1f')]=function(_0x1b1ae7){if(this[_0x51dd('0x18')][_0x1b1ae7['linkedid']]&&_0x1b1ae7['linkedid']!==_0x1b1ae7[_0x51dd('0x91')]&&!this[_0x51dd('0x18')][_0x1b1ae7['linkedid']][_0x51dd('0x50')]){if(_0x1b1ae7[_0x51dd('0x138')]==='1'){this['callProgressDetectingCustomer'](_0x1b1ae7,_0x1b1ae7['linkedid'],_0x1b1ae7[_0x51dd('0x138')]);}}};Preview[_0x51dd('0x11')]['addVariable']=function(_0x1a1697,_0x2bba0d,_0x1b7591){if(this[_0x51dd('0x18')][_0x1a1697]){if(_[_0x51dd('0x46')](this['actions'][_0x1a1697][_0x51dd('0x12c')])){this[_0x51dd('0x18')][_0x1a1697][_0x51dd('0x12c')]={};}this[_0x51dd('0x18')][_0x1a1697][_0x51dd('0x12c')][_0x2bba0d]=_0x1b7591;}};Preview[_0x51dd('0x11')][_0x51dd('0x25')]=function(_0x1533ad){try{if(!_[_0x51dd('0x46')](_0x1533ad)){if(ut[_0x51dd('0x141')](_['keys'](_0x1533ad['variable'])[0x0])){this[_0x51dd('0x142')](_0x1533ad['uniqueid'],_[_0x51dd('0x143')](_0x1533ad[_0x51dd('0x144')])[0x0],_0x1533ad[_0x51dd('0x145')]);}}}catch(_0x571474){logger[_0x51dd('0x146')](_0x51dd('0x147'),util[_0x51dd('0x148')](_0x571474,{'showHidden':![],'depth':null}));}};Preview[_0x51dd('0x11')]['syncAttendedTransfer']=function(_0x58140a){if(_0x58140a){if(this[_0x51dd('0x18')][_0x58140a[_0x51dd('0x149')]]){this[_0x51dd('0x18')][_0x58140a[_0x51dd('0x149')]][_0x51dd('0x13d')]=!![];}}};Preview[_0x51dd('0x11')][_0x51dd('0x27')]=function(_0x33c56a){if(_0x33c56a){if(this[_0x51dd('0x18')][_0x33c56a[_0x51dd('0x14a')]]){this[_0x51dd('0x18')][_0x33c56a['transfererlinkedid']]['transfer']=!![];}}};module[_0x51dd('0x14b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6ff6224..9d5a9c0 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 _0x60f2=['moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','preview','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','resolve','then','catch','[createHistory]\x20'];(function(_0x31685d,_0x203f48){var _0x491db6=function(_0x4ece67){while(--_0x4ece67){_0x31685d['push'](_0x31685d['shift']());}};_0x491db6(++_0x203f48);}(_0x60f2,0xe4));var _0x260f=function(_0x3a93cc,_0x804c22){_0x3a93cc=_0x3a93cc-0x0;var _0x1f8154=_0x60f2[_0x3a93cc];return _0x1f8154;};'use strict';var util=require(_0x260f('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x260f('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x260f('0x2'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x260f('0x3'));var voiceQueueReport=require(_0x260f('0x4'));function loggerCatch(_0x36f3dd){return function(_0x16ddfc){logger[_0x260f('0x5')](_0x36f3dd,util[_0x260f('0x6')](_0x16ddfc,{'showHidden':![],'depth':null}));};}function create(_0x40483c){return cmHopperHistory[_0x260f('0x7')](_0x40483c)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x55f42e){return BPromise[_0x260f('0x8')]()[_0x260f('0x9')](agentReportPreview[_0x260f('0x7')](_0x55f42e))[_0x260f('0xa')](loggerCatch(_0x260f('0xb')));}function moveContact(_0x6ad2db){return cmHopper[_0x260f('0xc')](_0x6ad2db,!![])[_0x260f('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x260f('0xd')]=function(_0x96660d){return cmHopperBlack['checkIsBlackList'](_0x96660d)[_0x260f('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x34e4fd){return BPromise[_0x260f('0x8')]()[_0x260f('0x9')](cmHopper[_0x260f('0xe')](_0x34e4fd))['catch'](loggerCatch(_0x260f('0xf')));};exports[_0x260f('0x7')]=function(_0x4c85d1,_0x55632b){create(_0x4c85d1)[_0x260f('0xa')](loggerCatch(_0x55632b));moveContact(_0x4c85d1)[_0x260f('0xa')](loggerCatch(_0x55632b));};exports[_0x260f('0x10')]=function(_0x8d9ef6,_0x29969d){createAgent(_0x8d9ef6)['catch'](loggerCatch(_0x29969d));};exports[_0x260f('0x11')]=function(_0x234686,_0x7c3ca0){create(_0x234686)[_0x260f('0xa')](loggerCatch(_0x7c3ca0));};exports[_0x260f('0x12')]=function(_0x1bc85c,_0x1a5289){moveContact(_0x1bc85c)['catch'](loggerCatch(_0x1a5289));};exports[_0x260f('0x13')]=function(_0x456a64,_0x3f94cc,_0x1d46a5){if(_0x3f94cc){_0x456a64[_0x260f('0x14')]=null;}if(_0x1d46a5){_0x456a64[_0x260f('0x15')]=![];}return cmHopper[_0x260f('0x13')](_0x456a64)[_0x260f('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x260f('0x16')]=function(_0x372ce5){return cmHopper[_0x260f('0x16')](_0x372ce5)[_0x260f('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x260f('0x17')]=function(_0x5a6c2b){return cmHopper[_0x260f('0x17')]({'UserId':null},_0x5a6c2b,0x1)[_0x260f('0xa')](loggerCatch(_0x260f('0x18')));};exports[_0x260f('0x19')]=function(_0x4eb23a){return cmHopper[_0x260f('0x17')]({'active':![]},_0x4eb23a,0x1)[_0x260f('0xa')](loggerCatch(_0x260f('0x1a')));};exports['crateCustomerReportQueue']=function(_0x34393a){var _0x5e33d8={};_0x5e33d8[_0x260f('0x1b')]=_0x34393a[_0x260f('0x1b')];_0x5e33d8[_0x260f('0x1c')]=_0x34393a[_0x260f('0x1c')];_0x5e33d8[_0x260f('0x1d')]=_0x34393a[_0x260f('0x1d')];_0x5e33d8[_0x260f('0x1e')]=_0x34393a[_0x260f('0x1e')];_0x5e33d8[_0x260f('0x1f')]=_0x34393a[_0x260f('0x1f')];_0x5e33d8[_0x260f('0x20')]=_0x34393a[_0x260f('0x21')];_0x5e33d8[_0x260f('0x22')]=_0x34393a[_0x260f('0x21')];_0x5e33d8['queuecallercomplete']=0x1;_0x5e33d8['queuecallercompleteAt']=_0x34393a[_0x260f('0x23')];_0x5e33d8[_0x260f('0x24')]=_0x34393a[_0x260f('0x25')];_0x5e33d8['context']=_0x260f('0x26');_0x5e33d8[_0x260f('0x27')]=_0x260f('0x28');_0x5e33d8[_0x260f('0x29')]=0x0;_0x5e33d8['assigned']=0x1;_0x5e33d8['lastAssignedTo']=_0x34393a[_0x260f('0x25')];_0x5e33d8[_0x260f('0x2a')]=_0x260f('0x2b');return BPromise[_0x260f('0x8')]()[_0x260f('0x9')](voiceQueueReport[_0x260f('0x2c')](_0x5e33d8))[_0x260f('0xa')](loggerCatch(_0x260f('0x2d')));};exports[_0x260f('0x2e')]=function(_0x4c9c90,_0x1555db){return BPromise[_0x260f('0x8')]()[_0x260f('0x9')](cmHopper[_0x260f('0x2e')](_0x4c9c90,_0x1555db))['catch'](loggerCatch(_0x260f('0x2f')));};exports['rescheduleContactInQueue']=function(_0x262597){return cmHopper[_0x260f('0x13')](_0x262597,!![],!![])[_0x260f('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x5b14=['../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','membername','exten','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5b14,0x14a));var _0x45b1=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5b14[_0x2b4411];return _0x8e41ef;};'use strict';var util=require('util');var BPromise=require(_0x45b1('0x0'));var logger=require(_0x45b1('0x1'))(_0x45b1('0x2'));var cmHopper=require(_0x45b1('0x3'));var cmHopperHistory=require(_0x45b1('0x4'));var cmHopperBlack=require(_0x45b1('0x5'));var agentReportPreview=require(_0x45b1('0x6'));var voiceQueueReport=require(_0x45b1('0x7'));function loggerCatch(_0x4890fa){return function(_0x189736){logger['error'](_0x4890fa,util[_0x45b1('0x8')](_0x189736,{'showHidden':![],'depth':null}));};}function create(_0x6d0345){return cmHopperHistory[_0x45b1('0x9')](_0x6d0345)[_0x45b1('0xa')](loggerCatch(_0x45b1('0xb')));}function createAgent(_0x211353){return BPromise[_0x45b1('0xc')]()[_0x45b1('0xd')](agentReportPreview[_0x45b1('0x9')](_0x211353))[_0x45b1('0xa')](loggerCatch(_0x45b1('0xb')));}function moveContact(_0x11031d){return cmHopper[_0x45b1('0xe')](_0x11031d,!![])[_0x45b1('0xa')](loggerCatch(_0x45b1('0xf')));}exports[_0x45b1('0x10')]=function(_0x2b4989){return cmHopperBlack[_0x45b1('0x10')](_0x2b4989)['catch'](loggerCatch(_0x45b1('0x11')));};exports[_0x45b1('0x12')]=function(_0x80f6f){return BPromise[_0x45b1('0xc')]()[_0x45b1('0xd')](cmHopper[_0x45b1('0x12')](_0x80f6f))[_0x45b1('0xa')](loggerCatch(_0x45b1('0x13')));};exports['createHistory']=function(_0x28fe6b,_0x5331e9){create(_0x28fe6b)[_0x45b1('0xa')](loggerCatch(_0x5331e9));moveContact(_0x28fe6b)['catch'](loggerCatch(_0x5331e9));};exports[_0x45b1('0x14')]=function(_0x52362c,_0x5d28cb){createAgent(_0x52362c)[_0x45b1('0xa')](loggerCatch(_0x5d28cb));};exports[_0x45b1('0x15')]=function(_0x5d3cb3,_0xb952c8){create(_0x5d3cb3)[_0x45b1('0xa')](loggerCatch(_0xb952c8));};exports[_0x45b1('0x16')]=function(_0x1bbe48,_0x57621b){moveContact(_0x1bbe48)[_0x45b1('0xa')](loggerCatch(_0x57621b));};exports[_0x45b1('0x17')]=function(_0x2576b5,_0x5d00d5,_0x258d6e){if(_0x5d00d5){_0x2576b5['UserId']=null;}if(_0x258d6e){_0x2576b5['active']=![];}return cmHopper[_0x45b1('0x17')](_0x2576b5)[_0x45b1('0xa')](loggerCatch(_0x45b1('0x18')));};exports[_0x45b1('0x19')]=function(_0x1a288b){return cmHopper[_0x45b1('0x19')](_0x1a288b)['catch'](loggerCatch(_0x45b1('0x1a')));};exports[_0x45b1('0x1b')]=function(_0x4484ff){return cmHopper[_0x45b1('0x1b')]({'UserId':null},_0x4484ff,0x1)[_0x45b1('0xa')](loggerCatch(_0x45b1('0x1c')));};exports[_0x45b1('0x1d')]=function(_0x81243){return cmHopper[_0x45b1('0x1b')]({'active':![]},_0x81243,0x1)[_0x45b1('0xa')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x4556d2){var _0x406461={};_0x406461['type']=_0x4556d2['type'];_0x406461[_0x45b1('0x1e')]=_0x4556d2[_0x45b1('0x1e')];_0x406461['calleridnum']=_0x4556d2[_0x45b1('0x1f')];_0x406461[_0x45b1('0x20')]=_0x4556d2[_0x45b1('0x20')];_0x406461[_0x45b1('0x21')]=_0x4556d2[_0x45b1('0x21')];_0x406461['queuecallerjoinAt']=_0x4556d2[_0x45b1('0x22')];_0x406461[_0x45b1('0x23')]=_0x4556d2['answertime'];_0x406461['queuecallercomplete']=0x1;_0x406461[_0x45b1('0x24')]=_0x4556d2[_0x45b1('0x25')];_0x406461['connectedlinename']=_0x4556d2[_0x45b1('0x26')];_0x406461['context']='from-sip';_0x406461[_0x45b1('0x27')]='xcally-motion-preview';_0x406461['holdtime']=0x0;_0x406461[_0x45b1('0x28')]=0x1;_0x406461[_0x45b1('0x29')]=_0x4556d2['membername'];_0x406461[_0x45b1('0x2a')]=_0x45b1('0x2b');return BPromise['resolve']()[_0x45b1('0xd')](voiceQueueReport[_0x45b1('0x2c')](_0x406461))['catch'](loggerCatch(_0x45b1('0x2d')));};exports['getContactRecallMe']=function(_0x1bd7bb,_0x4e41d0){return BPromise[_0x45b1('0xc')]()[_0x45b1('0xd')](cmHopper[_0x45b1('0x2e')](_0x1bd7bb,_0x4e41d0))[_0x45b1('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x45b1('0x2f')]=function(_0x50de2a){return cmHopper[_0x45b1('0x17')](_0x50de2a,!![],!![])[_0x45b1('0xa')](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 8ac34a8..1d1c3f5 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 _0x9bb5=['uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','Global','scheduledAt','active','scheduledat','minutes','ContactId','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','queue','motionChannel','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','not_inuse','push','milliseconds','CampaignId','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','env','XCALLY_IP_AGI','../../dialer/utils','error','logger','info','loggerError','inspect','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','responsetime','getSeconds','starttime','logLookAgent','membername','UserId','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','xcally-motion-preview','from-sip','timeout'];(function(_0x29c86a,_0x52ee0e){var _0x6727e=function(_0x10110a){while(--_0x10110a){_0x29c86a['push'](_0x29c86a['shift']());}};_0x6727e(++_0x52ee0e);}(_0x9bb5,0x1ba));var _0x59bb=function(_0x4c14a7,_0x550e7d){_0x4c14a7=_0x4c14a7-0x0;var _0x563a39=_0x9bb5[_0x4c14a7];return _0x563a39;};'use strict';var util=require(_0x59bb('0x0'));var _=require(_0x59bb('0x1'));var moment=require(_0x59bb('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x59bb('0x3')][_0x59bb('0x4')]||'127.0.0.1';var utils=require(_0x59bb('0x5'));exports['loggerCatch']=function(_0x1ce7c0){return function(_0x26ffb5){logger[_0x59bb('0x6')](_0x1ce7c0,util['inspect'](_0x26ffb5,{'showHidden':![],'depth':null}));};};exports[_0x59bb('0x7')]=function(_0x3ff896,_0x4808f1){logger[_0x59bb('0x8')](_0x3ff896,util['inspect'](_0x4808f1,{'showHidden':![],'depth':null}));};exports[_0x59bb('0x9')]=function(_0x4e854f,_0x3d25a7){logger[_0x59bb('0x6')](_0x4e854f,util[_0x59bb('0xa')](_0x3d25a7,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x102ce7){return function(_0x3ed9ba){logger[_0x59bb('0x8')](_0x102ce7,util[_0x59bb('0xa')](_0x3ed9ba,{'showHidden':![],'depth':null}));};};exports[_0x59bb('0xb')]=function(_0x1fe341,_0x62eff6,_0x2b79ec){return{'message':_0x1fe341,'unlock':_0x62eff6,'active':_0x2b79ec};};exports[_0x59bb('0xc')]=function(_0x3e4535,_0x55806c,_0x11aa8b){if(!_[_0x59bb('0xd')](_0x11aa8b)&&_0x59bb('0xe')===typeof _0x11aa8b&&!_[_0x59bb('0xf')](_0x11aa8b)){if(!_['isUndefined'](_0x55806c)&&'string'===typeof _0x55806c&&!_[_0x59bb('0xf')](_0x55806c)){return util['format']('\x22%s\x22\x20<%s>',_0x55806c,_0x11aa8b);}return util[_0x59bb('0x10')](_0x59bb('0x11'),_0x11aa8b,_0x11aa8b);}if(!_[_0x59bb('0xd')](_0x3e4535)&&_0x59bb('0xe')===typeof _0x3e4535&&!_[_0x59bb('0xf')](_0x3e4535)){return _0x3e4535;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x130e00){if(_[_0x59bb('0x12')](_0x130e00)){return![];}return _0x130e00;};exports[_0x59bb('0x13')]=function(_0x1054f8,_0x3f3c46,_0x55e769,_0xff489f,_0x5f0165,_0x2c7913){var _0x1cb16f={'XMD-QUEUE':_0x3f3c46['Queue']?_0x3f3c46[_0x59bb('0x14')][_0x59bb('0x15')]:'','XMD-CALLERID':_0xff489f,'XMD-CALLERID-PREVIEW':_0x2c7913?util[_0x59bb('0x10')]('\x22%s\x22\x20<%s>',_0x2c7913[_0x59bb('0x16')],_0x2c7913[_0x59bb('0x17')]):_0xff489f,'XMD-DIALID':_0x5f0165,'XMD-CONTACTID':_0x3f3c46['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xff489f,'XMD-VOICEQUEUEID':_0x3f3c46[_0x59bb('0x18')],'XMD-DIALCHANNEL':_0x55e769,'XMD-DIALTIMEOUT':_0x1054f8[_0x59bb('0x19')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x59bb('0x1a'),_0x1054f8[_0x59bb('0x1b')]?'g':'',_[_0x59bb('0xf')](_0x1054f8[_0x59bb('0x1c')])?'':_0x59bb('0x1d')),'XMD-DIALURL':_0x1054f8[_0x59bb('0x1e')]||'','XMD-AGI':_0x1054f8[_0x59bb('0x1f')]?util[_0x59bb('0x10')](_0x59bb('0x20'),ipAgi,_0x1054f8[_0x59bb('0x1f')]):_0x59bb('0x21'),'XMD-AGIAFTER':_0x1054f8[_0x59bb('0x1b')]?util[_0x59bb('0x10')](_0x59bb('0x20'),ipAgi,_0x1054f8[_0x59bb('0x1b')]):_0x59bb('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2c7913?_0x2c7913[_0x59bb('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2c7913?_0x2c7913[_0x59bb('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x59bb('0x24')};if(!_['isEmpty'](_0x1054f8['monitor_format'])){_0x1cb16f[util[_0x59bb('0x10')]('%s',_0x59bb('0x25'))]=_0x1054f8['monitor_format'];_0x1cb16f[util[_0x59bb('0x10')]('%s',_0x59bb('0x26'))]=_0x5f0165;}return _0x1cb16f;};exports[_0x59bb('0x27')]=function(_0x574b68){var _0x301fce={};for(var _0x12edb5 in _0x574b68){if(_0x574b68['hasOwnProperty'](_0x12edb5)){_0x301fce[util[_0x59bb('0x10')]('%s',_[_0x59bb('0x28')](_0x12edb5))]=_0x574b68[_0x12edb5];}}return{'variables':_0x301fce};};exports['logBlacklist']=function(_0x44dc82){var _0x34d5ec=moment()['format'](_0x59bb('0x29'));_0x44dc82[_0x59bb('0x2a')]=0xd;_0x44dc82[_0x59bb('0x2b')]='Blacklist';_0x44dc82['starttime']=_0x34d5ec;_0x44dc82['responsetime']=_0x34d5ec;_0x44dc82[_0x59bb('0x2c')]=_0x34d5ec;};exports['logAgent']=function(_0x376de1,_0x40bb9d,_0x2e64d4){var _0x5c9a0b=moment()[_0x59bb('0x10')](_0x59bb('0x29'));_0x376de1['state']=_0x40bb9d;_0x376de1[_0x59bb('0x2b')]=_0x2e64d4;_0x376de1[_0x59bb('0x2d')]=_0x5c9a0b;_0x376de1['ringtime']=utils[_0x59bb('0x2e')](_0x376de1[_0x59bb('0x2d')],_0x376de1[_0x59bb('0x2f')]);};exports[_0x59bb('0x30')]=function(_0x2e6c07,_0x6ccb45,_0x284c13){_0x2e6c07[_0x59bb('0x31')]=_0x6ccb45;_0x2e6c07[_0x59bb('0x32')]=_0x284c13;};exports['logCustomer']=function(_0x103764,_0x4c26a2,_0x41187e){var _0x265c0b=moment()[_0x59bb('0x10')](_0x59bb('0x29'));_0x103764['state']=_0x4c26a2;_0x103764[_0x59bb('0x2b')]=_0x41187e;_0x103764[_0x59bb('0x2d')]=_0x103764[_0x59bb('0x2d')]?_0x103764['responsetime']:_0x265c0b;_0x103764[_0x59bb('0x2c')]=_0x103764[_0x59bb('0x2c')]?_0x103764[_0x59bb('0x2c')]:_0x265c0b;_0x103764['ringtime']=utils[_0x59bb('0x2e')](_0x103764['responsetime']||0x0,_0x103764['starttime']||0x0);_0x103764[_0x59bb('0x33')]=_0x103764[_0x59bb('0x34')]?utils[_0x59bb('0x2e')](_0x103764['endtime'],_0x103764[_0x59bb('0x34')]):0x0;};exports['isFailure']=function(_0x1dbff0){return _0x1dbff0===_0x59bb('0x35');};exports[_0x59bb('0x36')]=function(_0x50bddc,_0x40564e,_0xb79827,_0x3ae977,_0x266821){var _0x3bf272=_0x3ae977?_0x59bb('0x37'):_0x50bddc['calleridname'];_0x3bf272=_0x266821?_0x59bb('0x38'):_0x3bf272;return{'actionid':_0x50bddc['uniqueid'],'action':_0x59bb('0x39'),'channel':_0x50bddc[_0x59bb('0x3a')],'callerid':util[_0x59bb('0x10')](_0x59bb('0x11'),_0x3bf272,_0x50bddc[_0x59bb('0x17')]),'Exten':_0x59bb('0x3b'),'Context':_0x59bb('0x3c'),'Priority':'1','variable':_0xb79827,'timeout':(_0x40564e[_0x59bb('0x3d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x50bddc[_0x59bb('0x3e')]};};exports[_0x59bb('0x3f')]=function(_0x6ba3c2){return _0x6ba3c2[_0x59bb('0x40')]+_0x6ba3c2[_0x59bb('0x41')]+_0x6ba3c2[_0x59bb('0x42')]+_0x6ba3c2[_0x59bb('0x43')]+_0x6ba3c2['countnosuchnumberretry'];};exports['cloneAction']=function(_0x254a85){var _0x1d20db=_['clone'](_0x254a85);_0x1d20db[_0x59bb('0x2a')]=0xf;_0x1d20db['statedesc']=_0x59bb('0x44');return _0x1d20db;};exports[_0x59bb('0x45')]=function(_0x50a2cd,_0x325d97,_0x574bf1){var _0x1bfd21={};_0x1bfd21[_0x325d97]=_0x50a2cd[_0x325d97];_0x1bfd21[_0x59bb('0x46')]=![];_0x1bfd21[_0x59bb('0x47')]=moment()['add'](_0x574bf1,_0x59bb('0x48'))[_0x59bb('0x10')](_0x59bb('0x29'));_0x1bfd21[_0x59bb('0x49')]=_0x50a2cd[_0x59bb('0x49')];_0x1bfd21[_0x59bb('0x4a')]=_0x50a2cd[_0x59bb('0x4a')];_0x1bfd21[_0x59bb('0x18')]=_0x50a2cd[_0x59bb('0x18')]||undefined;return _0x1bfd21;};exports[_0x59bb('0x4b')]=function(_0xd9f579,_0xd7fc61){if(!_['isNil'](_0xd9f579)){if(_0xd9f579[_0x59bb('0x4c')]>0x0){_0xd9f579[_0x59bb('0x4c')]-=0x1;}else{logger[_0x59bb('0x8')](_0xd7fc61,_0x59bb('0x4d'));}}else{logger[_0x59bb('0x6')](_0xd7fc61,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5348c6){if(_0x5348c6<=0x0){return!![];}return![];};function buildObj(_0x35e904,_0x104123,_0x2c6efd){_0x35e904['lastevent']=_0x104123;_0x35e904['name']=_0x35e904[_0x59bb('0x4e')];_0x35e904['interface']=_0x35e904[_0x59bb('0x3a')];_0x35e904[_0x59bb('0x4f')]='voice';if(_0x2c6efd){_0x35e904[_0x59bb('0x50')]=_0x2c6efd['mandatoryDisposition'];}return _0x35e904;}exports[_0x59bb('0x51')]=buildObj;exports[_0x59bb('0x52')]=function(_0x23c46d){var _0x5c6797=[];for(var _0x5b1886 in _0x23c46d){if(_0x23c46d[_0x59bb('0x53')](_0x5b1886)){if(!_[_0x59bb('0x12')](_0x23c46d[_0x5b1886])&&_0x23c46d[_0x5b1886]['state']===_0x59bb('0x54')&&_0x23c46d[_0x5b1886]['status']==='reachable'){_0x5c6797[_0x59bb('0x55')](_0x23c46d[_0x5b1886]['id']);}}}return _0x5c6797;};exports['getDiff']=function(_0x4850a4){var _0x495ac7=moment()[_0x59bb('0x56')](0x0);var _0x35c7d6=moment(_0x4850a4)[_0x59bb('0x56')](0x0);return _0x495ac7['diff'](_0x35c7d6,'seconds');};exports['createBody']=function(_0x446259){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x446259[_0x59bb('0x49')],'ListId':_0x446259[_0x59bb('0x4a')],'VoiceQueueId':_0x446259['VoiceQueueId']||undefined,'CampaignId':_0x446259[_0x59bb('0x57')]||undefined};};exports['filterKey']=function(_0x4bcf54){if(_0x4bcf54===_0x59bb('0x3e')||_0x4bcf54==='idContact'||_0x4bcf54===_0x59bb('0x4e')||_0x4bcf54===_0x59bb('0x58')||_0x4bcf54===_0x59bb('0x59')||_0x4bcf54===_0x59bb('0x5a')||_0x4bcf54===_0x59bb('0x31')||_0x4bcf54===_0x59bb('0x3a')||_0x4bcf54==='calleridname'||_0x4bcf54===_0x59bb('0x46')||_0x4bcf54==='calleridnum'||_0x4bcf54===_0x59bb('0x47')||_0x4bcf54===_0x59bb('0x40')||_0x4bcf54===_0x59bb('0x41')||_0x4bcf54===_0x59bb('0x42')||_0x4bcf54===_0x59bb('0x5b')||_0x4bcf54===_0x59bb('0x5c')||_0x4bcf54===_0x59bb('0x5d')||_0x4bcf54===_0x59bb('0x5e')||_0x4bcf54===_0x59bb('0x5f')||_0x4bcf54===_0x59bb('0x49')||_0x4bcf54===_0x59bb('0x4a')||_0x4bcf54===_0x59bb('0x32')||_0x4bcf54===_0x59bb('0x18')||_0x4bcf54===_0x59bb('0x60')||_0x4bcf54===_0x59bb('0x61')||_0x4bcf54===_0x59bb('0x62')||_0x4bcf54===_0x59bb('0x63')||_0x4bcf54==='xmd-listid'||_0x4bcf54===_0x59bb('0x64')||_0x4bcf54==='xmd-dialtimeout'||_0x4bcf54==='xmd-dialoptions'||_0x4bcf54==='xmd-dialid'||_0x4bcf54==='xmd-dialchannel'||_0x4bcf54===_0x59bb('0x65')||_0x4bcf54===_0x59bb('0x66')||_0x4bcf54==='xmd-callerid'||_0x4bcf54===_0x59bb('0x67')||_0x4bcf54==='xmd-agi'||_0x4bcf54===_0x59bb('0x68')||_0x4bcf54===_0x59bb('0x69')||_0x4bcf54===_0x59bb('0x6a')||_0x4bcf54===_0x59bb('0x6b')||_0x4bcf54===_0x59bb('0x6c')||_0x4bcf54===_0x59bb('0x6d')||_0x4bcf54===_0x59bb('0x6e')||_0x4bcf54===_0x59bb('0x6f')||_0x4bcf54===_0x59bb('0x68')||_0x4bcf54==='rtpaudioqosbridged'||_0x4bcf54===_0x59bb('0x6a')||_0x4bcf54===_0x59bb('0x6b')||_0x4bcf54==='rtpaudioqosloss'||_0x4bcf54===_0x59bb('0x6d')||_0x4bcf54===_0x59bb('0x6e')||_0x4bcf54===_0x59bb('0x6f')||_0x4bcf54===_0x59bb('0x70')||_0x4bcf54==='bridgepvtcallid'||_0x4bcf54===_0x59bb('0x2a')||_0x4bcf54==='statedesc'){return![];}return!![];};exports[_0x59bb('0x71')]=function(_0x483d34,_0x1a0268){var _0x4a4b3a,_0x4bb05c,_0x1b9214;if(_0x1a0268<=0x0){_0x1a0268=0x1;}_0x4a4b3a=new RegExp('\x5cw{0,'+_0x1a0268+'}$');_0x4bb05c=Math[_0x59bb('0x72')](0xa,_0x1a0268-0x1);_0x1b9214=Math[_0x59bb('0x72')](0xa,_0x1a0268)-0x1;return util[_0x59bb('0x10')]('%s',_[_0x59bb('0x73')](_0x483d34,_0x4a4b3a,_[_0x59bb('0x74')](_0x4bb05c,_0x1b9214)));};exports[_0x59bb('0x75')]=function(_0x37443f){var _0x4d1487=_0x37443f[_0x59bb('0x76')](/"(.*?)"/);return _0x4d1487?_0x4d1487[0x1]:_0x37443f;};exports[_0x59bb('0x77')]=function(_0x561c53){var _0x15d740=_0x561c53[_0x59bb('0x76')](/<(.*?)>/);return _0x15d740?_0x15d740[0x1]:_0x561c53;};function buildNoAnswerEventPayload(_0x2de748,_0x448b4a){var _0x385f1a=buildObj(_0x2de748,_0x59bb('0x78'));if(!_['isEmpty'](_0x448b4a[_0x59bb('0x79')])){Object[_0x59bb('0x7a')](_0x448b4a[_0x59bb('0x79')])[_0x59bb('0x7b')](function(_0x300854){_0x385f1a[_0x300854[_0x59bb('0x7c')]()]=_0x448b4a[_0x59bb('0x79')][_0x300854];});}return _0x385f1a;}exports[_0x59bb('0x7d')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xf647=['countagentrejectretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push','milliseconds','diff','CampaignId','filterKey','idContact','type','countbusyretry','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','replace','random','match','extractCalleridNumber','noanswer','variables','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','getSeconds','membername','UserId','logCustomer','statedesc','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry'];(function(_0x5018c7,_0x2e7e3f){var _0x477ec2=function(_0x63083d){while(--_0x63083d){_0x5018c7['push'](_0x5018c7['shift']());}};_0x477ec2(++_0x2e7e3f);}(_0xf647,0x159));var _0x7f64=function(_0x1b6f25,_0x48432a){_0x1b6f25=_0x1b6f25-0x0;var _0x3af0d2=_0xf647[_0x1b6f25];return _0x3af0d2;};'use strict';var util=require(_0x7f64('0x0'));var _=require(_0x7f64('0x1'));var moment=require(_0x7f64('0x2'));var logger=require(_0x7f64('0x3'))(_0x7f64('0x4'));var ipAgi=process[_0x7f64('0x5')][_0x7f64('0x6')]||_0x7f64('0x7');var utils=require('../../dialer/utils');exports[_0x7f64('0x8')]=function(_0x4ffda0){return function(_0x295c1a){logger[_0x7f64('0x9')](_0x4ffda0,util[_0x7f64('0xa')](_0x295c1a,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x56ab76,_0x2e3251){logger[_0x7f64('0xb')](_0x56ab76,util[_0x7f64('0xa')](_0x2e3251,{'showHidden':![],'depth':null}));};exports[_0x7f64('0xc')]=function(_0x55ba3d,_0x5b0d3c){logger[_0x7f64('0x9')](_0x55ba3d,util['inspect'](_0x5b0d3c,{'showHidden':![],'depth':null}));};exports[_0x7f64('0xd')]=function(_0x41e4ac){return function(_0x32f462){logger[_0x7f64('0xb')](_0x41e4ac,util[_0x7f64('0xa')](_0x32f462,{'showHidden':![],'depth':null}));};};exports[_0x7f64('0xe')]=function(_0x57b988,_0x4ff86c,_0x4f41f8){return{'message':_0x57b988,'unlock':_0x4ff86c,'active':_0x4f41f8};};exports[_0x7f64('0xf')]=function(_0x53bc95,_0x1e10fa,_0x323244){if(!_[_0x7f64('0x10')](_0x323244)&&_0x7f64('0x11')===typeof _0x323244&&!_['isEmpty'](_0x323244)){if(!_[_0x7f64('0x10')](_0x1e10fa)&&_0x7f64('0x11')===typeof _0x1e10fa&&!_[_0x7f64('0x12')](_0x1e10fa)){return util['format'](_0x7f64('0x13'),_0x1e10fa,_0x323244);}return util[_0x7f64('0x14')](_0x7f64('0x13'),_0x323244,_0x323244);}if(!_[_0x7f64('0x10')](_0x53bc95)&&'string'===typeof _0x53bc95&&!_['isEmpty'](_0x53bc95)){return _0x53bc95;}return _0x7f64('0x15');};exports[_0x7f64('0x16')]=function(_0x25dbe3){if(_[_0x7f64('0x17')](_0x25dbe3)){return![];}return _0x25dbe3;};exports['addVariables']=function(_0x3f775a,_0x185639,_0x137c82,_0x55fe61,_0x3d2452,_0x53c231){var _0x235622={'XMD-QUEUE':_0x185639['Queue']?_0x185639[_0x7f64('0x18')][_0x7f64('0x19')]:'','XMD-CALLERID':_0x55fe61,'XMD-CALLERID-PREVIEW':_0x53c231?util[_0x7f64('0x14')]('\x22%s\x22\x20<%s>',_0x53c231[_0x7f64('0x1a')],_0x53c231[_0x7f64('0x1b')]):_0x55fe61,'XMD-DIALID':_0x3d2452,'XMD-CONTACTID':_0x185639['ContactId'],'XMD-CDRTYPE':_0x7f64('0x1c'),'CALLERID(all)':_0x55fe61,'XMD-VOICEQUEUEID':_0x185639[_0x7f64('0x1d')],'XMD-DIALCHANNEL':_0x137c82,'XMD-DIALTIMEOUT':_0x3f775a[_0x7f64('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x7f64('0x14')](_0x7f64('0x1f'),_0x3f775a['dialQueueProject2']?'g':'',_[_0x7f64('0x12')](_0x3f775a[_0x7f64('0x20')])?'':_0x7f64('0x21')),'XMD-DIALURL':_0x3f775a[_0x7f64('0x22')]||'','XMD-AGI':_0x3f775a[_0x7f64('0x23')]?util['format'](_0x7f64('0x24'),ipAgi,_0x3f775a[_0x7f64('0x23')]):'NONE','XMD-AGIAFTER':_0x3f775a[_0x7f64('0x25')]?util[_0x7f64('0x14')](_0x7f64('0x24'),ipAgi,_0x3f775a[_0x7f64('0x25')]):_0x7f64('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x53c231?_0x53c231[_0x7f64('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x53c231?_0x53c231[_0x7f64('0x28')]:'','XMD-DESTINATION':_0x7f64('0x29'),'SIPADDHEADER':_0x7f64('0x2a')};if(!_[_0x7f64('0x12')](_0x3f775a[_0x7f64('0x20')])){_0x235622[util[_0x7f64('0x14')]('%s',_0x7f64('0x2b'))]=_0x3f775a[_0x7f64('0x20')];_0x235622[util[_0x7f64('0x14')]('%s',_0x7f64('0x2c'))]=_0x3d2452;}return _0x235622;};exports[_0x7f64('0x2d')]=function(_0x10383a){var _0x5b5af3={};for(var _0x394c5e in _0x10383a){if(_0x10383a[_0x7f64('0x2e')](_0x394c5e)){_0x5b5af3[util[_0x7f64('0x14')]('%s',_[_0x7f64('0x2f')](_0x394c5e))]=_0x10383a[_0x394c5e];}}return{'variables':_0x5b5af3};};exports[_0x7f64('0x30')]=function(_0x42fb34){var _0x31e9b8=moment()[_0x7f64('0x14')](_0x7f64('0x31'));_0x42fb34['state']=0xd;_0x42fb34['statedesc']=_0x7f64('0x32');_0x42fb34[_0x7f64('0x33')]=_0x31e9b8;_0x42fb34[_0x7f64('0x34')]=_0x31e9b8;_0x42fb34[_0x7f64('0x35')]=_0x31e9b8;};exports[_0x7f64('0x36')]=function(_0x197183,_0x39f91c,_0x1b857b){var _0x37c246=moment()[_0x7f64('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x197183[_0x7f64('0x37')]=_0x39f91c;_0x197183['statedesc']=_0x1b857b;_0x197183[_0x7f64('0x34')]=_0x37c246;_0x197183[_0x7f64('0x38')]=utils[_0x7f64('0x39')](_0x197183[_0x7f64('0x34')],_0x197183[_0x7f64('0x33')]);};exports['logLookAgent']=function(_0x31b757,_0x2ea55b,_0x3ad978){_0x31b757[_0x7f64('0x3a')]=_0x2ea55b;_0x31b757[_0x7f64('0x3b')]=_0x3ad978;};exports[_0x7f64('0x3c')]=function(_0x12e760,_0x2138a4,_0x345bff){var _0x3afde7=moment()[_0x7f64('0x14')](_0x7f64('0x31'));_0x12e760[_0x7f64('0x37')]=_0x2138a4;_0x12e760[_0x7f64('0x3d')]=_0x345bff;_0x12e760[_0x7f64('0x34')]=_0x12e760[_0x7f64('0x34')]?_0x12e760[_0x7f64('0x34')]:_0x3afde7;_0x12e760['endtime']=_0x12e760[_0x7f64('0x35')]?_0x12e760[_0x7f64('0x35')]:_0x3afde7;_0x12e760[_0x7f64('0x38')]=utils[_0x7f64('0x39')](_0x12e760[_0x7f64('0x34')]||0x0,_0x12e760[_0x7f64('0x33')]||0x0);_0x12e760['talktime']=_0x12e760[_0x7f64('0x3e')]?utils[_0x7f64('0x39')](_0x12e760[_0x7f64('0x35')],_0x12e760[_0x7f64('0x3e')]):0x0;};exports[_0x7f64('0x3f')]=function(_0x5f5d56){return _0x5f5d56===_0x7f64('0x40');};exports[_0x7f64('0x41')]=function(_0x246665,_0x2485e0,_0x404a88,_0xa05b1a,_0x15ac30){var _0x1e85b7=_0xa05b1a?_0x7f64('0x42'):_0x246665['calleridname'];_0x1e85b7=_0x15ac30?'BOOKED':_0x1e85b7;return{'actionid':_0x246665[_0x7f64('0x43')],'action':_0x7f64('0x44'),'channel':_0x246665[_0x7f64('0x45')],'callerid':util[_0x7f64('0x14')]('\x22%s\x22\x20<%s>',_0x1e85b7,_0x246665[_0x7f64('0x1b')]),'Exten':_0x7f64('0x29'),'Context':_0x7f64('0x46'),'Priority':'1','variable':_0x404a88,'timeout':(_0x2485e0[_0x7f64('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x246665[_0x7f64('0x43')]};};exports[_0x7f64('0x48')]=function(_0x189c2e){return _0x189c2e['countbusyretry']+_0x189c2e[_0x7f64('0x49')]+_0x189c2e[_0x7f64('0x4a')]+_0x189c2e[_0x7f64('0x4b')]+_0x189c2e['countnosuchnumberretry'];};exports['cloneAction']=function(_0x4409f9){var _0x20a0cc=_[_0x7f64('0x4c')](_0x4409f9);_0x20a0cc[_0x7f64('0x37')]=0xf;_0x20a0cc[_0x7f64('0x3d')]=_0x7f64('0x4d');return _0x20a0cc;};exports[_0x7f64('0x4e')]=function(_0x4067b7,_0x8e4d44,_0x29ca72){var _0x2b098b={};_0x2b098b[_0x8e4d44]=_0x4067b7[_0x8e4d44];_0x2b098b[_0x7f64('0x4f')]=![];_0x2b098b[_0x7f64('0x50')]=moment()[_0x7f64('0x51')](_0x29ca72,_0x7f64('0x52'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2b098b[_0x7f64('0x53')]=_0x4067b7['ContactId'];_0x2b098b[_0x7f64('0x54')]=_0x4067b7['ListId'];_0x2b098b[_0x7f64('0x1d')]=_0x4067b7[_0x7f64('0x1d')]||undefined;return _0x2b098b;};exports[_0x7f64('0x55')]=function(_0x331d79,_0x2f61ab){if(!_[_0x7f64('0x17')](_0x331d79)){if(_0x331d79[_0x7f64('0x56')]>0x0){_0x331d79['pTalking']-=0x1;}else{logger['info'](_0x2f61ab,_0x7f64('0x57'));}}else{logger['error'](_0x2f61ab,_0x7f64('0x58'));}};exports[_0x7f64('0x59')]=function(_0x4238c8){if(_0x4238c8<=0x0){return!![];}return![];};function buildObj(_0x220e7a,_0x170444,_0x42d757){_0x220e7a[_0x7f64('0x5a')]=_0x170444;_0x220e7a[_0x7f64('0x19')]=_0x220e7a[_0x7f64('0x5b')];_0x220e7a['interface']=_0x220e7a[_0x7f64('0x45')];_0x220e7a[_0x7f64('0x5c')]=_0x7f64('0x5d');if(_0x42d757){_0x220e7a[_0x7f64('0x5e')]=_0x42d757[_0x7f64('0x5e')];}return _0x220e7a;}exports['buildObj']=buildObj;exports[_0x7f64('0x5f')]=function(_0x30d24b){var _0x2a1848=[];for(var _0x400504 in _0x30d24b){if(_0x30d24b[_0x7f64('0x2e')](_0x400504)){if(!_[_0x7f64('0x17')](_0x30d24b[_0x400504])&&_0x30d24b[_0x400504]['state']===_0x7f64('0x60')&&_0x30d24b[_0x400504][_0x7f64('0x61')]===_0x7f64('0x62')){_0x2a1848[_0x7f64('0x63')](_0x30d24b[_0x400504]['id']);}}}return _0x2a1848;};exports['getDiff']=function(_0x46d60f){var _0x3261bc=moment()['milliseconds'](0x0);var _0x6ca8be=moment(_0x46d60f)[_0x7f64('0x64')](0x0);return _0x3261bc[_0x7f64('0x65')](_0x6ca8be,'seconds');};exports['createBody']=function(_0x16bdee){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x16bdee[_0x7f64('0x53')],'ListId':_0x16bdee[_0x7f64('0x54')],'VoiceQueueId':_0x16bdee[_0x7f64('0x1d')]||undefined,'CampaignId':_0x16bdee[_0x7f64('0x66')]||undefined};};exports[_0x7f64('0x67')]=function(_0x55a075){if(_0x55a075===_0x7f64('0x43')||_0x55a075===_0x7f64('0x68')||_0x55a075===_0x7f64('0x5b')||_0x55a075===_0x7f64('0x69')||_0x55a075==='campaigntype'||_0x55a075==='dialAnswer'||_0x55a075===_0x7f64('0x3a')||_0x55a075===_0x7f64('0x45')||_0x55a075===_0x7f64('0x1a')||_0x55a075===_0x7f64('0x4f')||_0x55a075===_0x7f64('0x1b')||_0x55a075===_0x7f64('0x50')||_0x55a075===_0x7f64('0x6a')||_0x55a075===_0x7f64('0x49')||_0x55a075===_0x7f64('0x4a')||_0x55a075===_0x7f64('0x6b')||_0x55a075==='callback'||_0x55a075===_0x7f64('0x6c')||_0x55a075===_0x7f64('0x6d')||_0x55a075==='recallme'||_0x55a075===_0x7f64('0x53')||_0x55a075===_0x7f64('0x54')||_0x55a075==='UserId'||_0x55a075===_0x7f64('0x1d')||_0x55a075===_0x7f64('0x6e')||_0x55a075===_0x7f64('0x6f')||_0x55a075==='xmd-queue'||_0x55a075===_0x7f64('0x70')||_0x55a075===_0x7f64('0x71')||_0x55a075===_0x7f64('0x72')||_0x55a075==='xmd-dialtimeout'||_0x55a075===_0x7f64('0x73')||_0x55a075===_0x7f64('0x74')||_0x55a075===_0x7f64('0x75')||_0x55a075===_0x7f64('0x76')||_0x55a075===_0x7f64('0x77')||_0x55a075==='xmd-callerid'||_0x55a075===_0x7f64('0x78')||_0x55a075===_0x7f64('0x79')||_0x55a075==='rtpaudioqos'||_0x55a075===_0x7f64('0x7a')||_0x55a075===_0x7f64('0x7b')||_0x55a075===_0x7f64('0x7c')||_0x55a075===_0x7f64('0x7d')||_0x55a075===_0x7f64('0x7e')||_0x55a075===_0x7f64('0x7f')||_0x55a075==='rtpaudioqosrttbridged'||_0x55a075==='rtpaudioqos'||_0x55a075===_0x7f64('0x7a')||_0x55a075===_0x7f64('0x7b')||_0x55a075===_0x7f64('0x7c')||_0x55a075===_0x7f64('0x7d')||_0x55a075===_0x7f64('0x7e')||_0x55a075===_0x7f64('0x7f')||_0x55a075===_0x7f64('0x80')||_0x55a075===_0x7f64('0x81')||_0x55a075===_0x7f64('0x82')||_0x55a075===_0x7f64('0x37')||_0x55a075===_0x7f64('0x3d')){return![];}return!![];};exports[_0x7f64('0x83')]=function(_0x11894a,_0x288460){var _0x53835d,_0x2c3708,_0x3f80ed;if(_0x288460<=0x0){_0x288460=0x1;}_0x53835d=new RegExp('\x5cw{0,'+_0x288460+'}$');_0x2c3708=Math['pow'](0xa,_0x288460-0x1);_0x3f80ed=Math['pow'](0xa,_0x288460)-0x1;return util[_0x7f64('0x14')]('%s',_[_0x7f64('0x84')](_0x11894a,_0x53835d,_[_0x7f64('0x85')](_0x2c3708,_0x3f80ed)));};exports['extractCalleridName']=function(_0x2c2e5d){var _0x493373=_0x2c2e5d[_0x7f64('0x86')](/"(.*?)"/);return _0x493373?_0x493373[0x1]:_0x2c2e5d;};exports[_0x7f64('0x87')]=function(_0x2bdcb1){var _0x24e1c4=_0x2bdcb1[_0x7f64('0x86')](/<(.*?)>/);return _0x24e1c4?_0x24e1c4[0x1]:_0x2bdcb1;};function buildNoAnswerEventPayload(_0x3c243d,_0x5e6312){var _0x2af292=buildObj(_0x3c243d,_0x7f64('0x88'));if(!_[_0x7f64('0x12')](_0x5e6312['variables'])){Object['keys'](_0x5e6312[_0x7f64('0x89')])[_0x7f64('0x8a')](function(_0x1e5bf3){_0x2af292[_0x1e5bf3['toLowerCase']()]=_0x5e6312[_0x7f64('0x89')][_0x1e5bf3];});}return _0x2af292;}exports[_0x7f64('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 77501e9..a1ed2ad 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 _0x1723=['voicequeuechannelhangup','queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1723,0x1c3));var _0x3172=function(_0x3b2572,_0x278dd7){_0x3b2572=_0x3b2572-0x0;var _0x2ba96d=_0x1723[_0x3b2572];return _0x2ba96d;};'use strict';exports[_0x3172('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x3172('0x1'),'required':!![]},'penalty':{'type':_0x3172('0x2'),'required':![]},'paused':{'type':_0x3172('0x3'),'required':![]}};exports[_0x3172('0x4')]={'queue':{'type':_0x3172('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x3172('0x5')]={'interface':{'type':_0x3172('0x1'),'required':!![]},'paused':{'type':_0x3172('0x3')},'reason':{'type':_0x3172('0x1'),'required':![]}};exports[_0x3172('0x6')]={'module':{'type':_0x3172('0x1'),'required':![]}};exports[_0x3172('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x3172('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x3172('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x3172('0x9')]={'uniqueid':{'type':_0x3172('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x3172('0x1'),'required':!![]},'exten':{'type':_0x3172('0x1'),'required':!![]},'context':{'type':_0x3172('0x1')}}; \ No newline at end of file +var _0x6583=['voicequeuechannel','voicechannel','queueadd','string','reload'];(function(_0x5d7404,_0x5c3889){var _0x3f985f=function(_0x10bde2){while(--_0x10bde2){_0x5d7404['push'](_0x5d7404['shift']());}};_0x3f985f(++_0x5c3889);}(_0x6583,0x19c));var _0x3658=function(_0x2d6f29,_0x2f6366){_0x2d6f29=_0x2d6f29-0x0;var _0x291f5a=_0x6583[_0x2d6f29];return _0x291f5a;};'use strict';exports[_0x3658('0x0')]={'queue':{'type':_0x3658('0x1'),'required':!![]},'interface':{'type':_0x3658('0x1'),'required':!![]},'membername':{'type':_0x3658('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x3658('0x1'),'required':!![]},'interface':{'type':_0x3658('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x3658('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x3658('0x2')]={'module':{'type':_0x3658('0x1'),'required':![]}};exports[_0x3658('0x3')]={'uniqueid':{'type':_0x3658('0x1'),'required':!![]}};exports[_0x3658('0x4')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x3658('0x1')},'format':{'type':_0x3658('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x3658('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x3658('0x1'),'required':!![]},'context':{'type':_0x3658('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b30a791..72de024 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(_0x53e977,_0x26e81e){var _0x1f89bc=function(_0x2f78e5){while(--_0x2f78e5){_0x53e977['push'](_0x53e977['shift']());}};_0x1f89bc(++_0x26e81e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ee037,_0x31bf6a){_0x1ee037=_0x1ee037-0x0;var _0x1cf1c4=_0x5f2f[_0x1ee037];return _0x1cf1c4;};'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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x41c1b0,_0x45571f){var _0x42f6ee=function(_0x47d7e0){while(--_0x47d7e0){_0x41c1b0['push'](_0x41c1b0['shift']());}};_0x42f6ee(++_0x45571f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 66939b4..eb640d0 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 _0x74ee=['assign'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x74ee,0xaf));var _0xe74e=function(_0x5de172,_0x31e576){_0x5de172=_0x5de172-0x0;var _0x5dd0b5=_0x74ee[_0x5de172];return _0x5dd0b5;};'use strict';function mergeDBDataToRealtime(_0xc23873,_0x13adc6){var _0x5291c1=Object[_0xe74e('0x0')]({},_0xc23873);for(var _0x26d2ce in _0x13adc6){if(_0x5291c1['hasOwnProperty'](_0x26d2ce)){_0x5291c1[_0x26d2ce]=_0x13adc6[_0x26d2ce];}}return _0x5291c1;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xff95=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff95,0x19f));var _0x5ff9=function(_0x2a6cdb,_0x11e70){_0x2a6cdb=_0x2a6cdb-0x0;var _0x53a286=_0xff95[_0x2a6cdb];return _0x53a286;};'use strict';function mergeDBDataToRealtime(_0x1c734f,_0x17e37d){var _0x2ae913=Object['assign']({},_0x1c734f);for(var _0x48fff8 in _0x17e37d){if(_0x2ae913[_0x5ff9('0x0')](_0x48fff8)){_0x2ae913[_0x48fff8]=_0x17e37d[_0x48fff8];}}return _0x2ae913;}exports[_0x5ff9('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 a6d54a2..61c526a 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 _0x8ab1=['keys','channel','split','calleridnum','outbound','destination','exten','type','lastapplication','context','from-voip-provider','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','callerid','calleridpreview','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','getCallType','UserId','membername','create','monitor','monitors','monitorFilename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','mobile','phone','attendedTransfer','exports','lodash','moment','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','prototype','findAgent','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','match','getAgentByInternal'];(function(_0x409ef8,_0x238031){var _0x39b747=function(_0x290810){while(--_0x290810){_0x409ef8['push'](_0x409ef8['shift']());}};_0x39b747(++_0x238031);}(_0x8ab1,0x81));var _0x18ab=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x8ab1[_0x118139];return _0x2fece9;};'use strict';var _=require(_0x18ab('0x0'));var moment=require(_0x18ab('0x1'));var util=require('util');var config=require(_0x18ab('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x18ab('0x3'));var RpcVoiceDialReport=require(_0x18ab('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x18ab('0x5'));var RpcVoiceRecording=require(_0x18ab('0x6'));var RpcVoiceTransferReport=require(_0x18ab('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x18ab('0x8'));var VoiceDialReport=require(_0x18ab('0x9'));var UserReport=require(_0x18ab('0xa'));function Report(_0x28d322){this[_0x18ab('0xb')]=_0x28d322;this[_0x18ab('0xc')]=_0x28d322[_0x18ab('0xc')];this['telephones']=_0x28d322[_0x18ab('0xd')];}Report['prototype'][_0x18ab('0xe')]=function(_0x9bac44){var _0x2ac2ed=new VoiceQueueReport(this[_0x18ab('0xb')]);var _0x37b944=new VoiceAgentReport(this['realtime']);var _0x1613a2=new VoiceDialReport(this[_0x18ab('0xb')]);var _0x4e7ea8=new VoiceCallReport(this[_0x18ab('0xb')]);var _0x40e293=new UserReport(this[_0x18ab('0xb')]);if(config[_0x18ab('0xf')]&&config[_0x18ab('0xf')]['disabled']){ami['on'](_0x18ab('0x10'),this['voiceQueueReport'][_0x18ab('0x11')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x18ab('0x11')](this));ami['on'](_0x18ab('0x12'),this[_0x18ab('0x13')][_0x18ab('0x11')](this));ami['on']('custom:voiceDialReport',this[_0x18ab('0x14')][_0x18ab('0x11')](this));ami['on'](_0x18ab('0x15'),this[_0x18ab('0x16')]['bind'](this));ami['on'](_0x18ab('0x17'),this['attendedTransfer'][_0x18ab('0x11')](this));}};Report[_0x18ab('0x18')][_0x18ab('0x19')]=function(_0x5be585){var _0x4a0a15;_0x4a0a15=_[_0x18ab('0x1a')](this[_0x18ab('0xc')],function(_0x3da9b9){return _0x3da9b9[_0x18ab('0x1b')]==_0x5be585||_0x3da9b9[_0x18ab('0x1c')]==_0x5be585;});if(_['isNil'](_0x4a0a15)){var _0x3110e1=_[_0x18ab('0x1a')](this[_0x18ab('0xd')],function(_0x2333be){return _0x2333be['accountcode']==_0x5be585||_0x2333be['name']==_0x5be585;});if(_0x3110e1){_0x4a0a15=_[_0x18ab('0x1a')](this[_0x18ab('0xc')],function(_0x5ace39){return _0x5ace39[_0x18ab('0x1d')]==util[_0x18ab('0x1e')](_0x18ab('0x1f'),_0x3110e1['name']);});}}return _0x4a0a15;};Report['prototype']['voiceQueueReport']=function(_0x566bda){for(var _0x258dc8=0x0;_0x258dc8<_0x566bda[_0x18ab('0x20')];_0x258dc8+=0x1){var _0xe0422c=this[_0x18ab('0x19')](_0x566bda[_0x258dc8][_0x18ab('0x21')]);if(_0xe0422c){_0x566bda[_0x258dc8]['accountcode']=_0xe0422c[_0x18ab('0x1b')];_0x566bda[_0x258dc8][_0x18ab('0x22')]=!![];_0x566bda[_0x258dc8][_0x18ab('0x23')]=_0xe0422c[_0x18ab('0x1c')];_0x566bda[_0x258dc8][_0x18ab('0x1d')]=_[_0x18ab('0x24')](_0xe0422c[_0x18ab('0x1d')])?util[_0x18ab('0x1e')](_0x18ab('0x1f'),_0xe0422c['name']):_0xe0422c[_0x18ab('0x1d')];if(_0x566bda[_0x258dc8][_0x18ab('0x25')]){_0x566bda[_0x258dc8][_0x18ab('0x26')]=moment()[_0x18ab('0x1e')](_0x18ab('0x27'));}if(_0x566bda[_0x258dc8][_0x18ab('0x28')]){_0x566bda[_0x258dc8][_0x18ab('0x29')]=moment()[_0x18ab('0x1e')](_0x18ab('0x27'));}RpcMemberReport[_0x18ab('0x2a')](_0x566bda[_0x258dc8]);}RpcVoiceQueueReport['create'](_0x566bda[_0x258dc8]);}};function extractCalleridNumber(_0xc04f97){var _0x321072=_0xc04f97[_0x18ab('0x2b')](/<(.*?)>/);return _0x321072?_0x321072[0x1]:_0xc04f97;}Report['prototype'][_0x18ab('0x2c')]=function(_0x896ede){for(var _0x3fea9d=0x0;_0x3fea9d','calleridname','transfers','linkedid','transfereelinkedid'];(function(_0x4edec9,_0x633020){var _0x1b2bf7=function(_0x36a2b1){while(--_0x36a2b1){_0x4edec9['push'](_0x4edec9['shift']());}};_0x1b2bf7(++_0x633020);}(_0x3c46,0x1db));var _0x63c4=function(_0x460765,_0x30f733){_0x460765=_0x460765-0x0;var _0x22ee7e=_0x3c46[_0x460765];return _0x22ee7e;};'use strict';var _=require(_0x63c4('0x0'));var moment=require('moment');var util=require(_0x63c4('0x1'));var config=require(_0x63c4('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x63c4('0x3'));var RpcVoiceCallReport=require(_0x63c4('0x4'));var RpcVoiceDialReport=require(_0x63c4('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x63c4('0x6'));var RpcVoiceRecording=require(_0x63c4('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x63c4('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x63c4('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x63c4('0xa'));function Report(_0x1204eb){this[_0x63c4('0xb')]=_0x1204eb;this[_0x63c4('0xc')]=_0x1204eb[_0x63c4('0xc')];this['telephones']=_0x1204eb['telephones'];}Report[_0x63c4('0xd')][_0x63c4('0xe')]=function(_0x4ae644){var _0x78fa6e=new VoiceQueueReport(this['realtime']);var _0x590129=new VoiceAgentReport(this[_0x63c4('0xb')]);var _0x25169e=new VoiceDialReport(this['realtime']);var _0x94b69=new VoiceCallReport(this['realtime']);var _0x86d123=new UserReport(this[_0x63c4('0xb')]);if(config[_0x63c4('0xf')]&&config[_0x63c4('0xf')][_0x63c4('0x10')]){ami['on'](_0x63c4('0x11'),this[_0x63c4('0x12')][_0x63c4('0x13')](this));ami['on'](_0x63c4('0x14'),this['voiceCallReport'][_0x63c4('0x13')](this));ami['on'](_0x63c4('0x15'),this[_0x63c4('0x16')]['bind'](this));ami['on'](_0x63c4('0x17'),this['voiceDialReport']['bind'](this));ami['on'](_0x63c4('0x18'),this[_0x63c4('0x19')][_0x63c4('0x13')](this));ami['on']('attendedtransfer',this[_0x63c4('0x1a')][_0x63c4('0x13')](this));}};Report['prototype'][_0x63c4('0x1b')]=function(_0x44d3ab){var _0x5e2297;_0x5e2297=_[_0x63c4('0x1c')](this[_0x63c4('0xc')],function(_0x432d15){return _0x432d15[_0x63c4('0x1d')]==_0x44d3ab||_0x432d15[_0x63c4('0x1e')]==_0x44d3ab;});if(_[_0x63c4('0x1f')](_0x5e2297)){var _0x4209c3=_[_0x63c4('0x1c')](this[_0x63c4('0x20')],function(_0x19b3a4){return _0x19b3a4[_0x63c4('0x1d')]==_0x44d3ab||_0x19b3a4[_0x63c4('0x1e')]==_0x44d3ab;});if(_0x4209c3){_0x5e2297=_['find'](this['agents'],function(_0x3fb2d0){return _0x3fb2d0[_0x63c4('0x21')]==util[_0x63c4('0x22')](_0x63c4('0x23'),_0x4209c3[_0x63c4('0x1e')]);});}}return _0x5e2297;};Report[_0x63c4('0xd')][_0x63c4('0x12')]=function(_0x172674){for(var _0x3bfaa8=0x0;_0x3bfaa8<_0x172674[_0x63c4('0x24')];_0x3bfaa8+=0x1){var _0x5d91be=this[_0x63c4('0x1b')](_0x172674[_0x3bfaa8][_0x63c4('0x25')]);if(_0x5d91be){_0x172674[_0x3bfaa8][_0x63c4('0x1d')]=_0x5d91be[_0x63c4('0x1d')];_0x172674[_0x3bfaa8][_0x63c4('0x26')]=!![];_0x172674[_0x3bfaa8][_0x63c4('0x27')]=_0x5d91be[_0x63c4('0x1e')];_0x172674[_0x3bfaa8]['interface']=_['isNil'](_0x5d91be['interface'])?util[_0x63c4('0x22')](_0x63c4('0x23'),_0x5d91be['name']):_0x5d91be['interface'];if(_0x172674[_0x3bfaa8]['queuecallercomplete']){_0x172674[_0x3bfaa8][_0x63c4('0x28')]=moment()[_0x63c4('0x22')](_0x63c4('0x29'));}if(_0x172674[_0x3bfaa8]['queuecallerexit']){_0x172674[_0x3bfaa8]['queuecallerexitAt']=moment()['format'](_0x63c4('0x29'));}RpcMemberReport['voiceQueueReport'](_0x172674[_0x3bfaa8]);}RpcVoiceQueueReport['create'](_0x172674[_0x3bfaa8]);}};function extractCalleridNumber(_0xc84f7f){var _0x2b6a89=_0xc84f7f[_0x63c4('0x2a')](/<(.*?)>/);return _0x2b6a89?_0x2b6a89[0x1]:_0xc84f7f;}Report[_0x63c4('0xd')][_0x63c4('0x2b')]=function(_0x53468d){for(var _0x5e0a46=0x0;_0x5e0a46{delete this['channels'][_0x2d9c1a];},_0xe7ab59);}};module[_0x67cb('0x9e')]=VoiceAgentReport; \ No newline at end of file +var _0x98a7=['rejected','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','agent','talktime','acw','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','agents','interface','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','voice','assign','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','name','accountcode','exten','custom:agentconnect','user:%s','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','isNotNull','[%s][voiceAgentReport][agentringnoanswer]\x20event:'];(function(_0xf4832,_0x506015){var _0x36d1af=function(_0x2a111d){while(--_0x2a111d){_0xf4832['push'](_0xf4832['shift']());}};_0x36d1af(++_0x506015);}(_0x98a7,0xdf));var _0x798a=function(_0x578e6d,_0x57a67a){_0x578e6d=_0x578e6d-0x0;var _0x44a22e=_0x98a7[_0x578e6d];return _0x44a22e;};'use strict';var _=require(_0x798a('0x0'));var moment=require(_0x798a('0x1'));var util=require(_0x798a('0x2'));var Redis=require(_0x798a('0x3'));var config=require(_0x798a('0x4'));var logger=require(_0x798a('0x5'))(_0x798a('0x6'));var ami=require('../ami');config[_0x798a('0x7')]=_[_0x798a('0x8')](config[_0x798a('0x7')],{'host':_0x798a('0x9'),'port':0x18eb});var io=require(_0x798a('0xa'))(new Redis(config[_0x798a('0x7')]));function VoiceAgentReport(_0x43b976){this[_0x798a('0xb')]={};this[_0x798a('0xc')]=_0x43b976[_0x798a('0xb')];this['voiceQueues']=_0x43b976[_0x798a('0xd')];this['agents']=_0x43b976['agents'];this[_0x798a('0xe')]={};ami['on'](_0x798a('0xf'),this[_0x798a('0x10')][_0x798a('0x11')](this));ami['on'](_0x798a('0x12'),this['syncAgentConnect'][_0x798a('0x11')](this));ami['on'](_0x798a('0x13'),this['syncAgentRingNoAnswer'][_0x798a('0x11')](this));ami['on'](_0x798a('0x14'),this[_0x798a('0x15')]['bind'](this));ami['on']('agentcomplete',this[_0x798a('0x16')][_0x798a('0x11')](this));ami['on'](_0x798a('0x17'),this[_0x798a('0x18')][_0x798a('0x11')](this));ami['on']('hangup',this[_0x798a('0x19')]['bind'](this));ami['on'](_0x798a('0x1a'),this[_0x798a('0x1b')][_0x798a('0x11')](this));ami['on'](_0x798a('0x1c'),this[_0x798a('0x1d')]['bind'](this));ami['on']('attendedtransfer',this[_0x798a('0x1e')]['bind'](this));ami['on'](_0x798a('0x1f'),this[_0x798a('0x20')]['bind'](this));}VoiceAgentReport[_0x798a('0x21')][_0x798a('0x22')]=function(_0x19160e,_0x225647,_0x40248a){io['to'](_0x19160e)[_0x798a('0x22')](_0x225647,_0x40248a);};VoiceAgentReport['prototype']['isNotNull']=function(_0x3d4440){return _0x3d4440!==null&&!_[_0x798a('0x23')](_0x3d4440);};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x10')]=function(_0x39e7de){try{if(this['isNotNull'](_0x39e7de)){logger[_0x798a('0x24')](_0x798a('0x25'),_0x39e7de[_0x798a('0x26')],_0x39e7de[_0x798a('0x27')],_0x39e7de[_0x798a('0x28')]);logger['debug'](_0x798a('0x29'),_0x39e7de[_0x798a('0x26')],util[_0x798a('0x2a')](_0x39e7de,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x39e7de[_0x798a('0x26')]])){this['channels'][_0x39e7de[_0x798a('0x26')]]={};}var _0x4004fd=this[_0x798a('0x2b')][_0x39e7de[_0x798a('0x2c')]];var _0x380ab7=this[_0x798a('0xb')][_0x39e7de[_0x798a('0x26')]][_0x39e7de[_0x798a('0x28')]];var _0x2f523e=this[_0x798a('0xd')][_0x39e7de['queue']];var _0x26659e=this[_0x798a('0xe')][_0x39e7de[_0x798a('0x26')]];if(_[_0x798a('0x23')](_0x380ab7)){_0x380ab7={'agentcalledAt':moment()[_0x798a('0x2d')](_0x798a('0x2e')),'lastevent':_0x798a('0x2f'),'mandatoryDisposition':_0x2f523e&&_0x2f523e[_0x798a('0x30')]?_0x2f523e[_0x798a('0x30')]:![],'type':_0x2f523e&&_0x2f523e['type']?_0x2f523e[_0x798a('0x31')]:'inbound','variables':_0x26659e,'motionChannel':_0x798a('0x32')};}Object[_0x798a('0x33')](_0x380ab7,_['omit'](_0x39e7de,[_0x798a('0x34'),_0x798a('0x35')]));this[_0x798a('0xb')][_0x39e7de[_0x798a('0x26')]][_0x39e7de[_0x798a('0x28')]]=_0x380ab7;logger[_0x798a('0x36')](_0x798a('0x37'),_0x39e7de['uniqueid'],util[_0x798a('0x2a')](_0x380ab7,{'showHidden':![],'depth':null}));ami[_0x798a('0x22')](_0x798a('0x38'),_0x380ab7);var _0x1bb432={'id':_0x4004fd['id'],'calleridnum':_0x380ab7[_0x798a('0x39')],'queue':_0x380ab7[_0x798a('0x3a')],'variables':_0x380ab7[_0x798a('0xe')],'uniqueid':_0x39e7de[_0x798a('0x26')]};logger[_0x798a('0x36')](_0x798a('0x3b'),_0x39e7de[_0x798a('0x26')],util[_0x798a('0x2a')](_0x1bb432,{'showHidden':![],'depth':null}));this[_0x798a('0x22')](util[_0x798a('0x2d')]('user:%s',_0x39e7de[_0x798a('0x27')]),_0x798a('0x3c'),_0x1bb432);}}catch(_0x529059){logger[_0x798a('0x3d')](_0x798a('0x3e'),_0x39e7de['uniqueid'],util[_0x798a('0x2a')](_0x529059,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x3f')]=function(_0x3e98ae){try{if(this['isNotNull'](_0x3e98ae)){if(this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]]){for(var _0x40ffcb in this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]]){if(this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]]['hasOwnProperty'](_0x40ffcb)){if(_0x3e98ae[_0x798a('0x28')]===_0x40ffcb){logger['info'](_0x798a('0x40'),_0x3e98ae[_0x798a('0x26')],_0x3e98ae[_0x798a('0x27')],_0x3e98ae[_0x798a('0x28')]);this['channels'][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x41')]=moment()[_0x798a('0x2d')](_0x798a('0x2e'));this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x42')]=_0x3e98ae[_0x798a('0x42')];this[_0x798a('0xb')][_0x3e98ae['uniqueid']][_0x40ffcb]['connectedlinenum']=_0x3e98ae['connectedlinenum'];this[_0x798a('0xb')][_0x3e98ae['uniqueid']][_0x40ffcb][_0x798a('0x43')]=_0x3e98ae[_0x798a('0x43')];this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x44')]=_0x3e98ae['destchannelstatedesc'];this[_0x798a('0xb')][_0x3e98ae['uniqueid']][_0x40ffcb][_0x798a('0x45')]=_0x3e98ae[_0x798a('0x45')];this['channels'][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x46')]=_0x798a('0x47');_[_0x798a('0x48')](this[_0x798a('0x2b')][_0x3e98ae[_0x798a('0x2c')]],_['pick'](_0x3e98ae,[_0x798a('0x3a'),'destconnectedlinenum']));var _0x17b647=this[_0x798a('0x2b')][_0x3e98ae[_0x798a('0x2c')]];var _0x245d52={'id':_0x17b647['id'],'name':_0x17b647[_0x798a('0x49')],'agentconnected':!![],'destaccountcode':_0x17b647[_0x798a('0x4a')],'destconnectedlinenum':this[_0x798a('0xb')][_0x3e98ae['uniqueid']][_0x3e98ae[_0x798a('0x28')]][_0x798a('0x4b')],'queue':this['channels'][_0x3e98ae[_0x798a('0x26')]][_0x3e98ae[_0x798a('0x28')]][_0x798a('0x3a')],'uniqueid':this['channels'][_0x3e98ae['uniqueid']][_0x3e98ae['destuniqueid']][_0x798a('0x26')]};ami['emit'](_0x798a('0x4c'),this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x3e98ae[_0x798a('0x28')]]);this['emit'](util[_0x798a('0x2d')](_0x798a('0x4d'),_0x3e98ae['membername']),_0x798a('0x4e'),_0x245d52);}else if(!this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x13')]&&!this['channels'][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x4f')]){logger['info'](_0x798a('0x50'),_0x3e98ae['uniqueid'],this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb]['membername'],_0x40ffcb);this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x13')]=!![];this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x51')]=moment()[_0x798a('0x2d')](_0x798a('0x2e'));this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x52')]=_0x3e98ae[_0x798a('0x28')];this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x53')]=_0x3e98ae[_0x798a('0x27')];this[_0x798a('0xb')][_0x3e98ae['uniqueid']][_0x40ffcb][_0x798a('0x46')]=_0x798a('0x54');this['channels'][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb][_0x798a('0x55')]=_0x798a('0x54');logger[_0x798a('0x36')](_0x798a('0x56'),_0x3e98ae[_0x798a('0x26')],util[_0x798a('0x2a')](this[_0x798a('0xb')][_0x3e98ae['uniqueid']][_0x40ffcb],{'showHidden':![],'depth':null}));ami[_0x798a('0x22')]('custom:agentansweredelsewhere',this[_0x798a('0xb')][_0x3e98ae[_0x798a('0x26')]][_0x40ffcb]);}else{logger[_0x798a('0x36')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x3e98ae[_0x798a('0x26')]);}}}}}}catch(_0x5b3fde){logger[_0x798a('0x3d')](_0x798a('0x57'),_0x3e98ae[_0x798a('0x26')],util[_0x798a('0x2a')](_0x5b3fde,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x798a('0x58')]=function(_0x1be514){try{if(this[_0x798a('0x59')](_0x1be514)){logger[_0x798a('0x36')](_0x798a('0x5a'),_0x1be514[_0x798a('0x26')],util['inspect'](_0x1be514,{'showHidden':![],'depth':null}));if(this[_0x798a('0xb')][_0x1be514[_0x798a('0x26')]]&&this[_0x798a('0xb')][_0x1be514['uniqueid']][_0x1be514['destuniqueid']]){logger[_0x798a('0x24')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x1be514[_0x798a('0x26')],_0x1be514[_0x798a('0x27')],_0x1be514[_0x798a('0x28')]);var _0x2edc24=this[_0x798a('0x2b')][_0x1be514[_0x798a('0x2c')]];var _0x29dd78=this[_0x798a('0xb')][_0x1be514[_0x798a('0x26')]][_0x1be514[_0x798a('0x28')]];_0x29dd78[_0x798a('0x13')]=!![];_0x29dd78[_0x798a('0x51')]=moment()[_0x798a('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');_0x29dd78[_0x798a('0x46')]=_0x798a('0x5b');_0x29dd78['reason']=_0x798a('0x5b');var _0x95af64={'id':_0x2edc24['id'],'name':_0x2edc24[_0x798a('0x49')],'queue':_0x29dd78[_0x798a('0x3a')],'uniqueid':_0x29dd78['uniqueid']};logger[_0x798a('0x36')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x1be514[_0x798a('0x26')],util[_0x798a('0x2a')](_0x95af64,{'showHidden':![],'depth':null}));this[_0x798a('0x22')](util[_0x798a('0x2d')](_0x798a('0x4d'),_0x2edc24['name']),'user:agentringnoanswer',_0x95af64);ami[_0x798a('0x22')](_0x798a('0x5c'),_0x29dd78);this['channels'][_0x1be514['uniqueid']][_0x1be514[_0x798a('0x28')]]=Object[_0x798a('0x33')]({},_0x29dd78);}}}catch(_0x1126ee){logger[_0x798a('0x3d')]('[%s][voiceAgentReport][agentringnoanswer]',_0x1be514[_0x798a('0x26')],util[_0x798a('0x2a')](_0x1126ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x798a('0x15')]=function(_0x2ef8f6){try{if(this[_0x798a('0x59')](_0x2ef8f6)){logger['debug'](_0x798a('0x5d'),_0x2ef8f6['uniqueid'],util[_0x798a('0x2a')](_0x2ef8f6,{'showHidden':![],'depth':null}));if(this['channels'][_0x2ef8f6['uniqueid']]){for(var _0x43a30b in this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]]){if(this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]][_0x798a('0x5e')](_0x43a30b)&&!this[_0x798a('0xb')][_0x2ef8f6['uniqueid']][_0x43a30b][_0x798a('0x13')]&&!this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]][_0x43a30b][_0x798a('0x4f')]){logger[_0x798a('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2ef8f6[_0x798a('0x26')],this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]][_0x43a30b][_0x798a('0x27')],_0x43a30b);this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]][_0x43a30b][_0x798a('0x13')]=!![];this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]][_0x43a30b][_0x798a('0x51')]=moment()[_0x798a('0x2d')](_0x798a('0x2e'));this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]][_0x43a30b][_0x798a('0x46')]=_0x798a('0x5f');this['channels'][_0x2ef8f6['uniqueid']][_0x43a30b]['reason']=_0x798a('0x5f');logger[_0x798a('0x36')](_0x798a('0x60'),_0x2ef8f6['uniqueid'],util[_0x798a('0x2a')](this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]][_0x43a30b],{'showHidden':![],'depth':null}));ami[_0x798a('0x22')](_0x798a('0x61'),this[_0x798a('0xb')][_0x2ef8f6[_0x798a('0x26')]][_0x43a30b]);}}}}}catch(_0x36cb55){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0x2ef8f6[_0x798a('0x26')],util['inspect'](_0x36cb55,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x798a('0x16')]=function(_0x5e97d7){try{if(this['isNotNull'](_0x5e97d7)){logger[_0x798a('0x36')](_0x798a('0x62'),_0x5e97d7['uniqueid'],util[_0x798a('0x2a')](_0x5e97d7,{'showHidden':![],'depth':null}));if(this['channels'][_0x5e97d7[_0x798a('0x26')]]){for(var _0x5bfc12 in this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]]){if(this['channels'][_0x5e97d7[_0x798a('0x26')]][_0x798a('0x5e')](_0x5bfc12)){if(this['channels'][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12][_0x798a('0x41')]&&!this['channels'][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12]['agentcomplete']){logger['info'](_0x798a('0x63'),_0x5e97d7['uniqueid'],this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12][_0x798a('0x27')],_0x5bfc12);this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12][_0x798a('0x4f')]=!![];this['channels'][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12]['agentcompleteAt']=moment()['format'](_0x798a('0x2e'));this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12][_0x798a('0x46')]='complete';this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12][_0x798a('0x55')]=_0x5e97d7[_0x798a('0x55')]==_0x798a('0x64')?_0x798a('0x65'):_0x5e97d7[_0x798a('0x55')];this[_0x798a('0xb')][_0x5e97d7['uniqueid']][_0x5bfc12]['talktime']=_0x5e97d7[_0x798a('0x66')];if(this[_0x798a('0xd')][_0x5e97d7['queue']]&&this[_0x798a('0xd')][_0x5e97d7['queue']][_0x798a('0x67')]){this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12]['acwtime']=this[_0x798a('0xd')][_0x5e97d7[_0x798a('0x3a')]]['acwTimeout'];this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12][_0x798a('0x68')]=!![];}this[_0x798a('0x2b')][_0x5e97d7[_0x798a('0x2c')]]=_['omit'](this[_0x798a('0x2b')][_0x5e97d7[_0x798a('0x2c')]],[_0x798a('0x3a'),_0x798a('0x69')]);logger[_0x798a('0x36')](_0x798a('0x6a'),_0x5e97d7[_0x798a('0x26')],util[_0x798a('0x2a')](this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12],{'showHidden':![],'depth':null}));ami[_0x798a('0x22')]('custom:agentcomplete',this[_0x798a('0xb')][_0x5e97d7[_0x798a('0x26')]][_0x5bfc12]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x5e97d7['uniqueid'],util['inspect']({'id':this[_0x798a('0x2b')][_0x5e97d7['interface']]['id'],'destaccountcode':_0x5e97d7[_0x798a('0x6b')]},{'showHidden':![],'depth':null}));this[_0x798a('0x22')](util[_0x798a('0x2d')](_0x798a('0x4d'),_0x5e97d7['membername']),_0x798a('0x6c'),{'id':this[_0x798a('0x2b')][_0x5e97d7[_0x798a('0x2c')]]['id'],'destaccountcode':Number(_0x5e97d7['destaccountcode'])});}}}}}}catch(_0x3e615b){logger[_0x798a('0x3d')](_0x798a('0x6d'),_0x5e97d7[_0x798a('0x26')],util[_0x798a('0x2a')](_0x3e615b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x18')]=function(_0x5e28ba){try{if(this[_0x798a('0x59')](_0x5e28ba)){logger[_0x798a('0x36')](_0x798a('0x6e'),_0x5e28ba['uniqueid'],util[_0x798a('0x2a')](_0x5e28ba,{'showHidden':![],'depth':null}));this[_0x798a('0x6f')](_0x5e28ba[_0x798a('0x26')],_[_0x798a('0x70')](_0x5e28ba[_0x798a('0x71')])[0x0],_0x5e28ba['value']);if(this[_0x798a('0xb')][_0x5e28ba['uniqueid']]){for(var _0x482239 in this[_0x798a('0xb')][_0x5e28ba[_0x798a('0x26')]]){if(this['channels'][_0x5e28ba[_0x798a('0x26')]][_0x798a('0x5e')](_0x482239)){logger['info'](_0x798a('0x72'),_0x5e28ba['uniqueid'],_0x482239,_['keys'](_0x5e28ba['variable'])[0x0],_0x5e28ba['value']);if(_[_0x798a('0x23')](this[_0x798a('0xb')][_0x5e28ba[_0x798a('0x26')]][_0x482239][_0x798a('0xe')])){this[_0x798a('0xb')][_0x5e28ba[_0x798a('0x26')]][_0x482239]['variables']={};}this[_0x798a('0xb')][_0x5e28ba['uniqueid']][_0x482239]['variables']=this[_0x798a('0xe')][_0x5e28ba['uniqueid']];}}}}}catch(_0x534437){logger[_0x798a('0x3d')](_0x798a('0x73'),_0x5e28ba[_0x798a('0x26')],util[_0x798a('0x2a')](_0x534437,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x6f')]=function(_0x8122ad,_0x2bc358,_0x33b325){var _0x46ce61=[_0x798a('0x74'),_0x798a('0x75'),_0x798a('0x76'),'rtpaudioqosjitterbridged',_0x798a('0x77'),_0x798a('0x78'),_0x798a('0x79'),'rtpaudioqosrttbridged',_0x798a('0x7a'),_0x798a('0x7b'),_0x798a('0x7c'),_0x798a('0x7d'),'membercalls',_0x798a('0x7e'),_0x798a('0x7f'),_0x798a('0x80'),_0x798a('0x27'),_0x798a('0x81'),_0x798a('0x82')];if(!_['isNil'](_0x2bc358)&&!_[_0x798a('0x83')](_0x46ce61,_0x2bc358)){if(_[_0x798a('0x23')](this[_0x798a('0xe')][_0x8122ad])){this[_0x798a('0xe')][_0x8122ad]={};}this[_0x798a('0xe')][_0x8122ad][_0x2bc358]=_0x33b325;}};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x19')]=function(_0x5f123e){try{if(this['isNotNull'](_0x5f123e)){logger[_0x798a('0x36')](_0x798a('0x84'),_0x5f123e[_0x798a('0x26')],util['inspect'](_0x5f123e,{'showHidden':![],'depth':null}));if(this[_0x798a('0xb')][_0x5f123e[_0x798a('0x26')]]){for(var _0x332723 in this[_0x798a('0xb')][_0x5f123e['uniqueid']]){if(this['channels'][_0x5f123e[_0x798a('0x26')]][_0x798a('0x5e')](_0x332723)){if(this[_0x798a('0xb')][_0x5f123e[_0x798a('0x26')]][_0x332723][_0x798a('0x55')]==_0x798a('0x64')&&this[_0x798a('0xb')][_0x5f123e[_0x798a('0x26')]][_0x332723][_0x798a('0x4f')]){logger[_0x798a('0x24')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x5f123e['uniqueid'],_0x332723);this[_0x798a('0xb')][_0x5f123e[_0x798a('0x26')]][_0x332723][_0x798a('0x85')]=moment()[_0x798a('0x2d')](_0x798a('0x2e'));}}}logger[_0x798a('0x36')](_0x798a('0x86'),_0x5f123e[_0x798a('0x26')],util['inspect'](_[_0x798a('0x87')](this[_0x798a('0xb')][_0x5f123e[_0x798a('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x798a('0x22')](_0x798a('0x88'),_['values'](this[_0x798a('0xb')][_0x5f123e[_0x798a('0x26')]]));this[_0x798a('0x89')](_0x5f123e['uniqueid']);}if(this[_0x798a('0xe')][_0x5f123e[_0x798a('0x26')]]){delete this[_0x798a('0xe')][_0x5f123e[_0x798a('0x26')]];}}}catch(_0x1ba685){logger['error'](_0x798a('0x8a'),_0x5f123e[_0x798a('0x26')],util[_0x798a('0x2a')](_0x1ba685,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x1e')]=function(_0x1382b8){try{if(this[_0x798a('0x59')](_0x1382b8)){logger[_0x798a('0x36')](_0x798a('0x8b'),_0x1382b8[_0x798a('0x26')],util['inspect'](_0x1382b8,{'showHidden':![],'depth':null}));if(this['channels'][_0x1382b8[_0x798a('0x8c')]]){for(var _0x102bb4 in this[_0x798a('0xb')][_0x1382b8[_0x798a('0x8c')]]){if(this['channels'][_0x1382b8[_0x798a('0x8c')]][_0x798a('0x5e')](_0x102bb4)){if(_0x1382b8[_0x798a('0x8d')]===_0x102bb4){logger[_0x798a('0x24')](_0x798a('0x8e'),_0x1382b8['uniqueid'],this['channels'][_0x1382b8[_0x798a('0x8c')]][_0x102bb4]['membername'],_0x102bb4);var _0x502147=moment();this['channels'][_0x1382b8[_0x798a('0x8c')]][_0x102bb4][_0x798a('0x4f')]=!![];this['channels'][_0x1382b8['transfereeuniqueid']][_0x102bb4][_0x798a('0x85')]=moment()[_0x798a('0x2d')](_0x798a('0x2e'));this['channels'][_0x1382b8['transfereeuniqueid']][_0x102bb4][_0x798a('0x46')]='complete';this['channels'][_0x1382b8['transfereeuniqueid']][_0x102bb4][_0x798a('0x55')]=_0x798a('0x64');this['channels'][_0x1382b8['transfereeuniqueid']][_0x102bb4][_0x798a('0x66')]=_0x502147[_0x798a('0x8f')](this[_0x798a('0xb')][_0x1382b8[_0x798a('0x8c')]][_0x102bb4][_0x798a('0x41')],_0x798a('0x90'));}}}}if(this['channels'][_0x1382b8[_0x798a('0x91')]]){var _0x16eded=this[_0x798a('0xb')][_0x1382b8[_0x798a('0x91')]];this[_0x798a('0xb')][_0x1382b8[_0x798a('0x91')]]=this[_0x798a('0xb')][_0x1382b8[_0x798a('0x8c')]];this['channels'][_0x1382b8[_0x798a('0x8c')]]=_0x16eded;}}}catch(_0x231281){logger[_0x798a('0x3d')]('[%s][voiceAgentReport][attendedtransfer]',_0x1382b8['uniqueid'],util[_0x798a('0x2a')](_0x231281,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x20')]=function(_0x2f4c84){try{if(this[_0x798a('0x59')](_0x2f4c84)){logger[_0x798a('0x36')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x2f4c84[_0x798a('0x26')],util[_0x798a('0x2a')](_0x2f4c84,{'showHidden':![],'depth':null}));if(this['channels'][_0x2f4c84[_0x798a('0x8c')]]){for(var _0x213d41 in this['channels'][_0x2f4c84[_0x798a('0x8c')]]){if(this[_0x798a('0xb')][_0x2f4c84[_0x798a('0x8c')]][_0x798a('0x5e')](_0x213d41)){if(_0x2f4c84['transfereruniqueid']===_0x213d41){logger[_0x798a('0x24')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2f4c84[_0x798a('0x26')],this['channels'][_0x2f4c84[_0x798a('0x8c')]][_0x213d41]['membername'],_0x213d41);var _0x5c7db6=moment();this[_0x798a('0xb')][_0x2f4c84[_0x798a('0x8c')]][_0x213d41]['agentcomplete']=!![];this[_0x798a('0xb')][_0x2f4c84['transfereeuniqueid']][_0x213d41]['agentcompleteAt']=_0x5c7db6;this['channels'][_0x2f4c84[_0x798a('0x8c')]][_0x213d41][_0x798a('0x46')]=_0x798a('0x92');this[_0x798a('0xb')][_0x2f4c84[_0x798a('0x8c')]][_0x213d41][_0x798a('0x55')]=_0x798a('0x64');this['channels'][_0x2f4c84['transfereeuniqueid']][_0x213d41][_0x798a('0x66')]=_0x5c7db6[_0x798a('0x8f')](this[_0x798a('0xb')][_0x2f4c84[_0x798a('0x8c')]][_0x213d41][_0x798a('0x41')],_0x798a('0x90'));}}}}}}catch(_0x21bde6){logger[_0x798a('0x3d')]('[%s][voiceAgentReport][blindtransfer]',_0x2f4c84[_0x798a('0x26')],util[_0x798a('0x2a')](_0x21bde6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x1b')]=function(_0x4c658f){var _0x24a2b9='';try{if(this[_0x798a('0x59')](_0x4c658f)){logger[_0x798a('0x36')](_0x798a('0x93'),_0x4c658f[_0x798a('0x26')],util[_0x798a('0x2a')](_0x4c658f,{'showHidden':![],'depth':null}));if(_0x4c658f[_0x798a('0x94')]){_0x24a2b9=_0x4c658f[_0x798a('0x94')][_0x798a('0x95')](0x0,_0x4c658f[_0x798a('0x94')][_0x798a('0x96')]('-'));if(this[_0x798a('0x2b')][_0x24a2b9]){logger['info'](_0x798a('0x97'),_0x4c658f[_0x798a('0x26')],_0x24a2b9);this[_0x798a('0x2b')][_0x24a2b9][_0x798a('0x98')]=!![];}}}}catch(_0x4460e3){logger[_0x798a('0x3d')](_0x798a('0x99'),_0x4c658f[_0x798a('0x26')],util[_0x798a('0x2a')](_0x4460e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x798a('0x21')][_0x798a('0x1d')]=function(_0x3f69b1){var _0x2b951a='';try{if(this[_0x798a('0x59')](_0x3f69b1)){logger[_0x798a('0x36')](_0x798a('0x9a'),_0x3f69b1[_0x798a('0x26')],util[_0x798a('0x2a')](_0x3f69b1,{'showHidden':![],'depth':null}));if(_0x3f69b1[_0x798a('0x94')]){_0x2b951a=_0x3f69b1[_0x798a('0x94')][_0x798a('0x95')](0x0,_0x3f69b1['channel'][_0x798a('0x96')]('-'));if(this[_0x798a('0x2b')][_0x2b951a]){logger['info'](_0x798a('0x9b'),_0x3f69b1['uniqueid'],_0x2b951a);this[_0x798a('0x2b')][_0x2b951a][_0x798a('0x98')]=![];}}}}catch(_0xbada3){logger['error'](_0x798a('0x9c'),_0x3f69b1['uniqueid'],util[_0x798a('0x2a')](_0xbada3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x798a('0x21')]['deleteChannelAfterTimeout']=function(_0xa88fa0,_0x1e983a=0x2710){if(this[_0x798a('0xb')][_0xa88fa0]){setTimeout(()=>{delete this[_0x798a('0xb')][_0xa88fa0];},_0x1e983a);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 2fe79f2..0b82931 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d4d=['util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','isUndefined','merge','pick','keys','context','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','disposition','toNumber','channelstate','split','undefined','debug','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','calleridnum','destinationchannel','answertime','connectedlinename','membername','user:%s','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfereruniqueid','BlindTransfer','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1d4d,0x188));var _0xd1d4=function(_0x4ebe9a,_0x466362){_0x4ebe9a=_0x4ebe9a-0x0;var _0x4d2fd6=_0x1d4d[_0x4ebe9a];return _0x4d2fd6;};'use strict';var _=require(_0xd1d4('0x0'));var moment=require(_0xd1d4('0x1'));var util=require(_0xd1d4('0x2'));var path=require(_0xd1d4('0x3'));var Redis=require('ioredis');var config=require(_0xd1d4('0x4'));var logger=require(_0xd1d4('0x5'))(_0xd1d4('0x6'));var ami=require(_0xd1d4('0x7'));var Channel=require(_0xd1d4('0x8'));var RpcSetting=require(_0xd1d4('0x9'));var applications=[_0xd1d4('0xa'),_0xd1d4('0xb'),_0xd1d4('0xc'),_0xd1d4('0xd'),'playback',_0xd1d4('0xe')];var dispositions=[_0xd1d4('0xf'),_0xd1d4('0x10'),_0xd1d4('0x10'),_0xd1d4('0xf'),_0xd1d4('0xf'),'NO\x20ANSWER','ANSWERED',_0xd1d4('0x11'),_0xd1d4('0x10'),_0xd1d4('0x10'),'FAILED'];config[_0xd1d4('0x12')]=_[_0xd1d4('0x13')](config[_0xd1d4('0x12')],{'host':'localhost','port':0x18eb});var io=require(_0xd1d4('0x14'))(new Redis(config[_0xd1d4('0x12')]));function VoiceCallReport(_0x283bbe){this[_0xd1d4('0x15')]=_0x283bbe['channels'];this[_0xd1d4('0x16')]=_0x283bbe[_0xd1d4('0x16')];this[_0xd1d4('0x17')]={};ami['on'](_0xd1d4('0x18'),this[_0xd1d4('0x19')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x1b'),this[_0xd1d4('0x19')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x1c'),this[_0xd1d4('0x1d')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x1e'),this['syncNewState']['bind'](this));ami['on'](_0xd1d4('0x1f'),this[_0xd1d4('0x20')]['bind'](this));ami['on']('hangup',this[_0xd1d4('0x21')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x22'),this[_0xd1d4('0x23')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x24'),this[_0xd1d4('0x25')][_0xd1d4('0x1a')](this));ami['on']('blindtransfer',this[_0xd1d4('0x26')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x27'),this['syncMusicOnHoldStart'][_0xd1d4('0x1a')](this));ami['on']('musiconholdstop',this[_0xd1d4('0x28')][_0xd1d4('0x1a')](this));try{logger[_0xd1d4('0x29')](_0xd1d4('0x2a'));ami[_0xd1d4('0x2b')]();}catch(_0x18951b){logger[_0xd1d4('0x2c')]('[voiceCallReport][coreshowchannels]',util[_0xd1d4('0x2d')](_0x18951b,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x2f')]=function(_0x4fc3a8){return _0x4fc3a8!==null&&!_['isUndefined'](_0x4fc3a8);};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x30')]=function(_0x50ca1d,_0x27bef2,_0x2808b8){io['to'](_0x50ca1d)[_0xd1d4('0x30')](_0x27bef2,_0x2808b8);};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x23')]=function(_0x2dbf82){try{if(this[_0xd1d4('0x2f')](_0x2dbf82)){logger[_0xd1d4('0x29')](_0xd1d4('0x31'),_0x2dbf82[_0xd1d4('0x32')],_0x2dbf82[_0xd1d4('0x33')],_0x2dbf82['calleridnum']);logger['debug'](_0xd1d4('0x34'),_0x2dbf82[_0xd1d4('0x32')],util['inspect'](_0x2dbf82,{'showHidden':![],'depth':null}));if(_0x2dbf82[_0xd1d4('0x32')]===_0x2dbf82['linkedid']){if(!_[_0xd1d4('0x35')](this[_0xd1d4('0x15')][_0x2dbf82[_0xd1d4('0x32')]])){_[_0xd1d4('0x36')](this['channels'][_0x2dbf82['uniqueid']],_[_0xd1d4('0x37')](_0x2dbf82,_[_0xd1d4('0x38')](this[_0xd1d4('0x15')][_0x2dbf82[_0xd1d4('0x32')]])));}}if(_0x2dbf82[_0xd1d4('0x39')]===_0xd1d4('0x3a')){var _0x5719ff=this[_0xd1d4('0x16')][_0x2dbf82[_0xd1d4('0x3b')]['split']('-')[0x0]];if(_0x5719ff){if(_0x2dbf82[_0xd1d4('0x3c')]==_0xd1d4('0x3d')){_0x5719ff[_0xd1d4('0x3e')]=_0x2dbf82[_0xd1d4('0x3f')];this[_0xd1d4('0x30')](util[_0xd1d4('0x40')]('user:%s',_0x5719ff[_0xd1d4('0x41')]),_0xd1d4('0x42'),{'id':_0x5719ff['id'],'destaccountcode':_0x5719ff[_0xd1d4('0x43')],'destconnectedlinenum':_0x2dbf82['connectedlinenum']});}}}}}catch(_0x1cbdc7){logger[_0xd1d4('0x2c')](_0xd1d4('0x44'),_0x2dbf82['uniqueid'],util[_0xd1d4('0x2d')](_0x1cbdc7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x1d')]=function(_0x44550d){try{if(this[_0xd1d4('0x2f')](_0x44550d)){logger['debug'](_0xd1d4('0x45'),_0x44550d[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x44550d,{'showHidden':![],'depth':null}));if(this[_0xd1d4('0x15')][_0x44550d[_0xd1d4('0x32')]]){return;}if(_0x44550d[_0xd1d4('0x3b')]===_0xd1d4('0x46')){return;}if(_0x44550d[_0xd1d4('0x32')]!==_0x44550d[_0xd1d4('0x47')]&&!this[_0xd1d4('0x17')][_0x44550d[_0xd1d4('0x47')]]){return;}logger[_0xd1d4('0x29')](_0xd1d4('0x48'),_0x44550d[_0xd1d4('0x32')],_0x44550d['context'],_0x44550d[_0xd1d4('0x3c')]);this[_0xd1d4('0x15')][_0x44550d[_0xd1d4('0x32')]]=new Channel();this[_0xd1d4('0x15')][_0x44550d[_0xd1d4('0x32')]]['starttime']=moment()[_0xd1d4('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd1d4('0x15')][_0x44550d['uniqueid']][_0xd1d4('0x49')]=dispositions[_[_0xd1d4('0x4a')](_0x44550d[_0xd1d4('0x4b')])];_[_0xd1d4('0x36')](this[_0xd1d4('0x15')][_0x44550d['uniqueid']],_[_0xd1d4('0x37')](_0x44550d,_['keys'](this[_0xd1d4('0x15')][_0x44550d[_0xd1d4('0x32')]])));if(_0x44550d[_0xd1d4('0x39')]===_0xd1d4('0x3a')){var _0x265c7d=this['agents'][_0x44550d[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]];if(_0x265c7d&&typeof _0x265c7d[_0xd1d4('0x3e')]===_0xd1d4('0x4d')){_0x265c7d[_0xd1d4('0x3e')]=_0x44550d['exten'];logger[_0xd1d4('0x4e')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x44550d[_0xd1d4('0x32')],util['inspect']({'id':_0x265c7d['id'],'destaccountcode':_0x265c7d[_0xd1d4('0x43')],'destconnectedlinenum':_0x44550d[_0xd1d4('0x3c')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xd1d4('0x40')]('user:%s',_0x265c7d[_0xd1d4('0x41')]),_0xd1d4('0x42'),{'id':_0x265c7d['id'],'destaccountcode':_0x265c7d[_0xd1d4('0x43')],'destconnectedlinenum':_0x44550d[_0xd1d4('0x3c')]});}}}}catch(_0x35eb36){logger[_0xd1d4('0x2c')](_0xd1d4('0x4f'),_0x44550d['uniqueid'],util[_0xd1d4('0x2d')](_0x35eb36,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x19')]=function(_0x2d24e0){try{if(this[_0xd1d4('0x2f')](_0x2d24e0)){logger[_0xd1d4('0x4e')]('[%s][voiceCallReport][newexten]\x20event:',_0x2d24e0[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x2d24e0,{'showHidden':![],'depth':null}));if(_0x2d24e0['channel']===_0xd1d4('0x46')||_0x2d24e0[_0xd1d4('0x3c')]==='h')return;if(_0x2d24e0[_0xd1d4('0x32')]===_0x2d24e0[_0xd1d4('0x47')]||this[_0xd1d4('0x17')][_0x2d24e0['linkedid']]){_0x2d24e0[_0xd1d4('0x50')]=_0x2d24e0[_0xd1d4('0x50')]?_0x2d24e0['application'][_0xd1d4('0x51')]():undefined;_0x2d24e0[_0xd1d4('0x52')]=_0x2d24e0[_0xd1d4('0x53')]||_0x2d24e0[_0xd1d4('0x52')];if(_0x2d24e0[_0xd1d4('0x53')]&&_0x2d24e0['application']!==_0xd1d4('0xb')){_0x2d24e0[_0xd1d4('0x52')]=_0x2d24e0[_0xd1d4('0x52')][_0xd1d4('0x51')]();}logger[_0xd1d4('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2d24e0[_0xd1d4('0x32')],_0x2d24e0[_0xd1d4('0x50')],_0x2d24e0[_0xd1d4('0x52')]);if(_[_0xd1d4('0x35')](this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']])){this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]]=new Channel();this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]][_0xd1d4('0x54')]=_0x2d24e0[_0xd1d4('0x55')]?moment()[_0xd1d4('0x56')](moment['duration'](_0x2d24e0[_0xd1d4('0x55')])[_0xd1d4('0x57')](),_0xd1d4('0x57'))[_0xd1d4('0x40')](_0xd1d4('0x58')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]][_0xd1d4('0x49')]=_0xd1d4('0xf');}_[_0xd1d4('0x36')](this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]],_[_0xd1d4('0x37')](_0x2d24e0,_[_0xd1d4('0x38')](this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']])));if(_[_0xd1d4('0x59')](applications,_0x2d24e0[_0xd1d4('0x50')])){this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']][_0xd1d4('0x5a')]=_0x2d24e0[_0xd1d4('0x50')];this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]][_0xd1d4('0x5b')]=_0x2d24e0[_0xd1d4('0x52')];if(_0x2d24e0['application']===_0xd1d4('0xa')&&_[_0xd1d4('0x5c')](_0x2d24e0[_0xd1d4('0x52')][_0xd1d4('0x51')](),_0xd1d4('0x5d'))){var _0x44c333=_0x2d24e0[_0xd1d4('0x52')]['split']('=');var _0x424c59=_0x44c333[0x0][_0xd1d4('0x51')]()[_0xd1d4('0x5e')](/cdr\((.*)\)/);if(_0x424c59){if(_0x424c59[0x1]===_0xd1d4('0x5f')&&!_[_0xd1d4('0x60')](this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]][_0x424c59[0x1]]))return;this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']][_0x424c59[0x1]]=_0x44c333[0x1];}}else if(_0x2d24e0[_0xd1d4('0x50')]===_0xd1d4('0xb')){this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']][_0xd1d4('0xb')]=_0x2d24e0[_0xd1d4('0x52')]['split'](',')[0x0];}}}}}catch(_0x46a571){logger['error']('[%s][voiceCallReport][newexten]',_0x2d24e0['uniqueid'],util[_0xd1d4('0x2d')](_0x46a571,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd1d4('0x2e')]['syncNewState']=function(_0x22ec36){try{if(this[_0xd1d4('0x2f')](_0x22ec36)){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x22ec36['uniqueid'],_0x22ec36['linkedid'],_0x22ec36[_0xd1d4('0x33')],_0x22ec36['calleridnum']);logger[_0xd1d4('0x4e')](_0xd1d4('0x61'),_0x22ec36[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x22ec36,{'showHidden':![],'depth':null}));if(_0x22ec36[_0xd1d4('0x4b')]!=='6')return;var _0x317faf=this['agents'][_0x22ec36[_0xd1d4('0x3b')]['split']('-')[0x0]];if(_0x22ec36[_0xd1d4('0x32')]!==_0x22ec36[_0xd1d4('0x47')]){var _0x408840=moment();if(this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]]){if(!this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x62')]){this['channels'][_0x22ec36[_0xd1d4('0x47')]]['answered']=!![];this['channels'][_0x22ec36['linkedid']]['answertime']=_0x408840[_0xd1d4('0x40')](_0xd1d4('0x58'));if(this['channels'][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x54')]){this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x63')]=_0x408840[_0xd1d4('0x64')](this['channels'][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x54')],_0xd1d4('0x57'));}}this[_0xd1d4('0x15')][_0x22ec36['linkedid']][_0xd1d4('0x47')]=_0x22ec36[_0xd1d4('0x32')];if(_0x22ec36[_0xd1d4('0x65')]!==_0xd1d4('0x3d')){this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x3f')]=_0x22ec36[_0xd1d4('0x65')];}this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]]['connectedlinename']=_0x22ec36['calleridname'];this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x66')]=_0x22ec36[_0xd1d4('0x3b')];this[_0xd1d4('0x15')][_0x22ec36['linkedid']][_0xd1d4('0x49')]=dispositions[_['toNumber'](_0x22ec36[_0xd1d4('0x4b')])];if(_0x317faf){this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]]['UserId']=_0x317faf['id'];this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]]['membername']=_0x317faf[_0xd1d4('0x41')];}}if(this[_0xd1d4('0x15')][_0x22ec36['uniqueid']]){if(!this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x62')]){this[_0xd1d4('0x15')][_0x22ec36['uniqueid']][_0xd1d4('0x62')]=!![];this['channels'][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x67')]=_0x408840['format'](_0xd1d4('0x58'));if(this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x54')]){this[_0xd1d4('0x15')][_0x22ec36['uniqueid']][_0xd1d4('0x63')]=_0x408840[_0xd1d4('0x64')](this['channels'][_0x22ec36['uniqueid']][_0xd1d4('0x54')],_0xd1d4('0x57'));}}if(_0x22ec36[_0xd1d4('0x65')]!==_0xd1d4('0x3d')){this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x3f')]=_0x22ec36['calleridnum'];}this['channels'][_0x22ec36['uniqueid']][_0xd1d4('0x68')]=_0x22ec36[_0xd1d4('0x33')];this['channels'][_0x22ec36['uniqueid']][_0xd1d4('0x66')]=_0x22ec36[_0xd1d4('0x3b')];this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]]['disposition']=dispositions[_[_0xd1d4('0x4a')](_0x22ec36[_0xd1d4('0x4b')])];}}else{if(this[_0xd1d4('0x15')][_0x22ec36['uniqueid']]){if(_0x317faf){this['channels'][_0x22ec36[_0xd1d4('0x32')]]['UserId']=_0x317faf['id'];this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x69')]=_0x317faf[_0xd1d4('0x41')];}}}if(_0x22ec36[_0xd1d4('0x39')]===_0xd1d4('0x3a')){if(_0x317faf){_0x317faf[_0xd1d4('0x3e')]=_0x22ec36[_0xd1d4('0x3c')];var _0x3b5982;if(this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]]){_0x3b5982=this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0xb')];}else if(this['channels'][_0x22ec36[_0xd1d4('0x47')]]){_0x3b5982=this['channels'][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0xb')];}_0x317faf[_0xd1d4('0xb')]=_0x3b5982;var _0x52a9d3={'id':_0x317faf['id'],'name':_0x317faf[_0xd1d4('0x41')],'agentconnected':!![],'destaccountcode':_0x317faf[_0xd1d4('0x43')],'destconnectedlinenum':_0x22ec36[_0xd1d4('0x3c')],'queue':_0x3b5982||undefined,'uniqueid':_0x22ec36['linkedid']};logger[_0xd1d4('0x4e')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x22ec36[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x52a9d3,{'showHidden':![],'depth':null}));this['emit'](util[_0xd1d4('0x40')](_0xd1d4('0x6a'),_0x317faf[_0xd1d4('0x41')]),_0xd1d4('0x42'),_0x52a9d3);}}}}catch(_0x3e83de){logger[_0xd1d4('0x2c')]('[%s][voiceCallReport][newstate]',_0x22ec36[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x3e83de,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd1d4('0x6b')]=function(_0xc5d322,_0x4ca399){try{if(this[_0xd1d4('0x15')][_0xc5d322]){logger['info'](_0xd1d4('0x6c'),_0xc5d322,_0x4ca399);this[_0xd1d4('0x15')][_0xc5d322][_0xd1d4('0x6d')]=!![];if(_[_0xd1d4('0x6e')](_0x4ca399,_0xd1d4('0x6f'))){_0x4ca399=_0x4ca399[_0xd1d4('0x70')](_0xd1d4('0x6f'),_0xd1d4('0x71'));}this['channels'][_0xc5d322]['monitorFilename']=_0x4ca399;var _0x2f2a79=_[_0xd1d4('0x72')](this[_0xd1d4('0x15')][_0xc5d322][_0xd1d4('0x73')],{'filename':_0x4ca399});if(_[_0xd1d4('0x60')](_0x2f2a79)){this[_0xd1d4('0x15')][_0xc5d322][_0xd1d4('0x73')][_0xd1d4('0x74')]({'filename':_0x4ca399,'createdAt':moment()['format'](_0xd1d4('0x58')),'mixmonitorid':'','status':_0xd1d4('0x75')});}}}catch(_0xbd58c2){logger[_0xd1d4('0x2c')](_0xd1d4('0x76'),_0xc5d322,util[_0xd1d4('0x2d')](_0xbd58c2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd1d4('0x20')]=function(_0x563c2c){try{if(this[_0xd1d4('0x2f')](_0x563c2c)){logger[_0xd1d4('0x4e')](_0xd1d4('0x77'),_0x563c2c['uniqueid'],util[_0xd1d4('0x2d')](_0x563c2c,{'showHidden':![],'depth':null}));if(this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]]&&_0x563c2c[_0xd1d4('0x3b')]!=_0xd1d4('0x46')){if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')])){if(this['isNotNull'](_0x563c2c[_0xd1d4('0x78')]['mixmonitor_filename'])){logger[_0xd1d4('0x29')](_0xd1d4('0x79'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x6b')](_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x7b')])){logger[_0xd1d4('0x29')](_0xd1d4('0x7c'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0x65')]=_0x563c2c['value'];}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x7d')])){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0x7e')]=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')]['xmd-cdrtype'])){logger[_0xd1d4('0x29')](_0xd1d4('0x7f'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0x5f')]=_0x563c2c['value'];}else if(this['isNotNull'](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x80')])){logger[_0xd1d4('0x29')](_0xd1d4('0x81'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')][_0xd1d4('0x4c')](',')[0x0]);this['channels'][_0x563c2c['uniqueid']][_0xd1d4('0xb')]=_0x563c2c[_0xd1d4('0x7a')][_0xd1d4('0x4c')](',')[0x0];}else if(this['isNotNull'](_0x563c2c[_0xd1d4('0x78')]['xmd-originatecalleridnum'])){logger[_0xd1d4('0x29')](_0xd1d4('0x82'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c['value']);this[_0xd1d4('0x15')][_0x563c2c['uniqueid']]['originatecalleridnum']=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x83')])){logger[_0xd1d4('0x29')](_0xd1d4('0x84'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c['uniqueid']][_0xd1d4('0x85')]=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c['variable'][_0xd1d4('0x86')])){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0x87')]=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c['variable'][_0xd1d4('0x88')])){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x563c2c['uniqueid'],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0xb')]=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x89')])){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]]['sipcalluniqueid']=_0x563c2c[_0xd1d4('0x7a')];}}}else if(this['isNotNull'](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x8a')])){if(_0x563c2c['value']){var _0x5c7ca9=path[_0xd1d4('0x8b')](_0x563c2c[_0xd1d4('0x7a')])[_0xd1d4('0x41')];logger[_0xd1d4('0x29')](_0xd1d4('0x79'),_0x5c7ca9,_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x6b')](_0x5c7ca9,_0x563c2c[_0xd1d4('0x7a')]);}}else if(this['channels'][_0x563c2c[_0xd1d4('0x47')]]){if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')])){if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x89')])){logger[_0xd1d4('0x29')](_0xd1d4('0x8c'),_0x563c2c[_0xd1d4('0x47')],_0x563c2c[_0xd1d4('0x7a')]);this['channels'][_0x563c2c[_0xd1d4('0x47')]][_0xd1d4('0x8d')]=_0x563c2c[_0xd1d4('0x7a')];}}}}}catch(_0x41c662){logger[_0xd1d4('0x2c')]('[%s][voiceCallReport][varset]',_0x563c2c[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x41c662,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x21')]=function(_0x694682){try{if(this['isNotNull'](_0x694682)){logger[_0xd1d4('0x4e')](_0xd1d4('0x8e'),_0x694682[_0xd1d4('0x32')],util['inspect'](_0x694682,{'showHidden':![],'depth':null}));if(this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]]){if(this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]]){this[_0xd1d4('0x15')][this['blindTransfers'][_0x694682['linkedid']][_0xd1d4('0x47')]][_0xd1d4('0x32')]=_0x694682[_0xd1d4('0x32')];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]]['linkedid']]['answered']=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x62')];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]][_0xd1d4('0x67')]=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x67')];this[_0xd1d4('0x15')][this['blindTransfers'][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]]['destinationchannel']=this['channels'][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]][_0xd1d4('0x3b')];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]][_0xd1d4('0x49')]=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x49')];this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]]=this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]]['linkedid']];this[_0xd1d4('0x8f')](this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x47')]);}else if(this['channels'][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]]){this['channels'][this['blindTransfers'][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]][_0xd1d4('0x32')]=[this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]][_0xd1d4('0x47')],this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]]['linkedid']=this[_0xd1d4('0x15')][this['blindTransfers'][_0x694682[_0xd1d4('0x47')]]['uniqueid']][_0xd1d4('0x32')]][0x0];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]][_0xd1d4('0x62')]=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x62')];this['channels'][this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x32')]]['answertime']=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]]['answertime'];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]]['uniqueid']][_0xd1d4('0x66')]=this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]][_0xd1d4('0x3b')];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x32')]][_0xd1d4('0x49')]=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x49')];this['channels'][_0x694682[_0xd1d4('0x32')]]=this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x32')]];this['deleteChannelAfterTimeout'](this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x32')]);}}if(this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]]){logger[_0xd1d4('0x29')](_0xd1d4('0x90'),_0x694682[_0xd1d4('0x32')],_0x694682['cause-txt']);var _0x2f9a36=moment();this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]]['endtime']=_0x2f9a36[_0xd1d4('0x40')](_0xd1d4('0x58'));this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x55')]=_0x2f9a36['diff'](this[_0xd1d4('0x15')][_0x694682['uniqueid']][_0xd1d4('0x54')],_0xd1d4('0x57'));if(this['channels'][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x62')]){this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x91')]=_0x2f9a36[_0xd1d4('0x64')](this['channels'][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x67')],_0xd1d4('0x57'));this[_0xd1d4('0x15')][_0x694682['uniqueid']][_0xd1d4('0x63')]=this['channels'][_0x694682['uniqueid']][_0xd1d4('0x55')]-this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x91')];}if(_0x694682[_0xd1d4('0x39')]===_0xd1d4('0x3a')){if(this[_0xd1d4('0x16')][_0x694682[_0xd1d4('0x3b')]['split']('-')[0x0]]){this[_0xd1d4('0x16')][_0x694682['channel']['split']('-')[0x0]]=_[_0xd1d4('0x92')](this['agents'][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]],[_0xd1d4('0x3e')]);logger[_0xd1d4('0x4e')](_0xd1d4('0x93'),_0x694682[_0xd1d4('0x32')],util[_0xd1d4('0x2d')]({'id':this[_0xd1d4('0x16')][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]]['id'],'destaccountcode':this[_0xd1d4('0x16')][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]][_0xd1d4('0x43')]},{'showHidden':![],'depth':null}));this[_0xd1d4('0x30')](util[_0xd1d4('0x40')](_0xd1d4('0x6a'),this[_0xd1d4('0x16')][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]][_0xd1d4('0x41')]),_0xd1d4('0x94'),{'id':this[_0xd1d4('0x16')][_0x694682['channel']['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]][_0xd1d4('0x43')]});for(var _0x1c62ee=0x0;_0x1c62ee{delete this['channels'][_0x393b46];},_0x159478);}};module[_0xd1d4('0xc4')]=VoiceCallReport; \ No newline at end of file +var _0x3146=['webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transferType','transfertargetuniqueid','origtransferercalleridnum','origtransfereruniqueid','origtransfererlinkedid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','[%s][voiceCallReport][newchannel]','application','applicationdata','appdata','toLowerCase','isUndefined','starttime','duration','subtract','seconds','includes','lastdata','startsWith','cdr(','match','type','isNil','queue','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','replace','.wav49','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','value','xmd-phone','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','transferToInternal','getSettings','then','stopRecordingOnTransfer','StopMixMonitor','catch','Action','finally'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3146,0xeb));var _0x6314=function(_0x3f2548,_0x1c9646){_0x3f2548=_0x3f2548-0x0;var _0xfa4c2e=_0x3146[_0x3f2548];return _0xfa4c2e;};'use strict';var _=require(_0x6314('0x0'));var moment=require(_0x6314('0x1'));var util=require('util');var path=require('path');var Redis=require(_0x6314('0x2'));var config=require(_0x6314('0x3'));var logger=require(_0x6314('0x4'))(_0x6314('0x5'));var ami=require(_0x6314('0x6'));var Channel=require(_0x6314('0x7'));var RpcSetting=require('../rpc/setting');var applications=[_0x6314('0x8'),'queue',_0x6314('0x9'),_0x6314('0xa'),_0x6314('0xb'),_0x6314('0xc')];var dispositions=[_0x6314('0xd'),_0x6314('0xe'),'FAILED',_0x6314('0xd'),_0x6314('0xd'),'NO\x20ANSWER',_0x6314('0xf'),_0x6314('0x10'),_0x6314('0xe'),_0x6314('0xe'),_0x6314('0xe')];config['redis']=_[_0x6314('0x11')](config[_0x6314('0x12')],{'host':'localhost','port':0x18eb});var io=require(_0x6314('0x13'))(new Redis(config[_0x6314('0x12')]));function VoiceCallReport(_0x1cb2ca){this[_0x6314('0x14')]=_0x1cb2ca[_0x6314('0x14')];this[_0x6314('0x15')]=_0x1cb2ca[_0x6314('0x15')];this[_0x6314('0x16')]={};ami['on']('coreshowchannel',this[_0x6314('0x17')][_0x6314('0x18')](this));ami['on'](_0x6314('0x19'),this['syncNewExten'][_0x6314('0x18')](this));ami['on'](_0x6314('0x1a'),this[_0x6314('0x1b')][_0x6314('0x18')](this));ami['on'](_0x6314('0x1c'),this[_0x6314('0x1d')][_0x6314('0x18')](this));ami['on'](_0x6314('0x1e'),this[_0x6314('0x1f')][_0x6314('0x18')](this));ami['on'](_0x6314('0x20'),this[_0x6314('0x21')][_0x6314('0x18')](this));ami['on']('newcallerid',this[_0x6314('0x22')][_0x6314('0x18')](this));ami['on'](_0x6314('0x23'),this[_0x6314('0x24')][_0x6314('0x18')](this));ami['on'](_0x6314('0x25'),this[_0x6314('0x26')][_0x6314('0x18')](this));ami['on'](_0x6314('0x27'),this[_0x6314('0x28')][_0x6314('0x18')](this));ami['on'](_0x6314('0x29'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x6314('0x2a')](_0x6314('0x2b'));ami[_0x6314('0x2c')]();}catch(_0x1a00b7){logger[_0x6314('0x2d')](_0x6314('0x2e'),util['inspect'](_0x1a00b7,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x6314('0x2f')]['isNotNull']=function(_0x160411){return _0x160411!==null&&!_['isUndefined'](_0x160411);};VoiceCallReport[_0x6314('0x2f')]['emit']=function(_0x436c28,_0x497510,_0x8e5fe9){io['to'](_0x436c28)[_0x6314('0x30')](_0x497510,_0x8e5fe9);};VoiceCallReport[_0x6314('0x2f')][_0x6314('0x22')]=function(_0x5b4ad9){try{if(this[_0x6314('0x31')](_0x5b4ad9)){logger['info'](_0x6314('0x32'),_0x5b4ad9[_0x6314('0x33')],_0x5b4ad9[_0x6314('0x34')],_0x5b4ad9['calleridnum']);logger[_0x6314('0x35')](_0x6314('0x36'),_0x5b4ad9['uniqueid'],util[_0x6314('0x37')](_0x5b4ad9,{'showHidden':![],'depth':null}));if(_0x5b4ad9[_0x6314('0x33')]===_0x5b4ad9['linkedid']){if(!_['isUndefined'](this[_0x6314('0x14')][_0x5b4ad9[_0x6314('0x33')]])){_[_0x6314('0x38')](this[_0x6314('0x14')][_0x5b4ad9['uniqueid']],_[_0x6314('0x39')](_0x5b4ad9,_[_0x6314('0x3a')](this['channels'][_0x5b4ad9[_0x6314('0x33')]])));}}if(_0x5b4ad9[_0x6314('0x3b')]===_0x6314('0x3c')){var _0x42911a=this[_0x6314('0x15')][_0x5b4ad9[_0x6314('0x3d')][_0x6314('0x3e')]('-')[0x0]];if(_0x42911a){if(_0x5b4ad9[_0x6314('0x3f')]==_0x6314('0x40')){_0x42911a[_0x6314('0x41')]=_0x5b4ad9[_0x6314('0x42')];this[_0x6314('0x30')](util[_0x6314('0x43')](_0x6314('0x44'),_0x42911a['name']),'user:agentconnect',{'id':_0x42911a['id'],'destaccountcode':_0x42911a['accountcode'],'destconnectedlinenum':_0x5b4ad9['connectedlinenum']});}}}}}catch(_0x31a858){logger[_0x6314('0x2d')](_0x6314('0x45'),_0x5b4ad9[_0x6314('0x33')],util[_0x6314('0x37')](_0x31a858,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6314('0x2f')]['syncNewChannel']=function(_0x20d160){try{if(this[_0x6314('0x31')](_0x20d160)){logger[_0x6314('0x35')](_0x6314('0x46'),_0x20d160[_0x6314('0x33')],util[_0x6314('0x37')](_0x20d160,{'showHidden':![],'depth':null}));if(this[_0x6314('0x14')][_0x20d160[_0x6314('0x33')]]){return;}if(_0x20d160[_0x6314('0x3d')]===_0x6314('0x47')){return;}if(_0x20d160[_0x6314('0x33')]!==_0x20d160[_0x6314('0x48')]&&!this[_0x6314('0x16')][_0x20d160[_0x6314('0x48')]]){return;}logger[_0x6314('0x2a')](_0x6314('0x49'),_0x20d160['uniqueid'],_0x20d160[_0x6314('0x3b')],_0x20d160[_0x6314('0x3f')]);this[_0x6314('0x14')][_0x20d160[_0x6314('0x33')]]=new Channel();this[_0x6314('0x14')][_0x20d160['uniqueid']]['starttime']=moment()[_0x6314('0x43')](_0x6314('0x4a'));this[_0x6314('0x14')][_0x20d160[_0x6314('0x33')]][_0x6314('0x4b')]=dispositions[_[_0x6314('0x4c')](_0x20d160[_0x6314('0x4d')])];_[_0x6314('0x38')](this[_0x6314('0x14')][_0x20d160['uniqueid']],_[_0x6314('0x39')](_0x20d160,_[_0x6314('0x3a')](this[_0x6314('0x14')][_0x20d160[_0x6314('0x33')]])));if(_0x20d160[_0x6314('0x3b')]===_0x6314('0x3c')){var _0x12fbc7=this['agents'][_0x20d160[_0x6314('0x3d')][_0x6314('0x3e')]('-')[0x0]];if(_0x12fbc7&&typeof _0x12fbc7[_0x6314('0x41')]===_0x6314('0x4e')){_0x12fbc7[_0x6314('0x41')]=_0x20d160[_0x6314('0x3f')];logger[_0x6314('0x35')](_0x6314('0x4f'),_0x20d160['uniqueid'],util[_0x6314('0x37')]({'id':_0x12fbc7['id'],'destaccountcode':_0x12fbc7[_0x6314('0x50')],'destconnectedlinenum':_0x20d160[_0x6314('0x3f')]},{'showHidden':![],'depth':null}));this[_0x6314('0x30')](util['format'](_0x6314('0x44'),_0x12fbc7[_0x6314('0x51')]),_0x6314('0x52'),{'id':_0x12fbc7['id'],'destaccountcode':_0x12fbc7[_0x6314('0x50')],'destconnectedlinenum':_0x20d160['exten']});}}}}catch(_0xb926a1){logger[_0x6314('0x2d')](_0x6314('0x53'),_0x20d160['uniqueid'],util['inspect'](_0xb926a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6314('0x2f')][_0x6314('0x17')]=function(_0x18f937){try{if(this[_0x6314('0x31')](_0x18f937)){logger[_0x6314('0x35')]('[%s][voiceCallReport][newexten]\x20event:',_0x18f937[_0x6314('0x33')],util[_0x6314('0x37')](_0x18f937,{'showHidden':![],'depth':null}));if(_0x18f937['channel']==='OutgoingSpoolFailed'||_0x18f937[_0x6314('0x3f')]==='h')return;if(_0x18f937['uniqueid']===_0x18f937['linkedid']||this[_0x6314('0x16')][_0x18f937['linkedid']]){_0x18f937['application']=_0x18f937[_0x6314('0x54')]?_0x18f937['application']['toLowerCase']():undefined;_0x18f937['applicationdata']=_0x18f937['appdata']||_0x18f937[_0x6314('0x55')];if(_0x18f937[_0x6314('0x56')]&&_0x18f937[_0x6314('0x54')]!=='queue'){_0x18f937[_0x6314('0x55')]=_0x18f937[_0x6314('0x55')][_0x6314('0x57')]();}logger[_0x6314('0x2a')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x18f937['uniqueid'],_0x18f937[_0x6314('0x54')],_0x18f937[_0x6314('0x55')]);if(_[_0x6314('0x58')](this[_0x6314('0x14')][_0x18f937['uniqueid']])){this[_0x6314('0x14')][_0x18f937[_0x6314('0x33')]]=new Channel();this['channels'][_0x18f937[_0x6314('0x33')]][_0x6314('0x59')]=_0x18f937[_0x6314('0x5a')]?moment()[_0x6314('0x5b')](moment[_0x6314('0x5a')](_0x18f937[_0x6314('0x5a')])['seconds'](),_0x6314('0x5c'))['format'](_0x6314('0x4a')):moment()[_0x6314('0x43')](_0x6314('0x4a'));this[_0x6314('0x14')][_0x18f937[_0x6314('0x33')]][_0x6314('0x4b')]='NO\x20ANSWER';}_[_0x6314('0x38')](this['channels'][_0x18f937[_0x6314('0x33')]],_['pick'](_0x18f937,_[_0x6314('0x3a')](this[_0x6314('0x14')][_0x18f937[_0x6314('0x33')]])));if(_[_0x6314('0x5d')](applications,_0x18f937[_0x6314('0x54')])){this['channels'][_0x18f937[_0x6314('0x33')]]['lastapplication']=_0x18f937[_0x6314('0x54')];this[_0x6314('0x14')][_0x18f937['uniqueid']][_0x6314('0x5e')]=_0x18f937[_0x6314('0x55')];if(_0x18f937[_0x6314('0x54')]==='set'&&_[_0x6314('0x5f')](_0x18f937[_0x6314('0x55')][_0x6314('0x57')](),_0x6314('0x60'))){var _0x3c10bc=_0x18f937[_0x6314('0x55')][_0x6314('0x3e')]('=');var _0x1d13e6=_0x3c10bc[0x0][_0x6314('0x57')]()[_0x6314('0x61')](/cdr\((.*)\)/);if(_0x1d13e6){if(_0x1d13e6[0x1]===_0x6314('0x62')&&!_[_0x6314('0x63')](this[_0x6314('0x14')][_0x18f937[_0x6314('0x33')]][_0x1d13e6[0x1]]))return;this[_0x6314('0x14')][_0x18f937[_0x6314('0x33')]][_0x1d13e6[0x1]]=_0x3c10bc[0x1];}}else if(_0x18f937['application']===_0x6314('0x64')){this[_0x6314('0x14')][_0x18f937[_0x6314('0x33')]][_0x6314('0x64')]=_0x18f937[_0x6314('0x55')][_0x6314('0x3e')](',')[0x0];}}}}}catch(_0xde3d01){logger[_0x6314('0x2d')]('[%s][voiceCallReport][newexten]',_0x18f937[_0x6314('0x33')],util[_0x6314('0x37')](_0xde3d01,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6314('0x2f')][_0x6314('0x1d')]=function(_0x397757){try{if(this[_0x6314('0x31')](_0x397757)){logger[_0x6314('0x2a')](_0x6314('0x65'),_0x397757[_0x6314('0x33')],_0x397757[_0x6314('0x48')],_0x397757[_0x6314('0x34')],_0x397757[_0x6314('0x66')]);logger[_0x6314('0x35')]('[%s][voiceCallReport][newstate]\x20event:',_0x397757['uniqueid'],util[_0x6314('0x37')](_0x397757,{'showHidden':![],'depth':null}));if(_0x397757['channelstate']!=='6')return;var _0x3d9992=this['agents'][_0x397757[_0x6314('0x3d')][_0x6314('0x3e')]('-')[0x0]];if(_0x397757[_0x6314('0x33')]!==_0x397757[_0x6314('0x48')]){var _0x5d960e=moment();if(this[_0x6314('0x14')][_0x397757['linkedid']]){if(!this[_0x6314('0x14')][_0x397757[_0x6314('0x48')]][_0x6314('0x67')]){this['channels'][_0x397757['linkedid']][_0x6314('0x67')]=!![];this['channels'][_0x397757[_0x6314('0x48')]][_0x6314('0x68')]=_0x5d960e[_0x6314('0x43')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x397757[_0x6314('0x48')]][_0x6314('0x59')]){this[_0x6314('0x14')][_0x397757['linkedid']][_0x6314('0x69')]=_0x5d960e[_0x6314('0x6a')](this[_0x6314('0x14')][_0x397757[_0x6314('0x48')]][_0x6314('0x59')],_0x6314('0x5c'));}}this[_0x6314('0x14')][_0x397757['linkedid']][_0x6314('0x48')]=_0x397757[_0x6314('0x33')];if(_0x397757[_0x6314('0x66')]!=='xcally-motion-preview'){this[_0x6314('0x14')][_0x397757[_0x6314('0x48')]]['connectedlinenum']=_0x397757[_0x6314('0x66')];}this['channels'][_0x397757[_0x6314('0x48')]][_0x6314('0x6b')]=_0x397757[_0x6314('0x34')];this[_0x6314('0x14')][_0x397757[_0x6314('0x48')]][_0x6314('0x6c')]=_0x397757[_0x6314('0x3d')];this[_0x6314('0x14')][_0x397757['linkedid']][_0x6314('0x4b')]=dispositions[_[_0x6314('0x4c')](_0x397757[_0x6314('0x4d')])];if(_0x3d9992){this[_0x6314('0x14')][_0x397757[_0x6314('0x48')]][_0x6314('0x6d')]=_0x3d9992['id'];this[_0x6314('0x14')][_0x397757[_0x6314('0x48')]]['membername']=_0x3d9992['name'];}}if(this[_0x6314('0x14')][_0x397757['uniqueid']]){if(!this[_0x6314('0x14')][_0x397757[_0x6314('0x33')]][_0x6314('0x67')]){this['channels'][_0x397757['uniqueid']]['answered']=!![];this['channels'][_0x397757[_0x6314('0x33')]][_0x6314('0x68')]=_0x5d960e[_0x6314('0x43')](_0x6314('0x4a'));if(this[_0x6314('0x14')][_0x397757['uniqueid']][_0x6314('0x59')]){this[_0x6314('0x14')][_0x397757['uniqueid']]['holdtime']=_0x5d960e['diff'](this[_0x6314('0x14')][_0x397757['uniqueid']][_0x6314('0x59')],'seconds');}}if(_0x397757[_0x6314('0x66')]!==_0x6314('0x40')){this[_0x6314('0x14')][_0x397757[_0x6314('0x33')]][_0x6314('0x42')]=_0x397757[_0x6314('0x66')];}this['channels'][_0x397757[_0x6314('0x33')]][_0x6314('0x6b')]=_0x397757[_0x6314('0x34')];this['channels'][_0x397757['uniqueid']][_0x6314('0x6c')]=_0x397757['channel'];this[_0x6314('0x14')][_0x397757[_0x6314('0x33')]]['disposition']=dispositions[_[_0x6314('0x4c')](_0x397757[_0x6314('0x4d')])];}}else{if(this['channels'][_0x397757[_0x6314('0x33')]]){if(_0x3d9992){this[_0x6314('0x14')][_0x397757[_0x6314('0x33')]][_0x6314('0x6d')]=_0x3d9992['id'];this[_0x6314('0x14')][_0x397757[_0x6314('0x33')]]['membername']=_0x3d9992[_0x6314('0x51')];}}}if(_0x397757[_0x6314('0x3b')]===_0x6314('0x3c')){if(_0x3d9992){_0x3d9992[_0x6314('0x41')]=_0x397757[_0x6314('0x3f')];var _0x55ba08;if(this[_0x6314('0x14')][_0x397757['uniqueid']]){_0x55ba08=this[_0x6314('0x14')][_0x397757['uniqueid']]['queue'];}else if(this['channels'][_0x397757[_0x6314('0x48')]]){_0x55ba08=this[_0x6314('0x14')][_0x397757['linkedid']][_0x6314('0x64')];}_0x3d9992[_0x6314('0x64')]=_0x55ba08;var _0x2fdead={'id':_0x3d9992['id'],'name':_0x3d9992[_0x6314('0x51')],'agentconnected':!![],'destaccountcode':_0x3d9992[_0x6314('0x50')],'destconnectedlinenum':_0x397757['exten'],'queue':_0x55ba08||undefined,'uniqueid':_0x397757[_0x6314('0x48')]};logger[_0x6314('0x35')](_0x6314('0x6e'),_0x397757[_0x6314('0x33')],util[_0x6314('0x37')](_0x2fdead,{'showHidden':![],'depth':null}));this[_0x6314('0x30')](util[_0x6314('0x43')]('user:%s',_0x3d9992['name']),_0x6314('0x52'),_0x2fdead);}}}}catch(_0x2ed14c){logger[_0x6314('0x2d')](_0x6314('0x6f'),_0x397757[_0x6314('0x33')],util[_0x6314('0x37')](_0x2ed14c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6314('0x2f')][_0x6314('0x70')]=function(_0x427519,_0x20dc50){try{if(this[_0x6314('0x14')][_0x427519]){logger[_0x6314('0x2a')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x427519,_0x20dc50);this['channels'][_0x427519][_0x6314('0x71')]=!![];if(_['endsWith'](_0x20dc50,'.wav49')){_0x20dc50=_0x20dc50[_0x6314('0x72')](_0x6314('0x73'),_0x6314('0x74'));}this[_0x6314('0x14')][_0x427519][_0x6314('0x75')]=_0x20dc50;var _0x47bbd9=_['find'](this[_0x6314('0x14')][_0x427519][_0x6314('0x76')],{'filename':_0x20dc50});if(_[_0x6314('0x63')](_0x47bbd9)){this['channels'][_0x427519][_0x6314('0x76')][_0x6314('0x77')]({'filename':_0x20dc50,'createdAt':moment()[_0x6314('0x43')](_0x6314('0x4a')),'mixmonitorid':'','status':_0x6314('0x78')});}}}catch(_0x1803fe){logger[_0x6314('0x2d')](_0x6314('0x79'),_0x427519,util['inspect'](_0x1803fe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6314('0x2f')]['syncVarSet']=function(_0x22eb53){try{if(this[_0x6314('0x31')](_0x22eb53)){logger[_0x6314('0x35')]('[%s][voiceCallReport][varset]\x20event:',_0x22eb53['uniqueid'],util[_0x6314('0x37')](_0x22eb53,{'showHidden':![],'depth':null}));if(this[_0x6314('0x14')][_0x22eb53[_0x6314('0x33')]]&&_0x22eb53[_0x6314('0x3d')]!=_0x6314('0x47')){if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')])){if(this['isNotNull'](_0x22eb53[_0x6314('0x7a')][_0x6314('0x7b')])){logger[_0x6314('0x2a')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x22eb53[_0x6314('0x33')],_0x22eb53[_0x6314('0x7c')]);this[_0x6314('0x70')](_0x22eb53[_0x6314('0x33')],_0x22eb53[_0x6314('0x7c')]);}else if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')][_0x6314('0x7d')])){logger[_0x6314('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x22eb53[_0x6314('0x33')],_0x22eb53[_0x6314('0x7c')]);this['channels'][_0x22eb53[_0x6314('0x33')]][_0x6314('0x66')]=_0x22eb53[_0x6314('0x7c')];}else if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')]['xmd-callerid'])){logger[_0x6314('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x22eb53[_0x6314('0x33')],_0x22eb53[_0x6314('0x7c')]);this['channels'][_0x22eb53[_0x6314('0x33')]][_0x6314('0x7e')]=_0x22eb53[_0x6314('0x7c')];}else if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')][_0x6314('0x7f')])){logger['info'](_0x6314('0x80'),_0x22eb53[_0x6314('0x33')],_0x22eb53['value']);this[_0x6314('0x14')][_0x22eb53[_0x6314('0x33')]][_0x6314('0x62')]=_0x22eb53['value'];}else if(this[_0x6314('0x31')](_0x22eb53['variable'][_0x6314('0x81')])){logger[_0x6314('0x2a')](_0x6314('0x82'),_0x22eb53['uniqueid'],_0x22eb53['value'][_0x6314('0x3e')](',')[0x0]);this[_0x6314('0x14')][_0x22eb53[_0x6314('0x33')]]['queue']=_0x22eb53['value'][_0x6314('0x3e')](',')[0x0];}else if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')]['xmd-originatecalleridnum'])){logger['info'](_0x6314('0x83'),_0x22eb53[_0x6314('0x33')],_0x22eb53[_0x6314('0x7c')]);this[_0x6314('0x14')][_0x22eb53[_0x6314('0x33')]]['originatecalleridnum']=_0x22eb53[_0x6314('0x7c')];}else if(this['isNotNull'](_0x22eb53[_0x6314('0x7a')][_0x6314('0x84')])){logger[_0x6314('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x22eb53[_0x6314('0x33')],_0x22eb53[_0x6314('0x7c')]);this[_0x6314('0x14')][_0x22eb53[_0x6314('0x33')]][_0x6314('0x85')]=_0x22eb53['value'];}else if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')][_0x6314('0x86')])){logger['info'](_0x6314('0x87'),_0x22eb53['uniqueid'],_0x22eb53[_0x6314('0x7c')]);this[_0x6314('0x14')][_0x22eb53[_0x6314('0x33')]][_0x6314('0x88')]=_0x22eb53[_0x6314('0x7c')];}else if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')][_0x6314('0x89')])){logger[_0x6314('0x2a')](_0x6314('0x8a'),_0x22eb53[_0x6314('0x33')],_0x22eb53[_0x6314('0x7c')]);this[_0x6314('0x14')][_0x22eb53[_0x6314('0x33')]][_0x6314('0x64')]=_0x22eb53['value'];}else if(this['isNotNull'](_0x22eb53[_0x6314('0x7a')]['sipcallid'])){logger[_0x6314('0x2a')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x22eb53[_0x6314('0x33')],_0x22eb53['value']);this[_0x6314('0x14')][_0x22eb53[_0x6314('0x33')]]['sipcalluniqueid']=_0x22eb53[_0x6314('0x7c')];}}}else if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')]['mixmonitor_filename'])){if(_0x22eb53['value']){var _0x3c40e1=path[_0x6314('0x8b')](_0x22eb53[_0x6314('0x7c')])[_0x6314('0x51')];logger[_0x6314('0x2a')](_0x6314('0x8c'),_0x3c40e1,_0x22eb53[_0x6314('0x7c')]);this['syncMixMonitorFilename'](_0x3c40e1,_0x22eb53[_0x6314('0x7c')]);}}else if(this[_0x6314('0x14')][_0x22eb53['linkedid']]){if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')])){if(this[_0x6314('0x31')](_0x22eb53[_0x6314('0x7a')][_0x6314('0x8d')])){logger['info'](_0x6314('0x8e'),_0x22eb53[_0x6314('0x48')],_0x22eb53[_0x6314('0x7c')]);this['channels'][_0x22eb53[_0x6314('0x48')]][_0x6314('0x8f')]=_0x22eb53['value'];}}}}}catch(_0x84978b){logger[_0x6314('0x2d')]('[%s][voiceCallReport][varset]',_0x22eb53[_0x6314('0x33')],util[_0x6314('0x37')](_0x84978b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6314('0x2f')]['syncHangup']=function(_0x3d10a7){try{if(this[_0x6314('0x31')](_0x3d10a7)){logger[_0x6314('0x35')](_0x6314('0x90'),_0x3d10a7[_0x6314('0x33')],util[_0x6314('0x37')](_0x3d10a7,{'showHidden':![],'depth':null}));if(this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]]){if(this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]]['linkedid']]){this['channels'][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x48')]][_0x6314('0x33')]=_0x3d10a7[_0x6314('0x33')];this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]]['linkedid']][_0x6314('0x67')]=this[_0x6314('0x14')][_0x3d10a7[_0x6314('0x33')]][_0x6314('0x67')];this['channels'][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x48')]][_0x6314('0x68')]=this['channels'][_0x3d10a7[_0x6314('0x33')]][_0x6314('0x68')];this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x48')]][_0x6314('0x6c')]=this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x48')]][_0x6314('0x3d')];this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x48')]][_0x6314('0x4b')]=this['channels'][_0x3d10a7[_0x6314('0x33')]][_0x6314('0x4b')];this['channels'][_0x3d10a7[_0x6314('0x33')]]=this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x48')]];this[_0x6314('0x91')](this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x48')]);}else if(this['channels'][this[_0x6314('0x16')][_0x3d10a7['linkedid']]['uniqueid']]){this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x33')]][_0x6314('0x33')]=[this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7['linkedid']]['uniqueid']][_0x6314('0x48')],this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]]['uniqueid']][_0x6314('0x48')]=this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]]['uniqueid']]['uniqueid']][0x0];this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x33')]][_0x6314('0x67')]=this[_0x6314('0x14')][_0x3d10a7[_0x6314('0x33')]][_0x6314('0x67')];this[_0x6314('0x14')][this['blindTransfers'][_0x3d10a7['linkedid']]['uniqueid']][_0x6314('0x68')]=this[_0x6314('0x14')][_0x3d10a7['uniqueid']]['answertime'];this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x33')]][_0x6314('0x6c')]=this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x33')]][_0x6314('0x3d')];this[_0x6314('0x14')][this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]]['uniqueid']][_0x6314('0x4b')]=this['channels'][_0x3d10a7[_0x6314('0x33')]][_0x6314('0x4b')];this['channels'][_0x3d10a7[_0x6314('0x33')]]=this[_0x6314('0x14')][this['blindTransfers'][_0x3d10a7['linkedid']]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0x6314('0x16')][_0x3d10a7[_0x6314('0x48')]][_0x6314('0x33')]);}}if(this[_0x6314('0x14')][_0x3d10a7['uniqueid']]){logger[_0x6314('0x2a')](_0x6314('0x92'),_0x3d10a7[_0x6314('0x33')],_0x3d10a7[_0x6314('0x93')]);var _0x29dfee=moment();this['channels'][_0x3d10a7[_0x6314('0x33')]]['endtime']=_0x29dfee[_0x6314('0x43')](_0x6314('0x4a'));this[_0x6314('0x14')][_0x3d10a7[_0x6314('0x33')]]['duration']=_0x29dfee[_0x6314('0x6a')](this[_0x6314('0x14')][_0x3d10a7[_0x6314('0x33')]]['starttime'],_0x6314('0x5c'));if(this[_0x6314('0x14')][_0x3d10a7[_0x6314('0x33')]][_0x6314('0x67')]){this[_0x6314('0x14')][_0x3d10a7['uniqueid']]['billableseconds']=_0x29dfee[_0x6314('0x6a')](this[_0x6314('0x14')][_0x3d10a7[_0x6314('0x33')]]['answertime'],'seconds');this['channels'][_0x3d10a7[_0x6314('0x33')]]['holdtime']=this[_0x6314('0x14')][_0x3d10a7[_0x6314('0x33')]]['duration']-this[_0x6314('0x14')][_0x3d10a7[_0x6314('0x33')]]['billableseconds'];}if(_0x3d10a7['context']===_0x6314('0x3c')){if(this[_0x6314('0x15')][_0x3d10a7['channel'][_0x6314('0x3e')]('-')[0x0]]){this[_0x6314('0x15')][_0x3d10a7[_0x6314('0x3d')]['split']('-')[0x0]]=_[_0x6314('0x94')](this[_0x6314('0x15')][_0x3d10a7[_0x6314('0x3d')]['split']('-')[0x0]],[_0x6314('0x41')]);logger[_0x6314('0x35')](_0x6314('0x95'),_0x3d10a7[_0x6314('0x33')],util['inspect']({'id':this[_0x6314('0x15')][_0x3d10a7[_0x6314('0x3d')][_0x6314('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0x6314('0x15')][_0x3d10a7[_0x6314('0x3d')]['split']('-')[0x0]][_0x6314('0x50')]},{'showHidden':![],'depth':null}));this[_0x6314('0x30')](util[_0x6314('0x43')]('user:%s',this[_0x6314('0x15')][_0x3d10a7[_0x6314('0x3d')][_0x6314('0x3e')]('-')[0x0]]['name']),_0x6314('0x96'),{'id':this[_0x6314('0x15')][_0x3d10a7[_0x6314('0x3d')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x6314('0x15')][_0x3d10a7[_0x6314('0x3d')][_0x6314('0x3e')]('-')[0x0]]['accountcode']});for(var _0x259171=0x0;_0x259171{delete this[_0x6314('0x14')][_0x54d958];},_0x11c7eb);}};module[_0x6314('0xc5')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 8f8eae7..ff2c524 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa728=['info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','YYYY-MM-DD\x20HH:mm:ss','duration','diff','starttime','seconds','lastevent','complete','total','answertime','answered','billableseconds','sumHoldTime','holdtime','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','application','set','applicationdata','appdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncHangup','isNotNull','isUndefined','prototype','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','format','channel','substring','lastIndexOf','omit','event','interface','emit','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','ANSWER','connectedlinenum','connectedlinename','connect'];(function(_0xcca2ea,_0x3942fe){var _0x6b85d1=function(_0x4e8ef1){while(--_0x4e8ef1){_0xcca2ea['push'](_0xcca2ea['shift']());}};_0x6b85d1(++_0x3942fe);}(_0xa728,0xb4));var _0x8a72=function(_0x150598,_0xde21f7){_0x150598=_0x150598-0x0;var _0x4840e2=_0xa728[_0x150598];return _0x4840e2;};'use strict';var _=require(_0x8a72('0x0'));var moment=require(_0x8a72('0x1'));var util=require(_0x8a72('0x2'));var Redis=require(_0x8a72('0x3'));var config=require('../../../config/environment');var logger=require(_0x8a72('0x4'))(_0x8a72('0x5'));var ami=require(_0x8a72('0x6'));config[_0x8a72('0x7')]=_['defaults'](config[_0x8a72('0x7')],{'host':_0x8a72('0x8'),'port':0x18eb});var io=require(_0x8a72('0x9'))(new Redis(config[_0x8a72('0x7')]));function VoiceDialReport(_0x44a8a9){this[_0x8a72('0xa')]=_0x44a8a9[_0x8a72('0xb')];this[_0x8a72('0xc')]=_0x44a8a9[_0x8a72('0xc')];this[_0x8a72('0xd')]={};this[_0x8a72('0xe')]={};ami['on'](_0x8a72('0xf'),this[_0x8a72('0x10')][_0x8a72('0x11')](this));ami['on'](_0x8a72('0x12'),this[_0x8a72('0x13')][_0x8a72('0x11')](this));ami['on'](_0x8a72('0x14'),this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x8a72('0x15')]['bind'](this));}VoiceDialReport['prototype'][_0x8a72('0x16')]=function(_0x1c9467){return _0x1c9467!==null&&!_[_0x8a72('0x17')](_0x1c9467);};VoiceDialReport[_0x8a72('0x18')]['emit']=function(_0x17a65b,_0x14840f,_0x1a9533){io['to'](_0x17a65b)['emit'](_0x14840f,_0x1a9533);};VoiceDialReport[_0x8a72('0x18')][_0x8a72('0x10')]=function(_0xce0af){try{if(this[_0x8a72('0x16')](_0xce0af)){logger[_0x8a72('0x19')](_0x8a72('0x1a'),_0xce0af['uniqueid'],util[_0x8a72('0x1b')](_0xce0af,{'showHidden':![],'depth':null}));if(this['channels'][_0xce0af[_0x8a72('0x1c')]]){_[_0x8a72('0x1d')](this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]],{'starttime':moment()[_0x8a72('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0xce0af[_0x8a72('0x1f')][_0x8a72('0x20')](0x0,_0xce0af[_0x8a72('0x1f')][_0x8a72('0x21')]('-')),'membername':_0xce0af[_0x8a72('0x1f')][_0x8a72('0x20')](_0xce0af['channel'][_0x8a72('0x21')]('/')+0x1,_0xce0af[_0x8a72('0x1f')][_0x8a72('0x21')]('-'))},_[_0x8a72('0x22')](_0xce0af,[_0x8a72('0x23'),'privilege']));logger['info']('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0xce0af[_0x8a72('0x1c')],this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]]['membername'],this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]][_0x8a72('0x24')]);logger[_0x8a72('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0xce0af[_0x8a72('0x1c')],util[_0x8a72('0x1b')](this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));if(this[_0x8a72('0xd')][_0xce0af[_0x8a72('0x1c')]])_[_0x8a72('0x1d')](this['channels'][_0xce0af[_0x8a72('0x1c')]],this['applications'][_0xce0af[_0x8a72('0x1c')]]);this[_0x8a72('0x25')]('voice:outbound',_0x8a72('0x26'),this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]]);logger['debug'](_0x8a72('0x27'),_0xce0af[_0x8a72('0x1c')],util['inspect'](this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8a72('0x28'),this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]]);}}}catch(_0x238c2a){logger[_0x8a72('0x29')](_0x8a72('0x2a'),_0xce0af['uniqueid'],util['inspect'](_0x238c2a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a72('0x18')][_0x8a72('0x13')]=function(_0x148fd1){try{if(this[_0x8a72('0x16')](_0x148fd1)){logger[_0x8a72('0x19')](_0x8a72('0x2b'),_0x148fd1[_0x8a72('0x1c')],util['inspect'](_0x148fd1,{'showHidden':![],'depth':null}));if(this[_0x8a72('0xa')][_0x148fd1['uniqueid']]){this[_0x8a72('0xa')][_0x148fd1['uniqueid']]['dialstatus']=_0x148fd1['dialstatus'];if(_0x148fd1['dialstatus']===_0x8a72('0x2c')){this['channels'][_0x148fd1[_0x8a72('0x1c')]][_0x8a72('0x2d')]=_0x148fd1[_0x8a72('0x2d')];this[_0x8a72('0xa')][_0x148fd1[_0x8a72('0x1c')]][_0x8a72('0x2e')]=_0x148fd1[_0x8a72('0x2e')];this[_0x8a72('0xa')][_0x148fd1['uniqueid']]['answertime']=moment()[_0x8a72('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x148fd1[_0x8a72('0x1c')]]['lastevent']=_0x8a72('0x2f');logger[_0x8a72('0x30')](_0x8a72('0x31'),_0x148fd1['uniqueid'],_0x148fd1[_0x8a72('0x1f')][_0x8a72('0x20')](_0x148fd1[_0x8a72('0x1f')][_0x8a72('0x21')]('/')+0x1,_0x148fd1[_0x8a72('0x1f')][_0x8a72('0x21')]('-')));logger['debug'](_0x8a72('0x32'),_0x148fd1['uniqueid'],util['inspect'](this[_0x8a72('0xa')][_0x148fd1['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8a72('0x25')]('custom:dialconnect',this[_0x8a72('0xa')][_0x148fd1[_0x8a72('0x1c')]]);}logger[_0x8a72('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x148fd1[_0x8a72('0x1c')],util[_0x8a72('0x1b')](this['channels'][_0x148fd1[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));this[_0x8a72('0x25')](_0x8a72('0x33'),_0x8a72('0x26'),this['channels'][_0x148fd1['uniqueid']]);}}}catch(_0x35b1a6){logger['error'](_0x8a72('0x34'),_0x148fd1[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x35b1a6,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x19f7ef){try{if(this[_0x8a72('0x16')](_0x19f7ef)){logger[_0x8a72('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x19f7ef['uniqueid'],util['inspect'](_0x19f7ef,{'showHidden':![],'depth':null}));this[_0x8a72('0x35')](_0x19f7ef[_0x8a72('0x1c')],_[_0x8a72('0x36')](_0x19f7ef[_0x8a72('0x37')])[0x0],_0x19f7ef[_0x8a72('0x38')]);if(this['isNotNull'](_0x19f7ef[_0x8a72('0x37')])&&this[_0x8a72('0x16')](_0x19f7ef['variable'][_0x8a72('0x39')])){if(_[_0x8a72('0x17')](this[_0x8a72('0xa')][_0x19f7ef[_0x8a72('0x1c')]])){this['channels'][_0x19f7ef[_0x8a72('0x1c')]]={'routeId':_0x19f7ef['value'],'variables':this['variables'][_0x19f7ef[_0x8a72('0x1c')]],'motionChannel':'voice'};logger[_0x8a72('0x30')](_0x8a72('0x3a'),_0x19f7ef['uniqueid'],_0x19f7ef[_0x8a72('0x37')][_0x8a72('0x39')],_[_0x8a72('0x36')](_0x19f7ef['variable'])[0x0],_0x19f7ef[_0x8a72('0x38')]);logger[_0x8a72('0x19')](_0x8a72('0x3b'),_0x19f7ef[_0x8a72('0x1c')],util['inspect'](this[_0x8a72('0xa')][_0x19f7ef[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));this[_0x8a72('0x25')]('voice:outbound',_0x8a72('0x26'),this[_0x8a72('0xa')][_0x19f7ef[_0x8a72('0x1c')]]);}}}}catch(_0x271c66){logger[_0x8a72('0x29')]('[%s][voiceDialReport][varset]',_0x19f7ef[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x271c66,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x73aa50,_0x3bbeb2,_0x15df4e){var _0x2a03d1=[_0x8a72('0x3c'),'rtpaudioqosbridged',_0x8a72('0x3d'),_0x8a72('0x3e'),_0x8a72('0x3f'),'rtpaudioqoslossbridged',_0x8a72('0x40'),_0x8a72('0x41'),'sipcallid',_0x8a72('0x42'),_0x8a72('0x43'),_0x8a72('0x44'),_0x8a72('0x45'),_0x8a72('0x46'),_0x8a72('0x47'),_0x8a72('0x48'),'membername',_0x8a72('0x49'),'memberrealtime'];if(!_[_0x8a72('0x4a')](_0x3bbeb2)&&!_['includes'](_0x2a03d1,_0x3bbeb2)){if(_['isUndefined'](this['variables'][_0x73aa50])){this[_0x8a72('0xe')][_0x73aa50]={};}this['variables'][_0x73aa50][_0x3bbeb2]=_0x15df4e;}};VoiceDialReport[_0x8a72('0x18')][_0x8a72('0x15')]=function(_0x4f156e){try{if(this['isNotNull'](_0x4f156e)){logger[_0x8a72('0x19')]('[%s][voiceDialReport][hangup]\x20event:',_0x4f156e[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x4f156e,{'showHidden':![],'depth':null}));if(this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]){logger[_0x8a72('0x30')](_0x8a72('0x4b'),_0x4f156e['uniqueid'],_0x4f156e[_0x8a72('0x4c')]);this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x4d')]=moment()[_0x8a72('0x1e')](_0x8a72('0x4e'));this['channels'][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x4f')]=moment(this['channels'][_0x4f156e['uniqueid']][_0x8a72('0x4d')])[_0x8a72('0x50')](this['channels'][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x51')],_0x8a72('0x52'));this['channels'][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x53')]=_0x8a72('0x54');this[_0x8a72('0xc')][_0x8a72('0x55')]+=0x1;if(this[_0x8a72('0xa')][_0x4f156e['uniqueid']][_0x8a72('0x56')]){this[_0x8a72('0xc')][_0x8a72('0x57')]+=0x1;this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]['holdtime']=moment(this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]['answertime'])[_0x8a72('0x50')](this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x51')],_0x8a72('0x52'));this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x58')]=moment(this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x4d')])[_0x8a72('0x50')](this['channels'][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x56')],'seconds');this[_0x8a72('0xc')][_0x8a72('0x59')]+=this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x5a')]||0x0;this[_0x8a72('0xc')]['sumBillable']+=this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]['billableseconds'];}this[_0x8a72('0xc')]['sumDuration']+=this[_0x8a72('0xa')][_0x4f156e['uniqueid']][_0x8a72('0x4f')];logger[_0x8a72('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x4f156e[_0x8a72('0x1c')],util['inspect'](this[_0x8a72('0xa')][_0x4f156e['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8a72('0x25')](_0x8a72('0x5b'),this['channels'][_0x4f156e[_0x8a72('0x1c')]]);logger[_0x8a72('0x19')](_0x8a72('0x5c'),_0x4f156e[_0x8a72('0x1c')],util[_0x8a72('0x1b')](this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]);logger[_0x8a72('0x19')](_0x8a72('0x5d'),_0x4f156e[_0x8a72('0x1c')],util[_0x8a72('0x1b')](this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x8a72('0x33'),_0x8a72('0x5e'),this[_0x8a72('0xc')]);logger[_0x8a72('0x30')](_0x8a72('0x5f'),JSON[_0x8a72('0x60')](this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]));logger[_0x8a72('0x19')](_0x8a72('0x61'),_0x4f156e['uniqueid'],util['inspect'](this['channels'][_0x4f156e[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));this[_0x8a72('0x25')](_0x8a72('0x33'),_0x8a72('0x62'),this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]);this[_0x8a72('0x63')](_0x4f156e[_0x8a72('0x1c')]);}else if(this['channels'][_0x4f156e['linkedid']]){this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x64')]][_0x8a72('0x1c')]=this[_0x8a72('0xa')][_0x4f156e['linkedid']][_0x8a72('0x65')];}if(this['variables'][_0x4f156e['uniqueid']]){delete this['variables'][_0x4f156e[_0x8a72('0x1c')]];}}}catch(_0x2400d9){logger[_0x8a72('0x29')](_0x8a72('0x66'),_0x4f156e[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x2400d9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a72('0x18')][_0x8a72('0x67')]=function(_0x5dc40d){try{if(this[_0x8a72('0x16')](_0x5dc40d)){logger[_0x8a72('0x19')]('[%s][voiceDialReport][newexten]\x20event:',_0x5dc40d[_0x8a72('0x1c')],util['inspect'](_0x5dc40d,{'showHidden':![],'depth':null}));if(_0x5dc40d[_0x8a72('0x68')]['toLowerCase']()===_0x8a72('0x69')){_0x5dc40d[_0x8a72('0x6a')]=(_0x5dc40d[_0x8a72('0x6b')]||_0x5dc40d[_0x8a72('0x6a')])[_0x8a72('0x6c')]();if(_[_0x8a72('0x6d')](_0x5dc40d[_0x8a72('0x6a')],_0x8a72('0x6e'))){if(_[_0x8a72('0x17')](this[_0x8a72('0xd')][_0x5dc40d[_0x8a72('0x1c')]]))this['applications'][_0x5dc40d['uniqueid']]={};logger[_0x8a72('0x30')](_0x8a72('0x6f'),_0x5dc40d['uniqueid'],_0x5dc40d[_0x8a72('0x68')],_0x5dc40d['applicationdata']);var _0x1c7401=_0x5dc40d[_0x8a72('0x6a')][_0x8a72('0x70')]('=');var _0x5d85aa=_0x1c7401[0x0]['match'](/cdr\((.*)\)/);if(_0x5d85aa)this[_0x8a72('0xd')][_0x5dc40d[_0x8a72('0x1c')]][_0x5d85aa[0x1]]=_0x1c7401[0x1];}}}}catch(_0x189b50){logger[_0x8a72('0x29')]('[%s][voiceDialReport][newexten]',_0x5dc40d[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x189b50,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a72('0x18')]['deleteChannelAfterTimeout']=function(_0x316c96,_0x52a9e7=0x2710){if(this[_0x8a72('0xa')][_0x316c96]){setTimeout(()=>{delete this[_0x8a72('0xa')][_0x316c96];},_0x52a9e7);}};module[_0x8a72('0x71')]=VoiceDialReport; \ No newline at end of file +var _0xe0c9=['variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','cause-txt','duration','diff','starttime','complete','total','answertime','holdtime','seconds','billableseconds','endtime','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','application','toLowerCase','set','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../ami','redis','localhost','socket.io-emitter','outboundChannels','outbound','applications'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xe0c9,0x1ba));var _0x9e0c=function(_0x2efd4b,_0x30fc7f){_0x2efd4b=_0x2efd4b-0x0;var _0x7e70b7=_0xe0c9[_0x2efd4b];return _0x7e70b7;};'use strict';var _=require('lodash');var moment=require(_0x9e0c('0x0'));var util=require(_0x9e0c('0x1'));var Redis=require(_0x9e0c('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0x9e0c('0x3'));config[_0x9e0c('0x4')]=_['defaults'](config['redis'],{'host':_0x9e0c('0x5'),'port':0x18eb});var io=require(_0x9e0c('0x6'))(new Redis(config['redis']));function VoiceDialReport(_0x5427f2){this['channels']=_0x5427f2[_0x9e0c('0x7')];this[_0x9e0c('0x8')]=_0x5427f2[_0x9e0c('0x8')];this[_0x9e0c('0x9')]={};this[_0x9e0c('0xa')]={};ami['on'](_0x9e0c('0xb'),this[_0x9e0c('0xc')][_0x9e0c('0xd')](this));ami['on'](_0x9e0c('0xe'),this[_0x9e0c('0xf')][_0x9e0c('0xd')](this));ami['on'](_0x9e0c('0x10'),this[_0x9e0c('0x11')][_0x9e0c('0xd')](this));ami['on'](_0x9e0c('0x12'),this['syncHangup'][_0x9e0c('0xd')](this));}VoiceDialReport[_0x9e0c('0x13')][_0x9e0c('0x14')]=function(_0x52fb8f){return _0x52fb8f!==null&&!_[_0x9e0c('0x15')](_0x52fb8f);};VoiceDialReport[_0x9e0c('0x13')][_0x9e0c('0x16')]=function(_0x5cd2a1,_0x28c790,_0x5d6f8a){io['to'](_0x5cd2a1)[_0x9e0c('0x16')](_0x28c790,_0x5d6f8a);};VoiceDialReport[_0x9e0c('0x13')][_0x9e0c('0xc')]=function(_0x337403){try{if(this[_0x9e0c('0x14')](_0x337403)){logger[_0x9e0c('0x17')](_0x9e0c('0x18'),_0x337403[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](_0x337403,{'showHidden':![],'depth':null}));if(this['channels'][_0x337403[_0x9e0c('0x19')]]){_[_0x9e0c('0x1b')](this[_0x9e0c('0x1c')][_0x337403[_0x9e0c('0x19')]],{'starttime':moment()[_0x9e0c('0x1d')](_0x9e0c('0x1e')),'lastevent':_0x9e0c('0x1f'),'interface':_0x337403[_0x9e0c('0x20')][_0x9e0c('0x21')](0x0,_0x337403['channel'][_0x9e0c('0x22')]('-')),'membername':_0x337403[_0x9e0c('0x20')][_0x9e0c('0x21')](_0x337403[_0x9e0c('0x20')]['lastIndexOf']('/')+0x1,_0x337403[_0x9e0c('0x20')][_0x9e0c('0x22')]('-'))},_['omit'](_0x337403,[_0x9e0c('0x23'),'privilege']));logger['info'](_0x9e0c('0x24'),_0x337403[_0x9e0c('0x19')],this[_0x9e0c('0x1c')][_0x337403[_0x9e0c('0x19')]][_0x9e0c('0x25')],this[_0x9e0c('0x1c')][_0x337403[_0x9e0c('0x19')]]['interface']);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x337403[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](this[_0x9e0c('0x1c')][_0x337403[_0x9e0c('0x19')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x337403['uniqueid']])_['merge'](this[_0x9e0c('0x1c')][_0x337403[_0x9e0c('0x19')]],this['applications'][_0x337403[_0x9e0c('0x19')]]);this[_0x9e0c('0x16')](_0x9e0c('0x26'),_0x9e0c('0x27'),this['channels'][_0x337403['uniqueid']]);logger[_0x9e0c('0x17')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x337403['uniqueid'],util['inspect'](this[_0x9e0c('0x1c')][_0x337403[_0x9e0c('0x19')]],{'showHidden':![],'depth':null}));ami[_0x9e0c('0x16')](_0x9e0c('0x28'),this[_0x9e0c('0x1c')][_0x337403[_0x9e0c('0x19')]]);}}}catch(_0xdad5f7){logger[_0x9e0c('0x29')]('[%s][voiceDialReport][dialbegin]',_0x337403['uniqueid'],util['inspect'](_0xdad5f7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9e0c('0x13')]['syncDialEnd']=function(_0x3ea479){try{if(this[_0x9e0c('0x14')](_0x3ea479)){logger[_0x9e0c('0x17')](_0x9e0c('0x2a'),_0x3ea479[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](_0x3ea479,{'showHidden':![],'depth':null}));if(this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]]){this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]][_0x9e0c('0x2b')]=_0x3ea479['dialstatus'];if(_0x3ea479[_0x9e0c('0x2b')]===_0x9e0c('0x2c')){this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]][_0x9e0c('0x2d')]=_0x3ea479['connectedlinenum'];this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]][_0x9e0c('0x2e')]=_0x3ea479[_0x9e0c('0x2e')];this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]]['answertime']=moment()[_0x9e0c('0x1d')](_0x9e0c('0x1e'));this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]][_0x9e0c('0x2f')]=_0x9e0c('0x30');logger[_0x9e0c('0x31')](_0x9e0c('0x32'),_0x3ea479['uniqueid'],_0x3ea479[_0x9e0c('0x20')][_0x9e0c('0x21')](_0x3ea479[_0x9e0c('0x20')][_0x9e0c('0x22')]('/')+0x1,_0x3ea479[_0x9e0c('0x20')]['lastIndexOf']('-')));logger[_0x9e0c('0x17')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x3ea479[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]],{'showHidden':![],'depth':null}));ami[_0x9e0c('0x16')](_0x9e0c('0x33'),this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]]);}logger['debug'](_0x9e0c('0x34'),_0x3ea479[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](this['channels'][_0x3ea479['uniqueid']],{'showHidden':![],'depth':null}));this[_0x9e0c('0x16')](_0x9e0c('0x26'),_0x9e0c('0x27'),this[_0x9e0c('0x1c')][_0x3ea479[_0x9e0c('0x19')]]);}}}catch(_0x190480){logger[_0x9e0c('0x29')](_0x9e0c('0x35'),_0x3ea479[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](_0x190480,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9e0c('0x13')][_0x9e0c('0x11')]=function(_0x5cdda6){try{if(this[_0x9e0c('0x14')](_0x5cdda6)){logger['debug']('[%s][voiceDialReport][varset]\x20event:',_0x5cdda6[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](_0x5cdda6,{'showHidden':![],'depth':null}));this['addVariable'](_0x5cdda6['uniqueid'],_['keys'](_0x5cdda6[_0x9e0c('0x36')])[0x0],_0x5cdda6[_0x9e0c('0x37')]);if(this['isNotNull'](_0x5cdda6[_0x9e0c('0x36')])&&this['isNotNull'](_0x5cdda6['variable'][_0x9e0c('0x38')])){if(_['isUndefined'](this[_0x9e0c('0x1c')][_0x5cdda6[_0x9e0c('0x19')]])){this[_0x9e0c('0x1c')][_0x5cdda6['uniqueid']]={'routeId':_0x5cdda6[_0x9e0c('0x37')],'variables':this[_0x9e0c('0xa')][_0x5cdda6[_0x9e0c('0x19')]],'motionChannel':_0x9e0c('0x39')};logger[_0x9e0c('0x31')](_0x9e0c('0x3a'),_0x5cdda6[_0x9e0c('0x19')],_0x5cdda6[_0x9e0c('0x36')][_0x9e0c('0x38')],_[_0x9e0c('0x3b')](_0x5cdda6[_0x9e0c('0x36')])[0x0],_0x5cdda6[_0x9e0c('0x37')]);logger[_0x9e0c('0x17')](_0x9e0c('0x3c'),_0x5cdda6[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](this['channels'][_0x5cdda6['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x9e0c('0x26'),_0x9e0c('0x27'),this[_0x9e0c('0x1c')][_0x5cdda6[_0x9e0c('0x19')]]);}}}}catch(_0x162162){logger[_0x9e0c('0x29')](_0x9e0c('0x3d'),_0x5cdda6[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](_0x162162,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9e0c('0x13')][_0x9e0c('0x3e')]=function(_0x5dbf5a,_0x566c11,_0x3fec63){var _0x31ab34=['rtpaudioqos','rtpaudioqosbridged',_0x9e0c('0x3f'),_0x9e0c('0x40'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x9e0c('0x41'),_0x9e0c('0x42'),_0x9e0c('0x43'),_0x9e0c('0x44'),_0x9e0c('0x45'),_0x9e0c('0x46'),_0x9e0c('0x47'),'memberdynamic',_0x9e0c('0x48'),_0x9e0c('0x49'),_0x9e0c('0x25'),_0x9e0c('0x4a'),_0x9e0c('0x4b')];if(!_[_0x9e0c('0x4c')](_0x566c11)&&!_[_0x9e0c('0x4d')](_0x31ab34,_0x566c11)){if(_[_0x9e0c('0x15')](this[_0x9e0c('0xa')][_0x5dbf5a])){this[_0x9e0c('0xa')][_0x5dbf5a]={};}this[_0x9e0c('0xa')][_0x5dbf5a][_0x566c11]=_0x3fec63;}};VoiceDialReport[_0x9e0c('0x13')][_0x9e0c('0x4e')]=function(_0x166dbb){try{if(this[_0x9e0c('0x14')](_0x166dbb)){logger['debug'](_0x9e0c('0x4f'),_0x166dbb[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](_0x166dbb,{'showHidden':![],'depth':null}));if(this['channels'][_0x166dbb[_0x9e0c('0x19')]]){logger[_0x9e0c('0x31')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x166dbb[_0x9e0c('0x19')],_0x166dbb[_0x9e0c('0x50')]);this[_0x9e0c('0x1c')][_0x166dbb['uniqueid']]['endtime']=moment()[_0x9e0c('0x1d')](_0x9e0c('0x1e'));this[_0x9e0c('0x1c')][_0x166dbb['uniqueid']][_0x9e0c('0x51')]=moment(this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]]['endtime'])[_0x9e0c('0x52')](this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x53')],'seconds');this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x2f')]=_0x9e0c('0x54');this[_0x9e0c('0x8')][_0x9e0c('0x55')]+=0x1;if(this['channels'][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x56')]){this[_0x9e0c('0x8')]['answered']+=0x1;this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x57')]=moment(this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x56')])[_0x9e0c('0x52')](this['channels'][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x53')],_0x9e0c('0x58'));this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x59')]=moment(this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x5a')])[_0x9e0c('0x52')](this['channels'][_0x166dbb['uniqueid']][_0x9e0c('0x56')],_0x9e0c('0x58'));this[_0x9e0c('0x8')]['sumHoldTime']+=this['channels'][_0x166dbb['uniqueid']][_0x9e0c('0x57')]||0x0;this[_0x9e0c('0x8')]['sumBillable']+=this['channels'][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x59')];}this['outbound'][_0x9e0c('0x5b')]+=this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]][_0x9e0c('0x51')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x166dbb[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]],{'showHidden':![],'depth':null}));ami[_0x9e0c('0x16')](_0x9e0c('0x5c'),this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]]);logger[_0x9e0c('0x17')](_0x9e0c('0x5d'),_0x166dbb[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]],{'showHidden':![],'depth':null}));ami[_0x9e0c('0x16')](_0x9e0c('0x5e'),this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]]);logger[_0x9e0c('0x17')](_0x9e0c('0x5f'),_0x166dbb[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]],{'showHidden':![],'depth':null}));this[_0x9e0c('0x16')](_0x9e0c('0x26'),'voice_outbound:save',this[_0x9e0c('0x8')]);logger[_0x9e0c('0x31')](_0x9e0c('0x60'),JSON[_0x9e0c('0x61')](this['channels'][_0x166dbb['uniqueid']]));logger[_0x9e0c('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x166dbb['uniqueid'],util[_0x9e0c('0x1a')](this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:remove',this[_0x9e0c('0x1c')][_0x166dbb['uniqueid']]);this[_0x9e0c('0x62')](_0x166dbb[_0x9e0c('0x19')]);}else if(this[_0x9e0c('0x1c')][_0x166dbb['linkedid']]){this[_0x9e0c('0x1c')][_0x166dbb['linkedid']][_0x9e0c('0x19')]=this[_0x9e0c('0x1c')][_0x166dbb[_0x9e0c('0x63')]][_0x9e0c('0x64')];}if(this[_0x9e0c('0xa')][_0x166dbb[_0x9e0c('0x19')]]){delete this[_0x9e0c('0xa')][_0x166dbb['uniqueid']];}}}catch(_0x3514d3){logger[_0x9e0c('0x29')](_0x9e0c('0x65'),_0x166dbb[_0x9e0c('0x19')],util[_0x9e0c('0x1a')](_0x3514d3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9e0c('0x66')]=function(_0x190b56){try{if(this[_0x9e0c('0x14')](_0x190b56)){logger[_0x9e0c('0x17')]('[%s][voiceDialReport][newexten]\x20event:',_0x190b56['uniqueid'],util[_0x9e0c('0x1a')](_0x190b56,{'showHidden':![],'depth':null}));if(_0x190b56[_0x9e0c('0x67')][_0x9e0c('0x68')]()===_0x9e0c('0x69')){_0x190b56['applicationdata']=(_0x190b56['appdata']||_0x190b56['applicationdata'])[_0x9e0c('0x68')]();if(_['startsWith'](_0x190b56[_0x9e0c('0x6a')],_0x9e0c('0x6b'))){if(_[_0x9e0c('0x15')](this[_0x9e0c('0x9')][_0x190b56['uniqueid']]))this[_0x9e0c('0x9')][_0x190b56['uniqueid']]={};logger[_0x9e0c('0x31')](_0x9e0c('0x6c'),_0x190b56[_0x9e0c('0x19')],_0x190b56['application'],_0x190b56[_0x9e0c('0x6a')]);var _0x107270=_0x190b56[_0x9e0c('0x6a')][_0x9e0c('0x6d')]('=');var _0x3aa50c=_0x107270[0x0][_0x9e0c('0x6e')](/cdr\((.*)\)/);if(_0x3aa50c)this[_0x9e0c('0x9')][_0x190b56[_0x9e0c('0x19')]][_0x3aa50c[0x1]]=_0x107270[0x1];}}}}catch(_0x26bab8){logger['error'](_0x9e0c('0x6f'),_0x190b56[_0x9e0c('0x19')],util['inspect'](_0x26bab8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9e0c('0x13')][_0x9e0c('0x62')]=function(_0x50d978,_0x1e0ea6=0x2710){if(this[_0x9e0c('0x1c')][_0x50d978]){setTimeout(()=>{delete this[_0x9e0c('0x1c')][_0x50d978];},_0x1e0ea6);}};module[_0x9e0c('0x70')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 07091bb..19803c1 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5e1=['emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','debug','[%s][voiceQueueReport][','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','name','voice_queue:save','isNotNull','isUndefined','catch','[voiceQueueReport][queues]','then','actionid','isRunning','queuestatus','createQueueSummaryReport','queues','summaryEvent','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','inbound','outbound','custom:queuesummary','statusRequests','completeEvent','syncQueueMember','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','last','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','local/','linkedid','queuecallercomplete','add','seconds','transfertype','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','keys','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','handleHangup','length','diff','total','answered','sumBillable','milliseconds','unmanaged','lastevent','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','startsWith','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceQueueReport][newexten]','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','realtime','agents','channels','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','queuestatuscomplete','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','queuecallerexit','clearZombieChannels','Action','status','channel','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','voiceQueues','emitVoiceQueueChannelRemove','clearqueuereport'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xe5e1,0xaa));var _0x1e5e=function(_0x21d76f,_0x4cb87a){_0x21d76f=_0x21d76f-0x0;var _0x308322=_0xe5e1[_0x21d76f];return _0x308322;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x1e5e('0x0'));var Redis=require(_0x1e5e('0x1'));var config=require(_0x1e5e('0x2'));var logger=require(_0x1e5e('0x3'))(_0x1e5e('0x4'));var ami=require(_0x1e5e('0x5'));var QueueReport=require(_0x1e5e('0x6'));var VoiceQueueSummary=require(_0x1e5e('0x7'));config['redis']=_[_0x1e5e('0x8')](config[_0x1e5e('0x9')],{'host':_0x1e5e('0xa'),'port':0x18eb});var io=require(_0x1e5e('0xb'))(new Redis(config[_0x1e5e('0x9')]));var Sequence=function(){};Sequence[_0x1e5e('0xc')][_0x1e5e('0xd')]=function(_0x3575da){this['tail']=this[_0x1e5e('0xe')]?this[_0x1e5e('0xe')]['finally'](_0x3575da):_0x3575da();};function VoiceQueueReport(_0x5b9b1b){this[_0x1e5e('0xf')]=new Sequence();this[_0x1e5e('0x10')]={};this[_0x1e5e('0x11')]=_0x5b9b1b;this[_0x1e5e('0x12')]=_0x5b9b1b[_0x1e5e('0x12')];this[_0x1e5e('0x13')]=_0x5b9b1b['queueChannels'];this['voiceQueues']=_0x5b9b1b['voiceQueues'];this[_0x1e5e('0x14')]=_0x5b9b1b[_0x1e5e('0x14')];this[_0x1e5e('0x15')]=initializeSummary();this[_0x1e5e('0x16')]={};ami['on'](_0x1e5e('0x17'),this[_0x1e5e('0x18')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x1a'),this[_0x1e5e('0x1b')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x1c'),this['syncQueueMember']['bind'](this));ami['on'](_0x1e5e('0x1d'),this['syncQueueStatusComplete'][_0x1e5e('0x19')](this));ami['on']('queuecallerjoin',this[_0x1e5e('0x1e')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x1f'),this[_0x1e5e('0x20')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x21'),this[_0x1e5e('0x22')]['bind'](this));ami['on']('agentcomplete',this[_0x1e5e('0x23')][_0x1e5e('0x19')](this));ami['on']('agentconnect',this[_0x1e5e('0x24')]['bind'](this));ami['on'](_0x1e5e('0x25'),this['syncVarSet'][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x26'),this[_0x1e5e('0x27')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x28'),this[_0x1e5e('0x29')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x2a'),this[_0x1e5e('0x2b')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x2c'),this['syncMusicOnHoldStop'][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x2d'),this[_0x1e5e('0x2e')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x2f'),this['syncBlindTransfer'][_0x1e5e('0x19')](this));this[_0x1e5e('0x30')]();this[_0x1e5e('0x31')]();}function clearChannels(_0x20e9d9){if(!_[_0x1e5e('0x32')](_0x20e9d9)){for(var _0x1aec8d in _0x20e9d9){if(_0x20e9d9[_0x1e5e('0x33')](_0x1aec8d)){delete _0x20e9d9[_0x1aec8d];}}}}function clearCampaigns(_0x5c9c8d){if(!_[_0x1e5e('0x32')](_0x5c9c8d)){for(var _0x4a924f in _0x5c9c8d){if(_0x5c9c8d[_0x1e5e('0x33')](_0x4a924f)){_0x5c9c8d[_0x4a924f][_0x1e5e('0x34')]=0x0;}}}}function clearVoiceQueues(_0x56f073){if(!_[_0x1e5e('0x32')](_0x56f073)){for(var _0x400b8c in _0x56f073){if(_0x56f073[_0x1e5e('0x33')](_0x400b8c)){_0x56f073[_0x400b8c][_0x1e5e('0x34')]=0x0;_0x56f073[_0x400b8c][_0x1e5e('0x35')]=0x0;_0x56f073[_0x400b8c][_0x1e5e('0x36')]=0x0;_0x56f073[_0x400b8c][_0x1e5e('0x37')]=0x0;_0x56f073[_0x400b8c][_0x1e5e('0x38')]=!![];}}}}function clearAgentBooked(_0x560949){if(!_[_0x1e5e('0x32')](_0x560949)){for(var _0x2a1155 in _0x560949){if(_0x560949['hasOwnProperty'](_0x2a1155)){_0x560949[_0x2a1155]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x40f82f){return _0x40f82f[_0x1e5e('0x39')]||_0x40f82f[_0x1e5e('0x1f')]||_0x40f82f['queuecallercomplete'];}VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x3a')]=function(){var _0x34645e=this;for(var _0x3dfb72 in this['channels']){if(this[_0x1e5e('0x13')][_0x1e5e('0x33')](_0x3dfb72)&&!this[_0x1e5e('0x13')][_0x3dfb72]['switch']){this['sequence'][_0x1e5e('0xd')](function(){if(!_['isNil'](_0x34645e[_0x1e5e('0x13')][_0x3dfb72])){return ami[_0x1e5e('0x3b')]({'action':_0x1e5e('0x3c'),'channel':_0x34645e['channels'][_0x3dfb72][_0x1e5e('0x3d')]})['catch'](function(_0x179111){if(_0x179111['message']===_0x1e5e('0x3e')){setTimeout(function(){if(_0x34645e['channels'][_0x3dfb72]){delete _0x34645e[_0x1e5e('0x13')][_0x3dfb72];logger[_0x1e5e('0x3f')](_0x1e5e('0x40'),_0x3dfb72,util[_0x1e5e('0x41')](_0x179111,{'showHidden':![],'depth':null}));}if(_0x34645e[_0x1e5e('0x10')][_0x3dfb72]){delete _0x34645e['queueReports'][_0x3dfb72];logger[_0x1e5e('0x3f')](_0x1e5e('0x42'),_0x3dfb72,util[_0x1e5e('0x41')](_0x179111,{'showHidden':![],'depth':null}));}if(_0x34645e[_0x1e5e('0x16')][_0x3dfb72]){delete _0x34645e[_0x1e5e('0x16')][_0x3dfb72];logger[_0x1e5e('0x3f')](_0x1e5e('0x43'),_0x3dfb72,util[_0x1e5e('0x41')](_0x179111,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x29')]=function(){logger[_0x1e5e('0x3f')](_0x1e5e('0x44'));clearChannels(this['channels']);this[_0x1e5e('0x45')](this[_0x1e5e('0x10')]);clearAgentBooked(this[_0x1e5e('0x12')]);clearVoiceQueues(this[_0x1e5e('0x46')]);clearCampaigns(this[_0x1e5e('0x14')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x45')]=function(_0x3f1c85){var _0x8f99d8=this;if(!_[_0x1e5e('0x32')](_0x3f1c85)){for(var _0xf76a6b in _0x3f1c85){if(_0x3f1c85[_0x1e5e('0x33')](_0xf76a6b)){_0x8f99d8[_0x1e5e('0x47')](_0x3f1c85[_0xf76a6b],_0x1e5e('0x48'));delete _0x3f1c85[_0xf76a6b];}}}};VoiceQueueReport['prototype'][_0x1e5e('0x49')]=function(_0x3b9cc3,_0x25a53b,_0x301a49){io['to'](_0x3b9cc3)['emit'](_0x25a53b,_0x301a49);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x4a')]=function(_0x2ad211,_0xf0fad3){logger['debug']('[%s][voiceQueueReport]['+_0xf0fad3+_0x1e5e('0x4b'),_0x2ad211[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x2ad211,{'showHidden':![],'depth':null}));this[_0x1e5e('0x49')](util['format'](_0x1e5e('0x4d'),_0x2ad211[_0x1e5e('0x4e')]),_0x1e5e('0x4f'),_0x2ad211);io['emit'](_0x1e5e('0x50'),_0x2ad211);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x47')]=function(_0x446868,_0xfa583){logger[_0x1e5e('0x51')](_0x1e5e('0x52')+_0xfa583+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x446868[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x446868,{'showHidden':![],'depth':null}));if(_0x446868[_0x1e5e('0x53')]===_0x1e5e('0x54')){return;}this[_0x1e5e('0x49')](util['format'](_0x1e5e('0x4d'),_0x446868[_0x1e5e('0x4e')]),_0x1e5e('0x55'),_0x446868);io[_0x1e5e('0x49')](_0x1e5e('0x56'),_0x446868);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x57')]=function(_0x5dc8dc){if(_0x5dc8dc[_0x1e5e('0x58')]==='inbound'){logger['debug'](_0x1e5e('0x59'),util[_0x1e5e('0x41')](_0x5dc8dc,{'showHidden':![],'depth':null}));this[_0x1e5e('0x49')](util[_0x1e5e('0x5a')]('voice:queue:%s',_0x5dc8dc[_0x1e5e('0x5b')]),_0x1e5e('0x5c'),_0x5dc8dc);}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x5d')]=function(_0x14c48a){return _0x14c48a!==null&&!_[_0x1e5e('0x5e')](_0x14c48a);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x31')]=function(){var _0x5c3fd2=this;setInterval(function(){_0x5c3fd2['clearZombieChannels']();ami[_0x1e5e('0x3b')]({'action':'queues'})[_0x1e5e('0x5f')](function(_0x22105b){logger['error'](_0x1e5e('0x60'),util[_0x1e5e('0x41')](_0x22105b,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x1e5e('0x30')]=function(){var _0x5f1953=this;setInterval(function(){if(!_0x5f1953[_0x1e5e('0x15')]['isRunning']){return ami['Action']({'action':'queuesummary'})[_0x1e5e('0x61')](function(_0x1810e7){_0x5f1953[_0x1e5e('0x15')]['id']=_0x1810e7[_0x1e5e('0x62')];_0x5f1953[_0x1e5e('0x15')][_0x1e5e('0x63')]=!![];_0x5f1953[_0x1e5e('0x15')][_0x1e5e('0x64')][_0x1810e7['actionid']]={};})['catch'](function(_0x2361fc){logger[_0x1e5e('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x1e5e('0x41')](_0x2361fc,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x1e5e('0x65')]=function(_0x5d88b7,_0x26df1d){var _0x4f6870;if(this['summary']&&this['summary'][_0x1e5e('0x66')]&&this[_0x1e5e('0x15')][_0x1e5e('0x66')][_0x5d88b7[_0x1e5e('0x5b')]]){_0x4f6870=this[_0x1e5e('0x15')]['queues'][_0x5d88b7[_0x1e5e('0x5b')]][_0x1e5e('0x67')];}var _0x379913=new VoiceQueueSummary(_0x5d88b7);return _0x379913[_0x1e5e('0x68')](_0x26df1d[_0x1e5e('0x12')],this[_0x1e5e('0x12')],_0x4f6870,this[_0x1e5e('0x11')][_0x1e5e('0x13')]);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x69')]=function(_0x58f0bc,_0x5e3f46){var _0x14af63=this[_0x1e5e('0x65')](_0x58f0bc,_0x5e3f46);var _0x3aac3b=![];_0x3aac3b=_0x14af63[_0x1e5e('0x6a')](_0x58f0bc);if(_0x3aac3b){Object[_0x1e5e('0x6b')](_0x58f0bc,_0x14af63);this['realtime']['voiceQueues'][_0x58f0bc[_0x1e5e('0x5b')]]=_0x58f0bc;this[_0x1e5e('0x57')](_0x14af63);}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x6c')]=function(_0x2edbe6){var _0x5acfc1=null;var _0x2ccc13=this[_0x1e5e('0x15')]['id'];if(this['summary'][_0x1e5e('0x64')][_0x2ccc13]){_0x5acfc1=this['summary'][_0x1e5e('0x64')][_0x2ccc13][_0x2edbe6[_0x1e5e('0x62')]];}if(!_0x5acfc1){this['summary']=initializeSummary();return;}var _0x3725a9=this[_0x1e5e('0x46')][_0x5acfc1[_0x1e5e('0x4e')]];if(_0x3725a9[_0x1e5e('0x58')]===_0x1e5e('0x6d')){this[_0x1e5e('0x69')](_0x3725a9,_0x5acfc1);}else if(_0x3725a9[_0x1e5e('0x58')]===_0x1e5e('0x6e')){var _0x2a63ff=this[_0x1e5e('0x65')](_0x3725a9,_0x5acfc1);ami[_0x1e5e('0x49')](_0x1e5e('0x6f'),_0x2a63ff);}this[_0x1e5e('0x15')][_0x1e5e('0x70')]-=0x1;var _0x799a93=this[_0x1e5e('0x15')][_0x1e5e('0x70')]>0x0?!![]:![];if(!_0x799a93){return this[_0x1e5e('0x1b')](this[_0x1e5e('0x15')][_0x1e5e('0x71')]);}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x72')]=function(_0x2e2dfb){var _0x2a85ad=this['summary']['id'];if(this[_0x1e5e('0x15')]['queuestatus'][_0x2a85ad]&&this[_0x1e5e('0x15')][_0x1e5e('0x64')][_0x2a85ad][_0x2e2dfb[_0x1e5e('0x62')]]){this[_0x1e5e('0x15')][_0x1e5e('0x64')][_0x2a85ad][_0x2e2dfb['actionid']][_0x1e5e('0x12')][_0x1e5e('0x73')](_0x2e2dfb);}};VoiceQueueReport[_0x1e5e('0xc')]['syncQueueSummary']=function(_0x168440){var _0x69e367=this;try{if(this['isNotNull'](_0x168440)&&this[_0x1e5e('0x5d')](_0x168440[_0x1e5e('0x4e')])){logger[_0x1e5e('0x51')](_0x1e5e('0x74'),util[_0x1e5e('0x41')](_0x168440,{'showHidden':![],'depth':null}));var _0x165569=this[_0x1e5e('0x46')][_0x168440[_0x1e5e('0x4e')]];if(_0x165569){logger['debug'](_0x1e5e('0x75'),_0x165569[_0x1e5e('0x5b')]);this[_0x1e5e('0x15')][_0x1e5e('0x66')][_0x165569[_0x1e5e('0x5b')]]={'summaryEvent':_0x168440};this['summary']['statusRequests']+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x165569[_0x1e5e('0x5b')]})[_0x1e5e('0x61')](function(_0x35fc40){if(!_0x69e367['summary']['queuestatus'][_0x168440[_0x1e5e('0x62')]]){_0x69e367[_0x1e5e('0x15')]['queuestatus'][_0x168440[_0x1e5e('0x62')]]={};}_0x69e367['summary']['queuestatus'][_0x168440[_0x1e5e('0x62')]][_0x35fc40[_0x1e5e('0x62')]]={'queue':_0x165569[_0x1e5e('0x5b')],'agents':[]};})[_0x1e5e('0x5f')](function(_0x9d1009){throw _0x9d1009;});}}}catch(_0x435ccd){logger[_0x1e5e('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x1e5e('0x41')](_0x435ccd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x1b')]=function(_0x2408ec){if(this[_0x1e5e('0x15')][_0x1e5e('0x70')]>0x0){this[_0x1e5e('0x15')][_0x1e5e('0x71')]=_0x2408ec;return;}logger['debug'](_0x1e5e('0x76'),util['inspect'](_0x2408ec,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit'](_0x1e5e('0x77'),{});};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x1e')]=function(_0x3310ea){try{if(this[_0x1e5e('0x5d')](_0x3310ea)){logger['debug'](_0x1e5e('0x78'),_0x3310ea[_0x1e5e('0x4c')],util['inspect'](_0x3310ea,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x1e5e('0x10')][_0x3310ea[_0x1e5e('0x4c')]])){this[_0x1e5e('0x10')][_0x3310ea[_0x1e5e('0x4c')]]=[];}if(_[_0x1e5e('0x5e')](this[_0x1e5e('0x13')][_0x3310ea['uniqueid']])){this[_0x1e5e('0x13')][_0x3310ea[_0x1e5e('0x4c')]]={};}var _0x14e83d=new QueueReport();_0x14e83d[_0x1e5e('0x4e')]=_0x3310ea[_0x1e5e('0x4e')];_0x14e83d[_0x1e5e('0x58')]=this[_0x1e5e('0x46')][_0x14e83d[_0x1e5e('0x4e')]]&&this[_0x1e5e('0x46')][_0x14e83d['queue']][_0x1e5e('0x58')]?this[_0x1e5e('0x46')][_0x14e83d[_0x1e5e('0x4e')]][_0x1e5e('0x58')]||_0x1e5e('0x6d'):_0x1e5e('0x6d');_0x14e83d[_0x1e5e('0x79')]=moment()['format'](_0x1e5e('0x7a'));_0x14e83d['position']=_0x3310ea[_0x1e5e('0x7b')];_0x14e83d['count']=_0x3310ea[_0x1e5e('0x7c')];_0x14e83d[_0x1e5e('0x4c')]=_0x3310ea['uniqueid'];logger['info'](_0x1e5e('0x7d'),_0x14e83d[_0x1e5e('0x4e')],_0x14e83d[_0x1e5e('0x58')]);Object['assign'](_0x14e83d,_['pick'](_0x3310ea,_['keys'](_0x14e83d)));this['queueReports'][_0x3310ea[_0x1e5e('0x4c')]][_0x1e5e('0x73')](_0x14e83d);this[_0x1e5e('0x13')][_0x3310ea[_0x1e5e('0x4c')]]=_0x14e83d;this[_0x1e5e('0x4a')](_0x14e83d,_0x1e5e('0x7e'));}}catch(_0x37ec48){logger[_0x1e5e('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3310ea[_0x1e5e('0x4c')],util['inspect'](_0x37ec48,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1e5e('0x20')]=function(_0x19fd68){try{if(this[_0x1e5e('0x5d')](_0x19fd68)){logger[_0x1e5e('0x51')](_0x1e5e('0x7f'),_0x19fd68[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x19fd68,{'showHidden':![],'depth':null}));if(this[_0x1e5e('0x10')][_0x19fd68[_0x1e5e('0x4c')]]){var _0x53b03f=_['last'](this[_0x1e5e('0x10')][_0x19fd68[_0x1e5e('0x4c')]]);_0x53b03f['queuecallercomplete']=![];_0x53b03f[_0x1e5e('0x80')]=null;_0x53b03f[_0x1e5e('0x81')]=_0x19fd68['holdtime'];_0x53b03f[_0x1e5e('0x82')]=_0x19fd68[_0x1e5e('0x82')];_0x53b03f['queuecallerabandon']=!![];_0x53b03f[_0x1e5e('0x83')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x53b03f[_0x1e5e('0x53')]=_0x1e5e('0x84');_0x53b03f[_0x1e5e('0x85')]=null;logger[_0x1e5e('0x86')](_0x1e5e('0x87'),_0x53b03f['queue'],_0x53b03f[_0x1e5e('0x58')]);this['channels'][_0x19fd68['uniqueid']]=_0x53b03f;this[_0x1e5e('0x47')](_0x53b03f,_0x1e5e('0x1f'));}}}catch(_0x59eb01){logger[_0x1e5e('0x3f')](_0x1e5e('0x7f'),_0x19fd68[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x59eb01,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x2a775f){try{if(this[_0x1e5e('0x5d')](_0x2a775f)){logger[_0x1e5e('0x51')](_0x1e5e('0x88'),_0x2a775f['uniqueid'],util['inspect'](_0x2a775f,{'showHidden':![],'depth':null}));if(this[_0x1e5e('0x10')][_0x2a775f[_0x1e5e('0x4c')]]){var _0x38ea92=_['last'](this[_0x1e5e('0x10')][_0x2a775f[_0x1e5e('0x4c')]]);_0x38ea92[_0x1e5e('0x89')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x38ea92['connectedlinenum']=_0x2a775f[_0x1e5e('0x8a')];_0x38ea92[_0x1e5e('0x8b')]=_0x2a775f[_0x1e5e('0x8b')];logger['info'](_0x1e5e('0x8c'),_0x38ea92[_0x1e5e('0x4e')],_0x38ea92[_0x1e5e('0x58')],_0x2a775f[_0x1e5e('0x8a')],_0x2a775f[_0x1e5e('0x8b')]);this[_0x1e5e('0x13')][_0x2a775f['uniqueid']]=_0x38ea92;this[_0x1e5e('0x4a')](_0x38ea92,_0x1e5e('0x21'));}}}catch(_0xf0d653){logger[_0x1e5e('0x3f')](_0x1e5e('0x88'),_0x2a775f[_0x1e5e('0x4c')],util['inspect'](_0xf0d653,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1e5e('0x24')]=function(_0x4b2800){try{if(this[_0x1e5e('0x5d')](_0x4b2800)){logger['debug'](_0x1e5e('0x8d'),_0x4b2800[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x4b2800,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4b2800['uniqueid']]){var _0x37a059=_[_0x1e5e('0x8e')](this[_0x1e5e('0x10')][_0x4b2800[_0x1e5e('0x4c')]]);_0x37a059['queuecallercomplete']=!![];_0x37a059[_0x1e5e('0x53')]=_0x1e5e('0x8f');logger[_0x1e5e('0x86')](_0x1e5e('0x90'),_0x37a059[_0x1e5e('0x4e')],_0x37a059[_0x1e5e('0x58')]);}}}catch(_0x24aff7){logger[_0x1e5e('0x3f')](_0x1e5e('0x8d'),_0x4b2800['uniqueid'],util[_0x1e5e('0x41')](_0x24aff7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x23')]=function(_0x1d1e00){try{if(this['isNotNull'](_0x1d1e00)){logger[_0x1e5e('0x51')](_0x1e5e('0x91'),_0x1d1e00[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x1d1e00,{'showHidden':![],'depth':null}));if(this[_0x1e5e('0x10')][_0x1d1e00[_0x1e5e('0x4c')]]){var _0x74ae53=_[_0x1e5e('0x8e')](this['queueReports'][_0x1d1e00[_0x1e5e('0x4c')]]);_0x74ae53[_0x1e5e('0x1f')]=![];_0x74ae53[_0x1e5e('0x83')]=null;_0x74ae53['assigned']=!![];_0x74ae53[_0x1e5e('0x85')]=_0x1d1e00['membername'];_0x74ae53[_0x1e5e('0x81')]=_0x1d1e00[_0x1e5e('0x81')];_0x74ae53['queuecallercomplete']=!![];_0x74ae53[_0x1e5e('0x39')]=![];_0x74ae53[_0x1e5e('0x92')]=null;if(!_0x74ae53['transfer']){if(_0x1d1e00[_0x1e5e('0x93')]==_0x1e5e('0x94')){_0x74ae53[_0x1e5e('0x53')]=_0x1e5e('0x95');logger[_0x1e5e('0x86')](_0x1e5e('0x96'),_0x74ae53[_0x1e5e('0x4e')],_0x74ae53[_0x1e5e('0x58')]);}else{if(_['startsWith'](_0x1d1e00[_0x1e5e('0x3d')]['toLowerCase'](),_0x1e5e('0x97'))){if(this['queueReports'][_0x1d1e00[_0x1e5e('0x98')]]){var _0x32d44d=_[_0x1e5e('0x8e')](this['queueReports'][_0x1d1e00['linkedid']]);_0x32d44d[_0x1e5e('0x99')]=![];_0x32d44d[_0x1e5e('0x39')]=!![];_0x32d44d[_0x1e5e('0x92')]=moment(_0x74ae53[_0x1e5e('0x79')])[_0x1e5e('0x9a')](_0x1d1e00[_0x1e5e('0x81')],_0x1e5e('0x9b'))[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x32d44d[_0x1e5e('0x53')]='FORWARDTRANSFER';_0x32d44d[_0x1e5e('0x94')]=!![];_0x32d44d[_0x1e5e('0x9c')]='FORWARD';_0x32d44d[_0x1e5e('0x9d')]=_0x1d1e00[_0x1e5e('0x9e')];_0x32d44d[_0x1e5e('0x9f')]=_0x1d1e00[_0x1e5e('0x4c')];logger[_0x1e5e('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x32d44d[_0x1e5e('0x4e')],_0x32d44d[_0x1e5e('0x58')]);var _0x5798db=this[_0x1e5e('0x10')][_0x1d1e00[_0x1e5e('0x98')]];this['queueReports'][_0x1d1e00[_0x1e5e('0x98')]]=this[_0x1e5e('0x10')][_0x1d1e00[_0x1e5e('0x4c')]];this['queueReports'][_0x1d1e00[_0x1e5e('0x4c')]]=_0x5798db;}}else{_0x74ae53[_0x1e5e('0x53')]=_0x1e5e('0xa0')+_0x1d1e00[_0x1e5e('0x93')][_0x1e5e('0xa1')]();logger[_0x1e5e('0x86')](_0x1e5e('0xa2'),_0x74ae53[_0x1e5e('0x4e')],_0x74ae53['type'],_0x74ae53[_0x1e5e('0x53')]);}}}this[_0x1e5e('0x13')][_0x1d1e00[_0x1e5e('0x4c')]]=_0x74ae53;}}}catch(_0x2ecb60){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x1d1e00[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x2ecb60,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x4c0b6b){try{if(this[_0x1e5e('0x5d')](_0x4c0b6b)){logger[_0x1e5e('0x51')](_0x1e5e('0xa3'),_0x4c0b6b[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x4c0b6b,{'showHidden':![],'depth':null}));this['addVariable'](_0x4c0b6b[_0x1e5e('0x4c')],_[_0x1e5e('0xa4')](_0x4c0b6b[_0x1e5e('0xa5')])[0x0],_0x4c0b6b['value']);if(this[_0x1e5e('0x10')][_0x4c0b6b[_0x1e5e('0x4c')]]){var _0x33947c=_[_0x1e5e('0x8e')](this[_0x1e5e('0x10')][_0x4c0b6b['uniqueid']]);if(_0x33947c){if(this[_0x1e5e('0x5d')](_0x4c0b6b[_0x1e5e('0xa5')])&&this[_0x1e5e('0x5d')](_0x4c0b6b[_0x1e5e('0xa5')]['queuestatus'])){switch(_0x4c0b6b[_0x1e5e('0xa6')]){case _0x1e5e('0xa7'):_0x33947c[_0x1e5e('0x39')]=![];_0x33947c[_0x1e5e('0x92')]=null;break;case _0x1e5e('0xa8'):_0x33947c['lastevent']=_0x1e5e('0xa9');_0x33947c[_0x1e5e('0x39')]=!![];_0x33947c['queuecallerexitAt']=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x33947c[_0x1e5e('0x89')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));logger[_0x1e5e('0x51')](_0x1e5e('0xaa'),_0x4c0b6b[_0x1e5e('0x4c')],util['inspect'](_0x33947c,{'showHidden':![],'depth':null}));ami[_0x1e5e('0x49')](_0x1e5e('0xab'),_0x33947c);break;default:_0x33947c[_0x1e5e('0x39')]=!![];_0x33947c[_0x1e5e('0x92')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x33947c[_0x1e5e('0x89')]=moment()['format'](_0x1e5e('0x7a'));}_0x33947c[_0x1e5e('0x1f')]=![];_0x33947c[_0x1e5e('0x83')]=null;_0x33947c[_0x1e5e('0x53')]=_0x4c0b6b['value'];this[_0x1e5e('0x13')][_0x4c0b6b[_0x1e5e('0x4c')]]=_0x33947c;this[_0x1e5e('0x47')](_0x33947c,_0x1e5e('0x25'));}else if(this[_0x1e5e('0x5d')](_0x4c0b6b[_0x1e5e('0xa5')])&&this[_0x1e5e('0x5d')](_0x4c0b6b[_0x1e5e('0xa5')][_0x1e5e('0xac')])){if(!_0x33947c[_0x1e5e('0x1f')]){_0x33947c['queuecallerexit']=!![];_0x33947c[_0x1e5e('0x92')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x33947c['queuecallerexitreason']=_0x1e5e('0xad');_0x33947c[_0x1e5e('0x89')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));this['channels'][_0x4c0b6b[_0x1e5e('0x4c')]]=_0x33947c;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x4c0b6b[_0x1e5e('0x4c')],_0x33947c[_0x1e5e('0x4e')],_0x33947c[_0x1e5e('0x58')],_['keys'](_0x4c0b6b['variable'])[0x0],_0x4c0b6b['value']);_0x33947c['variables']=this['variables'][_0x4c0b6b[_0x1e5e('0x4c')]];}}}}catch(_0x3ba08e){logger[_0x1e5e('0x3f')](_0x1e5e('0xa3'),_0x4c0b6b[_0x1e5e('0x4c')],util['inspect'](_0x3ba08e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0xae')]=function(_0x2c862d,_0x249ac1,_0x1cfeab){var _0x393a75=[_0x1e5e('0xaf'),_0x1e5e('0xb0'),_0x1e5e('0xb1'),_0x1e5e('0xb2'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x1e5e('0xb3'),_0x1e5e('0xb4'),'sipuri',_0x1e5e('0xb5'),_0x1e5e('0xb6'),_0x1e5e('0xb7'),_0x1e5e('0xb8'),'memberinterface','memberlastcall','membername',_0x1e5e('0xb9'),_0x1e5e('0xba')];if(!_[_0x1e5e('0xbb')](_0x249ac1)&&!_['includes'](_0x393a75,_0x249ac1)){if(_[_0x1e5e('0x5e')](this[_0x1e5e('0x16')][_0x2c862d])){this[_0x1e5e('0x16')][_0x2c862d]={};}this[_0x1e5e('0x16')][_0x2c862d][_0x249ac1]=_0x1cfeab;}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0xbc')]=function(_0x2a8fe0,_0x3dccb3,_0xb6db17){try{var _0xd55495={};if(this['queueReports'][_0x2a8fe0]){for(var _0x2229dd=0x0;_0x2229dd{delete this['channels'][_0x53861f];},_0x2bda20);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0x46a4=['queueChannels','voiceQueues','campaigns','summary','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentConnect','varset','hangup','syncHangup','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','clearZombieChannels','isNil','status','channel','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','error','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','loopQueueSummary','isRunning','Action','queuesummary','then','queuestatus','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','assigned','lastAssignedTo','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','FORWARD','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','handleHangup','sumHoldTime','seconds','ATTENDEDTRANSFER','length','milliseconds','diff','total','answered','queuecallercompleteAt','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','syncAttendedTransfer','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','transfertype','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','[%s][voiceQueueReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','set','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels'];(function(_0x12c3d7,_0xc116fd){var _0x14ba8b=function(_0x184608){while(--_0x184608){_0x12c3d7['push'](_0x12c3d7['shift']());}};_0x14ba8b(++_0xc116fd);}(_0x46a4,0xe2));var _0x446a=function(_0x2bb9cd,_0x13c6eb){_0x2bb9cd=_0x2bb9cd-0x0;var _0x150406=_0x46a4[_0x2bb9cd];return _0x150406;};'use strict';var _=require('lodash');var moment=require(_0x446a('0x0'));var util=require(_0x446a('0x1'));var Redis=require(_0x446a('0x2'));var config=require(_0x446a('0x3'));var logger=require(_0x446a('0x4'))(_0x446a('0x5'));var ami=require(_0x446a('0x6'));var QueueReport=require(_0x446a('0x7'));var VoiceQueueSummary=require(_0x446a('0x8'));config['redis']=_[_0x446a('0x9')](config['redis'],{'host':_0x446a('0xa'),'port':0x18eb});var io=require(_0x446a('0xb'))(new Redis(config[_0x446a('0xc')]));var Sequence=function(){};Sequence[_0x446a('0xd')][_0x446a('0xe')]=function(_0x1892f3){this[_0x446a('0xf')]=this[_0x446a('0xf')]?this['tail'][_0x446a('0x10')](_0x1892f3):_0x1892f3();};function VoiceQueueReport(_0x1446f9){this[_0x446a('0x11')]=new Sequence();this[_0x446a('0x12')]={};this[_0x446a('0x13')]=_0x1446f9;this['agents']=_0x1446f9[_0x446a('0x14')];this[_0x446a('0x15')]=_0x1446f9[_0x446a('0x16')];this['voiceQueues']=_0x1446f9[_0x446a('0x17')];this[_0x446a('0x18')]=_0x1446f9[_0x446a('0x18')];this[_0x446a('0x19')]=initializeSummary();this[_0x446a('0x1a')]={};ami['on']('queuesummary',this[_0x446a('0x1b')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x1d'),this[_0x446a('0x1e')][_0x446a('0x1c')](this));ami['on']('queuemember',this[_0x446a('0x1f')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x20'),this['syncQueueStatusComplete'][_0x446a('0x1c')](this));ami['on'](_0x446a('0x21'),this[_0x446a('0x22')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x23'),this[_0x446a('0x24')][_0x446a('0x1c')](this));ami['on']('queuecallerleave',this[_0x446a('0x25')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x26'),this['syncAgentComplete']['bind'](this));ami['on']('agentconnect',this[_0x446a('0x27')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x28'),this['syncVarSet'][_0x446a('0x1c')](this));ami['on'](_0x446a('0x29'),this[_0x446a('0x2a')][_0x446a('0x1c')](this));ami['on']('fullybooted',this[_0x446a('0x2b')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x2c'),this['syncMusicOnHoldStart'][_0x446a('0x1c')](this));ami['on'](_0x446a('0x2d'),this[_0x446a('0x2e')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x2f'),this['syncAttendedTransfer'][_0x446a('0x1c')](this));ami['on'](_0x446a('0x30'),this[_0x446a('0x31')][_0x446a('0x1c')](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x4e289b){if(!_[_0x446a('0x32')](_0x4e289b)){for(var _0x4351b7 in _0x4e289b){if(_0x4e289b['hasOwnProperty'](_0x4351b7)){delete _0x4e289b[_0x4351b7];}}}}function clearCampaigns(_0x1cb541){if(!_[_0x446a('0x32')](_0x1cb541)){for(var _0x1cfcc3 in _0x1cb541){if(_0x1cb541[_0x446a('0x33')](_0x1cfcc3)){_0x1cb541[_0x1cfcc3]['originated']=0x0;}}}}function clearVoiceQueues(_0x121cd5){if(!_[_0x446a('0x32')](_0x121cd5)){for(var _0x5b1f0f in _0x121cd5){if(_0x121cd5[_0x446a('0x33')](_0x5b1f0f)){_0x121cd5[_0x5b1f0f][_0x446a('0x34')]=0x0;_0x121cd5[_0x5b1f0f][_0x446a('0x35')]=0x0;_0x121cd5[_0x5b1f0f][_0x446a('0x36')]=0x0;_0x121cd5[_0x5b1f0f][_0x446a('0x37')]=0x0;_0x121cd5[_0x5b1f0f][_0x446a('0x38')]=!![];}}}}function clearAgentBooked(_0x934c7a){if(!_['isEmpty'](_0x934c7a)){for(var _0x58cc7e in _0x934c7a){if(_0x934c7a[_0x446a('0x33')](_0x58cc7e)){_0x934c7a[_0x58cc7e][_0x446a('0x39')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x59e99f){return _0x59e99f[_0x446a('0x3a')]||_0x59e99f[_0x446a('0x23')]||_0x59e99f['queuecallercomplete'];}VoiceQueueReport[_0x446a('0xd')][_0x446a('0x3b')]=function(){var _0x88e5dc=this;for(var _0xc8df4d in this['channels']){if(this[_0x446a('0x15')][_0x446a('0x33')](_0xc8df4d)&&!this[_0x446a('0x15')][_0xc8df4d]['switch']){this[_0x446a('0x11')]['enqueue'](function(){if(!_[_0x446a('0x3c')](_0x88e5dc[_0x446a('0x15')][_0xc8df4d])){return ami['Action']({'action':_0x446a('0x3d'),'channel':_0x88e5dc[_0x446a('0x15')][_0xc8df4d][_0x446a('0x3e')]})[_0x446a('0x3f')](function(_0xf8f4e7){if(_0xf8f4e7[_0x446a('0x40')]===_0x446a('0x41')){setTimeout(function(){if(_0x88e5dc[_0x446a('0x15')][_0xc8df4d]){delete _0x88e5dc[_0x446a('0x15')][_0xc8df4d];logger['error'](_0x446a('0x42'),_0xc8df4d,util[_0x446a('0x43')](_0xf8f4e7,{'showHidden':![],'depth':null}));}if(_0x88e5dc[_0x446a('0x12')][_0xc8df4d]){delete _0x88e5dc[_0x446a('0x12')][_0xc8df4d];logger['error'](_0x446a('0x44'),_0xc8df4d,util[_0x446a('0x43')](_0xf8f4e7,{'showHidden':![],'depth':null}));}if(_0x88e5dc[_0x446a('0x1a')][_0xc8df4d]){delete _0x88e5dc[_0x446a('0x1a')][_0xc8df4d];logger[_0x446a('0x45')]('[%s][voiceQueueReport][checkVariables]',_0xc8df4d,util[_0x446a('0x43')](_0xf8f4e7,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x2b')]=function(){logger[_0x446a('0x45')](_0x446a('0x46'));clearChannels(this[_0x446a('0x15')]);this[_0x446a('0x47')](this[_0x446a('0x12')]);clearAgentBooked(this[_0x446a('0x14')]);clearVoiceQueues(this[_0x446a('0x17')]);clearCampaigns(this[_0x446a('0x18')]);this[_0x446a('0x19')]=initializeSummary();};VoiceQueueReport['prototype'][_0x446a('0x47')]=function(_0x4c7361){var _0x5dbe5d=this;if(!_[_0x446a('0x32')](_0x4c7361)){for(var _0x567031 in _0x4c7361){if(_0x4c7361['hasOwnProperty'](_0x567031)){_0x5dbe5d[_0x446a('0x48')](_0x4c7361[_0x567031],_0x446a('0x49'));delete _0x4c7361[_0x567031];}}}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x4a')]=function(_0x56d512,_0x42887f,_0x395020){io['to'](_0x56d512)[_0x446a('0x4a')](_0x42887f,_0x395020);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x270ded,_0x18e824){logger['debug'](_0x446a('0x4b')+_0x18e824+_0x446a('0x4c'),_0x270ded['uniqueid'],util[_0x446a('0x43')](_0x270ded,{'showHidden':![],'depth':null}));this[_0x446a('0x4a')](util[_0x446a('0x4d')](_0x446a('0x4e'),_0x270ded[_0x446a('0x4f')]),_0x446a('0x50'),_0x270ded);io['emit'](_0x446a('0x51'),_0x270ded);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x3735cd,_0x59bb90){logger[_0x446a('0x52')](_0x446a('0x4b')+_0x59bb90+_0x446a('0x53'),_0x3735cd['uniqueid'],util[_0x446a('0x43')](_0x3735cd,{'showHidden':![],'depth':null}));if(_0x3735cd['queuecallerexitreason']==='ATTENDEDTRANSFER'){return;}this[_0x446a('0x4a')](util[_0x446a('0x4d')](_0x446a('0x4e'),_0x3735cd[_0x446a('0x4f')]),_0x446a('0x54'),_0x3735cd);io[_0x446a('0x4a')](_0x446a('0x55'),_0x3735cd);};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x56')]=function(_0x5df907){if(_0x5df907[_0x446a('0x57')]===_0x446a('0x58')){logger['debug'](_0x446a('0x59'),util['inspect'](_0x5df907,{'showHidden':![],'depth':null}));this[_0x446a('0x4a')](util['format']('voice:queue:%s',_0x5df907[_0x446a('0x5a')]),'voice_queue:save',_0x5df907);}};VoiceQueueReport['prototype'][_0x446a('0x5b')]=function(_0x3ff5aa){return _0x3ff5aa!==null&&!_[_0x446a('0x5c')](_0x3ff5aa);};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x5d')]=function(){var _0x450325=this;setInterval(function(){_0x450325[_0x446a('0x3b')]();ami['Action']({'action':_0x446a('0x5e')})[_0x446a('0x3f')](function(_0x412d1f){logger[_0x446a('0x45')](_0x446a('0x5f'),util[_0x446a('0x43')](_0x412d1f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x60')]=function(){var _0x32d46c=this;setInterval(function(){if(!_0x32d46c[_0x446a('0x19')][_0x446a('0x61')]){return ami[_0x446a('0x62')]({'action':_0x446a('0x63')})[_0x446a('0x64')](function(_0x138b96){_0x32d46c['summary']['id']=_0x138b96['actionid'];_0x32d46c['summary'][_0x446a('0x61')]=!![];_0x32d46c['summary'][_0x446a('0x65')][_0x138b96[_0x446a('0x66')]]={};})[_0x446a('0x3f')](function(_0x9ed435){logger[_0x446a('0x45')](_0x446a('0x67'),util[_0x446a('0x43')](_0x9ed435,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x68')]=function(_0x750c88,_0x46be37){var _0x2c3abd;if(this[_0x446a('0x19')]&&this[_0x446a('0x19')][_0x446a('0x5e')]&&this[_0x446a('0x19')][_0x446a('0x5e')][_0x750c88['name']]){_0x2c3abd=this[_0x446a('0x19')]['queues'][_0x750c88[_0x446a('0x5a')]][_0x446a('0x69')];}var _0x500c6f=new VoiceQueueSummary(_0x750c88);return _0x500c6f[_0x446a('0x6a')](_0x46be37['agents'],this[_0x446a('0x14')],_0x2c3abd,this['realtime'][_0x446a('0x15')]);};VoiceQueueReport['prototype'][_0x446a('0x6b')]=function(_0x5ee367,_0x16e7f6){var _0x1a8812=this[_0x446a('0x68')](_0x5ee367,_0x16e7f6);var _0x585462=![];_0x585462=_0x1a8812[_0x446a('0x6c')](_0x5ee367);if(_0x585462){Object[_0x446a('0x6d')](_0x5ee367,_0x1a8812);this[_0x446a('0x13')][_0x446a('0x17')][_0x5ee367[_0x446a('0x5a')]]=_0x5ee367;this[_0x446a('0x56')](_0x1a8812);}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x6e')]=function(_0x14e4d0){var _0x30b7ca=null;var _0x1b6c2b=this[_0x446a('0x19')]['id'];if(this[_0x446a('0x19')]['queuestatus'][_0x1b6c2b]){_0x30b7ca=this[_0x446a('0x19')]['queuestatus'][_0x1b6c2b][_0x14e4d0['actionid']];}if(!_0x30b7ca){this[_0x446a('0x19')]=initializeSummary();return;}var _0x18c7bb=this[_0x446a('0x17')][_0x30b7ca[_0x446a('0x4f')]];if(_0x18c7bb[_0x446a('0x57')]===_0x446a('0x58')){this[_0x446a('0x6b')](_0x18c7bb,_0x30b7ca);}else if(_0x18c7bb[_0x446a('0x57')]==='outbound'){var _0x2557f3=this[_0x446a('0x68')](_0x18c7bb,_0x30b7ca);ami[_0x446a('0x4a')](_0x446a('0x6f'),_0x2557f3);}this[_0x446a('0x19')]['statusRequests']-=0x1;var _0x10b520=this['summary'][_0x446a('0x70')]>0x0?!![]:![];if(!_0x10b520){return this[_0x446a('0x1e')](this[_0x446a('0x19')][_0x446a('0x71')]);}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x1f')]=function(_0x182cae){var _0x220919=this[_0x446a('0x19')]['id'];if(this[_0x446a('0x19')][_0x446a('0x65')][_0x220919]&&this[_0x446a('0x19')]['queuestatus'][_0x220919][_0x182cae[_0x446a('0x66')]]){this['summary'][_0x446a('0x65')][_0x220919][_0x182cae[_0x446a('0x66')]][_0x446a('0x14')][_0x446a('0x72')](_0x182cae);}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x1b')]=function(_0x172390){var _0x677325=this;try{if(this[_0x446a('0x5b')](_0x172390)&&this[_0x446a('0x5b')](_0x172390[_0x446a('0x4f')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x446a('0x43')](_0x172390,{'showHidden':![],'depth':null}));var _0x5146a5=this[_0x446a('0x17')][_0x172390[_0x446a('0x4f')]];if(_0x5146a5){logger['debug'](_0x446a('0x73'),_0x5146a5['name']);this[_0x446a('0x19')][_0x446a('0x5e')][_0x5146a5[_0x446a('0x5a')]]={'summaryEvent':_0x172390};this[_0x446a('0x19')][_0x446a('0x70')]+=0x1;return ami['Action']({'action':_0x446a('0x65'),'queue':_0x5146a5['name']})[_0x446a('0x64')](function(_0x4c48a6){if(!_0x677325[_0x446a('0x19')][_0x446a('0x65')][_0x172390[_0x446a('0x66')]]){_0x677325[_0x446a('0x19')]['queuestatus'][_0x172390[_0x446a('0x66')]]={};}_0x677325['summary']['queuestatus'][_0x172390[_0x446a('0x66')]][_0x4c48a6[_0x446a('0x66')]]={'queue':_0x5146a5['name'],'agents':[]};})[_0x446a('0x3f')](function(_0x42028e){throw _0x42028e;});}}}catch(_0x3af18f){logger[_0x446a('0x45')]('[voiceQueueReport][queuesummary]',util[_0x446a('0x43')](_0x3af18f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')]['syncQueueSummaryComplete']=function(_0x461b65){if(this[_0x446a('0x19')]['statusRequests']>0x0){this[_0x446a('0x19')]['completeEvent']=_0x461b65;return;}logger[_0x446a('0x52')](_0x446a('0x74'),util['inspect'](_0x461b65,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x446a('0x4a')](_0x446a('0x75'),{});};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x22')]=function(_0x287324){try{if(this[_0x446a('0x5b')](_0x287324)){logger[_0x446a('0x52')](_0x446a('0x76'),_0x287324[_0x446a('0x77')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(_[_0x446a('0x5c')](this[_0x446a('0x12')][_0x287324[_0x446a('0x77')]])){this[_0x446a('0x12')][_0x287324['uniqueid']]=[];}if(_[_0x446a('0x5c')](this['channels'][_0x287324[_0x446a('0x77')]])){this['channels'][_0x287324[_0x446a('0x77')]]={};}var _0x5ad2f1=new QueueReport();_0x5ad2f1[_0x446a('0x4f')]=_0x287324[_0x446a('0x4f')];_0x5ad2f1[_0x446a('0x57')]=this[_0x446a('0x17')][_0x5ad2f1[_0x446a('0x4f')]]&&this['voiceQueues'][_0x5ad2f1['queue']][_0x446a('0x57')]?this[_0x446a('0x17')][_0x5ad2f1['queue']]['type']||_0x446a('0x58'):_0x446a('0x58');_0x5ad2f1[_0x446a('0x78')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));_0x5ad2f1['position']=_0x287324['position'];_0x5ad2f1['count']=_0x287324[_0x446a('0x7a')];_0x5ad2f1[_0x446a('0x77')]=_0x287324[_0x446a('0x77')];logger[_0x446a('0x7b')](_0x446a('0x7c'),_0x5ad2f1[_0x446a('0x4f')],_0x5ad2f1[_0x446a('0x57')]);Object['assign'](_0x5ad2f1,_[_0x446a('0x7d')](_0x287324,_[_0x446a('0x7e')](_0x5ad2f1)));this[_0x446a('0x12')][_0x287324[_0x446a('0x77')]]['push'](_0x5ad2f1);this[_0x446a('0x15')][_0x287324[_0x446a('0x77')]]=_0x5ad2f1;this[_0x446a('0x7f')](_0x5ad2f1,_0x446a('0x21'));}}catch(_0x36d831){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x287324[_0x446a('0x77')],util[_0x446a('0x43')](_0x36d831,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')]['syncQueueCallerAbandon']=function(_0x160c63){try{if(this['isNotNull'](_0x160c63)){logger[_0x446a('0x52')](_0x446a('0x80'),_0x160c63['uniqueid'],util['inspect'](_0x160c63,{'showHidden':![],'depth':null}));if(this[_0x446a('0x12')][_0x160c63[_0x446a('0x77')]]){var _0x2a9620=_[_0x446a('0x81')](this[_0x446a('0x12')][_0x160c63[_0x446a('0x77')]]);_0x2a9620[_0x446a('0x82')]=![];_0x2a9620['queuecallercompleteAt']=null;_0x2a9620[_0x446a('0x83')]=_0x160c63[_0x446a('0x83')];_0x2a9620['originalposition']=_0x160c63[_0x446a('0x84')];_0x2a9620[_0x446a('0x23')]=!![];_0x2a9620[_0x446a('0x85')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));_0x2a9620[_0x446a('0x86')]=_0x446a('0x87');_0x2a9620['lastAssignedTo']=null;logger[_0x446a('0x7b')](_0x446a('0x88'),_0x2a9620['queue'],_0x2a9620[_0x446a('0x57')]);this[_0x446a('0x15')][_0x160c63[_0x446a('0x77')]]=_0x2a9620;this[_0x446a('0x48')](_0x2a9620,_0x446a('0x23'));}}}catch(_0xbc3645){logger[_0x446a('0x45')](_0x446a('0x80'),_0x160c63[_0x446a('0x77')],util['inspect'](_0xbc3645,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')]['syncQueueCallerLeave']=function(_0x353dbf){try{if(this[_0x446a('0x5b')](_0x353dbf)){logger[_0x446a('0x52')]('[%s][voiceQueueReport][queuecallerleave]',_0x353dbf[_0x446a('0x77')],util[_0x446a('0x43')](_0x353dbf,{'showHidden':![],'depth':null}));if(this[_0x446a('0x12')][_0x353dbf[_0x446a('0x77')]]){var _0xf58d01=_['last'](this[_0x446a('0x12')][_0x353dbf[_0x446a('0x77')]]);_0xf58d01[_0x446a('0x89')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));_0xf58d01[_0x446a('0x8a')]=_0x353dbf[_0x446a('0x8a')];_0xf58d01[_0x446a('0x8b')]=_0x353dbf['connectedlinename'];logger[_0x446a('0x7b')](_0x446a('0x8c'),_0xf58d01[_0x446a('0x4f')],_0xf58d01[_0x446a('0x57')],_0x353dbf[_0x446a('0x8a')],_0x353dbf[_0x446a('0x8b')]);this[_0x446a('0x15')][_0x353dbf[_0x446a('0x77')]]=_0xf58d01;this['emitVoiceQueueChannelSave'](_0xf58d01,_0x446a('0x8d'));}}}catch(_0x122d2c){logger['error'](_0x446a('0x8e'),_0x353dbf[_0x446a('0x77')],util[_0x446a('0x43')](_0x122d2c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x446a('0x27')]=function(_0x4c4fa9){try{if(this['isNotNull'](_0x4c4fa9)){logger[_0x446a('0x52')](_0x446a('0x8f'),_0x4c4fa9[_0x446a('0x77')],util[_0x446a('0x43')](_0x4c4fa9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4c4fa9[_0x446a('0x77')]]){var _0x31350b=_['last'](this['queueReports'][_0x4c4fa9[_0x446a('0x77')]]);_0x31350b[_0x446a('0x82')]=!![];_0x31350b[_0x446a('0x86')]=_0x446a('0x90');logger[_0x446a('0x7b')](_0x446a('0x91'),_0x31350b['queue'],_0x31350b[_0x446a('0x57')]);}}}catch(_0x5f0002){logger['error'](_0x446a('0x8f'),_0x4c4fa9['uniqueid'],util[_0x446a('0x43')](_0x5f0002,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x92')]=function(_0x7f0531){try{if(this[_0x446a('0x5b')](_0x7f0531)){logger[_0x446a('0x52')](_0x446a('0x93'),_0x7f0531[_0x446a('0x77')],util[_0x446a('0x43')](_0x7f0531,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x7f0531[_0x446a('0x77')]]){var _0x5ef545=_[_0x446a('0x81')](this['queueReports'][_0x7f0531['uniqueid']]);_0x5ef545[_0x446a('0x23')]=![];_0x5ef545['queuecallerabandonAt']=null;_0x5ef545[_0x446a('0x94')]=!![];_0x5ef545[_0x446a('0x95')]=_0x7f0531[_0x446a('0x96')];_0x5ef545[_0x446a('0x83')]=_0x7f0531['holdtime'];_0x5ef545['queuecallercomplete']=!![];_0x5ef545[_0x446a('0x3a')]=![];_0x5ef545[_0x446a('0x97')]=null;if(!_0x5ef545[_0x446a('0x98')]){if(_0x7f0531[_0x446a('0x99')]==_0x446a('0x98')){_0x5ef545[_0x446a('0x86')]=_0x446a('0x9a');logger[_0x446a('0x7b')](_0x446a('0x9b'),_0x5ef545[_0x446a('0x4f')],_0x5ef545[_0x446a('0x57')]);}else{if(_[_0x446a('0x9c')](_0x7f0531[_0x446a('0x3e')][_0x446a('0x9d')](),_0x446a('0x9e'))){if(this[_0x446a('0x12')][_0x7f0531[_0x446a('0x9f')]]){var _0x2dc2e9=_['last'](this['queueReports'][_0x7f0531[_0x446a('0x9f')]]);_0x2dc2e9['queuecallercomplete']=![];_0x2dc2e9[_0x446a('0x3a')]=!![];_0x2dc2e9[_0x446a('0x97')]=moment(_0x5ef545[_0x446a('0x78')])[_0x446a('0xa0')](_0x7f0531['holdtime'],'seconds')[_0x446a('0x4d')](_0x446a('0x79'));_0x2dc2e9['queuecallerexitreason']='FORWARDTRANSFER';_0x2dc2e9[_0x446a('0x98')]=!![];_0x2dc2e9['transfertype']=_0x446a('0xa1');_0x2dc2e9['transferexten']=_0x7f0531['destexten'];_0x2dc2e9[_0x446a('0xa2')]=_0x7f0531[_0x446a('0x77')];logger[_0x446a('0x7b')](_0x446a('0xa3'),_0x2dc2e9['queue'],_0x2dc2e9[_0x446a('0x57')]);var _0x25d670=this[_0x446a('0x12')][_0x7f0531[_0x446a('0x9f')]];this[_0x446a('0x12')][_0x7f0531[_0x446a('0x9f')]]=this[_0x446a('0x12')][_0x7f0531['uniqueid']];this[_0x446a('0x12')][_0x7f0531[_0x446a('0x77')]]=_0x25d670;}}else{_0x5ef545[_0x446a('0x86')]=_0x446a('0xa4')+_0x7f0531[_0x446a('0x99')][_0x446a('0xa5')]();logger[_0x446a('0x7b')](_0x446a('0xa6'),_0x5ef545['queue'],_0x5ef545[_0x446a('0x57')],_0x5ef545['queuecallerexitreason']);}}}this[_0x446a('0x15')][_0x7f0531[_0x446a('0x77')]]=_0x5ef545;}}}catch(_0x247a4d){logger[_0x446a('0x45')](_0x446a('0x93'),_0x7f0531[_0x446a('0x77')],util[_0x446a('0x43')](_0x247a4d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xa7')]=function(_0x48a1e0){try{if(this['isNotNull'](_0x48a1e0)){logger['debug'](_0x446a('0xa8'),_0x48a1e0['uniqueid'],util[_0x446a('0x43')](_0x48a1e0,{'showHidden':![],'depth':null}));this[_0x446a('0xa9')](_0x48a1e0[_0x446a('0x77')],_['keys'](_0x48a1e0[_0x446a('0xaa')])[0x0],_0x48a1e0[_0x446a('0xab')]);if(this['queueReports'][_0x48a1e0[_0x446a('0x77')]]){var _0x55a008=_['last'](this[_0x446a('0x12')][_0x48a1e0[_0x446a('0x77')]]);if(_0x55a008){if(this[_0x446a('0x5b')](_0x48a1e0['variable'])&&this[_0x446a('0x5b')](_0x48a1e0[_0x446a('0xaa')][_0x446a('0x65')])){switch(_0x48a1e0['value']){case _0x446a('0xac'):_0x55a008['queuecallerexit']=![];_0x55a008[_0x446a('0x97')]=null;break;case'TIMEOUT':_0x55a008[_0x446a('0xad')]=_0x446a('0xae');_0x55a008[_0x446a('0x3a')]=!![];_0x55a008['queuecallerexitAt']=moment()[_0x446a('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x55a008[_0x446a('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x446a('0x52')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x48a1e0[_0x446a('0x77')],util['inspect'](_0x55a008,{'showHidden':![],'depth':null}));ami['emit'](_0x446a('0xaf'),_0x55a008);break;default:_0x55a008[_0x446a('0x3a')]=!![];_0x55a008[_0x446a('0x97')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55a008[_0x446a('0x89')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));}_0x55a008[_0x446a('0x23')]=![];_0x55a008['queuecallerabandonAt']=null;_0x55a008[_0x446a('0x86')]=_0x48a1e0['value'];this[_0x446a('0x15')][_0x48a1e0['uniqueid']]=_0x55a008;this['emitVoiceQueueChannelRemove'](_0x55a008,_0x446a('0x28'));}else if(this[_0x446a('0x5b')](_0x48a1e0[_0x446a('0xaa')])&&this[_0x446a('0x5b')](_0x48a1e0[_0x446a('0xaa')][_0x446a('0xb0')])){if(!_0x55a008[_0x446a('0x23')]){_0x55a008[_0x446a('0x3a')]=!![];_0x55a008[_0x446a('0x97')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));_0x55a008['queuecallerexitreason']=_0x446a('0xb1');_0x55a008[_0x446a('0x89')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));this[_0x446a('0x15')][_0x48a1e0[_0x446a('0x77')]]=_0x55a008;}}logger[_0x446a('0x7b')](_0x446a('0xb2'),_0x48a1e0[_0x446a('0x77')],_0x55a008['queue'],_0x55a008[_0x446a('0x57')],_[_0x446a('0x7e')](_0x48a1e0[_0x446a('0xaa')])[0x0],_0x48a1e0[_0x446a('0xab')]);_0x55a008[_0x446a('0x1a')]=this['variables'][_0x48a1e0[_0x446a('0x77')]];}}}}catch(_0x32989e){logger[_0x446a('0x45')](_0x446a('0xa8'),_0x48a1e0[_0x446a('0x77')],util['inspect'](_0x32989e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xa9')]=function(_0x9d5b74,_0x511c60,_0x16efc9){var _0x316da6=['rtpaudioqos',_0x446a('0xb3'),'rtpaudioqosjitter',_0x446a('0xb4'),_0x446a('0xb5'),_0x446a('0xb6'),_0x446a('0xb7'),_0x446a('0xb8'),'sipcallid','sipuri','bridgepeer',_0x446a('0xb9'),_0x446a('0xba'),_0x446a('0xbb'),'memberinterface','memberlastcall',_0x446a('0x96'),_0x446a('0xbc'),_0x446a('0xbd')];if(!_['isNil'](_0x511c60)&&!_[_0x446a('0xbe')](_0x316da6,_0x511c60)){if(_[_0x446a('0x5c')](this[_0x446a('0x1a')][_0x9d5b74])){this[_0x446a('0x1a')][_0x9d5b74]={};}this[_0x446a('0x1a')][_0x9d5b74][_0x511c60]=_0x16efc9;}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xbf')]=function(_0x489b3e,_0x5da324,_0x1c23f0){try{var _0x977afd={};if(this[_0x446a('0x12')][_0x489b3e]){for(var _0x1fa53f=0x0;_0x1fa53f{delete this[_0x446a('0x15')][_0x43edf0];},_0x3766fd);}};module[_0x446a('0xf7')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 25ccda3..6b43aff 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b82=['queue','Request','CreateReportAgentPreview','../client','createHistory','campaign'];(function(_0x255445,_0x5a6a88){var _0x31397d=function(_0x249704){while(--_0x249704){_0x255445['push'](_0x255445['shift']());}};_0x31397d(++_0x5a6a88);}(_0x6b82,0x75));var _0x26b8=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0x6b82[_0x54b2b0];return _0x1a0d6b;};'use strict';var client=require(_0x26b8('0x0'));exports[_0x26b8('0x1')]=function(_0x319c73){return function(){_0x319c73[_0x26b8('0x2')]=_0x319c73[_0x26b8('0x3')];return client[_0x26b8('0x4')](_0x26b8('0x5'),{'body':_0x319c73,'log':_0x26b8('0x5')});};}; \ No newline at end of file +var _0x984f=['createHistory','campaign','CreateReportAgentPreview'];(function(_0x19de02,_0x3e0f1e){var _0x16bc03=function(_0x17784a){while(--_0x17784a){_0x19de02['push'](_0x19de02['shift']());}};_0x16bc03(++_0x3e0f1e);}(_0x984f,0xbd));var _0xf984=function(_0x8f6fa5,_0x320980){_0x8f6fa5=_0x8f6fa5-0x0;var _0x2e1201=_0x984f[_0x8f6fa5];return _0x2e1201;};'use strict';var client=require('../client');exports[_0xf984('0x0')]=function(_0x2490a3){return function(){_0x2490a3[_0xf984('0x1')]=_0x2490a3['queue'];return client['Request'](_0xf984('0x2'),{'body':_0x2490a3,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 7d9d0f6..99f0f63 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f0d=['CreateAttachment'];(function(_0x5ea8d8,_0x404d40){var _0xfe09=function(_0x2807f7){while(--_0x2807f7){_0x5ea8d8['push'](_0x5ea8d8['shift']());}};_0xfe09(++_0x404d40);}(_0x7f0d,0x89));var _0xd7f0=function(_0x5ed435,_0x1a0d7d){_0x5ed435=_0x5ed435-0x0;var _0x327146=_0x7f0d[_0x5ed435];return _0x327146;};'use strict';var client=require('../client');exports['create']=function(_0x548c1f){return client['Request']('CreateAttachment',{'body':_0x548c1f,'log':_0xd7f0('0x0')});}; \ No newline at end of file +var _0x5f63=['create','Request','CreateAttachment','../client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5f63,0x117));var _0x35f6=function(_0x5d6844,_0x4f00e7){_0x5d6844=_0x5d6844-0x0;var _0x7f526b=_0x5f63[_0x5d6844];return _0x7f526b;};'use strict';var client=require(_0x35f6('0x0'));exports[_0x35f6('0x1')]=function(_0xecc965){return client[_0x35f6('0x2')](_0x35f6('0x3'),{'body':_0xecc965,'log':_0x35f6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 7313767..d5c528c 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0xd47394,_0x42c0d2){var _0x198ac5=function(_0x31672b){while(--_0x31672b){_0xd47394['push'](_0xd47394['shift']());}};_0x198ac5(++_0x42c0d2);}(_0x326f,0xd1));var _0xf326=function(_0x184fd4,_0x5691a1){_0x184fd4=_0x184fd4-0x0;var _0x4cdb9a=_0x326f[_0x184fd4];return _0x4cdb9a;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0x5f2f=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','Trunk','callerid','TrunkBackup','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','GetCampaign','name','type','active','limitCalls'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x392ad2,_0xf4c384){_0x392ad2=_0x392ad2-0x0;var _0x594d51=_0x5f2f[_0x392ad2];return _0x594d51;};'use strict';var client=require(_0xf5f2('0x0'));exports[_0xf5f2('0x1')]=function(){return function(){return client[_0xf5f2('0x2')](_0xf5f2('0x3'),{'options':{'raw':![],'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'dialNoAnswerRetryFrequency',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'dialDropMaxRetry',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'dialMachineMaxRetry',_0xf5f2('0x14'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0xf5f2('0x15'),_0xf5f2('0x16'),'dialAMDActive',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'dialAMDMaximumNumberOfWords',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21'),'dialCutDigit'],'include':[{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x22'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x24'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x25'),'attributes':['id',_0xf5f2('0x4')],'include':[{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x26'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x27')]}]},{'model':'SquareProject','as':_0xf5f2('0x28'),'attributes':['id',_0xf5f2('0x4')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 0cf675a..f95fea4 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x873c=['../client','CreateCmContact','getContacts','Request','GetCmContact'];(function(_0x2c9a11,_0x44e8af){var _0x2cd3aa=function(_0x71e93){while(--_0x71e93){_0x2c9a11['push'](_0x2c9a11['shift']());}};_0x2cd3aa(++_0x44e8af);}(_0x873c,0x104));var _0xc873=function(_0x529595,_0x2fcbc0){_0x529595=_0x529595-0x0;var _0x382a36=_0x873c[_0x529595];return _0x382a36;};'use strict';var client=require(_0xc873('0x0'));exports['createContact']=function(_0x59ef45){return function(){return client['Request'](_0xc873('0x1'),{'body':_0x59ef45,'log':_0xc873('0x1')});};};exports[_0xc873('0x2')]=function(_0xffcf0a){return function(){return client[_0xc873('0x3')](_0xc873('0x4'),{'options':_0xffcf0a,'log':_0xc873('0x4')});};}; \ No newline at end of file +var _0xc598=['../client','CreateCmContact','GetCmContact'];(function(_0x55617b,_0x3838c5){var _0x4b0d40=function(_0xfdd0f1){while(--_0xfdd0f1){_0x55617b['push'](_0x55617b['shift']());}};_0x4b0d40(++_0x3838c5);}(_0xc598,0xd5));var _0x8c59=function(_0x4e5cdf,_0x55b58b){_0x4e5cdf=_0x4e5cdf-0x0;var _0x121234=_0xc598[_0x4e5cdf];return _0x121234;};'use strict';var client=require(_0x8c59('0x0'));exports['createContact']=function(_0xc843ce){return function(){return client['Request'](_0x8c59('0x1'),{'body':_0xc843ce,'log':'CreateCmContact'});};};exports['getContacts']=function(_0xb48a0a){return function(){return client['Request'](_0x8c59('0x2'),{'options':_0xb48a0a,'log':_0x8c59('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index eb5a3c8..fbac6de 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcc7=['destroyContact','DestroyCmHopper','getContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','GetContactDialer','GetContactDialerIvr','moveContactManagedDialer','MoveContactManagedDialer','ListId','VoiceQueueId','CampaignId','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','VoiceQueue','name','unlockContact','getContactRecallMe','GetContactRecallMe','CmContact','Agent','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','GetCmHopper','Contact','getCmHopper','Request','UpdateCmHopper','format','ContactId','rescheduleContact'];(function(_0x1b1ae3,_0x4ee04d){var _0x43bcbe=function(_0x20836e){while(--_0x20836e){_0x1b1ae3['push'](_0x1b1ae3['shift']());}};_0x43bcbe(++_0x4ee04d);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x5db16f,_0x3a2a32){_0x5db16f=_0x5db16f-0x0;var _0x12ff59=_0xbcc7[_0x5db16f];return _0x12ff59;};'use strict';var client=require(_0x7bcc('0x0'));var moment=require(_0x7bcc('0x1'));exports['getContacts']=function(_0x446ead,_0x4bd2e1){return function(){return client['Request'](_0x7bcc('0x2'),{'options':{'where':{'VoiceQueueId':_0x446ead},'include':[{'model':'CmContact','as':_0x7bcc('0x3')}],'limit':_0x4bd2e1,'raw':![]},'log':_0x7bcc('0x4')});};};exports['updateContacts']=function(_0x1bf847,_0x24ff05,_0x82b2e1){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0x6'),{'body':_0x1bf847,'options':{'where':{'VoiceQueueId':_0x24ff05,'scheduledat':{'$lte':moment()[_0x7bcc('0x7')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x82b2e1},'log':_0x7bcc('0x6')});};};exports['rescheduleContact']=function(_0x317db2){return client[_0x7bcc('0x5')]('UpdateCmHopper',{'body':_0x317db2,'options':{'where':{'ContactId':_0x317db2[_0x7bcc('0x8')],'ListId':_0x317db2['ListId'],'VoiceQueueId':_0x317db2['VoiceQueueId'],'CampaignId':_0x317db2['CampaignId']}},'log':_0x7bcc('0x9')});};exports[_0x7bcc('0xa')]=function(_0xb3207,_0x1121d1,_0x45fedf){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0xb'),{'options':{'where':{'VoiceQueueId':_0xb3207,'ListId':_0x1121d1,'ContactId':_0x45fedf}},'log':'DestroyCmHopper'});};};exports[_0x7bcc('0xc')]=function(_0x101354,_0x4659c5,_0x12714f,_0x39f912){return client[_0x7bcc('0x5')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x101354,'active':![],'scheduledat':{'$lte':moment()[_0x7bcc('0x7')](_0x7bcc('0xd'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4659c5}}]},'order':[[_0x7bcc('0xe'),_0x7bcc('0xf')],[_0x7bcc('0x10'),_0x39f912],['id',_0x7bcc('0x11')]],'raw':!![],'limit':_0x12714f},'log':_0x7bcc('0x12')});};exports['getContactDialerIvr']=function(_0x20105e,_0x4ce248,_0x3156f3){return client[_0x7bcc('0x5')](_0x7bcc('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x20105e,'active':![],'scheduledat':{'$lte':moment()[_0x7bcc('0x7')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':'CmContact','as':_0x7bcc('0x3')}],'order':[[_0x7bcc('0xe'),_0x7bcc('0xf')],[_0x7bcc('0x10'),_0x3156f3],['id',_0x7bcc('0x11')]],'raw':!![],'limit':_0x4ce248},'log':_0x7bcc('0x13')});};exports[_0x7bcc('0x14')]=function(_0x3d0719,_0x15b2c3){_0x3d0719['campaign']=_0x3d0719['queue'];return client[_0x7bcc('0x5')](_0x7bcc('0x15'),{'body':_0x3d0719,'options':{'where':{'ContactId':_0x3d0719[_0x7bcc('0x8')],'ListId':_0x3d0719[_0x7bcc('0x16')],'VoiceQueueId':_0x3d0719[_0x7bcc('0x17')],'CampaignId':_0x3d0719[_0x7bcc('0x18')],'active':_0x15b2c3?undefined:!![]}},'log':_0x7bcc('0x15')});};exports[_0x7bcc('0x19')]=function(_0x32b3ea){return client['Request'](_0x7bcc('0x1a'),{'options':{'where':{'VoiceQueueId':_0x32b3ea['id']?_0x32b3ea['id']||null:null}},'log':_0x7bcc('0x19')});};exports[_0x7bcc('0x1b')]=function(_0x3875df){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0x1c'),{'options':{'where':{'id':_0x3875df},'include':[{'model':'CmContact','as':'Contact'},{'model':_0x7bcc('0x1d'),'as':'Agent','attributes':['id','name']},{'model':_0x7bcc('0x1e'),'as':'Queue','attributes':['id',_0x7bcc('0x1f')]}],'raw':!![]},'log':_0x7bcc('0x4')});};};exports[_0x7bcc('0x20')]=function(_0x5b919f,_0x17c3ce,_0x1dea55){return client[_0x7bcc('0x5')](_0x7bcc('0x6'),{'body':_0x5b919f,'options':{'where':{'id':_0x17c3ce},'limit':_0x1dea55},'log':_0x7bcc('0x6')});};exports[_0x7bcc('0x21')]=function(_0x9fdacf,_0x57aa56){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x9fdacf,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x57aa56}},'order':[[_0x7bcc('0xe'),'DESC'],[_0x7bcc('0x10'),_0x7bcc('0xf')],['id',_0x7bcc('0x11')]],'include':[{'model':_0x7bcc('0x23'),'as':'Contact'},{'model':_0x7bcc('0x1d'),'as':_0x7bcc('0x24'),'attributes':['id',_0x7bcc('0x1f'),'voicePause']}],'group':_0x7bcc('0x25'),'raw':!![]},'log':_0x7bcc('0x12')});};};exports[_0x7bcc('0x26')]=function(_0x26c033,_0x1c562f){return client[_0x7bcc('0x5')](_0x7bcc('0x27'),{'body':_0x26c033,'options':_0x1c562f||{},'log':_0x7bcc('0x27')});};exports[_0x7bcc('0x28')]=function(_0x338e79,_0x2865a1,_0x529c55){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0x29'),{'body':{'where':{'voiceQueueIds':_0x338e79,'interval':_0x2865a1,'availableAgentsIds':_0x529c55}},'log':_0x7bcc('0x28')});};}; \ No newline at end of file +var _0x714c=['getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','moment','getContacts','Request','CmContact','Contact','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','format','priority','DESC','scheduledat','ASC','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','Queue','unlockContact'];(function(_0x40c09c,_0x3efd32){var _0x260c44=function(_0x4ab94b){while(--_0x4ab94b){_0x40c09c['push'](_0x40c09c['shift']());}};_0x260c44(++_0x3efd32);}(_0x714c,0x18d));var _0xc714=function(_0x4d770d,_0x5af4ce){_0x4d770d=_0x4d770d-0x0;var _0x11dc7a=_0x714c[_0x4d770d];return _0x11dc7a;};'use strict';var client=require('../client');var moment=require(_0xc714('0x0'));exports[_0xc714('0x1')]=function(_0x130c49,_0x283ad4){return function(){return client[_0xc714('0x2')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x130c49},'include':[{'model':_0xc714('0x3'),'as':_0xc714('0x4')}],'limit':_0x283ad4,'raw':![]},'log':'getCmHopper'});};};exports['updateContacts']=function(_0x2f2e3c,_0xf624fc,_0x1c4a3b){return function(){return client[_0xc714('0x2')]('UpdateCmHopper',{'body':_0x2f2e3c,'options':{'where':{'VoiceQueueId':_0xf624fc,'scheduledat':{'$lte':moment()['format'](_0xc714('0x5'))}},'limit':_0x1c4a3b},'log':_0xc714('0x6')});};};exports[_0xc714('0x7')]=function(_0x32985c){return client[_0xc714('0x2')]('UpdateCmHopper',{'body':_0x32985c,'options':{'where':{'ContactId':_0x32985c[_0xc714('0x8')],'ListId':_0x32985c[_0xc714('0x9')],'VoiceQueueId':_0x32985c[_0xc714('0xa')],'CampaignId':_0x32985c[_0xc714('0xb')]}},'log':_0xc714('0x7')});};exports['destroyContact']=function(_0xaa2acc,_0x3060eb,_0x5cc07f){return function(){return client['Request'](_0xc714('0xc'),{'options':{'where':{'VoiceQueueId':_0xaa2acc,'ListId':_0x3060eb,'ContactId':_0x5cc07f}},'log':'DestroyCmHopper'});};};exports[_0xc714('0xd')]=function(_0x4462fe,_0x44898b,_0x3be76d,_0x5030c1){return client[_0xc714('0x2')](_0xc714('0xe'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4462fe,'active':![],'scheduledat':{'$lte':moment()[_0xc714('0xf')](_0xc714('0x5'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x44898b}}]},'order':[[_0xc714('0x10'),_0xc714('0x11')],[_0xc714('0x12'),_0x5030c1],['id',_0xc714('0x13')]],'raw':!![],'limit':_0x3be76d},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x17b1bb,_0x33941d,_0xe22937){return client[_0xc714('0x2')](_0xc714('0xe'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x17b1bb,'active':![],'scheduledat':{'$lte':moment()[_0xc714('0xf')](_0xc714('0x5'))}},'include':[{'model':_0xc714('0x3'),'as':'Contact'}],'order':[[_0xc714('0x10'),_0xc714('0x11')],[_0xc714('0x12'),_0xe22937],['id',_0xc714('0x13')]],'raw':!![],'limit':_0x33941d},'log':'GetContactDialerIvr'});};exports[_0xc714('0x14')]=function(_0xc9787a,_0x27ee89){_0xc9787a[_0xc714('0x15')]=_0xc9787a[_0xc714('0x16')];return client['Request'](_0xc714('0x17'),{'body':_0xc9787a,'options':{'where':{'ContactId':_0xc9787a['ContactId'],'ListId':_0xc9787a[_0xc714('0x9')],'VoiceQueueId':_0xc9787a[_0xc714('0xa')],'CampaignId':_0xc9787a[_0xc714('0xb')],'active':_0x27ee89?undefined:!![]}},'log':_0xc714('0x17')});};exports[_0xc714('0x18')]=function(_0x587ea8){return client['Request'](_0xc714('0x19'),{'options':{'where':{'VoiceQueueId':_0x587ea8['id']?_0x587ea8['id']||null:null}},'log':'countReScheduled'});};exports[_0xc714('0x1a')]=function(_0x4637e7){return function(){return client['Request']('GetCmHopperPreview',{'options':{'where':{'id':_0x4637e7},'include':[{'model':_0xc714('0x3'),'as':_0xc714('0x4')},{'model':_0xc714('0x1b'),'as':_0xc714('0x1c'),'attributes':['id',_0xc714('0x1d')]},{'model':'VoiceQueue','as':_0xc714('0x1e'),'attributes':['id',_0xc714('0x1d')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xc714('0x1f')]=function(_0x1bcd98,_0x43f8d9,_0x48b64b){return client['Request'](_0xc714('0x6'),{'body':_0x1bcd98,'options':{'where':{'id':_0x43f8d9},'limit':_0x48b64b},'log':'UpdateCmHopper'});};exports[_0xc714('0x20')]=function(_0x1d51b5,_0x480758){return function(){return client[_0xc714('0x2')](_0xc714('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1d51b5,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0xc714('0x5'))},'UserId':{'$in':_0x480758}},'order':[[_0xc714('0x10'),'DESC'],[_0xc714('0x12'),_0xc714('0x11')],['id',_0xc714('0x13')]],'include':[{'model':_0xc714('0x3'),'as':_0xc714('0x4')},{'model':_0xc714('0x1b'),'as':_0xc714('0x1c'),'attributes':['id','name',_0xc714('0x22')]}],'group':_0xc714('0x23'),'raw':!![]},'log':_0xc714('0xe')});};};exports[_0xc714('0x24')]=function(_0x3a1c45,_0x21c346){return client[_0xc714('0x2')](_0xc714('0x25'),{'body':_0x3a1c45,'options':_0x21c346||{},'log':_0xc714('0x25')});};exports[_0xc714('0x26')]=function(_0x3ebb68,_0x4113f8,_0x28843f){return function(){return client[_0xc714('0x2')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x3ebb68,'interval':_0x4113f8,'availableAgentsIds':_0x28843f}},'log':_0xc714('0x26')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index f2c74fe..060ef2d 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x545b=['Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','VerifyAdditionalPhones','swapAdditionalPhones'];(function(_0x550ddc,_0x2f6d5f){var _0x14726f=function(_0x406865){while(--_0x406865){_0x550ddc['push'](_0x550ddc['shift']());}};_0x14726f(++_0x2f6d5f);}(_0x545b,0x1ec));var _0xb545=function(_0x4a1e37,_0x2eef28){_0x4a1e37=_0x4a1e37-0x0;var _0xeb1f8b=_0x545b[_0x4a1e37];return _0xeb1f8b;};'use strict';var client=require(_0xb545('0x0'));exports[_0xb545('0x1')]=function(_0x252744,_0x90a761,_0x170234){return client['Request'](_0xb545('0x2'),{'body':_0x252744,'reason':_0x90a761,'entity':_0x170234,'log':'VerifyAdditionalPhones'});};exports[_0xb545('0x3')]=function(_0x41886f,_0x288031,_0x1fda61){return client[_0xb545('0x4')](_0xb545('0x5'),{'body':_0x41886f,'duration':_0x288031,'waitTime':_0x1fda61,'log':_0xb545('0x5')});};exports[_0xb545('0x6')]=function(_0x43bc0c){return function(){return client[_0xb545('0x4')]('IncrementPreviewCounters',{'body':_0x43bc0c,'log':_0xb545('0x7')});};}; \ No newline at end of file +var _0x4cd6=['swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones'];(function(_0x3f3f40,_0x4e745f){var _0x32c366=function(_0x343f6a){while(--_0x343f6a){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x32c366(++_0x4e745f);}(_0x4cd6,0xec));var _0x64cd=function(_0x3b081a,_0x100d97){_0x3b081a=_0x3b081a-0x0;var _0x256a75=_0x4cd6[_0x3b081a];return _0x256a75;};'use strict';var client=require(_0x64cd('0x0'));exports[_0x64cd('0x1')]=function(_0x1e47df,_0x7ed6a6,_0x3d2627){return client[_0x64cd('0x2')](_0x64cd('0x3'),{'body':_0x1e47df,'reason':_0x7ed6a6,'entity':_0x3d2627,'log':_0x64cd('0x3')});};exports[_0x64cd('0x4')]=function(_0x4b5923,_0x35ac56,_0x25a8b4){return client['Request']('SwapAdditionalPhones',{'body':_0x4b5923,'duration':_0x35ac56,'waitTime':_0x25a8b4,'log':_0x64cd('0x5')});};exports[_0x64cd('0x6')]=function(_0x1eecc5){return function(){return client[_0x64cd('0x2')](_0x64cd('0x7'),{'body':_0x1eecc5,'log':_0x64cd('0x7')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index da10b3e..2848b47 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9da=['GetCmHopperBlack','GetCmHopperBlackIvr','../client','checkIsBlackList','VoiceQueueId','phone','checkIsBlackListIvr','Request'];(function(_0x3b79ee,_0x2c7e90){var _0x1541e1=function(_0x16b4d4){while(--_0x16b4d4){_0x3b79ee['push'](_0x3b79ee['shift']());}};_0x1541e1(++_0x2c7e90);}(_0xf9da,0x11a));var _0xaf9d=function(_0x4498ac,_0x30e301){_0x4498ac=_0x4498ac-0x0;var _0x4bf1b6=_0xf9da[_0x4498ac];return _0x4bf1b6;};'use strict';var client=require(_0xaf9d('0x0'));exports[_0xaf9d('0x1')]=function(_0x265758){return client['Request']('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x265758[_0xaf9d('0x2')],'phone':_0x265758[_0xaf9d('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0xaf9d('0x4')]=function(_0x373172){return client[_0xaf9d('0x5')](_0xaf9d('0x6'),{'options':{'where':{'CampaignId':_0x373172['CampaignId'],'phone':_0x373172[_0xaf9d('0x3')]},'raw':![]},'log':_0xaf9d('0x7')});}; \ No newline at end of file +var _0x5d49=['../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x5d49,0xcf));var _0x95d4=function(_0x47fb2a,_0x3e71fc){_0x47fb2a=_0x47fb2a-0x0;var _0x1111c2=_0x5d49[_0x47fb2a];return _0x1111c2;};'use strict';var client=require(_0x95d4('0x0'));exports[_0x95d4('0x1')]=function(_0x1e4a58){return client[_0x95d4('0x2')](_0x95d4('0x3'),{'options':{'where':{'VoiceQueueId':_0x1e4a58[_0x95d4('0x4')],'phone':_0x1e4a58[_0x95d4('0x5')]},'raw':![]},'log':_0x95d4('0x3')});};exports[_0x95d4('0x6')]=function(_0x1415b0){return client[_0x95d4('0x2')](_0x95d4('0x3'),{'options':{'where':{'CampaignId':_0x1415b0[_0x95d4('0x7')],'phone':_0x1415b0[_0x95d4('0x5')]},'raw':![]},'log':_0x95d4('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index baece57..ab9c502 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf133=['campaign','queue','Request','CreateCmHopperFinal','../client','createContact'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xf133,0x106));var _0x3f13=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf133[_0x88cd7b];return _0x56fcc8;};'use strict';var client=require(_0x3f13('0x0'));exports[_0x3f13('0x1')]=function(_0x52f2eb){return function(){_0x52f2eb[_0x3f13('0x2')]=_0x52f2eb[_0x3f13('0x3')];return client[_0x3f13('0x4')](_0x3f13('0x5'),{'body':_0x52f2eb,'log':_0x3f13('0x5')});};}; \ No newline at end of file +var _0x0b6f=['../client','createContact','campaign','queue','CreateCmHopperFinal'];(function(_0x504187,_0x407042){var _0x84c53d=function(_0x41ab4c){while(--_0x41ab4c){_0x504187['push'](_0x504187['shift']());}};_0x84c53d(++_0x407042);}(_0x0b6f,0x195));var _0xf0b6=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0x0b6f[_0x4f8d61];return _0x3bc078;};'use strict';var client=require(_0xf0b6('0x0'));exports[_0xf0b6('0x1')]=function(_0x9c052f){return function(){_0x9c052f[_0xf0b6('0x2')]=_0x9c052f[_0xf0b6('0x3')];return client['Request'](_0xf0b6('0x4'),{'body':_0x9c052f,'log':_0xf0b6('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 605da07..fbb1d4e 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2706=['endOf','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivr','../client','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','startOf','day'];(function(_0x59547f,_0x441963){var _0x3a5309=function(_0x414561){while(--_0x414561){_0x59547f['push'](_0x59547f['shift']());}};_0x3a5309(++_0x441963);}(_0x2706,0x1b4));var _0x6270=function(_0x456e19,_0x56b700){_0x456e19=_0x456e19-0x0;var _0x297a29=_0x2706[_0x456e19];return _0x297a29;};'use strict';var client=require(_0x6270('0x0'));var moment=require('moment');exports['createHistory']=function(_0x3f226f){_0x3f226f[_0x6270('0x1')]=_0x3f226f[_0x6270('0x2')];return client[_0x6270('0x3')](_0x6270('0x4'),{'body':_0x3f226f,'log':_0x6270('0x4')});};exports[_0x6270('0x5')]=function(_0x454f8b){return client[_0x6270('0x3')](_0x6270('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x6270('0x7')](_0x454f8b,_0x6270('0x8'))[_0x6270('0x9')](_0x6270('0xa')),moment()[_0x6270('0x9')](_0x6270('0xa'))]}},'raw':![]},'log':_0x6270('0xb')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x6270('0x3')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x6270('0xc')](_0x6270('0xd'))[_0x6270('0x9')](_0x6270('0xa')),moment()[_0x6270('0xe')](_0x6270('0xd'))[_0x6270('0x9')](_0x6270('0xa'))]},'campaigntype':_0x6270('0x2')},'raw':![]},'log':_0x6270('0xf')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x6270('0x3')](_0x6270('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6270('0xc')]('day')[_0x6270('0x9')](_0x6270('0xa')),moment()[_0x6270('0xe')](_0x6270('0xd'))[_0x6270('0x9')](_0x6270('0xa'))]},'campaigntype':_0x6270('0x11')},'raw':![]},'log':_0x6270('0x10')});};}; \ No newline at end of file +var _0x4e56=['endOf','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','moment','createHistory','campaign','queue','Request','CreateCmHopperHistory','AvgHandleTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','startOf','day'];(function(_0x4792d9,_0x131035){var _0x369e3f=function(_0xe1e738){while(--_0xe1e738){_0x4792d9['push'](_0x4792d9['shift']());}};_0x369e3f(++_0x131035);}(_0x4e56,0x89));var _0x64e5=function(_0x514d52,_0x16f59f){_0x514d52=_0x514d52-0x0;var _0x211383=_0x4e56[_0x514d52];return _0x211383;};'use strict';var client=require(_0x64e5('0x0'));var moment=require(_0x64e5('0x1'));exports[_0x64e5('0x2')]=function(_0x47b40c){_0x47b40c[_0x64e5('0x3')]=_0x47b40c[_0x64e5('0x4')];return client[_0x64e5('0x5')](_0x64e5('0x6'),{'body':_0x47b40c,'log':_0x64e5('0x6')});};exports['avgHandleTime']=function(_0x275276){return client[_0x64e5('0x5')](_0x64e5('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0x64e5('0x8')](_0x275276,'minutes')[_0x64e5('0x9')](_0x64e5('0xa')),moment()[_0x64e5('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':_0x64e5('0xb')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x64e5('0x5')](_0x64e5('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x64e5('0xd')](_0x64e5('0xe'))[_0x64e5('0x9')](_0x64e5('0xa')),moment()[_0x64e5('0xf')](_0x64e5('0xe'))[_0x64e5('0x9')](_0x64e5('0xa'))]},'campaigntype':_0x64e5('0x4')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x64e5('0x10')]=function(){return function(){return client[_0x64e5('0x5')](_0x64e5('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x64e5('0xd')](_0x64e5('0xe'))[_0x64e5('0x9')](_0x64e5('0xa')),moment()[_0x64e5('0xf')](_0x64e5('0xe'))[_0x64e5('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x64e5('0x12')},'raw':![]},'log':_0x64e5('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 72fe77d..d873e4c 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4f4=['ListId','key','Trunk','active','getFaxAccount','notify','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','name','description','ecm','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x593b5d,_0x2e9d34){var _0x37a171=function(_0x2455bc){while(--_0x2455bc){_0x593b5d['push'](_0x593b5d['shift']());}};_0x37a171(++_0x2e9d34);}(_0xb4f4,0xda));var _0x4b4f=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xb4f4[_0x576170];return _0x397c70;};'use strict';var client=require(_0x4b4f('0x0'));exports[_0x4b4f('0x1')]=function(){return function(){return client['Request'](_0x4b4f('0x2'),{'options':{'raw':![],'attributes':['id',_0x4b4f('0x3'),_0x4b4f('0x4'),_0x4b4f('0x5'),'headerinfo',_0x4b4f('0x6'),_0x4b4f('0x7'),_0x4b4f('0x8'),_0x4b4f('0x9'),_0x4b4f('0xa'),_0x4b4f('0xb'),_0x4b4f('0xc'),'tech','TrunkId',_0x4b4f('0xd'),_0x4b4f('0xe')],'include':[{'model':_0x4b4f('0xf'),'as':_0x4b4f('0xf'),'attributes':['id',_0x4b4f('0x3'),'callerid',_0x4b4f('0x10')]}]},'log':_0x4b4f('0x11')});};};exports[_0x4b4f('0x12')]=function(_0x5f0f0b,_0x4a65db){return client[_0x4b4f('0x13')]('NotifyFaxAccount',{'account':{'id':_0x5f0f0b},'body':_0x4a65db,'log':_0x4b4f('0x14')});}; \ No newline at end of file +var _0x3a6d=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','TrunkId','ListId','key','Trunk','callerid','active','getFaxAccount','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','name','description','ecm','headerinfo'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3a6d,0x143));var _0xd3a6=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3a6d[_0xa148b7];return _0x51efd3;};'use strict';var client=require(_0xd3a6('0x0'));exports[_0xd3a6('0x1')]=function(){return function(){return client['Request'](_0xd3a6('0x2'),{'options':{'raw':![],'attributes':['id',_0xd3a6('0x3'),_0xd3a6('0x4'),_0xd3a6('0x5'),_0xd3a6('0x6'),'localstationid',_0xd3a6('0x7'),_0xd3a6('0x8'),_0xd3a6('0x9'),_0xd3a6('0xa'),_0xd3a6('0xb'),_0xd3a6('0xc'),'tech',_0xd3a6('0xd'),_0xd3a6('0xe'),_0xd3a6('0xf')],'include':[{'model':_0xd3a6('0x10'),'as':_0xd3a6('0x10'),'attributes':['id',_0xd3a6('0x3'),_0xd3a6('0x11'),_0xd3a6('0x12')]}]},'log':_0xd3a6('0x13')});};};exports['notify']=function(_0x172513,_0x1a00f7){return client[_0xd3a6('0x14')](_0xd3a6('0x15'),{'account':{'id':_0x172513},'body':_0x1a00f7,'log':_0xd3a6('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 0eedd13..67a5283 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf18=['update','Request','UpdateFaxMessage','../client'];(function(_0x3995e0,_0x13833a){var _0xb9ea5e=function(_0x597289){while(--_0x597289){_0x3995e0['push'](_0x3995e0['shift']());}};_0xb9ea5e(++_0x13833a);}(_0xaf18,0x15f));var _0x8af1=function(_0x7048ce,_0x2358f2){_0x7048ce=_0x7048ce-0x0;var _0x166188=_0xaf18[_0x7048ce];return _0x166188;};'use strict';var client=require(_0x8af1('0x0'));exports[_0x8af1('0x1')]=function(_0x24fad4,_0x19df3e){return client[_0x8af1('0x2')](_0x8af1('0x3'),{'body':_0x19df3e,'options':{'where':{'AttachmentId':_0x24fad4}},'log':_0x8af1('0x3')});}; \ No newline at end of file +var _0xa021=['../client','UpdateFaxMessage'];(function(_0xdceae4,_0x5add49){var _0x23e95f=function(_0x51f6eb){while(--_0x51f6eb){_0xdceae4['push'](_0xdceae4['shift']());}};_0x23e95f(++_0x5add49);}(_0xa021,0x78));var _0x1a02=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0xa021[_0x42ebba];return _0x3fd2af;};'use strict';var client=require(_0x1a02('0x0'));exports['update']=function(_0x232fc9,_0x18f809){return client['Request'](_0x1a02('0x1'),{'body':_0x18f809,'options':{'where':{'AttachmentId':_0x232fc9}},'log':_0x1a02('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 00748d5..e877eb6 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x848c=['password','remoteUri','authType','DeskConfiguration','Configurations','DeskField','Subjects','content','variableName','Variable','Descriptions','type','keyType','keyContent','Fields','idField','Tags','../../client','Request','GetDeskAccount','name','description','username'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x848c,0x181));var _0xc848=function(_0x2037e0,_0x23cc47){_0x2037e0=_0x2037e0-0x0;var _0x4f6502=_0x848c[_0x2037e0];return _0x4f6502;};'use strict';var client=require(_0xc848('0x0'));exports['getDeskAccounts']=function(){return function(_0x118a3e){return client[_0xc848('0x1')](_0xc848('0x2'),{'options':{'raw':![],'attributes':['id',_0xc848('0x3'),_0xc848('0x4'),_0xc848('0x5'),_0xc848('0x6'),_0xc848('0x7'),_0xc848('0x8'),'type','serverUrl'],'include':[{'model':_0xc848('0x9'),'as':_0xc848('0xa'),'attributes':['id',_0xc848('0x3')],'include':[{'model':_0xc848('0xb'),'as':_0xc848('0xc'),'attributes':['id','type',_0xc848('0xd'),_0xc848('0xe')],'include':[{'model':_0xc848('0xf'),'as':_0xc848('0xf'),'attributes':['id',_0xc848('0x3')]}]},{'model':_0xc848('0xb'),'as':_0xc848('0x10'),'attributes':['id',_0xc848('0x11'),'content','key',_0xc848('0x12'),_0xc848('0x13'),_0xc848('0xe')],'include':[{'model':_0xc848('0xf'),'as':'Variable','attributes':['id','name']}]},{'model':_0xc848('0xb'),'as':_0xc848('0x14'),'attributes':['id',_0xc848('0x11'),_0xc848('0xd'),_0xc848('0x15'),'nameField','customField',_0xc848('0xe')],'include':[{'model':_0xc848('0xf'),'as':_0xc848('0xf'),'attributes':['id',_0xc848('0x3')]}]},{'model':'Tag','as':_0xc848('0x16'),'attributes':['id',_0xc848('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0x813c=['DeskField','Fields','idField','Tags','GetDeskAccount','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','Subjects','content','Variable','Descriptions','keyType','keyContent','variableName'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x813c,0x10c));var _0xc813=function(_0x46e7cd,_0x3b1f00){_0x46e7cd=_0x46e7cd-0x0;var _0x4cdbb1=_0x813c[_0x46e7cd];return _0x4cdbb1;};'use strict';var client=require('../../client');exports['getDeskAccounts']=function(){return function(_0x54a1c2){return client['Request'](_0xc813('0x0'),{'options':{'raw':![],'attributes':['id',_0xc813('0x1'),_0xc813('0x2'),_0xc813('0x3'),_0xc813('0x4'),_0xc813('0x5'),_0xc813('0x6'),_0xc813('0x7'),_0xc813('0x8')],'include':[{'model':_0xc813('0x9'),'as':_0xc813('0xa'),'attributes':['id',_0xc813('0x1')],'include':[{'model':'DeskField','as':_0xc813('0xb'),'attributes':['id',_0xc813('0x7'),_0xc813('0xc'),'variableName'],'include':[{'model':_0xc813('0xd'),'as':'Variable','attributes':['id',_0xc813('0x1')]}]},{'model':'DeskField','as':_0xc813('0xe'),'attributes':['id',_0xc813('0x7'),_0xc813('0xc'),'key',_0xc813('0xf'),_0xc813('0x10'),_0xc813('0x11')],'include':[{'model':'Variable','as':_0xc813('0xd'),'attributes':['id','name']}]},{'model':_0xc813('0x12'),'as':_0xc813('0x13'),'attributes':['id',_0xc813('0x7'),_0xc813('0xc'),_0xc813('0x14'),'nameField','customField','variableName'],'include':[{'model':'Variable','as':_0xc813('0xd'),'attributes':['id',_0xc813('0x1')]}]},{'model':'Tag','as':_0xc813('0x15'),'attributes':['id',_0xc813('0x1')]}]}]},'log':_0xc813('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index d21ba8d..7ac4f4a 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x351d=['moduleCreate','Dynamics365Field','type','content','Variable','key','keyType','keyContent','Fields','idField','customField','CloudProvider','data2','data7','../../client','Request','GetDynamics365Account','username','remoteUri','tenantId','clientSecret','serverUrl','description','Dynamics365Configuration','Configurations','ticketType'];(function(_0x3b9072,_0x263a6d){var _0x1d69bb=function(_0x4f2806){while(--_0x4f2806){_0x3b9072['push'](_0x3b9072['shift']());}};_0x1d69bb(++_0x263a6d);}(_0x351d,0x90));var _0xd351=function(_0x4c100f,_0x268ef2){_0x4c100f=_0x4c100f-0x0;var _0x4e803c=_0x351d[_0x4c100f];return _0x4e803c;};'use strict';var client=require(_0xd351('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x109108){return client[_0xd351('0x1')](_0xd351('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xd351('0x3'),'password',_0xd351('0x4'),_0xd351('0x5'),'clientId',_0xd351('0x6'),_0xd351('0x7'),_0xd351('0x8'),'modernAuthentication'],'include':[{'model':_0xd351('0x9'),'as':_0xd351('0xa'),'attributes':['id','name',_0xd351('0xb'),_0xd351('0xc'),'additionalSearchContact','openNewTab'],'include':[{'model':_0xd351('0xd'),'as':'Subjects','attributes':['id',_0xd351('0xe'),_0xd351('0xf'),'variableName'],'include':[{'model':_0xd351('0x10'),'as':_0xd351('0x10'),'attributes':['id','name']}]},{'model':_0xd351('0xd'),'as':'Descriptions','attributes':['id','type',_0xd351('0xf'),_0xd351('0x11'),_0xd351('0x12'),_0xd351('0x13'),'variableName'],'include':[{'model':_0xd351('0x10'),'as':_0xd351('0x10'),'attributes':['id','name']}]},{'model':_0xd351('0xd'),'as':_0xd351('0x14'),'attributes':['id',_0xd351('0xe'),_0xd351('0xf'),_0xd351('0x15'),'nameField',_0xd351('0x16'),'variableName'],'include':[{'model':'Variable','as':_0xd351('0x10'),'attributes':['id','name']}]}]},{'model':_0xd351('0x17'),'as':_0xd351('0x17'),'attributes':['id',_0xd351('0x18'),'data5',_0xd351('0x19')]}]},'log':_0xd351('0x2')});};}; \ No newline at end of file +var _0x3ee7=['keyContent','Variable','Fields','content','customField','data2','data5','getDynamics365Accounts','GetDynamics365Account','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','description','Dynamics365Configuration','Configurations','ticketType','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','variableName','name','Descriptions','keyType'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x3ee7,0x98));var _0x73ee=function(_0x38ac44,_0x38c414){_0x38ac44=_0x38ac44-0x0;var _0x42e9ae=_0x3ee7[_0x38ac44];return _0x42e9ae;};'use strict';var client=require('../../client');exports[_0x73ee('0x0')]=function(){return function(_0x5b474a){return client['Request'](_0x73ee('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x73ee('0x2'),_0x73ee('0x3'),_0x73ee('0x4'),_0x73ee('0x5'),_0x73ee('0x6'),_0x73ee('0x7'),_0x73ee('0x8'),_0x73ee('0x9'),'modernAuthentication'],'include':[{'model':_0x73ee('0xa'),'as':_0x73ee('0xb'),'attributes':['id','name',_0x73ee('0xc'),'moduleCreate',_0x73ee('0xd'),_0x73ee('0xe')],'include':[{'model':_0x73ee('0xf'),'as':_0x73ee('0x10'),'attributes':['id',_0x73ee('0x11'),'content',_0x73ee('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x73ee('0x13')]}]},{'model':'Dynamics365Field','as':_0x73ee('0x14'),'attributes':['id',_0x73ee('0x11'),'content','key',_0x73ee('0x15'),_0x73ee('0x16'),'variableName'],'include':[{'model':_0x73ee('0x17'),'as':'Variable','attributes':['id',_0x73ee('0x13')]}]},{'model':'Dynamics365Field','as':_0x73ee('0x18'),'attributes':['id',_0x73ee('0x11'),_0x73ee('0x19'),'idField','nameField',_0x73ee('0x1a'),_0x73ee('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]},{'model':'CloudProvider','as':'CloudProvider','attributes':['id',_0x73ee('0x1b'),_0x73ee('0x1c'),'data7']}]},'log':_0x73ee('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 43cb9a8..68820e8 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2af=['Fields','nameField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent'];(function(_0x1b2050,_0x309da3){var _0xb5643c=function(_0x55cc90){while(--_0x55cc90){_0x1b2050['push'](_0x1b2050['shift']());}};_0xb5643c(++_0x309da3);}(_0xb2af,0xd2));var _0xfb2a=function(_0x4c3730,_0x1e071d){_0x4c3730=_0x4c3730-0x0;var _0x56330a=_0xb2af[_0x4c3730];return _0x56330a;};'use strict';var client=require(_0xfb2a('0x0'));exports[_0xfb2a('0x1')]=function(){return function(_0xf5c2e0){return client[_0xfb2a('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0xfb2a('0x3'),_0xfb2a('0x4'),_0xfb2a('0x5'),_0xfb2a('0x6'),_0xfb2a('0x7')],'include':[{'model':'FreshdeskConfiguration','as':_0xfb2a('0x8'),'attributes':['id',_0xfb2a('0x3')],'include':[{'model':_0xfb2a('0x9'),'attributes':['id','name']},{'model':_0xfb2a('0xa'),'as':_0xfb2a('0xb'),'attributes':['id',_0xfb2a('0xc'),_0xfb2a('0xd'),_0xfb2a('0xe')],'include':[{'model':_0xfb2a('0xf'),'as':_0xfb2a('0xf'),'attributes':['id',_0xfb2a('0x3')]}]},{'model':_0xfb2a('0xa'),'as':_0xfb2a('0x10'),'attributes':['id',_0xfb2a('0xc'),_0xfb2a('0xd'),_0xfb2a('0x11'),_0xfb2a('0x12'),_0xfb2a('0x13'),_0xfb2a('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xfb2a('0xa'),'as':_0xfb2a('0x14'),'attributes':['id',_0xfb2a('0xc'),_0xfb2a('0xd'),'idField',_0xfb2a('0x15'),'customField','variableName'],'include':[{'model':_0xfb2a('0xf'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xfb2a('0x16')});};}; \ No newline at end of file +var _0x48bc=['name','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','FreshdeskField','type','variableName','Variable','Descriptions','content','key','keyType','keyContent','Fields','nameField','customField','../../client','getFreshdeskAccounts','GetFreshdeskAccount'];(function(_0x224012,_0x293e50){var _0x544142=function(_0x5f0835){while(--_0x5f0835){_0x224012['push'](_0x224012['shift']());}};_0x544142(++_0x293e50);}(_0x48bc,0x1b6));var _0xc48b=function(_0x40a768,_0x4c112a){_0x40a768=_0x40a768-0x0;var _0x3379e1=_0x48bc[_0x40a768];return _0x3379e1;};'use strict';var client=require(_0xc48b('0x0'));exports[_0xc48b('0x1')]=function(){return function(_0x11f046){return client['Request'](_0xc48b('0x2'),{'options':{'raw':![],'attributes':['id',_0xc48b('0x3'),_0xc48b('0x4'),_0xc48b('0x5'),_0xc48b('0x6'),_0xc48b('0x7')],'include':[{'model':_0xc48b('0x8'),'as':'Configurations','attributes':['id',_0xc48b('0x3')],'include':[{'model':'Tag','attributes':['id',_0xc48b('0x3')]},{'model':_0xc48b('0x9'),'as':'Subjects','attributes':['id',_0xc48b('0xa'),'content',_0xc48b('0xb')],'include':[{'model':_0xc48b('0xc'),'as':'Variable','attributes':['id',_0xc48b('0x3')]}]},{'model':_0xc48b('0x9'),'as':_0xc48b('0xd'),'attributes':['id',_0xc48b('0xa'),_0xc48b('0xe'),_0xc48b('0xf'),_0xc48b('0x10'),_0xc48b('0x11'),_0xc48b('0xb')],'include':[{'model':_0xc48b('0xc'),'as':_0xc48b('0xc'),'attributes':['id',_0xc48b('0x3')]}]},{'model':'FreshdeskField','as':_0xc48b('0x12'),'attributes':['id',_0xc48b('0xa'),_0xc48b('0xe'),'idField',_0xc48b('0x13'),_0xc48b('0x14'),_0xc48b('0xb')],'include':[{'model':_0xc48b('0xc'),'as':_0xc48b('0xc'),'attributes':['id',_0xc48b('0x3')]}]}]}]},'log':_0xc48b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index cc7c700..dbc55db 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4873=['getFreshsalesAccounts','GetFreshsalesAccount','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','name','FreshsalesField','Subjects','content','variableName','Variable','Descriptions','key','../../client'];(function(_0x519958,_0x8db673){var _0x39de83=function(_0x331383){while(--_0x331383){_0x519958['push'](_0x519958['shift']());}};_0x39de83(++_0x8db673);}(_0x4873,0x1df));var _0x3487=function(_0x382d96,_0x3ba1ce){_0x382d96=_0x382d96-0x0;var _0x20a5a3=_0x4873[_0x382d96];return _0x20a5a3;};'use strict';var client=require(_0x3487('0x0'));exports[_0x3487('0x1')]=function(){return function(_0x332e18){return client['Request'](_0x3487('0x2'),{'options':{'raw':![],'attributes':['id','name','username',_0x3487('0x3'),_0x3487('0x4'),_0x3487('0x5')],'include':[{'model':_0x3487('0x6'),'as':_0x3487('0x7'),'attributes':['id',_0x3487('0x8')],'include':[{'model':_0x3487('0x9'),'as':_0x3487('0xa'),'attributes':['id','type',_0x3487('0xb'),_0x3487('0xc')],'include':[{'model':_0x3487('0xd'),'as':_0x3487('0xd'),'attributes':['id',_0x3487('0x8')]}]},{'model':'FreshsalesField','as':_0x3487('0xe'),'attributes':['id','type',_0x3487('0xb'),_0x3487('0xf'),'keyType','keyContent',_0x3487('0xc')],'include':[{'model':_0x3487('0xd'),'as':'Variable','attributes':['id',_0x3487('0x8')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0xb091=['Subjects','content','variableName','Variable','Descriptions','type','key','keyType','GetFreshsalesccount','getFreshsalesAccounts','Request','GetFreshsalesAccount','username','serverUrl','FreshsalesConfiguration','name','FreshsalesField'];(function(_0x43f643,_0x6acb80){var _0x275246=function(_0x3d5d1a){while(--_0x3d5d1a){_0x43f643['push'](_0x43f643['shift']());}};_0x275246(++_0x6acb80);}(_0xb091,0x16e));var _0x1b09=function(_0x1bea3f,_0x5c4490){_0x1bea3f=_0x1bea3f-0x0;var _0x4f8265=_0xb091[_0x1bea3f];return _0x4f8265;};'use strict';var client=require('../../client');exports[_0x1b09('0x0')]=function(){return function(_0x12cc7c){return client[_0x1b09('0x1')](_0x1b09('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x1b09('0x3'),'apiKey','remoteUri',_0x1b09('0x4')],'include':[{'model':_0x1b09('0x5'),'as':'Configurations','attributes':['id',_0x1b09('0x6')],'include':[{'model':_0x1b09('0x7'),'as':_0x1b09('0x8'),'attributes':['id','type',_0x1b09('0x9'),_0x1b09('0xa')],'include':[{'model':_0x1b09('0xb'),'as':_0x1b09('0xb'),'attributes':['id',_0x1b09('0x6')]}]},{'model':_0x1b09('0x7'),'as':_0x1b09('0xc'),'attributes':['id',_0x1b09('0xd'),_0x1b09('0x9'),_0x1b09('0xe'),_0x1b09('0xf'),'keyContent',_0x1b09('0xa')],'include':[{'model':_0x1b09('0xb'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x1b09('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index b128ac9..bbdbff9 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3149=['additionalSearchLead','SalesforceField','Variable','Descriptions','Fields','../../client','Request','GetSalesforceAccount','name','password','remoteUri','clientId','clientSecret','securityToken','type','SalesforceConfiguration','Configurations','moduleSearch','ticketType','additionalSearchAccount'];(function(_0x37522d,_0x1c637c){var _0x48075f=function(_0x5eeb0){while(--_0x5eeb0){_0x37522d['push'](_0x37522d['shift']());}};_0x48075f(++_0x1c637c);}(_0x3149,0x181));var _0x9314=function(_0x3df299,_0x1a02c3){_0x3df299=_0x3df299-0x0;var _0x5106d8=_0x3149[_0x3df299];return _0x5106d8;};'use strict';var client=require(_0x9314('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x905bad){return client[_0x9314('0x1')](_0x9314('0x2'),{'options':{'raw':![],'attributes':['id',_0x9314('0x3'),'username',_0x9314('0x4'),_0x9314('0x5'),_0x9314('0x6'),_0x9314('0x7'),_0x9314('0x8'),'serverUrl',_0x9314('0x9')],'include':[{'model':_0x9314('0xa'),'as':_0x9314('0xb'),'attributes':['id',_0x9314('0x3'),_0x9314('0xc'),'moduleCreate',_0x9314('0xd'),'leadId',_0x9314('0xe'),'additionalSearchContact',_0x9314('0xf')],'include':[{'model':_0x9314('0x10'),'as':'Subjects','include':[{'model':_0x9314('0x11'),'as':'Variable','attributes':['id',_0x9314('0x3')]}]},{'model':_0x9314('0x10'),'as':_0x9314('0x12'),'include':[{'model':'Variable','as':_0x9314('0x11'),'attributes':['id',_0x9314('0x3')]}]},{'model':_0x9314('0x10'),'as':_0x9314('0x13'),'include':[{'model':_0x9314('0x11'),'as':_0x9314('0x11'),'attributes':['id',_0x9314('0x3')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0x1af1=['additionalSearchAccount','additionalSearchContact','additionalSearchLead','Subjects','Variable','SalesforceField','Descriptions','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','securityToken','type','moduleCreate','leadId'];(function(_0x11d3b1,_0x3b55c5){var _0x2055da=function(_0x2b5da0){while(--_0x2b5da0){_0x11d3b1['push'](_0x11d3b1['shift']());}};_0x2055da(++_0x3b55c5);}(_0x1af1,0x133));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x11af('0x0'));exports[_0x11af('0x1')]=function(){return function(_0x32dd8e){return client[_0x11af('0x2')](_0x11af('0x3'),{'options':{'raw':![],'attributes':['id',_0x11af('0x4'),_0x11af('0x5'),_0x11af('0x6'),_0x11af('0x7'),_0x11af('0x8'),'clientSecret',_0x11af('0x9'),'serverUrl',_0x11af('0xa')],'include':[{'model':'SalesforceConfiguration','as':'Configurations','attributes':['id',_0x11af('0x4'),'moduleSearch',_0x11af('0xb'),'ticketType',_0x11af('0xc'),_0x11af('0xd'),_0x11af('0xe'),_0x11af('0xf')],'include':[{'model':'SalesforceField','as':_0x11af('0x10'),'include':[{'model':_0x11af('0x11'),'as':_0x11af('0x11'),'attributes':['id',_0x11af('0x4')]}]},{'model':_0x11af('0x12'),'as':_0x11af('0x13'),'include':[{'model':_0x11af('0x11'),'as':_0x11af('0x11'),'attributes':['id',_0x11af('0x4')]}]},{'model':_0x11af('0x12'),'as':'Fields','include':[{'model':_0x11af('0x11'),'as':_0x11af('0x11'),'attributes':['id',_0x11af('0x4')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 963bada..e3299dd 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','Request','GetServicenowAccount'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x524e,0x15e));var _0xe524=function(_0x1bc173,_0x18de49){_0x1bc173=_0x1bc173-0x0;var _0x7d18bd=_0x524e[_0x1bc173];return _0x7d18bd;};'use strict';var client=require('../../client');exports['getServicenowAccounts']=function(){return function(_0x353d8a){return client[_0xe524('0x0')](_0xe524('0x1'),{'options':{'raw':![],'attributes':['id',_0xe524('0x2'),_0xe524('0x3'),_0xe524('0x4'),_0xe524('0x5'),_0xe524('0x6'),_0xe524('0x7'),_0xe524('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0xe524('0x9'),'attributes':['id',_0xe524('0x2')],'include':[{'model':_0xe524('0xa'),'as':'Subjects','attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]},{'model':_0xe524('0xa'),'as':_0xe524('0xf'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x10'),_0xe524('0x11'),_0xe524('0x12'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id','name']}]},{'model':'ServicenowField','as':_0xe524('0x13'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x14'),_0xe524('0x15'),'customField',_0xe524('0xd')],'include':[{'model':'Variable','as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0x814b=['variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','GetServicenowAccount','name','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','ServicenowField','type','content'];(function(_0x260757,_0x3e9949){var _0x5284dc=function(_0x333fbe){while(--_0x333fbe){_0x260757['push'](_0x260757['shift']());}};_0x5284dc(++_0x3e9949);}(_0x814b,0x1a2));var _0xb814=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x814b[_0x14e27a];return _0x288688;};'use strict';var client=require(_0xb814('0x0'));exports[_0xb814('0x1')]=function(){return function(_0x434f30){return client[_0xb814('0x2')](_0xb814('0x3'),{'options':{'raw':![],'attributes':['id',_0xb814('0x4'),'description',_0xb814('0x5'),_0xb814('0x6'),_0xb814('0x7'),_0xb814('0x8'),_0xb814('0x9')],'include':[{'model':_0xb814('0xa'),'as':'Configurations','attributes':['id',_0xb814('0x4')],'include':[{'model':_0xb814('0xb'),'as':'Subjects','attributes':['id',_0xb814('0xc'),_0xb814('0xd'),_0xb814('0xe')],'include':[{'model':_0xb814('0xf'),'as':_0xb814('0xf'),'attributes':['id',_0xb814('0x4')]}]},{'model':_0xb814('0xb'),'as':_0xb814('0x10'),'attributes':['id',_0xb814('0xc'),_0xb814('0xd'),_0xb814('0x11'),'keyType',_0xb814('0x12'),'variableName'],'include':[{'model':_0xb814('0xf'),'as':_0xb814('0xf'),'attributes':['id',_0xb814('0x4')]}]},{'model':_0xb814('0xb'),'as':_0xb814('0x13'),'attributes':['id',_0xb814('0xc'),_0xb814('0xd'),_0xb814('0x14'),_0xb814('0x15'),_0xb814('0x16'),_0xb814('0xe')],'include':[{'model':_0xb814('0xf'),'as':_0xb814('0xf'),'attributes':['id',_0xb814('0x4')]}]}]}]},'log':_0xb814('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index ae01b98..a16c466 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['idField','nameField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','serverUrl','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyContent','Fields'];(function(_0x44330c,_0x22f9b5){var _0x5b3cd9=function(_0x3fa058){while(--_0x3fa058){_0x44330c['push'](_0x44330c['shift']());}};_0x5b3cd9(++_0x22f9b5);}(_0xadb5,0xad));var _0x5adb=function(_0x2d185c,_0x5667a2){_0x2d185c=_0x2d185c-0x0;var _0x49e1ca=_0xadb5[_0x2d185c];return _0x49e1ca;};'use strict';var client=require('../../client');exports[_0x5adb('0x0')]=function(){return function(_0x49fc17){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x3'),'username',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x5adb('0x7'),'attributes':['id',_0x5adb('0x3')],'include':[{'model':_0x5adb('0x8'),'as':_0x5adb('0x9'),'attributes':['id',_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':_0x5adb('0xd'),'attributes':['id',_0x5adb('0x3')]}]},{'model':_0x5adb('0x8'),'as':_0x5adb('0xe'),'attributes':['id',_0x5adb('0xa'),_0x5adb('0xb'),'key','keyType',_0x5adb('0xf'),_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':'Variable','attributes':['id',_0x5adb('0x3')]}]},{'model':'SugarcrmField','as':_0x5adb('0x10'),'attributes':['id','type',_0x5adb('0xb'),_0x5adb('0x11'),_0x5adb('0x12'),'customField',_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':_0x5adb('0xd'),'attributes':['id','name']}]}]}]},'log':_0x5adb('0x2')});};}; \ No newline at end of file +var _0x0295=['remoteUri','serverUrl','SugarcrmConfiguration','Configurations','name','SugarcrmField','Subjects','Variable','Descriptions','content','key','keyType','variableName','Fields','customField','GetSugarcrmAccount','../../client','Request','username','password'];(function(_0x10a2d3,_0x47c606){var _0x206a62=function(_0x368c7a){while(--_0x368c7a){_0x10a2d3['push'](_0x10a2d3['shift']());}};_0x206a62(++_0x47c606);}(_0x0295,0x1f0));var _0x5029=function(_0x1cfda3,_0x32e81){_0x1cfda3=_0x1cfda3-0x0;var _0x45a82f=_0x0295[_0x1cfda3];return _0x45a82f;};'use strict';var client=require(_0x5029('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0x5e71d0){return client[_0x5029('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id','name',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5')],'include':[{'model':_0x5029('0x6'),'as':_0x5029('0x7'),'attributes':['id',_0x5029('0x8')],'include':[{'model':_0x5029('0x9'),'as':_0x5029('0xa'),'attributes':['id','type','content','variableName'],'include':[{'model':_0x5029('0xb'),'as':'Variable','attributes':['id',_0x5029('0x8')]}]},{'model':'SugarcrmField','as':_0x5029('0xc'),'attributes':['id','type',_0x5029('0xd'),_0x5029('0xe'),_0x5029('0xf'),'keyContent',_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id','name']}]},{'model':_0x5029('0x9'),'as':_0x5029('0x11'),'attributes':['id','type','content','idField','nameField',_0x5029('0x12'),_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id',_0x5029('0x8')]}]}]}]},'log':_0x5029('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 49434ca..f7b60a0 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c62=['Subjects','type','variableName','Variable','Descriptions','content','keyType','keyContent','Fields','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2c62,0x196));var _0x22c6=function(_0x125414,_0x440af9){_0x125414=_0x125414-0x0;var _0x2dfd84=_0x2c62[_0x125414];return _0x2dfd84;};'use strict';var client=require(_0x22c6('0x0'));exports[_0x22c6('0x1')]=function(){return function(_0x30288a){return client[_0x22c6('0x2')](_0x22c6('0x3'),{'options':{'raw':![],'attributes':['id',_0x22c6('0x4'),_0x22c6('0x5'),_0x22c6('0x6'),'accessKey',_0x22c6('0x7'),_0x22c6('0x8')],'include':[{'model':_0x22c6('0x9'),'as':_0x22c6('0xa'),'attributes':['id','name'],'include':[{'model':_0x22c6('0xb'),'as':_0x22c6('0xc'),'attributes':['id',_0x22c6('0xd'),'content',_0x22c6('0xe')],'include':[{'model':_0x22c6('0xf'),'as':_0x22c6('0xf'),'attributes':['id',_0x22c6('0x4')]}]},{'model':_0x22c6('0xb'),'as':_0x22c6('0x10'),'attributes':['id',_0x22c6('0xd'),_0x22c6('0x11'),'key',_0x22c6('0x12'),_0x22c6('0x13'),_0x22c6('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x22c6('0xb'),'as':_0x22c6('0x14'),'attributes':['id','type',_0x22c6('0x11'),'idField','nameField',_0x22c6('0x15'),_0x22c6('0xe')],'include':[{'model':_0x22c6('0xf'),'as':_0x22c6('0xf'),'attributes':['id',_0x22c6('0x4')]}]}]}]},'log':_0x22c6('0x3')});};}; \ No newline at end of file +var _0x8f7f=['getVtigerAccounts','Request','name','description','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','variableName','Variable','Descriptions','content','key','keyContent','Fields','idField','GetVtigerAccount'];(function(_0x5e8b4f,_0x2486e2){var _0x59a5a1=function(_0x2407ab){while(--_0x2407ab){_0x5e8b4f['push'](_0x5e8b4f['shift']());}};_0x59a5a1(++_0x2486e2);}(_0x8f7f,0x1b8));var _0xf8f7=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x8f7f[_0x474bc0];return _0x4b24cf;};'use strict';var client=require('../../client');exports[_0xf8f7('0x0')]=function(){return function(_0x6f77f5){return client[_0xf8f7('0x1')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0xf8f7('0x2'),_0xf8f7('0x3'),_0xf8f7('0x4'),_0xf8f7('0x5'),_0xf8f7('0x6'),_0xf8f7('0x7')],'include':[{'model':_0xf8f7('0x8'),'as':_0xf8f7('0x9'),'attributes':['id',_0xf8f7('0x2')],'include':[{'model':_0xf8f7('0xa'),'as':_0xf8f7('0xb'),'attributes':['id',_0xf8f7('0xc'),'content',_0xf8f7('0xd')],'include':[{'model':_0xf8f7('0xe'),'as':_0xf8f7('0xe'),'attributes':['id',_0xf8f7('0x2')]}]},{'model':'VtigerField','as':_0xf8f7('0xf'),'attributes':['id',_0xf8f7('0xc'),_0xf8f7('0x10'),_0xf8f7('0x11'),'keyType',_0xf8f7('0x12'),_0xf8f7('0xd')],'include':[{'model':_0xf8f7('0xe'),'as':_0xf8f7('0xe'),'attributes':['id',_0xf8f7('0x2')]}]},{'model':_0xf8f7('0xa'),'as':_0xf8f7('0x13'),'attributes':['id','type',_0xf8f7('0x10'),_0xf8f7('0x14'),'nameField','customField',_0xf8f7('0xd')],'include':[{'model':_0xf8f7('0xe'),'as':'Variable','attributes':['id',_0xf8f7('0x2')]}]}]}]},'log':_0xf8f7('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 4eb3e3d..fde8a6d 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4649=['ZendeskConfiguration','ZendeskField','Subjects','content','variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','password','serverUrl','type'];(function(_0x200941,_0x83e581){var _0x15d44b=function(_0x59d0d1){while(--_0x59d0d1){_0x200941['push'](_0x200941['shift']());}};_0x15d44b(++_0x83e581);}(_0x4649,0x1af));var _0x9464=function(_0x20c465,_0x5d9a01){_0x20c465=_0x20c465-0x0;var _0x40b121=_0x4649[_0x20c465];return _0x40b121;};'use strict';var client=require(_0x9464('0x0'));exports[_0x9464('0x1')]=function(){return function(_0x46e743){return client[_0x9464('0x2')](_0x9464('0x3'),{'options':{'raw':![],'attributes':['id',_0x9464('0x4'),_0x9464('0x5'),_0x9464('0x6'),'token','remoteUri','authType',_0x9464('0x7'),_0x9464('0x8')],'include':[{'model':_0x9464('0x9'),'as':'Configurations','attributes':['id',_0x9464('0x4')],'include':[{'model':'Tag','attributes':['id',_0x9464('0x4')]},{'model':_0x9464('0xa'),'as':_0x9464('0xb'),'attributes':['id',_0x9464('0x8'),_0x9464('0xc'),_0x9464('0xd')],'include':[{'model':_0x9464('0xe'),'as':_0x9464('0xe'),'attributes':['id',_0x9464('0x4')]}]},{'model':_0x9464('0xa'),'as':_0x9464('0xf'),'attributes':['id',_0x9464('0x8'),_0x9464('0xc'),_0x9464('0x10'),'keyType',_0x9464('0x11'),_0x9464('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x9464('0x4')]}]},{'model':_0x9464('0xa'),'as':_0x9464('0x12'),'attributes':['id',_0x9464('0x8'),_0x9464('0xc'),_0x9464('0x13'),_0x9464('0x14'),_0x9464('0x15'),_0x9464('0xd')],'include':[{'model':_0x9464('0xe'),'as':_0x9464('0xe'),'attributes':['id',_0x9464('0x4')]}]}]}]},'log':_0x9464('0x3')});};}; \ No newline at end of file +var _0xade1=['Tag','ZendeskField','content','variableName','Descriptions','key','keyType','keyContent','Variable','idField','nameField','../../client','Request','GetZendeskAccount','name','username','password','token','remoteUri','authType','serverUrl','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xade1,0x1c3));var _0x1ade=function(_0x112e80,_0x34a741){_0x112e80=_0x112e80-0x0;var _0x33a307=_0xade1[_0x112e80];return _0x33a307;};'use strict';var client=require(_0x1ade('0x0'));exports['getZendeskAccounts']=function(){return function(_0x5fdded){return client[_0x1ade('0x1')](_0x1ade('0x2'),{'options':{'raw':![],'attributes':['id',_0x1ade('0x3'),_0x1ade('0x4'),_0x1ade('0x5'),_0x1ade('0x6'),_0x1ade('0x7'),_0x1ade('0x8'),_0x1ade('0x9'),_0x1ade('0xa')],'include':[{'model':'ZendeskConfiguration','as':'Configurations','attributes':['id',_0x1ade('0x3')],'include':[{'model':_0x1ade('0xb'),'attributes':['id',_0x1ade('0x3')]},{'model':_0x1ade('0xc'),'as':'Subjects','attributes':['id','type',_0x1ade('0xd'),_0x1ade('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x1ade('0x3')]}]},{'model':_0x1ade('0xc'),'as':_0x1ade('0xf'),'attributes':['id',_0x1ade('0xa'),_0x1ade('0xd'),_0x1ade('0x10'),_0x1ade('0x11'),_0x1ade('0x12'),_0x1ade('0xe')],'include':[{'model':_0x1ade('0x13'),'as':'Variable','attributes':['id',_0x1ade('0x3')]}]},{'model':_0x1ade('0xc'),'as':'Fields','attributes':['id','type','content',_0x1ade('0x14'),_0x1ade('0x15'),'customField',_0x1ade('0xe')],'include':[{'model':_0x1ade('0x13'),'as':_0x1ade('0x13'),'attributes':['id',_0x1ade('0x3')]}]}]}]},'log':_0x1ade('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 93438fd..b7560cb 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd788=['variableName','Variable','name','ZohoField','Descriptions','key','keyType','keyContent','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','description','host','clientSecret','code','refreshToken','ZohoConfiguration','Configurations','moduleSearch','Subjects','type','content'];(function(_0x3fbeea,_0x59b594){var _0x479753=function(_0x2d874d){while(--_0x2d874d){_0x3fbeea['push'](_0x3fbeea['shift']());}};_0x479753(++_0x59b594);}(_0xd788,0xa7));var _0x8d78=function(_0x265ff2,_0x183632){_0x265ff2=_0x265ff2-0x0;var _0x3d723f=_0xd788[_0x265ff2];return _0x3d723f;};'use strict';var client=require(_0x8d78('0x0'));exports[_0x8d78('0x1')]=function(){return function(_0x423ff1){return client[_0x8d78('0x2')](_0x8d78('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8d78('0x4'),_0x8d78('0x5'),'zone','clientId',_0x8d78('0x6'),'serverUrl',_0x8d78('0x7'),_0x8d78('0x8')],'include':[{'model':_0x8d78('0x9'),'as':_0x8d78('0xa'),'attributes':['id','name','moduleCreate',_0x8d78('0xb'),_0x8d78('0x4')],'include':[{'model':'ZohoField','as':_0x8d78('0xc'),'attributes':['id',_0x8d78('0xd'),_0x8d78('0xe'),_0x8d78('0xf')],'include':[{'model':_0x8d78('0x10'),'as':'Variable','attributes':['id',_0x8d78('0x11')]}]},{'model':_0x8d78('0x12'),'as':_0x8d78('0x13'),'attributes':['id',_0x8d78('0xd'),_0x8d78('0xe'),_0x8d78('0x14'),_0x8d78('0x15'),_0x8d78('0x16'),_0x8d78('0xf')],'include':[{'model':'Variable','as':_0x8d78('0x10'),'attributes':['id','name']}]},{'model':_0x8d78('0x12'),'as':'Fields','attributes':['id',_0x8d78('0xd'),_0x8d78('0xe'),_0x8d78('0x17'),_0x8d78('0x18'),_0x8d78('0x19'),_0x8d78('0xf')],'include':[{'model':_0x8d78('0x10'),'as':_0x8d78('0x10'),'attributes':['id',_0x8d78('0x11')]}]}]}]},'log':_0x8d78('0x3')});};}; \ No newline at end of file +var _0xe47c=['type','idField','nameField','customField','GetZohoAccount','../../client','getZohoAccounts','name','description','host','clientId','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','content','variableName','Variable','Descriptions','keyType','Fields'];(function(_0x53efe5,_0x580c4c){var _0x2c6ef2=function(_0x60cb41){while(--_0x60cb41){_0x53efe5['push'](_0x53efe5['shift']());}};_0x2c6ef2(++_0x580c4c);}(_0xe47c,0xef));var _0xce47=function(_0x358045,_0x1824a9){_0x358045=_0x358045-0x0;var _0x43a2f6=_0xe47c[_0x358045];return _0x43a2f6;};'use strict';var client=require(_0xce47('0x0'));exports[_0xce47('0x1')]=function(){return function(_0x48ca68){return client['Request']('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xce47('0x2'),_0xce47('0x3'),_0xce47('0x4'),'zone',_0xce47('0x5'),'clientSecret',_0xce47('0x6'),_0xce47('0x7'),_0xce47('0x8')],'include':[{'model':_0xce47('0x9'),'as':_0xce47('0xa'),'attributes':['id',_0xce47('0x2'),_0xce47('0xb'),_0xce47('0xc'),_0xce47('0x3')],'include':[{'model':_0xce47('0xd'),'as':_0xce47('0xe'),'attributes':['id','type',_0xce47('0xf'),_0xce47('0x10')],'include':[{'model':_0xce47('0x11'),'as':_0xce47('0x11'),'attributes':['id',_0xce47('0x2')]}]},{'model':_0xce47('0xd'),'as':_0xce47('0x12'),'attributes':['id','type',_0xce47('0xf'),'key',_0xce47('0x13'),'keyContent',_0xce47('0x10')],'include':[{'model':_0xce47('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xce47('0xd'),'as':_0xce47('0x14'),'attributes':['id',_0xce47('0x15'),_0xce47('0xf'),_0xce47('0x16'),_0xce47('0x17'),_0xce47('0x18'),_0xce47('0x10')],'include':[{'model':_0xce47('0x11'),'as':_0xce47('0x11'),'attributes':['id',_0xce47('0x2')]}]}]}]},'log':_0xce47('0x19')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 01501dd..08ed19f 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe505=['intervalIftime','../../../config/logger','dialer','stack','silly','intervalIftime\x20called\x20with','isArray','length','every','number','map','interval','concat','Request','IntervalIftime'];(function(_0x501e72,_0x4301a3){var _0x3bf720=function(_0x2ef3fa){while(--_0x2ef3fa){_0x501e72['push'](_0x501e72['shift']());}};_0x3bf720(++_0x4301a3);}(_0xe505,0xf1));var _0x5e50=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xe505[_0x334599];return _0x4cdff2;};var logger=require(_0x5e50('0x0'))(_0x5e50('0x1'));var client=require('../client');function intervalIftime(_0x2a73ce,_0x37ffb9){const _0x28ef0b=new Error()[_0x5e50('0x2')]['replace'](/^Error/,'')['trim']();logger[_0x5e50('0x3')](_0x5e50('0x4'),_0x2a73ce,_0x37ffb9,_0x28ef0b);const _0x58d931=Array[_0x5e50('0x5')](_0x2a73ce);if(!_0x2a73ce||_0x58d931&&_0x2a73ce[_0x5e50('0x6')]===0x0){return Promise['resolve'](![]);}else{var _0x338c8b=[];var _0x454d28=[];var _0x18cb3d=_0x58d931?_0x2a73ce:[_0x2a73ce];var _0x53e077=_0x18cb3d[_0x5e50('0x7')](function(_0x3ac052){return typeof _0x3ac052===_0x5e50('0x8');});var _0x53a187=_0x18cb3d[_0x5e50('0x7')](function(_0x16db91){return typeof _0x16db91==='string';});if(!_0x53e077&&!_0x53a187){_0x338c8b=_0x18cb3d[_0x5e50('0x9')](function(_0x179482){return _0x179482['id'];});if(_0x338c8b[_0x5e50('0x6')]===0x0){_0x454d28=_0x18cb3d[_0x5e50('0x9')](function(_0x40455c){return _0x40455c[_0x5e50('0xa')];});}}else{if(_0x53e077){_0x338c8b=_0x338c8b[_0x5e50('0xb')](_0x18cb3d);}if(_0x53a187){_0x454d28=_0x454d28[_0x5e50('0xb')](_0x18cb3d);}}return client[_0x5e50('0xc')](_0x5e50('0xd'),{'intervalIds':_0x338c8b,'intervals':_0x454d28,'timezone':_0x37ffb9,'log':_0x5e50('0xd')});}}exports[_0x5e50('0xe')]=intervalIftime; \ No newline at end of file +var _0xfaa1=['intervalIftime\x20called\x20with','isArray','length','number','every','string','map','interval','concat','Request','IntervalIftime','dialer','stack','replace','trim','silly'];(function(_0x59b3b2,_0x221407){var _0x24e053=function(_0x36fdc4){while(--_0x36fdc4){_0x59b3b2['push'](_0x59b3b2['shift']());}};_0x24e053(++_0x221407);}(_0xfaa1,0x7b));var _0x1faa=function(_0x29d740,_0x2ba4a8){_0x29d740=_0x29d740-0x0;var _0x196059=_0xfaa1[_0x29d740];return _0x196059;};var logger=require('../../../config/logger')(_0x1faa('0x0'));var client=require('../client');function intervalIftime(_0x3bc9a4,_0x3e3d27){const _0xbedc04=new Error()[_0x1faa('0x1')][_0x1faa('0x2')](/^Error/,'')[_0x1faa('0x3')]();logger[_0x1faa('0x4')](_0x1faa('0x5'),_0x3bc9a4,_0x3e3d27,_0xbedc04);const _0x1ac3e4=Array[_0x1faa('0x6')](_0x3bc9a4);if(!_0x3bc9a4||_0x1ac3e4&&_0x3bc9a4[_0x1faa('0x7')]===0x0){return Promise['resolve'](![]);}else{var _0x3e8b8d=[];var _0x267fa9=[];var _0x1eb33b=_0x1ac3e4?_0x3bc9a4:[_0x3bc9a4];var _0x4a7ea8=_0x1eb33b['every'](function(_0x2ba270){return typeof _0x2ba270===_0x1faa('0x8');});var _0x331981=_0x1eb33b[_0x1faa('0x9')](function(_0x534ae7){return typeof _0x534ae7===_0x1faa('0xa');});if(!_0x4a7ea8&&!_0x331981){_0x3e8b8d=_0x1eb33b[_0x1faa('0xb')](function(_0x14ed64){return _0x14ed64['id'];});if(_0x3e8b8d[_0x1faa('0x7')]===0x0){_0x267fa9=_0x1eb33b[_0x1faa('0xb')](function(_0x355512){return _0x355512[_0x1faa('0xc')];});}}else{if(_0x4a7ea8){_0x3e8b8d=_0x3e8b8d[_0x1faa('0xd')](_0x1eb33b);}if(_0x331981){_0x267fa9=_0x267fa9[_0x1faa('0xd')](_0x1eb33b);}}return client[_0x1faa('0xe')](_0x1faa('0xf'),{'intervalIds':_0x3e8b8d,'intervals':_0x267fa9,'timezone':_0x3e3d27,'log':_0x1faa('0xf')});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index eab80ed..1ac2b7f 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x432b=['lodash','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','toNumber','accountcode','membername','TALKING','starttime','endtime','outbound','dialstring','agent','uniqueid','moment'];(function(_0x38323b,_0x5f79df){var _0x2b9af5=function(_0x576caa){while(--_0x576caa){_0x38323b['push'](_0x38323b['shift']());}};_0x2b9af5(++_0x5f79df);}(_0x432b,0x8b));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb432('0x0'));var _=require(_0xb432('0x1'));var util=require('util');var client=require('../client');exports[_0xb432('0x2')]=function(_0xc5239b){var _0xae743f=_0xc5239b[_0xb432('0x3')]||_0xc5239b['queuecallerexitAt'];return client[_0xb432('0x4')](_0xb432('0x5'),{'body':{'channel':_0xb432('0x6'),'membername':_0xc5239b['lastAssignedTo'],'interface':_[_0xb432('0x7')](_0xc5239b[_0xb432('0x8')])?util[_0xb432('0x9')](_0xb432('0xa'),_0xc5239b[_0xb432('0xb')]):_0xc5239b[_0xb432('0x8')],'type':'TALKING','enterAt':_0xc5239b[_0xb432('0xc')],'exitAt':_0xae743f,'duration':moment(_0xae743f)[_0xb432('0xd')](_0xc5239b[_0xb432('0xc')],'seconds'),'data1':_0xb432('0xe'),'data2':_0xc5239b[_0xb432('0xf')],'data3':_0xc5239b[_0xb432('0x10')],'data4':null,'data5':_0xc5239b[_0xb432('0x11')],'role':'agent','internal':_0xc5239b['accountcode']?_[_0xb432('0x12')](_0xc5239b[_0xb432('0x13')]):undefined,'uniqueid':_0xc5239b['uniqueid']},'log':_0xb432('0x5')});};exports['voiceDialReport']=function(_0xd9525e){return client[_0xb432('0x4')](_0xb432('0x5'),{'body':{'channel':_0xb432('0x6'),'membername':_0xd9525e[_0xb432('0x14')],'interface':_0xd9525e[_0xb432('0x8')],'type':_0xb432('0x15'),'enterAt':_0xd9525e[_0xb432('0x16')],'exitAt':_0xd9525e['endtime'],'duration':moment(_0xd9525e[_0xb432('0x17')])[_0xb432('0xd')](_0xd9525e[_0xb432('0x16')],'seconds')>=0x0?moment(_0xd9525e['endtime'])['diff'](_0xd9525e[_0xb432('0x16')],'seconds'):null,'data1':_0xb432('0x18'),'data2':_0xd9525e[_0xb432('0x13')],'data3':_0xd9525e[_0xb432('0x10')],'data4':_0xd9525e[_0xb432('0x19')]||null,'role':_0xb432('0x1a'),'internal':_0xd9525e[_0xb432('0x13')]?_['toNumber'](_0xd9525e[_0xb432('0x13')]):undefined,'uniqueid':_0xd9525e[_0xb432('0x1b')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x9dff=['Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','moment','util','queuecallercompleteAt','queuecallerexitAt'];(function(_0x2a74f5,_0x542b0b){var _0x358258=function(_0x52e19e){while(--_0x52e19e){_0x2a74f5['push'](_0x2a74f5['shift']());}};_0x358258(++_0x542b0b);}(_0x9dff,0xef));var _0xf9df=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9dff[_0x565c49];return _0x20ca34;};'use strict';var moment=require(_0xf9df('0x0'));var _=require('lodash');var util=require(_0xf9df('0x1'));var client=require('../client');exports['voiceQueueReport']=function(_0x4a356f){var _0x1fcd9c=_0x4a356f[_0xf9df('0x2')]||_0x4a356f[_0xf9df('0x3')];return client[_0xf9df('0x4')](_0xf9df('0x5'),{'body':{'channel':_0xf9df('0x6'),'membername':_0x4a356f[_0xf9df('0x7')],'interface':_[_0xf9df('0x8')](_0x4a356f[_0xf9df('0x9')])?util[_0xf9df('0xa')](_0xf9df('0xb'),_0x4a356f['lastAssignedTo']):_0x4a356f['interface'],'type':_0xf9df('0xc'),'enterAt':_0x4a356f['queuecallerleaveAt'],'exitAt':_0x1fcd9c,'duration':moment(_0x1fcd9c)[_0xf9df('0xd')](_0x4a356f['queuecallerleaveAt'],_0xf9df('0xe')),'data1':'inbound','data2':_0x4a356f[_0xf9df('0xf')],'data3':_0x4a356f[_0xf9df('0x10')],'data4':null,'data5':_0x4a356f[_0xf9df('0x11')],'role':_0xf9df('0x12'),'internal':_0x4a356f[_0xf9df('0x13')]?_[_0xf9df('0x14')](_0x4a356f[_0xf9df('0x13')]):undefined,'uniqueid':_0x4a356f[_0xf9df('0x15')]},'log':_0xf9df('0x5')});};exports[_0xf9df('0x16')]=function(_0x4adc3e){return client['Request'](_0xf9df('0x5'),{'body':{'channel':_0xf9df('0x6'),'membername':_0x4adc3e[_0xf9df('0x17')],'interface':_0x4adc3e[_0xf9df('0x9')],'type':_0xf9df('0xc'),'enterAt':_0x4adc3e[_0xf9df('0x18')],'exitAt':_0x4adc3e['endtime'],'duration':moment(_0x4adc3e[_0xf9df('0x19')])[_0xf9df('0xd')](_0x4adc3e['starttime'],_0xf9df('0xe'))>=0x0?moment(_0x4adc3e[_0xf9df('0x19')])[_0xf9df('0xd')](_0x4adc3e[_0xf9df('0x18')],_0xf9df('0xe')):null,'data1':_0xf9df('0x1a'),'data2':_0x4adc3e[_0xf9df('0x13')],'data3':_0x4adc3e[_0xf9df('0x10')],'data4':_0x4adc3e['dialstring']||null,'role':'agent','internal':_0x4adc3e[_0xf9df('0x13')]?_[_0xf9df('0x14')](_0x4adc3e['accountcode']):undefined,'uniqueid':_0x4adc3e[_0xf9df('0x15')]},'log':_0xf9df('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 0254ace..924c63c 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 _0xd0a4=['previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xd0a4,0x166));var _0x4d0a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0a4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4d0a('0x0'));exports[_0x4d0a('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x4d0a('0x2')]},'log':_0x4d0a('0x3')});}; \ No newline at end of file +var _0x95af=['getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x95af,0x173));var _0xf95a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x95af[_0x46698a];return _0x356db0;};'use strict';var client=require(_0xf95a('0x0'));exports[_0xf95a('0x1')]=function(){return client['Request'](_0xf95a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf95a('0x3'),_0xf95a('0x4')]},'log':_0xf95a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index e507004..cfba640 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 _0x62ef=['Request','GetTemplate','html','../client','getTemplates'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x62ef,0xd0));var _0xf62e=function(_0x3aa0ac,_0x5f5da6){_0x3aa0ac=_0x3aa0ac-0x0;var _0x568a11=_0x62ef[_0x3aa0ac];return _0x568a11;};'use strict';var client=require(_0xf62e('0x0'));exports[_0xf62e('0x1')]=function(_0x3182ed){return function(_0x5cad8f){return client[_0xf62e('0x2')](_0xf62e('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xf62e('0x4')]},'log':_0xf62e('0x3')});};}; \ No newline at end of file +var _0x72a1=['name','html','getTemplates','GetTemplate'];(function(_0x155a36,_0x4bf39){var _0x3c99d0=function(_0x2ff601){while(--_0x2ff601){_0x155a36['push'](_0x155a36['shift']());}};_0x3c99d0(++_0x4bf39);}(_0x72a1,0x1ce));var _0x172a=function(_0x49bb84,_0x338309){_0x49bb84=_0x49bb84-0x0;var _0x4df92a=_0x72a1[_0x49bb84];return _0x4df92a;};'use strict';var client=require('../client');exports[_0x172a('0x0')]=function(_0x54a5fa){return function(_0x1e3e0a){return client['Request'](_0x172a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x172a('0x2'),_0x172a('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 4b3b073..405b512 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 _0x5945=['getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data6','data7','../client'];(function(_0x1211bd,_0x5171bc){var _0x86d777=function(_0x42d011){while(--_0x42d011){_0x1211bd['push'](_0x1211bd['shift']());}};_0x86d777(++_0x5171bc);}(_0x5945,0xfb));var _0x5594=function(_0x1405c1,_0x532676){_0x1405c1=_0x1405c1-0x0;var _0x59aabc=_0x5945[_0x1405c1];return _0x59aabc;};'use strict';var client=require(_0x5594('0x0'));exports[_0x5594('0x1')]=function(_0x2bc64b){return function(_0x2656c7){return client[_0x5594('0x2')](_0x5594('0x3'),{'options':{'raw':![],'attributes':['id',_0x5594('0x4'),_0x5594('0x5'),'status'],'include':[{'model':_0x5594('0x6'),'as':_0x5594('0x7'),'attributes':['id',_0x5594('0x8'),_0x5594('0x9'),_0x5594('0xa')]},{'model':_0x5594('0x6'),'as':_0x5594('0xb'),'attributes':['id',_0x5594('0x8'),_0x5594('0x9'),'value']},{'model':_0x5594('0xc'),'as':_0x5594('0xd'),'attributes':['id',_0x5594('0xe'),_0x5594('0xf'),_0x5594('0x10'),_0x5594('0x11'),_0x5594('0x12'),'data5',_0x5594('0x13'),_0x5594('0x14')]}]},'log':_0x5594('0x3')});};}; \ No newline at end of file +var _0x8cd9=['data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data3'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x8cd9,0x17d));var _0x98cd=function(_0x5eb348,_0x3cec7a){_0x5eb348=_0x5eb348-0x0;var _0x1d0d25=_0x8cd9[_0x5eb348];return _0x1d0d25;};'use strict';var client=require(_0x98cd('0x0'));exports[_0x98cd('0x1')]=function(_0x2d8bb6){return function(_0x47e697){return client[_0x98cd('0x2')](_0x98cd('0x3'),{'options':{'raw':![],'attributes':['id',_0x98cd('0x4'),_0x98cd('0x5'),_0x98cd('0x6')],'include':[{'model':_0x98cd('0x7'),'as':_0x98cd('0x8'),'attributes':['id',_0x98cd('0x9'),_0x98cd('0xa'),'value']},{'model':_0x98cd('0x7'),'as':_0x98cd('0xb'),'attributes':['id',_0x98cd('0x9'),'operator',_0x98cd('0xc')]},{'model':_0x98cd('0xd'),'as':_0x98cd('0xe'),'attributes':['id',_0x98cd('0xf'),_0x98cd('0x10'),_0x98cd('0x11'),_0x98cd('0x12'),'data4','data5','data6',_0x98cd('0x13')]}]},'log':_0x98cd('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6fab072..c273941 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 _0x1b69=['Request','GetTrunk','name','defaultuser'];(function(_0x3692c4,_0x2af72e){var _0x47b06d=function(_0x1d521f){while(--_0x1d521f){_0x3692c4['push'](_0x3692c4['shift']());}};_0x47b06d(++_0x2af72e);}(_0x1b69,0x1d0));var _0x91b6=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1b69[_0x4a7631];return _0x1a5a6f;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x4dbd62){return function(_0x133e5e){return client[_0x91b6('0x0')](_0x91b6('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x91b6('0x2'),'registry',_0x91b6('0x3')]},'log':_0x91b6('0x1')});};}; \ No newline at end of file +var _0xd943=['defaultuser','../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0x4201bc,_0x277058){var _0x75842f=function(_0x587366){while(--_0x587366){_0x4201bc['push'](_0x4201bc['shift']());}};_0x75842f(++_0x277058);}(_0xd943,0x14a));var _0x3d94=function(_0x186337,_0x4d2cdc){_0x186337=_0x186337-0x0;var _0x2775e6=_0xd943[_0x186337];return _0x2775e6;};'use strict';var client=require(_0x3d94('0x0'));exports[_0x3d94('0x1')]=function(_0x206cef){return function(_0x296678){return client[_0x3d94('0x2')](_0x3d94('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3d94('0x4'),_0x3d94('0x5'),_0x3d94('0x6')]},'log':_0x3d94('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6a12f0b..a30e643 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x3c68d1,_0x6238b2){var _0x620ba9=function(_0x4e3617){while(--_0x4e3617){_0x3c68d1['push'](_0x3c68d1['shift']());}};_0x620ba9(++_0x6238b2);}(_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 +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(_0xf466fc,_0xe6b550){_0xf466fc=_0xf466fc-0x0;var _0x1e6330=_0xe706[_0xf466fc];return _0x1e6330;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b91b959..d4f528b 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 _0x3a08=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x3a08,0x172));var _0x83a0=function(_0x4c8a11,_0x193f3e){_0x4c8a11=_0x4c8a11-0x0;var _0x45c948=_0x3a08[_0x4c8a11];return _0x45c948;};'use strict';var client=require(_0x83a0('0x0'));exports[_0x83a0('0x1')]=function(_0xed1a3a){return client[_0x83a0('0x2')]('CreateVoiceAgentReport',{'body':_0xed1a3a,'log':_0x83a0('0x3')});};exports['update']=function(_0x4bf04b,_0x1b9b43,_0x141c15){return client[_0x83a0('0x2')](_0x83a0('0x4'),{'body':_0x4bf04b,'options':{'where':{'uniqueid':_0x1b9b43,'interface':_0x141c15,'agentcomplete':!![]}},'log':_0x83a0('0x4')});}; \ No newline at end of file +var _0x1181=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x95975a,_0x1802d5){var _0x1aa609=function(_0xa412f4){while(--_0xa412f4){_0x95975a['push'](_0x95975a['shift']());}};_0x1aa609(++_0x1802d5);}(_0x1181,0x169));var _0x1118=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x1181[_0x2b0a86];return _0x955940;};'use strict';var client=require(_0x1118('0x0'));exports[_0x1118('0x1')]=function(_0x224550){return client[_0x1118('0x2')](_0x1118('0x3'),{'body':_0x224550,'log':'CreateVoiceAgentReport'});};exports[_0x1118('0x4')]=function(_0x766447,_0x1823f5,_0x221038){return client[_0x1118('0x2')](_0x1118('0x5'),{'body':_0x766447,'options':{'where':{'uniqueid':_0x1823f5,'interface':_0x221038,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9d009c3..419f3de 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 _0x3e0e=['callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','GetVoiceCallReports','moment','util','../client','create','CreateVoiceCallReport','merge','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e0e,0x14f));var _0xe3e0=function(_0x42453c,_0x5cc5bf){_0x42453c=_0x42453c-0x0;var _0x5b3465=_0x3e0e[_0x42453c];return _0x5b3465;};'use strict';var moment=require(_0xe3e0('0x0'));var util=require(_0xe3e0('0x1'));var _=require('lodash');var client=require(_0xe3e0('0x2'));exports[_0xe3e0('0x3')]=function(_0x230604){return client['Request'](_0xe3e0('0x4'),{'body':_[_0xe3e0('0x5')](_0x230604,{'source':_0x230604[_0xe3e0('0x6')],'destinationcontext':_0x230604['context'],'callerid':_0x230604[_0xe3e0('0x7')],'amaflags':_0xe3e0('0x8')}),'log':_0xe3e0('0x4')});};exports[_0xe3e0('0x9')]=function(){return function(){return client[_0xe3e0('0xa')](_0xe3e0('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0xe3e0('0xc'))[_0xe3e0('0xd')](_0xe3e0('0xe')),moment()[_0xe3e0('0xf')](_0xe3e0('0xc'))[_0xe3e0('0xd')](_0xe3e0('0xe'))]}},'attributes':['type',_0xe3e0('0x10'),_0xe3e0('0x11'),'billableseconds']},'log':_0xe3e0('0x12')});};}; \ No newline at end of file +var _0x6621=['billableseconds','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','duration'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x6621,0xc0));var _0x1662=function(_0x418afb,_0x4ebded){_0x418afb=_0x418afb-0x0;var _0x1f67e4=_0x6621[_0x418afb];return _0x1f67e4;};'use strict';var moment=require(_0x1662('0x0'));var util=require(_0x1662('0x1'));var _=require(_0x1662('0x2'));var client=require('../client');exports['create']=function(_0x3ab191){return client[_0x1662('0x3')](_0x1662('0x4'),{'body':_[_0x1662('0x5')](_0x3ab191,{'source':_0x3ab191[_0x1662('0x6')],'destinationcontext':_0x3ab191[_0x1662('0x7')],'callerid':_0x3ab191[_0x1662('0x8')],'amaflags':_0x1662('0x9')}),'log':_0x1662('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x1662('0xa')],'createdAt':{'$between':[moment()['startOf']('day')[_0x1662('0xb')](_0x1662('0xc')),moment()[_0x1662('0xd')](_0x1662('0xe'))['format'](_0x1662('0xc'))]}},'attributes':['type',_0x1662('0xf'),_0x1662('0x10'),_0x1662('0x11')]},'log':_0x1662('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b81be67..5df2c66 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 _0x31da=['create','Request','CreateVoiceDialReport','../client'];(function(_0xdfb29a,_0x3443b5){var _0x52f21e=function(_0x56598e){while(--_0x56598e){_0xdfb29a['push'](_0xdfb29a['shift']());}};_0x52f21e(++_0x3443b5);}(_0x31da,0xdf));var _0xa31d=function(_0xbe80e3,_0x4165de){_0xbe80e3=_0xbe80e3-0x0;var _0x5301ef=_0x31da[_0xbe80e3];return _0x5301ef;};'use strict';var client=require(_0xa31d('0x0'));exports[_0xa31d('0x1')]=function(_0x567c10){return client[_0xa31d('0x2')](_0xa31d('0x3'),{'body':_0x567c10,'log':_0xa31d('0x3')});}; \ No newline at end of file +var _0x092f=['../client','create','Request','CreateVoiceDialReport'];(function(_0x4a1a3f,_0x2775b4){var _0x23b31a=function(_0x157d15){while(--_0x157d15){_0x4a1a3f['push'](_0x4a1a3f['shift']());}};_0x23b31a(++_0x2775b4);}(_0x092f,0x84));var _0xf092=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0x092f[_0x5302fb];return _0x43e6a4;};'use strict';var client=require(_0xf092('0x0'));exports[_0xf092('0x1')]=function(_0x4f08e5){return client[_0xf092('0x2')](_0xf092('0x3'),{'body':_0x4f08e5,'log':_0xf092('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 1177fe4..94afd1d 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 _0x6ea9=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x88fab1,_0x1accff){var _0x20c571=function(_0x12de1c){while(--_0x12de1c){_0x88fab1['push'](_0x88fab1['shift']());}};_0x20c571(++_0x1accff);}(_0x6ea9,0x89));var _0x96ea=function(_0x10ccd9,_0x3b2baa){_0x10ccd9=_0x10ccd9-0x0;var _0x474e73=_0x6ea9[_0x10ccd9];return _0x474e73;};'use strict';var client=require(_0x96ea('0x0'));exports[_0x96ea('0x1')]=function(){return function(){return client[_0x96ea('0x2')](_0x96ea('0x3'),{'options':{'raw':!![],'attributes':['id',_0x96ea('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x96ea('0x1')});};}; \ No newline at end of file +var _0x8c38=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x45caf5,_0x5d2b40){var _0x301360=function(_0x2ad695){while(--_0x2ad695){_0x45caf5['push'](_0x45caf5['shift']());}};_0x301360(++_0x5d2b40);}(_0x8c38,0x83));var _0x88c3=function(_0x57b691,_0x47652b){_0x57b691=_0x57b691-0x0;var _0xb096bc=_0x8c38[_0x57b691];return _0xb096bc;};'use strict';var client=require(_0x88c3('0x0'));exports[_0x88c3('0x1')]=function(){return function(){return client['Request'](_0x88c3('0x2'),{'options':{'raw':!![],'attributes':['id',_0x88c3('0x3'),_0x88c3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x88c3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 93c3427..74066ba 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 _0xa382=['dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialCutDigit','dialNoSuchNumberMaxRetry'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa382,0x1cd));var _0x2a38=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xa382[_0x2be8c2];return _0x97f531;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x2a38('0x0')](_0x2a38('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x2a38('0x2'),_0x2a38('0x3'),_0x2a38('0x4'),_0x2a38('0x5'),_0x2a38('0x6'),_0x2a38('0x7'),_0x2a38('0x8'),'dialLimitChannel',_0x2a38('0x9'),_0x2a38('0xa'),_0x2a38('0xb'),_0x2a38('0xc'),_0x2a38('0xd'),_0x2a38('0xe'),_0x2a38('0xf'),_0x2a38('0x10'),_0x2a38('0x11'),_0x2a38('0x12'),_0x2a38('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0x2a38('0x14'),_0x2a38('0x15'),'dialNoAnswerRetryFrequency',_0x2a38('0x16'),'dialTimezone','dialGlobalInterval',_0x2a38('0x17'),_0x2a38('0x18'),_0x2a38('0x19'),_0x2a38('0x1a'),_0x2a38('0x1b'),_0x2a38('0x1c'),_0x2a38('0x1d'),_0x2a38('0x1e'),_0x2a38('0x1f'),_0x2a38('0x20'),_0x2a38('0x21'),_0x2a38('0x22'),_0x2a38('0x23'),_0x2a38('0x24'),_0x2a38('0x25'),_0x2a38('0x26'),_0x2a38('0x27'),_0x2a38('0x28'),'dialQueueProject2',_0x2a38('0x5'),'strategy','dialRandomLastDigitCallerIdNumber',_0x2a38('0x29'),_0x2a38('0x2a'),_0x2a38('0x2b'),'dialDropMaxRetry',_0x2a38('0x2c'),_0x2a38('0x2d'),'dialAbandonedRetryFrequency',_0x2a38('0x2e'),_0x2a38('0x2f'),_0x2a38('0x30'),_0x2a38('0x31'),_0x2a38('0x32'),_0x2a38('0x33'),'dialPredictiveIntervalMinThreshold',_0x2a38('0x34'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x2a38('0x35'),'as':_0x2a38('0x35'),'attributes':['id',_0x2a38('0x36'),_0x2a38('0x37'),_0x2a38('0x38')]},{'model':_0x2a38('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x2a38('0x36')]},{'model':_0x2a38('0x35'),'as':_0x2a38('0x3a'),'attributes':['id',_0x2a38('0x36'),_0x2a38('0x37'),'active']},{'model':_0x2a38('0x3b'),'as':'Interval','attributes':['id',_0x2a38('0x36')],'include':[{'model':_0x2a38('0x3b'),'as':_0x2a38('0x3c'),'attributes':['id',_0x2a38('0x36'),_0x2a38('0x3d')]}]}]},'log':_0x2a38('0x3e')});};}; \ No newline at end of file +var _0x5e5c=['dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod'];(function(_0x1c766f,_0x5cec63){var _0x567833=function(_0x282854){while(--_0x282854){_0x1c766f['push'](_0x1c766f['shift']());}};_0x567833(++_0x5cec63);}(_0x5e5c,0x1ed));var _0xc5e5=function(_0x434433,_0x27901b){_0x434433=_0x434433-0x0;var _0x237016=_0x5e5c[_0x434433];return _0x237016;};'use strict';var client=require(_0xc5e5('0x0'));exports[_0xc5e5('0x1')]=function(){return function(){return client[_0xc5e5('0x2')](_0xc5e5('0x3'),{'options':{'raw':![],'attributes':['id',_0xc5e5('0x4'),_0xc5e5('0x5'),_0xc5e5('0x6'),_0xc5e5('0x7'),_0xc5e5('0x8'),_0xc5e5('0x9'),'dialActive',_0xc5e5('0xa'),_0xc5e5('0xb'),_0xc5e5('0xc'),_0xc5e5('0xd'),_0xc5e5('0xe'),_0xc5e5('0xf'),'dialPredictiveInterval',_0xc5e5('0x10'),_0xc5e5('0x11'),'dialOriginateTimeout',_0xc5e5('0x12'),_0xc5e5('0x13'),'dialQueueProject',_0xc5e5('0x14'),_0xc5e5('0x15'),_0xc5e5('0x16'),_0xc5e5('0x17'),_0xc5e5('0x18'),_0xc5e5('0x19'),_0xc5e5('0x1a'),_0xc5e5('0x1b'),'dialGlobalInterval',_0xc5e5('0x1c'),_0xc5e5('0x1d'),_0xc5e5('0x1e'),_0xc5e5('0x1f'),_0xc5e5('0x20'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0xc5e5('0x21'),'dialAMDBetweenWordsSilence',_0xc5e5('0x22'),_0xc5e5('0x23'),_0xc5e5('0x24'),'timeout',_0xc5e5('0x25'),_0xc5e5('0x26'),_0xc5e5('0x27'),_0xc5e5('0x28'),'dialAgiAfterHangupClient',_0xc5e5('0x29'),'monitor_format',_0xc5e5('0x2a'),_0xc5e5('0x2b'),_0xc5e5('0x2c'),'dialNoSuchNumberMaxRetry',_0xc5e5('0x2d'),_0xc5e5('0x2e'),'dialDropRetryFrequency',_0xc5e5('0x2f'),_0xc5e5('0x30'),_0xc5e5('0x31'),_0xc5e5('0x32'),_0xc5e5('0x33'),_0xc5e5('0x34'),_0xc5e5('0x35'),'dialPredictiveIntervalMaxThreshold',_0xc5e5('0x36'),_0xc5e5('0x37'),_0xc5e5('0x38')],'include':[{'model':_0xc5e5('0x39'),'as':'Trunk','attributes':['id',_0xc5e5('0x4'),_0xc5e5('0x3a'),_0xc5e5('0x3b')]},{'model':'Pause','as':_0xc5e5('0x3c'),'attributes':['id',_0xc5e5('0x4')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0xc5e5('0x4'),'callerid','active']},{'model':_0xc5e5('0x3d'),'as':_0xc5e5('0x3d'),'attributes':['id','name'],'include':[{'model':_0xc5e5('0x3d'),'as':_0xc5e5('0x3e'),'attributes':['id',_0xc5e5('0x4'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index eb9815d..beb47c7 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(_0x51e924,_0x1669ef){var _0x4df4b4=function(_0x393f6d){while(--_0x393f6d){_0x51e924['push'](_0x51e924['shift']());}};_0x4df4b4(++_0x1669ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x3d3255,_0x274ce9){var _0x2a5ffe=function(_0x2eae3b){while(--_0x2eae3b){_0x3d3255['push'](_0x3d3255['shift']());}};_0x2a5ffe(++_0x274ce9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 25381d2..0d14a37 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 _0x2ecb=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x3509bc,_0x15f09f){var _0x360da8=function(_0x4d402d){while(--_0x4d402d){_0x3509bc['push'](_0x3509bc['shift']());}};_0x360da8(++_0x15f09f);}(_0x2ecb,0x13e));var _0xb2ec=function(_0x95ad05,_0x3cadb6){_0x95ad05=_0x95ad05-0x0;var _0x2d79f4=_0x2ecb[_0x95ad05];return _0x2d79f4;};'use strict';var client=require('../client');exports[_0xb2ec('0x0')]=function(_0x3a56af){return function(){return client['Request'](_0xb2ec('0x1'),{'options':{'where':{'VoiceQueueId':_0x3a56af,'paused':!![]},'raw':!![]},'log':_0xb2ec('0x0')});};}; \ No newline at end of file +var _0x70b1=['Request','getVoiceQueueRtPauses'];(function(_0x1e3afa,_0x54b6b1){var _0x5157af=function(_0xd18770){while(--_0xd18770){_0x1e3afa['push'](_0x1e3afa['shift']());}};_0x5157af(++_0x54b6b1);}(_0x70b1,0xed));var _0x170b=function(_0x19d892,_0x31192b){_0x19d892=_0x19d892-0x0;var _0x4ce54e=_0x70b1[_0x19d892];return _0x4ce54e;};'use strict';var client=require('../client');exports[_0x170b('0x0')]=function(_0x2d9805){return function(){return client[_0x170b('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2d9805,'paused':!![]},'raw':!![]},'log':_0x170b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4f015ea..5326a9d 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(_0x20d82c,_0x3fab0a){var _0x3567a5=function(_0x2e77a6){while(--_0x2e77a6){_0x20d82c['push'](_0x20d82c['shift']());}};_0x3567a5(++_0x3fab0a);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0x51ce09,_0x1393f1){var _0x33ac8a=function(_0x4feb35){while(--_0x4feb35){_0x51ce09['push'](_0x51ce09['shift']());}};_0x33ac8a(++_0x1393f1);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 560bb9d..3e3958a 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 _0x669a=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x2b9b5f,_0x24c34b){var _0xfab9e=function(_0x58c0f6){while(--_0x58c0f6){_0x2b9b5f['push'](_0x2b9b5f['shift']());}};_0xfab9e(++_0x24c34b);}(_0x669a,0xb2));var _0xa669=function(_0xde001,_0xe7b70e){_0xde001=_0xde001-0x0;var _0xa4d114=_0x669a[_0xde001];return _0xa4d114;};'use strict';var client=require('../client');exports[_0xa669('0x0')]={};exports[_0xa669('0x1')]=function(_0x473450){return client['Request'](_0xa669('0x2'),{'body':{'result':_0x473450['result'],'transfererchannel':_0x473450[_0xa669('0x3')],'transferercalleridnum':_0x473450[_0xa669('0x4')],'transferercalleridname':_0x473450[_0xa669('0x5')],'transfererconnectedlinenum':_0x473450['transfererconnectedlinenum'],'transfererconnectedlinename':_0x473450[_0xa669('0x6')],'transfereraccountcode':_0x473450['transfereraccountcode'],'transferercontext':_0x473450[_0xa669('0x7')],'transfererexten':_0x473450[_0xa669('0x8')],'transfererlinkedid':_0x473450[_0xa669('0x9')],'transfereechannel':_0x473450['transfereechannel'],'transfereecalleridnum':_0x473450[_0xa669('0xa')],'transfereecalleridname':_0x473450[_0xa669('0xb')],'transfereeconnectedlinenum':_0x473450[_0xa669('0xc')],'transfereeconnectedlinename':_0x473450[_0xa669('0xd')],'transfereeaccountcode':_0x473450[_0xa669('0xe')],'transfereecontext':_0x473450[_0xa669('0xf')],'transfereeexten':_0x473450[_0xa669('0x10')],'transfereelinkedid':_0x473450[_0xa669('0x11')],'isexternal':_0x473450[_0xa669('0x12')],'context':_0x473450[_0xa669('0x13')],'extension':_0x473450[_0xa669('0x14')],'type':'blind'},'log':_0xa669('0x2')});};exports[_0xa669('0x15')]=function(_0x552100){return client[_0xa669('0x16')](_0xa669('0x2'),{'body':{'result':_0x552100[_0xa669('0x17')],'transfererchannel':_0x552100[_0xa669('0x18')],'transferercalleridnum':_0x552100[_0xa669('0x19')],'transferercalleridname':_0x552100[_0xa669('0x1a')],'transfererconnectedlinenum':_0x552100[_0xa669('0x1b')],'transfererconnectedlinename':_0x552100[_0xa669('0x1c')],'transfereraccountcode':_0x552100[_0xa669('0x1d')],'transferercontext':_0x552100[_0xa669('0x1e')],'transfererexten':_0x552100[_0xa669('0x1f')],'transfererlinkedid':_0x552100['origtransfererlinkedid'],'transfereechannel':_0x552100[_0xa669('0x20')],'transfereecalleridnum':_0x552100['transfertargetcalleridnum'],'transfereecalleridname':_0x552100[_0xa669('0x21')],'transfereeconnectedlinenum':_0x552100[_0xa669('0x22')],'transfereeconnectedlinename':_0x552100['transfertargetconnectedlinename'],'transfereeaccountcode':_0x552100[_0xa669('0x23')],'transfereecontext':_0x552100[_0xa669('0x24')],'transfereeexten':_0x552100[_0xa669('0x25')],'transfereelinkedid':_0x552100[_0xa669('0x26')],'isexternal':_0x552100[_0xa669('0x12')],'context':_0x552100[_0xa669('0x27')],'extension':_0x552100[_0xa669('0x28')],'type':'attended'},'log':_0xa669('0x2')});}; \ No newline at end of file +var _0xc723=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','isexternal','context','extension','blind','Request','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x2527e8,_0x74581e){var _0x598c97=function(_0x3059cf){while(--_0x3059cf){_0x2527e8['push'](_0x2527e8['shift']());}};_0x598c97(++_0x74581e);}(_0xc723,0x140));var _0x3c72=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0xc723[_0x36fbef];return _0x45e270;};'use strict';var client=require(_0x3c72('0x0'));exports[_0x3c72('0x1')]={};exports[_0x3c72('0x2')]=function(_0x406e0f){return client['Request'](_0x3c72('0x3'),{'body':{'result':_0x406e0f[_0x3c72('0x4')],'transfererchannel':_0x406e0f[_0x3c72('0x5')],'transferercalleridnum':_0x406e0f[_0x3c72('0x6')],'transferercalleridname':_0x406e0f[_0x3c72('0x7')],'transfererconnectedlinenum':_0x406e0f[_0x3c72('0x8')],'transfererconnectedlinename':_0x406e0f[_0x3c72('0x9')],'transfereraccountcode':_0x406e0f[_0x3c72('0xa')],'transferercontext':_0x406e0f[_0x3c72('0xb')],'transfererexten':_0x406e0f['transfererexten'],'transfererlinkedid':_0x406e0f['transfererlinkedid'],'transfereechannel':_0x406e0f['transfereechannel'],'transfereecalleridnum':_0x406e0f[_0x3c72('0xc')],'transfereecalleridname':_0x406e0f[_0x3c72('0xd')],'transfereeconnectedlinenum':_0x406e0f[_0x3c72('0xe')],'transfereeconnectedlinename':_0x406e0f[_0x3c72('0xf')],'transfereeaccountcode':_0x406e0f[_0x3c72('0x10')],'transfereecontext':_0x406e0f['transfereecontext'],'transfereeexten':_0x406e0f['transfereeexten'],'transfereelinkedid':_0x406e0f['transfereelinkedid'],'isexternal':_0x406e0f[_0x3c72('0x11')],'context':_0x406e0f[_0x3c72('0x12')],'extension':_0x406e0f[_0x3c72('0x13')],'type':_0x3c72('0x14')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x355ec2){return client[_0x3c72('0x15')](_0x3c72('0x3'),{'body':{'result':_0x355ec2[_0x3c72('0x4')],'transfererchannel':_0x355ec2[_0x3c72('0x16')],'transferercalleridnum':_0x355ec2['origtransferercalleridnum'],'transferercalleridname':_0x355ec2[_0x3c72('0x17')],'transfererconnectedlinenum':_0x355ec2[_0x3c72('0x18')],'transfererconnectedlinename':_0x355ec2[_0x3c72('0x19')],'transfereraccountcode':_0x355ec2[_0x3c72('0x1a')],'transferercontext':_0x355ec2[_0x3c72('0x1b')],'transfererexten':_0x355ec2['secondtransfererexten'],'transfererlinkedid':_0x355ec2[_0x3c72('0x1c')],'transfereechannel':_0x355ec2[_0x3c72('0x1d')],'transfereecalleridnum':_0x355ec2[_0x3c72('0x1e')],'transfereecalleridname':_0x355ec2[_0x3c72('0x1f')],'transfereeconnectedlinenum':_0x355ec2[_0x3c72('0x20')],'transfereeconnectedlinename':_0x355ec2[_0x3c72('0x21')],'transfereeaccountcode':_0x355ec2['transfertargetaccountcode'],'transfereecontext':_0x355ec2[_0x3c72('0x22')],'transfereeexten':_0x355ec2[_0x3c72('0x23')],'transfereelinkedid':_0x355ec2[_0x3c72('0x24')],'isexternal':_0x355ec2[_0x3c72('0x11')],'context':_0x355ec2[_0x3c72('0x25')],'extension':_0x355ec2[_0x3c72('0x26')],'type':'attended'},'log':_0x3c72('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7402601..8452d7f 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(_0x38b708,_0x28e052){var _0x3d1743=function(_0x916791){while(--_0x916791){_0x38b708['push'](_0x38b708['shift']());}};_0x3d1743(++_0x28e052);}(_0x7a54,0x106));var _0x47a5=function(_0x3818ea,_0x414ef2){_0x3818ea=_0x3818ea-0x0;var _0x1301f6=_0x7a54[_0x3818ea];return _0x1301f6;};'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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x361975,_0xf760a1){var _0x4879ce=function(_0x3ebe40){while(--_0x3ebe40){_0x361975['push'](_0x361975['shift']());}};_0x4879ce(++_0xf760a1);}(_0xb10b,0x12a));var _0xbb10=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0xb10b[_0x19d350];return _0x3bfc8d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 6987a39..91446f6 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 _0xaf9f=['calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','trigger:%s','merge','lodash','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','lastName','phone','mobile','fax','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName'];(function(_0x1b1270,_0x4b4fe7){var _0x335d12=function(_0x320fd5){while(--_0x320fd5){_0x1b1270['push'](_0x1b1270['shift']());}};_0x335d12(++_0x4b4fe7);}(_0xaf9f,0x1b4));var _0xfaf9=function(_0x55b3b5,_0x254983){_0x55b3b5=_0x55b3b5-0x0;var _0x5297a9=_0xaf9f[_0x55b3b5];return _0x5297a9;};'use strict';var _=require(_0xfaf9('0x0'));var BPromise=require('bluebird');var Redis=require(_0xfaf9('0x1'));var util=require(_0xfaf9('0x2'));var config=require(_0xfaf9('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xfaf9('0x4'));config[_0xfaf9('0x5')]=_[_0xfaf9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfaf9('0x7'))(new Redis(config[_0xfaf9('0x5')]));function emit(_0x44dbe6,_0x7ffdc6,_0x48babf,_0x1bfbf8,_0x4a8b44){logger[_0xfaf9('0x8')](_0xfaf9('0x9'),_0x44dbe6,_0x7ffdc6['id'],_0x48babf,_0x1bfbf8,JSON[_0xfaf9('0xa')](_0x4a8b44));io['to'](_0x48babf)[_0xfaf9('0xb')](_0x1bfbf8,_0x4a8b44);}exports[_0xfaf9('0xc')]=function(_0x31e9ad,_0x35f316,_0x5107bf,_0x260a5b){var _0x489db6,_0x497979;var _0x39e0f2={};var _0x3cb254;var _0x4baff2=Number(_0x5107bf['data1']);var _0xe2e4a7=_0x5107bf[_0xfaf9('0xd')]?Boolean(Number(_0x5107bf['data2'])):![];var _0x811fe9;var _0x4a39e6=![];if(!_[_0xfaf9('0xe')](_0x5107bf['data5'])){if(_0x5107bf[_0xfaf9('0xf')]=='1')_0x4a39e6=!![];}if(!_0x4a39e6){if(_0x260a5b[_0xfaf9('0x10')]){_0x39e0f2['id']=_0x260a5b[_0xfaf9('0x10')];}}if(!_0x39e0f2['id']){_0x39e0f2[_0xfaf9('0x11')]=_0x4baff2;_0x811fe9=_0x5107bf[_0xfaf9('0x12')]&&_0x5107bf[_0xfaf9('0x12')]!=='0'?_0x5107bf[_0xfaf9('0x12')][_0xfaf9('0x13')](','):['phone'];_0x39e0f2[_0xfaf9('0x14')]=_[_0xfaf9('0x15')](_0x811fe9,function(_0x462e5d){var _0x73baa6={};_0x73baa6[_0x462e5d]=_0x260a5b[_0xfaf9('0x16')]?_0x260a5b['destcalleridnum']:_0x260a5b['calleridnum'];return _0x73baa6;});_0x3cb254=_0x260a5b[_0xfaf9('0x16')]?_0x260a5b[_0xfaf9('0x17')]:_0x260a5b['calleridnum'];}var _0x420d21=['id','firstName',_0xfaf9('0x18'),_0xfaf9('0x19'),_0xfaf9('0x1a'),_0xfaf9('0x1b'),_0xfaf9('0x11'),'createdAt','scheduledAt','updatedAt'];var _0x5069bb=_[_0xfaf9('0x1c')](_0x420d21,_0x811fe9);BPromise[_0xfaf9('0x1d')]()['then'](cmContactRpc[_0xfaf9('0x1e')]({'attributes':_0x5069bb,'where':_0x39e0f2,'phone':_0x3cb254}))[_0xfaf9('0x1f')](function(_0x497eea){_0x497979=_0x497eea;if(!_[_0xfaf9('0x20')](_0x497979)){if(_0x497979[_0xfaf9('0x21')]===0x1){_0x489db6=_0x497979[0x0];logger[_0xfaf9('0x8')](_0xfaf9('0x22'),_0x260a5b[_0xfaf9('0x23')],_0x35f316['id'],_0x489db6['id']);}else{logger['info'](_0xfaf9('0x24'),_0x260a5b[_0xfaf9('0x23')],_0x35f316['id'],_[_0xfaf9('0x15')](_0x497979,'id')[_0xfaf9('0x25')](','));}return;}else{logger[_0xfaf9('0x8')](_0xfaf9('0x26'),_0x260a5b['uniqueid'],_0x35f316['id']);var _0x486750={'ListId':_0x4baff2};var _0x21ead6=_0x5107bf[_0xfaf9('0x27')]&&_0x5107bf[_0xfaf9('0x27')]!=='0'?_0x5107bf[_0xfaf9('0x27')]:'phone';if(_0xe2e4a7){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x260a5b[_0xfaf9('0x23')],_0x35f316['id']);_0x486750[_0x21ead6]=_[_0xfaf9('0xe')](_0x260a5b[_0xfaf9('0x16')])?_0x260a5b['calleridnum']:_0x260a5b['destcalleridnum'];if(_['isNil'](_0x260a5b['routeId'])){_0x486750[_0xfaf9('0x28')]=_0x260a5b['calleridname']&&_0x260a5b[_0xfaf9('0x29')]!==_0xfaf9('0x2a')?_0x260a5b['calleridname']:_0xfaf9('0x2b');}else{_0x486750['firstName']=_0x260a5b[_0xfaf9('0x2c')]&&_0x260a5b[_0xfaf9('0x2c')]!==_0xfaf9('0x2a')?_0x260a5b[_0xfaf9('0x2c')]:_0xfaf9('0x2b');}return BPromise[_0xfaf9('0x1d')]()['then'](cmContactRpc[_0xfaf9('0x2d')](_0x486750))[_0xfaf9('0x1f')](function(_0x2d2a18){_0x489db6=_0x2d2a18;_0x497979[_0xfaf9('0x2e')](_0x2d2a18);if(_0x489db6){logger[_0xfaf9('0x8')](_0xfaf9('0x2f'),_0x260a5b[_0xfaf9('0x23')],_0x35f316['id'],_0x489db6['id']);}return;});}else{logger[_0xfaf9('0x8')](_0xfaf9('0x30'),_0x260a5b[_0xfaf9('0x23')],_0x35f316['id']);_0x486750[_0x21ead6]=_[_0xfaf9('0xe')](_0x260a5b['routeId'])?_0x260a5b['calleridnum']:_0x260a5b[_0xfaf9('0x17')];if(_['isNil'](_0x260a5b[_0xfaf9('0x16')])){_0x486750['firstName']=_0x260a5b[_0xfaf9('0x29')]&&_0x260a5b[_0xfaf9('0x29')]!==_0xfaf9('0x2a')?_0x260a5b[_0xfaf9('0x29')]:_0xfaf9('0x2b');}else{_0x486750['firstName']=_0x260a5b[_0xfaf9('0x2c')]&&_0x260a5b[_0xfaf9('0x2c')]!==_0xfaf9('0x2a')?_0x260a5b['destcalleridname']:_0xfaf9('0x2b');}_0x489db6=_0x486750;_0x497979[_0xfaf9('0x2e')](_0x486750);return;}}})[_0xfaf9('0x1f')](function(){if(_0x31e9ad){emit(_0x260a5b['uniqueid'],_0x35f316,util['format'](_0xfaf9('0x31'),_0x31e9ad[_0xfaf9('0x32')]),util['format'](_0xfaf9('0x33'),_0x5107bf['action']['toLowerCase']()),{'evt':_[_0xfaf9('0x34')](_0x260a5b,{'autoCreate':_0xe2e4a7}),'contact':_0x489db6===undefined?{}:_0x489db6,'contacts':_0x497979[_0xfaf9('0x21')]===0x0?undefined:_0x497979});}});}; \ No newline at end of file +var _0xc7ec=['xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','toLowerCase','merge','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5'];(function(_0xdae0c0,_0x1bc59b){var _0x483a38=function(_0x490839){while(--_0x490839){_0xdae0c0['push'](_0xdae0c0['shift']());}};_0x483a38(++_0x1bc59b);}(_0xc7ec,0x164));var _0xcc7e=function(_0x5079f0,_0x2e0ae4){_0x5079f0=_0x5079f0-0x0;var _0x182bce=_0xc7ec[_0x5079f0];return _0x182bce;};'use strict';var _=require(_0xcc7e('0x0'));var BPromise=require(_0xcc7e('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xcc7e('0x2'));var logger=require(_0xcc7e('0x3'))(_0xcc7e('0x4'));var cmContactRpc=require(_0xcc7e('0x5'));config[_0xcc7e('0x6')]=_[_0xcc7e('0x7')](config[_0xcc7e('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcc7e('0x6')]));function emit(_0x4b6d8d,_0x1328f8,_0x298ad2,_0x6650fb,_0x457f58){logger['info'](_0xcc7e('0x8'),_0x4b6d8d,_0x1328f8['id'],_0x298ad2,_0x6650fb,JSON[_0xcc7e('0x9')](_0x457f58));io['to'](_0x298ad2)[_0xcc7e('0xa')](_0x6650fb,_0x457f58);}exports[_0xcc7e('0xb')]=function(_0x1c08d3,_0x13597e,_0x1af130,_0x55695e){var _0x5666de,_0x228088;var _0x1fcf24={};var _0x12c341;var _0x56dd0d=Number(_0x1af130['data1']);var _0x1a4040=_0x1af130[_0xcc7e('0xc')]?Boolean(Number(_0x1af130['data2'])):![];var _0x1c2999;var _0x37c265=![];if(!_[_0xcc7e('0xd')](_0x1af130[_0xcc7e('0xe')])){if(_0x1af130['data5']=='1')_0x37c265=!![];}if(!_0x37c265){if(_0x55695e[_0xcc7e('0xf')]){_0x1fcf24['id']=_0x55695e[_0xcc7e('0xf')];}}if(!_0x1fcf24['id']){_0x1fcf24[_0xcc7e('0x10')]=_0x56dd0d;_0x1c2999=_0x1af130[_0xcc7e('0x11')]&&_0x1af130[_0xcc7e('0x11')]!=='0'?_0x1af130['data3'][_0xcc7e('0x12')](','):[_0xcc7e('0x13')];_0x1fcf24[_0xcc7e('0x14')]=_[_0xcc7e('0x15')](_0x1c2999,function(_0x1080c8){var _0x4b12ff={};_0x4b12ff[_0x1080c8]=_0x55695e[_0xcc7e('0x16')]?_0x55695e[_0xcc7e('0x17')]:_0x55695e[_0xcc7e('0x18')];return _0x4b12ff;});_0x12c341=_0x55695e[_0xcc7e('0x16')]?_0x55695e[_0xcc7e('0x17')]:_0x55695e[_0xcc7e('0x18')];}var _0x4c02e4=['id','firstName','lastName','phone',_0xcc7e('0x19'),_0xcc7e('0x1a'),_0xcc7e('0x10'),'createdAt',_0xcc7e('0x1b'),_0xcc7e('0x1c')];var _0x2bfe22=_[_0xcc7e('0x1d')](_0x4c02e4,_0x1c2999);BPromise[_0xcc7e('0x1e')]()[_0xcc7e('0x1f')](cmContactRpc[_0xcc7e('0x20')]({'attributes':_0x2bfe22,'where':_0x1fcf24,'phone':_0x12c341}))['then'](function(_0x2e47a9){_0x228088=_0x2e47a9;if(!_['isEmpty'](_0x228088)){if(_0x228088['length']===0x1){_0x5666de=_0x228088[0x0];logger['info'](_0xcc7e('0x21'),_0x55695e[_0xcc7e('0x22')],_0x13597e['id'],_0x5666de['id']);}else{logger[_0xcc7e('0x23')](_0xcc7e('0x24'),_0x55695e[_0xcc7e('0x22')],_0x13597e['id'],_['map'](_0x228088,'id')[_0xcc7e('0x25')](','));}return;}else{logger['info'](_0xcc7e('0x26'),_0x55695e[_0xcc7e('0x22')],_0x13597e['id']);var _0x287181={'ListId':_0x56dd0d};var _0x39db08=_0x1af130[_0xcc7e('0x27')]&&_0x1af130[_0xcc7e('0x27')]!=='0'?_0x1af130[_0xcc7e('0x27')]:_0xcc7e('0x13');if(_0x1a4040){logger[_0xcc7e('0x23')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x55695e['uniqueid'],_0x13597e['id']);_0x287181[_0x39db08]=_[_0xcc7e('0xd')](_0x55695e['routeId'])?_0x55695e[_0xcc7e('0x18')]:_0x55695e[_0xcc7e('0x17')];if(_[_0xcc7e('0xd')](_0x55695e['routeId'])){_0x287181[_0xcc7e('0x28')]=_0x55695e[_0xcc7e('0x29')]&&_0x55695e[_0xcc7e('0x29')]!==_0xcc7e('0x2a')?_0x55695e['calleridname']:_0xcc7e('0x2b');}else{_0x287181['firstName']=_0x55695e['destcalleridname']&&_0x55695e[_0xcc7e('0x2c')]!==_0xcc7e('0x2a')?_0x55695e[_0xcc7e('0x2c')]:_0xcc7e('0x2b');}return BPromise[_0xcc7e('0x1e')]()['then'](cmContactRpc['createContact'](_0x287181))['then'](function(_0x547040){_0x5666de=_0x547040;_0x228088['push'](_0x547040);if(_0x5666de){logger[_0xcc7e('0x23')](_0xcc7e('0x2d'),_0x55695e[_0xcc7e('0x22')],_0x13597e['id'],_0x5666de['id']);}return;});}else{logger[_0xcc7e('0x23')](_0xcc7e('0x2e'),_0x55695e['uniqueid'],_0x13597e['id']);_0x287181[_0x39db08]=_[_0xcc7e('0xd')](_0x55695e['routeId'])?_0x55695e[_0xcc7e('0x18')]:_0x55695e[_0xcc7e('0x17')];if(_[_0xcc7e('0xd')](_0x55695e['routeId'])){_0x287181[_0xcc7e('0x28')]=_0x55695e[_0xcc7e('0x29')]&&_0x55695e[_0xcc7e('0x29')]!==_0xcc7e('0x2a')?_0x55695e[_0xcc7e('0x29')]:_0xcc7e('0x2b');}else{_0x287181[_0xcc7e('0x28')]=_0x55695e[_0xcc7e('0x2c')]&&_0x55695e[_0xcc7e('0x2c')]!==_0xcc7e('0x2a')?_0x55695e[_0xcc7e('0x2c')]:_0xcc7e('0x2b');}_0x5666de=_0x287181;_0x228088['push'](_0x287181);return;}}})[_0xcc7e('0x1f')](function(){if(_0x1c08d3){emit(_0x55695e[_0xcc7e('0x22')],_0x13597e,util['format'](_0xcc7e('0x2f'),_0x1c08d3[_0xcc7e('0x30')]),util[_0xcc7e('0x31')](_0xcc7e('0x32'),_0x1af130['action'][_0xcc7e('0x33')]()),{'evt':_[_0xcc7e('0x34')](_0x55695e,{'autoCreate':_0x1a4040}),'contact':_0x5666de===undefined?{}:_0x5666de,'contacts':_0x228088['length']===0x0?undefined:_0x228088});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2966dce..568d20b 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 _0xcbbf=['hasOwnProperty','status','checkTrigger','merge','Actions','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','800','data5','windowHeight','600','winApplication','winArguments','format','name','trigger:%s:%s','jscripty','user:%s','trigger:%s','action','exec','integration','script','parse','search','replace','length','every','AllConditions','checkConditions','channel','some','AnyConditions','checkTrigger:\x20trigger','evt','account','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','queue','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','info','stringify','emit','prototype','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface'];(function(_0x175396,_0x661ab7){var _0x5a0536=function(_0xded175){while(--_0xded175){_0x175396['push'](_0x175396['shift']());}};_0x5a0536(++_0x661ab7);}(_0xcbbf,0x14e));var _0xfcbb=function(_0xf611b7,_0xf93b00){_0xf611b7=_0xf611b7-0x0;var _0x34b975=_0xcbbf[_0xf611b7];return _0x34b975;};'use strict';var util=require(_0xfcbb('0x0'));var _=require(_0xfcbb('0x1'));var url=require(_0xfcbb('0x2'));var Mustache=require(_0xfcbb('0x3'));var Redis=require(_0xfcbb('0x4'));var urlforward=require('./urlforward');var integration=require(_0xfcbb('0x5'));var cmContact=require(_0xfcbb('0x6'));var script=require(_0xfcbb('0x7'));var config=require(_0xfcbb('0x8'));var logger=require(_0xfcbb('0x9'))(_0xfcbb('0xa'));var ami=require(_0xfcbb('0xb'));config[_0xfcbb('0xc')]=_['defaults'](config[_0xfcbb('0xc')],{'host':_0xfcbb('0xd'),'port':0x18eb});var io=require(_0xfcbb('0xe'))(new Redis(config[_0xfcbb('0xc')]));var operators={'equals':function(_0x45cd28,_0x472448){return _0x45cd28==_0x472448;},'not_equals':function(_0x44c923,_0x1ca313){return _0x44c923!=_0x1ca313;}};var barAndWebActions=[_0xfcbb('0xf'),_0xfcbb('0x2'),_0xfcbb('0x10')];function Trigger(_0xee5258){this[_0xfcbb('0x11')]=_0xee5258[_0xfcbb('0x11')];this[_0xfcbb('0x12')]=_0xee5258[_0xfcbb('0x12')];this['voiceQueues']=_0xee5258[_0xfcbb('0x13')];this[_0xfcbb('0x14')]=_0xee5258[_0xfcbb('0x14')];this[_0xfcbb('0x15')]=_0xee5258[_0xfcbb('0x15')];this[_0xfcbb('0x16')]=_0xee5258[_0xfcbb('0x16')];this['freshdeskAccounts']=_0xee5258[_0xfcbb('0x17')];this[_0xfcbb('0x18')]=_0xee5258[_0xfcbb('0x18')];this[_0xfcbb('0x19')]=_0xee5258[_0xfcbb('0x19')];this[_0xfcbb('0x1a')]=_0xee5258[_0xfcbb('0x1a')];this['deskAccounts']=_0xee5258[_0xfcbb('0x1b')];this['vtigerAccounts']=_0xee5258[_0xfcbb('0x1c')];this[_0xfcbb('0x1d')]=_0xee5258[_0xfcbb('0x1d')];this['dynamics365Accounts']=_0xee5258[_0xfcbb('0x1e')];this[_0xfcbb('0x1f')]=_0xee5258[_0xfcbb('0x1f')];this[_0xfcbb('0x20')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xfcbb('0x18')],'freshdesk':this[_0xfcbb('0x17')],'sugarcrm':this[_0xfcbb('0x19')],'zoho':this['zohoAccounts'],'desk':this[_0xfcbb('0x1b')],'vtiger':this[_0xfcbb('0x1c')],'dynamics365':this[_0xfcbb('0x1e')],'freshsales':this[_0xfcbb('0x1f')],'servicenow':this[_0xfcbb('0x1d')]};ami['on'](_0xfcbb('0x21'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on']('custom:agentconnect',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcomplete',this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x24'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x25'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x26'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0xfcbb('0x23')](this));ami['on']('custom:agentreject',this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x27'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfcbb('0x29'),this['syncCustomEvent'][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x2a'),this[_0xfcbb('0x2b')][_0xfcbb('0x23')](this));ami['on']('custom:dialconnect',this[_0xfcbb('0x2b')][_0xfcbb('0x23')](this));ami['on']('custom:dialend',this[_0xfcbb('0x2b')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x2c'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x2d'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x2e'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on']('custom:incomingmessage',this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x2f'),this[_0xfcbb('0x22')]['bind'](this));ami['on'](_0xfcbb('0x30'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));ami['on'](_0xfcbb('0x31'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfcbb('0x32'),this[_0xfcbb('0x22')][_0xfcbb('0x23')](this));}Trigger['prototype']['emit']=function(_0x17d037,_0xce2796,_0x208502){logger[_0xfcbb('0x33')](_0x17d037,_0xce2796,JSON[_0xfcbb('0x34')](_0x208502));io['to'](_0x17d037)[_0xfcbb('0x35')](_0xce2796,_0x208502);};Trigger[_0xfcbb('0x36')][_0xfcbb('0x22')]=function(_0x5968d8){var _0x2bb3ea=_['clone'](_0x5968d8);if(typeof _0x2bb3ea[_0xfcbb('0x37')]===_0xfcbb('0x38')){_0x2bb3ea[_0xfcbb('0x37')]=_0xfcbb('0x39');}logger[_0xfcbb('0x3a')](_0xfcbb('0x22'),util[_0xfcbb('0x3b')](_0x2bb3ea,{'showHidden':!![],'depth':null}));this[_0xfcbb('0x3c')](_0x2bb3ea);};Trigger[_0xfcbb('0x36')][_0xfcbb('0x2b')]=function(_0x2ea0d4){if(this[_0xfcbb('0x12')][_0x2ea0d4[_0xfcbb('0x3d')]]){this[_0xfcbb('0x22')](_0x2ea0d4);}};Trigger[_0xfcbb('0x36')][_0xfcbb('0x3c')]=function(_0x473d41){var _0x5d1bcb;for(var _0x2e2f7d in this[_0xfcbb('0x11')]){if(this[_0xfcbb('0x11')][_0xfcbb('0x3e')](_0x2e2f7d)){if(this[_0xfcbb('0x11')][_0x2e2f7d][_0xfcbb('0x3f')]){_0x5d1bcb=this[_0xfcbb('0x40')](this[_0xfcbb('0x11')][_0x2e2f7d],_0x473d41);if(_0x5d1bcb){_[_0xfcbb('0x41')](_0x473d41,_0x473d41['variables']);for(var _0x1936c5=0x0,_0x15dbce,_0x295c54,_0x57b7e4;_0x1936c50x0){_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 _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x429ddd,_0x52bdf9){var _0x1225f7=function(_0x44510){while(--_0x44510){_0x429ddd['push'](_0x429ddd['shift']());}};_0x1225f7(++_0x52bdf9);}(_0x3e74,0x175));var _0x43e7=function(_0x46a55f,_0x40086e){_0x46a55f=_0x46a55f-0x0;var _0x370ce5=_0x3e74[_0x46a55f];return _0x370ce5;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 10ead3a..bf8f51b 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 _0x06bf=['nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','Subjects','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','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','lodash','request-promise','./util','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','POST','clientId','username','password','clientSecret','then','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','substring','lastIndexOf','enduserId','outbound','telephone1','&$filter=','\x20eq\x20\x27','replace'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x06bf,0x110));var _0xf06b=function(_0x1dac1f,_0x4d84e9){_0x1dac1f=_0x1dac1f-0x0;var _0x10f42f=_0x06bf[_0x1dac1f];return _0x10f42f;};'use strict';var _=require(_0xf06b('0x0'));var rp=require(_0xf06b('0x1'));var util=require('util');var intUtil=require(_0xf06b('0x2'));var md5=require('md5');var Redis=require(_0xf06b('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0xf06b('0x4'));config[_0xf06b('0x5')]=_[_0xf06b('0x6')](config[_0xf06b('0x5')],{'host':_0xf06b('0x7'),'port':0x18eb});var io=require(_0xf06b('0x8'))(new Redis(config[_0xf06b('0x5')]));function getAuthToken(_0x183840,_0x15d2e2,_0x372dfa){if(_0x183840[_0xf06b('0x9')]){_0x183840[_0xf06b('0xa')]=_0x183840[_0xf06b('0xb')][_0xf06b('0xc')];_0x183840[_0xf06b('0xd')]=_0x183840[_0xf06b('0xb')]['data2'];return Promise['resolve'](_0x183840['CloudProvider']['data5']);}var _0x1aff31={'method':_0xf06b('0xe'),'uri':_0x15d2e2,'form':{'client_id':_0x183840[_0xf06b('0xf')],'resource':_0x183840['remoteUri'],'username':_0x183840[_0xf06b('0x10')],'password':_0x183840['password'],'grant_type':_0xf06b('0x11'),'client_secret':_0x183840[_0xf06b('0x12')]},'json':!![]};return rp(_0x1aff31)[_0xf06b('0x13')](function(_0x51eee7){return _0x51eee7['access_token'];})[_0xf06b('0x14')](function(_0x3de233){logger[_0xf06b('0x15')]('['+[_0x372dfa['toUpperCase']()]+_0xf06b('0x16'));return _0x3de233[_0xf06b('0x17')];});}function getUser(_0x200908,_0x27ff7a,_0x438900,_0x761148,_0x1e9acf,_0xb3b566){return new Promise(function(_0x15d31b,_0x26a11f){return getAuthToken(_0x27ff7a,_0x761148,_0xb3b566)[_0xf06b('0x13')](function(_0x25bd18){var _0x590a92={'method':_0xf06b('0x18'),'uri':_0x1e9acf+_0xf06b('0x19'),'headers':{'Authorization':_0xf06b('0x1a')+_0x25bd18,'OData-Version':_0xf06b('0x1b')},'json':!![]};return rp(_0x590a92);})[_0xf06b('0x13')](function(_0x352ef2){var _0x4e6233=_0x352ef2[_0xf06b('0x1c')];var _0x468712=![];var _0x31aaa3=null;if(!_[_0xf06b('0x1d')](_0x438900)){if(intUtil['validateEmail'](_0x438900[_0xf06b('0x1e')])){_0x200908[_0xf06b('0x1f')]=_0x438900['email'];for(_0x31aaa3=0x0;_0x31aaa3<_0x4e6233[_0xf06b('0x20')];_0x31aaa3++){if(_0x4e6233[_0x31aaa3][_0xf06b('0x21')]===_0x438900[_0xf06b('0x1e')]&&!_0x4e6233[_0x31aaa3]['isdisabled']){_0x468712=!![];logger[_0xf06b('0x22')]('['+[_0xb3b566[_0xf06b('0x23')]()]+_0xf06b('0x24')+_0x4e6233[_0x31aaa3][_0xf06b('0x25')]+'!');_0x200908[_0xf06b('0x26')]=_0x4e6233[_0x31aaa3][_0xf06b('0x25')];}}}}if(!_0x468712){logger[_0xf06b('0x22')]('['+[_0xb3b566[_0xf06b('0x23')]()]+_0xf06b('0x27'));_0x200908[_0xf06b('0x1f')]=_0x27ff7a[_0xf06b('0x10')];for(_0x31aaa3=0x0;_0x31aaa3<_0x4e6233[_0xf06b('0x20')];_0x31aaa3++){if(_0x4e6233[_0x31aaa3][_0xf06b('0x21')]===_0x27ff7a[_0xf06b('0x10')]){_0x200908[_0xf06b('0x26')]=_0x4e6233[_0x31aaa3][_0xf06b('0x25')];}}}_0x15d31b(_0x200908);})['catch'](function(_0x51a393){_0x26a11f(_0x51a393[_0xf06b('0x17')]);});});}function createEndUser(_0x4c7a90,_0x1530aa,_0x4beb02,_0x39cbab,_0x24bdfe,_0x1d8367,_0x15ccea){return new Promise(function(_0x3dfc2c,_0x439f04){return getAuthToken(_0x1530aa,_0x4beb02,_0x1d8367)['then'](function(_0x415b5c){var _0x2ddd46=_0x1d8367[_0xf06b('0x28')]()==='outbound'?_0x24bdfe[_0xf06b('0x29')]:_0x24bdfe[_0xf06b('0x2a')];var _0x284b00={'method':_0xf06b('0xe'),'uri':_0x39cbab+_0xf06b('0x2b'),'body':{'fullname':_0x2ddd46,'firstname':_0x2ddd46,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf06b('0x2c')+_0x4c7a90[_0xf06b('0x26')]+')'},'headers':{'Authorization':_0xf06b('0x1a')+_0x415b5c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x284b00[_0xf06b('0x2d')][_0x15ccea]=_0x2ddd46;return rp(_0x284b00);})['then'](function(_0x2c6b41){var _0x3f5f88=_0x2c6b41[_0xf06b('0x2e')]['odata-entityid'];var _0x101938=_0x3f5f88[_0xf06b('0x2f')](_0x3f5f88[_0xf06b('0x30')]('(')+0x1,_0x3f5f88[_0xf06b('0x30')](')'));_0x4c7a90[_0xf06b('0x31')]=_0x101938;_0x3dfc2c(_0x4c7a90);})[_0xf06b('0x14')](function(_0x4c35d4){_0x439f04(_0x4c35d4[_0xf06b('0x17')]);});});}function getEndUser(_0x99a20f,_0x611834,_0x2f1dac,_0x114a20,_0x27175d,_0x27b069,_0xc5f5dd,_0xa19385){var _0x5c90b2=_0x27b069[_0xf06b('0x28')]()===_0xf06b('0x32')?_0x27175d[_0xf06b('0x29')]:_0x27175d[_0xf06b('0x2a')];return getAuthToken(_0x611834,_0x2f1dac,_0x27b069)['then'](function(_0x570dc2){_0xa19385=_0xa19385?_0xa19385:_0xf06b('0x33');var _0x2358b3={'method':_0xf06b('0x18'),'uri':_0x114a20+'contacts?$select='+_0xa19385+_0xf06b('0x34')+_0xa19385+_0xf06b('0x35')+_0x5c90b2[_0xf06b('0x36')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x570dc2,'If-None-Match':null,'OData-Version':_0xf06b('0x1b')},'json':!![]};return rp(_0x2358b3);})[_0xf06b('0x13')](function(_0x1110a6){var _0x5359de=![];if(!_0x1110a6)return _0x5359de;var _0xea9d03=_0x1110a6[_0xf06b('0x1c')];for(var _0x5811a8=0x0;_0x5811a8<_0xea9d03[_0xf06b('0x20')];_0x5811a8++){if(_0xea9d03[_0x5811a8][_0xa19385]===_0x5c90b2){_0x5359de=!![];_0x99a20f[_0xf06b('0x31')]=_0xea9d03[_0x5811a8]['contactid'];}}return _0x5359de;})[_0xf06b('0x13')](function(_0x47f804){if(_0x47f804)return _0x99a20f;if(_0xc5f5dd===_0xf06b('0x37')){logger[_0xf06b('0x22')]('['+[_0x27b069[_0xf06b('0x23')]()]+_0xf06b('0x38'));return _0x99a20f;}return createEndUser(_0x99a20f,_0x611834,_0x2f1dac,_0x114a20,_0x27175d,_0x27b069,_0xa19385)[_0xf06b('0x13')](function(_0x44f6c6){logger[_0xf06b('0x22')]('['+[_0x27b069['toUpperCase']()]+']\x20Enduser\x20created!',_0x44f6c6[_0xf06b('0x31')]);return _0x44f6c6;});});}function getCustomFields(_0x23b942,_0x9cd347,_0x2e4821){var _0x38cbf1={};if(_0x23b942[_0xf06b('0x20')]>0x0){_[_0xf06b('0x39')](_0x23b942,function(_0x2e316d){if(_['includes'](['string',_0xf06b('0x3a')],_0x2e316d[_0xf06b('0x3b')])&&_0x2e316d[_0xf06b('0x3c')]&&!_0x2e316d[_0xf06b('0x3d')]){var _0x5b9726=_0x2e316d[_0xf06b('0x3e')][_0xf06b('0x28')]();var _0x37a70e=_0x5b9726[_0xf06b('0x2f')](0x0,_0x5b9726[_0xf06b('0x3f')]('_'));var _0x27e3b6=_0x5b9726[_0xf06b('0x2f')](_0x5b9726[_0xf06b('0x3f')]('_')+0x1);if(_0x37a70e===_0x2e4821){_0x38cbf1[_0x27e3b6]=_0x2e316d[_0xf06b('0x40')];}}});}return _0x38cbf1;}function getTicket(_0x575716,_0x1f7097,_0x3118a0,_0x3fd8fa,_0xfc54e7,_0x153f1f,_0x5ba3f3){return new Promise(function(_0x363180,_0xabc74){var _0x336224;return getAuthToken(_0x1f7097,_0x3118a0,_0x5ba3f3)[_0xf06b('0x13')](function(_0x325921){if(_0x153f1f[_0xf06b('0x41')]===_0xf06b('0x42')){_0x336224={'method':_0xf06b('0xe'),'uri':_0x3fd8fa+_0xf06b('0x43'),'body':Object[_0xf06b('0x44')]({},{'title':intUtil[_0xf06b('0x45')](_0x153f1f['Subjects'],_0xfc54e7,'\x20'),'description':intUtil['getString'](_0x153f1f[_0xf06b('0x46')],_0xfc54e7,'\x0a'),'customerid_contact@odata.bind':_0x575716['enduserId']?_0xf06b('0x47')+_0x575716['enduserId']+')':undefined,'ownerid@odata.bind':_0xf06b('0x2c')+_0x575716[_0xf06b('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x153f1f[_0xf06b('0x48')],_0xfc54e7,_0x153f1f[_0xf06b('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x325921,'OData-Version':_0xf06b('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x153f1f[_0xf06b('0x41')]===_0xf06b('0x49')){var _0x2b4ca3=_0x575716[_0xf06b('0x31')]?[{'partyid_systemuser@odata.bind':_0xf06b('0x2c')+_0x575716[_0xf06b('0x26')]+')','participationtypemask':_0x575716['callDirection']===_0xf06b('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xf06b('0x47')+_0x575716[_0xf06b('0x31')]+')','participationtypemask':_0x575716['callDirection']===_0xf06b('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf06b('0x2c')+_0x575716['userId']+')','participationtypemask':_0x575716[_0xf06b('0x4b')]===_0xf06b('0x4a')?0x2:0x1}];_0x336224={'method':_0xf06b('0xe'),'uri':_0x3fd8fa+_0xf06b('0x4c'),'body':Object[_0xf06b('0x44')]({},{'subject':intUtil[_0xf06b('0x45')](_0x153f1f[_0xf06b('0x4d')],_0xfc54e7,'\x20'),'phonenumber':String(_0xfc54e7[_0xf06b('0x2a')]),'description':intUtil[_0xf06b('0x45')](_0x153f1f[_0xf06b('0x46')],_0xfc54e7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x575716[_0xf06b('0x31')]?_0xf06b('0x47')+_0x575716[_0xf06b('0x31')]+')':undefined,'ownerid@odata.bind':_0xf06b('0x2c')+_0x575716[_0xf06b('0x26')]+')','directioncode':_0x575716[_0xf06b('0x4b')]===_0xf06b('0x4a')?![]:!![],'phonecall_activity_parties':_0x2b4ca3},getCustomFields(_0x153f1f[_0xf06b('0x48')],_0xfc54e7,_0x153f1f['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x325921,'OData-Version':_0xf06b('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x336224);})[_0xf06b('0x13')](function(_0xf6d2cb){var _0x242ee2=_0xf6d2cb[_0xf06b('0x2e')][_0xf06b('0x4e')];var _0x5d0a48=_0x242ee2[_0xf06b('0x2f')](_0x242ee2[_0xf06b('0x30')]('(')+0x1,_0x242ee2[_0xf06b('0x30')](')'));_0x575716[_0xf06b('0x4f')]=_0x5d0a48;_0x363180(_0x575716);})[_0xf06b('0x14')](function(_0x5a5c51){_0xabc74(_0x5a5c51['message']);});});}function emit(_0x1531c0,_0x5c3861,_0x85013e,_0x1433ed){var _0x52539b={'uri':util[_0xf06b('0x50')](_0xf06b('0x51'),_0x1531c0,_0x85013e,_0x1433ed)};io['to'](util[_0xf06b('0x50')](_0xf06b('0x52'),_0x5c3861))['emit'](_0xf06b('0x53'),_0x52539b);}exports['cs']=function(_0x301324,_0x2aa8ca,_0x52fca9,_0x1c0a74,_0x2b919e,_0x174a74,_0x42976d,_0xe5813e){var _0x325c82={};_0x174a74['remoteUri']=_0x174a74[_0xf06b('0x9')]?intUtil['stripTrailingSlash'](_0x174a74[_0xf06b('0xb')]['data7']):intUtil['stripTrailingSlash'](_0x174a74[_0xf06b('0xa')]);_0x174a74[_0xf06b('0x54')]=intUtil[_0xf06b('0x55')](_0x174a74[_0xf06b('0x54')]);_0x325c82['callDirection']=_0xe5813e==='queue'||_0xe5813e===_0xf06b('0x56')?_0xf06b('0x4a'):_0xf06b('0x32');var _0x5cd027=_0x174a74[_0xf06b('0x9')]?util[_0xf06b('0x50')](_0xf06b('0x57'),_0x174a74[_0xf06b('0xb')][_0xf06b('0xc')]):util['format'](_0xf06b('0x57'),_0x174a74[_0xf06b('0xa')]);var _0xe77015=util['format'](_0xf06b('0x58'),_0x174a74[_0xf06b('0xd')]);var _0x592091=util[_0xf06b('0x50')](_0xf06b('0x59'),_0x174a74['serverUrl'],_0x2aa8ca[_0xf06b('0x5a')],md5(_0x2aa8ca[_0xf06b('0x5a')]));if(_0x2b919e&&_0x2b919e[_0xf06b('0x5b')]){logger[_0xf06b('0x22')](_0xf06b('0x5c'),_0xf06b('0x5d'));_0x2aa8ca[_0xf06b('0x5e')]=_0x592091;}else if(_0x42976d&&_0x42976d[_0xf06b('0x5f')]&&_0x42976d[_0xf06b('0x5f')]!==_0xf06b('0x60')){logger[_0xf06b('0x22')](_0xf06b('0x61'),_0xf06b('0x5d'));_0x2aa8ca['recordingURL']=_0x592091;}else{_0x2aa8ca[_0xf06b('0x5e')]='';}return getUser(_0x325c82,_0x174a74,_0x1c0a74,_0xe77015,_0x5cd027,_0xe5813e)[_0xf06b('0x13')](function(_0x3b02ec){logger[_0xf06b('0x22')]('['+_0xe5813e['toUpperCase']()+_0xf06b('0x62'),_0x3b02ec[_0xf06b('0x26')]);logger[_0xf06b('0x22')]('['+_0xe5813e[_0xf06b('0x23')]()+_0xf06b('0x63'),_0x3b02ec[_0xf06b('0x1f')]);return getEndUser(_0x3b02ec,_0x174a74,_0xe77015,_0x5cd027,_0x2aa8ca,_0xe5813e,_0x52fca9[_0xf06b('0x64')],_0x52fca9[_0xf06b('0x65')]);})[_0xf06b('0x13')](function(_0x319f17){logger[_0xf06b('0x22')]('['+_0xe5813e['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x319f17[_0xf06b('0x31')]);logger[_0xf06b('0x22')]('['+_0xe5813e[_0xf06b('0x23')]()+_0xf06b('0x66'),_0x2aa8ca['calleridnum']);return getTicket(_0x319f17,_0x174a74,_0xe77015,_0x5cd027,_0x2aa8ca,_0x52fca9,_0xe5813e);})[_0xf06b('0x13')](function(_0x100ead){logger['info'](util[_0xf06b('0x50')]('['+_0xe5813e[_0xf06b('0x23')]()+_0xf06b('0x67'),_0x52fca9[_0xf06b('0x41')],_0x100ead[_0xf06b('0x4f')]));logger[_0xf06b('0x22')](util[_0xf06b('0x50')]('['+_0xe5813e['toUpperCase']()+_0xf06b('0x68'),_0xe5813e));if(_0xe5813e!=='unmanaged'&&_0x52fca9[_0xf06b('0x69')]){logger[_0xf06b('0x22')]('['+_0xe5813e[_0xf06b('0x23')]()+']',_0xf06b('0x6a'));emit(_0x174a74['remoteUri'],_0x1c0a74['name'],_0x52fca9[_0xf06b('0x41')],_0x100ead[_0xf06b('0x4f')]);}})['catch'](function(_0x32c1fb){logger[_0xf06b('0x15')]('['+_0xe5813e['toUpperCase']()+_0xf06b('0x6b'),_0x32c1fb['message']);console[_0xf06b('0x15')](_0xf06b('0x6c'),_0x32c1fb);});}; \ No newline at end of file +var _0x8630=['trigger:browser:url','stripTrailingSlash','serverUrl','outbound','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','defaults','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','catch','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','type','customField','indexOf','content','incident','getString','Subjects','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','ticketType','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x8630,0x1cd));var _0x0863=function(_0x170668,_0x3ef761){_0x170668=_0x170668-0x0;var _0x199be9=_0x8630[_0x170668];return _0x199be9;};'use strict';var _=require(_0x0863('0x0'));var rp=require('request-promise');var util=require(_0x0863('0x1'));var intUtil=require(_0x0863('0x2'));var md5=require(_0x0863('0x3'));var Redis=require(_0x0863('0x4'));var logger=require(_0x0863('0x5'))(_0x0863('0x6'));var config=require('../../../../config/environment');config['redis']=_[_0x0863('0x7')](config[_0x0863('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0863('0x9'))(new Redis(config['redis']));function getAuthToken(_0x1a3114,_0x2af9e3,_0x15ee62){if(_0x1a3114[_0x0863('0xa')]){_0x1a3114[_0x0863('0xb')]=_0x1a3114[_0x0863('0xc')][_0x0863('0xd')];_0x1a3114[_0x0863('0xe')]=_0x1a3114[_0x0863('0xc')][_0x0863('0xf')];return Promise[_0x0863('0x10')](_0x1a3114[_0x0863('0xc')][_0x0863('0x11')]);}var _0x9f3d15={'method':_0x0863('0x12'),'uri':_0x2af9e3,'form':{'client_id':_0x1a3114[_0x0863('0x13')],'resource':_0x1a3114['remoteUri'],'username':_0x1a3114[_0x0863('0x14')],'password':_0x1a3114[_0x0863('0x15')],'grant_type':_0x0863('0x15'),'client_secret':_0x1a3114[_0x0863('0x16')]},'json':!![]};return rp(_0x9f3d15)['then'](function(_0x43e6cc){return _0x43e6cc['access_token'];})[_0x0863('0x17')](function(_0x5e11f9){logger[_0x0863('0x18')]('['+[_0x15ee62['toUpperCase']()]+_0x0863('0x19'));return _0x5e11f9[_0x0863('0x1a')];});}function getUser(_0x1b4ecb,_0x1b1073,_0x552322,_0x56a398,_0x1d2b55,_0xfa2552){return new Promise(function(_0x5d822b,_0x22958f){return getAuthToken(_0x1b1073,_0x56a398,_0xfa2552)[_0x0863('0x1b')](function(_0x30e277){var _0x22a5ab={'method':_0x0863('0x1c'),'uri':_0x1d2b55+_0x0863('0x1d'),'headers':{'Authorization':_0x0863('0x1e')+_0x30e277,'OData-Version':_0x0863('0x1f')},'json':!![]};return rp(_0x22a5ab);})[_0x0863('0x1b')](function(_0x266e5c){var _0x2e4c51=_0x266e5c[_0x0863('0x20')];var _0x3124ed=![];var _0x54e4ba=null;if(!_[_0x0863('0x21')](_0x552322)){if(intUtil[_0x0863('0x22')](_0x552322[_0x0863('0x23')])){_0x1b4ecb[_0x0863('0x24')]=_0x552322[_0x0863('0x23')];for(_0x54e4ba=0x0;_0x54e4ba<_0x2e4c51[_0x0863('0x25')];_0x54e4ba++){if(_0x2e4c51[_0x54e4ba][_0x0863('0x26')]===_0x552322[_0x0863('0x23')]&&!_0x2e4c51[_0x54e4ba][_0x0863('0x27')]){_0x3124ed=!![];logger[_0x0863('0x28')]('['+[_0xfa2552[_0x0863('0x29')]()]+_0x0863('0x2a')+_0x2e4c51[_0x54e4ba]['systemuserid']+'!');_0x1b4ecb[_0x0863('0x2b')]=_0x2e4c51[_0x54e4ba][_0x0863('0x2c')];}}}}if(!_0x3124ed){logger[_0x0863('0x28')]('['+[_0xfa2552[_0x0863('0x29')]()]+_0x0863('0x2d'));_0x1b4ecb[_0x0863('0x24')]=_0x1b1073[_0x0863('0x14')];for(_0x54e4ba=0x0;_0x54e4ba<_0x2e4c51[_0x0863('0x25')];_0x54e4ba++){if(_0x2e4c51[_0x54e4ba]['internalemailaddress']===_0x1b1073[_0x0863('0x14')]){_0x1b4ecb[_0x0863('0x2b')]=_0x2e4c51[_0x54e4ba][_0x0863('0x2c')];}}}_0x5d822b(_0x1b4ecb);})[_0x0863('0x17')](function(_0x270b35){_0x22958f(_0x270b35['message']);});});}function createEndUser(_0x4fa9a0,_0x4988bb,_0x8ca2e6,_0x51d82a,_0x41e1a2,_0x40d7c5,_0x331bd0){return new Promise(function(_0x434871,_0x6433f8){return getAuthToken(_0x4988bb,_0x8ca2e6,_0x40d7c5)['then'](function(_0x5d0b94){var _0x49dde5=_0x40d7c5[_0x0863('0x2e')]()==='outbound'?_0x41e1a2[_0x0863('0x2f')]:_0x41e1a2[_0x0863('0x30')];var _0x2dbe01={'method':_0x0863('0x12'),'uri':_0x51d82a+_0x0863('0x31'),'body':{'fullname':_0x49dde5,'firstname':_0x49dde5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0863('0x32')+_0x4fa9a0[_0x0863('0x2b')]+')'},'headers':{'Authorization':_0x0863('0x1e')+_0x5d0b94,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x2dbe01[_0x0863('0x33')][_0x331bd0]=_0x49dde5;return rp(_0x2dbe01);})[_0x0863('0x1b')](function(_0x2509af){var _0x2fb9ba=_0x2509af[_0x0863('0x34')][_0x0863('0x35')];var _0x5cd282=_0x2fb9ba[_0x0863('0x36')](_0x2fb9ba[_0x0863('0x37')]('(')+0x1,_0x2fb9ba[_0x0863('0x37')](')'));_0x4fa9a0[_0x0863('0x38')]=_0x5cd282;_0x434871(_0x4fa9a0);})[_0x0863('0x17')](function(_0x3d48ce){_0x6433f8(_0x3d48ce['message']);});});}function getEndUser(_0x2fe131,_0x1eda86,_0x49d82c,_0x245a60,_0x5d9710,_0x50d928,_0x4e79c7,_0x278f2e){var _0xf3a6ac=_0x50d928[_0x0863('0x2e')]()==='outbound'?_0x5d9710[_0x0863('0x2f')]:_0x5d9710[_0x0863('0x30')];return getAuthToken(_0x1eda86,_0x49d82c,_0x50d928)[_0x0863('0x1b')](function(_0x4bcf8d){_0x278f2e=_0x278f2e?_0x278f2e:'telephone1';var _0x5a5769={'method':_0x0863('0x1c'),'uri':_0x245a60+_0x0863('0x39')+_0x278f2e+_0x0863('0x3a')+_0x278f2e+_0x0863('0x3b')+_0xf3a6ac[_0x0863('0x3c')]('+',_0x0863('0x3d'))+'\x27','headers':{'Authorization':_0x0863('0x1e')+_0x4bcf8d,'If-None-Match':null,'OData-Version':_0x0863('0x1f')},'json':!![]};return rp(_0x5a5769);})[_0x0863('0x1b')](function(_0x453f40){var _0x4ebe71=![];if(!_0x453f40)return _0x4ebe71;var _0x114d3c=_0x453f40[_0x0863('0x20')];for(var _0x1abb59=0x0;_0x1abb59<_0x114d3c[_0x0863('0x25')];_0x1abb59++){if(_0x114d3c[_0x1abb59][_0x278f2e]===_0xf3a6ac){_0x4ebe71=!![];_0x2fe131['enduserId']=_0x114d3c[_0x1abb59][_0x0863('0x3e')];}}return _0x4ebe71;})['then'](function(_0x8fe55a){if(_0x8fe55a)return _0x2fe131;if(_0x4e79c7===_0x0863('0x3f')){logger[_0x0863('0x28')]('['+[_0x50d928[_0x0863('0x29')]()]+_0x0863('0x40'));return _0x2fe131;}return createEndUser(_0x2fe131,_0x1eda86,_0x49d82c,_0x245a60,_0x5d9710,_0x50d928,_0x278f2e)['then'](function(_0x351694){logger['info']('['+[_0x50d928[_0x0863('0x29')]()]+_0x0863('0x41'),_0x351694[_0x0863('0x38')]);return _0x351694;});});}function getCustomFields(_0x3b7c56,_0x388f7a,_0x4e4221){var _0x107f97={};if(_0x3b7c56[_0x0863('0x25')]>0x0){_[_0x0863('0x42')](_0x3b7c56,function(_0x4e4327){if(_['includes'](['string','picklist'],_0x4e4327[_0x0863('0x43')])&&_0x4e4327['nameField']&&!_0x4e4327[_0x0863('0x44')]){var _0x47702e=_0x4e4327['idField'][_0x0863('0x2e')]();var _0xfaf1b6=_0x47702e['substring'](0x0,_0x47702e[_0x0863('0x45')]('_'));var _0x285de7=_0x47702e[_0x0863('0x36')](_0x47702e[_0x0863('0x45')]('_')+0x1);if(_0xfaf1b6===_0x4e4221){_0x107f97[_0x285de7]=_0x4e4327[_0x0863('0x46')];}}});}return _0x107f97;}function getTicket(_0x1c3d08,_0x2cd79c,_0x31460f,_0x5ead1f,_0x40aa0d,_0x2d48b8,_0x2cfcb2){return new Promise(function(_0x44116a,_0x46d9a3){var _0x1ac09f;return getAuthToken(_0x2cd79c,_0x31460f,_0x2cfcb2)[_0x0863('0x1b')](function(_0x286f26){if(_0x2d48b8['ticketType']===_0x0863('0x47')){_0x1ac09f={'method':'POST','uri':_0x5ead1f+'incidents','body':Object['assign']({},{'title':intUtil[_0x0863('0x48')](_0x2d48b8[_0x0863('0x49')],_0x40aa0d,'\x20'),'description':intUtil['getString'](_0x2d48b8[_0x0863('0x4a')],_0x40aa0d,'\x0a'),'customerid_contact@odata.bind':_0x1c3d08[_0x0863('0x38')]?_0x0863('0x4b')+_0x1c3d08['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x1c3d08[_0x0863('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x2d48b8[_0x0863('0x4c')],_0x40aa0d,_0x2d48b8['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x286f26,'OData-Version':_0x0863('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2d48b8['ticketType']==='phonecall'){var _0xc9332b=_0x1c3d08[_0x0863('0x38')]?[{'partyid_systemuser@odata.bind':_0x0863('0x32')+_0x1c3d08[_0x0863('0x2b')]+')','participationtypemask':_0x1c3d08[_0x0863('0x4d')]===_0x0863('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x0863('0x4b')+_0x1c3d08[_0x0863('0x38')]+')','participationtypemask':_0x1c3d08['callDirection']===_0x0863('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0863('0x32')+_0x1c3d08[_0x0863('0x2b')]+')','participationtypemask':_0x1c3d08[_0x0863('0x4d')]===_0x0863('0x4e')?0x2:0x1}];_0x1ac09f={'method':_0x0863('0x12'),'uri':_0x5ead1f+_0x0863('0x4f'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x2d48b8['Subjects'],_0x40aa0d,'\x20'),'phonenumber':String(_0x40aa0d[_0x0863('0x30')]),'description':intUtil[_0x0863('0x48')](_0x2d48b8[_0x0863('0x4a')],_0x40aa0d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1c3d08[_0x0863('0x38')]?_0x0863('0x4b')+_0x1c3d08[_0x0863('0x38')]+')':undefined,'ownerid@odata.bind':_0x0863('0x32')+_0x1c3d08[_0x0863('0x2b')]+')','directioncode':_0x1c3d08[_0x0863('0x4d')]===_0x0863('0x4e')?![]:!![],'phonecall_activity_parties':_0xc9332b},getCustomFields(_0x2d48b8[_0x0863('0x4c')],_0x40aa0d,_0x2d48b8[_0x0863('0x50')])),'headers':{'Authorization':_0x0863('0x1e')+_0x286f26,'OData-Version':_0x0863('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1ac09f);})[_0x0863('0x1b')](function(_0xfe078c){var _0x1524f9=_0xfe078c[_0x0863('0x34')][_0x0863('0x35')];var _0x216a61=_0x1524f9[_0x0863('0x36')](_0x1524f9['lastIndexOf']('(')+0x1,_0x1524f9[_0x0863('0x37')](')'));_0x1c3d08['ticketId']=_0x216a61;_0x44116a(_0x1c3d08);})[_0x0863('0x17')](function(_0x577b49){_0x46d9a3(_0x577b49[_0x0863('0x1a')]);});});}function emit(_0x27807a,_0xf57f9,_0x47c329,_0x754c99){var _0x57fc52={'uri':util['format'](_0x0863('0x51'),_0x27807a,_0x47c329,_0x754c99)};io['to'](util[_0x0863('0x52')](_0x0863('0x53'),_0xf57f9))['emit'](_0x0863('0x54'),_0x57fc52);}exports['cs']=function(_0x2fd942,_0x3ed47b,_0x216d72,_0x1002d5,_0xa12f99,_0x447ad9,_0x2645ef,_0x49a5fc){var _0x591f2a={};_0x447ad9[_0x0863('0xb')]=_0x447ad9['modernAuthentication']?intUtil[_0x0863('0x55')](_0x447ad9[_0x0863('0xc')]['data7']):intUtil['stripTrailingSlash'](_0x447ad9[_0x0863('0xb')]);_0x447ad9[_0x0863('0x56')]=intUtil[_0x0863('0x55')](_0x447ad9[_0x0863('0x56')]);_0x591f2a[_0x0863('0x4d')]=_0x49a5fc==='queue'||_0x49a5fc==='unmanaged'?'queue':_0x0863('0x57');var _0x7184c7=_0x447ad9['modernAuthentication']?util['format']('%s/api/data/v9.0/',_0x447ad9[_0x0863('0xc')][_0x0863('0xd')]):util['format']('%s/api/data/v9.0/',_0x447ad9[_0x0863('0xb')]);var _0x42b162=util[_0x0863('0x52')](_0x0863('0x58'),_0x447ad9[_0x0863('0xe')]);var _0x37c003=util['format'](_0x0863('0x59'),_0x447ad9[_0x0863('0x56')],_0x3ed47b[_0x0863('0x5a')],md5(_0x3ed47b[_0x0863('0x5a')]));if(_0xa12f99&&_0xa12f99['monitor_format']){logger[_0x0863('0x28')](_0x0863('0x5b'),_0x0863('0x5c'));_0x3ed47b[_0x0863('0x5d')]=_0x37c003;}else if(_0x2645ef&&_0x2645ef[_0x0863('0x5e')]&&_0x2645ef[_0x0863('0x5e')]!==_0x0863('0x5f')){logger[_0x0863('0x28')](_0x0863('0x60'),_0x0863('0x5c'));_0x3ed47b['recordingURL']=_0x37c003;}else{_0x3ed47b[_0x0863('0x5d')]='';}return getUser(_0x591f2a,_0x447ad9,_0x1002d5,_0x42b162,_0x7184c7,_0x49a5fc)['then'](function(_0x3b7317){logger[_0x0863('0x28')]('['+_0x49a5fc[_0x0863('0x29')]()+']\x20The\x20User\x20ID\x20is:',_0x3b7317[_0x0863('0x2b')]);logger[_0x0863('0x28')]('['+_0x49a5fc['toUpperCase']()+_0x0863('0x61'),_0x3b7317[_0x0863('0x24')]);return getEndUser(_0x3b7317,_0x447ad9,_0x42b162,_0x7184c7,_0x3ed47b,_0x49a5fc,_0x216d72['moduleCreate'],_0x216d72[_0x0863('0x62')]);})['then'](function(_0x44cd73){logger[_0x0863('0x28')]('['+_0x49a5fc[_0x0863('0x29')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x44cd73[_0x0863('0x38')]);logger[_0x0863('0x28')]('['+_0x49a5fc[_0x0863('0x29')]()+_0x0863('0x63'),_0x3ed47b[_0x0863('0x30')]);return getTicket(_0x44cd73,_0x447ad9,_0x42b162,_0x7184c7,_0x3ed47b,_0x216d72,_0x49a5fc);})[_0x0863('0x1b')](function(_0x262b62){logger[_0x0863('0x28')](util[_0x0863('0x52')]('['+_0x49a5fc['toUpperCase']()+_0x0863('0x64'),_0x216d72[_0x0863('0x50')],_0x262b62['ticketId']));logger[_0x0863('0x28')](util[_0x0863('0x52')]('['+_0x49a5fc[_0x0863('0x29')]()+_0x0863('0x65'),_0x49a5fc));if(_0x49a5fc!==_0x0863('0x66')&&_0x216d72[_0x0863('0x67')]){logger[_0x0863('0x28')]('['+_0x49a5fc[_0x0863('0x29')]()+']',_0x0863('0x68'));emit(_0x447ad9[_0x0863('0xb')],_0x1002d5[_0x0863('0x69')],_0x216d72[_0x0863('0x50')],_0x262b62[_0x0863('0x6a')]);}})[_0x0863('0x17')](function(_0x5b1cf2){logger[_0x0863('0x18')]('['+_0x49a5fc[_0x0863('0x29')]()+_0x0863('0x6b'),_0x5b1cf2[_0x0863('0x1a')]);console[_0x0863('0x18')](_0x0863('0x6c'),_0x5b1cf2);});}; \ 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 04852d3..1dc38d8 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 _0x6669=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','stringify','GET','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','monitor_format','toUpperCase','lastevent','lodash','request-promise','md5','../../../../config/environment','redis','defaults','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','email'];(function(_0x4ba566,_0x1e59f2){var _0x5b2031=function(_0x1ddad0){while(--_0x1ddad0){_0x4ba566['push'](_0x4ba566['shift']());}};_0x5b2031(++_0x1e59f2);}(_0x6669,0x189));var _0x9666=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x6669[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x9666('0x0'));var rp=require(_0x9666('0x1'));var md5=require(_0x9666('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x9666('0x3'));var logger=require('../../../../config/logger')('freshdesk');config[_0x9666('0x4')]=_[_0x9666('0x5')](config[_0x9666('0x4')],{'host':_0x9666('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9666('0x4')]));var headers={'Content-Type':'application/json','Accept':_0x9666('0x7')};function emit(_0x38a848,_0x5df440,_0x4ab970){io['to'](_0x38a848)[_0x9666('0x8')](_0x5df440,_0x4ab970);}function getTicket(_0x3493a1,_0x435834,_0xd7f58f,_0x1e578b,_0x142ca6){logger[_0x9666('0x9')]('Creating\x20new\x20ticket...');var _0x6afc09=_[_0x9666('0xa')]({'responder_id':_0x435834['id'],'requester_id':_0xd7f58f['id'],'name':util[_0x9666('0xb')](_0x9666('0xc'),_0x142ca6[_0x9666('0xd')]),'phone':_0x142ca6['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9666('0xe')](_0x1e578b['Subjects'],_0x142ca6,'\x20'),'description':intUtil[_0x9666('0xe')](_0x1e578b[_0x9666('0xf')],_0x142ca6,_0x9666('0x10')),'tags':getTags(_0x1e578b[_0x9666('0x11')],_0x9666('0x12'))},getCustomFields(_0x1e578b[_0x9666('0x13')],_0x142ca6));_0x6afc09[_0x9666('0x14')]=_[_0x9666('0x15')](_[_0x9666('0x16')](_0x6afc09[_0x9666('0x14')],'id'),'value');return request({'uri':util[_0x9666('0xb')](_0x9666('0x17'),_0x3493a1[_0x9666('0x18')]),'method':_0x9666('0x19'),'body':_0x6afc09})[_0x9666('0x1a')](function(_0x200c33){logger[_0x9666('0x9')](_0x9666('0x1b'));return _0x200c33;});}function getUser(_0xabb6cd,_0x4b75b3){if(intUtil[_0x9666('0x1c')](_0x4b75b3)){return request({'uri':util[_0x9666('0xb')](_0x9666('0x1d'),_0xabb6cd[_0x9666('0x18')]),'qs':{'email':_0x4b75b3}})['then'](function(_0x25fe32){if(_0x25fe32[_0x9666('0x1e')]){logger['info']('Agent\x20found!');return _['find'](_0x25fe32,function(_0x410936){return _0x410936['contact'][_0x9666('0x1f')]===_0x4b75b3;});}else{logger[_0x9666('0x9')](_0x9666('0x20'));return request({'uri':util['format'](_0x9666('0x21'),_0xabb6cd[_0x9666('0x18')])})[_0x9666('0x1a')](function(_0x4fa57f){logger['info'](_0x9666('0x22'));return _0x4fa57f;});}});}else{logger[_0x9666('0x9')](_0x9666('0x23'));return request({'uri':util['format'](_0x9666('0x21'),_0xabb6cd['remoteUri'])})['then'](function(_0x40fdc9){logger[_0x9666('0x9')](_0x9666('0x22'));return _0x40fdc9;});}}function getEndUser(_0x31147a,_0x127a19,_0x50a260){logger['info']('Searching\x20enduser\x20with\x20phone',_0x50a260);return request({'uri':util[_0x9666('0xb')]('%s/api/v2/contacts',_0x31147a[_0x9666('0x18')]),'qs':{'phone':_0x50a260}})[_0x9666('0x1a')](function(_0x424bb2){if(_0x424bb2[_0x9666('0x1e')]){logger[_0x9666('0x9')]('Enduser\x20found!');return _[_0x9666('0x24')](_0x424bb2,{'phone':_0x50a260});}else{logger['info'](_0x9666('0x25'));return request({'uri':util[_0x9666('0xb')](_0x9666('0x26'),_0x31147a[_0x9666('0x18')]),'method':_0x9666('0x19'),'body':{'name':_0x127a19,'phone':_0x50a260}})[_0x9666('0x1a')](function(_0xbad8cd){logger['info'](_0x9666('0x27'));return _0xbad8cd;});}});}function getAuth(_0x5cadba){return util[_0x9666('0xb')](_0x9666('0x28'),new Buffer(_0x5cadba[_0x9666('0x29')]+':X')[_0x9666('0x2a')]('base64'));}function request(_0x4c1d2c){logger[_0x9666('0x2b')]('[HTTP]',JSON[_0x9666('0x2c')](_0x4c1d2c));return rp(_[_0x9666('0x5')](_0x4c1d2c,{'method':_0x9666('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x33ec2f,_0x40f195){var _0x245525=[];if(_0x33ec2f&&_0x33ec2f[_0x9666('0x1e')]>0x0){_0x245525=_['map'](_0x33ec2f,_0x40f195);}return _0x245525;}function getCustomFields(_0x491a45,_0x4e085c){var _0x16e4ef=[];var _0x48c05d={'custom_fields':[]};if(_0x491a45[_0x9666('0x1e')]>0x0){_['forEach'](_0x491a45,function(_0x1c9828){if(_[_0x9666('0x2e')]([_0x9666('0x2f'),_0x9666('0x30')],_0x1c9828[_0x9666('0x31')])&&_0x1c9828[_0x9666('0x32')]&&!_0x1c9828['customField']){_0x48c05d[_0x1c9828[_0x9666('0x32')][_0x9666('0x33')]()]=_0x1c9828[_0x9666('0x34')]['toString']();}else if(_[_0x9666('0x2e')](['string','picklist'],_0x1c9828[_0x9666('0x31')])&&_0x1c9828[_0x9666('0x35')]&&_0x1c9828[_0x9666('0x36')]){_0x48c05d['custom_fields'][_0x9666('0x37')]({'id':_0x1c9828[_0x9666('0x35')],'value':_0x1c9828[_0x9666('0x34')][_0x9666('0x2a')]()});}else if(_0x1c9828[_0x9666('0x31')]==='variable'&&_0x1c9828['variableName']&&_0x1c9828['idField']&&_0x1c9828[_0x9666('0x36')]){_0x4e085c[_0x1c9828[_0x9666('0x38')]]&&_0x48c05d[_0x9666('0x14')][_0x9666('0x37')]({'id':_0x1c9828[_0x9666('0x35')],'value':_0x4e085c[_0x1c9828[_0x9666('0x38')]]['toString']()});}else if(_0x1c9828['type']===_0x9666('0x39')&&_0x1c9828[_0x9666('0x3a')]&&_0x1c9828[_0x9666('0x3a')][_0x9666('0x12')]&&_0x1c9828[_0x9666('0x35')]&&_0x1c9828[_0x9666('0x36')]){_0x4e085c[_0x1c9828[_0x9666('0x3a')]['name']['toLowerCase']()]&&_0x48c05d[_0x9666('0x14')][_0x9666('0x37')]({'id':_0x1c9828[_0x9666('0x35')],'value':_0x4e085c[_0x1c9828[_0x9666('0x3a')]['name'][_0x9666('0x33')]()][_0x9666('0x2a')]()});}});}return _0x48c05d;}exports[_0x9666('0x3b')]=function(_0x5e5b6e,_0x16d6c5,_0x40eed6,_0xfa2e3,_0x26047d,_0x6d099a){var _0x4c01e9,_0x10ba9e;_0x6d099a[_0x9666('0x18')]=intUtil[_0x9666('0x3c')](_0x6d099a[_0x9666('0x18')]);_0x6d099a[_0x9666('0x3d')]=intUtil[_0x9666('0x3c')](_0x6d099a[_0x9666('0x3d')]);if(_0x26047d&&_0x26047d['monitor_format']){logger[_0x9666('0x9')](_0x9666('0x3e'),_0x9666('0x3f'));_0x16d6c5['recordingURL']=util[_0x9666('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6d099a[_0x9666('0x3d')],_0x16d6c5[_0x9666('0x40')],md5(_0x16d6c5[_0x9666('0x40')]));}else{_0x16d6c5[_0x9666('0x41')]='';}headers[_0x9666('0x42')]=getAuth(_0x6d099a);return getUser(_0x6d099a,_0xfa2e3[_0x9666('0x1f')])[_0x9666('0x1a')](function(_0x36960b){_0x4c01e9=_0x36960b;logger[_0x9666('0x9')]('The\x20User\x20ID\x20is:',_0x4c01e9['id']);return getEndUser(_0x6d099a,_0x16d6c5[_0x9666('0xd')],_0x16d6c5[_0x9666('0x43')]);})[_0x9666('0x1a')](function(_0x47d580){_0x10ba9e=_0x47d580;logger['info']('The\x20Enduser\x20ID\x20is:',_0x10ba9e['id']);return getTicket(_0x6d099a,_0x4c01e9,_0x10ba9e,_0x40eed6,_0x16d6c5);})[_0x9666('0x1a')](function(_0x510ef0){if(_0x510ef0&&_0x510ef0['id']){logger[_0x9666('0x9')](_0x9666('0x1b'));logger[_0x9666('0x9')](_0x9666('0x44'),_0x510ef0['id']);logger['info']('[QUEUE]',_0x9666('0x45'));emit(util[_0x9666('0xb')](_0x9666('0x46'),_0xfa2e3[_0x9666('0x12')]),_0x9666('0x47'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x6d099a[_0x9666('0x18')],_0x510ef0['id'])});}})[_0x9666('0x48')](function(_0x425368){logger[_0x9666('0x49')]('[QUEUE]',JSON[_0x9666('0x2c')](_0x425368));});};exports['outbound']=function(_0x5b5d7b,_0x1c23ae,_0x326abc,_0x54e74f,_0x390328,_0x3a093a,_0x28e8be){var _0x9549,_0x1e6360;_0x3a093a['remoteUri']=intUtil[_0x9666('0x3c')](_0x3a093a[_0x9666('0x18')]);_0x3a093a['serverUrl']=intUtil[_0x9666('0x3c')](_0x3a093a[_0x9666('0x3d')]);if(_0x28e8be&&_0x28e8be[_0x9666('0x4a')]&&_0x28e8be['recordingFormat']!==_0x9666('0x4b')){logger['info'](_0x9666('0x4c'),_0x9666('0x3f'));_0x1c23ae['recordingURL']=util[_0x9666('0xb')](_0x9666('0x4d'),_0x3a093a['serverUrl'],_0x1c23ae['uniqueid'],md5(_0x1c23ae[_0x9666('0x40')]));}headers[_0x9666('0x42')]=getAuth(_0x3a093a);return getUser(_0x3a093a,_0x54e74f[_0x9666('0x1f')])[_0x9666('0x1a')](function(_0x58d7f6){_0x9549=_0x58d7f6;logger[_0x9666('0x9')](_0x9666('0x4e'),_0x9549['id']);return getEndUser(_0x3a093a,_0x1c23ae['destcalleridname'],_0x1c23ae[_0x9666('0x4f')]);})[_0x9666('0x1a')](function(_0x1ea89b){_0x1e6360=_0x1ea89b;logger[_0x9666('0x9')](_0x9666('0x50'),_0x1e6360['id']);return getTicket(_0x3a093a,_0x9549,_0x1e6360,_0x326abc,_0x1c23ae);})[_0x9666('0x1a')](function(_0x28cda7){if(_0x28cda7&&_0x28cda7['id']){logger['info']('Ticket\x20created!');logger[_0x9666('0x9')](_0x9666('0x44'),_0x28cda7['id']);logger[_0x9666('0x9')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x9666('0x46'),_0x54e74f[_0x9666('0x12')]),_0x9666('0x47'),{'uri':util[_0x9666('0xb')](_0x9666('0x51'),_0x3a093a[_0x9666('0x18')],_0x28cda7['id'])});}})[_0x9666('0x48')](function(_0x2daae2){logger[_0x9666('0x49')](_0x9666('0x4c'),JSON[_0x9666('0x2c')](_0x2daae2));});};exports['unmanaged']=function(_0x47569d,_0x46e65d,_0x3b9cfa,_0x231c1e,_0x18c7eb,_0x5cdff0){var _0x42a628,_0x22f64d;_0x5cdff0[_0x9666('0x18')]=intUtil[_0x9666('0x3c')](_0x5cdff0['remoteUri']);_0x5cdff0[_0x9666('0x3d')]=intUtil[_0x9666('0x3c')](_0x5cdff0['serverUrl']);if(_0x18c7eb&&_0x18c7eb[_0x9666('0x52')]){logger[_0x9666('0x9')]('['+_0x46e65d['lastevent'][_0x9666('0x53')]()+']',_0x9666('0x3f'));_0x46e65d[_0x9666('0x41')]=util[_0x9666('0xb')](_0x9666('0x4d'),_0x5cdff0['serverUrl'],_0x46e65d[_0x9666('0x40')],md5(_0x46e65d[_0x9666('0x40')]));}else{_0x46e65d[_0x9666('0x41')]='';}headers[_0x9666('0x42')]=getAuth(_0x5cdff0);return getUser(_0x5cdff0,'')[_0x9666('0x1a')](function(_0x1139dc){_0x42a628=_0x1139dc;logger['info'](_0x9666('0x4e'),_0x42a628['id']);return getEndUser(_0x5cdff0,_0x46e65d[_0x9666('0xd')],_0x46e65d['calleridnum']);})['then'](function(_0x510d47){_0x22f64d=_0x510d47;logger[_0x9666('0x9')](_0x9666('0x50'),_0x22f64d['id']);return getTicket(_0x5cdff0,_0x42a628,_0x22f64d,_0x3b9cfa,_0x46e65d);})[_0x9666('0x1a')](function(_0x35a2ce){if(_0x35a2ce){logger[_0x9666('0x9')](_0x9666('0x1b'));logger[_0x9666('0x9')]('The\x20Ticket\x20ID\x20is:',_0x35a2ce['id']);}})['catch'](function(_0x296e5c){logger['error']('['+_0x46e65d[_0x9666('0x54')][_0x9666('0x53')]()+']',JSON['stringify'](_0x296e5c));});}; \ No newline at end of file +var _0x8bed=['defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','name','custom_fields','mapValues','keyBy','value','POST','then','Ticket\x20created!','validateEmail','remoteUri','length','find','contact','email','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','[HTTP]','stringify','GET','map','string','picklist','type','nameField','toLowerCase','content','idField','variable','variableName','customField','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:browser:url','lastevent','toUpperCase','error','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8bed,0xa6));var _0xd8be=function(_0x2d2949,_0x24c559){_0x2d2949=_0x2d2949-0x0;var _0x4bb11f=_0x8bed[_0x2d2949];return _0x4bb11f;};'use strict';var _=require('lodash');var rp=require(_0xd8be('0x0'));var md5=require(_0xd8be('0x1'));var util=require(_0xd8be('0x2'));var Redis=require(_0xd8be('0x3'));var intUtil=require(_0xd8be('0x4'));var config=require(_0xd8be('0x5'));var logger=require(_0xd8be('0x6'))('freshdesk');config[_0xd8be('0x7')]=_[_0xd8be('0x8')](config[_0xd8be('0x7')],{'host':_0xd8be('0x9'),'port':0x18eb});var io=require(_0xd8be('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xd8be('0xb'),'Accept':'application/json'};function emit(_0x1010a2,_0x396c37,_0x13be55){io['to'](_0x1010a2)[_0xd8be('0xc')](_0x396c37,_0x13be55);}function getTicket(_0x58ccbf,_0x45f1e3,_0x39e993,_0x15f60b,_0x357580){logger[_0xd8be('0xd')](_0xd8be('0xe'));var _0x2883c1=_['merge']({'responder_id':_0x45f1e3['id'],'requester_id':_0x39e993['id'],'name':util[_0xd8be('0xf')](_0xd8be('0x10'),_0x357580[_0xd8be('0x11')]),'phone':_0x357580[_0xd8be('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd8be('0x13')](_0x15f60b[_0xd8be('0x14')],_0x357580,'\x20'),'description':intUtil[_0xd8be('0x13')](_0x15f60b['Descriptions'],_0x357580,_0xd8be('0x15')),'tags':getTags(_0x15f60b[_0xd8be('0x16')],_0xd8be('0x17'))},getCustomFields(_0x15f60b['Fields'],_0x357580));_0x2883c1[_0xd8be('0x18')]=_[_0xd8be('0x19')](_[_0xd8be('0x1a')](_0x2883c1['custom_fields'],'id'),_0xd8be('0x1b'));return request({'uri':util[_0xd8be('0xf')]('%s/api/v2/tickets',_0x58ccbf['remoteUri']),'method':_0xd8be('0x1c'),'body':_0x2883c1})[_0xd8be('0x1d')](function(_0x21a3ac){logger[_0xd8be('0xd')](_0xd8be('0x1e'));return _0x21a3ac;});}function getUser(_0x46329d,_0x4406b){if(intUtil[_0xd8be('0x1f')](_0x4406b)){return request({'uri':util[_0xd8be('0xf')]('%s/api/v2/agents',_0x46329d[_0xd8be('0x20')]),'qs':{'email':_0x4406b}})['then'](function(_0x509a75){if(_0x509a75[_0xd8be('0x21')]){logger['info']('Agent\x20found!');return _[_0xd8be('0x22')](_0x509a75,function(_0x2e358c){return _0x2e358c[_0xd8be('0x23')][_0xd8be('0x24')]===_0x4406b;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd8be('0xf')]('%s/api/v2/agents/me',_0x46329d[_0xd8be('0x20')])})[_0xd8be('0x1d')](function(_0x11208d){logger['info'](_0xd8be('0x25'));return _0x11208d;});}});}else{logger[_0xd8be('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd8be('0xf')](_0xd8be('0x26'),_0x46329d['remoteUri'])})['then'](function(_0x515daf){logger['info'](_0xd8be('0x25'));return _0x515daf;});}}function getEndUser(_0x4f6f11,_0x1010b6,_0x1890e9){logger['info'](_0xd8be('0x27'),_0x1890e9);return request({'uri':util[_0xd8be('0xf')](_0xd8be('0x28'),_0x4f6f11[_0xd8be('0x20')]),'qs':{'phone':_0x1890e9}})[_0xd8be('0x1d')](function(_0x52c097){if(_0x52c097['length']){logger[_0xd8be('0xd')]('Enduser\x20found!');return _[_0xd8be('0x22')](_0x52c097,{'phone':_0x1890e9});}else{logger[_0xd8be('0xd')](_0xd8be('0x29'));return request({'uri':util[_0xd8be('0xf')](_0xd8be('0x28'),_0x4f6f11[_0xd8be('0x20')]),'method':_0xd8be('0x1c'),'body':{'name':_0x1010b6,'phone':_0x1890e9}})[_0xd8be('0x1d')](function(_0x385443){logger[_0xd8be('0xd')](_0xd8be('0x2a'));return _0x385443;});}});}function getAuth(_0xe103da){return util[_0xd8be('0xf')]('Basic\x20%s',new Buffer(_0xe103da[_0xd8be('0x2b')]+':X')[_0xd8be('0x2c')](_0xd8be('0x2d')));}function request(_0x3b5749){logger['debug'](_0xd8be('0x2e'),JSON[_0xd8be('0x2f')](_0x3b5749));return rp(_['defaults'](_0x3b5749,{'method':_0xd8be('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x54be1c,_0x42908e){var _0x856e70=[];if(_0x54be1c&&_0x54be1c[_0xd8be('0x21')]>0x0){_0x856e70=_[_0xd8be('0x31')](_0x54be1c,_0x42908e);}return _0x856e70;}function getCustomFields(_0x6a7de4,_0x37a571){var _0x332655=[];var _0x437b22={'custom_fields':[]};if(_0x6a7de4[_0xd8be('0x21')]>0x0){_['forEach'](_0x6a7de4,function(_0x3113f5){if(_['includes']([_0xd8be('0x32'),_0xd8be('0x33')],_0x3113f5[_0xd8be('0x34')])&&_0x3113f5[_0xd8be('0x35')]&&!_0x3113f5['customField']){_0x437b22[_0x3113f5['nameField'][_0xd8be('0x36')]()]=_0x3113f5[_0xd8be('0x37')]['toString']();}else if(_['includes']([_0xd8be('0x32'),'picklist'],_0x3113f5[_0xd8be('0x34')])&&_0x3113f5['idField']&&_0x3113f5['customField']){_0x437b22[_0xd8be('0x18')]['push']({'id':_0x3113f5[_0xd8be('0x38')],'value':_0x3113f5[_0xd8be('0x37')][_0xd8be('0x2c')]()});}else if(_0x3113f5[_0xd8be('0x34')]===_0xd8be('0x39')&&_0x3113f5[_0xd8be('0x3a')]&&_0x3113f5[_0xd8be('0x38')]&&_0x3113f5[_0xd8be('0x3b')]){_0x37a571[_0x3113f5['variableName']]&&_0x437b22[_0xd8be('0x18')]['push']({'id':_0x3113f5[_0xd8be('0x38')],'value':_0x37a571[_0x3113f5['variableName']][_0xd8be('0x2c')]()});}else if(_0x3113f5[_0xd8be('0x34')]==='customVariable'&&_0x3113f5[_0xd8be('0x3c')]&&_0x3113f5[_0xd8be('0x3c')][_0xd8be('0x17')]&&_0x3113f5[_0xd8be('0x38')]&&_0x3113f5[_0xd8be('0x3b')]){_0x37a571[_0x3113f5['Variable'][_0xd8be('0x17')]['toLowerCase']()]&&_0x437b22[_0xd8be('0x18')]['push']({'id':_0x3113f5[_0xd8be('0x38')],'value':_0x37a571[_0x3113f5[_0xd8be('0x3c')][_0xd8be('0x17')]['toLowerCase']()][_0xd8be('0x2c')]()});}});}return _0x437b22;}exports[_0xd8be('0x3d')]=function(_0x2c1bd2,_0x2478f2,_0x1eaf01,_0x40d3ab,_0x377459,_0x4c18ee){var _0x10baf4,_0x8cc131;_0x4c18ee[_0xd8be('0x20')]=intUtil[_0xd8be('0x3e')](_0x4c18ee['remoteUri']);_0x4c18ee[_0xd8be('0x3f')]=intUtil['stripTrailingSlash'](_0x4c18ee['serverUrl']);if(_0x377459&&_0x377459[_0xd8be('0x40')]){logger[_0xd8be('0xd')](_0xd8be('0x41'),_0xd8be('0x42'));_0x2478f2[_0xd8be('0x43')]=util[_0xd8be('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c18ee[_0xd8be('0x3f')],_0x2478f2[_0xd8be('0x44')],md5(_0x2478f2[_0xd8be('0x44')]));}else{_0x2478f2[_0xd8be('0x43')]='';}headers[_0xd8be('0x45')]=getAuth(_0x4c18ee);return getUser(_0x4c18ee,_0x40d3ab[_0xd8be('0x24')])[_0xd8be('0x1d')](function(_0x5c1b98){_0x10baf4=_0x5c1b98;logger[_0xd8be('0xd')](_0xd8be('0x46'),_0x10baf4['id']);return getEndUser(_0x4c18ee,_0x2478f2['calleridname'],_0x2478f2['calleridnum']);})[_0xd8be('0x1d')](function(_0x985453){_0x8cc131=_0x985453;logger['info']('The\x20Enduser\x20ID\x20is:',_0x8cc131['id']);return getTicket(_0x4c18ee,_0x10baf4,_0x8cc131,_0x1eaf01,_0x2478f2);})[_0xd8be('0x1d')](function(_0x249b71){if(_0x249b71&&_0x249b71['id']){logger['info'](_0xd8be('0x1e'));logger['info'](_0xd8be('0x47'),_0x249b71['id']);logger[_0xd8be('0xd')](_0xd8be('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd8be('0xf')](_0xd8be('0x48'),_0x40d3ab['name']),'trigger:browser:url',{'uri':util[_0xd8be('0xf')](_0xd8be('0x49'),_0x4c18ee[_0xd8be('0x20')],_0x249b71['id'])});}})[_0xd8be('0x4a')](function(_0x5386f5){logger['error']('[QUEUE]',JSON[_0xd8be('0x2f')](_0x5386f5));});};exports[_0xd8be('0x4b')]=function(_0x5a8fbd,_0x4c9863,_0x4b4d9c,_0x5bb8eb,_0x550253,_0x2a65ca,_0x9ba952){var _0xe00a55,_0x23388e;_0x2a65ca[_0xd8be('0x20')]=intUtil[_0xd8be('0x3e')](_0x2a65ca[_0xd8be('0x20')]);_0x2a65ca[_0xd8be('0x3f')]=intUtil[_0xd8be('0x3e')](_0x2a65ca[_0xd8be('0x3f')]);if(_0x9ba952&&_0x9ba952[_0xd8be('0x4c')]&&_0x9ba952[_0xd8be('0x4c')]!==_0xd8be('0x4d')){logger[_0xd8be('0xd')](_0xd8be('0x4e'),_0xd8be('0x42'));_0x4c9863[_0xd8be('0x43')]=util[_0xd8be('0xf')](_0xd8be('0x4f'),_0x2a65ca[_0xd8be('0x3f')],_0x4c9863['uniqueid'],md5(_0x4c9863[_0xd8be('0x44')]));}headers[_0xd8be('0x45')]=getAuth(_0x2a65ca);return getUser(_0x2a65ca,_0x5bb8eb[_0xd8be('0x24')])[_0xd8be('0x1d')](function(_0x5ba3db){_0xe00a55=_0x5ba3db;logger['info'](_0xd8be('0x46'),_0xe00a55['id']);return getEndUser(_0x2a65ca,_0x4c9863[_0xd8be('0x50')],_0x4c9863[_0xd8be('0x51')]);})[_0xd8be('0x1d')](function(_0x45c8fc){_0x23388e=_0x45c8fc;logger['info'](_0xd8be('0x52'),_0x23388e['id']);return getTicket(_0x2a65ca,_0xe00a55,_0x23388e,_0x4b4d9c,_0x4c9863);})[_0xd8be('0x1d')](function(_0x4e0f7f){if(_0x4e0f7f&&_0x4e0f7f['id']){logger[_0xd8be('0xd')]('Ticket\x20created!');logger[_0xd8be('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4e0f7f['id']);logger[_0xd8be('0xd')](_0xd8be('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd8be('0xf')](_0xd8be('0x48'),_0x5bb8eb['name']),_0xd8be('0x53'),{'uri':util[_0xd8be('0xf')](_0xd8be('0x49'),_0x2a65ca[_0xd8be('0x20')],_0x4e0f7f['id'])});}})['catch'](function(_0x3dbffa){logger['error'](_0xd8be('0x4e'),JSON[_0xd8be('0x2f')](_0x3dbffa));});};exports['unmanaged']=function(_0xfd46fa,_0x305fbc,_0x107ce1,_0x453f4e,_0x5b915c,_0xc7e91f){var _0x4b125c,_0x279421;_0xc7e91f[_0xd8be('0x20')]=intUtil[_0xd8be('0x3e')](_0xc7e91f['remoteUri']);_0xc7e91f['serverUrl']=intUtil[_0xd8be('0x3e')](_0xc7e91f[_0xd8be('0x3f')]);if(_0x5b915c&&_0x5b915c[_0xd8be('0x40')]){logger[_0xd8be('0xd')]('['+_0x305fbc[_0xd8be('0x54')][_0xd8be('0x55')]()+']',_0xd8be('0x42'));_0x305fbc[_0xd8be('0x43')]=util['format'](_0xd8be('0x4f'),_0xc7e91f['serverUrl'],_0x305fbc['uniqueid'],md5(_0x305fbc[_0xd8be('0x44')]));}else{_0x305fbc[_0xd8be('0x43')]='';}headers['Authorization']=getAuth(_0xc7e91f);return getUser(_0xc7e91f,'')['then'](function(_0x528770){_0x4b125c=_0x528770;logger[_0xd8be('0xd')](_0xd8be('0x46'),_0x4b125c['id']);return getEndUser(_0xc7e91f,_0x305fbc[_0xd8be('0x11')],_0x305fbc[_0xd8be('0x12')]);})[_0xd8be('0x1d')](function(_0x4a8c84){_0x279421=_0x4a8c84;logger[_0xd8be('0xd')](_0xd8be('0x52'),_0x279421['id']);return getTicket(_0xc7e91f,_0x4b125c,_0x279421,_0x107ce1,_0x305fbc);})[_0xd8be('0x1d')](function(_0x436754){if(_0x436754){logger['info'](_0xd8be('0x1e'));logger[_0xd8be('0xd')](_0xd8be('0x47'),_0x436754['id']);}})[_0xd8be('0x4a')](function(_0x43585){logger[_0xd8be('0x56')]('['+_0x305fbc[_0xd8be('0x54')][_0xd8be('0x55')]()+']',JSON[_0xd8be('0x2f')](_0x43585));});}; \ 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 2a04f92..d323bac 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 _0x232f=[']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','then','users','length','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','headers','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','adminEmail','adminId','error','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Descriptions','Contact','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name'];(function(_0x4a372d,_0x3bd91f){var _0x546ac0=function(_0x1311f5){while(--_0x1311f5){_0x4a372d['push'](_0x4a372d['shift']());}};_0x546ac0(++_0x3bd91f);}(_0x232f,0xa9));var _0xf232=function(_0x4583f5,_0x48986e){_0x4583f5=_0x4583f5-0x0;var _0x16513b=_0x232f[_0x4583f5];return _0x16513b;};'use strict';var _=require(_0xf232('0x0'));var rp=require(_0xf232('0x1'));var md5=require(_0xf232('0x2'));var util=require(_0xf232('0x3'));var moment=require('moment');var Promise=require(_0xf232('0x4'));var Redis=require(_0xf232('0x5'));var intUtil=require(_0xf232('0x6'));var config=require(_0xf232('0x7'));var logger=require(_0xf232('0x8'))(_0xf232('0x9'));config[_0xf232('0xa')]=_[_0xf232('0xb')](config[_0xf232('0xa')],{'host':_0xf232('0xc'),'port':0x18eb});var io=require(_0xf232('0xd'))(new Redis(config[_0xf232('0xa')]));function getAdminId(_0x491c90,_0x19dc61,_0x144e56,_0x314c3a){return new Promise(function(_0x1fed48,_0x27510b){var _0x57bbca=![];var _0x4e6356={'method':_0xf232('0xe'),'uri':_0x314c3a+_0xf232('0xf'),'json':!![]};_0x4e6356['headers']=_0x144e56;logger[_0xf232('0x10')]('Getting\x20admin\x20information');return rp(_0x4e6356)[_0xf232('0x11')](function(_0x49a222){if(_0x49a222){var _0x1cdb6c=_0x49a222[_0xf232('0x12')];var _0x2d8c06=null;for(_0x2d8c06=0x0;_0x2d8c06<_0x1cdb6c[_0xf232('0x13')];_0x2d8c06++){if(_0x1cdb6c[_0x2d8c06]['email']===_0x491c90['adminEmail']){_0x491c90['adminId']=_0x1cdb6c[_0x2d8c06]['id'];_0x57bbca=!![];}}if(_0x57bbca){logger[_0xf232('0x10')](_0xf232('0x14'),_0x491c90['adminId']);_0x1fed48(_0x491c90);}else{_0x27510b({'statusCode':0x194,'message':_0xf232('0x15')});}}else{_0x27510b({'statusCode':0x194,'message':_0xf232('0x15')});}})[_0xf232('0x16')](function(_0x1a20e1){logger['error']('['+[_0x19dc61[_0xf232('0x17')]()]+']',_0x1a20e1[_0xf232('0x18')]);_0x27510b(_0x1a20e1);});});}function getUser(_0x44820a,_0x3185d1,_0x509769){return function(_0x3ffe7d){return new Promise(function(_0x52bb6c,_0x1b3621){var _0xa20261={'method':_0xf232('0xe'),'uri':_0x509769+_0xf232('0xf'),'json':!![]};_0xa20261[_0xf232('0x19')]=_0x3185d1;logger[_0xf232('0x10')]('Getting\x20user\x20list');return rp(_0xa20261)[_0xf232('0x11')](function(_0x28ed31){if(_0x28ed31){var _0x3ce1fa=_0x28ed31[_0xf232('0x12')];var _0x522b5e=![];var _0x572a71=null;if(_0x3ffe7d[_0xf232('0x1a')]!==null){logger[_0xf232('0x10')](_0xf232('0x1b'),_0x3ffe7d[_0xf232('0x1a')]);_0x3ffe7d[_0xf232('0x1c')]=_0x3ffe7d[_0xf232('0x1a')];for(_0x572a71=0x0;_0x572a71<_0x3ce1fa[_0xf232('0x13')];_0x572a71++){if(_0x3ce1fa[_0x572a71]['email']===_0x3ffe7d[_0xf232('0x1a')]){_0x522b5e=!![];_0x3ffe7d['userId']=_0x3ce1fa[_0x572a71]['id'];logger[_0xf232('0x10')]('User\x20found:',_0x3ffe7d[_0xf232('0x1d')]);}}}if(!_0x522b5e){logger[_0xf232('0x10')](_0xf232('0x1e'));_0x3ffe7d[_0xf232('0x1c')]=_0x3ffe7d[_0xf232('0x1f')];_0x3ffe7d[_0xf232('0x1d')]=_0x3ffe7d[_0xf232('0x20')];_0x522b5e=!![];}if(_0x522b5e){_0x52bb6c(_0x3ffe7d);}else{_0x1b3621({'statusCode':0x194,'message':_0xf232('0x15')});}}else{_0x1b3621({'statusCode':0x194,'message':_0xf232('0x15')});}})[_0xf232('0x16')](function(_0x1a952e){logger[_0xf232('0x21')]('['+[_0x44820a[_0xf232('0x17')]()]+']',_0x1a952e[_0xf232('0x18')]);_0x1b3621(_0x1a952e);});});};}function searchContact(_0x3d97ce,_0x33bbb7,_0x5c6ae4,_0x3b38ce){return new Promise(function(_0x519a33,_0x5c6367){var _0x9d4b1f={'method':_0xf232('0xe'),'headers':_0x33bbb7,'uri':_0x3d97ce+'/api/lookup?q='+_0x3b38ce+_0xf232('0x22')+_0x5c6ae4+_0xf232('0x23'),'json':!![]};rp(_0x9d4b1f)[_0xf232('0x11')](function(_0x231ed7){var _0x211f0b=_[_0xf232('0x24')](_0x231ed7[_0xf232('0x25')]['contacts'],[_0x5c6ae4,_0x3b38ce]);_0x519a33(_0x211f0b);})['catch'](function(_0x1bc9ec){_0x5c6367(_0x1bc9ec);});});}function getEndUser(_0x5a7490,_0xb31f1a,_0x13a35c){return function(_0x2c8caf){return new Promise(function(_0x28a098,_0x22876d){logger[_0xf232('0x10')](util['format'](_0xf232('0x26'),_0x2c8caf[_0xf232('0x27')]));searchContact(_0x13a35c,_0xb31f1a,_0xf232('0x28'),_0x2c8caf[_0xf232('0x27')])[_0xf232('0x11')](function(_0x3e95b3){if(_0x3e95b3){_0x2c8caf[_0xf232('0x29')]=_0x3e95b3['id'];logger[_0xf232('0x10')](_0xf232('0x2a'),_0x2c8caf[_0xf232('0x29')]);return _0x28a098(_0x2c8caf);}searchContact(_0x13a35c,_0xb31f1a,_0xf232('0x2b'),_0x2c8caf[_0xf232('0x27')])[_0xf232('0x11')](function(_0x1ce5f0){if(_0x1ce5f0){_0x2c8caf['endUserId']=_0x1ce5f0['id'];logger[_0xf232('0x10')]('Contact\x20found\x20work_number:',_0x2c8caf[_0xf232('0x29')]);return _0x28a098(_0x2c8caf);}createEndUser(_0x2c8caf,_0x5a7490,_0xb31f1a,_0x13a35c)[_0xf232('0x11')](function(_0x316d63){logger['info']('Contact\x20created:',_0x316d63[_0xf232('0x29')]);return _0x28a098(_0x316d63);});});})[_0xf232('0x16')](function(_0x564781){_0x22876d(_0x564781);});});};}function createEndUser(_0x3c4ee7,_0x57f2d7,_0x2a13c6,_0x3dd472){return new Promise(function(_0x30c0f8,_0x53270f){var _0x4300f6=moment();var _0x24345f={'method':'POST','uri':_0x3dd472+_0xf232('0x2c'),'body':{'contact':{'last_name':_0x3c4ee7['contactNumber'],'work_number':_0x3c4ee7[_0xf232('0x27')],'mobile_number':_0x3c4ee7[_0xf232('0x27')],'owner_id':_0x3c4ee7[_0xf232('0x1d')],'created_at':_0x4300f6[_0xf232('0x2d')](_0xf232('0x2e'))}},'json':!![]};_0x24345f[_0xf232('0x19')]=_0x2a13c6;logger['info'](_0xf232('0x2f'));return rp(_0x24345f)[_0xf232('0x11')](function(_0x25a674){_0x3c4ee7[_0xf232('0x29')]=_0x25a674[_0xf232('0x30')]['id'];_0x30c0f8(_0x3c4ee7);})[_0xf232('0x16')](function(_0x1bad4c){logger['error']('['+[_0x57f2d7[_0xf232('0x17')]()]+']',_0x1bad4c[_0xf232('0x18')]);_0x53270f(_0x1bad4c['message']);});});}function getTicket(_0x4f233d,_0x37b7b4,_0x3b5a73,_0xb1738c,_0x75747e){return function(_0x22619d){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x1b94bd,_0x484034){var _0x2b1dfa=moment();var _0x1267a0={'method':_0xf232('0x31'),'uri':_0x3b5a73+_0xf232('0x32'),'body':{'title':intUtil['getString'](_0xb1738c['Subjects'],_0x75747e,'\x20'),'description':intUtil[_0xf232('0x33')](_0xb1738c[_0xf232('0x34')],_0x75747e,'\x0a'),'owner_id':_0x22619d['userId'],'creater_id':_0x22619d[_0xf232('0x20')],'targetable_id':_0x22619d[_0xf232('0x29')],'targetable_type':_0xf232('0x35'),'created_at':_0x2b1dfa[_0xf232('0x2d')](_0xf232('0x2e')),'due_date':_0x2b1dfa[_0xf232('0x36')](0x1e,'m')[_0xf232('0x2d')](_0xf232('0x2e'))},'json':!![]};_0x1267a0[_0xf232('0x19')]=_0x37b7b4;return rp(_0x1267a0)[_0xf232('0x11')](function(_0x59b28d){_0x22619d[_0xf232('0x37')]=_0x59b28d['task']['id'];logger['info'](_0xf232('0x38'),_0x22619d[_0xf232('0x37')]);_0x1b94bd(_0x22619d);})[_0xf232('0x16')](function(_0x15faf3){logger[_0xf232('0x21')]('['+[_0x4f233d[_0xf232('0x17')]()]+']',_0x15faf3[_0xf232('0x18')]);_0x484034(_0x15faf3[_0xf232('0x18')]);});});};}function emit(_0x510ae5,_0x22b85f,_0x36c7cc){var _0x4872a9={'uri':_0x510ae5+'/contacts/'+_0x36c7cc};io['to'](util[_0xf232('0x2d')](_0xf232('0x39'),_0x22b85f))[_0xf232('0x3a')](_0xf232('0x3b'),_0x4872a9);}exports['cs']=function(_0x54aa58,_0x2e139b,_0x5317dc,_0x19dcfd,_0xa5dc4c,_0x195f8d,_0x5b5b78,_0x34cdd2){var _0xde6e23={};var _0x46bb4b={'Authorization':_0xf232('0x3c')+_0x195f8d[_0xf232('0x3d')]};_0x195f8d['remoteUri']=intUtil[_0xf232('0x3e')](_0x195f8d[_0xf232('0x3f')]);_0x195f8d['serverUrl']=intUtil['stripTrailingSlash'](_0x195f8d[_0xf232('0x40')]);var _0x4c9b07=_0x195f8d['remoteUri'];_0xde6e23[_0xf232('0x1f')]=_0x195f8d['username'];_0xde6e23['contactNumber']=_0x34cdd2[_0xf232('0x41')]()===_0xf232('0x42')?_0x2e139b['destcalleridnum']:_0x2e139b[_0xf232('0x43')];_0xde6e23[_0xf232('0x44')]=_0x34cdd2===_0xf232('0x45')||_0x34cdd2===_0xf232('0x46')?_0xf232('0x45'):_0xf232('0x42');if(_0x19dcfd){_0xde6e23['agentEmail']=_0x19dcfd[_0xf232('0x47')];}var _0x147fef=util[_0xf232('0x2d')](_0xf232('0x48'),_0x195f8d[_0xf232('0x40')],_0x2e139b[_0xf232('0x49')],md5(_0x2e139b[_0xf232('0x49')]));if(_0xa5dc4c&&_0xa5dc4c[_0xf232('0x4a')]){logger[_0xf232('0x10')](_0xf232('0x4b'),_0xf232('0x4c'));_0x2e139b[_0xf232('0x4d')]=_0x147fef;}else if(_0x5b5b78&&_0x5b5b78['recordingFormat']&&_0x5b5b78[_0xf232('0x4e')]!=='none'){logger[_0xf232('0x10')](_0xf232('0x4f'),_0xf232('0x4c'));_0x2e139b[_0xf232('0x4d')]=_0x147fef;}else{_0x2e139b[_0xf232('0x4d')]='';}return getAdminId(_0xde6e23,_0x34cdd2,_0x46bb4b,_0x4c9b07)[_0xf232('0x11')](getUser(_0x34cdd2,_0x46bb4b,_0x4c9b07))['then'](getEndUser(_0x34cdd2,_0x46bb4b,_0x4c9b07))[_0xf232('0x11')](getTicket(_0x34cdd2,_0x46bb4b,_0x4c9b07,_0x5317dc,_0x2e139b))[_0xf232('0x11')](function(_0x4ca573){logger[_0xf232('0x10')](util[_0xf232('0x2d')](_0xf232('0x50'),_0x4ca573[_0xf232('0x37')]));if(_0x34cdd2!=='unmanaged'){logger[_0xf232('0x10')]('['+[_0x34cdd2[_0xf232('0x17')]()]+']',_0xf232('0x51'));emit(_0x4c9b07,_0x19dcfd[_0xf232('0x52')],_0x4ca573[_0xf232('0x29')]);}})['catch'](function(_0x30635a){logger[_0xf232('0x21')]('['+[_0x34cdd2[_0xf232('0x17')]()]+_0xf232('0x53'),util['inspect'](_0x30635a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe935=['agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','Subjects','getString','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','/contacts/','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','recordingFormat','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','headers'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0xe935,0x8a));var _0x5e93=function(_0x53d9d3,_0x416b2f){_0x53d9d3=_0x53d9d3-0x0;var _0x259ab3=_0xe935[_0x53d9d3];return _0x259ab3;};'use strict';var _=require(_0x5e93('0x0'));var rp=require(_0x5e93('0x1'));var md5=require(_0x5e93('0x2'));var util=require(_0x5e93('0x3'));var moment=require(_0x5e93('0x4'));var Promise=require(_0x5e93('0x5'));var Redis=require(_0x5e93('0x6'));var intUtil=require(_0x5e93('0x7'));var config=require(_0x5e93('0x8'));var logger=require(_0x5e93('0x9'))(_0x5e93('0xa'));config[_0x5e93('0xb')]=_[_0x5e93('0xc')](config['redis'],{'host':_0x5e93('0xd'),'port':0x18eb});var io=require(_0x5e93('0xe'))(new Redis(config[_0x5e93('0xb')]));function getAdminId(_0x3b9a0a,_0x550620,_0x47c607,_0x3b3248){return new Promise(function(_0x442790,_0x27df9d){var _0x1f9c53=![];var _0x120c4c={'method':'GET','uri':_0x3b3248+'/api/selector/owners','json':!![]};_0x120c4c['headers']=_0x47c607;logger[_0x5e93('0xf')](_0x5e93('0x10'));return rp(_0x120c4c)[_0x5e93('0x11')](function(_0x51fb64){if(_0x51fb64){var _0x2d3222=_0x51fb64[_0x5e93('0x12')];var _0xb5d83c=null;for(_0xb5d83c=0x0;_0xb5d83c<_0x2d3222[_0x5e93('0x13')];_0xb5d83c++){if(_0x2d3222[_0xb5d83c][_0x5e93('0x14')]===_0x3b9a0a[_0x5e93('0x15')]){_0x3b9a0a[_0x5e93('0x16')]=_0x2d3222[_0xb5d83c]['id'];_0x1f9c53=!![];}}if(_0x1f9c53){logger[_0x5e93('0xf')](_0x5e93('0x17'),_0x3b9a0a[_0x5e93('0x16')]);_0x442790(_0x3b9a0a);}else{_0x27df9d({'statusCode':0x194,'message':_0x5e93('0x18')});}}else{_0x27df9d({'statusCode':0x194,'message':_0x5e93('0x18')});}})[_0x5e93('0x19')](function(_0x48b558){logger[_0x5e93('0x1a')]('['+[_0x550620[_0x5e93('0x1b')]()]+']',_0x48b558['message']);_0x27df9d(_0x48b558);});});}function getUser(_0x4d1903,_0x4fe65b,_0x2b7465){return function(_0x55dc8b){return new Promise(function(_0x559806,_0x5d04b5){var _0x5934e9={'method':'GET','uri':_0x2b7465+_0x5e93('0x1c'),'json':!![]};_0x5934e9[_0x5e93('0x1d')]=_0x4fe65b;logger['info']('Getting\x20user\x20list');return rp(_0x5934e9)[_0x5e93('0x11')](function(_0x4717ce){if(_0x4717ce){var _0xd22b6e=_0x4717ce[_0x5e93('0x12')];var _0x1b56b3=![];var _0x4639ed=null;if(_0x55dc8b[_0x5e93('0x1e')]!==null){logger[_0x5e93('0xf')](_0x5e93('0x1f'),_0x55dc8b[_0x5e93('0x1e')]);_0x55dc8b[_0x5e93('0x20')]=_0x55dc8b['agentEmail'];for(_0x4639ed=0x0;_0x4639ed<_0xd22b6e[_0x5e93('0x13')];_0x4639ed++){if(_0xd22b6e[_0x4639ed][_0x5e93('0x14')]===_0x55dc8b[_0x5e93('0x1e')]){_0x1b56b3=!![];_0x55dc8b[_0x5e93('0x21')]=_0xd22b6e[_0x4639ed]['id'];logger[_0x5e93('0xf')](_0x5e93('0x22'),_0x55dc8b[_0x5e93('0x21')]);}}}if(!_0x1b56b3){logger[_0x5e93('0xf')](_0x5e93('0x23'));_0x55dc8b['userEmail']=_0x55dc8b['adminEmail'];_0x55dc8b[_0x5e93('0x21')]=_0x55dc8b[_0x5e93('0x16')];_0x1b56b3=!![];}if(_0x1b56b3){_0x559806(_0x55dc8b);}else{_0x5d04b5({'statusCode':0x194,'message':_0x5e93('0x18')});}}else{_0x5d04b5({'statusCode':0x194,'message':_0x5e93('0x18')});}})[_0x5e93('0x19')](function(_0x409e71){logger[_0x5e93('0x1a')]('['+[_0x4d1903[_0x5e93('0x1b')]()]+']',_0x409e71[_0x5e93('0x24')]);_0x5d04b5(_0x409e71);});});};}function searchContact(_0x57325a,_0xbba39b,_0x5b9d4d,_0x5a7afe){return new Promise(function(_0x1306a4,_0x1355a1){var _0x56744d={'method':'GET','headers':_0xbba39b,'uri':_0x57325a+_0x5e93('0x25')+_0x5a7afe+_0x5e93('0x26')+_0x5b9d4d+_0x5e93('0x27'),'json':!![]};rp(_0x56744d)['then'](function(_0x576411){var _0x120f8f=_[_0x5e93('0x28')](_0x576411[_0x5e93('0x29')][_0x5e93('0x29')],[_0x5b9d4d,_0x5a7afe]);_0x1306a4(_0x120f8f);})[_0x5e93('0x19')](function(_0x4cfd29){_0x1355a1(_0x4cfd29);});});}function getEndUser(_0x445c41,_0x50b95c,_0x448d3b){return function(_0x94d9b6){return new Promise(function(_0x3ab161,_0x3f0bbd){logger[_0x5e93('0xf')](util['format'](_0x5e93('0x2a'),_0x94d9b6[_0x5e93('0x2b')]));searchContact(_0x448d3b,_0x50b95c,_0x5e93('0x2c'),_0x94d9b6[_0x5e93('0x2b')])[_0x5e93('0x11')](function(_0x57c213){if(_0x57c213){_0x94d9b6[_0x5e93('0x2d')]=_0x57c213['id'];logger['info'](_0x5e93('0x2e'),_0x94d9b6[_0x5e93('0x2d')]);return _0x3ab161(_0x94d9b6);}searchContact(_0x448d3b,_0x50b95c,_0x5e93('0x2f'),_0x94d9b6[_0x5e93('0x2b')])['then'](function(_0x10585e){if(_0x10585e){_0x94d9b6[_0x5e93('0x2d')]=_0x10585e['id'];logger[_0x5e93('0xf')](_0x5e93('0x30'),_0x94d9b6[_0x5e93('0x2d')]);return _0x3ab161(_0x94d9b6);}createEndUser(_0x94d9b6,_0x445c41,_0x50b95c,_0x448d3b)[_0x5e93('0x11')](function(_0x2d3869){logger['info']('Contact\x20created:',_0x2d3869['endUserId']);return _0x3ab161(_0x2d3869);});});})[_0x5e93('0x19')](function(_0x9ecceb){_0x3f0bbd(_0x9ecceb);});});};}function createEndUser(_0x5025ce,_0x59e2da,_0x1a07fd,_0x4cd819){return new Promise(function(_0x5e86d6,_0x339d9d){var _0x53d7dc=moment();var _0x1f8bb6={'method':'POST','uri':_0x4cd819+_0x5e93('0x31'),'body':{'contact':{'last_name':_0x5025ce[_0x5e93('0x2b')],'work_number':_0x5025ce[_0x5e93('0x2b')],'mobile_number':_0x5025ce[_0x5e93('0x2b')],'owner_id':_0x5025ce['userId'],'created_at':_0x53d7dc[_0x5e93('0x32')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1f8bb6[_0x5e93('0x1d')]=_0x1a07fd;logger[_0x5e93('0xf')](_0x5e93('0x33'));return rp(_0x1f8bb6)[_0x5e93('0x11')](function(_0x5b62a5){_0x5025ce[_0x5e93('0x2d')]=_0x5b62a5[_0x5e93('0x34')]['id'];_0x5e86d6(_0x5025ce);})[_0x5e93('0x19')](function(_0x367d12){logger[_0x5e93('0x1a')]('['+[_0x59e2da[_0x5e93('0x1b')]()]+']',_0x367d12[_0x5e93('0x24')]);_0x339d9d(_0x367d12['message']);});});}function getTicket(_0x19dfca,_0x48639b,_0x13bea8,_0x29fe42,_0x1b6125){return function(_0x4a0d79){logger[_0x5e93('0xf')](_0x5e93('0x35'));return new Promise(function(_0x21dabb,_0x5390bc){var _0x188e1a=moment();var _0x3a095c={'method':_0x5e93('0x36'),'uri':_0x13bea8+_0x5e93('0x37'),'body':{'title':intUtil['getString'](_0x29fe42[_0x5e93('0x38')],_0x1b6125,'\x20'),'description':intUtil[_0x5e93('0x39')](_0x29fe42[_0x5e93('0x3a')],_0x1b6125,'\x0a'),'owner_id':_0x4a0d79[_0x5e93('0x21')],'creater_id':_0x4a0d79['adminId'],'targetable_id':_0x4a0d79[_0x5e93('0x2d')],'targetable_type':'Contact','created_at':_0x188e1a['format'](_0x5e93('0x3b')),'due_date':_0x188e1a[_0x5e93('0x3c')](0x1e,'m')[_0x5e93('0x32')](_0x5e93('0x3b'))},'json':!![]};_0x3a095c[_0x5e93('0x1d')]=_0x48639b;return rp(_0x3a095c)[_0x5e93('0x11')](function(_0x195ae8){_0x4a0d79[_0x5e93('0x3d')]=_0x195ae8['task']['id'];logger[_0x5e93('0xf')](_0x5e93('0x3e'),_0x4a0d79[_0x5e93('0x3d')]);_0x21dabb(_0x4a0d79);})['catch'](function(_0x57469b){logger['error']('['+[_0x19dfca[_0x5e93('0x1b')]()]+']',_0x57469b[_0x5e93('0x24')]);_0x5390bc(_0x57469b[_0x5e93('0x24')]);});});};}function emit(_0x2941e5,_0x4fb851,_0x43d929){var _0xd5418a={'uri':_0x2941e5+_0x5e93('0x3f')+_0x43d929};io['to'](util[_0x5e93('0x32')]('user:%s',_0x4fb851))[_0x5e93('0x40')]('trigger:browser:url',_0xd5418a);}exports['cs']=function(_0x2e59a4,_0x3cafc4,_0x2eca2d,_0x1eb690,_0x546e51,_0x2b9a52,_0x4aed22,_0x453393){var _0x2be9a2={};var _0x5303a9={'Authorization':_0x5e93('0x41')+_0x2b9a52[_0x5e93('0x42')]};_0x2b9a52['remoteUri']=intUtil['stripTrailingSlash'](_0x2b9a52[_0x5e93('0x43')]);_0x2b9a52['serverUrl']=intUtil[_0x5e93('0x44')](_0x2b9a52['serverUrl']);var _0x3a61ba=_0x2b9a52['remoteUri'];_0x2be9a2[_0x5e93('0x15')]=_0x2b9a52[_0x5e93('0x45')];_0x2be9a2['contactNumber']=_0x453393[_0x5e93('0x46')]()===_0x5e93('0x47')?_0x3cafc4['destcalleridnum']:_0x3cafc4['calleridnum'];_0x2be9a2['callDirection']=_0x453393==='queue'||_0x453393===_0x5e93('0x48')?_0x5e93('0x49'):_0x5e93('0x47');if(_0x1eb690){_0x2be9a2[_0x5e93('0x1e')]=_0x1eb690[_0x5e93('0x14')];}var _0x581bd3=util[_0x5e93('0x32')](_0x5e93('0x4a'),_0x2b9a52[_0x5e93('0x4b')],_0x3cafc4['uniqueid'],md5(_0x3cafc4[_0x5e93('0x4c')]));if(_0x546e51&&_0x546e51['monitor_format']){logger[_0x5e93('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3cafc4[_0x5e93('0x4d')]=_0x581bd3;}else if(_0x4aed22&&_0x4aed22[_0x5e93('0x4e')]&&_0x4aed22[_0x5e93('0x4e')]!=='none'){logger[_0x5e93('0xf')]('[OUTBOUND]',_0x5e93('0x4f'));_0x3cafc4['recordingURL']=_0x581bd3;}else{_0x3cafc4['recordingURL']='';}return getAdminId(_0x2be9a2,_0x453393,_0x5303a9,_0x3a61ba)[_0x5e93('0x11')](getUser(_0x453393,_0x5303a9,_0x3a61ba))[_0x5e93('0x11')](getEndUser(_0x453393,_0x5303a9,_0x3a61ba))[_0x5e93('0x11')](getTicket(_0x453393,_0x5303a9,_0x3a61ba,_0x2eca2d,_0x3cafc4))[_0x5e93('0x11')](function(_0x80fbea){logger['info'](util[_0x5e93('0x32')](_0x5e93('0x50'),_0x80fbea[_0x5e93('0x3d')]));if(_0x453393!==_0x5e93('0x48')){logger['info']('['+[_0x453393[_0x5e93('0x1b')]()]+']',_0x5e93('0x51'));emit(_0x3a61ba,_0x1eb690['name'],_0x80fbea[_0x5e93('0x2d')]);}})[_0x5e93('0x19')](function(_0x567723){logger[_0x5e93('0x1a')]('['+[_0x453393[_0x5e93('0x1b')]()]+_0x5e93('0x52'),util[_0x5e93('0x53')](_0x567723,{'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 9bf200f..263ea7c 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 _0xfc89=['toLowerCase','data1','find','Configurations','queue','outbound','log','unmanaged','zendesk','dynamics365','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','./zendesk','./sugarcrm','./zoho','./desk','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','vtiger','servicenow','exec','includes'];(function(_0x20a086,_0x15cef2){var _0x379cc3=function(_0xe4c176){while(--_0xe4c176){_0x20a086['push'](_0x20a086['shift']());}};_0x379cc3(++_0x15cef2);}(_0xfc89,0xf3));var _0x9fc8=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xfc89[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x9fc8('0x0'));var salesforce=require('./salesforce');var sugarcrm=require(_0x9fc8('0x1'));var freshdesk=require('./freshdesk');var zoho=require(_0x9fc8('0x2'));var desk=require(_0x9fc8('0x3'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x9fc8('0x4'));var freshsales=require(_0x9fc8('0x5'));var integrations=['zendesk','salesforce',_0x9fc8('0x6'),_0x9fc8('0x7'),_0x9fc8('0x8'),'desk',_0x9fc8('0x9'),'dynamics365','freshsales',_0x9fc8('0xa')];exports[_0x9fc8('0xb')]=function(_0x35ecf0,_0x463b45,_0xd246c8,_0x459ec9,_0x5d5b18,_0x32991c){if(_0xd246c8){if(_[_0x9fc8('0xc')](integrations,_0x35ecf0['data1'][_0x9fc8('0xd')]())){try{var _0x500801=null;var _0x44cba8='';var _0x3c45e4=_0xd246c8[_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]()];if(_0x3c45e4){var _0x408381=_0x3c45e4[_0x35ecf0['data2']];if(_0x408381){var _0x1a59b6=_[_0x9fc8('0xf')](_0x408381[_0x9fc8('0x10')],{'id':parseInt(_0x35ecf0['data3'],0xa)});if(_0x1a59b6){if(_0x459ec9){if(_0x5d5b18&&_0x463b45[_0x9fc8('0x11')]){_0x44cba8=_0x9fc8('0x11');}else if(_0x463b45['routeId']){_0x44cba8=_0x9fc8('0x12');}else{console[_0x9fc8('0x13')]('EVENT\x20UNKNOWN',_0x463b45);}}else{_0x44cba8=_0x9fc8('0x14');}switch(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]()){case _0x9fc8('0x15'):zendesk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'salesforce':salesforce[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x6'):sugarcrm[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x7'):freshdesk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x8'):zoho[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'desk':desk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'vtiger':vtiger[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'freshsales':freshsales['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;case _0x9fc8('0xa'):servicenow['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;case _0x9fc8('0x16'):dynamics365['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;default:console[_0x9fc8('0x13')](_0x9fc8('0x17'));}}else{_0x500801=require(_0x9fc8('0x18'))(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]());_0x500801[_0x9fc8('0x19')]('[EXEC]',util[_0x9fc8('0x1a')](_0x9fc8('0x1b'),_0x35ecf0['data1'][_0x9fc8('0xd')](),_0x35ecf0[_0x9fc8('0x1c')]));}}else{_0x500801=require(_0x9fc8('0x18'))(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]());_0x500801['error'](_0x9fc8('0x1d'),util[_0x9fc8('0x1a')](_0x9fc8('0x1e'),_0x35ecf0[_0x9fc8('0xe')]['toLowerCase'](),_0x35ecf0[_0x9fc8('0x1f')]));}}else{}}catch(_0x5390f5){console[_0x9fc8('0x19')](_0x5390f5);}}}}; \ No newline at end of file +var _0xb12a=['data1','find','Configurations','data3','queue','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','zoho','servicenow','../../../../config/logger','toLowerCase','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','vtiger','dynamics365','freshsales'];(function(_0x19d0b6,_0x85209a){var _0x16060b=function(_0x33d5d3){while(--_0x33d5d3){_0x19d0b6['push'](_0x19d0b6['shift']());}};_0x16060b(++_0x85209a);}(_0xb12a,0xbd));var _0xab12=function(_0x3337ba,_0x19476a){_0x3337ba=_0x3337ba-0x0;var _0x4a2477=_0xb12a[_0x3337ba];return _0x4a2477;};'use strict';var _=require('lodash');var util=require(_0xab12('0x0'));var zendesk=require(_0xab12('0x1'));var salesforce=require(_0xab12('0x2'));var sugarcrm=require(_0xab12('0x3'));var freshdesk=require(_0xab12('0x4'));var zoho=require(_0xab12('0x5'));var desk=require('./desk');var vtiger=require(_0xab12('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0xab12('0x7'));var freshsales=require(_0xab12('0x8'));var integrations=[_0xab12('0x9'),_0xab12('0xa'),'sugarcrm',_0xab12('0xb'),'zoho','desk',_0xab12('0xc'),_0xab12('0xd'),_0xab12('0xe'),'servicenow'];exports['exec']=function(_0x33c032,_0x1cefdc,_0x36674,_0x112ec4,_0x34551b,_0x2872cc){if(_0x36674){if(_['includes'](integrations,_0x33c032['data1']['toLowerCase']())){try{var _0x475234=null;var _0x5f02f7='';var _0x2e5664=_0x36674[_0x33c032[_0xab12('0xf')]['toLowerCase']()];if(_0x2e5664){var _0x5fa389=_0x2e5664[_0x33c032['data2']];if(_0x5fa389){var _0x2b9986=_[_0xab12('0x10')](_0x5fa389[_0xab12('0x11')],{'id':parseInt(_0x33c032[_0xab12('0x12')],0xa)});if(_0x2b9986){if(_0x112ec4){if(_0x34551b&&_0x1cefdc[_0xab12('0x13')]){_0x5f02f7=_0xab12('0x13');}else if(_0x1cefdc['routeId']){_0x5f02f7='outbound';}else{console[_0xab12('0x14')](_0xab12('0x15'),_0x1cefdc);}}else{_0x5f02f7=_0xab12('0x16');}switch(_0x33c032[_0xab12('0xf')]['toLowerCase']()){case _0xab12('0x9'):zendesk[_0x5f02f7](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc);break;case _0xab12('0xa'):salesforce[_0x5f02f7](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc);break;case _0xab12('0x17'):sugarcrm[_0x5f02f7](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc);break;case _0xab12('0xb'):freshdesk[_0x5f02f7](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc);break;case _0xab12('0x18'):zoho[_0x5f02f7](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc);break;case'desk':desk[_0x5f02f7](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc);break;case _0xab12('0xc'):vtiger[_0x5f02f7](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc);break;case'freshsales':freshsales['cs'](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc,_0x5f02f7);break;case _0xab12('0x19'):servicenow['cs'](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc,_0x5f02f7);break;case _0xab12('0xd'):dynamics365['cs'](_0x33c032,_0x1cefdc,_0x2b9986,_0x112ec4,_0x34551b,_0x5fa389,_0x2872cc,_0x5f02f7);break;default:console[_0xab12('0x14')]('unknown\x20integration');}}else{_0x475234=require(_0xab12('0x1a'))(_0x33c032['data1'][_0xab12('0x1b')]());_0x475234['error']('[EXEC]',util['format'](_0xab12('0x1c'),_0x33c032['data1'][_0xab12('0x1b')](),_0x33c032[_0xab12('0x12')]));}}else{_0x475234=require(_0xab12('0x1a'))(_0x33c032[_0xab12('0xf')][_0xab12('0x1b')]());_0x475234[_0xab12('0x1d')](_0xab12('0x1e'),util[_0xab12('0x1f')](_0xab12('0x20'),_0x33c032['data1']['toLowerCase'](),_0x33c032[_0xab12('0x21')]));}}else{}}catch(_0x50f3af){console[_0xab12('0x1d')](_0x50f3af);}}}}; \ 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 31bc99e..056fcd5 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 _0x5a5d=['[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','unmanaged','monitor_format','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','contact','endUserType','lead','WhoId','account','WhatId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','additionalSearchAccount','Account','length','first','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum'];(function(_0x50e334,_0x4052c9){var _0x58ac30=function(_0x2eda11){while(--_0x2eda11){_0x50e334['push'](_0x50e334['shift']());}};_0x58ac30(++_0x4052c9);}(_0x5a5d,0x118));var _0xd5a5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5a5d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd5a5('0x0'));var rp=require('request-promise');var moment=require(_0xd5a5('0x1'));var BPromise=require(_0xd5a5('0x2'));var md5=require(_0xd5a5('0x3'));var jsforce=require(_0xd5a5('0x4'));var util=require(_0xd5a5('0x5'));var Redis=require(_0xd5a5('0x6'));var intUtil=require('./util');var config=require(_0xd5a5('0x7'));var logger=require('../../../../config/logger')(_0xd5a5('0x8'));config[_0xd5a5('0x9')]=_[_0xd5a5('0xa')](config[_0xd5a5('0x9')],{'host':_0xd5a5('0xb'),'port':0x18eb});var io=require(_0xd5a5('0xc'))(new Redis(config[_0xd5a5('0x9')]));function emit(_0x41f53d,_0x49e47c,_0x4466df){io['to'](_0x41f53d)[_0xd5a5('0xd')](_0x49e47c,_0x4466df);}function getTicket(_0x2dd066,_0x387bc2,_0x1a057e,_0x3df968,_0x13b72f,_0x408e96,_0x299c85,_0x2f7337){var _0x1b5faa=Object[_0xd5a5('0xe')]({},{'OwnerId':_0x387bc2['id'],'Subject':intUtil[_0xd5a5('0xf')](_0x3df968['Subjects'],_0x13b72f,'\x20'),'Description':intUtil['getString'](_0x3df968[_0xd5a5('0x10')],_0x13b72f,'\x0a')},getCustomFields(_0x408e96,_0x13b72f));if(_0x1a057e){if(_0x3df968[_0xd5a5('0x11')]===_0xd5a5('0x12')){_0x1b5faa[_0xd5a5('0x13')]=moment[_0xd5a5('0x14')]();_0x1b5faa[_0xd5a5('0x15')]=![];_0x1b5faa['IsRecurrence']=![];if(_0x1a057e['endUserType']===_0xd5a5('0x16')||_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x18')){_0x1b5faa[_0xd5a5('0x19')]=_0x1a057e['id'];}else if(_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x1a')){_0x1b5faa[_0xd5a5('0x1b')]=_0x1a057e['id'];}}else if(_0x3df968['ticketType']==='Case'){if(_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x16')){_0x1b5faa['ContactId']=_0x1a057e['id'];}else if(_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x1a')){_0x1b5faa[_0xd5a5('0x1c')]=_0x1a057e['id'];}else if(_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x18')&&_0x3df968[_0xd5a5('0x1d')]){_0x1b5faa[_0x3df968[_0xd5a5('0x1d')]]=_0x1a057e['id'];}else{logger['info'](_0xd5a5('0x1e'));}}}return _0x299c85[_0xd5a5('0x1f')](_0x3df968[_0xd5a5('0x11')])[_0xd5a5('0x20')](_0x1b5faa);}function getUser(_0x2f5c76,_0x35cbb0,_0x1e1285){if(!_[_0xd5a5('0x21')](_0x35cbb0)&&intUtil[_0xd5a5('0x22')](_0x35cbb0)){var _0x572e37={'Email':_0x35cbb0};var _0x538318={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1e1285[_0xd5a5('0x1f')](_0xd5a5('0x23'))[_0xd5a5('0x24')](_0x572e37,_0x538318)['execute']()[_0xd5a5('0x25')](function(_0xbdfbca){if(_0xbdfbca['length']){var _0x365cd7=_['find'](_0xbdfbca,function(_0x5a365d){return _0x5a365d[_0xd5a5('0x26')]===_0x35cbb0;});if(_0x365cd7){logger[_0xd5a5('0x27')](_0xd5a5('0x28'),_0x35cbb0);return BPromise[_0xd5a5('0x29')]({'id':_0x365cd7['Id'],'name':_0x365cd7[_0xd5a5('0x2a')]});}}else{logger[_0xd5a5('0x27')](_0xd5a5('0x2b'),_0x35cbb0);return _0x1e1285[_0xd5a5('0x2c')]()[_0xd5a5('0x25')](function(_0x12ec57){return BPromise[_0xd5a5('0x29')]({'id':_0x12ec57['user_id'],'name':_0x12ec57[_0xd5a5('0x2d')]});});}});}else{logger['info'](_0xd5a5('0x2b'),_0x35cbb0);return _0x1e1285[_0xd5a5('0x2c')]()[_0xd5a5('0x25')](function(_0x4f6f78){return BPromise[_0xd5a5('0x29')]({'id':_0x4f6f78['user_id'],'name':_0x4f6f78[_0xd5a5('0x2d')]});});}}function getEndUser(_0x423b4c,_0x341728,_0x4edd66,_0x39aef5,_0x2170cb){var _0x1e4806={'$or':{'Phone':_0x39aef5}};var _0x548d43={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd5a5('0x29')]()[_0xd5a5('0x25')](function(){logger[_0xd5a5('0x27')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x39aef5,_0x341728[_0xd5a5('0x2e')]);switch(_0x341728[_0xd5a5('0x2e')]){case'contact_lead':var _0x47ce24=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x30')]){var _0x1937b0={};_0x1937b0[_0x341728[_0xd5a5('0x30')]]=_0x39aef5;_[_0xd5a5('0x31')](_0x47ce24[_0xd5a5('0x32')],_0x1937b0);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x33'))[_0xd5a5('0x24')](_0x47ce24,_0x548d43)[_0xd5a5('0x34')]()[_0xd5a5('0x25')](function(_0x1df325){if(_0x1df325&&_0x1df325['length']){return _0x1df325;}else{var _0x5b174c=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x35')]){var _0x43b72d={};_0x43b72d[_0x341728['additionalSearchLead']]=_0x39aef5;_[_0xd5a5('0x31')](_0x5b174c['$or'],_0x43b72d);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x36'))[_0xd5a5('0x24')](_0x5b174c,_0x548d43);}});case'account_contact_lead':var _0x4239e3=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x37')]){var _0x1937b0={};_0x1937b0[_0x341728['additionalSearchAccount']]=_0x39aef5;_[_0xd5a5('0x31')](_0x4239e3[_0xd5a5('0x32')],_0x1937b0);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x38'))[_0xd5a5('0x24')](_0x4239e3,_0x548d43)[_0xd5a5('0x34')]()['then'](function(_0x2e20ae){if(_0x2e20ae&&_0x2e20ae[_0xd5a5('0x39')]){return _0x2e20ae;}else{var _0x1ad08d=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x30')]){var _0x1d7896={};_0x1d7896[_0x341728['additionalSearchContact']]=_0x39aef5;_[_0xd5a5('0x31')](_0x1ad08d[_0xd5a5('0x32')],_0x1d7896);}return _0x2170cb[_0xd5a5('0x1f')]('Contact')[_0xd5a5('0x24')](_0x1ad08d,_0x548d43)[_0xd5a5('0x25')](function(_0x261092){if(_0x261092&&_0x261092[_0xd5a5('0x39')]){return _0x261092;}else{var _0x59c760=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x35')]){var _0xb77dd1={};_0xb77dd1[_0x341728[_0xd5a5('0x35')]]=_0x39aef5;_[_0xd5a5('0x31')](_0x59c760['$or'],_0xb77dd1);}return _0x2170cb[_0xd5a5('0x1f')]('Lead')[_0xd5a5('0x24')](_0x59c760,_0x548d43);}});}});case _0xd5a5('0x16'):var _0x47ce24=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x30')]){var _0x1937b0={};_0x1937b0[_0x341728['additionalSearchContact']]=_0x39aef5;_[_0xd5a5('0x31')](_0x47ce24['$or'],_0x1937b0);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x33'))['find'](_0x47ce24,_0x548d43)[_0xd5a5('0x34')]();case'lead':var _0x5cabbf=_['cloneDeep'](_0x1e4806);if(_0x341728['additionalSearchLead']){var _0x1937b0={};_0x1937b0[_0x341728['additionalSearchLead']]=_0x39aef5;_[_0xd5a5('0x31')](_0x5cabbf[_0xd5a5('0x32')],_0x1937b0);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x36'))[_0xd5a5('0x24')](_0x5cabbf,_0x548d43);case _0xd5a5('0x1a'):var _0x4239e3=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x37')]){var _0x1937b0={};_0x1937b0[_0x341728[_0xd5a5('0x37')]]=_0x39aef5;_[_0xd5a5('0x31')](_0x4239e3[_0xd5a5('0x32')],_0x1937b0);}return _0x2170cb['sobject']('Account')[_0xd5a5('0x24')](_0x4239e3,_0x548d43);default:return null;}})[_0xd5a5('0x25')](function(_0x145cd8){if(_0x145cd8&&_0x145cd8[_0xd5a5('0x39')]){var _0x4da31e=_[_0xd5a5('0x3a')](_0x145cd8);if(_0x4da31e){return BPromise['resolve']({'id':_0x4da31e['Id'],'name':_0x4da31e[_0xd5a5('0x2a')],'phone':_0x4da31e['Phone'],'endUserType':_0x4da31e['attributes']['type'][_0xd5a5('0x3b')]()});}}})[_0xd5a5('0x25')](function(_0x73347b){if(_0x73347b){logger[_0xd5a5('0x27')](_0xd5a5('0x3c'),_0x73347b[_0xd5a5('0x17')],_0x39aef5);return BPromise[_0xd5a5('0x29')](_0x73347b);}else{logger[_0xd5a5('0x27')](_0xd5a5('0x3d'),_0x39aef5);var _0x30fef5={'Phone':_0x39aef5};if(_0x341728[_0xd5a5('0x3e')]){if(_0x341728[_0xd5a5('0x3e')]===_0xd5a5('0x16')){logger['info'](_0xd5a5('0x3f'),_0x39aef5,_0x341728[_0xd5a5('0x3e')]);_0x30fef5[_0xd5a5('0x40')]=_0x4edd66!==_0xd5a5('0x41')?_0x4edd66:util[_0xd5a5('0x42')](_0xd5a5('0x43'),_0x39aef5);}else if(_0x341728['moduleCreate']===_0xd5a5('0x18')){logger[_0xd5a5('0x27')](_0xd5a5('0x3f'),_0x39aef5,_0x341728[_0xd5a5('0x3e')]);_0x30fef5[_0xd5a5('0x40')]=_0x4edd66!==''?_0x4edd66:util['format'](_0xd5a5('0x43'),_0x39aef5);_0x30fef5[_0xd5a5('0x44')]=_0xd5a5('0x45');}else if(_0x341728[_0xd5a5('0x3e')]===_0xd5a5('0x1a')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x39aef5,_0x341728[_0xd5a5('0x3e')]);_0x30fef5[_0xd5a5('0x2a')]=_0x4edd66!==_0xd5a5('0x41')?_0x4edd66:util['format']('Caller\x20-\x20%s',_0x39aef5);}else{return null;}}return _0x2170cb[_0xd5a5('0x1f')](_[_0xd5a5('0x46')](_0x341728[_0xd5a5('0x3e')]))[_0xd5a5('0x20')](_0x30fef5)[_0xd5a5('0x25')](function(_0x2dbdca){return BPromise[_0xd5a5('0x29')]({'id':_0x2dbdca['id'],'endUserType':_0x341728[_0xd5a5('0x3e')]});});}});}function getCustomFields(_0x5745ea,_0x6ca226){var _0x4a6d51={};if(_0x5745ea[_0xd5a5('0x39')]>0x0){_['forEach'](_0x5745ea,function(_0x5c9146){if(_[_0xd5a5('0x47')](['string',_0xd5a5('0x48')],_0x5c9146[_0xd5a5('0x49')])&&_0x5c9146[_0xd5a5('0x4a')]){_0x4a6d51[_0x5c9146[_0xd5a5('0x4a')]]=_0x5c9146[_0xd5a5('0x4b')][_0xd5a5('0x4c')]();}else if(_0x5c9146[_0xd5a5('0x49')]==='variable'&&_0x5c9146[_0xd5a5('0x4d')]&&_0x5c9146['idField']){_0x6ca226[_0x5c9146[_0xd5a5('0x4d')]]&&(_0x4a6d51[_0x5c9146[_0xd5a5('0x4a')]]=_0x6ca226[_0x5c9146[_0xd5a5('0x4d')]]['toString']());}else if(_0x5c9146[_0xd5a5('0x49')]===_0xd5a5('0x4e')&&_0x5c9146[_0xd5a5('0x4f')]&&_0x5c9146[_0xd5a5('0x4f')][_0xd5a5('0x50')]&&_0x5c9146[_0xd5a5('0x4a')]){_0x6ca226[_0x5c9146[_0xd5a5('0x4f')][_0xd5a5('0x50')][_0xd5a5('0x3b')]()]&&(_0x4a6d51[_0x5c9146[_0xd5a5('0x4a')]]=_0x6ca226[_0x5c9146[_0xd5a5('0x4f')]['name'][_0xd5a5('0x3b')]()][_0xd5a5('0x4c')]());}});}return _0x4a6d51;}function getConnection(_0x4cf99a){var _0x2a9bd3=_0x4cf99a['password'][_0xd5a5('0x51')](_0x4cf99a[_0xd5a5('0x52')]);var _0x27c361=new jsforce[(_0xd5a5('0x53'))]({'oauth2':{'loginUrl':_0x4cf99a[_0xd5a5('0x54')]||_0xd5a5('0x55'),'clientId':_0x4cf99a[_0xd5a5('0x56')],'clientSecret':_0x4cf99a[_0xd5a5('0x57')]}});return _0x27c361['login'](_0x4cf99a[_0xd5a5('0x58')],_0x2a9bd3)[_0xd5a5('0x25')](function(){logger[_0xd5a5('0x27')]('Connection\x20established.');return _0x27c361;});}exports[_0xd5a5('0x59')]=function(_0x488bc9,_0x282d8f,_0x320e70,_0xaf4e69,_0x27d1f5,_0xa22db0){var _0x4cd21d,_0x155f8a,_0x5c9330,_0xdd9345;_0xa22db0[_0xd5a5('0x5a')]=intUtil['stripTrailingSlash'](_0xa22db0[_0xd5a5('0x5a')]);_0xa22db0[_0xd5a5('0x54')]=intUtil['stripTrailingSlash'](_0xa22db0[_0xd5a5('0x54')]);if(_0x27d1f5&&_0x27d1f5['monitor_format']){logger[_0xd5a5('0x27')](_0xd5a5('0x5b'),_0xd5a5('0x5c'));_0x282d8f[_0xd5a5('0x5d')]=util[_0xd5a5('0x42')](_0xd5a5('0x5e'),_0xa22db0[_0xd5a5('0x5a')],_0x282d8f[_0xd5a5('0x5f')],md5(_0x282d8f[_0xd5a5('0x5f')]));}else{_0x282d8f['recordingURL']='';}return getConnection(_0xa22db0)[_0xd5a5('0x25')](function(_0x431b54){_0xdd9345=_0x431b54;return getUser(_0xa22db0,_0xaf4e69[_0xd5a5('0x60')],_0xdd9345);})[_0xd5a5('0x25')](function(_0x2f2de9){_0x4cd21d=_0x2f2de9;return getEndUser(_0xa22db0,_0x320e70,_0x282d8f['calleridname'],_0x282d8f[_0xd5a5('0x61')],_0xdd9345);})[_0xd5a5('0x25')](function(_0x498445){_0x155f8a=_0x498445;return getTicket(_0xa22db0,_0x4cd21d,_0x155f8a,_0x320e70,_0x282d8f,_0x320e70['Fields'],_0xdd9345,_0xd5a5('0x59'));})[_0xd5a5('0x25')](function(_0x57868e){_0x5c9330=_0x57868e;logger[_0xd5a5('0x27')](_0xd5a5('0x62'),_0x5c9330['id']);logger['info'](_0xd5a5('0x63'),_0x5c9330['id'],_0xaf4e69[_0xd5a5('0x50')],_0xa22db0[_0xd5a5('0x49')]);switch(_0xa22db0['type']){case _0xd5a5('0x64'):emit(util['format']('user:%s',_0xaf4e69[_0xd5a5('0x50')]),_0xd5a5('0x65'),{'recordId':_0x5c9330['id']});break;case'newTab':emit(util[_0xd5a5('0x42')](_0xd5a5('0x66'),_0xaf4e69['name']),_0xd5a5('0x67'),{'uri':util[_0xd5a5('0x42')](_0xd5a5('0x68'),_0xdd9345[_0xd5a5('0x69')],_0x5c9330['id'])});break;default:logger[_0xd5a5('0x6a')](_0xd5a5('0x6b'));}})[_0xd5a5('0x6c')](function(_0x4c5836){logger[_0xd5a5('0x6a')](_0xd5a5('0x5b'),_0x4c5836);});};exports[_0xd5a5('0x6d')]=function(_0x1310fb,_0x806144,_0x4c808a,_0x2a032b,_0x3fa763,_0x58e889,_0x2a44b3){var _0x3d84a5,_0x212b21,_0x295a36,_0x293f99;_0x58e889[_0xd5a5('0x5a')]=intUtil['stripTrailingSlash'](_0x58e889[_0xd5a5('0x5a')]);_0x58e889[_0xd5a5('0x54')]=intUtil[_0xd5a5('0x6e')](_0x58e889['remoteUri']);if(_0x2a44b3&&_0x2a44b3['recordingFormat']&&_0x2a44b3[_0xd5a5('0x6f')]!==_0xd5a5('0x70')){logger[_0xd5a5('0x27')](_0xd5a5('0x71'),_0xd5a5('0x5c'));_0x806144[_0xd5a5('0x5d')]=util[_0xd5a5('0x42')](_0xd5a5('0x5e'),_0x58e889['serverUrl'],_0x806144[_0xd5a5('0x5f')],md5(_0x806144[_0xd5a5('0x5f')]));}return getConnection(_0x58e889)[_0xd5a5('0x25')](function(_0x5e65d8){_0x293f99=_0x5e65d8;return getUser(_0x58e889,_0x2a032b['email'],_0x293f99);})[_0xd5a5('0x25')](function(_0x2a24e1){_0x3d84a5=_0x2a24e1;return getEndUser(_0x58e889,_0x4c808a,_0x806144[_0xd5a5('0x72')],_0x806144[_0xd5a5('0x73')],_0x293f99);})['then'](function(_0x4c1a50){_0x212b21=_0x4c1a50;return getTicket(_0x58e889,_0x3d84a5,_0x212b21,_0x4c808a,_0x806144,_0x4c808a[_0xd5a5('0x74')],_0x293f99,_0xd5a5('0x6d'));})['then'](function(_0x1192ae){_0x295a36=_0x1192ae;logger['info'](_0xd5a5('0x75'),_0x295a36['id']);logger['info'](_0xd5a5('0x76'),_0x295a36['id'],_0x2a032b['name'],_0x58e889[_0xd5a5('0x49')]);switch(_0x58e889['type']){case'integrationTab':emit(util[_0xd5a5('0x42')]('user:%s',_0x2a032b['name']),_0xd5a5('0x65'),{'recordId':_0x295a36['id']});break;case _0xd5a5('0x77'):emit(util['format'](_0xd5a5('0x66'),_0x2a032b['name']),_0xd5a5('0x67'),{'uri':util[_0xd5a5('0x42')](_0xd5a5('0x68'),_0x293f99[_0xd5a5('0x69')],_0x295a36['id'])});break;default:logger[_0xd5a5('0x6a')](_0xd5a5('0x71'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd5a5('0x6c')](function(_0x552bf9){logger['error']('[OUTBOUND]',_0x552bf9);});};exports[_0xd5a5('0x78')]=function(_0x44c2b3,_0x595deb,_0x43a7a4,_0x4cc66c,_0x1ad763,_0x3bfc70){var _0x463eb2,_0x2cce84,_0x274967,_0x2aba5d;_0x3bfc70['serverUrl']=intUtil[_0xd5a5('0x6e')](_0x3bfc70[_0xd5a5('0x5a')]);_0x3bfc70['remoteUri']=intUtil[_0xd5a5('0x6e')](_0x3bfc70[_0xd5a5('0x54')]);if(_0x1ad763&&_0x1ad763[_0xd5a5('0x79')]){logger[_0xd5a5('0x27')]('['+_0x595deb[_0xd5a5('0x7a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x595deb[_0xd5a5('0x5d')]=util[_0xd5a5('0x42')](_0xd5a5('0x5e'),_0x3bfc70[_0xd5a5('0x5a')],_0x595deb[_0xd5a5('0x5f')],md5(_0x595deb[_0xd5a5('0x5f')]));}else{_0x595deb['recordingURL']='';}return getConnection(_0x3bfc70)[_0xd5a5('0x25')](function(_0x567961){_0x2aba5d=_0x567961;if(!_['isNil'](_0x4cc66c)){return getUser(_0x3bfc70,_0x4cc66c['name'],_0x2aba5d);}else{return getUser(_0x3bfc70,null,_0x2aba5d);}})['then'](function(_0x4b44a3){_0x463eb2=_0x4b44a3;return getEndUser(_0x3bfc70,_0x43a7a4,_0x595deb['calleridname'],_0x595deb[_0xd5a5('0x61')],_0x2aba5d);})[_0xd5a5('0x25')](function(_0xbe7018){_0x2cce84=_0xbe7018;return getTicket(_0x3bfc70,_0x463eb2,_0x2cce84,_0x43a7a4,_0x595deb,_0x43a7a4[_0xd5a5('0x74')],_0x2aba5d);})[_0xd5a5('0x25')](function(_0x4ea4fe){_0x274967=_0x4ea4fe;logger[_0xd5a5('0x27')]('['+_0x595deb[_0xd5a5('0x7a')]['toUpperCase']()+_0xd5a5('0x7b'),_0x274967['id']);logger[_0xd5a5('0x27')]('['+_0x595deb[_0xd5a5('0x7a')][_0xd5a5('0x7c')]()+_0xd5a5('0x7d'),_0x3bfc70[_0xd5a5('0x49')]);})[_0xd5a5('0x6c')](function(_0xa7e80f){logger[_0xd5a5('0x6a')]('['+_0x595deb[_0xd5a5('0x7a')][_0xd5a5('0x7c')]()+']',_0xa7e80f);});}; \ No newline at end of file +var _0xb50b=['recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','endUserType','lead','WhoId','WhatId','Case','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','ticketType','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','Contact','first','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','catch'];(function(_0x196bb7,_0x111ba0){var _0x52c316=function(_0x3f51f4){while(--_0x3f51f4){_0x196bb7['push'](_0x196bb7['shift']());}};_0x52c316(++_0x111ba0);}(_0xb50b,0x10c));var _0xbb50=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xb50b[_0x22868f];return _0x97bc75;};'use strict';var _=require(_0xbb50('0x0'));var rp=require(_0xbb50('0x1'));var moment=require(_0xbb50('0x2'));var BPromise=require(_0xbb50('0x3'));var md5=require(_0xbb50('0x4'));var jsforce=require(_0xbb50('0x5'));var util=require(_0xbb50('0x6'));var Redis=require(_0xbb50('0x7'));var intUtil=require(_0xbb50('0x8'));var config=require(_0xbb50('0x9'));var logger=require(_0xbb50('0xa'))(_0xbb50('0xb'));config[_0xbb50('0xc')]=_['defaults'](config[_0xbb50('0xc')],{'host':_0xbb50('0xd'),'port':0x18eb});var io=require(_0xbb50('0xe'))(new Redis(config[_0xbb50('0xc')]));function emit(_0x5e5a6c,_0x4467c3,_0x2f22f0){io['to'](_0x5e5a6c)[_0xbb50('0xf')](_0x4467c3,_0x2f22f0);}function getTicket(_0x52faf0,_0x2b48e5,_0x34dc46,_0x59b38a,_0x14f44b,_0x22c28c,_0xaffaae,_0x5170b5){var _0xe882e=Object['assign']({},{'OwnerId':_0x2b48e5['id'],'Subject':intUtil[_0xbb50('0x10')](_0x59b38a['Subjects'],_0x14f44b,'\x20'),'Description':intUtil[_0xbb50('0x10')](_0x59b38a[_0xbb50('0x11')],_0x14f44b,'\x0a')},getCustomFields(_0x22c28c,_0x14f44b));if(_0x34dc46){if(_0x59b38a['ticketType']===_0xbb50('0x12')){_0xe882e[_0xbb50('0x13')]=moment[_0xbb50('0x14')]();_0xe882e[_0xbb50('0x15')]=![];_0xe882e['IsRecurrence']=![];if(_0x34dc46[_0xbb50('0x16')]==='contact'||_0x34dc46['endUserType']===_0xbb50('0x17')){_0xe882e[_0xbb50('0x18')]=_0x34dc46['id'];}else if(_0x34dc46[_0xbb50('0x16')]==='account'){_0xe882e[_0xbb50('0x19')]=_0x34dc46['id'];}}else if(_0x59b38a['ticketType']===_0xbb50('0x1a')){if(_0x34dc46[_0xbb50('0x16')]===_0xbb50('0x1b')){_0xe882e[_0xbb50('0x1c')]=_0x34dc46['id'];}else if(_0x34dc46['endUserType']===_0xbb50('0x1d')){_0xe882e[_0xbb50('0x1e')]=_0x34dc46['id'];}else if(_0x34dc46['endUserType']==='lead'&&_0x59b38a[_0xbb50('0x1f')]){_0xe882e[_0x59b38a['leadId']]=_0x34dc46['id'];}else{logger[_0xbb50('0x20')](_0xbb50('0x21'));}}}return _0xaffaae[_0xbb50('0x22')](_0x59b38a[_0xbb50('0x23')])['create'](_0xe882e);}function getUser(_0x1c9dce,_0x235e64,_0x2b116d){if(!_['isNil'](_0x235e64)&&intUtil['validateEmail'](_0x235e64)){var _0x3ea523={'Email':_0x235e64};var _0x32f506={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2b116d[_0xbb50('0x22')](_0xbb50('0x24'))[_0xbb50('0x25')](_0x3ea523,_0x32f506)[_0xbb50('0x26')]()[_0xbb50('0x27')](function(_0x5c5413){if(_0x5c5413[_0xbb50('0x28')]){var _0x1c49d6=_[_0xbb50('0x25')](_0x5c5413,function(_0x50b28b){return _0x50b28b[_0xbb50('0x29')]===_0x235e64;});if(_0x1c49d6){logger[_0xbb50('0x20')](_0xbb50('0x2a'),_0x235e64);return BPromise[_0xbb50('0x2b')]({'id':_0x1c49d6['Id'],'name':_0x1c49d6[_0xbb50('0x2c')]});}}else{logger[_0xbb50('0x20')](_0xbb50('0x2d'),_0x235e64);return _0x2b116d[_0xbb50('0x2e')]()[_0xbb50('0x27')](function(_0x3f7b59){return BPromise['resolve']({'id':_0x3f7b59['user_id'],'name':_0x3f7b59[_0xbb50('0x2f')]});});}});}else{logger['info'](_0xbb50('0x2d'),_0x235e64);return _0x2b116d[_0xbb50('0x2e')]()['then'](function(_0x3f5f24){return BPromise[_0xbb50('0x2b')]({'id':_0x3f5f24[_0xbb50('0x30')],'name':_0x3f5f24['display_name']});});}}function getEndUser(_0x521f4c,_0x467d7c,_0x2e1187,_0x4c21f3,_0x49e0b6){var _0x10998b={'$or':{'Phone':_0x4c21f3}};var _0x1947f3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbb50('0x2b')]()[_0xbb50('0x27')](function(){logger[_0xbb50('0x20')](_0xbb50('0x31'),_0x4c21f3,_0x467d7c['moduleSearch']);switch(_0x467d7c[_0xbb50('0x32')]){case'contact_lead':var _0xf04014=_['cloneDeep'](_0x10998b);if(_0x467d7c[_0xbb50('0x33')]){var _0x5545c={};_0x5545c[_0x467d7c[_0xbb50('0x33')]]=_0x4c21f3;_[_0xbb50('0x34')](_0xf04014[_0xbb50('0x35')],_0x5545c);}return _0x49e0b6[_0xbb50('0x22')]('Contact')[_0xbb50('0x25')](_0xf04014,_0x1947f3)[_0xbb50('0x26')]()['then'](function(_0x1b82d6){if(_0x1b82d6&&_0x1b82d6['length']){return _0x1b82d6;}else{var _0xf0a99a=_['cloneDeep'](_0x10998b);if(_0x467d7c['additionalSearchLead']){var _0x1fc6f1={};_0x1fc6f1[_0x467d7c[_0xbb50('0x36')]]=_0x4c21f3;_[_0xbb50('0x34')](_0xf0a99a[_0xbb50('0x35')],_0x1fc6f1);}return _0x49e0b6[_0xbb50('0x22')](_0xbb50('0x37'))['find'](_0xf0a99a,_0x1947f3);}});case _0xbb50('0x38'):var _0x29b5e8=_[_0xbb50('0x39')](_0x10998b);if(_0x467d7c[_0xbb50('0x3a')]){var _0x5545c={};_0x5545c[_0x467d7c[_0xbb50('0x3a')]]=_0x4c21f3;_['merge'](_0x29b5e8[_0xbb50('0x35')],_0x5545c);}return _0x49e0b6[_0xbb50('0x22')](_0xbb50('0x3b'))['find'](_0x29b5e8,_0x1947f3)['execute']()[_0xbb50('0x27')](function(_0x16c19b){if(_0x16c19b&&_0x16c19b[_0xbb50('0x28')]){return _0x16c19b;}else{var _0x140b9a=_[_0xbb50('0x39')](_0x10998b);if(_0x467d7c[_0xbb50('0x33')]){var _0x872917={};_0x872917[_0x467d7c['additionalSearchContact']]=_0x4c21f3;_['merge'](_0x140b9a[_0xbb50('0x35')],_0x872917);}return _0x49e0b6[_0xbb50('0x22')](_0xbb50('0x3c'))[_0xbb50('0x25')](_0x140b9a,_0x1947f3)[_0xbb50('0x27')](function(_0x45ebc3){if(_0x45ebc3&&_0x45ebc3[_0xbb50('0x28')]){return _0x45ebc3;}else{var _0x9563e2=_[_0xbb50('0x39')](_0x10998b);if(_0x467d7c[_0xbb50('0x36')]){var _0x21f277={};_0x21f277[_0x467d7c[_0xbb50('0x36')]]=_0x4c21f3;_['merge'](_0x9563e2[_0xbb50('0x35')],_0x21f277);}return _0x49e0b6[_0xbb50('0x22')](_0xbb50('0x37'))[_0xbb50('0x25')](_0x9563e2,_0x1947f3);}});}});case _0xbb50('0x1b'):var _0xf04014=_[_0xbb50('0x39')](_0x10998b);if(_0x467d7c[_0xbb50('0x33')]){var _0x5545c={};_0x5545c[_0x467d7c[_0xbb50('0x33')]]=_0x4c21f3;_['merge'](_0xf04014['$or'],_0x5545c);}return _0x49e0b6[_0xbb50('0x22')](_0xbb50('0x3c'))['find'](_0xf04014,_0x1947f3)[_0xbb50('0x26')]();case _0xbb50('0x17'):var _0x87c6f8=_[_0xbb50('0x39')](_0x10998b);if(_0x467d7c['additionalSearchLead']){var _0x5545c={};_0x5545c[_0x467d7c[_0xbb50('0x36')]]=_0x4c21f3;_[_0xbb50('0x34')](_0x87c6f8[_0xbb50('0x35')],_0x5545c);}return _0x49e0b6[_0xbb50('0x22')](_0xbb50('0x37'))['find'](_0x87c6f8,_0x1947f3);case _0xbb50('0x1d'):var _0x29b5e8=_[_0xbb50('0x39')](_0x10998b);if(_0x467d7c[_0xbb50('0x3a')]){var _0x5545c={};_0x5545c[_0x467d7c['additionalSearchAccount']]=_0x4c21f3;_[_0xbb50('0x34')](_0x29b5e8[_0xbb50('0x35')],_0x5545c);}return _0x49e0b6['sobject'](_0xbb50('0x3b'))[_0xbb50('0x25')](_0x29b5e8,_0x1947f3);default:return null;}})[_0xbb50('0x27')](function(_0x168ae7){if(_0x168ae7&&_0x168ae7[_0xbb50('0x28')]){var _0xc9c8cc=_[_0xbb50('0x3d')](_0x168ae7);if(_0xc9c8cc){return BPromise[_0xbb50('0x2b')]({'id':_0xc9c8cc['Id'],'name':_0xc9c8cc[_0xbb50('0x2c')],'phone':_0xc9c8cc['Phone'],'endUserType':_0xc9c8cc[_0xbb50('0x3e')]['type']['toLowerCase']()});}}})['then'](function(_0x332a95){if(_0x332a95){logger['info'](_0xbb50('0x3f'),_0x332a95[_0xbb50('0x16')],_0x4c21f3);return BPromise[_0xbb50('0x2b')](_0x332a95);}else{logger[_0xbb50('0x20')](_0xbb50('0x40'),_0x4c21f3);var _0x34b94e={'Phone':_0x4c21f3};if(_0x467d7c['moduleCreate']){if(_0x467d7c[_0xbb50('0x41')]==='contact'){logger['info'](_0xbb50('0x42'),_0x4c21f3,_0x467d7c['moduleCreate']);_0x34b94e[_0xbb50('0x43')]=_0x2e1187!==_0xbb50('0x44')?_0x2e1187:util[_0xbb50('0x45')](_0xbb50('0x46'),_0x4c21f3);}else if(_0x467d7c[_0xbb50('0x41')]===_0xbb50('0x17')){logger[_0xbb50('0x20')](_0xbb50('0x42'),_0x4c21f3,_0x467d7c[_0xbb50('0x41')]);_0x34b94e[_0xbb50('0x43')]=_0x2e1187!==_0xbb50('0x44')?_0x2e1187:util[_0xbb50('0x45')](_0xbb50('0x46'),_0x4c21f3);_0x34b94e['Company']=_0xbb50('0x47');}else if(_0x467d7c[_0xbb50('0x41')]===_0xbb50('0x1d')){logger['info'](_0xbb50('0x42'),_0x4c21f3,_0x467d7c[_0xbb50('0x41')]);_0x34b94e['Name']=_0x2e1187!==_0xbb50('0x44')?_0x2e1187:util[_0xbb50('0x45')](_0xbb50('0x46'),_0x4c21f3);}else{return null;}}return _0x49e0b6[_0xbb50('0x22')](_['upperFirst'](_0x467d7c[_0xbb50('0x41')]))['create'](_0x34b94e)[_0xbb50('0x27')](function(_0x509f17){return BPromise['resolve']({'id':_0x509f17['id'],'endUserType':_0x467d7c['moduleCreate']});});}});}function getCustomFields(_0x2c704d,_0x1df7ca){var _0x1fbae0={};if(_0x2c704d[_0xbb50('0x28')]>0x0){_['forEach'](_0x2c704d,function(_0x345168){if(_[_0xbb50('0x48')]([_0xbb50('0x49'),_0xbb50('0x4a')],_0x345168[_0xbb50('0x4b')])&&_0x345168[_0xbb50('0x4c')]){_0x1fbae0[_0x345168[_0xbb50('0x4c')]]=_0x345168[_0xbb50('0x4d')][_0xbb50('0x4e')]();}else if(_0x345168[_0xbb50('0x4b')]===_0xbb50('0x4f')&&_0x345168[_0xbb50('0x50')]&&_0x345168['idField']){_0x1df7ca[_0x345168['variableName']]&&(_0x1fbae0[_0x345168[_0xbb50('0x4c')]]=_0x1df7ca[_0x345168['variableName']][_0xbb50('0x4e')]());}else if(_0x345168[_0xbb50('0x4b')]===_0xbb50('0x51')&&_0x345168[_0xbb50('0x52')]&&_0x345168[_0xbb50('0x52')][_0xbb50('0x53')]&&_0x345168[_0xbb50('0x4c')]){_0x1df7ca[_0x345168[_0xbb50('0x52')][_0xbb50('0x53')][_0xbb50('0x54')]()]&&(_0x1fbae0[_0x345168[_0xbb50('0x4c')]]=_0x1df7ca[_0x345168[_0xbb50('0x52')][_0xbb50('0x53')][_0xbb50('0x54')]()][_0xbb50('0x4e')]());}});}return _0x1fbae0;}function getConnection(_0x537070){var _0x37cf83=_0x537070[_0xbb50('0x55')][_0xbb50('0x56')](_0x537070[_0xbb50('0x57')]);var _0x39c334=new jsforce[(_0xbb50('0x58'))]({'oauth2':{'loginUrl':_0x537070[_0xbb50('0x59')]||_0xbb50('0x5a'),'clientId':_0x537070[_0xbb50('0x5b')],'clientSecret':_0x537070[_0xbb50('0x5c')]}});return _0x39c334[_0xbb50('0x5d')](_0x537070['username'],_0x37cf83)[_0xbb50('0x27')](function(){logger['info'](_0xbb50('0x5e'));return _0x39c334;});}exports['queue']=function(_0x142236,_0x52847b,_0x96cab3,_0x238a2f,_0x1fbdad,_0x493220){var _0x23f900,_0xc4590d,_0x249d73,_0x593e93;_0x493220[_0xbb50('0x5f')]=intUtil[_0xbb50('0x60')](_0x493220[_0xbb50('0x5f')]);_0x493220[_0xbb50('0x59')]=intUtil[_0xbb50('0x60')](_0x493220['remoteUri']);if(_0x1fbdad&&_0x1fbdad[_0xbb50('0x61')]){logger[_0xbb50('0x20')]('[QUEUE]','Recording\x20is\x20enabled!');_0x52847b[_0xbb50('0x62')]=util[_0xbb50('0x45')](_0xbb50('0x63'),_0x493220['serverUrl'],_0x52847b['uniqueid'],md5(_0x52847b[_0xbb50('0x64')]));}else{_0x52847b[_0xbb50('0x62')]='';}return getConnection(_0x493220)[_0xbb50('0x27')](function(_0x447edf){_0x593e93=_0x447edf;return getUser(_0x493220,_0x238a2f[_0xbb50('0x65')],_0x593e93);})[_0xbb50('0x27')](function(_0x1e6d33){_0x23f900=_0x1e6d33;return getEndUser(_0x493220,_0x96cab3,_0x52847b['calleridname'],_0x52847b['calleridnum'],_0x593e93);})[_0xbb50('0x27')](function(_0x39e931){_0xc4590d=_0x39e931;return getTicket(_0x493220,_0x23f900,_0xc4590d,_0x96cab3,_0x52847b,_0x96cab3['Fields'],_0x593e93,_0xbb50('0x66'));})[_0xbb50('0x27')](function(_0xfdb98d){_0x249d73=_0xfdb98d;logger[_0xbb50('0x20')](_0xbb50('0x67'),_0x249d73['id']);logger[_0xbb50('0x20')](_0xbb50('0x68'),_0x249d73['id'],_0x238a2f[_0xbb50('0x53')],_0x493220['type']);switch(_0x493220[_0xbb50('0x4b')]){case _0xbb50('0x69'):emit(util[_0xbb50('0x45')](_0xbb50('0x6a'),_0x238a2f[_0xbb50('0x53')]),_0xbb50('0x6b'),{'recordId':_0x249d73['id']});break;case'newTab':emit(util['format'](_0xbb50('0x6a'),_0x238a2f['name']),_0xbb50('0x6c'),{'uri':util[_0xbb50('0x45')](_0xbb50('0x6d'),_0x593e93[_0xbb50('0x6e')],_0x249d73['id'])});break;default:logger[_0xbb50('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xbb50('0x70')](function(_0x4251c5){logger['error']('[QUEUE]',_0x4251c5);});};exports['outbound']=function(_0x45b904,_0x5dec58,_0x5c6491,_0x32a508,_0x208269,_0x4aa611,_0x237f66){var _0x4ca624,_0x240613,_0x1cce63,_0x576812;_0x4aa611[_0xbb50('0x5f')]=intUtil[_0xbb50('0x60')](_0x4aa611[_0xbb50('0x5f')]);_0x4aa611[_0xbb50('0x59')]=intUtil['stripTrailingSlash'](_0x4aa611[_0xbb50('0x59')]);if(_0x237f66&&_0x237f66['recordingFormat']&&_0x237f66[_0xbb50('0x71')]!=='none'){logger[_0xbb50('0x20')](_0xbb50('0x72'),_0xbb50('0x73'));_0x5dec58[_0xbb50('0x62')]=util[_0xbb50('0x45')](_0xbb50('0x63'),_0x4aa611[_0xbb50('0x5f')],_0x5dec58[_0xbb50('0x64')],md5(_0x5dec58[_0xbb50('0x64')]));}return getConnection(_0x4aa611)['then'](function(_0x3b053f){_0x576812=_0x3b053f;return getUser(_0x4aa611,_0x32a508[_0xbb50('0x65')],_0x576812);})['then'](function(_0x1f559a){_0x4ca624=_0x1f559a;return getEndUser(_0x4aa611,_0x5c6491,_0x5dec58['destcalleridname'],_0x5dec58[_0xbb50('0x74')],_0x576812);})[_0xbb50('0x27')](function(_0xe27695){_0x240613=_0xe27695;return getTicket(_0x4aa611,_0x4ca624,_0x240613,_0x5c6491,_0x5dec58,_0x5c6491[_0xbb50('0x75')],_0x576812,_0xbb50('0x76'));})[_0xbb50('0x27')](function(_0x17ee85){_0x1cce63=_0x17ee85;logger[_0xbb50('0x20')](_0xbb50('0x77'),_0x1cce63['id']);logger[_0xbb50('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1cce63['id'],_0x32a508[_0xbb50('0x53')],_0x4aa611[_0xbb50('0x4b')]);switch(_0x4aa611[_0xbb50('0x4b')]){case'integrationTab':emit(util[_0xbb50('0x45')](_0xbb50('0x6a'),_0x32a508[_0xbb50('0x53')]),_0xbb50('0x6b'),{'recordId':_0x1cce63['id']});break;case'newTab':emit(util['format']('user:%s',_0x32a508['name']),_0xbb50('0x6c'),{'uri':util[_0xbb50('0x45')](_0xbb50('0x6d'),_0x576812[_0xbb50('0x6e')],_0x1cce63['id'])});break;default:logger[_0xbb50('0x6f')](_0xbb50('0x72'),_0xbb50('0x78'));}})[_0xbb50('0x70')](function(_0x23bd57){logger[_0xbb50('0x6f')](_0xbb50('0x72'),_0x23bd57);});};exports['unmanaged']=function(_0x248be2,_0x3f0f94,_0x2f8a2a,_0x5b5cb8,_0x4d6a56,_0x163ea2){var _0x39de14,_0x9e2ce6,_0x22dd3d,_0x4816f0;_0x163ea2[_0xbb50('0x5f')]=intUtil[_0xbb50('0x60')](_0x163ea2[_0xbb50('0x5f')]);_0x163ea2[_0xbb50('0x59')]=intUtil[_0xbb50('0x60')](_0x163ea2[_0xbb50('0x59')]);if(_0x4d6a56&&_0x4d6a56['monitor_format']){logger[_0xbb50('0x20')]('['+_0x3f0f94[_0xbb50('0x79')][_0xbb50('0x7a')]()+']',_0xbb50('0x73'));_0x3f0f94['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x163ea2['serverUrl'],_0x3f0f94['uniqueid'],md5(_0x3f0f94[_0xbb50('0x64')]));}else{_0x3f0f94[_0xbb50('0x62')]='';}return getConnection(_0x163ea2)['then'](function(_0x3b86bf){_0x4816f0=_0x3b86bf;if(!_['isNil'](_0x5b5cb8)){return getUser(_0x163ea2,_0x5b5cb8['name'],_0x4816f0);}else{return getUser(_0x163ea2,null,_0x4816f0);}})[_0xbb50('0x27')](function(_0x540f83){_0x39de14=_0x540f83;return getEndUser(_0x163ea2,_0x2f8a2a,_0x3f0f94[_0xbb50('0x7b')],_0x3f0f94[_0xbb50('0x7c')],_0x4816f0);})[_0xbb50('0x27')](function(_0x246eff){_0x9e2ce6=_0x246eff;return getTicket(_0x163ea2,_0x39de14,_0x9e2ce6,_0x2f8a2a,_0x3f0f94,_0x2f8a2a['Fields'],_0x4816f0);})[_0xbb50('0x27')](function(_0x386b65){_0x22dd3d=_0x386b65;logger[_0xbb50('0x20')]('['+_0x3f0f94[_0xbb50('0x79')][_0xbb50('0x7a')]()+_0xbb50('0x7d'),_0x22dd3d['id']);logger[_0xbb50('0x20')]('['+_0x3f0f94[_0xbb50('0x79')]['toUpperCase']()+_0xbb50('0x7e'),_0x163ea2[_0xbb50('0x4b')]);})[_0xbb50('0x70')](function(_0x18de78){logger['error']('['+_0x3f0f94[_0xbb50('0x79')][_0xbb50('0x7a')]()+']',_0x18de78);});}; \ 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 0597dbf..b5f5bce 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 _0xb1a5=['user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','%s/api/now/table/','email','adminEmail','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','result','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','length','active','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','content','toString','includes','idField','customField','toLowerCase','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','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'];(function(_0x12309b,_0x59dd8c){var _0x482e4d=function(_0x308407){while(--_0x308407){_0x12309b['push'](_0x12309b['shift']());}};_0x482e4d(++_0x59dd8c);}(_0xb1a5,0x8a));var _0x5b1a=function(_0x7aafa0,_0x3377c8){_0x7aafa0=_0x7aafa0-0x0;var _0x315548=_0xb1a5[_0x7aafa0];return _0x315548;};'use strict';var _=require(_0x5b1a('0x0'));var Promise=require(_0x5b1a('0x1'));var rp=require(_0x5b1a('0x2'));var util=require(_0x5b1a('0x3'));var md5=require(_0x5b1a('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x5b1a('0x5'));var logger=require(_0x5b1a('0x6'))(_0x5b1a('0x7'));config[_0x5b1a('0x8')]=_[_0x5b1a('0x9')](config['redis'],{'host':_0x5b1a('0xa'),'port':0x18eb});var io=require(_0x5b1a('0xb'))(new Redis(config[_0x5b1a('0x8')]));function getAdminUser(_0x8e03ab,_0x829b48,_0x321544,_0x417fa3,_0x3ca2be,_0x421b50){return new Promise(function(_0x51a16a,_0x4b06f5){var _0x4d8569={'method':'GET','uri':_0x417fa3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3ca2be+'&'+_0x421b50,'auth':_0x829b48,'json':!![]};return rp(_0x4d8569)['then'](function(_0x169ac5){if(_0x169ac5[_0x5b1a('0xc')]['length']>0x0){_0x321544[_0x5b1a('0xd')]=_0x169ac5['result'][0x0][_0x5b1a('0xe')];}logger[_0x5b1a('0xf')]('['+[_0x8e03ab[_0x5b1a('0x10')]()]+'],\x20getAdminUser\x20crm',_0x321544);_0x51a16a(_0x321544);})[_0x5b1a('0x11')](function(_0x42de72){logger[_0x5b1a('0x12')]('['+[_0x8e03ab[_0x5b1a('0x10')]()]+']',_0x42de72[_0x5b1a('0x13')]);_0x4b06f5(_0x42de72[_0x5b1a('0x13')]);});});}function getUser(_0x3ef7db,_0x42846b,_0x45536b,_0x108d15,_0x1ea7ec){return function(_0x423a7a){logger[_0x5b1a('0xf')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+_0x5b1a('0x14'),_0x423a7a);return new Promise(function(_0x24e858,_0x205980){if(intUtil[_0x5b1a('0x15')](_0x423a7a[_0x5b1a('0x16')])){var _0x108493={'method':_0x5b1a('0x17'),'uri':_0x45536b+'sys_user?sysparm_query=email%3D'+_0x423a7a[_0x5b1a('0x16')]+'&'+_0x108d15+'&'+_0x1ea7ec,'auth':_0x42846b,'json':!![]};logger[_0x5b1a('0xf')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+_0x5b1a('0x18'),_0x108493);return rp(_0x108493)[_0x5b1a('0x19')](function(_0x14d2f8){logger[_0x5b1a('0xf')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+_0x5b1a('0x1a'),_0x14d2f8);if(_0x14d2f8['result'][_0x5b1a('0x1b')]>0x0&&String(_0x14d2f8[_0x5b1a('0xc')][0x0][_0x5b1a('0x1c')])==='true'){_0x423a7a[_0x5b1a('0x1d')]=_0x14d2f8[_0x5b1a('0xc')][0x0][_0x5b1a('0xe')];}else{_0x423a7a[_0x5b1a('0x1d')]=_0x423a7a[_0x5b1a('0xd')];_0x423a7a[_0x5b1a('0x16')]=_0x423a7a['adminEmail'];}logger[_0x5b1a('0xf')]('['+[_0x3ef7db['toUpperCase']()]+_0x5b1a('0x1e'),_0x423a7a);_0x24e858(_0x423a7a);})[_0x5b1a('0x11')](function(_0x504526){logger[_0x5b1a('0x12')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+']',_0x504526['message']);_0x205980(_0x504526['message']);});}else{logger[_0x5b1a('0xf')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+_0x5b1a('0x1f'));_0x423a7a[_0x5b1a('0x1d')]=_0x423a7a[_0x5b1a('0xd')];_0x423a7a[_0x5b1a('0x16')]=_0x423a7a['adminEmail'];_0x24e858(_0x423a7a);}});};}function createEndUser(_0x16e647,_0x755d89,_0x1838ff,_0x2ef92e,_0x468295){logger[_0x5b1a('0xf')]('['+[_0x16e647[_0x5b1a('0x10')]()]+_0x5b1a('0x20'),_0x1838ff);return new Promise(function(_0x5f3959,_0x50b866){var _0x467e95={'method':_0x5b1a('0x21'),'uri':_0x2ef92e+_0x5b1a('0x22')+_0x468295,'body':{'user_name':_0x1838ff[_0x5b1a('0x23')],'roles':'user','first_name':_0x1838ff[_0x5b1a('0x23')],'active':_0x5b1a('0x24'),'date_format':_0x5b1a('0x25'),'phone':_0x1838ff['endUserNumber']},'auth':_0x755d89,'json':!![]};return rp(_0x467e95)[_0x5b1a('0x19')](function(_0x27ba9a){logger['info']('['+[_0x16e647[_0x5b1a('0x10')]()]+_0x5b1a('0x26'),_0x27ba9a[_0x5b1a('0xc')]);_0x1838ff['endUserId']=_0x27ba9a[_0x5b1a('0xc')][_0x5b1a('0xe')];_0x5f3959(_0x1838ff);})[_0x5b1a('0x11')](function(_0x44675e){logger[_0x5b1a('0x12')]('['+[_0x16e647['toUpperCase']()]+']',_0x44675e[_0x5b1a('0x13')]);_0x50b866(_0x44675e[_0x5b1a('0x13')]);});});}function getEndUser(_0x14bc2a,_0x4e0214,_0x58232b,_0x2270b6,_0x4a4c42){return function(_0x55f4d7){logger['info']('['+[_0x14bc2a[_0x5b1a('0x10')]()]+_0x5b1a('0x27'),_0x55f4d7);return new Promise(function(_0x531d22,_0x3a562b){var _0x3b92f2={'method':_0x5b1a('0x17'),'uri':_0x58232b+'sys_user?sysparm_query=phone%3D'+_0x55f4d7[_0x5b1a('0x23')]+'&'+_0x2270b6+'&'+_0x4a4c42,'auth':_0x4e0214,'json':!![]};return rp(_0x3b92f2)[_0x5b1a('0x19')](function(_0x49ec6f){if(_0x49ec6f[_0x5b1a('0xc')]['length']>0x0){_0x55f4d7[_0x5b1a('0x28')]=_0x49ec6f[_0x5b1a('0xc')][0x0]['sys_id'];logger['info']('['+[_0x14bc2a['toUpperCase']()]+_0x5b1a('0x29'),_0x55f4d7);_0x531d22(_0x55f4d7);}else{return createEndUser(_0x14bc2a,_0x4e0214,_0x55f4d7,_0x58232b,_0x2270b6)['then'](function(_0x2b9145){logger['info']('['+[_0x14bc2a['toUpperCase']()]+_0x5b1a('0x2a'),_0x2b9145);_0x531d22(_0x2b9145);});}})[_0x5b1a('0x11')](function(_0x530bbe){logger[_0x5b1a('0x12')]('['+[_0x14bc2a['toUpperCase']()]+']',_0x530bbe['message']);_0x3a562b(_0x530bbe[_0x5b1a('0x13')]);});});};}function getCustomFields(_0x4a7c05,_0x50b1df){var _0x204909={};if(_0x4a7c05[_0x5b1a('0x1b')]>0x0){_[_0x5b1a('0x2b')](_0x4a7c05,function(_0x190f6f){if(_['includes']([_0x5b1a('0x2c'),_0x5b1a('0x2d')],_0x190f6f[_0x5b1a('0x2e')])&&_0x190f6f[_0x5b1a('0x2f')]&&!_0x190f6f['customField']){_0x204909[_0x190f6f[_0x5b1a('0x2f')]['toLowerCase']()]=_0x190f6f[_0x5b1a('0x30')][_0x5b1a('0x31')]();}else if(_[_0x5b1a('0x32')]([_0x5b1a('0x2c'),_0x5b1a('0x2d')],_0x190f6f[_0x5b1a('0x2e')])&&_0x190f6f[_0x5b1a('0x33')]&&_0x190f6f[_0x5b1a('0x34')]){_0x204909[_0x190f6f[_0x5b1a('0x33')][_0x5b1a('0x35')]()]=_0x190f6f[_0x5b1a('0x30')][_0x5b1a('0x31')]();}else if(_0x190f6f[_0x5b1a('0x2e')]==='variable'&&_0x190f6f['variableName']&&_0x190f6f[_0x5b1a('0x33')]&&_0x190f6f[_0x5b1a('0x34')]){_0x204909[_0x190f6f['idField'][_0x5b1a('0x35')]()]=_0x50b1df[_0x190f6f[_0x5b1a('0x36')]][_0x5b1a('0x31')]();}else if(_0x190f6f[_0x5b1a('0x2e')]===_0x5b1a('0x37')&&_0x190f6f['Variable']&&_0x190f6f[_0x5b1a('0x38')][_0x5b1a('0x39')]&&_0x190f6f[_0x5b1a('0x33')]&&_0x190f6f[_0x5b1a('0x34')]){_0x204909[_0x190f6f['idField']['toLowerCase']()]=_0x50b1df[_0x190f6f[_0x5b1a('0x38')][_0x5b1a('0x39')]['toLowerCase']()][_0x5b1a('0x31')]();}});}return _0x204909;}function getTicket(_0x274f79,_0x4384dd,_0x5ebb82,_0xb569e6,_0x275a94,_0x3f6f6d){return function(_0x1c14b4){logger[_0x5b1a('0xf')]('['+[_0x274f79[_0x5b1a('0x10')]()]+_0x5b1a('0x3a'),_0x1c14b4);return new Promise(function(_0x59e622,_0x2c185b){var _0x268773=_0x274f79['toLowerCase']()==='outbound'?_0x1c14b4[_0x5b1a('0x1d')]:_0x1c14b4[_0x5b1a('0x28')];var _0x36c0bf={'method':'POST','uri':_0x5ebb82+_0x5b1a('0x3b')+'?'+_0x3f6f6d,'body':Object[_0x5b1a('0x3c')]({},{'active':'true','caller_id':_0x268773,'assigned_to':_0x1c14b4[_0x5b1a('0x1d')],'short_description':intUtil[_0x5b1a('0x3d')](_0xb569e6[_0x5b1a('0x3e')],_0x275a94,'\x20'),'description':intUtil[_0x5b1a('0x3d')](_0xb569e6[_0x5b1a('0x3f')],_0x275a94,'\x0a')},getCustomFields(_0xb569e6[_0x5b1a('0x40')],_0x275a94)),'auth':_0x4384dd,'json':!![]};return rp(_0x36c0bf)['then'](function(_0x4b1985){logger['info']('['+[_0x274f79[_0x5b1a('0x10')]()]+_0x5b1a('0x41'),_0x4b1985[_0x5b1a('0xc')]);_0x1c14b4[_0x5b1a('0x42')]=_0x4b1985[_0x5b1a('0xc')][_0x5b1a('0xe')];_0x1c14b4[_0x5b1a('0x43')]=_0x4b1985[_0x5b1a('0xc')][_0x5b1a('0x44')];logger[_0x5b1a('0xf')]('['+[_0x274f79['toUpperCase']()]+_0x5b1a('0x45'),_0x1c14b4);_0x59e622(_0x1c14b4);})[_0x5b1a('0x11')](function(_0x5501e4){logger['error']('['+[_0x274f79[_0x5b1a('0x10')]()]+']',_0x5501e4[_0x5b1a('0x13')]);_0x2c185b(_0x5501e4[_0x5b1a('0x13')]);});});};}function createRemoteTag(_0x377e37,_0x5cfc95,_0x398ea4,_0x21d227){return new Promise(function(_0x205ed4,_0x552e74){var _0x1fbbe4={'method':_0x5b1a('0x21'),'uri':_0x398ea4+_0x5b1a('0x46')+'?'+_0x21d227,'body':{'short_description':_0x377e37,'global':!![],'active':!![],'name':_0x377e37},'auth':_0x5cfc95,'json':!![]};return rp(_0x1fbbe4)[_0x5b1a('0x19')](function(_0x39ae74){var _0x2945ad=_0x39ae74[_0x5b1a('0xc')][_0x5b1a('0xe')];_0x205ed4(_0x2945ad);});});}function getRemoteTag(_0x471ec9,_0x5e4750,_0x479a1d,_0x302ba0,_0x54eef2){return new Promise(function(_0x28a506,_0x292e94){var _0x281b8e={'method':'GET','uri':_0x479a1d+_0x5b1a('0x46')+_0x5b1a('0x47')+_0x471ec9+'&'+_0x302ba0,'auth':_0x5e4750,'json':!![]};return rp(_0x281b8e)[_0x5b1a('0x19')](function(_0x57151c){if(_0x57151c[_0x5b1a('0xc')][_0x5b1a('0x1b')]>0x0){var _0x5f299e=_0x57151c['result'][0x0][_0x5b1a('0xe')];_0x28a506(_0x5f299e);}else{return createRemoteTag(_0x471ec9,_0x5e4750,_0x479a1d,_0x302ba0)[_0x5b1a('0x19')](function(_0x298545){_0x28a506(_0x298545);});}});});}function assignTagToIncident(_0x16197a,_0x2a6c3a,_0x5beeb6,_0x3b7d0c,_0x10b0f6){return new Promise(function(_0x4b9cf6,_0x19b7b1){var _0x76f7d7={'method':_0x5b1a('0x21'),'uri':_0x5beeb6+_0x5b1a('0x48')+'?'+_0x10b0f6,'body':{'label':_0x16197a,'table':'incident','id_type':_0x5b1a('0x49'),'table_key':_0x3b7d0c['ticketId'],'title':_0x5b1a('0x4a')+_0x3b7d0c['ticketNumber'],'id_display':_0x3b7d0c[_0x5b1a('0x43')]},'auth':_0x2a6c3a,'json':!![]};return rp(_0x76f7d7)['then'](function(_0x185428){_0x4b9cf6();})['catch'](function(){_0x4b9cf6();});});}function manageTags(_0x8de6a8,_0x120ef4,_0x4fc470,_0xec2ac2,_0x44652f,_0x34e9db,_0x1e90cd){return new Promise(function(_0x41f49e,_0xe6818f){var _0x192d9b=[];_0x120ef4[_0x5b1a('0x2b')](function(_0x41618c){_0x192d9b[_0x5b1a('0x4b')](getRemoteTag(_0x41618c,_0x4fc470,_0xec2ac2,_0x34e9db,_0x1e90cd));});return Promise['all'](_0x192d9b)[_0x5b1a('0x19')](function(_0x1bd2a9){if(_0x1bd2a9[_0x5b1a('0x1b')]){logger['info']('['+[_0x8de6a8[_0x5b1a('0x10')]()]+_0x5b1a('0x4c'),_0x1bd2a9);var _0x4470f2=[];_0x1bd2a9[_0x5b1a('0x2b')](function(_0x195893){_0x4470f2[_0x5b1a('0x4b')](assignTagToIncident(_0x195893,_0x4fc470,_0xec2ac2,_0x44652f,_0x34e9db));});return Promise['all'](_0x4470f2)[_0x5b1a('0x19')](function(){_0x41f49e();})[_0x5b1a('0x11')](function(){_0x41f49e();});}else{_0x41f49e();}});});}function getTags(_0x597e9d,_0x1650ce,_0x149286,_0x1999ac,_0x41f423,_0xf19e0f){return function(_0x2e2077){return new Promise(function(_0x2e52de,_0x2c1a9d){var _0x244295=[];var _0x5e05df=_0x1999ac[_0x5b1a('0x4d')];if(_0x5e05df&&_0x5e05df['length']>0x0){_0x244295=_[_0x5b1a('0x4e')](_0x5e05df,'name');}if(_0x244295[_0x5b1a('0x1b')]>0x0){return manageTags(_0x597e9d,_0x244295,_0x1650ce,_0x149286,_0x2e2077,_0x41f423,_0xf19e0f)[_0x5b1a('0x19')](function(){_0x2e52de(_0x2e2077);});}else{_0x2e52de(_0x2e2077);}});};}function emit(_0x2fb209,_0x124db9,_0x2e2612){var _0x26ac70=_0x5b1a('0x4f')+_0x5b1a('0x50')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x5b1a('0x51');var _0x1f77d1={'uri':_0x2fb209+_0x5b1a('0x52')+_0x2e2612+_0x26ac70};io['to'](util[_0x5b1a('0x53')](_0x5b1a('0x54'),_0x124db9))[_0x5b1a('0x55')](_0x5b1a('0x56'),_0x1f77d1);}exports['cs']=function(_0x5ad092,_0x7415de,_0x124c7e,_0x2b3ed5,_0xd6a61,_0x22c5d2,_0x208262,_0x23bde6){var _0x2cde2c={};var _0xd8cfbb={'user':_0x22c5d2[_0x5b1a('0x57')],'pass':_0x22c5d2[_0x5b1a('0x58')]};var _0x3393ea=_0x5b1a('0x59');var _0x27388d='sysparm_display_value=true';_0x22c5d2[_0x5b1a('0x5a')]=intUtil[_0x5b1a('0x5b')](_0x22c5d2[_0x5b1a('0x5a')]);_0x22c5d2['serverUrl']=intUtil[_0x5b1a('0x5b')](_0x22c5d2['serverUrl']);var _0x4a01f4=util[_0x5b1a('0x53')](_0x5b1a('0x5c'),_0x22c5d2[_0x5b1a('0x5a')]);_0x2cde2c['userEmail']=!_['isNil'](_0x2b3ed5)?_0x2b3ed5[_0x5b1a('0x5d')]:null;_0x2cde2c[_0x5b1a('0x5e')]=_0x22c5d2[_0x5b1a('0x5d')];_0x2cde2c['endUserNumber']=_0x23bde6[_0x5b1a('0x35')]()==='outbound'?_0x7415de[_0x5b1a('0x5f')]:_0x7415de['calleridnum'];_0x2cde2c[_0x5b1a('0x60')]=_0x23bde6===_0x5b1a('0x61')||_0x23bde6==='unmanaged'?_0x5b1a('0x61'):'outbound';var _0x4e4dfc=util[_0x5b1a('0x53')](_0x5b1a('0x62'),_0x22c5d2[_0x5b1a('0x63')],_0x7415de[_0x5b1a('0x64')],md5(_0x7415de[_0x5b1a('0x64')]));if(_0xd6a61&&_0xd6a61[_0x5b1a('0x65')]){logger['info'](_0x5b1a('0x66'),_0x5b1a('0x67'));_0x7415de[_0x5b1a('0x68')]=_0x4e4dfc;}else if(_0x208262&&_0x208262[_0x5b1a('0x69')]&&_0x208262[_0x5b1a('0x69')]!==_0x5b1a('0x6a')){logger[_0x5b1a('0xf')]('[OUTBOUND]',_0x5b1a('0x67'));_0x7415de[_0x5b1a('0x68')]=_0x4e4dfc;}else{_0x7415de['recordingURL']='';}return getAdminUser(_0x23bde6,_0xd8cfbb,_0x2cde2c,_0x4a01f4,_0x27388d,_0x3393ea)['then'](getUser(_0x23bde6,_0xd8cfbb,_0x4a01f4,_0x27388d,_0x3393ea))[_0x5b1a('0x19')](getEndUser(_0x23bde6,_0xd8cfbb,_0x4a01f4,_0x27388d,_0x3393ea))[_0x5b1a('0x19')](getTicket(_0x23bde6,_0xd8cfbb,_0x4a01f4,_0x124c7e,_0x7415de,_0x27388d))[_0x5b1a('0x19')](function(_0x426e42){logger[_0x5b1a('0xf')](util['format'](_0x5b1a('0x6b'),_0x426e42[_0x5b1a('0x42')]));logger[_0x5b1a('0xf')](util['format'](_0x5b1a('0x6c'),_0x23bde6));if(_0x23bde6!=='unmanaged'){logger['info']('['+[_0x23bde6[_0x5b1a('0x10')]()]+']',_0x5b1a('0x6d'));emit(_0x22c5d2[_0x5b1a('0x5a')],_0x2b3ed5['name'],_0x426e42[_0x5b1a('0x42')]);}})[_0x5b1a('0x11')](function(_0x3b3e06){logger[_0x5b1a('0x12')]('['+[_0x23bde6[_0x5b1a('0x10')]()]+_0x5b1a('0x6e'),util['inspect'](_0x3b3e06,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x25d6=['all','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','nameField','string','type','idField','customField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push'];(function(_0x2e705e,_0x16e7f2){var _0x258cfe=function(_0x3e9ea5){while(--_0x3e9ea5){_0x2e705e['push'](_0x2e705e['shift']());}};_0x258cfe(++_0x16e7f2);}(_0x25d6,0x90));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x625d('0x0'));var Promise=require(_0x625d('0x1'));var rp=require(_0x625d('0x2'));var util=require(_0x625d('0x3'));var md5=require(_0x625d('0x4'));var Redis=require(_0x625d('0x5'));var intUtil=require(_0x625d('0x6'));var config=require(_0x625d('0x7'));var logger=require(_0x625d('0x8'))('servicenow');config[_0x625d('0x9')]=_['defaults'](config[_0x625d('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x625d('0xa'))(new Redis(config['redis']));function getAdminUser(_0x280783,_0x49c36b,_0x2b92c3,_0x215464,_0x49cd69,_0x5ca216){return new Promise(function(_0x518b76,_0x133b0d){var _0x18b498={'method':_0x625d('0xb'),'uri':_0x215464+_0x625d('0xc')+'&'+_0x49cd69+'&'+_0x5ca216,'auth':_0x49c36b,'json':!![]};return rp(_0x18b498)[_0x625d('0xd')](function(_0x2e0e9c){if(_0x2e0e9c['result'][_0x625d('0xe')]>0x0){_0x2b92c3[_0x625d('0xf')]=_0x2e0e9c[_0x625d('0x10')][0x0]['sys_id'];}logger[_0x625d('0x11')]('['+[_0x280783[_0x625d('0x12')]()]+_0x625d('0x13'),_0x2b92c3);_0x518b76(_0x2b92c3);})[_0x625d('0x14')](function(_0x36ae72){logger[_0x625d('0x15')]('['+[_0x280783[_0x625d('0x12')]()]+']',_0x36ae72['message']);_0x133b0d(_0x36ae72[_0x625d('0x16')]);});});}function getUser(_0x34c8a7,_0x34989a,_0x1ebe01,_0x1b2a43,_0x356fbb){return function(_0x36574f){logger[_0x625d('0x11')]('['+[_0x34c8a7[_0x625d('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x36574f);return new Promise(function(_0x1a43f7,_0x4e8e24){if(intUtil['validateEmail'](_0x36574f[_0x625d('0x17')])){var _0x24b177={'method':_0x625d('0xb'),'uri':_0x1ebe01+_0x625d('0x18')+_0x36574f['userEmail']+'&'+_0x1b2a43+'&'+_0x356fbb,'auth':_0x34989a,'json':!![]};logger['info']('['+[_0x34c8a7[_0x625d('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x24b177);return rp(_0x24b177)[_0x625d('0xd')](function(_0x58caff){logger[_0x625d('0x11')]('['+[_0x34c8a7[_0x625d('0x12')]()]+_0x625d('0x19'),_0x58caff);if(_0x58caff[_0x625d('0x10')]['length']>0x0&&String(_0x58caff[_0x625d('0x10')][0x0]['active'])===_0x625d('0x1a')){_0x36574f[_0x625d('0x1b')]=_0x58caff[_0x625d('0x10')][0x0][_0x625d('0x1c')];}else{_0x36574f[_0x625d('0x1b')]=_0x36574f[_0x625d('0xf')];_0x36574f[_0x625d('0x17')]=_0x36574f[_0x625d('0x1d')];}logger[_0x625d('0x11')]('['+[_0x34c8a7[_0x625d('0x12')]()]+_0x625d('0x1e'),_0x36574f);_0x1a43f7(_0x36574f);})['catch'](function(_0x1fde58){logger[_0x625d('0x15')]('['+[_0x34c8a7['toUpperCase']()]+']',_0x1fde58[_0x625d('0x16')]);_0x4e8e24(_0x1fde58['message']);});}else{logger['info']('['+[_0x34c8a7[_0x625d('0x12')]()]+_0x625d('0x1f'));_0x36574f[_0x625d('0x1b')]=_0x36574f[_0x625d('0xf')];_0x36574f[_0x625d('0x17')]=_0x36574f['adminEmail'];_0x1a43f7(_0x36574f);}});};}function createEndUser(_0x2488d0,_0x52c20c,_0x27b729,_0x530736,_0x321b56){logger[_0x625d('0x11')]('['+[_0x2488d0[_0x625d('0x12')]()]+_0x625d('0x20'),_0x27b729);return new Promise(function(_0x776a91,_0x161904){var _0x26dbf5={'method':_0x625d('0x21'),'uri':_0x530736+'sys_user?'+_0x321b56,'body':{'user_name':_0x27b729[_0x625d('0x22')],'roles':_0x625d('0x23'),'first_name':_0x27b729[_0x625d('0x22')],'active':_0x625d('0x1a'),'date_format':'System','phone':_0x27b729['endUserNumber']},'auth':_0x52c20c,'json':!![]};return rp(_0x26dbf5)['then'](function(_0x455bb0){logger['info']('['+[_0x2488d0['toUpperCase']()]+_0x625d('0x24'),_0x455bb0[_0x625d('0x10')]);_0x27b729[_0x625d('0x25')]=_0x455bb0[_0x625d('0x10')][_0x625d('0x1c')];_0x776a91(_0x27b729);})[_0x625d('0x14')](function(_0x45ec6c){logger[_0x625d('0x15')]('['+[_0x2488d0[_0x625d('0x12')]()]+']',_0x45ec6c[_0x625d('0x16')]);_0x161904(_0x45ec6c[_0x625d('0x16')]);});});}function getEndUser(_0x7c4c2e,_0x1e83d8,_0x560327,_0xf60dc8,_0x2d14b6){return function(_0x58cdaa){logger[_0x625d('0x11')]('['+[_0x7c4c2e[_0x625d('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0x58cdaa);return new Promise(function(_0x53a569,_0x1a9470){var _0x141904={'method':_0x625d('0xb'),'uri':_0x560327+_0x625d('0x26')+_0x58cdaa[_0x625d('0x22')]+'&'+_0xf60dc8+'&'+_0x2d14b6,'auth':_0x1e83d8,'json':!![]};return rp(_0x141904)[_0x625d('0xd')](function(_0x30ba57){if(_0x30ba57['result']['length']>0x0){_0x58cdaa[_0x625d('0x25')]=_0x30ba57[_0x625d('0x10')][0x0]['sys_id'];logger['info']('['+[_0x7c4c2e[_0x625d('0x12')]()]+_0x625d('0x27'),_0x58cdaa);_0x53a569(_0x58cdaa);}else{return createEndUser(_0x7c4c2e,_0x1e83d8,_0x58cdaa,_0x560327,_0xf60dc8)[_0x625d('0xd')](function(_0x4d2ee3){logger['info']('['+[_0x7c4c2e['toUpperCase']()]+_0x625d('0x28'),_0x4d2ee3);_0x53a569(_0x4d2ee3);});}})['catch'](function(_0x52b5aa){logger['error']('['+[_0x7c4c2e[_0x625d('0x12')]()]+']',_0x52b5aa[_0x625d('0x16')]);_0x1a9470(_0x52b5aa[_0x625d('0x16')]);});});};}function getCustomFields(_0x2a5038,_0x287fa6){var _0x2c89be={};if(_0x2a5038[_0x625d('0xe')]>0x0){_[_0x625d('0x29')](_0x2a5038,function(_0x2dcce5){if(_[_0x625d('0x2a')](['string',_0x625d('0x2b')],_0x2dcce5['type'])&&_0x2dcce5[_0x625d('0x2c')]&&!_0x2dcce5['customField']){_0x2c89be[_0x2dcce5[_0x625d('0x2c')]['toLowerCase']()]=_0x2dcce5['content']['toString']();}else if(_[_0x625d('0x2a')]([_0x625d('0x2d'),'picklist'],_0x2dcce5[_0x625d('0x2e')])&&_0x2dcce5[_0x625d('0x2f')]&&_0x2dcce5[_0x625d('0x30')]){_0x2c89be[_0x2dcce5[_0x625d('0x2f')][_0x625d('0x31')]()]=_0x2dcce5[_0x625d('0x32')][_0x625d('0x33')]();}else if(_0x2dcce5[_0x625d('0x2e')]===_0x625d('0x34')&&_0x2dcce5[_0x625d('0x35')]&&_0x2dcce5[_0x625d('0x2f')]&&_0x2dcce5[_0x625d('0x30')]){_0x2c89be[_0x2dcce5['idField'][_0x625d('0x31')]()]=_0x287fa6[_0x2dcce5[_0x625d('0x35')]][_0x625d('0x33')]();}else if(_0x2dcce5['type']===_0x625d('0x36')&&_0x2dcce5[_0x625d('0x37')]&&_0x2dcce5[_0x625d('0x37')][_0x625d('0x38')]&&_0x2dcce5[_0x625d('0x2f')]&&_0x2dcce5[_0x625d('0x30')]){_0x2c89be[_0x2dcce5['idField'][_0x625d('0x31')]()]=_0x287fa6[_0x2dcce5[_0x625d('0x37')][_0x625d('0x38')]['toLowerCase']()][_0x625d('0x33')]();}});}return _0x2c89be;}function getTicket(_0x308b8d,_0x1f8d83,_0x406071,_0x1396e6,_0x2618c9,_0x385cf0){return function(_0x5b0083){logger[_0x625d('0x11')]('['+[_0x308b8d[_0x625d('0x12')]()]+_0x625d('0x39'),_0x5b0083);return new Promise(function(_0x16a1e3,_0x23f8a1){var _0x58b0be=_0x308b8d['toLowerCase']()===_0x625d('0x3a')?_0x5b0083['userId']:_0x5b0083[_0x625d('0x25')];var _0x2467e7={'method':_0x625d('0x21'),'uri':_0x406071+_0x625d('0x3b')+'?'+_0x385cf0,'body':Object['assign']({},{'active':_0x625d('0x1a'),'caller_id':_0x58b0be,'assigned_to':_0x5b0083['userId'],'short_description':intUtil[_0x625d('0x3c')](_0x1396e6[_0x625d('0x3d')],_0x2618c9,'\x20'),'description':intUtil['getString'](_0x1396e6[_0x625d('0x3e')],_0x2618c9,'\x0a')},getCustomFields(_0x1396e6[_0x625d('0x3f')],_0x2618c9)),'auth':_0x1f8d83,'json':!![]};return rp(_0x2467e7)['then'](function(_0x31a684){logger[_0x625d('0x11')]('['+[_0x308b8d[_0x625d('0x12')]()]+_0x625d('0x40'),_0x31a684[_0x625d('0x10')]);_0x5b0083[_0x625d('0x41')]=_0x31a684[_0x625d('0x10')]['sys_id'];_0x5b0083[_0x625d('0x42')]=_0x31a684['result'][_0x625d('0x43')];logger[_0x625d('0x11')]('['+[_0x308b8d[_0x625d('0x12')]()]+']\x20getTicket\x20crm',_0x5b0083);_0x16a1e3(_0x5b0083);})[_0x625d('0x14')](function(_0x4a12a4){logger[_0x625d('0x15')]('['+[_0x308b8d[_0x625d('0x12')]()]+']',_0x4a12a4[_0x625d('0x16')]);_0x23f8a1(_0x4a12a4[_0x625d('0x16')]);});});};}function createRemoteTag(_0x48b55f,_0x220e94,_0x4aa301,_0x45653a){return new Promise(function(_0x342834,_0x4bfc16){var _0x21f1dd={'method':'POST','uri':_0x4aa301+_0x625d('0x44')+'?'+_0x45653a,'body':{'short_description':_0x48b55f,'global':!![],'active':!![],'name':_0x48b55f},'auth':_0x220e94,'json':!![]};return rp(_0x21f1dd)['then'](function(_0x53257e){var _0x399d9b=_0x53257e[_0x625d('0x10')][_0x625d('0x1c')];_0x342834(_0x399d9b);});});}function getRemoteTag(_0x41849d,_0x32bc85,_0x10c0c3,_0x6b0c14,_0x3db852){return new Promise(function(_0x588d12,_0x42b2ac){var _0x4ef163={'method':_0x625d('0xb'),'uri':_0x10c0c3+_0x625d('0x44')+_0x625d('0x45')+_0x41849d+'&'+_0x6b0c14,'auth':_0x32bc85,'json':!![]};return rp(_0x4ef163)[_0x625d('0xd')](function(_0x4ba35c){if(_0x4ba35c['result'][_0x625d('0xe')]>0x0){var _0x1d08f4=_0x4ba35c[_0x625d('0x10')][0x0][_0x625d('0x1c')];_0x588d12(_0x1d08f4);}else{return createRemoteTag(_0x41849d,_0x32bc85,_0x10c0c3,_0x6b0c14)['then'](function(_0x2c51fb){_0x588d12(_0x2c51fb);});}});});}function assignTagToIncident(_0x476b6a,_0x5c97fa,_0x52b052,_0x166ec7,_0x3cef54){return new Promise(function(_0x46b07d,_0x4864da){var _0x2d196d={'method':'POST','uri':_0x52b052+_0x625d('0x46')+'?'+_0x3cef54,'body':{'label':_0x476b6a,'table':_0x625d('0x3b'),'id_type':_0x625d('0x47'),'table_key':_0x166ec7['ticketId'],'title':_0x625d('0x48')+_0x166ec7[_0x625d('0x42')],'id_display':_0x166ec7[_0x625d('0x42')]},'auth':_0x5c97fa,'json':!![]};return rp(_0x2d196d)[_0x625d('0xd')](function(_0x4be2fb){_0x46b07d();})[_0x625d('0x14')](function(){_0x46b07d();});});}function manageTags(_0x27e466,_0x21c772,_0x51e51a,_0x364e98,_0x4e4361,_0x70e34c,_0x190d3a){return new Promise(function(_0x1d9988,_0x3460bd){var _0x53318e=[];_0x21c772['forEach'](function(_0x3bfd20){_0x53318e[_0x625d('0x49')](getRemoteTag(_0x3bfd20,_0x51e51a,_0x364e98,_0x70e34c,_0x190d3a));});return Promise[_0x625d('0x4a')](_0x53318e)['then'](function(_0x12b9ae){if(_0x12b9ae['length']){logger[_0x625d('0x11')]('['+[_0x27e466['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x12b9ae);var _0x5cfa43=[];_0x12b9ae[_0x625d('0x29')](function(_0x2666d4){_0x5cfa43[_0x625d('0x49')](assignTagToIncident(_0x2666d4,_0x51e51a,_0x364e98,_0x4e4361,_0x70e34c));});return Promise[_0x625d('0x4a')](_0x5cfa43)[_0x625d('0xd')](function(){_0x1d9988();})[_0x625d('0x14')](function(){_0x1d9988();});}else{_0x1d9988();}});});}function getTags(_0x191dee,_0x4fc91e,_0xf0eb13,_0x5df979,_0x43433c,_0x1bcfbb){return function(_0x5c0309){return new Promise(function(_0x25a3f3,_0x2eb983){var _0x3df2c0=[];var _0x3b01e8=_0x5df979['Tags'];if(_0x3b01e8&&_0x3b01e8[_0x625d('0xe')]>0x0){_0x3df2c0=_['map'](_0x3b01e8,_0x625d('0x38'));}if(_0x3df2c0['length']>0x0){return manageTags(_0x191dee,_0x3df2c0,_0x4fc91e,_0xf0eb13,_0x5c0309,_0x43433c,_0x1bcfbb)[_0x625d('0xd')](function(){_0x25a3f3(_0x5c0309);});}else{_0x25a3f3(_0x5c0309);}});};}function emit(_0x3d5d76,_0x13122a,_0x3f37b1){var _0x4bf7c8=_0x625d('0x4b')+_0x625d('0x4c')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x625d('0x4d');var _0x26026d={'uri':_0x3d5d76+_0x625d('0x4e')+_0x3f37b1+_0x4bf7c8};io['to'](util[_0x625d('0x4f')](_0x625d('0x50'),_0x13122a))[_0x625d('0x51')](_0x625d('0x52'),_0x26026d);}exports['cs']=function(_0x7a49d6,_0x501f7f,_0x3cffa8,_0x274400,_0x21eaf6,_0x1e12d6,_0x2c0eec,_0x282350){var _0x2c0d0d={};var _0x2b925a={'user':_0x1e12d6[_0x625d('0x53')],'pass':_0x1e12d6[_0x625d('0x54')]};var _0x422f11='sysparm_limit=1';var _0x462560=_0x625d('0x55');_0x1e12d6[_0x625d('0x56')]=intUtil[_0x625d('0x57')](_0x1e12d6['remoteUri']);_0x1e12d6[_0x625d('0x58')]=intUtil['stripTrailingSlash'](_0x1e12d6[_0x625d('0x58')]);var _0x2d2ddb=util[_0x625d('0x4f')](_0x625d('0x59'),_0x1e12d6[_0x625d('0x56')]);_0x2c0d0d[_0x625d('0x17')]=!_[_0x625d('0x5a')](_0x274400)?_0x274400[_0x625d('0x5b')]:null;_0x2c0d0d['adminEmail']=_0x1e12d6[_0x625d('0x5b')];_0x2c0d0d[_0x625d('0x22')]=_0x282350[_0x625d('0x31')]()===_0x625d('0x3a')?_0x501f7f[_0x625d('0x5c')]:_0x501f7f[_0x625d('0x5d')];_0x2c0d0d[_0x625d('0x5e')]=_0x282350===_0x625d('0x5f')||_0x282350===_0x625d('0x60')?_0x625d('0x5f'):'outbound';var _0x55b703=util['format'](_0x625d('0x61'),_0x1e12d6[_0x625d('0x58')],_0x501f7f['uniqueid'],md5(_0x501f7f[_0x625d('0x62')]));if(_0x21eaf6&&_0x21eaf6['monitor_format']){logger[_0x625d('0x11')](_0x625d('0x63'),_0x625d('0x64'));_0x501f7f[_0x625d('0x65')]=_0x55b703;}else if(_0x2c0eec&&_0x2c0eec[_0x625d('0x66')]&&_0x2c0eec[_0x625d('0x66')]!==_0x625d('0x67')){logger[_0x625d('0x11')](_0x625d('0x68'),_0x625d('0x64'));_0x501f7f[_0x625d('0x65')]=_0x55b703;}else{_0x501f7f[_0x625d('0x65')]='';}return getAdminUser(_0x282350,_0x2b925a,_0x2c0d0d,_0x2d2ddb,_0x462560,_0x422f11)[_0x625d('0xd')](getUser(_0x282350,_0x2b925a,_0x2d2ddb,_0x462560,_0x422f11))[_0x625d('0xd')](getEndUser(_0x282350,_0x2b925a,_0x2d2ddb,_0x462560,_0x422f11))['then'](getTicket(_0x282350,_0x2b925a,_0x2d2ddb,_0x3cffa8,_0x501f7f,_0x462560))[_0x625d('0xd')](function(_0x147c06){logger[_0x625d('0x11')](util[_0x625d('0x4f')](_0x625d('0x69'),_0x147c06[_0x625d('0x41')]));logger[_0x625d('0x11')](util[_0x625d('0x4f')]('call\x20direction:\x20%s',_0x282350));if(_0x282350!=='unmanaged'){logger[_0x625d('0x11')]('['+[_0x282350[_0x625d('0x12')]()]+']',_0x625d('0x6a'));emit(_0x1e12d6['remoteUri'],_0x274400[_0x625d('0x38')],_0x147c06[_0x625d('0x41')]);}})[_0x625d('0x14')](function(_0x420166){logger[_0x625d('0x15')]('['+[_0x282350[_0x625d('0x12')]()]+_0x625d('0x6b'),util[_0x625d('0x6c')](_0x420166,{'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 e117422..36d2e07 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 _0x3750=['calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','uri','recordingFormat','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','trigger:browser:url','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','POST','getString','created_by','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','length','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','Agent\x20found!','resolve','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Enduser\x20created.','debug','merge','forEach','string','customField','nameField','content','type','toString','variable','customVariable','Variable','toLowerCase','custom_fields','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3750,0x1f4));var _0x0375=function(_0x419c0c,_0x2598ad){_0x419c0c=_0x419c0c-0x0;var _0x391694=_0x3750[_0x419c0c];return _0x391694;};'use strict';var _=require(_0x0375('0x0'));var rp=require(_0x0375('0x1'));var BPromise=require(_0x0375('0x2'));var md5=require(_0x0375('0x3'));var util=require(_0x0375('0x4'));var Redis=require('ioredis');var intUtil=require(_0x0375('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0375('0x6'))('sugarcrm');config['redis']=_[_0x0375('0x7')](config['redis'],{'host':_0x0375('0x8'),'port':0x18eb});var io=require(_0x0375('0x9'))(new Redis(config[_0x0375('0xa')]));var def={'method':_0x0375('0xb'),'json':!![]};function emit(_0xd7bf4e,_0x5620cf,_0x1a21b8){io['to'](_0xd7bf4e)['emit'](_0x5620cf,_0x1a21b8);}function getTicket(_0x32e136,_0x51ed50,_0x29a3ea,_0x308a5e,_0x306fa5,_0x95ddc4,_0x56894e,_0x13dbb7){logger['info']('Creating\x20new\x20ticket...');var _0x157956=new Date();var _0x501ebb=[{'name':'name','value':intUtil[_0x0375('0xc')](_0x308a5e['Subjects'],_0x306fa5,'\x20')},{'name':'assigned_user_id','value':_0x51ed50['id']},{'name':_0x0375('0xd'),'value':_0x51ed50['id']},{'name':_0x0375('0xe'),'value':intUtil[_0x0375('0xc')](_0x308a5e['Descriptions'],_0x306fa5,'\x0a')},{'name':_0x0375('0xf'),'value':_0x157956[_0x0375('0x10')]()[_0x0375('0x11')](0x0,0x13)[_0x0375('0x12')]('T','\x20')},{'name':_0x0375('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x0375('0x14'),'value':_0x29a3ea['id']},{'name':_0x0375('0x15'),'value':_0x0375('0x16')},{'name':_0x0375('0x17'),'value':_0x29a3ea[_0x0375('0x18')]},{'name':_0x0375('0x19'),'value':_0x13dbb7}];if(_0x95ddc4[_0x0375('0x1a')]){_['forEach'](_0x95ddc4,function(_0x40d0f3){if(_0x306fa5[_0x40d0f3[_0x0375('0x1b')]]){_0x501ebb[_0x0375('0x1c')]({'name':_0x40d0f3[_0x0375('0x1d')],'value':_0x306fa5[_0x40d0f3[_0x0375('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0x56894e['id'],'module_name':'Calls','name_value_list':_0x501ebb})}});}function getAuth(_0x1b2e41){return util[_0x0375('0x20')](_0x0375('0x21'),new Buffer(_0x1b2e41[_0x0375('0x22')]+':X')['toString'](_0x0375('0x23')));}function getServerInfo(_0x1b9756){return request({'form':{'method':_0x0375('0x24'),'input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0x1b9756['id']})}});}function getUser(_0x359c2f,_0x1b13d8,_0xde1308){if(!_[_0x0375('0x25')](_0x1b13d8)){logger[_0x0375('0x26')](_0x0375('0x27'),_0x1b13d8);return request({'form':{'method':_0x0375('0x28'),'input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0xde1308['id'],'module_name':'Employees','query':util[_0x0375('0x20')](_0x0375('0x29'),_0x1b13d8),'order_by':'','offset':'0','select_fields':['id',_0x0375('0x18'),_0x0375('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0375('0x2b')](function(_0x51a3c5){if(_0x51a3c5[_0x0375('0x2c')][_0x0375('0x1a')]){var _0x27f97c=_['find'](_0x51a3c5[_0x0375('0x2c')],function(_0x25feea){return _0x25feea[_0x0375('0x2d')]['user_name']['value']===_0x1b13d8;});if(_0x27f97c){logger[_0x0375('0x26')](_0x0375('0x2e'));return BPromise[_0x0375('0x2f')]({'id':_0x27f97c['name_value_list']['id'][_0x0375('0x30')],'name':_0x27f97c[_0x0375('0x2d')][_0x0375('0x18')][_0x0375('0x30')]});}}logger[_0x0375('0x26')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0375('0x2f')]({'id':_0xde1308[_0x0375('0x2d')][_0x0375('0x31')]['value'],'name':_0xde1308[_0x0375('0x2d')][_0x0375('0x2a')][_0x0375('0x30')]});});}else{logger['info'](_0x0375('0x32'));return BPromise[_0x0375('0x2f')]({'id':_0xde1308[_0x0375('0x2d')][_0x0375('0x31')][_0x0375('0x30')],'name':_0xde1308[_0x0375('0x2d')]['user_name'][_0x0375('0x30')]});}}function getEndUser(_0x3102e8,_0x546506,_0x425954,_0x15ee11){logger[_0x0375('0x26')](_0x0375('0x33'),_0x425954);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0x15ee11['id'],'module_name':_0x0375('0x16'),'query':util[_0x0375('0x20')](_0x0375('0x34'),_0x425954),'order_by':'','offset':'0','select_fields':['id',_0x0375('0x18'),_0x0375('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3f36e6){if(_0x3f36e6['entry_list']['length']){var _0x392f50=_[_0x0375('0x36')](_0x3f36e6[_0x0375('0x2c')],function(_0x5494db){return _0x5494db[_0x0375('0x2d')][_0x0375('0x35')]['value']===_0x425954;});if(_0x392f50){logger[_0x0375('0x26')](_0x0375('0x37'));return BPromise[_0x0375('0x2f')]({'id':_0x392f50[_0x0375('0x2d')]['id'][_0x0375('0x30')],'name':_0x392f50[_0x0375('0x2d')][_0x0375('0x18')][_0x0375('0x30')],'phone':_0x392f50['name_value_list'][_0x0375('0x35')][_0x0375('0x30')]});}}else{logger[_0x0375('0x26')](_0x0375('0x38'));return request({'form':{'method':_0x0375('0x39'),'input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0x15ee11['id'],'module_name':'Contacts','name_value_list':[{'name':_0x0375('0x3a'),'value':_0x546506!==''?_0x546506:util[_0x0375('0x20')]('Caller\x20-\x20%s',_0x425954)},{'name':_0x0375('0x35'),'value':_0x425954}]})}})[_0x0375('0x2b')](function(_0x26bf54){logger['info'](_0x0375('0x3b'));return BPromise[_0x0375('0x2f')]({'id':_0x26bf54['id'],'name':_0x26bf54[_0x0375('0x2c')]['first_name'][_0x0375('0x30')],'phone':_0x26bf54['entry_list'][_0x0375('0x35')][_0x0375('0x30')]});});}});}function request(_0x1e5dfc){logger[_0x0375('0x3c')]('[HTTP]',JSON[_0x0375('0x1f')](_0x1e5dfc));return rp(_[_0x0375('0x3d')](def,_0x1e5dfc));}function getTags(_0x5861ec,_0x207d9f){var _0x531148=[];if(_0x5861ec&&_0x5861ec['length']>0x0){_0x531148=_['map'](_0x5861ec,_0x207d9f);}return _0x531148;}function getCustomFields(_0x3f22a8,_0x3ade9b){var _0x369ec2=[];var _0x5846fe={'custom_fields':[]};if(_0x3f22a8['length']>0x0){_[_0x0375('0x3e')](_0x3f22a8,function(_0x4beadb){if(_0x4beadb['type']===_0x0375('0x3f')&&_0x4beadb['nameField']&&!_0x4beadb[_0x0375('0x40')]){_0x5846fe[_0x4beadb[_0x0375('0x41')]['toLowerCase']()]=_0x4beadb[_0x0375('0x42')]['toString']();}else if(_0x4beadb[_0x0375('0x43')]===_0x0375('0x3f')&&_0x4beadb['idField']&&_0x4beadb['customField']){_0x5846fe['custom_fields']['push']({'id':_0x4beadb[_0x0375('0x1d')],'value':_0x4beadb[_0x0375('0x42')][_0x0375('0x44')]()});}else if(_0x4beadb[_0x0375('0x43')]===_0x0375('0x45')&&_0x4beadb[_0x0375('0x1b')]&&_0x4beadb[_0x0375('0x1d')]&&_0x4beadb['customField']){_0x3ade9b[_0x4beadb[_0x0375('0x1b')]]&&_0x5846fe['custom_fields'][_0x0375('0x1c')]({'id':_0x4beadb['idField'],'value':_0x3ade9b[_0x4beadb[_0x0375('0x1b')]][_0x0375('0x44')]()});}else if(_0x4beadb[_0x0375('0x43')]===_0x0375('0x46')&&_0x4beadb['Variable']&&_0x4beadb[_0x0375('0x47')][_0x0375('0x18')]&&_0x4beadb[_0x0375('0x1d')]&&_0x4beadb[_0x0375('0x40')]){_0x3ade9b[_0x4beadb[_0x0375('0x47')]['name'][_0x0375('0x48')]()]&&_0x5846fe[_0x0375('0x49')][_0x0375('0x1c')]({'id':_0x4beadb[_0x0375('0x1d')],'value':_0x3ade9b[_0x4beadb[_0x0375('0x47')][_0x0375('0x18')][_0x0375('0x48')]()]['toString']()});}});}return _0x5846fe;}function getConnection(_0x2168eb){return request({'method':_0x0375('0xb'),'form':{'method':_0x0375('0x4a'),'input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'user_auth':{'user_name':_0x2168eb[_0x0375('0x4b')],'password':_0x2168eb[_0x0375('0x4c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x324305){var _0x56da90=_0x324305;if(_0x56da90['id']){def[_0x0375('0x4d')]=_0x56da90['id'];return BPromise[_0x0375('0x2f')](_0x56da90);}else{throw new Error(util['format'](_0x0375('0x4e'),_0x2168eb['id']));}});}function setRelationship(_0x1d064f,_0x1f867e,_0x34806b,_0x3ddc8b){return request({'form':{'method':_0x0375('0x4f'),'input_type':_0x0375('0x1e'),'response_type':'JSON','rest_data':JSON[_0x0375('0x1f')]({'session':_0x1d064f['id'],'module_name':_0x0375('0x50'),'module_id':_0x34806b['id'],'link_field_name':_0x3ddc8b,'related_ids':[_0x1f867e['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x11894f,_0xfca372,_0x579cb1,_0x32b345,_0x6cfab3,_0x4aa764){var _0x4de55d,_0x22b39b,_0x2f0d31,_0x41ce0d;_0x4aa764[_0x0375('0x51')]=intUtil[_0x0375('0x52')](_0x4aa764[_0x0375('0x51')]);_0x4aa764[_0x0375('0x53')]=intUtil[_0x0375('0x52')](_0x4aa764[_0x0375('0x53')]);def['uri']=util[_0x0375('0x20')](_0x0375('0x54'),_0x4aa764['remoteUri']);if(_0x6cfab3&&_0x6cfab3[_0x0375('0x55')]){logger[_0x0375('0x26')]('[QUEUE]',_0x0375('0x56'));_0xfca372[_0x0375('0x57')]=util['format'](_0x0375('0x58'),_0x4aa764[_0x0375('0x53')],_0xfca372[_0x0375('0x59')],md5(_0xfca372[_0x0375('0x59')]));}else{_0xfca372['recordingURL']='';}return getConnection(_0x4aa764)['then'](function(_0x43a8a0){_0x41ce0d=_0x43a8a0;return getUser(_0x4aa764,_0x32b345[_0x0375('0x18')],_0x41ce0d);})['then'](function(_0x5dab6c){_0x4de55d=_0x5dab6c;logger[_0x0375('0x26')]('The\x20User\x20ID\x20is:',_0x4de55d['id']);return getEndUser(_0x4aa764,_0xfca372[_0x0375('0x5a')],_0xfca372['calleridnum'],_0x41ce0d);})[_0x0375('0x2b')](function(_0x2ee88d){_0x22b39b=_0x2ee88d;logger[_0x0375('0x26')](_0x0375('0x5b'),_0x22b39b['id']);return getTicket(_0x4aa764,_0x4de55d,_0x22b39b,_0x579cb1,_0xfca372,_0x579cb1[_0x0375('0x5c')],_0x41ce0d,_0x0375('0x5d'));})[_0x0375('0x2b')](function(_0x129e9c){_0x2f0d31=_0x129e9c;logger[_0x0375('0x26')](_0x0375('0x5e'));logger[_0x0375('0x26')](_0x0375('0x5f'),_0x2f0d31['id']);return setRelationship(_0x41ce0d,_0x4de55d,_0x2f0d31,'users');})['then'](function(){return setRelationship(_0x41ce0d,_0x22b39b,_0x2f0d31,_0x0375('0x60'));})[_0x0375('0x2b')](function(){return getServerInfo(_0x41ce0d);})[_0x0375('0x2b')](function(_0x101b48){var _0x5e65b6=parseInt(_0x101b48[_0x0375('0x61')][_0x0375('0x62')](0x0));var _0x49d36e=util['format'](_0x0375('0x63'),_0x4aa764[_0x0375('0x51')],_0x2f0d31['id']);if(_0x5e65b6>0x6){_0x49d36e=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4aa764[_0x0375('0x51')],_0x2f0d31['id']);}logger[_0x0375('0x26')](_0x0375('0x64'),_0x0375('0x65'));emit(util[_0x0375('0x20')](_0x0375('0x66'),_0x32b345[_0x0375('0x18')]),'trigger:browser:url',{'uri':_0x49d36e});})[_0x0375('0x67')](function(_0x2f37e0){logger[_0x0375('0x68')](_0x0375('0x64'),JSON[_0x0375('0x1f')](_0x2f37e0));});};exports[_0x0375('0x69')]=function(_0x459c6a,_0x2295fd,_0xf3f0bf,_0x968b48,_0x38d1ca,_0x52d605,_0x5913fc){var _0x1cf460,_0x36e5d8,_0x3b6174,_0x32d17a;_0x52d605['remoteUri']=intUtil['stripTrailingSlash'](_0x52d605[_0x0375('0x51')]);_0x52d605[_0x0375('0x53')]=intUtil[_0x0375('0x52')](_0x52d605['serverUrl']);def[_0x0375('0x6a')]=util[_0x0375('0x20')](_0x0375('0x54'),_0x52d605[_0x0375('0x51')]);if(_0x5913fc&&_0x5913fc[_0x0375('0x6b')]&&_0x5913fc[_0x0375('0x6b')]!=='none'){logger['info']('[OUTBOUND]',_0x0375('0x56'));_0x2295fd[_0x0375('0x57')]=util[_0x0375('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52d605['serverUrl'],_0x2295fd['uniqueid'],md5(_0x2295fd[_0x0375('0x59')]));}return getConnection(_0x52d605)[_0x0375('0x2b')](function(_0x23e615){_0x32d17a=_0x23e615;return getUser(_0x52d605,_0x968b48[_0x0375('0x18')],_0x32d17a);})['then'](function(_0x501abc){_0x1cf460=_0x501abc;logger['info'](_0x0375('0x6c'),_0x1cf460['id']);return getEndUser(_0x52d605,_0x2295fd['destcalleridname'],_0x2295fd[_0x0375('0x6d')],_0x32d17a);})[_0x0375('0x2b')](function(_0x3540a6){_0x36e5d8=_0x3540a6;logger[_0x0375('0x26')](_0x0375('0x5b'),_0x36e5d8['id']);return getTicket(_0x52d605,_0x1cf460,_0x36e5d8,_0xf3f0bf,_0x2295fd,_0xf3f0bf['Fields'],_0x32d17a,_0x0375('0x6e'));})[_0x0375('0x2b')](function(_0x15c312){_0x3b6174=_0x15c312;logger[_0x0375('0x26')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3b6174['id']);return setRelationship(_0x32d17a,_0x1cf460,_0x3b6174,_0x0375('0x6f'));})['then'](function(){return setRelationship(_0x32d17a,_0x36e5d8,_0x3b6174,_0x0375('0x60'));})[_0x0375('0x2b')](function(){return getServerInfo(_0x32d17a);})[_0x0375('0x2b')](function(_0x393850){var _0x208fca=parseInt(_0x393850[_0x0375('0x61')]['charAt'](0x0));var _0x36f00a=util['format'](_0x0375('0x63'),_0x52d605[_0x0375('0x51')],_0x3b6174['id']);if(_0x208fca>0x6){_0x36f00a=util[_0x0375('0x20')](_0x0375('0x70'),_0x52d605[_0x0375('0x51')],_0x3b6174['id']);}logger[_0x0375('0x26')](_0x0375('0x71'),_0x0375('0x65'));emit(util[_0x0375('0x20')](_0x0375('0x66'),_0x968b48[_0x0375('0x18')]),_0x0375('0x72'),{'uri':_0x36f00a});})[_0x0375('0x67')](function(_0x317775){logger[_0x0375('0x68')](_0x0375('0x71'),JSON[_0x0375('0x1f')](_0x317775));});};exports['unmanaged']=function(_0x2d974b,_0x29f8f6,_0x4a510b,_0x15cdd6,_0x124ae4,_0x439913){var _0x48e72e,_0x5f4f23,_0x5a4fdf,_0x15cd08;_0x439913[_0x0375('0x51')]=intUtil[_0x0375('0x52')](_0x439913[_0x0375('0x51')]);_0x439913[_0x0375('0x53')]=intUtil[_0x0375('0x52')](_0x439913[_0x0375('0x53')]);def['uri']=util['format'](_0x0375('0x54'),_0x439913['remoteUri']);if(_0x124ae4&&_0x124ae4[_0x0375('0x55')]){logger['info']('['+_0x29f8f6[_0x0375('0x73')][_0x0375('0x74')]()+']',_0x0375('0x56'));_0x29f8f6[_0x0375('0x57')]=util[_0x0375('0x20')](_0x0375('0x58'),_0x439913[_0x0375('0x53')],_0x29f8f6[_0x0375('0x59')],md5(_0x29f8f6[_0x0375('0x59')]));}else{_0x29f8f6[_0x0375('0x57')]='';}return getConnection(_0x439913)['then'](function(_0x18cca6){_0x15cd08=_0x18cca6;if(!_['isNil'](_0x15cdd6)){return getUser(_0x439913,_0x15cdd6['name'],_0x15cd08);}else{return getUser(_0x439913,null,_0x15cd08);}})[_0x0375('0x2b')](function(_0x3b4ae4){_0x48e72e=_0x3b4ae4;logger[_0x0375('0x26')](_0x0375('0x6c'),_0x48e72e['id']);return getEndUser(_0x439913,_0x29f8f6['calleridname'],_0x29f8f6[_0x0375('0x75')],_0x15cd08);})[_0x0375('0x2b')](function(_0x46b647){_0x5f4f23=_0x46b647;logger[_0x0375('0x26')](_0x0375('0x5b'),_0x5f4f23['id']);return getTicket(_0x439913,_0x48e72e,_0x5f4f23,_0x4a510b,_0x29f8f6,_0x4a510b['Fields'],_0x15cd08,_0x0375('0x5d'));})[_0x0375('0x2b')](function(_0x31a933){_0x5a4fdf=_0x31a933;logger[_0x0375('0x26')](_0x0375('0x5e'));logger[_0x0375('0x26')]('The\x20Ticket\x20ID\x20is:',_0x5a4fdf['id']);return setRelationship(_0x15cd08,_0x48e72e,_0x5a4fdf,_0x0375('0x6f'));})[_0x0375('0x2b')](function(){return setRelationship(_0x15cd08,_0x5f4f23,_0x5a4fdf,_0x0375('0x60'));})['then'](function(){return getServerInfo(_0x15cd08);})[_0x0375('0x67')](function(_0x1e2fb9){logger[_0x0375('0x68')]('['+_0x29f8f6[_0x0375('0x73')][_0x0375('0x74')]()+']',JSON[_0x0375('0x1f')](_0x1e2fb9));});}; \ No newline at end of file +var _0xe048=['version','trigger:browser:url','error','unmanaged','monitor_format','lastevent','toUpperCase','isNil','calleridname','Fields','Inbound','users','request-promise','bluebird','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','POST','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','push','idField','variableName','set_entry','JSON','Basic\x20%s','toString','base64','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','format','phone_home','find','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','map','forEach','type','customField','nameField','content','string','custom_fields','variable','customVariable','Variable','toLowerCase','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe048,0x1e4));var _0x8e04=function(_0x19a8fb,_0x3a831e){_0x19a8fb=_0x19a8fb-0x0;var _0x1a053b=_0xe048[_0x19a8fb];return _0x1a053b;};'use strict';var _=require('lodash');var rp=require(_0x8e04('0x0'));var BPromise=require(_0x8e04('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x8e04('0x2'));var config=require(_0x8e04('0x3'));var logger=require(_0x8e04('0x4'))('sugarcrm');config[_0x8e04('0x5')]=_[_0x8e04('0x6')](config['redis'],{'host':_0x8e04('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8e04('0x5')]));var def={'method':_0x8e04('0x8'),'json':!![]};function emit(_0x547cad,_0xbec249,_0x4920e0){io['to'](_0x547cad)['emit'](_0xbec249,_0x4920e0);}function getTicket(_0x198cb1,_0x4344e5,_0x1fb848,_0x260971,_0x1b41bb,_0x346001,_0x5f065f,_0x591930){logger[_0x8e04('0x9')]('Creating\x20new\x20ticket...');var _0x454b38=new Date();var _0x45e083=[{'name':_0x8e04('0xa'),'value':intUtil[_0x8e04('0xb')](_0x260971[_0x8e04('0xc')],_0x1b41bb,'\x20')},{'name':_0x8e04('0xd'),'value':_0x4344e5['id']},{'name':_0x8e04('0xe'),'value':_0x4344e5['id']},{'name':_0x8e04('0xf'),'value':intUtil['getString'](_0x260971[_0x8e04('0x10')],_0x1b41bb,'\x0a')},{'name':_0x8e04('0x11'),'value':_0x454b38[_0x8e04('0x12')]()[_0x8e04('0x13')](0x0,0x13)[_0x8e04('0x14')]('T','\x20')},{'name':_0x8e04('0x15'),'value':'0'},{'name':_0x8e04('0x16'),'value':'15'},{'name':'parent_id','value':_0x1fb848['id']},{'name':_0x8e04('0x17'),'value':_0x8e04('0x18')},{'name':_0x8e04('0x19'),'value':_0x1fb848[_0x8e04('0xa')]},{'name':'direction','value':_0x591930}];if(_0x346001[_0x8e04('0x1a')]){_['forEach'](_0x346001,function(_0x455e8f){if(_0x1b41bb[_0x455e8f['variableName']]){_0x45e083[_0x8e04('0x1b')]({'name':_0x455e8f[_0x8e04('0x1c')],'value':_0x1b41bb[_0x455e8f[_0x8e04('0x1d')]]});}});}return request({'form':{'method':_0x8e04('0x1e'),'input_type':_0x8e04('0x1f'),'response_type':_0x8e04('0x1f'),'rest_data':JSON['stringify']({'session':_0x5f065f['id'],'module_name':'Calls','name_value_list':_0x45e083})}});}function getAuth(_0x130bfe){return util['format'](_0x8e04('0x20'),new Buffer(_0x130bfe['apiKey']+':X')[_0x8e04('0x21')](_0x8e04('0x22')));}function getServerInfo(_0x4c1077){return request({'form':{'method':'get_server_info','input_type':_0x8e04('0x1f'),'response_type':_0x8e04('0x1f'),'rest_data':JSON['stringify']({'session':_0x4c1077['id']})}});}function getUser(_0x2d0771,_0x56e644,_0x252ec6){if(!_['isNil'](_0x56e644)){logger['info'](_0x8e04('0x23'),_0x56e644);return request({'form':{'method':_0x8e04('0x24'),'input_type':_0x8e04('0x1f'),'response_type':_0x8e04('0x1f'),'rest_data':JSON[_0x8e04('0x25')]({'session':_0x252ec6['id'],'module_name':_0x8e04('0x26'),'query':util['format'](_0x8e04('0x27'),_0x56e644),'order_by':'','offset':'0','select_fields':['id',_0x8e04('0xa'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8e04('0x28')](function(_0x31f570){if(_0x31f570['entry_list'][_0x8e04('0x1a')]){var _0x3238b0=_['find'](_0x31f570[_0x8e04('0x29')],function(_0x11e2e5){return _0x11e2e5[_0x8e04('0x2a')][_0x8e04('0x2b')][_0x8e04('0x2c')]===_0x56e644;});if(_0x3238b0){logger[_0x8e04('0x9')](_0x8e04('0x2d'));return BPromise[_0x8e04('0x2e')]({'id':_0x3238b0[_0x8e04('0x2a')]['id'][_0x8e04('0x2c')],'name':_0x3238b0[_0x8e04('0x2a')][_0x8e04('0xa')]['value']});}}logger[_0x8e04('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x252ec6[_0x8e04('0x2a')]['user_id'][_0x8e04('0x2c')],'name':_0x252ec6['name_value_list']['user_name'][_0x8e04('0x2c')]});});}else{logger[_0x8e04('0x9')](_0x8e04('0x2f'));return BPromise[_0x8e04('0x2e')]({'id':_0x252ec6['name_value_list'][_0x8e04('0x30')][_0x8e04('0x2c')],'name':_0x252ec6[_0x8e04('0x2a')][_0x8e04('0x2b')][_0x8e04('0x2c')]});}}function getEndUser(_0x311f0f,_0x2a1fa9,_0x3eeac7,_0x469a02){logger['info'](_0x8e04('0x31'),_0x3eeac7);return request({'form':{'method':_0x8e04('0x24'),'input_type':_0x8e04('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x469a02['id'],'module_name':_0x8e04('0x18'),'query':util[_0x8e04('0x32')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3eeac7),'order_by':'','offset':'0','select_fields':['id','name',_0x8e04('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4e82b8){if(_0x4e82b8[_0x8e04('0x29')][_0x8e04('0x1a')]){var _0x5b69a1=_[_0x8e04('0x34')](_0x4e82b8[_0x8e04('0x29')],function(_0x3000b5){return _0x3000b5[_0x8e04('0x2a')]['phone_home'][_0x8e04('0x2c')]===_0x3eeac7;});if(_0x5b69a1){logger[_0x8e04('0x9')](_0x8e04('0x35'));return BPromise[_0x8e04('0x2e')]({'id':_0x5b69a1[_0x8e04('0x2a')]['id'][_0x8e04('0x2c')],'name':_0x5b69a1['name_value_list'][_0x8e04('0xa')]['value'],'phone':_0x5b69a1[_0x8e04('0x2a')][_0x8e04('0x33')]['value']});}}else{logger[_0x8e04('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x8e04('0x1e'),'input_type':_0x8e04('0x1f'),'response_type':_0x8e04('0x1f'),'rest_data':JSON[_0x8e04('0x25')]({'session':_0x469a02['id'],'module_name':_0x8e04('0x18'),'name_value_list':[{'name':_0x8e04('0x36'),'value':_0x2a1fa9!==_0x8e04('0x37')?_0x2a1fa9:util[_0x8e04('0x32')](_0x8e04('0x38'),_0x3eeac7)},{'name':_0x8e04('0x33'),'value':_0x3eeac7}]})}})[_0x8e04('0x28')](function(_0x3e87fa){logger['info'](_0x8e04('0x39'));return BPromise[_0x8e04('0x2e')]({'id':_0x3e87fa['id'],'name':_0x3e87fa[_0x8e04('0x29')][_0x8e04('0x36')][_0x8e04('0x2c')],'phone':_0x3e87fa[_0x8e04('0x29')]['phone_home'][_0x8e04('0x2c')]});});}});}function request(_0x5921c2){logger['debug'](_0x8e04('0x3a'),JSON[_0x8e04('0x25')](_0x5921c2));return rp(_['merge'](def,_0x5921c2));}function getTags(_0x3c5e08,_0x401ba7){var _0x155f19=[];if(_0x3c5e08&&_0x3c5e08[_0x8e04('0x1a')]>0x0){_0x155f19=_[_0x8e04('0x3b')](_0x3c5e08,_0x401ba7);}return _0x155f19;}function getCustomFields(_0x504446,_0x1ac8c2){var _0x2572ff=[];var _0x1fd28a={'custom_fields':[]};if(_0x504446['length']>0x0){_[_0x8e04('0x3c')](_0x504446,function(_0x2a8b56){if(_0x2a8b56[_0x8e04('0x3d')]==='string'&&_0x2a8b56['nameField']&&!_0x2a8b56[_0x8e04('0x3e')]){_0x1fd28a[_0x2a8b56[_0x8e04('0x3f')]['toLowerCase']()]=_0x2a8b56[_0x8e04('0x40')][_0x8e04('0x21')]();}else if(_0x2a8b56['type']===_0x8e04('0x41')&&_0x2a8b56['idField']&&_0x2a8b56[_0x8e04('0x3e')]){_0x1fd28a[_0x8e04('0x42')][_0x8e04('0x1b')]({'id':_0x2a8b56['idField'],'value':_0x2a8b56[_0x8e04('0x40')]['toString']()});}else if(_0x2a8b56[_0x8e04('0x3d')]===_0x8e04('0x43')&&_0x2a8b56[_0x8e04('0x1d')]&&_0x2a8b56[_0x8e04('0x1c')]&&_0x2a8b56[_0x8e04('0x3e')]){_0x1ac8c2[_0x2a8b56[_0x8e04('0x1d')]]&&_0x1fd28a[_0x8e04('0x42')]['push']({'id':_0x2a8b56[_0x8e04('0x1c')],'value':_0x1ac8c2[_0x2a8b56[_0x8e04('0x1d')]][_0x8e04('0x21')]()});}else if(_0x2a8b56[_0x8e04('0x3d')]===_0x8e04('0x44')&&_0x2a8b56[_0x8e04('0x45')]&&_0x2a8b56[_0x8e04('0x45')][_0x8e04('0xa')]&&_0x2a8b56[_0x8e04('0x1c')]&&_0x2a8b56[_0x8e04('0x3e')]){_0x1ac8c2[_0x2a8b56[_0x8e04('0x45')]['name'][_0x8e04('0x46')]()]&&_0x1fd28a['custom_fields'][_0x8e04('0x1b')]({'id':_0x2a8b56['idField'],'value':_0x1ac8c2[_0x2a8b56[_0x8e04('0x45')][_0x8e04('0xa')][_0x8e04('0x46')]()][_0x8e04('0x21')]()});}});}return _0x1fd28a;}function getConnection(_0x3b0ab7){return request({'method':_0x8e04('0x8'),'form':{'method':'login','input_type':'JSON','response_type':_0x8e04('0x1f'),'rest_data':JSON[_0x8e04('0x25')]({'user_auth':{'user_name':_0x3b0ab7['username'],'password':_0x3b0ab7[_0x8e04('0x47')],'encryption':'PLAIN'},'application':_0x8e04('0x48')})}})[_0x8e04('0x28')](function(_0x9c2a30){var _0x2454a0=_0x9c2a30;if(_0x2454a0['id']){def[_0x8e04('0x49')]=_0x2454a0['id'];return BPromise[_0x8e04('0x2e')](_0x2454a0);}else{throw new Error(util[_0x8e04('0x32')](_0x8e04('0x4a'),_0x3b0ab7['id']));}});}function setRelationship(_0xa2b999,_0x2b9e1a,_0x240d1f,_0x265301){return request({'form':{'method':_0x8e04('0x4b'),'input_type':_0x8e04('0x1f'),'response_type':_0x8e04('0x1f'),'rest_data':JSON['stringify']({'session':_0xa2b999['id'],'module_name':_0x8e04('0x4c'),'module_id':_0x240d1f['id'],'link_field_name':_0x265301,'related_ids':[_0x2b9e1a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8e04('0x4d')]=function(_0x56cba6,_0x481da4,_0x101907,_0x191fcf,_0x53b30e,_0x4e1500){var _0x4f78d2,_0x316d9b,_0x39282f,_0x32a95a;_0x4e1500[_0x8e04('0x4e')]=intUtil[_0x8e04('0x4f')](_0x4e1500['remoteUri']);_0x4e1500[_0x8e04('0x50')]=intUtil['stripTrailingSlash'](_0x4e1500[_0x8e04('0x50')]);def[_0x8e04('0x51')]=util[_0x8e04('0x32')]('%s/service/v4_1/rest.php',_0x4e1500[_0x8e04('0x4e')]);if(_0x53b30e&&_0x53b30e['monitor_format']){logger[_0x8e04('0x9')](_0x8e04('0x52'),'Recording\x20is\x20enabled!');_0x481da4[_0x8e04('0x53')]=util[_0x8e04('0x32')](_0x8e04('0x54'),_0x4e1500[_0x8e04('0x50')],_0x481da4['uniqueid'],md5(_0x481da4[_0x8e04('0x55')]));}else{_0x481da4[_0x8e04('0x53')]='';}return getConnection(_0x4e1500)['then'](function(_0x4d80bc){_0x32a95a=_0x4d80bc;return getUser(_0x4e1500,_0x191fcf[_0x8e04('0xa')],_0x32a95a);})[_0x8e04('0x28')](function(_0xcdddf1){_0x4f78d2=_0xcdddf1;logger[_0x8e04('0x9')](_0x8e04('0x56'),_0x4f78d2['id']);return getEndUser(_0x4e1500,_0x481da4['calleridname'],_0x481da4[_0x8e04('0x57')],_0x32a95a);})['then'](function(_0x118d00){_0x316d9b=_0x118d00;logger[_0x8e04('0x9')](_0x8e04('0x58'),_0x316d9b['id']);return getTicket(_0x4e1500,_0x4f78d2,_0x316d9b,_0x101907,_0x481da4,_0x101907['Fields'],_0x32a95a,'Inbound');})[_0x8e04('0x28')](function(_0x59c7eb){_0x39282f=_0x59c7eb;logger['info'](_0x8e04('0x59'));logger['info'](_0x8e04('0x5a'),_0x39282f['id']);return setRelationship(_0x32a95a,_0x4f78d2,_0x39282f,'users');})[_0x8e04('0x28')](function(){return setRelationship(_0x32a95a,_0x316d9b,_0x39282f,_0x8e04('0x5b'));})['then'](function(){return getServerInfo(_0x32a95a);})[_0x8e04('0x28')](function(_0x4a4f9f){var _0x35b4cb=parseInt(_0x4a4f9f['version'][_0x8e04('0x5c')](0x0));var _0x585ab6=util['format'](_0x8e04('0x5d'),_0x4e1500[_0x8e04('0x4e')],_0x39282f['id']);if(_0x35b4cb>0x6){_0x585ab6=util[_0x8e04('0x32')](_0x8e04('0x5e'),_0x4e1500[_0x8e04('0x4e')],_0x39282f['id']);}logger['info'](_0x8e04('0x52'),_0x8e04('0x5f'));emit(util['format'](_0x8e04('0x60'),_0x191fcf[_0x8e04('0xa')]),'trigger:browser:url',{'uri':_0x585ab6});})[_0x8e04('0x61')](function(_0x2f3e30){logger['error'](_0x8e04('0x52'),JSON[_0x8e04('0x25')](_0x2f3e30));});};exports['outbound']=function(_0x5800e5,_0x2db375,_0x454279,_0x25fe4f,_0x18f6eb,_0x14cc61,_0x4f4c99){var _0x32a89b,_0x338abe,_0x1a8484,_0x257706;_0x14cc61[_0x8e04('0x4e')]=intUtil[_0x8e04('0x4f')](_0x14cc61['remoteUri']);_0x14cc61[_0x8e04('0x50')]=intUtil['stripTrailingSlash'](_0x14cc61[_0x8e04('0x50')]);def[_0x8e04('0x51')]=util[_0x8e04('0x32')](_0x8e04('0x62'),_0x14cc61[_0x8e04('0x4e')]);if(_0x4f4c99&&_0x4f4c99[_0x8e04('0x63')]&&_0x4f4c99[_0x8e04('0x63')]!==_0x8e04('0x64')){logger[_0x8e04('0x9')](_0x8e04('0x65'),_0x8e04('0x66'));_0x2db375[_0x8e04('0x53')]=util[_0x8e04('0x32')](_0x8e04('0x54'),_0x14cc61['serverUrl'],_0x2db375['uniqueid'],md5(_0x2db375[_0x8e04('0x55')]));}return getConnection(_0x14cc61)[_0x8e04('0x28')](function(_0x5b2ad5){_0x257706=_0x5b2ad5;return getUser(_0x14cc61,_0x25fe4f[_0x8e04('0xa')],_0x257706);})[_0x8e04('0x28')](function(_0x5aced1){_0x32a89b=_0x5aced1;logger[_0x8e04('0x9')](_0x8e04('0x56'),_0x32a89b['id']);return getEndUser(_0x14cc61,_0x2db375[_0x8e04('0x67')],_0x2db375[_0x8e04('0x68')],_0x257706);})['then'](function(_0x5a5d6f){_0x338abe=_0x5a5d6f;logger[_0x8e04('0x9')](_0x8e04('0x58'),_0x338abe['id']);return getTicket(_0x14cc61,_0x32a89b,_0x338abe,_0x454279,_0x2db375,_0x454279['Fields'],_0x257706,_0x8e04('0x69'));})['then'](function(_0x27c4fa){_0x1a8484=_0x27c4fa;logger[_0x8e04('0x9')](_0x8e04('0x59'));logger[_0x8e04('0x9')](_0x8e04('0x5a'),_0x1a8484['id']);return setRelationship(_0x257706,_0x32a89b,_0x1a8484,'users');})[_0x8e04('0x28')](function(){return setRelationship(_0x257706,_0x338abe,_0x1a8484,_0x8e04('0x5b'));})[_0x8e04('0x28')](function(){return getServerInfo(_0x257706);})[_0x8e04('0x28')](function(_0x1092df){var _0x4d0f7d=parseInt(_0x1092df[_0x8e04('0x6a')][_0x8e04('0x5c')](0x0));var _0x3c6cc4=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x14cc61[_0x8e04('0x4e')],_0x1a8484['id']);if(_0x4d0f7d>0x6){_0x3c6cc4=util['format'](_0x8e04('0x5e'),_0x14cc61['remoteUri'],_0x1a8484['id']);}logger[_0x8e04('0x9')]('[OUTBOUND]',_0x8e04('0x5f'));emit(util[_0x8e04('0x32')](_0x8e04('0x60'),_0x25fe4f[_0x8e04('0xa')]),_0x8e04('0x6b'),{'uri':_0x3c6cc4});})[_0x8e04('0x61')](function(_0x3440ab){logger[_0x8e04('0x6c')]('[OUTBOUND]',JSON[_0x8e04('0x25')](_0x3440ab));});};exports[_0x8e04('0x6d')]=function(_0x3ef58b,_0x42f715,_0x2fd111,_0x393764,_0x4ac281,_0x30051a){var _0x125dad,_0x3688f1,_0x414f5d,_0x67002d;_0x30051a[_0x8e04('0x4e')]=intUtil[_0x8e04('0x4f')](_0x30051a[_0x8e04('0x4e')]);_0x30051a[_0x8e04('0x50')]=intUtil['stripTrailingSlash'](_0x30051a[_0x8e04('0x50')]);def[_0x8e04('0x51')]=util[_0x8e04('0x32')](_0x8e04('0x62'),_0x30051a[_0x8e04('0x4e')]);if(_0x4ac281&&_0x4ac281[_0x8e04('0x6e')]){logger[_0x8e04('0x9')]('['+_0x42f715[_0x8e04('0x6f')][_0x8e04('0x70')]()+']','Recording\x20is\x20enabled!');_0x42f715[_0x8e04('0x53')]=util[_0x8e04('0x32')](_0x8e04('0x54'),_0x30051a[_0x8e04('0x50')],_0x42f715[_0x8e04('0x55')],md5(_0x42f715[_0x8e04('0x55')]));}else{_0x42f715[_0x8e04('0x53')]='';}return getConnection(_0x30051a)[_0x8e04('0x28')](function(_0x365308){_0x67002d=_0x365308;if(!_[_0x8e04('0x71')](_0x393764)){return getUser(_0x30051a,_0x393764[_0x8e04('0xa')],_0x67002d);}else{return getUser(_0x30051a,null,_0x67002d);}})[_0x8e04('0x28')](function(_0x55b8e7){_0x125dad=_0x55b8e7;logger['info'](_0x8e04('0x56'),_0x125dad['id']);return getEndUser(_0x30051a,_0x42f715[_0x8e04('0x72')],_0x42f715[_0x8e04('0x57')],_0x67002d);})['then'](function(_0x2d25a2){_0x3688f1=_0x2d25a2;logger[_0x8e04('0x9')]('The\x20Enduser\x20ID\x20is:',_0x3688f1['id']);return getTicket(_0x30051a,_0x125dad,_0x3688f1,_0x2fd111,_0x42f715,_0x2fd111[_0x8e04('0x73')],_0x67002d,_0x8e04('0x74'));})['then'](function(_0x53267d){_0x414f5d=_0x53267d;logger[_0x8e04('0x9')](_0x8e04('0x59'));logger[_0x8e04('0x9')]('The\x20Ticket\x20ID\x20is:',_0x414f5d['id']);return setRelationship(_0x67002d,_0x125dad,_0x414f5d,_0x8e04('0x75'));})[_0x8e04('0x28')](function(){return setRelationship(_0x67002d,_0x3688f1,_0x414f5d,_0x8e04('0x5b'));})[_0x8e04('0x28')](function(){return getServerInfo(_0x67002d);})[_0x8e04('0x61')](function(_0x3722ec){logger[_0x8e04('0x6c')]('['+_0x42f715[_0x8e04('0x6f')][_0x8e04('0x70')]()+']',JSON[_0x8e04('0x25')](_0x3722ec));});}; \ 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 bcfcdd0..01de0de 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 _0x1eff=['substring','validateEmail','test','getString','sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','customVariable','join','slice'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x1eff,0x1a1));var _0xf1ef=function(_0x488238,_0x50c7c1){_0x488238=_0x488238-0x0;var _0x5ae48e=_0x1eff[_0x488238];return _0x5ae48e;};'use strict';var _=require('lodash');var util=require('util');exports[_0xf1ef('0x0')]=function(_0x508105,_0x5e7895,_0x224132){var _0x4a1cc4=[];if(_0x508105['length']>0x0){var _0x3ca9a3=_[_0xf1ef('0x1')](_0x508105,['id']);for(var _0x43f3e0=0x0;_0x43f3e0<_0x3ca9a3['length'];_0x43f3e0++){var _0x572a8b=_0x3ca9a3[_0x43f3e0];if(_0x572a8b[_0xf1ef('0x2')]===_0xf1ef('0x3')){_0x4a1cc4[_0xf1ef('0x4')](_0x572a8b[_0xf1ef('0x5')]);}else if(_0x572a8b[_0xf1ef('0x2')]===_0xf1ef('0x6')&&_0x572a8b[_0xf1ef('0x7')]){_0x5e7895[_0x572a8b['variableName']]&&_0x4a1cc4[_0xf1ef('0x4')](_0x5e7895[_0x572a8b[_0xf1ef('0x7')]][_0xf1ef('0x8')]());}else if(_0x572a8b[_0xf1ef('0x2')]==='customVariable'&&_0x572a8b[_0xf1ef('0x9')]&&_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')]){_0x5e7895[_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')][_0xf1ef('0xb')]()]&&_0x4a1cc4['push'](_0x5e7895[_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')][_0xf1ef('0xb')]()][_0xf1ef('0x8')]());}else if(_0x572a8b['type']===_0xf1ef('0xc')){if(_0x572a8b[_0xf1ef('0xd')]===_0xf1ef('0x3')&&_0x572a8b[_0xf1ef('0xe')]){_0x4a1cc4[_0xf1ef('0x4')](util['format'](_0xf1ef('0xf'),_0x572a8b[_0xf1ef('0xe')],_0x572a8b[_0xf1ef('0x10')]));}else if(_0x572a8b[_0xf1ef('0xd')]===_0xf1ef('0x6')&&_0x572a8b[_0xf1ef('0x7')]&&_0x572a8b[_0xf1ef('0xe')]){_0x5e7895[_0x572a8b[_0xf1ef('0x7')]]&&_0x4a1cc4[_0xf1ef('0x4')](util['format'](_0xf1ef('0xf'),_0x572a8b[_0xf1ef('0xe')],_0x5e7895[_0x572a8b[_0xf1ef('0x7')]]));}else if(_0x572a8b[_0xf1ef('0xd')]===_0xf1ef('0x11')&&_0x572a8b[_0xf1ef('0x9')]&&_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')]&&_0x572a8b[_0xf1ef('0xe')]){_0x5e7895[_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')][_0xf1ef('0xb')]()]&&_0x4a1cc4[_0xf1ef('0x4')](util['format'](_0xf1ef('0xf'),_0x572a8b[_0xf1ef('0xe')],_0x5e7895[_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')][_0xf1ef('0xb')]()]));}}}}return _0x4a1cc4[_0xf1ef('0x12')](_0x224132);};exports['stripTrailingSlash']=function(_0x37a20b){var _0x34fc7b=_0x37a20b[_0xf1ef('0x13')](-0x1);if(_0x34fc7b==='/'){_0x37a20b=_0x37a20b[_0xf1ef('0x14')](0x0,_0x37a20b['lastIndexOf'](_0x34fc7b));}return _0x37a20b;};exports[_0xf1ef('0x15')]=function(_0x25f8a6){if(!_['isNil'](_0x25f8a6)&&_0x25f8a6!==''){var _0x31be01=/^(([^<>()\[\]\\.,;:\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 _0x31be01[_0xf1ef('0x16')](String(_0x25f8a6)[_0xf1ef('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x43a7=['variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','customVariable','join','substring','isNil','test','lodash','util','getString','length','sortBy','type','push','content'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x43a7,0x1cc));var _0x743a=function(_0x4604ad,_0x2c516e){_0x4604ad=_0x4604ad-0x0;var _0x3ed8ef=_0x43a7[_0x4604ad];return _0x3ed8ef;};'use strict';var _=require(_0x743a('0x0'));var util=require(_0x743a('0x1'));exports[_0x743a('0x2')]=function(_0x146951,_0x18d3fe,_0x4f340d){var _0x2295a6=[];if(_0x146951[_0x743a('0x3')]>0x0){var _0x2a80d6=_[_0x743a('0x4')](_0x146951,['id']);for(var _0x491ad1=0x0;_0x491ad1<_0x2a80d6[_0x743a('0x3')];_0x491ad1++){var _0x353683=_0x2a80d6[_0x491ad1];if(_0x353683[_0x743a('0x5')]==='string'){_0x2295a6[_0x743a('0x6')](_0x353683[_0x743a('0x7')]);}else if(_0x353683[_0x743a('0x5')]===_0x743a('0x8')&&_0x353683['variableName']){_0x18d3fe[_0x353683['variableName']]&&_0x2295a6[_0x743a('0x6')](_0x18d3fe[_0x353683[_0x743a('0x9')]][_0x743a('0xa')]());}else if(_0x353683['type']==='customVariable'&&_0x353683[_0x743a('0xb')]&&_0x353683[_0x743a('0xb')][_0x743a('0xc')]){_0x18d3fe[_0x353683[_0x743a('0xb')][_0x743a('0xc')][_0x743a('0xd')]()]&&_0x2295a6['push'](_0x18d3fe[_0x353683[_0x743a('0xb')]['name'][_0x743a('0xd')]()][_0x743a('0xa')]());}else if(_0x353683[_0x743a('0x5')]===_0x743a('0xe')){if(_0x353683[_0x743a('0xf')]===_0x743a('0x10')&&_0x353683[_0x743a('0x11')]){_0x2295a6[_0x743a('0x6')](util[_0x743a('0x12')](_0x743a('0x13'),_0x353683[_0x743a('0x11')],_0x353683[_0x743a('0x14')]));}else if(_0x353683[_0x743a('0xf')]==='variable'&&_0x353683[_0x743a('0x9')]&&_0x353683[_0x743a('0x11')]){_0x18d3fe[_0x353683[_0x743a('0x9')]]&&_0x2295a6['push'](util[_0x743a('0x12')]('%s:\x20%s',_0x353683[_0x743a('0x11')],_0x18d3fe[_0x353683[_0x743a('0x9')]]));}else if(_0x353683[_0x743a('0xf')]===_0x743a('0x15')&&_0x353683[_0x743a('0xb')]&&_0x353683['Variable']['name']&&_0x353683[_0x743a('0x11')]){_0x18d3fe[_0x353683['Variable'][_0x743a('0xc')][_0x743a('0xd')]()]&&_0x2295a6[_0x743a('0x6')](util[_0x743a('0x12')](_0x743a('0x13'),_0x353683[_0x743a('0x11')],_0x18d3fe[_0x353683[_0x743a('0xb')][_0x743a('0xc')][_0x743a('0xd')]()]));}}}}return _0x2295a6[_0x743a('0x16')](_0x4f340d);};exports['stripTrailingSlash']=function(_0x1374d8){var _0x2aa033=_0x1374d8['slice'](-0x1);if(_0x2aa033==='/'){_0x1374d8=_0x1374d8[_0x743a('0x17')](0x0,_0x1374d8['lastIndexOf'](_0x2aa033));}return _0x1374d8;};exports['validateEmail']=function(_0x468762){if(!_[_0x743a('0x18')](_0x468762)&&_0x468762!==''){var _0x306761=/^(([^<>()\[\]\\.,;:\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 _0x306761[_0x743a('0x19')](String(_0x468762)[_0x743a('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index f78450b..a8eb645 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x1076b3,_0x619f9c){var _0x5bb848=function(_0x1e3572){while(--_0x1e3572){_0x1076b3['push'](_0x1076b3['shift']());}};_0x5bb848(++_0x619f9c);}(_0x34e8,0x12c));var _0x834e=function(_0x29aef6,_0x460596){_0x29aef6=_0x29aef6-0x0;var _0x2bc5ea=_0x34e8[_0x29aef6];return _0x2bc5ea;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x45b8e5,_0x4bd654){var _0x398fbc=function(_0x285d43){while(--_0x285d43){_0x45b8e5['push'](_0x45b8e5['shift']());}};_0x398fbc(++_0x4bd654);}(_0x34e8,0x12c));var _0x834e=function(_0x50f5a6,_0x599ba2){_0x50f5a6=_0x50f5a6-0x0;var _0x4c53ae=_0x34e8[_0x50f5a6];return _0x4c53ae;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ 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 c872f5b..3c089e4 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 _0x6ec8=['destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','custom_fields','push','variable','variableName','customField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','recordingFormat','none','destcalleridname'];(function(_0x26b30a,_0xfb3217){var _0x269187=function(_0x468148){while(--_0x468148){_0x26b30a['push'](_0x26b30a['shift']());}};_0x269187(++_0xfb3217);}(_0x6ec8,0x85));var _0x86ec=function(_0x1c5f32,_0x1ac260){_0x1c5f32=_0x1c5f32-0x0;var _0x3bd1e8=_0x6ec8[_0x1c5f32];return _0x3bd1e8;};'use strict';var _=require(_0x86ec('0x0'));var rp=require('request-promise');var md5=require(_0x86ec('0x1'));var util=require('util');var Redis=require(_0x86ec('0x2'));var intUtil=require(_0x86ec('0x3'));var config=require(_0x86ec('0x4'));var logger=require(_0x86ec('0x5'))(_0x86ec('0x6'));config[_0x86ec('0x7')]=_[_0x86ec('0x8')](config[_0x86ec('0x7')],{'host':_0x86ec('0x9'),'port':0x18eb});var io=require(_0x86ec('0xa'))(new Redis(config['redis']));function emit(_0x4423b8,_0x35e04b,_0x1ee23b){io['to'](_0x4423b8)[_0x86ec('0xb')](_0x35e04b,_0x1ee23b);}var headers={'Content-Type':'application/json','Accept':_0x86ec('0xc')};function getTicket(_0x43571,_0x2ef210,_0x477389,_0x636675,_0x531496){logger['info'](_0x86ec('0xd'));return request({'uri':util[_0x86ec('0xe')](_0x86ec('0xf'),_0x43571[_0x86ec('0x10')]),'method':'POST','body':{'ticket':_[_0x86ec('0x11')]({'requester_id':_0x477389['id'],'submitter_id':_0x2ef210?_0x2ef210['id']:undefined,'assignee_id':_0x2ef210?_0x2ef210['id']:undefined,'tags':getTags(_0x636675[_0x86ec('0x12')],_0x86ec('0x13')),'subject':intUtil[_0x86ec('0x14')](_0x636675[_0x86ec('0x15')],_0x531496,'\x20'),'description':intUtil[_0x86ec('0x14')](_0x636675[_0x86ec('0x16')],_0x531496,'\x0a'),'comment':{'public':![],'body':intUtil[_0x86ec('0x14')](_0x636675[_0x86ec('0x16')],_0x531496,'\x0a')}},getCustomFields(_0x636675[_0x86ec('0x17')],_0x531496))}})[_0x86ec('0x18')](function(_0x59b2f4){logger[_0x86ec('0x19')](_0x86ec('0x1a'));return _0x59b2f4[_0x86ec('0x1b')];});}function getUser(_0x34f70a,_0x10c5d9){if(intUtil[_0x86ec('0x1c')](_0x10c5d9)){logger[_0x86ec('0x19')]('Getting\x20agent\x20with\x20email',_0x10c5d9);return request({'uri':util[_0x86ec('0xe')](_0x86ec('0x1d'),_0x34f70a[_0x86ec('0x10')]),'qs':{'query':util['format'](_0x86ec('0x1e'),_0x10c5d9)}})['then'](function(_0x1b76f5){if(_0x1b76f5['count']){logger[_0x86ec('0x19')](_0x86ec('0x1f'));return _['find'](_0x1b76f5[_0x86ec('0x20')],{'email':_0x10c5d9,'role':_0x86ec('0x21')});}else{logger[_0x86ec('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x86ec('0xe')]('%s/users/me.json',_0x34f70a['remoteUri'])})['then'](function(_0x10294d){logger[_0x86ec('0x19')](_0x86ec('0x22'));return _0x10294d[_0x86ec('0x23')];});}});}else{logger[_0x86ec('0x19')](_0x86ec('0x24'));return request({'uri':util['format'](_0x86ec('0x25'),_0x34f70a[_0x86ec('0x10')])})['then'](function(_0x4e1d33){logger[_0x86ec('0x19')](_0x86ec('0x22'));return _0x4e1d33[_0x86ec('0x23')];});}}function getEndUser(_0x5b23f8,_0x287da8,_0x5e44cd){logger[_0x86ec('0x19')](_0x86ec('0x26'),_0x5e44cd);return request({'uri':util[_0x86ec('0xe')]('%s/search.json',_0x5b23f8[_0x86ec('0x10')]),'qs':{'query':util['format'](_0x86ec('0x27'),_0x5e44cd)}})['then'](function(_0x3783c1){var _0x2316b6;if(_0x3783c1[_0x86ec('0x20')][_0x86ec('0x28')]){_0x3783c1['results']=_['filter'](_0x3783c1[_0x86ec('0x20')],{'suspended':![],'role':_0x86ec('0x29')});if(_0x3783c1[_0x86ec('0x20')][_0x86ec('0x28')]){_0x2316b6=_[_0x86ec('0x2a')](_0x3783c1['results']);}}if(_0x2316b6){logger[_0x86ec('0x19')]('Enduser\x20found!');return _0x2316b6;}else{logger[_0x86ec('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x86ec('0xe')](_0x86ec('0x2b'),_0x5b23f8[_0x86ec('0x10')]),'method':_0x86ec('0x2c'),'body':{'user':{'role':'end-user','name':util[_0x86ec('0xe')](_0x86ec('0x2d'),_0x287da8||_0x5e44cd),'phone':_0x5e44cd}}})[_0x86ec('0x18')](function(_0xee42e2){logger[_0x86ec('0x19')](_0x86ec('0x2e'));return _0xee42e2[_0x86ec('0x23')];});}});}function getAuth(_0x5c5179){var _0xecd28d;if(_0x5c5179[_0x86ec('0x2f')]===_0x86ec('0x30')){_0xecd28d=util[_0x86ec('0xe')](_0x86ec('0x31'),_0x5c5179[_0x86ec('0x32')],_0x5c5179[_0x86ec('0x30')]);}else if(_0x5c5179['authType']===_0x86ec('0x33')){_0xecd28d=util['format'](_0x86ec('0x34'),_0x5c5179[_0x86ec('0x32')],_0x5c5179[_0x86ec('0x33')]);}return util[_0x86ec('0xe')](_0x86ec('0x35'),new Buffer(_0xecd28d)['toString'](_0x86ec('0x36')));}function request(_0xd34af0){logger[_0x86ec('0x37')](_0x86ec('0x38'),JSON[_0x86ec('0x39')](_0xd34af0));return rp(_['defaults'](_0xd34af0,{'method':_0x86ec('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x3bd6e8,_0x1b486d){var _0x4a21e3=[];if(_0x3bd6e8&&_0x3bd6e8[_0x86ec('0x28')]>0x0){_0x4a21e3=_[_0x86ec('0x3b')](_0x3bd6e8,_0x1b486d);}return _0x4a21e3;}function getCustomFields(_0x1b9e5b,_0x577f72){var _0x4c3605=[];var _0x3875ba={'custom_fields':[]};if(_0x1b9e5b[_0x86ec('0x28')]>0x0){_[_0x86ec('0x3c')](_0x1b9e5b,function(_0x25d08b){if(_[_0x86ec('0x3d')]([_0x86ec('0x3e'),_0x86ec('0x3f')],_0x25d08b['type'])&&_0x25d08b['nameField']&&!_0x25d08b['customField']){_0x3875ba[_0x25d08b[_0x86ec('0x40')][_0x86ec('0x41')]()]=_0x25d08b[_0x86ec('0x42')][_0x86ec('0x43')]();}else if(_[_0x86ec('0x3d')]([_0x86ec('0x3e'),_0x86ec('0x3f')],_0x25d08b[_0x86ec('0x44')])&&_0x25d08b[_0x86ec('0x45')]&&_0x25d08b['customField']){_0x3875ba[_0x86ec('0x46')][_0x86ec('0x47')]({'id':_0x25d08b[_0x86ec('0x45')],'value':_0x25d08b[_0x86ec('0x42')][_0x86ec('0x43')]()});}else if(_0x25d08b[_0x86ec('0x44')]===_0x86ec('0x48')&&_0x25d08b[_0x86ec('0x49')]&&_0x25d08b[_0x86ec('0x45')]&&_0x25d08b[_0x86ec('0x4a')]){_0x577f72[_0x25d08b['variableName']]&&_0x3875ba[_0x86ec('0x46')][_0x86ec('0x47')]({'id':_0x25d08b[_0x86ec('0x45')],'value':_0x577f72[_0x25d08b['variableName']]['toString']()});}else if(_0x25d08b[_0x86ec('0x44')]===_0x86ec('0x4b')&&_0x25d08b['Variable']&&_0x25d08b[_0x86ec('0x4c')]['name']&&_0x25d08b[_0x86ec('0x45')]&&_0x25d08b['customField']){_0x577f72[_0x25d08b['Variable']['name']['toLowerCase']()]&&_0x3875ba[_0x86ec('0x46')][_0x86ec('0x47')]({'id':_0x25d08b[_0x86ec('0x45')],'value':_0x577f72[_0x25d08b['Variable'][_0x86ec('0x13')][_0x86ec('0x41')]()][_0x86ec('0x43')]()});}});}return _0x3875ba;}exports[_0x86ec('0x4d')]=function(_0x1e83f4,_0x52af77,_0x512eca,_0x3231d8,_0x5d8dae,_0x50a972){var _0x24c7ce,_0x10cd1f;_0x50a972['remoteUri']=intUtil[_0x86ec('0x4e')](_0x50a972[_0x86ec('0x10')]);_0x50a972[_0x86ec('0x4f')]=intUtil[_0x86ec('0x4e')](_0x50a972['serverUrl']);if(_0x5d8dae&&_0x5d8dae['monitor_format']){logger[_0x86ec('0x19')]('[QUEUE]','Recording\x20is\x20enabled!');_0x52af77[_0x86ec('0x50')]=util[_0x86ec('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50a972[_0x86ec('0x4f')],_0x52af77['uniqueid'],md5(_0x52af77[_0x86ec('0x51')]));}else{_0x52af77['recordingURL']='';}headers[_0x86ec('0x52')]=getAuth(_0x50a972);return getUser(_0x50a972,_0x3231d8[_0x86ec('0x53')])[_0x86ec('0x18')](function(_0x40e56f){_0x24c7ce=_0x40e56f;logger[_0x86ec('0x19')](_0x86ec('0x54'),_0x24c7ce['id']);return getEndUser(_0x50a972,_0x52af77['calleridname'],_0x52af77[_0x86ec('0x55')]);})[_0x86ec('0x18')](function(_0x37adab){_0x10cd1f=_0x37adab;logger[_0x86ec('0x19')]('The\x20Enduser\x20ID\x20is:',_0x10cd1f['id']);return getTicket(_0x50a972,_0x24c7ce,_0x10cd1f,_0x512eca,_0x52af77);})[_0x86ec('0x18')](function(_0xd2df3f){if(_0xd2df3f){logger[_0x86ec('0x19')]('The\x20Ticket\x20ID\x20is:',_0xd2df3f['id']);switch(_0x50a972['type']){case _0x86ec('0x56'):logger[_0x86ec('0x19')](_0x86ec('0x57'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x86ec('0xe')](_0x86ec('0x58'),_0x50a972['remoteUri'],_0x24c7ce['id'],_0xd2df3f['id']),'method':_0x86ec('0x2c')});case _0x86ec('0x59'):logger[_0x86ec('0x19')](_0x86ec('0x57'),_0x86ec('0x5a'));emit(util[_0x86ec('0xe')](_0x86ec('0x5b'),_0x3231d8[_0x86ec('0x13')]),_0x86ec('0x5c'),{'uri':util[_0x86ec('0xe')](_0x86ec('0x5d'),_0x50a972[_0x86ec('0x10')][_0x86ec('0x5e')](_0x86ec('0x5f'),''),_0xd2df3f['id'])});break;default:logger[_0x86ec('0x60')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x86ec('0x61')](function(_0x2ccc6a){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2ccc6a,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4fe23c,_0x3d8549,_0xc9439,_0x5bc447,_0x173315,_0x149dc4,_0x2f207d){var _0x5408b9,_0x195154;_0x149dc4[_0x86ec('0x10')]=intUtil[_0x86ec('0x4e')](_0x149dc4[_0x86ec('0x10')]);_0x149dc4[_0x86ec('0x4f')]=intUtil[_0x86ec('0x4e')](_0x149dc4[_0x86ec('0x4f')]);if(_0x2f207d&&_0x2f207d[_0x86ec('0x62')]&&_0x2f207d['recordingFormat']!==_0x86ec('0x63')){logger[_0x86ec('0x19')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3d8549['recordingURL']=util[_0x86ec('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x149dc4[_0x86ec('0x4f')],_0x3d8549['uniqueid'],md5(_0x3d8549[_0x86ec('0x51')]));}headers[_0x86ec('0x52')]=getAuth(_0x149dc4);return getUser(_0x149dc4,_0x5bc447[_0x86ec('0x53')])[_0x86ec('0x18')](function(_0x4223a5){_0x5408b9=_0x4223a5;logger[_0x86ec('0x19')](_0x86ec('0x54'),_0x5408b9['id']);return getEndUser(_0x149dc4,_0x3d8549[_0x86ec('0x64')],_0x3d8549[_0x86ec('0x65')]);})[_0x86ec('0x18')](function(_0x30484a){_0x195154=_0x30484a;logger['info'](_0x86ec('0x66'),_0x195154['id']);return getTicket(_0x149dc4,_0x5408b9,_0x195154,_0xc9439,_0x3d8549);})[_0x86ec('0x18')](function(_0x173c65){if(_0x173c65){logger['info'](_0x86ec('0x67'),_0x173c65['id']);switch(_0x149dc4[_0x86ec('0x44')]){case _0x86ec('0x56'):logger[_0x86ec('0x19')](_0x86ec('0x68'),_0x86ec('0x69'));return request({'uri':util[_0x86ec('0xe')](_0x86ec('0x58'),_0x149dc4[_0x86ec('0x10')],_0x5408b9['id'],_0x173c65['id']),'method':'POST'});case _0x86ec('0x59'):logger[_0x86ec('0x19')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x86ec('0xe')](_0x86ec('0x5b'),_0x5bc447[_0x86ec('0x13')]),_0x86ec('0x5c'),{'uri':util[_0x86ec('0xe')]('%s/agent/tickets/%s',_0x149dc4[_0x86ec('0x10')]['replace'](_0x86ec('0x5f'),''),_0x173c65['id'])});break;default:logger[_0x86ec('0x60')](_0x86ec('0x68'),_0x86ec('0x6a'));}}})[_0x86ec('0x61')](function(_0x2b1776){logger[_0x86ec('0x60')](_0x86ec('0x6b'),util[_0x86ec('0x6c')](_0x2b1776,{'showHidden':!![],'depth':null}));});};exports[_0x86ec('0x6d')]=function(_0x3b3169,_0x5b0f9b,_0x3ce02a,_0x2417c6,_0x99fb2b,_0x2ea2a9){var _0x5f5dc7,_0x16dd83;_0x2ea2a9[_0x86ec('0x10')]=intUtil['stripTrailingSlash'](_0x2ea2a9[_0x86ec('0x10')]);_0x2ea2a9[_0x86ec('0x4f')]=intUtil['stripTrailingSlash'](_0x2ea2a9[_0x86ec('0x4f')]);if(_0x99fb2b&&_0x99fb2b[_0x86ec('0x6e')]){logger['info']('['+_0x5b0f9b[_0x86ec('0x6f')][_0x86ec('0x70')]()+']',_0x86ec('0x71'));_0x5b0f9b[_0x86ec('0x50')]=util[_0x86ec('0xe')](_0x86ec('0x72'),_0x2ea2a9[_0x86ec('0x4f')],_0x5b0f9b[_0x86ec('0x51')],md5(_0x5b0f9b[_0x86ec('0x51')]));}else{_0x5b0f9b[_0x86ec('0x50')]='';}headers[_0x86ec('0x52')]=getAuth(_0x2ea2a9);return getUser(_0x2ea2a9)[_0x86ec('0x18')](function(_0x1a6053){_0x5f5dc7=_0x1a6053;logger[_0x86ec('0x19')](_0x86ec('0x54'),_0x5f5dc7['id']);return getEndUser(_0x2ea2a9,_0x5b0f9b[_0x86ec('0x73')],_0x5b0f9b[_0x86ec('0x55')]);})['then'](function(_0xbeec98){_0x16dd83=_0xbeec98;logger[_0x86ec('0x19')](_0x86ec('0x66'),_0x16dd83['id']);return getTicket(_0x2ea2a9,_0x5f5dc7,_0x16dd83,_0x3ce02a,_0x5b0f9b);})[_0x86ec('0x18')](function(_0x236d59){if(_0x236d59){logger[_0x86ec('0x19')](_0x86ec('0x67'),_0x236d59['id']);}})['catch'](function(_0x3ef74d){logger['error']('['+_0x5b0f9b[_0x86ec('0x6f')]['toUpperCase']()+']'+_0x86ec('0x74'),util[_0x86ec('0x6c')](_0x3ef74d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x214f=['idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','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','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','destcalleridname','destcalleridnum','user:%s','/api/v2','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','validateEmail','%s/search.json','count','find','results','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','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','username','Basic\x20%s','toString','base64','debug','stringify','GET','forEach','includes','string','picklist','type','nameField','toLowerCase','content'];(function(_0x42dd6c,_0x4ea28c){var _0x3346a2=function(_0x17877b){while(--_0x17877b){_0x42dd6c['push'](_0x42dd6c['shift']());}};_0x3346a2(++_0x4ea28c);}(_0x214f,0x181));var _0xf214=function(_0x2bc919,_0x1a22c0){_0x2bc919=_0x2bc919-0x0;var _0x274fbf=_0x214f[_0x2bc919];return _0x274fbf;};'use strict';var _=require(_0xf214('0x0'));var rp=require(_0xf214('0x1'));var md5=require(_0xf214('0x2'));var util=require(_0xf214('0x3'));var Redis=require(_0xf214('0x4'));var intUtil=require(_0xf214('0x5'));var config=require(_0xf214('0x6'));var logger=require(_0xf214('0x7'))(_0xf214('0x8'));config[_0xf214('0x9')]=_[_0xf214('0xa')](config[_0xf214('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf214('0xb'))(new Redis(config[_0xf214('0x9')]));function emit(_0x211054,_0x734e2a,_0x3f8657){io['to'](_0x211054)[_0xf214('0xc')](_0x734e2a,_0x3f8657);}var headers={'Content-Type':_0xf214('0xd'),'Accept':'application/json'};function getTicket(_0x47156b,_0x4c6e35,_0xe4a442,_0x4612fb,_0x3c4756){logger[_0xf214('0xe')](_0xf214('0xf'));return request({'uri':util[_0xf214('0x10')](_0xf214('0x11'),_0x47156b[_0xf214('0x12')]),'method':_0xf214('0x13'),'body':{'ticket':_[_0xf214('0x14')]({'requester_id':_0xe4a442['id'],'submitter_id':_0x4c6e35?_0x4c6e35['id']:undefined,'assignee_id':_0x4c6e35?_0x4c6e35['id']:undefined,'tags':getTags(_0x4612fb[_0xf214('0x15')],_0xf214('0x16')),'subject':intUtil['getString'](_0x4612fb['Subjects'],_0x3c4756,'\x20'),'description':intUtil[_0xf214('0x17')](_0x4612fb[_0xf214('0x18')],_0x3c4756,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf214('0x17')](_0x4612fb['Descriptions'],_0x3c4756,'\x0a')}},getCustomFields(_0x4612fb[_0xf214('0x19')],_0x3c4756))}})[_0xf214('0x1a')](function(_0x42fc64){logger[_0xf214('0xe')](_0xf214('0x1b'));return _0x42fc64['ticket'];});}function getUser(_0x23ba17,_0x514a89){if(intUtil[_0xf214('0x1c')](_0x514a89)){logger['info']('Getting\x20agent\x20with\x20email',_0x514a89);return request({'uri':util[_0xf214('0x10')](_0xf214('0x1d'),_0x23ba17[_0xf214('0x12')]),'qs':{'query':util[_0xf214('0x10')]('type:user\x20role:agent\x20email:%s',_0x514a89)}})[_0xf214('0x1a')](function(_0x30df34){if(_0x30df34[_0xf214('0x1e')]){logger['info']('Agent\x20found!');return _[_0xf214('0x1f')](_0x30df34[_0xf214('0x20')],{'email':_0x514a89,'role':_0xf214('0x21')});}else{logger[_0xf214('0xe')](_0xf214('0x22'));return request({'uri':util['format'](_0xf214('0x23'),_0x23ba17[_0xf214('0x12')])})[_0xf214('0x1a')](function(_0xfc92b8){logger[_0xf214('0xe')](_0xf214('0x24'));return _0xfc92b8[_0xf214('0x25')];});}});}else{logger[_0xf214('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf214('0x10')](_0xf214('0x23'),_0x23ba17[_0xf214('0x12')])})['then'](function(_0x54fe5a){logger[_0xf214('0xe')](_0xf214('0x24'));return _0x54fe5a[_0xf214('0x25')];});}}function getEndUser(_0x51844f,_0x16f425,_0x52df8e){logger[_0xf214('0xe')](_0xf214('0x26'),_0x52df8e);return request({'uri':util[_0xf214('0x10')](_0xf214('0x1d'),_0x51844f[_0xf214('0x12')]),'qs':{'query':util[_0xf214('0x10')](_0xf214('0x27'),_0x52df8e)}})[_0xf214('0x1a')](function(_0x478526){var _0x3d5963;if(_0x478526[_0xf214('0x20')][_0xf214('0x28')]){_0x478526[_0xf214('0x20')]=_[_0xf214('0x29')](_0x478526[_0xf214('0x20')],{'suspended':![],'role':_0xf214('0x2a')});if(_0x478526['results'][_0xf214('0x28')]){_0x3d5963=_[_0xf214('0x2b')](_0x478526['results']);}}if(_0x3d5963){logger[_0xf214('0xe')](_0xf214('0x2c'));return _0x3d5963;}else{logger['info'](_0xf214('0x2d'));return request({'uri':util[_0xf214('0x10')](_0xf214('0x2e'),_0x51844f[_0xf214('0x12')]),'method':_0xf214('0x13'),'body':{'user':{'role':_0xf214('0x2a'),'name':util[_0xf214('0x10')](_0xf214('0x2f'),_0x16f425||_0x52df8e),'phone':_0x52df8e}}})['then'](function(_0x1ca9fb){logger['info'](_0xf214('0x30'));return _0x1ca9fb[_0xf214('0x25')];});}});}function getAuth(_0x523677){var _0x5d5f53;if(_0x523677[_0xf214('0x31')]===_0xf214('0x32')){_0x5d5f53=util['format']('%s:%s',_0x523677['username'],_0x523677[_0xf214('0x32')]);}else if(_0x523677[_0xf214('0x31')]===_0xf214('0x33')){_0x5d5f53=util['format']('%s/token:%s',_0x523677[_0xf214('0x34')],_0x523677[_0xf214('0x33')]);}return util[_0xf214('0x10')](_0xf214('0x35'),new Buffer(_0x5d5f53)[_0xf214('0x36')](_0xf214('0x37')));}function request(_0x5c2f8c){logger[_0xf214('0x38')]('[HTTP]',JSON[_0xf214('0x39')](_0x5c2f8c));return rp(_[_0xf214('0xa')](_0x5c2f8c,{'method':_0xf214('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x461211,_0xe1a1f7){var _0xd07b4f=[];if(_0x461211&&_0x461211['length']>0x0){_0xd07b4f=_['map'](_0x461211,_0xe1a1f7);}return _0xd07b4f;}function getCustomFields(_0x36fda8,_0x21e71e){var _0xf0ba3=[];var _0x267371={'custom_fields':[]};if(_0x36fda8[_0xf214('0x28')]>0x0){_[_0xf214('0x3b')](_0x36fda8,function(_0x4803e7){if(_[_0xf214('0x3c')]([_0xf214('0x3d'),_0xf214('0x3e')],_0x4803e7[_0xf214('0x3f')])&&_0x4803e7[_0xf214('0x40')]&&!_0x4803e7['customField']){_0x267371[_0x4803e7['nameField'][_0xf214('0x41')]()]=_0x4803e7[_0xf214('0x42')][_0xf214('0x36')]();}else if(_[_0xf214('0x3c')](['string',_0xf214('0x3e')],_0x4803e7['type'])&&_0x4803e7[_0xf214('0x43')]&&_0x4803e7[_0xf214('0x44')]){_0x267371[_0xf214('0x45')][_0xf214('0x46')]({'id':_0x4803e7[_0xf214('0x43')],'value':_0x4803e7[_0xf214('0x42')][_0xf214('0x36')]()});}else if(_0x4803e7[_0xf214('0x3f')]===_0xf214('0x47')&&_0x4803e7['variableName']&&_0x4803e7[_0xf214('0x43')]&&_0x4803e7[_0xf214('0x44')]){_0x21e71e[_0x4803e7[_0xf214('0x48')]]&&_0x267371[_0xf214('0x45')]['push']({'id':_0x4803e7[_0xf214('0x43')],'value':_0x21e71e[_0x4803e7[_0xf214('0x48')]]['toString']()});}else if(_0x4803e7[_0xf214('0x3f')]===_0xf214('0x49')&&_0x4803e7[_0xf214('0x4a')]&&_0x4803e7[_0xf214('0x4a')]['name']&&_0x4803e7[_0xf214('0x43')]&&_0x4803e7['customField']){_0x21e71e[_0x4803e7['Variable']['name'][_0xf214('0x41')]()]&&_0x267371[_0xf214('0x45')][_0xf214('0x46')]({'id':_0x4803e7[_0xf214('0x43')],'value':_0x21e71e[_0x4803e7[_0xf214('0x4a')][_0xf214('0x16')][_0xf214('0x41')]()][_0xf214('0x36')]()});}});}return _0x267371;}exports[_0xf214('0x4b')]=function(_0x32e686,_0x5afdcf,_0x4a9c2,_0x54e468,_0x35eb62,_0x58ee26){var _0x28051c,_0x589d4d;_0x58ee26[_0xf214('0x12')]=intUtil[_0xf214('0x4c')](_0x58ee26[_0xf214('0x12')]);_0x58ee26['serverUrl']=intUtil[_0xf214('0x4c')](_0x58ee26[_0xf214('0x4d')]);if(_0x35eb62&&_0x35eb62[_0xf214('0x4e')]){logger[_0xf214('0xe')]('[QUEUE]',_0xf214('0x4f'));_0x5afdcf[_0xf214('0x50')]=util[_0xf214('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58ee26[_0xf214('0x4d')],_0x5afdcf[_0xf214('0x51')],md5(_0x5afdcf[_0xf214('0x51')]));}else{_0x5afdcf['recordingURL']='';}headers['Authorization']=getAuth(_0x58ee26);return getUser(_0x58ee26,_0x54e468['email'])['then'](function(_0x963261){_0x28051c=_0x963261;logger[_0xf214('0xe')](_0xf214('0x52'),_0x28051c['id']);return getEndUser(_0x58ee26,_0x5afdcf['calleridname'],_0x5afdcf[_0xf214('0x53')]);})[_0xf214('0x1a')](function(_0x2ac5ea){_0x589d4d=_0x2ac5ea;logger[_0xf214('0xe')](_0xf214('0x54'),_0x589d4d['id']);return getTicket(_0x58ee26,_0x28051c,_0x589d4d,_0x4a9c2,_0x5afdcf);})[_0xf214('0x1a')](function(_0x31a5ce){if(_0x31a5ce){logger[_0xf214('0xe')](_0xf214('0x55'),_0x31a5ce['id']);switch(_0x58ee26['type']){case'integrationTab':logger[_0xf214('0xe')](_0xf214('0x56'),_0xf214('0x57'));return request({'uri':util[_0xf214('0x10')](_0xf214('0x58'),_0x58ee26['remoteUri'],_0x28051c['id'],_0x31a5ce['id']),'method':_0xf214('0x13')});case _0xf214('0x59'):logger[_0xf214('0xe')]('[QUEUE]',_0xf214('0x5a'));emit(util[_0xf214('0x10')]('user:%s',_0x54e468[_0xf214('0x16')]),_0xf214('0x5b'),{'uri':util[_0xf214('0x10')](_0xf214('0x5c'),_0x58ee26[_0xf214('0x12')][_0xf214('0x5d')]('/api/v2',''),_0x31a5ce['id'])});break;default:logger[_0xf214('0x5e')]('[QUEUE]',_0xf214('0x5f'));}}})[_0xf214('0x60')](function(_0x37b5dc){logger[_0xf214('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xf214('0x61')](_0x37b5dc,{'showHidden':!![],'depth':null}));});};exports[_0xf214('0x62')]=function(_0x556e99,_0x4b153e,_0x13d20f,_0x1059d6,_0x41d38a,_0xb62034,_0x3a7bb5){var _0xe0cfca,_0x35bd0b;_0xb62034[_0xf214('0x12')]=intUtil[_0xf214('0x4c')](_0xb62034[_0xf214('0x12')]);_0xb62034[_0xf214('0x4d')]=intUtil[_0xf214('0x4c')](_0xb62034[_0xf214('0x4d')]);if(_0x3a7bb5&&_0x3a7bb5[_0xf214('0x63')]&&_0x3a7bb5[_0xf214('0x63')]!==_0xf214('0x64')){logger[_0xf214('0xe')](_0xf214('0x65'),'Recording\x20is\x20enabled!');_0x4b153e['recordingURL']=util[_0xf214('0x10')](_0xf214('0x66'),_0xb62034[_0xf214('0x4d')],_0x4b153e[_0xf214('0x51')],md5(_0x4b153e[_0xf214('0x51')]));}headers[_0xf214('0x67')]=getAuth(_0xb62034);return getUser(_0xb62034,_0x1059d6[_0xf214('0x68')])[_0xf214('0x1a')](function(_0x3b6d7b){_0xe0cfca=_0x3b6d7b;logger['info'](_0xf214('0x52'),_0xe0cfca['id']);return getEndUser(_0xb62034,_0x4b153e[_0xf214('0x69')],_0x4b153e[_0xf214('0x6a')]);})[_0xf214('0x1a')](function(_0x37c902){_0x35bd0b=_0x37c902;logger[_0xf214('0xe')](_0xf214('0x54'),_0x35bd0b['id']);return getTicket(_0xb62034,_0xe0cfca,_0x35bd0b,_0x13d20f,_0x4b153e);})[_0xf214('0x1a')](function(_0x224336){if(_0x224336){logger[_0xf214('0xe')](_0xf214('0x55'),_0x224336['id']);switch(_0xb62034[_0xf214('0x3f')]){case'integrationTab':logger[_0xf214('0xe')](_0xf214('0x65'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xf214('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xb62034[_0xf214('0x12')],_0xe0cfca['id'],_0x224336['id']),'method':_0xf214('0x13')});case'newTab':logger[_0xf214('0xe')](_0xf214('0x65'),_0xf214('0x5a'));emit(util[_0xf214('0x10')](_0xf214('0x6b'),_0x1059d6[_0xf214('0x16')]),_0xf214('0x5b'),{'uri':util['format'](_0xf214('0x5c'),_0xb62034[_0xf214('0x12')][_0xf214('0x5d')](_0xf214('0x6c'),''),_0x224336['id'])});break;default:logger[_0xf214('0x5e')](_0xf214('0x65'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x32c632){logger[_0xf214('0x5e')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x32c632,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x42608f,_0x23c585,_0x3f8810,_0x463724,_0x58fe48,_0x251ae1){var _0xaa8520,_0x43502b;_0x251ae1[_0xf214('0x12')]=intUtil[_0xf214('0x4c')](_0x251ae1[_0xf214('0x12')]);_0x251ae1[_0xf214('0x4d')]=intUtil[_0xf214('0x4c')](_0x251ae1[_0xf214('0x4d')]);if(_0x58fe48&&_0x58fe48['monitor_format']){logger['info']('['+_0x23c585[_0xf214('0x6d')][_0xf214('0x6e')]()+']','Recording\x20is\x20enabled!');_0x23c585[_0xf214('0x50')]=util[_0xf214('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x251ae1[_0xf214('0x4d')],_0x23c585[_0xf214('0x51')],md5(_0x23c585['uniqueid']));}else{_0x23c585[_0xf214('0x50')]='';}headers[_0xf214('0x67')]=getAuth(_0x251ae1);return getUser(_0x251ae1)[_0xf214('0x1a')](function(_0xd91042){_0xaa8520=_0xd91042;logger['info'](_0xf214('0x52'),_0xaa8520['id']);return getEndUser(_0x251ae1,_0x23c585[_0xf214('0x6f')],_0x23c585[_0xf214('0x53')]);})[_0xf214('0x1a')](function(_0x55a60e){_0x43502b=_0x55a60e;logger['info'](_0xf214('0x54'),_0x43502b['id']);return getTicket(_0x251ae1,_0xaa8520,_0x43502b,_0x3f8810,_0x23c585);})[_0xf214('0x1a')](function(_0x3a0325){if(_0x3a0325){logger[_0xf214('0xe')](_0xf214('0x55'),_0x3a0325['id']);}})['catch'](function(_0xd608ea){logger[_0xf214('0x5e')]('['+_0x23c585[_0xf214('0x6d')][_0xf214('0x6e')]()+']'+_0xf214('0x70'),util[_0xf214('0x61')](_0xd608ea,{'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 a0b9030..3842367 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 _0x2617=['What_Id','First_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','Fields','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','zoho.eu','calleridnum','Inbound','lodash','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','picklist','type','variableName','idField','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','data','enduserType','moduleCreate','Error:\x20','log','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads','nothing','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Full_Name','Last_Name'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x2617,0x175));var _0x7261=function(_0x208ad9,_0x69c80c){_0x208ad9=_0x208ad9-0x0;var _0x18dd92=_0x2617[_0x208ad9];return _0x18dd92;};'use strict';var _=require(_0x7261('0x0'));var rp=require('request-promise');var md5=require(_0x7261('0x1'));var util=require(_0x7261('0x2'));var intUtil=require(_0x7261('0x3'));var moment=require(_0x7261('0x4'));var Redis=require('ioredis');var BPromise=require(_0x7261('0x5'));var config=require(_0x7261('0x6'));var logger=require(_0x7261('0x7'))(_0x7261('0x8'));config[_0x7261('0x9')]=_[_0x7261('0xa')](config[_0x7261('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x7261('0xb'))(new Redis(config[_0x7261('0x9')]));function emit(_0x38444d,_0x33be81,_0x548b65){io['to'](_0x38444d)[_0x7261('0xc')](_0x33be81,_0x548b65);}function request(_0x14f348){logger[_0x7261('0xd')](_0x7261('0xe'),JSON[_0x7261('0xf')](_0x14f348));return rp(_0x14f348);}function getCustomFields(_0x5f125f,_0x5a49f4){var _0x1d5f5b={};if(_0x5f125f['length']>0x0){_[_0x7261('0x10')](_0x5f125f,function(_0x54642d){if(_[_0x7261('0x11')](['string',_0x7261('0x12')],_0x54642d[_0x7261('0x13')])&&_0x54642d['idField']){_0x1d5f5b[_0x54642d['idField']]=_0x54642d['content']['toString']();}else if(_0x54642d[_0x7261('0x13')]==='variable'&&_0x54642d[_0x7261('0x14')]&&_0x54642d[_0x7261('0x15')]&&_0x5a49f4[_0x54642d[_0x7261('0x14')]]){_0x1d5f5b[_0x54642d['idField']]=_0x5a49f4[_0x54642d[_0x7261('0x14')]][_0x7261('0x16')]();}else if(_0x54642d[_0x7261('0x13')]===_0x7261('0x17')&&_0x54642d[_0x7261('0x18')]&&_0x54642d[_0x7261('0x18')][_0x7261('0x19')]&&_0x54642d[_0x7261('0x15')]&&_0x5a49f4[_0x54642d['Variable'][_0x7261('0x19')][_0x7261('0x1a')]()]){_0x1d5f5b[_0x54642d['idField']]=_0x5a49f4[_0x54642d[_0x7261('0x18')][_0x7261('0x19')][_0x7261('0x1a')]()][_0x7261('0x16')]();}});}return _0x1d5f5b;}function getName(_0x9346e){if(_0x9346e[_0x7261('0x1b')]('\x20')>0x0){var _0x1ca019=_0x9346e[_0x7261('0x1c')](/ (.+)/);if(_0x1ca019[0x1]){return _0x1ca019;}}return[_0x9346e,_0x9346e];}var accountsTokens={};function getAccessToken(_0x250fb4){return new Promise(function(_0x22ce40,_0x54f777){if(!_[_0x7261('0x1d')](accountsTokens[_0x250fb4['id']])&&!_['isNil'](accountsTokens[_0x250fb4['id']][_0x7261('0x1e')])){if(moment()[_0x7261('0x1f')](accountsTokens[_0x250fb4['id']][_0x7261('0x20')])){_0x22ce40(accountsTokens[_0x250fb4['id']]['access_token']);}}var _0x352d08;switch(_0x250fb4[_0x7261('0x21')]){case'US':_0x352d08=_0x7261('0x22');break;case'AU':_0x352d08='https://accounts.zoho.com.au';break;case'EU':_0x352d08=_0x7261('0x23');break;case'IN':_0x352d08=_0x7261('0x24');break;case'CN':_0x352d08=_0x7261('0x25');break;default:_0x352d08=_0x7261('0x23');break;}var _0x41902b={'method':_0x7261('0x26'),'uri':_0x352d08+'/oauth/v2/token','qs':{'refresh_token':_0x250fb4[_0x7261('0x27')],'client_id':_0x250fb4[_0x7261('0x28')],'client_secret':_0x250fb4[_0x7261('0x29')],'grant_type':_0x7261('0x2a')},'json':!![]};return rp(_0x41902b)[_0x7261('0x2b')](function(_0x2899e5){accountsTokens[_0x250fb4['id']]={'access_token':_0x2899e5['access_token'],'expires_in':moment()[_0x7261('0x2c')](_0x2899e5[_0x7261('0x20')],'seconds')};_0x22ce40(_0x2899e5[_0x7261('0x1e')]);})[_0x7261('0x2d')](function(_0x38ea99){logger[_0x7261('0x2e')](_0x7261('0x2f'),_0x38ea99[_0x7261('0x30')]);_0x54f777(_0x38ea99);});});}function getUser(_0x5acf91,_0x197ff3,_0xc2428c,_0x1f1637){logger[_0x7261('0x31')](_0x7261('0x32'));return request({'method':_0x7261('0x33'),'uri':util[_0x7261('0x34')](_0x7261('0x35'),_0x197ff3),'qs':{'type':_0x7261('0x36')},'headers':{'Authorization':_0x7261('0x37')+_0x5acf91},'json':!![]})[_0x7261('0x2b')](function(_0x245558){if(_0x245558['users']){var _0x317d20=-0x1;if(_[_0x7261('0x38')](_0x245558[_0x7261('0x39')])){if(!_[_0x7261('0x1d')](_0x1f1637)){_0x317d20=_[_0x7261('0x3a')](_0x245558['users'],function(_0x12c145){return _0x12c145['email']===_0x1f1637;});}if(_0x317d20>=0x0){logger[_0x7261('0x31')](_0x7261('0x3b'));}else{logger['info'](_0x7261('0x3c'));_0x317d20=_[_0x7261('0x3a')](_0x245558[_0x7261('0x39')],function(_0x584560){return _0x584560[_0x7261('0x3d')][_0x7261('0x19')]==='Administrator';});}return _0x245558[_0x7261('0x39')][_0x317d20];}else{if(_0x245558['user'][_0x7261('0x3d')]['name']===_0x7261('0x3e')){logger[_0x7261('0x31')](_0x7261('0x3c'));user=_0x245558[_0x7261('0x3f')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x245558));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x7261('0xf')](_0x245558));}}}else{logger[_0x7261('0x2e')](_0x7261('0x40'),JSON[_0x7261('0xf')](_0x245558));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x7261('0xf')](_0x245558));}})[_0x7261('0x2d')](function(_0x151f29){console[_0x7261('0x2e')](_0x151f29);});}function getZohoUser(_0x3cf499,_0x3d36f5){return new BPromise(function(_0x28971f,_0x30ce2f){request(_0x3cf499)[_0x7261('0x2b')](function(_0x16a288){var _0x4a7c1e=null;if(_0x16a288){_0x4a7c1e=_0x16a288['data'][0x0];_0x4a7c1e['enduserType']=_0x3d36f5;}_0x28971f(_0x4a7c1e);})[_0x7261('0x2d')](function(_0x5f50ab){_0x30ce2f(_0x5f50ab);});});}function createEndUser(_0x5dfe3e,_0x46ea16,_0x25a551,_0x4e2450,_0x2dd4ac,_0x63e940){var _0x25a551=getName(_0x25a551);return request({'method':_0x7261('0x26'),'uri':'https://www.zohoapis.'+_0x46ea16+_0x7261('0x41')+_[_0x7261('0x42')](_0x63e940['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x25a551[0x1],'First_Name':_0x25a551[0x0],'Phone':_0x4e2450,'Owner':{'name':!_[_0x7261('0x1d')](_0x2dd4ac[_0x7261('0x43')][_0x7261('0x19')])?_0x2dd4ac[_0x7261('0x43')]['name']:!_['isNil'](_0x2dd4ac[_0x7261('0x44')])?_0x2dd4ac[_0x7261('0x44')]+'\x20'+_0x2dd4ac[_0x7261('0x45')]:_0x2dd4ac['last_name'],'id':_0x2dd4ac['id']}}]},'headers':{'Authorization':_0x7261('0x37')+_0x5dfe3e},'json':!![]})[_0x7261('0x2b')](function(_0x50e18a){if(_0x50e18a&&_0x50e18a['data'][0x0][_0x7261('0x46')]===_0x7261('0x47')){var _0x39027d=_0x50e18a[_0x7261('0x48')][0x0]['details'];_0x39027d[_0x7261('0x49')]=_[_0x7261('0x42')](_0x63e940[_0x7261('0x4a')])+'s';return _0x39027d;}logger['error'](_0x7261('0x40'),JSON['stringify'](data));throw new Error(_0x7261('0x4b')+JSON[_0x7261('0xf')](data));})[_0x7261('0x2d')](function(_0x339f53){console[_0x7261('0x4c')]('CREATE\x20ERROR',_0x339f53);});}function getEndUser(_0x12f9b0,_0x250493,_0x59c9eb,_0x3ec6ec,_0x2e6148,_0x2d10cd,_0x49f60a){var _0x18ab3b={'method':_0x7261('0x33'),'uri':'','headers':{'Authorization':_0x7261('0x37')+_0x12f9b0},'json':!![]};switch(_0x49f60a[_0x7261('0x4d')]){case _0x7261('0x4e'):_0x18ab3b['uri']=_0x7261('0x4f')+_0x250493+_0x7261('0x50')+_0x2e6148+'))';return getZohoUser(_0x18ab3b,_0x7261('0x51'))[_0x7261('0x2b')](function(_0x154ca5){if(_0x154ca5)return _0x154ca5;_0x18ab3b[_0x7261('0x52')]=_0x7261('0x4f')+_0x250493+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2e6148+'))';return getZohoUser(_0x18ab3b,_0x7261('0x53'))[_0x7261('0x2b')](function(_0x1befa5){if(_0x1befa5)return _0x1befa5;if(_0x49f60a['moduleCreate']!=_0x7261('0x54')){return createEndUser(_0x12f9b0,_0x250493,_0x3ec6ec,_0x2e6148,_0x2d10cd,_0x49f60a);}else{return{};}});});break;case'contact':_0x18ab3b[_0x7261('0x52')]=_0x7261('0x4f')+_0x250493+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2e6148+'))';return getZohoUser(_0x18ab3b,'Contacts')[_0x7261('0x2b')](function(_0x27cc1b){if(_0x27cc1b)return _0x27cc1b;if(_0x49f60a['moduleCreate']!=_0x7261('0x54')){return createEndUser(_0x12f9b0,_0x250493,_0x3ec6ec,_0x2e6148,_0x2d10cd,_0x49f60a);}else{return{};}});break;case'lead':_0x18ab3b[_0x7261('0x52')]=_0x7261('0x4f')+_0x250493+_0x7261('0x55')+_0x2e6148+'))';return getZohoUser(_0x18ab3b,'Leads')[_0x7261('0x2b')](function(_0x524b2e){if(_0x524b2e)return _0x524b2e;if(_0x49f60a['moduleCreate']!=_0x7261('0x54')){return createEndUser(_0x12f9b0,_0x250493,_0x3ec6ec,_0x2e6148,_0x2d10cd,_0x49f60a);}else{return{};}});break;}}function getCall(_0x47e2af,_0x524698,_0x52e012,_0xa1c87b,_0x2ee0e5,_0x138e3a,_0x518337,_0x4befea){logger['info'](_0x7261('0x56'));var _0x3d9293={};_0x3d9293[_0x7261('0x57')]={'name':!_['isNil'](_0xa1c87b[_0x7261('0x43')]['name'])&&!_[_0x7261('0x1d')](_0xa1c87b[_0x7261('0x3d')][_0x7261('0x19')])&&_0xa1c87b[_0x7261('0x3d')][_0x7261('0x19')]===_0x7261('0x58')?_0xa1c87b[_0x7261('0x43')]['name']:!_[_0x7261('0x1d')](_0xa1c87b[_0x7261('0x44')])?_0xa1c87b[_0x7261('0x44')]+'\x20'+_0xa1c87b['last_name']:_0xa1c87b[_0x7261('0x45')],'id':_0xa1c87b['id']};_0x3d9293['Subject']=intUtil[_0x7261('0x59')](_0x138e3a[_0x7261('0x5a')],_0x518337,'\x20');_0x3d9293[_0x7261('0x5b')]=intUtil[_0x7261('0x59')](_0x138e3a[_0x7261('0x5c')],_0x518337,'\x0a');if(_0x2ee0e5[_0x7261('0x49')]==='Contacts'){_0x3d9293['Who_Id']={'name':!_[_0x7261('0x1d')](_0x2ee0e5[_0x7261('0x5d')])?_0x2ee0e5[_0x7261('0x5d')]:!_[_0x7261('0x1d')](_0x2ee0e5['First_Name'])?_0x2ee0e5['First_Name']+'\x20'+_0x2ee0e5[_0x7261('0x5e')]:_0x2ee0e5[_0x7261('0x5e')],'id':_0x2ee0e5['id']};}if(_0x2ee0e5[_0x7261('0x49')]===_0x7261('0x53')){_0x3d9293[_0x7261('0x5f')]={'name':!_['isNil'](_0x2ee0e5[_0x7261('0x5d')])?_0x2ee0e5[_0x7261('0x5d')]:!_[_0x7261('0x1d')](_0x2ee0e5[_0x7261('0x60')])?_0x2ee0e5[_0x7261('0x60')]+'\x20'+_0x2ee0e5[_0x7261('0x5e')]:_0x2ee0e5[_0x7261('0x5e')],'id':_0x2ee0e5['id']};_0x3d9293[_0x7261('0x61')]=_[_0x7261('0x42')](_0x2ee0e5[_0x7261('0x49')]);}if(_0x518337[_0x7261('0x62')]){_0x3d9293[_0x7261('0x63')]=moment[_0x7261('0x64')](parseInt(_0x518337['talktime'])*0x3e8)[_0x7261('0x34')](_0x7261('0x65'));}else if(_0x518337[_0x7261('0x66')]&&_0x518337['endtime']){_0x3d9293['Call_Duration']=moment['utc'](moment(_0x518337[_0x7261('0x67')],_0x7261('0x68'))['diff'](moment(_0x518337[_0x7261('0x69')],_0x7261('0x68'))))['format']('mm:ss');}switch(_0x518337['lastevent']){case _0x7261('0x6a'):_0x3d9293[_0x7261('0x6b')]=_0x7261('0x6c');break;case _0x7261('0x6d'):case _0x7261('0x6e'):_0x3d9293[_0x7261('0x6b')]='Answered';break;case _0x7261('0x6f'):_0x3d9293[_0x7261('0x6b')]=_0x7261('0x70');break;case _0x7261('0x71'):_0x3d9293['Call_Result']='Abandoned';break;case _0x7261('0x72'):_0x3d9293[_0x7261('0x6b')]=_0x7261('0x73');default:}_0x3d9293[_0x7261('0x74')]=(_0x4befea==='outbound'?moment(_0x518337[_0x7261('0x69')])[_0x7261('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x518337[_0x7261('0x75')])[_0x7261('0x34')](_0x7261('0x68')))||moment()['format'](_0x7261('0x68'));_0x3d9293[_0x7261('0x76')]=_0x4befea||'Inbound';_0x3d9293=_[_0x7261('0x77')](_0x3d9293,getCustomFields(_0x138e3a[_0x7261('0x78')],_0x518337));return request({'method':_0x7261('0x26'),'uri':_0x7261('0x4f')+_0x524698+'/crm/v2/Calls','headers':{'Authorization':_0x7261('0x37')+_0x47e2af},'body':{'data':[_0x3d9293]},'json':!![]})[_0x7261('0x2b')](function(_0x8316bc){if(_0x8316bc&&_0x8316bc[_0x7261('0x48')][0x0]['code']===_0x7261('0x47')){logger[_0x7261('0x31')](_0x7261('0x79'));return{'id':_0x8316bc[_0x7261('0x48')][0x0][_0x7261('0x7a')]['id']};}})[_0x7261('0x2d')](function(_0x8b2068){logger[_0x7261('0x31')]('err',_0x8b2068[_0x7261('0x30')]);console[_0x7261('0x4c')](_0x7261('0x7b'),_0x8b2068);});}exports[_0x7261('0x7c')]=function(_0x3ab700,_0x4c6eff,_0x5eada1,_0x3acda2,_0x3123b2,_0x273579){var _0xbc2ed0,_0x1e2a03,_0x34bccf;_0x273579[_0x7261('0x7d')]=intUtil[_0x7261('0x7e')](_0x273579[_0x7261('0x7d')]);_0x273579[_0x7261('0x7f')]=intUtil[_0x7261('0x7e')](_0x273579[_0x7261('0x7f')]);if(_0x3123b2&&_0x3123b2[_0x7261('0x80')]){logger['info']('[QUEUE]',_0x7261('0x81'));_0x4c6eff[_0x7261('0x82')]=_0x273579[_0x7261('0x7f')]+'/api/voice/recordings/'+_0x4c6eff[_0x7261('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x4c6eff[_0x7261('0x83')]);}else{_0x4c6eff[_0x7261('0x82')]='';}var _0x1d55db=_0x273579[_0x7261('0x7d')]==='zoho.eu'?'eu':_0x7261('0x84');return getAccessToken(_0x273579)[_0x7261('0x2b')](function(_0x930214){_0x34bccf=_0x930214;return getUser(_0x34bccf,_0x1d55db,_0x273579,_0x3acda2[_0x7261('0x85')]);})[_0x7261('0x2b')](function(_0x4a1cc9){_0xbc2ed0=_0x4a1cc9;logger['info'](_0x7261('0x86'),_0xbc2ed0['id']);return getEndUser(_0x34bccf,_0x1d55db,_0x273579,_0x4c6eff[_0x7261('0x87')],_0x4c6eff['calleridnum'],_0xbc2ed0,_0x5eada1);})[_0x7261('0x2b')](function(_0x36f3db){_0x1e2a03=_0x36f3db;return getCall(_0x34bccf,_0x1d55db,_0x273579,_0xbc2ed0,_0x1e2a03,_0x5eada1,_0x4c6eff,'Inbound');})[_0x7261('0x2b')](function(_0x3b24af){if(_0x3b24af){logger[_0x7261('0x31')](_0x7261('0x88'),_0x3b24af['id']);logger[_0x7261('0x31')](_0x7261('0x89'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7261('0x8a'),_0x3acda2[_0x7261('0x19')]),_0x7261('0x8b'),{'uri':_0x7261('0x8c')+_0x273579[_0x7261('0x7d')]+_0x7261('0x8d')+_0x3b24af['id']});}})[_0x7261('0x2d')](function(_0x62d2f2){logger[_0x7261('0x2e')]('[QUEUE]',JSON['stringify'](_0x62d2f2));});};exports[_0x7261('0x8e')]=function(_0x4c959b,_0x4abec1,_0x39a98e,_0x875061,_0x4f588a,_0x3cc8b6,_0x361385){var _0x5f0ede,_0x189bdb,_0x49be88;_0x3cc8b6['host']=intUtil[_0x7261('0x7e')](_0x3cc8b6['host']);_0x3cc8b6[_0x7261('0x7f')]=intUtil['stripTrailingSlash'](_0x3cc8b6[_0x7261('0x7f')]);if(_0x361385&&_0x361385[_0x7261('0x8f')]&&_0x361385[_0x7261('0x8f')]!=='none'){logger[_0x7261('0x31')](_0x7261('0x90'),_0x7261('0x81'));_0x4abec1[_0x7261('0x82')]=_0x3cc8b6['serverUrl']+_0x7261('0x91')+_0x4abec1[_0x7261('0x83')]+_0x7261('0x92')+md5(_0x4abec1['uniqueid']);}var _0x3d8d34=_0x3cc8b6[_0x7261('0x7d')]==='zoho.eu'?'eu':_0x7261('0x84');return getAccessToken(_0x3cc8b6)[_0x7261('0x2b')](function(_0x1c14ce){_0x49be88=_0x1c14ce;return getUser(_0x49be88,_0x3d8d34,_0x3cc8b6,_0x875061[_0x7261('0x85')]);})['then'](function(_0x53a131){_0x5f0ede=_0x53a131;logger[_0x7261('0x31')]('The\x20User\x20ID\x20is:',_0x5f0ede['id']);return getEndUser(_0x49be88,_0x3d8d34,_0x3cc8b6,_0x4abec1[_0x7261('0x93')],_0x4abec1[_0x7261('0x94')],_0x5f0ede,_0x39a98e);})[_0x7261('0x2b')](function(_0x63dcf0){_0x189bdb=_0x63dcf0;return getCall(_0x49be88,_0x3d8d34,_0x3cc8b6,_0x5f0ede,_0x189bdb,_0x39a98e,_0x4abec1,_0x7261('0x95'));})[_0x7261('0x2b')](function(_0x2b6287){if(_0x2b6287){logger[_0x7261('0x31')](_0x7261('0x88'),_0x2b6287['id']);logger['info'](_0x7261('0x90'),_0x7261('0x96'));emit(util['format'](_0x7261('0x8a'),_0x875061['name']),'trigger:browser:url',{'uri':_0x7261('0x8c')+_0x3cc8b6[_0x7261('0x7d')]+_0x7261('0x8d')+_0x2b6287['id']});}})[_0x7261('0x2d')](function(_0x36a034){logger[_0x7261('0x2e')](_0x7261('0x90'),JSON[_0x7261('0xf')](_0x36a034));});};exports['unmanaged']=function(_0x3249a5,_0x1bdd12,_0x5f16a2,_0x5b45f8,_0x5d95d0,_0x90220){var _0x38b262,_0x19e337,_0x53eefd;_0x90220[_0x7261('0x7d')]=intUtil['stripTrailingSlash'](_0x90220[_0x7261('0x7d')]);_0x90220['serverUrl']=intUtil['stripTrailingSlash'](_0x90220[_0x7261('0x7f')]);if(_0x5d95d0&&_0x5d95d0[_0x7261('0x80')]){logger[_0x7261('0x31')]('['+_0x1bdd12[_0x7261('0x97')][_0x7261('0x98')]()+']','Recording\x20is\x20enabled!');_0x1bdd12[_0x7261('0x82')]=_0x90220[_0x7261('0x7f')]+'/api/voice/recordings/'+_0x1bdd12[_0x7261('0x83')]+_0x7261('0x92')+md5(_0x1bdd12['uniqueid']);}else{_0x1bdd12[_0x7261('0x82')]='';}var _0x572712=_0x90220['host']===_0x7261('0x99')?'eu':_0x7261('0x84');return getAccessToken(_0x90220)['then'](function(_0x3687a0){_0x53eefd=_0x3687a0;return getUser(_0x53eefd,_0x572712,_0x90220);})[_0x7261('0x2b')](function(_0xaf541){_0x38b262=_0xaf541;logger[_0x7261('0x31')](_0x7261('0x86'),_0x38b262['id']);return getEndUser(_0x53eefd,_0x572712,_0x90220,_0x1bdd12[_0x7261('0x87')],_0x1bdd12[_0x7261('0x9a')],_0x38b262,_0x5f16a2);})['then'](function(_0x15a966){_0x19e337=_0x15a966;return getCall(_0x53eefd,_0x572712,_0x90220,_0x38b262,_0x19e337,_0x5f16a2,_0x1bdd12,_0x7261('0x9b'));})[_0x7261('0x2b')](function(_0x5c9945){if(_0x5c9945){logger[_0x7261('0x31')]('The\x20Call\x20ID\x20is:',_0x5c9945['id']);}})[_0x7261('0x2d')](function(_0x4cce9c){logger[_0x7261('0x2e')]('['+_0x1bdd12[_0x7261('0x97')][_0x7261('0x98')]()+']',JSON[_0x7261('0xf')](_0x4cce9c));});}; \ No newline at end of file +var _0xf547=['variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Called','complete','Answered','Call_Result','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','log','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','calleridnum','lodash','request-promise','md5','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','picklist','type','idField','content'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf547,0x1b7));var _0x7f54=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xf547[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x7f54('0x0'));var rp=require(_0x7f54('0x1'));var md5=require(_0x7f54('0x2'));var util=require('util');var intUtil=require(_0x7f54('0x3'));var moment=require('moment');var Redis=require(_0x7f54('0x4'));var BPromise=require(_0x7f54('0x5'));var config=require(_0x7f54('0x6'));var logger=require(_0x7f54('0x7'))('zoho');config[_0x7f54('0x8')]=_[_0x7f54('0x9')](config['redis'],{'host':_0x7f54('0xa'),'port':0x18eb});var io=require(_0x7f54('0xb'))(new Redis(config[_0x7f54('0x8')]));function emit(_0x7f3055,_0x18c7a9,_0x2799ef){io['to'](_0x7f3055)[_0x7f54('0xc')](_0x18c7a9,_0x2799ef);}function request(_0x183c25){logger[_0x7f54('0xd')]('[HTTP]',JSON[_0x7f54('0xe')](_0x183c25));return rp(_0x183c25);}function getCustomFields(_0x323d3c,_0x5696fe){var _0x3f88e3={};if(_0x323d3c[_0x7f54('0xf')]>0x0){_[_0x7f54('0x10')](_0x323d3c,function(_0x284691){if(_[_0x7f54('0x11')]([_0x7f54('0x12'),_0x7f54('0x13')],_0x284691[_0x7f54('0x14')])&&_0x284691[_0x7f54('0x15')]){_0x3f88e3[_0x284691[_0x7f54('0x15')]]=_0x284691[_0x7f54('0x16')]['toString']();}else if(_0x284691['type']===_0x7f54('0x17')&&_0x284691[_0x7f54('0x18')]&&_0x284691[_0x7f54('0x15')]&&_0x5696fe[_0x284691[_0x7f54('0x18')]]){_0x3f88e3[_0x284691[_0x7f54('0x15')]]=_0x5696fe[_0x284691[_0x7f54('0x18')]]['toString']();}else if(_0x284691[_0x7f54('0x14')]===_0x7f54('0x19')&&_0x284691[_0x7f54('0x1a')]&&_0x284691[_0x7f54('0x1a')]['name']&&_0x284691['idField']&&_0x5696fe[_0x284691[_0x7f54('0x1a')][_0x7f54('0x1b')][_0x7f54('0x1c')]()]){_0x3f88e3[_0x284691['idField']]=_0x5696fe[_0x284691[_0x7f54('0x1a')]['name'][_0x7f54('0x1c')]()]['toString']();}});}return _0x3f88e3;}function getName(_0x429db1){if(_0x429db1[_0x7f54('0x1d')]('\x20')>0x0){var _0x59c83e=_0x429db1[_0x7f54('0x1e')](/ (.+)/);if(_0x59c83e[0x1]){return _0x59c83e;}}return[_0x429db1,_0x429db1];}var accountsTokens={};function getAccessToken(_0x27b462){return new Promise(function(_0x137360,_0x44a269){if(!_[_0x7f54('0x1f')](accountsTokens[_0x27b462['id']])&&!_[_0x7f54('0x1f')](accountsTokens[_0x27b462['id']][_0x7f54('0x20')])){if(moment()[_0x7f54('0x21')](accountsTokens[_0x27b462['id']][_0x7f54('0x22')])){_0x137360(accountsTokens[_0x27b462['id']][_0x7f54('0x20')]);}}var _0x4c7c0a;switch(_0x27b462[_0x7f54('0x23')]){case'US':_0x4c7c0a=_0x7f54('0x24');break;case'AU':_0x4c7c0a=_0x7f54('0x25');break;case'EU':_0x4c7c0a=_0x7f54('0x26');break;case'IN':_0x4c7c0a=_0x7f54('0x27');break;case'CN':_0x4c7c0a=_0x7f54('0x28');break;default:_0x4c7c0a=_0x7f54('0x26');break;}var _0x38e73d={'method':'POST','uri':_0x4c7c0a+_0x7f54('0x29'),'qs':{'refresh_token':_0x27b462[_0x7f54('0x2a')],'client_id':_0x27b462[_0x7f54('0x2b')],'client_secret':_0x27b462[_0x7f54('0x2c')],'grant_type':_0x7f54('0x2d')},'json':!![]};return rp(_0x38e73d)['then'](function(_0x1c8e4d){accountsTokens[_0x27b462['id']]={'access_token':_0x1c8e4d[_0x7f54('0x20')],'expires_in':moment()[_0x7f54('0x2e')](_0x1c8e4d[_0x7f54('0x22')],'seconds')};_0x137360(_0x1c8e4d[_0x7f54('0x20')]);})[_0x7f54('0x2f')](function(_0x47be17){logger[_0x7f54('0x30')](_0x7f54('0x31'),_0x47be17['stack']);_0x44a269(_0x47be17);});});}function getUser(_0x2fe61b,_0x3713b8,_0x2d5bdc,_0x16cfbf){logger[_0x7f54('0x32')](_0x7f54('0x33'));return request({'method':_0x7f54('0x34'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x3713b8),'qs':{'type':_0x7f54('0x35')},'headers':{'Authorization':_0x7f54('0x36')+_0x2fe61b},'json':!![]})[_0x7f54('0x37')](function(_0x1ab51d){if(_0x1ab51d['users']){var _0x317cef=-0x1;if(_['isArrayLikeObject'](_0x1ab51d[_0x7f54('0x38')])){if(!_[_0x7f54('0x1f')](_0x16cfbf)){_0x317cef=_[_0x7f54('0x39')](_0x1ab51d[_0x7f54('0x38')],function(_0xa37237){return _0xa37237[_0x7f54('0x3a')]===_0x16cfbf;});}if(_0x317cef>=0x0){logger[_0x7f54('0x32')]('Agent\x20found!');}else{logger[_0x7f54('0x32')](_0x7f54('0x3b'));_0x317cef=_['findIndex'](_0x1ab51d[_0x7f54('0x38')],function(_0x3ccaa4){return _0x3ccaa4[_0x7f54('0x3c')][_0x7f54('0x1b')]===_0x7f54('0x3d');});}return _0x1ab51d[_0x7f54('0x38')][_0x317cef];}else{if(_0x1ab51d[_0x7f54('0x3e')][_0x7f54('0x3c')][_0x7f54('0x1b')]===_0x7f54('0x3d')){logger['info'](_0x7f54('0x3b'));user=_0x1ab51d[_0x7f54('0x3e')];return user;}else{logger[_0x7f54('0x30')](_0x7f54('0x3f'),JSON[_0x7f54('0xe')](_0x1ab51d));throw new Error(_0x7f54('0x40')+JSON[_0x7f54('0xe')](_0x1ab51d));}}}else{logger[_0x7f54('0x30')]('The\x20failing\x20result\x20is',JSON[_0x7f54('0xe')](_0x1ab51d));throw new Error(_0x7f54('0x40')+JSON[_0x7f54('0xe')](_0x1ab51d));}})[_0x7f54('0x2f')](function(_0x3c3ae9){console[_0x7f54('0x30')](_0x3c3ae9);});}function getZohoUser(_0x3ce1b2,_0xcd1591){return new BPromise(function(_0x3df367,_0x2a5ae8){request(_0x3ce1b2)[_0x7f54('0x37')](function(_0x1f9de6){var _0x240b4d=null;if(_0x1f9de6){_0x240b4d=_0x1f9de6[_0x7f54('0x41')][0x0];_0x240b4d[_0x7f54('0x42')]=_0xcd1591;}_0x3df367(_0x240b4d);})[_0x7f54('0x2f')](function(_0x38ea48){_0x2a5ae8(_0x38ea48);});});}function createEndUser(_0x59b13f,_0xbe16d1,_0x4a3b5a,_0x427aee,_0x7f0afa,_0x40599f){var _0x4a3b5a=getName(_0x4a3b5a);return request({'method':_0x7f54('0x43'),'uri':'https://www.zohoapis.'+_0xbe16d1+'/crm/v2/'+_[_0x7f54('0x44')](_0x40599f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4a3b5a[0x1],'First_Name':_0x4a3b5a[0x0],'Phone':_0x427aee,'Owner':{'name':!_['isNil'](_0x7f0afa[_0x7f54('0x45')][_0x7f54('0x1b')])?_0x7f0afa[_0x7f54('0x45')][_0x7f54('0x1b')]:!_[_0x7f54('0x1f')](_0x7f0afa['first_name'])?_0x7f0afa[_0x7f54('0x46')]+'\x20'+_0x7f0afa[_0x7f54('0x47')]:_0x7f0afa[_0x7f54('0x47')],'id':_0x7f0afa['id']}}]},'headers':{'Authorization':_0x7f54('0x36')+_0x59b13f},'json':!![]})[_0x7f54('0x37')](function(_0x13ed05){if(_0x13ed05&&_0x13ed05[_0x7f54('0x41')][0x0][_0x7f54('0x48')]===_0x7f54('0x49')){var _0x1f209b=_0x13ed05[_0x7f54('0x41')][0x0][_0x7f54('0x4a')];_0x1f209b[_0x7f54('0x42')]=_['startCase'](_0x40599f[_0x7f54('0x4b')])+'s';return _0x1f209b;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x7f54('0xe')](data));throw new Error(_0x7f54('0x4c')+JSON[_0x7f54('0xe')](data));})[_0x7f54('0x2f')](function(_0x38e33e){console['log'](_0x7f54('0x4d'),_0x38e33e);});}function getEndUser(_0x415f36,_0x4d00c2,_0x5ef375,_0x336c54,_0x477e25,_0x182ffc,_0x528a25){var _0x45d400={'method':_0x7f54('0x34'),'uri':'','headers':{'Authorization':_0x7f54('0x36')+_0x415f36},'json':!![]};switch(_0x528a25['moduleSearch']){case _0x7f54('0x4e'):_0x45d400[_0x7f54('0x4f')]=_0x7f54('0x50')+_0x4d00c2+_0x7f54('0x51')+_0x477e25+'))';return getZohoUser(_0x45d400,_0x7f54('0x52'))[_0x7f54('0x37')](function(_0xa8a304){if(_0xa8a304)return _0xa8a304;_0x45d400[_0x7f54('0x4f')]=_0x7f54('0x50')+_0x4d00c2+_0x7f54('0x53')+_0x477e25+'))';return getZohoUser(_0x45d400,'Leads')['then'](function(_0x51d76c){if(_0x51d76c)return _0x51d76c;if(_0x528a25[_0x7f54('0x4b')]!=_0x7f54('0x54')){return createEndUser(_0x415f36,_0x4d00c2,_0x336c54,_0x477e25,_0x182ffc,_0x528a25);}else{return{};}});});break;case _0x7f54('0x55'):_0x45d400[_0x7f54('0x4f')]=_0x7f54('0x50')+_0x4d00c2+_0x7f54('0x51')+_0x477e25+'))';return getZohoUser(_0x45d400,_0x7f54('0x52'))[_0x7f54('0x37')](function(_0x4fb8e7){if(_0x4fb8e7)return _0x4fb8e7;if(_0x528a25['moduleCreate']!=_0x7f54('0x54')){return createEndUser(_0x415f36,_0x4d00c2,_0x336c54,_0x477e25,_0x182ffc,_0x528a25);}else{return{};}});break;case'lead':_0x45d400[_0x7f54('0x4f')]='https://www.zohoapis.'+_0x4d00c2+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x477e25+'))';return getZohoUser(_0x45d400,_0x7f54('0x56'))['then'](function(_0x2e7050){if(_0x2e7050)return _0x2e7050;if(_0x528a25[_0x7f54('0x4b')]!=_0x7f54('0x54')){return createEndUser(_0x415f36,_0x4d00c2,_0x336c54,_0x477e25,_0x182ffc,_0x528a25);}else{return{};}});break;}}function getCall(_0x4a1fc8,_0x22231e,_0x225ff9,_0x3ba0d2,_0x10b81a,_0x548400,_0x3d8452,_0x59864d){logger['info'](_0x7f54('0x57'));var _0x57e5da={};_0x57e5da[_0x7f54('0x58')]={'name':!_[_0x7f54('0x1f')](_0x3ba0d2[_0x7f54('0x45')][_0x7f54('0x1b')])&&!_[_0x7f54('0x1f')](_0x3ba0d2[_0x7f54('0x3c')][_0x7f54('0x1b')])&&_0x3ba0d2[_0x7f54('0x3c')][_0x7f54('0x1b')]===_0x7f54('0x59')?_0x3ba0d2[_0x7f54('0x45')]['name']:!_[_0x7f54('0x1f')](_0x3ba0d2[_0x7f54('0x46')])?_0x3ba0d2[_0x7f54('0x46')]+'\x20'+_0x3ba0d2[_0x7f54('0x47')]:_0x3ba0d2[_0x7f54('0x47')],'id':_0x3ba0d2['id']};_0x57e5da[_0x7f54('0x5a')]=intUtil[_0x7f54('0x5b')](_0x548400[_0x7f54('0x5c')],_0x3d8452,'\x20');_0x57e5da[_0x7f54('0x5d')]=intUtil[_0x7f54('0x5b')](_0x548400[_0x7f54('0x5e')],_0x3d8452,'\x0a');if(_0x10b81a[_0x7f54('0x42')]===_0x7f54('0x52')){_0x57e5da['Who_Id']={'name':!_[_0x7f54('0x1f')](_0x10b81a[_0x7f54('0x5f')])?_0x10b81a[_0x7f54('0x5f')]:!_['isNil'](_0x10b81a['First_Name'])?_0x10b81a[_0x7f54('0x60')]+'\x20'+_0x10b81a[_0x7f54('0x61')]:_0x10b81a[_0x7f54('0x61')],'id':_0x10b81a['id']};}if(_0x10b81a['enduserType']===_0x7f54('0x56')){_0x57e5da[_0x7f54('0x62')]={'name':!_[_0x7f54('0x1f')](_0x10b81a['Full_Name'])?_0x10b81a['Full_Name']:!_[_0x7f54('0x1f')](_0x10b81a['First_Name'])?_0x10b81a['First_Name']+'\x20'+_0x10b81a[_0x7f54('0x61')]:_0x10b81a[_0x7f54('0x61')],'id':_0x10b81a['id']};_0x57e5da[_0x7f54('0x63')]=_[_0x7f54('0x44')](_0x10b81a[_0x7f54('0x42')]);}if(_0x3d8452['talktime']){_0x57e5da[_0x7f54('0x64')]=moment[_0x7f54('0x65')](parseInt(_0x3d8452['talktime'])*0x3e8)[_0x7f54('0x66')]('mm:ss');}else if(_0x3d8452[_0x7f54('0x67')]&&_0x3d8452[_0x7f54('0x68')]){_0x57e5da[_0x7f54('0x64')]=moment[_0x7f54('0x65')](moment(_0x3d8452[_0x7f54('0x68')],_0x7f54('0x69'))[_0x7f54('0x6a')](moment(_0x3d8452[_0x7f54('0x6b')],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0x3d8452[_0x7f54('0x6c')]){case'called':_0x57e5da['Call_Result']=_0x7f54('0x6d');break;case _0x7f54('0x6e'):case'connect':_0x57e5da['Call_Result']=_0x7f54('0x6f');break;case'rejected':_0x57e5da[_0x7f54('0x70')]='Rejected';break;case _0x7f54('0x71'):_0x57e5da[_0x7f54('0x70')]=_0x7f54('0x72');break;case _0x7f54('0x73'):_0x57e5da['Call_Result']=_0x7f54('0x74');default:}_0x57e5da[_0x7f54('0x75')]=(_0x59864d==='outbound'?moment(_0x3d8452[_0x7f54('0x6b')])[_0x7f54('0x66')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3d8452['agentcalledAt'])[_0x7f54('0x66')](_0x7f54('0x69')))||moment()[_0x7f54('0x66')](_0x7f54('0x69'));_0x57e5da[_0x7f54('0x76')]=_0x59864d||_0x7f54('0x77');_0x57e5da=_[_0x7f54('0x78')](_0x57e5da,getCustomFields(_0x548400[_0x7f54('0x79')],_0x3d8452));return request({'method':'POST','uri':_0x7f54('0x50')+_0x22231e+_0x7f54('0x7a'),'headers':{'Authorization':_0x7f54('0x36')+_0x4a1fc8},'body':{'data':[_0x57e5da]},'json':!![]})['then'](function(_0xe511a6){if(_0xe511a6&&_0xe511a6[_0x7f54('0x41')][0x0][_0x7f54('0x48')]===_0x7f54('0x49')){logger['info'](_0x7f54('0x7b'));return{'id':_0xe511a6['data'][0x0][_0x7f54('0x4a')]['id']};}})[_0x7f54('0x2f')](function(_0x13675f){logger['info']('err',_0x13675f[_0x7f54('0x7c')]);console[_0x7f54('0x7d')]('err',_0x13675f);});}exports['queue']=function(_0x29240f,_0x5685df,_0x30ec2d,_0x5758aa,_0x7afe9b,_0x1cda56){var _0xf3352f,_0xf465d,_0xca0fa8;_0x1cda56[_0x7f54('0x7e')]=intUtil['stripTrailingSlash'](_0x1cda56['host']);_0x1cda56[_0x7f54('0x7f')]=intUtil[_0x7f54('0x80')](_0x1cda56[_0x7f54('0x7f')]);if(_0x7afe9b&&_0x7afe9b[_0x7f54('0x81')]){logger[_0x7f54('0x32')](_0x7f54('0x82'),_0x7f54('0x83'));_0x5685df[_0x7f54('0x84')]=_0x1cda56[_0x7f54('0x7f')]+_0x7f54('0x85')+_0x5685df['uniqueid']+_0x7f54('0x86')+md5(_0x5685df[_0x7f54('0x87')]);}else{_0x5685df[_0x7f54('0x84')]='';}var _0x4d677b=_0x1cda56[_0x7f54('0x7e')]===_0x7f54('0x88')?'eu':_0x7f54('0x89');return getAccessToken(_0x1cda56)[_0x7f54('0x37')](function(_0x1f9a70){_0xca0fa8=_0x1f9a70;return getUser(_0xca0fa8,_0x4d677b,_0x1cda56,_0x5758aa[_0x7f54('0x3a')]);})['then'](function(_0x3b3774){_0xf3352f=_0x3b3774;logger[_0x7f54('0x32')](_0x7f54('0x8a'),_0xf3352f['id']);return getEndUser(_0xca0fa8,_0x4d677b,_0x1cda56,_0x5685df[_0x7f54('0x8b')],_0x5685df['calleridnum'],_0xf3352f,_0x30ec2d);})[_0x7f54('0x37')](function(_0x3e4b81){_0xf465d=_0x3e4b81;return getCall(_0xca0fa8,_0x4d677b,_0x1cda56,_0xf3352f,_0xf465d,_0x30ec2d,_0x5685df,_0x7f54('0x77'));})[_0x7f54('0x37')](function(_0x21f9d4){if(_0x21f9d4){logger[_0x7f54('0x32')]('The\x20Call\x20ID\x20is:',_0x21f9d4['id']);logger[_0x7f54('0x32')](_0x7f54('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7f54('0x66')](_0x7f54('0x8c'),_0x5758aa[_0x7f54('0x1b')]),_0x7f54('0x8d'),{'uri':_0x7f54('0x8e')+_0x1cda56['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x21f9d4['id']});}})['catch'](function(_0x42107e){logger[_0x7f54('0x30')]('[QUEUE]',JSON[_0x7f54('0xe')](_0x42107e));});};exports[_0x7f54('0x8f')]=function(_0x18fd82,_0x394c03,_0x335fca,_0x4ac588,_0x3ae50f,_0x49d0f2,_0x78b619){var _0x9677d6,_0x2590b2,_0xba1a36;_0x49d0f2[_0x7f54('0x7e')]=intUtil['stripTrailingSlash'](_0x49d0f2['host']);_0x49d0f2[_0x7f54('0x7f')]=intUtil[_0x7f54('0x80')](_0x49d0f2[_0x7f54('0x7f')]);if(_0x78b619&&_0x78b619['recordingFormat']&&_0x78b619[_0x7f54('0x90')]!=='none'){logger[_0x7f54('0x32')](_0x7f54('0x91'),_0x7f54('0x83'));_0x394c03['recordingURL']=_0x49d0f2['serverUrl']+_0x7f54('0x85')+_0x394c03[_0x7f54('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x394c03[_0x7f54('0x87')]);}var _0x4132a1=_0x49d0f2[_0x7f54('0x7e')]===_0x7f54('0x88')?'eu':_0x7f54('0x89');return getAccessToken(_0x49d0f2)['then'](function(_0x4f390){_0xba1a36=_0x4f390;return getUser(_0xba1a36,_0x4132a1,_0x49d0f2,_0x4ac588[_0x7f54('0x3a')]);})['then'](function(_0x18a3cd){_0x9677d6=_0x18a3cd;logger[_0x7f54('0x32')](_0x7f54('0x8a'),_0x9677d6['id']);return getEndUser(_0xba1a36,_0x4132a1,_0x49d0f2,_0x394c03[_0x7f54('0x92')],_0x394c03[_0x7f54('0x93')],_0x9677d6,_0x335fca);})[_0x7f54('0x37')](function(_0x40607f){_0x2590b2=_0x40607f;return getCall(_0xba1a36,_0x4132a1,_0x49d0f2,_0x9677d6,_0x2590b2,_0x335fca,_0x394c03,_0x7f54('0x94'));})[_0x7f54('0x37')](function(_0x5ccc41){if(_0x5ccc41){logger['info'](_0x7f54('0x95'),_0x5ccc41['id']);logger[_0x7f54('0x32')](_0x7f54('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7f54('0x66')](_0x7f54('0x8c'),_0x4ac588[_0x7f54('0x1b')]),'trigger:browser:url',{'uri':'https://crm.'+_0x49d0f2[_0x7f54('0x7e')]+_0x7f54('0x96')+_0x5ccc41['id']});}})['catch'](function(_0x5169d7){logger[_0x7f54('0x30')](_0x7f54('0x91'),JSON[_0x7f54('0xe')](_0x5169d7));});};exports[_0x7f54('0x97')]=function(_0x158187,_0x44a7fc,_0x352778,_0x47d02d,_0x54270a,_0x3d3ff6){var _0x11f42b,_0x365b8b,_0x267742;_0x3d3ff6['host']=intUtil[_0x7f54('0x80')](_0x3d3ff6[_0x7f54('0x7e')]);_0x3d3ff6['serverUrl']=intUtil['stripTrailingSlash'](_0x3d3ff6[_0x7f54('0x7f')]);if(_0x54270a&&_0x54270a[_0x7f54('0x81')]){logger['info']('['+_0x44a7fc[_0x7f54('0x6c')][_0x7f54('0x98')]()+']','Recording\x20is\x20enabled!');_0x44a7fc[_0x7f54('0x84')]=_0x3d3ff6['serverUrl']+'/api/voice/recordings/'+_0x44a7fc[_0x7f54('0x87')]+_0x7f54('0x86')+md5(_0x44a7fc[_0x7f54('0x87')]);}else{_0x44a7fc[_0x7f54('0x84')]='';}var _0x3f8065=_0x3d3ff6[_0x7f54('0x7e')]===_0x7f54('0x88')?'eu':_0x7f54('0x89');return getAccessToken(_0x3d3ff6)[_0x7f54('0x37')](function(_0x593eb7){_0x267742=_0x593eb7;return getUser(_0x267742,_0x3f8065,_0x3d3ff6);})[_0x7f54('0x37')](function(_0x1cf714){_0x11f42b=_0x1cf714;logger[_0x7f54('0x32')](_0x7f54('0x8a'),_0x11f42b['id']);return getEndUser(_0x267742,_0x3f8065,_0x3d3ff6,_0x44a7fc['calleridname'],_0x44a7fc[_0x7f54('0x99')],_0x11f42b,_0x352778);})[_0x7f54('0x37')](function(_0x14ed06){_0x365b8b=_0x14ed06;return getCall(_0x267742,_0x3f8065,_0x3d3ff6,_0x11f42b,_0x365b8b,_0x352778,_0x44a7fc,'Inbound');})[_0x7f54('0x37')](function(_0x41e4f1){if(_0x41e4f1){logger[_0x7f54('0x32')](_0x7f54('0x95'),_0x41e4f1['id']);}})[_0x7f54('0x2f')](function(_0x544280){logger[_0x7f54('0x30')]('['+_0x44a7fc[_0x7f54('0x6c')][_0x7f54('0x98')]()+']',JSON[_0x7f54('0xe')](_0x544280));});}; \ 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 4d1673c..e3308bc 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 _0x35a0=['trigger','data2','Script','data3','render','exec','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger'];(function(_0x4008de,_0x15f2e9){var _0x596738=function(_0x2d4060){while(--_0x2d4060){_0x4008de['push'](_0x4008de['shift']());}};_0x596738(++_0x15f2e9);}(_0x35a0,0x76));var _0x035a=function(_0x4651ae,_0x3d2bc0){_0x4651ae=_0x4651ae-0x0;var _0x29a97c=_0x35a0[_0x4651ae];return _0x29a97c;};'use strict';var util=require('util');var sh=require(_0x035a('0x0'));var Mustache=require(_0x035a('0x1'));var logger=require(_0x035a('0x2'))(_0x035a('0x3'));exports['exec']=function(_0x2fcb6d,_0x5baf7c){var _0x15f69c=_0x2fcb6d[_0x035a('0x4')]?_0x2fcb6d[_0x035a('0x4')]:_0x035a('0x5');var _0x36c841=_0x2fcb6d[_0x035a('0x6')]?Mustache[_0x035a('0x7')](_0x2fcb6d[_0x035a('0x6')],_0x5baf7c):_0x5baf7c;sh[_0x035a('0x8')](_0x36c841,function(_0x4ca235,_0xfd60dd,_0x56b57a){if(_0x4ca235!==0x0){logger['error'](util[_0x035a('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x15f69c,_0x36c841,_0x4ca235,_0x56b57a));}else{logger['info'](util[_0x035a('0x9')](_0x035a('0xa'),_0x15f69c,_0x36c841,_0xfd60dd));}});}; \ No newline at end of file +var _0xb6f5=['render','exec','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','data2','Script','data3'];(function(_0x556046,_0x3c77a8){var _0x409c21=function(_0x10cc35){while(--_0x10cc35){_0x556046['push'](_0x556046['shift']());}};_0x409c21(++_0x3c77a8);}(_0xb6f5,0xa1));var _0x5b6f=function(_0x48d3f8,_0x502a1b){_0x48d3f8=_0x48d3f8-0x0;var _0x3f6498=_0xb6f5[_0x48d3f8];return _0x3f6498;};'use strict';var util=require(_0x5b6f('0x0'));var sh=require(_0x5b6f('0x1'));var Mustache=require(_0x5b6f('0x2'));var logger=require('../../../../config/logger')(_0x5b6f('0x3'));exports['exec']=function(_0x41c5b8,_0x5b0014){var _0xb95d98=_0x41c5b8[_0x5b6f('0x4')]?_0x41c5b8['data2']:_0x5b6f('0x5');var _0x7819ce=_0x41c5b8[_0x5b6f('0x6')]?Mustache[_0x5b6f('0x7')](_0x41c5b8[_0x5b6f('0x6')],_0x5b0014):_0x5b0014;sh[_0x5b6f('0x8')](_0x7819ce,function(_0x494112,_0x3d06d5,_0x45ac46){if(_0x494112!==0x0){logger[_0x5b6f('0x9')](util['format'](_0x5b6f('0xa'),_0xb95d98,_0x7819ce,_0x494112,_0x45ac46));}else{logger[_0x5b6f('0xb')](util[_0x5b6f('0xc')](_0x5b6f('0xd'),_0xb95d98,_0x7819ce,_0x3d06d5));}});}; \ 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 b07afa9..d8d4876 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 _0xca35=['data2','data5','headers','parse','render','data6','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','message','request-promise','util','mustache','../../../../config/logger','exec','data1','toUpperCase'];(function(_0x39f10c,_0x4d5802){var _0x2c4194=function(_0x5401a2){while(--_0x5401a2){_0x39f10c['push'](_0x39f10c['shift']());}};_0x2c4194(++_0x4d5802);}(_0xca35,0x199));var _0x5ca3=function(_0x4cd14a,_0x3c08b4){_0x4cd14a=_0x4cd14a-0x0;var _0x59ac6a=_0xca35[_0x4cd14a];return _0x59ac6a;};'use strict';var rp=require(_0x5ca3('0x0'));var util=require(_0x5ca3('0x1'));var _=require('lodash');var Mustache=require(_0x5ca3('0x2'));var logger=require(_0x5ca3('0x3'))('trigger');exports[_0x5ca3('0x4')]=function(_0x4302ab,_0xd95380){var _0x588df6,_0x40b830;var _0x40e805={'method':_0x4302ab[_0x5ca3('0x5')][_0x5ca3('0x6')](),'uri':Mustache['render'](_0x4302ab[_0x5ca3('0x7')],_0xd95380),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4302ab[_0x5ca3('0x8')])==='number'&&parseInt(_0x4302ab[_0x5ca3('0x8')])>=0x1&&parseInt(_0x4302ab['data5'])<=0xa?parseInt(_0x4302ab[_0x5ca3('0x8')])*0x3e8:0x5*0x3e8};try{_0x40e805[_0x5ca3('0x9')]=_0x4302ab['data6']?JSON[_0x5ca3('0xa')](Mustache[_0x5ca3('0xb')](_0x4302ab[_0x5ca3('0xc')],_0xd95380)):{};}catch(_0x126beb){logger[_0x5ca3('0xd')](_0x126beb[_0x5ca3('0xe')]);}switch(_0x4302ab[_0x5ca3('0x5')][_0x5ca3('0x6')]()){case _0x5ca3('0xf'):case _0x5ca3('0x10'):_0x588df6=null;_0x40e805['qs']=_0xd95380;break;case _0x5ca3('0x11'):case _0x5ca3('0x12'):if(_0x4302ab[_0x5ca3('0x13')]){try{_0x588df6=JSON[_0x5ca3('0xa')](Mustache[_0x5ca3('0xb')](_0x4302ab[_0x5ca3('0x13')],_0xd95380));_0x40e805[_0x5ca3('0x14')]=_0x588df6;}catch(_0x356f2b){logger[_0x5ca3('0xd')](_0x356f2b[_0x5ca3('0xe')]);logger[_0x5ca3('0xd')](_0x5ca3('0x15'));}}else{_0x588df6=_0xd95380;_0x40e805['body']=_0x588df6;}break;}logger[_0x5ca3('0x16')](util[_0x5ca3('0x17')](_0x5ca3('0x18'),_0x4302ab[_0x5ca3('0x5')],_0x4302ab['data2'],JSON[_0x5ca3('0x19')](_0x40e805)));rp(_0x40e805)[_0x5ca3('0x1a')](function(_0x572a21){_0x588df6=!_['isNil'](_0x588df6)?_0x5ca3('0x1b')+_0x588df6:'';_0x40b830=typeof _0x572a21[_0x5ca3('0x14')]===_0x5ca3('0x1c')?JSON[_0x5ca3('0x19')](_0x572a21[_0x5ca3('0x14')]):_0x572a21['body'];logger[_0x5ca3('0x16')](util[_0x5ca3('0x17')](_0x5ca3('0x1d'),_0x4302ab['data1'],_0x4302ab[_0x5ca3('0x7')],_0x572a21['statusCode'],_0x40b830));})[_0x5ca3('0x1e')](function(_0x3b6177){logger[_0x5ca3('0xd')](util[_0x5ca3('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4302ab[_0x5ca3('0x5')],_0x4302ab[_0x5ca3('0x7')],_0x3b6177['statusCode'],_0x3b6177['name'],_0x3b6177[_0x5ca3('0x1f')]));});}; \ No newline at end of file +var _0xfa5a=['number','data6','error','stack','GET','DELETE','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil',',\x20request\x20body:\x20','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5'];(function(_0x329808,_0x343255){var _0x1bbad0=function(_0x458c5b){while(--_0x458c5b){_0x329808['push'](_0x329808['shift']());}};_0x1bbad0(++_0x343255);}(_0xfa5a,0x175));var _0xafa5=function(_0x2c12b5,_0x28f811){_0x2c12b5=_0x2c12b5-0x0;var _0x1e05c3=_0xfa5a[_0x2c12b5];return _0x1e05c3;};'use strict';var rp=require(_0xafa5('0x0'));var util=require(_0xafa5('0x1'));var _=require(_0xafa5('0x2'));var Mustache=require(_0xafa5('0x3'));var logger=require(_0xafa5('0x4'))('trigger');exports[_0xafa5('0x5')]=function(_0x2d8639,_0x4738c3){var _0x4d2204,_0xe4fe78;var _0x338d0b={'method':_0x2d8639[_0xafa5('0x6')][_0xafa5('0x7')](),'uri':Mustache[_0xafa5('0x8')](_0x2d8639[_0xafa5('0x9')],_0x4738c3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2d8639[_0xafa5('0xa')])===_0xafa5('0xb')&&parseInt(_0x2d8639[_0xafa5('0xa')])>=0x1&&parseInt(_0x2d8639[_0xafa5('0xa')])<=0xa?parseInt(_0x2d8639[_0xafa5('0xa')])*0x3e8:0x5*0x3e8};try{_0x338d0b['headers']=_0x2d8639[_0xafa5('0xc')]?JSON['parse'](Mustache[_0xafa5('0x8')](_0x2d8639[_0xafa5('0xc')],_0x4738c3)):{};}catch(_0x1a4d0c){logger[_0xafa5('0xd')](_0x1a4d0c[_0xafa5('0xe')]);}switch(_0x2d8639[_0xafa5('0x6')]['toUpperCase']()){case _0xafa5('0xf'):case _0xafa5('0x10'):_0x4d2204=null;_0x338d0b['qs']=_0x4738c3;break;case'POST':case _0xafa5('0x11'):if(_0x2d8639['data7']){try{_0x4d2204=JSON[_0xafa5('0x12')](Mustache[_0xafa5('0x8')](_0x2d8639[_0xafa5('0x13')],_0x4738c3));_0x338d0b[_0xafa5('0x14')]=_0x4d2204;}catch(_0x3c58fe){logger['error'](_0x3c58fe[_0xafa5('0xe')]);logger[_0xafa5('0xd')](_0xafa5('0x15'));}}else{_0x4d2204=_0x4738c3;_0x338d0b['body']=_0x4d2204;}break;}logger['info'](util[_0xafa5('0x16')](_0xafa5('0x17'),_0x2d8639[_0xafa5('0x6')],_0x2d8639[_0xafa5('0x9')],JSON['stringify'](_0x338d0b)));rp(_0x338d0b)['then'](function(_0x4a976b){_0x4d2204=!_[_0xafa5('0x18')](_0x4d2204)?_0xafa5('0x19')+_0x4d2204:'';_0xe4fe78=typeof _0x4a976b[_0xafa5('0x14')]==='object'?JSON[_0xafa5('0x1a')](_0x4a976b[_0xafa5('0x14')]):_0x4a976b[_0xafa5('0x14')];logger['info'](util['format'](_0xafa5('0x1b'),_0x2d8639[_0xafa5('0x6')],_0x2d8639[_0xafa5('0x9')],_0x4a976b[_0xafa5('0x1c')],_0xe4fe78));})['catch'](function(_0x340c76){logger[_0xafa5('0xd')](util[_0xafa5('0x16')](_0xafa5('0x1d'),_0x2d8639['data1'],_0x2d8639[_0xafa5('0x9')],_0x340c76[_0xafa5('0x1c')],_0x340c76[_0xafa5('0x1e')],_0x340c76[_0xafa5('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 93cab81..9816481 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 _0x4e5e=['../../config/logger','routing','client','http','Request','request','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x4e5e,0x14e));var _0xe4e5=function(_0x13791a,_0xc4218e){_0x13791a=_0x13791a-0x0;var _0x116430=_0x4e5e[_0x13791a];return _0x116430;};'use strict';var jayson=require(_0xe4e5('0x0'));var BPromise=require(_0xe4e5('0x1'));var logger=require(_0xe4e5('0x2'))(_0xe4e5('0x3'));var client=jayson[_0xe4e5('0x4')][_0xe4e5('0x5')]({'port':0x2329});client[_0xe4e5('0x6')]=function(_0x122810,_0x53d4f8){return new BPromise(function(_0x2d4551,_0x3807d2){return client[_0xe4e5('0x7')](_0x122810,_0x53d4f8)['then'](function(_0x214fdb){logger['debug'](_0xe4e5('0x8'),_0xe4e5('0x3'),_0x122810,_0x53d4f8,_0x214fdb);if(_0x214fdb[_0xe4e5('0x9')]){logger[_0xe4e5('0x9')]('rpc',_0xe4e5('0x3'),_0x122810,_0x214fdb[_0xe4e5('0x9')][_0xe4e5('0xa')],_0x53d4f8);return _0x3807d2(_0x214fdb[_0xe4e5('0x9')]['message']);}else{return _0x2d4551(_0x214fdb[_0xe4e5('0xb')]);}})[_0xe4e5('0xc')](function(_0x275692){logger[_0xe4e5('0x9')]('rpc',_0xe4e5('0x3'),_0x122810,_0x275692,_0x53d4f8);return _0x3807d2(_0x275692);});});};module[_0xe4e5('0xd')]=client; \ No newline at end of file +var _0x0a15=['catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','rpc','error','message','result'];(function(_0x47b4d6,_0x13b0b3){var _0x317a04=function(_0x15549e){while(--_0x15549e){_0x47b4d6['push'](_0x47b4d6['shift']());}};_0x317a04(++_0x13b0b3);}(_0x0a15,0x160));var _0x50a1=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x0a15[_0x2db12b];return _0x20990b;};'use strict';var jayson=require(_0x50a1('0x0'));var BPromise=require(_0x50a1('0x1'));var logger=require(_0x50a1('0x2'))(_0x50a1('0x3'));var client=jayson[_0x50a1('0x4')][_0x50a1('0x5')]({'port':0x2329});client[_0x50a1('0x6')]=function(_0x8e02c9,_0x35d1f5){return new BPromise(function(_0x65978b,_0x42a77f){return client[_0x50a1('0x7')](_0x8e02c9,_0x35d1f5)['then'](function(_0x5a3c65){logger['debug'](_0x50a1('0x8'),'routing',_0x8e02c9,_0x35d1f5,_0x5a3c65);if(_0x5a3c65[_0x50a1('0x9')]){logger['error']('rpc',_0x50a1('0x3'),_0x8e02c9,_0x5a3c65['error'][_0x50a1('0xa')],_0x35d1f5);return _0x42a77f(_0x5a3c65[_0x50a1('0x9')][_0x50a1('0xa')]);}else{return _0x65978b(_0x5a3c65[_0x50a1('0xb')]);}})[_0x50a1('0xc')](function(_0x560d7c){logger[_0x50a1('0x9')]('rpc','routing',_0x8e02c9,_0x560d7c,_0x35d1f5);return _0x42a77f(_0x560d7c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2b50ecc..e851e42 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 _0x7ac0=['catch','error','Email\x20service\x20initialization','./lib/email','../../config/logger','email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7ac0,0x145));var _0x07ac=function(_0x51fa75,_0x5171ca){_0x51fa75=_0x51fa75-0x0;var _0x648a6e=_0x7ac0[_0x51fa75];return _0x648a6e;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x07ac('0x0'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x07ac('0x1'))(_0x07ac('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x07ac('0x3')]()[_0x07ac('0x4')](mailAccount[_0x07ac('0x5')]())[_0x07ac('0x4')](realtime['initMailAccounts']())['then'](function(){email[_0x07ac('0x6')](realtime[_0x07ac('0x7')]);return realtime;});}function main(){return server[_0x07ac('0x8')](realtime,email)[_0x07ac('0x4')](function(){return initRealtime();})['then'](function(){return setting[_0x07ac('0x9')]();})[_0x07ac('0x4')](function(_0xd97bf2){return setInterval(initRealtime,_0xd97bf2[_0x07ac('0xa')]*0x3e8);})[_0x07ac('0xb')](function(_0x251089){logger[_0x07ac('0xc')](_0x07ac('0xd'),_0x251089);});}main(); \ No newline at end of file +var _0x4d76=['./lib/email','./rpc/mailAccount','email','resolve','getMailAccounts','then','initMailAccounts','mailAccounts','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime'];(function(_0x493642,_0x12c75d){var _0x1f2423=function(_0xa4b154){while(--_0xa4b154){_0x493642['push'](_0x493642['shift']());}};_0x1f2423(++_0x12c75d);}(_0x4d76,0xc1));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var server=require(_0x64d7('0x0'));var Realtime=require(_0x64d7('0x1'));var EmailChannel=require(_0x64d7('0x2'));var mailAccount=require(_0x64d7('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x64d7('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x64d7('0x5')]()['then'](mailAccount[_0x64d7('0x6')]())[_0x64d7('0x7')](realtime[_0x64d7('0x8')]())[_0x64d7('0x7')](function(){email['refresh'](realtime[_0x64d7('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x64d7('0x7')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x19dcb2){return setInterval(initRealtime,_0x19dcb2[_0x64d7('0xa')]*0x3e8);})[_0x64d7('0xb')](function(_0x2dd5ee){logger['error'](_0x64d7('0xc'),_0x2dd5ee);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e40c311..5aadbbb 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 _0xe9fd=['service','provider','imapAccounts','hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','info','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','isNil','md5','mailAccount:update','refresh','active'];(function(_0x5aa1c2,_0x1adfb1){var _0x44a665=function(_0x3910ef){while(--_0x3910ef){_0x5aa1c2['push'](_0x5aa1c2['shift']());}};_0x44a665(++_0x1adfb1);}(_0xe9fd,0x176));var _0xde9f=function(_0x54d87e,_0x25dde1){_0x54d87e=_0x54d87e-0x0;var _0x2538c4=_0xe9fd[_0x54d87e];return _0x2538c4;};'use strict';var _=require(_0xde9f('0x0'));var moment=require(_0xde9f('0x1'));var BPromise=require(_0xde9f('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xde9f('0x3'));var logger=require(_0xde9f('0x4'))('email');config[_0xde9f('0x5')]=_[_0xde9f('0x6')](config[_0xde9f('0x5')],{'host':_0xde9f('0x7'),'port':0x18eb});var io=require(_0xde9f('0x8'))(new Redis(config[_0xde9f('0x5')]));var EmailImap=require(_0xde9f('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x258c71){logger['info'](_0xde9f('0xa'));this[_0xde9f('0xb')]=_0x258c71['mailAccounts'];this['imapAccounts']={};this[_0xde9f('0xc')]=new EmailSmtp();}EmailChannel[_0xde9f('0xd')][_0xde9f('0xe')]=function(_0x1fa3e5){var _0x441e8f=this[_0xde9f('0xb')][_0x1fa3e5];var _0x5d68db={'id':_0x441e8f['id'],'name':_0x441e8f[_0xde9f('0xf')],'key':_0x441e8f[_0xde9f('0x10')],'active':_0x441e8f['active'],'Imap':{'status':_0x441e8f[_0xde9f('0x11')][_0xde9f('0x12')],'messageStatus':_0x441e8f['Imap'][_0xde9f('0x13')],'total':_0x441e8f[_0xde9f('0x11')]['total']}};if(_[_0xde9f('0x14')](md5Accounts[_0x1fa3e5])){md5Accounts[_0x1fa3e5]={};}var _0x3ee018=md5(JSON['stringify'](_0x5d68db));if(md5Accounts[_0x1fa3e5][_0xde9f('0x15')]!==_0x3ee018){md5Accounts[_0x1fa3e5][_0xde9f('0x15')]=_0x3ee018;io['emit'](_0xde9f('0x16'),_0x5d68db);}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x17')]=function(_0x378a27){for(var _0x2d8224 in _0x378a27){if(_0x378a27['hasOwnProperty'](_0x2d8224)){if(_0x378a27[_0x2d8224][_0xde9f('0x11')]&&_0x378a27[_0x2d8224][_0xde9f('0x18')]){var _0x21d9d5=_0x378a27[_0x2d8224][_0xde9f('0x11')];if(!_0x21d9d5[_0xde9f('0x19')]&&_0x378a27[_0x2d8224][_0xde9f('0x1a')]!=='custom')_0x21d9d5['service']=_0x378a27[_0x2d8224][_0xde9f('0x1a')];if(!this[_0xde9f('0x1b')][_0xde9f('0x1c')](_0x21d9d5['id'])){this[_0xde9f('0x1b')][_0x21d9d5['id']]=new EmailImap(_0x21d9d5,_0x378a27[_0x2d8224][_0xde9f('0x1d')]);this['imapAccounts'][_0x21d9d5['id']]['on'](_0xde9f('0x1e'),this[_0xde9f('0x1f')][_0xde9f('0x20')](this,_0x2d8224));this[_0xde9f('0x1b')][_0x21d9d5['id']]['on'](_0xde9f('0x1d'),this[_0xde9f('0x21')]['bind'](this,_0x2d8224));this['imapAccounts'][_0x21d9d5['id']]['on'](_0xde9f('0x22'),this[_0xde9f('0x23')][_0xde9f('0x20')](this,_0x2d8224));this[_0xde9f('0x1b')][_0x21d9d5['id']]['on']('error',this[_0xde9f('0x24')]['bind'](this,_0x2d8224));}}else{if(_[_0xde9f('0x14')](this[_0xde9f('0xb')][_0x2d8224][_0xde9f('0x11')])){this['mailAccounts'][_0x2d8224][_0xde9f('0x11')]={};}this['mailAccounts'][_0x2d8224][_0xde9f('0x11')][_0xde9f('0x12')]=_0xde9f('0x25');this[_0xde9f('0xb')][_0x2d8224][_0xde9f('0x11')][_0xde9f('0x13')]='';this[_0xde9f('0xe')](_0x2d8224);}}}};EmailChannel[_0xde9f('0xd')]['handleImapBox']=function(_0x1b5dba,_0x4d0265){if(this['mailAccounts'][_0x1b5dba]){this[_0xde9f('0xb')][_0x1b5dba]['Imap'][_0xde9f('0x12')]=_0xde9f('0x26');this[_0xde9f('0xb')][_0x1b5dba][_0xde9f('0x11')][_0xde9f('0x13')]=_0x4d0265[_0xde9f('0xf')];if(_0x4d0265['messages']){this[_0xde9f('0xb')][_0x1b5dba][_0xde9f('0x11')]['total']=_0x4d0265[_0xde9f('0x27')][_0xde9f('0x28')];}return this['emit'](_0x1b5dba);}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x21')]=function(_0x11fe3c,_0x467da7){logger['info'](_0xde9f('0x29'),_0x467da7[_0xde9f('0x2a')],_0x467da7['lastName'],_0x467da7[_0xde9f('0x2b')],_0x11fe3c);if(this[_0xde9f('0xb')][_0x11fe3c]){return mailAccount['notify'](_0x11fe3c,_0x467da7)[_0xde9f('0x2c')](function(_0x1fc2ab){if(_0x1fc2ab){logger[_0xde9f('0x2d')]('Mail\x20accepted\x20from\x20routing');}})[_0xde9f('0x2e')](function(_0x52395d){logger[_0xde9f('0x2f')](_0xde9f('0x30'),JSON[_0xde9f('0x31')](_0x52395d));});}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x23')]=function(_0xb086d8){if(this[_0xde9f('0xb')][_0xb086d8]&&this[_0xde9f('0xb')][_0xb086d8]['Imap']){if(this[_0xde9f('0x1b')][this[_0xde9f('0xb')][_0xb086d8][_0xde9f('0x11')]['id']]){delete this['imapAccounts'][this[_0xde9f('0xb')][_0xb086d8][_0xde9f('0x11')]['id']];}this[_0xde9f('0xb')][_0xb086d8][_0xde9f('0x11')]['lastSync']=moment();this[_0xde9f('0xe')](_0xb086d8);}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x24')]=function(_0x59dd96,_0x37a7f3){if(this[_0xde9f('0xb')][_0x59dd96]){this[_0xde9f('0xb')][_0x59dd96][_0xde9f('0x11')]['status']='error';this[_0xde9f('0xb')][_0x59dd96][_0xde9f('0x11')][_0xde9f('0x13')]=_0x37a7f3;return this['emit'](_0x59dd96);}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x32')]=function(_0x26c0a3,_0x4a9495){return this[_0xde9f('0xc')][_0xde9f('0x33')](_0x26c0a3,_0x4a9495);};EmailChannel[_0xde9f('0xd')][_0xde9f('0x34')]=function(_0x2bd4d5){var _0x391ee1=this;if(this[_0xde9f('0xb')][_0x2bd4d5['id']]){if(_[_0xde9f('0x14')](this[_0xde9f('0xb')][_0x2bd4d5['id']][_0xde9f('0x35')])){this['mailAccounts'][_0x2bd4d5['id']][_0xde9f('0x35')]={};}this[_0xde9f('0xb')][_0x2bd4d5['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x2445b0,_0x319d21){return _0x391ee1[_0xde9f('0xc')][_0xde9f('0x36')](_0x2bd4d5)[_0xde9f('0x2c')](function(_0x3c082c){_0x391ee1[_0xde9f('0xb')][_0x2bd4d5['id']][_0xde9f('0x35')]['status']=_0xde9f('0x37');_0x391ee1['mailAccounts'][_0x2bd4d5['id']][_0xde9f('0x35')][_0xde9f('0x13')]='';_0x391ee1[_0xde9f('0xe')](_0x2bd4d5['id']);_0x2445b0(_0x3c082c);})[_0xde9f('0x2e')](function(_0x545faa){_0x391ee1[_0xde9f('0xb')][_0x2bd4d5['id']][_0xde9f('0x35')][_0xde9f('0x12')]=_0xde9f('0x2f');_0x391ee1['mailAccounts'][_0x2bd4d5['id']]['Smtp'][_0xde9f('0x13')]=_0x545faa;_0x391ee1['emit'](_0x2bd4d5['id']);_0x319d21(_0x545faa);});});}return this[_0xde9f('0xc')][_0xde9f('0x36')](_0x2bd4d5);};module[_0xde9f('0x38')]=EmailChannel; \ No newline at end of file +var _0xdff6=['sendMail','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','handleImapBox','bind','end','error','handleImapError','isNil','disabled','messages','total','handleImapEmail','firstName','lastName','notify','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0xdff6,0xa9));var _0x6dff=function(_0x5a769c,_0x5f16e5){_0x5a769c=_0x5a769c-0x0;var _0xe27e80=_0xdff6[_0x5a769c];return _0xe27e80;};'use strict';var _=require(_0x6dff('0x0'));var moment=require(_0x6dff('0x1'));var BPromise=require(_0x6dff('0x2'));var md5=require(_0x6dff('0x3'));var Redis=require(_0x6dff('0x4'));var config=require(_0x6dff('0x5'));var logger=require('../../../config/logger')(_0x6dff('0x6'));config[_0x6dff('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6dff('0x8'))(new Redis(config[_0x6dff('0x7')]));var EmailImap=require(_0x6dff('0x9'));var EmailSmtp=require(_0x6dff('0xa'));var mailAccount=require(_0x6dff('0xb'));var md5Accounts={};function EmailChannel(_0x24a7ad){logger['info']('start\x20email\x20channel');this[_0x6dff('0xc')]=_0x24a7ad[_0x6dff('0xc')];this[_0x6dff('0xd')]={};this[_0x6dff('0xe')]=new EmailSmtp();}EmailChannel[_0x6dff('0xf')][_0x6dff('0x10')]=function(_0x18caf1){var _0x3a4f3e=this[_0x6dff('0xc')][_0x18caf1];var _0x4afcfe={'id':_0x3a4f3e['id'],'name':_0x3a4f3e[_0x6dff('0x11')],'key':_0x3a4f3e['key'],'active':_0x3a4f3e[_0x6dff('0x12')],'Imap':{'status':_0x3a4f3e[_0x6dff('0x13')][_0x6dff('0x14')],'messageStatus':_0x3a4f3e[_0x6dff('0x13')][_0x6dff('0x15')],'total':_0x3a4f3e[_0x6dff('0x13')]['total']}};if(_['isNil'](md5Accounts[_0x18caf1])){md5Accounts[_0x18caf1]={};}var _0xd27204=md5(JSON[_0x6dff('0x16')](_0x4afcfe));if(md5Accounts[_0x18caf1][_0x6dff('0x3')]!==_0xd27204){md5Accounts[_0x18caf1]['md5']=_0xd27204;io[_0x6dff('0x10')](_0x6dff('0x17'),_0x4afcfe);}};EmailChannel[_0x6dff('0xf')][_0x6dff('0x18')]=function(_0x489d73){for(var _0x4e5469 in _0x489d73){if(_0x489d73[_0x6dff('0x19')](_0x4e5469)){if(_0x489d73[_0x4e5469][_0x6dff('0x13')]&&_0x489d73[_0x4e5469][_0x6dff('0x12')]){var _0x49e52f=_0x489d73[_0x4e5469][_0x6dff('0x13')];if(!_0x49e52f[_0x6dff('0x1a')]&&_0x489d73[_0x4e5469][_0x6dff('0x1b')]!==_0x6dff('0x1c'))_0x49e52f[_0x6dff('0x1a')]=_0x489d73[_0x4e5469][_0x6dff('0x1b')];if(!this['imapAccounts'][_0x6dff('0x19')](_0x49e52f['id'])){this[_0x6dff('0xd')][_0x49e52f['id']]=new EmailImap(_0x49e52f,_0x489d73[_0x4e5469][_0x6dff('0x6')]);this[_0x6dff('0xd')][_0x49e52f['id']]['on']('box',this[_0x6dff('0x1d')][_0x6dff('0x1e')](this,_0x4e5469));this[_0x6dff('0xd')][_0x49e52f['id']]['on'](_0x6dff('0x6'),this['handleImapEmail'][_0x6dff('0x1e')](this,_0x4e5469));this[_0x6dff('0xd')][_0x49e52f['id']]['on'](_0x6dff('0x1f'),this['handleImapEnd'][_0x6dff('0x1e')](this,_0x4e5469));this[_0x6dff('0xd')][_0x49e52f['id']]['on'](_0x6dff('0x20'),this[_0x6dff('0x21')][_0x6dff('0x1e')](this,_0x4e5469));}}else{if(_[_0x6dff('0x22')](this[_0x6dff('0xc')][_0x4e5469][_0x6dff('0x13')])){this[_0x6dff('0xc')][_0x4e5469][_0x6dff('0x13')]={};}this[_0x6dff('0xc')][_0x4e5469][_0x6dff('0x13')][_0x6dff('0x14')]=_0x6dff('0x23');this[_0x6dff('0xc')][_0x4e5469]['Imap']['messageStatus']='';this[_0x6dff('0x10')](_0x4e5469);}}}};EmailChannel[_0x6dff('0xf')][_0x6dff('0x1d')]=function(_0x128a43,_0x42d592){if(this[_0x6dff('0xc')][_0x128a43]){this[_0x6dff('0xc')][_0x128a43][_0x6dff('0x13')][_0x6dff('0x14')]='connected';this['mailAccounts'][_0x128a43]['Imap'][_0x6dff('0x15')]=_0x42d592[_0x6dff('0x11')];if(_0x42d592[_0x6dff('0x24')]){this['mailAccounts'][_0x128a43]['Imap'][_0x6dff('0x25')]=_0x42d592[_0x6dff('0x24')][_0x6dff('0x25')];}return this[_0x6dff('0x10')](_0x128a43);}};EmailChannel[_0x6dff('0xf')][_0x6dff('0x26')]=function(_0x42e268,_0x32f8ce){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x32f8ce[_0x6dff('0x27')],_0x32f8ce[_0x6dff('0x28')],_0x32f8ce['from'],_0x42e268);if(this['mailAccounts'][_0x42e268]){return mailAccount[_0x6dff('0x29')](_0x42e268,_0x32f8ce)['then'](function(_0x65f79a){if(_0x65f79a){logger[_0x6dff('0x2a')](_0x6dff('0x2b'));}})[_0x6dff('0x2c')](function(_0x5cce57){logger[_0x6dff('0x20')](_0x6dff('0x2d'),JSON[_0x6dff('0x16')](_0x5cce57));});}};EmailChannel[_0x6dff('0xf')]['handleImapEnd']=function(_0x3ad2f4){if(this[_0x6dff('0xc')][_0x3ad2f4]&&this['mailAccounts'][_0x3ad2f4][_0x6dff('0x13')]){if(this[_0x6dff('0xd')][this[_0x6dff('0xc')][_0x3ad2f4]['Imap']['id']]){delete this[_0x6dff('0xd')][this['mailAccounts'][_0x3ad2f4]['Imap']['id']];}this[_0x6dff('0xc')][_0x3ad2f4]['Imap'][_0x6dff('0x2e')]=moment();this[_0x6dff('0x10')](_0x3ad2f4);}};EmailChannel['prototype']['handleImapError']=function(_0x31ced7,_0x1eedb2){if(this[_0x6dff('0xc')][_0x31ced7]){this[_0x6dff('0xc')][_0x31ced7][_0x6dff('0x13')][_0x6dff('0x14')]=_0x6dff('0x20');this[_0x6dff('0xc')][_0x31ced7][_0x6dff('0x13')][_0x6dff('0x15')]=_0x1eedb2;return this[_0x6dff('0x10')](_0x31ced7);}};EmailChannel['prototype'][_0x6dff('0x2f')]=function(_0xc7a4c6,_0x595111){return this[_0x6dff('0xe')]['send'](_0xc7a4c6,_0x595111);};EmailChannel[_0x6dff('0xf')][_0x6dff('0x30')]=function(_0x119f33){var _0x3d3f58=this;if(this[_0x6dff('0xc')][_0x119f33['id']]){if(_[_0x6dff('0x22')](this[_0x6dff('0xc')][_0x119f33['id']][_0x6dff('0x31')])){this[_0x6dff('0xc')][_0x119f33['id']][_0x6dff('0x31')]={};}this[_0x6dff('0xc')][_0x119f33['id']]['Smtp'][_0x6dff('0x2e')]=moment();return new BPromise(function(_0x77d20b,_0x3a1bd4){return _0x3d3f58[_0x6dff('0xe')][_0x6dff('0x32')](_0x119f33)[_0x6dff('0x33')](function(_0x3183bb){_0x3d3f58[_0x6dff('0xc')][_0x119f33['id']][_0x6dff('0x31')][_0x6dff('0x14')]=_0x6dff('0x34');_0x3d3f58[_0x6dff('0xc')][_0x119f33['id']]['Smtp'][_0x6dff('0x15')]='';_0x3d3f58[_0x6dff('0x10')](_0x119f33['id']);_0x77d20b(_0x3183bb);})[_0x6dff('0x2c')](function(_0x224238){_0x3d3f58[_0x6dff('0xc')][_0x119f33['id']][_0x6dff('0x31')][_0x6dff('0x14')]='error';_0x3d3f58[_0x6dff('0xc')][_0x119f33['id']][_0x6dff('0x31')][_0x6dff('0x15')]=_0x224238;_0x3d3f58[_0x6dff('0x10')](_0x119f33['id']);_0x3a1bd4(_0x224238);});});}return this[_0x6dff('0xe')][_0x6dff('0x32')](_0x119f33);};module[_0x6dff('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index acc32d8..ccf2f77 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 _0xe0d5=['util','imap','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','handleReady','bind','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','CloudProvider','data5','password','anonymous@xcally.com','host','tls','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','handleFetchError','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchEnd','closeBox','stringify','textCode','hasOwnProperty','exports','lodash'];(function(_0x2788b2,_0x4e735c){var _0xbca93f=function(_0x4dccf8){while(--_0x4dccf8){_0x2788b2['push'](_0x2788b2['shift']());}};_0xbca93f(++_0x4e735c);}(_0xe0d5,0xb3));var _0x5e0d=function(_0x23d3dd,_0x3be1be){_0x23d3dd=_0x23d3dd-0x0;var _0x872358=_0xe0d5[_0x23d3dd];return _0x872358;};'use strict';var _=require(_0x5e0d('0x0'));var util=require(_0x5e0d('0x1'));var Imap=require(_0x5e0d('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x5e0d('0x3'))[_0x5e0d('0x4')];var EventEmitter=require(_0x5e0d('0x5'))[_0x5e0d('0x6')];var utils=require(_0x5e0d('0x7'));var logger=require(_0x5e0d('0x8'))(_0x5e0d('0x9'));function EmailImap(_0x33e044,_0x4cc05c){this['mailbox']=_0x33e044[_0x5e0d('0xa')];this[_0x5e0d('0xb')]=this[_0x5e0d('0xc')](_0x33e044,_0x4cc05c);this[_0x5e0d('0x2')]=new Imap(this[_0x5e0d('0xb')]);this[_0x5e0d('0x2')][_0x5e0d('0xd')]('ready',this[_0x5e0d('0xe')][_0x5e0d('0xf')](this));this[_0x5e0d('0x2')][_0x5e0d('0xd')]('end',this[_0x5e0d('0x10')][_0x5e0d('0xf')](this));this[_0x5e0d('0x2')]['on'](_0x5e0d('0x11'),this[_0x5e0d('0x12')][_0x5e0d('0xf')](this));this[_0x5e0d('0x2')][_0x5e0d('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x5e0d('0x14')][_0x5e0d('0xc')]=function(_0x6db885,_0x27f68b){var _0x3d1d14={'connTimeout':_0x6db885['connTimeout']?_0x6db885[_0x5e0d('0x15')]*0x3e8:0x2710,'authTimeout':_0x6db885['authTimeout']?_0x6db885[_0x5e0d('0x16')]*0x3e8:0x1388};if(_0x6db885['service']){_0x3d1d14[_0x5e0d('0x17')]=_0x6db885[_0x5e0d('0x17')];if(_0x6db885[_0x5e0d('0x18')]){_0x3d1d14[_0x5e0d('0x19')]=utils['generateXOAuth2Token'](_0x6db885[_0x5e0d('0x1a')][_0x5e0d('0x1b')],_0x6db885['user']);}else{_0x3d1d14[_0x5e0d('0x1c')]=_0x6db885[_0x5e0d('0x1c')];}}else{if(_0x6db885['authentication']){_0x3d1d14[_0x5e0d('0x17')]=_0x6db885[_0x5e0d('0x17')];_0x3d1d14[_0x5e0d('0x1c')]=_0x6db885['password'];}}_0x3d1d14[_0x5e0d('0x9')]=_0x27f68b||_0x6db885[_0x5e0d('0x17')]||_0x5e0d('0x1d');_0x3d1d14[_0x5e0d('0x1e')]=_0x6db885['host'];_0x3d1d14['port']=_0x6db885['port']||0x3e1;if(_0x6db885[_0x5e0d('0x1f')]){_0x3d1d14['tls']=!![];}else{_0x3d1d14[_0x5e0d('0x1f')]=![];_0x3d1d14['autotls']='required';}return _0x3d1d14;};EmailImap[_0x5e0d('0x14')][_0x5e0d('0xe')]=function(){this[_0x5e0d('0x2')][_0x5e0d('0x20')](this['mailbox'],![],this[_0x5e0d('0x21')][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x21')]=function(_0x1daebb,_0x159bd7){if(_0x1daebb){this[_0x5e0d('0x12')](_0x1daebb,!![]);}else{this['emit'](_0x5e0d('0x22'),_0x159bd7);this[_0x5e0d('0x23')]();}};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x24')]=function(_0x30e96a){if(_0x30e96a){this[_0x5e0d('0x12')](_0x30e96a,!![]);}else{this['imap'][_0x5e0d('0x25')]();}};EmailImap[_0x5e0d('0x14')]['readUnseen']=function(){this[_0x5e0d('0x2')][_0x5e0d('0x26')]([_0x5e0d('0x27')],this['handleReadUnseen'][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x28')]=function(_0x129942,_0x3d33f8){if(_0x129942){this[_0x5e0d('0x12')](_0x129942,!![]);}else{if(_0x3d33f8[_0x5e0d('0x29')]){try{var _0x10f94c=this[_0x5e0d('0x2')][_0x5e0d('0x2a')](_0x3d33f8[_0x5e0d('0x2b')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x10f94c['on'](_0x5e0d('0x2c'),this[_0x5e0d('0x2d')][_0x5e0d('0xf')](this));_0x10f94c[_0x5e0d('0xd')](_0x5e0d('0x11'),this[_0x5e0d('0x2e')]['bind'](this));_0x10f94c[_0x5e0d('0xd')](_0x5e0d('0x25'),this['handleFetchEnd'][_0x5e0d('0xf')](this));}catch(_0x3ae409){logger['error'](_0x3ae409);}}else{this[_0x5e0d('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x5e0d('0xf')](this));}}};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x2d')]=function(_0x5a879b){_0x5a879b['on'](_0x5e0d('0x2f'),this[_0x5e0d('0x30')][_0x5e0d('0xf')](this));_0x5a879b[_0x5e0d('0xd')]('attributes',this[_0x5e0d('0x31')][_0x5e0d('0xf')](this));_0x5a879b['once'](_0x5e0d('0x25'),this[_0x5e0d('0x32')][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x30')]=function(_0x415b72){simpleParser(_0x415b72,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype'][_0x5e0d('0x31')]=function(){};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x32')]=function(){};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x33')]=function(_0x46d2d3,_0x47dfa8){if(_0x46d2d3){logger[_0x5e0d('0x11')](_0x46d2d3);}else{var _0x5922fe=this;utils[_0x5e0d('0x34')](this[_0x5e0d('0xb')],_0x47dfa8,function(_0x292d57){_0x5922fe[_0x5e0d('0x35')](_0x5e0d('0x9'),_0x292d57);});}};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x36')]=function(){this[_0x5e0d('0x2')][_0x5e0d('0x37')](!![],this['handleCloseBox'][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x2e')]=function(_0x4a8dd6){this[_0x5e0d('0x12')](_0x4a8dd6);this[_0x5e0d('0x2')]['closeBox'](!![],this[_0x5e0d('0x24')][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x10')]=function(){this['emit'](_0x5e0d('0x25'));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x12')]=function(_0x3fcf4b,_0x24e581){logger[_0x5e0d('0x11')](_0x5e0d('0x12'),this['account'][_0x5e0d('0x9')],JSON[_0x5e0d('0x38')](_0x3fcf4b));var _0x225839='';if(_0x3fcf4b){if(_0x3fcf4b[_0x5e0d('0x39')]){_0x225839=_0x3fcf4b['textCode'];}else{for(var _0x32af66 in _0x3fcf4b){if(_0x3fcf4b[_0x5e0d('0x3a')](_0x32af66)){_0x225839+=_['upperFirst'](_0x32af66)+':\x20'+_0x3fcf4b[_0x32af66]+'\x0a';}}}}if(_0x24e581){this[_0x5e0d('0x2')][_0x5e0d('0x25')]();}else{this['emit'](_0x5e0d('0x11'),_0x225839);this[_0x5e0d('0x35')](_0x5e0d('0x25'));}};module[_0x5e0d('0x3b')]=EmailImap; \ No newline at end of file +var _0x2aa8=['parser','stringify','textCode','hasOwnProperty','exports','imap','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','mailbox','account','once','handleReady','handleEnd','error','handleError','bind','connect','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes'];(function(_0x50c16c,_0x43b99e){var _0x24dc5f=function(_0x39b90f){while(--_0x39b90f){_0x50c16c['push'](_0x50c16c['shift']());}};_0x24dc5f(++_0x43b99e);}(_0x2aa8,0x81));var _0x82aa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2aa8[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0x82aa('0x0'));var simpleParser=require(_0x82aa('0x1'))[_0x82aa('0x2')];var Iconv=require('iconv')[_0x82aa('0x3')];var EventEmitter=require(_0x82aa('0x4'))[_0x82aa('0x5')];var utils=require('./utils');var logger=require(_0x82aa('0x6'))('email');function EmailImap(_0x55db73,_0x3c8e81){this[_0x82aa('0x7')]=_0x55db73['mailbox'];this[_0x82aa('0x8')]=this['getAccount'](_0x55db73,_0x3c8e81);this['imap']=new Imap(this['account']);this['imap'][_0x82aa('0x9')]('ready',this[_0x82aa('0xa')]['bind'](this));this[_0x82aa('0x0')][_0x82aa('0x9')]('end',this[_0x82aa('0xb')]['bind'](this));this[_0x82aa('0x0')]['on'](_0x82aa('0xc'),this[_0x82aa('0xd')][_0x82aa('0xe')](this));this[_0x82aa('0x0')][_0x82aa('0xf')]();}util[_0x82aa('0x10')](EmailImap,EventEmitter);EmailImap[_0x82aa('0x11')][_0x82aa('0x12')]=function(_0x4fbf8c,_0x2310e6){var _0x1311db={'connTimeout':_0x4fbf8c[_0x82aa('0x13')]?_0x4fbf8c[_0x82aa('0x13')]*0x3e8:0x2710,'authTimeout':_0x4fbf8c[_0x82aa('0x14')]?_0x4fbf8c[_0x82aa('0x14')]*0x3e8:0x1388};if(_0x4fbf8c[_0x82aa('0x15')]){_0x1311db['user']=_0x4fbf8c[_0x82aa('0x16')];if(_0x4fbf8c[_0x82aa('0x17')]){_0x1311db['xoauth2']=utils['generateXOAuth2Token'](_0x4fbf8c['CloudProvider'][_0x82aa('0x18')],_0x4fbf8c['user']);}else{_0x1311db[_0x82aa('0x19')]=_0x4fbf8c[_0x82aa('0x19')];}}else{if(_0x4fbf8c[_0x82aa('0x1a')]){_0x1311db['user']=_0x4fbf8c[_0x82aa('0x16')];_0x1311db[_0x82aa('0x19')]=_0x4fbf8c[_0x82aa('0x19')];}}_0x1311db[_0x82aa('0x1b')]=_0x2310e6||_0x4fbf8c[_0x82aa('0x16')]||_0x82aa('0x1c');_0x1311db[_0x82aa('0x1d')]=_0x4fbf8c['host'];_0x1311db[_0x82aa('0x1e')]=_0x4fbf8c['port']||0x3e1;if(_0x4fbf8c[_0x82aa('0x1f')]){_0x1311db[_0x82aa('0x1f')]=!![];}else{_0x1311db[_0x82aa('0x1f')]=![];_0x1311db[_0x82aa('0x20')]=_0x82aa('0x21');}return _0x1311db;};EmailImap['prototype'][_0x82aa('0xa')]=function(){this['imap'][_0x82aa('0x22')](this[_0x82aa('0x7')],![],this['handleOpenBox'][_0x82aa('0xe')](this));};EmailImap[_0x82aa('0x11')][_0x82aa('0x23')]=function(_0x34aa37,_0x25c04a){if(_0x34aa37){this[_0x82aa('0xd')](_0x34aa37,!![]);}else{this[_0x82aa('0x24')](_0x82aa('0x25'),_0x25c04a);this[_0x82aa('0x26')]();}};EmailImap[_0x82aa('0x11')][_0x82aa('0x27')]=function(_0x2128ca){if(_0x2128ca){this['handleError'](_0x2128ca,!![]);}else{this[_0x82aa('0x0')][_0x82aa('0x28')]();}};EmailImap[_0x82aa('0x11')]['readUnseen']=function(){this[_0x82aa('0x0')][_0x82aa('0x29')]([_0x82aa('0x2a')],this[_0x82aa('0x2b')][_0x82aa('0xe')](this));};EmailImap['prototype'][_0x82aa('0x2b')]=function(_0x252763,_0x1a2f01){if(_0x252763){this[_0x82aa('0xd')](_0x252763,!![]);}else{if(_0x1a2f01[_0x82aa('0x2c')]){try{var _0x4ae56e=this[_0x82aa('0x0')][_0x82aa('0x2d')](_0x1a2f01[_0x82aa('0x2e')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x4ae56e['on'](_0x82aa('0x2f'),this[_0x82aa('0x30')][_0x82aa('0xe')](this));_0x4ae56e[_0x82aa('0x9')]('error',this[_0x82aa('0x31')][_0x82aa('0xe')](this));_0x4ae56e[_0x82aa('0x9')]('end',this[_0x82aa('0x32')][_0x82aa('0xe')](this));}catch(_0x979315){logger['error'](_0x979315);}}else{this['imap'][_0x82aa('0x33')](!![],this[_0x82aa('0x27')]['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x4337ed){_0x4337ed['on'](_0x82aa('0x34'),this['handleMessageBody']['bind'](this));_0x4337ed[_0x82aa('0x9')]('attributes',this['handleMessageAttributes']['bind'](this));_0x4337ed['once'](_0x82aa('0x28'),this[_0x82aa('0x35')][_0x82aa('0xe')](this));};EmailImap['prototype'][_0x82aa('0x36')]=function(_0x37d2a7){simpleParser(_0x37d2a7,{'Iconv':Iconv},this[_0x82aa('0x37')][_0x82aa('0xe')](this));};EmailImap[_0x82aa('0x11')][_0x82aa('0x38')]=function(){};EmailImap[_0x82aa('0x11')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x82aa('0x37')]=function(_0x4a75e4,_0x29a6c5){if(_0x4a75e4){logger[_0x82aa('0xc')](_0x4a75e4);}else{var _0x11cb30=this;utils[_0x82aa('0x39')](this[_0x82aa('0x8')],_0x29a6c5,function(_0x4a2ea6){_0x11cb30[_0x82aa('0x24')](_0x82aa('0x1b'),_0x4a2ea6);});}};EmailImap[_0x82aa('0x11')][_0x82aa('0x32')]=function(){this[_0x82aa('0x0')][_0x82aa('0x33')](!![],this['handleCloseBox'][_0x82aa('0xe')](this));};EmailImap[_0x82aa('0x11')][_0x82aa('0x31')]=function(_0x37cf77){this[_0x82aa('0xd')](_0x37cf77);this[_0x82aa('0x0')][_0x82aa('0x33')](!![],this['handleCloseBox'][_0x82aa('0xe')](this));};EmailImap[_0x82aa('0x11')]['handleEnd']=function(){this[_0x82aa('0x24')]('end');};EmailImap[_0x82aa('0x11')][_0x82aa('0xd')]=function(_0x22f7b6,_0x195c1c){logger['error'](_0x82aa('0xd'),this['account']['email'],JSON[_0x82aa('0x3a')](_0x22f7b6));var _0x479c5e='';if(_0x22f7b6){if(_0x22f7b6[_0x82aa('0x3b')]){_0x479c5e=_0x22f7b6[_0x82aa('0x3b')];}else{for(var _0x627392 in _0x22f7b6){if(_0x22f7b6[_0x82aa('0x3c')](_0x627392)){_0x479c5e+=_['upperFirst'](_0x627392)+':\x20'+_0x22f7b6[_0x627392]+'\x0a';}}}}if(_0x195c1c){this[_0x82aa('0x0')][_0x82aa('0x28')]();}else{this['emit'](_0x82aa('0xc'),_0x479c5e);this['emit'](_0x82aa('0x28'));}};module[_0x82aa('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 0c5fe2b..1a5c02e 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 _0x260b=['toString','prototype','verify','Not\x20verifired','exports','nodemailer','send','createTransport','use','compile'];(function(_0x3a0020,_0xe3feaa){var _0x1adcb7=function(_0x3627c3){while(--_0x3627c3){_0x3a0020['push'](_0x3a0020['shift']());}};_0x1adcb7(++_0xe3feaa);}(_0x260b,0x7d));var _0xb260=function(_0x145435,_0x326220){_0x145435=_0x145435-0x0;var _0x55a234=_0x260b[_0x145435];return _0x55a234;};'use strict';var nodemailer=require(_0xb260('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xb260('0x1')]=function(_0x27cbaa,_0x442bc1){return new Promise(function(_0x54195d,_0x1cf70e){var _0x3393c1=nodemailer[_0xb260('0x2')](_0x27cbaa);_0x3393c1[_0xb260('0x3')](_0xb260('0x4'),inlineBase64());_0x3393c1['sendMail'](_0x442bc1,function(_0x52fcc4,_0x289892){if(_0x52fcc4){_0x1cf70e(_0x52fcc4[_0xb260('0x5')]());}else{_0x54195d(_0x289892);}});});};EmailSmtp[_0xb260('0x6')][_0xb260('0x7')]=function(_0x472a42){return new Promise(function(_0x58a765,_0x44ee4b){var _0x20a709=nodemailer[_0xb260('0x2')](_0x472a42);_0x20a709[_0xb260('0x7')](function(_0x1176d1,_0x5111e8){if(_0x1176d1){_0x44ee4b(_0x1176d1[_0xb260('0x5')]());}else{if(_0x5111e8){_0x58a765(_0x5111e8);}else{_0x44ee4b(_0xb260('0x8'));}}});});};module[_0xb260('0x9')]=EmailSmtp; \ No newline at end of file +var _0x0286=['exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','toString','verify','Not\x20verifired'];(function(_0x2162e4,_0x5eb29c){var _0x3ec31d=function(_0x327910){while(--_0x327910){_0x2162e4['push'](_0x2162e4['shift']());}};_0x3ec31d(++_0x5eb29c);}(_0x0286,0x19f));var _0x6028=function(_0x23a469,_0x5667e4){_0x23a469=_0x23a469-0x0;var _0x5f2a21=_0x0286[_0x23a469];return _0x5f2a21;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x6028('0x0'));function EmailSmtp(){}EmailSmtp[_0x6028('0x1')][_0x6028('0x2')]=function(_0x53940d,_0x97abc6){return new Promise(function(_0x587f74,_0x16cf12){var _0x4127a5=nodemailer[_0x6028('0x3')](_0x53940d);_0x4127a5[_0x6028('0x4')]('compile',inlineBase64());_0x4127a5['sendMail'](_0x97abc6,function(_0x552957,_0x454ab7){if(_0x552957){_0x16cf12(_0x552957[_0x6028('0x5')]());}else{_0x587f74(_0x454ab7);}});});};EmailSmtp[_0x6028('0x1')][_0x6028('0x6')]=function(_0x5b8c4c){return new Promise(function(_0x4c2fdf,_0x57ec6c){var _0xa0f94=nodemailer[_0x6028('0x3')](_0x5b8c4c);_0xa0f94['verify'](function(_0x3eeb3f,_0x42b89b){if(_0x3eeb3f){_0x57ec6c(_0x3eeb3f[_0x6028('0x5')]());}else{if(_0x42b89b){_0x4c2fdf(_0x42b89b);}else{_0x57ec6c(_0x6028('0x7'));}}});});};module[_0x6028('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 0e8f7b1..6d09dab 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 _0x921d=['attach','type','attachment','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','messageId','inReplyTo','date','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','

Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','length','slice','join','Anonymous','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc'];(function(_0x3e3663,_0x4712be){var _0xc20576=function(_0x53ec5c){while(--_0x53ec5c){_0x3e3663['push'](_0x3e3663['shift']());}};_0xc20576(++_0x4712be);}(_0x921d,0x1de));var _0xd921=function(_0x2c46ba,_0x51febd){_0x2c46ba=_0x2c46ba-0x0;var _0x1aa617=_0x921d[_0x2c46ba];return _0x1aa617;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0xd921('0x0'));var fs=require('fs');var path=require('path');var util=require(_0xd921('0x1'));var tnef=require(_0xd921('0x2'));var logger=require(_0xd921('0x3'))(_0xd921('0x4'));var config=require(_0xd921('0x5'));function getAddress(_0xb2ad0f){var _0x302f47=_['head'](_0xb2ad0f[_0xd921('0x6')]);return _0x302f47&&_0x302f47[_0xd921('0x7')]?_0x302f47[_0xd921('0x7')]:_0xd921('0x8')+random[_0xd921('0x9')](0x6)+_0xd921('0xa');}function getFirstName(_0x34c1b9){var _0x4aca1f=_[_0xd921('0xb')](_0x34c1b9[_0xd921('0x6')]);if(_0x4aca1f&&_0x4aca1f[_0xd921('0xc')]){if(_0x4aca1f[_0xd921('0xc')]==_0x4aca1f[_0xd921('0x7')]){return _0x4aca1f[_0xd921('0xc')][_0xd921('0xd')](0x0,_0x4aca1f['name'][_0xd921('0xe')]('@'));}var _0x2d921f=_0x4aca1f[_0xd921('0xc')][_0xd921('0xf')](/\s+/);return _0x2d921f[_0xd921('0x10')]>0x1?_0x2d921f[_0xd921('0x11')](0x0,-0x1)[_0xd921('0x12')]('\x20'):_0x4aca1f[_0xd921('0xc')];}return _0xd921('0x13');}function getLastName(_0x44d4df){var _0x261fea=_[_0xd921('0xb')](_0x44d4df['value']);if(_0x261fea&&_0x261fea[_0xd921('0xc')]){var _0x1f79f0=_0x261fea[_0xd921('0xc')][_0xd921('0xf')](/\s+/);return _0x1f79f0['length']>0x1?_0x1f79f0['pop']():'';}return'';}function getMails(_0x16438c,_0x2af8b2){var _0x43abd9='';for(var _0x66ee00=0x0;_0x66ee00<_0x2af8b2[_0xd921('0x6')][_0xd921('0x10')];_0x66ee00+=0x1){if(_0x2af8b2['value'][_0x66ee00][_0xd921('0x7')]!==_0x16438c){if(!_[_0xd921('0x14')](_0x43abd9)){_0x43abd9+=',';}_0x43abd9+=_0x2af8b2[_0xd921('0x6')][_0x66ee00][_0xd921('0xc')]||_0x2af8b2[_0xd921('0x6')][_0x66ee00]['address']||'';_0x43abd9+='\x20<';_0x43abd9+=_0x2af8b2[_0xd921('0x6')][_0x66ee00][_0xd921('0x7')]?_0x2af8b2[_0xd921('0x6')][_0x66ee00][_0xd921('0x7')]:_0xd921('0x8')+random[_0xd921('0x9')](0x6)+_0xd921('0xa');_0x43abd9+='>';}}return _0x43abd9;}function parseEmail(_0x480a60,_0x146b9d,_0x1d1922){if(_0x146b9d[_0xd921('0x15')]){var _0x31f1de=/)<[^<]*)*<\/script>/gi;while(_0x31f1de[_0xd921('0x16')](_0x146b9d[_0xd921('0x15')])){_0x146b9d[_0xd921('0x15')]=_0x146b9d['html']['replace'](_0x31f1de,'');}if(_0x146b9d[_0xd921('0x15')][_0xd921('0x17')](_0xd921('0x18'))){var _0x30e8ea=[];_0x146b9d[_0xd921('0x19')][_0xd921('0x1a')](_0x57ebc6=>{_0x30e8ea[_0xd921('0x1b')](_0x57ebc6[_0xd921('0x1c')]);});var _0x1ba9fa=/]+>/g;var _0x56b4f4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x54f5c=_0x146b9d[_0xd921('0x15')][_0xd921('0x1d')](_0x56b4f4,_0xd921('0x1e'));var _0x4a93ea=_0x54f5c[_0xd921('0x1d')](_0x1ba9fa,_0xd921('0x1f'));for(let _0x1ae8d5=0x0;_0x1ae8d5<_0x30e8ea[_0xd921('0x10')];_0x1ae8d5++){var _0x3b85fc=_0x4a93ea[_0xd921('0x1d')]('_IMG',_0xd921('0x20')+_0x30e8ea[_0x1ae8d5]+_0xd921('0x21'));_0x4a93ea=_0x3b85fc;}_0x146b9d[_0xd921('0x15')]=_0x4a93ea;}_0x1d1922[_0xd921('0x22')]=_0x146b9d['html'];}else{_0x1d1922['body']=_0x146b9d[_0xd921('0x23')];}if(_0x1d1922[_0xd921('0x22')]){_0x1d1922[_0xd921('0x22')]=_0x1d1922[_0xd921('0x22')]['replace'](/0x0){var _0x2e1e94=['Auto-Submitted:\x20auto-replied',_0xd921('0x34'),_0xd921('0x35')];for(var _0x506059=0x0;_0x506059<_0x146b9d[_0xd921('0x33')][_0xd921('0x10')];_0x506059++){var _0x395db8=_[_0xd921('0xe')](_0x2e1e94,_0x146b9d[_0xd921('0x33')][_0x506059][_0xd921('0x36')]);if(_0x395db8>=0x0){_0x1d1922[_0xd921('0x37')]=!![];}}}return _0x1d1922;}exports[_0xd921('0x38')]=function(_0x4e9b1a,_0x3270d6,_0x5a48d3){var _0x9d12ea={'from':getAddress(_0x3270d6[_0xd921('0x39')]),'firstName':getFirstName(_0x3270d6[_0xd921('0x39')]),'lastName':getLastName(_0x3270d6[_0xd921('0x39')]),'mapKey':_0xd921('0x4'),'message':{'from':getMails(_0x4e9b1a[_0xd921('0x4')],_0x3270d6[_0xd921('0x39')]),'to':_0x4e9b1a[_0xd921('0x4')],'cc':'','subject':_0x3270d6['subject']||'','messageId':_0x3270d6[_0xd921('0x3a')],'inReplyTo':_0x3270d6[_0xd921('0x3b')],'sentAt':moment(_0x3270d6[_0xd921('0x3c')])[_0xd921('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3270d6[_0xd921('0x15')]&&!_0x3270d6[_0xd921('0x23')]){var _0x1e8d6f=_[_0xd921('0x3d')](_0x3270d6[_0xd921('0x19')],{'contentType':_0xd921('0x3e')});if(_0x1e8d6f['length']){logger[_0xd921('0x3f')](util['format'](_0xd921('0x40'),_0x3270d6['messageId']));tnef[_0xd921('0x41')](_[_0xd921('0x42')](_0x1e8d6f)[_0xd921('0x31')],function(_0x6e86e7,_0x2e7f4f){if(_0x2e7f4f){_0x3270d6[_0xd921('0x15')]=_0x2e7f4f[_0xd921('0x43')]||'

Empty\x20message

';if(_0x2e7f4f['Attachments']){for(var _0x284f83=0x0;_0x284f83<_0x2e7f4f[_0xd921('0x44')][_0xd921('0x10')];_0x284f83++){var _0x499d1d=_0x2e7f4f['Attachments'][_0x284f83];_0x9d12ea['message'][_0xd921('0x19')]['push']({'filename':_0x499d1d['Title'],'content':Buffer[_0xd921('0x39')](_0x499d1d['Data'])});}}}_0x5a48d3(parseEmail(_0x4e9b1a,_0x3270d6,_0x9d12ea));});}else{_0x3270d6[_0xd921('0x15')]=_0xd921('0x45');_0x5a48d3(parseEmail(_0x4e9b1a,_0x3270d6,_0x9d12ea));}}else{_0x5a48d3(parseEmail(_0x4e9b1a,_0x3270d6,_0x9d12ea));}};exports[_0xd921('0x46')]=function(_0x423948,_0xc1815e){var _0x2902a7=['user='+(_0xc1815e||''),_0xd921('0x47')+_0x423948,'',''];return Buffer[_0xd921('0x39')](_0x2902a7[_0xd921('0x12')](''),_0xd921('0x48'))['toString'](_0xd921('0x49'));}; \ No newline at end of file +var _0x1ad5=['content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','lodash','moment','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','Anonymous','html','test','replace','includes','','body','0x1?_0x378ddb['slice'](0x0,-0x1)['join']('\x20'):_0x393dd3['name'];}return _0x51ad('0x10');}function getLastName(_0x1de62d){var _0x1b0e0b=_['head'](_0x1de62d['value']);if(_0x1b0e0b&&_0x1b0e0b['name']){var _0x37cc72=_0x1b0e0b[_0x51ad('0xb')][_0x51ad('0xe')](/\s+/);return _0x37cc72[_0x51ad('0xf')]>0x1?_0x37cc72['pop']():'';}return'';}function getMails(_0x433799,_0x1df05a){var _0x256e3b='';for(var _0x437beb=0x0;_0x437beb<_0x1df05a[_0x51ad('0x6')][_0x51ad('0xf')];_0x437beb+=0x1){if(_0x1df05a['value'][_0x437beb]['address']!==_0x433799){if(!_['isEmpty'](_0x256e3b)){_0x256e3b+=',';}_0x256e3b+=_0x1df05a['value'][_0x437beb][_0x51ad('0xb')]||_0x1df05a[_0x51ad('0x6')][_0x437beb][_0x51ad('0x7')]||'';_0x256e3b+='\x20<';_0x256e3b+=_0x1df05a['value'][_0x437beb][_0x51ad('0x7')]?_0x1df05a[_0x51ad('0x6')][_0x437beb][_0x51ad('0x7')]:_0x51ad('0x8')+random[_0x51ad('0x9')](0x6)+'@xcally.com';_0x256e3b+='>';}}return _0x256e3b;}function parseEmail(_0x5d4b4d,_0x37cb39,_0x46e8f9){if(_0x37cb39[_0x51ad('0x11')]){var _0x3ed779=/)<[^<]*)*<\/script>/gi;while(_0x3ed779[_0x51ad('0x12')](_0x37cb39[_0x51ad('0x11')])){_0x37cb39[_0x51ad('0x11')]=_0x37cb39[_0x51ad('0x11')][_0x51ad('0x13')](_0x3ed779,'');}if(_0x37cb39[_0x51ad('0x11')][_0x51ad('0x14')](_0x51ad('0x15'))){var _0x4cedd2=[];_0x37cb39[_0x51ad('0x16')][_0x51ad('0x17')](_0x3d56ad=>{_0x4cedd2[_0x51ad('0x18')](_0x3d56ad['filename']);});var _0xfadb0e=/]+>/g;var _0x30ff1d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1cbee1=_0x37cb39[_0x51ad('0x11')][_0x51ad('0x13')](_0x30ff1d,_0x51ad('0x19'));var _0x4bb7b3=_0x1cbee1[_0x51ad('0x13')](_0xfadb0e,'_IMG');for(let _0x2d5abf=0x0;_0x2d5abf<_0x4cedd2[_0x51ad('0xf')];_0x2d5abf++){var _0x4efdf6=_0x4bb7b3[_0x51ad('0x13')](_0x51ad('0x1a'),'\x20[Attachment:\x20'+_0x4cedd2[_0x2d5abf]+_0x51ad('0x1b'));_0x4bb7b3=_0x4efdf6;}_0x37cb39[_0x51ad('0x11')]=_0x4bb7b3;}_0x46e8f9['body']=_0x37cb39['html'];}else{_0x46e8f9[_0x51ad('0x1c')]=_0x37cb39['textAsHtml'];}if(_0x46e8f9[_0x51ad('0x1c')]){_0x46e8f9[_0x51ad('0x1c')]=_0x46e8f9['body'][_0x51ad('0x13')](/0x0){var _0x2724f2=[_0x51ad('0x2f'),_0x51ad('0x30'),_0x51ad('0x31')];for(var _0x539aae=0x0;_0x539aae<_0x37cb39[_0x51ad('0x2e')][_0x51ad('0xf')];_0x539aae++){var _0x2cd352=_[_0x51ad('0xd')](_0x2724f2,_0x37cb39[_0x51ad('0x2e')][_0x539aae][_0x51ad('0x32')]);if(_0x2cd352>=0x0){_0x46e8f9[_0x51ad('0x33')]=!![];}}}return _0x46e8f9;}exports[_0x51ad('0x34')]=function(_0x425f52,_0x1bb5a2,_0x3fc5b6){var _0xc59637={'from':getAddress(_0x1bb5a2[_0x51ad('0x35')]),'firstName':getFirstName(_0x1bb5a2[_0x51ad('0x35')]),'lastName':getLastName(_0x1bb5a2[_0x51ad('0x35')]),'mapKey':_0x51ad('0x3'),'message':{'from':getMails(_0x425f52[_0x51ad('0x3')],_0x1bb5a2[_0x51ad('0x35')]),'to':_0x425f52[_0x51ad('0x3')],'cc':'','subject':_0x1bb5a2[_0x51ad('0x36')]||'','messageId':_0x1bb5a2[_0x51ad('0x37')],'inReplyTo':_0x1bb5a2[_0x51ad('0x38')],'sentAt':moment(_0x1bb5a2['date'])[_0x51ad('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1bb5a2[_0x51ad('0x11')]&&!_0x1bb5a2['textAsHtml']){var _0xd3bb37=_[_0x51ad('0x39')](_0x1bb5a2['attachments'],{'contentType':_0x51ad('0x3a')});if(_0xd3bb37[_0x51ad('0xf')]){logger[_0x51ad('0x3b')](util[_0x51ad('0x28')](_0x51ad('0x3c'),_0x1bb5a2[_0x51ad('0x37')]));tnef[_0x51ad('0x3d')](_['first'](_0xd3bb37)[_0x51ad('0x2d')],function(_0x2e21ce,_0x41eea1){if(_0x41eea1){_0x1bb5a2['html']=_0x41eea1[_0x51ad('0x3e')]||_0x51ad('0x3f');if(_0x41eea1[_0x51ad('0x40')]){for(var _0x100be9=0x0;_0x100be9<_0x41eea1[_0x51ad('0x40')][_0x51ad('0xf')];_0x100be9++){var _0x2ac433=_0x41eea1[_0x51ad('0x40')][_0x100be9];_0xc59637[_0x51ad('0x1e')][_0x51ad('0x16')][_0x51ad('0x18')]({'filename':_0x2ac433[_0x51ad('0x41')],'content':Buffer[_0x51ad('0x35')](_0x2ac433[_0x51ad('0x42')])});}}}_0x3fc5b6(parseEmail(_0x425f52,_0x1bb5a2,_0xc59637));});}else{_0x1bb5a2['html']=_0x51ad('0x3f');_0x3fc5b6(parseEmail(_0x425f52,_0x1bb5a2,_0xc59637));}}else{_0x3fc5b6(parseEmail(_0x425f52,_0x1bb5a2,_0xc59637));}};exports[_0x51ad('0x43')]=function(_0x1bf80f,_0x1f2211){var _0x2cccf0=['user='+(_0x1f2211||''),_0x51ad('0x44')+_0x1bf80f,'',''];return Buffer[_0x51ad('0x35')](_0x2cccf0['join'](''),_0x51ad('0x45'))['toString'](_0x51ad('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 47499f4..0bc256f 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 _0xbe6f=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe6f,0xe0));var _0xfbe6=function(_0x24f747,_0x2b5a82){_0x24f747=_0x24f747-0x0;var _0x3b13d3=_0xbe6f[_0x24f747];return _0x3b13d3;};'use strict';var _=require(_0xfbe6('0x0'));function MailAccount(_0x24ac08){this['id']=_0x24ac08['id']||0x0;this[_0xfbe6('0x1')]=_0x24ac08[_0xfbe6('0x1')]||_0xfbe6('0x2');this[_0xfbe6('0x3')]=_0x24ac08[_0xfbe6('0x3')]||'SERV';this[_0xfbe6('0x4')]=_0x24ac08[_0xfbe6('0x4')]||![];this[_0xfbe6('0x5')]=_0x24ac08[_0xfbe6('0x5')]||[];this[_0xfbe6('0x6')]=_0x24ac08[_0xfbe6('0x6')]||[];}module[_0xfbe6('0x7')]=MailAccount; \ No newline at end of file +var _0x648f=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x1a3f80,_0x28758a){var _0x132bb2=function(_0x4b1363){while(--_0x4b1363){_0x1a3f80['push'](_0x1a3f80['shift']());}};_0x132bb2(++_0x28758a);}(_0x648f,0x19f));var _0xf648=function(_0x3970d9,_0x43e60d){_0x3970d9=_0x3970d9-0x0;var _0x42ff83=_0x648f[_0x3970d9];return _0x42ff83;};'use strict';var _=require(_0xf648('0x0'));function MailAccount(_0x479c05){this['id']=_0x479c05['id']||0x0;this[_0xf648('0x1')]=_0x479c05['name']||_0xf648('0x2');this['key']=_0x479c05[_0xf648('0x3')]||_0xf648('0x4');this[_0xf648('0x5')]=_0x479c05[_0xf648('0x5')]||![];this[_0xf648('0x6')]=_0x479c05[_0xf648('0x6')]||[];this['Smtp']=_0x479c05[_0xf648('0x7')]||[];}module[_0xf648('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 9b2668b..38b35a2 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 _0x7226=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined'];(function(_0x3e8c3d,_0x37629a){var _0x1d5201=function(_0x2f33c0){while(--_0x2f33c0){_0x3e8c3d['push'](_0x3e8c3d['shift']());}};_0x1d5201(++_0x37629a);}(_0x7226,0xa9));var _0x6722=function(_0x374d5a,_0x42a75){_0x374d5a=_0x374d5a-0x0;var _0x4cf62a=_0x7226[_0x374d5a];return _0x4cf62a;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0xa1a6b8,_0x4077b7,_0x4a1ed2){var _0x41284e=_[_0x6722('0x0')](_0xa1a6b8,function(_0x1fe5f3,_0x2eedff){return _0x1fe5f3[_0x4a1ed2];});for(var _0x36a92c in _0x4077b7){if(_0x4077b7[_0x6722('0x1')](_0x36a92c)){if(!_0x41284e[_0x36a92c]){delete _0x4077b7[_0x36a92c];}}}}Realtime[_0x6722('0x2')][_0x6722('0x3')]=function(_0x3a876a,_0x580b9d){for(var _0x20c25c in _0x580b9d){if(_0x3a876a[_0x6722('0x1')](_0x20c25c)){_0x3a876a[_0x20c25c]=_0x580b9d[_0x20c25c];}}};Realtime[_0x6722('0x2')]['initMailAccounts']=function(){var _0x3a13e6=this;return function(_0x1fd77e){if(_0x1fd77e){freeIsNotKey(_0x1fd77e,_0x3a13e6['mailAccounts'],'id');for(var _0x49a61a=0x0,_0xc71294={},_0x1aa00e={};_0x49a61a<_0x1fd77e[_0x6722('0x4')];_0x49a61a+=0x1){_0xc71294=_0x1fd77e[_0x49a61a];if(_[_0x6722('0x5')](_0x3a13e6[_0x6722('0x6')][_0xc71294['id']])){_0x3a13e6['mailAccounts'][_0xc71294['id']]=new MailAccount(_0xc71294);}else{_['merge'](_0x3a13e6['mailAccounts'][_0xc71294['id']],_0xc71294);}}}return _0x3a13e6[_0x6722('0x6')];};};module['exports']=Realtime; \ No newline at end of file +var _0x990c=['prototype','initMailAccounts','length','isUndefined','lodash','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x990c,0x94));var _0xc990=function(_0x4928c6,_0x1f6379){_0x4928c6=_0x4928c6-0x0;var _0x1ca244=_0x990c[_0x4928c6];return _0x1ca244;};'use strict';var _=require(_0xc990('0x0'));var MailAccount=require(_0xc990('0x1'));var Realtime=function(){this[_0xc990('0x2')]={};};function freeIsNotKey(_0x22fbb5,_0x312263,_0x3c7f88){var _0x2e98a6=_['mapKeys'](_0x22fbb5,function(_0x5ee7ed,_0x45c61c){return _0x5ee7ed[_0x3c7f88];});for(var _0x130d7f in _0x312263){if(_0x312263[_0xc990('0x3')](_0x130d7f)){if(!_0x2e98a6[_0x130d7f]){delete _0x312263[_0x130d7f];}}}}Realtime[_0xc990('0x4')]['mergeFromDatabase']=function(_0xa32479,_0x14843a){for(var _0x3848c2 in _0x14843a){if(_0xa32479[_0xc990('0x3')](_0x3848c2)){_0xa32479[_0x3848c2]=_0x14843a[_0x3848c2];}}};Realtime[_0xc990('0x4')][_0xc990('0x5')]=function(){var _0x142efe=this;return function(_0x50c2a6){if(_0x50c2a6){freeIsNotKey(_0x50c2a6,_0x142efe[_0xc990('0x2')],'id');for(var _0xa2a7bb=0x0,_0x17f6e2={},_0x2cad5f={};_0xa2a7bb<_0x50c2a6[_0xc990('0x6')];_0xa2a7bb+=0x1){_0x17f6e2=_0x50c2a6[_0xa2a7bb];if(_[_0xc990('0x7')](_0x142efe[_0xc990('0x2')][_0x17f6e2['id']])){_0x142efe[_0xc990('0x2')][_0x17f6e2['id']]=new MailAccount(_0x17f6e2);}else{_['merge'](_0x142efe[_0xc990('0x2')][_0x17f6e2['id']],_0x17f6e2);}}}return _0x142efe[_0xc990('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 4982305..033c0a6 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 _0xf6da=['GetMailAccount','name','provider','service','email','active','key','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x43d106,_0x96a475){var _0x2160bc=function(_0x1219fb){while(--_0x1219fb){_0x43d106['push'](_0x43d106['shift']());}};_0x2160bc(++_0x96a475);}(_0xf6da,0x19f));var _0xaf6d=function(_0x54b774,_0x2bc4a3){_0x54b774=_0x54b774-0x0;var _0x3065d4=_0xf6da[_0x54b774];return _0x3065d4;};'use strict';var client=require(_0xaf6d('0x0'));exports[_0xaf6d('0x1')]=function(){return function(){return client[_0xaf6d('0x2')](_0xaf6d('0x3'),{'options':{'attributes':['id',_0xaf6d('0x4'),_0xaf6d('0x5'),_0xaf6d('0x6'),_0xaf6d('0x7'),_0xaf6d('0x8'),_0xaf6d('0x9'),'ListId',_0xaf6d('0xa')],'raw':![],'include':[{'model':_0xaf6d('0xb'),'as':_0xaf6d('0xc'),'include':[{'model':_0xaf6d('0xd'),'attributes':['id',_0xaf6d('0x4'),_0xaf6d('0x6'),_0xaf6d('0xe'),_0xaf6d('0xf')],'as':'CloudProvider'}]},{'model':_0xaf6d('0x10'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0xaf6d('0x4'),_0xaf6d('0x6'),_0xaf6d('0xe'),_0xaf6d('0xf')],'as':_0xaf6d('0xd')}]}]},'log':_0xaf6d('0x11')});};};exports['notify']=function(_0x2ec5b8,_0x28e257){return client[_0xaf6d('0x2')](_0xaf6d('0x12'),{'account':{'id':_0x2ec5b8},'body':_0x28e257,'log':_0xaf6d('0x12')});}; \ No newline at end of file +var _0x7d5d=['Imap','name','type','CloudProvider','MailServerOut','data5','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','provider','service','email','key','ListId','TemplateId','MailServerIn'];(function(_0x23ce9a,_0x1d7064){var _0x681ab2=function(_0x432edb){while(--_0x432edb){_0x23ce9a['push'](_0x23ce9a['shift']());}};_0x681ab2(++_0x1d7064);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0x982d02,_0x4ef5e6){_0x982d02=_0x982d02-0x0;var _0xaf3078=_0x7d5d[_0x982d02];return _0xaf3078;};'use strict';var client=require('../client');exports[_0xd7d5('0x0')]=function(){return function(){return client[_0xd7d5('0x1')]('GetMailAccount',{'options':{'attributes':['id','name',_0xd7d5('0x2'),_0xd7d5('0x3'),_0xd7d5('0x4'),'active',_0xd7d5('0x5'),_0xd7d5('0x6'),_0xd7d5('0x7')],'raw':![],'include':[{'model':_0xd7d5('0x8'),'as':_0xd7d5('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0xd7d5('0xa'),_0xd7d5('0x3'),_0xd7d5('0xb'),'data5'],'as':_0xd7d5('0xc')}]},{'model':_0xd7d5('0xd'),'as':'Smtp','include':[{'model':_0xd7d5('0xc'),'attributes':['id',_0xd7d5('0xa'),_0xd7d5('0x3'),'type',_0xd7d5('0xe')],'as':_0xd7d5('0xc')}]}]},'log':_0xd7d5('0xf')});};};exports[_0xd7d5('0x10')]=function(_0x4be025,_0x59d51c){return client[_0xd7d5('0x1')](_0xd7d5('0x11'),{'account':{'id':_0x4be025},'body':_0x59d51c,'log':_0xd7d5('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index a9353d6..ad548fe 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 _0x3ef1=['Request','ShowSetting','GetSettings','../client'];(function(_0x4fd42e,_0x446a11){var _0x33c1dc=function(_0x11ce06){while(--_0x11ce06){_0x4fd42e['push'](_0x4fd42e['shift']());}};_0x33c1dc(++_0x446a11);}(_0x3ef1,0x19b));var _0x13ef=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x3ef1[_0xdea41a];return _0x15d0d8;};'use strict';var client=require(_0x13ef('0x0'));exports['getSettings']=function(){return client[_0x13ef('0x1')](_0x13ef('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x13ef('0x3')});}; \ No newline at end of file +var _0x80fc=['GetSettings'];(function(_0x3972dd,_0x298e3f){var _0x3a29c8=function(_0x461387){while(--_0x461387){_0x3972dd['push'](_0x3972dd['shift']());}};_0x3a29c8(++_0x298e3f);}(_0x80fc,0x142));var _0xc80f=function(_0x41476a,_0x559206){_0x41476a=_0x41476a-0x0;var _0x5983d3=_0x80fc[_0x41476a];return _0x5983d3;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xc80f('0x0')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 487a38f..8986cec 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 5951293..3f9b995 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 _0x4e53=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','sticky-session','ioredis','../../config/environment','timeout','listen','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../routes'];(function(_0x5307a6,_0x4f6e7b){var _0x5410b9=function(_0x5f526f){while(--_0x5f526f){_0x5307a6['push'](_0x5307a6['shift']());}};_0x5410b9(++_0x4f6e7b);}(_0x4e53,0x1a9));var _0x34e5=function(_0xe47217,_0x3a35db){_0xe47217=_0xe47217-0x0;var _0x3dc84c=_0x4e53[_0xe47217];return _0x3dc84c;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x34e5('0x0'));var sticky=require(_0x34e5('0x1'));var Redis=require(_0x34e5('0x2'));var config=require(_0x34e5('0x3'));var app=express();var server=http['createServer'](app);server[_0x34e5('0x4')]=0xdbba0;if(sticky[_0x34e5('0x5')](server,config['port'])){var socketio=require(_0x34e5('0x6'))(server,{'transports':[_0x34e5('0x7'),_0x34e5('0x8')]});config[_0x34e5('0x9')]=_[_0x34e5('0xa')](config[_0x34e5('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x34e5('0xb')](require(_0x34e5('0xc'))({'pubClient':new Redis(config[_0x34e5('0x9')]),'subClient':new Redis(config['redis'])}));require(_0x34e5('0xd'))[_0x34e5('0xe')]();require('../../config/socketio')[_0x34e5('0xe')](socketio);require('../../config/express')[_0x34e5('0xe')](app);require(_0x34e5('0xf'))[_0x34e5('0xe')](app);}else{server[_0x34e5('0x10')](_0x34e5('0x11'),function(){console[_0x34e5('0x12')](_0x34e5('0x13'),config['port']);});}exports=module[_0x34e5('0x14')]=app; \ No newline at end of file +var _0x68d5=['lodash','http','express','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0xfcf20,_0x5f1747){var _0x5697e3=function(_0x2e325d){while(--_0x2e325d){_0xfcf20['push'](_0xfcf20['shift']());}};_0x5697e3(++_0x5f1747);}(_0x68d5,0x1a4));var _0x568d=function(_0x104b43,_0x46c28d){_0x104b43=_0x104b43-0x0;var _0x140fa5=_0x68d5[_0x104b43];return _0x140fa5;};'use strict';var _=require(_0x568d('0x0'));var http=require(_0x568d('0x1'));var express=require(_0x568d('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x568d('0x3')])){var socketio=require(_0x568d('0x4'))(server,{'transports':[_0x568d('0x5'),_0x568d('0x6')]});config[_0x568d('0x7')]=_[_0x568d('0x8')](config[_0x568d('0x7')],{'host':_0x568d('0x9'),'port':0x18eb});socketio[_0x568d('0xa')](require('socket.io-redis')({'pubClient':new Redis(config[_0x568d('0x7')]),'subClient':new Redis(config['redis'])}));require(_0x568d('0xb'))[_0x568d('0xc')]();require(_0x568d('0xd'))[_0x568d('0xc')](socketio);require(_0x568d('0xe'))[_0x568d('0xc')](app);require(_0x568d('0xf'))[_0x568d('0xc')](app);}else{server[_0x568d('0x10')](_0x568d('0x11'),function(){console[_0x568d('0x12')](_0x568d('0x13'),config[_0x568d('0x3')]);});}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 0802d7e..70ed2f7 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 _0x0558=['rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','client','debug'];(function(_0x3ab14c,_0x4093a1){var _0x423753=function(_0x278031){while(--_0x278031){_0x3ab14c['push'](_0x3ab14c['shift']());}};_0x423753(++_0x4093a1);}(_0x0558,0x6a));var _0x8055=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x0558[_0x1af98d];return _0x3553ea;};'use strict';var jayson=require(_0x8055('0x0'));var BPromise=require(_0x8055('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x8055('0x2')]['http']({'port':0x2329});client['Request']=function(_0x55a9be,_0x3eda70){return new BPromise(function(_0x1879f2,_0x2e9f13){return client['request'](_0x55a9be,_0x3eda70)['then'](function(_0x1cd4d3){logger[_0x8055('0x3')](_0x8055('0x4'),_0x8055('0x5'),_0x55a9be,_0x3eda70,_0x1cd4d3);if(_0x1cd4d3['error']){logger[_0x8055('0x6')](_0x8055('0x4'),_0x8055('0x5'),_0x55a9be,_0x1cd4d3['error']['message'],_0x3eda70);return _0x2e9f13(_0x1cd4d3[_0x8055('0x6')][_0x8055('0x7')]);}else{return _0x1879f2(_0x1cd4d3[_0x8055('0x8')]);}})[_0x8055('0x9')](function(_0x33768c){logger[_0x8055('0x6')]('rpc',_0x8055('0x5'),_0x55a9be,_0x33768c,_0x3eda70);return _0x2e9f13(_0x33768c);});});};module[_0x8055('0xa')]=client; \ No newline at end of file +var _0xe4a2=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','error','result','catch','rpc'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0xe4a2,0x1e1));var _0x2e4a=function(_0x529994,_0x5712de){_0x529994=_0x529994-0x0;var _0x22bedd=_0xe4a2[_0x529994];return _0x22bedd;};'use strict';var jayson=require(_0x2e4a('0x0'));var BPromise=require(_0x2e4a('0x1'));var logger=require(_0x2e4a('0x2'))(_0x2e4a('0x3'));var client=jayson[_0x2e4a('0x4')][_0x2e4a('0x5')]({'port':0x2329});client[_0x2e4a('0x6')]=function(_0x3e85cd,_0x403c6d){return new BPromise(function(_0xcdb2fb,_0x1da45d){return client['request'](_0x3e85cd,_0x403c6d)[_0x2e4a('0x7')](function(_0xf6c704){logger[_0x2e4a('0x8')]('rpc','routing',_0x3e85cd,_0x403c6d,_0xf6c704);if(_0xf6c704[_0x2e4a('0x9')]){logger[_0x2e4a('0x9')]('rpc',_0x2e4a('0x3'),_0x3e85cd,_0xf6c704['error']['message'],_0x403c6d);return _0x1da45d(_0xf6c704[_0x2e4a('0x9')]['message']);}else{return _0xcdb2fb(_0xf6c704[_0x2e4a('0xa')]);}})[_0x2e4a('0xb')](function(_0x2a5013){logger[_0x2e4a('0x9')](_0x2e4a('0xc'),_0x2e4a('0x3'),_0x3e85cd,_0x2a5013,_0x403c6d);return _0x1da45d(_0x2a5013);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 646f02c..f073e66 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 _0x8c9d=['resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8c9d,0xd8));var _0xd8c9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c9d[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xd8c9('0x0'));var server=require('./server');var Realtime=require(_0xd8c9('0x1'));var user=require(_0xd8c9('0x2'));var interval=require(_0xd8c9('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xd8c9('0x4'));var smsQueue=require(_0xd8c9('0x5'));var mailQueue=require(_0xd8c9('0x6'));var faxQueue=require(_0xd8c9('0x7'));var whatsappQueue=require(_0xd8c9('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd8c9('0x9')]()[_0xd8c9('0xa')](user[_0xd8c9('0xb')]())['then'](realtime[_0xd8c9('0xc')]())[_0xd8c9('0xa')](interval[_0xd8c9('0xd')]())[_0xd8c9('0xa')](realtime[_0xd8c9('0xe')]())[_0xd8c9('0xa')](openchannelQueue[_0xd8c9('0xf')]())[_0xd8c9('0xa')](realtime['initOpenchannelQueues']())[_0xd8c9('0xa')](chatQueue[_0xd8c9('0x10')]())[_0xd8c9('0xa')](realtime[_0xd8c9('0x11')]())['then'](smsQueue['getSmsQueues']())[_0xd8c9('0xa')](realtime['initSmsQueues']())[_0xd8c9('0xa')](mailQueue[_0xd8c9('0x12')]())[_0xd8c9('0xa')](realtime[_0xd8c9('0x13')]())[_0xd8c9('0xa')](faxQueue[_0xd8c9('0x14')]())['then'](realtime[_0xd8c9('0x15')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xd8c9('0xa')](realtime[_0xd8c9('0x16')]())[_0xd8c9('0xa')](function(){return realtime;});}function main(){return server[_0xd8c9('0x17')](realtime)[_0xd8c9('0xa')](function(_0x318204){return initRealtime();})[_0xd8c9('0xa')](function(_0x4e13ea){return setInterval(initRealtime,0x1388);})[_0xd8c9('0x18')](function(_0x1afcad){console['log'](_0x1afcad);});}main(); \ No newline at end of file +var _0x7f1b=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','initFaxQueues','getWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x2ce4bb,_0x4bc632){var _0x19356b=function(_0x47137b){while(--_0x47137b){_0x2ce4bb['push'](_0x2ce4bb['shift']());}};_0x19356b(++_0x4bc632);}(_0x7f1b,0x133));var _0xb7f1=function(_0x12cf98,_0x30b6ae){_0x12cf98=_0x12cf98-0x0;var _0x50fea8=_0x7f1b[_0x12cf98];return _0x50fea8;};'use strict';var BPromise=require(_0xb7f1('0x0'));var server=require(_0xb7f1('0x1'));var Realtime=require(_0xb7f1('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0xb7f1('0x3'));var chatQueue=require(_0xb7f1('0x4'));var smsQueue=require(_0xb7f1('0x5'));var mailQueue=require(_0xb7f1('0x6'));var faxQueue=require(_0xb7f1('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xb7f1('0x8')](user[_0xb7f1('0x9')]())['then'](realtime[_0xb7f1('0xa')]())['then'](interval[_0xb7f1('0xb')]())[_0xb7f1('0x8')](realtime[_0xb7f1('0xc')]())[_0xb7f1('0x8')](openchannelQueue[_0xb7f1('0xd')]())[_0xb7f1('0x8')](realtime[_0xb7f1('0xe')]())[_0xb7f1('0x8')](chatQueue[_0xb7f1('0xf')]())[_0xb7f1('0x8')](realtime[_0xb7f1('0x10')]())[_0xb7f1('0x8')](smsQueue[_0xb7f1('0x11')]())['then'](realtime[_0xb7f1('0x12')]())[_0xb7f1('0x8')](mailQueue['getMailQueues']())['then'](realtime[_0xb7f1('0x13')]())['then'](faxQueue['getFaxQueues']())[_0xb7f1('0x8')](realtime[_0xb7f1('0x14')]())[_0xb7f1('0x8')](whatsappQueue[_0xb7f1('0x15')]())[_0xb7f1('0x8')](realtime['initWhatsappQueues']())[_0xb7f1('0x8')](function(){return realtime;});}function main(){return server[_0xb7f1('0x16')](realtime)[_0xb7f1('0x8')](function(_0x8f3794){return initRealtime();})[_0xb7f1('0x8')](function(_0x5a29d5){return setInterval(initRealtime,0x1388);})[_0xb7f1('0x17')](function(_0x6b8110){console['log'](_0x6b8110);});}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 a086af7..052627a 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x4a8378,_0x57627b){var _0xf67798=function(_0x3a58fd){while(--_0x3a58fd){_0x4a8378['push'](_0x4a8378['shift']());}};_0xf67798(++_0x57627b);}(_0xe14b,0x93));var _0xbe14=function(_0x67126c,_0x4ccffc){_0x67126c=_0x67126c-0x0;var _0x442091=_0xe14b[_0x67126c];return _0x442091;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x16d644,_0x46545e){var _0xf808cc=function(_0x4024ef){while(--_0x4024ef){_0x16d644['push'](_0x16d644['shift']());}};_0xf808cc(++_0x46545e);}(_0x326f,0xd1));var _0xf326=function(_0x1bcec4,_0x31b398){_0x1bcec4=_0x1bcec4-0x0;var _0x484516=_0x326f[_0x1bcec4];return _0x484516;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 992189e..5f9466b 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 _0xaf01=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request','then','error'];(function(_0x205db5,_0x5ae499){var _0x530649=function(_0x28a350){while(--_0x28a350){_0x205db5['push'](_0x205db5['shift']());}};_0x530649(++_0x5ae499);}(_0xaf01,0xc0));var _0x1af0=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xaf01[_0x49b207];return _0x2dc8fa;};'use strict';var BPromise=require(_0x1af0('0x0'));var jayson=require(_0x1af0('0x1'));var client=jayson['client'][_0x1af0('0x2')]({'port':0x232b});function request(_0x3f51cf,_0xd24604){return new BPromise(function(_0x4b2cce,_0x49cbd2){return client[_0x1af0('0x3')](_0x3f51cf,_0xd24604)[_0x1af0('0x4')](function(_0x47b680){if(_0x47b680[_0x1af0('0x5')]){return _0x49cbd2(_0x47b680['error']['message']);}else{return _0x4b2cce(_0x47b680['result']);}})[_0x1af0('0x6')](function(_0x124a92){return _0x49cbd2(_0x124a92);});});}exports[_0x1af0('0x7')]=function(_0x57aca7,_0x31dffd){return request(_0x1af0('0x8'),{'account':_0x57aca7,'message':_0x31dffd});}; \ No newline at end of file +var _0xe99e=['jayson/promise','client','http','request','then','error','message','result','sendMailMessage','bluebird'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xe99e,0x1df));var _0xee99=function(_0x10a467,_0x4f75be){_0x10a467=_0x10a467-0x0;var _0x39bcbb=_0xe99e[_0x10a467];return _0x39bcbb;};'use strict';var BPromise=require(_0xee99('0x0'));var jayson=require(_0xee99('0x1'));var client=jayson[_0xee99('0x2')][_0xee99('0x3')]({'port':0x232b});function request(_0x4ea0a2,_0x366778){return new BPromise(function(_0x423943,_0x31862f){return client[_0xee99('0x4')](_0x4ea0a2,_0x366778)[_0xee99('0x5')](function(_0xf68264){if(_0xf68264[_0xee99('0x6')]){return _0x31862f(_0xf68264[_0xee99('0x6')][_0xee99('0x7')]);}else{return _0x423943(_0xf68264[_0xee99('0x8')]);}})['catch'](function(_0x310d62){return _0x31862f(_0x310d62);});});}exports[_0xee99('0x9')]=function(_0x16c2dd,_0x41be43){return request('SendMail',{'account':_0x16c2dd,'message':_0x41be43});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 02ca111..a41228d 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 _0x8aad=['mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','mailPause','mailCurrentCapacity','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','faxWaitingInteractions','whatsappWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus'];(function(_0x4f7a18,_0x5b58f1){var _0xdf7def=function(_0x4d534a){while(--_0x4d534a){_0x4f7a18['push'](_0x4f7a18['shift']());}};_0xdf7def(++_0x5b58f1);}(_0x8aad,0x146));var _0xd8aa=function(_0x453e52,_0x5d59ac){_0x453e52=_0x453e52-0x0;var _0x16cffb=_0x8aad[_0x453e52];return _0x16cffb;};'use strict';var _=require(_0xd8aa('0x0'));var md5=require(_0xd8aa('0x1'));var moment=require('moment');var Redis=require(_0xd8aa('0x2'));var config=require('../../../config/environment');config[_0xd8aa('0x3')]=_[_0xd8aa('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd8aa('0x5'))(new Redis(config['redis']));function Agent(_0x53248c){this['id']=_0x53248c['id']||0x0;this[_0xd8aa('0x6')]=_0x53248c[_0xd8aa('0x6')]||'';this[_0xd8aa('0x7')]=_0x53248c['online']||!![];this[_0xd8aa('0x8')]=_0x53248c[_0xd8aa('0x8')]||![];this[_0xd8aa('0x9')]=_0x53248c[_0xd8aa('0x9')]||![];this['mailPause']=_0x53248c['mailPause']||![];this[_0xd8aa('0xa')]=_0x53248c[_0xd8aa('0xa')]||![];this[_0xd8aa('0xb')]=_0x53248c[_0xd8aa('0xb')]||![];this[_0xd8aa('0xc')]=_0x53248c['openchannelPause']||![];this[_0xd8aa('0xd')]=_0xd8aa('0xe');this[_0xd8aa('0xf')]=0x0;this[_0xd8aa('0x10')]=_0x53248c[_0xd8aa('0x10')]||0x0;this[_0xd8aa('0x11')]=0x0;this[_0xd8aa('0x12')]=_0xd8aa('0xe');this[_0xd8aa('0x13')]=0x0;this[_0xd8aa('0x14')]=_0x53248c['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0xd8aa('0x15')]=_0xd8aa('0xe');this[_0xd8aa('0x16')]=0x0;this['faxCapacity']=_0x53248c[_0xd8aa('0x17')]||0x0;this[_0xd8aa('0x18')]=0x0;this[_0xd8aa('0x19')]=_0xd8aa('0xe');this['smsStatusTime']=0x0;this[_0xd8aa('0x1a')]=_0x53248c[_0xd8aa('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xd8aa('0x1b')]=_0xd8aa('0xe');this[_0xd8aa('0x1c')]=0x0;this[_0xd8aa('0x1d')]=_0x53248c[_0xd8aa('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xd8aa('0x1e')]=_0xd8aa('0xe');this[_0xd8aa('0x1f')]=0x0;this[_0xd8aa('0x20')]=_0x53248c['openchannelCapacity']||0x0;this[_0xd8aa('0x21')]=0x0;this[_0xd8aa('0x22')]=![];this[_0xd8aa('0x23')]=undefined;this[_0xd8aa('0x1')]='';this[_0xd8aa('0x24')]={};this['faxWaitingInteractions']={};this[_0xd8aa('0x25')]={};this[_0xd8aa('0x26')]={};this[_0xd8aa('0x27')]={};this['whatsappWaitingInteractions']={};this[_0xd8aa('0x28')]();}Agent[_0xd8aa('0x29')][_0xd8aa('0x2a')]=function(_0x290849){if(this[_0x290849+_0xd8aa('0x2b')]>0x0){if(this[_0x290849+_0xd8aa('0x2c')]>0x0&&this[_0x290849+_0xd8aa('0x2b')]>=this[_0x290849+_0xd8aa('0x2c')]){return _0xd8aa('0x2d');}else{return _0xd8aa('0x2e');}}else{return _0xd8aa('0x2f');}};Agent[_0xd8aa('0x29')][_0xd8aa('0x28')]=function(){var _0x5f1027=[_0xd8aa('0x30'),_0xd8aa('0x31'),_0xd8aa('0x32'),_0xd8aa('0x33'),_0xd8aa('0x34'),_0xd8aa('0x35')];for(var _0x26ab06=0x0;_0x26ab06<_0x5f1027[_0xd8aa('0x36')];_0x26ab06+=0x1){var _0x3bba1d=this[_0xd8aa('0x2a')](_0x5f1027[_0x26ab06]);if(this[_0x5f1027[_0x26ab06]+'Status']!==_0x3bba1d){this[_0x5f1027[_0x26ab06]+_0xd8aa('0x37')]=_[_0xd8aa('0x38')](moment()[_0xd8aa('0x39')]('x'));}this[_0x5f1027[_0x26ab06]+'Status']=_0x3bba1d;}var _0x19a59d={'id':this['id'],'name':this['name'],'online':this[_0xd8aa('0x7')],'voicePause':this[_0xd8aa('0x8')],'chatPause':this[_0xd8aa('0x9')],'mailPause':this[_0xd8aa('0x3a')],'smsPause':this[_0xd8aa('0xb')],'faxPause':this[_0xd8aa('0xa')],'openchannelPause':this[_0xd8aa('0xc')],'chatStatus':this[_0xd8aa('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd8aa('0x10')],'chatCurrentCapacity':this[_0xd8aa('0x11')],'mailStatus':this[_0xd8aa('0x12')],'mailStatusTime':this[_0xd8aa('0x13')],'mailCapacity':this[_0xd8aa('0x14')],'mailCurrentCapacity':this[_0xd8aa('0x3b')],'faxStatus':this[_0xd8aa('0x15')],'faxStatusTime':this[_0xd8aa('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xd8aa('0x18')],'smsStatus':this[_0xd8aa('0x19')],'smsStatusTime':this[_0xd8aa('0x3c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xd8aa('0x3d')],'whatsappStatus':this[_0xd8aa('0x1b')],'whatsappStatusTime':this[_0xd8aa('0x1c')],'whatsappCapacity':this[_0xd8aa('0x1d')],'whatsappCurrentCapacity':this[_0xd8aa('0x3e')],'openchannelStatus':this[_0xd8aa('0x1e')],'openchannelStatusTime':this[_0xd8aa('0x1f')],'openchannelCapacity':this[_0xd8aa('0x20')],'openchannelCurrentCapacity':this[_0xd8aa('0x21')],'busy':this['busy'],'busyQueue':this[_0xd8aa('0x23')],'chatWaitingInteractions':this[_0xd8aa('0x24')],'faxWaitingInteractions':this[_0xd8aa('0x3f')],'mailWaitingInteractions':this[_0xd8aa('0x25')],'openchannelWaitingInteractions':this[_0xd8aa('0x26')],'smsWaitingInteractions':this[_0xd8aa('0x27')],'whatsappWaitingInteractions':this[_0xd8aa('0x40')]};var _0x30b0c4=md5(JSON[_0xd8aa('0x41')](_0x19a59d));if(this['md5']!==_0x30b0c4){this[_0xd8aa('0x1')]=_0x30b0c4;io['emit'](_0xd8aa('0x42'),_[_0xd8aa('0x43')](_0x19a59d,['online']));}};module[_0xd8aa('0x44')]=Agent; \ No newline at end of file +var _0x1a37=['faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatPause','chatStatusTime','smsStatus','whatsappStatusTime','busy','openchannelWaitingInteractions','whatsappWaitingInteractions','stringify','emit','user:routing:update','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity'];(function(_0x4fb7c1,_0xc70ccf){var _0x14d64c=function(_0x49f95d){while(--_0x49f95d){_0x4fb7c1['push'](_0x4fb7c1['shift']());}};_0x14d64c(++_0xc70ccf);}(_0x1a37,0xb4));var _0x71a3=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x1a37[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x71a3('0x0'));var md5=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var Redis=require(_0x71a3('0x3'));var config=require(_0x71a3('0x4'));config[_0x71a3('0x5')]=_[_0x71a3('0x6')](config[_0x71a3('0x5')],{'host':_0x71a3('0x7'),'port':0x18eb});var io=require(_0x71a3('0x8'))(new Redis(config['redis']));function Agent(_0x11e8a8){this['id']=_0x11e8a8['id']||0x0;this['name']=_0x11e8a8[_0x71a3('0x9')]||'';this[_0x71a3('0xa')]=_0x11e8a8[_0x71a3('0xa')]||!![];this[_0x71a3('0xb')]=_0x11e8a8['voicePause']||![];this['chatPause']=_0x11e8a8['chatPause']||![];this['mailPause']=_0x11e8a8[_0x71a3('0xc')]||![];this[_0x71a3('0xd')]=_0x11e8a8[_0x71a3('0xd')]||![];this[_0x71a3('0xe')]=_0x11e8a8[_0x71a3('0xe')]||![];this[_0x71a3('0xf')]=_0x11e8a8[_0x71a3('0xf')]||![];this[_0x71a3('0x10')]='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x11e8a8[_0x71a3('0x11')]||0x0;this[_0x71a3('0x12')]=0x0;this[_0x71a3('0x13')]=_0x71a3('0x14');this[_0x71a3('0x15')]=0x0;this[_0x71a3('0x16')]=_0x11e8a8[_0x71a3('0x16')]||0x0;this[_0x71a3('0x17')]=0x0;this[_0x71a3('0x18')]=_0x71a3('0x14');this[_0x71a3('0x19')]=0x0;this['faxCapacity']=_0x11e8a8[_0x71a3('0x1a')]||0x0;this[_0x71a3('0x1b')]=0x0;this['smsStatus']='unknown';this[_0x71a3('0x1c')]=0x0;this[_0x71a3('0x1d')]=_0x11e8a8[_0x71a3('0x1d')]||0x0;this[_0x71a3('0x1e')]=0x0;this[_0x71a3('0x1f')]=_0x71a3('0x14');this['whatsappStatusTime']=0x0;this[_0x71a3('0x20')]=_0x11e8a8[_0x71a3('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x71a3('0x14');this[_0x71a3('0x21')]=0x0;this[_0x71a3('0x22')]=_0x11e8a8[_0x71a3('0x22')]||0x0;this[_0x71a3('0x23')]=0x0;this['busy']=![];this[_0x71a3('0x24')]=undefined;this[_0x71a3('0x1')]='';this[_0x71a3('0x25')]={};this[_0x71a3('0x26')]={};this[_0x71a3('0x27')]={};this['openchannelWaitingInteractions']={};this[_0x71a3('0x28')]={};this['whatsappWaitingInteractions']={};this[_0x71a3('0x29')]();}Agent[_0x71a3('0x2a')][_0x71a3('0x2b')]=function(_0x21899d){if(this[_0x21899d+_0x71a3('0x2c')]>0x0){if(this[_0x21899d+_0x71a3('0x2d')]>0x0&&this[_0x21899d+'CurrentCapacity']>=this[_0x21899d+_0x71a3('0x2d')]){return _0x71a3('0x2e');}else{return _0x71a3('0x2f');}}else{return _0x71a3('0x30');}};Agent[_0x71a3('0x2a')]['updateRealtime']=function(){var _0x107fbd=[_0x71a3('0x31'),'chat',_0x71a3('0x32'),'fax',_0x71a3('0x33'),_0x71a3('0x34')];for(var _0x211ea8=0x0;_0x211ea8<_0x107fbd[_0x71a3('0x35')];_0x211ea8+=0x1){var _0x25f351=this[_0x71a3('0x2b')](_0x107fbd[_0x211ea8]);if(this[_0x107fbd[_0x211ea8]+_0x71a3('0x36')]!==_0x25f351){this[_0x107fbd[_0x211ea8]+_0x71a3('0x37')]=_[_0x71a3('0x38')](moment()[_0x71a3('0x39')]('x'));}this[_0x107fbd[_0x211ea8]+_0x71a3('0x36')]=_0x25f351;}var _0x228afa={'id':this['id'],'name':this['name'],'online':this[_0x71a3('0xa')],'voicePause':this[_0x71a3('0xb')],'chatPause':this[_0x71a3('0x3a')],'mailPause':this[_0x71a3('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x71a3('0xd')],'openchannelPause':this[_0x71a3('0xf')],'chatStatus':this[_0x71a3('0x10')],'chatStatusTime':this[_0x71a3('0x3b')],'chatCapacity':this[_0x71a3('0x11')],'chatCurrentCapacity':this[_0x71a3('0x12')],'mailStatus':this[_0x71a3('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x71a3('0x16')],'mailCurrentCapacity':this[_0x71a3('0x17')],'faxStatus':this[_0x71a3('0x18')],'faxStatusTime':this[_0x71a3('0x19')],'faxCapacity':this[_0x71a3('0x1a')],'faxCurrentCapacity':this[_0x71a3('0x1b')],'smsStatus':this[_0x71a3('0x3c')],'smsStatusTime':this[_0x71a3('0x1c')],'smsCapacity':this[_0x71a3('0x1d')],'smsCurrentCapacity':this[_0x71a3('0x1e')],'whatsappStatus':this[_0x71a3('0x1f')],'whatsappStatusTime':this[_0x71a3('0x3d')],'whatsappCapacity':this[_0x71a3('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x71a3('0x21')],'openchannelCapacity':this[_0x71a3('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x71a3('0x3e')],'busyQueue':this[_0x71a3('0x24')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x71a3('0x26')],'mailWaitingInteractions':this[_0x71a3('0x27')],'openchannelWaitingInteractions':this[_0x71a3('0x3f')],'smsWaitingInteractions':this[_0x71a3('0x28')],'whatsappWaitingInteractions':this[_0x71a3('0x40')]};var _0x255098=md5(JSON[_0x71a3('0x41')](_0x228afa));if(this['md5']!==_0x255098){this[_0x71a3('0x1')]=_0x255098;io[_0x71a3('0x42')](_0x71a3('0x43'),_['omit'](_0x228afa,[_0x71a3('0xa')]));}};module[_0x71a3('0x44')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 481e77d..322bda3 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 _0x8a1a=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','paused','online','loggedIn','available','stringify','chat:queue:%s','emit','chat_queue:save','lodash','md5','util'];(function(_0x218424,_0x4beac7){var _0x450c16=function(_0x367ea0){while(--_0x367ea0){_0x218424['push'](_0x218424['shift']());}};_0x450c16(++_0x4beac7);}(_0x8a1a,0x115));var _0xa8a1=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x8a1a[_0x13524d];return _0x9918b4;};'use strict';var _=require(_0xa8a1('0x0'));var md5=require(_0xa8a1('0x1'));var util=require(_0xa8a1('0x2'));var Redis=require('ioredis');var config=require(_0xa8a1('0x3'));config[_0xa8a1('0x4')]=_[_0xa8a1('0x5')](config[_0xa8a1('0x4')],{'host':_0xa8a1('0x6'),'port':0x18eb});var io=require(_0xa8a1('0x7'))(new Redis(config[_0xa8a1('0x4')]));function ChatQueue(_0x1fface){this['id']=_0x1fface['id']||0x0;this[_0xa8a1('0x8')]=_0x1fface[_0xa8a1('0x8')]||'';this[_0xa8a1('0x9')]=_0x1fface['timeout']||0xa;this['strategy']=_0x1fface[_0xa8a1('0xa')]||_0xa8a1('0xb');this[_0xa8a1('0xc')]=_0x1fface['Agents'];this['mapAgentsId']={};this[_0xa8a1('0xd')]=0x0;this['md5']='';this[_0xa8a1('0xe')]();this[_0xa8a1('0xf')]();}ChatQueue[_0xa8a1('0x10')][_0xa8a1('0xe')]=function(){var _0x311c3a=this['mapAgentsId'][_0xa8a1('0x11')];this[_0xa8a1('0x12')]=_[_0xa8a1('0x13')](this['Agents'],'id');this[_0xa8a1('0x12')]['_rr']=_0x311c3a;};ChatQueue['prototype'][_0xa8a1('0xf')]=function(){this['loggedIn']=0x0;this[_0xa8a1('0x14')]=0x0;for(var _0x1b0a47=0x0;_0x1b0a47=0x0?this[_0xa8a1('0x17')]:0x0;var _0x3bd0a4={'id':this['id'],'available':this[_0xa8a1('0x17')],'loggedIn':this[_0xa8a1('0x16')],'name':this[_0xa8a1('0x8')],'paused':this[_0xa8a1('0x14')],'waiting':this[_0xa8a1('0xd')]};var _0x27ac5d=md5(JSON[_0xa8a1('0x18')](_0x3bd0a4));if(this[_0xa8a1('0x1')]!==_0x27ac5d){this[_0xa8a1('0x1')]=_0x27ac5d;io['to'](util['format'](_0xa8a1('0x19'),_0x3bd0a4[_0xa8a1('0x8')]))[_0xa8a1('0x1a')](_0xa8a1('0x1b'),_0x3bd0a4);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x1d18=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','paused','available','loggedIn','name','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5'];(function(_0x1a968e,_0x3f45f4){var _0x2c7b23=function(_0xc1e5c4){while(--_0xc1e5c4){_0x1a968e['push'](_0x1a968e['shift']());}};_0x2c7b23(++_0x3f45f4);}(_0x1d18,0x1da));var _0x81d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x81d1('0x0'));var md5=require(_0x81d1('0x1'));var util=require(_0x81d1('0x2'));var Redis=require(_0x81d1('0x3'));var config=require(_0x81d1('0x4'));config[_0x81d1('0x5')]=_[_0x81d1('0x6')](config[_0x81d1('0x5')],{'host':_0x81d1('0x7'),'port':0x18eb});var io=require(_0x81d1('0x8'))(new Redis(config['redis']));function ChatQueue(_0x26c605){this['id']=_0x26c605['id']||0x0;this['name']=_0x26c605['name']||'';this[_0x81d1('0x9')]=_0x26c605[_0x81d1('0x9')]||0xa;this['strategy']=_0x26c605[_0x81d1('0xa')]||_0x81d1('0xb');this[_0x81d1('0xc')]=_0x26c605['Agents'];this[_0x81d1('0xd')]={};this['waiting']=0x0;this[_0x81d1('0x1')]='';this[_0x81d1('0xe')]();this[_0x81d1('0xf')]();}ChatQueue[_0x81d1('0x10')][_0x81d1('0xe')]=function(){var _0x134d7b=this[_0x81d1('0xd')]['_rr'];this[_0x81d1('0xd')]=_[_0x81d1('0x11')](this[_0x81d1('0xc')],'id');this[_0x81d1('0xd')]['_rr']=_0x134d7b;};ChatQueue[_0x81d1('0x10')][_0x81d1('0xf')]=function(){this['loggedIn']=0x0;this[_0x81d1('0x12')]=0x0;for(var _0x3aa2f9=0x0;_0x3aa2f9=0x0?this['available']:0x0;var _0x22053f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x81d1('0x15')],'paused':this[_0x81d1('0x12')],'waiting':this[_0x81d1('0x16')]};var _0x18abd2=md5(JSON[_0x81d1('0x17')](_0x22053f));if(this[_0x81d1('0x1')]!==_0x18abd2){this[_0x81d1('0x1')]=_0x18abd2;io['to'](util[_0x81d1('0x18')](_0x81d1('0x19'),_0x22053f['name']))[_0x81d1('0x1a')](_0x81d1('0x1b'),_0x22053f);}};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 5d5eb52..781cbd9 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 _0x7abe=['fax:queue:%s','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','available','stringify','format'];(function(_0x4cf628,_0x56c30f){var _0x44d7f3=function(_0x194ee9){while(--_0x194ee9){_0x4cf628['push'](_0x4cf628['shift']());}};_0x44d7f3(++_0x56c30f);}(_0x7abe,0x161));var _0xe7ab=function(_0x3f6527,_0x4b541a){_0x3f6527=_0x3f6527-0x0;var _0x129de2=_0x7abe[_0x3f6527];return _0x129de2;};'use strict';var _=require(_0xe7ab('0x0'));var md5=require('md5');var util=require(_0xe7ab('0x1'));var Redis=require('ioredis');var config=require(_0xe7ab('0x2'));config[_0xe7ab('0x3')]=_[_0xe7ab('0x4')](config['redis'],{'host':_0xe7ab('0x5'),'port':0x18eb});var io=require(_0xe7ab('0x6'))(new Redis(config[_0xe7ab('0x3')]));function FaxQueue(_0x3800b7){this['id']=_0x3800b7['id']||0x0;this[_0xe7ab('0x7')]=_0x3800b7[_0xe7ab('0x7')]||'';this[_0xe7ab('0x8')]=_0x3800b7['timeout']||0xa;this['strategy']=_0x3800b7['strategy']||_0xe7ab('0x9');this[_0xe7ab('0xa')]=_0x3800b7[_0xe7ab('0xa')];this[_0xe7ab('0xb')]={};this[_0xe7ab('0xc')]=0x0;this[_0xe7ab('0xd')]='';this[_0xe7ab('0xe')]();this['updateRealtime']();}FaxQueue['prototype'][_0xe7ab('0xe')]=function(){var _0x5f4c5d=this['mapAgentsId'][_0xe7ab('0xf')];this[_0xe7ab('0xb')]=_[_0xe7ab('0x10')](this['Agents'],'id');this[_0xe7ab('0xb')][_0xe7ab('0xf')]=_0x5f4c5d;};FaxQueue[_0xe7ab('0x11')][_0xe7ab('0x12')]=function(){this[_0xe7ab('0x13')]=0x0;this[_0xe7ab('0x14')]=0x0;for(var _0xa3514a=0x0;_0xa3514a=0x0?this[_0xe7ab('0x16')]:0x0;var _0xa0c33d={'id':this['id'],'available':this[_0xe7ab('0x16')],'loggedIn':this[_0xe7ab('0x13')],'name':this[_0xe7ab('0x7')],'paused':this[_0xe7ab('0x14')],'waiting':this[_0xe7ab('0xc')]};var _0x406a46=md5(JSON[_0xe7ab('0x17')](_0xa0c33d));if(this[_0xe7ab('0xd')]!==_0x406a46){this[_0xe7ab('0xd')]=_0x406a46;io['to'](util[_0xe7ab('0x18')](_0xe7ab('0x19'),_0xa0c33d[_0xe7ab('0x7')]))['emit']('fax_queue:save',_0xa0c33d);}};module[_0xe7ab('0x1a')]=FaxQueue; \ No newline at end of file +var _0x60d4=['defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','paused','faxPause','available','waiting','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','redis'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x60d4,0xf6));var _0x460d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x60d4[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x460d('0x0'));var md5=require(_0x460d('0x1'));var util=require(_0x460d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x460d('0x3')]=_[_0x460d('0x4')](config['redis'],{'host':_0x460d('0x5'),'port':0x18eb});var io=require(_0x460d('0x6'))(new Redis(config[_0x460d('0x3')]));function FaxQueue(_0x174e71){this['id']=_0x174e71['id']||0x0;this[_0x460d('0x7')]=_0x174e71[_0x460d('0x7')]||'';this[_0x460d('0x8')]=_0x174e71[_0x460d('0x8')]||0xa;this[_0x460d('0x9')]=_0x174e71[_0x460d('0x9')]||'beepall';this[_0x460d('0xa')]=_0x174e71[_0x460d('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x460d('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype'][_0x460d('0xb')]=function(){var _0x2ad283=this[_0x460d('0xc')][_0x460d('0xd')];this[_0x460d('0xc')]=_[_0x460d('0xe')](this[_0x460d('0xa')],'id');this[_0x460d('0xc')]['_rr']=_0x2ad283;};FaxQueue[_0x460d('0xf')]['updateRealtime']=function(){this[_0x460d('0x10')]=0x0;this[_0x460d('0x11')]=0x0;for(var _0x5c00c1=0x0;_0x5c00c1=0x0?this['available']:0x0;var _0x4550ce={'id':this['id'],'available':this[_0x460d('0x13')],'loggedIn':this[_0x460d('0x10')],'name':this[_0x460d('0x7')],'paused':this[_0x460d('0x11')],'waiting':this[_0x460d('0x14')]};var _0x113c57=md5(JSON['stringify'](_0x4550ce));if(this['md5']!==_0x113c57){this[_0x460d('0x1')]=_0x113c57;io['to'](util['format'](_0x460d('0x15'),_0x4550ce[_0x460d('0x7')]))[_0x460d('0x16')](_0x460d('0x17'),_0x4550ce);}};module[_0x460d('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b2bdc1f..31ff46b 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 _0x4702=['name','Intervals','exports'];(function(_0x2ae278,_0x5eb5a4){var _0x412c37=function(_0xcaab64){while(--_0xcaab64){_0x2ae278['push'](_0x2ae278['shift']());}};_0x412c37(++_0x5eb5a4);}(_0x4702,0x120));var _0x2470=function(_0x585551,_0x489080){_0x585551=_0x585551-0x0;var _0x55c80b=_0x4702[_0x585551];return _0x55c80b;};'use strict';function Interval(_0x4c9b49){this['id']=_0x4c9b49['id']||0x0;this[_0x2470('0x0')]=_0x4c9b49['name']||'';this[_0x2470('0x1')]=_0x4c9b49[_0x2470('0x1')]||{};}module[_0x2470('0x2')]=Interval; \ No newline at end of file +var _0xe6b4=['name','Intervals','exports'];(function(_0x28e8d0,_0x56de18){var _0x32ecef=function(_0x45e0f7){while(--_0x45e0f7){_0x28e8d0['push'](_0x28e8d0['shift']());}};_0x32ecef(++_0x56de18);}(_0xe6b4,0x147));var _0x4e6b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe6b4[_0x3ab51d];return _0x29a04e;};'use strict';function Interval(_0x4f53a7){this['id']=_0x4f53a7['id']||0x0;this[_0x4e6b('0x0')]=_0x4f53a7[_0x4e6b('0x0')]||'';this['Intervals']=_0x4f53a7[_0x4e6b('0x1')]||{};}module[_0x4e6b('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 4cbe091..5a8579e 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 _0xe0e2=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','paused','length','online','loggedIn','mailPause','available','mail:queue:%s','emit','mail_queue:save','exports','lodash'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xe0e2,0x1b1));var _0x2e0e=function(_0x3bdc30,_0x119486){_0x3bdc30=_0x3bdc30-0x0;var _0x1a4986=_0xe0e2[_0x3bdc30];return _0x1a4986;};'use strict';var _=require(_0x2e0e('0x0'));var md5=require(_0x2e0e('0x1'));var util=require(_0x2e0e('0x2'));var Redis=require(_0x2e0e('0x3'));var config=require(_0x2e0e('0x4'));config[_0x2e0e('0x5')]=_[_0x2e0e('0x6')](config[_0x2e0e('0x5')],{'host':_0x2e0e('0x7'),'port':0x18eb});var io=require(_0x2e0e('0x8'))(new Redis(config[_0x2e0e('0x5')]));function MailQueue(_0x791cb1){this['id']=_0x791cb1['id']||0x0;this[_0x2e0e('0x9')]=_0x791cb1['name']||'';this[_0x2e0e('0xa')]=_0x791cb1['timeout']||0xa;this[_0x2e0e('0xb')]=_0x791cb1[_0x2e0e('0xb')]||_0x2e0e('0xc');this[_0x2e0e('0xd')]=_0x791cb1[_0x2e0e('0xd')];this[_0x2e0e('0xe')]={};this[_0x2e0e('0xf')]=0x0;this[_0x2e0e('0x1')]='';this[_0x2e0e('0x10')]();this[_0x2e0e('0x11')]();}MailQueue['prototype'][_0x2e0e('0x10')]=function(){var _0x24bc77=this['mapAgentsId'][_0x2e0e('0x12')];this[_0x2e0e('0xe')]=_[_0x2e0e('0x13')](this['Agents'],'id');this[_0x2e0e('0xe')]['_rr']=_0x24bc77;};MailQueue[_0x2e0e('0x14')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x2e0e('0x15')]=0x0;for(var _0x585b45=0x0;_0x585b45=0x0?this[_0x2e0e('0x1a')]:0x0;var _0x45d7df={'id':this['id'],'available':this[_0x2e0e('0x1a')],'loggedIn':this[_0x2e0e('0x18')],'name':this[_0x2e0e('0x9')],'paused':this[_0x2e0e('0x15')],'waiting':this[_0x2e0e('0xf')]};var _0x58aab3=md5(JSON['stringify'](_0x45d7df));if(this['md5']!==_0x58aab3){this[_0x2e0e('0x1')]=_0x58aab3;io['to'](util['format'](_0x2e0e('0x1b'),_0x45d7df[_0x2e0e('0x9')]))[_0x2e0e('0x1c')](_0x2e0e('0x1d'),_0x45d7df);}};module[_0x2e0e('0x1e')]=MailQueue; \ No newline at end of file +var _0xff4f=['Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','emit','mail_queue:save','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','strategy','beepall'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0xff4f,0x17c));var _0xfff4=function(_0x56f77f,_0x520fd7){_0x56f77f=_0x56f77f-0x0;var _0x23cab7=_0xff4f[_0x56f77f];return _0x23cab7;};'use strict';var _=require('lodash');var md5=require(_0xfff4('0x0'));var util=require(_0xfff4('0x1'));var Redis=require(_0xfff4('0x2'));var config=require(_0xfff4('0x3'));config[_0xfff4('0x4')]=_['defaults'](config[_0xfff4('0x4')],{'host':_0xfff4('0x5'),'port':0x18eb});var io=require(_0xfff4('0x6'))(new Redis(config[_0xfff4('0x4')]));function MailQueue(_0x346b26){this['id']=_0x346b26['id']||0x0;this[_0xfff4('0x7')]=_0x346b26[_0xfff4('0x7')]||'';this['timeout']=_0x346b26['timeout']||0xa;this['strategy']=_0x346b26[_0xfff4('0x8')]||_0xfff4('0x9');this[_0xfff4('0xa')]=_0x346b26[_0xfff4('0xa')];this[_0xfff4('0xb')]={};this[_0xfff4('0xc')]=0x0;this[_0xfff4('0x0')]='';this[_0xfff4('0xd')]();this['updateRealtime']();}MailQueue[_0xfff4('0xe')][_0xfff4('0xd')]=function(){var _0x383e7a=this[_0xfff4('0xb')][_0xfff4('0xf')];this[_0xfff4('0xb')]=_['map'](this['Agents'],'id');this[_0xfff4('0xb')][_0xfff4('0xf')]=_0x383e7a;};MailQueue[_0xfff4('0xe')]['updateRealtime']=function(){this[_0xfff4('0x10')]=0x0;this[_0xfff4('0x11')]=0x0;for(var _0x213148=0x0;_0x213148=0x0?this[_0xfff4('0x14')]:0x0;var _0x89712d={'id':this['id'],'available':this[_0xfff4('0x14')],'loggedIn':this[_0xfff4('0x10')],'name':this[_0xfff4('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x57687a=md5(JSON[_0xfff4('0x15')](_0x89712d));if(this[_0xfff4('0x0')]!==_0x57687a){this[_0xfff4('0x0')]=_0x57687a;io['to'](util[_0xfff4('0x16')](_0xfff4('0x17'),_0x89712d[_0xfff4('0x7')]))[_0xfff4('0x18')](_0xfff4('0x19'),_0x89712d);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 3dc3dd5..16a4ad5 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x326f,0xd1));var _0xf326=function(_0x294d35,_0x32f743){_0x294d35=_0x294d35-0x0;var _0x5e5cd3=_0x326f[_0x294d35];return _0x5e5cd3;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x1261,0x144));var _0x1126=function(_0xc051b2,_0x3d6d9d){_0xc051b2=_0xc051b2-0x0;var _0x599dc2=_0x1261[_0xc051b2];return _0x599dc2;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7e02a84..8456b85 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 _0x6a24=['name','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x30e4c8,_0x11b4e5){var _0x5b129d=function(_0x45cd55){while(--_0x45cd55){_0x30e4c8['push'](_0x30e4c8['shift']());}};_0x5b129d(++_0x11b4e5);}(_0x6a24,0xd1));var _0x46a2=function(_0x1e725e,_0x815936){_0x1e725e=_0x1e725e-0x0;var _0x2fdfe1=_0x6a24[_0x1e725e];return _0x2fdfe1;};'use strict';var _=require(_0x46a2('0x0'));var md5=require(_0x46a2('0x1'));var util=require('util');var Redis=require(_0x46a2('0x2'));var config=require(_0x46a2('0x3'));config[_0x46a2('0x4')]=_[_0x46a2('0x5')](config[_0x46a2('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x46a2('0x6'))(new Redis(config[_0x46a2('0x4')]));function SmsQueue(_0x4f6948){this['id']=_0x4f6948['id']||0x0;this[_0x46a2('0x7')]=_0x4f6948[_0x46a2('0x7')]||'';this['timeout']=_0x4f6948['timeout']||0xa;this[_0x46a2('0x8')]=_0x4f6948[_0x46a2('0x8')]||'beepall';this[_0x46a2('0x9')]=_0x4f6948['Agents'];this[_0x46a2('0xa')]={};this['waiting']=0x0;this[_0x46a2('0x1')]='';this[_0x46a2('0xb')]();this[_0x46a2('0xc')]();}SmsQueue[_0x46a2('0xd')][_0x46a2('0xb')]=function(){var _0x40ef63=this[_0x46a2('0xa')][_0x46a2('0xe')];this['mapAgentsId']=_['map'](this[_0x46a2('0x9')],'id');this[_0x46a2('0xa')]['_rr']=_0x40ef63;};SmsQueue[_0x46a2('0xd')][_0x46a2('0xc')]=function(){this[_0x46a2('0xf')]=0x0;this[_0x46a2('0x10')]=0x0;for(var _0xddc328=0x0;_0xddc328=0x0?this['available']:0x0;var _0x27250b={'id':this['id'],'available':this[_0x46a2('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x46a2('0x7')],'paused':this[_0x46a2('0x10')],'waiting':this[_0x46a2('0x14')]};var _0xc28d15=md5(JSON[_0x46a2('0x15')](_0x27250b));if(this[_0x46a2('0x1')]!==_0xc28d15){this[_0x46a2('0x1')]=_0xc28d15;io['to'](util[_0x46a2('0x16')](_0x46a2('0x17'),_0x27250b[_0x46a2('0x7')]))[_0x46a2('0x18')](_0x46a2('0x19'),_0x27250b);}};module[_0x46a2('0x1a')]=SmsQueue; \ No newline at end of file +var _0x4f17=['_rr','map','prototype','paused','online','loggedIn','smsPause','available','stringify','md5','format','sms:queue:%s','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId'];(function(_0x7f943a,_0x44ce53){var _0x5fa814=function(_0x3925dd){while(--_0x3925dd){_0x7f943a['push'](_0x7f943a['shift']());}};_0x5fa814(++_0x44ce53);}(_0x4f17,0x9e));var _0x74f1=function(_0x8e74c4,_0x4c3b72){_0x8e74c4=_0x8e74c4-0x0;var _0x50e53f=_0x4f17[_0x8e74c4];return _0x50e53f;};'use strict';var _=require(_0x74f1('0x0'));var md5=require('md5');var util=require(_0x74f1('0x1'));var Redis=require(_0x74f1('0x2'));var config=require('../../../config/environment');config[_0x74f1('0x3')]=_[_0x74f1('0x4')](config[_0x74f1('0x3')],{'host':_0x74f1('0x5'),'port':0x18eb});var io=require(_0x74f1('0x6'))(new Redis(config['redis']));function SmsQueue(_0x5e67b0){this['id']=_0x5e67b0['id']||0x0;this[_0x74f1('0x7')]=_0x5e67b0['name']||'';this[_0x74f1('0x8')]=_0x5e67b0['timeout']||0xa;this[_0x74f1('0x9')]=_0x5e67b0[_0x74f1('0x9')]||_0x74f1('0xa');this['Agents']=_0x5e67b0[_0x74f1('0xb')];this['mapAgentsId']={};this[_0x74f1('0xc')]=0x0;this['md5']='';this[_0x74f1('0xd')]();this[_0x74f1('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x28307c=this[_0x74f1('0xf')][_0x74f1('0x10')];this[_0x74f1('0xf')]=_[_0x74f1('0x11')](this[_0x74f1('0xb')],'id');this[_0x74f1('0xf')][_0x74f1('0x10')]=_0x28307c;};SmsQueue[_0x74f1('0x12')][_0x74f1('0xe')]=function(){this['loggedIn']=0x0;this[_0x74f1('0x13')]=0x0;for(var _0x4e156f=0x0;_0x4e156f=0x0?this['available']:0x0;var _0x1cc44b={'id':this['id'],'available':this[_0x74f1('0x17')],'loggedIn':this[_0x74f1('0x15')],'name':this[_0x74f1('0x7')],'paused':this[_0x74f1('0x13')],'waiting':this['waiting']};var _0x353918=md5(JSON[_0x74f1('0x18')](_0x1cc44b));if(this[_0x74f1('0x19')]!==_0x353918){this[_0x74f1('0x19')]=_0x353918;io['to'](util[_0x74f1('0x1a')](_0x74f1('0x1b'),_0x1cc44b['name']))['emit']('sms_queue:save',_0x1cc44b);}};module[_0x74f1('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1f5d774..35d625d 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 _0xcf92=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash'];(function(_0x27f92f,_0x2fa692){var _0x1a1729=function(_0x138ed4){while(--_0x138ed4){_0x27f92f['push'](_0x27f92f['shift']());}};_0x1a1729(++_0x2fa692);}(_0xcf92,0x95));var _0x2cf9=function(_0x3200ce,_0x48615a){_0x3200ce=_0x3200ce-0x0;var _0x3f766e=_0xcf92[_0x3200ce];return _0x3f766e;};'use strict';var _=require(_0x2cf9('0x0'));var md5=require(_0x2cf9('0x1'));var util=require(_0x2cf9('0x2'));var Redis=require(_0x2cf9('0x3'));var config=require(_0x2cf9('0x4'));config[_0x2cf9('0x5')]=_[_0x2cf9('0x6')](config[_0x2cf9('0x5')],{'host':_0x2cf9('0x7'),'port':0x18eb});var io=require(_0x2cf9('0x8'))(new Redis(config[_0x2cf9('0x5')]));function WhatsappQueue(_0x3d219f){this['id']=_0x3d219f['id']||0x0;this[_0x2cf9('0x9')]=_0x3d219f[_0x2cf9('0x9')]||'';this['timeout']=_0x3d219f[_0x2cf9('0xa')]||0xa;this['strategy']=_0x3d219f[_0x2cf9('0xb')]||'beepall';this[_0x2cf9('0xc')]=_0x3d219f[_0x2cf9('0xc')];this['mapAgentsId']={};this[_0x2cf9('0xd')]=0x0;this[_0x2cf9('0x1')]='';this[_0x2cf9('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x2cf9('0xf')][_0x2cf9('0xe')]=function(){var _0x56ced6=this[_0x2cf9('0x10')][_0x2cf9('0x11')];this[_0x2cf9('0x10')]=_[_0x2cf9('0x12')](this['Agents'],'id');this[_0x2cf9('0x10')]['_rr']=_0x56ced6;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x2cf9('0x13')]=0x0;this[_0x2cf9('0x14')]=0x0;for(var _0x5c91b1=0x0;_0x5c91b1=0x0?this['available']:0x0;var _0x308aec={'id':this['id'],'available':this[_0x2cf9('0x17')],'loggedIn':this[_0x2cf9('0x13')],'name':this[_0x2cf9('0x9')],'paused':this[_0x2cf9('0x14')],'waiting':this[_0x2cf9('0xd')]};var _0x390da2=md5(JSON[_0x2cf9('0x18')](_0x308aec));if(this[_0x2cf9('0x1')]!==_0x390da2){this[_0x2cf9('0x1')]=_0x390da2;io['to'](util[_0x2cf9('0x19')](_0x2cf9('0x1a'),_0x308aec[_0x2cf9('0x9')]))[_0x2cf9('0x1b')](_0x2cf9('0x1c'),_0x308aec);}};module[_0x2cf9('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x2351=['available','stringify','format','whatsapp:queue:%s','name','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','whatsappPause'];(function(_0x4df28c,_0xc3cf35){var _0x5916cd=function(_0x53b03d){while(--_0x53b03d){_0x4df28c['push'](_0x4df28c['shift']());}};_0x5916cd(++_0xc3cf35);}(_0x2351,0x11e));var _0x1235=function(_0x57429e,_0xe23d13){_0x57429e=_0x57429e-0x0;var _0x25f76c=_0x2351[_0x57429e];return _0x25f76c;};'use strict';var _=require(_0x1235('0x0'));var md5=require(_0x1235('0x1'));var util=require(_0x1235('0x2'));var Redis=require('ioredis');var config=require(_0x1235('0x3'));config[_0x1235('0x4')]=_[_0x1235('0x5')](config[_0x1235('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x1235('0x6'))(new Redis(config[_0x1235('0x4')]));function WhatsappQueue(_0x4c001d){this['id']=_0x4c001d['id']||0x0;this['name']=_0x4c001d['name']||'';this[_0x1235('0x7')]=_0x4c001d[_0x1235('0x7')]||0xa;this[_0x1235('0x8')]=_0x4c001d[_0x1235('0x8')]||_0x1235('0x9');this[_0x1235('0xa')]=_0x4c001d[_0x1235('0xa')];this[_0x1235('0xb')]={};this[_0x1235('0xc')]=0x0;this[_0x1235('0x1')]='';this[_0x1235('0xd')]();this[_0x1235('0xe')]();}WhatsappQueue[_0x1235('0xf')][_0x1235('0xd')]=function(){var _0x252528=this[_0x1235('0xb')][_0x1235('0x10')];this['mapAgentsId']=_[_0x1235('0x11')](this[_0x1235('0xa')],'id');this[_0x1235('0xb')]['_rr']=_0x252528;};WhatsappQueue[_0x1235('0xf')]['updateRealtime']=function(){this[_0x1235('0x12')]=0x0;this[_0x1235('0x13')]=0x0;for(var _0x1cc1c3=0x0;_0x1cc1c3=0x0?this['available']:0x0;var _0x386da5={'id':this['id'],'available':this[_0x1235('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x1235('0x13')],'waiting':this[_0x1235('0xc')]};var _0x53affc=md5(JSON[_0x1235('0x17')](_0x386da5));if(this['md5']!==_0x53affc){this[_0x1235('0x1')]=_0x53affc;io['to'](util[_0x1235('0x18')](_0x1235('0x19'),_0x386da5[_0x1235('0x1a')]))['emit']('whatsapp_queue:save',_0x386da5);}};module[_0x1235('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 4118a3d..cfaea82 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x22a020,_0x5193a4){var _0x3afdc9=function(_0x1d4c16){while(--_0x1d4c16){_0x22a020['push'](_0x22a020['shift']());}};_0x3afdc9(++_0x5193a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xb10b[_0x50a0c2];return _0x5ebadd;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 aa7d6e3..33a3494 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 _0xc418=['update','Request','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x558165,_0xf5d905){var _0x41138d=function(_0x203da7){while(--_0x203da7){_0x558165['push'](_0x558165['shift']());}};_0x41138d(++_0xf5d905);}(_0xc418,0x1cc));var _0x8c41=function(_0x33fdfc,_0x7c0a3a){_0x33fdfc=_0x33fdfc-0x0;var _0xc0f0f1=_0xc418[_0x33fdfc];return _0xc0f0f1;};'use strict';var client=require('../client');exports[_0x8c41('0x0')]=function(_0x306b18,_0x939722){return client[_0x8c41('0x1')]('UpdateChatInteraction',{'body':_0x939722,'options':{'where':{'id':_0x306b18}},'log':_0x8c41('0x2')});};exports['addTags']=function(_0x295506,_0x1e633a){return client[_0x8c41('0x1')](_0x8c41('0x3'),{'body':_0x1e633a,'options':{'where':{'id':_0x295506}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x5530=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5530,0x12e));var _0x0553=function(_0x3cd2a1,_0x2e0aa3){_0x3cd2a1=_0x3cd2a1-0x0;var _0x1daa7e=_0x5530[_0x3cd2a1];return _0x1daa7e;};'use strict';var client=require('../client');exports[_0x0553('0x0')]=function(_0x554a0f,_0x56f57d){return client[_0x0553('0x1')](_0x0553('0x2'),{'body':_0x56f57d,'options':{'where':{'id':_0x554a0f}},'log':_0x0553('0x3')});};exports['addTags']=function(_0x114c5d,_0x2fc718){return client[_0x0553('0x1')](_0x0553('0x4'),{'body':_0x2fc718,'options':{'where':{'id':_0x114c5d}},'log':_0x0553('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 0b60bab..235ba7b 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 _0x3242=['create','Request','../client'];(function(_0x2c40bf,_0x5ce37a){var _0x31ab19=function(_0x56303){while(--_0x56303){_0x2c40bf['push'](_0x2c40bf['shift']());}};_0x31ab19(++_0x5ce37a);}(_0x3242,0x1be));var _0x2324=function(_0x3cf65f,_0x58fd7d){_0x3cf65f=_0x3cf65f-0x0;var _0x29ab47=_0x3242[_0x3cf65f];return _0x29ab47;};'use strict';var client=require(_0x2324('0x0'));exports[_0x2324('0x1')]=function(_0x1c248e){return client[_0x2324('0x2')]('CreateChatMessage',{'body':_0x1c248e,'log':'createChatMessage'});}; \ No newline at end of file +var _0x1304=['CreateChatMessage','createChatMessage'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x1304,0x1cc));var _0x4130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1304[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x441e53){return client['Request'](_0x4130('0x0'),{'body':_0x441e53,'log':_0x4130('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 06d041d..3800ec9 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 _0xa13d=['User','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue','timeout'];(function(_0x18da2d,_0x177ab1){var _0x4c8590=function(_0x2f8459){while(--_0x2f8459){_0x18da2d['push'](_0x18da2d['shift']());}};_0x4c8590(++_0x177ab1);}(_0xa13d,0x154));var _0xda13=function(_0xa92c15,_0x2ec505){_0xa92c15=_0xa92c15-0x0;var _0x395588=_0xa13d[_0xa92c15];return _0x395588;};'use strict';var client=require(_0xda13('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xda13('0x1')](_0xda13('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xda13('0x3'),'strategy'],'include':[{'model':_0xda13('0x4'),'as':_0xda13('0x5'),'attributes':['id','name','online',_0xda13('0x6')]}]},'log':_0xda13('0x7')});};}; \ No newline at end of file +var _0xf3cc=['getChatQueues','Request','GetChatQueue','timeout','strategy','User','name','online','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x150599,_0x3bdfb0){_0x150599=_0x150599-0x0;var _0x12c65f=_0xf3cc[_0x150599];return _0x12c65f;};'use strict';var client=require(_0xcf3c('0x0'));exports[_0xcf3c('0x1')]=function(){return function(){return client[_0xcf3c('0x2')](_0xcf3c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xcf3c('0x4'),_0xcf3c('0x5')],'include':[{'model':_0xcf3c('0x6'),'as':'Agents','attributes':['id',_0xcf3c('0x7'),_0xcf3c('0x8'),'chatPause']}]},'log':_0xcf3c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d43caab..c90113f 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 _0x1cc7=['update','UpdateChatQueueReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cc7,0x15a));var _0x71cc=function(_0x5d9f1e,_0x409ac7){_0x5d9f1e=_0x5d9f1e-0x0;var _0x1ee06b=_0x1cc7[_0x5d9f1e];return _0x1ee06b;};'use strict';var client=require(_0x71cc('0x0'));exports[_0x71cc('0x1')]=function(_0x7812aa){return client['Request']('CreateChatQueueReport',{'body':_0x7812aa,'log':'CreateChatQueueReport'});};exports[_0x71cc('0x2')]=function(_0x1fac93,_0x402191){return client['Request']('UpdateChatQueueReport',{'body':_0x402191,'options':{'where':{'uniqueid':_0x1fac93},'order':[['id','DESC']],'limit':0x1},'log':_0x71cc('0x3')});}; \ No newline at end of file +var _0x7217=['update','Request','UpdateChatQueueReport','DESC','CreateChatQueueReport'];(function(_0x5c543c,_0x1368b6){var _0x74c152=function(_0x20d712){while(--_0x20d712){_0x5c543c['push'](_0x5c543c['shift']());}};_0x74c152(++_0x1368b6);}(_0x7217,0xa9));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'use strict';var client=require('../client');exports['create']=function(_0x3f36a3){return client['Request'](_0x7721('0x0'),{'body':_0x3f36a3,'log':_0x7721('0x0')});};exports[_0x7721('0x1')]=function(_0x18353b,_0x363be8){return client[_0x7721('0x2')](_0x7721('0x3'),{'body':_0x363be8,'options':{'where':{'uniqueid':_0x18353b},'order':[['id',_0x7721('0x4')]],'limit':0x1},'log':_0x7721('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 20e0492..887e8e0 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(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x7a54,0x106));var _0x47a5=function(_0x3f9a71,_0x5b8939){_0x3f9a71=_0x3f9a71-0x0;var _0x10d1f1=_0x7a54[_0x3f9a71];return _0x10d1f1;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0x7a54,0x106));var _0x47a5=function(_0x4575ff,_0x1b57d4){_0x4575ff=_0x4575ff-0x0;var _0x122164=_0x7a54[_0x4575ff];return _0x122164;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2533b3d..aa278e6 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 _0x2a86=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x4a28b3,_0x1453f4){var _0x2793f3=function(_0x1195ea){while(--_0x1195ea){_0x4a28b3['push'](_0x4a28b3['shift']());}};_0x2793f3(++_0x1453f4);}(_0x2a86,0x122));var _0x62a8=function(_0x34667c,_0x1b3daf){_0x34667c=_0x34667c-0x0;var _0x60c5aa=_0x2a86[_0x34667c];return _0x60c5aa;};'use strict';var client=require(_0x62a8('0x0'));exports[_0x62a8('0x1')]=function(_0x44eca2){return client[_0x62a8('0x2')](_0x62a8('0x3'),{'body':_0x44eca2,'log':_0x62a8('0x4')});}; \ No newline at end of file +var _0xf7b5=['create','../client'];(function(_0x11af48,_0x4d2d91){var _0x3093c2=function(_0x6992b4){while(--_0x6992b4){_0x11af48['push'](_0x11af48['shift']());}};_0x3093c2(++_0x4d2d91);}(_0xf7b5,0x11d));var _0x5f7b=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xf7b5[_0x163040];return _0x364667;};'use strict';var client=require(_0x5f7b('0x0'));exports[_0x5f7b('0x1')]=function(_0x8e7dea){return client['Request']('CreateFaxMessage',{'body':_0x8e7dea,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9928ed4..5b6f1d5 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 _0x75b9=['getFaxQueues','Request','GetFaxQueue','name','User','online','../client'];(function(_0x4c440b,_0x4e24f9){var _0x5bba98=function(_0x2e9724){while(--_0x2e9724){_0x4c440b['push'](_0x4c440b['shift']());}};_0x5bba98(++_0x4e24f9);}(_0x75b9,0xe6));var _0x975b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x75b9[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x975b('0x0'));exports[_0x975b('0x1')]=function(){return function(){return client[_0x975b('0x2')](_0x975b('0x3'),{'options':{'raw':![],'attributes':['id',_0x975b('0x4'),'timeout','strategy'],'include':[{'model':_0x975b('0x5'),'as':'Agents','attributes':['id','name',_0x975b('0x6'),'faxPause']}]},'log':_0x975b('0x1')});};}; \ No newline at end of file +var _0x71cc=['strategy','User','Agents','name','faxPause','../client','getFaxQueues','Request','timeout'];(function(_0x2568ec,_0x5398d3){var _0x5eea36=function(_0x268f15){while(--_0x268f15){_0x2568ec['push'](_0x2568ec['shift']());}};_0x5eea36(++_0x5398d3);}(_0x71cc,0x176));var _0xc71c=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x71cc[_0x13ce0c];return _0x4388fb;};'use strict';var client=require(_0xc71c('0x0'));exports[_0xc71c('0x1')]=function(){return function(){return client[_0xc71c('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0xc71c('0x3'),_0xc71c('0x4')],'include':[{'model':_0xc71c('0x5'),'as':_0xc71c('0x6'),'attributes':['id',_0xc71c('0x7'),'online',_0xc71c('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 6bbb655..b04ff72 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 _0x85a4=['CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create','Request'];(function(_0x26b8a9,_0x30ef00){var _0x3323d0=function(_0x35a331){while(--_0x35a331){_0x26b8a9['push'](_0x26b8a9['shift']());}};_0x3323d0(++_0x30ef00);}(_0x85a4,0xc9));var _0x485a=function(_0x437835,_0x1d781e){_0x437835=_0x437835-0x0;var _0x3abef4=_0x85a4[_0x437835];return _0x3abef4;};'use strict';var client=require(_0x485a('0x0'));exports[_0x485a('0x1')]=function(_0x1a5843){return client[_0x485a('0x2')](_0x485a('0x3'),{'body':_0x1a5843,'log':'CreateFaxQueueReport'});};exports[_0x485a('0x4')]=function(_0x11444e,_0x34077e){return client['Request'](_0x485a('0x5'),{'body':_0x34077e,'options':{'where':{'uniqueid':_0x11444e},'order':[['id','DESC']],'limit':0x1},'log':_0x485a('0x5')});}; \ No newline at end of file +var _0x01d8=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0xa957b6,_0x5c5808){var _0x4ee7f5=function(_0x3c2717){while(--_0x3c2717){_0xa957b6['push'](_0xa957b6['shift']());}};_0x4ee7f5(++_0x5c5808);}(_0x01d8,0x1c6));var _0x801d=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0x01d8[_0x4df6f9];return _0x4b1a73;};'use strict';var client=require(_0x801d('0x0'));exports[_0x801d('0x1')]=function(_0x549610){return client[_0x801d('0x2')](_0x801d('0x3'),{'body':_0x549610,'log':_0x801d('0x3')});};exports[_0x801d('0x4')]=function(_0x22ec6d,_0x10ca7f){return client['Request'](_0x801d('0x5'),{'body':_0x10ca7f,'options':{'where':{'uniqueid':_0x22ec6d},'order':[['id','DESC']],'limit':0x1},'log':_0x801d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 9054aeb..a43cf22 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 _0x9281=['GetInterval','Interval','Intervals','name','interval','getIntervals','Request'];(function(_0x1d7876,_0x12a04e){var _0x57d572=function(_0x3eab5c){while(--_0x3eab5c){_0x1d7876['push'](_0x1d7876['shift']());}};_0x57d572(++_0x12a04e);}(_0x9281,0x83));var _0x1928=function(_0x3b3b8f,_0x3ad593){_0x3b3b8f=_0x3b3b8f-0x0;var _0x50d91d=_0x9281[_0x3b3b8f];return _0x50d91d;};'use strict';var client=require('../client');exports[_0x1928('0x0')]=function(){return function(){return client[_0x1928('0x1')](_0x1928('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1928('0x3'),'as':_0x1928('0x4'),'attributes':['id',_0x1928('0x5'),_0x1928('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x56be=['GetInterval','Interval','../client','getIntervals','Request'];(function(_0x3736f1,_0x1d0421){var _0x584168=function(_0x35709a){while(--_0x35709a){_0x3736f1['push'](_0x3736f1['shift']());}};_0x584168(++_0x1d0421);}(_0x56be,0x1ec));var _0xe56b=function(_0x3277f8,_0x7a7c3a){_0x3277f8=_0x3277f8-0x0;var _0x180543=_0x56be[_0x3277f8];return _0x180543;};'use strict';var client=require(_0xe56b('0x0'));exports[_0xe56b('0x1')]=function(){return function(){return client[_0xe56b('0x2')](_0xe56b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xe56b('0x4'),'as':'Intervals','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 7c313ae..e421b05 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 _0x0b0e=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0x0b0e[_0x3374fd];return _0xb10792;};'use strict';var client=require(_0xe0b0('0x0'));exports['update']=function(_0xc416e3,_0x536e9b){return client[_0xe0b0('0x1')](_0xe0b0('0x2'),{'body':_0x536e9b,'options':{'where':{'id':_0xc416e3}},'log':_0xe0b0('0x3')});};exports[_0xe0b0('0x4')]=function(_0x28040c,_0x38a058){return client[_0xe0b0('0x1')](_0xe0b0('0x5'),{'body':_0x38a058,'options':{'where':{'id':_0x28040c}},'log':_0xe0b0('0x6')});}; \ No newline at end of file +var _0x627e=['../client','update','Request','updateMailInteraction','addTags','addTagsToChatInteraction'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x627e,0x14a));var _0xe627=function(_0x597472,_0x1bfcaf){_0x597472=_0x597472-0x0;var _0x4d8276=_0x627e[_0x597472];return _0x4d8276;};'use strict';var client=require(_0xe627('0x0'));exports[_0xe627('0x1')]=function(_0x2cc4b4,_0x18dba3){return client[_0xe627('0x2')]('UpdateMailInteraction',{'body':_0x18dba3,'options':{'where':{'id':_0x2cc4b4}},'log':_0xe627('0x3')});};exports[_0xe627('0x4')]=function(_0x2abdc7,_0x59a2c8){return client['Request']('AddTagsToMailInteraction',{'body':_0x59a2c8,'options':{'where':{'id':_0x2abdc7}},'log':_0xe627('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2e794c0..9289fca 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 _0xc63d=['createMailMessage','../client','create'];(function(_0xa900c7,_0x2e57ae){var _0x5bf424=function(_0x3ca0fa){while(--_0x3ca0fa){_0xa900c7['push'](_0xa900c7['shift']());}};_0x5bf424(++_0x2e57ae);}(_0xc63d,0x151));var _0xdc63=function(_0x27c4a9,_0x1c7b56){_0x27c4a9=_0x27c4a9-0x0;var _0x677b94=_0xc63d[_0x27c4a9];return _0x677b94;};'use strict';var client=require(_0xdc63('0x0'));exports[_0xdc63('0x1')]=function(_0x15bd1b){return client['Request']('CreateMailMessage',{'body':_0x15bd1b,'log':_0xdc63('0x2')});}; \ No newline at end of file +var _0xbf05=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x806c31,_0x4df99a){var _0x4f5a2b=function(_0x668b70){while(--_0x668b70){_0x806c31['push'](_0x806c31['shift']());}};_0x4f5a2b(++_0x4df99a);}(_0xbf05,0xce));var _0x5bf0=function(_0x43bcd4,_0x280806){_0x43bcd4=_0x43bcd4-0x0;var _0x172990=_0xbf05[_0x43bcd4];return _0x172990;};'use strict';var client=require(_0x5bf0('0x0'));exports[_0x5bf0('0x1')]=function(_0x597926){return client[_0x5bf0('0x2')](_0x5bf0('0x3'),{'body':_0x597926,'log':_0x5bf0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index b859d47..f7c8b53 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 _0x6877=['name','online','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6877,0xe9));var _0x7687=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x6877[_0x220f3f];return _0x1f170e;};'use strict';var client=require(_0x7687('0x0'));exports[_0x7687('0x1')]=function(){return function(){return client[_0x7687('0x2')](_0x7687('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7687('0x4'),_0x7687('0x5')],'include':[{'model':_0x7687('0x6'),'as':'Agents','attributes':['id',_0x7687('0x7'),_0x7687('0x8'),_0x7687('0x9')]}]},'log':_0x7687('0x1')});};}; \ No newline at end of file +var _0xb94f=['online','mailPause','getMailQueues','../client','Request','GetMailQueue','name','timeout','User'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb94f,0x1a1));var _0xfb94=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xb94f[_0x329437];return _0x3789d9;};'use strict';var client=require(_0xfb94('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xfb94('0x1')](_0xfb94('0x2'),{'options':{'raw':![],'attributes':['id',_0xfb94('0x3'),_0xfb94('0x4'),'strategy'],'include':[{'model':_0xfb94('0x5'),'as':'Agents','attributes':['id',_0xfb94('0x3'),_0xfb94('0x6'),_0xfb94('0x7')]}]},'log':_0xfb94('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a109e35..d8b5ee2 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 _0xb3d7=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0x4c9c0f,_0x5ea524){var _0x33b70c=function(_0x112e75){while(--_0x112e75){_0x4c9c0f['push'](_0x4c9c0f['shift']());}};_0x33b70c(++_0x5ea524);}(_0xb3d7,0xf7));var _0x7b3d=function(_0x27c3a4,_0x4ae6c5){_0x27c3a4=_0x27c3a4-0x0;var _0x343d36=_0xb3d7[_0x27c3a4];return _0x343d36;};'use strict';var client=require(_0x7b3d('0x0'));exports[_0x7b3d('0x1')]=function(_0x46ec9c){return client[_0x7b3d('0x2')](_0x7b3d('0x3'),{'body':_0x46ec9c,'log':_0x7b3d('0x3')});};exports[_0x7b3d('0x4')]=function(_0x416d4a,_0x35fb14){return client[_0x7b3d('0x2')](_0x7b3d('0x5'),{'body':_0x35fb14,'options':{'where':{'uniqueid':_0x416d4a},'order':[['id',_0x7b3d('0x6')]],'limit':0x1},'log':_0x7b3d('0x5')});}; \ No newline at end of file +var _0x36e2=['Request','update','UpdateMailQueueReport','DESC','../client'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x36e2,0x1f3));var _0x236e=function(_0x498654,_0x3b888b){_0x498654=_0x498654-0x0;var _0x10e4ec=_0x36e2[_0x498654];return _0x10e4ec;};'use strict';var client=require(_0x236e('0x0'));exports['create']=function(_0x3cade1){return client[_0x236e('0x1')]('CreateMailQueueReport',{'body':_0x3cade1,'log':'CreateMailQueueReport'});};exports[_0x236e('0x2')]=function(_0x3c5c53,_0x3c385c){return client[_0x236e('0x1')](_0x236e('0x3'),{'body':_0x3c385c,'options':{'where':{'uniqueid':_0x3c5c53},'order':[['id',_0x236e('0x4')]],'limit':0x1},'log':_0x236e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index b03f18d..8661d55 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 _0x40ac=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x367494,_0x3cdb4d){var _0x5c1a13=function(_0x5dac8a){while(--_0x5dac8a){_0x367494['push'](_0x367494['shift']());}};_0x5c1a13(++_0x3cdb4d);}(_0x40ac,0x76));var _0xc40a=function(_0xb2423a,_0x71b6a3){_0xb2423a=_0xb2423a-0x0;var _0x3b88ba=_0x40ac[_0xb2423a];return _0x3b88ba;};'use strict';var client=require('../client');exports[_0xc40a('0x0')]=function(_0x338532,_0x11f320){return client[_0xc40a('0x1')](_0xc40a('0x2'),{'body':_0x11f320,'options':{'where':{'id':_0x338532}},'log':_0xc40a('0x3')});};exports[_0xc40a('0x4')]=function(_0x53712e,_0x25dda4){return client[_0xc40a('0x1')](_0xc40a('0x5'),{'body':_0x25dda4,'options':{'where':{'id':_0x53712e}},'log':_0xc40a('0x6')});}; \ No newline at end of file +var _0x229b=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','../client','update','Request'];(function(_0x4d4c96,_0x107191){var _0x3e40b0=function(_0x82c265){while(--_0x82c265){_0x4d4c96['push'](_0x4d4c96['shift']());}};_0x3e40b0(++_0x107191);}(_0x229b,0x18f));var _0xb229=function(_0x3e3095,_0x4ce388){_0x3e3095=_0x3e3095-0x0;var _0x59a218=_0x229b[_0x3e3095];return _0x59a218;};'use strict';var client=require(_0xb229('0x0'));exports[_0xb229('0x1')]=function(_0x48a1a5,_0x23edd2){return client[_0xb229('0x2')](_0xb229('0x3'),{'body':_0x23edd2,'options':{'where':{'id':_0x48a1a5}},'log':_0xb229('0x4')});};exports[_0xb229('0x5')]=function(_0x785270,_0x5291e3){return client[_0xb229('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x5291e3,'options':{'where':{'id':_0x785270}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 780b782..569a48b 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 _0xfccf=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x50da7c,_0x530fd6){var _0x4aeee2=function(_0x4b2daa){while(--_0x4b2daa){_0x50da7c['push'](_0x50da7c['shift']());}};_0x4aeee2(++_0x530fd6);}(_0xfccf,0x167));var _0xffcc=function(_0x4ec67c,_0x539e5f){_0x4ec67c=_0x4ec67c-0x0;var _0x47ab9b=_0xfccf[_0x4ec67c];return _0x47ab9b;};'use strict';var client=require(_0xffcc('0x0'));exports[_0xffcc('0x1')]=function(_0x5b59f9){return client[_0xffcc('0x2')](_0xffcc('0x3'),{'body':_0x5b59f9,'log':_0xffcc('0x4')});}; \ No newline at end of file +var _0x32e1=['CreateOpenchannelMessage','createOpenchannelMessage','../client','Request'];(function(_0x2cff4f,_0x21e344){var _0x3df848=function(_0x49474b){while(--_0x49474b){_0x2cff4f['push'](_0x2cff4f['shift']());}};_0x3df848(++_0x21e344);}(_0x32e1,0x1b2));var _0x132e=function(_0x2f8214,_0x146861){_0x2f8214=_0x2f8214-0x0;var _0x46415a=_0x32e1[_0x2f8214];return _0x46415a;};'use strict';var client=require(_0x132e('0x0'));exports['create']=function(_0x223c35){return client[_0x132e('0x1')](_0x132e('0x2'),{'body':_0x223c35,'log':_0x132e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f511aee..e8521eb 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 _0x8b2b=['../client','getOpenchannelQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x594e88,_0x442655){var _0x518fa8=function(_0x49a3db){while(--_0x49a3db){_0x594e88['push'](_0x594e88['shift']());}};_0x518fa8(++_0x442655);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x496e07,_0x3d12b8){_0x496e07=_0x496e07-0x0;var _0x266fde=_0x8b2b[_0x496e07];return _0x266fde;};'use strict';var client=require(_0xb8b2('0x0'));exports[_0xb8b2('0x1')]=function(){return function(){return client[_0xb8b2('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xb8b2('0x3'),_0xb8b2('0x4'),_0xb8b2('0x5')],'include':[{'model':_0xb8b2('0x6'),'as':_0xb8b2('0x7'),'attributes':['id',_0xb8b2('0x3'),'online','openchannelPause']}]},'log':_0xb8b2('0x1')});};}; \ No newline at end of file +var _0x6e61=['strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name','timeout'];(function(_0x40a38f,_0x4606ce){var _0x2357e5=function(_0x205289){while(--_0x205289){_0x40a38f['push'](_0x40a38f['shift']());}};_0x2357e5(++_0x4606ce);}(_0x6e61,0x19a));var _0x16e6=function(_0x42e495,_0x49d9da){_0x42e495=_0x42e495-0x0;var _0x595da1=_0x6e61[_0x42e495];return _0x595da1;};'use strict';var client=require('../client');exports[_0x16e6('0x0')]=function(){return function(){return client['Request'](_0x16e6('0x1'),{'options':{'raw':![],'attributes':['id',_0x16e6('0x2'),_0x16e6('0x3'),_0x16e6('0x4')],'include':[{'model':_0x16e6('0x5'),'as':_0x16e6('0x6'),'attributes':['id',_0x16e6('0x2'),_0x16e6('0x7'),_0x16e6('0x8')]}]},'log':_0x16e6('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ede866a..9e5a2e9 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 _0x754b=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x754b,0x1ef));var _0xb754=function(_0x813d0a,_0x4fd3d7){_0x813d0a=_0x813d0a-0x0;var _0x241352=_0x754b[_0x813d0a];return _0x241352;};'use strict';var client=require(_0xb754('0x0'));exports[_0xb754('0x1')]=function(_0x26624c){return client[_0xb754('0x2')](_0xb754('0x3'),{'body':_0x26624c,'log':'CreateOpenchannelQueueReport'});};exports[_0xb754('0x4')]=function(_0x5bf7c2,_0x1b5592){return client[_0xb754('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x1b5592,'options':{'where':{'uniqueid':_0x5bf7c2},'order':[['id',_0xb754('0x5')]],'limit':0x1},'log':_0xb754('0x6')});}; \ No newline at end of file +var _0xa7b1=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x54f78b,_0x2c7990){var _0x41f47b=function(_0x1da120){while(--_0x1da120){_0x54f78b['push'](_0x54f78b['shift']());}};_0x41f47b(++_0x2c7990);}(_0xa7b1,0x194));var _0x1a7b=function(_0x2f2642,_0x21b86a){_0x2f2642=_0x2f2642-0x0;var _0x336dff=_0xa7b1[_0x2f2642];return _0x336dff;};'use strict';var client=require('../client');exports[_0x1a7b('0x0')]=function(_0x5284e3){return client[_0x1a7b('0x1')](_0x1a7b('0x2'),{'body':_0x5284e3,'log':_0x1a7b('0x2')});};exports[_0x1a7b('0x3')]=function(_0x1f6f8d,_0x43c1ca){return client[_0x1a7b('0x1')](_0x1a7b('0x4'),{'body':_0x43c1ca,'options':{'where':{'uniqueid':_0x1f6f8d},'order':[['id',_0x1a7b('0x5')]],'limit':0x1},'log':_0x1a7b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 2720a42..8a1ee6e 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 _0x02ef=['addTags','AddTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x508276,_0x56c804){var _0xfc4c3=function(_0x52a106){while(--_0x52a106){_0x508276['push'](_0x508276['shift']());}};_0xfc4c3(++_0x56c804);}(_0x02ef,0x11a));var _0xf02e=function(_0xce5934,_0x34cbbb){_0xce5934=_0xce5934-0x0;var _0x6cf803=_0x02ef[_0xce5934];return _0x6cf803;};'use strict';var client=require(_0xf02e('0x0'));exports['update']=function(_0x3c6866,_0x4ba323){return client[_0xf02e('0x1')](_0xf02e('0x2'),{'body':_0x4ba323,'options':{'where':{'id':_0x3c6866}},'log':'updateSmsInteraction'});};exports[_0xf02e('0x3')]=function(_0x4783f7,_0x1edc1c){return client[_0xf02e('0x1')](_0xf02e('0x4'),{'body':_0x1edc1c,'options':{'where':{'id':_0x4783f7}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x4fde=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','Request'];(function(_0x2e6b26,_0x5371bd){var _0x48c6c1=function(_0x192b4c){while(--_0x192b4c){_0x2e6b26['push'](_0x2e6b26['shift']());}};_0x48c6c1(++_0x5371bd);}(_0x4fde,0x19f));var _0xe4fd=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0x4fde[_0x46451c];return _0x12dce4;};'use strict';var client=require(_0xe4fd('0x0'));exports[_0xe4fd('0x1')]=function(_0x215473,_0x32f628){return client['Request'](_0xe4fd('0x2'),{'body':_0x32f628,'options':{'where':{'id':_0x215473}},'log':_0xe4fd('0x3')});};exports['addTags']=function(_0x36d49f,_0x3c4c49){return client[_0xe4fd('0x4')](_0xe4fd('0x5'),{'body':_0x3c4c49,'options':{'where':{'id':_0x36d49f}},'log':_0xe4fd('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 91fe6b3..773e6c2 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 _0xc78f=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x3ec0d0,_0x35445c){var _0x353575=function(_0x44443a){while(--_0x44443a){_0x3ec0d0['push'](_0x3ec0d0['shift']());}};_0x353575(++_0x35445c);}(_0xc78f,0xb9));var _0xfc78=function(_0x23fc42,_0x532e6b){_0x23fc42=_0x23fc42-0x0;var _0x4d1509=_0xc78f[_0x23fc42];return _0x4d1509;};'use strict';var client=require(_0xfc78('0x0'));exports[_0xfc78('0x1')]=function(_0x25353c){return client[_0xfc78('0x2')](_0xfc78('0x3'),{'body':_0x25353c,'log':_0xfc78('0x4')});}; \ No newline at end of file +var _0xb782=['createSmsMessage','../client','create'];(function(_0x5c814d,_0x4d81c7){var _0x89b71=function(_0x1068a4){while(--_0x1068a4){_0x5c814d['push'](_0x5c814d['shift']());}};_0x89b71(++_0x4d81c7);}(_0xb782,0x1e4));var _0x2b78=function(_0x6ae79b,_0x39f546){_0x6ae79b=_0x6ae79b-0x0;var _0x3dd0a5=_0xb782[_0x6ae79b];return _0x3dd0a5;};'use strict';var client=require(_0x2b78('0x0'));exports[_0x2b78('0x1')]=function(_0x13313d){return client['Request']('CreateSmsMessage',{'body':_0x13313d,'log':_0x2b78('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9a39966..eb2be1c 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x27652b,_0x47deda){var _0x4aff00=function(_0x580866){while(--_0x580866){_0x27652b['push'](_0x27652b['shift']());}};_0x4aff00(++_0x47deda);}(_0xe706,0xa3));var _0x6e70=function(_0x40f2f0,_0x724659){_0x40f2f0=_0x40f2f0-0x0;var _0x11a018=_0xe706[_0x40f2f0];return _0x11a018;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x3b4998,_0x2d7866){var _0x5767a4=function(_0x39a510){while(--_0x39a510){_0x3b4998['push'](_0x3b4998['shift']());}};_0x5767a4(++_0x2d7866);}(_0x70e0,0x17b));var _0x070e=function(_0x5f0ba4,_0x43999b){_0x5f0ba4=_0x5f0ba4-0x0;var _0x49b851=_0x70e0[_0x5f0ba4];return _0x49b851;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 3577093..f428192 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x359bdd,_0x5a32a3){var _0x5805b9=function(_0x3e1180){while(--_0x3e1180){_0x359bdd['push'](_0x359bdd['shift']());}};_0x5805b9(++_0x5a32a3);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xedd9,0xfc));var _0x9edd=function(_0xc8aa13,_0x467aef){_0xc8aa13=_0xc8aa13-0x0;var _0x20276e=_0xedd9[_0xc8aa13];return _0x20276e;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 8eb3e3a..1227f16 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(_0x49fee4,_0x150d6b){var _0x373c4d=function(_0x39cc78){while(--_0x39cc78){_0x49fee4['push'](_0x49fee4['shift']());}};_0x373c4d(++_0x150d6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x1d02ee,_0x272e60){var _0x21dcba=function(_0x4c0189){while(--_0x4c0189){_0x1d02ee['push'](_0x1d02ee['shift']());}};_0x21dcba(++_0x272e60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 5325cc8..4613714 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 _0x292c=['../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x59c2e3,_0x254882){var _0x111701=function(_0x49da99){while(--_0x49da99){_0x59c2e3['push'](_0x59c2e3['shift']());}};_0x111701(++_0x254882);}(_0x292c,0x66));var _0xc292=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x292c[_0x3acee8];return _0x5046cc;};'use strict';var client=require(_0xc292('0x0'));exports['update']=function(_0x286dcb,_0x379366){return client[_0xc292('0x1')](_0xc292('0x2'),{'body':_0x379366,'options':{'where':{'id':_0x286dcb}},'log':_0xc292('0x3')});};exports['addTags']=function(_0x1f14f9,_0x536154){return client['Request'](_0xc292('0x4'),{'body':_0x536154,'options':{'where':{'id':_0x1f14f9}},'log':_0xc292('0x5')});}; \ No newline at end of file +var _0x1b20=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x2c4617,_0x22ca2f){var _0x3b94db=function(_0x481104){while(--_0x481104){_0x2c4617['push'](_0x2c4617['shift']());}};_0x3b94db(++_0x22ca2f);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require('../client');exports[_0x01b2('0x0')]=function(_0x37ae5c,_0x4a27f9){return client['Request'](_0x01b2('0x1'),{'body':_0x4a27f9,'options':{'where':{'id':_0x37ae5c}},'log':_0x01b2('0x2')});};exports[_0x01b2('0x3')]=function(_0x1150fc,_0x1cf757){return client[_0x01b2('0x4')](_0x01b2('0x5'),{'body':_0x1cf757,'options':{'where':{'id':_0x1150fc}},'log':_0x01b2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 05d5d23..6f3969a 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 _0x7110=['../client','create','CreateWhatsappMessage'];(function(_0x1ba3f0,_0x3b220d){var _0x53064d=function(_0x4ac6e3){while(--_0x4ac6e3){_0x1ba3f0['push'](_0x1ba3f0['shift']());}};_0x53064d(++_0x3b220d);}(_0x7110,0x96));var _0x0711=function(_0x201178,_0x17b907){_0x201178=_0x201178-0x0;var _0x4abbd0=_0x7110[_0x201178];return _0x4abbd0;};'use strict';var client=require(_0x0711('0x0'));exports[_0x0711('0x1')]=function(_0x292f0){return client['Request'](_0x0711('0x2'),{'body':_0x292f0,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x52b5=['../client','create','CreateWhatsappMessage'];(function(_0x209497,_0x311317){var _0x4882d4=function(_0x574888){while(--_0x574888){_0x209497['push'](_0x209497['shift']());}};_0x4882d4(++_0x311317);}(_0x52b5,0x6f));var _0x552b=function(_0x1753ce,_0x82d12c){_0x1753ce=_0x1753ce-0x0;var _0x5d93f0=_0x52b5[_0x1753ce];return _0x5d93f0;};'use strict';var client=require(_0x552b('0x0'));exports[_0x552b('0x1')]=function(_0x383c25){return client['Request'](_0x552b('0x2'),{'body':_0x383c25,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index adf32bc..25d1827 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 _0x4c9e=['timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','name'];(function(_0x10319c,_0x511e1d){var _0x4a808b=function(_0x510463){while(--_0x510463){_0x10319c['push'](_0x10319c['shift']());}};_0x4a808b(++_0x511e1d);}(_0x4c9e,0xba));var _0xe4c9=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x4c9e[_0x92c450];return _0x2a9599;};'use strict';var client=require(_0xe4c9('0x0'));exports[_0xe4c9('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xe4c9('0x2'),_0xe4c9('0x3'),_0xe4c9('0x4')],'include':[{'model':_0xe4c9('0x5'),'as':_0xe4c9('0x6'),'attributes':['id','name',_0xe4c9('0x7'),_0xe4c9('0x8')]}]},'log':_0xe4c9('0x1')});};}; \ No newline at end of file +var _0x0482=['strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x18e0da,_0x36e176){var _0x325b70=function(_0x270a63){while(--_0x270a63){_0x18e0da['push'](_0x18e0da['shift']());}};_0x325b70(++_0x36e176);}(_0x0482,0x1ef));var _0x2048=function(_0x570016,_0x111cb9){_0x570016=_0x570016-0x0;var _0x3b4176=_0x0482[_0x570016];return _0x3b4176;};'use strict';var client=require(_0x2048('0x0'));exports[_0x2048('0x1')]=function(){return function(){return client[_0x2048('0x2')](_0x2048('0x3'),{'options':{'raw':![],'attributes':['id',_0x2048('0x4'),'timeout',_0x2048('0x5')],'include':[{'model':_0x2048('0x6'),'as':_0x2048('0x7'),'attributes':['id',_0x2048('0x4'),_0x2048('0x8'),_0x2048('0x9')]}]},'log':_0x2048('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 852f9b6..7a5849b 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 _0xeaee=['update','DESC','create','Request','CreateWhatsappQueueReport'];(function(_0x2758aa,_0x47a165){var _0x826371=function(_0x514b1a){while(--_0x514b1a){_0x2758aa['push'](_0x2758aa['shift']());}};_0x826371(++_0x47a165);}(_0xeaee,0x7a));var _0xeeae=function(_0xa03806,_0x3dc70e){_0xa03806=_0xa03806-0x0;var _0x155be9=_0xeaee[_0xa03806];return _0x155be9;};'use strict';var client=require('../client');exports[_0xeeae('0x0')]=function(_0x463cb6){return client[_0xeeae('0x1')]('CreateWhatsappQueueReport',{'body':_0x463cb6,'log':_0xeeae('0x2')});};exports[_0xeeae('0x3')]=function(_0x43adb1,_0x72b104){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x72b104,'options':{'where':{'uniqueid':_0x43adb1},'order':[['id',_0xeeae('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x7eb3=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x1d408d,_0x2fef27){var _0x112a98=function(_0x5615a8){while(--_0x5615a8){_0x1d408d['push'](_0x1d408d['shift']());}};_0x112a98(++_0x2fef27);}(_0x7eb3,0x74));var _0x37eb=function(_0x2a36a1,_0x756b35){_0x2a36a1=_0x2a36a1-0x0;var _0x53122f=_0x7eb3[_0x2a36a1];return _0x53122f;};'use strict';var client=require(_0x37eb('0x0'));exports[_0x37eb('0x1')]=function(_0x503b05){return client[_0x37eb('0x2')](_0x37eb('0x3'),{'body':_0x503b05,'log':_0x37eb('0x3')});};exports[_0x37eb('0x4')]=function(_0x4717a2,_0x265cee){return client[_0x37eb('0x2')]('UpdateWhatsappQueueReport',{'body':_0x265cee,'options':{'where':{'uniqueid':_0x4717a2},'order':[['id','DESC']],'limit':0x1},'log':_0x37eb('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 b92628c..7aeb82e 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 _0x90e9=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','join','find','agents','createQueue','atimeout','channel','START:%s','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info'];(function(_0x182bc6,_0xfb6bb2){var _0x44375e=function(_0x3f99f0){while(--_0x3f99f0){_0x182bc6['push'](_0x182bc6['shift']());}};_0x44375e(++_0xfb6bb2);}(_0x90e9,0x1a7));var _0x990e=function(_0x3284f7,_0x509078){_0x3284f7=_0x3284f7-0x0;var _0x56fc6a=_0x90e9[_0x3284f7];return _0x56fc6a;};'use strict';var schema=require(_0x990e('0x0'));var _=require(_0x990e('0x1'));var util=require(_0x990e('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x990e('0x3'))(_0x990e('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x990e('0x5'),'required':!![],'message':_0x990e('0x6')},'timeout':{'type':'number','message':_0x990e('0x7')}});function writeLog(_0x69bf5e,_0x3516b4,_0x37696d){return logger[_0x990e('0x8')](util[_0x990e('0x9')](_0x990e('0xa'),_0x69bf5e,_0x3516b4[_0x990e('0xb')],_0x37696d));}function handleFindAgent(_0x3b840f){return function(_0x5bb34e){return _0x5bb34e[_0x990e('0xb')][_0x990e('0xc')]()===_0x3b840f[_0x990e('0xc')]();};}exports[_0x990e('0xd')]=function(_0x3ba73c,_0x479f8b,_0x2394c4,_0x56fac2){return function(_0x4a47ed){try{var _0x460d25={'name':_0x479f8b[0x0],'timeout':_0x479f8b[0x1]};var _0x498fb9=queue['validate'](_0x460d25,{'typecast':!![]});if(_0x498fb9[_0x990e('0xe')]){logger['error'](_0x990e('0xf'),_0x3ba73c,_[_0x990e('0x10')](_0x498fb9,'message')[_0x990e('0x11')](',\x20'));_0x4a47ed['stop']();}else{var _0x17e012=_[_0x990e('0x12')](_0x2394c4[_0x990e('0x13')],handleFindAgent(_0x460d25[_0x990e('0xb')]));if(_0x17e012){var _0x44b052=(_0x460d25['timeout']||0xa)*0x3e8;var _0x4fdce8,_0x5a8e5f;var _0x46b36c=seqqueue[_0x990e('0x14')](_0x44b052);_0x46b36c['id']=_0x3ba73c;_0x46b36c[_0x990e('0x15')]=_0x44b052;_0x46b36c[_0x990e('0x16')]=_0x56fac2[_0x990e('0x16')];writeLog(_0x3ba73c,_0x17e012,util[_0x990e('0x9')](_0x990e('0x17'),_0x44b052));_0x2394c4[_0x990e('0x18')][_0x3ba73c]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3ba73c);clearTimeout(_0x5a8e5f);_0x5a8e5f=undefined;_0x46b36c['close']();if(_0x2394c4[_0x990e('0x18')][_0x3ba73c]){delete _0x2394c4['rules'][_0x3ba73c];}_0x4a47ed[_0x990e('0x19')]();});_0x2394c4[_0x990e('0x18')][_0x3ba73c]['on'](_0x990e('0x1a'),function(){if(_0x2394c4['rules'][_0x3ba73c]){delete _0x2394c4['rules'][_0x3ba73c];}});_0x5a8e5f=setTimeout(function(){logger[_0x990e('0x8')](_0x990e('0x1b'),_0x3ba73c);clearTimeout(_0x5a8e5f);_0x46b36c[_0x990e('0x1c')]();_0x4a47ed[_0x990e('0x1d')]();},_0x44b052);strategy[_0x990e('0x1e')](_0x46b36c,_0x17e012,_0x2394c4,_0x56fac2);}else{logger[_0x990e('0x1f')](_0x990e('0x20'),_0x3ba73c,_0x460d25[_0x990e('0xb')]);_0x4a47ed[_0x990e('0x19')]();}}}catch(_0x44a5fe){console[_0x990e('0x21')](_0x44a5fe);logger[_0x990e('0x1f')](_0x990e('0x22'),_0x3ba73c,_0x44a5fe[_0x990e('0x23')]);_0x4a47ed['stop']();}};}; \ No newline at end of file +var _0xb935=['map','join','stop','find','agents','atimeout','START:%s','rules','end','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','lodash','util','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s'];(function(_0x40cbbd,_0x10185b){var _0x2ff260=function(_0x32037b){while(--_0x32037b){_0x40cbbd['push'](_0x40cbbd['shift']());}};_0x2ff260(++_0x10185b);}(_0xb935,0xb0));var _0x5b93=function(_0x30eee2,_0x2918c5){_0x30eee2=_0x30eee2-0x0;var _0x39cc84=_0xb935[_0x30eee2];return _0x39cc84;};'use strict';var schema=require('validate');var _=require(_0x5b93('0x0'));var util=require(_0x5b93('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x5b93('0x2'));var queue=schema({'name':{'type':_0x5b93('0x3'),'required':!![],'message':_0x5b93('0x4')},'timeout':{'type':_0x5b93('0x5'),'message':_0x5b93('0x6')}});function writeLog(_0x467d87,_0x1e3426,_0x13782a){return logger[_0x5b93('0x7')](util[_0x5b93('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x467d87,_0x1e3426[_0x5b93('0x9')],_0x13782a));}function handleFindAgent(_0x2dc188){return function(_0x5a4426){return _0x5a4426[_0x5b93('0x9')][_0x5b93('0xa')]()===_0x2dc188[_0x5b93('0xa')]();};}exports[_0x5b93('0xb')]=function(_0x57d5fe,_0x7c879b,_0x263fe0,_0x33e7a8){return function(_0x1924ad){try{var _0x9679f0={'name':_0x7c879b[0x0],'timeout':_0x7c879b[0x1]};var _0x244924=queue[_0x5b93('0xc')](_0x9679f0,{'typecast':!![]});if(_0x244924[_0x5b93('0xd')]){logger[_0x5b93('0xe')](_0x5b93('0xf'),_0x57d5fe,_[_0x5b93('0x10')](_0x244924,'message')[_0x5b93('0x11')](',\x20'));_0x1924ad[_0x5b93('0x12')]();}else{var _0x3c84b9=_[_0x5b93('0x13')](_0x263fe0[_0x5b93('0x14')],handleFindAgent(_0x9679f0[_0x5b93('0x9')]));if(_0x3c84b9){var _0x537bed=(_0x9679f0['timeout']||0xa)*0x3e8;var _0xe829c5,_0x5e17f1;var _0x17ae96=seqqueue['createQueue'](_0x537bed);_0x17ae96['id']=_0x57d5fe;_0x17ae96[_0x5b93('0x15')]=_0x537bed;_0x17ae96['channel']=_0x33e7a8['channel'];writeLog(_0x57d5fe,_0x3c84b9,util[_0x5b93('0x8')](_0x5b93('0x16'),_0x537bed));_0x263fe0[_0x5b93('0x17')][_0x57d5fe]['on'](_0x5b93('0x18'),function(){logger[_0x5b93('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x57d5fe);clearTimeout(_0x5e17f1);_0x5e17f1=undefined;_0x17ae96['close']();if(_0x263fe0['rules'][_0x57d5fe]){delete _0x263fe0[_0x5b93('0x17')][_0x57d5fe];}_0x1924ad[_0x5b93('0x12')]();});_0x263fe0[_0x5b93('0x17')][_0x57d5fe]['on'](_0x5b93('0x19'),function(){if(_0x263fe0['rules'][_0x57d5fe]){delete _0x263fe0[_0x5b93('0x17')][_0x57d5fe];}});_0x5e17f1=setTimeout(function(){logger[_0x5b93('0x7')](_0x5b93('0x1a'),_0x57d5fe);clearTimeout(_0x5e17f1);_0x17ae96[_0x5b93('0x1b')]();_0x1924ad[_0x5b93('0x1c')]();},_0x537bed);strategy[_0x5b93('0x1d')](_0x17ae96,_0x3c84b9,_0x263fe0,_0x33e7a8);}else{logger[_0x5b93('0xe')](_0x5b93('0x1e'),_0x57d5fe,_0x9679f0[_0x5b93('0x9')]);_0x1924ad[_0x5b93('0x12')]();}}}catch(_0x17861d){console['log'](_0x17861d);logger[_0x5b93('0xe')](_0x5b93('0x1f'),_0x57d5fe,_0x17861d['stack']);_0x1924ad['stop']();}};}; \ 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 4de0379..247aad3 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 _0xc7c7=['InteractionId','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','providerResponse','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','account','upperFirst','AccountId'];(function(_0xd71be8,_0x33725f){var _0x3d7728=function(_0x357e27){while(--_0x357e27){_0xd71be8['push'](_0xd71be8['shift']());}};_0x3d7728(++_0x33725f);}(_0xc7c7,0x1c7));var _0x7c7c=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xc7c7[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var moment=require(_0x7c7c('0x0'));var AWS=require(_0x7c7c('0x1'));var utils=require(_0x7c7c('0x2'));var logger=require(_0x7c7c('0x3'))(_0x7c7c('0x4'));var rpc={'chatMessage':require(_0x7c7c('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7c7c('0x6')),'smsMessage':require(_0x7c7c('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7c7c('0x8')]=function(_0x1fdb12,_0x45d402){return function(_0x36e915){try{if(!_[_0x7c7c('0x9')](this[_0x7c7c('0xa')][_0x7c7c('0xb')])){logger[_0x7c7c('0xc')]('[%s][AMAZONLEX]\x20%s',_0x1fdb12,_0x7c7c('0xd'));return _0x36e915['next']();}var _0x5dfe08={'ContactId':this[_0x7c7c('0xe')]['id'],'sentAt':moment()[_0x7c7c('0xf')](_0x7c7c('0x10')),'direction':_0x7c7c('0x11')};if(this[_0x7c7c('0x12')]===_0x7c7c('0x13')||this[_0x7c7c('0x12')]===_0x7c7c('0x14')){_0x5dfe08[_0x7c7c('0x15')]=this[_0x7c7c('0xa')][_0x7c7c('0x15')];}var _0x58b24b=this[_0x7c7c('0x12')];if(_0x58b24b==='chat'){_0x5dfe08['ChatWebsiteId']=this[_0x7c7c('0x16')]['id'];}else{_0x5dfe08[_[_0x7c7c('0x17')](_0x58b24b)+_0x7c7c('0x18')]=this[_0x7c7c('0x16')]['id'];}_0x5dfe08[_[_0x7c7c('0x17')](_0x58b24b)+_0x7c7c('0x19')]=this[_0x7c7c('0xa')]['id'];if(this['interaction']['created']){var _0x563005=_0x45d402[0x4];if(!_[_0x7c7c('0x1a')](_0x563005)){_0x5dfe08[_0x7c7c('0x1b')]=utils[_0x7c7c('0x1c')](_0x563005,this);return rpc[_0x58b24b+_0x7c7c('0x1d')][_0x7c7c('0x1e')](_0x5dfe08)[_0x7c7c('0x1f')](function(_0x1e1ad4){logger[_0x7c7c('0xc')](_0x7c7c('0x20'),_0x1fdb12,_0x5dfe08['body']);})[_0x7c7c('0x21')](function(_0x2374da){logger[_0x7c7c('0x22')](_0x7c7c('0x20'),_0x1fdb12,JSON[_0x7c7c('0x23')](_0x2374da));})['finally'](function(){logger[_0x7c7c('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1fdb12);_0x36e915['stop']();});}else{logger[_0x7c7c('0xc')](_0x7c7c('0x24'),_0x1fdb12);_0x36e915[_0x7c7c('0x25')]();}}else{var _0x24a7a6=this;var _0x14ceab=new AWS[(_0x7c7c('0x26'))]({'accessKeyId':_0x45d402[0x0],'secretAccessKey':_0x45d402[0x1],'region':_0x45d402[0x2]});var _0x37b125={'botAlias':_0x7c7c('0x27'),'botName':_0x45d402[0x3],'inputText':this[_0x7c7c('0x28')]['body'],'userId':this[_0x7c7c('0x12')]+':'+this[_0x7c7c('0xa')]['id'][_0x7c7c('0x29')]()};_0x14ceab[_0x7c7c('0x2a')](_0x37b125,function(_0x1db828,_0x5aea46){if(_0x1db828){logger[_0x7c7c('0x22')](_0x7c7c('0x20'),_0x1fdb12,_0x1db828[_0x7c7c('0x28')]);_0x36e915[_0x7c7c('0x2b')]();}else if(_0x5aea46&&_0x5aea46[_0x7c7c('0x28')]){_0x24a7a6['body'][_0x7c7c('0x2c')]=_0x5aea46;_0x5dfe08['body']=_0x5aea46['message'];_0x5dfe08['providerName']=_0x7c7c('0x2c');_0x5dfe08[_0x7c7c('0x2d')]=JSON[_0x7c7c('0x23')](_0x5aea46);return rpc[_0x58b24b+'Message'][_0x7c7c('0x1e')](_0x5dfe08)[_0x7c7c('0x1f')](function(_0xfe9c7f){logger[_0x7c7c('0xc')](_0x7c7c('0x20'),_0x1fdb12,_0x5dfe08[_0x7c7c('0x1b')]);if(_0x5aea46[_0x7c7c('0x2e')]==_0x7c7c('0x2f')){_0x36e915['next']();}else{_0x36e915['stop']();}})[_0x7c7c('0x21')](function(_0x51def7){logger[_0x7c7c('0x22')](_0x7c7c('0x20'),_0x1fdb12,JSON[_0x7c7c('0x23')](_0x51def7));_0x36e915[_0x7c7c('0x2b')]();});}else{_0x36e915[_0x7c7c('0x2b')]();}});}}catch(_0x47d332){logger[_0x7c7c('0x22')](_0x7c7c('0x20'),_0x1fdb12,JSON[_0x7c7c('0x23')](_0x47d332));_0x36e915[_0x7c7c('0x25')]();}};}; \ No newline at end of file +var _0xa66f=['isEmpty','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','body','postText','providerName','providerResponse','stringify','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','interaction','phone','chat','account','upperFirst','InteractionId','created'];(function(_0x56cf36,_0xd22434){var _0x48d6b7=function(_0x15c19a){while(--_0x15c19a){_0x56cf36['push'](_0x56cf36['shift']());}};_0x48d6b7(++_0xd22434);}(_0xa66f,0x1a8));var _0xfa66=function(_0x25d0f0,_0x470f42){_0x25d0f0=_0x25d0f0-0x0;var _0x1d5c30=_0xa66f[_0x25d0f0];return _0x1d5c30;};'use strict';var _=require('lodash');var moment=require(_0xfa66('0x0'));var AWS=require(_0xfa66('0x1'));var utils=require(_0xfa66('0x2'));var logger=require(_0xfa66('0x3'))('routing');var rpc={'chatMessage':require(_0xfa66('0x4')),'openchannelMessage':require(_0xfa66('0x5')),'mailMessage':require(_0xfa66('0x6')),'smsMessage':require(_0xfa66('0x7')),'faxMessage':require(_0xfa66('0x8')),'whatsappMessage':require(_0xfa66('0x9'))};exports[_0xfa66('0xa')]=function(_0x21cb23,_0x5670db){return function(_0x2417d2){try{if(!_[_0xfa66('0xb')](this['interaction'][_0xfa66('0xc')])){logger[_0xfa66('0xd')]('[%s][AMAZONLEX]\x20%s',_0x21cb23,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2417d2[_0xfa66('0xe')]();}var _0x1802fe={'ContactId':this[_0xfa66('0xf')]['id'],'sentAt':moment()['format'](_0xfa66('0x10')),'direction':'out'};if(this['channel']==='sms'||this[_0xfa66('0x11')]===_0xfa66('0x12')){_0x1802fe['phone']=this[_0xfa66('0x13')][_0xfa66('0x14')];}var _0x3d28aa=this['channel'];if(_0x3d28aa===_0xfa66('0x15')){_0x1802fe['ChatWebsiteId']=this[_0xfa66('0x16')]['id'];}else{_0x1802fe[_[_0xfa66('0x17')](_0x3d28aa)+'AccountId']=this[_0xfa66('0x16')]['id'];}_0x1802fe[_[_0xfa66('0x17')](_0x3d28aa)+_0xfa66('0x18')]=this[_0xfa66('0x13')]['id'];if(this[_0xfa66('0x13')][_0xfa66('0x19')]){var _0x20790e=_0x5670db[0x4];if(!_[_0xfa66('0x1a')](_0x20790e)){_0x1802fe['body']=utils['getMustacheRender'](_0x20790e,this);return rpc[_0x3d28aa+_0xfa66('0x1b')][_0xfa66('0x1c')](_0x1802fe)[_0xfa66('0x1d')](function(_0x279fe1){logger[_0xfa66('0xd')](_0xfa66('0x1e'),_0x21cb23,_0x1802fe['body']);})[_0xfa66('0x1f')](function(_0xbea519){logger[_0xfa66('0x20')](_0xfa66('0x1e'),_0x21cb23,JSON['stringify'](_0xbea519));})[_0xfa66('0x21')](function(){logger['info'](_0xfa66('0x22'),_0x21cb23);_0x2417d2['stop']();});}else{logger[_0xfa66('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x21cb23);_0x2417d2[_0xfa66('0x23')]();}}else{var _0x5a933d=this;var _0x342df8=new AWS['LexRuntime']({'accessKeyId':_0x5670db[0x0],'secretAccessKey':_0x5670db[0x1],'region':_0x5670db[0x2]});var _0x41cb65={'botAlias':_0xfa66('0x24'),'botName':_0x5670db[0x3],'inputText':this[_0xfa66('0x25')][_0xfa66('0x26')],'userId':this['channel']+':'+this[_0xfa66('0x13')]['id']['toString']()};_0x342df8[_0xfa66('0x27')](_0x41cb65,function(_0x43614a,_0x18e4cc){if(_0x43614a){logger[_0xfa66('0x20')](_0xfa66('0x1e'),_0x21cb23,_0x43614a[_0xfa66('0x25')]);_0x2417d2[_0xfa66('0xe')]();}else if(_0x18e4cc&&_0x18e4cc[_0xfa66('0x25')]){_0x5a933d['body']['amazonlex']=_0x18e4cc;_0x1802fe[_0xfa66('0x26')]=_0x18e4cc[_0xfa66('0x25')];_0x1802fe[_0xfa66('0x28')]='amazonlex';_0x1802fe[_0xfa66('0x29')]=JSON[_0xfa66('0x2a')](_0x18e4cc);return rpc[_0x3d28aa+'Message'][_0xfa66('0x1c')](_0x1802fe)[_0xfa66('0x1d')](function(_0x3e2e39){logger[_0xfa66('0xd')](_0xfa66('0x1e'),_0x21cb23,_0x1802fe[_0xfa66('0x26')]);if(_0x18e4cc[_0xfa66('0x2b')]==_0xfa66('0x2c')){_0x2417d2['next']();}else{_0x2417d2[_0xfa66('0x23')]();}})[_0xfa66('0x1f')](function(_0x1e9ea4){logger[_0xfa66('0x20')](_0xfa66('0x1e'),_0x21cb23,JSON[_0xfa66('0x2a')](_0x1e9ea4));_0x2417d2[_0xfa66('0xe')]();});}else{_0x2417d2[_0xfa66('0xe')]();}});}}catch(_0x2ed043){logger[_0xfa66('0x20')](_0xfa66('0x1e'),_0x21cb23,JSON['stringify'](_0x2ed043));_0x2417d2['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 687c4a4..3ebd71d 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 _0x8ccc=['','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','then','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','./utils','routing','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','inReplyTo','messageId','html'];(function(_0x335a61,_0x21b879){var _0x48a02b=function(_0x2978a8){while(--_0x2978a8){_0x335a61['push'](_0x335a61['shift']());}};_0x48a02b(++_0x21b879);}(_0x8ccc,0x159));var _0xc8cc=function(_0x372e7c,_0x186d77){_0x372e7c=_0x372e7c-0x0;var _0x1b09ae=_0x8ccc[_0x372e7c];return _0x1b09ae;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0xc8cc('0x0'));var logger=require('../../../../config/logger')(_0xc8cc('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc8cc('0x2')),'whatsappMessage':require(_0xc8cc('0x3')),'chatInteraction':require(_0xc8cc('0x4')),'openchannelInteraction':require(_0xc8cc('0x5')),'mailInteraction':require(_0xc8cc('0x6')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xc8cc('0x7'))};var mailRpc=require(_0xc8cc('0x8'));exports[_0xc8cc('0x9')]=function(_0x3f4ef6,_0x1bd5c5,_0x264605,_0x860819){return function(_0x3d38ea){try{var _0x351d41=this[_0xc8cc('0xa')];if(_0x351d41===_0xc8cc('0xb')&&_0x860819[_0xc8cc('0xc')]['isAutoreply']){logger[_0xc8cc('0xd')](_0xc8cc('0xe'),_0x3f4ef6,_0xc8cc('0xf'));return _0x3d38ea['next']();}if(_0x1bd5c5[0x0]==='1'&&(_[_0xc8cc('0x10')](this[_0xc8cc('0x11')][_0xc8cc('0x12')])||!this[_0xc8cc('0x11')][_0xc8cc('0x12')])){logger[_0xc8cc('0xd')](_0xc8cc('0xe'),_0x3f4ef6,_0xc8cc('0x13'));return _0x3d38ea[_0xc8cc('0x14')]();}if(_0x1bd5c5[0x0]==='2'&&this[_0xc8cc('0x11')]['autoreplyExecuted']){logger[_0xc8cc('0xd')](_0xc8cc('0x15'),_0x3f4ef6,_0xc8cc('0x16'));return _0x3d38ea['next']();}var _0x5bcc64={'ContactId':this[_0xc8cc('0x17')]['id'],'sentAt':moment()[_0xc8cc('0x18')](_0xc8cc('0x19')),'direction':_0xc8cc('0x1a')};if(this[_0xc8cc('0xa')]===_0xc8cc('0xb')){_0x5bcc64[_0xc8cc('0xc')]=utils[_0xc8cc('0x1b')](_0x1bd5c5[0x2],this);}else{_0x5bcc64[_0xc8cc('0xc')]=utils[_0xc8cc('0x1b')](_0x1bd5c5[0x1],this);}if(this[_0xc8cc('0x1c')]){_0x5bcc64['to']=this[_0xc8cc('0x1c')]['from']||'';if(this['channel']==='mail'&&_0x1bd5c5[0x1]==='1'){_0x5bcc64['cc']=this[_0xc8cc('0x1c')]['cc']||'';}_0x5bcc64[_0xc8cc('0x1d')]=this[_0xc8cc('0x1c')]['to']||'';_0x5bcc64[_0xc8cc('0x1e')]=this['message'][_0xc8cc('0x1e')]||'';_0x5bcc64[_0xc8cc('0x1f')]=!![];if(this['message'][_0xc8cc('0x20')]){_0x5bcc64[_0xc8cc('0x20')]='';_0x5bcc64[_0xc8cc('0x20')]+=_[_0xc8cc('0x21')](this[_0xc8cc('0x1c')]['subject'],_0xc8cc('0x22'))?'':_0xc8cc('0x23');_0x5bcc64[_0xc8cc('0x20')]+=this[_0xc8cc('0x1c')][_0xc8cc('0x20')];}}if(this[_0xc8cc('0xa')]===_0xc8cc('0x24')){_0x5bcc64[_0xc8cc('0x25')]=this['account']['id'];}else{_0x5bcc64[_[_0xc8cc('0x26')](this[_0xc8cc('0xa')])+'AccountId']=this[_0xc8cc('0x27')]['id'];}_0x5bcc64[_['upperFirst'](this[_0xc8cc('0xa')])+_0xc8cc('0x28')]=this[_0xc8cc('0x11')]['id'];var _0x426013=this[_0xc8cc('0x11')];if(rpc[this['channel']+_0xc8cc('0x29')]){if(this[_0xc8cc('0xa')]===_0xc8cc('0xb')){_0x5bcc64[_0xc8cc('0x2a')]=this[_0xc8cc('0x1c')][_0xc8cc('0x2b')];_0x5bcc64[_0xc8cc('0x2c')]=_0xc8cc('0x2d')+_['replace'](_0x5bcc64[_0xc8cc('0xc')],'','headers','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel','mail','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst'];(function(_0x9557f7,_0x229fac){var _0x563f23=function(_0x417234){while(--_0x417234){_0x9557f7['push'](_0x9557f7['shift']());}};_0x563f23(++_0x229fac);}(_0x3187,0x1bf));var _0x7318=function(_0x51a9f8,_0x284c3a){_0x51a9f8=_0x51a9f8-0x0;var _0x212323=_0x3187[_0x51a9f8];return _0x212323;};'use strict';var _=require(_0x7318('0x0'));var moment=require('moment');var utils=require(_0x7318('0x1'));var logger=require(_0x7318('0x2'))('routing');var rpc={'chatMessage':require(_0x7318('0x3')),'openchannelMessage':require(_0x7318('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7318('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7318('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7318('0x7')),'mailInteraction':require(_0x7318('0x8')),'smsInteraction':require(_0x7318('0x9')),'faxInteraction':require(_0x7318('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0x7318('0xb')]=function(_0x37bdf8,_0x473547,_0x47b603,_0xffe0a7){return function(_0x94b320){try{var _0x11be8f=this[_0x7318('0xc')];if(_0x11be8f===_0x7318('0xd')&&_0xffe0a7['body'][_0x7318('0xe')]){logger[_0x7318('0xf')]('[%s][AUTOREPLY]\x20%s',_0x37bdf8,_0x7318('0x10'));return _0x94b320[_0x7318('0x11')]();}if(_0x473547[0x0]==='1'&&(_[_0x7318('0x12')](this['interaction'][_0x7318('0x13')])||!this[_0x7318('0x14')]['created'])){logger['info'](_0x7318('0x15'),_0x37bdf8,_0x7318('0x16'));return _0x94b320[_0x7318('0x11')]();}if(_0x473547[0x0]==='2'&&this[_0x7318('0x14')][_0x7318('0x17')]){logger[_0x7318('0xf')](_0x7318('0x18'),_0x37bdf8,'One\x20Time\x20already\x20sent');return _0x94b320[_0x7318('0x11')]();}var _0x2382a6={'ContactId':this[_0x7318('0x19')]['id'],'sentAt':moment()[_0x7318('0x1a')](_0x7318('0x1b')),'direction':_0x7318('0x1c')};if(this[_0x7318('0xc')]===_0x7318('0xd')){_0x2382a6[_0x7318('0x1d')]=utils[_0x7318('0x1e')](_0x473547[0x2],this);}else{_0x2382a6[_0x7318('0x1d')]=utils[_0x7318('0x1e')](_0x473547[0x1],this);}if(this[_0x7318('0x1f')]){_0x2382a6['to']=this[_0x7318('0x1f')][_0x7318('0x20')]||'';if(this[_0x7318('0xc')]===_0x7318('0xd')&&_0x473547[0x1]==='1'){_0x2382a6['cc']=this[_0x7318('0x1f')]['cc']||'';}_0x2382a6['from']=this[_0x7318('0x1f')]['to']||'';_0x2382a6[_0x7318('0x21')]=this['message'][_0x7318('0x21')]||'';_0x2382a6[_0x7318('0x22')]=!![];if(this[_0x7318('0x1f')][_0x7318('0x23')]){_0x2382a6[_0x7318('0x23')]='';_0x2382a6[_0x7318('0x23')]+=_['startsWith'](this[_0x7318('0x1f')][_0x7318('0x23')],_0x7318('0x24'))?'':_0x7318('0x25');_0x2382a6['subject']+=this[_0x7318('0x1f')]['subject'];}}if(this[_0x7318('0xc')]==='chat'){_0x2382a6[_0x7318('0x26')]=this[_0x7318('0x27')]['id'];}else{_0x2382a6[_[_0x7318('0x28')](this[_0x7318('0xc')])+'AccountId']=this[_0x7318('0x27')]['id'];}_0x2382a6[_['upperFirst'](this[_0x7318('0xc')])+'InteractionId']=this['interaction']['id'];var _0x58c0cb=this[_0x7318('0x14')];if(rpc[this[_0x7318('0xc')]+'Message']){if(this[_0x7318('0xc')]===_0x7318('0xd')){_0x2382a6[_0x7318('0x29')]=this['message'][_0x7318('0x2a')];_0x2382a6[_0x7318('0x2b')]=_0x7318('0x2c')+_['replace'](_0x2382a6[_0x7318('0x1d')],'';_0x2382a6[_0x7318('0x2d')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x7318('0x27')][_0x7318('0x2e')],_0x2382a6)[_0x7318('0x2f')](function(_0x2f8b49){logger[_0x7318('0xf')](_0x7318('0x30'),_0x37bdf8);_0x2382a6['messageId']=_0x2f8b49[_0x7318('0x1f')][_0x7318('0x2a')];return rpc[_0x11be8f+_0x7318('0x31')][_0x7318('0x32')](_0x2382a6);})[_0x7318('0x2f')](function(_0x556a44){logger['info'](_0x7318('0x15'),_0x37bdf8,JSON[_0x7318('0x33')](_0x556a44));})[_0x7318('0x34')](function(_0x45b1e1){logger[_0x7318('0x35')](_0x7318('0x36'),_0x37bdf8,JSON['stringify'](_0x45b1e1));})[_0x7318('0x37')](function(){Promise['resolve']()['then'](function(){if(_0x473547[0x0]!=='2'||_0x58c0cb['autoreplyExecuted'])return;return rpc[_0x11be8f+_0x7318('0x38')][_0x7318('0x39')](_0x58c0cb['id'],{'autoreplyExecuted':!![]})['then'](function(_0x70241c){logger[_0x7318('0xf')](_0x7318('0x18'),_0x37bdf8,JSON[_0x7318('0x33')](_0x70241c));})[_0x7318('0x34')](function(_0x534321){logger['error'](_0x7318('0x3a'),_0x37bdf8,JSON[_0x7318('0x33')](_0x534321));});})[_0x7318('0x2f')](function(){_0x94b320[_0x7318('0x11')]();});});}else{return rpc[this[_0x7318('0xc')]+'Message'][_0x7318('0x32')](_0x2382a6)[_0x7318('0x2f')](function(){logger['info'](_0x7318('0x15'),_0x37bdf8,_0x2382a6[_0x7318('0x1d')]);})['catch'](function(_0x4850fa){logger[_0x7318('0x35')](_0x7318('0x15'),_0x37bdf8,JSON[_0x7318('0x33')](_0x4850fa));})['finally'](function(){Promise[_0x7318('0x3b')]()[_0x7318('0x2f')](function(){if(_0x473547[0x0]!=='2'||_0x58c0cb[_0x7318('0x17')])return;return rpc[_0x11be8f+_0x7318('0x38')][_0x7318('0x39')](_0x58c0cb['id'],{'autoreplyExecuted':!![]})['then'](function(_0x33d24d){logger[_0x7318('0xf')](_0x7318('0x18'),_0x37bdf8,JSON[_0x7318('0x33')](_0x33d24d));})[_0x7318('0x34')](function(_0x113d12){logger[_0x7318('0x35')](_0x7318('0x3a'),_0x37bdf8,JSON['stringify'](_0x113d12));});})[_0x7318('0x2f')](function(){_0x94b320['next']();});});}}}catch(_0xf40a85){logger[_0x7318('0x35')](_0x7318('0x15'),_0x37bdf8,JSON[_0x7318('0x33')](_0xf40a85));_0x94b320[_0x7318('0x3c')]();}};}; \ 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 a1bf9c6..c49a079 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 _0x2197=['../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x1937e3,_0x2f69bf){var _0x37ae2d=function(_0x18bccf){while(--_0x18bccf){_0x1937e3['push'](_0x1937e3['shift']());}};_0x37ae2d(++_0x2f69bf);}(_0x2197,0x1a2));var _0x7219=function(_0x161e9a,_0x49f072){_0x161e9a=_0x161e9a-0x0;var _0x4edbf1=_0x2197[_0x161e9a];return _0x4edbf1;};'use strict';var moment=require('moment');var logger=require(_0x7219('0x0'))(_0x7219('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7219('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7219('0x3')),'whatsappInteraction':require(_0x7219('0x4'))};exports['consequence']=function(_0xcd5ae6,_0x2887d8,_0x32ebac,_0x29d4d0){return function(_0xec9e36){try{logger[_0x7219('0x5')](_0x7219('0x6'),_0xcd5ae6,_0x2887d8[0x0]);var _0x11990f={'closed':0x1,'closedAt':moment()[_0x7219('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x2887d8[0x0]};if(rpc[_0x29d4d0[_0x7219('0x8')]+'Interaction']){rpc[_0x29d4d0[_0x7219('0x8')]+_0x7219('0x9')][_0x7219('0xa')](_0x29d4d0['interaction']['id'],_0x11990f)[_0x7219('0xb')](function(_0x145dfb){logger['info'](_0x7219('0xc'),_0xcd5ae6,_0x29d4d0[_0x7219('0xd')]['id']);})[_0x7219('0xe')](function(_0xd0c77d){logger[_0x7219('0xf')](_0x7219('0x10'),_0xcd5ae6,JSON[_0x7219('0x11')](_0xd0c77d));})[_0x7219('0x12')](function(){_0xec9e36['stop']();});}}catch(_0x209c4c){logger[_0x7219('0xf')]('[%s][CLOSE]\x20%s',_0xcd5ae6,JSON['stringify'](_0x209c4c));_0xec9e36['stop']();}};}; \ No newline at end of file +var _0xe1ca=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','[%s][CLOSE]\x20%s','finally','stop','error','stringify','moment','../../../../config/logger','../../rpc/chatInteraction'];(function(_0xad91f9,_0x275b39){var _0x400c72=function(_0xa763a8){while(--_0xa763a8){_0xad91f9['push'](_0xad91f9['shift']());}};_0x400c72(++_0x275b39);}(_0xe1ca,0xa5));var _0xae1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1ca[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xae1c('0x0'));var logger=require(_0xae1c('0x1'))('routing');var rpc={'chatInteraction':require(_0xae1c('0x2')),'openchannelInteraction':require(_0xae1c('0x3')),'smsInteraction':require(_0xae1c('0x4')),'mailInteraction':require(_0xae1c('0x5')),'faxInteraction':require(_0xae1c('0x6')),'whatsappInteraction':require(_0xae1c('0x7'))};exports[_0xae1c('0x8')]=function(_0x2d9197,_0x2708f,_0x3dde11,_0x5cfb2d){return function(_0x1d937a){try{logger[_0xae1c('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x2d9197,_0x2708f[0x0]);var _0x393ce0={'closed':0x1,'closedAt':moment()[_0xae1c('0xa')](_0xae1c('0xb')),'closeReason':_0xae1c('0xc'),'disposition':_0x2708f[0x0]};if(rpc[_0x5cfb2d[_0xae1c('0xd')]+_0xae1c('0xe')]){rpc[_0x5cfb2d[_0xae1c('0xd')]+'Interaction']['update'](_0x5cfb2d['interaction']['id'],_0x393ce0)[_0xae1c('0xf')](function(_0x5442f0){logger[_0xae1c('0x9')](_0xae1c('0x10'),_0x2d9197,_0x5cfb2d[_0xae1c('0x11')]['id']);})[_0xae1c('0x12')](function(_0x49acf6){logger['error'](_0xae1c('0x13'),_0x2d9197,JSON['stringify'](_0x49acf6));})[_0xae1c('0x14')](function(){_0x1d937a[_0xae1c('0x15')]();});}}catch(_0xdf6e2c){logger[_0xae1c('0x16')]('[%s][CLOSE]\x20%s',_0x2d9197,JSON[_0xae1c('0x17')](_0xdf6e2c));_0x1d937a[_0xae1c('0x15')]();}};}; \ 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 4dbc305..c0c807c 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 _0x199c=['UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','body','getMustacheRender','Message','create','then','catch','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','dialogflow','result','fulfillment','providerName','metadata','next','error','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction'];(function(_0x3c6b5d,_0x2ba6b1){var _0x586935=function(_0x9b1979){while(--_0x9b1979){_0x3c6b5d['push'](_0x3c6b5d['shift']());}};_0x586935(++_0x2ba6b1);}(_0x199c,0x1d8));var _0xc199=function(_0x18ffcd,_0x170cbb){_0x18ffcd=_0x18ffcd-0x0;var _0x11ed2d=_0x199c[_0x18ffcd];return _0x11ed2d;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0xc199('0x0'));var md5=require(_0xc199('0x1'));var utils=require(_0xc199('0x2'));var logger=require(_0xc199('0x3'))(_0xc199('0x4'));var rpc={'chatMessage':require(_0xc199('0x5')),'openchannelMessage':require(_0xc199('0x6')),'mailMessage':require(_0xc199('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc199('0x8')),'whatsappMessage':require(_0xc199('0x9'))};exports['consequence']=function(_0x4cd9cb,_0xc2b40a){return function(_0x126236){try{if(!_[_0xc199('0xa')](this[_0xc199('0xb')][_0xc199('0xc')])){logger[_0xc199('0xd')](_0xc199('0xe'),_0x4cd9cb,_0xc199('0xf'));return _0x126236['next']();}var _0x30b717={'ContactId':this[_0xc199('0x10')]['id'],'sentAt':moment()[_0xc199('0x11')](_0xc199('0x12')),'direction':_0xc199('0x13')};if(this[_0xc199('0x14')]==='sms'||this[_0xc199('0x14')]===_0xc199('0x15')){_0x30b717[_0xc199('0x16')]=this[_0xc199('0xb')][_0xc199('0x16')];}var _0x52d3c3=this[_0xc199('0x14')];if(_0x52d3c3===_0xc199('0x17')){_0x30b717[_0xc199('0x18')]=this[_0xc199('0x19')]['id'];}else{_0x30b717[_[_0xc199('0x1a')](_0x52d3c3)+'AccountId']=this['account']['id'];}_0x30b717[_[_0xc199('0x1a')](_0x52d3c3)+'InteractionId']=this[_0xc199('0xb')]['id'];if(this[_0xc199('0xb')]['created']){var _0x445c65=_0xc2b40a[0x2];if(!_['isEmpty'](_0x445c65)){_0x30b717[_0xc199('0x1b')]=utils[_0xc199('0x1c')](_0x445c65,this);return rpc[_0x52d3c3+_0xc199('0x1d')][_0xc199('0x1e')](_0x30b717)[_0xc199('0x1f')](function(_0x40de74){logger[_0xc199('0xd')](_0xc199('0xe'),_0x4cd9cb,_0x30b717[_0xc199('0x1b')]);})[_0xc199('0x20')](function(_0x153098){logger['error'](_0xc199('0xe'),_0x4cd9cb,JSON[_0xc199('0x21')](_0x153098));})[_0xc199('0x22')](function(){logger[_0xc199('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4cd9cb);_0x126236[_0xc199('0x23')]();});}else{logger[_0xc199('0xd')](_0xc199('0x24'),_0x4cd9cb);_0x126236[_0xc199('0x23')]();}}else{var _0x45873f=this;var _0x5c34e8=apiai(_0xc2b40a[0x0],{'language':_0xc2b40a[0x1]||'en'});return _0x5c34e8['textRequest'](this['message'][_0xc199('0x1b')],{'sessionId':md5(this['interaction']['id'])})[_0xc199('0x1f')](function(_0x5cefd7){_0x45873f[_0xc199('0x1b')][_0xc199('0x25')]=_0x5cefd7;_0x30b717['body']=_0x5cefd7[_0xc199('0x26')][_0xc199('0x27')]['speech'];_0x30b717[_0xc199('0x28')]='dialogflow';_0x30b717['providerResponse']=JSON[_0xc199('0x21')](_0x5cefd7);return rpc[_0x52d3c3+_0xc199('0x1d')][_0xc199('0x1e')](_0x30b717)['then'](function(_0x2ed565){logger[_0xc199('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x4cd9cb,_0x30b717[_0xc199('0x1b')]);if(_0x5cefd7['result'][_0xc199('0x29')]['endConversation']){_0x126236[_0xc199('0x2a')]();}else{_0x126236[_0xc199('0x23')]();}})[_0xc199('0x20')](function(_0x1099a3){logger[_0xc199('0x2b')](_0xc199('0xe'),_0x4cd9cb,JSON[_0xc199('0x21')](_0x1099a3));_0x126236[_0xc199('0x2a')]();});})['catch'](function(_0x23f080){logger[_0xc199('0x2b')](_0xc199('0xe'),_0x4cd9cb,_0x23f080['message']);_0x126236[_0xc199('0x2a')]();});}}catch(_0x50f0d3){logger['error'](_0xc199('0xe'),_0x4cd9cb,JSON[_0xc199('0x21')](_0x50f0d3));_0x126236['stop']();}};}; \ No newline at end of file +var _0xf603=['YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','created','isEmpty','body','getMustacheRender','Message','create','then','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','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0x2f63de,_0x11935c){var _0x4acf4b=function(_0x1ac0e4){while(--_0x1ac0e4){_0x2f63de['push'](_0x2f63de['shift']());}};_0x4acf4b(++_0x11935c);}(_0xf603,0x124));var _0x3f60=function(_0x140637,_0x2d3bfe){_0x140637=_0x140637-0x0;var _0x2607ef=_0xf603[_0x140637];return _0x2607ef;};'use strict';var _=require(_0x3f60('0x0'));var moment=require(_0x3f60('0x1'));var apiai=require('apiai-promise');var md5=require(_0x3f60('0x2'));var utils=require(_0x3f60('0x3'));var logger=require(_0x3f60('0x4'))(_0x3f60('0x5'));var rpc={'chatMessage':require(_0x3f60('0x6')),'openchannelMessage':require(_0x3f60('0x7')),'mailMessage':require(_0x3f60('0x8')),'smsMessage':require(_0x3f60('0x9')),'faxMessage':require(_0x3f60('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x49a08c,_0x413b11){return function(_0x43ec55){try{if(!_[_0x3f60('0xb')](this[_0x3f60('0xc')][_0x3f60('0xd')])){logger[_0x3f60('0xe')](_0x3f60('0xf'),_0x49a08c,_0x3f60('0x10'));return _0x43ec55[_0x3f60('0x11')]();}var _0xbeb1f3={'ContactId':this[_0x3f60('0x12')]['id'],'sentAt':moment()[_0x3f60('0x13')](_0x3f60('0x14')),'direction':'out'};if(this['channel']==='sms'||this[_0x3f60('0x15')]===_0x3f60('0x16')){_0xbeb1f3[_0x3f60('0x17')]=this['interaction'][_0x3f60('0x17')];}var _0x64976a=this['channel'];if(_0x64976a===_0x3f60('0x18')){_0xbeb1f3[_0x3f60('0x19')]=this['account']['id'];}else{_0xbeb1f3[_[_0x3f60('0x1a')](_0x64976a)+'AccountId']=this[_0x3f60('0x1b')]['id'];}_0xbeb1f3[_[_0x3f60('0x1a')](_0x64976a)+'InteractionId']=this[_0x3f60('0xc')]['id'];if(this['interaction'][_0x3f60('0x1c')]){var _0x4fe8ee=_0x413b11[0x2];if(!_[_0x3f60('0x1d')](_0x4fe8ee)){_0xbeb1f3[_0x3f60('0x1e')]=utils[_0x3f60('0x1f')](_0x4fe8ee,this);return rpc[_0x64976a+_0x3f60('0x20')][_0x3f60('0x21')](_0xbeb1f3)[_0x3f60('0x22')](function(_0x52aa44){logger[_0x3f60('0xe')](_0x3f60('0xf'),_0x49a08c,_0xbeb1f3[_0x3f60('0x1e')]);})[_0x3f60('0x23')](function(_0x167372){logger[_0x3f60('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x49a08c,JSON[_0x3f60('0x25')](_0x167372));})[_0x3f60('0x26')](function(){logger['info'](_0x3f60('0x27'),_0x49a08c);_0x43ec55[_0x3f60('0x28')]();});}else{logger[_0x3f60('0xe')](_0x3f60('0x29'),_0x49a08c);_0x43ec55[_0x3f60('0x28')]();}}else{var _0x1b161e=this;var _0x44b665=apiai(_0x413b11[0x0],{'language':_0x413b11[0x1]||'en'});return _0x44b665[_0x3f60('0x2a')](this[_0x3f60('0x2b')][_0x3f60('0x1e')],{'sessionId':md5(this[_0x3f60('0xc')]['id'])})[_0x3f60('0x22')](function(_0x1f9390){_0x1b161e[_0x3f60('0x1e')][_0x3f60('0x2c')]=_0x1f9390;_0xbeb1f3['body']=_0x1f9390[_0x3f60('0x2d')][_0x3f60('0x2e')][_0x3f60('0x2f')];_0xbeb1f3[_0x3f60('0x30')]=_0x3f60('0x2c');_0xbeb1f3[_0x3f60('0x31')]=JSON[_0x3f60('0x25')](_0x1f9390);return rpc[_0x64976a+_0x3f60('0x20')]['create'](_0xbeb1f3)[_0x3f60('0x22')](function(_0x1829f2){logger[_0x3f60('0xe')](_0x3f60('0xf'),_0x49a08c,_0xbeb1f3[_0x3f60('0x1e')]);if(_0x1f9390[_0x3f60('0x2d')][_0x3f60('0x32')][_0x3f60('0x33')]){_0x43ec55[_0x3f60('0x11')]();}else{_0x43ec55[_0x3f60('0x28')]();}})[_0x3f60('0x23')](function(_0x457e5b){logger[_0x3f60('0x24')](_0x3f60('0xf'),_0x49a08c,JSON[_0x3f60('0x25')](_0x457e5b));_0x43ec55[_0x3f60('0x11')]();});})[_0x3f60('0x23')](function(_0x3dd647){logger[_0x3f60('0x24')](_0x3f60('0xf'),_0x49a08c,_0x3dd647[_0x3f60('0x2b')]);_0x43ec55[_0x3f60('0x11')]();});}}catch(_0x190306){logger[_0x3f60('0x24')](_0x3f60('0xf'),_0x49a08c,JSON[_0x3f60('0x25')](_0x190306));_0x43ec55[_0x3f60('0x28')]();}};}; \ 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 97baa28..319e79b 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 _0x24c9=['../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','interaction','UserId','next','contact','out','channel','sms','phone','chat','AccountId','account','upperFirst','InteractionId','created','getMustacheRender','then','body','finally','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','providerResponse','push','all','lodash','dialogflow','md5','moment'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x24c9,0x1ca));var _0x924c=function(_0x5267cc,_0xc00f2c){_0x5267cc=_0x5267cc-0x0;var _0x2f2453=_0x24c9[_0x5267cc];return _0x2f2453;};'use strict';var _=require(_0x924c('0x0'));var dialogflow=require(_0x924c('0x1'));var md5=require(_0x924c('0x2'));var moment=require(_0x924c('0x3'));var Promise=require('bluebird');var logger=require(_0x924c('0x4'))(_0x924c('0x5'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x924c('0x6')),'mailMessage':require(_0x924c('0x7')),'smsMessage':require(_0x924c('0x8')),'faxMessage':require(_0x924c('0x9')),'whatsappMessage':require(_0x924c('0xa'))};function createMessage(_0x1aec07,_0x52c356,_0x287618,_0xdbbd46){return new Promise(function(_0x5f0f52,_0x2c55cd){var _0x436eeb=_[_0x924c('0xb')](_0x287618);_0x436eeb['body']=_0xdbbd46;return rpc[_0x52c356+_0x924c('0xc')][_0x924c('0xd')](_0x436eeb)['then'](function(){logger[_0x924c('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x1aec07,_0x436eeb['body']);_0x5f0f52();})[_0x924c('0xf')](function(_0x157fa7){logger[_0x924c('0x10')](_0x924c('0x11'),_0x1aec07,JSON[_0x924c('0x12')](_0x157fa7));_0x2c55cd(_0x157fa7);});});}exports['consequence']=function(_0x4069bd,_0x56663f){return function(_0x30c920){try{if(!_['isNil'](this[_0x924c('0x13')][_0x924c('0x14')])){logger[_0x924c('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x4069bd,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x30c920[_0x924c('0x15')]();}var _0x349e3e={'ContactId':this[_0x924c('0x16')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x924c('0x17')};if(this[_0x924c('0x18')]===_0x924c('0x19')||this[_0x924c('0x18')]==='whatsapp'){_0x349e3e[_0x924c('0x1a')]=this[_0x924c('0x13')][_0x924c('0x1a')];}var _0x550e78=this[_0x924c('0x18')];if(_0x550e78===_0x924c('0x1b')){_0x349e3e['ChatWebsiteId']=this['account']['id'];}else{_0x349e3e[_['upperFirst'](_0x550e78)+_0x924c('0x1c')]=this[_0x924c('0x1d')]['id'];}_0x349e3e[_[_0x924c('0x1e')](_0x550e78)+_0x924c('0x1f')]=this['interaction']['id'];if(this[_0x924c('0x13')][_0x924c('0x20')]){var _0x5496d8=_0x56663f[0x4];if(!_['isEmpty'](_0x5496d8)){_0x349e3e['body']=utils[_0x924c('0x21')](_0x5496d8,this);return rpc[_0x550e78+'Message'][_0x924c('0xd')](_0x349e3e)[_0x924c('0x22')](function(_0x1d3307){logger['info'](_0x924c('0x11'),_0x4069bd,_0x349e3e[_0x924c('0x23')]);})['catch'](function(_0x10cca4){logger['error'](_0x924c('0x11'),_0x4069bd,JSON[_0x924c('0x12')](_0x10cca4));})[_0x924c('0x24')](function(){logger[_0x924c('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4069bd);_0x30c920[_0x924c('0x25')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4069bd);_0x30c920['stop']();}}else{var _0x510b28=this;var _0x4eed65=_0x56663f[0x2][_0x924c('0x26')](/\\n/g,'\x0a');var _0x1a7109={'credentials':{'private_key':_0x4eed65,'client_email':_0x56663f[0x1]}};var _0x5f3446=new dialogflow[(_0x924c('0x27'))](_0x1a7109);var _0x2efe91=_0x5f3446[_0x924c('0x28')](_0x56663f[0x0],md5(_0x510b28[_0x924c('0x13')]['id']));var _0x42f020={'session':_0x2efe91,'queryInput':{'text':{'text':_0x510b28[_0x924c('0x29')]['body'],'languageCode':_0x56663f[0x3]||'en'}}};return _0x5f3446[_0x924c('0x2a')](_0x42f020)['then'](function(_0xe48425){if(_0xe48425&&_0xe48425[_0x924c('0x2b')]){_0x510b28[_0x924c('0x23')][_0x924c('0x2c')]=_0xe48425;var _0x515db8=_0xe48425[0x0];var _0x3ddd82=_0x515db8[_0x924c('0x2d')]['diagnosticInfo']&&_0x515db8[_0x924c('0x2d')][_0x924c('0x2e')][_0x924c('0x2f')]?_0x515db8[_0x924c('0x2d')][_0x924c('0x2e')][_0x924c('0x2f')][_0x924c('0x30')][_0x924c('0x31')]:![];_0x510b28['body'][_0x924c('0x32')]=_0x515db8[_0x924c('0x2d')][_0x924c('0x33')];_0x510b28[_0x924c('0x23')][_0x924c('0x34')]=_0x515db8['queryResult']['allRequiredParamsPresent'];_0x510b28['body'][_0x924c('0x35')]=_0x515db8['queryResult'][_0x924c('0x2e')]&&_0x515db8['queryResult'][_0x924c('0x2e')]['fields']?_0x515db8['queryResult'][_0x924c('0x2e')][_0x924c('0x2f')]['end_conversation']['boolValue']:![];_0x510b28[_0x924c('0x23')][_0x924c('0x36')]=_0x515db8['queryResult'][_0x924c('0x37')][_0x924c('0x38')];_0x510b28[_0x924c('0x23')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x515db8[_0x924c('0x2d')][_0x924c('0x37')][_0x924c('0x39')];_0x510b28[_0x924c('0x23')][_0x924c('0x3a')]=_0x515db8[_0x924c('0x2d')][_0x924c('0x37')][_0x924c('0x3b')];_0x510b28['body'][_0x924c('0x3c')]=_0x515db8[_0x924c('0x2d')][_0x924c('0x3d')];_0x510b28[_0x924c('0x23')][_0x924c('0x3e')]=_0x515db8[_0x924c('0x2d')]['queryText'];_0x510b28[_0x924c('0x23')]['DIALOGFLOWV2_SCORE']=_0x515db8[_0x924c('0x2d')]['intentDetectionConfidence'];_0x349e3e['providerName']=_0x924c('0x2c');_0x349e3e[_0x924c('0x3f')]=JSON[_0x924c('0x12')](_0xe48425);var _0x283354=[];for(var _0x2a9388=0x0;_0x2a9388<_0xe48425['length'];_0x2a9388++){var _0x5411f4=_0xe48425[_0x2a9388];if(_0x5411f4&&_0x5411f4[_0x924c('0x2d')]&&_0x5411f4['queryResult']['fulfillmentText']){_0x283354[_0x924c('0x40')](createMessage(_0x4069bd,_0x550e78,_0x349e3e,_0x5411f4[_0x924c('0x2d')]['fulfillmentText']));}}return Promise[_0x924c('0x41')](_0x283354)[_0x924c('0x22')](function(){if(_0x3ddd82){_0x30c920[_0x924c('0x15')]();}else{_0x30c920[_0x924c('0x25')]();}})['catch'](function(_0x26e7bc){logger[_0x924c('0x10')](_0x924c('0x11'),_0x4069bd,JSON['stringify'](_0x26e7bc));_0x30c920[_0x924c('0x15')]();});}})[_0x924c('0xf')](function(_0x26e620){logger[_0x924c('0x10')](_0x924c('0x11'),_0x4069bd,_0x26e620['message'],_0x26e620['stack']);_0x30c920[_0x924c('0x15')]();});}}catch(_0x1d23e0){logger[_0x924c('0x10')](_0x924c('0x11'),_0x4069bd,JSON[_0x924c('0x12')](_0x1d23e0));_0x30c920['stop']();}};}; \ No newline at end of file +var _0x1979=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','providerName','length','fulfillmentText','push','message','lodash','dialogflow','moment','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','then','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x1afc02,_0x102049){var _0x19e94a=function(_0x40f4e2){while(--_0x40f4e2){_0x1afc02['push'](_0x1afc02['shift']());}};_0x19e94a(++_0x102049);}(_0x1979,0x1b9));var _0x9197=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x1979[_0x38c699];return _0x3b1ded;};'use strict';var _=require(_0x9197('0x0'));var dialogflow=require(_0x9197('0x1'));var md5=require('md5');var moment=require(_0x9197('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x9197('0x3'));var utils=require(_0x9197('0x4'));var rpc={'chatMessage':require(_0x9197('0x5')),'openchannelMessage':require(_0x9197('0x6')),'mailMessage':require(_0x9197('0x7')),'smsMessage':require(_0x9197('0x8')),'faxMessage':require(_0x9197('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x5be4f4,_0x5968e7,_0x512f2a,_0x38f778){return new Promise(function(_0x178ee3,_0x5b4ad9){var _0xcd4024=_[_0x9197('0xa')](_0x512f2a);_0xcd4024[_0x9197('0xb')]=_0x38f778;return rpc[_0x5968e7+_0x9197('0xc')][_0x9197('0xd')](_0xcd4024)['then'](function(){logger[_0x9197('0xe')](_0x9197('0xf'),_0x5be4f4,_0xcd4024[_0x9197('0xb')]);_0x178ee3();})[_0x9197('0x10')](function(_0xe1641b){logger[_0x9197('0x11')](_0x9197('0xf'),_0x5be4f4,JSON[_0x9197('0x12')](_0xe1641b));_0x5b4ad9(_0xe1641b);});});}exports['consequence']=function(_0x16124d,_0x432631){return function(_0x21dade){try{if(!_[_0x9197('0x13')](this[_0x9197('0x14')][_0x9197('0x15')])){logger[_0x9197('0xe')](_0x9197('0xf'),_0x16124d,_0x9197('0x16'));return _0x21dade[_0x9197('0x17')]();}var _0x51796c={'ContactId':this[_0x9197('0x18')]['id'],'sentAt':moment()['format'](_0x9197('0x19')),'direction':_0x9197('0x1a')};if(this['channel']===_0x9197('0x1b')||this['channel']==='whatsapp'){_0x51796c[_0x9197('0x1c')]=this[_0x9197('0x14')][_0x9197('0x1c')];}var _0x4ff4da=this[_0x9197('0x1d')];if(_0x4ff4da===_0x9197('0x1e')){_0x51796c[_0x9197('0x1f')]=this[_0x9197('0x20')]['id'];}else{_0x51796c[_[_0x9197('0x21')](_0x4ff4da)+_0x9197('0x22')]=this['account']['id'];}_0x51796c[_[_0x9197('0x21')](_0x4ff4da)+_0x9197('0x23')]=this[_0x9197('0x14')]['id'];if(this[_0x9197('0x14')][_0x9197('0x24')]){var _0x3de796=_0x432631[0x4];if(!_[_0x9197('0x25')](_0x3de796)){_0x51796c[_0x9197('0xb')]=utils[_0x9197('0x26')](_0x3de796,this);return rpc[_0x4ff4da+_0x9197('0xc')]['create'](_0x51796c)[_0x9197('0x27')](function(_0x457d66){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x16124d,_0x51796c[_0x9197('0xb')]);})[_0x9197('0x10')](function(_0x23bf4e){logger[_0x9197('0x11')](_0x9197('0xf'),_0x16124d,JSON[_0x9197('0x12')](_0x23bf4e));})['finally'](function(){logger['info'](_0x9197('0x28'),_0x16124d);_0x21dade[_0x9197('0x29')]();});}else{logger['info'](_0x9197('0x2a'),_0x16124d);_0x21dade[_0x9197('0x29')]();}}else{var _0x2569f8=this;var _0x23c150=_0x432631[0x2]['replace'](/\\n/g,'\x0a');var _0x20030e={'credentials':{'private_key':_0x23c150,'client_email':_0x432631[0x1]}};var _0x3edbcd=new dialogflow['SessionsClient'](_0x20030e);var _0x81a3ca=_0x3edbcd[_0x9197('0x2b')](_0x432631[0x0],md5(_0x2569f8['interaction']['id']));var _0x5b6cfb={'session':_0x81a3ca,'queryInput':{'text':{'text':_0x2569f8['message'][_0x9197('0xb')],'languageCode':_0x432631[0x3]||'en'}}};return _0x3edbcd[_0x9197('0x2c')](_0x5b6cfb)[_0x9197('0x27')](function(_0x589247){if(_0x589247&&_0x589247['length']){_0x2569f8['body']['dialogflowV2']=_0x589247;var _0x2b3b99=_0x589247[0x0];var _0x17aa63=_0x2b3b99[_0x9197('0x2d')][_0x9197('0x2e')]&&_0x2b3b99[_0x9197('0x2d')]['diagnosticInfo']['fields']?_0x2b3b99['queryResult'][_0x9197('0x2e')][_0x9197('0x2f')][_0x9197('0x30')][_0x9197('0x31')]:![];_0x2569f8[_0x9197('0xb')][_0x9197('0x32')]=_0x2b3b99[_0x9197('0x2d')][_0x9197('0x33')];_0x2569f8[_0x9197('0xb')][_0x9197('0x34')]=_0x2b3b99[_0x9197('0x2d')][_0x9197('0x35')];_0x2569f8[_0x9197('0xb')][_0x9197('0x36')]=_0x2b3b99[_0x9197('0x2d')][_0x9197('0x2e')]&&_0x2b3b99[_0x9197('0x2d')]['diagnosticInfo'][_0x9197('0x2f')]?_0x2b3b99[_0x9197('0x2d')][_0x9197('0x2e')][_0x9197('0x2f')][_0x9197('0x30')]['boolValue']:![];_0x2569f8['body']['DIALOGFLOWV2_INTENTNAME']=_0x2b3b99[_0x9197('0x2d')][_0x9197('0x37')][_0x9197('0x38')];_0x2569f8[_0x9197('0xb')][_0x9197('0x39')]=_0x2b3b99[_0x9197('0x2d')]['intent'][_0x9197('0x3a')];_0x2569f8[_0x9197('0xb')][_0x9197('0x3b')]=_0x2b3b99[_0x9197('0x2d')]['intent']['isFallback'];_0x2569f8[_0x9197('0xb')][_0x9197('0x3c')]=_0x2b3b99[_0x9197('0x2d')][_0x9197('0x3d')];_0x2569f8[_0x9197('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x2b3b99[_0x9197('0x2d')][_0x9197('0x3e')];_0x2569f8[_0x9197('0xb')][_0x9197('0x3f')]=_0x2b3b99[_0x9197('0x2d')]['intentDetectionConfidence'];_0x51796c[_0x9197('0x40')]='dialogflowV2';_0x51796c['providerResponse']=JSON[_0x9197('0x12')](_0x589247);var _0x3dc769=[];for(var _0x4e55f5=0x0;_0x4e55f5<_0x589247[_0x9197('0x41')];_0x4e55f5++){var _0x3e0604=_0x589247[_0x4e55f5];if(_0x3e0604&&_0x3e0604[_0x9197('0x2d')]&&_0x3e0604[_0x9197('0x2d')][_0x9197('0x42')]){_0x3dc769[_0x9197('0x43')](createMessage(_0x16124d,_0x4ff4da,_0x51796c,_0x3e0604[_0x9197('0x2d')][_0x9197('0x42')]));}}return Promise['all'](_0x3dc769)[_0x9197('0x27')](function(){if(_0x17aa63){_0x21dade[_0x9197('0x17')]();}else{_0x21dade[_0x9197('0x29')]();}})[_0x9197('0x10')](function(_0x385e85){logger[_0x9197('0x11')](_0x9197('0xf'),_0x16124d,JSON['stringify'](_0x385e85));_0x21dade[_0x9197('0x17')]();});}})[_0x9197('0x10')](function(_0x31b066){logger[_0x9197('0x11')](_0x9197('0xf'),_0x16124d,_0x31b066[_0x9197('0x44')],_0x31b066['stack']);_0x21dade[_0x9197('0x17')]();});}}catch(_0x45829e){logger[_0x9197('0x11')](_0x9197('0xf'),_0x16124d,JSON[_0x9197('0x12')](_0x45829e));_0x21dade[_0x9197('0x29')]();}};}; \ 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 b70223a..e9efad2 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 _0xee87=['consequence','replace','validate','error','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x526d62,_0x7f3be){var _0x273839=function(_0x3aa857){while(--_0x3aa857){_0x526d62['push'](_0x526d62['shift']());}};_0x273839(++_0x7f3be);}(_0xee87,0x19a));var _0x7ee8=function(_0x5768f2,_0x1d26f9){_0x5768f2=_0x5768f2-0x0;var _0x9401b5=_0xee87[_0x5768f2];return _0x9401b5;};'use strict';var schema=require('validate');var _=require(_0x7ee8('0x0'));var htmlToText=require(_0x7ee8('0x1'));var utils=require(_0x7ee8('0x2'));var logger=require(_0x7ee8('0x3'))(_0x7ee8('0x4'));var gotoif=schema({'condition':{'type':_0x7ee8('0x5'),'required':!![],'message':_0x7ee8('0x6')},'priorityTrue':{'type':_0x7ee8('0x7'),'message':_0x7ee8('0x8')},'priorityFalse':{'type':_0x7ee8('0x7'),'message':_0x7ee8('0x9')}});exports[_0x7ee8('0xa')]=function(_0x111068,_0x139e39){return function(_0x3b0e7f){try{var _0x463c35={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x139e39[0x0],this),{'wordwrap':![]})[_0x7ee8('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x139e39[0x1],'priorityFalse':_0x139e39[0x2]};var _0x139257=gotoif[_0x7ee8('0xc')](_0x463c35,{'typecast':!![]});if(_0x139257['length']){logger[_0x7ee8('0xd')]('[%s][GOTOIF]\x20%s',_0x111068,_[_0x7ee8('0xe')](_0x139257,_0x7ee8('0xf'))[_0x7ee8('0x10')](',\x20'));_0x3b0e7f[_0x7ee8('0x11')]();}else{try{var _0x5800d=eval('('+_0x463c35[_0x7ee8('0x12')]+')');var _0x499c52=_0x5800d?_0x463c35['priorityTrue']:_0x463c35[_0x7ee8('0x13')];logger[_0x7ee8('0x14')](_0x7ee8('0x15'),_0x111068,_0x463c35[_0x7ee8('0x12')],_0x5800d,_0x499c52||_0x7ee8('0x16'));if(_0x499c52){var _0x22a6e1=_['findIndex'](_0x3b0e7f[_0x7ee8('0x17')](),{'p':_0x499c52});if(_0x22a6e1>=0x0){logger['info'](_0x7ee8('0x18'),_0x111068,_0x499c52||_0x7ee8('0x16'),_0x22a6e1);_0x3b0e7f[_0x7ee8('0x16')](_0x22a6e1);}else{logger[_0x7ee8('0x14')](_0x7ee8('0x19'),_0x111068,_0x499c52||_0x7ee8('0x16'));_0x3b0e7f[_0x7ee8('0x11')]();}}else{_0x3b0e7f[_0x7ee8('0x16')]();}}catch(_0x1c892f){logger['error'](_0x7ee8('0x1a'),_0x111068,_0x1c892f[_0x7ee8('0xf')]);_0x3b0e7f[_0x7ee8('0x11')]();}}}catch(_0x5d9f59){logger['error'](_0x7ee8('0x1b'),_0x111068,JSON['stringify'](_0x5d9f59));_0x3b0e7f[_0x7ee8('0x11')]();}};}; \ No newline at end of file +var _0x5769=['fromString','replace','length','error','map','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x1c73ee,_0x19c0fc){var _0x3b88d4=function(_0xa471cf){while(--_0xa471cf){_0x1c73ee['push'](_0x1c73ee['shift']());}};_0x3b88d4(++_0x19c0fc);}(_0x5769,0x162));var _0x9576=function(_0x181600,_0x817634){_0x181600=_0x181600-0x0;var _0x3b65b6=_0x5769[_0x181600];return _0x3b65b6;};'use strict';var schema=require(_0x9576('0x0'));var _=require('lodash');var htmlToText=require(_0x9576('0x1'));var utils=require('./utils');var logger=require(_0x9576('0x2'))('routing');var gotoif=schema({'condition':{'type':_0x9576('0x3'),'required':!![],'message':_0x9576('0x4')},'priorityTrue':{'type':_0x9576('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x9576('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x1dc682,_0x4b390a){return function(_0x3c1db1){try{var _0x4f229a={'condition':htmlToText[_0x9576('0x6')](utils['getMustacheRender'](_0x4b390a[0x0],this),{'wordwrap':![]})[_0x9576('0x7')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4b390a[0x1],'priorityFalse':_0x4b390a[0x2]};var _0x12785b=gotoif[_0x9576('0x0')](_0x4f229a,{'typecast':!![]});if(_0x12785b[_0x9576('0x8')]){logger[_0x9576('0x9')]('[%s][GOTOIF]\x20%s',_0x1dc682,_[_0x9576('0xa')](_0x12785b,'message')[_0x9576('0xb')](',\x20'));_0x3c1db1['stop']();}else{try{var _0x1bd010=eval('('+_0x4f229a[_0x9576('0xc')]+')');var _0x52a1ce=_0x1bd010?_0x4f229a[_0x9576('0xd')]:_0x4f229a[_0x9576('0xe')];logger[_0x9576('0xf')](_0x9576('0x10'),_0x1dc682,_0x4f229a[_0x9576('0xc')],_0x1bd010,_0x52a1ce||_0x9576('0x11'));if(_0x52a1ce){var _0x19beb0=_[_0x9576('0x12')](_0x3c1db1[_0x9576('0x13')](),{'p':_0x52a1ce});if(_0x19beb0>=0x0){logger[_0x9576('0xf')](_0x9576('0x14'),_0x1dc682,_0x52a1ce||_0x9576('0x11'),_0x19beb0);_0x3c1db1['next'](_0x19beb0);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1dc682,_0x52a1ce||_0x9576('0x11'));_0x3c1db1[_0x9576('0x15')]();}}else{_0x3c1db1[_0x9576('0x11')]();}}catch(_0xf273d3){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1dc682,_0xf273d3['message']);_0x3c1db1[_0x9576('0x15')]();}}}catch(_0x3ffe3a){logger[_0x9576('0x9')](_0x9576('0x16'),_0x1dc682,JSON[_0x9576('0x17')](_0x3ffe3a));_0x3c1db1[_0x9576('0x15')]();}};}; \ 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 2ee3195..94141d8 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 _0x53a2=['stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','[%s][GOTOP]\x20%s','map','join'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x53a2,0x91));var _0x253a=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x53a2[_0x18ab2a];return _0x16dcee;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0x253a('0x0'));var gotop=schema({'priority':{'type':_0x253a('0x1'),'required':!![],'message':_0x253a('0x2')}});exports['consequence']=function(_0x126433,_0xd7272a){return function(_0x120311){try{var _0x46044c={'priority':_0xd7272a[0x0]};var _0x157c78=gotop[_0x253a('0x3')](_0x46044c,{'typecast':!![]});if(_0x157c78[_0x253a('0x4')]){logger['error'](_0x253a('0x5'),_0x126433,_[_0x253a('0x6')](_0x157c78,'message')[_0x253a('0x7')](',\x20'));_0x120311[_0x253a('0x8')]();}else{logger[_0x253a('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x126433,_0x46044c[_0x253a('0xa')]);if(_0x46044c[_0x253a('0xa')]){var _0x5166b1=_[_0x253a('0xb')](_0x120311['rules'](),{'p':_0x46044c[_0x253a('0xa')]});if(_0x5166b1>=0x0){logger[_0x253a('0x9')](_0x253a('0xc'),_0x126433,_0x46044c[_0x253a('0xa')]||'next',_0x5166b1);_0x120311[_0x253a('0xd')](_0x5166b1);}else{logger[_0x253a('0x9')](_0x253a('0xe'),_0x126433,_0x46044c[_0x253a('0xa')]||_0x253a('0xd'));_0x120311[_0x253a('0x8')]();}}else{_0x120311[_0x253a('0xd')]();}}}catch(_0x195f19){logger[_0x253a('0xf')](_0x253a('0x5'),_0x126433,JSON[_0x253a('0x10')](_0x195f19));_0x120311[_0x253a('0x8')]();}};}; \ No newline at end of file +var _0xe59e=['length','error','map','join','stop','priority','findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x53ddab,_0x4ada9d){var _0x5819ac=function(_0x4d5fc8){while(--_0x4d5fc8){_0x53ddab['push'](_0x53ddab['shift']());}};_0x5819ac(++_0x4ada9d);}(_0xe59e,0xfd));var _0xee59=function(_0x2d7d89,_0x5a63d0){_0x2d7d89=_0x2d7d89-0x0;var _0x18dd24=_0xe59e[_0x2d7d89];return _0x18dd24;};'use strict';var schema=require(_0xee59('0x0'));var _=require(_0xee59('0x1'));var logger=require(_0xee59('0x2'))(_0xee59('0x3'));var gotop=schema({'priority':{'type':_0xee59('0x4'),'required':!![],'message':_0xee59('0x5')}});exports[_0xee59('0x6')]=function(_0x279045,_0x5d90f9){return function(_0x252fff){try{var _0x42d3d4={'priority':_0x5d90f9[0x0]};var _0x35ac02=gotop[_0xee59('0x0')](_0x42d3d4,{'typecast':!![]});if(_0x35ac02[_0xee59('0x7')]){logger[_0xee59('0x8')]('[%s][GOTOP]\x20%s',_0x279045,_[_0xee59('0x9')](_0x35ac02,'message')[_0xee59('0xa')](',\x20'));_0x252fff[_0xee59('0xb')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x279045,_0x42d3d4[_0xee59('0xc')]);if(_0x42d3d4[_0xee59('0xc')]){var _0x582caf=_[_0xee59('0xd')](_0x252fff[_0xee59('0xe')](),{'p':_0x42d3d4[_0xee59('0xc')]});if(_0x582caf>=0x0){logger[_0xee59('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x279045,_0x42d3d4['priority']||_0xee59('0x10'),_0x582caf);_0x252fff[_0xee59('0x10')](_0x582caf);}else{logger['info'](_0xee59('0x11'),_0x279045,_0x42d3d4[_0xee59('0xc')]||_0xee59('0x10'));_0x252fff[_0xee59('0xb')]();}}else{_0x252fff['next']();}}}catch(_0x426e35){logger[_0xee59('0x8')](_0xee59('0x12'),_0x279045,JSON[_0xee59('0x13')](_0x426e35));_0x252fff['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 4aaee6b..af83c63 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 _0x9789=['Message','create','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','chat','ChatWebsiteId','upperFirst','channel','account','InteractionId'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9789,0xc7));var _0x9978=function(_0x48081d,_0x2091f0){_0x48081d=_0x48081d-0x0;var _0x2904bb=_0x9789[_0x48081d];return _0x2904bb;};'use strict';var _=require(_0x9978('0x0'));var utils=require(_0x9978('0x1'));var logger=require(_0x9978('0x2'))('routing');var rpc={'chatMessage':require(_0x9978('0x3')),'openchannelMessage':require(_0x9978('0x4')),'mailMessage':require(_0x9978('0x5')),'smsMessage':require(_0x9978('0x6')),'faxMessage':require(_0x9978('0x7')),'whatsappMessage':require(_0x9978('0x8'))};exports[_0x9978('0x9')]=function(_0x2a1751,_0x556690){return function(_0x2bb8ff){try{var _0x1f3ad0={'body':utils['getMustacheRender'](_0x556690[0x0],this),'ContactId':this[_0x9978('0xa')]['id']};if(this['channel']===_0x9978('0xb')){_0x1f3ad0[_0x9978('0xc')]=this['account']['id'];}else{_0x1f3ad0[_[_0x9978('0xd')](this[_0x9978('0xe')])+'AccountId']=this[_0x9978('0xf')]['id'];}_0x1f3ad0[_[_0x9978('0xd')](this[_0x9978('0xe')])+_0x9978('0x10')]=this['interaction']['id'];if(rpc[this['channel']+_0x9978('0x11')]){return rpc[this['channel']+_0x9978('0x11')][_0x9978('0x12')](_0x1f3ad0)['then'](function(_0x5a40c2){logger['info'](_0x9978('0x13'),_0x2a1751,_0x1f3ad0['body']);_0x2bb8ff[_0x9978('0x14')]();})['catch'](function(_0x525f56){logger[_0x9978('0x15')](_0x9978('0x13'),_0x2a1751,JSON[_0x9978('0x16')](_0x525f56));_0x2bb8ff[_0x9978('0x17')]();});}}catch(_0x29fd6f){logger[_0x9978('0x15')](_0x9978('0x13'),_0x2a1751,JSON[_0x9978('0x16')](_0x29fd6f));_0x2bb8ff['stop']();}};}; \ No newline at end of file +var _0x37e9=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x37e9,0x1f4));var _0x937e=function(_0x446384,_0x261f80){_0x446384=_0x446384-0x0;var _0x2d6e2f=_0x37e9[_0x446384];return _0x2d6e2f;};'use strict';var _=require('lodash');var utils=require(_0x937e('0x0'));var logger=require(_0x937e('0x1'))(_0x937e('0x2'));var rpc={'chatMessage':require(_0x937e('0x3')),'openchannelMessage':require(_0x937e('0x4')),'mailMessage':require(_0x937e('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x937e('0x6')),'whatsappMessage':require(_0x937e('0x7'))};exports[_0x937e('0x8')]=function(_0x40418b,_0x3830a6){return function(_0x24c1c7){try{var _0x5a648d={'body':utils[_0x937e('0x9')](_0x3830a6[0x0],this),'ContactId':this[_0x937e('0xa')]['id']};if(this[_0x937e('0xb')]==='chat'){_0x5a648d[_0x937e('0xc')]=this[_0x937e('0xd')]['id'];}else{_0x5a648d[_[_0x937e('0xe')](this['channel'])+'AccountId']=this[_0x937e('0xd')]['id'];}_0x5a648d[_['upperFirst'](this[_0x937e('0xb')])+_0x937e('0xf')]=this[_0x937e('0x10')]['id'];if(rpc[this['channel']+_0x937e('0x11')]){return rpc[this[_0x937e('0xb')]+'Message'][_0x937e('0x12')](_0x5a648d)[_0x937e('0x13')](function(_0x39dbc4){logger[_0x937e('0x14')](_0x937e('0x15'),_0x40418b,_0x5a648d[_0x937e('0x16')]);_0x24c1c7[_0x937e('0x17')]();})[_0x937e('0x18')](function(_0x52edab){logger[_0x937e('0x19')](_0x937e('0x15'),_0x40418b,JSON['stringify'](_0x52edab));_0x24c1c7[_0x937e('0x1a')]();});}}catch(_0x2735d5){logger[_0x937e('0x19')](_0x937e('0x15'),_0x40418b,JSON[_0x937e('0x1b')](_0x2735d5));_0x24c1c7[_0x937e('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 99811a2..bbd34bd 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 _0xdf23=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdf23,0x7f));var _0x3df2=function(_0x230324,_0x336f9b){_0x230324=_0x230324-0x0;var _0x3ed632=_0xdf23[_0x230324];return _0x3ed632;};'use strict';var utils=require(_0x3df2('0x0'));var logger=require(_0x3df2('0x1'))(_0x3df2('0x2'));exports[_0x3df2('0x3')]=function(_0x443006,_0x4c6bb3){return function(_0x224933){try{logger[_0x3df2('0x4')](_0x3df2('0x5'),_0x443006,utils[_0x3df2('0x6')](_0x4c6bb3[0x0],this));_0x224933[_0x3df2('0x7')]();}catch(_0x4ee1ce){logger[_0x3df2('0x8')]('[%s][NOOP]\x20%s',_0x443006,JSON[_0x3df2('0x9')](_0x4ee1ce));_0x224933[_0x3df2('0xa')]();}};}; \ No newline at end of file +var _0x90b5=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','stringify','stop'];(function(_0x3b4756,_0x3ee9b7){var _0x3ce1a5=function(_0x2ca195){while(--_0x2ca195){_0x3b4756['push'](_0x3b4756['shift']());}};_0x3ce1a5(++_0x3ee9b7);}(_0x90b5,0x1b9));var _0x590b=function(_0x2abfd6,_0x488035){_0x2abfd6=_0x2abfd6-0x0;var _0x13f52e=_0x90b5[_0x2abfd6];return _0x13f52e;};'use strict';var utils=require(_0x590b('0x0'));var logger=require(_0x590b('0x1'))(_0x590b('0x2'));exports[_0x590b('0x3')]=function(_0x4e031d,_0x46ce0d){return function(_0x2ad8c7){try{logger[_0x590b('0x4')](_0x590b('0x5'),_0x4e031d,utils['getMustacheRender'](_0x46ce0d[0x0],this));_0x2ad8c7[_0x590b('0x6')]();}catch(_0x115027){logger['error'](_0x590b('0x5'),_0x4e031d,JSON[_0x590b('0x7')](_0x115027));_0x2ad8c7[_0x590b('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index b9a4d3f..bc3a7d9 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 _0xaf00=['redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','interaction','channel','MessageId','message','chat','WebsiteId','account','info','name','QueueReport','create','catch','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','stop','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','util','seq-queue','moment','../../../../config/logger','routing','./strategy'];(function(_0x5510a6,_0x4975b9){var _0x962a10=function(_0x5cca76){while(--_0x5cca76){_0x5510a6['push'](_0x5510a6['shift']());}};_0x962a10(++_0x4975b9);}(_0xaf00,0xf5));var _0x0af0=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0xaf00[_0x1d83db];return _0x2dc1d1;};'use strict';var schema=require(_0x0af0('0x0'));var _=require('lodash');var util=require(_0x0af0('0x1'));var seqqueue=require(_0x0af0('0x2'));var moment=require(_0x0af0('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x0af0('0x4'))(_0x0af0('0x5'));var strategy=require(_0x0af0('0x6'));config[_0x0af0('0x7')]=_[_0x0af0('0x8')](config[_0x0af0('0x7')],{'host':_0x0af0('0x9'),'port':0x18eb});var io=require(_0x0af0('0xa'))(new Redis(config[_0x0af0('0x7')]));var attributes=['id',_0x0af0('0xb'),'account',_0x0af0('0xc'),_0x0af0('0xd'),_0x0af0('0xe')];function emit(_0x1bb550,_0x1bd51d,_0x6bcc5a){io['to'](_0x1bb550)[_0x0af0('0xf')](_0x1bd51d,_0x6bcc5a);}function emitChannelQueueInteraction(_0x245193,_0x4cc9fa,_0x1f1a79,_0xca5aed,_0x1df7a3,_0xf68742,_0xa2a860,_0x56c5b9){var _0x12a27b=_[_0x0af0('0x10')](_0x1f1a79);_0x12a27b[_0x0af0('0xb')]=_0x56c5b9;_0x12a27b[_0x0af0('0xc')]=_0x4cc9fa;_0x12a27b['account']=_0xca5aed;_0x12a27b['id']=_0x1df7a3;if(_0xf68742){attributes['push'](_[_0x0af0('0x11')](_0x245193)+_0x0af0('0x12'));_0xa2a860[util[_0x0af0('0x13')]('%sQueuesWaitingInteractions',_0x245193)][_0x1df7a3]=_[_0x0af0('0x14')](_0x12a27b,attributes);}else{delete _0xa2a860[util[_0x0af0('0x13')](_0x0af0('0x15'),_0x245193)][_0x1df7a3];}emit(util[_0x0af0('0x13')](_0x0af0('0x16'),_0x245193,_0x4cc9fa),util[_0x0af0('0x13')](_0x0af0('0x17'),_0x245193,_0xf68742?_0x0af0('0x18'):_0x0af0('0x19')),_['pick'](_0x12a27b,attributes));}var rpc={'openchannelQueueReport':require(_0x0af0('0x1a')),'mailQueueReport':require(_0x0af0('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x0af0('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x0af0('0x1d')),'chatInteraction':require(_0x0af0('0x1e')),'faxInteraction':require(_0x0af0('0x1f')),'mailInteraction':require(_0x0af0('0x20')),'openchannelInteraction':require(_0x0af0('0x21')),'smsInteraction':require(_0x0af0('0x22')),'whatsappInteraction':require(_0x0af0('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x0af0('0x24')},'timeout':{'type':'number','message':_0x0af0('0x25')}});function startRouting(_0x38d0a3,_0x287d30,_0x622824,_0x22e55d){if(_0x38d0a3&&_0x287d30&&_0x622824){_0x287d30[_0x0af0('0x26')]+=0x1;var _0x276a0b={'uniqueid':_0x38d0a3,'from':_0x622824[_0x0af0('0x27')]?_0x622824['body'][_0x0af0('0xd')]:'','joinAt':moment()[_0x0af0('0x13')](_0x0af0('0x28')),'ContactId':_0x622824[_0x0af0('0x29')]?_0x622824[_0x0af0('0x29')]['id']:null,'ListId':_0x622824['list']?_0x622824[_0x0af0('0x2a')]['id']:null};_0x276a0b[_['upperFirst'](_0x622824['channel'])+'QueueId']=_0x287d30['id']||null;_0x276a0b[_[_0x0af0('0x2b')](_0x622824['channel'])+'InteractionId']=_0x622824['interaction']?_0x622824[_0x0af0('0x2c')]['id']:null;_0x276a0b[_[_0x0af0('0x2b')](_0x622824[_0x0af0('0x2d')])+_0x0af0('0x2e')]=_0x622824[_0x0af0('0x2f')]?_0x622824[_0x0af0('0x2f')]['id']:null;_0x276a0b[_[_0x0af0('0x2b')](_0x622824[_0x0af0('0x2d')])+(_0x622824[_0x0af0('0x2d')]!==_0x0af0('0x30')?'AccountId':_0x0af0('0x31'))]=_0x622824[_0x0af0('0x32')]?_0x622824[_0x0af0('0x32')]['id']:null;logger[_0x0af0('0x33')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x38d0a3,_0x287d30[_0x0af0('0x34')]));emitChannelQueueInteraction(_0x622824['channel'],_0x287d30[_0x0af0('0x34')],_0x276a0b,_0x622824[_0x0af0('0x32')][_0x0af0('0x34')],_0x622824[_0x0af0('0x2f')]['id'],!![],_0x22e55d,_0x287d30['id']);if(rpc[_0x622824[_0x0af0('0x2d')]+_0x0af0('0x35')]){return rpc[_0x622824[_0x0af0('0x2d')]+'QueueReport'][_0x0af0('0x36')](_0x276a0b)[_0x0af0('0x37')](function(_0x1f2053){logger['error']('create\x20queue\x20report',_0x1f2053);});}}}function stopRouting(_0x36bc5a,_0x1ee20c,_0x4e5268,_0xa7831c){if(_0x36bc5a&&_0x1ee20c){_0x1ee20c['waiting']-=0x1;var _0x31acae={'leaveAt':moment()['format'](_0x0af0('0x28')),'acceptAt':moment()[_0x0af0('0x13')](_0x0af0('0x28')),'reason':'accepted'};logger[_0x0af0('0x33')](util[_0x0af0('0x13')](_0x0af0('0x38'),_0x36bc5a,_0x1ee20c[_0x0af0('0x34')]));emitChannelQueueInteraction(_0x4e5268[_0x0af0('0x2d')],_0x1ee20c[_0x0af0('0x34')],_0x4e5268[_0x0af0('0x27')],_0x4e5268[_0x0af0('0x32')][_0x0af0('0x34')],_0x4e5268[_0x0af0('0x2f')]['id'],![],_0xa7831c,_0x1ee20c['id']);return rpc[_0x4e5268[_0x0af0('0x2d')]+_0x0af0('0x39')][_0x0af0('0x3a')](_0x4e5268[_0x0af0('0x2c')]['id'],{'queueId':_0x1ee20c['id']})[_0x0af0('0x3b')](function(){if(rpc[_0x4e5268[_0x0af0('0x2d')]+_0x0af0('0x35')]){return rpc[_0x4e5268[_0x0af0('0x2d')]+'QueueReport'][_0x0af0('0x3a')](_0x36bc5a,_0x31acae)[_0x0af0('0x37')](function(_0x346afd){logger[_0x0af0('0x3c')](_0x0af0('0x3d'),_0x346afd);});}});}}function endRouting(_0x252876,_0x58d0cf,_0xcae2ec,_0x43b005){if(_0x252876&&_0x58d0cf){_0x58d0cf[_0x0af0('0x26')]-=0x1;var _0x1d4c2f={'leaveAt':moment()['format'](_0x0af0('0x28')),'exitAt':moment()[_0x0af0('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x0af0('0x33')](util[_0x0af0('0x13')](_0x0af0('0x3e'),_0x252876,_0x58d0cf[_0x0af0('0x34')]));emitChannelQueueInteraction(_0xcae2ec['channel'],_0x58d0cf[_0x0af0('0x34')],_0xcae2ec[_0x0af0('0x27')],_0xcae2ec[_0x0af0('0x32')][_0x0af0('0x34')],_0xcae2ec[_0x0af0('0x2f')]['id'],![],_0x43b005);if(rpc[_0xcae2ec[_0x0af0('0x2d')]+_0x0af0('0x35')]){return rpc[_0xcae2ec['channel']+_0x0af0('0x35')][_0x0af0('0x3a')](_0x252876,_0x1d4c2f)[_0x0af0('0x37')](function(_0x39a21f){logger[_0x0af0('0x3c')](_0x0af0('0x3d'),_0x39a21f);});}}}function handleFindQueue(_0x249cb2){return function(_0x54d1b9){return _0x54d1b9[_0x0af0('0x34')][_0x0af0('0x3f')]()===_0x249cb2[_0x0af0('0x3f')]();};}exports[_0x0af0('0x40')]=function(_0x136a05,_0x22a913,_0x233083,_0x7d817d){return function(_0x43807b){try{var _0x11b98b={'name':_0x22a913[0x0],'timeout':_0x22a913[0x1]};var _0x2837d4=queue[_0x0af0('0x0')](_0x11b98b,{'typecast':!![]});if(_0x2837d4[_0x0af0('0x41')]){logger[_0x0af0('0x3c')](_0x0af0('0x42'),_0x136a05,_[_0x0af0('0x43')](_0x2837d4,_0x0af0('0x2f'))[_0x0af0('0x44')](',\x20'));_0x43807b['stop']();}else{var _0x4c5a02=_['find'](_0x233083[_0x7d817d['channel']+_0x0af0('0x45')],handleFindQueue(_0x11b98b[_0x0af0('0x34')]));if(_0x4c5a02){startRouting(_0x136a05,_0x4c5a02,_0x7d817d,_0x233083);var _0x5975ba=(_0x4c5a02['timeout']||0xa)*0x3e8;var _0xe7144d=(_0x11b98b[_0x0af0('0x46')]||0x14)*0x3e8;var _0x1c253a;if(_0x5975ba>_0xe7144d){_0xe7144d=_0x5975ba;}var _0x389453=seqqueue[_0x0af0('0x47')](_0x5975ba);_0x389453['id']=_0x136a05;_0x389453[_0x0af0('0x48')]=_0x5975ba;_0x389453[_0x0af0('0x49')]=_0xe7144d;_0x389453[_0x0af0('0x2d')]=_0x7d817d[_0x0af0('0x2d')];_0x233083[_0x0af0('0x4a')][_0x136a05]['on'](_0x0af0('0x4b'),function(){logger[_0x0af0('0x33')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x136a05);stopRouting(_0x136a05,_0x4c5a02,_0x7d817d,_0x233083);clearTimeout(_0x1c253a);_0x1c253a=undefined;_0x389453['close'](!![]);if(_0x233083['rules'][_0x136a05]){delete _0x233083[_0x0af0('0x4a')][_0x136a05];}_0x43807b[_0x0af0('0x4c')]();});_0x233083[_0x0af0('0x4a')][_0x136a05]['on']('complete',function(){if(_0x233083[_0x0af0('0x4a')][_0x136a05]){delete _0x233083['rules'][_0x136a05];}});_0x1c253a=setTimeout(function(){logger[_0x0af0('0x33')](_0x0af0('0x4d'),_0x136a05);endRouting(_0x136a05,_0x4c5a02,_0x7d817d,_0x233083);clearTimeout(_0x1c253a);_0x389453[_0x0af0('0x4e')](!![]);_0x43807b[_0x0af0('0x4f')]();},_0xe7144d);switch(_0x4c5a02[_0x0af0('0x50')]){case _0x0af0('0x51'):strategy[_0x0af0('0x51')](_0x389453,_0x4c5a02,_0x233083,_0x7d817d);break;default:strategy[_0x0af0('0x52')](_0x389453,_0x4c5a02,_0x233083,_0x7d817d);}}else{logger[_0x0af0('0x3c')](_0x0af0('0x53'),_0x136a05,_0x11b98b[_0x0af0('0x34')]);_0x43807b[_0x0af0('0x4c')]();}}}catch(_0x33215f){logger[_0x0af0('0x3c')]('[%s][QUEUE]\x20%s',_0x136a05,_0x33215f['stack']);_0x43807b[_0x0af0('0x4c')]();}};}; \ No newline at end of file +var _0xa825=['../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','join','stop','find','Queues','timeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/logger','./strategy','redis','localhost','queue_id','account','queue','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction'];(function(_0x37dbfc,_0x55f2a7){var _0x76c42f=function(_0x38e714){while(--_0x38e714){_0x37dbfc['push'](_0x37dbfc['shift']());}};_0x76c42f(++_0x55f2a7);}(_0xa825,0x180));var _0x5a82=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa825[_0x3b380d];return _0x54502b;};'use strict';var schema=require(_0x5a82('0x0'));var _=require(_0x5a82('0x1'));var util=require(_0x5a82('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x5a82('0x3'));var Redis=require(_0x5a82('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5a82('0x5'))('routing');var strategy=require(_0x5a82('0x6'));config[_0x5a82('0x7')]=_['defaults'](config[_0x5a82('0x7')],{'host':_0x5a82('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5a82('0x7')]));var attributes=['id',_0x5a82('0x9'),_0x5a82('0xa'),_0x5a82('0xb'),'from','joinAt'];function emit(_0x17ee52,_0x55568b,_0x283118){io['to'](_0x17ee52)['emit'](_0x55568b,_0x283118);}function emitChannelQueueInteraction(_0x2e9ddd,_0x318112,_0x21b64c,_0x199fa9,_0x38ff21,_0x3a6616,_0x55f7b1,_0x3d337a){var _0x2a9ec2=_[_0x5a82('0xc')](_0x21b64c);_0x2a9ec2[_0x5a82('0x9')]=_0x3d337a;_0x2a9ec2['queue']=_0x318112;_0x2a9ec2[_0x5a82('0xa')]=_0x199fa9;_0x2a9ec2['id']=_0x38ff21;if(_0x3a6616){attributes[_0x5a82('0xd')](_[_0x5a82('0xe')](_0x2e9ddd)+_0x5a82('0xf'));_0x55f7b1[util[_0x5a82('0x10')](_0x5a82('0x11'),_0x2e9ddd)][_0x38ff21]=_['pick'](_0x2a9ec2,attributes);}else{delete _0x55f7b1[util[_0x5a82('0x10')](_0x5a82('0x11'),_0x2e9ddd)][_0x38ff21];}emit(util[_0x5a82('0x10')](_0x5a82('0x12'),_0x2e9ddd,_0x318112),util[_0x5a82('0x10')](_0x5a82('0x13'),_0x2e9ddd,_0x3a6616?_0x5a82('0x14'):_0x5a82('0x15')),_[_0x5a82('0x16')](_0x2a9ec2,attributes));}var rpc={'openchannelQueueReport':require(_0x5a82('0x17')),'mailQueueReport':require(_0x5a82('0x18')),'chatQueueReport':require(_0x5a82('0x19')),'smsQueueReport':require(_0x5a82('0x1a')),'faxQueueReport':require(_0x5a82('0x1b')),'whatsappQueueReport':require(_0x5a82('0x1c')),'chatInteraction':require(_0x5a82('0x1d')),'faxInteraction':require(_0x5a82('0x1e')),'mailInteraction':require(_0x5a82('0x1f')),'openchannelInteraction':require(_0x5a82('0x20')),'smsInteraction':require(_0x5a82('0x21')),'whatsappInteraction':require(_0x5a82('0x22'))};var queue=schema({'name':{'type':_0x5a82('0x23'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5a82('0x24'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x137d50,_0x427df8,_0x2ad428,_0x5635e0){if(_0x137d50&&_0x427df8&&_0x2ad428){_0x427df8['waiting']+=0x1;var _0x25d351={'uniqueid':_0x137d50,'from':_0x2ad428[_0x5a82('0x25')]?_0x2ad428['body']['from']:'','joinAt':moment()[_0x5a82('0x10')](_0x5a82('0x26')),'ContactId':_0x2ad428['contact']?_0x2ad428[_0x5a82('0x27')]['id']:null,'ListId':_0x2ad428[_0x5a82('0x28')]?_0x2ad428[_0x5a82('0x28')]['id']:null};_0x25d351[_[_0x5a82('0x29')](_0x2ad428[_0x5a82('0x2a')])+'QueueId']=_0x427df8['id']||null;_0x25d351[_[_0x5a82('0x29')](_0x2ad428[_0x5a82('0x2a')])+_0x5a82('0xf')]=_0x2ad428[_0x5a82('0x2b')]?_0x2ad428['interaction']['id']:null;_0x25d351[_[_0x5a82('0x29')](_0x2ad428[_0x5a82('0x2a')])+_0x5a82('0x2c')]=_0x2ad428['message']?_0x2ad428['message']['id']:null;_0x25d351[_['upperFirst'](_0x2ad428[_0x5a82('0x2a')])+(_0x2ad428['channel']!==_0x5a82('0x2d')?_0x5a82('0x2e'):_0x5a82('0x2f'))]=_0x2ad428[_0x5a82('0xa')]?_0x2ad428[_0x5a82('0xa')]['id']:null;logger[_0x5a82('0x30')](util[_0x5a82('0x10')](_0x5a82('0x31'),_0x137d50,_0x427df8[_0x5a82('0x32')]));emitChannelQueueInteraction(_0x2ad428[_0x5a82('0x2a')],_0x427df8[_0x5a82('0x32')],_0x25d351,_0x2ad428['account']['name'],_0x2ad428[_0x5a82('0x33')]['id'],!![],_0x5635e0,_0x427df8['id']);if(rpc[_0x2ad428[_0x5a82('0x2a')]+_0x5a82('0x34')]){return rpc[_0x2ad428[_0x5a82('0x2a')]+_0x5a82('0x34')][_0x5a82('0x35')](_0x25d351)['catch'](function(_0x1188a2){logger[_0x5a82('0x36')](_0x5a82('0x37'),_0x1188a2);});}}}function stopRouting(_0x52d950,_0x22e97a,_0x40863a,_0x22ae4d){if(_0x52d950&&_0x22e97a){_0x22e97a[_0x5a82('0x38')]-=0x1;var _0x14c93d={'leaveAt':moment()[_0x5a82('0x10')](_0x5a82('0x26')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x5a82('0x39')};logger[_0x5a82('0x30')](util[_0x5a82('0x10')](_0x5a82('0x3a'),_0x52d950,_0x22e97a[_0x5a82('0x32')]));emitChannelQueueInteraction(_0x40863a[_0x5a82('0x2a')],_0x22e97a['name'],_0x40863a['body'],_0x40863a[_0x5a82('0xa')]['name'],_0x40863a[_0x5a82('0x33')]['id'],![],_0x22ae4d,_0x22e97a['id']);return rpc[_0x40863a[_0x5a82('0x2a')]+'Interaction'][_0x5a82('0x3b')](_0x40863a[_0x5a82('0x2b')]['id'],{'queueId':_0x22e97a['id']})[_0x5a82('0x3c')](function(){if(rpc[_0x40863a['channel']+'QueueReport']){return rpc[_0x40863a[_0x5a82('0x2a')]+_0x5a82('0x34')][_0x5a82('0x3b')](_0x52d950,_0x14c93d)[_0x5a82('0x3d')](function(_0xdeaa77){logger[_0x5a82('0x36')](_0x5a82('0x3e'),_0xdeaa77);});}});}}function endRouting(_0x24334f,_0x34a6a6,_0x2fb199,_0x82395){if(_0x24334f&&_0x34a6a6){_0x34a6a6[_0x5a82('0x38')]-=0x1;var _0x1a36ff={'leaveAt':moment()[_0x5a82('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x5a82('0x10')](_0x5a82('0x26')),'reason':'timeout'};logger[_0x5a82('0x30')](util[_0x5a82('0x10')](_0x5a82('0x3f'),_0x24334f,_0x34a6a6[_0x5a82('0x32')]));emitChannelQueueInteraction(_0x2fb199['channel'],_0x34a6a6[_0x5a82('0x32')],_0x2fb199[_0x5a82('0x25')],_0x2fb199[_0x5a82('0xa')][_0x5a82('0x32')],_0x2fb199['message']['id'],![],_0x82395);if(rpc[_0x2fb199[_0x5a82('0x2a')]+_0x5a82('0x34')]){return rpc[_0x2fb199[_0x5a82('0x2a')]+_0x5a82('0x34')][_0x5a82('0x3b')](_0x24334f,_0x1a36ff)['catch'](function(_0x46454f){logger[_0x5a82('0x36')](_0x5a82('0x3e'),_0x46454f);});}}}function handleFindQueue(_0x2bcddd){return function(_0x2f201b){return _0x2f201b['name'][_0x5a82('0x40')]()===_0x2bcddd[_0x5a82('0x40')]();};}exports[_0x5a82('0x41')]=function(_0x1bfc5d,_0x3bf513,_0x2a5897,_0x259847){return function(_0x3f51cb){try{var _0x2ddccd={'name':_0x3bf513[0x0],'timeout':_0x3bf513[0x1]};var _0x3b59fe=queue['validate'](_0x2ddccd,{'typecast':!![]});if(_0x3b59fe[_0x5a82('0x42')]){logger[_0x5a82('0x36')]('[%s][QUEUE]\x20%s',_0x1bfc5d,_['map'](_0x3b59fe,'message')[_0x5a82('0x43')](',\x20'));_0x3f51cb[_0x5a82('0x44')]();}else{var _0x153705=_[_0x5a82('0x45')](_0x2a5897[_0x259847['channel']+_0x5a82('0x46')],handleFindQueue(_0x2ddccd[_0x5a82('0x32')]));if(_0x153705){startRouting(_0x1bfc5d,_0x153705,_0x259847,_0x2a5897);var _0x49e382=(_0x153705[_0x5a82('0x47')]||0xa)*0x3e8;var _0x560940=(_0x2ddccd[_0x5a82('0x47')]||0x14)*0x3e8;var _0x44c06d;if(_0x49e382>_0x560940){_0x560940=_0x49e382;}var _0x3f9454=seqqueue['createQueue'](_0x49e382);_0x3f9454['id']=_0x1bfc5d;_0x3f9454['atimeout']=_0x49e382;_0x3f9454[_0x5a82('0x48')]=_0x560940;_0x3f9454['channel']=_0x259847[_0x5a82('0x2a')];_0x2a5897[_0x5a82('0x49')][_0x1bfc5d]['on'](_0x5a82('0x4a'),function(){logger['info'](_0x5a82('0x4b'),_0x1bfc5d);stopRouting(_0x1bfc5d,_0x153705,_0x259847,_0x2a5897);clearTimeout(_0x44c06d);_0x44c06d=undefined;_0x3f9454[_0x5a82('0x4c')](!![]);if(_0x2a5897['rules'][_0x1bfc5d]){delete _0x2a5897[_0x5a82('0x49')][_0x1bfc5d];}_0x3f51cb[_0x5a82('0x44')]();});_0x2a5897['rules'][_0x1bfc5d]['on'](_0x5a82('0x4d'),function(){if(_0x2a5897[_0x5a82('0x49')][_0x1bfc5d]){delete _0x2a5897[_0x5a82('0x49')][_0x1bfc5d];}});_0x44c06d=setTimeout(function(){logger[_0x5a82('0x30')](_0x5a82('0x4e'),_0x1bfc5d);endRouting(_0x1bfc5d,_0x153705,_0x259847,_0x2a5897);clearTimeout(_0x44c06d);_0x3f9454[_0x5a82('0x4c')](!![]);_0x3f51cb[_0x5a82('0x4f')]();},_0x560940);switch(_0x153705['strategy']){case _0x5a82('0x50'):strategy['rrmemory'](_0x3f9454,_0x153705,_0x2a5897,_0x259847);break;default:strategy['beepall'](_0x3f9454,_0x153705,_0x2a5897,_0x259847);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1bfc5d,_0x2ddccd[_0x5a82('0x32')]);_0x3f51cb[_0x5a82('0x44')]();}}}catch(_0x13303c){logger[_0x5a82('0x36')](_0x5a82('0x51'),_0x1bfc5d,_0x13303c[_0x5a82('0x52')]);_0x3f51cb[_0x5a82('0x44')]();}};}; \ 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 4e6df9f..4df634e 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 _0xe14d=['[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','forcedOwnership',':FORCED','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14d,0x1ee));var _0xde14=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe14d[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xde14('0x0'));var uuid=require(_0xde14('0x1'));var util=require(_0xde14('0x2'));var logger=require(_0xde14('0x3'))('routing');var Agent=function(_0x1c5b4,_0x28965b,_0x4b20e2,_0x1c3e94){this[_0xde14('0x4')]=uuid['v4']();this[_0xde14('0x5')]=_0x1c5b4;this[_0xde14('0x6')]=_0x28965b;this[_0xde14('0x7')]=_0x4b20e2;this[_0xde14('0x8')]=_0x1c3e94;this['squeue']['push'](this[_0xde14('0x9')][_0xde14('0xa')](this),this[_0xde14('0xb')][_0xde14('0xa')](this));this[_0xde14('0x5')]['on'](_0xde14('0xc'),this[_0xde14('0xb')][_0xde14('0xa')](this));this['squeue']['on'](_0xde14('0xd'),this[_0xde14('0xe')][_0xde14('0xa')](this));};Agent[_0xde14('0xf')][_0xde14('0x10')]=function(){this[_0xde14('0x5')][_0xde14('0x10')](this[_0xde14('0x9')][_0xde14('0xa')](this),this[_0xde14('0xb')][_0xde14('0xa')](this));};Agent[_0xde14('0xf')][_0xde14('0xe')]=function(){this[_0xde14('0xb')](!![]);};Agent[_0xde14('0xf')]['handleRun']=function(){logger['debug'](_0xde14('0x11'),this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);if(_['isNil'](this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']])){logger[_0xde14('0x13')](_0xde14('0x14'),this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);setTimeout(this[_0xde14('0x10')][_0xde14('0xa')](this),0x3e8);}else{if(this[_0xde14('0x8')]['forcedOwnership']||util[_0xde14('0x15')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this['agent']['id']],this[_0xde14('0x5')]['channel'],![])){this[_0xde14('0x7')]['agents'][this[_0xde14('0x6')]['id']][_0xde14('0x16')]=!![];this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']][_0xde14('0x17')]=undefined;util[_0xde14('0x18')](this[_0xde14('0x7')],this[_0xde14('0x8')],this[_0xde14('0x6')],this[_0xde14('0x5')][_0xde14('0x19')]);util[_0xde14('0x1a')](this['notificationId'],this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],null,this[_0xde14('0x8')]);util[_0xde14('0x1b')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],'RINGING'+(this[_0xde14('0x8')][_0xde14('0x1c')]?_0xde14('0x1d'):''));}else{logger[_0xde14('0x13')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);setTimeout(this[_0xde14('0x10')]['bind'](this),0x3e8);}}};Agent[_0xde14('0xf')]['handleTimeout']=function(_0x2760f9){if(_[_0xde14('0x1e')](this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']])){return logger[_0xde14('0x13')](_0xde14('0x14'),this[_0xde14('0x5')]['id'],this['agent']['id']);}else{logger[_0xde14('0x13')](_0xde14('0x1f'),this['squeue']['id'],this[_0xde14('0x6')]['id']);util['hideNotification'](this[_0xde14('0x4')],this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],null,this['routing']);this[_0xde14('0x7')][_0xde14('0x12')][this['agent']['id']][_0xde14('0x16')]=![];this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']][_0xde14('0x17')]=undefined;util[_0xde14('0x20')](this[_0xde14('0x7')],this[_0xde14('0x8')],this[_0xde14('0x6')],this['squeue']['channel']);util[_0xde14('0x1b')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],_0x2760f9?_0xde14('0x21'):_0xde14('0x22'));}if(!_0x2760f9){setTimeout(this[_0xde14('0x10')][_0xde14('0xa')](this),0x3e8);}};function agent(_0x4e33e0,_0x1854d3,_0x48c043,_0x4a363c){return new Agent(_0x4e33e0,_0x1854d3,_0x48c043,_0x4a363c);}module['exports']=agent; \ No newline at end of file +var _0xb903=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','handleRun','bind','handleTimeout','handleDrained','push','debug','isNil','realtime','agents','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','RINGING',':FORCED'];(function(_0x4a795d,_0xc6c970){var _0x4aac75=function(_0x3ff5e0){while(--_0x3ff5e0){_0x4a795d['push'](_0x4a795d['shift']());}};_0x4aac75(++_0xc6c970);}(_0xb903,0x185));var _0x3b90=function(_0x41613f,_0x2be3d3){_0x41613f=_0x41613f-0x0;var _0x2c477b=_0xb903[_0x41613f];return _0x2c477b;};'use strict';var _=require(_0x3b90('0x0'));var uuid=require(_0x3b90('0x1'));var util=require(_0x3b90('0x2'));var logger=require(_0x3b90('0x3'))('routing');var Agent=function(_0x3312ca,_0xf414f4,_0x3b024a,_0x1cd5d8){this[_0x3b90('0x4')]=uuid['v4']();this[_0x3b90('0x5')]=_0x3312ca;this[_0x3b90('0x6')]=_0xf414f4;this['realtime']=_0x3b024a;this[_0x3b90('0x7')]=_0x1cd5d8;this['squeue']['push'](this[_0x3b90('0x8')][_0x3b90('0x9')](this),this[_0x3b90('0xa')][_0x3b90('0x9')](this));this['squeue']['on']('timeout',this['handleTimeout']['bind'](this));this['squeue']['on']('drained',this[_0x3b90('0xb')][_0x3b90('0x9')](this));};Agent['prototype'][_0x3b90('0xc')]=function(){this[_0x3b90('0x5')]['push'](this[_0x3b90('0x8')][_0x3b90('0x9')](this),this[_0x3b90('0xa')]['bind'](this));};Agent['prototype'][_0x3b90('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x3b90('0x8')]=function(){logger[_0x3b90('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x3b90('0x6')]['id']);if(_[_0x3b90('0xe')](this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);setTimeout(this['push'][_0x3b90('0x9')](this),0x3e8);}else{if(this[_0x3b90('0x7')][_0x3b90('0x11')]||util[_0x3b90('0x12')](this['squeue']['id'],this[_0x3b90('0xf')]['agents'][this[_0x3b90('0x6')]['id']],this[_0x3b90('0x5')]['channel'],![])){this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x13')]=!![];this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x14')]=undefined;util[_0x3b90('0x15')](this[_0x3b90('0xf')],this['routing'],this[_0x3b90('0x6')],this[_0x3b90('0x5')][_0x3b90('0x16')]);util[_0x3b90('0x17')](this[_0x3b90('0x4')],this[_0x3b90('0x5')]['id'],this['realtime']['agents'][this[_0x3b90('0x6')]['id']],null,this[_0x3b90('0x7')]);util[_0x3b90('0x18')](this[_0x3b90('0x5')]['id'],this['realtime'][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']],_0x3b90('0x19')+(this['routing'][_0x3b90('0x11')]?_0x3b90('0x1a'):''));}else{logger[_0x3b90('0xd')](_0x3b90('0x1b'),this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);setTimeout(this['push'][_0x3b90('0x9')](this),0x3e8);}}};Agent['prototype'][_0x3b90('0xa')]=function(_0x9891e4){if(_[_0x3b90('0xe')](this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']])){return logger[_0x3b90('0xd')](_0x3b90('0x1c'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x3b90('0xd')](_0x3b90('0x1d'),this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x3b90('0x5')]['id'],this[_0x3b90('0xf')][_0x3b90('0x10')][this['agent']['id']],null,this[_0x3b90('0x7')]);this['realtime']['agents'][this[_0x3b90('0x6')]['id']][_0x3b90('0x13')]=![];this['realtime'][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x14')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x3b90('0x7')],this[_0x3b90('0x6')],this[_0x3b90('0x5')][_0x3b90('0x16')]);util['writeLog'](this['squeue']['id'],this[_0x3b90('0xf')][_0x3b90('0x10')][this['agent']['id']],_0x9891e4?'STOP':_0x3b90('0x1e'));}if(!_0x9891e4){setTimeout(this[_0x3b90('0xc')][_0x3b90('0x9')](this),0x3e8);}};function agent(_0x298df6,_0x5a3266,_0x2154e2,_0x583842){return new Agent(_0x298df6,_0x5a3266,_0x2154e2,_0x583842);}module[_0x3b90('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 095a129..7a63dee 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 _0x6541=['./util','../../../../../config/logger','routing','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','length','Agents','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20EMPTY','hideNotification','notificationId','STOP','TIMEOUT','busy','removeWaitingNotification','exports','lodash','uuid'];(function(_0x2230fc,_0x4e16c0){var _0xf47695=function(_0x5b8f76){while(--_0x5b8f76){_0x2230fc['push'](_0x2230fc['shift']());}};_0xf47695(++_0x4e16c0);}(_0x6541,0xbc));var _0x1654=function(_0x5eceeb,_0x9fa29c){_0x5eceeb=_0x5eceeb-0x0;var _0x189034=_0x6541[_0x5eceeb];return _0x189034;};'use strict';var _=require(_0x1654('0x0'));var uuid=require(_0x1654('0x1'));var util=require(_0x1654('0x2'));var logger=require(_0x1654('0x3'))(_0x1654('0x4'));var Beepall=function(_0x415b97,_0x4753d6,_0x4c0a1a,_0x42ec66){this['notificationId']=uuid['v4']();this[_0x1654('0x5')]=_0x415b97;this[_0x1654('0x6')]=_0x4753d6;this[_0x1654('0x7')]=_0x4c0a1a;this[_0x1654('0x4')]=_0x42ec66;this[_0x1654('0x5')][_0x1654('0x8')](this[_0x1654('0x9')][_0x1654('0xa')](this),this[_0x1654('0xb')][_0x1654('0xa')](this));this[_0x1654('0x5')]['on'](_0x1654('0xc'),this[_0x1654('0xb')]['bind'](this));this[_0x1654('0x5')]['on'](_0x1654('0xd'),this['handleDrained'][_0x1654('0xa')](this));};Beepall[_0x1654('0xe')][_0x1654('0x8')]=function(){this['squeue']['push'](this[_0x1654('0x9')][_0x1654('0xa')](this),this['handleTimeout'][_0x1654('0xa')](this));};Beepall['prototype'][_0x1654('0xf')]=function(){this['handleTimeout'](!![]);};Beepall[_0x1654('0xe')][_0x1654('0x9')]=function(){var _0xd8108e=!![];if(!_[_0x1654('0x10')](this['queue'])&&!_[_0x1654('0x10')](this[_0x1654('0x6')]['Agents'])&&this[_0x1654('0x6')]['Agents'][_0x1654('0x11')]>0x0){for(var _0x1b0550=0x0,_0x23bf83;_0x1b05500x0){for(var _0x4b8846=0x0,_0x1cb288;_0x4b88460x0&&_0x26461f[_0x8bd0ef+_0x83bb('0x21')]>=_0x26461f[_0x8bd0ef+'Capacity']){writeLog(_0x52cadc,_0x26461f,_0x8bd0ef[_0x83bb('0x22')]()+_0x83bb('0x23'));return![];}}return!![];};exports[_0x83bb('0x24')]=function(_0x24eef6,_0x29fa80,_0x34efb0,_0x3d8abf,_0x3fc96a){return sendNotification(!![],_0x24eef6,_0x29fa80,_0x34efb0,_0x3d8abf,_0x3fc96a);};exports[_0x83bb('0x25')]=function(_0x39df38,_0x2c35fe,_0x4dab2d,_0x35c257,_0x2c86ee){return sendNotification(![],_0x39df38,_0x2c35fe,_0x4dab2d,_0x35c257,_0x2c86ee);};exports[_0x83bb('0x26')]=function(_0x18d478,_0x33ca19,_0x3ee849){var _0x3f4d43=_0x33ca19['interaction'][_0x83bb('0x27')];if(!_0x3f4d43&&_0x3ee849){_0x3f4d43=_0x3ee849['id'];}var _0x4a9ecf=_[_0x83bb('0x28')](_0x18d478[_0x33ca19[_0x83bb('0x29')]+_0x83bb('0x2a')],function(_0x2f3768){var _0x10cfc5=_[_0x83bb('0x2b')](_0x33ca19[_0x83bb('0x29')])+'InteractionId';return _0x2f3768[_0x10cfc5]===_0x33ca19[_0x83bb('0x2c')]['id'];});if(!_0x4a9ecf&&_0x3f4d43&&_0x18d478[_0x83bb('0x2d')][_0x3f4d43]){_0x4a9ecf=_[_0x83bb('0x28')](_0x18d478[_0x83bb('0x2d')][_0x3f4d43][_0x33ca19[_0x83bb('0x29')]+_0x83bb('0x2e')],function(_0x117fc9){return _0x117fc9['id']===_0x33ca19[_0x83bb('0x2c')]['id'];});}return _0x4a9ecf;};exports[_0x83bb('0x2f')]=function(_0x1fb7f5,_0x30d24a,_0x24085c,_0x234c44){if(_0x24085c&&_0x24085c['id']&&_0x1fb7f5[_0x83bb('0x2d')]&&_0x1fb7f5['agents'][_0x24085c['id']]){_0x1fb7f5[_0x83bb('0x2d')][_0x24085c['id']][_0x234c44+_0x83bb('0x2e')][_0x30d24a[_0x83bb('0x14')]['id']]={'id':_0x30d24a[_0x83bb('0x2c')]['id']};}};exports[_0x83bb('0x30')]=function(_0x84ed71,_0x1cd910,_0x324c2c,_0x30a7b6){if(_0x324c2c&&_0x324c2c['id']&&_0x84ed71[_0x83bb('0x2d')]&&_0x84ed71[_0x83bb('0x2d')][_0x324c2c['id']]){delete _0x84ed71['agents'][_0x324c2c['id']][_0x30a7b6+_0x83bb('0x2e')][_0x1cd910[_0x83bb('0x14')]['id']];}};exports[_0x83bb('0x31')]=writeLog; \ No newline at end of file +var _0xce2f=['message','writeLog','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','localhost','redis','name','notificationSound','notificationShake','body','queue','msg','getMustacheRender','account','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','user:%s','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','interaction','UserId','channel','capitalize','InteractionId','agents','some','WaitingInteractions','saveWaitingNotification'];(function(_0x231ee9,_0x517eab){var _0x385ff9=function(_0xc6cb78){while(--_0xc6cb78){_0x231ee9['push'](_0x231ee9['shift']());}};_0x385ff9(++_0x517eab);}(_0xce2f,0x18a));var _0xfce2=function(_0x1c73ba,_0x11bfe9){_0x1c73ba=_0x1c73ba-0x0;var _0x58e09a=_0xce2f[_0x1c73ba];return _0x58e09a;};'use strict';var _=require('lodash');var util=require(_0xfce2('0x0'));var utils=require(_0xfce2('0x1'));var Redis=require(_0xfce2('0x2'));var config=require(_0xfce2('0x3'));var logger=require(_0xfce2('0x4'))(_0xfce2('0x5'));config['redis']=_[_0xfce2('0x6')](config['redis'],{'host':_0xfce2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfce2('0x8')]));function sendNotification(_0xeffde2,_0x13c378,_0x741a25,_0x442065,_0x458b85,_0x27f1d1){var _0x23af14=_0x27f1d1||{};var _0x5155a4=_0x741a25['split']('.');var _0x2141d1={'uniqueid':_0x13c378,'channel':_0x5155a4[0x0],'id':_0x5155a4[0x1],'title':_0x5155a4[0x0]+'\x20interaction','interactionId':_0x5155a4[0x2],'queue':_0x458b85?_0x458b85[_0xfce2('0x9')]:null,'sound':_0x23af14['account'][_0xfce2('0xa')],'shake':_0x23af14['account'][_0xfce2('0xb')]};try{if(!_0x23af14[_0xfce2('0xc')]){_0x23af14[_0xfce2('0xc')]={};}if(_0x458b85){_0x23af14['body'][_0xfce2('0xd')]=_0x458b85;}else if(_0x23af14['body'][_0xfce2('0xd')]){delete _0x23af14[_0xfce2('0xc')][_0xfce2('0xd')];}_0x2141d1[_0xfce2('0xe')]=utils[_0xfce2('0xf')](_0x23af14[_0xfce2('0x10')][_0xfce2('0x11')],_0x23af14);}catch(_0x4fdcc2){_0x2141d1[_0xfce2('0xe')]=_0xfce2('0x12');logger['error'](util[_0xfce2('0x13')](_0xfce2('0x14'),_0x13c378,_0x4fdcc2['message']));}io['to'](util['format'](_0xfce2('0x15'),_0x442065[_0xfce2('0x9')]))['emit'](util[_0xfce2('0x13')](_0xfce2('0x16'),_0xeffde2?_0xfce2('0x17'):_0xfce2('0x18')),_0x2141d1);}function writeLog(_0x2ad9f5,_0x30d38b,_0x270e52){return logger[_0xfce2('0x19')](util[_0xfce2('0x13')](_0xfce2('0x1a'),_0x2ad9f5,_0x30d38b['name'],_0x270e52));}exports['isAgentAvailable']=function(_0x3c4f1f,_0x3ea07b,_0x312c10,_0x24a13e){if(_0x3ea07b[_0xfce2('0x1b')]){writeLog(_0x3c4f1f,_0x3ea07b,_0xfce2('0x1c'));return![];}if(!_0x3ea07b[_0xfce2('0x1d')]){writeLog(_0x3c4f1f,_0x3ea07b,_0xfce2('0x1e'));return![];}if(_0x3ea07b[_0x312c10+'Pause']){writeLog(_0x3c4f1f,_0x3ea07b,_0xfce2('0x1f'));return![];}if(_0x24a13e&&_0x3ea07b[_0xfce2('0x20')](_0x312c10+_0xfce2('0x21'))&&_0x3ea07b['hasOwnProperty'](_0x312c10+'CurrentCapacity')){if(_0x3ea07b[_0x312c10+_0xfce2('0x21')]>0x0&&_0x3ea07b[_0x312c10+_0xfce2('0x22')]>=_0x3ea07b[_0x312c10+_0xfce2('0x21')]){writeLog(_0x3c4f1f,_0x3ea07b,_0x312c10[_0xfce2('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xfce2('0x24')]=function(_0x5cd9b2,_0x992b0f,_0x47ed7f,_0x20af10,_0x13129d){return sendNotification(!![],_0x5cd9b2,_0x992b0f,_0x47ed7f,_0x20af10,_0x13129d);};exports[_0xfce2('0x25')]=function(_0x4c63ea,_0x5a8b8a,_0x2358dc,_0x175bcc,_0x112f0a){return sendNotification(![],_0x4c63ea,_0x5a8b8a,_0x2358dc,_0x175bcc,_0x112f0a);};exports['checkWaitingNotifications']=function(_0x6c8a47,_0xef1b38,_0x58022e){var _0x31649e=_0xef1b38[_0xfce2('0x26')][_0xfce2('0x27')];if(!_0x31649e&&_0x58022e){_0x31649e=_0x58022e['id'];}var _0x1f48ba=_['some'](_0x6c8a47[_0xef1b38[_0xfce2('0x28')]+'QueuesWaitingInteractions'],function(_0x1b211c){var _0x468739=_[_0xfce2('0x29')](_0xef1b38[_0xfce2('0x28')])+_0xfce2('0x2a');return _0x1b211c[_0x468739]===_0xef1b38[_0xfce2('0x26')]['id'];});if(!_0x1f48ba&&_0x31649e&&_0x6c8a47[_0xfce2('0x2b')][_0x31649e]){_0x1f48ba=_[_0xfce2('0x2c')](_0x6c8a47['agents'][_0x31649e][_0xef1b38[_0xfce2('0x28')]+_0xfce2('0x2d')],function(_0x254206){return _0x254206['id']===_0xef1b38['interaction']['id'];});}return _0x1f48ba;};exports[_0xfce2('0x2e')]=function(_0x4c08d3,_0x4d453e,_0x42b3d0,_0x4fd253){if(_0x42b3d0&&_0x42b3d0['id']&&_0x4c08d3[_0xfce2('0x2b')]&&_0x4c08d3[_0xfce2('0x2b')][_0x42b3d0['id']]){_0x4c08d3[_0xfce2('0x2b')][_0x42b3d0['id']][_0x4fd253+_0xfce2('0x2d')][_0x4d453e['message']['id']]={'id':_0x4d453e['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x1d24d1,_0x10f855,_0x3d313a,_0x3c7305){if(_0x3d313a&&_0x3d313a['id']&&_0x1d24d1[_0xfce2('0x2b')]&&_0x1d24d1['agents'][_0x3d313a['id']]){delete _0x1d24d1['agents'][_0x3d313a['id']][_0x3c7305+_0xfce2('0x2d')][_0x10f855[_0xfce2('0x2f')]['id']];}};exports[_0xfce2('0x30')]=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 dd636eb..3defc5c 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 _0x6cf2=['info','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x4a01bd,_0x172e88){var _0x2c01e7=function(_0x8e717e){while(--_0x8e717e){_0x4a01bd['push'](_0x4a01bd['shift']());}};_0x2c01e7(++_0x172e88);}(_0x6cf2,0x7c));var _0x26cf=function(_0x289afd,_0x4503ea){_0x289afd=_0x289afd-0x0;var _0x160b43=_0x6cf2[_0x289afd];return _0x160b43;};'use strict';var schema=require('validate');var sh=require(_0x26cf('0x0'));var _=require(_0x26cf('0x1'));var utils=require(_0x26cf('0x2'));var logger=require(_0x26cf('0x3'))(_0x26cf('0x4'));var system=schema({'command':{'type':_0x26cf('0x5'),'required':!![],'message':_0x26cf('0x6')}});exports[_0x26cf('0x7')]=function(_0x54e531,_0x2d8e78){return function(_0x384b91){try{var _0x3b5c2f={'command':_0x2d8e78[0x0]};var _0x2b519b=system[_0x26cf('0x8')](_0x3b5c2f,{'typecast':!![]});if(_0x2b519b[_0x26cf('0x9')]){logger['error'](_0x26cf('0xa'),_0x54e531,_['map'](_0x2b519b,_0x26cf('0xb'))[_0x26cf('0xc')](',\x20'));logger['info'](_0x26cf('0xd'),_0x54e531);_0x384b91[_0x26cf('0xe')]();}else{var _0x3d652e=this;var _0x3e138d=utils[_0x26cf('0xf')](_0x2d8e78[0x0],this);logger[_0x26cf('0x10')](_0x26cf('0x11'),_0x54e531,_0x3e138d);sh[_0x26cf('0x12')](_['trim'](_0x3e138d),function(_0x3fff46,_0x157326){logger[_0x26cf('0x10')](_0x26cf('0x13'),_0x54e531,_0x3fff46);if(_0x3fff46==0x0){var _0xfe0837=_0x157326[_0x26cf('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x26cf('0x15')](_0x2d8e78[0x1])||_['isEmpty'](_0x2d8e78[0x1])){logger[_0x26cf('0x10')](_0x26cf('0x16'),_0x54e531);_0x3d652e[_0x26cf('0x17')][_0x2d8e78[0x1]]=_0xfe0837;}else{logger[_0x26cf('0x10')](_0x26cf('0x18'),_0x54e531,_0x2d8e78[0x1],_0xfe0837);_0x3d652e[_0x26cf('0x17')][_0x2d8e78[0x1]]=_0xfe0837;}}_0x384b91[_0x26cf('0xe')]();});}}catch(_0x3f2e84){logger[_0x26cf('0x19')](_0x26cf('0xa'),_0x54e531,_[_0x26cf('0x1a')](_0x3f2e84)?JSON[_0x26cf('0x1b')](_0x3f2e84):_0x3f2e84);logger[_0x26cf('0x10')](_0x26cf('0xd'),_0x54e531);_0x384b91[_0x26cf('0xe')]();}};}; \ No newline at end of file +var _0x5f42=['lodash','string','consequence','length','error','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs'];(function(_0xa54d39,_0x3506ae){var _0x3175ed=function(_0x2500a8){while(--_0x2500a8){_0xa54d39['push'](_0xa54d39['shift']());}};_0x3175ed(++_0x3506ae);}(_0x5f42,0x10f));var _0x25f4=function(_0x129c3b,_0x190203){_0x129c3b=_0x129c3b-0x0;var _0x13c89d=_0x5f42[_0x129c3b];return _0x13c89d;};'use strict';var schema=require(_0x25f4('0x0'));var sh=require(_0x25f4('0x1'));var _=require(_0x25f4('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x25f4('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x25f4('0x4')]=function(_0x49c71b,_0x4f92df){return function(_0xb8a943){try{var _0xd4f328={'command':_0x4f92df[0x0]};var _0x53031c=system[_0x25f4('0x0')](_0xd4f328,{'typecast':!![]});if(_0x53031c[_0x25f4('0x5')]){logger[_0x25f4('0x6')](_0x25f4('0x7'),_0x49c71b,_['map'](_0x53031c,_0x25f4('0x8'))['join'](',\x20'));logger[_0x25f4('0x9')](_0x25f4('0xa'),_0x49c71b);_0xb8a943[_0x25f4('0xb')]();}else{var _0x13cd28=this;var _0x49f724=utils[_0x25f4('0xc')](_0x4f92df[0x0],this);logger[_0x25f4('0x9')](_0x25f4('0xd'),_0x49c71b,_0x49f724);sh['exec'](_['trim'](_0x49f724),function(_0x320aab,_0x4de8ea){logger[_0x25f4('0x9')](_0x25f4('0xe'),_0x49c71b,_0x320aab);if(_0x320aab==0x0){var _0x4129e3=_0x4de8ea[_0x25f4('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x25f4('0x10')](_0x4f92df[0x1])||_[_0x25f4('0x11')](_0x4f92df[0x1])){logger[_0x25f4('0x9')]('[%s][SYSTEM]\x20no\x20variable',_0x49c71b);_0x13cd28[_0x25f4('0x12')][_0x4f92df[0x1]]=_0x4129e3;}else{logger[_0x25f4('0x9')](_0x25f4('0x13'),_0x49c71b,_0x4f92df[0x1],_0x4129e3);_0x13cd28[_0x25f4('0x12')][_0x4f92df[0x1]]=_0x4129e3;}}_0xb8a943[_0x25f4('0xb')]();});}}catch(_0x34c5d0){logger['error'](_0x25f4('0x7'),_0x49c71b,_[_0x25f4('0x14')](_0x34c5d0)?JSON['stringify'](_0x34c5d0):_0x34c5d0);logger[_0x25f4('0x9')](_0x25f4('0xa'),_0x49c71b);_0xb8a943[_0x25f4('0xb')]();}};}; \ 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 553172a..435ba46 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 _0x9912=['stringify','finally','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch'];(function(_0x2460d9,_0x15da87){var _0x4bc204=function(_0x40bbce){while(--_0x40bbce){_0x2460d9['push'](_0x2460d9['shift']());}};_0x4bc204(++_0x15da87);}(_0x9912,0x8f));var _0x2991=function(_0x338f1d,_0x7fd33e){_0x338f1d=_0x338f1d-0x0;var _0x268ac0=_0x9912[_0x338f1d];return _0x268ac0;};'use strict';var schema=require(_0x2991('0x0'));var _=require(_0x2991('0x1'));var rpc={'chatInteraction':require(_0x2991('0x2')),'openchannelInteraction':require(_0x2991('0x3')),'smsInteraction':require(_0x2991('0x4')),'mailInteraction':require(_0x2991('0x5')),'faxInteraction':require(_0x2991('0x6')),'whatsappInteraction':require(_0x2991('0x7'))};var logger=require('../../../../config/logger')(_0x2991('0x8'));var tag=schema({'tag':{'type':_0x2991('0x9'),'required':!![],'message':_0x2991('0xa')}});exports[_0x2991('0xb')]=function(_0x5ce197,_0x4dea4b,_0xf1c560,_0x49493a){return function(_0x54cc04){try{var _0x3cd144={'tag':_0x4dea4b[0x0]};var _0x29b3c8=tag['validate'](_0x3cd144,{'typecast':!![]});if(_0x29b3c8['length']){logger[_0x2991('0xc')](_0x2991('0xd'),_0x5ce197,_[_0x2991('0xe')](_0x29b3c8,'message')[_0x2991('0xf')](',\x20'));logger[_0x2991('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5ce197);_0x54cc04[_0x2991('0x11')]();}else{var _0x3ec161={'ids':[_0x4dea4b[0x0]]};if(rpc[_0x49493a[_0x2991('0x12')]+_0x2991('0x13')]){rpc[_0x49493a[_0x2991('0x12')]+_0x2991('0x13')][_0x2991('0x14')](_0x49493a[_0x2991('0x15')]['id'],_0x3ec161)[_0x2991('0x16')](function(_0x490596){logger[_0x2991('0x10')](_0x2991('0x17'),_0x5ce197,_0x4dea4b[0x1],_0x49493a[_0x2991('0x12')],_0x49493a[_0x2991('0x15')]['id']);})[_0x2991('0x18')](function(_0x31f2c5){logger['error']('[%s][TAG]\x20%s',_0x5ce197,JSON[_0x2991('0x19')](_0x31f2c5));logger[_0x2991('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5ce197);})[_0x2991('0x1a')](function(){_0x54cc04['next']();});}}}catch(_0x42f8d7){logger[_0x2991('0xc')](_0x2991('0xd'),_0x5ce197,_['isObject'](_0x42f8d7)?JSON[_0x2991('0x19')](_0x42f8d7):_0x42f8d7);logger[_0x2991('0x10')](_0x2991('0x1b'),_0x5ce197);_0x54cc04[_0x2991('0x11')]();}};}; \ No newline at end of file +var _0x9832=['channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','[%s][TAG]\x20%s','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','next','Interaction'];(function(_0x1af43e,_0x152f83){var _0x397675=function(_0x27327a){while(--_0x27327a){_0x1af43e['push'](_0x1af43e['shift']());}};_0x397675(++_0x152f83);}(_0x9832,0x1c9));var _0x2983=function(_0x3a4e29,_0x5d9565){_0x3a4e29=_0x3a4e29-0x0;var _0x5d1a83=_0x9832[_0x3a4e29];return _0x5d1a83;};'use strict';var schema=require(_0x2983('0x0'));var _=require(_0x2983('0x1'));var rpc={'chatInteraction':require(_0x2983('0x2')),'openchannelInteraction':require(_0x2983('0x3')),'smsInteraction':require(_0x2983('0x4')),'mailInteraction':require(_0x2983('0x5')),'faxInteraction':require(_0x2983('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x2983('0x7'))('routing');var tag=schema({'tag':{'type':_0x2983('0x8'),'required':!![],'message':_0x2983('0x9')}});exports[_0x2983('0xa')]=function(_0x3d5a7d,_0x581c82,_0x2a1831,_0x29fadd){return function(_0x3a7bfd){try{var _0x5dea73={'tag':_0x581c82[0x0]};var _0x30a92d=tag[_0x2983('0x0')](_0x5dea73,{'typecast':!![]});if(_0x30a92d[_0x2983('0xb')]){logger[_0x2983('0xc')]('[%s][TAG]\x20%s',_0x3d5a7d,_[_0x2983('0xd')](_0x30a92d,_0x2983('0xe'))[_0x2983('0xf')](',\x20'));logger[_0x2983('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3d5a7d);_0x3a7bfd[_0x2983('0x11')]();}else{var _0x3f5398={'ids':[_0x581c82[0x0]]};if(rpc[_0x29fadd['channel']+_0x2983('0x12')]){rpc[_0x29fadd[_0x2983('0x13')]+'Interaction'][_0x2983('0x14')](_0x29fadd[_0x2983('0x15')]['id'],_0x3f5398)['then'](function(_0x4e0d18){logger[_0x2983('0x10')](_0x2983('0x16'),_0x3d5a7d,_0x581c82[0x1],_0x29fadd[_0x2983('0x13')],_0x29fadd[_0x2983('0x15')]['id']);})['catch'](function(_0x1a028f){logger[_0x2983('0xc')]('[%s][TAG]\x20%s',_0x3d5a7d,JSON[_0x2983('0x17')](_0x1a028f));logger['info'](_0x2983('0x18'),_0x3d5a7d);})[_0x2983('0x19')](function(){_0x3a7bfd[_0x2983('0x11')]();});}}}catch(_0x10dbe2){logger[_0x2983('0xc')](_0x2983('0x1a'),_0x3d5a7d,_[_0x2983('0x1b')](_0x10dbe2)?JSON[_0x2983('0x17')](_0x10dbe2):_0x10dbe2);logger[_0x2983('0x10')](_0x2983('0x18'),_0x3d5a7d);_0x3a7bfd['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index ba07f0e..4b38afe 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 _0xe223=['title','jsonrpc','method','login','params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing'];(function(_0x2f0c11,_0x46aa9e){var _0xe984ed=function(_0x54d71f){while(--_0x54d71f){_0x2f0c11['push'](_0x2f0c11['shift']());}};_0xe984ed(++_0x46aa9e);}(_0xe223,0x16b));var _0x3e22=function(_0x3165ab,_0x49ab2b){_0x3165ab=_0x3165ab-0x0;var _0x1b49d4=_0xe223[_0x3165ab];return _0x1b49d4;};'use strict';var rp=require('request-promise');var logger=require(_0x3e22('0x0'))(_0x3e22('0x1'));var _=require(_0x3e22('0x2'));var arr=[];exports[_0x3e22('0x3')]=function(_0xc34bf5,_0x1c8c1b){return function(_0x7505fb){var _0x5bbcbc=_0x1c8c1b[0xa];var _0x17038c=_0x1c8c1b[0xb];var _0xfe28bc=_0x1c8c1b[0xc];var _0x3c3732=_0x1c8c1b[0xd];var _0x2886c6=_0x1c8c1b[0xe];var _0x1cf672=_0x1c8c1b[0xf][_0x3e22('0x4')](/\n/g,_0x3e22('0x5'));var _0x31fb8c=_0x1c8c1b[0x10][_0x3e22('0x4')](/\n/g,'\x20');if(!arr[_0x3e22('0x6')](_0x17038c)){arr[_0x3e22('0x7')](_0x17038c);var _0x4f2e13=_0x1c8c1b[0x3];var _0x2c325f=_0x1c8c1b[0x4];var _0x5bcf6f=_0x1c8c1b[0x1];var _0x14777d=_0x1c8c1b[0x0];var _0x1b8383={};_0x1b8383[_0x3e22('0x8')]=_0x1c8c1b[0x8]+_0x3e22('0x9')+_0xfe28bc+'|'+_0x5bbcbc+'|'+_0x3c3732+'|'+_0x17038c+'|'+_0x2886c6;_0x1b8383[_0x3e22('0xa')]=_0x1c8c1b[0x7]+_0x3e22('0x9')+_0xfe28bc+'|'+_0x5bbcbc+'|'+_0x3c3732+'|'+_0x17038c+'|'+_0x2886c6+'|'+_0x1cf672+'|'+_0x31fb8c;_0x1b8383[_0x3e22('0xb')]=_0x1c8c1b[0x9];var _0x31d4af={};_0x31d4af[_0x3e22('0xc')]='2.0';_0x31d4af[_0x3e22('0xd')]=_0x3e22('0xe');var _0x1bc8e9=[];_0x1bc8e9[_0x3e22('0x7')](_0x1c8c1b[0x2]);_0x1bc8e9[_0x3e22('0x7')](_0x1c8c1b[0x5]);_0x1bc8e9['push'](_0x1c8c1b[0x6]);_0x31d4af[_0x3e22('0xf')]=_0x1bc8e9;_0x31d4af['id']=0x1;var _0x45313f=JSON[_0x3e22('0x10')](_0x31d4af);var _0x5a1240={'encoding':_0x3e22('0x11'),'method':'POST','timeout':0x2710,'url':_0x4f2e13,'headers':{'Content-Type':'application/json-rpc'},'body':_0x45313f};return rp(_0x5a1240)[_0x3e22('0x12')](function(_0x2d0280){const _0x4f15e8=JSON[_0x3e22('0x13')](_0x2d0280);if(!_0x4f15e8[_0x3e22('0x14')][_0x3e22('0x15')]){throw new Error(_0x3e22('0x16'));}var _0x128e39=_0x17038c;var _0x52a133=_0x3e22('0x17')+_0x5bcf6f+'&serviceId='+_0x14777d+_0x3e22('0x18')+_0x128e39+_0x3e22('0x19')+JSON[_0x3e22('0x10')](_0x1b8383);var _0x11b6a1=_0x2c325f+'?'+_0x52a133;return rp(_0x11b6a1);})[_0x3e22('0x12')](function(_0x23126c){logger[_0x3e22('0x1a')](_0x3e22('0x1b'),_0xc34bf5,_0x23126c);_0x7505fb[_0x3e22('0x1c')]();})[_0x3e22('0x1d')](function(_0x39f0af){logger[_0x3e22('0x1e')](_0x3e22('0x1f'),_0xc34bf5,_['isObject'](_0x39f0af)?JSON['stringify'](_0x39f0af):_0x39f0af);_0x7505fb[_0x3e22('0x1c')]();});}else{logger['info'](_0x3e22('0x20'),_0xc34bf5);_0x7505fb[_0x3e22('0x21')]();}};}; \ No newline at end of file +var _0xfe5a=['parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','2.0','method','params','POST','application/json-rpc','then'];(function(_0x5d83e7,_0x4a1344){var _0x2ccedb=function(_0x26776b){while(--_0x26776b){_0x5d83e7['push'](_0x5d83e7['shift']());}};_0x2ccedb(++_0x4a1344);}(_0xfe5a,0x170));var _0xafe5=function(_0x3a93da,_0x5f3680){_0x3a93da=_0x3a93da-0x0;var _0x56a67f=_0xfe5a[_0x3a93da];return _0x56a67f;};'use strict';var rp=require(_0xafe5('0x0'));var logger=require('../../../../config/logger')(_0xafe5('0x1'));var _=require(_0xafe5('0x2'));var arr=[];exports[_0xafe5('0x3')]=function(_0xd32446,_0x3dfb77){return function(_0x120efa){var _0x11f46b=_0x3dfb77[0xa];var _0x1ab5be=_0x3dfb77[0xb];var _0x50879d=_0x3dfb77[0xc];var _0x5f2291=_0x3dfb77[0xd];var _0x368693=_0x3dfb77[0xe];var _0xaaa1f8=_0x3dfb77[0xf][_0xafe5('0x4')](/\n/g,_0xafe5('0x5'));var _0x1c6b8c=_0x3dfb77[0x10][_0xafe5('0x4')](/\n/g,'\x20');if(!arr[_0xafe5('0x6')](_0x1ab5be)){arr[_0xafe5('0x7')](_0x1ab5be);var _0x282f2a=_0x3dfb77[0x3];var _0x12600c=_0x3dfb77[0x4];var _0x5b45be=_0x3dfb77[0x1];var _0x4cf5f7=_0x3dfb77[0x0];var _0x4a4e7d={};_0x4a4e7d[_0xafe5('0x8')]=_0x3dfb77[0x8]+_0xafe5('0x9')+_0x50879d+'|'+_0x11f46b+'|'+_0x5f2291+'|'+_0x1ab5be+'|'+_0x368693;_0x4a4e7d['urlOnRing']=_0x3dfb77[0x7]+_0xafe5('0x9')+_0x50879d+'|'+_0x11f46b+'|'+_0x5f2291+'|'+_0x1ab5be+'|'+_0x368693+'|'+_0xaaa1f8+'|'+_0x1c6b8c;_0x4a4e7d['title']=_0x3dfb77[0x9];var _0x1e2726={};_0x1e2726['jsonrpc']=_0xafe5('0xa');_0x1e2726[_0xafe5('0xb')]='login';var _0x3a6316=[];_0x3a6316[_0xafe5('0x7')](_0x3dfb77[0x2]);_0x3a6316[_0xafe5('0x7')](_0x3dfb77[0x5]);_0x3a6316[_0xafe5('0x7')](_0x3dfb77[0x6]);_0x1e2726[_0xafe5('0xc')]=_0x3a6316;_0x1e2726['id']=0x1;var _0x3bda71=JSON['stringify'](_0x1e2726);var _0x4c94b9={'encoding':'utf8','method':_0xafe5('0xd'),'timeout':0x2710,'url':_0x282f2a,'headers':{'Content-Type':_0xafe5('0xe')},'body':_0x3bda71};return rp(_0x4c94b9)[_0xafe5('0xf')](function(_0x27dd20){const _0x5681c1=JSON[_0xafe5('0x10')](_0x27dd20);if(!_0x5681c1[_0xafe5('0x11')][_0xafe5('0x12')]){throw new Error(_0xafe5('0x13'));}var _0x26e0f4=_0x1ab5be;var _0xab08fd=_0xafe5('0x14')+_0x5b45be+_0xafe5('0x15')+_0x4cf5f7+_0xafe5('0x16')+_0x26e0f4+_0xafe5('0x17')+JSON[_0xafe5('0x18')](_0x4a4e7d);var _0x9717b5=_0x12600c+'?'+_0xab08fd;return rp(_0x9717b5);})[_0xafe5('0xf')](function(_0x33ab06){logger[_0xafe5('0x19')](_0xafe5('0x1a'),_0xd32446,_0x33ab06);_0x120efa[_0xafe5('0x1b')]();})['catch'](function(_0xbbf99b){logger[_0xafe5('0x1c')](_0xafe5('0x1d'),_0xd32446,_[_0xafe5('0x1e')](_0xbbf99b)?JSON['stringify'](_0xbbf99b):_0xbbf99b);_0x120efa[_0xafe5('0x1b')]();});}else{logger[_0xafe5('0x19')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0xd32446);_0x120efa[_0xafe5('0x1f')]();}};}; \ 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 8483a36..d01d02e 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(_0x212d03,_0xf6fbc6){var _0x32070f=function(_0x1f2a25){while(--_0x1f2a25){_0x212d03['push'](_0x212d03['shift']());}};_0x32070f(++_0xf6fbc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x41cd9e,_0x587e7e){var _0x3b921d=function(_0x1a8dbf){while(--_0x1a8dbf){_0x41cd9e['push'](_0x41cd9e['shift']());}};_0x3b921d(++_0x587e7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 68dae45..efa791b 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 _0x8d62=['rules','execute','stringify','matchPath','complete','format','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','mailQueues','loggedIn','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','.js'];(function(_0x27d446,_0x17135c){var _0x16935f=function(_0x119593){while(--_0x119593){_0x27d446['push'](_0x27d446['shift']());}};_0x16935f(++_0x17135c);}(_0x8d62,0xf8));var _0x28d6=function(_0x1e1762,_0x185229){_0x1e1762=_0x1e1762-0x0;var _0x3f58d0=_0x8d62[_0x1e1762];return _0x3f58d0;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var path=require(_0x28d6('0x1'));var fs=require('fs');var jayson=require(_0x28d6('0x2'));var BPromise=require(_0x28d6('0x3'));var utils=require(_0x28d6('0x4'));var sUtils=require(_0x28d6('0x5'));var logger=require(_0x28d6('0x6'))(_0x28d6('0x7'));var rpc={'openchannelQueueReport':require(_0x28d6('0x8')),'mailQueueReport':require(_0x28d6('0x9')),'chatQueueReport':require(_0x28d6('0xa')),'smsQueueReport':require(_0x28d6('0xb')),'faxQueueReport':require(_0x28d6('0xc')),'whatsappQueueReport':require(_0x28d6('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1d5399,_0xb9dccb,_0x3f3235){return util['format'](_0x28d6('0xe'),_0x1d5399,_0xb9dccb||0x0,_0x3f3235||0x0);}function getIntervals(_0x4b564f,_0x13eeb6){var _0x7726e1=[];if(!_[_0x28d6('0xf')](_0x13eeb6[_0x28d6('0x10')])&&!_[_0x28d6('0xf')](_0x4b564f[_0x13eeb6['IntervalId']])&&!_[_0x28d6('0xf')](_0x4b564f[_0x13eeb6[_0x28d6('0x10')]][_0x28d6('0x11')])){_0x7726e1=_[_0x28d6('0x12')](_0x4b564f[_0x13eeb6[_0x28d6('0x10')]][_0x28d6('0x11')],_0x28d6('0x13'));}else if(!_[_0x28d6('0xf')](_0x13eeb6['interval'])){_0x7726e1=[_0x13eeb6[_0x28d6('0x13')]];}return _0x7726e1;}exports[_0x28d6('0x14')]=function(_0x33ba38){_0x33ba38['rules']={};return new BPromise(function(_0x1621ee,_0x53f101){var _0x19c21d={'Start':function(_0x425ffb){var _0x4b82e2=this;return new Promise(function(_0x1881a8,_0x159d2a){if(_0x425ffb){try{var _0x2d5eee=[];var _0x17a822=getId(_0x425ffb[_0x28d6('0x15')],_0x425ffb['message']?_0x425ffb[_0x28d6('0x16')]['id']:0x0,_0x425ffb['interaction']?_0x425ffb[_0x28d6('0x17')]['id']:0x0);var _0x155151=sUtils[_0x28d6('0x18')](_0x33ba38,_0x425ffb);if(_0x425ffb[_0x28d6('0x19')]||!_0x155151&&_0x425ffb[_0x28d6('0x1a')]&&_[_0x28d6('0x1b')](_0x425ffb[_0x28d6('0x1a')])&&_0x425ffb['applications'][_0x28d6('0x1c')]){for(var _0x20f2fd=0x0;_0x20f2fd<_0x425ffb['applications'][_0x28d6('0x1c')];_0x20f2fd+=0x1){var _0x24f764=_0x425ffb[_0x28d6('0x1a')][_0x20f2fd];if(fs[_0x28d6('0x1d')](path[_0x28d6('0x1e')](__dirname,_0x28d6('0x1a'),_0x24f764[_0x28d6('0x1f')]+'.js'))){var _0xcf8fa0=[];switch(_0x24f764['app'][_0x28d6('0x20')]()){case _0x28d6('0x21'):var _0x455dd6=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');if(_0x425ffb[_0x28d6('0x15')]==='mail'){_0xcf8fa0['push'](_0x455dd6[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x455dd6[0x1]);_0xcf8fa0[_0x28d6('0x24')](_0x455dd6[_0x28d6('0x25')](0x2,_0x455dd6[_0x28d6('0x1c')])['join'](','));}else{_0xcf8fa0[_0x28d6('0x24')](_0x455dd6[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x455dd6[_0x28d6('0x25')](0x1,_0x455dd6[_0x28d6('0x1c')])[_0x28d6('0x1e')](','));}break;case _0x28d6('0x26'):var _0x60ded0=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');_0xcf8fa0[_0x28d6('0x24')](_0x60ded0[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x60ded0[0x1]);_0xcf8fa0[_0x28d6('0x24')](_0x60ded0[_0x28d6('0x25')](0x2,_0x60ded0[_0x28d6('0x1c')])['join'](','));break;case'dialogflowv2':var _0x1de585=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');_0xcf8fa0[_0x28d6('0x24')](_0x1de585[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x1de585[0x1]);_0xcf8fa0[_0x28d6('0x24')](_0x1de585[0x2]);_0xcf8fa0['push'](_0x1de585[0x3]);_0xcf8fa0[_0x28d6('0x24')](_0x1de585['slice'](0x4,_0x1de585[_0x28d6('0x1c')])['join'](','));break;case _0x28d6('0x27'):var _0x2594cb=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');_0xcf8fa0[_0x28d6('0x24')](_0x2594cb[0x0]);_0xcf8fa0['push'](_0x2594cb[0x1]);_0xcf8fa0['push'](_0x2594cb[0x2]);_0xcf8fa0[_0x28d6('0x24')](_0x2594cb[0x3]);_0xcf8fa0[_0x28d6('0x24')](_0x2594cb['slice'](0x4,_0x2594cb[_0x28d6('0x1c')])['join'](','));break;case _0x28d6('0x16'):_0xcf8fa0['push'](_0x24f764[_0x28d6('0x22')]);break;case'tag':_0xcf8fa0[_0x28d6('0x24')](_0x24f764[_0x28d6('0x28')]);_0xcf8fa0[_0x28d6('0x24')](_0x24f764[_0x28d6('0x22')]);break;case _0x28d6('0x29'):var _0x10b374=utils[_0x28d6('0x2a')](_0x425ffb['account'][_0x28d6('0x2b')],_0x425ffb);var _0x23a04b=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');_0xcf8fa0['push'](_0x23a04b[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x1]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x2]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x3]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x4]);_0xcf8fa0['push'](_0x23a04b[0x5]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x6]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x7]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x8]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x9]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0xa]);_0xcf8fa0[_0x28d6('0x24')](_0x425ffb[_0x28d6('0x17')]['id']);_0xcf8fa0[_0x28d6('0x24')](_0x425ffb[_0x28d6('0x16')]['id']);_0xcf8fa0[_0x28d6('0x24')](_0x24f764[_0x28d6('0x2c')]);_0xcf8fa0[_0x28d6('0x24')](_0x425ffb[_0x28d6('0x17')][_0x28d6('0x2d')]);_0xcf8fa0[_0x28d6('0x24')](_0x425ffb[_0x28d6('0x2e')]['body']);_0xcf8fa0['push'](_0x10b374);break;default:_0xcf8fa0=_['isNil'](_0x24f764[_0x28d6('0x22')])?[]:_0x24f764['appdata']['split'](',');}var _0x293320={'id':util['format'](_0x28d6('0x2f'),_0x17a822,_0x24f764['id'],_0x24f764[_0x28d6('0x1f')]),'condition':require('./interval')[_0x28d6('0x30')](_0x17a822,getIntervals(_0x33ba38[_0x28d6('0x31')],_0x24f764),_0x33ba38),'consequence':require(_0x28d6('0x32')+_0x24f764[_0x28d6('0x1f')])[_0x28d6('0x33')](_0x17a822,_0xcf8fa0,_0x33ba38,_0x425ffb),'p':_0x24f764[_0x28d6('0x34')]||0x0};logger[_0x28d6('0x35')](_0x28d6('0x36'),_0x293320['id'],'on\x20interval',getIntervals(_0x33ba38[_0x28d6('0x31')],_0x24f764)[_0x28d6('0x1e')]('\x20|\x20'));_0x2d5eee[_0x28d6('0x24')](_0x293320);}else{logger[_0x28d6('0x37')](_0x28d6('0x38'),path['join'](__dirname,_0x28d6('0x1a'),_0x24f764[_0x28d6('0x1f')]+_0x28d6('0x39')));}}_0x33ba38[_0x28d6('0x3a')][_0x17a822]=new RuleEngine(_0x2d5eee);_0x33ba38['rules'][_0x17a822][_0x28d6('0x3b')](_0x425ffb,function(_0x3559ab){logger[_0x28d6('0x35')]('Applications\x20executed',JSON[_0x28d6('0x3c')](_0x3559ab[_0x28d6('0x3d')]));if(_0x33ba38[_0x28d6('0x3a')][_0x17a822]){_0x33ba38[_0x28d6('0x3a')][_0x17a822]['emit'](_0x28d6('0x3e'));}});return _0x1881a8({'code':0xc8,'message':_0x425ffb});}else{if(_0x155151){logger[_0x28d6('0x35')](util[_0x28d6('0x3f')](_0x28d6('0x40'),_0x17a822));}else{logger[_0x28d6('0x35')]('No\x20applications\x20to\x20execute');}return _0x1881a8({'code':0xc8,'message':_0x425ffb});}}catch(_0x159580){logger[_0x28d6('0x37')](_0x159580[_0x28d6('0x41')]);return _0x159d2a(_0x4b82e2[_0x28d6('0x37')](0x1f4,_0x159580));}}return _0x159d2a(_0x28d6('0x42'));});},'AcceptMessage':function(_0x182d70){var _0x10a52=this;return new Promise(function(_0x6876a5,_0x293c76){if(_0x182d70[_0x28d6('0x43')]&&_0x182d70['agent']['id']){if(_0x33ba38['agents'][_0x182d70[_0x28d6('0x43')]['id']]){_0x33ba38['agents'][_0x182d70['agent']['id']]['busy']=![];_0x33ba38[_0x28d6('0x44')][_0x182d70['agent']['id']][_0x28d6('0x45')]=undefined;}}if(_0x182d70['message']&&_0x182d70[_0x28d6('0x16')]['id']){try{var _0x3b7f2e=getId(_0x182d70[_0x28d6('0x15')],_0x182d70['message']?_0x182d70['message']['id']:0x0,_0x182d70['interaction']?_0x182d70[_0x28d6('0x17')]['id']:0x0);if(_0x33ba38[_0x28d6('0x3a')][_0x3b7f2e]){_0x33ba38['rules'][_0x3b7f2e][_0x28d6('0x46')](_0x28d6('0x47'));if(rpc[_0x182d70[_0x28d6('0x15')]+_0x28d6('0x48')]){rpc[_0x182d70[_0x28d6('0x15')]+_0x28d6('0x48')][_0x28d6('0x49')](_0x3b7f2e,{'UserId':_0x182d70[_0x28d6('0x16')]['UserId']})[_0x28d6('0x4a')](function(){logger[_0x28d6('0x37')](_0x28d6('0x4b'));});}}return _0x6876a5({'code':0xc8,'message':_0x182d70});}catch(_0x2b0b72){logger[_0x28d6('0x37')](_0x2b0b72[_0x28d6('0x41')]);return _0x293c76(_0x10a52[_0x28d6('0x37')](0x1f4,_0x2b0b72));}}logger['error'](_0x28d6('0x4c'));return _0x293c76(_0x10a52['error'](0x1f4,_0x28d6('0x4c')));});},'RejectMessage':function(_0x2f8f42){var _0x6ee4d9=this;return new Promise(function(_0x15edd6,_0x69aa04){if(_0x2f8f42[_0x28d6('0x43')]&&_0x2f8f42['agent']['id']){try{if(_0x33ba38[_0x28d6('0x44')][_0x2f8f42['agent']['id']]){_0x33ba38[_0x28d6('0x44')][_0x2f8f42['agent']['id']][_0x28d6('0x4d')]=![];_0x33ba38[_0x28d6('0x44')][_0x2f8f42[_0x28d6('0x43')]['id']][_0x28d6('0x45')]=undefined;}return _0x15edd6({'code':0xc8,'message':_0x2f8f42});}catch(_0x49a01a){logger[_0x28d6('0x37')](_0x49a01a[_0x28d6('0x41')]);return _0x69aa04(_0x6ee4d9[_0x28d6('0x37')](0x1f4,_0x49a01a));}}logger[_0x28d6('0x37')](_0x28d6('0x4c'));return _0x69aa04(_0x6ee4d9[_0x28d6('0x37')](0x1f4,_0x28d6('0x4c')));});},'AbandonInteraction':function(_0x1ed92e){var _0x164f53=this;return new Promise(function(_0xe55cde,_0x267661){if(_0x1ed92e['channel']&&_0x1ed92e[_0x28d6('0x17')]&&_0x1ed92e[_0x28d6('0x17')]['id']){try{var _0x45a288=getId(_0x1ed92e[_0x28d6('0x15')],_0x1ed92e[_0x28d6('0x16')]?_0x1ed92e['message']['id']:0x0,_0x1ed92e[_0x28d6('0x17')]?_0x1ed92e[_0x28d6('0x17')]['id']:0x0);if(_0x33ba38[_0x28d6('0x3a')][_0x45a288]){_0x33ba38[_0x28d6('0x3a')][_0x45a288][_0x28d6('0x46')]('end');}return _0xe55cde({'code':0xc8,'message':_0x1ed92e});}catch(_0x3bf12f){logger[_0x28d6('0x37')](_0x3bf12f[_0x28d6('0x41')]);return _0x267661(_0x164f53[_0x28d6('0x37')](0x1f4,_0x3bf12f));}}logger['error'](_0x28d6('0x4c'));return _0x267661(_0x164f53['error'](0x1f4,_0x28d6('0x4c')));});},'AgentCapacity':function(_0x1b8ed6){var _0x351f8d=this;return new Promise(function(_0x4c5c36,_0x21fd25){if(_0x33ba38[_0x28d6('0x44')][_0x28d6('0x4e')](_0x1b8ed6['id'])){for(var _0x16ced4 in _0x1b8ed6[_0x28d6('0x4f')]){if(_0x1b8ed6[_0x28d6('0x4f')][_0x28d6('0x4e')](_0x16ced4)){if(_0x33ba38['agents'][_0x1b8ed6['id']][_0x28d6('0x4e')](_0x16ced4+_0x28d6('0x50'))){_0x33ba38[_0x28d6('0x44')][_0x1b8ed6['id']][_0x16ced4+_0x28d6('0x50')]=parseInt(_0x1b8ed6[_0x28d6('0x4f')][_0x16ced4],0xa);}}}_0x33ba38[_0x28d6('0x44')][_0x1b8ed6['id']][_0x28d6('0x51')]();return _0x4c5c36({'code':0xc8,'message':_0x33ba38[_0x28d6('0x44')][_0x1b8ed6['id']]});}else{return _0x21fd25(_0x351f8d[_0x28d6('0x37')](0x1f4,_0x28d6('0x52')));}});},'Agents':function(_0x5d1441){return new Promise(function(_0x3a87c8){var _0xbe3e6=_[_0x28d6('0x53')](_0x33ba38[_0x28d6('0x44')]);if(_0x5d1441&&_0x5d1441['id']){var _0xbd4b4b=_['find'](_0xbe3e6,function(_0x2322c6){return _0x2322c6['id']===_0x5d1441['id'];});_0x3a87c8(_0xbd4b4b);}else{_0x3a87c8({'count':_0xbe3e6[_0x28d6('0x1c')],'rows':_0xbe3e6});}});},'ChatQueues':function(){return new Promise(function(_0xd6b590){var _0x3676b3=[];for(var _0x221dec in _0x33ba38[_0x28d6('0x54')]){if(_0x33ba38[_0x28d6('0x54')]['hasOwnProperty'](_0x221dec)){var _0x543770=_0x33ba38[_0x28d6('0x54')][_0x221dec];var _0x245872={'id':_0x543770['id'],'available':_0x543770[_0x28d6('0x55')],'loggedIn':_0x543770['loggedIn'],'name':_0x543770[_0x28d6('0x56')],'paused':_0x543770['paused'],'waiting':_0x543770['waiting']};_0x3676b3[_0x28d6('0x24')](_0x245872);}}_0xd6b590({'count':_0x3676b3[_0x28d6('0x1c')],'rows':_0x3676b3});});},'MailQueues':function(){return new Promise(function(_0x2613fb){var _0x2f0580=[];for(var _0x45245a in _0x33ba38[_0x28d6('0x57')]){if(_0x33ba38[_0x28d6('0x57')]['hasOwnProperty'](_0x45245a)){var _0x5956de=_0x33ba38['mailQueues'][_0x45245a];var _0x2fae42={'id':_0x5956de['id'],'available':_0x5956de[_0x28d6('0x55')],'loggedIn':_0x5956de[_0x28d6('0x58')],'name':_0x5956de[_0x28d6('0x56')],'paused':_0x5956de[_0x28d6('0x59')],'waiting':_0x5956de[_0x28d6('0x5a')]};_0x2f0580[_0x28d6('0x24')](_0x2fae42);}}_0x2613fb({'count':_0x2f0580[_0x28d6('0x1c')],'rows':_0x2f0580});});},'OpenchannelQueues':function(){return new Promise(function(_0x26a2f7){var _0x1ed7e3=[];for(var _0x5e1ba4 in _0x33ba38[_0x28d6('0x5b')]){if(_0x33ba38[_0x28d6('0x5b')][_0x28d6('0x4e')](_0x5e1ba4)){var _0xb9a647=_0x33ba38[_0x28d6('0x5b')][_0x5e1ba4];var _0x278401={'id':_0xb9a647['id'],'available':_0xb9a647[_0x28d6('0x55')],'loggedIn':_0xb9a647[_0x28d6('0x58')],'name':_0xb9a647[_0x28d6('0x56')],'paused':_0xb9a647['paused'],'waiting':_0xb9a647['waiting']};_0x1ed7e3[_0x28d6('0x24')](_0x278401);}}_0x26a2f7({'count':_0x1ed7e3[_0x28d6('0x1c')],'rows':_0x1ed7e3});});},'SmsQueues':function(){return new Promise(function(_0x6bdf9f){var _0x5418ba=[];for(var _0x376a7d in _0x33ba38[_0x28d6('0x5c')]){if(_0x33ba38[_0x28d6('0x5c')][_0x28d6('0x4e')](_0x376a7d)){var _0x228f44=_0x33ba38[_0x28d6('0x5c')][_0x376a7d];var _0x2dbdf6={'id':_0x228f44['id'],'available':_0x228f44[_0x28d6('0x55')],'loggedIn':_0x228f44[_0x28d6('0x58')],'name':_0x228f44[_0x28d6('0x56')],'paused':_0x228f44[_0x28d6('0x59')],'waiting':_0x228f44[_0x28d6('0x5a')]};_0x5418ba[_0x28d6('0x24')](_0x2dbdf6);}}_0x6bdf9f({'count':_0x5418ba[_0x28d6('0x1c')],'rows':_0x5418ba});});},'FaxQueues':function(){return new Promise(function(_0x22d73b){var _0x51adbb=[];for(var _0x12cac4 in _0x33ba38[_0x28d6('0x5d')]){if(_0x33ba38[_0x28d6('0x5d')][_0x28d6('0x4e')](_0x12cac4)){var _0x4bf2cd=_0x33ba38[_0x28d6('0x5d')][_0x12cac4];var _0x51c690={'id':_0x4bf2cd['id'],'available':_0x4bf2cd[_0x28d6('0x55')],'loggedIn':_0x4bf2cd[_0x28d6('0x58')],'name':_0x4bf2cd['name'],'paused':_0x4bf2cd[_0x28d6('0x59')],'waiting':_0x4bf2cd['waiting']};_0x51adbb[_0x28d6('0x24')](_0x51c690);}}_0x22d73b({'count':_0x51adbb[_0x28d6('0x1c')],'rows':_0x51adbb});});},'WhatsappQueues':function(){return new Promise(function(_0x4a6903){var _0x3fede2=[];for(var _0x18c0aa in _0x33ba38[_0x28d6('0x5e')]){if(_0x33ba38['whatsappQueues'][_0x28d6('0x4e')](_0x18c0aa)){var _0x359fe2=_0x33ba38[_0x28d6('0x5e')][_0x18c0aa];var _0x1a8def={'id':_0x359fe2['id'],'available':_0x359fe2[_0x28d6('0x55')],'loggedIn':_0x359fe2[_0x28d6('0x58')],'name':_0x359fe2[_0x28d6('0x56')],'paused':_0x359fe2[_0x28d6('0x59')],'waiting':_0x359fe2['waiting']};_0x3fede2[_0x28d6('0x24')](_0x1a8def);}}_0x4a6903({'count':_0x3fede2[_0x28d6('0x1c')],'rows':_0x3fede2});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x801f2f){var _0x4f2ac4=_[_0x28d6('0x53')](_0x33ba38[_0x28d6('0x5f')]);_0x801f2f({'count':_0x4f2ac4[_0x28d6('0x1c')],'rows':_0x4f2ac4});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x26aab9){var _0x5632ba=_['values'](_0x33ba38[_0x28d6('0x60')]);_0x26aab9({'count':_0x5632ba[_0x28d6('0x1c')],'rows':_0x5632ba});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4da055){var _0x15b53a=_['values'](_0x33ba38[_0x28d6('0x61')]);_0x4da055({'count':_0x15b53a[_0x28d6('0x1c')],'rows':_0x15b53a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3f0eff){var _0xca226b=_['values'](_0x33ba38['smsQueuesWaitingInteractions']);_0x3f0eff({'count':_0xca226b[_0x28d6('0x1c')],'rows':_0xca226b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5e1ce0){var _0x261cfb=_['values'](_0x33ba38[_0x28d6('0x62')]);_0x5e1ce0({'count':_0x261cfb[_0x28d6('0x1c')],'rows':_0x261cfb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3b6e84){var _0x5383c8=_[_0x28d6('0x53')](_0x33ba38['whatsappQueuesWaitingInteractions']);_0x3b6e84({'count':_0x5383c8[_0x28d6('0x1c')],'rows':_0x5383c8});});}};var _0x2788b7=jayson['server'](_0x19c21d)[_0x28d6('0x63')]();_0x2788b7['on'](_0x28d6('0x37'),function(_0x420931){logger['error'](JSON[_0x28d6('0x3c')](_0x420931));return _0x53f101(_0x420931);});_0x2788b7['listen'](0x232c,_0x28d6('0x64'),function(){console['log'](_0x28d6('0x65'),0x232c);return _0x1621ee('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x3ce9=['QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','values','chatQueues','available','loggedIn','name','waiting','mailQueues','openchannelQueues','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','mail','push','slice','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','rules','Applications\x20executed','emit','complete','format','Skipped\x20routing\x20for\x20%s','stack','agent','agents','busy','busyQueue'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x3ce9,0x85));var _0x93ce=function(_0x375216,_0x52ee5e){_0x375216=_0x375216-0x0;var _0x2407de=_0x3ce9[_0x375216];return _0x2407de;};'use strict';var _=require(_0x93ce('0x0'));var util=require('util');var path=require(_0x93ce('0x1'));var fs=require('fs');var jayson=require(_0x93ce('0x2'));var BPromise=require(_0x93ce('0x3'));var utils=require(_0x93ce('0x4'));var sUtils=require(_0x93ce('0x5'));var logger=require(_0x93ce('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x93ce('0x7')),'mailQueueReport':require(_0x93ce('0x8')),'chatQueueReport':require(_0x93ce('0x9')),'smsQueueReport':require(_0x93ce('0xa')),'faxQueueReport':require(_0x93ce('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x93ce('0xc'));function getId(_0xf3f61,_0x4a112a,_0x5605fe){return util['format'](_0x93ce('0xd'),_0xf3f61,_0x4a112a||0x0,_0x5605fe||0x0);}function getIntervals(_0x5e3f70,_0x2e3e58){var _0x5129b4=[];if(!_[_0x93ce('0xe')](_0x2e3e58['IntervalId'])&&!_[_0x93ce('0xe')](_0x5e3f70[_0x2e3e58['IntervalId']])&&!_['isNil'](_0x5e3f70[_0x2e3e58['IntervalId']]['Intervals'])){_0x5129b4=_['map'](_0x5e3f70[_0x2e3e58[_0x93ce('0xf')]][_0x93ce('0x10')],_0x93ce('0x11'));}else if(!_['isNil'](_0x2e3e58[_0x93ce('0x11')])){_0x5129b4=[_0x2e3e58['interval']];}return _0x5129b4;}exports[_0x93ce('0x12')]=function(_0x175e00){_0x175e00['rules']={};return new BPromise(function(_0x4a4655,_0x3aad5e){var _0x549f83={'Start':function(_0x15a719){var _0x4bc3e1=this;return new Promise(function(_0xecc51b,_0x5cd45f){if(_0x15a719){try{var _0x20323f=[];var _0x6f74cf=getId(_0x15a719[_0x93ce('0x13')],_0x15a719[_0x93ce('0x14')]?_0x15a719[_0x93ce('0x14')]['id']:0x0,_0x15a719['interaction']?_0x15a719[_0x93ce('0x15')]['id']:0x0);var _0x221030=sUtils[_0x93ce('0x16')](_0x175e00,_0x15a719);if(_0x15a719[_0x93ce('0x17')]||!_0x221030&&_0x15a719[_0x93ce('0x18')]&&_[_0x93ce('0x19')](_0x15a719['applications'])&&_0x15a719['applications'][_0x93ce('0x1a')]){for(var _0x31d670=0x0;_0x31d670<_0x15a719[_0x93ce('0x18')][_0x93ce('0x1a')];_0x31d670+=0x1){var _0x4166c8=_0x15a719[_0x93ce('0x18')][_0x31d670];if(fs[_0x93ce('0x1b')](path[_0x93ce('0x1c')](__dirname,'applications',_0x4166c8[_0x93ce('0x1d')]+_0x93ce('0x1e')))){var _0x169a92=[];switch(_0x4166c8[_0x93ce('0x1d')]['toLowerCase']()){case _0x93ce('0x1f'):var _0x49ecf4=_0x4166c8[_0x93ce('0x20')][_0x93ce('0x21')](',');if(_0x15a719['channel']===_0x93ce('0x22')){_0x169a92[_0x93ce('0x23')](_0x49ecf4[0x0]);_0x169a92[_0x93ce('0x23')](_0x49ecf4[0x1]);_0x169a92[_0x93ce('0x23')](_0x49ecf4[_0x93ce('0x24')](0x2,_0x49ecf4[_0x93ce('0x1a')])[_0x93ce('0x1c')](','));}else{_0x169a92[_0x93ce('0x23')](_0x49ecf4[0x0]);_0x169a92['push'](_0x49ecf4[_0x93ce('0x24')](0x1,_0x49ecf4[_0x93ce('0x1a')])[_0x93ce('0x1c')](','));}break;case'dialogflow':var _0x105ac6=_0x4166c8[_0x93ce('0x20')][_0x93ce('0x21')](',');_0x169a92[_0x93ce('0x23')](_0x105ac6[0x0]);_0x169a92[_0x93ce('0x23')](_0x105ac6[0x1]);_0x169a92['push'](_0x105ac6[_0x93ce('0x24')](0x2,_0x105ac6[_0x93ce('0x1a')])[_0x93ce('0x1c')](','));break;case'dialogflowv2':var _0x22d890=_0x4166c8[_0x93ce('0x20')][_0x93ce('0x21')](',');_0x169a92[_0x93ce('0x23')](_0x22d890[0x0]);_0x169a92['push'](_0x22d890[0x1]);_0x169a92[_0x93ce('0x23')](_0x22d890[0x2]);_0x169a92[_0x93ce('0x23')](_0x22d890[0x3]);_0x169a92[_0x93ce('0x23')](_0x22d890[_0x93ce('0x24')](0x4,_0x22d890[_0x93ce('0x1a')])['join'](','));break;case _0x93ce('0x25'):var _0x578a3f=_0x4166c8[_0x93ce('0x20')][_0x93ce('0x21')](',');_0x169a92['push'](_0x578a3f[0x0]);_0x169a92[_0x93ce('0x23')](_0x578a3f[0x1]);_0x169a92[_0x93ce('0x23')](_0x578a3f[0x2]);_0x169a92[_0x93ce('0x23')](_0x578a3f[0x3]);_0x169a92[_0x93ce('0x23')](_0x578a3f[_0x93ce('0x24')](0x4,_0x578a3f[_0x93ce('0x1a')])[_0x93ce('0x1c')](','));break;case'message':_0x169a92['push'](_0x4166c8[_0x93ce('0x20')]);break;case _0x93ce('0x26'):_0x169a92[_0x93ce('0x23')](_0x4166c8[_0x93ce('0x27')]);_0x169a92[_0x93ce('0x23')](_0x4166c8[_0x93ce('0x20')]);break;case _0x93ce('0x28'):var _0x949f79=utils[_0x93ce('0x29')](_0x15a719[_0x93ce('0x2a')][_0x93ce('0x2b')],_0x15a719);var _0x5e68c9=_0x4166c8[_0x93ce('0x20')][_0x93ce('0x21')](',');_0x169a92[_0x93ce('0x23')](_0x5e68c9[0x0]);_0x169a92[_0x93ce('0x23')](_0x5e68c9[0x1]);_0x169a92[_0x93ce('0x23')](_0x5e68c9[0x2]);_0x169a92[_0x93ce('0x23')](_0x5e68c9[0x3]);_0x169a92[_0x93ce('0x23')](_0x5e68c9[0x4]);_0x169a92[_0x93ce('0x23')](_0x5e68c9[0x5]);_0x169a92['push'](_0x5e68c9[0x6]);_0x169a92[_0x93ce('0x23')](_0x5e68c9[0x7]);_0x169a92[_0x93ce('0x23')](_0x5e68c9[0x8]);_0x169a92['push'](_0x5e68c9[0x9]);_0x169a92['push'](_0x5e68c9[0xa]);_0x169a92[_0x93ce('0x23')](_0x15a719[_0x93ce('0x15')]['id']);_0x169a92[_0x93ce('0x23')](_0x15a719[_0x93ce('0x14')]['id']);_0x169a92[_0x93ce('0x23')](_0x4166c8[_0x93ce('0x2c')]);_0x169a92[_0x93ce('0x23')](_0x15a719[_0x93ce('0x15')][_0x93ce('0x2d')]);_0x169a92[_0x93ce('0x23')](_0x15a719[_0x93ce('0x2e')][_0x93ce('0x2e')]);_0x169a92[_0x93ce('0x23')](_0x949f79);break;default:_0x169a92=_[_0x93ce('0xe')](_0x4166c8['appdata'])?[]:_0x4166c8[_0x93ce('0x20')][_0x93ce('0x21')](',');}var _0x50690d={'id':util['format'](_0x93ce('0x2f'),_0x6f74cf,_0x4166c8['id'],_0x4166c8[_0x93ce('0x1d')]),'condition':require(_0x93ce('0x30'))[_0x93ce('0x31')](_0x6f74cf,getIntervals(_0x175e00['intervals'],_0x4166c8),_0x175e00),'consequence':require(_0x93ce('0x32')+_0x4166c8[_0x93ce('0x1d')])[_0x93ce('0x33')](_0x6f74cf,_0x169a92,_0x175e00,_0x15a719),'p':_0x4166c8[_0x93ce('0x34')]||0x0};logger[_0x93ce('0x35')](_0x93ce('0x36'),_0x50690d['id'],_0x93ce('0x37'),getIntervals(_0x175e00['intervals'],_0x4166c8)[_0x93ce('0x1c')](_0x93ce('0x38')));_0x20323f[_0x93ce('0x23')](_0x50690d);}else{logger[_0x93ce('0x39')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x93ce('0x1c')](__dirname,'applications',_0x4166c8[_0x93ce('0x1d')]+'.js'));}}_0x175e00[_0x93ce('0x3a')][_0x6f74cf]=new RuleEngine(_0x20323f);_0x175e00['rules'][_0x6f74cf]['execute'](_0x15a719,function(_0x266ed6){logger[_0x93ce('0x35')](_0x93ce('0x3b'),JSON['stringify'](_0x266ed6['matchPath']));if(_0x175e00[_0x93ce('0x3a')][_0x6f74cf]){_0x175e00[_0x93ce('0x3a')][_0x6f74cf][_0x93ce('0x3c')](_0x93ce('0x3d'));}});return _0xecc51b({'code':0xc8,'message':_0x15a719});}else{if(_0x221030){logger['info'](util[_0x93ce('0x3e')](_0x93ce('0x3f'),_0x6f74cf));}else{logger[_0x93ce('0x35')]('No\x20applications\x20to\x20execute');}return _0xecc51b({'code':0xc8,'message':_0x15a719});}}catch(_0x2810a7){logger[_0x93ce('0x39')](_0x2810a7[_0x93ce('0x40')]);return _0x5cd45f(_0x4bc3e1[_0x93ce('0x39')](0x1f4,_0x2810a7));}}return _0x5cd45f('routing\x20is\x20empty');});},'AcceptMessage':function(_0x15992a){var _0x216978=this;return new Promise(function(_0x443eb3,_0x2ee877){if(_0x15992a[_0x93ce('0x41')]&&_0x15992a[_0x93ce('0x41')]['id']){if(_0x175e00[_0x93ce('0x42')][_0x15992a[_0x93ce('0x41')]['id']]){_0x175e00['agents'][_0x15992a['agent']['id']][_0x93ce('0x43')]=![];_0x175e00[_0x93ce('0x42')][_0x15992a['agent']['id']][_0x93ce('0x44')]=undefined;}}if(_0x15992a['message']&&_0x15992a[_0x93ce('0x14')]['id']){try{var _0x4078f0=getId(_0x15992a[_0x93ce('0x13')],_0x15992a[_0x93ce('0x14')]?_0x15992a[_0x93ce('0x14')]['id']:0x0,_0x15992a[_0x93ce('0x15')]?_0x15992a[_0x93ce('0x15')]['id']:0x0);if(_0x175e00[_0x93ce('0x3a')][_0x4078f0]){_0x175e00[_0x93ce('0x3a')][_0x4078f0][_0x93ce('0x3c')]('end');if(rpc[_0x15992a[_0x93ce('0x13')]+_0x93ce('0x45')]){rpc[_0x15992a[_0x93ce('0x13')]+_0x93ce('0x45')][_0x93ce('0x46')](_0x4078f0,{'UserId':_0x15992a[_0x93ce('0x14')][_0x93ce('0x47')]})[_0x93ce('0x48')](function(){logger[_0x93ce('0x39')](_0x93ce('0x49'));});}}return _0x443eb3({'code':0xc8,'message':_0x15992a});}catch(_0x40d6cd){logger[_0x93ce('0x39')](_0x40d6cd[_0x93ce('0x40')]);return _0x2ee877(_0x216978['error'](0x1f4,_0x40d6cd));}}logger[_0x93ce('0x39')](_0x93ce('0x4a'));return _0x2ee877(_0x216978[_0x93ce('0x39')](0x1f4,_0x93ce('0x4a')));});},'RejectMessage':function(_0x27bc76){var _0x4ca841=this;return new Promise(function(_0x26c023,_0x19ce49){if(_0x27bc76[_0x93ce('0x41')]&&_0x27bc76[_0x93ce('0x41')]['id']){try{if(_0x175e00['agents'][_0x27bc76[_0x93ce('0x41')]['id']]){_0x175e00[_0x93ce('0x42')][_0x27bc76[_0x93ce('0x41')]['id']][_0x93ce('0x43')]=![];_0x175e00[_0x93ce('0x42')][_0x27bc76[_0x93ce('0x41')]['id']][_0x93ce('0x44')]=undefined;}return _0x26c023({'code':0xc8,'message':_0x27bc76});}catch(_0x31a1c9){logger[_0x93ce('0x39')](_0x31a1c9[_0x93ce('0x40')]);return _0x19ce49(_0x4ca841['error'](0x1f4,_0x31a1c9));}}logger[_0x93ce('0x39')](_0x93ce('0x4a'));return _0x19ce49(_0x4ca841[_0x93ce('0x39')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x9de0a8){var _0x13ba5a=this;return new Promise(function(_0x72630a,_0x4bac30){if(_0x9de0a8[_0x93ce('0x13')]&&_0x9de0a8['interaction']&&_0x9de0a8['interaction']['id']){try{var _0x241c93=getId(_0x9de0a8[_0x93ce('0x13')],_0x9de0a8['message']?_0x9de0a8['message']['id']:0x0,_0x9de0a8[_0x93ce('0x15')]?_0x9de0a8[_0x93ce('0x15')]['id']:0x0);if(_0x175e00[_0x93ce('0x3a')][_0x241c93]){_0x175e00['rules'][_0x241c93][_0x93ce('0x3c')](_0x93ce('0x4b'));}return _0x72630a({'code':0xc8,'message':_0x9de0a8});}catch(_0x3e3061){logger[_0x93ce('0x39')](_0x3e3061[_0x93ce('0x40')]);return _0x4bac30(_0x13ba5a[_0x93ce('0x39')](0x1f4,_0x3e3061));}}logger[_0x93ce('0x39')](_0x93ce('0x4a'));return _0x4bac30(_0x13ba5a['error'](0x1f4,_0x93ce('0x4a')));});},'AgentCapacity':function(_0x166a43){var _0x327652=this;return new Promise(function(_0x436129,_0x2c9f78){if(_0x175e00['agents'][_0x93ce('0x4c')](_0x166a43['id'])){for(var _0x8ea894 in _0x166a43[_0x93ce('0x4d')]){if(_0x166a43[_0x93ce('0x4d')][_0x93ce('0x4c')](_0x8ea894)){if(_0x175e00[_0x93ce('0x42')][_0x166a43['id']][_0x93ce('0x4c')](_0x8ea894+'CurrentCapacity')){_0x175e00['agents'][_0x166a43['id']][_0x8ea894+'CurrentCapacity']=parseInt(_0x166a43[_0x93ce('0x4d')][_0x8ea894],0xa);}}}_0x175e00[_0x93ce('0x42')][_0x166a43['id']]['updateRealtime']();return _0x436129({'code':0xc8,'message':_0x175e00[_0x93ce('0x42')][_0x166a43['id']]});}else{return _0x2c9f78(_0x327652[_0x93ce('0x39')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x516f44){return new Promise(function(_0x20c872){var _0xffed8e=_[_0x93ce('0x4e')](_0x175e00['agents']);if(_0x516f44&&_0x516f44['id']){var _0x5315aa=_['find'](_0xffed8e,function(_0x54c257){return _0x54c257['id']===_0x516f44['id'];});_0x20c872(_0x5315aa);}else{_0x20c872({'count':_0xffed8e['length'],'rows':_0xffed8e});}});},'ChatQueues':function(){return new Promise(function(_0x18249f){var _0x4c1dfd=[];for(var _0xe4e3e4 in _0x175e00[_0x93ce('0x4f')]){if(_0x175e00[_0x93ce('0x4f')][_0x93ce('0x4c')](_0xe4e3e4)){var _0x24aa62=_0x175e00[_0x93ce('0x4f')][_0xe4e3e4];var _0x569b09={'id':_0x24aa62['id'],'available':_0x24aa62[_0x93ce('0x50')],'loggedIn':_0x24aa62[_0x93ce('0x51')],'name':_0x24aa62[_0x93ce('0x52')],'paused':_0x24aa62['paused'],'waiting':_0x24aa62[_0x93ce('0x53')]};_0x4c1dfd[_0x93ce('0x23')](_0x569b09);}}_0x18249f({'count':_0x4c1dfd[_0x93ce('0x1a')],'rows':_0x4c1dfd});});},'MailQueues':function(){return new Promise(function(_0x19fb0b){var _0x3bf707=[];for(var _0x5d20d7 in _0x175e00[_0x93ce('0x54')]){if(_0x175e00[_0x93ce('0x54')]['hasOwnProperty'](_0x5d20d7)){var _0x2b69dd=_0x175e00[_0x93ce('0x54')][_0x5d20d7];var _0xd52fe7={'id':_0x2b69dd['id'],'available':_0x2b69dd[_0x93ce('0x50')],'loggedIn':_0x2b69dd[_0x93ce('0x51')],'name':_0x2b69dd['name'],'paused':_0x2b69dd['paused'],'waiting':_0x2b69dd[_0x93ce('0x53')]};_0x3bf707[_0x93ce('0x23')](_0xd52fe7);}}_0x19fb0b({'count':_0x3bf707[_0x93ce('0x1a')],'rows':_0x3bf707});});},'OpenchannelQueues':function(){return new Promise(function(_0x175f1f){var _0x4a0687=[];for(var _0x191192 in _0x175e00[_0x93ce('0x55')]){if(_0x175e00[_0x93ce('0x55')][_0x93ce('0x4c')](_0x191192)){var _0x1781b8=_0x175e00[_0x93ce('0x55')][_0x191192];var _0x38bdbe={'id':_0x1781b8['id'],'available':_0x1781b8[_0x93ce('0x50')],'loggedIn':_0x1781b8[_0x93ce('0x51')],'name':_0x1781b8['name'],'paused':_0x1781b8[_0x93ce('0x56')],'waiting':_0x1781b8[_0x93ce('0x53')]};_0x4a0687[_0x93ce('0x23')](_0x38bdbe);}}_0x175f1f({'count':_0x4a0687[_0x93ce('0x1a')],'rows':_0x4a0687});});},'SmsQueues':function(){return new Promise(function(_0x3a2b9b){var _0x10ef21=[];for(var _0x467419 in _0x175e00[_0x93ce('0x57')]){if(_0x175e00[_0x93ce('0x57')][_0x93ce('0x4c')](_0x467419)){var _0x4a55cf=_0x175e00[_0x93ce('0x57')][_0x467419];var _0x2da531={'id':_0x4a55cf['id'],'available':_0x4a55cf[_0x93ce('0x50')],'loggedIn':_0x4a55cf[_0x93ce('0x51')],'name':_0x4a55cf[_0x93ce('0x52')],'paused':_0x4a55cf[_0x93ce('0x56')],'waiting':_0x4a55cf['waiting']};_0x10ef21[_0x93ce('0x23')](_0x2da531);}}_0x3a2b9b({'count':_0x10ef21[_0x93ce('0x1a')],'rows':_0x10ef21});});},'FaxQueues':function(){return new Promise(function(_0x27c17e){var _0x3c325b=[];for(var _0x5e121c in _0x175e00['faxQueues']){if(_0x175e00[_0x93ce('0x58')][_0x93ce('0x4c')](_0x5e121c)){var _0x314b5b=_0x175e00[_0x93ce('0x58')][_0x5e121c];var _0x3d06f2={'id':_0x314b5b['id'],'available':_0x314b5b[_0x93ce('0x50')],'loggedIn':_0x314b5b['loggedIn'],'name':_0x314b5b[_0x93ce('0x52')],'paused':_0x314b5b['paused'],'waiting':_0x314b5b[_0x93ce('0x53')]};_0x3c325b[_0x93ce('0x23')](_0x3d06f2);}}_0x27c17e({'count':_0x3c325b[_0x93ce('0x1a')],'rows':_0x3c325b});});},'WhatsappQueues':function(){return new Promise(function(_0x37748b){var _0x1e99d4=[];for(var _0xa7f663 in _0x175e00[_0x93ce('0x59')]){if(_0x175e00['whatsappQueues'][_0x93ce('0x4c')](_0xa7f663)){var _0x230576=_0x175e00['whatsappQueues'][_0xa7f663];var _0x5c4db1={'id':_0x230576['id'],'available':_0x230576[_0x93ce('0x50')],'loggedIn':_0x230576['loggedIn'],'name':_0x230576[_0x93ce('0x52')],'paused':_0x230576[_0x93ce('0x56')],'waiting':_0x230576[_0x93ce('0x53')]};_0x1e99d4['push'](_0x5c4db1);}}_0x37748b({'count':_0x1e99d4[_0x93ce('0x1a')],'rows':_0x1e99d4});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x204eb9){var _0x341850=_[_0x93ce('0x4e')](_0x175e00[_0x93ce('0x5a')]);_0x204eb9({'count':_0x341850[_0x93ce('0x1a')],'rows':_0x341850});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3b70b4){var _0x5b2430=_[_0x93ce('0x4e')](_0x175e00[_0x93ce('0x5b')]);_0x3b70b4({'count':_0x5b2430['length'],'rows':_0x5b2430});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5162a1){var _0x11f6fb=_[_0x93ce('0x4e')](_0x175e00[_0x93ce('0x5c')]);_0x5162a1({'count':_0x11f6fb['length'],'rows':_0x11f6fb});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x6f67bb){var _0x529b67=_['values'](_0x175e00['smsQueuesWaitingInteractions']);_0x6f67bb({'count':_0x529b67['length'],'rows':_0x529b67});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x117cf5){var _0x2613f4=_['values'](_0x175e00[_0x93ce('0x5d')]);_0x117cf5({'count':_0x2613f4[_0x93ce('0x1a')],'rows':_0x2613f4});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x48ee2f){var _0x220b45=_[_0x93ce('0x4e')](_0x175e00[_0x93ce('0x5e')]);_0x48ee2f({'count':_0x220b45['length'],'rows':_0x220b45});});}};var _0x4157d8=jayson[_0x93ce('0x5f')](_0x549f83)['http']();_0x4157d8['on'](_0x93ce('0x39'),function(_0x136af9){logger['error'](JSON[_0x93ce('0x60')](_0x136af9));return _0x3aad5e(_0x136af9);});_0x4157d8[_0x93ce('0x12')](0x232c,_0x93ce('0x61'),function(){console[_0x93ce('0x62')](_0x93ce('0x63'),0x232c);return _0x4a4655(_0x93ce('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c807488..4988ff4 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 _0x5cda=['request','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','then','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','routing','client','http'];(function(_0x5699dd,_0x1d1244){var _0xb60868=function(_0x141966){while(--_0x141966){_0x5699dd['push'](_0x5699dd['shift']());}};_0xb60868(++_0x1d1244);}(_0x5cda,0xe9));var _0xa5cd=function(_0x319a54,_0x518cb9){_0x319a54=_0x319a54-0x0;var _0x2a2caf=_0x5cda[_0x319a54];return _0x2a2caf;};'use strict';var util=require(_0xa5cd('0x0'));var BPromise=require(_0xa5cd('0x1'));var jayson=require(_0xa5cd('0x2'));var _=require(_0xa5cd('0x3'));var logger=require('../../../config/logger')(_0xa5cd('0x4'));var client=jayson[_0xa5cd('0x5')][_0xa5cd('0x6')]({'port':0x232a});function request(_0x16e235,_0x181253){return new BPromise(function(_0x3427ea,_0x208d5e){return client[_0xa5cd('0x7')](_0x16e235,_0x181253)['then'](function(_0xfab420){if(_0xfab420[_0xa5cd('0x8')]){return _0x208d5e(_0xfab420[_0xa5cd('0x8')][_0xa5cd('0x9')]);}else{return _0x3427ea(_0xfab420['result']);}})[_0xa5cd('0xa')](function(_0x923ff4){return _0x208d5e(_0x923ff4);});});}exports['condition']=function(_0x23ac73,_0x5ea947,_0x54fee2){return function(_0x3878d7){if(_0x54fee2[_0xa5cd('0xb')]&&!_0x54fee2[_0xa5cd('0xb')][_0x23ac73]){logger[_0xa5cd('0xc')](_0xa5cd('0xd'),_0x23ac73);return _0x3878d7[_0xa5cd('0xe')]();}var _0x57d394=[];for(var _0x6da564=0x0;_0x6da564<_0x5ea947[_0xa5cd('0xf')];_0x6da564+=0x1){_0x57d394[_0xa5cd('0x10')](request(_0xa5cd('0x11'),{'command':util[_0xa5cd('0x12')](_0xa5cd('0x13'),_0x5ea947[_0x6da564])})[_0xa5cd('0x14')](function(_0x2c84d6){return _0x2c84d6&&_0x2c84d6['message']&&_0x2c84d6[_0xa5cd('0x9')][_0xa5cd('0x15')]('true')>=0x0?!![]:![];})[_0xa5cd('0xa')](function(){logger[_0xa5cd('0x8')](_0xa5cd('0x16'),_0x23ac73,_0x5ea947[_0x6da564]);}));}BPromise[_0xa5cd('0x17')](_0x57d394)[_0xa5cd('0x14')](function(_0x34f18e){var _0x4db486=_[_0xa5cd('0x18')](_0x34f18e);logger[_0xa5cd('0xc')](_0xa5cd('0x19'),_0x23ac73,_0x5ea947[_0xa5cd('0x1a')](_0xa5cd('0x1b')),_0x4db486);_0x3878d7[_0xa5cd('0x1c')](_0x4db486);})[_0xa5cd('0xa')](function(_0x2470b6){logger['error'](_0xa5cd('0x19'),_0x23ac73,_0x5ea947['join']('\x20|\x20'),_0x2470b6[_0xa5cd('0x1d')]);_0x3878d7['stop']();});};}; \ No newline at end of file +var _0xc4cc=['catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','error','message'];(function(_0x32d83d,_0x1aaa1f){var _0xacc348=function(_0xd5609d){while(--_0xd5609d){_0x32d83d['push'](_0x32d83d['shift']());}};_0xacc348(++_0x1aaa1f);}(_0xc4cc,0x86));var _0xcc4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4cc[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xcc4c('0x0'));var BPromise=require(_0xcc4c('0x1'));var jayson=require(_0xcc4c('0x2'));var _=require(_0xcc4c('0x3'));var logger=require(_0xcc4c('0x4'))(_0xcc4c('0x5'));var client=jayson[_0xcc4c('0x6')][_0xcc4c('0x7')]({'port':0x232a});function request(_0x2af69d,_0xe862cd){return new BPromise(function(_0x38e9f5,_0x538d7b){return client[_0xcc4c('0x8')](_0x2af69d,_0xe862cd)['then'](function(_0x2669b7){if(_0x2669b7['error']){return _0x538d7b(_0x2669b7[_0xcc4c('0x9')][_0xcc4c('0xa')]);}else{return _0x38e9f5(_0x2669b7['result']);}})[_0xcc4c('0xb')](function(_0x213c4d){return _0x538d7b(_0x213c4d);});});}exports['condition']=function(_0x39562e,_0x18fc99,_0x25642a){return function(_0x321bae){if(_0x25642a[_0xcc4c('0xc')]&&!_0x25642a[_0xcc4c('0xc')][_0x39562e]){logger[_0xcc4c('0xd')](_0xcc4c('0xe'),_0x39562e);return _0x321bae[_0xcc4c('0xf')]();}var _0x495d82=[];for(var _0x595e21=0x0;_0x595e21<_0x18fc99['length'];_0x595e21+=0x1){_0x495d82[_0xcc4c('0x10')](request('Command',{'command':util[_0xcc4c('0x11')]('iftime\x20%s',_0x18fc99[_0x595e21])})[_0xcc4c('0x12')](function(_0xea2b2a){return _0xea2b2a&&_0xea2b2a[_0xcc4c('0xa')]&&_0xea2b2a[_0xcc4c('0xa')][_0xcc4c('0x13')](_0xcc4c('0x14'))>=0x0?!![]:![];})[_0xcc4c('0xb')](function(){logger[_0xcc4c('0x9')](_0xcc4c('0x15'),_0x39562e,_0x18fc99[_0x595e21]);}));}BPromise[_0xcc4c('0x16')](_0x495d82)['then'](function(_0x6450a0){var _0x4dd8e3=_[_0xcc4c('0x17')](_0x6450a0);logger[_0xcc4c('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x39562e,_0x18fc99[_0xcc4c('0x18')](_0xcc4c('0x19')),_0x4dd8e3);_0x321bae[_0xcc4c('0x1a')](_0x4dd8e3);})['catch'](function(_0x1de4c3){logger[_0xcc4c('0x9')](_0xcc4c('0x1b'),_0x39562e,_0x18fc99[_0xcc4c('0x18')](_0xcc4c('0x19')),_0x1de4c3[_0xcc4c('0x1c')]);_0x321bae['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 90ec56e..5c4c691 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 _0x9354=['agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','transfer','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x338bb1,_0x42f96e){var _0x4de306=function(_0x49e0ec){while(--_0x49e0ec){_0x338bb1['push'](_0x338bb1['shift']());}};_0x4de306(++_0x42f96e);}(_0x9354,0x96));var _0x4935=function(_0x4b8ecc,_0x4cd01c){_0x4b8ecc=_0x4b8ecc-0x0;var _0x48c1b9=_0x9354[_0x4b8ecc];return _0x48c1b9;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var utils=require(_0x4935('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4896da,_0x263dd5){utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x4'),_0x4896da['uniqueid'],_0x4896da[_0x4935('0x5')],_0x4896da[_0x4935('0x6')],_0x4896da[_0x4935('0x7')],_0x4896da[_0x4935('0x8')],_0x4896da[_0x4935('0x9')],_0x4896da[_0x4935('0xa')],_0x4896da[_0x4935('0xb')]));if(_0x4896da[_0x4935('0x6')]){utils[_0x4935('0xc')](_0x4896da['queue'])[_0x4935('0xd')](function(_0x47a44f){if(_0x47a44f){_0x4896da[_0x4935('0xe')]=_0x47a44f[_0x4935('0xe')];_0x4896da[_0x4935('0xf')]=_0x4896da[_0x4935('0x10')]?_0x47a44f[_0x4935('0x11')]:![];_0x4896da[_0x4935('0x12')]=_0x4896da['agentacw']?_0x47a44f['acwTimeout']:0x0;}utils[_0x4935('0x13')]('CreateVoiceAgentReport',_0x4896da);});}else{utils['request'](_0x4935('0x14'),_0x4896da);}if(_0x263dd5){delete transfers[_0x4896da[_0x4935('0x15')]];}else{delete agents[_0x4896da[_0x4935('0x16')]];}}exports[_0x4935('0x17')]=function(_0x3b246a){try{utils[_0x4935('0x18')](util[_0x4935('0x3')](_0x4935('0x19'),_0x3b246a[_0x4935('0x15')]),_0x3b246a);agents[_0x3b246a[_0x4935('0x16')]]=_0x3b246a;agents[_0x3b246a[_0x4935('0x16')]][_0x4935('0x1a')]=utils[_0x4935('0x1b')]();agents[_0x3b246a[_0x4935('0x16')]][_0x4935('0xb')]=_0x4935('0x1c');agents[_0x3b246a['destuniqueid']][_0x4935('0xa')]=null;agents[_0x3b246a[_0x4935('0x16')]][_0x4935('0x1d')]=null;utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x1e'),_0x3b246a['uniqueid'],agents[_0x3b246a[_0x4935('0x16')]][_0x4935('0x7')],_0x3b246a['destuniqueid']));}catch(_0x288eff){utils[_0x4935('0x1f')](util[_0x4935('0x3')]('[%s][agents][agentcalled]',_0x3b246a['uniqueid']),_0x288eff);}};exports[_0x4935('0x20')]=function(_0x6b849f){try{if(!_[_0x4935('0x21')](agents[_0x6b849f[_0x4935('0x16')]])){utils[_0x4935('0x18')](util[_0x4935('0x3')](_0x4935('0x22'),_0x6b849f[_0x4935('0x15')]),_0x6b849f);utils['info'](util[_0x4935('0x3')](_0x4935('0x23'),_0x6b849f[_0x4935('0x15')],agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0x7')],_0x6b849f['destuniqueid']));agents[_0x6b849f['destuniqueid']][_0x4935('0x20')]=!![];agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0x24')]=utils[_0x4935('0x1b')]();agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0xb')]=_0x4935('0x25');agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0x26')]=_0x4935('0x25');agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0x27')]=_0x6b849f[_0x4935('0x28')]?parseInt(_0x6b849f[_0x4935('0x28')])/0x3e8:0x0;agents[_0x6b849f[_0x4935('0x16')]]['talktime']=0x0;unanswered['push'](_0x6b849f['destuniqueid']);}}catch(_0x1fc218){utils[_0x4935('0x1f')](util['format'](_0x4935('0x22'),_0x6b849f[_0x4935('0x15')]),_0x1fc218);}};exports[_0x4935('0x29')]=function(_0x9fe9f6){try{_[_0x4935('0x2a')](agents,function(_0x24262e,_0x28afc2){if(_0x24262e[_0x4935('0x15')]==_0x9fe9f6['uniqueid']&&!_[_0x4935('0x2b')](unanswered,_0x24262e[_0x4935('0x16')])){utils['debug'](util['format'](_0x4935('0x2c'),_0x9fe9f6['uniqueid']),_0x9fe9f6);utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x2d'),_0x9fe9f6['uniqueid'],_0x24262e['membername'],_0x24262e[_0x4935('0x16')]));_0x24262e[_0x4935('0x20')]=!![];_0x24262e['agentringnoanswerAt']=utils[_0x4935('0x1b')]();_0x24262e[_0x4935('0xb')]=_0x4935('0x2e');_0x24262e[_0x4935('0x26')]=_0x4935('0x2e');_0x24262e['holdtime']=_0x9fe9f6['holdtime'];_0x24262e[_0x4935('0x2f')]=0x0;writeDB(_0x24262e);}});}catch(_0x1016cc){utils['error'](util['format'](_0x4935('0x2c'),_0x9fe9f6['uniqueid']),_0x1016cc);}};exports[_0x4935('0x30')]=function(_0x3f32fb){try{if(agents[_0x3f32fb[_0x4935('0x16')]]){utils[_0x4935('0x18')](util[_0x4935('0x3')](_0x4935('0x31'),_0x3f32fb['uniqueid']),_0x3f32fb);utils[_0x4935('0x2')](util['format'](_0x4935('0x32'),_0x3f32fb['uniqueid'],agents[_0x3f32fb[_0x4935('0x16')]]['membername'],_0x3f32fb[_0x4935('0x16')]));agents[_0x3f32fb[_0x4935('0x16')]][_0x4935('0x33')]=utils[_0x4935('0x1b')]();agents[_0x3f32fb[_0x4935('0x16')]][_0x4935('0xa')]=_0x3f32fb[_0x4935('0xa')];agents[_0x3f32fb['destuniqueid']]['connectedlinename']=_0x3f32fb[_0x4935('0x1d')];agents[_0x3f32fb['destuniqueid']]['holdtime']=_0x3f32fb[_0x4935('0x28')];agents[_0x3f32fb['destuniqueid']][_0x4935('0xb')]=_0x4935('0x34');_[_0x4935('0x2a')](agents,function(_0x99b7c5,_0xb366e6){if(_0x99b7c5['destuniqueid']!=_0x3f32fb['destuniqueid']&&_0x99b7c5[_0x4935('0x15')]==_0x3f32fb[_0x4935('0x15')]){_0x99b7c5[_0x4935('0x2f')]=0x0;_0x99b7c5[_0x4935('0x27')]=_0x3f32fb[_0x4935('0x28')];_0x99b7c5[_0x4935('0x20')]=!![];_0x99b7c5[_0x4935('0x24')]=utils[_0x4935('0x1b')]();_0x99b7c5['lastevent']='answered_elsewhere';_0x99b7c5[_0x4935('0x26')]=_0x4935('0x35');_0x99b7c5['answeredelsewheredestinationuniqueid']=_0x3f32fb[_0x4935('0x16')];_0x99b7c5[_0x4935('0x36')]=_0x3f32fb[_0x4935('0x7')];writeDB(_0x99b7c5);}});}}catch(_0xe5c9f5){utils['error'](util['format'](_0x4935('0x31'),_0x3f32fb[_0x4935('0x15')]),_0xe5c9f5);}};exports['agentcomplete']=function(_0x1eaa47){try{if(!_[_0x4935('0x21')](agents[_0x1eaa47[_0x4935('0x16')]])){utils['debug'](util[_0x4935('0x3')](_0x4935('0x37'),_0x1eaa47[_0x4935('0x15')]),_0x1eaa47);utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x38'),_0x1eaa47[_0x4935('0x15')],agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x7')],_0x1eaa47[_0x4935('0x16')]));agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x10')]=!![];agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x39')]=utils[_0x4935('0x1b')]();agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x2f')]=utils[_0x4935('0x3a')](agents[_0x1eaa47['destuniqueid']][_0x4935('0x39')],agents[_0x1eaa47['destuniqueid']][_0x4935('0x33')]);agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x26')]=_0x1eaa47[_0x4935('0x26')];agents[_0x1eaa47['destuniqueid']][_0x4935('0xb')]=_0x4935('0x3b');writeDB(agents[_0x1eaa47[_0x4935('0x16')]]);}}catch(_0xa55ce1){utils[_0x4935('0x1f')](util[_0x4935('0x3')](_0x4935('0x37'),_0x1eaa47[_0x4935('0x15')]),_0xa55ce1);}};exports[_0x4935('0x3c')]=function(_0x392cba){try{if(!_['isNil'](agents[_0x392cba[_0x4935('0x3d')]])){utils[_0x4935('0x18')](util['format'](_0x4935('0x3e'),_0x392cba[_0x4935('0x15')]),_0x392cba);utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x3f'),_0x392cba[_0x4935('0x15')],agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x7')],agents[_0x392cba['transfereruniqueid']][_0x4935('0x15')]));agents[_0x392cba['transfereruniqueid']]['transfer']=!![];agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x40')]=_0x4935('0x41');agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x42')]=_0x392cba['extension'];agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x43')]=agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x15')];}}catch(_0x377ff4){utils[_0x4935('0x1f')](util[_0x4935('0x3')](_0x4935('0x3e'),_0x392cba[_0x4935('0x15')]),_0x377ff4);}};exports[_0x4935('0x44')]=function(_0x4c1fb4){try{utils[_0x4935('0x18')](util['format'](_0x4935('0x45'),_0x4c1fb4[_0x4935('0x46')]),_0x4c1fb4);if(_0x4c1fb4['origtransfereruniqueid']==_0x4c1fb4[_0x4935('0x47')]){if(!_['isNil'](agents[_0x4c1fb4['secondtransfereruniqueid']])){utils['info'](util[_0x4935('0x3')](_0x4935('0x48'),_0x4c1fb4[_0x4935('0x46')],agents[_0x4c1fb4[_0x4935('0x49')]][_0x4935('0x7')]));agents[_0x4c1fb4['secondtransfereruniqueid']]['transfer']=!![];agents[_0x4c1fb4[_0x4935('0x49')]][_0x4935('0x40')]=_0x4935('0x4a');agents[_0x4c1fb4['secondtransfereruniqueid']][_0x4935('0x42')]=_0x4c1fb4[_0x4935('0x4b')];agents[_0x4c1fb4[_0x4935('0x49')]][_0x4935('0x43')]=_0x4c1fb4['origtransfereruniqueid'];}if(_0x4c1fb4[_0x4935('0x4c')]&&agents[_0x4c1fb4['transfereeuniqueid']]){agents[_0x4c1fb4['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x4c1fb4[_0x4935('0x4c')]]=_[_0x4935('0x4d')](agents[_0x4c1fb4['transfereeuniqueid']]);transfers[_0x4c1fb4[_0x4935('0x4c')]][_0x4935('0x9')]=agents[_0x4c1fb4['secondtransfereruniqueid']][_0x4935('0x9')];transfers[_0x4c1fb4[_0x4935('0x4c')]][_0x4935('0x4e')]=agents[_0x4c1fb4[_0x4935('0x49')]][_0x4935('0x4e')];transfers[_0x4c1fb4[_0x4935('0x4c')]][_0x4935('0x1a')]=utils['now']();transfers[_0x4c1fb4[_0x4935('0x4c')]]['agentconnectAt']=utils['now']();transfers[_0x4c1fb4[_0x4935('0x4c')]][_0x4935('0x27')]=0x0;transfers[_0x4c1fb4['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x4c1fb4[_0x4935('0x49')]==_0x4c1fb4[_0x4935('0x4f')]){if(!_[_0x4935('0x21')](agents[_0x4c1fb4['origtransfereruniqueid']])){utils[_0x4935('0x2')](util['format'](_0x4935('0x48'),_0x4c1fb4[_0x4935('0x46')],agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x7')]));agents[_0x4c1fb4[_0x4935('0x46')]]['transfer']=!![];agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x40')]='ATTENDED';agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x42')]=_0x4c1fb4[_0x4935('0x50')];agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x43')]=_0x4c1fb4[_0x4935('0x49')];}if(_0x4c1fb4[_0x4935('0x51')]&&agents[_0x4c1fb4[_0x4935('0x51')]]){agents[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x52')]=0x1;transfers[_0x4c1fb4[_0x4935('0x51')]]=_['clone'](agents[_0x4c1fb4[_0x4935('0x51')]]);transfers[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x9')]=agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x9')];transfers[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x4e')]=agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x4e')];transfers[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x1a')]=utils[_0x4935('0x1b')]();transfers[_0x4c1fb4[_0x4935('0x51')]]['agentconnectAt']=utils['now']();transfers[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x27')]=0x0;transfers[_0x4c1fb4['transfertargetuniqueid']][_0x4935('0x52')]=0x2;}}}catch(_0x30e77f){utils['error'](util['format'](_0x4935('0x45'),_0x4c1fb4[_0x4935('0x46')]),_0x30e77f);}};exports[_0x4935('0x53')]=function(_0x2abd63){try{utils[_0x4935('0x18')](util['format'](_0x4935('0x54'),_0x2abd63[_0x4935('0x15')]),_0x2abd63);if(agents[_0x2abd63[_0x4935('0x15')]]&&agents[_0x2abd63[_0x4935('0x15')]]['reason']===_0x4935('0x25')){if(_0x2abd63['cause']==='21'){agents[_0x2abd63['uniqueid']][_0x4935('0x26')]=_0x4935('0x55');agents[_0x2abd63['uniqueid']][_0x4935('0xb')]=_0x4935('0x55');}utils[_0x4935('0x2')](util['format'](_0x4935('0x56'),_0x2abd63['uniqueid'],agents[_0x2abd63['uniqueid']][_0x4935('0x7')],agents[_0x2abd63[_0x4935('0x15')]][_0x4935('0x26')],agents[_0x2abd63[_0x4935('0x15')]][_0x4935('0xb')]));writeDB(agents[_0x2abd63[_0x4935('0x15')]]);var _0x2eae00=unanswered[_0x4935('0x57')](_0x2abd63['uniqueid']);if(_0x2eae00>-0x1){unanswered[_0x4935('0x58')](_0x2eae00,0x1);}}if(transfers[_0x2abd63[_0x4935('0x15')]]){transfers[_0x2abd63[_0x4935('0x15')]]['agentcomplete']=!![];transfers[_0x2abd63['uniqueid']][_0x4935('0x39')]=utils[_0x4935('0x1b')]();transfers[_0x2abd63['uniqueid']][_0x4935('0x2f')]=utils['diffTime'](transfers[_0x2abd63['uniqueid']][_0x4935('0x39')],transfers[_0x2abd63[_0x4935('0x15')]][_0x4935('0x33')]);transfers[_0x2abd63['uniqueid']]['reason']=_0x4935('0x59');transfers[_0x2abd63['uniqueid']][_0x4935('0xb')]='complete';utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x56'),_0x2abd63[_0x4935('0x15')],transfers[_0x2abd63[_0x4935('0x15')]][_0x4935('0x7')],transfers[_0x2abd63[_0x4935('0x15')]]['reason'],transfers[_0x2abd63[_0x4935('0x15')]]['lastevent']));writeDB(transfers[_0x2abd63[_0x4935('0x15')]],!![]);}if(agents[_0x2abd63[_0x4935('0x15')]]&&agents[_0x2abd63['uniqueid']][_0x4935('0x33')]){agents[_0x2abd63['uniqueid']][_0x4935('0x10')]=!![];agents[_0x2abd63[_0x4935('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x2abd63['uniqueid']][_0x4935('0x2f')]=utils['diffTime'](agents[_0x2abd63['uniqueid']][_0x4935('0x39')],agents[_0x2abd63['uniqueid']][_0x4935('0x33')]);agents[_0x2abd63['uniqueid']]['reason']=agents[_0x2abd63['uniqueid']][_0x4935('0x5a')]?'transfer':_0x4935('0x59');agents[_0x2abd63[_0x4935('0x15')]][_0x4935('0xb')]=_0x4935('0x3b');utils[_0x4935('0x2')](util['format'](_0x4935('0x56'),_0x2abd63[_0x4935('0x15')],agents[_0x2abd63['uniqueid']][_0x4935('0x7')],agents[_0x2abd63[_0x4935('0x15')]]['reason'],agents[_0x2abd63[_0x4935('0x15')]][_0x4935('0xb')]));writeDB(agents[_0x2abd63['uniqueid']]);}}catch(_0x390767){utils['error'](util[_0x4935('0x3')](_0x4935('0x54'),_0x2abd63['uniqueid']),_0x390767);}}; \ No newline at end of file +var _0xb688=['agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','util','./utils','info','format','uniqueid','channel','queue','membername','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','reason','talktime','[%s][agents][queuecallerabandon]'];(function(_0x4eb4fe,_0x296c34){var _0x576eac=function(_0x407be8){while(--_0x407be8){_0x4eb4fe['push'](_0x4eb4fe['shift']());}};_0x576eac(++_0x296c34);}(_0xb688,0xcf));var _0x8b68=function(_0x419b1f,_0x4e428a){_0x419b1f=_0x419b1f-0x0;var _0x562ff3=_0xb688[_0x419b1f];return _0x562ff3;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var utils=require(_0x8b68('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x266285,_0x1080e8){utils[_0x8b68('0x2')](util[_0x8b68('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x266285[_0x8b68('0x4')],_0x266285[_0x8b68('0x5')],_0x266285[_0x8b68('0x6')],_0x266285[_0x8b68('0x7')],_0x266285['interface'],_0x266285[_0x8b68('0x8')],_0x266285['connectedlinenum'],_0x266285[_0x8b68('0x9')]));if(_0x266285[_0x8b68('0x6')]){utils[_0x8b68('0xa')](_0x266285[_0x8b68('0x6')])[_0x8b68('0xb')](function(_0x3f9685){if(_0x3f9685){_0x266285[_0x8b68('0xc')]=_0x3f9685[_0x8b68('0xc')];_0x266285[_0x8b68('0xd')]=_0x266285[_0x8b68('0xe')]?_0x3f9685[_0x8b68('0xf')]:![];_0x266285[_0x8b68('0x10')]=_0x266285[_0x8b68('0xd')]?_0x3f9685['acwTimeout']:0x0;}utils[_0x8b68('0x11')](_0x8b68('0x12'),_0x266285);});}else{utils[_0x8b68('0x11')](_0x8b68('0x12'),_0x266285);}if(_0x1080e8){delete transfers[_0x266285[_0x8b68('0x4')]];}else{delete agents[_0x266285[_0x8b68('0x13')]];}}exports[_0x8b68('0x14')]=function(_0x137c8e){try{utils[_0x8b68('0x15')](util['format'](_0x8b68('0x16'),_0x137c8e['uniqueid']),_0x137c8e);agents[_0x137c8e['destuniqueid']]=_0x137c8e;agents[_0x137c8e[_0x8b68('0x13')]][_0x8b68('0x17')]=utils[_0x8b68('0x18')]();agents[_0x137c8e['destuniqueid']]['lastevent']=_0x8b68('0x19');agents[_0x137c8e['destuniqueid']][_0x8b68('0x1a')]=null;agents[_0x137c8e[_0x8b68('0x13')]][_0x8b68('0x1b')]=null;utils[_0x8b68('0x2')](util['format'](_0x8b68('0x1c'),_0x137c8e[_0x8b68('0x4')],agents[_0x137c8e['destuniqueid']][_0x8b68('0x7')],_0x137c8e[_0x8b68('0x13')]));}catch(_0x3cf3bd){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')]('[%s][agents][agentcalled]',_0x137c8e[_0x8b68('0x4')]),_0x3cf3bd);}};exports[_0x8b68('0x1e')]=function(_0x59e9b1){try{if(!_[_0x8b68('0x1f')](agents[_0x59e9b1[_0x8b68('0x13')]])){utils[_0x8b68('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x59e9b1[_0x8b68('0x4')]),_0x59e9b1);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x20'),_0x59e9b1[_0x8b68('0x4')],agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x7')],_0x59e9b1[_0x8b68('0x13')]));agents[_0x59e9b1['destuniqueid']][_0x8b68('0x1e')]=!![];agents[_0x59e9b1[_0x8b68('0x13')]]['agentringnoanswerAt']=utils[_0x8b68('0x18')]();agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x9')]='timeout';agents[_0x59e9b1['destuniqueid']]['reason']=_0x8b68('0x21');agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x22')]=_0x59e9b1['ringtime']?parseInt(_0x59e9b1[_0x8b68('0x23')])/0x3e8:0x0;agents[_0x59e9b1['destuniqueid']]['talktime']=0x0;unanswered[_0x8b68('0x24')](_0x59e9b1['destuniqueid']);}}catch(_0x26cad7){utils[_0x8b68('0x1d')](util['format']('[%s][agents][agentringnoanswer]',_0x59e9b1[_0x8b68('0x4')]),_0x26cad7);}};exports[_0x8b68('0x25')]=function(_0x1e7c06){try{_[_0x8b68('0x26')](agents,function(_0x210926,_0x2ad2df){if(_0x210926[_0x8b68('0x4')]==_0x1e7c06['uniqueid']&&!_[_0x8b68('0x27')](unanswered,_0x210926['destuniqueid'])){utils[_0x8b68('0x15')](util[_0x8b68('0x3')]('[%s][agents][queuecallerabandon]',_0x1e7c06[_0x8b68('0x4')]),_0x1e7c06);utils[_0x8b68('0x2')](util[_0x8b68('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1e7c06['uniqueid'],_0x210926[_0x8b68('0x7')],_0x210926[_0x8b68('0x13')]));_0x210926[_0x8b68('0x1e')]=!![];_0x210926[_0x8b68('0x28')]=utils[_0x8b68('0x18')]();_0x210926[_0x8b68('0x9')]=_0x8b68('0x29');_0x210926[_0x8b68('0x2a')]=_0x8b68('0x29');_0x210926[_0x8b68('0x22')]=_0x1e7c06[_0x8b68('0x22')];_0x210926[_0x8b68('0x2b')]=0x0;writeDB(_0x210926);}});}catch(_0x232fa9){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')](_0x8b68('0x2c'),_0x1e7c06[_0x8b68('0x4')]),_0x232fa9);}};exports[_0x8b68('0x2d')]=function(_0x120b34){try{if(agents[_0x120b34[_0x8b68('0x13')]]){utils[_0x8b68('0x15')](util[_0x8b68('0x3')]('[%s][agents][agentconnect]',_0x120b34['uniqueid']),_0x120b34);utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x2e'),_0x120b34[_0x8b68('0x4')],agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x7')],_0x120b34[_0x8b68('0x13')]));agents[_0x120b34[_0x8b68('0x13')]]['agentconnectAt']=utils[_0x8b68('0x18')]();agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x1a')]=_0x120b34[_0x8b68('0x1a')];agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x1b')]=_0x120b34[_0x8b68('0x1b')];agents[_0x120b34[_0x8b68('0x13')]]['holdtime']=_0x120b34[_0x8b68('0x23')];agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x9')]=_0x8b68('0x2f');_[_0x8b68('0x26')](agents,function(_0x3b3394,_0xa748c2){if(_0x3b3394['destuniqueid']!=_0x120b34[_0x8b68('0x13')]&&_0x3b3394[_0x8b68('0x4')]==_0x120b34['uniqueid']){_0x3b3394[_0x8b68('0x2b')]=0x0;_0x3b3394[_0x8b68('0x22')]=_0x120b34['ringtime'];_0x3b3394['agentringnoanswer']=!![];_0x3b3394['agentringnoanswerAt']=utils['now']();_0x3b3394[_0x8b68('0x9')]=_0x8b68('0x30');_0x3b3394['reason']=_0x8b68('0x30');_0x3b3394['answeredelsewheredestinationuniqueid']=_0x120b34[_0x8b68('0x13')];_0x3b3394[_0x8b68('0x31')]=_0x120b34['membername'];writeDB(_0x3b3394);}});}}catch(_0x2f90d9){utils['error'](util['format']('[%s][agents][agentconnect]',_0x120b34[_0x8b68('0x4')]),_0x2f90d9);}};exports[_0x8b68('0xe')]=function(_0x3ba80e){try{if(!_[_0x8b68('0x1f')](agents[_0x3ba80e['destuniqueid']])){utils[_0x8b68('0x15')](util['format'](_0x8b68('0x32'),_0x3ba80e[_0x8b68('0x4')]),_0x3ba80e);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x33'),_0x3ba80e[_0x8b68('0x4')],agents[_0x3ba80e[_0x8b68('0x13')]]['membername'],_0x3ba80e[_0x8b68('0x13')]));agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0xe')]=!![];agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x34')],agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x36')]);agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x2a')]=_0x3ba80e[_0x8b68('0x2a')];agents[_0x3ba80e['destuniqueid']][_0x8b68('0x9')]=_0x8b68('0x37');writeDB(agents[_0x3ba80e['destuniqueid']]);}}catch(_0xeab810){utils['error'](util['format']('[%s][agents][agentcomplete]',_0x3ba80e[_0x8b68('0x4')]),_0xeab810);}};exports[_0x8b68('0x38')]=function(_0x34047c){try{if(!_[_0x8b68('0x1f')](agents[_0x34047c['transfereruniqueid']])){utils['debug'](util[_0x8b68('0x3')](_0x8b68('0x39'),_0x34047c[_0x8b68('0x4')]),_0x34047c);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x3a'),_0x34047c['uniqueid'],agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x7')],agents[_0x34047c['transfereruniqueid']][_0x8b68('0x4')]));agents[_0x34047c[_0x8b68('0x3b')]]['transfer']=!![];agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x3c')]='blind';agents[_0x34047c['transfereruniqueid']]['transferexten']=_0x34047c[_0x8b68('0x3d')];agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x3e')]=agents[_0x34047c[_0x8b68('0x3b')]]['uniqueid'];}}catch(_0x5a1711){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')](_0x8b68('0x39'),_0x34047c['uniqueid']),_0x5a1711);}};exports[_0x8b68('0x3f')]=function(_0xe1ba20){try{utils[_0x8b68('0x15')](util['format'](_0x8b68('0x40'),_0xe1ba20['origtransfereruniqueid']),_0xe1ba20);if(_0xe1ba20[_0x8b68('0x41')]==_0xe1ba20[_0x8b68('0x42')]){if(!_['isNil'](agents[_0xe1ba20[_0x8b68('0x43')]])){utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x44'),_0xe1ba20[_0x8b68('0x41')],agents[_0xe1ba20['secondtransfereruniqueid']][_0x8b68('0x7')]));agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x45')]=!![];agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x3c')]=_0x8b68('0x46');agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x47')]=_0xe1ba20['origtransfererexten'];agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x3e')]=_0xe1ba20[_0x8b68('0x41')];}if(_0xe1ba20[_0x8b68('0x48')]&&agents[_0xe1ba20[_0x8b68('0x48')]]){agents[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x49')]=0x1;transfers[_0xe1ba20[_0x8b68('0x48')]]=_[_0x8b68('0x4a')](agents[_0xe1ba20[_0x8b68('0x48')]]);transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x8')]=agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x8')];transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x4b')]=agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x4b')];transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x17')]=utils['now']();transfers[_0xe1ba20[_0x8b68('0x48')]]['agentconnectAt']=utils['now']();transfers[_0xe1ba20[_0x8b68('0x48')]]['holdtime']=0x0;transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x49')]=0x2;}}else if(_0xe1ba20[_0x8b68('0x43')]==_0xe1ba20['secondtransfererlinkedid']){if(!_[_0x8b68('0x1f')](agents[_0xe1ba20[_0x8b68('0x41')]])){utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x44'),_0xe1ba20[_0x8b68('0x41')],agents[_0xe1ba20[_0x8b68('0x41')]]['membername']));agents[_0xe1ba20['origtransfereruniqueid']][_0x8b68('0x45')]=!![];agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x3c')]=_0x8b68('0x46');agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x47')]=_0xe1ba20[_0x8b68('0x4c')];agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x3e')]=_0xe1ba20[_0x8b68('0x43')];}if(_0xe1ba20[_0x8b68('0x4d')]&&agents[_0xe1ba20[_0x8b68('0x4d')]]){agents[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x49')]=0x1;transfers[_0xe1ba20[_0x8b68('0x4d')]]=_[_0x8b68('0x4a')](agents[_0xe1ba20[_0x8b68('0x4d')]]);transfers[_0xe1ba20[_0x8b68('0x4d')]]['calleridnum']=agents[_0xe1ba20['origtransfereruniqueid']][_0x8b68('0x8')];transfers[_0xe1ba20[_0x8b68('0x4d')]]['calleridname']=agents[_0xe1ba20['origtransfereruniqueid']]['calleridname'];transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x17')]=utils[_0x8b68('0x18')]();transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x36')]=utils['now']();transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x22')]=0x0;transfers[_0xe1ba20['transfertargetuniqueid']][_0x8b68('0x49')]=0x2;}}}catch(_0x5aa883){utils['error'](util['format'](_0x8b68('0x40'),_0xe1ba20[_0x8b68('0x41')]),_0x5aa883);}};exports[_0x8b68('0x4e')]=function(_0x7269fd){try{utils[_0x8b68('0x15')](util[_0x8b68('0x3')](_0x8b68('0x4f'),_0x7269fd[_0x8b68('0x4')]),_0x7269fd);if(agents[_0x7269fd[_0x8b68('0x4')]]&&agents[_0x7269fd[_0x8b68('0x4')]]['reason']===_0x8b68('0x21')){if(_0x7269fd[_0x8b68('0x50')]==='21'){agents[_0x7269fd[_0x8b68('0x4')]]['reason']='rejected';agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]='rejected';}utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x51'),_0x7269fd[_0x8b68('0x4')],agents[_0x7269fd['uniqueid']][_0x8b68('0x7')],agents[_0x7269fd['uniqueid']]['reason'],agents[_0x7269fd[_0x8b68('0x4')]]['lastevent']));writeDB(agents[_0x7269fd[_0x8b68('0x4')]]);var _0x385eda=unanswered['indexOf'](_0x7269fd[_0x8b68('0x4')]);if(_0x385eda>-0x1){unanswered[_0x8b68('0x52')](_0x385eda,0x1);}}if(transfers[_0x7269fd[_0x8b68('0x4')]]){transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0xe')]=!![];transfers[_0x7269fd['uniqueid']][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](transfers[_0x7269fd['uniqueid']]['agentcompleteAt'],transfers[_0x7269fd[_0x8b68('0x4')]]['agentconnectAt']);transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')]=_0x8b68('0x53');transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]=_0x8b68('0x37');utils[_0x8b68('0x2')](util['format'](_0x8b68('0x51'),_0x7269fd['uniqueid'],transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x7')],transfers[_0x7269fd[_0x8b68('0x4')]]['reason'],transfers[_0x7269fd[_0x8b68('0x4')]]['lastevent']));writeDB(transfers[_0x7269fd[_0x8b68('0x4')]],!![]);}if(agents[_0x7269fd['uniqueid']]&&agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x36')]){agents[_0x7269fd[_0x8b68('0x4')]]['agentcomplete']=!![];agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x34')],agents[_0x7269fd[_0x8b68('0x4')]]['agentconnectAt']);agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')]=agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x45')]?_0x8b68('0x45'):'agent';agents[_0x7269fd[_0x8b68('0x4')]]['lastevent']=_0x8b68('0x37');utils[_0x8b68('0x2')](util['format'](_0x8b68('0x51'),_0x7269fd[_0x8b68('0x4')],agents[_0x7269fd[_0x8b68('0x4')]]['membername'],agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')],agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]));writeDB(agents[_0x7269fd[_0x8b68('0x4')]]);}}catch(_0x42464c){utils['error'](util[_0x8b68('0x3')](_0x8b68('0x4f'),_0x7269fd[_0x8b68('0x4')]),_0x42464c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 496df5a..ab0c1a8 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 _0x9e13=['format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed'];(function(_0x172856,_0x13bc1f){var _0xc158fc=function(_0x2df1bf){while(--_0x2df1bf){_0x172856['push'](_0x172856['shift']());}};_0xc158fc(++_0x13bc1f);}(_0x9e13,0x190));var _0x39e1=function(_0x3e37ed,_0x373d5a){_0x3e37ed=_0x3e37ed-0x0;var _0x432e99=_0x9e13[_0x3e37ed];return _0x432e99;};'use strict';var _=require(_0x39e1('0x0'));var util=require(_0x39e1('0x1'));var utils=require(_0x39e1('0x2'));var dispositions=[_0x39e1('0x3'),_0x39e1('0x4'),_0x39e1('0x4'),'NO\x20ANSWER',_0x39e1('0x3'),_0x39e1('0x3'),'ANSWERED','BUSY',_0x39e1('0x4'),_0x39e1('0x4'),'FAILED'];var channels={};function writeDB(_0x5e49a8){utils[_0x39e1('0x5')](util['format'](_0x39e1('0x6'),_0x5e49a8[_0x39e1('0x7')],_0x5e49a8[_0x39e1('0x8')],_0x5e49a8[_0x39e1('0x9')],_0x5e49a8[_0x39e1('0xa')],_0x5e49a8[_0x39e1('0xb')],_0x5e49a8[_0x39e1('0xc')],_0x5e49a8[_0x39e1('0xd')],_0x5e49a8['lastevent']));if(_0x5e49a8[_0x39e1('0xe')]){utils[_0x39e1('0xf')](_0x5e49a8[_0x39e1('0xe')])[_0x39e1('0x10')](function(_0x2cdffa){if(_0x2cdffa){_0x5e49a8[_0x39e1('0x11')]=_0x2cdffa['id'];}utils[_0x39e1('0x12')]('CreateVoiceCallReport',_0x5e49a8);});}else{utils[_0x39e1('0x12')]('CreateVoiceCallReport',_0x5e49a8);}if(channels[_0x5e49a8[_0x39e1('0x7')]]){delete channels[_0x5e49a8[_0x39e1('0x7')]];}}exports[_0x39e1('0x13')]=function(_0x540b98){try{utils[_0x39e1('0x14')](util['format'](_0x39e1('0x15'),_0x540b98[_0x39e1('0x7')]),_0x540b98);if(_0x540b98[_0x39e1('0x7')]==_0x540b98[_0x39e1('0x16')]&&_0x540b98[_0x39e1('0x8')]!=_0x39e1('0x17')){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x19'),_0x540b98['uniqueid'],_0x540b98[_0x39e1('0x1a')],_0x540b98[_0x39e1('0x1b')]));channels[_0x540b98[_0x39e1('0x7')]]={'uniqueid':_0x540b98[_0x39e1('0x7')],'accountcode':_0x540b98[_0x39e1('0xe')],'source':_0x540b98[_0x39e1('0xc')],'destination':_0x540b98['exten'],'destinationcontext':_0x540b98[_0x39e1('0x1a')],'channel':_0x540b98['channel'],'starttime':utils[_0x39e1('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x39e1('0x3'),'amaflags':_0x39e1('0x1d')};}}catch(_0x43ee6f){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')](_0x39e1('0x15'),_0x540b98[_0x39e1('0x7')]),_0x43ee6f);}};exports[_0x39e1('0x1f')]=function(_0x58903f){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x58903f[_0x39e1('0x7')]),_0x58903f);if(!_[_0x39e1('0x20')](channels[_0x58903f[_0x39e1('0x7')]])&&_0x58903f[_0x39e1('0x21')]==0x6){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x22'),_0x58903f[_0x39e1('0x7')],_0x58903f[_0x39e1('0x1a')],_0x58903f[_0x39e1('0x8')]));if(_[_0x39e1('0x20')](channels[_0x58903f['uniqueid']][_0x39e1('0x23')])){channels[_0x58903f['uniqueid']]['systemanswertime']=utils[_0x39e1('0x1c')]();}}else if(!_[_0x39e1('0x20')](channels[_0x58903f['linkedid']])&&_0x58903f[_0x39e1('0x21')]==0x6&&_0x58903f[_0x39e1('0x1a')]!='transfer'){utils['info'](util[_0x39e1('0x18')](_0x39e1('0x24'),_0x58903f['uniqueid'],_0x58903f[_0x39e1('0x16')],_0x58903f[_0x39e1('0x1a')],_0x58903f[_0x39e1('0x8')]));channels[_0x58903f[_0x39e1('0x16')]]['accountcode']=_0x58903f[_0x39e1('0xe')];channels[_0x58903f[_0x39e1('0x16')]][_0x39e1('0x25')]=_0x58903f[_0x39e1('0x8')];if(_[_0x39e1('0x20')](channels[_0x58903f[_0x39e1('0x16')]][_0x39e1('0x26')])){channels[_0x58903f[_0x39e1('0x16')]][_0x39e1('0x26')]=utils[_0x39e1('0x1c')]();}channels[_0x58903f[_0x39e1('0x16')]][_0x39e1('0x27')]=dispositions[_[_0x39e1('0x28')](_0x58903f[_0x39e1('0x21')])]||_0x39e1('0x29');}}catch(_0x4b9f26){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')]('[%s][calls][newstate]',_0x58903f[_0x39e1('0x7')]),_0x4b9f26);}};exports[_0x39e1('0x2a')]=function(_0x1552f6){try{if(!_['isNil'](channels[_0x1552f6[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')](_0x39e1('0x2b'),_0x1552f6[_0x39e1('0x7')]),_0x1552f6);if(_[_0x39e1('0x20')](channels[_0x1552f6[_0x39e1('0x7')]]['callerid'])){channels[_0x1552f6[_0x39e1('0x7')]][_0x39e1('0x2c')]=_0x1552f6[_0x39e1('0x2d')]+'\x20<'+_0x1552f6[_0x39e1('0xc')]+'>';}utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x2e'),_0x1552f6[_0x39e1('0x7')],channels[_0x1552f6[_0x39e1('0x7')]][_0x39e1('0x2c')],_0x1552f6['cause-txt']));channels[_0x1552f6[_0x39e1('0x7')]][_0x39e1('0x2f')]=utils[_0x39e1('0x1c')]();channels[_0x1552f6[_0x39e1('0x7')]]['duration']=utils[_0x39e1('0x30')](channels[_0x1552f6['uniqueid']][_0x39e1('0x2f')],channels[_0x1552f6['uniqueid']][_0x39e1('0x31')]);channels[_0x1552f6['uniqueid']][_0x39e1('0x32')]=channels[_0x1552f6[_0x39e1('0x7')]]['answertime']?utils['diffTime'](channels[_0x1552f6[_0x39e1('0x7')]]['endtime'],channels[_0x1552f6[_0x39e1('0x7')]][_0x39e1('0x26')]):0x0;writeDB(channels[_0x1552f6[_0x39e1('0x7')]]);}}catch(_0x6e6fec){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')](_0x39e1('0x2b'),_0x1552f6[_0x39e1('0x7')]),_0x6e6fec);}};exports[_0x39e1('0x33')]=function(_0x4af8b5){try{if(!_[_0x39e1('0x20')](channels[_0x4af8b5['localtwolinkedid']])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')](_0x39e1('0x34'),_0x4af8b5[_0x39e1('0x35')]),_0x4af8b5);if(channels[_0x4af8b5[_0x39e1('0x36')]][_0x39e1('0x8')]==_0x4af8b5['transfereechannel']){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x37'),_0x4af8b5['origtransfereruniqueid'],_0x4af8b5[_0x39e1('0x36')],_0x4af8b5[_0x39e1('0x38')]));channels[_0x4af8b5['localtwolinkedid']][_0x39e1('0x25')]=_0x4af8b5[_0x39e1('0x38')];channels[_0x4af8b5['localtwolinkedid']]['userfield']=_0x39e1('0x39');}else if(channels[_0x4af8b5[_0x39e1('0x36')]][_0x39e1('0x8')]=_0x4af8b5[_0x39e1('0x3a')]){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x37'),_0x4af8b5[_0x39e1('0x35')],_0x4af8b5['localtwolinkedid'],_0x4af8b5['origtransfererchannel']));channels[_0x4af8b5['localtwolinkedid']][_0x39e1('0x25')]=_0x4af8b5[_0x39e1('0x3b')];channels[_0x4af8b5[_0x39e1('0x36')]][_0x39e1('0x3c')]=_0x39e1('0x39');}}}catch(_0x3d2e86){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')](_0x39e1('0x34'),_0x4af8b5[_0x39e1('0x35')]),_0x3d2e86);}};exports['musiconholdstart']=function(_0x33bdcb){try{if(!_['isNil'](channels[_0x33bdcb[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')](_0x39e1('0x3d'),_0x33bdcb[_0x39e1('0x7')]),_0x33bdcb);channels[_0x33bdcb[_0x39e1('0x7')]][_0x39e1('0x3e')]=utils[_0x39e1('0x1c')]();utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x3f'),_0x33bdcb[_0x39e1('0x7')],channels[_0x33bdcb[_0x39e1('0x7')]]['musiconholdstartAt']));}}catch(_0x32d7bd){utils[_0x39e1('0x1e')](util['format']('[%s][calls][musiconholdstart]',_0x33bdcb[_0x39e1('0x7')]),_0x32d7bd);}};exports['musiconholdstop']=function(_0x1404e0){try{if(!_[_0x39e1('0x20')](channels[_0x1404e0[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')]('[%s][calls][musiconholdstop]',_0x1404e0['uniqueid']),_0x1404e0);if(!_[_0x39e1('0x20')](channels[_0x1404e0[_0x39e1('0x7')]][_0x39e1('0x3e')])){channels[_0x1404e0[_0x39e1('0x7')]][_0x39e1('0x40')]+=utils[_0x39e1('0x30')](utils['now'](),channels[_0x1404e0[_0x39e1('0x7')]][_0x39e1('0x3e')]);utils[_0x39e1('0x5')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1404e0[_0x39e1('0x7')],channels[_0x1404e0[_0x39e1('0x7')]][_0x39e1('0x40')]));delete channels[_0x1404e0['uniqueid']][_0x39e1('0x3e')];}}}catch(_0x80e424){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')](_0x39e1('0x41'),_0x1404e0[_0x39e1('0x7')]),_0x80e424);}};exports[_0x39e1('0x42')]=function(_0x1fc81e){try{if(!_[_0x39e1('0x20')](channels[_0x1fc81e[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')](_0x39e1('0x43'),_0x1fc81e[_0x39e1('0x7')]),_0x1fc81e);if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')]['xmd-originatecalleridnum'])){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x45'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]]['source']=_0x1fc81e[_0x39e1('0x46')];}if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')]['xmd-phone'])){utils['info'](util[_0x39e1('0x18')](_0x39e1('0x47'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x48')]=_0x1fc81e[_0x39e1('0x46')];channels[_0x1fc81e['uniqueid']][_0x39e1('0x2c')]='\x22'+_0x1fc81e[_0x39e1('0x46')]+_0x39e1('0x49')+_0x1fc81e[_0x39e1('0x46')]+'>';}if(!_['isNil'](_0x1fc81e['variable'][_0x39e1('0x4a')])||!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')]['xmd-callerid'])){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x4b'),_0x1fc81e['uniqueid'],!_['isNil'](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x4a')])?_0x39e1('0x4a'):'xmd-callerid',_0x1fc81e['value']));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x2c')]=_0x1fc81e[_0x39e1('0x46')];}if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x4c')])||!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x4d')])){utils['info'](util['format'](_0x39e1('0x4b'),_0x1fc81e[_0x39e1('0x7')],!_['isNil'](_0x1fc81e['variable'][_0x39e1('0x4c')])?'xmd-queue':_0x39e1('0x4d'),_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x4e')]=_0x39e1('0x4f');channels[_0x1fc81e['uniqueid']][_0x39e1('0x50')]=_0x1fc81e[_0x39e1('0x46')];channels[_0x1fc81e['uniqueid']][_0x39e1('0x9')]=!![];}if(!_['isNil'](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x51')])){utils['info'](util['format'](_0x39e1('0x52'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e['uniqueid']][_0x39e1('0x53')]=_0x1fc81e['value'];}if(!_['isNil'](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x54')])){utils['info'](util[_0x39e1('0x18')](_0x39e1('0x55'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e['value']));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x56')]=_0x1fc81e[_0x39e1('0x46')];}if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x57')])){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x58'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x59')]=_0x1fc81e[_0x39e1('0x46')];}if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')]['sipcallid'])){utils['info'](util[_0x39e1('0x18')](_0x39e1('0x5a'),_0x1fc81e['uniqueid'],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]]['sipcallid']=_0x1fc81e['value'];}}}catch(_0x38c895){utils['error'](util[_0x39e1('0x18')](_0x39e1('0x43'),_0x1fc81e[_0x39e1('0x7')]),_0x38c895);}};exports[_0x39e1('0x5b')]=function(_0x328d2b){try{if(!_[_0x39e1('0x20')](channels[_0x328d2b[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')]('[%s][calls][newexten]',_0x328d2b[_0x39e1('0x7')]),_0x328d2b);utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x5c'),_0x328d2b['uniqueid'],_0x328d2b[_0x39e1('0x5d')],_0x328d2b[_0x39e1('0x5e')]));if(_0x328d2b[_0x39e1('0x5d')][_0x39e1('0x5f')]()==_0x39e1('0x60')&&_[_0x39e1('0x61')](_0x328d2b[_0x39e1('0x5e')][_0x39e1('0x5f')](),_0x39e1('0x62'))){var _0x2c1fe3=_0x328d2b[_0x39e1('0x5e')][_0x39e1('0x63')]('=');var _0x3f53f8=_0x2c1fe3[0x0][_0x39e1('0x64')](_0x2c1fe3[0x0][_0x39e1('0x65')]('(')+0x1,_0x2c1fe3[0x0][_0x39e1('0x65')](')'));var _0x2a26fb=_0x2c1fe3[0x1];channels[_0x328d2b[_0x39e1('0x7')]][_0x3f53f8]=_0x2a26fb;}if(!_[_0x39e1('0x66')](['hangup',_0x39e1('0x67'),_0x39e1('0x68'),'set',_0x39e1('0x69')],_0x328d2b[_0x39e1('0x5d')][_0x39e1('0x5f')]())){channels[_0x328d2b[_0x39e1('0x7')]][_0x39e1('0x4e')]=_0x328d2b[_0x39e1('0x5d')];channels[_0x328d2b[_0x39e1('0x7')]]['lastdata']=_0x328d2b['appdata'];}}}catch(_0x3f25e7){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')]('[%s][calls][newexten]',_0x328d2b['uniqueid']),_0x3f25e7);}}; \ No newline at end of file +var _0x4f94=['interface','connectedlinenum','lastevent','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','error','newstate','debug','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','channelstate','transfer','accountcode','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','[%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','userfield','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername'];(function(_0x3ca829,_0xc55f17){var _0x3b416b=function(_0x592aae){while(--_0x592aae){_0x3ca829['push'](_0x3ca829['shift']());}};_0x3b416b(++_0xc55f17);}(_0x4f94,0x14a));var _0x44f9=function(_0x274fff,_0x120061){_0x274fff=_0x274fff-0x0;var _0x5803f0=_0x4f94[_0x274fff];return _0x5803f0;};'use strict';var _=require('lodash');var util=require(_0x44f9('0x0'));var utils=require(_0x44f9('0x1'));var dispositions=['NO\x20ANSWER','FAILED',_0x44f9('0x2'),_0x44f9('0x3'),_0x44f9('0x3'),_0x44f9('0x3'),_0x44f9('0x4'),_0x44f9('0x5'),_0x44f9('0x2'),'FAILED',_0x44f9('0x2')];var channels={};function writeDB(_0x47973f){utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x8'),_0x47973f['uniqueid'],_0x47973f[_0x44f9('0x9')],_0x47973f[_0x44f9('0xa')],_0x47973f[_0x44f9('0xb')],_0x47973f[_0x44f9('0xc')],_0x47973f['calleridnum'],_0x47973f[_0x44f9('0xd')],_0x47973f[_0x44f9('0xe')]));if(_0x47973f['accountcode']){utils['getUserByInternal'](_0x47973f['accountcode'])[_0x44f9('0xf')](function(_0x4bd36d){if(_0x4bd36d){_0x47973f[_0x44f9('0x10')]=_0x4bd36d['id'];}utils[_0x44f9('0x11')](_0x44f9('0x12'),_0x47973f);});}else{utils[_0x44f9('0x11')]('CreateVoiceCallReport',_0x47973f);}if(channels[_0x47973f[_0x44f9('0x13')]]){delete channels[_0x47973f[_0x44f9('0x13')]];}}exports[_0x44f9('0x14')]=function(_0x442d21){try{utils['debug'](util['format'](_0x44f9('0x15'),_0x442d21[_0x44f9('0x13')]),_0x442d21);if(_0x442d21[_0x44f9('0x13')]==_0x442d21[_0x44f9('0x16')]&&_0x442d21[_0x44f9('0x9')]!=_0x44f9('0x17')){utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x18'),_0x442d21[_0x44f9('0x13')],_0x442d21['context'],_0x442d21[_0x44f9('0x19')]));channels[_0x442d21[_0x44f9('0x13')]]={'uniqueid':_0x442d21[_0x44f9('0x13')],'accountcode':_0x442d21['accountcode'],'source':_0x442d21['calleridnum'],'destination':_0x442d21['exten'],'destinationcontext':_0x442d21[_0x44f9('0x1a')],'channel':_0x442d21['channel'],'starttime':utils[_0x44f9('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x236b5b){utils[_0x44f9('0x1c')](util[_0x44f9('0x7')](_0x44f9('0x15'),_0x442d21[_0x44f9('0x13')]),_0x236b5b);}};exports[_0x44f9('0x1d')]=function(_0x12c28e){try{utils[_0x44f9('0x1e')](util[_0x44f9('0x7')](_0x44f9('0x1f'),_0x12c28e[_0x44f9('0x13')]),_0x12c28e);if(!_['isNil'](channels[_0x12c28e[_0x44f9('0x13')]])&&_0x12c28e['channelstate']==0x6){utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x20'),_0x12c28e[_0x44f9('0x13')],_0x12c28e[_0x44f9('0x1a')],_0x12c28e['channel']));if(_['isNil'](channels[_0x12c28e['uniqueid']][_0x44f9('0x21')])){channels[_0x12c28e['uniqueid']][_0x44f9('0x21')]=utils[_0x44f9('0x1b')]();}}else if(!_[_0x44f9('0x22')](channels[_0x12c28e['linkedid']])&&_0x12c28e[_0x44f9('0x23')]==0x6&&_0x12c28e[_0x44f9('0x1a')]!=_0x44f9('0x24')){utils[_0x44f9('0x6')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x12c28e[_0x44f9('0x13')],_0x12c28e[_0x44f9('0x16')],_0x12c28e[_0x44f9('0x1a')],_0x12c28e[_0x44f9('0x9')]));channels[_0x12c28e[_0x44f9('0x16')]]['accountcode']=_0x12c28e[_0x44f9('0x25')];channels[_0x12c28e[_0x44f9('0x16')]][_0x44f9('0x26')]=_0x12c28e[_0x44f9('0x9')];if(_['isNil'](channels[_0x12c28e[_0x44f9('0x16')]][_0x44f9('0x27')])){channels[_0x12c28e[_0x44f9('0x16')]][_0x44f9('0x27')]=utils[_0x44f9('0x1b')]();}channels[_0x12c28e[_0x44f9('0x16')]][_0x44f9('0x28')]=dispositions[_[_0x44f9('0x29')](_0x12c28e['channelstate'])]||_0x44f9('0x4');}}catch(_0x2dfc7c){utils[_0x44f9('0x1c')](util[_0x44f9('0x7')](_0x44f9('0x1f'),_0x12c28e[_0x44f9('0x13')]),_0x2dfc7c);}};exports[_0x44f9('0x2a')]=function(_0x1293a5){try{if(!_['isNil'](channels[_0x1293a5[_0x44f9('0x13')]])){utils[_0x44f9('0x1e')](util[_0x44f9('0x7')](_0x44f9('0x2b'),_0x1293a5[_0x44f9('0x13')]),_0x1293a5);if(_['isNil'](channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x2c')])){channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x2c')]=_0x1293a5[_0x44f9('0x2d')]+'\x20<'+_0x1293a5[_0x44f9('0x2e')]+'>';}utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x2f'),_0x1293a5[_0x44f9('0x13')],channels[_0x1293a5[_0x44f9('0x13')]]['callerid'],_0x1293a5[_0x44f9('0x30')]));channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x31')]=utils[_0x44f9('0x1b')]();channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x32')]=utils[_0x44f9('0x33')](channels[_0x1293a5[_0x44f9('0x13')]]['endtime'],channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x34')]);channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x35')]=channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x27')]?utils['diffTime'](channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x31')],channels[_0x1293a5[_0x44f9('0x13')]][_0x44f9('0x27')]):0x0;writeDB(channels[_0x1293a5[_0x44f9('0x13')]]);}}catch(_0x1c53b1){utils[_0x44f9('0x1c')](util[_0x44f9('0x7')]('[%s][calls][hangup]',_0x1293a5[_0x44f9('0x13')]),_0x1c53b1);}};exports[_0x44f9('0x36')]=function(_0x64a866){try{if(!_['isNil'](channels[_0x64a866[_0x44f9('0x37')]])){utils[_0x44f9('0x1e')](util[_0x44f9('0x7')](_0x44f9('0x38'),_0x64a866[_0x44f9('0x39')]),_0x64a866);if(channels[_0x64a866[_0x44f9('0x37')]]['channel']==_0x64a866[_0x44f9('0x3a')]){utils['info'](util[_0x44f9('0x7')](_0x44f9('0x3b'),_0x64a866[_0x44f9('0x39')],_0x64a866['localtwolinkedid'],_0x64a866['secondtransfererchannel']));channels[_0x64a866[_0x44f9('0x37')]]['destinationchannel']=_0x64a866[_0x44f9('0x3c')];channels[_0x64a866['localtwolinkedid']][_0x44f9('0x3d')]='_attended';}else if(channels[_0x64a866['localtwolinkedid']]['channel']=_0x64a866['transfertargetchannel']){utils[_0x44f9('0x6')](util[_0x44f9('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x64a866['origtransfereruniqueid'],_0x64a866[_0x44f9('0x37')],_0x64a866[_0x44f9('0x3e')]));channels[_0x64a866[_0x44f9('0x37')]][_0x44f9('0x26')]=_0x64a866[_0x44f9('0x3e')];channels[_0x64a866[_0x44f9('0x37')]][_0x44f9('0x3d')]=_0x44f9('0x3f');}}}catch(_0x3ac380){utils[_0x44f9('0x1c')](util[_0x44f9('0x7')](_0x44f9('0x38'),_0x64a866[_0x44f9('0x39')]),_0x3ac380);}};exports[_0x44f9('0x40')]=function(_0x374fd0){try{if(!_[_0x44f9('0x22')](channels[_0x374fd0[_0x44f9('0x13')]])){utils[_0x44f9('0x1e')](util[_0x44f9('0x7')](_0x44f9('0x41'),_0x374fd0[_0x44f9('0x13')]),_0x374fd0);channels[_0x374fd0[_0x44f9('0x13')]][_0x44f9('0x42')]=utils[_0x44f9('0x1b')]();utils['info'](util[_0x44f9('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x374fd0['uniqueid'],channels[_0x374fd0[_0x44f9('0x13')]][_0x44f9('0x42')]));}}catch(_0x111657){utils[_0x44f9('0x1c')](util[_0x44f9('0x7')](_0x44f9('0x41'),_0x374fd0[_0x44f9('0x13')]),_0x111657);}};exports[_0x44f9('0x43')]=function(_0x9d5ba2){try{if(!_[_0x44f9('0x22')](channels[_0x9d5ba2[_0x44f9('0x13')]])){utils['debug'](util[_0x44f9('0x7')](_0x44f9('0x44'),_0x9d5ba2[_0x44f9('0x13')]),_0x9d5ba2);if(!_[_0x44f9('0x22')](channels[_0x9d5ba2[_0x44f9('0x13')]][_0x44f9('0x42')])){channels[_0x9d5ba2[_0x44f9('0x13')]]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x9d5ba2[_0x44f9('0x13')]][_0x44f9('0x42')]);utils['info'](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x9d5ba2[_0x44f9('0x13')],channels[_0x9d5ba2[_0x44f9('0x13')]]['mohtime']));delete channels[_0x9d5ba2[_0x44f9('0x13')]]['musiconholdstartAt'];}}}catch(_0x462f18){utils[_0x44f9('0x1c')](util[_0x44f9('0x7')](_0x44f9('0x44'),_0x9d5ba2['uniqueid']),_0x462f18);}};exports[_0x44f9('0x45')]=function(_0x4426ee){try{if(!_[_0x44f9('0x22')](channels[_0x4426ee[_0x44f9('0x13')]])){utils[_0x44f9('0x1e')](util[_0x44f9('0x7')](_0x44f9('0x46'),_0x4426ee['uniqueid']),_0x4426ee);if(!_[_0x44f9('0x22')](_0x4426ee[_0x44f9('0x47')][_0x44f9('0x48')])){utils[_0x44f9('0x6')](util[_0x44f9('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4426ee[_0x44f9('0x13')],_0x4426ee[_0x44f9('0x49')]));channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x4a')]=_0x4426ee[_0x44f9('0x49')];}if(!_[_0x44f9('0x22')](_0x4426ee['variable'][_0x44f9('0x4b')])){utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x4c'),_0x4426ee['uniqueid'],_0x4426ee[_0x44f9('0x49')]));channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x4d')]=_0x4426ee['value'];channels[_0x4426ee['uniqueid']][_0x44f9('0x2c')]='\x22'+_0x4426ee[_0x44f9('0x49')]+_0x44f9('0x4e')+_0x4426ee[_0x44f9('0x49')]+'>';}if(!_[_0x44f9('0x22')](_0x4426ee[_0x44f9('0x47')][_0x44f9('0x4f')])||!_[_0x44f9('0x22')](_0x4426ee['variable'][_0x44f9('0x50')])){utils['info'](util[_0x44f9('0x7')](_0x44f9('0x51'),_0x4426ee[_0x44f9('0x13')],!_[_0x44f9('0x22')](_0x4426ee[_0x44f9('0x47')][_0x44f9('0x4f')])?_0x44f9('0x4f'):_0x44f9('0x50'),_0x4426ee[_0x44f9('0x49')]));channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x2c')]=_0x4426ee[_0x44f9('0x49')];}if(!_[_0x44f9('0x22')](_0x4426ee[_0x44f9('0x47')][_0x44f9('0x52')])||!_[_0x44f9('0x22')](_0x4426ee['variable']['xmcs-queue'])){utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x51'),_0x4426ee[_0x44f9('0x13')],!_[_0x44f9('0x22')](_0x4426ee['variable']['xmd-queue'])?_0x44f9('0x52'):_0x44f9('0x53'),_0x4426ee[_0x44f9('0x49')]));channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x54')]=_0x44f9('0x55');channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x56')]=_0x4426ee['value'];channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0xa')]=!![];}if(!_['isNil'](_0x4426ee[_0x44f9('0x47')][_0x44f9('0x57')])){utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x58'),_0x4426ee[_0x44f9('0x13')],_0x4426ee['value']));channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x59')]=_0x4426ee['value'];}if(!_[_0x44f9('0x22')](_0x4426ee[_0x44f9('0x47')][_0x44f9('0x5a')])){utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x5b'),_0x4426ee[_0x44f9('0x13')],_0x4426ee[_0x44f9('0x49')]));channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x5c')]=_0x4426ee[_0x44f9('0x49')];}if(!_['isNil'](_0x4426ee['variable'][_0x44f9('0x5d')])){utils['info'](util['format'](_0x44f9('0x5e'),_0x4426ee[_0x44f9('0x13')],_0x4426ee['value']));channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x5f')]=_0x4426ee[_0x44f9('0x49')];}if(!_[_0x44f9('0x22')](_0x4426ee[_0x44f9('0x47')][_0x44f9('0x60')])){utils[_0x44f9('0x6')](util['format'](_0x44f9('0x61'),_0x4426ee[_0x44f9('0x13')],_0x4426ee[_0x44f9('0x49')]));channels[_0x4426ee[_0x44f9('0x13')]][_0x44f9('0x60')]=_0x4426ee[_0x44f9('0x49')];}}}catch(_0x327384){utils[_0x44f9('0x1c')](util[_0x44f9('0x7')](_0x44f9('0x46'),_0x4426ee[_0x44f9('0x13')]),_0x327384);}};exports[_0x44f9('0x62')]=function(_0xdbed19){try{if(!_['isNil'](channels[_0xdbed19[_0x44f9('0x13')]])){utils[_0x44f9('0x1e')](util[_0x44f9('0x7')](_0x44f9('0x63'),_0xdbed19[_0x44f9('0x13')]),_0xdbed19);utils[_0x44f9('0x6')](util[_0x44f9('0x7')](_0x44f9('0x64'),_0xdbed19['uniqueid'],_0xdbed19[_0x44f9('0x65')],_0xdbed19[_0x44f9('0x66')]));if(_0xdbed19[_0x44f9('0x65')][_0x44f9('0x67')]()==_0x44f9('0x68')&&_[_0x44f9('0x69')](_0xdbed19[_0x44f9('0x66')][_0x44f9('0x67')](),_0x44f9('0x6a'))){var _0x325b35=_0xdbed19['appdata'][_0x44f9('0x6b')]('=');var _0x51e68b=_0x325b35[0x0][_0x44f9('0x6c')](_0x325b35[0x0]['lastIndexOf']('(')+0x1,_0x325b35[0x0][_0x44f9('0x6d')](')'));var _0x1608c4=_0x325b35[0x1];channels[_0xdbed19[_0x44f9('0x13')]][_0x51e68b]=_0x1608c4;}if(!_[_0x44f9('0x6e')]([_0x44f9('0x2a'),_0x44f9('0x6f'),_0x44f9('0x70'),_0x44f9('0x68'),_0x44f9('0x71')],_0xdbed19[_0x44f9('0x65')][_0x44f9('0x67')]())){channels[_0xdbed19['uniqueid']][_0x44f9('0x54')]=_0xdbed19[_0x44f9('0x65')];channels[_0xdbed19['uniqueid']][_0x44f9('0x56')]=_0xdbed19['appdata'];}}}catch(_0x257f1d){utils['error'](util[_0x44f9('0x7')](_0x44f9('0x63'),_0xdbed19[_0x44f9('0x13')]),_0x257f1d);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ecaab85..ccc9dc5 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 _0x8ee8=['[core]\x20connected','shutdown','info','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils'];(function(_0x4da735,_0x22a02a){var _0x57dfc8=function(_0x2b67ea){while(--_0x2b67ea){_0x4da735['push'](_0x4da735['shift']());}};_0x57dfc8(++_0x22a02a);}(_0x8ee8,0x8b));var _0x88ee=function(_0x4e98fb,_0x5709f5){_0x4e98fb=_0x4e98fb-0x0;var _0x132c42=_0x8ee8[_0x4e98fb];return _0x132c42;};'use strict';var utils=require(_0x88ee('0x0'));exports['connect']=function(){utils['info'](_0x88ee('0x1'));};exports[_0x88ee('0x2')]=function(){utils[_0x88ee('0x3')]('[core]\x20shutdown');};exports[_0x88ee('0x4')]=function(){utils[_0x88ee('0x3')](_0x88ee('0x5'));};exports[_0x88ee('0x6')]=function(_0xd2e1e9){utils[_0x88ee('0x6')](_0x88ee('0x7'),_0xd2e1e9);};exports['close']=function(){utils['info'](_0x88ee('0x8'));};exports[_0x88ee('0x9')]=function(_0x46fd47){}; \ No newline at end of file +var _0x292b=['info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent'];(function(_0x1e9ca5,_0x4c36eb){var _0x51b78c=function(_0x35981d){while(--_0x35981d){_0x1e9ca5['push'](_0x1e9ca5['shift']());}};_0x51b78c(++_0x4c36eb);}(_0x292b,0x75));var _0xb292=function(_0x33626e,_0x2c1e9a){_0x33626e=_0x33626e-0x0;var _0x254df4=_0x292b[_0x33626e];return _0x254df4;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xb292('0x0')](_0xb292('0x1'));};exports[_0xb292('0x2')]=function(){utils[_0xb292('0x0')](_0xb292('0x3'));};exports['fullybooted']=function(){utils[_0xb292('0x0')](_0xb292('0x4'));};exports[_0xb292('0x5')]=function(_0x216041){utils[_0xb292('0x5')](_0xb292('0x6'),_0x216041);};exports['close']=function(){utils[_0xb292('0x0')](_0xb292('0x7'));};exports[_0xb292('0x8')]=function(_0x10ec43){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 36af1ee..21e4347 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 _0xbe7a=['appdata','toLowerCase','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','assign','starttime','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','request','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0xe19c6d,_0x1271b6){var _0xa842a0=function(_0x53368d){while(--_0x53368d){_0xe19c6d['push'](_0xe19c6d['shift']());}};_0xa842a0(++_0x1271b6);}(_0xbe7a,0xf4));var _0xabe7=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xbe7a[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0xabe7('0x0'));var util=require(_0xabe7('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2589df){utils[_0xabe7('0x2')](util[_0xabe7('0x3')](_0xabe7('0x4'),_0x2589df['uniqueid'],_0x2589df[_0xabe7('0x5')],_0x2589df[_0xabe7('0x6')],_0x2589df[_0xabe7('0x7')],_0x2589df[_0xabe7('0x8')],_0x2589df['dialstatus']));utils[_0xabe7('0x9')]('CreateVoiceDialReport',_0x2589df);delete dials[_0x2589df[_0xabe7('0xa')]];}exports[_0xabe7('0xb')]=function(_0x10efa1){try{utils[_0xabe7('0xc')](util[_0xabe7('0x3')](_0xabe7('0xd'),_0x10efa1[_0xabe7('0xa')]),_0x10efa1);utils['info'](util['format'](_0xabe7('0xe'),_0x10efa1[_0xabe7('0xa')],_0x10efa1[_0xabe7('0xf')],_0x10efa1[_0xabe7('0x10')]));if(_0x10efa1[_0xabe7('0xf')][_0xabe7('0x11')]()=='set'&&_[_0xabe7('0x12')](_0x10efa1[_0xabe7('0x10')][_0xabe7('0x11')](),_0xabe7('0x13'))){var _0x5d152e=_0x10efa1[_0xabe7('0x10')]['split']('=');dials[_0x10efa1[_0xabe7('0xa')]]={'routeId':_0x5d152e[0x1]};}}catch(_0x3fd0f0){utils[_0xabe7('0x14')](util['format'](_0xabe7('0xd'),_0x10efa1[_0xabe7('0xa')]),_0x3fd0f0);}};exports[_0xabe7('0x15')]=function(_0x770bd5){try{utils['debug'](util[_0xabe7('0x3')](_0xabe7('0x16'),_0x770bd5[_0xabe7('0xa')]),_0x770bd5);if(!_['isNil'](_0x770bd5[_0xabe7('0x17')][_0xabe7('0x18')])){utils['info'](util[_0xabe7('0x3')](_0xabe7('0x19'),_0x770bd5['uniqueid'],_0x770bd5[_0xabe7('0x1a')]));dials[_0x770bd5[_0xabe7('0xa')]]={'routeId':_0x770bd5['value']};}}catch(_0x14ba57){utils[_0xabe7('0x14')](util['format']('[%s][dials][varset]',_0x770bd5[_0xabe7('0xa')]),_0x14ba57);}};exports['dialbegin']=function(_0x2d9ebf){try{if(!_[_0xabe7('0x1b')](dials[_0x2d9ebf[_0xabe7('0xa')]])){utils[_0xabe7('0xc')](util['format']('[%s][dials][dialbegin]',_0x2d9ebf[_0xabe7('0xa')]),_0x2d9ebf);dials[_0x2d9ebf[_0xabe7('0xa')]]=_[_0xabe7('0x1c')](dials[_0x2d9ebf[_0xabe7('0xa')]],_0x2d9ebf);dials[_0x2d9ebf['uniqueid']][_0xabe7('0x1d')]=utils['now']();dials[_0x2d9ebf[_0xabe7('0xa')]][_0xabe7('0x1e')]='called';utils[_0xabe7('0x2')](util[_0xabe7('0x3')](_0xabe7('0x1f'),_0x2d9ebf[_0xabe7('0xa')],dials[_0x2d9ebf[_0xabe7('0xa')]][_0xabe7('0x1d')]));}}catch(_0x381ec8){utils[_0xabe7('0x14')](util[_0xabe7('0x3')](_0xabe7('0x20'),_0x2d9ebf[_0xabe7('0xa')]),_0x381ec8);}};exports[_0xabe7('0x21')]=function(_0x5c96aa){try{if(!_[_0xabe7('0x1b')](dials[_0x5c96aa[_0xabe7('0xa')]])){utils[_0xabe7('0xc')](util[_0xabe7('0x3')](_0xabe7('0x22'),_0x5c96aa[_0xabe7('0xa')]),_0x5c96aa);dials[_0x5c96aa[_0xabe7('0xa')]]['dialstatus']=_0x5c96aa[_0xabe7('0x23')];if(_0x5c96aa['dialstatus']=='ANSWER'){dials[_0x5c96aa[_0xabe7('0xa')]]=_[_0xabe7('0x1c')](dials[_0x5c96aa['uniqueid']],_0x5c96aa);dials[_0x5c96aa[_0xabe7('0xa')]]['answertime']=utils[_0xabe7('0x24')]();dials[_0x5c96aa[_0xabe7('0xa')]][_0xabe7('0x1e')]=_0xabe7('0x25');utils[_0xabe7('0x2')](util[_0xabe7('0x3')](_0xabe7('0x26'),_0x5c96aa[_0xabe7('0xa')],_0x5c96aa[_0xabe7('0x23')],dials[_0x5c96aa[_0xabe7('0xa')]][_0xabe7('0x27')]));}else{utils['info'](util['format'](_0xabe7('0x28'),_0x5c96aa[_0xabe7('0xa')],_0x5c96aa[_0xabe7('0x23')]));}}}catch(_0x48cd73){utils[_0xabe7('0x14')](util[_0xabe7('0x3')](_0xabe7('0x22'),_0x5c96aa[_0xabe7('0xa')]),_0x48cd73);}};exports[_0xabe7('0x29')]=function(_0x3e0362){try{if(!_[_0xabe7('0x1b')](dials[_0x3e0362[_0xabe7('0xa')]])){utils['debug'](util[_0xabe7('0x3')](_0xabe7('0x2a'),_0x3e0362[_0xabe7('0xa')]),_0x3e0362);utils[_0xabe7('0x2')](util[_0xabe7('0x3')](_0xabe7('0x2b'),_0x3e0362['uniqueid'],_0x3e0362[_0xabe7('0x7')],_0x3e0362[_0xabe7('0x2c')],_0x3e0362[_0xabe7('0x2d')]));dials[_0x3e0362['uniqueid']]=_['assign'](dials[_0x3e0362['uniqueid']],{'endtime':utils[_0xabe7('0x24')](),'lastevent':_0xabe7('0x2e')});dials[_0x3e0362['uniqueid']][_0xabe7('0x2f')]=utils['diffTime'](dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x30')],dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x1d')]);dials[_0x3e0362['uniqueid']][_0xabe7('0x31')]=utils[_0xabe7('0x32')](dials[_0x3e0362[_0xabe7('0xa')]]['answertime']||dials[_0x3e0362[_0xabe7('0xa')]]['endtime'],dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x1d')]);dials[_0x3e0362['uniqueid']][_0xabe7('0x33')]=dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x27')]?utils[_0xabe7('0x32')](dials[_0x3e0362['uniqueid']][_0xabe7('0x30')],dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x27')]):0x0;writeDB(dials[_0x3e0362[_0xabe7('0xa')]]);}}catch(_0xd1e16f){utils[_0xabe7('0x14')](util[_0xabe7('0x3')](_0xabe7('0x2a'),_0x3e0362[_0xabe7('0xa')]),_0xd1e16f);}}; \ No newline at end of file +var _0x599c=['[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called'];(function(_0x3eb540,_0x4e517a){var _0x2e88d8=function(_0x5902aa){while(--_0x5902aa){_0x3eb540['push'](_0x3eb540['shift']());}};_0x2e88d8(++_0x4e517a);}(_0x599c,0x147));var _0xc599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x599c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc599('0x0'));var util=require(_0xc599('0x1'));var utils=require(_0xc599('0x2'));var dials={};function writeDB(_0x1bac91){utils[_0xc599('0x3')](util[_0xc599('0x4')](_0xc599('0x5'),_0x1bac91[_0xc599('0x6')],_0x1bac91['channel'],_0x1bac91[_0xc599('0x7')],_0x1bac91[_0xc599('0x8')],_0x1bac91[_0xc599('0x9')],_0x1bac91[_0xc599('0xa')]));utils[_0xc599('0xb')](_0xc599('0xc'),_0x1bac91);delete dials[_0x1bac91[_0xc599('0x6')]];}exports[_0xc599('0xd')]=function(_0x373b19){try{utils[_0xc599('0xe')](util[_0xc599('0x4')](_0xc599('0xf'),_0x373b19[_0xc599('0x6')]),_0x373b19);utils['info'](util[_0xc599('0x4')](_0xc599('0x10'),_0x373b19[_0xc599('0x6')],_0x373b19[_0xc599('0x11')],_0x373b19[_0xc599('0x12')]));if(_0x373b19[_0xc599('0x11')][_0xc599('0x13')]()==_0xc599('0x14')&&_['startsWith'](_0x373b19[_0xc599('0x12')][_0xc599('0x13')](),_0xc599('0x15'))){var _0xe98234=_0x373b19[_0xc599('0x12')][_0xc599('0x16')]('=');dials[_0x373b19['uniqueid']]={'routeId':_0xe98234[0x1]};}}catch(_0x285045){utils[_0xc599('0x17')](util[_0xc599('0x4')]('[%s][dials][newexten]',_0x373b19['uniqueid']),_0x285045);}};exports[_0xc599('0x18')]=function(_0x20ebe4){try{utils[_0xc599('0xe')](util[_0xc599('0x4')](_0xc599('0x19'),_0x20ebe4[_0xc599('0x6')]),_0x20ebe4);if(!_[_0xc599('0x1a')](_0x20ebe4[_0xc599('0x1b')][_0xc599('0x1c')])){utils['info'](util[_0xc599('0x4')](_0xc599('0x1d'),_0x20ebe4[_0xc599('0x6')],_0x20ebe4[_0xc599('0x1e')]));dials[_0x20ebe4[_0xc599('0x6')]]={'routeId':_0x20ebe4['value']};}}catch(_0x230d94){utils[_0xc599('0x17')](util[_0xc599('0x4')](_0xc599('0x19'),_0x20ebe4[_0xc599('0x6')]),_0x230d94);}};exports[_0xc599('0x1f')]=function(_0x43d9ee){try{if(!_[_0xc599('0x1a')](dials[_0x43d9ee[_0xc599('0x6')]])){utils[_0xc599('0xe')](util[_0xc599('0x4')](_0xc599('0x20'),_0x43d9ee['uniqueid']),_0x43d9ee);dials[_0x43d9ee[_0xc599('0x6')]]=_[_0xc599('0x21')](dials[_0x43d9ee[_0xc599('0x6')]],_0x43d9ee);dials[_0x43d9ee['uniqueid']][_0xc599('0x22')]=utils[_0xc599('0x23')]();dials[_0x43d9ee[_0xc599('0x6')]]['lastevent']=_0xc599('0x24');utils['info'](util['format'](_0xc599('0x25'),_0x43d9ee[_0xc599('0x6')],dials[_0x43d9ee[_0xc599('0x6')]]['starttime']));}}catch(_0x56dfb2){utils[_0xc599('0x17')](util[_0xc599('0x4')]('[%s][dials][dialbegin]',_0x43d9ee[_0xc599('0x6')]),_0x56dfb2);}};exports['dialend']=function(_0x28027e){try{if(!_[_0xc599('0x1a')](dials[_0x28027e[_0xc599('0x6')]])){utils[_0xc599('0xe')](util['format'](_0xc599('0x26'),_0x28027e[_0xc599('0x6')]),_0x28027e);dials[_0x28027e[_0xc599('0x6')]][_0xc599('0xa')]=_0x28027e[_0xc599('0xa')];if(_0x28027e[_0xc599('0xa')]==_0xc599('0x27')){dials[_0x28027e[_0xc599('0x6')]]=_['assign'](dials[_0x28027e['uniqueid']],_0x28027e);dials[_0x28027e[_0xc599('0x6')]][_0xc599('0x28')]=utils[_0xc599('0x23')]();dials[_0x28027e['uniqueid']]['lastevent']=_0xc599('0x29');utils['info'](util[_0xc599('0x4')](_0xc599('0x2a'),_0x28027e['uniqueid'],_0x28027e[_0xc599('0xa')],dials[_0x28027e[_0xc599('0x6')]][_0xc599('0x28')]));}else{utils[_0xc599('0x3')](util['format'](_0xc599('0x2b'),_0x28027e['uniqueid'],_0x28027e['dialstatus']));}}}catch(_0x3c3504){utils['error'](util[_0xc599('0x4')](_0xc599('0x26'),_0x28027e[_0xc599('0x6')]),_0x3c3504);}};exports[_0xc599('0x2c')]=function(_0x10d948){try{if(!_[_0xc599('0x1a')](dials[_0x10d948['uniqueid']])){utils[_0xc599('0xe')](util['format'](_0xc599('0x2d'),_0x10d948[_0xc599('0x6')]),_0x10d948);utils[_0xc599('0x3')](util[_0xc599('0x4')](_0xc599('0x2e'),_0x10d948[_0xc599('0x6')],_0x10d948[_0xc599('0x8')],_0x10d948['calleridname'],_0x10d948['cause-txt']));dials[_0x10d948['uniqueid']]=_['assign'](dials[_0x10d948[_0xc599('0x6')]],{'endtime':utils[_0xc599('0x23')](),'lastevent':_0xc599('0x2f')});dials[_0x10d948[_0xc599('0x6')]][_0xc599('0x30')]=utils[_0xc599('0x31')](dials[_0x10d948[_0xc599('0x6')]][_0xc599('0x32')],dials[_0x10d948['uniqueid']][_0xc599('0x22')]);dials[_0x10d948[_0xc599('0x6')]]['holdtime']=utils[_0xc599('0x31')](dials[_0x10d948[_0xc599('0x6')]][_0xc599('0x28')]||dials[_0x10d948[_0xc599('0x6')]][_0xc599('0x32')],dials[_0x10d948['uniqueid']]['starttime']);dials[_0x10d948[_0xc599('0x6')]][_0xc599('0x33')]=dials[_0x10d948['uniqueid']][_0xc599('0x28')]?utils['diffTime'](dials[_0x10d948[_0xc599('0x6')]][_0xc599('0x32')],dials[_0x10d948['uniqueid']][_0xc599('0x28')]):0x0;writeDB(dials[_0x10d948[_0xc599('0x6')]]);}}catch(_0x31b02d){utils[_0xc599('0x17')](util[_0xc599('0x4')]('[%s][dials][hangup]',_0x10d948[_0xc599('0x6')]),_0x31b02d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8df949f..d68b14a 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 _0xf79f=['[%s][index][newstate]','[%s][index][hangup]','hangup','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xf79f,0x9b));var _0xff79=function(_0x14286a,_0x54bf72){_0x14286a=_0x14286a-0x0;var _0x26d207=_0xf79f[_0x14286a];return _0x26d207;};var AsteriskManager=require(_0xff79('0x0'));var config=require('../../config/environment');var utils=require(_0xff79('0x1'));var util=require(_0xff79('0x2'));var isXDREnabled=config['xdr']&&config[_0xff79('0x3')][_0xff79('0x4')]?!config[_0xff79('0x3')][_0xff79('0x4')]:!![];var isProduction=config['env']===_0xff79('0x5')||![];var isLocalAsterisk=config[_0xff79('0x3')]&&config[_0xff79('0x3')][_0xff79('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xff79('0x7')][_0xff79('0x8')],config[_0xff79('0x7')]['ip'],config[_0xff79('0x7')][_0xff79('0x9')],config[_0xff79('0x7')][_0xff79('0xa')],!![]);ami[_0xff79('0xb')]();if(!isXDREnabled){utils[_0xff79('0xc')](_0xff79('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xff79('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xff79('0xe'));var calls=require(_0xff79('0xf'));var queues=require('./queues.controller');var recordings=require(_0xff79('0x10'));var members=require(_0xff79('0x11'));var dials=require(_0xff79('0x12'));var transfers=require(_0xff79('0x13'));var core=require(_0xff79('0x14'));ami['on'](_0xff79('0x15'),core[_0xff79('0x15')]);ami['on']('shutdown',core[_0xff79('0x16')]);ami['on'](_0xff79('0x17'),core[_0xff79('0x17')]);ami['on']('error',core[_0xff79('0x18')]);ami['on'](_0xff79('0x19'),core[_0xff79('0x19')]);ami['on'](_0xff79('0x1a'),core['managerevent']);ami['on']('devicestatechange',function(_0x40b20b){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x1d'),_0x40b20b[_0xff79('0x1e')]),_0x40b20b);members['devicestatechange'](_0x40b20b);}catch(_0x114cb0){utils[_0xff79('0x18')](util['format'](_0xff79('0x1d'),_0x40b20b[_0xff79('0x1e')]),_0x114cb0);}});ami['on'](_0xff79('0x1f'),function(_0x2f7d06){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x20'),_0x2f7d06[_0xff79('0x21')]),_0x2f7d06);agents[_0xff79('0x1f')](_0x2f7d06);}catch(_0x514c13){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x20'),_0x2f7d06[_0xff79('0x21')]),_0x514c13);}});ami['on'](_0xff79('0x22'),function(_0x139a75){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x23'),_0x139a75['uniqueid']),_0x139a75);agents['agentringnoanswer'](_0x139a75);}catch(_0x35d82f){utils['error'](util[_0xff79('0x1c')](_0xff79('0x23'),_0x139a75['uniqueid']),_0x35d82f);}});ami['on'](_0xff79('0x24'),function(_0x29eedf){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')]('[%s][index][agentconnect]',_0x29eedf['uniqueid']),_0x29eedf);agents[_0xff79('0x24')](_0x29eedf);queues['agentconnect'](_0x29eedf);}catch(_0x2a5503){utils[_0xff79('0x18')](util[_0xff79('0x1c')]('[%s][index][agentconnect]',_0x29eedf[_0xff79('0x21')]),_0x2a5503);}});ami['on'](_0xff79('0x25'),function(_0x9dab15){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x26'),_0x9dab15[_0xff79('0x21')]),_0x9dab15);agents[_0xff79('0x25')](_0x9dab15);queues[_0xff79('0x25')](_0x9dab15);members[_0xff79('0x25')](_0x9dab15);}catch(_0x4ce80d){utils['error'](util[_0xff79('0x1c')](_0xff79('0x26'),_0x9dab15[_0xff79('0x21')]),_0x4ce80d);}});ami['on'](_0xff79('0x27'),function(_0x375d83){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x28'),_0x375d83[_0xff79('0x21')]),_0x375d83);agents[_0xff79('0x27')](_0x375d83);queues[_0xff79('0x27')](_0x375d83);}catch(_0x22d4e7){utils['error'](util[_0xff79('0x1c')](_0xff79('0x28'),_0x375d83[_0xff79('0x21')]),_0x22d4e7);}});ami['on']('queuecallerjoin',function(_0x592686){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')]('[%s][index][queuecallerjoin]',_0x592686[_0xff79('0x21')]),_0x592686);queues['queuecallerjoin'](_0x592686);recordings[_0xff79('0x29')](_0x592686);}catch(_0x195f21){utils[_0xff79('0x18')](util['format']('[%s][index][queuecallerjoin]',_0x592686[_0xff79('0x21')]),_0x195f21);}});ami['on'](_0xff79('0x2a'),function(_0x578e07){try{utils[_0xff79('0x1b')](util['format'](_0xff79('0x2b'),_0x578e07[_0xff79('0x21')]),_0x578e07);queues['queuecallerleave'](_0x578e07);}catch(_0x310527){utils['error'](util[_0xff79('0x1c')](_0xff79('0x2b'),_0x578e07[_0xff79('0x21')]),_0x310527);}});ami['on'](_0xff79('0x2c'),function(_0xbc86a1){try{utils[_0xff79('0x1b')](util['format'](_0xff79('0x2d'),_0xbc86a1[_0xff79('0x21')]),_0xbc86a1);queues['musiconholdstart'](_0xbc86a1);calls[_0xff79('0x2c')](_0xbc86a1);}catch(_0x5200d9){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x2d'),_0xbc86a1[_0xff79('0x21')]),_0x5200d9);}});ami['on']('musiconholdstop',function(_0x3f0ac3){try{utils['debug'](util[_0xff79('0x1c')](_0xff79('0x2e'),_0x3f0ac3[_0xff79('0x21')]),_0x3f0ac3);queues[_0xff79('0x2f')](_0x3f0ac3);calls[_0xff79('0x2f')](_0x3f0ac3);}catch(_0xd5d477){utils['error'](util[_0xff79('0x1c')](_0xff79('0x2e'),_0x3f0ac3['uniqueid']),_0xd5d477);}});ami['on'](_0xff79('0x30'),function(_0x1b0e29){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x31'),_0x1b0e29[_0xff79('0x21')]),_0x1b0e29);calls[_0xff79('0x30')](_0x1b0e29);recordings[_0xff79('0x30')](_0x1b0e29);}catch(_0xd8b4cf){utils[_0xff79('0x18')](util['format'](_0xff79('0x31'),_0x1b0e29[_0xff79('0x21')]),_0xd8b4cf);}});ami['on']('hangup',function(_0x14a445){try{utils['debug'](util['format'](_0xff79('0x32'),_0x14a445[_0xff79('0x21')]),_0x14a445);calls['hangup'](_0x14a445);recordings[_0xff79('0x33')](_0x14a445);dials[_0xff79('0x33')](_0x14a445);agents['hangup'](_0x14a445);queues[_0xff79('0x33')](_0x14a445);}catch(_0x1cd716){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x32'),_0x14a445[_0xff79('0x21')]),_0x1cd716);}});ami['on']('cdr',function(_0x263d44){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x34'),_0x263d44[_0xff79('0x21')]),_0x263d44);members['cdr'](_0x263d44);}catch(_0x406853){utils[_0xff79('0x18')](util['format'](_0xff79('0x34'),_0x263d44['uniqueid']),_0x406853);}});ami['on'](_0xff79('0x35'),function(_0x16d6f9){try{utils[_0xff79('0x1b')](util['format']('[%s][index][blindtransfer]',_0x16d6f9[_0xff79('0x21')]),_0x16d6f9);queues[_0xff79('0x35')](_0x16d6f9);agents[_0xff79('0x35')](_0x16d6f9);transfers[_0xff79('0x35')](_0x16d6f9);}catch(_0x234352){utils[_0xff79('0x18')](util[_0xff79('0x1c')]('[%s][index][blindtransfer]',_0x16d6f9[_0xff79('0x21')]),_0x234352);}});ami['on'](_0xff79('0x36'),function(_0xdfe74){try{utils[_0xff79('0x1b')](util['format'](_0xff79('0x37'),_0xdfe74['origtransfereruniqueid']),_0xdfe74);queues[_0xff79('0x36')](_0xdfe74);transfers['attendedtransfer'](_0xdfe74);agents['attendedtransfer'](_0xdfe74);calls[_0xff79('0x36')](_0xdfe74);}catch(_0x2372fa){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x37'),_0xdfe74[_0xff79('0x38')]),_0x2372fa);}});ami['on'](_0xff79('0x39'),function(_0x37e99e){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x3a'),_0x37e99e[_0xff79('0x21')]),_0x37e99e);queues[_0xff79('0x39')](_0x37e99e);recordings[_0xff79('0x39')](_0x37e99e);calls[_0xff79('0x39')](_0x37e99e);dials['varset'](_0x37e99e);}catch(_0x43a75f){utils['error'](util[_0xff79('0x1c')](_0xff79('0x3a'),_0x37e99e['uniqueid']),_0x43a75f);}});ami['on'](_0xff79('0x3b'),function(_0x35b850){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x3c'),_0x35b850[_0xff79('0x21')]),_0x35b850);calls[_0xff79('0x3b')](_0x35b850);recordings[_0xff79('0x3b')](_0x35b850);dials[_0xff79('0x3b')](_0x35b850);}catch(_0x3c3a3e){utils['error'](util[_0xff79('0x1c')](_0xff79('0x3c'),_0x35b850[_0xff79('0x21')]),_0x3c3a3e);}});ami['on'](_0xff79('0x3d'),function(_0x388f8c){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x3e'),_0x388f8c['uniqueid']),_0x388f8c);calls[_0xff79('0x3d')](_0x388f8c);recordings[_0xff79('0x3d')](_0x388f8c);}catch(_0x402a05){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x3e'),_0x388f8c['uniqueid']),_0x402a05);}});ami['on'](_0xff79('0x3f'),function(_0x1cb4e8){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x40'),_0x1cb4e8[_0xff79('0x21')]),_0x1cb4e8);dials[_0xff79('0x3f')](_0x1cb4e8);}catch(_0xe16faf){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x41'),_0x1cb4e8['uniqueid']),_0xe16faf);}});ami['on'](_0xff79('0x42'),function(_0x9c35){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')]('[%s][index][dialend]',_0x9c35['uniqueid']),_0x9c35);dials[_0xff79('0x42')](_0x9c35);}catch(_0x52a3e2){utils[_0xff79('0x18')](util['format'](_0xff79('0x43'),_0x9c35['uniqueid']),_0x52a3e2);}});} \ No newline at end of file +var _0xf14a=['queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xf14a,0x64));var _0xaf14=function(_0x46f24e,_0x4648c5){_0x46f24e=_0x46f24e-0x0;var _0x84c9d6=_0xf14a[_0x46f24e];return _0x84c9d6;};var AsteriskManager=require('asterisk-manager');var config=require(_0xaf14('0x0'));var utils=require(_0xaf14('0x1'));var util=require(_0xaf14('0x2'));var isXDREnabled=config['xdr']&&config[_0xaf14('0x3')][_0xaf14('0x4')]?!config[_0xaf14('0x3')]['disabled']:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0xaf14('0x3')]&&config[_0xaf14('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xaf14('0x5')][_0xaf14('0x6')],config[_0xaf14('0x5')]['ip'],config[_0xaf14('0x5')]['username'],config['asterisk'][_0xaf14('0x7')],!![]);ami[_0xaf14('0x8')]();if(!isXDREnabled){utils[_0xaf14('0x9')](_0xaf14('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xaf14('0x9')](_0xaf14('0xb'));}else{var agents=require(_0xaf14('0xc'));var calls=require(_0xaf14('0xd'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xaf14('0xe'));var dials=require(_0xaf14('0xf'));var transfers=require(_0xaf14('0x10'));var core=require(_0xaf14('0x11'));ami['on'](_0xaf14('0x12'),core['connect']);ami['on'](_0xaf14('0x13'),core[_0xaf14('0x13')]);ami['on']('fullybooted',core[_0xaf14('0x14')]);ami['on'](_0xaf14('0x15'),core[_0xaf14('0x15')]);ami['on']('close',core[_0xaf14('0x16')]);ami['on'](_0xaf14('0x17'),core[_0xaf14('0x17')]);ami['on'](_0xaf14('0x18'),function(_0x1d4999){try{utils[_0xaf14('0x19')](util['format'](_0xaf14('0x1a'),_0x1d4999[_0xaf14('0x1b')]),_0x1d4999);members['devicestatechange'](_0x1d4999);}catch(_0x4effea){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x1a'),_0x1d4999[_0xaf14('0x1b')]),_0x4effea);}});ami['on'](_0xaf14('0x1d'),function(_0x160660){try{utils[_0xaf14('0x19')](util['format'](_0xaf14('0x1e'),_0x160660[_0xaf14('0x1f')]),_0x160660);agents[_0xaf14('0x1d')](_0x160660);}catch(_0x2a0f7a){utils[_0xaf14('0x15')](util['format']('[%s][index][agentcalled]',_0x160660[_0xaf14('0x1f')]),_0x2a0f7a);}});ami['on'](_0xaf14('0x20'),function(_0x1a06df){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')]('[%s][index][agentringnoanswer]',_0x1a06df[_0xaf14('0x1f')]),_0x1a06df);agents[_0xaf14('0x20')](_0x1a06df);}catch(_0x29a9ff){utils[_0xaf14('0x15')](util['format'](_0xaf14('0x21'),_0x1a06df[_0xaf14('0x1f')]),_0x29a9ff);}});ami['on'](_0xaf14('0x22'),function(_0x4e9dd2){try{utils['debug'](util[_0xaf14('0x1c')](_0xaf14('0x23'),_0x4e9dd2[_0xaf14('0x1f')]),_0x4e9dd2);agents[_0xaf14('0x22')](_0x4e9dd2);queues['agentconnect'](_0x4e9dd2);}catch(_0x317059){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')]('[%s][index][agentconnect]',_0x4e9dd2['uniqueid']),_0x317059);}});ami['on'](_0xaf14('0x24'),function(_0x37d845){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')](_0xaf14('0x25'),_0x37d845[_0xaf14('0x1f')]),_0x37d845);agents['agentcomplete'](_0x37d845);queues[_0xaf14('0x24')](_0x37d845);members[_0xaf14('0x24')](_0x37d845);}catch(_0x35bee0){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')]('[%s][index][agentcomplete]',_0x37d845[_0xaf14('0x1f')]),_0x35bee0);}});ami['on'](_0xaf14('0x26'),function(_0x5dea7c){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')](_0xaf14('0x27'),_0x5dea7c['uniqueid']),_0x5dea7c);agents[_0xaf14('0x26')](_0x5dea7c);queues[_0xaf14('0x26')](_0x5dea7c);}catch(_0x5196c5){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')]('[%s][index][queuecallerabandon]',_0x5dea7c[_0xaf14('0x1f')]),_0x5196c5);}});ami['on'](_0xaf14('0x28'),function(_0x35d225){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')](_0xaf14('0x29'),_0x35d225[_0xaf14('0x1f')]),_0x35d225);queues[_0xaf14('0x28')](_0x35d225);recordings[_0xaf14('0x28')](_0x35d225);}catch(_0x346f3c){utils[_0xaf14('0x15')](util['format'](_0xaf14('0x29'),_0x35d225[_0xaf14('0x1f')]),_0x346f3c);}});ami['on'](_0xaf14('0x2a'),function(_0x4da826){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')](_0xaf14('0x2b'),_0x4da826[_0xaf14('0x1f')]),_0x4da826);queues[_0xaf14('0x2a')](_0x4da826);}catch(_0x508143){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x2b'),_0x4da826[_0xaf14('0x1f')]),_0x508143);}});ami['on'](_0xaf14('0x2c'),function(_0x38293f){try{utils[_0xaf14('0x19')](util['format'](_0xaf14('0x2d'),_0x38293f['uniqueid']),_0x38293f);queues['musiconholdstart'](_0x38293f);calls[_0xaf14('0x2c')](_0x38293f);}catch(_0x5b50d2){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x2d'),_0x38293f[_0xaf14('0x1f')]),_0x5b50d2);}});ami['on']('musiconholdstop',function(_0x3e5c6f){try{utils[_0xaf14('0x19')](util['format'](_0xaf14('0x2e'),_0x3e5c6f[_0xaf14('0x1f')]),_0x3e5c6f);queues[_0xaf14('0x2f')](_0x3e5c6f);calls[_0xaf14('0x2f')](_0x3e5c6f);}catch(_0x17d461){utils[_0xaf14('0x15')](util['format'](_0xaf14('0x2e'),_0x3e5c6f[_0xaf14('0x1f')]),_0x17d461);}});ami['on'](_0xaf14('0x30'),function(_0x4c52d4){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')](_0xaf14('0x31'),_0x4c52d4[_0xaf14('0x1f')]),_0x4c52d4);calls[_0xaf14('0x30')](_0x4c52d4);recordings['newstate'](_0x4c52d4);}catch(_0x204958){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x31'),_0x4c52d4[_0xaf14('0x1f')]),_0x204958);}});ami['on'](_0xaf14('0x32'),function(_0x62735e){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')](_0xaf14('0x33'),_0x62735e[_0xaf14('0x1f')]),_0x62735e);calls[_0xaf14('0x32')](_0x62735e);recordings[_0xaf14('0x32')](_0x62735e);dials[_0xaf14('0x32')](_0x62735e);agents[_0xaf14('0x32')](_0x62735e);queues['hangup'](_0x62735e);}catch(_0x3cace6){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x33'),_0x62735e['uniqueid']),_0x3cace6);}});ami['on']('cdr',function(_0x4e300c){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')](_0xaf14('0x34'),_0x4e300c[_0xaf14('0x1f')]),_0x4e300c);members[_0xaf14('0x35')](_0x4e300c);}catch(_0x4b9227){utils['error'](util['format'](_0xaf14('0x34'),_0x4e300c[_0xaf14('0x1f')]),_0x4b9227);}});ami['on']('blindtransfer',function(_0x3cc19a){try{utils[_0xaf14('0x19')](util[_0xaf14('0x1c')](_0xaf14('0x36'),_0x3cc19a[_0xaf14('0x1f')]),_0x3cc19a);queues['blindtransfer'](_0x3cc19a);agents[_0xaf14('0x37')](_0x3cc19a);transfers[_0xaf14('0x37')](_0x3cc19a);}catch(_0x1b67f2){utils[_0xaf14('0x15')](util['format'](_0xaf14('0x36'),_0x3cc19a[_0xaf14('0x1f')]),_0x1b67f2);}});ami['on'](_0xaf14('0x38'),function(_0x45efee){try{utils['debug'](util[_0xaf14('0x1c')](_0xaf14('0x39'),_0x45efee[_0xaf14('0x3a')]),_0x45efee);queues[_0xaf14('0x38')](_0x45efee);transfers[_0xaf14('0x38')](_0x45efee);agents['attendedtransfer'](_0x45efee);calls[_0xaf14('0x38')](_0x45efee);}catch(_0x5c30e3){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x39'),_0x45efee[_0xaf14('0x3a')]),_0x5c30e3);}});ami['on'](_0xaf14('0x3b'),function(_0x8ceb18){try{utils['debug'](util[_0xaf14('0x1c')]('[%s][index][varset]',_0x8ceb18[_0xaf14('0x1f')]),_0x8ceb18);queues[_0xaf14('0x3b')](_0x8ceb18);recordings[_0xaf14('0x3b')](_0x8ceb18);calls['varset'](_0x8ceb18);dials[_0xaf14('0x3b')](_0x8ceb18);}catch(_0x101f63){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x3c'),_0x8ceb18[_0xaf14('0x1f')]),_0x101f63);}});ami['on']('newexten',function(_0x49f4a8){try{utils['debug'](util['format'](_0xaf14('0x3d'),_0x49f4a8[_0xaf14('0x1f')]),_0x49f4a8);calls[_0xaf14('0x3e')](_0x49f4a8);recordings[_0xaf14('0x3e')](_0x49f4a8);dials['newexten'](_0x49f4a8);}catch(_0x24f3b7){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x3d'),_0x49f4a8[_0xaf14('0x1f')]),_0x24f3b7);}});ami['on'](_0xaf14('0x3f'),function(_0x4ef571){try{utils['debug'](util['format'](_0xaf14('0x40'),_0x4ef571[_0xaf14('0x1f')]),_0x4ef571);calls['newchannel'](_0x4ef571);recordings[_0xaf14('0x3f')](_0x4ef571);}catch(_0x29bd85){utils[_0xaf14('0x15')](util[_0xaf14('0x1c')](_0xaf14('0x40'),_0x4ef571[_0xaf14('0x1f')]),_0x29bd85);}});ami['on'](_0xaf14('0x41'),function(_0x44379b){try{utils[_0xaf14('0x19')](util['format'](_0xaf14('0x42'),_0x44379b[_0xaf14('0x1f')]),_0x44379b);dials[_0xaf14('0x41')](_0x44379b);}catch(_0x1559ab){utils['error'](util['format'](_0xaf14('0x43'),_0x44379b[_0xaf14('0x1f')]),_0x1559ab);}});ami['on'](_0xaf14('0x44'),function(_0x4126be){try{utils['debug'](util['format'](_0xaf14('0x45'),_0x4126be[_0xaf14('0x1f')]),_0x4126be);dials[_0xaf14('0x44')](_0x4126be);}catch(_0x3e773e){utils['error'](util['format']('[%s][index][dialend]',_0x4126be['uniqueid']),_0x3e773e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e764f59..e9074d8 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 _0xfb68=['name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','now','agent','NOT_INUSE','duration','exitAt','agentcomplete','isNil','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','source','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then'];(function(_0x2de012,_0x5276dd){var _0x5b6423=function(_0x50136d){while(--_0x50136d){_0x2de012['push'](_0x2de012['shift']());}};_0x5b6423(++_0x5276dd);}(_0xfb68,0x1d2));var _0x8fb6=function(_0x3f5f4a,_0x56220b){_0x3f5f4a=_0x3f5f4a-0x0;var _0x2e8114=_0xfb68[_0x3f5f4a];return _0x2e8114;};'use strict';var _=require(_0x8fb6('0x0'));var util=require(_0x8fb6('0x1'));var utils=require(_0x8fb6('0x2'));var members={};var exclude=[_0x8fb6('0x3'),_0x8fb6('0x4')];function writeDB(_0x5b1aea){utils['info'](util[_0x8fb6('0x5')](_0x8fb6('0x6'),_0x5b1aea[_0x8fb6('0x7')],_0x5b1aea[_0x8fb6('0x8')],_0x5b1aea[_0x8fb6('0x9')],_0x5b1aea['data2'],_0x5b1aea[_0x8fb6('0xa')],_0x5b1aea[_0x8fb6('0xb')]));if(_0x5b1aea[_0x8fb6('0x8')]){utils[_0x8fb6('0xc')](_0x5b1aea[_0x8fb6('0x8')])[_0x8fb6('0xd')](function(_0x368988){if(_0x368988){_0x5b1aea['membername']=_0x368988[_0x8fb6('0xe')];_0x5b1aea['internal']=_0x368988[_0x8fb6('0xf')];utils['request'](_0x8fb6('0x10'),_0x5b1aea);}else{utils[_0x8fb6('0x11')](_0x5b1aea['interface'][_0x8fb6('0x12')]('/')[0x1])[_0x8fb6('0xd')](function(_0x28d16b){if(_0x28d16b){_0x5b1aea[_0x8fb6('0xa')]=_0x28d16b[_0x8fb6('0xe')];_0x5b1aea['internal']=_0x28d16b[_0x8fb6('0xf')];utils[_0x8fb6('0x13')]('CreateMemberReport',_0x5b1aea);}});}})[_0x8fb6('0x14')](function(_0x287935){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')](_0x8fb6('0x16'),_0x5b1aea[_0x8fb6('0x7')]),_0x287935);});}delete members[_0x5b1aea[_0x8fb6('0x8')]];}function startsWith(_0x11543c,_0x10db95){return _['some'](_0x11543c,function(_0x551c16){return _[_0x8fb6('0x17')](_0x10db95,_0x551c16);});}exports[_0x8fb6('0x18')]=function(_0x259deb){try{utils[_0x8fb6('0x19')](util[_0x8fb6('0x5')](_0x8fb6('0x1a'),members[_0x259deb[_0x8fb6('0x1b')]]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb[_0x8fb6('0x1b')]),_0x259deb);utils['info'](util[_0x8fb6('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x259deb['device']]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb['device'],_0x259deb['state'],_0x259deb[_0x8fb6('0x1b')]));switch(_0x259deb[_0x8fb6('0x1c')]){case'INUSE':case _0x8fb6('0x1d'):if(!startsWith(exclude,_0x259deb['device'])){members[_0x259deb['device']]={'channel':'voice','interface':_0x259deb[_0x8fb6('0x1b')],'type':'TALKING','enterAt':utils[_0x8fb6('0x1e')](),'role':_0x8fb6('0x1f')};}break;case _0x8fb6('0x20'):if(!_['isNil'](members[_0x259deb[_0x8fb6('0x1b')]])){members[_0x259deb[_0x8fb6('0x1b')]]['exitAt']=utils[_0x8fb6('0x1e')]();members[_0x259deb['device']][_0x8fb6('0x21')]=utils['diffTime'](members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x22')],members[_0x259deb[_0x8fb6('0x1b')]]['enterAt']);if(members[_0x259deb['device']]['uniqueid']){writeDB(members[_0x259deb[_0x8fb6('0x1b')]]);}}break;default:break;}}catch(_0x443cce){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')]('[%s][members][devicestatechange]',members[_0x259deb[_0x8fb6('0x1b')]]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb[_0x8fb6('0x1b')]),_0x443cce);}};exports[_0x8fb6('0x23')]=function(_0x4438c3){try{if(!_[_0x8fb6('0x24')](members[_0x4438c3['interface']])){utils[_0x8fb6('0x19')](util[_0x8fb6('0x5')]('[%s][members][agentcomplete]',_0x4438c3['uniqueid']),_0x4438c3);utils[_0x8fb6('0x25')](util['format'](_0x8fb6('0x26'),_0x4438c3[_0x8fb6('0x7')],_0x4438c3[_0x8fb6('0x8')],_0x4438c3[_0x8fb6('0x27')]));members[_0x4438c3['interface']]=_[_0x8fb6('0x28')](members[_0x4438c3[_0x8fb6('0x8')]],{'data4':_0x4438c3[_0x8fb6('0x27')],'uniqueid':_0x4438c3[_0x8fb6('0x7')]});}}catch(_0xcdecf0){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')]('[%s][members][agentcomplete]',_0x4438c3[_0x8fb6('0x7')]),_0xcdecf0);}};exports['cdr']=function(_0x44236a){try{utils[_0x8fb6('0x19')](util['format'](_0x8fb6('0x29'),_0x44236a[_0x8fb6('0x7')]),_0x44236a);if(_0x44236a[_0x8fb6('0x9')]){var _0x35898f=_0x44236a[_0x8fb6('0x9')][_0x8fb6('0x12')]('-')[0x0];if(!_['isNil'](members[_0x35898f])){members[_0x35898f]=_[_0x8fb6('0x28')](members[_0x35898f],{'data1':members[_0x35898f]['data1']||_0x44236a[_0x8fb6('0xb')],'data2':members[_0x35898f][_0x8fb6('0x2a')]||_0x44236a['source'],'data3':members[_0x35898f][_0x8fb6('0x2b')]||_0x44236a[_0x8fb6('0x2c')],'uniqueid':members[_0x35898f]['uniqueid']||_0x44236a[_0x8fb6('0x7')]});utils['info'](util['format'](_0x8fb6('0x2d'),_0x44236a[_0x8fb6('0x7')],members[_0x35898f][_0x8fb6('0x2e')],members[_0x35898f]['data2'],members[_0x35898f]['data3']));if(members[_0x35898f][_0x8fb6('0x22')]){writeDB(members[_0x35898f]);}}}if(_0x44236a['destinationchannel']){var _0x5d9a95=_0x44236a['destinationchannel']['split']('-')[0x0];if(!_[_0x8fb6('0x24')](members[_0x5d9a95])){members[_0x5d9a95]=_['assign'](members[_0x5d9a95],{'data1':members[_0x5d9a95][_0x8fb6('0x2e')]||_0x44236a[_0x8fb6('0xb')],'data2':members[_0x5d9a95][_0x8fb6('0x2a')]||_0x44236a[_0x8fb6('0x2f')],'data3':members[_0x5d9a95][_0x8fb6('0x2b')]||_0x44236a['destination'],'uniqueid':members[_0x5d9a95][_0x8fb6('0x7')]||_0x44236a['uniqueid']});utils[_0x8fb6('0x25')](util[_0x8fb6('0x5')](_0x8fb6('0x2d'),_0x44236a[_0x8fb6('0x7')],members[_0x5d9a95][_0x8fb6('0x2e')],members[_0x5d9a95][_0x8fb6('0x2a')],members[_0x5d9a95][_0x8fb6('0x2b')]));if(members[_0x5d9a95]['exitAt']){writeDB(members[_0x5d9a95]);}}}}catch(_0x306f7c){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')](_0x8fb6('0x29'),_0x44236a[_0x8fb6('0x7')]),_0x306f7c);}}; \ No newline at end of file +var _0x4a3d=['now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','queue','cdr','[%s][members][cdr]','assign','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','then','membername','name','internal','request','CreateMemberReport','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','device','INUSE','BUSY','TALKING'];(function(_0x39ec44,_0xb4a77){var _0x301ad6=function(_0x250f01){while(--_0x250f01){_0x39ec44['push'](_0x39ec44['shift']());}};_0x301ad6(++_0xb4a77);}(_0x4a3d,0x79));var _0xd4a3=function(_0x4b5b8b,_0x3494d1){_0x4b5b8b=_0x4b5b8b-0x0;var _0x10d1e2=_0x4a3d[_0x4b5b8b];return _0x10d1e2;};'use strict';var _=require(_0xd4a3('0x0'));var util=require(_0xd4a3('0x1'));var utils=require(_0xd4a3('0x2'));var members={};var exclude=[_0xd4a3('0x3'),_0xd4a3('0x4')];function writeDB(_0x34fd01){utils[_0xd4a3('0x5')](util[_0xd4a3('0x6')](_0xd4a3('0x7'),_0x34fd01[_0xd4a3('0x8')],_0x34fd01[_0xd4a3('0x9')],_0x34fd01[_0xd4a3('0xa')],_0x34fd01['data2'],_0x34fd01['membername'],_0x34fd01[_0xd4a3('0xb')]));if(_0x34fd01[_0xd4a3('0x9')]){utils['getUserByInterface'](_0x34fd01['interface'])[_0xd4a3('0xc')](function(_0x1ad12e){if(_0x1ad12e){_0x34fd01[_0xd4a3('0xd')]=_0x1ad12e[_0xd4a3('0xe')];_0x34fd01[_0xd4a3('0xf')]=_0x1ad12e[_0xd4a3('0xf')];utils[_0xd4a3('0x10')](_0xd4a3('0x11'),_0x34fd01);}else{utils['getUserByName'](_0x34fd01[_0xd4a3('0x9')][_0xd4a3('0x12')]('/')[0x1])[_0xd4a3('0xc')](function(_0x213577){if(_0x213577){_0x34fd01[_0xd4a3('0xd')]=_0x213577[_0xd4a3('0xe')];_0x34fd01[_0xd4a3('0xf')]=_0x213577['internal'];utils[_0xd4a3('0x10')](_0xd4a3('0x11'),_0x34fd01);}});}})[_0xd4a3('0x13')](function(_0x1d13e3){utils[_0xd4a3('0x14')](util[_0xd4a3('0x6')](_0xd4a3('0x15'),_0x34fd01[_0xd4a3('0x8')]),_0x1d13e3);});}delete members[_0x34fd01['interface']];}function startsWith(_0x5d16e8,_0x140379){return _[_0xd4a3('0x16')](_0x5d16e8,function(_0x124d03){return _[_0xd4a3('0x17')](_0x140379,_0x124d03);});}exports[_0xd4a3('0x18')]=function(_0x454361){try{utils['debug'](util[_0xd4a3('0x6')]('[%s][members][devicestatechange]',members[_0x454361[_0xd4a3('0x19')]]?members[_0x454361['device']][_0xd4a3('0x8')]:_0x454361['device']),_0x454361);utils[_0xd4a3('0x5')](util[_0xd4a3('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x454361[_0xd4a3('0x19')]]?members[_0x454361[_0xd4a3('0x19')]][_0xd4a3('0x8')]:_0x454361['device'],_0x454361['state'],_0x454361[_0xd4a3('0x19')]));switch(_0x454361['state']){case _0xd4a3('0x1a'):case _0xd4a3('0x1b'):if(!startsWith(exclude,_0x454361['device'])){members[_0x454361['device']]={'channel':'voice','interface':_0x454361[_0xd4a3('0x19')],'type':_0xd4a3('0x1c'),'enterAt':utils[_0xd4a3('0x1d')](),'role':'agent'};}break;case _0xd4a3('0x1e'):if(!_[_0xd4a3('0x1f')](members[_0x454361[_0xd4a3('0x19')]])){members[_0x454361[_0xd4a3('0x19')]][_0xd4a3('0x20')]=utils[_0xd4a3('0x1d')]();members[_0x454361['device']][_0xd4a3('0x21')]=utils[_0xd4a3('0x22')](members[_0x454361['device']][_0xd4a3('0x20')],members[_0x454361[_0xd4a3('0x19')]][_0xd4a3('0x23')]);if(members[_0x454361['device']][_0xd4a3('0x8')]){writeDB(members[_0x454361[_0xd4a3('0x19')]]);}}break;default:break;}}catch(_0x20a845){utils['error'](util[_0xd4a3('0x6')]('[%s][members][devicestatechange]',members[_0x454361[_0xd4a3('0x19')]]?members[_0x454361['device']][_0xd4a3('0x8')]:_0x454361['device']),_0x20a845);}};exports[_0xd4a3('0x24')]=function(_0x535ecd){try{if(!_[_0xd4a3('0x1f')](members[_0x535ecd['interface']])){utils[_0xd4a3('0x25')](util[_0xd4a3('0x6')](_0xd4a3('0x26'),_0x535ecd[_0xd4a3('0x8')]),_0x535ecd);utils[_0xd4a3('0x5')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x535ecd[_0xd4a3('0x8')],_0x535ecd[_0xd4a3('0x9')],_0x535ecd[_0xd4a3('0x27')]));members[_0x535ecd[_0xd4a3('0x9')]]=_['assign'](members[_0x535ecd[_0xd4a3('0x9')]],{'data4':_0x535ecd[_0xd4a3('0x27')],'uniqueid':_0x535ecd['uniqueid']});}}catch(_0x3ee869){utils['error'](util[_0xd4a3('0x6')](_0xd4a3('0x26'),_0x535ecd[_0xd4a3('0x8')]),_0x3ee869);}};exports[_0xd4a3('0x28')]=function(_0x43746f){try{utils[_0xd4a3('0x25')](util[_0xd4a3('0x6')](_0xd4a3('0x29'),_0x43746f[_0xd4a3('0x8')]),_0x43746f);if(_0x43746f['channel']){var _0x250ca9=_0x43746f[_0xd4a3('0xa')][_0xd4a3('0x12')]('-')[0x0];if(!_['isNil'](members[_0x250ca9])){members[_0x250ca9]=_[_0xd4a3('0x2a')](members[_0x250ca9],{'data1':members[_0x250ca9][_0xd4a3('0x2b')]||_0x43746f[_0xd4a3('0xb')],'data2':members[_0x250ca9][_0xd4a3('0x2c')]||_0x43746f[_0xd4a3('0x2d')],'data3':members[_0x250ca9][_0xd4a3('0x2e')]||_0x43746f[_0xd4a3('0x2f')],'uniqueid':members[_0x250ca9]['uniqueid']||_0x43746f[_0xd4a3('0x8')]});utils['info'](util['format'](_0xd4a3('0x30'),_0x43746f[_0xd4a3('0x8')],members[_0x250ca9][_0xd4a3('0x2b')],members[_0x250ca9][_0xd4a3('0x2c')],members[_0x250ca9]['data3']));if(members[_0x250ca9][_0xd4a3('0x20')]){writeDB(members[_0x250ca9]);}}}if(_0x43746f['destinationchannel']){var _0x380e73=_0x43746f[_0xd4a3('0x31')][_0xd4a3('0x12')]('-')[0x0];if(!_[_0xd4a3('0x1f')](members[_0x380e73])){members[_0x380e73]=_['assign'](members[_0x380e73],{'data1':members[_0x380e73][_0xd4a3('0x2b')]||_0x43746f[_0xd4a3('0xb')],'data2':members[_0x380e73][_0xd4a3('0x2c')]||_0x43746f[_0xd4a3('0x2d')],'data3':members[_0x380e73]['data3']||_0x43746f['destination'],'uniqueid':members[_0x380e73][_0xd4a3('0x8')]||_0x43746f[_0xd4a3('0x8')]});utils[_0xd4a3('0x5')](util[_0xd4a3('0x6')](_0xd4a3('0x30'),_0x43746f[_0xd4a3('0x8')],members[_0x380e73][_0xd4a3('0x2b')],members[_0x380e73]['data2'],members[_0x380e73]['data3']));if(members[_0x380e73][_0xd4a3('0x20')]){writeDB(members[_0x380e73]);}}}}catch(_0x26ab3a){utils[_0xd4a3('0x14')](util[_0xd4a3('0x6')](_0xd4a3('0x29'),_0x43746f[_0xd4a3('0x8')]),_0x26ab3a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0e2821b..1844a80 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 _0x3073=['calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','position','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','[%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','origtransfererexten','transferexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid'];(function(_0x41568f,_0x7c6734){var _0x2b35e5=function(_0x486c48){while(--_0x486c48){_0x41568f['push'](_0x41568f['shift']());}};_0x2b35e5(++_0x7c6734);}(_0x3073,0x73));var _0x3307=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3073[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x3307('0x0'));var util=require('util');var utils=require(_0x3307('0x1'));var queues={};function writeDB(_0x367003){utils['info'](util[_0x3307('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x367003[_0x3307('0x3')],_0x367003['channel'],_0x367003[_0x3307('0x4')],_0x367003[_0x3307('0x5')],_0x367003[_0x3307('0x6')],_0x367003[_0x3307('0x7')],_0x367003[_0x3307('0x8')]));if(_0x367003['queue']){utils[_0x3307('0x9')](_0x367003[_0x3307('0x4')])[_0x3307('0xa')](function(_0x353712){if(_0x353712){_0x367003['type']=_0x353712['type'];}utils[_0x3307('0xb')]('CreateVoiceQueueReport',_0x367003);});}else{utils[_0x3307('0xb')]('CreateVoiceQueueReport',_0x367003);}if(_0x367003[_0x3307('0xc')]){delete queues[_0x367003[_0x3307('0xc')]];}else{delete queues[_0x367003[_0x3307('0x3')]];}}exports[_0x3307('0xd')]=function(_0x2cef96){try{utils[_0x3307('0xe')](util[_0x3307('0x2')](_0x3307('0xf'),_0x2cef96[_0x3307('0x3')]),_0x2cef96);utils[_0x3307('0x10')](util[_0x3307('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x2cef96[_0x3307('0x3')],_0x2cef96[_0x3307('0x4')],_0x2cef96['position']));queues[_0x2cef96[_0x3307('0x3')]]=_[_0x3307('0x11')](_0x2cef96,{'originalposition':_0x2cef96['position'],'queuecallerjoinAt':utils[_0x3307('0x12')](),'mohtime':0x0});}catch(_0x30a61f){utils[_0x3307('0x13')](util['format'](_0x3307('0xf'),_0x2cef96['uniqueid']),_0x30a61f);}};exports['hangup']=function(_0x6aafac){try{if(!_[_0x3307('0x14')](queues[_0x6aafac[_0x3307('0x3')]])){utils[_0x3307('0xe')](util['format'](_0x3307('0x15'),_0x6aafac[_0x3307('0x3')]),_0x6aafac);if(queues[_0x6aafac['uniqueid']][_0x3307('0x16')]){if(!queues[_0x6aafac[_0x3307('0x3')]]['queuecallerabandon']&&!queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x17')]){queues[_0x6aafac[_0x3307('0x3')]]['queuecallercomplete']=!![];queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x18')]=utils[_0x3307('0x12')]();queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x8')]=_0x3307('0x19');}utils['info'](util[_0x3307('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x6aafac[_0x3307('0x3')],queues[_0x6aafac['uniqueid']][_0x3307('0x1a')],queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x8')]));writeDB(queues[_0x6aafac[_0x3307('0x3')]]);}else if(queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0xc')]){utils[_0x3307('0x10')](util['format'](_0x3307('0x1b'),_0x6aafac[_0x3307('0x3')],queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x1a')],queues[_0x6aafac['uniqueid']][_0x3307('0xc')]));queues[queues[_0x6aafac['uniqueid']][_0x3307('0xc')]]=queues[_0x6aafac[_0x3307('0x3')]];queues[queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0xc')]][_0x3307('0x1c')]=0x2;delete queues[_0x6aafac[_0x3307('0x3')]];}}}catch(_0x1b84cb){utils['error'](util[_0x3307('0x2')]('[%s][queues][hangup]',_0x6aafac['uniqueid']),_0x1b84cb);}};exports['varset']=function(_0x263f05){try{utils['debug'](util[_0x3307('0x2')](_0x3307('0x1d'),_0x263f05[_0x3307('0x3')]),_0x263f05);if(!_['isNil'](_0x263f05[_0x3307('0x1e')][_0x3307('0x1f')])&&_0x263f05[_0x3307('0x20')][_0x3307('0x21')]()!==_0x3307('0x22')){if(!_[_0x3307('0x14')](queues[_0x263f05[_0x3307('0x3')]])){queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x24')]=null;queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x17')]=!![];queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x25')]=utils[_0x3307('0x12')]();queues[_0x263f05['uniqueid']][_0x3307('0x8')]=_0x263f05['value'][_0x3307('0x21')]();utils[_0x3307('0x10')](util['format'](_0x3307('0x26'),_0x263f05[_0x3307('0x3')],queues[_0x263f05[_0x3307('0x3')]]['name'],_0x263f05[_0x3307('0x20')],queues[_0x263f05['uniqueid']][_0x3307('0x8')]));writeDB(queues[_0x263f05[_0x3307('0x3')]]);}}else if(!_[_0x3307('0x14')](_0x263f05[_0x3307('0x1e')][_0x3307('0x27')])){if(!_[_0x3307('0x14')](queues[_0x263f05[_0x3307('0x3')]])&&!queues[_0x263f05[_0x3307('0x3')]]['queuecallerabandon']){queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x263f05[_0x3307('0x3')]]['queuecallerabandonAt']=null;queues[_0x263f05[_0x3307('0x3')]]['queuecallerexit']=!![];queues[_0x263f05[_0x3307('0x3')]]['queuecallerexitAt']=utils[_0x3307('0x12')]();queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x8')]=_0x3307('0x28');utils[_0x3307('0x10')](util['format'](_0x3307('0x29'),_0x263f05['uniqueid'],queues[_0x263f05[_0x3307('0x3')]]['name'],_0x263f05[_0x3307('0x20')],queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x8')]));}}}catch(_0x24ee69){utils['error'](util[_0x3307('0x2')]('[%s][queues][varset]',_0x263f05[_0x3307('0x3')]),_0x24ee69);}};exports[_0x3307('0x23')]=function(_0x38f1d8){try{if(!_[_0x3307('0x14')](queues[_0x38f1d8[_0x3307('0x3')]])){utils[_0x3307('0xe')](util['format'](_0x3307('0x2a'),_0x38f1d8[_0x3307('0x3')]),_0x38f1d8);queues[_0x38f1d8[_0x3307('0x3')]][_0x3307('0x17')]=![];queues[_0x38f1d8[_0x3307('0x3')]]['queuecallerexitAt']=null;queues[_0x38f1d8[_0x3307('0x3')]][_0x3307('0x23')]=!![];queues[_0x38f1d8[_0x3307('0x3')]]['queuecallerabandonAt']=utils[_0x3307('0x12')]();queues[_0x38f1d8[_0x3307('0x3')]][_0x3307('0x8')]='ABANDONED';utils[_0x3307('0x10')](util[_0x3307('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x38f1d8['uniqueid'],queues[_0x38f1d8['uniqueid']][_0x3307('0x1a')],queues[_0x38f1d8[_0x3307('0x3')]][_0x3307('0x8')]));}}catch(_0x1f0ada){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x2a'),_0x38f1d8[_0x3307('0x3')]),_0x1f0ada);}};exports['queuecallerleave']=function(_0x367936){try{if(!_[_0x3307('0x14')](queues[_0x367936['uniqueid']])){utils[_0x3307('0xe')](util[_0x3307('0x2')](_0x3307('0x2b'),_0x367936['uniqueid']),_0x367936);utils['info'](util[_0x3307('0x2')](_0x3307('0x2c'),_0x367936[_0x3307('0x3')],queues[_0x367936[_0x3307('0x3')]]['name'],_0x367936[_0x3307('0x2d')],_0x367936[_0x3307('0x2e')]));queues[_0x367936[_0x3307('0x3')]][_0x3307('0x2f')]=!![];queues[_0x367936[_0x3307('0x3')]][_0x3307('0x16')]=utils[_0x3307('0x12')]();queues[_0x367936[_0x3307('0x3')]][_0x3307('0x30')]=utils[_0x3307('0x31')](queues[_0x367936[_0x3307('0x3')]][_0x3307('0x16')],queues[_0x367936['uniqueid']]['queuecallerjoinAt']);queues[_0x367936[_0x3307('0x3')]]['position']=_0x367936[_0x3307('0x32')];queues[_0x367936['uniqueid']][_0x3307('0x33')]=_0x367936[_0x3307('0x33')];queues[_0x367936[_0x3307('0x3')]][_0x3307('0x2d')]=_0x367936['connectedlinenum'];queues[_0x367936[_0x3307('0x3')]][_0x3307('0x2e')]=_0x367936[_0x3307('0x2e')];}}catch(_0x23ce78){utils[_0x3307('0x13')](util['format'](_0x3307('0x2b'),_0x367936[_0x3307('0x3')]),_0x23ce78);}};exports[_0x3307('0x34')]=function(_0x249044){try{if(!_['isNil'](queues[_0x249044[_0x3307('0x3')]])){utils[_0x3307('0xe')](util[_0x3307('0x2')](_0x3307('0x35'),_0x249044[_0x3307('0x3')]),_0x249044);utils[_0x3307('0x10')](util[_0x3307('0x2')](_0x3307('0x36'),_0x249044[_0x3307('0x3')],queues[_0x249044['uniqueid']][_0x3307('0x1a')],_0x249044[_0x3307('0x37')],_0x249044[_0x3307('0x38')]));queues[_0x249044[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x249044[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x249044[_0x3307('0x3')]][_0x3307('0x24')]=null;queues[_0x249044[_0x3307('0x3')]][_0x3307('0x17')]=![];queues[_0x249044[_0x3307('0x3')]][_0x3307('0x8')]=null;queues[_0x249044[_0x3307('0x3')]][_0x3307('0x25')]=null;queues[_0x249044[_0x3307('0x3')]][_0x3307('0x39')]=!![];queues[_0x249044['uniqueid']][_0x3307('0x7')]=_0x249044['destaccountcode'];queues[_0x249044['uniqueid']][_0x3307('0x5')]=_0x249044[_0x3307('0x37')];}}catch(_0x41991f){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x35'),_0x249044['uniqueid']),_0x41991f);}};exports[_0x3307('0x3a')]=function(_0x35a947){try{if(!_[_0x3307('0x14')](queues[_0x35a947[_0x3307('0x3')]])){if(queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x16')]){utils[_0x3307('0xe')](util['format']('[%s][queues][agentcomplete]',_0x35a947[_0x3307('0x3')]),_0x35a947);queues[_0x35a947['uniqueid']][_0x3307('0x23')]=![];queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x35a947[_0x3307('0x3')]]['queuecallerabandonAt']=null;queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x17')]=![];queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x25')]=null;queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x39')]=!![];queues[_0x35a947[_0x3307('0x3')]]['lastAssignedTo']=_0x35a947[_0x3307('0x37')];queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x3b')]=!![];queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x18')]=utils[_0x3307('0x12')]();if(_0x35a947[_0x3307('0x3c')]==_0x3307('0x3d')){if(!queues[_0x35a947[_0x3307('0x3')]]['transfer']){queues[_0x35a947[_0x3307('0x3')]]['queuecallerexitreason']=_0x3307('0x3e');}}else{queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x8')]='COMPLETEDBY'+_0x35a947[_0x3307('0x3c')][_0x3307('0x21')]();}utils[_0x3307('0x10')](util[_0x3307('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x35a947[_0x3307('0x3')],queues[_0x35a947[_0x3307('0x3')]]['name'],_0x35a947[_0x3307('0x37')],queues[_0x35a947['uniqueid']][_0x3307('0x8')]));writeDB(queues[_0x35a947[_0x3307('0x3')]]);}}}catch(_0x5c887b){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x3f'),_0x35a947[_0x3307('0x3')]),_0x5c887b);}};exports[_0x3307('0x40')]=function(_0x26f5bd){try{if(!_[_0x3307('0x14')](queues[_0x26f5bd['transfereeuniqueid']])){utils[_0x3307('0xe')](util[_0x3307('0x2')]('[%s][queues][blindtransfer]',_0x26f5bd[_0x3307('0x3')]),_0x26f5bd);queues[_0x26f5bd[_0x3307('0x41')]][_0x3307('0x3d')]=!![];queues[_0x26f5bd[_0x3307('0x41')]][_0x3307('0x42')]=_0x3307('0x43');queues[_0x26f5bd[_0x3307('0x41')]]['transferexten']=_0x26f5bd['extension'];queues[_0x26f5bd[_0x3307('0x41')]][_0x3307('0x44')]=_0x26f5bd['transfereeuniqueid'];queues[_0x26f5bd[_0x3307('0x41')]][_0x3307('0x8')]=_0x3307('0x45');utils[_0x3307('0x10')](util[_0x3307('0x2')](_0x3307('0x46'),_0x26f5bd[_0x3307('0x3')],queues[_0x26f5bd['transfereeuniqueid']][_0x3307('0x1a')],_0x26f5bd['transfereeuniqueid'],_0x26f5bd[_0x3307('0x47')]));}}catch(_0x4fec19){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x48'),_0x26f5bd[_0x3307('0x3')]),_0x4fec19);}};exports[_0x3307('0x49')]=function(_0xbc79bb){try{utils['debug'](util['format'](_0x3307('0x4a'),_0xbc79bb[_0x3307('0x4b')]),_0xbc79bb);if(_0xbc79bb['origtransfereruniqueid']==_0xbc79bb['origtransfererlinkedid']){if(!_[_0x3307('0x14')](queues[_0xbc79bb[_0x3307('0x4c')]])){utils[_0x3307('0x10')](util['format'](_0x3307('0x4d'),_0xbc79bb['origtransfereruniqueid'],queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x1a')],_0xbc79bb[_0x3307('0x4e')]));queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x3d')]=!![];queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x42')]='ATTENDED';queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x4f')]=_0xbc79bb['origtransfererexten'];queues[_0xbc79bb[_0x3307('0x4c')]]['transferuniqueid']=_0xbc79bb['origtransfereruniqueid'];queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x8')]=_0x3307('0x50');}if(!_[_0x3307('0x14')](queues[_0xbc79bb[_0x3307('0x51')]])){if(_0xbc79bb['transfereelinkedid']&&queues[_0xbc79bb['transfereelinkedid']]){queues[_0xbc79bb[_0x3307('0x52')]][_0x3307('0x1c')]=0x1;queues[_0xbc79bb[_0x3307('0x41')]]=_[_0x3307('0x53')](queues[_0xbc79bb[_0x3307('0x52')]]);queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0xc')]=_0xbc79bb[_0x3307('0x54')];queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0x1c')]=0x2;queues[_0xbc79bb[_0x3307('0x41')]]['calleridnum']=queues[_0xbc79bb['secondtransfererlinkedid']][_0x3307('0x6')];queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0x55')]=queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x55')];queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0x56')]=utils[_0x3307('0x12')]();queues[_0xbc79bb[_0x3307('0x41')]]['queuecallerleaveAt']=utils[_0x3307('0x12')]();queues[_0xbc79bb['transfereeuniqueid']][_0x3307('0x30')]=0x0;queues[_0xbc79bb[_0x3307('0x41')]]['mohtime']=0x0;utils[_0x3307('0x10')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb['transfereeuniqueid']][_0x3307('0x1a')],queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0x6')],queues[_0xbc79bb['transfereeuniqueid']][_0x3307('0x55')]));}else{utils['info'](util[_0x3307('0x2')](_0x3307('0x57'),_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x1a')],_0xbc79bb['secondtransfererlinkedid']));queues[_0xbc79bb['origtransfererlinkedid']][_0x3307('0xc')]=_0xbc79bb[_0x3307('0x4c')];}}}else if(_0xbc79bb[_0x3307('0x58')]==_0xbc79bb['secondtransfererlinkedid']){if(!_['isNil'](queues[_0xbc79bb[_0x3307('0x51')]])){utils[_0x3307('0x10')](util[_0x3307('0x2')](_0x3307('0x59'),_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb[_0x3307('0x51')]]['name'],_0xbc79bb['secondtransfereruniqueid'],_0xbc79bb['secondtransfererexten']));queues[_0xbc79bb['origtransfererlinkedid']][_0x3307('0x3d')]=!![];queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x42')]='ATTENDED';queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x4f')]=_0xbc79bb[_0x3307('0x5a')];queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x44')]=_0xbc79bb[_0x3307('0x58')];queues[_0xbc79bb['origtransfererlinkedid']][_0x3307('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x3307('0x14')](queues[_0xbc79bb[_0x3307('0x4c')]])){if(_0xbc79bb[_0x3307('0x5b')]&&queues[_0xbc79bb[_0x3307('0x5b')]]){queues[_0xbc79bb[_0x3307('0x5b')]][_0x3307('0x1c')]=0x1;queues[_0xbc79bb[_0x3307('0x54')]]=_[_0x3307('0x53')](queues[_0xbc79bb['transfertargetlinkedid']]);queues[_0xbc79bb[_0x3307('0x54')]]['transfereduniqueid']=_0xbc79bb[_0x3307('0x54')];queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x1c')]=0x2;queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x6')]=queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x6')];queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x55')]=queues[_0xbc79bb['origtransfererlinkedid']][_0x3307('0x55')];queues[_0xbc79bb[_0x3307('0x54')]]['queuecallerjoinAt']=utils[_0x3307('0x12')]();queues[_0xbc79bb['transfertargetuniqueid']][_0x3307('0x16')]=utils[_0x3307('0x12')]();queues[_0xbc79bb[_0x3307('0x54')]]['holdtime']=0x0;queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x5c')]=0x0;utils['info'](util[_0x3307('0x2')](_0x3307('0x5d'),_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb['transfertargetuniqueid']][_0x3307('0x1a')],queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0xc')],queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x6')],queues[_0xbc79bb['transfertargetuniqueid']][_0x3307('0x55')]));}else{utils[_0x3307('0x10')](util[_0x3307('0x2')](_0x3307('0x57'),_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb['secondtransfererlinkedid']][_0x3307('0x1a')],_0xbc79bb[_0x3307('0x51')]));queues[_0xbc79bb['secondtransfererlinkedid']][_0x3307('0xc')]=_0xbc79bb[_0x3307('0x51')];}}}}catch(_0x3ceadc){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x4a'),_0xbc79bb['origtransfereruniqueid']),_0x3ceadc);}};exports[_0x3307('0x5e')]=function(_0x310472){try{if(!_['isNil'](queues[_0x310472[_0x3307('0x3')]])){utils['debug'](util[_0x3307('0x2')](_0x3307('0x5f'),_0x310472[_0x3307('0x3')]),_0x310472);queues[_0x310472[_0x3307('0x3')]][_0x3307('0x60')]=utils[_0x3307('0x12')]();utils[_0x3307('0x10')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x310472[_0x3307('0x3')],queues[_0x310472[_0x3307('0x3')]][_0x3307('0x1a')],queues[_0x310472[_0x3307('0x3')]][_0x3307('0x60')]));}}catch(_0x382d6f){utils[_0x3307('0x13')](util['format']('[%s][queues][musiconholdstart]',_0x310472[_0x3307('0x3')]),_0x382d6f);}};exports[_0x3307('0x61')]=function(_0x5113b6){try{if(!_[_0x3307('0x14')](queues[_0x5113b6[_0x3307('0x3')]])){if(!_['isNil'](queues[_0x5113b6[_0x3307('0x3')]]['musiconholdstartAt'])){utils[_0x3307('0xe')](util[_0x3307('0x2')](_0x3307('0x62'),_0x5113b6[_0x3307('0x3')]),_0x5113b6);queues[_0x5113b6[_0x3307('0x3')]][_0x3307('0x5c')]+=utils[_0x3307('0x31')](utils['now'](),queues[_0x5113b6[_0x3307('0x3')]]['musiconholdstartAt']);utils['info'](util[_0x3307('0x2')](_0x3307('0x63'),_0x5113b6[_0x3307('0x3')],queues[_0x5113b6[_0x3307('0x3')]][_0x3307('0x1a')],queues[_0x5113b6[_0x3307('0x3')]][_0x3307('0x5c')]));delete queues[_0x5113b6[_0x3307('0x3')]][_0x3307('0x60')];}}}catch(_0x432a28){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x62'),_0x5113b6[_0x3307('0x3')]),_0x432a28);}}; \ No newline at end of file +var _0x9b02=['[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','isNil','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop'];(function(_0x15663d,_0xc4bd42){var _0x4c254e=function(_0x19fef3){while(--_0x19fef3){_0x15663d['push'](_0x15663d['shift']());}};_0x4c254e(++_0xc4bd42);}(_0x9b02,0x13e));var _0x29b0=function(_0x76009a,_0x407953){_0x76009a=_0x76009a-0x0;var _0x4f93f1=_0x9b02[_0x76009a];return _0x4f93f1;};'use strict';var _=require(_0x29b0('0x0'));var util=require(_0x29b0('0x1'));var utils=require(_0x29b0('0x2'));var queues={};function writeDB(_0x43841e){utils[_0x29b0('0x3')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x43841e[_0x29b0('0x4')],_0x43841e[_0x29b0('0x5')],_0x43841e['queue'],_0x43841e[_0x29b0('0x6')],_0x43841e[_0x29b0('0x7')],_0x43841e[_0x29b0('0x8')],_0x43841e[_0x29b0('0x9')]));if(_0x43841e[_0x29b0('0xa')]){utils['getVoiceQueueByName'](_0x43841e[_0x29b0('0xa')])[_0x29b0('0xb')](function(_0x5e6888){if(_0x5e6888){_0x43841e['type']=_0x5e6888[_0x29b0('0xc')];}utils[_0x29b0('0xd')]('CreateVoiceQueueReport',_0x43841e);});}else{utils['request'](_0x29b0('0xe'),_0x43841e);}if(_0x43841e[_0x29b0('0xf')]){delete queues[_0x43841e[_0x29b0('0xf')]];}else{delete queues[_0x43841e[_0x29b0('0x4')]];}}exports['queuecallerjoin']=function(_0x325e0c){try{utils[_0x29b0('0x10')](util[_0x29b0('0x11')](_0x29b0('0x12'),_0x325e0c['uniqueid']),_0x325e0c);utils['info'](util[_0x29b0('0x11')](_0x29b0('0x13'),_0x325e0c[_0x29b0('0x4')],_0x325e0c[_0x29b0('0xa')],_0x325e0c[_0x29b0('0x14')]));queues[_0x325e0c[_0x29b0('0x4')]]=_[_0x29b0('0x15')](_0x325e0c,{'originalposition':_0x325e0c[_0x29b0('0x14')],'queuecallerjoinAt':utils[_0x29b0('0x16')](),'mohtime':0x0});}catch(_0x959cc2){utils[_0x29b0('0x17')](util[_0x29b0('0x11')]('[%s][queues][queuecallerjoin]',_0x325e0c['uniqueid']),_0x959cc2);}};exports[_0x29b0('0x18')]=function(_0x266cd8){try{if(!_['isNil'](queues[_0x266cd8['uniqueid']])){utils[_0x29b0('0x10')](util[_0x29b0('0x11')](_0x29b0('0x19'),_0x266cd8[_0x29b0('0x4')]),_0x266cd8);if(queues[_0x266cd8[_0x29b0('0x4')]][_0x29b0('0x1a')]){if(!queues[_0x266cd8['uniqueid']][_0x29b0('0x1b')]&&!queues[_0x266cd8[_0x29b0('0x4')]][_0x29b0('0x1c')]){queues[_0x266cd8['uniqueid']][_0x29b0('0x1d')]=!![];queues[_0x266cd8['uniqueid']][_0x29b0('0x1e')]=utils[_0x29b0('0x16')]();queues[_0x266cd8['uniqueid']][_0x29b0('0x9')]=_0x29b0('0x1f');}utils['info'](util[_0x29b0('0x11')](_0x29b0('0x20'),_0x266cd8[_0x29b0('0x4')],queues[_0x266cd8[_0x29b0('0x4')]]['name'],queues[_0x266cd8[_0x29b0('0x4')]][_0x29b0('0x9')]));writeDB(queues[_0x266cd8[_0x29b0('0x4')]]);}else if(queues[_0x266cd8[_0x29b0('0x4')]]['transfereduniqueid']){utils[_0x29b0('0x3')](util[_0x29b0('0x11')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x266cd8['uniqueid'],queues[_0x266cd8[_0x29b0('0x4')]][_0x29b0('0x21')],queues[_0x266cd8['uniqueid']]['transfereduniqueid']));queues[queues[_0x266cd8[_0x29b0('0x4')]][_0x29b0('0xf')]]=queues[_0x266cd8[_0x29b0('0x4')]];queues[queues[_0x266cd8[_0x29b0('0x4')]]['transfereduniqueid']][_0x29b0('0x22')]=0x2;delete queues[_0x266cd8[_0x29b0('0x4')]];}}}catch(_0x490165){utils[_0x29b0('0x17')](util[_0x29b0('0x11')](_0x29b0('0x19'),_0x266cd8[_0x29b0('0x4')]),_0x490165);}};exports[_0x29b0('0x23')]=function(_0x40a790){try{utils['debug'](util['format'](_0x29b0('0x24'),_0x40a790[_0x29b0('0x4')]),_0x40a790);if(!_['isNil'](_0x40a790[_0x29b0('0x25')]['queuestatus'])&&_0x40a790[_0x29b0('0x26')][_0x29b0('0x27')]()!=='CONTINUE'){if(!_[_0x29b0('0x28')](queues[_0x40a790['uniqueid']])){queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x1b')]=![];queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x29')]=null;queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x1c')]=!![];queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x2a')]=utils['now']();queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x9')]=_0x40a790[_0x29b0('0x26')][_0x29b0('0x27')]();utils[_0x29b0('0x3')](util['format'](_0x29b0('0x2b'),_0x40a790[_0x29b0('0x4')],queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x21')],_0x40a790[_0x29b0('0x26')],queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x9')]));writeDB(queues[_0x40a790['uniqueid']]);}}else if(!_[_0x29b0('0x28')](_0x40a790[_0x29b0('0x25')][_0x29b0('0x2c')])){if(!_[_0x29b0('0x28')](queues[_0x40a790['uniqueid']])&&!queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x1b')]){queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x1b')]=![];queues[_0x40a790[_0x29b0('0x4')]]['queuecallerabandonAt']=null;queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x1c')]=!![];queues[_0x40a790[_0x29b0('0x4')]]['queuecallerexitAt']=utils[_0x29b0('0x16')]();queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x9')]=_0x29b0('0x2d');utils[_0x29b0('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x40a790[_0x29b0('0x4')],queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x21')],_0x40a790[_0x29b0('0x26')],queues[_0x40a790[_0x29b0('0x4')]][_0x29b0('0x9')]));}}}catch(_0x3d9c49){utils[_0x29b0('0x17')](util[_0x29b0('0x11')]('[%s][queues][varset]',_0x40a790['uniqueid']),_0x3d9c49);}};exports[_0x29b0('0x1b')]=function(_0x145e2a){try{if(!_[_0x29b0('0x28')](queues[_0x145e2a['uniqueid']])){utils[_0x29b0('0x10')](util[_0x29b0('0x11')](_0x29b0('0x2e'),_0x145e2a[_0x29b0('0x4')]),_0x145e2a);queues[_0x145e2a['uniqueid']][_0x29b0('0x1c')]=![];queues[_0x145e2a[_0x29b0('0x4')]][_0x29b0('0x2a')]=null;queues[_0x145e2a[_0x29b0('0x4')]][_0x29b0('0x1b')]=!![];queues[_0x145e2a[_0x29b0('0x4')]][_0x29b0('0x29')]=utils[_0x29b0('0x16')]();queues[_0x145e2a[_0x29b0('0x4')]][_0x29b0('0x9')]=_0x29b0('0x2f');utils['info'](util[_0x29b0('0x11')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x145e2a[_0x29b0('0x4')],queues[_0x145e2a['uniqueid']][_0x29b0('0x21')],queues[_0x145e2a['uniqueid']][_0x29b0('0x9')]));}}catch(_0x3368e8){utils[_0x29b0('0x17')](util[_0x29b0('0x11')](_0x29b0('0x2e'),_0x145e2a['uniqueid']),_0x3368e8);}};exports[_0x29b0('0x30')]=function(_0x53f046){try{if(!_[_0x29b0('0x28')](queues[_0x53f046['uniqueid']])){utils[_0x29b0('0x10')](util['format']('[%s][queues][queuecallerleave]',_0x53f046['uniqueid']),_0x53f046);utils['info'](util[_0x29b0('0x11')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x53f046[_0x29b0('0x4')],queues[_0x53f046[_0x29b0('0x4')]][_0x29b0('0x21')],_0x53f046[_0x29b0('0x31')],_0x53f046[_0x29b0('0x32')]));queues[_0x53f046[_0x29b0('0x4')]][_0x29b0('0x30')]=!![];queues[_0x53f046[_0x29b0('0x4')]][_0x29b0('0x1a')]=utils[_0x29b0('0x16')]();queues[_0x53f046[_0x29b0('0x4')]][_0x29b0('0x33')]=utils['diffTime'](queues[_0x53f046['uniqueid']][_0x29b0('0x1a')],queues[_0x53f046[_0x29b0('0x4')]][_0x29b0('0x34')]);queues[_0x53f046['uniqueid']][_0x29b0('0x14')]=_0x53f046['position'];queues[_0x53f046[_0x29b0('0x4')]][_0x29b0('0x35')]=_0x53f046[_0x29b0('0x35')];queues[_0x53f046[_0x29b0('0x4')]][_0x29b0('0x31')]=_0x53f046[_0x29b0('0x31')];queues[_0x53f046[_0x29b0('0x4')]][_0x29b0('0x32')]=_0x53f046[_0x29b0('0x32')];}}catch(_0x2f06b9){utils['error'](util[_0x29b0('0x11')](_0x29b0('0x36'),_0x53f046[_0x29b0('0x4')]),_0x2f06b9);}};exports[_0x29b0('0x37')]=function(_0x54b1e2){try{if(!_[_0x29b0('0x28')](queues[_0x54b1e2['uniqueid']])){utils[_0x29b0('0x10')](util[_0x29b0('0x11')](_0x29b0('0x38'),_0x54b1e2[_0x29b0('0x4')]),_0x54b1e2);utils[_0x29b0('0x3')](util[_0x29b0('0x11')](_0x29b0('0x39'),_0x54b1e2[_0x29b0('0x4')],queues[_0x54b1e2[_0x29b0('0x4')]][_0x29b0('0x21')],_0x54b1e2[_0x29b0('0x3a')],_0x54b1e2[_0x29b0('0x3b')]));queues[_0x54b1e2[_0x29b0('0x4')]][_0x29b0('0x1b')]=![];queues[_0x54b1e2[_0x29b0('0x4')]]['queuecallerabandon']=![];queues[_0x54b1e2[_0x29b0('0x4')]][_0x29b0('0x29')]=null;queues[_0x54b1e2['uniqueid']][_0x29b0('0x1c')]=![];queues[_0x54b1e2[_0x29b0('0x4')]][_0x29b0('0x9')]=null;queues[_0x54b1e2['uniqueid']][_0x29b0('0x2a')]=null;queues[_0x54b1e2['uniqueid']][_0x29b0('0x3c')]=!![];queues[_0x54b1e2[_0x29b0('0x4')]]['accountcode']=_0x54b1e2[_0x29b0('0x3b')];queues[_0x54b1e2[_0x29b0('0x4')]][_0x29b0('0x6')]=_0x54b1e2[_0x29b0('0x3a')];}}catch(_0x3a466c){utils['error'](util[_0x29b0('0x11')]('[%s][queues][agentconnect]',_0x54b1e2['uniqueid']),_0x3a466c);}};exports[_0x29b0('0x3d')]=function(_0x111b5e){try{if(!_[_0x29b0('0x28')](queues[_0x111b5e[_0x29b0('0x4')]])){if(queues[_0x111b5e['uniqueid']][_0x29b0('0x1a')]){utils[_0x29b0('0x10')](util[_0x29b0('0x11')](_0x29b0('0x3e'),_0x111b5e[_0x29b0('0x4')]),_0x111b5e);queues[_0x111b5e[_0x29b0('0x4')]]['queuecallerabandon']=![];queues[_0x111b5e[_0x29b0('0x4')]]['queuecallerabandon']=![];queues[_0x111b5e[_0x29b0('0x4')]]['queuecallerabandonAt']=null;queues[_0x111b5e[_0x29b0('0x4')]][_0x29b0('0x1c')]=![];queues[_0x111b5e[_0x29b0('0x4')]][_0x29b0('0x2a')]=null;queues[_0x111b5e['uniqueid']][_0x29b0('0x3c')]=!![];queues[_0x111b5e[_0x29b0('0x4')]][_0x29b0('0x6')]=_0x111b5e[_0x29b0('0x3a')];queues[_0x111b5e[_0x29b0('0x4')]][_0x29b0('0x1d')]=!![];queues[_0x111b5e[_0x29b0('0x4')]][_0x29b0('0x1e')]=utils['now']();if(_0x111b5e[_0x29b0('0x3f')]==_0x29b0('0x40')){if(!queues[_0x111b5e[_0x29b0('0x4')]][_0x29b0('0x40')]){queues[_0x111b5e['uniqueid']][_0x29b0('0x9')]=_0x29b0('0x41');}}else{queues[_0x111b5e[_0x29b0('0x4')]][_0x29b0('0x9')]=_0x29b0('0x42')+_0x111b5e[_0x29b0('0x3f')]['toUpperCase']();}utils[_0x29b0('0x3')](util[_0x29b0('0x11')](_0x29b0('0x43'),_0x111b5e[_0x29b0('0x4')],queues[_0x111b5e['uniqueid']][_0x29b0('0x21')],_0x111b5e[_0x29b0('0x3a')],queues[_0x111b5e[_0x29b0('0x4')]][_0x29b0('0x9')]));writeDB(queues[_0x111b5e[_0x29b0('0x4')]]);}}}catch(_0x3cb77c){utils[_0x29b0('0x17')](util[_0x29b0('0x11')](_0x29b0('0x3e'),_0x111b5e[_0x29b0('0x4')]),_0x3cb77c);}};exports[_0x29b0('0x44')]=function(_0x12a6c3){try{if(!_[_0x29b0('0x28')](queues[_0x12a6c3['transfereeuniqueid']])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x12a6c3[_0x29b0('0x4')]),_0x12a6c3);queues[_0x12a6c3[_0x29b0('0x45')]][_0x29b0('0x40')]=!![];queues[_0x12a6c3[_0x29b0('0x45')]][_0x29b0('0x46')]=_0x29b0('0x47');queues[_0x12a6c3[_0x29b0('0x45')]][_0x29b0('0x48')]=_0x12a6c3[_0x29b0('0x49')];queues[_0x12a6c3['transfereeuniqueid']][_0x29b0('0x4a')]=_0x12a6c3[_0x29b0('0x45')];queues[_0x12a6c3[_0x29b0('0x45')]][_0x29b0('0x9')]=_0x29b0('0x4b');utils[_0x29b0('0x3')](util[_0x29b0('0x11')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x12a6c3[_0x29b0('0x4')],queues[_0x12a6c3[_0x29b0('0x45')]][_0x29b0('0x21')],_0x12a6c3[_0x29b0('0x45')],_0x12a6c3[_0x29b0('0x49')]));}}catch(_0x2c235b){utils[_0x29b0('0x17')](util['format'](_0x29b0('0x4c'),_0x12a6c3[_0x29b0('0x4')]),_0x2c235b);}};exports[_0x29b0('0x4d')]=function(_0x4204c9){try{utils[_0x29b0('0x10')](util[_0x29b0('0x11')](_0x29b0('0x4e'),_0x4204c9[_0x29b0('0x4f')]),_0x4204c9);if(_0x4204c9[_0x29b0('0x4f')]==_0x4204c9[_0x29b0('0x50')]){if(!_[_0x29b0('0x28')](queues[_0x4204c9['secondtransfererlinkedid']])){utils[_0x29b0('0x3')](util['format'](_0x29b0('0x51'),_0x4204c9[_0x29b0('0x4f')],queues[_0x4204c9['secondtransfererlinkedid']][_0x29b0('0x21')],_0x4204c9['origtransfererexten']));queues[_0x4204c9[_0x29b0('0x52')]][_0x29b0('0x40')]=!![];queues[_0x4204c9[_0x29b0('0x52')]][_0x29b0('0x46')]=_0x29b0('0x53');queues[_0x4204c9[_0x29b0('0x52')]]['transferexten']=_0x4204c9[_0x29b0('0x54')];queues[_0x4204c9[_0x29b0('0x52')]][_0x29b0('0x4a')]=_0x4204c9[_0x29b0('0x4f')];queues[_0x4204c9[_0x29b0('0x52')]]['queuecallerexitreason']=_0x29b0('0x55');}if(!_[_0x29b0('0x28')](queues[_0x4204c9[_0x29b0('0x50')]])){if(_0x4204c9[_0x29b0('0x56')]&&queues[_0x4204c9['transfereelinkedid']]){queues[_0x4204c9[_0x29b0('0x56')]][_0x29b0('0x22')]=0x1;queues[_0x4204c9['transfereeuniqueid']]=_['clone'](queues[_0x4204c9[_0x29b0('0x56')]]);queues[_0x4204c9[_0x29b0('0x45')]][_0x29b0('0xf')]=_0x4204c9[_0x29b0('0x57')];queues[_0x4204c9[_0x29b0('0x45')]][_0x29b0('0x22')]=0x2;queues[_0x4204c9[_0x29b0('0x45')]][_0x29b0('0x7')]=queues[_0x4204c9[_0x29b0('0x52')]]['calleridnum'];queues[_0x4204c9['transfereeuniqueid']][_0x29b0('0x58')]=queues[_0x4204c9[_0x29b0('0x52')]][_0x29b0('0x58')];queues[_0x4204c9['transfereeuniqueid']][_0x29b0('0x34')]=utils['now']();queues[_0x4204c9['transfereeuniqueid']][_0x29b0('0x1a')]=utils[_0x29b0('0x16')]();queues[_0x4204c9[_0x29b0('0x45')]]['holdtime']=0x0;queues[_0x4204c9['transfereeuniqueid']][_0x29b0('0x59')]=0x0;utils['info'](util[_0x29b0('0x11')](_0x29b0('0x5a'),_0x4204c9[_0x29b0('0x4f')],queues[_0x4204c9[_0x29b0('0x45')]][_0x29b0('0x21')],queues[_0x4204c9[_0x29b0('0x45')]][_0x29b0('0x7')],queues[_0x4204c9[_0x29b0('0x45')]][_0x29b0('0x58')]));}else{utils['info'](util[_0x29b0('0x11')](_0x29b0('0x5b'),_0x4204c9[_0x29b0('0x4f')],queues[_0x4204c9[_0x29b0('0x50')]]['name'],_0x4204c9[_0x29b0('0x52')]));queues[_0x4204c9[_0x29b0('0x50')]][_0x29b0('0xf')]=_0x4204c9[_0x29b0('0x52')];}}}else if(_0x4204c9[_0x29b0('0x5c')]==_0x4204c9['secondtransfererlinkedid']){if(!_[_0x29b0('0x28')](queues[_0x4204c9[_0x29b0('0x50')]])){utils[_0x29b0('0x3')](util[_0x29b0('0x11')](_0x29b0('0x5d'),_0x4204c9[_0x29b0('0x4f')],queues[_0x4204c9[_0x29b0('0x50')]][_0x29b0('0x21')],_0x4204c9[_0x29b0('0x5c')],_0x4204c9[_0x29b0('0x5e')]));queues[_0x4204c9['origtransfererlinkedid']][_0x29b0('0x40')]=!![];queues[_0x4204c9[_0x29b0('0x50')]][_0x29b0('0x46')]=_0x29b0('0x53');queues[_0x4204c9[_0x29b0('0x50')]][_0x29b0('0x48')]=_0x4204c9['secondtransfererexten'];queues[_0x4204c9['origtransfererlinkedid']][_0x29b0('0x4a')]=_0x4204c9[_0x29b0('0x5c')];queues[_0x4204c9[_0x29b0('0x50')]][_0x29b0('0x9')]=_0x29b0('0x55');}if(!_[_0x29b0('0x28')](queues[_0x4204c9[_0x29b0('0x52')]])){if(_0x4204c9[_0x29b0('0x5f')]&&queues[_0x4204c9[_0x29b0('0x5f')]]){queues[_0x4204c9['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x4204c9[_0x29b0('0x57')]]=_[_0x29b0('0x60')](queues[_0x4204c9[_0x29b0('0x5f')]]);queues[_0x4204c9[_0x29b0('0x57')]][_0x29b0('0xf')]=_0x4204c9[_0x29b0('0x57')];queues[_0x4204c9[_0x29b0('0x57')]][_0x29b0('0x22')]=0x2;queues[_0x4204c9[_0x29b0('0x57')]][_0x29b0('0x7')]=queues[_0x4204c9[_0x29b0('0x50')]]['calleridnum'];queues[_0x4204c9['transfertargetuniqueid']][_0x29b0('0x58')]=queues[_0x4204c9['origtransfererlinkedid']][_0x29b0('0x58')];queues[_0x4204c9[_0x29b0('0x57')]][_0x29b0('0x34')]=utils['now']();queues[_0x4204c9[_0x29b0('0x57')]][_0x29b0('0x1a')]=utils[_0x29b0('0x16')]();queues[_0x4204c9['transfertargetuniqueid']][_0x29b0('0x33')]=0x0;queues[_0x4204c9[_0x29b0('0x57')]][_0x29b0('0x59')]=0x0;utils[_0x29b0('0x3')](util[_0x29b0('0x11')](_0x29b0('0x61'),_0x4204c9[_0x29b0('0x4f')],queues[_0x4204c9[_0x29b0('0x57')]][_0x29b0('0x21')],queues[_0x4204c9[_0x29b0('0x57')]][_0x29b0('0xf')],queues[_0x4204c9['transfertargetuniqueid']][_0x29b0('0x7')],queues[_0x4204c9['transfertargetuniqueid']]['calleridname']));}else{utils[_0x29b0('0x3')](util[_0x29b0('0x11')](_0x29b0('0x5b'),_0x4204c9[_0x29b0('0x4f')],queues[_0x4204c9[_0x29b0('0x52')]][_0x29b0('0x21')],_0x4204c9[_0x29b0('0x50')]));queues[_0x4204c9[_0x29b0('0x52')]]['transfereduniqueid']=_0x4204c9[_0x29b0('0x50')];}}}}catch(_0x5aed99){utils[_0x29b0('0x17')](util['format']('[%s][queues][attendedtransfer]',_0x4204c9[_0x29b0('0x4f')]),_0x5aed99);}};exports['musiconholdstart']=function(_0x53f41b){try{if(!_[_0x29b0('0x28')](queues[_0x53f41b[_0x29b0('0x4')]])){utils[_0x29b0('0x10')](util[_0x29b0('0x11')]('[%s][queues][musiconholdstart]',_0x53f41b[_0x29b0('0x4')]),_0x53f41b);queues[_0x53f41b[_0x29b0('0x4')]][_0x29b0('0x62')]=utils['now']();utils['info'](util[_0x29b0('0x11')](_0x29b0('0x63'),_0x53f41b[_0x29b0('0x4')],queues[_0x53f41b['uniqueid']][_0x29b0('0x21')],queues[_0x53f41b['uniqueid']]['musiconholdstartAt']));}}catch(_0x1e1ed4){utils[_0x29b0('0x17')](util[_0x29b0('0x11')](_0x29b0('0x64'),_0x53f41b[_0x29b0('0x4')]),_0x1e1ed4);}};exports[_0x29b0('0x65')]=function(_0xaaa0b6){try{if(!_['isNil'](queues[_0xaaa0b6[_0x29b0('0x4')]])){if(!_['isNil'](queues[_0xaaa0b6[_0x29b0('0x4')]][_0x29b0('0x62')])){utils[_0x29b0('0x10')](util[_0x29b0('0x11')](_0x29b0('0x66'),_0xaaa0b6[_0x29b0('0x4')]),_0xaaa0b6);queues[_0xaaa0b6[_0x29b0('0x4')]][_0x29b0('0x59')]+=utils[_0x29b0('0x67')](utils['now'](),queues[_0xaaa0b6[_0x29b0('0x4')]][_0x29b0('0x62')]);utils[_0x29b0('0x3')](util[_0x29b0('0x11')](_0x29b0('0x68'),_0xaaa0b6['uniqueid'],queues[_0xaaa0b6[_0x29b0('0x4')]][_0x29b0('0x21')],queues[_0xaaa0b6[_0x29b0('0x4')]]['mohtime']));delete queues[_0xaaa0b6[_0x29b0('0x4')]]['musiconholdstartAt'];}}}catch(_0x131930){utils['error'](util[_0x29b0('0x11')]('[%s][queues][musiconholdstop]',_0xaaa0b6['uniqueid']),_0x131930);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5029e5f..dbe5caf 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 _0x2d76=['uniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','error','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','variable','mixmonitor_filename','value','replace','.wav49','.WAV','find','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d76,0xeb));var _0x62d7=function(_0xeafe71,_0x4c7f64){_0xeafe71=_0xeafe71-0x0;var _0x35f1a=_0x2d76[_0xeafe71];return _0x35f1a;};'use strict';var _=require(_0x62d7('0x0'));var util=require(_0x62d7('0x1'));var utils=require(_0x62d7('0x2'));var recordings={};function writeDB(_0x50cb92){utils[_0x62d7('0x3')](util[_0x62d7('0x4')]('[%s][recordings][writeDB]',_0x50cb92[_0x62d7('0x5')]));if(_0x50cb92[_0x62d7('0x6')]){utils[_0x62d7('0x7')](_0x50cb92[_0x62d7('0x6')])[_0x62d7('0x8')](function(_0x353428){if(_0x353428){_0x50cb92[_0x62d7('0x9')]=_0x353428[_0x62d7('0xa')];_0x50cb92['UserId']=_0x353428['id'];}utils[_0x62d7('0xb')](_0x62d7('0xc'),_0x50cb92);});}else{utils['request'](_0x62d7('0xc'),_0x50cb92);}}exports['newchannel']=function(_0x3190ba){try{utils[_0x62d7('0xd')](util[_0x62d7('0x4')](_0x62d7('0xe'),_0x3190ba[_0x62d7('0x5')]),_0x3190ba);if(_0x3190ba['uniqueid']==_0x3190ba[_0x62d7('0xf')]){utils[_0x62d7('0x3')](util[_0x62d7('0x4')](_0x62d7('0x10'),_0x3190ba[_0x62d7('0x5')],_0x3190ba[_0x62d7('0x11')],_0x3190ba['exten']));recordings[_0x3190ba[_0x62d7('0x5')]]={'uniqueid':_0x3190ba['uniqueid'],'accountcode':_0x3190ba[_0x62d7('0x6')],'exten':_0x3190ba['exten'],'context':_0x3190ba[_0x62d7('0x11')],'channel':_0x3190ba[_0x62d7('0x12')],'monitors':[]};}}catch(_0x26f5dc){utils[_0x62d7('0x13')](util[_0x62d7('0x4')]('[%s][recordings][newchannel]',_0x3190ba[_0x62d7('0x5')]),_0x26f5dc);}};exports['newstate']=function(_0x40f3b6){try{utils['debug'](util[_0x62d7('0x4')](_0x62d7('0x14'),_0x40f3b6['uniqueid']),_0x40f3b6);if(!_['isNil'](recordings[_0x40f3b6[_0x62d7('0x5')]])&&_0x40f3b6[_0x62d7('0x15')]==0x6){utils[_0x62d7('0x3')](util[_0x62d7('0x4')](_0x62d7('0x16'),_0x40f3b6[_0x62d7('0x5')],_0x40f3b6[_0x62d7('0x11')],_0x40f3b6[_0x62d7('0x12')]));}else if(!_[_0x62d7('0x17')](recordings[_0x40f3b6[_0x62d7('0xf')]])&&_0x40f3b6[_0x62d7('0x15')]==0x6&&_0x40f3b6[_0x62d7('0x11')]!=_0x62d7('0x18')){utils[_0x62d7('0x3')](util[_0x62d7('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x40f3b6[_0x62d7('0x5')],_0x40f3b6[_0x62d7('0xf')],_0x40f3b6[_0x62d7('0x11')],_0x40f3b6[_0x62d7('0x12')]));recordings[_0x40f3b6['linkedid']][_0x62d7('0x6')]=_0x40f3b6[_0x62d7('0x6')];}}catch(_0x74b22b){utils['error'](util[_0x62d7('0x4')](_0x62d7('0x14'),_0x40f3b6['uniqueid']),_0x74b22b);}};exports['varset']=function(_0x5de132){try{if(!_[_0x62d7('0x17')](_0x5de132[_0x62d7('0x19')])&&!_['isNil'](_0x5de132['variable'][_0x62d7('0x1a')])){utils[_0x62d7('0xd')](util[_0x62d7('0x4')]('[%s][recordings][varset]',_0x5de132[_0x62d7('0x5')]),_0x5de132);utils[_0x62d7('0x3')](util[_0x62d7('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5de132[_0x62d7('0x5')],_0x5de132[_0x62d7('0x19')],_0x5de132[_0x62d7('0x1b')]));if(_['endsWith'](_0x5de132[_0x62d7('0x1b')],'.wav49')){_0x5de132[_0x62d7('0x1b')]=_0x5de132[_0x62d7('0x1b')][_0x62d7('0x1c')](_0x62d7('0x1d'),_0x62d7('0x1e'));}if(recordings[_0x5de132['linkedid']]){var _0x22dfed=_[_0x62d7('0x1f')](recordings[_0x5de132[_0x62d7('0xf')]]['monitors'],{'value':_0x5de132['value']});if(_['isNil'](_0x22dfed)){recordings[_0x5de132['linkedid']][_0x62d7('0x20')]['push']({'value':_0x5de132[_0x62d7('0x1b')]});}}}}catch(_0x113a5c){utils[_0x62d7('0x13')](util[_0x62d7('0x4')](_0x62d7('0x21'),_0x5de132[_0x62d7('0x5')]),_0x113a5c);}};exports[_0x62d7('0x22')]=function(_0xe60217){try{if(!_[_0x62d7('0x17')](recordings[_0xe60217['uniqueid']])){utils[_0x62d7('0xd')](util[_0x62d7('0x4')](_0x62d7('0x23'),_0xe60217[_0x62d7('0x5')]),_0xe60217);utils[_0x62d7('0x3')](util[_0x62d7('0x4')](_0x62d7('0x24'),_0xe60217['uniqueid'],_0xe60217[_0x62d7('0x25')],_0xe60217['calleridname'],_0xe60217[_0x62d7('0x26')]));recordings[_0xe60217[_0x62d7('0x5')]][_0x62d7('0x25')]=_0xe60217[_0x62d7('0x25')];recordings[_0xe60217[_0x62d7('0x5')]]['calleridname']=_0xe60217[_0x62d7('0x27')];recordings[_0xe60217['uniqueid']][_0x62d7('0x28')]=_0xe60217['connectedlinenum'];recordings[_0xe60217['uniqueid']][_0x62d7('0x29')]=_0xe60217[_0x62d7('0x29')];if(recordings[_0xe60217['uniqueid']][_0x62d7('0x2a')]==_0x62d7('0x2b')&&recordings[_0xe60217['uniqueid']][_0x62d7('0x6')]){recordings[_0xe60217[_0x62d7('0x5')]][_0x62d7('0x28')]=recordings[_0xe60217[_0x62d7('0x5')]][_0x62d7('0x6')];recordings[_0xe60217[_0x62d7('0x5')]][_0x62d7('0x29')]='';}recordings[_0xe60217['uniqueid']][_0x62d7('0x20')][_0x62d7('0x2c')](function(_0x386d28){var _0x15dec6=_[_0x62d7('0x2d')](recordings[_0xe60217[_0x62d7('0x5')]]);_0x15dec6['value']=_0x386d28[_0x62d7('0x1b')];writeDB(_0x15dec6);});delete recordings[_0xe60217['uniqueid']];}}catch(_0xa2a5d7){utils[_0x62d7('0x13')](util['format'](_0x62d7('0x23'),_0xe60217[_0x62d7('0x5')]),_0xa2a5d7);}};exports[_0x62d7('0x2e')]=function(_0x2f0356){try{if(!_[_0x62d7('0x17')](recordings[_0x2f0356['uniqueid']])){utils[_0x62d7('0xd')](util['format'](_0x62d7('0x2f'),_0x2f0356['uniqueid']),_0x2f0356);utils['info'](util[_0x62d7('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x2f0356[_0x62d7('0x5')],_0x2f0356[_0x62d7('0x30')],_0x2f0356[_0x62d7('0x31')]));if(_0x2f0356['application'][_0x62d7('0x32')]()==_0x62d7('0x33')&&_['startsWith'](_0x2f0356['appdata'][_0x62d7('0x32')](),_0x62d7('0x34'))){var _0x3b7fd7=_0x2f0356[_0x62d7('0x31')][_0x62d7('0x35')]('=');var _0x4ced10=_0x3b7fd7[0x0][_0x62d7('0x36')](_0x3b7fd7[0x0][_0x62d7('0x37')]('(')+0x1,_0x3b7fd7[0x0][_0x62d7('0x37')](')'));var _0x42e171=_0x3b7fd7[0x1];recordings[_0x2f0356[_0x62d7('0x5')]][_0x4ced10]=_0x42e171;}}}catch(_0x5d029e){utils[_0x62d7('0x13')](util[_0x62d7('0x4')](_0x62d7('0x2f'),_0x2f0356['uniqueid']),_0x5d029e);}};exports[_0x62d7('0x38')]=function(_0x5e10d2){try{if(!_[_0x62d7('0x17')](recordings[_0x5e10d2[_0x62d7('0x5')]])){utils['debug'](util[_0x62d7('0x4')](_0x62d7('0x39'),_0x5e10d2[_0x62d7('0x5')]),_0x5e10d2);utils[_0x62d7('0x3')](util[_0x62d7('0x4')](_0x62d7('0x3a'),_0x5e10d2[_0x62d7('0x5')],_0x5e10d2[_0x62d7('0x3b')]));recordings[_0x5e10d2[_0x62d7('0x5')]][_0x62d7('0x3b')]=_0x5e10d2[_0x62d7('0x3b')];}}catch(_0x23a803){utils[_0x62d7('0x13')](util['format']('[%s][recordings][queuecallerjoin]',_0x5e10d2['uniqueid']),_0x23a803);}}; \ No newline at end of file +var _0x6467=['connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','application','toLowerCase','startsWith','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','UserId','request','newchannel','debug','format','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum'];(function(_0x271973,_0x5e74cb){var _0x3e6f96=function(_0x35251b){while(--_0x35251b){_0x271973['push'](_0x271973['shift']());}};_0x3e6f96(++_0x5e74cb);}(_0x6467,0x87));var _0x7646=function(_0x31d06e,_0xf8e8db){_0x31d06e=_0x31d06e-0x0;var _0x470a15=_0x6467[_0x31d06e];return _0x470a15;};'use strict';var _=require(_0x7646('0x0'));var util=require(_0x7646('0x1'));var utils=require(_0x7646('0x2'));var recordings={};function writeDB(_0x62e49f){utils[_0x7646('0x3')](util['format'](_0x7646('0x4'),_0x62e49f['uniqueid']));if(_0x62e49f[_0x7646('0x5')]){utils[_0x7646('0x6')](_0x62e49f[_0x7646('0x5')])[_0x7646('0x7')](function(_0x541ed2){if(_0x541ed2){_0x62e49f['membername']=_0x541ed2['name'];_0x62e49f[_0x7646('0x8')]=_0x541ed2['id'];}utils[_0x7646('0x9')]('CreateVoiceRecording',_0x62e49f);});}else{utils[_0x7646('0x9')]('CreateVoiceRecording',_0x62e49f);}}exports[_0x7646('0xa')]=function(_0x4b1ad9){try{utils[_0x7646('0xb')](util[_0x7646('0xc')](_0x7646('0xd'),_0x4b1ad9[_0x7646('0xe')]),_0x4b1ad9);if(_0x4b1ad9['uniqueid']==_0x4b1ad9[_0x7646('0xf')]){utils[_0x7646('0x3')](util[_0x7646('0xc')](_0x7646('0x10'),_0x4b1ad9[_0x7646('0xe')],_0x4b1ad9[_0x7646('0x11')],_0x4b1ad9[_0x7646('0x12')]));recordings[_0x4b1ad9[_0x7646('0xe')]]={'uniqueid':_0x4b1ad9[_0x7646('0xe')],'accountcode':_0x4b1ad9['accountcode'],'exten':_0x4b1ad9['exten'],'context':_0x4b1ad9[_0x7646('0x11')],'channel':_0x4b1ad9[_0x7646('0x13')],'monitors':[]};}}catch(_0x5b60d4){utils[_0x7646('0x14')](util[_0x7646('0xc')](_0x7646('0xd'),_0x4b1ad9[_0x7646('0xe')]),_0x5b60d4);}};exports[_0x7646('0x15')]=function(_0x58fd9b){try{utils[_0x7646('0xb')](util[_0x7646('0xc')](_0x7646('0x16'),_0x58fd9b['uniqueid']),_0x58fd9b);if(!_[_0x7646('0x17')](recordings[_0x58fd9b[_0x7646('0xe')]])&&_0x58fd9b[_0x7646('0x18')]==0x6){utils[_0x7646('0x3')](util[_0x7646('0xc')](_0x7646('0x19'),_0x58fd9b['uniqueid'],_0x58fd9b['context'],_0x58fd9b[_0x7646('0x13')]));}else if(!_[_0x7646('0x17')](recordings[_0x58fd9b[_0x7646('0xf')]])&&_0x58fd9b[_0x7646('0x18')]==0x6&&_0x58fd9b['context']!=_0x7646('0x1a')){utils[_0x7646('0x3')](util[_0x7646('0xc')](_0x7646('0x1b'),_0x58fd9b[_0x7646('0xe')],_0x58fd9b[_0x7646('0xf')],_0x58fd9b[_0x7646('0x11')],_0x58fd9b[_0x7646('0x13')]));recordings[_0x58fd9b['linkedid']][_0x7646('0x5')]=_0x58fd9b['accountcode'];}}catch(_0x305a54){utils['error'](util[_0x7646('0xc')](_0x7646('0x16'),_0x58fd9b[_0x7646('0xe')]),_0x305a54);}};exports['varset']=function(_0x530a1a){try{if(!_[_0x7646('0x17')](_0x530a1a[_0x7646('0x1c')])&&!_[_0x7646('0x17')](_0x530a1a['variable'][_0x7646('0x1d')])){utils[_0x7646('0xb')](util[_0x7646('0xc')](_0x7646('0x1e'),_0x530a1a['uniqueid']),_0x530a1a);utils[_0x7646('0x3')](util['format'](_0x7646('0x1f'),_0x530a1a['uniqueid'],_0x530a1a[_0x7646('0x1c')],_0x530a1a[_0x7646('0x20')]));if(_[_0x7646('0x21')](_0x530a1a['value'],'.wav49')){_0x530a1a[_0x7646('0x20')]=_0x530a1a[_0x7646('0x20')][_0x7646('0x22')](_0x7646('0x23'),_0x7646('0x24'));}if(recordings[_0x530a1a[_0x7646('0xf')]]){var _0x44d184=_[_0x7646('0x25')](recordings[_0x530a1a[_0x7646('0xf')]][_0x7646('0x26')],{'value':_0x530a1a['value']});if(_[_0x7646('0x17')](_0x44d184)){recordings[_0x530a1a['linkedid']][_0x7646('0x26')][_0x7646('0x27')]({'value':_0x530a1a[_0x7646('0x20')]});}}}}catch(_0x5e5351){utils[_0x7646('0x14')](util[_0x7646('0xc')](_0x7646('0x1e'),_0x530a1a[_0x7646('0xe')]),_0x5e5351);}};exports['hangup']=function(_0x383025){try{if(!_[_0x7646('0x17')](recordings[_0x383025[_0x7646('0xe')]])){utils[_0x7646('0xb')](util[_0x7646('0xc')]('[%s][recordings][hangup]',_0x383025[_0x7646('0xe')]),_0x383025);utils[_0x7646('0x3')](util['format'](_0x7646('0x28'),_0x383025['uniqueid'],_0x383025[_0x7646('0x29')],_0x383025['calleridname'],_0x383025[_0x7646('0x2a')]));recordings[_0x383025['uniqueid']][_0x7646('0x29')]=_0x383025[_0x7646('0x29')];recordings[_0x383025[_0x7646('0xe')]][_0x7646('0x2b')]=_0x383025['calleridname'];recordings[_0x383025['uniqueid']][_0x7646('0x2c')]=_0x383025['connectedlinenum'];recordings[_0x383025[_0x7646('0xe')]][_0x7646('0x2d')]=_0x383025[_0x7646('0x2d')];if(recordings[_0x383025[_0x7646('0xe')]][_0x7646('0x2e')]==_0x7646('0x2f')&&recordings[_0x383025[_0x7646('0xe')]]['accountcode']){recordings[_0x383025['uniqueid']][_0x7646('0x2c')]=recordings[_0x383025['uniqueid']][_0x7646('0x5')];recordings[_0x383025[_0x7646('0xe')]][_0x7646('0x2d')]='';}recordings[_0x383025[_0x7646('0xe')]][_0x7646('0x26')][_0x7646('0x30')](function(_0x437b57){var _0x512a21=_['clone'](recordings[_0x383025[_0x7646('0xe')]]);_0x512a21['value']=_0x437b57[_0x7646('0x20')];writeDB(_0x512a21);});delete recordings[_0x383025[_0x7646('0xe')]];}}catch(_0x20322d){utils['error'](util[_0x7646('0xc')](_0x7646('0x31'),_0x383025[_0x7646('0xe')]),_0x20322d);}};exports[_0x7646('0x32')]=function(_0x1f6fe1){try{if(!_[_0x7646('0x17')](recordings[_0x1f6fe1[_0x7646('0xe')]])){utils[_0x7646('0xb')](util[_0x7646('0xc')](_0x7646('0x33'),_0x1f6fe1[_0x7646('0xe')]),_0x1f6fe1);utils[_0x7646('0x3')](util[_0x7646('0xc')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1f6fe1[_0x7646('0xe')],_0x1f6fe1[_0x7646('0x34')],_0x1f6fe1['appdata']));if(_0x1f6fe1[_0x7646('0x34')][_0x7646('0x35')]()=='set'&&_[_0x7646('0x36')](_0x1f6fe1['appdata'][_0x7646('0x35')](),'cdr')){var _0x4f6e12=_0x1f6fe1['appdata']['split']('=');var _0x8f13ea=_0x4f6e12[0x0]['substring'](_0x4f6e12[0x0][_0x7646('0x37')]('(')+0x1,_0x4f6e12[0x0]['lastIndexOf'](')'));var _0x6ca051=_0x4f6e12[0x1];recordings[_0x1f6fe1['uniqueid']][_0x8f13ea]=_0x6ca051;}}}catch(_0x3bbe31){utils[_0x7646('0x14')](util[_0x7646('0xc')](_0x7646('0x33'),_0x1f6fe1['uniqueid']),_0x3bbe31);}};exports[_0x7646('0x38')]=function(_0x563556){try{if(!_[_0x7646('0x17')](recordings[_0x563556[_0x7646('0xe')]])){utils[_0x7646('0xb')](util[_0x7646('0xc')](_0x7646('0x39'),_0x563556[_0x7646('0xe')]),_0x563556);utils[_0x7646('0x3')](util[_0x7646('0xc')](_0x7646('0x3a'),_0x563556[_0x7646('0xe')],_0x563556[_0x7646('0x3b')]));recordings[_0x563556[_0x7646('0xe')]][_0x7646('0x3b')]=_0x563556['queue'];}}catch(_0x57e473){utils[_0x7646('0x14')](util[_0x7646('0xc')](_0x7646('0x39'),_0x563556[_0x7646('0xe')]),_0x57e473);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 73f7335..4c08c9f 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 _0x7130=['transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','transferercalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0x7130,0x1a7));var _0x0713=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7130[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x0713('0x0'));var util=require(_0x0713('0x1'));var utils=require('./utils');function writeDB(_0x1deef1){utils[_0x0713('0x2')](util[_0x0713('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x1deef1[_0x0713('0x4')]===_0x0713('0x5')?_0x1deef1[_0x0713('0x6')]:_0x1deef1[_0x0713('0x7')],_0x1deef1[_0x0713('0x4')]));utils[_0x0713('0x8')](_0x0713('0x9'),_0x1deef1);}exports['blindtransfer']=function(_0x332e6a){try{utils[_0x0713('0xa')](util[_0x0713('0x3')](_0x0713('0xb'),_0x332e6a[_0x0713('0x7')]),_0x332e6a);utils[_0x0713('0x2')](util[_0x0713('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x332e6a[_0x0713('0x7')],_0x332e6a[_0x0713('0xc')],_0x332e6a['transferercalleridname'],_0x332e6a['transfereecalleridnum'],_0x332e6a['transfereecalleridname']));_0x332e6a[_0x0713('0x4')]=_0x0713('0xd');writeDB(_0x332e6a);}catch(_0x5a6ada){utils[_0x0713('0xe')](util[_0x0713('0x3')](_0x0713('0xb'),_0x332e6a[_0x0713('0x7')]),_0x5a6ada);}};exports[_0x0713('0xf')]=function(_0x2ffc09){try{utils[_0x0713('0xa')](util[_0x0713('0x3')](_0x0713('0x10'),_0x2ffc09[_0x0713('0x6')]),_0x2ffc09);utils['info'](util[_0x0713('0x3')](_0x0713('0x11'),_0x2ffc09[_0x0713('0x6')],_0x2ffc09[_0x0713('0x12')],_0x2ffc09[_0x0713('0x13')],_0x2ffc09[_0x0713('0x14')],_0x2ffc09[_0x0713('0x15')]));_0x2ffc09=_[_0x0713('0x16')](_0x2ffc09,{'transfererchannel':_0x2ffc09[_0x0713('0x17')],'transferercalleridnum':_0x2ffc09[_0x0713('0x12')],'transferercalleridname':_0x2ffc09['origtransferercalleridname'],'transfererconnectedlinenum':_0x2ffc09[_0x0713('0x18')],'transfererconnectedlinename':_0x2ffc09['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2ffc09['origtransfereraccountcode'],'transferercontext':_0x2ffc09[_0x0713('0x19')],'transfererexten':_0x2ffc09[_0x0713('0x1a')],'transfererlinkedid':_0x2ffc09[_0x0713('0x1b')],'context':_0x2ffc09[_0x0713('0x1c')],'extension':_0x2ffc09[_0x0713('0x1d')],'type':'attended'});if(_[_0x0713('0x1e')](_0x2ffc09[_0x0713('0x1f')])){_0x2ffc09=_[_0x0713('0x16')](_0x2ffc09,{'transfereechannel':_0x2ffc09[_0x0713('0x20')],'transfereecalleridnum':_0x2ffc09[_0x0713('0x14')],'transfereecalleridname':_0x2ffc09['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2ffc09[_0x0713('0x21')],'transfereeconnectedlinename':_0x2ffc09['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2ffc09[_0x0713('0x22')],'transfereecontext':_0x2ffc09[_0x0713('0x23')],'transfereeexten':_0x2ffc09[_0x0713('0x24')],'transfereelinkedid':_0x2ffc09['transfertargetlinkedid']});}writeDB(_0x2ffc09);}catch(_0x5517ad){utils[_0x0713('0xe')](util['format'](_0x0713('0x10'),_0x2ffc09[_0x0713('0x6')]),_0x5517ad);}}; \ No newline at end of file +var _0x5a6f=['lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x5a6f,0x134));var _0xf5a6=function(_0xf09935,_0x159e06){_0xf09935=_0xf09935-0x0;var _0x22fe5b=_0x5a6f[_0xf09935];return _0x22fe5b;};'use strict';var _=require(_0xf5a6('0x0'));var util=require(_0xf5a6('0x1'));var utils=require(_0xf5a6('0x2'));function writeDB(_0x26be4b){utils['info'](util[_0xf5a6('0x3')](_0xf5a6('0x4'),_0x26be4b[_0xf5a6('0x5')]===_0xf5a6('0x6')?_0x26be4b[_0xf5a6('0x7')]:_0x26be4b['uniqueid'],_0x26be4b[_0xf5a6('0x5')]));utils[_0xf5a6('0x8')](_0xf5a6('0x9'),_0x26be4b);}exports[_0xf5a6('0xa')]=function(_0x305732){try{utils['debug'](util['format'](_0xf5a6('0xb'),_0x305732['uniqueid']),_0x305732);utils['info'](util[_0xf5a6('0x3')](_0xf5a6('0xc'),_0x305732[_0xf5a6('0xd')],_0x305732[_0xf5a6('0xe')],_0x305732[_0xf5a6('0xf')],_0x305732[_0xf5a6('0x10')],_0x305732[_0xf5a6('0x11')]));_0x305732[_0xf5a6('0x5')]=_0xf5a6('0x12');writeDB(_0x305732);}catch(_0x31d3ea){utils['error'](util[_0xf5a6('0x3')](_0xf5a6('0xb'),_0x305732[_0xf5a6('0xd')]),_0x31d3ea);}};exports['attendedtransfer']=function(_0x43304a){try{utils[_0xf5a6('0x13')](util[_0xf5a6('0x3')]('[%s][transfers][attendedtransfer]',_0x43304a[_0xf5a6('0x7')]),_0x43304a);utils['info'](util['format'](_0xf5a6('0x14'),_0x43304a[_0xf5a6('0x7')],_0x43304a[_0xf5a6('0x15')],_0x43304a[_0xf5a6('0x16')],_0x43304a[_0xf5a6('0x17')],_0x43304a[_0xf5a6('0x18')]));_0x43304a=_[_0xf5a6('0x19')](_0x43304a,{'transfererchannel':_0x43304a[_0xf5a6('0x1a')],'transferercalleridnum':_0x43304a['origtransferercalleridnum'],'transferercalleridname':_0x43304a[_0xf5a6('0x16')],'transfererconnectedlinenum':_0x43304a[_0xf5a6('0x1b')],'transfererconnectedlinename':_0x43304a[_0xf5a6('0x1c')],'transfereraccountcode':_0x43304a[_0xf5a6('0x1d')],'transferercontext':_0x43304a[_0xf5a6('0x1e')],'transfererexten':_0x43304a[_0xf5a6('0x1f')],'transfererlinkedid':_0x43304a[_0xf5a6('0x20')],'context':_0x43304a['origtransferercontext'],'extension':_0x43304a[_0xf5a6('0x21')],'type':'attended'});if(_[_0xf5a6('0x22')](_0x43304a[_0xf5a6('0x23')])){_0x43304a=_[_0xf5a6('0x19')](_0x43304a,{'transfereechannel':_0x43304a[_0xf5a6('0x24')],'transfereecalleridnum':_0x43304a['transfertargetcalleridnum'],'transfereecalleridname':_0x43304a[_0xf5a6('0x18')],'transfereeconnectedlinenum':_0x43304a[_0xf5a6('0x25')],'transfereeconnectedlinename':_0x43304a[_0xf5a6('0x26')],'transfereeaccountcode':_0x43304a[_0xf5a6('0x27')],'transfereecontext':_0x43304a[_0xf5a6('0x28')],'transfereeexten':_0x43304a[_0xf5a6('0x29')],'transfereelinkedid':_0x43304a[_0xf5a6('0x2a')]});}writeDB(_0x43304a);}catch(_0x9b8300){utils['error'](util[_0xf5a6('0x3')](_0xf5a6('0x2b'),_0x43304a[_0xf5a6('0x7')]),_0x9b8300);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9717bec..f0ebefa 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 _0xb1f7=['debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb1f7,0x19d));var _0x7b1f=function(_0xbef885,_0x245e90){_0xbef885=_0xbef885-0x0;var _0x5502f0=_0xb1f7[_0xbef885];return _0x5502f0;};'use strict';var BPromise=require(_0x7b1f('0x0'));var jayson=require(_0x7b1f('0x1'));var moment=require(_0x7b1f('0x2'));var util=require(_0x7b1f('0x3'));var client=jayson[_0x7b1f('0x4')][_0x7b1f('0x5')]({'port':0x2329});var logger=require(_0x7b1f('0x6'))(_0x7b1f('0x7'));exports[_0x7b1f('0x8')]=function(_0x2941cc,_0x23838f){logger[_0x7b1f('0x8')](_0x2941cc,_0x23838f?util[_0x7b1f('0x9')](_0x23838f,{'showHidden':![],'depth':null}):'');};exports[_0x7b1f('0xa')]=function(_0x2c6da6,_0x467c4c){logger[_0x7b1f('0xa')](_0x2c6da6,_0x467c4c?util[_0x7b1f('0x9')](_0x467c4c,{'showHidden':![],'depth':null}):'');};exports[_0x7b1f('0xb')]=function(_0x2783a0,_0x2df717){logger[_0x7b1f('0xb')](_0x2783a0,_0x2df717?util[_0x7b1f('0x9')](_0x2df717,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5bda9a,_0x4802ab){return client[_0x7b1f('0xc')](_0x5bda9a,{'body':_0x4802ab})[_0x7b1f('0xd')](function(_0x1d0989){logger['debug'](_0x7b1f('0xe'),_0x5bda9a,_0x1d0989?util[_0x7b1f('0x9')](_0x1d0989,{'showHidden':![],'depth':null}):'');})[_0x7b1f('0xf')](function(_0x3484db){logger['error'](_0x7b1f('0xe'),_0x5bda9a,_0x3484db?util[_0x7b1f('0x9')](_0x3484db,{'showHidden':![],'depth':null}):'');});};function getUser(_0x416c65){return client[_0x7b1f('0xc')](_0x7b1f('0x10'),{'options':{'raw':!![],'attributes':['id',_0x7b1f('0x11'),'name',_0x7b1f('0x12')],'where':_0x416c65,'limit':0x1}})['then'](function(_0x57f110){logger[_0x7b1f('0xa')](_0x7b1f('0x13'),JSON[_0x7b1f('0x14')](_0x416c65),_0x57f110?util['inspect'](_0x57f110,{'showHidden':![],'depth':null}):'');return _0x57f110[_0x7b1f('0x15')][_0x7b1f('0x16')]?_0x57f110['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x5576ca){return new BPromise(function(_0x1c269c,_0x3b768b){if(_0x5576ca){return getUser({'internal':_0x5576ca})[_0x7b1f('0xd')](function(_0x4dca3b){logger[_0x7b1f('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5576ca,_0x4dca3b?_0x7b1f('0x17'):_0x7b1f('0x18'));return _0x1c269c(_0x4dca3b);})[_0x7b1f('0xf')](function(_0x5890af){logger[_0x7b1f('0xb')]('[utils][getUserByInternal]',_0x5890af?util[_0x7b1f('0x9')](_0x5890af,{'showHidden':![],'depth':null}):'');return _0x1c269c(null);});}return _0x1c269c(null);});};exports[_0x7b1f('0x19')]=function(_0xf5a059){return new BPromise(function(_0xc3a52a,_0x48487d){if(_0xf5a059){return getUser({'interface':_0xf5a059})['then'](function(_0x264483){logger['info'](_0x7b1f('0x1a'),_0xf5a059,_0x264483?_0x7b1f('0x17'):_0x7b1f('0x18'));return _0xc3a52a(_0x264483);})['catch'](function(_0x580cbb){logger[_0x7b1f('0xb')]('[utils][getUserByInterface]',_0x580cbb?util[_0x7b1f('0x9')](_0x580cbb,{'showHidden':![],'depth':null}):'');return _0xc3a52a(null);});}return _0xc3a52a(null);});};exports[_0x7b1f('0x1b')]=function(_0x309bd6){return new BPromise(function(_0x5de8e2,_0x3d6dc6){if(_0x309bd6){return getUser({'name':_0x309bd6})[_0x7b1f('0xd')](function(_0x299df8){logger[_0x7b1f('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x309bd6,_0x299df8?_0x7b1f('0x17'):_0x7b1f('0x18'));return _0x5de8e2(_0x299df8);})[_0x7b1f('0xf')](function(_0xf3764a){logger['error'](_0x7b1f('0x1c'),_0xf3764a?util[_0x7b1f('0x9')](_0xf3764a,{'showHidden':![],'depth':null}):'');return _0x5de8e2(null);});}return _0x5de8e2(null);});};exports[_0x7b1f('0x1d')]=function(_0x46842d){return new BPromise(function(_0x455f0a,_0x4be6da){if(_0x46842d){return client[_0x7b1f('0xc')](_0x7b1f('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0x7b1f('0x1f'),_0x7b1f('0x20'),_0x7b1f('0x21')],'where':{'name':_0x46842d},'limit':0x1}})[_0x7b1f('0xd')](function(_0x7eb9d3){logger['debug'](_0x7b1f('0x22'),_0x46842d,_0x7eb9d3?util[_0x7b1f('0x9')](_0x7eb9d3,{'showHidden':![],'depth':null}):'');logger[_0x7b1f('0x8')](_0x7b1f('0x23'),_0x46842d,_0x7eb9d3?_0x7b1f('0x17'):_0x7b1f('0x18'));return _0x455f0a(_0x7eb9d3[_0x7b1f('0x15')]['length']?_0x7eb9d3[_0x7b1f('0x15')][0x0]:null);})[_0x7b1f('0xf')](function(_0xa9bc63){logger[_0x7b1f('0xb')]('[utils][getVoiceQueueByName]',_0xa9bc63?util[_0x7b1f('0x9')](_0xa9bc63,{'showHidden':![],'depth':null}):'');return _0x455f0a(null);});}return _0x455f0a(null);});};exports[_0x7b1f('0x24')]=function(_0x1b969c,_0x35260c){return moment(_0x1b969c)[_0x7b1f('0x25')](_0x35260c,_0x7b1f('0x26'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7b1f('0x27')]=function(_0x2562b3,_0x4f2979){return moment(_0x2562b3)[_0x7b1f('0x28')](_0x4f2979,'seconds')[_0x7b1f('0x29')](_0x7b1f('0x2a'));};exports['diffTime']=function(_0x291038,_0x31669a){return moment(_0x291038)[_0x7b1f('0x2b')](moment(_0x31669a),_0x7b1f('0x26'));};exports[_0x7b1f('0x2c')]=function(_0x4f6944,_0x46f649){return parseInt(_0x4f6944,0xa)+parseInt(_0x46f649,0xa);};exports[_0x7b1f('0x2d')]=function(){return moment()[_0x7b1f('0x29')](_0x7b1f('0x2a'));};exports['isAfter']=function(_0x1f43ff,_0x50c9d8){if(_0x50c9d8){return moment(_0x1f43ff)[_0x7b1f('0x2e')](_0x50c9d8);}return!![];};exports['isBefore']=function(_0x4a8d93,_0x2b06ca){if(_0x2b06ca){return moment(_0x4a8d93)['isBefore'](_0x2b06ca);}else if(_0x4a8d93){return!![];}return![];}; \ No newline at end of file +var _0xef8b=['[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','xdr','info','inspect','debug','request','then','[utils][request]\x20name:%s','catch','error','internal','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','found','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s'];(function(_0x2cc94e,_0x7fd5d2){var _0x103b86=function(_0x17f16a){while(--_0x17f16a){_0x2cc94e['push'](_0x2cc94e['shift']());}};_0x103b86(++_0x7fd5d2);}(_0xef8b,0xee));var _0xbef8=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xef8b[_0x282a1f];return _0x296ea7;};'use strict';var BPromise=require(_0xbef8('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbef8('0x1'));var util=require(_0xbef8('0x2'));var client=jayson[_0xbef8('0x3')][_0xbef8('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xbef8('0x5'));exports['info']=function(_0x322e86,_0x2751af){logger[_0xbef8('0x6')](_0x322e86,_0x2751af?util[_0xbef8('0x7')](_0x2751af,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x343d59,_0x506f97){logger[_0xbef8('0x8')](_0x343d59,_0x506f97?util[_0xbef8('0x7')](_0x506f97,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x498b35,_0x2f922d){logger['error'](_0x498b35,_0x2f922d?util[_0xbef8('0x7')](_0x2f922d,{'showHidden':![],'depth':null}):'');};exports[_0xbef8('0x9')]=function(_0x295995,_0x22e2bd){return client[_0xbef8('0x9')](_0x295995,{'body':_0x22e2bd})[_0xbef8('0xa')](function(_0x18a148){logger[_0xbef8('0x8')](_0xbef8('0xb'),_0x295995,_0x18a148?util[_0xbef8('0x7')](_0x18a148,{'showHidden':![],'depth':null}):'');})[_0xbef8('0xc')](function(_0x1de5b4){logger[_0xbef8('0xd')](_0xbef8('0xb'),_0x295995,_0x1de5b4?util[_0xbef8('0x7')](_0x1de5b4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5f3a69){return client[_0xbef8('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xbef8('0xe'),'name','interface'],'where':_0x5f3a69,'limit':0x1}})[_0xbef8('0xa')](function(_0x39237a){logger[_0xbef8('0x8')](_0xbef8('0xf'),JSON[_0xbef8('0x10')](_0x5f3a69),_0x39237a?util['inspect'](_0x39237a,{'showHidden':![],'depth':null}):'');return _0x39237a[_0xbef8('0x11')][_0xbef8('0x12')]?_0x39237a[_0xbef8('0x11')][0x0]:null;});}exports[_0xbef8('0x13')]=function(_0x47c7f3){return new BPromise(function(_0x2fe907,_0x13c46f){if(_0x47c7f3){return getUser({'internal':_0x47c7f3})[_0xbef8('0xa')](function(_0x580fa6){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x47c7f3,_0x580fa6?'found':_0xbef8('0x14'));return _0x2fe907(_0x580fa6);})[_0xbef8('0xc')](function(_0x52f9b0){logger[_0xbef8('0xd')](_0xbef8('0x15'),_0x52f9b0?util[_0xbef8('0x7')](_0x52f9b0,{'showHidden':![],'depth':null}):'');return _0x2fe907(null);});}return _0x2fe907(null);});};exports[_0xbef8('0x16')]=function(_0x509ad0){return new BPromise(function(_0x57a11c,_0x2de1b4){if(_0x509ad0){return getUser({'interface':_0x509ad0})[_0xbef8('0xa')](function(_0x2bcea4){logger[_0xbef8('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x509ad0,_0x2bcea4?'found':'notfound');return _0x57a11c(_0x2bcea4);})[_0xbef8('0xc')](function(_0x3a0323){logger['error'](_0xbef8('0x17'),_0x3a0323?util[_0xbef8('0x7')](_0x3a0323,{'showHidden':![],'depth':null}):'');return _0x57a11c(null);});}return _0x57a11c(null);});};exports[_0xbef8('0x18')]=function(_0x279c3c){return new BPromise(function(_0x47f715,_0xa37881){if(_0x279c3c){return getUser({'name':_0x279c3c})['then'](function(_0x1307c9){logger[_0xbef8('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x279c3c,_0x1307c9?_0xbef8('0x19'):_0xbef8('0x14'));return _0x47f715(_0x1307c9);})[_0xbef8('0xc')](function(_0x313238){logger[_0xbef8('0xd')](_0xbef8('0x1a'),_0x313238?util[_0xbef8('0x7')](_0x313238,{'showHidden':![],'depth':null}):'');return _0x47f715(null);});}return _0x47f715(null);});};exports[_0xbef8('0x1b')]=function(_0x3e8af9){return new BPromise(function(_0x2d212b,_0x28c20f){if(_0x3e8af9){return client[_0xbef8('0x9')](_0xbef8('0x1c'),{'options':{'raw':!![],'attributes':['id','name','type',_0xbef8('0x1d'),_0xbef8('0x1e')],'where':{'name':_0x3e8af9},'limit':0x1}})['then'](function(_0x594921){logger[_0xbef8('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x3e8af9,_0x594921?util[_0xbef8('0x7')](_0x594921,{'showHidden':![],'depth':null}):'');logger[_0xbef8('0x6')](_0xbef8('0x1f'),_0x3e8af9,_0x594921?_0xbef8('0x19'):_0xbef8('0x14'));return _0x2d212b(_0x594921[_0xbef8('0x11')]['length']?_0x594921[_0xbef8('0x11')][0x0]:null);})[_0xbef8('0xc')](function(_0x272926){logger[_0xbef8('0xd')](_0xbef8('0x20'),_0x272926?util['inspect'](_0x272926,{'showHidden':![],'depth':null}):'');return _0x2d212b(null);});}return _0x2d212b(null);});};exports['addTime']=function(_0x71072d,_0x5781bd){return moment(_0x71072d)[_0xbef8('0x21')](_0x5781bd,_0xbef8('0x22'))[_0xbef8('0x23')](_0xbef8('0x24'));};exports[_0xbef8('0x25')]=function(_0x1a235f,_0x4996bf){return moment(_0x1a235f)[_0xbef8('0x26')](_0x4996bf,_0xbef8('0x22'))[_0xbef8('0x23')](_0xbef8('0x24'));};exports[_0xbef8('0x27')]=function(_0x438dd1,_0x1dfcfa){return moment(_0x438dd1)[_0xbef8('0x28')](moment(_0x1dfcfa),_0xbef8('0x22'));};exports[_0xbef8('0x29')]=function(_0x21c6b5,_0x4d75e7){return parseInt(_0x21c6b5,0xa)+parseInt(_0x4d75e7,0xa);};exports[_0xbef8('0x2a')]=function(){return moment()[_0xbef8('0x23')](_0xbef8('0x24'));};exports[_0xbef8('0x2b')]=function(_0x757e41,_0x19c546){if(_0x19c546){return moment(_0x757e41)[_0xbef8('0x2b')](_0x19c546);}return!![];};exports[_0xbef8('0x2c')]=function(_0x5e734a,_0x5ce473){if(_0x5ce473){return moment(_0x5e734a)[_0xbef8('0x2c')](_0x5ce473);}else if(_0x5e734a){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 f05ee65..535503e 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 _0x5651=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','url','setupLoggers','lodash','express-winston','path','util','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client','ensureDir','catch','user','then','no-user','data','error','api','auth','set','use','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','name','inspect','logger','device'];(function(_0x458b8f,_0x1c7ac5){var _0x23aba3=function(_0x239548){while(--_0x239548){_0x458b8f['push'](_0x458b8f['shift']());}};_0x23aba3(++_0x1c7ac5);}(_0x5651,0xdd));var _0x1565=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x5651[_0x57486e];return _0x5f110b;};var fs=require('fs-extra');var _=require(_0x1565('0x0'));var ewinston=require(_0x1565('0x1'));var path=require(_0x1565('0x2'));var util=require(_0x1565('0x3'));var fileLogger=require(_0x1565('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x1565('0x5')];var maskSensitiveData=require(_0x1565('0x6'))[_0x1565('0x7')];function ClientSideLogger(){function _0x44ef8a(_0x4051f0){var _0x1a5806=path[_0x1565('0x8')]('/var',_0x1565('0x9'),_0x1565('0xa'));var _0x4660dc=path[_0x1565('0x8')](_0x1565('0xb'),_0x4051f0['role']+'-'+_0x4051f0['name']);return fs[_0x1565('0xc')](path[_0x1565('0x8')](_0x1a5806,_0x4660dc))['then'](function(){var _0x1c8895=fileLogger(_0x1565('0xb'),path[_0x1565('0x8')](_0x1a5806,_0x4660dc));return _0x1c8895;})[_0x1565('0xd')](function(_0x2c092d){throw _0x2c092d;});}this[_0x1565('0x9')]=function(_0x4b1152,_0x4774c4,_0x3da62b,_0x43ee7c){return _0x44ef8a(_0x4b1152[_0x1565('0xe')])[_0x1565('0xf')](function(_0x5668cc){var _0x59979d=_0x5668cc[_0x4774c4];return _0x59979d;})[_0x1565('0xf')](function(_0x29181d){var _0x424ad0=_0x4b1152['user']?_0x4b1152[_0x1565('0xe')]['id']:_0x1565('0x10');var _0x1454cf=_0x43ee7c[_0x1565('0x11')];var _0x2ee426=_0x43ee7c['timestamp'];var _0x262568=new Date(Number(_0x2ee426));return _0x29181d(_0x424ad0,_0x262568,_0x3da62b,_0x1454cf);})[_0x1565('0xd')](function(_0x15ac73){fileLogger(_0x1565('0xb'))[_0x1565('0x12')](_0x15ac73);});};}function setupLoggers(_0x53613e){return new Promise(function(_0x4ebee8){var _0x380f07=new ClientSideLogger();var _0x54a10f=fileLogger(_0x1565('0x13'));var _0x516f3c=fileLogger(_0x1565('0x14'));_0x53613e[_0x1565('0x15')]('client-side-logger',_0x380f07);_0x53613e[_0x1565('0x16')](ewinston['logger']({'winstonInstance':_0x54a10f,'meta':![],'statusLevels':!![],'msg':function(_0x343bb3,_0x2df3a3){var _0xeb732f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x1565('0x17')](_0x343bb3[_0x1565('0x18')])){_0xeb732f+='\x20body=%s';var _0x5d43d4=_0x343bb3[_0x1565('0x18')];maskSensitiveData(_0x5d43d4);}return safeTemplate(util[_0x1565('0x19')](_0xeb732f,_0x343bb3[_0x1565('0x1a')],_0x343bb3[_0x1565('0x1b')][_0x1565('0x1c')]?_0x343bb3['headers']['x-forwarded-for']:_0x343bb3[_0x1565('0x1d')][_0x1565('0x1e')]||_0x343bb3['ip'],_0x343bb3['url'],_0x2df3a3[_0x1565('0x1f')],_0x2df3a3[_0x1565('0x20')],_0x343bb3[_0x1565('0xe')]?_0x343bb3[_0x1565('0xe')]['id']:null,_0x343bb3[_0x1565('0xe')]?_0x343bb3[_0x1565('0xe')][_0x1565('0x21')]:null,_0x343bb3[_0x1565('0xe')]?_0x343bb3['user']['role']:null,_0x5d43d4?util[_0x1565('0x22')](_0x5d43d4,![],null):''));}}));_0x53613e['use'](ewinston[_0x1565('0x23')]({'winstonInstance':_0x516f3c,'meta':![],'statusLevels':!![],'msg':function(_0x5ef8b4,_0x5beb21){var _0x23c8d7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x5ef8b4[_0x1565('0x18')]&&_0x5ef8b4[_0x1565('0x18')][_0x1565('0x24')]&&_0x5ef8b4[_0x1565('0x18')]['agent_id']){_0x23c8d7=_0x1565('0x25');}return util['format'](_0x23c8d7,_0x5ef8b4['method'],_0x5ef8b4[_0x1565('0x1b')][_0x1565('0x1c')]?_0x5ef8b4['headers'][_0x1565('0x1c')]:_0x5ef8b4[_0x1565('0x1d')]['remoteAddress']||_0x5ef8b4['ip'],_0x5ef8b4['url'],_0x5beb21[_0x1565('0x1f')],_0x5beb21['responseTime'],_0x5ef8b4['user']?_0x5ef8b4[_0x1565('0xe')]['id']:null,_0x5ef8b4['user']?_0x5ef8b4[_0x1565('0xe')][_0x1565('0x21')]:null,_0x5ef8b4[_0x1565('0xe')]?_0x5ef8b4[_0x1565('0xe')]['role']:null,_0x5ef8b4[_0x1565('0x18')]&&_0x5ef8b4[_0x1565('0x18')][_0x1565('0x24')]?_0x5ef8b4[_0x1565('0x18')][_0x1565('0x24')]:_0x1565('0x26'),_0x5ef8b4[_0x1565('0x18')]&&_0x5ef8b4[_0x1565('0x18')][_0x1565('0x27')]?_0x5ef8b4[_0x1565('0x18')]['agent_id']:'',_0x5ef8b4[_0x1565('0x18')]&&_0x5ef8b4['body'][_0x1565('0x28')]?_0x5ef8b4[_0x1565('0x18')][_0x1565('0x28')]:'');},'ignoreRoute':function(_0x525e01){var _0x48026e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x48026e['test'](_0x525e01[_0x1565('0x29')]);}}));return _0x4ebee8();});}exports[_0x1565('0x2a')]=setupLoggers; \ No newline at end of file +var _0xb654=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','device','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client','role','name','then','catch','user','data','error','api','set','client-side-logger','use','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','logger'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xb654,0x179));var _0x4b65=function(_0x324136,_0x440fe6){_0x324136=_0x324136-0x0;var _0x55ffef=_0xb654[_0x324136];return _0x55ffef;};var fs=require(_0x4b65('0x0'));var _=require('lodash');var ewinston=require(_0x4b65('0x1'));var path=require(_0x4b65('0x2'));var util=require(_0x4b65('0x3'));var fileLogger=require(_0x4b65('0x4'))['fileLogger'];var safeTemplate=require(_0x4b65('0x5'))[_0x4b65('0x6')];var maskSensitiveData=require(_0x4b65('0x7'))[_0x4b65('0x8')];function ClientSideLogger(){function _0x24d607(_0x2b9635){var _0x3cd55b=path[_0x4b65('0x9')]('/var',_0x4b65('0xa'),_0x4b65('0xb'));var _0x31b9ba=path[_0x4b65('0x9')](_0x4b65('0xc'),_0x2b9635[_0x4b65('0xd')]+'-'+_0x2b9635[_0x4b65('0xe')]);return fs['ensureDir'](path[_0x4b65('0x9')](_0x3cd55b,_0x31b9ba))[_0x4b65('0xf')](function(){var _0xf1e0d2=fileLogger(_0x4b65('0xc'),path[_0x4b65('0x9')](_0x3cd55b,_0x31b9ba));return _0xf1e0d2;})[_0x4b65('0x10')](function(_0x535a35){throw _0x535a35;});}this['log']=function(_0x13548f,_0x5cb2e8,_0x36b226,_0x243d9a){return _0x24d607(_0x13548f['user'])['then'](function(_0x56328f){var _0x3c5163=_0x56328f[_0x5cb2e8];return _0x3c5163;})[_0x4b65('0xf')](function(_0x2f6b50){var _0x2c9025=_0x13548f[_0x4b65('0x11')]?_0x13548f[_0x4b65('0x11')]['id']:'no-user';var _0xcdc566=_0x243d9a[_0x4b65('0x12')];var _0x1a94ab=_0x243d9a['timestamp'];var _0x5ca157=new Date(Number(_0x1a94ab));return _0x2f6b50(_0x2c9025,_0x5ca157,_0x36b226,_0xcdc566);})[_0x4b65('0x10')](function(_0x571cb1){fileLogger('client')[_0x4b65('0x13')](_0x571cb1);});};}function setupLoggers(_0x3603d3){return new Promise(function(_0x2b598c){var _0x1f5ad3=new ClientSideLogger();var _0x53b63f=fileLogger(_0x4b65('0x14'));var _0x4cb057=fileLogger('auth');_0x3603d3[_0x4b65('0x15')](_0x4b65('0x16'),_0x1f5ad3);_0x3603d3[_0x4b65('0x17')](ewinston['logger']({'winstonInstance':_0x53b63f,'meta':![],'statusLevels':!![],'msg':function(_0x47d76b,_0x264e4e){var _0x4a42aa='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x4b65('0x18')](_0x47d76b[_0x4b65('0x19')])){_0x4a42aa+=_0x4b65('0x1a');var _0x153947=_0x47d76b[_0x4b65('0x19')];maskSensitiveData(_0x153947);}return safeTemplate(util[_0x4b65('0x1b')](_0x4a42aa,_0x47d76b[_0x4b65('0x1c')],_0x47d76b[_0x4b65('0x1d')][_0x4b65('0x1e')]?_0x47d76b[_0x4b65('0x1d')][_0x4b65('0x1e')]:_0x47d76b[_0x4b65('0x1f')][_0x4b65('0x20')]||_0x47d76b['ip'],_0x47d76b['url'],_0x264e4e[_0x4b65('0x21')],_0x264e4e[_0x4b65('0x22')],_0x47d76b[_0x4b65('0x11')]?_0x47d76b['user']['id']:null,_0x47d76b[_0x4b65('0x11')]?_0x47d76b['user'][_0x4b65('0xe')]:null,_0x47d76b['user']?_0x47d76b[_0x4b65('0x11')][_0x4b65('0xd')]:null,_0x153947?util[_0x4b65('0x23')](_0x153947,![],null):''));}}));_0x3603d3[_0x4b65('0x17')](ewinston[_0x4b65('0x24')]({'winstonInstance':_0x4cb057,'meta':![],'statusLevels':!![],'msg':function(_0x17c189,_0x3b1547){var _0x1ea141=_0x4b65('0x25');if(_0x17c189[_0x4b65('0x19')]&&_0x17c189[_0x4b65('0x19')]['device']&&_0x17c189['body'][_0x4b65('0x26')]){_0x1ea141=_0x4b65('0x27');}return util['format'](_0x1ea141,_0x17c189[_0x4b65('0x1c')],_0x17c189[_0x4b65('0x1d')]['x-forwarded-for']?_0x17c189[_0x4b65('0x1d')][_0x4b65('0x1e')]:_0x17c189[_0x4b65('0x1f')][_0x4b65('0x20')]||_0x17c189['ip'],_0x17c189[_0x4b65('0x28')],_0x3b1547[_0x4b65('0x21')],_0x3b1547[_0x4b65('0x22')],_0x17c189[_0x4b65('0x11')]?_0x17c189[_0x4b65('0x11')]['id']:null,_0x17c189[_0x4b65('0x11')]?_0x17c189[_0x4b65('0x11')][_0x4b65('0xe')]:null,_0x17c189['user']?_0x17c189[_0x4b65('0x11')][_0x4b65('0xd')]:null,_0x17c189['body']&&_0x17c189[_0x4b65('0x19')][_0x4b65('0x29')]?_0x17c189['body'][_0x4b65('0x29')]:_0x4b65('0x2a'),_0x17c189[_0x4b65('0x19')]&&_0x17c189[_0x4b65('0x19')][_0x4b65('0x26')]?_0x17c189[_0x4b65('0x19')][_0x4b65('0x26')]:'',_0x17c189[_0x4b65('0x19')]&&_0x17c189['body'][_0x4b65('0x2b')]?_0x17c189[_0x4b65('0x19')][_0x4b65('0x2b')]:'');},'ignoreRoute':function(_0x3c7eeb){var _0x5f01a2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5f01a2[_0x4b65('0x2c')](_0x3c7eeb[_0x4b65('0x28')]);}}));return _0x2b598c();});}exports[_0x4b65('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 03dea0e..fef9c28 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf861=['includes','daysInMonth','max','domCompare','MMM','guess','isMoment','split','padStart','length','iftime','lodash','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','format','ddd'];(function(_0x38b4de,_0x3b2b10){var _0x54f3dc=function(_0xf82116){while(--_0xf82116){_0x38b4de['push'](_0x38b4de['shift']());}};_0x54f3dc(++_0x3b2b10);}(_0xf861,0x1a2));var _0x1f86=function(_0x266009,_0x4f5aa7){_0x266009=_0x266009-0x0;var _0x3c1bff=_0xf861[_0x266009];return _0x3c1bff;};var _=require(_0x1f86('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][_0x1f86('0x1')](function(_0x4f072e){return _0x4f072e[_0x1f86('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x1f86('0x3');var EINVALID_DATE=_0x1f86('0x4');function throwIfDateNotValid(_0x4df542){if(!_0x4df542[_0x1f86('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x16e12a){var _0x4310fe=_0x16e12a['split'](':')[_0x1f86('0x1')](function(_0x2076a2){return parseInt(_0x2076a2,0xa);});var _0x4ce289=_0x4310fe[0x0];var _0xb1275b=_0x4310fe[0x1];if(_0x4ce289<0x0||_0x4ce289>0x17||_0xb1275b<0x0||_0xb1275b>0x3b){throw new Error(EINVALID_DATE);}return[_0x4ce289,_0xb1275b];}function circularDoWInterval(_0x5d5174,_0x12fc03){if(_0x5d5174===_0x12fc03){return[_0x5d5174];}else{var _0x142d7e=moment[_0x1f86('0x6')]();moment[_0x1f86('0x6')]('en');var _0x571c51=moment[_0x1f86('0x7')]()['map'](function(_0xc4738){return _0xc4738[_0x1f86('0x8')]();});moment['locale'](_0x142d7e);var _0x423933=_0x571c51[_0x1f86('0x9')](_0x5d5174);var _0x10c345=_0x571c51[_0x1f86('0x9')](_0x12fc03);if(_0x10c345>_0x423933){return _0x571c51['slice'](_0x423933,_0x10c345+0x1);}else{var _0xc548d1=_0x571c51[_0x1f86('0xa')](0x0,_0x10c345+0x1);var _0x2c5c1d=_0x571c51[_0x1f86('0xa')](_0x423933);return _0x2c5c1d[_0x1f86('0xb')](_0xc548d1);}}}module[_0x1f86('0xc')][_0x1f86('0xd')]=circularDoWInterval;function circularMonthInterval(_0x3e53c0,_0x66bf20){if(_0x3e53c0===_0x66bf20){return[_0x3e53c0];}else{var _0x32bf5a=moment['locale']();moment[_0x1f86('0x6')]('en');var _0x42a0de=moment[_0x1f86('0xe')]()[_0x1f86('0x1')](function(_0x5a3287){return _0x5a3287[_0x1f86('0x8')]();});moment[_0x1f86('0x6')](_0x32bf5a);var _0x356dc2=_0x42a0de[_0x1f86('0x9')](_0x3e53c0);var _0x5da1a4=_0x42a0de[_0x1f86('0x9')](_0x66bf20);if(_0x5da1a4>_0x356dc2){return _0x42a0de[_0x1f86('0xa')](_0x356dc2,_0x5da1a4+0x1);}else{var _0xb3c835=_0x42a0de[_0x1f86('0xa')](0x0,_0x5da1a4+0x1);var _0x5a989b=_0x42a0de[_0x1f86('0xa')](_0x356dc2);return _0x5a989b['concat'](_0xb3c835);}}}module[_0x1f86('0xc')][_0x1f86('0xf')]=circularMonthInterval;function parseDom(_0x2f38d4){var _0x53fd22=parseInt(_0x2f38d4,0xa);if(_0x53fd22<0x1||_0x53fd22>0x1f){throw new Error(EINVALID_DATE);}return _0x53fd22;}function timeCompare(_0x36691f,_0x51a121,_0x4e36e7){var _0x5a6e11=_0x36691f[_0x1f86('0x10')]();var _0x1cca91=extractTime(_0x51a121);var _0x1dc469=_0x1cca91[0x0];var _0x1abfb1=_0x1cca91[0x1];var _0x514073=_0x36691f[_0x1f86('0x10')]()[_0x1f86('0x11')](_0x1dc469)[_0x1f86('0x12')](_0x1abfb1);throwIfDateNotValid(_0x514073);var _0x24d40d=extractTime(_0x4e36e7);var _0x17932c=_0x24d40d[0x0];var _0x3b968f=_0x24d40d[0x1];var _0x3842f8=_0x36691f[_0x1f86('0x10')]()[_0x1f86('0x11')](_0x17932c)['minutes'](_0x3b968f);throwIfDateNotValid(_0x3842f8);if(_0x3842f8[_0x1f86('0x13')](_0x514073)){var _0x40a5d8=_0x5a6e11[_0x1f86('0x10')]()[_0x1f86('0x14')]('day');var _0x36ad1e=_0x5a6e11[_0x1f86('0x10')]()[_0x1f86('0x15')](_0x1f86('0x16'));return _0x5a6e11[_0x1f86('0x17')](_0x514073,_0x36ad1e,undefined,'[]')||_0x5a6e11['isBetween'](_0x40a5d8,_0x3842f8,undefined,'[]');}else{return _0x5a6e11[_0x1f86('0x17')](_0x514073,_0x3842f8,undefined,'[]');}}module[_0x1f86('0xc')]['timeCompare']=timeCompare;function dowCompare(_0x4f3254,_0x1be542,_0x2ef7f4){var _0x2a5c45=_0x4f3254[_0x1f86('0x6')]('en')[_0x1f86('0x18')](_0x1f86('0x19'))[_0x1f86('0x8')]();return circularDoWInterval(_0x1be542,_0x2ef7f4)[_0x1f86('0x1a')](_0x2a5c45);}module[_0x1f86('0xc')]['dowCompare']=dowCompare;function domCompare(_0x12d826,_0xc8e7ba,_0x1f91ca){var _0x107eac=_0x12d826['date']();if(_0xc8e7ba===_0x1f91ca){return _0x107eac===_0xc8e7ba;}else{var _0x2ac4a8=_0x12d826[_0x1f86('0x1b')]();var _0x490103=_0xc8e7ba<_0x1f91ca;let _0x4e94db=![];var _0x4bec99=0x0;var _0x173b18=0x0;if(_0x490103){_0x4bec99=Math[_0x1f86('0x1c')](0x1,_0xc8e7ba);_0x173b18=Math['min'](_0x1f91ca,_0x2ac4a8);_0x4e94db=_0x107eac>=_0x4bec99&&_0x107eac<=_0x173b18;}else{_0x4bec99=Math['min'](_0xc8e7ba,_0x2ac4a8);_0x173b18=Math[_0x1f86('0x1c')](0x1,_0x1f91ca);_0x4e94db=_0x107eac>=_0x4bec99||_0x107eac<=_0x173b18;}return _0x4e94db;}}module[_0x1f86('0xc')][_0x1f86('0x1d')]=domCompare;function monthCompare(_0x51d374,_0x31e1a5,_0x181ad9){var _0x1f4774=_0x51d374[_0x1f86('0x6')]('en')[_0x1f86('0x18')](_0x1f86('0x1e'))['toLowerCase']();return circularMonthInterval(_0x31e1a5,_0x181ad9)['includes'](_0x1f4774);}module[_0x1f86('0xc')]['monthCompare']=monthCompare;function iftime(_0x74ff94,_0x5693f4=moment['tz'][_0x1f86('0x1f')](),_0x4b3acf=moment()){if(!validateRx['test'](_0x74ff94)){throw new Error(EINVALID_STRING);}else{var _0x52a585=(moment[_0x1f86('0x20')](_0x4b3acf)?_0x4b3acf[_0x1f86('0x10')]():moment(_0x4b3acf))['tz'](_0x5693f4)[_0x1f86('0x6')]('en');throwIfDateNotValid(_0x52a585);var _0x3ba678=_0x74ff94[_0x1f86('0x21')](',');var _0x3d8076=_0x3ba678[0x0];var _0x284fb3=_0x3ba678[0x1];var _0x5b6cc5=_0x3ba678[0x2];var _0x3eb41d=_0x3ba678[0x3];let _0x2e92e=!![];if(_0x3d8076!=='*'){var _0xf26fa1=_0x3d8076[_0x1f86('0x21')]('-');var _0x103421=_[_0x1f86('0x22')](_0xf26fa1[0x0],0x5,'0');var _0x2c0f61=_0xf26fa1['length']===0x2?_['padStart'](_0xf26fa1[0x1],0x5,'0'):_0x103421;_0x2e92e=timeCompare(_0x52a585,_0x103421,_0x2c0f61);}let _0x3a9780=!![];if(_0x284fb3!=='*'){var _0x39786e=_0x284fb3[_0x1f86('0x21')]('-');var _0x42b3e0=_0x39786e[0x0];var _0x1ba5f4=_0x39786e[_0x1f86('0x23')]===0x2?_0x39786e[0x1]:_0x42b3e0;_0x3a9780=dowCompare(_0x52a585,_0x42b3e0,_0x1ba5f4);}let _0x4429be=!![];if(_0x5b6cc5!=='*'){var _0x49ecae=_0x5b6cc5[_0x1f86('0x21')]('-');var _0x4e49d4=parseDom(_0x49ecae[0x0]);var _0x26b223=_0x49ecae[_0x1f86('0x23')]===0x2?parseDom(_0x49ecae[0x1]):_0x4e49d4;_0x4429be=domCompare(_0x52a585,_0x4e49d4,_0x26b223);}let _0x211780=!![];if(_0x3eb41d!=='*'){var _0x5045e1=_0x3eb41d[_0x1f86('0x21')]('-');var _0x1de914=_0x5045e1[0x0];var _0xd2042d=_0x5045e1['length']===0x2?_0x5045e1[0x1]:_0x5045e1[0x0];_0x211780=monthCompare(_0x52a585,_0x1de914,_0xd2042d);}return _0x2e92e&&_0x3a9780&&_0x4429be&&_0x211780;}}module['exports'][_0x1f86('0x24')]=iftime; \ No newline at end of file +var _0x15bc=['split','locale','weekdaysShort','toLowerCase','indexOf','slice','exports','circularDoWInterval','monthsShort','concat','circularMonthInterval','clone','hours','minutes','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x15bc,0x184));var _0xc15b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15bc[_0x3dd15e];return _0x231fd0;};var _=require(_0xc15b('0x0'));var moment=require(_0xc15b('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][_0xc15b('0x2')](function(_0xd438cb){return _0xd438cb[_0xc15b('0x3')];})[_0xc15b('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc15b('0x5');var EINVALID_DATE=_0xc15b('0x6');function throwIfDateNotValid(_0x12d520){if(!_0x12d520[_0xc15b('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5e3f52){var _0x193518=_0x5e3f52[_0xc15b('0x8')](':')[_0xc15b('0x2')](function(_0x20d0d8){return parseInt(_0x20d0d8,0xa);});var _0x31db3b=_0x193518[0x0];var _0x4d7168=_0x193518[0x1];if(_0x31db3b<0x0||_0x31db3b>0x17||_0x4d7168<0x0||_0x4d7168>0x3b){throw new Error(EINVALID_DATE);}return[_0x31db3b,_0x4d7168];}function circularDoWInterval(_0x3a12f3,_0x28b78d){if(_0x3a12f3===_0x28b78d){return[_0x3a12f3];}else{var _0x3b2cb7=moment[_0xc15b('0x9')]();moment[_0xc15b('0x9')]('en');var _0x202278=moment[_0xc15b('0xa')]()[_0xc15b('0x2')](function(_0x409743){return _0x409743[_0xc15b('0xb')]();});moment[_0xc15b('0x9')](_0x3b2cb7);var _0x4eb5fc=_0x202278[_0xc15b('0xc')](_0x3a12f3);var _0x3ad85f=_0x202278['indexOf'](_0x28b78d);if(_0x3ad85f>_0x4eb5fc){return _0x202278[_0xc15b('0xd')](_0x4eb5fc,_0x3ad85f+0x1);}else{var _0x23659a=_0x202278[_0xc15b('0xd')](0x0,_0x3ad85f+0x1);var _0x5e730a=_0x202278[_0xc15b('0xd')](_0x4eb5fc);return _0x5e730a['concat'](_0x23659a);}}}module[_0xc15b('0xe')][_0xc15b('0xf')]=circularDoWInterval;function circularMonthInterval(_0xf4c5e1,_0x5dcfe5){if(_0xf4c5e1===_0x5dcfe5){return[_0xf4c5e1];}else{var _0x1abac4=moment[_0xc15b('0x9')]();moment['locale']('en');var _0x14349a=moment[_0xc15b('0x10')]()[_0xc15b('0x2')](function(_0xf71412){return _0xf71412[_0xc15b('0xb')]();});moment[_0xc15b('0x9')](_0x1abac4);var _0x47b1ef=_0x14349a[_0xc15b('0xc')](_0xf4c5e1);var _0x3881a8=_0x14349a[_0xc15b('0xc')](_0x5dcfe5);if(_0x3881a8>_0x47b1ef){return _0x14349a['slice'](_0x47b1ef,_0x3881a8+0x1);}else{var _0x3358c8=_0x14349a[_0xc15b('0xd')](0x0,_0x3881a8+0x1);var _0x3e40f7=_0x14349a['slice'](_0x47b1ef);return _0x3e40f7[_0xc15b('0x11')](_0x3358c8);}}}module[_0xc15b('0xe')][_0xc15b('0x12')]=circularMonthInterval;function parseDom(_0x54f5da){var _0x49c47a=parseInt(_0x54f5da,0xa);if(_0x49c47a<0x1||_0x49c47a>0x1f){throw new Error(EINVALID_DATE);}return _0x49c47a;}function timeCompare(_0x1bdee1,_0x29e2db,_0x2763f2){var _0x1319c9=_0x1bdee1[_0xc15b('0x13')]();var _0x4f45b5=extractTime(_0x29e2db);var _0x36212f=_0x4f45b5[0x0];var _0x42f615=_0x4f45b5[0x1];var _0x2c7656=_0x1bdee1[_0xc15b('0x13')]()[_0xc15b('0x14')](_0x36212f)[_0xc15b('0x15')](_0x42f615);throwIfDateNotValid(_0x2c7656);var _0x418f14=extractTime(_0x2763f2);var _0x48cf24=_0x418f14[0x0];var _0x1d23dd=_0x418f14[0x1];var _0x3c31fd=_0x1bdee1[_0xc15b('0x13')]()[_0xc15b('0x14')](_0x48cf24)['minutes'](_0x1d23dd);throwIfDateNotValid(_0x3c31fd);if(_0x3c31fd['isBefore'](_0x2c7656)){var _0x2c6ac7=_0x1319c9[_0xc15b('0x13')]()[_0xc15b('0x16')]('day');var _0x1bee6f=_0x1319c9['clone']()[_0xc15b('0x17')](_0xc15b('0x18'));return _0x1319c9['isBetween'](_0x2c7656,_0x1bee6f,undefined,'[]')||_0x1319c9[_0xc15b('0x19')](_0x2c6ac7,_0x3c31fd,undefined,'[]');}else{return _0x1319c9[_0xc15b('0x19')](_0x2c7656,_0x3c31fd,undefined,'[]');}}module[_0xc15b('0xe')][_0xc15b('0x1a')]=timeCompare;function dowCompare(_0x3276e0,_0x4674d7,_0x216da0){var _0x276719=_0x3276e0[_0xc15b('0x9')]('en')[_0xc15b('0x1b')](_0xc15b('0x1c'))[_0xc15b('0xb')]();return circularDoWInterval(_0x4674d7,_0x216da0)[_0xc15b('0x1d')](_0x276719);}module['exports'][_0xc15b('0x1e')]=dowCompare;function domCompare(_0x5c9629,_0x254542,_0x9025b4){var _0x20def2=_0x5c9629[_0xc15b('0x1f')]();if(_0x254542===_0x9025b4){return _0x20def2===_0x254542;}else{var _0x1efde5=_0x5c9629[_0xc15b('0x20')]();var _0x1b4aa3=_0x254542<_0x9025b4;let _0x378d84=![];var _0x4f123b=0x0;var _0x2d0632=0x0;if(_0x1b4aa3){_0x4f123b=Math[_0xc15b('0x21')](0x1,_0x254542);_0x2d0632=Math[_0xc15b('0x22')](_0x9025b4,_0x1efde5);_0x378d84=_0x20def2>=_0x4f123b&&_0x20def2<=_0x2d0632;}else{_0x4f123b=Math['min'](_0x254542,_0x1efde5);_0x2d0632=Math['max'](0x1,_0x9025b4);_0x378d84=_0x20def2>=_0x4f123b||_0x20def2<=_0x2d0632;}return _0x378d84;}}module[_0xc15b('0xe')][_0xc15b('0x23')]=domCompare;function monthCompare(_0x15c709,_0x2b2928,_0x50abca){var _0x80dc27=_0x15c709['locale']('en')[_0xc15b('0x1b')](_0xc15b('0x24'))[_0xc15b('0xb')]();return circularMonthInterval(_0x2b2928,_0x50abca)[_0xc15b('0x1d')](_0x80dc27);}module[_0xc15b('0xe')][_0xc15b('0x25')]=monthCompare;function iftime(_0x2e49c7,_0x3b6e54=moment['tz'][_0xc15b('0x26')](),_0xb52286=moment()){if(!validateRx[_0xc15b('0x27')](_0x2e49c7)){throw new Error(EINVALID_STRING);}else{var _0x59e82b=(moment[_0xc15b('0x28')](_0xb52286)?_0xb52286['clone']():moment(_0xb52286))['tz'](_0x3b6e54)[_0xc15b('0x9')]('en');throwIfDateNotValid(_0x59e82b);var _0x16a6e9=_0x2e49c7[_0xc15b('0x8')](',');var _0x1b98fb=_0x16a6e9[0x0];var _0x3bcd0d=_0x16a6e9[0x1];var _0x8eaff=_0x16a6e9[0x2];var _0x2be7d9=_0x16a6e9[0x3];let _0x13fcf3=!![];if(_0x1b98fb!=='*'){var _0xaaacbc=_0x1b98fb[_0xc15b('0x8')]('-');var _0x4dd57f=_[_0xc15b('0x29')](_0xaaacbc[0x0],0x5,'0');var _0x1a155a=_0xaaacbc[_0xc15b('0x2a')]===0x2?_[_0xc15b('0x29')](_0xaaacbc[0x1],0x5,'0'):_0x4dd57f;_0x13fcf3=timeCompare(_0x59e82b,_0x4dd57f,_0x1a155a);}let _0x947153=!![];if(_0x3bcd0d!=='*'){var _0x493527=_0x3bcd0d[_0xc15b('0x8')]('-');var _0x1d2413=_0x493527[0x0];var _0x5f04fa=_0x493527[_0xc15b('0x2a')]===0x2?_0x493527[0x1]:_0x1d2413;_0x947153=dowCompare(_0x59e82b,_0x1d2413,_0x5f04fa);}let _0x58c19c=!![];if(_0x8eaff!=='*'){var _0x46f533=_0x8eaff[_0xc15b('0x8')]('-');var _0x588072=parseDom(_0x46f533[0x0]);var _0x3a8b32=_0x46f533[_0xc15b('0x2a')]===0x2?parseDom(_0x46f533[0x1]):_0x588072;_0x58c19c=domCompare(_0x59e82b,_0x588072,_0x3a8b32);}let _0x245ac2=!![];if(_0x2be7d9!=='*'){var _0x5d27de=_0x2be7d9[_0xc15b('0x8')]('-');var _0x881fef=_0x5d27de[0x0];var _0x5d1c03=_0x5d27de['length']===0x2?_0x5d27de[0x1]:_0x5d27de[0x0];_0x245ac2=monthCompare(_0x59e82b,_0x881fef,_0x5d1c03);}return _0x13fcf3&&_0x947153&&_0x58c19c&&_0x245ac2;}}module[_0xc15b('0xe')][_0xc15b('0x2b')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index b023eb8..301963d 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c52=['warn','transports','File','%s-%s','error','Console','consoleLogger','fileLogger','path','moment','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','}}}','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9c52,0x119));var _0x29c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c52[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x29c5('0x0'));var util=require('util');var moment=require(_0x29c5('0x1'));var winston=require('winston');var config=require(_0x29c5('0x2'));var debugLevel=config[_0x29c5('0x3')]?config[_0x29c5('0x3')][_0x29c5('0x4')]():_0x29c5('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x29c5('0x6'),'warn':_0x29c5('0x7'),'info':_0x29c5('0x8'),'print':_0x29c5('0x9'),'success':'bold\x20green','http':'gray','verbose':_0x29c5('0xa'),'debug':_0x29c5('0xb'),'silly':_0x29c5('0xc')};winston[_0x29c5('0xd')](XC_LOG_COLORS);function getLogFileName(_0x4f8317,_0x244863,_0x40a436){var _0x2aa54d=_0x4f8317||_0x29c5('0xe');return path[_0x29c5('0xf')](_0x2aa54d,util[_0x29c5('0x10')](_0x29c5('0x11'),_0x244863,_0x40a436));}function formatter(_0x556065,_0x20a996){_0x20a996[_0x29c5('0x12')]=_0x20a996[_0x29c5('0x12')][_0x29c5('0x13')](/@@{/g,_0x29c5('0x14'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x29c5('0x15'),moment()[_0x29c5('0x10')](_0x29c5('0x16')),_0x20a996[_0x29c5('0x17')]['toUpperCase'](),_0x556065,_0x20a996[_0x29c5('0x12')]);}function fileFormat(_0x29e439,_0x3fc7ef){_0x3fc7ef[_0x29c5('0x12')]=_0x3fc7ef[_0x29c5('0x12')]['replace'](/@@{/g,'{{{')[_0x29c5('0x13')](/}@@/g,_0x29c5('0x18'))[_0x29c5('0x13')](/@{/g,'{{')[_0x29c5('0x13')](/}@/g,'}}');var _0x2bd1a7=_0x3fc7ef[_0x29c5('0x19')]&&Object[_0x29c5('0x1a')](_0x3fc7ef[_0x29c5('0x19')])['length']?'\x0a\x09'+JSON[_0x29c5('0x1b')](_0x3fc7ef[_0x29c5('0x19')]):'';return util[_0x29c5('0x10')](_0x29c5('0x1c'),moment()[_0x29c5('0x10')](_0x29c5('0x16')),_0x3fc7ef[_0x29c5('0x17')][_0x29c5('0x1d')](),_0x29e439,_0x3fc7ef[_0x29c5('0x12')],_0x2bd1a7);}function consoleLogger(){var _0x5bffa2=new winston[(_0x29c5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x29c5('0x1f'),'json':![],'formatter':function(_0x5ef666){return formatter('',_0x5ef666);}})]});return _0x5bffa2;}function fileLogger(_0x42a9eb,_0x19491f){var _0x4e9f7f=new winston[(_0x29c5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x29c5('0x20'))][(_0x29c5('0x21'))]({'name':util[_0x29c5('0x10')](_0x29c5('0x22'),_0x42a9eb,'error'),'filename':getLogFileName(_0x19491f,_0x42a9eb,_0x29c5('0x23')),'level':_0x29c5('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x15cdca){return fileFormat(_0x42a9eb,_0x15cdca);}}),new winston[(_0x29c5('0x20'))]['File']({'name':util['format'](_0x29c5('0x22'),_0x42a9eb,debugLevel),'filename':getLogFileName(_0x19491f,_0x42a9eb,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x301fb2){return fileFormat(_0x42a9eb,_0x301fb2);}}),new winston['transports'][(_0x29c5('0x24'))]({'level':'warn','json':![],'formatter':function(_0x2c0843){return fileFormat(_0x42a9eb,_0x2c0843);}})]});return _0x4e9f7f;}exports[_0x29c5('0x25')]=consoleLogger;exports[_0x29c5('0x26')]=fileLogger; \ No newline at end of file +var _0x0f51=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','redBG\x20white','red','white','bold\x20white','bold\x20green','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}'];(function(_0x5152e9,_0x80dbbd){var _0x12e4b6=function(_0x17dc43){while(--_0x17dc43){_0x5152e9['push'](_0x5152e9['shift']());}};_0x12e4b6(++_0x80dbbd);}(_0x0f51,0x170));var _0x10f5=function(_0x3a5c6a,_0x290dd1){_0x3a5c6a=_0x3a5c6a-0x0;var _0x4ac43a=_0x0f51[_0x3a5c6a];return _0x4ac43a;};'use strict';var path=require(_0x10f5('0x0'));var util=require(_0x10f5('0x1'));var moment=require(_0x10f5('0x2'));var winston=require(_0x10f5('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x10f5('0x4')][_0x10f5('0x5')]():'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':_0x10f5('0x6'),'error':_0x10f5('0x7'),'warn':'bold\x20yellow','info':_0x10f5('0x8'),'print':_0x10f5('0x9'),'success':_0x10f5('0xa'),'http':'gray','verbose':'bold\x20magenta','debug':_0x10f5('0xb'),'silly':_0x10f5('0xc')};winston[_0x10f5('0xd')](XC_LOG_COLORS);function getLogFileName(_0x24c715,_0x35bbfc,_0x3f3cfb){var _0x4b4088=_0x24c715||_0x10f5('0xe');return path[_0x10f5('0xf')](_0x4b4088,util[_0x10f5('0x10')](_0x10f5('0x11'),_0x35bbfc,_0x3f3cfb));}function formatter(_0xe933aa,_0x62c694){_0x62c694[_0x10f5('0x12')]=_0x62c694[_0x10f5('0x12')][_0x10f5('0x13')](/@@{/g,_0x10f5('0x14'))['replace'](/}@@/g,_0x10f5('0x15'))[_0x10f5('0x13')](/@{/g,'{{')[_0x10f5('0x13')](/}@/g,'}}');return util[_0x10f5('0x10')](_0x10f5('0x16'),moment()[_0x10f5('0x10')](_0x10f5('0x17')),_0x62c694['level']['toUpperCase'](),_0xe933aa,_0x62c694[_0x10f5('0x12')]);}function fileFormat(_0x1464a6,_0x2b34da){_0x2b34da[_0x10f5('0x12')]=_0x2b34da[_0x10f5('0x12')][_0x10f5('0x13')](/@@{/g,_0x10f5('0x14'))[_0x10f5('0x13')](/}@@/g,_0x10f5('0x15'))[_0x10f5('0x13')](/@{/g,'{{')[_0x10f5('0x13')](/}@/g,'}}');var _0x5bbb8d=_0x2b34da[_0x10f5('0x18')]&&Object[_0x10f5('0x19')](_0x2b34da[_0x10f5('0x18')])[_0x10f5('0x1a')]?'\x0a\x09'+JSON[_0x10f5('0x1b')](_0x2b34da['meta']):'';return util['format'](_0x10f5('0x1c'),moment()[_0x10f5('0x10')](_0x10f5('0x17')),_0x2b34da['level'][_0x10f5('0x1d')](),_0x1464a6,_0x2b34da['message'],_0x5bbb8d);}function consoleLogger(){var _0x5ddab6=new winston[(_0x10f5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x10f5('0x1f'))][(_0x10f5('0x20'))]({'level':_0x10f5('0x21'),'json':![],'formatter':function(_0x2e9702){return formatter('',_0x2e9702);}})]});return _0x5ddab6;}function fileLogger(_0x5a2210,_0x518e84){var _0xd0e08d=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x10f5('0x1f'))][(_0x10f5('0x22'))]({'name':util['format'](_0x10f5('0x23'),_0x5a2210,_0x10f5('0x24')),'filename':getLogFileName(_0x518e84,_0x5a2210,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x491320){return fileFormat(_0x5a2210,_0x491320);}}),new winston[(_0x10f5('0x1f'))][(_0x10f5('0x22'))]({'name':util[_0x10f5('0x10')](_0x10f5('0x23'),_0x5a2210,debugLevel),'filename':getLogFileName(_0x518e84,_0x5a2210,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x37ea05){return fileFormat(_0x5a2210,_0x37ea05);}}),new winston[(_0x10f5('0x1f'))][(_0x10f5('0x20'))]({'level':_0x10f5('0x21'),'json':![],'formatter':function(_0x2a9fb2){return fileFormat(_0x5a2210,_0x2a9fb2);}})]});return _0xd0e08d;}exports[_0x10f5('0x25')]=consoleLogger;exports[_0x10f5('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 7e2b1c8..b9ea143 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x1a85,0x178));var _0x51a8=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0x1a85[_0x20d08e];return _0x2cbd12;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x0295,0x1f0));var _0x5029=function(_0x9b7721,_0x36ef2f){_0x9b7721=_0x9b7721-0x0;var _0x2c92de=_0x0295[_0x9b7721];return _0x2c92de;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 2d00c00..384e22f 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['\x5c$&','exports','replace'];(function(_0x200293,_0x37b867){var _0x496a1d=function(_0x3b03ca){while(--_0x3b03ca){_0x200293['push'](_0x200293['shift']());}};_0x496a1d(++_0x37b867);}(_0x5f2f,0x73));var _0xf5f2=function(_0x526ba2,_0x4a5be1){_0x526ba2=_0x526ba2-0x0;var _0x1094d2=_0x5f2f[_0x526ba2];return _0x1094d2;};module[_0xf5f2('0x0')]={'escapeRegExp'(_0x423dd9,_0x2dcf60=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x423dd9[_0xf5f2('0x1')](_0x2dcf60,_0xf5f2('0x2'));}}; \ No newline at end of file +var _0x1261=['replace','\x5c$&'];(function(_0x24c344,_0x5a8ecc){var _0x1dc732=function(_0xe5f613){while(--_0xe5f613){_0x24c344['push'](_0x24c344['shift']());}};_0x1dc732(++_0x5a8ecc);}(_0x1261,0x144));var _0x1126=function(_0x7aaac8,_0x3a4233){_0x7aaac8=_0x7aaac8-0x0;var _0x4a8013=_0x1261[_0x7aaac8];return _0x4a8013;};module['exports']={'escapeRegExp'(_0x234ea5,_0x26c6a0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x234ea5[_0x1126('0x0')](_0x26c6a0,_0x1126('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 27eed66..526f70e 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 _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x53f540,_0xcacc66){var _0x22d8e6=function(_0x2b8795){while(--_0x2b8795){_0x53f540['push'](_0x53f540['shift']());}};_0x22d8e6(++_0xcacc66);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file +var _0xb10b=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x1aae48,_0x3b2d29){var _0x4e6337=function(_0x32af66){while(--_0x32af66){_0x1aae48['push'](_0x1aae48['shift']());}};_0x4e6337(++_0x3b2d29);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f2327,_0x123bcd){_0x5f2327=_0x5f2327-0x0;var _0x304698=_0xb10b[_0x5f2327];return _0x304698;};var _=require(_0xbb10('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4bb7bb){return _0x4bb7bb==='{{'?_0xbb10('0x1'):_0xbb10('0x2');}function safeTemplate(_0x1dcb08){var _0x4d688c=_0x1dcb08;if(typeof _0x1dcb08===_0xbb10('0x3')){_0x4d688c=_0x1dcb08[_0xbb10('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xbb10('0x5')](_0x1dcb08)){_0x4d688c=_0x1dcb08[_0xbb10('0x6')](function(_0x49baf4){return safeTemplate(_0x49baf4);});}else if(_[_0xbb10('0x7')](_0x1dcb08)){_0x4d688c=Object['keys'](_0x1dcb08)[_0xbb10('0x8')](function(_0x3cdd53,_0x513741){_0x3cdd53[_0x513741]=safeTemplate(_0x1dcb08[_0x513741]);return _0x3cdd53;},{});}return _0x4d688c;}module[_0xbb10('0x9')][_0xbb10('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index daa56ad..3581c29 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 _0x1a0e=['motion2','NODE_PATH','string','env','pathExists','then','readJSON','updated','Updating\x20app.json','exports','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','name'];(function(_0xa989f6,_0x1a950e){var _0x50e6c7=function(_0x177e29){while(--_0x177e29){_0xa989f6['push'](_0xa989f6['shift']());}};_0x50e6c7(++_0x1a950e);}(_0x1a0e,0xee));var _0xe1a0=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x1a0e[_0x3f2fea];return _0x69a4d5;};var fs=require('fs-extra');var path=require(_0xe1a0('0x0'));var config=require(_0xe1a0('0x1'));var root=config[_0xe1a0('0x2')];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0xe1a0('0x3')](root,_0xe1a0('0x4'));function setLegacyLibsNodeEnvPath(_0x497300){let _0x263952=![];if(Array[_0xe1a0('0x5')](_0x497300[_0xe1a0('0x6')])){var _0x14e5a0=_0x497300[_0xe1a0('0x6')][_0xe1a0('0x7')](function(_0x250e16){return _0x250e16[_0xe1a0('0x8')]===_0xe1a0('0x9');});if(_0x14e5a0>-0x1){var _0x5c0561=_0x497300[_0xe1a0('0x6')][_0x14e5a0];if(typeof _0x5c0561['env'][_0xe1a0('0xa')]!==_0xe1a0('0xb')){_0x5c0561[_0xe1a0('0xc')]['NODE_PATH']=NODEPATH;_0x263952=!![];}}return{'appConfig':_0x497300,'updated':_0x263952};}}function updateAppConfig(_0x329a00){return fs[_0xe1a0('0xd')](APP_JSON_PATH)[_0xe1a0('0xe')](function(_0x4ee58a){if(_0x4ee58a){return fs[_0xe1a0('0xf')](APP_JSON_PATH)[_0xe1a0('0xe')](function(_0x5280af){var _0xd570bf=setLegacyLibsNodeEnvPath(_0x5280af);if(_0xd570bf[_0xe1a0('0x10')]){_0x329a00['info'](_0xe1a0('0x11'));return fs['writeJSON'](APP_JSON_PATH,_0x5280af,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xe1a0('0x3')]();}});}module[_0xe1a0('0x12')]=updateAppConfig; \ No newline at end of file +var _0xec70=['name','env','string','NODE_PATH','then','readJSON','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','resolve','server/app.json','legacy-libs','apps'];(function(_0x48263c,_0x257104){var _0x47f899=function(_0x54bfc5){while(--_0x54bfc5){_0x48263c['push'](_0x48263c['shift']());}};_0x47f899(++_0x257104);}(_0xec70,0x1da));var _0x0ec7=function(_0x3beb1f,_0xc0567a){_0x3beb1f=_0x3beb1f-0x0;var _0x7ace5b=_0xec70[_0x3beb1f];return _0x7ace5b;};var fs=require(_0x0ec7('0x0'));var path=require(_0x0ec7('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0x0ec7('0x2')](root,_0x0ec7('0x3'));var NODEPATH=path['resolve'](root,_0x0ec7('0x4'));function setLegacyLibsNodeEnvPath(_0x2429a8){let _0x17ac04=![];if(Array['isArray'](_0x2429a8[_0x0ec7('0x5')])){var _0x38eb8e=_0x2429a8[_0x0ec7('0x5')]['findIndex'](function(_0x302f7a){return _0x302f7a[_0x0ec7('0x6')]==='motion2';});if(_0x38eb8e>-0x1){var _0x3cf420=_0x2429a8[_0x0ec7('0x5')][_0x38eb8e];if(typeof _0x3cf420[_0x0ec7('0x7')]['NODE_PATH']!==_0x0ec7('0x8')){_0x3cf420[_0x0ec7('0x7')][_0x0ec7('0x9')]=NODEPATH;_0x17ac04=!![];}}return{'appConfig':_0x2429a8,'updated':_0x17ac04};}}function updateAppConfig(_0x30ac37){return fs['pathExists'](APP_JSON_PATH)[_0x0ec7('0xa')](function(_0x3feebb){if(_0x3feebb){return fs[_0x0ec7('0xb')](APP_JSON_PATH)['then'](function(_0x2e4dd3){var _0x5e4ceb=setLegacyLibsNodeEnvPath(_0x2e4dd3);if(_0x5e4ceb['updated']){_0x30ac37[_0x0ec7('0xc')](_0x0ec7('0xd'));return fs[_0x0ec7('0xe')](APP_JSON_PATH,_0x2e4dd3,{'spaces':0x2});}else{return Promise[_0x0ec7('0x2')]();}});}else{return Promise['resolve']();}});}module[_0x0ec7('0xf')]=updateAppConfig; \ No newline at end of file